From: Cris Di Sclafani Date: Thu, 29 Oct 2020 08:59:50 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=0bd84f1250710a6758ee0a4dc09523684ff325cb;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 0fc8f03..beeca61 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.4", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-10-29T08:51:59.200Z", "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 952aec7..7b269a6 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 _0x0ff6=['browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','sequelize','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward'];(function(_0xe295a8,_0x39b1db){var _0x238ea5=function(_0x227f49){while(--_0x227f49){_0xe295a8['push'](_0xe295a8['shift']());}};_0x238ea5(++_0x39b1db);}(_0x0ff6,0x96));var _0x60ff=function(_0x74a0c6,_0x327fee){_0x74a0c6=_0x74a0c6-0x0;var _0x2fb098=_0x0ff6[_0x74a0c6];return _0x2fb098;};'use strict';var Sequelize=require(_0x60ff('0x0'));module['exports']={'name':{'type':Sequelize[_0x60ff('0x1')],'get':function(_0x347337){return this[_0x60ff('0x2')](_0x60ff('0x3'));}},'action':{'type':Sequelize[_0x60ff('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x60ff('0x5'),_0x60ff('0x6'),_0x60ff('0x7'),_0x60ff('0x8'),_0x60ff('0x9'),_0x60ff('0xa'),'bot',_0x60ff('0xb')]],'msg':_0x60ff('0xc')}},'comment':_0x60ff('0xc')},'data1':{'type':Sequelize[_0x60ff('0x4')](0x1000),'comment':_0x60ff('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x60ff('0xe')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x60ff('0xf')},'data4':{'type':Sequelize[_0x60ff('0x4')](0x1000)},'data5':{'type':Sequelize[_0x60ff('0x4')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8acb=['sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','motionbar','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]'];(function(_0x87e03a,_0x164a98){var _0x31ecc7=function(_0x496357){while(--_0x496357){_0x87e03a['push'](_0x87e03a['shift']());}};_0x31ecc7(++_0x164a98);}(_0x8acb,0x17a));var _0xb8ac=function(_0x30ca29,_0x31ca7c){_0x30ca29=_0x30ca29-0x0;var _0x257e00=_0x8acb[_0x30ca29];return _0x257e00;};'use strict';var Sequelize=require(_0xb8ac('0x0'));module[_0xb8ac('0x1')]={'name':{'type':Sequelize[_0xb8ac('0x2')],'get':function(_0xbe9e26){return this[_0xb8ac('0x3')](_0xb8ac('0x4'));}},'action':{'type':Sequelize[_0xb8ac('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb8ac('0x6'),'integration',_0xb8ac('0x7'),'jscripty',_0xb8ac('0x8'),'browser',_0xb8ac('0x9'),_0xb8ac('0xa')]],'msg':_0xb8ac('0xb')}},'comment':_0xb8ac('0xb')},'data1':{'type':Sequelize[_0xb8ac('0x5')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0xb8ac('0x5')](0x1000),'comment':_0xb8ac('0xc')},'data3':{'type':Sequelize[_0xb8ac('0x5')](0x1000),'comment':_0xb8ac('0xd')},'data4':{'type':Sequelize[_0xb8ac('0x5')](0x1000)},'data5':{'type':Sequelize[_0xb8ac('0x5')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 7f1c781..edb8eef 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 _0xcb5f=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','update','destroy','then','sendStatus','error','stack','name','body','Action','find','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xcb5f,0x10e));var _0xfcb5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcb5f[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xfcb5('0x0'));var emlformat=require(_0xfcb5('0x1'));var rimraf=require(_0xfcb5('0x2'));var zipdir=require(_0xfcb5('0x3'));var jsonpatch=require(_0xfcb5('0x4'));var rp=require(_0xfcb5('0x5'));var moment=require('moment');var BPromise=require(_0xfcb5('0x6'));var Mustache=require(_0xfcb5('0x7'));var util=require(_0xfcb5('0x8'));var path=require(_0xfcb5('0x9'));var sox=require(_0xfcb5('0xa'));var csv=require(_0xfcb5('0xb'));var ejs=require(_0xfcb5('0xc'));var fs=require('fs');var _=require(_0xfcb5('0xd'));var squel=require(_0xfcb5('0xe'));var crypto=require(_0xfcb5('0xf'));var jsforce=require(_0xfcb5('0x10'));var deskjs=require(_0xfcb5('0x11'));var toCsv=require('to-csv');var querystring=require(_0xfcb5('0x12'));var Papa=require('papaparse');var Redis=require(_0xfcb5('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfcb5('0x14'));var hardwareService=require(_0xfcb5('0x15'));var logger=require(_0xfcb5('0x16'))(_0xfcb5('0x17'));var utils=require('../../config/utils');var config=require(_0xfcb5('0x18'));var db=require(_0xfcb5('0x19'))['db'];function respondWithStatusCode(_0x1702eb,_0x2035bb){_0x2035bb=_0x2035bb||0xcc;return function(_0x58d514){if(_0x58d514){return _0x1702eb['sendStatus'](_0x2035bb);}return _0x1702eb[_0xfcb5('0x1a')](_0x2035bb)[_0xfcb5('0x1b')]();};}function respondWithResult(_0x57bbd4,_0x186932){_0x186932=_0x186932||0xc8;return function(_0x3db906){if(_0x3db906){return _0x57bbd4[_0xfcb5('0x1a')](_0x186932)[_0xfcb5('0x1c')](_0x3db906);}};}function respondWithFilteredResult(_0x12fe28,_0x44f95d){return function(_0x10443e){if(_0x10443e){var _0x13b671=_0x10443e[_0xfcb5('0x1d')],_0x37e6b8=_0x44f95d[_0xfcb5('0x1e')],_0x1d871c=_0x44f95d[_0xfcb5('0x1e')]+_0x44f95d[_0xfcb5('0x1f')],_0xadd087;if(_0x1d871c>=_0x13b671){_0x1d871c=_0x13b671;_0xadd087=0xc8;}else{_0xadd087=0xce;}_0x12fe28[_0xfcb5('0x1a')](_0xadd087);return _0x12fe28[_0xfcb5('0x20')]('Content-Range',_0x37e6b8+'-'+_0x1d871c+'/'+_0x13b671)[_0xfcb5('0x1c')](_0x10443e);}return null;};}function patchUpdates(_0x37ba2e){return function(_0x40a0d5){try{jsonpatch[_0xfcb5('0x21')](_0x40a0d5,_0x37ba2e,!![]);}catch(_0xddff66){return BPromise[_0xfcb5('0x22')](_0xddff66);}return _0x40a0d5['save']();};}function saveUpdates(_0xb966c8,_0x56a141){return function(_0xb397cb){if(_0xb397cb){return _0xb397cb[_0xfcb5('0x23')](_0xb966c8)['then'](function(_0x56c518){return _0x56c518;});}return null;};}function removeEntity(_0x5bf078,_0xc2865d){return function(_0x13c889){if(_0x13c889){return _0x13c889[_0xfcb5('0x24')]()[_0xfcb5('0x25')](function(){_0x5bf078[_0xfcb5('0x1a')](0xcc)[_0xfcb5('0x1b')]();});}};}function handleEntityNotFound(_0x26185c,_0x370007){return function(_0x2c5b53){if(!_0x2c5b53){_0x26185c[_0xfcb5('0x26')](0x194);}return _0x2c5b53;};}function handleError(_0x131da8,_0x55cce1){_0x55cce1=_0x55cce1||0x1f4;return function(_0x53e4d2){logger[_0xfcb5('0x27')](_0x53e4d2[_0xfcb5('0x28')]);if(_0x53e4d2[_0xfcb5('0x29')]){delete _0x53e4d2['name'];}_0x131da8[_0xfcb5('0x1a')](_0x55cce1)['send'](_0x53e4d2);};}exports[_0xfcb5('0x23')]=function(_0x1ee08d,_0x468331){if(_0x1ee08d['body']['id']){delete _0x1ee08d[_0xfcb5('0x2a')]['id'];}return db[_0xfcb5('0x2b')][_0xfcb5('0x2c')]({'where':{'id':_0x1ee08d[_0xfcb5('0x2d')]['id']}})['then'](handleEntityNotFound(_0x468331,null))[_0xfcb5('0x25')](saveUpdates(_0x1ee08d[_0xfcb5('0x2a')],null))['then'](respondWithResult(_0x468331,null))['catch'](handleError(_0x468331,null));};exports['destroy']=function(_0x1ecf5c,_0x450f79){return db[_0xfcb5('0x2b')]['find']({'where':{'id':_0x1ecf5c['params']['id']}})[_0xfcb5('0x25')](handleEntityNotFound(_0x450f79,null))[_0xfcb5('0x25')](removeEntity(_0x450f79,null))[_0xfcb5('0x2e')](handleError(_0x450f79,null));}; \ No newline at end of file +var _0x9813=['sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','end','stack','name','send','Action','find','catch','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x9813,0xff));var _0x3981=function(_0x1abc5f,_0x1d28da){_0x1abc5f=_0x1abc5f-0x0;var _0x57a641=_0x9813[_0x1abc5f];return _0x57a641;};'use strict';var pdf=require(_0x3981('0x0'));var emlformat=require(_0x3981('0x1'));var rimraf=require(_0x3981('0x2'));var zipdir=require(_0x3981('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3981('0x4'));var moment=require(_0x3981('0x5'));var BPromise=require(_0x3981('0x6'));var Mustache=require(_0x3981('0x7'));var util=require(_0x3981('0x8'));var path=require(_0x3981('0x9'));var sox=require(_0x3981('0xa'));var csv=require(_0x3981('0xb'));var ejs=require(_0x3981('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3981('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3981('0xe'));var toCsv=require(_0x3981('0xb'));var querystring=require(_0x3981('0xf'));var Papa=require(_0x3981('0x10'));var Redis=require(_0x3981('0x11'));var authService=require(_0x3981('0x12'));var qs=require(_0x3981('0x13'));var as=require(_0x3981('0x14'));var hardwareService=require(_0x3981('0x15'));var logger=require(_0x3981('0x16'))(_0x3981('0x17'));var utils=require(_0x3981('0x18'));var config=require(_0x3981('0x19'));var db=require(_0x3981('0x1a'))['db'];function respondWithStatusCode(_0x1f9699,_0x1e802c){_0x1e802c=_0x1e802c||0xcc;return function(_0x50c978){if(_0x50c978){return _0x1f9699[_0x3981('0x1b')](_0x1e802c);}return _0x1f9699[_0x3981('0x1c')](_0x1e802c)['end']();};}function respondWithResult(_0x538063,_0xc850b2){_0xc850b2=_0xc850b2||0xc8;return function(_0x4b9ec5){if(_0x4b9ec5){return _0x538063[_0x3981('0x1c')](_0xc850b2)[_0x3981('0x1d')](_0x4b9ec5);}};}function respondWithFilteredResult(_0x5259f9,_0x303e22){return function(_0x3c0c93){if(_0x3c0c93){var _0x52fcc7=_0x3c0c93[_0x3981('0x1e')],_0x1a5567=_0x303e22[_0x3981('0x1f')],_0x137591=_0x303e22[_0x3981('0x1f')]+_0x303e22[_0x3981('0x20')],_0x5c95fa;if(_0x137591>=_0x52fcc7){_0x137591=_0x52fcc7;_0x5c95fa=0xc8;}else{_0x5c95fa=0xce;}_0x5259f9[_0x3981('0x1c')](_0x5c95fa);return _0x5259f9[_0x3981('0x21')](_0x3981('0x22'),_0x1a5567+'-'+_0x137591+'/'+_0x52fcc7)[_0x3981('0x1d')](_0x3c0c93);}return null;};}function patchUpdates(_0x10519b){return function(_0x2972b6){try{jsonpatch['apply'](_0x2972b6,_0x10519b,!![]);}catch(_0x432aec){return BPromise[_0x3981('0x23')](_0x432aec);}return _0x2972b6['save']();};}function saveUpdates(_0xf92de3,_0x11f892){return function(_0x57d9dd){if(_0x57d9dd){return _0x57d9dd[_0x3981('0x24')](_0xf92de3)[_0x3981('0x25')](function(_0x1611b3){return _0x1611b3;});}return null;};}function removeEntity(_0x3abb4c,_0x18092d){return function(_0xad0722){if(_0xad0722){return _0xad0722[_0x3981('0x26')]()['then'](function(){_0x3abb4c[_0x3981('0x1c')](0xcc)[_0x3981('0x27')]();});}};}function handleEntityNotFound(_0x2b202a,_0x22231d){return function(_0x556618){if(!_0x556618){_0x2b202a[_0x3981('0x1b')](0x194);}return _0x556618;};}function handleError(_0x36b9be,_0x35febf){_0x35febf=_0x35febf||0x1f4;return function(_0x2ff15b){logger['error'](_0x2ff15b[_0x3981('0x28')]);if(_0x2ff15b[_0x3981('0x29')]){delete _0x2ff15b['name'];}_0x36b9be[_0x3981('0x1c')](_0x35febf)[_0x3981('0x2a')](_0x2ff15b);};}exports[_0x3981('0x24')]=function(_0x331403,_0x5ce549){if(_0x331403['body']['id']){delete _0x331403['body']['id'];}return db[_0x3981('0x2b')][_0x3981('0x2c')]({'where':{'id':_0x331403['params']['id']}})[_0x3981('0x25')](handleEntityNotFound(_0x5ce549,null))['then'](saveUpdates(_0x331403['body'],null))[_0x3981('0x25')](respondWithResult(_0x5ce549,null))[_0x3981('0x2d')](handleError(_0x5ce549,null));};exports[_0x3981('0x26')]=function(_0x139e90,_0xf97f94){return db[_0x3981('0x2b')][_0x3981('0x2c')]({'where':{'id':_0x139e90[_0x3981('0x2e')]['id']}})['then'](handleEntityNotFound(_0xf97f94,null))[_0x3981('0x25')](removeEntity(_0xf97f94,null))[_0x3981('0x2d')](handleError(_0xf97f94,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index da952d4..e115337 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 _0xf9e1=['../../config/environment','./action.attributes','exports','define','Action','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1324f2,_0x54accc){var _0x5260b4=function(_0x4fc82f){while(--_0x4fc82f){_0x1324f2['push'](_0x1324f2['shift']());}};_0x5260b4(++_0x54accc);}(_0xf9e1,0xe2));var _0x1f9e=function(_0x571644,_0x41f832){_0x571644=_0x571644-0x0;var _0x3269a6=_0xf9e1[_0x571644];return _0x3269a6;};'use strict';var _=require(_0x1f9e('0x0'));var util=require(_0x1f9e('0x1'));var logger=require(_0x1f9e('0x2'))('api');var moment=require(_0x1f9e('0x3'));var BPromise=require(_0x1f9e('0x4'));var rp=require(_0x1f9e('0x5'));var fs=require('fs');var path=require(_0x1f9e('0x6'));var rimraf=require(_0x1f9e('0x7'));var config=require(_0x1f9e('0x8'));var attributes=require(_0x1f9e('0x9'));module[_0x1f9e('0xa')]=function(_0x4f6213,_0x19357e){return _0x4f6213[_0x1f9e('0xb')](_0x1f9e('0xc'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa278=['../../config/logger','api','bluebird','request-promise','path','rimraf','./action.attributes','exports','define','Action','tools_actions','lodash','util'];(function(_0x215454,_0x24d91f){var _0x14eb7c=function(_0x399011){while(--_0x399011){_0x215454['push'](_0x215454['shift']());}};_0x14eb7c(++_0x24d91f);}(_0xa278,0x184));var _0x8a27=function(_0x315b61,_0x4bb11e){_0x315b61=_0x315b61-0x0;var _0x3521e8=_0xa278[_0x315b61];return _0x3521e8;};'use strict';var _=require(_0x8a27('0x0'));var util=require(_0x8a27('0x1'));var logger=require(_0x8a27('0x2'))(_0x8a27('0x3'));var moment=require('moment');var BPromise=require(_0x8a27('0x4'));var rp=require(_0x8a27('0x5'));var fs=require('fs');var path=require(_0x8a27('0x6'));var rimraf=require(_0x8a27('0x7'));var config=require('../../config/environment');var attributes=require(_0x8a27('0x8'));module[_0x8a27('0x9')]=function(_0x3ba466,_0x228682){return _0x3ba466[_0x8a27('0xa')](_0x8a27('0xb'),attributes,{'tableName':_0x8a27('0xc'),'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 94875d4..76f2c61 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s'];(function(_0x2be133,_0x48a819){var _0x260334=function(_0x14f985){while(--_0x14f985){_0x2be133['push'](_0x2be133['shift']());}};_0x260334(++_0x48a819);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b4d43,_0x1590f7){_0x4b4d43=_0x4b4d43-0x0;var _0x5706ba=_0xcb91[_0x4b4d43];return _0x5706ba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('Action,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x130422,_0x43a473){var _0x598367=function(_0x5e8180){while(--_0x5e8180){_0x130422['push'](_0x130422['shift']());}};_0x598367(++_0x43a473);}(_0xe706,0xa3));var _0x6e70=function(_0x3253f3,_0x1c57d8){_0x3253f3=_0x3253f3-0x0;var _0x598c26=_0xe706[_0x3253f3];return _0x598c26;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('Action,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('Action,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 2ce09b9..946d652 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 _0x463a=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','/:id','update','isAuthenticated'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x463a,0x190));var _0xa463=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x463a[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require(_0xa463('0x0'));var util=require(_0xa463('0x1'));var path=require(_0xa463('0x2'));var timeout=require(_0xa463('0x3'));var express=require(_0xa463('0x4'));var router=express[_0xa463('0x5')]();var auth=require(_0xa463('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./action.controller');router['put'](_0xa463('0x7'),auth['isAuthenticated'](),controller[_0xa463('0x8')]);router['delete'](_0xa463('0x7'),auth[_0xa463('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3c44=['../../config/environment','put','update','/:id','isAuthenticated','exports','multer','connect-timeout','Router','../../components/interaction/service'];(function(_0xcaad19,_0x2fa6dc){var _0x397b45=function(_0x331437){while(--_0x331437){_0xcaad19['push'](_0xcaad19['shift']());}};_0x397b45(++_0x2fa6dc);}(_0x3c44,0x18c));var _0x43c4=function(_0x39d7c1,_0x3f1d0a){_0x39d7c1=_0x39d7c1-0x0;var _0x5ac8c2=_0x3c44[_0x39d7c1];return _0x5ac8c2;};'use strict';var multer=require(_0x43c4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x43c4('0x1'));var express=require('express');var router=express[_0x43c4('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x43c4('0x3'));var config=require(_0x43c4('0x4'));var controller=require('./action.controller');router[_0x43c4('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x43c4('0x6')]);router['delete'](_0x43c4('0x7'),auth[_0x43c4('0x8')](),controller['destroy']);module[_0x43c4('0x9')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index e3de946..bd03d0b 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 _0x0984=['TEXT','sequelize','STRING'];(function(_0x15a238,_0xdc6ea1){var _0x506955=function(_0x2b4e71){while(--_0x2b4e71){_0x15a238['push'](_0x15a238['shift']());}};_0x506955(++_0xdc6ea1);}(_0x0984,0x67));var _0x4098=function(_0x428952,_0x1d8b68){_0x428952=_0x428952-0x0;var _0x4283bb=_0x0984[_0x428952];return _0x4283bb;};'use strict';var Sequelize=require(_0x4098('0x0'));module['exports']={'name':{'type':Sequelize[_0x4098('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4098('0x1')]},'parent':{'type':Sequelize[_0x4098('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x4098('0x2')]},'joins':{'type':Sequelize[_0x4098('0x2')]}}; \ No newline at end of file +var _0x5658=['STRING','TEXT','sequelize'];(function(_0x753dd1,_0x3c1670){var _0x262c9c=function(_0x27d319){while(--_0x27d319){_0x753dd1['push'](_0x753dd1['shift']());}};_0x262c9c(++_0x3c1670);}(_0x5658,0x164));var _0x8565=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5658[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x8565('0x0'));module['exports']={'name':{'type':Sequelize[_0x8565('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8565('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8565('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 5278b39..ee855f7 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 _0xb2b5=['SUM(%s)','Please\x20insert\x20at\x20least\x20one\x20field','metric','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','error','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','findAll','rows','catch','params','merge','options','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','cross_join','COUNT(%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)','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','value','getFields','Sequelize','AnalyticMetric','table','MetricId','function','replace','format','orderBy','order','DESC','alias','joins','parse','type','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','IS\x20NULL','IS\x20NOT\x20EMPTY','operator','condition','ValidationErrorItem','keyBy','select','from','groupBy','No\x20available\x20data','output','fullPath','%s-%s.%s','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','run','runReport'];(function(_0x122a34,_0x1ea0c5){var _0x3b526f=function(_0x3bf5dd){while(--_0x3bf5dd){_0x122a34['push'](_0x122a34['shift']());}};_0x3b526f(++_0x1ea0c5);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xb2b5[_0x51020b];return _0x371e47;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5b2b('0x0'));var rp=require(_0x5b2b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5b2b('0x2'));var util=require(_0x5b2b('0x3'));var path=require(_0x5b2b('0x4'));var sox=require(_0x5b2b('0x5'));var csv=require('to-csv');var ejs=require(_0x5b2b('0x6'));var fs=require('fs');var _=require(_0x5b2b('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5b2b('0x8'));var deskjs=require(_0x5b2b('0x9'));var toCsv=require(_0x5b2b('0xa'));var querystring=require(_0x5b2b('0xb'));var Papa=require(_0x5b2b('0xc'));var Redis=require(_0x5b2b('0xd'));var authService=require(_0x5b2b('0xe'));var qs=require(_0x5b2b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b2b('0x10'));var logger=require(_0x5b2b('0x11'))('api');var utils=require(_0x5b2b('0x12'));var config=require(_0x5b2b('0x13'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5b2b('0x14'))[_0x5b2b('0x15')];function respondWithStatusCode(_0xfe1936,_0x12f1f8){_0x12f1f8=_0x12f1f8||0xcc;return function(_0x2efc16){if(_0x2efc16){return _0xfe1936[_0x5b2b('0x16')](_0x12f1f8);}return _0xfe1936[_0x5b2b('0x17')](_0x12f1f8)['end']();};}function respondWithResult(_0x30e9a3,_0x4fa243){_0x4fa243=_0x4fa243||0xc8;return function(_0x39dad7){if(_0x39dad7){return _0x30e9a3[_0x5b2b('0x17')](_0x4fa243)[_0x5b2b('0x18')](_0x39dad7);}};}function respondWithFilteredResult(_0x2611a3,_0x4ff4ba){return function(_0x310060){if(_0x310060){var _0x57b38f=_0x310060[_0x5b2b('0x19')],_0x3dd404=_0x4ff4ba[_0x5b2b('0x1a')],_0x481d65=_0x4ff4ba['offset']+_0x4ff4ba[_0x5b2b('0x1b')],_0x56ca46;if(_0x481d65>=_0x57b38f){_0x481d65=_0x57b38f;_0x56ca46=0xc8;}else{_0x56ca46=0xce;}_0x2611a3[_0x5b2b('0x17')](_0x56ca46);return _0x2611a3[_0x5b2b('0x1c')](_0x5b2b('0x1d'),_0x3dd404+'-'+_0x481d65+'/'+_0x57b38f)[_0x5b2b('0x18')](_0x310060);}return null;};}function patchUpdates(_0x47bb1b){return function(_0x35b589){try{jsonpatch[_0x5b2b('0x1e')](_0x35b589,_0x47bb1b,!![]);}catch(_0x38f083){return BPromise[_0x5b2b('0x1f')](_0x38f083);}return _0x35b589[_0x5b2b('0x20')]();};}function saveUpdates(_0x42f0ed,_0x11cc3e){return function(_0x208c1f){if(_0x208c1f){return _0x208c1f[_0x5b2b('0x21')](_0x42f0ed)[_0x5b2b('0x22')](function(_0x34c624){return _0x34c624;});}return null;};}function removeEntity(_0xa8ebd5,_0x2de273){return function(_0x5fdeb1){if(_0x5fdeb1){return _0x5fdeb1['destroy']()['then'](function(){var _0xfdaeed=_0x5fdeb1['get']({'plain':!![]});var _0x3a530f='CustomReports';return db[_0x5b2b('0x23')][_0x5b2b('0x24')]({'where':{'type':_0x3a530f,'resourceId':_0xfdaeed['id']}})[_0x5b2b('0x22')](function(){return _0x5fdeb1;});})[_0x5b2b('0x22')](function(){_0xa8ebd5[_0x5b2b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x923346,_0x3e97dc){return function(_0x55b05c){if(!_0x55b05c){_0x923346[_0x5b2b('0x16')](0x194);}return _0x55b05c;};}function handleError(_0x1fa64b,_0x49fca6){_0x49fca6=_0x49fca6||0x1f4;return function(_0x2425df){logger[_0x5b2b('0x25')](_0x2425df[_0x5b2b('0x26')]);if(_0x2425df[_0x5b2b('0x27')]){delete _0x2425df[_0x5b2b('0x27')];}_0x1fa64b[_0x5b2b('0x17')](_0x49fca6)['send'](_0x2425df);};}exports[_0x5b2b('0x28')]=function(_0x42b46c,_0xf5f479){var _0x4162f6={},_0x45a0cd={},_0x5930ef={'count':0x0,'rows':[]};var _0x3ff027=_[_0x5b2b('0x29')](db[_0x5b2b('0x2a')][_0x5b2b('0x2b')],function(_0xbe2fc9){return{'name':_0xbe2fc9[_0x5b2b('0x2c')],'type':_0xbe2fc9['type'][_0x5b2b('0x2d')]};});_0x45a0cd[_0x5b2b('0x2e')]=_[_0x5b2b('0x29')](_0x3ff027,_0x5b2b('0x27'));_0x45a0cd[_0x5b2b('0x2f')]=_[_0x5b2b('0x30')](_0x42b46c[_0x5b2b('0x2f')]);_0x45a0cd[_0x5b2b('0x31')]=_[_0x5b2b('0x32')](_0x45a0cd[_0x5b2b('0x2e')],_0x45a0cd['query']);_0x4162f6[_0x5b2b('0x33')]=_[_0x5b2b('0x32')](_0x45a0cd[_0x5b2b('0x2e')],qs[_0x5b2b('0x34')](_0x42b46c[_0x5b2b('0x2f')][_0x5b2b('0x34')]));_0x4162f6[_0x5b2b('0x33')]=_0x4162f6[_0x5b2b('0x33')][_0x5b2b('0x35')]?_0x4162f6['attributes']:_0x45a0cd[_0x5b2b('0x2e')];if(!_0x42b46c[_0x5b2b('0x2f')][_0x5b2b('0x36')](_0x5b2b('0x37'))){_0x4162f6['limit']=qs['limit'](_0x42b46c[_0x5b2b('0x2f')]['limit']);_0x4162f6[_0x5b2b('0x1a')]=qs[_0x5b2b('0x1a')](_0x42b46c[_0x5b2b('0x2f')][_0x5b2b('0x1a')]);}_0x4162f6['order']=qs[_0x5b2b('0x38')](_0x42b46c[_0x5b2b('0x2f')][_0x5b2b('0x38')]);_0x4162f6[_0x5b2b('0x39')]=qs[_0x5b2b('0x31')](_[_0x5b2b('0x3a')](_0x42b46c[_0x5b2b('0x2f')],_0x45a0cd['filters']),_0x3ff027);if(_0x42b46c['query'][_0x5b2b('0x3b')]){_0x4162f6[_0x5b2b('0x39')]=_['merge'](_0x4162f6[_0x5b2b('0x39')],{'$or':_[_0x5b2b('0x29')](_0x3ff027,function(_0x501615){if(_0x501615['type']!=='VIRTUAL'){var _0x30c4e0={};_0x30c4e0[_0x501615[_0x5b2b('0x27')]]={'$like':'%'+_0x42b46c[_0x5b2b('0x2f')][_0x5b2b('0x3b')]+'%'};return _0x30c4e0;}})});}_0x4162f6=_['merge']({},_0x4162f6,_0x42b46c['options']);var _0xb3f4dc={'where':_0x4162f6['where']};return db[_0x5b2b('0x2a')][_0x5b2b('0x19')](_0xb3f4dc)[_0x5b2b('0x22')](function(_0x4910e8){_0x5930ef[_0x5b2b('0x19')]=_0x4910e8;if(_0x42b46c['query']['includeAll']){_0x4162f6['include']=[{'all':!![]}];}return db[_0x5b2b('0x2a')][_0x5b2b('0x3c')](_0x4162f6);})[_0x5b2b('0x22')](function(_0xea78d){_0x5930ef[_0x5b2b('0x3d')]=_0xea78d;return _0x5930ef;})['then'](respondWithFilteredResult(_0xf5f479,_0x4162f6))[_0x5b2b('0x3e')](handleError(_0xf5f479,null));};exports['show']=function(_0x18065c,_0x225e50){var _0x5bcbe0={'raw':![],'where':{'id':_0x18065c[_0x5b2b('0x3f')]['id']}},_0x2374f8={};_0x2374f8['model']=_[_0x5b2b('0x30')](db[_0x5b2b('0x2a')][_0x5b2b('0x2b')]);_0x2374f8['query']=_[_0x5b2b('0x30')](_0x18065c[_0x5b2b('0x2f')]);_0x2374f8[_0x5b2b('0x31')]=_[_0x5b2b('0x32')](_0x2374f8[_0x5b2b('0x2e')],_0x2374f8[_0x5b2b('0x2f')]);_0x5bcbe0[_0x5b2b('0x33')]=_[_0x5b2b('0x32')](_0x2374f8[_0x5b2b('0x2e')],qs['fields'](_0x18065c[_0x5b2b('0x2f')][_0x5b2b('0x34')]));_0x5bcbe0[_0x5b2b('0x33')]=_0x5bcbe0[_0x5b2b('0x33')][_0x5b2b('0x35')]?_0x5bcbe0[_0x5b2b('0x33')]:_0x2374f8['model'];if(_0x18065c['query']['includeAll']){_0x5bcbe0['include']=[{'all':!![]}];}_0x5bcbe0=_[_0x5b2b('0x40')]({},_0x5bcbe0,_0x18065c[_0x5b2b('0x41')]);return db[_0x5b2b('0x2a')][_0x5b2b('0x42')](_0x5bcbe0)[_0x5b2b('0x22')](handleEntityNotFound(_0x225e50,null))[_0x5b2b('0x22')](respondWithResult(_0x225e50,null))[_0x5b2b('0x3e')](handleError(_0x225e50,null));};exports['create']=function(_0x43ddd5,_0x1f814c){return db['AnalyticCustomReport']['create'](_0x43ddd5[_0x5b2b('0x43')],{})['then'](function(_0x5a6b8e){var _0x40b8ee=_0x43ddd5[_0x5b2b('0x44')][_0x5b2b('0x45')]({'plain':!![]});if(!_0x40b8ee)throw new Error(_0x5b2b('0x46'));if(_0x40b8ee['role']===_0x5b2b('0x44')){var _0x2d14cc=_0x5a6b8e['get']({'plain':!![]});var _0x5612f3=_0x5b2b('0x47');return db[_0x5b2b('0x48')][_0x5b2b('0x42')]({'where':{'name':_0x5612f3,'userProfileId':_0x40b8ee['userProfileId']},'raw':!![]})['then'](function(_0x1eddab){if(_0x1eddab&&_0x1eddab[_0x5b2b('0x49')]===0x0){return db['UserProfileResource'][_0x5b2b('0x4a')]({'name':_0x2d14cc[_0x5b2b('0x27')],'resourceId':_0x2d14cc['id'],'type':'CustomReports','sectionId':_0x1eddab['id']},{})[_0x5b2b('0x22')](function(){return _0x5a6b8e;});}else{return _0x5a6b8e;}})['catch'](function(_0x5da3df){logger[_0x5b2b('0x25')](_0x5b2b('0x4b'),_0x5da3df);throw _0x5da3df;});}return _0x5a6b8e;})[_0x5b2b('0x22')](respondWithResult(_0x1f814c,0xc9))[_0x5b2b('0x3e')](handleError(_0x1f814c,null));};exports['update']=function(_0xa7da0d,_0x57e376){if(_0xa7da0d[_0x5b2b('0x43')]['id']){delete _0xa7da0d['body']['id'];}return db[_0x5b2b('0x2a')][_0x5b2b('0x42')]({'where':{'id':_0xa7da0d[_0x5b2b('0x3f')]['id']}})[_0x5b2b('0x22')](handleEntityNotFound(_0x57e376,null))['then'](saveUpdates(_0xa7da0d[_0x5b2b('0x43')],null))[_0x5b2b('0x22')](respondWithResult(_0x57e376,null))[_0x5b2b('0x3e')](handleError(_0x57e376,null));};exports['destroy']=function(_0x42fac9,_0x5a0e86){return db['AnalyticCustomReport'][_0x5b2b('0x42')]({'where':{'id':_0x42fac9[_0x5b2b('0x3f')]['id']}})[_0x5b2b('0x22')](handleEntityNotFound(_0x5a0e86,null))[_0x5b2b('0x22')](removeEntity(_0x5a0e86,null))[_0x5b2b('0x3e')](handleError(_0x5a0e86,null));};exports[_0x5b2b('0x4c')]=function(_0x3df1aa,_0x5b8b0e){var _0x45cf58=0xa;var _0x41d14f=[_0x5b2b('0x4d'),'left_join',_0x5b2b('0x4e'),_0x5b2b('0x4f')];var _0x5972d1={'SUM':'SUM(%s)','COUNT':_0x5b2b('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5b2b('0x51'),'MIN':_0x5b2b('0x52'),'AVG':_0x5b2b('0x53'),'GROUP_CONCAT':_0x5b2b('0x54'),'GROUP_CONCAT ASC':_0x5b2b('0x55'),'GROUP_CONCAT DESC':_0x5b2b('0x56')};var _0x3598d6={'SEC_TO_TIME':_0x5b2b('0x57'),'DATE':_0x5b2b('0x58'),'HOUR':_0x5b2b('0x59'),'ROUND':_0x5b2b('0x5a'),'UNIX_TIMESTAMP':_0x5b2b('0x5b')};var _0x31f193=function(_0x348a87){return!_['includes'](['IS\x20NULL',_0x5b2b('0x5c'),_0x5b2b('0x5d'),'IS\x20NOT\x20EMPTY'],_0x348a87);};var _0x581a72=function(_0x3a91cf){if(!_0x3a91cf||!_0x3a91cf[_0x5b2b('0x5e')][_0x5b2b('0x35')]){return'';}for(var _0x1be3e0='(',_0x40af7b=0x0;_0x40af7b<_0x3a91cf[_0x5b2b('0x5e')][_0x5b2b('0x35')];_0x40af7b+=0x1){_0x40af7b>0x0&&(_0x1be3e0+='\x20'+_0x3a91cf['operator']+'\x20');_0x1be3e0+=_0x3a91cf['rules'][_0x40af7b]['group']?_0x581a72(_0x3a91cf[_0x5b2b('0x5e')][_0x40af7b][_0x5b2b('0x5f')]):_0x3a91cf[_0x5b2b('0x5e')][_0x40af7b][_0x5b2b('0x60')]+'\x20'+_0x3a91cf[_0x5b2b('0x5e')][_0x40af7b]['condition']+(_0x31f193(_0x3a91cf[_0x5b2b('0x5e')][_0x40af7b]['condition'])?'\x20'+_0x3a91cf[_0x5b2b('0x5e')][_0x40af7b][_0x5b2b('0x61')]:'');}return _0x1be3e0+')';};var _0x536813={'where':{'id':_0x3df1aa[_0x5b2b('0x3f')]['id']}},_0x2b443f,_0x511b02,_0x27cf7a,_0x467624,_0x56e334;_0x536813=_[_0x5b2b('0x40')]({},_0x536813,_0x3df1aa[_0x5b2b('0x41')]);return db[_0x5b2b('0x2a')][_0x5b2b('0x42')](_0x536813)[_0x5b2b('0x22')](function(_0x494a6d){if(_0x494a6d){_0x2b443f=_0x494a6d;return _0x494a6d[_0x5b2b('0x62')]();}return null;})[_0x5b2b('0x22')](function(_0x5df24e){if(_0x5df24e){if(!_0x5df24e[_0x5b2b('0x35')]){throw new db[(_0x5b2b('0x63'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x511b02=_0x5df24e;return db[_0x5b2b('0x64')][_0x5b2b('0x3c')]({'raw':!![]});}return null;})[_0x5b2b('0x22')](function(_0x1c29ed){if(_0x1c29ed){_0x27cf7a=_['keyBy'](_0x1c29ed,'id');var _0x27a30b;var _0x560f16=squel['select']();_0x560f16['from'](_0x2b443f[_0x5b2b('0x65')]);for(var _0x162bca=0x0;_0x162bca<_0x511b02['length'];_0x162bca+=0x1){_0x27a30b=_0x511b02[_0x162bca][_0x5b2b('0x66')]?_0x27cf7a[_0x511b02[_0x162bca][_0x5b2b('0x66')]]['metric']:_0x511b02[_0x162bca]['field'];_0x27a30b=_0x511b02[_0x162bca][_0x5b2b('0x67')]?_[_0x5b2b('0x68')](_0x5972d1[_0x511b02[_0x162bca][_0x5b2b('0x67')]],'%s',_0x27a30b):_0x27a30b;_0x27a30b=_0x511b02[_0x162bca]['format']?_['replace'](_0x3598d6[_0x511b02[_0x162bca][_0x5b2b('0x69')]],'%s',_0x27a30b):_0x27a30b;if(_0x511b02[_0x162bca]['groupBy']){_0x560f16[_0x5b2b('0x5f')](_0x27a30b);}_0x511b02[_0x162bca][_0x5b2b('0x6a')]&&_0x560f16[_0x5b2b('0x6b')](_0x27a30b,_0x511b02[_0x162bca][_0x5b2b('0x6a')]===_0x5b2b('0x6c')?![]:!![]);_0x560f16[_0x5b2b('0x60')](_0x27a30b,_0x511b02[_0x162bca][_0x5b2b('0x6d')]||_0x27a30b);}if(_0x2b443f['joins']){_0x2b443f[_0x5b2b('0x6e')]=JSON[_0x5b2b('0x6f')](_0x2b443f['joins']);for(var _0x568657=0x0;_0x568657<_0x2b443f[_0x5b2b('0x6e')][_0x5b2b('0x35')];_0x568657+=0x1){if(_0x2b443f['joins'][_0x568657][_0x5b2b('0x70')]&&_[_0x5b2b('0x71')](_0x41d14f,_0x2b443f['joins'][_0x568657][_0x5b2b('0x70')])&&_0x2b443f[_0x5b2b('0x6e')][_0x568657][_0x5b2b('0x72')]&&_0x2b443f[_0x5b2b('0x6e')][_0x568657][_0x5b2b('0x73')]&&_0x2b443f[_0x5b2b('0x6e')][_0x568657][_0x5b2b('0x74')]){_0x560f16[_0x2b443f[_0x5b2b('0x6e')][_0x568657][_0x5b2b('0x70')]](_0x2b443f['joins'][_0x568657]['foreignTable'],null,util[_0x5b2b('0x69')](_0x5b2b('0x75'),_0x2b443f[_0x5b2b('0x65')],_0x2b443f[_0x5b2b('0x6e')][_0x568657]['parentKey'],_0x2b443f[_0x5b2b('0x6e')][_0x568657][_0x5b2b('0x73')],_0x2b443f['joins'][_0x568657][_0x5b2b('0x74')]));}}}if(_0x2b443f['conditions']){_0x2b443f['conditions']=JSON['parse'](_0x2b443f[_0x5b2b('0x76')]);_0x560f16[_0x5b2b('0x39')](_0x581a72(_0x2b443f[_0x5b2b('0x76')]['group']));}_0x56e334=_0x560f16[_0x5b2b('0x77')]();_0x560f16['limit'](_0x45cf58);_0x560f16[_0x5b2b('0x1a')](0x0);logger[_0x5b2b('0x78')](_0x5b2b('0x79'),_0x560f16[_0x5b2b('0x7a')]());return db['sequelize'][_0x5b2b('0x2f')](_0x560f16[_0x5b2b('0x7a')](),{'type':db[_0x5b2b('0x7b')][_0x5b2b('0x7c')][_0x5b2b('0x7d')]});}})[_0x5b2b('0x22')](respondWithResult(_0x5b8b0e,null))[_0x5b2b('0x3e')](handleError(_0x5b8b0e,null));};function runReport(_0x50a973,_0x2dcfa1,_0x5aeeeb){var _0x1e8158=_0x2dcfa1[_0x5b2b('0x27')];var _0x1604f0=0xa;var _0x20c6a1=[_0x5b2b('0x4d'),_0x5b2b('0x7e'),_0x5b2b('0x4e'),'cross_join'];var _0x112209={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5b2b('0x7f'),'MAX':'MAX(%s)','MIN':_0x5b2b('0x52'),'AVG':_0x5b2b('0x53'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5b2b('0x55'),'GROUP_CONCAT DESC':_0x5b2b('0x56')};var _0x40aeea={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x5b2b('0x59'),'ROUND':_0x5b2b('0x5a'),'UNIX_TIMESTAMP':_0x5b2b('0x5b')};var _0x248310=function(_0x1076cd){return!_[_0x5b2b('0x71')]([_0x5b2b('0x80'),_0x5b2b('0x5c'),_0x5b2b('0x5d'),_0x5b2b('0x81')],_0x1076cd);};var _0x2e91e6=function(_0x26e352){if(!_0x26e352||!_0x26e352[_0x5b2b('0x5e')][_0x5b2b('0x35')]){return'';}for(var _0xb96606='(',_0xe76f6=0x0;_0xe76f6<_0x26e352['rules'][_0x5b2b('0x35')];_0xe76f6+=0x1){_0xe76f6>0x0&&(_0xb96606+='\x20'+_0x26e352[_0x5b2b('0x82')]+'\x20');_0xb96606+=_0x26e352[_0x5b2b('0x5e')][_0xe76f6][_0x5b2b('0x5f')]?_0x2e91e6(_0x26e352[_0x5b2b('0x5e')][_0xe76f6][_0x5b2b('0x5f')]):_0x26e352[_0x5b2b('0x5e')][_0xe76f6]['field']+'\x20'+_0x26e352[_0x5b2b('0x5e')][_0xe76f6][_0x5b2b('0x83')]+(_0x248310(_0x26e352['rules'][_0xe76f6][_0x5b2b('0x83')])?'\x20'+_0x26e352[_0x5b2b('0x5e')][_0xe76f6][_0x5b2b('0x61')]:'');}return _0xb96606+')';};var _0x522cbf={'where':{'id':_0x50a973['id']}},_0x4b8f7a,_0x1bc5ab,_0x2a0c9d,_0x414a65,_0x34d21d;_0x522cbf=_[_0x5b2b('0x40')]({},_0x522cbf,_0x5aeeeb);return db[_0x5b2b('0x2a')]['find'](_0x522cbf)[_0x5b2b('0x22')](function(_0x3163ed){if(_0x3163ed){_0x4b8f7a=_0x3163ed;return _0x3163ed['getFields']();}return null;})[_0x5b2b('0x22')](function(_0x20f378){if(_0x20f378){if(!_0x20f378['length']){throw new db[(_0x5b2b('0x63'))][(_0x5b2b('0x84'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1bc5ab=_0x20f378;return db[_0x5b2b('0x64')][_0x5b2b('0x3c')]({'raw':!![]});}return null;})[_0x5b2b('0x22')](function(_0x57213c){if(_0x57213c){_0x2a0c9d=_[_0x5b2b('0x85')](_0x57213c,'id');var _0x57a8c0;var _0x3821d2=squel[_0x5b2b('0x86')]();_0x3821d2[_0x5b2b('0x87')](_0x4b8f7a[_0x5b2b('0x65')]);for(var _0xf05d20=0x0;_0xf05d20<_0x1bc5ab[_0x5b2b('0x35')];_0xf05d20+=0x1){_0x57a8c0=_0x1bc5ab[_0xf05d20][_0x5b2b('0x66')]?_0x2a0c9d[_0x1bc5ab[_0xf05d20]['MetricId']]['metric']:_0x1bc5ab[_0xf05d20][_0x5b2b('0x60')];_0x57a8c0=_0x1bc5ab[_0xf05d20][_0x5b2b('0x67')]?_['replace'](_0x112209[_0x1bc5ab[_0xf05d20][_0x5b2b('0x67')]],'%s',_0x57a8c0):_0x57a8c0;_0x57a8c0=_0x1bc5ab[_0xf05d20]['format']?_[_0x5b2b('0x68')](_0x40aeea[_0x1bc5ab[_0xf05d20][_0x5b2b('0x69')]],'%s',_0x57a8c0):_0x57a8c0;if(_0x1bc5ab[_0xf05d20][_0x5b2b('0x88')]){_0x3821d2[_0x5b2b('0x5f')](_0x57a8c0);}_0x1bc5ab[_0xf05d20]['orderBy']&&_0x3821d2['order'](_0x57a8c0,_0x1bc5ab[_0xf05d20]['orderBy']===_0x5b2b('0x6c')?![]:!![]);_0x3821d2[_0x5b2b('0x60')](_0x57a8c0,_0x1bc5ab[_0xf05d20][_0x5b2b('0x6d')]||_0x57a8c0);}if(_0x4b8f7a[_0x5b2b('0x6e')]){_0x4b8f7a[_0x5b2b('0x6e')]=JSON[_0x5b2b('0x6f')](_0x4b8f7a[_0x5b2b('0x6e')]);for(var _0x4e037a=0x0;_0x4e037a<_0x4b8f7a[_0x5b2b('0x6e')][_0x5b2b('0x35')];_0x4e037a+=0x1){if(_0x4b8f7a[_0x5b2b('0x6e')][_0x4e037a]['type']&&_[_0x5b2b('0x71')](_0x20c6a1,_0x4b8f7a['joins'][_0x4e037a][_0x5b2b('0x70')])&&_0x4b8f7a[_0x5b2b('0x6e')][_0x4e037a]['parentKey']&&_0x4b8f7a[_0x5b2b('0x6e')][_0x4e037a]['foreignTable']&&_0x4b8f7a[_0x5b2b('0x6e')][_0x4e037a][_0x5b2b('0x74')]){_0x3821d2[_0x4b8f7a[_0x5b2b('0x6e')][_0x4e037a][_0x5b2b('0x70')]](_0x4b8f7a[_0x5b2b('0x6e')][_0x4e037a][_0x5b2b('0x73')],null,util[_0x5b2b('0x69')](_0x5b2b('0x75'),_0x4b8f7a[_0x5b2b('0x65')],_0x4b8f7a[_0x5b2b('0x6e')][_0x4e037a]['parentKey'],_0x4b8f7a[_0x5b2b('0x6e')][_0x4e037a][_0x5b2b('0x73')],_0x4b8f7a[_0x5b2b('0x6e')][_0x4e037a][_0x5b2b('0x74')]));}}}if(_0x4b8f7a[_0x5b2b('0x76')]){_0x4b8f7a[_0x5b2b('0x76')]=JSON[_0x5b2b('0x6f')](_0x4b8f7a[_0x5b2b('0x76')]);_0x3821d2[_0x5b2b('0x39')](_0x2e91e6(_0x4b8f7a[_0x5b2b('0x76')][_0x5b2b('0x5f')]));}_0x34d21d=_0x3821d2[_0x5b2b('0x77')]();_0x3821d2[_0x5b2b('0x1b')](_0x1604f0);_0x3821d2['offset'](0x0);logger[_0x5b2b('0x78')](_0x5b2b('0x79'),_0x3821d2['toString']());return db[_0x5b2b('0x7b')]['query'](_0x3821d2[_0x5b2b('0x7a')](),{'type':db['sequelize']['QueryTypes'][_0x5b2b('0x7d')]});}})[_0x5b2b('0x22')](function(_0x1d9882){if(!_0x1d9882['length']){throw new db[(_0x5b2b('0x63'))]['ValidationErrorItem'](_0x5b2b('0x89'),0xcc);}if(_0x2dcfa1[_0x5b2b('0x8a')]==='web'){return null;}var _0x5ced15=_[_0x5b2b('0x40')](_0x2dcfa1,{'name':_0x2dcfa1[_0x5b2b('0x8b')]||_0x2dcfa1[_0x5b2b('0x27')]||_0x4b8f7a[_0x5b2b('0x27')],'basename':_0x1e8158,'savename':util['format'](_0x5b2b('0x8c'),_0x2dcfa1['name']||_0x4b8f7a['name'],require('randomstring')['generate'](0x4),_0x2dcfa1['output']||_0x5b2b('0x8d')),'reportId':_0x4b8f7a['id'],'reportType':_0x5b2b('0x8e')});return db[_0x5b2b('0x8f')][_0x5b2b('0x4a')](_0x5ced15,{'raw':!![]});})['then'](function(_0x37d485){if(_0x4b8f7a[_0x5b2b('0x65')]===_0x5b2b('0x90')){_0x34d21d[_0x5b2b('0x39')](_0x4b8f7a[_0x5b2b('0x65')]+_0x5b2b('0x91'),_0x2dcfa1[_0x5b2b('0x92')],_0x2dcfa1[_0x5b2b('0x93')]);}else{_0x34d21d[_0x5b2b('0x39')](_0x4b8f7a[_0x5b2b('0x65')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2dcfa1[_0x5b2b('0x92')],_0x2dcfa1[_0x5b2b('0x93')]);}if(_0x37d485){logger[_0x5b2b('0x94')](_0x5b2b('0x95'),_0x34d21d['toString']());require('child_process')[_0x5b2b('0x96')](path[_0x5b2b('0x4d')](__dirname,_0x5b2b('0x97'),_0x37d485[_0x5b2b('0x8a')]),[_0x37d485['id'],_0x34d21d[_0x5b2b('0x7a')](),path['join'](__dirname,_0x5b2b('0x98'),_0x37d485[_0x5b2b('0x99')]),_0x1e8158]);return _0x37d485;}else{var _0x8784c1=squel[_0x5b2b('0x86')]();_0x8784c1['from']('('+_0x34d21d[_0x5b2b('0x7a')]()+')',_0x5b2b('0x9a'));_0x8784c1[_0x5b2b('0x60')]('COUNT(*)',_0x5b2b('0x19'));_0x34d21d[_0x5b2b('0x1b')](_0x2dcfa1['limit']||_0x1604f0);_0x34d21d[_0x5b2b('0x1a')](_0x2dcfa1[_0x5b2b('0x1a')]||0x0);return dbH['sequelize']['query'](_0x8784c1[_0x5b2b('0x7a')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x3df31c){if(!_0x3df31c['length']){_0x414a65=0x0;}else{_0x414a65=_0x3df31c[0x0][_0x5b2b('0x19')]||0x0;}return dbH[_0x5b2b('0x7b')][_0x5b2b('0x2f')](_0x34d21d[_0x5b2b('0x7a')](),{'type':dbH['sequelize'][_0x5b2b('0x7c')][_0x5b2b('0x7d')]});})[_0x5b2b('0x22')](function(_0x29b4a9){return{'rows':_0x29b4a9||[],'count':_0x414a65};});}});}exports[_0x5b2b('0x9b')]=function(_0x163a20,_0x553c91){return runReport(_0x163a20[_0x5b2b('0x3f')],_0x163a20[_0x5b2b('0x2f')],_0x163a20[_0x5b2b('0x41')])[_0x5b2b('0x22')](respondWithResult(_0x553c91,null))[_0x5b2b('0x3e')](handleError(_0x553c91,null));};exports[_0x5b2b('0x9c')]=runReport;exports[_0x5b2b('0x2f')]=function(_0xeab12,_0x149a96){var _0x262f23=0xa;var _0x21f110=[_0x5b2b('0x4d'),_0x5b2b('0x7e'),_0x5b2b('0x4e'),_0x5b2b('0x4f')];var _0x4c68e2={'SUM':_0x5b2b('0x9d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x5b2b('0x53'),'GROUP_CONCAT':_0x5b2b('0x54'),'GROUP_CONCAT ASC':_0x5b2b('0x55'),'GROUP_CONCAT DESC':_0x5b2b('0x56')};var _0x1215c8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x5b2b('0x59'),'ROUND':_0x5b2b('0x5a'),'UNIX_TIMESTAMP':_0x5b2b('0x5b')};var _0x2e7849=function(_0x1f606c){return!_['includes']([_0x5b2b('0x80'),_0x5b2b('0x5c'),_0x5b2b('0x5d'),_0x5b2b('0x81')],_0x1f606c);};var _0x47fc6a=function(_0x2ad0fe){if(!_0x2ad0fe||!_0x2ad0fe[_0x5b2b('0x5e')][_0x5b2b('0x35')]){return'';}for(var _0x2ff164='(',_0x3ca146=0x0;_0x3ca146<_0x2ad0fe[_0x5b2b('0x5e')]['length'];_0x3ca146+=0x1){_0x3ca146>0x0&&(_0x2ff164+='\x20'+_0x2ad0fe['operator']+'\x20');_0x2ff164+=_0x2ad0fe['rules'][_0x3ca146][_0x5b2b('0x5f')]?_0x47fc6a(_0x2ad0fe[_0x5b2b('0x5e')][_0x3ca146][_0x5b2b('0x5f')]):_0x2ad0fe['rules'][_0x3ca146][_0x5b2b('0x60')]+'\x20'+_0x2ad0fe['rules'][_0x3ca146][_0x5b2b('0x83')]+(_0x2e7849(_0x2ad0fe['rules'][_0x3ca146][_0x5b2b('0x83')])?'\x20'+_0x2ad0fe[_0x5b2b('0x5e')][_0x3ca146][_0x5b2b('0x61')]:'');}return _0x2ff164+')';};var _0x2e8afa={'where':{'id':_0xeab12[_0x5b2b('0x3f')]['id']}},_0x1979a9,_0x5ee8ec,_0x36f64f,_0x9598b1,_0x32dcab;_0x2e8afa=_['merge']({},_0x2e8afa,_0xeab12[_0x5b2b('0x41')]);return db[_0x5b2b('0x2a')][_0x5b2b('0x42')](_0x2e8afa)[_0x5b2b('0x22')](function(_0x1cbb97){if(_0x1cbb97){_0x1979a9=_0x1cbb97;return _0x1cbb97[_0x5b2b('0x62')]();}return null;})['then'](function(_0x1b7c8b){if(_0x1b7c8b){if(!_0x1b7c8b['length']){throw new db[(_0x5b2b('0x63'))][(_0x5b2b('0x84'))](_0x5b2b('0x9e'),0x193);}_0x5ee8ec=_0x1b7c8b;return db[_0x5b2b('0x64')][_0x5b2b('0x3c')]({'raw':!![]});}return null;})['then'](function(_0x486f1b){if(_0x486f1b){_0x36f64f=_[_0x5b2b('0x85')](_0x486f1b,'id');var _0x4be14d;var _0x54c261=squel[_0x5b2b('0x86')]();_0x54c261['from'](_0x1979a9[_0x5b2b('0x65')]);for(var _0x1c3d10=0x0;_0x1c3d10<_0x5ee8ec[_0x5b2b('0x35')];_0x1c3d10+=0x1){_0x4be14d=_0x5ee8ec[_0x1c3d10][_0x5b2b('0x66')]?_0x36f64f[_0x5ee8ec[_0x1c3d10][_0x5b2b('0x66')]][_0x5b2b('0x9f')]:_0x5ee8ec[_0x1c3d10]['field'];_0x4be14d=_0x5ee8ec[_0x1c3d10][_0x5b2b('0x67')]?_['replace'](_0x4c68e2[_0x5ee8ec[_0x1c3d10]['function']],'%s',_0x4be14d):_0x4be14d;_0x4be14d=_0x5ee8ec[_0x1c3d10][_0x5b2b('0x69')]?_[_0x5b2b('0x68')](_0x1215c8[_0x5ee8ec[_0x1c3d10][_0x5b2b('0x69')]],'%s',_0x4be14d):_0x4be14d;if(_0x5ee8ec[_0x1c3d10][_0x5b2b('0x88')]){_0x54c261[_0x5b2b('0x5f')](_0x4be14d);}_0x5ee8ec[_0x1c3d10][_0x5b2b('0x6a')]&&_0x54c261[_0x5b2b('0x6b')](_0x4be14d,_0x5ee8ec[_0x1c3d10][_0x5b2b('0x6a')]===_0x5b2b('0x6c')?![]:!![]);_0x54c261[_0x5b2b('0x60')](_0x4be14d,_0x5ee8ec[_0x1c3d10][_0x5b2b('0x6d')]||_0x4be14d);}if(_0x1979a9[_0x5b2b('0x6e')]){_0x1979a9[_0x5b2b('0x6e')]=JSON[_0x5b2b('0x6f')](_0x1979a9[_0x5b2b('0x6e')]);for(var _0x3a168e=0x0;_0x3a168e<_0x1979a9[_0x5b2b('0x6e')][_0x5b2b('0x35')];_0x3a168e+=0x1){if(_0x1979a9['joins'][_0x3a168e][_0x5b2b('0x70')]&&_['includes'](_0x21f110,_0x1979a9['joins'][_0x3a168e][_0x5b2b('0x70')])&&_0x1979a9['joins'][_0x3a168e]['parentKey']&&_0x1979a9[_0x5b2b('0x6e')][_0x3a168e][_0x5b2b('0x73')]&&_0x1979a9['joins'][_0x3a168e][_0x5b2b('0x74')]){_0x54c261[_0x1979a9['joins'][_0x3a168e]['type']](_0x1979a9['joins'][_0x3a168e][_0x5b2b('0x73')],null,util[_0x5b2b('0x69')](_0x5b2b('0x75'),_0x1979a9[_0x5b2b('0x65')],_0x1979a9['joins'][_0x3a168e]['parentKey'],_0x1979a9[_0x5b2b('0x6e')][_0x3a168e][_0x5b2b('0x73')],_0x1979a9['joins'][_0x3a168e][_0x5b2b('0x74')]));}}}if(_0x1979a9[_0x5b2b('0x76')]){_0x1979a9['conditions']=JSON[_0x5b2b('0x6f')](_0x1979a9[_0x5b2b('0x76')]);_0x54c261['where'](_0x47fc6a(_0x1979a9['conditions'][_0x5b2b('0x5f')]));}_0x32dcab=_0x54c261[_0x5b2b('0x77')]();_0x54c261[_0x5b2b('0x1b')](_0x262f23);_0x54c261[_0x5b2b('0x1a')](0x0);logger['debug'](_0x5b2b('0x79'),_0x54c261[_0x5b2b('0x7a')]());return db['sequelize'][_0x5b2b('0x2f')](_0x54c261[_0x5b2b('0x7a')](),{'type':db['sequelize'][_0x5b2b('0x7c')]['SELECT']});}})[_0x5b2b('0x22')](function(){return{'sql':_0x32dcab[_0x5b2b('0x7a')]()};})[_0x5b2b('0x22')](respondWithResult(_0x149a96,null))['catch'](handleError(_0x149a96,null));}; \ No newline at end of file +var _0x9f94=['Run\x20Query:','toString','fork','../../components/export/','../../files/reports','savename','select','countTable','run','runReport','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','get','CustomReports','UserProfileResource','then','end','error','name','send','index','AnalyticCustomReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','MIN(%s)','HOUR(%s)','parse','parentKey','clone','No\x20available\x20data','output','web','randomstring','generate','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info'];(function(_0x4062dc,_0x50af25){var _0x4248dd=function(_0x541fe8){while(--_0x541fe8){_0x4062dc['push'](_0x4062dc['shift']());}};_0x4248dd(++_0x50af25);}(_0x9f94,0x1e7));var _0x49f9=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9f94[_0x46e363];return _0x3fb059;};'use strict';var pdf=require(_0x49f9('0x0'));var emlformat=require(_0x49f9('0x1'));var rimraf=require(_0x49f9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x49f9('0x3'));var moment=require(_0x49f9('0x4'));var BPromise=require(_0x49f9('0x5'));var Mustache=require(_0x49f9('0x6'));var util=require(_0x49f9('0x7'));var path=require('path');var sox=require(_0x49f9('0x8'));var csv=require(_0x49f9('0x9'));var ejs=require(_0x49f9('0xa'));var fs=require('fs');var _=require(_0x49f9('0xb'));var squel=require(_0x49f9('0xc'));var crypto=require(_0x49f9('0xd'));var jsforce=require(_0x49f9('0xe'));var deskjs=require(_0x49f9('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x49f9('0x10'));var Redis=require('ioredis');var authService=require(_0x49f9('0x11'));var qs=require(_0x49f9('0x12'));var as=require(_0x49f9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49f9('0x14'))('api');var utils=require(_0x49f9('0x15'));var config=require(_0x49f9('0x16'));var db=require(_0x49f9('0x17'))['db'];var dbH=require(_0x49f9('0x17'))['dbH'];function respondWithStatusCode(_0x52c3fe,_0x446fb1){_0x446fb1=_0x446fb1||0xcc;return function(_0x9ed1f5){if(_0x9ed1f5){return _0x52c3fe[_0x49f9('0x18')](_0x446fb1);}return _0x52c3fe[_0x49f9('0x19')](_0x446fb1)['end']();};}function respondWithResult(_0x4e7790,_0x5f1577){_0x5f1577=_0x5f1577||0xc8;return function(_0x2a23dc){if(_0x2a23dc){return _0x4e7790['status'](_0x5f1577)[_0x49f9('0x1a')](_0x2a23dc);}};}function respondWithFilteredResult(_0x4b8228,_0x398a05){return function(_0x760ac){if(_0x760ac){var _0x482aa5=_0x760ac[_0x49f9('0x1b')],_0x45a376=_0x398a05[_0x49f9('0x1c')],_0x1a2026=_0x398a05[_0x49f9('0x1c')]+_0x398a05[_0x49f9('0x1d')],_0x24250f;if(_0x1a2026>=_0x482aa5){_0x1a2026=_0x482aa5;_0x24250f=0xc8;}else{_0x24250f=0xce;}_0x4b8228[_0x49f9('0x19')](_0x24250f);return _0x4b8228[_0x49f9('0x1e')](_0x49f9('0x1f'),_0x45a376+'-'+_0x1a2026+'/'+_0x482aa5)[_0x49f9('0x1a')](_0x760ac);}return null;};}function patchUpdates(_0x1971e3){return function(_0xa9b24c){try{jsonpatch[_0x49f9('0x20')](_0xa9b24c,_0x1971e3,!![]);}catch(_0x136836){return BPromise['reject'](_0x136836);}return _0xa9b24c['save']();};}function saveUpdates(_0x916ef5,_0x4884ef){return function(_0x3e8a62){if(_0x3e8a62){return _0x3e8a62['update'](_0x916ef5)['then'](function(_0x42c0aa){return _0x42c0aa;});}return null;};}function removeEntity(_0xde1383,_0x4e92e5){return function(_0x372347){if(_0x372347){return _0x372347['destroy']()['then'](function(){var _0xf2afb7=_0x372347[_0x49f9('0x21')]({'plain':!![]});var _0x5757d3=_0x49f9('0x22');return db[_0x49f9('0x23')]['destroy']({'where':{'type':_0x5757d3,'resourceId':_0xf2afb7['id']}})[_0x49f9('0x24')](function(){return _0x372347;});})[_0x49f9('0x24')](function(){_0xde1383[_0x49f9('0x19')](0xcc)[_0x49f9('0x25')]();});}};}function handleEntityNotFound(_0x4e6a90,_0xa559a2){return function(_0x3aff06){if(!_0x3aff06){_0x4e6a90[_0x49f9('0x18')](0x194);}return _0x3aff06;};}function handleError(_0x10da65,_0x28e56f){_0x28e56f=_0x28e56f||0x1f4;return function(_0x45e077){logger[_0x49f9('0x26')](_0x45e077['stack']);if(_0x45e077['name']){delete _0x45e077[_0x49f9('0x27')];}_0x10da65[_0x49f9('0x19')](_0x28e56f)[_0x49f9('0x28')](_0x45e077);};}exports[_0x49f9('0x29')]=function(_0x51adc3,_0x2d1e7d){var _0x76e1c6={},_0x1deb22={},_0x5c8fc5={'count':0x0,'rows':[]};var _0xc0a9aa=_['map'](db[_0x49f9('0x2a')][_0x49f9('0x2b')],function(_0x39f66a){return{'name':_0x39f66a['fieldName'],'type':_0x39f66a[_0x49f9('0x2c')][_0x49f9('0x2d')]};});_0x1deb22[_0x49f9('0x2e')]=_[_0x49f9('0x2f')](_0xc0a9aa,_0x49f9('0x27'));_0x1deb22[_0x49f9('0x30')]=_[_0x49f9('0x31')](_0x51adc3[_0x49f9('0x30')]);_0x1deb22[_0x49f9('0x32')]=_[_0x49f9('0x33')](_0x1deb22[_0x49f9('0x2e')],_0x1deb22[_0x49f9('0x30')]);_0x76e1c6[_0x49f9('0x34')]=_[_0x49f9('0x33')](_0x1deb22[_0x49f9('0x2e')],qs[_0x49f9('0x35')](_0x51adc3[_0x49f9('0x30')]['fields']));_0x76e1c6[_0x49f9('0x34')]=_0x76e1c6[_0x49f9('0x34')][_0x49f9('0x36')]?_0x76e1c6[_0x49f9('0x34')]:_0x1deb22['model'];if(!_0x51adc3['query'][_0x49f9('0x37')]('nolimit')){_0x76e1c6[_0x49f9('0x1d')]=qs[_0x49f9('0x1d')](_0x51adc3[_0x49f9('0x30')][_0x49f9('0x1d')]);_0x76e1c6[_0x49f9('0x1c')]=qs[_0x49f9('0x1c')](_0x51adc3[_0x49f9('0x30')]['offset']);}_0x76e1c6[_0x49f9('0x38')]=qs[_0x49f9('0x39')](_0x51adc3['query']['sort']);_0x76e1c6['where']=qs[_0x49f9('0x32')](_['pick'](_0x51adc3['query'],_0x1deb22[_0x49f9('0x32')]),_0xc0a9aa);if(_0x51adc3[_0x49f9('0x30')][_0x49f9('0x3a')]){_0x76e1c6[_0x49f9('0x3b')]=_['merge'](_0x76e1c6[_0x49f9('0x3b')],{'$or':_['map'](_0xc0a9aa,function(_0x2e1277){if(_0x2e1277[_0x49f9('0x2c')]!==_0x49f9('0x3c')){var _0x33bac9={};_0x33bac9[_0x2e1277[_0x49f9('0x27')]]={'$like':'%'+_0x51adc3[_0x49f9('0x30')]['filter']+'%'};return _0x33bac9;}})});}_0x76e1c6=_['merge']({},_0x76e1c6,_0x51adc3[_0x49f9('0x3d')]);var _0x2fecb6={'where':_0x76e1c6[_0x49f9('0x3b')]};return db['AnalyticCustomReport'][_0x49f9('0x1b')](_0x2fecb6)[_0x49f9('0x24')](function(_0x4c656c){_0x5c8fc5['count']=_0x4c656c;if(_0x51adc3[_0x49f9('0x30')][_0x49f9('0x3e')]){_0x76e1c6[_0x49f9('0x3f')]=[{'all':!![]}];}return db[_0x49f9('0x2a')]['findAll'](_0x76e1c6);})[_0x49f9('0x24')](function(_0x4b760e){_0x5c8fc5[_0x49f9('0x40')]=_0x4b760e;return _0x5c8fc5;})[_0x49f9('0x24')](respondWithFilteredResult(_0x2d1e7d,_0x76e1c6))[_0x49f9('0x41')](handleError(_0x2d1e7d,null));};exports[_0x49f9('0x42')]=function(_0x2693be,_0x1bc0c9){var _0x11398a={'raw':![],'where':{'id':_0x2693be['params']['id']}},_0x338974={};_0x338974[_0x49f9('0x2e')]=_[_0x49f9('0x31')](db[_0x49f9('0x2a')][_0x49f9('0x2b')]);_0x338974[_0x49f9('0x30')]=_[_0x49f9('0x31')](_0x2693be[_0x49f9('0x30')]);_0x338974['filters']=_[_0x49f9('0x33')](_0x338974['model'],_0x338974[_0x49f9('0x30')]);_0x11398a[_0x49f9('0x34')]=_['intersection'](_0x338974[_0x49f9('0x2e')],qs[_0x49f9('0x35')](_0x2693be['query'][_0x49f9('0x35')]));_0x11398a[_0x49f9('0x34')]=_0x11398a['attributes'][_0x49f9('0x36')]?_0x11398a[_0x49f9('0x34')]:_0x338974[_0x49f9('0x2e')];if(_0x2693be[_0x49f9('0x30')][_0x49f9('0x3e')]){_0x11398a[_0x49f9('0x3f')]=[{'all':!![]}];}_0x11398a=_['merge']({},_0x11398a,_0x2693be[_0x49f9('0x3d')]);return db['AnalyticCustomReport'][_0x49f9('0x43')](_0x11398a)[_0x49f9('0x24')](handleEntityNotFound(_0x1bc0c9,null))['then'](respondWithResult(_0x1bc0c9,null))[_0x49f9('0x41')](handleError(_0x1bc0c9,null));};exports[_0x49f9('0x44')]=function(_0x9649c5,_0x10b535){return db[_0x49f9('0x2a')][_0x49f9('0x44')](_0x9649c5[_0x49f9('0x45')],{})[_0x49f9('0x24')](function(_0x6936a3){var _0x2e62dd=_0x9649c5[_0x49f9('0x46')]['get']({'plain':!![]});if(!_0x2e62dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e62dd[_0x49f9('0x47')]===_0x49f9('0x46')){var _0x1a0bfe=_0x6936a3[_0x49f9('0x21')]({'plain':!![]});var _0xacd19a=_0x49f9('0x48');return db[_0x49f9('0x49')]['find']({'where':{'name':_0xacd19a,'userProfileId':_0x2e62dd[_0x49f9('0x4a')]},'raw':!![]})[_0x49f9('0x24')](function(_0x58060){if(_0x58060&&_0x58060[_0x49f9('0x4b')]===0x0){return db[_0x49f9('0x23')]['create']({'name':_0x1a0bfe['name'],'resourceId':_0x1a0bfe['id'],'type':'CustomReports','sectionId':_0x58060['id']},{})[_0x49f9('0x24')](function(){return _0x6936a3;});}else{return _0x6936a3;}})[_0x49f9('0x41')](function(_0x186db7){logger[_0x49f9('0x26')](_0x49f9('0x4c'),_0x186db7);throw _0x186db7;});}return _0x6936a3;})[_0x49f9('0x24')](respondWithResult(_0x10b535,0xc9))['catch'](handleError(_0x10b535,null));};exports[_0x49f9('0x4d')]=function(_0x57acbb,_0x2fa14c){if(_0x57acbb['body']['id']){delete _0x57acbb['body']['id'];}return db[_0x49f9('0x2a')]['find']({'where':{'id':_0x57acbb[_0x49f9('0x4e')]['id']}})[_0x49f9('0x24')](handleEntityNotFound(_0x2fa14c,null))[_0x49f9('0x24')](saveUpdates(_0x57acbb[_0x49f9('0x45')],null))[_0x49f9('0x24')](respondWithResult(_0x2fa14c,null))[_0x49f9('0x41')](handleError(_0x2fa14c,null));};exports['destroy']=function(_0x5f649b,_0x2463ea){return db[_0x49f9('0x2a')][_0x49f9('0x43')]({'where':{'id':_0x5f649b[_0x49f9('0x4e')]['id']}})[_0x49f9('0x24')](handleEntityNotFound(_0x2463ea,null))[_0x49f9('0x24')](removeEntity(_0x2463ea,null))[_0x49f9('0x41')](handleError(_0x2463ea,null));};exports['preview']=function(_0x33d7d9,_0x594664){var _0x2ed3d2=0xa;var _0x249cfa=[_0x49f9('0x4f'),_0x49f9('0x50'),_0x49f9('0x51'),'cross_join'];var _0xbd2b8f={'SUM':_0x49f9('0x52'),'COUNT':_0x49f9('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x49f9('0x54'),'MIN':'MIN(%s)','AVG':_0x49f9('0x55'),'GROUP_CONCAT':_0x49f9('0x56'),'GROUP_CONCAT ASC':_0x49f9('0x57'),'GROUP_CONCAT DESC':_0x49f9('0x58')};var _0x556287={'SEC_TO_TIME':_0x49f9('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x49f9('0x5a'),'UNIX_TIMESTAMP':_0x49f9('0x5b')};var _0x55b708=function(_0x104174){return!_[_0x49f9('0x5c')]([_0x49f9('0x5d'),_0x49f9('0x5e'),_0x49f9('0x5f'),_0x49f9('0x60')],_0x104174);};var _0x568a90=function(_0x55579b){if(!_0x55579b||!_0x55579b[_0x49f9('0x61')][_0x49f9('0x36')]){return'';}for(var _0x579800='(',_0x457c2f=0x0;_0x457c2f<_0x55579b[_0x49f9('0x61')][_0x49f9('0x36')];_0x457c2f+=0x1){_0x457c2f>0x0&&(_0x579800+='\x20'+_0x55579b[_0x49f9('0x62')]+'\x20');_0x579800+=_0x55579b[_0x49f9('0x61')][_0x457c2f][_0x49f9('0x63')]?_0x568a90(_0x55579b['rules'][_0x457c2f][_0x49f9('0x63')]):_0x55579b[_0x49f9('0x61')][_0x457c2f][_0x49f9('0x64')]+'\x20'+_0x55579b[_0x49f9('0x61')][_0x457c2f][_0x49f9('0x65')]+(_0x55b708(_0x55579b[_0x49f9('0x61')][_0x457c2f][_0x49f9('0x65')])?'\x20'+_0x55579b[_0x49f9('0x61')][_0x457c2f][_0x49f9('0x66')]:'');}return _0x579800+')';};var _0x34098e={'where':{'id':_0x33d7d9[_0x49f9('0x4e')]['id']}},_0x253edf,_0x2bd3ec,_0x3f3f26,_0x149159,_0x18e165;_0x34098e=_[_0x49f9('0x67')]({},_0x34098e,_0x33d7d9['options']);return db[_0x49f9('0x2a')]['find'](_0x34098e)['then'](function(_0x187494){if(_0x187494){_0x253edf=_0x187494;return _0x187494[_0x49f9('0x68')]();}return null;})[_0x49f9('0x24')](function(_0x564eca){if(_0x564eca){if(!_0x564eca['length']){throw new db[(_0x49f9('0x69'))][(_0x49f9('0x6a'))](_0x49f9('0x6b'),0x193);}_0x2bd3ec=_0x564eca;return db['AnalyticMetric'][_0x49f9('0x6c')]({'raw':!![]});}return null;})[_0x49f9('0x24')](function(_0x2316e2){if(_0x2316e2){_0x3f3f26=_[_0x49f9('0x6d')](_0x2316e2,'id');var _0x5bdcef;var _0x3ae840=squel['select']();_0x3ae840[_0x49f9('0x6e')](_0x253edf[_0x49f9('0x6f')]);for(var _0x412060=0x0;_0x412060<_0x2bd3ec[_0x49f9('0x36')];_0x412060+=0x1){_0x5bdcef=_0x2bd3ec[_0x412060][_0x49f9('0x70')]?_0x3f3f26[_0x2bd3ec[_0x412060]['MetricId']][_0x49f9('0x71')]:_0x2bd3ec[_0x412060][_0x49f9('0x64')];_0x5bdcef=_0x2bd3ec[_0x412060]['function']?_[_0x49f9('0x72')](_0xbd2b8f[_0x2bd3ec[_0x412060][_0x49f9('0x73')]],'%s',_0x5bdcef):_0x5bdcef;_0x5bdcef=_0x2bd3ec[_0x412060][_0x49f9('0x74')]?_[_0x49f9('0x72')](_0x556287[_0x2bd3ec[_0x412060]['format']],'%s',_0x5bdcef):_0x5bdcef;if(_0x2bd3ec[_0x412060][_0x49f9('0x75')]){_0x3ae840['group'](_0x5bdcef);}_0x2bd3ec[_0x412060][_0x49f9('0x76')]&&_0x3ae840[_0x49f9('0x38')](_0x5bdcef,_0x2bd3ec[_0x412060][_0x49f9('0x76')]===_0x49f9('0x77')?![]:!![]);_0x3ae840[_0x49f9('0x64')](_0x5bdcef,_0x2bd3ec[_0x412060][_0x49f9('0x78')]||_0x5bdcef);}if(_0x253edf[_0x49f9('0x79')]){_0x253edf[_0x49f9('0x79')]=JSON['parse'](_0x253edf[_0x49f9('0x79')]);for(var _0x33642f=0x0;_0x33642f<_0x253edf['joins'][_0x49f9('0x36')];_0x33642f+=0x1){if(_0x253edf['joins'][_0x33642f][_0x49f9('0x2c')]&&_[_0x49f9('0x5c')](_0x249cfa,_0x253edf['joins'][_0x33642f]['type'])&&_0x253edf['joins'][_0x33642f]['parentKey']&&_0x253edf[_0x49f9('0x79')][_0x33642f][_0x49f9('0x7a')]&&_0x253edf['joins'][_0x33642f][_0x49f9('0x7b')]){_0x3ae840[_0x253edf['joins'][_0x33642f]['type']](_0x253edf[_0x49f9('0x79')][_0x33642f]['foreignTable'],null,util[_0x49f9('0x74')](_0x49f9('0x7c'),_0x253edf['table'],_0x253edf['joins'][_0x33642f]['parentKey'],_0x253edf['joins'][_0x33642f]['foreignTable'],_0x253edf[_0x49f9('0x79')][_0x33642f][_0x49f9('0x7b')]));}}}if(_0x253edf['conditions']){_0x253edf[_0x49f9('0x7d')]=JSON['parse'](_0x253edf[_0x49f9('0x7d')]);_0x3ae840[_0x49f9('0x3b')](_0x568a90(_0x253edf[_0x49f9('0x7d')]['group']));}_0x18e165=_0x3ae840['clone']();_0x3ae840[_0x49f9('0x1d')](_0x2ed3d2);_0x3ae840['offset'](0x0);logger[_0x49f9('0x7e')](_0x49f9('0x7f'),_0x3ae840['toString']());return db['sequelize'][_0x49f9('0x30')](_0x3ae840['toString'](),{'type':db[_0x49f9('0x80')][_0x49f9('0x81')][_0x49f9('0x82')]});}})[_0x49f9('0x24')](respondWithResult(_0x594664,null))['catch'](handleError(_0x594664,null));};function runReport(_0x182bdc,_0x31c4a6,_0x6fc9c){var _0x2b7938=_0x31c4a6['name'];var _0x3f86cb=0xa;var _0x7410f1=[_0x49f9('0x4f'),_0x49f9('0x50'),_0x49f9('0x51'),'cross_join'];var _0x5143e1={'SUM':_0x49f9('0x52'),'COUNT':_0x49f9('0x53'),'COUNT DISTINCT':_0x49f9('0x83'),'MAX':_0x49f9('0x54'),'MIN':_0x49f9('0x84'),'AVG':_0x49f9('0x55'),'GROUP_CONCAT':_0x49f9('0x56'),'GROUP_CONCAT ASC':_0x49f9('0x57'),'GROUP_CONCAT DESC':_0x49f9('0x58')};var _0x590cf3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x49f9('0x85'),'ROUND':_0x49f9('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x205f43=function(_0x4e7a7e){return!_['includes']([_0x49f9('0x5d'),_0x49f9('0x5e'),_0x49f9('0x5f'),_0x49f9('0x60')],_0x4e7a7e);};var _0x3ae2b3=function(_0x323f41){if(!_0x323f41||!_0x323f41[_0x49f9('0x61')][_0x49f9('0x36')]){return'';}for(var _0x27a4c9='(',_0x17aa19=0x0;_0x17aa19<_0x323f41[_0x49f9('0x61')][_0x49f9('0x36')];_0x17aa19+=0x1){_0x17aa19>0x0&&(_0x27a4c9+='\x20'+_0x323f41[_0x49f9('0x62')]+'\x20');_0x27a4c9+=_0x323f41['rules'][_0x17aa19][_0x49f9('0x63')]?_0x3ae2b3(_0x323f41[_0x49f9('0x61')][_0x17aa19][_0x49f9('0x63')]):_0x323f41[_0x49f9('0x61')][_0x17aa19][_0x49f9('0x64')]+'\x20'+_0x323f41['rules'][_0x17aa19][_0x49f9('0x65')]+(_0x205f43(_0x323f41[_0x49f9('0x61')][_0x17aa19]['condition'])?'\x20'+_0x323f41['rules'][_0x17aa19]['value']:'');}return _0x27a4c9+')';};var _0xf037f0={'where':{'id':_0x182bdc['id']}},_0x7988b7,_0x471bd5,_0x396ee1,_0x486fac,_0xfc4a3e;_0xf037f0=_[_0x49f9('0x67')]({},_0xf037f0,_0x6fc9c);return db[_0x49f9('0x2a')]['find'](_0xf037f0)[_0x49f9('0x24')](function(_0x57b879){if(_0x57b879){_0x7988b7=_0x57b879;return _0x57b879[_0x49f9('0x68')]();}return null;})['then'](function(_0x4e5d45){if(_0x4e5d45){if(!_0x4e5d45[_0x49f9('0x36')]){throw new db[(_0x49f9('0x69'))][(_0x49f9('0x6a'))](_0x49f9('0x6b'),0x193);}_0x471bd5=_0x4e5d45;return db['AnalyticMetric'][_0x49f9('0x6c')]({'raw':!![]});}return null;})[_0x49f9('0x24')](function(_0x4db188){if(_0x4db188){_0x396ee1=_['keyBy'](_0x4db188,'id');var _0x4a66f8;var _0x4e732c=squel['select']();_0x4e732c[_0x49f9('0x6e')](_0x7988b7[_0x49f9('0x6f')]);for(var _0x3d045b=0x0;_0x3d045b<_0x471bd5[_0x49f9('0x36')];_0x3d045b+=0x1){_0x4a66f8=_0x471bd5[_0x3d045b][_0x49f9('0x70')]?_0x396ee1[_0x471bd5[_0x3d045b]['MetricId']][_0x49f9('0x71')]:_0x471bd5[_0x3d045b][_0x49f9('0x64')];_0x4a66f8=_0x471bd5[_0x3d045b][_0x49f9('0x73')]?_[_0x49f9('0x72')](_0x5143e1[_0x471bd5[_0x3d045b][_0x49f9('0x73')]],'%s',_0x4a66f8):_0x4a66f8;_0x4a66f8=_0x471bd5[_0x3d045b]['format']?_['replace'](_0x590cf3[_0x471bd5[_0x3d045b][_0x49f9('0x74')]],'%s',_0x4a66f8):_0x4a66f8;if(_0x471bd5[_0x3d045b]['groupBy']){_0x4e732c['group'](_0x4a66f8);}_0x471bd5[_0x3d045b][_0x49f9('0x76')]&&_0x4e732c[_0x49f9('0x38')](_0x4a66f8,_0x471bd5[_0x3d045b]['orderBy']==='DESC'?![]:!![]);_0x4e732c[_0x49f9('0x64')](_0x4a66f8,_0x471bd5[_0x3d045b][_0x49f9('0x78')]||_0x4a66f8);}if(_0x7988b7[_0x49f9('0x79')]){_0x7988b7[_0x49f9('0x79')]=JSON[_0x49f9('0x86')](_0x7988b7[_0x49f9('0x79')]);for(var _0x499280=0x0;_0x499280<_0x7988b7[_0x49f9('0x79')][_0x49f9('0x36')];_0x499280+=0x1){if(_0x7988b7[_0x49f9('0x79')][_0x499280][_0x49f9('0x2c')]&&_['includes'](_0x7410f1,_0x7988b7[_0x49f9('0x79')][_0x499280][_0x49f9('0x2c')])&&_0x7988b7['joins'][_0x499280][_0x49f9('0x87')]&&_0x7988b7[_0x49f9('0x79')][_0x499280][_0x49f9('0x7a')]&&_0x7988b7[_0x49f9('0x79')][_0x499280][_0x49f9('0x7b')]){_0x4e732c[_0x7988b7['joins'][_0x499280][_0x49f9('0x2c')]](_0x7988b7[_0x49f9('0x79')][_0x499280]['foreignTable'],null,util[_0x49f9('0x74')]('%s.%s\x20=\x20%s.%s',_0x7988b7['table'],_0x7988b7[_0x49f9('0x79')][_0x499280][_0x49f9('0x87')],_0x7988b7['joins'][_0x499280][_0x49f9('0x7a')],_0x7988b7['joins'][_0x499280][_0x49f9('0x7b')]));}}}if(_0x7988b7[_0x49f9('0x7d')]){_0x7988b7['conditions']=JSON[_0x49f9('0x86')](_0x7988b7[_0x49f9('0x7d')]);_0x4e732c[_0x49f9('0x3b')](_0x3ae2b3(_0x7988b7['conditions'][_0x49f9('0x63')]));}_0xfc4a3e=_0x4e732c[_0x49f9('0x88')]();_0x4e732c['limit'](_0x3f86cb);_0x4e732c['offset'](0x0);logger['debug'](_0x49f9('0x7f'),_0x4e732c['toString']());return db['sequelize'][_0x49f9('0x30')](_0x4e732c['toString'](),{'type':db[_0x49f9('0x80')]['QueryTypes']['SELECT']});}})[_0x49f9('0x24')](function(_0x2111d4){if(!_0x2111d4[_0x49f9('0x36')]){throw new db[(_0x49f9('0x69'))]['ValidationErrorItem'](_0x49f9('0x89'),0xcc);}if(_0x31c4a6[_0x49f9('0x8a')]===_0x49f9('0x8b')){return null;}var _0xf7b0aa=_[_0x49f9('0x67')](_0x31c4a6,{'name':_0x31c4a6['fullPath']||_0x31c4a6[_0x49f9('0x27')]||_0x7988b7['name'],'basename':_0x2b7938,'savename':util[_0x49f9('0x74')]('%s-%s.%s',_0x31c4a6[_0x49f9('0x27')]||_0x7988b7['name'],require(_0x49f9('0x8c'))[_0x49f9('0x8d')](0x4),_0x31c4a6[_0x49f9('0x8a')]||'csv'),'reportId':_0x7988b7['id'],'reportType':_0x49f9('0x8e')});return db[_0x49f9('0x8f')][_0x49f9('0x44')](_0xf7b0aa,{'raw':!![]});})[_0x49f9('0x24')](function(_0x4a4ae4){if(_0x7988b7[_0x49f9('0x6f')]==='cdr'){_0xfc4a3e[_0x49f9('0x3b')](_0x7988b7['table']+_0x49f9('0x90'),_0x31c4a6[_0x49f9('0x91')],_0x31c4a6[_0x49f9('0x92')]);}else{_0xfc4a3e['where'](_0x7988b7[_0x49f9('0x6f')]+_0x49f9('0x93'),_0x31c4a6[_0x49f9('0x91')],_0x31c4a6[_0x49f9('0x92')]);}if(_0x4a4ae4){logger[_0x49f9('0x94')](_0x49f9('0x95'),_0xfc4a3e[_0x49f9('0x96')]());require('child_process')[_0x49f9('0x97')](path[_0x49f9('0x4f')](__dirname,_0x49f9('0x98'),_0x4a4ae4[_0x49f9('0x8a')]),[_0x4a4ae4['id'],_0xfc4a3e[_0x49f9('0x96')](),path['join'](__dirname,_0x49f9('0x99'),_0x4a4ae4[_0x49f9('0x9a')]),_0x2b7938]);return _0x4a4ae4;}else{var _0x1fe414=squel[_0x49f9('0x9b')]();_0x1fe414[_0x49f9('0x6e')]('('+_0xfc4a3e[_0x49f9('0x96')]()+')',_0x49f9('0x9c'));_0x1fe414[_0x49f9('0x64')]('COUNT(*)',_0x49f9('0x1b'));_0xfc4a3e['limit'](_0x31c4a6[_0x49f9('0x1d')]||_0x3f86cb);_0xfc4a3e[_0x49f9('0x1c')](_0x31c4a6[_0x49f9('0x1c')]||0x0);return dbH[_0x49f9('0x80')][_0x49f9('0x30')](_0x1fe414['toString'](),{'type':dbH[_0x49f9('0x80')]['QueryTypes']['SELECT']})[_0x49f9('0x24')](function(_0x17e21c){if(!_0x17e21c['length']){_0x486fac=0x0;}else{_0x486fac=_0x17e21c[0x0]['count']||0x0;}return dbH[_0x49f9('0x80')][_0x49f9('0x30')](_0xfc4a3e[_0x49f9('0x96')](),{'type':dbH['sequelize'][_0x49f9('0x81')][_0x49f9('0x82')]});})[_0x49f9('0x24')](function(_0x210969){return{'rows':_0x210969||[],'count':_0x486fac};});}});}exports[_0x49f9('0x9d')]=function(_0x4d23da,_0x5a712d){return runReport(_0x4d23da[_0x49f9('0x4e')],_0x4d23da[_0x49f9('0x30')],_0x4d23da['options'])[_0x49f9('0x24')](respondWithResult(_0x5a712d,null))[_0x49f9('0x41')](handleError(_0x5a712d,null));};exports[_0x49f9('0x9e')]=runReport;exports[_0x49f9('0x30')]=function(_0x497805,_0xc1b686){var _0x2923df=0xa;var _0x259a20=[_0x49f9('0x4f'),_0x49f9('0x50'),_0x49f9('0x51'),'cross_join'];var _0x286b90={'SUM':_0x49f9('0x52'),'COUNT':_0x49f9('0x53'),'COUNT DISTINCT':_0x49f9('0x83'),'MAX':'MAX(%s)','MIN':_0x49f9('0x84'),'AVG':_0x49f9('0x55'),'GROUP_CONCAT':_0x49f9('0x56'),'GROUP_CONCAT ASC':_0x49f9('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x58bf69={'SEC_TO_TIME':_0x49f9('0x59'),'DATE':'DATE(%s)','HOUR':_0x49f9('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x49f9('0x5b')};var _0x4031f4=function(_0xf198e5){return!_[_0x49f9('0x5c')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x49f9('0x5f'),'IS\x20NOT\x20EMPTY'],_0xf198e5);};var _0x56a244=function(_0x32264f){if(!_0x32264f||!_0x32264f['rules'][_0x49f9('0x36')]){return'';}for(var _0x21ca71='(',_0x14de03=0x0;_0x14de03<_0x32264f[_0x49f9('0x61')][_0x49f9('0x36')];_0x14de03+=0x1){_0x14de03>0x0&&(_0x21ca71+='\x20'+_0x32264f[_0x49f9('0x62')]+'\x20');_0x21ca71+=_0x32264f[_0x49f9('0x61')][_0x14de03][_0x49f9('0x63')]?_0x56a244(_0x32264f[_0x49f9('0x61')][_0x14de03][_0x49f9('0x63')]):_0x32264f[_0x49f9('0x61')][_0x14de03]['field']+'\x20'+_0x32264f[_0x49f9('0x61')][_0x14de03][_0x49f9('0x65')]+(_0x4031f4(_0x32264f[_0x49f9('0x61')][_0x14de03][_0x49f9('0x65')])?'\x20'+_0x32264f[_0x49f9('0x61')][_0x14de03][_0x49f9('0x66')]:'');}return _0x21ca71+')';};var _0x5b7030={'where':{'id':_0x497805[_0x49f9('0x4e')]['id']}},_0x1da9a7,_0x1a0c41,_0x3f3419,_0x2cefe1,_0x3b051c;_0x5b7030=_['merge']({},_0x5b7030,_0x497805[_0x49f9('0x3d')]);return db[_0x49f9('0x2a')][_0x49f9('0x43')](_0x5b7030)[_0x49f9('0x24')](function(_0x575947){if(_0x575947){_0x1da9a7=_0x575947;return _0x575947[_0x49f9('0x68')]();}return null;})['then'](function(_0x37efa9){if(_0x37efa9){if(!_0x37efa9[_0x49f9('0x36')]){throw new db[(_0x49f9('0x69'))][(_0x49f9('0x6a'))](_0x49f9('0x6b'),0x193);}_0x1a0c41=_0x37efa9;return db['AnalyticMetric'][_0x49f9('0x6c')]({'raw':!![]});}return null;})[_0x49f9('0x24')](function(_0x32e9c6){if(_0x32e9c6){_0x3f3419=_[_0x49f9('0x6d')](_0x32e9c6,'id');var _0x1a92bc;var _0x51494a=squel[_0x49f9('0x9b')]();_0x51494a[_0x49f9('0x6e')](_0x1da9a7[_0x49f9('0x6f')]);for(var _0x18b947=0x0;_0x18b947<_0x1a0c41['length'];_0x18b947+=0x1){_0x1a92bc=_0x1a0c41[_0x18b947]['MetricId']?_0x3f3419[_0x1a0c41[_0x18b947][_0x49f9('0x70')]][_0x49f9('0x71')]:_0x1a0c41[_0x18b947][_0x49f9('0x64')];_0x1a92bc=_0x1a0c41[_0x18b947][_0x49f9('0x73')]?_['replace'](_0x286b90[_0x1a0c41[_0x18b947][_0x49f9('0x73')]],'%s',_0x1a92bc):_0x1a92bc;_0x1a92bc=_0x1a0c41[_0x18b947]['format']?_[_0x49f9('0x72')](_0x58bf69[_0x1a0c41[_0x18b947][_0x49f9('0x74')]],'%s',_0x1a92bc):_0x1a92bc;if(_0x1a0c41[_0x18b947][_0x49f9('0x75')]){_0x51494a[_0x49f9('0x63')](_0x1a92bc);}_0x1a0c41[_0x18b947][_0x49f9('0x76')]&&_0x51494a['order'](_0x1a92bc,_0x1a0c41[_0x18b947][_0x49f9('0x76')]===_0x49f9('0x77')?![]:!![]);_0x51494a[_0x49f9('0x64')](_0x1a92bc,_0x1a0c41[_0x18b947][_0x49f9('0x78')]||_0x1a92bc);}if(_0x1da9a7['joins']){_0x1da9a7[_0x49f9('0x79')]=JSON['parse'](_0x1da9a7['joins']);for(var _0x2af1f5=0x0;_0x2af1f5<_0x1da9a7[_0x49f9('0x79')][_0x49f9('0x36')];_0x2af1f5+=0x1){if(_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x2c')]&&_['includes'](_0x259a20,_0x1da9a7['joins'][_0x2af1f5][_0x49f9('0x2c')])&&_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x87')]&&_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x7a')]&&_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x7b')]){_0x51494a[_0x1da9a7['joins'][_0x2af1f5][_0x49f9('0x2c')]](_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x7a')],null,util[_0x49f9('0x74')](_0x49f9('0x7c'),_0x1da9a7['table'],_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x87')],_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x7a')],_0x1da9a7['joins'][_0x2af1f5][_0x49f9('0x7b')]));}}}if(_0x1da9a7[_0x49f9('0x7d')]){_0x1da9a7[_0x49f9('0x7d')]=JSON['parse'](_0x1da9a7[_0x49f9('0x7d')]);_0x51494a['where'](_0x56a244(_0x1da9a7[_0x49f9('0x7d')]['group']));}_0x3b051c=_0x51494a[_0x49f9('0x88')]();_0x51494a[_0x49f9('0x1d')](_0x2923df);_0x51494a[_0x49f9('0x1c')](0x0);logger[_0x49f9('0x7e')](_0x49f9('0x7f'),_0x51494a[_0x49f9('0x96')]());return db[_0x49f9('0x80')]['query'](_0x51494a[_0x49f9('0x96')](),{'type':db['sequelize'][_0x49f9('0x81')][_0x49f9('0x82')]});}})['then'](function(){return{'sql':_0x3b051c[_0x49f9('0x96')]()};})['then'](respondWithResult(_0xc1b686,null))['catch'](handleError(_0xc1b686,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 705744d..316a763 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 _0xb1ef=['./analyticCustomReport.attributes','define','AnalyticCustomReport','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4b26b5,_0x4f71fd){var _0x4dec71=function(_0x184329){while(--_0x184329){_0x4b26b5['push'](_0x4b26b5['shift']());}};_0x4dec71(++_0x4f71fd);}(_0xb1ef,0x93));var _0xfb1e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1ef[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfb1e('0x0'));var util=require(_0xfb1e('0x1'));var logger=require('../../config/logger')(_0xfb1e('0x2'));var moment=require(_0xfb1e('0x3'));var BPromise=require(_0xfb1e('0x4'));var rp=require(_0xfb1e('0x5'));var fs=require('fs');var path=require(_0xfb1e('0x6'));var rimraf=require(_0xfb1e('0x7'));var config=require(_0xfb1e('0x8'));var attributes=require(_0xfb1e('0x9'));module['exports']=function(_0x1a41a9,_0x382252){return _0x1a41a9[_0xfb1e('0xa')](_0xfb1e('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x248d=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x248d,0x14f));var _0xd248=function(_0x14b2db,_0x1ec1b4){_0x14b2db=_0x14b2db-0x0;var _0x1ecb84=_0x248d[_0x14b2db];return _0x1ecb84;};'use strict';var _=require(_0xd248('0x0'));var util=require(_0xd248('0x1'));var logger=require(_0xd248('0x2'))('api');var moment=require(_0xd248('0x3'));var BPromise=require(_0xd248('0x4'));var rp=require(_0xd248('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd248('0x6'));var config=require(_0xd248('0x7'));var attributes=require(_0xd248('0x8'));module['exports']=function(_0x44ada4,_0x11d0d1){return _0x44ada4[_0xd248('0x9')](_0xd248('0xa'),attributes,{'tableName':_0xd248('0xb'),'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 5da69f4..748a30b 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 _0x4076=['info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then'];(function(_0x54209d,_0x4610a5){var _0x1d47d9=function(_0x55e0d5){while(--_0x55e0d5){_0x54209d['push'](_0x54209d['shift']());}};_0x1d47d9(++_0x4610a5);}(_0x4076,0xdb));var _0x6407=function(_0x215138,_0x791aa){_0x215138=_0x215138-0x0;var _0x2310e0=_0x4076[_0x215138];return _0x2310e0;};'use strict';var _=require(_0x6407('0x0'));var util=require(_0x6407('0x1'));var moment=require('moment');var BPromise=require(_0x6407('0x2'));var rs=require(_0x6407('0x3'));var fs=require('fs');var Redis=require(_0x6407('0x4'));var db=require(_0x6407('0x5'))['db'];var utils=require(_0x6407('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6407('0x7'));var jayson=require(_0x6407('0x8'));var client=jayson[_0x6407('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cfeab,_0x1a96eb,_0x45c859){return new BPromise(function(_0x68bcf9,_0x393736){return client[_0x6407('0xa')](_0x3cfeab,_0x45c859)[_0x6407('0xb')](function(_0x1c3989){logger[_0x6407('0xc')](_0x6407('0xd'),_0x1a96eb,_0x6407('0xe'));logger[_0x6407('0xf')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1a96eb,_0x6407('0xe'),JSON[_0x6407('0x10')](_0x1c3989));if(_0x1c3989[_0x6407('0x11')]){if(_0x1c3989[_0x6407('0x11')][_0x6407('0x12')]===0x1f4){logger['error'](_0x6407('0xd'),_0x1a96eb,_0x1c3989[_0x6407('0x11')][_0x6407('0x13')]);return _0x393736(_0x1c3989[_0x6407('0x11')][_0x6407('0x13')]);}logger['error'](_0x6407('0xd'),_0x1a96eb,_0x1c3989[_0x6407('0x11')][_0x6407('0x13')]);return _0x68bcf9(_0x1c3989[_0x6407('0x11')][_0x6407('0x13')]);}else{logger['info'](_0x6407('0xd'),_0x1a96eb,'request\x20sent');_0x68bcf9(_0x1c3989['result'][_0x6407('0x13')]);}})[_0x6407('0x14')](function(_0x5b198c){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x1a96eb,_0x5b198c);_0x393736(_0x5b198c);});});} \ No newline at end of file +var _0x545c=['AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x55c76f,_0x13b7f4){var _0x1571ff=function(_0x4082ce){while(--_0x4082ce){_0x55c76f['push'](_0x55c76f['shift']());}};_0x1571ff(++_0x13b7f4);}(_0x545c,0x1e3));var _0xc545=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0x545c[_0xfbdff6];return _0x4cb9be;};'use strict';var _=require(_0xc545('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc545('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc545('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc545('0x3'));var logger=require(_0xc545('0x4'))(_0xc545('0x5'));var config=require(_0xc545('0x6'));var jayson=require(_0xc545('0x7'));var client=jayson[_0xc545('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x139dd8,_0x3d3564,_0x80b9f2){return new BPromise(function(_0x148f19,_0x4d5be4){return client[_0xc545('0x9')](_0x139dd8,_0x80b9f2)['then'](function(_0x147fad){logger[_0xc545('0xa')](_0xc545('0xb'),_0x3d3564,_0xc545('0xc'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x3d3564,_0xc545('0xc'),JSON[_0xc545('0xd')](_0x147fad));if(_0x147fad[_0xc545('0xe')]){if(_0x147fad[_0xc545('0xe')][_0xc545('0xf')]===0x1f4){logger[_0xc545('0xe')](_0xc545('0xb'),_0x3d3564,_0x147fad[_0xc545('0xe')][_0xc545('0x10')]);return _0x4d5be4(_0x147fad[_0xc545('0xe')][_0xc545('0x10')]);}logger[_0xc545('0xe')](_0xc545('0xb'),_0x3d3564,_0x147fad[_0xc545('0xe')][_0xc545('0x10')]);return _0x148f19(_0x147fad[_0xc545('0xe')]['message']);}else{logger[_0xc545('0xa')](_0xc545('0xb'),_0x3d3564,_0xc545('0xc'));_0x148f19(_0x147fad[_0xc545('0x11')]['message']);}})[_0xc545('0x12')](function(_0x1a2d04){logger[_0xc545('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3d3564,_0x1a2d04);_0x4d5be4(_0x1a2d04);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 3bfc845..80e43f2 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 _0x9976=['put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','/:id/query','post','create'];(function(_0x23173f,_0x20b2ae){var _0x27b374=function(_0x4273b9){while(--_0x4273b9){_0x23173f['push'](_0x23173f['shift']());}};_0x27b374(++_0x20b2ae);}(_0x9976,0x138));var _0x6997=function(_0x25e2ee,_0x49d785){_0x25e2ee=_0x25e2ee-0x0;var _0x39ef9b=_0x9976[_0x25e2ee];return _0x39ef9b;};'use strict';var multer=require(_0x6997('0x0'));var util=require(_0x6997('0x1'));var path=require(_0x6997('0x2'));var timeout=require(_0x6997('0x3'));var express=require(_0x6997('0x4'));var router=express['Router']();var auth=require(_0x6997('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6997('0x6'));var controller=require(_0x6997('0x7'));router[_0x6997('0x8')]('/',auth[_0x6997('0x9')](),controller[_0x6997('0xa')]);router[_0x6997('0x8')](_0x6997('0xb'),auth[_0x6997('0x9')](),controller[_0x6997('0xc')]);router[_0x6997('0x8')](_0x6997('0xd'),auth[_0x6997('0x9')](),controller['preview']);router['get'](_0x6997('0xe'),auth['isAuthenticated'](),controller['run']);router['get'](_0x6997('0xf'),auth['isAuthenticated'](),controller['query']);router[_0x6997('0x10')]('/',auth[_0x6997('0x9')](),controller[_0x6997('0x11')]);router[_0x6997('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x6997('0x13')]);router[_0x6997('0x14')](_0x6997('0xb'),auth['isAuthenticated'](),controller[_0x6997('0x15')]);module['exports']=router; \ No newline at end of file +var _0x97fc=['query','post','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run'];(function(_0x51e964,_0xf55d22){var _0x20bb85=function(_0x4f3b30){while(--_0x4f3b30){_0x51e964['push'](_0x51e964['shift']());}};_0x20bb85(++_0xf55d22);}(_0x97fc,0x192));var _0xc97f=function(_0x58f49b,_0x40d7c8){_0x58f49b=_0x58f49b-0x0;var _0x5c22b8=_0x97fc[_0x58f49b];return _0x5c22b8;};'use strict';var multer=require(_0xc97f('0x0'));var util=require('util');var path=require(_0xc97f('0x1'));var timeout=require(_0xc97f('0x2'));var express=require(_0xc97f('0x3'));var router=express[_0xc97f('0x4')]();var auth=require(_0xc97f('0x5'));var interaction=require(_0xc97f('0x6'));var config=require(_0xc97f('0x7'));var controller=require(_0xc97f('0x8'));router[_0xc97f('0x9')]('/',auth[_0xc97f('0xa')](),controller[_0xc97f('0xb')]);router[_0xc97f('0x9')](_0xc97f('0xc'),auth['isAuthenticated'](),controller[_0xc97f('0xd')]);router[_0xc97f('0x9')](_0xc97f('0xe'),auth[_0xc97f('0xa')](),controller['preview']);router[_0xc97f('0x9')](_0xc97f('0xf'),auth['isAuthenticated'](),controller['run']);router[_0xc97f('0x9')]('/:id/query',auth['isAuthenticated'](),controller[_0xc97f('0x10')]);router[_0xc97f('0x11')]('/',auth[_0xc97f('0xa')](),controller['create']);router[_0xc97f('0x12')](_0xc97f('0xc'),auth[_0xc97f('0xa')](),controller[_0xc97f('0x13')]);router['delete'](_0xc97f('0xc'),auth['isAuthenticated'](),controller[_0xc97f('0x14')]);module[_0xc97f('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index bf797ff..be39436 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 _0x73ac=['sequelize','exports','STRING','TEXT'];(function(_0x1757cd,_0x53d275){var _0x549048=function(_0x2de929){while(--_0x2de929){_0x1757cd['push'](_0x1757cd['shift']());}};_0x549048(++_0x53d275);}(_0x73ac,0x98));var _0xc73a=function(_0x3fa2cd,_0x270474){_0x3fa2cd=_0x3fa2cd-0x0;var _0x170c39=_0x73ac[_0x3fa2cd];return _0x170c39;};'use strict';var Sequelize=require(_0xc73a('0x0'));module[_0xc73a('0x1')]={'name':{'type':Sequelize[_0xc73a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc73a('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xc73a('0x3')]},'joins':{'type':Sequelize[_0xc73a('0x3')]}}; \ No newline at end of file +var _0xd989=['TEXT','exports','STRING'];(function(_0x16fa00,_0x376b64){var _0x1eb025=function(_0x4b14a4){while(--_0x4b14a4){_0x16fa00['push'](_0x16fa00['shift']());}};_0x1eb025(++_0x376b64);}(_0xd989,0x9d));var _0x9d98=function(_0x11d08e,_0x1cd670){_0x11d08e=_0x11d08e-0x0;var _0x19c8cb=_0xd989[_0x11d08e];return _0x19c8cb;};'use strict';var Sequelize=require('sequelize');module[_0x9d98('0x0')]={'name':{'type':Sequelize[_0x9d98('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9d98('0x1')]},'parent':{'type':Sequelize[_0x9d98('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9d98('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 455ba1b..51433a9 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 _0x552b=['../../mysqldb','dbH','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','merge','options','rows','show','params','keys','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','groupBy','clone','No\x20available\x20data','output','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','runReport','cross_join','MIN(%s)','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x20ac65,_0x1793dd){var _0x243780=function(_0x133123){while(--_0x133123){_0x20ac65['push'](_0x20ac65['shift']());}};_0x243780(++_0x1793dd);}(_0x552b,0x1e2));var _0xb552=function(_0x5c4cc1,_0x5cd4b7){_0x5c4cc1=_0x5c4cc1-0x0;var _0x1944ef=_0x552b[_0x5c4cc1];return _0x1944ef;};'use strict';var pdf=require(_0xb552('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb552('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb552('0x2'));var moment=require(_0xb552('0x3'));var BPromise=require(_0xb552('0x4'));var Mustache=require(_0xb552('0x5'));var util=require(_0xb552('0x6'));var path=require('path');var sox=require(_0xb552('0x7'));var csv=require(_0xb552('0x8'));var ejs=require(_0xb552('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb552('0xa'));var crypto=require(_0xb552('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb552('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb552('0xd'));var Papa=require(_0xb552('0xe'));var Redis=require(_0xb552('0xf'));var authService=require(_0xb552('0x10'));var qs=require(_0xb552('0x11'));var as=require(_0xb552('0x12'));var hardwareService=require(_0xb552('0x13'));var logger=require('../../config/logger')(_0xb552('0x14'));var utils=require(_0xb552('0x15'));var config=require('../../config/environment');var db=require(_0xb552('0x16'))['db'];var dbH=require('../../mysqldb')[_0xb552('0x17')];function respondWithStatusCode(_0x1e3ebc,_0x55ce0d){_0x55ce0d=_0x55ce0d||0xcc;return function(_0x3f69f2){if(_0x3f69f2){return _0x1e3ebc[_0xb552('0x18')](_0x55ce0d);}return _0x1e3ebc[_0xb552('0x19')](_0x55ce0d)[_0xb552('0x1a')]();};}function respondWithResult(_0x5a0623,_0x301049){_0x301049=_0x301049||0xc8;return function(_0x9e008e){if(_0x9e008e){return _0x5a0623['status'](_0x301049)[_0xb552('0x1b')](_0x9e008e);}};}function respondWithFilteredResult(_0x12adab,_0x10c6e8){return function(_0x3937a1){if(_0x3937a1){var _0x1eb820=_0x3937a1[_0xb552('0x1c')],_0x395903=_0x10c6e8[_0xb552('0x1d')],_0x3bfb0e=_0x10c6e8[_0xb552('0x1d')]+_0x10c6e8['limit'],_0x5c0c96;if(_0x3bfb0e>=_0x1eb820){_0x3bfb0e=_0x1eb820;_0x5c0c96=0xc8;}else{_0x5c0c96=0xce;}_0x12adab['status'](_0x5c0c96);return _0x12adab[_0xb552('0x1e')](_0xb552('0x1f'),_0x395903+'-'+_0x3bfb0e+'/'+_0x1eb820)[_0xb552('0x1b')](_0x3937a1);}return null;};}function patchUpdates(_0xc34a68){return function(_0x5851cf){try{jsonpatch[_0xb552('0x20')](_0x5851cf,_0xc34a68,!![]);}catch(_0x1fa4ce){return BPromise[_0xb552('0x21')](_0x1fa4ce);}return _0x5851cf[_0xb552('0x22')]();};}function saveUpdates(_0x5af2ef,_0x4c75b1){return function(_0x2c50dd){if(_0x2c50dd){return _0x2c50dd[_0xb552('0x23')](_0x5af2ef)[_0xb552('0x24')](function(_0x3556a0){return _0x3556a0;});}return null;};}function removeEntity(_0x200f59,_0x5dd858){return function(_0x4f0187){if(_0x4f0187){return _0x4f0187[_0xb552('0x25')]()[_0xb552('0x24')](function(){var _0x435e79=_0x4f0187['get']({'plain':!![]});var _0x24d0d6=_0xb552('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x24d0d6,'resourceId':_0x435e79['id']}})[_0xb552('0x24')](function(){return _0x4f0187;});})[_0xb552('0x24')](function(){_0x200f59[_0xb552('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x505845,_0xe5f347){return function(_0x5a901f){if(!_0x5a901f){_0x505845['sendStatus'](0x194);}return _0x5a901f;};}function handleError(_0x444119,_0x319716){_0x319716=_0x319716||0x1f4;return function(_0x45a8f4){logger[_0xb552('0x27')](_0x45a8f4[_0xb552('0x28')]);if(_0x45a8f4['name']){delete _0x45a8f4[_0xb552('0x29')];}_0x444119[_0xb552('0x19')](_0x319716)['send'](_0x45a8f4);};}exports[_0xb552('0x2a')]=function(_0x23e99f,_0x54a638){var _0x35731f={},_0x197bd6={},_0x4b5c17={'count':0x0,'rows':[]};var _0x19fd68=_[_0xb552('0x2b')](db[_0xb552('0x2c')][_0xb552('0x2d')],function(_0x2042bb){return{'name':_0x2042bb[_0xb552('0x2e')],'type':_0x2042bb['type'][_0xb552('0x2f')]};});_0x197bd6[_0xb552('0x30')]=_['map'](_0x19fd68,_0xb552('0x29'));_0x197bd6[_0xb552('0x31')]=_['keys'](_0x23e99f['query']);_0x197bd6[_0xb552('0x32')]=_[_0xb552('0x33')](_0x197bd6['model'],_0x197bd6[_0xb552('0x31')]);_0x35731f[_0xb552('0x34')]=_[_0xb552('0x33')](_0x197bd6[_0xb552('0x30')],qs[_0xb552('0x35')](_0x23e99f['query'][_0xb552('0x35')]));_0x35731f[_0xb552('0x34')]=_0x35731f[_0xb552('0x34')][_0xb552('0x36')]?_0x35731f[_0xb552('0x34')]:_0x197bd6[_0xb552('0x30')];if(!_0x23e99f[_0xb552('0x31')][_0xb552('0x37')](_0xb552('0x38'))){_0x35731f[_0xb552('0x39')]=qs[_0xb552('0x39')](_0x23e99f[_0xb552('0x31')]['limit']);_0x35731f[_0xb552('0x1d')]=qs[_0xb552('0x1d')](_0x23e99f[_0xb552('0x31')][_0xb552('0x1d')]);}_0x35731f[_0xb552('0x3a')]=qs[_0xb552('0x3b')](_0x23e99f[_0xb552('0x31')][_0xb552('0x3b')]);_0x35731f[_0xb552('0x3c')]=qs[_0xb552('0x32')](_[_0xb552('0x3d')](_0x23e99f[_0xb552('0x31')],_0x197bd6[_0xb552('0x32')]),_0x19fd68);if(_0x23e99f[_0xb552('0x31')][_0xb552('0x3e')]){_0x35731f[_0xb552('0x3c')]=_['merge'](_0x35731f[_0xb552('0x3c')],{'$or':_['map'](_0x19fd68,function(_0x57658c){if(_0x57658c[_0xb552('0x3f')]!=='VIRTUAL'){var _0x47cc05={};_0x47cc05[_0x57658c[_0xb552('0x29')]]={'$like':'%'+_0x23e99f[_0xb552('0x31')][_0xb552('0x3e')]+'%'};return _0x47cc05;}})});}_0x35731f=_[_0xb552('0x40')]({},_0x35731f,_0x23e99f[_0xb552('0x41')]);var _0x279943={'where':_0x35731f[_0xb552('0x3c')]};return db[_0xb552('0x2c')][_0xb552('0x1c')](_0x279943)[_0xb552('0x24')](function(_0xede151){_0x4b5c17[_0xb552('0x1c')]=_0xede151;if(_0x23e99f[_0xb552('0x31')]['includeAll']){_0x35731f['include']=[{'all':!![]}];}return db[_0xb552('0x2c')]['findAll'](_0x35731f);})[_0xb552('0x24')](function(_0x44d867){_0x4b5c17[_0xb552('0x42')]=_0x44d867;return _0x4b5c17;})[_0xb552('0x24')](respondWithFilteredResult(_0x54a638,_0x35731f))['catch'](handleError(_0x54a638,null));};exports[_0xb552('0x43')]=function(_0x5843d9,_0x143b66){var _0x33dc46={'raw':!![],'where':{'id':_0x5843d9[_0xb552('0x44')]['id']}},_0x5f4f98={};_0x5f4f98[_0xb552('0x30')]=_[_0xb552('0x45')](db[_0xb552('0x2c')][_0xb552('0x2d')]);_0x5f4f98[_0xb552('0x31')]=_[_0xb552('0x45')](_0x5843d9[_0xb552('0x31')]);_0x5f4f98['filters']=_[_0xb552('0x33')](_0x5f4f98[_0xb552('0x30')],_0x5f4f98['query']);_0x33dc46['attributes']=_[_0xb552('0x33')](_0x5f4f98[_0xb552('0x30')],qs[_0xb552('0x35')](_0x5843d9[_0xb552('0x31')][_0xb552('0x35')]));_0x33dc46[_0xb552('0x34')]=_0x33dc46['attributes'][_0xb552('0x36')]?_0x33dc46['attributes']:_0x5f4f98[_0xb552('0x30')];if(_0x5843d9[_0xb552('0x31')]['includeAll']){_0x33dc46['include']=[{'all':!![]}];}_0x33dc46=_[_0xb552('0x40')]({},_0x33dc46,_0x5843d9['options']);return db[_0xb552('0x2c')][_0xb552('0x46')](_0x33dc46)['then'](handleEntityNotFound(_0x143b66,null))[_0xb552('0x24')](respondWithResult(_0x143b66,null))[_0xb552('0x47')](handleError(_0x143b66,null));};exports[_0xb552('0x48')]=function(_0x57d58a,_0x3a780a){return db[_0xb552('0x2c')][_0xb552('0x48')](_0x57d58a[_0xb552('0x49')],{})[_0xb552('0x24')](function(_0x107f4b){var _0x1c5822=_0x57d58a['user'][_0xb552('0x4a')]({'plain':!![]});if(!_0x1c5822)throw new Error(_0xb552('0x4b'));if(_0x1c5822[_0xb552('0x4c')]===_0xb552('0x4d')){var _0x4fb784=_0x107f4b[_0xb552('0x4a')]({'plain':!![]});var _0x1078f6=_0xb552('0x4e');return db[_0xb552('0x4f')][_0xb552('0x46')]({'where':{'name':_0x1078f6,'userProfileId':_0x1c5822[_0xb552('0x50')]},'raw':!![]})[_0xb552('0x24')](function(_0x1b8dc3){if(_0x1b8dc3&&_0x1b8dc3[_0xb552('0x51')]===0x0){return db[_0xb552('0x52')][_0xb552('0x48')]({'name':_0x4fb784[_0xb552('0x29')],'resourceId':_0x4fb784['id'],'type':_0xb552('0x26'),'sectionId':_0x1b8dc3['id']},{})[_0xb552('0x24')](function(){return _0x107f4b;});}else{return _0x107f4b;}})[_0xb552('0x47')](function(_0x1bdd68){logger[_0xb552('0x27')](_0xb552('0x53'),_0x1bdd68);throw _0x1bdd68;});}return _0x107f4b;})[_0xb552('0x24')](respondWithResult(_0x3a780a,0xc9))[_0xb552('0x47')](handleError(_0x3a780a,null));};exports[_0xb552('0x23')]=function(_0x200999,_0x231fcc){if(_0x200999[_0xb552('0x49')]['id']){delete _0x200999[_0xb552('0x49')]['id'];}return db['AnalyticDefaultReport']['find']({'where':{'id':_0x200999[_0xb552('0x44')]['id']}})['then'](handleEntityNotFound(_0x231fcc,null))[_0xb552('0x24')](saveUpdates(_0x200999[_0xb552('0x49')],null))[_0xb552('0x24')](respondWithResult(_0x231fcc,null))[_0xb552('0x47')](handleError(_0x231fcc,null));};exports[_0xb552('0x25')]=function(_0x8c6b68,_0x5736df){return db[_0xb552('0x2c')]['find']({'where':{'id':_0x8c6b68[_0xb552('0x44')]['id']}})['then'](handleEntityNotFound(_0x5736df,null))[_0xb552('0x24')](removeEntity(_0x5736df,null))[_0xb552('0x47')](handleError(_0x5736df,null));};exports[_0xb552('0x54')]=function(_0x4d9ae0,_0x56495e){var _0x157b99=0xa;var _0x50eac6=[_0xb552('0x55'),_0xb552('0x56'),_0xb552('0x57'),'cross_join'];var _0x83a3b1={'SUM':_0xb552('0x58'),'COUNT':_0xb552('0x59'),'COUNT DISTINCT':_0xb552('0x5a'),'MAX':_0xb552('0x5b'),'MIN':'MIN(%s)','AVG':_0xb552('0x5c'),'GROUP_CONCAT':_0xb552('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3b4d7c={'SEC_TO_TIME':_0xb552('0x5e'),'DATE':_0xb552('0x5f'),'HOUR':_0xb552('0x60'),'ROUND':_0xb552('0x61'),'UNIX_TIMESTAMP':_0xb552('0x62')};var _0x5e4c59=function(_0x1f0ad4){return!_[_0xb552('0x63')]([_0xb552('0x64'),_0xb552('0x65'),_0xb552('0x66'),_0xb552('0x67')],_0x1f0ad4);};var _0x1187a9=function(_0x5e89bc){if(!_0x5e89bc||!_0x5e89bc[_0xb552('0x68')][_0xb552('0x36')]){return'';}for(var _0x234f95='(',_0x1560a1=0x0;_0x1560a1<_0x5e89bc[_0xb552('0x68')][_0xb552('0x36')];_0x1560a1+=0x1){_0x1560a1>0x0&&(_0x234f95+='\x20'+_0x5e89bc[_0xb552('0x69')]+'\x20');_0x234f95+=_0x5e89bc['rules'][_0x1560a1][_0xb552('0x6a')]?_0x1187a9(_0x5e89bc['rules'][_0x1560a1][_0xb552('0x6a')]):_0x5e89bc[_0xb552('0x68')][_0x1560a1][_0xb552('0x6b')]+'\x20'+_0x5e89bc[_0xb552('0x68')][_0x1560a1][_0xb552('0x6c')]+(_0x5e4c59(_0x5e89bc['rules'][_0x1560a1][_0xb552('0x6c')])?'\x20'+_0x5e89bc[_0xb552('0x68')][_0x1560a1][_0xb552('0x6d')]:'');}return _0x234f95+')';};var _0x283c10={'where':{'id':_0x4d9ae0[_0xb552('0x44')]['id']}},_0x3c4140,_0x5c39ef,_0x2a3f31,_0x389221,_0x346fa7;_0x283c10=_[_0xb552('0x40')]({},_0x283c10,_0x4d9ae0['options']);return db[_0xb552('0x2c')][_0xb552('0x46')](_0x283c10)[_0xb552('0x24')](function(_0x539eab){if(_0x539eab){_0x3c4140=_0x539eab;return _0x539eab[_0xb552('0x6e')]();}return null;})[_0xb552('0x24')](function(_0x423ca9){if(_0x423ca9){if(!_0x423ca9[_0xb552('0x36')]){throw new db[(_0xb552('0x6f'))][(_0xb552('0x70'))](_0xb552('0x71'),0x193);}_0x5c39ef=_0x423ca9;return db[_0xb552('0x72')][_0xb552('0x73')]({'raw':!![]});}return null;})[_0xb552('0x24')](function(_0x3a5533){if(_0x3a5533){_0x2a3f31=_[_0xb552('0x74')](_0x3a5533,'id');var _0x258a1e;var _0x155f7b=squel[_0xb552('0x75')]();_0x155f7b[_0xb552('0x76')](_0x3c4140[_0xb552('0x77')]);for(var _0x3f9efb=0x0;_0x3f9efb<_0x5c39ef[_0xb552('0x36')];_0x3f9efb+=0x1){_0x258a1e=_0x5c39ef[_0x3f9efb][_0xb552('0x78')]?_0x2a3f31[_0x5c39ef[_0x3f9efb][_0xb552('0x78')]][_0xb552('0x79')]:_0x5c39ef[_0x3f9efb][_0xb552('0x6b')];_0x258a1e=_0x5c39ef[_0x3f9efb][_0xb552('0x7a')]?_['replace'](_0x83a3b1[_0x5c39ef[_0x3f9efb][_0xb552('0x7a')]],'%s',_0x258a1e):_0x258a1e;_0x258a1e=_0x5c39ef[_0x3f9efb][_0xb552('0x7b')]?_[_0xb552('0x7c')](_0x3b4d7c[_0x5c39ef[_0x3f9efb][_0xb552('0x7b')]],'%s',_0x258a1e):_0x258a1e;if(_0x5c39ef[_0x3f9efb]['groupBy']){_0x155f7b[_0xb552('0x6a')](_0x258a1e);}_0x5c39ef[_0x3f9efb][_0xb552('0x7d')]&&_0x155f7b[_0xb552('0x3a')](_0x258a1e,_0x5c39ef[_0x3f9efb][_0xb552('0x7d')]===_0xb552('0x7e')?![]:!![]);_0x155f7b[_0xb552('0x6b')](_0x258a1e,_0x5c39ef[_0x3f9efb][_0xb552('0x7f')]||_0x258a1e);}if(_0x3c4140[_0xb552('0x80')]){_0x3c4140[_0xb552('0x80')]=JSON[_0xb552('0x81')](_0x3c4140['joins']);for(var _0x37a110=0x0;_0x37a110<_0x3c4140[_0xb552('0x80')]['length'];_0x37a110+=0x1){if(_0x3c4140[_0xb552('0x80')][_0x37a110]['type']&&_['includes'](_0x50eac6,_0x3c4140[_0xb552('0x80')][_0x37a110][_0xb552('0x3f')])&&_0x3c4140[_0xb552('0x80')][_0x37a110][_0xb552('0x82')]&&_0x3c4140[_0xb552('0x80')][_0x37a110][_0xb552('0x83')]&&_0x3c4140[_0xb552('0x80')][_0x37a110]['foreignKey']){_0x155f7b[_0x3c4140[_0xb552('0x80')][_0x37a110][_0xb552('0x3f')]](_0x3c4140[_0xb552('0x80')][_0x37a110][_0xb552('0x83')],null,util[_0xb552('0x7b')](_0xb552('0x84'),_0x3c4140[_0xb552('0x77')],_0x3c4140[_0xb552('0x80')][_0x37a110][_0xb552('0x82')],_0x3c4140[_0xb552('0x80')][_0x37a110][_0xb552('0x83')],_0x3c4140[_0xb552('0x80')][_0x37a110][_0xb552('0x85')]));}}}if(_0x3c4140[_0xb552('0x86')]){_0x3c4140[_0xb552('0x86')]=JSON[_0xb552('0x81')](_0x3c4140[_0xb552('0x86')]);_0x155f7b[_0xb552('0x3c')](_0x1187a9(_0x3c4140[_0xb552('0x86')][_0xb552('0x6a')]));}_0x346fa7=_0x155f7b['clone']();_0x155f7b[_0xb552('0x39')](_0x157b99);_0x155f7b[_0xb552('0x1d')](0x0);logger[_0xb552('0x87')](_0xb552('0x88'),_0x155f7b[_0xb552('0x89')]());return db[_0xb552('0x8a')][_0xb552('0x31')](_0x155f7b['toString'](),{'type':db[_0xb552('0x8a')][_0xb552('0x8b')][_0xb552('0x8c')]});}})[_0xb552('0x24')](respondWithResult(_0x56495e,null))[_0xb552('0x47')](handleError(_0x56495e,null));};function runReport(_0x5e8630,_0x471916,_0xb2227d){var _0x237337=_0x471916[_0xb552('0x29')];var _0x10a24e=0xa;var _0x3669a9=['join',_0xb552('0x56'),'right_join','cross_join'];var _0x4652fc={'SUM':_0xb552('0x58'),'COUNT':_0xb552('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb552('0x5b'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xb552('0x5d'),'GROUP_CONCAT ASC':_0xb552('0x8d'),'GROUP_CONCAT DESC':_0xb552('0x8e')};var _0x2af3b1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb552('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0xb552('0x61'),'UNIX_TIMESTAMP':_0xb552('0x62')};var _0x111454=function(_0x228197){return!_[_0xb552('0x63')]([_0xb552('0x64'),_0xb552('0x65'),_0xb552('0x66'),_0xb552('0x67')],_0x228197);};var _0x443fb7=function(_0x403ce1){if(!_0x403ce1||!_0x403ce1['rules'][_0xb552('0x36')]){return'';}for(var _0x16a28a='(',_0x1d187e=0x0;_0x1d187e<_0x403ce1[_0xb552('0x68')][_0xb552('0x36')];_0x1d187e+=0x1){_0x1d187e>0x0&&(_0x16a28a+='\x20'+_0x403ce1[_0xb552('0x69')]+'\x20');_0x16a28a+=_0x403ce1[_0xb552('0x68')][_0x1d187e][_0xb552('0x6a')]?_0x443fb7(_0x403ce1[_0xb552('0x68')][_0x1d187e][_0xb552('0x6a')]):_0x403ce1['rules'][_0x1d187e][_0xb552('0x6b')]+'\x20'+_0x403ce1['rules'][_0x1d187e]['condition']+(_0x111454(_0x403ce1[_0xb552('0x68')][_0x1d187e][_0xb552('0x6c')])?'\x20'+_0x403ce1['rules'][_0x1d187e][_0xb552('0x6d')]:'');}return _0x16a28a+')';};var _0x3b93d2={'where':{'id':_0x5e8630['id']}},_0x9e24e0,_0x3de839,_0x537ddb,_0x75c14b,_0x22dda1;_0x3b93d2=_[_0xb552('0x40')]({},_0x3b93d2,_0xb2227d);return db['AnalyticDefaultReport'][_0xb552('0x46')](_0x3b93d2)['then'](function(_0x3d373c){if(_0x3d373c){_0x9e24e0=_0x3d373c;return _0x3d373c[_0xb552('0x6e')]();}return null;})[_0xb552('0x24')](function(_0x1d75cd){if(_0x1d75cd){if(!_0x1d75cd[_0xb552('0x36')]){throw new db[(_0xb552('0x6f'))][(_0xb552('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3de839=_0x1d75cd;return db[_0xb552('0x72')][_0xb552('0x73')]({'raw':!![]});}return null;})[_0xb552('0x24')](function(_0x4ceeaf){if(_0x4ceeaf){_0x537ddb=_[_0xb552('0x74')](_0x4ceeaf,'id');var _0x3bba7f;var _0x9fc88d=squel['select']();_0x9fc88d[_0xb552('0x76')](_0x9e24e0['table']);for(var _0x4a6305=0x0;_0x4a6305<_0x3de839['length'];_0x4a6305+=0x1){_0x3bba7f=_0x3de839[_0x4a6305][_0xb552('0x78')]?_0x537ddb[_0x3de839[_0x4a6305]['MetricId']][_0xb552('0x79')]:_0x3de839[_0x4a6305]['field'];_0x3bba7f=_0x3de839[_0x4a6305][_0xb552('0x7a')]?_[_0xb552('0x7c')](_0x4652fc[_0x3de839[_0x4a6305]['function']],'%s',_0x3bba7f):_0x3bba7f;_0x3bba7f=_0x3de839[_0x4a6305][_0xb552('0x7b')]?_[_0xb552('0x7c')](_0x2af3b1[_0x3de839[_0x4a6305]['format']],'%s',_0x3bba7f):_0x3bba7f;if(_0x3de839[_0x4a6305][_0xb552('0x8f')]){_0x9fc88d[_0xb552('0x6a')](_0x3bba7f);}_0x3de839[_0x4a6305][_0xb552('0x7d')]&&_0x9fc88d[_0xb552('0x3a')](_0x3bba7f,_0x3de839[_0x4a6305][_0xb552('0x7d')]===_0xb552('0x7e')?![]:!![]);_0x9fc88d[_0xb552('0x6b')](_0x3bba7f,_0x3de839[_0x4a6305]['alias']||_0x3bba7f);}if(_0x9e24e0[_0xb552('0x80')]){_0x9e24e0[_0xb552('0x80')]=JSON['parse'](_0x9e24e0['joins']);for(var _0x21a27f=0x0;_0x21a27f<_0x9e24e0[_0xb552('0x80')][_0xb552('0x36')];_0x21a27f+=0x1){if(_0x9e24e0[_0xb552('0x80')][_0x21a27f]['type']&&_[_0xb552('0x63')](_0x3669a9,_0x9e24e0['joins'][_0x21a27f][_0xb552('0x3f')])&&_0x9e24e0[_0xb552('0x80')][_0x21a27f]['parentKey']&&_0x9e24e0[_0xb552('0x80')][_0x21a27f][_0xb552('0x83')]&&_0x9e24e0[_0xb552('0x80')][_0x21a27f][_0xb552('0x85')]){_0x9fc88d[_0x9e24e0[_0xb552('0x80')][_0x21a27f][_0xb552('0x3f')]](_0x9e24e0['joins'][_0x21a27f][_0xb552('0x83')],null,util[_0xb552('0x7b')]('%s.%s\x20=\x20%s.%s',_0x9e24e0[_0xb552('0x77')],_0x9e24e0['joins'][_0x21a27f][_0xb552('0x82')],_0x9e24e0[_0xb552('0x80')][_0x21a27f][_0xb552('0x83')],_0x9e24e0[_0xb552('0x80')][_0x21a27f]['foreignKey']));}}}if(_0x9e24e0['conditions']){_0x9e24e0[_0xb552('0x86')]=JSON['parse'](_0x9e24e0['conditions']);_0x9fc88d[_0xb552('0x3c')](_0x443fb7(_0x9e24e0[_0xb552('0x86')][_0xb552('0x6a')]));}_0x22dda1=_0x9fc88d[_0xb552('0x90')]();_0x9fc88d[_0xb552('0x39')](_0x10a24e);_0x9fc88d['offset'](0x0);logger[_0xb552('0x87')](_0xb552('0x88'),_0x9fc88d['toString']());return db[_0xb552('0x8a')][_0xb552('0x31')](_0x9fc88d[_0xb552('0x89')](),{'type':db[_0xb552('0x8a')][_0xb552('0x8b')][_0xb552('0x8c')]});}})[_0xb552('0x24')](function(_0xa35359){if(!_0xa35359[_0xb552('0x36')]){throw new db[(_0xb552('0x6f'))][(_0xb552('0x70'))](_0xb552('0x91'),0xcc);}if(_0x471916[_0xb552('0x92')]==='web'){return null;}var _0xeb995b=_[_0xb552('0x40')](_0x471916,{'name':_0x471916['fullPath']||_0x471916[_0xb552('0x29')]||_0x9e24e0[_0xb552('0x29')],'basename':_0x237337,'savename':util['format'](_0xb552('0x93'),_0x471916[_0xb552('0x29')]||_0x9e24e0[_0xb552('0x29')],require(_0xb552('0x94'))[_0xb552('0x95')](0x4),_0x471916[_0xb552('0x92')]||_0xb552('0x96')),'reportId':_0x9e24e0['id'],'reportType':_0xb552('0x97')});return db[_0xb552('0x98')][_0xb552('0x48')](_0xeb995b,{'raw':!![]});})[_0xb552('0x24')](function(_0x3610dc){if(_0x9e24e0[_0xb552('0x77')]===_0xb552('0x99')){_0x22dda1[_0xb552('0x3c')](_0x9e24e0['table']+_0xb552('0x9a'),_0x471916[_0xb552('0x9b')],_0x471916[_0xb552('0x9c')]);}else{_0x22dda1[_0xb552('0x3c')](_0x9e24e0[_0xb552('0x77')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x471916['startDate'],_0x471916[_0xb552('0x9c')]);}if(_0x3610dc){logger['info'](_0xb552('0x9d'),_0x22dda1[_0xb552('0x89')]());require(_0xb552('0x9e'))[_0xb552('0x9f')](path[_0xb552('0x55')](__dirname,_0xb552('0xa0'),_0x3610dc[_0xb552('0x92')]),[_0x3610dc['id'],_0x22dda1[_0xb552('0x89')](),path['join'](__dirname,_0xb552('0xa1'),_0x3610dc[_0xb552('0xa2')]),_0x237337]);return _0x3610dc;}else{var _0x229306=squel[_0xb552('0x75')]();_0x229306[_0xb552('0x76')]('('+_0x22dda1['toString']()+')',_0xb552('0xa3'));_0x229306['field']('COUNT(*)','count');_0x22dda1[_0xb552('0x39')](_0x471916[_0xb552('0x39')]||_0x10a24e);_0x22dda1['offset'](_0x471916[_0xb552('0x1d')]||0x0);return dbH[_0xb552('0x8a')][_0xb552('0x31')](_0x229306[_0xb552('0x89')](),{'type':dbH[_0xb552('0x8a')][_0xb552('0x8b')][_0xb552('0x8c')]})[_0xb552('0x24')](function(_0x46bc3c){if(!_0x46bc3c[_0xb552('0x36')]){_0x75c14b=0x0;}else{_0x75c14b=_0x46bc3c[0x0][_0xb552('0x1c')]||0x0;}return dbH[_0xb552('0x8a')][_0xb552('0x31')](_0x22dda1[_0xb552('0x89')](),{'type':dbH[_0xb552('0x8a')][_0xb552('0x8b')][_0xb552('0x8c')]});})[_0xb552('0x24')](function(_0x31238f){return{'rows':_0x31238f||[],'count':_0x75c14b};});}});}exports[_0xb552('0xa4')]=function(_0xbca8e6,_0x1bed6d){return runReport(_0xbca8e6[_0xb552('0x44')],_0xbca8e6['query'],_0xbca8e6['options'])[_0xb552('0x24')](respondWithResult(_0x1bed6d,null))[_0xb552('0x47')](handleError(_0x1bed6d,null));};exports[_0xb552('0xa5')]=runReport;exports[_0xb552('0x31')]=function(_0x5a8e3c,_0x2682ad){var _0x3c0f85=0xa;var _0x16e911=[_0xb552('0x55'),_0xb552('0x56'),_0xb552('0x57'),_0xb552('0xa6')];var _0x243895={'SUM':'SUM(%s)','COUNT':_0xb552('0x59'),'COUNT DISTINCT':_0xb552('0x5a'),'MAX':_0xb552('0x5b'),'MIN':_0xb552('0xa7'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb552('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb552('0x8e')};var _0xdc245e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb552('0x5f'),'HOUR':_0xb552('0x60'),'ROUND':_0xb552('0x61'),'UNIX_TIMESTAMP':_0xb552('0x62')};var _0x5967c8=function(_0x4eb9e6){return!_[_0xb552('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb552('0x66'),_0xb552('0x67')],_0x4eb9e6);};var _0x33612e=function(_0x4e956e){if(!_0x4e956e||!_0x4e956e[_0xb552('0x68')]['length']){return'';}for(var _0x3bd747='(',_0x3afd23=0x0;_0x3afd23<_0x4e956e['rules'][_0xb552('0x36')];_0x3afd23+=0x1){_0x3afd23>0x0&&(_0x3bd747+='\x20'+_0x4e956e[_0xb552('0x69')]+'\x20');_0x3bd747+=_0x4e956e[_0xb552('0x68')][_0x3afd23][_0xb552('0x6a')]?_0x33612e(_0x4e956e['rules'][_0x3afd23]['group']):_0x4e956e[_0xb552('0x68')][_0x3afd23][_0xb552('0x6b')]+'\x20'+_0x4e956e['rules'][_0x3afd23]['condition']+(_0x5967c8(_0x4e956e['rules'][_0x3afd23][_0xb552('0x6c')])?'\x20'+_0x4e956e['rules'][_0x3afd23][_0xb552('0x6d')]:'');}return _0x3bd747+')';};var _0x3a8a6d={'where':{'id':_0x5a8e3c[_0xb552('0x44')]['id']}},_0x37f53a,_0x1e9bb9,_0x2b26ac,_0x3ed7fd,_0x4b573a;_0x3a8a6d=_['merge']({},_0x3a8a6d,_0x5a8e3c['options']);return db['AnalyticDefaultReport'][_0xb552('0x46')](_0x3a8a6d)[_0xb552('0x24')](function(_0x2b8119){if(_0x2b8119){_0x37f53a=_0x2b8119;return _0x2b8119[_0xb552('0x6e')]();}return null;})[_0xb552('0x24')](function(_0x35cbd3){if(_0x35cbd3){if(!_0x35cbd3[_0xb552('0x36')]){throw new db[(_0xb552('0x6f'))][(_0xb552('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1e9bb9=_0x35cbd3;return db[_0xb552('0x72')][_0xb552('0x73')]({'raw':!![]});}return null;})[_0xb552('0x24')](function(_0x27861e){if(_0x27861e){_0x2b26ac=_[_0xb552('0x74')](_0x27861e,'id');var _0x3c8e2f;var _0x513ff0=squel[_0xb552('0x75')]();_0x513ff0[_0xb552('0x76')](_0x37f53a[_0xb552('0x77')]);for(var _0x492f10=0x0;_0x492f10<_0x1e9bb9[_0xb552('0x36')];_0x492f10+=0x1){_0x3c8e2f=_0x1e9bb9[_0x492f10]['MetricId']?_0x2b26ac[_0x1e9bb9[_0x492f10]['MetricId']][_0xb552('0x79')]:_0x1e9bb9[_0x492f10][_0xb552('0x6b')];_0x3c8e2f=_0x1e9bb9[_0x492f10][_0xb552('0x7a')]?_[_0xb552('0x7c')](_0x243895[_0x1e9bb9[_0x492f10]['function']],'%s',_0x3c8e2f):_0x3c8e2f;_0x3c8e2f=_0x1e9bb9[_0x492f10]['format']?_[_0xb552('0x7c')](_0xdc245e[_0x1e9bb9[_0x492f10][_0xb552('0x7b')]],'%s',_0x3c8e2f):_0x3c8e2f;if(_0x1e9bb9[_0x492f10][_0xb552('0x8f')]){_0x513ff0[_0xb552('0x6a')](_0x3c8e2f);}_0x1e9bb9[_0x492f10][_0xb552('0x7d')]&&_0x513ff0['order'](_0x3c8e2f,_0x1e9bb9[_0x492f10][_0xb552('0x7d')]===_0xb552('0x7e')?![]:!![]);_0x513ff0['field'](_0x3c8e2f,_0x1e9bb9[_0x492f10][_0xb552('0x7f')]||_0x3c8e2f);}if(_0x37f53a[_0xb552('0x80')]){_0x37f53a[_0xb552('0x80')]=JSON[_0xb552('0x81')](_0x37f53a['joins']);for(var _0x1193f6=0x0;_0x1193f6<_0x37f53a[_0xb552('0x80')][_0xb552('0x36')];_0x1193f6+=0x1){if(_0x37f53a[_0xb552('0x80')][_0x1193f6][_0xb552('0x3f')]&&_['includes'](_0x16e911,_0x37f53a[_0xb552('0x80')][_0x1193f6][_0xb552('0x3f')])&&_0x37f53a[_0xb552('0x80')][_0x1193f6]['parentKey']&&_0x37f53a[_0xb552('0x80')][_0x1193f6][_0xb552('0x83')]&&_0x37f53a[_0xb552('0x80')][_0x1193f6][_0xb552('0x85')]){_0x513ff0[_0x37f53a[_0xb552('0x80')][_0x1193f6]['type']](_0x37f53a[_0xb552('0x80')][_0x1193f6][_0xb552('0x83')],null,util[_0xb552('0x7b')](_0xb552('0x84'),_0x37f53a[_0xb552('0x77')],_0x37f53a[_0xb552('0x80')][_0x1193f6][_0xb552('0x82')],_0x37f53a[_0xb552('0x80')][_0x1193f6][_0xb552('0x83')],_0x37f53a[_0xb552('0x80')][_0x1193f6]['foreignKey']));}}}if(_0x37f53a[_0xb552('0x86')]){_0x37f53a[_0xb552('0x86')]=JSON[_0xb552('0x81')](_0x37f53a[_0xb552('0x86')]);_0x513ff0[_0xb552('0x3c')](_0x33612e(_0x37f53a[_0xb552('0x86')][_0xb552('0x6a')]));}_0x4b573a=_0x513ff0['clone']();_0x513ff0[_0xb552('0x39')](_0x3c0f85);_0x513ff0[_0xb552('0x1d')](0x0);logger['debug'](_0xb552('0x88'),_0x513ff0[_0xb552('0x89')]());return db[_0xb552('0x8a')][_0xb552('0x31')](_0x513ff0[_0xb552('0x89')](),{'type':db[_0xb552('0x8a')][_0xb552('0x8b')][_0xb552('0x8c')]});}})['then'](function(){return{'sql':_0x4b573a[_0xb552('0x89')]()};})[_0xb552('0x24')](respondWithResult(_0x2682ad,null))[_0xb552('0x47')](handleError(_0x2682ad,null));}; \ No newline at end of file +var _0xe82c=['info','Run\x20Query:','child_process','fork','../../components/export/','countTable','COUNT(*)','run','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','error','stack','name','send','index','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','AnalyticMetric','select','from','table','MetricId','metric','function','replace','format','orderBy','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','sequelize','toString','QueryTypes','SELECT','MIN(%s)','IS\x20NULL','IS\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','DESC','Limited\x20Query:','No\x20available\x20data','output','web','fullPath','generate','csv','default','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate'];(function(_0x3a6c33,_0x356492){var _0x4b4b72=function(_0x2fcc45){while(--_0x2fcc45){_0x3a6c33['push'](_0x3a6c33['shift']());}};_0x4b4b72(++_0x356492);}(_0xe82c,0xae));var _0xce82=function(_0x85f6e8,_0x2e43c7){_0x85f6e8=_0x85f6e8-0x0;var _0x50dde3=_0xe82c[_0x85f6e8];return _0x50dde3;};'use strict';var pdf=require(_0xce82('0x0'));var emlformat=require(_0xce82('0x1'));var rimraf=require(_0xce82('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce82('0x3'));var rp=require(_0xce82('0x4'));var moment=require(_0xce82('0x5'));var BPromise=require(_0xce82('0x6'));var Mustache=require(_0xce82('0x7'));var util=require('util');var path=require(_0xce82('0x8'));var sox=require(_0xce82('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xce82('0xa'));var squel=require(_0xce82('0xb'));var crypto=require(_0xce82('0xc'));var jsforce=require(_0xce82('0xd'));var deskjs=require(_0xce82('0xe'));var toCsv=require(_0xce82('0xf'));var querystring=require(_0xce82('0x10'));var Papa=require(_0xce82('0x11'));var Redis=require('ioredis');var authService=require(_0xce82('0x12'));var qs=require(_0xce82('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce82('0x14'));var logger=require(_0xce82('0x15'))(_0xce82('0x16'));var utils=require(_0xce82('0x17'));var config=require(_0xce82('0x18'));var db=require(_0xce82('0x19'))['db'];var dbH=require(_0xce82('0x19'))[_0xce82('0x1a')];function respondWithStatusCode(_0x1d5f10,_0xaa42f1){_0xaa42f1=_0xaa42f1||0xcc;return function(_0x23e38d){if(_0x23e38d){return _0x1d5f10[_0xce82('0x1b')](_0xaa42f1);}return _0x1d5f10[_0xce82('0x1c')](_0xaa42f1)[_0xce82('0x1d')]();};}function respondWithResult(_0x360493,_0x94791a){_0x94791a=_0x94791a||0xc8;return function(_0x87994){if(_0x87994){return _0x360493['status'](_0x94791a)[_0xce82('0x1e')](_0x87994);}};}function respondWithFilteredResult(_0x4f36a2,_0x507b26){return function(_0x1d2223){if(_0x1d2223){var _0x2b5926=_0x1d2223[_0xce82('0x1f')],_0x1c852f=_0x507b26[_0xce82('0x20')],_0x1b2004=_0x507b26[_0xce82('0x20')]+_0x507b26[_0xce82('0x21')],_0x3e2bcd;if(_0x1b2004>=_0x2b5926){_0x1b2004=_0x2b5926;_0x3e2bcd=0xc8;}else{_0x3e2bcd=0xce;}_0x4f36a2[_0xce82('0x1c')](_0x3e2bcd);return _0x4f36a2['set'](_0xce82('0x22'),_0x1c852f+'-'+_0x1b2004+'/'+_0x2b5926)[_0xce82('0x1e')](_0x1d2223);}return null;};}function patchUpdates(_0xc08a0f){return function(_0x38805e){try{jsonpatch[_0xce82('0x23')](_0x38805e,_0xc08a0f,!![]);}catch(_0x33362){return BPromise[_0xce82('0x24')](_0x33362);}return _0x38805e[_0xce82('0x25')]();};}function saveUpdates(_0x266f56,_0x225218){return function(_0xa1c707){if(_0xa1c707){return _0xa1c707['update'](_0x266f56)[_0xce82('0x26')](function(_0x372586){return _0x372586;});}return null;};}function removeEntity(_0x5b1c27,_0x5ad2f2){return function(_0x4fb284){if(_0x4fb284){return _0x4fb284[_0xce82('0x27')]()[_0xce82('0x26')](function(){var _0x3ea021=_0x4fb284[_0xce82('0x28')]({'plain':!![]});var _0x9c8b0a=_0xce82('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x9c8b0a,'resourceId':_0x3ea021['id']}})[_0xce82('0x26')](function(){return _0x4fb284;});})[_0xce82('0x26')](function(){_0x5b1c27['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46b288,_0x489265){return function(_0x1bdaac){if(!_0x1bdaac){_0x46b288[_0xce82('0x1b')](0x194);}return _0x1bdaac;};}function handleError(_0x57aadc,_0xd0076b){_0xd0076b=_0xd0076b||0x1f4;return function(_0x2c1c4c){logger[_0xce82('0x2a')](_0x2c1c4c[_0xce82('0x2b')]);if(_0x2c1c4c['name']){delete _0x2c1c4c[_0xce82('0x2c')];}_0x57aadc['status'](_0xd0076b)[_0xce82('0x2d')](_0x2c1c4c);};}exports[_0xce82('0x2e')]=function(_0x256e7e,_0x19726e){var _0x22a462={},_0x314bf1={},_0x47255e={'count':0x0,'rows':[]};var _0x316ed0=_['map'](db[_0xce82('0x2f')][_0xce82('0x30')],function(_0x529343){return{'name':_0x529343['fieldName'],'type':_0x529343[_0xce82('0x31')][_0xce82('0x32')]};});_0x314bf1[_0xce82('0x33')]=_['map'](_0x316ed0,_0xce82('0x2c'));_0x314bf1[_0xce82('0x34')]=_[_0xce82('0x35')](_0x256e7e[_0xce82('0x34')]);_0x314bf1['filters']=_[_0xce82('0x36')](_0x314bf1['model'],_0x314bf1['query']);_0x22a462[_0xce82('0x37')]=_['intersection'](_0x314bf1[_0xce82('0x33')],qs[_0xce82('0x38')](_0x256e7e[_0xce82('0x34')][_0xce82('0x38')]));_0x22a462[_0xce82('0x37')]=_0x22a462[_0xce82('0x37')]['length']?_0x22a462[_0xce82('0x37')]:_0x314bf1['model'];if(!_0x256e7e[_0xce82('0x34')][_0xce82('0x39')]('nolimit')){_0x22a462[_0xce82('0x21')]=qs[_0xce82('0x21')](_0x256e7e[_0xce82('0x34')][_0xce82('0x21')]);_0x22a462[_0xce82('0x20')]=qs[_0xce82('0x20')](_0x256e7e[_0xce82('0x34')][_0xce82('0x20')]);}_0x22a462[_0xce82('0x3a')]=qs[_0xce82('0x3b')](_0x256e7e[_0xce82('0x34')][_0xce82('0x3b')]);_0x22a462[_0xce82('0x3c')]=qs[_0xce82('0x3d')](_['pick'](_0x256e7e[_0xce82('0x34')],_0x314bf1[_0xce82('0x3d')]),_0x316ed0);if(_0x256e7e['query'][_0xce82('0x3e')]){_0x22a462[_0xce82('0x3c')]=_[_0xce82('0x3f')](_0x22a462[_0xce82('0x3c')],{'$or':_[_0xce82('0x40')](_0x316ed0,function(_0x559b04){if(_0x559b04[_0xce82('0x31')]!==_0xce82('0x41')){var _0x9e6d40={};_0x9e6d40[_0x559b04[_0xce82('0x2c')]]={'$like':'%'+_0x256e7e[_0xce82('0x34')]['filter']+'%'};return _0x9e6d40;}})});}_0x22a462=_[_0xce82('0x3f')]({},_0x22a462,_0x256e7e[_0xce82('0x42')]);var _0x144376={'where':_0x22a462[_0xce82('0x3c')]};return db[_0xce82('0x2f')]['count'](_0x144376)[_0xce82('0x26')](function(_0x59fd91){_0x47255e[_0xce82('0x1f')]=_0x59fd91;if(_0x256e7e['query'][_0xce82('0x43')]){_0x22a462['include']=[{'all':!![]}];}return db[_0xce82('0x2f')][_0xce82('0x44')](_0x22a462);})[_0xce82('0x26')](function(_0x17bee6){_0x47255e[_0xce82('0x45')]=_0x17bee6;return _0x47255e;})['then'](respondWithFilteredResult(_0x19726e,_0x22a462))[_0xce82('0x46')](handleError(_0x19726e,null));};exports['show']=function(_0x138660,_0x219072){var _0xc4da7f={'raw':!![],'where':{'id':_0x138660[_0xce82('0x47')]['id']}},_0x648124={};_0x648124[_0xce82('0x33')]=_[_0xce82('0x35')](db[_0xce82('0x2f')][_0xce82('0x30')]);_0x648124[_0xce82('0x34')]=_[_0xce82('0x35')](_0x138660[_0xce82('0x34')]);_0x648124[_0xce82('0x3d')]=_[_0xce82('0x36')](_0x648124[_0xce82('0x33')],_0x648124['query']);_0xc4da7f['attributes']=_['intersection'](_0x648124[_0xce82('0x33')],qs[_0xce82('0x38')](_0x138660[_0xce82('0x34')][_0xce82('0x38')]));_0xc4da7f['attributes']=_0xc4da7f['attributes'][_0xce82('0x48')]?_0xc4da7f[_0xce82('0x37')]:_0x648124[_0xce82('0x33')];if(_0x138660[_0xce82('0x34')][_0xce82('0x43')]){_0xc4da7f[_0xce82('0x49')]=[{'all':!![]}];}_0xc4da7f=_['merge']({},_0xc4da7f,_0x138660['options']);return db[_0xce82('0x2f')][_0xce82('0x4a')](_0xc4da7f)['then'](handleEntityNotFound(_0x219072,null))[_0xce82('0x26')](respondWithResult(_0x219072,null))[_0xce82('0x46')](handleError(_0x219072,null));};exports[_0xce82('0x4b')]=function(_0x251304,_0x44f365){return db[_0xce82('0x2f')][_0xce82('0x4b')](_0x251304[_0xce82('0x4c')],{})[_0xce82('0x26')](function(_0x1a900e){var _0x5ec350=_0x251304[_0xce82('0x4d')][_0xce82('0x28')]({'plain':!![]});if(!_0x5ec350)throw new Error(_0xce82('0x4e'));if(_0x5ec350[_0xce82('0x4f')]===_0xce82('0x4d')){var _0x2a7b1a=_0x1a900e[_0xce82('0x28')]({'plain':!![]});var _0x3d976e='Reports';return db[_0xce82('0x50')][_0xce82('0x4a')]({'where':{'name':_0x3d976e,'userProfileId':_0x5ec350[_0xce82('0x51')]},'raw':!![]})[_0xce82('0x26')](function(_0x3c6931){if(_0x3c6931&&_0x3c6931[_0xce82('0x52')]===0x0){return db[_0xce82('0x53')][_0xce82('0x4b')]({'name':_0x2a7b1a[_0xce82('0x2c')],'resourceId':_0x2a7b1a['id'],'type':_0xce82('0x29'),'sectionId':_0x3c6931['id']},{})[_0xce82('0x26')](function(){return _0x1a900e;});}else{return _0x1a900e;}})[_0xce82('0x46')](function(_0x58e083){logger['error'](_0xce82('0x54'),_0x58e083);throw _0x58e083;});}return _0x1a900e;})[_0xce82('0x26')](respondWithResult(_0x44f365,0xc9))[_0xce82('0x46')](handleError(_0x44f365,null));};exports[_0xce82('0x55')]=function(_0x3cb8b2,_0x3eca04){if(_0x3cb8b2[_0xce82('0x4c')]['id']){delete _0x3cb8b2[_0xce82('0x4c')]['id'];}return db['AnalyticDefaultReport'][_0xce82('0x4a')]({'where':{'id':_0x3cb8b2[_0xce82('0x47')]['id']}})[_0xce82('0x26')](handleEntityNotFound(_0x3eca04,null))[_0xce82('0x26')](saveUpdates(_0x3cb8b2['body'],null))[_0xce82('0x26')](respondWithResult(_0x3eca04,null))['catch'](handleError(_0x3eca04,null));};exports[_0xce82('0x27')]=function(_0xa45d1f,_0x26dfc8){return db[_0xce82('0x2f')][_0xce82('0x4a')]({'where':{'id':_0xa45d1f[_0xce82('0x47')]['id']}})[_0xce82('0x26')](handleEntityNotFound(_0x26dfc8,null))[_0xce82('0x26')](removeEntity(_0x26dfc8,null))[_0xce82('0x46')](handleError(_0x26dfc8,null));};exports[_0xce82('0x56')]=function(_0x4129f4,_0x4e8722){var _0x474848=0xa;var _0x5ddaa6=[_0xce82('0x57'),_0xce82('0x58'),_0xce82('0x59'),_0xce82('0x5a')];var _0x1d251b={'SUM':_0xce82('0x5b'),'COUNT':_0xce82('0x5c'),'COUNT DISTINCT':_0xce82('0x5d'),'MAX':_0xce82('0x5e'),'MIN':'MIN(%s)','AVG':_0xce82('0x5f'),'GROUP_CONCAT':_0xce82('0x60'),'GROUP_CONCAT ASC':_0xce82('0x61'),'GROUP_CONCAT DESC':_0xce82('0x62')};var _0x45d22e={'SEC_TO_TIME':_0xce82('0x63'),'DATE':_0xce82('0x64'),'HOUR':_0xce82('0x65'),'ROUND':_0xce82('0x66'),'UNIX_TIMESTAMP':_0xce82('0x67')};var _0x501d8b=function(_0x2fcad3){return!_[_0xce82('0x68')](['IS\x20NULL',_0xce82('0x69'),'IS\x20EMPTY',_0xce82('0x6a')],_0x2fcad3);};var _0x295255=function(_0x25c467){if(!_0x25c467||!_0x25c467[_0xce82('0x6b')][_0xce82('0x48')]){return'';}for(var _0x25eabc='(',_0xc9af2e=0x0;_0xc9af2e<_0x25c467[_0xce82('0x6b')][_0xce82('0x48')];_0xc9af2e+=0x1){_0xc9af2e>0x0&&(_0x25eabc+='\x20'+_0x25c467[_0xce82('0x6c')]+'\x20');_0x25eabc+=_0x25c467[_0xce82('0x6b')][_0xc9af2e][_0xce82('0x6d')]?_0x295255(_0x25c467[_0xce82('0x6b')][_0xc9af2e]['group']):_0x25c467['rules'][_0xc9af2e][_0xce82('0x6e')]+'\x20'+_0x25c467['rules'][_0xc9af2e][_0xce82('0x6f')]+(_0x501d8b(_0x25c467[_0xce82('0x6b')][_0xc9af2e][_0xce82('0x6f')])?'\x20'+_0x25c467[_0xce82('0x6b')][_0xc9af2e][_0xce82('0x70')]:'');}return _0x25eabc+')';};var _0x460f90={'where':{'id':_0x4129f4[_0xce82('0x47')]['id']}},_0xd0c0eb,_0x603331,_0x1e715d,_0x580a90,_0x5bb986;_0x460f90=_[_0xce82('0x3f')]({},_0x460f90,_0x4129f4[_0xce82('0x42')]);return db[_0xce82('0x2f')]['find'](_0x460f90)[_0xce82('0x26')](function(_0x11323a){if(_0x11323a){_0xd0c0eb=_0x11323a;return _0x11323a[_0xce82('0x71')]();}return null;})[_0xce82('0x26')](function(_0x55c89b){if(_0x55c89b){if(!_0x55c89b[_0xce82('0x48')]){throw new db[(_0xce82('0x72'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x603331=_0x55c89b;return db[_0xce82('0x73')][_0xce82('0x44')]({'raw':!![]});}return null;})[_0xce82('0x26')](function(_0x28cd7a){if(_0x28cd7a){_0x1e715d=_['keyBy'](_0x28cd7a,'id');var _0x301f72;var _0x4dca5c=squel[_0xce82('0x74')]();_0x4dca5c[_0xce82('0x75')](_0xd0c0eb[_0xce82('0x76')]);for(var _0x34f2fd=0x0;_0x34f2fd<_0x603331[_0xce82('0x48')];_0x34f2fd+=0x1){_0x301f72=_0x603331[_0x34f2fd][_0xce82('0x77')]?_0x1e715d[_0x603331[_0x34f2fd]['MetricId']][_0xce82('0x78')]:_0x603331[_0x34f2fd]['field'];_0x301f72=_0x603331[_0x34f2fd][_0xce82('0x79')]?_[_0xce82('0x7a')](_0x1d251b[_0x603331[_0x34f2fd][_0xce82('0x79')]],'%s',_0x301f72):_0x301f72;_0x301f72=_0x603331[_0x34f2fd][_0xce82('0x7b')]?_[_0xce82('0x7a')](_0x45d22e[_0x603331[_0x34f2fd][_0xce82('0x7b')]],'%s',_0x301f72):_0x301f72;if(_0x603331[_0x34f2fd]['groupBy']){_0x4dca5c[_0xce82('0x6d')](_0x301f72);}_0x603331[_0x34f2fd][_0xce82('0x7c')]&&_0x4dca5c[_0xce82('0x3a')](_0x301f72,_0x603331[_0x34f2fd][_0xce82('0x7c')]==='DESC'?![]:!![]);_0x4dca5c[_0xce82('0x6e')](_0x301f72,_0x603331[_0x34f2fd][_0xce82('0x7d')]||_0x301f72);}if(_0xd0c0eb[_0xce82('0x7e')]){_0xd0c0eb[_0xce82('0x7e')]=JSON[_0xce82('0x7f')](_0xd0c0eb[_0xce82('0x7e')]);for(var _0x1fa552=0x0;_0x1fa552<_0xd0c0eb[_0xce82('0x7e')]['length'];_0x1fa552+=0x1){if(_0xd0c0eb['joins'][_0x1fa552][_0xce82('0x31')]&&_[_0xce82('0x68')](_0x5ddaa6,_0xd0c0eb[_0xce82('0x7e')][_0x1fa552][_0xce82('0x31')])&&_0xd0c0eb[_0xce82('0x7e')][_0x1fa552]['parentKey']&&_0xd0c0eb['joins'][_0x1fa552][_0xce82('0x80')]&&_0xd0c0eb[_0xce82('0x7e')][_0x1fa552][_0xce82('0x81')]){_0x4dca5c[_0xd0c0eb[_0xce82('0x7e')][_0x1fa552][_0xce82('0x31')]](_0xd0c0eb[_0xce82('0x7e')][_0x1fa552][_0xce82('0x80')],null,util[_0xce82('0x7b')](_0xce82('0x82'),_0xd0c0eb[_0xce82('0x76')],_0xd0c0eb[_0xce82('0x7e')][_0x1fa552][_0xce82('0x83')],_0xd0c0eb[_0xce82('0x7e')][_0x1fa552][_0xce82('0x80')],_0xd0c0eb[_0xce82('0x7e')][_0x1fa552][_0xce82('0x81')]));}}}if(_0xd0c0eb[_0xce82('0x84')]){_0xd0c0eb['conditions']=JSON['parse'](_0xd0c0eb[_0xce82('0x84')]);_0x4dca5c[_0xce82('0x3c')](_0x295255(_0xd0c0eb['conditions'][_0xce82('0x6d')]));}_0x5bb986=_0x4dca5c[_0xce82('0x85')]();_0x4dca5c[_0xce82('0x21')](_0x474848);_0x4dca5c['offset'](0x0);logger[_0xce82('0x86')]('Limited\x20Query:',_0x4dca5c['toString']());return db[_0xce82('0x87')][_0xce82('0x34')](_0x4dca5c[_0xce82('0x88')](),{'type':db['sequelize'][_0xce82('0x89')][_0xce82('0x8a')]});}})[_0xce82('0x26')](respondWithResult(_0x4e8722,null))['catch'](handleError(_0x4e8722,null));};function runReport(_0x2c7f80,_0x1ae763,_0x3f6f2c){var _0x1fae86=_0x1ae763['name'];var _0x130fc0=0xa;var _0x3594a2=[_0xce82('0x57'),'left_join',_0xce82('0x59'),'cross_join'];var _0x47ed93={'SUM':_0xce82('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xce82('0x5d'),'MAX':_0xce82('0x5e'),'MIN':_0xce82('0x8b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xce82('0x60'),'GROUP_CONCAT ASC':_0xce82('0x61'),'GROUP_CONCAT DESC':_0xce82('0x62')};var _0x37420f={'SEC_TO_TIME':_0xce82('0x63'),'DATE':_0xce82('0x64'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xce82('0x67')};var _0x46cf4c=function(_0x1f399b){return!_[_0xce82('0x68')]([_0xce82('0x8c'),_0xce82('0x69'),_0xce82('0x8d'),_0xce82('0x6a')],_0x1f399b);};var _0x47a14b=function(_0x49852c){if(!_0x49852c||!_0x49852c[_0xce82('0x6b')][_0xce82('0x48')]){return'';}for(var _0x197bab='(',_0x28ff52=0x0;_0x28ff52<_0x49852c['rules'][_0xce82('0x48')];_0x28ff52+=0x1){_0x28ff52>0x0&&(_0x197bab+='\x20'+_0x49852c[_0xce82('0x6c')]+'\x20');_0x197bab+=_0x49852c[_0xce82('0x6b')][_0x28ff52]['group']?_0x47a14b(_0x49852c[_0xce82('0x6b')][_0x28ff52][_0xce82('0x6d')]):_0x49852c['rules'][_0x28ff52][_0xce82('0x6e')]+'\x20'+_0x49852c[_0xce82('0x6b')][_0x28ff52][_0xce82('0x6f')]+(_0x46cf4c(_0x49852c[_0xce82('0x6b')][_0x28ff52][_0xce82('0x6f')])?'\x20'+_0x49852c['rules'][_0x28ff52][_0xce82('0x70')]:'');}return _0x197bab+')';};var _0x196426={'where':{'id':_0x2c7f80['id']}},_0x23492a,_0xcb2f77,_0x534100,_0x3a2545,_0x4e4f4b;_0x196426=_[_0xce82('0x3f')]({},_0x196426,_0x3f6f2c);return db[_0xce82('0x2f')][_0xce82('0x4a')](_0x196426)[_0xce82('0x26')](function(_0x16af07){if(_0x16af07){_0x23492a=_0x16af07;return _0x16af07[_0xce82('0x71')]();}return null;})['then'](function(_0xd69238){if(_0xd69238){if(!_0xd69238['length']){throw new db[(_0xce82('0x72'))][(_0xce82('0x8e'))](_0xce82('0x8f'),0x193);}_0xcb2f77=_0xd69238;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xce82('0x26')](function(_0x331f7d){if(_0x331f7d){_0x534100=_[_0xce82('0x90')](_0x331f7d,'id');var _0x40fc4d;var _0x943900=squel[_0xce82('0x74')]();_0x943900[_0xce82('0x75')](_0x23492a[_0xce82('0x76')]);for(var _0x2bb43c=0x0;_0x2bb43c<_0xcb2f77[_0xce82('0x48')];_0x2bb43c+=0x1){_0x40fc4d=_0xcb2f77[_0x2bb43c][_0xce82('0x77')]?_0x534100[_0xcb2f77[_0x2bb43c][_0xce82('0x77')]]['metric']:_0xcb2f77[_0x2bb43c][_0xce82('0x6e')];_0x40fc4d=_0xcb2f77[_0x2bb43c][_0xce82('0x79')]?_['replace'](_0x47ed93[_0xcb2f77[_0x2bb43c][_0xce82('0x79')]],'%s',_0x40fc4d):_0x40fc4d;_0x40fc4d=_0xcb2f77[_0x2bb43c][_0xce82('0x7b')]?_[_0xce82('0x7a')](_0x37420f[_0xcb2f77[_0x2bb43c][_0xce82('0x7b')]],'%s',_0x40fc4d):_0x40fc4d;if(_0xcb2f77[_0x2bb43c]['groupBy']){_0x943900[_0xce82('0x6d')](_0x40fc4d);}_0xcb2f77[_0x2bb43c][_0xce82('0x7c')]&&_0x943900[_0xce82('0x3a')](_0x40fc4d,_0xcb2f77[_0x2bb43c][_0xce82('0x7c')]===_0xce82('0x91')?![]:!![]);_0x943900['field'](_0x40fc4d,_0xcb2f77[_0x2bb43c][_0xce82('0x7d')]||_0x40fc4d);}if(_0x23492a['joins']){_0x23492a[_0xce82('0x7e')]=JSON[_0xce82('0x7f')](_0x23492a[_0xce82('0x7e')]);for(var _0x4c4360=0x0;_0x4c4360<_0x23492a[_0xce82('0x7e')][_0xce82('0x48')];_0x4c4360+=0x1){if(_0x23492a['joins'][_0x4c4360][_0xce82('0x31')]&&_['includes'](_0x3594a2,_0x23492a[_0xce82('0x7e')][_0x4c4360][_0xce82('0x31')])&&_0x23492a[_0xce82('0x7e')][_0x4c4360][_0xce82('0x83')]&&_0x23492a[_0xce82('0x7e')][_0x4c4360][_0xce82('0x80')]&&_0x23492a[_0xce82('0x7e')][_0x4c4360][_0xce82('0x81')]){_0x943900[_0x23492a['joins'][_0x4c4360]['type']](_0x23492a['joins'][_0x4c4360][_0xce82('0x80')],null,util[_0xce82('0x7b')](_0xce82('0x82'),_0x23492a['table'],_0x23492a['joins'][_0x4c4360]['parentKey'],_0x23492a[_0xce82('0x7e')][_0x4c4360][_0xce82('0x80')],_0x23492a['joins'][_0x4c4360][_0xce82('0x81')]));}}}if(_0x23492a['conditions']){_0x23492a[_0xce82('0x84')]=JSON[_0xce82('0x7f')](_0x23492a[_0xce82('0x84')]);_0x943900[_0xce82('0x3c')](_0x47a14b(_0x23492a['conditions'][_0xce82('0x6d')]));}_0x4e4f4b=_0x943900[_0xce82('0x85')]();_0x943900[_0xce82('0x21')](_0x130fc0);_0x943900['offset'](0x0);logger[_0xce82('0x86')](_0xce82('0x92'),_0x943900[_0xce82('0x88')]());return db[_0xce82('0x87')][_0xce82('0x34')](_0x943900['toString'](),{'type':db[_0xce82('0x87')][_0xce82('0x89')][_0xce82('0x8a')]});}})[_0xce82('0x26')](function(_0xaf56b6){if(!_0xaf56b6[_0xce82('0x48')]){throw new db['Sequelize'][(_0xce82('0x8e'))](_0xce82('0x93'),0xcc);}if(_0x1ae763[_0xce82('0x94')]===_0xce82('0x95')){return null;}var _0x1ec191=_[_0xce82('0x3f')](_0x1ae763,{'name':_0x1ae763[_0xce82('0x96')]||_0x1ae763[_0xce82('0x2c')]||_0x23492a['name'],'basename':_0x1fae86,'savename':util['format']('%s-%s.%s',_0x1ae763[_0xce82('0x2c')]||_0x23492a['name'],require('randomstring')[_0xce82('0x97')](0x4),_0x1ae763['output']||_0xce82('0x98')),'reportId':_0x23492a['id'],'reportType':_0xce82('0x99')});return db['AnalyticExtractedReport'][_0xce82('0x4b')](_0x1ec191,{'raw':!![]});})[_0xce82('0x26')](function(_0x5d758c){if(_0x23492a[_0xce82('0x76')]===_0xce82('0x9a')){_0x4e4f4b[_0xce82('0x3c')](_0x23492a[_0xce82('0x76')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1ae763['startDate'],_0x1ae763[_0xce82('0x9b')]);}else{_0x4e4f4b['where'](_0x23492a[_0xce82('0x76')]+_0xce82('0x9c'),_0x1ae763[_0xce82('0x9d')],_0x1ae763[_0xce82('0x9b')]);}if(_0x5d758c){logger[_0xce82('0x9e')](_0xce82('0x9f'),_0x4e4f4b[_0xce82('0x88')]());require(_0xce82('0xa0'))[_0xce82('0xa1')](path[_0xce82('0x57')](__dirname,_0xce82('0xa2'),_0x5d758c[_0xce82('0x94')]),[_0x5d758c['id'],_0x4e4f4b[_0xce82('0x88')](),path[_0xce82('0x57')](__dirname,'../../files/reports',_0x5d758c['savename']),_0x1fae86]);return _0x5d758c;}else{var _0x966b57=squel[_0xce82('0x74')]();_0x966b57[_0xce82('0x75')]('('+_0x4e4f4b[_0xce82('0x88')]()+')',_0xce82('0xa3'));_0x966b57[_0xce82('0x6e')](_0xce82('0xa4'),'count');_0x4e4f4b[_0xce82('0x21')](_0x1ae763[_0xce82('0x21')]||_0x130fc0);_0x4e4f4b[_0xce82('0x20')](_0x1ae763[_0xce82('0x20')]||0x0);return dbH[_0xce82('0x87')][_0xce82('0x34')](_0x966b57[_0xce82('0x88')](),{'type':dbH[_0xce82('0x87')][_0xce82('0x89')][_0xce82('0x8a')]})['then'](function(_0x556017){if(!_0x556017[_0xce82('0x48')]){_0x3a2545=0x0;}else{_0x3a2545=_0x556017[0x0][_0xce82('0x1f')]||0x0;}return dbH['sequelize'][_0xce82('0x34')](_0x4e4f4b[_0xce82('0x88')](),{'type':dbH[_0xce82('0x87')]['QueryTypes'][_0xce82('0x8a')]});})['then'](function(_0xce99c4){return{'rows':_0xce99c4||[],'count':_0x3a2545};});}});}exports[_0xce82('0xa5')]=function(_0x13c384,_0x14a44d){return runReport(_0x13c384[_0xce82('0x47')],_0x13c384[_0xce82('0x34')],_0x13c384[_0xce82('0x42')])[_0xce82('0x26')](respondWithResult(_0x14a44d,null))['catch'](handleError(_0x14a44d,null));};exports['runReport']=runReport;exports[_0xce82('0x34')]=function(_0x1700b2,_0x441274){var _0x4c85ae=0xa;var _0x4254e2=[_0xce82('0x57'),'left_join',_0xce82('0x59'),_0xce82('0x5a')];var _0x5a4a16={'SUM':'SUM(%s)','COUNT':_0xce82('0x5c'),'COUNT DISTINCT':_0xce82('0x5d'),'MAX':_0xce82('0x5e'),'MIN':_0xce82('0x8b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xce82('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xce82('0x62')};var _0x1874ac={'SEC_TO_TIME':_0xce82('0x63'),'DATE':_0xce82('0x64'),'HOUR':_0xce82('0x65'),'ROUND':_0xce82('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3169d7=function(_0x12d5a9){return!_['includes']([_0xce82('0x8c'),_0xce82('0x69'),_0xce82('0x8d'),'IS\x20NOT\x20EMPTY'],_0x12d5a9);};var _0x40c015=function(_0x3a93ff){if(!_0x3a93ff||!_0x3a93ff[_0xce82('0x6b')][_0xce82('0x48')]){return'';}for(var _0x26d6ec='(',_0xbd6b4b=0x0;_0xbd6b4b<_0x3a93ff[_0xce82('0x6b')][_0xce82('0x48')];_0xbd6b4b+=0x1){_0xbd6b4b>0x0&&(_0x26d6ec+='\x20'+_0x3a93ff[_0xce82('0x6c')]+'\x20');_0x26d6ec+=_0x3a93ff[_0xce82('0x6b')][_0xbd6b4b][_0xce82('0x6d')]?_0x40c015(_0x3a93ff['rules'][_0xbd6b4b][_0xce82('0x6d')]):_0x3a93ff[_0xce82('0x6b')][_0xbd6b4b][_0xce82('0x6e')]+'\x20'+_0x3a93ff['rules'][_0xbd6b4b][_0xce82('0x6f')]+(_0x3169d7(_0x3a93ff[_0xce82('0x6b')][_0xbd6b4b][_0xce82('0x6f')])?'\x20'+_0x3a93ff[_0xce82('0x6b')][_0xbd6b4b][_0xce82('0x70')]:'');}return _0x26d6ec+')';};var _0x5d9271={'where':{'id':_0x1700b2[_0xce82('0x47')]['id']}},_0x2346b4,_0x1b2b70,_0x5c0d09,_0x28ea29,_0x5f0d71;_0x5d9271=_[_0xce82('0x3f')]({},_0x5d9271,_0x1700b2[_0xce82('0x42')]);return db[_0xce82('0x2f')]['find'](_0x5d9271)[_0xce82('0x26')](function(_0x2aa01b){if(_0x2aa01b){_0x2346b4=_0x2aa01b;return _0x2aa01b[_0xce82('0x71')]();}return null;})['then'](function(_0x39796e){if(_0x39796e){if(!_0x39796e[_0xce82('0x48')]){throw new db[(_0xce82('0x72'))][(_0xce82('0x8e'))](_0xce82('0x8f'),0x193);}_0x1b2b70=_0x39796e;return db[_0xce82('0x73')][_0xce82('0x44')]({'raw':!![]});}return null;})[_0xce82('0x26')](function(_0x18cfec){if(_0x18cfec){_0x5c0d09=_['keyBy'](_0x18cfec,'id');var _0x927097;var _0x2a9c9c=squel[_0xce82('0x74')]();_0x2a9c9c[_0xce82('0x75')](_0x2346b4[_0xce82('0x76')]);for(var _0x17829a=0x0;_0x17829a<_0x1b2b70['length'];_0x17829a+=0x1){_0x927097=_0x1b2b70[_0x17829a][_0xce82('0x77')]?_0x5c0d09[_0x1b2b70[_0x17829a][_0xce82('0x77')]][_0xce82('0x78')]:_0x1b2b70[_0x17829a]['field'];_0x927097=_0x1b2b70[_0x17829a][_0xce82('0x79')]?_[_0xce82('0x7a')](_0x5a4a16[_0x1b2b70[_0x17829a][_0xce82('0x79')]],'%s',_0x927097):_0x927097;_0x927097=_0x1b2b70[_0x17829a][_0xce82('0x7b')]?_[_0xce82('0x7a')](_0x1874ac[_0x1b2b70[_0x17829a][_0xce82('0x7b')]],'%s',_0x927097):_0x927097;if(_0x1b2b70[_0x17829a]['groupBy']){_0x2a9c9c[_0xce82('0x6d')](_0x927097);}_0x1b2b70[_0x17829a]['orderBy']&&_0x2a9c9c[_0xce82('0x3a')](_0x927097,_0x1b2b70[_0x17829a][_0xce82('0x7c')]===_0xce82('0x91')?![]:!![]);_0x2a9c9c[_0xce82('0x6e')](_0x927097,_0x1b2b70[_0x17829a][_0xce82('0x7d')]||_0x927097);}if(_0x2346b4['joins']){_0x2346b4[_0xce82('0x7e')]=JSON['parse'](_0x2346b4[_0xce82('0x7e')]);for(var _0x485d4d=0x0;_0x485d4d<_0x2346b4['joins'][_0xce82('0x48')];_0x485d4d+=0x1){if(_0x2346b4[_0xce82('0x7e')][_0x485d4d][_0xce82('0x31')]&&_[_0xce82('0x68')](_0x4254e2,_0x2346b4[_0xce82('0x7e')][_0x485d4d][_0xce82('0x31')])&&_0x2346b4[_0xce82('0x7e')][_0x485d4d][_0xce82('0x83')]&&_0x2346b4['joins'][_0x485d4d]['foreignTable']&&_0x2346b4[_0xce82('0x7e')][_0x485d4d][_0xce82('0x81')]){_0x2a9c9c[_0x2346b4[_0xce82('0x7e')][_0x485d4d]['type']](_0x2346b4['joins'][_0x485d4d][_0xce82('0x80')],null,util[_0xce82('0x7b')](_0xce82('0x82'),_0x2346b4[_0xce82('0x76')],_0x2346b4[_0xce82('0x7e')][_0x485d4d][_0xce82('0x83')],_0x2346b4[_0xce82('0x7e')][_0x485d4d][_0xce82('0x80')],_0x2346b4['joins'][_0x485d4d]['foreignKey']));}}}if(_0x2346b4[_0xce82('0x84')]){_0x2346b4[_0xce82('0x84')]=JSON['parse'](_0x2346b4[_0xce82('0x84')]);_0x2a9c9c[_0xce82('0x3c')](_0x40c015(_0x2346b4[_0xce82('0x84')][_0xce82('0x6d')]));}_0x5f0d71=_0x2a9c9c[_0xce82('0x85')]();_0x2a9c9c[_0xce82('0x21')](_0x4c85ae);_0x2a9c9c['offset'](0x0);logger[_0xce82('0x86')]('Limited\x20Query:',_0x2a9c9c['toString']());return db[_0xce82('0x87')][_0xce82('0x34')](_0x2a9c9c[_0xce82('0x88')](),{'type':db[_0xce82('0x87')]['QueryTypes']['SELECT']});}})[_0xce82('0x26')](function(){return{'sql':_0x5f0d71[_0xce82('0x88')]()};})[_0xce82('0x26')](respondWithResult(_0x441274,null))['catch'](handleError(_0x441274,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index f6a4a25..0f2e642 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 _0x66fa=['define','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x66fa,0x117));var _0xa66f=function(_0x547657,_0x5ee353){_0x547657=_0x547657-0x0;var _0x56c5e3=_0x66fa[_0x547657];return _0x56c5e3;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var logger=require('../../config/logger')(_0xa66f('0x2'));var moment=require(_0xa66f('0x3'));var BPromise=require(_0xa66f('0x4'));var rp=require(_0xa66f('0x5'));var fs=require('fs');var path=require(_0xa66f('0x6'));var rimraf=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x2239d3,_0x20a150){return _0x2239d3[_0xa66f('0x9')](_0xa66f('0xa'),attributes,{'tableName':_0xa66f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','lodash','util','../../config/logger','api','moment'];(function(_0x816485,_0x2f4ff0){var _0x3f7d25=function(_0x2339ed){while(--_0x2339ed){_0x816485['push'](_0x816485['shift']());}};_0x3f7d25(++_0x2f4ff0);}(_0x53ec,0x192));var _0xc53e=function(_0x4e566c,_0x16e04c){_0x4e566c=_0x4e566c-0x0;var _0x31947e=_0x53ec[_0x4e566c];return _0x31947e;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 69fc4db..409f8e0 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 _0xc91b=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash'];(function(_0x46b17c,_0x38d50c){var _0xee6fa2=function(_0x4430c5){while(--_0x4430c5){_0x46b17c['push'](_0x46b17c['shift']());}};_0xee6fa2(++_0x38d50c);}(_0xc91b,0x16f));var _0xbc91=function(_0x1f29d4,_0x20cdb6){_0x1f29d4=_0x1f29d4-0x0;var _0x1caf45=_0xc91b[_0x1f29d4];return _0x1caf45;};'use strict';var _=require(_0xbc91('0x0'));var util=require(_0xbc91('0x1'));var moment=require(_0xbc91('0x2'));var BPromise=require(_0xbc91('0x3'));var rs=require(_0xbc91('0x4'));var fs=require('fs');var Redis=require(_0xbc91('0x5'));var db=require(_0xbc91('0x6'))['db'];var utils=require(_0xbc91('0x7'));var logger=require('../../config/logger')(_0xbc91('0x8'));var config=require(_0xbc91('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbc91('0xa')][_0xbc91('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x535cb9,_0xf88d45,_0x43731a){return new BPromise(function(_0x36e15f,_0x34f079){return client[_0xbc91('0xc')](_0x535cb9,_0x43731a)[_0xbc91('0xd')](function(_0xa20d9){logger['info'](_0xbc91('0xe'),_0xf88d45,_0xbc91('0xf'));logger[_0xbc91('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0xf88d45,'request\x20sent',JSON[_0xbc91('0x11')](_0xa20d9));if(_0xa20d9[_0xbc91('0x12')]){if(_0xa20d9['error']['code']===0x1f4){logger[_0xbc91('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xf88d45,_0xa20d9['error'][_0xbc91('0x13')]);return _0x34f079(_0xa20d9[_0xbc91('0x12')][_0xbc91('0x13')]);}logger[_0xbc91('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xf88d45,_0xa20d9['error'][_0xbc91('0x13')]);return _0x36e15f(_0xa20d9[_0xbc91('0x12')]['message']);}else{logger[_0xbc91('0x14')](_0xbc91('0xe'),_0xf88d45,_0xbc91('0xf'));_0x36e15f(_0xa20d9[_0xbc91('0x15')][_0xbc91('0x13')]);}})[_0xbc91('0x16')](function(_0xb92600){logger[_0xbc91('0x12')](_0xbc91('0xe'),_0xf88d45,_0xb92600);_0x34f079(_0xb92600);});});} \ No newline at end of file +var _0x590a=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x211897,_0x12b0ac){var _0x35952f=function(_0x18f318){while(--_0x18f318){_0x211897['push'](_0x211897['shift']());}};_0x35952f(++_0x12b0ac);}(_0x590a,0x159));var _0xa590=function(_0x6adbf1,_0x5779c7){_0x6adbf1=_0x6adbf1-0x0;var _0x3b8a42=_0x590a[_0x6adbf1];return _0x3b8a42;};'use strict';var _=require('lodash');var util=require(_0xa590('0x0'));var moment=require(_0xa590('0x1'));var BPromise=require(_0xa590('0x2'));var rs=require(_0xa590('0x3'));var fs=require('fs');var Redis=require(_0xa590('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa590('0x5'))(_0xa590('0x6'));var config=require(_0xa590('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa590('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dcf20,_0x163d19,_0x2ad01a){return new BPromise(function(_0x27a5fa,_0x5d9565){return client['request'](_0x2dcf20,_0x2ad01a)[_0xa590('0x9')](function(_0x486f78){logger[_0xa590('0xa')](_0xa590('0xb'),_0x163d19,_0xa590('0xc'));logger['debug'](_0xa590('0xd'),_0x163d19,_0xa590('0xc'),JSON[_0xa590('0xe')](_0x486f78));if(_0x486f78[_0xa590('0xf')]){if(_0x486f78[_0xa590('0xf')][_0xa590('0x10')]===0x1f4){logger[_0xa590('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x163d19,_0x486f78['error'][_0xa590('0x11')]);return _0x5d9565(_0x486f78[_0xa590('0xf')][_0xa590('0x11')]);}logger[_0xa590('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x163d19,_0x486f78[_0xa590('0xf')][_0xa590('0x11')]);return _0x27a5fa(_0x486f78['error']['message']);}else{logger[_0xa590('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x163d19,_0xa590('0xc'));_0x27a5fa(_0x486f78[_0xa590('0x12')][_0xa590('0x11')]);}})[_0xa590('0x13')](function(_0xfb7055){logger[_0xa590('0xf')](_0xa590('0xb'),_0x163d19,_0xfb7055);_0x5d9565(_0xfb7055);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 62553a0..41d275e 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 _0xb9ef=['isAuthenticated','show','get','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','update','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','/:id'];(function(_0x33fd46,_0x575863){var _0xfe858c=function(_0x2d1802){while(--_0x2d1802){_0x33fd46['push'](_0x33fd46['shift']());}};_0xfe858c(++_0x575863);}(_0xb9ef,0xa8));var _0xfb9e=function(_0x47b232,_0x5abe98){_0x47b232=_0x47b232-0x0;var _0x4f21fe=_0xb9ef[_0x47b232];return _0x4f21fe;};'use strict';var multer=require(_0xfb9e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfb9e('0x1'));var express=require(_0xfb9e('0x2'));var router=express[_0xfb9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xfb9e('0x4'));var config=require(_0xfb9e('0x5'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xfb9e('0x6')]);router['get'](_0xfb9e('0x7'),auth[_0xfb9e('0x8')](),controller[_0xfb9e('0x9')]);router[_0xfb9e('0xa')](_0xfb9e('0xb'),auth['isAuthenticated'](),controller[_0xfb9e('0xc')]);router[_0xfb9e('0xa')](_0xfb9e('0xd'),auth[_0xfb9e('0x8')](),controller['run']);router['get'](_0xfb9e('0xe'),auth['isAuthenticated'](),controller[_0xfb9e('0xf')]);router[_0xfb9e('0x10')]('/',auth['isAuthenticated'](),controller[_0xfb9e('0x11')]);router[_0xfb9e('0x12')](_0xfb9e('0x7'),auth['isAuthenticated'](),controller[_0xfb9e('0x13')]);router['delete'](_0xfb9e('0x7'),auth[_0xfb9e('0x8')](),controller[_0xfb9e('0x14')]);module[_0xfb9e('0x15')]=router; \ No newline at end of file +var _0xe37e=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','query','create','put'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xe37e,0xbc));var _0xee37=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xe37e[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require(_0xee37('0x0'));var util=require(_0xee37('0x1'));var path=require(_0xee37('0x2'));var timeout=require(_0xee37('0x3'));var express=require(_0xee37('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xee37('0x5'));var config=require(_0xee37('0x6'));var controller=require(_0xee37('0x7'));router['get']('/',auth[_0xee37('0x8')](),controller[_0xee37('0x9')]);router[_0xee37('0xa')](_0xee37('0xb'),auth[_0xee37('0x8')](),controller[_0xee37('0xc')]);router['get'](_0xee37('0xd'),auth[_0xee37('0x8')](),controller[_0xee37('0xe')]);router['get'](_0xee37('0xf'),auth[_0xee37('0x8')](),controller['run']);router[_0xee37('0xa')]('/:id/query',auth[_0xee37('0x8')](),controller[_0xee37('0x10')]);router['post']('/',auth[_0xee37('0x8')](),controller[_0xee37('0x11')]);router[_0xee37('0x12')](_0xee37('0xb'),auth[_0xee37('0x8')](),controller[_0xee37('0x13')]);router[_0xee37('0x14')](_0xee37('0xb'),auth['isAuthenticated'](),controller[_0xee37('0x15')]);module[_0xee37('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index f4b02c7..ac39966 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 _0x0bc4=['exports','STRING','ENUM','csv','xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED'];(function(_0x3e33c7,_0x1c691d){var _0x2d1629=function(_0x226266){while(--_0x226266){_0x3e33c7['push'](_0x3e33c7['shift']());}};_0x2d1629(++_0x1c691d);}(_0x0bc4,0x6e));var _0x40bc=function(_0x44df38,_0x36a713){_0x44df38=_0x44df38-0x0;var _0x4f388e=_0x0bc4[_0x44df38];return _0x4f388e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x40bc('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x40bc('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x40bc('0x2')](_0x40bc('0x3'),'pdf',_0x40bc('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x40bc('0x1')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x40bc('0x5')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x40bc('0x2')](_0x40bc('0x6'),_0x40bc('0x7')),'allowNull':![],'defaultValue':_0x40bc('0x6')},'reportId':{'type':Sequelize[_0x40bc('0x8')](0xb)[_0x40bc('0x9')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4974=['DATE','Loading','manual','scheduled','INTEGER','sequelize','moment','exports','STRING','ENUM','csv','xlsx'];(function(_0x4aa76f,_0x5c8dfd){var _0x55dcd8=function(_0x42cee9){while(--_0x42cee9){_0x4aa76f['push'](_0x4aa76f['shift']());}};_0x55dcd8(++_0x5c8dfd);}(_0x4974,0x125));var _0x4497=function(_0x41790f,_0x3b4c01){_0x41790f=_0x41790f-0x0;var _0x3df424=_0x4974[_0x41790f];return _0x3df424;};'use strict';var Sequelize=require(_0x4497('0x0'));var moment=require(_0x4497('0x1'));module[_0x4497('0x2')]={'name':{'type':Sequelize[_0x4497('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x4497('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x4497('0x4')](_0x4497('0x5'),'pdf',_0x4497('0x6')),'allowNull':![],'defaultValue':_0x4497('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x4497('0x7')]},'endDate':{'type':Sequelize[_0x4497('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x4497('0x8')},'type':{'type':Sequelize[_0x4497('0x4')](_0x4497('0x9'),_0x4497('0xa')),'allowNull':![],'defaultValue':_0x4497('0x9')},'reportId':{'type':Sequelize[_0x4497('0xb')](0xb)['UNSIGNED']},'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 9ea2aec..332a6aa 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 _0xb13a=['show','params','rawAttributes','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','savename','output','existsSync','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','download','format','%s.%s','basename','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','ExtractedReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','AnalyticExtractedReport','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch'];(function(_0x1cd585,_0x54276b){var _0x3ca87f=function(_0x224de8){while(--_0x224de8){_0x1cd585['push'](_0x1cd585['shift']());}};_0x3ca87f(++_0x54276b);}(_0xb13a,0x12a));var _0xab13=function(_0x451524,_0x5f2639){_0x451524=_0x451524-0x0;var _0x31c51d=_0xb13a[_0x451524];return _0x31c51d;};'use strict';var pdf=require(_0xab13('0x0'));var emlformat=require(_0xab13('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xab13('0x2'));var jsonpatch=require(_0xab13('0x3'));var rp=require(_0xab13('0x4'));var moment=require(_0xab13('0x5'));var BPromise=require(_0xab13('0x6'));var Mustache=require(_0xab13('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xab13('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xab13('0x9'));var squel=require(_0xab13('0xa'));var crypto=require('crypto');var jsforce=require(_0xab13('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xab13('0x8'));var querystring=require(_0xab13('0xc'));var Papa=require(_0xab13('0xd'));var Redis=require(_0xab13('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xab13('0xf'));var as=require(_0xab13('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xab13('0x11'))(_0xab13('0x12'));var utils=require(_0xab13('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25c82c,_0x4aad26){_0x4aad26=_0x4aad26||0xcc;return function(_0x10da6f){if(_0x10da6f){return _0x25c82c['sendStatus'](_0x4aad26);}return _0x25c82c[_0xab13('0x14')](_0x4aad26)[_0xab13('0x15')]();};}function respondWithResult(_0x30fb7e,_0x304678){_0x304678=_0x304678||0xc8;return function(_0x147588){if(_0x147588){return _0x30fb7e[_0xab13('0x14')](_0x304678)[_0xab13('0x16')](_0x147588);}};}function respondWithFilteredResult(_0x23cedd,_0x5a6277){return function(_0x19cdc2){if(_0x19cdc2){var _0x37d106=_0x19cdc2['count'],_0x733435=_0x5a6277[_0xab13('0x17')],_0x564fc3=_0x5a6277[_0xab13('0x17')]+_0x5a6277[_0xab13('0x18')],_0x5c7592;if(_0x564fc3>=_0x37d106){_0x564fc3=_0x37d106;_0x5c7592=0xc8;}else{_0x5c7592=0xce;}_0x23cedd[_0xab13('0x14')](_0x5c7592);return _0x23cedd[_0xab13('0x19')](_0xab13('0x1a'),_0x733435+'-'+_0x564fc3+'/'+_0x37d106)[_0xab13('0x16')](_0x19cdc2);}return null;};}function patchUpdates(_0x5890b3){return function(_0x2e18d6){try{jsonpatch[_0xab13('0x1b')](_0x2e18d6,_0x5890b3,!![]);}catch(_0x3b9c58){return BPromise[_0xab13('0x1c')](_0x3b9c58);}return _0x2e18d6[_0xab13('0x1d')]();};}function saveUpdates(_0x3908b7,_0x3df266){return function(_0x521546){if(_0x521546){return _0x521546[_0xab13('0x1e')](_0x3908b7)[_0xab13('0x1f')](function(_0x25cef3){return _0x25cef3;});}return null;};}function removeEntity(_0x5bbd0b,_0x49b36b){return function(_0x5b7047){if(_0x5b7047){return _0x5b7047['destroy']()[_0xab13('0x1f')](function(){var _0x1ead97=_0x5b7047['get']({'plain':!![]});var _0x217d0b=_0xab13('0x20');return db[_0xab13('0x21')][_0xab13('0x22')]({'where':{'type':_0x217d0b,'resourceId':_0x1ead97['id']}})[_0xab13('0x1f')](function(){return _0x5b7047;});})['then'](function(){_0x5bbd0b[_0xab13('0x14')](0xcc)[_0xab13('0x15')]();});}};}function handleEntityNotFound(_0x27d83c,_0x579a33){return function(_0x54ff7b){if(!_0x54ff7b){_0x27d83c[_0xab13('0x23')](0x194);}return _0x54ff7b;};}function handleError(_0x29f021,_0x3b7ffb){_0x3b7ffb=_0x3b7ffb||0x1f4;return function(_0x8c7509){logger[_0xab13('0x24')](_0x8c7509[_0xab13('0x25')]);if(_0x8c7509[_0xab13('0x26')]){delete _0x8c7509['name'];}_0x29f021[_0xab13('0x14')](_0x3b7ffb)[_0xab13('0x27')](_0x8c7509);};}exports[_0xab13('0x28')]=function(_0x4d58b5,_0x2491df){var _0x1b1a0c={},_0xb33194={},_0x2b355c={'count':0x0,'rows':[]};var _0x682839=_['map'](db[_0xab13('0x29')]['rawAttributes'],function(_0x18cc05){return{'name':_0x18cc05[_0xab13('0x2a')],'type':_0x18cc05[_0xab13('0x2b')][_0xab13('0x2c')]};});_0xb33194[_0xab13('0x2d')]=_[_0xab13('0x2e')](_0x682839,_0xab13('0x26'));_0xb33194[_0xab13('0x2f')]=_[_0xab13('0x30')](_0x4d58b5['query']);_0xb33194[_0xab13('0x31')]=_['intersection'](_0xb33194[_0xab13('0x2d')],_0xb33194[_0xab13('0x2f')]);_0x1b1a0c[_0xab13('0x32')]=_['intersection'](_0xb33194['model'],qs[_0xab13('0x33')](_0x4d58b5[_0xab13('0x2f')][_0xab13('0x33')]));_0x1b1a0c['attributes']=_0x1b1a0c[_0xab13('0x32')][_0xab13('0x34')]?_0x1b1a0c[_0xab13('0x32')]:_0xb33194[_0xab13('0x2d')];if(!_0x4d58b5[_0xab13('0x2f')][_0xab13('0x35')](_0xab13('0x36'))){_0x1b1a0c[_0xab13('0x18')]=qs[_0xab13('0x18')](_0x4d58b5[_0xab13('0x2f')][_0xab13('0x18')]);_0x1b1a0c[_0xab13('0x17')]=qs[_0xab13('0x17')](_0x4d58b5[_0xab13('0x2f')][_0xab13('0x17')]);}_0x1b1a0c['order']=qs[_0xab13('0x37')](_0x4d58b5[_0xab13('0x2f')][_0xab13('0x37')]);_0x1b1a0c['where']=qs[_0xab13('0x31')](_[_0xab13('0x38')](_0x4d58b5[_0xab13('0x2f')],_0xb33194['filters']),_0x682839);if(_0x4d58b5['query'][_0xab13('0x39')]){_0x1b1a0c[_0xab13('0x3a')]=_[_0xab13('0x3b')](_0x1b1a0c[_0xab13('0x3a')],{'$or':_['map'](_0x682839,function(_0xc9fa9a){if(_0xc9fa9a[_0xab13('0x2b')]!=='VIRTUAL'){var _0x2b4116={};_0x2b4116[_0xc9fa9a['name']]={'$like':'%'+_0x4d58b5[_0xab13('0x2f')][_0xab13('0x39')]+'%'};return _0x2b4116;}})});}_0x1b1a0c=_['merge']({},_0x1b1a0c,_0x4d58b5[_0xab13('0x3c')]);var _0x4e1bb9={'where':_0x1b1a0c['where']};return db['AnalyticExtractedReport']['count'](_0x4e1bb9)['then'](function(_0x45217a){_0x2b355c['count']=_0x45217a;if(_0x4d58b5[_0xab13('0x2f')][_0xab13('0x3d')]){_0x1b1a0c[_0xab13('0x3e')]=[{'all':!![]}];}return db[_0xab13('0x29')][_0xab13('0x3f')](_0x1b1a0c);})[_0xab13('0x1f')](function(_0x52a367){_0x2b355c[_0xab13('0x40')]=_0x52a367;return _0x2b355c;})[_0xab13('0x1f')](respondWithFilteredResult(_0x2491df,_0x1b1a0c))[_0xab13('0x41')](handleError(_0x2491df,null));};exports[_0xab13('0x42')]=function(_0x221f0c,_0x59d890){var _0x32be28={'raw':!![],'where':{'id':_0x221f0c[_0xab13('0x43')]['id']}},_0x2825ad={};_0x2825ad[_0xab13('0x2d')]=_['keys'](db[_0xab13('0x29')][_0xab13('0x44')]);_0x2825ad[_0xab13('0x2f')]=_[_0xab13('0x30')](_0x221f0c['query']);_0x2825ad[_0xab13('0x31')]=_['intersection'](_0x2825ad['model'],_0x2825ad[_0xab13('0x2f')]);_0x32be28[_0xab13('0x32')]=_[_0xab13('0x45')](_0x2825ad[_0xab13('0x2d')],qs[_0xab13('0x33')](_0x221f0c['query']['fields']));_0x32be28[_0xab13('0x32')]=_0x32be28[_0xab13('0x32')][_0xab13('0x34')]?_0x32be28[_0xab13('0x32')]:_0x2825ad[_0xab13('0x2d')];if(_0x221f0c['query'][_0xab13('0x3d')]){_0x32be28[_0xab13('0x3e')]=[{'all':!![]}];}_0x32be28=_['merge']({},_0x32be28,_0x221f0c[_0xab13('0x3c')]);return db[_0xab13('0x29')]['find'](_0x32be28)[_0xab13('0x1f')](handleEntityNotFound(_0x59d890,null))[_0xab13('0x1f')](respondWithResult(_0x59d890,null))['catch'](handleError(_0x59d890,null));};exports['create']=function(_0x38e977,_0x19ed67){return db[_0xab13('0x29')][_0xab13('0x46')](_0x38e977[_0xab13('0x47')],{})['then'](function(_0x423af3){var _0x204cde=_0x38e977[_0xab13('0x48')]['get']({'plain':!![]});if(!_0x204cde)throw new Error(_0xab13('0x49'));if(_0x204cde[_0xab13('0x4a')]===_0xab13('0x48')){var _0x3511eb=_0x423af3['get']({'plain':!![]});var _0x246d1d=_0xab13('0x20');return db[_0xab13('0x4b')][_0xab13('0x4c')]({'where':{'name':_0x246d1d,'userProfileId':_0x204cde[_0xab13('0x4d')]},'raw':!![]})['then'](function(_0x191b93){if(_0x191b93&&_0x191b93[_0xab13('0x4e')]===0x0){return db[_0xab13('0x21')]['create']({'name':_0x3511eb['name'],'resourceId':_0x3511eb['id'],'type':_0x191b93['name'],'sectionId':_0x191b93['id']},{})[_0xab13('0x1f')](function(){return _0x423af3;});}else{return _0x423af3;}})['catch'](function(_0x3a9bd0){logger[_0xab13('0x24')](_0xab13('0x4f'),_0x3a9bd0);throw _0x3a9bd0;});}return _0x423af3;})[_0xab13('0x1f')](respondWithResult(_0x19ed67,0xc9))[_0xab13('0x41')](handleError(_0x19ed67,null));};exports[_0xab13('0x1e')]=function(_0x2e61b3,_0x2b3ec1){if(_0x2e61b3[_0xab13('0x47')]['id']){delete _0x2e61b3[_0xab13('0x47')]['id'];}return db[_0xab13('0x29')]['find']({'where':{'id':_0x2e61b3['params']['id']}})[_0xab13('0x1f')](handleEntityNotFound(_0x2b3ec1,null))[_0xab13('0x1f')](saveUpdates(_0x2e61b3[_0xab13('0x47')],null))[_0xab13('0x1f')](respondWithResult(_0x2b3ec1,null))['catch'](handleError(_0x2b3ec1,null));};exports['destroy']=function(_0xb476e1,_0x1fb5c4){return db[_0xab13('0x29')][_0xab13('0x4c')]({'where':{'id':_0xb476e1[_0xab13('0x43')]['id']}})[_0xab13('0x1f')](handleEntityNotFound(_0x1fb5c4,null))['then'](removeEntity(_0x1fb5c4,null))['catch'](handleError(_0x1fb5c4,null));};exports['download']=function(_0x2a2f6c,_0x377693,_0x14f72b){return db[_0xab13('0x29')][_0xab13('0x4c')]({'where':{'id':_0x2a2f6c['params']['id']},'attributes':['name','basename',_0xab13('0x50'),_0xab13('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x377693,null))[_0xab13('0x1f')](function(_0x5862fd){if(_0x5862fd){if(!fs[_0xab13('0x52')](path['join'](config[_0xab13('0x53')],_0xab13('0x54'),_0x5862fd[_0xab13('0x50')]))){throw new db['Sequelize'][(_0xab13('0x55'))](_0xab13('0x56'));}if(_0x2a2f6c['query']['exists']){return _0x377693['sendStatus'](0xc8);}return _0x377693[_0xab13('0x57')](path['join'](config[_0xab13('0x53')],_0xab13('0x54'),_0x5862fd[_0xab13('0x50')]),util[_0xab13('0x58')](_0xab13('0x59'),_0x5862fd[_0xab13('0x5a')]||_0x5862fd['name'],_0x5862fd[_0xab13('0x51')]['toLowerCase']()));}})['catch'](handleError(_0x377693,null));}; \ No newline at end of file +var _0xf234=['body','params','download','basename','output','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','savename','format','%s.%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','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/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','ExtractedReports','then','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','filter','includeAll','include','catch','show','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'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf234,0xd2));var _0x4f23=function(_0x1e7aa7,_0x4e83fd){_0x1e7aa7=_0x1e7aa7-0x0;var _0x4d3c52=_0xf234[_0x1e7aa7];return _0x4d3c52;};'use strict';var pdf=require(_0x4f23('0x0'));var emlformat=require(_0x4f23('0x1'));var rimraf=require(_0x4f23('0x2'));var zipdir=require(_0x4f23('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f23('0x4'));var moment=require(_0x4f23('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4f23('0x6'));var util=require(_0x4f23('0x7'));var path=require(_0x4f23('0x8'));var sox=require('sox');var csv=require(_0x4f23('0x9'));var ejs=require(_0x4f23('0xa'));var fs=require('fs');var _=require(_0x4f23('0xb'));var squel=require(_0x4f23('0xc'));var crypto=require(_0x4f23('0xd'));var jsforce=require(_0x4f23('0xe'));var deskjs=require(_0x4f23('0xf'));var toCsv=require(_0x4f23('0x9'));var querystring=require(_0x4f23('0x10'));var Papa=require(_0x4f23('0x11'));var Redis=require(_0x4f23('0x12'));var authService=require(_0x4f23('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4f23('0x14'));var hardwareService=require(_0x4f23('0x15'));var logger=require(_0x4f23('0x16'))(_0x4f23('0x17'));var utils=require('../../config/utils');var config=require(_0x4f23('0x18'));var db=require(_0x4f23('0x19'))['db'];function respondWithStatusCode(_0x5badd0,_0x4a4c84){_0x4a4c84=_0x4a4c84||0xcc;return function(_0x505a50){if(_0x505a50){return _0x5badd0[_0x4f23('0x1a')](_0x4a4c84);}return _0x5badd0[_0x4f23('0x1b')](_0x4a4c84)[_0x4f23('0x1c')]();};}function respondWithResult(_0x1cea9a,_0x128cd9){_0x128cd9=_0x128cd9||0xc8;return function(_0x128bbf){if(_0x128bbf){return _0x1cea9a[_0x4f23('0x1b')](_0x128cd9)[_0x4f23('0x1d')](_0x128bbf);}};}function respondWithFilteredResult(_0x174f0f,_0x321ceb){return function(_0x5c415b){if(_0x5c415b){var _0x537115=_0x5c415b[_0x4f23('0x1e')],_0x53cb9e=_0x321ceb[_0x4f23('0x1f')],_0x180338=_0x321ceb[_0x4f23('0x1f')]+_0x321ceb['limit'],_0x1937b6;if(_0x180338>=_0x537115){_0x180338=_0x537115;_0x1937b6=0xc8;}else{_0x1937b6=0xce;}_0x174f0f[_0x4f23('0x1b')](_0x1937b6);return _0x174f0f[_0x4f23('0x20')](_0x4f23('0x21'),_0x53cb9e+'-'+_0x180338+'/'+_0x537115)[_0x4f23('0x1d')](_0x5c415b);}return null;};}function patchUpdates(_0x346a73){return function(_0x4d67fd){try{jsonpatch[_0x4f23('0x22')](_0x4d67fd,_0x346a73,!![]);}catch(_0x539fd9){return BPromise[_0x4f23('0x23')](_0x539fd9);}return _0x4d67fd[_0x4f23('0x24')]();};}function saveUpdates(_0xa280d3,_0x306bbe){return function(_0x4ba403){if(_0x4ba403){return _0x4ba403[_0x4f23('0x25')](_0xa280d3)['then'](function(_0x5ece14){return _0x5ece14;});}return null;};}function removeEntity(_0x334c2c,_0x35b21a){return function(_0x2487b1){if(_0x2487b1){return _0x2487b1[_0x4f23('0x26')]()['then'](function(){var _0x4af4da=_0x2487b1[_0x4f23('0x27')]({'plain':!![]});var _0x1db2d4=_0x4f23('0x28');return db['UserProfileResource'][_0x4f23('0x26')]({'where':{'type':_0x1db2d4,'resourceId':_0x4af4da['id']}})['then'](function(){return _0x2487b1;});})[_0x4f23('0x29')](function(){_0x334c2c[_0x4f23('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26a78c,_0x4e8d57){return function(_0x5965e7){if(!_0x5965e7){_0x26a78c[_0x4f23('0x1a')](0x194);}return _0x5965e7;};}function handleError(_0x1356ba,_0x50c83a){_0x50c83a=_0x50c83a||0x1f4;return function(_0x4314ab){logger['error'](_0x4314ab[_0x4f23('0x2a')]);if(_0x4314ab[_0x4f23('0x2b')]){delete _0x4314ab[_0x4f23('0x2b')];}_0x1356ba['status'](_0x50c83a)[_0x4f23('0x2c')](_0x4314ab);};}exports[_0x4f23('0x2d')]=function(_0x10aae8,_0x5dc5cd){var _0x5a561f={},_0x255d4e={},_0x511e03={'count':0x0,'rows':[]};var _0x1809f7=_[_0x4f23('0x2e')](db[_0x4f23('0x2f')][_0x4f23('0x30')],function(_0x47757b){return{'name':_0x47757b['fieldName'],'type':_0x47757b[_0x4f23('0x31')][_0x4f23('0x32')]};});_0x255d4e[_0x4f23('0x33')]=_[_0x4f23('0x2e')](_0x1809f7,_0x4f23('0x2b'));_0x255d4e[_0x4f23('0x34')]=_[_0x4f23('0x35')](_0x10aae8[_0x4f23('0x34')]);_0x255d4e[_0x4f23('0x36')]=_[_0x4f23('0x37')](_0x255d4e[_0x4f23('0x33')],_0x255d4e[_0x4f23('0x34')]);_0x5a561f[_0x4f23('0x38')]=_[_0x4f23('0x37')](_0x255d4e[_0x4f23('0x33')],qs[_0x4f23('0x39')](_0x10aae8[_0x4f23('0x34')][_0x4f23('0x39')]));_0x5a561f['attributes']=_0x5a561f[_0x4f23('0x38')][_0x4f23('0x3a')]?_0x5a561f[_0x4f23('0x38')]:_0x255d4e[_0x4f23('0x33')];if(!_0x10aae8[_0x4f23('0x34')]['hasOwnProperty'](_0x4f23('0x3b'))){_0x5a561f[_0x4f23('0x3c')]=qs[_0x4f23('0x3c')](_0x10aae8[_0x4f23('0x34')]['limit']);_0x5a561f[_0x4f23('0x1f')]=qs[_0x4f23('0x1f')](_0x10aae8['query'][_0x4f23('0x1f')]);}_0x5a561f[_0x4f23('0x3d')]=qs[_0x4f23('0x3e')](_0x10aae8[_0x4f23('0x34')][_0x4f23('0x3e')]);_0x5a561f[_0x4f23('0x3f')]=qs['filters'](_[_0x4f23('0x40')](_0x10aae8[_0x4f23('0x34')],_0x255d4e[_0x4f23('0x36')]),_0x1809f7);if(_0x10aae8[_0x4f23('0x34')]['filter']){_0x5a561f[_0x4f23('0x3f')]=_[_0x4f23('0x41')](_0x5a561f[_0x4f23('0x3f')],{'$or':_['map'](_0x1809f7,function(_0x172f8d){if(_0x172f8d[_0x4f23('0x31')]!=='VIRTUAL'){var _0x59f62e={};_0x59f62e[_0x172f8d[_0x4f23('0x2b')]]={'$like':'%'+_0x10aae8[_0x4f23('0x34')][_0x4f23('0x42')]+'%'};return _0x59f62e;}})});}_0x5a561f=_[_0x4f23('0x41')]({},_0x5a561f,_0x10aae8['options']);var _0x3c6213={'where':_0x5a561f[_0x4f23('0x3f')]};return db[_0x4f23('0x2f')][_0x4f23('0x1e')](_0x3c6213)[_0x4f23('0x29')](function(_0x657e44){_0x511e03[_0x4f23('0x1e')]=_0x657e44;if(_0x10aae8['query'][_0x4f23('0x43')]){_0x5a561f[_0x4f23('0x44')]=[{'all':!![]}];}return db[_0x4f23('0x2f')]['findAll'](_0x5a561f);})[_0x4f23('0x29')](function(_0x152cbe){_0x511e03['rows']=_0x152cbe;return _0x511e03;})['then'](respondWithFilteredResult(_0x5dc5cd,_0x5a561f))[_0x4f23('0x45')](handleError(_0x5dc5cd,null));};exports[_0x4f23('0x46')]=function(_0x3c02fe,_0xc79409){var _0x2fa9bc={'raw':!![],'where':{'id':_0x3c02fe['params']['id']}},_0x10fdba={};_0x10fdba[_0x4f23('0x33')]=_['keys'](db[_0x4f23('0x2f')][_0x4f23('0x30')]);_0x10fdba['query']=_['keys'](_0x3c02fe['query']);_0x10fdba['filters']=_['intersection'](_0x10fdba['model'],_0x10fdba['query']);_0x2fa9bc['attributes']=_['intersection'](_0x10fdba[_0x4f23('0x33')],qs[_0x4f23('0x39')](_0x3c02fe[_0x4f23('0x34')][_0x4f23('0x39')]));_0x2fa9bc[_0x4f23('0x38')]=_0x2fa9bc[_0x4f23('0x38')][_0x4f23('0x3a')]?_0x2fa9bc[_0x4f23('0x38')]:_0x10fdba[_0x4f23('0x33')];if(_0x3c02fe[_0x4f23('0x34')]['includeAll']){_0x2fa9bc[_0x4f23('0x44')]=[{'all':!![]}];}_0x2fa9bc=_['merge']({},_0x2fa9bc,_0x3c02fe['options']);return db[_0x4f23('0x2f')][_0x4f23('0x47')](_0x2fa9bc)[_0x4f23('0x29')](handleEntityNotFound(_0xc79409,null))[_0x4f23('0x29')](respondWithResult(_0xc79409,null))[_0x4f23('0x45')](handleError(_0xc79409,null));};exports[_0x4f23('0x48')]=function(_0xed075e,_0x526d32){return db['AnalyticExtractedReport'][_0x4f23('0x48')](_0xed075e['body'],{})['then'](function(_0x3c2e09){var _0x4e9afe=_0xed075e[_0x4f23('0x49')][_0x4f23('0x27')]({'plain':!![]});if(!_0x4e9afe)throw new Error(_0x4f23('0x4a'));if(_0x4e9afe[_0x4f23('0x4b')]==='user'){var _0x54c362=_0x3c2e09[_0x4f23('0x27')]({'plain':!![]});var _0x1c5f5a='ExtractedReports';return db[_0x4f23('0x4c')][_0x4f23('0x47')]({'where':{'name':_0x1c5f5a,'userProfileId':_0x4e9afe[_0x4f23('0x4d')]},'raw':!![]})[_0x4f23('0x29')](function(_0x55d7bf){if(_0x55d7bf&&_0x55d7bf[_0x4f23('0x4e')]===0x0){return db[_0x4f23('0x4f')][_0x4f23('0x48')]({'name':_0x54c362[_0x4f23('0x2b')],'resourceId':_0x54c362['id'],'type':_0x55d7bf[_0x4f23('0x2b')],'sectionId':_0x55d7bf['id']},{})[_0x4f23('0x29')](function(){return _0x3c2e09;});}else{return _0x3c2e09;}})[_0x4f23('0x45')](function(_0x14f0d1){logger['error'](_0x4f23('0x50'),_0x14f0d1);throw _0x14f0d1;});}return _0x3c2e09;})['then'](respondWithResult(_0x526d32,0xc9))['catch'](handleError(_0x526d32,null));};exports[_0x4f23('0x25')]=function(_0x4361aa,_0x4ff05c){if(_0x4361aa[_0x4f23('0x51')]['id']){delete _0x4361aa['body']['id'];}return db['AnalyticExtractedReport'][_0x4f23('0x47')]({'where':{'id':_0x4361aa[_0x4f23('0x52')]['id']}})[_0x4f23('0x29')](handleEntityNotFound(_0x4ff05c,null))[_0x4f23('0x29')](saveUpdates(_0x4361aa[_0x4f23('0x51')],null))['then'](respondWithResult(_0x4ff05c,null))[_0x4f23('0x45')](handleError(_0x4ff05c,null));};exports['destroy']=function(_0x370ae7,_0x13aeca){return db[_0x4f23('0x2f')][_0x4f23('0x47')]({'where':{'id':_0x370ae7[_0x4f23('0x52')]['id']}})[_0x4f23('0x29')](handleEntityNotFound(_0x13aeca,null))[_0x4f23('0x29')](removeEntity(_0x13aeca,null))[_0x4f23('0x45')](handleError(_0x13aeca,null));};exports[_0x4f23('0x53')]=function(_0x1c432f,_0x481e9b,_0x20f819){return db[_0x4f23('0x2f')][_0x4f23('0x47')]({'where':{'id':_0x1c432f[_0x4f23('0x52')]['id']},'attributes':[_0x4f23('0x2b'),_0x4f23('0x54'),'savename',_0x4f23('0x55')],'raw':!![]})[_0x4f23('0x29')](handleEntityNotFound(_0x481e9b,null))['then'](function(_0xbd32e4){if(_0xbd32e4){if(!fs[_0x4f23('0x56')](path[_0x4f23('0x57')](config[_0x4f23('0x58')],'server/files/reports',_0xbd32e4['savename']))){throw new db[(_0x4f23('0x59'))][(_0x4f23('0x5a'))](_0x4f23('0x5b'));}if(_0x1c432f[_0x4f23('0x34')][_0x4f23('0x5c')]){return _0x481e9b[_0x4f23('0x1a')](0xc8);}return _0x481e9b[_0x4f23('0x53')](path[_0x4f23('0x57')](config[_0x4f23('0x58')],_0x4f23('0x5d'),_0xbd32e4[_0x4f23('0x5e')]),util[_0x4f23('0x5f')](_0x4f23('0x60'),_0xbd32e4[_0x4f23('0x54')]||_0xbd32e4[_0x4f23('0x2b')],_0xbd32e4[_0x4f23('0x55')]['toLowerCase']()));}})[_0x4f23('0x45')](handleError(_0x481e9b,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index e960cbf..d352d51 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 _0xa4d8=['request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment','bluebird'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0xa4d8,0x1e9));var _0x8a4d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa4d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8a4d('0x0'));var util=require(_0x8a4d('0x1'));var logger=require('../../config/logger')(_0x8a4d('0x2'));var moment=require(_0x8a4d('0x3'));var BPromise=require(_0x8a4d('0x4'));var rp=require(_0x8a4d('0x5'));var fs=require('fs');var path=require(_0x8a4d('0x6'));var rimraf=require('rimraf');var config=require(_0x8a4d('0x7'));var attributes=require(_0x8a4d('0x8'));module[_0x8a4d('0x9')]=function(_0x529d93,_0x4e4f07){return _0x529d93[_0x8a4d('0xa')](_0x8a4d('0xb'),attributes,{'tableName':_0x8a4d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93af=['AnalyticExtractedReport','analytics_extracted_reports','api','moment','bluebird','request-promise','path','rimraf','./analyticExtractedReport.attributes','exports','define'];(function(_0x52e5bf,_0x33a43){var _0x779e6=function(_0x3dec4a){while(--_0x3dec4a){_0x52e5bf['push'](_0x52e5bf['shift']());}};_0x779e6(++_0x33a43);}(_0x93af,0x1af));var _0xf93a=function(_0x4f35f4,_0x51a8c3){_0x4f35f4=_0x4f35f4-0x0;var _0x2e9a70=_0x93af[_0x4f35f4];return _0x2e9a70;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf93a('0x0'));var moment=require(_0xf93a('0x1'));var BPromise=require(_0xf93a('0x2'));var rp=require(_0xf93a('0x3'));var fs=require('fs');var path=require(_0xf93a('0x4'));var rimraf=require(_0xf93a('0x5'));var config=require('../../config/environment');var attributes=require(_0xf93a('0x6'));module[_0xf93a('0x7')]=function(_0x4dbe60,_0x252457){return _0x4dbe60[_0xf93a('0x8')](_0xf93a('0x9'),attributes,{'tableName':_0xf93a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 8da0590..b5febb6 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 _0x3f88=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch'];(function(_0x32c450,_0x5c9631){var _0x1c9dfa=function(_0x498f57){while(--_0x498f57){_0x32c450['push'](_0x32c450['shift']());}};_0x1c9dfa(++_0x5c9631);}(_0x3f88,0x98));var _0x83f8=function(_0x10d1b5,_0x14010b){_0x10d1b5=_0x10d1b5-0x0;var _0x80ad03=_0x3f88[_0x10d1b5];return _0x80ad03;};'use strict';var _=require('lodash');var util=require(_0x83f8('0x0'));var moment=require(_0x83f8('0x1'));var BPromise=require(_0x83f8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83f8('0x3'));var db=require(_0x83f8('0x4'))['db'];var utils=require(_0x83f8('0x5'));var logger=require(_0x83f8('0x6'))(_0x83f8('0x7'));var config=require('../../config/environment');var jayson=require(_0x83f8('0x8'));var client=jayson[_0x83f8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ca4bb,_0x4dd17e,_0x496eca){return new BPromise(function(_0x34aeeb,_0x276359){return client[_0x83f8('0xa')](_0x2ca4bb,_0x496eca)[_0x83f8('0xb')](function(_0x188a1e){logger[_0x83f8('0xc')](_0x83f8('0xd'),_0x4dd17e,_0x83f8('0xe'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x4dd17e,_0x83f8('0xe'),JSON[_0x83f8('0xf')](_0x188a1e));if(_0x188a1e[_0x83f8('0x10')]){if(_0x188a1e[_0x83f8('0x10')]['code']===0x1f4){logger[_0x83f8('0x10')](_0x83f8('0xd'),_0x4dd17e,_0x188a1e[_0x83f8('0x10')]['message']);return _0x276359(_0x188a1e[_0x83f8('0x10')][_0x83f8('0x11')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x4dd17e,_0x188a1e[_0x83f8('0x10')][_0x83f8('0x11')]);return _0x34aeeb(_0x188a1e['error']['message']);}else{logger[_0x83f8('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4dd17e,_0x83f8('0xe'));_0x34aeeb(_0x188a1e['result']['message']);}})[_0x83f8('0x12')](function(_0x10d203){logger[_0x83f8('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4dd17e,_0x10d203);_0x276359(_0x10d203);});});} \ No newline at end of file +var _0xce2c=['request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x56f873,_0x3f5e6e){var _0x2a7cda=function(_0xf7fc12){while(--_0xf7fc12){_0x56f873['push'](_0x56f873['shift']());}};_0x2a7cda(++_0x3f5e6e);}(_0xce2c,0x171));var _0xcce2=function(_0x385559,_0x7d5353){_0x385559=_0x385559-0x0;var _0x6e5312=_0xce2c[_0x385559];return _0x6e5312;};'use strict';var _=require(_0xcce2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcce2('0x1'))(_0xcce2('0x2'));var config=require('../../config/environment');var jayson=require(_0xcce2('0x3'));var client=jayson[_0xcce2('0x4')][_0xcce2('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x10e83c,_0x14894c,_0x467693){return new BPromise(function(_0x5c0ec9,_0x227651){return client[_0xcce2('0x6')](_0x10e83c,_0x467693)[_0xcce2('0x7')](function(_0x153328){logger['info'](_0xcce2('0x8'),_0x14894c,_0xcce2('0x9'));logger[_0xcce2('0xa')](_0xcce2('0xb'),_0x14894c,_0xcce2('0x9'),JSON['stringify'](_0x153328));if(_0x153328[_0xcce2('0xc')]){if(_0x153328[_0xcce2('0xc')][_0xcce2('0xd')]===0x1f4){logger[_0xcce2('0xc')](_0xcce2('0x8'),_0x14894c,_0x153328[_0xcce2('0xc')][_0xcce2('0xe')]);return _0x227651(_0x153328[_0xcce2('0xc')][_0xcce2('0xe')]);}logger[_0xcce2('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x14894c,_0x153328[_0xcce2('0xc')][_0xcce2('0xe')]);return _0x5c0ec9(_0x153328[_0xcce2('0xc')][_0xcce2('0xe')]);}else{logger[_0xcce2('0xf')](_0xcce2('0x8'),_0x14894c,_0xcce2('0x9'));_0x5c0ec9(_0x153328[_0xcce2('0x10')]['message']);}})[_0xcce2('0x11')](function(_0x9291cb){logger[_0xcce2('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x14894c,_0x9291cb);_0x227651(_0x9291cb);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 0859c65..4039e9a 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 _0x2f3a=['show','/:id/download','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x3e1f4e,_0x3d48f8){var _0x14ea69=function(_0x49c9e0){while(--_0x49c9e0){_0x3e1f4e['push'](_0x3e1f4e['shift']());}};_0x14ea69(++_0x3d48f8);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x252933,_0x43a776){_0x252933=_0x252933-0x0;var _0x41a521=_0x2f3a[_0x252933];return _0x41a521;};'use strict';var multer=require(_0xa2f3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa2f3('0x1'));var express=require(_0xa2f3('0x2'));var router=express[_0xa2f3('0x3')]();var auth=require(_0xa2f3('0x4'));var interaction=require(_0xa2f3('0x5'));var config=require(_0xa2f3('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0xa2f3('0x7')]('/',auth['isAuthenticated'](),controller[_0xa2f3('0x8')]);router[_0xa2f3('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xa2f3('0x9')]);router[_0xa2f3('0x7')](_0xa2f3('0xa'),auth[_0xa2f3('0xb')](),controller['download']);router[_0xa2f3('0xc')]('/',auth[_0xa2f3('0xb')](),controller[_0xa2f3('0xd')]);router[_0xa2f3('0xe')](_0xa2f3('0xf'),auth['isAuthenticated'](),controller[_0xa2f3('0x10')]);router[_0xa2f3('0x11')]('/:id',auth[_0xa2f3('0xb')](),controller[_0xa2f3('0x12')]);module[_0xa2f3('0x13')]=router; \ No newline at end of file +var _0x11a9=['download','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x190c49,_0x17a01a){var _0x1831c3=function(_0x28af0e){while(--_0x28af0e){_0x190c49['push'](_0x190c49['shift']());}};_0x1831c3(++_0x17a01a);}(_0x11a9,0x11b));var _0x911a=function(_0xceec30,_0x43c4e5){_0xceec30=_0xceec30-0x0;var _0x259b0c=_0x11a9[_0xceec30];return _0x259b0c;};'use strict';var multer=require(_0x911a('0x0'));var util=require(_0x911a('0x1'));var path=require(_0x911a('0x2'));var timeout=require(_0x911a('0x3'));var express=require(_0x911a('0x4'));var router=express[_0x911a('0x5')]();var auth=require(_0x911a('0x6'));var interaction=require(_0x911a('0x7'));var config=require(_0x911a('0x8'));var controller=require(_0x911a('0x9'));router[_0x911a('0xa')]('/',auth[_0x911a('0xb')](),controller[_0x911a('0xc')]);router['get'](_0x911a('0xd'),auth['isAuthenticated'](),controller[_0x911a('0xe')]);router[_0x911a('0xa')](_0x911a('0xf'),auth[_0x911a('0xb')](),controller[_0x911a('0x10')]);router[_0x911a('0x11')]('/',auth[_0x911a('0xb')](),controller[_0x911a('0x12')]);router[_0x911a('0x13')](_0x911a('0xd'),auth['isAuthenticated'](),controller[_0x911a('0x14')]);router[_0x911a('0x15')](_0x911a('0xd'),auth[_0x911a('0xb')](),controller['destroy']);module[_0x911a('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 977bdf3..67b5e17 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x101ed5,_0x4f5c30){var _0x5ae524=function(_0x568fd2){while(--_0x568fd2){_0x101ed5['push'](_0x101ed5['shift']());}};_0x5ae524(++_0x4f5c30);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc4aa[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x2113cd,_0xb2845b){var _0x554747=function(_0x2b3c6a){while(--_0x2b3c6a){_0x2113cd['push'](_0x2113cd['shift']());}};_0x554747(++_0xb2845b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 92fa803..86fd457 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 _0xd6ce=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../mysqldb','status','end','json','offset','limit','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','AnalyticFieldReport','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','bulkCreate','update','params','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','crypto'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0xd6ce,0x127));var _0xed6c=function(_0x7ef7db,_0x392508){_0x7ef7db=_0x7ef7db-0x0;var _0x465a01=_0xd6ce[_0x7ef7db];return _0x465a01;};'use strict';var pdf=require(_0xed6c('0x0'));var emlformat=require(_0xed6c('0x1'));var rimraf=require(_0xed6c('0x2'));var zipdir=require(_0xed6c('0x3'));var jsonpatch=require(_0xed6c('0x4'));var rp=require(_0xed6c('0x5'));var moment=require(_0xed6c('0x6'));var BPromise=require(_0xed6c('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xed6c('0x8'));var sox=require(_0xed6c('0x9'));var csv=require(_0xed6c('0xa'));var ejs=require(_0xed6c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xed6c('0xc'));var jsforce=require(_0xed6c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed6c('0xe'));var Papa=require(_0xed6c('0xf'));var Redis=require(_0xed6c('0x10'));var authService=require(_0xed6c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xed6c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xed6c('0x13'))['db'];function respondWithStatusCode(_0x125c5f,_0x4efd40){_0x4efd40=_0x4efd40||0xcc;return function(_0x17e109){if(_0x17e109){return _0x125c5f['sendStatus'](_0x4efd40);}return _0x125c5f[_0xed6c('0x14')](_0x4efd40)[_0xed6c('0x15')]();};}function respondWithResult(_0x47c392,_0x3f3126){_0x3f3126=_0x3f3126||0xc8;return function(_0x32a8c9){if(_0x32a8c9){return _0x47c392[_0xed6c('0x14')](_0x3f3126)[_0xed6c('0x16')](_0x32a8c9);}};}function respondWithFilteredResult(_0x4b0ad3,_0x57ec05){return function(_0x2034d4){if(_0x2034d4){var _0x3d99b8=_0x2034d4['count'],_0x156e84=_0x57ec05[_0xed6c('0x17')],_0x4fbdb5=_0x57ec05[_0xed6c('0x17')]+_0x57ec05[_0xed6c('0x18')],_0x13c503;if(_0x4fbdb5>=_0x3d99b8){_0x4fbdb5=_0x3d99b8;_0x13c503=0xc8;}else{_0x13c503=0xce;}_0x4b0ad3[_0xed6c('0x14')](_0x13c503);return _0x4b0ad3['set'](_0xed6c('0x19'),_0x156e84+'-'+_0x4fbdb5+'/'+_0x3d99b8)[_0xed6c('0x16')](_0x2034d4);}return null;};}function patchUpdates(_0x277ee7){return function(_0x5bc042){try{jsonpatch[_0xed6c('0x1a')](_0x5bc042,_0x277ee7,!![]);}catch(_0x2d34d5){return BPromise[_0xed6c('0x1b')](_0x2d34d5);}return _0x5bc042[_0xed6c('0x1c')]();};}function saveUpdates(_0x314aeb,_0x5e86ad){return function(_0x85aedf){if(_0x85aedf){return _0x85aedf['update'](_0x314aeb)[_0xed6c('0x1d')](function(_0x37a9ce){return _0x37a9ce;});}return null;};}function removeEntity(_0x30e605,_0x34faac){return function(_0x49a583){if(_0x49a583){return _0x49a583[_0xed6c('0x1e')]()['then'](function(){_0x30e605[_0xed6c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7882e0,_0x21e0ba){return function(_0x51876b){if(!_0x51876b){_0x7882e0[_0xed6c('0x1f')](0x194);}return _0x51876b;};}function handleError(_0x391970,_0x1c3aca){_0x1c3aca=_0x1c3aca||0x1f4;return function(_0x638bc2){logger[_0xed6c('0x20')](_0x638bc2[_0xed6c('0x21')]);if(_0x638bc2[_0xed6c('0x22')]){delete _0x638bc2[_0xed6c('0x22')];}_0x391970['status'](_0x1c3aca)[_0xed6c('0x23')](_0x638bc2);};}exports[_0xed6c('0x24')]=function(_0x225ec6,_0x21d91e){var _0x953c0d={},_0x3574a3={},_0x47bdc5={'count':0x0,'rows':[]};var _0x23ee72=_[_0xed6c('0x25')](db[_0xed6c('0x26')]['rawAttributes'],function(_0x4e4373){return{'name':_0x4e4373['fieldName'],'type':_0x4e4373['type'][_0xed6c('0x27')]};});_0x3574a3['model']=_[_0xed6c('0x25')](_0x23ee72,'name');_0x3574a3[_0xed6c('0x28')]=_[_0xed6c('0x29')](_0x225ec6['query']);_0x3574a3[_0xed6c('0x2a')]=_[_0xed6c('0x2b')](_0x3574a3[_0xed6c('0x2c')],_0x3574a3[_0xed6c('0x28')]);_0x953c0d[_0xed6c('0x2d')]=_[_0xed6c('0x2b')](_0x3574a3['model'],qs[_0xed6c('0x2e')](_0x225ec6[_0xed6c('0x28')]['fields']));_0x953c0d[_0xed6c('0x2d')]=_0x953c0d['attributes'][_0xed6c('0x2f')]?_0x953c0d[_0xed6c('0x2d')]:_0x3574a3[_0xed6c('0x2c')];if(!_0x225ec6[_0xed6c('0x28')][_0xed6c('0x30')](_0xed6c('0x31'))){_0x953c0d['limit']=qs['limit'](_0x225ec6['query'][_0xed6c('0x18')]);_0x953c0d[_0xed6c('0x17')]=qs[_0xed6c('0x17')](_0x225ec6['query'][_0xed6c('0x17')]);}_0x953c0d[_0xed6c('0x32')]=qs[_0xed6c('0x33')](_0x225ec6[_0xed6c('0x28')][_0xed6c('0x33')]);_0x953c0d[_0xed6c('0x34')]=qs[_0xed6c('0x2a')](_[_0xed6c('0x35')](_0x225ec6[_0xed6c('0x28')],_0x3574a3[_0xed6c('0x2a')]),_0x23ee72);if(_0x225ec6[_0xed6c('0x28')][_0xed6c('0x36')]){_0x953c0d['where']=_[_0xed6c('0x37')](_0x953c0d[_0xed6c('0x34')],{'$or':_[_0xed6c('0x25')](_0x23ee72,function(_0x246589){if(_0x246589['type']!==_0xed6c('0x38')){var _0xb12a25={};_0xb12a25[_0x246589[_0xed6c('0x22')]]={'$like':'%'+_0x225ec6['query'][_0xed6c('0x36')]+'%'};return _0xb12a25;}})});}_0x953c0d=_['merge']({},_0x953c0d,_0x225ec6[_0xed6c('0x39')]);var _0x3aaf5a={'where':_0x953c0d[_0xed6c('0x34')]};return db['AnalyticFieldReport'][_0xed6c('0x3a')](_0x3aaf5a)[_0xed6c('0x1d')](function(_0x48708d){_0x47bdc5[_0xed6c('0x3a')]=_0x48708d;if(_0x225ec6[_0xed6c('0x28')][_0xed6c('0x3b')]){_0x953c0d[_0xed6c('0x3c')]=[{'all':!![]}];}return db[_0xed6c('0x26')][_0xed6c('0x3d')](_0x953c0d);})[_0xed6c('0x1d')](function(_0x212acc){_0x47bdc5[_0xed6c('0x3e')]=_0x212acc;return _0x47bdc5;})[_0xed6c('0x1d')](respondWithFilteredResult(_0x21d91e,_0x953c0d))[_0xed6c('0x3f')](handleError(_0x21d91e,null));};exports[_0xed6c('0x40')]=function(_0x41409d,_0x5c170e){var _0x10d810={'raw':![],'where':{'id':_0x41409d['params']['id']}},_0x468f50={};_0x468f50[_0xed6c('0x2c')]=_[_0xed6c('0x29')](db['AnalyticFieldReport']['rawAttributes']);_0x468f50[_0xed6c('0x28')]=_[_0xed6c('0x29')](_0x41409d['query']);_0x468f50[_0xed6c('0x2a')]=_[_0xed6c('0x2b')](_0x468f50['model'],_0x468f50['query']);_0x10d810[_0xed6c('0x2d')]=_[_0xed6c('0x2b')](_0x468f50[_0xed6c('0x2c')],qs[_0xed6c('0x2e')](_0x41409d['query'][_0xed6c('0x2e')]));_0x10d810[_0xed6c('0x2d')]=_0x10d810[_0xed6c('0x2d')][_0xed6c('0x2f')]?_0x10d810[_0xed6c('0x2d')]:_0x468f50[_0xed6c('0x2c')];if(_0x41409d[_0xed6c('0x28')][_0xed6c('0x3b')]){_0x10d810[_0xed6c('0x3c')]=[{'all':!![]}];}_0x10d810=_['merge']({},_0x10d810,_0x41409d[_0xed6c('0x39')]);return db['AnalyticFieldReport'][_0xed6c('0x41')](_0x10d810)[_0xed6c('0x1d')](handleEntityNotFound(_0x5c170e,null))[_0xed6c('0x1d')](respondWithResult(_0x5c170e,null))[_0xed6c('0x3f')](handleError(_0x5c170e,null));};exports['create']=function(_0x15a844,_0x47e113){return db[_0xed6c('0x26')][_0xed6c('0x42')](_0x15a844[_0xed6c('0x43')],{})[_0xed6c('0x1d')](respondWithResult(_0x47e113,0xc9))['catch'](handleError(_0x47e113,null));};exports[_0xed6c('0x44')]=function(_0x369481,_0xb54734){return db[_0xed6c('0x26')][_0xed6c('0x44')](_0x369481[_0xed6c('0x43')],{'raw':![],'individualHooks':!![]})[_0xed6c('0x1d')](respondWithResult(_0xb54734,0xc9))[_0xed6c('0x3f')](handleError(_0xb54734,null));};exports[_0xed6c('0x45')]=function(_0x124616,_0x77ca87){if(_0x124616[_0xed6c('0x43')]['id']){delete _0x124616[_0xed6c('0x43')]['id'];}return db[_0xed6c('0x26')][_0xed6c('0x41')]({'where':{'id':_0x124616[_0xed6c('0x46')]['id']}})[_0xed6c('0x1d')](handleEntityNotFound(_0x77ca87,null))['then'](saveUpdates(_0x124616[_0xed6c('0x43')],null))[_0xed6c('0x1d')](respondWithResult(_0x77ca87,null))[_0xed6c('0x3f')](handleError(_0x77ca87,null));};exports[_0xed6c('0x1e')]=function(_0x2301fd,_0x200a7a){return db[_0xed6c('0x26')][_0xed6c('0x41')]({'where':{'id':_0x2301fd['params']['id']}})[_0xed6c('0x1d')](handleEntityNotFound(_0x200a7a,null))[_0xed6c('0x1d')](removeEntity(_0x200a7a,null))[_0xed6c('0x3f')](handleError(_0x200a7a,null));};exports[_0xed6c('0x47')]=function(_0x2438aa,_0xaacd00){return db['AnalyticFieldReport'][_0xed6c('0x1e')]({'where':{'id':_0x2438aa[_0xed6c('0x28')][_0xed6c('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0xed6c('0x1d')](respondWithResult(_0xaacd00,0xcc))['catch'](handleError(_0xaacd00,null));};exports[_0xed6c('0x49')]=function(_0x39e366,_0x2d6f1b,_0x40b9bf){return db[_0xed6c('0x4a')]['findOne']({'where':{'id':_0x39e366[_0xed6c('0x46')]['id']}})[_0xed6c('0x1d')](handleEntityNotFound(_0x2d6f1b,null))['then'](function(_0x33fbeb){if(_0x33fbeb){return db[_0xed6c('0x4b')]['transaction'](function(_0x26513b){return db[_0xed6c('0x26')][_0xed6c('0x1e')]({'where':{'CustomReportId':_0x39e366[_0xed6c('0x46')]['id']},'transaction':_0x26513b})['then'](function(_0x39d335){var _0x4e8fd8=_[_0xed6c('0x25')](_0x39e366[_0xed6c('0x43')],function(_0x301dc9){delete _0x301dc9['id'];_0x301dc9[_0xed6c('0x4c')]=_0x39e366[_0xed6c('0x46')]['id'];return _0x301dc9;});return db[_0xed6c('0x26')][_0xed6c('0x44')](_0x4e8fd8,{'transaction':_0x26513b});});})[_0xed6c('0x1d')](function(){return db['AnalyticFieldReport'][_0xed6c('0x3d')]({'where':{'CustomReportId':_0x39e366[_0xed6c('0x46')]['id']}});});}})[_0xed6c('0x1d')](respondWithResult(_0x2d6f1b,null))[_0xed6c('0x3f')](handleError(_0x2d6f1b,null));}; \ No newline at end of file +var _0x325e=['attributes','length','hasOwnProperty','limit','order','sort','where','pick','filters','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','find','create','bulkCreate','body','update','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','json','apply','reject','save','then','destroy','error','stack','name','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','intersection'];(function(_0x48f703,_0x14e365){var _0x6d6e46=function(_0x10e372){while(--_0x10e372){_0x48f703['push'](_0x48f703['shift']());}};_0x6d6e46(++_0x14e365);}(_0x325e,0xc1));var _0xe325=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x325e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe325('0x0'));var emlformat=require(_0xe325('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe325('0x2'));var jsonpatch=require(_0xe325('0x3'));var rp=require('request-promise');var moment=require(_0xe325('0x4'));var BPromise=require(_0xe325('0x5'));var Mustache=require(_0xe325('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe325('0x7'));var ejs=require(_0xe325('0x8'));var fs=require('fs');var _=require(_0xe325('0x9'));var squel=require(_0xe325('0xa'));var crypto=require(_0xe325('0xb'));var jsforce=require(_0xe325('0xc'));var deskjs=require(_0xe325('0xd'));var toCsv=require(_0xe325('0x7'));var querystring=require('querystring');var Papa=require(_0xe325('0xe'));var Redis=require(_0xe325('0xf'));var authService=require(_0xe325('0x10'));var qs=require(_0xe325('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe325('0x12'));var logger=require(_0xe325('0x13'))(_0xe325('0x14'));var utils=require(_0xe325('0x15'));var config=require(_0xe325('0x16'));var db=require(_0xe325('0x17'))['db'];function respondWithStatusCode(_0x1ec4bf,_0x433d11){_0x433d11=_0x433d11||0xcc;return function(_0x3d151a){if(_0x3d151a){return _0x1ec4bf[_0xe325('0x18')](_0x433d11);}return _0x1ec4bf[_0xe325('0x19')](_0x433d11)[_0xe325('0x1a')]();};}function respondWithResult(_0x210a5c,_0x26df6d){_0x26df6d=_0x26df6d||0xc8;return function(_0x2beec7){if(_0x2beec7){return _0x210a5c[_0xe325('0x19')](_0x26df6d)['json'](_0x2beec7);}};}function respondWithFilteredResult(_0x14eae7,_0x544c57){return function(_0x435861){if(_0x435861){var _0xb99c4a=_0x435861['count'],_0x565005=_0x544c57['offset'],_0x41dd20=_0x544c57[_0xe325('0x1b')]+_0x544c57['limit'],_0x157cbb;if(_0x41dd20>=_0xb99c4a){_0x41dd20=_0xb99c4a;_0x157cbb=0xc8;}else{_0x157cbb=0xce;}_0x14eae7[_0xe325('0x19')](_0x157cbb);return _0x14eae7[_0xe325('0x1c')]('Content-Range',_0x565005+'-'+_0x41dd20+'/'+_0xb99c4a)[_0xe325('0x1d')](_0x435861);}return null;};}function patchUpdates(_0x59ca9b){return function(_0x12b89f){try{jsonpatch[_0xe325('0x1e')](_0x12b89f,_0x59ca9b,!![]);}catch(_0x99becb){return BPromise[_0xe325('0x1f')](_0x99becb);}return _0x12b89f[_0xe325('0x20')]();};}function saveUpdates(_0x1da2d6,_0x5d43ed){return function(_0x5ed827){if(_0x5ed827){return _0x5ed827['update'](_0x1da2d6)[_0xe325('0x21')](function(_0x18dffc){return _0x18dffc;});}return null;};}function removeEntity(_0x2cf396,_0x301204){return function(_0x38e3b4){if(_0x38e3b4){return _0x38e3b4[_0xe325('0x22')]()[_0xe325('0x21')](function(){_0x2cf396[_0xe325('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x491aed,_0x298405){return function(_0x2641c8){if(!_0x2641c8){_0x491aed[_0xe325('0x18')](0x194);}return _0x2641c8;};}function handleError(_0x391450,_0x3c68f9){_0x3c68f9=_0x3c68f9||0x1f4;return function(_0x4d4264){logger[_0xe325('0x23')](_0x4d4264[_0xe325('0x24')]);if(_0x4d4264[_0xe325('0x25')]){delete _0x4d4264[_0xe325('0x25')];}_0x391450[_0xe325('0x19')](_0x3c68f9)['send'](_0x4d4264);};}exports['index']=function(_0x3d0696,_0x249ce6){var _0x1b7b26={},_0x5aec1d={},_0x2cd305={'count':0x0,'rows':[]};var _0x49ae13=_[_0xe325('0x26')](db[_0xe325('0x27')]['rawAttributes'],function(_0x5db379){return{'name':_0x5db379[_0xe325('0x28')],'type':_0x5db379[_0xe325('0x29')][_0xe325('0x2a')]};});_0x5aec1d[_0xe325('0x2b')]=_[_0xe325('0x26')](_0x49ae13,_0xe325('0x25'));_0x5aec1d[_0xe325('0x2c')]=_[_0xe325('0x2d')](_0x3d0696[_0xe325('0x2c')]);_0x5aec1d['filters']=_[_0xe325('0x2e')](_0x5aec1d[_0xe325('0x2b')],_0x5aec1d[_0xe325('0x2c')]);_0x1b7b26[_0xe325('0x2f')]=_['intersection'](_0x5aec1d[_0xe325('0x2b')],qs['fields'](_0x3d0696[_0xe325('0x2c')]['fields']));_0x1b7b26['attributes']=_0x1b7b26[_0xe325('0x2f')][_0xe325('0x30')]?_0x1b7b26[_0xe325('0x2f')]:_0x5aec1d[_0xe325('0x2b')];if(!_0x3d0696[_0xe325('0x2c')][_0xe325('0x31')]('nolimit')){_0x1b7b26[_0xe325('0x32')]=qs['limit'](_0x3d0696[_0xe325('0x2c')][_0xe325('0x32')]);_0x1b7b26[_0xe325('0x1b')]=qs[_0xe325('0x1b')](_0x3d0696['query'][_0xe325('0x1b')]);}_0x1b7b26[_0xe325('0x33')]=qs[_0xe325('0x34')](_0x3d0696[_0xe325('0x2c')][_0xe325('0x34')]);_0x1b7b26[_0xe325('0x35')]=qs['filters'](_[_0xe325('0x36')](_0x3d0696[_0xe325('0x2c')],_0x5aec1d[_0xe325('0x37')]),_0x49ae13);if(_0x3d0696[_0xe325('0x2c')]['filter']){_0x1b7b26[_0xe325('0x35')]=_[_0xe325('0x38')](_0x1b7b26['where'],{'$or':_[_0xe325('0x26')](_0x49ae13,function(_0x1532af){if(_0x1532af[_0xe325('0x29')]!==_0xe325('0x39')){var _0x47a376={};_0x47a376[_0x1532af['name']]={'$like':'%'+_0x3d0696[_0xe325('0x2c')]['filter']+'%'};return _0x47a376;}})});}_0x1b7b26=_[_0xe325('0x38')]({},_0x1b7b26,_0x3d0696[_0xe325('0x3a')]);var _0x133cc9={'where':_0x1b7b26[_0xe325('0x35')]};return db[_0xe325('0x27')][_0xe325('0x3b')](_0x133cc9)[_0xe325('0x21')](function(_0x378ee5){_0x2cd305[_0xe325('0x3b')]=_0x378ee5;if(_0x3d0696['query']['includeAll']){_0x1b7b26[_0xe325('0x3c')]=[{'all':!![]}];}return db[_0xe325('0x27')][_0xe325('0x3d')](_0x1b7b26);})['then'](function(_0x566f67){_0x2cd305[_0xe325('0x3e')]=_0x566f67;return _0x2cd305;})[_0xe325('0x21')](respondWithFilteredResult(_0x249ce6,_0x1b7b26))[_0xe325('0x3f')](handleError(_0x249ce6,null));};exports[_0xe325('0x40')]=function(_0xc62ec0,_0x59f947){var _0xae14d8={'raw':![],'where':{'id':_0xc62ec0[_0xe325('0x41')]['id']}},_0x48b078={};_0x48b078['model']=_[_0xe325('0x2d')](db[_0xe325('0x27')][_0xe325('0x42')]);_0x48b078[_0xe325('0x2c')]=_[_0xe325('0x2d')](_0xc62ec0[_0xe325('0x2c')]);_0x48b078[_0xe325('0x37')]=_[_0xe325('0x2e')](_0x48b078[_0xe325('0x2b')],_0x48b078[_0xe325('0x2c')]);_0xae14d8[_0xe325('0x2f')]=_[_0xe325('0x2e')](_0x48b078[_0xe325('0x2b')],qs[_0xe325('0x43')](_0xc62ec0['query'][_0xe325('0x43')]));_0xae14d8['attributes']=_0xae14d8[_0xe325('0x2f')][_0xe325('0x30')]?_0xae14d8[_0xe325('0x2f')]:_0x48b078['model'];if(_0xc62ec0[_0xe325('0x2c')][_0xe325('0x44')]){_0xae14d8[_0xe325('0x3c')]=[{'all':!![]}];}_0xae14d8=_[_0xe325('0x38')]({},_0xae14d8,_0xc62ec0[_0xe325('0x3a')]);return db[_0xe325('0x27')][_0xe325('0x45')](_0xae14d8)[_0xe325('0x21')](handleEntityNotFound(_0x59f947,null))[_0xe325('0x21')](respondWithResult(_0x59f947,null))[_0xe325('0x3f')](handleError(_0x59f947,null));};exports[_0xe325('0x46')]=function(_0x365e59,_0x265a6c){return db[_0xe325('0x27')]['create'](_0x365e59['body'],{})[_0xe325('0x21')](respondWithResult(_0x265a6c,0xc9))[_0xe325('0x3f')](handleError(_0x265a6c,null));};exports[_0xe325('0x47')]=function(_0xeb2235,_0x3c6ead){return db[_0xe325('0x27')][_0xe325('0x47')](_0xeb2235[_0xe325('0x48')],{'raw':![],'individualHooks':!![]})[_0xe325('0x21')](respondWithResult(_0x3c6ead,0xc9))[_0xe325('0x3f')](handleError(_0x3c6ead,null));};exports[_0xe325('0x49')]=function(_0x464ca5,_0x37299b){if(_0x464ca5[_0xe325('0x48')]['id']){delete _0x464ca5[_0xe325('0x48')]['id'];}return db[_0xe325('0x27')][_0xe325('0x45')]({'where':{'id':_0x464ca5['params']['id']}})['then'](handleEntityNotFound(_0x37299b,null))[_0xe325('0x21')](saveUpdates(_0x464ca5[_0xe325('0x48')],null))[_0xe325('0x21')](respondWithResult(_0x37299b,null))[_0xe325('0x3f')](handleError(_0x37299b,null));};exports[_0xe325('0x22')]=function(_0x5eeb9c,_0x27d10e){return db[_0xe325('0x27')]['find']({'where':{'id':_0x5eeb9c[_0xe325('0x41')]['id']}})[_0xe325('0x21')](handleEntityNotFound(_0x27d10e,null))[_0xe325('0x21')](removeEntity(_0x27d10e,null))[_0xe325('0x3f')](handleError(_0x27d10e,null));};exports['bulkDestroy']=function(_0x31c9af,_0x41f249){return db[_0xe325('0x27')]['destroy']({'where':{'id':_0x31c9af[_0xe325('0x2c')][_0xe325('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xe325('0x21')](respondWithResult(_0x41f249,0xcc))['catch'](handleError(_0x41f249,null));};exports[_0xe325('0x4b')]=function(_0x2d1403,_0x12ac80,_0x2a611b){return db[_0xe325('0x4c')]['findOne']({'where':{'id':_0x2d1403[_0xe325('0x41')]['id']}})[_0xe325('0x21')](handleEntityNotFound(_0x12ac80,null))[_0xe325('0x21')](function(_0x4ffebb){if(_0x4ffebb){return db[_0xe325('0x4d')][_0xe325('0x4e')](function(_0x508c74){return db[_0xe325('0x27')]['destroy']({'where':{'CustomReportId':_0x2d1403[_0xe325('0x41')]['id']},'transaction':_0x508c74})[_0xe325('0x21')](function(_0x352a39){var _0x1db9db=_[_0xe325('0x26')](_0x2d1403['body'],function(_0x284228){delete _0x284228['id'];_0x284228[_0xe325('0x4f')]=_0x2d1403[_0xe325('0x41')]['id'];return _0x284228;});return db[_0xe325('0x27')]['bulkCreate'](_0x1db9db,{'transaction':_0x508c74});});})[_0xe325('0x21')](function(){return db[_0xe325('0x27')][_0xe325('0x3d')]({'where':{'CustomReportId':_0x2d1403[_0xe325('0x41')]['id']}});});}})['then'](respondWithResult(_0x12ac80,null))['catch'](handleError(_0x12ac80,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 687a022..5e409e5 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 _0x8739=['rimraf','../../config/environment','exports','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4f95f8,_0xb73784){var _0x123b8e=function(_0x89ad8f){while(--_0x89ad8f){_0x4f95f8['push'](_0x4f95f8['shift']());}};_0x123b8e(++_0xb73784);}(_0x8739,0xfd));var _0x9873=function(_0x2eee52,_0x115662){_0x2eee52=_0x2eee52-0x0;var _0x11a18b=_0x8739[_0x2eee52];return _0x11a18b;};'use strict';var _=require(_0x9873('0x0'));var util=require(_0x9873('0x1'));var logger=require(_0x9873('0x2'))(_0x9873('0x3'));var moment=require(_0x9873('0x4'));var BPromise=require('bluebird');var rp=require(_0x9873('0x5'));var fs=require('fs');var path=require(_0x9873('0x6'));var rimraf=require(_0x9873('0x7'));var config=require(_0x9873('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0x9873('0x9')]=function(_0x59d503,_0x4cab1d){return _0x59d503['define']('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcde7=['./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x30208b,_0x3ba154){var _0x3e42e5=function(_0x520c9b){while(--_0x520c9b){_0x30208b['push'](_0x30208b['shift']());}};_0x3e42e5(++_0x3ba154);}(_0xcde7,0x1a9));var _0x7cde=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xcde7[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x7cde('0x0'));var util=require(_0x7cde('0x1'));var logger=require(_0x7cde('0x2'))(_0x7cde('0x3'));var moment=require(_0x7cde('0x4'));var BPromise=require(_0x7cde('0x5'));var rp=require(_0x7cde('0x6'));var fs=require('fs');var path=require(_0x7cde('0x7'));var rimraf=require(_0x7cde('0x8'));var config=require(_0x7cde('0x9'));var attributes=require(_0x7cde('0xa'));module[_0x7cde('0xb')]=function(_0x1075c2,_0x1cfd7e){return _0x1075c2[_0x7cde('0xc')](_0x7cde('0xd'),attributes,{'tableName':_0x7cde('0xe'),'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 8a5376e..ed1e114 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 _0x6379=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x55c4c5,_0x2f19c3){var _0x2a3d07=function(_0x332212){while(--_0x332212){_0x55c4c5['push'](_0x55c4c5['shift']());}};_0x2a3d07(++_0x2f19c3);}(_0x6379,0x1dc));var _0x9637=function(_0x1ffe75,_0x59931f){_0x1ffe75=_0x1ffe75-0x0;var _0x56bcdc=_0x6379[_0x1ffe75];return _0x56bcdc;};'use strict';var _=require(_0x9637('0x0'));var util=require(_0x9637('0x1'));var moment=require(_0x9637('0x2'));var BPromise=require(_0x9637('0x3'));var rs=require(_0x9637('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9637('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9637('0x6'))(_0x9637('0x7'));var config=require(_0x9637('0x8'));var jayson=require(_0x9637('0x9'));var client=jayson[_0x9637('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b91e3,_0x32c145,_0xcab46){return new BPromise(function(_0x20addb,_0x19798d){return client[_0x9637('0xb')](_0x5b91e3,_0xcab46)['then'](function(_0x3df19e){logger[_0x9637('0xc')](_0x9637('0xd'),_0x32c145,_0x9637('0xe'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x32c145,'request\x20sent',JSON['stringify'](_0x3df19e));if(_0x3df19e['error']){if(_0x3df19e[_0x9637('0xf')][_0x9637('0x10')]===0x1f4){logger[_0x9637('0xf')](_0x9637('0xd'),_0x32c145,_0x3df19e[_0x9637('0xf')][_0x9637('0x11')]);return _0x19798d(_0x3df19e['error'][_0x9637('0x11')]);}logger[_0x9637('0xf')](_0x9637('0xd'),_0x32c145,_0x3df19e[_0x9637('0xf')][_0x9637('0x11')]);return _0x20addb(_0x3df19e['error'][_0x9637('0x11')]);}else{logger[_0x9637('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x32c145,_0x9637('0xe'));_0x20addb(_0x3df19e[_0x9637('0x12')][_0x9637('0x11')]);}})[_0x9637('0x13')](function(_0x340166){logger[_0x9637('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x32c145,_0x340166);_0x19798d(_0x340166);});});} \ No newline at end of file +var _0x014e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x500f38,_0x420d7d){var _0x29a07b=function(_0x5e3c11){while(--_0x5e3c11){_0x500f38['push'](_0x500f38['shift']());}};_0x29a07b(++_0x420d7d);}(_0x014e,0x1f2));var _0xe014=function(_0x28898,_0x438a8c){_0x28898=_0x28898-0x0;var _0x39e12b=_0x014e[_0x28898];return _0x39e12b;};'use strict';var _=require(_0xe014('0x0'));var util=require(_0xe014('0x1'));var moment=require(_0xe014('0x2'));var BPromise=require(_0xe014('0x3'));var rs=require(_0xe014('0x4'));var fs=require('fs');var Redis=require(_0xe014('0x5'));var db=require(_0xe014('0x6'))['db'];var utils=require(_0xe014('0x7'));var logger=require(_0xe014('0x8'))(_0xe014('0x9'));var config=require(_0xe014('0xa'));var jayson=require(_0xe014('0xb'));var client=jayson[_0xe014('0xc')][_0xe014('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x177515,_0x10a416,_0x58ea3d){return new BPromise(function(_0x223daa,_0x34798a){return client[_0xe014('0xe')](_0x177515,_0x58ea3d)['then'](function(_0x7d72f3){logger[_0xe014('0xf')](_0xe014('0x10'),_0x10a416,_0xe014('0x11'));logger[_0xe014('0x12')](_0xe014('0x13'),_0x10a416,_0xe014('0x11'),JSON[_0xe014('0x14')](_0x7d72f3));if(_0x7d72f3[_0xe014('0x15')]){if(_0x7d72f3['error'][_0xe014('0x16')]===0x1f4){logger[_0xe014('0x15')](_0xe014('0x10'),_0x10a416,_0x7d72f3[_0xe014('0x15')][_0xe014('0x17')]);return _0x34798a(_0x7d72f3['error'][_0xe014('0x17')]);}logger['error'](_0xe014('0x10'),_0x10a416,_0x7d72f3[_0xe014('0x15')][_0xe014('0x17')]);return _0x223daa(_0x7d72f3['error'][_0xe014('0x17')]);}else{logger[_0xe014('0xf')](_0xe014('0x10'),_0x10a416,_0xe014('0x11'));_0x223daa(_0x7d72f3[_0xe014('0x18')][_0xe014('0x17')]);}})['catch'](function(_0x4768c7){logger[_0xe014('0x15')](_0xe014('0x10'),_0x10a416,_0x4768c7);_0x34798a(_0x4768c7);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 9b8858e..0e995cd 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(_0x532cc7,_0x24dbe8){var _0x2ad62a=function(_0x16db4a){while(--_0x16db4a){_0x532cc7['push'](_0x532cc7['shift']());}};_0x2ad62a(++_0x24dbe8);}(_0x814b,0x1a2));var _0xb814=function(_0x379ee5,_0x336c42){_0x379ee5=_0x379ee5-0x0;var _0x114694=_0x814b[_0x379ee5];return _0x114694;};'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 _0x7217=['put','update','delete','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','/create_many','bulkCreate','/:id/create_many','addFields'];(function(_0x392ec2,_0x4e9f85){var _0x16e517=function(_0x379e8b){while(--_0x379e8b){_0x392ec2['push'](_0x392ec2['shift']());}};_0x16e517(++_0x4e9f85);}(_0x7217,0x19e));var _0x7721=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x7217[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xc')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0x10'),auth[_0x7721('0x8')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x13')]);router[_0x7721('0x14')]('/destroy_many',auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index bd26c66..9747400 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 _0xc936=['name','STRING','TEXT','exports'];(function(_0x4eaed1,_0x38ba87){var _0x22b9b8=function(_0x1ddaff){while(--_0x1ddaff){_0x4eaed1['push'](_0x4eaed1['shift']());}};_0x22b9b8(++_0x38ba87);}(_0xc936,0x153));var _0x6c93=function(_0x3be48b,_0xddcefa){_0x3be48b=_0x3be48b-0x0;var _0xeee73f=_0xc936[_0x3be48b];return _0xeee73f;};'use strict';var Sequelize=require('sequelize');module[_0x6c93('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6c93('0x1')},'table':{'type':Sequelize[_0x6c93('0x2')]},'metric':{'type':Sequelize[_0x6c93('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf865=['name','TEXT','sequelize','exports','STRING'];(function(_0x564022,_0x15206f){var _0x1adb7e=function(_0x3315ba){while(--_0x3315ba){_0x564022['push'](_0x564022['shift']());}};_0x1adb7e(++_0x15206f);}(_0xf865,0x11a));var _0x5f86=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0xf865[_0x141e03];return _0x2074e3;};'use strict';var Sequelize=require(_0x5f86('0x0'));module[_0x5f86('0x1')]={'name':{'type':Sequelize[_0x5f86('0x2')],'allowNull':![],'unique':_0x5f86('0x3')},'table':{'type':Sequelize[_0x5f86('0x2')]},'metric':{'type':Sequelize[_0x5f86('0x4')]},'description':{'type':Sequelize[_0x5f86('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index b88d907..56687ca 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 _0x19e1=['../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Metrics','UserProfileResource','error','name','send','index','map','AnalyticMetric','fieldName','type','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','keys','find','body','user','create','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x19e1,0x163));var _0x119e=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x19e1[_0x6cf19c];return _0xce14f3;};'use strict';var pdf=require(_0x119e('0x0'));var emlformat=require(_0x119e('0x1'));var rimraf=require(_0x119e('0x2'));var zipdir=require(_0x119e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x119e('0x4'));var BPromise=require(_0x119e('0x5'));var Mustache=require('mustache');var util=require(_0x119e('0x6'));var path=require(_0x119e('0x7'));var sox=require('sox');var csv=require(_0x119e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x119e('0x9'));var squel=require(_0x119e('0xa'));var crypto=require(_0x119e('0xb'));var jsforce=require(_0x119e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x119e('0x8'));var querystring=require(_0x119e('0xd'));var Papa=require(_0x119e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x119e('0xf'));var as=require(_0x119e('0x10'));var hardwareService=require(_0x119e('0x11'));var logger=require(_0x119e('0x12'))(_0x119e('0x13'));var utils=require(_0x119e('0x14'));var config=require(_0x119e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x430fff,_0x62d949){_0x62d949=_0x62d949||0xcc;return function(_0x1b0482){if(_0x1b0482){return _0x430fff[_0x119e('0x16')](_0x62d949);}return _0x430fff[_0x119e('0x17')](_0x62d949)[_0x119e('0x18')]();};}function respondWithResult(_0x4cfe1f,_0x1d46eb){_0x1d46eb=_0x1d46eb||0xc8;return function(_0x8a9fad){if(_0x8a9fad){return _0x4cfe1f[_0x119e('0x17')](_0x1d46eb)[_0x119e('0x19')](_0x8a9fad);}};}function respondWithFilteredResult(_0x132332,_0x3bac54){return function(_0x285148){if(_0x285148){var _0x791000=_0x285148['count'],_0x2c5902=_0x3bac54[_0x119e('0x1a')],_0x42acfd=_0x3bac54[_0x119e('0x1a')]+_0x3bac54[_0x119e('0x1b')],_0x41f329;if(_0x42acfd>=_0x791000){_0x42acfd=_0x791000;_0x41f329=0xc8;}else{_0x41f329=0xce;}_0x132332[_0x119e('0x17')](_0x41f329);return _0x132332[_0x119e('0x1c')](_0x119e('0x1d'),_0x2c5902+'-'+_0x42acfd+'/'+_0x791000)[_0x119e('0x19')](_0x285148);}return null;};}function patchUpdates(_0x35d22c){return function(_0x40528a){try{jsonpatch[_0x119e('0x1e')](_0x40528a,_0x35d22c,!![]);}catch(_0x2bd27a){return BPromise['reject'](_0x2bd27a);}return _0x40528a[_0x119e('0x1f')]();};}function saveUpdates(_0x5ef280,_0xd4c2d5){return function(_0x523a8d){if(_0x523a8d){return _0x523a8d[_0x119e('0x20')](_0x5ef280)[_0x119e('0x21')](function(_0x5b7ba0){return _0x5b7ba0;});}return null;};}function removeEntity(_0x4d41f0,_0x1ee79b){return function(_0x29de19){if(_0x29de19){return _0x29de19[_0x119e('0x22')]()['then'](function(){var _0x54c485=_0x29de19[_0x119e('0x23')]({'plain':!![]});var _0x52d69b=_0x119e('0x24');return db[_0x119e('0x25')][_0x119e('0x22')]({'where':{'type':_0x52d69b,'resourceId':_0x54c485['id']}})['then'](function(){return _0x29de19;});})[_0x119e('0x21')](function(){_0x4d41f0['status'](0xcc)[_0x119e('0x18')]();});}};}function handleEntityNotFound(_0x5398e6,_0x5c57a2){return function(_0xdc170f){if(!_0xdc170f){_0x5398e6[_0x119e('0x16')](0x194);}return _0xdc170f;};}function handleError(_0x1a7dea,_0x2770ac){_0x2770ac=_0x2770ac||0x1f4;return function(_0x476f0){logger[_0x119e('0x26')](_0x476f0['stack']);if(_0x476f0[_0x119e('0x27')]){delete _0x476f0[_0x119e('0x27')];}_0x1a7dea['status'](_0x2770ac)[_0x119e('0x28')](_0x476f0);};}exports[_0x119e('0x29')]=function(_0x49b965,_0x18f2d4){var _0x513843={},_0x12d101={},_0x201f9b={'count':0x0,'rows':[]};var _0x4211fb=_[_0x119e('0x2a')](db[_0x119e('0x2b')]['rawAttributes'],function(_0x1853f9){return{'name':_0x1853f9[_0x119e('0x2c')],'type':_0x1853f9[_0x119e('0x2d')][_0x119e('0x2e')]};});_0x12d101[_0x119e('0x2f')]=_[_0x119e('0x2a')](_0x4211fb,'name');_0x12d101['query']=_['keys'](_0x49b965['query']);_0x12d101[_0x119e('0x30')]=_[_0x119e('0x31')](_0x12d101['model'],_0x12d101['query']);_0x513843[_0x119e('0x32')]=_[_0x119e('0x31')](_0x12d101['model'],qs[_0x119e('0x33')](_0x49b965[_0x119e('0x34')]['fields']));_0x513843[_0x119e('0x32')]=_0x513843[_0x119e('0x32')][_0x119e('0x35')]?_0x513843[_0x119e('0x32')]:_0x12d101[_0x119e('0x2f')];if(!_0x49b965[_0x119e('0x34')][_0x119e('0x36')](_0x119e('0x37'))){_0x513843[_0x119e('0x1b')]=qs[_0x119e('0x1b')](_0x49b965[_0x119e('0x34')][_0x119e('0x1b')]);_0x513843[_0x119e('0x1a')]=qs[_0x119e('0x1a')](_0x49b965[_0x119e('0x34')]['offset']);}_0x513843[_0x119e('0x38')]=qs[_0x119e('0x39')](_0x49b965[_0x119e('0x34')]['sort']);_0x513843[_0x119e('0x3a')]=qs[_0x119e('0x30')](_[_0x119e('0x3b')](_0x49b965[_0x119e('0x34')],_0x12d101[_0x119e('0x30')]),_0x4211fb);if(_0x49b965['query']['filter']){_0x513843[_0x119e('0x3a')]=_[_0x119e('0x3c')](_0x513843[_0x119e('0x3a')],{'$or':_[_0x119e('0x2a')](_0x4211fb,function(_0x119c2d){if(_0x119c2d[_0x119e('0x2d')]!==_0x119e('0x3d')){var _0x4ec4bc={};_0x4ec4bc[_0x119c2d['name']]={'$like':'%'+_0x49b965[_0x119e('0x34')]['filter']+'%'};return _0x4ec4bc;}})});}_0x513843=_['merge']({},_0x513843,_0x49b965[_0x119e('0x3e')]);var _0x5b8f0f={'where':_0x513843['where']};return db['AnalyticMetric'][_0x119e('0x3f')](_0x5b8f0f)[_0x119e('0x21')](function(_0x113cb0){_0x201f9b[_0x119e('0x3f')]=_0x113cb0;if(_0x49b965[_0x119e('0x34')][_0x119e('0x40')]){_0x513843[_0x119e('0x41')]=[{'all':!![]}];}return db[_0x119e('0x2b')][_0x119e('0x42')](_0x513843);})[_0x119e('0x21')](function(_0x3d25a8){_0x201f9b[_0x119e('0x43')]=_0x3d25a8;return _0x201f9b;})[_0x119e('0x21')](respondWithFilteredResult(_0x18f2d4,_0x513843))[_0x119e('0x44')](handleError(_0x18f2d4,null));};exports['show']=function(_0x442c05,_0x3fb1f0){var _0x3a55b3={'raw':!![],'where':{'id':_0x442c05[_0x119e('0x45')]['id']}},_0x31e6e6={};_0x31e6e6[_0x119e('0x2f')]=_['keys'](db[_0x119e('0x2b')]['rawAttributes']);_0x31e6e6[_0x119e('0x34')]=_[_0x119e('0x46')](_0x442c05[_0x119e('0x34')]);_0x31e6e6[_0x119e('0x30')]=_[_0x119e('0x31')](_0x31e6e6[_0x119e('0x2f')],_0x31e6e6[_0x119e('0x34')]);_0x3a55b3['attributes']=_['intersection'](_0x31e6e6[_0x119e('0x2f')],qs[_0x119e('0x33')](_0x442c05[_0x119e('0x34')][_0x119e('0x33')]));_0x3a55b3[_0x119e('0x32')]=_0x3a55b3[_0x119e('0x32')][_0x119e('0x35')]?_0x3a55b3[_0x119e('0x32')]:_0x31e6e6[_0x119e('0x2f')];if(_0x442c05[_0x119e('0x34')][_0x119e('0x40')]){_0x3a55b3[_0x119e('0x41')]=[{'all':!![]}];}_0x3a55b3=_[_0x119e('0x3c')]({},_0x3a55b3,_0x442c05[_0x119e('0x3e')]);return db['AnalyticMetric'][_0x119e('0x47')](_0x3a55b3)[_0x119e('0x21')](handleEntityNotFound(_0x3fb1f0,null))['then'](respondWithResult(_0x3fb1f0,null))[_0x119e('0x44')](handleError(_0x3fb1f0,null));};exports['create']=function(_0x460aa6,_0x103a7d){return db[_0x119e('0x2b')]['create'](_0x460aa6[_0x119e('0x48')],{})[_0x119e('0x21')](function(_0x50ea06){var _0x46d022=_0x460aa6[_0x119e('0x49')][_0x119e('0x23')]({'plain':!![]});if(!_0x46d022)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46d022['role']==='user'){var _0x1f79cd=_0x50ea06[_0x119e('0x23')]({'plain':!![]});var _0x4ef35a=_0x119e('0x24');return db['UserProfileSection'][_0x119e('0x47')]({'where':{'name':_0x4ef35a,'userProfileId':_0x46d022['userProfileId']},'raw':!![]})[_0x119e('0x21')](function(_0x1980f9){if(_0x1980f9&&_0x1980f9['autoAssociation']===0x0){return db['UserProfileResource'][_0x119e('0x4a')]({'name':_0x1f79cd[_0x119e('0x27')],'resourceId':_0x1f79cd['id'],'type':_0x1980f9[_0x119e('0x27')],'sectionId':_0x1980f9['id']},{})[_0x119e('0x21')](function(){return _0x50ea06;});}else{return _0x50ea06;}})[_0x119e('0x44')](function(_0x2ced7f){logger[_0x119e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ced7f);throw _0x2ced7f;});}return _0x50ea06;})['then'](respondWithResult(_0x103a7d,0xc9))['catch'](handleError(_0x103a7d,null));};exports[_0x119e('0x20')]=function(_0x34d038,_0x488154){if(_0x34d038[_0x119e('0x48')]['id']){delete _0x34d038[_0x119e('0x48')]['id'];}return db[_0x119e('0x2b')][_0x119e('0x47')]({'where':{'id':_0x34d038['params']['id']}})[_0x119e('0x21')](handleEntityNotFound(_0x488154,null))['then'](saveUpdates(_0x34d038[_0x119e('0x48')],null))[_0x119e('0x21')](respondWithResult(_0x488154,null))[_0x119e('0x44')](handleError(_0x488154,null));};exports[_0x119e('0x22')]=function(_0x168898,_0x5da020){return db[_0x119e('0x2b')][_0x119e('0x47')]({'where':{'id':_0x168898[_0x119e('0x45')]['id']}})[_0x119e('0x21')](handleEntityNotFound(_0x5da020,null))[_0x119e('0x21')](removeEntity(_0x5da020,null))['catch'](handleError(_0x5da020,null));}; \ No newline at end of file +var _0x80ed=['end','sendStatus','stack','name','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','merge','VIRTUAL','options','AnalyticMetric','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','find','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','set','Content-Range','apply','save','update','destroy','then','get','Metrics','UserProfileResource'];(function(_0x23fce2,_0x29b0aa){var _0x7af835=function(_0x3c0b04){while(--_0x3c0b04){_0x23fce2['push'](_0x23fce2['shift']());}};_0x7af835(++_0x29b0aa);}(_0x80ed,0x11c));var _0xd80e=function(_0x36a7d8,_0x3cba6b){_0x36a7d8=_0x36a7d8-0x0;var _0x58aeb8=_0x80ed[_0x36a7d8];return _0x58aeb8;};'use strict';var pdf=require(_0xd80e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd80e('0x1'));var zipdir=require(_0xd80e('0x2'));var jsonpatch=require(_0xd80e('0x3'));var rp=require('request-promise');var moment=require(_0xd80e('0x4'));var BPromise=require(_0xd80e('0x5'));var Mustache=require(_0xd80e('0x6'));var util=require(_0xd80e('0x7'));var path=require('path');var sox=require(_0xd80e('0x8'));var csv=require(_0xd80e('0x9'));var ejs=require(_0xd80e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x9'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var db=require(_0xd80e('0x19'))['db'];function respondWithStatusCode(_0x1a9024,_0x118f53){_0x118f53=_0x118f53||0xcc;return function(_0x1d3fcf){if(_0x1d3fcf){return _0x1a9024['sendStatus'](_0x118f53);}return _0x1a9024['status'](_0x118f53)['end']();};}function respondWithResult(_0x57fefb,_0x145766){_0x145766=_0x145766||0xc8;return function(_0x3d233b){if(_0x3d233b){return _0x57fefb[_0xd80e('0x1a')](_0x145766)[_0xd80e('0x1b')](_0x3d233b);}};}function respondWithFilteredResult(_0x449c60,_0x58a17e){return function(_0x595683){if(_0x595683){var _0x2c8c61=_0x595683[_0xd80e('0x1c')],_0x3124e8=_0x58a17e[_0xd80e('0x1d')],_0x3b48ae=_0x58a17e[_0xd80e('0x1d')]+_0x58a17e['limit'],_0x40a4d5;if(_0x3b48ae>=_0x2c8c61){_0x3b48ae=_0x2c8c61;_0x40a4d5=0xc8;}else{_0x40a4d5=0xce;}_0x449c60[_0xd80e('0x1a')](_0x40a4d5);return _0x449c60[_0xd80e('0x1e')](_0xd80e('0x1f'),_0x3124e8+'-'+_0x3b48ae+'/'+_0x2c8c61)[_0xd80e('0x1b')](_0x595683);}return null;};}function patchUpdates(_0x593af6){return function(_0x39397a){try{jsonpatch[_0xd80e('0x20')](_0x39397a,_0x593af6,!![]);}catch(_0xecfe74){return BPromise['reject'](_0xecfe74);}return _0x39397a[_0xd80e('0x21')]();};}function saveUpdates(_0x2ef8a1,_0x2765ea){return function(_0x147134){if(_0x147134){return _0x147134[_0xd80e('0x22')](_0x2ef8a1)['then'](function(_0x4b6b8a){return _0x4b6b8a;});}return null;};}function removeEntity(_0x35a1bc,_0x3fa159){return function(_0x3b39bf){if(_0x3b39bf){return _0x3b39bf[_0xd80e('0x23')]()[_0xd80e('0x24')](function(){var _0x326d66=_0x3b39bf[_0xd80e('0x25')]({'plain':!![]});var _0x5430b6=_0xd80e('0x26');return db[_0xd80e('0x27')][_0xd80e('0x23')]({'where':{'type':_0x5430b6,'resourceId':_0x326d66['id']}})['then'](function(){return _0x3b39bf;});})[_0xd80e('0x24')](function(){_0x35a1bc[_0xd80e('0x1a')](0xcc)[_0xd80e('0x28')]();});}};}function handleEntityNotFound(_0x482779,_0x521aa4){return function(_0x5420e7){if(!_0x5420e7){_0x482779[_0xd80e('0x29')](0x194);}return _0x5420e7;};}function handleError(_0x4b8291,_0x9f9287){_0x9f9287=_0x9f9287||0x1f4;return function(_0x1044cc){logger['error'](_0x1044cc[_0xd80e('0x2a')]);if(_0x1044cc[_0xd80e('0x2b')]){delete _0x1044cc[_0xd80e('0x2b')];}_0x4b8291[_0xd80e('0x1a')](_0x9f9287)['send'](_0x1044cc);};}exports[_0xd80e('0x2c')]=function(_0x1ad3bc,_0x845451){var _0x39088b={},_0x2b1aaf={},_0x361946={'count':0x0,'rows':[]};var _0x289685=_[_0xd80e('0x2d')](db['AnalyticMetric']['rawAttributes'],function(_0x30f9bd){return{'name':_0x30f9bd[_0xd80e('0x2e')],'type':_0x30f9bd[_0xd80e('0x2f')][_0xd80e('0x30')]};});_0x2b1aaf[_0xd80e('0x31')]=_[_0xd80e('0x2d')](_0x289685,'name');_0x2b1aaf['query']=_[_0xd80e('0x32')](_0x1ad3bc[_0xd80e('0x33')]);_0x2b1aaf[_0xd80e('0x34')]=_[_0xd80e('0x35')](_0x2b1aaf[_0xd80e('0x31')],_0x2b1aaf[_0xd80e('0x33')]);_0x39088b[_0xd80e('0x36')]=_[_0xd80e('0x35')](_0x2b1aaf['model'],qs['fields'](_0x1ad3bc[_0xd80e('0x33')][_0xd80e('0x37')]));_0x39088b[_0xd80e('0x36')]=_0x39088b[_0xd80e('0x36')][_0xd80e('0x38')]?_0x39088b[_0xd80e('0x36')]:_0x2b1aaf[_0xd80e('0x31')];if(!_0x1ad3bc[_0xd80e('0x33')][_0xd80e('0x39')](_0xd80e('0x3a'))){_0x39088b['limit']=qs[_0xd80e('0x3b')](_0x1ad3bc['query'][_0xd80e('0x3b')]);_0x39088b[_0xd80e('0x1d')]=qs[_0xd80e('0x1d')](_0x1ad3bc[_0xd80e('0x33')]['offset']);}_0x39088b[_0xd80e('0x3c')]=qs['sort'](_0x1ad3bc[_0xd80e('0x33')]['sort']);_0x39088b[_0xd80e('0x3d')]=qs[_0xd80e('0x34')](_['pick'](_0x1ad3bc[_0xd80e('0x33')],_0x2b1aaf[_0xd80e('0x34')]),_0x289685);if(_0x1ad3bc[_0xd80e('0x33')]['filter']){_0x39088b[_0xd80e('0x3d')]=_[_0xd80e('0x3e')](_0x39088b[_0xd80e('0x3d')],{'$or':_[_0xd80e('0x2d')](_0x289685,function(_0x3c6f5f){if(_0x3c6f5f[_0xd80e('0x2f')]!==_0xd80e('0x3f')){var _0x137552={};_0x137552[_0x3c6f5f[_0xd80e('0x2b')]]={'$like':'%'+_0x1ad3bc['query']['filter']+'%'};return _0x137552;}})});}_0x39088b=_['merge']({},_0x39088b,_0x1ad3bc[_0xd80e('0x40')]);var _0x3ff4b4={'where':_0x39088b['where']};return db[_0xd80e('0x41')]['count'](_0x3ff4b4)[_0xd80e('0x24')](function(_0x5ade19){_0x361946[_0xd80e('0x1c')]=_0x5ade19;if(_0x1ad3bc[_0xd80e('0x33')]['includeAll']){_0x39088b['include']=[{'all':!![]}];}return db[_0xd80e('0x41')][_0xd80e('0x42')](_0x39088b);})[_0xd80e('0x24')](function(_0x3e65a7){_0x361946[_0xd80e('0x43')]=_0x3e65a7;return _0x361946;})[_0xd80e('0x24')](respondWithFilteredResult(_0x845451,_0x39088b))[_0xd80e('0x44')](handleError(_0x845451,null));};exports[_0xd80e('0x45')]=function(_0x91c6ed,_0x2da5f5){var _0x1bbb36={'raw':!![],'where':{'id':_0x91c6ed[_0xd80e('0x46')]['id']}},_0x2e257e={};_0x2e257e[_0xd80e('0x31')]=_[_0xd80e('0x32')](db[_0xd80e('0x41')]['rawAttributes']);_0x2e257e['query']=_['keys'](_0x91c6ed[_0xd80e('0x33')]);_0x2e257e['filters']=_[_0xd80e('0x35')](_0x2e257e[_0xd80e('0x31')],_0x2e257e[_0xd80e('0x33')]);_0x1bbb36[_0xd80e('0x36')]=_[_0xd80e('0x35')](_0x2e257e[_0xd80e('0x31')],qs['fields'](_0x91c6ed['query']['fields']));_0x1bbb36[_0xd80e('0x36')]=_0x1bbb36['attributes'][_0xd80e('0x38')]?_0x1bbb36[_0xd80e('0x36')]:_0x2e257e[_0xd80e('0x31')];if(_0x91c6ed[_0xd80e('0x33')][_0xd80e('0x47')]){_0x1bbb36['include']=[{'all':!![]}];}_0x1bbb36=_[_0xd80e('0x3e')]({},_0x1bbb36,_0x91c6ed[_0xd80e('0x40')]);return db[_0xd80e('0x41')]['find'](_0x1bbb36)[_0xd80e('0x24')](handleEntityNotFound(_0x2da5f5,null))[_0xd80e('0x24')](respondWithResult(_0x2da5f5,null))[_0xd80e('0x44')](handleError(_0x2da5f5,null));};exports['create']=function(_0x8d5cb8,_0x29aaa0){return db[_0xd80e('0x41')][_0xd80e('0x48')](_0x8d5cb8[_0xd80e('0x49')],{})[_0xd80e('0x24')](function(_0x56ba81){var _0x5aad1b=_0x8d5cb8[_0xd80e('0x4a')][_0xd80e('0x25')]({'plain':!![]});if(!_0x5aad1b)throw new Error(_0xd80e('0x4b'));if(_0x5aad1b['role']==='user'){var _0x1762a8=_0x56ba81[_0xd80e('0x25')]({'plain':!![]});var _0x183f78=_0xd80e('0x26');return db[_0xd80e('0x4c')]['find']({'where':{'name':_0x183f78,'userProfileId':_0x5aad1b[_0xd80e('0x4d')]},'raw':!![]})['then'](function(_0x46c781){if(_0x46c781&&_0x46c781[_0xd80e('0x4e')]===0x0){return db['UserProfileResource'][_0xd80e('0x48')]({'name':_0x1762a8[_0xd80e('0x2b')],'resourceId':_0x1762a8['id'],'type':_0x46c781[_0xd80e('0x2b')],'sectionId':_0x46c781['id']},{})[_0xd80e('0x24')](function(){return _0x56ba81;});}else{return _0x56ba81;}})[_0xd80e('0x44')](function(_0x470319){logger[_0xd80e('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x470319);throw _0x470319;});}return _0x56ba81;})[_0xd80e('0x24')](respondWithResult(_0x29aaa0,0xc9))[_0xd80e('0x44')](handleError(_0x29aaa0,null));};exports[_0xd80e('0x22')]=function(_0x4a66ca,_0x52ab04){if(_0x4a66ca[_0xd80e('0x49')]['id']){delete _0x4a66ca[_0xd80e('0x49')]['id'];}return db[_0xd80e('0x41')][_0xd80e('0x50')]({'where':{'id':_0x4a66ca[_0xd80e('0x46')]['id']}})[_0xd80e('0x24')](handleEntityNotFound(_0x52ab04,null))[_0xd80e('0x24')](saveUpdates(_0x4a66ca[_0xd80e('0x49')],null))['then'](respondWithResult(_0x52ab04,null))[_0xd80e('0x44')](handleError(_0x52ab04,null));};exports['destroy']=function(_0x3b5f47,_0x3c184c){return db[_0xd80e('0x41')][_0xd80e('0x50')]({'where':{'id':_0x3b5f47[_0xd80e('0x46')]['id']}})[_0xd80e('0x24')](handleEntityNotFound(_0x3c184c,null))['then'](removeEntity(_0x3c184c,null))[_0xd80e('0x44')](handleError(_0x3c184c,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d22536f..8f47e7d 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 _0x0d2e=['define','AnalyticMetric','analytics_metrics','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x17a647,_0x2bbe12){var _0x219a38=function(_0x131c5d){while(--_0x131c5d){_0x17a647['push'](_0x17a647['shift']());}};_0x219a38(++_0x2bbe12);}(_0x0d2e,0xf3));var _0xe0d2=function(_0x567bcb,_0x4978c1){_0x567bcb=_0x567bcb-0x0;var _0x4eebc2=_0x0d2e[_0x567bcb];return _0x4eebc2;};'use strict';var _=require('lodash');var util=require(_0xe0d2('0x0'));var logger=require(_0xe0d2('0x1'))('api');var moment=require(_0xe0d2('0x2'));var BPromise=require(_0xe0d2('0x3'));var rp=require(_0xe0d2('0x4'));var fs=require('fs');var path=require(_0xe0d2('0x5'));var rimraf=require('rimraf');var config=require(_0xe0d2('0x6'));var attributes=require(_0xe0d2('0x7'));module[_0xe0d2('0x8')]=function(_0x113181,_0x2098f2){return _0x113181[_0xe0d2('0x9')](_0xe0d2('0xa'),attributes,{'tableName':_0xe0d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ba4=['define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','rimraf','../../config/environment','exports'];(function(_0xf6086c,_0x23b3cb){var _0x3118a3=function(_0x3fad4a){while(--_0x3fad4a){_0xf6086c['push'](_0xf6086c['shift']());}};_0x3118a3(++_0x23b3cb);}(_0x1ba4,0x7b));var _0x41ba=function(_0x2f73a7,_0x1be12b){_0x2f73a7=_0x2f73a7-0x0;var _0x4e8690=_0x1ba4[_0x2f73a7];return _0x4e8690;};'use strict';var _=require(_0x41ba('0x0'));var util=require(_0x41ba('0x1'));var logger=require(_0x41ba('0x2'))(_0x41ba('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x41ba('0x4'));var config=require(_0x41ba('0x5'));var attributes=require('./analyticMetric.attributes');module[_0x41ba('0x6')]=function(_0x3f8b5b,_0x2701a3){return _0x3f8b5b[_0x41ba('0x7')](_0x41ba('0x8'),attributes,{'tableName':_0x41ba('0x9'),'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 8ea8ff0..1b41de4 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 _0x6cf1=['http','request','then','info','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1b743a,_0x15376b){var _0x9b28fc=function(_0x12f409){while(--_0x12f409){_0x1b743a['push'](_0x1b743a['shift']());}};_0x9b28fc(++_0x15376b);}(_0x6cf1,0x1f1));var _0x16cf=function(_0x20a353,_0x544561){_0x20a353=_0x20a353-0x0;var _0x524940=_0x6cf1[_0x20a353];return _0x524940;};'use strict';var _=require(_0x16cf('0x0'));var util=require(_0x16cf('0x1'));var moment=require(_0x16cf('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16cf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x16cf('0x4'));var logger=require(_0x16cf('0x5'))(_0x16cf('0x6'));var config=require(_0x16cf('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x16cf('0x8')][_0x16cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19c0c8,_0x9d4bb6,_0xbf0dfe){return new BPromise(function(_0x2238cb,_0x5e3f05){return client[_0x16cf('0xa')](_0x19c0c8,_0xbf0dfe)[_0x16cf('0xb')](function(_0x2adc1e){logger[_0x16cf('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x9d4bb6,'request\x20sent');logger[_0x16cf('0xd')](_0x16cf('0xe'),_0x9d4bb6,_0x16cf('0xf'),JSON[_0x16cf('0x10')](_0x2adc1e));if(_0x2adc1e['error']){if(_0x2adc1e[_0x16cf('0x11')]['code']===0x1f4){logger[_0x16cf('0x11')](_0x16cf('0x12'),_0x9d4bb6,_0x2adc1e[_0x16cf('0x11')][_0x16cf('0x13')]);return _0x5e3f05(_0x2adc1e['error'][_0x16cf('0x13')]);}logger[_0x16cf('0x11')](_0x16cf('0x12'),_0x9d4bb6,_0x2adc1e[_0x16cf('0x11')][_0x16cf('0x13')]);return _0x2238cb(_0x2adc1e[_0x16cf('0x11')][_0x16cf('0x13')]);}else{logger[_0x16cf('0xc')](_0x16cf('0x12'),_0x9d4bb6,_0x16cf('0xf'));_0x2238cb(_0x2adc1e[_0x16cf('0x14')][_0x16cf('0x13')]);}})[_0x16cf('0x15')](function(_0x5024e9){logger['error'](_0x16cf('0x12'),_0x9d4bb6,_0x5024e9);_0x5e3f05(_0x5024e9);});});} \ No newline at end of file +var _0x533b=['../../config/environment','jayson/promise','client','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4580d4,_0xb4514f){var _0x48ce72=function(_0x35194e){while(--_0x35194e){_0x4580d4['push'](_0x4580d4['shift']());}};_0x48ce72(++_0xb4514f);}(_0x533b,0x183));var _0xb533=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x533b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb533('0x0'));var util=require(_0xb533('0x1'));var moment=require(_0xb533('0x2'));var BPromise=require('bluebird');var rs=require(_0xb533('0x3'));var fs=require('fs');var Redis=require(_0xb533('0x4'));var db=require(_0xb533('0x5'))['db'];var utils=require(_0xb533('0x6'));var logger=require(_0xb533('0x7'))(_0xb533('0x8'));var config=require(_0xb533('0x9'));var jayson=require(_0xb533('0xa'));var client=jayson[_0xb533('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d8cc6,_0x55f4f3,_0x158db0){return new BPromise(function(_0x59dc61,_0x153dff){return client['request'](_0x2d8cc6,_0x158db0)[_0xb533('0xc')](function(_0x446481){logger[_0xb533('0xd')](_0xb533('0xe'),_0x55f4f3,_0xb533('0xf'));logger[_0xb533('0x10')](_0xb533('0x11'),_0x55f4f3,_0xb533('0xf'),JSON[_0xb533('0x12')](_0x446481));if(_0x446481[_0xb533('0x13')]){if(_0x446481[_0xb533('0x13')][_0xb533('0x14')]===0x1f4){logger[_0xb533('0x13')](_0xb533('0xe'),_0x55f4f3,_0x446481[_0xb533('0x13')]['message']);return _0x153dff(_0x446481[_0xb533('0x13')][_0xb533('0x15')]);}logger[_0xb533('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x55f4f3,_0x446481[_0xb533('0x13')][_0xb533('0x15')]);return _0x59dc61(_0x446481[_0xb533('0x13')][_0xb533('0x15')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x55f4f3,_0xb533('0xf'));_0x59dc61(_0x446481['result'][_0xb533('0x15')]);}})['catch'](function(_0x22f46f){logger[_0xb533('0x13')](_0xb533('0xe'),_0x55f4f3,_0x22f46f);_0x153dff(_0x22f46f);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index db82d9d..d88d14a 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 _0x187d=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x3edf27,_0x542b96){var _0x24bbff=function(_0xef8d6){while(--_0xef8d6){_0x3edf27['push'](_0x3edf27['shift']());}};_0x24bbff(++_0x542b96);}(_0x187d,0x93));var _0xd187=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x187d[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var auth=require(_0xd187('0x5'));var interaction=require(_0xd187('0x6'));var config=require('../../config/environment');var controller=require(_0xd187('0x7'));router[_0xd187('0x8')]('/',auth['isAuthenticated'](),controller[_0xd187('0x9')]);router[_0xd187('0x8')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xc')]);router[_0xd187('0xd')]('/',auth[_0xd187('0xb')](),controller[_0xd187('0xe')]);router['put'](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xf')]);router[_0xd187('0x10')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller['destroy']);module[_0xd187('0x11')]=router; \ No newline at end of file +var _0xe2fe=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','/:id','post','create','put','update','exports','multer'];(function(_0x3565c1,_0x30cc7a){var _0x3f2183=function(_0x57b3b){while(--_0x57b3b){_0x3565c1['push'](_0x3565c1['shift']());}};_0x3f2183(++_0x30cc7a);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var auth=require(_0xee2f('0x3'));var interaction=require(_0xee2f('0x4'));var config=require(_0xee2f('0x5'));var controller=require(_0xee2f('0x6'));router['get']('/',auth[_0xee2f('0x7')](),controller[_0xee2f('0x8')]);router['get'](_0xee2f('0x9'),auth[_0xee2f('0x7')](),controller['show']);router[_0xee2f('0xa')]('/',auth['isAuthenticated'](),controller[_0xee2f('0xb')]);router[_0xee2f('0xc')]('/:id',auth[_0xee2f('0x7')](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xee2f('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index b9898db..f6f62ca 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 _0x5f66=['exports','sequelize'];(function(_0xcf7834,_0x24a774){var _0x25aca0=function(_0x4a1899){while(--_0x4a1899){_0xcf7834['push'](_0xcf7834['shift']());}};_0x25aca0(++_0x24a774);}(_0x5f66,0x16f));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0x65f6('0x0'));module[_0x65f6('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xe2ef=['sequelize','exports','TEXT'];(function(_0x26a655,_0x4b48c2){var _0x6db920=function(_0x23b3d9){while(--_0x23b3d9){_0x26a655['push'](_0x26a655['shift']());}};_0x6db920(++_0x4b48c2);}(_0xe2ef,0xf6));var _0xfe2e=function(_0x4ba677,_0x2dff1e){_0x4ba677=_0x4ba677-0x0;var _0x4ed8d2=_0xe2ef[_0x4ba677];return _0x4ed8d2;};'use strict';var Sequelize=require(_0xfe2e('0x0'));module[_0xfe2e('0x1')]={'tree':{'type':Sequelize[_0xfe2e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index c72a0e1..45d134d 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 _0x9308=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','then','destroy','error','stack','name','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0xfa5b8a,_0x2381f7){var _0x2f351d=function(_0x4bb826){while(--_0x4bb826){_0xfa5b8a['push'](_0xfa5b8a['shift']());}};_0x2f351d(++_0x2381f7);}(_0x9308,0x7b));var _0x8930=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9308[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x8930('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8930('0x1'));var zipdir=require(_0x8930('0x2'));var jsonpatch=require(_0x8930('0x3'));var rp=require('request-promise');var moment=require(_0x8930('0x4'));var BPromise=require(_0x8930('0x5'));var Mustache=require('mustache');var util=require(_0x8930('0x6'));var path=require(_0x8930('0x7'));var sox=require(_0x8930('0x8'));var csv=require(_0x8930('0x9'));var ejs=require(_0x8930('0xa'));var fs=require('fs');var _=require(_0x8930('0xb'));var squel=require('squel');var crypto=require(_0x8930('0xc'));var jsforce=require(_0x8930('0xd'));var deskjs=require(_0x8930('0xe'));var toCsv=require(_0x8930('0x9'));var querystring=require(_0x8930('0xf'));var Papa=require('papaparse');var Redis=require(_0x8930('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8930('0x11'));var hardwareService=require(_0x8930('0x12'));var logger=require(_0x8930('0x13'))('api');var utils=require(_0x8930('0x14'));var config=require(_0x8930('0x15'));var db=require(_0x8930('0x16'))['db'];function respondWithStatusCode(_0x2983b0,_0x118885){_0x118885=_0x118885||0xcc;return function(_0x7d0c45){if(_0x7d0c45){return _0x2983b0[_0x8930('0x17')](_0x118885);}return _0x2983b0[_0x8930('0x18')](_0x118885)[_0x8930('0x19')]();};}function respondWithResult(_0x4c70a2,_0x4e52b8){_0x4e52b8=_0x4e52b8||0xc8;return function(_0x2205ed){if(_0x2205ed){return _0x4c70a2[_0x8930('0x18')](_0x4e52b8)[_0x8930('0x1a')](_0x2205ed);}};}function respondWithFilteredResult(_0x3863eb,_0x57e98a){return function(_0x11d954){if(_0x11d954){var _0x304df3=_0x11d954[_0x8930('0x1b')],_0x36fcb9=_0x57e98a[_0x8930('0x1c')],_0x58e788=_0x57e98a[_0x8930('0x1c')]+_0x57e98a[_0x8930('0x1d')],_0x2b6bd6;if(_0x58e788>=_0x304df3){_0x58e788=_0x304df3;_0x2b6bd6=0xc8;}else{_0x2b6bd6=0xce;}_0x3863eb[_0x8930('0x18')](_0x2b6bd6);return _0x3863eb[_0x8930('0x1e')](_0x8930('0x1f'),_0x36fcb9+'-'+_0x58e788+'/'+_0x304df3)[_0x8930('0x1a')](_0x11d954);}return null;};}function patchUpdates(_0x3d3565){return function(_0x1215a5){try{jsonpatch['apply'](_0x1215a5,_0x3d3565,!![]);}catch(_0x337d99){return BPromise[_0x8930('0x20')](_0x337d99);}return _0x1215a5['save']();};}function saveUpdates(_0x25fa84,_0x3ad32a){return function(_0x29baf5){if(_0x29baf5){return _0x29baf5['update'](_0x25fa84)[_0x8930('0x21')](function(_0x40edb4){return _0x40edb4;});}return null;};}function removeEntity(_0x2458fe,_0x288c36){return function(_0x4edc94){if(_0x4edc94){return _0x4edc94[_0x8930('0x22')]()[_0x8930('0x21')](function(){_0x2458fe[_0x8930('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47e35d,_0x13de1e){return function(_0x1bbbc1){if(!_0x1bbbc1){_0x47e35d[_0x8930('0x17')](0x194);}return _0x1bbbc1;};}function handleError(_0x43f3a7,_0x4bdef9){_0x4bdef9=_0x4bdef9||0x1f4;return function(_0xc4c4cf){logger[_0x8930('0x23')](_0xc4c4cf[_0x8930('0x24')]);if(_0xc4c4cf[_0x8930('0x25')]){delete _0xc4c4cf['name'];}_0x43f3a7['status'](_0x4bdef9)['send'](_0xc4c4cf);};}exports['index']=function(_0x4d58de,_0x317ae8){var _0x2764b1={},_0x3b1900={},_0x1406f4={'count':0x0,'rows':[]};var _0x2efcfc=_['map'](db[_0x8930('0x26')][_0x8930('0x27')],function(_0x703540){return{'name':_0x703540[_0x8930('0x28')],'type':_0x703540[_0x8930('0x29')][_0x8930('0x2a')]};});_0x3b1900[_0x8930('0x2b')]=_['map'](_0x2efcfc,'name');_0x3b1900['query']=_[_0x8930('0x2c')](_0x4d58de[_0x8930('0x2d')]);_0x3b1900[_0x8930('0x2e')]=_['intersection'](_0x3b1900[_0x8930('0x2b')],_0x3b1900['query']);_0x2764b1['attributes']=_[_0x8930('0x2f')](_0x3b1900[_0x8930('0x2b')],qs[_0x8930('0x30')](_0x4d58de[_0x8930('0x2d')][_0x8930('0x30')]));_0x2764b1[_0x8930('0x31')]=_0x2764b1[_0x8930('0x31')][_0x8930('0x32')]?_0x2764b1['attributes']:_0x3b1900[_0x8930('0x2b')];if(!_0x4d58de[_0x8930('0x2d')][_0x8930('0x33')](_0x8930('0x34'))){_0x2764b1[_0x8930('0x1d')]=qs[_0x8930('0x1d')](_0x4d58de[_0x8930('0x2d')]['limit']);_0x2764b1[_0x8930('0x1c')]=qs['offset'](_0x4d58de[_0x8930('0x2d')][_0x8930('0x1c')]);}_0x2764b1[_0x8930('0x35')]=qs['sort'](_0x4d58de[_0x8930('0x2d')][_0x8930('0x36')]);_0x2764b1[_0x8930('0x37')]=qs[_0x8930('0x2e')](_[_0x8930('0x38')](_0x4d58de['query'],_0x3b1900['filters']),_0x2efcfc);if(_0x4d58de[_0x8930('0x2d')][_0x8930('0x39')]){_0x2764b1[_0x8930('0x37')]=_[_0x8930('0x3a')](_0x2764b1[_0x8930('0x37')],{'$or':_['map'](_0x2efcfc,function(_0x291575){if(_0x291575[_0x8930('0x29')]!==_0x8930('0x3b')){var _0xd80170={};_0xd80170[_0x291575[_0x8930('0x25')]]={'$like':'%'+_0x4d58de[_0x8930('0x2d')][_0x8930('0x39')]+'%'};return _0xd80170;}})});}_0x2764b1=_[_0x8930('0x3a')]({},_0x2764b1,_0x4d58de[_0x8930('0x3c')]);var _0x1716e6={'where':_0x2764b1['where']};return db[_0x8930('0x26')][_0x8930('0x1b')](_0x1716e6)[_0x8930('0x21')](function(_0x3d02de){_0x1406f4['count']=_0x3d02de;if(_0x4d58de['query']['includeAll']){_0x2764b1[_0x8930('0x3d')]=[{'all':!![]}];}return db[_0x8930('0x26')][_0x8930('0x3e')](_0x2764b1);})[_0x8930('0x21')](function(_0x3c279a){_0x1406f4[_0x8930('0x3f')]=_0x3c279a;return _0x1406f4;})[_0x8930('0x21')](respondWithFilteredResult(_0x317ae8,_0x2764b1))[_0x8930('0x40')](handleError(_0x317ae8,null));};exports['show']=function(_0x37e53e,_0x2021c9){var _0x245099={'raw':!![],'where':{'id':_0x37e53e[_0x8930('0x41')]['id']}},_0x24f6b9={};_0x24f6b9[_0x8930('0x2b')]=_[_0x8930('0x2c')](db['AnalyticTreeReport'][_0x8930('0x27')]);_0x24f6b9[_0x8930('0x2d')]=_[_0x8930('0x2c')](_0x37e53e[_0x8930('0x2d')]);_0x24f6b9[_0x8930('0x2e')]=_[_0x8930('0x2f')](_0x24f6b9['model'],_0x24f6b9['query']);_0x245099['attributes']=_[_0x8930('0x2f')](_0x24f6b9[_0x8930('0x2b')],qs[_0x8930('0x30')](_0x37e53e[_0x8930('0x2d')]['fields']));_0x245099[_0x8930('0x31')]=_0x245099['attributes'][_0x8930('0x32')]?_0x245099[_0x8930('0x31')]:_0x24f6b9[_0x8930('0x2b')];if(_0x37e53e[_0x8930('0x2d')]['includeAll']){_0x245099[_0x8930('0x3d')]=[{'all':!![]}];}_0x245099=_['merge']({},_0x245099,_0x37e53e[_0x8930('0x3c')]);return db[_0x8930('0x26')][_0x8930('0x42')](_0x245099)[_0x8930('0x21')](handleEntityNotFound(_0x2021c9,null))['then'](respondWithResult(_0x2021c9,null))[_0x8930('0x40')](handleError(_0x2021c9,null));};exports[_0x8930('0x43')]=function(_0x205a51,_0x43f811){return db['AnalyticTreeReport']['create'](_0x205a51[_0x8930('0x44')],{})[_0x8930('0x21')](respondWithResult(_0x43f811,0xc9))['catch'](handleError(_0x43f811,null));};exports[_0x8930('0x45')]=function(_0x2b24db,_0x4dc0e0){if(_0x2b24db[_0x8930('0x44')]['id']){delete _0x2b24db['body']['id'];}return db[_0x8930('0x26')][_0x8930('0x42')]({'where':{'id':_0x2b24db['params']['id']}})['then'](handleEntityNotFound(_0x4dc0e0,null))[_0x8930('0x21')](saveUpdates(_0x2b24db[_0x8930('0x44')],null))[_0x8930('0x21')](respondWithResult(_0x4dc0e0,null))[_0x8930('0x40')](handleError(_0x4dc0e0,null));};exports[_0x8930('0x22')]=function(_0x4c6b4f,_0x5114e6){return db[_0x8930('0x26')][_0x8930('0x42')]({'where':{'id':_0x4c6b4f['params']['id']}})[_0x8930('0x21')](handleEntityNotFound(_0x5114e6,null))[_0x8930('0x21')](removeEntity(_0x5114e6,null))[_0x8930('0x40')](handleError(_0x5114e6,null));}; \ No newline at end of file +var _0xaf01=['../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x45d110,_0x352195){var _0x27a1f5=function(_0x5ee28f){while(--_0x5ee28f){_0x45d110['push'](_0x45d110['shift']());}};_0x27a1f5(++_0x352195);}(_0xaf01,0x1af));var _0x1af0=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xaf01[_0x29d94e];return _0x106237;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1af0('0x0'));var rimraf=require(_0x1af0('0x1'));var zipdir=require(_0x1af0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1af0('0x3'));var moment=require(_0x1af0('0x4'));var BPromise=require(_0x1af0('0x5'));var Mustache=require(_0x1af0('0x6'));var util=require(_0x1af0('0x7'));var path=require(_0x1af0('0x8'));var sox=require('sox');var csv=require(_0x1af0('0x9'));var ejs=require(_0x1af0('0xa'));var fs=require('fs');var _=require(_0x1af0('0xb'));var squel=require(_0x1af0('0xc'));var crypto=require('crypto');var jsforce=require(_0x1af0('0xd'));var deskjs=require(_0x1af0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1af0('0xf'));var Papa=require(_0x1af0('0x10'));var Redis=require(_0x1af0('0x11'));var authService=require(_0x1af0('0x12'));var qs=require(_0x1af0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1af0('0x14'))(_0x1af0('0x15'));var utils=require(_0x1af0('0x16'));var config=require('../../config/environment');var db=require(_0x1af0('0x17'))['db'];function respondWithStatusCode(_0x3ecc95,_0x5eca6f){_0x5eca6f=_0x5eca6f||0xcc;return function(_0x1e9b98){if(_0x1e9b98){return _0x3ecc95[_0x1af0('0x18')](_0x5eca6f);}return _0x3ecc95[_0x1af0('0x19')](_0x5eca6f)[_0x1af0('0x1a')]();};}function respondWithResult(_0x1c3e2e,_0x1f13b6){_0x1f13b6=_0x1f13b6||0xc8;return function(_0x593cd8){if(_0x593cd8){return _0x1c3e2e['status'](_0x1f13b6)[_0x1af0('0x1b')](_0x593cd8);}};}function respondWithFilteredResult(_0x321e8e,_0x320d19){return function(_0xe03ea7){if(_0xe03ea7){var _0x43161c=_0xe03ea7['count'],_0x39a604=_0x320d19[_0x1af0('0x1c')],_0x423b6c=_0x320d19['offset']+_0x320d19['limit'],_0x53be78;if(_0x423b6c>=_0x43161c){_0x423b6c=_0x43161c;_0x53be78=0xc8;}else{_0x53be78=0xce;}_0x321e8e['status'](_0x53be78);return _0x321e8e['set'](_0x1af0('0x1d'),_0x39a604+'-'+_0x423b6c+'/'+_0x43161c)[_0x1af0('0x1b')](_0xe03ea7);}return null;};}function patchUpdates(_0x14b8a1){return function(_0xdbda47){try{jsonpatch[_0x1af0('0x1e')](_0xdbda47,_0x14b8a1,!![]);}catch(_0x24eceb){return BPromise[_0x1af0('0x1f')](_0x24eceb);}return _0xdbda47[_0x1af0('0x20')]();};}function saveUpdates(_0x159e3c,_0x16c0c2){return function(_0x1c693f){if(_0x1c693f){return _0x1c693f[_0x1af0('0x21')](_0x159e3c)['then'](function(_0x213311){return _0x213311;});}return null;};}function removeEntity(_0x1a5829,_0x22c02b){return function(_0x4e76f4){if(_0x4e76f4){return _0x4e76f4[_0x1af0('0x22')]()[_0x1af0('0x23')](function(){_0x1a5829['status'](0xcc)[_0x1af0('0x1a')]();});}};}function handleEntityNotFound(_0x259db8,_0x4f19ef){return function(_0x186467){if(!_0x186467){_0x259db8['sendStatus'](0x194);}return _0x186467;};}function handleError(_0x5e1bb0,_0x614939){_0x614939=_0x614939||0x1f4;return function(_0x41769e){logger[_0x1af0('0x24')](_0x41769e[_0x1af0('0x25')]);if(_0x41769e[_0x1af0('0x26')]){delete _0x41769e[_0x1af0('0x26')];}_0x5e1bb0[_0x1af0('0x19')](_0x614939)[_0x1af0('0x27')](_0x41769e);};}exports['index']=function(_0x34db5d,_0x591d28){var _0x54937a={},_0x5cf5ae={},_0x507c49={'count':0x0,'rows':[]};var _0x5444f0=_[_0x1af0('0x28')](db[_0x1af0('0x29')][_0x1af0('0x2a')],function(_0x245247){return{'name':_0x245247[_0x1af0('0x2b')],'type':_0x245247['type'][_0x1af0('0x2c')]};});_0x5cf5ae['model']=_[_0x1af0('0x28')](_0x5444f0,'name');_0x5cf5ae[_0x1af0('0x2d')]=_['keys'](_0x34db5d[_0x1af0('0x2d')]);_0x5cf5ae[_0x1af0('0x2e')]=_[_0x1af0('0x2f')](_0x5cf5ae[_0x1af0('0x30')],_0x5cf5ae[_0x1af0('0x2d')]);_0x54937a[_0x1af0('0x31')]=_['intersection'](_0x5cf5ae[_0x1af0('0x30')],qs[_0x1af0('0x32')](_0x34db5d[_0x1af0('0x2d')][_0x1af0('0x32')]));_0x54937a['attributes']=_0x54937a['attributes'][_0x1af0('0x33')]?_0x54937a['attributes']:_0x5cf5ae[_0x1af0('0x30')];if(!_0x34db5d['query'][_0x1af0('0x34')](_0x1af0('0x35'))){_0x54937a[_0x1af0('0x36')]=qs[_0x1af0('0x36')](_0x34db5d[_0x1af0('0x2d')]['limit']);_0x54937a[_0x1af0('0x1c')]=qs[_0x1af0('0x1c')](_0x34db5d[_0x1af0('0x2d')][_0x1af0('0x1c')]);}_0x54937a[_0x1af0('0x37')]=qs[_0x1af0('0x38')](_0x34db5d[_0x1af0('0x2d')]['sort']);_0x54937a['where']=qs[_0x1af0('0x2e')](_[_0x1af0('0x39')](_0x34db5d[_0x1af0('0x2d')],_0x5cf5ae[_0x1af0('0x2e')]),_0x5444f0);if(_0x34db5d[_0x1af0('0x2d')][_0x1af0('0x3a')]){_0x54937a[_0x1af0('0x3b')]=_[_0x1af0('0x3c')](_0x54937a['where'],{'$or':_['map'](_0x5444f0,function(_0x167d01){if(_0x167d01[_0x1af0('0x3d')]!==_0x1af0('0x3e')){var _0x35651c={};_0x35651c[_0x167d01['name']]={'$like':'%'+_0x34db5d[_0x1af0('0x2d')][_0x1af0('0x3a')]+'%'};return _0x35651c;}})});}_0x54937a=_[_0x1af0('0x3c')]({},_0x54937a,_0x34db5d[_0x1af0('0x3f')]);var _0x722b9d={'where':_0x54937a[_0x1af0('0x3b')]};return db['AnalyticTreeReport']['count'](_0x722b9d)['then'](function(_0x273ce5){_0x507c49['count']=_0x273ce5;if(_0x34db5d[_0x1af0('0x2d')]['includeAll']){_0x54937a[_0x1af0('0x40')]=[{'all':!![]}];}return db[_0x1af0('0x29')][_0x1af0('0x41')](_0x54937a);})[_0x1af0('0x23')](function(_0x18ab9d){_0x507c49[_0x1af0('0x42')]=_0x18ab9d;return _0x507c49;})[_0x1af0('0x23')](respondWithFilteredResult(_0x591d28,_0x54937a))['catch'](handleError(_0x591d28,null));};exports[_0x1af0('0x43')]=function(_0x528b6e,_0x2f326f){var _0x280e2c={'raw':!![],'where':{'id':_0x528b6e[_0x1af0('0x44')]['id']}},_0x242cf1={};_0x242cf1[_0x1af0('0x30')]=_[_0x1af0('0x45')](db[_0x1af0('0x29')][_0x1af0('0x2a')]);_0x242cf1[_0x1af0('0x2d')]=_[_0x1af0('0x45')](_0x528b6e[_0x1af0('0x2d')]);_0x242cf1[_0x1af0('0x2e')]=_[_0x1af0('0x2f')](_0x242cf1['model'],_0x242cf1[_0x1af0('0x2d')]);_0x280e2c[_0x1af0('0x31')]=_[_0x1af0('0x2f')](_0x242cf1[_0x1af0('0x30')],qs[_0x1af0('0x32')](_0x528b6e[_0x1af0('0x2d')][_0x1af0('0x32')]));_0x280e2c['attributes']=_0x280e2c['attributes'][_0x1af0('0x33')]?_0x280e2c[_0x1af0('0x31')]:_0x242cf1[_0x1af0('0x30')];if(_0x528b6e[_0x1af0('0x2d')][_0x1af0('0x46')]){_0x280e2c[_0x1af0('0x40')]=[{'all':!![]}];}_0x280e2c=_[_0x1af0('0x3c')]({},_0x280e2c,_0x528b6e[_0x1af0('0x3f')]);return db['AnalyticTreeReport'][_0x1af0('0x47')](_0x280e2c)[_0x1af0('0x23')](handleEntityNotFound(_0x2f326f,null))['then'](respondWithResult(_0x2f326f,null))[_0x1af0('0x48')](handleError(_0x2f326f,null));};exports[_0x1af0('0x49')]=function(_0x383d3,_0x537229){return db[_0x1af0('0x29')][_0x1af0('0x49')](_0x383d3['body'],{})[_0x1af0('0x23')](respondWithResult(_0x537229,0xc9))['catch'](handleError(_0x537229,null));};exports[_0x1af0('0x21')]=function(_0xf08f45,_0x2c5d77){if(_0xf08f45[_0x1af0('0x4a')]['id']){delete _0xf08f45[_0x1af0('0x4a')]['id'];}return db['AnalyticTreeReport'][_0x1af0('0x47')]({'where':{'id':_0xf08f45['params']['id']}})[_0x1af0('0x23')](handleEntityNotFound(_0x2c5d77,null))[_0x1af0('0x23')](saveUpdates(_0xf08f45['body'],null))['then'](respondWithResult(_0x2c5d77,null))[_0x1af0('0x48')](handleError(_0x2c5d77,null));};exports['destroy']=function(_0x34daf3,_0x157bed){return db[_0x1af0('0x29')][_0x1af0('0x47')]({'where':{'id':_0x34daf3['params']['id']}})[_0x1af0('0x23')](handleEntityNotFound(_0x157bed,null))[_0x1af0('0x23')](removeEntity(_0x157bed,null))['catch'](handleError(_0x157bed,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index f17850d..9ddfc6a 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 _0x7aea=['AnalyticTreeReport','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7aea,0xa9));var _0xa7ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7aea[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa7ae('0x0'));var util=require(_0xa7ae('0x1'));var logger=require(_0xa7ae('0x2'))('api');var moment=require(_0xa7ae('0x3'));var BPromise=require('bluebird');var rp=require(_0xa7ae('0x4'));var fs=require('fs');var path=require(_0xa7ae('0x5'));var rimraf=require('rimraf');var config=require(_0xa7ae('0x6'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x554f42,_0x9e911e){return _0x554f42['define'](_0xa7ae('0x7'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc77d=['moment','bluebird','path','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','util','../../config/logger'];(function(_0x433bff,_0x55d2da){var _0x23105e=function(_0x2efdde){while(--_0x2efdde){_0x433bff['push'](_0x433bff['shift']());}};_0x23105e(++_0x55d2da);}(_0xc77d,0x6a));var _0xdc77=function(_0x35b7ba,_0x155c7f){_0x35b7ba=_0x35b7ba-0x0;var _0x25ea5e=_0xc77d[_0x35b7ba];return _0x25ea5e;};'use strict';var _=require('lodash');var util=require(_0xdc77('0x0'));var logger=require(_0xdc77('0x1'))('api');var moment=require(_0xdc77('0x2'));var BPromise=require(_0xdc77('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc77('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdc77('0x5'));module[_0xdc77('0x6')]=function(_0x3646f8,_0x2da1aa){return _0x3646f8['define'](_0xdc77('0x7'),attributes,{'tableName':_0xdc77('0x8'),'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 ecd553c..7413acc 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 _0x5bc7=['debug','error','code','AnalyticTreeReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5bc7,0x1ea));var _0x75bc=function(_0x146f03,_0xad2335){_0x146f03=_0x146f03-0x0;var _0x18a3c5=_0x5bc7[_0x146f03];return _0x18a3c5;};'use strict';var _=require(_0x75bc('0x0'));var util=require('util');var moment=require(_0x75bc('0x1'));var BPromise=require(_0x75bc('0x2'));var rs=require(_0x75bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75bc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75bc('0x5'))(_0x75bc('0x6'));var config=require(_0x75bc('0x7'));var jayson=require(_0x75bc('0x8'));var client=jayson[_0x75bc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14ce46,_0x1152aa,_0x4c2a73){return new BPromise(function(_0x562f3f,_0x3a3941){return client[_0x75bc('0xa')](_0x14ce46,_0x4c2a73)[_0x75bc('0xb')](function(_0x303b6e){logger[_0x75bc('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1152aa,_0x75bc('0xd'));logger[_0x75bc('0xe')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x1152aa,_0x75bc('0xd'),JSON['stringify'](_0x303b6e));if(_0x303b6e[_0x75bc('0xf')]){if(_0x303b6e[_0x75bc('0xf')][_0x75bc('0x10')]===0x1f4){logger['error'](_0x75bc('0x11'),_0x1152aa,_0x303b6e[_0x75bc('0xf')][_0x75bc('0x12')]);return _0x3a3941(_0x303b6e['error'][_0x75bc('0x12')]);}logger['error'](_0x75bc('0x11'),_0x1152aa,_0x303b6e[_0x75bc('0xf')][_0x75bc('0x12')]);return _0x562f3f(_0x303b6e[_0x75bc('0xf')]['message']);}else{logger[_0x75bc('0xc')](_0x75bc('0x11'),_0x1152aa,_0x75bc('0xd'));_0x562f3f(_0x303b6e[_0x75bc('0x13')][_0x75bc('0x12')]);}})[_0x75bc('0x14')](function(_0x1f22f2){logger[_0x75bc('0xf')](_0x75bc('0x11'),_0x1152aa,_0x1f22f2);_0x3a3941(_0x1f22f2);});});} \ No newline at end of file +var _0x470e=['debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2c209d,_0x130f59){var _0x37b254=function(_0x167008){while(--_0x167008){_0x2c209d['push'](_0x2c209d['shift']());}};_0x37b254(++_0x130f59);}(_0x470e,0xc3));var _0xe470=function(_0x12c3d1,_0x3c6ae7){_0x12c3d1=_0x12c3d1-0x0;var _0x282840=_0x470e[_0x12c3d1];return _0x282840;};'use strict';var _=require(_0xe470('0x0'));var util=require(_0xe470('0x1'));var moment=require(_0xe470('0x2'));var BPromise=require(_0xe470('0x3'));var rs=require(_0xe470('0x4'));var fs=require('fs');var Redis=require(_0xe470('0x5'));var db=require(_0xe470('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe470('0x7'))(_0xe470('0x8'));var config=require(_0xe470('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe470('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19dfbd,_0x41b312,_0x2e72e2){return new BPromise(function(_0x3ff259,_0x158dfe){return client[_0xe470('0xb')](_0x19dfbd,_0x2e72e2)['then'](function(_0x3661f5){logger[_0xe470('0xc')](_0xe470('0xd'),_0x41b312,_0xe470('0xe'));logger[_0xe470('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x41b312,_0xe470('0xe'),JSON['stringify'](_0x3661f5));if(_0x3661f5['error']){if(_0x3661f5[_0xe470('0x10')][_0xe470('0x11')]===0x1f4){logger[_0xe470('0x10')](_0xe470('0xd'),_0x41b312,_0x3661f5[_0xe470('0x10')][_0xe470('0x12')]);return _0x158dfe(_0x3661f5[_0xe470('0x10')][_0xe470('0x12')]);}logger[_0xe470('0x10')]('AnalyticTreeReport,\x20%s,\x20%s',_0x41b312,_0x3661f5['error'][_0xe470('0x12')]);return _0x3ff259(_0x3661f5[_0xe470('0x10')][_0xe470('0x12')]);}else{logger[_0xe470('0xc')](_0xe470('0xd'),_0x41b312,'request\x20sent');_0x3ff259(_0x3661f5[_0xe470('0x13')][_0xe470('0x12')]);}})[_0xe470('0x14')](function(_0x4fa0bc){logger[_0xe470('0x10')](_0xe470('0xd'),_0x41b312,_0x4fa0bc);_0x158dfe(_0x4fa0bc);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index f9d58f3..792268f 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 _0xd824=['create','/:id','update','delete','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post'];(function(_0x59b2ea,_0x2aa714){var _0x39dc9d=function(_0x1c00f3){while(--_0x1c00f3){_0x59b2ea['push'](_0x59b2ea['shift']());}};_0x39dc9d(++_0x2aa714);}(_0xd824,0x1d5));var _0x4d82=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd824[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var path=require('path');var timeout=require(_0x4d82('0x2'));var express=require('express');var router=express[_0x4d82('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4d82('0x4'));var config=require(_0x4d82('0x5'));var controller=require('./analyticTreeReport.controller');router[_0x4d82('0x6')]('/',auth[_0x4d82('0x7')](),controller[_0x4d82('0x8')]);router[_0x4d82('0x6')]('/:id',auth[_0x4d82('0x7')](),controller[_0x4d82('0x9')]);router[_0x4d82('0xa')]('/',auth[_0x4d82('0x7')](),controller[_0x4d82('0xb')]);router['put'](_0x4d82('0xc'),auth[_0x4d82('0x7')](),controller[_0x4d82('0xd')]);router[_0x4d82('0xe')]('/:id',auth[_0x4d82('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x27bc=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','create','update','exports','path'];(function(_0x2d81de,_0x2ed903){var _0xe91fc1=function(_0x4ae7d0){while(--_0x4ae7d0){_0x2d81de['push'](_0x2d81de['shift']());}};_0xe91fc1(++_0x2ed903);}(_0x27bc,0x120));var _0xc27b=function(_0x5538c4,_0x38cd72){_0x5538c4=_0x5538c4-0x0;var _0x3223c6=_0x27bc[_0x5538c4];return _0x3223c6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc27b('0x0'));var timeout=require(_0xc27b('0x1'));var express=require(_0xc27b('0x2'));var router=express[_0xc27b('0x3')]();var auth=require(_0xc27b('0x4'));var interaction=require(_0xc27b('0x5'));var config=require(_0xc27b('0x6'));var controller=require(_0xc27b('0x7'));router[_0xc27b('0x8')]('/',auth['isAuthenticated'](),controller[_0xc27b('0x9')]);router[_0xc27b('0x8')](_0xc27b('0xa'),auth[_0xc27b('0xb')](),controller[_0xc27b('0xc')]);router[_0xc27b('0xd')]('/',auth['isAuthenticated'](),controller[_0xc27b('0xe')]);router['put'](_0xc27b('0xa'),auth[_0xc27b('0xb')](),controller[_0xc27b('0xf')]);router['delete'](_0xc27b('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc27b('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index c66ca17..d0a33bc 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 _0x2cae=['STRING','sequelize','exports'];(function(_0x275caa,_0x166d5e){var _0x28d670=function(_0x2a20e1){while(--_0x2a20e1){_0x275caa['push'](_0x275caa['shift']());}};_0x28d670(++_0x166d5e);}(_0x2cae,0x1cc));var _0xe2ca=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x2cae[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0xe2ca('0x0'));module[_0xe2ca('0x1')]={'name':{'type':Sequelize[_0xe2ca('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe2ca('0x2')]}}; \ No newline at end of file +var _0x8834=['exports','STRING'];(function(_0x34b35d,_0x53c19f){var _0x5ad57f=function(_0x55aa02){while(--_0x55aa02){_0x34b35d['push'](_0x34b35d['shift']());}};_0x5ad57f(++_0x53c19f);}(_0x8834,0x1ba));var _0x4883=function(_0x4adfb5,_0x50140c){_0x4adfb5=_0x4adfb5-0x0;var _0x1539f2=_0x8834[_0x4adfb5];return _0x1539f2;};'use strict';var Sequelize=require('sequelize');module[_0x4883('0x0')]={'name':{'type':Sequelize[_0x4883('0x1')]},'basename':{'type':Sequelize[_0x4883('0x1')]},'type':{'type':Sequelize[_0x4883('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 1a6bc48..1e8e254 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 _0xada2=['eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','Attachment','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','clone','omit','createdAt','updatedAt','body','destroy','originalname','basename','file','mimetype','download','findOne','join','root','server/files/attachments/','html-pdf'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xada2,0x13f));var _0x2ada=function(_0x4792eb,_0x1e1aca){_0x4792eb=_0x4792eb-0x0;var _0x25fb07=_0xada2[_0x4792eb];return _0x25fb07;};'use strict';var pdf=require(_0x2ada('0x0'));var emlformat=require(_0x2ada('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2ada('0x2'));var jsonpatch=require(_0x2ada('0x3'));var rp=require('request-promise');var moment=require(_0x2ada('0x4'));var BPromise=require(_0x2ada('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2ada('0x6'));var sox=require(_0x2ada('0x7'));var csv=require(_0x2ada('0x8'));var ejs=require(_0x2ada('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2ada('0xa'));var crypto=require(_0x2ada('0xb'));var jsforce=require(_0x2ada('0xc'));var deskjs=require(_0x2ada('0xd'));var toCsv=require(_0x2ada('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2ada('0xe'));var qs=require(_0x2ada('0xf'));var as=require(_0x2ada('0x10'));var hardwareService=require(_0x2ada('0x11'));var logger=require(_0x2ada('0x12'))('api');var utils=require(_0x2ada('0x13'));var config=require(_0x2ada('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d9f93,_0x282d67){_0x282d67=_0x282d67||0xcc;return function(_0x3ee064){if(_0x3ee064){return _0x4d9f93[_0x2ada('0x15')](_0x282d67);}return _0x4d9f93[_0x2ada('0x16')](_0x282d67)['end']();};}function respondWithResult(_0x3e556d,_0x279206){_0x279206=_0x279206||0xc8;return function(_0xa0908f){if(_0xa0908f){return _0x3e556d[_0x2ada('0x16')](_0x279206)[_0x2ada('0x17')](_0xa0908f);}};}function respondWithFilteredResult(_0x17bfb0,_0x106500){return function(_0x186e0c){if(_0x186e0c){var _0x1ebbc1=_0x186e0c[_0x2ada('0x18')],_0x3b70d7=_0x106500['offset'],_0x406568=_0x106500[_0x2ada('0x19')]+_0x106500[_0x2ada('0x1a')],_0x3ae66c;if(_0x406568>=_0x1ebbc1){_0x406568=_0x1ebbc1;_0x3ae66c=0xc8;}else{_0x3ae66c=0xce;}_0x17bfb0[_0x2ada('0x16')](_0x3ae66c);return _0x17bfb0['set'](_0x2ada('0x1b'),_0x3b70d7+'-'+_0x406568+'/'+_0x1ebbc1)[_0x2ada('0x17')](_0x186e0c);}return null;};}function patchUpdates(_0x1f569f){return function(_0x34d00c){try{jsonpatch[_0x2ada('0x1c')](_0x34d00c,_0x1f569f,!![]);}catch(_0x4e8eae){return BPromise['reject'](_0x4e8eae);}return _0x34d00c[_0x2ada('0x1d')]();};}function saveUpdates(_0x5aa851,_0x1c35fc){return function(_0x9f0080){if(_0x9f0080){return _0x9f0080[_0x2ada('0x1e')](_0x5aa851)['then'](function(_0x28f26e){return _0x28f26e;});}return null;};}function removeEntity(_0x4c5363,_0x5b677f){return function(_0x32aff1){if(_0x32aff1){return _0x32aff1['destroy']()[_0x2ada('0x1f')](function(){_0x4c5363[_0x2ada('0x16')](0xcc)[_0x2ada('0x20')]();});}};}function handleEntityNotFound(_0xdd7a0f,_0x21b4f9){return function(_0x2ec436){if(!_0x2ec436){_0xdd7a0f[_0x2ada('0x15')](0x194);}return _0x2ec436;};}function handleError(_0xcaf70a,_0x78b8b){_0x78b8b=_0x78b8b||0x1f4;return function(_0xe37e32){logger[_0x2ada('0x21')](_0xe37e32[_0x2ada('0x22')]);if(_0xe37e32[_0x2ada('0x23')]){delete _0xe37e32[_0x2ada('0x23')];}_0xcaf70a['status'](_0x78b8b)[_0x2ada('0x24')](_0xe37e32);};}exports[_0x2ada('0x25')]=function(_0x516c03,_0x2f56c7){var _0x1c3b34={},_0x284ff5={},_0x268d0f={'count':0x0,'rows':[]};var _0x229ba9=_[_0x2ada('0x26')](db[_0x2ada('0x27')][_0x2ada('0x28')],function(_0x499eee){return{'name':_0x499eee['fieldName'],'type':_0x499eee['type'][_0x2ada('0x29')]};});_0x284ff5[_0x2ada('0x2a')]=_[_0x2ada('0x26')](_0x229ba9,_0x2ada('0x23'));_0x284ff5[_0x2ada('0x2b')]=_[_0x2ada('0x2c')](_0x516c03['query']);_0x284ff5[_0x2ada('0x2d')]=_['intersection'](_0x284ff5[_0x2ada('0x2a')],_0x284ff5[_0x2ada('0x2b')]);_0x1c3b34[_0x2ada('0x2e')]=_[_0x2ada('0x2f')](_0x284ff5[_0x2ada('0x2a')],qs['fields'](_0x516c03[_0x2ada('0x2b')][_0x2ada('0x30')]));_0x1c3b34[_0x2ada('0x2e')]=_0x1c3b34[_0x2ada('0x2e')][_0x2ada('0x31')]?_0x1c3b34['attributes']:_0x284ff5['model'];if(!_0x516c03[_0x2ada('0x2b')]['hasOwnProperty'](_0x2ada('0x32'))){_0x1c3b34['limit']=qs[_0x2ada('0x1a')](_0x516c03[_0x2ada('0x2b')][_0x2ada('0x1a')]);_0x1c3b34[_0x2ada('0x19')]=qs[_0x2ada('0x19')](_0x516c03[_0x2ada('0x2b')]['offset']);}_0x1c3b34['order']=qs[_0x2ada('0x33')](_0x516c03[_0x2ada('0x2b')][_0x2ada('0x33')]);_0x1c3b34[_0x2ada('0x34')]=qs[_0x2ada('0x2d')](_['pick'](_0x516c03[_0x2ada('0x2b')],_0x284ff5['filters']),_0x229ba9);if(_0x516c03[_0x2ada('0x2b')][_0x2ada('0x35')]){_0x1c3b34[_0x2ada('0x34')]=_[_0x2ada('0x36')](_0x1c3b34[_0x2ada('0x34')],{'$or':_['map'](_0x229ba9,function(_0x311ea8){if(_0x311ea8[_0x2ada('0x37')]!==_0x2ada('0x38')){var _0x1b9796={};_0x1b9796[_0x311ea8['name']]={'$like':'%'+_0x516c03[_0x2ada('0x2b')][_0x2ada('0x35')]+'%'};return _0x1b9796;}})});}_0x1c3b34=_[_0x2ada('0x36')]({},_0x1c3b34,_0x516c03[_0x2ada('0x39')]);var _0x9950c9={'where':_0x1c3b34[_0x2ada('0x34')]};return db[_0x2ada('0x27')][_0x2ada('0x18')](_0x9950c9)[_0x2ada('0x1f')](function(_0x3e4070){_0x268d0f[_0x2ada('0x18')]=_0x3e4070;if(_0x516c03[_0x2ada('0x2b')][_0x2ada('0x3a')]){_0x1c3b34[_0x2ada('0x3b')]=[{'all':!![]}];}return db[_0x2ada('0x27')]['findAll'](_0x1c3b34);})[_0x2ada('0x1f')](function(_0x16ce59){_0x268d0f[_0x2ada('0x3c')]=_0x16ce59;return _0x268d0f;})[_0x2ada('0x1f')](respondWithFilteredResult(_0x2f56c7,_0x1c3b34))['catch'](handleError(_0x2f56c7,null));};exports[_0x2ada('0x3d')]=function(_0x4bb66b,_0x553f0d){var _0xb81430={'raw':!![],'where':{'id':_0x4bb66b[_0x2ada('0x3e')]['id']}},_0x259554={};_0x259554['model']=_[_0x2ada('0x2c')](db[_0x2ada('0x27')][_0x2ada('0x28')]);_0x259554['query']=_[_0x2ada('0x2c')](_0x4bb66b[_0x2ada('0x2b')]);_0x259554[_0x2ada('0x2d')]=_['intersection'](_0x259554[_0x2ada('0x2a')],_0x259554[_0x2ada('0x2b')]);_0xb81430['attributes']=_[_0x2ada('0x2f')](_0x259554[_0x2ada('0x2a')],qs[_0x2ada('0x30')](_0x4bb66b[_0x2ada('0x2b')][_0x2ada('0x30')]));_0xb81430['attributes']=_0xb81430[_0x2ada('0x2e')][_0x2ada('0x31')]?_0xb81430[_0x2ada('0x2e')]:_0x259554[_0x2ada('0x2a')];if(_0x4bb66b[_0x2ada('0x2b')][_0x2ada('0x3a')]){_0xb81430[_0x2ada('0x3b')]=[{'all':!![]}];}_0xb81430=_[_0x2ada('0x36')]({},_0xb81430,_0x4bb66b[_0x2ada('0x39')]);return db['Attachment'][_0x2ada('0x3f')](_0xb81430)['then'](handleEntityNotFound(_0x553f0d,null))[_0x2ada('0x1f')](respondWithResult(_0x553f0d,null))[_0x2ada('0x40')](handleError(_0x553f0d,null));};exports[_0x2ada('0x41')]=function(_0x3753a7,_0x3693f2){var _0x4d077d={'where':{'id':_0x3753a7[_0x2ada('0x3e')]['id']}},_0x22c56e={};_0x22c56e[_0x2ada('0x2a')]=_[_0x2ada('0x2c')](db[_0x2ada('0x27')][_0x2ada('0x28')]);_0x4d077d[_0x2ada('0x2e')]=_[_0x2ada('0x2f')](_0x22c56e[_0x2ada('0x2a')],qs[_0x2ada('0x30')](_0x3753a7[_0x2ada('0x2b')][_0x2ada('0x30')]));_0x4d077d[_0x2ada('0x2e')]=_0x4d077d[_0x2ada('0x2e')][_0x2ada('0x31')]?_0x4d077d['attributes']:_0x22c56e['model'];if(_0x3753a7[_0x2ada('0x2b')][_0x2ada('0x3a')]){_0x4d077d['include']=[{'all':!![]}];}_0x4d077d=_[_0x2ada('0x36')]({},_0x4d077d,_0x3753a7[_0x2ada('0x39')]);return db[_0x2ada('0x27')]['find'](_0x4d077d)[_0x2ada('0x1f')](handleEntityNotFound(_0x3693f2,null))['then'](function(_0x1024cb){if(_0x1024cb){var _0x5a7d14=_0x1024cb['get']({'plain':!![]});_0x5a7d14=qs[_0x2ada('0x42')](_0x5a7d14,['id',_0x2ada('0x43'),_0x2ada('0x44')]);_0x3753a7[_0x2ada('0x45')]=_[_0x2ada('0x42')](_0x3753a7[_0x2ada('0x45')],['id',_0x2ada('0x43'),_0x2ada('0x44')]);return db[_0x2ada('0x27')]['create'](_[_0x2ada('0x36')](_0x5a7d14,_0x3753a7[_0x2ada('0x45')]),{'include':_0x3753a7[_0x2ada('0x2b')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x2ada('0x1f')](respondWithResult(_0x3693f2,0xc9))['catch'](handleError(_0x3693f2,null));};exports[_0x2ada('0x1e')]=function(_0x56b536,_0x5e0cfc){if(_0x56b536['body']['id']){delete _0x56b536[_0x2ada('0x45')]['id'];}return db[_0x2ada('0x27')][_0x2ada('0x3f')]({'where':{'id':_0x56b536[_0x2ada('0x3e')]['id']}})[_0x2ada('0x1f')](handleEntityNotFound(_0x5e0cfc,null))[_0x2ada('0x1f')](saveUpdates(_0x56b536[_0x2ada('0x45')],null))['then'](respondWithResult(_0x5e0cfc,null))[_0x2ada('0x40')](handleError(_0x5e0cfc,null));};exports[_0x2ada('0x46')]=function(_0x4e8655,_0x1c7469){return db[_0x2ada('0x27')][_0x2ada('0x3f')]({'where':{'id':_0x4e8655['params']['id']}})[_0x2ada('0x1f')](handleEntityNotFound(_0x1c7469,null))[_0x2ada('0x1f')](removeEntity(_0x1c7469,null))[_0x2ada('0x40')](handleError(_0x1c7469,null));};exports['create']=function(_0x4d8bbf,_0x8465e7,_0x4ce802){_0x4d8bbf[_0x2ada('0x45')][_0x2ada('0x23')]=_0x4d8bbf['file'][_0x2ada('0x47')];_0x4d8bbf['body'][_0x2ada('0x48')]=_0x4d8bbf[_0x2ada('0x49')]['filename'];_0x4d8bbf[_0x2ada('0x45')][_0x2ada('0x37')]=_0x4d8bbf[_0x2ada('0x49')][_0x2ada('0x4a')];return db[_0x2ada('0x27')]['create'](_0x4d8bbf[_0x2ada('0x45')])[_0x2ada('0x1f')](respondWithResult(_0x8465e7,0xc9))[_0x2ada('0x40')](handleError(_0x8465e7,null));};exports[_0x2ada('0x4b')]=function(_0x1912c9,_0x1740a2,_0x1234f1){return db[_0x2ada('0x27')][_0x2ada('0x4c')]({'where':{'id':_0x1912c9[_0x2ada('0x3e')]['id']},'raw':!![]})[_0x2ada('0x1f')](handleEntityNotFound(_0x1740a2,null))[_0x2ada('0x1f')](function(_0x536c48){if(_0x536c48){return _0x1740a2[_0x2ada('0x4b')](path[_0x2ada('0x4d')](config[_0x2ada('0x4e')],_0x2ada('0x4f'),_0x536c48[_0x2ada('0x48')]));}})[_0x2ada('0x40')](handleError(_0x1740a2,null));}; \ No newline at end of file +var _0x51b5=['Attachment','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','mimetype','download','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','map'];(function(_0x3c15c2,_0x15110b){var _0x421658=function(_0x2e6723){while(--_0x2e6723){_0x3c15c2['push'](_0x3c15c2['shift']());}};_0x421658(++_0x15110b);}(_0x51b5,0x7f));var _0x551b=function(_0x3f1f5b,_0x4cccea){_0x3f1f5b=_0x3f1f5b-0x0;var _0x527a0c=_0x51b5[_0x3f1f5b];return _0x527a0c;};'use strict';var pdf=require(_0x551b('0x0'));var emlformat=require(_0x551b('0x1'));var rimraf=require(_0x551b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x551b('0x3'));var rp=require('request-promise');var moment=require(_0x551b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x551b('0x5'));var util=require(_0x551b('0x6'));var path=require(_0x551b('0x7'));var sox=require('sox');var csv=require(_0x551b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x551b('0x9'));var squel=require(_0x551b('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x551b('0xb'));var toCsv=require(_0x551b('0x8'));var querystring=require(_0x551b('0xc'));var Papa=require(_0x551b('0xd'));var Redis=require(_0x551b('0xe'));var authService=require(_0x551b('0xf'));var qs=require(_0x551b('0x10'));var as=require(_0x551b('0x11'));var hardwareService=require(_0x551b('0x12'));var logger=require(_0x551b('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b820f,_0x15cdea){_0x15cdea=_0x15cdea||0xcc;return function(_0x2138c2){if(_0x2138c2){return _0x3b820f[_0x551b('0x14')](_0x15cdea);}return _0x3b820f[_0x551b('0x15')](_0x15cdea)[_0x551b('0x16')]();};}function respondWithResult(_0x180f59,_0x1d331e){_0x1d331e=_0x1d331e||0xc8;return function(_0x4f85e7){if(_0x4f85e7){return _0x180f59[_0x551b('0x15')](_0x1d331e)[_0x551b('0x17')](_0x4f85e7);}};}function respondWithFilteredResult(_0xd800d4,_0x480a99){return function(_0x582d66){if(_0x582d66){var _0x5614e4=_0x582d66[_0x551b('0x18')],_0x3f7e39=_0x480a99['offset'],_0x3a9e0c=_0x480a99[_0x551b('0x19')]+_0x480a99[_0x551b('0x1a')],_0x1fa59f;if(_0x3a9e0c>=_0x5614e4){_0x3a9e0c=_0x5614e4;_0x1fa59f=0xc8;}else{_0x1fa59f=0xce;}_0xd800d4['status'](_0x1fa59f);return _0xd800d4[_0x551b('0x1b')]('Content-Range',_0x3f7e39+'-'+_0x3a9e0c+'/'+_0x5614e4)[_0x551b('0x17')](_0x582d66);}return null;};}function patchUpdates(_0x3437b8){return function(_0x400a84){try{jsonpatch[_0x551b('0x1c')](_0x400a84,_0x3437b8,!![]);}catch(_0x42ca1b){return BPromise[_0x551b('0x1d')](_0x42ca1b);}return _0x400a84['save']();};}function saveUpdates(_0x3a84b7,_0x20053a){return function(_0x3d4021){if(_0x3d4021){return _0x3d4021[_0x551b('0x1e')](_0x3a84b7)[_0x551b('0x1f')](function(_0x461f1e){return _0x461f1e;});}return null;};}function removeEntity(_0x5f0123,_0x2ab789){return function(_0x1bfe73){if(_0x1bfe73){return _0x1bfe73[_0x551b('0x20')]()[_0x551b('0x1f')](function(){_0x5f0123[_0x551b('0x15')](0xcc)[_0x551b('0x16')]();});}};}function handleEntityNotFound(_0x3c9c8e,_0xe4622a){return function(_0x540a51){if(!_0x540a51){_0x3c9c8e[_0x551b('0x14')](0x194);}return _0x540a51;};}function handleError(_0x39c5a3,_0x1129db){_0x1129db=_0x1129db||0x1f4;return function(_0x34f451){logger[_0x551b('0x21')](_0x34f451[_0x551b('0x22')]);if(_0x34f451[_0x551b('0x23')]){delete _0x34f451[_0x551b('0x23')];}_0x39c5a3['status'](_0x1129db)[_0x551b('0x24')](_0x34f451);};}exports[_0x551b('0x25')]=function(_0x2219cb,_0x2602b0){var _0x451382={},_0x3fe140={},_0x5dd2d6={'count':0x0,'rows':[]};var _0xd7db16=_[_0x551b('0x26')](db[_0x551b('0x27')][_0x551b('0x28')],function(_0x1e6797){return{'name':_0x1e6797[_0x551b('0x29')],'type':_0x1e6797[_0x551b('0x2a')][_0x551b('0x2b')]};});_0x3fe140['model']=_['map'](_0xd7db16,_0x551b('0x23'));_0x3fe140[_0x551b('0x2c')]=_[_0x551b('0x2d')](_0x2219cb[_0x551b('0x2c')]);_0x3fe140[_0x551b('0x2e')]=_[_0x551b('0x2f')](_0x3fe140[_0x551b('0x30')],_0x3fe140[_0x551b('0x2c')]);_0x451382[_0x551b('0x31')]=_['intersection'](_0x3fe140[_0x551b('0x30')],qs[_0x551b('0x32')](_0x2219cb[_0x551b('0x2c')][_0x551b('0x32')]));_0x451382[_0x551b('0x31')]=_0x451382['attributes']['length']?_0x451382[_0x551b('0x31')]:_0x3fe140[_0x551b('0x30')];if(!_0x2219cb[_0x551b('0x2c')][_0x551b('0x33')](_0x551b('0x34'))){_0x451382['limit']=qs['limit'](_0x2219cb[_0x551b('0x2c')][_0x551b('0x1a')]);_0x451382[_0x551b('0x19')]=qs[_0x551b('0x19')](_0x2219cb[_0x551b('0x2c')]['offset']);}_0x451382[_0x551b('0x35')]=qs[_0x551b('0x36')](_0x2219cb[_0x551b('0x2c')][_0x551b('0x36')]);_0x451382[_0x551b('0x37')]=qs[_0x551b('0x2e')](_[_0x551b('0x38')](_0x2219cb['query'],_0x3fe140[_0x551b('0x2e')]),_0xd7db16);if(_0x2219cb['query']['filter']){_0x451382[_0x551b('0x37')]=_[_0x551b('0x39')](_0x451382[_0x551b('0x37')],{'$or':_['map'](_0xd7db16,function(_0x391d0c){if(_0x391d0c[_0x551b('0x2a')]!=='VIRTUAL'){var _0x46cebd={};_0x46cebd[_0x391d0c[_0x551b('0x23')]]={'$like':'%'+_0x2219cb[_0x551b('0x2c')][_0x551b('0x3a')]+'%'};return _0x46cebd;}})});}_0x451382=_['merge']({},_0x451382,_0x2219cb[_0x551b('0x3b')]);var _0x3474fd={'where':_0x451382['where']};return db[_0x551b('0x27')]['count'](_0x3474fd)[_0x551b('0x1f')](function(_0x1a73ee){_0x5dd2d6[_0x551b('0x18')]=_0x1a73ee;if(_0x2219cb['query'][_0x551b('0x3c')]){_0x451382[_0x551b('0x3d')]=[{'all':!![]}];}return db['Attachment'][_0x551b('0x3e')](_0x451382);})[_0x551b('0x1f')](function(_0x490d2d){_0x5dd2d6[_0x551b('0x3f')]=_0x490d2d;return _0x5dd2d6;})[_0x551b('0x1f')](respondWithFilteredResult(_0x2602b0,_0x451382))[_0x551b('0x40')](handleError(_0x2602b0,null));};exports[_0x551b('0x41')]=function(_0x2f395e,_0x5188de){var _0x5c2427={'raw':!![],'where':{'id':_0x2f395e[_0x551b('0x42')]['id']}},_0x286e62={};_0x286e62['model']=_['keys'](db['Attachment']['rawAttributes']);_0x286e62[_0x551b('0x2c')]=_[_0x551b('0x2d')](_0x2f395e[_0x551b('0x2c')]);_0x286e62[_0x551b('0x2e')]=_['intersection'](_0x286e62[_0x551b('0x30')],_0x286e62[_0x551b('0x2c')]);_0x5c2427[_0x551b('0x31')]=_[_0x551b('0x2f')](_0x286e62[_0x551b('0x30')],qs[_0x551b('0x32')](_0x2f395e['query']['fields']));_0x5c2427['attributes']=_0x5c2427[_0x551b('0x31')][_0x551b('0x43')]?_0x5c2427['attributes']:_0x286e62['model'];if(_0x2f395e[_0x551b('0x2c')][_0x551b('0x3c')]){_0x5c2427[_0x551b('0x3d')]=[{'all':!![]}];}_0x5c2427=_[_0x551b('0x39')]({},_0x5c2427,_0x2f395e[_0x551b('0x3b')]);return db[_0x551b('0x27')][_0x551b('0x44')](_0x5c2427)[_0x551b('0x1f')](handleEntityNotFound(_0x5188de,null))[_0x551b('0x1f')](respondWithResult(_0x5188de,null))[_0x551b('0x40')](handleError(_0x5188de,null));};exports['clone']=function(_0x21c092,_0x384ee6){var _0x2471c1={'where':{'id':_0x21c092[_0x551b('0x42')]['id']}},_0x35cbfc={};_0x35cbfc[_0x551b('0x30')]=_['keys'](db['Attachment'][_0x551b('0x28')]);_0x2471c1['attributes']=_[_0x551b('0x2f')](_0x35cbfc['model'],qs['fields'](_0x21c092[_0x551b('0x2c')][_0x551b('0x32')]));_0x2471c1[_0x551b('0x31')]=_0x2471c1[_0x551b('0x31')][_0x551b('0x43')]?_0x2471c1[_0x551b('0x31')]:_0x35cbfc[_0x551b('0x30')];if(_0x21c092[_0x551b('0x2c')]['includeAll']){_0x2471c1[_0x551b('0x3d')]=[{'all':!![]}];}_0x2471c1=_[_0x551b('0x39')]({},_0x2471c1,_0x21c092[_0x551b('0x3b')]);return db['Attachment']['find'](_0x2471c1)[_0x551b('0x1f')](handleEntityNotFound(_0x384ee6,null))[_0x551b('0x1f')](function(_0x45c8ce){if(_0x45c8ce){var _0x3c5438=_0x45c8ce[_0x551b('0x45')]({'plain':!![]});_0x3c5438=qs[_0x551b('0x46')](_0x3c5438,['id',_0x551b('0x47'),_0x551b('0x48')]);_0x21c092['body']=_[_0x551b('0x46')](_0x21c092[_0x551b('0x49')],['id','createdAt',_0x551b('0x48')]);return db['Attachment']['create'](_[_0x551b('0x39')](_0x3c5438,_0x21c092[_0x551b('0x49')]),{'include':_0x21c092[_0x551b('0x2c')][_0x551b('0x3c')]?[{'all':!![]}]:undefined});}})[_0x551b('0x1f')](respondWithResult(_0x384ee6,0xc9))[_0x551b('0x40')](handleError(_0x384ee6,null));};exports['update']=function(_0x5c81ce,_0x49d549){if(_0x5c81ce[_0x551b('0x49')]['id']){delete _0x5c81ce['body']['id'];}return db[_0x551b('0x27')][_0x551b('0x44')]({'where':{'id':_0x5c81ce[_0x551b('0x42')]['id']}})[_0x551b('0x1f')](handleEntityNotFound(_0x49d549,null))['then'](saveUpdates(_0x5c81ce[_0x551b('0x49')],null))[_0x551b('0x1f')](respondWithResult(_0x49d549,null))[_0x551b('0x40')](handleError(_0x49d549,null));};exports[_0x551b('0x20')]=function(_0x9b18af,_0x2aacbd){return db[_0x551b('0x27')]['find']({'where':{'id':_0x9b18af[_0x551b('0x42')]['id']}})[_0x551b('0x1f')](handleEntityNotFound(_0x2aacbd,null))[_0x551b('0x1f')](removeEntity(_0x2aacbd,null))[_0x551b('0x40')](handleError(_0x2aacbd,null));};exports[_0x551b('0x4a')]=function(_0x3a7ab0,_0x1a9f6c,_0x3f9dc8){_0x3a7ab0[_0x551b('0x49')][_0x551b('0x23')]=_0x3a7ab0[_0x551b('0x4b')][_0x551b('0x4c')];_0x3a7ab0[_0x551b('0x49')][_0x551b('0x4d')]=_0x3a7ab0[_0x551b('0x4b')]['filename'];_0x3a7ab0[_0x551b('0x49')][_0x551b('0x2a')]=_0x3a7ab0[_0x551b('0x4b')][_0x551b('0x4e')];return db[_0x551b('0x27')][_0x551b('0x4a')](_0x3a7ab0['body'])[_0x551b('0x1f')](respondWithResult(_0x1a9f6c,0xc9))[_0x551b('0x40')](handleError(_0x1a9f6c,null));};exports[_0x551b('0x4f')]=function(_0x4a688a,_0x3021e6,_0x1e3c18){return db[_0x551b('0x27')]['findOne']({'where':{'id':_0x4a688a[_0x551b('0x42')]['id']},'raw':!![]})[_0x551b('0x1f')](handleEntityNotFound(_0x3021e6,null))[_0x551b('0x1f')](function(_0x53842e){if(_0x53842e){return _0x3021e6[_0x551b('0x4f')](path[_0x551b('0x50')](config[_0x551b('0x51')],_0x551b('0x52'),_0x53842e[_0x551b('0x4d')]));}})[_0x551b('0x40')](handleError(_0x3021e6,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 34c11e1..6da4ef4 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 _0xcb91=['rimraf','./attachment.attributes','exports','define','attachments','../../config/logger','api','moment','bluebird','path'];(function(_0x28e30b,_0x539e98){var _0x1a3730=function(_0x183804){while(--_0x183804){_0x28e30b['push'](_0x28e30b['shift']());}};_0x1a3730(++_0x539e98);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x44fef1,_0x132cf4){_0x44fef1=_0x44fef1-0x0;var _0x3c3a04=_0xcb91[_0x44fef1];return _0x3c3a04;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('Attachment',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa37e=['moment','bluebird','path','../../config/environment','./attachment.attributes','exports','define','../../config/logger','api'];(function(_0x4065ee,_0xdb79dd){var _0xc78991=function(_0x1192dc){while(--_0x1192dc){_0x4065ee['push'](_0x4065ee['shift']());}};_0xc78991(++_0xdb79dd);}(_0xa37e,0x97));var _0xea37=function(_0x125e95,_0x134374){_0x125e95=_0x125e95-0x0;var _0x3799bc=_0xa37e[_0x125e95];return _0x3799bc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea37('0x0'))(_0xea37('0x1'));var moment=require(_0xea37('0x2'));var BPromise=require(_0xea37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea37('0x4'));var rimraf=require('rimraf');var config=require(_0xea37('0x5'));var attributes=require(_0xea37('0x6'));module[_0xea37('0x7')]=function(_0x4d380b,_0x57135b){return _0x4d380b[_0xea37('0x8')]('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 272a74f..36cf7b5 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 _0xb910=['lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Attachment,\x20%s,\x20%s','message','result','CreateAttachment','create','options','raw','catch'];(function(_0x1b4c8a,_0x178ad7){var _0x49802e=function(_0x5b721a){while(--_0x5b721a){_0x1b4c8a['push'](_0x1b4c8a['shift']());}};_0x49802e(++_0x178ad7);}(_0xb910,0xb6));var _0x0b91=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xb910[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0x0b91('0x0'));var util=require(_0x0b91('0x1'));var moment=require(_0x0b91('0x2'));var BPromise=require('bluebird');var rs=require(_0x0b91('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b91('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b91('0x5'))(_0x0b91('0x6'));var config=require(_0x0b91('0x7'));var jayson=require(_0x0b91('0x8'));var client=jayson[_0x0b91('0x9')][_0x0b91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28d08f,_0x4b75cb,_0x132043){return new BPromise(function(_0x47f5bf,_0x21aeb1){return client['request'](_0x28d08f,_0x132043)[_0x0b91('0xb')](function(_0xcf1691){logger[_0x0b91('0xc')]('Attachment,\x20%s,\x20%s',_0x4b75cb,'request\x20sent');logger[_0x0b91('0xd')](_0x0b91('0xe'),_0x4b75cb,_0x0b91('0xf'),JSON[_0x0b91('0x10')](_0xcf1691));if(_0xcf1691['error']){if(_0xcf1691[_0x0b91('0x11')]['code']===0x1f4){logger['error'](_0x0b91('0x12'),_0x4b75cb,_0xcf1691[_0x0b91('0x11')][_0x0b91('0x13')]);return _0x21aeb1(_0xcf1691['error'][_0x0b91('0x13')]);}logger[_0x0b91('0x11')]('Attachment,\x20%s,\x20%s',_0x4b75cb,_0xcf1691[_0x0b91('0x11')][_0x0b91('0x13')]);return _0x47f5bf(_0xcf1691['error']['message']);}else{logger['info'](_0x0b91('0x12'),_0x4b75cb,_0x0b91('0xf'));_0x47f5bf(_0xcf1691[_0x0b91('0x14')]['message']);}})['catch'](function(_0x1f1ba6){logger['error'](_0x0b91('0x12'),_0x4b75cb,_0x1f1ba6);_0x21aeb1(_0x1f1ba6);});});}exports[_0x0b91('0x15')]=function(_0x51b10a){var _0x35389b=this;return new Promise(function(_0x13649c,_0x2664bb){return db['Attachment'][_0x0b91('0x16')](_0x51b10a['body'],{'raw':_0x51b10a[_0x0b91('0x17')]?_0x51b10a[_0x0b91('0x17')][_0x0b91('0x18')]===undefined?!![]:![]:!![]})[_0x0b91('0xb')](function(_0x7f6f23){logger[_0x0b91('0xc')](_0x0b91('0x15'),_0x51b10a);logger[_0x0b91('0xd')](_0x0b91('0x15'),_0x51b10a,JSON[_0x0b91('0x10')](_0x7f6f23));_0x13649c(_0x7f6f23);})[_0x0b91('0x19')](function(_0x3aac98){logger[_0x0b91('0x11')](_0x0b91('0x15'),_0x3aac98[_0x0b91('0x13')],_0x51b10a);_0x2664bb(_0x35389b[_0x0b91('0x11')](0x1f4,_0x3aac98[_0x0b91('0x13')]));});});}; \ No newline at end of file +var _0xc1bc=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','catch','create','body','options','raw','info','CreateAttachment','lodash','util','moment'];(function(_0x3f1e0e,_0x3bcb1e){var _0x56293b=function(_0x1d8259){while(--_0x1d8259){_0x3f1e0e['push'](_0x3f1e0e['shift']());}};_0x56293b(++_0x3bcb1e);}(_0xc1bc,0x1ad));var _0xcc1b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc1bc[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xcc1b('0x0'));var util=require(_0xcc1b('0x1'));var moment=require(_0xcc1b('0x2'));var BPromise=require(_0xcc1b('0x3'));var rs=require(_0xcc1b('0x4'));var fs=require('fs');var Redis=require(_0xcc1b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc1b('0x6'));var logger=require(_0xcc1b('0x7'))(_0xcc1b('0x8'));var config=require(_0xcc1b('0x9'));var jayson=require(_0xcc1b('0xa'));var client=jayson['client'][_0xcc1b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c747d,_0x5dbbf9,_0x307809){return new BPromise(function(_0x39cddd,_0x16d299){return client['request'](_0x3c747d,_0x307809)[_0xcc1b('0xc')](function(_0x6ba507){logger['info'](_0xcc1b('0xd'),_0x5dbbf9,_0xcc1b('0xe'));logger[_0xcc1b('0xf')](_0xcc1b('0x10'),_0x5dbbf9,_0xcc1b('0xe'),JSON['stringify'](_0x6ba507));if(_0x6ba507['error']){if(_0x6ba507[_0xcc1b('0x11')][_0xcc1b('0x12')]===0x1f4){logger[_0xcc1b('0x11')](_0xcc1b('0xd'),_0x5dbbf9,_0x6ba507[_0xcc1b('0x11')][_0xcc1b('0x13')]);return _0x16d299(_0x6ba507[_0xcc1b('0x11')][_0xcc1b('0x13')]);}logger[_0xcc1b('0x11')](_0xcc1b('0xd'),_0x5dbbf9,_0x6ba507[_0xcc1b('0x11')][_0xcc1b('0x13')]);return _0x39cddd(_0x6ba507['error'][_0xcc1b('0x13')]);}else{logger['info'](_0xcc1b('0xd'),_0x5dbbf9,_0xcc1b('0xe'));_0x39cddd(_0x6ba507['result'][_0xcc1b('0x13')]);}})[_0xcc1b('0x14')](function(_0x4d667e){logger[_0xcc1b('0x11')]('Attachment,\x20%s,\x20%s',_0x5dbbf9,_0x4d667e);_0x16d299(_0x4d667e);});});}exports['CreateAttachment']=function(_0x3f1a69){var _0x8adbbf=this;return new Promise(function(_0x369cdb,_0x2f09b5){return db['Attachment'][_0xcc1b('0x15')](_0x3f1a69[_0xcc1b('0x16')],{'raw':_0x3f1a69[_0xcc1b('0x17')]?_0x3f1a69[_0xcc1b('0x17')][_0xcc1b('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x7d6906){logger[_0xcc1b('0x19')](_0xcc1b('0x1a'),_0x3f1a69);logger[_0xcc1b('0xf')](_0xcc1b('0x1a'),_0x3f1a69,JSON['stringify'](_0x7d6906));_0x369cdb(_0x7d6906);})[_0xcc1b('0x14')](function(_0x3cbca4){logger['error']('CreateAttachment',_0x3cbca4['message'],_0x3f1a69);_0x2f09b5(_0x8adbbf[_0xcc1b('0x11')](0x1f4,_0x3cbca4[_0xcc1b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 5b0dbfd..a4895c7 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 _0x887b=['format','%s-%s','now','originalname','post','single','file','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','/:id/download','clone','join','root','server/files/attachments/'];(function(_0x3f5dc8,_0x277a72){var _0x29fb58=function(_0x410ec1){while(--_0x410ec1){_0x3f5dc8['push'](_0x3f5dc8['shift']());}};_0x29fb58(++_0x277a72);}(_0x887b,0x185));var _0xb887=function(_0x41cf86,_0x22540d){_0x41cf86=_0x41cf86-0x0;var _0x28544c=_0x887b[_0x41cf86];return _0x28544c;};'use strict';var multer=require(_0xb887('0x0'));var util=require(_0xb887('0x1'));var path=require(_0xb887('0x2'));var timeout=require(_0xb887('0x3'));var express=require(_0xb887('0x4'));var router=express[_0xb887('0x5')]();var auth=require(_0xb887('0x6'));var interaction=require(_0xb887('0x7'));var config=require(_0xb887('0x8'));var controller=require('./attachment.controller');router[_0xb887('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb887('0xa'),auth[_0xb887('0xb')](),controller['show']);router['get'](_0xb887('0xc'),auth[_0xb887('0xb')](),controller['download']);router['post']('/:id/clone',auth[_0xb887('0xb')](),controller[_0xb887('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ec74a,_0x4dbf12,_0x46fe4e){_0x46fe4e(null,path[_0xb887('0xe')](config[_0xb887('0xf')],_0xb887('0x10')));},'filename':function(_0x4a028f,_0x582f11,_0x2380d2){_0x2380d2(null,util[_0xb887('0x11')](_0xb887('0x12'),Date[_0xb887('0x13')](),_0x582f11[_0xb887('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb887('0x15')]('/',upload[_0xb887('0x16')](_0xb887('0x17')),controller[_0xb887('0x18')]);router[_0xb887('0x19')](_0xb887('0xa'),auth[_0xb887('0xb')](),controller[_0xb887('0x1a')]);router[_0xb887('0x1b')](_0xb887('0xa'),auth[_0xb887('0xb')](),controller[_0xb887('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x7d25=['%s-%s','now','originalname','replace','create','put','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','index','/:id','isAuthenticated','show','post','/:id/clone','diskStorage','join','root','server/files/attachments/','format'];(function(_0x11dfbb,_0x1f4c8a){var _0x22d016=function(_0x38285c){while(--_0x38285c){_0x11dfbb['push'](_0x11dfbb['shift']());}};_0x22d016(++_0x1f4c8a);}(_0x7d25,0x8a));var _0x57d2=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x7d25[_0x4dc7b9];return _0x3ab114;};'use strict';var multer=require('multer');var util=require(_0x57d2('0x0'));var path=require(_0x57d2('0x1'));var timeout=require(_0x57d2('0x2'));var express=require(_0x57d2('0x3'));var router=express[_0x57d2('0x4')]();var auth=require(_0x57d2('0x5'));var interaction=require(_0x57d2('0x6'));var config=require('../../config/environment');var controller=require('./attachment.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x57d2('0x7')]);router['get'](_0x57d2('0x8'),auth[_0x57d2('0x9')](),controller[_0x57d2('0xa')]);router['get']('/:id/download',auth[_0x57d2('0x9')](),controller['download']);router[_0x57d2('0xb')](_0x57d2('0xc'),auth[_0x57d2('0x9')](),controller['clone']);var upload=multer({'storage':multer[_0x57d2('0xd')]({'destination':function(_0x1a86db,_0x1fa168,_0x3a53a1){_0x3a53a1(null,path[_0x57d2('0xe')](config[_0x57d2('0xf')],_0x57d2('0x10')));},'filename':function(_0x197426,_0x43d7fb,_0x32c33a){_0x32c33a(null,util[_0x57d2('0x11')](_0x57d2('0x12'),Date[_0x57d2('0x13')](),_0x43d7fb[_0x57d2('0x14')][_0x57d2('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x57d2('0xb')]('/',upload['single']('file'),controller[_0x57d2('0x16')]);router[_0x57d2('0x17')]('/:id',auth[_0x57d2('0x9')](),controller[_0x57d2('0x18')]);router['delete'](_0x57d2('0x8'),auth['isAuthenticated'](),controller[_0x57d2('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index b95486d..558d6ce 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 _0xd321=['email','callback','authenticate','clientID','clientSecret','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','user','agent','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport-google-oauth20','../../mysqldb','signToken','../../config/utils','google','/login'];(function(_0x41877d,_0x19b756){var _0x4f4f49=function(_0x1a17c3){while(--_0x1a17c3){_0x41877d['push'](_0x41877d['shift']());}};_0x4f4f49(++_0x19b756);}(_0xd321,0x107));var _0x1d32=function(_0x2ff3c9,_0x2f48de){_0x2ff3c9=_0x2ff3c9-0x0;var _0x233582=_0xd321[_0x2ff3c9];return _0x233582;};'use strict';var _=require(_0x1d32('0x0'));var passport=require('passport');var GoogleStrategy=require(_0x1d32('0x1'))['Strategy'];var moment=require('moment');var db=require(_0x1d32('0x2'))['db'];var config=require('../../config/environment');var signToken=require('../../components/auth/service')[_0x1d32('0x3')];var utils=require(_0x1d32('0x4'));exports['login']=passport['authenticate'](_0x1d32('0x5'),{'failureRedirect':_0x1d32('0x6'),'scope':['profile',_0x1d32('0x7')],'session':![]});exports[_0x1d32('0x8')]=passport[_0x1d32('0x9')](_0x1d32('0x5'),{'failureRedirect':_0x1d32('0x6'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config['google']?config[_0x1d32('0x5')][_0x1d32('0xa')]:'id','clientSecret':config['google']?config[_0x1d32('0x5')][_0x1d32('0xb')]:_0x1d32('0xc'),'callbackURL':config[_0x1d32('0x5')]?config[_0x1d32('0x5')][_0x1d32('0xd')]:''},function(_0x124b40,_0x140a51,_0x46734e,_0x2d42b9){var _0x43404b,_0x4e4cf3;return db['Setting'][_0x1d32('0xe')]({'where':{'id':0x1},'attributes':[_0x1d32('0xf'),_0x1d32('0x10')],'raw':!![]})[_0x1d32('0x11')](function(_0x4f7191){_0x43404b=_0x4f7191;return db[_0x1d32('0x12')][_0x1d32('0x13')]({'where':{'email':_[_0x1d32('0x14')](_0x46734e['emails'],_0x1d32('0x15')),'role':{'$or':['admin',_0x1d32('0x16'),_0x1d32('0x17')]}}});})[_0x1d32('0x11')](function(_0x1edd9e){_0x4e4cf3=_0x1edd9e;if(_0x4e4cf3){if(_0x4e4cf3['disabled']){return _0x2d42b9('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x43404b[_0x1d32('0x10')]>0x0){if(_0x4e4cf3['blocked']){if(moment(_0x4e4cf3['blockedAt'])[_0x1d32('0x18')](_0x43404b['blockDuration'],_0x1d32('0x19'))>moment()){return _0x2d42b9(_0x1d32('0x1a'));}else{return utils[_0x1d32('0x1b')](_0x4e4cf3,0x0,![],null)[_0x1d32('0x11')](function(){return utils[_0x1d32('0x1c')](_0x4e4cf3);})[_0x1d32('0x11')](function(){return _0x2d42b9(null,_0x4e4cf3);});}}else{return utils[_0x1d32('0x1c')](_0x4e4cf3)[_0x1d32('0x11')](function(){return _0x2d42b9(null,_0x4e4cf3);});}}else{return utils[_0x1d32('0x1c')](_0x4e4cf3)[_0x1d32('0x11')](function(){return _0x2d42b9(null,_0x4e4cf3);});}}return _0x2d42b9('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x1d32('0x1d')](function(_0x438a13){_0x2d42b9(_0x438a13);});})); \ No newline at end of file +var _0x62da=['disabled','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','lodash','passport','passport-google-oauth20','moment','../../config/utils','google','/login','profile','email','callback','authenticate','use','clientSecret','secret','Setting','allowedLoginAttempts','blockDuration','then','User','find','map','emails','value','admin','user'];(function(_0x2eb898,_0x43c47b){var _0x58974f=function(_0x5cdc1){while(--_0x5cdc1){_0x2eb898['push'](_0x2eb898['shift']());}};_0x58974f(++_0x43c47b);}(_0x62da,0x131));var _0xa62d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x62da[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa62d('0x0'));var passport=require(_0xa62d('0x1'));var GoogleStrategy=require(_0xa62d('0x2'))['Strategy'];var moment=require(_0xa62d('0x3'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var signToken=require('../../components/auth/service')['signToken'];var utils=require(_0xa62d('0x4'));exports['login']=passport['authenticate'](_0xa62d('0x5'),{'failureRedirect':_0xa62d('0x6'),'scope':[_0xa62d('0x7'),_0xa62d('0x8')],'session':![]});exports[_0xa62d('0x9')]=passport[_0xa62d('0xa')](_0xa62d('0x5'),{'failureRedirect':_0xa62d('0x6'),'session':![]});passport[_0xa62d('0xb')](new GoogleStrategy({'clientID':config[_0xa62d('0x5')]?config['google']['clientID']:'id','clientSecret':config['google']?config['google'][_0xa62d('0xc')]:_0xa62d('0xd'),'callbackURL':config[_0xa62d('0x5')]?config[_0xa62d('0x5')]['callbackURL']:''},function(_0x2a8927,_0x2945fc,_0xbb6b1c,_0x72d2ff){var _0x958704,_0x5b0b8d;return db[_0xa62d('0xe')]['findOne']({'where':{'id':0x1},'attributes':[_0xa62d('0xf'),_0xa62d('0x10')],'raw':!![]})[_0xa62d('0x11')](function(_0x38aad8){_0x958704=_0x38aad8;return db[_0xa62d('0x12')][_0xa62d('0x13')]({'where':{'email':_[_0xa62d('0x14')](_0xbb6b1c[_0xa62d('0x15')],_0xa62d('0x16')),'role':{'$or':[_0xa62d('0x17'),_0xa62d('0x18'),'agent']}}});})['then'](function(_0x90a801){_0x5b0b8d=_0x90a801;if(_0x5b0b8d){if(_0x5b0b8d[_0xa62d('0x19')]){return _0x72d2ff('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x958704[_0xa62d('0x10')]>0x0){if(_0x5b0b8d[_0xa62d('0x1a')]){if(moment(_0x5b0b8d[_0xa62d('0x1b')])[_0xa62d('0x1c')](_0x958704[_0xa62d('0x10')],_0xa62d('0x1d'))>moment()){return _0x72d2ff('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0xa62d('0x1e')](_0x5b0b8d,0x0,![],null)[_0xa62d('0x11')](function(){return utils[_0xa62d('0x1f')](_0x5b0b8d);})['then'](function(){return _0x72d2ff(null,_0x5b0b8d);});}}else{return utils[_0xa62d('0x1f')](_0x5b0b8d)[_0xa62d('0x11')](function(){return _0x72d2ff(null,_0x5b0b8d);});}}else{return utils['getLicense'](_0x5b0b8d)[_0xa62d('0x11')](function(){return _0x72d2ff(null,_0x5b0b8d);});}}return _0x72d2ff(_0xa62d('0x20'));})['catch'](function(_0x15666b){_0x72d2ff(_0x15666b);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 234f33a..379c589 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 _0xdeb7=['Router','../user/user.controller.js','../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie','exports','express','passport'];(function(_0x57cb81,_0x16d6a6){var _0x26f5e9=function(_0x20e84f){while(--_0x20e84f){_0x57cb81['push'](_0x57cb81['shift']());}};_0x26f5e9(++_0x16d6a6);}(_0xdeb7,0x77));var _0x7deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb7[_0x2641f9];return _0x585741;};'use strict';var express=require(_0x7deb('0x0'));var passport=require(_0x7deb('0x1'));var router=express[_0x7deb('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x7deb('0x3'));var authService=require(_0x7deb('0x4'));router[_0x7deb('0x5')]('/',controller[_0x7deb('0x6')]);router[_0x7deb('0x5')]('/callback',controller[_0x7deb('0x7')],authService[_0x7deb('0x8')],userController[_0x7deb('0x6')],authService[_0x7deb('0x9')]);module[_0x7deb('0xa')]=router; \ No newline at end of file +var _0x777f=['get','login','/callback','callback','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service'];(function(_0x1b931b,_0x4b260a){var _0x448a2b=function(_0x38573a){while(--_0x38573a){_0x1b931b['push'](_0x1b931b['shift']());}};_0x448a2b(++_0x4b260a);}(_0x777f,0x9f));var _0xf777=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x777f[_0x31b5b2];return _0x364f13;};'use strict';var express=require(_0xf777('0x0'));var passport=require(_0xf777('0x1'));var router=express[_0xf777('0x2')]();var controller=require(_0xf777('0x3'));var userController=require(_0xf777('0x4'));var authService=require(_0xf777('0x5'));router[_0xf777('0x6')]('/',controller[_0xf777('0x7')]);router['get'](_0xf777('0x8'),controller[_0xf777('0x9')],authService['isMiddleware'],userController['login'],authService['setTokenCookie']);module[_0xf777('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index a2a2844..c315892 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 _0xc298=['host','port','secure','authentication','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','error','status','send','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','save','Password\x20reset!','use','util','passport','passport-local','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','blocked','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','disabled','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','service'];(function(_0x4864ea,_0x7764ed){var _0x12e74f=function(_0x3fe41d){while(--_0x3fe41d){_0x4864ea['push'](_0x4864ea['shift']());}};_0x12e74f(++_0x7764ed);}(_0xc298,0x85));var _0x8c29=function(_0x2063bc,_0x1aa93b){_0x2063bc=_0x2063bc-0x0;var _0x2b352b=_0xc298[_0x2063bc];return _0x2b352b;};'use strict';var util=require(_0x8c29('0x0'));var passport=require(_0x8c29('0x1'));var LocalStrategy=require(_0x8c29('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x8c29('0x3'));var rs=require(_0x8c29('0x4'));var moment=require(_0x8c29('0x5'));var db=require(_0x8c29('0x6'))['db'];var authService=require(_0x8c29('0x7'));var utils=require(_0x8c29('0x8'));var client=jayson[_0x8c29('0x9')][_0x8c29('0xa')]({'port':0x232b});function localAuthenticate(_0xfb1afe,_0x1bca2c,_0x48aafa,_0x863f23){var _0x1aedd0,_0x4f08b0;return db[_0x8c29('0xb')][_0x8c29('0xc')]({'where':{'id':0x1},'attributes':[_0x8c29('0xd'),_0x8c29('0xe')],'raw':!![]})[_0x8c29('0xf')](function(_0x25c0ed){_0x1aedd0=_0x25c0ed;return _0xfb1afe['findOne']({'attributes':['id',_0x8c29('0x10'),_0x8c29('0x11'),_0x8c29('0x12'),_0x8c29('0x13'),'disabled',_0x8c29('0x14'),_0x8c29('0x15'),_0x8c29('0x16')],'where':{'name':_0x1bca2c,'role':{'$or':[_0x8c29('0x17'),_0x8c29('0x18'),'agent']}}});})[_0x8c29('0xf')](function(_0x2bb06a){if(!_0x2bb06a||_0x2bb06a&&_0x2bb06a[_0x8c29('0x10')]!==_0x1bca2c){throw new Error(_0x8c29('0x19'));}else{_0x4f08b0=_0x2bb06a;return _0x4f08b0;}})[_0x8c29('0xf')](function(){_0x4f08b0['authenticate'](_0x48aafa,function(_0x41654d,_0x544056){var _0x103f75=_0x4f08b0[_0x8c29('0x16')]+0x1;if(_0x41654d){return _0x863f23(_0x41654d);}else if(!_0x544056){if(_0x4f08b0[_0x8c29('0x1a')]){return _0x863f23(null,![],{'message':_0x8c29('0x19')});}else if(_0x1aedd0[_0x8c29('0xd')]>0x0){if(_0x4f08b0[_0x8c29('0x14')]){if(_0x1aedd0['blockDuration']>0x0){if(moment(_0x4f08b0[_0x8c29('0x15')])[_0x8c29('0x1b')](_0x1aedd0['blockDuration'],_0x8c29('0x1c'))>moment()){return _0x863f23(null,![],{'message':_0x8c29('0x19')});}else{return utils[_0x8c29('0x1d')](_0x4f08b0,_0x103f75,![],null)[_0x8c29('0xf')](function(){return _0x863f23(null,![],{'message':_0x8c29('0x19')});});}}else{return _0x863f23(null,![],{'message':_0x8c29('0x19')});}}else{if(_0x103f75>=_0x1aedd0[_0x8c29('0xd')]){return utils['clearBlockUser'](_0x4f08b0,0x0,!![],moment())[_0x8c29('0xf')](function(){return _0x863f23(null,![],{'message':_0x8c29('0x19')});});}else{return utils[_0x8c29('0x1d')](_0x4f08b0,_0x103f75,![],null)[_0x8c29('0xf')](function(){return _0x863f23(null,![],{'message':_0x8c29('0x19')});});}}}else{return _0x863f23(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4f08b0[_0x8c29('0x1a')]){return _0x863f23(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x1aedd0[_0x8c29('0xd')]>0x0){if(_0x4f08b0[_0x8c29('0x14')]){if(_0x1aedd0[_0x8c29('0xe')]>0x0){if(moment(_0x4f08b0[_0x8c29('0x15')])['add'](_0x1aedd0[_0x8c29('0xe')],_0x8c29('0x1c'))>moment()){return _0x863f23(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x8c29('0x1d')](_0x4f08b0,0x0,![],null)[_0x8c29('0xf')](function(){return utils[_0x8c29('0x1e')](_0x4f08b0);})[_0x8c29('0xf')](function(){return _0x863f23(null,_0x4f08b0);});}}else{return _0x863f23(null,![],{'message':_0x8c29('0x19')});}}else{return utils[_0x8c29('0x1d')](_0x4f08b0,0x0,![],null)[_0x8c29('0xf')](function(){return utils[_0x8c29('0x1e')](_0x4f08b0);})['then'](function(){return _0x863f23(null,_0x4f08b0);})[_0x8c29('0x1f')](function(_0x4319d4){return _0x863f23(null,![],_0x4319d4);});}}else{if(_0x4f08b0[_0x8c29('0x14')]){return _0x863f23(null,![],{'message':_0x8c29('0x19')});}else{return utils[_0x8c29('0x1e')](_0x4f08b0)[_0x8c29('0xf')](function(){return _0x863f23(null,_0x4f08b0);});}}}});})[_0x8c29('0x1f')](function(_0x19df20){return _0x863f23(null,![],_0x19df20);});}function sendServiceMail(_0x236729){return db['MailAccount'][_0x8c29('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0x8c29('0x21')],'include':[{'model':db[_0x8c29('0x22')],'as':_0x8c29('0x23')}]})[_0x8c29('0xf')](function(_0x136d27){if(!_0x136d27){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0xe7c5ba={'tls':{'rejectUnauthorized':![]}};if(_0x136d27[_0x8c29('0x23')][_0x8c29('0x24')]){_0xe7c5ba[_0x8c29('0x24')]=_0x136d27[_0x8c29('0x23')][_0x8c29('0x24')];}else{_0xe7c5ba[_0x8c29('0x25')]=_0x136d27['Smtp'][_0x8c29('0x25')];_0xe7c5ba['port']=_0x136d27['Smtp'][_0x8c29('0x26')];_0xe7c5ba[_0x8c29('0x27')]=_0x136d27[_0x8c29('0x23')][_0x8c29('0x27')];}if(_0x136d27[_0x8c29('0x23')][_0x8c29('0x28')]){_0xe7c5ba['auth']={'user':_0x136d27['Smtp'][_0x8c29('0x18')],'pass':_0x136d27[_0x8c29('0x23')][_0x8c29('0x29')]};}var _0x521867={'account':_0xe7c5ba,'message':_[_0x8c29('0x2a')]({'from':util[_0x8c29('0x2b')](_0x8c29('0x2c'),_0x136d27[_0x8c29('0x10')],_0x136d27[_0x8c29('0x21')]||_0x136d27[_0x8c29('0x23')]['user'])},_0x236729)};return client[_0x8c29('0x2d')](_0x8c29('0x2e'),_0x521867);})[_0x8c29('0xf')](function(_0x34c1b2){if(_0x34c1b2['error']){throw new Error(util[_0x8c29('0x2b')](_0x8c29('0x2f'),_0x34c1b2['error'][_0x8c29('0x30')]||JSON[_0x8c29('0x31')](_0x34c1b2[_0x8c29('0x32')])));}return!![];});}function handleError(_0x1a74af,_0x52864e,_0x96b81){return _0x1a74af[_0x8c29('0x33')](_0x52864e||0x1f4)[_0x8c29('0x34')]({'message':_0x96b81?_0x96b81[_0x8c29('0x30')]||_0x96b81:''});}function checkPasswordPattern(_0x72f23b,_0x5d2401,_0x23683f){if(_0x23683f){var _0x3cb864=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3cb864['test'](_0x5d2401)){return _0x72f23b;}else{throw new Error(_0x8c29('0x35'));}}else{return _0x72f23b;}}exports[_0x8c29('0x36')]=function(_0x14aa60,_0x5f5af6,_0x20ff09){passport['authenticate'](_0x8c29('0x37'),function(_0x354275,_0x226c57,_0x34deb6){var _0x5d53bf=_0x354275||_0x34deb6;if(_0x5d53bf){return handleError(_0x5f5af6,0x191,_0x5d53bf);}if(!_0x226c57){return handleError(_0x5f5af6,0x194,{'message':_0x8c29('0x38')});}else{var _0xbc1ccd={'payload':{'id':_0x226c57['id'],'role':_0x226c57['role']},'options':{'expiresIn':0x15180}};return authService[_0x8c29('0x39')](_0xbc1ccd)['then'](function(_0x12883f){_0x5f5af6[_0x8c29('0x3a')]({'id':_0x226c57['id'],'token':_0x12883f,'statusCall':'','isAlreadyLogged':_0x226c57[_0x8c29('0x3b')]});});}})(_0x14aa60,_0x5f5af6,_0x20ff09);};exports[_0x8c29('0x3c')]=function(_0x970f6,_0x2402db,_0xa13b7b){if(!_0x970f6[_0x8c29('0x3d')]['email']){return handleError(_0x2402db,0x1f4,{'message':_0x8c29('0x3e')});}var _0x39b82a=rs[_0x8c29('0x3f')]();_0x970f6['body'][_0x8c29('0x21')]=_0x970f6[_0x8c29('0x3d')][_0x8c29('0x21')][_0x8c29('0x40')]()[_0x8c29('0x41')]();var _0x35d5f0;return db[_0x8c29('0xb')][_0x8c29('0xc')]({'where':{'id':0x1},'attributes':[_0x8c29('0xd'),_0x8c29('0xe')],'raw':!![]})[_0x8c29('0xf')](function(_0x46a4aa){_0x35d5f0=_0x46a4aa;return db[_0x8c29('0x42')][_0x8c29('0x20')]({'where':{'email':_0x970f6[_0x8c29('0x3d')][_0x8c29('0x21')]}});})['then'](function(_0xe3f5fb){if(!_0xe3f5fb){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0xe3f5fb[_0x8c29('0x1a')]){throw new Error(_0x8c29('0x43'));}if(_0xe3f5fb[_0x8c29('0x14')]){if(moment(_0xe3f5fb[_0x8c29('0x15')])[_0x8c29('0x1b')](_0x35d5f0['blockDuration'],'minutes')>moment()){throw new Error(_0x8c29('0x44'));}else{_0xe3f5fb[_0x8c29('0x14')]=![];_0xe3f5fb[_0x8c29('0x15')]=null;}}_0xe3f5fb[_0x8c29('0x45')]=_0x39b82a;_0xe3f5fb[_0x8c29('0x46')]=Date['now']()+0x36ee80;return _0xe3f5fb['save']();})[_0x8c29('0xf')](function(){return sendServiceMail({'to':_0x970f6[_0x8c29('0x3d')][_0x8c29('0x21')],'subject':_0x8c29('0x47'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x8c29('0x48')+_0x8c29('0x49')+_0x970f6[_0x8c29('0x4a')][_0x8c29('0x25')]+_0x8c29('0x4b')+_0x39b82a+'\x0a\x0a'+_0x8c29('0x4c')});})[_0x8c29('0xf')](function(){_0x2402db[_0x8c29('0x33')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x3926d3){return handleError(_0x2402db,0x1f4,_0x3926d3);});};exports['reset']=function(_0x2525c1,_0x59bc7e,_0x130b9c){var _0x1823ad;return db[_0x8c29('0x42')][_0x8c29('0x20')]({'where':{'resetPasswordToken':_0x2525c1[_0x8c29('0x4d')][_0x8c29('0x4e')],'resetPasswordExpires':{'$gt':Date[_0x8c29('0x4f')]()}}})['then'](function(_0x478833){_0x1823ad=_0x478833;if(!_0x1823ad){throw new Error(_0x8c29('0x50'));}return db[_0x8c29('0xb')][_0x8c29('0xc')]({'attributes':['id','securePassword']});})[_0x8c29('0xf')](function(_0x5b5e2c){return checkPasswordPattern(_0x5b5e2c,_0x2525c1[_0x8c29('0x3d')]['password'],_0x5b5e2c[_0x8c29('0x51')]);})[_0x8c29('0xf')](function(){_0x1823ad['password']=_0x2525c1[_0x8c29('0x3d')][_0x8c29('0x11')];_0x1823ad[_0x8c29('0x45')]=null;_0x1823ad[_0x8c29('0x46')]=null;return _0x1823ad[_0x8c29('0x52')]();})[_0x8c29('0xf')](function(){_0x59bc7e[_0x8c29('0x33')](0xc8)['send']({'message':_0x8c29('0x53')});})[_0x8c29('0x1f')](function(_0x5b28e7){return handleError(_0x59bc7e,0x1f4,_0x5b28e7);});};passport[_0x8c29('0x54')](new LocalStrategy({'usernameField':_0x8c29('0x10'),'passwordField':_0x8c29('0x11')},function(_0x35fb1d,_0x25ea61,_0x37fe27){return localAuthenticate(db['User'],_0x35fb1d,_0x25ea61,_0x37fe27);})); \ No newline at end of file +var _0x76a6=['loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','clearBlockUser','disabled','minutes','getLicense','MailAccount','find','email','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','catch','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','save','Password\x20reset!','util','passport','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','blocked','blockedAt'];(function(_0xb07ade,_0x1b317b){var _0x158eed=function(_0x4a8d4c){while(--_0x4a8d4c){_0xb07ade['push'](_0xb07ade['shift']());}};_0x158eed(++_0x1b317b);}(_0x76a6,0x18b));var _0x676a=function(_0x1c289a,_0x277fe7){_0x1c289a=_0x1c289a-0x0;var _0x28d68e=_0x76a6[_0x1c289a];return _0x28d68e;};'use strict';var util=require(_0x676a('0x0'));var passport=require(_0x676a('0x1'));var LocalStrategy=require('passport-local')[_0x676a('0x2')];var jayson=require(_0x676a('0x3'));var _=require(_0x676a('0x4'));var rs=require(_0x676a('0x5'));var moment=require('moment');var db=require(_0x676a('0x6'))['db'];var authService=require(_0x676a('0x7'));var utils=require(_0x676a('0x8'));var client=jayson['client'][_0x676a('0x9')]({'port':0x232b});function localAuthenticate(_0x172fac,_0x45578e,_0x218a34,_0x4c5897){var _0x81427c,_0x32f29f;return db[_0x676a('0xa')][_0x676a('0xb')]({'where':{'id':0x1},'attributes':[_0x676a('0xc'),_0x676a('0xd')],'raw':!![]})[_0x676a('0xe')](function(_0x1779f8){_0x81427c=_0x1779f8;return _0x172fac[_0x676a('0xb')]({'attributes':['id',_0x676a('0xf'),_0x676a('0x10'),_0x676a('0x11'),'role','disabled',_0x676a('0x12'),_0x676a('0x13'),_0x676a('0x14')],'where':{'name':_0x45578e,'role':{'$or':[_0x676a('0x15'),_0x676a('0x16'),_0x676a('0x17')]}}});})[_0x676a('0xe')](function(_0x26e0bd){if(!_0x26e0bd||_0x26e0bd&&_0x26e0bd[_0x676a('0xf')]!==_0x45578e){throw new Error(_0x676a('0x18'));}else{_0x32f29f=_0x26e0bd;return _0x32f29f;}})[_0x676a('0xe')](function(){_0x32f29f[_0x676a('0x19')](_0x218a34,function(_0x5880fd,_0x6587f6){var _0x26923e=_0x32f29f[_0x676a('0x14')]+0x1;if(_0x5880fd){return _0x4c5897(_0x5880fd);}else if(!_0x6587f6){if(_0x32f29f['disabled']){return _0x4c5897(null,![],{'message':_0x676a('0x18')});}else if(_0x81427c['allowedLoginAttempts']>0x0){if(_0x32f29f[_0x676a('0x12')]){if(_0x81427c[_0x676a('0xd')]>0x0){if(moment(_0x32f29f[_0x676a('0x13')])[_0x676a('0x1a')](_0x81427c[_0x676a('0xd')],'minutes')>moment()){return _0x4c5897(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x676a('0x1b')](_0x32f29f,_0x26923e,![],null)[_0x676a('0xe')](function(){return _0x4c5897(null,![],{'message':_0x676a('0x18')});});}}else{return _0x4c5897(null,![],{'message':_0x676a('0x18')});}}else{if(_0x26923e>=_0x81427c[_0x676a('0xc')]){return utils[_0x676a('0x1b')](_0x32f29f,0x0,!![],moment())['then'](function(){return _0x4c5897(null,![],{'message':_0x676a('0x18')});});}else{return utils[_0x676a('0x1b')](_0x32f29f,_0x26923e,![],null)['then'](function(){return _0x4c5897(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x4c5897(null,![],{'message':_0x676a('0x18')});}}else{if(_0x32f29f[_0x676a('0x1c')]){return _0x4c5897(null,![],{'message':_0x676a('0x18')});}else if(_0x81427c[_0x676a('0xc')]>0x0){if(_0x32f29f[_0x676a('0x12')]){if(_0x81427c[_0x676a('0xd')]>0x0){if(moment(_0x32f29f[_0x676a('0x13')])[_0x676a('0x1a')](_0x81427c[_0x676a('0xd')],_0x676a('0x1d'))>moment()){return _0x4c5897(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x676a('0x1b')](_0x32f29f,0x0,![],null)[_0x676a('0xe')](function(){return utils[_0x676a('0x1e')](_0x32f29f);})[_0x676a('0xe')](function(){return _0x4c5897(null,_0x32f29f);});}}else{return _0x4c5897(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x676a('0x1b')](_0x32f29f,0x0,![],null)['then'](function(){return utils['getLicense'](_0x32f29f);})[_0x676a('0xe')](function(){return _0x4c5897(null,_0x32f29f);})['catch'](function(_0x5d9978){return _0x4c5897(null,![],_0x5d9978);});}}else{if(_0x32f29f[_0x676a('0x12')]){return _0x4c5897(null,![],{'message':_0x676a('0x18')});}else{return utils['getLicense'](_0x32f29f)[_0x676a('0xe')](function(){return _0x4c5897(null,_0x32f29f);});}}}});})['catch'](function(_0x52a2bf){return _0x4c5897(null,![],_0x52a2bf);});}function sendServiceMail(_0xfce087){return db[_0x676a('0x1f')][_0x676a('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0x676a('0x21')],'include':[{'model':db['MailServerOut'],'as':_0x676a('0x22')}]})[_0x676a('0xe')](function(_0x4cd5d1){if(!_0x4cd5d1){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x6f7b2a={'tls':{'rejectUnauthorized':![]}};if(_0x4cd5d1['Smtp'][_0x676a('0x23')]){_0x6f7b2a[_0x676a('0x23')]=_0x4cd5d1[_0x676a('0x22')]['service'];}else{_0x6f7b2a['host']=_0x4cd5d1[_0x676a('0x22')][_0x676a('0x24')];_0x6f7b2a[_0x676a('0x25')]=_0x4cd5d1[_0x676a('0x22')][_0x676a('0x25')];_0x6f7b2a[_0x676a('0x26')]=_0x4cd5d1[_0x676a('0x22')][_0x676a('0x26')];}if(_0x4cd5d1[_0x676a('0x22')][_0x676a('0x27')]){_0x6f7b2a[_0x676a('0x28')]={'user':_0x4cd5d1[_0x676a('0x22')]['user'],'pass':_0x4cd5d1['Smtp'][_0x676a('0x29')]};}var _0x19d4df={'account':_0x6f7b2a,'message':_[_0x676a('0x2a')]({'from':util[_0x676a('0x2b')](_0x676a('0x2c'),_0x4cd5d1[_0x676a('0xf')],_0x4cd5d1[_0x676a('0x21')]||_0x4cd5d1[_0x676a('0x22')][_0x676a('0x16')])},_0xfce087)};return client[_0x676a('0x2d')](_0x676a('0x2e'),_0x19d4df);})[_0x676a('0xe')](function(_0x2d13ce){if(_0x2d13ce['error']){throw new Error(util[_0x676a('0x2b')](_0x676a('0x2f'),_0x2d13ce[_0x676a('0x30')][_0x676a('0x31')]||JSON[_0x676a('0x32')](_0x2d13ce['error'])));}return!![];});}function handleError(_0xedd703,_0x3ee60d,_0x37f923){return _0xedd703[_0x676a('0x33')](_0x3ee60d||0x1f4)[_0x676a('0x34')]({'message':_0x37f923?_0x37f923[_0x676a('0x31')]||_0x37f923:''});}function checkPasswordPattern(_0x1b92ed,_0x4c47ee,_0xf77ecd){if(_0xf77ecd){var _0x4b3cef=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b3cef[_0x676a('0x35')](_0x4c47ee)){return _0x1b92ed;}else{throw new Error(_0x676a('0x36'));}}else{return _0x1b92ed;}}exports[_0x676a('0x37')]=function(_0x1ada2c,_0x33e96a,_0x5e12f2){passport[_0x676a('0x19')]('local',function(_0x16c077,_0x36c148,_0x4eb63a){var _0x3c6993=_0x16c077||_0x4eb63a;if(_0x3c6993){return handleError(_0x33e96a,0x191,_0x3c6993);}if(!_0x36c148){return handleError(_0x33e96a,0x194,{'message':_0x676a('0x38')});}else{var _0x21a2df={'payload':{'id':_0x36c148['id'],'role':_0x36c148[_0x676a('0x39')]},'options':{'expiresIn':0x15180}};return authService[_0x676a('0x3a')](_0x21a2df)['then'](function(_0x580926){_0x33e96a[_0x676a('0x3b')]({'id':_0x36c148['id'],'token':_0x580926,'statusCall':'','isAlreadyLogged':_0x36c148['online']});});}})(_0x1ada2c,_0x33e96a,_0x5e12f2);};exports['forgot']=function(_0x57a5bc,_0x22696b,_0x10c760){if(!_0x57a5bc[_0x676a('0x3c')]['email']){return handleError(_0x22696b,0x1f4,{'message':_0x676a('0x3d')});}var _0x401073=rs[_0x676a('0x3e')]();_0x57a5bc['body'][_0x676a('0x21')]=_0x57a5bc[_0x676a('0x3c')]['email'][_0x676a('0x3f')]()[_0x676a('0x40')]();var _0x418764;return db[_0x676a('0xa')][_0x676a('0xb')]({'where':{'id':0x1},'attributes':[_0x676a('0xc'),'blockDuration'],'raw':!![]})[_0x676a('0xe')](function(_0x91b620){_0x418764=_0x91b620;return db[_0x676a('0x41')]['find']({'where':{'email':_0x57a5bc['body'][_0x676a('0x21')]}});})[_0x676a('0xe')](function(_0xa1d2f1){if(!_0xa1d2f1){throw new Error(_0x676a('0x42'));}if(_0xa1d2f1[_0x676a('0x1c')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0xa1d2f1[_0x676a('0x12')]){if(moment(_0xa1d2f1[_0x676a('0x13')])[_0x676a('0x1a')](_0x418764['blockDuration'],'minutes')>moment()){throw new Error(_0x676a('0x43'));}else{_0xa1d2f1[_0x676a('0x12')]=![];_0xa1d2f1[_0x676a('0x13')]=null;}}_0xa1d2f1[_0x676a('0x44')]=_0x401073;_0xa1d2f1[_0x676a('0x45')]=Date[_0x676a('0x46')]()+0x36ee80;return _0xa1d2f1['save']();})[_0x676a('0xe')](function(){return sendServiceMail({'to':_0x57a5bc[_0x676a('0x3c')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x676a('0x47')+_0x57a5bc[_0x676a('0x48')][_0x676a('0x24')]+_0x676a('0x49')+_0x401073+'\x0a\x0a'+_0x676a('0x4a')});})[_0x676a('0xe')](function(){_0x22696b[_0x676a('0x33')](0xc8)['send']({'message':_0x676a('0x4b')});})[_0x676a('0x4c')](function(_0x4c9527){return handleError(_0x22696b,0x1f4,_0x4c9527);});};exports[_0x676a('0x4d')]=function(_0x5a8283,_0x4c3356,_0x4a52b0){var _0x37aabd;return db[_0x676a('0x41')][_0x676a('0x20')]({'where':{'resetPasswordToken':_0x5a8283['params'][_0x676a('0x4e')],'resetPasswordExpires':{'$gt':Date[_0x676a('0x46')]()}}})[_0x676a('0xe')](function(_0x15baa8){_0x37aabd=_0x15baa8;if(!_0x37aabd){throw new Error(_0x676a('0x4f'));}return db['Setting'][_0x676a('0xb')]({'attributes':['id',_0x676a('0x50')]});})[_0x676a('0xe')](function(_0x544f48){return checkPasswordPattern(_0x544f48,_0x5a8283[_0x676a('0x3c')]['password'],_0x544f48[_0x676a('0x50')]);})['then'](function(){_0x37aabd[_0x676a('0x10')]=_0x5a8283[_0x676a('0x3c')][_0x676a('0x10')];_0x37aabd[_0x676a('0x44')]=null;_0x37aabd[_0x676a('0x45')]=null;return _0x37aabd[_0x676a('0x51')]();})[_0x676a('0xe')](function(){_0x4c3356[_0x676a('0x33')](0xc8)[_0x676a('0x34')]({'message':_0x676a('0x52')});})['catch'](function(_0x167a71){return handleError(_0x4c3356,0x1f4,_0x167a71);});};passport['use'](new LocalStrategy({'usernameField':_0x676a('0xf'),'passwordField':_0x676a('0x10')},function(_0x1fc4f1,_0x391b59,_0x2f7fb3){return localAuthenticate(db[_0x676a('0x41')],_0x1fc4f1,_0x391b59,_0x2f7fb3);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index b215838..b2f9c90 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 _0xee15=['forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller','post','login','/forgot'];(function(_0x47b096,_0x5ec33b){var _0x37ebd0=function(_0xf4edc6){while(--_0xf4edc6){_0x47b096['push'](_0x47b096['shift']());}};_0x37ebd0(++_0x5ec33b);}(_0xee15,0x9a));var _0x5ee1=function(_0x587dd0,_0x273922){_0x587dd0=_0x587dd0-0x0;var _0x56f153=_0xee15[_0x587dd0];return _0x56f153;};'use strict';var express=require(_0x5ee1('0x0'));var router=express[_0x5ee1('0x1')]();var controller=require(_0x5ee1('0x2'));router[_0x5ee1('0x3')]('/',controller[_0x5ee1('0x4')]);router[_0x5ee1('0x3')](_0x5ee1('0x5'),controller[_0x5ee1('0x6')]);router[_0x5ee1('0x3')](_0x5ee1('0x7'),controller[_0x5ee1('0x8')]);module[_0x5ee1('0x9')]=router; \ No newline at end of file +var _0x9df1=['forgot','/reset/:token','reset','exports','express','Router','post','/forgot'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9df1,0x1b4));var _0x19df=function(_0x1638b5,_0x4f4e68){_0x1638b5=_0x1638b5-0x0;var _0x7cfb20=_0x9df1[_0x1638b5];return _0x7cfb20;};'use strict';var express=require(_0x19df('0x0'));var router=express[_0x19df('0x1')]();var controller=require('./authLocal.controller');router[_0x19df('0x2')]('/',controller['login']);router['post'](_0x19df('0x3'),controller[_0x19df('0x4')]);router[_0x19df('0x2')](_0x19df('0x5'),controller[_0x19df('0x6')]);module[_0x19df('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 0c9ef66..4b9372c 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 _0x44e3=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x1a7075,_0x210769){var _0x456ed8=function(_0x41a33f){while(--_0x41a33f){_0x1a7075['push'](_0x1a7075['shift']());}};_0x456ed8(++_0x210769);}(_0x44e3,0x177));var _0x344e=function(_0x5c3887,_0x148afb){_0x5c3887=_0x5c3887-0x0;var _0x30aa73=_0x44e3[_0x5c3887];return _0x30aa73;};'use strict';var Sequelize=require(_0x344e('0x0'));module[_0x344e('0x1')]={'name':{'type':Sequelize[_0x344e('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x344e('0x2')]},'description':{'type':Sequelize[_0x344e('0x2')]},'status':{'type':Sequelize[_0x344e('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x344e('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x84e6=['exports','STRING','BOOLEAN'];(function(_0x2054be,_0x1032d6){var _0xf49252=function(_0x5743e9){while(--_0x5743e9){_0x2054be['push'](_0x2054be['shift']());}};_0xf49252(++_0x1032d6);}(_0x84e6,0x1a4));var _0x684e=function(_0x229432,_0x59da9a){_0x229432=_0x229432-0x0;var _0x4d3584=_0x84e6[_0x229432];return _0x4d3584;};'use strict';var Sequelize=require('sequelize');module[_0x684e('0x0')]={'name':{'type':Sequelize[_0x684e('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x684e('0x1')]},'description':{'type':Sequelize[_0x684e('0x1')]},'status':{'type':Sequelize[_0x684e('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 4efe951..b5f75ad 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 _0x8d89=['fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','json','reject','update','destroy','then','error','stack','name','send','index','map','Automation','type','key','model','keys','query','filters','intersection','attributes','fields','sort','pick','filter','where','merge','options','findAll','rows','catch','show','params','rawAttributes','length','includeAll','include','create','body','find','addConditions','Condition','ids','getConditions','order','hasOwnProperty','nolimit','addActions','omit','getActions','Action','html-pdf','eml-format','rimraf'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x8d89,0x139));var _0x98d8=function(_0xb217f1,_0x2162f0){_0xb217f1=_0xb217f1-0x0;var _0x458a0a=_0x8d89[_0xb217f1];return _0x458a0a;};'use strict';var pdf=require(_0x98d8('0x0'));var emlformat=require(_0x98d8('0x1'));var rimraf=require(_0x98d8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x98d8('0x3'));var rp=require(_0x98d8('0x4'));var moment=require(_0x98d8('0x5'));var BPromise=require(_0x98d8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x98d8('0x7'));var sox=require(_0x98d8('0x8'));var csv=require(_0x98d8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x98d8('0xa'));var squel=require(_0x98d8('0xb'));var crypto=require('crypto');var jsforce=require(_0x98d8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x98d8('0x9'));var querystring=require(_0x98d8('0xd'));var Papa=require(_0x98d8('0xe'));var Redis=require(_0x98d8('0xf'));var authService=require(_0x98d8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x98d8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x98d8('0x12'))(_0x98d8('0x13'));var utils=require('../../config/utils');var config=require(_0x98d8('0x14'));var db=require(_0x98d8('0x15'))['db'];function respondWithStatusCode(_0x244e04,_0x2b9bc4){_0x2b9bc4=_0x2b9bc4||0xcc;return function(_0x2ecdfe){if(_0x2ecdfe){return _0x244e04[_0x98d8('0x16')](_0x2b9bc4);}return _0x244e04['status'](_0x2b9bc4)[_0x98d8('0x17')]();};}function respondWithResult(_0x1d83dc,_0x5c9bde){_0x5c9bde=_0x5c9bde||0xc8;return function(_0x87ee48){if(_0x87ee48){return _0x1d83dc[_0x98d8('0x18')](_0x5c9bde)['json'](_0x87ee48);}};}function respondWithFilteredResult(_0x4aeb99,_0x3270ba){return function(_0x5b38f5){if(_0x5b38f5){var _0x4ebe3b=_0x5b38f5[_0x98d8('0x19')],_0x3db913=_0x3270ba['offset'],_0x55f43f=_0x3270ba[_0x98d8('0x1a')]+_0x3270ba[_0x98d8('0x1b')],_0x179a72;if(_0x55f43f>=_0x4ebe3b){_0x55f43f=_0x4ebe3b;_0x179a72=0xc8;}else{_0x179a72=0xce;}_0x4aeb99['status'](_0x179a72);return _0x4aeb99[_0x98d8('0x1c')]('Content-Range',_0x3db913+'-'+_0x55f43f+'/'+_0x4ebe3b)[_0x98d8('0x1d')](_0x5b38f5);}return null;};}function patchUpdates(_0x30f4fc){return function(_0x581aa9){try{jsonpatch['apply'](_0x581aa9,_0x30f4fc,!![]);}catch(_0x3e6900){return BPromise[_0x98d8('0x1e')](_0x3e6900);}return _0x581aa9['save']();};}function saveUpdates(_0x232c74,_0x3bb964){return function(_0x5521d5){if(_0x5521d5){return _0x5521d5[_0x98d8('0x1f')](_0x232c74)['then'](function(_0x1754c0){return _0x1754c0;});}return null;};}function removeEntity(_0x2eab93,_0x55c35b){return function(_0x48a54b){if(_0x48a54b){return _0x48a54b[_0x98d8('0x20')]()[_0x98d8('0x21')](function(){_0x2eab93[_0x98d8('0x18')](0xcc)[_0x98d8('0x17')]();});}};}function handleEntityNotFound(_0x5c37b4,_0x5311ed){return function(_0x2b51f7){if(!_0x2b51f7){_0x5c37b4[_0x98d8('0x16')](0x194);}return _0x2b51f7;};}function handleError(_0x40cddd,_0x5d2d86){_0x5d2d86=_0x5d2d86||0x1f4;return function(_0x3708a4){logger[_0x98d8('0x22')](_0x3708a4[_0x98d8('0x23')]);if(_0x3708a4['name']){delete _0x3708a4[_0x98d8('0x24')];}_0x40cddd['status'](_0x5d2d86)[_0x98d8('0x25')](_0x3708a4);};}exports[_0x98d8('0x26')]=function(_0x4db782,_0x1c5ace){var _0x4f6928={},_0x7a4020={},_0x12a874={'count':0x0,'rows':[]};var _0x24af9d=_[_0x98d8('0x27')](db[_0x98d8('0x28')]['rawAttributes'],function(_0x179ec8){return{'name':_0x179ec8['fieldName'],'type':_0x179ec8[_0x98d8('0x29')][_0x98d8('0x2a')]};});_0x7a4020[_0x98d8('0x2b')]=_[_0x98d8('0x27')](_0x24af9d,_0x98d8('0x24'));_0x7a4020['query']=_[_0x98d8('0x2c')](_0x4db782[_0x98d8('0x2d')]);_0x7a4020[_0x98d8('0x2e')]=_[_0x98d8('0x2f')](_0x7a4020[_0x98d8('0x2b')],_0x7a4020[_0x98d8('0x2d')]);_0x4f6928[_0x98d8('0x30')]=_['intersection'](_0x7a4020[_0x98d8('0x2b')],qs[_0x98d8('0x31')](_0x4db782[_0x98d8('0x2d')][_0x98d8('0x31')]));_0x4f6928[_0x98d8('0x30')]=_0x4f6928['attributes']['length']?_0x4f6928[_0x98d8('0x30')]:_0x7a4020[_0x98d8('0x2b')];if(!_0x4db782[_0x98d8('0x2d')]['hasOwnProperty']('nolimit')){_0x4f6928[_0x98d8('0x1b')]=qs[_0x98d8('0x1b')](_0x4db782[_0x98d8('0x2d')][_0x98d8('0x1b')]);_0x4f6928['offset']=qs[_0x98d8('0x1a')](_0x4db782[_0x98d8('0x2d')][_0x98d8('0x1a')]);}_0x4f6928['order']=qs[_0x98d8('0x32')](_0x4db782['query']['sort']);_0x4f6928['where']=qs[_0x98d8('0x2e')](_[_0x98d8('0x33')](_0x4db782['query'],_0x7a4020[_0x98d8('0x2e')]),_0x24af9d);if(_0x4db782[_0x98d8('0x2d')][_0x98d8('0x34')]){_0x4f6928[_0x98d8('0x35')]=_[_0x98d8('0x36')](_0x4f6928[_0x98d8('0x35')],{'$or':_['map'](_0x24af9d,function(_0x1c3cb0){if(_0x1c3cb0[_0x98d8('0x29')]!=='VIRTUAL'){var _0x54a43c={};_0x54a43c[_0x1c3cb0[_0x98d8('0x24')]]={'$like':'%'+_0x4db782[_0x98d8('0x2d')][_0x98d8('0x34')]+'%'};return _0x54a43c;}})});}_0x4f6928=_['merge']({},_0x4f6928,_0x4db782[_0x98d8('0x37')]);var _0xf0ab79={'where':_0x4f6928[_0x98d8('0x35')]};return db[_0x98d8('0x28')][_0x98d8('0x19')](_0xf0ab79)[_0x98d8('0x21')](function(_0x36f1c8){_0x12a874[_0x98d8('0x19')]=_0x36f1c8;if(_0x4db782[_0x98d8('0x2d')]['includeAll']){_0x4f6928['include']=[{'all':!![]}];}return db[_0x98d8('0x28')][_0x98d8('0x38')](_0x4f6928);})[_0x98d8('0x21')](function(_0x386518){_0x12a874[_0x98d8('0x39')]=_0x386518;return _0x12a874;})[_0x98d8('0x21')](respondWithFilteredResult(_0x1c5ace,_0x4f6928))[_0x98d8('0x3a')](handleError(_0x1c5ace,null));};exports[_0x98d8('0x3b')]=function(_0x54073d,_0x3f5ae0){var _0x1e5342={'raw':![],'where':{'id':_0x54073d[_0x98d8('0x3c')]['id']}},_0x156b35={};_0x156b35[_0x98d8('0x2b')]=_[_0x98d8('0x2c')](db[_0x98d8('0x28')][_0x98d8('0x3d')]);_0x156b35[_0x98d8('0x2d')]=_[_0x98d8('0x2c')](_0x54073d[_0x98d8('0x2d')]);_0x156b35['filters']=_[_0x98d8('0x2f')](_0x156b35[_0x98d8('0x2b')],_0x156b35[_0x98d8('0x2d')]);_0x1e5342[_0x98d8('0x30')]=_[_0x98d8('0x2f')](_0x156b35[_0x98d8('0x2b')],qs['fields'](_0x54073d[_0x98d8('0x2d')][_0x98d8('0x31')]));_0x1e5342[_0x98d8('0x30')]=_0x1e5342['attributes'][_0x98d8('0x3e')]?_0x1e5342['attributes']:_0x156b35[_0x98d8('0x2b')];if(_0x54073d['query'][_0x98d8('0x3f')]){_0x1e5342[_0x98d8('0x40')]=[{'all':!![]}];}_0x1e5342=_['merge']({},_0x1e5342,_0x54073d[_0x98d8('0x37')]);return db['Automation']['find'](_0x1e5342)[_0x98d8('0x21')](handleEntityNotFound(_0x3f5ae0,null))[_0x98d8('0x21')](respondWithResult(_0x3f5ae0,null))[_0x98d8('0x3a')](handleError(_0x3f5ae0,null));};exports[_0x98d8('0x41')]=function(_0x84547c,_0x1b41d3){return db['Automation']['create'](_0x84547c[_0x98d8('0x42')],{})['then'](respondWithResult(_0x1b41d3,0xc9))['catch'](handleError(_0x1b41d3,null));};exports['update']=function(_0x3ffbe9,_0x3fb3dd){if(_0x3ffbe9['body']['id']){delete _0x3ffbe9['body']['id'];}return db[_0x98d8('0x28')][_0x98d8('0x43')]({'where':{'id':_0x3ffbe9['params']['id']}})[_0x98d8('0x21')](handleEntityNotFound(_0x3fb3dd,null))[_0x98d8('0x21')](saveUpdates(_0x3ffbe9[_0x98d8('0x42')],null))['then'](respondWithResult(_0x3fb3dd,null))[_0x98d8('0x3a')](handleError(_0x3fb3dd,null));};exports['destroy']=function(_0x5b7e77,_0x4912c4){return db['Automation'][_0x98d8('0x43')]({'where':{'id':_0x5b7e77['params']['id']}})['then'](handleEntityNotFound(_0x4912c4,null))[_0x98d8('0x21')](removeEntity(_0x4912c4,null))[_0x98d8('0x3a')](handleError(_0x4912c4,null));};exports[_0x98d8('0x44')]=function(_0x2603fa,_0x1b3381,_0x20c057){return db[_0x98d8('0x45')][_0x98d8('0x43')]({'where':{'id':_0x2603fa[_0x98d8('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1b3381,null))[_0x98d8('0x21')](function(_0x516eee){if(_0x516eee){return _0x516eee[_0x98d8('0x44')](_0x2603fa[_0x98d8('0x42')]['ids'],_['omit'](_0x2603fa[_0x98d8('0x42')],[_0x98d8('0x46'),'id'])||{});}})[_0x98d8('0x21')](respondWithResult(_0x1b3381,null))['catch'](handleError(_0x1b3381,null));};exports[_0x98d8('0x47')]=function(_0x2311df,_0x4ee9cd,_0x4bce17){var _0x93b75f={};var _0x33c0e6={};var _0x593683;var _0x59df3d;return db[_0x98d8('0x28')]['findOne']({'where':{'id':_0x2311df[_0x98d8('0x3c')]['id']}})[_0x98d8('0x21')](handleEntityNotFound(_0x4ee9cd,null))[_0x98d8('0x21')](function(_0x5f0c7b){if(_0x5f0c7b){_0x593683=_0x5f0c7b;_0x33c0e6['model']=_['keys'](db[_0x98d8('0x45')][_0x98d8('0x3d')]);_0x33c0e6[_0x98d8('0x2d')]=_['keys'](_0x2311df[_0x98d8('0x2d')]);_0x33c0e6[_0x98d8('0x2e')]=_['intersection'](_0x33c0e6['model'],_0x33c0e6[_0x98d8('0x2d')]);_0x93b75f[_0x98d8('0x30')]=_['intersection'](_0x33c0e6['model'],qs[_0x98d8('0x31')](_0x2311df[_0x98d8('0x2d')][_0x98d8('0x31')]));_0x93b75f[_0x98d8('0x30')]=_0x93b75f[_0x98d8('0x30')][_0x98d8('0x3e')]?_0x93b75f['attributes']:_0x33c0e6[_0x98d8('0x2b')];_0x93b75f[_0x98d8('0x48')]=qs[_0x98d8('0x32')](_0x2311df[_0x98d8('0x2d')]['sort']);_0x93b75f[_0x98d8('0x35')]=qs['filters'](_[_0x98d8('0x33')](_0x2311df['query'],_0x33c0e6[_0x98d8('0x2e')]));if(_0x2311df[_0x98d8('0x2d')][_0x98d8('0x34')]){_0x93b75f[_0x98d8('0x35')]=_[_0x98d8('0x36')](_0x93b75f['where'],{'$or':_[_0x98d8('0x27')](_0x93b75f[_0x98d8('0x30')],function(_0x23af61){var _0x5b93ca={};_0x5b93ca[_0x23af61]={'$like':'%'+_0x2311df[_0x98d8('0x2d')][_0x98d8('0x34')]+'%'};return _0x5b93ca;})});}_0x93b75f=_['merge']({},_0x93b75f,_0x2311df[_0x98d8('0x37')]);return _0x593683[_0x98d8('0x47')](_0x93b75f);}})[_0x98d8('0x21')](function(_0x477f07){if(_0x477f07){_0x59df3d=_0x477f07[_0x98d8('0x3e')];if(!_0x2311df['query'][_0x98d8('0x49')](_0x98d8('0x4a'))){_0x93b75f['limit']=qs['limit'](_0x2311df[_0x98d8('0x2d')][_0x98d8('0x1b')]);_0x93b75f[_0x98d8('0x1a')]=qs['offset'](_0x2311df[_0x98d8('0x2d')][_0x98d8('0x1a')]);}return _0x593683[_0x98d8('0x47')](_0x93b75f);}})[_0x98d8('0x21')](function(_0x4fc4e6){if(_0x4fc4e6){return _0x4fc4e6?{'count':_0x59df3d,'rows':_0x4fc4e6}:null;}})['then'](respondWithResult(_0x4ee9cd,null))['catch'](handleError(_0x4ee9cd,null));};exports[_0x98d8('0x4b')]=function(_0x56c146,_0x221291,_0x24d039){return db['Action'][_0x98d8('0x43')]({'where':{'id':_0x56c146[_0x98d8('0x3c')]['id']}})[_0x98d8('0x21')](handleEntityNotFound(_0x221291,null))['then'](function(_0x3acac0){if(_0x3acac0){return _0x3acac0[_0x98d8('0x4b')](_0x56c146[_0x98d8('0x42')][_0x98d8('0x46')],_[_0x98d8('0x4c')](_0x56c146[_0x98d8('0x42')],[_0x98d8('0x46'),'id'])||{});}})[_0x98d8('0x21')](respondWithResult(_0x221291,null))['catch'](handleError(_0x221291,null));};exports[_0x98d8('0x4d')]=function(_0x2cff4c,_0x4ef913,_0x40a317){var _0x536100={};var _0x29f949={};var _0x10ded8;var _0x153167;return db['Automation']['findOne']({'where':{'id':_0x2cff4c['params']['id']}})[_0x98d8('0x21')](handleEntityNotFound(_0x4ef913,null))[_0x98d8('0x21')](function(_0x58f799){if(_0x58f799){_0x10ded8=_0x58f799;_0x29f949[_0x98d8('0x2b')]=_[_0x98d8('0x2c')](db[_0x98d8('0x4e')][_0x98d8('0x3d')]);_0x29f949[_0x98d8('0x2d')]=_[_0x98d8('0x2c')](_0x2cff4c[_0x98d8('0x2d')]);_0x29f949[_0x98d8('0x2e')]=_[_0x98d8('0x2f')](_0x29f949[_0x98d8('0x2b')],_0x29f949['query']);_0x536100['attributes']=_[_0x98d8('0x2f')](_0x29f949['model'],qs[_0x98d8('0x31')](_0x2cff4c['query'][_0x98d8('0x31')]));_0x536100[_0x98d8('0x30')]=_0x536100[_0x98d8('0x30')]['length']?_0x536100[_0x98d8('0x30')]:_0x29f949[_0x98d8('0x2b')];_0x536100[_0x98d8('0x48')]=qs[_0x98d8('0x32')](_0x2cff4c[_0x98d8('0x2d')][_0x98d8('0x32')]);_0x536100[_0x98d8('0x35')]=qs[_0x98d8('0x2e')](_[_0x98d8('0x33')](_0x2cff4c[_0x98d8('0x2d')],_0x29f949['filters']));if(_0x2cff4c[_0x98d8('0x2d')]['filter']){_0x536100[_0x98d8('0x35')]=_[_0x98d8('0x36')](_0x536100[_0x98d8('0x35')],{'$or':_[_0x98d8('0x27')](_0x536100[_0x98d8('0x30')],function(_0x133760){var _0x1e5599={};_0x1e5599[_0x133760]={'$like':'%'+_0x2cff4c[_0x98d8('0x2d')][_0x98d8('0x34')]+'%'};return _0x1e5599;})});}_0x536100=_[_0x98d8('0x36')]({},_0x536100,_0x2cff4c['options']);return _0x10ded8['getActions'](_0x536100);}})['then'](function(_0x19303f){if(_0x19303f){_0x153167=_0x19303f[_0x98d8('0x3e')];if(!_0x2cff4c[_0x98d8('0x2d')][_0x98d8('0x49')](_0x98d8('0x4a'))){_0x536100['limit']=qs[_0x98d8('0x1b')](_0x2cff4c[_0x98d8('0x2d')][_0x98d8('0x1b')]);_0x536100[_0x98d8('0x1a')]=qs[_0x98d8('0x1a')](_0x2cff4c[_0x98d8('0x2d')][_0x98d8('0x1a')]);}return _0x10ded8['getActions'](_0x536100);}})[_0x98d8('0x21')](function(_0x35eee5){if(_0x35eee5){return _0x35eee5?{'count':_0x153167,'rows':_0x35eee5}:null;}})[_0x98d8('0x21')](respondWithResult(_0x4ef913,null))[_0x98d8('0x3a')](handleError(_0x4ef913,null));}; \ No newline at end of file +var _0xca56=['hasOwnProperty','nolimit','limit','order','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','params','include','find','create','body','destroy','addConditions','Condition','ids','omit','findOne','sort','options','getConditions','addActions','Action','getActions','html-pdf','eml-format','zip-dir','bluebird','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','status','end','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','index','map','Automation','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length'];(function(_0x32b808,_0x42f040){var _0x14a0ea=function(_0x13e4fa){while(--_0x13e4fa){_0x32b808['push'](_0x32b808['shift']());}};_0x14a0ea(++_0x42f040);}(_0xca56,0x109));var _0x6ca5=function(_0x151681,_0x557bc3){_0x151681=_0x151681-0x0;var _0x4315bb=_0xca56[_0x151681];return _0x4315bb;};'use strict';var pdf=require(_0x6ca5('0x0'));var emlformat=require(_0x6ca5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6ca5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6ca5('0x3'));var Mustache=require(_0x6ca5('0x4'));var util=require(_0x6ca5('0x5'));var path=require(_0x6ca5('0x6'));var sox=require('sox');var csv=require(_0x6ca5('0x7'));var ejs=require(_0x6ca5('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6ca5('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6ca5('0xa'));var toCsv=require(_0x6ca5('0x7'));var querystring=require(_0x6ca5('0xb'));var Papa=require(_0x6ca5('0xc'));var Redis=require(_0x6ca5('0xd'));var authService=require(_0x6ca5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6ca5('0xf'));var hardwareService=require(_0x6ca5('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x6ca5('0x11'));var config=require('../../config/environment');var db=require(_0x6ca5('0x12'))['db'];function respondWithStatusCode(_0x21c50b,_0x16ea63){_0x16ea63=_0x16ea63||0xcc;return function(_0x1327de){if(_0x1327de){return _0x21c50b['sendStatus'](_0x16ea63);}return _0x21c50b[_0x6ca5('0x13')](_0x16ea63)[_0x6ca5('0x14')]();};}function respondWithResult(_0x575240,_0x29af15){_0x29af15=_0x29af15||0xc8;return function(_0x55cde0){if(_0x55cde0){return _0x575240['status'](_0x29af15)['json'](_0x55cde0);}};}function respondWithFilteredResult(_0x5ca020,_0x57ea7c){return function(_0x4ddbc1){if(_0x4ddbc1){var _0x565b32=_0x4ddbc1[_0x6ca5('0x15')],_0x2b7ac2=_0x57ea7c[_0x6ca5('0x16')],_0x6ef4b6=_0x57ea7c[_0x6ca5('0x16')]+_0x57ea7c['limit'],_0x17c74c;if(_0x6ef4b6>=_0x565b32){_0x6ef4b6=_0x565b32;_0x17c74c=0xc8;}else{_0x17c74c=0xce;}_0x5ca020[_0x6ca5('0x13')](_0x17c74c);return _0x5ca020['set'](_0x6ca5('0x17'),_0x2b7ac2+'-'+_0x6ef4b6+'/'+_0x565b32)['json'](_0x4ddbc1);}return null;};}function patchUpdates(_0x198772){return function(_0x1a1caf){try{jsonpatch[_0x6ca5('0x18')](_0x1a1caf,_0x198772,!![]);}catch(_0x17984b){return BPromise[_0x6ca5('0x19')](_0x17984b);}return _0x1a1caf[_0x6ca5('0x1a')]();};}function saveUpdates(_0xb382b7,_0x582d9d){return function(_0x4ad925){if(_0x4ad925){return _0x4ad925[_0x6ca5('0x1b')](_0xb382b7)[_0x6ca5('0x1c')](function(_0x208129){return _0x208129;});}return null;};}function removeEntity(_0x347572,_0x432a48){return function(_0x1806b3){if(_0x1806b3){return _0x1806b3['destroy']()[_0x6ca5('0x1c')](function(){_0x347572['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bd130,_0x2e1da5){return function(_0x216d5a){if(!_0x216d5a){_0x2bd130[_0x6ca5('0x1d')](0x194);}return _0x216d5a;};}function handleError(_0x2fc9db,_0x8203d0){_0x8203d0=_0x8203d0||0x1f4;return function(_0x219b20){logger[_0x6ca5('0x1e')](_0x219b20[_0x6ca5('0x1f')]);if(_0x219b20['name']){delete _0x219b20['name'];}_0x2fc9db[_0x6ca5('0x13')](_0x8203d0)['send'](_0x219b20);};}exports[_0x6ca5('0x20')]=function(_0x298224,_0xbb0b6){var _0xf2ea6f={},_0x4bc196={},_0x30658b={'count':0x0,'rows':[]};var _0xe7e45b=_[_0x6ca5('0x21')](db[_0x6ca5('0x22')][_0x6ca5('0x23')],function(_0x38b135){return{'name':_0x38b135[_0x6ca5('0x24')],'type':_0x38b135[_0x6ca5('0x25')][_0x6ca5('0x26')]};});_0x4bc196[_0x6ca5('0x27')]=_['map'](_0xe7e45b,_0x6ca5('0x28'));_0x4bc196[_0x6ca5('0x29')]=_[_0x6ca5('0x2a')](_0x298224[_0x6ca5('0x29')]);_0x4bc196['filters']=_[_0x6ca5('0x2b')](_0x4bc196['model'],_0x4bc196[_0x6ca5('0x29')]);_0xf2ea6f[_0x6ca5('0x2c')]=_['intersection'](_0x4bc196[_0x6ca5('0x27')],qs['fields'](_0x298224['query'][_0x6ca5('0x2d')]));_0xf2ea6f[_0x6ca5('0x2c')]=_0xf2ea6f[_0x6ca5('0x2c')][_0x6ca5('0x2e')]?_0xf2ea6f['attributes']:_0x4bc196['model'];if(!_0x298224[_0x6ca5('0x29')][_0x6ca5('0x2f')](_0x6ca5('0x30'))){_0xf2ea6f[_0x6ca5('0x31')]=qs[_0x6ca5('0x31')](_0x298224[_0x6ca5('0x29')][_0x6ca5('0x31')]);_0xf2ea6f['offset']=qs[_0x6ca5('0x16')](_0x298224[_0x6ca5('0x29')][_0x6ca5('0x16')]);}_0xf2ea6f[_0x6ca5('0x32')]=qs['sort'](_0x298224[_0x6ca5('0x29')]['sort']);_0xf2ea6f['where']=qs[_0x6ca5('0x33')](_[_0x6ca5('0x34')](_0x298224[_0x6ca5('0x29')],_0x4bc196[_0x6ca5('0x33')]),_0xe7e45b);if(_0x298224[_0x6ca5('0x29')][_0x6ca5('0x35')]){_0xf2ea6f[_0x6ca5('0x36')]=_[_0x6ca5('0x37')](_0xf2ea6f[_0x6ca5('0x36')],{'$or':_['map'](_0xe7e45b,function(_0x6d990e){if(_0x6d990e[_0x6ca5('0x25')]!==_0x6ca5('0x38')){var _0x26c901={};_0x26c901[_0x6d990e[_0x6ca5('0x28')]]={'$like':'%'+_0x298224['query'][_0x6ca5('0x35')]+'%'};return _0x26c901;}})});}_0xf2ea6f=_[_0x6ca5('0x37')]({},_0xf2ea6f,_0x298224['options']);var _0x37c99c={'where':_0xf2ea6f[_0x6ca5('0x36')]};return db['Automation'][_0x6ca5('0x15')](_0x37c99c)[_0x6ca5('0x1c')](function(_0x5d2a07){_0x30658b[_0x6ca5('0x15')]=_0x5d2a07;if(_0x298224[_0x6ca5('0x29')][_0x6ca5('0x39')]){_0xf2ea6f['include']=[{'all':!![]}];}return db[_0x6ca5('0x22')][_0x6ca5('0x3a')](_0xf2ea6f);})['then'](function(_0x80e40){_0x30658b[_0x6ca5('0x3b')]=_0x80e40;return _0x30658b;})['then'](respondWithFilteredResult(_0xbb0b6,_0xf2ea6f))[_0x6ca5('0x3c')](handleError(_0xbb0b6,null));};exports['show']=function(_0x52e8de,_0x29d085){var _0x26a199={'raw':![],'where':{'id':_0x52e8de[_0x6ca5('0x3d')]['id']}},_0x31f3cf={};_0x31f3cf[_0x6ca5('0x27')]=_[_0x6ca5('0x2a')](db[_0x6ca5('0x22')][_0x6ca5('0x23')]);_0x31f3cf[_0x6ca5('0x29')]=_[_0x6ca5('0x2a')](_0x52e8de['query']);_0x31f3cf['filters']=_[_0x6ca5('0x2b')](_0x31f3cf['model'],_0x31f3cf['query']);_0x26a199[_0x6ca5('0x2c')]=_[_0x6ca5('0x2b')](_0x31f3cf[_0x6ca5('0x27')],qs[_0x6ca5('0x2d')](_0x52e8de[_0x6ca5('0x29')][_0x6ca5('0x2d')]));_0x26a199[_0x6ca5('0x2c')]=_0x26a199['attributes'][_0x6ca5('0x2e')]?_0x26a199[_0x6ca5('0x2c')]:_0x31f3cf[_0x6ca5('0x27')];if(_0x52e8de['query'][_0x6ca5('0x39')]){_0x26a199[_0x6ca5('0x3e')]=[{'all':!![]}];}_0x26a199=_['merge']({},_0x26a199,_0x52e8de['options']);return db[_0x6ca5('0x22')][_0x6ca5('0x3f')](_0x26a199)[_0x6ca5('0x1c')](handleEntityNotFound(_0x29d085,null))[_0x6ca5('0x1c')](respondWithResult(_0x29d085,null))[_0x6ca5('0x3c')](handleError(_0x29d085,null));};exports[_0x6ca5('0x40')]=function(_0x3be20a,_0x5ee2f8){return db['Automation'][_0x6ca5('0x40')](_0x3be20a[_0x6ca5('0x41')],{})[_0x6ca5('0x1c')](respondWithResult(_0x5ee2f8,0xc9))['catch'](handleError(_0x5ee2f8,null));};exports[_0x6ca5('0x1b')]=function(_0x598c3b,_0x29052f){if(_0x598c3b[_0x6ca5('0x41')]['id']){delete _0x598c3b['body']['id'];}return db[_0x6ca5('0x22')][_0x6ca5('0x3f')]({'where':{'id':_0x598c3b[_0x6ca5('0x3d')]['id']}})[_0x6ca5('0x1c')](handleEntityNotFound(_0x29052f,null))[_0x6ca5('0x1c')](saveUpdates(_0x598c3b[_0x6ca5('0x41')],null))['then'](respondWithResult(_0x29052f,null))['catch'](handleError(_0x29052f,null));};exports[_0x6ca5('0x42')]=function(_0x50bec5,_0x1ac8a9){return db[_0x6ca5('0x22')]['find']({'where':{'id':_0x50bec5[_0x6ca5('0x3d')]['id']}})[_0x6ca5('0x1c')](handleEntityNotFound(_0x1ac8a9,null))[_0x6ca5('0x1c')](removeEntity(_0x1ac8a9,null))[_0x6ca5('0x3c')](handleError(_0x1ac8a9,null));};exports[_0x6ca5('0x43')]=function(_0x349fea,_0x5069cc,_0x1f9e2a){return db[_0x6ca5('0x44')][_0x6ca5('0x3f')]({'where':{'id':_0x349fea['params']['id']}})[_0x6ca5('0x1c')](handleEntityNotFound(_0x5069cc,null))[_0x6ca5('0x1c')](function(_0x3c8f92){if(_0x3c8f92){return _0x3c8f92[_0x6ca5('0x43')](_0x349fea['body'][_0x6ca5('0x45')],_[_0x6ca5('0x46')](_0x349fea[_0x6ca5('0x41')],[_0x6ca5('0x45'),'id'])||{});}})[_0x6ca5('0x1c')](respondWithResult(_0x5069cc,null))[_0x6ca5('0x3c')](handleError(_0x5069cc,null));};exports['getConditions']=function(_0x28f1b4,_0x3152ed,_0x735814){var _0x2cae43={};var _0x321f28={};var _0x30b1da;var _0x5a2cb4;return db[_0x6ca5('0x22')][_0x6ca5('0x47')]({'where':{'id':_0x28f1b4['params']['id']}})[_0x6ca5('0x1c')](handleEntityNotFound(_0x3152ed,null))[_0x6ca5('0x1c')](function(_0x4844c5){if(_0x4844c5){_0x30b1da=_0x4844c5;_0x321f28[_0x6ca5('0x27')]=_['keys'](db[_0x6ca5('0x44')][_0x6ca5('0x23')]);_0x321f28['query']=_['keys'](_0x28f1b4[_0x6ca5('0x29')]);_0x321f28[_0x6ca5('0x33')]=_[_0x6ca5('0x2b')](_0x321f28[_0x6ca5('0x27')],_0x321f28[_0x6ca5('0x29')]);_0x2cae43[_0x6ca5('0x2c')]=_[_0x6ca5('0x2b')](_0x321f28[_0x6ca5('0x27')],qs['fields'](_0x28f1b4['query'][_0x6ca5('0x2d')]));_0x2cae43[_0x6ca5('0x2c')]=_0x2cae43['attributes'][_0x6ca5('0x2e')]?_0x2cae43[_0x6ca5('0x2c')]:_0x321f28[_0x6ca5('0x27')];_0x2cae43[_0x6ca5('0x32')]=qs[_0x6ca5('0x48')](_0x28f1b4[_0x6ca5('0x29')]['sort']);_0x2cae43[_0x6ca5('0x36')]=qs[_0x6ca5('0x33')](_[_0x6ca5('0x34')](_0x28f1b4[_0x6ca5('0x29')],_0x321f28[_0x6ca5('0x33')]));if(_0x28f1b4[_0x6ca5('0x29')][_0x6ca5('0x35')]){_0x2cae43[_0x6ca5('0x36')]=_[_0x6ca5('0x37')](_0x2cae43['where'],{'$or':_[_0x6ca5('0x21')](_0x2cae43[_0x6ca5('0x2c')],function(_0x456800){var _0xa5011={};_0xa5011[_0x456800]={'$like':'%'+_0x28f1b4[_0x6ca5('0x29')][_0x6ca5('0x35')]+'%'};return _0xa5011;})});}_0x2cae43=_[_0x6ca5('0x37')]({},_0x2cae43,_0x28f1b4[_0x6ca5('0x49')]);return _0x30b1da['getConditions'](_0x2cae43);}})['then'](function(_0x5b1d03){if(_0x5b1d03){_0x5a2cb4=_0x5b1d03[_0x6ca5('0x2e')];if(!_0x28f1b4[_0x6ca5('0x29')][_0x6ca5('0x2f')](_0x6ca5('0x30'))){_0x2cae43[_0x6ca5('0x31')]=qs[_0x6ca5('0x31')](_0x28f1b4['query']['limit']);_0x2cae43[_0x6ca5('0x16')]=qs[_0x6ca5('0x16')](_0x28f1b4['query']['offset']);}return _0x30b1da[_0x6ca5('0x4a')](_0x2cae43);}})[_0x6ca5('0x1c')](function(_0x12b44f){if(_0x12b44f){return _0x12b44f?{'count':_0x5a2cb4,'rows':_0x12b44f}:null;}})[_0x6ca5('0x1c')](respondWithResult(_0x3152ed,null))[_0x6ca5('0x3c')](handleError(_0x3152ed,null));};exports[_0x6ca5('0x4b')]=function(_0x5e83d5,_0x15abb4,_0x25e787){return db[_0x6ca5('0x4c')][_0x6ca5('0x3f')]({'where':{'id':_0x5e83d5['params']['id']}})['then'](handleEntityNotFound(_0x15abb4,null))['then'](function(_0x6f666d){if(_0x6f666d){return _0x6f666d[_0x6ca5('0x4b')](_0x5e83d5[_0x6ca5('0x41')][_0x6ca5('0x45')],_[_0x6ca5('0x46')](_0x5e83d5[_0x6ca5('0x41')],[_0x6ca5('0x45'),'id'])||{});}})['then'](respondWithResult(_0x15abb4,null))[_0x6ca5('0x3c')](handleError(_0x15abb4,null));};exports[_0x6ca5('0x4d')]=function(_0xab2454,_0x171c70,_0x1e8273){var _0x18b72a={};var _0x214309={};var _0x37ba80;var _0x332089;return db[_0x6ca5('0x22')][_0x6ca5('0x47')]({'where':{'id':_0xab2454[_0x6ca5('0x3d')]['id']}})[_0x6ca5('0x1c')](handleEntityNotFound(_0x171c70,null))[_0x6ca5('0x1c')](function(_0x4dfa70){if(_0x4dfa70){_0x37ba80=_0x4dfa70;_0x214309[_0x6ca5('0x27')]=_[_0x6ca5('0x2a')](db[_0x6ca5('0x4c')][_0x6ca5('0x23')]);_0x214309[_0x6ca5('0x29')]=_[_0x6ca5('0x2a')](_0xab2454[_0x6ca5('0x29')]);_0x214309[_0x6ca5('0x33')]=_[_0x6ca5('0x2b')](_0x214309[_0x6ca5('0x27')],_0x214309[_0x6ca5('0x29')]);_0x18b72a[_0x6ca5('0x2c')]=_[_0x6ca5('0x2b')](_0x214309['model'],qs['fields'](_0xab2454['query']['fields']));_0x18b72a[_0x6ca5('0x2c')]=_0x18b72a[_0x6ca5('0x2c')]['length']?_0x18b72a['attributes']:_0x214309[_0x6ca5('0x27')];_0x18b72a[_0x6ca5('0x32')]=qs[_0x6ca5('0x48')](_0xab2454[_0x6ca5('0x29')]['sort']);_0x18b72a[_0x6ca5('0x36')]=qs[_0x6ca5('0x33')](_[_0x6ca5('0x34')](_0xab2454[_0x6ca5('0x29')],_0x214309['filters']));if(_0xab2454[_0x6ca5('0x29')][_0x6ca5('0x35')]){_0x18b72a[_0x6ca5('0x36')]=_['merge'](_0x18b72a[_0x6ca5('0x36')],{'$or':_[_0x6ca5('0x21')](_0x18b72a[_0x6ca5('0x2c')],function(_0xbcd676){var _0x1b8cfe={};_0x1b8cfe[_0xbcd676]={'$like':'%'+_0xab2454[_0x6ca5('0x29')][_0x6ca5('0x35')]+'%'};return _0x1b8cfe;})});}_0x18b72a=_[_0x6ca5('0x37')]({},_0x18b72a,_0xab2454['options']);return _0x37ba80['getActions'](_0x18b72a);}})[_0x6ca5('0x1c')](function(_0xab5eea){if(_0xab5eea){_0x332089=_0xab5eea[_0x6ca5('0x2e')];if(!_0xab2454[_0x6ca5('0x29')][_0x6ca5('0x2f')]('nolimit')){_0x18b72a['limit']=qs['limit'](_0xab2454['query'][_0x6ca5('0x31')]);_0x18b72a[_0x6ca5('0x16')]=qs[_0x6ca5('0x16')](_0xab2454[_0x6ca5('0x29')][_0x6ca5('0x16')]);}return _0x37ba80['getActions'](_0x18b72a);}})[_0x6ca5('0x1c')](function(_0x503ddf){if(_0x503ddf){return _0x503ddf?{'count':_0x332089,'rows':_0x503ddf}:null;}})[_0x6ca5('0x1c')](respondWithResult(_0x171c70,null))['catch'](handleError(_0x171c70,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 33b5103..a858bce 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 _0xae24=['../../config/logger','moment','bluebird','rimraf','./automation.attributes','exports','define','Automation','lodash'];(function(_0x5169a4,_0x270720){var _0x17579f=function(_0x23d9c2){while(--_0x23d9c2){_0x5169a4['push'](_0x5169a4['shift']());}};_0x17579f(++_0x270720);}(_0xae24,0x182));var _0x4ae2=function(_0x2ad8f6,_0x182da9){_0x2ad8f6=_0x2ad8f6-0x0;var _0xb4a88f=_0xae24[_0x2ad8f6];return _0xb4a88f;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var logger=require(_0x4ae2('0x1'))('api');var moment=require(_0x4ae2('0x2'));var BPromise=require(_0x4ae2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ae2('0x4'));var config=require('../../config/environment');var attributes=require(_0x4ae2('0x5'));module[_0x4ae2('0x6')]=function(_0x20c85c,_0x3e6055){return _0x20c85c[_0x4ae2('0x7')](_0x4ae2('0x8'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5075=['bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','define','tools_automations','lodash','util','../../config/logger','api','moment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5075,0x73));var _0x5507=function(_0x3ba566,_0x5e009d){_0x3ba566=_0x3ba566-0x0;var _0x480317=_0x5075[_0x3ba566];return _0x480317;};'use strict';var _=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var logger=require(_0x5507('0x2'))(_0x5507('0x3'));var moment=require(_0x5507('0x4'));var BPromise=require(_0x5507('0x5'));var rp=require(_0x5507('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var attributes=require(_0x5507('0x9'));module['exports']=function(_0x5b6d7f,_0x2cd9ee){return _0x5b6d7f[_0x5507('0xa')]('Automation',attributes,{'tableName':_0x5507('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 476d38c..c2add1d 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 _0x8fcd=['Automation,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x3f6565,_0x12a8bb){var _0x4abd23=function(_0x56dce7){while(--_0x56dce7){_0x3f6565['push'](_0x3f6565['shift']());}};_0x4abd23(++_0x12a8bb);}(_0x8fcd,0xf4));var _0xd8fc=function(_0x3fff1c,_0x1b137c){_0x3fff1c=_0x3fff1c-0x0;var _0x130243=_0x8fcd[_0x3fff1c];return _0x130243;};'use strict';var _=require(_0xd8fc('0x0'));var util=require(_0xd8fc('0x1'));var moment=require('moment');var BPromise=require(_0xd8fc('0x2'));var rs=require(_0xd8fc('0x3'));var fs=require('fs');var Redis=require(_0xd8fc('0x4'));var db=require(_0xd8fc('0x5'))['db'];var utils=require(_0xd8fc('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd8fc('0x7'));var jayson=require(_0xd8fc('0x8'));var client=jayson[_0xd8fc('0x9')][_0xd8fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58d799,_0x2aec47,_0x4a0220){return new BPromise(function(_0x2f4559,_0x5b7392){return client[_0xd8fc('0xb')](_0x58d799,_0x4a0220)[_0xd8fc('0xc')](function(_0x3e9c49){logger[_0xd8fc('0xd')]('Automation,\x20%s,\x20%s',_0x2aec47,_0xd8fc('0xe'));logger[_0xd8fc('0xf')](_0xd8fc('0x10'),_0x2aec47,_0xd8fc('0xe'),JSON[_0xd8fc('0x11')](_0x3e9c49));if(_0x3e9c49['error']){if(_0x3e9c49['error'][_0xd8fc('0x12')]===0x1f4){logger[_0xd8fc('0x13')](_0xd8fc('0x14'),_0x2aec47,_0x3e9c49['error']['message']);return _0x5b7392(_0x3e9c49['error'][_0xd8fc('0x15')]);}logger['error'](_0xd8fc('0x14'),_0x2aec47,_0x3e9c49[_0xd8fc('0x13')]['message']);return _0x2f4559(_0x3e9c49[_0xd8fc('0x13')][_0xd8fc('0x15')]);}else{logger[_0xd8fc('0xd')](_0xd8fc('0x14'),_0x2aec47,_0xd8fc('0xe'));_0x2f4559(_0x3e9c49[_0xd8fc('0x16')][_0xd8fc('0x15')]);}})[_0xd8fc('0x17')](function(_0x45eb2){logger[_0xd8fc('0x13')]('Automation,\x20%s,\x20%s',_0x2aec47,_0x45eb2);_0x5b7392(_0x45eb2);});});} \ No newline at end of file +var _0xf0ab=['Automation,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf0ab,0x17c));var _0xbf0a=function(_0x2b86f9,_0x35fcda){_0x2b86f9=_0x2b86f9-0x0;var _0x421038=_0xf0ab[_0x2b86f9];return _0x421038;};'use strict';var _=require(_0xbf0a('0x0'));var util=require(_0xbf0a('0x1'));var moment=require(_0xbf0a('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf0a('0x3'));var fs=require('fs');var Redis=require(_0xbf0a('0x4'));var db=require(_0xbf0a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbf0a('0x6'));var config=require(_0xbf0a('0x7'));var jayson=require(_0xbf0a('0x8'));var client=jayson[_0xbf0a('0x9')][_0xbf0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f4e27,_0x24677a,_0x1b8661){return new BPromise(function(_0x15fd59,_0xb2072f){return client['request'](_0x4f4e27,_0x1b8661)[_0xbf0a('0xb')](function(_0xb01e0b){logger[_0xbf0a('0xc')](_0xbf0a('0xd'),_0x24677a,_0xbf0a('0xe'));logger[_0xbf0a('0xf')](_0xbf0a('0x10'),_0x24677a,_0xbf0a('0xe'),JSON[_0xbf0a('0x11')](_0xb01e0b));if(_0xb01e0b['error']){if(_0xb01e0b['error'][_0xbf0a('0x12')]===0x1f4){logger[_0xbf0a('0x13')]('Automation,\x20%s,\x20%s',_0x24677a,_0xb01e0b[_0xbf0a('0x13')][_0xbf0a('0x14')]);return _0xb2072f(_0xb01e0b[_0xbf0a('0x13')][_0xbf0a('0x14')]);}logger[_0xbf0a('0x13')]('Automation,\x20%s,\x20%s',_0x24677a,_0xb01e0b[_0xbf0a('0x13')]['message']);return _0x15fd59(_0xb01e0b[_0xbf0a('0x13')]['message']);}else{logger['info'](_0xbf0a('0xd'),_0x24677a,'request\x20sent');_0x15fd59(_0xb01e0b['result'][_0xbf0a('0x14')]);}})[_0xbf0a('0x15')](function(_0xcc575){logger[_0xbf0a('0x13')](_0xbf0a('0xd'),_0x24677a,_0xcc575);_0xb2072f(_0xcc575);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index b4e37ac..3aa4481 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 _0xf8eb=['/:id/actions','getActions','post','create','addConditions','addActions','put','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','getConditions'];(function(_0x2fae9e,_0x43e068){var _0x3fa1cf=function(_0x4921b0){while(--_0x4921b0){_0x2fae9e['push'](_0x2fae9e['shift']());}};_0x3fa1cf(++_0x43e068);}(_0xf8eb,0x159));var _0xbf8e=function(_0x3cfaff,_0x37f317){_0x3cfaff=_0x3cfaff-0x0;var _0x39b714=_0xf8eb[_0x3cfaff];return _0x39b714;};'use strict';var multer=require(_0xbf8e('0x0'));var util=require(_0xbf8e('0x1'));var path=require(_0xbf8e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf8e('0x3')]();var auth=require(_0xbf8e('0x4'));var interaction=require(_0xbf8e('0x5'));var config=require(_0xbf8e('0x6'));var controller=require(_0xbf8e('0x7'));router['get']('/',auth[_0xbf8e('0x8')](),controller[_0xbf8e('0x9')]);router[_0xbf8e('0xa')](_0xbf8e('0xb'),auth[_0xbf8e('0x8')](),controller[_0xbf8e('0xc')]);router[_0xbf8e('0xa')](_0xbf8e('0xd'),auth[_0xbf8e('0x8')](),controller[_0xbf8e('0xe')]);router[_0xbf8e('0xa')](_0xbf8e('0xf'),auth['isAuthenticated'](),controller[_0xbf8e('0x10')]);router[_0xbf8e('0x11')]('/',auth[_0xbf8e('0x8')](),controller[_0xbf8e('0x12')]);router[_0xbf8e('0x11')](_0xbf8e('0xd'),auth[_0xbf8e('0x8')](),controller[_0xbf8e('0x13')]);router['post'](_0xbf8e('0xf'),auth['isAuthenticated'](),controller[_0xbf8e('0x14')]);router[_0xbf8e('0x15')](_0xbf8e('0xb'),auth[_0xbf8e('0x8')](),controller['update']);router[_0xbf8e('0x16')]('/:id',auth[_0xbf8e('0x8')](),controller['destroy']);module[_0xbf8e('0x17')]=router; \ No newline at end of file +var _0x8cdb=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','update'];(function(_0x28ac9d,_0x10c052){var _0x201d5f=function(_0x20d7f1){while(--_0x20d7f1){_0x28ac9d['push'](_0x28ac9d['shift']());}};_0x201d5f(++_0x10c052);}(_0x8cdb,0x193));var _0xb8cd=function(_0x3f3c01,_0x159e9d){_0x3f3c01=_0x3f3c01-0x0;var _0x5a6be2=_0x8cdb[_0x3f3c01];return _0x5a6be2;};'use strict';var multer=require(_0xb8cd('0x0'));var util=require(_0xb8cd('0x1'));var path=require(_0xb8cd('0x2'));var timeout=require(_0xb8cd('0x3'));var express=require('express');var router=express[_0xb8cd('0x4')]();var auth=require(_0xb8cd('0x5'));var interaction=require(_0xb8cd('0x6'));var config=require(_0xb8cd('0x7'));var controller=require(_0xb8cd('0x8'));router[_0xb8cd('0x9')]('/',auth[_0xb8cd('0xa')](),controller['index']);router[_0xb8cd('0x9')](_0xb8cd('0xb'),auth[_0xb8cd('0xa')](),controller[_0xb8cd('0xc')]);router[_0xb8cd('0x9')](_0xb8cd('0xd'),auth['isAuthenticated'](),controller[_0xb8cd('0xe')]);router[_0xb8cd('0x9')](_0xb8cd('0xf'),auth['isAuthenticated'](),controller[_0xb8cd('0x10')]);router[_0xb8cd('0x11')]('/',auth['isAuthenticated'](),controller[_0xb8cd('0x12')]);router[_0xb8cd('0x11')](_0xb8cd('0xd'),auth[_0xb8cd('0xa')](),controller['addConditions']);router[_0xb8cd('0x11')]('/:id/actions',auth[_0xb8cd('0xa')](),controller[_0xb8cd('0x13')]);router[_0xb8cd('0x14')](_0xb8cd('0xb'),auth[_0xb8cd('0xa')](),controller[_0xb8cd('0x15')]);router[_0xb8cd('0x16')](_0xb8cd('0xb'),auth[_0xb8cd('0xa')](),controller[_0xb8cd('0x17')]);module[_0xb8cd('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 011cf0e..335073b 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 _0x2e8e=['#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING','ENUM','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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e8e,0xee));var _0xe2e8=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0x2e8e[_0x1ebc6c];return _0x3a826d;};'use strict';var Sequelize=require('sequelize');module[_0xe2e8('0x0')]={'name':{'type':Sequelize[_0xe2e8('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xe2e8('0x2')](_0xe2e8('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xe2e8('0x1')]},'active':{'type':Sequelize[_0xe2e8('0x4')],'defaultValue':0x0,'comment':_0xe2e8('0x5')},'limitCalls':{'type':Sequelize[_0xe2e8('0x6')](0x4)[_0xe2e8('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xe2e8('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xe2e8('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xe2e8('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xe2e8('0x6')](0x3)[_0xe2e8('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe2e8('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe2e8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe2e8('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe2e8('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe2e8('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xe2e8('0x6')](0x3)[_0xe2e8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xe2e8('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe2e8('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe2e8('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe2e8('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xe2e8('0x6')](0x3)[_0xe2e8('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe2e8('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe2e8('0x1')],'defaultValue':_0xe2e8('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xe2e8('0x2')]('always','never',_0xe2e8('0xf')),'defaultValue':_0xe2e8('0x10')},'dialAMDActive':{'type':Sequelize[_0xe2e8('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xe2e8('0x6')](0x9)[_0xe2e8('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe2e8('0x11')},'dialAMDGreeting':{'type':Sequelize[_0xe2e8('0x6')](0x9)[_0xe2e8('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe2e8('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe2e8('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe2e8('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe2e8('0x6')](0x9)[_0xe2e8('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xe2e8('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe2e8('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe2e8('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe2e8('0x6')](0x9)[_0xe2e8('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe2e8('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xe2e8('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe2e8('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xe2e8('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xe2e8('0x2')](_0xe2e8('0x17'),'ASC'),'defaultValue':_0xe2e8('0x17')},'dialPrefix':{'type':Sequelize[_0xe2e8('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe2e8('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe2e8('0x18')},'dialCutDigit':{'type':Sequelize[_0xe2e8('0x6')](0x3)[_0xe2e8('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe2e8('0x19')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe2e8('0x6')](0x3)[_0xe2e8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe2e8('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe2e8('0x6')](0x5)[_0xe2e8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe2e8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe2e8('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0xe2e8('0x6')](0x5)[_0xe2e8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe2e8('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe2e8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe2e8('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe2e8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe2e8('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0xe2e8('0x6')](0x3)[_0xe2e8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xe2e8('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe2e8('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe2e8('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe2e8('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe2e8('0x6')](0x5)[_0xe2e8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x7d27=['never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x7d27,0x84));var _0x77d2=function(_0x3874ab,_0x1e2dec){_0x3874ab=_0x3874ab-0x0;var _0x3b90e8=_0x7d27[_0x3874ab];return _0x3b90e8;};'use strict';var Sequelize=require(_0x77d2('0x0'));module[_0x77d2('0x1')]={'name':{'type':Sequelize[_0x77d2('0x2')],'unique':_0x77d2('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x77d2('0x4')),'allowNull':![],'defaultValue':_0x77d2('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x77d2('0x5')],'defaultValue':0x0,'comment':_0x77d2('0x6')},'limitCalls':{'type':Sequelize[_0x77d2('0x7')](0x4)[_0x77d2('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x77d2('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x77d2('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x77d2('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x77d2('0x7')](0x3)[_0x77d2('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x77d2('0x7')](0x3)[_0x77d2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x77d2('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x77d2('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x77d2('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x77d2('0x7')](0x3)[_0x77d2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x77d2('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x77d2('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x77d2('0x8')],'defaultValue':0x3,'comment':_0x77d2('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x77d2('0x7')](0x5)[_0x77d2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x77d2('0x7')](0x3)[_0x77d2('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x77d2('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x77d2('0xf'),_0x77d2('0x10'),_0x77d2('0x11')),'defaultValue':_0x77d2('0xf')},'dialAMDActive':{'type':Sequelize[_0x77d2('0x5')],'defaultValue':0x0,'comment':_0x77d2('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x77d2('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x77d2('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x77d2('0x7')](0x9)[_0x77d2('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x77d2('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x77d2('0x7')](0x9)[_0x77d2('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x77d2('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x77d2('0x7')](0x9)[_0x77d2('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x77d2('0x7')](0x9)[_0x77d2('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x77d2('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x77d2('0x7')](0x9)[_0x77d2('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x77d2('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x77d2('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x77d2('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x77d2('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x77d2('0x18'),_0x77d2('0x19')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x77d2('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x77d2('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x77d2('0x1a')},'dialCutDigit':{'type':Sequelize[_0x77d2('0x7')](0x3)[_0x77d2('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x77d2('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x77d2('0x7')](0x3)[_0x77d2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x77d2('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x77d2('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x77d2('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x77d2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x77d2('0x7')](0x5)[_0x77d2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x77d2('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x77d2('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x77d2('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x77d2('0x7')](0x5)[_0x77d2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x77d2('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x77d2('0x7')](0x3)[_0x77d2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x77d2('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x77d2('0x7')](0x5)[_0x77d2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x77d2('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x77d2('0x7')](0x3)[_0x77d2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x77d2('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x77d2('0x7')](0x5)[_0x77d2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x77d2('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index c3d3d41..fdcdd59 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 _0x35cd=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','status','json','offset','limit','set','Content-Range','reject','update','then','IvrCampaigns','UserProfileResource','destroy','sendStatus','error','name','send','index','map','Campaign','type','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','rawAttributes','fields','find','catch','create','role','user','get','UserProfileSection','userProfileId','autoAssociation','clone','length','createdAt','updatedAt','body','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','order','sort','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','cm_hopper','fromQuery','cm_contacts','COALESCE(phone,\x27\x27)','push','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js'];(function(_0x4f34d1,_0x15d0b8){var _0x3106a4=function(_0x4468ca){while(--_0x4468ca){_0x4f34d1['push'](_0x4f34d1['shift']());}};_0x3106a4(++_0x15d0b8);}(_0x35cd,0xfc));var _0xd35c=function(_0x36405a,_0x762511){_0x36405a=_0x36405a-0x0;var _0x443a48=_0x35cd[_0x36405a];return _0x443a48;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd35c('0x0'));var rimraf=require(_0xd35c('0x1'));var zipdir=require(_0xd35c('0x2'));var jsonpatch=require(_0xd35c('0x3'));var rp=require(_0xd35c('0x4'));var moment=require(_0xd35c('0x5'));var BPromise=require(_0xd35c('0x6'));var Mustache=require(_0xd35c('0x7'));var util=require(_0xd35c('0x8'));var path=require(_0xd35c('0x9'));var sox=require(_0xd35c('0xa'));var csv=require(_0xd35c('0xb'));var ejs=require(_0xd35c('0xc'));var fs=require('fs');var _=require(_0xd35c('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd35c('0xe'));var deskjs=require(_0xd35c('0xf'));var toCsv=require(_0xd35c('0xb'));var querystring=require(_0xd35c('0x10'));var Papa=require(_0xd35c('0x11'));var Redis=require('ioredis');var authService=require(_0xd35c('0x12'));var qs=require(_0xd35c('0x13'));var as=require(_0xd35c('0x14'));var hardwareService=require(_0xd35c('0x15'));var logger=require('../../config/logger')(_0xd35c('0x16'));var utils=require(_0xd35c('0x17'));var config=require('../../config/environment');var db=require(_0xd35c('0x18'))['db'];function respondWithStatusCode(_0x31e59b,_0x2ce633){_0x2ce633=_0x2ce633||0xcc;return function(_0x313630){if(_0x313630){return _0x31e59b['sendStatus'](_0x2ce633);}return _0x31e59b['status'](_0x2ce633)[_0xd35c('0x19')]();};}function respondWithResult(_0x284175,_0x3d3293){_0x3d3293=_0x3d3293||0xc8;return function(_0x168e27){if(_0x168e27){return _0x284175[_0xd35c('0x1a')](_0x3d3293)[_0xd35c('0x1b')](_0x168e27);}};}function respondWithFilteredResult(_0x38a25c,_0xdc1ba2){return function(_0x22fcfa){if(_0x22fcfa){var _0x142cc3=_0x22fcfa['count'],_0xeb9b4a=_0xdc1ba2[_0xd35c('0x1c')],_0x10599a=_0xdc1ba2[_0xd35c('0x1c')]+_0xdc1ba2[_0xd35c('0x1d')],_0x3999d3;if(_0x10599a>=_0x142cc3){_0x10599a=_0x142cc3;_0x3999d3=0xc8;}else{_0x3999d3=0xce;}_0x38a25c[_0xd35c('0x1a')](_0x3999d3);return _0x38a25c[_0xd35c('0x1e')](_0xd35c('0x1f'),_0xeb9b4a+'-'+_0x10599a+'/'+_0x142cc3)[_0xd35c('0x1b')](_0x22fcfa);}return null;};}function patchUpdates(_0x28980e){return function(_0x4b3d0f){try{jsonpatch['apply'](_0x4b3d0f,_0x28980e,!![]);}catch(_0x31d14b){return BPromise[_0xd35c('0x20')](_0x31d14b);}return _0x4b3d0f['save']();};}function saveUpdates(_0x20342a,_0x371595){return function(_0x1cf5cd){if(_0x1cf5cd){return _0x1cf5cd[_0xd35c('0x21')](_0x20342a)['then'](function(_0x25bddd){return _0x25bddd;});}return null;};}function removeEntity(_0x76da2,_0x290911){return function(_0x44fc50){if(_0x44fc50){return _0x44fc50['destroy']()[_0xd35c('0x22')](function(){var _0x2242dd=_0x44fc50['get']({'plain':!![]});var _0x3fc98c=_0xd35c('0x23');return db[_0xd35c('0x24')][_0xd35c('0x25')]({'where':{'type':_0x3fc98c,'resourceId':_0x2242dd['id']}})[_0xd35c('0x22')](function(){return _0x44fc50;});})[_0xd35c('0x22')](function(){_0x76da2['status'](0xcc)[_0xd35c('0x19')]();});}};}function handleEntityNotFound(_0x2efd6e,_0x55358f){return function(_0x27939f){if(!_0x27939f){_0x2efd6e[_0xd35c('0x26')](0x194);}return _0x27939f;};}function handleError(_0x25aa77,_0x5eeb86){_0x5eeb86=_0x5eeb86||0x1f4;return function(_0x42e6a6){logger[_0xd35c('0x27')](_0x42e6a6['stack']);if(_0x42e6a6['name']){delete _0x42e6a6[_0xd35c('0x28')];}_0x25aa77[_0xd35c('0x1a')](_0x5eeb86)[_0xd35c('0x29')](_0x42e6a6);};}exports[_0xd35c('0x2a')]=function(_0x3063de,_0x358805){var _0x4f85f6={},_0x162668={},_0x369522={'count':0x0,'rows':[]};var _0x23230e=_[_0xd35c('0x2b')](db[_0xd35c('0x2c')]['rawAttributes'],function(_0x5aba15){return{'name':_0x5aba15['fieldName'],'type':_0x5aba15[_0xd35c('0x2d')][_0xd35c('0x2e')]};});_0x162668[_0xd35c('0x2f')]=_[_0xd35c('0x2b')](_0x23230e,'name');_0x162668[_0xd35c('0x30')]=_[_0xd35c('0x31')](_0x3063de[_0xd35c('0x30')]);_0x162668['filters']=_[_0xd35c('0x32')](_0x162668[_0xd35c('0x2f')],_0x162668[_0xd35c('0x30')]);_0x4f85f6['attributes']=_['intersection'](_0x162668['model'],qs['fields'](_0x3063de[_0xd35c('0x30')]['fields']));_0x4f85f6[_0xd35c('0x33')]=_0x4f85f6['attributes']['length']?_0x4f85f6[_0xd35c('0x33')]:_0x162668['model'];if(!_0x3063de[_0xd35c('0x30')][_0xd35c('0x34')](_0xd35c('0x35'))){_0x4f85f6[_0xd35c('0x1d')]=qs[_0xd35c('0x1d')](_0x3063de[_0xd35c('0x30')][_0xd35c('0x1d')]);_0x4f85f6[_0xd35c('0x1c')]=qs[_0xd35c('0x1c')](_0x3063de['query'][_0xd35c('0x1c')]);}_0x4f85f6['order']=qs['sort'](_0x3063de[_0xd35c('0x30')]['sort']);_0x4f85f6[_0xd35c('0x36')]=qs[_0xd35c('0x37')](_['pick'](_0x3063de[_0xd35c('0x30')],_0x162668[_0xd35c('0x37')]),_0x23230e);if(_0x3063de['query'][_0xd35c('0x38')]){_0x4f85f6['where']=_[_0xd35c('0x39')](_0x4f85f6[_0xd35c('0x36')],{'$or':_[_0xd35c('0x2b')](_0x23230e,function(_0x4946a3){if(_0x4946a3[_0xd35c('0x2d')]!==_0xd35c('0x3a')){var _0x15e34f={};_0x15e34f[_0x4946a3[_0xd35c('0x28')]]={'$like':'%'+_0x3063de[_0xd35c('0x30')][_0xd35c('0x38')]+'%'};return _0x15e34f;}})});}_0x4f85f6=_[_0xd35c('0x39')]({},_0x4f85f6,_0x3063de[_0xd35c('0x3b')]);var _0x1be4b1={'where':_0x4f85f6[_0xd35c('0x36')]};return db[_0xd35c('0x2c')]['count'](_0x1be4b1)[_0xd35c('0x22')](function(_0x57fca9){_0x369522[_0xd35c('0x3c')]=_0x57fca9;if(_0x3063de[_0xd35c('0x30')][_0xd35c('0x3d')]){_0x4f85f6[_0xd35c('0x3e')]=[{'all':!![]}];}return db[_0xd35c('0x2c')][_0xd35c('0x3f')](_0x4f85f6);})['then'](function(_0x343d26){_0x369522[_0xd35c('0x40')]=_0x343d26;return _0x369522;})[_0xd35c('0x22')](respondWithFilteredResult(_0x358805,_0x4f85f6))['catch'](handleError(_0x358805,null));};exports['show']=function(_0x51cb1f,_0x4c664d){var _0x284a8c={'raw':![],'where':{'id':_0x51cb1f[_0xd35c('0x41')]['id']}},_0x3fada2={};_0x3fada2['model']=_[_0xd35c('0x31')](db[_0xd35c('0x2c')][_0xd35c('0x42')]);_0x3fada2[_0xd35c('0x30')]=_['keys'](_0x51cb1f[_0xd35c('0x30')]);_0x3fada2[_0xd35c('0x37')]=_[_0xd35c('0x32')](_0x3fada2[_0xd35c('0x2f')],_0x3fada2['query']);_0x284a8c[_0xd35c('0x33')]=_[_0xd35c('0x32')](_0x3fada2[_0xd35c('0x2f')],qs[_0xd35c('0x43')](_0x51cb1f[_0xd35c('0x30')][_0xd35c('0x43')]));_0x284a8c['attributes']=_0x284a8c[_0xd35c('0x33')]['length']?_0x284a8c['attributes']:_0x3fada2[_0xd35c('0x2f')];if(_0x51cb1f['query'][_0xd35c('0x3d')]){_0x284a8c[_0xd35c('0x3e')]=[{'all':!![]}];}_0x284a8c=_[_0xd35c('0x39')]({},_0x284a8c,_0x51cb1f[_0xd35c('0x3b')]);return db[_0xd35c('0x2c')][_0xd35c('0x44')](_0x284a8c)[_0xd35c('0x22')](handleEntityNotFound(_0x4c664d,null))['then'](respondWithResult(_0x4c664d,null))[_0xd35c('0x45')](handleError(_0x4c664d,null));};exports[_0xd35c('0x46')]=function(_0x484671,_0x45e630){return db[_0xd35c('0x2c')][_0xd35c('0x46')](_0x484671['body'],{})[_0xd35c('0x22')](function(_0x22198d){var _0x10c539=_0x484671['user']['get']({'plain':!![]});if(!_0x10c539)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10c539[_0xd35c('0x47')]===_0xd35c('0x48')){var _0x4a80bb=_0x22198d[_0xd35c('0x49')]({'plain':!![]});var _0x4b4337=_0xd35c('0x23');return db[_0xd35c('0x4a')][_0xd35c('0x44')]({'where':{'name':_0x4b4337,'userProfileId':_0x10c539[_0xd35c('0x4b')]},'raw':!![]})[_0xd35c('0x22')](function(_0x4af44b){if(_0x4af44b&&_0x4af44b[_0xd35c('0x4c')]===0x0){return db[_0xd35c('0x24')][_0xd35c('0x46')]({'name':_0x4a80bb[_0xd35c('0x28')],'resourceId':_0x4a80bb['id'],'type':_0x4af44b[_0xd35c('0x28')],'sectionId':_0x4af44b['id']},{})[_0xd35c('0x22')](function(){return _0x22198d;});}else{return _0x22198d;}})[_0xd35c('0x45')](function(_0x47b563){logger[_0xd35c('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47b563);throw _0x47b563;});}return _0x22198d;})[_0xd35c('0x22')](respondWithResult(_0x45e630,0xc9))['catch'](handleError(_0x45e630,null));};exports[_0xd35c('0x4d')]=function(_0x27882f,_0x16bd5b){var _0x2f5f47={'where':{'id':_0x27882f[_0xd35c('0x41')]['id']}},_0x1d14d3={};_0x1d14d3[_0xd35c('0x2f')]=_[_0xd35c('0x31')](db[_0xd35c('0x2c')]['rawAttributes']);_0x2f5f47[_0xd35c('0x33')]=_[_0xd35c('0x32')](_0x1d14d3['model'],qs[_0xd35c('0x43')](_0x27882f[_0xd35c('0x30')][_0xd35c('0x43')]));_0x2f5f47[_0xd35c('0x33')]=_0x2f5f47[_0xd35c('0x33')][_0xd35c('0x4e')]?_0x2f5f47[_0xd35c('0x33')]:_0x1d14d3['model'];if(_0x27882f[_0xd35c('0x30')][_0xd35c('0x3d')]){_0x2f5f47[_0xd35c('0x3e')]=[{'all':!![]}];}_0x2f5f47=_['merge']({},_0x2f5f47,_0x27882f[_0xd35c('0x3b')]);return db[_0xd35c('0x2c')][_0xd35c('0x44')](_0x2f5f47)[_0xd35c('0x22')](handleEntityNotFound(_0x16bd5b,null))[_0xd35c('0x22')](function(_0x564fdd){if(_0x564fdd){var _0x37f111=_0x564fdd[_0xd35c('0x49')]({'plain':!![]});_0x37f111=qs['omit'](_0x37f111,['id',_0xd35c('0x4f'),_0xd35c('0x50')]);_0x27882f[_0xd35c('0x51')]=_[_0xd35c('0x52')](_0x27882f['body'],['id',_0xd35c('0x4f'),_0xd35c('0x50')]);return db['Campaign']['create'](_['merge'](_0x37f111,_0x27882f[_0xd35c('0x51')]),{'include':_0x27882f[_0xd35c('0x30')][_0xd35c('0x3d')]?[{'all':!![]}]:undefined})[_0xd35c('0x22')](function(_0x46335d){var _0x26a216=_0x27882f[_0xd35c('0x48')]['get']({'plain':!![]});if(!_0x26a216)throw new Error(_0xd35c('0x53'));if(_0x26a216[_0xd35c('0x47')]===_0xd35c('0x48')){var _0x3c1b09=_0x46335d[_0xd35c('0x49')]({'plain':!![]});var _0x1692a2='IvrCampaigns';return db['UserProfileSection'][_0xd35c('0x44')]({'where':{'name':_0x1692a2,'userProfileId':_0x26a216['userProfileId']},'raw':!![]})[_0xd35c('0x22')](function(_0x137b9b){if(_0x137b9b&&_0x137b9b[_0xd35c('0x4c')]===0x0){return db[_0xd35c('0x24')]['create']({'name':_0x3c1b09[_0xd35c('0x28')],'resourceId':_0x3c1b09['id'],'type':_0x137b9b['name'],'sectionId':_0x137b9b['id']},{})[_0xd35c('0x22')](function(){return _0x46335d;});}else{return _0x46335d;}})[_0xd35c('0x45')](function(_0x55ffff){logger[_0xd35c('0x27')](_0xd35c('0x54'),_0x55ffff);throw _0x55ffff;});}return _0x46335d;});}})[_0xd35c('0x22')](respondWithResult(_0x16bd5b,0xc9))[_0xd35c('0x45')](handleError(_0x16bd5b,null));};exports[_0xd35c('0x21')]=function(_0x38e489,_0x1a8fc2){if(_0x38e489[_0xd35c('0x51')]['id']){delete _0x38e489[_0xd35c('0x51')]['id'];}return db[_0xd35c('0x2c')][_0xd35c('0x44')]({'where':{'id':_0x38e489[_0xd35c('0x41')]['id']}})[_0xd35c('0x22')](handleEntityNotFound(_0x1a8fc2,null))['then'](saveUpdates(_0x38e489[_0xd35c('0x51')],null))['then'](respondWithResult(_0x1a8fc2,null))['catch'](handleError(_0x1a8fc2,null));};exports[_0xd35c('0x25')]=function(_0x4fca1a,_0x1b4a7b){return db['Campaign'][_0xd35c('0x44')]({'where':{'id':_0x4fca1a[_0xd35c('0x41')]['id']}})[_0xd35c('0x22')](handleEntityNotFound(_0x1b4a7b,null))[_0xd35c('0x22')](removeEntity(_0x1b4a7b,null))[_0xd35c('0x45')](handleError(_0x1b4a7b,null));};exports['getHoppers']=function(_0x5de234,_0x6559ba,_0x3f6768){var _0x1cdd83={'raw':!![],'where':{}};var _0x29dc0c={};var _0x130218={'count':0x0,'rows':[]};return db[_0xd35c('0x2c')][_0xd35c('0x55')]({'where':{'id':_0x5de234[_0xd35c('0x41')]['id']}})[_0xd35c('0x22')](handleEntityNotFound(_0x6559ba,null))[_0xd35c('0x22')](function(_0x3dab5f){if(_0x3dab5f){_0x29dc0c[_0xd35c('0x2f')]=_['keys'](db[_0xd35c('0x56')][_0xd35c('0x42')]);_0x29dc0c['query']=_[_0xd35c('0x31')](_0x5de234[_0xd35c('0x30')]);_0x29dc0c[_0xd35c('0x37')]=_[_0xd35c('0x32')](_0x29dc0c[_0xd35c('0x2f')],_0x29dc0c[_0xd35c('0x30')]);_0x1cdd83[_0xd35c('0x33')]=_['intersection'](_0x29dc0c[_0xd35c('0x2f')],qs[_0xd35c('0x43')](_0x5de234[_0xd35c('0x30')][_0xd35c('0x43')]));_0x1cdd83[_0xd35c('0x33')]=_0x1cdd83[_0xd35c('0x33')][_0xd35c('0x4e')]?_0x1cdd83[_0xd35c('0x33')]:_0x29dc0c[_0xd35c('0x2f')];if(!_0x5de234[_0xd35c('0x30')][_0xd35c('0x34')](_0xd35c('0x35'))){_0x1cdd83[_0xd35c('0x1d')]=qs[_0xd35c('0x1d')](_0x5de234[_0xd35c('0x30')][_0xd35c('0x1d')]);_0x1cdd83[_0xd35c('0x1c')]=qs[_0xd35c('0x1c')](_0x5de234[_0xd35c('0x30')][_0xd35c('0x1c')]);}_0x1cdd83[_0xd35c('0x57')]=qs[_0xd35c('0x58')](_0x5de234[_0xd35c('0x30')][_0xd35c('0x58')]);_0x1cdd83[_0xd35c('0x36')]=qs['filters'](_[_0xd35c('0x59')](_0x5de234[_0xd35c('0x30')],_0x29dc0c[_0xd35c('0x37')]));_0x1cdd83['where'][_0xd35c('0x5a')]=_0x3dab5f['id'];if(_0x5de234[_0xd35c('0x30')][_0xd35c('0x38')]){_0x1cdd83[_0xd35c('0x36')]=_[_0xd35c('0x39')](_0x1cdd83['where'],{'$or':_[_0xd35c('0x2b')](_0x1cdd83[_0xd35c('0x33')],function(_0x22b435){var _0x29e16e={};_0x29e16e[_0x22b435]={'$like':'%'+_0x5de234['query'][_0xd35c('0x38')]+'%'};return _0x29e16e;})});}_0x1cdd83=_['merge']({},_0x1cdd83,_0x5de234['options']);return db['CmHopper'][_0xd35c('0x3c')]({'where':_0x1cdd83[_0xd35c('0x36')]})[_0xd35c('0x22')](function(_0x54b917){_0x130218[_0xd35c('0x3c')]=_0x54b917;if(_0x5de234[_0xd35c('0x30')][_0xd35c('0x3d')]){_0x1cdd83['include']=[{'all':!![]}];}return db[_0xd35c('0x56')][_0xd35c('0x3f')](_0x1cdd83);})[_0xd35c('0x22')](function(_0x133496){_0x130218[_0xd35c('0x40')]=_0x133496;return _0x130218;});}})[_0xd35c('0x22')](respondWithFilteredResult(_0x6559ba,_0x1cdd83))[_0xd35c('0x45')](handleError(_0x6559ba,null));};exports[_0xd35c('0x5b')]=function(_0x2102c1,_0x443acf,_0x12b3a4){var _0xc59bf5={'raw':!![],'where':{}};var _0xfc6b35={};var _0x503ec8={'count':0x0,'rows':[]};return db[_0xd35c('0x2c')][_0xd35c('0x55')]({'where':{'id':_0x2102c1[_0xd35c('0x41')]['id']}})[_0xd35c('0x22')](handleEntityNotFound(_0x443acf,null))[_0xd35c('0x22')](function(_0x24ef43){if(_0x24ef43){_0xfc6b35[_0xd35c('0x2f')]=_[_0xd35c('0x31')](db['CmHopperHistory'][_0xd35c('0x42')]);_0xfc6b35[_0xd35c('0x30')]=_['keys'](_0x2102c1['query']);_0xfc6b35[_0xd35c('0x37')]=_[_0xd35c('0x32')](_0xfc6b35['model'],_0xfc6b35['query']);_0xc59bf5[_0xd35c('0x33')]=_[_0xd35c('0x32')](_0xfc6b35[_0xd35c('0x2f')],qs[_0xd35c('0x43')](_0x2102c1[_0xd35c('0x30')][_0xd35c('0x43')]));_0xc59bf5[_0xd35c('0x33')]=_0xc59bf5['attributes']['length']?_0xc59bf5[_0xd35c('0x33')]:_0xfc6b35[_0xd35c('0x2f')];if(!_0x2102c1['query']['hasOwnProperty'](_0xd35c('0x35'))){_0xc59bf5[_0xd35c('0x1d')]=qs[_0xd35c('0x1d')](_0x2102c1[_0xd35c('0x30')][_0xd35c('0x1d')]);_0xc59bf5[_0xd35c('0x1c')]=qs['offset'](_0x2102c1[_0xd35c('0x30')][_0xd35c('0x1c')]);}_0xc59bf5[_0xd35c('0x57')]=qs['sort'](_0x2102c1[_0xd35c('0x30')][_0xd35c('0x58')]);_0xc59bf5['where']=qs['filters'](_[_0xd35c('0x59')](_0x2102c1[_0xd35c('0x30')],_0xfc6b35[_0xd35c('0x37')]));_0xc59bf5[_0xd35c('0x36')]['CampaignId']=_0x24ef43['id'];if(_0x2102c1[_0xd35c('0x30')][_0xd35c('0x38')]){_0xc59bf5[_0xd35c('0x36')]=_[_0xd35c('0x39')](_0xc59bf5[_0xd35c('0x36')],{'$or':_[_0xd35c('0x2b')](_0xc59bf5['attributes'],function(_0x248721){var _0x32dab0={};_0x32dab0[_0x248721]={'$like':'%'+_0x2102c1[_0xd35c('0x30')][_0xd35c('0x38')]+'%'};return _0x32dab0;})});}_0xc59bf5=_[_0xd35c('0x39')]({},_0xc59bf5,_0x2102c1[_0xd35c('0x3b')]);return db[_0xd35c('0x5c')][_0xd35c('0x3c')]({'where':_0xc59bf5['where']})['then'](function(_0x29c0a6){_0x503ec8['count']=_0x29c0a6;if(_0x2102c1[_0xd35c('0x30')]['includeAll']){_0xc59bf5[_0xd35c('0x3e')]=[{'all':!![]}];}return db[_0xd35c('0x5c')][_0xd35c('0x3f')](_0xc59bf5);})[_0xd35c('0x22')](function(_0xa20886){_0x503ec8[_0xd35c('0x40')]=_0xa20886;return _0x503ec8;});}})['then'](respondWithFilteredResult(_0x443acf,_0xc59bf5))[_0xd35c('0x45')](handleError(_0x443acf,null));};exports[_0xd35c('0x5d')]=function(_0x16c062,_0xd02a3c,_0x25862a){var _0x4b12cb={'raw':!![],'where':{}};var _0x2cf388={};var _0x5ca584={'count':0x0,'rows':[]};return db[_0xd35c('0x2c')][_0xd35c('0x55')]({'where':{'id':_0x16c062[_0xd35c('0x41')]['id']}})[_0xd35c('0x22')](handleEntityNotFound(_0xd02a3c,null))[_0xd35c('0x22')](function(_0xc3eace){if(_0xc3eace){_0x2cf388['model']=_['keys'](db[_0xd35c('0x5e')][_0xd35c('0x42')]);_0x2cf388['query']=_[_0xd35c('0x31')](_0x16c062[_0xd35c('0x30')]);_0x2cf388['filters']=_['intersection'](_0x2cf388[_0xd35c('0x2f')],_0x2cf388[_0xd35c('0x30')]);_0x4b12cb['attributes']=_[_0xd35c('0x32')](_0x2cf388[_0xd35c('0x2f')],qs[_0xd35c('0x43')](_0x16c062[_0xd35c('0x30')]['fields']));_0x4b12cb[_0xd35c('0x33')]=_0x4b12cb[_0xd35c('0x33')]['length']?_0x4b12cb[_0xd35c('0x33')]:_0x2cf388[_0xd35c('0x2f')];if(!_0x16c062[_0xd35c('0x30')][_0xd35c('0x34')](_0xd35c('0x35'))){_0x4b12cb[_0xd35c('0x1d')]=qs[_0xd35c('0x1d')](_0x16c062[_0xd35c('0x30')]['limit']);_0x4b12cb[_0xd35c('0x1c')]=qs[_0xd35c('0x1c')](_0x16c062[_0xd35c('0x30')][_0xd35c('0x1c')]);}_0x4b12cb[_0xd35c('0x57')]=qs['sort'](_0x16c062[_0xd35c('0x30')]['sort']);_0x4b12cb[_0xd35c('0x36')]=qs[_0xd35c('0x37')](_[_0xd35c('0x59')](_0x16c062['query'],_0x2cf388[_0xd35c('0x37')]));_0x4b12cb[_0xd35c('0x36')][_0xd35c('0x5a')]=_0xc3eace['id'];if(_0x16c062[_0xd35c('0x30')]['filter']){_0x4b12cb[_0xd35c('0x36')]=_[_0xd35c('0x39')](_0x4b12cb[_0xd35c('0x36')],{'$or':_[_0xd35c('0x2b')](_0x4b12cb[_0xd35c('0x33')],function(_0x5c377c){var _0x4f83ec={};_0x4f83ec[_0x5c377c]={'$like':'%'+_0x16c062['query'][_0xd35c('0x38')]+'%'};return _0x4f83ec;})});}_0x4b12cb=_['merge']({},_0x4b12cb,_0x16c062[_0xd35c('0x3b')]);return db['CmHopperFinal'][_0xd35c('0x3c')]({'where':_0x4b12cb[_0xd35c('0x36')]})[_0xd35c('0x22')](function(_0x2e2096){_0x5ca584[_0xd35c('0x3c')]=_0x2e2096;if(_0x16c062[_0xd35c('0x30')][_0xd35c('0x3d')]){_0x4b12cb[_0xd35c('0x3e')]=[{'all':!![]}];}return db[_0xd35c('0x5e')][_0xd35c('0x3f')](_0x4b12cb);})[_0xd35c('0x22')](function(_0x212254){_0x5ca584['rows']=_0x212254;return _0x5ca584;});}})[_0xd35c('0x22')](respondWithFilteredResult(_0xd02a3c,_0x4b12cb))[_0xd35c('0x45')](handleError(_0xd02a3c,null));};exports[_0xd35c('0x5f')]=function(_0x4189f7,_0x3e7509,_0x1ca543){var _0x1ae2b6={'raw':!![],'where':{}};var _0x403ff1={};var _0x2acafd={'count':0x0,'rows':[]};return db['Campaign'][_0xd35c('0x55')]({'where':{'id':_0x4189f7['params']['id']}})[_0xd35c('0x22')](handleEntityNotFound(_0x3e7509,null))[_0xd35c('0x22')](function(_0x4350a2){if(_0x4350a2){_0x403ff1['model']=_[_0xd35c('0x31')](db[_0xd35c('0x60')][_0xd35c('0x42')]);_0x403ff1[_0xd35c('0x30')]=_[_0xd35c('0x31')](_0x4189f7[_0xd35c('0x30')]);_0x403ff1[_0xd35c('0x37')]=_['intersection'](_0x403ff1[_0xd35c('0x2f')],_0x403ff1[_0xd35c('0x30')]);_0x1ae2b6['attributes']=_['intersection'](_0x403ff1[_0xd35c('0x2f')],qs['fields'](_0x4189f7[_0xd35c('0x30')][_0xd35c('0x43')]));_0x1ae2b6[_0xd35c('0x33')]=_0x1ae2b6['attributes'][_0xd35c('0x4e')]?_0x1ae2b6[_0xd35c('0x33')]:_0x403ff1['model'];if(!_0x4189f7['query'][_0xd35c('0x34')](_0xd35c('0x35'))){_0x1ae2b6[_0xd35c('0x1d')]=qs[_0xd35c('0x1d')](_0x4189f7[_0xd35c('0x30')][_0xd35c('0x1d')]);_0x1ae2b6[_0xd35c('0x1c')]=qs[_0xd35c('0x1c')](_0x4189f7[_0xd35c('0x30')][_0xd35c('0x1c')]);}_0x1ae2b6[_0xd35c('0x57')]=qs[_0xd35c('0x58')](_0x4189f7[_0xd35c('0x30')][_0xd35c('0x58')]);_0x1ae2b6[_0xd35c('0x36')]=qs[_0xd35c('0x37')](_[_0xd35c('0x59')](_0x4189f7[_0xd35c('0x30')],_0x403ff1[_0xd35c('0x37')]));_0x1ae2b6[_0xd35c('0x36')][_0xd35c('0x5a')]=_0x4350a2['id'];if(_0x4189f7['query'][_0xd35c('0x38')]){_0x1ae2b6[_0xd35c('0x36')]=_[_0xd35c('0x39')](_0x1ae2b6['where'],{'$or':_[_0xd35c('0x2b')](_0x1ae2b6['attributes'],function(_0xf480dc){var _0x48927b={};_0x48927b[_0xf480dc]={'$like':'%'+_0x4189f7[_0xd35c('0x30')][_0xd35c('0x38')]+'%'};return _0x48927b;})});}_0x1ae2b6=_['merge']({},_0x1ae2b6,_0x4189f7[_0xd35c('0x3b')]);return db['CmHopperBlack'][_0xd35c('0x3c')]({'where':_0x1ae2b6[_0xd35c('0x36')]})[_0xd35c('0x22')](function(_0x523c58){_0x2acafd[_0xd35c('0x3c')]=_0x523c58;if(_0x4189f7['query'][_0xd35c('0x3d')]){_0x1ae2b6[_0xd35c('0x3e')]=[{'all':!![]}];}return db[_0xd35c('0x60')][_0xd35c('0x3f')](_0x1ae2b6);})['then'](function(_0x30158b){_0x2acafd[_0xd35c('0x40')]=_0x30158b;return _0x2acafd;});}})[_0xd35c('0x22')](respondWithFilteredResult(_0x3e7509,_0x1ae2b6))['catch'](handleError(_0x3e7509,null));};exports[_0xd35c('0x61')]=function(_0x103b35,_0x5e24bc,_0x1a689f){var _0x3e01b7={};var _0x39edc7={};var _0x55908b;var _0x3a1bf7;return db[_0xd35c('0x2c')]['findOne']({'where':{'id':_0x103b35[_0xd35c('0x41')]['id']}})[_0xd35c('0x22')](handleEntityNotFound(_0x5e24bc,null))[_0xd35c('0x22')](function(_0x15c7e8){if(_0x15c7e8){_0x55908b=_0x15c7e8;_0x39edc7[_0xd35c('0x2f')]=_[_0xd35c('0x31')](db[_0xd35c('0x62')][_0xd35c('0x42')]);_0x39edc7[_0xd35c('0x30')]=_[_0xd35c('0x31')](_0x103b35[_0xd35c('0x30')]);_0x39edc7[_0xd35c('0x37')]=_[_0xd35c('0x32')](_0x39edc7[_0xd35c('0x2f')],_0x39edc7['query']);_0x3e01b7['attributes']=_[_0xd35c('0x32')](_0x39edc7[_0xd35c('0x2f')],qs[_0xd35c('0x43')](_0x103b35['query'][_0xd35c('0x43')]));_0x3e01b7['attributes']=_0x3e01b7['attributes'][_0xd35c('0x4e')]?_0x3e01b7['attributes']:_0x39edc7[_0xd35c('0x2f')];_0x3e01b7['order']=qs[_0xd35c('0x58')](_0x103b35['query']['sort']);_0x3e01b7['where']=qs[_0xd35c('0x37')](_[_0xd35c('0x59')](_0x103b35['query'],_0x39edc7['filters']));if(_0x103b35['query'][_0xd35c('0x38')]){_0x3e01b7[_0xd35c('0x36')]=_[_0xd35c('0x39')](_0x3e01b7[_0xd35c('0x36')],{'$or':_['map'](_0x3e01b7[_0xd35c('0x33')],function(_0xac6f0){var _0x41e29a={};_0x41e29a[_0xac6f0]={'$like':'%'+_0x103b35[_0xd35c('0x30')][_0xd35c('0x38')]+'%'};return _0x41e29a;})});}_0x3e01b7=_[_0xd35c('0x39')]({},_0x3e01b7,_0x103b35[_0xd35c('0x3b')]);return _0x55908b[_0xd35c('0x61')](_0x3e01b7);}})[_0xd35c('0x22')](function(_0x11645c){if(_0x11645c){_0x3a1bf7=_0x11645c[_0xd35c('0x4e')];if(!_0x103b35['query'][_0xd35c('0x34')](_0xd35c('0x35'))){_0x3e01b7[_0xd35c('0x1d')]=qs[_0xd35c('0x1d')](_0x103b35[_0xd35c('0x30')][_0xd35c('0x1d')]);_0x3e01b7[_0xd35c('0x1c')]=qs[_0xd35c('0x1c')](_0x103b35[_0xd35c('0x30')][_0xd35c('0x1c')]);}return _0x55908b[_0xd35c('0x61')](_0x3e01b7);}})['then'](function(_0x4df973){if(_0x4df973){return _0x4df973?{'count':_0x3a1bf7,'rows':_0x4df973}:null;}})[_0xd35c('0x22')](respondWithResult(_0x5e24bc,null))[_0xd35c('0x45')](handleError(_0x5e24bc,null));};exports[_0xd35c('0x63')]=function(_0x2f5e98,_0x48b3bb,_0x4ac63c){var _0x551a2f,_0xa61082;return db[_0xd35c('0x2c')][_0xd35c('0x44')]({'where':{'id':_0x2f5e98[_0xd35c('0x41')]['id']}})[_0xd35c('0x22')](handleEntityNotFound(_0x48b3bb,null))[_0xd35c('0x22')](function(_0x17de90){if(_0x17de90){_0xa61082=_0x17de90;return _0x17de90[_0xd35c('0x63')](_0x2f5e98[_0xd35c('0x51')][_0xd35c('0x64')],_[_0xd35c('0x52')](_0x2f5e98[_0xd35c('0x51')],[_0xd35c('0x64'),'id'])||{});}return null;})[_0xd35c('0x65')](function(_0xba488d){var _0x260e76;_0x551a2f=_0xba488d||[];var _0x4e2d27=[];if(_0xba488d){for(var _0x5c238c=0x0;_0x5c238c<_0xba488d[_0xd35c('0x4e')];_0x5c238c+=0x1){var _0x4a978d=_0xba488d[_0x5c238c][_0xd35c('0x49')]({'plain':!![]});_0xa61082[_0xd35c('0x66')]=_0x2f5e98['body'][_0xd35c('0x66')]?_0x2f5e98['body'][_0xd35c('0x66')]:_0xa61082['dialCheckDuplicateType'];switch(_0xa61082[_0xd35c('0x66')]){case _0xd35c('0x67'):_0x260e76=squel[_0xd35c('0x68')]()[_0xd35c('0x69')]('cm_hopper')['fromQuery']([_0xd35c('0x6a'),_0xd35c('0x6b'),_0xd35c('0x6c'),_0xd35c('0x6d'),'CampaignId','createdAt',_0xd35c('0x50')],squel[_0xd35c('0x6e')]()[_0xd35c('0x6f')](_0xd35c('0x6a'),_0xd35c('0x6a'))['field'](_0xd35c('0x70'),_0xd35c('0x6b'))[_0xd35c('0x6f')]('id',_0xd35c('0x6c'))[_0xd35c('0x6f')](_0x4a978d[_0xd35c('0x71')][_0xd35c('0x72')](),_0xd35c('0x6d'))['field'](_0x2f5e98['params']['id'][_0xd35c('0x72')](),_0xd35c('0x5a'))[_0xd35c('0x6f')](_0xd35c('0x70'),_0xd35c('0x4f'))[_0xd35c('0x6f')](_0xd35c('0x70'),'updatedAt')[_0xd35c('0x73')]('cm_contacts')[_0xd35c('0x36')](_0xd35c('0x74'))['where'](_0xd35c('0x75'),_0x4a978d[_0xd35c('0x71')]['toString']())[_0xd35c('0x36')](_0xd35c('0x76'))[_0xd35c('0x36')](_0xd35c('0x77'),squel[_0xd35c('0x6e')]()[_0xd35c('0x6f')](_0xd35c('0x78'))[_0xd35c('0x73')](_0xd35c('0x79'))[_0xd35c('0x36')](_0xd35c('0x7a'),_0x2f5e98[_0xd35c('0x41')]['id'][_0xd35c('0x72')]()))['where'](_0xd35c('0x77'),squel[_0xd35c('0x6e')]()[_0xd35c('0x6f')]('COALESCE(phone,\x27\x27)')['from'](_0xd35c('0x7b'))[_0xd35c('0x36')]('CampaignId\x20=\x20?',_0x2f5e98[_0xd35c('0x41')]['id'][_0xd35c('0x72')]())))['toString']();break;case'onlyIfOpen':_0x260e76=squel[_0xd35c('0x68')]()[_0xd35c('0x69')]('cm_hopper')[_0xd35c('0x7c')](['phone',_0xd35c('0x6b'),_0xd35c('0x6c'),_0xd35c('0x6d'),_0xd35c('0x5a'),_0xd35c('0x4f'),_0xd35c('0x50')],squel[_0xd35c('0x6e')]()[_0xd35c('0x6f')](_0xd35c('0x6a'),'phone')[_0xd35c('0x6f')](_0xd35c('0x70'),_0xd35c('0x6b'))[_0xd35c('0x6f')]('id',_0xd35c('0x6c'))[_0xd35c('0x6f')](_0x4a978d[_0xd35c('0x71')][_0xd35c('0x72')](),_0xd35c('0x6d'))[_0xd35c('0x6f')](_0x2f5e98[_0xd35c('0x41')]['id'][_0xd35c('0x72')](),_0xd35c('0x5a'))[_0xd35c('0x6f')](_0xd35c('0x70'),'createdAt')[_0xd35c('0x6f')](_0xd35c('0x70'),_0xd35c('0x50'))[_0xd35c('0x73')](_0xd35c('0x7d'))['where']('deletedAt\x20IS\x20NULL')[_0xd35c('0x36')](_0xd35c('0x75'),_0x4a978d[_0xd35c('0x71')][_0xd35c('0x72')]())[_0xd35c('0x36')](_0xd35c('0x76'))[_0xd35c('0x36')](_0xd35c('0x77'),squel[_0xd35c('0x6e')]()[_0xd35c('0x6f')](_0xd35c('0x7e'))[_0xd35c('0x73')](_0xd35c('0x7b'))['where']('CampaignId\x20=\x20?',_0x2f5e98['params']['id'][_0xd35c('0x72')]())))['toString']();break;default:_0x260e76=squel['insert']()['into']('cm_hopper')['fromQuery']([_0xd35c('0x6a'),_0xd35c('0x6b'),_0xd35c('0x6c'),_0xd35c('0x6d'),_0xd35c('0x5a'),_0xd35c('0x4f'),_0xd35c('0x50')],squel[_0xd35c('0x6e')]()['field']('phone','phone')['field'](_0xd35c('0x70'),'scheduledAt')['field']('id','ContactId')['field'](_0x4a978d[_0xd35c('0x71')][_0xd35c('0x72')](),_0xd35c('0x6d'))['field'](_0x2f5e98[_0xd35c('0x41')]['id'][_0xd35c('0x72')](),_0xd35c('0x5a'))[_0xd35c('0x6f')](_0xd35c('0x70'),_0xd35c('0x4f'))[_0xd35c('0x6f')]('NOW()',_0xd35c('0x50'))[_0xd35c('0x73')](_0xd35c('0x7d'))[_0xd35c('0x36')](_0xd35c('0x74'))[_0xd35c('0x36')](_0xd35c('0x75'),_0x4a978d[_0xd35c('0x71')][_0xd35c('0x72')]())[_0xd35c('0x36')]('phone\x20IS\x20NOT\x20NULL'))[_0xd35c('0x72')]();}_0x4e2d27[_0xd35c('0x7f')](db['sequelize'][_0xd35c('0x30')](_0x260e76));}return BPromise['all'](_0x4e2d27);}})[_0xd35c('0x22')](function(){return _0x551a2f;})['then'](respondWithResult(_0x48b3bb,null))[_0xd35c('0x45')](handleError(_0x48b3bb,null));};exports[_0xd35c('0x80')]=function(_0x539656,_0x154b2b,_0x41bac9){return db[_0xd35c('0x2c')][_0xd35c('0x44')]({'where':{'id':_0x539656[_0xd35c('0x41')]['id']}})[_0xd35c('0x22')](handleEntityNotFound(_0x154b2b,null))['then'](function(_0x2180f4){if(_0x2180f4){return _0x2180f4[_0xd35c('0x80')](_0x539656[_0xd35c('0x30')][_0xd35c('0x64')]);}})[_0xd35c('0x22')](function(_0x36e671){if(_0x36e671){return db[_0xd35c('0x56')][_0xd35c('0x25')]({'where':{'ListId':_0x539656[_0xd35c('0x30')][_0xd35c('0x64')],'CampaignId':_0x539656[_0xd35c('0x41')]['id']}})['then'](function(){return _0x36e671;});}})[_0xd35c('0x22')](respondWithStatusCode(_0x154b2b,null))[_0xd35c('0x45')](handleError(_0x154b2b,null));};exports[_0xd35c('0x81')]=function(_0x18fc2b,_0x4d6a35,_0x3dfc4a){var _0x2c65a3={'raw':!![],'where':{}};var _0x2722fe={};var _0x2f8770={'count':0x0,'rows':[]};return db[_0xd35c('0x2c')][_0xd35c('0x55')]({'where':{'id':_0x18fc2b['params']['id']}})['then'](handleEntityNotFound(_0x4d6a35,null))['then'](function(_0x3b60b9){if(_0x3b60b9){_0x2722fe[_0xd35c('0x2f')]=_[_0xd35c('0x31')](db[_0xd35c('0x62')]['rawAttributes']);_0x2722fe[_0xd35c('0x30')]=_['keys'](_0x18fc2b[_0xd35c('0x30')]);_0x2722fe[_0xd35c('0x37')]=_[_0xd35c('0x32')](_0x2722fe['model'],_0x2722fe[_0xd35c('0x30')]);_0x2c65a3['attributes']=_[_0xd35c('0x32')](_0x2722fe[_0xd35c('0x2f')],qs[_0xd35c('0x43')](_0x18fc2b[_0xd35c('0x30')][_0xd35c('0x43')]));_0x2c65a3[_0xd35c('0x33')]=_0x2c65a3[_0xd35c('0x33')][_0xd35c('0x4e')]?_0x2c65a3['attributes']:_0x2722fe['model'];if(!_0x18fc2b[_0xd35c('0x30')][_0xd35c('0x34')](_0xd35c('0x35'))){_0x2c65a3['limit']=qs[_0xd35c('0x1d')](_0x18fc2b[_0xd35c('0x30')][_0xd35c('0x1d')]);_0x2c65a3[_0xd35c('0x1c')]=qs[_0xd35c('0x1c')](_0x18fc2b[_0xd35c('0x30')][_0xd35c('0x1c')]);}_0x2c65a3['order']=qs[_0xd35c('0x58')](_0x18fc2b[_0xd35c('0x30')][_0xd35c('0x58')]);_0x2c65a3[_0xd35c('0x36')]=qs[_0xd35c('0x37')](_[_0xd35c('0x59')](_0x18fc2b['query'],_0x2722fe[_0xd35c('0x37')]));_0x2c65a3[_0xd35c('0x36')][_0xd35c('0x5a')]=_0x3b60b9['id'];if(_0x18fc2b[_0xd35c('0x30')]['filter']){_0x2c65a3['where']=_[_0xd35c('0x39')](_0x2c65a3['where'],{'$or':_['map'](_0x2c65a3[_0xd35c('0x33')],function(_0x4140e9){var _0x4fe71f={};_0x4fe71f[_0x4140e9]={'$like':'%'+_0x18fc2b[_0xd35c('0x30')]['filter']+'%'};return _0x4fe71f;})});}_0x2c65a3=_[_0xd35c('0x39')]({},_0x2c65a3,_0x18fc2b[_0xd35c('0x3b')]);return db[_0xd35c('0x62')][_0xd35c('0x3c')]({'where':_0x2c65a3['where']})[_0xd35c('0x22')](function(_0x58c914){_0x2f8770[_0xd35c('0x3c')]=_0x58c914;if(_0x18fc2b[_0xd35c('0x30')][_0xd35c('0x3d')]){_0x2c65a3[_0xd35c('0x3e')]=[{'all':!![]}];}return db[_0xd35c('0x62')]['findAll'](_0x2c65a3);})['then'](function(_0x2013a0){_0x2f8770[_0xd35c('0x40')]=_0x2013a0;return _0x2f8770;});}})['then'](respondWithFilteredResult(_0x4d6a35,_0x2c65a3))['catch'](handleError(_0x4d6a35,null));};exports[_0xd35c('0x82')]=function(_0x2c6680,_0x613088,_0x388ddc){var _0x31c3a9,_0x36b1ec;return db[_0xd35c('0x2c')][_0xd35c('0x44')]({'where':{'id':_0x2c6680[_0xd35c('0x41')]['id']}})['then'](handleEntityNotFound(_0x613088,null))[_0xd35c('0x22')](function(_0x53a7c4){if(_0x53a7c4){_0x36b1ec=_0x53a7c4;return _0x53a7c4['addBlackLists'](_0x2c6680[_0xd35c('0x51')][_0xd35c('0x64')],_[_0xd35c('0x52')](_0x2c6680[_0xd35c('0x51')],[_0xd35c('0x64'),'id'])||{});}return null;})[_0xd35c('0x65')](function(_0x5e478a){var _0xecd66f;_0x31c3a9=_0x5e478a||[];var _0x16474f=[];if(_0x5e478a){for(var _0x356295=0x0;_0x356295<_0x5e478a[_0xd35c('0x4e')];_0x356295+=0x1){var _0x2586b1=_0x5e478a[_0x356295][_0xd35c('0x49')]({'plain':!![]});_0xecd66f=squel[_0xd35c('0x68')]()['into'](_0xd35c('0x83'))['fromQuery']([_0xd35c('0x6a'),'ContactId',_0xd35c('0x6d'),'CampaignId',_0xd35c('0x4f'),_0xd35c('0x50')],squel[_0xd35c('0x6e')]()[_0xd35c('0x6f')](_0xd35c('0x6a'),_0xd35c('0x6a'))[_0xd35c('0x6f')]('id','ContactId')['field'](_0x2586b1[_0xd35c('0x71')][_0xd35c('0x72')](),_0xd35c('0x6d'))[_0xd35c('0x6f')](_0x2c6680['params']['id'][_0xd35c('0x72')](),_0xd35c('0x5a'))[_0xd35c('0x6f')](_0xd35c('0x70'),_0xd35c('0x4f'))[_0xd35c('0x6f')](_0xd35c('0x70'),_0xd35c('0x50'))['from'](_0xd35c('0x7d'))['where'](_0xd35c('0x74'))['where'](_0xd35c('0x75'),_0x2586b1[_0xd35c('0x71')][_0xd35c('0x72')]())[_0xd35c('0x36')](_0xd35c('0x76')))[_0xd35c('0x72')]();_0x16474f[_0xd35c('0x7f')](db[_0xd35c('0x84')][_0xd35c('0x30')](_0xecd66f));}return BPromise['all'](_0x16474f);}})[_0xd35c('0x22')](function(){return _0x31c3a9;})['then'](respondWithResult(_0x613088,null))[_0xd35c('0x45')](handleError(_0x613088,null));};exports[_0xd35c('0x85')]=function(_0x4d3858,_0x28c08e,_0x7c4e75){return db[_0xd35c('0x2c')]['find']({'where':{'id':_0x4d3858['params']['id']}})[_0xd35c('0x22')](handleEntityNotFound(_0x28c08e,null))[_0xd35c('0x22')](function(_0x896587){if(_0x896587){return _0x896587[_0xd35c('0x85')](_0x4d3858['query'][_0xd35c('0x64')]);}})[_0xd35c('0x22')](function(_0x1828c6){if(_0x1828c6){return db[_0xd35c('0x60')][_0xd35c('0x25')]({'where':{'ListId':_0x4d3858[_0xd35c('0x30')][_0xd35c('0x64')],'CampaignId':_0x4d3858[_0xd35c('0x41')]['id']}})[_0xd35c('0x22')](function(){return _0x1828c6;});}})[_0xd35c('0x22')](respondWithStatusCode(_0x28c08e,null))[_0xd35c('0x45')](handleError(_0x28c08e,null));}; \ No newline at end of file +var _0x4af7=['sequelize','all','removeLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','IvrCampaigns','error','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','options','includeAll','findAll','catch','show','params','length','include','merge','find','create','body','user','get','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','update','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','rows','CmHopperHistory','pick','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','phone','CmListId','toString','NOW()','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','from','onlyIfOpen','insert','into','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','push'];(function(_0x178225,_0x21e015){var _0xc732dc=function(_0x22588c){while(--_0x22588c){_0x178225['push'](_0x178225['shift']());}};_0xc732dc(++_0x21e015);}(_0x4af7,0x191));var _0x74af=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x4af7[_0x2b4448];return _0xb4b465;};'use strict';var pdf=require(_0x74af('0x0'));var emlformat=require(_0x74af('0x1'));var rimraf=require(_0x74af('0x2'));var zipdir=require(_0x74af('0x3'));var jsonpatch=require(_0x74af('0x4'));var rp=require(_0x74af('0x5'));var moment=require('moment');var BPromise=require(_0x74af('0x6'));var Mustache=require('mustache');var util=require(_0x74af('0x7'));var path=require('path');var sox=require(_0x74af('0x8'));var csv=require(_0x74af('0x9'));var ejs=require(_0x74af('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x74af('0xb'));var crypto=require('crypto');var jsforce=require(_0x74af('0xc'));var deskjs=require(_0x74af('0xd'));var toCsv=require(_0x74af('0x9'));var querystring=require(_0x74af('0xe'));var Papa=require(_0x74af('0xf'));var Redis=require(_0x74af('0x10'));var authService=require(_0x74af('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74af('0x12'));var logger=require('../../config/logger')(_0x74af('0x13'));var utils=require(_0x74af('0x14'));var config=require('../../config/environment');var db=require(_0x74af('0x15'))['db'];function respondWithStatusCode(_0x193024,_0x46d4ad){_0x46d4ad=_0x46d4ad||0xcc;return function(_0x3911a0){if(_0x3911a0){return _0x193024[_0x74af('0x16')](_0x46d4ad);}return _0x193024['status'](_0x46d4ad)[_0x74af('0x17')]();};}function respondWithResult(_0x4a2a3c,_0x1faa5d){_0x1faa5d=_0x1faa5d||0xc8;return function(_0xf78713){if(_0xf78713){return _0x4a2a3c[_0x74af('0x18')](_0x1faa5d)[_0x74af('0x19')](_0xf78713);}};}function respondWithFilteredResult(_0x14b7d6,_0x295edd){return function(_0x4cfbaa){if(_0x4cfbaa){var _0x4e4a24=_0x4cfbaa[_0x74af('0x1a')],_0x23f62c=_0x295edd['offset'],_0x5750fd=_0x295edd[_0x74af('0x1b')]+_0x295edd[_0x74af('0x1c')],_0x483908;if(_0x5750fd>=_0x4e4a24){_0x5750fd=_0x4e4a24;_0x483908=0xc8;}else{_0x483908=0xce;}_0x14b7d6[_0x74af('0x18')](_0x483908);return _0x14b7d6[_0x74af('0x1d')](_0x74af('0x1e'),_0x23f62c+'-'+_0x5750fd+'/'+_0x4e4a24)['json'](_0x4cfbaa);}return null;};}function patchUpdates(_0x57fe02){return function(_0x197eea){try{jsonpatch[_0x74af('0x1f')](_0x197eea,_0x57fe02,!![]);}catch(_0x4d3486){return BPromise[_0x74af('0x20')](_0x4d3486);}return _0x197eea[_0x74af('0x21')]();};}function saveUpdates(_0x189a0d,_0x512896){return function(_0xde59a9){if(_0xde59a9){return _0xde59a9['update'](_0x189a0d)[_0x74af('0x22')](function(_0x223bca){return _0x223bca;});}return null;};}function removeEntity(_0x2c3c1c,_0x471a7a){return function(_0x1374dc){if(_0x1374dc){return _0x1374dc[_0x74af('0x23')]()[_0x74af('0x22')](function(){var _0x365efd=_0x1374dc['get']({'plain':!![]});var _0x14f60b=_0x74af('0x24');return db['UserProfileResource'][_0x74af('0x23')]({'where':{'type':_0x14f60b,'resourceId':_0x365efd['id']}})[_0x74af('0x22')](function(){return _0x1374dc;});})['then'](function(){_0x2c3c1c['status'](0xcc)[_0x74af('0x17')]();});}};}function handleEntityNotFound(_0x3376d6,_0x498ec3){return function(_0x9f208d){if(!_0x9f208d){_0x3376d6['sendStatus'](0x194);}return _0x9f208d;};}function handleError(_0x2eabe7,_0x26f1e9){_0x26f1e9=_0x26f1e9||0x1f4;return function(_0x5505d3){logger[_0x74af('0x25')](_0x5505d3['stack']);if(_0x5505d3[_0x74af('0x26')]){delete _0x5505d3[_0x74af('0x26')];}_0x2eabe7[_0x74af('0x18')](_0x26f1e9)[_0x74af('0x27')](_0x5505d3);};}exports[_0x74af('0x28')]=function(_0x43095f,_0x1065b9){var _0xfbe332={},_0x271940={},_0x100218={'count':0x0,'rows':[]};var _0x1f9068=_[_0x74af('0x29')](db[_0x74af('0x2a')][_0x74af('0x2b')],function(_0x598f1b){return{'name':_0x598f1b[_0x74af('0x2c')],'type':_0x598f1b[_0x74af('0x2d')][_0x74af('0x2e')]};});_0x271940[_0x74af('0x2f')]=_['map'](_0x1f9068,'name');_0x271940[_0x74af('0x30')]=_[_0x74af('0x31')](_0x43095f[_0x74af('0x30')]);_0x271940[_0x74af('0x32')]=_[_0x74af('0x33')](_0x271940['model'],_0x271940['query']);_0xfbe332['attributes']=_[_0x74af('0x33')](_0x271940[_0x74af('0x2f')],qs[_0x74af('0x34')](_0x43095f['query'][_0x74af('0x34')]));_0xfbe332[_0x74af('0x35')]=_0xfbe332[_0x74af('0x35')]['length']?_0xfbe332[_0x74af('0x35')]:_0x271940['model'];if(!_0x43095f[_0x74af('0x30')]['hasOwnProperty'](_0x74af('0x36'))){_0xfbe332['limit']=qs[_0x74af('0x1c')](_0x43095f[_0x74af('0x30')][_0x74af('0x1c')]);_0xfbe332['offset']=qs[_0x74af('0x1b')](_0x43095f[_0x74af('0x30')][_0x74af('0x1b')]);}_0xfbe332[_0x74af('0x37')]=qs[_0x74af('0x38')](_0x43095f[_0x74af('0x30')][_0x74af('0x38')]);_0xfbe332[_0x74af('0x39')]=qs[_0x74af('0x32')](_['pick'](_0x43095f[_0x74af('0x30')],_0x271940[_0x74af('0x32')]),_0x1f9068);if(_0x43095f[_0x74af('0x30')]['filter']){_0xfbe332[_0x74af('0x39')]=_['merge'](_0xfbe332[_0x74af('0x39')],{'$or':_['map'](_0x1f9068,function(_0x310ee4){if(_0x310ee4[_0x74af('0x2d')]!=='VIRTUAL'){var _0x38552c={};_0x38552c[_0x310ee4[_0x74af('0x26')]]={'$like':'%'+_0x43095f['query'][_0x74af('0x3a')]+'%'};return _0x38552c;}})});}_0xfbe332=_['merge']({},_0xfbe332,_0x43095f[_0x74af('0x3b')]);var _0x123e3a={'where':_0xfbe332['where']};return db['Campaign'][_0x74af('0x1a')](_0x123e3a)[_0x74af('0x22')](function(_0x33632b){_0x100218[_0x74af('0x1a')]=_0x33632b;if(_0x43095f[_0x74af('0x30')][_0x74af('0x3c')]){_0xfbe332['include']=[{'all':!![]}];}return db['Campaign'][_0x74af('0x3d')](_0xfbe332);})[_0x74af('0x22')](function(_0xd86545){_0x100218['rows']=_0xd86545;return _0x100218;})['then'](respondWithFilteredResult(_0x1065b9,_0xfbe332))[_0x74af('0x3e')](handleError(_0x1065b9,null));};exports[_0x74af('0x3f')]=function(_0x19a538,_0x1b5269){var _0x4a6714={'raw':![],'where':{'id':_0x19a538[_0x74af('0x40')]['id']}},_0x56f793={};_0x56f793[_0x74af('0x2f')]=_['keys'](db[_0x74af('0x2a')][_0x74af('0x2b')]);_0x56f793[_0x74af('0x30')]=_[_0x74af('0x31')](_0x19a538[_0x74af('0x30')]);_0x56f793[_0x74af('0x32')]=_[_0x74af('0x33')](_0x56f793[_0x74af('0x2f')],_0x56f793['query']);_0x4a6714[_0x74af('0x35')]=_['intersection'](_0x56f793[_0x74af('0x2f')],qs[_0x74af('0x34')](_0x19a538[_0x74af('0x30')][_0x74af('0x34')]));_0x4a6714[_0x74af('0x35')]=_0x4a6714[_0x74af('0x35')][_0x74af('0x41')]?_0x4a6714[_0x74af('0x35')]:_0x56f793[_0x74af('0x2f')];if(_0x19a538[_0x74af('0x30')]['includeAll']){_0x4a6714[_0x74af('0x42')]=[{'all':!![]}];}_0x4a6714=_[_0x74af('0x43')]({},_0x4a6714,_0x19a538['options']);return db[_0x74af('0x2a')][_0x74af('0x44')](_0x4a6714)[_0x74af('0x22')](handleEntityNotFound(_0x1b5269,null))['then'](respondWithResult(_0x1b5269,null))[_0x74af('0x3e')](handleError(_0x1b5269,null));};exports[_0x74af('0x45')]=function(_0x2ef489,_0x3c41b8){return db[_0x74af('0x2a')]['create'](_0x2ef489[_0x74af('0x46')],{})[_0x74af('0x22')](function(_0x1fc273){var _0x133936=_0x2ef489[_0x74af('0x47')][_0x74af('0x48')]({'plain':!![]});if(!_0x133936)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x133936[_0x74af('0x49')]===_0x74af('0x47')){var _0xa072bd=_0x1fc273[_0x74af('0x48')]({'plain':!![]});var _0x589ddb=_0x74af('0x24');return db[_0x74af('0x4a')][_0x74af('0x44')]({'where':{'name':_0x589ddb,'userProfileId':_0x133936['userProfileId']},'raw':!![]})[_0x74af('0x22')](function(_0x315312){if(_0x315312&&_0x315312['autoAssociation']===0x0){return db['UserProfileResource'][_0x74af('0x45')]({'name':_0xa072bd[_0x74af('0x26')],'resourceId':_0xa072bd['id'],'type':_0x315312[_0x74af('0x26')],'sectionId':_0x315312['id']},{})['then'](function(){return _0x1fc273;});}else{return _0x1fc273;}})[_0x74af('0x3e')](function(_0x3c7ce6){logger[_0x74af('0x25')](_0x74af('0x4b'),_0x3c7ce6);throw _0x3c7ce6;});}return _0x1fc273;})[_0x74af('0x22')](respondWithResult(_0x3c41b8,0xc9))[_0x74af('0x3e')](handleError(_0x3c41b8,null));};exports['clone']=function(_0x12c6d8,_0x28c01e){var _0x55501c={'where':{'id':_0x12c6d8[_0x74af('0x40')]['id']}},_0xef425e={};_0xef425e['model']=_['keys'](db['Campaign']['rawAttributes']);_0x55501c[_0x74af('0x35')]=_[_0x74af('0x33')](_0xef425e['model'],qs[_0x74af('0x34')](_0x12c6d8['query']['fields']));_0x55501c['attributes']=_0x55501c[_0x74af('0x35')][_0x74af('0x41')]?_0x55501c[_0x74af('0x35')]:_0xef425e[_0x74af('0x2f')];if(_0x12c6d8[_0x74af('0x30')][_0x74af('0x3c')]){_0x55501c[_0x74af('0x42')]=[{'all':!![]}];}_0x55501c=_[_0x74af('0x43')]({},_0x55501c,_0x12c6d8[_0x74af('0x3b')]);return db[_0x74af('0x2a')][_0x74af('0x44')](_0x55501c)[_0x74af('0x22')](handleEntityNotFound(_0x28c01e,null))[_0x74af('0x22')](function(_0x5e897d){if(_0x5e897d){var _0x12300c=_0x5e897d['get']({'plain':!![]});_0x12300c=qs[_0x74af('0x4c')](_0x12300c,['id','createdAt','updatedAt']);_0x12c6d8['body']=_[_0x74af('0x4c')](_0x12c6d8[_0x74af('0x46')],['id',_0x74af('0x4d'),_0x74af('0x4e')]);return db['Campaign'][_0x74af('0x45')](_[_0x74af('0x43')](_0x12300c,_0x12c6d8[_0x74af('0x46')]),{'include':_0x12c6d8[_0x74af('0x30')][_0x74af('0x3c')]?[{'all':!![]}]:undefined})['then'](function(_0x5a88b2){var _0x4ee25d=_0x12c6d8[_0x74af('0x47')][_0x74af('0x48')]({'plain':!![]});if(!_0x4ee25d)throw new Error(_0x74af('0x4f'));if(_0x4ee25d['role']===_0x74af('0x47')){var _0x4274e6=_0x5a88b2['get']({'plain':!![]});var _0x58a607='IvrCampaigns';return db[_0x74af('0x4a')]['find']({'where':{'name':_0x58a607,'userProfileId':_0x4ee25d[_0x74af('0x50')]},'raw':!![]})[_0x74af('0x22')](function(_0x19fe65){if(_0x19fe65&&_0x19fe65[_0x74af('0x51')]===0x0){return db[_0x74af('0x52')][_0x74af('0x45')]({'name':_0x4274e6['name'],'resourceId':_0x4274e6['id'],'type':_0x19fe65[_0x74af('0x26')],'sectionId':_0x19fe65['id']},{})[_0x74af('0x22')](function(){return _0x5a88b2;});}else{return _0x5a88b2;}})[_0x74af('0x3e')](function(_0x4a841b){logger['error'](_0x74af('0x4b'),_0x4a841b);throw _0x4a841b;});}return _0x5a88b2;});}})[_0x74af('0x22')](respondWithResult(_0x28c01e,0xc9))[_0x74af('0x3e')](handleError(_0x28c01e,null));};exports[_0x74af('0x53')]=function(_0x11c4fd,_0x2018e0){if(_0x11c4fd[_0x74af('0x46')]['id']){delete _0x11c4fd[_0x74af('0x46')]['id'];}return db['Campaign'][_0x74af('0x44')]({'where':{'id':_0x11c4fd[_0x74af('0x40')]['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x2018e0,null))[_0x74af('0x22')](saveUpdates(_0x11c4fd[_0x74af('0x46')],null))[_0x74af('0x22')](respondWithResult(_0x2018e0,null))[_0x74af('0x3e')](handleError(_0x2018e0,null));};exports[_0x74af('0x23')]=function(_0x5824cc,_0x3dfda8){return db[_0x74af('0x2a')][_0x74af('0x44')]({'where':{'id':_0x5824cc['params']['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x3dfda8,null))[_0x74af('0x22')](removeEntity(_0x3dfda8,null))[_0x74af('0x3e')](handleError(_0x3dfda8,null));};exports[_0x74af('0x54')]=function(_0x4e9a7e,_0x2ae16a,_0x32de2a){var _0x663a70={'raw':!![],'where':{}};var _0x490418={};var _0x498d5f={'count':0x0,'rows':[]};return db[_0x74af('0x2a')][_0x74af('0x55')]({'where':{'id':_0x4e9a7e[_0x74af('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ae16a,null))['then'](function(_0xfae46a){if(_0xfae46a){_0x490418[_0x74af('0x2f')]=_[_0x74af('0x31')](db[_0x74af('0x56')][_0x74af('0x2b')]);_0x490418[_0x74af('0x30')]=_[_0x74af('0x31')](_0x4e9a7e[_0x74af('0x30')]);_0x490418[_0x74af('0x32')]=_['intersection'](_0x490418['model'],_0x490418[_0x74af('0x30')]);_0x663a70[_0x74af('0x35')]=_['intersection'](_0x490418['model'],qs[_0x74af('0x34')](_0x4e9a7e[_0x74af('0x30')][_0x74af('0x34')]));_0x663a70['attributes']=_0x663a70['attributes'][_0x74af('0x41')]?_0x663a70['attributes']:_0x490418['model'];if(!_0x4e9a7e['query'][_0x74af('0x57')](_0x74af('0x36'))){_0x663a70[_0x74af('0x1c')]=qs[_0x74af('0x1c')](_0x4e9a7e[_0x74af('0x30')]['limit']);_0x663a70[_0x74af('0x1b')]=qs[_0x74af('0x1b')](_0x4e9a7e['query'][_0x74af('0x1b')]);}_0x663a70[_0x74af('0x37')]=qs[_0x74af('0x38')](_0x4e9a7e['query'][_0x74af('0x38')]);_0x663a70[_0x74af('0x39')]=qs[_0x74af('0x32')](_['pick'](_0x4e9a7e['query'],_0x490418[_0x74af('0x32')]));_0x663a70[_0x74af('0x39')][_0x74af('0x58')]=_0xfae46a['id'];if(_0x4e9a7e['query'][_0x74af('0x3a')]){_0x663a70['where']=_[_0x74af('0x43')](_0x663a70[_0x74af('0x39')],{'$or':_[_0x74af('0x29')](_0x663a70[_0x74af('0x35')],function(_0x327ff6){var _0x2edc43={};_0x2edc43[_0x327ff6]={'$like':'%'+_0x4e9a7e[_0x74af('0x30')][_0x74af('0x3a')]+'%'};return _0x2edc43;})});}_0x663a70=_[_0x74af('0x43')]({},_0x663a70,_0x4e9a7e[_0x74af('0x3b')]);return db[_0x74af('0x56')][_0x74af('0x1a')]({'where':_0x663a70[_0x74af('0x39')]})[_0x74af('0x22')](function(_0x509fe4){_0x498d5f[_0x74af('0x1a')]=_0x509fe4;if(_0x4e9a7e[_0x74af('0x30')][_0x74af('0x3c')]){_0x663a70['include']=[{'all':!![]}];}return db[_0x74af('0x56')]['findAll'](_0x663a70);})['then'](function(_0x311bdb){_0x498d5f[_0x74af('0x59')]=_0x311bdb;return _0x498d5f;});}})[_0x74af('0x22')](respondWithFilteredResult(_0x2ae16a,_0x663a70))[_0x74af('0x3e')](handleError(_0x2ae16a,null));};exports['getHopperHistories']=function(_0x14eeab,_0x2263a0,_0x5713c1){var _0x326142={'raw':!![],'where':{}};var _0x390549={};var _0x5a80db={'count':0x0,'rows':[]};return db['Campaign'][_0x74af('0x55')]({'where':{'id':_0x14eeab[_0x74af('0x40')]['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x2263a0,null))[_0x74af('0x22')](function(_0x56ea79){if(_0x56ea79){_0x390549[_0x74af('0x2f')]=_['keys'](db[_0x74af('0x5a')][_0x74af('0x2b')]);_0x390549['query']=_['keys'](_0x14eeab['query']);_0x390549['filters']=_[_0x74af('0x33')](_0x390549[_0x74af('0x2f')],_0x390549[_0x74af('0x30')]);_0x326142[_0x74af('0x35')]=_[_0x74af('0x33')](_0x390549[_0x74af('0x2f')],qs[_0x74af('0x34')](_0x14eeab[_0x74af('0x30')]['fields']));_0x326142[_0x74af('0x35')]=_0x326142[_0x74af('0x35')]['length']?_0x326142[_0x74af('0x35')]:_0x390549[_0x74af('0x2f')];if(!_0x14eeab['query'][_0x74af('0x57')](_0x74af('0x36'))){_0x326142[_0x74af('0x1c')]=qs['limit'](_0x14eeab[_0x74af('0x30')][_0x74af('0x1c')]);_0x326142[_0x74af('0x1b')]=qs[_0x74af('0x1b')](_0x14eeab['query']['offset']);}_0x326142[_0x74af('0x37')]=qs['sort'](_0x14eeab[_0x74af('0x30')]['sort']);_0x326142[_0x74af('0x39')]=qs[_0x74af('0x32')](_[_0x74af('0x5b')](_0x14eeab[_0x74af('0x30')],_0x390549[_0x74af('0x32')]));_0x326142[_0x74af('0x39')]['CampaignId']=_0x56ea79['id'];if(_0x14eeab[_0x74af('0x30')][_0x74af('0x3a')]){_0x326142[_0x74af('0x39')]=_[_0x74af('0x43')](_0x326142[_0x74af('0x39')],{'$or':_[_0x74af('0x29')](_0x326142[_0x74af('0x35')],function(_0x5a2e23){var _0x243d0f={};_0x243d0f[_0x5a2e23]={'$like':'%'+_0x14eeab[_0x74af('0x30')]['filter']+'%'};return _0x243d0f;})});}_0x326142=_[_0x74af('0x43')]({},_0x326142,_0x14eeab[_0x74af('0x3b')]);return db[_0x74af('0x5a')][_0x74af('0x1a')]({'where':_0x326142[_0x74af('0x39')]})[_0x74af('0x22')](function(_0x2e6e67){_0x5a80db['count']=_0x2e6e67;if(_0x14eeab['query'][_0x74af('0x3c')]){_0x326142[_0x74af('0x42')]=[{'all':!![]}];}return db[_0x74af('0x5a')][_0x74af('0x3d')](_0x326142);})[_0x74af('0x22')](function(_0x229a19){_0x5a80db[_0x74af('0x59')]=_0x229a19;return _0x5a80db;});}})[_0x74af('0x22')](respondWithFilteredResult(_0x2263a0,_0x326142))[_0x74af('0x3e')](handleError(_0x2263a0,null));};exports[_0x74af('0x5c')]=function(_0x28c7bc,_0x436cb8,_0xea360){var _0x1e3d4b={'raw':!![],'where':{}};var _0x5b51d3={};var _0x463f0e={'count':0x0,'rows':[]};return db[_0x74af('0x2a')]['findOne']({'where':{'id':_0x28c7bc['params']['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x436cb8,null))[_0x74af('0x22')](function(_0x3f6dc6){if(_0x3f6dc6){_0x5b51d3[_0x74af('0x2f')]=_['keys'](db[_0x74af('0x5d')][_0x74af('0x2b')]);_0x5b51d3[_0x74af('0x30')]=_[_0x74af('0x31')](_0x28c7bc[_0x74af('0x30')]);_0x5b51d3['filters']=_[_0x74af('0x33')](_0x5b51d3['model'],_0x5b51d3[_0x74af('0x30')]);_0x1e3d4b[_0x74af('0x35')]=_[_0x74af('0x33')](_0x5b51d3['model'],qs[_0x74af('0x34')](_0x28c7bc['query'][_0x74af('0x34')]));_0x1e3d4b[_0x74af('0x35')]=_0x1e3d4b[_0x74af('0x35')][_0x74af('0x41')]?_0x1e3d4b['attributes']:_0x5b51d3[_0x74af('0x2f')];if(!_0x28c7bc[_0x74af('0x30')][_0x74af('0x57')](_0x74af('0x36'))){_0x1e3d4b[_0x74af('0x1c')]=qs['limit'](_0x28c7bc[_0x74af('0x30')][_0x74af('0x1c')]);_0x1e3d4b[_0x74af('0x1b')]=qs[_0x74af('0x1b')](_0x28c7bc['query']['offset']);}_0x1e3d4b[_0x74af('0x37')]=qs[_0x74af('0x38')](_0x28c7bc[_0x74af('0x30')]['sort']);_0x1e3d4b['where']=qs['filters'](_[_0x74af('0x5b')](_0x28c7bc['query'],_0x5b51d3[_0x74af('0x32')]));_0x1e3d4b[_0x74af('0x39')][_0x74af('0x58')]=_0x3f6dc6['id'];if(_0x28c7bc[_0x74af('0x30')][_0x74af('0x3a')]){_0x1e3d4b[_0x74af('0x39')]=_['merge'](_0x1e3d4b[_0x74af('0x39')],{'$or':_[_0x74af('0x29')](_0x1e3d4b[_0x74af('0x35')],function(_0x5835ac){var _0x302ce0={};_0x302ce0[_0x5835ac]={'$like':'%'+_0x28c7bc[_0x74af('0x30')]['filter']+'%'};return _0x302ce0;})});}_0x1e3d4b=_[_0x74af('0x43')]({},_0x1e3d4b,_0x28c7bc['options']);return db[_0x74af('0x5d')]['count']({'where':_0x1e3d4b['where']})[_0x74af('0x22')](function(_0x7e4c4b){_0x463f0e[_0x74af('0x1a')]=_0x7e4c4b;if(_0x28c7bc[_0x74af('0x30')][_0x74af('0x3c')]){_0x1e3d4b['include']=[{'all':!![]}];}return db[_0x74af('0x5d')]['findAll'](_0x1e3d4b);})['then'](function(_0x1be660){_0x463f0e[_0x74af('0x59')]=_0x1be660;return _0x463f0e;});}})[_0x74af('0x22')](respondWithFilteredResult(_0x436cb8,_0x1e3d4b))[_0x74af('0x3e')](handleError(_0x436cb8,null));};exports[_0x74af('0x5e')]=function(_0x470fc9,_0x55c448,_0x33c334){var _0x2767ef={'raw':!![],'where':{}};var _0x2c12ca={};var _0x291aa={'count':0x0,'rows':[]};return db[_0x74af('0x2a')][_0x74af('0x55')]({'where':{'id':_0x470fc9[_0x74af('0x40')]['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x55c448,null))[_0x74af('0x22')](function(_0x5a7edd){if(_0x5a7edd){_0x2c12ca['model']=_['keys'](db[_0x74af('0x5f')][_0x74af('0x2b')]);_0x2c12ca[_0x74af('0x30')]=_['keys'](_0x470fc9[_0x74af('0x30')]);_0x2c12ca[_0x74af('0x32')]=_['intersection'](_0x2c12ca[_0x74af('0x2f')],_0x2c12ca[_0x74af('0x30')]);_0x2767ef[_0x74af('0x35')]=_['intersection'](_0x2c12ca[_0x74af('0x2f')],qs[_0x74af('0x34')](_0x470fc9[_0x74af('0x30')]['fields']));_0x2767ef['attributes']=_0x2767ef[_0x74af('0x35')][_0x74af('0x41')]?_0x2767ef[_0x74af('0x35')]:_0x2c12ca[_0x74af('0x2f')];if(!_0x470fc9['query']['hasOwnProperty'](_0x74af('0x36'))){_0x2767ef[_0x74af('0x1c')]=qs[_0x74af('0x1c')](_0x470fc9['query'][_0x74af('0x1c')]);_0x2767ef[_0x74af('0x1b')]=qs['offset'](_0x470fc9[_0x74af('0x30')][_0x74af('0x1b')]);}_0x2767ef['order']=qs[_0x74af('0x38')](_0x470fc9[_0x74af('0x30')][_0x74af('0x38')]);_0x2767ef[_0x74af('0x39')]=qs[_0x74af('0x32')](_[_0x74af('0x5b')](_0x470fc9[_0x74af('0x30')],_0x2c12ca[_0x74af('0x32')]));_0x2767ef[_0x74af('0x39')][_0x74af('0x58')]=_0x5a7edd['id'];if(_0x470fc9[_0x74af('0x30')][_0x74af('0x3a')]){_0x2767ef[_0x74af('0x39')]=_[_0x74af('0x43')](_0x2767ef[_0x74af('0x39')],{'$or':_[_0x74af('0x29')](_0x2767ef[_0x74af('0x35')],function(_0xa0e1a){var _0x5e60be={};_0x5e60be[_0xa0e1a]={'$like':'%'+_0x470fc9[_0x74af('0x30')][_0x74af('0x3a')]+'%'};return _0x5e60be;})});}_0x2767ef=_[_0x74af('0x43')]({},_0x2767ef,_0x470fc9['options']);return db[_0x74af('0x5f')]['count']({'where':_0x2767ef['where']})['then'](function(_0x12a513){_0x291aa[_0x74af('0x1a')]=_0x12a513;if(_0x470fc9[_0x74af('0x30')][_0x74af('0x3c')]){_0x2767ef['include']=[{'all':!![]}];}return db[_0x74af('0x5f')]['findAll'](_0x2767ef);})[_0x74af('0x22')](function(_0x581676){_0x291aa[_0x74af('0x59')]=_0x581676;return _0x291aa;});}})[_0x74af('0x22')](respondWithFilteredResult(_0x55c448,_0x2767ef))[_0x74af('0x3e')](handleError(_0x55c448,null));};exports['getLists']=function(_0x562b75,_0xd84b6c,_0x34ee57){var _0x367f09={};var _0x411229={};var _0x43cd8d;var _0x28a762;return db['Campaign'][_0x74af('0x55')]({'where':{'id':_0x562b75[_0x74af('0x40')]['id']}})[_0x74af('0x22')](handleEntityNotFound(_0xd84b6c,null))[_0x74af('0x22')](function(_0x5036ce){if(_0x5036ce){_0x43cd8d=_0x5036ce;_0x411229[_0x74af('0x2f')]=_[_0x74af('0x31')](db[_0x74af('0x60')][_0x74af('0x2b')]);_0x411229[_0x74af('0x30')]=_['keys'](_0x562b75[_0x74af('0x30')]);_0x411229[_0x74af('0x32')]=_[_0x74af('0x33')](_0x411229[_0x74af('0x2f')],_0x411229[_0x74af('0x30')]);_0x367f09['attributes']=_['intersection'](_0x411229[_0x74af('0x2f')],qs[_0x74af('0x34')](_0x562b75[_0x74af('0x30')][_0x74af('0x34')]));_0x367f09[_0x74af('0x35')]=_0x367f09[_0x74af('0x35')][_0x74af('0x41')]?_0x367f09[_0x74af('0x35')]:_0x411229[_0x74af('0x2f')];_0x367f09['order']=qs[_0x74af('0x38')](_0x562b75['query'][_0x74af('0x38')]);_0x367f09['where']=qs[_0x74af('0x32')](_[_0x74af('0x5b')](_0x562b75['query'],_0x411229['filters']));if(_0x562b75[_0x74af('0x30')][_0x74af('0x3a')]){_0x367f09[_0x74af('0x39')]=_[_0x74af('0x43')](_0x367f09[_0x74af('0x39')],{'$or':_[_0x74af('0x29')](_0x367f09[_0x74af('0x35')],function(_0x2cbd0b){var _0x367497={};_0x367497[_0x2cbd0b]={'$like':'%'+_0x562b75[_0x74af('0x30')][_0x74af('0x3a')]+'%'};return _0x367497;})});}_0x367f09=_[_0x74af('0x43')]({},_0x367f09,_0x562b75['options']);return _0x43cd8d[_0x74af('0x61')](_0x367f09);}})[_0x74af('0x22')](function(_0x159371){if(_0x159371){_0x28a762=_0x159371[_0x74af('0x41')];if(!_0x562b75[_0x74af('0x30')][_0x74af('0x57')](_0x74af('0x36'))){_0x367f09[_0x74af('0x1c')]=qs[_0x74af('0x1c')](_0x562b75[_0x74af('0x30')][_0x74af('0x1c')]);_0x367f09['offset']=qs[_0x74af('0x1b')](_0x562b75[_0x74af('0x30')]['offset']);}return _0x43cd8d[_0x74af('0x61')](_0x367f09);}})[_0x74af('0x22')](function(_0x5f0b6d){if(_0x5f0b6d){return _0x5f0b6d?{'count':_0x28a762,'rows':_0x5f0b6d}:null;}})[_0x74af('0x22')](respondWithResult(_0xd84b6c,null))['catch'](handleError(_0xd84b6c,null));};exports[_0x74af('0x62')]=function(_0x12464f,_0x49847c,_0xd615f2){var _0x14031d,_0x235904;return db['Campaign'][_0x74af('0x44')]({'where':{'id':_0x12464f[_0x74af('0x40')]['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x49847c,null))[_0x74af('0x22')](function(_0x11e65f){if(_0x11e65f){_0x235904=_0x11e65f;return _0x11e65f['addLists'](_0x12464f['body'][_0x74af('0x63')],_[_0x74af('0x4c')](_0x12464f[_0x74af('0x46')],[_0x74af('0x63'),'id'])||{});}return null;})[_0x74af('0x64')](function(_0x4ff044){var _0x2985cf;_0x14031d=_0x4ff044||[];var _0x4a755a=[];if(_0x4ff044){for(var _0x322191=0x0;_0x322191<_0x4ff044['length'];_0x322191+=0x1){var _0x1aec37=_0x4ff044[_0x322191][_0x74af('0x48')]({'plain':!![]});_0x235904[_0x74af('0x65')]=_0x12464f[_0x74af('0x46')]['dialCheckDuplicateType']?_0x12464f[_0x74af('0x46')][_0x74af('0x65')]:_0x235904[_0x74af('0x65')];switch(_0x235904['dialCheckDuplicateType']){case _0x74af('0x66'):_0x2985cf=squel['insert']()['into'](_0x74af('0x67'))[_0x74af('0x68')](['phone',_0x74af('0x69'),_0x74af('0x6a'),_0x74af('0x6b'),_0x74af('0x58'),_0x74af('0x4d'),'updatedAt'],squel[_0x74af('0x6c')]()[_0x74af('0x6d')](_0x74af('0x6e'),_0x74af('0x6e'))[_0x74af('0x6d')]('NOW()',_0x74af('0x69'))[_0x74af('0x6d')]('id','ContactId')[_0x74af('0x6d')](_0x1aec37[_0x74af('0x6f')][_0x74af('0x70')](),_0x74af('0x6b'))['field'](_0x12464f[_0x74af('0x40')]['id'][_0x74af('0x70')](),_0x74af('0x58'))[_0x74af('0x6d')]('NOW()',_0x74af('0x4d'))[_0x74af('0x6d')](_0x74af('0x71'),_0x74af('0x4e'))['from'](_0x74af('0x72'))[_0x74af('0x39')]('deletedAt\x20IS\x20NULL')[_0x74af('0x39')]('ListId\x20=\x20?',_0x1aec37[_0x74af('0x6f')][_0x74af('0x70')]())['where'](_0x74af('0x73'))[_0x74af('0x39')](_0x74af('0x74'),squel[_0x74af('0x6c')]()[_0x74af('0x6d')](_0x74af('0x75'))['from']('cm_hopper_final')['where'](_0x74af('0x76'),_0x12464f[_0x74af('0x40')]['id'][_0x74af('0x70')]()))[_0x74af('0x39')](_0x74af('0x74'),squel[_0x74af('0x6c')]()[_0x74af('0x6d')](_0x74af('0x77'))[_0x74af('0x78')](_0x74af('0x67'))[_0x74af('0x39')](_0x74af('0x76'),_0x12464f['params']['id'][_0x74af('0x70')]())))[_0x74af('0x70')]();break;case _0x74af('0x79'):_0x2985cf=squel[_0x74af('0x7a')]()[_0x74af('0x7b')]('cm_hopper')[_0x74af('0x68')]([_0x74af('0x6e'),_0x74af('0x69'),_0x74af('0x6a'),'ListId','CampaignId',_0x74af('0x4d'),_0x74af('0x4e')],squel[_0x74af('0x6c')]()[_0x74af('0x6d')]('phone',_0x74af('0x6e'))[_0x74af('0x6d')](_0x74af('0x71'),_0x74af('0x69'))[_0x74af('0x6d')]('id',_0x74af('0x6a'))[_0x74af('0x6d')](_0x1aec37[_0x74af('0x6f')]['toString'](),_0x74af('0x6b'))['field'](_0x12464f['params']['id'][_0x74af('0x70')](),_0x74af('0x58'))['field'](_0x74af('0x71'),_0x74af('0x4d'))[_0x74af('0x6d')](_0x74af('0x71'),_0x74af('0x4e'))[_0x74af('0x78')](_0x74af('0x72'))[_0x74af('0x39')]('deletedAt\x20IS\x20NULL')[_0x74af('0x39')](_0x74af('0x7c'),_0x1aec37['CmListId'][_0x74af('0x70')]())[_0x74af('0x39')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x74af('0x6c')]()[_0x74af('0x6d')]('COALESCE(phone,\x27\x27)')[_0x74af('0x78')]('cm_hopper')[_0x74af('0x39')](_0x74af('0x76'),_0x12464f[_0x74af('0x40')]['id'][_0x74af('0x70')]())))['toString']();break;default:_0x2985cf=squel[_0x74af('0x7a')]()[_0x74af('0x7b')](_0x74af('0x67'))[_0x74af('0x68')]([_0x74af('0x6e'),'scheduledAt',_0x74af('0x6a'),_0x74af('0x6b'),_0x74af('0x58'),_0x74af('0x4d'),_0x74af('0x4e')],squel[_0x74af('0x6c')]()[_0x74af('0x6d')](_0x74af('0x6e'),_0x74af('0x6e'))[_0x74af('0x6d')](_0x74af('0x71'),_0x74af('0x69'))[_0x74af('0x6d')]('id',_0x74af('0x6a'))['field'](_0x1aec37['CmListId']['toString'](),'ListId')[_0x74af('0x6d')](_0x12464f[_0x74af('0x40')]['id']['toString'](),_0x74af('0x58'))[_0x74af('0x6d')]('NOW()',_0x74af('0x4d'))[_0x74af('0x6d')]('NOW()','updatedAt')[_0x74af('0x78')]('cm_contacts')[_0x74af('0x39')](_0x74af('0x7d'))[_0x74af('0x39')](_0x74af('0x7c'),_0x1aec37[_0x74af('0x6f')][_0x74af('0x70')]())[_0x74af('0x39')](_0x74af('0x73')))[_0x74af('0x70')]();}_0x4a755a[_0x74af('0x7e')](db[_0x74af('0x7f')][_0x74af('0x30')](_0x2985cf));}return BPromise[_0x74af('0x80')](_0x4a755a);}})[_0x74af('0x22')](function(){return _0x14031d;})[_0x74af('0x22')](respondWithResult(_0x49847c,null))['catch'](handleError(_0x49847c,null));};exports[_0x74af('0x81')]=function(_0x3daae2,_0x1a5cfc,_0x578ffb){return db[_0x74af('0x2a')][_0x74af('0x44')]({'where':{'id':_0x3daae2[_0x74af('0x40')]['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x1a5cfc,null))['then'](function(_0x57eb47){if(_0x57eb47){return _0x57eb47[_0x74af('0x81')](_0x3daae2['query'][_0x74af('0x63')]);}})[_0x74af('0x22')](function(_0x4b6aa7){if(_0x4b6aa7){return db[_0x74af('0x56')][_0x74af('0x23')]({'where':{'ListId':_0x3daae2['query']['ids'],'CampaignId':_0x3daae2[_0x74af('0x40')]['id']}})[_0x74af('0x22')](function(){return _0x4b6aa7;});}})[_0x74af('0x22')](respondWithStatusCode(_0x1a5cfc,null))[_0x74af('0x3e')](handleError(_0x1a5cfc,null));};exports['getBlackLists']=function(_0x537f30,_0x120e37,_0xb9089f){var _0x3f42d2={'raw':!![],'where':{}};var _0x1a529b={};var _0x156aa1={'count':0x0,'rows':[]};return db['Campaign'][_0x74af('0x55')]({'where':{'id':_0x537f30['params']['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x120e37,null))[_0x74af('0x22')](function(_0xef83d6){if(_0xef83d6){_0x1a529b[_0x74af('0x2f')]=_[_0x74af('0x31')](db[_0x74af('0x60')]['rawAttributes']);_0x1a529b['query']=_['keys'](_0x537f30[_0x74af('0x30')]);_0x1a529b[_0x74af('0x32')]=_[_0x74af('0x33')](_0x1a529b['model'],_0x1a529b['query']);_0x3f42d2[_0x74af('0x35')]=_[_0x74af('0x33')](_0x1a529b[_0x74af('0x2f')],qs['fields'](_0x537f30[_0x74af('0x30')][_0x74af('0x34')]));_0x3f42d2[_0x74af('0x35')]=_0x3f42d2[_0x74af('0x35')][_0x74af('0x41')]?_0x3f42d2['attributes']:_0x1a529b[_0x74af('0x2f')];if(!_0x537f30[_0x74af('0x30')][_0x74af('0x57')](_0x74af('0x36'))){_0x3f42d2[_0x74af('0x1c')]=qs[_0x74af('0x1c')](_0x537f30['query'][_0x74af('0x1c')]);_0x3f42d2[_0x74af('0x1b')]=qs[_0x74af('0x1b')](_0x537f30['query'][_0x74af('0x1b')]);}_0x3f42d2[_0x74af('0x37')]=qs[_0x74af('0x38')](_0x537f30[_0x74af('0x30')][_0x74af('0x38')]);_0x3f42d2[_0x74af('0x39')]=qs[_0x74af('0x32')](_['pick'](_0x537f30['query'],_0x1a529b[_0x74af('0x32')]));_0x3f42d2[_0x74af('0x39')][_0x74af('0x58')]=_0xef83d6['id'];if(_0x537f30[_0x74af('0x30')][_0x74af('0x3a')]){_0x3f42d2[_0x74af('0x39')]=_[_0x74af('0x43')](_0x3f42d2[_0x74af('0x39')],{'$or':_[_0x74af('0x29')](_0x3f42d2[_0x74af('0x35')],function(_0x229d12){var _0x230081={};_0x230081[_0x229d12]={'$like':'%'+_0x537f30[_0x74af('0x30')][_0x74af('0x3a')]+'%'};return _0x230081;})});}_0x3f42d2=_[_0x74af('0x43')]({},_0x3f42d2,_0x537f30[_0x74af('0x3b')]);return db[_0x74af('0x60')]['count']({'where':_0x3f42d2['where']})[_0x74af('0x22')](function(_0x504add){_0x156aa1['count']=_0x504add;if(_0x537f30[_0x74af('0x30')][_0x74af('0x3c')]){_0x3f42d2['include']=[{'all':!![]}];}return db['CmList']['findAll'](_0x3f42d2);})['then'](function(_0x3193a2){_0x156aa1[_0x74af('0x59')]=_0x3193a2;return _0x156aa1;});}})[_0x74af('0x22')](respondWithFilteredResult(_0x120e37,_0x3f42d2))[_0x74af('0x3e')](handleError(_0x120e37,null));};exports['addBlackLists']=function(_0x1a018a,_0x18a808,_0x556709){var _0xe4419c,_0x44322b;return db[_0x74af('0x2a')]['find']({'where':{'id':_0x1a018a[_0x74af('0x40')]['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x18a808,null))[_0x74af('0x22')](function(_0x2f2f32){if(_0x2f2f32){_0x44322b=_0x2f2f32;return _0x2f2f32[_0x74af('0x82')](_0x1a018a[_0x74af('0x46')]['ids'],_[_0x74af('0x4c')](_0x1a018a['body'],[_0x74af('0x63'),'id'])||{});}return null;})[_0x74af('0x64')](function(_0x2637ae){var _0x492815;_0xe4419c=_0x2637ae||[];var _0xfcfb10=[];if(_0x2637ae){for(var _0x439555=0x0;_0x439555<_0x2637ae['length'];_0x439555+=0x1){var _0x199f02=_0x2637ae[_0x439555]['get']({'plain':!![]});_0x492815=squel[_0x74af('0x7a')]()[_0x74af('0x7b')]('cm_hopper_black')['fromQuery']([_0x74af('0x6e'),_0x74af('0x6a'),_0x74af('0x6b'),_0x74af('0x58'),_0x74af('0x4d'),'updatedAt'],squel[_0x74af('0x6c')]()[_0x74af('0x6d')](_0x74af('0x6e'),_0x74af('0x6e'))[_0x74af('0x6d')]('id','ContactId')[_0x74af('0x6d')](_0x199f02['CmListId']['toString'](),'ListId')['field'](_0x1a018a['params']['id'][_0x74af('0x70')](),_0x74af('0x58'))['field'](_0x74af('0x71'),_0x74af('0x4d'))[_0x74af('0x6d')](_0x74af('0x71'),_0x74af('0x4e'))[_0x74af('0x78')](_0x74af('0x72'))[_0x74af('0x39')](_0x74af('0x7d'))[_0x74af('0x39')]('ListId\x20=\x20?',_0x199f02[_0x74af('0x6f')]['toString']())[_0x74af('0x39')](_0x74af('0x73')))[_0x74af('0x70')]();_0xfcfb10[_0x74af('0x7e')](db[_0x74af('0x7f')][_0x74af('0x30')](_0x492815));}return BPromise[_0x74af('0x80')](_0xfcfb10);}})['then'](function(){return _0xe4419c;})['then'](respondWithResult(_0x18a808,null))[_0x74af('0x3e')](handleError(_0x18a808,null));};exports[_0x74af('0x83')]=function(_0x5a3d51,_0x38b1fd,_0x21173c){return db[_0x74af('0x2a')]['find']({'where':{'id':_0x5a3d51[_0x74af('0x40')]['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x38b1fd,null))[_0x74af('0x22')](function(_0x2a9091){if(_0x2a9091){return _0x2a9091['removeBlackLists'](_0x5a3d51[_0x74af('0x30')][_0x74af('0x63')]);}})[_0x74af('0x22')](function(_0xaf4fd0){if(_0xaf4fd0){return db[_0x74af('0x5f')][_0x74af('0x23')]({'where':{'ListId':_0x5a3d51['query'][_0x74af('0x63')],'CampaignId':_0x5a3d51[_0x74af('0x40')]['id']}})[_0x74af('0x22')](function(){return _0xaf4fd0;});}})['then'](respondWithStatusCode(_0x38b1fd,null))[_0x74af('0x3e')](handleError(_0x38b1fd,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 7a68ce1..1dc9321 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','campaigns','lodash','../../config/logger'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0xb10b,0x12a));var _0xbb10=function(_0x161ec6,_0x580285){_0x161ec6=_0x161ec6-0x0;var _0x477176=_0xb10b[_0x161ec6];return _0x477176;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('Campaign',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x55d61d,_0x12e03a){var _0x16f451=function(_0x24e769){while(--_0x24e769){_0x55d61d['push'](_0x55d61d['shift']());}};_0x16f451(++_0x12e03a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 7abee32..29bd1a6 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(_0x7fa8a1,_0x52c9be){var _0x41fa61=function(_0x185b0d){while(--_0x185b0d){_0x7fa8a1['push'](_0x7fa8a1['shift']());}};_0x41fa61(++_0x52c9be);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 _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(_0x40de5d,_0x3943a8){var _0x3bd741=function(_0x404358){while(--_0x404358){_0x40de5d['push'](_0x40de5d['shift']());}};_0x3bd741(++_0x3943a8);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 3e1c1f9..45d6bd4 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 _0x5f87=['isAuthenticated','index','show','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','/:id','update','delete','removeLists','removeBlackLists','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./campaign.controller','get'];(function(_0x474ed3,_0x5d44b8){var _0x2460f4=function(_0x3aaadb){while(--_0x3aaadb){_0x474ed3['push'](_0x474ed3['shift']());}};_0x2460f4(++_0x5d44b8);}(_0x5f87,0x1be));var _0x75f8=function(_0x20c227,_0xf3f44e){_0x20c227=_0x20c227-0x0;var _0x10bc30=_0x5f87[_0x20c227];return _0x10bc30;};'use strict';var multer=require(_0x75f8('0x0'));var util=require(_0x75f8('0x1'));var path=require(_0x75f8('0x2'));var timeout=require('connect-timeout');var express=require(_0x75f8('0x3'));var router=express[_0x75f8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x75f8('0x5'));var config=require(_0x75f8('0x6'));var controller=require(_0x75f8('0x7'));router[_0x75f8('0x8')]('/',auth[_0x75f8('0x9')](),controller[_0x75f8('0xa')]);router[_0x75f8('0x8')]('/:id',auth[_0x75f8('0x9')](),controller[_0x75f8('0xb')]);router[_0x75f8('0x8')](_0x75f8('0xc'),auth['isAuthenticated'](),controller['getHoppers']);router[_0x75f8('0x8')](_0x75f8('0xd'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x75f8('0x8')](_0x75f8('0xe'),auth['isAuthenticated'](),controller[_0x75f8('0xf')]);router['get'](_0x75f8('0x10'),auth['isAuthenticated'](),controller[_0x75f8('0x11')]);router[_0x75f8('0x8')](_0x75f8('0x12'),auth['isAuthenticated'](),controller[_0x75f8('0x13')]);router[_0x75f8('0x8')](_0x75f8('0x14'),auth['isAuthenticated'](),controller[_0x75f8('0x15')]);router[_0x75f8('0x16')]('/',auth['isAuthenticated'](),controller[_0x75f8('0x17')]);router[_0x75f8('0x16')](_0x75f8('0x18'),auth[_0x75f8('0x9')](),controller[_0x75f8('0x19')]);router['post']('/:id/lists',auth[_0x75f8('0x9')](),controller[_0x75f8('0x1a')]);router['post'](_0x75f8('0x14'),auth['isAuthenticated'](),controller[_0x75f8('0x1b')]);router[_0x75f8('0x1c')](_0x75f8('0x1d'),auth[_0x75f8('0x9')](),controller[_0x75f8('0x1e')]);router['delete'](_0x75f8('0x1d'),auth[_0x75f8('0x9')](),controller['destroy']);router[_0x75f8('0x1f')]('/:id/lists',auth['isAuthenticated'](),controller[_0x75f8('0x20')]);router[_0x75f8('0x1f')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x75f8('0x21')]);module[_0x75f8('0x22')]=router; \ No newline at end of file +var _0xb0e3=['create','/:id/clone','/:id/lists','addLists','addBlackLists','put','update','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./campaign.controller','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getLists','/:id/blacklists','getBlackLists','post'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb0e3,0x113));var _0x3b0e=function(_0x2b0111,_0x43367b){_0x2b0111=_0x2b0111-0x0;var _0x22397b=_0xb0e3[_0x2b0111];return _0x22397b;};'use strict';var multer=require(_0x3b0e('0x0'));var util=require(_0x3b0e('0x1'));var path=require(_0x3b0e('0x2'));var timeout=require(_0x3b0e('0x3'));var express=require(_0x3b0e('0x4'));var router=express[_0x3b0e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3b0e('0x6'));var config=require(_0x3b0e('0x7'));var controller=require(_0x3b0e('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3b0e('0x9')](_0x3b0e('0xa'),auth[_0x3b0e('0xb')](),controller[_0x3b0e('0xc')]);router[_0x3b0e('0x9')](_0x3b0e('0xd'),auth[_0x3b0e('0xb')](),controller[_0x3b0e('0xe')]);router[_0x3b0e('0x9')](_0x3b0e('0xf'),auth['isAuthenticated'](),controller[_0x3b0e('0x10')]);router[_0x3b0e('0x9')](_0x3b0e('0x11'),auth[_0x3b0e('0xb')](),controller['getHopperFinals']);router[_0x3b0e('0x9')]('/:id/hopper_black',auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0x3b0e('0x9')]('/:id/lists',auth[_0x3b0e('0xb')](),controller[_0x3b0e('0x12')]);router[_0x3b0e('0x9')](_0x3b0e('0x13'),auth[_0x3b0e('0xb')](),controller[_0x3b0e('0x14')]);router[_0x3b0e('0x15')]('/',auth['isAuthenticated'](),controller[_0x3b0e('0x16')]);router[_0x3b0e('0x15')](_0x3b0e('0x17'),auth[_0x3b0e('0xb')](),controller['clone']);router[_0x3b0e('0x15')](_0x3b0e('0x18'),auth['isAuthenticated'](),controller[_0x3b0e('0x19')]);router[_0x3b0e('0x15')]('/:id/blacklists',auth[_0x3b0e('0xb')](),controller[_0x3b0e('0x1a')]);router[_0x3b0e('0x1b')](_0x3b0e('0xa'),auth['isAuthenticated'](),controller[_0x3b0e('0x1c')]);router[_0x3b0e('0x1d')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x3b0e('0x1d')](_0x3b0e('0x18'),auth[_0x3b0e('0xb')](),controller[_0x3b0e('0x1e')]);router[_0x3b0e('0x1d')](_0x3b0e('0x13'),auth[_0x3b0e('0xb')](),controller[_0x3b0e('0x1f')]);module[_0x3b0e('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 948b64d..1b1e4b6 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 _0xd72c=['VIRTUAL','key','sequelize','STRING','TEXT'];(function(_0xc65834,_0x5df6fb){var _0x5da298=function(_0x30fbc2){while(--_0x30fbc2){_0xc65834['push'](_0xc65834['shift']());}};_0x5da298(++_0x5df6fb);}(_0xd72c,0x1c4));var _0xcd72=function(_0x43e97a,_0x1a53ff){_0x43e97a=_0x43e97a-0x0;var _0x3140a9=_0xd72c[_0x43e97a];return _0x3140a9;};'use strict';var Sequelize=require(_0xcd72('0x0'));module['exports']={'key':{'type':Sequelize[_0xcd72('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xcd72('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcd72('0x1')]},'name':{'type':Sequelize[_0xcd72('0x3')],'get':function(){return this['getDataValue'](_0xcd72('0x4'));}}}; \ No newline at end of file +var _0xa2f3=['STRING','TEXT','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x1d426f,_0x37e919){var _0x17f71a=function(_0x3bf60c){while(--_0x3bf60c){_0x1d426f['push'](_0x1d426f['shift']());}};_0x17f71a(++_0x37e919);}(_0xa2f3,0x1b0));var _0x3a2f=function(_0x28b4f2,_0x344860){_0x28b4f2=_0x28b4f2-0x0;var _0x1662df=_0xa2f3[_0x28b4f2];return _0x1662df;};'use strict';var Sequelize=require(_0x3a2f('0x0'));module[_0x3a2f('0x1')]={'key':{'type':Sequelize[_0x3a2f('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x3a2f('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x3a2f('0x4')],'get':function(){return this[_0x3a2f('0x5')](_0x3a2f('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 16afa9d..505de1f 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 _0x9297=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','name','send','index','map','CannedAnswer','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','update','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x9297,0xa3));var _0x7929=function(_0x547927,_0x546dab){_0x547927=_0x547927-0x0;var _0x5b9923=_0x9297[_0x547927];return _0x5b9923;};'use strict';var pdf=require(_0x7929('0x0'));var emlformat=require(_0x7929('0x1'));var rimraf=require(_0x7929('0x2'));var zipdir=require(_0x7929('0x3'));var jsonpatch=require(_0x7929('0x4'));var rp=require('request-promise');var moment=require(_0x7929('0x5'));var BPromise=require(_0x7929('0x6'));var Mustache=require(_0x7929('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7929('0x8'));var csv=require(_0x7929('0x9'));var ejs=require(_0x7929('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7929('0xb'));var crypto=require(_0x7929('0xc'));var jsforce=require(_0x7929('0xd'));var deskjs=require(_0x7929('0xe'));var toCsv=require(_0x7929('0x9'));var querystring=require('querystring');var Papa=require(_0x7929('0xf'));var Redis=require(_0x7929('0x10'));var authService=require(_0x7929('0x11'));var qs=require(_0x7929('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7929('0x13'));var logger=require('../../config/logger')(_0x7929('0x14'));var utils=require(_0x7929('0x15'));var config=require('../../config/environment');var db=require(_0x7929('0x16'))['db'];function respondWithStatusCode(_0x3a88e8,_0x5e79d3){_0x5e79d3=_0x5e79d3||0xcc;return function(_0x2ab898){if(_0x2ab898){return _0x3a88e8[_0x7929('0x17')](_0x5e79d3);}return _0x3a88e8[_0x7929('0x18')](_0x5e79d3)[_0x7929('0x19')]();};}function respondWithResult(_0x225b12,_0x54c72c){_0x54c72c=_0x54c72c||0xc8;return function(_0x9c62d9){if(_0x9c62d9){return _0x225b12[_0x7929('0x18')](_0x54c72c)[_0x7929('0x1a')](_0x9c62d9);}};}function respondWithFilteredResult(_0x276cf7,_0x4ade21){return function(_0x2e8386){if(_0x2e8386){var _0x5dedc8=_0x2e8386[_0x7929('0x1b')],_0x8a5d4f=_0x4ade21['offset'],_0x1b0f7b=_0x4ade21[_0x7929('0x1c')]+_0x4ade21[_0x7929('0x1d')],_0x396985;if(_0x1b0f7b>=_0x5dedc8){_0x1b0f7b=_0x5dedc8;_0x396985=0xc8;}else{_0x396985=0xce;}_0x276cf7['status'](_0x396985);return _0x276cf7['set'](_0x7929('0x1e'),_0x8a5d4f+'-'+_0x1b0f7b+'/'+_0x5dedc8)[_0x7929('0x1a')](_0x2e8386);}return null;};}function patchUpdates(_0x5765d6){return function(_0x2bdb67){try{jsonpatch[_0x7929('0x1f')](_0x2bdb67,_0x5765d6,!![]);}catch(_0x458985){return BPromise[_0x7929('0x20')](_0x458985);}return _0x2bdb67[_0x7929('0x21')]();};}function saveUpdates(_0x2df133,_0x2dc591){return function(_0x532a8e){if(_0x532a8e){return _0x532a8e['update'](_0x2df133)[_0x7929('0x22')](function(_0x3113df){return _0x3113df;});}return null;};}function removeEntity(_0x20b62,_0x5c84d2){return function(_0xac2a4b){if(_0xac2a4b){return _0xac2a4b['destroy']()[_0x7929('0x22')](function(){var _0x9090f4=_0xac2a4b[_0x7929('0x23')]({'plain':!![]});var _0x12a05c='CannedAnswers';return db[_0x7929('0x24')][_0x7929('0x25')]({'where':{'type':_0x12a05c,'resourceId':_0x9090f4['id']}})[_0x7929('0x22')](function(){return _0xac2a4b;});})['then'](function(){_0x20b62[_0x7929('0x18')](0xcc)[_0x7929('0x19')]();});}};}function handleEntityNotFound(_0x535ad2,_0x3e72e9){return function(_0xc2a742){if(!_0xc2a742){_0x535ad2['sendStatus'](0x194);}return _0xc2a742;};}function handleError(_0x2ca62c,_0x314360){_0x314360=_0x314360||0x1f4;return function(_0xf6a174){logger['error'](_0xf6a174[_0x7929('0x26')]);if(_0xf6a174[_0x7929('0x27')]){delete _0xf6a174['name'];}_0x2ca62c['status'](_0x314360)[_0x7929('0x28')](_0xf6a174);};}exports[_0x7929('0x29')]=function(_0x228061,_0x42e71b){var _0x18e5b0={},_0x374271={},_0x57cdef={'count':0x0,'rows':[]};var _0x2bf7d3=_[_0x7929('0x2a')](db[_0x7929('0x2b')][_0x7929('0x2c')],function(_0x514fa6){return{'name':_0x514fa6['fieldName'],'type':_0x514fa6[_0x7929('0x2d')][_0x7929('0x2e')]};});_0x374271[_0x7929('0x2f')]=_[_0x7929('0x2a')](_0x2bf7d3,_0x7929('0x27'));_0x374271[_0x7929('0x30')]=_['keys'](_0x228061['query']);_0x374271['filters']=_[_0x7929('0x31')](_0x374271[_0x7929('0x2f')],_0x374271['query']);_0x18e5b0[_0x7929('0x32')]=_[_0x7929('0x31')](_0x374271['model'],qs[_0x7929('0x33')](_0x228061[_0x7929('0x30')]['fields']));_0x18e5b0['attributes']=_0x18e5b0['attributes'][_0x7929('0x34')]?_0x18e5b0['attributes']:_0x374271[_0x7929('0x2f')];if(!_0x228061[_0x7929('0x30')]['hasOwnProperty'](_0x7929('0x35'))){_0x18e5b0['limit']=qs[_0x7929('0x1d')](_0x228061[_0x7929('0x30')]['limit']);_0x18e5b0[_0x7929('0x1c')]=qs[_0x7929('0x1c')](_0x228061[_0x7929('0x30')][_0x7929('0x1c')]);}_0x18e5b0[_0x7929('0x36')]=qs[_0x7929('0x37')](_0x228061[_0x7929('0x30')][_0x7929('0x37')]);_0x18e5b0[_0x7929('0x38')]=qs[_0x7929('0x39')](_[_0x7929('0x3a')](_0x228061['query'],_0x374271[_0x7929('0x39')]),_0x2bf7d3);if(_0x228061[_0x7929('0x30')][_0x7929('0x3b')]){_0x18e5b0['where']=_[_0x7929('0x3c')](_0x18e5b0[_0x7929('0x38')],{'$or':_[_0x7929('0x2a')](_0x2bf7d3,function(_0x5509d2){if(_0x5509d2[_0x7929('0x2d')]!==_0x7929('0x3d')){var _0x3e2b9b={};_0x3e2b9b[_0x5509d2[_0x7929('0x27')]]={'$like':'%'+_0x228061[_0x7929('0x30')]['filter']+'%'};return _0x3e2b9b;}})});}_0x18e5b0=_['merge']({},_0x18e5b0,_0x228061[_0x7929('0x3e')]);var _0x11e1e8={'where':_0x18e5b0['where']};return db[_0x7929('0x2b')][_0x7929('0x1b')](_0x11e1e8)[_0x7929('0x22')](function(_0x38270b){_0x57cdef[_0x7929('0x1b')]=_0x38270b;if(_0x228061[_0x7929('0x30')][_0x7929('0x3f')]){_0x18e5b0[_0x7929('0x40')]=[{'all':!![]}];}return db[_0x7929('0x2b')][_0x7929('0x41')](_0x18e5b0);})[_0x7929('0x22')](function(_0x431004){_0x57cdef['rows']=_0x431004;return _0x57cdef;})[_0x7929('0x22')](respondWithFilteredResult(_0x42e71b,_0x18e5b0))[_0x7929('0x42')](handleError(_0x42e71b,null));};exports[_0x7929('0x43')]=function(_0x12bc71,_0x24e5ab){var _0xc6f749={'raw':!![],'where':{'id':_0x12bc71[_0x7929('0x44')]['id']}},_0x2905fe={};_0x2905fe[_0x7929('0x2f')]=_[_0x7929('0x45')](db[_0x7929('0x2b')][_0x7929('0x2c')]);_0x2905fe['query']=_[_0x7929('0x45')](_0x12bc71[_0x7929('0x30')]);_0x2905fe['filters']=_[_0x7929('0x31')](_0x2905fe[_0x7929('0x2f')],_0x2905fe[_0x7929('0x30')]);_0xc6f749[_0x7929('0x32')]=_['intersection'](_0x2905fe[_0x7929('0x2f')],qs[_0x7929('0x33')](_0x12bc71[_0x7929('0x30')]['fields']));_0xc6f749[_0x7929('0x32')]=_0xc6f749['attributes'][_0x7929('0x34')]?_0xc6f749[_0x7929('0x32')]:_0x2905fe['model'];if(_0x12bc71[_0x7929('0x30')][_0x7929('0x3f')]){_0xc6f749[_0x7929('0x40')]=[{'all':!![]}];}_0xc6f749=_[_0x7929('0x3c')]({},_0xc6f749,_0x12bc71[_0x7929('0x3e')]);return db[_0x7929('0x2b')]['find'](_0xc6f749)[_0x7929('0x22')](handleEntityNotFound(_0x24e5ab,null))[_0x7929('0x22')](respondWithResult(_0x24e5ab,null))[_0x7929('0x42')](handleError(_0x24e5ab,null));};exports[_0x7929('0x46')]=function(_0x6a3a51,_0x184460){if(_0x6a3a51[_0x7929('0x47')]['id']){delete _0x6a3a51[_0x7929('0x47')]['id'];}return db[_0x7929('0x2b')][_0x7929('0x48')]({'where':{'id':_0x6a3a51['params']['id']}})['then'](handleEntityNotFound(_0x184460,null))[_0x7929('0x22')](saveUpdates(_0x6a3a51[_0x7929('0x47')],null))[_0x7929('0x22')](respondWithResult(_0x184460,null))['catch'](handleError(_0x184460,null));};exports[_0x7929('0x25')]=function(_0x30c2a7,_0x5ac079){return db[_0x7929('0x2b')]['find']({'where':{'id':_0x30c2a7['params']['id']}})[_0x7929('0x22')](handleEntityNotFound(_0x5ac079,null))[_0x7929('0x22')](removeEntity(_0x5ac079,null))['catch'](handleError(_0x5ac079,null));};exports[_0x7929('0x49')]=function(_0x3585ac,_0x450ef7){var _0x258ce8={'key':_0x3585ac[_0x7929('0x47')][_0x7929('0x2e')]};if(_0x3585ac[_0x7929('0x47')][_0x7929('0x4a')]){_0x258ce8[_0x7929('0x4a')]=_0x3585ac['body'][_0x7929('0x4a')];}else if(_0x3585ac[_0x7929('0x47')]['SmsAccountId']){_0x258ce8[_0x7929('0x4b')]=_0x3585ac[_0x7929('0x47')][_0x7929('0x4b')];}else if(_0x3585ac[_0x7929('0x47')][_0x7929('0x4c')]){_0x258ce8[_0x7929('0x4c')]=_0x3585ac[_0x7929('0x47')]['OpenchannelAccountId'];}else if(_0x3585ac[_0x7929('0x47')][_0x7929('0x4d')]){_0x258ce8[_0x7929('0x4d')]=_0x3585ac[_0x7929('0x47')][_0x7929('0x4d')];}return db[_0x7929('0x2b')][_0x7929('0x48')]({'where':_0x258ce8})['then'](function(_0x485b64){if(_0x485b64){throw new db[(_0x7929('0x4e'))][(_0x7929('0x4f'))](_0x7929('0x50'));}return db[_0x7929('0x2b')][_0x7929('0x49')](_0x3585ac['body']);})['then'](function(_0x368b68){var _0x51a5b8=_0x3585ac['user'][_0x7929('0x23')]({'plain':!![]});if(!_0x51a5b8)throw new Error(_0x7929('0x51'));if(_0x51a5b8[_0x7929('0x52')]==='user'){var _0x2ed9b5=_0x368b68[_0x7929('0x23')]({'plain':!![]});return db[_0x7929('0x53')][_0x7929('0x48')]({'where':{'name':_0x7929('0x54'),'userProfileId':_0x51a5b8[_0x7929('0x55')]},'raw':!![]})[_0x7929('0x22')](function(_0x610de9){if(_0x610de9&&_0x610de9[_0x7929('0x56')]===0x0){return db['UserProfileResource'][_0x7929('0x49')]({'name':_0x2ed9b5[_0x7929('0x27')],'resourceId':_0x2ed9b5['id'],'type':_0x610de9[_0x7929('0x27')],'sectionId':_0x610de9['id']},{})[_0x7929('0x22')](function(){return _0x368b68;});}else{return _0x368b68;}})[_0x7929('0x42')](function(_0x4e247a){logger[_0x7929('0x57')](_0x7929('0x58'),_0x4e247a);throw _0x4e247a;});}return _0x368b68;})[_0x7929('0x22')](respondWithResult(_0x450ef7,0xc9))[_0x7929('0x42')](handleError(_0x450ef7,null));}; \ No newline at end of file +var _0x9064=['query','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','CannedAnswer','includeAll','include','findAll','rows','catch','params','rawAttributes','length','merge','options','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','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','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','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','then','CannedAnswers','UserProfileResource','destroy','error','name','send','index','map','fieldName','type','key','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9064,0x125));var _0x4906=function(_0x57c39e,_0x401207){_0x57c39e=_0x57c39e-0x0;var _0x5314b6=_0x9064[_0x57c39e];return _0x5314b6;};'use strict';var pdf=require(_0x4906('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4906('0x1'));var zipdir=require(_0x4906('0x2'));var jsonpatch=require(_0x4906('0x3'));var rp=require('request-promise');var moment=require(_0x4906('0x4'));var BPromise=require(_0x4906('0x5'));var Mustache=require(_0x4906('0x6'));var util=require('util');var path=require(_0x4906('0x7'));var sox=require(_0x4906('0x8'));var csv=require(_0x4906('0x9'));var ejs=require(_0x4906('0xa'));var fs=require('fs');var _=require(_0x4906('0xb'));var squel=require(_0x4906('0xc'));var crypto=require(_0x4906('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4906('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4906('0xf'));var Papa=require('papaparse');var Redis=require(_0x4906('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4906('0x11'));var hardwareService=require(_0x4906('0x12'));var logger=require(_0x4906('0x13'))(_0x4906('0x14'));var utils=require('../../config/utils');var config=require(_0x4906('0x15'));var db=require(_0x4906('0x16'))['db'];function respondWithStatusCode(_0x49b90c,_0x539ece){_0x539ece=_0x539ece||0xcc;return function(_0x20d87b){if(_0x20d87b){return _0x49b90c[_0x4906('0x17')](_0x539ece);}return _0x49b90c[_0x4906('0x18')](_0x539ece)[_0x4906('0x19')]();};}function respondWithResult(_0x4fc391,_0x3a4432){_0x3a4432=_0x3a4432||0xc8;return function(_0x1215ba){if(_0x1215ba){return _0x4fc391[_0x4906('0x18')](_0x3a4432)[_0x4906('0x1a')](_0x1215ba);}};}function respondWithFilteredResult(_0x545aa2,_0x2aa38d){return function(_0x425f95){if(_0x425f95){var _0x107d76=_0x425f95[_0x4906('0x1b')],_0xd9b0af=_0x2aa38d[_0x4906('0x1c')],_0x3b1cbf=_0x2aa38d[_0x4906('0x1c')]+_0x2aa38d[_0x4906('0x1d')],_0x18bc9d;if(_0x3b1cbf>=_0x107d76){_0x3b1cbf=_0x107d76;_0x18bc9d=0xc8;}else{_0x18bc9d=0xce;}_0x545aa2['status'](_0x18bc9d);return _0x545aa2[_0x4906('0x1e')](_0x4906('0x1f'),_0xd9b0af+'-'+_0x3b1cbf+'/'+_0x107d76)[_0x4906('0x1a')](_0x425f95);}return null;};}function patchUpdates(_0x9c5e41){return function(_0x3d0be7){try{jsonpatch['apply'](_0x3d0be7,_0x9c5e41,!![]);}catch(_0x429e1b){return BPromise[_0x4906('0x20')](_0x429e1b);}return _0x3d0be7[_0x4906('0x21')]();};}function saveUpdates(_0x28cc57,_0x25fb22){return function(_0x35187f){if(_0x35187f){return _0x35187f['update'](_0x28cc57)[_0x4906('0x22')](function(_0x3ea0b0){return _0x3ea0b0;});}return null;};}function removeEntity(_0x155248,_0x5454b2){return function(_0x2e6b7b){if(_0x2e6b7b){return _0x2e6b7b['destroy']()[_0x4906('0x22')](function(){var _0x403096=_0x2e6b7b['get']({'plain':!![]});var _0x4559ce=_0x4906('0x23');return db[_0x4906('0x24')][_0x4906('0x25')]({'where':{'type':_0x4559ce,'resourceId':_0x403096['id']}})[_0x4906('0x22')](function(){return _0x2e6b7b;});})[_0x4906('0x22')](function(){_0x155248[_0x4906('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55f4c1,_0x331fb1){return function(_0x422ac4){if(!_0x422ac4){_0x55f4c1[_0x4906('0x17')](0x194);}return _0x422ac4;};}function handleError(_0x436f8b,_0x5bcbb2){_0x5bcbb2=_0x5bcbb2||0x1f4;return function(_0x355aa5){logger[_0x4906('0x26')](_0x355aa5['stack']);if(_0x355aa5[_0x4906('0x27')]){delete _0x355aa5[_0x4906('0x27')];}_0x436f8b['status'](_0x5bcbb2)[_0x4906('0x28')](_0x355aa5);};}exports[_0x4906('0x29')]=function(_0x4c305d,_0x466d67){var _0x5c3fb1={},_0x2b0c73={},_0x4a6454={'count':0x0,'rows':[]};var _0x228fc6=_[_0x4906('0x2a')](db['CannedAnswer']['rawAttributes'],function(_0x5bd240){return{'name':_0x5bd240[_0x4906('0x2b')],'type':_0x5bd240[_0x4906('0x2c')][_0x4906('0x2d')]};});_0x2b0c73['model']=_[_0x4906('0x2a')](_0x228fc6,_0x4906('0x27'));_0x2b0c73['query']=_[_0x4906('0x2e')](_0x4c305d[_0x4906('0x2f')]);_0x2b0c73[_0x4906('0x30')]=_[_0x4906('0x31')](_0x2b0c73['model'],_0x2b0c73[_0x4906('0x2f')]);_0x5c3fb1[_0x4906('0x32')]=_[_0x4906('0x31')](_0x2b0c73[_0x4906('0x33')],qs[_0x4906('0x34')](_0x4c305d['query'][_0x4906('0x34')]));_0x5c3fb1[_0x4906('0x32')]=_0x5c3fb1['attributes']['length']?_0x5c3fb1['attributes']:_0x2b0c73['model'];if(!_0x4c305d['query']['hasOwnProperty'](_0x4906('0x35'))){_0x5c3fb1[_0x4906('0x1d')]=qs[_0x4906('0x1d')](_0x4c305d[_0x4906('0x2f')][_0x4906('0x1d')]);_0x5c3fb1[_0x4906('0x1c')]=qs[_0x4906('0x1c')](_0x4c305d[_0x4906('0x2f')][_0x4906('0x1c')]);}_0x5c3fb1[_0x4906('0x36')]=qs['sort'](_0x4c305d[_0x4906('0x2f')][_0x4906('0x37')]);_0x5c3fb1[_0x4906('0x38')]=qs[_0x4906('0x30')](_[_0x4906('0x39')](_0x4c305d[_0x4906('0x2f')],_0x2b0c73[_0x4906('0x30')]),_0x228fc6);if(_0x4c305d[_0x4906('0x2f')][_0x4906('0x3a')]){_0x5c3fb1[_0x4906('0x38')]=_['merge'](_0x5c3fb1['where'],{'$or':_[_0x4906('0x2a')](_0x228fc6,function(_0x57b7b4){if(_0x57b7b4['type']!==_0x4906('0x3b')){var _0xfd8b1e={};_0xfd8b1e[_0x57b7b4[_0x4906('0x27')]]={'$like':'%'+_0x4c305d[_0x4906('0x2f')][_0x4906('0x3a')]+'%'};return _0xfd8b1e;}})});}_0x5c3fb1=_['merge']({},_0x5c3fb1,_0x4c305d['options']);var _0x2f5160={'where':_0x5c3fb1[_0x4906('0x38')]};return db[_0x4906('0x3c')][_0x4906('0x1b')](_0x2f5160)[_0x4906('0x22')](function(_0x3cc683){_0x4a6454[_0x4906('0x1b')]=_0x3cc683;if(_0x4c305d['query'][_0x4906('0x3d')]){_0x5c3fb1[_0x4906('0x3e')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4906('0x3f')](_0x5c3fb1);})[_0x4906('0x22')](function(_0x462d3e){_0x4a6454[_0x4906('0x40')]=_0x462d3e;return _0x4a6454;})[_0x4906('0x22')](respondWithFilteredResult(_0x466d67,_0x5c3fb1))[_0x4906('0x41')](handleError(_0x466d67,null));};exports['show']=function(_0x9a4431,_0x7fea5c){var _0xae4448={'raw':!![],'where':{'id':_0x9a4431[_0x4906('0x42')]['id']}},_0x5904cc={};_0x5904cc[_0x4906('0x33')]=_[_0x4906('0x2e')](db[_0x4906('0x3c')][_0x4906('0x43')]);_0x5904cc['query']=_[_0x4906('0x2e')](_0x9a4431[_0x4906('0x2f')]);_0x5904cc[_0x4906('0x30')]=_['intersection'](_0x5904cc['model'],_0x5904cc['query']);_0xae4448['attributes']=_['intersection'](_0x5904cc[_0x4906('0x33')],qs[_0x4906('0x34')](_0x9a4431['query'][_0x4906('0x34')]));_0xae4448['attributes']=_0xae4448[_0x4906('0x32')][_0x4906('0x44')]?_0xae4448[_0x4906('0x32')]:_0x5904cc[_0x4906('0x33')];if(_0x9a4431[_0x4906('0x2f')][_0x4906('0x3d')]){_0xae4448['include']=[{'all':!![]}];}_0xae4448=_[_0x4906('0x45')]({},_0xae4448,_0x9a4431[_0x4906('0x46')]);return db[_0x4906('0x3c')][_0x4906('0x47')](_0xae4448)[_0x4906('0x22')](handleEntityNotFound(_0x7fea5c,null))['then'](respondWithResult(_0x7fea5c,null))['catch'](handleError(_0x7fea5c,null));};exports[_0x4906('0x48')]=function(_0x51f686,_0x57630b){if(_0x51f686[_0x4906('0x49')]['id']){delete _0x51f686[_0x4906('0x49')]['id'];}return db[_0x4906('0x3c')][_0x4906('0x47')]({'where':{'id':_0x51f686[_0x4906('0x42')]['id']}})[_0x4906('0x22')](handleEntityNotFound(_0x57630b,null))[_0x4906('0x22')](saveUpdates(_0x51f686['body'],null))[_0x4906('0x22')](respondWithResult(_0x57630b,null))[_0x4906('0x41')](handleError(_0x57630b,null));};exports[_0x4906('0x25')]=function(_0x47ad77,_0x28cfd0){return db['CannedAnswer'][_0x4906('0x47')]({'where':{'id':_0x47ad77[_0x4906('0x42')]['id']}})[_0x4906('0x22')](handleEntityNotFound(_0x28cfd0,null))['then'](removeEntity(_0x28cfd0,null))[_0x4906('0x41')](handleError(_0x28cfd0,null));};exports[_0x4906('0x4a')]=function(_0x5012ab,_0x380df6){var _0x99e6c6={'key':_0x5012ab[_0x4906('0x49')]['key']};if(_0x5012ab[_0x4906('0x49')][_0x4906('0x4b')]){_0x99e6c6[_0x4906('0x4b')]=_0x5012ab['body'][_0x4906('0x4b')];}else if(_0x5012ab[_0x4906('0x49')][_0x4906('0x4c')]){_0x99e6c6['SmsAccountId']=_0x5012ab['body'][_0x4906('0x4c')];}else if(_0x5012ab['body'][_0x4906('0x4d')]){_0x99e6c6[_0x4906('0x4d')]=_0x5012ab[_0x4906('0x49')]['OpenchannelAccountId'];}else if(_0x5012ab[_0x4906('0x49')][_0x4906('0x4e')]){_0x99e6c6[_0x4906('0x4e')]=_0x5012ab['body']['ChatWebsiteId'];}return db[_0x4906('0x3c')][_0x4906('0x47')]({'where':_0x99e6c6})[_0x4906('0x22')](function(_0x2db78b){if(_0x2db78b){throw new db['Sequelize']['ValidationError'](_0x4906('0x4f'));}return db[_0x4906('0x3c')]['create'](_0x5012ab[_0x4906('0x49')]);})['then'](function(_0x5469e5){var _0x4b1685=_0x5012ab[_0x4906('0x50')]['get']({'plain':!![]});if(!_0x4b1685)throw new Error(_0x4906('0x51'));if(_0x4b1685['role']===_0x4906('0x50')){var _0x1cca2c=_0x5469e5['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'CannedAnswers','userProfileId':_0x4b1685[_0x4906('0x52')]},'raw':!![]})[_0x4906('0x22')](function(_0x20980a){if(_0x20980a&&_0x20980a[_0x4906('0x53')]===0x0){return db['UserProfileResource'][_0x4906('0x4a')]({'name':_0x1cca2c[_0x4906('0x27')],'resourceId':_0x1cca2c['id'],'type':_0x20980a[_0x4906('0x27')],'sectionId':_0x20980a['id']},{})['then'](function(){return _0x5469e5;});}else{return _0x5469e5;}})[_0x4906('0x41')](function(_0x1a9c64){logger['error'](_0x4906('0x54'),_0x1a9c64);throw _0x1a9c64;});}return _0x5469e5;})[_0x4906('0x22')](respondWithResult(_0x380df6,0xc9))[_0x4906('0x41')](handleError(_0x380df6,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 932192b..e7336be 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 _0xb138=['moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0xb138,0x1dd));var _0x8b13=function(_0x4a30f1,_0x2e75a8){_0x4a30f1=_0x4a30f1-0x0;var _0x1e0a09=_0xb138[_0x4a30f1];return _0x1e0a09;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8b13('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xecb2=['./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3b669d,_0x5f03d8){var _0x139da0=function(_0x231280){while(--_0x231280){_0x3b669d['push'](_0x3b669d['shift']());}};_0x139da0(++_0x5f03d8);}(_0xecb2,0xf6));var _0x2ecb=function(_0x525597,_0x34396f){_0x525597=_0x525597-0x0;var _0x4ea32f=_0xecb2[_0x525597];return _0x4ea32f;};'use strict';var _=require(_0x2ecb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2ecb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2ecb('0x2'));var fs=require('fs');var path=require(_0x2ecb('0x3'));var rimraf=require(_0x2ecb('0x4'));var config=require(_0x2ecb('0x5'));var attributes=require(_0x2ecb('0x6'));module[_0x2ecb('0x7')]=function(_0x4c169f,_0x51b28c){return _0x4c169f['define'](_0x2ecb('0x8'),attributes,{'tableName':_0x2ecb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2ecb('0xa'),'collate':_0x2ecb('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 2e34a65..4137739 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 _0x3510=['client','http','request','then','info','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','CannedAnswer,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4f7811,_0x35e53e){var _0x23111b=function(_0x18cba6){while(--_0x18cba6){_0x4f7811['push'](_0x4f7811['shift']());}};_0x23111b(++_0x35e53e);}(_0x3510,0xa7));var _0x0351=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x3510[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0x0351('0x0'));var util=require(_0x0351('0x1'));var moment=require(_0x0351('0x2'));var BPromise=require(_0x0351('0x3'));var rs=require(_0x0351('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0351('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0351('0x6'))('rpc');var config=require(_0x0351('0x7'));var jayson=require(_0x0351('0x8'));var client=jayson[_0x0351('0x9')][_0x0351('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38611e,_0x2c10c6,_0x350d2f){return new BPromise(function(_0x27322d,_0x26c39f){return client[_0x0351('0xb')](_0x38611e,_0x350d2f)[_0x0351('0xc')](function(_0x28d9cd){logger[_0x0351('0xd')]('CannedAnswer,\x20%s,\x20%s',_0x2c10c6,_0x0351('0xe'));logger[_0x0351('0xf')](_0x0351('0x10'),_0x2c10c6,_0x0351('0xe'),JSON[_0x0351('0x11')](_0x28d9cd));if(_0x28d9cd['error']){if(_0x28d9cd[_0x0351('0x12')]['code']===0x1f4){logger['error'](_0x0351('0x13'),_0x2c10c6,_0x28d9cd[_0x0351('0x12')]['message']);return _0x26c39f(_0x28d9cd[_0x0351('0x12')][_0x0351('0x14')]);}logger[_0x0351('0x12')](_0x0351('0x13'),_0x2c10c6,_0x28d9cd[_0x0351('0x12')]['message']);return _0x27322d(_0x28d9cd[_0x0351('0x12')][_0x0351('0x14')]);}else{logger['info'](_0x0351('0x13'),_0x2c10c6,_0x0351('0xe'));_0x27322d(_0x28d9cd[_0x0351('0x15')][_0x0351('0x14')]);}})['catch'](function(_0x426cd8){logger[_0x0351('0x12')](_0x0351('0x13'),_0x2c10c6,_0x426cd8);_0x26c39f(_0x426cd8);});});} \ No newline at end of file +var _0x62ab=['request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','CannedAnswer,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x62ab,0x12f));var _0xb62a=function(_0x42b260,_0x312da9){_0x42b260=_0x42b260-0x0;var _0x14ddb5=_0x62ab[_0x42b260];return _0x14ddb5;};'use strict';var _=require(_0xb62a('0x0'));var util=require(_0xb62a('0x1'));var moment=require('moment');var BPromise=require(_0xb62a('0x2'));var rs=require(_0xb62a('0x3'));var fs=require('fs');var Redis=require(_0xb62a('0x4'));var db=require(_0xb62a('0x5'))['db'];var utils=require(_0xb62a('0x6'));var logger=require('../../config/logger')(_0xb62a('0x7'));var config=require('../../config/environment');var jayson=require(_0xb62a('0x8'));var client=jayson[_0xb62a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xed15e9,_0x25706c,_0x5363e2){return new BPromise(function(_0x57afa9,_0x56909c){return client['request'](_0xed15e9,_0x5363e2)[_0xb62a('0xa')](function(_0x209f11){logger['info'](_0xb62a('0xb'),_0x25706c,_0xb62a('0xc'));logger['debug'](_0xb62a('0xd'),_0x25706c,'request\x20sent',JSON[_0xb62a('0xe')](_0x209f11));if(_0x209f11[_0xb62a('0xf')]){if(_0x209f11['error'][_0xb62a('0x10')]===0x1f4){logger[_0xb62a('0xf')]('CannedAnswer,\x20%s,\x20%s',_0x25706c,_0x209f11['error'][_0xb62a('0x11')]);return _0x56909c(_0x209f11[_0xb62a('0xf')][_0xb62a('0x11')]);}logger[_0xb62a('0xf')](_0xb62a('0xb'),_0x25706c,_0x209f11[_0xb62a('0xf')][_0xb62a('0x11')]);return _0x57afa9(_0x209f11[_0xb62a('0xf')][_0xb62a('0x11')]);}else{logger[_0xb62a('0x12')](_0xb62a('0xb'),_0x25706c,_0xb62a('0xc'));_0x57afa9(_0x209f11[_0xb62a('0x13')][_0xb62a('0x11')]);}})[_0xb62a('0x14')](function(_0x377779){logger[_0xb62a('0xf')](_0xb62a('0xb'),_0x25706c,_0x377779);_0x56909c(_0x377779);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 0cd9606..f82abd4 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 _0xdd84=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put','update','delete','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xdd84,0xbe));var _0x4dd8=function(_0x1f586a,_0x532dbc){_0x1f586a=_0x1f586a-0x0;var _0x35f2ae=_0xdd84[_0x1f586a];return _0x35f2ae;};'use strict';var multer=require(_0x4dd8('0x0'));var util=require(_0x4dd8('0x1'));var path=require('path');var timeout=require(_0x4dd8('0x2'));var express=require(_0x4dd8('0x3'));var router=express['Router']();var auth=require(_0x4dd8('0x4'));var interaction=require(_0x4dd8('0x5'));var config=require(_0x4dd8('0x6'));var controller=require('./cannedAnswer.controller');router[_0x4dd8('0x7')]('/',auth[_0x4dd8('0x8')](),controller['index']);router[_0x4dd8('0x7')](_0x4dd8('0x9'),auth['isAuthenticated'](),controller[_0x4dd8('0xa')]);router['post']('/',auth[_0x4dd8('0x8')](),controller[_0x4dd8('0xb')]);router[_0x4dd8('0xc')](_0x4dd8('0x9'),auth[_0x4dd8('0x8')](),controller[_0x4dd8('0xd')]);router[_0x4dd8('0xe')]('/:id',auth[_0x4dd8('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x20d6=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','/:id','show','post'];(function(_0x55732c,_0x4da144){var _0x24887a=function(_0x2f9afd){while(--_0x2f9afd){_0x55732c['push'](_0x55732c['shift']());}};_0x24887a(++_0x4da144);}(_0x20d6,0x9d));var _0x620d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x20d6[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var path=require(_0x620d('0x2'));var timeout=require(_0x620d('0x3'));var express=require(_0x620d('0x4'));var router=express['Router']();var auth=require(_0x620d('0x5'));var interaction=require(_0x620d('0x6'));var config=require(_0x620d('0x7'));var controller=require(_0x620d('0x8'));router['get']('/',auth[_0x620d('0x9')](),controller[_0x620d('0xa')]);router['get'](_0x620d('0xb'),auth[_0x620d('0x9')](),controller[_0x620d('0xc')]);router[_0x620d('0xd')]('/',auth[_0x620d('0x9')](),controller[_0x620d('0xe')]);router[_0x620d('0xf')](_0x620d('0xb'),auth[_0x620d('0x9')](),controller[_0x620d('0x10')]);router[_0x620d('0x11')](_0x620d('0xb'),auth['isAuthenticated'](),controller[_0x620d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 5c46b4e..1c8af34 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 _0x0622=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x186f55,_0x41057f){var _0x92b8de=function(_0x194856){while(--_0x194856){_0x186f55['push'](_0x186f55['shift']());}};_0x92b8de(++_0x41057f);}(_0x0622,0x167));var _0x2062=function(_0x2500a0,_0x397225){_0x2500a0=_0x2500a0-0x0;var _0x54a7ca=_0x0622[_0x2500a0];return _0x54a7ca;};'use strict';var Sequelize=require('sequelize');module[_0x2062('0x0')]={'calldate':{'type':Sequelize[_0x2062('0x1')],'allowNull':![],'defaultValue':_0x2062('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x2062('0x3')]},'dst':{'type':Sequelize[_0x2062('0x3')]},'dcontext':{'type':Sequelize[_0x2062('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x2062('0x3')]},'lastapp':{'type':Sequelize[_0x2062('0x3')]},'lastdata':{'type':Sequelize[_0x2062('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2062('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x2062('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2062('0x3')]},'linkedid':{'type':Sequelize[_0x2062('0x3')]},'sequence':{'type':Sequelize[_0x2062('0x3')]},'peeraccount':{'type':Sequelize[_0x2062('0x3')]},'type':{'type':Sequelize[_0x2062('0x3')]},'tag':{'type':Sequelize[_0x2062('0x3')]}}; \ No newline at end of file +var _0xe062=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x20b1f7,_0x1a8f10){var _0x595b92=function(_0xe57ad7){while(--_0xe57ad7){_0x20b1f7['push'](_0x20b1f7['shift']());}};_0x595b92(++_0x1a8f10);}(_0xe062,0x139));var _0x2e06=function(_0x38875b,_0x158938){_0x38875b=_0x38875b-0x0;var _0x157806=_0xe062[_0x38875b];return _0x157806;};'use strict';var Sequelize=require(_0x2e06('0x0'));module[_0x2e06('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x2e06('0x2')},'clid':{'type':Sequelize[_0x2e06('0x3')]},'src':{'type':Sequelize[_0x2e06('0x3')]},'dst':{'type':Sequelize[_0x2e06('0x3')]},'dcontext':{'type':Sequelize[_0x2e06('0x3')]},'channel':{'type':Sequelize[_0x2e06('0x3')]},'dstchannel':{'type':Sequelize[_0x2e06('0x3')]},'lastapp':{'type':Sequelize[_0x2e06('0x3')]},'lastdata':{'type':Sequelize[_0x2e06('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2e06('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2e06('0x3')]},'amaflags':{'type':Sequelize[_0x2e06('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x2e06('0x3')]},'userfield':{'type':Sequelize[_0x2e06('0x3')]},'uniqueid':{'type':Sequelize[_0x2e06('0x3')]},'linkedid':{'type':Sequelize[_0x2e06('0x3')]},'sequence':{'type':Sequelize[_0x2e06('0x3')]},'peeraccount':{'type':Sequelize[_0x2e06('0x3')]},'type':{'type':Sequelize[_0x2e06('0x3')]},'tag':{'type':Sequelize[_0x2e06('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 9ec43d8..e401798 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 _0x0b6e=['map','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','Cdr','include','catch','show','params','rawAttributes','includeAll','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','stack','name','index'];(function(_0x13d017,_0x13c192){var _0x432db4=function(_0x30ded7){while(--_0x30ded7){_0x13d017['push'](_0x13d017['shift']());}};_0x432db4(++_0x13c192);}(_0x0b6e,0xaf));var _0xe0b6=function(_0x147cba,_0x368976){_0x147cba=_0x147cba-0x0;var _0x5ba48f=_0x0b6e[_0x147cba];return _0x5ba48f;};'use strict';var pdf=require(_0xe0b6('0x0'));var emlformat=require(_0xe0b6('0x1'));var rimraf=require(_0xe0b6('0x2'));var zipdir=require(_0xe0b6('0x3'));var jsonpatch=require(_0xe0b6('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe0b6('0x5'));var Mustache=require(_0xe0b6('0x6'));var util=require(_0xe0b6('0x7'));var path=require(_0xe0b6('0x8'));var sox=require(_0xe0b6('0x9'));var csv=require('to-csv');var ejs=require(_0xe0b6('0xa'));var fs=require('fs');var _=require(_0xe0b6('0xb'));var squel=require(_0xe0b6('0xc'));var crypto=require(_0xe0b6('0xd'));var jsforce=require(_0xe0b6('0xe'));var deskjs=require(_0xe0b6('0xf'));var toCsv=require(_0xe0b6('0x10'));var querystring=require(_0xe0b6('0x11'));var Papa=require(_0xe0b6('0x12'));var Redis=require('ioredis');var authService=require(_0xe0b6('0x13'));var qs=require(_0xe0b6('0x14'));var as=require(_0xe0b6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0b6('0x16'))(_0xe0b6('0x17'));var utils=require(_0xe0b6('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12de1b,_0x2a0524){_0x2a0524=_0x2a0524||0xcc;return function(_0x47709a){if(_0x47709a){return _0x12de1b[_0xe0b6('0x19')](_0x2a0524);}return _0x12de1b[_0xe0b6('0x1a')](_0x2a0524)[_0xe0b6('0x1b')]();};}function respondWithResult(_0x1d1c51,_0x47f25e){_0x47f25e=_0x47f25e||0xc8;return function(_0x2ef337){if(_0x2ef337){return _0x1d1c51['status'](_0x47f25e)[_0xe0b6('0x1c')](_0x2ef337);}};}function respondWithFilteredResult(_0x3bf6e1,_0x11e185){return function(_0x1a6668){if(_0x1a6668){var _0x325d88=_0x1a6668[_0xe0b6('0x1d')],_0x457634=_0x11e185[_0xe0b6('0x1e')],_0x5e5f69=_0x11e185[_0xe0b6('0x1e')]+_0x11e185[_0xe0b6('0x1f')],_0x4da9e9;if(_0x5e5f69>=_0x325d88){_0x5e5f69=_0x325d88;_0x4da9e9=0xc8;}else{_0x4da9e9=0xce;}_0x3bf6e1['status'](_0x4da9e9);return _0x3bf6e1['set']('Content-Range',_0x457634+'-'+_0x5e5f69+'/'+_0x325d88)[_0xe0b6('0x1c')](_0x1a6668);}return null;};}function patchUpdates(_0x3d1cb9){return function(_0x4dae0f){try{jsonpatch[_0xe0b6('0x20')](_0x4dae0f,_0x3d1cb9,!![]);}catch(_0x301280){return BPromise[_0xe0b6('0x21')](_0x301280);}return _0x4dae0f[_0xe0b6('0x22')]();};}function saveUpdates(_0x30ca07,_0x123126){return function(_0x460896){if(_0x460896){return _0x460896[_0xe0b6('0x23')](_0x30ca07)[_0xe0b6('0x24')](function(_0x11d875){return _0x11d875;});}return null;};}function removeEntity(_0xbcdc0c,_0x5c0424){return function(_0x35e961){if(_0x35e961){return _0x35e961[_0xe0b6('0x25')]()['then'](function(){_0xbcdc0c[_0xe0b6('0x1a')](0xcc)[_0xe0b6('0x1b')]();});}};}function handleEntityNotFound(_0x46421d,_0x5b049c){return function(_0x974368){if(!_0x974368){_0x46421d['sendStatus'](0x194);}return _0x974368;};}function handleError(_0x53356d,_0x26db33){_0x26db33=_0x26db33||0x1f4;return function(_0x1d3241){logger['error'](_0x1d3241[_0xe0b6('0x26')]);if(_0x1d3241[_0xe0b6('0x27')]){delete _0x1d3241[_0xe0b6('0x27')];}_0x53356d['status'](_0x26db33)['send'](_0x1d3241);};}exports[_0xe0b6('0x28')]=function(_0xd13c15,_0x242367){var _0x2cc123={},_0x27efa2={},_0x2887d7={'count':0x0,'rows':[]};var _0x1e9810=_[_0xe0b6('0x29')](db['Cdr']['rawAttributes'],function(_0x2fb72f){return{'name':_0x2fb72f[_0xe0b6('0x2a')],'type':_0x2fb72f[_0xe0b6('0x2b')][_0xe0b6('0x2c')]};});_0x27efa2[_0xe0b6('0x2d')]=_[_0xe0b6('0x29')](_0x1e9810,_0xe0b6('0x27'));_0x27efa2['query']=_[_0xe0b6('0x2e')](_0xd13c15[_0xe0b6('0x2f')]);_0x27efa2['filters']=_[_0xe0b6('0x30')](_0x27efa2['model'],_0x27efa2[_0xe0b6('0x2f')]);_0x2cc123[_0xe0b6('0x31')]=_['intersection'](_0x27efa2['model'],qs[_0xe0b6('0x32')](_0xd13c15[_0xe0b6('0x2f')][_0xe0b6('0x32')]));_0x2cc123['attributes']=_0x2cc123[_0xe0b6('0x31')][_0xe0b6('0x33')]?_0x2cc123['attributes']:_0x27efa2['model'];if(!_0xd13c15[_0xe0b6('0x2f')][_0xe0b6('0x34')]('nolimit')){_0x2cc123[_0xe0b6('0x1f')]=qs['limit'](_0xd13c15[_0xe0b6('0x2f')][_0xe0b6('0x1f')]);_0x2cc123[_0xe0b6('0x1e')]=qs[_0xe0b6('0x1e')](_0xd13c15[_0xe0b6('0x2f')][_0xe0b6('0x1e')]);}_0x2cc123['order']=qs[_0xe0b6('0x35')](_0xd13c15['query'][_0xe0b6('0x35')]);_0x2cc123[_0xe0b6('0x36')]=qs[_0xe0b6('0x37')](_[_0xe0b6('0x38')](_0xd13c15[_0xe0b6('0x2f')],_0x27efa2['filters']),_0x1e9810);if(_0xd13c15[_0xe0b6('0x2f')][_0xe0b6('0x39')]){_0x2cc123[_0xe0b6('0x36')]=_[_0xe0b6('0x3a')](_0x2cc123[_0xe0b6('0x36')],{'$or':_['map'](_0x1e9810,function(_0x5508a2){if(_0x5508a2['type']!==_0xe0b6('0x3b')){var _0x2aa148={};_0x2aa148[_0x5508a2['name']]={'$like':'%'+_0xd13c15['query'][_0xe0b6('0x39')]+'%'};return _0x2aa148;}})});}_0x2cc123=_[_0xe0b6('0x3a')]({},_0x2cc123,_0xd13c15['options']);var _0x11236e={'where':_0x2cc123[_0xe0b6('0x36')]};return db[_0xe0b6('0x3c')][_0xe0b6('0x1d')](_0x11236e)[_0xe0b6('0x24')](function(_0x5d35b8){_0x2887d7[_0xe0b6('0x1d')]=_0x5d35b8;if(_0xd13c15['query']['includeAll']){_0x2cc123[_0xe0b6('0x3d')]=[{'all':!![]}];}return db[_0xe0b6('0x3c')]['findAll'](_0x2cc123);})[_0xe0b6('0x24')](function(_0x3617c9){_0x2887d7['rows']=_0x3617c9;return _0x2887d7;})[_0xe0b6('0x24')](respondWithFilteredResult(_0x242367,_0x2cc123))[_0xe0b6('0x3e')](handleError(_0x242367,null));};exports[_0xe0b6('0x3f')]=function(_0x2cd191,_0xd68677){var _0x1d13cd={'raw':!![],'where':{'id':_0x2cd191[_0xe0b6('0x40')]['id']}},_0x3ed95d={};_0x3ed95d[_0xe0b6('0x2d')]=_[_0xe0b6('0x2e')](db[_0xe0b6('0x3c')][_0xe0b6('0x41')]);_0x3ed95d['query']=_['keys'](_0x2cd191[_0xe0b6('0x2f')]);_0x3ed95d[_0xe0b6('0x37')]=_[_0xe0b6('0x30')](_0x3ed95d[_0xe0b6('0x2d')],_0x3ed95d[_0xe0b6('0x2f')]);_0x1d13cd['attributes']=_[_0xe0b6('0x30')](_0x3ed95d[_0xe0b6('0x2d')],qs[_0xe0b6('0x32')](_0x2cd191['query'][_0xe0b6('0x32')]));_0x1d13cd[_0xe0b6('0x31')]=_0x1d13cd[_0xe0b6('0x31')]['length']?_0x1d13cd[_0xe0b6('0x31')]:_0x3ed95d[_0xe0b6('0x2d')];if(_0x2cd191[_0xe0b6('0x2f')][_0xe0b6('0x42')]){_0x1d13cd[_0xe0b6('0x3d')]=[{'all':!![]}];}_0x1d13cd=_[_0xe0b6('0x3a')]({},_0x1d13cd,_0x2cd191[_0xe0b6('0x43')]);return db['Cdr'][_0xe0b6('0x44')](_0x1d13cd)['then'](handleEntityNotFound(_0xd68677,null))['then'](respondWithResult(_0xd68677,null))[_0xe0b6('0x3e')](handleError(_0xd68677,null));};exports[_0xe0b6('0x45')]=function(_0x324faf,_0x3560eb){return db[_0xe0b6('0x3c')][_0xe0b6('0x45')](_0x324faf[_0xe0b6('0x46')],{})[_0xe0b6('0x24')](respondWithResult(_0x3560eb,0xc9))[_0xe0b6('0x3e')](handleError(_0x3560eb,null));};exports[_0xe0b6('0x23')]=function(_0x17dfd0,_0xf5bd3c){if(_0x17dfd0[_0xe0b6('0x46')]['id']){delete _0x17dfd0[_0xe0b6('0x46')]['id'];}return db[_0xe0b6('0x3c')][_0xe0b6('0x44')]({'where':{'id':_0x17dfd0[_0xe0b6('0x40')]['id']}})['then'](handleEntityNotFound(_0xf5bd3c,null))[_0xe0b6('0x24')](saveUpdates(_0x17dfd0['body'],null))[_0xe0b6('0x24')](respondWithResult(_0xf5bd3c,null))[_0xe0b6('0x3e')](handleError(_0xf5bd3c,null));};exports['destroy']=function(_0x2a49e8,_0x2f3b56){return db[_0xe0b6('0x3c')][_0xe0b6('0x44')]({'where':{'id':_0x2a49e8[_0xe0b6('0x40')]['id']}})[_0xe0b6('0x24')](handleEntityNotFound(_0x2f3b56,null))[_0xe0b6('0x24')](removeEntity(_0x2f3b56,null))[_0xe0b6('0x3e')](handleError(_0x2f3b56,null));};exports[_0xe0b6('0x47')]=function(_0x31c0d1,_0xd73323){return db[_0xe0b6('0x3c')][_0xe0b6('0x47')]()['then'](respondWithResult(_0xd73323,null))[_0xe0b6('0x3e')](handleError(_0xd73323,null));}; \ No newline at end of file +var _0x3a60=['ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','Cdr','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x2c7780,_0x100f4a){var _0x580bc8=function(_0x3d435c){while(--_0x3d435c){_0x2c7780['push'](_0x2c7780['shift']());}};_0x580bc8(++_0x100f4a);}(_0x3a60,0x87));var _0x03a6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3a60[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x03a6('0x0'));var emlformat=require(_0x03a6('0x1'));var rimraf=require(_0x03a6('0x2'));var zipdir=require(_0x03a6('0x3'));var jsonpatch=require(_0x03a6('0x4'));var rp=require(_0x03a6('0x5'));var moment=require(_0x03a6('0x6'));var BPromise=require(_0x03a6('0x7'));var Mustache=require(_0x03a6('0x8'));var util=require(_0x03a6('0x9'));var path=require(_0x03a6('0xa'));var sox=require(_0x03a6('0xb'));var csv=require(_0x03a6('0xc'));var ejs=require(_0x03a6('0xd'));var fs=require('fs');var _=require(_0x03a6('0xe'));var squel=require(_0x03a6('0xf'));var crypto=require(_0x03a6('0x10'));var jsforce=require(_0x03a6('0x11'));var deskjs=require(_0x03a6('0x12'));var toCsv=require(_0x03a6('0xc'));var querystring=require(_0x03a6('0x13'));var Papa=require(_0x03a6('0x14'));var Redis=require(_0x03a6('0x15'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x03a6('0x16'));var hardwareService=require(_0x03a6('0x17'));var logger=require(_0x03a6('0x18'))(_0x03a6('0x19'));var utils=require(_0x03a6('0x1a'));var config=require(_0x03a6('0x1b'));var db=require(_0x03a6('0x1c'))['db'];function respondWithStatusCode(_0x21199b,_0x160c7c){_0x160c7c=_0x160c7c||0xcc;return function(_0x53f011){if(_0x53f011){return _0x21199b[_0x03a6('0x1d')](_0x160c7c);}return _0x21199b[_0x03a6('0x1e')](_0x160c7c)[_0x03a6('0x1f')]();};}function respondWithResult(_0x1cf5af,_0x5a0856){_0x5a0856=_0x5a0856||0xc8;return function(_0x2e5a9f){if(_0x2e5a9f){return _0x1cf5af['status'](_0x5a0856)[_0x03a6('0x20')](_0x2e5a9f);}};}function respondWithFilteredResult(_0x2aaa4f,_0x1718f8){return function(_0x2da35a){if(_0x2da35a){var _0x50c8e5=_0x2da35a[_0x03a6('0x21')],_0x1f4c79=_0x1718f8[_0x03a6('0x22')],_0x4e91e4=_0x1718f8[_0x03a6('0x22')]+_0x1718f8[_0x03a6('0x23')],_0x189b7e;if(_0x4e91e4>=_0x50c8e5){_0x4e91e4=_0x50c8e5;_0x189b7e=0xc8;}else{_0x189b7e=0xce;}_0x2aaa4f[_0x03a6('0x1e')](_0x189b7e);return _0x2aaa4f[_0x03a6('0x24')]('Content-Range',_0x1f4c79+'-'+_0x4e91e4+'/'+_0x50c8e5)[_0x03a6('0x20')](_0x2da35a);}return null;};}function patchUpdates(_0x43ad46){return function(_0x3da49f){try{jsonpatch[_0x03a6('0x25')](_0x3da49f,_0x43ad46,!![]);}catch(_0x130d84){return BPromise[_0x03a6('0x26')](_0x130d84);}return _0x3da49f[_0x03a6('0x27')]();};}function saveUpdates(_0x5ad58c,_0x35165a){return function(_0x2ac582){if(_0x2ac582){return _0x2ac582[_0x03a6('0x28')](_0x5ad58c)[_0x03a6('0x29')](function(_0x17afc0){return _0x17afc0;});}return null;};}function removeEntity(_0x1ea412,_0x20cec7){return function(_0xff236d){if(_0xff236d){return _0xff236d[_0x03a6('0x2a')]()['then'](function(){_0x1ea412[_0x03a6('0x1e')](0xcc)[_0x03a6('0x1f')]();});}};}function handleEntityNotFound(_0x4a09ba,_0xf8c0c8){return function(_0x39a342){if(!_0x39a342){_0x4a09ba[_0x03a6('0x1d')](0x194);}return _0x39a342;};}function handleError(_0x292c5a,_0x3c0348){_0x3c0348=_0x3c0348||0x1f4;return function(_0x525b1c){logger[_0x03a6('0x2b')](_0x525b1c[_0x03a6('0x2c')]);if(_0x525b1c[_0x03a6('0x2d')]){delete _0x525b1c[_0x03a6('0x2d')];}_0x292c5a[_0x03a6('0x1e')](_0x3c0348)[_0x03a6('0x2e')](_0x525b1c);};}exports['index']=function(_0x20795b,_0x536ed0){var _0x5ee442={},_0x2d7459={},_0x2beb04={'count':0x0,'rows':[]};var _0x36870e=_['map'](db[_0x03a6('0x2f')][_0x03a6('0x30')],function(_0x4f5e50){return{'name':_0x4f5e50[_0x03a6('0x31')],'type':_0x4f5e50[_0x03a6('0x32')]['key']};});_0x2d7459[_0x03a6('0x33')]=_[_0x03a6('0x34')](_0x36870e,_0x03a6('0x2d'));_0x2d7459[_0x03a6('0x35')]=_[_0x03a6('0x36')](_0x20795b[_0x03a6('0x35')]);_0x2d7459[_0x03a6('0x37')]=_[_0x03a6('0x38')](_0x2d7459[_0x03a6('0x33')],_0x2d7459['query']);_0x5ee442[_0x03a6('0x39')]=_['intersection'](_0x2d7459[_0x03a6('0x33')],qs[_0x03a6('0x3a')](_0x20795b[_0x03a6('0x35')][_0x03a6('0x3a')]));_0x5ee442[_0x03a6('0x39')]=_0x5ee442[_0x03a6('0x39')][_0x03a6('0x3b')]?_0x5ee442[_0x03a6('0x39')]:_0x2d7459[_0x03a6('0x33')];if(!_0x20795b['query'][_0x03a6('0x3c')](_0x03a6('0x3d'))){_0x5ee442['limit']=qs['limit'](_0x20795b[_0x03a6('0x35')][_0x03a6('0x23')]);_0x5ee442[_0x03a6('0x22')]=qs[_0x03a6('0x22')](_0x20795b[_0x03a6('0x35')][_0x03a6('0x22')]);}_0x5ee442[_0x03a6('0x3e')]=qs[_0x03a6('0x3f')](_0x20795b[_0x03a6('0x35')][_0x03a6('0x3f')]);_0x5ee442[_0x03a6('0x40')]=qs[_0x03a6('0x37')](_[_0x03a6('0x41')](_0x20795b['query'],_0x2d7459[_0x03a6('0x37')]),_0x36870e);if(_0x20795b[_0x03a6('0x35')][_0x03a6('0x42')]){_0x5ee442[_0x03a6('0x40')]=_['merge'](_0x5ee442[_0x03a6('0x40')],{'$or':_[_0x03a6('0x34')](_0x36870e,function(_0x4736db){if(_0x4736db[_0x03a6('0x32')]!=='VIRTUAL'){var _0x577c42={};_0x577c42[_0x4736db[_0x03a6('0x2d')]]={'$like':'%'+_0x20795b[_0x03a6('0x35')][_0x03a6('0x42')]+'%'};return _0x577c42;}})});}_0x5ee442=_['merge']({},_0x5ee442,_0x20795b['options']);var _0x42b1bc={'where':_0x5ee442[_0x03a6('0x40')]};return db['Cdr'][_0x03a6('0x21')](_0x42b1bc)['then'](function(_0x2855fb){_0x2beb04[_0x03a6('0x21')]=_0x2855fb;if(_0x20795b['query'][_0x03a6('0x43')]){_0x5ee442[_0x03a6('0x44')]=[{'all':!![]}];}return db[_0x03a6('0x2f')][_0x03a6('0x45')](_0x5ee442);})['then'](function(_0x1b195b){_0x2beb04[_0x03a6('0x46')]=_0x1b195b;return _0x2beb04;})[_0x03a6('0x29')](respondWithFilteredResult(_0x536ed0,_0x5ee442))[_0x03a6('0x47')](handleError(_0x536ed0,null));};exports[_0x03a6('0x48')]=function(_0x174310,_0x4c4680){var _0x224326={'raw':!![],'where':{'id':_0x174310['params']['id']}},_0x43e2d5={};_0x43e2d5[_0x03a6('0x33')]=_[_0x03a6('0x36')](db['Cdr'][_0x03a6('0x30')]);_0x43e2d5[_0x03a6('0x35')]=_[_0x03a6('0x36')](_0x174310['query']);_0x43e2d5[_0x03a6('0x37')]=_['intersection'](_0x43e2d5[_0x03a6('0x33')],_0x43e2d5['query']);_0x224326[_0x03a6('0x39')]=_[_0x03a6('0x38')](_0x43e2d5[_0x03a6('0x33')],qs[_0x03a6('0x3a')](_0x174310[_0x03a6('0x35')][_0x03a6('0x3a')]));_0x224326[_0x03a6('0x39')]=_0x224326[_0x03a6('0x39')][_0x03a6('0x3b')]?_0x224326['attributes']:_0x43e2d5['model'];if(_0x174310[_0x03a6('0x35')][_0x03a6('0x43')]){_0x224326[_0x03a6('0x44')]=[{'all':!![]}];}_0x224326=_['merge']({},_0x224326,_0x174310[_0x03a6('0x49')]);return db[_0x03a6('0x2f')][_0x03a6('0x4a')](_0x224326)[_0x03a6('0x29')](handleEntityNotFound(_0x4c4680,null))['then'](respondWithResult(_0x4c4680,null))[_0x03a6('0x47')](handleError(_0x4c4680,null));};exports[_0x03a6('0x4b')]=function(_0x4f961a,_0x21b754){return db[_0x03a6('0x2f')]['create'](_0x4f961a[_0x03a6('0x4c')],{})[_0x03a6('0x29')](respondWithResult(_0x21b754,0xc9))[_0x03a6('0x47')](handleError(_0x21b754,null));};exports[_0x03a6('0x28')]=function(_0x311d0d,_0x8e0a16){if(_0x311d0d[_0x03a6('0x4c')]['id']){delete _0x311d0d[_0x03a6('0x4c')]['id'];}return db[_0x03a6('0x2f')][_0x03a6('0x4a')]({'where':{'id':_0x311d0d['params']['id']}})[_0x03a6('0x29')](handleEntityNotFound(_0x8e0a16,null))[_0x03a6('0x29')](saveUpdates(_0x311d0d[_0x03a6('0x4c')],null))['then'](respondWithResult(_0x8e0a16,null))['catch'](handleError(_0x8e0a16,null));};exports['destroy']=function(_0x5a082d,_0x4fa115){return db[_0x03a6('0x2f')][_0x03a6('0x4a')]({'where':{'id':_0x5a082d[_0x03a6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4fa115,null))[_0x03a6('0x29')](removeEntity(_0x4fa115,null))['catch'](handleError(_0x4fa115,null));};exports['describe']=function(_0x157642,_0x22bf32){return db['Cdr']['describe']()['then'](respondWithResult(_0x22bf32,null))[_0x03a6('0x47')](handleError(_0x22bf32,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 60ae5c0..62c15df 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 _0x3c71=['request-promise','path','rimraf','exports','define','cdr','accountcode','calldate','disposition','dst','src','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0xef3e4,_0x3a8560){var _0x2f4214=function(_0xfc62b3){while(--_0xfc62b3){_0xef3e4['push'](_0xef3e4['shift']());}};_0x2f4214(++_0x3a8560);}(_0x3c71,0xa5));var _0x13c7=function(_0x36d25b,_0x8a09c8){_0x36d25b=_0x36d25b-0x0;var _0x314a58=_0x3c71[_0x36d25b];return _0x314a58;};'use strict';var _=require('lodash');var util=require(_0x13c7('0x0'));var logger=require(_0x13c7('0x1'))(_0x13c7('0x2'));var moment=require(_0x13c7('0x3'));var BPromise=require(_0x13c7('0x4'));var rp=require(_0x13c7('0x5'));var fs=require('fs');var path=require(_0x13c7('0x6'));var rimraf=require(_0x13c7('0x7'));var config=require('../../config/environment');var attributes=require('./cdr.attributes');module[_0x13c7('0x8')]=function(_0x1f77c3,_0x5da601){return _0x1f77c3[_0x13c7('0x9')]('Cdr',attributes,{'tableName':_0x13c7('0xa'),'paranoid':![],'indexes':[{'name':_0x13c7('0xb'),'fields':[_0x13c7('0xb')]},{'name':'calldate','fields':[_0x13c7('0xc')]},{'name':'disposition','fields':[_0x13c7('0xd')]},{'name':_0x13c7('0xe'),'fields':['dst']},{'name':_0x13c7('0xf'),'fields':[_0x13c7('0xf')]},{'name':_0x13c7('0x10'),'fields':[_0x13c7('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0xed9d=['request-promise','path','rimraf','../../config/environment','exports','Cdr','cdr','calldate','disposition','src','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x43a251,_0x2ca1b8){var _0x15f782=function(_0x8b1d41){while(--_0x8b1d41){_0x43a251['push'](_0x43a251['shift']());}};_0x15f782(++_0x2ca1b8);}(_0xed9d,0xab));var _0xded9=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xed9d[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0xded9('0x0'));var util=require(_0xded9('0x1'));var logger=require(_0xded9('0x2'))(_0xded9('0x3'));var moment=require('moment');var BPromise=require(_0xded9('0x4'));var rp=require(_0xded9('0x5'));var fs=require('fs');var path=require(_0xded9('0x6'));var rimraf=require(_0xded9('0x7'));var config=require(_0xded9('0x8'));var attributes=require('./cdr.attributes');module[_0xded9('0x9')]=function(_0x20417c,_0x2ea589){return _0x20417c['define'](_0xded9('0xa'),attributes,{'tableName':_0xded9('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':['accountcode']},{'name':_0xded9('0xc'),'fields':[_0xded9('0xc')]},{'name':_0xded9('0xd'),'fields':[_0xded9('0xd')]},{'name':'dst','fields':['dst']},{'name':'src','fields':[_0xded9('0xe')]},{'name':'uniqueid','fields':[_0xded9('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 47150fb..3874cc6 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 _0x200f=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1e79c6,_0x2ddf98){var _0x38e46a=function(_0x374807){while(--_0x374807){_0x1e79c6['push'](_0x1e79c6['shift']());}};_0x38e46a(++_0x2ddf98);}(_0x200f,0x8d));var _0xf200=function(_0x2110bb,_0x5bf49e){_0x2110bb=_0x2110bb-0x0;var _0x5cf87c=_0x200f[_0x2110bb];return _0x5cf87c;};'use strict';var _=require(_0xf200('0x0'));var util=require(_0xf200('0x1'));var moment=require(_0xf200('0x2'));var BPromise=require(_0xf200('0x3'));var rs=require(_0xf200('0x4'));var fs=require('fs');var Redis=require(_0xf200('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf200('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf200('0x7'));var jayson=require(_0xf200('0x8'));var client=jayson[_0xf200('0x9')][_0xf200('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfbd9dd,_0x47b45c,_0x8e9d60){return new BPromise(function(_0x2fa985,_0x36bf4d){return client[_0xf200('0xb')](_0xfbd9dd,_0x8e9d60)[_0xf200('0xc')](function(_0x4818db){logger['info'](_0xf200('0xd'),_0x47b45c,_0xf200('0xe'));logger['debug'](_0xf200('0xf'),_0x47b45c,'request\x20sent',JSON[_0xf200('0x10')](_0x4818db));if(_0x4818db['error']){if(_0x4818db[_0xf200('0x11')][_0xf200('0x12')]===0x1f4){logger[_0xf200('0x11')](_0xf200('0xd'),_0x47b45c,_0x4818db['error']['message']);return _0x36bf4d(_0x4818db[_0xf200('0x11')][_0xf200('0x13')]);}logger[_0xf200('0x11')]('Cdr,\x20%s,\x20%s',_0x47b45c,_0x4818db[_0xf200('0x11')][_0xf200('0x13')]);return _0x2fa985(_0x4818db[_0xf200('0x11')][_0xf200('0x13')]);}else{logger[_0xf200('0x14')](_0xf200('0xd'),_0x47b45c,_0xf200('0xe'));_0x2fa985(_0x4818db[_0xf200('0x15')][_0xf200('0x13')]);}})[_0xf200('0x16')](function(_0x39d8be){logger[_0xf200('0x11')](_0xf200('0xd'),_0x47b45c,_0x39d8be);_0x36bf4d(_0x39d8be);});});} \ No newline at end of file +var _0x8cc9=['Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x2ee7e1,_0xcf2156){var _0x3e6dc7=function(_0x795f53){while(--_0x795f53){_0x2ee7e1['push'](_0x2ee7e1['shift']());}};_0x3e6dc7(++_0xcf2156);}(_0x8cc9,0x188));var _0x98cc=function(_0x42cc5f,_0x4806cd){_0x42cc5f=_0x42cc5f-0x0;var _0x152bb6=_0x8cc9[_0x42cc5f];return _0x152bb6;};'use strict';var _=require(_0x98cc('0x0'));var util=require(_0x98cc('0x1'));var moment=require(_0x98cc('0x2'));var BPromise=require(_0x98cc('0x3'));var rs=require(_0x98cc('0x4'));var fs=require('fs');var Redis=require(_0x98cc('0x5'));var db=require(_0x98cc('0x6'))['db'];var utils=require(_0x98cc('0x7'));var logger=require(_0x98cc('0x8'))(_0x98cc('0x9'));var config=require(_0x98cc('0xa'));var jayson=require(_0x98cc('0xb'));var client=jayson[_0x98cc('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22c53d,_0xfc463d,_0x5e4f0f){return new BPromise(function(_0x359d9f,_0x191715){return client[_0x98cc('0xd')](_0x22c53d,_0x5e4f0f)[_0x98cc('0xe')](function(_0x24a5bc){logger[_0x98cc('0xf')](_0x98cc('0x10'),_0xfc463d,'request\x20sent');logger[_0x98cc('0x11')](_0x98cc('0x12'),_0xfc463d,_0x98cc('0x13'),JSON['stringify'](_0x24a5bc));if(_0x24a5bc['error']){if(_0x24a5bc[_0x98cc('0x14')]['code']===0x1f4){logger[_0x98cc('0x14')](_0x98cc('0x10'),_0xfc463d,_0x24a5bc[_0x98cc('0x14')][_0x98cc('0x15')]);return _0x191715(_0x24a5bc[_0x98cc('0x14')]['message']);}logger[_0x98cc('0x14')](_0x98cc('0x10'),_0xfc463d,_0x24a5bc['error']['message']);return _0x359d9f(_0x24a5bc[_0x98cc('0x14')][_0x98cc('0x15')]);}else{logger['info'](_0x98cc('0x10'),_0xfc463d,_0x98cc('0x13'));_0x359d9f(_0x24a5bc[_0x98cc('0x16')][_0x98cc('0x15')]);}})[_0x98cc('0x17')](function(_0x4a216e){logger[_0x98cc('0x14')](_0x98cc('0x10'),_0xfc463d,_0x4a216e);_0x191715(_0x4a216e);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 22d5c5e..f74f2dc 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 _0xa0b3=['index','/describe','describe','/:id','show','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated'];(function(_0x373e5e,_0x47c709){var _0x58d2c2=function(_0x23b0fc){while(--_0x23b0fc){_0x373e5e['push'](_0x373e5e['shift']());}};_0x58d2c2(++_0x47c709);}(_0xa0b3,0x1a6));var _0x3a0b=function(_0x3818a1,_0x31bc14){_0x3818a1=_0x3818a1-0x0;var _0x465793=_0xa0b3[_0x3818a1];return _0x465793;};'use strict';var multer=require(_0x3a0b('0x0'));var util=require(_0x3a0b('0x1'));var path=require('path');var timeout=require(_0x3a0b('0x2'));var express=require(_0x3a0b('0x3'));var router=express['Router']();var auth=require(_0x3a0b('0x4'));var interaction=require(_0x3a0b('0x5'));var config=require(_0x3a0b('0x6'));var controller=require(_0x3a0b('0x7'));router[_0x3a0b('0x8')]('/',auth[_0x3a0b('0x9')](),controller[_0x3a0b('0xa')]);router[_0x3a0b('0x8')](_0x3a0b('0xb'),auth[_0x3a0b('0x9')](),controller[_0x3a0b('0xc')]);router['get'](_0x3a0b('0xd'),auth[_0x3a0b('0x9')](),controller[_0x3a0b('0xe')]);router['post']('/',auth[_0x3a0b('0x9')](),controller['create']);router['put'](_0x3a0b('0xd'),auth['isAuthenticated'](),controller[_0x3a0b('0xf')]);router[_0x3a0b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3a0b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8994=['show','create','put','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cdr.controller','get','/describe','/:id','isAuthenticated'];(function(_0x48b8ad,_0xe28403){var _0x4d1bae=function(_0x5d13b2){while(--_0x5d13b2){_0x48b8ad['push'](_0x48b8ad['shift']());}};_0x4d1bae(++_0xe28403);}(_0x8994,0xd1));var _0x4899=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8994[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0x4899('0x0'));var util=require(_0x4899('0x1'));var path=require('path');var timeout=require(_0x4899('0x2'));var express=require(_0x4899('0x3'));var router=express[_0x4899('0x4')]();var auth=require(_0x4899('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4899('0x6'));var controller=require(_0x4899('0x7'));router[_0x4899('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4899('0x8')](_0x4899('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4899('0xa'),auth[_0x4899('0xb')](),controller[_0x4899('0xc')]);router['post']('/',auth[_0x4899('0xb')](),controller[_0x4899('0xd')]);router[_0x4899('0xe')](_0x4899('0xa'),auth[_0x4899('0xb')](),controller['update']);router[_0x4899('0xf')](_0x4899('0xa'),auth[_0x4899('0xb')](),controller[_0x4899('0x10')]);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 66651db..8c3f495 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 _0x7a18=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x7a18,0x15c));var _0x87a1=function(_0x3e21f4,_0x43d310){_0x3e21f4=_0x3e21f4-0x0;var _0x40fc49=_0x7a18[_0x3e21f4];return _0x40fc49;};'use strict';var Sequelize=require('sequelize');module[_0x87a1('0x0')]={'priority':{'type':Sequelize[_0x87a1('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x87a1('0x2')],'allowNull':![],'defaultValue':_0x87a1('0x3')},'appdata':{'type':Sequelize[_0x87a1('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x87a1('0x2')],'defaultValue':_0x87a1('0x5')}}; \ No newline at end of file +var _0x0b77=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x388eb7,_0x2f1bcb){var _0x17f762=function(_0x7a187c){while(--_0x7a187c){_0x388eb7['push'](_0x388eb7['shift']());}};_0x17f762(++_0x2f1bcb);}(_0x0b77,0x1c3));var _0x70b7=function(_0x2f8530,_0x5cbd67){_0x2f8530=_0x2f8530-0x0;var _0x5e814e=_0x0b77[_0x2f8530];return _0x5e814e;};'use strict';var Sequelize=require(_0x70b7('0x0'));module[_0x70b7('0x1')]={'priority':{'type':Sequelize[_0x70b7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x70b7('0x3')],'allowNull':![],'defaultValue':_0x70b7('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x70b7('0x3')]},'interval':{'type':Sequelize[_0x70b7('0x3')],'defaultValue':_0x70b7('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 421408b..7b79b9a 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 _0x042e=['reject','update','then','sendStatus','error','stack','send','params','model','keys','ChatApplication','query','intersection','attributes','fields','length','includeAll','include','find','catch','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','limit','Content-Range'];(function(_0x57014b,_0x360c0f){var _0x2b258a=function(_0x52c4a3){while(--_0x52c4a3){_0x57014b['push'](_0x57014b['shift']());}};_0x2b258a(++_0x360c0f);}(_0x042e,0x182));var _0xe042=function(_0x197a2,_0x34df3d){_0x197a2=_0x197a2-0x0;var _0x3f0d10=_0x042e[_0x197a2];return _0x3f0d10;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe042('0x0'));var rimraf=require(_0xe042('0x1'));var zipdir=require(_0xe042('0x2'));var jsonpatch=require(_0xe042('0x3'));var rp=require(_0xe042('0x4'));var moment=require('moment');var BPromise=require(_0xe042('0x5'));var Mustache=require(_0xe042('0x6'));var util=require(_0xe042('0x7'));var path=require(_0xe042('0x8'));var sox=require('sox');var csv=require(_0xe042('0x9'));var ejs=require(_0xe042('0xa'));var fs=require('fs');var _=require(_0xe042('0xb'));var squel=require(_0xe042('0xc'));var crypto=require('crypto');var jsforce=require(_0xe042('0xd'));var deskjs=require(_0xe042('0xe'));var toCsv=require(_0xe042('0x9'));var querystring=require(_0xe042('0xf'));var Papa=require(_0xe042('0x10'));var Redis=require(_0xe042('0x11'));var authService=require(_0xe042('0x12'));var qs=require(_0xe042('0x13'));var as=require(_0xe042('0x14'));var hardwareService=require(_0xe042('0x15'));var logger=require(_0xe042('0x16'))(_0xe042('0x17'));var utils=require(_0xe042('0x18'));var config=require('../../config/environment');var db=require(_0xe042('0x19'))['db'];function respondWithStatusCode(_0x554f82,_0x5a4964){_0x5a4964=_0x5a4964||0xcc;return function(_0x64dad7){if(_0x64dad7){return _0x554f82['sendStatus'](_0x5a4964);}return _0x554f82[_0xe042('0x1a')](_0x5a4964)[_0xe042('0x1b')]();};}function respondWithResult(_0x5459aa,_0x4b2a9a){_0x4b2a9a=_0x4b2a9a||0xc8;return function(_0x502a4b){if(_0x502a4b){return _0x5459aa[_0xe042('0x1a')](_0x4b2a9a)['json'](_0x502a4b);}};}function respondWithFilteredResult(_0x32683e,_0x139465){return function(_0x13b73b){if(_0x13b73b){var _0x1b630d=_0x13b73b['count'],_0x3341bd=_0x139465['offset'],_0x2c7de3=_0x139465['offset']+_0x139465[_0xe042('0x1c')],_0x282a2d;if(_0x2c7de3>=_0x1b630d){_0x2c7de3=_0x1b630d;_0x282a2d=0xc8;}else{_0x282a2d=0xce;}_0x32683e['status'](_0x282a2d);return _0x32683e['set'](_0xe042('0x1d'),_0x3341bd+'-'+_0x2c7de3+'/'+_0x1b630d)['json'](_0x13b73b);}return null;};}function patchUpdates(_0x2bd3c8){return function(_0x19b657){try{jsonpatch['apply'](_0x19b657,_0x2bd3c8,!![]);}catch(_0x129343){return BPromise[_0xe042('0x1e')](_0x129343);}return _0x19b657['save']();};}function saveUpdates(_0x292eea,_0x42425e){return function(_0x20be89){if(_0x20be89){return _0x20be89[_0xe042('0x1f')](_0x292eea)[_0xe042('0x20')](function(_0xf6ec5e){return _0xf6ec5e;});}return null;};}function removeEntity(_0x3d8c71,_0x5e6a33){return function(_0x9cc77c){if(_0x9cc77c){return _0x9cc77c['destroy']()[_0xe042('0x20')](function(){_0x3d8c71['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d16a0,_0xc3ef){return function(_0x442432){if(!_0x442432){_0x1d16a0[_0xe042('0x21')](0x194);}return _0x442432;};}function handleError(_0x3d9ede,_0x4fe8e9){_0x4fe8e9=_0x4fe8e9||0x1f4;return function(_0x2c3527){logger[_0xe042('0x22')](_0x2c3527[_0xe042('0x23')]);if(_0x2c3527['name']){delete _0x2c3527['name'];}_0x3d9ede[_0xe042('0x1a')](_0x4fe8e9)[_0xe042('0x24')](_0x2c3527);};}exports['show']=function(_0x30a8d2,_0x463f3a){var _0x10107f={'raw':!![],'where':{'id':_0x30a8d2[_0xe042('0x25')]['id']}},_0xfc5665={};_0xfc5665[_0xe042('0x26')]=_[_0xe042('0x27')](db[_0xe042('0x28')]['rawAttributes']);_0xfc5665[_0xe042('0x29')]=_['keys'](_0x30a8d2['query']);_0xfc5665['filters']=_[_0xe042('0x2a')](_0xfc5665[_0xe042('0x26')],_0xfc5665['query']);_0x10107f[_0xe042('0x2b')]=_[_0xe042('0x2a')](_0xfc5665[_0xe042('0x26')],qs[_0xe042('0x2c')](_0x30a8d2[_0xe042('0x29')][_0xe042('0x2c')]));_0x10107f[_0xe042('0x2b')]=_0x10107f[_0xe042('0x2b')][_0xe042('0x2d')]?_0x10107f[_0xe042('0x2b')]:_0xfc5665[_0xe042('0x26')];if(_0x30a8d2[_0xe042('0x29')][_0xe042('0x2e')]){_0x10107f[_0xe042('0x2f')]=[{'all':!![]}];}_0x10107f=_['merge']({},_0x10107f,_0x30a8d2['options']);return db['ChatApplication'][_0xe042('0x30')](_0x10107f)[_0xe042('0x20')](handleEntityNotFound(_0x463f3a,null))['then'](respondWithResult(_0x463f3a,null))[_0xe042('0x31')](handleError(_0x463f3a,null));};exports[_0xe042('0x1f')]=function(_0xb31c2,_0x194a86){if(_0xb31c2['body']['id']){delete _0xb31c2[_0xe042('0x32')]['id'];}return db[_0xe042('0x28')][_0xe042('0x30')]({'where':{'id':_0xb31c2[_0xe042('0x25')]['id']}})[_0xe042('0x20')](handleEntityNotFound(_0x194a86,null))[_0xe042('0x20')](saveUpdates(_0xb31c2[_0xe042('0x32')],null))[_0xe042('0x20')](respondWithResult(_0x194a86,null))[_0xe042('0x31')](handleError(_0x194a86,null));};exports[_0xe042('0x33')]=function(_0x59ac25,_0x1821cd){return db[_0xe042('0x28')][_0xe042('0x30')]({'where':{'id':_0x59ac25['params']['id']}})[_0xe042('0x20')](handleEntityNotFound(_0x1821cd,null))['then'](removeEntity(_0x1821cd,null))['catch'](handleError(_0x1821cd,null));}; \ No newline at end of file +var _0x64be=['name','send','show','params','model','keys','ChatApplication','rawAttributes','query','fields','attributes','includeAll','include','options','catch','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','then','stack'];(function(_0x436a03,_0x423aaf){var _0xec83db=function(_0x4f6d10){while(--_0x4f6d10){_0x436a03['push'](_0x436a03['shift']());}};_0xec83db(++_0x423aaf);}(_0x64be,0x7d));var _0xe64b=function(_0x48a67f,_0x12fd90){_0x48a67f=_0x48a67f-0x0;var _0x4f1faf=_0x64be[_0x48a67f];return _0x4f1faf;};'use strict';var pdf=require(_0xe64b('0x0'));var emlformat=require(_0xe64b('0x1'));var rimraf=require(_0xe64b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe64b('0x3'));var moment=require('moment');var BPromise=require(_0xe64b('0x4'));var Mustache=require(_0xe64b('0x5'));var util=require(_0xe64b('0x6'));var path=require(_0xe64b('0x7'));var sox=require(_0xe64b('0x8'));var csv=require(_0xe64b('0x9'));var ejs=require(_0xe64b('0xa'));var fs=require('fs');var _=require(_0xe64b('0xb'));var squel=require(_0xe64b('0xc'));var crypto=require(_0xe64b('0xd'));var jsforce=require(_0xe64b('0xe'));var deskjs=require(_0xe64b('0xf'));var toCsv=require(_0xe64b('0x9'));var querystring=require(_0xe64b('0x10'));var Papa=require(_0xe64b('0x11'));var Redis=require(_0xe64b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe64b('0x13'));var as=require(_0xe64b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe64b('0x15'));var config=require('../../config/environment');var db=require(_0xe64b('0x16'))['db'];function respondWithStatusCode(_0x2dd7ac,_0xf57d72){_0xf57d72=_0xf57d72||0xcc;return function(_0x4caf5d){if(_0x4caf5d){return _0x2dd7ac[_0xe64b('0x17')](_0xf57d72);}return _0x2dd7ac[_0xe64b('0x18')](_0xf57d72)[_0xe64b('0x19')]();};}function respondWithResult(_0x1db43f,_0x4c6e70){_0x4c6e70=_0x4c6e70||0xc8;return function(_0x27b00c){if(_0x27b00c){return _0x1db43f[_0xe64b('0x18')](_0x4c6e70)[_0xe64b('0x1a')](_0x27b00c);}};}function respondWithFilteredResult(_0x5aee1c,_0x1b8ba1){return function(_0x5d6c90){if(_0x5d6c90){var _0x1f7e7a=_0x5d6c90['count'],_0x4fee95=_0x1b8ba1[_0xe64b('0x1b')],_0x13304f=_0x1b8ba1[_0xe64b('0x1b')]+_0x1b8ba1[_0xe64b('0x1c')],_0x164b1c;if(_0x13304f>=_0x1f7e7a){_0x13304f=_0x1f7e7a;_0x164b1c=0xc8;}else{_0x164b1c=0xce;}_0x5aee1c[_0xe64b('0x18')](_0x164b1c);return _0x5aee1c[_0xe64b('0x1d')]('Content-Range',_0x4fee95+'-'+_0x13304f+'/'+_0x1f7e7a)[_0xe64b('0x1a')](_0x5d6c90);}return null;};}function patchUpdates(_0x4041b4){return function(_0x405818){try{jsonpatch[_0xe64b('0x1e')](_0x405818,_0x4041b4,!![]);}catch(_0x20e0ec){return BPromise[_0xe64b('0x1f')](_0x20e0ec);}return _0x405818[_0xe64b('0x20')]();};}function saveUpdates(_0x67025b,_0xf6cd85){return function(_0x3561d3){if(_0x3561d3){return _0x3561d3[_0xe64b('0x21')](_0x67025b)['then'](function(_0x3e3e83){return _0x3e3e83;});}return null;};}function removeEntity(_0x48118d,_0x2387da){return function(_0x4b506f){if(_0x4b506f){return _0x4b506f[_0xe64b('0x22')]()[_0xe64b('0x23')](function(){_0x48118d[_0xe64b('0x18')](0xcc)[_0xe64b('0x19')]();});}};}function handleEntityNotFound(_0x535b14,_0x2bf03b){return function(_0x54168e){if(!_0x54168e){_0x535b14[_0xe64b('0x17')](0x194);}return _0x54168e;};}function handleError(_0x5199be,_0x2d1521){_0x2d1521=_0x2d1521||0x1f4;return function(_0x2bb55e){logger['error'](_0x2bb55e[_0xe64b('0x24')]);if(_0x2bb55e['name']){delete _0x2bb55e[_0xe64b('0x25')];}_0x5199be[_0xe64b('0x18')](_0x2d1521)[_0xe64b('0x26')](_0x2bb55e);};}exports[_0xe64b('0x27')]=function(_0x531c85,_0xda1708){var _0x44e5df={'raw':!![],'where':{'id':_0x531c85[_0xe64b('0x28')]['id']}},_0x14e503={};_0x14e503[_0xe64b('0x29')]=_[_0xe64b('0x2a')](db[_0xe64b('0x2b')][_0xe64b('0x2c')]);_0x14e503[_0xe64b('0x2d')]=_['keys'](_0x531c85[_0xe64b('0x2d')]);_0x14e503['filters']=_['intersection'](_0x14e503['model'],_0x14e503['query']);_0x44e5df['attributes']=_['intersection'](_0x14e503[_0xe64b('0x29')],qs['fields'](_0x531c85[_0xe64b('0x2d')][_0xe64b('0x2e')]));_0x44e5df[_0xe64b('0x2f')]=_0x44e5df[_0xe64b('0x2f')]['length']?_0x44e5df[_0xe64b('0x2f')]:_0x14e503[_0xe64b('0x29')];if(_0x531c85[_0xe64b('0x2d')][_0xe64b('0x30')]){_0x44e5df[_0xe64b('0x31')]=[{'all':!![]}];}_0x44e5df=_['merge']({},_0x44e5df,_0x531c85[_0xe64b('0x32')]);return db[_0xe64b('0x2b')]['find'](_0x44e5df)['then'](handleEntityNotFound(_0xda1708,null))[_0xe64b('0x23')](respondWithResult(_0xda1708,null))[_0xe64b('0x33')](handleError(_0xda1708,null));};exports[_0xe64b('0x21')]=function(_0x66ee1e,_0x1d0d8d){if(_0x66ee1e[_0xe64b('0x34')]['id']){delete _0x66ee1e[_0xe64b('0x34')]['id'];}return db[_0xe64b('0x2b')][_0xe64b('0x35')]({'where':{'id':_0x66ee1e[_0xe64b('0x28')]['id']}})[_0xe64b('0x23')](handleEntityNotFound(_0x1d0d8d,null))['then'](saveUpdates(_0x66ee1e[_0xe64b('0x34')],null))[_0xe64b('0x23')](respondWithResult(_0x1d0d8d,null))[_0xe64b('0x33')](handleError(_0x1d0d8d,null));};exports[_0xe64b('0x22')]=function(_0x5eac47,_0x440c70){return db[_0xe64b('0x2b')][_0xe64b('0x35')]({'where':{'id':_0x5eac47[_0xe64b('0x28')]['id']}})[_0xe64b('0x23')](handleEntityNotFound(_0x440c70,null))[_0xe64b('0x23')](removeEntity(_0x440c70,null))[_0xe64b('0x33')](handleError(_0x440c70,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 1c32570..984c76c 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 _0xc722=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x580d97,_0xf8a984){var _0x50d54d=function(_0x22810a){while(--_0x22810a){_0x580d97['push'](_0x580d97['shift']());}};_0x50d54d(++_0xf8a984);}(_0xc722,0x144));var _0x2c72=function(_0x5d71b9,_0x3e19c8){_0x5d71b9=_0x5d71b9-0x0;var _0x26d9e5=_0xc722[_0x5d71b9];return _0x26d9e5;};'use strict';var _=require('lodash');var util=require(_0x2c72('0x0'));var logger=require(_0x2c72('0x1'))(_0x2c72('0x2'));var moment=require(_0x2c72('0x3'));var BPromise=require(_0x2c72('0x4'));var rp=require(_0x2c72('0x5'));var fs=require('fs');var path=require(_0x2c72('0x6'));var rimraf=require(_0x2c72('0x7'));var config=require('../../config/environment');var attributes=require(_0x2c72('0x8'));module['exports']=function(_0x42e4a8,_0x45be75){return _0x42e4a8['define'](_0x2c72('0x9'),attributes,{'tableName':_0x2c72('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2c72('0xb'),'collate':_0x2c72('0xc')});}; \ No newline at end of file +var _0x0b77=['../../config/environment','exports','define','ChatApplication','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x13725b,_0x36f52f){var _0x2530c5=function(_0x42ced2){while(--_0x42ced2){_0x13725b['push'](_0x13725b['shift']());}};_0x2530c5(++_0x36f52f);}(_0x0b77,0x16d));var _0x70b7=function(_0x17249c,_0x168d62){_0x17249c=_0x17249c-0x0;var _0x324e7b=_0x0b77[_0x17249c];return _0x324e7b;};'use strict';var _=require('lodash');var util=require(_0x70b7('0x0'));var logger=require(_0x70b7('0x1'))(_0x70b7('0x2'));var moment=require(_0x70b7('0x3'));var BPromise=require(_0x70b7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70b7('0x5'));var rimraf=require(_0x70b7('0x6'));var config=require(_0x70b7('0x7'));var attributes=require('./chatApplication.attributes');module[_0x70b7('0x8')]=function(_0x4bdd0a,_0x10bd7b){return _0x4bdd0a[_0x70b7('0x9')](_0x70b7('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x70b7('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 5dd1d8a..a630bbd 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 _0x7051=['rpc','../../config/environment','client','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x3d75c4,_0x594c23){var _0x407801=function(_0x344234){while(--_0x344234){_0x3d75c4['push'](_0x3d75c4['shift']());}};_0x407801(++_0x594c23);}(_0x7051,0x120));var _0x1705=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0x7051[_0x26fc81];return _0x9feece;};'use strict';var _=require(_0x1705('0x0'));var util=require(_0x1705('0x1'));var moment=require('moment');var BPromise=require(_0x1705('0x2'));var rs=require(_0x1705('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1705('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1705('0x5'))(_0x1705('0x6'));var config=require(_0x1705('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1705('0x8')][_0x1705('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16dd1d,_0x38eb46,_0x5aa6b1){return new BPromise(function(_0x523842,_0x41cb7b){return client['request'](_0x16dd1d,_0x5aa6b1)[_0x1705('0xa')](function(_0x8672e1){logger[_0x1705('0xb')](_0x1705('0xc'),_0x38eb46,_0x1705('0xd'));logger[_0x1705('0xe')](_0x1705('0xf'),_0x38eb46,'request\x20sent',JSON['stringify'](_0x8672e1));if(_0x8672e1[_0x1705('0x10')]){if(_0x8672e1['error'][_0x1705('0x11')]===0x1f4){logger[_0x1705('0x10')]('ChatApplication,\x20%s,\x20%s',_0x38eb46,_0x8672e1['error']['message']);return _0x41cb7b(_0x8672e1[_0x1705('0x10')][_0x1705('0x12')]);}logger[_0x1705('0x10')](_0x1705('0xc'),_0x38eb46,_0x8672e1[_0x1705('0x10')][_0x1705('0x12')]);return _0x523842(_0x8672e1[_0x1705('0x10')]['message']);}else{logger[_0x1705('0xb')](_0x1705('0xc'),_0x38eb46,'request\x20sent');_0x523842(_0x8672e1[_0x1705('0x13')][_0x1705('0x12')]);}})[_0x1705('0x14')](function(_0x528f38){logger[_0x1705('0x10')](_0x1705('0xc'),_0x38eb46,_0x528f38);_0x41cb7b(_0x528f38);});});} \ No newline at end of file +var _0x9bbc=['../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x34b30d,_0xaa6257){var _0x5c33ba=function(_0x52c1be){while(--_0x52c1be){_0x34b30d['push'](_0x34b30d['shift']());}};_0x5c33ba(++_0xaa6257);}(_0x9bbc,0x173));var _0xc9bb=function(_0x9152f7,_0x1c56a2){_0x9152f7=_0x9152f7-0x0;var _0xbe781a=_0x9bbc[_0x9152f7];return _0xbe781a;};'use strict';var _=require(_0xc9bb('0x0'));var util=require(_0xc9bb('0x1'));var moment=require(_0xc9bb('0x2'));var BPromise=require(_0xc9bb('0x3'));var rs=require(_0xc9bb('0x4'));var fs=require('fs');var Redis=require(_0xc9bb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9bb('0x6'));var logger=require(_0xc9bb('0x7'))('rpc');var config=require(_0xc9bb('0x8'));var jayson=require(_0xc9bb('0x9'));var client=jayson[_0xc9bb('0xa')][_0xc9bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46544f,_0x38d055,_0x3f6e36){return new BPromise(function(_0x22b560,_0x535150){return client[_0xc9bb('0xc')](_0x46544f,_0x3f6e36)['then'](function(_0x5b2aa8){logger[_0xc9bb('0xd')](_0xc9bb('0xe'),_0x38d055,_0xc9bb('0xf'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x38d055,_0xc9bb('0xf'),JSON['stringify'](_0x5b2aa8));if(_0x5b2aa8['error']){if(_0x5b2aa8[_0xc9bb('0x10')][_0xc9bb('0x11')]===0x1f4){logger['error'](_0xc9bb('0xe'),_0x38d055,_0x5b2aa8[_0xc9bb('0x10')][_0xc9bb('0x12')]);return _0x535150(_0x5b2aa8[_0xc9bb('0x10')][_0xc9bb('0x12')]);}logger[_0xc9bb('0x10')](_0xc9bb('0xe'),_0x38d055,_0x5b2aa8[_0xc9bb('0x10')]['message']);return _0x22b560(_0x5b2aa8[_0xc9bb('0x10')][_0xc9bb('0x12')]);}else{logger['info'](_0xc9bb('0xe'),_0x38d055,'request\x20sent');_0x22b560(_0x5b2aa8[_0xc9bb('0x13')][_0xc9bb('0x12')]);}})[_0xc9bb('0x14')](function(_0x5079fd){logger[_0xc9bb('0x10')]('ChatApplication,\x20%s,\x20%s',_0x38d055,_0x5079fd);_0x535150(_0x5079fd);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index ab5d2aa..07618ea 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 _0xcce7=['../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','util','express','../../components/auth/service'];(function(_0x13e31b,_0x2d82f4){var _0xc5484e=function(_0x14cbeb){while(--_0x14cbeb){_0x13e31b['push'](_0x13e31b['shift']());}};_0xc5484e(++_0x2d82f4);}(_0xcce7,0x1bd));var _0x7cce=function(_0x314cdb,_0x39595c){_0x314cdb=_0x314cdb-0x0;var _0x586c99=_0xcce7[_0x314cdb];return _0x586c99;};'use strict';var multer=require('multer');var util=require(_0x7cce('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7cce('0x1'));var router=express['Router']();var auth=require(_0x7cce('0x2'));var interaction=require(_0x7cce('0x3'));var config=require(_0x7cce('0x4'));var controller=require(_0x7cce('0x5'));router[_0x7cce('0x6')](_0x7cce('0x7'),auth[_0x7cce('0x8')](),controller[_0x7cce('0x9')]);router[_0x7cce('0xa')]('/:id',auth[_0x7cce('0x8')](),controller[_0x7cce('0xb')]);router[_0x7cce('0xc')](_0x7cce('0x7'),auth['isAuthenticated'](),controller[_0x7cce('0xd')]);module['exports']=router; \ No newline at end of file +var _0x0711=['/:id','show','isAuthenticated','update','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment','get'];(function(_0xd07a06,_0x8566fe){var _0x76e5be=function(_0x12ec6c){while(--_0x12ec6c){_0xd07a06['push'](_0xd07a06['shift']());}};_0x76e5be(++_0x8566fe);}(_0x0711,0x14a));var _0x1071=function(_0x5e73e3,_0x496454){_0x5e73e3=_0x5e73e3-0x0;var _0x37a1e1=_0x0711[_0x5e73e3];return _0x37a1e1;};'use strict';var multer=require(_0x1071('0x0'));var util=require('util');var path=require(_0x1071('0x1'));var timeout=require(_0x1071('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x1071('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1071('0x4'));var controller=require('./chatApplication.controller');router[_0x1071('0x5')](_0x1071('0x6'),auth['isAuthenticated'](),controller[_0x1071('0x7')]);router['put'](_0x1071('0x6'),auth[_0x1071('0x8')](),controller[_0x1071('0x9')]);router[_0x1071('0xa')](_0x1071('0x6'),auth[_0x1071('0x8')](),controller['destroy']);module[_0x1071('0xb')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index cadc056..37a40ce 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 _0xf94a=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2f6cfb,_0x43a30a){var _0x566464=function(_0x167d40){while(--_0x167d40){_0x2f6cfb['push'](_0x2f6cfb['shift']());}};_0x566464(++_0x43a30a);}(_0xf94a,0xec));var _0xaf94=function(_0x18ed88,_0x2fb109){_0x18ed88=_0x18ed88-0x0;var _0x43c29c=_0xf94a[_0x18ed88];return _0x43c29c;};'use strict';var Sequelize=require(_0xaf94('0x0'));module[_0xaf94('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xaf94('0x2')]},'write':{'type':Sequelize[_0xaf94('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2da9=['STRING','sequelize'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x2da9,0x1d1));var _0x92da=function(_0x1779e3,_0x22133b){_0x1779e3=_0x1779e3-0x0;var _0x49f989=_0x2da9[_0x1779e3];return _0x49f989;};'use strict';var Sequelize=require(_0x92da('0x0'));module['exports']={'name':{'type':Sequelize[_0x92da('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x92da('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 6a2581f..33e3973 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 _0x03fa=['findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.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','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','stack','name','send','index','map','ChatGroup','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','destroy','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','order','addMessage','ChatGroupId','getMessages'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x03fa,0x70));var _0xa03f=function(_0x5970a4,_0x410a19){_0x5970a4=_0x5970a4-0x0;var _0x45fc63=_0x03fa[_0x5970a4];return _0x45fc63;};'use strict';var pdf=require(_0xa03f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa03f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa03f('0x2'));var rp=require(_0xa03f('0x3'));var moment=require(_0xa03f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa03f('0x5'));var util=require(_0xa03f('0x6'));var path=require(_0xa03f('0x7'));var sox=require(_0xa03f('0x8'));var csv=require(_0xa03f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa03f('0xa'));var squel=require('squel');var crypto=require(_0xa03f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa03f('0x9'));var querystring=require(_0xa03f('0xc'));var Papa=require('papaparse');var Redis=require(_0xa03f('0xd'));var authService=require(_0xa03f('0xe'));var qs=require(_0xa03f('0xf'));var as=require(_0xa03f('0x10'));var hardwareService=require(_0xa03f('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xa03f('0x12'));var config=require(_0xa03f('0x13'));var db=require(_0xa03f('0x14'))['db'];config[_0xa03f('0x15')]=_[_0xa03f('0x16')](config[_0xa03f('0x15')],{'host':_0xa03f('0x17'),'port':0x18eb});var socket=require(_0xa03f('0x18'))(new Redis(config[_0xa03f('0x15')]));require(_0xa03f('0x19'))['register'](socket);var jayson=require(_0xa03f('0x1a'));var client=jayson['client'][_0xa03f('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3866f,_0xe87e87,_0x324480){if(_0x324480){var _0x6b9aa9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6b9aa9[_0xa03f('0x1c')](_0xe87e87)){return _0x3866f;}else{throw new db[(_0xa03f('0x1d'))][(_0xa03f('0x1e'))](_0xa03f('0x1f'));}}else{return _0x3866f;}}function respondWithRpcPromise(_0x17c203,_0xf5b28,_0x2fcfe2,_0x163ac7){return new BPromise(function(_0x3c2080,_0x3bb904){var _0x531f1e=_0x163ac7||client;return _0x531f1e[_0xa03f('0x20')](_0x17c203,_0x2fcfe2)[_0xa03f('0x21')](function(_0xa5bbb9){logger[_0xa03f('0x22')](_0xa03f('0x23'),_0xf5b28,_0xa03f('0x24'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0xf5b28,_0xa03f('0x24'),JSON['stringify'](_0xa5bbb9));if(_0xa5bbb9[_0xa03f('0x25')]){if(_0xa5bbb9[_0xa03f('0x25')][_0xa03f('0x26')]===0x1f4){logger[_0xa03f('0x25')]('ChatGroup,\x20%s,\x20%s',_0xf5b28,_0xa5bbb9[_0xa03f('0x25')][_0xa03f('0x27')]);return _0x3bb904(_0xa5bbb9[_0xa03f('0x25')][_0xa03f('0x27')]);}logger[_0xa03f('0x25')](_0xa03f('0x23'),_0xf5b28,_0xa5bbb9['error']['message']);return _0x3c2080(_0xa5bbb9[_0xa03f('0x25')][_0xa03f('0x27')]);}else{logger[_0xa03f('0x22')](_0xa03f('0x23'),_0xf5b28,_0xa03f('0x24'));_0x3c2080(_0xa5bbb9['result'][_0xa03f('0x27')]);}})['catch'](function(_0xcec26f){logger[_0xa03f('0x25')](_0xa03f('0x23'),_0xf5b28,_0xcec26f);_0x3bb904(_0xcec26f);});});}function respondWithStatusCode(_0x475153,_0x1c2a8b){_0x1c2a8b=_0x1c2a8b||0xcc;return function(_0x315d3c){if(_0x315d3c){return _0x475153[_0xa03f('0x28')](_0x1c2a8b);}return _0x475153['status'](_0x1c2a8b)[_0xa03f('0x29')]();};}function respondWithResult(_0x52d089,_0x4596d2){_0x4596d2=_0x4596d2||0xc8;return function(_0x32bd2f){if(_0x32bd2f){return _0x52d089['status'](_0x4596d2)[_0xa03f('0x2a')](_0x32bd2f);}};}function respondWithFilteredResult(_0x118dd7,_0x593997){return function(_0x547983){if(_0x547983){var _0x32406e=_0x547983[_0xa03f('0x2b')],_0x170f4d=_0x593997[_0xa03f('0x2c')],_0xa085a9=_0x593997[_0xa03f('0x2c')]+_0x593997[_0xa03f('0x2d')],_0x29dee3;if(_0xa085a9>=_0x32406e){_0xa085a9=_0x32406e;_0x29dee3=0xc8;}else{_0x29dee3=0xce;}_0x118dd7[_0xa03f('0x2e')](_0x29dee3);return _0x118dd7['set'](_0xa03f('0x2f'),_0x170f4d+'-'+_0xa085a9+'/'+_0x32406e)[_0xa03f('0x2a')](_0x547983);}return null;};}function patchUpdates(_0x180d80){return function(_0x44312e){try{jsonpatch[_0xa03f('0x30')](_0x44312e,_0x180d80,!![]);}catch(_0x50dede){return BPromise[_0xa03f('0x31')](_0x50dede);}return _0x44312e[_0xa03f('0x32')]();};}function saveUpdates(_0x58e6ce,_0x20e192){return function(_0x595bc8){if(_0x595bc8){return _0x595bc8[_0xa03f('0x33')](_0x58e6ce)['then'](function(_0x98c39c){return _0x98c39c;});}return null;};}function removeEntity(_0x43747d,_0xe160f1){return function(_0x45419f){if(_0x45419f){return _0x45419f['destroy']()[_0xa03f('0x21')](function(){_0x43747d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ea760,_0x569463){return function(_0x1511d0){if(!_0x1511d0){_0x2ea760[_0xa03f('0x28')](0x194);}return _0x1511d0;};}function handleError(_0x30f959,_0x2dc307){_0x2dc307=_0x2dc307||0x1f4;return function(_0x5ae951){logger['error'](_0x5ae951[_0xa03f('0x34')]);if(_0x5ae951[_0xa03f('0x35')]){delete _0x5ae951[_0xa03f('0x35')];}_0x30f959[_0xa03f('0x2e')](_0x2dc307)[_0xa03f('0x36')](_0x5ae951);};}exports[_0xa03f('0x37')]=function(_0x3f4f75,_0x466033){var _0x1139bf={},_0x3ffb0d={},_0x4daf1d={'count':0x0,'rows':[]};var _0x519898=_[_0xa03f('0x38')](db[_0xa03f('0x39')]['rawAttributes'],function(_0x1b2eb2){return{'name':_0x1b2eb2[_0xa03f('0x3a')],'type':_0x1b2eb2[_0xa03f('0x3b')][_0xa03f('0x3c')]};});_0x3ffb0d[_0xa03f('0x3d')]=_[_0xa03f('0x38')](_0x519898,_0xa03f('0x35'));_0x3ffb0d[_0xa03f('0x3e')]=_[_0xa03f('0x3f')](_0x3f4f75['query']);_0x3ffb0d[_0xa03f('0x40')]=_[_0xa03f('0x41')](_0x3ffb0d[_0xa03f('0x3d')],_0x3ffb0d[_0xa03f('0x3e')]);_0x1139bf[_0xa03f('0x42')]=_['intersection'](_0x3ffb0d[_0xa03f('0x3d')],qs[_0xa03f('0x43')](_0x3f4f75[_0xa03f('0x3e')][_0xa03f('0x43')]));_0x1139bf[_0xa03f('0x42')]=_0x1139bf['attributes'][_0xa03f('0x44')]?_0x1139bf[_0xa03f('0x42')]:_0x3ffb0d[_0xa03f('0x3d')];if(!_0x3f4f75[_0xa03f('0x3e')][_0xa03f('0x45')]('nolimit')){_0x1139bf[_0xa03f('0x2d')]=qs[_0xa03f('0x2d')](_0x3f4f75[_0xa03f('0x3e')]['limit']);_0x1139bf[_0xa03f('0x2c')]=qs['offset'](_0x3f4f75['query'][_0xa03f('0x2c')]);}_0x1139bf['order']=qs[_0xa03f('0x46')](_0x3f4f75[_0xa03f('0x3e')][_0xa03f('0x46')]);_0x1139bf[_0xa03f('0x47')]=qs['filters'](_[_0xa03f('0x48')](_0x3f4f75['query'],_0x3ffb0d[_0xa03f('0x40')]),_0x519898);if(_0x3f4f75[_0xa03f('0x3e')][_0xa03f('0x49')]){_0x1139bf[_0xa03f('0x47')]=_['merge'](_0x1139bf[_0xa03f('0x47')],{'$or':_[_0xa03f('0x38')](_0x519898,function(_0x571df0){if(_0x571df0['type']!==_0xa03f('0x4a')){var _0x53ca2c={};_0x53ca2c[_0x571df0['name']]={'$like':'%'+_0x3f4f75[_0xa03f('0x3e')]['filter']+'%'};return _0x53ca2c;}})});}_0x1139bf=_['merge']({},_0x1139bf,_0x3f4f75[_0xa03f('0x4b')]);var _0x18233a={'where':_0x1139bf[_0xa03f('0x47')]};return db[_0xa03f('0x39')][_0xa03f('0x2b')](_0x18233a)[_0xa03f('0x21')](function(_0x33d3bd){_0x4daf1d[_0xa03f('0x2b')]=_0x33d3bd;if(_0x3f4f75[_0xa03f('0x3e')][_0xa03f('0x4c')]){_0x1139bf[_0xa03f('0x4d')]=[{'all':!![]}];}return db['ChatGroup'][_0xa03f('0x4e')](_0x1139bf);})[_0xa03f('0x21')](function(_0x22059f){_0x4daf1d[_0xa03f('0x4f')]=_0x22059f;return _0x4daf1d;})[_0xa03f('0x21')](respondWithFilteredResult(_0x466033,_0x1139bf))[_0xa03f('0x50')](handleError(_0x466033,null));};exports[_0xa03f('0x51')]=function(_0x554c7c,_0x1378cf){var _0x19b07e={'raw':!![],'where':{'id':_0x554c7c[_0xa03f('0x52')]['id']}},_0x2cd8af={};_0x2cd8af[_0xa03f('0x3d')]=_[_0xa03f('0x3f')](db['ChatGroup'][_0xa03f('0x53')]);_0x2cd8af[_0xa03f('0x3e')]=_[_0xa03f('0x3f')](_0x554c7c[_0xa03f('0x3e')]);_0x2cd8af[_0xa03f('0x40')]=_[_0xa03f('0x41')](_0x2cd8af[_0xa03f('0x3d')],_0x2cd8af[_0xa03f('0x3e')]);_0x19b07e[_0xa03f('0x42')]=_[_0xa03f('0x41')](_0x2cd8af[_0xa03f('0x3d')],qs[_0xa03f('0x43')](_0x554c7c['query'][_0xa03f('0x43')]));_0x19b07e[_0xa03f('0x42')]=_0x19b07e[_0xa03f('0x42')]['length']?_0x19b07e[_0xa03f('0x42')]:_0x2cd8af['model'];if(_0x554c7c['query']['includeAll']){_0x19b07e[_0xa03f('0x4d')]=[{'all':!![]}];}_0x19b07e=_[_0xa03f('0x54')]({},_0x19b07e,_0x554c7c[_0xa03f('0x4b')]);return db['ChatGroup'][_0xa03f('0x55')](_0x19b07e)[_0xa03f('0x21')](handleEntityNotFound(_0x1378cf,null))['then'](respondWithResult(_0x1378cf,null))[_0xa03f('0x50')](handleError(_0x1378cf,null));};exports[_0xa03f('0x56')]=function(_0x139fbc,_0xbca44c){return db['ChatGroup'][_0xa03f('0x56')](_0x139fbc['body'],{})[_0xa03f('0x21')](respondWithResult(_0xbca44c,0xc9))[_0xa03f('0x50')](handleError(_0xbca44c,null));};exports[_0xa03f('0x33')]=function(_0x7b4aaf,_0x18b5b9){if(_0x7b4aaf[_0xa03f('0x57')]['id']){delete _0x7b4aaf['body']['id'];}return db[_0xa03f('0x39')][_0xa03f('0x55')]({'where':{'id':_0x7b4aaf[_0xa03f('0x52')]['id']}})['then'](handleEntityNotFound(_0x18b5b9,null))[_0xa03f('0x21')](saveUpdates(_0x7b4aaf['body'],null))[_0xa03f('0x21')](respondWithResult(_0x18b5b9,null))['catch'](handleError(_0x18b5b9,null));};exports[_0xa03f('0x58')]=function(_0x2e858a,_0x35697b){return db[_0xa03f('0x39')][_0xa03f('0x55')]({'where':{'id':_0x2e858a[_0xa03f('0x52')]['id']}})['then'](handleEntityNotFound(_0x35697b,null))[_0xa03f('0x21')](removeEntity(_0x35697b,null))[_0xa03f('0x50')](handleError(_0x35697b,null));};exports['describe']=function(_0xadf9db,_0xda5468){return db['ChatGroup']['describe']()[_0xa03f('0x21')](respondWithResult(_0xda5468,null))[_0xa03f('0x50')](handleError(_0xda5468,null));};exports['getUnread']=function(_0x5425d2,_0x4e9eee,_0x1fc592){return db[_0xa03f('0x59')][_0xa03f('0x2b')]({'where':{'ChatGroupId':_0x5425d2[_0xa03f('0x52')]['id'],'ToId':_0x5425d2[_0xa03f('0x5a')]['id'],'read':![]}})[_0xa03f('0x21')](function(_0x261872){return{'id':_[_0xa03f('0x5b')](_0x5425d2['params']['id']),'count':_0x261872};})[_0xa03f('0x21')](respondWithResult(_0x4e9eee,null))[_0xa03f('0x50')](handleError(_0x4e9eee,null));};exports[_0xa03f('0x5c')]=function(_0x37c946,_0x440022,_0x166861){return db[_0xa03f('0x39')][_0xa03f('0x55')]({'where':{'id':_0x37c946[_0xa03f('0x52')]['id']}})[_0xa03f('0x21')](handleEntityNotFound(_0x440022,null))['then'](function(_0x2d7d43){if(_0x2d7d43){return _0x2d7d43[_0xa03f('0x5c')](_0x37c946[_0xa03f('0x57')][_0xa03f('0x5d')],_[_0xa03f('0x5e')](_0x37c946[_0xa03f('0x57')],[_0xa03f('0x5d'),'id'])||{});}})[_0xa03f('0x21')](respondWithResult(_0x440022,null))[_0xa03f('0x50')](handleError(_0x440022,null));};exports[_0xa03f('0x5f')]=function(_0x197331,_0x1000ff,_0x3e57ed){var _0x38816a={};var _0x860f09={};var _0x52df7e;var _0x33af3e;return db[_0xa03f('0x39')]['findOne']({'where':{'id':_0x197331['params']['id']}})[_0xa03f('0x21')](handleEntityNotFound(_0x1000ff,null))[_0xa03f('0x21')](function(_0x1b2590){if(_0x1b2590){_0x52df7e=_0x1b2590;_0x860f09[_0xa03f('0x3d')]=_['keys'](db['User'][_0xa03f('0x53')]);_0x860f09['query']=_['keys'](_0x197331[_0xa03f('0x3e')]);_0x860f09[_0xa03f('0x40')]=_[_0xa03f('0x41')](_0x860f09[_0xa03f('0x3d')],_0x860f09[_0xa03f('0x3e')]);_0x38816a[_0xa03f('0x42')]=_[_0xa03f('0x41')](_0x860f09[_0xa03f('0x3d')],qs[_0xa03f('0x43')](_0x197331[_0xa03f('0x3e')]['fields']));_0x38816a['attributes']=_0x38816a[_0xa03f('0x42')][_0xa03f('0x44')]?_0x38816a[_0xa03f('0x42')]:_0x860f09[_0xa03f('0x3d')];_0x38816a[_0xa03f('0x60')]=qs[_0xa03f('0x46')](_0x197331[_0xa03f('0x3e')][_0xa03f('0x46')]);_0x38816a[_0xa03f('0x47')]=qs['filters'](_[_0xa03f('0x48')](_0x197331[_0xa03f('0x3e')],_0x860f09[_0xa03f('0x40')]));if(_0x197331[_0xa03f('0x3e')][_0xa03f('0x49')]){_0x38816a['where']=_[_0xa03f('0x54')](_0x38816a[_0xa03f('0x47')],{'$or':_[_0xa03f('0x38')](_0x38816a['attributes'],function(_0xbac291){var _0x33a819={};_0x33a819[_0xbac291]={'$like':'%'+_0x197331[_0xa03f('0x3e')][_0xa03f('0x49')]+'%'};return _0x33a819;})});}_0x38816a=_[_0xa03f('0x54')]({},_0x38816a,_0x197331[_0xa03f('0x4b')]);return _0x52df7e[_0xa03f('0x5f')](_0x38816a);}})[_0xa03f('0x21')](function(_0x369058){if(_0x369058){_0x33af3e=_0x369058[_0xa03f('0x44')];if(!_0x197331[_0xa03f('0x3e')][_0xa03f('0x45')]('nolimit')){_0x38816a[_0xa03f('0x2d')]=qs['limit'](_0x197331[_0xa03f('0x3e')][_0xa03f('0x2d')]);_0x38816a[_0xa03f('0x2c')]=qs['offset'](_0x197331['query']['offset']);}return _0x52df7e['getMembers'](_0x38816a);}})[_0xa03f('0x21')](function(_0x379f86){if(_0x379f86){return _0x379f86?{'count':_0x33af3e,'rows':_0x379f86}:null;}})[_0xa03f('0x21')](respondWithResult(_0x1000ff,null))[_0xa03f('0x50')](handleError(_0x1000ff,null));};exports['removeMembers']=function(_0x3d7821,_0x113da3,_0x63bfc5){return db[_0xa03f('0x39')][_0xa03f('0x55')]({'where':{'id':_0x3d7821[_0xa03f('0x52')]['id']}})['then'](handleEntityNotFound(_0x113da3,null))[_0xa03f('0x21')](function(_0x27edfb){if(_0x27edfb){return _0x27edfb['removeMembers'](_0x3d7821['query']['ids']);}})[_0xa03f('0x21')](respondWithStatusCode(_0x113da3,null))[_0xa03f('0x50')](handleError(_0x113da3,null));};exports[_0xa03f('0x61')]=function(_0x570d6d,_0x42665f,_0x436bfd){if(_0x570d6d[_0xa03f('0x57')]['id']){delete _0x570d6d['body']['id'];}return db[_0xa03f('0x39')][_0xa03f('0x55')]({'where':{'id':_0x570d6d[_0xa03f('0x52')]['id']}})[_0xa03f('0x21')](handleEntityNotFound(_0x42665f,null))[_0xa03f('0x21')](function(_0x19caac){if(_0x19caac){_0x570d6d[_0xa03f('0x57')][_0xa03f('0x62')]=_0x19caac['id'];return db[_0xa03f('0x59')][_0xa03f('0x56')](_0x570d6d[_0xa03f('0x57')]);}})[_0xa03f('0x21')](respondWithResult(_0x42665f,null))['catch'](handleError(_0x42665f,null));};exports[_0xa03f('0x63')]=function(_0x1ef4dd,_0x495e79,_0x1faef3){var _0x4058d1={};var _0x343794={};var _0x153d18;var _0x4f7759;return db[_0xa03f('0x39')][_0xa03f('0x64')]({'where':{'id':_0x1ef4dd[_0xa03f('0x52')]['id']}})[_0xa03f('0x21')](handleEntityNotFound(_0x495e79,null))[_0xa03f('0x21')](function(_0x2738ef){if(_0x2738ef){_0x153d18=_0x2738ef;_0x343794[_0xa03f('0x3d')]=_[_0xa03f('0x3f')](db[_0xa03f('0x59')][_0xa03f('0x53')]);_0x343794['query']=_[_0xa03f('0x3f')](_0x1ef4dd['query']);_0x343794[_0xa03f('0x40')]=_[_0xa03f('0x41')](_0x343794[_0xa03f('0x3d')],_0x343794[_0xa03f('0x3e')]);_0x4058d1[_0xa03f('0x42')]=_[_0xa03f('0x41')](_0x343794[_0xa03f('0x3d')],qs[_0xa03f('0x43')](_0x1ef4dd['query'][_0xa03f('0x43')]));_0x4058d1[_0xa03f('0x42')]=_0x4058d1[_0xa03f('0x42')]['length']?_0x4058d1[_0xa03f('0x42')]:_0x343794[_0xa03f('0x3d')];_0x4058d1[_0xa03f('0x60')]=qs[_0xa03f('0x46')](_0x1ef4dd[_0xa03f('0x3e')][_0xa03f('0x46')]);_0x4058d1[_0xa03f('0x47')]=qs[_0xa03f('0x40')](_[_0xa03f('0x48')](_0x1ef4dd['query'],_0x343794[_0xa03f('0x40')]));if(_0x1ef4dd[_0xa03f('0x3e')][_0xa03f('0x49')]){_0x4058d1[_0xa03f('0x47')]=_[_0xa03f('0x54')](_0x4058d1[_0xa03f('0x47')],{'$or':_[_0xa03f('0x38')](_0x4058d1['attributes'],function(_0x126f8a){var _0x46ae92={};_0x46ae92[_0x126f8a]={'$like':'%'+_0x1ef4dd[_0xa03f('0x3e')]['filter']+'%'};return _0x46ae92;})});}if(_0x1ef4dd[_0xa03f('0x3e')][_0xa03f('0x65')]){var _0x3bc1ec=_0x1ef4dd[_0xa03f('0x3e')][_0xa03f('0x65')][_0xa03f('0x66')](',');var _0x560d21={};_0x560d21[_0x3bc1ec[0x0]]={'$gte':moment(_0x3bc1ec[0x1])[_0xa03f('0x67')](_0xa03f('0x68'))};_0x4058d1[_0xa03f('0x47')]=_['merge'](_0x4058d1['where'],_0x560d21);}_0x4058d1=_[_0xa03f('0x54')]({},_0x4058d1,_0x1ef4dd[_0xa03f('0x4b')]);return _0x153d18[_0xa03f('0x63')](_0x4058d1);}})[_0xa03f('0x21')](function(_0x43fd6c){if(_0x43fd6c){_0x4f7759=_0x43fd6c[_0xa03f('0x44')];if(!_0x1ef4dd[_0xa03f('0x3e')][_0xa03f('0x45')](_0xa03f('0x69'))){_0x4058d1[_0xa03f('0x2d')]=qs[_0xa03f('0x2d')](_0x1ef4dd['query']['limit']);_0x4058d1['offset']=qs[_0xa03f('0x2c')](_0x1ef4dd[_0xa03f('0x3e')]['offset']);}return _0x153d18[_0xa03f('0x63')](_0x4058d1);}})[_0xa03f('0x21')](function(_0x2f7563){if(_0x2f7563){return _0x2f7563?{'count':_0x4f7759,'rows':_0x2f7563}:null;}})['then'](respondWithResult(_0x495e79,null))[_0xa03f('0x50')](handleError(_0x495e79,null));}; \ No newline at end of file +var _0x2158=['api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./chatGroup.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','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','count','offset','Content-Range','json','apply','reject','save','destroy','sendStatus','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','fields','find','create','update','body','params','describe','getUnread','ChatInternalMessage','user','omit','ids','findOne','User','pick','getMembers','hasOwnProperty','removeMembers','addMessage','$gte','format','getMessages','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x4139b8,_0x554564){var _0x40c6d6=function(_0x4a743b){while(--_0x4a743b){_0x4139b8['push'](_0x4139b8['shift']());}};_0x40c6d6(++_0x554564);}(_0x2158,0xc3));var _0x8215=function(_0x33fbc4,_0x344f17){_0x33fbc4=_0x33fbc4-0x0;var _0x2789e5=_0x2158[_0x33fbc4];return _0x2789e5;};'use strict';var pdf=require(_0x8215('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8215('0x1'));var zipdir=require(_0x8215('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8215('0x3'));var BPromise=require(_0x8215('0x4'));var Mustache=require(_0x8215('0x5'));var util=require(_0x8215('0x6'));var path=require(_0x8215('0x7'));var sox=require(_0x8215('0x8'));var csv=require(_0x8215('0x9'));var ejs=require(_0x8215('0xa'));var fs=require('fs');var _=require(_0x8215('0xb'));var squel=require(_0x8215('0xc'));var crypto=require(_0x8215('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8215('0xe'));var toCsv=require(_0x8215('0x9'));var querystring=require(_0x8215('0xf'));var Papa=require('papaparse');var Redis=require(_0x8215('0x10'));var authService=require(_0x8215('0x11'));var qs=require(_0x8215('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8215('0x13'));var logger=require(_0x8215('0x14'))(_0x8215('0x15'));var utils=require(_0x8215('0x16'));var config=require(_0x8215('0x17'));var db=require('../../mysqldb')['db'];config[_0x8215('0x18')]=_[_0x8215('0x19')](config[_0x8215('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x8215('0x1a'))(new Redis(config[_0x8215('0x18')]));require(_0x8215('0x1b'))[_0x8215('0x1c')](socket);var jayson=require(_0x8215('0x1d'));var client=jayson[_0x8215('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x344035,_0x8a8f2e,_0x1f1a2c){if(_0x1f1a2c){var _0x55cb04=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55cb04[_0x8215('0x1f')](_0x8a8f2e)){return _0x344035;}else{throw new db[(_0x8215('0x20'))][(_0x8215('0x21'))](_0x8215('0x22'));}}else{return _0x344035;}}function respondWithRpcPromise(_0x3787ac,_0xcfa078,_0x331b14,_0x5943b0){return new BPromise(function(_0x4e35f7,_0x32431c){var _0x4e8752=_0x5943b0||client;return _0x4e8752[_0x8215('0x23')](_0x3787ac,_0x331b14)[_0x8215('0x24')](function(_0x24a297){logger[_0x8215('0x25')](_0x8215('0x26'),_0xcfa078,'request\x20sent');logger['debug'](_0x8215('0x27'),_0xcfa078,_0x8215('0x28'),JSON[_0x8215('0x29')](_0x24a297));if(_0x24a297[_0x8215('0x2a')]){if(_0x24a297['error'][_0x8215('0x2b')]===0x1f4){logger['error'](_0x8215('0x26'),_0xcfa078,_0x24a297[_0x8215('0x2a')]['message']);return _0x32431c(_0x24a297[_0x8215('0x2a')][_0x8215('0x2c')]);}logger[_0x8215('0x2a')](_0x8215('0x26'),_0xcfa078,_0x24a297[_0x8215('0x2a')][_0x8215('0x2c')]);return _0x4e35f7(_0x24a297[_0x8215('0x2a')]['message']);}else{logger[_0x8215('0x25')](_0x8215('0x26'),_0xcfa078,_0x8215('0x28'));_0x4e35f7(_0x24a297[_0x8215('0x2d')][_0x8215('0x2c')]);}})[_0x8215('0x2e')](function(_0xf4c6fc){logger[_0x8215('0x2a')](_0x8215('0x26'),_0xcfa078,_0xf4c6fc);_0x32431c(_0xf4c6fc);});});}function respondWithStatusCode(_0x1eb718,_0x3abb2b){_0x3abb2b=_0x3abb2b||0xcc;return function(_0x1a2328){if(_0x1a2328){return _0x1eb718['sendStatus'](_0x3abb2b);}return _0x1eb718['status'](_0x3abb2b)[_0x8215('0x2f')]();};}function respondWithResult(_0x17ec5b,_0x4dc562){_0x4dc562=_0x4dc562||0xc8;return function(_0x211886){if(_0x211886){return _0x17ec5b[_0x8215('0x30')](_0x4dc562)['json'](_0x211886);}};}function respondWithFilteredResult(_0x1ada45,_0x4a0072){return function(_0x767767){if(_0x767767){var _0x524e51=_0x767767[_0x8215('0x31')],_0x5dbccb=_0x4a0072[_0x8215('0x32')],_0x22b90f=_0x4a0072['offset']+_0x4a0072['limit'],_0x412d02;if(_0x22b90f>=_0x524e51){_0x22b90f=_0x524e51;_0x412d02=0xc8;}else{_0x412d02=0xce;}_0x1ada45[_0x8215('0x30')](_0x412d02);return _0x1ada45['set'](_0x8215('0x33'),_0x5dbccb+'-'+_0x22b90f+'/'+_0x524e51)[_0x8215('0x34')](_0x767767);}return null;};}function patchUpdates(_0x53a1db){return function(_0x4fae8d){try{jsonpatch[_0x8215('0x35')](_0x4fae8d,_0x53a1db,!![]);}catch(_0xe8307c){return BPromise[_0x8215('0x36')](_0xe8307c);}return _0x4fae8d[_0x8215('0x37')]();};}function saveUpdates(_0x33fa6a,_0x4fbda2){return function(_0x162b41){if(_0x162b41){return _0x162b41['update'](_0x33fa6a)['then'](function(_0x450aef){return _0x450aef;});}return null;};}function removeEntity(_0x21d076,_0x721c6){return function(_0x3803a9){if(_0x3803a9){return _0x3803a9[_0x8215('0x38')]()[_0x8215('0x24')](function(){_0x21d076[_0x8215('0x30')](0xcc)[_0x8215('0x2f')]();});}};}function handleEntityNotFound(_0x2d327c,_0x519d6d){return function(_0x645af8){if(!_0x645af8){_0x2d327c[_0x8215('0x39')](0x194);}return _0x645af8;};}function handleError(_0xe50e9a,_0x3719b2){_0x3719b2=_0x3719b2||0x1f4;return function(_0x2e49a6){logger[_0x8215('0x2a')](_0x2e49a6['stack']);if(_0x2e49a6[_0x8215('0x3a')]){delete _0x2e49a6[_0x8215('0x3a')];}_0xe50e9a[_0x8215('0x30')](_0x3719b2)[_0x8215('0x3b')](_0x2e49a6);};}exports[_0x8215('0x3c')]=function(_0x5c8e1c,_0x2e030e){var _0x4e3c33={},_0x60fcbc={},_0x4f4d89={'count':0x0,'rows':[]};var _0x2caa68=_[_0x8215('0x3d')](db[_0x8215('0x3e')][_0x8215('0x3f')],function(_0x586ccb){return{'name':_0x586ccb[_0x8215('0x40')],'type':_0x586ccb[_0x8215('0x41')][_0x8215('0x42')]};});_0x60fcbc['model']=_[_0x8215('0x3d')](_0x2caa68,_0x8215('0x3a'));_0x60fcbc[_0x8215('0x43')]=_[_0x8215('0x44')](_0x5c8e1c[_0x8215('0x43')]);_0x60fcbc[_0x8215('0x45')]=_['intersection'](_0x60fcbc[_0x8215('0x46')],_0x60fcbc['query']);_0x4e3c33[_0x8215('0x47')]=_[_0x8215('0x48')](_0x60fcbc[_0x8215('0x46')],qs['fields'](_0x5c8e1c[_0x8215('0x43')]['fields']));_0x4e3c33[_0x8215('0x47')]=_0x4e3c33[_0x8215('0x47')][_0x8215('0x49')]?_0x4e3c33[_0x8215('0x47')]:_0x60fcbc[_0x8215('0x46')];if(!_0x5c8e1c[_0x8215('0x43')]['hasOwnProperty'](_0x8215('0x4a'))){_0x4e3c33[_0x8215('0x4b')]=qs[_0x8215('0x4b')](_0x5c8e1c['query'][_0x8215('0x4b')]);_0x4e3c33[_0x8215('0x32')]=qs['offset'](_0x5c8e1c['query'][_0x8215('0x32')]);}_0x4e3c33[_0x8215('0x4c')]=qs[_0x8215('0x4d')](_0x5c8e1c['query'][_0x8215('0x4d')]);_0x4e3c33[_0x8215('0x4e')]=qs['filters'](_['pick'](_0x5c8e1c[_0x8215('0x43')],_0x60fcbc['filters']),_0x2caa68);if(_0x5c8e1c[_0x8215('0x43')][_0x8215('0x4f')]){_0x4e3c33[_0x8215('0x4e')]=_[_0x8215('0x50')](_0x4e3c33['where'],{'$or':_[_0x8215('0x3d')](_0x2caa68,function(_0x1b513a){if(_0x1b513a['type']!==_0x8215('0x51')){var _0x403cde={};_0x403cde[_0x1b513a[_0x8215('0x3a')]]={'$like':'%'+_0x5c8e1c[_0x8215('0x43')][_0x8215('0x4f')]+'%'};return _0x403cde;}})});}_0x4e3c33=_[_0x8215('0x50')]({},_0x4e3c33,_0x5c8e1c[_0x8215('0x52')]);var _0x5cc676={'where':_0x4e3c33['where']};return db[_0x8215('0x3e')]['count'](_0x5cc676)[_0x8215('0x24')](function(_0x1bd147){_0x4f4d89[_0x8215('0x31')]=_0x1bd147;if(_0x5c8e1c[_0x8215('0x43')]['includeAll']){_0x4e3c33[_0x8215('0x53')]=[{'all':!![]}];}return db['ChatGroup'][_0x8215('0x54')](_0x4e3c33);})[_0x8215('0x24')](function(_0x153e7b){_0x4f4d89[_0x8215('0x55')]=_0x153e7b;return _0x4f4d89;})[_0x8215('0x24')](respondWithFilteredResult(_0x2e030e,_0x4e3c33))[_0x8215('0x2e')](handleError(_0x2e030e,null));};exports['show']=function(_0x892e7d,_0x11e6b4){var _0x586d09={'raw':!![],'where':{'id':_0x892e7d['params']['id']}},_0x2d813c={};_0x2d813c[_0x8215('0x46')]=_['keys'](db[_0x8215('0x3e')]['rawAttributes']);_0x2d813c[_0x8215('0x43')]=_[_0x8215('0x44')](_0x892e7d['query']);_0x2d813c[_0x8215('0x45')]=_[_0x8215('0x48')](_0x2d813c[_0x8215('0x46')],_0x2d813c[_0x8215('0x43')]);_0x586d09['attributes']=_[_0x8215('0x48')](_0x2d813c['model'],qs[_0x8215('0x56')](_0x892e7d['query'][_0x8215('0x56')]));_0x586d09[_0x8215('0x47')]=_0x586d09[_0x8215('0x47')][_0x8215('0x49')]?_0x586d09[_0x8215('0x47')]:_0x2d813c[_0x8215('0x46')];if(_0x892e7d[_0x8215('0x43')]['includeAll']){_0x586d09[_0x8215('0x53')]=[{'all':!![]}];}_0x586d09=_[_0x8215('0x50')]({},_0x586d09,_0x892e7d['options']);return db['ChatGroup'][_0x8215('0x57')](_0x586d09)[_0x8215('0x24')](handleEntityNotFound(_0x11e6b4,null))[_0x8215('0x24')](respondWithResult(_0x11e6b4,null))[_0x8215('0x2e')](handleError(_0x11e6b4,null));};exports['create']=function(_0xa62ac9,_0x40e45b){return db['ChatGroup'][_0x8215('0x58')](_0xa62ac9['body'],{})['then'](respondWithResult(_0x40e45b,0xc9))[_0x8215('0x2e')](handleError(_0x40e45b,null));};exports[_0x8215('0x59')]=function(_0x4d5149,_0xd08e23){if(_0x4d5149['body']['id']){delete _0x4d5149['body']['id'];}return db[_0x8215('0x3e')]['find']({'where':{'id':_0x4d5149['params']['id']}})[_0x8215('0x24')](handleEntityNotFound(_0xd08e23,null))['then'](saveUpdates(_0x4d5149[_0x8215('0x5a')],null))['then'](respondWithResult(_0xd08e23,null))[_0x8215('0x2e')](handleError(_0xd08e23,null));};exports['destroy']=function(_0x3a8064,_0x178fda){return db[_0x8215('0x3e')][_0x8215('0x57')]({'where':{'id':_0x3a8064[_0x8215('0x5b')]['id']}})[_0x8215('0x24')](handleEntityNotFound(_0x178fda,null))[_0x8215('0x24')](removeEntity(_0x178fda,null))[_0x8215('0x2e')](handleError(_0x178fda,null));};exports['describe']=function(_0x5359da,_0x89f9ec){return db['ChatGroup'][_0x8215('0x5c')]()[_0x8215('0x24')](respondWithResult(_0x89f9ec,null))['catch'](handleError(_0x89f9ec,null));};exports[_0x8215('0x5d')]=function(_0x38060e,_0x5bc384,_0x352c69){return db[_0x8215('0x5e')][_0x8215('0x31')]({'where':{'ChatGroupId':_0x38060e['params']['id'],'ToId':_0x38060e[_0x8215('0x5f')]['id'],'read':![]}})[_0x8215('0x24')](function(_0x3f27f8){return{'id':_['toInteger'](_0x38060e[_0x8215('0x5b')]['id']),'count':_0x3f27f8};})['then'](respondWithResult(_0x5bc384,null))[_0x8215('0x2e')](handleError(_0x5bc384,null));};exports['addMembers']=function(_0x2e520d,_0x3d29f2,_0x8bd62b){return db[_0x8215('0x3e')]['find']({'where':{'id':_0x2e520d[_0x8215('0x5b')]['id']}})[_0x8215('0x24')](handleEntityNotFound(_0x3d29f2,null))['then'](function(_0x30eec5){if(_0x30eec5){return _0x30eec5['addMembers'](_0x2e520d[_0x8215('0x5a')]['ids'],_[_0x8215('0x60')](_0x2e520d[_0x8215('0x5a')],[_0x8215('0x61'),'id'])||{});}})[_0x8215('0x24')](respondWithResult(_0x3d29f2,null))[_0x8215('0x2e')](handleError(_0x3d29f2,null));};exports['getMembers']=function(_0x4ed718,_0x4a82a5,_0x4508f7){var _0x970795={};var _0x3291ec={};var _0x6027d4;var _0x35362e;return db[_0x8215('0x3e')][_0x8215('0x62')]({'where':{'id':_0x4ed718[_0x8215('0x5b')]['id']}})[_0x8215('0x24')](handleEntityNotFound(_0x4a82a5,null))['then'](function(_0x1fb183){if(_0x1fb183){_0x6027d4=_0x1fb183;_0x3291ec['model']=_[_0x8215('0x44')](db[_0x8215('0x63')][_0x8215('0x3f')]);_0x3291ec[_0x8215('0x43')]=_[_0x8215('0x44')](_0x4ed718[_0x8215('0x43')]);_0x3291ec['filters']=_[_0x8215('0x48')](_0x3291ec[_0x8215('0x46')],_0x3291ec['query']);_0x970795[_0x8215('0x47')]=_['intersection'](_0x3291ec[_0x8215('0x46')],qs[_0x8215('0x56')](_0x4ed718[_0x8215('0x43')]['fields']));_0x970795[_0x8215('0x47')]=_0x970795[_0x8215('0x47')][_0x8215('0x49')]?_0x970795[_0x8215('0x47')]:_0x3291ec[_0x8215('0x46')];_0x970795[_0x8215('0x4c')]=qs['sort'](_0x4ed718['query']['sort']);_0x970795[_0x8215('0x4e')]=qs[_0x8215('0x45')](_[_0x8215('0x64')](_0x4ed718[_0x8215('0x43')],_0x3291ec['filters']));if(_0x4ed718['query']['filter']){_0x970795[_0x8215('0x4e')]=_['merge'](_0x970795['where'],{'$or':_[_0x8215('0x3d')](_0x970795[_0x8215('0x47')],function(_0x3028f4){var _0x27db92={};_0x27db92[_0x3028f4]={'$like':'%'+_0x4ed718['query'][_0x8215('0x4f')]+'%'};return _0x27db92;})});}_0x970795=_[_0x8215('0x50')]({},_0x970795,_0x4ed718[_0x8215('0x52')]);return _0x6027d4[_0x8215('0x65')](_0x970795);}})[_0x8215('0x24')](function(_0x2621d3){if(_0x2621d3){_0x35362e=_0x2621d3[_0x8215('0x49')];if(!_0x4ed718[_0x8215('0x43')][_0x8215('0x66')](_0x8215('0x4a'))){_0x970795[_0x8215('0x4b')]=qs[_0x8215('0x4b')](_0x4ed718[_0x8215('0x43')]['limit']);_0x970795[_0x8215('0x32')]=qs['offset'](_0x4ed718['query'][_0x8215('0x32')]);}return _0x6027d4[_0x8215('0x65')](_0x970795);}})[_0x8215('0x24')](function(_0x5d78e0){if(_0x5d78e0){return _0x5d78e0?{'count':_0x35362e,'rows':_0x5d78e0}:null;}})[_0x8215('0x24')](respondWithResult(_0x4a82a5,null))[_0x8215('0x2e')](handleError(_0x4a82a5,null));};exports[_0x8215('0x67')]=function(_0x1bf8b9,_0x2fe344,_0xe75e26){return db[_0x8215('0x3e')][_0x8215('0x57')]({'where':{'id':_0x1bf8b9[_0x8215('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2fe344,null))[_0x8215('0x24')](function(_0x1ff152){if(_0x1ff152){return _0x1ff152[_0x8215('0x67')](_0x1bf8b9[_0x8215('0x43')]['ids']);}})[_0x8215('0x24')](respondWithStatusCode(_0x2fe344,null))[_0x8215('0x2e')](handleError(_0x2fe344,null));};exports[_0x8215('0x68')]=function(_0x8755fa,_0x379328,_0x55121a){if(_0x8755fa[_0x8215('0x5a')]['id']){delete _0x8755fa[_0x8215('0x5a')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x8755fa[_0x8215('0x5b')]['id']}})[_0x8215('0x24')](handleEntityNotFound(_0x379328,null))[_0x8215('0x24')](function(_0x5340b7){if(_0x5340b7){_0x8755fa[_0x8215('0x5a')]['ChatGroupId']=_0x5340b7['id'];return db[_0x8215('0x5e')][_0x8215('0x58')](_0x8755fa['body']);}})[_0x8215('0x24')](respondWithResult(_0x379328,null))[_0x8215('0x2e')](handleError(_0x379328,null));};exports['getMessages']=function(_0x15e305,_0x4a05c4,_0x2bf2b4){var _0x12916c={};var _0x5392ee={};var _0x26296a;var _0x1406a6;return db['ChatGroup'][_0x8215('0x62')]({'where':{'id':_0x15e305[_0x8215('0x5b')]['id']}})[_0x8215('0x24')](handleEntityNotFound(_0x4a05c4,null))['then'](function(_0x54de52){if(_0x54de52){_0x26296a=_0x54de52;_0x5392ee[_0x8215('0x46')]=_[_0x8215('0x44')](db['ChatInternalMessage']['rawAttributes']);_0x5392ee['query']=_[_0x8215('0x44')](_0x15e305[_0x8215('0x43')]);_0x5392ee['filters']=_[_0x8215('0x48')](_0x5392ee[_0x8215('0x46')],_0x5392ee[_0x8215('0x43')]);_0x12916c['attributes']=_['intersection'](_0x5392ee['model'],qs[_0x8215('0x56')](_0x15e305[_0x8215('0x43')][_0x8215('0x56')]));_0x12916c[_0x8215('0x47')]=_0x12916c['attributes'][_0x8215('0x49')]?_0x12916c[_0x8215('0x47')]:_0x5392ee['model'];_0x12916c[_0x8215('0x4c')]=qs['sort'](_0x15e305[_0x8215('0x43')]['sort']);_0x12916c[_0x8215('0x4e')]=qs['filters'](_[_0x8215('0x64')](_0x15e305[_0x8215('0x43')],_0x5392ee[_0x8215('0x45')]));if(_0x15e305[_0x8215('0x43')][_0x8215('0x4f')]){_0x12916c[_0x8215('0x4e')]=_['merge'](_0x12916c[_0x8215('0x4e')],{'$or':_[_0x8215('0x3d')](_0x12916c[_0x8215('0x47')],function(_0x514503){var _0x21bd94={};_0x21bd94[_0x514503]={'$like':'%'+_0x15e305[_0x8215('0x43')][_0x8215('0x4f')]+'%'};return _0x21bd94;})});}if(_0x15e305['query'][_0x8215('0x69')]){var _0x5b058d=_0x15e305[_0x8215('0x43')]['$gte']['split'](',');var _0xd5bd9f={};_0xd5bd9f[_0x5b058d[0x0]]={'$gte':moment(_0x5b058d[0x1])[_0x8215('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x12916c[_0x8215('0x4e')]=_[_0x8215('0x50')](_0x12916c['where'],_0xd5bd9f);}_0x12916c=_[_0x8215('0x50')]({},_0x12916c,_0x15e305[_0x8215('0x52')]);return _0x26296a['getMessages'](_0x12916c);}})['then'](function(_0x46cba6){if(_0x46cba6){_0x1406a6=_0x46cba6[_0x8215('0x49')];if(!_0x15e305['query']['hasOwnProperty'](_0x8215('0x4a'))){_0x12916c['limit']=qs[_0x8215('0x4b')](_0x15e305[_0x8215('0x43')][_0x8215('0x4b')]);_0x12916c[_0x8215('0x32')]=qs[_0x8215('0x32')](_0x15e305[_0x8215('0x43')][_0x8215('0x32')]);}return _0x26296a[_0x8215('0x6b')](_0x12916c);}})[_0x8215('0x24')](function(_0x251f1f){if(_0x251f1f){return _0x251f1f?{'count':_0x1406a6,'rows':_0x251f1f}:null;}})['then'](respondWithResult(_0x4a05c4,null))['catch'](handleError(_0x4a05c4,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 4a1b6af..eb7fe7d 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','ChatGroup','setMaxListeners','save','remove','emit'];(function(_0xbfdd60,_0x543717){var _0x129e36=function(_0x15aba2){while(--_0x15aba2){_0xbfdd60['push'](_0xbfdd60['shift']());}};_0x129e36(++_0x543717);}(_0xb10b,0x12a));var _0xbb10=function(_0x27a591,_0x24c79b){_0x27a591=_0x27a591-0x0;var _0x2de723=_0xb10b[_0x27a591];return _0x2de723;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatGroupEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatGroupEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatGroup[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x4866bc,_0x445681){var _0x49a352=function(_0x1b43a1){while(--_0x1b43a1){_0x4866bc['push'](_0x4866bc['shift']());}};_0x49a352(++_0x445681);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2e5f8a,_0x6f3cf6){_0x2e5f8a=_0x2e5f8a-0x0;var _0xdbe311=_0x5f2f[_0x2e5f8a];return _0xdbe311;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatGroup=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatGroupEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatGroupEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatGroup[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index f9ba246..60d59db 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 _0xe944=['define','ChatGroup','chat_groups','lodash','api','request-promise','../../config/environment','./chatGroup.attributes','exports'];(function(_0x24e76f,_0x52166f){var _0x117a85=function(_0x44012a){while(--_0x44012a){_0x24e76f['push'](_0x24e76f['shift']());}};_0x117a85(++_0x52166f);}(_0xe944,0x174));var _0x4e94=function(_0x1e0a9d,_0x23581d){_0x1e0a9d=_0x1e0a9d-0x0;var _0x553a89=_0xe944[_0x1e0a9d];return _0x553a89;};'use strict';var _=require(_0x4e94('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4e94('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e94('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4e94('0x3'));var attributes=require(_0x4e94('0x4'));module[_0x4e94('0x5')]=function(_0xbb43ae,_0x4d00e5){return _0xbb43ae[_0x4e94('0x6')](_0x4e94('0x7'),attributes,{'tableName':_0x4e94('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06ae=['path','rimraf','../../config/environment','define','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xcbf03b,_0x2ddbfd){var _0x2384a6=function(_0x58a614){while(--_0x58a614){_0xcbf03b['push'](_0xcbf03b['shift']());}};_0x2384a6(++_0x2ddbfd);}(_0x06ae,0x16e));var _0xe06a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x06ae[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xe06a('0x0'));var logger=require(_0xe06a('0x1'))(_0xe06a('0x2'));var moment=require(_0xe06a('0x3'));var BPromise=require(_0xe06a('0x4'));var rp=require(_0xe06a('0x5'));var fs=require('fs');var path=require(_0xe06a('0x6'));var rimraf=require(_0xe06a('0x7'));var config=require(_0xe06a('0x8'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x50e6cf,_0x1df79f){return _0x50e6cf[_0xe06a('0x9')](_0xe06a('0xa'),attributes,{'tableName':_0xe06a('0xb'),'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 c195162..d329505 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 _0xedee=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x43c8b7,_0x114978){var _0x34c10e=function(_0x4a8f55){while(--_0x4a8f55){_0x43c8b7['push'](_0x43c8b7['shift']());}};_0x34c10e(++_0x114978);}(_0xedee,0x114));var _0xeede=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xedee[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xeede('0x0'));var util=require(_0xeede('0x1'));var moment=require(_0xeede('0x2'));var BPromise=require(_0xeede('0x3'));var rs=require(_0xeede('0x4'));var fs=require('fs');var Redis=require(_0xeede('0x5'));var db=require(_0xeede('0x6'))['db'];var utils=require(_0xeede('0x7'));var logger=require(_0xeede('0x8'))(_0xeede('0x9'));var config=require(_0xeede('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xeede('0xb')](config[_0xeede('0xc')],{'host':_0xeede('0xd'),'port':0x18eb});var socket=require(_0xeede('0xe'))(new Redis(config[_0xeede('0xc')]));require(_0xeede('0xf'))[_0xeede('0x10')](socket);function respondWithRpcPromise(_0x1934d0,_0x522d22,_0x5cc5cc){return new BPromise(function(_0x74ad87,_0x4c8b92){return client['request'](_0x1934d0,_0x5cc5cc)[_0xeede('0x11')](function(_0x1d5f80){logger[_0xeede('0x12')]('ChatGroup,\x20%s,\x20%s',_0x522d22,_0xeede('0x13'));logger[_0xeede('0x14')](_0xeede('0x15'),_0x522d22,_0xeede('0x13'),JSON[_0xeede('0x16')](_0x1d5f80));if(_0x1d5f80[_0xeede('0x17')]){if(_0x1d5f80['error']['code']===0x1f4){logger[_0xeede('0x17')](_0xeede('0x18'),_0x522d22,_0x1d5f80[_0xeede('0x17')][_0xeede('0x19')]);return _0x4c8b92(_0x1d5f80[_0xeede('0x17')][_0xeede('0x19')]);}logger[_0xeede('0x17')](_0xeede('0x18'),_0x522d22,_0x1d5f80['error'][_0xeede('0x19')]);return _0x74ad87(_0x1d5f80['error'][_0xeede('0x19')]);}else{logger[_0xeede('0x12')](_0xeede('0x18'),_0x522d22,_0xeede('0x13'));_0x74ad87(_0x1d5f80[_0xeede('0x1a')][_0xeede('0x19')]);}})[_0xeede('0x1b')](function(_0x2891f1){logger[_0xeede('0x17')](_0xeede('0x18'),_0x522d22,_0x2891f1);_0x4c8b92(_0x2891f1);});});} \ No newline at end of file +var _0x9731=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util'];(function(_0x3f01d0,_0x11b322){var _0x1ca2d7=function(_0x24e88b){while(--_0x24e88b){_0x3f01d0['push'](_0x3f01d0['shift']());}};_0x1ca2d7(++_0x11b322);}(_0x9731,0x8f));var _0x1973=function(_0x1723bf,_0x7b607b){_0x1723bf=_0x1723bf-0x0;var _0x4946b4=_0x9731[_0x1723bf];return _0x4946b4;};'use strict';var _=require(_0x1973('0x0'));var util=require(_0x1973('0x1'));var moment=require(_0x1973('0x2'));var BPromise=require(_0x1973('0x3'));var rs=require(_0x1973('0x4'));var fs=require('fs');var Redis=require(_0x1973('0x5'));var db=require(_0x1973('0x6'))['db'];var utils=require(_0x1973('0x7'));var logger=require(_0x1973('0x8'))(_0x1973('0x9'));var config=require(_0x1973('0xa'));var jayson=require(_0x1973('0xb'));var client=jayson[_0x1973('0xc')][_0x1973('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1973('0xe')],{'host':_0x1973('0xf'),'port':0x18eb});var socket=require(_0x1973('0x10'))(new Redis(config[_0x1973('0xe')]));require('./chatGroup.socket')[_0x1973('0x11')](socket);function respondWithRpcPromise(_0xe1db05,_0x53bb3f,_0x3d4359){return new BPromise(function(_0x2cc1ed,_0x3dfbca){return client[_0x1973('0x12')](_0xe1db05,_0x3d4359)['then'](function(_0x4e9f7f){logger['info'](_0x1973('0x13'),_0x53bb3f,_0x1973('0x14'));logger[_0x1973('0x15')](_0x1973('0x16'),_0x53bb3f,'request\x20sent',JSON[_0x1973('0x17')](_0x4e9f7f));if(_0x4e9f7f[_0x1973('0x18')]){if(_0x4e9f7f[_0x1973('0x18')]['code']===0x1f4){logger[_0x1973('0x18')]('ChatGroup,\x20%s,\x20%s',_0x53bb3f,_0x4e9f7f[_0x1973('0x18')][_0x1973('0x19')]);return _0x3dfbca(_0x4e9f7f[_0x1973('0x18')]['message']);}logger[_0x1973('0x18')](_0x1973('0x13'),_0x53bb3f,_0x4e9f7f[_0x1973('0x18')][_0x1973('0x19')]);return _0x2cc1ed(_0x4e9f7f[_0x1973('0x18')][_0x1973('0x19')]);}else{logger[_0x1973('0x1a')](_0x1973('0x13'),_0x53bb3f,_0x1973('0x14'));_0x2cc1ed(_0x4e9f7f[_0x1973('0x1b')][_0x1973('0x19')]);}})[_0x1973('0x1c')](function(_0x59e0dd){logger[_0x1973('0x18')]('ChatGroup,\x20%s,\x20%s',_0x53bb3f,_0x59e0dd);_0x3dfbca(_0x59e0dd);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index bc28959..da65d49 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 _0x5704=['save','remove','update','removeListener','register','chatGroup:'];(function(_0x3392d2,_0x582611){var _0xa4843e=function(_0x5c179a){while(--_0x5c179a){_0x3392d2['push'](_0x3392d2['shift']());}};_0xa4843e(++_0x582611);}(_0x5704,0x1ce));var _0x4570=function(_0x19f28e,_0x479808){_0x19f28e=_0x19f28e-0x0;var _0x5b609a=_0x5704[_0x19f28e];return _0x5b609a;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x4570('0x0'),_0x4570('0x1'),_0x4570('0x2')];function createListener(_0x279d2e,_0x1d3c8b){return function(_0x3c6379){_0x1d3c8b['emit'](_0x279d2e,_0x3c6379);};}function removeListener(_0x47775b,_0x1ef90b){return function(){ChatGroupEvents[_0x4570('0x3')](_0x47775b,_0x1ef90b);};}exports[_0x4570('0x4')]=function(_0x590ba7){for(var _0x41b934=0x0,_0x9c63c7=events['length'];_0x41b934<_0x9c63c7;_0x41b934++){var _0x4b8d0f=events[_0x41b934];var _0x539b0d=createListener(_0x4570('0x5')+_0x4b8d0f,_0x590ba7);ChatGroupEvents['on'](_0x4b8d0f,_0x539b0d);}}; \ No newline at end of file +var _0x5c0e=['emit','length','./chatGroup.events','save','remove','update'];(function(_0x36f82a,_0x4ec395){var _0x495067=function(_0x2ede56){while(--_0x2ede56){_0x36f82a['push'](_0x36f82a['shift']());}};_0x495067(++_0x4ec395);}(_0x5c0e,0x140));var _0xe5c0=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x5c0e[_0x467488];return _0x56107f;};'use strict';var ChatGroupEvents=require(_0xe5c0('0x0'));var events=[_0xe5c0('0x1'),_0xe5c0('0x2'),_0xe5c0('0x3')];function createListener(_0x45045a,_0x5ea398){return function(_0x574238){_0x5ea398[_0xe5c0('0x4')](_0x45045a,_0x574238);};}function removeListener(_0x46e1a7,_0x7fb7be){return function(){ChatGroupEvents['removeListener'](_0x46e1a7,_0x7fb7be);};}exports['register']=function(_0x61608a){for(var _0xb0b476=0x0,_0x37f7a7=events[_0xe5c0('0x5')];_0xb0b476<_0x37f7a7;_0xb0b476++){var _0x1d00dc=events[_0xb0b476];var _0x5b4908=createListener('chatGroup:'+_0x1d00dc,_0x61608a);ChatGroupEvents['on'](_0x1d00dc,_0x5b4908);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index afb574f..ca3d4b9 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 _0x79b0=['/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x37eef2,_0x5940ef){var _0x528b68=function(_0x3c7059){while(--_0x3c7059){_0x37eef2['push'](_0x37eef2['shift']());}};_0x528b68(++_0x5940ef);}(_0x79b0,0x100));var _0x079b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x79b0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x079b('0x0'));var path=require(_0x079b('0x1'));var timeout=require(_0x079b('0x2'));var express=require(_0x079b('0x3'));var router=express[_0x079b('0x4')]();var auth=require(_0x079b('0x5'));var interaction=require(_0x079b('0x6'));var config=require(_0x079b('0x7'));var controller=require(_0x079b('0x8'));router[_0x079b('0x9')]('/',auth[_0x079b('0xa')](),controller[_0x079b('0xb')]);router[_0x079b('0x9')](_0x079b('0xc'),auth[_0x079b('0xa')](),controller['describe']);router['get'](_0x079b('0xd'),auth[_0x079b('0xa')](),controller['show']);router[_0x079b('0x9')](_0x079b('0xe'),auth[_0x079b('0xa')](),controller[_0x079b('0xf')]);router['get'](_0x079b('0x10'),auth['isAuthenticated'](),controller[_0x079b('0x11')]);router[_0x079b('0x9')](_0x079b('0x12'),auth[_0x079b('0xa')](),controller[_0x079b('0x13')]);router[_0x079b('0x14')]('/',auth[_0x079b('0xa')](),controller[_0x079b('0x15')]);router['post'](_0x079b('0x10'),auth[_0x079b('0xa')](),controller[_0x079b('0x16')]);router[_0x079b('0x14')]('/:id/messages',auth[_0x079b('0xa')](),controller[_0x079b('0x17')]);router[_0x079b('0x18')](_0x079b('0xd'),auth[_0x079b('0xa')](),controller[_0x079b('0x19')]);router[_0x079b('0x1a')](_0x079b('0xd'),auth[_0x079b('0xa')](),controller[_0x079b('0x1b')]);router[_0x079b('0x1a')](_0x079b('0x10'),auth[_0x079b('0xa')](),controller[_0x079b('0x1c')]);module[_0x079b('0x1d')]=router; \ No newline at end of file +var _0x1e3d=['/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','update','delete','destroy','removeMembers','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','/:id','show','/:id/unread','getUnread'];(function(_0x47ea80,_0x48bba8){var _0x4a2d71=function(_0x55a8b0){while(--_0x55a8b0){_0x47ea80['push'](_0x47ea80['shift']());}};_0x4a2d71(++_0x48bba8);}(_0x1e3d,0x1cb));var _0xd1e3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1e3d[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xd1e3('0x0'));var util=require(_0xd1e3('0x1'));var path=require(_0xd1e3('0x2'));var timeout=require(_0xd1e3('0x3'));var express=require(_0xd1e3('0x4'));var router=express[_0xd1e3('0x5')]();var auth=require(_0xd1e3('0x6'));var interaction=require(_0xd1e3('0x7'));var config=require(_0xd1e3('0x8'));var controller=require(_0xd1e3('0x9'));router[_0xd1e3('0xa')]('/',auth[_0xd1e3('0xb')](),controller['index']);router[_0xd1e3('0xa')](_0xd1e3('0xc'),auth[_0xd1e3('0xb')](),controller['describe']);router[_0xd1e3('0xa')](_0xd1e3('0xd'),auth[_0xd1e3('0xb')](),controller[_0xd1e3('0xe')]);router['get'](_0xd1e3('0xf'),auth['isAuthenticated'](),controller[_0xd1e3('0x10')]);router[_0xd1e3('0xa')](_0xd1e3('0x11'),auth['isAuthenticated'](),controller[_0xd1e3('0x12')]);router[_0xd1e3('0xa')](_0xd1e3('0x13'),auth['isAuthenticated'](),controller[_0xd1e3('0x14')]);router['post']('/',auth[_0xd1e3('0xb')](),controller['create']);router[_0xd1e3('0x15')](_0xd1e3('0x11'),auth[_0xd1e3('0xb')](),controller[_0xd1e3('0x16')]);router[_0xd1e3('0x15')](_0xd1e3('0x13'),auth['isAuthenticated'](),controller[_0xd1e3('0x17')]);router['put'](_0xd1e3('0xd'),auth[_0xd1e3('0xb')](),controller[_0xd1e3('0x18')]);router[_0xd1e3('0x19')](_0xd1e3('0xd'),auth[_0xd1e3('0xb')](),controller[_0xd1e3('0x1a')]);router[_0xd1e3('0x19')](_0xd1e3('0x11'),auth[_0xd1e3('0xb')](),controller[_0xd1e3('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index ef65f98..294ee6a 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 _0xa92c=['INTEGER','star','thumb','TEXT','STRING','DATE','long','out','sequelize','exports','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa92c,0x1e1));var _0xca92=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0xa92c[_0x31eb67];return _0x2a8cb8;};'use strict';var Sequelize=require(_0xca92('0x0'));module[_0xca92('0x1')]={'closed':{'type':Sequelize[_0xca92('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xca92('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0xca92('0x4'),_0xca92('0x5')),'defaultValue':_0xca92('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xca92('0x6')]},'mailTranscript':{'type':Sequelize[_0xca92('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xca92('0x8')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xca92('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xca92('0x7')]},'osName':{'type':Sequelize[_0xca92('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xca92('0x7')]},'deviceVendor':{'type':Sequelize[_0xca92('0x7')]},'deviceType':{'type':Sequelize[_0xca92('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xca92('0x7')]},'formData':{'type':Sequelize['TEXT'](_0xca92('0x9'))},'read1stAt':{'type':Sequelize[_0xca92('0x8')]},'lastMsgAt':{'type':Sequelize[_0xca92('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xca92('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xca92('0x7')]},'customerPort':{'type':Sequelize[_0xca92('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xca92('0x6')]}}; \ No newline at end of file +var _0xd876=['exports','INTEGER','ENUM','star','thumb','DATE','STRING','TEXT','long','out'];(function(_0x483539,_0x4771b7){var _0x546f3f=function(_0x507c07){while(--_0x507c07){_0x483539['push'](_0x483539['shift']());}};_0x546f3f(++_0x4771b7);}(_0xd876,0x1cc));var _0x6d87=function(_0x1f8a39,_0xac239b){_0x1f8a39=_0x1f8a39-0x0;var _0x301bdf=_0xd876[_0x1f8a39];return _0x301bdf;};'use strict';var Sequelize=require('sequelize');module[_0x6d87('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6d87('0x1')]},'ratingType':{'type':Sequelize[_0x6d87('0x2')](_0x6d87('0x3'),_0x6d87('0x4')),'defaultValue':_0x6d87('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6d87('0x5')]},'disposition':{'type':Sequelize[_0x6d87('0x6')]},'note':{'type':Sequelize[_0x6d87('0x6')]},'browserName':{'type':Sequelize[_0x6d87('0x6')]},'browserVersion':{'type':Sequelize[_0x6d87('0x6')]},'osName':{'type':Sequelize[_0x6d87('0x6')]},'osVersion':{'type':Sequelize[_0x6d87('0x6')]},'deviceModel':{'type':Sequelize[_0x6d87('0x6')]},'deviceVendor':{'type':Sequelize[_0x6d87('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x6d87('0x7')]},'customerIp':{'type':Sequelize[_0x6d87('0x6')]},'formData':{'type':Sequelize[_0x6d87('0x7')](_0x6d87('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x6d87('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x6d87('0x2')]('in',_0x6d87('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6d87('0x6')]},'customerPort':{'type':Sequelize[_0x6d87('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x6d87('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 9ab85a5..db76d1e 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 _0x4888=['follow','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','attachId','join','root','server/files/attachments/','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','agentAlias','System','%s%d','agentIdentifier','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','omit','getMessages','nolimit','pick','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','addTags','ids','spread','color','emit','chatInteractionTags:save','removeTags','download','unix','server','tmp','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Account','Owner','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','YYYY-MM-DD','closedAt','browserName','osName','referer','customerIp','customerPort','N.A.','existsSync','createReadStream','createWriteStream','renderFile','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','register','http','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','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatInteraction,\x20%s,\x20%s','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','fullname','TagIds','split','forEach','Tags','push','index','ChatInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','select','field','from','tools_tags','u.id','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','length','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','text','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','rawAttributes','includeAll','include','options','create','body','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','vidaooApiKey','MotionCWB:'];(function(_0x1a3cc7,_0x2900e3){var _0x338438=function(_0x5a4872){while(--_0x5a4872){_0x1a3cc7['push'](_0x1a3cc7['shift']());}};_0x338438(++_0x2900e3);}(_0x4888,0x198));var _0x8488=function(_0x4c0ebb,_0x1e7eae){_0x4c0ebb=_0x4c0ebb-0x0;var _0xfc4dc1=_0x4888[_0x4c0ebb];return _0xfc4dc1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8488('0x0'));var rimraf=require(_0x8488('0x1'));var zipdir=require(_0x8488('0x2'));var jsonpatch=require(_0x8488('0x3'));var rp=require(_0x8488('0x4'));var moment=require(_0x8488('0x5'));var BPromise=require(_0x8488('0x6'));var Mustache=require('mustache');var util=require(_0x8488('0x7'));var path=require(_0x8488('0x8'));var sox=require(_0x8488('0x9'));var csv=require(_0x8488('0xa'));var ejs=require(_0x8488('0xb'));var fs=require('fs');var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0xa'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var db=require(_0x8488('0x16'))['db'];config['redis']=_[_0x8488('0x17')](config[_0x8488('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8488('0x18')]));require('./chatInteraction.socket')[_0x8488('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8488('0x1a')]({'port':0x232b});var client9004=jayson[_0x8488('0x1b')][_0x8488('0x1a')]({'port':0x232c});function checkPasswordPattern(_0x2bcb7c,_0x3b3cfa,_0x8d3b3d){if(_0x8d3b3d){var _0x165139=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x165139['test'](_0x3b3cfa)){return _0x2bcb7c;}else{throw new db[(_0x8488('0x1c'))][(_0x8488('0x1d'))](_0x8488('0x1e'));}}else{return _0x2bcb7c;}}function respondWithRpcPromise(_0x37361d,_0x60ae2f,_0x39775f,_0x1aedb1){return new BPromise(function(_0x27c62a,_0x514c31){var _0x1de64a=_0x1aedb1||client;return _0x1de64a[_0x8488('0x1f')](_0x37361d,_0x39775f)[_0x8488('0x20')](function(_0x3dd93e){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x60ae2f,_0x8488('0x21'));logger[_0x8488('0x22')](_0x8488('0x23'),_0x60ae2f,_0x8488('0x21'),JSON[_0x8488('0x24')](_0x3dd93e));if(_0x3dd93e[_0x8488('0x25')]){if(_0x3dd93e[_0x8488('0x25')][_0x8488('0x26')]===0x1f4){logger[_0x8488('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x60ae2f,_0x3dd93e[_0x8488('0x25')][_0x8488('0x27')]);return _0x514c31(_0x3dd93e[_0x8488('0x25')][_0x8488('0x27')]);}logger[_0x8488('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x60ae2f,_0x3dd93e['error']['message']);return _0x27c62a(_0x3dd93e['error'][_0x8488('0x27')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x60ae2f,_0x8488('0x21'));_0x27c62a(_0x3dd93e[_0x8488('0x28')][_0x8488('0x27')]);}})[_0x8488('0x29')](function(_0x287662){logger['error'](_0x8488('0x2a'),_0x60ae2f,_0x287662);_0x514c31(_0x287662);});});}function respondWithStatusCode(_0x38c137,_0xf9720e){_0xf9720e=_0xf9720e||0xcc;return function(_0x3df1f9){if(_0x3df1f9){return _0x38c137[_0x8488('0x2b')](_0xf9720e);}return _0x38c137[_0x8488('0x2c')](_0xf9720e)[_0x8488('0x2d')]();};}function respondWithResult(_0x296b6c,_0x368f9c){_0x368f9c=_0x368f9c||0xc8;return function(_0x1d9317){if(_0x1d9317){return _0x296b6c[_0x8488('0x2c')](_0x368f9c)['json'](_0x1d9317);}};}function respondWithFilteredResult(_0x57ce3c,_0x4e3fe2){return function(_0x292fe8){if(_0x292fe8){var _0x408c36=_0x292fe8[_0x8488('0x2e')],_0x19cf42=_0x4e3fe2['offset'],_0x121dcc=_0x4e3fe2[_0x8488('0x2f')]+_0x4e3fe2[_0x8488('0x30')],_0x117321;if(_0x121dcc>=_0x408c36){_0x121dcc=_0x408c36;_0x117321=0xc8;}else{_0x117321=0xce;}_0x57ce3c[_0x8488('0x2c')](_0x117321);return _0x57ce3c[_0x8488('0x31')](_0x8488('0x32'),_0x19cf42+'-'+_0x121dcc+'/'+_0x408c36)['json'](_0x292fe8);}return null;};}function patchUpdates(_0x46c95b){return function(_0x23f67a){try{jsonpatch['apply'](_0x23f67a,_0x46c95b,!![]);}catch(_0x1b0637){return BPromise[_0x8488('0x33')](_0x1b0637);}return _0x23f67a[_0x8488('0x34')]();};}function saveUpdates(_0x446f90,_0x4555d0){return function(_0x484a0e){if(_0x484a0e){return _0x484a0e[_0x8488('0x35')](_0x446f90)[_0x8488('0x20')](function(_0x3f3861){return _0x3f3861;});}return null;};}function removeEntity(_0x584965,_0x17ca2f){return function(_0x5bc335){if(_0x5bc335){return _0x5bc335[_0x8488('0x36')]()[_0x8488('0x20')](function(){_0x584965[_0x8488('0x2c')](0xcc)[_0x8488('0x2d')]();});}};}function handleEntityNotFound(_0x4c3b59,_0x1bb256){return function(_0xe71bd9){if(!_0xe71bd9){_0x4c3b59[_0x8488('0x2b')](0x194);}return _0xe71bd9;};}function handleError(_0x583ece,_0x3920d1){_0x3920d1=_0x3920d1||0x1f4;return function(_0x17bfea){logger[_0x8488('0x25')](_0x17bfea[_0x8488('0x37')]);if(_0x17bfea[_0x8488('0x38')]){delete _0x17bfea[_0x8488('0x38')];}_0x583ece[_0x8488('0x2c')](_0x3920d1)[_0x8488('0x39')](_0x17bfea);};}function getInteractionUsers(_0x1a8235,_0x2171dc){return new BPromise(function(_0x3b6d07,_0x4cb675){try{if(_0x2171dc[_0x1a8235['id']]){_0x1a8235['Users']=_[_0x8488('0x3a')](_0x2171dc[_0x1a8235['id']],function(_0x36c17a){return{'id':_0x36c17a['id'],'fullname':_0x36c17a[_0x8488('0x3b')]};});}}catch(_0x390a17){_0x4cb675(_0x390a17);}_0x3b6d07(_0x1a8235);});}function getInteractionTags(_0x2d9fa1,_0x910460){return new BPromise(function(_0x13c260,_0x4481df){try{if(_0x2d9fa1[_0x8488('0x3c')]){_0x2d9fa1['Tags']=[];_0x2d9fa1[_0x8488('0x3c')][_0x8488('0x3d')](',')[_0x8488('0x3e')](function(_0x520e82){_0x2d9fa1[_0x8488('0x3f')][_0x8488('0x40')](_0x910460[_0x520e82]);});}delete _0x2d9fa1[_0x8488('0x3c')];}catch(_0x28bc84){_0x4481df(_0x28bc84);}_0x13c260(_0x2d9fa1);});}function updateChatInteraction(_0x44d5f2,_0x156246,_0x1aac4b){return new BPromise(function(_0x496ea0,_0x45db70){return getInteractionUsers(_0x44d5f2,_0x1aac4b)[_0x8488('0x20')](function(_0x891cff){return getInteractionTags(_0x891cff,_0x156246);})['then'](function(_0x3649ae){_0x496ea0(_0x3649ae);})['catch'](function(_0x40ee7e){_0x45db70(_0x40ee7e);});});}exports[_0x8488('0x41')]=function(_0x5cbd11,_0x22a3f3){var _0x4023ac={},_0x10cc1f={},_0x25ef13={'count':0x0,'rows':[]};var _0x2158b2=_['map'](db[_0x8488('0x42')]['rawAttributes'],function(_0x3440ae){return{'name':_0x3440ae[_0x8488('0x43')],'type':_0x3440ae[_0x8488('0x44')][_0x8488('0x45')]};});_0x10cc1f[_0x8488('0x46')]=_[_0x8488('0x3a')](_0x2158b2,_0x8488('0x38'));_0x10cc1f[_0x8488('0x47')]=_[_0x8488('0x48')](_0x5cbd11[_0x8488('0x47')]);_0x10cc1f[_0x8488('0x49')]=_[_0x8488('0x4a')](_0x10cc1f[_0x8488('0x46')],_0x10cc1f[_0x8488('0x47')]);_0x4023ac[_0x8488('0x4b')]=_[_0x8488('0x4a')](_0x10cc1f[_0x8488('0x46')],qs['fields'](_0x5cbd11[_0x8488('0x47')][_0x8488('0x4c')]));_0x4023ac[_0x8488('0x4b')]=_0x4023ac[_0x8488('0x4b')]['length']?_0x4023ac[_0x8488('0x4b')]:_0x10cc1f[_0x8488('0x46')];if(!_0x5cbd11[_0x8488('0x47')][_0x8488('0x4d')]('nolimit')){_0x4023ac[_0x8488('0x30')]=qs[_0x8488('0x30')](_0x5cbd11[_0x8488('0x47')][_0x8488('0x30')]);_0x4023ac[_0x8488('0x2f')]=qs[_0x8488('0x2f')](_0x5cbd11[_0x8488('0x47')][_0x8488('0x2f')]);}_0x4023ac[_0x8488('0x4e')]=qs[_0x8488('0x4f')](_0x5cbd11[_0x8488('0x47')][_0x8488('0x4f')]);_0x4023ac[_0x8488('0x50')]=qs['filters'](_['pick'](_0x5cbd11[_0x8488('0x47')],_0x10cc1f[_0x8488('0x49')]),_0x2158b2);var _0x3749da=[];var _0x45bd4b=squel[_0x8488('0x51')]()[_0x8488('0x52')]('id')[_0x8488('0x52')](_0x8488('0x38'))[_0x8488('0x52')]('color')[_0x8488('0x53')](_0x8488('0x54'));var _0x51d1eb=squel[_0x8488('0x51')]()[_0x8488('0x52')](_0x8488('0x55'))[_0x8488('0x52')]('u.fullname')[_0x8488('0x52')](_0x8488('0x56'))[_0x8488('0x53')]('user_has_chat_interactions','ui')[_0x8488('0x57')](_0x8488('0x58'),'u',_0x8488('0x59'));var _0x3eb06e=squel['select']()[_0x8488('0x53')]('chat_interactions','i')['left_join'](_0x8488('0x5a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x8488('0x57')](_0x8488('0x58'),'o',_0x8488('0x5b'))[_0x8488('0x57')](_0x8488('0x5c'),'a',_0x8488('0x5d'))['left_join'](_0x8488('0x5e'),'me',_0x8488('0x5f'))[_0x8488('0x57')](_0x8488('0x60'),'it',_0x8488('0x61'))['left_join'](_0x8488('0x54'),'t','t.id\x20=\x20it.TagId');var _0x137f50=squel[_0x8488('0x62')]();var _0x5da71e=[];var _0x342188=squel[_0x8488('0x62')]();var _0x304ceb;if(_0x5cbd11[_0x8488('0x47')][_0x8488('0x63')]){_0x304ceb=as[_0x8488('0x64')](_0x5cbd11['query'][_0x8488('0x63')]);var _0x568da7=_0x304ceb[_0x8488('0x65')];for(var _0x3fa6e2=0x0;_0x3fa6e2<_0x304ceb[_0x8488('0x66')][_0x8488('0x67')];_0x3fa6e2++){var _0x38cfa5=_0x304ceb[_0x8488('0x66')][_0x3fa6e2];var _0x5a4426='i';var _0x43ec52=_['find'](_0x2158b2,[_0x8488('0x38'),_0x38cfa5[_0x8488('0x52')]]);if(!_0x43ec52){switch(_0x38cfa5[_0x8488('0x52')]){case _0x8488('0x68'):if(_0x38cfa5[_0x8488('0x69')]==0x1){_0x3eb06e[_0x8488('0x6a')]('`'+_0x38cfa5['field']+'`\x20=\x200');}else{_0x3eb06e['having']('`'+_0x38cfa5[_0x8488('0x52')]+_0x8488('0x6b'));}break;case _0x8488('0x6c'):if(_0x38cfa5[_0x8488('0x6d')]===_0x8488('0x6e')){if(_0x38cfa5[_0x8488('0x69')][_0x8488('0x3d')]('\x20')[_0x8488('0x67')]>0x1){_0x137f50[_0x568da7](_0x8488('0x6f'),qs[_0x8488('0x70')](_0x38cfa5['value']),null);}else{var _0x1f7e98='%'+_0x38cfa5[_0x8488('0x69')]+'%';_0x137f50[_0x568da7](_0x8488('0x71'),_0x1f7e98,_0x1f7e98,_0x1f7e98);}}else{_0x43ec52=_['find'](_0x2158b2,['name',_0x8488('0x72')]);_0x38cfa5[_0x8488('0x52')]=_0x8488('0x72');_0x1a3988=as[_0x8488('0x73')](_0x5a4426,_0x43ec52['type'],_0x38cfa5);_0x137f50[_0x568da7](_0x1a3988['text'],_0x1a3988[_0x8488('0x69')][_0x8488('0x74')],_0x1a3988[_0x8488('0x69')]['end']);}break;case _0x8488('0x75'):var _0x401f4d=_0x38cfa5[_0x8488('0x69')][_0x8488('0x3d')](',')[_0x8488('0x3a')](function(_0x5e41e5){return Number(_0x5e41e5);});_0x401f4d[_0x8488('0x3e')](function(_0x3babee){_0x342188['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3babee+',%');});_0x5da71e=_[_0x8488('0x76')](_0x5da71e,_0x401f4d);break;case _0x8488('0x77'):if(_0x38cfa5['operator']===_0x8488('0x6e')){_0x137f50[_0x568da7](_0x8488('0x78'),'%'+_0x38cfa5[_0x8488('0x69')]+'%',null);}else{_0x43ec52=_[_0x8488('0x79')](_0x2158b2,[_0x8488('0x38'),_0x8488('0x7a')]);_0x38cfa5[_0x8488('0x52')]='UserId';_0x1a3988=as[_0x8488('0x73')](_0x5a4426,_0x43ec52[_0x8488('0x44')],_0x38cfa5);_0x137f50[_0x568da7](_0x1a3988['text'],_0x1a3988['value'][_0x8488('0x74')],_0x1a3988[_0x8488('0x69')][_0x8488('0x2d')]);}break;case'body':_0x1a3988=as[_0x8488('0x73')]('me',null,_0x38cfa5);_0x137f50[_0x568da7](_0x1a3988[_0x8488('0x7b')],_0x1a3988['value'][_0x8488('0x74')],_0x1a3988['value'][_0x8488('0x2d')]);break;}}else{var _0x1a3988=as[_0x8488('0x73')](_0x5a4426,_0x43ec52['type'],_0x38cfa5);_0x137f50[_0x568da7](_0x1a3988[_0x8488('0x7b')],_0x1a3988[_0x8488('0x69')]['start'],_0x1a3988['value'][_0x8488('0x2d')]);}}}else{var _0x21a42e=_(_0x5cbd11[_0x8488('0x47')])[_0x8488('0x48')]()[_0x8488('0x3a')](function(_0x2fb435){return _[_0x8488('0x7c')](_0x2158b2,[_0x8488('0x38'),_0x2fb435])?_0x2fb435:undefined;})[_0x8488('0x7d')]()[_0x8488('0x69')]();if(!_['isEmpty'](_0x21a42e)){_0x21a42e[_0x8488('0x3e')](function(_0x5c0599){if(_0x5c0599===_0x8488('0x7e')){_0x3eb06e[_0x8488('0x50')](_0x8488('0x7f'),[][_0x8488('0x80')](_0x5cbd11['query'][_0x5c0599]));}else if(_0x5c0599===_0x8488('0x81')){var _0x15ee3a=JSON['parse'](_0x5cbd11[_0x8488('0x47')][_0x5c0599])['$gte'];var _0x26241b=JSON[_0x8488('0x82')](_0x5cbd11[_0x8488('0x47')][_0x5c0599])[_0x8488('0x83')];_0x3eb06e[_0x8488('0x50')](_0x8488('0x84'),_0x15ee3a,_0x26241b);}else{if(_0x5cbd11[_0x8488('0x47')][_0x5c0599]===_0x8488('0x85')){_0x3eb06e['where']('i.'+_0x5c0599+_0x8488('0x86'));}else{_0x3eb06e['where']('i.'+_0x5c0599+'\x20=\x20?',_0x5cbd11[_0x8488('0x47')][_0x5c0599]);}}});}if(_0x5cbd11[_0x8488('0x47')][_0x8488('0x87')]){if(_0x5cbd11['query']['read']==0x1){_0x3eb06e[_0x8488('0x6a')](_0x8488('0x88'));}else{_0x3eb06e['having'](_0x8488('0x89'));}}if(_0x5cbd11[_0x8488('0x47')][_0x8488('0x8a')]){_0x5da71e=_[_0x8488('0x8b')](_0x5cbd11[_0x8488('0x47')][_0x8488('0x8a')])?_0x5cbd11['query'][_0x8488('0x8a')]:new Array(_0x5cbd11[_0x8488('0x47')][_0x8488('0x8a')]);_0x5da71e['forEach'](function(_0x1cfe70){_0x342188['or'](_0x8488('0x8c'),'%,'+_0x1cfe70+',%');});}if(_0x5cbd11[_0x8488('0x47')]['filter']){var _0x28468b=_0x5cbd11[_0x8488('0x47')]['filter']['replace']('\x5c','\x5c\x5c')[_0x8488('0x8d')]('\x27\x27',_0x8488('0x8e'));if(qs['isNumeric'](_0x28468b)){_0x137f50['or'](_0x8488('0x8f'),_0x28468b+'%');}else{_0x137f50['or'](_0x8488('0x90'),qs['getFullTextValue'](_0x28468b))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x28468b+'%');}}}_0x3eb06e[_0x8488('0x50')](_0x137f50);_0x3eb06e['group'](_0x8488('0x91'));var _0x202d16={'type':db[_0x8488('0x1c')][_0x8488('0x92')]['SELECT'],'raw':!![]};var _0xde3227=_0x3eb06e['clone']();_0xde3227[_0x8488('0x52')]('i.id');_0xde3227[_0x8488('0x52')](_0x8488('0x93'),_0x8488('0x68'));if(_0x4023ac[_0x8488('0x4e')]){_0x4023ac[_0x8488('0x4e')][_0x8488('0x3e')](function(_0x784d23){_0x3eb06e[_0x8488('0x4e')]('i.'+_0x784d23[0x0],_0x784d23[0x1]===_0x8488('0x94')?![]:!![]);});}if(!_[_0x8488('0x95')](_0x5da71e)){_0x3eb06e[_0x8488('0x6a')](_0x342188);_0xde3227[_0x8488('0x50')](_0x8488('0x96'),_0x5da71e);}BPromise[_0x8488('0x97')]()['then'](function(){if(!_0x304ceb){if(_0x5cbd11[_0x8488('0x47')][_0x8488('0x7e')]||_0x5cbd11['query'][_0x8488('0x98')])return;_0xde3227[_0x8488('0x50')](_0x8488('0x99'));_0x3eb06e[_0x8488('0x50')](_0x8488('0x99'));return;}return _0x5cbd11[_0x8488('0x9a')][_0x8488('0x9b')]({'attributes':['id'],'raw':!![]})[_0x8488('0x20')](function(_0x8682a5){if(_[_0x8488('0x95')](_0x8682a5)){_0xde3227[_0x8488('0x50')]('i.ChatWebsiteId\x20IS\x20NULL');_0x3eb06e[_0x8488('0x50')](_0x8488('0x9c'));}else{_0xde3227['where'](_0x8488('0x7f'),_[_0x8488('0x3a')](_0x8682a5,'id'));_0x3eb06e[_0x8488('0x50')](_0x8488('0x7f'),_[_0x8488('0x3a')](_0x8682a5,'id'));}});})['then'](function(){db['sequelize'][_0x8488('0x47')](_0xde3227[_0x8488('0x9d')](),_0x202d16)[_0x8488('0x20')](function(_0x244a2b){_0x25ef13[_0x8488('0x2e')]=_0x244a2b[_0x8488('0x67')];if(_0x25ef13[_0x8488('0x2e')]===0x0)return[];return db[_0x8488('0x9e')][_0x8488('0x47')](_0x45bd4b[_0x8488('0x9d')](),_0x202d16)[_0x8488('0x20')](function(_0xb045bc){_0x3749da=_[_0x8488('0x9f')](_0xb045bc,'id');_0x202d16=_[_0x8488('0xa0')](_0x202d16,{'model':db[_0x8488('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5cbd11['query'][_0x8488('0x4c')]){_0x4023ac['attributes']['forEach'](function(_0x1e25a3){_0x3eb06e[_0x8488('0x52')]('i.'+_0x1e25a3);});}else{_0x3eb06e[_0x8488('0x52')](_0x8488('0x93'),_0x8488('0x68'));_0x3eb06e[_0x8488('0x52')](_0x8488('0xa1'),_0x8488('0xa2'));_0x3eb06e[_0x8488('0x52')](_0x8488('0xa3'),'Account.mandatoryDisposition');_0x3eb06e[_0x8488('0x52')](_0x8488('0xa4'));_0x3eb06e[_0x8488('0x52')](_0x8488('0xa5'),_0x8488('0xa6'));_0x3eb06e[_0x8488('0x52')]('c.lastName',_0x8488('0xa7'));_0x3eb06e['field'](_0x8488('0xa8'),_0x8488('0xa9'));_0x3eb06e['field']('c.phone',_0x8488('0xaa'));_0x3eb06e[_0x8488('0x52')](_0x8488('0xab'),_0x8488('0xac'));_0x3eb06e[_0x8488('0x52')]('c.fax',_0x8488('0xad'));_0x3eb06e[_0x8488('0x52')]('o.fullname','Owner.fullname');_0x3eb06e[_0x8488('0x52')](_0x8488('0xae'),_0x8488('0xaf'));_0x3eb06e['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8488('0x3c'));}if(_0x4023ac[_0x8488('0x30')])_0x3eb06e[_0x8488('0x30')](_0x4023ac['limit']);if(_0x4023ac[_0x8488('0x2f')])_0x3eb06e[_0x8488('0x2f')](_0x4023ac[_0x8488('0x2f')]);return db[_0x8488('0x9e')][_0x8488('0x47')](_0x3eb06e[_0x8488('0x9d')](),_0x202d16);})[_0x8488('0x20')](function(_0x1c8f5d){_0x51d1eb[_0x8488('0x50')](_0x8488('0xb0'),_[_0x8488('0x3a')](_0x1c8f5d,'id'));return db[_0x8488('0x9e')][_0x8488('0x47')](_0x51d1eb['toString'](),_0x202d16)[_0x8488('0x20')](function(_0x1445c7){var _0x248175=_['groupBy'](_0x1445c7,_0x8488('0xb1'));var _0x546a25=[];_0x1c8f5d[_0x8488('0x3e')](function(_0x52fe9f){_0x546a25['push'](updateChatInteraction(_0x52fe9f,_0x3749da,_0x248175));});return BPromise[_0x8488('0xb2')](_0x546a25);});});})['then'](function(_0x42f36b){_0x25ef13[_0x8488('0xb3')]=_0x42f36b;return _0x25ef13;})[_0x8488('0x20')](respondWithFilteredResult(_0x22a3f3,_0x4023ac));})[_0x8488('0x29')](handleError(_0x22a3f3,null));};exports['show']=function(_0x391e86,_0x450afa){var _0x477a86={'raw':![],'where':{'id':_0x391e86['params']['id']}},_0x37ca73={};_0x37ca73[_0x8488('0x46')]=_[_0x8488('0x48')](db[_0x8488('0x42')][_0x8488('0xb4')]);_0x37ca73[_0x8488('0x47')]=_['keys'](_0x391e86['query']);_0x37ca73[_0x8488('0x49')]=_[_0x8488('0x4a')](_0x37ca73[_0x8488('0x46')],_0x37ca73[_0x8488('0x47')]);_0x477a86[_0x8488('0x4b')]=_['intersection'](_0x37ca73['model'],qs['fields'](_0x391e86[_0x8488('0x47')][_0x8488('0x4c')]));_0x477a86[_0x8488('0x4b')]=_0x477a86['attributes'][_0x8488('0x67')]?_0x477a86[_0x8488('0x4b')]:_0x37ca73['model'];if(_0x391e86[_0x8488('0x47')][_0x8488('0xb5')]){_0x477a86[_0x8488('0xb6')]=[{'all':!![]}];}_0x477a86=_[_0x8488('0xa0')]({},_0x477a86,_0x391e86[_0x8488('0xb7')]);return db[_0x8488('0x42')][_0x8488('0x79')](_0x477a86)[_0x8488('0x20')](handleEntityNotFound(_0x450afa,null))[_0x8488('0x20')](respondWithResult(_0x450afa,null))[_0x8488('0x29')](handleError(_0x450afa,null));};exports[_0x8488('0xb8')]=function(_0x13add2,_0xa0c692){return db['ChatInteraction'][_0x8488('0xb8')](_0x13add2[_0x8488('0xb9')],{})['then'](respondWithResult(_0xa0c692,0xc9))['catch'](handleError(_0xa0c692,null));};exports['update']=function(_0x5e60cb,_0x14ff09){if(_0x5e60cb[_0x8488('0xb9')]['id']){delete _0x5e60cb['body']['id'];}return db[_0x8488('0x42')]['find']({'where':{'id':_0x5e60cb[_0x8488('0xba')]['id']}})[_0x8488('0x20')](handleEntityNotFound(_0x14ff09,null))[_0x8488('0x20')](saveUpdates(_0x5e60cb[_0x8488('0xb9')],null))[_0x8488('0x20')](respondWithResult(_0x14ff09,null))['catch'](handleError(_0x14ff09,null));};exports[_0x8488('0x36')]=function(_0x27c233,_0x41e251){return db[_0x8488('0x42')]['find']({'where':{'id':_0x27c233['params']['id']}})[_0x8488('0x20')](handleEntityNotFound(_0x41e251,null))[_0x8488('0x20')](removeEntity(_0x41e251,null))[_0x8488('0x29')](handleError(_0x41e251,null));};exports[_0x8488('0xbb')]=function(_0x2f8191,_0x14b32b){return db[_0x8488('0x42')][_0x8488('0xbb')]()[_0x8488('0x20')](respondWithResult(_0x14b32b,null))[_0x8488('0x29')](handleError(_0x14b32b,null));};exports[_0x8488('0xbc')]=function(_0x1e7617,_0x315136){var _0x193a96=_0x1e7617['params']['id'];var _0x556b9b;var _0x2c20e9;var _0x312a32;return db[_0x8488('0x42')][_0x8488('0xbd')]({'where':{'id':_0x193a96}})[_0x8488('0x20')](function(_0x22f2de){_0x556b9b=_0x22f2de;return db[_0x8488('0xbe')][_0x8488('0xbd')]({'where':{'id':_0x22f2de[_0x8488('0x7e')]},'attributes':['id','vidaooApiKey',_0x8488('0xbf')],'raw':!![]});})[_0x8488('0x20')](function(_0x2d7d0b){if(_0x2d7d0b&&_0x2d7d0b['vidaooApiKey']&&_0x2d7d0b[_0x8488('0xbf')]){_0x2c20e9=_0x2d7d0b;var _0x3a5ce0={'rejectUnauthorized':![],'method':_0x8488('0xc0'),'uri':_0x8488('0xc1'),'headers':{'X-APIKEY':_0x2d7d0b[_0x8488('0xc2')]},'body':{'name':_0x8488('0xc3')+_0x193a96},'redirect':_0x8488('0xc4'),'json':!![]};return rp(_0x3a5ce0);}else{throw new db[(_0x8488('0x1c'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x8488('0x20')](function(_0x215d7e){_0x312a32=_0x215d7e;if(_0x312a32['id']){var _0x257a1b={'body':_0x312a32[_0x8488('0xc5')],'ChatWebsiteId':_0x2c20e9['id'],'ChatInteractionId':_0x556b9b['id'],'direction':_0x8488('0xc6'),'UserId':_0x1e7617[_0x8488('0x9a')]['id']};return db[_0x8488('0xc7')]['create'](_0x257a1b,{});}else{throw new db[(_0x8488('0x1c'))]['ValidationError'](_0x8488('0xc8'));}})[_0x8488('0x20')](function(){return _0x556b9b[_0x8488('0xc9')]({'vidaooSessionId':_0x312a32['id']});})[_0x8488('0x20')](respondWithResult(_0x315136,null))[_0x8488('0x29')](handleError(_0x315136,null));};exports['customUpdate']=function(_0x27add0,_0x319fa8){if(_0x27add0[_0x8488('0xb9')]['id']){delete _0x27add0[_0x8488('0xb9')]['id'];}return db[_0x8488('0x42')][_0x8488('0x79')]({'where':{'id':_0x27add0[_0x8488('0xba')]['id']}})['then'](handleEntityNotFound(_0x319fa8,null))[_0x8488('0x20')](saveUpdates(_0x27add0['body'],null))['then'](respondWithResult(_0x319fa8,null))[_0x8488('0x29')](handleError(_0x319fa8,null));};exports[_0x8488('0xca')]=function(_0x5da38e,_0x47633f,_0x2ba4ba){if(_0x5da38e[_0x8488('0xb9')]['id']){delete _0x5da38e[_0x8488('0xb9')]['id'];}return db[_0x8488('0x42')]['find']({'where':{'id':_0x5da38e['params']['id']}})[_0x8488('0x20')](function(_0x1c4b86){if(!_0x1c4b86){logger[_0x8488('0x25')](_0x8488('0xcb'),_0x8488('0xca'),0x194,'entity\x20not\x20found');_0x47633f['sendStatus'](0x194);}else{if(_0x1c4b86[_0x8488('0x7a')]){throw new db[(_0x8488('0x1c'))][(_0x8488('0x1d'))](_0x8488('0xcc'));}}return _0x1c4b86;})[_0x8488('0x20')](function(_0x1a2b0d){if(_0x1a2b0d){return _0x1a2b0d[_0x8488('0x35')]({'closed':_0x5da38e[_0x8488('0xb9')][_0x8488('0xcd')],'disposition':_0x5da38e[_0x8488('0xb9')][_0x8488('0xce')]})[_0x8488('0x20')](function(_0x327051){return _0x327051;});}})[_0x8488('0x20')](function(_0x4a3c76){return respondWithRpcPromise(_0x8488('0xcf'),_0x8488('0xca'),_0x5da38e[_0x8488('0xb9')],client9004);})['then'](respondWithResult(_0x47633f,null))[_0x8488('0x29')](handleError(_0x47633f,null));};exports[_0x8488('0xd0')]=function(_0x24c5ed,_0x4ef936,_0x62adfe){_0x24c5ed[_0x8488('0xb9')]['name']=_0x24c5ed[_0x8488('0xd1')][_0x8488('0xd2')];_0x24c5ed['body'][_0x8488('0xd3')]=_0x24c5ed[_0x8488('0xd1')][_0x8488('0xd4')];_0x24c5ed[_0x8488('0xb9')][_0x8488('0x44')]=_0x24c5ed[_0x8488('0xd1')][_0x8488('0xd5')];return db[_0x8488('0xd6')][_0x8488('0xb8')](_0x24c5ed[_0x8488('0xb9')])['then'](respondWithResult(_0x4ef936,0xc9))[_0x8488('0x29')](handleError(_0x4ef936,null));};exports[_0x8488('0xd7')]=function(_0x52e72a,_0x230e13,_0x54bed4){return db[_0x8488('0x42')][_0x8488('0xbd')]({'where':{'id':_0x52e72a[_0x8488('0xba')]['id']},'raw':!![]})[_0x8488('0x20')](handleEntityNotFound(_0x230e13,null))[_0x8488('0x20')](function(_0x2c587f){if(_0x2c587f){if(_0x2c587f['closed']){return _0x230e13[_0x8488('0x2c')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x8488('0xd6')][_0x8488('0xbd')]({'where':{'id':_0x52e72a[_0x8488('0x47')][_0x8488('0xd8')]},'raw':!![]})['then'](handleEntityNotFound(_0x230e13,null));}})['then'](function(_0x52749d){if(_0x52749d){return _0x230e13['download'](path[_0x8488('0xd9')](config[_0x8488('0xda')],_0x8488('0xdb'),_0x52749d[_0x8488('0xd3')]));}})[_0x8488('0x29')](handleError(_0x230e13,null));};exports['close']=function(_0x1f5299,_0x939646){var _0x42b9b7=null;var _0x491c3c=null;var _0x50b45f=null;var _0x1f8fb1=null;if(_0x1f5299[_0x8488('0xb9')]['id']){delete _0x1f5299['body']['id'];}if(_0x1f5299['body'][_0x8488('0xdc')]){_0x1f8fb1=path[_0x8488('0xd9')](config[_0x8488('0xda')],_0x8488('0xdd'),util[_0x8488('0xde')](_0x8488('0xdf'),Date[_0x8488('0xe0')]()));_0x1f5299[_0x8488('0xb9')][_0x8488('0xe1')]=_0x1f8fb1;}return db[_0x8488('0x42')][_0x8488('0x79')]({'where':{'id':_0x1f5299[_0x8488('0xba')]['id']},'include':[{'model':db[_0x8488('0xc7')],'as':_0x8488('0xe2'),'include':[{'model':db[_0x8488('0x77')],'as':_0x8488('0x77')}]}]})[_0x8488('0x20')](handleEntityNotFound(_0x939646,null))['then'](saveUpdates(_0x1f5299[_0x8488('0xb9')],null))[_0x8488('0x20')](function(_0xddf093){if(_0xddf093){_0x42b9b7=_0xddf093;return db['ChatWebsite'][_0x8488('0x79')]({'where':{'id':_0x42b9b7[_0x8488('0x7e')]}});}})[_0x8488('0x20')](function(_0x674d19){if(_0x674d19){_0x50b45f=_0x674d19;return db['CmContact'][_0x8488('0x79')]({'where':{'id':_0x42b9b7['ContactId']}});}})[_0x8488('0x20')](function(_0x391b98){if(_0x391b98){_0x491c3c=_0x391b98;if(_0x1f8fb1){var _0x5b2721=null;for(var _0x388871=0x1;_0x388871<_0x42b9b7[_0x8488('0xe2')][_0x8488('0x67')];++_0x388871){_0x5b2721=_0x42b9b7[_0x8488('0xe2')][_0x388871];var _0x3cd626=_0x5b2721[_0x8488('0x7a')]?util['format']('%s%d',_0x50b45f[_0x8488('0xe3')],_0x5b2721[_0x8488('0x7a')]):_0x8488('0xe4');var _0x2628ba=_0x1f5299[_0x8488('0xb9')]['customer']||util['format'](_0x8488('0xe5'),'Visitor',_0x5b2721[_0x8488('0x72')]);switch(_0x50b45f[_0x8488('0xe6')]){case'website_alias':_0x3cd626=_0x5b2721['UserId']?util[_0x8488('0xde')](_0x8488('0xe5'),_0x50b45f['agentAlias'],_0x5b2721[_0x8488('0x7a')]):'System';break;case'agent_alias':_0x3cd626=_0x5b2721[_0x8488('0x7a')]?_0x5b2721[_0x8488('0x77')][_0x8488('0xe7')]||_0x5b2721['User'][_0x8488('0x3b')]:_0x8488('0xe4');break;case _0x8488('0xe8'):_0x3cd626=_0x5b2721[_0x8488('0x7a')]?_0x5b2721['User'][_0x8488('0x3b')]:_0x8488('0xe4');break;default:_0x3cd626=_0x5b2721[_0x8488('0x7a')]?util[_0x8488('0xde')](_0x8488('0xe5'),_0x50b45f[_0x8488('0xe3')],_0x5b2721[_0x8488('0x7a')]):_0x8488('0xe4');}var _0x201a91=util[_0x8488('0xde')](_0x8488('0xe9'),moment(_0x5b2721['createdAt'])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x5b2721[_0x8488('0xea')]==='in'?_0x2628ba:_0x3cd626,_0x5b2721['body']);if(!_0x5b2721[_0x8488('0xeb')]){fs['appendFileSync'](_0x1f8fb1,_0x201a91);}}return db[_0x8488('0xec')][_0x8488('0xbd')]({'where':{'service':!![]},'include':[{'model':db[_0x8488('0xed')],'as':_0x8488('0xee'),'raw':!![]}]});}}})['then'](function(_0x4957f0){if(_0x4957f0&&_0x4957f0[_0x8488('0xee')]&&_0x1f5299['body']){var _0x9eebf6={'tls':{'rejectUnauthorized':![]}};if(_0x4957f0['Smtp'][_0x8488('0xef')]){_0x9eebf6[_0x8488('0xef')]=_0x4957f0['Smtp'][_0x8488('0xef')];}else{_0x9eebf6[_0x8488('0xf0')]=_0x4957f0[_0x8488('0xee')][_0x8488('0xf0')];_0x9eebf6[_0x8488('0xf1')]=_0x4957f0[_0x8488('0xee')][_0x8488('0xf1')];_0x9eebf6[_0x8488('0xf2')]=_0x4957f0[_0x8488('0xee')][_0x8488('0xf2')];}if(_0x4957f0[_0x8488('0xee')][_0x8488('0xf3')]){_0x9eebf6['auth']={'user':_0x4957f0[_0x8488('0xee')][_0x8488('0x9a')],'pass':_0x4957f0[_0x8488('0xee')]['pass']};}return respondWithRpcPromise(_0x8488('0xf4'),'sendMail',{'account':_0x9eebf6,'message':{'from':util[_0x8488('0xde')](_0x8488('0xf5'),_0x4957f0[_0x8488('0x38')],_0x4957f0['email']||_0x4957f0['Smtp'][_0x8488('0x9a')]),'to':_0x1f5299[_0x8488('0xb9')][_0x8488('0xdc')],'subject':_0x8488('0xf6'),'text':util[_0x8488('0xde')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x1f5299['body']['mailTranscript']),'attachments':[{'path':_0x1f8fb1}]}})[_0x8488('0x20')](function(){return _0x42b9b7;})[_0x8488('0x29')](function(_0x2c0ae1){console[_0x8488('0x25')](_0x2c0ae1);});}else{return _0x42b9b7;}})['then'](respondWithStatusCode(_0x939646,0xc8))[_0x8488('0x29')](handleError(_0x939646,null));};exports[_0x8488('0xf7')]=function(_0xa358dc,_0x5be3e5,_0xab367e){return db['ChatMessage'][_0x8488('0x79')]({'where':{'id':_0xa358dc[_0x8488('0xba')]['id']}})[_0x8488('0x20')](handleEntityNotFound(_0x5be3e5,null))[_0x8488('0x20')](function(_0x59b90a){if(_0x59b90a){return _0x59b90a[_0x8488('0xf7')](_0xa358dc['body']['ids'],_[_0x8488('0xf8')](_0xa358dc[_0x8488('0xb9')],['ids','id'])||{});}})[_0x8488('0x20')](respondWithResult(_0x5be3e5,null))['catch'](handleError(_0x5be3e5,null));};exports[_0x8488('0xf9')]=function(_0x1c1375,_0x5dbd0c,_0x4e5c26){var _0x1e98c8={'raw':![],'where':{}};var _0x184265={};var _0x3bd2cb={'count':0x0,'rows':[]};return db[_0x8488('0x42')]['findOne']({'where':{'id':_0x1c1375[_0x8488('0xba')]['id']}})[_0x8488('0x20')](handleEntityNotFound(_0x5dbd0c,null))[_0x8488('0x20')](function(_0x5da39c){if(_0x5da39c){_0x184265[_0x8488('0x46')]=_[_0x8488('0x48')](db['ChatMessage'][_0x8488('0xb4')]);_0x184265[_0x8488('0x47')]=_[_0x8488('0x48')](_0x1c1375['query']);_0x184265[_0x8488('0x49')]=_[_0x8488('0x4a')](_0x184265[_0x8488('0x46')],_0x184265[_0x8488('0x47')]);_0x1e98c8[_0x8488('0x4b')]=_['intersection'](_0x184265[_0x8488('0x46')],qs[_0x8488('0x4c')](_0x1c1375[_0x8488('0x47')][_0x8488('0x4c')]));_0x1e98c8['attributes']=_0x1e98c8['attributes'][_0x8488('0x67')]?_0x1e98c8['attributes']:_0x184265[_0x8488('0x46')];if(!_0x1c1375['query'][_0x8488('0x4d')](_0x8488('0xfa'))){_0x1e98c8['limit']=qs['limit'](_0x1c1375['query'][_0x8488('0x30')]);_0x1e98c8[_0x8488('0x2f')]=qs[_0x8488('0x2f')](_0x1c1375['query'][_0x8488('0x2f')]);}_0x1e98c8[_0x8488('0x4e')]=qs[_0x8488('0x4f')](_0x1c1375[_0x8488('0x47')][_0x8488('0x4f')]);_0x1e98c8[_0x8488('0x50')]=qs[_0x8488('0x49')](_[_0x8488('0xfb')](_0x1c1375['query'],_0x184265[_0x8488('0x49')]));_0x1e98c8['where'][_0x8488('0xb1')]=_0x5da39c['id'];if(_0x1c1375['query'][_0x8488('0xfc')]){_0x1e98c8['where']=_['merge'](_0x1e98c8[_0x8488('0x50')],{'$or':_['map'](_0x1e98c8[_0x8488('0x4b')],function(_0x582b7d){var _0x358868={};_0x358868[_0x582b7d]={'$like':'%'+_0x1c1375['query']['filter']+'%'};return _0x358868;})});}if(_0x1c1375['query'][_0x8488('0xfd')]){var _0x5807e9=_0x1c1375[_0x8488('0x47')][_0x8488('0xfd')][_0x8488('0x3d')](',');var _0x1d3714={};_0x1d3714[_0x5807e9[0x0]]={'$gte':moment(_0x5807e9[0x1])[_0x8488('0xde')](_0x8488('0xfe'))};_0x1e98c8['where']=_[_0x8488('0xa0')](_0x1e98c8['where'],_0x1d3714);}_0x1e98c8=_[_0x8488('0xa0')]({},_0x1e98c8,_0x1c1375[_0x8488('0xb7')]);return db[_0x8488('0xc7')][_0x8488('0x2e')]({'where':_0x1e98c8[_0x8488('0x50')]})['then'](function(_0x7c86dd){_0x3bd2cb['count']=_0x7c86dd;if(_0x1c1375['query'][_0x8488('0xb5')]){_0x1e98c8['include']=[{'all':!![]}];}return db[_0x8488('0xc7')][_0x8488('0xff')](_0x1e98c8);})[_0x8488('0x20')](function(_0x3abbe0){_0x3bd2cb[_0x8488('0xb3')]=_0x3abbe0;return _0x3bd2cb;});}})[_0x8488('0x20')](respondWithFilteredResult(_0x5dbd0c,_0x1e98c8))[_0x8488('0x29')](handleError(_0x5dbd0c,null));};exports[_0x8488('0x100')]=function(_0x5d287f,_0x29ea4b,_0xab7ae3){var _0x42295c={'where':{}},_0x51ca92={},_0x554d9a={'count':0x0,'rows':[]};return db[_0x8488('0x42')][_0x8488('0xbd')]({'where':{'id':_0x5d287f[_0x8488('0xba')]['id']}})[_0x8488('0x20')](handleEntityNotFound(_0x29ea4b,null))[_0x8488('0x20')](function(_0x21e76e){if(_0x21e76e){_0x51ca92[_0x8488('0x46')]=_[_0x8488('0x48')](db[_0x8488('0xc7')][_0x8488('0xb4')]);_0x51ca92[_0x8488('0x47')]=_[_0x8488('0x48')](_0x5d287f[_0x8488('0x47')]);_0x51ca92['filters']=_[_0x8488('0x4a')](_0x51ca92[_0x8488('0x46')],_0x51ca92[_0x8488('0x47')]);_0x42295c[_0x8488('0x4b')]=_[_0x8488('0x4a')](_0x51ca92['model'],qs['fields'](_0x5d287f[_0x8488('0x47')][_0x8488('0x4c')]));_0x42295c[_0x8488('0x4b')]=_0x42295c['attributes'][_0x8488('0x67')]?_0x42295c[_0x8488('0x4b')]:_0x51ca92[_0x8488('0x46')];if(!_0x5d287f[_0x8488('0x47')][_0x8488('0x4d')](_0x8488('0xfa'))){_0x42295c[_0x8488('0x30')]=qs[_0x8488('0x30')](_0x5d287f[_0x8488('0x47')][_0x8488('0x30')]);_0x42295c[_0x8488('0x2f')]=qs[_0x8488('0x2f')](_0x5d287f[_0x8488('0x47')][_0x8488('0x2f')]);}_0x42295c[_0x8488('0x4e')]=qs[_0x8488('0x4f')](_0x5d287f[_0x8488('0x47')][_0x8488('0x4f')]);_0x42295c[_0x8488('0x50')]=qs[_0x8488('0x49')](_[_0x8488('0xfb')](_0x5d287f[_0x8488('0x47')],_0x51ca92['filters']));_0x42295c['where'][_0x8488('0xb1')]=_0x21e76e['id'];if(_0x5d287f[_0x8488('0x47')][_0x8488('0xfc')]){_0x42295c[_0x8488('0x50')]=_[_0x8488('0xa0')](_0x42295c['where'],{'$or':_[_0x8488('0x3a')](_0x42295c[_0x8488('0x4b')],function(_0x2f96cb){var _0x379b81={};_0x379b81[_0x2f96cb]={'$like':'%'+_0x5d287f[_0x8488('0x47')][_0x8488('0xfc')]+'%'};return _0x379b81;})});}_0x42295c[_0x8488('0x50')][_0x8488('0xeb')]=![];if(_0x5d287f['query']['id']){_0x42295c[_0x8488('0x50')]['id']={'$gt':_0x5d287f[_0x8488('0x47')]['id']};}_0x42295c=_[_0x8488('0xa0')]({},_0x42295c,_0x5d287f[_0x8488('0xb7')]);return db[_0x8488('0xc7')][_0x8488('0x2e')]({'where':_0x42295c[_0x8488('0x50')]})['then'](function(_0x24ff97){_0x554d9a[_0x8488('0x2e')]=_0x24ff97;_0x42295c[_0x8488('0xb6')]=[];if(_0x5d287f[_0x8488('0x47')][_0x8488('0x101')]){_0x42295c[_0x8488('0xb6')][_0x8488('0x40')]({'model':db[_0x8488('0x77')],'as':'User','attributes':['id',_0x8488('0x3b'),_0x8488('0xe7')]});}if(_0x5d287f[_0x8488('0x47')][_0x8488('0xb5')]){_0x42295c[_0x8488('0xb6')]=[{'all':!![]}];}return db[_0x8488('0xc7')][_0x8488('0xff')](_0x42295c);})[_0x8488('0x20')](function(_0x32bd5f){_0x554d9a[_0x8488('0xb3')]=_0x32bd5f;return _0x554d9a;});}})[_0x8488('0x20')](respondWithFilteredResult(_0x29ea4b,_0x42295c))['catch'](handleError(_0x29ea4b,null));};exports[_0x8488('0x102')]=function(_0x5608c4,_0x5d3b8d,_0x51f315){return db[_0x8488('0x42')]['find']({'where':{'id':_0x5608c4['params']['id']}})['then'](handleEntityNotFound(_0x5d3b8d,null))[_0x8488('0x20')](function(_0x3f9240){if(_0x3f9240){return _0x3f9240['setTags'](_0x5608c4[_0x8488('0xb9')]['ids'],_['omit'](_0x5608c4['body'],[_0x8488('0x103'),'id'])||{})[_0x8488('0x104')](function(){return db['Tag']['findAll']({'attributes':['id',_0x8488('0x38'),_0x8488('0x105')],'where':{'id':_0x5608c4[_0x8488('0xb9')]['ids']}});})[_0x8488('0x20')](function(_0x3377ae){socket[_0x8488('0x106')](_0x8488('0x107'),{'id':Number(_0x5608c4[_0x8488('0xba')]['id']),'tags':_0x3377ae||[]});return{'id':Number(_0x5608c4['params']['id']),'tags':_0x3377ae||[]};});}})[_0x8488('0x20')](respondWithResult(_0x5d3b8d,null))[_0x8488('0x29')](handleError(_0x5d3b8d,null));};exports[_0x8488('0x108')]=function(_0x1aa9de,_0x190c7a,_0x524c83){return db['ChatInteraction'][_0x8488('0x79')]({'where':{'id':_0x1aa9de[_0x8488('0xba')]['id']}})[_0x8488('0x20')](handleEntityNotFound(_0x190c7a,null))['then'](function(_0x5c0461){if(_0x5c0461){return _0x5c0461['removeTags'](_0x1aa9de[_0x8488('0x47')][_0x8488('0x103')]);}})[_0x8488('0x20')](respondWithStatusCode(_0x190c7a,null))['catch'](handleError(_0x190c7a,null));};exports[_0x8488('0x109')]=function(_0x5d038c,_0x42afd4){var _0x54e484=moment()[_0x8488('0x10a')]()['toString']();var _0x42367d=path[_0x8488('0xd9')](config[_0x8488('0xda')],_0x8488('0x10b'),'files',_0x8488('0x10c'));var _0x49d626=path[_0x8488('0xd9')](config[_0x8488('0xda')],_0x8488('0x10b'),_0x8488('0x10d'),_0x8488('0x10e'));var _0x33e945=path[_0x8488('0xd9')](_0x42367d,_0x54e484);var _0x116d17=util['format'](_0x8488('0x10f'),_0x5d038c['params']['id'],_0x54e484);var _0x2370fd=path['join'](_0x42367d,_0x116d17);var _0x21d61a=[];_0x21d61a[_0x8488('0x40')]({'model':db[_0x8488('0x77')],'as':'User','attributes':['id',_0x8488('0x3b')],'raw':!![]});_0x21d61a[_0x8488('0x40')]({'model':db[_0x8488('0x110')],'as':_0x8488('0x6c'),'attributes':['id',_0x8488('0x111'),_0x8488('0x112')],'raw':!![]});if(_0x5d038c[_0x8488('0x47')]['attachments']){_0x21d61a[_0x8488('0x40')]({'model':db[_0x8488('0xd6')],'as':_0x8488('0xd6'),'raw':!![]});}var _0x1aef84=[{'model':db[_0x8488('0xc7')],'as':'Messages','attributes':['id',_0x8488('0xb9'),_0x8488('0x81'),_0x8488('0xea'),'secret',_0x8488('0x87')],'include':_0x21d61a}];_0x1aef84['push']({'model':db['ChatWebsite'],'as':_0x8488('0x113'),'attributes':['id',_0x8488('0x38')]});_0x1aef84[_0x8488('0x40')]({'model':db[_0x8488('0x77')],'as':_0x8488('0x114'),'attributes':['id',_0x8488('0x3b')]});return db['ChatInteraction']['find']({'where':{'id':_0x5d038c[_0x8488('0xba')]['id']},'include':_0x1aef84})[_0x8488('0x20')](handleEntityNotFound(_0x42afd4,null))[_0x8488('0x20')](function(_0x47edf8){if(_0x47edf8){var _0x1dc04e=_0x47edf8[_0x8488('0x115')]({'plain':!![]});fs[_0x8488('0x116')](_0x33e945);var _0x22749f={'format':'A4','border':'10px','header':{'height':_0x8488('0x117'),'contents':{'first':_0x8488('0x118')}},'footer':{'height':_0x8488('0x119'),'contents':{'default':util[_0x8488('0xde')](_0x8488('0x11a'),util['format']('%s\x20#%d',_0x8488('0x11b'),_0x1dc04e['id']),moment()['format'](_0x8488('0x11c'))[_0x8488('0x9d')]())}}};var _0x33f830={'channel':'Chat','account':_0x1dc04e[_0x8488('0x113')][_0x8488('0x38')],'agent':_0x1dc04e['Owner']?_0x1dc04e[_0x8488('0x114')][_0x8488('0x3b')]:'N.A.','createdAt':moment(_0x1dc04e[_0x8488('0x81')])[_0x8488('0xde')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x1dc04e['closed']?moment(_0x1dc04e[_0x8488('0x11d')])[_0x8488('0xde')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x1dc04e[_0x8488('0xce')],'chatInfo':{'browser':_0x1dc04e[_0x8488('0x11e')],'os':_0x1dc04e[_0x8488('0x11f')],'referer':_0x1dc04e[_0x8488('0x120')],'customerIp':_0x1dc04e[_0x8488('0x121')],'customerPort':_0x1dc04e['customerPort']?_0x1dc04e[_0x8488('0x122')]:_0x8488('0x123')},'messages':_(_0x1dc04e[_0x8488('0xe2')])['tail']()['filter']({'secret':![]})[_0x8488('0x3a')](function(_0x34bcaa){if(_0x34bcaa[_0x8488('0xd6')]){var _0x520188=path[_0x8488('0xd9')](_0x49d626,_0x34bcaa[_0x8488('0xd6')][_0x8488('0xd3')]);if(fs[_0x8488('0x124')](_0x520188)){fs[_0x8488('0x125')](_0x520188)['pipe'](fs[_0x8488('0x126')](path[_0x8488('0xd9')](_0x33e945,_0x34bcaa['Attachment'][_0x8488('0xd3')])));}}return{'date':moment(_0x34bcaa['createdAt'])[_0x8488('0xde')](_0x8488('0xfe'))[_0x8488('0x9d')](),'sender':_0x34bcaa['direction']===_0x8488('0xc6')?_0x34bcaa[_0x8488('0x77')]?_0x34bcaa['User'][_0x8488('0x3b')]:_0x8488('0xe4'):_0x34bcaa['Contact'][_0x8488('0x111')]+(_0x34bcaa['Contact'][_0x8488('0x112')]?'\x20'+_0x34bcaa[_0x8488('0x6c')][_0x8488('0x112')]:''),'body':_0x34bcaa[_0x8488('0xd6')]?_0x34bcaa[_0x8488('0xd6')]['basename']:_0x34bcaa[_0x8488('0xb9')],'direction':_0x34bcaa['direction']==='out'?'A':'C','secret':_0x34bcaa['secret'],'read':_0x34bcaa[_0x8488('0x87')],'attachment':_0x34bcaa['Attachment']};})[_0x8488('0x69')]()};return ejs[_0x8488('0x127')](path[_0x8488('0xd9')](config[_0x8488('0xda')],_0x8488('0x10b'),'views',_0x8488('0x128')),{'interaction':_0x33f830})[_0x8488('0x20')](function(_0x407cd5){return new BPromise(function(_0x6a3925,_0x4d1227){pdf[_0x8488('0xb8')](_0x407cd5,_0x22749f)['toFile'](path[_0x8488('0xd9')](_0x33e945,_0x8488('0x129')+_0x1dc04e['id']+'-'+_0x54e484+_0x8488('0x12a')),function(_0x358f95,_0x520c5a){if(_0x358f95)return _0x4d1227(_0x358f95);_0x6a3925(_0x520c5a);});});})[_0x8488('0x20')](function(){return new BPromise(function(_0x5baaa5,_0x34a5e4){zipdir(_0x33e945,{'saveTo':_0x2370fd},function(_0x22efdd,_0x4b3081){if(_0x22efdd)return _0x34a5e4(_0x22efdd);return _0x5baaa5(_0x4b3081);});})[_0x8488('0x20')](function(){return new BPromise(function(_0xf8bfa8,_0x3cf327){rimraf(_0x33e945,function(_0x3c4b4d){if(_0x3c4b4d)_0x3cf327(_0x3c4b4d);return _0xf8bfa8();});});})['then'](function(){return _0x42afd4[_0x8488('0x109')](_0x2370fd,_0x116d17,function(_0x337cac){if(_0x337cac){console[_0x8488('0x12b')](_0x8488('0x12c'),_0x337cac);}else{fs[_0x8488('0x12d')](_0x2370fd);}});});});}else{return _0x42afd4[_0x8488('0x2b')](0xc8);}})['catch'](handleError(_0x42afd4,null));}; \ No newline at end of file +var _0x4137=['set','Content-Range','save','update','destroy','stack','name','send','Users','map','fullname','TagIds','index','ChatInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','select','field','tools_tags','u.fullname','ui.ChatInteractionId','from','chat_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','sqlOperator','find','unreadMessages','value','having','`\x20>\x200','Contact','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','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','end','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','rows','show','params','includeAll','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooApiKey','POST','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','updateAttributes','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','basename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','download','root','server/files/attachments/','close','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','addMessage','ids','omit','getMessages','hasOwnProperty','merge','$gte','YYYY-MM-DD\x20HH:mm:ss','include','findAll','nolimit','includeAgent','addTags','setTags','spread','color','chatInteractionTags:save','removeTags','unix','join','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','Chat','Account','N.A.','referer','customerIp','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.html','transcript-','.pdf','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','register','jayson/promise','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','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','count','offset','limit'];(function(_0x16dbcd,_0x274516){var _0x34706e=function(_0x43433d){while(--_0x43433d){_0x16dbcd['push'](_0x16dbcd['shift']());}};_0x34706e(++_0x274516);}(_0x4137,0xf8));var _0x7413=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4137[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0x7413('0x0'));var emlformat=require(_0x7413('0x1'));var rimraf=require(_0x7413('0x2'));var zipdir=require(_0x7413('0x3'));var jsonpatch=require(_0x7413('0x4'));var rp=require(_0x7413('0x5'));var moment=require(_0x7413('0x6'));var BPromise=require(_0x7413('0x7'));var Mustache=require(_0x7413('0x8'));var util=require(_0x7413('0x9'));var path=require(_0x7413('0xa'));var sox=require(_0x7413('0xb'));var csv=require('to-csv');var ejs=require(_0x7413('0xc'));var fs=require('fs');var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0x11'));var querystring=require('querystring');var Papa=require(_0x7413('0x12'));var Redis=require(_0x7413('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x14'));var as=require(_0x7413('0x15'));var hardwareService=require(_0x7413('0x16'));var logger=require(_0x7413('0x17'))(_0x7413('0x18'));var utils=require('../../config/utils');var config=require(_0x7413('0x19'));var db=require(_0x7413('0x1a'))['db'];config['redis']=_[_0x7413('0x1b')](config[_0x7413('0x1c')],{'host':_0x7413('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInteraction.socket')[_0x7413('0x1e')](socket);var jayson=require(_0x7413('0x1f'));var client=jayson['client'][_0x7413('0x20')]({'port':0x232b});var client9004=jayson[_0x7413('0x21')]['http']({'port':0x232c});function checkPasswordPattern(_0x38b3d1,_0x50f301,_0x4b9a5b){if(_0x4b9a5b){var _0x26501b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x26501b['test'](_0x50f301)){return _0x38b3d1;}else{throw new db[(_0x7413('0x22'))]['ValidationError'](_0x7413('0x23'));}}else{return _0x38b3d1;}}function respondWithRpcPromise(_0x3230d8,_0x19157f,_0x12a01e,_0x2a3417){return new BPromise(function(_0x26dafe,_0x51194e){var _0xecc3e=_0x2a3417||client;return _0xecc3e[_0x7413('0x24')](_0x3230d8,_0x12a01e)[_0x7413('0x25')](function(_0xfe5b8c){logger['info'](_0x7413('0x26'),_0x19157f,_0x7413('0x27'));logger[_0x7413('0x28')](_0x7413('0x29'),_0x19157f,_0x7413('0x27'),JSON[_0x7413('0x2a')](_0xfe5b8c));if(_0xfe5b8c[_0x7413('0x2b')]){if(_0xfe5b8c[_0x7413('0x2b')]['code']===0x1f4){logger['error'](_0x7413('0x26'),_0x19157f,_0xfe5b8c['error'][_0x7413('0x2c')]);return _0x51194e(_0xfe5b8c[_0x7413('0x2b')][_0x7413('0x2c')]);}logger[_0x7413('0x2b')](_0x7413('0x26'),_0x19157f,_0xfe5b8c[_0x7413('0x2b')][_0x7413('0x2c')]);return _0x26dafe(_0xfe5b8c[_0x7413('0x2b')][_0x7413('0x2c')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x19157f,_0x7413('0x27'));_0x26dafe(_0xfe5b8c['result'][_0x7413('0x2c')]);}})[_0x7413('0x2d')](function(_0x463b21){logger['error'](_0x7413('0x26'),_0x19157f,_0x463b21);_0x51194e(_0x463b21);});});}function respondWithStatusCode(_0x896552,_0x79cab6){_0x79cab6=_0x79cab6||0xcc;return function(_0x4843fd){if(_0x4843fd){return _0x896552[_0x7413('0x2e')](_0x79cab6);}return _0x896552[_0x7413('0x2f')](_0x79cab6)['end']();};}function respondWithResult(_0x24dce7,_0x4ed662){_0x4ed662=_0x4ed662||0xc8;return function(_0x1d0bde){if(_0x1d0bde){return _0x24dce7[_0x7413('0x2f')](_0x4ed662)[_0x7413('0x30')](_0x1d0bde);}};}function respondWithFilteredResult(_0x13a836,_0x25fa52){return function(_0x2004ea){if(_0x2004ea){var _0x5bb3ea=_0x2004ea[_0x7413('0x31')],_0x1ffb6f=_0x25fa52[_0x7413('0x32')],_0x17c342=_0x25fa52[_0x7413('0x32')]+_0x25fa52[_0x7413('0x33')],_0x39db32;if(_0x17c342>=_0x5bb3ea){_0x17c342=_0x5bb3ea;_0x39db32=0xc8;}else{_0x39db32=0xce;}_0x13a836['status'](_0x39db32);return _0x13a836[_0x7413('0x34')](_0x7413('0x35'),_0x1ffb6f+'-'+_0x17c342+'/'+_0x5bb3ea)[_0x7413('0x30')](_0x2004ea);}return null;};}function patchUpdates(_0xd373d5){return function(_0x14bf3b){try{jsonpatch['apply'](_0x14bf3b,_0xd373d5,!![]);}catch(_0x1c36f8){return BPromise['reject'](_0x1c36f8);}return _0x14bf3b[_0x7413('0x36')]();};}function saveUpdates(_0x126d66,_0x1cc4d8){return function(_0x539d93){if(_0x539d93){return _0x539d93[_0x7413('0x37')](_0x126d66)['then'](function(_0x29e30a){return _0x29e30a;});}return null;};}function removeEntity(_0x31c174,_0x591666){return function(_0x499cfa){if(_0x499cfa){return _0x499cfa[_0x7413('0x38')]()[_0x7413('0x25')](function(){_0x31c174[_0x7413('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dd1ce,_0x409f06){return function(_0x5a92ab){if(!_0x5a92ab){_0x4dd1ce['sendStatus'](0x194);}return _0x5a92ab;};}function handleError(_0xda3035,_0x575a79){_0x575a79=_0x575a79||0x1f4;return function(_0x3ad12d){logger[_0x7413('0x2b')](_0x3ad12d[_0x7413('0x39')]);if(_0x3ad12d[_0x7413('0x3a')]){delete _0x3ad12d[_0x7413('0x3a')];}_0xda3035['status'](_0x575a79)[_0x7413('0x3b')](_0x3ad12d);};}function getInteractionUsers(_0x8dc047,_0x44e8b5){return new BPromise(function(_0xfa34ef,_0x245777){try{if(_0x44e8b5[_0x8dc047['id']]){_0x8dc047[_0x7413('0x3c')]=_[_0x7413('0x3d')](_0x44e8b5[_0x8dc047['id']],function(_0x385156){return{'id':_0x385156['id'],'fullname':_0x385156[_0x7413('0x3e')]};});}}catch(_0x26a241){_0x245777(_0x26a241);}_0xfa34ef(_0x8dc047);});}function getInteractionTags(_0x5c03eb,_0x320c61){return new BPromise(function(_0x5a9791,_0x31f8){try{if(_0x5c03eb['TagIds']){_0x5c03eb['Tags']=[];_0x5c03eb['TagIds']['split'](',')['forEach'](function(_0x44af7d){_0x5c03eb['Tags']['push'](_0x320c61[_0x44af7d]);});}delete _0x5c03eb[_0x7413('0x3f')];}catch(_0x4d0008){_0x31f8(_0x4d0008);}_0x5a9791(_0x5c03eb);});}function updateChatInteraction(_0x4c6746,_0x3d92ec,_0x32f1e8){return new BPromise(function(_0x18674c,_0x41ba22){return getInteractionUsers(_0x4c6746,_0x32f1e8)[_0x7413('0x25')](function(_0x57cb9e){return getInteractionTags(_0x57cb9e,_0x3d92ec);})[_0x7413('0x25')](function(_0x51c48a){_0x18674c(_0x51c48a);})[_0x7413('0x2d')](function(_0x1d8219){_0x41ba22(_0x1d8219);});});}exports[_0x7413('0x40')]=function(_0xfe0daa,_0x3f7da2){var _0x125466={},_0x12c1b3={},_0x1f88e7={'count':0x0,'rows':[]};var _0x35d198=_[_0x7413('0x3d')](db[_0x7413('0x41')][_0x7413('0x42')],function(_0x3fbec4){return{'name':_0x3fbec4['fieldName'],'type':_0x3fbec4[_0x7413('0x43')][_0x7413('0x44')]};});_0x12c1b3[_0x7413('0x45')]=_[_0x7413('0x3d')](_0x35d198,_0x7413('0x3a'));_0x12c1b3[_0x7413('0x46')]=_[_0x7413('0x47')](_0xfe0daa[_0x7413('0x46')]);_0x12c1b3[_0x7413('0x48')]=_[_0x7413('0x49')](_0x12c1b3[_0x7413('0x45')],_0x12c1b3['query']);_0x125466[_0x7413('0x4a')]=_['intersection'](_0x12c1b3[_0x7413('0x45')],qs[_0x7413('0x4b')](_0xfe0daa[_0x7413('0x46')][_0x7413('0x4b')]));_0x125466[_0x7413('0x4a')]=_0x125466[_0x7413('0x4a')][_0x7413('0x4c')]?_0x125466[_0x7413('0x4a')]:_0x12c1b3[_0x7413('0x45')];if(!_0xfe0daa[_0x7413('0x46')]['hasOwnProperty']('nolimit')){_0x125466[_0x7413('0x33')]=qs['limit'](_0xfe0daa['query'][_0x7413('0x33')]);_0x125466[_0x7413('0x32')]=qs['offset'](_0xfe0daa[_0x7413('0x46')]['offset']);}_0x125466['order']=qs[_0x7413('0x4d')](_0xfe0daa['query'][_0x7413('0x4d')]);_0x125466[_0x7413('0x4e')]=qs[_0x7413('0x48')](_[_0x7413('0x4f')](_0xfe0daa[_0x7413('0x46')],_0x12c1b3[_0x7413('0x48')]),_0x35d198);var _0x153a9c=[];var _0xde6773=squel[_0x7413('0x50')]()[_0x7413('0x51')]('id')['field'](_0x7413('0x3a'))['field']('color')['from'](_0x7413('0x52'));var _0x4299a3=squel[_0x7413('0x50')]()[_0x7413('0x51')]('u.id')['field'](_0x7413('0x53'))['field'](_0x7413('0x54'))['from']('user_has_chat_interactions','ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x6734e4=squel[_0x7413('0x50')]()[_0x7413('0x55')](_0x7413('0x56'),'i')[_0x7413('0x57')]('cm_contacts','c',_0x7413('0x58'))[_0x7413('0x57')](_0x7413('0x59'),'o','o.id\x20=\x20i.UserId')[_0x7413('0x57')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0x7413('0x57')](_0x7413('0x5a'),'me',_0x7413('0x5b'))[_0x7413('0x57')](_0x7413('0x5c'),'it',_0x7413('0x5d'))['left_join'](_0x7413('0x52'),'t','t.id\x20=\x20it.TagId');var _0x1d5ff2=squel['expr']();var _0x1ea50f=[];var _0x4d4faa=squel[_0x7413('0x5e')]();var _0x262f77;if(_0xfe0daa['query'][_0x7413('0x5f')]){_0x262f77=as['parseSearch'](_0xfe0daa[_0x7413('0x46')][_0x7413('0x5f')]);var _0x5163ca=_0x262f77[_0x7413('0x60')];for(var _0x12048c=0x0;_0x12048c<_0x262f77['conditions'][_0x7413('0x4c')];_0x12048c++){var _0x2bebea=_0x262f77['conditions'][_0x12048c];var _0xf4641='i';var _0x28eaf4=_[_0x7413('0x61')](_0x35d198,[_0x7413('0x3a'),_0x2bebea[_0x7413('0x51')]]);if(!_0x28eaf4){switch(_0x2bebea[_0x7413('0x51')]){case _0x7413('0x62'):if(_0x2bebea[_0x7413('0x63')]==0x1){_0x6734e4['having']('`'+_0x2bebea[_0x7413('0x51')]+'`\x20=\x200');}else{_0x6734e4[_0x7413('0x64')]('`'+_0x2bebea[_0x7413('0x51')]+_0x7413('0x65'));}break;case _0x7413('0x66'):if(_0x2bebea['operator']==='$substring'){if(_0x2bebea['value']['split']('\x20')['length']>0x1){_0x1d5ff2[_0x5163ca](_0x7413('0x67'),qs[_0x7413('0x68')](_0x2bebea[_0x7413('0x63')]),null);}else{var _0x5de03e='%'+_0x2bebea[_0x7413('0x63')]+'%';_0x1d5ff2[_0x5163ca](_0x7413('0x69'),_0x5de03e,_0x5de03e,_0x5de03e);}}else{_0x28eaf4=_[_0x7413('0x61')](_0x35d198,[_0x7413('0x3a'),_0x7413('0x6a')]);_0x2bebea[_0x7413('0x51')]=_0x7413('0x6a');_0x46983f=as[_0x7413('0x6b')](_0xf4641,_0x28eaf4[_0x7413('0x43')],_0x2bebea);_0x1d5ff2[_0x5163ca](_0x46983f[_0x7413('0x6c')],_0x46983f[_0x7413('0x63')][_0x7413('0x6d')],_0x46983f[_0x7413('0x63')]['end']);}break;case _0x7413('0x6e'):var _0x405ae4=_0x2bebea['value'][_0x7413('0x6f')](',')[_0x7413('0x3d')](function(_0x521682){return Number(_0x521682);});_0x405ae4[_0x7413('0x70')](function(_0x102fd2){_0x4d4faa['or'](_0x7413('0x71'),'%,'+_0x102fd2+',%');});_0x1ea50f=_['union'](_0x1ea50f,_0x405ae4);break;case _0x7413('0x72'):if(_0x2bebea[_0x7413('0x73')]==='$substring'){_0x1d5ff2[_0x5163ca](_0x7413('0x74'),'%'+_0x2bebea['value']+'%',null);}else{_0x28eaf4=_['find'](_0x35d198,[_0x7413('0x3a'),_0x7413('0x75')]);_0x2bebea[_0x7413('0x51')]=_0x7413('0x75');_0x46983f=as[_0x7413('0x6b')](_0xf4641,_0x28eaf4[_0x7413('0x43')],_0x2bebea);_0x1d5ff2[_0x5163ca](_0x46983f[_0x7413('0x6c')],_0x46983f[_0x7413('0x63')]['start'],_0x46983f[_0x7413('0x63')]['end']);}break;case _0x7413('0x76'):_0x46983f=as[_0x7413('0x6b')]('me',null,_0x2bebea);_0x1d5ff2[_0x5163ca](_0x46983f[_0x7413('0x6c')],_0x46983f[_0x7413('0x63')][_0x7413('0x6d')],_0x46983f[_0x7413('0x63')][_0x7413('0x77')]);break;}}else{var _0x46983f=as[_0x7413('0x6b')](_0xf4641,_0x28eaf4['type'],_0x2bebea);_0x1d5ff2[_0x5163ca](_0x46983f[_0x7413('0x6c')],_0x46983f[_0x7413('0x63')]['start'],_0x46983f[_0x7413('0x63')][_0x7413('0x77')]);}}}else{var _0x599a91=_(_0xfe0daa[_0x7413('0x46')])['keys']()[_0x7413('0x3d')](function(_0x3d4ce3){return _['some'](_0x35d198,['name',_0x3d4ce3])?_0x3d4ce3:undefined;})[_0x7413('0x78')]()[_0x7413('0x63')]();if(!_[_0x7413('0x79')](_0x599a91)){_0x599a91['forEach'](function(_0x3fff33){if(_0x3fff33===_0x7413('0x7a')){_0x6734e4[_0x7413('0x4e')](_0x7413('0x7b'),[][_0x7413('0x7c')](_0xfe0daa[_0x7413('0x46')][_0x3fff33]));}else if(_0x3fff33==='createdAt'){var _0x3b6975=JSON[_0x7413('0x7d')](_0xfe0daa[_0x7413('0x46')][_0x3fff33])['$gte'];var _0x350b01=JSON[_0x7413('0x7d')](_0xfe0daa[_0x7413('0x46')][_0x3fff33])[_0x7413('0x7e')];_0x6734e4[_0x7413('0x4e')](_0x7413('0x7f'),_0x3b6975,_0x350b01);}else{if(_0xfe0daa[_0x7413('0x46')][_0x3fff33]===_0x7413('0x80')){_0x6734e4[_0x7413('0x4e')]('i.'+_0x3fff33+'\x20IS\x20NULL');}else{_0x6734e4[_0x7413('0x4e')]('i.'+_0x3fff33+_0x7413('0x81'),_0xfe0daa[_0x7413('0x46')][_0x3fff33]);}}});}if(_0xfe0daa[_0x7413('0x46')][_0x7413('0x82')]){if(_0xfe0daa[_0x7413('0x46')]['read']==0x1){_0x6734e4[_0x7413('0x64')]('`unreadMessages`\x20=\x200');}else{_0x6734e4['having'](_0x7413('0x83'));}}if(_0xfe0daa[_0x7413('0x46')]['tag']){_0x1ea50f=_[_0x7413('0x84')](_0xfe0daa[_0x7413('0x46')][_0x7413('0x85')])?_0xfe0daa[_0x7413('0x46')][_0x7413('0x85')]:new Array(_0xfe0daa[_0x7413('0x46')][_0x7413('0x85')]);_0x1ea50f[_0x7413('0x70')](function(_0x5f4765){_0x4d4faa['or'](_0x7413('0x71'),'%,'+_0x5f4765+',%');});}if(_0xfe0daa['query'][_0x7413('0x86')]){var _0x3ad956=_0xfe0daa['query'][_0x7413('0x86')][_0x7413('0x87')]('\x5c','\x5c\x5c')[_0x7413('0x87')]('\x27\x27',_0x7413('0x88'));if(qs[_0x7413('0x89')](_0x3ad956)){_0x1d5ff2['or'](_0x7413('0x8a'),_0x3ad956+'%');}else{_0x1d5ff2['or'](_0x7413('0x8b'),qs[_0x7413('0x68')](_0x3ad956))['or'](_0x7413('0x8c'),_0x3ad956+'%');}}}_0x6734e4[_0x7413('0x4e')](_0x1d5ff2);_0x6734e4['group'](_0x7413('0x8d'));var _0x290acf={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x29ac62=_0x6734e4['clone']();_0x29ac62[_0x7413('0x51')](_0x7413('0x8d'));_0x29ac62[_0x7413('0x51')](_0x7413('0x8e'),_0x7413('0x62'));if(_0x125466[_0x7413('0x8f')]){_0x125466[_0x7413('0x8f')][_0x7413('0x70')](function(_0x3efa75){_0x6734e4['order']('i.'+_0x3efa75[0x0],_0x3efa75[0x1]===_0x7413('0x90')?![]:!![]);});}if(!_[_0x7413('0x79')](_0x1ea50f)){_0x6734e4[_0x7413('0x64')](_0x4d4faa);_0x29ac62['where'](_0x7413('0x91'),_0x1ea50f);}BPromise[_0x7413('0x92')]()[_0x7413('0x25')](function(){if(!_0x262f77){if(_0xfe0daa[_0x7413('0x46')][_0x7413('0x7a')]||_0xfe0daa[_0x7413('0x46')][_0x7413('0x93')])return;_0x29ac62[_0x7413('0x4e')](_0x7413('0x94'));_0x6734e4[_0x7413('0x4e')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0xfe0daa[_0x7413('0x95')][_0x7413('0x96')]({'attributes':['id'],'raw':!![]})['then'](function(_0x43f813){if(_[_0x7413('0x79')](_0x43f813)){_0x29ac62['where'](_0x7413('0x97'));_0x6734e4[_0x7413('0x4e')](_0x7413('0x97'));}else{_0x29ac62['where'](_0x7413('0x7b'),_['map'](_0x43f813,'id'));_0x6734e4[_0x7413('0x4e')](_0x7413('0x7b'),_[_0x7413('0x3d')](_0x43f813,'id'));}});})[_0x7413('0x25')](function(){db[_0x7413('0x98')][_0x7413('0x46')](_0x29ac62['toString'](),_0x290acf)[_0x7413('0x25')](function(_0x40e10d){_0x1f88e7[_0x7413('0x31')]=_0x40e10d[_0x7413('0x4c')];if(_0x1f88e7[_0x7413('0x31')]===0x0)return[];return db['sequelize'][_0x7413('0x46')](_0xde6773[_0x7413('0x99')](),_0x290acf)[_0x7413('0x25')](function(_0x3c4661){_0x153a9c=_[_0x7413('0x9a')](_0x3c4661,'id');_0x290acf=_['merge'](_0x290acf,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xfe0daa[_0x7413('0x46')][_0x7413('0x4b')]){_0x125466[_0x7413('0x4a')][_0x7413('0x70')](function(_0x4ec202){_0x6734e4['field']('i.'+_0x4ec202);});}else{_0x6734e4[_0x7413('0x51')](_0x7413('0x8e'),_0x7413('0x62'));_0x6734e4['field']('a.key',_0x7413('0x9b'));_0x6734e4[_0x7413('0x51')](_0x7413('0x9c'),_0x7413('0x9d'));_0x6734e4[_0x7413('0x51')](_0x7413('0x9e'));_0x6734e4[_0x7413('0x51')]('c.firstName','Contact.firstName');_0x6734e4[_0x7413('0x51')](_0x7413('0x9f'),'Contact.lastName');_0x6734e4[_0x7413('0x51')](_0x7413('0xa0'),_0x7413('0xa1'));_0x6734e4[_0x7413('0x51')](_0x7413('0xa2'),_0x7413('0xa3'));_0x6734e4[_0x7413('0x51')](_0x7413('0xa4'),_0x7413('0xa5'));_0x6734e4['field'](_0x7413('0xa6'),_0x7413('0xa7'));_0x6734e4[_0x7413('0x51')](_0x7413('0xa8'),_0x7413('0xa9'));_0x6734e4[_0x7413('0x51')]('o.internal','Owner.internal');_0x6734e4['field'](_0x7413('0xaa'),_0x7413('0x3f'));}if(_0x125466[_0x7413('0x33')])_0x6734e4[_0x7413('0x33')](_0x125466[_0x7413('0x33')]);if(_0x125466[_0x7413('0x32')])_0x6734e4[_0x7413('0x32')](_0x125466[_0x7413('0x32')]);return db['sequelize'][_0x7413('0x46')](_0x6734e4['toString'](),_0x290acf);})[_0x7413('0x25')](function(_0x30985e){_0x4299a3[_0x7413('0x4e')](_0x7413('0xab'),_[_0x7413('0x3d')](_0x30985e,'id'));return db['sequelize'][_0x7413('0x46')](_0x4299a3[_0x7413('0x99')](),_0x290acf)[_0x7413('0x25')](function(_0x145fcb){var _0xf11f9b=_[_0x7413('0xac')](_0x145fcb,_0x7413('0xad'));var _0xa43b1b=[];_0x30985e[_0x7413('0x70')](function(_0x31f54f){_0xa43b1b[_0x7413('0xae')](updateChatInteraction(_0x31f54f,_0x153a9c,_0xf11f9b));});return BPromise[_0x7413('0xaf')](_0xa43b1b);});});})[_0x7413('0x25')](function(_0x398823){_0x1f88e7[_0x7413('0xb0')]=_0x398823;return _0x1f88e7;})['then'](respondWithFilteredResult(_0x3f7da2,_0x125466));})['catch'](handleError(_0x3f7da2,null));};exports[_0x7413('0xb1')]=function(_0xae889e,_0x591ee4){var _0x2144b3={'raw':![],'where':{'id':_0xae889e[_0x7413('0xb2')]['id']}},_0x571a6c={};_0x571a6c[_0x7413('0x45')]=_[_0x7413('0x47')](db[_0x7413('0x41')][_0x7413('0x42')]);_0x571a6c[_0x7413('0x46')]=_[_0x7413('0x47')](_0xae889e[_0x7413('0x46')]);_0x571a6c['filters']=_[_0x7413('0x49')](_0x571a6c['model'],_0x571a6c[_0x7413('0x46')]);_0x2144b3['attributes']=_[_0x7413('0x49')](_0x571a6c[_0x7413('0x45')],qs[_0x7413('0x4b')](_0xae889e['query'][_0x7413('0x4b')]));_0x2144b3[_0x7413('0x4a')]=_0x2144b3[_0x7413('0x4a')][_0x7413('0x4c')]?_0x2144b3[_0x7413('0x4a')]:_0x571a6c[_0x7413('0x45')];if(_0xae889e['query'][_0x7413('0xb3')]){_0x2144b3['include']=[{'all':!![]}];}_0x2144b3=_['merge']({},_0x2144b3,_0xae889e[_0x7413('0xb4')]);return db[_0x7413('0x41')][_0x7413('0x61')](_0x2144b3)['then'](handleEntityNotFound(_0x591ee4,null))[_0x7413('0x25')](respondWithResult(_0x591ee4,null))[_0x7413('0x2d')](handleError(_0x591ee4,null));};exports[_0x7413('0xb5')]=function(_0x422c6d,_0x3772c2){return db[_0x7413('0x41')]['create'](_0x422c6d['body'],{})['then'](respondWithResult(_0x3772c2,0xc9))[_0x7413('0x2d')](handleError(_0x3772c2,null));};exports[_0x7413('0x37')]=function(_0x4f54f7,_0x2b202a){if(_0x4f54f7[_0x7413('0x76')]['id']){delete _0x4f54f7[_0x7413('0x76')]['id'];}return db[_0x7413('0x41')]['find']({'where':{'id':_0x4f54f7[_0x7413('0xb2')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x2b202a,null))['then'](saveUpdates(_0x4f54f7[_0x7413('0x76')],null))[_0x7413('0x25')](respondWithResult(_0x2b202a,null))[_0x7413('0x2d')](handleError(_0x2b202a,null));};exports[_0x7413('0x38')]=function(_0x5a9c7e,_0x1b8863){return db[_0x7413('0x41')]['find']({'where':{'id':_0x5a9c7e[_0x7413('0xb2')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x1b8863,null))['then'](removeEntity(_0x1b8863,null))[_0x7413('0x2d')](handleError(_0x1b8863,null));};exports['describe']=function(_0x4caf14,_0x150669){return db[_0x7413('0x41')][_0x7413('0xb6')]()[_0x7413('0x25')](respondWithResult(_0x150669,null))[_0x7413('0x2d')](handleError(_0x150669,null));};exports[_0x7413('0xb7')]=function(_0x2bac58,_0x5863c8){var _0x24092e=_0x2bac58['params']['id'];var _0x4ca0d5;var _0x143c25;var _0x3642db;return db['ChatInteraction'][_0x7413('0xb8')]({'where':{'id':_0x24092e}})[_0x7413('0x25')](function(_0x3d968e){_0x4ca0d5=_0x3d968e;return db[_0x7413('0xb9')][_0x7413('0xb8')]({'where':{'id':_0x3d968e[_0x7413('0x7a')]},'attributes':['id','vidaooApiKey',_0x7413('0xba')],'raw':!![]});})[_0x7413('0x25')](function(_0x14f143){if(_0x14f143&&_0x14f143[_0x7413('0xbb')]&&_0x14f143['vidaooEscalation']){_0x143c25=_0x14f143;var _0x2de249={'rejectUnauthorized':![],'method':_0x7413('0xbc'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x14f143[_0x7413('0xbb')]},'body':{'name':_0x7413('0xbd')+_0x24092e},'redirect':_0x7413('0xbe'),'json':!![]};return rp(_0x2de249);}else{throw new db['Sequelize'][(_0x7413('0xbf'))](_0x7413('0xc0'));}})[_0x7413('0x25')](function(_0x1aa397){_0x3642db=_0x1aa397;if(_0x3642db['id']){var _0xb789fc={'body':_0x3642db[_0x7413('0xc1')],'ChatWebsiteId':_0x143c25['id'],'ChatInteractionId':_0x4ca0d5['id'],'direction':'out','UserId':_0x2bac58['user']['id']};return db[_0x7413('0xc2')][_0x7413('0xb5')](_0xb789fc,{});}else{throw new db[(_0x7413('0x22'))][(_0x7413('0xbf'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x7413('0x25')](function(){return _0x4ca0d5[_0x7413('0xc3')]({'vidaooSessionId':_0x3642db['id']});})[_0x7413('0x25')](respondWithResult(_0x5863c8,null))[_0x7413('0x2d')](handleError(_0x5863c8,null));};exports['customUpdate']=function(_0x56422f,_0x13b42b){if(_0x56422f[_0x7413('0x76')]['id']){delete _0x56422f['body']['id'];}return db[_0x7413('0x41')][_0x7413('0x61')]({'where':{'id':_0x56422f['params']['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x13b42b,null))[_0x7413('0x25')](saveUpdates(_0x56422f[_0x7413('0x76')],null))[_0x7413('0x25')](respondWithResult(_0x13b42b,null))['catch'](handleError(_0x13b42b,null));};exports['abandon']=function(_0x533a4c,_0x4ee56c,_0x2f9603){if(_0x533a4c[_0x7413('0x76')]['id']){delete _0x533a4c[_0x7413('0x76')]['id'];}return db[_0x7413('0x41')][_0x7413('0x61')]({'where':{'id':_0x533a4c[_0x7413('0xb2')]['id']}})[_0x7413('0x25')](function(_0x3d4d43){if(!_0x3d4d43){logger[_0x7413('0x2b')](_0x7413('0xc4'),_0x7413('0xc5'),0x194,'entity\x20not\x20found');_0x4ee56c['sendStatus'](0x194);}else{if(_0x3d4d43['UserId']){throw new db[(_0x7413('0x22'))][(_0x7413('0xbf'))](_0x7413('0xc6'));}}return _0x3d4d43;})['then'](function(_0x4af3d2){if(_0x4af3d2){return _0x4af3d2[_0x7413('0x37')]({'closed':_0x533a4c[_0x7413('0x76')][_0x7413('0xc7')],'disposition':_0x533a4c['body'][_0x7413('0xc8')]})['then'](function(_0x1cc173){return _0x1cc173;});}})[_0x7413('0x25')](function(_0x205730){return respondWithRpcPromise(_0x7413('0xc9'),'abandon',_0x533a4c['body'],client9004);})['then'](respondWithResult(_0x4ee56c,null))['catch'](handleError(_0x4ee56c,null));};exports['attachmentUpload']=function(_0x4f3411,_0xa7c2fb,_0x2b4135){_0x4f3411['body'][_0x7413('0x3a')]=_0x4f3411[_0x7413('0xca')]['originalname'];_0x4f3411[_0x7413('0x76')][_0x7413('0xcb')]=_0x4f3411[_0x7413('0xca')]['filename'];_0x4f3411['body']['type']=_0x4f3411[_0x7413('0xca')][_0x7413('0xcc')];return db[_0x7413('0xcd')][_0x7413('0xb5')](_0x4f3411[_0x7413('0x76')])['then'](respondWithResult(_0xa7c2fb,0xc9))['catch'](handleError(_0xa7c2fb,null));};exports[_0x7413('0xce')]=function(_0x3e2d80,_0x2ac897,_0x37fe92){return db['ChatInteraction'][_0x7413('0xb8')]({'where':{'id':_0x3e2d80[_0x7413('0xb2')]['id']},'raw':!![]})[_0x7413('0x25')](handleEntityNotFound(_0x2ac897,null))[_0x7413('0x25')](function(_0x2c0a9b){if(_0x2c0a9b){if(_0x2c0a9b[_0x7413('0xc7')]){return _0x2ac897[_0x7413('0x2f')](0x193)[_0x7413('0x30')]({'status':0x193,'message':_0x7413('0xcf')});}return db[_0x7413('0xcd')]['findOne']({'where':{'id':_0x3e2d80[_0x7413('0x46')][_0x7413('0xd0')]},'raw':!![]})[_0x7413('0x25')](handleEntityNotFound(_0x2ac897,null));}})[_0x7413('0x25')](function(_0x202174){if(_0x202174){return _0x2ac897[_0x7413('0xd1')](path['join'](config[_0x7413('0xd2')],_0x7413('0xd3'),_0x202174[_0x7413('0xcb')]));}})[_0x7413('0x2d')](handleError(_0x2ac897,null));};exports[_0x7413('0xd4')]=function(_0x372ebc,_0x5efa42){var _0x561c08=null;var _0x39aac5=null;var _0x3954b6=null;var _0x13f578=null;if(_0x372ebc[_0x7413('0x76')]['id']){delete _0x372ebc[_0x7413('0x76')]['id'];}if(_0x372ebc[_0x7413('0x76')]['mailTranscript']){_0x13f578=path['join'](config[_0x7413('0xd2')],_0x7413('0xd5'),util[_0x7413('0xd6')](_0x7413('0xd7'),Date['now']()));_0x372ebc[_0x7413('0x76')][_0x7413('0xd8')]=_0x13f578;}return db['ChatInteraction'][_0x7413('0x61')]({'where':{'id':_0x372ebc[_0x7413('0xb2')]['id']},'include':[{'model':db[_0x7413('0xc2')],'as':_0x7413('0xd9'),'include':[{'model':db['User'],'as':_0x7413('0x72')}]}]})[_0x7413('0x25')](handleEntityNotFound(_0x5efa42,null))[_0x7413('0x25')](saveUpdates(_0x372ebc[_0x7413('0x76')],null))['then'](function(_0x54a70a){if(_0x54a70a){_0x561c08=_0x54a70a;return db[_0x7413('0xb9')][_0x7413('0x61')]({'where':{'id':_0x561c08[_0x7413('0x7a')]}});}})[_0x7413('0x25')](function(_0x1c5d99){if(_0x1c5d99){_0x3954b6=_0x1c5d99;return db[_0x7413('0xda')][_0x7413('0x61')]({'where':{'id':_0x561c08['ContactId']}});}})[_0x7413('0x25')](function(_0x24c091){if(_0x24c091){_0x39aac5=_0x24c091;if(_0x13f578){var _0x558e82=null;for(var _0x538654=0x1;_0x538654<_0x561c08[_0x7413('0xd9')]['length'];++_0x538654){_0x558e82=_0x561c08['Messages'][_0x538654];var _0x26cd01=_0x558e82[_0x7413('0x75')]?util[_0x7413('0xd6')](_0x7413('0xdb'),_0x3954b6[_0x7413('0xdc')],_0x558e82[_0x7413('0x75')]):_0x7413('0xdd');var _0x12fcf7=_0x372ebc['body'][_0x7413('0xde')]||util[_0x7413('0xd6')]('%s%d',_0x7413('0xdf'),_0x558e82[_0x7413('0x6a')]);switch(_0x3954b6[_0x7413('0xe0')]){case _0x7413('0xe1'):_0x26cd01=_0x558e82['UserId']?util[_0x7413('0xd6')](_0x7413('0xdb'),_0x3954b6[_0x7413('0xdc')],_0x558e82['UserId']):_0x7413('0xdd');break;case _0x7413('0xe2'):_0x26cd01=_0x558e82[_0x7413('0x75')]?_0x558e82['User'][_0x7413('0xe3')]||_0x558e82['User'][_0x7413('0x3e')]:'System';break;case'agent_fullname':_0x26cd01=_0x558e82[_0x7413('0x75')]?_0x558e82[_0x7413('0x72')][_0x7413('0x3e')]:_0x7413('0xdd');break;default:_0x26cd01=_0x558e82['UserId']?util[_0x7413('0xd6')]('%s%d',_0x3954b6[_0x7413('0xdc')],_0x558e82[_0x7413('0x75')]):'System';}var _0x65bed2=util[_0x7413('0xd6')](_0x7413('0xe4'),moment(_0x558e82[_0x7413('0xe5')])[_0x7413('0xd6')](_0x7413('0xe6')),_0x558e82[_0x7413('0xe7')]==='in'?_0x12fcf7:_0x26cd01,_0x558e82[_0x7413('0x76')]);if(!_0x558e82[_0x7413('0xe8')]){fs[_0x7413('0xe9')](_0x13f578,_0x65bed2);}}return db[_0x7413('0xea')][_0x7413('0xb8')]({'where':{'service':!![]},'include':[{'model':db[_0x7413('0xeb')],'as':_0x7413('0xec'),'raw':!![]}]});}}})[_0x7413('0x25')](function(_0x2abdb9){if(_0x2abdb9&&_0x2abdb9['Smtp']&&_0x372ebc['body']){var _0x32e473={'tls':{'rejectUnauthorized':![]}};if(_0x2abdb9[_0x7413('0xec')]['service']){_0x32e473[_0x7413('0xed')]=_0x2abdb9['Smtp']['service'];}else{_0x32e473[_0x7413('0xee')]=_0x2abdb9['Smtp'][_0x7413('0xee')];_0x32e473[_0x7413('0xef')]=_0x2abdb9[_0x7413('0xec')][_0x7413('0xef')];_0x32e473['secure']=_0x2abdb9[_0x7413('0xec')][_0x7413('0xf0')];}if(_0x2abdb9[_0x7413('0xec')][_0x7413('0xf1')]){_0x32e473['auth']={'user':_0x2abdb9['Smtp'][_0x7413('0x95')],'pass':_0x2abdb9[_0x7413('0xec')]['pass']};}return respondWithRpcPromise('SendMail',_0x7413('0xf2'),{'account':_0x32e473,'message':{'from':util['format'](_0x7413('0xf3'),_0x2abdb9[_0x7413('0x3a')],_0x2abdb9['email']||_0x2abdb9[_0x7413('0xec')][_0x7413('0x95')]),'to':_0x372ebc['body'][_0x7413('0xf4')],'subject':_0x7413('0xf5'),'text':util[_0x7413('0xd6')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x372ebc[_0x7413('0x76')]['mailTranscript']),'attachments':[{'path':_0x13f578}]}})[_0x7413('0x25')](function(){return _0x561c08;})['catch'](function(_0x1fc604){console[_0x7413('0x2b')](_0x1fc604);});}else{return _0x561c08;}})[_0x7413('0x25')](respondWithStatusCode(_0x5efa42,0xc8))['catch'](handleError(_0x5efa42,null));};exports[_0x7413('0xf6')]=function(_0x39b512,_0xd20e1b,_0x2428d0){return db[_0x7413('0xc2')][_0x7413('0x61')]({'where':{'id':_0x39b512['params']['id']}})['then'](handleEntityNotFound(_0xd20e1b,null))[_0x7413('0x25')](function(_0x529f85){if(_0x529f85){return _0x529f85['addMessage'](_0x39b512['body'][_0x7413('0xf7')],_[_0x7413('0xf8')](_0x39b512[_0x7413('0x76')],[_0x7413('0xf7'),'id'])||{});}})['then'](respondWithResult(_0xd20e1b,null))[_0x7413('0x2d')](handleError(_0xd20e1b,null));};exports[_0x7413('0xf9')]=function(_0x437390,_0x29044a,_0x53808c){var _0x22614a={'raw':![],'where':{}};var _0x1687c4={};var _0x305310={'count':0x0,'rows':[]};return db[_0x7413('0x41')]['findOne']({'where':{'id':_0x437390['params']['id']}})['then'](handleEntityNotFound(_0x29044a,null))[_0x7413('0x25')](function(_0x50e131){if(_0x50e131){_0x1687c4['model']=_[_0x7413('0x47')](db[_0x7413('0xc2')][_0x7413('0x42')]);_0x1687c4['query']=_[_0x7413('0x47')](_0x437390[_0x7413('0x46')]);_0x1687c4[_0x7413('0x48')]=_[_0x7413('0x49')](_0x1687c4[_0x7413('0x45')],_0x1687c4['query']);_0x22614a[_0x7413('0x4a')]=_['intersection'](_0x1687c4['model'],qs[_0x7413('0x4b')](_0x437390['query'][_0x7413('0x4b')]));_0x22614a[_0x7413('0x4a')]=_0x22614a['attributes']['length']?_0x22614a[_0x7413('0x4a')]:_0x1687c4[_0x7413('0x45')];if(!_0x437390[_0x7413('0x46')][_0x7413('0xfa')]('nolimit')){_0x22614a['limit']=qs['limit'](_0x437390[_0x7413('0x46')]['limit']);_0x22614a[_0x7413('0x32')]=qs['offset'](_0x437390[_0x7413('0x46')]['offset']);}_0x22614a['order']=qs[_0x7413('0x4d')](_0x437390['query'][_0x7413('0x4d')]);_0x22614a[_0x7413('0x4e')]=qs['filters'](_['pick'](_0x437390['query'],_0x1687c4[_0x7413('0x48')]));_0x22614a['where'][_0x7413('0xad')]=_0x50e131['id'];if(_0x437390[_0x7413('0x46')][_0x7413('0x86')]){_0x22614a[_0x7413('0x4e')]=_[_0x7413('0xfb')](_0x22614a[_0x7413('0x4e')],{'$or':_['map'](_0x22614a['attributes'],function(_0x5bbc6c){var _0x3f29db={};_0x3f29db[_0x5bbc6c]={'$like':'%'+_0x437390[_0x7413('0x46')][_0x7413('0x86')]+'%'};return _0x3f29db;})});}if(_0x437390[_0x7413('0x46')][_0x7413('0xfc')]){var _0x1f5fce=_0x437390[_0x7413('0x46')][_0x7413('0xfc')][_0x7413('0x6f')](',');var _0x1de3bf={};_0x1de3bf[_0x1f5fce[0x0]]={'$gte':moment(_0x1f5fce[0x1])[_0x7413('0xd6')](_0x7413('0xfd'))};_0x22614a[_0x7413('0x4e')]=_[_0x7413('0xfb')](_0x22614a[_0x7413('0x4e')],_0x1de3bf);}_0x22614a=_[_0x7413('0xfb')]({},_0x22614a,_0x437390[_0x7413('0xb4')]);return db[_0x7413('0xc2')][_0x7413('0x31')]({'where':_0x22614a[_0x7413('0x4e')]})[_0x7413('0x25')](function(_0x26d10d){_0x305310['count']=_0x26d10d;if(_0x437390[_0x7413('0x46')][_0x7413('0xb3')]){_0x22614a[_0x7413('0xfe')]=[{'all':!![]}];}return db[_0x7413('0xc2')][_0x7413('0xff')](_0x22614a);})['then'](function(_0x293ba7){_0x305310[_0x7413('0xb0')]=_0x293ba7;return _0x305310;});}})[_0x7413('0x25')](respondWithFilteredResult(_0x29044a,_0x22614a))[_0x7413('0x2d')](handleError(_0x29044a,null));};exports['getMyMessages']=function(_0x5ecd20,_0x27014c,_0x26b96c){var _0x646615={'where':{}},_0x441c99={},_0x39abc4={'count':0x0,'rows':[]};return db[_0x7413('0x41')][_0x7413('0xb8')]({'where':{'id':_0x5ecd20[_0x7413('0xb2')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x27014c,null))[_0x7413('0x25')](function(_0x3e8312){if(_0x3e8312){_0x441c99['model']=_[_0x7413('0x47')](db[_0x7413('0xc2')][_0x7413('0x42')]);_0x441c99[_0x7413('0x46')]=_['keys'](_0x5ecd20[_0x7413('0x46')]);_0x441c99[_0x7413('0x48')]=_[_0x7413('0x49')](_0x441c99[_0x7413('0x45')],_0x441c99['query']);_0x646615[_0x7413('0x4a')]=_[_0x7413('0x49')](_0x441c99[_0x7413('0x45')],qs[_0x7413('0x4b')](_0x5ecd20[_0x7413('0x46')][_0x7413('0x4b')]));_0x646615['attributes']=_0x646615[_0x7413('0x4a')][_0x7413('0x4c')]?_0x646615['attributes']:_0x441c99[_0x7413('0x45')];if(!_0x5ecd20[_0x7413('0x46')]['hasOwnProperty'](_0x7413('0x100'))){_0x646615['limit']=qs[_0x7413('0x33')](_0x5ecd20[_0x7413('0x46')][_0x7413('0x33')]);_0x646615[_0x7413('0x32')]=qs[_0x7413('0x32')](_0x5ecd20[_0x7413('0x46')]['offset']);}_0x646615['order']=qs['sort'](_0x5ecd20[_0x7413('0x46')]['sort']);_0x646615[_0x7413('0x4e')]=qs['filters'](_['pick'](_0x5ecd20[_0x7413('0x46')],_0x441c99[_0x7413('0x48')]));_0x646615[_0x7413('0x4e')]['ChatInteractionId']=_0x3e8312['id'];if(_0x5ecd20[_0x7413('0x46')][_0x7413('0x86')]){_0x646615['where']=_[_0x7413('0xfb')](_0x646615['where'],{'$or':_[_0x7413('0x3d')](_0x646615[_0x7413('0x4a')],function(_0x107c4d){var _0x6842db={};_0x6842db[_0x107c4d]={'$like':'%'+_0x5ecd20['query'][_0x7413('0x86')]+'%'};return _0x6842db;})});}_0x646615[_0x7413('0x4e')][_0x7413('0xe8')]=![];if(_0x5ecd20['query']['id']){_0x646615[_0x7413('0x4e')]['id']={'$gt':_0x5ecd20[_0x7413('0x46')]['id']};}_0x646615=_[_0x7413('0xfb')]({},_0x646615,_0x5ecd20[_0x7413('0xb4')]);return db[_0x7413('0xc2')]['count']({'where':_0x646615[_0x7413('0x4e')]})[_0x7413('0x25')](function(_0x3bbcf7){_0x39abc4[_0x7413('0x31')]=_0x3bbcf7;_0x646615[_0x7413('0xfe')]=[];if(_0x5ecd20['query'][_0x7413('0x101')]){_0x646615[_0x7413('0xfe')][_0x7413('0xae')]({'model':db[_0x7413('0x72')],'as':_0x7413('0x72'),'attributes':['id',_0x7413('0x3e'),_0x7413('0xe3')]});}if(_0x5ecd20[_0x7413('0x46')][_0x7413('0xb3')]){_0x646615[_0x7413('0xfe')]=[{'all':!![]}];}return db[_0x7413('0xc2')][_0x7413('0xff')](_0x646615);})['then'](function(_0x485eb){_0x39abc4['rows']=_0x485eb;return _0x39abc4;});}})['then'](respondWithFilteredResult(_0x27014c,_0x646615))[_0x7413('0x2d')](handleError(_0x27014c,null));};exports[_0x7413('0x102')]=function(_0x3a9de3,_0x2b3bcb,_0xb4ab49){return db[_0x7413('0x41')][_0x7413('0x61')]({'where':{'id':_0x3a9de3[_0x7413('0xb2')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x2b3bcb,null))[_0x7413('0x25')](function(_0x4e1b22){if(_0x4e1b22){return _0x4e1b22[_0x7413('0x103')](_0x3a9de3[_0x7413('0x76')]['ids'],_[_0x7413('0xf8')](_0x3a9de3[_0x7413('0x76')],[_0x7413('0xf7'),'id'])||{})[_0x7413('0x104')](function(){return db['Tag'][_0x7413('0xff')]({'attributes':['id',_0x7413('0x3a'),_0x7413('0x105')],'where':{'id':_0x3a9de3[_0x7413('0x76')][_0x7413('0xf7')]}});})[_0x7413('0x25')](function(_0x212f65){socket['emit'](_0x7413('0x106'),{'id':Number(_0x3a9de3[_0x7413('0xb2')]['id']),'tags':_0x212f65||[]});return{'id':Number(_0x3a9de3['params']['id']),'tags':_0x212f65||[]};});}})['then'](respondWithResult(_0x2b3bcb,null))['catch'](handleError(_0x2b3bcb,null));};exports[_0x7413('0x107')]=function(_0x2c8a05,_0x28d2aa,_0x2c4d3e){return db[_0x7413('0x41')]['find']({'where':{'id':_0x2c8a05['params']['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x28d2aa,null))[_0x7413('0x25')](function(_0x528175){if(_0x528175){return _0x528175[_0x7413('0x107')](_0x2c8a05[_0x7413('0x46')][_0x7413('0xf7')]);}})[_0x7413('0x25')](respondWithStatusCode(_0x28d2aa,null))['catch'](handleError(_0x28d2aa,null));};exports[_0x7413('0xd1')]=function(_0x253505,_0x1c1031){var _0x3741dd=moment()[_0x7413('0x108')]()['toString']();var _0x3bee58=path[_0x7413('0x109')](config[_0x7413('0xd2')],_0x7413('0x10a'),_0x7413('0x10b'),_0x7413('0x10c'));var _0x18972f=path['join'](config[_0x7413('0xd2')],_0x7413('0x10a'),_0x7413('0x10b'),_0x7413('0x10d'));var _0x1470df=path[_0x7413('0x109')](_0x3bee58,_0x3741dd);var _0x443536=util[_0x7413('0xd6')](_0x7413('0x10e'),_0x253505[_0x7413('0xb2')]['id'],_0x3741dd);var _0x3182f9=path[_0x7413('0x109')](_0x3bee58,_0x443536);var _0x35f619=[];_0x35f619[_0x7413('0xae')]({'model':db[_0x7413('0x72')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x35f619[_0x7413('0xae')]({'model':db[_0x7413('0xda')],'as':_0x7413('0x66'),'attributes':['id',_0x7413('0x10f'),_0x7413('0x110')],'raw':!![]});if(_0x253505[_0x7413('0x46')][_0x7413('0x10d')]){_0x35f619[_0x7413('0xae')]({'model':db[_0x7413('0xcd')],'as':_0x7413('0xcd'),'raw':!![]});}var _0x23da62=[{'model':db[_0x7413('0xc2')],'as':_0x7413('0xd9'),'attributes':['id',_0x7413('0x76'),_0x7413('0xe5'),_0x7413('0xe7'),_0x7413('0xe8'),_0x7413('0x82')],'include':_0x35f619}];_0x23da62[_0x7413('0xae')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0x7413('0x3a')]});_0x23da62[_0x7413('0xae')]({'model':db[_0x7413('0x72')],'as':_0x7413('0x111'),'attributes':['id',_0x7413('0x3e')]});return db[_0x7413('0x41')][_0x7413('0x61')]({'where':{'id':_0x253505[_0x7413('0xb2')]['id']},'include':_0x23da62})[_0x7413('0x25')](handleEntityNotFound(_0x1c1031,null))[_0x7413('0x25')](function(_0x28e623){if(_0x28e623){var _0x3551e8=_0x28e623[_0x7413('0x112')]({'plain':!![]});fs[_0x7413('0x113')](_0x1470df);var _0x37b7dc={'format':'A4','border':_0x7413('0x114'),'header':{'height':_0x7413('0x115'),'contents':{'first':_0x7413('0x116')}},'footer':{'height':_0x7413('0x117'),'contents':{'default':util[_0x7413('0xd6')](_0x7413('0x118'),util[_0x7413('0xd6')](_0x7413('0x119'),'Chat',_0x3551e8['id']),moment()[_0x7413('0xd6')](_0x7413('0x11a'))['toString']())}}};var _0x258061={'channel':_0x7413('0x11b'),'account':_0x3551e8[_0x7413('0x11c')][_0x7413('0x3a')],'agent':_0x3551e8[_0x7413('0x111')]?_0x3551e8['Owner']['fullname']:_0x7413('0x11d'),'createdAt':moment(_0x3551e8['createdAt'])[_0x7413('0xd6')](_0x7413('0xfd'))[_0x7413('0x99')](),'closedAt':_0x3551e8['closed']?moment(_0x3551e8['closedAt'])[_0x7413('0xd6')](_0x7413('0xfd'))[_0x7413('0x99')]():'','disposition':_0x3551e8[_0x7413('0xc8')],'chatInfo':{'browser':_0x3551e8['browserName'],'os':_0x3551e8['osName'],'referer':_0x3551e8[_0x7413('0x11e')],'customerIp':_0x3551e8[_0x7413('0x11f')],'customerPort':_0x3551e8['customerPort']?_0x3551e8['customerPort']:_0x7413('0x11d')},'messages':_(_0x3551e8[_0x7413('0xd9')])['tail']()['filter']({'secret':![]})[_0x7413('0x3d')](function(_0x2315cb){if(_0x2315cb[_0x7413('0xcd')]){var _0x3170ab=path[_0x7413('0x109')](_0x18972f,_0x2315cb['Attachment'][_0x7413('0xcb')]);if(fs[_0x7413('0x120')](_0x3170ab)){fs[_0x7413('0x121')](_0x3170ab)[_0x7413('0x122')](fs[_0x7413('0x123')](path['join'](_0x1470df,_0x2315cb[_0x7413('0xcd')][_0x7413('0xcb')])));}}return{'date':moment(_0x2315cb[_0x7413('0xe5')])[_0x7413('0xd6')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x2315cb[_0x7413('0xe7')]===_0x7413('0x124')?_0x2315cb[_0x7413('0x72')]?_0x2315cb[_0x7413('0x72')][_0x7413('0x3e')]:'System':_0x2315cb[_0x7413('0x66')]['firstName']+(_0x2315cb['Contact'][_0x7413('0x110')]?'\x20'+_0x2315cb['Contact'][_0x7413('0x110')]:''),'body':_0x2315cb[_0x7413('0xcd')]?_0x2315cb[_0x7413('0xcd')][_0x7413('0xcb')]:_0x2315cb[_0x7413('0x76')],'direction':_0x2315cb['direction']===_0x7413('0x124')?'A':'C','secret':_0x2315cb[_0x7413('0xe8')],'read':_0x2315cb[_0x7413('0x82')],'attachment':_0x2315cb[_0x7413('0xcd')]};})['value']()};return ejs[_0x7413('0x125')](path[_0x7413('0x109')](config[_0x7413('0xd2')],_0x7413('0x10a'),_0x7413('0x126'),_0x7413('0x127')),{'interaction':_0x258061})['then'](function(_0x45aa4f){return new BPromise(function(_0xab1a5d,_0x37a312){pdf[_0x7413('0xb5')](_0x45aa4f,_0x37b7dc)['toFile'](path[_0x7413('0x109')](_0x1470df,_0x7413('0x128')+_0x3551e8['id']+'-'+_0x3741dd+_0x7413('0x129')),function(_0x263c73,_0x1e6b24){if(_0x263c73)return _0x37a312(_0x263c73);_0xab1a5d(_0x1e6b24);});});})[_0x7413('0x25')](function(){return new BPromise(function(_0x4c59c5,_0x48fb07){zipdir(_0x1470df,{'saveTo':_0x3182f9},function(_0x303185,_0x510904){if(_0x303185)return _0x48fb07(_0x303185);return _0x4c59c5(_0x510904);});})[_0x7413('0x25')](function(){return new BPromise(function(_0x1efc10,_0x5a6d40){rimraf(_0x1470df,function(_0x180196){if(_0x180196)_0x5a6d40(_0x180196);return _0x1efc10();});});})[_0x7413('0x25')](function(){return _0x1c1031['download'](_0x3182f9,_0x443536,function(_0x5950d2){if(_0x5950d2){console[_0x7413('0x12a')](_0x7413('0x12b'),_0x5950d2);}else{fs['unlinkSync'](_0x3182f9);}});});});}else{return _0x1c1031[_0x7413('0x2e')](0xc8);}})[_0x7413('0x2d')](handleError(_0x1c1031,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index f1bca61..a48dc42 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 _0x4649=['then','Users','map','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x2b0ae9,_0x599d4f){var _0x3915c9=function(_0x3cef2d){while(--_0x3cef2d){_0x2b0ae9['push'](_0x2b0ae9['shift']());}};_0x3915c9(++_0x599d4f);}(_0x4649,0x199));var _0x9464=function(_0x576509,_0x5b489a){_0x576509=_0x576509-0x0;var _0x35815a=_0x4649[_0x576509];return _0x35815a;};'use strict';var EventEmitter=require(_0x9464('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x9464('0x1')];var ChatMessage=require(_0x9464('0x2'))['db'][_0x9464('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x9464('0x4')](0x0);var events={'afterCreate':_0x9464('0x5'),'afterUpdate':_0x9464('0x6'),'afterDestroy':_0x9464('0x7')};function emitEvent(_0x58331a){return function(_0xdfa97e,_0x488a7c,_0x44f19f){_0xdfa97e[_0x9464('0x8')]({'attributes':['id'],'raw':!![]})[_0x9464('0x9')](function(_0x8e7f8c){_0xdfa97e['setDataValue'](_0x9464('0xa'),_0x8e7f8c[_0x9464('0xb')](function(_0x2f0c31){return{'id':_0x2f0c31['id']};}));return ChatMessage[_0x9464('0xc')]({'where':{'ChatInteractionId':_0xdfa97e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9464('0x9')](function(_0x5d850a){_0xdfa97e[_0x9464('0xd')]('unreadMessages',_0x5d850a[_0x9464('0xe')]);ChatInteractionEvents[_0x9464('0xf')](_0x58331a+':'+_0xdfa97e['id'],_0xdfa97e);ChatInteractionEvents[_0x9464('0xf')](_0x58331a,_0xdfa97e);_0x44f19f(null);})[_0x9464('0x10')](_0x44f19f(null));};}for(var e in events){if(events[_0x9464('0x11')](e)){var event=events[e];ChatInteraction[_0x9464('0x12')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x369e=['ChatInteraction','ChatMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x369e,0x17a));var _0xe369=function(_0x1c73ee,_0x49a9c9){_0x1c73ee=_0x1c73ee-0x0;var _0x154f05=_0x369e[_0x1c73ee];return _0x154f05;};'use strict';var EventEmitter=require(_0xe369('0x0'));var ChatInteraction=require(_0xe369('0x1'))['db'][_0xe369('0x2')];var ChatMessage=require(_0xe369('0x1'))['db'][_0xe369('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xe369('0x4')](0x0);var events={'afterCreate':_0xe369('0x5'),'afterUpdate':'update','afterDestroy':_0xe369('0x6')};function emitEvent(_0x561c4c){return function(_0x17a7b6,_0x3302f0,_0x4038c8){_0x17a7b6[_0xe369('0x7')]({'attributes':['id'],'raw':!![]})[_0xe369('0x8')](function(_0x17acb8){_0x17a7b6[_0xe369('0x9')](_0xe369('0xa'),_0x17acb8[_0xe369('0xb')](function(_0x3b2eda){return{'id':_0x3b2eda['id']};}));return ChatMessage[_0xe369('0xc')]({'where':{'ChatInteractionId':_0x17a7b6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2f0775){_0x17a7b6[_0xe369('0x9')](_0xe369('0xd'),_0x2f0775[_0xe369('0xe')]);ChatInteractionEvents['emit'](_0x561c4c+':'+_0x17a7b6['id'],_0x17a7b6);ChatInteractionEvents[_0xe369('0xf')](_0x561c4c,_0x17a7b6);_0x4038c8(null);})['catch'](_0x4038c8(null));};}for(var e in events){if(events[_0xe369('0x10')](e)){var event=events[e];ChatInteraction[_0xe369('0x11')](e,emitEvent(event));}}module[_0xe369('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 c024436..5b0db90 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 _0x6aa2=['rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','path'];(function(_0x12e073,_0x4d43db){var _0x267748=function(_0x381284){while(--_0x381284){_0x12e073['push'](_0x12e073['shift']());}};_0x267748(++_0x4d43db);}(_0x6aa2,0x94));var _0x26aa=function(_0x4e5d67,_0x54dffc){_0x4e5d67=_0x4e5d67-0x0;var _0x4acdf3=_0x6aa2[_0x4e5d67];return _0x4acdf3;};'use strict';var _=require(_0x26aa('0x0'));var util=require(_0x26aa('0x1'));var logger=require(_0x26aa('0x2'))('api');var moment=require(_0x26aa('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x26aa('0x4'));var rimraf=require(_0x26aa('0x5'));var config=require(_0x26aa('0x6'));var attributes=require(_0x26aa('0x7'));module[_0x26aa('0x8')]=function(_0xdd1a94,_0x1143d9){return _0xdd1a94[_0x26aa('0x9')](_0x26aa('0xa'),attributes,{'tableName':_0x26aa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2f3d6c,_0x51a60a,_0x503863){if(_0x2f3d6c[_0x26aa('0xc')](_0x26aa('0xd'))){_0x2f3d6c['closedAt']=moment()[_0x26aa('0xe')](_0x26aa('0xf'));}_0x503863(null,_0x2f3d6c);}},'charset':'utf8mb4','collate':_0x26aa('0x10')});}; \ No newline at end of file +var _0x80c7=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closedAt'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0x80c7,0x1ea));var _0x780c=function(_0x16e2b0,_0x44723e){_0x16e2b0=_0x16e2b0-0x0;var _0x1483f3=_0x80c7[_0x16e2b0];return _0x1483f3;};'use strict';var _=require('lodash');var util=require(_0x780c('0x0'));var logger=require(_0x780c('0x1'))(_0x780c('0x2'));var moment=require(_0x780c('0x3'));var BPromise=require(_0x780c('0x4'));var rp=require(_0x780c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x780c('0x6'));var config=require(_0x780c('0x7'));var attributes=require(_0x780c('0x8'));module[_0x780c('0x9')]=function(_0x299ee1,_0x1e9ee9){return _0x299ee1[_0x780c('0xa')](_0x780c('0xb'),attributes,{'tableName':_0x780c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2efc45,_0x1b8b2e,_0x1b591e){if(_0x2efc45['changed']('closed')){_0x2efc45[_0x780c('0xd')]=moment()[_0x780c('0xe')](_0x780c('0xf'));}_0x1b591e(null,_0x2efc45);}},'charset':_0x780c('0x10'),'collate':_0x780c('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 7a56c2f..2e38b97 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 _0x9fc2=['message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','attributes','limit','AddTagsToChatInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x11579f,_0x26ab6b){var _0x56e613=function(_0x21c110){while(--_0x21c110){_0x11579f['push'](_0x11579f['shift']());}};_0x56e613(++_0x26ab6b);}(_0x9fc2,0x163));var _0x29fc=function(_0x27a444,_0x5902d4){_0x27a444=_0x27a444-0x0;var _0x370fdc=_0x9fc2[_0x27a444];return _0x370fdc;};'use strict';var _=require(_0x29fc('0x0'));var util=require(_0x29fc('0x1'));var moment=require('moment');var BPromise=require(_0x29fc('0x2'));var rs=require(_0x29fc('0x3'));var fs=require('fs');var Redis=require(_0x29fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x29fc('0x5'));var logger=require('../../config/logger')(_0x29fc('0x6'));var config=require(_0x29fc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x29fc('0x8')][_0x29fc('0x9')]({'port':0x232a});config[_0x29fc('0xa')]=_[_0x29fc('0xb')](config[_0x29fc('0xa')],{'host':_0x29fc('0xc'),'port':0x18eb});var socket=require(_0x29fc('0xd'))(new Redis(config[_0x29fc('0xa')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3e4494,_0x5f4b1d,_0x31b8e7){return new BPromise(function(_0x4fccf9,_0x4171a2){return client[_0x29fc('0xe')](_0x3e4494,_0x31b8e7)[_0x29fc('0xf')](function(_0x54084b){logger['info'](_0x29fc('0x10'),_0x5f4b1d,_0x29fc('0x11'));logger[_0x29fc('0x12')](_0x29fc('0x13'),_0x5f4b1d,_0x29fc('0x11'),JSON[_0x29fc('0x14')](_0x54084b));if(_0x54084b[_0x29fc('0x15')]){if(_0x54084b['error'][_0x29fc('0x16')]===0x1f4){logger[_0x29fc('0x15')](_0x29fc('0x10'),_0x5f4b1d,_0x54084b['error']['message']);return _0x4171a2(_0x54084b['error'][_0x29fc('0x17')]);}logger[_0x29fc('0x15')](_0x29fc('0x10'),_0x5f4b1d,_0x54084b[_0x29fc('0x15')][_0x29fc('0x17')]);return _0x4fccf9(_0x54084b[_0x29fc('0x15')]['message']);}else{logger[_0x29fc('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x5f4b1d,_0x29fc('0x11'));_0x4fccf9(_0x54084b[_0x29fc('0x19')][_0x29fc('0x17')]);}})[_0x29fc('0x1a')](function(_0xcd7c0d){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x5f4b1d,_0xcd7c0d);_0x4171a2(_0xcd7c0d);});});}exports[_0x29fc('0x1b')]=function(_0x13eabe){var _0x25a599=this;return new Promise(function(_0x29baa0,_0x3d3da8){return db[_0x29fc('0x1c')][_0x29fc('0x1d')](_0x13eabe[_0x29fc('0x1e')],{'raw':_0x13eabe[_0x29fc('0x1f')]?_0x13eabe['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13eabe[_0x29fc('0x1f')]?_0x13eabe[_0x29fc('0x1f')]['where']||null:null,'attributes':_0x13eabe[_0x29fc('0x1f')]?_0x13eabe[_0x29fc('0x1f')][_0x29fc('0x20')]||null:null,'limit':_0x13eabe[_0x29fc('0x1f')]?_0x13eabe[_0x29fc('0x1f')][_0x29fc('0x21')]||null:null})[_0x29fc('0xf')](function(_0x32c549){logger[_0x29fc('0x18')](_0x29fc('0x1b'),_0x13eabe);logger['debug']('UpdateChatInteraction',_0x13eabe,JSON[_0x29fc('0x14')](_0x32c549));_0x29baa0(_0x32c549);})[_0x29fc('0x1a')](function(_0x311404){logger['error'](_0x29fc('0x1b'),_0x311404['message'],_0x13eabe);_0x3d3da8(_0x25a599[_0x29fc('0x15')](0x1f4,_0x311404[_0x29fc('0x17')]));});});};exports[_0x29fc('0x22')]=function(_0xbb7b27){return new Promise(function(_0x52de38,_0xa60c8d){return db['ChatInteraction'][_0x29fc('0x23')]({'where':_0xbb7b27['options']?_0xbb7b27[_0x29fc('0x1f')][_0x29fc('0x24')]||null:null})[_0x29fc('0xf')](function(_0x4994b1){if(_0x4994b1){return _0x4994b1[_0x29fc('0x25')](_0xbb7b27[_0x29fc('0x1e')][_0x29fc('0x26')],_[_0x29fc('0x27')](_0xbb7b27['body'],[_0x29fc('0x26'),'id'])||{});}})[_0x29fc('0x28')](function(_0x3c96a4){logger['info'](_0x29fc('0x29'),_0xbb7b27);logger[_0x29fc('0x12')]('AddTags',_0xbb7b27,JSON[_0x29fc('0x14')](_0x3c96a4));_0x52de38(_0x3c96a4);})[_0x29fc('0x1a')](function(_0x3e1565){logger[_0x29fc('0x15')](_0x29fc('0x29'),_0x3e1565[_0x29fc('0x17')],_0xbb7b27);_0xa60c8d(_this[_0x29fc('0x15')](0x1f4,_0x3e1565[_0x29fc('0x17')]));});});}; \ No newline at end of file +var _0xab32=['../../config/environment','jayson/promise','http','redis','defaults','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateChatInteraction','update','options','raw','limit','stringify','AddTagsToChatInteraction','ChatInteraction','find','where','addTags','body','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4521e3,_0x10a8a4){var _0x46a272=function(_0x2f4c64){while(--_0x2f4c64){_0x4521e3['push'](_0x4521e3['shift']());}};_0x46a272(++_0x10a8a4);}(_0xab32,0x98));var _0x2ab3=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0xab32[_0x1e500e];return _0x10dc5e;};'use strict';var _=require(_0x2ab3('0x0'));var util=require(_0x2ab3('0x1'));var moment=require('moment');var BPromise=require(_0x2ab3('0x2'));var rs=require(_0x2ab3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ab3('0x4'))['db'];var utils=require(_0x2ab3('0x5'));var logger=require(_0x2ab3('0x6'))(_0x2ab3('0x7'));var config=require(_0x2ab3('0x8'));var jayson=require(_0x2ab3('0x9'));var client=jayson['client'][_0x2ab3('0xa')]({'port':0x232a});config[_0x2ab3('0xb')]=_[_0x2ab3('0xc')](config[_0x2ab3('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x465997,_0xbe1a40,_0x2bc3ec){return new BPromise(function(_0x56020b,_0x3cb5ba){return client['request'](_0x465997,_0x2bc3ec)[_0x2ab3('0xd')](function(_0x2e4e27){logger[_0x2ab3('0xe')](_0x2ab3('0xf'),_0xbe1a40,_0x2ab3('0x10'));logger[_0x2ab3('0x11')](_0x2ab3('0x12'),_0xbe1a40,_0x2ab3('0x10'),JSON['stringify'](_0x2e4e27));if(_0x2e4e27[_0x2ab3('0x13')]){if(_0x2e4e27['error'][_0x2ab3('0x14')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0xbe1a40,_0x2e4e27[_0x2ab3('0x13')][_0x2ab3('0x15')]);return _0x3cb5ba(_0x2e4e27[_0x2ab3('0x13')][_0x2ab3('0x15')]);}logger[_0x2ab3('0x13')](_0x2ab3('0xf'),_0xbe1a40,_0x2e4e27[_0x2ab3('0x13')][_0x2ab3('0x15')]);return _0x56020b(_0x2e4e27[_0x2ab3('0x13')][_0x2ab3('0x15')]);}else{logger['info'](_0x2ab3('0xf'),_0xbe1a40,_0x2ab3('0x10'));_0x56020b(_0x2e4e27[_0x2ab3('0x16')][_0x2ab3('0x15')]);}})[_0x2ab3('0x17')](function(_0x202191){logger[_0x2ab3('0x13')]('ChatInteraction,\x20%s,\x20%s',_0xbe1a40,_0x202191);_0x3cb5ba(_0x202191);});});}exports[_0x2ab3('0x18')]=function(_0x1b0b9f){var _0x11d45f=this;return new Promise(function(_0x2ee4cb,_0x285290){return db['ChatInteraction'][_0x2ab3('0x19')](_0x1b0b9f['body'],{'raw':_0x1b0b9f[_0x2ab3('0x1a')]?_0x1b0b9f[_0x2ab3('0x1a')][_0x2ab3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b0b9f[_0x2ab3('0x1a')]?_0x1b0b9f['options']['where']||null:null,'attributes':_0x1b0b9f[_0x2ab3('0x1a')]?_0x1b0b9f[_0x2ab3('0x1a')]['attributes']||null:null,'limit':_0x1b0b9f['options']?_0x1b0b9f[_0x2ab3('0x1a')][_0x2ab3('0x1c')]||null:null})[_0x2ab3('0xd')](function(_0x28b6e6){logger[_0x2ab3('0xe')](_0x2ab3('0x18'),_0x1b0b9f);logger[_0x2ab3('0x11')](_0x2ab3('0x18'),_0x1b0b9f,JSON[_0x2ab3('0x1d')](_0x28b6e6));_0x2ee4cb(_0x28b6e6);})['catch'](function(_0x2e0df9){logger[_0x2ab3('0x13')](_0x2ab3('0x18'),_0x2e0df9['message'],_0x1b0b9f);_0x285290(_0x11d45f[_0x2ab3('0x13')](0x1f4,_0x2e0df9[_0x2ab3('0x15')]));});});};exports[_0x2ab3('0x1e')]=function(_0x43e940){return new Promise(function(_0x4b2dc4,_0x373705){return db[_0x2ab3('0x1f')][_0x2ab3('0x20')]({'where':_0x43e940[_0x2ab3('0x1a')]?_0x43e940['options'][_0x2ab3('0x21')]||null:null})[_0x2ab3('0xd')](function(_0x4b30ba){if(_0x4b30ba){return _0x4b30ba[_0x2ab3('0x22')](_0x43e940[_0x2ab3('0x23')]['ids'],_[_0x2ab3('0x24')](_0x43e940['body'],[_0x2ab3('0x25'),'id'])||{});}})[_0x2ab3('0x26')](function(_0x577667){logger[_0x2ab3('0xe')](_0x2ab3('0x27'),_0x43e940);logger[_0x2ab3('0x11')](_0x2ab3('0x27'),_0x43e940,JSON['stringify'](_0x577667));_0x4b2dc4(_0x577667);})[_0x2ab3('0x17')](function(_0x21b920){logger[_0x2ab3('0x13')](_0x2ab3('0x27'),_0x21b920[_0x2ab3('0x15')],_0x43e940);_0x373705(_this[_0x2ab3('0x13')](0x1f4,_0x21b920['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 297160c..d0814ec 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 _0xa8e7=['register','chatInteraction:','./chatInteraction.events','save','remove','emit','removeListener'];(function(_0xba192c,_0x4be2f7){var _0x5c837f=function(_0x248622){while(--_0x248622){_0xba192c['push'](_0xba192c['shift']());}};_0x5c837f(++_0x4be2f7);}(_0xa8e7,0x18a));var _0x7a8e=function(_0x23a7f5,_0x490f8a){_0x23a7f5=_0x23a7f5-0x0;var _0x1ac0d3=_0xa8e7[_0x23a7f5];return _0x1ac0d3;};'use strict';var ChatInteractionEvents=require(_0x7a8e('0x0'));var events=[_0x7a8e('0x1'),_0x7a8e('0x2'),'update'];function createListener(_0x36c5a1,_0x16aed8){return function(_0x500a33){_0x16aed8[_0x7a8e('0x3')](_0x36c5a1,_0x500a33);};}function removeListener(_0x265a12,_0x493489){return function(){ChatInteractionEvents[_0x7a8e('0x4')](_0x265a12,_0x493489);};}exports[_0x7a8e('0x5')]=function(_0x51137e){for(var _0x242402=0x0,_0x363104=events['length'];_0x242402<_0x363104;_0x242402++){var _0x408173=events[_0x242402];var _0x317f0f=createListener(_0x7a8e('0x6')+_0x408173,_0x51137e);ChatInteractionEvents['on'](_0x408173,_0x317f0f);}}; \ No newline at end of file +var _0x489c=['save','update','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x489c,0x1d3));var _0xc489=function(_0x34a8b0,_0x17a597){_0x34a8b0=_0x34a8b0-0x0;var _0x1e318a=_0x489c[_0x34a8b0];return _0x1e318a;};'use strict';var ChatInteractionEvents=require(_0xc489('0x0'));var events=[_0xc489('0x1'),'remove',_0xc489('0x2')];function createListener(_0x35c17b,_0x404818){return function(_0x1451a3){_0x404818['emit'](_0x35c17b,_0x1451a3);};}function removeListener(_0x1bec1a,_0x5c27f2){return function(){ChatInteractionEvents['removeListener'](_0x1bec1a,_0x5c27f2);};}exports[_0xc489('0x3')]=function(_0x51a665){for(var _0xab5f73=0x0,_0x440a44=events[_0xc489('0x4')];_0xab5f73<_0x440a44;_0xab5f73++){var _0x3cda49=events[_0xab5f73];var _0x3e169f=createListener(_0xc489('0x5')+_0x3cda49,_0x51a665);ChatInteractionEvents['on'](_0x3cda49,_0x3e169f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index f0f329e..0126fa9 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 _0x5853=['chat','chatinteraction:addtags','addTags','update','put','/:id/custom_update','customUpdate','abandon','/:id/close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','/:id/attachment_upload','single','addMessage','tracked'];(function(_0x553927,_0x408337){var _0x4f6d8e=function(_0x197ae6){while(--_0x197ae6){_0x553927['push'](_0x553927['shift']());}};_0x4f6d8e(++_0x408337);}(_0x5853,0x113));var _0x3585=function(_0x5ecaab,_0x2f3053){_0x5ecaab=_0x5ecaab-0x0;var _0x3db1a8=_0x5853[_0x5ecaab];return _0x3db1a8;};'use strict';var multer=require(_0x3585('0x0'));var util=require(_0x3585('0x1'));var path=require(_0x3585('0x2'));var timeout=require(_0x3585('0x3'));var express=require(_0x3585('0x4'));var router=express['Router']();var auth=require(_0x3585('0x5'));var interaction=require(_0x3585('0x6'));var config=require(_0x3585('0x7'));var controller=require(_0x3585('0x8'));router[_0x3585('0x9')]('/',auth[_0x3585('0xa')](),controller['index']);router[_0x3585('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3585('0xb')]);router['get'](_0x3585('0xc'),auth[_0x3585('0xd')](),controller[_0x3585('0xe')]);router[_0x3585('0x9')](_0x3585('0xf'),auth[_0x3585('0xd')](),controller[_0x3585('0x10')]);router['get'](_0x3585('0x11'),auth[_0x3585('0xa')](),controller[_0x3585('0x12')]);router[_0x3585('0x9')](_0x3585('0x13'),auth[_0x3585('0xd')](),controller[_0x3585('0x14')]);router['get'](_0x3585('0x15'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x3585('0x16')]);router['post'](_0x3585('0x17'),auth[_0x3585('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x3585('0x18')]({'destination':function(_0x3c97ae,_0x5e31b2,_0x366723){_0x366723(null,path[_0x3585('0x19')](config[_0x3585('0x1a')],_0x3585('0x1b')));},'filename':function(_0x2496a4,_0x59e340,_0x3bd298){_0x3bd298(null,util['format'](_0x3585('0x1c'),Date[_0x3585('0x1d')](),_0x59e340[_0x3585('0x1e')][_0x3585('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3585('0x20')](_0x3585('0x21'),upload[_0x3585('0x22')]('file'),controller['attachmentUpload']);router[_0x3585('0x20')](_0x3585('0x11'),auth[_0x3585('0xd')](),controller[_0x3585('0x23')]);router[_0x3585('0x20')]('/:id/tags',auth[_0x3585('0xa')](),interaction[_0x3585('0x24')](_0x3585('0x25'),_0x3585('0x26')),controller[_0x3585('0x27')]);router['put']('/:id',auth['isAuthenticated'](),interaction['tracked']('chat','chatinteraction:update'),controller[_0x3585('0x28')]);router[_0x3585('0x29')](_0x3585('0x2a'),controller[_0x3585('0x2b')]);router[_0x3585('0x29')]('/:id/abandon',auth[_0x3585('0xd')](),controller[_0x3585('0x2c')]);router['put'](_0x3585('0x2d'),controller['close']);router[_0x3585('0x2e')](_0x3585('0xc'),auth[_0x3585('0xa')](),interaction[_0x3585('0x24')](_0x3585('0x25'),_0x3585('0x2f')),controller[_0x3585('0x30')]);router[_0x3585('0x2e')](_0x3585('0x31'),auth[_0x3585('0xa')](),controller[_0x3585('0x32')]);module[_0x3585('0x33')]=router; \ No newline at end of file +var _0xd142=['createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','attachmentUpload','addMessage','tracked','chatinteraction:addtags','addTags','put','/:id','chat','update','customUpdate','/:id/abandon','/:id/close','delete','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','post','create'];(function(_0x3ec845,_0x4e6c51){var _0x3c8434=function(_0x53b5a8){while(--_0x53b5a8){_0x3ec845['push'](_0x3ec845['shift']());}};_0x3c8434(++_0x4e6c51);}(_0xd142,0x11a));var _0x2d14=function(_0x23da4d,_0x63498c){_0x23da4d=_0x23da4d-0x0;var _0x4ae55=_0xd142[_0x23da4d];return _0x4ae55;};'use strict';var multer=require(_0x2d14('0x0'));var util=require(_0x2d14('0x1'));var path=require(_0x2d14('0x2'));var timeout=require(_0x2d14('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x2d14('0x4'));var interaction=require(_0x2d14('0x5'));var config=require(_0x2d14('0x6'));var controller=require(_0x2d14('0x7'));router[_0x2d14('0x8')]('/',auth[_0x2d14('0x9')](),controller[_0x2d14('0xa')]);router[_0x2d14('0x8')](_0x2d14('0xb'),auth[_0x2d14('0x9')](),controller[_0x2d14('0xc')]);router[_0x2d14('0x8')]('/:id',auth[_0x2d14('0xd')](),controller[_0x2d14('0xe')]);router['get'](_0x2d14('0xf'),auth[_0x2d14('0xd')](),controller[_0x2d14('0x10')]);router['get'](_0x2d14('0x11'),auth[_0x2d14('0x9')](),controller['getMessages']);router['get'](_0x2d14('0x12'),auth[_0x2d14('0xd')](),controller[_0x2d14('0x13')]);router['get'](_0x2d14('0x14'),auth[_0x2d14('0x9')](),controller[_0x2d14('0x15')]);router[_0x2d14('0x16')]('/',auth['isAuthenticated'](),controller[_0x2d14('0x17')]);router[_0x2d14('0x16')]('/:id/vidaoo',auth[_0x2d14('0x9')](),controller[_0x2d14('0x18')]);var upload=multer({'storage':multer[_0x2d14('0x19')]({'destination':function(_0xe9aadc,_0x2dfcd4,_0x5e6095){_0x5e6095(null,path[_0x2d14('0x1a')](config[_0x2d14('0x1b')],_0x2d14('0x1c')));},'filename':function(_0x30a789,_0x27b6a3,_0x5ac4a5){_0x5ac4a5(null,util[_0x2d14('0x1d')](_0x2d14('0x1e'),Date[_0x2d14('0x1f')](),_0x27b6a3[_0x2d14('0x20')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x2d14('0x21'),upload['single']('file'),controller[_0x2d14('0x22')]);router[_0x2d14('0x16')](_0x2d14('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x2d14('0x23')]);router[_0x2d14('0x16')]('/:id/tags',auth[_0x2d14('0x9')](),interaction[_0x2d14('0x24')]('chat',_0x2d14('0x25')),controller[_0x2d14('0x26')]);router[_0x2d14('0x27')](_0x2d14('0x28'),auth[_0x2d14('0x9')](),interaction['tracked'](_0x2d14('0x29'),'chatinteraction:update'),controller[_0x2d14('0x2a')]);router['put']('/:id/custom_update',controller[_0x2d14('0x2b')]);router[_0x2d14('0x27')](_0x2d14('0x2c'),auth[_0x2d14('0xd')](),controller['abandon']);router[_0x2d14('0x27')](_0x2d14('0x2d'),controller['close']);router[_0x2d14('0x2e')](_0x2d14('0x28'),auth[_0x2d14('0x9')](),interaction[_0x2d14('0x24')](_0x2d14('0x29'),'chatinteraction:destroy'),controller[_0x2d14('0x2f')]);router[_0x2d14('0x2e')](_0x2d14('0x30'),auth[_0x2d14('0x9')](),controller[_0x2d14('0x31')]);module[_0x2d14('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 34448fa..48090a9 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 _0xda2d=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0x447080,_0x1571ac){var _0x667c47=function(_0x4a4013){while(--_0x4a4013){_0x447080['push'](_0x447080['shift']());}};_0x667c47(++_0x1571ac);}(_0xda2d,0x102));var _0xdda2=function(_0x56cc43,_0x5a2bf8){_0x56cc43=_0x56cc43-0x0;var _0x1d93c1=_0xda2d[_0x56cc43];return _0x1d93c1;};'use strict';var Sequelize=require('sequelize');module[_0xdda2('0x0')]={'body':{'type':Sequelize[_0xdda2('0x1')](_0xdda2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdda2('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xdda2('0x4')]}}; \ No newline at end of file +var _0x0295=['sequelize','medium'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0295,0x1f0));var _0x5029=function(_0x23884b,_0x50c307){_0x23884b=_0x23884b-0x0;var _0x28113b=_0x0295[_0x23884b];return _0x28113b;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x5029('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 0373f96..551a828 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 _0x8dea=['YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','user','fullname','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','role','push','FromId','ToId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','register','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format'];(function(_0x2a3702,_0x31452e){var _0x42dfef=function(_0x490850){while(--_0x490850){_0x2a3702['push'](_0x2a3702['shift']());}};_0x42dfef(++_0x31452e);}(_0x8dea,0x162));var _0xa8de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8dea[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xa8de('0x0'));var emlformat=require(_0xa8de('0x1'));var rimraf=require(_0xa8de('0x2'));var zipdir=require(_0xa8de('0x3'));var jsonpatch=require(_0xa8de('0x4'));var rp=require(_0xa8de('0x5'));var moment=require(_0xa8de('0x6'));var BPromise=require(_0xa8de('0x7'));var Mustache=require('mustache');var util=require(_0xa8de('0x8'));var path=require(_0xa8de('0x9'));var sox=require(_0xa8de('0xa'));var csv=require('to-csv');var ejs=require(_0xa8de('0xb'));var fs=require('fs');var _=require(_0xa8de('0xc'));var squel=require(_0xa8de('0xd'));var crypto=require('crypto');var jsforce=require(_0xa8de('0xe'));var deskjs=require(_0xa8de('0xf'));var toCsv=require(_0xa8de('0x10'));var querystring=require(_0xa8de('0x11'));var Papa=require('papaparse');var Redis=require(_0xa8de('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa8de('0x13'));var as=require(_0xa8de('0x14'));var hardwareService=require(_0xa8de('0x15'));var logger=require(_0xa8de('0x16'))(_0xa8de('0x17'));var utils=require(_0xa8de('0x18'));var config=require(_0xa8de('0x19'));var db=require(_0xa8de('0x1a'))['db'];config[_0xa8de('0x1b')]=_[_0xa8de('0x1c')](config[_0xa8de('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa8de('0x1b')]));require('./chatInternalMessage.socket')[_0xa8de('0x1d')](socket);function respondWithStatusCode(_0x25d98c,_0x19f22c){_0x19f22c=_0x19f22c||0xcc;return function(_0x4d11b3){if(_0x4d11b3){return _0x25d98c[_0xa8de('0x1e')](_0x19f22c);}return _0x25d98c[_0xa8de('0x1f')](_0x19f22c)[_0xa8de('0x20')]();};}function respondWithResult(_0x56a22c,_0x249e23){_0x249e23=_0x249e23||0xc8;return function(_0x123829){if(_0x123829){return _0x56a22c[_0xa8de('0x1f')](_0x249e23)['json'](_0x123829);}};}function respondWithFilteredResult(_0x54ac56,_0x39643e){return function(_0x176ce0){if(_0x176ce0){var _0x2d040f=_0x176ce0[_0xa8de('0x21')],_0x3d5730=_0x39643e[_0xa8de('0x22')],_0x2e2985=_0x39643e[_0xa8de('0x22')]+_0x39643e[_0xa8de('0x23')],_0x697fdf;if(_0x2e2985>=_0x2d040f){_0x2e2985=_0x2d040f;_0x697fdf=0xc8;}else{_0x697fdf=0xce;}_0x54ac56[_0xa8de('0x1f')](_0x697fdf);return _0x54ac56[_0xa8de('0x24')](_0xa8de('0x25'),_0x3d5730+'-'+_0x2e2985+'/'+_0x2d040f)['json'](_0x176ce0);}return null;};}function patchUpdates(_0x54b2fa){return function(_0x595cc7){try{jsonpatch[_0xa8de('0x26')](_0x595cc7,_0x54b2fa,!![]);}catch(_0x6c6f37){return BPromise['reject'](_0x6c6f37);}return _0x595cc7['save']();};}function saveUpdates(_0x5408d8,_0x50380c){return function(_0x5ef218){if(_0x5ef218){return _0x5ef218['update'](_0x5408d8)[_0xa8de('0x27')](function(_0x2d8fbb){return _0x2d8fbb;});}return null;};}function removeEntity(_0x5a0612,_0x4c999b){return function(_0x12619b){if(_0x12619b){return _0x12619b[_0xa8de('0x28')]()[_0xa8de('0x27')](function(){_0x5a0612[_0xa8de('0x1f')](0xcc)[_0xa8de('0x20')]();});}};}function handleEntityNotFound(_0x1e7621,_0x20aa17){return function(_0x546196){if(!_0x546196){_0x1e7621[_0xa8de('0x1e')](0x194);}return _0x546196;};}function handleError(_0x7afdd2,_0x5362d5){_0x5362d5=_0x5362d5||0x1f4;return function(_0xad1de8){logger[_0xa8de('0x29')](_0xad1de8[_0xa8de('0x2a')]);if(_0xad1de8[_0xa8de('0x2b')]){delete _0xad1de8[_0xa8de('0x2b')];}_0x7afdd2[_0xa8de('0x1f')](_0x5362d5)[_0xa8de('0x2c')](_0xad1de8);};}exports[_0xa8de('0x2d')]=function(_0x3ad493,_0x4fd400){var _0x246ddf={},_0x364fcd={},_0x3aabbf={'count':0x0,'rows':[]};var _0x5cedc2=_[_0xa8de('0x2e')](db[_0xa8de('0x2f')][_0xa8de('0x30')],function(_0x600a80){return{'name':_0x600a80[_0xa8de('0x31')],'type':_0x600a80['type'][_0xa8de('0x32')]};});_0x364fcd['model']=_['map'](_0x5cedc2,_0xa8de('0x2b'));_0x364fcd[_0xa8de('0x33')]=_[_0xa8de('0x34')](_0x3ad493[_0xa8de('0x33')]);_0x364fcd[_0xa8de('0x35')]=_['intersection'](_0x364fcd[_0xa8de('0x36')],_0x364fcd[_0xa8de('0x33')]);_0x246ddf[_0xa8de('0x37')]=_[_0xa8de('0x38')](_0x364fcd[_0xa8de('0x36')],qs[_0xa8de('0x39')](_0x3ad493[_0xa8de('0x33')][_0xa8de('0x39')]));_0x246ddf[_0xa8de('0x37')]=_0x246ddf[_0xa8de('0x37')]['length']?_0x246ddf['attributes']:_0x364fcd['model'];if(!_0x3ad493[_0xa8de('0x33')][_0xa8de('0x3a')](_0xa8de('0x3b'))){_0x246ddf[_0xa8de('0x23')]=qs[_0xa8de('0x23')](_0x3ad493[_0xa8de('0x33')]['limit']);_0x246ddf['offset']=qs[_0xa8de('0x22')](_0x3ad493['query'][_0xa8de('0x22')]);}_0x246ddf[_0xa8de('0x3c')]=qs['sort'](_0x3ad493[_0xa8de('0x33')][_0xa8de('0x3d')]);_0x246ddf[_0xa8de('0x3e')]=qs[_0xa8de('0x35')](_[_0xa8de('0x3f')](_0x3ad493[_0xa8de('0x33')],_0x364fcd[_0xa8de('0x35')]),_0x5cedc2);if(_0x3ad493[_0xa8de('0x33')][_0xa8de('0x40')]){_0x246ddf[_0xa8de('0x3e')]=_[_0xa8de('0x41')](_0x246ddf['where'],{'$or':_['map'](_0x5cedc2,function(_0x25bb69){if(_0x25bb69[_0xa8de('0x42')]!=='VIRTUAL'){var _0x3eb6={};_0x3eb6[_0x25bb69[_0xa8de('0x2b')]]={'$like':'%'+_0x3ad493[_0xa8de('0x33')][_0xa8de('0x40')]+'%'};return _0x3eb6;}})});}_0x246ddf=_[_0xa8de('0x41')]({},_0x246ddf,_0x3ad493['options']);var _0xb09f3e={'where':_0x246ddf['where']};return db['ChatInternalMessage']['count'](_0xb09f3e)[_0xa8de('0x27')](function(_0x55abe8){_0x3aabbf[_0xa8de('0x21')]=_0x55abe8;if(_0x3ad493[_0xa8de('0x33')][_0xa8de('0x43')]){_0x246ddf[_0xa8de('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xa8de('0x45')](_0x246ddf);})[_0xa8de('0x27')](function(_0x12ae79){_0x3aabbf[_0xa8de('0x46')]=_0x12ae79;return _0x3aabbf;})[_0xa8de('0x27')](respondWithFilteredResult(_0x4fd400,_0x246ddf))[_0xa8de('0x47')](handleError(_0x4fd400,null));};exports[_0xa8de('0x48')]=function(_0x36c674,_0x28c1f0){var _0x258cc3={'raw':!![],'where':{'id':_0x36c674[_0xa8de('0x49')]['id']}},_0x23d6af={};_0x23d6af['model']=_[_0xa8de('0x34')](db[_0xa8de('0x2f')][_0xa8de('0x30')]);_0x23d6af['query']=_[_0xa8de('0x34')](_0x36c674[_0xa8de('0x33')]);_0x23d6af[_0xa8de('0x35')]=_['intersection'](_0x23d6af[_0xa8de('0x36')],_0x23d6af['query']);_0x258cc3['attributes']=_[_0xa8de('0x38')](_0x23d6af[_0xa8de('0x36')],qs[_0xa8de('0x39')](_0x36c674[_0xa8de('0x33')]['fields']));_0x258cc3[_0xa8de('0x37')]=_0x258cc3[_0xa8de('0x37')][_0xa8de('0x4a')]?_0x258cc3[_0xa8de('0x37')]:_0x23d6af[_0xa8de('0x36')];if(_0x36c674['query']['includeAll']){_0x258cc3['include']=[{'all':!![]}];}_0x258cc3=_['merge']({},_0x258cc3,_0x36c674[_0xa8de('0x4b')]);return db['ChatInternalMessage'][_0xa8de('0x4c')](_0x258cc3)[_0xa8de('0x27')](handleEntityNotFound(_0x28c1f0,null))[_0xa8de('0x27')](respondWithResult(_0x28c1f0,null))[_0xa8de('0x47')](handleError(_0x28c1f0,null));};exports[_0xa8de('0x4d')]=function(_0x5bdb66,_0x571812){return db['ChatInternalMessage'][_0xa8de('0x4d')](_0x5bdb66['body'],{})[_0xa8de('0x27')](respondWithResult(_0x571812,0xc9))[_0xa8de('0x47')](handleError(_0x571812,null));};exports['update']=function(_0x285110,_0x105bd2){if(_0x285110[_0xa8de('0x4e')]['id']){delete _0x285110[_0xa8de('0x4e')]['id'];}return db[_0xa8de('0x2f')]['find']({'where':{'id':_0x285110[_0xa8de('0x49')]['id']}})[_0xa8de('0x27')](handleEntityNotFound(_0x105bd2,null))['then'](saveUpdates(_0x285110['body'],null))[_0xa8de('0x27')](respondWithResult(_0x105bd2,null))[_0xa8de('0x47')](handleError(_0x105bd2,null));};exports[_0xa8de('0x28')]=function(_0x3c8bad,_0x36b361){return db[_0xa8de('0x2f')]['find']({'where':{'id':_0x3c8bad[_0xa8de('0x49')]['id']}})[_0xa8de('0x27')](handleEntityNotFound(_0x36b361,null))[_0xa8de('0x27')](removeEntity(_0x36b361,null))['catch'](handleError(_0x36b361,null));};exports['describe']=function(_0x4f907c,_0x5a4518){return db[_0xa8de('0x2f')][_0xa8de('0x4f')]()['then'](respondWithResult(_0x5a4518,null))[_0xa8de('0x47')](handleError(_0x5a4518,null));};function wrapUser(_0x44f9d8){return function(_0x1e588c){var _0x365e72=_0x44f9d8[_0xa8de('0x50')]({'plain':!![]});_0x365e72[_0xa8de('0x51')]=[];if(_0x1e588c){_0x365e72[_0xa8de('0x52')]=_0x1e588c[_0xa8de('0x53')];_0x365e72[_0xa8de('0x54')]=_0x1e588c;}else{_0x365e72['lastMessageAt']=moment(0x0)[_0xa8de('0x55')](_0xa8de('0x56'));_0x365e72[_0xa8de('0x54')]={};}return _0x365e72;};}exports[_0xa8de('0x57')]=function(_0x58f7fe,_0x868033,_0x36f968){var _0x1b6440=[];return db['User']['findAll']({'where':{'role':[_0xa8de('0x58'),'admin',_0xa8de('0x59')]},'attributes':['id',_0xa8de('0x5a'),_0xa8de('0x2b'),'role','userpic',_0xa8de('0x5b'),_0xa8de('0x5c'),_0xa8de('0x5d'),_0xa8de('0x5e'),'showWebBar'],'order':qs[_0xa8de('0x3d')](_0xa8de('0x5f')),'include':[{'model':db[_0xa8de('0x60')],'as':_0xa8de('0x61'),'attributes':['id',_0xa8de('0x2b'),_0xa8de('0x42')],'through':{'attributes':[]}}]})[_0xa8de('0x27')](function(_0x39ae78){if(_0x39ae78){var _0xe49b64=_0x58f7fe['user'][_0xa8de('0x50')]({'plain':!![]});if(!_0xe49b64)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe49b64['role']===_0xa8de('0x59')){return db['UserProfileSection']['find']({'where':{'name':_0xa8de('0x62'),'userProfileId':_0xe49b64[_0xa8de('0x63')]},'raw':!![]})['then'](function(_0x23a43a){if(_0x23a43a){if(_0x23a43a[_0xa8de('0x64')]===0x0){return db[_0xa8de('0x65')][_0xa8de('0x45')]({'where':{'sectionId':_0x23a43a['id']},'raw':!![]})[_0xa8de('0x27')](function(_0x95bf98){var _0x14689a=[];if(_[_0xa8de('0x66')](_0x95bf98)){_0x14689a=_[_0xa8de('0x40')](_0x39ae78,function(_0x55e884){if(_0x55e884[_0xa8de('0x67')]!==_0xa8de('0x58')){return _0x55e884;}});return _0x14689a;}else{for(var _0x1ee961=0x0;_0x1ee961<_0x39ae78[_0xa8de('0x4a')];_0x1ee961++){var _0xd537e5=_0x39ae78[_0x1ee961];if(_0xd537e5[_0xa8de('0x67')]==='agent'){var _0x44e90b=_[_0xa8de('0x4c')](_0x95bf98,function(_0x23eb4e){return _0x23eb4e['resourceId']===_0xd537e5['id'];});if(_0x44e90b)_0x14689a[_0xa8de('0x68')](_0xd537e5);}else{_0x14689a['push'](_0xd537e5);}}return _0x14689a;}});}else{return _0x39ae78;}}else{var _0x285c83=_[_0xa8de('0x40')](_0x39ae78,function(_0x3c6ae0){if(_0x3c6ae0['role']!==_0xa8de('0x58')){return _0x3c6ae0;}});return _0x285c83;}});}else{return _0x39ae78;}}})[_0xa8de('0x27')](function(_0x126bc8){var _0x4ea3c0=[];if(_0x126bc8){_0x1b6440=_0x126bc8;for(var _0x5c4054=0x0;_0x5c4054<_0x126bc8[_0xa8de('0x4a')];_0x5c4054+=0x1){_0x1b6440[_0x5c4054][_0xa8de('0x51')]=[];_0x4ea3c0[_0xa8de('0x68')](db[_0xa8de('0x2f')][_0xa8de('0x4c')]({'where':{'FromId':[_0x58f7fe[_0xa8de('0x59')]['id'],_0x126bc8[_0x5c4054]['id']],'ToId':[_0x58f7fe['user']['id'],_0x126bc8[_0x5c4054]['id']],'ChatGroupId':null},'attributes':['id',_0xa8de('0x53'),_0xa8de('0x69'),_0xa8de('0x6a'),_0xa8de('0x6b'),_0xa8de('0x4e')],'order':qs[_0xa8de('0x3d')](_0xa8de('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa8de('0x27')](wrapUser(_0x126bc8[_0x5c4054])));}return BPromise[_0xa8de('0x6d')](_0x4ea3c0);}return[];})['then'](function(_0x4bf9ba){return{'rows':_0x4bf9ba,'count':_0x4bf9ba[_0xa8de('0x4a')]};})[_0xa8de('0x27')](respondWithResult(_0x868033,null))[_0xa8de('0x47')](handleError(_0x868033,null));}; \ No newline at end of file +var _0x36d5=['index','map','ChatInternalMessage','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','params','keys','find','create','body','destroy','get','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','findAll','agent','admin','user','fullname','role','online','lastLoginAt','allowmessenger','showWebBar','-online','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','messages','FromId','ToId','read','-createdAt','all','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','status','end','count','offset','limit','Content-Range','json','apply','save','update','then','sendStatus','error','name','send'];(function(_0x4dd327,_0x1b29b7){var _0x445a6e=function(_0x4cb4b5){while(--_0x4cb4b5){_0x4dd327['push'](_0x4dd327['shift']());}};_0x445a6e(++_0x1b29b7);}(_0x36d5,0x1e3));var _0x536d=function(_0xe3bbea,_0x3ae4d3){_0xe3bbea=_0xe3bbea-0x0;var _0x18713d=_0x36d5[_0xe3bbea];return _0x18713d;};'use strict';var pdf=require(_0x536d('0x0'));var emlformat=require(_0x536d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x536d('0x2'));var rp=require(_0x536d('0x3'));var moment=require('moment');var BPromise=require(_0x536d('0x4'));var Mustache=require(_0x536d('0x5'));var util=require('util');var path=require(_0x536d('0x6'));var sox=require(_0x536d('0x7'));var csv=require(_0x536d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x536d('0x9'));var squel=require(_0x536d('0xa'));var crypto=require(_0x536d('0xb'));var jsforce=require(_0x536d('0xc'));var deskjs=require(_0x536d('0xd'));var toCsv=require(_0x536d('0x8'));var querystring=require(_0x536d('0xe'));var Papa=require(_0x536d('0xf'));var Redis=require(_0x536d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x536d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x536d('0x12'))(_0x536d('0x13'));var utils=require(_0x536d('0x14'));var config=require('../../config/environment');var db=require(_0x536d('0x15'))['db'];config[_0x536d('0x16')]=_[_0x536d('0x17')](config[_0x536d('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x536d('0x18'))(new Redis(config[_0x536d('0x16')]));require(_0x536d('0x19'))[_0x536d('0x1a')](socket);function respondWithStatusCode(_0x45b746,_0x34cbce){_0x34cbce=_0x34cbce||0xcc;return function(_0x5bead7){if(_0x5bead7){return _0x45b746['sendStatus'](_0x34cbce);}return _0x45b746[_0x536d('0x1b')](_0x34cbce)[_0x536d('0x1c')]();};}function respondWithResult(_0x1fd960,_0x4de5b0){_0x4de5b0=_0x4de5b0||0xc8;return function(_0x27f92c){if(_0x27f92c){return _0x1fd960['status'](_0x4de5b0)['json'](_0x27f92c);}};}function respondWithFilteredResult(_0xd2e9f8,_0x3b0f24){return function(_0x567133){if(_0x567133){var _0x2b00bb=_0x567133[_0x536d('0x1d')],_0x344fbb=_0x3b0f24[_0x536d('0x1e')],_0x3440e6=_0x3b0f24[_0x536d('0x1e')]+_0x3b0f24[_0x536d('0x1f')],_0x10bce0;if(_0x3440e6>=_0x2b00bb){_0x3440e6=_0x2b00bb;_0x10bce0=0xc8;}else{_0x10bce0=0xce;}_0xd2e9f8[_0x536d('0x1b')](_0x10bce0);return _0xd2e9f8['set'](_0x536d('0x20'),_0x344fbb+'-'+_0x3440e6+'/'+_0x2b00bb)[_0x536d('0x21')](_0x567133);}return null;};}function patchUpdates(_0x1399bf){return function(_0x5489be){try{jsonpatch[_0x536d('0x22')](_0x5489be,_0x1399bf,!![]);}catch(_0x248786){return BPromise['reject'](_0x248786);}return _0x5489be[_0x536d('0x23')]();};}function saveUpdates(_0x44178b,_0x50ba9a){return function(_0x5348b6){if(_0x5348b6){return _0x5348b6[_0x536d('0x24')](_0x44178b)['then'](function(_0x1f7294){return _0x1f7294;});}return null;};}function removeEntity(_0x4b567a,_0x4abc05){return function(_0x23ac1d){if(_0x23ac1d){return _0x23ac1d['destroy']()[_0x536d('0x25')](function(){_0x4b567a[_0x536d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31eb43,_0x4858e6){return function(_0x47ef7a){if(!_0x47ef7a){_0x31eb43[_0x536d('0x26')](0x194);}return _0x47ef7a;};}function handleError(_0x2f7ac9,_0x390834){_0x390834=_0x390834||0x1f4;return function(_0xd057fa){logger[_0x536d('0x27')](_0xd057fa['stack']);if(_0xd057fa[_0x536d('0x28')]){delete _0xd057fa[_0x536d('0x28')];}_0x2f7ac9['status'](_0x390834)[_0x536d('0x29')](_0xd057fa);};}exports[_0x536d('0x2a')]=function(_0x5c228c,_0x321e2d){var _0x39d484={},_0x679db0={},_0x2f2403={'count':0x0,'rows':[]};var _0x24c75c=_[_0x536d('0x2b')](db[_0x536d('0x2c')][_0x536d('0x2d')],function(_0x4f5582){return{'name':_0x4f5582['fieldName'],'type':_0x4f5582[_0x536d('0x2e')][_0x536d('0x2f')]};});_0x679db0[_0x536d('0x30')]=_[_0x536d('0x2b')](_0x24c75c,_0x536d('0x28'));_0x679db0[_0x536d('0x31')]=_['keys'](_0x5c228c['query']);_0x679db0['filters']=_[_0x536d('0x32')](_0x679db0[_0x536d('0x30')],_0x679db0['query']);_0x39d484['attributes']=_[_0x536d('0x32')](_0x679db0[_0x536d('0x30')],qs[_0x536d('0x33')](_0x5c228c[_0x536d('0x31')]['fields']));_0x39d484[_0x536d('0x34')]=_0x39d484[_0x536d('0x34')][_0x536d('0x35')]?_0x39d484[_0x536d('0x34')]:_0x679db0['model'];if(!_0x5c228c[_0x536d('0x31')][_0x536d('0x36')](_0x536d('0x37'))){_0x39d484[_0x536d('0x1f')]=qs[_0x536d('0x1f')](_0x5c228c[_0x536d('0x31')][_0x536d('0x1f')]);_0x39d484['offset']=qs[_0x536d('0x1e')](_0x5c228c[_0x536d('0x31')][_0x536d('0x1e')]);}_0x39d484[_0x536d('0x38')]=qs[_0x536d('0x39')](_0x5c228c[_0x536d('0x31')][_0x536d('0x39')]);_0x39d484[_0x536d('0x3a')]=qs[_0x536d('0x3b')](_[_0x536d('0x3c')](_0x5c228c[_0x536d('0x31')],_0x679db0[_0x536d('0x3b')]),_0x24c75c);if(_0x5c228c[_0x536d('0x31')][_0x536d('0x3d')]){_0x39d484[_0x536d('0x3a')]=_['merge'](_0x39d484['where'],{'$or':_['map'](_0x24c75c,function(_0x4f9fb7){if(_0x4f9fb7['type']!=='VIRTUAL'){var _0x1bdf57={};_0x1bdf57[_0x4f9fb7[_0x536d('0x28')]]={'$like':'%'+_0x5c228c[_0x536d('0x31')][_0x536d('0x3d')]+'%'};return _0x1bdf57;}})});}_0x39d484=_[_0x536d('0x3e')]({},_0x39d484,_0x5c228c[_0x536d('0x3f')]);var _0x37ab34={'where':_0x39d484['where']};return db[_0x536d('0x2c')]['count'](_0x37ab34)['then'](function(_0x44f980){_0x2f2403[_0x536d('0x1d')]=_0x44f980;if(_0x5c228c[_0x536d('0x31')][_0x536d('0x40')]){_0x39d484[_0x536d('0x41')]=[{'all':!![]}];}return db[_0x536d('0x2c')]['findAll'](_0x39d484);})['then'](function(_0x2ae7ae){_0x2f2403[_0x536d('0x42')]=_0x2ae7ae;return _0x2f2403;})[_0x536d('0x25')](respondWithFilteredResult(_0x321e2d,_0x39d484))[_0x536d('0x43')](handleError(_0x321e2d,null));};exports['show']=function(_0x36c348,_0x57f9b8){var _0x2add19={'raw':!![],'where':{'id':_0x36c348[_0x536d('0x44')]['id']}},_0x53223a={};_0x53223a[_0x536d('0x30')]=_[_0x536d('0x45')](db[_0x536d('0x2c')][_0x536d('0x2d')]);_0x53223a[_0x536d('0x31')]=_[_0x536d('0x45')](_0x36c348[_0x536d('0x31')]);_0x53223a[_0x536d('0x3b')]=_[_0x536d('0x32')](_0x53223a[_0x536d('0x30')],_0x53223a[_0x536d('0x31')]);_0x2add19[_0x536d('0x34')]=_[_0x536d('0x32')](_0x53223a[_0x536d('0x30')],qs[_0x536d('0x33')](_0x36c348[_0x536d('0x31')][_0x536d('0x33')]));_0x2add19[_0x536d('0x34')]=_0x2add19[_0x536d('0x34')][_0x536d('0x35')]?_0x2add19[_0x536d('0x34')]:_0x53223a[_0x536d('0x30')];if(_0x36c348['query'][_0x536d('0x40')]){_0x2add19[_0x536d('0x41')]=[{'all':!![]}];}_0x2add19=_['merge']({},_0x2add19,_0x36c348[_0x536d('0x3f')]);return db[_0x536d('0x2c')][_0x536d('0x46')](_0x2add19)[_0x536d('0x25')](handleEntityNotFound(_0x57f9b8,null))[_0x536d('0x25')](respondWithResult(_0x57f9b8,null))[_0x536d('0x43')](handleError(_0x57f9b8,null));};exports[_0x536d('0x47')]=function(_0x244c66,_0x1d7769){return db[_0x536d('0x2c')]['create'](_0x244c66[_0x536d('0x48')],{})[_0x536d('0x25')](respondWithResult(_0x1d7769,0xc9))[_0x536d('0x43')](handleError(_0x1d7769,null));};exports[_0x536d('0x24')]=function(_0x952948,_0x3f1f51){if(_0x952948[_0x536d('0x48')]['id']){delete _0x952948['body']['id'];}return db[_0x536d('0x2c')][_0x536d('0x46')]({'where':{'id':_0x952948[_0x536d('0x44')]['id']}})[_0x536d('0x25')](handleEntityNotFound(_0x3f1f51,null))[_0x536d('0x25')](saveUpdates(_0x952948['body'],null))[_0x536d('0x25')](respondWithResult(_0x3f1f51,null))['catch'](handleError(_0x3f1f51,null));};exports[_0x536d('0x49')]=function(_0x2f7563,_0x4d9d6f){return db[_0x536d('0x2c')][_0x536d('0x46')]({'where':{'id':_0x2f7563['params']['id']}})[_0x536d('0x25')](handleEntityNotFound(_0x4d9d6f,null))[_0x536d('0x25')](removeEntity(_0x4d9d6f,null))['catch'](handleError(_0x4d9d6f,null));};exports['describe']=function(_0x15612b,_0x4a91f5){return db[_0x536d('0x2c')]['describe']()[_0x536d('0x25')](respondWithResult(_0x4a91f5,null))['catch'](handleError(_0x4a91f5,null));};function wrapUser(_0x458cf8){return function(_0x29b5ed){var _0x41abb2=_0x458cf8[_0x536d('0x4a')]({'plain':!![]});_0x41abb2['messages']=[];if(_0x29b5ed){_0x41abb2[_0x536d('0x4b')]=_0x29b5ed[_0x536d('0x4c')];_0x41abb2[_0x536d('0x4d')]=_0x29b5ed;}else{_0x41abb2[_0x536d('0x4b')]=moment(0x0)[_0x536d('0x4e')](_0x536d('0x4f'));_0x41abb2[_0x536d('0x4d')]={};}return _0x41abb2;};}exports['getUsers']=function(_0x476266,_0x3dcf0f,_0xe2ff05){var _0x381535=[];return db['User'][_0x536d('0x50')]({'where':{'role':[_0x536d('0x51'),_0x536d('0x52'),_0x536d('0x53')]},'attributes':['id',_0x536d('0x54'),_0x536d('0x28'),_0x536d('0x55'),'userpic','internal',_0x536d('0x56'),_0x536d('0x57'),_0x536d('0x58'),_0x536d('0x59')],'order':qs[_0x536d('0x39')](_0x536d('0x5a')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x536d('0x28'),_0x536d('0x2e')],'through':{'attributes':[]}}]})[_0x536d('0x25')](function(_0x35690a){if(_0x35690a){var _0x19c653=_0x476266[_0x536d('0x53')]['get']({'plain':!![]});if(!_0x19c653)throw new Error(_0x536d('0x5b'));if(_0x19c653['role']===_0x536d('0x53')){return db[_0x536d('0x5c')]['find']({'where':{'name':_0x536d('0x5d'),'userProfileId':_0x19c653[_0x536d('0x5e')]},'raw':!![]})[_0x536d('0x25')](function(_0xb31c56){if(_0xb31c56){if(_0xb31c56[_0x536d('0x5f')]===0x0){return db[_0x536d('0x60')][_0x536d('0x50')]({'where':{'sectionId':_0xb31c56['id']},'raw':!![]})[_0x536d('0x25')](function(_0x3174ea){var _0xe8dd8c=[];if(_[_0x536d('0x61')](_0x3174ea)){_0xe8dd8c=_[_0x536d('0x3d')](_0x35690a,function(_0x42f098){if(_0x42f098['role']!=='agent'){return _0x42f098;}});return _0xe8dd8c;}else{for(var _0x57445d=0x0;_0x57445d<_0x35690a[_0x536d('0x35')];_0x57445d++){var _0x54bd95=_0x35690a[_0x57445d];if(_0x54bd95['role']===_0x536d('0x51')){var _0x2df051=_['find'](_0x3174ea,function(_0x12f310){return _0x12f310['resourceId']===_0x54bd95['id'];});if(_0x2df051)_0xe8dd8c['push'](_0x54bd95);}else{_0xe8dd8c[_0x536d('0x62')](_0x54bd95);}}return _0xe8dd8c;}});}else{return _0x35690a;}}else{var _0x7624f6=_[_0x536d('0x3d')](_0x35690a,function(_0x22e229){if(_0x22e229[_0x536d('0x55')]!==_0x536d('0x51')){return _0x22e229;}});return _0x7624f6;}});}else{return _0x35690a;}}})['then'](function(_0x3339d1){var _0x14e3c1=[];if(_0x3339d1){_0x381535=_0x3339d1;for(var _0x31b072=0x0;_0x31b072<_0x3339d1[_0x536d('0x35')];_0x31b072+=0x1){_0x381535[_0x31b072][_0x536d('0x63')]=[];_0x14e3c1[_0x536d('0x62')](db['ChatInternalMessage'][_0x536d('0x46')]({'where':{'FromId':[_0x476266[_0x536d('0x53')]['id'],_0x3339d1[_0x31b072]['id']],'ToId':[_0x476266[_0x536d('0x53')]['id'],_0x3339d1[_0x31b072]['id']],'ChatGroupId':null},'attributes':['id',_0x536d('0x4c'),_0x536d('0x64'),_0x536d('0x65'),_0x536d('0x66'),_0x536d('0x48')],'order':qs[_0x536d('0x39')](_0x536d('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x3339d1[_0x31b072])));}return BPromise[_0x536d('0x68')](_0x14e3c1);}return[];})[_0x536d('0x25')](function(_0x3c9f21){return{'rows':_0x3c9f21,'count':_0x3c9f21['length']};})[_0x536d('0x25')](respondWithResult(_0x3dcf0f,null))['catch'](handleError(_0x3dcf0f,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 39eebfb..132c095 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 _0xf50a=['setMaxListeners','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf50a,0x1b8));var _0xaf50=function(_0x310eaf,_0x5024e1){_0x310eaf=_0x310eaf-0x0;var _0xbab0d8=_0xf50a[_0x310eaf];return _0xbab0d8;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xaf50('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xaf50('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaf50('0x2'),'afterDestroy':_0xaf50('0x3')};function emitEvent(_0x2a92a6){return function(_0x570778,_0x3db96b,_0x2d9951){ChatInternalMessageEvents['emit'](_0x2a92a6+':'+_0x570778['id'],_0x570778);ChatInternalMessageEvents[_0xaf50('0x4')](_0x2a92a6,_0x570778);_0x2d9951(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xaf50('0x5')](e,emitEvent(event));}}module[_0xaf50('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x4fd7=['ChatInternalMessage','setMaxListeners','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3eacab,_0x315019){var _0x3a42be=function(_0x4dab30){while(--_0x4dab30){_0x3eacab['push'](_0x3eacab['shift']());}};_0x3a42be(++_0x315019);}(_0x4fd7,0xe6));var _0x74fd=function(_0x6d6d83,_0x46380b){_0x6d6d83=_0x6d6d83-0x0;var _0x52af18=_0x4fd7[_0x6d6d83];return _0x52af18;};'use strict';var EventEmitter=require(_0x74fd('0x0'));var ChatInternalMessage=require(_0x74fd('0x1'))['db'][_0x74fd('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x74fd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x74fd('0x4')};function emitEvent(_0x29109a){return function(_0x59e3f1,_0x34f92f,_0x4a343e){ChatInternalMessageEvents[_0x74fd('0x5')](_0x29109a+':'+_0x59e3f1['id'],_0x59e3f1);ChatInternalMessageEvents['emit'](_0x29109a,_0x59e3f1);_0x4a343e(null);};}for(var e in events){if(events[_0x74fd('0x6')](e)){var event=events[e];ChatInternalMessage[_0x74fd('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 097c4cd..2d555c5 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 _0xb137=['moment','request-promise','path','rimraf','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5a98d5,_0x1f476d){var _0x753c1b=function(_0x4e0ba6){while(--_0x4e0ba6){_0x5a98d5['push'](_0x5a98d5['shift']());}};_0x753c1b(++_0x1f476d);}(_0xb137,0x1b8));var _0x7b13=function(_0x40a77f,_0x1d5f8d){_0x40a77f=_0x40a77f-0x0;var _0x415aa1=_0xb137[_0x40a77f];return _0x415aa1;};'use strict';var _=require(_0x7b13('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7b13('0x1'));var BPromise=require('bluebird');var rp=require(_0x7b13('0x2'));var fs=require('fs');var path=require(_0x7b13('0x3'));var rimraf=require(_0x7b13('0x4'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x7b13('0x5')]=function(_0x41047e,_0x2a6a76){return _0x41047e[_0x7b13('0x6')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b13('0x7'),'collate':_0x7b13('0x8')});}; \ No newline at end of file +var _0x8835=['chat_internal_messages','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage'];(function(_0x721e9f,_0x40e826){var _0x5d2286=function(_0x4f4edd){while(--_0x4f4edd){_0x721e9f['push'](_0x721e9f['shift']());}};_0x5d2286(++_0x40e826);}(_0x8835,0x9d));var _0x5883=function(_0x59c031,_0x35ae0c){_0x59c031=_0x59c031-0x0;var _0x3c31e0=_0x8835[_0x59c031];return _0x3c31e0;};'use strict';var _=require(_0x5883('0x0'));var util=require(_0x5883('0x1'));var logger=require('../../config/logger')(_0x5883('0x2'));var moment=require(_0x5883('0x3'));var BPromise=require(_0x5883('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5883('0x5'));var rimraf=require(_0x5883('0x6'));var config=require(_0x5883('0x7'));var attributes=require(_0x5883('0x8'));module[_0x5883('0x9')]=function(_0x101172,_0x137cbe){return _0x101172[_0x5883('0xa')](_0x5883('0xb'),attributes,{'tableName':_0x5883('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 9bc39eb..f1cc171 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 _0xc0b7=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x37ad4c,_0x2c8a9c){var _0x2c14d6=function(_0x4962cf){while(--_0x4962cf){_0x37ad4c['push'](_0x37ad4c['shift']());}};_0x2c14d6(++_0x2c8a9c);}(_0xc0b7,0xb9));var _0x7c0b=function(_0x2f4141,_0x3de02a){_0x2f4141=_0x2f4141-0x0;var _0x36f1ad=_0xc0b7[_0x2f4141];return _0x36f1ad;};'use strict';var _=require('lodash');var util=require(_0x7c0b('0x0'));var moment=require(_0x7c0b('0x1'));var BPromise=require(_0x7c0b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c0b('0x3'))['db'];var utils=require(_0x7c0b('0x4'));var logger=require(_0x7c0b('0x5'))(_0x7c0b('0x6'));var config=require(_0x7c0b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7c0b('0x8')][_0x7c0b('0x9')]({'port':0x232a});config[_0x7c0b('0xa')]=_[_0x7c0b('0xb')](config['redis'],{'host':_0x7c0b('0xc'),'port':0x18eb});var socket=require(_0x7c0b('0xd'))(new Redis(config[_0x7c0b('0xa')]));require(_0x7c0b('0xe'))[_0x7c0b('0xf')](socket);function respondWithRpcPromise(_0x570c11,_0x34016e,_0xb36415){return new BPromise(function(_0x474b76,_0x5ca70a){return client['request'](_0x570c11,_0xb36415)['then'](function(_0x2ae24f){logger[_0x7c0b('0x10')](_0x7c0b('0x11'),_0x34016e,_0x7c0b('0x12'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x34016e,'request\x20sent',JSON[_0x7c0b('0x13')](_0x2ae24f));if(_0x2ae24f['error']){if(_0x2ae24f[_0x7c0b('0x14')]['code']===0x1f4){logger[_0x7c0b('0x14')](_0x7c0b('0x11'),_0x34016e,_0x2ae24f[_0x7c0b('0x14')][_0x7c0b('0x15')]);return _0x5ca70a(_0x2ae24f['error'][_0x7c0b('0x15')]);}logger[_0x7c0b('0x14')](_0x7c0b('0x11'),_0x34016e,_0x2ae24f['error']['message']);return _0x474b76(_0x2ae24f[_0x7c0b('0x14')][_0x7c0b('0x15')]);}else{logger[_0x7c0b('0x10')](_0x7c0b('0x11'),_0x34016e,_0x7c0b('0x12'));_0x474b76(_0x2ae24f[_0x7c0b('0x16')][_0x7c0b('0x15')]);}})[_0x7c0b('0x17')](function(_0x48bc5c){logger[_0x7c0b('0x14')](_0x7c0b('0x11'),_0x34016e,_0x48bc5c);_0x5ca70a(_0x48bc5c);});});} \ No newline at end of file +var _0xe596=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe596,0x152));var _0x6e59=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xe596[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require(_0x6e59('0x0'));var moment=require(_0x6e59('0x1'));var BPromise=require('bluebird');var rs=require(_0x6e59('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e59('0x3'))['db'];var utils=require(_0x6e59('0x4'));var logger=require(_0x6e59('0x5'))(_0x6e59('0x6'));var config=require('../../config/environment');var jayson=require(_0x6e59('0x7'));var client=jayson[_0x6e59('0x8')][_0x6e59('0x9')]({'port':0x232a});config['redis']=_[_0x6e59('0xa')](config[_0x6e59('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6e59('0xc'))(new Redis(config[_0x6e59('0xb')]));require(_0x6e59('0xd'))[_0x6e59('0xe')](socket);function respondWithRpcPromise(_0x3a6e6c,_0x5989e5,_0x4e0570){return new BPromise(function(_0x41125c,_0x4a1720){return client[_0x6e59('0xf')](_0x3a6e6c,_0x4e0570)[_0x6e59('0x10')](function(_0x1cd72d){logger[_0x6e59('0x11')](_0x6e59('0x12'),_0x5989e5,_0x6e59('0x13'));logger[_0x6e59('0x14')](_0x6e59('0x15'),_0x5989e5,'request\x20sent',JSON[_0x6e59('0x16')](_0x1cd72d));if(_0x1cd72d[_0x6e59('0x17')]){if(_0x1cd72d[_0x6e59('0x17')][_0x6e59('0x18')]===0x1f4){logger[_0x6e59('0x17')](_0x6e59('0x12'),_0x5989e5,_0x1cd72d['error'][_0x6e59('0x19')]);return _0x4a1720(_0x1cd72d[_0x6e59('0x17')][_0x6e59('0x19')]);}logger[_0x6e59('0x17')](_0x6e59('0x12'),_0x5989e5,_0x1cd72d['error']['message']);return _0x41125c(_0x1cd72d[_0x6e59('0x17')][_0x6e59('0x19')]);}else{logger['info'](_0x6e59('0x12'),_0x5989e5,_0x6e59('0x13'));_0x41125c(_0x1cd72d['result']['message']);}})['catch'](function(_0x37dcd8){logger['error'](_0x6e59('0x12'),_0x5989e5,_0x37dcd8);_0x4a1720(_0x37dcd8);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 7aced4b..f3e2007 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 _0x5d55=['save','update','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x3e43b3,_0xfb2173){var _0x576c32=function(_0x29f81f){while(--_0x29f81f){_0x3e43b3['push'](_0x3e43b3['shift']());}};_0x576c32(++_0xfb2173);}(_0x5d55,0x1a4));var _0x55d5=function(_0x5aeb2c,_0x462724){_0x5aeb2c=_0x5aeb2c-0x0;var _0x1dcd9e=_0x5d55[_0x5aeb2c];return _0x1dcd9e;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x55d5('0x0'),'remove',_0x55d5('0x1')];function createListener(_0x441dc5,_0x47de4d){return function(_0x46c617){_0x47de4d[_0x55d5('0x2')](_0x441dc5,_0x46c617);};}function removeListener(_0x3bca0b,_0x546e6c){return function(){ChatInternalMessageEvents[_0x55d5('0x3')](_0x3bca0b,_0x546e6c);};}exports[_0x55d5('0x4')]=function(_0x33e5c5){for(var _0x35fe43=0x0,_0x16d364=events[_0x55d5('0x5')];_0x35fe43<_0x16d364;_0x35fe43++){var _0x454144=events[_0x35fe43];var _0x3937d3=createListener(_0x55d5('0x6')+_0x454144,_0x33e5c5);ChatInternalMessageEvents['on'](_0x454144,_0x3937d3);}}; \ No newline at end of file +var _0xbe02=['remove','update','emit','removeListener','register','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x2590ac,_0x323b6b){var _0x3c6a06=function(_0x10bbf9){while(--_0x10bbf9){_0x2590ac['push'](_0x2590ac['shift']());}};_0x3c6a06(++_0x323b6b);}(_0xbe02,0x146));var _0x2be0=function(_0x2e1101,_0x515934){_0x2e1101=_0x2e1101-0x0;var _0x59d9fd=_0xbe02[_0x2e1101];return _0x59d9fd;};'use strict';var ChatInternalMessageEvents=require(_0x2be0('0x0'));var events=[_0x2be0('0x1'),_0x2be0('0x2'),_0x2be0('0x3')];function createListener(_0x56973c,_0x26aef6){return function(_0x2b34c2){_0x26aef6[_0x2be0('0x4')](_0x56973c,_0x2b34c2);};}function removeListener(_0x364c99,_0x22ed11){return function(){ChatInternalMessageEvents[_0x2be0('0x5')](_0x364c99,_0x22ed11);};}exports[_0x2be0('0x6')]=function(_0x474a35){for(var _0x39a2ca=0x0,_0x4e872c=events['length'];_0x39a2ca<_0x4e872c;_0x39a2ca++){var _0x176f12=events[_0x39a2ca];var _0xdfef68=createListener(_0x2be0('0x7')+_0x176f12,_0x474a35);ChatInternalMessageEvents['on'](_0x176f12,_0xdfef68);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 599875a..e3a6f5a 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(_0x5631e5,_0x373f18){var _0x477444=function(_0xc373a7){while(--_0xc373a7){_0x5631e5['push'](_0x5631e5['shift']());}};_0x477444(++_0x373f18);}(_0x70e0,0x17b));var _0x070e=function(_0x6abdbf,_0x54f37e){_0x6abdbf=_0x6abdbf-0x0;var _0x2a5314=_0x70e0[_0x6abdbf];return _0x2a5314;};'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 _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0x17d48d,_0x4074fb){var _0x26aee9=function(_0x13cb1e){while(--_0x13cb1e){_0x17d48d['push'](_0x17d48d['shift']());}};_0x26aee9(++_0x4074fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getUsers']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['put']('/:id',controller['update']);router[_0x0a9e('0xe')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xf')]);module[_0x0a9e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 3ea3d1e..86795c3 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 _0xec15=['medium','BOOLEAN','out','DATE','sequelize'];(function(_0x3628bf,_0x4e7422){var _0x57a32b=function(_0x301081){while(--_0x301081){_0x3628bf['push'](_0x3628bf['shift']());}};_0x57a32b(++_0x4e7422);}(_0xec15,0xe5));var _0x5ec1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec15[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x5ec1('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x5ec1('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x5ec1('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5ec1('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5ec1('0x3')),'defaultValue':_0x5ec1('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x5ec1('0x4')]}}; \ No newline at end of file +var _0xd48e=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x3870fe,_0x510bd2){var _0x3fff97=function(_0x3d2514){while(--_0x3d2514){_0x3870fe['push'](_0x3870fe['shift']());}};_0x3fff97(++_0x510bd2);}(_0xd48e,0x155));var _0xed48=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xd48e[_0x166742];return _0xb7814a;};'use strict';var Sequelize=require(_0xed48('0x0'));module[_0xed48('0x1')]={'body':{'type':Sequelize[_0xed48('0x2')](_0xed48('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xed48('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xed48('0x5')]('in',_0xed48('0x6')),'defaultValue':_0xed48('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xed48('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index ad83389..42e00dd 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 _0xc425=['user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','UserId','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','role','AcceptMessage','acceptMessage','manual','SIP/%s','channel','EventManager','acceptmessage','parse','formData','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./chatMessage.socket','register','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','end','stack','send','map','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','ChatMessage','includeAll','include','findAll','rows','show','params','keys','find','body','describe','chat-interactions','accept','chat','readAt'];(function(_0x2ac9e6,_0x5c156d){var _0x4541a5=function(_0x211a8c){while(--_0x211a8c){_0x2ac9e6['push'](_0x2ac9e6['shift']());}};_0x4541a5(++_0x5c156d);}(_0xc425,0x109));var _0x5c42=function(_0x48cdf6,_0x275d81){_0x48cdf6=_0x48cdf6-0x0;var _0x5210c1=_0xc425[_0x48cdf6];return _0x5210c1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5c42('0x0'));var rimraf=require(_0x5c42('0x1'));var zipdir=require(_0x5c42('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c42('0x3'));var moment=require(_0x5c42('0x4'));var BPromise=require(_0x5c42('0x5'));var Mustache=require(_0x5c42('0x6'));var util=require(_0x5c42('0x7'));var path=require(_0x5c42('0x8'));var sox=require('sox');var csv=require(_0x5c42('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5c42('0xa'));var squel=require(_0x5c42('0xb'));var crypto=require(_0x5c42('0xc'));var jsforce=require(_0x5c42('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5c42('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5c42('0xe'));var qs=require(_0x5c42('0xf'));var as=require(_0x5c42('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c42('0x11'))(_0x5c42('0x12'));var utils=require(_0x5c42('0x13'));var config=require('../../config/environment');var db=require(_0x5c42('0x14'))['db'];config['redis']=_['defaults'](config[_0x5c42('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x5c42('0x16'))(new Redis(config['redis']));require(_0x5c42('0x17'))[_0x5c42('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5c42('0x19')][_0x5c42('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0x5c42('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x9f56d0,_0x2cb627,_0x59a14c){if(_0x59a14c){var _0x53bf5b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x53bf5b['test'](_0x2cb627)){return _0x9f56d0;}else{throw new db[(_0x5c42('0x1b'))][(_0x5c42('0x1c'))](_0x5c42('0x1d'));}}else{return _0x9f56d0;}}function respondWithRpcPromise(_0x306f9e,_0x51d438,_0x4bbe18,_0x51a64b){return new BPromise(function(_0xe86471,_0x1fb23e){var _0x1211c8=_0x51a64b||client;return _0x1211c8['request'](_0x306f9e,_0x4bbe18)[_0x5c42('0x1e')](function(_0x330515){logger[_0x5c42('0x1f')](_0x5c42('0x20'),_0x51d438,_0x5c42('0x21'));logger[_0x5c42('0x22')](_0x5c42('0x23'),_0x51d438,_0x5c42('0x21'),JSON[_0x5c42('0x24')](_0x330515));if(_0x330515[_0x5c42('0x25')]){if(_0x330515[_0x5c42('0x25')]['code']===0x1f4){logger[_0x5c42('0x25')](_0x5c42('0x20'),_0x51d438,_0x330515[_0x5c42('0x25')][_0x5c42('0x26')]);return _0x1fb23e(_0x330515['error']['message']);}logger[_0x5c42('0x25')](_0x5c42('0x20'),_0x51d438,_0x330515[_0x5c42('0x25')][_0x5c42('0x26')]);return _0xe86471(_0x330515[_0x5c42('0x25')][_0x5c42('0x26')]);}else{logger[_0x5c42('0x1f')]('ChatMessage,\x20%s,\x20%s',_0x51d438,_0x5c42('0x21'));_0xe86471(_0x330515[_0x5c42('0x27')][_0x5c42('0x26')]);}})[_0x5c42('0x28')](function(_0x4cf086){logger[_0x5c42('0x25')](_0x5c42('0x20'),_0x51d438,_0x4cf086);_0x1fb23e(_0x4cf086);});});}function respondWithStatusCode(_0x173aec,_0x1a53d0){_0x1a53d0=_0x1a53d0||0xcc;return function(_0x16257f){if(_0x16257f){return _0x173aec[_0x5c42('0x29')](_0x1a53d0);}return _0x173aec[_0x5c42('0x2a')](_0x1a53d0)['end']();};}function respondWithResult(_0x7f7551,_0x47ad98){_0x47ad98=_0x47ad98||0xc8;return function(_0x33737f){if(_0x33737f){return _0x7f7551[_0x5c42('0x2a')](_0x47ad98)[_0x5c42('0x2b')](_0x33737f);}};}function respondWithFilteredResult(_0x599c3f,_0x4dc685){return function(_0x568b99){if(_0x568b99){var _0x5572e6=_0x568b99['count'],_0x5dff2a=_0x4dc685[_0x5c42('0x2c')],_0x26c4d9=_0x4dc685[_0x5c42('0x2c')]+_0x4dc685[_0x5c42('0x2d')],_0x138701;if(_0x26c4d9>=_0x5572e6){_0x26c4d9=_0x5572e6;_0x138701=0xc8;}else{_0x138701=0xce;}_0x599c3f['status'](_0x138701);return _0x599c3f[_0x5c42('0x2e')](_0x5c42('0x2f'),_0x5dff2a+'-'+_0x26c4d9+'/'+_0x5572e6)[_0x5c42('0x2b')](_0x568b99);}return null;};}function patchUpdates(_0x484bc1){return function(_0x1efdd7){try{jsonpatch[_0x5c42('0x30')](_0x1efdd7,_0x484bc1,!![]);}catch(_0x47858c){return BPromise[_0x5c42('0x31')](_0x47858c);}return _0x1efdd7['save']();};}function saveUpdates(_0x35a642,_0x3538ac){return function(_0x32e2d4){if(_0x32e2d4){return _0x32e2d4[_0x5c42('0x32')](_0x35a642)[_0x5c42('0x1e')](function(_0x5563cc){return _0x5563cc;});}return null;};}function removeEntity(_0x521589,_0x1f1718){return function(_0x24eae7){if(_0x24eae7){return _0x24eae7[_0x5c42('0x33')]()['then'](function(){_0x521589['status'](0xcc)[_0x5c42('0x34')]();});}};}function handleEntityNotFound(_0x5d07c0,_0x712e61){return function(_0x1af75b){if(!_0x1af75b){_0x5d07c0[_0x5c42('0x29')](0x194);}return _0x1af75b;};}function handleError(_0x5943d9,_0x17eacd){_0x17eacd=_0x17eacd||0x1f4;return function(_0x4434e4){logger[_0x5c42('0x25')](_0x4434e4[_0x5c42('0x35')]);if(_0x4434e4['name']){delete _0x4434e4['name'];}_0x5943d9[_0x5c42('0x2a')](_0x17eacd)[_0x5c42('0x36')](_0x4434e4);};}exports['index']=function(_0x2c94d5,_0x3678b1){var _0x2e5cc3={},_0x2cdcf0={},_0x3a055c={'count':0x0,'rows':[]};var _0x5ede5a=_[_0x5c42('0x37')](db['ChatMessage'][_0x5c42('0x38')],function(_0x5ba243){return{'name':_0x5ba243[_0x5c42('0x39')],'type':_0x5ba243[_0x5c42('0x3a')][_0x5c42('0x3b')]};});_0x2cdcf0['model']=_[_0x5c42('0x37')](_0x5ede5a,_0x5c42('0x3c'));_0x2cdcf0[_0x5c42('0x3d')]=_['keys'](_0x2c94d5[_0x5c42('0x3d')]);_0x2cdcf0[_0x5c42('0x3e')]=_[_0x5c42('0x3f')](_0x2cdcf0[_0x5c42('0x40')],_0x2cdcf0[_0x5c42('0x3d')]);_0x2e5cc3['attributes']=_[_0x5c42('0x3f')](_0x2cdcf0['model'],qs['fields'](_0x2c94d5[_0x5c42('0x3d')][_0x5c42('0x41')]));_0x2e5cc3[_0x5c42('0x42')]=_0x2e5cc3[_0x5c42('0x42')][_0x5c42('0x43')]?_0x2e5cc3[_0x5c42('0x42')]:_0x2cdcf0[_0x5c42('0x40')];if(!_0x2c94d5[_0x5c42('0x3d')][_0x5c42('0x44')](_0x5c42('0x45'))){_0x2e5cc3[_0x5c42('0x2d')]=qs[_0x5c42('0x2d')](_0x2c94d5[_0x5c42('0x3d')][_0x5c42('0x2d')]);_0x2e5cc3[_0x5c42('0x2c')]=qs[_0x5c42('0x2c')](_0x2c94d5[_0x5c42('0x3d')]['offset']);}_0x2e5cc3[_0x5c42('0x46')]=qs['sort'](_0x2c94d5[_0x5c42('0x3d')][_0x5c42('0x47')]);_0x2e5cc3['where']=qs[_0x5c42('0x3e')](_['pick'](_0x2c94d5[_0x5c42('0x3d')],_0x2cdcf0[_0x5c42('0x3e')]),_0x5ede5a);if(_0x2c94d5[_0x5c42('0x3d')][_0x5c42('0x48')]){_0x2e5cc3[_0x5c42('0x49')]=_[_0x5c42('0x4a')](_0x2e5cc3[_0x5c42('0x49')],{'$or':_[_0x5c42('0x37')](_0x5ede5a,function(_0x303619){if(_0x303619[_0x5c42('0x3a')]!==_0x5c42('0x4b')){var _0x35564b={};_0x35564b[_0x303619[_0x5c42('0x3c')]]={'$like':'%'+_0x2c94d5['query'][_0x5c42('0x48')]+'%'};return _0x35564b;}})});}_0x2e5cc3=_[_0x5c42('0x4a')]({},_0x2e5cc3,_0x2c94d5[_0x5c42('0x4c')]);var _0x1d3631={'where':_0x2e5cc3['where']};return db[_0x5c42('0x4d')]['count'](_0x1d3631)[_0x5c42('0x1e')](function(_0x364d93){_0x3a055c['count']=_0x364d93;if(_0x2c94d5[_0x5c42('0x3d')][_0x5c42('0x4e')]){_0x2e5cc3[_0x5c42('0x4f')]=[{'all':!![]}];}return db['ChatMessage'][_0x5c42('0x50')](_0x2e5cc3);})[_0x5c42('0x1e')](function(_0x37f9c5){_0x3a055c[_0x5c42('0x51')]=_0x37f9c5;return _0x3a055c;})[_0x5c42('0x1e')](respondWithFilteredResult(_0x3678b1,_0x2e5cc3))[_0x5c42('0x28')](handleError(_0x3678b1,null));};exports[_0x5c42('0x52')]=function(_0x40ce98,_0x4dac35){var _0x48ce89={'raw':!![],'where':{'id':_0x40ce98[_0x5c42('0x53')]['id']}},_0x3f2b2a={};_0x3f2b2a[_0x5c42('0x40')]=_[_0x5c42('0x54')](db['ChatMessage']['rawAttributes']);_0x3f2b2a[_0x5c42('0x3d')]=_['keys'](_0x40ce98[_0x5c42('0x3d')]);_0x3f2b2a[_0x5c42('0x3e')]=_['intersection'](_0x3f2b2a[_0x5c42('0x40')],_0x3f2b2a['query']);_0x48ce89[_0x5c42('0x42')]=_[_0x5c42('0x3f')](_0x3f2b2a['model'],qs['fields'](_0x40ce98[_0x5c42('0x3d')][_0x5c42('0x41')]));_0x48ce89[_0x5c42('0x42')]=_0x48ce89[_0x5c42('0x42')][_0x5c42('0x43')]?_0x48ce89[_0x5c42('0x42')]:_0x3f2b2a[_0x5c42('0x40')];if(_0x40ce98[_0x5c42('0x3d')][_0x5c42('0x4e')]){_0x48ce89[_0x5c42('0x4f')]=[{'all':!![]}];}_0x48ce89=_[_0x5c42('0x4a')]({},_0x48ce89,_0x40ce98[_0x5c42('0x4c')]);return db[_0x5c42('0x4d')][_0x5c42('0x55')](_0x48ce89)[_0x5c42('0x1e')](handleEntityNotFound(_0x4dac35,null))[_0x5c42('0x1e')](respondWithResult(_0x4dac35,null))['catch'](handleError(_0x4dac35,null));};exports['create']=function(_0x37b5d8,_0x2c98e7){return db['ChatMessage']['create'](_0x37b5d8[_0x5c42('0x56')],{})[_0x5c42('0x1e')](respondWithResult(_0x2c98e7,0xc9))['catch'](handleError(_0x2c98e7,null));};exports[_0x5c42('0x32')]=function(_0xcad152,_0x59d975){if(_0xcad152[_0x5c42('0x56')]['id']){delete _0xcad152[_0x5c42('0x56')]['id'];}return db[_0x5c42('0x4d')][_0x5c42('0x55')]({'where':{'id':_0xcad152[_0x5c42('0x53')]['id']}})[_0x5c42('0x1e')](handleEntityNotFound(_0x59d975,null))['then'](saveUpdates(_0xcad152[_0x5c42('0x56')],null))['then'](respondWithResult(_0x59d975,null))[_0x5c42('0x28')](handleError(_0x59d975,null));};exports[_0x5c42('0x33')]=function(_0x3c74a6,_0x48ca91){return db[_0x5c42('0x4d')][_0x5c42('0x55')]({'where':{'id':_0x3c74a6[_0x5c42('0x53')]['id']}})['then'](handleEntityNotFound(_0x48ca91,null))['then'](removeEntity(_0x48ca91,null))[_0x5c42('0x28')](handleError(_0x48ca91,null));};exports[_0x5c42('0x57')]=function(_0x545675,_0x3fe0de){return db[_0x5c42('0x4d')][_0x5c42('0x57')]()[_0x5c42('0x1e')](respondWithResult(_0x3fe0de,null))[_0x5c42('0x28')](handleError(_0x3fe0de,null));};var interaction_log=require(_0x5c42('0x11'))(_0x5c42('0x58'));exports[_0x5c42('0x59')]=function(_0x88df60,_0x4b57ca,_0x9e4416){var _0x42ed71={'channel':_0x5c42('0x5a')};if(_0x88df60[_0x5c42('0x56')]['id']){delete _0x88df60[_0x5c42('0x56')]['id'];}_0x88df60[_0x5c42('0x56')]['read']=!![];_0x88df60[_0x5c42('0x56')][_0x5c42('0x5b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x88df60['body']['UserId']=_0x88df60[_0x5c42('0x56')]['UserId']||_0x88df60[_0x5c42('0x5c')]['id'];return db['ChatMessage'][_0x5c42('0x55')]({'where':{'id':_0x88df60[_0x5c42('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x5c42('0x5d')],'as':_0x5c42('0x5e')}]})[_0x5c42('0x1e')](handleEntityNotFound(_0x4b57ca,null))[_0x5c42('0x1e')](saveUpdates(_0x88df60[_0x5c42('0x56')],null))['then'](function(_0x2979f9){if(_0x2979f9){_0x42ed71[_0x5c42('0x26')]=_0x2979f9[_0x5c42('0x5f')]({'plain':!![]});return db[_0x5c42('0x60')][_0x5c42('0x55')]({'where':{'id':_0x2979f9[_0x5c42('0x61')]}});}return null;})[_0x5c42('0x1e')](handleEntityNotFound(_0x4b57ca,null))['then'](function(_0x1da70a){if(_0x1da70a){return _0x1da70a[_0x5c42('0x32')]({'UserId':_0x88df60['body'][_0x5c42('0x62')],'read1stAt':_['isNil'](_0x1da70a[_0x5c42('0x63')])?moment()[_0x5c42('0x64')](_0x5c42('0x65')):undefined});}return null;})[_0x5c42('0x1e')](function(_0x52253f){if(_0x52253f){_0x42ed71[_0x5c42('0x66')]=_0x52253f['get']({'plain':!![]});interaction_log[_0x5c42('0x1f')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x88df60[_0x5c42('0x5c')]['id'],_0x88df60[_0x5c42('0x5c')][_0x5c42('0x3c')],_0x88df60[_0x5c42('0x5c')][_0x5c42('0x67')],_0x42ed71['interaction']['id'],_0x88df60[_0x5c42('0x56')]?JSON['stringify'](_0x88df60[_0x5c42('0x56')]):'null');return respondWithRpcPromise(_0x5c42('0x68'),_0x5c42('0x69'),_0x42ed71);}return null;})[_0x5c42('0x1e')](function(_0x3688ce){if(_0x3688ce){if(_0x88df60[_0x5c42('0x56')][_0x5c42('0x6a')]){_0x42ed71[_0x5c42('0x26')]['interface']=util[_0x5c42('0x64')](_0x5c42('0x6b'),_0x88df60[_0x5c42('0x5c')]['name']);_0x42ed71[_0x5c42('0x26')][_0x5c42('0x6c')]=_0x42ed71['channel'];_0x42ed71[_0x5c42('0x26')]['event']=_0x5c42('0x59');return respondWithRpcPromise(_0x5c42('0x6d'),_0x5c42('0x6d'),{'event':_0x5c42('0x6e'),'message':_[_0x5c42('0x4a')](_0x42ed71[_0x5c42('0x26')],JSON[_0x5c42('0x6f')](_0x42ed71[_0x5c42('0x66')][_0x5c42('0x70')]))},client9002)[_0x5c42('0x1e')](function(){return _0x42ed71;});}return _0x42ed71;}return null;})['then'](respondWithResult(_0x4b57ca,null))[_0x5c42('0x28')](handleError(_0x4b57ca,null));};var interaction_log=require(_0x5c42('0x11'))(_0x5c42('0x58'));exports['reject']=function(_0x1e1d18,_0x5cec7,_0x56c36b){var _0x1b324b={'agent':{},'channel':'chat'};if(_0x1e1d18[_0x5c42('0x56')]['id']){delete _0x1e1d18['body']['id'];}_0x1e1d18[_0x5c42('0x56')][_0x5c42('0x62')]=_0x1e1d18[_0x5c42('0x56')][_0x5c42('0x62')]||_0x1e1d18[_0x5c42('0x5c')]['id'];_0x1b324b[_0x5c42('0x71')]['id']=_0x1e1d18[_0x5c42('0x56')][_0x5c42('0x62')];return db[_0x5c42('0x4d')][_0x5c42('0x55')]({'where':{'id':_0x1e1d18['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5cec7,null))['then'](function(_0x8e237c){if(_0x8e237c){_0x1b324b[_0x5c42('0x26')]=_0x8e237c[_0x5c42('0x5f')]({'plain':!![]});return db[_0x5c42('0x60')][_0x5c42('0x55')]({'where':{'id':_0x8e237c[_0x5c42('0x61')]}});}return null;})[_0x5c42('0x1e')](handleEntityNotFound(_0x5cec7,null))['then'](function(_0x28753c){if(_0x28753c){_0x1b324b['interaction']=_0x28753c[_0x5c42('0x5f')]({'plain':!![]});interaction_log[_0x5c42('0x1f')](_0x5c42('0x72'),_0x1e1d18[_0x5c42('0x5c')]['id'],_0x1e1d18[_0x5c42('0x5c')][_0x5c42('0x3c')],_0x1e1d18['user']['role'],_0x1b324b[_0x5c42('0x66')]['id'],_0x1e1d18[_0x5c42('0x56')]?JSON[_0x5c42('0x24')](_0x1e1d18['body']):'null');return respondWithRpcPromise(_0x5c42('0x73'),_0x5c42('0x74'),_0x1b324b);}return null;})['then'](function(_0x3b2e13){if(_0x3b2e13){_0x3b2e13[_0x5c42('0x26')][_0x5c42('0x75')]=util[_0x5c42('0x64')]('SIP/%s',_0x1e1d18['user'][_0x5c42('0x3c')]);_0x3b2e13[_0x5c42('0x26')][_0x5c42('0x6c')]=_0x1b324b[_0x5c42('0x6c')];_0x3b2e13[_0x5c42('0x26')]['event']='reject';respondWithRpcPromise(_0x5c42('0x6d'),'EventManager',{'event':_0x5c42('0x76'),'message':_0x3b2e13[_0x5c42('0x26')]},client9002);return _0x1b324b;}return null;})['then'](respondWithResult(_0x5cec7,null))[_0x5c42('0x28')](handleError(_0x5cec7,null));}; \ No newline at end of file +var _0x1362=['request','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','status','end','offset','limit','set','Content-Range','json','apply','reject','save','then','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','../../config/logger','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','get','ChatInteraction','ChatInteractionId','update','read1stAt','info','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','interface','SIP/%s','channel','event','accept','EventManager','parse','interaction','agent','RejectMessage','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.'];(function(_0x3287c4,_0x5a6b3e){var _0x2015ef=function(_0x269d69){while(--_0x269d69){_0x3287c4['push'](_0x3287c4['shift']());}};_0x2015ef(++_0x5a6b3e);}(_0x1362,0x1b8));var _0x2136=function(_0x19dbc6,_0x41b28a){_0x19dbc6=_0x19dbc6-0x0;var _0xf4481e=_0x1362[_0x19dbc6];return _0xf4481e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2136('0x0'));var rimraf=require(_0x2136('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2136('0x2'));var rp=require('request-promise');var moment=require(_0x2136('0x3'));var BPromise=require(_0x2136('0x4'));var Mustache=require(_0x2136('0x5'));var util=require(_0x2136('0x6'));var path=require(_0x2136('0x7'));var sox=require(_0x2136('0x8'));var csv=require(_0x2136('0x9'));var ejs=require(_0x2136('0xa'));var fs=require('fs');var _=require(_0x2136('0xb'));var squel=require(_0x2136('0xc'));var crypto=require(_0x2136('0xd'));var jsforce=require(_0x2136('0xe'));var deskjs=require(_0x2136('0xf'));var toCsv=require(_0x2136('0x9'));var querystring=require('querystring');var Papa=require(_0x2136('0x10'));var Redis=require(_0x2136('0x11'));var authService=require(_0x2136('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2136('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2136('0x14'));var utils=require('../../config/utils');var config=require(_0x2136('0x15'));var db=require('../../mysqldb')['db'];config[_0x2136('0x16')]=_[_0x2136('0x17')](config[_0x2136('0x16')],{'host':_0x2136('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2136('0x16')]));require(_0x2136('0x19'))[_0x2136('0x1a')](socket);var jayson=require(_0x2136('0x1b'));var client=jayson[_0x2136('0x1c')][_0x2136('0x1d')]({'port':0x232c});var client9002=jayson[_0x2136('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x301e22,_0x5da705,_0x2e1215){if(_0x2e1215){var _0x1a8cba=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a8cba[_0x2136('0x1e')](_0x5da705)){return _0x301e22;}else{throw new db['Sequelize']['ValidationError'](_0x2136('0x1f'));}}else{return _0x301e22;}}function respondWithRpcPromise(_0x5637f8,_0x41992e,_0x3eb8b0,_0x36fe5e){return new BPromise(function(_0x575799,_0x110f75){var _0x14cdc9=_0x36fe5e||client;return _0x14cdc9[_0x2136('0x20')](_0x5637f8,_0x3eb8b0)['then'](function(_0x8ac39e){logger['info'](_0x2136('0x21'),_0x41992e,'request\x20sent');logger[_0x2136('0x22')](_0x2136('0x23'),_0x41992e,_0x2136('0x24'),JSON[_0x2136('0x25')](_0x8ac39e));if(_0x8ac39e['error']){if(_0x8ac39e[_0x2136('0x26')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x41992e,_0x8ac39e['error'][_0x2136('0x27')]);return _0x110f75(_0x8ac39e[_0x2136('0x26')][_0x2136('0x27')]);}logger[_0x2136('0x26')]('ChatMessage,\x20%s,\x20%s',_0x41992e,_0x8ac39e[_0x2136('0x26')]['message']);return _0x575799(_0x8ac39e[_0x2136('0x26')]['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x41992e,'request\x20sent');_0x575799(_0x8ac39e[_0x2136('0x28')][_0x2136('0x27')]);}})['catch'](function(_0x3fce52){logger[_0x2136('0x26')](_0x2136('0x21'),_0x41992e,_0x3fce52);_0x110f75(_0x3fce52);});});}function respondWithStatusCode(_0x5c25ef,_0x146d43){_0x146d43=_0x146d43||0xcc;return function(_0x21cbba){if(_0x21cbba){return _0x5c25ef['sendStatus'](_0x146d43);}return _0x5c25ef[_0x2136('0x29')](_0x146d43)[_0x2136('0x2a')]();};}function respondWithResult(_0x152b93,_0x2e34fd){_0x2e34fd=_0x2e34fd||0xc8;return function(_0x54f25f){if(_0x54f25f){return _0x152b93['status'](_0x2e34fd)['json'](_0x54f25f);}};}function respondWithFilteredResult(_0x1bec70,_0x542d4c){return function(_0xd7ec41){if(_0xd7ec41){var _0x2ed710=_0xd7ec41['count'],_0x5e41cc=_0x542d4c[_0x2136('0x2b')],_0x2464e3=_0x542d4c[_0x2136('0x2b')]+_0x542d4c[_0x2136('0x2c')],_0x2a6f4b;if(_0x2464e3>=_0x2ed710){_0x2464e3=_0x2ed710;_0x2a6f4b=0xc8;}else{_0x2a6f4b=0xce;}_0x1bec70[_0x2136('0x29')](_0x2a6f4b);return _0x1bec70[_0x2136('0x2d')](_0x2136('0x2e'),_0x5e41cc+'-'+_0x2464e3+'/'+_0x2ed710)[_0x2136('0x2f')](_0xd7ec41);}return null;};}function patchUpdates(_0x3a75ec){return function(_0x1b558a){try{jsonpatch[_0x2136('0x30')](_0x1b558a,_0x3a75ec,!![]);}catch(_0x2b9ce5){return BPromise[_0x2136('0x31')](_0x2b9ce5);}return _0x1b558a[_0x2136('0x32')]();};}function saveUpdates(_0x3f8c5d,_0x15b740){return function(_0x326507){if(_0x326507){return _0x326507['update'](_0x3f8c5d)[_0x2136('0x33')](function(_0x35c878){return _0x35c878;});}return null;};}function removeEntity(_0x53933a,_0x1d60f6){return function(_0x4da294){if(_0x4da294){return _0x4da294['destroy']()[_0x2136('0x33')](function(){_0x53933a[_0x2136('0x29')](0xcc)[_0x2136('0x2a')]();});}};}function handleEntityNotFound(_0x293d6f,_0x36882a){return function(_0x3ea323){if(!_0x3ea323){_0x293d6f['sendStatus'](0x194);}return _0x3ea323;};}function handleError(_0x4d713c,_0x15a5f3){_0x15a5f3=_0x15a5f3||0x1f4;return function(_0xa2a96e){logger['error'](_0xa2a96e['stack']);if(_0xa2a96e['name']){delete _0xa2a96e[_0x2136('0x34')];}_0x4d713c[_0x2136('0x29')](_0x15a5f3)[_0x2136('0x35')](_0xa2a96e);};}exports[_0x2136('0x36')]=function(_0x5d6bcc,_0x3e69ec){var _0x332434={},_0x170b94={},_0x2e85b1={'count':0x0,'rows':[]};var _0x27658b=_[_0x2136('0x37')](db[_0x2136('0x38')][_0x2136('0x39')],function(_0x18a739){return{'name':_0x18a739[_0x2136('0x3a')],'type':_0x18a739['type'][_0x2136('0x3b')]};});_0x170b94['model']=_[_0x2136('0x37')](_0x27658b,_0x2136('0x34'));_0x170b94[_0x2136('0x3c')]=_[_0x2136('0x3d')](_0x5d6bcc[_0x2136('0x3c')]);_0x170b94[_0x2136('0x3e')]=_[_0x2136('0x3f')](_0x170b94[_0x2136('0x40')],_0x170b94['query']);_0x332434[_0x2136('0x41')]=_[_0x2136('0x3f')](_0x170b94[_0x2136('0x40')],qs[_0x2136('0x42')](_0x5d6bcc[_0x2136('0x3c')][_0x2136('0x42')]));_0x332434[_0x2136('0x41')]=_0x332434[_0x2136('0x41')]['length']?_0x332434['attributes']:_0x170b94['model'];if(!_0x5d6bcc['query'][_0x2136('0x43')]('nolimit')){_0x332434[_0x2136('0x2c')]=qs[_0x2136('0x2c')](_0x5d6bcc[_0x2136('0x3c')]['limit']);_0x332434[_0x2136('0x2b')]=qs['offset'](_0x5d6bcc[_0x2136('0x3c')][_0x2136('0x2b')]);}_0x332434[_0x2136('0x44')]=qs[_0x2136('0x45')](_0x5d6bcc['query'][_0x2136('0x45')]);_0x332434[_0x2136('0x46')]=qs[_0x2136('0x3e')](_[_0x2136('0x47')](_0x5d6bcc[_0x2136('0x3c')],_0x170b94[_0x2136('0x3e')]),_0x27658b);if(_0x5d6bcc[_0x2136('0x3c')][_0x2136('0x48')]){_0x332434[_0x2136('0x46')]=_[_0x2136('0x49')](_0x332434[_0x2136('0x46')],{'$or':_[_0x2136('0x37')](_0x27658b,function(_0x5e2b50){if(_0x5e2b50['type']!=='VIRTUAL'){var _0x3a5c15={};_0x3a5c15[_0x5e2b50[_0x2136('0x34')]]={'$like':'%'+_0x5d6bcc[_0x2136('0x3c')][_0x2136('0x48')]+'%'};return _0x3a5c15;}})});}_0x332434=_[_0x2136('0x49')]({},_0x332434,_0x5d6bcc[_0x2136('0x4a')]);var _0x6edd15={'where':_0x332434[_0x2136('0x46')]};return db['ChatMessage'][_0x2136('0x4b')](_0x6edd15)['then'](function(_0x1cfdd2){_0x2e85b1['count']=_0x1cfdd2;if(_0x5d6bcc[_0x2136('0x3c')][_0x2136('0x4c')]){_0x332434[_0x2136('0x4d')]=[{'all':!![]}];}return db[_0x2136('0x38')][_0x2136('0x4e')](_0x332434);})[_0x2136('0x33')](function(_0x2f07b4){_0x2e85b1[_0x2136('0x4f')]=_0x2f07b4;return _0x2e85b1;})[_0x2136('0x33')](respondWithFilteredResult(_0x3e69ec,_0x332434))[_0x2136('0x50')](handleError(_0x3e69ec,null));};exports[_0x2136('0x51')]=function(_0x5a0bfd,_0x3f3dfb){var _0x53cb2f={'raw':!![],'where':{'id':_0x5a0bfd[_0x2136('0x52')]['id']}},_0x17e5f0={};_0x17e5f0[_0x2136('0x40')]=_[_0x2136('0x3d')](db[_0x2136('0x38')]['rawAttributes']);_0x17e5f0[_0x2136('0x3c')]=_[_0x2136('0x3d')](_0x5a0bfd['query']);_0x17e5f0['filters']=_['intersection'](_0x17e5f0[_0x2136('0x40')],_0x17e5f0['query']);_0x53cb2f[_0x2136('0x41')]=_['intersection'](_0x17e5f0['model'],qs[_0x2136('0x42')](_0x5a0bfd[_0x2136('0x3c')][_0x2136('0x42')]));_0x53cb2f['attributes']=_0x53cb2f[_0x2136('0x41')]['length']?_0x53cb2f[_0x2136('0x41')]:_0x17e5f0[_0x2136('0x40')];if(_0x5a0bfd[_0x2136('0x3c')]['includeAll']){_0x53cb2f[_0x2136('0x4d')]=[{'all':!![]}];}_0x53cb2f=_[_0x2136('0x49')]({},_0x53cb2f,_0x5a0bfd[_0x2136('0x4a')]);return db['ChatMessage'][_0x2136('0x53')](_0x53cb2f)[_0x2136('0x33')](handleEntityNotFound(_0x3f3dfb,null))[_0x2136('0x33')](respondWithResult(_0x3f3dfb,null))[_0x2136('0x50')](handleError(_0x3f3dfb,null));};exports[_0x2136('0x54')]=function(_0x5c0342,_0x17e70f){return db[_0x2136('0x38')][_0x2136('0x54')](_0x5c0342[_0x2136('0x55')],{})[_0x2136('0x33')](respondWithResult(_0x17e70f,0xc9))[_0x2136('0x50')](handleError(_0x17e70f,null));};exports['update']=function(_0xc81bdf,_0x2b023e){if(_0xc81bdf[_0x2136('0x55')]['id']){delete _0xc81bdf[_0x2136('0x55')]['id'];}return db['ChatMessage'][_0x2136('0x53')]({'where':{'id':_0xc81bdf['params']['id']}})[_0x2136('0x33')](handleEntityNotFound(_0x2b023e,null))['then'](saveUpdates(_0xc81bdf[_0x2136('0x55')],null))['then'](respondWithResult(_0x2b023e,null))[_0x2136('0x50')](handleError(_0x2b023e,null));};exports[_0x2136('0x56')]=function(_0x3d4123,_0x3fd5d1){return db[_0x2136('0x38')][_0x2136('0x53')]({'where':{'id':_0x3d4123[_0x2136('0x52')]['id']}})['then'](handleEntityNotFound(_0x3fd5d1,null))[_0x2136('0x33')](removeEntity(_0x3fd5d1,null))[_0x2136('0x50')](handleError(_0x3fd5d1,null));};exports[_0x2136('0x57')]=function(_0x469a42,_0x16dbde){return db[_0x2136('0x38')][_0x2136('0x57')]()[_0x2136('0x33')](respondWithResult(_0x16dbde,null))[_0x2136('0x50')](handleError(_0x16dbde,null));};var interaction_log=require(_0x2136('0x58'))(_0x2136('0x59'));exports['accept']=function(_0x298acd,_0x51dfb4,_0x1d7e13){var _0x4c46da={'channel':_0x2136('0x5a')};if(_0x298acd[_0x2136('0x55')]['id']){delete _0x298acd[_0x2136('0x55')]['id'];}_0x298acd['body'][_0x2136('0x5b')]=!![];_0x298acd[_0x2136('0x55')][_0x2136('0x5c')]=moment()[_0x2136('0x5d')](_0x2136('0x5e'));_0x298acd['body'][_0x2136('0x5f')]=_0x298acd['body']['UserId']||_0x298acd['user']['id'];return db[_0x2136('0x38')][_0x2136('0x53')]({'where':{'id':_0x298acd[_0x2136('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x2136('0x60')],'as':'Contact'}]})[_0x2136('0x33')](handleEntityNotFound(_0x51dfb4,null))['then'](saveUpdates(_0x298acd[_0x2136('0x55')],null))[_0x2136('0x33')](function(_0x3dd040){if(_0x3dd040){_0x4c46da[_0x2136('0x27')]=_0x3dd040[_0x2136('0x61')]({'plain':!![]});return db[_0x2136('0x62')]['find']({'where':{'id':_0x3dd040[_0x2136('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x51dfb4,null))['then'](function(_0x5d1bd2){if(_0x5d1bd2){return _0x5d1bd2[_0x2136('0x64')]({'UserId':_0x298acd[_0x2136('0x55')]['UserId'],'read1stAt':_['isNil'](_0x5d1bd2[_0x2136('0x65')])?moment()['format'](_0x2136('0x5e')):undefined});}return null;})['then'](function(_0x1d0429){if(_0x1d0429){_0x4c46da['interaction']=_0x1d0429[_0x2136('0x61')]({'plain':!![]});interaction_log[_0x2136('0x66')](_0x2136('0x67'),_0x298acd[_0x2136('0x68')]['id'],_0x298acd[_0x2136('0x68')]['name'],_0x298acd[_0x2136('0x68')][_0x2136('0x69')],_0x4c46da['interaction']['id'],_0x298acd[_0x2136('0x55')]?JSON[_0x2136('0x25')](_0x298acd[_0x2136('0x55')]):_0x2136('0x6a'));return respondWithRpcPromise(_0x2136('0x6b'),'acceptMessage',_0x4c46da);}return null;})[_0x2136('0x33')](function(_0x5d5248){if(_0x5d5248){if(_0x298acd[_0x2136('0x55')]['manual']){_0x4c46da[_0x2136('0x27')][_0x2136('0x6c')]=util[_0x2136('0x5d')](_0x2136('0x6d'),_0x298acd[_0x2136('0x68')][_0x2136('0x34')]);_0x4c46da['message'][_0x2136('0x6e')]=_0x4c46da[_0x2136('0x6e')];_0x4c46da[_0x2136('0x27')][_0x2136('0x6f')]=_0x2136('0x70');return respondWithRpcPromise('EventManager',_0x2136('0x71'),{'event':'acceptmessage','message':_[_0x2136('0x49')](_0x4c46da[_0x2136('0x27')],JSON[_0x2136('0x72')](_0x4c46da[_0x2136('0x73')]['formData']))},client9002)[_0x2136('0x33')](function(){return _0x4c46da;});}return _0x4c46da;}return null;})[_0x2136('0x33')](respondWithResult(_0x51dfb4,null))[_0x2136('0x50')](handleError(_0x51dfb4,null));};var interaction_log=require(_0x2136('0x58'))(_0x2136('0x59'));exports['reject']=function(_0x14d6f8,_0x507e26,_0x106d0d){var _0x5ad326={'agent':{},'channel':_0x2136('0x5a')};if(_0x14d6f8[_0x2136('0x55')]['id']){delete _0x14d6f8['body']['id'];}_0x14d6f8[_0x2136('0x55')][_0x2136('0x5f')]=_0x14d6f8[_0x2136('0x55')][_0x2136('0x5f')]||_0x14d6f8[_0x2136('0x68')]['id'];_0x5ad326[_0x2136('0x74')]['id']=_0x14d6f8[_0x2136('0x55')]['UserId'];return db[_0x2136('0x38')][_0x2136('0x53')]({'where':{'id':_0x14d6f8['params']['id'],'UserId':null}})[_0x2136('0x33')](handleEntityNotFound(_0x507e26,null))['then'](function(_0x4b7fc0){if(_0x4b7fc0){_0x5ad326['message']=_0x4b7fc0[_0x2136('0x61')]({'plain':!![]});return db[_0x2136('0x62')][_0x2136('0x53')]({'where':{'id':_0x4b7fc0['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x507e26,null))[_0x2136('0x33')](function(_0xb10a1f){if(_0xb10a1f){_0x5ad326[_0x2136('0x73')]=_0xb10a1f[_0x2136('0x61')]({'plain':!![]});interaction_log[_0x2136('0x66')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x14d6f8[_0x2136('0x68')]['id'],_0x14d6f8['user']['name'],_0x14d6f8[_0x2136('0x68')][_0x2136('0x69')],_0x5ad326['interaction']['id'],_0x14d6f8[_0x2136('0x55')]?JSON['stringify'](_0x14d6f8[_0x2136('0x55')]):'null');return respondWithRpcPromise(_0x2136('0x75'),'rejectMessage',_0x5ad326);}return null;})['then'](function(_0x289ca3){if(_0x289ca3){_0x289ca3[_0x2136('0x27')][_0x2136('0x6c')]=util[_0x2136('0x5d')](_0x2136('0x6d'),_0x14d6f8[_0x2136('0x68')][_0x2136('0x34')]);_0x289ca3['message'][_0x2136('0x6e')]=_0x5ad326[_0x2136('0x6e')];_0x289ca3['message'][_0x2136('0x6f')]='reject';respondWithRpcPromise('EventManager',_0x2136('0x71'),{'event':'rejectmessage','message':_0x289ca3['message']},client9002);return _0x5ad326;}return null;})[_0x2136('0x33')](respondWithResult(_0x507e26,null))['catch'](handleError(_0x507e26,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index edbaaa6..8fad4db 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 _0xf64a=['remove','emit','hasOwnProperty','hook','exports','ChatMessage','setMaxListeners','save'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0xf64a,0x17d));var _0xaf64=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xf64a[_0x2ca9d4];return _0x258956;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0xaf64('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xaf64('0x1')](0x0);var events={'afterCreate':_0xaf64('0x2'),'afterUpdate':'update','afterDestroy':_0xaf64('0x3')};function emitEvent(_0x1d1f7b){return function(_0x455728,_0x1fd6a6,_0x4cb18c){ChatMessageEvents['emit'](_0x1d1f7b+':'+_0x455728['id'],_0x455728);ChatMessageEvents[_0xaf64('0x4')](_0x1d1f7b,_0x455728);_0x4cb18c(null);};}for(var e in events){if(events[_0xaf64('0x5')](e)){var event=events[e];ChatMessage[_0xaf64('0x6')](e,emitEvent(event));}}module[_0xaf64('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0xd416=['setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0xd416,0x19c));var _0x6d41=function(_0x118d84,_0x4f4071){_0x118d84=_0x118d84-0x0;var _0x3a9bf2=_0xd416[_0x118d84];return _0x3a9bf2;};'use strict';var EventEmitter=require(_0x6d41('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6d41('0x1')](0x0);var events={'afterCreate':_0x6d41('0x2'),'afterUpdate':_0x6d41('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2eb193){return function(_0x14b01e,_0x1f7c37,_0x1eaebe){ChatMessageEvents[_0x6d41('0x4')](_0x2eb193+':'+_0x14b01e['id'],_0x14b01e);ChatMessageEvents['emit'](_0x2eb193,_0x14b01e);_0x1eaebe(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x6d41('0x5')](e,emitEvent(event));}}module[_0x6d41('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index d4d4f7d..a40af25 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 _0x718e=['createdAt','direction','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','toLowerCase','out','secret','isNil','findOne','then','update'];(function(_0x4a1a4a,_0x13cfaa){var _0x137f0f=function(_0x3dc3e1){while(--_0x3dc3e1){_0x4a1a4a['push'](_0x4a1a4a['shift']());}};_0x137f0f(++_0x13cfaa);}(_0x718e,0x17f));var _0xe718=function(_0x397dd0,_0x58a7a8){_0x397dd0=_0x397dd0-0x0;var _0x4188b2=_0x718e[_0x397dd0];return _0x4188b2;};'use strict';var _=require('lodash');var util=require(_0xe718('0x0'));var logger=require(_0xe718('0x1'))(_0xe718('0x2'));var moment=require(_0xe718('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe718('0x4'));var config=require(_0xe718('0x5'));var attributes=require(_0xe718('0x6'));module[_0xe718('0x7')]=function(_0x5bbef3,_0x33ef54){return _0x5bbef3['define'](_0xe718('0x8'),attributes,{'tableName':_0xe718('0x9'),'paranoid':![],'indexes':[{'name':_0xe718('0xa'),'fields':[_0xe718('0xb')],'type':_0xe718('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x20aee2,_0x1ca1ed,_0x2fce6b){var _0x3d1af0=_0x5bbef3[_0xe718('0xd')];var _0x127fde=_0x20aee2[_0xe718('0xe')]({'plain':!![]});if(_0x127fde['direction']['toLowerCase']()==='in'||_0x127fde['direction'][_0xe718('0xf')]()===_0xe718('0x10')&&!_0x127fde[_0xe718('0x11')]&&!_[_0xe718('0x12')](_0x127fde['UserId'])){_0x3d1af0['ChatInteraction'][_0xe718('0x13')]({'where':{'id':_0x127fde['ChatInteractionId']}})[_0xe718('0x14')](function(_0x56fedf){if(_0x56fedf){_0x56fedf[_0xe718('0x15')]({'lastMsgAt':_0x127fde[_0xe718('0x16')],'lastMsgDirection':_0x127fde[_0xe718('0x17')][_0xe718('0xf')]()});}})['catch'](function(_0x4d2a04){console[_0xe718('0x18')](_0x4d2a04);});}_0x2fce6b();}},'charset':_0xe718('0x19'),'collate':_0xe718('0x1a')});}; \ No newline at end of file +var _0x8032=['define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatMessage.attributes','exports'];(function(_0x246f92,_0xcf7bd4){var _0x2b8e7d=function(_0x9e8650){while(--_0x9e8650){_0x246f92['push'](_0x246f92['shift']());}};_0x2b8e7d(++_0xcf7bd4);}(_0x8032,0x1d7));var _0x2803=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x8032[_0x5ce3c8];return _0xa76867;};'use strict';var _=require('lodash');var util=require(_0x2803('0x0'));var logger=require(_0x2803('0x1'))(_0x2803('0x2'));var moment=require(_0x2803('0x3'));var BPromise=require(_0x2803('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2803('0x5'));var rimraf=require('rimraf');var config=require(_0x2803('0x6'));var attributes=require(_0x2803('0x7'));module[_0x2803('0x8')]=function(_0x1885d9,_0x357bef){return _0x1885d9[_0x2803('0x9')](_0x2803('0xa'),attributes,{'tableName':_0x2803('0xb'),'paranoid':![],'indexes':[{'name':_0x2803('0xc'),'fields':[_0x2803('0xd')],'type':_0x2803('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa6248a,_0x265c57,_0x45b904){var _0x2153f8=_0x1885d9[_0x2803('0xf')];var _0x3e8a46=_0xa6248a[_0x2803('0x10')]({'plain':!![]});if(_0x3e8a46[_0x2803('0x11')]['toLowerCase']()==='in'||_0x3e8a46[_0x2803('0x11')][_0x2803('0x12')]()===_0x2803('0x13')&&!_0x3e8a46[_0x2803('0x14')]&&!_[_0x2803('0x15')](_0x3e8a46[_0x2803('0x16')])){_0x2153f8[_0x2803('0x17')][_0x2803('0x18')]({'where':{'id':_0x3e8a46[_0x2803('0x19')]}})['then'](function(_0x259c9c){if(_0x259c9c){_0x259c9c[_0x2803('0x1a')]({'lastMsgAt':_0x3e8a46[_0x2803('0x1b')],'lastMsgDirection':_0x3e8a46[_0x2803('0x11')][_0x2803('0x12')]()});}})[_0x2803('0x1c')](function(_0x100b28){console['error'](_0x100b28);});}_0x45b904();}},'charset':'utf8mb4','collate':_0x2803('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 1dbfc83..3a71360 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 _0x78fa=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateChatMessage','options','raw','debug','stringify','lodash','util'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0x78fa,0x8f));var _0xa78f=function(_0x3acf41,_0x5285dd){_0x3acf41=_0x3acf41-0x0;var _0x5b51e7=_0x78fa[_0x3acf41];return _0x5b51e7;};'use strict';var _=require(_0xa78f('0x0'));var util=require(_0xa78f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa78f('0x2'));var db=require(_0xa78f('0x3'))['db'];var utils=require(_0xa78f('0x4'));var logger=require(_0xa78f('0x5'))(_0xa78f('0x6'));var config=require(_0xa78f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa78f('0x8')]({'port':0x232a});config[_0xa78f('0x9')]=_[_0xa78f('0xa')](config[_0xa78f('0x9')],{'host':_0xa78f('0xb'),'port':0x18eb});var socket=require(_0xa78f('0xc'))(new Redis(config['redis']));require('./chatMessage.socket')[_0xa78f('0xd')](socket);function respondWithRpcPromise(_0x46275a,_0xd3ee67,_0x2dc151){return new BPromise(function(_0x293c08,_0x31d80a){return client[_0xa78f('0xe')](_0x46275a,_0x2dc151)[_0xa78f('0xf')](function(_0x2d0b61){logger[_0xa78f('0x10')](_0xa78f('0x11'),_0xd3ee67,_0xa78f('0x12'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0xd3ee67,'request\x20sent',JSON['stringify'](_0x2d0b61));if(_0x2d0b61['error']){if(_0x2d0b61[_0xa78f('0x13')][_0xa78f('0x14')]===0x1f4){logger[_0xa78f('0x13')]('ChatMessage,\x20%s,\x20%s',_0xd3ee67,_0x2d0b61['error'][_0xa78f('0x15')]);return _0x31d80a(_0x2d0b61[_0xa78f('0x13')][_0xa78f('0x15')]);}logger['error'](_0xa78f('0x11'),_0xd3ee67,_0x2d0b61[_0xa78f('0x13')][_0xa78f('0x15')]);return _0x293c08(_0x2d0b61[_0xa78f('0x13')][_0xa78f('0x15')]);}else{logger[_0xa78f('0x10')]('ChatMessage,\x20%s,\x20%s',_0xd3ee67,_0xa78f('0x12'));_0x293c08(_0x2d0b61[_0xa78f('0x16')][_0xa78f('0x15')]);}})[_0xa78f('0x17')](function(_0x3ce5fb){logger[_0xa78f('0x13')](_0xa78f('0x11'),_0xd3ee67,_0x3ce5fb);_0x31d80a(_0x3ce5fb);});});}exports[_0xa78f('0x18')]=function(_0x3e5cb3){var _0x329448=this;return new Promise(function(_0xea9a99,_0x4ab341){return db['ChatMessage']['create'](_0x3e5cb3['body'],{'raw':_0x3e5cb3[_0xa78f('0x19')]?_0x3e5cb3[_0xa78f('0x19')][_0xa78f('0x1a')]===undefined?!![]:![]:!![]})[_0xa78f('0xf')](function(_0x4686aa){logger[_0xa78f('0x10')](_0xa78f('0x18'),_0x3e5cb3);logger[_0xa78f('0x1b')](_0xa78f('0x18'),_0x3e5cb3,JSON[_0xa78f('0x1c')](_0x4686aa));_0xea9a99(_0x4686aa);})[_0xa78f('0x17')](function(_0x136d54){logger['error'](_0xa78f('0x18'),_0x136d54[_0xa78f('0x15')],_0x3e5cb3);_0x4ab341(_0x329448[_0xa78f('0x13')](0x1f4,_0x136d54[_0xa78f('0x15')]));});});}; \ No newline at end of file +var _0x3d12=['error','code','message','result','catch','CreateChatMessage','create','body','options','raw','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x24472f,_0x469831){var _0x1f7ad1=function(_0x3e4607){while(--_0x3e4607){_0x24472f['push'](_0x24472f['shift']());}};_0x1f7ad1(++_0x469831);}(_0x3d12,0xf2));var _0x23d1=function(_0x4a2f94,_0x2dba60){_0x4a2f94=_0x4a2f94-0x0;var _0x297269=_0x3d12[_0x4a2f94];return _0x297269;};'use strict';var _=require(_0x23d1('0x0'));var util=require(_0x23d1('0x1'));var moment=require(_0x23d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x23d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23d1('0x4'))['db'];var utils=require(_0x23d1('0x5'));var logger=require(_0x23d1('0x6'))(_0x23d1('0x7'));var config=require(_0x23d1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x23d1('0x9')][_0x23d1('0xa')]({'port':0x232a});config[_0x23d1('0xb')]=_[_0x23d1('0xc')](config[_0x23d1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x23d1('0xd'))(new Redis(config[_0x23d1('0xb')]));require(_0x23d1('0xe'))['register'](socket);function respondWithRpcPromise(_0x58fc59,_0x36c496,_0x307546){return new BPromise(function(_0x3b2b93,_0x1a1752){return client[_0x23d1('0xf')](_0x58fc59,_0x307546)[_0x23d1('0x10')](function(_0x35f365){logger[_0x23d1('0x11')](_0x23d1('0x12'),_0x36c496,_0x23d1('0x13'));logger[_0x23d1('0x14')](_0x23d1('0x15'),_0x36c496,'request\x20sent',JSON['stringify'](_0x35f365));if(_0x35f365[_0x23d1('0x16')]){if(_0x35f365[_0x23d1('0x16')][_0x23d1('0x17')]===0x1f4){logger[_0x23d1('0x16')](_0x23d1('0x12'),_0x36c496,_0x35f365[_0x23d1('0x16')]['message']);return _0x1a1752(_0x35f365[_0x23d1('0x16')][_0x23d1('0x18')]);}logger[_0x23d1('0x16')](_0x23d1('0x12'),_0x36c496,_0x35f365['error']['message']);return _0x3b2b93(_0x35f365[_0x23d1('0x16')]['message']);}else{logger['info'](_0x23d1('0x12'),_0x36c496,_0x23d1('0x13'));_0x3b2b93(_0x35f365[_0x23d1('0x19')][_0x23d1('0x18')]);}})[_0x23d1('0x1a')](function(_0x1ad5d1){logger[_0x23d1('0x16')](_0x23d1('0x12'),_0x36c496,_0x1ad5d1);_0x1a1752(_0x1ad5d1);});});}exports[_0x23d1('0x1b')]=function(_0x30f232){var _0x416220=this;return new Promise(function(_0x37d5a4,_0x1a3e04){return db['ChatMessage'][_0x23d1('0x1c')](_0x30f232[_0x23d1('0x1d')],{'raw':_0x30f232[_0x23d1('0x1e')]?_0x30f232[_0x23d1('0x1e')][_0x23d1('0x1f')]===undefined?!![]:![]:!![]})[_0x23d1('0x10')](function(_0x244538){logger[_0x23d1('0x11')]('CreateChatMessage',_0x30f232);logger[_0x23d1('0x14')](_0x23d1('0x1b'),_0x30f232,JSON[_0x23d1('0x20')](_0x244538));_0x37d5a4(_0x244538);})[_0x23d1('0x1a')](function(_0x5644ef){logger[_0x23d1('0x16')](_0x23d1('0x1b'),_0x5644ef['message'],_0x30f232);_0x1a3e04(_0x416220[_0x23d1('0x16')](0x1f4,_0x5644ef[_0x23d1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 0a499d3..5c91b8e 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 _0xc2c7=['register','chatMessage:','save','remove','update','emit'];(function(_0x4e0e02,_0xb7355d){var _0x146f93=function(_0x1d2bbf){while(--_0x1d2bbf){_0x4e0e02['push'](_0x4e0e02['shift']());}};_0x146f93(++_0xb7355d);}(_0xc2c7,0x134));var _0x7c2c=function(_0x4ac6c3,_0x36e5ea){_0x4ac6c3=_0x4ac6c3-0x0;var _0x3f3436=_0xc2c7[_0x4ac6c3];return _0x3f3436;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x7c2c('0x0'),_0x7c2c('0x1'),_0x7c2c('0x2')];function createListener(_0x330870,_0x380d13){return function(_0x237e4d){_0x380d13[_0x7c2c('0x3')](_0x330870,_0x237e4d);};}function removeListener(_0x116f8a,_0x4bbc14){return function(){ChatMessageEvents['removeListener'](_0x116f8a,_0x4bbc14);};}exports[_0x7c2c('0x4')]=function(_0x42ecc9){for(var _0x23c038=0x0,_0x54f027=events['length'];_0x23c038<_0x54f027;_0x23c038++){var _0x5a1027=events[_0x23c038];var _0x2274cd=createListener(_0x7c2c('0x5')+_0x5a1027,_0x42ecc9);ChatMessageEvents['on'](_0x5a1027,_0x2274cd);}}; \ No newline at end of file +var _0xb016=['register','./chatMessage.events','save','emit'];(function(_0x4b6420,_0x126201){var _0x37076f=function(_0x3ee471){while(--_0x3ee471){_0x4b6420['push'](_0x4b6420['shift']());}};_0x37076f(++_0x126201);}(_0xb016,0x159));var _0x6b01=function(_0x507560,_0x4b348f){_0x507560=_0x507560-0x0;var _0x3137db=_0xb016[_0x507560];return _0x3137db;};'use strict';var ChatMessageEvents=require(_0x6b01('0x0'));var events=[_0x6b01('0x1'),'remove','update'];function createListener(_0xf74fa1,_0x531b6a){return function(_0x160a7d){_0x531b6a[_0x6b01('0x2')](_0xf74fa1,_0x160a7d);};}function removeListener(_0x161b59,_0x3b9de1){return function(){ChatMessageEvents['removeListener'](_0x161b59,_0x3b9de1);};}exports[_0x6b01('0x3')]=function(_0x65407a){for(var _0x192b2d=0x0,_0x5759a1=events['length'];_0x192b2d<_0x5759a1;_0x192b2d++){var _0x374aab=events[_0x192b2d];var _0x39f9fa=createListener('chatMessage:'+_0x374aab,_0x65407a);ChatMessageEvents['on'](_0x374aab,_0x39f9fa);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index e55fcad..37faeac 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 _0xaeb4=['Router','../../components/auth/service','../../config/environment','./chatMessage.controller','isAuthenticated','/describe','get','/:id','show','tracked','chat','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','path','express'];(function(_0x50b3fd,_0x4c007d){var _0x33265f=function(_0x4e5bbe){while(--_0x4e5bbe){_0x50b3fd['push'](_0x50b3fd['shift']());}};_0x33265f(++_0x4c007d);}(_0xaeb4,0x14e));var _0x4aeb=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xaeb4[_0x5cb1af];return _0x8d7940;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4aeb('0x0'));var timeout=require('connect-timeout');var express=require(_0x4aeb('0x1'));var router=express[_0x4aeb('0x2')]();var auth=require(_0x4aeb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4aeb('0x4'));var controller=require(_0x4aeb('0x5'));router['get']('/',auth[_0x4aeb('0x6')](),controller['index']);router['get'](_0x4aeb('0x7'),auth[_0x4aeb('0x6')](),controller['describe']);router[_0x4aeb('0x8')](_0x4aeb('0x9'),auth[_0x4aeb('0x6')](),controller[_0x4aeb('0xa')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x4aeb('0xb')](_0x4aeb('0xc'),'chatmessage:create'),controller[_0x4aeb('0xd')]);router[_0x4aeb('0xe')](_0x4aeb('0x9'),controller[_0x4aeb('0xf')]);router['put'](_0x4aeb('0x10'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x4aeb('0x11'),auth[_0x4aeb('0x6')](),controller[_0x4aeb('0x12')]);router[_0x4aeb('0x13')](_0x4aeb('0x9'),auth['isAuthenticated'](),controller[_0x4aeb('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7e29=['show','post','tracked','chat','put','update','/:id/accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id'];(function(_0x59ecf9,_0x9a29d){var _0x3c68c1=function(_0x4992c5){while(--_0x4992c5){_0x59ecf9['push'](_0x59ecf9['shift']());}};_0x3c68c1(++_0x9a29d);}(_0x7e29,0x9b));var _0x97e2=function(_0x5132c1,_0xa981d){_0x5132c1=_0x5132c1-0x0;var _0x106638=_0x7e29[_0x5132c1];return _0x106638;};'use strict';var multer=require(_0x97e2('0x0'));var util=require(_0x97e2('0x1'));var path=require('path');var timeout=require(_0x97e2('0x2'));var express=require(_0x97e2('0x3'));var router=express[_0x97e2('0x4')]();var auth=require(_0x97e2('0x5'));var interaction=require(_0x97e2('0x6'));var config=require(_0x97e2('0x7'));var controller=require('./chatMessage.controller');router[_0x97e2('0x8')]('/',auth['isAuthenticated'](),controller[_0x97e2('0x9')]);router['get']('/describe',auth[_0x97e2('0xa')](),controller[_0x97e2('0xb')]);router['get'](_0x97e2('0xc'),auth[_0x97e2('0xa')](),controller[_0x97e2('0xd')]);router[_0x97e2('0xe')]('/',auth[_0x97e2('0xa')](),interaction[_0x97e2('0xf')](_0x97e2('0x10'),'chatmessage:create'),controller['create']);router[_0x97e2('0x11')]('/:id',controller[_0x97e2('0x12')]);router[_0x97e2('0x11')](_0x97e2('0x13'),auth['isAuthenticated'](),controller['accept']);router[_0x97e2('0x11')](_0x97e2('0x14'),auth['isAuthenticated'](),controller[_0x97e2('0x15')]);router[_0x97e2('0x16')](_0x97e2('0xc'),auth['isAuthenticated'](),controller[_0x97e2('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 345f190..8ba2fa8 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 _0xea18=['TEXT','medium','sequelize','exports'];(function(_0x731658,_0x26f155){var _0x29adfd=function(_0x2baf72){while(--_0x2baf72){_0x731658['push'](_0x731658['shift']());}};_0x29adfd(++_0x26f155);}(_0xea18,0x102));var _0x8ea1=function(_0x32cf93,_0x170441){_0x32cf93=_0x32cf93-0x0;var _0x3d6405=_0xea18[_0x32cf93];return _0x3d6405;};'use strict';var Sequelize=require(_0x8ea1('0x0'));module[_0x8ea1('0x1')]={'body':{'type':Sequelize[_0x8ea1('0x2')](_0x8ea1('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x19f2=['exports','TEXT','medium'];(function(_0x41c50f,_0x1b94fa){var _0x25523c=function(_0x52c06a){while(--_0x52c06a){_0x41c50f['push'](_0x41c50f['shift']());}};_0x25523c(++_0x1b94fa);}(_0x19f2,0x1ad));var _0x219f=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0x19f2[_0x26a906];return _0x495575;};'use strict';var Sequelize=require('sequelize');module[_0x219f('0x0')]={'body':{'type':Sequelize[_0x219f('0x1')](_0x219f('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 80163cb..2dea8af 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 _0x82c4=['findAll','rows','catch','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','ChatOfflineMessage','includeAll','include'];(function(_0x13980b,_0x1fbb72){var _0x13220b=function(_0x11aa5f){while(--_0x11aa5f){_0x13980b['push'](_0x13980b['shift']());}};_0x13220b(++_0x1fbb72);}(_0x82c4,0x1ca));var _0x482c=function(_0x3fd723,_0x1f48b4){_0x3fd723=_0x3fd723-0x0;var _0x131dc2=_0x82c4[_0x3fd723];return _0x131dc2;};'use strict';var pdf=require(_0x482c('0x0'));var emlformat=require(_0x482c('0x1'));var rimraf=require(_0x482c('0x2'));var zipdir=require(_0x482c('0x3'));var jsonpatch=require(_0x482c('0x4'));var rp=require(_0x482c('0x5'));var moment=require(_0x482c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x482c('0x7'));var util=require('util');var path=require(_0x482c('0x8'));var sox=require('sox');var csv=require(_0x482c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x482c('0xa'));var squel=require(_0x482c('0xb'));var crypto=require(_0x482c('0xc'));var jsforce=require(_0x482c('0xd'));var deskjs=require(_0x482c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x482c('0xf'));var Papa=require(_0x482c('0x10'));var Redis=require(_0x482c('0x11'));var authService=require(_0x482c('0x12'));var qs=require(_0x482c('0x13'));var as=require(_0x482c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x482c('0x15'))(_0x482c('0x16'));var utils=require(_0x482c('0x17'));var config=require('../../config/environment');var db=require(_0x482c('0x18'))['db'];function respondWithStatusCode(_0xbbda9b,_0x3fabb3){_0x3fabb3=_0x3fabb3||0xcc;return function(_0x56aafd){if(_0x56aafd){return _0xbbda9b['sendStatus'](_0x3fabb3);}return _0xbbda9b[_0x482c('0x19')](_0x3fabb3)[_0x482c('0x1a')]();};}function respondWithResult(_0x59837f,_0x56ee17){_0x56ee17=_0x56ee17||0xc8;return function(_0x14452b){if(_0x14452b){return _0x59837f[_0x482c('0x19')](_0x56ee17)[_0x482c('0x1b')](_0x14452b);}};}function respondWithFilteredResult(_0x3dfbc8,_0x37a4f0){return function(_0x119635){if(_0x119635){var _0x3beedb=_0x119635[_0x482c('0x1c')],_0xf65563=_0x37a4f0[_0x482c('0x1d')],_0x3fc79c=_0x37a4f0['offset']+_0x37a4f0[_0x482c('0x1e')],_0x1758fb;if(_0x3fc79c>=_0x3beedb){_0x3fc79c=_0x3beedb;_0x1758fb=0xc8;}else{_0x1758fb=0xce;}_0x3dfbc8['status'](_0x1758fb);return _0x3dfbc8[_0x482c('0x1f')](_0x482c('0x20'),_0xf65563+'-'+_0x3fc79c+'/'+_0x3beedb)['json'](_0x119635);}return null;};}function patchUpdates(_0x4bd270){return function(_0x357965){try{jsonpatch['apply'](_0x357965,_0x4bd270,!![]);}catch(_0x16fe9a){return BPromise[_0x482c('0x21')](_0x16fe9a);}return _0x357965[_0x482c('0x22')]();};}function saveUpdates(_0x3f97ae,_0x5c927b){return function(_0x1c9a7b){if(_0x1c9a7b){return _0x1c9a7b[_0x482c('0x23')](_0x3f97ae)[_0x482c('0x24')](function(_0xd18658){return _0xd18658;});}return null;};}function removeEntity(_0x14d832,_0x58ed18){return function(_0x4afcd9){if(_0x4afcd9){return _0x4afcd9[_0x482c('0x25')]()[_0x482c('0x24')](function(){_0x14d832[_0x482c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d5490,_0x579d2f){return function(_0x2f3f96){if(!_0x2f3f96){_0x3d5490[_0x482c('0x26')](0x194);}return _0x2f3f96;};}function handleError(_0x4f1108,_0x466583){_0x466583=_0x466583||0x1f4;return function(_0x5436e2){logger['error'](_0x5436e2[_0x482c('0x27')]);if(_0x5436e2[_0x482c('0x28')]){delete _0x5436e2[_0x482c('0x28')];}_0x4f1108[_0x482c('0x19')](_0x466583)[_0x482c('0x29')](_0x5436e2);};}exports[_0x482c('0x2a')]=function(_0x2981d2,_0x5ad788){var _0xb65836={},_0x255417={},_0x58da7c={'count':0x0,'rows':[]};var _0xb01bc3=_['map'](db['ChatOfflineMessage'][_0x482c('0x2b')],function(_0x5af04c){return{'name':_0x5af04c[_0x482c('0x2c')],'type':_0x5af04c[_0x482c('0x2d')][_0x482c('0x2e')]};});_0x255417[_0x482c('0x2f')]=_[_0x482c('0x30')](_0xb01bc3,_0x482c('0x28'));_0x255417[_0x482c('0x31')]=_[_0x482c('0x32')](_0x2981d2[_0x482c('0x31')]);_0x255417[_0x482c('0x33')]=_[_0x482c('0x34')](_0x255417[_0x482c('0x2f')],_0x255417[_0x482c('0x31')]);_0xb65836[_0x482c('0x35')]=_[_0x482c('0x34')](_0x255417[_0x482c('0x2f')],qs[_0x482c('0x36')](_0x2981d2[_0x482c('0x31')]['fields']));_0xb65836['attributes']=_0xb65836['attributes'][_0x482c('0x37')]?_0xb65836[_0x482c('0x35')]:_0x255417[_0x482c('0x2f')];if(!_0x2981d2[_0x482c('0x31')]['hasOwnProperty'](_0x482c('0x38'))){_0xb65836['limit']=qs[_0x482c('0x1e')](_0x2981d2[_0x482c('0x31')][_0x482c('0x1e')]);_0xb65836[_0x482c('0x1d')]=qs[_0x482c('0x1d')](_0x2981d2[_0x482c('0x31')][_0x482c('0x1d')]);}_0xb65836[_0x482c('0x39')]=qs['sort'](_0x2981d2['query'][_0x482c('0x3a')]);_0xb65836['where']=qs[_0x482c('0x33')](_[_0x482c('0x3b')](_0x2981d2[_0x482c('0x31')],_0x255417['filters']),_0xb01bc3);if(_0x2981d2[_0x482c('0x31')][_0x482c('0x3c')]){_0xb65836[_0x482c('0x3d')]=_[_0x482c('0x3e')](_0xb65836['where'],{'$or':_[_0x482c('0x30')](_0xb01bc3,function(_0x52a610){if(_0x52a610[_0x482c('0x2d')]!=='VIRTUAL'){var _0x234bd2={};_0x234bd2[_0x52a610['name']]={'$like':'%'+_0x2981d2[_0x482c('0x31')][_0x482c('0x3c')]+'%'};return _0x234bd2;}})});}_0xb65836=_['merge']({},_0xb65836,_0x2981d2[_0x482c('0x3f')]);var _0x536816={'where':_0xb65836['where']};return db[_0x482c('0x40')]['count'](_0x536816)['then'](function(_0x5a07a3){_0x58da7c['count']=_0x5a07a3;if(_0x2981d2[_0x482c('0x31')][_0x482c('0x41')]){_0xb65836[_0x482c('0x42')]=[{'all':!![]}];}return db[_0x482c('0x40')][_0x482c('0x43')](_0xb65836);})['then'](function(_0x24f3b5){_0x58da7c[_0x482c('0x44')]=_0x24f3b5;return _0x58da7c;})[_0x482c('0x24')](respondWithFilteredResult(_0x5ad788,_0xb65836))[_0x482c('0x45')](handleError(_0x5ad788,null));};exports['show']=function(_0x490641,_0xa41da0){var _0x44bedf={'raw':!![],'where':{'id':_0x490641[_0x482c('0x46')]['id']}},_0x4e4d91={};_0x4e4d91[_0x482c('0x2f')]=_[_0x482c('0x32')](db[_0x482c('0x40')][_0x482c('0x2b')]);_0x4e4d91[_0x482c('0x31')]=_[_0x482c('0x32')](_0x490641[_0x482c('0x31')]);_0x4e4d91['filters']=_[_0x482c('0x34')](_0x4e4d91[_0x482c('0x2f')],_0x4e4d91[_0x482c('0x31')]);_0x44bedf[_0x482c('0x35')]=_[_0x482c('0x34')](_0x4e4d91[_0x482c('0x2f')],qs[_0x482c('0x36')](_0x490641['query']['fields']));_0x44bedf[_0x482c('0x35')]=_0x44bedf[_0x482c('0x35')][_0x482c('0x37')]?_0x44bedf['attributes']:_0x4e4d91[_0x482c('0x2f')];if(_0x490641['query'][_0x482c('0x41')]){_0x44bedf[_0x482c('0x42')]=[{'all':!![]}];}_0x44bedf=_[_0x482c('0x3e')]({},_0x44bedf,_0x490641[_0x482c('0x3f')]);return db['ChatOfflineMessage'][_0x482c('0x47')](_0x44bedf)[_0x482c('0x24')](handleEntityNotFound(_0xa41da0,null))[_0x482c('0x24')](respondWithResult(_0xa41da0,null))['catch'](handleError(_0xa41da0,null));};exports[_0x482c('0x48')]=function(_0x41d96f,_0xcf89c4){return db['ChatOfflineMessage']['create'](_0x41d96f['body'],{})['then'](respondWithResult(_0xcf89c4,0xc9))['catch'](handleError(_0xcf89c4,null));};exports['update']=function(_0x3096c4,_0x5bd0c5){if(_0x3096c4[_0x482c('0x49')]['id']){delete _0x3096c4[_0x482c('0x49')]['id'];}return db[_0x482c('0x40')][_0x482c('0x47')]({'where':{'id':_0x3096c4[_0x482c('0x46')]['id']}})[_0x482c('0x24')](handleEntityNotFound(_0x5bd0c5,null))[_0x482c('0x24')](saveUpdates(_0x3096c4[_0x482c('0x49')],null))[_0x482c('0x24')](respondWithResult(_0x5bd0c5,null))[_0x482c('0x45')](handleError(_0x5bd0c5,null));};exports[_0x482c('0x25')]=function(_0x3f7ff7,_0x1126b7){return db[_0x482c('0x40')][_0x482c('0x47')]({'where':{'id':_0x3f7ff7[_0x482c('0x46')]['id']}})[_0x482c('0x24')](handleEntityNotFound(_0x1126b7,null))[_0x482c('0x24')](removeEntity(_0x1126b7,null))[_0x482c('0x45')](handleError(_0x1126b7,null));};exports['describe']=function(_0x107b1b,_0x3b8b04){return db['ChatOfflineMessage'][_0x482c('0x4a')]()[_0x482c('0x24')](respondWithResult(_0x3b8b04,null))[_0x482c('0x45')](handleError(_0x3b8b04,null));}; \ No newline at end of file +var _0xf494=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','count','offset','limit','apply','reject','update','then','stack','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0xf494,0x1c6));var _0x4f49=function(_0x5b0d30,_0x4e0eb9){_0x5b0d30=_0x5b0d30-0x0;var _0x471048=_0xf494[_0x5b0d30];return _0x471048;};'use strict';var pdf=require(_0x4f49('0x0'));var emlformat=require(_0x4f49('0x1'));var rimraf=require(_0x4f49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f49('0x3'));var rp=require(_0x4f49('0x4'));var moment=require(_0x4f49('0x5'));var BPromise=require(_0x4f49('0x6'));var Mustache=require(_0x4f49('0x7'));var util=require(_0x4f49('0x8'));var path=require(_0x4f49('0x9'));var sox=require(_0x4f49('0xa'));var csv=require(_0x4f49('0xb'));var ejs=require(_0x4f49('0xc'));var fs=require('fs');var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xb'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b9cd3,_0x12527d){_0x12527d=_0x12527d||0xcc;return function(_0x4bf89f){if(_0x4bf89f){return _0x4b9cd3[_0x4f49('0x18')](_0x12527d);}return _0x4b9cd3[_0x4f49('0x19')](_0x12527d)[_0x4f49('0x1a')]();};}function respondWithResult(_0x2efe49,_0x1a0f1e){_0x1a0f1e=_0x1a0f1e||0xc8;return function(_0x2f0131){if(_0x2f0131){return _0x2efe49[_0x4f49('0x19')](_0x1a0f1e)['json'](_0x2f0131);}};}function respondWithFilteredResult(_0x515ace,_0x1f2d0d){return function(_0x415e83){if(_0x415e83){var _0x5878f4=_0x415e83[_0x4f49('0x1b')],_0x5bdfaf=_0x1f2d0d['offset'],_0x2f0a0d=_0x1f2d0d[_0x4f49('0x1c')]+_0x1f2d0d[_0x4f49('0x1d')],_0x2ecaaa;if(_0x2f0a0d>=_0x5878f4){_0x2f0a0d=_0x5878f4;_0x2ecaaa=0xc8;}else{_0x2ecaaa=0xce;}_0x515ace[_0x4f49('0x19')](_0x2ecaaa);return _0x515ace['set']('Content-Range',_0x5bdfaf+'-'+_0x2f0a0d+'/'+_0x5878f4)['json'](_0x415e83);}return null;};}function patchUpdates(_0x47f1e8){return function(_0xb2081a){try{jsonpatch[_0x4f49('0x1e')](_0xb2081a,_0x47f1e8,!![]);}catch(_0x1c2d70){return BPromise[_0x4f49('0x1f')](_0x1c2d70);}return _0xb2081a['save']();};}function saveUpdates(_0x416893,_0x2aed27){return function(_0x197a49){if(_0x197a49){return _0x197a49[_0x4f49('0x20')](_0x416893)[_0x4f49('0x21')](function(_0x509f7c){return _0x509f7c;});}return null;};}function removeEntity(_0x3e7e28,_0x357446){return function(_0x3ae590){if(_0x3ae590){return _0x3ae590['destroy']()[_0x4f49('0x21')](function(){_0x3e7e28[_0x4f49('0x19')](0xcc)[_0x4f49('0x1a')]();});}};}function handleEntityNotFound(_0x43c458,_0x9d30aa){return function(_0x36187b){if(!_0x36187b){_0x43c458['sendStatus'](0x194);}return _0x36187b;};}function handleError(_0x4e9041,_0x3a947b){_0x3a947b=_0x3a947b||0x1f4;return function(_0x429de7){logger['error'](_0x429de7[_0x4f49('0x22')]);if(_0x429de7[_0x4f49('0x23')]){delete _0x429de7[_0x4f49('0x23')];}_0x4e9041['status'](_0x3a947b)[_0x4f49('0x24')](_0x429de7);};}exports[_0x4f49('0x25')]=function(_0x298785,_0x148153){var _0xfefbab={},_0x122404={},_0x4915af={'count':0x0,'rows':[]};var _0x50c571=_[_0x4f49('0x26')](db[_0x4f49('0x27')][_0x4f49('0x28')],function(_0x560050){return{'name':_0x560050[_0x4f49('0x29')],'type':_0x560050[_0x4f49('0x2a')][_0x4f49('0x2b')]};});_0x122404['model']=_['map'](_0x50c571,_0x4f49('0x23'));_0x122404[_0x4f49('0x2c')]=_[_0x4f49('0x2d')](_0x298785['query']);_0x122404[_0x4f49('0x2e')]=_[_0x4f49('0x2f')](_0x122404[_0x4f49('0x30')],_0x122404[_0x4f49('0x2c')]);_0xfefbab[_0x4f49('0x31')]=_[_0x4f49('0x2f')](_0x122404[_0x4f49('0x30')],qs[_0x4f49('0x32')](_0x298785[_0x4f49('0x2c')][_0x4f49('0x32')]));_0xfefbab[_0x4f49('0x31')]=_0xfefbab[_0x4f49('0x31')][_0x4f49('0x33')]?_0xfefbab[_0x4f49('0x31')]:_0x122404[_0x4f49('0x30')];if(!_0x298785[_0x4f49('0x2c')][_0x4f49('0x34')](_0x4f49('0x35'))){_0xfefbab[_0x4f49('0x1d')]=qs['limit'](_0x298785[_0x4f49('0x2c')][_0x4f49('0x1d')]);_0xfefbab[_0x4f49('0x1c')]=qs[_0x4f49('0x1c')](_0x298785[_0x4f49('0x2c')][_0x4f49('0x1c')]);}_0xfefbab[_0x4f49('0x36')]=qs[_0x4f49('0x37')](_0x298785[_0x4f49('0x2c')][_0x4f49('0x37')]);_0xfefbab[_0x4f49('0x38')]=qs[_0x4f49('0x2e')](_[_0x4f49('0x39')](_0x298785['query'],_0x122404[_0x4f49('0x2e')]),_0x50c571);if(_0x298785[_0x4f49('0x2c')][_0x4f49('0x3a')]){_0xfefbab[_0x4f49('0x38')]=_[_0x4f49('0x3b')](_0xfefbab[_0x4f49('0x38')],{'$or':_[_0x4f49('0x26')](_0x50c571,function(_0x25fdf8){if(_0x25fdf8[_0x4f49('0x2a')]!==_0x4f49('0x3c')){var _0x173b6e={};_0x173b6e[_0x25fdf8[_0x4f49('0x23')]]={'$like':'%'+_0x298785[_0x4f49('0x2c')][_0x4f49('0x3a')]+'%'};return _0x173b6e;}})});}_0xfefbab=_['merge']({},_0xfefbab,_0x298785[_0x4f49('0x3d')]);var _0xb0e6c2={'where':_0xfefbab['where']};return db[_0x4f49('0x27')][_0x4f49('0x1b')](_0xb0e6c2)['then'](function(_0x29e762){_0x4915af[_0x4f49('0x1b')]=_0x29e762;if(_0x298785[_0x4f49('0x2c')][_0x4f49('0x3e')]){_0xfefbab[_0x4f49('0x3f')]=[{'all':!![]}];}return db[_0x4f49('0x27')][_0x4f49('0x40')](_0xfefbab);})['then'](function(_0x5e1461){_0x4915af['rows']=_0x5e1461;return _0x4915af;})[_0x4f49('0x21')](respondWithFilteredResult(_0x148153,_0xfefbab))[_0x4f49('0x41')](handleError(_0x148153,null));};exports[_0x4f49('0x42')]=function(_0x373f90,_0x1053b2){var _0x1ecf6c={'raw':!![],'where':{'id':_0x373f90[_0x4f49('0x43')]['id']}},_0x38aff8={};_0x38aff8[_0x4f49('0x30')]=_['keys'](db['ChatOfflineMessage'][_0x4f49('0x28')]);_0x38aff8[_0x4f49('0x2c')]=_[_0x4f49('0x2d')](_0x373f90['query']);_0x38aff8[_0x4f49('0x2e')]=_['intersection'](_0x38aff8['model'],_0x38aff8[_0x4f49('0x2c')]);_0x1ecf6c[_0x4f49('0x31')]=_[_0x4f49('0x2f')](_0x38aff8['model'],qs[_0x4f49('0x32')](_0x373f90[_0x4f49('0x2c')]['fields']));_0x1ecf6c[_0x4f49('0x31')]=_0x1ecf6c['attributes'][_0x4f49('0x33')]?_0x1ecf6c[_0x4f49('0x31')]:_0x38aff8[_0x4f49('0x30')];if(_0x373f90['query'][_0x4f49('0x3e')]){_0x1ecf6c[_0x4f49('0x3f')]=[{'all':!![]}];}_0x1ecf6c=_[_0x4f49('0x3b')]({},_0x1ecf6c,_0x373f90[_0x4f49('0x3d')]);return db[_0x4f49('0x27')][_0x4f49('0x44')](_0x1ecf6c)[_0x4f49('0x21')](handleEntityNotFound(_0x1053b2,null))[_0x4f49('0x21')](respondWithResult(_0x1053b2,null))[_0x4f49('0x41')](handleError(_0x1053b2,null));};exports[_0x4f49('0x45')]=function(_0x4fe382,_0x26c222){return db[_0x4f49('0x27')]['create'](_0x4fe382[_0x4f49('0x46')],{})['then'](respondWithResult(_0x26c222,0xc9))[_0x4f49('0x41')](handleError(_0x26c222,null));};exports[_0x4f49('0x20')]=function(_0x2d3dcd,_0x300230){if(_0x2d3dcd['body']['id']){delete _0x2d3dcd[_0x4f49('0x46')]['id'];}return db[_0x4f49('0x27')][_0x4f49('0x44')]({'where':{'id':_0x2d3dcd[_0x4f49('0x43')]['id']}})[_0x4f49('0x21')](handleEntityNotFound(_0x300230,null))[_0x4f49('0x21')](saveUpdates(_0x2d3dcd[_0x4f49('0x46')],null))[_0x4f49('0x21')](respondWithResult(_0x300230,null))[_0x4f49('0x41')](handleError(_0x300230,null));};exports[_0x4f49('0x47')]=function(_0x1be59a,_0x4482f7){return db[_0x4f49('0x27')][_0x4f49('0x44')]({'where':{'id':_0x1be59a[_0x4f49('0x43')]['id']}})[_0x4f49('0x21')](handleEntityNotFound(_0x4482f7,null))['then'](removeEntity(_0x4482f7,null))['catch'](handleError(_0x4482f7,null));};exports[_0x4f49('0x48')]=function(_0x197670,_0x36bcc2){return db[_0x4f49('0x27')][_0x4f49('0x48')]()[_0x4f49('0x21')](respondWithResult(_0x36bcc2,null))[_0x4f49('0x41')](handleError(_0x36bcc2,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 8bdcbc5..e05048e 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 _0xd4f7=['rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','lodash','util','api','request-promise'];(function(_0xa39b2b,_0x8c128c){var _0x54d7f3=function(_0x139c09){while(--_0x139c09){_0xa39b2b['push'](_0xa39b2b['shift']());}};_0x54d7f3(++_0x8c128c);}(_0xd4f7,0x1ac));var _0x7d4f=function(_0x51cc1d,_0xaa88ae){_0x51cc1d=_0x51cc1d-0x0;var _0x2eb9f2=_0xd4f7[_0x51cc1d];return _0x2eb9f2;};'use strict';var _=require(_0x7d4f('0x0'));var util=require(_0x7d4f('0x1'));var logger=require('../../config/logger')(_0x7d4f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7d4f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d4f('0x4'));var config=require(_0x7d4f('0x5'));var attributes=require(_0x7d4f('0x6'));module[_0x7d4f('0x7')]=function(_0x1928bd,_0x29eff5){return _0x1928bd[_0x7d4f('0x8')](_0x7d4f('0x9'),attributes,{'tableName':_0x7d4f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7d4f('0xb')});}; \ No newline at end of file +var _0x9037=['bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','define','utf8mb4_unicode_ci','util','api','moment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9037,0xd9));var _0x7903=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9037[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x7903('0x0'));var logger=require('../../config/logger')(_0x7903('0x1'));var moment=require(_0x7903('0x2'));var BPromise=require(_0x7903('0x3'));var rp=require(_0x7903('0x4'));var fs=require('fs');var path=require(_0x7903('0x5'));var rimraf=require(_0x7903('0x6'));var config=require(_0x7903('0x7'));var attributes=require(_0x7903('0x8'));module['exports']=function(_0x24239f,_0x2ea219){return _0x24239f[_0x7903('0x9')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7903('0xa')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index e766dc8..33b3f3e 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 _0xca26=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x4871f4,_0x2c1f0){var _0x565f30=function(_0x61e2ed){while(--_0x61e2ed){_0x4871f4['push'](_0x4871f4['shift']());}};_0x565f30(++_0x2c1f0);}(_0xca26,0xd8));var _0x6ca2=function(_0x617eb,_0x2f2f57){_0x617eb=_0x617eb-0x0;var _0x3e5dbf=_0xca26[_0x617eb];return _0x3e5dbf;};'use strict';var _=require('lodash');var util=require(_0x6ca2('0x0'));var moment=require(_0x6ca2('0x1'));var BPromise=require(_0x6ca2('0x2'));var rs=require(_0x6ca2('0x3'));var fs=require('fs');var Redis=require(_0x6ca2('0x4'));var db=require(_0x6ca2('0x5'))['db'];var utils=require(_0x6ca2('0x6'));var logger=require('../../config/logger')(_0x6ca2('0x7'));var config=require(_0x6ca2('0x8'));var jayson=require(_0x6ca2('0x9'));var client=jayson[_0x6ca2('0xa')][_0x6ca2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x560f83,_0x3f9eb0,_0x514848){return new BPromise(function(_0x49315d,_0x287a5c){return client[_0x6ca2('0xc')](_0x560f83,_0x514848)[_0x6ca2('0xd')](function(_0x428bdc){logger[_0x6ca2('0xe')](_0x6ca2('0xf'),_0x3f9eb0,'request\x20sent');logger['debug'](_0x6ca2('0x10'),_0x3f9eb0,_0x6ca2('0x11'),JSON[_0x6ca2('0x12')](_0x428bdc));if(_0x428bdc[_0x6ca2('0x13')]){if(_0x428bdc[_0x6ca2('0x13')][_0x6ca2('0x14')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x3f9eb0,_0x428bdc[_0x6ca2('0x13')][_0x6ca2('0x15')]);return _0x287a5c(_0x428bdc[_0x6ca2('0x13')]['message']);}logger[_0x6ca2('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3f9eb0,_0x428bdc['error'][_0x6ca2('0x15')]);return _0x49315d(_0x428bdc['error'][_0x6ca2('0x15')]);}else{logger[_0x6ca2('0xe')](_0x6ca2('0xf'),_0x3f9eb0,_0x6ca2('0x11'));_0x49315d(_0x428bdc[_0x6ca2('0x16')][_0x6ca2('0x15')]);}})[_0x6ca2('0x17')](function(_0x16b848){logger[_0x6ca2('0x13')](_0x6ca2('0xf'),_0x3f9eb0,_0x16b848);_0x287a5c(_0x16b848);});});} \ No newline at end of file +var _0xf212=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','info','catch','lodash','bluebird','randomstring','ioredis'];(function(_0xd7845b,_0x3d84e8){var _0x53a9df=function(_0x58b910){while(--_0x58b910){_0xd7845b['push'](_0xd7845b['shift']());}};_0x53a9df(++_0x3d84e8);}(_0xf212,0x122));var _0x2f21=function(_0x294ff8,_0x51a22e){_0x294ff8=_0x294ff8-0x0;var _0x7e3eb7=_0xf212[_0x294ff8];return _0x7e3eb7;};'use strict';var _=require(_0x2f21('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2f21('0x1'));var rs=require(_0x2f21('0x2'));var fs=require('fs');var Redis=require(_0x2f21('0x3'));var db=require(_0x2f21('0x4'))['db'];var utils=require(_0x2f21('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f21('0x6'));var jayson=require(_0x2f21('0x7'));var client=jayson[_0x2f21('0x8')][_0x2f21('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6d0d82,_0xa0021e,_0x44006e){return new BPromise(function(_0x2e5915,_0x5090d5){return client[_0x2f21('0xa')](_0x6d0d82,_0x44006e)[_0x2f21('0xb')](function(_0x35d8cb){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0xa0021e,_0x2f21('0xc'));logger[_0x2f21('0xd')](_0x2f21('0xe'),_0xa0021e,'request\x20sent',JSON[_0x2f21('0xf')](_0x35d8cb));if(_0x35d8cb[_0x2f21('0x10')]){if(_0x35d8cb[_0x2f21('0x10')]['code']===0x1f4){logger[_0x2f21('0x10')](_0x2f21('0x11'),_0xa0021e,_0x35d8cb[_0x2f21('0x10')][_0x2f21('0x12')]);return _0x5090d5(_0x35d8cb['error'][_0x2f21('0x12')]);}logger[_0x2f21('0x10')](_0x2f21('0x11'),_0xa0021e,_0x35d8cb[_0x2f21('0x10')]['message']);return _0x2e5915(_0x35d8cb[_0x2f21('0x10')][_0x2f21('0x12')]);}else{logger[_0x2f21('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0xa0021e,'request\x20sent');_0x2e5915(_0x35d8cb['result'][_0x2f21('0x12')]);}})[_0x2f21('0x14')](function(_0x2ff624){logger['error'](_0x2f21('0x11'),_0xa0021e,_0x2ff624);_0x5090d5(_0x2ff624);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 12de1c8..346a78b 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 _0x24b4=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','describe','/:id','show','create','update','delete','exports','util'];(function(_0x5d82c0,_0x54bb2f){var _0x340b63=function(_0x4cad44){while(--_0x4cad44){_0x5d82c0['push'](_0x5d82c0['shift']());}};_0x340b63(++_0x54bb2f);}(_0x24b4,0xd1));var _0x424b=function(_0xea9702,_0x3d1c9b){_0xea9702=_0xea9702-0x0;var _0xdc7ec9=_0x24b4[_0xea9702];return _0xdc7ec9;};'use strict';var multer=require('multer');var util=require(_0x424b('0x0'));var path=require(_0x424b('0x1'));var timeout=require(_0x424b('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x424b('0x3'));var interaction=require(_0x424b('0x4'));var config=require('../../config/environment');var controller=require(_0x424b('0x5'));router[_0x424b('0x6')]('/',auth[_0x424b('0x7')](),controller['index']);router[_0x424b('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x424b('0x8')]);router['get'](_0x424b('0x9'),auth[_0x424b('0x7')](),controller[_0x424b('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x424b('0xb')]);router['put'](_0x424b('0x9'),auth['isAuthenticated'](),controller[_0x424b('0xc')]);router[_0x424b('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x424b('0xe')]=router; \ No newline at end of file +var _0x2d7e=['index','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x1cf6dc,_0x521c93){var _0x56d1cf=function(_0x43fd2a){while(--_0x43fd2a){_0x1cf6dc['push'](_0x1cf6dc['shift']());}};_0x56d1cf(++_0x521c93);}(_0x2d7e,0xe6));var _0xe2d7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2d7e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe2d7('0x0'));var util=require(_0xe2d7('0x1'));var path=require(_0xe2d7('0x2'));var timeout=require(_0xe2d7('0x3'));var express=require(_0xe2d7('0x4'));var router=express[_0xe2d7('0x5')]();var auth=require(_0xe2d7('0x6'));var interaction=require(_0xe2d7('0x7'));var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0xe2d7('0x8')]('/',auth[_0xe2d7('0x9')](),controller[_0xe2d7('0xa')]);router[_0xe2d7('0x8')]('/describe',auth[_0xe2d7('0x9')](),controller[_0xe2d7('0xb')]);router[_0xe2d7('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe2d7('0xc')]);router[_0xe2d7('0xd')]('/',auth[_0xe2d7('0x9')](),controller[_0xe2d7('0xe')]);router[_0xe2d7('0xf')](_0xe2d7('0x10'),auth[_0xe2d7('0x9')](),controller[_0xe2d7('0x11')]);router['delete']('/:id',auth[_0xe2d7('0x9')](),controller[_0xe2d7('0x12')]);module[_0xe2d7('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 4d6c424..a318c9e 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 _0x65ed=['sequelize','exports','STRING','ENUM','timeout','mouseOver','INTEGER'];(function(_0x27d2aa,_0x5a595c){var _0x46c5ab=function(_0x306bb1){while(--_0x306bb1){_0x27d2aa['push'](_0x27d2aa['shift']());}};_0x46c5ab(++_0x5a595c);}(_0x65ed,0x134));var _0xd65e=function(_0x4649c4,_0x4c8c1a){_0x4649c4=_0x4649c4-0x0;var _0x4166e2=_0x65ed[_0x4649c4];return _0x4166e2;};'use strict';var Sequelize=require(_0xd65e('0x0'));module[_0xd65e('0x1')]={'name':{'type':Sequelize[_0xd65e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd65e('0x3')]('mouseOver',_0xd65e('0x4')),'defaultValue':_0xd65e('0x5')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd65e('0x6')]}}; \ No newline at end of file +var _0x8cfe=['timeout','INTEGER','sequelize','exports','STRING','ENUM','mouseOver'];(function(_0x334b65,_0x15a867){var _0x206cb5=function(_0x1647b6){while(--_0x1647b6){_0x334b65['push'](_0x334b65['shift']());}};_0x206cb5(++_0x15a867);}(_0x8cfe,0xaa));var _0xe8cf=function(_0x3f641c,_0x2f0aef){_0x3f641c=_0x3f641c-0x0;var _0x28af41=_0x8cfe[_0x3f641c];return _0x28af41;};'use strict';var Sequelize=require(_0xe8cf('0x0'));module[_0xe8cf('0x1')]={'name':{'type':Sequelize[_0xe8cf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe8cf('0x3')](_0xe8cf('0x4'),_0xe8cf('0x5')),'defaultValue':_0xe8cf('0x4')},'selector':{'type':Sequelize[_0xe8cf('0x2')]},'timeout':{'type':Sequelize[_0xe8cf('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index c2331e9..82fd702 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 _0xa9e0=['keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','include','options','find','create','body','catch','params','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','show','model'];(function(_0x9b3efc,_0x577a0d){var _0x200f05=function(_0x15ad7c){while(--_0x15ad7c){_0x9b3efc['push'](_0x9b3efc['shift']());}};_0x200f05(++_0x577a0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={'raw':!![],'where':{'id':_0x526cf3['params']['id']}},_0x45a1e7={};_0x45a1e7[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x45a1e7[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x526cf3[_0x0a9e('0x2a')]);_0x45a1e7[_0x0a9e('0x2b')]=_['intersection'](_0x45a1e7[_0x0a9e('0x26')],_0x45a1e7[_0x0a9e('0x2a')]);_0x479bc4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x45a1e7['model'],qs[_0x0a9e('0x2e')](_0x526cf3[_0x0a9e('0x2a')][_0x0a9e('0x2e')]));_0x479bc4[_0x0a9e('0x2c')]=_0x479bc4[_0x0a9e('0x2c')][_0x0a9e('0x2f')]?_0x479bc4[_0x0a9e('0x2c')]:_0x45a1e7[_0x0a9e('0x26')];if(_0x526cf3[_0x0a9e('0x2a')]['includeAll']){_0x479bc4[_0x0a9e('0x30')]=[{'all':!![]}];}_0x479bc4=_['merge']({},_0x479bc4,_0x526cf3[_0x0a9e('0x31')]);return db[_0x0a9e('0x28')][_0x0a9e('0x32')](_0x479bc4)[_0x0a9e('0x1f')](handleEntityNotFound(_0x384319,null))[_0x0a9e('0x1f')](respondWithResult(_0x384319,null))['catch'](handleError(_0x384319,null));};exports[_0x0a9e('0x33')]=function(_0x46f0a5,_0x40cb85){return db[_0x0a9e('0x28')][_0x0a9e('0x33')](_0x46f0a5[_0x0a9e('0x34')],{})[_0x0a9e('0x1f')](respondWithResult(_0x40cb85,0xc9))[_0x0a9e('0x35')](handleError(_0x40cb85,null));};exports['update']=function(_0x44295a,_0x5e7238){if(_0x44295a[_0x0a9e('0x34')]['id']){delete _0x44295a[_0x0a9e('0x34')]['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x32')]({'where':{'id':_0x44295a['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5e7238,null))[_0x0a9e('0x1f')](saveUpdates(_0x44295a[_0x0a9e('0x34')],null))[_0x0a9e('0x1f')](respondWithResult(_0x5e7238,null))['catch'](handleError(_0x5e7238,null));};exports['destroy']=function(_0x1e8694,_0x5640eb){return db[_0x0a9e('0x28')][_0x0a9e('0x32')]({'where':{'id':_0x1e8694[_0x0a9e('0x36')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5640eb,null))['then'](removeEntity(_0x5640eb,null))[_0x0a9e('0x35')](handleError(_0x5640eb,null));}; \ No newline at end of file +var _0x0713=['update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','includeAll','include','merge','options','find','catch','create','body'];(function(_0x8b3690,_0x56f97f){var _0x5cea29=function(_0x279487){while(--_0x279487){_0x8b3690['push'](_0x8b3690['shift']());}};_0x5cea29(++_0x56f97f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={'raw':!![],'where':{'id':_0x4d5c4b[_0x3071('0x2d')]['id']}},_0x163604={};_0x163604[_0x3071('0x2e')]=_[_0x3071('0x2f')](db[_0x3071('0x30')][_0x3071('0x31')]);_0x163604[_0x3071('0x32')]=_[_0x3071('0x2f')](_0x4d5c4b[_0x3071('0x32')]);_0x163604['filters']=_['intersection'](_0x163604[_0x3071('0x2e')],_0x163604[_0x3071('0x32')]);_0x28792d[_0x3071('0x33')]=_[_0x3071('0x34')](_0x163604[_0x3071('0x2e')],qs[_0x3071('0x35')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x35')]));_0x28792d['attributes']=_0x28792d['attributes']['length']?_0x28792d[_0x3071('0x33')]:_0x163604[_0x3071('0x2e')];if(_0x4d5c4b['query'][_0x3071('0x36')]){_0x28792d[_0x3071('0x37')]=[{'all':!![]}];}_0x28792d=_[_0x3071('0x38')]({},_0x28792d,_0x4d5c4b[_0x3071('0x39')]);return db['ChatProactiveAction'][_0x3071('0x3a')](_0x28792d)[_0x3071('0x26')](handleEntityNotFound(_0x4fb1ca,null))[_0x3071('0x26')](respondWithResult(_0x4fb1ca,null))[_0x3071('0x3b')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x3c')]=function(_0x2068ce,_0x3c55c){return db[_0x3071('0x30')]['create'](_0x2068ce[_0x3071('0x3d')],{})['then'](respondWithResult(_0x3c55c,0xc9))['catch'](handleError(_0x3c55c,null));};exports[_0x3071('0x3e')]=function(_0xa3a7ae,_0x54d9c3){if(_0xa3a7ae[_0x3071('0x3d')]['id']){delete _0xa3a7ae[_0x3071('0x3d')]['id'];}return db[_0x3071('0x30')][_0x3071('0x3a')]({'where':{'id':_0xa3a7ae[_0x3071('0x2d')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x54d9c3,null))['then'](saveUpdates(_0xa3a7ae[_0x3071('0x3d')],null))[_0x3071('0x26')](respondWithResult(_0x54d9c3,null))['catch'](handleError(_0x54d9c3,null));};exports[_0x3071('0x27')]=function(_0x5b1392,_0x28f855){return db[_0x3071('0x30')]['find']({'where':{'id':_0x5b1392['params']['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x28f855,null))[_0x3071('0x26')](removeEntity(_0x28f855,null))[_0x3071('0x3b')](handleError(_0x28f855,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 413d6d3..1381dce 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 _0xac11=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac11,0x78));var _0x1ac1=function(_0x2b8d12,_0x2f718a){_0x2b8d12=_0x2b8d12-0x0;var _0x66a901=_0xac11[_0x2b8d12];return _0x66a901;};'use strict';var _=require('lodash');var util=require(_0x1ac1('0x0'));var logger=require(_0x1ac1('0x1'))(_0x1ac1('0x2'));var moment=require(_0x1ac1('0x3'));var BPromise=require(_0x1ac1('0x4'));var rp=require(_0x1ac1('0x5'));var fs=require('fs');var path=require(_0x1ac1('0x6'));var rimraf=require(_0x1ac1('0x7'));var config=require('../../config/environment');var attributes=require(_0x1ac1('0x8'));module['exports']=function(_0x332fe0,_0x1d03af){return _0x332fe0[_0x1ac1('0x9')](_0x1ac1('0xa'),attributes,{'tableName':_0x1ac1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c1d=['ChatProactiveAction','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','define'];(function(_0x582501,_0x14d823){var _0x5b9392=function(_0x163049){while(--_0x163049){_0x582501['push'](_0x582501['shift']());}};_0x5b9392(++_0x14d823);}(_0x2c1d,0xf3));var _0xd2c1=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2c1d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd2c1('0x0'));var util=require(_0xd2c1('0x1'));var logger=require(_0xd2c1('0x2'))(_0xd2c1('0x3'));var moment=require(_0xd2c1('0x4'));var BPromise=require('bluebird');var rp=require(_0xd2c1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd2c1('0x6'));var config=require(_0xd2c1('0x7'));var attributes=require(_0xd2c1('0x8'));module['exports']=function(_0x5419f8,_0x2fc52f){return _0x5419f8[_0xd2c1('0x9')](_0xd2c1('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 409b39a..462e65e 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 _0x7a2c=['rpc','../../config/environment','jayson/promise','client','http','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1d1e94,_0x102e26){var _0x556139=function(_0x20f5fd){while(--_0x20f5fd){_0x1d1e94['push'](_0x1d1e94['shift']());}};_0x556139(++_0x102e26);}(_0x7a2c,0x117));var _0xc7a2=function(_0x40e07a,_0xa14613){_0x40e07a=_0x40e07a-0x0;var _0x554585=_0x7a2c[_0x40e07a];return _0x554585;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var moment=require(_0xc7a2('0x1'));var BPromise=require(_0xc7a2('0x2'));var rs=require(_0xc7a2('0x3'));var fs=require('fs');var Redis=require(_0xc7a2('0x4'));var db=require(_0xc7a2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7a2('0x6'))(_0xc7a2('0x7'));var config=require(_0xc7a2('0x8'));var jayson=require(_0xc7a2('0x9'));var client=jayson[_0xc7a2('0xa')][_0xc7a2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9fd05d,_0x207cc8,_0x551261){return new BPromise(function(_0x2998e8,_0xbc1676){return client['request'](_0x9fd05d,_0x551261)['then'](function(_0x3707f0){logger[_0xc7a2('0xc')](_0xc7a2('0xd'),_0x207cc8,_0xc7a2('0xe'));logger[_0xc7a2('0xf')](_0xc7a2('0x10'),_0x207cc8,_0xc7a2('0xe'),JSON[_0xc7a2('0x11')](_0x3707f0));if(_0x3707f0['error']){if(_0x3707f0[_0xc7a2('0x12')][_0xc7a2('0x13')]===0x1f4){logger[_0xc7a2('0x12')](_0xc7a2('0xd'),_0x207cc8,_0x3707f0['error'][_0xc7a2('0x14')]);return _0xbc1676(_0x3707f0['error'][_0xc7a2('0x14')]);}logger[_0xc7a2('0x12')](_0xc7a2('0xd'),_0x207cc8,_0x3707f0[_0xc7a2('0x12')][_0xc7a2('0x14')]);return _0x2998e8(_0x3707f0[_0xc7a2('0x12')][_0xc7a2('0x14')]);}else{logger[_0xc7a2('0xc')](_0xc7a2('0xd'),_0x207cc8,_0xc7a2('0xe'));_0x2998e8(_0x3707f0['result'][_0xc7a2('0x14')]);}})[_0xc7a2('0x15')](function(_0x161160){logger[_0xc7a2('0x12')](_0xc7a2('0xd'),_0x207cc8,_0x161160);_0xbc1676(_0x161160);});});} \ No newline at end of file +var _0x86dc=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x2387c5,_0xfcc74c){var _0x2c414c=function(_0x3d1881){while(--_0x3d1881){_0x2387c5['push'](_0x2387c5['shift']());}};_0x2c414c(++_0xfcc74c);}(_0x86dc,0x145));var _0xc86d=function(_0x555b04,_0x199407){_0x555b04=_0x555b04-0x0;var _0x33271e=_0x86dc[_0x555b04];return _0x33271e;};'use strict';var _=require(_0xc86d('0x0'));var util=require(_0xc86d('0x1'));var moment=require(_0xc86d('0x2'));var BPromise=require('bluebird');var rs=require(_0xc86d('0x3'));var fs=require('fs');var Redis=require(_0xc86d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc86d('0x5'));var logger=require(_0xc86d('0x6'))(_0xc86d('0x7'));var config=require(_0xc86d('0x8'));var jayson=require(_0xc86d('0x9'));var client=jayson['client'][_0xc86d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d8597,_0x406d14,_0x4398d0){return new BPromise(function(_0xb7109a,_0x2daa74){return client['request'](_0x1d8597,_0x4398d0)[_0xc86d('0xb')](function(_0x530db8){logger['info'](_0xc86d('0xc'),_0x406d14,_0xc86d('0xd'));logger[_0xc86d('0xe')](_0xc86d('0xf'),_0x406d14,_0xc86d('0xd'),JSON[_0xc86d('0x10')](_0x530db8));if(_0x530db8[_0xc86d('0x11')]){if(_0x530db8[_0xc86d('0x11')]['code']===0x1f4){logger[_0xc86d('0x11')](_0xc86d('0xc'),_0x406d14,_0x530db8['error'][_0xc86d('0x12')]);return _0x2daa74(_0x530db8['error'][_0xc86d('0x12')]);}logger[_0xc86d('0x11')](_0xc86d('0xc'),_0x406d14,_0x530db8[_0xc86d('0x11')][_0xc86d('0x12')]);return _0xb7109a(_0x530db8[_0xc86d('0x11')][_0xc86d('0x12')]);}else{logger[_0xc86d('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x406d14,_0xc86d('0xd'));_0xb7109a(_0x530db8[_0xc86d('0x14')][_0xc86d('0x12')]);}})[_0xc86d('0x15')](function(_0x5a065c){logger['error'](_0xc86d('0xc'),_0x406d14,_0x5a065c);_0x2daa74(_0x5a065c);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 17f66b7..412d135 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 _0xc7fb=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','post','put','update','delete','exports','multer'];(function(_0x57b777,_0x451305){var _0x123390=function(_0x1847d5){while(--_0x1847d5){_0x57b777['push'](_0x57b777['shift']());}};_0x123390(++_0x451305);}(_0xc7fb,0x68));var _0xbc7f=function(_0xf1a81d,_0x1c3128){_0xf1a81d=_0xf1a81d-0x0;var _0x1e3312=_0xc7fb[_0xf1a81d];return _0x1e3312;};'use strict';var multer=require(_0xbc7f('0x0'));var util=require(_0xbc7f('0x1'));var path=require(_0xbc7f('0x2'));var timeout=require(_0xbc7f('0x3'));var express=require(_0xbc7f('0x4'));var router=express['Router']();var auth=require(_0xbc7f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbc7f('0x6'));var controller=require(_0xbc7f('0x7'));router['get'](_0xbc7f('0x8'),auth[_0xbc7f('0x9')](),controller['show']);router[_0xbc7f('0xa')]('/',auth[_0xbc7f('0x9')](),controller['create']);router[_0xbc7f('0xb')](_0xbc7f('0x8'),auth[_0xbc7f('0x9')](),controller[_0xbc7f('0xc')]);router[_0xbc7f('0xd')](_0xbc7f('0x8'),auth[_0xbc7f('0x9')](),controller['destroy']);module[_0xbc7f('0xe')]=router; \ No newline at end of file +var _0xc809=['isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0xc809,0x1b8));var _0x9c80=function(_0x196a66,_0x234bd2){_0x196a66=_0x196a66-0x0;var _0x5b07b1=_0xc809[_0x196a66];return _0x5b07b1;};'use strict';var multer=require(_0x9c80('0x0'));var util=require(_0x9c80('0x1'));var path=require(_0x9c80('0x2'));var timeout=require(_0x9c80('0x3'));var express=require(_0x9c80('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9c80('0x5'));var config=require(_0x9c80('0x6'));var controller=require(_0x9c80('0x7'));router[_0x9c80('0x8')](_0x9c80('0x9'),auth[_0x9c80('0xa')](),controller[_0x9c80('0xb')]);router[_0x9c80('0xc')]('/',auth['isAuthenticated'](),controller[_0x9c80('0xd')]);router[_0x9c80('0xe')]('/:id',auth[_0x9c80('0xa')](),controller['update']);router[_0x9c80('0xf')](_0x9c80('0x9'),auth['isAuthenticated'](),controller[_0x9c80('0x10')]);module[_0x9c80('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index f121360..03d0317 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 _0x1d6f=['ENUM','beepall','roundrobin','sequelize','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d6f,0x87));var _0xf1d6=function(_0x1c0971,_0x3f2272){_0x1c0971=_0x1c0971-0x0;var _0x53476d=_0x1d6f[_0x1c0971];return _0x53476d;};'use strict';var Sequelize=require(_0xf1d6('0x0'));module['exports']={'name':{'type':Sequelize[_0xf1d6('0x1')],'unique':_0xf1d6('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf1d6('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf1d6('0x3')]('rrmemory',_0xf1d6('0x4'),_0xf1d6('0x5'))}}; \ No newline at end of file +var _0x80a8=['exports','STRING','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x1de9ef,_0x45fda8){var _0x10b9d6=function(_0x24c5cf){while(--_0x24c5cf){_0x1de9ef['push'](_0x1de9ef['shift']());}};_0x10b9d6(++_0x45fda8);}(_0x80a8,0xc6));var _0x880a=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x80a8[_0x710815];return _0x5b3b89;};'use strict';var Sequelize=require('sequelize');module[_0x880a('0x0')]={'name':{'type':Sequelize[_0x880a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x880a('0x1')]},'timeout':{'type':Sequelize[_0x880a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x880a('0x3'),_0x880a('0x4'),_0x880a('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 2ad33ad..b3c81d3 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 _0xca8e=['info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','count','offset','limit','status','set','Content-Range','json','apply','reject','destroy','get','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','order','User','chatPause','updatedAt','createdAt','format','SIP','getTeams','pick','addTeams','body','ids','Team','voicePause','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','all','union','value','isEmpty','addAgents','userChatQueue:save','removeAgents','isArray','userChatQueue:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','socket.io-emitter','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then'];(function(_0x393efa,_0x442132){var _0x32aa3c=function(_0x2fd6b8){while(--_0x2fd6b8){_0x393efa['push'](_0x393efa['shift']());}};_0x32aa3c(++_0x442132);}(_0xca8e,0x105));var _0xeca8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca8e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xeca8('0x0'));var emlformat=require(_0xeca8('0x1'));var rimraf=require(_0xeca8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeca8('0x3'));var moment=require(_0xeca8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeca8('0x5'));var util=require('util');var path=require(_0xeca8('0x6'));var sox=require(_0xeca8('0x7'));var csv=require(_0xeca8('0x8'));var ejs=require(_0xeca8('0x9'));var fs=require('fs');var _=require(_0xeca8('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xeca8('0xb'));var deskjs=require(_0xeca8('0xc'));var toCsv=require(_0xeca8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeca8('0xd'));var authService=require(_0xeca8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xeca8('0xf'));var hardwareService=require(_0xeca8('0x10'));var logger=require(_0xeca8('0x11'))(_0xeca8('0x12'));var utils=require(_0xeca8('0x13'));var config=require(_0xeca8('0x14'));var db=require('../../mysqldb')['db'];config[_0xeca8('0x15')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xeca8('0x16'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xeca8('0x17')](socket);var jayson=require(_0xeca8('0x18'));var client=jayson[_0xeca8('0x19')][_0xeca8('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4769af,_0x35e03e,_0x3ebbb0){if(_0x3ebbb0){var _0xec82d3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xec82d3['test'](_0x35e03e)){return _0x4769af;}else{throw new db[(_0xeca8('0x1b'))][(_0xeca8('0x1c'))](_0xeca8('0x1d'));}}else{return _0x4769af;}}function respondWithRpcPromise(_0x2f865d,_0x1090b1,_0x309a8d,_0x91efc1){return new BPromise(function(_0x51f4be,_0x313c25){var _0x202df1=_0x91efc1||client;return _0x202df1['request'](_0x2f865d,_0x309a8d)[_0xeca8('0x1e')](function(_0x1a2429){logger[_0xeca8('0x1f')](_0xeca8('0x20'),_0x1090b1,_0xeca8('0x21'));logger[_0xeca8('0x22')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1090b1,'request\x20sent',JSON[_0xeca8('0x23')](_0x1a2429));if(_0x1a2429[_0xeca8('0x24')]){if(_0x1a2429[_0xeca8('0x24')][_0xeca8('0x25')]===0x1f4){logger[_0xeca8('0x24')]('ChatQueue,\x20%s,\x20%s',_0x1090b1,_0x1a2429[_0xeca8('0x24')][_0xeca8('0x26')]);return _0x313c25(_0x1a2429['error'][_0xeca8('0x26')]);}logger[_0xeca8('0x24')]('ChatQueue,\x20%s,\x20%s',_0x1090b1,_0x1a2429[_0xeca8('0x24')][_0xeca8('0x26')]);return _0x51f4be(_0x1a2429[_0xeca8('0x24')][_0xeca8('0x26')]);}else{logger['info'](_0xeca8('0x20'),_0x1090b1,_0xeca8('0x21'));_0x51f4be(_0x1a2429[_0xeca8('0x27')][_0xeca8('0x26')]);}})[_0xeca8('0x28')](function(_0x32b47d){logger[_0xeca8('0x24')](_0xeca8('0x20'),_0x1090b1,_0x32b47d);_0x313c25(_0x32b47d);});});}function respondWithStatusCode(_0x290b5c,_0x3d674f){_0x3d674f=_0x3d674f||0xcc;return function(_0x2f19b2){if(_0x2f19b2){return _0x290b5c[_0xeca8('0x29')](_0x3d674f);}return _0x290b5c['status'](_0x3d674f)[_0xeca8('0x2a')]();};}function respondWithResult(_0x6b24f6,_0x1bca77){_0x1bca77=_0x1bca77||0xc8;return function(_0x5b5092){if(_0x5b5092){return _0x6b24f6['status'](_0x1bca77)['json'](_0x5b5092);}};}function respondWithFilteredResult(_0x5c46ca,_0x3c36dc){return function(_0x5e64f5){if(_0x5e64f5){var _0x159323=_0x5e64f5[_0xeca8('0x2b')],_0x3adb11=_0x3c36dc[_0xeca8('0x2c')],_0x2e490=_0x3c36dc[_0xeca8('0x2c')]+_0x3c36dc[_0xeca8('0x2d')],_0x5ced4e;if(_0x2e490>=_0x159323){_0x2e490=_0x159323;_0x5ced4e=0xc8;}else{_0x5ced4e=0xce;}_0x5c46ca[_0xeca8('0x2e')](_0x5ced4e);return _0x5c46ca[_0xeca8('0x2f')](_0xeca8('0x30'),_0x3adb11+'-'+_0x2e490+'/'+_0x159323)[_0xeca8('0x31')](_0x5e64f5);}return null;};}function patchUpdates(_0x356310){return function(_0x163573){try{jsonpatch[_0xeca8('0x32')](_0x163573,_0x356310,!![]);}catch(_0x187fac){return BPromise[_0xeca8('0x33')](_0x187fac);}return _0x163573['save']();};}function saveUpdates(_0x27d9e8,_0x1c7951){return function(_0x4adaec){if(_0x4adaec){return _0x4adaec['update'](_0x27d9e8)[_0xeca8('0x1e')](function(_0xe2f3f0){return _0xe2f3f0;});}return null;};}function removeEntity(_0x57ffac,_0x33e35e){return function(_0x333631){if(_0x333631){return _0x333631[_0xeca8('0x34')]()[_0xeca8('0x1e')](function(){var _0x367110=_0x333631[_0xeca8('0x35')]({'plain':!![]});var _0x14cf62='ChatQueues';return db['UserProfileResource'][_0xeca8('0x34')]({'where':{'type':_0x14cf62,'resourceId':_0x367110['id']}})[_0xeca8('0x1e')](function(){return _0x333631;});})['then'](function(){_0x57ffac['status'](0xcc)[_0xeca8('0x2a')]();});}};}function handleEntityNotFound(_0x430d39,_0x39386d){return function(_0x42f03a){if(!_0x42f03a){_0x430d39[_0xeca8('0x29')](0x194);}return _0x42f03a;};}function handleError(_0x45a054,_0x372620){_0x372620=_0x372620||0x1f4;return function(_0x3b21c1){logger[_0xeca8('0x24')](_0x3b21c1[_0xeca8('0x36')]);if(_0x3b21c1['name']){delete _0x3b21c1[_0xeca8('0x37')];}_0x45a054[_0xeca8('0x2e')](_0x372620)[_0xeca8('0x38')](_0x3b21c1);};}exports[_0xeca8('0x39')]=function(_0x1c34ae,_0x1e9fd4){var _0x5ebbfb={},_0x39585a={},_0x55ae80={'count':0x0,'rows':[]};var _0x459daa=_[_0xeca8('0x3a')](db[_0xeca8('0x3b')][_0xeca8('0x3c')],function(_0x5316c4){return{'name':_0x5316c4[_0xeca8('0x3d')],'type':_0x5316c4[_0xeca8('0x3e')][_0xeca8('0x3f')]};});_0x39585a[_0xeca8('0x40')]=_[_0xeca8('0x3a')](_0x459daa,_0xeca8('0x37'));_0x39585a['query']=_[_0xeca8('0x41')](_0x1c34ae[_0xeca8('0x42')]);_0x39585a[_0xeca8('0x43')]=_[_0xeca8('0x44')](_0x39585a[_0xeca8('0x40')],_0x39585a[_0xeca8('0x42')]);_0x5ebbfb[_0xeca8('0x45')]=_[_0xeca8('0x44')](_0x39585a[_0xeca8('0x40')],qs[_0xeca8('0x46')](_0x1c34ae[_0xeca8('0x42')]['fields']));_0x5ebbfb[_0xeca8('0x45')]=_0x5ebbfb[_0xeca8('0x45')][_0xeca8('0x47')]?_0x5ebbfb['attributes']:_0x39585a[_0xeca8('0x40')];if(!_0x1c34ae[_0xeca8('0x42')][_0xeca8('0x48')](_0xeca8('0x49'))){_0x5ebbfb[_0xeca8('0x2d')]=qs['limit'](_0x1c34ae[_0xeca8('0x42')]['limit']);_0x5ebbfb[_0xeca8('0x2c')]=qs[_0xeca8('0x2c')](_0x1c34ae[_0xeca8('0x42')][_0xeca8('0x2c')]);}_0x5ebbfb['order']=qs[_0xeca8('0x4a')](_0x1c34ae[_0xeca8('0x42')][_0xeca8('0x4a')]);_0x5ebbfb[_0xeca8('0x4b')]=qs['filters'](_['pick'](_0x1c34ae[_0xeca8('0x42')],_0x39585a[_0xeca8('0x43')]),_0x459daa);if(_0x1c34ae[_0xeca8('0x42')][_0xeca8('0x4c')]){_0x5ebbfb[_0xeca8('0x4b')]=_['merge'](_0x5ebbfb[_0xeca8('0x4b')],{'$or':_['map'](_0x459daa,function(_0x1e732c){if(_0x1e732c[_0xeca8('0x3e')]!==_0xeca8('0x4d')){var _0xf9db84={};_0xf9db84[_0x1e732c[_0xeca8('0x37')]]={'$like':'%'+_0x1c34ae[_0xeca8('0x42')][_0xeca8('0x4c')]+'%'};return _0xf9db84;}})});}_0x5ebbfb=_[_0xeca8('0x4e')]({},_0x5ebbfb,_0x1c34ae['options']);var _0x4ed6f7={'where':_0x5ebbfb[_0xeca8('0x4b')]};return db['ChatQueue']['count'](_0x4ed6f7)[_0xeca8('0x1e')](function(_0x3395aa){_0x55ae80[_0xeca8('0x2b')]=_0x3395aa;if(_0x1c34ae['query'][_0xeca8('0x4f')]){_0x5ebbfb[_0xeca8('0x50')]=[{'all':!![]}];}return db[_0xeca8('0x3b')][_0xeca8('0x51')](_0x5ebbfb);})[_0xeca8('0x1e')](function(_0x4cb7b1){_0x55ae80[_0xeca8('0x52')]=_0x4cb7b1;return _0x55ae80;})['then'](respondWithFilteredResult(_0x1e9fd4,_0x5ebbfb))[_0xeca8('0x28')](handleError(_0x1e9fd4,null));};exports[_0xeca8('0x53')]=function(_0x4c6f1b,_0x16e029){var _0x2c3931={'raw':!![],'where':{'id':_0x4c6f1b[_0xeca8('0x54')]['id']}},_0x4d4408={};_0x4d4408[_0xeca8('0x40')]=_[_0xeca8('0x41')](db[_0xeca8('0x3b')]['rawAttributes']);_0x4d4408[_0xeca8('0x42')]=_['keys'](_0x4c6f1b['query']);_0x4d4408[_0xeca8('0x43')]=_[_0xeca8('0x44')](_0x4d4408[_0xeca8('0x40')],_0x4d4408['query']);_0x2c3931[_0xeca8('0x45')]=_[_0xeca8('0x44')](_0x4d4408[_0xeca8('0x40')],qs[_0xeca8('0x46')](_0x4c6f1b[_0xeca8('0x42')][_0xeca8('0x46')]));_0x2c3931[_0xeca8('0x45')]=_0x2c3931[_0xeca8('0x45')][_0xeca8('0x47')]?_0x2c3931[_0xeca8('0x45')]:_0x4d4408[_0xeca8('0x40')];if(_0x4c6f1b['query'][_0xeca8('0x4f')]){_0x2c3931[_0xeca8('0x50')]=[{'all':!![]}];}_0x2c3931=_[_0xeca8('0x4e')]({},_0x2c3931,_0x4c6f1b[_0xeca8('0x55')]);return db[_0xeca8('0x3b')][_0xeca8('0x56')](_0x2c3931)[_0xeca8('0x1e')](handleEntityNotFound(_0x16e029,null))[_0xeca8('0x1e')](respondWithResult(_0x16e029,null))[_0xeca8('0x28')](handleError(_0x16e029,null));};exports['create']=function(_0x35c740,_0x395b8f){return db['ChatQueue'][_0xeca8('0x57')](_0x35c740['body'],{})[_0xeca8('0x1e')](function(_0x582cb2){var _0x1e7c63=_0x35c740[_0xeca8('0x58')][_0xeca8('0x35')]({'plain':!![]});if(!_0x1e7c63)throw new Error(_0xeca8('0x59'));if(_0x1e7c63[_0xeca8('0x5a')]===_0xeca8('0x58')){var _0x6101be=_0x582cb2['get']({'plain':!![]});var _0x2d912e='ChatQueues';return db['UserProfileSection'][_0xeca8('0x56')]({'where':{'name':_0x2d912e,'userProfileId':_0x1e7c63[_0xeca8('0x5b')]},'raw':!![]})['then'](function(_0x302ef9){if(_0x302ef9&&_0x302ef9[_0xeca8('0x5c')]===0x0){return db[_0xeca8('0x5d')][_0xeca8('0x57')]({'name':_0x6101be[_0xeca8('0x37')],'resourceId':_0x6101be['id'],'type':_0x302ef9[_0xeca8('0x37')],'sectionId':_0x302ef9['id']},{})[_0xeca8('0x1e')](function(){return _0x582cb2;});}else{return _0x582cb2;}})[_0xeca8('0x28')](function(_0x4fd6d9){logger[_0xeca8('0x24')](_0xeca8('0x5e'),_0x4fd6d9);throw _0x4fd6d9;});}return _0x582cb2;})[_0xeca8('0x1e')](respondWithResult(_0x395b8f,0xc9))[_0xeca8('0x28')](handleError(_0x395b8f,null));};exports['update']=function(_0x2419fa,_0x258cec){if(_0x2419fa['body']['id']){delete _0x2419fa['body']['id'];}return db[_0xeca8('0x3b')]['find']({'where':{'id':_0x2419fa['params']['id']}})[_0xeca8('0x1e')](handleEntityNotFound(_0x258cec,null))[_0xeca8('0x1e')](saveUpdates(_0x2419fa['body'],null))[_0xeca8('0x1e')](respondWithResult(_0x258cec,null))['catch'](handleError(_0x258cec,null));};exports['destroy']=function(_0x1cb7d8,_0x1ee52f){return db['ChatQueue'][_0xeca8('0x56')]({'where':{'id':_0x1cb7d8[_0xeca8('0x54')]['id']}})['then'](handleEntityNotFound(_0x1ee52f,null))['then'](removeEntity(_0x1ee52f,null))[_0xeca8('0x28')](handleError(_0x1ee52f,null));};exports[_0xeca8('0x5f')]=function(_0x4ccd43,_0x11f954){return db[_0xeca8('0x3b')][_0xeca8('0x5f')]()[_0xeca8('0x1e')](respondWithResult(_0x11f954,null))['catch'](handleError(_0x11f954,null));};exports[_0xeca8('0x60')]=function(_0x2260f8,_0x2f37f9,_0x30f431){var _0x3b89ba={'raw':!![],'where':{}},_0x5bd5dd={},_0x2e956e;return db[_0xeca8('0x3b')][_0xeca8('0x61')]({'where':{'id':_0x2260f8[_0xeca8('0x54')]['id']}})[_0xeca8('0x1e')](handleEntityNotFound(_0x2f37f9,null))[_0xeca8('0x1e')](function(_0x24c4f0){if(_0x24c4f0){_0x2e956e=_0x24c4f0[_0xeca8('0x35')]({'plain':!![]});_0x5bd5dd[_0xeca8('0x40')]=_[_0xeca8('0x41')](db[_0xeca8('0x62')][_0xeca8('0x3c')]);_0x5bd5dd[_0xeca8('0x42')]=_[_0xeca8('0x41')](_0x2260f8[_0xeca8('0x42')]);_0x5bd5dd[_0xeca8('0x43')]=_['intersection'](_0x5bd5dd[_0xeca8('0x40')],_0x5bd5dd[_0xeca8('0x42')]);_0x3b89ba[_0xeca8('0x45')]=_[_0xeca8('0x44')](_0x5bd5dd[_0xeca8('0x40')],qs['fields'](_0x2260f8['query'][_0xeca8('0x46')]));_0x3b89ba['attributes']=_0x3b89ba[_0xeca8('0x45')]['length']?_0x3b89ba[_0xeca8('0x45')]:_0x5bd5dd[_0xeca8('0x40')];if(!_0x2260f8[_0xeca8('0x42')]['hasOwnProperty']('nolimit')){_0x3b89ba[_0xeca8('0x2d')]=qs[_0xeca8('0x2d')](_0x2260f8[_0xeca8('0x42')][_0xeca8('0x2d')]);_0x3b89ba[_0xeca8('0x2c')]=qs[_0xeca8('0x2c')](_0x2260f8[_0xeca8('0x42')][_0xeca8('0x2c')]);}_0x3b89ba[_0xeca8('0x63')]=qs[_0xeca8('0x4a')](_0x2260f8[_0xeca8('0x42')][_0xeca8('0x4a')]);_0x3b89ba['where']=qs[_0xeca8('0x43')](_['pick'](_0x2260f8[_0xeca8('0x42')],_0x5bd5dd[_0xeca8('0x43')]));_0x3b89ba[_0xeca8('0x4b')]['ChatQueueId']=_0x24c4f0['id'];if(_0x2260f8[_0xeca8('0x42')][_0xeca8('0x4c')]){_0x3b89ba[_0xeca8('0x4b')]=_[_0xeca8('0x4e')](_0x3b89ba['where'],{'$or':_[_0xeca8('0x3a')](_0x3b89ba[_0xeca8('0x45')],function(_0x22549c){var _0x1a0673={};_0x1a0673[_0x22549c]={'$like':'%'+_0x2260f8['query'][_0xeca8('0x4c')]+'%'};return _0x1a0673;})});}_0x3b89ba=_[_0xeca8('0x4e')]({},_0x3b89ba,_0x2260f8[_0xeca8('0x55')]);return db['UserChatQueue'][_0xeca8('0x51')](_0x3b89ba);}})[_0xeca8('0x1e')](function(_0x113118){if(_0x113118){return db[_0xeca8('0x64')]['findAndCountAll']({'where':{'id':_[_0xeca8('0x3a')](_0x113118,'UserId'),'role':'agent'},'attributes':['id',_0xeca8('0x37'),_0xeca8('0x65'),_0xeca8('0x66'),_0xeca8('0x67')]});}})['then'](function(_0x16d481){if(_0x16d481){return{'count':_0x16d481[_0xeca8('0x2b')],'rows':_[_0xeca8('0x3a')](_0x16d481[_0xeca8('0x52')],function(_0x35694c){return{'membername':_0x35694c[_0xeca8('0x37')],'UserId':_0x35694c['id'],'queue_name':_0x2e956e[_0xeca8('0x37')],'ChatQueueId':_0x2e956e['id'],'interface':util[_0xeca8('0x68')]('%s/%s',_0xeca8('0x69'),_0x35694c[_0xeca8('0x37')]),'penalty':0x0,'paused':_0x35694c[_0xeca8('0x65')],'createdAt':_0x35694c['createdAt'],'updatedAt':_0x35694c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xeca8('0x1e')](respondWithFilteredResult(_0x2f37f9,_0x3b89ba))['catch'](handleError(_0x2f37f9,null));};exports[_0xeca8('0x6a')]=function(_0x548a8f,_0x57c1d5,_0x3d4f39){var _0x51705d={};var _0x1bd262={};var _0x2aff3c;var _0x3a9699;return db[_0xeca8('0x3b')][_0xeca8('0x61')]({'where':{'id':_0x548a8f['params']['id']}})[_0xeca8('0x1e')](handleEntityNotFound(_0x57c1d5,null))[_0xeca8('0x1e')](function(_0xde7a87){if(_0xde7a87){_0x2aff3c=_0xde7a87;_0x1bd262[_0xeca8('0x40')]=_[_0xeca8('0x41')](db['Team'][_0xeca8('0x3c')]);_0x1bd262['query']=_[_0xeca8('0x41')](_0x548a8f[_0xeca8('0x42')]);_0x1bd262['filters']=_[_0xeca8('0x44')](_0x1bd262[_0xeca8('0x40')],_0x1bd262[_0xeca8('0x42')]);_0x51705d[_0xeca8('0x45')]=_[_0xeca8('0x44')](_0x1bd262[_0xeca8('0x40')],qs['fields'](_0x548a8f[_0xeca8('0x42')]['fields']));_0x51705d[_0xeca8('0x45')]=_0x51705d['attributes'][_0xeca8('0x47')]?_0x51705d[_0xeca8('0x45')]:_0x1bd262[_0xeca8('0x40')];_0x51705d[_0xeca8('0x63')]=qs[_0xeca8('0x4a')](_0x548a8f['query'][_0xeca8('0x4a')]);_0x51705d['where']=qs[_0xeca8('0x43')](_[_0xeca8('0x6b')](_0x548a8f[_0xeca8('0x42')],_0x1bd262[_0xeca8('0x43')]));if(_0x548a8f['query'][_0xeca8('0x4c')]){_0x51705d['where']=_[_0xeca8('0x4e')](_0x51705d[_0xeca8('0x4b')],{'$or':_[_0xeca8('0x3a')](_0x51705d[_0xeca8('0x45')],function(_0x453d45){var _0x5bfe98={};_0x5bfe98[_0x453d45]={'$like':'%'+_0x548a8f['query']['filter']+'%'};return _0x5bfe98;})});}_0x51705d=_[_0xeca8('0x4e')]({},_0x51705d,_0x548a8f['options']);return _0x2aff3c[_0xeca8('0x6a')](_0x51705d);}})[_0xeca8('0x1e')](function(_0x2d85cf){if(_0x2d85cf){_0x3a9699=_0x2d85cf[_0xeca8('0x47')];if(!_0x548a8f[_0xeca8('0x42')][_0xeca8('0x48')](_0xeca8('0x49'))){_0x51705d[_0xeca8('0x2d')]=qs[_0xeca8('0x2d')](_0x548a8f[_0xeca8('0x42')]['limit']);_0x51705d[_0xeca8('0x2c')]=qs[_0xeca8('0x2c')](_0x548a8f['query']['offset']);}return _0x2aff3c[_0xeca8('0x6a')](_0x51705d);}})['then'](function(_0x33a6f3){if(_0x33a6f3){return _0x33a6f3?{'count':_0x3a9699,'rows':_0x33a6f3}:null;}})[_0xeca8('0x1e')](respondWithResult(_0x57c1d5,null))[_0xeca8('0x28')](handleError(_0x57c1d5,null));};exports[_0xeca8('0x6c')]=function(_0x3c26bb,_0x4e5ed6,_0x363383){var _0x3adef5=_0x3c26bb[_0xeca8('0x6d')][_0xeca8('0x6e')];return db[_0xeca8('0x6f')][_0xeca8('0x51')]({'where':{'id':_0x3adef5},'attributes':['id'],'include':[{'model':db[_0xeca8('0x64')],'as':'Agents','attributes':['id',_0xeca8('0x37'),'online',_0xeca8('0x70'),_0xeca8('0x71')],'raw':!![]}]})['then'](function(_0x25d320){if(_0x25d320){var _0x4f3cd5=_[_0xeca8('0x72')](_0x25d320,function(_0x18416b){var _0x8dc04e=_0x18416b['get']({'plain':!![]});return _0x8dc04e[_0xeca8('0x73')];});return db[_0xeca8('0x3b')][_0xeca8('0x56')]({'where':{'id':_0x3c26bb[_0xeca8('0x54')]['id']}})['then'](function(_0x5bf889){return db[_0xeca8('0x74')][_0xeca8('0x75')](function(_0x4d1f3a){return _0x5bf889['addTeams'](_0x3adef5,{'transaction':_0x4d1f3a})[_0xeca8('0x1e')](function(){return BPromise['each'](_0x4f3cd5,function(_0x14c86b){return db[_0xeca8('0x62')][_0xeca8('0x76')]({'where':{'UserId':_0x14c86b['id'],'ChatQueueId':_0x3c26bb['params']['id']},'transaction':_0x4d1f3a});});})[_0xeca8('0x1e')](function(){_0x4f3cd5[_0xeca8('0x77')](function(_0x4b10a1){socket[_0xeca8('0x78')]('userChatQueue:save',{'UserId':_0x4b10a1['id'],'ChatQueueId':_0x5bf889['id']});});});});});}})[_0xeca8('0x1e')](respondWithStatusCode(_0x4e5ed6,null))['catch'](handleError(_0x4e5ed6,null));};exports[_0xeca8('0x79')]=function(_0x7c043d,_0x1585e5,_0x511ec8){return db[_0xeca8('0x6f')][_0xeca8('0x51')]({'where':{'id':_0x7c043d[_0xeca8('0x42')][_0xeca8('0x6e')]},'attributes':['id'],'include':[{'model':db[_0xeca8('0x64')],'as':_0xeca8('0x73'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1585e5,null))[_0xeca8('0x1e')](function(_0x17f9e5){var _0x26d3e6=_['map'](_0x17f9e5,'id');var _0x32f512=[];var _0x4876d7=[];var _0x41058a=squel[_0xeca8('0x7a')]();_0x41058a[_0xeca8('0x7b')](_0xeca8('0x7c'))[_0xeca8('0x7d')](_0xeca8('0x7e'),'tq')[_0xeca8('0x7f')](_0xeca8('0x80'),'ut',_0xeca8('0x81'))[_0xeca8('0x4b')](_0xeca8('0x82'),_0x7c043d[_0xeca8('0x54')]['id']);for(var _0x57060d=0x0;_0x57060d<_0x17f9e5[_0xeca8('0x47')];_0x57060d+=0x1){let _0xd62674=_0x17f9e5[_0x57060d];for(var _0x4e5f0e=0x0;_0x4e5f0e<_0xd62674['Agents']['length'];_0x4e5f0e+=0x1){let _0x420b88=_0xd62674[_0xeca8('0x73')][_0x4e5f0e];var _0x3361ec=_0x41058a['clone']();_0x3361ec[_0xeca8('0x4b')](_0xeca8('0x83'),_0x420b88['id']);_0x4876d7[_0xeca8('0x84')](db[_0xeca8('0x74')][_0xeca8('0x42')](_0x3361ec['toString'](),{'type':db[_0xeca8('0x74')]['QueryTypes'][_0xeca8('0x85')]})[_0xeca8('0x1e')](function(_0x134b3b){if(_0x134b3b[_0xeca8('0x47')]===0x1){return _0x420b88['id'];}else{var _0x241f33=_[_0xeca8('0x86')](_['map'](_0x134b3b,_0xeca8('0x87')),function(_0x43a4f9){return _['includes'](_0x26d3e6,_0x43a4f9);});if(_0x241f33){return _0x420b88['id'];}}}));}}return BPromise[_0xeca8('0x88')](_0x4876d7)[_0xeca8('0x1e')](function(_0x59e593){_0x32f512=_(_0x32f512)[_0xeca8('0x89')](_0x59e593)['compact']()[_0xeca8('0x8a')]();return db[_0xeca8('0x3b')][_0xeca8('0x56')]({'where':{'id':_0x7c043d[_0xeca8('0x54')]['id']}})[_0xeca8('0x1e')](function(_0x193dbc){return db[_0xeca8('0x74')]['transaction'](function(_0x5028ef){return _0x193dbc[_0xeca8('0x79')](_0x7c043d[_0xeca8('0x42')][_0xeca8('0x6e')],{'transaction':_0x5028ef})[_0xeca8('0x1e')](function(){if(!_[_0xeca8('0x8b')](_0x32f512)){return _0x193dbc['removeAgents'](_0x32f512,{'transaction':_0x5028ef});}})['then'](function(){_0x32f512[_0xeca8('0x77')](function(_0xd6e378){socket[_0xeca8('0x78')]('userChatQueue:remove',{'UserId':_0xd6e378,'ChatQueueId':_0x193dbc['id']});});});});});});})[_0xeca8('0x1e')](respondWithStatusCode(_0x1585e5,null))[_0xeca8('0x28')](handleError(_0x1585e5,null));};exports[_0xeca8('0x8c')]=function(_0x68dac5,_0x425cfb,_0x23fb30){return db[_0xeca8('0x3b')][_0xeca8('0x56')]({'where':{'id':_0x68dac5['params']['id']}})[_0xeca8('0x1e')](handleEntityNotFound(_0x425cfb,null))[_0xeca8('0x1e')](function(_0x4c9c86){if(_0x4c9c86){return _0x4c9c86[_0xeca8('0x8c')](_0x68dac5[_0xeca8('0x6d')]['ids'],_['omit'](_0x68dac5[_0xeca8('0x6d')],[_0xeca8('0x6e'),'id'])||{})['spread'](function(_0x4a23b7){for(var _0x83e08d=0x0;_0x83e08d<_0x68dac5[_0xeca8('0x6d')]['ids'][_0xeca8('0x47')];_0x83e08d+=0x1){socket['emit'](_0xeca8('0x8d'),{'UserId':_0x68dac5[_0xeca8('0x6d')]['ids'][_0x83e08d],'ChatQueueId':_0x68dac5['params']['id']});}return _0x4a23b7;});}})[_0xeca8('0x1e')](respondWithResult(_0x425cfb,null))[_0xeca8('0x28')](handleError(_0x425cfb,null));};exports[_0xeca8('0x8e')]=function(_0x3098d8,_0x5aca7b,_0x423950){return db['ChatQueue']['find']({'where':{'id':_0x3098d8[_0xeca8('0x54')]['id']}})[_0xeca8('0x1e')](handleEntityNotFound(_0x5aca7b,null))[_0xeca8('0x1e')](function(_0x39911a){if(_0x39911a){return _0x39911a['removeAgents'](_0x3098d8['query']['ids'])[_0xeca8('0x1e')](function(){if(_[_0xeca8('0x8f')](_0x3098d8['query'][_0xeca8('0x6e')])){for(var _0x7e12=0x0;_0x7e12<_0x3098d8[_0xeca8('0x42')]['ids'][_0xeca8('0x47')];_0x7e12+=0x1){socket[_0xeca8('0x78')](_0xeca8('0x90'),{'UserId':Number(_0x3098d8['query'][_0xeca8('0x6e')][_0x7e12]),'ChatQueueId':Number(_0x3098d8[_0xeca8('0x54')]['id'])});}}else{socket[_0xeca8('0x78')]('userChatQueue:remove',{'UserId':Number(_0x3098d8[_0xeca8('0x42')]['ids']),'ChatQueueId':Number(_0x3098d8[_0xeca8('0x54')]['id'])});}});}})[_0xeca8('0x1e')](respondWithStatusCode(_0x5aca7b,null))['catch'](handleError(_0x5aca7b,null));};exports[_0xeca8('0x91')]=function(_0x184bf3,_0x162676,_0x58600f){var _0x50b868={};var _0xdced4d={};var _0x117dcc;var _0x4a47a2;return db[_0xeca8('0x3b')][_0xeca8('0x61')]({'where':{'id':_0x184bf3[_0xeca8('0x54')]['id']}})[_0xeca8('0x1e')](handleEntityNotFound(_0x162676,null))['then'](function(_0x559aed){if(_0x559aed){_0x117dcc=_0x559aed;_0xdced4d['model']=_[_0xeca8('0x41')](db['User'][_0xeca8('0x3c')]);_0xdced4d[_0xeca8('0x42')]=_[_0xeca8('0x41')](_0x184bf3['query']);_0xdced4d[_0xeca8('0x43')]=_['intersection'](_0xdced4d[_0xeca8('0x40')],_0xdced4d['query']);_0x50b868['attributes']=_[_0xeca8('0x44')](_0xdced4d['model'],qs[_0xeca8('0x46')](_0x184bf3[_0xeca8('0x42')][_0xeca8('0x46')]));_0x50b868[_0xeca8('0x45')]=_0x50b868[_0xeca8('0x45')][_0xeca8('0x47')]?_0x50b868[_0xeca8('0x45')]:_0xdced4d[_0xeca8('0x40')];_0x50b868[_0xeca8('0x63')]=qs['sort'](_0x184bf3[_0xeca8('0x42')]['sort']);_0x50b868[_0xeca8('0x4b')]=qs[_0xeca8('0x43')](_[_0xeca8('0x6b')](_0x184bf3[_0xeca8('0x42')],_0xdced4d['filters']));if(_0x184bf3['query']['filter']){_0x50b868[_0xeca8('0x4b')]=_[_0xeca8('0x4e')](_0x50b868[_0xeca8('0x4b')],{'$or':_[_0xeca8('0x3a')](_0x50b868['attributes'],function(_0x40f622){var _0x477707={};_0x477707[_0x40f622]={'$like':'%'+_0x184bf3['query'][_0xeca8('0x4c')]+'%'};return _0x477707;})});}_0x50b868=_[_0xeca8('0x4e')]({},_0x50b868,_0x184bf3[_0xeca8('0x55')]);return _0x117dcc[_0xeca8('0x91')](_0x50b868);}})[_0xeca8('0x1e')](function(_0x188859){if(_0x188859){_0x4a47a2=_0x188859[_0xeca8('0x47')];if(!_0x184bf3['query'][_0xeca8('0x48')]('nolimit')){_0x50b868[_0xeca8('0x2d')]=qs[_0xeca8('0x2d')](_0x184bf3['query'][_0xeca8('0x2d')]);_0x50b868[_0xeca8('0x2c')]=qs[_0xeca8('0x2c')](_0x184bf3['query'][_0xeca8('0x2c')]);}return _0x117dcc[_0xeca8('0x91')](_0x50b868);}})[_0xeca8('0x1e')](function(_0x513687){if(_0x513687){return _0x513687?{'count':_0x4a47a2,'rows':_0x513687}:null;}})['then'](respondWithResult(_0x162676,null))[_0xeca8('0x28')](handleError(_0x162676,null));}; \ No newline at end of file +var _0xfe5d=['offset','limit','Content-Range','apply','save','update','destroy','get','ChatQueues','UserProfileResource','stack','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','describe','getMembers','findOne','UserChatQueue','ChatQueueId','findAndCountAll','UserId','agent','chatPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','User','Agents','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','field','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','union','compact','removeAgents','userChatQueue:remove','addAgents','ids','omit','spread','userChatQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','test','Sequelize','ValidationError','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0xfe5d,0x69));var _0xdfe5=function(_0x2ef354,_0x755dd4){_0x2ef354=_0x2ef354-0x0;var _0xe2af92=_0xfe5d[_0x2ef354];return _0xe2af92;};'use strict';var pdf=require(_0xdfe5('0x0'));var emlformat=require(_0xdfe5('0x1'));var rimraf=require(_0xdfe5('0x2'));var zipdir=require(_0xdfe5('0x3'));var jsonpatch=require(_0xdfe5('0x4'));var rp=require('request-promise');var moment=require(_0xdfe5('0x5'));var BPromise=require(_0xdfe5('0x6'));var Mustache=require(_0xdfe5('0x7'));var util=require('util');var path=require(_0xdfe5('0x8'));var sox=require(_0xdfe5('0x9'));var csv=require('to-csv');var ejs=require(_0xdfe5('0xa'));var fs=require('fs');var _=require(_0xdfe5('0xb'));var squel=require(_0xdfe5('0xc'));var crypto=require(_0xdfe5('0xd'));var jsforce=require(_0xdfe5('0xe'));var deskjs=require(_0xdfe5('0xf'));var toCsv=require(_0xdfe5('0x10'));var querystring=require(_0xdfe5('0x11'));var Papa=require('papaparse');var Redis=require(_0xdfe5('0x12'));var authService=require(_0xdfe5('0x13'));var qs=require(_0xdfe5('0x14'));var as=require(_0xdfe5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdfe5('0x16'));var utils=require('../../config/utils');var config=require(_0xdfe5('0x17'));var db=require(_0xdfe5('0x18'))['db'];config['redis']=_[_0xdfe5('0x19')](config[_0xdfe5('0x1a')],{'host':_0xdfe5('0x1b'),'port':0x18eb});var socket=require(_0xdfe5('0x1c'))(new Redis(config[_0xdfe5('0x1a')]));require(_0xdfe5('0x1d'))['register'](socket);var jayson=require(_0xdfe5('0x1e'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x4ee4b7,_0x4cde0f,_0x1050c2){if(_0x1050c2){var _0xe02176=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe02176[_0xdfe5('0x1f')](_0x4cde0f)){return _0x4ee4b7;}else{throw new db[(_0xdfe5('0x20'))][(_0xdfe5('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 _0x4ee4b7;}}function respondWithRpcPromise(_0x40e38f,_0x360780,_0x5c122e,_0x11cc82){return new BPromise(function(_0x49fa39,_0x35a1b6){var _0x1b414a=_0x11cc82||client;return _0x1b414a[_0xdfe5('0x22')](_0x40e38f,_0x5c122e)[_0xdfe5('0x23')](function(_0x142c31){logger['info'](_0xdfe5('0x24'),_0x360780,_0xdfe5('0x25'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x360780,_0xdfe5('0x25'),JSON[_0xdfe5('0x26')](_0x142c31));if(_0x142c31[_0xdfe5('0x27')]){if(_0x142c31[_0xdfe5('0x27')][_0xdfe5('0x28')]===0x1f4){logger['error'](_0xdfe5('0x24'),_0x360780,_0x142c31['error'][_0xdfe5('0x29')]);return _0x35a1b6(_0x142c31[_0xdfe5('0x27')][_0xdfe5('0x29')]);}logger[_0xdfe5('0x27')](_0xdfe5('0x24'),_0x360780,_0x142c31[_0xdfe5('0x27')]['message']);return _0x49fa39(_0x142c31[_0xdfe5('0x27')][_0xdfe5('0x29')]);}else{logger[_0xdfe5('0x2a')](_0xdfe5('0x24'),_0x360780,_0xdfe5('0x25'));_0x49fa39(_0x142c31[_0xdfe5('0x2b')][_0xdfe5('0x29')]);}})['catch'](function(_0x31f5d4){logger[_0xdfe5('0x27')](_0xdfe5('0x24'),_0x360780,_0x31f5d4);_0x35a1b6(_0x31f5d4);});});}function respondWithStatusCode(_0x12e3e3,_0x2b503d){_0x2b503d=_0x2b503d||0xcc;return function(_0x2e774e){if(_0x2e774e){return _0x12e3e3[_0xdfe5('0x2c')](_0x2b503d);}return _0x12e3e3[_0xdfe5('0x2d')](_0x2b503d)[_0xdfe5('0x2e')]();};}function respondWithResult(_0xdc8c34,_0x58a203){_0x58a203=_0x58a203||0xc8;return function(_0x7e9f14){if(_0x7e9f14){return _0xdc8c34[_0xdfe5('0x2d')](_0x58a203)['json'](_0x7e9f14);}};}function respondWithFilteredResult(_0x2fcd8b,_0x28a6a8){return function(_0x405fe7){if(_0x405fe7){var _0x3dc096=_0x405fe7['count'],_0x67f4ce=_0x28a6a8[_0xdfe5('0x2f')],_0x77dd80=_0x28a6a8[_0xdfe5('0x2f')]+_0x28a6a8[_0xdfe5('0x30')],_0x2d7986;if(_0x77dd80>=_0x3dc096){_0x77dd80=_0x3dc096;_0x2d7986=0xc8;}else{_0x2d7986=0xce;}_0x2fcd8b[_0xdfe5('0x2d')](_0x2d7986);return _0x2fcd8b['set'](_0xdfe5('0x31'),_0x67f4ce+'-'+_0x77dd80+'/'+_0x3dc096)['json'](_0x405fe7);}return null;};}function patchUpdates(_0x173636){return function(_0x4b64c5){try{jsonpatch[_0xdfe5('0x32')](_0x4b64c5,_0x173636,!![]);}catch(_0x2d84da){return BPromise['reject'](_0x2d84da);}return _0x4b64c5[_0xdfe5('0x33')]();};}function saveUpdates(_0x43175e,_0x514465){return function(_0x322095){if(_0x322095){return _0x322095[_0xdfe5('0x34')](_0x43175e)['then'](function(_0x51b536){return _0x51b536;});}return null;};}function removeEntity(_0x3a80e8,_0x6a05d1){return function(_0x4d9adb){if(_0x4d9adb){return _0x4d9adb[_0xdfe5('0x35')]()[_0xdfe5('0x23')](function(){var _0xc2bc43=_0x4d9adb[_0xdfe5('0x36')]({'plain':!![]});var _0x5d9ac9=_0xdfe5('0x37');return db[_0xdfe5('0x38')][_0xdfe5('0x35')]({'where':{'type':_0x5d9ac9,'resourceId':_0xc2bc43['id']}})[_0xdfe5('0x23')](function(){return _0x4d9adb;});})[_0xdfe5('0x23')](function(){_0x3a80e8[_0xdfe5('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35e10e,_0x8ae6da){return function(_0x507fd9){if(!_0x507fd9){_0x35e10e['sendStatus'](0x194);}return _0x507fd9;};}function handleError(_0x2390b8,_0x52deb4){_0x52deb4=_0x52deb4||0x1f4;return function(_0x1a771d){logger['error'](_0x1a771d[_0xdfe5('0x39')]);if(_0x1a771d['name']){delete _0x1a771d['name'];}_0x2390b8[_0xdfe5('0x2d')](_0x52deb4)[_0xdfe5('0x3a')](_0x1a771d);};}exports[_0xdfe5('0x3b')]=function(_0x4caaba,_0x543ba4){var _0x46bb2a={},_0x3d7a46={},_0x27a257={'count':0x0,'rows':[]};var _0x57ea29=_[_0xdfe5('0x3c')](db[_0xdfe5('0x3d')][_0xdfe5('0x3e')],function(_0x508a31){return{'name':_0x508a31[_0xdfe5('0x3f')],'type':_0x508a31[_0xdfe5('0x40')][_0xdfe5('0x41')]};});_0x3d7a46[_0xdfe5('0x42')]=_[_0xdfe5('0x3c')](_0x57ea29,_0xdfe5('0x43'));_0x3d7a46[_0xdfe5('0x44')]=_[_0xdfe5('0x45')](_0x4caaba[_0xdfe5('0x44')]);_0x3d7a46['filters']=_['intersection'](_0x3d7a46[_0xdfe5('0x42')],_0x3d7a46[_0xdfe5('0x44')]);_0x46bb2a['attributes']=_[_0xdfe5('0x46')](_0x3d7a46[_0xdfe5('0x42')],qs[_0xdfe5('0x47')](_0x4caaba[_0xdfe5('0x44')][_0xdfe5('0x47')]));_0x46bb2a[_0xdfe5('0x48')]=_0x46bb2a[_0xdfe5('0x48')][_0xdfe5('0x49')]?_0x46bb2a[_0xdfe5('0x48')]:_0x3d7a46[_0xdfe5('0x42')];if(!_0x4caaba[_0xdfe5('0x44')][_0xdfe5('0x4a')](_0xdfe5('0x4b'))){_0x46bb2a[_0xdfe5('0x30')]=qs[_0xdfe5('0x30')](_0x4caaba[_0xdfe5('0x44')]['limit']);_0x46bb2a['offset']=qs[_0xdfe5('0x2f')](_0x4caaba['query'][_0xdfe5('0x2f')]);}_0x46bb2a[_0xdfe5('0x4c')]=qs['sort'](_0x4caaba[_0xdfe5('0x44')][_0xdfe5('0x4d')]);_0x46bb2a[_0xdfe5('0x4e')]=qs[_0xdfe5('0x4f')](_[_0xdfe5('0x50')](_0x4caaba[_0xdfe5('0x44')],_0x3d7a46[_0xdfe5('0x4f')]),_0x57ea29);if(_0x4caaba[_0xdfe5('0x44')][_0xdfe5('0x51')]){_0x46bb2a[_0xdfe5('0x4e')]=_[_0xdfe5('0x52')](_0x46bb2a[_0xdfe5('0x4e')],{'$or':_[_0xdfe5('0x3c')](_0x57ea29,function(_0x108d0b){if(_0x108d0b[_0xdfe5('0x40')]!==_0xdfe5('0x53')){var _0x20ac48={};_0x20ac48[_0x108d0b[_0xdfe5('0x43')]]={'$like':'%'+_0x4caaba['query'][_0xdfe5('0x51')]+'%'};return _0x20ac48;}})});}_0x46bb2a=_[_0xdfe5('0x52')]({},_0x46bb2a,_0x4caaba[_0xdfe5('0x54')]);var _0x20e0f0={'where':_0x46bb2a['where']};return db[_0xdfe5('0x3d')][_0xdfe5('0x55')](_0x20e0f0)[_0xdfe5('0x23')](function(_0x22d1fa){_0x27a257[_0xdfe5('0x55')]=_0x22d1fa;if(_0x4caaba[_0xdfe5('0x44')]['includeAll']){_0x46bb2a[_0xdfe5('0x56')]=[{'all':!![]}];}return db['ChatQueue'][_0xdfe5('0x57')](_0x46bb2a);})[_0xdfe5('0x23')](function(_0x25d441){_0x27a257[_0xdfe5('0x58')]=_0x25d441;return _0x27a257;})[_0xdfe5('0x23')](respondWithFilteredResult(_0x543ba4,_0x46bb2a))[_0xdfe5('0x59')](handleError(_0x543ba4,null));};exports[_0xdfe5('0x5a')]=function(_0x26ffdc,_0x53303e){var _0x3ff822={'raw':!![],'where':{'id':_0x26ffdc[_0xdfe5('0x5b')]['id']}},_0x1ea366={};_0x1ea366[_0xdfe5('0x42')]=_['keys'](db[_0xdfe5('0x3d')]['rawAttributes']);_0x1ea366[_0xdfe5('0x44')]=_[_0xdfe5('0x45')](_0x26ffdc['query']);_0x1ea366['filters']=_[_0xdfe5('0x46')](_0x1ea366[_0xdfe5('0x42')],_0x1ea366['query']);_0x3ff822[_0xdfe5('0x48')]=_[_0xdfe5('0x46')](_0x1ea366['model'],qs['fields'](_0x26ffdc[_0xdfe5('0x44')][_0xdfe5('0x47')]));_0x3ff822[_0xdfe5('0x48')]=_0x3ff822[_0xdfe5('0x48')][_0xdfe5('0x49')]?_0x3ff822[_0xdfe5('0x48')]:_0x1ea366[_0xdfe5('0x42')];if(_0x26ffdc[_0xdfe5('0x44')][_0xdfe5('0x5c')]){_0x3ff822[_0xdfe5('0x56')]=[{'all':!![]}];}_0x3ff822=_['merge']({},_0x3ff822,_0x26ffdc[_0xdfe5('0x54')]);return db[_0xdfe5('0x3d')]['find'](_0x3ff822)[_0xdfe5('0x23')](handleEntityNotFound(_0x53303e,null))['then'](respondWithResult(_0x53303e,null))[_0xdfe5('0x59')](handleError(_0x53303e,null));};exports['create']=function(_0x2a598d,_0x25c3fd){return db['ChatQueue'][_0xdfe5('0x5d')](_0x2a598d[_0xdfe5('0x5e')],{})[_0xdfe5('0x23')](function(_0x79cb3){var _0x28edbd=_0x2a598d['user']['get']({'plain':!![]});if(!_0x28edbd)throw new Error(_0xdfe5('0x5f'));if(_0x28edbd[_0xdfe5('0x60')]==='user'){var _0x54566a=_0x79cb3[_0xdfe5('0x36')]({'plain':!![]});var _0x421693='ChatQueues';return db['UserProfileSection'][_0xdfe5('0x61')]({'where':{'name':_0x421693,'userProfileId':_0x28edbd[_0xdfe5('0x62')]},'raw':!![]})[_0xdfe5('0x23')](function(_0x335673){if(_0x335673&&_0x335673[_0xdfe5('0x63')]===0x0){return db[_0xdfe5('0x38')][_0xdfe5('0x5d')]({'name':_0x54566a[_0xdfe5('0x43')],'resourceId':_0x54566a['id'],'type':_0x335673[_0xdfe5('0x43')],'sectionId':_0x335673['id']},{})[_0xdfe5('0x23')](function(){return _0x79cb3;});}else{return _0x79cb3;}})[_0xdfe5('0x59')](function(_0xf1aade){logger[_0xdfe5('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf1aade);throw _0xf1aade;});}return _0x79cb3;})['then'](respondWithResult(_0x25c3fd,0xc9))[_0xdfe5('0x59')](handleError(_0x25c3fd,null));};exports[_0xdfe5('0x34')]=function(_0x1ab2dc,_0xe46d8e){if(_0x1ab2dc[_0xdfe5('0x5e')]['id']){delete _0x1ab2dc[_0xdfe5('0x5e')]['id'];}return db[_0xdfe5('0x3d')]['find']({'where':{'id':_0x1ab2dc[_0xdfe5('0x5b')]['id']}})[_0xdfe5('0x23')](handleEntityNotFound(_0xe46d8e,null))[_0xdfe5('0x23')](saveUpdates(_0x1ab2dc['body'],null))[_0xdfe5('0x23')](respondWithResult(_0xe46d8e,null))['catch'](handleError(_0xe46d8e,null));};exports[_0xdfe5('0x35')]=function(_0x193932,_0x195448){return db[_0xdfe5('0x3d')][_0xdfe5('0x61')]({'where':{'id':_0x193932[_0xdfe5('0x5b')]['id']}})[_0xdfe5('0x23')](handleEntityNotFound(_0x195448,null))[_0xdfe5('0x23')](removeEntity(_0x195448,null))['catch'](handleError(_0x195448,null));};exports[_0xdfe5('0x64')]=function(_0x2cca85,_0x148410){return db[_0xdfe5('0x3d')]['describe']()[_0xdfe5('0x23')](respondWithResult(_0x148410,null))['catch'](handleError(_0x148410,null));};exports[_0xdfe5('0x65')]=function(_0x494588,_0x14cb63,_0x59a892){var _0x33134c={'raw':!![],'where':{}},_0x2c51d0={},_0x3bf188;return db['ChatQueue'][_0xdfe5('0x66')]({'where':{'id':_0x494588[_0xdfe5('0x5b')]['id']}})[_0xdfe5('0x23')](handleEntityNotFound(_0x14cb63,null))[_0xdfe5('0x23')](function(_0x20f82b){if(_0x20f82b){_0x3bf188=_0x20f82b[_0xdfe5('0x36')]({'plain':!![]});_0x2c51d0['model']=_['keys'](db[_0xdfe5('0x67')][_0xdfe5('0x3e')]);_0x2c51d0['query']=_['keys'](_0x494588[_0xdfe5('0x44')]);_0x2c51d0['filters']=_['intersection'](_0x2c51d0[_0xdfe5('0x42')],_0x2c51d0[_0xdfe5('0x44')]);_0x33134c['attributes']=_[_0xdfe5('0x46')](_0x2c51d0[_0xdfe5('0x42')],qs[_0xdfe5('0x47')](_0x494588[_0xdfe5('0x44')][_0xdfe5('0x47')]));_0x33134c[_0xdfe5('0x48')]=_0x33134c[_0xdfe5('0x48')][_0xdfe5('0x49')]?_0x33134c[_0xdfe5('0x48')]:_0x2c51d0[_0xdfe5('0x42')];if(!_0x494588[_0xdfe5('0x44')][_0xdfe5('0x4a')]('nolimit')){_0x33134c[_0xdfe5('0x30')]=qs[_0xdfe5('0x30')](_0x494588[_0xdfe5('0x44')][_0xdfe5('0x30')]);_0x33134c[_0xdfe5('0x2f')]=qs[_0xdfe5('0x2f')](_0x494588[_0xdfe5('0x44')][_0xdfe5('0x2f')]);}_0x33134c['order']=qs[_0xdfe5('0x4d')](_0x494588[_0xdfe5('0x44')][_0xdfe5('0x4d')]);_0x33134c[_0xdfe5('0x4e')]=qs['filters'](_[_0xdfe5('0x50')](_0x494588[_0xdfe5('0x44')],_0x2c51d0[_0xdfe5('0x4f')]));_0x33134c[_0xdfe5('0x4e')][_0xdfe5('0x68')]=_0x20f82b['id'];if(_0x494588['query']['filter']){_0x33134c[_0xdfe5('0x4e')]=_[_0xdfe5('0x52')](_0x33134c[_0xdfe5('0x4e')],{'$or':_[_0xdfe5('0x3c')](_0x33134c['attributes'],function(_0xadb659){var _0x5a2e9a={};_0x5a2e9a[_0xadb659]={'$like':'%'+_0x494588[_0xdfe5('0x44')]['filter']+'%'};return _0x5a2e9a;})});}_0x33134c=_['merge']({},_0x33134c,_0x494588[_0xdfe5('0x54')]);return db[_0xdfe5('0x67')][_0xdfe5('0x57')](_0x33134c);}})[_0xdfe5('0x23')](function(_0x412c75){if(_0x412c75){return db['User'][_0xdfe5('0x69')]({'where':{'id':_[_0xdfe5('0x3c')](_0x412c75,_0xdfe5('0x6a')),'role':_0xdfe5('0x6b')},'attributes':['id',_0xdfe5('0x43'),_0xdfe5('0x6c'),_0xdfe5('0x6d'),'createdAt']});}})[_0xdfe5('0x23')](function(_0x399b23){if(_0x399b23){return{'count':_0x399b23[_0xdfe5('0x55')],'rows':_[_0xdfe5('0x3c')](_0x399b23[_0xdfe5('0x58')],function(_0x2acadb){return{'membername':_0x2acadb['name'],'UserId':_0x2acadb['id'],'queue_name':_0x3bf188[_0xdfe5('0x43')],'ChatQueueId':_0x3bf188['id'],'interface':util[_0xdfe5('0x6e')](_0xdfe5('0x6f'),'SIP',_0x2acadb['name']),'penalty':0x0,'paused':_0x2acadb['chatPause'],'createdAt':_0x2acadb[_0xdfe5('0x70')],'updatedAt':_0x2acadb[_0xdfe5('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdfe5('0x23')](respondWithFilteredResult(_0x14cb63,_0x33134c))[_0xdfe5('0x59')](handleError(_0x14cb63,null));};exports[_0xdfe5('0x71')]=function(_0x356b0a,_0x23bdb0,_0x4395e0){var _0x1c9f7f={};var _0x3da8c9={};var _0x557793;var _0x3b2f73;return db[_0xdfe5('0x3d')]['findOne']({'where':{'id':_0x356b0a[_0xdfe5('0x5b')]['id']}})[_0xdfe5('0x23')](handleEntityNotFound(_0x23bdb0,null))[_0xdfe5('0x23')](function(_0x1df850){if(_0x1df850){_0x557793=_0x1df850;_0x3da8c9['model']=_['keys'](db[_0xdfe5('0x72')]['rawAttributes']);_0x3da8c9[_0xdfe5('0x44')]=_[_0xdfe5('0x45')](_0x356b0a[_0xdfe5('0x44')]);_0x3da8c9[_0xdfe5('0x4f')]=_['intersection'](_0x3da8c9[_0xdfe5('0x42')],_0x3da8c9[_0xdfe5('0x44')]);_0x1c9f7f[_0xdfe5('0x48')]=_[_0xdfe5('0x46')](_0x3da8c9['model'],qs[_0xdfe5('0x47')](_0x356b0a[_0xdfe5('0x44')][_0xdfe5('0x47')]));_0x1c9f7f[_0xdfe5('0x48')]=_0x1c9f7f[_0xdfe5('0x48')][_0xdfe5('0x49')]?_0x1c9f7f[_0xdfe5('0x48')]:_0x3da8c9['model'];_0x1c9f7f[_0xdfe5('0x4c')]=qs[_0xdfe5('0x4d')](_0x356b0a[_0xdfe5('0x44')]['sort']);_0x1c9f7f[_0xdfe5('0x4e')]=qs['filters'](_['pick'](_0x356b0a[_0xdfe5('0x44')],_0x3da8c9[_0xdfe5('0x4f')]));if(_0x356b0a['query'][_0xdfe5('0x51')]){_0x1c9f7f[_0xdfe5('0x4e')]=_[_0xdfe5('0x52')](_0x1c9f7f['where'],{'$or':_[_0xdfe5('0x3c')](_0x1c9f7f[_0xdfe5('0x48')],function(_0x372c2b){var _0x4b3c87={};_0x4b3c87[_0x372c2b]={'$like':'%'+_0x356b0a['query'][_0xdfe5('0x51')]+'%'};return _0x4b3c87;})});}_0x1c9f7f=_[_0xdfe5('0x52')]({},_0x1c9f7f,_0x356b0a[_0xdfe5('0x54')]);return _0x557793[_0xdfe5('0x71')](_0x1c9f7f);}})[_0xdfe5('0x23')](function(_0x575df4){if(_0x575df4){_0x3b2f73=_0x575df4[_0xdfe5('0x49')];if(!_0x356b0a[_0xdfe5('0x44')][_0xdfe5('0x4a')](_0xdfe5('0x4b'))){_0x1c9f7f[_0xdfe5('0x30')]=qs[_0xdfe5('0x30')](_0x356b0a['query']['limit']);_0x1c9f7f['offset']=qs[_0xdfe5('0x2f')](_0x356b0a['query'][_0xdfe5('0x2f')]);}return _0x557793[_0xdfe5('0x71')](_0x1c9f7f);}})[_0xdfe5('0x23')](function(_0x1a2155){if(_0x1a2155){return _0x1a2155?{'count':_0x3b2f73,'rows':_0x1a2155}:null;}})[_0xdfe5('0x23')](respondWithResult(_0x23bdb0,null))[_0xdfe5('0x59')](handleError(_0x23bdb0,null));};exports['addTeams']=function(_0x534b6c,_0x4cc32f,_0x4a5bf9){var _0x4c7ae2=_0x534b6c[_0xdfe5('0x5e')]['ids'];return db[_0xdfe5('0x72')][_0xdfe5('0x57')]({'where':{'id':_0x4c7ae2},'attributes':['id'],'include':[{'model':db[_0xdfe5('0x73')],'as':_0xdfe5('0x74'),'attributes':['id',_0xdfe5('0x43'),'online','voicePause',_0xdfe5('0x75')],'raw':!![]}]})['then'](function(_0x2e0121){if(_0x2e0121){var _0x3a5422=_[_0xdfe5('0x76')](_0x2e0121,function(_0x5b71b1){var _0x419cb1=_0x5b71b1[_0xdfe5('0x36')]({'plain':!![]});return _0x419cb1['Agents'];});return db['ChatQueue'][_0xdfe5('0x61')]({'where':{'id':_0x534b6c['params']['id']}})[_0xdfe5('0x23')](function(_0x4da160){return db[_0xdfe5('0x77')][_0xdfe5('0x78')](function(_0x3ec7f0){return _0x4da160[_0xdfe5('0x79')](_0x4c7ae2,{'transaction':_0x3ec7f0})[_0xdfe5('0x23')](function(){return BPromise[_0xdfe5('0x7a')](_0x3a5422,function(_0x39db43){return db[_0xdfe5('0x67')][_0xdfe5('0x7b')]({'where':{'UserId':_0x39db43['id'],'ChatQueueId':_0x534b6c['params']['id']},'transaction':_0x3ec7f0});});})[_0xdfe5('0x23')](function(){_0x3a5422[_0xdfe5('0x7c')](function(_0x2e85af){socket[_0xdfe5('0x7d')]('userChatQueue:save',{'UserId':_0x2e85af['id'],'ChatQueueId':_0x4da160['id']});});});});});}})[_0xdfe5('0x23')](respondWithStatusCode(_0x4cc32f,null))[_0xdfe5('0x59')](handleError(_0x4cc32f,null));};exports[_0xdfe5('0x7e')]=function(_0x63fe1,_0x3093e7,_0x4dd7a1){return db[_0xdfe5('0x72')][_0xdfe5('0x57')]({'where':{'id':_0x63fe1[_0xdfe5('0x44')]['ids']},'attributes':['id'],'include':[{'model':db[_0xdfe5('0x73')],'as':_0xdfe5('0x74'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3093e7,null))[_0xdfe5('0x23')](function(_0x11125c){var _0xe3bab4=_[_0xdfe5('0x3c')](_0x11125c,'id');var _0x2f7648=[];var _0x192bf4=[];var _0x24f21e=squel[_0xdfe5('0x7f')]();_0x24f21e[_0xdfe5('0x80')]('tq.TeamId')['from'](_0xdfe5('0x81'),'tq')[_0xdfe5('0x82')]('user_has_teams','ut',_0xdfe5('0x83'))[_0xdfe5('0x4e')](_0xdfe5('0x84'),_0x63fe1[_0xdfe5('0x5b')]['id']);for(var _0x2308f4=0x0;_0x2308f4<_0x11125c[_0xdfe5('0x49')];_0x2308f4+=0x1){let _0xd08eed=_0x11125c[_0x2308f4];for(var _0x2f3298=0x0;_0x2f3298<_0xd08eed[_0xdfe5('0x74')][_0xdfe5('0x49')];_0x2f3298+=0x1){let _0x478c90=_0xd08eed['Agents'][_0x2f3298];var _0x32a144=_0x24f21e[_0xdfe5('0x85')]();_0x32a144[_0xdfe5('0x4e')](_0xdfe5('0x86'),_0x478c90['id']);_0x192bf4[_0xdfe5('0x87')](db[_0xdfe5('0x77')][_0xdfe5('0x44')](_0x32a144['toString'](),{'type':db['sequelize'][_0xdfe5('0x88')][_0xdfe5('0x89')]})[_0xdfe5('0x23')](function(_0x274a32){if(_0x274a32[_0xdfe5('0x49')]===0x1){return _0x478c90['id'];}else{var _0x4a0396=_[_0xdfe5('0x8a')](_[_0xdfe5('0x3c')](_0x274a32,'TeamId'),function(_0x215751){return _[_0xdfe5('0x8b')](_0xe3bab4,_0x215751);});if(_0x4a0396){return _0x478c90['id'];}}}));}}return BPromise[_0xdfe5('0x8c')](_0x192bf4)[_0xdfe5('0x23')](function(_0xdcf642){_0x2f7648=_(_0x2f7648)[_0xdfe5('0x8d')](_0xdcf642)[_0xdfe5('0x8e')]()['value']();return db[_0xdfe5('0x3d')]['find']({'where':{'id':_0x63fe1[_0xdfe5('0x5b')]['id']}})['then'](function(_0x416d6b){return db[_0xdfe5('0x77')][_0xdfe5('0x78')](function(_0xc37cd1){return _0x416d6b[_0xdfe5('0x7e')](_0x63fe1['query']['ids'],{'transaction':_0xc37cd1})[_0xdfe5('0x23')](function(){if(!_['isEmpty'](_0x2f7648)){return _0x416d6b[_0xdfe5('0x8f')](_0x2f7648,{'transaction':_0xc37cd1});}})[_0xdfe5('0x23')](function(){_0x2f7648[_0xdfe5('0x7c')](function(_0x523982){socket['emit'](_0xdfe5('0x90'),{'UserId':_0x523982,'ChatQueueId':_0x416d6b['id']});});});});});});})[_0xdfe5('0x23')](respondWithStatusCode(_0x3093e7,null))['catch'](handleError(_0x3093e7,null));};exports[_0xdfe5('0x91')]=function(_0x567cea,_0x4847be,_0x1ed2a){return db[_0xdfe5('0x3d')][_0xdfe5('0x61')]({'where':{'id':_0x567cea[_0xdfe5('0x5b')]['id']}})[_0xdfe5('0x23')](handleEntityNotFound(_0x4847be,null))[_0xdfe5('0x23')](function(_0x274c04){if(_0x274c04){return _0x274c04[_0xdfe5('0x91')](_0x567cea[_0xdfe5('0x5e')][_0xdfe5('0x92')],_[_0xdfe5('0x93')](_0x567cea[_0xdfe5('0x5e')],[_0xdfe5('0x92'),'id'])||{})[_0xdfe5('0x94')](function(_0x4178d7){for(var _0x351b2f=0x0;_0x351b2f<_0x567cea[_0xdfe5('0x5e')]['ids'][_0xdfe5('0x49')];_0x351b2f+=0x1){socket[_0xdfe5('0x7d')](_0xdfe5('0x95'),{'UserId':_0x567cea[_0xdfe5('0x5e')][_0xdfe5('0x92')][_0x351b2f],'ChatQueueId':_0x567cea[_0xdfe5('0x5b')]['id']});}return _0x4178d7;});}})[_0xdfe5('0x23')](respondWithResult(_0x4847be,null))[_0xdfe5('0x59')](handleError(_0x4847be,null));};exports['removeAgents']=function(_0x752ba9,_0x27f69a,_0x5c867){return db[_0xdfe5('0x3d')][_0xdfe5('0x61')]({'where':{'id':_0x752ba9[_0xdfe5('0x5b')]['id']}})[_0xdfe5('0x23')](handleEntityNotFound(_0x27f69a,null))[_0xdfe5('0x23')](function(_0x3637a6){if(_0x3637a6){return _0x3637a6['removeAgents'](_0x752ba9['query']['ids'])[_0xdfe5('0x23')](function(){if(_[_0xdfe5('0x96')](_0x752ba9[_0xdfe5('0x44')]['ids'])){for(var _0x5f30d7=0x0;_0x5f30d7<_0x752ba9[_0xdfe5('0x44')][_0xdfe5('0x92')][_0xdfe5('0x49')];_0x5f30d7+=0x1){socket[_0xdfe5('0x7d')](_0xdfe5('0x90'),{'UserId':Number(_0x752ba9[_0xdfe5('0x44')][_0xdfe5('0x92')][_0x5f30d7]),'ChatQueueId':Number(_0x752ba9[_0xdfe5('0x5b')]['id'])});}}else{socket[_0xdfe5('0x7d')](_0xdfe5('0x90'),{'UserId':Number(_0x752ba9[_0xdfe5('0x44')]['ids']),'ChatQueueId':Number(_0x752ba9[_0xdfe5('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x27f69a,null))[_0xdfe5('0x59')](handleError(_0x27f69a,null));};exports[_0xdfe5('0x97')]=function(_0x5ee5df,_0x175287,_0x1dad82){var _0x47ff3d={};var _0x448e73={};var _0x360ea8;var _0x2f0f03;return db['ChatQueue']['findOne']({'where':{'id':_0x5ee5df[_0xdfe5('0x5b')]['id']}})[_0xdfe5('0x23')](handleEntityNotFound(_0x175287,null))['then'](function(_0x57344b){if(_0x57344b){_0x360ea8=_0x57344b;_0x448e73[_0xdfe5('0x42')]=_['keys'](db[_0xdfe5('0x73')][_0xdfe5('0x3e')]);_0x448e73[_0xdfe5('0x44')]=_[_0xdfe5('0x45')](_0x5ee5df[_0xdfe5('0x44')]);_0x448e73['filters']=_[_0xdfe5('0x46')](_0x448e73[_0xdfe5('0x42')],_0x448e73[_0xdfe5('0x44')]);_0x47ff3d[_0xdfe5('0x48')]=_[_0xdfe5('0x46')](_0x448e73[_0xdfe5('0x42')],qs['fields'](_0x5ee5df[_0xdfe5('0x44')][_0xdfe5('0x47')]));_0x47ff3d[_0xdfe5('0x48')]=_0x47ff3d[_0xdfe5('0x48')][_0xdfe5('0x49')]?_0x47ff3d['attributes']:_0x448e73[_0xdfe5('0x42')];_0x47ff3d[_0xdfe5('0x4c')]=qs[_0xdfe5('0x4d')](_0x5ee5df[_0xdfe5('0x44')][_0xdfe5('0x4d')]);_0x47ff3d[_0xdfe5('0x4e')]=qs[_0xdfe5('0x4f')](_[_0xdfe5('0x50')](_0x5ee5df[_0xdfe5('0x44')],_0x448e73[_0xdfe5('0x4f')]));if(_0x5ee5df['query']['filter']){_0x47ff3d['where']=_[_0xdfe5('0x52')](_0x47ff3d[_0xdfe5('0x4e')],{'$or':_[_0xdfe5('0x3c')](_0x47ff3d[_0xdfe5('0x48')],function(_0x2c0d29){var _0x335389={};_0x335389[_0x2c0d29]={'$like':'%'+_0x5ee5df[_0xdfe5('0x44')][_0xdfe5('0x51')]+'%'};return _0x335389;})});}_0x47ff3d=_[_0xdfe5('0x52')]({},_0x47ff3d,_0x5ee5df['options']);return _0x360ea8[_0xdfe5('0x97')](_0x47ff3d);}})[_0xdfe5('0x23')](function(_0x219433){if(_0x219433){_0x2f0f03=_0x219433[_0xdfe5('0x49')];if(!_0x5ee5df[_0xdfe5('0x44')][_0xdfe5('0x4a')](_0xdfe5('0x4b'))){_0x47ff3d['limit']=qs[_0xdfe5('0x30')](_0x5ee5df[_0xdfe5('0x44')][_0xdfe5('0x30')]);_0x47ff3d[_0xdfe5('0x2f')]=qs[_0xdfe5('0x2f')](_0x5ee5df['query']['offset']);}return _0x360ea8[_0xdfe5('0x97')](_0x47ff3d);}})[_0xdfe5('0x23')](function(_0x5479cf){if(_0x5479cf){return _0x5479cf?{'count':_0x2f0f03,'rows':_0x5479cf}:null;}})[_0xdfe5('0x23')](respondWithResult(_0x175287,null))[_0xdfe5('0x59')](handleError(_0x175287,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 880a19a..d447be9 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x6045d7,_0x474dd5){var _0x5f2e2b=function(_0x3644cc){while(--_0x3644cc){_0x6045d7['push'](_0x6045d7['shift']());}};_0x5f2e2b(++_0x474dd5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0x0b0e[_0x31a938];return _0x1bf341;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x1e1704,_0xfbfcb0){var _0x5abf01=function(_0x14935d){while(--_0x14935d){_0x1e1704['push'](_0x1e1704['shift']());}};_0x5abf01(++_0xfbfcb0);}(_0xb10b,0x12a));var _0xbb10=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0xb10b[_0x3eff21];return _0x1945bb;};'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 c11acf8..fc2164a 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 _0x39de=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatQueue','chat_queues','lodash'];(function(_0x32725c,_0x618c7f){var _0x4b3504=function(_0x331347){while(--_0x331347){_0x32725c['push'](_0x32725c['shift']());}};_0x4b3504(++_0x618c7f);}(_0x39de,0x8f));var _0xe39d=function(_0x3d9e94,_0x48136c){_0x3d9e94=_0x3d9e94-0x0;var _0x45f76e=_0x39de[_0x3d9e94];return _0x45f76e;};'use strict';var _=require(_0xe39d('0x0'));var util=require('util');var logger=require(_0xe39d('0x1'))(_0xe39d('0x2'));var moment=require(_0xe39d('0x3'));var BPromise=require(_0xe39d('0x4'));var rp=require(_0xe39d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe39d('0x6'));var config=require(_0xe39d('0x7'));var attributes=require('./chatQueue.attributes');module[_0xe39d('0x8')]=function(_0x592a65,_0x5ca63e){return _0x592a65[_0xe39d('0x9')](_0xe39d('0xa'),attributes,{'tableName':_0xe39d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95fb=['define','ChatQueue','chat_queues','lodash','util','api','bluebird','request-promise','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x95fb,0x174));var _0xb95f=function(_0x3c2a24,_0x5c67a0){_0x3c2a24=_0x3c2a24-0x0;var _0x1b29e1=_0x95fb[_0x3c2a24];return _0x1b29e1;};'use strict';var _=require(_0xb95f('0x0'));var util=require(_0xb95f('0x1'));var logger=require('../../config/logger')(_0xb95f('0x2'));var moment=require('moment');var BPromise=require(_0xb95f('0x3'));var rp=require(_0xb95f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb95f('0x5'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x5b864f,_0x1c5def){return _0x5b864f[_0xb95f('0x6')](_0xb95f('0x7'),attributes,{'tableName':_0xb95f('0x8'),'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 2635e9d..926dfbf 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 _0xe24e=['ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','then','info'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0xe24e,0x15f));var _0xee24=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0xe24e[_0x4aa4e6];return _0x322588;};'use strict';var _=require(_0xee24('0x0'));var util=require(_0xee24('0x1'));var moment=require(_0xee24('0x2'));var BPromise=require(_0xee24('0x3'));var rs=require(_0xee24('0x4'));var fs=require('fs');var Redis=require(_0xee24('0x5'));var db=require(_0xee24('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xee24('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xee24('0x8')][_0xee24('0x9')]({'port':0x232a});config[_0xee24('0xa')]=_[_0xee24('0xb')](config[_0xee24('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xee24('0xc'))(new Redis(config[_0xee24('0xa')]));require(_0xee24('0xd'))[_0xee24('0xe')](socket);function respondWithRpcPromise(_0x346647,_0x1cb7d6,_0x3a928d){return new BPromise(function(_0x2fa6e1,_0x47f87f){return client[_0xee24('0xf')](_0x346647,_0x3a928d)[_0xee24('0x10')](function(_0x1f9199){logger[_0xee24('0x11')](_0xee24('0x12'),_0x1cb7d6,_0xee24('0x13'));logger[_0xee24('0x14')](_0xee24('0x15'),_0x1cb7d6,'request\x20sent',JSON[_0xee24('0x16')](_0x1f9199));if(_0x1f9199[_0xee24('0x17')]){if(_0x1f9199[_0xee24('0x17')][_0xee24('0x18')]===0x1f4){logger[_0xee24('0x17')](_0xee24('0x12'),_0x1cb7d6,_0x1f9199[_0xee24('0x17')][_0xee24('0x19')]);return _0x47f87f(_0x1f9199[_0xee24('0x17')][_0xee24('0x19')]);}logger[_0xee24('0x17')](_0xee24('0x12'),_0x1cb7d6,_0x1f9199[_0xee24('0x17')][_0xee24('0x19')]);return _0x2fa6e1(_0x1f9199[_0xee24('0x17')]['message']);}else{logger['info'](_0xee24('0x12'),_0x1cb7d6,_0xee24('0x13'));_0x2fa6e1(_0x1f9199[_0xee24('0x1a')][_0xee24('0x19')]);}})[_0xee24('0x1b')](function(_0x27a0cf){logger[_0xee24('0x17')](_0xee24('0x12'),_0x1cb7d6,_0x27a0cf);_0x47f87f(_0x27a0cf);});});}exports[_0xee24('0x1c')]=function(_0xff741b){var _0x2ef7f0=this;return new Promise(function(_0xffa04d,_0x3ec49f){return db[_0xee24('0x1d')][_0xee24('0x1e')]({'raw':_0xff741b[_0xee24('0x1f')]?_0xff741b[_0xee24('0x1f')][_0xee24('0x20')]===undefined?!![]:![]:!![],'where':_0xff741b[_0xee24('0x1f')]?_0xff741b[_0xee24('0x1f')][_0xee24('0x21')]||null:null,'attributes':_0xff741b[_0xee24('0x1f')]?_0xff741b[_0xee24('0x1f')][_0xee24('0x22')]||null:null,'limit':_0xff741b[_0xee24('0x1f')]?_0xff741b[_0xee24('0x1f')][_0xee24('0x23')]||null:null,'include':_0xff741b[_0xee24('0x1f')]?_0xff741b[_0xee24('0x1f')][_0xee24('0x24')]?_[_0xee24('0x25')](_0xff741b[_0xee24('0x1f')][_0xee24('0x24')],function(_0x15c02f){return{'model':db[_0x15c02f[_0xee24('0x26')]],'as':_0x15c02f['as'],'attributes':_0x15c02f[_0xee24('0x22')],'include':_0x15c02f[_0xee24('0x24')]?_[_0xee24('0x25')](_0x15c02f[_0xee24('0x24')],function(_0x5617b6){return{'model':db[_0x5617b6[_0xee24('0x26')]],'as':_0x5617b6['as'],'attributes':_0x5617b6[_0xee24('0x22')],'include':_0x5617b6[_0xee24('0x24')]?_[_0xee24('0x25')](_0x5617b6[_0xee24('0x24')],function(_0x3d4964){return{'model':db[_0x3d4964[_0xee24('0x26')]],'as':_0x3d4964['as'],'attributes':_0x3d4964[_0xee24('0x22')]};}):[]};}):[]};}):[]:[]})[_0xee24('0x10')](function(_0x5d468d){logger[_0xee24('0x11')](_0xee24('0x1c'),_0xff741b);logger[_0xee24('0x14')]('GetChatQueue',_0xff741b,JSON[_0xee24('0x16')](_0x5d468d));_0xffa04d(_0x5d468d);})['catch'](function(_0x4ede3c){logger[_0xee24('0x17')](_0xee24('0x1c'),_0x4ede3c[_0xee24('0x19')],_0xff741b);_0x3ec49f(_0x2ef7f0[_0xee24('0x17')](0x1f4,_0x4ede3c[_0xee24('0x19')]));});});};exports[_0xee24('0x27')]=function(_0x41249d){var _0x328a05=this;return new Promise(function(_0x2266ab,_0x17a5ac){return db['ChatQueue'][_0xee24('0x28')]({'raw':_0x41249d[_0xee24('0x1f')]?_0x41249d[_0xee24('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x41249d[_0xee24('0x1f')]?_0x41249d[_0xee24('0x1f')]['where']||null:null,'attributes':_0x41249d[_0xee24('0x1f')]?_0x41249d[_0xee24('0x1f')]['attributes']||null:null,'include':_0x41249d[_0xee24('0x1f')]?_0x41249d['options'][_0xee24('0x24')]?_['map'](_0x41249d[_0xee24('0x1f')][_0xee24('0x24')],function(_0x790b44){return{'model':db[_0x790b44[_0xee24('0x26')]],'as':_0x790b44['as'],'attributes':_0x790b44[_0xee24('0x22')],'include':_0x790b44[_0xee24('0x24')]?_['map'](_0x790b44[_0xee24('0x24')],function(_0x32e2f0){return{'model':db[_0x32e2f0[_0xee24('0x26')]],'as':_0x32e2f0['as'],'attributes':_0x32e2f0['attributes'],'include':_0x32e2f0['include']?_[_0xee24('0x25')](_0x32e2f0['include'],function(_0x56de2e){return{'model':db[_0x56de2e['model']],'as':_0x56de2e['as'],'attributes':_0x56de2e['attributes']};}):[]};}):[]};}):[]:[]})[_0xee24('0x10')](function(_0x1cd632){logger[_0xee24('0x11')]('ShowChatQueue',_0x41249d);logger[_0xee24('0x14')](_0xee24('0x27'),_0x41249d,JSON[_0xee24('0x16')](_0x1cd632));_0x2266ab(_0x1cd632);})['catch'](function(_0x2b749f){logger[_0xee24('0x17')]('ShowChatQueue',_0x2b749f[_0xee24('0x19')],_0x41249d);_0x17a5ac(_0x328a05[_0xee24('0x17')](0x1f4,_0x2b749f[_0xee24('0x19')]));});});}; \ No newline at end of file +var _0x11e3=['localhost','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','catch','find','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults'];(function(_0x390b49,_0x5ecdc4){var _0x23c460=function(_0x3b815b){while(--_0x3b815b){_0x390b49['push'](_0x390b49['shift']());}};_0x23c460(++_0x5ecdc4);}(_0x11e3,0x6f));var _0x311e=function(_0x9bee87,_0x5db69e){_0x9bee87=_0x9bee87-0x0;var _0x3d8161=_0x11e3[_0x9bee87];return _0x3d8161;};'use strict';var _=require(_0x311e('0x0'));var util=require(_0x311e('0x1'));var moment=require(_0x311e('0x2'));var BPromise=require(_0x311e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x311e('0x4'));var db=require(_0x311e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x311e('0x6'))(_0x311e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x311e('0x8')][_0x311e('0x9')]({'port':0x232a});config[_0x311e('0xa')]=_[_0x311e('0xb')](config[_0x311e('0xa')],{'host':_0x311e('0xc'),'port':0x18eb});var socket=require(_0x311e('0xd'))(new Redis(config[_0x311e('0xa')]));require(_0x311e('0xe'))[_0x311e('0xf')](socket);function respondWithRpcPromise(_0x36b445,_0x2bde9f,_0x107912){return new BPromise(function(_0x5efdec,_0x3bab9b){return client['request'](_0x36b445,_0x107912)[_0x311e('0x10')](function(_0x33c300){logger[_0x311e('0x11')](_0x311e('0x12'),_0x2bde9f,'request\x20sent');logger['debug'](_0x311e('0x13'),_0x2bde9f,'request\x20sent',JSON['stringify'](_0x33c300));if(_0x33c300[_0x311e('0x14')]){if(_0x33c300[_0x311e('0x14')][_0x311e('0x15')]===0x1f4){logger[_0x311e('0x14')](_0x311e('0x12'),_0x2bde9f,_0x33c300[_0x311e('0x14')]['message']);return _0x3bab9b(_0x33c300[_0x311e('0x14')]['message']);}logger['error'](_0x311e('0x12'),_0x2bde9f,_0x33c300['error'][_0x311e('0x16')]);return _0x5efdec(_0x33c300['error'][_0x311e('0x16')]);}else{logger[_0x311e('0x11')]('ChatQueue,\x20%s,\x20%s',_0x2bde9f,_0x311e('0x17'));_0x5efdec(_0x33c300[_0x311e('0x18')][_0x311e('0x16')]);}})['catch'](function(_0x30b7b4){logger[_0x311e('0x14')](_0x311e('0x12'),_0x2bde9f,_0x30b7b4);_0x3bab9b(_0x30b7b4);});});}exports[_0x311e('0x19')]=function(_0x399fc2){var _0x47f42f=this;return new Promise(function(_0x3a6ccd,_0x5c0a69){return db[_0x311e('0x1a')][_0x311e('0x1b')]({'raw':_0x399fc2[_0x311e('0x1c')]?_0x399fc2['options'][_0x311e('0x1d')]===undefined?!![]:![]:!![],'where':_0x399fc2['options']?_0x399fc2[_0x311e('0x1c')][_0x311e('0x1e')]||null:null,'attributes':_0x399fc2[_0x311e('0x1c')]?_0x399fc2[_0x311e('0x1c')][_0x311e('0x1f')]||null:null,'limit':_0x399fc2[_0x311e('0x1c')]?_0x399fc2['options'][_0x311e('0x20')]||null:null,'include':_0x399fc2['options']?_0x399fc2[_0x311e('0x1c')][_0x311e('0x21')]?_[_0x311e('0x22')](_0x399fc2[_0x311e('0x1c')]['include'],function(_0x45c3b6){return{'model':db[_0x45c3b6['model']],'as':_0x45c3b6['as'],'attributes':_0x45c3b6[_0x311e('0x1f')],'include':_0x45c3b6['include']?_[_0x311e('0x22')](_0x45c3b6[_0x311e('0x21')],function(_0x5e9fe2){return{'model':db[_0x5e9fe2[_0x311e('0x23')]],'as':_0x5e9fe2['as'],'attributes':_0x5e9fe2[_0x311e('0x1f')],'include':_0x5e9fe2[_0x311e('0x21')]?_[_0x311e('0x22')](_0x5e9fe2[_0x311e('0x21')],function(_0xb03d19){return{'model':db[_0xb03d19[_0x311e('0x23')]],'as':_0xb03d19['as'],'attributes':_0xb03d19[_0x311e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ae602){logger[_0x311e('0x11')](_0x311e('0x19'),_0x399fc2);logger[_0x311e('0x24')](_0x311e('0x19'),_0x399fc2,JSON[_0x311e('0x25')](_0x3ae602));_0x3a6ccd(_0x3ae602);})[_0x311e('0x26')](function(_0x2af62a){logger[_0x311e('0x14')](_0x311e('0x19'),_0x2af62a[_0x311e('0x16')],_0x399fc2);_0x5c0a69(_0x47f42f[_0x311e('0x14')](0x1f4,_0x2af62a[_0x311e('0x16')]));});});};exports['ShowChatQueue']=function(_0xa3139f){var _0x31ce52=this;return new Promise(function(_0x3cd5da,_0x272684){return db[_0x311e('0x1a')][_0x311e('0x27')]({'raw':_0xa3139f[_0x311e('0x1c')]?_0xa3139f['options']['raw']===undefined?!![]:![]:!![],'where':_0xa3139f[_0x311e('0x1c')]?_0xa3139f['options'][_0x311e('0x1e')]||null:null,'attributes':_0xa3139f[_0x311e('0x1c')]?_0xa3139f[_0x311e('0x1c')][_0x311e('0x1f')]||null:null,'include':_0xa3139f['options']?_0xa3139f[_0x311e('0x1c')][_0x311e('0x21')]?_[_0x311e('0x22')](_0xa3139f[_0x311e('0x1c')]['include'],function(_0x2bd663){return{'model':db[_0x2bd663[_0x311e('0x23')]],'as':_0x2bd663['as'],'attributes':_0x2bd663[_0x311e('0x1f')],'include':_0x2bd663[_0x311e('0x21')]?_[_0x311e('0x22')](_0x2bd663[_0x311e('0x21')],function(_0xd6fafe){return{'model':db[_0xd6fafe['model']],'as':_0xd6fafe['as'],'attributes':_0xd6fafe[_0x311e('0x1f')],'include':_0xd6fafe[_0x311e('0x21')]?_[_0x311e('0x22')](_0xd6fafe['include'],function(_0x251b6f){return{'model':db[_0x251b6f[_0x311e('0x23')]],'as':_0x251b6f['as'],'attributes':_0x251b6f[_0x311e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x311e('0x10')](function(_0xb12896){logger[_0x311e('0x11')](_0x311e('0x28'),_0xa3139f);logger[_0x311e('0x24')](_0x311e('0x28'),_0xa3139f,JSON['stringify'](_0xb12896));_0x3cd5da(_0xb12896);})[_0x311e('0x26')](function(_0x20149f){logger[_0x311e('0x14')](_0x311e('0x28'),_0x20149f['message'],_0xa3139f);_0x272684(_0x31ce52['error'](0x1f4,_0x20149f[_0x311e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 67ce266..f7be946 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 _0xadb5=['update','emit','register','length','chatQueue:','save'];(function(_0x54ef1e,_0x218d4a){var _0x19c745=function(_0x46fb24){while(--_0x46fb24){_0x54ef1e['push'](_0x54ef1e['shift']());}};_0x19c745(++_0x218d4a);}(_0xadb5,0xad));var _0x5adb=function(_0x437bec,_0x380b66){_0x437bec=_0x437bec-0x0;var _0x87ff34=_0xadb5[_0x437bec];return _0x87ff34;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x5adb('0x0'),'remove',_0x5adb('0x1')];function createListener(_0x38f67f,_0x3129c3){return function(_0x4aecec){_0x3129c3[_0x5adb('0x2')](_0x38f67f,_0x4aecec);};}function removeListener(_0x31457,_0x2e3ef4){return function(){ChatQueueEvents['removeListener'](_0x31457,_0x2e3ef4);};}exports[_0x5adb('0x3')]=function(_0x168d89){for(var _0x3e2555=0x0,_0x3213e8=events[_0x5adb('0x4')];_0x3e2555<_0x3213e8;_0x3e2555++){var _0x353885=events[_0x3e2555];var _0x47228a=createListener(_0x5adb('0x5')+_0x353885,_0x168d89);ChatQueueEvents['on'](_0x353885,_0x47228a);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x11bc40,_0x537bbc){var _0x2b7a99=function(_0x50135b){while(--_0x50135b){_0x11bc40['push'](_0x11bc40['shift']());}};_0x2b7a99(++_0x537bbc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c5c49,_0x8640df){_0x2c5c49=_0x2c5c49-0x0;var _0x3b047d=_0x5f2f[_0x2c5c49];return _0x3b047d;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 5ae6bea..b8516df 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 _0x6c51=['multer','path','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','delete','/:id/teams','removeTeams','removeAgents','exports'];(function(_0x2beba9,_0x304957){var _0xfb6f7e=function(_0x331689){while(--_0x331689){_0x2beba9['push'](_0x2beba9['shift']());}};_0xfb6f7e(++_0x304957);}(_0x6c51,0xa2));var _0x16c5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6c51[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x16c5('0x0'));var util=require('util');var path=require(_0x16c5('0x1'));var timeout=require('connect-timeout');var express=require(_0x16c5('0x2'));var router=express[_0x16c5('0x3')]();var auth=require(_0x16c5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x16c5('0x5'));router[_0x16c5('0x6')]('/',auth[_0x16c5('0x7')](),controller[_0x16c5('0x8')]);router['get'](_0x16c5('0x9'),auth[_0x16c5('0x7')](),controller[_0x16c5('0xa')]);router[_0x16c5('0x6')](_0x16c5('0xb'),auth[_0x16c5('0x7')](),controller[_0x16c5('0xc')]);router[_0x16c5('0x6')](_0x16c5('0xd'),auth[_0x16c5('0x7')](),controller[_0x16c5('0xe')]);router[_0x16c5('0x6')]('/:id/teams',auth[_0x16c5('0x7')](),controller[_0x16c5('0xf')]);router[_0x16c5('0x6')](_0x16c5('0x10'),auth['isAuthenticated'](),controller[_0x16c5('0x11')]);router[_0x16c5('0x12')]('/',auth['isAuthenticated'](),controller[_0x16c5('0x13')]);router[_0x16c5('0x12')]('/:id/teams',auth[_0x16c5('0x7')](),controller[_0x16c5('0x14')]);router[_0x16c5('0x12')]('/:id/users',auth[_0x16c5('0x7')](),controller[_0x16c5('0x15')]);router['put']('/:id',auth[_0x16c5('0x7')](),controller['update']);router[_0x16c5('0x16')](_0x16c5('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x16c5('0x16')](_0x16c5('0x17'),auth['isAuthenticated'](),controller[_0x16c5('0x18')]);router[_0x16c5('0x16')](_0x16c5('0x10'),auth[_0x16c5('0x7')](),controller[_0x16c5('0x19')]);module[_0x16c5('0x1a')]=router; \ No newline at end of file +var _0x3f7f=['get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller'];(function(_0x494ea1,_0x50df4a){var _0x1da9da=function(_0x1bc499){while(--_0x1bc499){_0x494ea1['push'](_0x494ea1['shift']());}};_0x1da9da(++_0x50df4a);}(_0x3f7f,0xbb));var _0xf3f7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3f7f[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xf3f7('0x0'));var util=require(_0xf3f7('0x1'));var path=require('path');var timeout=require(_0xf3f7('0x2'));var express=require(_0xf3f7('0x3'));var router=express[_0xf3f7('0x4')]();var auth=require(_0xf3f7('0x5'));var interaction=require(_0xf3f7('0x6'));var config=require(_0xf3f7('0x7'));var controller=require(_0xf3f7('0x8'));router[_0xf3f7('0x9')]('/',auth['isAuthenticated'](),controller[_0xf3f7('0xa')]);router[_0xf3f7('0x9')](_0xf3f7('0xb'),auth[_0xf3f7('0xc')](),controller[_0xf3f7('0xd')]);router['get']('/:id',auth[_0xf3f7('0xc')](),controller[_0xf3f7('0xe')]);router[_0xf3f7('0x9')](_0xf3f7('0xf'),auth[_0xf3f7('0xc')](),controller[_0xf3f7('0x10')]);router['get'](_0xf3f7('0x11'),auth[_0xf3f7('0xc')](),controller['getTeams']);router[_0xf3f7('0x9')](_0xf3f7('0x12'),auth[_0xf3f7('0xc')](),controller[_0xf3f7('0x13')]);router[_0xf3f7('0x14')]('/',auth[_0xf3f7('0xc')](),controller['create']);router[_0xf3f7('0x14')](_0xf3f7('0x11'),auth[_0xf3f7('0xc')](),controller[_0xf3f7('0x15')]);router[_0xf3f7('0x14')](_0xf3f7('0x12'),auth[_0xf3f7('0xc')](),controller[_0xf3f7('0x16')]);router[_0xf3f7('0x17')]('/:id',auth[_0xf3f7('0xc')](),controller[_0xf3f7('0x18')]);router[_0xf3f7('0x19')]('/:id',auth[_0xf3f7('0xc')](),controller[_0xf3f7('0x1a')]);router[_0xf3f7('0x19')]('/:id/teams',auth[_0xf3f7('0xc')](),controller[_0xf3f7('0x1b')]);router['delete'](_0xf3f7('0x12'),auth[_0xf3f7('0xc')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 5b8e56b..300ffac 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 _0x893b=['STRING','DATE','moment','sequelize','exports'];(function(_0x4077ef,_0x584c5d){var _0x4b1852=function(_0x1ca351){while(--_0x1ca351){_0x4077ef['push'](_0x4077ef['shift']());}};_0x4b1852(++_0x584c5d);}(_0x893b,0x16f));var _0xb893=function(_0x41f134,_0x216ee6){_0x41f134=_0x41f134-0x0;var _0x22e54c=_0x893b[_0x41f134];return _0x22e54c;};'use strict';var moment=require(_0xb893('0x0'));var Sequelize=require(_0xb893('0x1'));module[_0xb893('0x2')]={'uniqueid':{'type':Sequelize[_0xb893('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb893('0x3')]},'joinAt':{'type':Sequelize[_0xb893('0x4')]},'leaveAt':{'type':Sequelize[_0xb893('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb893('0x4')]},'reason':{'type':Sequelize[_0xb893('0x3')]}}; \ No newline at end of file +var _0x9db1=['sequelize','exports','STRING','DATE','moment'];(function(_0x595775,_0x1d5665){var _0x5ad30f=function(_0xf245e3){while(--_0xf245e3){_0x595775['push'](_0x595775['shift']());}};_0x5ad30f(++_0x1d5665);}(_0x9db1,0x6d));var _0x19db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9db1[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x19db('0x0'));var Sequelize=require(_0x19db('0x1'));module[_0x19db('0x2')]={'uniqueid':{'type':Sequelize[_0x19db('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x19db('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x19db('0x4')]},'exitAt':{'type':Sequelize[_0x19db('0x4')]},'reason':{'type':Sequelize[_0x19db('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 2c65d01..39f11a6 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 _0x757a=['count','findAll','rows','catch','params','keys','includeAll','include','create','body','find','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','end','status','json','offset','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','map','VIRTUAL','options','ChatQueueReport'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x757a,0xde));var _0xa757=function(_0x189480,_0x45b6b5){_0x189480=_0x189480-0x0;var _0x2922e6=_0x757a[_0x189480];return _0x2922e6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa757('0x0'));var rimraf=require(_0xa757('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa757('0x2'));var BPromise=require(_0xa757('0x3'));var Mustache=require(_0xa757('0x4'));var util=require(_0xa757('0x5'));var path=require(_0xa757('0x6'));var sox=require(_0xa757('0x7'));var csv=require('to-csv');var ejs=require(_0xa757('0x8'));var fs=require('fs');var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0xd'));var querystring=require(_0xa757('0xe'));var Papa=require('papaparse');var Redis=require(_0xa757('0xf'));var authService=require(_0xa757('0x10'));var qs=require(_0xa757('0x11'));var as=require(_0xa757('0x12'));var hardwareService=require(_0xa757('0x13'));var logger=require(_0xa757('0x14'))(_0xa757('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56acfb,_0x4db68e){_0x4db68e=_0x4db68e||0xcc;return function(_0x421040){if(_0x421040){return _0x56acfb['sendStatus'](_0x4db68e);}return _0x56acfb['status'](_0x4db68e)[_0xa757('0x16')]();};}function respondWithResult(_0x513b1f,_0x481508){_0x481508=_0x481508||0xc8;return function(_0x32112b){if(_0x32112b){return _0x513b1f[_0xa757('0x17')](_0x481508)[_0xa757('0x18')](_0x32112b);}};}function respondWithFilteredResult(_0x4a0c38,_0x86abd){return function(_0x31cfd2){if(_0x31cfd2){var _0xf12b68=_0x31cfd2['count'],_0x2f7947=_0x86abd[_0xa757('0x19')],_0x185011=_0x86abd[_0xa757('0x19')]+_0x86abd[_0xa757('0x1a')],_0x3df1f9;if(_0x185011>=_0xf12b68){_0x185011=_0xf12b68;_0x3df1f9=0xc8;}else{_0x3df1f9=0xce;}_0x4a0c38['status'](_0x3df1f9);return _0x4a0c38['set'](_0xa757('0x1b'),_0x2f7947+'-'+_0x185011+'/'+_0xf12b68)[_0xa757('0x18')](_0x31cfd2);}return null;};}function patchUpdates(_0x1bd14c){return function(_0x340599){try{jsonpatch[_0xa757('0x1c')](_0x340599,_0x1bd14c,!![]);}catch(_0xe2d567){return BPromise['reject'](_0xe2d567);}return _0x340599[_0xa757('0x1d')]();};}function saveUpdates(_0x4fec52,_0x32c2a1){return function(_0x167640){if(_0x167640){return _0x167640[_0xa757('0x1e')](_0x4fec52)[_0xa757('0x1f')](function(_0x4d598c){return _0x4d598c;});}return null;};}function removeEntity(_0x5638c7,_0x40ec48){return function(_0x2159cf){if(_0x2159cf){return _0x2159cf[_0xa757('0x20')]()[_0xa757('0x1f')](function(){_0x5638c7[_0xa757('0x17')](0xcc)[_0xa757('0x16')]();});}};}function handleEntityNotFound(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(!_0x2bf276){_0x2ca10d['sendStatus'](0x194);}return _0x2bf276;};}function handleError(_0x3707c1,_0x59e9d4){_0x59e9d4=_0x59e9d4||0x1f4;return function(_0x422e9e){logger['error'](_0x422e9e[_0xa757('0x21')]);if(_0x422e9e[_0xa757('0x22')]){delete _0x422e9e[_0xa757('0x22')];}_0x3707c1['status'](_0x59e9d4)[_0xa757('0x23')](_0x422e9e);};}exports[_0xa757('0x24')]=function(_0x471e84,_0x3bf7f3){var _0x5b4779={},_0x449a7d={},_0x54263b={'count':0x0,'rows':[]};var _0x5a5664=_['map'](db['ChatQueueReport'][_0xa757('0x25')],function(_0x596ae2){return{'name':_0x596ae2[_0xa757('0x26')],'type':_0x596ae2[_0xa757('0x27')]['key']};});_0x449a7d[_0xa757('0x28')]=_['map'](_0x5a5664,_0xa757('0x22'));_0x449a7d[_0xa757('0x29')]=_['keys'](_0x471e84[_0xa757('0x29')]);_0x449a7d['filters']=_[_0xa757('0x2a')](_0x449a7d[_0xa757('0x28')],_0x449a7d[_0xa757('0x29')]);_0x5b4779[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x449a7d[_0xa757('0x28')],qs[_0xa757('0x2c')](_0x471e84[_0xa757('0x29')][_0xa757('0x2c')]));_0x5b4779[_0xa757('0x2b')]=_0x5b4779[_0xa757('0x2b')][_0xa757('0x2d')]?_0x5b4779[_0xa757('0x2b')]:_0x449a7d[_0xa757('0x28')];if(!_0x471e84[_0xa757('0x29')][_0xa757('0x2e')](_0xa757('0x2f'))){_0x5b4779[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x471e84[_0xa757('0x29')][_0xa757('0x1a')]);_0x5b4779[_0xa757('0x19')]=qs[_0xa757('0x19')](_0x471e84[_0xa757('0x29')]['offset']);}_0x5b4779[_0xa757('0x30')]=qs[_0xa757('0x31')](_0x471e84[_0xa757('0x29')][_0xa757('0x31')]);_0x5b4779[_0xa757('0x32')]=qs['filters'](_[_0xa757('0x33')](_0x471e84[_0xa757('0x29')],_0x449a7d[_0xa757('0x34')]),_0x5a5664);if(_0x471e84[_0xa757('0x29')][_0xa757('0x35')]){_0x5b4779[_0xa757('0x32')]=_['merge'](_0x5b4779[_0xa757('0x32')],{'$or':_[_0xa757('0x36')](_0x5a5664,function(_0x2cade7){if(_0x2cade7[_0xa757('0x27')]!==_0xa757('0x37')){var _0x111cfe={};_0x111cfe[_0x2cade7[_0xa757('0x22')]]={'$like':'%'+_0x471e84[_0xa757('0x29')][_0xa757('0x35')]+'%'};return _0x111cfe;}})});}_0x5b4779=_['merge']({},_0x5b4779,_0x471e84[_0xa757('0x38')]);var _0x34fba8={'where':_0x5b4779[_0xa757('0x32')]};return db[_0xa757('0x39')][_0xa757('0x3a')](_0x34fba8)[_0xa757('0x1f')](function(_0x501e26){_0x54263b[_0xa757('0x3a')]=_0x501e26;if(_0x471e84[_0xa757('0x29')]['includeAll']){_0x5b4779['include']=[{'all':!![]}];}return db[_0xa757('0x39')][_0xa757('0x3b')](_0x5b4779);})['then'](function(_0x51c3d1){_0x54263b[_0xa757('0x3c')]=_0x51c3d1;return _0x54263b;})[_0xa757('0x1f')](respondWithFilteredResult(_0x3bf7f3,_0x5b4779))[_0xa757('0x3d')](handleError(_0x3bf7f3,null));};exports['show']=function(_0x830dc4,_0x13a8f4){var _0x26802c={'raw':!![],'where':{'id':_0x830dc4[_0xa757('0x3e')]['id']}},_0x1ba399={};_0x1ba399['model']=_[_0xa757('0x3f')](db['ChatQueueReport']['rawAttributes']);_0x1ba399[_0xa757('0x29')]=_[_0xa757('0x3f')](_0x830dc4[_0xa757('0x29')]);_0x1ba399[_0xa757('0x34')]=_[_0xa757('0x2a')](_0x1ba399['model'],_0x1ba399['query']);_0x26802c[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x1ba399[_0xa757('0x28')],qs[_0xa757('0x2c')](_0x830dc4[_0xa757('0x29')][_0xa757('0x2c')]));_0x26802c['attributes']=_0x26802c[_0xa757('0x2b')][_0xa757('0x2d')]?_0x26802c['attributes']:_0x1ba399[_0xa757('0x28')];if(_0x830dc4['query'][_0xa757('0x40')]){_0x26802c[_0xa757('0x41')]=[{'all':!![]}];}_0x26802c=_['merge']({},_0x26802c,_0x830dc4[_0xa757('0x38')]);return db[_0xa757('0x39')]['find'](_0x26802c)[_0xa757('0x1f')](handleEntityNotFound(_0x13a8f4,null))[_0xa757('0x1f')](respondWithResult(_0x13a8f4,null))[_0xa757('0x3d')](handleError(_0x13a8f4,null));};exports[_0xa757('0x42')]=function(_0x543b5b,_0x199dc9){return db[_0xa757('0x39')][_0xa757('0x42')](_0x543b5b[_0xa757('0x43')],{})['then'](respondWithResult(_0x199dc9,0xc9))[_0xa757('0x3d')](handleError(_0x199dc9,null));};exports['update']=function(_0x50c131,_0x2acf88){if(_0x50c131[_0xa757('0x43')]['id']){delete _0x50c131[_0xa757('0x43')]['id'];}return db['ChatQueueReport'][_0xa757('0x44')]({'where':{'id':_0x50c131['params']['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x2acf88,null))[_0xa757('0x1f')](saveUpdates(_0x50c131[_0xa757('0x43')],null))[_0xa757('0x1f')](respondWithResult(_0x2acf88,null))[_0xa757('0x3d')](handleError(_0x2acf88,null));};exports[_0xa757('0x20')]=function(_0x57bf73,_0x505cd){return db['ChatQueueReport'][_0xa757('0x44')]({'where':{'id':_0x57bf73[_0xa757('0x3e')]['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x505cd,null))[_0xa757('0x1f')](removeEntity(_0x505cd,null))[_0xa757('0x3d')](handleError(_0x505cd,null));};exports[_0xa757('0x45')]=function(_0x15bad7,_0x2c5b3c){return db[_0xa757('0x39')][_0xa757('0x45')]()[_0xa757('0x1f')](respondWithResult(_0x2c5b3c,null))[_0xa757('0x3d')](handleError(_0x2c5b3c,null));}; \ No newline at end of file +var _0xcb91=['options','includeAll','include','findAll','params','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','ChatQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge'];(function(_0x19f103,_0xf56bc6){var _0x543133=function(_0x2d73fd){while(--_0x2d73fd){_0x19f103['push'](_0x19f103['shift']());}};_0x543133(++_0xf56bc6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x102977,_0x3a99a6){_0x102977=_0x102977-0x0;var _0x15c466=_0xcb91[_0x102977];return _0x15c466;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['index']=function(_0xd6891c,_0x21effa){var _0x41a9a0={},_0x1804fd={},_0x406821={'count':0x0,'rows':[]};var _0x21d6f5=_[_0x1cb9('0x26')](db[_0x1cb9('0x27')][_0x1cb9('0x28')],function(_0x9de64b){return{'name':_0x9de64b['fieldName'],'type':_0x9de64b[_0x1cb9('0x29')]['key']};});_0x1804fd[_0x1cb9('0x2a')]=_['map'](_0x21d6f5,_0x1cb9('0x24'));_0x1804fd[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2d')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x1804fd['model'],qs[_0x1cb9('0x2f')](_0xd6891c['query'][_0x1cb9('0x2f')]));_0x41a9a0['attributes']=_0x41a9a0[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x41a9a0[_0x1cb9('0x2e')]:_0x1804fd[_0x1cb9('0x2a')];if(!_0xd6891c['query'][_0x1cb9('0x31')](_0x1cb9('0x32'))){_0x41a9a0[_0x1cb9('0x1b')]=qs[_0x1cb9('0x1b')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1b')]);_0x41a9a0[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1a')]);}_0x41a9a0[_0x1cb9('0x33')]=qs[_0x1cb9('0x34')](_0xd6891c[_0x1cb9('0x2b')]['sort']);_0x41a9a0['where']=qs[_0x1cb9('0x35')](_[_0x1cb9('0x36')](_0xd6891c[_0x1cb9('0x2b')],_0x1804fd[_0x1cb9('0x35')]),_0x21d6f5);if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x37')]){_0x41a9a0[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x41a9a0['where'],{'$or':_[_0x1cb9('0x26')](_0x21d6f5,function(_0x1482c4){if(_0x1482c4[_0x1cb9('0x29')]!=='VIRTUAL'){var _0x2a5aac={};_0x2a5aac[_0x1482c4['name']]={'$like':'%'+_0xd6891c[_0x1cb9('0x2b')]['filter']+'%'};return _0x2a5aac;}})});}_0x41a9a0=_[_0x1cb9('0x39')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x3a')]);var _0x289b73={'where':_0x41a9a0[_0x1cb9('0x38')]};return db[_0x1cb9('0x27')][_0x1cb9('0x19')](_0x289b73)[_0x1cb9('0x1f')](function(_0x4a4788){_0x406821['count']=_0x4a4788;if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x3b')]){_0x41a9a0[_0x1cb9('0x3c')]=[{'all':!![]}];}return db[_0x1cb9('0x27')][_0x1cb9('0x3d')](_0x41a9a0);})[_0x1cb9('0x1f')](function(_0x32130b){_0x406821['rows']=_0x32130b;return _0x406821;})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x21effa,_0x41a9a0))['catch'](handleError(_0x21effa,null));};exports['show']=function(_0x4c6c75,_0x409c62){var _0x397ff9={'raw':!![],'where':{'id':_0x4c6c75[_0x1cb9('0x3e')]['id']}},_0x1bf51c={};_0x1bf51c[_0x1cb9('0x2a')]=_['keys'](db[_0x1cb9('0x27')]['rawAttributes']);_0x1bf51c[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0x4c6c75[_0x1cb9('0x2b')]);_0x1bf51c['filters']=_[_0x1cb9('0x2d')](_0x1bf51c['model'],_0x1bf51c[_0x1cb9('0x2b')]);_0x397ff9[_0x1cb9('0x2e')]=_['intersection'](_0x1bf51c['model'],qs[_0x1cb9('0x2f')](_0x4c6c75[_0x1cb9('0x2b')][_0x1cb9('0x2f')]));_0x397ff9[_0x1cb9('0x2e')]=_0x397ff9[_0x1cb9('0x2e')]['length']?_0x397ff9[_0x1cb9('0x2e')]:_0x1bf51c['model'];if(_0x4c6c75['query']['includeAll']){_0x397ff9[_0x1cb9('0x3c')]=[{'all':!![]}];}_0x397ff9=_[_0x1cb9('0x39')]({},_0x397ff9,_0x4c6c75[_0x1cb9('0x3a')]);return db[_0x1cb9('0x27')][_0x1cb9('0x3f')](_0x397ff9)[_0x1cb9('0x1f')](handleEntityNotFound(_0x409c62,null))[_0x1cb9('0x1f')](respondWithResult(_0x409c62,null))[_0x1cb9('0x40')](handleError(_0x409c62,null));};exports[_0x1cb9('0x41')]=function(_0x148a01,_0x3ea88c){return db['ChatQueueReport'][_0x1cb9('0x41')](_0x148a01[_0x1cb9('0x42')],{})[_0x1cb9('0x1f')](respondWithResult(_0x3ea88c,0xc9))['catch'](handleError(_0x3ea88c,null));};exports[_0x1cb9('0x43')]=function(_0x57251,_0x3c6044){if(_0x57251[_0x1cb9('0x42')]['id']){delete _0x57251[_0x1cb9('0x42')]['id'];}return db['ChatQueueReport'][_0x1cb9('0x3f')]({'where':{'id':_0x57251['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x3c6044,null))['then'](saveUpdates(_0x57251[_0x1cb9('0x42')],null))[_0x1cb9('0x1f')](respondWithResult(_0x3c6044,null))[_0x1cb9('0x40')](handleError(_0x3c6044,null));};exports[_0x1cb9('0x20')]=function(_0x56d0c5,_0x298475){return db[_0x1cb9('0x27')][_0x1cb9('0x3f')]({'where':{'id':_0x56d0c5[_0x1cb9('0x3e')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x298475,null))[_0x1cb9('0x1f')](removeEntity(_0x298475,null))[_0x1cb9('0x40')](handleError(_0x298475,null));};exports[_0x1cb9('0x44')]=function(_0xbb500e,_0x17f10e){return db['ChatQueueReport']['describe']()[_0x1cb9('0x1f')](respondWithResult(_0x17f10e,null))[_0x1cb9('0x40')](handleError(_0x17f10e,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 10f0104..01048f2 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 _0xd66e=['../../config/environment','./chatQueueReport.attributes','define','report_chat_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x17ef39,_0x124979){var _0x4c33d9=function(_0x31d81c){while(--_0x31d81c){_0x17ef39['push'](_0x17ef39['shift']());}};_0x4c33d9(++_0x124979);}(_0xd66e,0x171));var _0xed66=function(_0x267c52,_0x3c0df3){_0x267c52=_0x267c52-0x0;var _0x46c47b=_0xd66e[_0x267c52];return _0x46c47b;};'use strict';var _=require(_0xed66('0x0'));var util=require(_0xed66('0x1'));var logger=require('../../config/logger')(_0xed66('0x2'));var moment=require(_0xed66('0x3'));var BPromise=require(_0xed66('0x4'));var rp=require(_0xed66('0x5'));var fs=require('fs');var path=require(_0xed66('0x6'));var rimraf=require(_0xed66('0x7'));var config=require(_0xed66('0x8'));var attributes=require(_0xed66('0x9'));module['exports']=function(_0x11853d,_0x337468){return _0x11853d[_0xed66('0xa')]('ChatQueueReport',attributes,{'tableName':_0xed66('0xb'),'paranoid':![],'indexes':[{'name':_0xed66('0xc'),'fields':[_0xed66('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e3e=['moment','bluebird','request-promise','path','../../config/environment','./chatQueueReport.attributes','exports','ChatQueueReport','util','../../config/logger','api'];(function(_0x57e7f3,_0x208fb0){var _0x28a1c5=function(_0xe301a4){while(--_0xe301a4){_0x57e7f3['push'](_0x57e7f3['shift']());}};_0x28a1c5(++_0x208fb0);}(_0x1e3e,0xfa));var _0xe1e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1e3e[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xe1e3('0x0'));var logger=require(_0xe1e3('0x1'))(_0xe1e3('0x2'));var moment=require(_0xe1e3('0x3'));var BPromise=require(_0xe1e3('0x4'));var rp=require(_0xe1e3('0x5'));var fs=require('fs');var path=require(_0xe1e3('0x6'));var rimraf=require('rimraf');var config=require(_0xe1e3('0x7'));var attributes=require(_0xe1e3('0x8'));module[_0xe1e3('0x9')]=function(_0x21f80e,_0x18f17f){return _0x21f80e['define'](_0xe1e3('0xa'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':'uniqueid','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 a2b43c8..d1091b7 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 _0x4ddd=['result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x51bca3,_0x4d538f){var _0x522da4=function(_0x21e301){while(--_0x21e301){_0x51bca3['push'](_0x51bca3['shift']());}};_0x522da4(++_0x4d538f);}(_0x4ddd,0x1d3));var _0xd4dd=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x4ddd[_0xa9a245];return _0x2d0eaa;};'use strict';var _=require(_0xd4dd('0x0'));var util=require(_0xd4dd('0x1'));var moment=require(_0xd4dd('0x2'));var BPromise=require(_0xd4dd('0x3'));var rs=require(_0xd4dd('0x4'));var fs=require('fs');var Redis=require(_0xd4dd('0x5'));var db=require(_0xd4dd('0x6'))['db'];var utils=require(_0xd4dd('0x7'));var logger=require('../../config/logger')(_0xd4dd('0x8'));var config=require('../../config/environment');var jayson=require(_0xd4dd('0x9'));var client=jayson[_0xd4dd('0xa')][_0xd4dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10eb26,_0x5d3446,_0x3df8f9){return new BPromise(function(_0x240f38,_0x4edf18){return client[_0xd4dd('0xc')](_0x10eb26,_0x3df8f9)[_0xd4dd('0xd')](function(_0x1f5cef){logger[_0xd4dd('0xe')](_0xd4dd('0xf'),_0x5d3446,_0xd4dd('0x10'));logger[_0xd4dd('0x11')](_0xd4dd('0x12'),_0x5d3446,'request\x20sent',JSON[_0xd4dd('0x13')](_0x1f5cef));if(_0x1f5cef['error']){if(_0x1f5cef[_0xd4dd('0x14')][_0xd4dd('0x15')]===0x1f4){logger[_0xd4dd('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x5d3446,_0x1f5cef[_0xd4dd('0x14')][_0xd4dd('0x16')]);return _0x4edf18(_0x1f5cef['error'][_0xd4dd('0x16')]);}logger['error'](_0xd4dd('0xf'),_0x5d3446,_0x1f5cef['error'][_0xd4dd('0x16')]);return _0x240f38(_0x1f5cef['error'][_0xd4dd('0x16')]);}else{logger['info'](_0xd4dd('0xf'),_0x5d3446,_0xd4dd('0x10'));_0x240f38(_0x1f5cef[_0xd4dd('0x17')][_0xd4dd('0x16')]);}})[_0xd4dd('0x18')](function(_0x635d02){logger[_0xd4dd('0x14')](_0xd4dd('0xf'),_0x5d3446,_0x635d02);_0x4edf18(_0x635d02);});});}exports[_0xd4dd('0x19')]=function(_0x21a400){var _0x279ee2=this;return new Promise(function(_0x56aec7,_0x4b50ee){return db[_0xd4dd('0x1a')][_0xd4dd('0x1b')](_0x21a400[_0xd4dd('0x1c')],{'raw':_0x21a400['options']?_0x21a400[_0xd4dd('0x1d')][_0xd4dd('0x1e')]===undefined?!![]:![]:!![]})[_0xd4dd('0xd')](function(_0x5bc5f6){logger[_0xd4dd('0xe')](_0xd4dd('0x19'),_0x21a400);logger[_0xd4dd('0x11')](_0xd4dd('0x19'),_0x21a400,JSON[_0xd4dd('0x13')](_0x5bc5f6));_0x56aec7(_0x5bc5f6);})[_0xd4dd('0x18')](function(_0x447af8){logger[_0xd4dd('0x14')]('CreateChatQueueReport',_0x447af8['message'],_0x21a400);_0x4b50ee(_0x279ee2[_0xd4dd('0x14')](0x1f4,_0x447af8[_0xd4dd('0x16')]));});});};exports[_0xd4dd('0x1f')]=function(_0x3998ba){var _0x4d9bc6=this;return new Promise(function(_0x3be51f,_0x2fc3d0){return db['ChatQueueReport']['update'](_0x3998ba[_0xd4dd('0x1c')],{'raw':_0x3998ba['options']?_0x3998ba['options'][_0xd4dd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3998ba[_0xd4dd('0x1d')]?_0x3998ba[_0xd4dd('0x1d')][_0xd4dd('0x20')]||null:null,'attributes':_0x3998ba[_0xd4dd('0x1d')]?_0x3998ba[_0xd4dd('0x1d')][_0xd4dd('0x21')]||null:null,'limit':_0x3998ba[_0xd4dd('0x1d')]?_0x3998ba[_0xd4dd('0x1d')][_0xd4dd('0x22')]||null:null})[_0xd4dd('0xd')](function(_0x17105c){logger[_0xd4dd('0xe')](_0xd4dd('0x1f'),_0x3998ba);logger[_0xd4dd('0x11')](_0xd4dd('0x1f'),_0x3998ba,JSON[_0xd4dd('0x13')](_0x17105c));_0x3be51f(_0x17105c);})[_0xd4dd('0x18')](function(_0x5789a2){logger['error']('UpdateChatQueueReport',_0x5789a2[_0xd4dd('0x16')],_0x3998ba);_0x2fc3d0(_0x4d9bc6[_0xd4dd('0x14')](0x1f4,_0x5789a2[_0xd4dd('0x16')]));});});}; \ No newline at end of file +var _0xf34f=['CreateChatQueueReport','create','options','raw','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0xf34f,0x6b));var _0xff34=function(_0x84801a,_0x45fccc){_0x84801a=_0x84801a-0x0;var _0x3461ea=_0xf34f[_0x84801a];return _0x3461ea;};'use strict';var _=require('lodash');var util=require(_0xff34('0x0'));var moment=require('moment');var BPromise=require(_0xff34('0x1'));var rs=require(_0xff34('0x2'));var fs=require('fs');var Redis=require(_0xff34('0x3'));var db=require(_0xff34('0x4'))['db'];var utils=require(_0xff34('0x5'));var logger=require(_0xff34('0x6'))(_0xff34('0x7'));var config=require(_0xff34('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xff34('0x9')][_0xff34('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17dc18,_0x4e3ce3,_0x3529e9){return new BPromise(function(_0x69eb40,_0x5d2ea4){return client[_0xff34('0xb')](_0x17dc18,_0x3529e9)[_0xff34('0xc')](function(_0x4fd470){logger[_0xff34('0xd')](_0xff34('0xe'),_0x4e3ce3,'request\x20sent');logger[_0xff34('0xf')](_0xff34('0x10'),_0x4e3ce3,'request\x20sent',JSON[_0xff34('0x11')](_0x4fd470));if(_0x4fd470[_0xff34('0x12')]){if(_0x4fd470[_0xff34('0x12')]['code']===0x1f4){logger[_0xff34('0x12')](_0xff34('0xe'),_0x4e3ce3,_0x4fd470[_0xff34('0x12')][_0xff34('0x13')]);return _0x5d2ea4(_0x4fd470[_0xff34('0x12')][_0xff34('0x13')]);}logger[_0xff34('0x12')](_0xff34('0xe'),_0x4e3ce3,_0x4fd470[_0xff34('0x12')]['message']);return _0x69eb40(_0x4fd470[_0xff34('0x12')][_0xff34('0x13')]);}else{logger[_0xff34('0xd')](_0xff34('0xe'),_0x4e3ce3,'request\x20sent');_0x69eb40(_0x4fd470[_0xff34('0x14')][_0xff34('0x13')]);}})['catch'](function(_0xbb37ff){logger['error'](_0xff34('0xe'),_0x4e3ce3,_0xbb37ff);_0x5d2ea4(_0xbb37ff);});});}exports[_0xff34('0x15')]=function(_0x50bb3a){var _0x3f1397=this;return new Promise(function(_0x507ba3,_0x2635ae){return db['ChatQueueReport'][_0xff34('0x16')](_0x50bb3a['body'],{'raw':_0x50bb3a['options']?_0x50bb3a[_0xff34('0x17')][_0xff34('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0xbcc486){logger['info']('CreateChatQueueReport',_0x50bb3a);logger[_0xff34('0xf')](_0xff34('0x15'),_0x50bb3a,JSON[_0xff34('0x11')](_0xbcc486));_0x507ba3(_0xbcc486);})['catch'](function(_0x4e0037){logger[_0xff34('0x12')](_0xff34('0x15'),_0x4e0037[_0xff34('0x13')],_0x50bb3a);_0x2635ae(_0x3f1397['error'](0x1f4,_0x4e0037['message']));});});};exports[_0xff34('0x19')]=function(_0x4eb14e){var _0x7f37a3=this;return new Promise(function(_0x5b5232,_0x496382){return db[_0xff34('0x1a')][_0xff34('0x1b')](_0x4eb14e['body'],{'raw':_0x4eb14e[_0xff34('0x17')]?_0x4eb14e[_0xff34('0x17')][_0xff34('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4eb14e[_0xff34('0x17')]?_0x4eb14e['options'][_0xff34('0x1c')]||null:null,'attributes':_0x4eb14e[_0xff34('0x17')]?_0x4eb14e['options'][_0xff34('0x1d')]||null:null,'limit':_0x4eb14e[_0xff34('0x17')]?_0x4eb14e['options'][_0xff34('0x1e')]||null:null})[_0xff34('0xc')](function(_0x279e66){logger[_0xff34('0xd')](_0xff34('0x19'),_0x4eb14e);logger['debug'](_0xff34('0x19'),_0x4eb14e,JSON[_0xff34('0x11')](_0x279e66));_0x5b5232(_0x279e66);})[_0xff34('0x1f')](function(_0x19c837){logger['error'](_0xff34('0x19'),_0x19c837[_0xff34('0x13')],_0x4eb14e);_0x496382(_0x7f37a3['error'](0x1f4,_0x19c837['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index b6986f1..699b29c 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 _0xf0fc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','util','path','connect-timeout','express'];(function(_0xb54e3a,_0x53210b){var _0x44ecbe=function(_0x486af3){while(--_0x486af3){_0xb54e3a['push'](_0xb54e3a['shift']());}};_0x44ecbe(++_0x53210b);}(_0xf0fc,0x68));var _0xcf0f=function(_0x967abd,_0x55e888){_0x967abd=_0x967abd-0x0;var _0x533f1a=_0xf0fc[_0x967abd];return _0x533f1a;};'use strict';var multer=require('multer');var util=require(_0xcf0f('0x0'));var path=require(_0xcf0f('0x1'));var timeout=require(_0xcf0f('0x2'));var express=require(_0xcf0f('0x3'));var router=express['Router']();var auth=require(_0xcf0f('0x4'));var interaction=require(_0xcf0f('0x5'));var config=require(_0xcf0f('0x6'));var controller=require(_0xcf0f('0x7'));router[_0xcf0f('0x8')]('/',auth[_0xcf0f('0x9')](),controller[_0xcf0f('0xa')]);router[_0xcf0f('0x8')](_0xcf0f('0xb'),auth[_0xcf0f('0x9')](),controller[_0xcf0f('0xc')]);router[_0xcf0f('0x8')](_0xcf0f('0xd'),auth[_0xcf0f('0x9')](),controller[_0xcf0f('0xe')]);router['post']('/',auth[_0xcf0f('0x9')](),controller[_0xcf0f('0xf')]);router['put'](_0xcf0f('0xd'),auth[_0xcf0f('0x9')](),controller[_0xcf0f('0x10')]);router[_0xcf0f('0x11')](_0xcf0f('0xd'),auth[_0xcf0f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd88e=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout'];(function(_0x14e0a6,_0x51a319){var _0x5f21f9=function(_0x48d33d){while(--_0x48d33d){_0x14e0a6['push'](_0x14e0a6['shift']());}};_0x5f21f9(++_0x51a319);}(_0xd88e,0x14d));var _0xed88=function(_0x15b64a,_0x231453){_0x15b64a=_0x15b64a-0x0;var _0x33b57d=_0xd88e[_0x15b64a];return _0x33b57d;};'use strict';var multer=require(_0xed88('0x0'));var util=require('util');var path=require(_0xed88('0x1'));var timeout=require(_0xed88('0x2'));var express=require(_0xed88('0x3'));var router=express['Router']();var auth=require(_0xed88('0x4'));var interaction=require(_0xed88('0x5'));var config=require(_0xed88('0x6'));var controller=require(_0xed88('0x7'));router[_0xed88('0x8')]('/',auth[_0xed88('0x9')](),controller[_0xed88('0xa')]);router['get'](_0xed88('0xb'),auth['isAuthenticated'](),controller[_0xed88('0xc')]);router[_0xed88('0x8')](_0xed88('0xd'),auth[_0xed88('0x9')](),controller[_0xed88('0xe')]);router[_0xed88('0xf')]('/',auth[_0xed88('0x9')](),controller[_0xed88('0x10')]);router[_0xed88('0x11')](_0xed88('0xd'),auth[_0xed88('0x9')](),controller[_0xed88('0x12')]);router[_0xed88('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xed88('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 03ca65b..8c2266b 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 _0x37fe=['account','queue','DATE','NOW','exports','STRING','ENUM'];(function(_0x70f299,_0x35907f){var _0x292933=function(_0x3be6e3){while(--_0x3be6e3){_0x70f299['push'](_0x70f299['shift']());}};_0x292933(++_0x35907f);}(_0x37fe,0x138));var _0xe37f=function(_0x25d085,_0x40cebf){_0x25d085=_0x25d085-0x0;var _0x112d9d=_0x37fe[_0x25d085];return _0x112d9d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe37f('0x0')]={'uniqueid':{'type':Sequelize[_0xe37f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe37f('0x2')](_0xe37f('0x3'),'agent','queue'),'allowNull':![],'defaultValue':_0xe37f('0x4')},'transferredAt':{'type':Sequelize[_0xe37f('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe37f('0x6')]}}; \ No newline at end of file +var _0x6e21=['account','agent','queue','DATE','NOW','moment','sequelize','exports','ENUM'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x6e21,0x16d));var _0x16e2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6e21[_0x2c91e9];return _0x13f0ff;};'use strict';var moment=require(_0x16e2('0x0'));var Sequelize=require(_0x16e2('0x1'));module[_0x16e2('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x16e2('0x3')](_0x16e2('0x4'),_0x16e2('0x5'),_0x16e2('0x6')),'allowNull':![],'defaultValue':_0x16e2('0x6')},'transferredAt':{'type':Sequelize[_0x16e2('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x16e2('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index dc93863..e46d33a 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 _0x266c=['../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','ChatTransferReport','findAll','rows','catch','params','rawAttributes','length','includeAll','create','body','find','describe','html-pdf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x1139d0,_0x41e5f8){var _0xcc01a6=function(_0x504ffa){while(--_0x504ffa){_0x1139d0['push'](_0x1139d0['shift']());}};_0xcc01a6(++_0x41e5f8);}(_0x266c,0x155));var _0xc266=function(_0x20d15c,_0x2ca902){_0x20d15c=_0x20d15c-0x0;var _0x17d594=_0x266c[_0x20d15c];return _0x17d594;};'use strict';var pdf=require(_0xc266('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc266('0x1'));var jsonpatch=require(_0xc266('0x2'));var rp=require('request-promise');var moment=require(_0xc266('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc266('0x4'));var util=require(_0xc266('0x5'));var path=require(_0xc266('0x6'));var sox=require(_0xc266('0x7'));var csv=require(_0xc266('0x8'));var ejs=require(_0xc266('0x9'));var fs=require('fs');var _=require(_0xc266('0xa'));var squel=require(_0xc266('0xb'));var crypto=require(_0xc266('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc266('0x8'));var querystring=require(_0xc266('0xd'));var Papa=require(_0xc266('0xe'));var Redis=require(_0xc266('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc266('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc266('0x11'))(_0xc266('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc266('0x13'))['db'];function respondWithStatusCode(_0x186f4c,_0x5da987){_0x5da987=_0x5da987||0xcc;return function(_0x50af60){if(_0x50af60){return _0x186f4c[_0xc266('0x14')](_0x5da987);}return _0x186f4c['status'](_0x5da987)['end']();};}function respondWithResult(_0x2b4cbe,_0x14f78e){_0x14f78e=_0x14f78e||0xc8;return function(_0x10a869){if(_0x10a869){return _0x2b4cbe[_0xc266('0x15')](_0x14f78e)[_0xc266('0x16')](_0x10a869);}};}function respondWithFilteredResult(_0x3d47b7,_0x413d0e){return function(_0x841f40){if(_0x841f40){var _0x24872c=_0x841f40[_0xc266('0x17')],_0x41da79=_0x413d0e[_0xc266('0x18')],_0x56b584=_0x413d0e[_0xc266('0x18')]+_0x413d0e[_0xc266('0x19')],_0x5122e9;if(_0x56b584>=_0x24872c){_0x56b584=_0x24872c;_0x5122e9=0xc8;}else{_0x5122e9=0xce;}_0x3d47b7[_0xc266('0x15')](_0x5122e9);return _0x3d47b7[_0xc266('0x1a')](_0xc266('0x1b'),_0x41da79+'-'+_0x56b584+'/'+_0x24872c)['json'](_0x841f40);}return null;};}function patchUpdates(_0x3ea7d9){return function(_0x19bacb){try{jsonpatch[_0xc266('0x1c')](_0x19bacb,_0x3ea7d9,!![]);}catch(_0x255f32){return BPromise[_0xc266('0x1d')](_0x255f32);}return _0x19bacb[_0xc266('0x1e')]();};}function saveUpdates(_0x4ec57e,_0x4d2872){return function(_0x194cc7){if(_0x194cc7){return _0x194cc7[_0xc266('0x1f')](_0x4ec57e)[_0xc266('0x20')](function(_0x212847){return _0x212847;});}return null;};}function removeEntity(_0x29ee99,_0x5eeb63){return function(_0x35ea52){if(_0x35ea52){return _0x35ea52['destroy']()[_0xc266('0x20')](function(){_0x29ee99[_0xc266('0x15')](0xcc)[_0xc266('0x21')]();});}};}function handleEntityNotFound(_0x17746c,_0x247db8){return function(_0x58353c){if(!_0x58353c){_0x17746c[_0xc266('0x14')](0x194);}return _0x58353c;};}function handleError(_0x849bfe,_0x2d78c5){_0x2d78c5=_0x2d78c5||0x1f4;return function(_0x539505){logger[_0xc266('0x22')](_0x539505[_0xc266('0x23')]);if(_0x539505[_0xc266('0x24')]){delete _0x539505[_0xc266('0x24')];}_0x849bfe['status'](_0x2d78c5)[_0xc266('0x25')](_0x539505);};}exports[_0xc266('0x26')]=function(_0x207a30,_0x3a09ed){var _0x5af9b7={},_0x32171e={},_0x46f7c3={'count':0x0,'rows':[]};var _0x594ffe=_[_0xc266('0x27')](db['ChatTransferReport']['rawAttributes'],function(_0x422988){return{'name':_0x422988[_0xc266('0x28')],'type':_0x422988[_0xc266('0x29')][_0xc266('0x2a')]};});_0x32171e[_0xc266('0x2b')]=_[_0xc266('0x27')](_0x594ffe,_0xc266('0x24'));_0x32171e[_0xc266('0x2c')]=_[_0xc266('0x2d')](_0x207a30[_0xc266('0x2c')]);_0x32171e[_0xc266('0x2e')]=_[_0xc266('0x2f')](_0x32171e[_0xc266('0x2b')],_0x32171e['query']);_0x5af9b7[_0xc266('0x30')]=_[_0xc266('0x2f')](_0x32171e['model'],qs[_0xc266('0x31')](_0x207a30['query'][_0xc266('0x31')]));_0x5af9b7[_0xc266('0x30')]=_0x5af9b7[_0xc266('0x30')]['length']?_0x5af9b7[_0xc266('0x30')]:_0x32171e[_0xc266('0x2b')];if(!_0x207a30[_0xc266('0x2c')][_0xc266('0x32')](_0xc266('0x33'))){_0x5af9b7[_0xc266('0x19')]=qs['limit'](_0x207a30[_0xc266('0x2c')][_0xc266('0x19')]);_0x5af9b7['offset']=qs[_0xc266('0x18')](_0x207a30[_0xc266('0x2c')][_0xc266('0x18')]);}_0x5af9b7[_0xc266('0x34')]=qs[_0xc266('0x35')](_0x207a30[_0xc266('0x2c')][_0xc266('0x35')]);_0x5af9b7[_0xc266('0x36')]=qs[_0xc266('0x2e')](_[_0xc266('0x37')](_0x207a30[_0xc266('0x2c')],_0x32171e['filters']),_0x594ffe);if(_0x207a30['query']['filter']){_0x5af9b7['where']=_[_0xc266('0x38')](_0x5af9b7[_0xc266('0x36')],{'$or':_['map'](_0x594ffe,function(_0x4c893a){if(_0x4c893a[_0xc266('0x29')]!==_0xc266('0x39')){var _0x52ded8={};_0x52ded8[_0x4c893a[_0xc266('0x24')]]={'$like':'%'+_0x207a30['query']['filter']+'%'};return _0x52ded8;}})});}_0x5af9b7=_[_0xc266('0x38')]({},_0x5af9b7,_0x207a30[_0xc266('0x3a')]);var _0x31220c={'where':_0x5af9b7[_0xc266('0x36')]};return db['ChatTransferReport']['count'](_0x31220c)[_0xc266('0x20')](function(_0x2d43c1){_0x46f7c3[_0xc266('0x17')]=_0x2d43c1;if(_0x207a30[_0xc266('0x2c')]['includeAll']){_0x5af9b7[_0xc266('0x3b')]=[{'all':!![]}];}return db[_0xc266('0x3c')][_0xc266('0x3d')](_0x5af9b7);})[_0xc266('0x20')](function(_0x43b627){_0x46f7c3[_0xc266('0x3e')]=_0x43b627;return _0x46f7c3;})['then'](respondWithFilteredResult(_0x3a09ed,_0x5af9b7))[_0xc266('0x3f')](handleError(_0x3a09ed,null));};exports['show']=function(_0x15655a,_0x255129){var _0x355eac={'raw':!![],'where':{'id':_0x15655a[_0xc266('0x40')]['id']}},_0x31cf7a={};_0x31cf7a[_0xc266('0x2b')]=_['keys'](db[_0xc266('0x3c')][_0xc266('0x41')]);_0x31cf7a['query']=_[_0xc266('0x2d')](_0x15655a[_0xc266('0x2c')]);_0x31cf7a[_0xc266('0x2e')]=_[_0xc266('0x2f')](_0x31cf7a[_0xc266('0x2b')],_0x31cf7a[_0xc266('0x2c')]);_0x355eac['attributes']=_[_0xc266('0x2f')](_0x31cf7a[_0xc266('0x2b')],qs[_0xc266('0x31')](_0x15655a[_0xc266('0x2c')][_0xc266('0x31')]));_0x355eac[_0xc266('0x30')]=_0x355eac[_0xc266('0x30')][_0xc266('0x42')]?_0x355eac[_0xc266('0x30')]:_0x31cf7a['model'];if(_0x15655a['query'][_0xc266('0x43')]){_0x355eac['include']=[{'all':!![]}];}_0x355eac=_[_0xc266('0x38')]({},_0x355eac,_0x15655a['options']);return db[_0xc266('0x3c')]['find'](_0x355eac)[_0xc266('0x20')](handleEntityNotFound(_0x255129,null))[_0xc266('0x20')](respondWithResult(_0x255129,null))[_0xc266('0x3f')](handleError(_0x255129,null));};exports[_0xc266('0x44')]=function(_0xf6d18f,_0x55a71d){return db[_0xc266('0x3c')][_0xc266('0x44')](_0xf6d18f[_0xc266('0x45')],{})[_0xc266('0x20')](respondWithResult(_0x55a71d,0xc9))['catch'](handleError(_0x55a71d,null));};exports[_0xc266('0x1f')]=function(_0x1fd91b,_0xedab84){if(_0x1fd91b[_0xc266('0x45')]['id']){delete _0x1fd91b[_0xc266('0x45')]['id'];}return db[_0xc266('0x3c')][_0xc266('0x46')]({'where':{'id':_0x1fd91b['params']['id']}})[_0xc266('0x20')](handleEntityNotFound(_0xedab84,null))[_0xc266('0x20')](saveUpdates(_0x1fd91b[_0xc266('0x45')],null))[_0xc266('0x20')](respondWithResult(_0xedab84,null))[_0xc266('0x3f')](handleError(_0xedab84,null));};exports['destroy']=function(_0x25c3f4,_0x24f89d){return db[_0xc266('0x3c')]['find']({'where':{'id':_0x25c3f4[_0xc266('0x40')]['id']}})['then'](handleEntityNotFound(_0x24f89d,null))[_0xc266('0x20')](removeEntity(_0x24f89d,null))[_0xc266('0x3f')](handleError(_0x24f89d,null));};exports[_0xc266('0x47')]=function(_0x5cdec8,_0x417e4f){return db['ChatTransferReport'][_0xc266('0x47')]()[_0xc266('0x20')](respondWithResult(_0x417e4f,null))[_0xc266('0x3f')](handleError(_0x417e4f,null));}; \ No newline at end of file +var _0xc7a1=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','save','update','then','sendStatus','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs'];(function(_0x373f8a,_0x4f9602){var _0x5200eb=function(_0xa8bd5){while(--_0xa8bd5){_0x373f8a['push'](_0x373f8a['shift']());}};_0x5200eb(++_0x4f9602);}(_0xc7a1,0x115));var _0x1c7a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc7a1[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x1c7a('0x0'));var emlformat=require(_0x1c7a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1c7a('0x2'));var jsonpatch=require(_0x1c7a('0x3'));var rp=require(_0x1c7a('0x4'));var moment=require(_0x1c7a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1c7a('0x6'));var util=require(_0x1c7a('0x7'));var path=require('path');var sox=require(_0x1c7a('0x8'));var csv=require(_0x1c7a('0x9'));var ejs=require(_0x1c7a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1c7a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1c7a('0x9'));var querystring=require(_0x1c7a('0xc'));var Papa=require(_0x1c7a('0xd'));var Redis=require(_0x1c7a('0xe'));var authService=require(_0x1c7a('0xf'));var qs=require(_0x1c7a('0x10'));var as=require(_0x1c7a('0x11'));var hardwareService=require(_0x1c7a('0x12'));var logger=require(_0x1c7a('0x13'))('api');var utils=require(_0x1c7a('0x14'));var config=require(_0x1c7a('0x15'));var db=require(_0x1c7a('0x16'))['db'];function respondWithStatusCode(_0x55561f,_0x54d791){_0x54d791=_0x54d791||0xcc;return function(_0x284d97){if(_0x284d97){return _0x55561f['sendStatus'](_0x54d791);}return _0x55561f[_0x1c7a('0x17')](_0x54d791)[_0x1c7a('0x18')]();};}function respondWithResult(_0x1f1137,_0x49871d){_0x49871d=_0x49871d||0xc8;return function(_0x226642){if(_0x226642){return _0x1f1137[_0x1c7a('0x17')](_0x49871d)[_0x1c7a('0x19')](_0x226642);}};}function respondWithFilteredResult(_0x39d14f,_0x1f252c){return function(_0x332e25){if(_0x332e25){var _0x2562ba=_0x332e25[_0x1c7a('0x1a')],_0x47a1eb=_0x1f252c[_0x1c7a('0x1b')],_0x5d80ab=_0x1f252c[_0x1c7a('0x1b')]+_0x1f252c[_0x1c7a('0x1c')],_0x440924;if(_0x5d80ab>=_0x2562ba){_0x5d80ab=_0x2562ba;_0x440924=0xc8;}else{_0x440924=0xce;}_0x39d14f[_0x1c7a('0x17')](_0x440924);return _0x39d14f[_0x1c7a('0x1d')](_0x1c7a('0x1e'),_0x47a1eb+'-'+_0x5d80ab+'/'+_0x2562ba)[_0x1c7a('0x19')](_0x332e25);}return null;};}function patchUpdates(_0x1b0a77){return function(_0x35f498){try{jsonpatch['apply'](_0x35f498,_0x1b0a77,!![]);}catch(_0x5147d){return BPromise['reject'](_0x5147d);}return _0x35f498[_0x1c7a('0x1f')]();};}function saveUpdates(_0x41ebcd,_0x239045){return function(_0x281b6e){if(_0x281b6e){return _0x281b6e[_0x1c7a('0x20')](_0x41ebcd)[_0x1c7a('0x21')](function(_0x5bcda5){return _0x5bcda5;});}return null;};}function removeEntity(_0x14ca1e,_0x355f36){return function(_0x26528e){if(_0x26528e){return _0x26528e['destroy']()[_0x1c7a('0x21')](function(){_0x14ca1e[_0x1c7a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x471943,_0x3168bf){return function(_0x4b96cd){if(!_0x4b96cd){_0x471943[_0x1c7a('0x22')](0x194);}return _0x4b96cd;};}function handleError(_0x32e527,_0x45eaf0){_0x45eaf0=_0x45eaf0||0x1f4;return function(_0x1bd901){logger[_0x1c7a('0x23')](_0x1bd901[_0x1c7a('0x24')]);if(_0x1bd901['name']){delete _0x1bd901[_0x1c7a('0x25')];}_0x32e527['status'](_0x45eaf0)[_0x1c7a('0x26')](_0x1bd901);};}exports[_0x1c7a('0x27')]=function(_0x588a8f,_0x13cb8e){var _0x1bf403={},_0x134d90={},_0x353610={'count':0x0,'rows':[]};var _0x31951e=_[_0x1c7a('0x28')](db[_0x1c7a('0x29')][_0x1c7a('0x2a')],function(_0x214924){return{'name':_0x214924[_0x1c7a('0x2b')],'type':_0x214924[_0x1c7a('0x2c')]['key']};});_0x134d90[_0x1c7a('0x2d')]=_[_0x1c7a('0x28')](_0x31951e,_0x1c7a('0x25'));_0x134d90[_0x1c7a('0x2e')]=_[_0x1c7a('0x2f')](_0x588a8f[_0x1c7a('0x2e')]);_0x134d90['filters']=_[_0x1c7a('0x30')](_0x134d90[_0x1c7a('0x2d')],_0x134d90['query']);_0x1bf403[_0x1c7a('0x31')]=_['intersection'](_0x134d90['model'],qs[_0x1c7a('0x32')](_0x588a8f[_0x1c7a('0x2e')][_0x1c7a('0x32')]));_0x1bf403[_0x1c7a('0x31')]=_0x1bf403[_0x1c7a('0x31')][_0x1c7a('0x33')]?_0x1bf403[_0x1c7a('0x31')]:_0x134d90[_0x1c7a('0x2d')];if(!_0x588a8f[_0x1c7a('0x2e')][_0x1c7a('0x34')]('nolimit')){_0x1bf403[_0x1c7a('0x1c')]=qs[_0x1c7a('0x1c')](_0x588a8f[_0x1c7a('0x2e')][_0x1c7a('0x1c')]);_0x1bf403['offset']=qs['offset'](_0x588a8f[_0x1c7a('0x2e')][_0x1c7a('0x1b')]);}_0x1bf403[_0x1c7a('0x35')]=qs[_0x1c7a('0x36')](_0x588a8f[_0x1c7a('0x2e')]['sort']);_0x1bf403[_0x1c7a('0x37')]=qs[_0x1c7a('0x38')](_['pick'](_0x588a8f[_0x1c7a('0x2e')],_0x134d90[_0x1c7a('0x38')]),_0x31951e);if(_0x588a8f[_0x1c7a('0x2e')][_0x1c7a('0x39')]){_0x1bf403[_0x1c7a('0x37')]=_[_0x1c7a('0x3a')](_0x1bf403['where'],{'$or':_[_0x1c7a('0x28')](_0x31951e,function(_0x5ad977){if(_0x5ad977[_0x1c7a('0x2c')]!==_0x1c7a('0x3b')){var _0x5d980b={};_0x5d980b[_0x5ad977['name']]={'$like':'%'+_0x588a8f[_0x1c7a('0x2e')][_0x1c7a('0x39')]+'%'};return _0x5d980b;}})});}_0x1bf403=_['merge']({},_0x1bf403,_0x588a8f[_0x1c7a('0x3c')]);var _0x113dbb={'where':_0x1bf403[_0x1c7a('0x37')]};return db['ChatTransferReport'][_0x1c7a('0x1a')](_0x113dbb)[_0x1c7a('0x21')](function(_0x5740f5){_0x353610[_0x1c7a('0x1a')]=_0x5740f5;if(_0x588a8f[_0x1c7a('0x2e')]['includeAll']){_0x1bf403['include']=[{'all':!![]}];}return db[_0x1c7a('0x29')][_0x1c7a('0x3d')](_0x1bf403);})[_0x1c7a('0x21')](function(_0x433bed){_0x353610[_0x1c7a('0x3e')]=_0x433bed;return _0x353610;})['then'](respondWithFilteredResult(_0x13cb8e,_0x1bf403))[_0x1c7a('0x3f')](handleError(_0x13cb8e,null));};exports[_0x1c7a('0x40')]=function(_0x4a41e1,_0x5b757a){var _0x55ec03={'raw':!![],'where':{'id':_0x4a41e1['params']['id']}},_0x2dbaf6={};_0x2dbaf6['model']=_['keys'](db[_0x1c7a('0x29')][_0x1c7a('0x2a')]);_0x2dbaf6[_0x1c7a('0x2e')]=_[_0x1c7a('0x2f')](_0x4a41e1[_0x1c7a('0x2e')]);_0x2dbaf6[_0x1c7a('0x38')]=_[_0x1c7a('0x30')](_0x2dbaf6[_0x1c7a('0x2d')],_0x2dbaf6[_0x1c7a('0x2e')]);_0x55ec03['attributes']=_['intersection'](_0x2dbaf6['model'],qs[_0x1c7a('0x32')](_0x4a41e1[_0x1c7a('0x2e')][_0x1c7a('0x32')]));_0x55ec03[_0x1c7a('0x31')]=_0x55ec03[_0x1c7a('0x31')][_0x1c7a('0x33')]?_0x55ec03[_0x1c7a('0x31')]:_0x2dbaf6[_0x1c7a('0x2d')];if(_0x4a41e1[_0x1c7a('0x2e')][_0x1c7a('0x41')]){_0x55ec03[_0x1c7a('0x42')]=[{'all':!![]}];}_0x55ec03=_['merge']({},_0x55ec03,_0x4a41e1[_0x1c7a('0x3c')]);return db[_0x1c7a('0x29')][_0x1c7a('0x43')](_0x55ec03)[_0x1c7a('0x21')](handleEntityNotFound(_0x5b757a,null))['then'](respondWithResult(_0x5b757a,null))['catch'](handleError(_0x5b757a,null));};exports[_0x1c7a('0x44')]=function(_0x5c7c76,_0x50092a){return db[_0x1c7a('0x29')]['create'](_0x5c7c76[_0x1c7a('0x45')],{})[_0x1c7a('0x21')](respondWithResult(_0x50092a,0xc9))[_0x1c7a('0x3f')](handleError(_0x50092a,null));};exports[_0x1c7a('0x20')]=function(_0x56eadb,_0x17d7f7){if(_0x56eadb[_0x1c7a('0x45')]['id']){delete _0x56eadb[_0x1c7a('0x45')]['id'];}return db[_0x1c7a('0x29')]['find']({'where':{'id':_0x56eadb[_0x1c7a('0x46')]['id']}})['then'](handleEntityNotFound(_0x17d7f7,null))[_0x1c7a('0x21')](saveUpdates(_0x56eadb['body'],null))[_0x1c7a('0x21')](respondWithResult(_0x17d7f7,null))[_0x1c7a('0x3f')](handleError(_0x17d7f7,null));};exports['destroy']=function(_0x1980e9,_0x1117f1){return db[_0x1c7a('0x29')][_0x1c7a('0x43')]({'where':{'id':_0x1980e9[_0x1c7a('0x46')]['id']}})[_0x1c7a('0x21')](handleEntityNotFound(_0x1117f1,null))[_0x1c7a('0x21')](removeEntity(_0x1117f1,null))[_0x1c7a('0x3f')](handleError(_0x1117f1,null));};exports[_0x1c7a('0x47')]=function(_0x6f6959,_0x47f09a){return db[_0x1c7a('0x29')]['describe']()[_0x1c7a('0x21')](respondWithResult(_0x47f09a,null))[_0x1c7a('0x3f')](handleError(_0x47f09a,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 0d3050a..2cb8505 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 _0x54ef=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport'];(function(_0x2c0d91,_0x195a06){var _0x891055=function(_0x1f30cb){while(--_0x1f30cb){_0x2c0d91['push'](_0x2c0d91['shift']());}};_0x891055(++_0x195a06);}(_0x54ef,0x112));var _0xf54e=function(_0x43f7b1,_0x58a297){_0x43f7b1=_0x43f7b1-0x0;var _0xc8b6e2=_0x54ef[_0x43f7b1];return _0xc8b6e2;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xf54e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x00bb=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./chatTransferReport.attributes'];(function(_0x19997d,_0x2c92a4){var _0x49be7f=function(_0x2e5d31){while(--_0x2e5d31){_0x19997d['push'](_0x19997d['shift']());}};_0x49be7f(++_0x2c92a4);}(_0x00bb,0x1d8));var _0xb00b=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x00bb[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[{'name':_0xb00b('0xb'),'fields':[_0xb00b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 5a1fda1..8c3f0c3 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 _0x16e8=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x4c8dce,_0x417943){var _0x5ac36a=function(_0x394c78){while(--_0x394c78){_0x4c8dce['push'](_0x4c8dce['shift']());}};_0x5ac36a(++_0x417943);}(_0x16e8,0x12c));var _0x816e=function(_0x5437de,_0x4b85a4){_0x5437de=_0x5437de-0x0;var _0x4a9101=_0x16e8[_0x5437de];return _0x4a9101;};'use strict';var _=require('lodash');var util=require(_0x816e('0x0'));var moment=require('moment');var BPromise=require(_0x816e('0x1'));var rs=require(_0x816e('0x2'));var fs=require('fs');var Redis=require(_0x816e('0x3'));var db=require(_0x816e('0x4'))['db'];var utils=require(_0x816e('0x5'));var logger=require(_0x816e('0x6'))('rpc');var config=require(_0x816e('0x7'));var jayson=require(_0x816e('0x8'));var client=jayson[_0x816e('0x9')][_0x816e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eff15,_0x37628b,_0x2db390){return new BPromise(function(_0x323783,_0x3891ae){return client['request'](_0x5eff15,_0x2db390)['then'](function(_0x7f8a9e){logger[_0x816e('0xb')](_0x816e('0xc'),_0x37628b,_0x816e('0xd'));logger[_0x816e('0xe')](_0x816e('0xf'),_0x37628b,_0x816e('0xd'),JSON['stringify'](_0x7f8a9e));if(_0x7f8a9e[_0x816e('0x10')]){if(_0x7f8a9e[_0x816e('0x10')][_0x816e('0x11')]===0x1f4){logger[_0x816e('0x10')](_0x816e('0xc'),_0x37628b,_0x7f8a9e[_0x816e('0x10')]['message']);return _0x3891ae(_0x7f8a9e[_0x816e('0x10')][_0x816e('0x12')]);}logger['error'](_0x816e('0xc'),_0x37628b,_0x7f8a9e['error'][_0x816e('0x12')]);return _0x323783(_0x7f8a9e['error']['message']);}else{logger[_0x816e('0xb')](_0x816e('0xc'),_0x37628b,_0x816e('0xd'));_0x323783(_0x7f8a9e[_0x816e('0x13')][_0x816e('0x12')]);}})['catch'](function(_0x964333){logger[_0x816e('0x10')](_0x816e('0xc'),_0x37628b,_0x964333);_0x3891ae(_0x964333);});});} \ No newline at end of file +var _0xc93a=['client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x337bee,_0x53cbca){var _0x24c37d=function(_0x535b06){while(--_0x535b06){_0x337bee['push'](_0x337bee['shift']());}};_0x24c37d(++_0x53cbca);}(_0xc93a,0x11d));var _0xac93=function(_0x2908c4,_0x3e433c){_0x2908c4=_0x2908c4-0x0;var _0x4c5ef3=_0xc93a[_0x2908c4];return _0x4c5ef3;};'use strict';var _=require(_0xac93('0x0'));var util=require(_0xac93('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xac93('0x2'));var fs=require('fs');var Redis=require(_0xac93('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xac93('0x4'));var logger=require(_0xac93('0x5'))(_0xac93('0x6'));var config=require(_0xac93('0x7'));var jayson=require(_0xac93('0x8'));var client=jayson[_0xac93('0x9')][_0xac93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a6a9f,_0x133e61,_0x21a13e){return new BPromise(function(_0xa335f1,_0x3335d9){return client['request'](_0x5a6a9f,_0x21a13e)[_0xac93('0xb')](function(_0x12c9f7){logger[_0xac93('0xc')](_0xac93('0xd'),_0x133e61,_0xac93('0xe'));logger[_0xac93('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x133e61,_0xac93('0xe'),JSON[_0xac93('0x10')](_0x12c9f7));if(_0x12c9f7[_0xac93('0x11')]){if(_0x12c9f7[_0xac93('0x11')][_0xac93('0x12')]===0x1f4){logger[_0xac93('0x11')](_0xac93('0xd'),_0x133e61,_0x12c9f7[_0xac93('0x11')][_0xac93('0x13')]);return _0x3335d9(_0x12c9f7[_0xac93('0x11')]['message']);}logger[_0xac93('0x11')](_0xac93('0xd'),_0x133e61,_0x12c9f7[_0xac93('0x11')][_0xac93('0x13')]);return _0xa335f1(_0x12c9f7[_0xac93('0x11')][_0xac93('0x13')]);}else{logger[_0xac93('0xc')](_0xac93('0xd'),_0x133e61,_0xac93('0xe'));_0xa335f1(_0x12c9f7[_0xac93('0x14')][_0xac93('0x13')]);}})['catch'](function(_0x4448b1){logger[_0xac93('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x133e61,_0x4448b1);_0x3335d9(_0x4448b1);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index e6a7fe8..4c2c549 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 _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x31fb83,_0x1d22dc){var _0x44183f=function(_0x3aa1bb){while(--_0x3aa1bb){_0x31fb83['push'](_0x31fb83['shift']());}};_0x44183f(++_0x1d22dc);}(_0xb7e7,0x121));var _0x7b7e=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xb7e7[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['put'](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);module[_0x7b7e('0x10')]=router; \ No newline at end of file +var _0xbaf0=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 29bb87f..dde9296 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 _0xfdcb=['Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','name','text','input','getDataValue','onlineForm','parse','setDataValue','stringify','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note'];(function(_0xe86ad7,_0x4e34cd){var _0x45b33b=function(_0x186cea){while(--_0x186cea){_0xe86ad7['push'](_0xe86ad7['shift']());}};_0x45b33b(++_0x4e34cd);}(_0xfdcb,0x134));var _0xbfdc=function(_0x2242a1,_0x38f44d){_0x2242a1=_0x2242a1-0x0;var _0x2c298b=_0xfdcb[_0x2242a1];return _0x2c298b;};'use strict';var Sequelize=require(_0xbfdc('0x0'));var rs=require(_0xbfdc('0x1'));module[_0xbfdc('0x2')]={'name':{'type':Sequelize[_0xbfdc('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xbfdc('0x3')],'allowNull':![],'unique':_0xbfdc('0x4')},'description':{'type':Sequelize[_0xbfdc('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':_0xbfdc('0x5')},'key':{'type':Sequelize[_0xbfdc('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xbfdc('0x6')},'customerAlias':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xbfdc('0x3')],'allowNull':![],'defaultValue':_0xbfdc('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xbfdc('0x3')],'allowNull':![],'defaultValue':_0xbfdc('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbfdc('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xbfdc('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xbfdc('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xbfdc('0xa')]('rounded','squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':_0xbfdc('0xb')},'start_chat_button':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':_0xbfdc('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xbfdc('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xbfdc('0xe')},'download_transcript':{'type':Sequelize[_0xbfdc('0xf')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xbfdc('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':_0xbfdc('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0xbfdc('0xf')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xbfdc('0x11')]},'closingQuestion':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':_0xbfdc('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':_0xbfdc('0x13')},'noteTitle':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':_0xbfdc('0x14')},'placeholderMessage':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':_0xbfdc('0x15')},'closingMessage':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':_0xbfdc('0x16')},'closingMessageButton':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xbfdc('0xf')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xbfdc('0xf')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':_0xbfdc('0x17')},'ratingType':{'type':Sequelize[_0xbfdc('0xa')](_0xbfdc('0x18'),_0xbfdc('0x19')),'defaultValue':_0xbfdc('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xbfdc('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xbfdc('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xbfdc('0x1a'),'type':_0xbfdc('0x1b'),'required':!![]},'props':{'title':_0xbfdc('0x1a'),'helpText':''}},{'type':_0xbfdc('0x1c'),'props':{'title':_0xbfdc('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xbfdc('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xbfdc('0x1d')](_0xbfdc('0x1e'))?JSON[_0xbfdc('0x1f')](this[_0xbfdc('0x1d')](_0xbfdc('0x1e'))):{};},'set':function(_0x56ec58){return this[_0xbfdc('0x20')](_0xbfdc('0x1e'),JSON[_0xbfdc('0x21')](_0x56ec58));}},'offlineForm':{'type':Sequelize[_0xbfdc('0x11')],'defaultValue':function(){return JSON[_0xbfdc('0x21')]({'items':[{'type':_0xbfdc('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xbfdc('0x5'),'type':_0xbfdc('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0xbfdc('0x22'),'helpText':_0xbfdc('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xbfdc('0x1d')]('offlineForm')?JSON['parse'](this[_0xbfdc('0x1d')](_0xbfdc('0x24'))):{};},'set':function(_0x4b2f7f){return this[_0xbfdc('0x20')](_0xbfdc('0x24'),JSON['stringify'](_0x4b2f7f));}},'token':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':function(){return rs[_0xbfdc('0x25')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xbfdc('0xf')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xbfdc('0xf')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xbfdc('0x3')]},'forwardOffline':{'type':Sequelize[_0xbfdc('0xf')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xbfdc('0x3')]},'waitingTitle':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':_0xbfdc('0x26')},'waitingMessage':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':_0xbfdc('0x27')},'skipUnmanaged':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xbfdc('0xf')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xbfdc('0xf')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xbfdc('0x11')]},'showAgentAvatar':{'type':Sequelize[_0xbfdc('0xf')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xbfdc('0x3')]},'notificationTemplate':{'type':Sequelize[_0xbfdc('0x11')],'defaultValue':function(){return _0xbfdc('0x28');}},'notificationSound':{'type':Sequelize[_0xbfdc('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xbfdc('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xbfdc('0x29')},'verticalAlignment':{'type':Sequelize[_0xbfdc('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':_0xbfdc('0x2a')},'defaultTitle':{'type':Sequelize[_0xbfdc('0x3')]},'customerAvatar':{'type':Sequelize[_0xbfdc('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0xbfdc('0xf')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xbfdc('0x3')],'allowNull':![],'defaultValue':_0xbfdc('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xbfdc('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbfdc('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbfdc('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbfdc('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xbfdc('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbfdc('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xbfdc('0xf')],'defaultValue':![],'comment':_0xbfdc('0x2c'),'set':function(_0x3853a3){if(!_0x3853a3)this[_0xbfdc('0x20')](_0xbfdc('0x2d'),null);this[_0xbfdc('0x20')](_0xbfdc('0x2e'),_0x3853a3);}},'vidaooEscalation':{'type':Sequelize[_0xbfdc('0xf')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file +var _0x7bb8=['email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Type\x20a\x20message','Skip','Feedback','star','thumb','stringify','name','text','input','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','randomstring','exports','STRING'];(function(_0x12553b,_0x5a9b35){var _0x86a99a=function(_0x459e12){while(--_0x459e12){_0x12553b['push'](_0x12553b['shift']());}};_0x86a99a(++_0x5a9b35);}(_0x7bb8,0xe8));var _0x87bb=function(_0x268a92,_0x1ff874){_0x268a92=_0x268a92-0x0;var _0x496fc8=_0x7bb8[_0x268a92];return _0x496fc8;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x87bb('0x0'));module[_0x87bb('0x1')]={'name':{'type':Sequelize[_0x87bb('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x87bb('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x87bb('0x2')]},'mapKey':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x87bb('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x87bb('0x2')],'allowNull':![],'defaultValue':_0x87bb('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x87bb('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x87bb('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x87bb('0x2')]},'animation':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x87bb('0x9')](_0x87bb('0xa'),_0x87bb('0xb')),'defaultValue':_0x87bb('0xa')},'header_online':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0xc')},'start_chat_button':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x87bb('0xe')},'header_offline':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0xf')},'download_transcript':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x87bb('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x87bb('0x10')]},'closingQuestion':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x87bb('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x13')},'closingMessage':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0xe')},'skipMessageButton':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x14')},'conditionAgreement':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x15')},'ratingType':{'type':Sequelize[_0x87bb('0x9')](_0x87bb('0x16'),_0x87bb('0x17')),'defaultValue':_0x87bb('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x87bb('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x87bb('0x10')],'defaultValue':function(){return JSON[_0x87bb('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x87bb('0x19'),'type':_0x87bb('0x1a'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x87bb('0x1b'),'props':{'title':_0x87bb('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x87bb('0x3'),'type':_0x87bb('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x87bb('0x1c')](_0x87bb('0x1d'))?JSON[_0x87bb('0x1e')](this['getDataValue'](_0x87bb('0x1d'))):{};},'set':function(_0x512a99){return this[_0x87bb('0x1f')](_0x87bb('0x1d'),JSON[_0x87bb('0x18')](_0x512a99));}},'offlineForm':{'type':Sequelize[_0x87bb('0x10')],'defaultValue':function(){return JSON[_0x87bb('0x18')]({'items':[{'type':_0x87bb('0x1b'),'props':{'title':_0x87bb('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x87bb('0x3'),'type':_0x87bb('0x3')},'variable':null},{'type':_0x87bb('0x20'),'config':{'placeholder':_0x87bb('0x21')},'props':{'title':_0x87bb('0x21'),'helpText':_0x87bb('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x87bb('0x1c')](_0x87bb('0x23'))?JSON[_0x87bb('0x1e')](this['getDataValue'](_0x87bb('0x23'))):{};},'set':function(_0x5a3fc7){return this[_0x87bb('0x1f')]('offlineForm',JSON[_0x87bb('0x18')](_0x5a3fc7));}},'token':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':function(){return rs[_0x87bb('0x24')]();}},'autoclose':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x87bb('0x2')]},'forwardOffline':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x87bb('0x2')]},'waitingTitle':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x25')},'waitingMessage':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x27')},'offlineMessageBody':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x87bb('0x14')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x87bb('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x87bb('0x2')]},'notificationTemplate':{'type':Sequelize[_0x87bb('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x29')},'verticalAlignment':{'type':Sequelize[_0x87bb('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x2a')},'defaultTitle':{'type':Sequelize[_0x87bb('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x87bb('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x87bb('0x2')],'allowNull':![],'defaultValue':_0x87bb('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x87bb('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x87bb('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x2c')},'systemAvatar':{'type':Sequelize[_0x87bb('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x87bb('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![],'comment':_0x87bb('0x2d'),'set':function(_0x36f0da){if(!_0x36f0da)this[_0x87bb('0x1f')](_0x87bb('0x2e'),null);this[_0x87bb('0x1f')]('mandatoryDisposition',_0x36f0da);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 6e3ad4d..96ce1b9 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 _0x4944=['include','findAll','rows','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','destroy','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','pick','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','headers','user-agent','getResult','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','account','Applications','applications','priority','asc','ListId','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','vendor','device','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','firstName','messageId','created','autoclose','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','CompanyId','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','MailAccount','forwardOfflineAddress','Smtp','service','host','port','pass','SendMail','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','Owner','internal','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','interval','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','push','all','some','server/files/chat/iframe.js','utf8','remote','x-real-ip','connection','replace','textColor','addApplications','sequelize','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','onlineForm','items','fromKey','getOfflineMessages','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','redis','defaults','./chatWebsite.socket','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','update','get','ChatWebsites','UserProfileResource','end','stack','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','includeAll'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0x4944,0x1d5));var _0x4494=function(_0x169f72,_0x15cb6a){_0x169f72=_0x169f72-0x0;var _0x1b6211=_0x4944[_0x169f72];return _0x1b6211;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4494('0x0'));var zipdir=require(_0x4494('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4494('0x2'));var moment=require(_0x4494('0x3'));var BPromise=require(_0x4494('0x4'));var Mustache=require(_0x4494('0x5'));var util=require(_0x4494('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x4494('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4494('0x8'));var squel=require(_0x4494('0x9'));var crypto=require(_0x4494('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4494('0x7'));var querystring=require(_0x4494('0xb'));var Papa=require(_0x4494('0xc'));var Redis=require(_0x4494('0xd'));var authService=require(_0x4494('0xe'));var qs=require(_0x4494('0xf'));var as=require(_0x4494('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4494('0x11'));var utils=require(_0x4494('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4494('0x13')]=_[_0x4494('0x14')](config[_0x4494('0x13')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4494('0x15'))['register'](socket);var jayson=require(_0x4494('0x16'));var client=jayson[_0x4494('0x17')][_0x4494('0x18')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0x4494('0x17')][_0x4494('0x18')]({'port':0x232b});function checkPasswordPattern(_0x14c7af,_0x575697,_0x22bd8d){if(_0x22bd8d){var _0x5d08b2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d08b2['test'](_0x575697)){return _0x14c7af;}else{throw new db[(_0x4494('0x19'))][(_0x4494('0x1a'))](_0x4494('0x1b'));}}else{return _0x14c7af;}}function respondWithRpcPromise(_0x59bfb3,_0x1e777b,_0x8200d6,_0x36c558){return new BPromise(function(_0x402552,_0x30b9c1){var _0x32b0a4=_0x36c558||client;return _0x32b0a4[_0x4494('0x1c')](_0x59bfb3,_0x8200d6)[_0x4494('0x1d')](function(_0x502646){logger[_0x4494('0x1e')](_0x4494('0x1f'),_0x1e777b,_0x4494('0x20'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1e777b,_0x4494('0x20'),JSON['stringify'](_0x502646));if(_0x502646[_0x4494('0x21')]){if(_0x502646['error'][_0x4494('0x22')]===0x1f4){logger[_0x4494('0x21')](_0x4494('0x1f'),_0x1e777b,_0x502646[_0x4494('0x21')][_0x4494('0x23')]);return _0x30b9c1(_0x502646[_0x4494('0x21')][_0x4494('0x23')]);}logger[_0x4494('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x1e777b,_0x502646[_0x4494('0x21')]['message']);return _0x402552(_0x502646[_0x4494('0x21')][_0x4494('0x23')]);}else{logger['info'](_0x4494('0x1f'),_0x1e777b,_0x4494('0x20'));_0x402552(_0x502646[_0x4494('0x24')]['message']);}})[_0x4494('0x25')](function(_0x31e527){logger['error'](_0x4494('0x1f'),_0x1e777b,_0x31e527);_0x30b9c1(_0x31e527);});});}function respondWithStatusCode(_0x5f0009,_0x2a4509){_0x2a4509=_0x2a4509||0xcc;return function(_0x507a6a){if(_0x507a6a){return _0x5f0009[_0x4494('0x26')](_0x2a4509);}return _0x5f0009[_0x4494('0x27')](_0x2a4509)['end']();};}function respondWithResult(_0x1fcff5,_0x3a2307){_0x3a2307=_0x3a2307||0xc8;return function(_0x3c0965){if(_0x3c0965){return _0x1fcff5[_0x4494('0x27')](_0x3a2307)[_0x4494('0x28')](_0x3c0965);}};}function respondWithFilteredResult(_0x39d59d,_0x1741db){return function(_0x4203b){if(_0x4203b){var _0x550291=_0x4203b[_0x4494('0x29')],_0x56e8ad=_0x1741db['offset'],_0x594f5b=_0x1741db[_0x4494('0x2a')]+_0x1741db[_0x4494('0x2b')],_0x5898d7;if(_0x594f5b>=_0x550291){_0x594f5b=_0x550291;_0x5898d7=0xc8;}else{_0x5898d7=0xce;}_0x39d59d[_0x4494('0x27')](_0x5898d7);return _0x39d59d[_0x4494('0x2c')]('Content-Range',_0x56e8ad+'-'+_0x594f5b+'/'+_0x550291)['json'](_0x4203b);}return null;};}function patchUpdates(_0x285804){return function(_0x469c18){try{jsonpatch[_0x4494('0x2d')](_0x469c18,_0x285804,!![]);}catch(_0x41ff6c){return BPromise[_0x4494('0x2e')](_0x41ff6c);}return _0x469c18['save']();};}function saveUpdates(_0x3f3320,_0x1e7331){return function(_0x5c1131){if(_0x5c1131){return _0x5c1131[_0x4494('0x2f')](_0x3f3320)[_0x4494('0x1d')](function(_0x1528c3){return _0x1528c3;});}return null;};}function removeEntity(_0x342be5,_0x17d008){return function(_0x2528f2){if(_0x2528f2){return _0x2528f2['destroy']()['then'](function(){var _0x5e10ab=_0x2528f2[_0x4494('0x30')]({'plain':!![]});var _0x225484=_0x4494('0x31');return db[_0x4494('0x32')]['destroy']({'where':{'type':_0x225484,'resourceId':_0x5e10ab['id']}})['then'](function(){return _0x2528f2;});})[_0x4494('0x1d')](function(){_0x342be5[_0x4494('0x27')](0xcc)[_0x4494('0x33')]();});}};}function handleEntityNotFound(_0x382c57,_0x4abcbf){return function(_0x1e1e8a){if(!_0x1e1e8a){_0x382c57['sendStatus'](0x194);}return _0x1e1e8a;};}function handleError(_0x10f988,_0x4f8889){_0x4f8889=_0x4f8889||0x1f4;return function(_0x152347){logger['error'](_0x152347[_0x4494('0x34')]);if(_0x152347[_0x4494('0x35')]){delete _0x152347[_0x4494('0x35')];}_0x10f988[_0x4494('0x27')](_0x4f8889)[_0x4494('0x36')](_0x152347);};}exports['index']=function(_0x528af9,_0x3f906f){var _0x4c77a8={'include':[{'model':db[_0x4494('0x37')],'as':_0x4494('0x38')}]},_0x201942={},_0x119221={'count':0x0,'rows':[]};var _0x1954dc=_[_0x4494('0x39')](db[_0x4494('0x3a')][_0x4494('0x3b')],function(_0x303139){return{'name':_0x303139[_0x4494('0x3c')],'type':_0x303139[_0x4494('0x3d')][_0x4494('0x3e')]};});_0x201942[_0x4494('0x3f')]=_['map'](_0x1954dc,_0x4494('0x35'));_0x201942[_0x4494('0x40')]=_[_0x4494('0x41')](_0x528af9['query']);_0x201942[_0x4494('0x42')]=_['intersection'](_0x201942['model'],_0x201942[_0x4494('0x40')]);_0x4c77a8['attributes']=_[_0x4494('0x43')](_0x201942[_0x4494('0x3f')],qs[_0x4494('0x44')](_0x528af9[_0x4494('0x40')][_0x4494('0x44')]));_0x4c77a8['attributes']=_0x4c77a8[_0x4494('0x45')][_0x4494('0x46')]?_0x4c77a8[_0x4494('0x45')]:_0x201942[_0x4494('0x3f')];if(!_0x528af9['query'][_0x4494('0x47')]('nolimit')){_0x4c77a8['limit']=qs[_0x4494('0x2b')](_0x528af9['query'][_0x4494('0x2b')]);_0x4c77a8['offset']=qs[_0x4494('0x2a')](_0x528af9[_0x4494('0x40')][_0x4494('0x2a')]);}_0x4c77a8[_0x4494('0x48')]=qs[_0x4494('0x49')](_0x528af9[_0x4494('0x40')][_0x4494('0x49')]);_0x4c77a8['where']=qs[_0x4494('0x42')](_['pick'](_0x528af9[_0x4494('0x40')],_0x201942[_0x4494('0x42')]),_0x1954dc);if(_0x528af9[_0x4494('0x40')][_0x4494('0x4a')]){_0x4c77a8['where']=_[_0x4494('0x4b')](_0x4c77a8[_0x4494('0x4c')],{'$or':_[_0x4494('0x39')](_0x1954dc,function(_0x290b26){if(_0x290b26[_0x4494('0x3d')]!==_0x4494('0x4d')){var _0x464b1b={};_0x464b1b[_0x290b26[_0x4494('0x35')]]={'$like':'%'+_0x528af9[_0x4494('0x40')][_0x4494('0x4a')]+'%'};return _0x464b1b;}})});}_0x4c77a8=_['merge']({},_0x4c77a8,_0x528af9['options']);var _0x20564a={'where':_0x4c77a8[_0x4494('0x4c')]};return db[_0x4494('0x3a')][_0x4494('0x29')](_0x20564a)[_0x4494('0x1d')](function(_0x552e6d){_0x119221['count']=_0x552e6d;if(_0x528af9['query'][_0x4494('0x4e')]){_0x4c77a8[_0x4494('0x4f')]=[{'all':!![]}];}return db[_0x4494('0x3a')][_0x4494('0x50')](_0x4c77a8);})[_0x4494('0x1d')](function(_0x1dfd19){_0x119221[_0x4494('0x51')]=_0x1dfd19;return _0x119221;})['then'](respondWithFilteredResult(_0x3f906f,_0x4c77a8))[_0x4494('0x25')](handleError(_0x3f906f,null));};exports[_0x4494('0x52')]=function(_0x2c79f5,_0x42b41e){var _0x415974={'raw':![],'where':{'id':_0x2c79f5[_0x4494('0x53')]['id']},'include':[{'model':db[_0x4494('0x37')],'as':_0x4494('0x38')}]},_0x24f3bc={};_0x24f3bc[_0x4494('0x3f')]=_[_0x4494('0x41')](db[_0x4494('0x3a')][_0x4494('0x3b')]);_0x24f3bc['query']=_[_0x4494('0x41')](_0x2c79f5['query']);_0x24f3bc[_0x4494('0x42')]=_[_0x4494('0x43')](_0x24f3bc[_0x4494('0x3f')],_0x24f3bc['query']);_0x415974['attributes']=_[_0x4494('0x43')](_0x24f3bc[_0x4494('0x3f')],qs[_0x4494('0x44')](_0x2c79f5['query'][_0x4494('0x44')]));_0x415974[_0x4494('0x45')]=_0x415974[_0x4494('0x45')][_0x4494('0x46')]?_0x415974['attributes']:_0x24f3bc[_0x4494('0x3f')];if(_0x2c79f5[_0x4494('0x40')][_0x4494('0x4e')]){_0x415974[_0x4494('0x4f')]=[{'all':!![]}];}_0x415974=_[_0x4494('0x4b')]({},_0x415974,_0x2c79f5[_0x4494('0x54')]);return db[_0x4494('0x3a')][_0x4494('0x55')](_0x415974)[_0x4494('0x1d')](handleEntityNotFound(_0x42b41e,null))['then'](respondWithResult(_0x42b41e,null))['catch'](handleError(_0x42b41e,null));};exports['create']=function(_0x268ee6,_0x294604){return db[_0x4494('0x3a')][_0x4494('0x56')](_0x268ee6['body'],{})[_0x4494('0x1d')](function(_0x2e52cd){var _0x3dfa73=_0x268ee6[_0x4494('0x57')][_0x4494('0x30')]({'plain':!![]});if(!_0x3dfa73)throw new Error(_0x4494('0x58'));if(_0x3dfa73[_0x4494('0x59')]===_0x4494('0x57')){var _0x4fec05=_0x2e52cd[_0x4494('0x30')]({'plain':!![]});var _0x5a9011=_0x4494('0x31');return db[_0x4494('0x5a')][_0x4494('0x55')]({'where':{'name':_0x5a9011,'userProfileId':_0x3dfa73['userProfileId']},'raw':!![]})['then'](function(_0x134eab){if(_0x134eab&&_0x134eab[_0x4494('0x5b')]===0x0){return db[_0x4494('0x32')][_0x4494('0x56')]({'name':_0x4fec05[_0x4494('0x35')],'resourceId':_0x4fec05['id'],'type':_0x134eab[_0x4494('0x35')],'sectionId':_0x134eab['id']},{})['then'](function(){return _0x2e52cd;});}else{return _0x2e52cd;}})['catch'](function(_0x4c80c7){logger[_0x4494('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c80c7);throw _0x4c80c7;});}return _0x2e52cd;})[_0x4494('0x1d')](respondWithResult(_0x294604,0xc9))[_0x4494('0x25')](handleError(_0x294604,null));};exports[_0x4494('0x2f')]=function(_0x55bf14,_0x3e0ec8){if(_0x55bf14['body']['id']){delete _0x55bf14[_0x4494('0x5c')]['id'];}return db[_0x4494('0x3a')][_0x4494('0x55')]({'where':{'id':_0x55bf14[_0x4494('0x53')]['id']},'include':[{'model':db[_0x4494('0x37')],'as':_0x4494('0x38')}]})[_0x4494('0x1d')](handleEntityNotFound(_0x3e0ec8,null))[_0x4494('0x1d')](saveUpdates(_0x55bf14[_0x4494('0x5c')],null))['then'](respondWithResult(_0x3e0ec8,null))['catch'](handleError(_0x3e0ec8,null));};exports[_0x4494('0x5d')]=function(_0x1dcd7d,_0x49edaf){return db['ChatWebsite'][_0x4494('0x55')]({'where':{'id':_0x1dcd7d['params']['id']}})['then'](handleEntityNotFound(_0x49edaf,null))[_0x4494('0x1d')](removeEntity(_0x49edaf,null))[_0x4494('0x25')](handleError(_0x49edaf,null));};exports[_0x4494('0x5e')]=function(_0x4f680a,_0x2b7180){return db[_0x4494('0x3a')][_0x4494('0x5e')]()[_0x4494('0x1d')](respondWithResult(_0x2b7180,null))[_0x4494('0x25')](handleError(_0x2b7180,null));};exports[_0x4494('0x5f')]=function(_0x3f57ca,_0x4fa412,_0x5ae803){if(_0x3f57ca[_0x4494('0x5c')]['id']){delete _0x3f57ca[_0x4494('0x5c')]['id'];}return db[_0x4494('0x3a')][_0x4494('0x55')]({'where':{'id':_0x3f57ca['params']['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x4fa412,null))[_0x4494('0x1d')](function(_0x448068){if(_0x448068){_0x3f57ca[_0x4494('0x5c')][_0x4494('0x60')]=_0x448068['id'];return db[_0x4494('0x61')][_0x4494('0x56')](_0x3f57ca[_0x4494('0x5c')]);}})['then'](respondWithResult(_0x4fa412,null))[_0x4494('0x25')](handleError(_0x4fa412,null));};exports[_0x4494('0x62')]=function(_0x52c530,_0x2bdca6,_0x1e5fd9){var _0x3f01a2={'raw':![],'where':{}};var _0x563767={};var _0x5cc95f={'count':0x0,'rows':[]};return db[_0x4494('0x3a')][_0x4494('0x63')]({'where':{'id':_0x52c530[_0x4494('0x53')]['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x2bdca6,null))[_0x4494('0x1d')](function(_0x35f0fc){if(_0x35f0fc){_0x563767['model']=_[_0x4494('0x41')](db[_0x4494('0x61')]['rawAttributes']);_0x563767['query']=_['keys'](_0x52c530['query']);_0x563767[_0x4494('0x42')]=_[_0x4494('0x43')](_0x563767[_0x4494('0x3f')],_0x563767[_0x4494('0x40')]);_0x3f01a2['attributes']=_[_0x4494('0x43')](_0x563767[_0x4494('0x3f')],qs[_0x4494('0x44')](_0x52c530[_0x4494('0x40')][_0x4494('0x44')]));_0x3f01a2['attributes']=_0x3f01a2[_0x4494('0x45')][_0x4494('0x46')]?_0x3f01a2[_0x4494('0x45')]:_0x563767[_0x4494('0x3f')];if(!_0x52c530[_0x4494('0x40')]['hasOwnProperty'](_0x4494('0x64'))){_0x3f01a2[_0x4494('0x2b')]=qs[_0x4494('0x2b')](_0x52c530[_0x4494('0x40')][_0x4494('0x2b')]);_0x3f01a2[_0x4494('0x2a')]=qs['offset'](_0x52c530[_0x4494('0x40')][_0x4494('0x2a')]);}_0x3f01a2[_0x4494('0x48')]=qs[_0x4494('0x49')](_0x52c530[_0x4494('0x40')][_0x4494('0x49')]);_0x3f01a2[_0x4494('0x4c')]=qs[_0x4494('0x42')](_[_0x4494('0x65')](_0x52c530['query'],_0x563767[_0x4494('0x42')]));_0x3f01a2[_0x4494('0x4c')]['ChatWebsiteId']=_0x35f0fc['id'];if(_0x52c530[_0x4494('0x40')][_0x4494('0x4a')]){_0x3f01a2[_0x4494('0x4c')]=_[_0x4494('0x4b')](_0x3f01a2[_0x4494('0x4c')],{'$or':_[_0x4494('0x39')](_0x3f01a2['attributes'],function(_0x3bf76e){var _0x12b0f4={};_0x12b0f4[_0x3bf76e]={'$like':'%'+_0x52c530[_0x4494('0x40')]['filter']+'%'};return _0x12b0f4;})});}_0x3f01a2=_[_0x4494('0x4b')]({},_0x3f01a2,_0x52c530[_0x4494('0x54')]);return db[_0x4494('0x61')][_0x4494('0x29')]({'where':_0x3f01a2[_0x4494('0x4c')]})[_0x4494('0x1d')](function(_0x37fa91){_0x5cc95f[_0x4494('0x29')]=_0x37fa91;if(_0x52c530[_0x4494('0x40')][_0x4494('0x4e')]){_0x3f01a2[_0x4494('0x4f')]=[{'all':!![]}];}return db[_0x4494('0x61')][_0x4494('0x50')](_0x3f01a2);})[_0x4494('0x1d')](function(_0x2cc99c){_0x5cc95f[_0x4494('0x51')]=_0x2cc99c;return _0x5cc95f;});}})[_0x4494('0x1d')](respondWithFilteredResult(_0x2bdca6,_0x3f01a2))[_0x4494('0x25')](handleError(_0x2bdca6,null));};exports['removeDispositions']=function(_0x3d59b5,_0x4ea63c,_0x172cab){return db[_0x4494('0x3a')][_0x4494('0x55')]({'where':{'id':_0x3d59b5[_0x4494('0x53')]['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x4ea63c,null))[_0x4494('0x1d')](function(_0x4c8e68){if(_0x4c8e68){return _0x4c8e68[_0x4494('0x66')](_0x3d59b5[_0x4494('0x40')][_0x4494('0x67')]);}})['then'](respondWithStatusCode(_0x4ea63c,null))[_0x4494('0x25')](handleError(_0x4ea63c,null));};exports[_0x4494('0x68')]=function(_0x17d58a,_0x1eb876,_0x5b751f){if(_0x17d58a['body']['id']){delete _0x17d58a['body']['id'];}return db[_0x4494('0x3a')][_0x4494('0x55')]({'where':{'id':_0x17d58a[_0x4494('0x53')]['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x1eb876,null))[_0x4494('0x1d')](function(_0x15fdc5){if(_0x15fdc5){_0x17d58a[_0x4494('0x5c')][_0x4494('0x60')]=_0x15fdc5['id'];return db[_0x4494('0x69')][_0x4494('0x56')](_0x17d58a[_0x4494('0x5c')]);}})['then'](respondWithResult(_0x1eb876,null))[_0x4494('0x25')](handleError(_0x1eb876,null));};exports['getAnswers']=function(_0x486802,_0x2322fc,_0x25e28a){var _0x1cbd42={'raw':![],'where':{}};var _0x737cb3={};var _0x1797e1={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x486802['params']['id']}})['then'](handleEntityNotFound(_0x2322fc,null))[_0x4494('0x1d')](function(_0x1caabf){if(_0x1caabf){_0x737cb3[_0x4494('0x3f')]=_[_0x4494('0x41')](db[_0x4494('0x69')][_0x4494('0x3b')]);_0x737cb3['query']=_[_0x4494('0x41')](_0x486802['query']);_0x737cb3[_0x4494('0x42')]=_[_0x4494('0x43')](_0x737cb3[_0x4494('0x3f')],_0x737cb3[_0x4494('0x40')]);_0x1cbd42[_0x4494('0x45')]=_[_0x4494('0x43')](_0x737cb3[_0x4494('0x3f')],qs[_0x4494('0x44')](_0x486802['query'][_0x4494('0x44')]));_0x1cbd42[_0x4494('0x45')]=_0x1cbd42[_0x4494('0x45')][_0x4494('0x46')]?_0x1cbd42['attributes']:_0x737cb3['model'];if(!_0x486802[_0x4494('0x40')]['hasOwnProperty']('nolimit')){_0x1cbd42['limit']=qs[_0x4494('0x2b')](_0x486802[_0x4494('0x40')][_0x4494('0x2b')]);_0x1cbd42[_0x4494('0x2a')]=qs[_0x4494('0x2a')](_0x486802[_0x4494('0x40')][_0x4494('0x2a')]);}_0x1cbd42[_0x4494('0x48')]=qs['sort'](_0x486802['query'][_0x4494('0x49')]);_0x1cbd42[_0x4494('0x4c')]=qs[_0x4494('0x42')](_[_0x4494('0x65')](_0x486802[_0x4494('0x40')],_0x737cb3[_0x4494('0x42')]));_0x1cbd42[_0x4494('0x4c')][_0x4494('0x60')]=_0x1caabf['id'];if(_0x486802[_0x4494('0x40')]['filter']){_0x1cbd42['where']=_[_0x4494('0x4b')](_0x1cbd42[_0x4494('0x4c')],{'$or':_[_0x4494('0x39')](_0x1cbd42[_0x4494('0x45')],function(_0xd7e428){var _0x34adfd={};_0x34adfd[_0xd7e428]={'$like':'%'+_0x486802[_0x4494('0x40')]['filter']+'%'};return _0x34adfd;})});}_0x1cbd42=_['merge']({},_0x1cbd42,_0x486802[_0x4494('0x54')]);return db[_0x4494('0x69')][_0x4494('0x29')]({'where':_0x1cbd42[_0x4494('0x4c')]})[_0x4494('0x1d')](function(_0x5d6878){_0x1797e1[_0x4494('0x29')]=_0x5d6878;if(_0x486802[_0x4494('0x40')][_0x4494('0x4e')]){_0x1cbd42[_0x4494('0x4f')]=[{'all':!![]}];}return db[_0x4494('0x69')][_0x4494('0x50')](_0x1cbd42);})['then'](function(_0x425cf5){_0x1797e1['rows']=_0x425cf5;return _0x1797e1;});}})[_0x4494('0x1d')](respondWithFilteredResult(_0x2322fc,_0x1cbd42))[_0x4494('0x25')](handleError(_0x2322fc,null));};exports[_0x4494('0x6a')]=function(_0x844d94,_0x188157,_0x4913fe){return db[_0x4494('0x3a')][_0x4494('0x55')]({'where':{'id':_0x844d94[_0x4494('0x53')]['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x188157,null))[_0x4494('0x1d')](function(_0x3613b4){if(_0x3613b4){return _0x3613b4[_0x4494('0x6a')](_0x844d94['query'][_0x4494('0x67')]);}})[_0x4494('0x1d')](respondWithStatusCode(_0x188157,null))[_0x4494('0x25')](handleError(_0x188157,null));};exports[_0x4494('0x6b')]=function(_0x4dc2bf,_0x579d45,_0x57fbfd){_0x4dc2bf['body'][_0x4494('0x6c')]=_0x4dc2bf['file'][_0x4494('0x6d')];return db[_0x4494('0x3a')][_0x4494('0x55')]({'where':{'id':_0x4dc2bf['params']['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x579d45,null))[_0x4494('0x1d')](saveUpdates(_0x4dc2bf[_0x4494('0x5c')],null))[_0x4494('0x1d')](respondWithResult(_0x579d45,null))['catch'](handleError(_0x579d45,null));};exports[_0x4494('0x6e')]=function(_0x3c613f,_0x2d64e5,_0x3add65){_0x3c613f['body'][_0x4494('0x6f')]=_0x3c613f[_0x4494('0x70')][_0x4494('0x6d')];return db[_0x4494('0x3a')]['find']({'where':{'id':_0x3c613f[_0x4494('0x53')]['id']}})['then'](handleEntityNotFound(_0x2d64e5,null))[_0x4494('0x1d')](saveUpdates(_0x3c613f[_0x4494('0x5c')],null))['then'](respondWithResult(_0x2d64e5,null))[_0x4494('0x25')](handleError(_0x2d64e5,null));};exports[_0x4494('0x71')]=function(_0x55ff3b,_0x3cfa6c,_0x402ab8){_0x55ff3b[_0x4494('0x5c')][_0x4494('0x72')]=_0x55ff3b[_0x4494('0x70')][_0x4494('0x6d')];return db['ChatWebsite'][_0x4494('0x55')]({'where':{'id':_0x55ff3b[_0x4494('0x53')]['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x3cfa6c,null))[_0x4494('0x1d')](saveUpdates(_0x55ff3b[_0x4494('0x5c')],null))['then'](respondWithResult(_0x3cfa6c,null))[_0x4494('0x25')](handleError(_0x3cfa6c,null));};exports[_0x4494('0x73')]=function(_0x15d54a,_0x114c0f,_0x11950d){_0x15d54a[_0x4494('0x5c')][_0x4494('0x74')]=_0x15d54a[_0x4494('0x70')][_0x4494('0x6d')];return db['ChatWebsite'][_0x4494('0x55')]({'where':{'id':_0x15d54a[_0x4494('0x53')]['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x114c0f,null))[_0x4494('0x1d')](saveUpdates(_0x15d54a[_0x4494('0x5c')],null))[_0x4494('0x1d')](respondWithResult(_0x114c0f,null))['catch'](handleError(_0x114c0f,null));};exports['getLogo']=function(_0xdb7fbd,_0x36cc4d,_0x37b894){var _0xc58a4c=path[_0x4494('0x75')](config[_0x4494('0x76')],_0x4494('0x77'));var _0x397f88={'where':{'id':_0xdb7fbd[_0x4494('0x53')]['id']},'attributes':['id',_0x4494('0x6c')],'raw':!![]};var _0x1fad78=![];return require(_0x4494('0x78'))[_0x4494('0x79')]()[_0x4494('0x1d')](function(_0x1ce96a){if(_0x1ce96a){_0x1fad78=_0x1ce96a[_0x4494('0x7a')];}})['then'](function(){return db['ChatWebsite']['find'](_0x397f88);})['then'](handleEntityNotFound(_0x36cc4d,null))[_0x4494('0x1d')](function(_0x254c15){if(_0x254c15){if(!_[_0x4494('0x7b')](_0x254c15[_0x4494('0x6c')])){if(fs[_0x4494('0x7c')](path['join'](config['root'],'server/files/images/logos/',_0x254c15[_0x4494('0x6c')]))&&_0x1fad78){_0xc58a4c=path[_0x4494('0x75')](config[_0x4494('0x76')],_0x4494('0x7d'),_0x254c15[_0x4494('0x6c')]);}}return _0x36cc4d['download'](_0xc58a4c);}})[_0x4494('0x25')](handleError(_0x36cc4d,null));};exports['getAvatar']=function(_0x89780b,_0x3e58ea,_0x101e0f){var _0x15bda6=path[_0x4494('0x75')](config['root'],_0x4494('0x7e'));var _0x26649d={'where':{'id':_0x89780b[_0x4494('0x53')]['id']},'attributes':['id',_0x4494('0x6f')],'raw':!![]};return db[_0x4494('0x3a')][_0x4494('0x55')](_0x26649d)['then'](handleEntityNotFound(_0x3e58ea,null))[_0x4494('0x1d')](function(_0x878257){if(_0x878257){if(!_['isNil'](_0x878257[_0x4494('0x6f')])){if(fs['existsSync'](path[_0x4494('0x75')](config[_0x4494('0x76')],_0x4494('0x7f'),_0x878257[_0x4494('0x6f')]))){_0x15bda6=path[_0x4494('0x75')](config[_0x4494('0x76')],'server/files/images/avatars/',_0x878257[_0x4494('0x6f')]);}}return _0x3e58ea[_0x4494('0x80')](_0x15bda6);}})[_0x4494('0x25')](handleError(_0x3e58ea,null));};exports[_0x4494('0x81')]=function(_0xcd2cc6,_0x42390c,_0x8ef58b){var _0x208ee4=path[_0x4494('0x75')](config[_0x4494('0x76')],'server/files/images/avatars/customer_avatar.png');var _0x211fec={'where':{'id':_0xcd2cc6['params']['id']},'attributes':['id',_0x4494('0x72'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0x4494('0x55')](_0x211fec)[_0x4494('0x1d')](handleEntityNotFound(_0x42390c,null))[_0x4494('0x1d')](function(_0xdb0f0a){if(_0xdb0f0a){if(!_['isNil'](_0xdb0f0a[_0x4494('0x72')])){if(fs['existsSync'](path[_0x4494('0x75')](config[_0x4494('0x76')],'server/files/images/avatars/',_0xdb0f0a[_0x4494('0x72')]))&&_0xdb0f0a[_0x4494('0x82')]){_0x208ee4=path['join'](config[_0x4494('0x76')],_0x4494('0x7f'),_0xdb0f0a['customerAvatar']);}}return _0x42390c['download'](_0x208ee4);}})[_0x4494('0x25')](handleError(_0x42390c,null));};exports['getSystemAvatar']=function(_0xc7af92,_0x279778,_0x1aabca){var _0x38bf4a=path[_0x4494('0x75')](config[_0x4494('0x76')],_0x4494('0x83'));var _0x87b971={'where':{'id':_0xc7af92['params']['id']},'attributes':['id',_0x4494('0x74')],'raw':!![]};return db[_0x4494('0x3a')]['find'](_0x87b971)[_0x4494('0x1d')](handleEntityNotFound(_0x279778,null))[_0x4494('0x1d')](function(_0x2173e4){if(_0x2173e4){if(!_[_0x4494('0x7b')](_0x2173e4[_0x4494('0x74')])){if(fs[_0x4494('0x7c')](path[_0x4494('0x75')](config[_0x4494('0x76')],'server/files/images/avatars/',_0x2173e4[_0x4494('0x74')]))){_0x38bf4a=path[_0x4494('0x75')](config[_0x4494('0x76')],'server/files/images/avatars/',_0x2173e4[_0x4494('0x74')]);}}return _0x279778[_0x4494('0x80')](_0x38bf4a);}})['catch'](handleError(_0x279778,null));};exports[_0x4494('0x84')]=function(_0x37e665,_0x3a32c8,_0x49ae38){var _0x267c60=require('user-agent-parser');var _0x14d22f=new _0x267c60();var _0x3043c9=_0x14d22f['setUA'](_0x37e665[_0x4494('0x85')][_0x4494('0x86')])[_0x4494('0x87')]();var _0x5912f1={'body':_0x37e665[_0x4494('0x5c')],'channel':'chat'};var _0x3679bf=[];var _0x215599=[];var _0x476674={};var _0x137b33=![];return db[_0x4494('0x88')][_0x4494('0x5e')]()[_0x4494('0x1d')](function(_0x1cc85f){if(!_0x1cc85f){throw new db[(_0x4494('0x19'))][(_0x4494('0x1a'))](_0x4494('0x89'));}_0x3679bf=_[_0x4494('0x8a')](_[_0x4494('0x41')](_0x1cc85f),[_0x4494('0x8b'),_0x4494('0x8c')]);_0x215599=_[_0x4494('0x8a')](_[_0x4494('0x41')](_0x1cc85f),[_0x4494('0x8b'),'updatedAt','CompanyId','ListId']);if(_0x37e665[_0x4494('0x5c')]['id']){delete _0x37e665[_0x4494('0x5c')]['id'];}if(_[_0x4494('0x7b')](_0x37e665[_0x4494('0x5c')][_0x4494('0x8d')])){throw new db[(_0x4494('0x19'))][(_0x4494('0x1a'))](_0x4494('0x8e'));}if(_[_0x4494('0x7b')](_0x37e665[_0x4494('0x5c')][_0x4494('0x5c')])||_0x37e665[_0x4494('0x5c')][_0x4494('0x5c')]===''){throw new db[(_0x4494('0x19'))][(_0x4494('0x1a'))](_0x4494('0x8f'));}if(_[_0x4494('0x7b')](_0x37e665[_0x4494('0x5c')]['mapKey'])){throw new db[(_0x4494('0x19'))][(_0x4494('0x1a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x215599);}if(!_[_0x4494('0x90')](_0x215599,_0x37e665[_0x4494('0x5c')][_0x4494('0x91')])){throw new db['Sequelize'][(_0x4494('0x1a'))](_0x4494('0x92')+_0x215599);}_0x476674[_0x37e665[_0x4494('0x5c')]['mapKey']]=_0x37e665[_0x4494('0x5c')]['from'];})['then'](function(){return db[_0x4494('0x3a')][_0x4494('0x55')]({'where':{'id':_0x37e665[_0x4494('0x53')]['id']},'include':[{'model':db[_0x4494('0x93')],'as':_0x4494('0x94'),'include':[{'model':db[_0x4494('0x88')],'as':_0x4494('0x95'),'where':_0x476674,'limit':0x1,'order':[['updatedAt',_0x4494('0x96')]]}]},{'model':db[_0x4494('0x97')],'as':'Applications'}]});})[_0x4494('0x1d')](handleEntityNotFound(_0x3a32c8,null))[_0x4494('0x1d')](function(_0xb11091){if(_0xb11091&&_0xb11091[_0x4494('0x94')]){_0x5912f1[_0x4494('0x98')]=_0xb11091;_0x5912f1['applications']=_0xb11091[_0x4494('0x99')];_0x5912f1['list']=_0xb11091['List'];_0x5912f1['applications']=_['orderBy'](_0x5912f1[_0x4494('0x9a')],[_0x4494('0x9b')],[_0x4494('0x9c')]);if(_0x5912f1[_0x4494('0x98')]['Applications']){delete _0x5912f1['account'][_0x4494('0x99')];}if(_0x5912f1[_0x4494('0x98')][_0x4494('0x94')]&&_0x5912f1[_0x4494('0x98')]['List'][_0x4494('0x95')][_0x4494('0x46')]){return _0x5912f1['account'][_0x4494('0x94')][_0x4494('0x95')][0x0];}var _0x196e30=_['defaults'](_0x37e665[_0x4494('0x5c')],{'firstName':_0x37e665[_0x4494('0x5c')][_0x4494('0x8d')],'ListId':_0xb11091[_0x4494('0x9d')]});_0x196e30[_0x37e665[_0x4494('0x5c')]['mapKey']]=_0x37e665[_0x4494('0x5c')]['from'];return db[_0x4494('0x88')][_0x4494('0x56')](_0x196e30,{'fields':_0x3679bf,'raw':!![]});}})[_0x4494('0x1d')](handleEntityNotFound(_0x3a32c8,null))[_0x4494('0x1d')](function(_0x1fdae8){_0x5912f1[_0x4494('0x9e')]=_0x1fdae8;var _0x27a04f=_0x37e665[_0x4494('0x5c')][_0x4494('0x9f')];if(_0x37e665['headers'][_0x4494('0xa0')]){_0x27a04f=_0x37e665['headers']['cf-connecting-ip'];}else if(_0x37e665[_0x4494('0x85')][_0x4494('0xa1')]){_0x27a04f=_['first'](_0x37e665[_0x4494('0x85')][_0x4494('0xa1')][_0x4494('0xa2')](','));}if(_0x1fdae8){var _0x4a7cb3={'ContactId':_0x1fdae8['id'],'ChatWebsiteId':_0x37e665[_0x4494('0x53')]['id'],'from':(_0x1fdae8['firstName']||'')+'\x20'+(_0x1fdae8[_0x4494('0xa3')]||''),'customerIp':_0x27a04f,'customerPort':_0x37e665[_0x4494('0x85')]['x-real-port']?_0x37e665[_0x4494('0x85')][_0x4494('0xa4')]:null,'referer':_0x37e665[_0x4494('0x5c')][_0x4494('0xa5')],'browserName':_0x3043c9['browser']['name']&&_0x3043c9[_0x4494('0xa6')][_0x4494('0xa7')]?util[_0x4494('0xa8')]('%s\x20%s',_0x3043c9[_0x4494('0xa6')][_0x4494('0x35')],_0x3043c9['browser']['version']):_0x4494('0xa9'),'browserVersion':_0x3043c9[_0x4494('0xa6')][_0x4494('0xa7')]||_0x4494('0xa9'),'osName':util[_0x4494('0xa8')](_0x4494('0xaa'),_0x3043c9['os'][_0x4494('0x35')],_0x3043c9['os'][_0x4494('0xa7')]),'osVersion':_0x3043c9['os'][_0x4494('0xa7')],'deviceModel':_0x3043c9['device'][_0x4494('0x3f')]&&_0x3043c9['device'][_0x4494('0xab')]?util[_0x4494('0xa8')]('%s\x20%s\x20%s',_0x3043c9['device']['model'],_0x3043c9[_0x4494('0xac')]['vendor'],_0x3043c9[_0x4494('0xac')][_0x4494('0x3d')]):null,'deviceVendor':_0x3043c9[_0x4494('0xac')][_0x4494('0xab')],'deviceType':_0x3043c9[_0x4494('0xac')][_0x4494('0x3d')],'formData':JSON[_0x4494('0xad')](_0x37e665[_0x4494('0x5c')])};var _0x598b3a={'ChatWebsiteId':_0x37e665[_0x4494('0x53')]['id'],'closed':![]};if(_0x37e665[_0x4494('0x5c')][_0x4494('0xae')]){_0x598b3a['threadId']=_0x37e665[_0x4494('0x5c')][_0x4494('0xae')];return db[_0x4494('0xaf')][_0x4494('0x55')]({'where':_0x598b3a})[_0x4494('0x1d')](function(_0x183aed){if(_0x183aed){return[_0x183aed,![]];}_0x4a7cb3[_0x4494('0xae')]=_0x37e665[_0x4494('0x5c')][_0x4494('0xae')];_0x4a7cb3[_0x4494('0xb0')]=_0x37e665[_0x4494('0x5c')][_0x4494('0xb0')];return db[_0x4494('0xaf')][_0x4494('0x56')](_0x4a7cb3)[_0x4494('0x1d')](function(_0x387895){return[_0x387895,!![]];});});}_0x598b3a[_0x4494('0xb1')]=_0x1fdae8['id'];if(_0x37e665['body'][_0x4494('0xb2')]&&_0x37e665['body'][_0x4494('0xb2')]['id']){_0x598b3a['id']=_0x37e665[_0x4494('0x5c')][_0x4494('0xb2')]['id'];return db[_0x4494('0xaf')]['find']({'where':_0x598b3a})[_0x4494('0x1d')](function(_0x3ad1c3){if(_0x3ad1c3){return[_0x3ad1c3,![]];}return db[_0x4494('0xaf')][_0x4494('0x56')](_0x4a7cb3)[_0x4494('0x1d')](function(_0x1b1c4b){return[_0x1b1c4b,!![]];});});}return db[_0x4494('0xaf')][_0x4494('0x56')](_0x4a7cb3)[_0x4494('0x1d')](function(_0x1b966f){return[_0x1b966f,!![]];});}})['spread'](function(_0x5170d1,_0x5b75fe){if(_0x5170d1){_0x137b33=_0x5b75fe;if(!_0x5b75fe){var _0x326c21={'from':(_0x5912f1[_0x4494('0x9e')][_0x4494('0xb3')]||'')+'\x20'+(_0x5912f1[_0x4494('0x9e')]['lastName']||'')};if(_0x37e665[_0x4494('0x5c')][_0x4494('0xae')]&&_0x37e665[_0x4494('0x5c')][_0x4494('0xb4')]&&_0x37e665['body'][_0x4494('0xae')]!=_0x37e665[_0x4494('0x5c')][_0x4494('0xb4')]){_0x326c21['threadId']=_0x37e665[_0x4494('0x5c')]['messageId'];}return _0x5170d1[_0x4494('0x2f')](_0x326c21);}else{return _0x5170d1;}}})[_0x4494('0x1d')](function(_0x20aebc){_0x5912f1[_0x4494('0xb2')]=_0x20aebc[_0x4494('0x30')]({'plain':!![]});_0x5912f1['interaction'][_0x4494('0xb5')]=_0x137b33;if(_0x5912f1[_0x4494('0xb2')]['created']){if(_0x5912f1[_0x4494('0x98')][_0x4494('0xb6')]){_0x5912f1['applications']['push']({'id':0x0,'priority':_0x5912f1['applications'][_0x4494('0x46')]+0x1,'app':'close','appdata':_0x4494('0xb7'),'interval':_0x4494('0xb8')});}}return db[_0x4494('0xb9')][_0x4494('0x56')]({'body':_0x37e665['body'][_0x4494('0x5c')],'ChatWebsiteId':_0x37e665[_0x4494('0x53')]['id'],'ChatInteractionId':_0x20aebc['id'],'direction':'in','ContactId':_0x5912f1[_0x4494('0x9e')]['id'],'AttachmentId':_0x37e665[_0x4494('0x5c')][_0x4494('0xba')]});})[_0x4494('0x1d')](function(_0x21c112){_0x5912f1['message']=_0x21c112;if(_0x5912f1[_0x4494('0xb2')][_0x4494('0xbb')]){return db[_0x4494('0xbc')][_0x4494('0x55')]({'attributes':['id',_0x4494('0x35')],'where':{'id':_0x5912f1[_0x4494('0xb2')][_0x4494('0xbb')]}})[_0x4494('0x1d')](function(_0x55bd87){if(_0x55bd87){_0x5912f1[_0x4494('0x9a')]['unshift']({'id':0x0,'priority':0x0,'app':_0x4494('0xbd'),'appdata':_0x55bd87[_0x4494('0x35')]+','+(_0x5912f1['account'][_0x4494('0xbe')]||0xa),'interval':_0x4494('0xb8')});_0x5912f1[_0x4494('0xbf')]=!![];}return respondWithRpcPromise('Start',_0x4494('0xc0'),_0x5912f1);});}return respondWithRpcPromise(_0x4494('0xc1'),_0x4494('0xc0'),_0x5912f1);})[_0x4494('0x1d')](function(_0x1b12ee){respondWithRpcPromise(_0x4494('0xc2'),_0x4494('0xc2'),{'event':_0x4494('0x84'),'message':_0x1b12ee},client9002);return _0x1b12ee;})[_0x4494('0x1d')](respondWithResult(_0x3a32c8,null))['catch'](handleError(_0x3a32c8,null));};exports[_0x4494('0xc3')]=function(_0x234e22,_0x9a63ef,_0x1b11a6){var _0x3afc45,_0x416d65,_0x40b319;var _0x338215=[];var _0x40be0f=[];var _0x3ace0b={};return db[_0x4494('0x88')]['describe']()[_0x4494('0x1d')](function(_0x46758d){if(!_0x46758d){throw new db[(_0x4494('0x19'))][(_0x4494('0x1a'))]('no\x20available\x20attributes');}_0x40be0f=_[_0x4494('0x8a')](_[_0x4494('0x41')](_0x46758d),[_0x4494('0x8b'),_0x4494('0x8c')]);_0x338215=_[_0x4494('0x8a')](_['keys'](_0x46758d),[_0x4494('0x8b'),_0x4494('0x8c'),_0x4494('0xc4'),'ListId']);if(_0x234e22[_0x4494('0x5c')]['id']){delete _0x234e22[_0x4494('0x5c')]['id'];}if(_['isNil'](_0x234e22['body'][_0x4494('0x8d')])){throw _0x9a63ef[_0x4494('0x27')](0x1f4)['send'](new db[(_0x4494('0x19'))][(_0x4494('0x1a'))](_0x4494('0x8e')));}if(_[_0x4494('0x7b')](_0x234e22['body']['body'])||_0x234e22[_0x4494('0x5c')]['body']===''){throw _0x9a63ef[_0x4494('0x27')](0x1f4)['send'](new db[(_0x4494('0x19'))][(_0x4494('0x1a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x234e22['body']['mapKeyOffline'])){throw _0x9a63ef['status'](0x1f4)[_0x4494('0x36')](new db[(_0x4494('0x19'))][(_0x4494('0x1a'))](_0x4494('0xc5')+_0x338215));}if(!_[_0x4494('0x90')](_0x338215,_0x234e22[_0x4494('0x5c')][_0x4494('0xc6')])){throw _0x9a63ef[_0x4494('0x27')](0x1f4)['send'](new db['Sequelize'][(_0x4494('0x1a'))](_0x4494('0xc7')+_0x338215));}_0x3ace0b[_0x234e22[_0x4494('0x5c')]['mapKeyOffline']]=_0x234e22['body']['from'];})[_0x4494('0x1d')](function(){return db[_0x4494('0x3a')][_0x4494('0x55')]({'where':{'id':_0x234e22['params']['id']},'include':[{'model':db[_0x4494('0x93')],'as':_0x4494('0x94')}]});})[_0x4494('0x1d')](handleEntityNotFound(_0x9a63ef,null))[_0x4494('0x1d')](function(_0x780083){if(_0x780083&&_0x780083[_0x4494('0x94')]){_0x416d65=_0x780083;var _0x429321=_['defaults'](_0x234e22['body'],{'firstName':_0x234e22[_0x4494('0x5c')][_0x4494('0x8d')],'phone':_0x234e22[_0x4494('0x5c')][_0x4494('0x8d')],'ListId':_0x780083[_0x4494('0x9d')]});_0x429321[_0x234e22['body'][_0x4494('0xc6')]]=_0x234e22[_0x4494('0x5c')][_0x4494('0x8d')];return db[_0x4494('0x88')][_0x4494('0xc8')]({'where':_0x3ace0b,'defaults':_0x429321});}})[_0x4494('0xc9')](function(_0x4c6679){if(_0x4c6679){_0x40b319=_0x4c6679;var _0x1f2f62=fs[_0x4494('0xca')](path[_0x4494('0x75')](config[_0x4494('0x76')],_0x4494('0xcb')),'utf8');var _0xc154cf=ejs[_0x4494('0xcc')](_0x1f2f62,{'body':_[_0x4494('0xcd')](_0x234e22[_0x4494('0x5c')][_0x4494('0x5c')]),'bodyTitle':_0x416d65['offlineMessageBody']});return db['ChatOfflineMessage'][_0x4494('0x56')]({'body':_0xc154cf,'ContactId':_0x4c6679['id'],'ChatWebsiteId':_0x416d65['id']});}})[_0x4494('0x1d')](function(_0x193f55){if(_0x193f55){_0x3afc45=_0x193f55;return db[_0x4494('0xce')][_0x4494('0x63')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})[_0x4494('0x1d')](function(_0x391115){if(_0x391115&&_0x391115['Smtp']&&_0x416d65[_0x4494('0xcf')]){var _0x2f461b={'tls':{'rejectUnauthorized':![]}};if(_0x391115[_0x4494('0xd0')][_0x4494('0xd1')]){_0x2f461b[_0x4494('0xd1')]=_0x391115[_0x4494('0xd0')][_0x4494('0xd1')];}else{_0x2f461b[_0x4494('0xd2')]=_0x391115[_0x4494('0xd0')][_0x4494('0xd2')];_0x2f461b[_0x4494('0xd3')]=_0x391115[_0x4494('0xd0')][_0x4494('0xd3')];_0x2f461b['secure']=_0x391115['Smtp']['secure'];}if(_0x391115[_0x4494('0xd0')]['authentication']){_0x2f461b['auth']={'user':_0x391115[_0x4494('0xd0')][_0x4494('0x57')],'pass':_0x391115[_0x4494('0xd0')][_0x4494('0xd4')]};}return respondWithRpcPromise(_0x4494('0xd5'),'sendMail',{'account':_0x2f461b,'message':{'from':util[_0x4494('0xa8')]('\x22%s\x22\x20<%s>',_0x391115[_0x4494('0x35')],_0x391115[_0x4494('0xd6')]||_0x391115[_0x4494('0xd0')][_0x4494('0x57')]),'to':_0x416d65['forwardOfflineAddress'],'subject':_0x416d65[_0x4494('0xd7')],'text':_0x3afc45['body']}},client9003)[_0x4494('0x1d')](function(){return _0x3afc45;})['catch'](function(_0x341b8c){console[_0x4494('0x21')](_0x341b8c);});}})[_0x4494('0x1d')](function(){if(_0x3afc45){return _0x3afc45;}})[_0x4494('0x1d')](respondWithResult(_0x9a63ef,null))[_0x4494('0x25')](handleError(_0x9a63ef,null));};exports[_0x4494('0xd8')]=function(_0x241945,_0x51c585,_0xbe8f1b){return db[_0x4494('0xaf')][_0x4494('0x55')]({'where':{'id':_0x241945[_0x4494('0x53')]['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x51c585,null))[_0x4494('0x1d')](function(_0x411ce3){if(_0x411ce3){return _0x411ce3['addInteraction'](_0x241945['body'][_0x4494('0x67')],_[_0x4494('0xd9')](_0x241945[_0x4494('0x5c')],[_0x4494('0x67'),'id'])||{});}})[_0x4494('0x1d')](respondWithResult(_0x51c585,null))[_0x4494('0x25')](handleError(_0x51c585,null));};exports[_0x4494('0xda')]=function(_0x1d4a98,_0x10bf93,_0x3a1aab){var _0x306847={'raw':![],'where':{}};var _0x1949b0={};var _0x2a3c21={'count':0x0,'rows':[]};return db[_0x4494('0x3a')]['findOne']({'where':{'id':_0x1d4a98[_0x4494('0x53')]['id']}})['then'](handleEntityNotFound(_0x10bf93,null))[_0x4494('0x1d')](function(_0x2f6851){if(_0x2f6851){_0x1949b0[_0x4494('0x3f')]=_[_0x4494('0x41')](db[_0x4494('0xaf')][_0x4494('0x3b')]);_0x1949b0['query']=_[_0x4494('0x41')](_0x1d4a98[_0x4494('0x40')]);_0x1949b0['filters']=_[_0x4494('0x43')](_0x1949b0['model'],_0x1949b0[_0x4494('0x40')]);_0x306847[_0x4494('0x45')]=_[_0x4494('0x43')](_0x1949b0[_0x4494('0x3f')],qs[_0x4494('0x44')](_0x1d4a98['query'][_0x4494('0x44')]));_0x306847[_0x4494('0x45')]=_0x306847[_0x4494('0x45')][_0x4494('0x46')]?_0x306847[_0x4494('0x45')]:_0x1949b0[_0x4494('0x3f')];if(!_0x1d4a98['query']['hasOwnProperty'](_0x4494('0x64'))){_0x306847[_0x4494('0x2b')]=qs[_0x4494('0x2b')](_0x1d4a98[_0x4494('0x40')][_0x4494('0x2b')]);_0x306847['offset']=qs[_0x4494('0x2a')](_0x1d4a98[_0x4494('0x40')]['offset']);}_0x306847[_0x4494('0x48')]=qs[_0x4494('0x49')](_0x1d4a98[_0x4494('0x40')][_0x4494('0x49')]);_0x306847[_0x4494('0x4c')]=qs[_0x4494('0x42')](_[_0x4494('0x65')](_0x1d4a98[_0x4494('0x40')],_0x1949b0[_0x4494('0x42')]));_0x306847[_0x4494('0x4c')][_0x4494('0x60')]=_0x2f6851['id'];if(_0x1d4a98['query']['filter']){_0x306847[_0x4494('0x4c')]=_['merge'](_0x306847[_0x4494('0x4c')],{'$or':_[_0x4494('0x39')](_0x306847[_0x4494('0x45')],function(_0xdffc87){var _0x3ddf4b={};_0x3ddf4b[_0xdffc87]={'$like':'%'+_0x1d4a98['query'][_0x4494('0x4a')]+'%'};return _0x3ddf4b;})});}_0x306847=_['merge']({},_0x306847,_0x1d4a98[_0x4494('0x54')]);return db[_0x4494('0xaf')][_0x4494('0x29')]({'where':_0x306847['where']})[_0x4494('0x1d')](function(_0x292303){_0x2a3c21[_0x4494('0x29')]=_0x292303;if(_0x1d4a98[_0x4494('0x40')][_0x4494('0x4e')]){_0x306847[_0x4494('0x4f')]=[{'model':db[_0x4494('0x88')],'as':_0x4494('0xdb'),'required':![]},{'model':db[_0x4494('0xbc')],'as':_0x4494('0xdc'),'attributes':[_0x4494('0x35'),'fullname',_0x4494('0xdd')],'required':![]},{'model':db['Tag'],'as':_0x4494('0xde'),'attributes':['id',_0x4494('0x35'),_0x4494('0xdf')],'where':_0x1d4a98[_0x4494('0x40')]['tag']?{'id':_0x1d4a98[_0x4494('0x40')][_0x4494('0xe0')]}:undefined,'required':_0x1d4a98[_0x4494('0x40')][_0x4494('0xe0')]?!![]:![]}];}return db[_0x4494('0xaf')][_0x4494('0x50')](_0x306847);})['then'](function(_0x3eceb5){_0x2a3c21[_0x4494('0x51')]=_0x3eceb5;return _0x2a3c21;});}})[_0x4494('0x1d')](respondWithFilteredResult(_0x10bf93,_0x306847))[_0x4494('0x25')](handleError(_0x10bf93,null));};function iftimePromise(_0xba356f,_0x3a6ae8){return respondWithRpcPromise(_0x4494('0xe1'),_0x4494('0xe2'),{'command':_0x3a6ae8[_0x4494('0xe3')]?util[_0x4494('0xa8')](_0x4494('0xe4'),_0xba356f['interval'],_0x3a6ae8[_0x4494('0xe3')]):util[_0x4494('0xa8')](_0x4494('0xe5'),_0xba356f['interval'])},client9002)['then'](function(_0x2b2c2d){var _0x42beba=_0x2b2c2d&&_0x2b2c2d[_0x4494('0xe6')](_0x4494('0xe7'))>=0x0?!![]:![];logger[_0x4494('0x1e')](_0x4494('0xe8'),_0x3a6ae8['id'],_0xba356f['id'],_0xba356f[_0x4494('0xe9')],_0x42beba?_0x4494('0xea'):_0x4494('0xeb'),_0x3a6ae8[_0x4494('0xe3')]?_0x3a6ae8[_0x4494('0xe3')]:_0x4494('0xec'));return _0x42beba;})['catch'](function(_0xbc3860){logger['error'](_0x4494('0xe8'),_0x3a6ae8['id'],_0xba356f['id'],_0xba356f[_0x4494('0xe9')],util[_0x4494('0xed')](_0xbc3860,{'showHidden':![],'depth':null}),_0x3a6ae8[_0x4494('0xe3')]?_0x3a6ae8[_0x4494('0xe3')]:'No\x20timezone');return![];});}exports[_0x4494('0xe2')]=function(_0x5ea6d6,_0x223689,_0x488702){var _0x4c937a=0x0;var _0x5dcb9a=0x0;var _0x2b97fc=![];var _0x28a8d4;var _0x440ae6;return db[_0x4494('0x3a')]['find']({'where':{'id':_0x5ea6d6[_0x4494('0x53')]['id']},'include':[{'model':db[_0x4494('0xee')],'as':_0x4494('0xee'),'include':[{'model':db[_0x4494('0xee')],'as':_0x4494('0xef'),'attributes':['id',_0x4494('0xe9')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x223689,null))[_0x4494('0x1d')](function(_0x52c3e9){if(_0x52c3e9){_0x28a8d4=_0x52c3e9;return _0x52c3e9[_0x4494('0xf0')]({'raw':!![]});}})[_0x4494('0x1d')](function(_0x2f509c){if(_0x28a8d4){if(_0x2f509c){_0x440ae6=_0x2f509c;}}return require('../../config/license/util')[_0x4494('0x79')]();})[_0x4494('0x1d')](function(_0x4f8b43){if(_0x4f8b43){_0x5dcb9a=_0x4f8b43[_0x4494('0xf1')];_0x2b97fc=_0x4f8b43['custom'];}})['then'](function(){return db['ChatInteraction'][_0x4494('0x29')]({'where':{'closed':![]}});})[_0x4494('0x1d')](function(_0x2506ef){_0x4c937a=_0x2506ef;if(_0x5dcb9a&&_0x2506ef>_0x5dcb9a){return db[_0x4494('0xf2')][_0x4494('0x63')]({'where':{'id':0x1}})[_0x4494('0x1d')](function(_0x164b53){if(_0x164b53){_0x164b53[_0x4494('0xf3')](_0x4494('0xf4'));}});}})[_0x4494('0x1d')](function(){if(_0x28a8d4[_0x4494('0xee')]&&_0x28a8d4[_0x4494('0xee')][_0x4494('0xef')]){var _0x4570d7=[];for(var _0x332a37=0x0;_0x332a37<_0x28a8d4[_0x4494('0xee')][_0x4494('0xef')][_0x4494('0x46')];_0x332a37++){var _0x568da6=_0x28a8d4[_0x4494('0xee')][_0x4494('0xef')][_0x332a37][_0x4494('0x30')]({'plain':!![]});_0x4570d7[_0x4494('0xf5')](iftimePromise(_0x568da6,_0x28a8d4));}return BPromise[_0x4494('0xf6')](_0x4570d7)[_0x4494('0x1d')](function(_0x2c2f15){return _[_0x4494('0xf7')](_0x2c2f15);});}else{return!![];}})[_0x4494('0x1d')](function(_0x4fc543){var _0x3a9c67=fs[_0x4494('0xca')](path[_0x4494('0x75')](config[_0x4494('0x76')],_0x4494('0xf8')),_0x4494('0xf9'));var _0x2aaebe={'remote':_0x28a8d4[_0x4494('0xfa')],'query':querystring['stringify'](_[_0x4494('0x4b')](_0x28a8d4[_0x4494('0x30')]({'plain':!![]}),{'customerIp':_0x5ea6d6[_0x4494('0x85')][_0x4494('0xa1')]||_0x5ea6d6[_0x4494('0x85')][_0x4494('0xfb')]||_0x5ea6d6[_0x4494('0xfc')]['remoteAddress']||_0x5ea6d6['ip'],'referer':_0x5ea6d6['headers'][_0x4494('0xa5')],'openedInteractions':_0x4c937a,'maxInteractions':_0x5dcb9a,'virtual':_0x2b97fc[_0x4494('0xf1')],'online':_0x4fc543,'custom':_0x2b97fc}))[_0x4494('0xfd')](/'/g,'\x5c\x27')};_0x223689[_0x4494('0x36')](ejs[_0x4494('0xcc')](Mustache[_0x4494('0xcc')](_0x3a9c67,_0x2aaebe),{'proactiveActions':_0x440ae6,'alignment':_0x28a8d4['alignment'],'verticalAlignment':_0x28a8d4['verticalAlignment'],'div_color':_0x28a8d4[_0x4494('0xdf')],'text_color':_0x28a8d4[_0x4494('0xfe')]}));})['catch'](handleError(_0x223689,null));};exports[_0x4494('0xff')]=function(_0x32e959,_0x147c07,_0x3e2731){return db[_0x4494('0x3a')][_0x4494('0x63')]({'where':{'id':_0x32e959['params']['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x147c07,null))[_0x4494('0x1d')](function(_0x233541){if(_0x233541){return db[_0x4494('0x100')]['transaction'](function(_0x391bdd){return db[_0x4494('0x97')][_0x4494('0x5d')]({'where':{'ChatWebsiteId':_0x32e959[_0x4494('0x53')]['id']},'transaction':_0x391bdd})[_0x4494('0x1d')](function(_0xe4f6fa){var _0x20265d=_[_0x4494('0x39')](_0x32e959[_0x4494('0x5c')],function(_0x2e92eb){_0x2e92eb[_0x4494('0x60')]=_0x32e959[_0x4494('0x53')]['id'];return _0x2e92eb;});return db[_0x4494('0x97')][_0x4494('0x101')](_0x20265d,{'transaction':_0x391bdd});});})['then'](function(){return db[_0x4494('0x97')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x32e959[_0x4494('0x53')]['id']},'order':_0x4494('0x9b')});});}})[_0x4494('0x1d')](respondWithResult(_0x147c07,null))[_0x4494('0x25')](handleError(_0x147c07,null));};exports['getApplications']=function(_0x38159c,_0x3c1e4c,_0x1f777d){var _0x404a22={};var _0x149395={};var _0x33a052;var _0x2c2f8c;return db[_0x4494('0x3a')][_0x4494('0x63')]({'where':{'id':_0x38159c[_0x4494('0x53')]['id']}})['then'](handleEntityNotFound(_0x3c1e4c,null))[_0x4494('0x1d')](function(_0x20a428){if(_0x20a428){_0x33a052=_0x20a428;_0x149395[_0x4494('0x3f')]=_[_0x4494('0x41')](db[_0x4494('0x97')][_0x4494('0x3b')]);_0x149395[_0x4494('0x40')]=_[_0x4494('0x41')](_0x38159c[_0x4494('0x40')]);_0x149395[_0x4494('0x42')]=_[_0x4494('0x43')](_0x149395[_0x4494('0x3f')],_0x149395[_0x4494('0x40')]);_0x404a22[_0x4494('0x45')]=_[_0x4494('0x43')](_0x149395[_0x4494('0x3f')],qs[_0x4494('0x44')](_0x38159c[_0x4494('0x40')][_0x4494('0x44')]));_0x404a22[_0x4494('0x45')]=_0x404a22[_0x4494('0x45')][_0x4494('0x46')]?_0x404a22[_0x4494('0x45')]:_0x149395[_0x4494('0x3f')];_0x404a22[_0x4494('0x48')]=qs[_0x4494('0x49')](_0x38159c[_0x4494('0x40')][_0x4494('0x49')]);_0x404a22[_0x4494('0x4c')]=qs[_0x4494('0x42')](_['pick'](_0x38159c['query'],_0x149395[_0x4494('0x42')]));if(_0x38159c['query'][_0x4494('0x4a')]){_0x404a22[_0x4494('0x4c')]=_['merge'](_0x404a22[_0x4494('0x4c')],{'$or':_[_0x4494('0x39')](_0x404a22[_0x4494('0x45')],function(_0x5dbbdc){var _0x493d28={};_0x493d28[_0x5dbbdc]={'$like':'%'+_0x38159c[_0x4494('0x40')]['filter']+'%'};return _0x493d28;})});}_0x404a22=_['merge']({},_0x404a22,_0x38159c[_0x4494('0x54')]);return _0x33a052[_0x4494('0x102')](_0x404a22);}})['then'](function(_0x45571b){if(_0x45571b){_0x2c2f8c=_0x45571b[_0x4494('0x46')];if(!_0x38159c['query'][_0x4494('0x47')](_0x4494('0x64'))){_0x404a22['limit']=qs[_0x4494('0x2b')](_0x38159c[_0x4494('0x40')][_0x4494('0x2b')]);_0x404a22[_0x4494('0x2a')]=qs['offset'](_0x38159c['query']['offset']);}return _0x33a052[_0x4494('0x102')](_0x404a22);}})['then'](function(_0x49cab3){if(_0x49cab3){return _0x49cab3?{'count':_0x2c2f8c,'rows':_0x49cab3}:null;}})[_0x4494('0x1d')](respondWithResult(_0x3c1e4c,null))[_0x4494('0x25')](handleError(_0x3c1e4c,null));};exports[_0x4494('0x103')]=function(_0x1de488,_0x5bd076,_0x1d566e){return db[_0x4494('0x104')][_0x4494('0x55')]({'where':{'id':_0x1de488[_0x4494('0x53')]['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x5bd076,null))['then'](function(_0x554c99){if(_0x554c99){return _0x554c99['addProactiveActions'](_0x1de488[_0x4494('0x5c')][_0x4494('0x67')],_['omit'](_0x1de488['body'],['ids','id'])||{});}})[_0x4494('0x1d')](respondWithResult(_0x5bd076,null))[_0x4494('0x25')](handleError(_0x5bd076,null));};exports[_0x4494('0xf0')]=function(_0x228b75,_0x28c068,_0x13f01c){var _0x46bcd8={};var _0x11e8f9={};var _0x395b21;var _0x236e50;return db[_0x4494('0x3a')]['findOne']({'where':{'id':_0x228b75[_0x4494('0x53')]['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x28c068,null))['then'](function(_0xffb6ac){if(_0xffb6ac){_0x395b21=_0xffb6ac;_0x11e8f9[_0x4494('0x3f')]=_[_0x4494('0x41')](db[_0x4494('0x105')]['rawAttributes']);_0x11e8f9[_0x4494('0x40')]=_[_0x4494('0x41')](_0x228b75['query']);_0x11e8f9[_0x4494('0x42')]=_[_0x4494('0x43')](_0x11e8f9[_0x4494('0x3f')],_0x11e8f9['query']);_0x46bcd8['attributes']=_[_0x4494('0x43')](_0x11e8f9[_0x4494('0x3f')],qs['fields'](_0x228b75['query'][_0x4494('0x44')]));_0x46bcd8[_0x4494('0x45')]=_0x46bcd8[_0x4494('0x45')][_0x4494('0x46')]?_0x46bcd8[_0x4494('0x45')]:_0x11e8f9[_0x4494('0x3f')];_0x46bcd8[_0x4494('0x48')]=qs[_0x4494('0x49')](_0x228b75[_0x4494('0x40')][_0x4494('0x49')]);_0x46bcd8[_0x4494('0x4c')]=qs[_0x4494('0x42')](_[_0x4494('0x65')](_0x228b75['query'],_0x11e8f9['filters']));if(_0x228b75[_0x4494('0x40')][_0x4494('0x4a')]){_0x46bcd8[_0x4494('0x4c')]=_[_0x4494('0x4b')](_0x46bcd8['where'],{'$or':_[_0x4494('0x39')](_0x46bcd8[_0x4494('0x45')],function(_0x383ee8){var _0x4c677f={};_0x4c677f[_0x383ee8]={'$like':'%'+_0x228b75['query']['filter']+'%'};return _0x4c677f;})});}_0x46bcd8=_['merge']({},_0x46bcd8,_0x228b75['options']);return _0x395b21[_0x4494('0xf0')](_0x46bcd8);}})[_0x4494('0x1d')](function(_0xd37ffa){if(_0xd37ffa){_0x236e50=_0xd37ffa[_0x4494('0x46')];if(!_0x228b75[_0x4494('0x40')][_0x4494('0x47')]('nolimit')){_0x46bcd8['limit']=qs[_0x4494('0x2b')](_0x228b75[_0x4494('0x40')][_0x4494('0x2b')]);_0x46bcd8['offset']=qs[_0x4494('0x2a')](_0x228b75[_0x4494('0x40')][_0x4494('0x2a')]);}return _0x395b21[_0x4494('0xf0')](_0x46bcd8);}})[_0x4494('0x1d')](function(_0x1ca618){if(_0x1ca618){return _0x1ca618?{'count':_0x236e50,'rows':_0x1ca618}:null;}})[_0x4494('0x1d')](respondWithResult(_0x28c068,null))['catch'](handleError(_0x28c068,null));};exports[_0x4494('0x106')]=function(_0x80c1bf,_0x2a8ef4,_0x14e219){var _0x5ace67=_0x80c1bf[_0x4494('0x40')]['online']===_0x4494('0x107')?'offlineForm':_0x4494('0x108');return db[_0x4494('0x3a')][_0x4494('0x55')]({'attributes':['id',_0x5ace67],'where':{'id':_0x80c1bf[_0x4494('0x53')]['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x2a8ef4,null))[_0x4494('0x1d')](function(_0x21a627){if(_0x21a627){var _0x32d162=_0x21a627[_0x5ace67];var _0x192c95=_0x32d162&&_0x32d162[_0x4494('0x109')]?_0x32d162[_0x4494('0x109')]:[];_0x2a8ef4[_0x4494('0x36')]({'fromKey':_[_0x4494('0x7b')](_0x32d162[_0x4494('0x10a')])?undefined:_0x32d162[_0x4494('0x10a')],'count':_0x192c95[_0x4494('0x46')],'rows':_0x192c95});}})[_0x4494('0x25')](handleError(_0x2a8ef4,null));};exports[_0x4494('0x10b')]=function(_0x245bcc,_0x585487,_0x5d89ea){var _0x4b86d3={'raw':![],'where':{}};var _0x37583e={};var _0x55bc5a={'count':0x0,'rows':[]};return db[_0x4494('0x3a')][_0x4494('0x63')]({'where':{'id':_0x245bcc[_0x4494('0x53')]['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x585487,null))[_0x4494('0x1d')](function(_0x383c4e){if(_0x383c4e){_0x37583e[_0x4494('0x3f')]=_[_0x4494('0x41')](db['ChatOfflineMessage'][_0x4494('0x3b')]);_0x37583e[_0x4494('0x40')]=_[_0x4494('0x41')](_0x245bcc[_0x4494('0x40')]);_0x37583e[_0x4494('0x42')]=_[_0x4494('0x43')](_0x37583e[_0x4494('0x3f')],_0x37583e[_0x4494('0x40')]);_0x4b86d3[_0x4494('0x45')]=_['intersection'](_0x37583e[_0x4494('0x3f')],qs[_0x4494('0x44')](_0x245bcc['query'][_0x4494('0x44')]));_0x4b86d3[_0x4494('0x45')]=_0x4b86d3[_0x4494('0x45')][_0x4494('0x46')]?_0x4b86d3[_0x4494('0x45')]:_0x37583e['model'];if(!_0x245bcc[_0x4494('0x40')]['hasOwnProperty']('nolimit')){_0x4b86d3['limit']=qs[_0x4494('0x2b')](_0x245bcc['query'][_0x4494('0x2b')]);_0x4b86d3['offset']=qs[_0x4494('0x2a')](_0x245bcc[_0x4494('0x40')][_0x4494('0x2a')]);}_0x4b86d3[_0x4494('0x48')]=qs[_0x4494('0x49')](_0x245bcc[_0x4494('0x40')][_0x4494('0x49')]);_0x4b86d3[_0x4494('0x4c')]=qs['filters'](_[_0x4494('0x65')](_0x245bcc[_0x4494('0x40')],_0x37583e[_0x4494('0x42')]));_0x4b86d3[_0x4494('0x4c')][_0x4494('0x60')]=_0x383c4e['id'];if(_0x245bcc[_0x4494('0x40')]['filter']){_0x4b86d3['where']=_['merge'](_0x4b86d3['where'],{'$or':_['map'](_0x4b86d3['attributes'],function(_0xcd39e8){var _0x49f3ac={};_0x49f3ac[_0xcd39e8]={'$like':'%'+_0x245bcc[_0x4494('0x40')]['filter']+'%'};return _0x49f3ac;})});}_0x4b86d3=_[_0x4494('0x4b')]({},_0x4b86d3,_0x245bcc[_0x4494('0x54')]);return db['ChatOfflineMessage'][_0x4494('0x29')]({'where':_0x4b86d3[_0x4494('0x4c')]})[_0x4494('0x1d')](function(_0x4af615){_0x55bc5a[_0x4494('0x29')]=_0x4af615;if(_0x245bcc[_0x4494('0x40')][_0x4494('0x4e')]){_0x4b86d3['include']=[{'all':!![]}];}else{_0x4b86d3['include']=[{'model':db['CmContact'],'as':_0x4494('0xdb'),'required':![]}];}return db['ChatOfflineMessage'][_0x4494('0x50')](_0x4b86d3);})[_0x4494('0x1d')](function(_0x7d09dd){_0x55bc5a[_0x4494('0x51')]=_0x7d09dd;return _0x55bc5a;});}})[_0x4494('0x1d')](respondWithFilteredResult(_0x585487,_0x4b86d3))[_0x4494('0x25')](handleError(_0x585487,null));};exports['addAgents']=function(_0x39d5de,_0x2688ce,_0x16e537){return db[_0x4494('0x3a')][_0x4494('0x55')]({'where':{'id':_0x39d5de[_0x4494('0x53')]['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x2688ce,null))[_0x4494('0x1d')](function(_0xc725ef){if(_0xc725ef){return _0xc725ef['addAgents'](_0x39d5de[_0x4494('0x5c')][_0x4494('0x67')],_[_0x4494('0xd9')](_0x39d5de[_0x4494('0x5c')],['ids','id'])||{})[_0x4494('0xc9')](function(_0x252f11){for(var _0x269d26=0x0;_0x269d26<_0x39d5de['body'][_0x4494('0x67')][_0x4494('0x46')];_0x269d26+=0x1){socket[_0x4494('0x10c')](_0x4494('0x10d'),{'UserId':_0x39d5de['body']['ids'][_0x269d26],'ChatWebsiteId':_0x39d5de['params']['id']});}return _0x252f11;});}})[_0x4494('0x1d')](respondWithResult(_0x2688ce,null))['catch'](handleError(_0x2688ce,null));};exports[_0x4494('0x10e')]=function(_0x47dcd2,_0x57b3ff,_0x5c4727){return db['ChatWebsite']['find']({'where':{'id':_0x47dcd2['params']['id']}})[_0x4494('0x1d')](handleEntityNotFound(_0x57b3ff,null))[_0x4494('0x1d')](function(_0xe6425f){if(_0xe6425f){return _0xe6425f[_0x4494('0x10e')](_0x47dcd2['query']['ids'])[_0x4494('0x1d')](function(){if(_[_0x4494('0x10f')](_0x47dcd2[_0x4494('0x40')][_0x4494('0x67')])){for(var _0x14f6f3=0x0;_0x14f6f3<_0x47dcd2[_0x4494('0x40')][_0x4494('0x67')][_0x4494('0x46')];_0x14f6f3+=0x1){socket[_0x4494('0x10c')](_0x4494('0x110'),{'UserId':Number(_0x47dcd2['query'][_0x4494('0x67')][_0x14f6f3]),'ChatWebsiteId':Number(_0x47dcd2[_0x4494('0x53')]['id'])});}}else{socket[_0x4494('0x10c')]('userChatWebsite:remove',{'UserId':Number(_0x47dcd2[_0x4494('0x40')][_0x4494('0x67')]),'ChatWebsiteId':Number(_0x47dcd2[_0x4494('0x53')]['id'])});}});}})[_0x4494('0x1d')](respondWithStatusCode(_0x57b3ff,null))[_0x4494('0x25')](handleError(_0x57b3ff,null));};exports[_0x4494('0x111')]=function(_0x204eaf,_0x2f0e06,_0xc2d935){var _0x245036={};var _0x96907e={};var _0x20ca68;var _0x408d8b;return db[_0x4494('0x3a')]['findOne']({'where':{'id':_0x204eaf['params']['id']}})['then'](handleEntityNotFound(_0x2f0e06,null))[_0x4494('0x1d')](function(_0x54632c){if(_0x54632c){_0x20ca68=_0x54632c;_0x96907e[_0x4494('0x3f')]=_[_0x4494('0x41')](db['User']['rawAttributes']);_0x96907e[_0x4494('0x40')]=_[_0x4494('0x41')](_0x204eaf[_0x4494('0x40')]);_0x96907e[_0x4494('0x42')]=_[_0x4494('0x43')](_0x96907e['model'],_0x96907e['query']);_0x245036[_0x4494('0x45')]=_[_0x4494('0x43')](_0x96907e[_0x4494('0x3f')],qs[_0x4494('0x44')](_0x204eaf[_0x4494('0x40')][_0x4494('0x44')]));_0x245036[_0x4494('0x45')]=_0x245036[_0x4494('0x45')][_0x4494('0x46')]?_0x245036[_0x4494('0x45')]:_0x96907e[_0x4494('0x3f')];_0x245036[_0x4494('0x48')]=qs[_0x4494('0x49')](_0x204eaf[_0x4494('0x40')][_0x4494('0x49')]);_0x245036[_0x4494('0x4c')]=qs[_0x4494('0x42')](_[_0x4494('0x65')](_0x204eaf[_0x4494('0x40')],_0x96907e['filters']));if(_0x204eaf['query'][_0x4494('0x4a')]){_0x245036[_0x4494('0x4c')]=_[_0x4494('0x4b')](_0x245036[_0x4494('0x4c')],{'$or':_[_0x4494('0x39')](_0x245036[_0x4494('0x45')],function(_0x21fc31){var _0x523a86={};_0x523a86[_0x21fc31]={'$like':'%'+_0x204eaf['query']['filter']+'%'};return _0x523a86;})});}_0x245036=_[_0x4494('0x4b')]({},_0x245036,_0x204eaf[_0x4494('0x54')]);return _0x20ca68['getAgents'](_0x245036);}})[_0x4494('0x1d')](function(_0x269675){if(_0x269675){_0x408d8b=_0x269675[_0x4494('0x46')];if(!_0x204eaf['query'][_0x4494('0x47')](_0x4494('0x64'))){_0x245036[_0x4494('0x2b')]=qs[_0x4494('0x2b')](_0x204eaf[_0x4494('0x40')][_0x4494('0x2b')]);_0x245036['offset']=qs[_0x4494('0x2a')](_0x204eaf[_0x4494('0x40')][_0x4494('0x2a')]);}return _0x20ca68[_0x4494('0x111')](_0x245036);}})[_0x4494('0x1d')](function(_0x12528b){if(_0x12528b){return _0x12528b?{'count':_0x408d8b,'rows':_0x12528b}:null;}})[_0x4494('0x1d')](respondWithResult(_0x2f0e06,null))['catch'](handleError(_0x2f0e06,null));}; \ No newline at end of file +var _0xa0d0=['ChatWebsite','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','keys','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','Pause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','filter','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','updatedAt','difference','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','List','Contacts','DESC','ChatApplication','Applications','account','list','applications','priority','asc','ListId','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','device','vendor','threadId','externalUrl','ChatInteraction','ContactId','interaction','contact','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','offline','createdAt','CompanyId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','findOrCreate','spread','readFileSync','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','addInteraction','omit','getInteractions','pick','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','License','chatLicenseExceeded','some','server/files/chat/iframe.js','x-real-ip','remoteAddress','render','alignment','verticalAlignment','textColor','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','addAgents','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','catch','end','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xa0d0,0xe5));var _0x0a0d=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xa0d0[_0xb0f7c3];return _0x28ea68;};'use strict';var pdf=require(_0x0a0d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0a0d('0x1'));var zipdir=require(_0x0a0d('0x2'));var jsonpatch=require(_0x0a0d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0a0d('0x4'));var Mustache=require(_0x0a0d('0x5'));var util=require(_0x0a0d('0x6'));var path=require(_0x0a0d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0a0d('0x8'));var squel=require('squel');var crypto=require(_0x0a0d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0a0d('0xa'));var toCsv=require(_0x0a0d('0xb'));var querystring=require(_0x0a0d('0xc'));var Papa=require(_0x0a0d('0xd'));var Redis=require(_0x0a0d('0xe'));var authService=require(_0x0a0d('0xf'));var qs=require(_0x0a0d('0x10'));var as=require(_0x0a0d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a0d('0x12'))(_0x0a0d('0x13'));var utils=require(_0x0a0d('0x14'));var config=require(_0x0a0d('0x15'));var db=require(_0x0a0d('0x16'))['db'];config[_0x0a0d('0x17')]=_[_0x0a0d('0x18')](config[_0x0a0d('0x17')],{'host':_0x0a0d('0x19'),'port':0x18eb});var socket=require(_0x0a0d('0x1a'))(new Redis(config['redis']));require(_0x0a0d('0x1b'))[_0x0a0d('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0a0d('0x1d')][_0x0a0d('0x1e')]({'port':0x232c});var client9002=jayson[_0x0a0d('0x1d')][_0x0a0d('0x1e')]({'port':0x232a});var client9003=jayson[_0x0a0d('0x1d')]['http']({'port':0x232b});function checkPasswordPattern(_0x2f2aa4,_0x319dc0,_0x6b120a){if(_0x6b120a){var _0x5d58cd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d58cd[_0x0a0d('0x1f')](_0x319dc0)){return _0x2f2aa4;}else{throw new db[(_0x0a0d('0x20'))]['ValidationError'](_0x0a0d('0x21'));}}else{return _0x2f2aa4;}}function respondWithRpcPromise(_0x1dd1d1,_0x308219,_0x23ccec,_0x2534a0){return new BPromise(function(_0x14872f,_0x5d58f9){var _0x2184f9=_0x2534a0||client;return _0x2184f9['request'](_0x1dd1d1,_0x23ccec)[_0x0a0d('0x22')](function(_0x5d4233){logger[_0x0a0d('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x308219,_0x0a0d('0x24'));logger['debug'](_0x0a0d('0x25'),_0x308219,_0x0a0d('0x24'),JSON[_0x0a0d('0x26')](_0x5d4233));if(_0x5d4233['error']){if(_0x5d4233[_0x0a0d('0x27')][_0x0a0d('0x28')]===0x1f4){logger[_0x0a0d('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x308219,_0x5d4233['error'][_0x0a0d('0x29')]);return _0x5d58f9(_0x5d4233[_0x0a0d('0x27')][_0x0a0d('0x29')]);}logger[_0x0a0d('0x27')](_0x0a0d('0x2a'),_0x308219,_0x5d4233['error'][_0x0a0d('0x29')]);return _0x14872f(_0x5d4233[_0x0a0d('0x27')][_0x0a0d('0x29')]);}else{logger['info'](_0x0a0d('0x2a'),_0x308219,_0x0a0d('0x24'));_0x14872f(_0x5d4233['result'][_0x0a0d('0x29')]);}})[_0x0a0d('0x2b')](function(_0x4b942a){logger[_0x0a0d('0x27')](_0x0a0d('0x2a'),_0x308219,_0x4b942a);_0x5d58f9(_0x4b942a);});});}function respondWithStatusCode(_0x33a15d,_0x4a6ad0){_0x4a6ad0=_0x4a6ad0||0xcc;return function(_0x4f172b){if(_0x4f172b){return _0x33a15d['sendStatus'](_0x4a6ad0);}return _0x33a15d['status'](_0x4a6ad0)[_0x0a0d('0x2c')]();};}function respondWithResult(_0xefc33c,_0x17bb2c){_0x17bb2c=_0x17bb2c||0xc8;return function(_0x5cf7fb){if(_0x5cf7fb){return _0xefc33c[_0x0a0d('0x2d')](_0x17bb2c)[_0x0a0d('0x2e')](_0x5cf7fb);}};}function respondWithFilteredResult(_0x2c658e,_0x143d1f){return function(_0xf514dd){if(_0xf514dd){var _0xff613e=_0xf514dd['count'],_0x16b79c=_0x143d1f['offset'],_0x67f4e0=_0x143d1f[_0x0a0d('0x2f')]+_0x143d1f[_0x0a0d('0x30')],_0x4a647c;if(_0x67f4e0>=_0xff613e){_0x67f4e0=_0xff613e;_0x4a647c=0xc8;}else{_0x4a647c=0xce;}_0x2c658e['status'](_0x4a647c);return _0x2c658e[_0x0a0d('0x31')](_0x0a0d('0x32'),_0x16b79c+'-'+_0x67f4e0+'/'+_0xff613e)['json'](_0xf514dd);}return null;};}function patchUpdates(_0x161a87){return function(_0x172bb0){try{jsonpatch[_0x0a0d('0x33')](_0x172bb0,_0x161a87,!![]);}catch(_0x17b7c5){return BPromise[_0x0a0d('0x34')](_0x17b7c5);}return _0x172bb0['save']();};}function saveUpdates(_0x178536,_0x48ef77){return function(_0x22b149){if(_0x22b149){return _0x22b149[_0x0a0d('0x35')](_0x178536)[_0x0a0d('0x22')](function(_0x22c42c){return _0x22c42c;});}return null;};}function removeEntity(_0x29d16b,_0x4cdee4){return function(_0x104328){if(_0x104328){return _0x104328[_0x0a0d('0x36')]()[_0x0a0d('0x22')](function(){var _0xb943ed=_0x104328['get']({'plain':!![]});var _0x469723='ChatWebsites';return db[_0x0a0d('0x37')]['destroy']({'where':{'type':_0x469723,'resourceId':_0xb943ed['id']}})['then'](function(){return _0x104328;});})['then'](function(){_0x29d16b[_0x0a0d('0x2d')](0xcc)[_0x0a0d('0x2c')]();});}};}function handleEntityNotFound(_0x88478e,_0x19b23b){return function(_0x385336){if(!_0x385336){_0x88478e[_0x0a0d('0x38')](0x194);}return _0x385336;};}function handleError(_0x4ddc09,_0x431216){_0x431216=_0x431216||0x1f4;return function(_0xeff190){logger[_0x0a0d('0x27')](_0xeff190[_0x0a0d('0x39')]);if(_0xeff190[_0x0a0d('0x3a')]){delete _0xeff190['name'];}_0x4ddc09['status'](_0x431216)[_0x0a0d('0x3b')](_0xeff190);};}exports[_0x0a0d('0x3c')]=function(_0x400d52,_0x13e115){var _0x4e6279={'include':[{'model':db['Pause'],'as':_0x0a0d('0x3d')}]},_0x167ded={},_0x4d73ea={'count':0x0,'rows':[]};var _0x3d11e2=_['map'](db[_0x0a0d('0x3e')][_0x0a0d('0x3f')],function(_0x2cb746){return{'name':_0x2cb746[_0x0a0d('0x40')],'type':_0x2cb746[_0x0a0d('0x41')]['key']};});_0x167ded[_0x0a0d('0x42')]=_[_0x0a0d('0x43')](_0x3d11e2,_0x0a0d('0x3a'));_0x167ded['query']=_['keys'](_0x400d52[_0x0a0d('0x44')]);_0x167ded[_0x0a0d('0x45')]=_[_0x0a0d('0x46')](_0x167ded['model'],_0x167ded[_0x0a0d('0x44')]);_0x4e6279[_0x0a0d('0x47')]=_[_0x0a0d('0x46')](_0x167ded[_0x0a0d('0x42')],qs[_0x0a0d('0x48')](_0x400d52[_0x0a0d('0x44')][_0x0a0d('0x48')]));_0x4e6279[_0x0a0d('0x47')]=_0x4e6279[_0x0a0d('0x47')]['length']?_0x4e6279[_0x0a0d('0x47')]:_0x167ded[_0x0a0d('0x42')];if(!_0x400d52[_0x0a0d('0x44')][_0x0a0d('0x49')](_0x0a0d('0x4a'))){_0x4e6279[_0x0a0d('0x30')]=qs[_0x0a0d('0x30')](_0x400d52[_0x0a0d('0x44')][_0x0a0d('0x30')]);_0x4e6279[_0x0a0d('0x2f')]=qs[_0x0a0d('0x2f')](_0x400d52[_0x0a0d('0x44')]['offset']);}_0x4e6279['order']=qs[_0x0a0d('0x4b')](_0x400d52[_0x0a0d('0x44')]['sort']);_0x4e6279[_0x0a0d('0x4c')]=qs[_0x0a0d('0x45')](_['pick'](_0x400d52[_0x0a0d('0x44')],_0x167ded['filters']),_0x3d11e2);if(_0x400d52['query']['filter']){_0x4e6279[_0x0a0d('0x4c')]=_[_0x0a0d('0x4d')](_0x4e6279['where'],{'$or':_['map'](_0x3d11e2,function(_0x82fb3a){if(_0x82fb3a['type']!==_0x0a0d('0x4e')){var _0x3229aa={};_0x3229aa[_0x82fb3a[_0x0a0d('0x3a')]]={'$like':'%'+_0x400d52[_0x0a0d('0x44')]['filter']+'%'};return _0x3229aa;}})});}_0x4e6279=_[_0x0a0d('0x4d')]({},_0x4e6279,_0x400d52[_0x0a0d('0x4f')]);var _0x9e6fa2={'where':_0x4e6279[_0x0a0d('0x4c')]};return db['ChatWebsite'][_0x0a0d('0x50')](_0x9e6fa2)[_0x0a0d('0x22')](function(_0x327694){_0x4d73ea[_0x0a0d('0x50')]=_0x327694;if(_0x400d52['query'][_0x0a0d('0x51')]){_0x4e6279[_0x0a0d('0x52')]=[{'all':!![]}];}return db[_0x0a0d('0x3e')][_0x0a0d('0x53')](_0x4e6279);})[_0x0a0d('0x22')](function(_0x34f9e6){_0x4d73ea[_0x0a0d('0x54')]=_0x34f9e6;return _0x4d73ea;})['then'](respondWithFilteredResult(_0x13e115,_0x4e6279))[_0x0a0d('0x2b')](handleError(_0x13e115,null));};exports['show']=function(_0x5a57df,_0x3b2a54){var _0x3ed57b={'raw':![],'where':{'id':_0x5a57df['params']['id']},'include':[{'model':db['Pause'],'as':_0x0a0d('0x3d')}]},_0x567864={};_0x567864[_0x0a0d('0x42')]=_[_0x0a0d('0x55')](db[_0x0a0d('0x3e')][_0x0a0d('0x3f')]);_0x567864['query']=_[_0x0a0d('0x55')](_0x5a57df[_0x0a0d('0x44')]);_0x567864[_0x0a0d('0x45')]=_[_0x0a0d('0x46')](_0x567864[_0x0a0d('0x42')],_0x567864['query']);_0x3ed57b[_0x0a0d('0x47')]=_[_0x0a0d('0x46')](_0x567864[_0x0a0d('0x42')],qs[_0x0a0d('0x48')](_0x5a57df['query'][_0x0a0d('0x48')]));_0x3ed57b[_0x0a0d('0x47')]=_0x3ed57b[_0x0a0d('0x47')][_0x0a0d('0x56')]?_0x3ed57b[_0x0a0d('0x47')]:_0x567864[_0x0a0d('0x42')];if(_0x5a57df[_0x0a0d('0x44')][_0x0a0d('0x51')]){_0x3ed57b[_0x0a0d('0x52')]=[{'all':!![]}];}_0x3ed57b=_['merge']({},_0x3ed57b,_0x5a57df['options']);return db[_0x0a0d('0x3e')][_0x0a0d('0x57')](_0x3ed57b)[_0x0a0d('0x22')](handleEntityNotFound(_0x3b2a54,null))[_0x0a0d('0x22')](respondWithResult(_0x3b2a54,null))['catch'](handleError(_0x3b2a54,null));};exports[_0x0a0d('0x58')]=function(_0x49cef6,_0x1ad21c){return db[_0x0a0d('0x3e')][_0x0a0d('0x58')](_0x49cef6[_0x0a0d('0x59')],{})[_0x0a0d('0x22')](function(_0x281f11){var _0x57bfcf=_0x49cef6[_0x0a0d('0x5a')][_0x0a0d('0x5b')]({'plain':!![]});if(!_0x57bfcf)throw new Error(_0x0a0d('0x5c'));if(_0x57bfcf[_0x0a0d('0x5d')]===_0x0a0d('0x5a')){var _0x447f30=_0x281f11['get']({'plain':!![]});var _0x62880a=_0x0a0d('0x5e');return db[_0x0a0d('0x5f')]['find']({'where':{'name':_0x62880a,'userProfileId':_0x57bfcf[_0x0a0d('0x60')]},'raw':!![]})[_0x0a0d('0x22')](function(_0x2d093a){if(_0x2d093a&&_0x2d093a[_0x0a0d('0x61')]===0x0){return db[_0x0a0d('0x37')]['create']({'name':_0x447f30[_0x0a0d('0x3a')],'resourceId':_0x447f30['id'],'type':_0x2d093a[_0x0a0d('0x3a')],'sectionId':_0x2d093a['id']},{})[_0x0a0d('0x22')](function(){return _0x281f11;});}else{return _0x281f11;}})[_0x0a0d('0x2b')](function(_0x22ac13){logger[_0x0a0d('0x27')](_0x0a0d('0x62'),_0x22ac13);throw _0x22ac13;});}return _0x281f11;})['then'](respondWithResult(_0x1ad21c,0xc9))[_0x0a0d('0x2b')](handleError(_0x1ad21c,null));};exports['update']=function(_0x37e589,_0xd5ee55){if(_0x37e589['body']['id']){delete _0x37e589['body']['id'];}return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'where':{'id':_0x37e589[_0x0a0d('0x63')]['id']},'include':[{'model':db[_0x0a0d('0x64')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xd5ee55,null))[_0x0a0d('0x22')](saveUpdates(_0x37e589['body'],null))['then'](respondWithResult(_0xd5ee55,null))[_0x0a0d('0x2b')](handleError(_0xd5ee55,null));};exports[_0x0a0d('0x36')]=function(_0x3dad87,_0x485a8a){return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'where':{'id':_0x3dad87[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x485a8a,null))[_0x0a0d('0x22')](removeEntity(_0x485a8a,null))[_0x0a0d('0x2b')](handleError(_0x485a8a,null));};exports[_0x0a0d('0x65')]=function(_0x39633f,_0x509514){return db['ChatWebsite'][_0x0a0d('0x65')]()[_0x0a0d('0x22')](respondWithResult(_0x509514,null))[_0x0a0d('0x2b')](handleError(_0x509514,null));};exports[_0x0a0d('0x66')]=function(_0x5af912,_0x198076,_0x4cbd8a){if(_0x5af912[_0x0a0d('0x59')]['id']){delete _0x5af912['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x5af912[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x198076,null))[_0x0a0d('0x22')](function(_0x2ff793){if(_0x2ff793){_0x5af912[_0x0a0d('0x59')][_0x0a0d('0x67')]=_0x2ff793['id'];return db[_0x0a0d('0x68')]['create'](_0x5af912['body']);}})[_0x0a0d('0x22')](respondWithResult(_0x198076,null))[_0x0a0d('0x2b')](handleError(_0x198076,null));};exports[_0x0a0d('0x69')]=function(_0x3e633d,_0x10f4c6,_0x1cebd1){var _0x42bf32={'raw':![],'where':{}};var _0x5068d1={};var _0x2d1883={'count':0x0,'rows':[]};return db[_0x0a0d('0x3e')][_0x0a0d('0x6a')]({'where':{'id':_0x3e633d['params']['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x10f4c6,null))[_0x0a0d('0x22')](function(_0x28fa52){if(_0x28fa52){_0x5068d1[_0x0a0d('0x42')]=_['keys'](db[_0x0a0d('0x68')][_0x0a0d('0x3f')]);_0x5068d1[_0x0a0d('0x44')]=_[_0x0a0d('0x55')](_0x3e633d[_0x0a0d('0x44')]);_0x5068d1[_0x0a0d('0x45')]=_['intersection'](_0x5068d1[_0x0a0d('0x42')],_0x5068d1[_0x0a0d('0x44')]);_0x42bf32[_0x0a0d('0x47')]=_[_0x0a0d('0x46')](_0x5068d1[_0x0a0d('0x42')],qs[_0x0a0d('0x48')](_0x3e633d['query']['fields']));_0x42bf32[_0x0a0d('0x47')]=_0x42bf32[_0x0a0d('0x47')][_0x0a0d('0x56')]?_0x42bf32[_0x0a0d('0x47')]:_0x5068d1[_0x0a0d('0x42')];if(!_0x3e633d['query'][_0x0a0d('0x49')]('nolimit')){_0x42bf32[_0x0a0d('0x30')]=qs[_0x0a0d('0x30')](_0x3e633d['query'][_0x0a0d('0x30')]);_0x42bf32[_0x0a0d('0x2f')]=qs[_0x0a0d('0x2f')](_0x3e633d[_0x0a0d('0x44')][_0x0a0d('0x2f')]);}_0x42bf32[_0x0a0d('0x6b')]=qs[_0x0a0d('0x4b')](_0x3e633d['query'][_0x0a0d('0x4b')]);_0x42bf32[_0x0a0d('0x4c')]=qs[_0x0a0d('0x45')](_['pick'](_0x3e633d[_0x0a0d('0x44')],_0x5068d1[_0x0a0d('0x45')]));_0x42bf32['where']['ChatWebsiteId']=_0x28fa52['id'];if(_0x3e633d[_0x0a0d('0x44')]['filter']){_0x42bf32[_0x0a0d('0x4c')]=_[_0x0a0d('0x4d')](_0x42bf32[_0x0a0d('0x4c')],{'$or':_['map'](_0x42bf32[_0x0a0d('0x47')],function(_0x2a8461){var _0x40b1f6={};_0x40b1f6[_0x2a8461]={'$like':'%'+_0x3e633d[_0x0a0d('0x44')][_0x0a0d('0x6c')]+'%'};return _0x40b1f6;})});}_0x42bf32=_[_0x0a0d('0x4d')]({},_0x42bf32,_0x3e633d['options']);return db[_0x0a0d('0x68')][_0x0a0d('0x50')]({'where':_0x42bf32[_0x0a0d('0x4c')]})[_0x0a0d('0x22')](function(_0x1105ef){_0x2d1883[_0x0a0d('0x50')]=_0x1105ef;if(_0x3e633d[_0x0a0d('0x44')][_0x0a0d('0x51')]){_0x42bf32[_0x0a0d('0x52')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x42bf32);})[_0x0a0d('0x22')](function(_0x4e23b0){_0x2d1883[_0x0a0d('0x54')]=_0x4e23b0;return _0x2d1883;});}})['then'](respondWithFilteredResult(_0x10f4c6,_0x42bf32))[_0x0a0d('0x2b')](handleError(_0x10f4c6,null));};exports[_0x0a0d('0x6d')]=function(_0x273874,_0x236ffb,_0x27dea7){return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'where':{'id':_0x273874[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x236ffb,null))[_0x0a0d('0x22')](function(_0x4e4b36){if(_0x4e4b36){return _0x4e4b36[_0x0a0d('0x6d')](_0x273874['query']['ids']);}})['then'](respondWithStatusCode(_0x236ffb,null))[_0x0a0d('0x2b')](handleError(_0x236ffb,null));};exports[_0x0a0d('0x6e')]=function(_0x568ad,_0x1bb636,_0x44d579){if(_0x568ad[_0x0a0d('0x59')]['id']){delete _0x568ad[_0x0a0d('0x59')]['id'];}return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'where':{'id':_0x568ad['params']['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x1bb636,null))['then'](function(_0x47217f){if(_0x47217f){_0x568ad['body'][_0x0a0d('0x67')]=_0x47217f['id'];return db[_0x0a0d('0x6f')][_0x0a0d('0x58')](_0x568ad[_0x0a0d('0x59')]);}})[_0x0a0d('0x22')](respondWithResult(_0x1bb636,null))[_0x0a0d('0x2b')](handleError(_0x1bb636,null));};exports[_0x0a0d('0x70')]=function(_0x1048f1,_0x585779,_0x5f3316){var _0x2cb4d7={'raw':![],'where':{}};var _0x28c36f={};var _0x596978={'count':0x0,'rows':[]};return db[_0x0a0d('0x3e')][_0x0a0d('0x6a')]({'where':{'id':_0x1048f1[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x585779,null))[_0x0a0d('0x22')](function(_0x4aee22){if(_0x4aee22){_0x28c36f[_0x0a0d('0x42')]=_['keys'](db['CannedAnswer'][_0x0a0d('0x3f')]);_0x28c36f[_0x0a0d('0x44')]=_[_0x0a0d('0x55')](_0x1048f1[_0x0a0d('0x44')]);_0x28c36f['filters']=_[_0x0a0d('0x46')](_0x28c36f[_0x0a0d('0x42')],_0x28c36f[_0x0a0d('0x44')]);_0x2cb4d7[_0x0a0d('0x47')]=_[_0x0a0d('0x46')](_0x28c36f[_0x0a0d('0x42')],qs[_0x0a0d('0x48')](_0x1048f1[_0x0a0d('0x44')][_0x0a0d('0x48')]));_0x2cb4d7[_0x0a0d('0x47')]=_0x2cb4d7[_0x0a0d('0x47')][_0x0a0d('0x56')]?_0x2cb4d7[_0x0a0d('0x47')]:_0x28c36f[_0x0a0d('0x42')];if(!_0x1048f1['query'][_0x0a0d('0x49')](_0x0a0d('0x4a'))){_0x2cb4d7[_0x0a0d('0x30')]=qs[_0x0a0d('0x30')](_0x1048f1['query']['limit']);_0x2cb4d7['offset']=qs[_0x0a0d('0x2f')](_0x1048f1[_0x0a0d('0x44')][_0x0a0d('0x2f')]);}_0x2cb4d7[_0x0a0d('0x6b')]=qs[_0x0a0d('0x4b')](_0x1048f1[_0x0a0d('0x44')][_0x0a0d('0x4b')]);_0x2cb4d7['where']=qs[_0x0a0d('0x45')](_['pick'](_0x1048f1['query'],_0x28c36f[_0x0a0d('0x45')]));_0x2cb4d7['where'][_0x0a0d('0x67')]=_0x4aee22['id'];if(_0x1048f1[_0x0a0d('0x44')][_0x0a0d('0x6c')]){_0x2cb4d7[_0x0a0d('0x4c')]=_[_0x0a0d('0x4d')](_0x2cb4d7[_0x0a0d('0x4c')],{'$or':_['map'](_0x2cb4d7['attributes'],function(_0x5644b0){var _0x389310={};_0x389310[_0x5644b0]={'$like':'%'+_0x1048f1[_0x0a0d('0x44')][_0x0a0d('0x6c')]+'%'};return _0x389310;})});}_0x2cb4d7=_['merge']({},_0x2cb4d7,_0x1048f1[_0x0a0d('0x4f')]);return db['CannedAnswer'][_0x0a0d('0x50')]({'where':_0x2cb4d7[_0x0a0d('0x4c')]})['then'](function(_0x53f3da){_0x596978[_0x0a0d('0x50')]=_0x53f3da;if(_0x1048f1[_0x0a0d('0x44')][_0x0a0d('0x51')]){_0x2cb4d7[_0x0a0d('0x52')]=[{'all':!![]}];}return db[_0x0a0d('0x6f')][_0x0a0d('0x53')](_0x2cb4d7);})[_0x0a0d('0x22')](function(_0xc3a95d){_0x596978[_0x0a0d('0x54')]=_0xc3a95d;return _0x596978;});}})['then'](respondWithFilteredResult(_0x585779,_0x2cb4d7))[_0x0a0d('0x2b')](handleError(_0x585779,null));};exports[_0x0a0d('0x71')]=function(_0x3e2e25,_0x5dbc3c,_0x3d0de1){return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'where':{'id':_0x3e2e25['params']['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x5dbc3c,null))[_0x0a0d('0x22')](function(_0x47c424){if(_0x47c424){return _0x47c424[_0x0a0d('0x71')](_0x3e2e25[_0x0a0d('0x44')][_0x0a0d('0x72')]);}})[_0x0a0d('0x22')](respondWithStatusCode(_0x5dbc3c,null))[_0x0a0d('0x2b')](handleError(_0x5dbc3c,null));};exports[_0x0a0d('0x73')]=function(_0x33f25d,_0x120526,_0xe5b50){_0x33f25d[_0x0a0d('0x59')][_0x0a0d('0x74')]=_0x33f25d[_0x0a0d('0x75')][_0x0a0d('0x76')];return db[_0x0a0d('0x3e')]['find']({'where':{'id':_0x33f25d[_0x0a0d('0x63')]['id']}})['then'](handleEntityNotFound(_0x120526,null))[_0x0a0d('0x22')](saveUpdates(_0x33f25d[_0x0a0d('0x59')],null))['then'](respondWithResult(_0x120526,null))[_0x0a0d('0x2b')](handleError(_0x120526,null));};exports[_0x0a0d('0x77')]=function(_0x4b6f97,_0x46b7bf,_0x143272){_0x4b6f97['body'][_0x0a0d('0x78')]=_0x4b6f97[_0x0a0d('0x75')][_0x0a0d('0x76')];return db[_0x0a0d('0x3e')]['find']({'where':{'id':_0x4b6f97['params']['id']}})['then'](handleEntityNotFound(_0x46b7bf,null))[_0x0a0d('0x22')](saveUpdates(_0x4b6f97[_0x0a0d('0x59')],null))[_0x0a0d('0x22')](respondWithResult(_0x46b7bf,null))['catch'](handleError(_0x46b7bf,null));};exports[_0x0a0d('0x79')]=function(_0x4eb84c,_0x12e342,_0x474e23){_0x4eb84c['body']['customerAvatar']=_0x4eb84c[_0x0a0d('0x75')][_0x0a0d('0x76')];return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'where':{'id':_0x4eb84c[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x12e342,null))[_0x0a0d('0x22')](saveUpdates(_0x4eb84c[_0x0a0d('0x59')],null))[_0x0a0d('0x22')](respondWithResult(_0x12e342,null))[_0x0a0d('0x2b')](handleError(_0x12e342,null));};exports[_0x0a0d('0x7a')]=function(_0x522f2e,_0x52a36d,_0x478096){_0x522f2e[_0x0a0d('0x59')][_0x0a0d('0x7b')]=_0x522f2e[_0x0a0d('0x75')]['filename'];return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'where':{'id':_0x522f2e[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x52a36d,null))['then'](saveUpdates(_0x522f2e['body'],null))[_0x0a0d('0x22')](respondWithResult(_0x52a36d,null))[_0x0a0d('0x2b')](handleError(_0x52a36d,null));};exports['getLogo']=function(_0x89b90f,_0x3178f4,_0xc0205b){var _0x165c57=path[_0x0a0d('0x7c')](config[_0x0a0d('0x7d')],_0x0a0d('0x7e'));var _0x1637b8={'where':{'id':_0x89b90f['params']['id']},'attributes':['id',_0x0a0d('0x74')],'raw':!![]};var _0x3e6011=![];return require(_0x0a0d('0x7f'))[_0x0a0d('0x80')]()[_0x0a0d('0x22')](function(_0x51b176){if(_0x51b176){_0x3e6011=_0x51b176[_0x0a0d('0x81')];}})[_0x0a0d('0x22')](function(){return db[_0x0a0d('0x3e')][_0x0a0d('0x57')](_0x1637b8);})['then'](handleEntityNotFound(_0x3178f4,null))['then'](function(_0x4c61b2){if(_0x4c61b2){if(!_['isNil'](_0x4c61b2[_0x0a0d('0x74')])){if(fs[_0x0a0d('0x82')](path[_0x0a0d('0x7c')](config[_0x0a0d('0x7d')],_0x0a0d('0x83'),_0x4c61b2[_0x0a0d('0x74')]))&&_0x3e6011){_0x165c57=path[_0x0a0d('0x7c')](config[_0x0a0d('0x7d')],_0x0a0d('0x83'),_0x4c61b2[_0x0a0d('0x74')]);}}return _0x3178f4['download'](_0x165c57);}})['catch'](handleError(_0x3178f4,null));};exports[_0x0a0d('0x84')]=function(_0x3bd7bd,_0x21c250,_0x2f0059){var _0x24ab28=path[_0x0a0d('0x7c')](config[_0x0a0d('0x7d')],_0x0a0d('0x85'));var _0x46fd54={'where':{'id':_0x3bd7bd['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x0a0d('0x3e')][_0x0a0d('0x57')](_0x46fd54)[_0x0a0d('0x22')](handleEntityNotFound(_0x21c250,null))[_0x0a0d('0x22')](function(_0x48391f){if(_0x48391f){if(!_[_0x0a0d('0x86')](_0x48391f['agentAvatar'])){if(fs['existsSync'](path[_0x0a0d('0x7c')](config['root'],_0x0a0d('0x87'),_0x48391f[_0x0a0d('0x78')]))){_0x24ab28=path['join'](config[_0x0a0d('0x7d')],_0x0a0d('0x87'),_0x48391f[_0x0a0d('0x78')]);}}return _0x21c250[_0x0a0d('0x88')](_0x24ab28);}})[_0x0a0d('0x2b')](handleError(_0x21c250,null));};exports[_0x0a0d('0x89')]=function(_0x1f8b2c,_0xc2490e,_0x5f2bc9){var _0x53f1f2=path[_0x0a0d('0x7c')](config[_0x0a0d('0x7d')],_0x0a0d('0x8a'));var _0x4b8d65={'where':{'id':_0x1f8b2c[_0x0a0d('0x63')]['id']},'attributes':['id',_0x0a0d('0x8b'),_0x0a0d('0x8c')],'raw':!![]};return db[_0x0a0d('0x3e')][_0x0a0d('0x57')](_0x4b8d65)[_0x0a0d('0x22')](handleEntityNotFound(_0xc2490e,null))['then'](function(_0x505041){if(_0x505041){if(!_['isNil'](_0x505041[_0x0a0d('0x8b')])){if(fs['existsSync'](path[_0x0a0d('0x7c')](config[_0x0a0d('0x7d')],_0x0a0d('0x87'),_0x505041['customerAvatar']))&&_0x505041[_0x0a0d('0x8c')]){_0x53f1f2=path['join'](config[_0x0a0d('0x7d')],_0x0a0d('0x87'),_0x505041[_0x0a0d('0x8b')]);}}return _0xc2490e[_0x0a0d('0x88')](_0x53f1f2);}})[_0x0a0d('0x2b')](handleError(_0xc2490e,null));};exports['getSystemAvatar']=function(_0x237c9f,_0x41da54,_0xf5dffc){var _0x5c62fd=path[_0x0a0d('0x7c')](config[_0x0a0d('0x7d')],_0x0a0d('0x8d'));var _0x33c148={'where':{'id':_0x237c9f['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x0a0d('0x3e')][_0x0a0d('0x57')](_0x33c148)[_0x0a0d('0x22')](handleEntityNotFound(_0x41da54,null))[_0x0a0d('0x22')](function(_0x5a6004){if(_0x5a6004){if(!_[_0x0a0d('0x86')](_0x5a6004['systemAvatar'])){if(fs[_0x0a0d('0x82')](path['join'](config[_0x0a0d('0x7d')],_0x0a0d('0x87'),_0x5a6004[_0x0a0d('0x7b')]))){_0x5c62fd=path['join'](config[_0x0a0d('0x7d')],_0x0a0d('0x87'),_0x5a6004['systemAvatar']);}}return _0x41da54[_0x0a0d('0x88')](_0x5c62fd);}})[_0x0a0d('0x2b')](handleError(_0x41da54,null));};exports[_0x0a0d('0x8e')]=function(_0x42b55f,_0xfdef96,_0x14dfc6){var _0xc16b36=require('user-agent-parser');var _0x3dfbb0=new _0xc16b36();var _0x1c28af=_0x3dfbb0[_0x0a0d('0x8f')](_0x42b55f[_0x0a0d('0x90')]['user-agent'])[_0x0a0d('0x91')]();var _0x237339={'body':_0x42b55f[_0x0a0d('0x59')],'channel':_0x0a0d('0x92')};var _0x5325f5=[];var _0x485ab3=[];var _0x5ddc23={};var _0x2da561=![];return db[_0x0a0d('0x93')][_0x0a0d('0x65')]()[_0x0a0d('0x22')](function(_0x5d213a){if(!_0x5d213a){throw new db['Sequelize'][(_0x0a0d('0x94'))](_0x0a0d('0x95'));}_0x5325f5=_['difference'](_[_0x0a0d('0x55')](_0x5d213a),['createdAt',_0x0a0d('0x96')]);_0x485ab3=_[_0x0a0d('0x97')](_[_0x0a0d('0x55')](_0x5d213a),['createdAt',_0x0a0d('0x96'),'CompanyId','ListId']);if(_0x42b55f['body']['id']){delete _0x42b55f[_0x0a0d('0x59')]['id'];}if(_[_0x0a0d('0x86')](_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0x98')])){throw new db['Sequelize'][(_0x0a0d('0x94'))](_0x0a0d('0x99'));}if(_[_0x0a0d('0x86')](_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0x59')])||_0x42b55f[_0x0a0d('0x59')]['body']===''){throw new db[(_0x0a0d('0x20'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x42b55f['body']['mapKey'])){throw new db[(_0x0a0d('0x20'))]['ValidationError'](_0x0a0d('0x9a')+_0x485ab3);}if(!_[_0x0a0d('0x9b')](_0x485ab3,_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0x9c')])){throw new db[(_0x0a0d('0x20'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x485ab3);}_0x5ddc23[_0x42b55f[_0x0a0d('0x59')]['mapKey']]=_0x42b55f['body'][_0x0a0d('0x98')];})[_0x0a0d('0x22')](function(){return db[_0x0a0d('0x3e')]['find']({'where':{'id':_0x42b55f[_0x0a0d('0x63')]['id']},'include':[{'model':db[_0x0a0d('0x9d')],'as':_0x0a0d('0x9e'),'include':[{'model':db[_0x0a0d('0x93')],'as':_0x0a0d('0x9f'),'where':_0x5ddc23,'limit':0x1,'order':[[_0x0a0d('0x96'),_0x0a0d('0xa0')]]}]},{'model':db[_0x0a0d('0xa1')],'as':_0x0a0d('0xa2')}]});})[_0x0a0d('0x22')](handleEntityNotFound(_0xfdef96,null))[_0x0a0d('0x22')](function(_0x200dfd){if(_0x200dfd&&_0x200dfd[_0x0a0d('0x9e')]){_0x237339[_0x0a0d('0xa3')]=_0x200dfd;_0x237339['applications']=_0x200dfd[_0x0a0d('0xa2')];_0x237339[_0x0a0d('0xa4')]=_0x200dfd[_0x0a0d('0x9e')];_0x237339[_0x0a0d('0xa5')]=_['orderBy'](_0x237339[_0x0a0d('0xa5')],[_0x0a0d('0xa6')],[_0x0a0d('0xa7')]);if(_0x237339[_0x0a0d('0xa3')][_0x0a0d('0xa2')]){delete _0x237339[_0x0a0d('0xa3')]['Applications'];}if(_0x237339[_0x0a0d('0xa3')][_0x0a0d('0x9e')]&&_0x237339[_0x0a0d('0xa3')][_0x0a0d('0x9e')][_0x0a0d('0x9f')][_0x0a0d('0x56')]){return _0x237339['account'][_0x0a0d('0x9e')][_0x0a0d('0x9f')][0x0];}var _0x21ca58=_[_0x0a0d('0x18')](_0x42b55f['body'],{'firstName':_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0x98')],'ListId':_0x200dfd[_0x0a0d('0xa8')]});_0x21ca58[_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0x9c')]]=_0x42b55f[_0x0a0d('0x59')]['from'];return db[_0x0a0d('0x93')][_0x0a0d('0x58')](_0x21ca58,{'fields':_0x5325f5,'raw':!![]});}})[_0x0a0d('0x22')](handleEntityNotFound(_0xfdef96,null))[_0x0a0d('0x22')](function(_0x139e71){_0x237339['contact']=_0x139e71;var _0x35df9d=_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0xa9')];if(_0x42b55f[_0x0a0d('0x90')]['cf-connecting-ip']){_0x35df9d=_0x42b55f[_0x0a0d('0x90')][_0x0a0d('0xaa')];}else if(_0x42b55f[_0x0a0d('0x90')][_0x0a0d('0xab')]){_0x35df9d=_[_0x0a0d('0xac')](_0x42b55f[_0x0a0d('0x90')][_0x0a0d('0xab')][_0x0a0d('0xad')](','));}if(_0x139e71){var _0x3770c4={'ContactId':_0x139e71['id'],'ChatWebsiteId':_0x42b55f[_0x0a0d('0x63')]['id'],'from':(_0x139e71[_0x0a0d('0xae')]||'')+'\x20'+(_0x139e71[_0x0a0d('0xaf')]||''),'customerIp':_0x35df9d,'customerPort':_0x42b55f[_0x0a0d('0x90')][_0x0a0d('0xb0')]?_0x42b55f[_0x0a0d('0x90')][_0x0a0d('0xb0')]:null,'referer':_0x42b55f['body'][_0x0a0d('0xb1')],'browserName':_0x1c28af['browser'][_0x0a0d('0x3a')]&&_0x1c28af[_0x0a0d('0xb2')][_0x0a0d('0xb3')]?util[_0x0a0d('0xb4')](_0x0a0d('0xb5'),_0x1c28af['browser']['name'],_0x1c28af[_0x0a0d('0xb2')][_0x0a0d('0xb3')]):'unknown','browserVersion':_0x1c28af['browser']['version']||'unknown','osName':util[_0x0a0d('0xb4')](_0x0a0d('0xb5'),_0x1c28af['os'][_0x0a0d('0x3a')],_0x1c28af['os']['version']),'osVersion':_0x1c28af['os'][_0x0a0d('0xb3')],'deviceModel':_0x1c28af[_0x0a0d('0xb6')][_0x0a0d('0x42')]&&_0x1c28af[_0x0a0d('0xb6')][_0x0a0d('0xb7')]?util[_0x0a0d('0xb4')]('%s\x20%s\x20%s',_0x1c28af[_0x0a0d('0xb6')][_0x0a0d('0x42')],_0x1c28af[_0x0a0d('0xb6')][_0x0a0d('0xb7')],_0x1c28af[_0x0a0d('0xb6')][_0x0a0d('0x41')]):null,'deviceVendor':_0x1c28af[_0x0a0d('0xb6')][_0x0a0d('0xb7')],'deviceType':_0x1c28af[_0x0a0d('0xb6')]['type'],'formData':JSON[_0x0a0d('0x26')](_0x42b55f['body'])};var _0xb8cd31={'ChatWebsiteId':_0x42b55f[_0x0a0d('0x63')]['id'],'closed':![]};if(_0x42b55f['body'][_0x0a0d('0xb8')]){_0xb8cd31[_0x0a0d('0xb8')]=_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0xb8')];return db['ChatInteraction'][_0x0a0d('0x57')]({'where':_0xb8cd31})[_0x0a0d('0x22')](function(_0x232b29){if(_0x232b29){return[_0x232b29,![]];}_0x3770c4[_0x0a0d('0xb8')]=_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0xb8')];_0x3770c4['externalUrl']=_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0xb9')];return db[_0x0a0d('0xba')][_0x0a0d('0x58')](_0x3770c4)[_0x0a0d('0x22')](function(_0x22fb1c){return[_0x22fb1c,!![]];});});}_0xb8cd31[_0x0a0d('0xbb')]=_0x139e71['id'];if(_0x42b55f['body'][_0x0a0d('0xbc')]&&_0x42b55f['body'][_0x0a0d('0xbc')]['id']){_0xb8cd31['id']=_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0xbc')]['id'];return db[_0x0a0d('0xba')][_0x0a0d('0x57')]({'where':_0xb8cd31})['then'](function(_0x47db43){if(_0x47db43){return[_0x47db43,![]];}return db['ChatInteraction'][_0x0a0d('0x58')](_0x3770c4)[_0x0a0d('0x22')](function(_0x5cf9c4){return[_0x5cf9c4,!![]];});});}return db[_0x0a0d('0xba')][_0x0a0d('0x58')](_0x3770c4)[_0x0a0d('0x22')](function(_0xfc5715){return[_0xfc5715,!![]];});}})['spread'](function(_0x4205c5,_0x5f1b11){if(_0x4205c5){_0x2da561=_0x5f1b11;if(!_0x5f1b11){var _0xbd0deb={'from':(_0x237339[_0x0a0d('0xbd')][_0x0a0d('0xae')]||'')+'\x20'+(_0x237339[_0x0a0d('0xbd')][_0x0a0d('0xaf')]||'')};if(_0x42b55f['body']['threadId']&&_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0xbe')]&&_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0xb8')]!=_0x42b55f[_0x0a0d('0x59')]['messageId']){_0xbd0deb['threadId']=_0x42b55f['body'][_0x0a0d('0xbe')];}return _0x4205c5[_0x0a0d('0x35')](_0xbd0deb);}else{return _0x4205c5;}}})[_0x0a0d('0x22')](function(_0x1a8259){_0x237339[_0x0a0d('0xbc')]=_0x1a8259[_0x0a0d('0x5b')]({'plain':!![]});_0x237339[_0x0a0d('0xbc')][_0x0a0d('0xbf')]=_0x2da561;if(_0x237339[_0x0a0d('0xbc')][_0x0a0d('0xbf')]){if(_0x237339['account']['autoclose']){_0x237339[_0x0a0d('0xa5')][_0x0a0d('0xc0')]({'id':0x0,'priority':_0x237339['applications'][_0x0a0d('0x56')]+0x1,'app':_0x0a0d('0xc1'),'appdata':_0x0a0d('0xc2'),'interval':_0x0a0d('0xc3')});}}return db[_0x0a0d('0xc4')][_0x0a0d('0x58')]({'body':_0x42b55f['body'][_0x0a0d('0x59')],'ChatWebsiteId':_0x42b55f[_0x0a0d('0x63')]['id'],'ChatInteractionId':_0x1a8259['id'],'direction':'in','ContactId':_0x237339[_0x0a0d('0xbd')]['id'],'AttachmentId':_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0xc5')]});})[_0x0a0d('0x22')](function(_0x3fba15){_0x237339[_0x0a0d('0x29')]=_0x3fba15;if(_0x237339[_0x0a0d('0xbc')]['UserId']){return db[_0x0a0d('0xc6')][_0x0a0d('0x57')]({'attributes':['id',_0x0a0d('0x3a')],'where':{'id':_0x237339[_0x0a0d('0xbc')][_0x0a0d('0xc7')]}})['then'](function(_0x354cae){if(_0x354cae){_0x237339[_0x0a0d('0xa5')][_0x0a0d('0xc8')]({'id':0x0,'priority':0x0,'app':_0x0a0d('0xc9'),'appdata':_0x354cae[_0x0a0d('0x3a')]+','+(_0x237339[_0x0a0d('0xa3')][_0x0a0d('0xca')]||0xa),'interval':_0x0a0d('0xc3')});_0x237339['forcedOwnership']=!![];}return respondWithRpcPromise(_0x0a0d('0xcb'),_0x0a0d('0xcc'),_0x237339);});}return respondWithRpcPromise('Start','startRouting',_0x237339);})[_0x0a0d('0x22')](function(_0x2e8506){respondWithRpcPromise('EventManager','EventManager',{'event':_0x0a0d('0x8e'),'message':_0x2e8506},client9002);return _0x2e8506;})[_0x0a0d('0x22')](respondWithResult(_0xfdef96,null))['catch'](handleError(_0xfdef96,null));};exports[_0x0a0d('0xcd')]=function(_0x1e1d23,_0x5b74ee,_0x4881e5){var _0x36cad8,_0x511f63,_0x137214;var _0x28e503=[];var _0x899fa5=[];var _0x240bee={};return db['CmContact']['describe']()[_0x0a0d('0x22')](function(_0x527299){if(!_0x527299){throw new db[(_0x0a0d('0x20'))][(_0x0a0d('0x94'))](_0x0a0d('0x95'));}_0x899fa5=_['difference'](_[_0x0a0d('0x55')](_0x527299),['createdAt',_0x0a0d('0x96')]);_0x28e503=_[_0x0a0d('0x97')](_[_0x0a0d('0x55')](_0x527299),[_0x0a0d('0xce'),_0x0a0d('0x96'),_0x0a0d('0xcf'),'ListId']);if(_0x1e1d23[_0x0a0d('0x59')]['id']){delete _0x1e1d23['body']['id'];}if(_[_0x0a0d('0x86')](_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0x98')])){throw _0x5b74ee['status'](0x1f4)[_0x0a0d('0x3b')](new db[(_0x0a0d('0x20'))][(_0x0a0d('0x94'))](_0x0a0d('0x99')));}if(_[_0x0a0d('0x86')](_0x1e1d23['body'][_0x0a0d('0x59')])||_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0x59')]===''){throw _0x5b74ee[_0x0a0d('0x2d')](0x1f4)[_0x0a0d('0x3b')](new db[(_0x0a0d('0x20'))]['ValidationError'](_0x0a0d('0xd0')));}if(_[_0x0a0d('0x86')](_0x1e1d23[_0x0a0d('0x59')]['mapKeyOffline'])){throw _0x5b74ee['status'](0x1f4)[_0x0a0d('0x3b')](new db[(_0x0a0d('0x20'))][(_0x0a0d('0x94'))](_0x0a0d('0xd1')+_0x28e503));}if(!_[_0x0a0d('0x9b')](_0x28e503,_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0xd2')])){throw _0x5b74ee[_0x0a0d('0x2d')](0x1f4)[_0x0a0d('0x3b')](new db[(_0x0a0d('0x20'))][(_0x0a0d('0x94'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x28e503));}_0x240bee[_0x1e1d23[_0x0a0d('0x59')]['mapKeyOffline']]=_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0x98')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x1e1d23[_0x0a0d('0x63')]['id']},'include':[{'model':db[_0x0a0d('0x9d')],'as':_0x0a0d('0x9e')}]});})['then'](handleEntityNotFound(_0x5b74ee,null))[_0x0a0d('0x22')](function(_0xeb56bf){if(_0xeb56bf&&_0xeb56bf[_0x0a0d('0x9e')]){_0x511f63=_0xeb56bf;var _0x39dbf0=_[_0x0a0d('0x18')](_0x1e1d23[_0x0a0d('0x59')],{'firstName':_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0x98')],'phone':_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0x98')],'ListId':_0xeb56bf[_0x0a0d('0xa8')]});_0x39dbf0[_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0xd2')]]=_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0x98')];return db[_0x0a0d('0x93')][_0x0a0d('0xd3')]({'where':_0x240bee,'defaults':_0x39dbf0});}})[_0x0a0d('0xd4')](function(_0x526fa3){if(_0x526fa3){_0x137214=_0x526fa3;var _0x4d89c6=fs[_0x0a0d('0xd5')](path['join'](config[_0x0a0d('0x7d')],'server/files/templates/chatOfflineMessage.ejs'),_0x0a0d('0xd6'));var _0x35e095=ejs['render'](_0x4d89c6,{'body':_[_0x0a0d('0xd7')](_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0x59')]),'bodyTitle':_0x511f63[_0x0a0d('0xd8')]});return db[_0x0a0d('0xd9')][_0x0a0d('0x58')]({'body':_0x35e095,'ContactId':_0x526fa3['id'],'ChatWebsiteId':_0x511f63['id']});}})[_0x0a0d('0x22')](function(_0x1098ed){if(_0x1098ed){_0x36cad8=_0x1098ed;return db[_0x0a0d('0xda')][_0x0a0d('0x6a')]({'where':{'service':!![]},'include':[{'model':db[_0x0a0d('0xdb')],'as':_0x0a0d('0xdc'),'raw':!![]}]});}})[_0x0a0d('0x22')](function(_0x5c22ab){if(_0x5c22ab&&_0x5c22ab['Smtp']&&_0x511f63['forwardOfflineAddress']){var _0x182171={'tls':{'rejectUnauthorized':![]}};if(_0x5c22ab[_0x0a0d('0xdc')]['service']){_0x182171['service']=_0x5c22ab[_0x0a0d('0xdc')][_0x0a0d('0xdd')];}else{_0x182171[_0x0a0d('0xde')]=_0x5c22ab[_0x0a0d('0xdc')][_0x0a0d('0xde')];_0x182171['port']=_0x5c22ab[_0x0a0d('0xdc')][_0x0a0d('0xdf')];_0x182171['secure']=_0x5c22ab[_0x0a0d('0xdc')][_0x0a0d('0xe0')];}if(_0x5c22ab[_0x0a0d('0xdc')][_0x0a0d('0xe1')]){_0x182171[_0x0a0d('0xe2')]={'user':_0x5c22ab[_0x0a0d('0xdc')][_0x0a0d('0x5a')],'pass':_0x5c22ab[_0x0a0d('0xdc')][_0x0a0d('0xe3')]};}return respondWithRpcPromise(_0x0a0d('0xe4'),_0x0a0d('0xe5'),{'account':_0x182171,'message':{'from':util[_0x0a0d('0xb4')](_0x0a0d('0xe6'),_0x5c22ab[_0x0a0d('0x3a')],_0x5c22ab[_0x0a0d('0xe7')]||_0x5c22ab[_0x0a0d('0xdc')]['user']),'to':_0x511f63[_0x0a0d('0xe8')],'subject':_0x511f63[_0x0a0d('0xe9')],'text':_0x36cad8[_0x0a0d('0x59')]}},client9003)[_0x0a0d('0x22')](function(){return _0x36cad8;})[_0x0a0d('0x2b')](function(_0x20bd55){console[_0x0a0d('0x27')](_0x20bd55);});}})[_0x0a0d('0x22')](function(){if(_0x36cad8){return _0x36cad8;}})['then'](respondWithResult(_0x5b74ee,null))[_0x0a0d('0x2b')](handleError(_0x5b74ee,null));};exports[_0x0a0d('0xea')]=function(_0x5d9f61,_0x3b5ef5,_0x392e5e){return db[_0x0a0d('0xba')][_0x0a0d('0x57')]({'where':{'id':_0x5d9f61[_0x0a0d('0x63')]['id']}})['then'](handleEntityNotFound(_0x3b5ef5,null))[_0x0a0d('0x22')](function(_0x4c5382){if(_0x4c5382){return _0x4c5382['addInteraction'](_0x5d9f61['body'][_0x0a0d('0x72')],_[_0x0a0d('0xeb')](_0x5d9f61[_0x0a0d('0x59')],['ids','id'])||{});}})[_0x0a0d('0x22')](respondWithResult(_0x3b5ef5,null))[_0x0a0d('0x2b')](handleError(_0x3b5ef5,null));};exports[_0x0a0d('0xec')]=function(_0x24e58b,_0x1ab19d,_0x1f61f7){var _0x10e2c4={'raw':![],'where':{}};var _0x4f54e1={};var _0x33edb6={'count':0x0,'rows':[]};return db[_0x0a0d('0x3e')][_0x0a0d('0x6a')]({'where':{'id':_0x24e58b[_0x0a0d('0x63')]['id']}})['then'](handleEntityNotFound(_0x1ab19d,null))[_0x0a0d('0x22')](function(_0x111b6a){if(_0x111b6a){_0x4f54e1[_0x0a0d('0x42')]=_[_0x0a0d('0x55')](db['ChatInteraction']['rawAttributes']);_0x4f54e1[_0x0a0d('0x44')]=_[_0x0a0d('0x55')](_0x24e58b[_0x0a0d('0x44')]);_0x4f54e1[_0x0a0d('0x45')]=_['intersection'](_0x4f54e1[_0x0a0d('0x42')],_0x4f54e1[_0x0a0d('0x44')]);_0x10e2c4[_0x0a0d('0x47')]=_[_0x0a0d('0x46')](_0x4f54e1[_0x0a0d('0x42')],qs[_0x0a0d('0x48')](_0x24e58b[_0x0a0d('0x44')][_0x0a0d('0x48')]));_0x10e2c4[_0x0a0d('0x47')]=_0x10e2c4[_0x0a0d('0x47')][_0x0a0d('0x56')]?_0x10e2c4['attributes']:_0x4f54e1[_0x0a0d('0x42')];if(!_0x24e58b[_0x0a0d('0x44')][_0x0a0d('0x49')](_0x0a0d('0x4a'))){_0x10e2c4[_0x0a0d('0x30')]=qs[_0x0a0d('0x30')](_0x24e58b[_0x0a0d('0x44')][_0x0a0d('0x30')]);_0x10e2c4[_0x0a0d('0x2f')]=qs[_0x0a0d('0x2f')](_0x24e58b['query'][_0x0a0d('0x2f')]);}_0x10e2c4[_0x0a0d('0x6b')]=qs[_0x0a0d('0x4b')](_0x24e58b[_0x0a0d('0x44')][_0x0a0d('0x4b')]);_0x10e2c4[_0x0a0d('0x4c')]=qs[_0x0a0d('0x45')](_[_0x0a0d('0xed')](_0x24e58b[_0x0a0d('0x44')],_0x4f54e1[_0x0a0d('0x45')]));_0x10e2c4[_0x0a0d('0x4c')]['ChatWebsiteId']=_0x111b6a['id'];if(_0x24e58b[_0x0a0d('0x44')][_0x0a0d('0x6c')]){_0x10e2c4[_0x0a0d('0x4c')]=_[_0x0a0d('0x4d')](_0x10e2c4[_0x0a0d('0x4c')],{'$or':_['map'](_0x10e2c4[_0x0a0d('0x47')],function(_0x16e12b){var _0x4c10f2={};_0x4c10f2[_0x16e12b]={'$like':'%'+_0x24e58b[_0x0a0d('0x44')]['filter']+'%'};return _0x4c10f2;})});}_0x10e2c4=_[_0x0a0d('0x4d')]({},_0x10e2c4,_0x24e58b['options']);return db[_0x0a0d('0xba')][_0x0a0d('0x50')]({'where':_0x10e2c4['where']})['then'](function(_0x4a6a5d){_0x33edb6['count']=_0x4a6a5d;if(_0x24e58b[_0x0a0d('0x44')]['includeAll']){_0x10e2c4[_0x0a0d('0x52')]=[{'model':db[_0x0a0d('0x93')],'as':_0x0a0d('0xee'),'required':![]},{'model':db[_0x0a0d('0xc6')],'as':_0x0a0d('0xef'),'attributes':[_0x0a0d('0x3a'),_0x0a0d('0xf0'),_0x0a0d('0xf1')],'required':![]},{'model':db[_0x0a0d('0xf2')],'as':_0x0a0d('0xf3'),'attributes':['id',_0x0a0d('0x3a'),_0x0a0d('0xf4')],'where':_0x24e58b[_0x0a0d('0x44')][_0x0a0d('0xf5')]?{'id':_0x24e58b[_0x0a0d('0x44')]['tag']}:undefined,'required':_0x24e58b[_0x0a0d('0x44')][_0x0a0d('0xf5')]?!![]:![]}];}return db[_0x0a0d('0xba')][_0x0a0d('0x53')](_0x10e2c4);})[_0x0a0d('0x22')](function(_0x127a7c){_0x33edb6[_0x0a0d('0x54')]=_0x127a7c;return _0x33edb6;});}})[_0x0a0d('0x22')](respondWithFilteredResult(_0x1ab19d,_0x10e2c4))[_0x0a0d('0x2b')](handleError(_0x1ab19d,null));};function iftimePromise(_0x288ed0,_0x4ffcc2){return respondWithRpcPromise('Command',_0x0a0d('0xf6'),{'command':_0x4ffcc2[_0x0a0d('0xf7')]?util['format'](_0x0a0d('0xf8'),_0x288ed0[_0x0a0d('0xf9')],_0x4ffcc2['timezone']):util[_0x0a0d('0xb4')]('iftime\x20%s',_0x288ed0[_0x0a0d('0xf9')])},client9002)[_0x0a0d('0x22')](function(_0x5f4541){var _0x16ea9b=_0x5f4541&&_0x5f4541[_0x0a0d('0xfa')](_0x0a0d('0xfb'))>=0x0?!![]:![];logger['info'](_0x0a0d('0xfc'),_0x4ffcc2['id'],_0x288ed0['id'],_0x288ed0[_0x0a0d('0xf9')],_0x16ea9b?_0x0a0d('0xfd'):_0x0a0d('0xfe'),_0x4ffcc2[_0x0a0d('0xf7')]?_0x4ffcc2[_0x0a0d('0xf7')]:'No\x20timezone');return _0x16ea9b;})[_0x0a0d('0x2b')](function(_0x4b1ecd){logger['error'](_0x0a0d('0xfc'),_0x4ffcc2['id'],_0x288ed0['id'],_0x288ed0[_0x0a0d('0xf9')],util[_0x0a0d('0xff')](_0x4b1ecd,{'showHidden':![],'depth':null}),_0x4ffcc2[_0x0a0d('0xf7')]?_0x4ffcc2[_0x0a0d('0xf7')]:_0x0a0d('0x100'));return![];});}exports[_0x0a0d('0xf6')]=function(_0x263a72,_0x2c9776,_0x225af3){var _0x258d66=0x0;var _0x536fc2=0x0;var _0x385383=![];var _0xe1fcff;var _0x2879db;return db['ChatWebsite'][_0x0a0d('0x57')]({'where':{'id':_0x263a72[_0x0a0d('0x63')]['id']},'include':[{'model':db[_0x0a0d('0x101')],'as':_0x0a0d('0x101'),'include':[{'model':db['Interval'],'as':_0x0a0d('0x102'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x0a0d('0x22')](handleEntityNotFound(_0x2c9776,null))[_0x0a0d('0x22')](function(_0x57e273){if(_0x57e273){_0xe1fcff=_0x57e273;return _0x57e273[_0x0a0d('0x103')]({'raw':!![]});}})[_0x0a0d('0x22')](function(_0x100f88){if(_0xe1fcff){if(_0x100f88){_0x2879db=_0x100f88;}}return require(_0x0a0d('0x7f'))[_0x0a0d('0x80')]();})[_0x0a0d('0x22')](function(_0x2dc8db){if(_0x2dc8db){_0x536fc2=_0x2dc8db[_0x0a0d('0x104')];_0x385383=_0x2dc8db[_0x0a0d('0x81')];}})[_0x0a0d('0x22')](function(){return db[_0x0a0d('0xba')][_0x0a0d('0x50')]({'where':{'closed':![]}});})[_0x0a0d('0x22')](function(_0x5d77b0){_0x258d66=_0x5d77b0;if(_0x536fc2&&_0x5d77b0>_0x536fc2){return db[_0x0a0d('0x105')][_0x0a0d('0x6a')]({'where':{'id':0x1}})['then'](function(_0x1d870d){if(_0x1d870d){_0x1d870d['increment'](_0x0a0d('0x106'));}});}})[_0x0a0d('0x22')](function(){if(_0xe1fcff['Interval']&&_0xe1fcff[_0x0a0d('0x101')][_0x0a0d('0x102')]){var _0x19602c=[];for(var _0x21d64d=0x0;_0x21d64d<_0xe1fcff[_0x0a0d('0x101')][_0x0a0d('0x102')]['length'];_0x21d64d++){var _0x40cc06=_0xe1fcff[_0x0a0d('0x101')]['Intervals'][_0x21d64d]['get']({'plain':!![]});_0x19602c[_0x0a0d('0xc0')](iftimePromise(_0x40cc06,_0xe1fcff));}return BPromise['all'](_0x19602c)['then'](function(_0x8f1388){return _[_0x0a0d('0x107')](_0x8f1388);});}else{return!![];}})[_0x0a0d('0x22')](function(_0x1a6f61){var _0x53566f=fs['readFileSync'](path[_0x0a0d('0x7c')](config[_0x0a0d('0x7d')],_0x0a0d('0x108')),'utf8');var _0x14dea7={'remote':_0xe1fcff['remote'],'query':querystring[_0x0a0d('0x26')](_[_0x0a0d('0x4d')](_0xe1fcff['get']({'plain':!![]}),{'customerIp':_0x263a72[_0x0a0d('0x90')][_0x0a0d('0xab')]||_0x263a72[_0x0a0d('0x90')][_0x0a0d('0x109')]||_0x263a72['connection'][_0x0a0d('0x10a')]||_0x263a72['ip'],'referer':_0x263a72[_0x0a0d('0x90')]['referer'],'openedInteractions':_0x258d66,'maxInteractions':_0x536fc2,'virtual':_0x385383[_0x0a0d('0x104')],'online':_0x1a6f61,'custom':_0x385383}))['replace'](/'/g,'\x5c\x27')};_0x2c9776['send'](ejs[_0x0a0d('0x10b')](Mustache[_0x0a0d('0x10b')](_0x53566f,_0x14dea7),{'proactiveActions':_0x2879db,'alignment':_0xe1fcff[_0x0a0d('0x10c')],'verticalAlignment':_0xe1fcff[_0x0a0d('0x10d')],'div_color':_0xe1fcff[_0x0a0d('0xf4')],'text_color':_0xe1fcff[_0x0a0d('0x10e')]}));})[_0x0a0d('0x2b')](handleError(_0x2c9776,null));};exports[_0x0a0d('0x10f')]=function(_0x28ac67,_0x28b629,_0x2405e8){return db[_0x0a0d('0x3e')][_0x0a0d('0x6a')]({'where':{'id':_0x28ac67[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x28b629,null))[_0x0a0d('0x22')](function(_0x21f4fd){if(_0x21f4fd){return db[_0x0a0d('0x110')][_0x0a0d('0x111')](function(_0x9ff7c4){return db[_0x0a0d('0xa1')][_0x0a0d('0x36')]({'where':{'ChatWebsiteId':_0x28ac67['params']['id']},'transaction':_0x9ff7c4})[_0x0a0d('0x22')](function(_0x3e62b5){var _0x1d7857=_['map'](_0x28ac67[_0x0a0d('0x59')],function(_0x1fc0b8){_0x1fc0b8[_0x0a0d('0x67')]=_0x28ac67['params']['id'];return _0x1fc0b8;});return db[_0x0a0d('0xa1')][_0x0a0d('0x112')](_0x1d7857,{'transaction':_0x9ff7c4});});})[_0x0a0d('0x22')](function(){return db['ChatApplication'][_0x0a0d('0x113')]({'where':{'ChatWebsiteId':_0x28ac67[_0x0a0d('0x63')]['id']},'order':_0x0a0d('0xa6')});});}})[_0x0a0d('0x22')](respondWithResult(_0x28b629,null))[_0x0a0d('0x2b')](handleError(_0x28b629,null));};exports[_0x0a0d('0x114')]=function(_0x17b2e9,_0x2a9475,_0x4ff694){var _0x2199c4={};var _0x27a9da={};var _0x2643fd;var _0x4e141b;return db[_0x0a0d('0x3e')][_0x0a0d('0x6a')]({'where':{'id':_0x17b2e9[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x2a9475,null))[_0x0a0d('0x22')](function(_0xa440aa){if(_0xa440aa){_0x2643fd=_0xa440aa;_0x27a9da[_0x0a0d('0x42')]=_[_0x0a0d('0x55')](db['ChatApplication']['rawAttributes']);_0x27a9da['query']=_['keys'](_0x17b2e9[_0x0a0d('0x44')]);_0x27a9da[_0x0a0d('0x45')]=_[_0x0a0d('0x46')](_0x27a9da[_0x0a0d('0x42')],_0x27a9da[_0x0a0d('0x44')]);_0x2199c4[_0x0a0d('0x47')]=_[_0x0a0d('0x46')](_0x27a9da[_0x0a0d('0x42')],qs[_0x0a0d('0x48')](_0x17b2e9[_0x0a0d('0x44')]['fields']));_0x2199c4[_0x0a0d('0x47')]=_0x2199c4[_0x0a0d('0x47')]['length']?_0x2199c4[_0x0a0d('0x47')]:_0x27a9da[_0x0a0d('0x42')];_0x2199c4['order']=qs[_0x0a0d('0x4b')](_0x17b2e9[_0x0a0d('0x44')]['sort']);_0x2199c4[_0x0a0d('0x4c')]=qs[_0x0a0d('0x45')](_[_0x0a0d('0xed')](_0x17b2e9[_0x0a0d('0x44')],_0x27a9da[_0x0a0d('0x45')]));if(_0x17b2e9[_0x0a0d('0x44')]['filter']){_0x2199c4[_0x0a0d('0x4c')]=_[_0x0a0d('0x4d')](_0x2199c4[_0x0a0d('0x4c')],{'$or':_[_0x0a0d('0x43')](_0x2199c4[_0x0a0d('0x47')],function(_0x1ccd8b){var _0x191c33={};_0x191c33[_0x1ccd8b]={'$like':'%'+_0x17b2e9[_0x0a0d('0x44')][_0x0a0d('0x6c')]+'%'};return _0x191c33;})});}_0x2199c4=_[_0x0a0d('0x4d')]({},_0x2199c4,_0x17b2e9['options']);return _0x2643fd['getApplications'](_0x2199c4);}})['then'](function(_0x4cd267){if(_0x4cd267){_0x4e141b=_0x4cd267[_0x0a0d('0x56')];if(!_0x17b2e9['query']['hasOwnProperty'](_0x0a0d('0x4a'))){_0x2199c4[_0x0a0d('0x30')]=qs['limit'](_0x17b2e9[_0x0a0d('0x44')]['limit']);_0x2199c4[_0x0a0d('0x2f')]=qs['offset'](_0x17b2e9[_0x0a0d('0x44')][_0x0a0d('0x2f')]);}return _0x2643fd[_0x0a0d('0x114')](_0x2199c4);}})[_0x0a0d('0x22')](function(_0x1b4665){if(_0x1b4665){return _0x1b4665?{'count':_0x4e141b,'rows':_0x1b4665}:null;}})[_0x0a0d('0x22')](respondWithResult(_0x2a9475,null))[_0x0a0d('0x2b')](handleError(_0x2a9475,null));};exports['addProactiveActions']=function(_0x45c253,_0x13045a,_0x30bcfc){return db['chatProactiveAction']['find']({'where':{'id':_0x45c253[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x13045a,null))['then'](function(_0x59fc96){if(_0x59fc96){return _0x59fc96[_0x0a0d('0x115')](_0x45c253[_0x0a0d('0x59')][_0x0a0d('0x72')],_['omit'](_0x45c253[_0x0a0d('0x59')],[_0x0a0d('0x72'),'id'])||{});}})[_0x0a0d('0x22')](respondWithResult(_0x13045a,null))[_0x0a0d('0x2b')](handleError(_0x13045a,null));};exports['getProactiveActions']=function(_0x30e493,_0x446096,_0xbfd121){var _0x214ee8={};var _0x1af65e={};var _0x4fd753;var _0x3f2147;return db['ChatWebsite'][_0x0a0d('0x6a')]({'where':{'id':_0x30e493['params']['id']}})['then'](handleEntityNotFound(_0x446096,null))[_0x0a0d('0x22')](function(_0x7d9e0e){if(_0x7d9e0e){_0x4fd753=_0x7d9e0e;_0x1af65e[_0x0a0d('0x42')]=_[_0x0a0d('0x55')](db['ChatProactiveAction'][_0x0a0d('0x3f')]);_0x1af65e[_0x0a0d('0x44')]=_[_0x0a0d('0x55')](_0x30e493[_0x0a0d('0x44')]);_0x1af65e[_0x0a0d('0x45')]=_[_0x0a0d('0x46')](_0x1af65e[_0x0a0d('0x42')],_0x1af65e[_0x0a0d('0x44')]);_0x214ee8[_0x0a0d('0x47')]=_[_0x0a0d('0x46')](_0x1af65e[_0x0a0d('0x42')],qs['fields'](_0x30e493[_0x0a0d('0x44')]['fields']));_0x214ee8[_0x0a0d('0x47')]=_0x214ee8[_0x0a0d('0x47')][_0x0a0d('0x56')]?_0x214ee8['attributes']:_0x1af65e[_0x0a0d('0x42')];_0x214ee8[_0x0a0d('0x6b')]=qs[_0x0a0d('0x4b')](_0x30e493[_0x0a0d('0x44')]['sort']);_0x214ee8['where']=qs[_0x0a0d('0x45')](_[_0x0a0d('0xed')](_0x30e493[_0x0a0d('0x44')],_0x1af65e[_0x0a0d('0x45')]));if(_0x30e493[_0x0a0d('0x44')][_0x0a0d('0x6c')]){_0x214ee8[_0x0a0d('0x4c')]=_[_0x0a0d('0x4d')](_0x214ee8['where'],{'$or':_[_0x0a0d('0x43')](_0x214ee8[_0x0a0d('0x47')],function(_0x3394c7){var _0x41f4fd={};_0x41f4fd[_0x3394c7]={'$like':'%'+_0x30e493[_0x0a0d('0x44')][_0x0a0d('0x6c')]+'%'};return _0x41f4fd;})});}_0x214ee8=_['merge']({},_0x214ee8,_0x30e493[_0x0a0d('0x4f')]);return _0x4fd753[_0x0a0d('0x103')](_0x214ee8);}})[_0x0a0d('0x22')](function(_0x1dfbbc){if(_0x1dfbbc){_0x3f2147=_0x1dfbbc[_0x0a0d('0x56')];if(!_0x30e493[_0x0a0d('0x44')][_0x0a0d('0x49')](_0x0a0d('0x4a'))){_0x214ee8[_0x0a0d('0x30')]=qs['limit'](_0x30e493['query']['limit']);_0x214ee8['offset']=qs['offset'](_0x30e493[_0x0a0d('0x44')]['offset']);}return _0x4fd753['getProactiveActions'](_0x214ee8);}})[_0x0a0d('0x22')](function(_0x30c201){if(_0x30c201){return _0x30c201?{'count':_0x3f2147,'rows':_0x30c201}:null;}})[_0x0a0d('0x22')](respondWithResult(_0x446096,null))[_0x0a0d('0x2b')](handleError(_0x446096,null));};exports[_0x0a0d('0x116')]=function(_0x29f01c,_0x3cd323,_0x39de4c){var _0x575831=_0x29f01c[_0x0a0d('0x44')][_0x0a0d('0x117')]===_0x0a0d('0x118')?_0x0a0d('0x119'):_0x0a0d('0x11a');return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'attributes':['id',_0x575831],'where':{'id':_0x29f01c[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x3cd323,null))[_0x0a0d('0x22')](function(_0xeef3f7){if(_0xeef3f7){var _0x49dbf9=_0xeef3f7[_0x575831];var _0x5c48cb=_0x49dbf9&&_0x49dbf9['items']?_0x49dbf9[_0x0a0d('0x11b')]:[];_0x3cd323[_0x0a0d('0x3b')]({'fromKey':_['isNil'](_0x49dbf9['fromKey'])?undefined:_0x49dbf9[_0x0a0d('0x11c')],'count':_0x5c48cb[_0x0a0d('0x56')],'rows':_0x5c48cb});}})[_0x0a0d('0x2b')](handleError(_0x3cd323,null));};exports['getOfflineMessages']=function(_0x8a73dc,_0xcf653e,_0x290353){var _0x193043={'raw':![],'where':{}};var _0x4d97ca={};var _0x494e25={'count':0x0,'rows':[]};return db[_0x0a0d('0x3e')][_0x0a0d('0x6a')]({'where':{'id':_0x8a73dc[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0xcf653e,null))[_0x0a0d('0x22')](function(_0x5dbb0e){if(_0x5dbb0e){_0x4d97ca['model']=_['keys'](db[_0x0a0d('0xd9')]['rawAttributes']);_0x4d97ca['query']=_[_0x0a0d('0x55')](_0x8a73dc[_0x0a0d('0x44')]);_0x4d97ca[_0x0a0d('0x45')]=_['intersection'](_0x4d97ca[_0x0a0d('0x42')],_0x4d97ca[_0x0a0d('0x44')]);_0x193043[_0x0a0d('0x47')]=_['intersection'](_0x4d97ca[_0x0a0d('0x42')],qs[_0x0a0d('0x48')](_0x8a73dc[_0x0a0d('0x44')]['fields']));_0x193043[_0x0a0d('0x47')]=_0x193043[_0x0a0d('0x47')][_0x0a0d('0x56')]?_0x193043[_0x0a0d('0x47')]:_0x4d97ca[_0x0a0d('0x42')];if(!_0x8a73dc[_0x0a0d('0x44')][_0x0a0d('0x49')](_0x0a0d('0x4a'))){_0x193043[_0x0a0d('0x30')]=qs[_0x0a0d('0x30')](_0x8a73dc['query'][_0x0a0d('0x30')]);_0x193043[_0x0a0d('0x2f')]=qs[_0x0a0d('0x2f')](_0x8a73dc[_0x0a0d('0x44')][_0x0a0d('0x2f')]);}_0x193043[_0x0a0d('0x6b')]=qs[_0x0a0d('0x4b')](_0x8a73dc[_0x0a0d('0x44')]['sort']);_0x193043[_0x0a0d('0x4c')]=qs['filters'](_[_0x0a0d('0xed')](_0x8a73dc[_0x0a0d('0x44')],_0x4d97ca[_0x0a0d('0x45')]));_0x193043[_0x0a0d('0x4c')]['ChatWebsiteId']=_0x5dbb0e['id'];if(_0x8a73dc['query']['filter']){_0x193043['where']=_['merge'](_0x193043[_0x0a0d('0x4c')],{'$or':_[_0x0a0d('0x43')](_0x193043[_0x0a0d('0x47')],function(_0x444e43){var _0x245f12={};_0x245f12[_0x444e43]={'$like':'%'+_0x8a73dc['query'][_0x0a0d('0x6c')]+'%'};return _0x245f12;})});}_0x193043=_[_0x0a0d('0x4d')]({},_0x193043,_0x8a73dc[_0x0a0d('0x4f')]);return db[_0x0a0d('0xd9')]['count']({'where':_0x193043['where']})['then'](function(_0x3468d7){_0x494e25[_0x0a0d('0x50')]=_0x3468d7;if(_0x8a73dc[_0x0a0d('0x44')]['includeAll']){_0x193043['include']=[{'all':!![]}];}else{_0x193043['include']=[{'model':db['CmContact'],'as':_0x0a0d('0xee'),'required':![]}];}return db[_0x0a0d('0xd9')][_0x0a0d('0x53')](_0x193043);})[_0x0a0d('0x22')](function(_0x57530f){_0x494e25[_0x0a0d('0x54')]=_0x57530f;return _0x494e25;});}})[_0x0a0d('0x22')](respondWithFilteredResult(_0xcf653e,_0x193043))['catch'](handleError(_0xcf653e,null));};exports[_0x0a0d('0x11d')]=function(_0x12bdcc,_0xd504c9,_0x52e69b){return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'where':{'id':_0x12bdcc['params']['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0xd504c9,null))[_0x0a0d('0x22')](function(_0xcbc82b){if(_0xcbc82b){return _0xcbc82b[_0x0a0d('0x11d')](_0x12bdcc['body'][_0x0a0d('0x72')],_[_0x0a0d('0xeb')](_0x12bdcc[_0x0a0d('0x59')],['ids','id'])||{})[_0x0a0d('0xd4')](function(_0x47137b){for(var _0x55fdd5=0x0;_0x55fdd5<_0x12bdcc[_0x0a0d('0x59')][_0x0a0d('0x72')]['length'];_0x55fdd5+=0x1){socket['emit']('userChatWebsite:save',{'UserId':_0x12bdcc[_0x0a0d('0x59')][_0x0a0d('0x72')][_0x55fdd5],'ChatWebsiteId':_0x12bdcc[_0x0a0d('0x63')]['id']});}return _0x47137b;});}})[_0x0a0d('0x22')](respondWithResult(_0xd504c9,null))['catch'](handleError(_0xd504c9,null));};exports[_0x0a0d('0x11e')]=function(_0x251d65,_0x3f1741,_0x3e5555){return db['ChatWebsite'][_0x0a0d('0x57')]({'where':{'id':_0x251d65[_0x0a0d('0x63')]['id']}})['then'](handleEntityNotFound(_0x3f1741,null))[_0x0a0d('0x22')](function(_0x3e4e94){if(_0x3e4e94){return _0x3e4e94['removeAgents'](_0x251d65['query'][_0x0a0d('0x72')])[_0x0a0d('0x22')](function(){if(_[_0x0a0d('0x11f')](_0x251d65['query']['ids'])){for(var _0x70489b=0x0;_0x70489b<_0x251d65[_0x0a0d('0x44')]['ids'][_0x0a0d('0x56')];_0x70489b+=0x1){socket[_0x0a0d('0x120')]('userChatWebsite:remove',{'UserId':Number(_0x251d65[_0x0a0d('0x44')][_0x0a0d('0x72')][_0x70489b]),'ChatWebsiteId':Number(_0x251d65[_0x0a0d('0x63')]['id'])});}}else{socket[_0x0a0d('0x120')](_0x0a0d('0x121'),{'UserId':Number(_0x251d65[_0x0a0d('0x44')]['ids']),'ChatWebsiteId':Number(_0x251d65['params']['id'])});}});}})[_0x0a0d('0x22')](respondWithStatusCode(_0x3f1741,null))[_0x0a0d('0x2b')](handleError(_0x3f1741,null));};exports[_0x0a0d('0x122')]=function(_0x324a1c,_0x2d1ed3,_0x1f178d){var _0x4681ee={};var _0x2fcf64={};var _0x329131;var _0x5e3cb8;return db['ChatWebsite'][_0x0a0d('0x6a')]({'where':{'id':_0x324a1c[_0x0a0d('0x63')]['id']}})['then'](handleEntityNotFound(_0x2d1ed3,null))[_0x0a0d('0x22')](function(_0x5925c4){if(_0x5925c4){_0x329131=_0x5925c4;_0x2fcf64[_0x0a0d('0x42')]=_['keys'](db[_0x0a0d('0xc6')]['rawAttributes']);_0x2fcf64[_0x0a0d('0x44')]=_[_0x0a0d('0x55')](_0x324a1c[_0x0a0d('0x44')]);_0x2fcf64[_0x0a0d('0x45')]=_[_0x0a0d('0x46')](_0x2fcf64[_0x0a0d('0x42')],_0x2fcf64[_0x0a0d('0x44')]);_0x4681ee[_0x0a0d('0x47')]=_[_0x0a0d('0x46')](_0x2fcf64[_0x0a0d('0x42')],qs[_0x0a0d('0x48')](_0x324a1c['query'][_0x0a0d('0x48')]));_0x4681ee[_0x0a0d('0x47')]=_0x4681ee[_0x0a0d('0x47')][_0x0a0d('0x56')]?_0x4681ee[_0x0a0d('0x47')]:_0x2fcf64['model'];_0x4681ee[_0x0a0d('0x6b')]=qs['sort'](_0x324a1c[_0x0a0d('0x44')][_0x0a0d('0x4b')]);_0x4681ee['where']=qs[_0x0a0d('0x45')](_[_0x0a0d('0xed')](_0x324a1c[_0x0a0d('0x44')],_0x2fcf64[_0x0a0d('0x45')]));if(_0x324a1c[_0x0a0d('0x44')][_0x0a0d('0x6c')]){_0x4681ee[_0x0a0d('0x4c')]=_[_0x0a0d('0x4d')](_0x4681ee[_0x0a0d('0x4c')],{'$or':_[_0x0a0d('0x43')](_0x4681ee[_0x0a0d('0x47')],function(_0x1b8c11){var _0x7b1a31={};_0x7b1a31[_0x1b8c11]={'$like':'%'+_0x324a1c[_0x0a0d('0x44')][_0x0a0d('0x6c')]+'%'};return _0x7b1a31;})});}_0x4681ee=_[_0x0a0d('0x4d')]({},_0x4681ee,_0x324a1c[_0x0a0d('0x4f')]);return _0x329131[_0x0a0d('0x122')](_0x4681ee);}})['then'](function(_0x82766a){if(_0x82766a){_0x5e3cb8=_0x82766a['length'];if(!_0x324a1c[_0x0a0d('0x44')][_0x0a0d('0x49')](_0x0a0d('0x4a'))){_0x4681ee['limit']=qs['limit'](_0x324a1c[_0x0a0d('0x44')][_0x0a0d('0x30')]);_0x4681ee[_0x0a0d('0x2f')]=qs[_0x0a0d('0x2f')](_0x324a1c['query'][_0x0a0d('0x2f')]);}return _0x329131[_0x0a0d('0x122')](_0x4681ee);}})[_0x0a0d('0x22')](function(_0x416078){if(_0x416078){return _0x416078?{'count':_0x5e3cb8,'rows':_0x416078}:null;}})[_0x0a0d('0x22')](respondWithResult(_0x2d1ed3,null))[_0x0a0d('0x2b')](handleError(_0x2d1ed3,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index ba3afec..71d5a3f 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 _0x7bb8=['hasOwnProperty','../../mysqldb','ChatWebsite','setMaxListeners','save','remove','emit'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x7bb8,0xe8));var _0x87bb=function(_0x3318f0,_0x3ad120){_0x3318f0=_0x3318f0-0x0;var _0x1cc92f=_0x7bb8[_0x3318f0];return _0x1cc92f;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x87bb('0x0'))['db'][_0x87bb('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x87bb('0x2')](0x0);var events={'afterCreate':_0x87bb('0x3'),'afterUpdate':'update','afterDestroy':_0x87bb('0x4')};function emitEvent(_0x1c17f8){return function(_0x5c03d3,_0xd7ed75,_0x2e5773){ChatWebsiteEvents['emit'](_0x1c17f8+':'+_0x5c03d3['id'],_0x5c03d3);ChatWebsiteEvents[_0x87bb('0x5')](_0x1c17f8,_0x5c03d3);_0x2e5773(null);};}for(var e in events){if(events[_0x87bb('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xde6c=['hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x89833e,_0x28bff9){var _0x3ad041=function(_0x5afb12){while(--_0x5afb12){_0x89833e['push'](_0x89833e['shift']());}};_0x3ad041(++_0x28bff9);}(_0xde6c,0x119));var _0xcde6=function(_0x5c4d27,_0x5b0822){_0x5c4d27=_0x5c4d27-0x0;var _0x1dda1a=_0xde6c[_0x5c4d27];return _0x1dda1a;};'use strict';var EventEmitter=require(_0xcde6('0x0'));var ChatWebsite=require(_0xcde6('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xcde6('0x2')](0x0);var events={'afterCreate':_0xcde6('0x3'),'afterUpdate':_0xcde6('0x4'),'afterDestroy':_0xcde6('0x5')};function emitEvent(_0x494a32){return function(_0x145150,_0x262a54,_0x30d074){ChatWebsiteEvents['emit'](_0x494a32+':'+_0x145150['id'],_0x145150);ChatWebsiteEvents[_0xcde6('0x6')](_0x494a32,_0x145150);_0x30d074(null);};}for(var e in events){if(events[_0xcde6('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index de63cf0..d2b43b4 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 _0x22dd=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites'];(function(_0x4c6411,_0x3c7199){var _0x54b551=function(_0x1db5e9){while(--_0x1db5e9){_0x4c6411['push'](_0x4c6411['shift']());}};_0x54b551(++_0x3c7199);}(_0x22dd,0xe4));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd22d('0x0'));var util=require(_0xd22d('0x1'));var logger=require(_0xd22d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd22d('0x3'));var rp=require(_0xd22d('0x4'));var fs=require('fs');var path=require(_0xd22d('0x5'));var rimraf=require(_0xd22d('0x6'));var config=require(_0xd22d('0x7'));var attributes=require(_0xd22d('0x8'));module[_0xd22d('0x9')]=function(_0x2df700,_0x3f4197){return _0x2df700[_0xd22d('0xa')]('ChatWebsite',attributes,{'tableName':_0xd22d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a41=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','chat_websites','lodash','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a41,0x126));var _0x12a4=function(_0x3cf78d,_0x3a467a){_0x3cf78d=_0x3cf78d-0x0;var _0x35e8d6=_0x2a41[_0x3cf78d];return _0x35e8d6;};'use strict';var _=require(_0x12a4('0x0'));var util=require('util');var logger=require(_0x12a4('0x1'))(_0x12a4('0x2'));var moment=require(_0x12a4('0x3'));var BPromise=require(_0x12a4('0x4'));var rp=require(_0x12a4('0x5'));var fs=require('fs');var path=require(_0x12a4('0x6'));var rimraf=require(_0x12a4('0x7'));var config=require(_0x12a4('0x8'));var attributes=require(_0x12a4('0x9'));module['exports']=function(_0x379b3c,_0x7fc347){return _0x379b3c['define']('ChatWebsite',attributes,{'tableName':_0x12a4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index bc823f5..cad667d 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 _0x5496=['request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s'];(function(_0xbec8e6,_0x2841b5){var _0x4aa6f2=function(_0x583a0a){while(--_0x583a0a){_0xbec8e6['push'](_0xbec8e6['shift']());}};_0x4aa6f2(++_0x2841b5);}(_0x5496,0x175));var _0x6549=function(_0xcab48b,_0xc60fd1){_0xcab48b=_0xcab48b-0x0;var _0x1ad3ea=_0x5496[_0xcab48b];return _0x1ad3ea;};'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});config[_0x6549('0xa')]=_['defaults'](config[_0x6549('0xa')],{'host':_0x6549('0xb'),'port':0x18eb});var socket=require(_0x6549('0xc'))(new Redis(config['redis']));require(_0x6549('0xd'))[_0x6549('0xe')](socket);function respondWithRpcPromise(_0x2ecce2,_0x135c2c,_0x1e5083){return new BPromise(function(_0x3e08a6,_0x50fa35){return client['request'](_0x2ecce2,_0x1e5083)[_0x6549('0xf')](function(_0xac828c){logger[_0x6549('0x10')](_0x6549('0x11'),_0x135c2c,_0x6549('0x12'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x135c2c,_0x6549('0x12'),JSON[_0x6549('0x13')](_0xac828c));if(_0xac828c['error']){if(_0xac828c[_0x6549('0x14')][_0x6549('0x15')]===0x1f4){logger[_0x6549('0x14')](_0x6549('0x11'),_0x135c2c,_0xac828c[_0x6549('0x14')][_0x6549('0x16')]);return _0x50fa35(_0xac828c['error']['message']);}logger[_0x6549('0x14')](_0x6549('0x11'),_0x135c2c,_0xac828c['error'][_0x6549('0x16')]);return _0x3e08a6(_0xac828c[_0x6549('0x14')][_0x6549('0x16')]);}else{logger[_0x6549('0x10')](_0x6549('0x11'),_0x135c2c,'request\x20sent');_0x3e08a6(_0xac828c['result'][_0x6549('0x16')]);}})['catch'](function(_0x56c15b){logger[_0x6549('0x14')](_0x6549('0x11'),_0x135c2c,_0x56c15b);_0x50fa35(_0x56c15b);});});} \ No newline at end of file +var _0xef0f=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x58a51a,_0x223b82){var _0x8c56a1=function(_0x457686){while(--_0x457686){_0x58a51a['push'](_0x58a51a['shift']());}};_0x8c56a1(++_0x223b82);}(_0xef0f,0x168));var _0xfef0=function(_0x32a3a8,_0x1e2a47){_0x32a3a8=_0x32a3a8-0x0;var _0x94ce92=_0xef0f[_0x32a3a8];return _0x94ce92;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});config[_0xfef0('0xb')]=_[_0xfef0('0xc')](config['redis'],{'host':_0xfef0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfef0('0xb')]));require(_0xfef0('0xe'))[_0xfef0('0xf')](socket);function respondWithRpcPromise(_0x2d42dc,_0x334e74,_0x402dff){return new BPromise(function(_0xc177db,_0x4bd6f2){return client[_0xfef0('0x10')](_0x2d42dc,_0x402dff)[_0xfef0('0x11')](function(_0x410234){logger[_0xfef0('0x12')](_0xfef0('0x13'),_0x334e74,_0xfef0('0x14'));logger['debug'](_0xfef0('0x15'),_0x334e74,_0xfef0('0x14'),JSON[_0xfef0('0x16')](_0x410234));if(_0x410234[_0xfef0('0x17')]){if(_0x410234[_0xfef0('0x17')][_0xfef0('0x18')]===0x1f4){logger[_0xfef0('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x334e74,_0x410234[_0xfef0('0x17')]['message']);return _0x4bd6f2(_0x410234['error']['message']);}logger[_0xfef0('0x17')](_0xfef0('0x13'),_0x334e74,_0x410234[_0xfef0('0x17')][_0xfef0('0x19')]);return _0xc177db(_0x410234[_0xfef0('0x17')][_0xfef0('0x19')]);}else{logger[_0xfef0('0x12')](_0xfef0('0x13'),_0x334e74,'request\x20sent');_0xc177db(_0x410234[_0xfef0('0x1a')][_0xfef0('0x19')]);}})[_0xfef0('0x1b')](function(_0x39f9d3){logger[_0xfef0('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x334e74,_0x39f9d3);_0x4bd6f2(_0x39f9d3);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c8b5c44..4edf938 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(_0x4e39cd,_0x216b37){var _0x3e9298=function(_0x2a1f31){while(--_0x2a1f31){_0x4e39cd['push'](_0x4e39cd['shift']());}};_0x3e9298(++_0x216b37);}(_0x7a54,0x106));var _0x47a5=function(_0xf339f0,_0x2aa78c){_0xf339f0=_0xf339f0-0x0;var _0x4acd43=_0x7a54[_0xf339f0];return _0x4acd43;};'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 _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x4f94b1,_0x5d7170){var _0x4b7180=function(_0x503746){while(--_0x503746){_0x4f94b1['push'](_0x4f94b1['shift']());}};_0x4b7180(++_0x5d7170);}(_0x7a54,0x106));var _0x47a5=function(_0x1a4959,_0x4c26d0){_0x1a4959=_0x1a4959-0x0;var _0x22d465=_0x7a54[_0x1a4959];return _0x22d465;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index b775299..8c2028f 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 _0xd40e=['path','express','Router','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','/:id','isAuthenticated','show','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','getOfflineMessages','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','root','format','%s-%s','now','originalname','single','file','server/files/images/avatars/','join','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/offline','offline','/:id/interactions','addApplications','addProactiveActions','/:id/users','addAgents','put','update','destroy','delete','/:id/dispositions','removeDispositions','removeAgents','exports','multer','util'];(function(_0x5a5a98,_0x2d63f7){var _0x2f09ad=function(_0x46e4e2){while(--_0x46e4e2){_0x5a5a98['push'](_0x5a5a98['shift']());}};_0x2f09ad(++_0x2d63f7);}(_0xd40e,0xfa));var _0xed40=function(_0x65eae,_0x32dc5f){_0x65eae=_0x65eae-0x0;var _0x18e82b=_0xd40e[_0x65eae];return _0x18e82b;};'use strict';var multer=require(_0xed40('0x0'));var util=require(_0xed40('0x1'));var path=require(_0xed40('0x2'));var timeout=require('connect-timeout');var express=require(_0xed40('0x3'));var router=express[_0xed40('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xed40('0x5'));var config=require(_0xed40('0x6'));var controller=require(_0xed40('0x7'));router[_0xed40('0x8')]('/',auth['isAuthenticated'](),controller[_0xed40('0x9')]);router[_0xed40('0x8')](_0xed40('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xed40('0x8')](_0xed40('0xb'),auth[_0xed40('0xc')](),controller[_0xed40('0xd')]);router[_0xed40('0x8')]('/:id/dispositions',auth[_0xed40('0xc')](),controller['getDispositions']);router[_0xed40('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xed40('0xe')]);router[_0xed40('0x8')](_0xed40('0xf'),controller[_0xed40('0x10')]);router[_0xed40('0x8')](_0xed40('0x11'),controller['getAvatar']);router[_0xed40('0x8')](_0xed40('0x12'),controller['getCustomerAvatar']);router[_0xed40('0x8')]('/:id/system_avatar',controller[_0xed40('0x13')]);router[_0xed40('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xed40('0x14')]);router[_0xed40('0x8')](_0xed40('0x15'),controller[_0xed40('0x16')]);router[_0xed40('0x8')](_0xed40('0x17'),auth[_0xed40('0xc')](),controller[_0xed40('0x18')]);router['get'](_0xed40('0x19'),auth[_0xed40('0xc')](),controller[_0xed40('0x1a')]);router[_0xed40('0x8')]('/:id/fields',controller[_0xed40('0x1b')]);router[_0xed40('0x8')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0xed40('0x1c')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xed40('0x1d')]);router['post']('/',auth['isAuthenticated'](),controller[_0xed40('0x1e')]);router[_0xed40('0x1f')]('/:id/dispositions',auth[_0xed40('0xc')](),controller[_0xed40('0x20')]);router['post'](_0xed40('0x21'),auth[_0xed40('0xc')](),controller[_0xed40('0x22')]);var upload=multer({'storage':multer[_0xed40('0x23')]({'destination':function(_0x3ce4cf,_0x56bcd7,_0x23e5b9){_0x23e5b9(null,path['join'](config[_0xed40('0x24')],'server/files/images/logos/'));},'filename':function(_0x5f4313,_0x376f95,_0x5e4816){_0x5e4816(null,util[_0xed40('0x25')](_0xed40('0x26'),Date[_0xed40('0x27')](),_0x376f95[_0xed40('0x28')]));}})});router['post'](_0xed40('0xf'),upload[_0xed40('0x29')](_0xed40('0x2a')),controller['addLogo']);var upload=multer({'storage':multer[_0xed40('0x23')]({'destination':function(_0x188fc6,_0x5c9695,_0x1d4cfb){_0x1d4cfb(null,path['join'](config['root'],_0xed40('0x2b')));},'filename':function(_0x57f67c,_0x29f797,_0x30268e){_0x30268e(null,util[_0xed40('0x25')](_0xed40('0x26'),Date[_0xed40('0x27')](),_0x29f797[_0xed40('0x28')]));}})});router[_0xed40('0x1f')](_0xed40('0x11'),upload[_0xed40('0x29')](_0xed40('0x2a')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e745f,_0x140036,_0x468abe){_0x468abe(null,path[_0xed40('0x2c')](config[_0xed40('0x24')],'server/files/images/avatars/'));},'filename':function(_0x398234,_0x552e77,_0x9f3201){_0x9f3201(null,util['format'](_0xed40('0x26'),Date[_0xed40('0x27')](),_0x552e77['originalname']));}})});router[_0xed40('0x1f')](_0xed40('0x12'),upload[_0xed40('0x29')](_0xed40('0x2a')),controller[_0xed40('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x417eed,_0x2957e8,_0x4b5cca){_0x4b5cca(null,path['join'](config[_0xed40('0x24')],_0xed40('0x2b')));},'filename':function(_0x4c70e1,_0x4913e9,_0x2e59a0){_0x2e59a0(null,util[_0xed40('0x25')](_0xed40('0x26'),Date[_0xed40('0x27')](),_0x4913e9['originalname']));}})});router[_0xed40('0x1f')](_0xed40('0x2e'),upload['single'](_0xed40('0x2a')),controller[_0xed40('0x2f')]);router['post']('/:id/notify',controller['notify']);router['post'](_0xed40('0x30'),controller[_0xed40('0x31')]);router[_0xed40('0x1f')](_0xed40('0x32'),auth[_0xed40('0xc')](),controller['addInteraction']);router['post'](_0xed40('0x17'),auth[_0xed40('0xc')](),controller[_0xed40('0x33')]);router[_0xed40('0x1f')]('/:id/proactive_actions',auth[_0xed40('0xc')](),controller[_0xed40('0x34')]);router[_0xed40('0x1f')](_0xed40('0x35'),auth[_0xed40('0xc')](),controller[_0xed40('0x36')]);router[_0xed40('0x37')](_0xed40('0xb'),auth[_0xed40('0xc')](),controller[_0xed40('0x38')]);router['delete'](_0xed40('0xb'),auth['isAuthenticated'](),controller[_0xed40('0x39')]);router[_0xed40('0x3a')](_0xed40('0x3b'),auth[_0xed40('0xc')](),controller[_0xed40('0x3c')]);router[_0xed40('0x3a')](_0xed40('0x21'),auth[_0xed40('0xc')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0xed40('0xc')](),controller[_0xed40('0x3d')]);module[_0xed40('0x3e')]=router; \ No newline at end of file +var _0x71f1=['removeAnswers','exports','multer','util','connect-timeout','express','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','server/files/images/logos/','%s-%s','now','single','file','root','server/files/images/avatars/','format','originalname','addAvatar','addCustomerAvatar','addSystemAvatar','notify','/:id/offline','addInteraction','/:id/applications','addProactiveActions','update','delete','removeDispositions'];(function(_0x16415b,_0x42b3b2){var _0x5c99d5=function(_0x4a9415){while(--_0x4a9415){_0x16415b['push'](_0x16415b['shift']());}};_0x5c99d5(++_0x42b3b2);}(_0x71f1,0xea));var _0x171f=function(_0x40d80a,_0x5e5089){_0x40d80a=_0x40d80a-0x0;var _0x335bfb=_0x71f1[_0x40d80a];return _0x335bfb;};'use strict';var multer=require(_0x171f('0x0'));var util=require(_0x171f('0x1'));var path=require('path');var timeout=require(_0x171f('0x2'));var express=require(_0x171f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x171f('0x4'));router[_0x171f('0x5')]('/',auth[_0x171f('0x6')](),controller['index']);router['get'](_0x171f('0x7'),auth[_0x171f('0x6')](),controller[_0x171f('0x8')]);router[_0x171f('0x5')](_0x171f('0x9'),auth[_0x171f('0x6')](),controller['show']);router['get'](_0x171f('0xa'),auth[_0x171f('0x6')](),controller[_0x171f('0xb')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x171f('0xc')]);router[_0x171f('0x5')](_0x171f('0xd'),controller[_0x171f('0xe')]);router['get'](_0x171f('0xf'),controller['getAvatar']);router[_0x171f('0x5')](_0x171f('0x10'),controller['getCustomerAvatar']);router[_0x171f('0x5')](_0x171f('0x11'),controller[_0x171f('0x12')]);router[_0x171f('0x5')](_0x171f('0x13'),auth[_0x171f('0x6')](),controller['getInteractions']);router[_0x171f('0x5')]('/:id/snippet',controller['getSnippet']);router['get']('/:id/applications',auth[_0x171f('0x6')](),controller[_0x171f('0x14')]);router[_0x171f('0x5')](_0x171f('0x15'),auth[_0x171f('0x6')](),controller[_0x171f('0x16')]);router[_0x171f('0x5')](_0x171f('0x17'),controller[_0x171f('0x18')]);router[_0x171f('0x5')](_0x171f('0x19'),auth['isAuthenticated'](),controller[_0x171f('0x1a')]);router[_0x171f('0x5')](_0x171f('0x1b'),auth[_0x171f('0x6')](),controller[_0x171f('0x1c')]);router['post']('/',auth['isAuthenticated'](),controller[_0x171f('0x1d')]);router[_0x171f('0x1e')](_0x171f('0xa'),auth[_0x171f('0x6')](),controller[_0x171f('0x1f')]);router[_0x171f('0x1e')](_0x171f('0x20'),auth[_0x171f('0x6')](),controller[_0x171f('0x21')]);var upload=multer({'storage':multer[_0x171f('0x22')]({'destination':function(_0x30a64e,_0x28ce41,_0x5a3a65){_0x5a3a65(null,path[_0x171f('0x23')](config['root'],_0x171f('0x24')));},'filename':function(_0x276ef1,_0x342962,_0x4f7ca5){_0x4f7ca5(null,util['format'](_0x171f('0x25'),Date[_0x171f('0x26')](),_0x342962['originalname']));}})});router[_0x171f('0x1e')](_0x171f('0xd'),upload[_0x171f('0x27')](_0x171f('0x28')),controller['addLogo']);var upload=multer({'storage':multer[_0x171f('0x22')]({'destination':function(_0x183b90,_0x55ed18,_0xa0aaeb){_0xa0aaeb(null,path[_0x171f('0x23')](config[_0x171f('0x29')],_0x171f('0x2a')));},'filename':function(_0x244c46,_0x46edf1,_0x5ef48e){_0x5ef48e(null,util[_0x171f('0x2b')](_0x171f('0x25'),Date[_0x171f('0x26')](),_0x46edf1[_0x171f('0x2c')]));}})});router[_0x171f('0x1e')](_0x171f('0xf'),upload[_0x171f('0x27')](_0x171f('0x28')),controller[_0x171f('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3fde72,_0x28d64a,_0x590004){_0x590004(null,path['join'](config[_0x171f('0x29')],_0x171f('0x2a')));},'filename':function(_0x46be18,_0x58bf92,_0x2fed83){_0x2fed83(null,util[_0x171f('0x2b')](_0x171f('0x25'),Date[_0x171f('0x26')](),_0x58bf92[_0x171f('0x2c')]));}})});router[_0x171f('0x1e')]('/:id/customer_avatar',upload[_0x171f('0x27')](_0x171f('0x28')),controller[_0x171f('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4f6ec0,_0x1fc8b8,_0x4dd55a){_0x4dd55a(null,path[_0x171f('0x23')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x2e1b4a,_0x4697a2,_0x27b065){_0x27b065(null,util['format'](_0x171f('0x25'),Date[_0x171f('0x26')](),_0x4697a2[_0x171f('0x2c')]));}})});router[_0x171f('0x1e')](_0x171f('0x11'),upload[_0x171f('0x27')]('file'),controller[_0x171f('0x2f')]);router['post']('/:id/notify',controller[_0x171f('0x30')]);router['post'](_0x171f('0x31'),controller['offline']);router['post'](_0x171f('0x13'),auth['isAuthenticated'](),controller[_0x171f('0x32')]);router[_0x171f('0x1e')](_0x171f('0x33'),auth[_0x171f('0x6')](),controller['addApplications']);router[_0x171f('0x1e')](_0x171f('0x15'),auth[_0x171f('0x6')](),controller[_0x171f('0x34')]);router[_0x171f('0x1e')]('/:id/users',auth[_0x171f('0x6')](),controller['addAgents']);router['put'](_0x171f('0x9'),auth[_0x171f('0x6')](),controller[_0x171f('0x35')]);router[_0x171f('0x36')](_0x171f('0x9'),auth[_0x171f('0x6')](),controller['destroy']);router[_0x171f('0x36')](_0x171f('0xa'),auth[_0x171f('0x6')](),controller[_0x171f('0x37')]);router['delete'](_0x171f('0x20'),auth['isAuthenticated'](),controller[_0x171f('0x38')]);router[_0x171f('0x36')](_0x171f('0x1b'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x171f('0x39')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 63b3b6a..93aafbf 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 _0xf483=['Google','STRING','exports','ENUM','AmazonAWS'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf483,0xf2));var _0x3f48=function(_0x789678,_0x475d97){_0x789678=_0x789678-0x0;var _0x57f47c=_0xf483[_0x789678];return _0x57f47c;};'use strict';var Sequelize=require('sequelize');module[_0x3f48('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3f48('0x1')](_0x3f48('0x2'),_0x3f48('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x3f48('0x4')]},'data2':{'type':Sequelize[_0x3f48('0x4')]}}; \ No newline at end of file +var _0x363e=['exports','ENUM','AmazonAWS','Google','STRING','sequelize'];(function(_0x2536ad,_0x77ea35){var _0xdd5674=function(_0xe6094){while(--_0xe6094){_0x2536ad['push'](_0x2536ad['shift']());}};_0xdd5674(++_0x77ea35);}(_0x363e,0x179));var _0xe363=function(_0x56e7bc,_0xe3209f){_0x56e7bc=_0x56e7bc-0x0;var _0x48ced8=_0x363e[_0x56e7bc];return _0x48ced8;};'use strict';var Sequelize=require(_0xe363('0x0'));module[_0xe363('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe363('0x2')](_0xe363('0x3'),_0xe363('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xe363('0x5')]},'data2':{'type':Sequelize[_0xe363('0x5')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 4487b62..9fbeaee 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 _0x0ab0=['to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','map','CloudProvider','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','create','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0x0ab0,0x1b2));var _0x00ab=function(_0x35c26e,_0x1583cc){_0x35c26e=_0x35c26e-0x0;var _0x364f03=_0x0ab0[_0x35c26e];return _0x364f03;};'use strict';var pdf=require(_0x00ab('0x0'));var emlformat=require(_0x00ab('0x1'));var rimraf=require(_0x00ab('0x2'));var zipdir=require(_0x00ab('0x3'));var jsonpatch=require(_0x00ab('0x4'));var rp=require(_0x00ab('0x5'));var moment=require(_0x00ab('0x6'));var BPromise=require(_0x00ab('0x7'));var Mustache=require('mustache');var util=require(_0x00ab('0x8'));var path=require('path');var sox=require(_0x00ab('0x9'));var csv=require(_0x00ab('0xa'));var ejs=require(_0x00ab('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x00ab('0xc'));var crypto=require(_0x00ab('0xd'));var jsforce=require(_0x00ab('0xe'));var deskjs=require(_0x00ab('0xf'));var toCsv=require(_0x00ab('0xa'));var querystring=require(_0x00ab('0x10'));var Papa=require(_0x00ab('0x11'));var Redis=require(_0x00ab('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x00ab('0x13'));var as=require(_0x00ab('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x00ab('0x15'))(_0x00ab('0x16'));var utils=require(_0x00ab('0x17'));var config=require(_0x00ab('0x18'));var db=require(_0x00ab('0x19'))['db'];function respondWithStatusCode(_0x175b0d,_0x36d614){_0x36d614=_0x36d614||0xcc;return function(_0xea0337){if(_0xea0337){return _0x175b0d[_0x00ab('0x1a')](_0x36d614);}return _0x175b0d[_0x00ab('0x1b')](_0x36d614)[_0x00ab('0x1c')]();};}function respondWithResult(_0x18af44,_0x21ba7d){_0x21ba7d=_0x21ba7d||0xc8;return function(_0x49d8bf){if(_0x49d8bf){return _0x18af44['status'](_0x21ba7d)['json'](_0x49d8bf);}};}function respondWithFilteredResult(_0x23da96,_0x3ba818){return function(_0x3ad719){if(_0x3ad719){var _0x150dc8=_0x3ad719['count'],_0x4acbb4=_0x3ba818[_0x00ab('0x1d')],_0x5c521c=_0x3ba818[_0x00ab('0x1d')]+_0x3ba818[_0x00ab('0x1e')],_0x2ca145;if(_0x5c521c>=_0x150dc8){_0x5c521c=_0x150dc8;_0x2ca145=0xc8;}else{_0x2ca145=0xce;}_0x23da96[_0x00ab('0x1b')](_0x2ca145);return _0x23da96[_0x00ab('0x1f')](_0x00ab('0x20'),_0x4acbb4+'-'+_0x5c521c+'/'+_0x150dc8)[_0x00ab('0x21')](_0x3ad719);}return null;};}function patchUpdates(_0x47d1fd){return function(_0x3cc9a4){try{jsonpatch['apply'](_0x3cc9a4,_0x47d1fd,!![]);}catch(_0x2fa076){return BPromise[_0x00ab('0x22')](_0x2fa076);}return _0x3cc9a4[_0x00ab('0x23')]();};}function saveUpdates(_0x2bacd7,_0x3f392e){return function(_0x57b181){if(_0x57b181){return _0x57b181[_0x00ab('0x24')](_0x2bacd7)[_0x00ab('0x25')](function(_0xd2a692){return _0xd2a692;});}return null;};}function removeEntity(_0x1fd690,_0x3fe099){return function(_0x50d277){if(_0x50d277){return _0x50d277[_0x00ab('0x26')]()[_0x00ab('0x25')](function(){_0x1fd690[_0x00ab('0x1b')](0xcc)[_0x00ab('0x1c')]();});}};}function handleEntityNotFound(_0x3d0eb0,_0x445180){return function(_0x2c024a){if(!_0x2c024a){_0x3d0eb0[_0x00ab('0x1a')](0x194);}return _0x2c024a;};}function handleError(_0x1c5290,_0x5f6a25){_0x5f6a25=_0x5f6a25||0x1f4;return function(_0x3e88a9){logger[_0x00ab('0x27')](_0x3e88a9['stack']);if(_0x3e88a9[_0x00ab('0x28')]){delete _0x3e88a9[_0x00ab('0x28')];}_0x1c5290[_0x00ab('0x1b')](_0x5f6a25)[_0x00ab('0x29')](_0x3e88a9);};}exports['index']=function(_0x5b3b7d,_0x1a1560){var _0x56c1b5={},_0x159640={},_0x61e78e={'count':0x0,'rows':[]};var _0x1b6e7e=_[_0x00ab('0x2a')](db[_0x00ab('0x2b')][_0x00ab('0x2c')],function(_0x6e1202){return{'name':_0x6e1202['fieldName'],'type':_0x6e1202[_0x00ab('0x2d')][_0x00ab('0x2e')]};});_0x159640[_0x00ab('0x2f')]=_['map'](_0x1b6e7e,'name');_0x159640[_0x00ab('0x30')]=_[_0x00ab('0x31')](_0x5b3b7d['query']);_0x159640['filters']=_[_0x00ab('0x32')](_0x159640[_0x00ab('0x2f')],_0x159640[_0x00ab('0x30')]);_0x56c1b5[_0x00ab('0x33')]=_['intersection'](_0x159640[_0x00ab('0x2f')],qs[_0x00ab('0x34')](_0x5b3b7d[_0x00ab('0x30')]['fields']));_0x56c1b5[_0x00ab('0x33')]=_0x56c1b5['attributes'][_0x00ab('0x35')]?_0x56c1b5['attributes']:_0x159640['model'];if(!_0x5b3b7d[_0x00ab('0x30')][_0x00ab('0x36')](_0x00ab('0x37'))){_0x56c1b5[_0x00ab('0x1e')]=qs[_0x00ab('0x1e')](_0x5b3b7d['query'][_0x00ab('0x1e')]);_0x56c1b5[_0x00ab('0x1d')]=qs[_0x00ab('0x1d')](_0x5b3b7d['query'][_0x00ab('0x1d')]);}_0x56c1b5[_0x00ab('0x38')]=qs[_0x00ab('0x39')](_0x5b3b7d[_0x00ab('0x30')][_0x00ab('0x39')]);_0x56c1b5[_0x00ab('0x3a')]=qs[_0x00ab('0x3b')](_[_0x00ab('0x3c')](_0x5b3b7d[_0x00ab('0x30')],_0x159640[_0x00ab('0x3b')]),_0x1b6e7e);if(_0x5b3b7d[_0x00ab('0x30')]['filter']){_0x56c1b5[_0x00ab('0x3a')]=_[_0x00ab('0x3d')](_0x56c1b5[_0x00ab('0x3a')],{'$or':_[_0x00ab('0x2a')](_0x1b6e7e,function(_0x5e7fb5){if(_0x5e7fb5['type']!==_0x00ab('0x3e')){var _0xe25aa3={};_0xe25aa3[_0x5e7fb5['name']]={'$like':'%'+_0x5b3b7d['query']['filter']+'%'};return _0xe25aa3;}})});}_0x56c1b5=_[_0x00ab('0x3d')]({},_0x56c1b5,_0x5b3b7d[_0x00ab('0x3f')]);var _0x3289ef={'where':_0x56c1b5[_0x00ab('0x3a')]};return db[_0x00ab('0x2b')][_0x00ab('0x40')](_0x3289ef)['then'](function(_0x146ad7){_0x61e78e['count']=_0x146ad7;if(_0x5b3b7d['query'][_0x00ab('0x41')]){_0x56c1b5['include']=[{'all':!![]}];}return db['CloudProvider'][_0x00ab('0x42')](_0x56c1b5);})[_0x00ab('0x25')](function(_0x2b7586){_0x61e78e[_0x00ab('0x43')]=_0x2b7586;return _0x61e78e;})[_0x00ab('0x25')](respondWithFilteredResult(_0x1a1560,_0x56c1b5))[_0x00ab('0x44')](handleError(_0x1a1560,null));};exports[_0x00ab('0x45')]=function(_0x55c772,_0x17cb5e){var _0x51ec37={'raw':!![],'where':{'id':_0x55c772['params']['id']}},_0x3daacc={};_0x3daacc[_0x00ab('0x2f')]=_['keys'](db[_0x00ab('0x2b')][_0x00ab('0x2c')]);_0x3daacc[_0x00ab('0x30')]=_[_0x00ab('0x31')](_0x55c772['query']);_0x3daacc[_0x00ab('0x3b')]=_[_0x00ab('0x32')](_0x3daacc[_0x00ab('0x2f')],_0x3daacc[_0x00ab('0x30')]);_0x51ec37[_0x00ab('0x33')]=_['intersection'](_0x3daacc['model'],qs[_0x00ab('0x34')](_0x55c772[_0x00ab('0x30')]['fields']));_0x51ec37[_0x00ab('0x33')]=_0x51ec37[_0x00ab('0x33')][_0x00ab('0x35')]?_0x51ec37[_0x00ab('0x33')]:_0x3daacc[_0x00ab('0x2f')];if(_0x55c772[_0x00ab('0x30')][_0x00ab('0x41')]){_0x51ec37['include']=[{'all':!![]}];}_0x51ec37=_[_0x00ab('0x3d')]({},_0x51ec37,_0x55c772[_0x00ab('0x3f')]);return db['CloudProvider']['find'](_0x51ec37)['then'](handleEntityNotFound(_0x17cb5e,null))['then'](respondWithResult(_0x17cb5e,null))['catch'](handleError(_0x17cb5e,null));};exports['create']=function(_0x565085,_0xf0e426){return db[_0x00ab('0x2b')][_0x00ab('0x46')](_0x565085[_0x00ab('0x47')],{})[_0x00ab('0x25')](respondWithResult(_0xf0e426,0xc9))['catch'](handleError(_0xf0e426,null));};exports[_0x00ab('0x24')]=function(_0x200b85,_0x1331ef){if(_0x200b85[_0x00ab('0x47')]['id']){delete _0x200b85['body']['id'];}return db[_0x00ab('0x2b')][_0x00ab('0x48')]({'where':{'id':_0x200b85['params']['id']}})['then'](handleEntityNotFound(_0x1331ef,null))[_0x00ab('0x25')](saveUpdates(_0x200b85['body'],null))['then'](respondWithResult(_0x1331ef,null))[_0x00ab('0x44')](handleError(_0x1331ef,null));};exports[_0x00ab('0x26')]=function(_0x2ddcc1,_0x4a1e9d){return db[_0x00ab('0x2b')]['find']({'where':{'id':_0x2ddcc1[_0x00ab('0x49')]['id']}})[_0x00ab('0x25')](handleEntityNotFound(_0x4a1e9d,null))[_0x00ab('0x25')](removeEntity(_0x4a1e9d,null))[_0x00ab('0x44')](handleError(_0x4a1e9d,null));}; \ No newline at end of file +var _0xb3f3=['includeAll','find','create','body','update','catch','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','map','CloudProvider','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','then','rows','show','params'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xb3f3,0x92));var _0x3b3f=function(_0x309df4,_0x3391db){_0x309df4=_0x309df4-0x0;var _0x4be8fc=_0xb3f3[_0x309df4];return _0x4be8fc;};'use strict';var pdf=require(_0x3b3f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3b3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b3f('0x2'));var rp=require(_0x3b3f('0x3'));var moment=require('moment');var BPromise=require(_0x3b3f('0x4'));var Mustache=require(_0x3b3f('0x5'));var util=require('util');var path=require(_0x3b3f('0x6'));var sox=require('sox');var csv=require(_0x3b3f('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3b3f('0x8'));var squel=require('squel');var crypto=require(_0x3b3f('0x9'));var jsforce=require(_0x3b3f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3b3f('0x7'));var querystring=require(_0x3b3f('0xb'));var Papa=require(_0x3b3f('0xc'));var Redis=require(_0x3b3f('0xd'));var authService=require(_0x3b3f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3b3f('0xf'));var hardwareService=require(_0x3b3f('0x10'));var logger=require(_0x3b3f('0x11'))(_0x3b3f('0x12'));var utils=require(_0x3b3f('0x13'));var config=require(_0x3b3f('0x14'));var db=require(_0x3b3f('0x15'))['db'];function respondWithStatusCode(_0x3cad50,_0xcbd6af){_0xcbd6af=_0xcbd6af||0xcc;return function(_0x5be39d){if(_0x5be39d){return _0x3cad50[_0x3b3f('0x16')](_0xcbd6af);}return _0x3cad50[_0x3b3f('0x17')](_0xcbd6af)[_0x3b3f('0x18')]();};}function respondWithResult(_0x3a198f,_0x46f9aa){_0x46f9aa=_0x46f9aa||0xc8;return function(_0x535f04){if(_0x535f04){return _0x3a198f[_0x3b3f('0x17')](_0x46f9aa)['json'](_0x535f04);}};}function respondWithFilteredResult(_0x855057,_0x21b29f){return function(_0x119e19){if(_0x119e19){var _0x3cba88=_0x119e19[_0x3b3f('0x19')],_0x2dbb0d=_0x21b29f[_0x3b3f('0x1a')],_0x26b5ac=_0x21b29f[_0x3b3f('0x1a')]+_0x21b29f[_0x3b3f('0x1b')],_0x1896f5;if(_0x26b5ac>=_0x3cba88){_0x26b5ac=_0x3cba88;_0x1896f5=0xc8;}else{_0x1896f5=0xce;}_0x855057[_0x3b3f('0x17')](_0x1896f5);return _0x855057[_0x3b3f('0x1c')](_0x3b3f('0x1d'),_0x2dbb0d+'-'+_0x26b5ac+'/'+_0x3cba88)['json'](_0x119e19);}return null;};}function patchUpdates(_0x4208bd){return function(_0x1e68c3){try{jsonpatch[_0x3b3f('0x1e')](_0x1e68c3,_0x4208bd,!![]);}catch(_0x15b4f0){return BPromise[_0x3b3f('0x1f')](_0x15b4f0);}return _0x1e68c3[_0x3b3f('0x20')]();};}function saveUpdates(_0x81294,_0x167e91){return function(_0x63c40c){if(_0x63c40c){return _0x63c40c['update'](_0x81294)['then'](function(_0x34696a){return _0x34696a;});}return null;};}function removeEntity(_0x3b833f,_0x9318f1){return function(_0x573e61){if(_0x573e61){return _0x573e61[_0x3b3f('0x21')]()['then'](function(){_0x3b833f[_0x3b3f('0x17')](0xcc)[_0x3b3f('0x18')]();});}};}function handleEntityNotFound(_0x459119,_0x1bb01e){return function(_0x2ea457){if(!_0x2ea457){_0x459119['sendStatus'](0x194);}return _0x2ea457;};}function handleError(_0x243d69,_0x4b05f7){_0x4b05f7=_0x4b05f7||0x1f4;return function(_0x2165fb){logger[_0x3b3f('0x22')](_0x2165fb[_0x3b3f('0x23')]);if(_0x2165fb['name']){delete _0x2165fb[_0x3b3f('0x24')];}_0x243d69['status'](_0x4b05f7)[_0x3b3f('0x25')](_0x2165fb);};}exports['index']=function(_0x2ca58d,_0x425d99){var _0x583d76={},_0xb954c1={},_0x5867d8={'count':0x0,'rows':[]};var _0x45accd=_[_0x3b3f('0x26')](db[_0x3b3f('0x27')][_0x3b3f('0x28')],function(_0x4d5f62){return{'name':_0x4d5f62[_0x3b3f('0x29')],'type':_0x4d5f62[_0x3b3f('0x2a')]['key']};});_0xb954c1['model']=_[_0x3b3f('0x26')](_0x45accd,_0x3b3f('0x24'));_0xb954c1[_0x3b3f('0x2b')]=_[_0x3b3f('0x2c')](_0x2ca58d[_0x3b3f('0x2b')]);_0xb954c1[_0x3b3f('0x2d')]=_[_0x3b3f('0x2e')](_0xb954c1[_0x3b3f('0x2f')],_0xb954c1['query']);_0x583d76['attributes']=_['intersection'](_0xb954c1[_0x3b3f('0x2f')],qs[_0x3b3f('0x30')](_0x2ca58d['query']['fields']));_0x583d76[_0x3b3f('0x31')]=_0x583d76[_0x3b3f('0x31')]['length']?_0x583d76[_0x3b3f('0x31')]:_0xb954c1[_0x3b3f('0x2f')];if(!_0x2ca58d[_0x3b3f('0x2b')][_0x3b3f('0x32')]('nolimit')){_0x583d76[_0x3b3f('0x1b')]=qs[_0x3b3f('0x1b')](_0x2ca58d[_0x3b3f('0x2b')][_0x3b3f('0x1b')]);_0x583d76[_0x3b3f('0x1a')]=qs[_0x3b3f('0x1a')](_0x2ca58d[_0x3b3f('0x2b')][_0x3b3f('0x1a')]);}_0x583d76[_0x3b3f('0x33')]=qs[_0x3b3f('0x34')](_0x2ca58d[_0x3b3f('0x2b')]['sort']);_0x583d76['where']=qs[_0x3b3f('0x2d')](_['pick'](_0x2ca58d[_0x3b3f('0x2b')],_0xb954c1[_0x3b3f('0x2d')]),_0x45accd);if(_0x2ca58d['query'][_0x3b3f('0x35')]){_0x583d76[_0x3b3f('0x36')]=_[_0x3b3f('0x37')](_0x583d76['where'],{'$or':_[_0x3b3f('0x26')](_0x45accd,function(_0x2a3204){if(_0x2a3204['type']!==_0x3b3f('0x38')){var _0x59ed63={};_0x59ed63[_0x2a3204[_0x3b3f('0x24')]]={'$like':'%'+_0x2ca58d['query'][_0x3b3f('0x35')]+'%'};return _0x59ed63;}})});}_0x583d76=_[_0x3b3f('0x37')]({},_0x583d76,_0x2ca58d[_0x3b3f('0x39')]);var _0xcedb09={'where':_0x583d76['where']};return db['CloudProvider'][_0x3b3f('0x19')](_0xcedb09)['then'](function(_0x4322be){_0x5867d8[_0x3b3f('0x19')]=_0x4322be;if(_0x2ca58d[_0x3b3f('0x2b')]['includeAll']){_0x583d76[_0x3b3f('0x3a')]=[{'all':!![]}];}return db['CloudProvider'][_0x3b3f('0x3b')](_0x583d76);})[_0x3b3f('0x3c')](function(_0x374da4){_0x5867d8[_0x3b3f('0x3d')]=_0x374da4;return _0x5867d8;})[_0x3b3f('0x3c')](respondWithFilteredResult(_0x425d99,_0x583d76))['catch'](handleError(_0x425d99,null));};exports[_0x3b3f('0x3e')]=function(_0x5dfdb1,_0x3507c9){var _0x2faa29={'raw':!![],'where':{'id':_0x5dfdb1[_0x3b3f('0x3f')]['id']}},_0x3e39fe={};_0x3e39fe[_0x3b3f('0x2f')]=_[_0x3b3f('0x2c')](db[_0x3b3f('0x27')][_0x3b3f('0x28')]);_0x3e39fe[_0x3b3f('0x2b')]=_['keys'](_0x5dfdb1['query']);_0x3e39fe[_0x3b3f('0x2d')]=_[_0x3b3f('0x2e')](_0x3e39fe[_0x3b3f('0x2f')],_0x3e39fe[_0x3b3f('0x2b')]);_0x2faa29[_0x3b3f('0x31')]=_[_0x3b3f('0x2e')](_0x3e39fe[_0x3b3f('0x2f')],qs[_0x3b3f('0x30')](_0x5dfdb1[_0x3b3f('0x2b')][_0x3b3f('0x30')]));_0x2faa29[_0x3b3f('0x31')]=_0x2faa29[_0x3b3f('0x31')]['length']?_0x2faa29[_0x3b3f('0x31')]:_0x3e39fe[_0x3b3f('0x2f')];if(_0x5dfdb1[_0x3b3f('0x2b')][_0x3b3f('0x40')]){_0x2faa29['include']=[{'all':!![]}];}_0x2faa29=_[_0x3b3f('0x37')]({},_0x2faa29,_0x5dfdb1[_0x3b3f('0x39')]);return db[_0x3b3f('0x27')][_0x3b3f('0x41')](_0x2faa29)[_0x3b3f('0x3c')](handleEntityNotFound(_0x3507c9,null))[_0x3b3f('0x3c')](respondWithResult(_0x3507c9,null))['catch'](handleError(_0x3507c9,null));};exports['create']=function(_0x34c825,_0x2c8587){return db[_0x3b3f('0x27')][_0x3b3f('0x42')](_0x34c825[_0x3b3f('0x43')],{})[_0x3b3f('0x3c')](respondWithResult(_0x2c8587,0xc9))['catch'](handleError(_0x2c8587,null));};exports[_0x3b3f('0x44')]=function(_0x520d3b,_0x16ed98){if(_0x520d3b['body']['id']){delete _0x520d3b[_0x3b3f('0x43')]['id'];}return db[_0x3b3f('0x27')][_0x3b3f('0x41')]({'where':{'id':_0x520d3b['params']['id']}})[_0x3b3f('0x3c')](handleEntityNotFound(_0x16ed98,null))[_0x3b3f('0x3c')](saveUpdates(_0x520d3b[_0x3b3f('0x43')],null))[_0x3b3f('0x3c')](respondWithResult(_0x16ed98,null))['catch'](handleError(_0x16ed98,null));};exports[_0x3b3f('0x21')]=function(_0x263004,_0x15459e){return db['CloudProvider']['find']({'where':{'id':_0x263004[_0x3b3f('0x3f')]['id']}})[_0x3b3f('0x3c')](handleEntityNotFound(_0x15459e,null))[_0x3b3f('0x3c')](removeEntity(_0x15459e,null))[_0x3b3f('0x45')](handleError(_0x15459e,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 5456999..0dd4aaa 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 _0x5776=['cloud_providers','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider'];(function(_0xc12954,_0x253e72){var _0x14d239=function(_0x4bb1dd){while(--_0x4bb1dd){_0xc12954['push'](_0xc12954['shift']());}};_0x14d239(++_0x253e72);}(_0x5776,0x187));var _0x6577=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5776[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x6577('0x0'));var logger=require(_0x6577('0x1'))(_0x6577('0x2'));var moment=require(_0x6577('0x3'));var BPromise=require(_0x6577('0x4'));var rp=require(_0x6577('0x5'));var fs=require('fs');var path=require(_0x6577('0x6'));var rimraf=require(_0x6577('0x7'));var config=require('../../config/environment');var attributes=require(_0x6577('0x8'));module[_0x6577('0x9')]=function(_0x3639d8,_0x256ef3){return _0x3639d8[_0x6577('0xa')](_0x6577('0xb'),attributes,{'tableName':_0x6577('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x551a=['cloud_providers','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','CloudProvider'];(function(_0xbd926,_0x3c5a91){var _0x1d384b=function(_0x4a32a5){while(--_0x4a32a5){_0xbd926['push'](_0xbd926['shift']());}};_0x1d384b(++_0x3c5a91);}(_0x551a,0x1d5));var _0xa551=function(_0x31ec9e,_0x2c5bfa){_0x31ec9e=_0x31ec9e-0x0;var _0x5152be=_0x551a[_0x31ec9e];return _0x5152be;};'use strict';var _=require('lodash');var util=require(_0xa551('0x0'));var logger=require(_0xa551('0x1'))(_0xa551('0x2'));var moment=require(_0xa551('0x3'));var BPromise=require(_0xa551('0x4'));var rp=require(_0xa551('0x5'));var fs=require('fs');var path=require(_0xa551('0x6'));var rimraf=require(_0xa551('0x7'));var config=require(_0xa551('0x8'));var attributes=require(_0xa551('0x9'));module['exports']=function(_0x50cf85,_0x381cbc){return _0x50cf85['define'](_0xa551('0xa'),attributes,{'tableName':_0xa551('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 1ac20c4..00c1b86 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 _0x6a20=['error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6a20,0x13f));var _0x06a2=function(_0x571f36,_0x58551e){_0x571f36=_0x571f36-0x0;var _0x12724f=_0x6a20[_0x571f36];return _0x12724f;};'use strict';var _=require(_0x06a2('0x0'));var util=require('util');var moment=require(_0x06a2('0x1'));var BPromise=require(_0x06a2('0x2'));var rs=require(_0x06a2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x06a2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x06a2('0x5'));var config=require('../../config/environment');var jayson=require(_0x06a2('0x6'));var client=jayson[_0x06a2('0x7')][_0x06a2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x255aec,_0x4917fe,_0x1ebb76){return new BPromise(function(_0x40eb3b,_0x27f28b){return client[_0x06a2('0x9')](_0x255aec,_0x1ebb76)[_0x06a2('0xa')](function(_0x2a6e17){logger[_0x06a2('0xb')](_0x06a2('0xc'),_0x4917fe,_0x06a2('0xd'));logger[_0x06a2('0xe')](_0x06a2('0xf'),_0x4917fe,_0x06a2('0xd'),JSON[_0x06a2('0x10')](_0x2a6e17));if(_0x2a6e17[_0x06a2('0x11')]){if(_0x2a6e17['error'][_0x06a2('0x12')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x4917fe,_0x2a6e17[_0x06a2('0x11')]['message']);return _0x27f28b(_0x2a6e17[_0x06a2('0x11')][_0x06a2('0x13')]);}logger['error'](_0x06a2('0xc'),_0x4917fe,_0x2a6e17[_0x06a2('0x11')][_0x06a2('0x13')]);return _0x40eb3b(_0x2a6e17['error'][_0x06a2('0x13')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x4917fe,_0x06a2('0xd'));_0x40eb3b(_0x2a6e17['result']['message']);}})[_0x06a2('0x14')](function(_0x3e1b02){logger[_0x06a2('0x11')](_0x06a2('0xc'),_0x4917fe,_0x3e1b02);_0x27f28b(_0x3e1b02);});});} \ No newline at end of file +var _0xe37e=['http','request','then','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0xb175c7,_0x4b50b2){var _0x107183=function(_0x1b8aa2){while(--_0x1b8aa2){_0xb175c7['push'](_0xb175c7['shift']());}};_0x107183(++_0x4b50b2);}(_0xe37e,0xbc));var _0xee37=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xe37e[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0xee37('0x0'));var moment=require(_0xee37('0x1'));var BPromise=require(_0xee37('0x2'));var rs=require(_0xee37('0x3'));var fs=require('fs');var Redis=require(_0xee37('0x4'));var db=require(_0xee37('0x5'))['db'];var utils=require(_0xee37('0x6'));var logger=require(_0xee37('0x7'))(_0xee37('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xee37('0x9')][_0xee37('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59d554,_0x3f0059,_0x36510c){return new BPromise(function(_0x5c064d,_0x5cd337){return client[_0xee37('0xb')](_0x59d554,_0x36510c)[_0xee37('0xc')](function(_0x5d9586){logger['info']('CloudProvider,\x20%s,\x20%s',_0x3f0059,_0xee37('0xd'));logger['debug'](_0xee37('0xe'),_0x3f0059,'request\x20sent',JSON[_0xee37('0xf')](_0x5d9586));if(_0x5d9586['error']){if(_0x5d9586[_0xee37('0x10')]['code']===0x1f4){logger['error'](_0xee37('0x11'),_0x3f0059,_0x5d9586[_0xee37('0x10')][_0xee37('0x12')]);return _0x5cd337(_0x5d9586[_0xee37('0x10')][_0xee37('0x12')]);}logger['error'](_0xee37('0x11'),_0x3f0059,_0x5d9586[_0xee37('0x10')][_0xee37('0x12')]);return _0x5c064d(_0x5d9586[_0xee37('0x10')][_0xee37('0x12')]);}else{logger[_0xee37('0x13')](_0xee37('0x11'),_0x3f0059,_0xee37('0xd'));_0x5c064d(_0x5d9586[_0xee37('0x14')][_0xee37('0x12')]);}})[_0xee37('0x15')](function(_0xee9159){logger[_0xee37('0x10')]('CloudProvider,\x20%s,\x20%s',_0x3f0059,_0xee9159);_0x5cd337(_0xee9159);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 95b86d6..bb0a233 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 _0xc4ed=['util','path','connect-timeout','Router','./cloudProvider.controller','get','index','/:id','isAuthenticated','post','create','update','delete','exports','multer'];(function(_0x5ccdf5,_0x47ee1c){var _0x210b53=function(_0x461c1c){while(--_0x461c1c){_0x5ccdf5['push'](_0x5ccdf5['shift']());}};_0x210b53(++_0x47ee1c);}(_0xc4ed,0x68));var _0xdc4e=function(_0x3cf7df,_0x43b053){_0x3cf7df=_0x3cf7df-0x0;var _0x52ca51=_0xc4ed[_0x3cf7df];return _0x52ca51;};'use strict';var multer=require(_0xdc4e('0x0'));var util=require(_0xdc4e('0x1'));var path=require(_0xdc4e('0x2'));var timeout=require(_0xdc4e('0x3'));var express=require('express');var router=express[_0xdc4e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdc4e('0x5'));router[_0xdc4e('0x6')]('/',auth['isAuthenticated'](),controller[_0xdc4e('0x7')]);router[_0xdc4e('0x6')](_0xdc4e('0x8'),auth[_0xdc4e('0x9')](),controller['show']);router[_0xdc4e('0xa')]('/',auth[_0xdc4e('0x9')](),controller[_0xdc4e('0xb')]);router['put'](_0xdc4e('0x8'),auth[_0xdc4e('0x9')](),controller[_0xdc4e('0xc')]);router[_0xdc4e('0xd')](_0xdc4e('0x8'),auth[_0xdc4e('0x9')](),controller['destroy']);module[_0xdc4e('0xe')]=router; \ No newline at end of file +var _0xd46d=['../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x37a149,_0x3be794){var _0x3f2efc=function(_0x30aa19){while(--_0x30aa19){_0x37a149['push'](_0x37a149['shift']());}};_0x3f2efc(++_0x3be794);}(_0xd46d,0x6c));var _0xdd46=function(_0x4445bb,_0x1d23d4){_0x4445bb=_0x4445bb-0x0;var _0x54b20d=_0xd46d[_0x4445bb];return _0x54b20d;};'use strict';var multer=require(_0xdd46('0x0'));var util=require('util');var path=require(_0xdd46('0x1'));var timeout=require(_0xdd46('0x2'));var express=require(_0xdd46('0x3'));var router=express[_0xdd46('0x4')]();var auth=require(_0xdd46('0x5'));var interaction=require(_0xdd46('0x6'));var config=require(_0xdd46('0x7'));var controller=require(_0xdd46('0x8'));router[_0xdd46('0x9')]('/',auth[_0xdd46('0xa')](),controller[_0xdd46('0xb')]);router[_0xdd46('0x9')](_0xdd46('0xc'),auth['isAuthenticated'](),controller[_0xdd46('0xd')]);router[_0xdd46('0xe')]('/',auth['isAuthenticated'](),controller[_0xdd46('0xf')]);router[_0xdd46('0x10')](_0xdd46('0xc'),auth['isAuthenticated'](),controller[_0xdd46('0x11')]);router['delete']('/:id',auth[_0xdd46('0xa')](),controller[_0xdd46('0x12')]);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 2a20536..c998e89 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 _0xff50=['STRING','name','sequelize'];(function(_0x297c55,_0x34fa75){var _0x120389=function(_0x595108){while(--_0x595108){_0x297c55['push'](_0x297c55['shift']());}};_0x120389(++_0x34fa75);}(_0xff50,0x164));var _0x0ff5=function(_0x495b3d,_0x4d3da4){_0x495b3d=_0x495b3d-0x0;var _0x4cb329=_0xff50[_0x495b3d];return _0x4cb329;};'use strict';var Sequelize=require(_0x0ff5('0x0'));module['exports']={'name':{'type':Sequelize[_0x0ff5('0x1')],'unique':_0x0ff5('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0ff5('0x1')]},'companyId':{'type':Sequelize[_0x0ff5('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0ff5('0x1')]},'fax':{'type':Sequelize[_0x0ff5('0x1')]},'type':{'type':Sequelize[_0x0ff5('0x1')]},'street':{'type':Sequelize[_0x0ff5('0x1')]},'postalCode':{'type':Sequelize[_0x0ff5('0x1')]},'city':{'type':Sequelize[_0x0ff5('0x1')]},'country':{'type':Sequelize[_0x0ff5('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0ff5('0x1')]},'sStreet':{'type':Sequelize[_0x0ff5('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x0ff5('0x1')]},'sCountry':{'type':Sequelize[_0x0ff5('0x1')]},'description':{'type':Sequelize[_0x0ff5('0x1')]}}; \ No newline at end of file +var _0xe6ef=['name','sequelize','exports','STRING'];(function(_0x188363,_0xa749b2){var _0xd21b1b=function(_0x4a6a17){while(--_0x4a6a17){_0x188363['push'](_0x188363['shift']());}};_0xd21b1b(++_0xa749b2);}(_0xe6ef,0x91));var _0xfe6e=function(_0x1046c7,_0x3cd092){_0x1046c7=_0x1046c7-0x0;var _0x4cf13e=_0xe6ef[_0x1046c7];return _0x4cf13e;};'use strict';var Sequelize=require(_0xfe6e('0x0'));module[_0xfe6e('0x1')]={'name':{'type':Sequelize[_0xfe6e('0x2')],'unique':_0xfe6e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xfe6e('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xfe6e('0x2')]},'phone':{'type':Sequelize[_0xfe6e('0x2')]},'fax':{'type':Sequelize[_0xfe6e('0x2')]},'type':{'type':Sequelize[_0xfe6e('0x2')]},'street':{'type':Sequelize[_0xfe6e('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xfe6e('0x2')]},'country':{'type':Sequelize[_0xfe6e('0x2')]},'email':{'type':Sequelize[_0xfe6e('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xfe6e('0x2')]},'sPostalCode':{'type':Sequelize[_0xfe6e('0x2')]},'sCity':{'type':Sequelize[_0xfe6e('0x2')]},'sCountry':{'type':Sequelize[_0xfe6e('0x2')]},'description':{'type':Sequelize[_0xfe6e('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 5d1bfa6..f5daa61 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 _0x2688=['set','Content-Range','json','apply','reject','update','then','destroy','get','Companies','end','error','stack','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','where','pick','filters','merge','map','options','include','rows','catch','params','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','omit','getContacts','findOne','sort','filter','nolimit','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset'];(function(_0x587f2d,_0x1eb138){var _0x130af1=function(_0x572a18){while(--_0x572a18){_0x587f2d['push'](_0x587f2d['shift']());}};_0x130af1(++_0x1eb138);}(_0x2688,0x180));var _0x8268=function(_0x328b40,_0x370642){_0x328b40=_0x328b40-0x0;var _0x556a56=_0x2688[_0x328b40];return _0x556a56;};'use strict';var pdf=require(_0x8268('0x0'));var emlformat=require(_0x8268('0x1'));var rimraf=require(_0x8268('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8268('0x3'));var rp=require(_0x8268('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8268('0x5'));var util=require(_0x8268('0x6'));var path=require(_0x8268('0x7'));var sox=require(_0x8268('0x8'));var csv=require(_0x8268('0x9'));var ejs=require(_0x8268('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8268('0xb'));var crypto=require('crypto');var jsforce=require(_0x8268('0xc'));var deskjs=require(_0x8268('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8268('0xe'));var Papa=require(_0x8268('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8268('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8268('0x11'));var logger=require(_0x8268('0x12'))(_0x8268('0x13'));var utils=require('../../config/utils');var config=require(_0x8268('0x14'));var db=require(_0x8268('0x15'))['db'];function respondWithStatusCode(_0x2cae7c,_0x5beb11){_0x5beb11=_0x5beb11||0xcc;return function(_0x193c7b){if(_0x193c7b){return _0x2cae7c[_0x8268('0x16')](_0x5beb11);}return _0x2cae7c[_0x8268('0x17')](_0x5beb11)['end']();};}function respondWithResult(_0x2760f3,_0x24a1da){_0x24a1da=_0x24a1da||0xc8;return function(_0x5a4ee7){if(_0x5a4ee7){return _0x2760f3[_0x8268('0x17')](_0x24a1da)['json'](_0x5a4ee7);}};}function respondWithFilteredResult(_0x36fefb,_0x13c5c6){return function(_0x1f2c05){if(_0x1f2c05){var _0x3c9977=_0x1f2c05[_0x8268('0x18')],_0x584448=_0x13c5c6[_0x8268('0x19')],_0x2bd6e7=_0x13c5c6[_0x8268('0x19')]+_0x13c5c6['limit'],_0x402d41;if(_0x2bd6e7>=_0x3c9977){_0x2bd6e7=_0x3c9977;_0x402d41=0xc8;}else{_0x402d41=0xce;}_0x36fefb[_0x8268('0x17')](_0x402d41);return _0x36fefb[_0x8268('0x1a')](_0x8268('0x1b'),_0x584448+'-'+_0x2bd6e7+'/'+_0x3c9977)[_0x8268('0x1c')](_0x1f2c05);}return null;};}function patchUpdates(_0x135161){return function(_0x47744c){try{jsonpatch[_0x8268('0x1d')](_0x47744c,_0x135161,!![]);}catch(_0x385bd0){return BPromise[_0x8268('0x1e')](_0x385bd0);}return _0x47744c['save']();};}function saveUpdates(_0x28706e,_0x4bd2a0){return function(_0x175958){if(_0x175958){return _0x175958[_0x8268('0x1f')](_0x28706e)[_0x8268('0x20')](function(_0x4470dc){return _0x4470dc;});}return null;};}function removeEntity(_0x498001,_0x223d24){return function(_0x55736a){if(_0x55736a){return _0x55736a[_0x8268('0x21')]()[_0x8268('0x20')](function(){var _0x179f00=_0x55736a[_0x8268('0x22')]({'plain':!![]});var _0x5458a1=_0x8268('0x23');return db['UserProfileResource'][_0x8268('0x21')]({'where':{'type':_0x5458a1,'resourceId':_0x179f00['id']}})[_0x8268('0x20')](function(){return _0x55736a;});})['then'](function(){_0x498001[_0x8268('0x17')](0xcc)[_0x8268('0x24')]();});}};}function handleEntityNotFound(_0x5eb706,_0xba852b){return function(_0x2cc898){if(!_0x2cc898){_0x5eb706[_0x8268('0x16')](0x194);}return _0x2cc898;};}function handleError(_0x39a73a,_0x117d67){_0x117d67=_0x117d67||0x1f4;return function(_0x3f176c){logger[_0x8268('0x25')](_0x3f176c[_0x8268('0x26')]);if(_0x3f176c[_0x8268('0x27')]){delete _0x3f176c[_0x8268('0x27')];}_0x39a73a[_0x8268('0x17')](_0x117d67)[_0x8268('0x28')](_0x3f176c);};}exports[_0x8268('0x29')]=function(_0x3b0692,_0x30589b){var _0x5654f6={},_0x19af3c={},_0x27a37b={'count':0x0,'rows':[]};return db[_0x8268('0x2a')][_0x8268('0x2b')]()[_0x8268('0x20')](function(_0x414811){_0x19af3c[_0x8268('0x2c')]=_[_0x8268('0x2d')](_0x414811);_0x19af3c['query']=_[_0x8268('0x2d')](_0x3b0692[_0x8268('0x2e')]);_0x19af3c['filters']=_[_0x8268('0x2f')](_0x19af3c['model'],_0x19af3c[_0x8268('0x2e')]);_0x5654f6[_0x8268('0x30')]=_[_0x8268('0x2f')](_0x19af3c[_0x8268('0x2c')],qs[_0x8268('0x31')](_0x3b0692[_0x8268('0x2e')][_0x8268('0x31')]));_0x5654f6[_0x8268('0x30')]=_0x5654f6[_0x8268('0x30')][_0x8268('0x32')]?_0x5654f6[_0x8268('0x30')]:_0x19af3c[_0x8268('0x2c')];if(!_0x3b0692['query'][_0x8268('0x33')]('nolimit')){_0x5654f6[_0x8268('0x34')]=qs[_0x8268('0x34')](_0x3b0692[_0x8268('0x2e')][_0x8268('0x34')]);_0x5654f6[_0x8268('0x19')]=qs[_0x8268('0x19')](_0x3b0692['query'][_0x8268('0x19')]);}_0x5654f6[_0x8268('0x35')]=qs['sort'](_0x3b0692[_0x8268('0x2e')]['sort']);_0x5654f6[_0x8268('0x36')]=qs['filters'](_[_0x8268('0x37')](_0x3b0692[_0x8268('0x2e')],_0x19af3c[_0x8268('0x38')]),_0x414811);if(_0x3b0692[_0x8268('0x2e')]['filter']){_0x5654f6[_0x8268('0x36')]=_[_0x8268('0x39')](_0x5654f6[_0x8268('0x36')],{'$or':_[_0x8268('0x3a')](_0x5654f6['attributes'],function(_0x5ebd41){var _0x3985e0={};_0x3985e0[_0x5ebd41]={'$like':'%'+_0x3b0692[_0x8268('0x2e')]['filter']+'%'};return _0x3985e0;})});}_0x5654f6=_[_0x8268('0x39')]({},_0x5654f6,_0x3b0692[_0x8268('0x3b')]);var _0x47829f={'where':_0x5654f6[_0x8268('0x36')]};return db['CmCompany'][_0x8268('0x18')](_0x47829f)['then'](function(_0x8c29d5){_0x27a37b['count']=_0x8c29d5;if(_0x3b0692['query']['includeAll']){_0x5654f6[_0x8268('0x3c')]=[{'all':!![]}];}return db[_0x8268('0x2a')]['findAll'](_0x5654f6);})['then'](function(_0x2a8d9a){_0x27a37b[_0x8268('0x3d')]=_0x2a8d9a;return _0x27a37b;})[_0x8268('0x20')](respondWithFilteredResult(_0x30589b,_0x5654f6))['catch'](handleError(_0x30589b,null));})[_0x8268('0x3e')](handleError(_0x30589b,null));};exports['show']=function(_0x5778ad,_0x14b69e){var _0x1b19a8={'raw':![],'where':{'id':_0x5778ad[_0x8268('0x3f')]['id']}},_0x373dbd={};_0x373dbd[_0x8268('0x2c')]=_[_0x8268('0x2d')](db[_0x8268('0x2a')][_0x8268('0x40')]);_0x373dbd['query']=_[_0x8268('0x2d')](_0x5778ad[_0x8268('0x2e')]);_0x373dbd[_0x8268('0x38')]=_[_0x8268('0x2f')](_0x373dbd[_0x8268('0x2c')],_0x373dbd[_0x8268('0x2e')]);_0x1b19a8[_0x8268('0x30')]=_['intersection'](_0x373dbd['model'],qs[_0x8268('0x31')](_0x5778ad['query']['fields']));_0x1b19a8['attributes']=_0x1b19a8[_0x8268('0x30')]['length']?_0x1b19a8[_0x8268('0x30')]:_0x373dbd[_0x8268('0x2c')];if(_0x5778ad['query'][_0x8268('0x41')]){_0x1b19a8[_0x8268('0x3c')]=[{'all':!![]}];}_0x1b19a8=_['merge']({},_0x1b19a8,_0x5778ad[_0x8268('0x3b')]);return db['CmCompany'][_0x8268('0x42')](_0x1b19a8)[_0x8268('0x20')](handleEntityNotFound(_0x14b69e,null))[_0x8268('0x20')](respondWithResult(_0x14b69e,null))[_0x8268('0x3e')](handleError(_0x14b69e,null));};exports[_0x8268('0x43')]=function(_0x2614e5,_0x160810){return db[_0x8268('0x2a')]['create'](_0x2614e5['body'],{})[_0x8268('0x20')](function(_0x22f6a8){var _0x4ea560=_0x2614e5[_0x8268('0x44')][_0x8268('0x22')]({'plain':!![]});if(!_0x4ea560)throw new Error(_0x8268('0x45'));if(_0x4ea560['role']===_0x8268('0x44')){var _0x2a490c=_0x22f6a8['get']({'plain':!![]});var _0x4b54fd='Companies';return db[_0x8268('0x46')][_0x8268('0x42')]({'where':{'name':_0x4b54fd,'userProfileId':_0x4ea560['userProfileId']},'raw':!![]})[_0x8268('0x20')](function(_0x3addf0){if(_0x3addf0&&_0x3addf0[_0x8268('0x47')]===0x0){return db[_0x8268('0x48')]['create']({'name':_0x2a490c[_0x8268('0x27')],'resourceId':_0x2a490c['id'],'type':_0x3addf0['name'],'sectionId':_0x3addf0['id']},{})[_0x8268('0x20')](function(){return _0x22f6a8;});}else{return _0x22f6a8;}})[_0x8268('0x3e')](function(_0x39bb59){logger[_0x8268('0x25')](_0x8268('0x49'),_0x39bb59);throw _0x39bb59;});}return _0x22f6a8;})[_0x8268('0x20')](respondWithResult(_0x160810,0xc9))['catch'](handleError(_0x160810,null));};exports[_0x8268('0x1f')]=function(_0x3d2155,_0xb721a9){if(_0x3d2155[_0x8268('0x4a')]['id']){delete _0x3d2155[_0x8268('0x4a')]['id'];}return db[_0x8268('0x2a')][_0x8268('0x42')]({'where':{'id':_0x3d2155[_0x8268('0x3f')]['id']}})[_0x8268('0x20')](handleEntityNotFound(_0xb721a9,null))['then'](saveUpdates(_0x3d2155['body'],null))[_0x8268('0x20')](respondWithResult(_0xb721a9,null))[_0x8268('0x3e')](handleError(_0xb721a9,null));};exports[_0x8268('0x21')]=function(_0x492f59,_0x51c26d){return db[_0x8268('0x2a')][_0x8268('0x42')]({'where':{'id':_0x492f59[_0x8268('0x3f')]['id']}})[_0x8268('0x20')](handleEntityNotFound(_0x51c26d,null))[_0x8268('0x20')](removeEntity(_0x51c26d,null))['catch'](handleError(_0x51c26d,null));};exports[_0x8268('0x2b')]=function(_0x1c3967,_0x133fca){return db[_0x8268('0x2a')][_0x8268('0x2b')]()[_0x8268('0x20')](respondWithResult(_0x133fca,null))['catch'](handleError(_0x133fca,null));};exports['addContacts']=function(_0x5b3ab6,_0x394859,_0x55528a){return db['CmContact'][_0x8268('0x42')]({'where':{'id':_0x5b3ab6[_0x8268('0x3f')]['id']}})['then'](handleEntityNotFound(_0x394859,null))[_0x8268('0x20')](function(_0x5b2cfe){if(_0x5b2cfe){return _0x5b2cfe[_0x8268('0x4b')](_0x5b3ab6['body']['ids'],_[_0x8268('0x4c')](_0x5b3ab6[_0x8268('0x4a')],['ids','id'])||{});}})[_0x8268('0x20')](respondWithResult(_0x394859,null))[_0x8268('0x3e')](handleError(_0x394859,null));};exports[_0x8268('0x4d')]=function(_0x36f5e8,_0x571946,_0x48b539){var _0xa8f012={};var _0x18b228={};var _0x513d3b;var _0x2d0af3;return db[_0x8268('0x2a')][_0x8268('0x4e')]({'where':{'id':_0x36f5e8[_0x8268('0x3f')]['id']}})['then'](handleEntityNotFound(_0x571946,null))[_0x8268('0x20')](function(_0x1dd04b){if(_0x1dd04b){_0x513d3b=_0x1dd04b;_0x18b228[_0x8268('0x2c')]=_[_0x8268('0x2d')](db['CmContact'][_0x8268('0x40')]);_0x18b228[_0x8268('0x2e')]=_[_0x8268('0x2d')](_0x36f5e8[_0x8268('0x2e')]);_0x18b228[_0x8268('0x38')]=_[_0x8268('0x2f')](_0x18b228[_0x8268('0x2c')],_0x18b228[_0x8268('0x2e')]);_0xa8f012[_0x8268('0x30')]=_['intersection'](_0x18b228['model'],qs[_0x8268('0x31')](_0x36f5e8['query'][_0x8268('0x31')]));_0xa8f012['attributes']=_0xa8f012[_0x8268('0x30')][_0x8268('0x32')]?_0xa8f012[_0x8268('0x30')]:_0x18b228[_0x8268('0x2c')];_0xa8f012['order']=qs[_0x8268('0x4f')](_0x36f5e8[_0x8268('0x2e')][_0x8268('0x4f')]);_0xa8f012[_0x8268('0x36')]=qs['filters'](_[_0x8268('0x37')](_0x36f5e8[_0x8268('0x2e')],_0x18b228[_0x8268('0x38')]));if(_0x36f5e8[_0x8268('0x2e')][_0x8268('0x50')]){_0xa8f012[_0x8268('0x36')]=_[_0x8268('0x39')](_0xa8f012[_0x8268('0x36')],{'$or':_[_0x8268('0x3a')](_0xa8f012[_0x8268('0x30')],function(_0x36b7fd){var _0xc349c3={};_0xc349c3[_0x36b7fd]={'$like':'%'+_0x36f5e8['query'][_0x8268('0x50')]+'%'};return _0xc349c3;})});}_0xa8f012=_[_0x8268('0x39')]({},_0xa8f012,_0x36f5e8[_0x8268('0x3b')]);return _0x513d3b[_0x8268('0x4d')](_0xa8f012);}})[_0x8268('0x20')](function(_0xd0ea3){if(_0xd0ea3){_0x2d0af3=_0xd0ea3['length'];if(!_0x36f5e8[_0x8268('0x2e')][_0x8268('0x33')](_0x8268('0x51'))){_0xa8f012[_0x8268('0x34')]=qs[_0x8268('0x34')](_0x36f5e8[_0x8268('0x2e')][_0x8268('0x34')]);_0xa8f012[_0x8268('0x19')]=qs['offset'](_0x36f5e8[_0x8268('0x2e')][_0x8268('0x19')]);}return _0x513d3b['getContacts'](_0xa8f012);}})['then'](function(_0x380a72){if(_0x380a72){return _0x380a72?{'count':_0x2d0af3,'rows':_0x380a72}:null;}})['then'](respondWithResult(_0x571946,null))[_0x8268('0x3e')](handleError(_0x571946,null));}; \ No newline at end of file +var _0x3fc0=['limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Companies','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContact','addContacts','ids','omit','getContacts','findOne','pick','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x3fc0,0x13c));var _0x03fc=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x3fc0[_0x36dfbd];return _0x4ecad9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x03fc('0x0'));var zipdir=require(_0x03fc('0x1'));var jsonpatch=require(_0x03fc('0x2'));var rp=require(_0x03fc('0x3'));var moment=require(_0x03fc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x03fc('0x5'));var util=require(_0x03fc('0x6'));var path=require(_0x03fc('0x7'));var sox=require(_0x03fc('0x8'));var csv=require('to-csv');var ejs=require(_0x03fc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x03fc('0xa'));var crypto=require(_0x03fc('0xb'));var jsforce=require(_0x03fc('0xc'));var deskjs=require(_0x03fc('0xd'));var toCsv=require(_0x03fc('0xe'));var querystring=require(_0x03fc('0xf'));var Papa=require(_0x03fc('0x10'));var Redis=require(_0x03fc('0x11'));var authService=require(_0x03fc('0x12'));var qs=require(_0x03fc('0x13'));var as=require(_0x03fc('0x14'));var hardwareService=require(_0x03fc('0x15'));var logger=require(_0x03fc('0x16'))(_0x03fc('0x17'));var utils=require(_0x03fc('0x18'));var config=require(_0x03fc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c1d9f,_0xadb1f3){_0xadb1f3=_0xadb1f3||0xcc;return function(_0x3c2430){if(_0x3c2430){return _0x3c1d9f[_0x03fc('0x1a')](_0xadb1f3);}return _0x3c1d9f[_0x03fc('0x1b')](_0xadb1f3)[_0x03fc('0x1c')]();};}function respondWithResult(_0x4d1381,_0x11e45c){_0x11e45c=_0x11e45c||0xc8;return function(_0x4c8171){if(_0x4c8171){return _0x4d1381[_0x03fc('0x1b')](_0x11e45c)[_0x03fc('0x1d')](_0x4c8171);}};}function respondWithFilteredResult(_0x28c9fa,_0xfb4ee8){return function(_0x3e6902){if(_0x3e6902){var _0x529343=_0x3e6902[_0x03fc('0x1e')],_0x5acb46=_0xfb4ee8[_0x03fc('0x1f')],_0x4d5511=_0xfb4ee8['offset']+_0xfb4ee8[_0x03fc('0x20')],_0x34593d;if(_0x4d5511>=_0x529343){_0x4d5511=_0x529343;_0x34593d=0xc8;}else{_0x34593d=0xce;}_0x28c9fa[_0x03fc('0x1b')](_0x34593d);return _0x28c9fa[_0x03fc('0x21')](_0x03fc('0x22'),_0x5acb46+'-'+_0x4d5511+'/'+_0x529343)[_0x03fc('0x1d')](_0x3e6902);}return null;};}function patchUpdates(_0x26abbe){return function(_0x3a0a19){try{jsonpatch[_0x03fc('0x23')](_0x3a0a19,_0x26abbe,!![]);}catch(_0x16241e){return BPromise[_0x03fc('0x24')](_0x16241e);}return _0x3a0a19[_0x03fc('0x25')]();};}function saveUpdates(_0x400042,_0x4af1e7){return function(_0x40c17a){if(_0x40c17a){return _0x40c17a[_0x03fc('0x26')](_0x400042)[_0x03fc('0x27')](function(_0x1e178d){return _0x1e178d;});}return null;};}function removeEntity(_0x378493,_0xe20747){return function(_0x2e8392){if(_0x2e8392){return _0x2e8392[_0x03fc('0x28')]()[_0x03fc('0x27')](function(){var _0xa188a4=_0x2e8392[_0x03fc('0x29')]({'plain':!![]});var _0x4f0cd6='Companies';return db[_0x03fc('0x2a')][_0x03fc('0x28')]({'where':{'type':_0x4f0cd6,'resourceId':_0xa188a4['id']}})[_0x03fc('0x27')](function(){return _0x2e8392;});})[_0x03fc('0x27')](function(){_0x378493[_0x03fc('0x1b')](0xcc)[_0x03fc('0x1c')]();});}};}function handleEntityNotFound(_0x3f39ea,_0x138bac){return function(_0x2760f9){if(!_0x2760f9){_0x3f39ea['sendStatus'](0x194);}return _0x2760f9;};}function handleError(_0x32015d,_0x3b4059){_0x3b4059=_0x3b4059||0x1f4;return function(_0x422c94){logger[_0x03fc('0x2b')](_0x422c94['stack']);if(_0x422c94[_0x03fc('0x2c')]){delete _0x422c94[_0x03fc('0x2c')];}_0x32015d[_0x03fc('0x1b')](_0x3b4059)[_0x03fc('0x2d')](_0x422c94);};}exports['index']=function(_0x10b2e7,_0x30c96a){var _0x54c16d={},_0x48d1ef={},_0x58e602={'count':0x0,'rows':[]};return db[_0x03fc('0x2e')][_0x03fc('0x2f')]()[_0x03fc('0x27')](function(_0x4b91ce){_0x48d1ef[_0x03fc('0x30')]=_[_0x03fc('0x31')](_0x4b91ce);_0x48d1ef[_0x03fc('0x32')]=_['keys'](_0x10b2e7[_0x03fc('0x32')]);_0x48d1ef['filters']=_[_0x03fc('0x33')](_0x48d1ef[_0x03fc('0x30')],_0x48d1ef[_0x03fc('0x32')]);_0x54c16d[_0x03fc('0x34')]=_['intersection'](_0x48d1ef[_0x03fc('0x30')],qs[_0x03fc('0x35')](_0x10b2e7['query'][_0x03fc('0x35')]));_0x54c16d[_0x03fc('0x34')]=_0x54c16d['attributes'][_0x03fc('0x36')]?_0x54c16d['attributes']:_0x48d1ef[_0x03fc('0x30')];if(!_0x10b2e7['query'][_0x03fc('0x37')]('nolimit')){_0x54c16d[_0x03fc('0x20')]=qs[_0x03fc('0x20')](_0x10b2e7[_0x03fc('0x32')][_0x03fc('0x20')]);_0x54c16d[_0x03fc('0x1f')]=qs[_0x03fc('0x1f')](_0x10b2e7[_0x03fc('0x32')]['offset']);}_0x54c16d[_0x03fc('0x38')]=qs[_0x03fc('0x39')](_0x10b2e7[_0x03fc('0x32')][_0x03fc('0x39')]);_0x54c16d[_0x03fc('0x3a')]=qs[_0x03fc('0x3b')](_['pick'](_0x10b2e7['query'],_0x48d1ef[_0x03fc('0x3b')]),_0x4b91ce);if(_0x10b2e7[_0x03fc('0x32')][_0x03fc('0x3c')]){_0x54c16d[_0x03fc('0x3a')]=_[_0x03fc('0x3d')](_0x54c16d[_0x03fc('0x3a')],{'$or':_['map'](_0x54c16d[_0x03fc('0x34')],function(_0x1484cf){var _0x5401a1={};_0x5401a1[_0x1484cf]={'$like':'%'+_0x10b2e7['query'][_0x03fc('0x3c')]+'%'};return _0x5401a1;})});}_0x54c16d=_[_0x03fc('0x3d')]({},_0x54c16d,_0x10b2e7[_0x03fc('0x3e')]);var _0x17c62c={'where':_0x54c16d[_0x03fc('0x3a')]};return db[_0x03fc('0x2e')][_0x03fc('0x1e')](_0x17c62c)[_0x03fc('0x27')](function(_0x143f17){_0x58e602[_0x03fc('0x1e')]=_0x143f17;if(_0x10b2e7[_0x03fc('0x32')][_0x03fc('0x3f')]){_0x54c16d[_0x03fc('0x40')]=[{'all':!![]}];}return db[_0x03fc('0x2e')][_0x03fc('0x41')](_0x54c16d);})[_0x03fc('0x27')](function(_0x462632){_0x58e602[_0x03fc('0x42')]=_0x462632;return _0x58e602;})['then'](respondWithFilteredResult(_0x30c96a,_0x54c16d))['catch'](handleError(_0x30c96a,null));})[_0x03fc('0x43')](handleError(_0x30c96a,null));};exports[_0x03fc('0x44')]=function(_0x2e3245,_0x54f5a4){var _0x2958d5={'raw':![],'where':{'id':_0x2e3245['params']['id']}},_0xe6c2c0={};_0xe6c2c0[_0x03fc('0x30')]=_['keys'](db['CmCompany'][_0x03fc('0x45')]);_0xe6c2c0[_0x03fc('0x32')]=_[_0x03fc('0x31')](_0x2e3245[_0x03fc('0x32')]);_0xe6c2c0[_0x03fc('0x3b')]=_[_0x03fc('0x33')](_0xe6c2c0['model'],_0xe6c2c0[_0x03fc('0x32')]);_0x2958d5[_0x03fc('0x34')]=_['intersection'](_0xe6c2c0[_0x03fc('0x30')],qs[_0x03fc('0x35')](_0x2e3245[_0x03fc('0x32')]['fields']));_0x2958d5[_0x03fc('0x34')]=_0x2958d5[_0x03fc('0x34')][_0x03fc('0x36')]?_0x2958d5['attributes']:_0xe6c2c0['model'];if(_0x2e3245[_0x03fc('0x32')][_0x03fc('0x3f')]){_0x2958d5[_0x03fc('0x40')]=[{'all':!![]}];}_0x2958d5=_[_0x03fc('0x3d')]({},_0x2958d5,_0x2e3245[_0x03fc('0x3e')]);return db['CmCompany'][_0x03fc('0x46')](_0x2958d5)[_0x03fc('0x27')](handleEntityNotFound(_0x54f5a4,null))[_0x03fc('0x27')](respondWithResult(_0x54f5a4,null))[_0x03fc('0x43')](handleError(_0x54f5a4,null));};exports['create']=function(_0x4fdc10,_0xb31356){return db[_0x03fc('0x2e')][_0x03fc('0x47')](_0x4fdc10[_0x03fc('0x48')],{})[_0x03fc('0x27')](function(_0xd086b){var _0x126330=_0x4fdc10['user'][_0x03fc('0x29')]({'plain':!![]});if(!_0x126330)throw new Error(_0x03fc('0x49'));if(_0x126330[_0x03fc('0x4a')]===_0x03fc('0x4b')){var _0xbc3ab7=_0xd086b['get']({'plain':!![]});var _0x204feb=_0x03fc('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x204feb,'userProfileId':_0x126330['userProfileId']},'raw':!![]})[_0x03fc('0x27')](function(_0x4d5bfb){if(_0x4d5bfb&&_0x4d5bfb['autoAssociation']===0x0){return db[_0x03fc('0x2a')][_0x03fc('0x47')]({'name':_0xbc3ab7[_0x03fc('0x2c')],'resourceId':_0xbc3ab7['id'],'type':_0x4d5bfb[_0x03fc('0x2c')],'sectionId':_0x4d5bfb['id']},{})[_0x03fc('0x27')](function(){return _0xd086b;});}else{return _0xd086b;}})[_0x03fc('0x43')](function(_0x2bf7d){logger[_0x03fc('0x2b')](_0x03fc('0x4d'),_0x2bf7d);throw _0x2bf7d;});}return _0xd086b;})[_0x03fc('0x27')](respondWithResult(_0xb31356,0xc9))['catch'](handleError(_0xb31356,null));};exports[_0x03fc('0x26')]=function(_0x2b7477,_0x43fcfc){if(_0x2b7477[_0x03fc('0x48')]['id']){delete _0x2b7477[_0x03fc('0x48')]['id'];}return db[_0x03fc('0x2e')][_0x03fc('0x46')]({'where':{'id':_0x2b7477['params']['id']}})[_0x03fc('0x27')](handleEntityNotFound(_0x43fcfc,null))[_0x03fc('0x27')](saveUpdates(_0x2b7477['body'],null))[_0x03fc('0x27')](respondWithResult(_0x43fcfc,null))[_0x03fc('0x43')](handleError(_0x43fcfc,null));};exports[_0x03fc('0x28')]=function(_0xb1bba2,_0x209ccc){return db[_0x03fc('0x2e')][_0x03fc('0x46')]({'where':{'id':_0xb1bba2[_0x03fc('0x4e')]['id']}})[_0x03fc('0x27')](handleEntityNotFound(_0x209ccc,null))['then'](removeEntity(_0x209ccc,null))['catch'](handleError(_0x209ccc,null));};exports[_0x03fc('0x2f')]=function(_0x377e43,_0x327f0a){return db[_0x03fc('0x2e')][_0x03fc('0x2f')]()[_0x03fc('0x27')](respondWithResult(_0x327f0a,null))['catch'](handleError(_0x327f0a,null));};exports['addContacts']=function(_0x3bf80d,_0x105d11,_0x406c7d){return db[_0x03fc('0x4f')]['find']({'where':{'id':_0x3bf80d[_0x03fc('0x4e')]['id']}})[_0x03fc('0x27')](handleEntityNotFound(_0x105d11,null))[_0x03fc('0x27')](function(_0x352de1){if(_0x352de1){return _0x352de1[_0x03fc('0x50')](_0x3bf80d[_0x03fc('0x48')][_0x03fc('0x51')],_[_0x03fc('0x52')](_0x3bf80d[_0x03fc('0x48')],[_0x03fc('0x51'),'id'])||{});}})[_0x03fc('0x27')](respondWithResult(_0x105d11,null))['catch'](handleError(_0x105d11,null));};exports[_0x03fc('0x53')]=function(_0x595de5,_0x18b2c8,_0x4b75bc){var _0x17626b={};var _0x945498={};var _0x31e665;var _0x108f81;return db[_0x03fc('0x2e')][_0x03fc('0x54')]({'where':{'id':_0x595de5[_0x03fc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x18b2c8,null))[_0x03fc('0x27')](function(_0x1ebef4){if(_0x1ebef4){_0x31e665=_0x1ebef4;_0x945498['model']=_[_0x03fc('0x31')](db[_0x03fc('0x4f')][_0x03fc('0x45')]);_0x945498[_0x03fc('0x32')]=_['keys'](_0x595de5[_0x03fc('0x32')]);_0x945498['filters']=_[_0x03fc('0x33')](_0x945498[_0x03fc('0x30')],_0x945498[_0x03fc('0x32')]);_0x17626b[_0x03fc('0x34')]=_[_0x03fc('0x33')](_0x945498[_0x03fc('0x30')],qs[_0x03fc('0x35')](_0x595de5[_0x03fc('0x32')][_0x03fc('0x35')]));_0x17626b[_0x03fc('0x34')]=_0x17626b[_0x03fc('0x34')][_0x03fc('0x36')]?_0x17626b[_0x03fc('0x34')]:_0x945498[_0x03fc('0x30')];_0x17626b[_0x03fc('0x38')]=qs[_0x03fc('0x39')](_0x595de5[_0x03fc('0x32')]['sort']);_0x17626b[_0x03fc('0x3a')]=qs[_0x03fc('0x3b')](_[_0x03fc('0x55')](_0x595de5['query'],_0x945498[_0x03fc('0x3b')]));if(_0x595de5[_0x03fc('0x32')][_0x03fc('0x3c')]){_0x17626b['where']=_[_0x03fc('0x3d')](_0x17626b[_0x03fc('0x3a')],{'$or':_[_0x03fc('0x56')](_0x17626b[_0x03fc('0x34')],function(_0x5980ec){var _0x15c8b6={};_0x15c8b6[_0x5980ec]={'$like':'%'+_0x595de5['query'][_0x03fc('0x3c')]+'%'};return _0x15c8b6;})});}_0x17626b=_['merge']({},_0x17626b,_0x595de5[_0x03fc('0x3e')]);return _0x31e665[_0x03fc('0x53')](_0x17626b);}})[_0x03fc('0x27')](function(_0x3204da){if(_0x3204da){_0x108f81=_0x3204da[_0x03fc('0x36')];if(!_0x595de5[_0x03fc('0x32')][_0x03fc('0x37')]('nolimit')){_0x17626b[_0x03fc('0x20')]=qs[_0x03fc('0x20')](_0x595de5[_0x03fc('0x32')]['limit']);_0x17626b['offset']=qs[_0x03fc('0x1f')](_0x595de5[_0x03fc('0x32')]['offset']);}return _0x31e665[_0x03fc('0x53')](_0x17626b);}})[_0x03fc('0x27')](function(_0x38fae2){if(_0x38fae2){return _0x38fae2?{'count':_0x108f81,'rows':_0x38fae2}:null;}})['then'](respondWithResult(_0x18b2c8,null))[_0x03fc('0x43')](handleError(_0x18b2c8,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 986d6b7..41729f7 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 _0xc647=['path','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc647,0x1f2));var _0x7c64=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0xc647[_0x10df18];return _0x1f9a1d;};'use strict';var _=require(_0x7c64('0x0'));var util=require(_0x7c64('0x1'));var logger=require(_0x7c64('0x2'))('api');var moment=require(_0x7c64('0x3'));var BPromise=require(_0x7c64('0x4'));var rp=require(_0x7c64('0x5'));var fs=require('fs');var path=require(_0x7c64('0x6'));var rimraf=require('rimraf');var config=require(_0x7c64('0x7'));var attributes=require(_0x7c64('0x8'));module[_0x7c64('0x9')]=function(_0x1afd54,_0x355531){return _0x1afd54[_0x7c64('0xa')](_0x7c64('0xb'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5c4=['../../config/environment','./cmCompany.attributes','exports','define','CmCompany','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3f9ac2,_0x1b670b){var _0xe6a436=function(_0x1f3ea5){while(--_0x1f3ea5){_0x3f9ac2['push'](_0x3f9ac2['shift']());}};_0xe6a436(++_0x1b670b);}(_0xc5c4,0x65));var _0x4c5c=function(_0x44cb15,_0x47d0bf){_0x44cb15=_0x44cb15-0x0;var _0x1e1e68=_0xc5c4[_0x44cb15];return _0x1e1e68;};'use strict';var _=require('lodash');var util=require(_0x4c5c('0x0'));var logger=require(_0x4c5c('0x1'))(_0x4c5c('0x2'));var moment=require(_0x4c5c('0x3'));var BPromise=require(_0x4c5c('0x4'));var rp=require(_0x4c5c('0x5'));var fs=require('fs');var path=require(_0x4c5c('0x6'));var rimraf=require('rimraf');var config=require(_0x4c5c('0x7'));var attributes=require(_0x4c5c('0x8'));module[_0x4c5c('0x9')]=function(_0x25476b,_0xc1c5c9){return _0x25476b[_0x4c5c('0xa')](_0x4c5c('0xb'),attributes,{'tableName':'cm_companies','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 41133b4..5740849 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 _0x54dc=['CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x54dc,0x81));var _0xc54d=function(_0x41d5d5,_0x9867db){_0x41d5d5=_0x41d5d5-0x0;var _0x2142d3=_0x54dc[_0x41d5d5];return _0x2142d3;};'use strict';var _=require('lodash');var util=require(_0xc54d('0x0'));var moment=require(_0xc54d('0x1'));var BPromise=require(_0xc54d('0x2'));var rs=require(_0xc54d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc54d('0x4'))['db'];var utils=require(_0xc54d('0x5'));var logger=require(_0xc54d('0x6'))('rpc');var config=require(_0xc54d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc54d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2789a2,_0x348e23,_0x145507){return new BPromise(function(_0x455a31,_0x27286d){return client['request'](_0x2789a2,_0x145507)[_0xc54d('0x9')](function(_0x265d4d){logger[_0xc54d('0xa')](_0xc54d('0xb'),_0x348e23,_0xc54d('0xc'));logger[_0xc54d('0xd')](_0xc54d('0xe'),_0x348e23,_0xc54d('0xc'),JSON[_0xc54d('0xf')](_0x265d4d));if(_0x265d4d[_0xc54d('0x10')]){if(_0x265d4d[_0xc54d('0x10')][_0xc54d('0x11')]===0x1f4){logger[_0xc54d('0x10')]('CmCompany,\x20%s,\x20%s',_0x348e23,_0x265d4d[_0xc54d('0x10')][_0xc54d('0x12')]);return _0x27286d(_0x265d4d[_0xc54d('0x10')]['message']);}logger['error'](_0xc54d('0xb'),_0x348e23,_0x265d4d['error']['message']);return _0x455a31(_0x265d4d[_0xc54d('0x10')][_0xc54d('0x12')]);}else{logger[_0xc54d('0xa')](_0xc54d('0xb'),_0x348e23,_0xc54d('0xc'));_0x455a31(_0x265d4d['result'][_0xc54d('0x12')]);}})[_0xc54d('0x13')](function(_0x4160f3){logger[_0xc54d('0x10')](_0xc54d('0xb'),_0x348e23,_0x4160f3);_0x27286d(_0x4160f3);});});} \ No newline at end of file +var _0x1c57=['request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1c57,0x170));var _0x71c5=function(_0x2956fe,_0x1c4a6d){_0x2956fe=_0x2956fe-0x0;var _0x53f056=_0x1c57[_0x2956fe];return _0x53f056;};'use strict';var _=require(_0x71c5('0x0'));var util=require('util');var moment=require(_0x71c5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71c5('0x2'));var db=require(_0x71c5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x71c5('0x4'));var config=require(_0x71c5('0x5'));var jayson=require(_0x71c5('0x6'));var client=jayson[_0x71c5('0x7')][_0x71c5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58c86b,_0x158c13,_0x1e8104){return new BPromise(function(_0x36f34b,_0xb7b8d7){return client['request'](_0x58c86b,_0x1e8104)[_0x71c5('0x9')](function(_0x3f5a99){logger[_0x71c5('0xa')](_0x71c5('0xb'),_0x158c13,_0x71c5('0xc'));logger['debug'](_0x71c5('0xd'),_0x158c13,_0x71c5('0xc'),JSON[_0x71c5('0xe')](_0x3f5a99));if(_0x3f5a99[_0x71c5('0xf')]){if(_0x3f5a99['error'][_0x71c5('0x10')]===0x1f4){logger[_0x71c5('0xf')]('CmCompany,\x20%s,\x20%s',_0x158c13,_0x3f5a99['error'][_0x71c5('0x11')]);return _0xb7b8d7(_0x3f5a99[_0x71c5('0xf')][_0x71c5('0x11')]);}logger[_0x71c5('0xf')](_0x71c5('0xb'),_0x158c13,_0x3f5a99[_0x71c5('0xf')][_0x71c5('0x11')]);return _0x36f34b(_0x3f5a99[_0x71c5('0xf')][_0x71c5('0x11')]);}else{logger['info'](_0x71c5('0xb'),_0x158c13,'request\x20sent');_0x36f34b(_0x3f5a99[_0x71c5('0x12')][_0x71c5('0x11')]);}})[_0x71c5('0x13')](function(_0x165334){logger[_0x71c5('0xf')](_0x71c5('0xb'),_0x158c13,_0x165334);_0xb7b8d7(_0x165334);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 2cc941d..b06f28e 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 _0x9957=['../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/contacts','getContacts','post','addContacts','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./cmCompany.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0x10')](_0x7995('0xe'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0x55ca=['multer','util','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','getContacts','post','create','/:id/contacts','addContacts','put','update','destroy','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x55ca,0x126));var _0xa55c=function(_0x65ca71,_0x126845){_0x65ca71=_0x65ca71-0x0;var _0x5cb16e=_0x55ca[_0x65ca71];return _0x5cb16e;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['get']('/:id/contacts',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0xe')]);router[_0xa55c('0xd')](_0xa55c('0xf'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x10')]);router[_0xa55c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);module[_0xa55c('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 49f4ae1..03a956f 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 _0x7ef2=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x4b9750,_0x538cbf){var _0x4470b0=function(_0x204609){while(--_0x204609){_0x4b9750['push'](_0x4b9750['shift']());}};_0x4470b0(++_0x538cbf);}(_0x7ef2,0x15d));var _0x27ef=function(_0x330e96,_0x2d26db){_0x330e96=_0x330e96-0x0;var _0x32ef7b=_0x7ef2[_0x330e96];return _0x32ef7b;};'use strict';var _=require(_0x27ef('0x0'));var Sequelize=require('sequelize');module[_0x27ef('0x1')]={'firstName':{'type':Sequelize[_0x27ef('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x27ef('0x2')]},'postalCode':{'type':Sequelize[_0x27ef('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x27ef('0x2')]},'description':{'type':Sequelize[_0x27ef('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x27ef('0x2')]},'fax':{'type':Sequelize[_0x27ef('0x2')]},'email':{'type':Sequelize[_0x27ef('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x27ef('0x2')]},'fb_data':{'type':Sequelize[_0x27ef('0x2')]},'twitter':{'type':Sequelize[_0x27ef('0x2')]},'skype':{'type':Sequelize[_0x27ef('0x2')]},'teams':{'type':Sequelize[_0x27ef('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x27ef('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x27ef('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x27ef('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x27ef('0x5')],'defaultValue':Sequelize[_0x27ef('0x6')]},'dialTimezone':{'type':Sequelize[_0x27ef('0x2')]},'utcOffset':{'type':Sequelize[_0x27ef('0x4')]}}; \ No newline at end of file +var _0x075e=['exports','STRING','TEXT','INTEGER','DATE','NOW'];(function(_0x127235,_0x1662ac){var _0x200234=function(_0x359be8){while(--_0x359be8){_0x127235['push'](_0x127235['shift']());}};_0x200234(++_0x1662ac);}(_0x075e,0x1a4));var _0xe075=function(_0x5c3db8,_0x203731){_0x5c3db8=_0x5c3db8-0x0;var _0x439513=_0x075e[_0x5c3db8];return _0x439513;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0xe075('0x0')]={'firstName':{'type':Sequelize[_0xe075('0x1')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xe075('0x1')]},'postalCode':{'type':Sequelize[_0xe075('0x1')]},'city':{'type':Sequelize[_0xe075('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xe075('0x1')]},'description':{'type':Sequelize[_0xe075('0x2')]},'phone':{'type':Sequelize[_0xe075('0x1')]},'mobile':{'type':Sequelize[_0xe075('0x1')]},'fax':{'type':Sequelize[_0xe075('0x1')]},'email':{'type':Sequelize[_0xe075('0x1')]},'url':{'type':Sequelize[_0xe075('0x1')]},'facebook':{'type':Sequelize[_0xe075('0x1')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xe075('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xe075('0x1')]},'line':{'type':Sequelize[_0xe075('0x1')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xe075('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xe075('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe075('0x4')],'defaultValue':Sequelize[_0xe075('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 89d9f43..51654d4 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 _0xebe3=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register','end','count','offset','status','set','Content-Range','update','then','destroy','sendStatus','error','name','send','CmContact','keys','length','startsWith','push','CmCustomField','findOne','trimStart','cf_','all','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','expr','parseSearch','search','conditions','Tag','value','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','datetime','castTo','DATE','buildExpression','filter','isNil','Contact','isEmpty','forEach','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','clone','order','DESC','t.id\x20IN\x20?','resolve','user','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','merge','c.lastName','c.phone','c.mobile','c.fax','c.ListId','TagIds','Tags','split','find','params','catch','describe','columnName','displayName','findAll','body','get','mergeWith','tags','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','CmHopperFinal','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','join','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','$and','omit','format','cf_%d','pickBy','table','id\x20=\x20?','text','values','phone','getTags','rawAttributes','options','setTags','ids','getHoppers','ContactId','includeAll','rows','include','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','eml-format','rimraf'];(function(_0x1b394a,_0x5d574f){var _0x15a517=function(_0x506e60){while(--_0x506e60){_0x1b394a['push'](_0x1b394a['shift']());}};_0x15a517(++_0x5d574f);}(_0xebe3,0xe4));var _0x3ebe=function(_0x2a3705,_0x385344){_0x2a3705=_0x2a3705-0x0;var _0x41c26f=_0xebe3[_0x2a3705];return _0x41c26f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3ebe('0x0'));var rimraf=require(_0x3ebe('0x1'));var zipdir=require(_0x3ebe('0x2'));var jsonpatch=require(_0x3ebe('0x3'));var rp=require(_0x3ebe('0x4'));var moment=require(_0x3ebe('0x5'));var BPromise=require(_0x3ebe('0x6'));var Mustache=require(_0x3ebe('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3ebe('0x8'));var csv=require(_0x3ebe('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3ebe('0xa'));var squel=require(_0x3ebe('0xb'));var crypto=require(_0x3ebe('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3ebe('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3ebe('0xe'));var Papa=require(_0x3ebe('0xf'));var Redis=require(_0x3ebe('0x10'));var authService=require(_0x3ebe('0x11'));var qs=require(_0x3ebe('0x12'));var as=require(_0x3ebe('0x13'));var hardwareService=require(_0x3ebe('0x14'));var logger=require(_0x3ebe('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x3ebe('0x16'));var db=require(_0x3ebe('0x17'))['db'];config[_0x3ebe('0x18')]=_[_0x3ebe('0x19')](config[_0x3ebe('0x18')],{'host':_0x3ebe('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ebe('0x18')]));require(_0x3ebe('0x1b'))[_0x3ebe('0x1c')](socket);function respondWithStatusCode(_0xa804ab,_0x33f7b8){_0x33f7b8=_0x33f7b8||0xcc;return function(_0x214e48){if(_0x214e48){return _0xa804ab['sendStatus'](_0x33f7b8);}return _0xa804ab['status'](_0x33f7b8)[_0x3ebe('0x1d')]();};}function respondWithResult(_0x5c81f8,_0x4ee24c){_0x4ee24c=_0x4ee24c||0xc8;return function(_0x675e16){if(_0x675e16){return _0x5c81f8['status'](_0x4ee24c)['json'](_0x675e16);}};}function respondWithFilteredResult(_0xc32b03,_0x101dd2){return function(_0x230316){if(_0x230316){var _0x2c335f=_0x230316[_0x3ebe('0x1e')],_0x4377fe=_0x101dd2[_0x3ebe('0x1f')],_0x3aaf94=_0x101dd2['offset']+_0x101dd2['limit'],_0x394454;if(_0x3aaf94>=_0x2c335f){_0x3aaf94=_0x2c335f;_0x394454=0xc8;}else{_0x394454=0xce;}_0xc32b03[_0x3ebe('0x20')](_0x394454);return _0xc32b03[_0x3ebe('0x21')](_0x3ebe('0x22'),_0x4377fe+'-'+_0x3aaf94+'/'+_0x2c335f)['json'](_0x230316);}return null;};}function patchUpdates(_0x22b593){return function(_0x2b558b){try{jsonpatch['apply'](_0x2b558b,_0x22b593,!![]);}catch(_0x118320){return BPromise['reject'](_0x118320);}return _0x2b558b['save']();};}function saveUpdates(_0x32488d,_0x3fc477){return function(_0x11357f){if(_0x11357f){return _0x11357f[_0x3ebe('0x23')](_0x32488d)[_0x3ebe('0x24')](function(_0x5d66c4){return _0x5d66c4;});}return null;};}function removeEntity(_0x356f8f,_0x3ef71b){return function(_0xd04e62){if(_0xd04e62){return _0xd04e62[_0x3ebe('0x25')]()[_0x3ebe('0x24')](function(){_0x356f8f['status'](0xcc)[_0x3ebe('0x1d')]();});}};}function handleEntityNotFound(_0xecca3,_0x498330){return function(_0x4f5417){if(!_0x4f5417){_0xecca3[_0x3ebe('0x26')](0x194);}return _0x4f5417;};}function handleError(_0x200b1e,_0x4c1dd3){_0x4c1dd3=_0x4c1dd3||0x1f4;return function(_0x155dac){logger[_0x3ebe('0x27')](_0x155dac['stack']);if(_0x155dac[_0x3ebe('0x28')]){delete _0x155dac[_0x3ebe('0x28')];}_0x200b1e[_0x3ebe('0x20')](_0x4c1dd3)[_0x3ebe('0x29')](_0x155dac);};}exports['index']=function(_0x1ee02c,_0x5d1927){var _0x1973ba={},_0x17e02e={},_0x2bc346={'count':0x0,'rows':[]};return db[_0x3ebe('0x2a')]['describe']()[_0x3ebe('0x24')](function(_0x2b570d){var _0x2771fe=[];for(var _0x20d89c=0x0;_0x20d89c0x1){_0x24fbb6['or'](_0x3ebe('0x69'),qs['getFullTextValue'](_0x5b53c1),null);}else{if(qs['isNumeric'](_0x5b53c1)){_0x24fbb6['or'](_0x3ebe('0x6a'),_0x5b53c1+'%');_0x24fbb6['or'](_0x3ebe('0x6b'),_0x5b53c1+'%');_0x24fbb6['or'](_0x3ebe('0x6c'),_0x5b53c1+'%');_0x24fbb6['or'](_0x3ebe('0x6d'),_0x5b53c1+'%');}else if(qs[_0x3ebe('0x6e')](_0x5b53c1)){_0x24fbb6['or']('c.email\x20LIKE\x20?',_0x5b53c1+'%');}else{_0x24fbb6['or'](_0x3ebe('0x6f'),'%'+_0x5b53c1+'%');_0x24fbb6['or'](_0x3ebe('0x70'),'%'+_0x5b53c1+'%');_0x24fbb6['or']('c.email\x20LIKE\x20?','%'+_0x5b53c1+'%');}}}}_0x369043[_0x3ebe('0x40')](_0x24fbb6);_0x369043[_0x3ebe('0x71')](_0x3ebe('0x72'));var _0x5af1ff={'type':db[_0x3ebe('0x73')][_0x3ebe('0x74')]['SELECT'],'raw':!![]};var _0xfe3647=_0x369043[_0x3ebe('0x75')]()[_0x3ebe('0x43')](_0x3ebe('0x72'));if(_0x1973ba[_0x3ebe('0x76')]){_0x1973ba[_0x3ebe('0x76')][_0x3ebe('0x61')](function(_0x1036df){_0x369043[_0x3ebe('0x76')]('c.'+_0x1036df[0x0],_0x1036df[0x1]===_0x3ebe('0x77')?![]:!![]);});}if(!_[_0x3ebe('0x60')](_0x1b511f)){_0x369043['having'](_0x69dfdc);_0xfe3647['where'](_0x3ebe('0x78'),_0x1b511f);}BPromise[_0x3ebe('0x79')]()[_0x3ebe('0x24')](function(){if(_0x2cad1e&&!_['some'](_0x2cad1e[_0x3ebe('0x50')],['field',_0x3ebe('0x56')])){return _0x1ee02c[_0x3ebe('0x7a')][_0x3ebe('0x7b')]({'attributes':['id'],'raw':!![]})[_0x3ebe('0x24')](function(_0x28f756){if(_[_0x3ebe('0x60')](_0x28f756)){_0xfe3647[_0x3ebe('0x40')](_0x3ebe('0x7c'));_0x369043['where'](_0x3ebe('0x7c'));}else{_0xfe3647[_0x3ebe('0x40')](_0x3ebe('0x7d'),_[_0x3ebe('0x53')](_0x28f756,'id'));_0x369043[_0x3ebe('0x40')](_0x3ebe('0x7d'),_[_0x3ebe('0x53')](_0x28f756,'id'));}});}else{return;}})[_0x3ebe('0x24')](function(){db[_0x3ebe('0x7e')]['query'](_0xfe3647[_0x3ebe('0x7f')](),_0x5af1ff)[_0x3ebe('0x24')](function(_0xb6e0bf){_0x2bc346[_0x3ebe('0x1e')]=_0xb6e0bf['length'];if(_0x2bc346['count']===0x0)return[];return db[_0x3ebe('0x7e')][_0x3ebe('0x37')](_0x38434b['toString'](),_0x5af1ff);})['then'](function(_0x146ff9){_0x49da56=_['keyBy'](_0x146ff9,'id');_0x5af1ff=_[_0x3ebe('0x80')](_0x5af1ff,{'model':db[_0x3ebe('0x2a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1ee02c[_0x3ebe('0x37')]['fields']){_0x1973ba[_0x3ebe('0x3a')][_0x3ebe('0x61')](function(_0x5b9191){_0x369043[_0x3ebe('0x43')]('c.'+_0x5b9191);});}else{_0x369043[_0x3ebe('0x43')](_0x3ebe('0x72'));_0x369043[_0x3ebe('0x43')]('c.firstName');_0x369043['field'](_0x3ebe('0x81'));_0x369043[_0x3ebe('0x43')](_0x3ebe('0x82'));_0x369043['field'](_0x3ebe('0x83'));_0x369043[_0x3ebe('0x43')](_0x3ebe('0x84'));_0x369043['field']('c.email');_0x369043[_0x3ebe('0x43')](_0x3ebe('0x85'));_0x369043['field']('c.deletedAt');_0x369043[_0x3ebe('0x43')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3ebe('0x86'));}if(_0x1973ba[_0x3ebe('0x3e')])_0x369043[_0x3ebe('0x3e')](_0x1973ba[_0x3ebe('0x3e')]);if(_0x1973ba[_0x3ebe('0x1f')])_0x369043[_0x3ebe('0x1f')](_0x1973ba[_0x3ebe('0x1f')]);return db['sequelize'][_0x3ebe('0x37')](_0x369043[_0x3ebe('0x7f')](),_0x5af1ff);})[_0x3ebe('0x24')](function(_0x158bb8){_0x158bb8[_0x3ebe('0x61')](function(_0x5f0fdc){if(_0x5f0fdc[_0x3ebe('0x86')]){_0x5f0fdc[_0x3ebe('0x87')]=[];_0x5f0fdc['TagIds'][_0x3ebe('0x88')](',')[_0x3ebe('0x61')](function(_0x2f94c6){_0x5f0fdc[_0x3ebe('0x87')][_0x3ebe('0x2e')](_0x49da56[_0x2f94c6]);});}delete _0x5f0fdc['TagIds'];});_0x2bc346['rows']=_0x158bb8;return _0x2bc346;})[_0x3ebe('0x24')](respondWithFilteredResult(_0x5d1927,_0x1973ba));});})['catch'](handleError(_0x5d1927,null));};exports['destroy']=function(_0x21565a,_0x5b2744){return db[_0x3ebe('0x2a')][_0x3ebe('0x89')]({'where':{'id':_0x21565a[_0x3ebe('0x8a')]['id']}})[_0x3ebe('0x24')](handleEntityNotFound(_0x5b2744,null))[_0x3ebe('0x24')](removeEntity(_0x5b2744,null))[_0x3ebe('0x8b')](handleError(_0x5b2744,null));};exports[_0x3ebe('0x8c')]=function(_0xd6d1bc,_0x31198c){return db[_0x3ebe('0x2a')]['describe']()[_0x3ebe('0x24')](function(_0x3b930b){delete _0x3b930b['tags'];for(var _0x48cb52=0x0;_0x48cb52=_0x5304c4){_0x29ca61=_0x5304c4;_0x45f43d=0xc8;}else{_0x45f43d=0xce;}_0x514e97[_0xf69a('0x1f')](_0x45f43d);return _0x514e97[_0xf69a('0x20')](_0xf69a('0x21'),_0x353281+'-'+_0x29ca61+'/'+_0x5304c4)[_0xf69a('0x22')](_0x125a56);}return null;};}function patchUpdates(_0x3b2a7b){return function(_0x3f116d){try{jsonpatch[_0xf69a('0x23')](_0x3f116d,_0x3b2a7b,!![]);}catch(_0x57af27){return BPromise['reject'](_0x57af27);}return _0x3f116d[_0xf69a('0x24')]();};}function saveUpdates(_0x2c9f92,_0x268ed3){return function(_0x18fd4a){if(_0x18fd4a){return _0x18fd4a[_0xf69a('0x25')](_0x2c9f92)[_0xf69a('0x26')](function(_0x5224d8){return _0x5224d8;});}return null;};}function removeEntity(_0x3d0921,_0x403ebc){return function(_0x1a84f3){if(_0x1a84f3){return _0x1a84f3[_0xf69a('0x27')]()[_0xf69a('0x26')](function(){_0x3d0921[_0xf69a('0x1f')](0xcc)[_0xf69a('0x1c')]();});}};}function handleEntityNotFound(_0x3d348e,_0x5adafc){return function(_0x2437f1){if(!_0x2437f1){_0x3d348e[_0xf69a('0x1b')](0x194);}return _0x2437f1;};}function handleError(_0x356837,_0x4fa8e6){_0x4fa8e6=_0x4fa8e6||0x1f4;return function(_0x1ea893){logger['error'](_0x1ea893[_0xf69a('0x28')]);if(_0x1ea893[_0xf69a('0x29')]){delete _0x1ea893[_0xf69a('0x29')];}_0x356837['status'](_0x4fa8e6)[_0xf69a('0x2a')](_0x1ea893);};}exports[_0xf69a('0x2b')]=function(_0x2dc99b,_0xe3ec8b){var _0x5ecdbe={},_0x207e8c={},_0x2095da={'count':0x0,'rows':[]};return db['CmContact'][_0xf69a('0x2c')]()[_0xf69a('0x26')](function(_0x2726f5){var _0x144d24=[];for(var _0x178529=0x0;_0x1785290x1){_0x10a9e5['or'](_0xf69a('0x6e'),qs[_0xf69a('0x6f')](_0x44494d),null);}else{if(qs['isNumeric'](_0x44494d)){_0x10a9e5['or']('c.id\x20LIKE\x20?',_0x44494d+'%');_0x10a9e5['or'](_0xf69a('0x70'),_0x44494d+'%');_0x10a9e5['or'](_0xf69a('0x71'),_0x44494d+'%');_0x10a9e5['or'](_0xf69a('0x72'),_0x44494d+'%');}else if(qs[_0xf69a('0x73')](_0x44494d)){_0x10a9e5['or']('c.email\x20LIKE\x20?',_0x44494d+'%');}else{_0x10a9e5['or']('c.firstName\x20LIKE\x20?','%'+_0x44494d+'%');_0x10a9e5['or']('c.lastName\x20LIKE\x20?','%'+_0x44494d+'%');_0x10a9e5['or'](_0xf69a('0x74'),'%'+_0x44494d+'%');}}}}_0x530557['where'](_0x10a9e5);_0x530557[_0xf69a('0x75')](_0xf69a('0x76'));var _0x6b8658={'type':db[_0xf69a('0x77')][_0xf69a('0x78')][_0xf69a('0x79')],'raw':!![]};var _0x496306=_0x530557[_0xf69a('0x7a')]()['field'](_0xf69a('0x76'));if(_0x5ecdbe[_0xf69a('0x3d')]){_0x5ecdbe[_0xf69a('0x3d')][_0xf69a('0x55')](function(_0x1dd3fd){_0x530557[_0xf69a('0x3d')]('c.'+_0x1dd3fd[0x0],_0x1dd3fd[0x1]===_0xf69a('0x7b')?![]:!![]);});}if(!_[_0xf69a('0x66')](_0x3abedc)){_0x530557[_0xf69a('0x7c')](_0x512f41);_0x496306['where'](_0xf69a('0x7d'),_0x3abedc);}BPromise[_0xf69a('0x7e')]()['then'](function(){if(_0x400c68&&!_[_0xf69a('0x7f')](_0x400c68[_0xf69a('0x51')],[_0xf69a('0x42'),_0xf69a('0x58')])){return _0x2dc99b[_0xf69a('0x80')][_0xf69a('0x81')]({'attributes':['id'],'raw':!![]})[_0xf69a('0x26')](function(_0x1b9105){if(_[_0xf69a('0x66')](_0x1b9105)){_0x496306[_0xf69a('0x3f')](_0xf69a('0x82'));_0x530557[_0xf69a('0x3f')]('c.ListId\x20IS\x20NULL');}else{_0x496306[_0xf69a('0x3f')]('c.ListId\x20IN\x20?',_[_0xf69a('0x54')](_0x1b9105,'id'));_0x530557['where']('c.ListId\x20IN\x20?',_[_0xf69a('0x54')](_0x1b9105,'id'));}});}else{return;}})[_0xf69a('0x26')](function(){db[_0xf69a('0x83')]['query'](_0x496306[_0xf69a('0x84')](),_0x6b8658)['then'](function(_0x4f86d7){_0x2095da['count']=_0x4f86d7[_0xf69a('0x39')];if(_0x2095da[_0xf69a('0x1d')]===0x0)return[];return db[_0xf69a('0x83')][_0xf69a('0x34')](_0x8811dd['toString'](),_0x6b8658);})[_0xf69a('0x26')](function(_0x3a4072){_0x1d2b5a=_['keyBy'](_0x3a4072,'id');_0x6b8658=_[_0xf69a('0x85')](_0x6b8658,{'model':db[_0xf69a('0x86')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2dc99b[_0xf69a('0x34')][_0xf69a('0x38')]){_0x5ecdbe['attributes'][_0xf69a('0x55')](function(_0x4c1809){_0x530557[_0xf69a('0x42')]('c.'+_0x4c1809);});}else{_0x530557[_0xf69a('0x42')](_0xf69a('0x76'));_0x530557[_0xf69a('0x42')](_0xf69a('0x87'));_0x530557[_0xf69a('0x42')]('c.lastName');_0x530557[_0xf69a('0x42')](_0xf69a('0x88'));_0x530557[_0xf69a('0x42')](_0xf69a('0x89'));_0x530557[_0xf69a('0x42')](_0xf69a('0x8a'));_0x530557[_0xf69a('0x42')](_0xf69a('0x8b'));_0x530557['field'](_0xf69a('0x8c'));_0x530557[_0xf69a('0x42')](_0xf69a('0x8d'));_0x530557[_0xf69a('0x42')](_0xf69a('0x8e'),'TagIds');}if(_0x5ecdbe[_0xf69a('0x3c')])_0x530557[_0xf69a('0x3c')](_0x5ecdbe[_0xf69a('0x3c')]);if(_0x5ecdbe[_0xf69a('0x1e')])_0x530557[_0xf69a('0x1e')](_0x5ecdbe['offset']);return db[_0xf69a('0x83')][_0xf69a('0x34')](_0x530557['toString'](),_0x6b8658);})[_0xf69a('0x26')](function(_0x30d23c){_0x30d23c[_0xf69a('0x55')](function(_0x1cded4){if(_0x1cded4[_0xf69a('0x8f')]){_0x1cded4[_0xf69a('0x90')]=[];_0x1cded4[_0xf69a('0x8f')][_0xf69a('0x53')](',')['forEach'](function(_0xfe0211){_0x1cded4[_0xf69a('0x90')]['push'](_0x1d2b5a[_0xfe0211]);});}delete _0x1cded4[_0xf69a('0x8f')];});_0x2095da[_0xf69a('0x91')]=_0x30d23c;return _0x2095da;})['then'](respondWithFilteredResult(_0xe3ec8b,_0x5ecdbe));});})[_0xf69a('0x92')](handleError(_0xe3ec8b,null));};exports[_0xf69a('0x27')]=function(_0x521fda,_0x5e1327){return db[_0xf69a('0x86')][_0xf69a('0x93')]({'where':{'id':_0x521fda[_0xf69a('0x94')]['id']}})[_0xf69a('0x26')](handleEntityNotFound(_0x5e1327,null))['then'](removeEntity(_0x5e1327,null))[_0xf69a('0x92')](handleError(_0x5e1327,null));};exports['describe']=function(_0x486201,_0x9d5891){return db['CmContact'][_0xf69a('0x2c')]()[_0xf69a('0x26')](function(_0x3ac08f){delete _0x3ac08f[_0xf69a('0x95')];for(var _0x554358=0x0;_0x554358{}\s\\|]/g,'-');_0x1e2411(null,util['format']('%s-%s%s',path['basename'](_0x2253fd[_0x72d1('0x21')],path[_0x72d1('0x22')](_0x2253fd['originalname'])),Date[_0x72d1('0x23')](),path[_0x72d1('0x22')](_0x2253fd[_0x72d1('0x21')])));}})});router[_0x72d1('0x16')](_0x72d1('0x24'),upload['single']('file'),controller[_0x72d1('0x25')]);var upload=multer({'storage':multer[_0x72d1('0x1d')]({'destination':function(_0x2f661,_0x2f879f,_0xdf6a69){_0xdf6a69(null,path[_0x72d1('0x1e')](config[_0x72d1('0x1f')],'server/files/tmp'));},'filename':function(_0x57ec9e,_0x1ba258,_0x482cb8){_0x1ba258[_0x72d1('0x21')]=_0x1ba258[_0x72d1('0x21')][_0x72d1('0x26')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x482cb8(null,util['format'](_0x72d1('0x27'),path['basename'](_0x1ba258[_0x72d1('0x21')],path[_0x72d1('0x22')](_0x1ba258[_0x72d1('0x21')])),Date[_0x72d1('0x23')](),path['extname'](_0x1ba258[_0x72d1('0x21')])));}})});router['post'](_0x72d1('0x28'),upload[_0x72d1('0x29')]('file'),controller[_0x72d1('0x2a')]);router[_0x72d1('0x16')](_0x72d1('0x2b'),auth[_0x72d1('0x7')](),controller[_0x72d1('0x2c')]);router['put'](_0x72d1('0xb'),auth[_0x72d1('0x7')](),controller[_0x72d1('0x2d')]);router['delete'](_0x72d1('0xb'),auth[_0x72d1('0x7')](),controller['destroy']);module[_0x72d1('0x2e')]=router; \ No newline at end of file +var _0x7fbe=['/create_many','diskStorage','root','originalname','replace','%s-%s%s','basename','now','/csv','uploadCsv','join','server/files/tmp','format','extname','/upload','file','upload','import','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','/:id','show','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','/merge','post','create'];(function(_0x2f5b2b,_0xc3426c){var _0x12697a=function(_0x1e2ee3){while(--_0x1e2ee3){_0x2f5b2b['push'](_0x2f5b2b['shift']());}};_0x12697a(++_0xc3426c);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x7fbe[_0x595bd1];return _0xd0344f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var auth=require(_0xe7fb('0x4'));var interaction=require(_0xe7fb('0x5'));var config=require(_0xe7fb('0x6'));var controller=require(_0xe7fb('0x7'));router[_0xe7fb('0x8')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xa')]);router[_0xe7fb('0x8')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller['describe']);router[_0xe7fb('0x8')](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xd')]);router['get']('/:id/tags',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0x8')](_0xe7fb('0xf'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x8')](_0xe7fb('0x11'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x8')](_0xe7fb('0x13'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x8')]('/:id/jscripty_sessions',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x15')]);router['post'](_0xe7fb('0x16'),auth[_0xe7fb('0x9')](),controller['merge']);router[_0xe7fb('0x17')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0x18')]);router[_0xe7fb('0x17')](_0xe7fb('0x19'),auth[_0xe7fb('0x9')](),controller['bulkCreate']);router[_0xe7fb('0x17')]('/:id/tags',auth[_0xe7fb('0x9')](),controller['setTags']);var upload=multer({'storage':multer[_0xe7fb('0x1a')]({'destination':function(_0x4708f7,_0x3f96a7,_0x182269){_0x182269(null,path['join'](config[_0xe7fb('0x1b')],'server/files/tmp'));},'filename':function(_0x11cae0,_0x51f01f,_0x15f7a4){_0x51f01f['originalname']=_0x51f01f[_0xe7fb('0x1c')][_0xe7fb('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x15f7a4(null,util['format'](_0xe7fb('0x1e'),path[_0xe7fb('0x1f')](_0x51f01f[_0xe7fb('0x1c')],path['extname'](_0x51f01f[_0xe7fb('0x1c')])),Date[_0xe7fb('0x20')](),path['extname'](_0x51f01f['originalname'])));}})});router['post'](_0xe7fb('0x21'),upload['single']('file'),controller[_0xe7fb('0x22')]);var upload=multer({'storage':multer[_0xe7fb('0x1a')]({'destination':function(_0x2996ae,_0x4f6c73,_0x6c930){_0x6c930(null,path[_0xe7fb('0x23')](config[_0xe7fb('0x1b')],_0xe7fb('0x24')));},'filename':function(_0x392d75,_0x16237a,_0x380130){_0x16237a['originalname']=_0x16237a['originalname'][_0xe7fb('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x380130(null,util[_0xe7fb('0x25')](_0xe7fb('0x1e'),path['basename'](_0x16237a[_0xe7fb('0x1c')],path[_0xe7fb('0x26')](_0x16237a[_0xe7fb('0x1c')])),Date[_0xe7fb('0x20')](),path[_0xe7fb('0x26')](_0x16237a[_0xe7fb('0x1c')])));}})});router[_0xe7fb('0x17')](_0xe7fb('0x27'),upload['single'](_0xe7fb('0x28')),controller[_0xe7fb('0x29')]);router[_0xe7fb('0x17')]('/upload/:id',auth['isAuthenticated'](),controller[_0xe7fb('0x2a')]);router['put'](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x2b')]);router[_0xe7fb('0x2c')]('/:id',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x2d')]);module[_0xe7fb('0x2e')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 563d944..b18d353 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a99=['PHONE','sequelize','exports','INTEGER','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5a99,0xc9));var _0x95a9=function(_0x2cb1ec,_0x1ef536){_0x2cb1ec=_0x2cb1ec-0x0;var _0x48dafc=_0x5a99[_0x2cb1ec];return _0x48dafc;};'use strict';var Sequelize=require(_0x95a9('0x0'));module[_0x95a9('0x1')]={'CmContactId':{'type':Sequelize[_0x95a9('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x95a9('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x95a9('0x3')],'defaultValue':_0x95a9('0x4')},'OrderBy':{'type':Sequelize[_0x95a9('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x7217=['STRING','PHONE','sequelize','INTEGER'];(function(_0x359590,_0x15ab26){var _0x4e6a94=function(_0x511629){while(--_0x511629){_0x359590['push'](_0x359590['shift']());}};_0x4e6a94(++_0x15ab26);}(_0x7217,0x19e));var _0x7721=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x7217[_0x2d8fc2];return _0x3a9e53;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x7721('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x7721('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x7721('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x7721('0x2')],'defaultValue':_0x7721('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 92100af..99b453e 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0347=['name','send','map','CmContactHasItem','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','get','CmContactHasItems','stack'];(function(_0x1bbab5,_0x4f7ef0){var _0x4bd92e=function(_0x4b6696){while(--_0x4b6696){_0x1bbab5['push'](_0x1bbab5['shift']());}};_0x4bd92e(++_0x4f7ef0);}(_0x0347,0x1f0));var _0x7034=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0347[_0x21a9d9];return _0x46adce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7034('0x0'));var rimraf=require(_0x7034('0x1'));var zipdir=require(_0x7034('0x2'));var jsonpatch=require(_0x7034('0x3'));var rp=require(_0x7034('0x4'));var moment=require('moment');var BPromise=require(_0x7034('0x5'));var Mustache=require(_0x7034('0x6'));var util=require(_0x7034('0x7'));var path=require(_0x7034('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7034('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7034('0xa'));var crypto=require(_0x7034('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7034('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7034('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7034('0xe'));var qs=require(_0x7034('0xf'));var as=require(_0x7034('0x10'));var hardwareService=require(_0x7034('0x11'));var logger=require('../../config/logger')(_0x7034('0x12'));var utils=require(_0x7034('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13ee23,_0x1a7bd2){_0x1a7bd2=_0x1a7bd2||0xcc;return function(_0x91863b){if(_0x91863b){return _0x13ee23[_0x7034('0x14')](_0x1a7bd2);}return _0x13ee23['status'](_0x1a7bd2)[_0x7034('0x15')]();};}function respondWithResult(_0x143c0a,_0x2d0ad3){_0x2d0ad3=_0x2d0ad3||0xc8;return function(_0x110103){if(_0x110103){return _0x143c0a['status'](_0x2d0ad3)[_0x7034('0x16')](_0x110103);}};}function respondWithFilteredResult(_0x10f83e,_0x2a4396){return function(_0xc749d1){if(_0xc749d1){var _0x1e6898=_0xc749d1['count'],_0x418272=_0x2a4396[_0x7034('0x17')],_0x3dcc7a=_0x2a4396[_0x7034('0x17')]+_0x2a4396[_0x7034('0x18')],_0x1f8e78;if(_0x3dcc7a>=_0x1e6898){_0x3dcc7a=_0x1e6898;_0x1f8e78=0xc8;}else{_0x1f8e78=0xce;}_0x10f83e[_0x7034('0x19')](_0x1f8e78);return _0x10f83e[_0x7034('0x1a')](_0x7034('0x1b'),_0x418272+'-'+_0x3dcc7a+'/'+_0x1e6898)[_0x7034('0x16')](_0xc749d1);}return null;};}function patchUpdates(_0xbbf88f){return function(_0x505654){try{jsonpatch[_0x7034('0x1c')](_0x505654,_0xbbf88f,!![]);}catch(_0x2867c4){return BPromise[_0x7034('0x1d')](_0x2867c4);}return _0x505654['save']();};}function saveUpdates(_0x1bb1cc,_0x48f5f1){return function(_0x2c3964){if(_0x2c3964){return _0x2c3964[_0x7034('0x1e')](_0x1bb1cc)[_0x7034('0x1f')](function(_0x56ef60){return _0x56ef60;});}return null;};}function removeEntity(_0x31f2ef,_0x33c792){return function(_0xdd907b){if(_0xdd907b){return _0xdd907b[_0x7034('0x20')]()[_0x7034('0x1f')](function(){var _0x5f11a6=_0xdd907b[_0x7034('0x21')]({'plain':!![]});var _0x114d6b=_0x7034('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x114d6b,'resourceId':_0x5f11a6['id']}})[_0x7034('0x1f')](function(){return _0xdd907b;});})[_0x7034('0x1f')](function(){_0x31f2ef['status'](0xcc)[_0x7034('0x15')]();});}};}function handleEntityNotFound(_0x3a0f1d,_0xed5e9){return function(_0x822e15){if(!_0x822e15){_0x3a0f1d['sendStatus'](0x194);}return _0x822e15;};}function handleError(_0x36eb11,_0xd5b9af){_0xd5b9af=_0xd5b9af||0x1f4;return function(_0xc8ccba){logger['error'](_0xc8ccba[_0x7034('0x23')]);if(_0xc8ccba[_0x7034('0x24')]){delete _0xc8ccba[_0x7034('0x24')];}_0x36eb11[_0x7034('0x19')](_0xd5b9af)[_0x7034('0x25')](_0xc8ccba);};}exports['index']=function(_0x50a99f,_0x423158){var _0x518de0={},_0x1f5b6e={},_0x22c48d={'count':0x0,'rows':[]};var _0xec9b7d=_[_0x7034('0x26')](db[_0x7034('0x27')][_0x7034('0x28')],function(_0x28512d){return{'name':_0x28512d[_0x7034('0x29')],'type':_0x28512d['type'][_0x7034('0x2a')]};});_0x1f5b6e[_0x7034('0x2b')]=_[_0x7034('0x26')](_0xec9b7d,'name');_0x1f5b6e[_0x7034('0x2c')]=_[_0x7034('0x2d')](_0x50a99f[_0x7034('0x2c')]);_0x1f5b6e['filters']=_[_0x7034('0x2e')](_0x1f5b6e[_0x7034('0x2b')],_0x1f5b6e[_0x7034('0x2c')]);_0x518de0[_0x7034('0x2f')]=_['intersection'](_0x1f5b6e['model'],qs[_0x7034('0x30')](_0x50a99f[_0x7034('0x2c')][_0x7034('0x30')]));_0x518de0[_0x7034('0x2f')]=_0x518de0[_0x7034('0x2f')][_0x7034('0x31')]?_0x518de0[_0x7034('0x2f')]:_0x1f5b6e['model'];if(!_0x50a99f[_0x7034('0x2c')][_0x7034('0x32')]('nolimit')){_0x518de0[_0x7034('0x18')]=qs[_0x7034('0x18')](_0x50a99f[_0x7034('0x2c')][_0x7034('0x18')]);_0x518de0[_0x7034('0x17')]=qs[_0x7034('0x17')](_0x50a99f[_0x7034('0x2c')][_0x7034('0x17')]);}_0x518de0[_0x7034('0x33')]=qs[_0x7034('0x34')](_0x50a99f['query'][_0x7034('0x34')]);_0x518de0[_0x7034('0x35')]=qs[_0x7034('0x36')](_[_0x7034('0x37')](_0x50a99f['query'],_0x1f5b6e[_0x7034('0x36')]),_0xec9b7d);if(_0x50a99f['query'][_0x7034('0x38')]){_0x518de0[_0x7034('0x35')]=_[_0x7034('0x39')](_0x518de0[_0x7034('0x35')],{'$or':_['map'](_0xec9b7d,function(_0x13f13c){if(_0x13f13c['type']!==_0x7034('0x3a')){var _0x7d19f5={};_0x7d19f5[_0x13f13c[_0x7034('0x24')]]={'$like':'%'+_0x50a99f['query']['filter']+'%'};return _0x7d19f5;}})});}_0x518de0=_[_0x7034('0x39')]({},_0x518de0,_0x50a99f[_0x7034('0x3b')]);var _0x5e043e={'where':_0x518de0[_0x7034('0x35')]};return db[_0x7034('0x27')]['count'](_0x5e043e)[_0x7034('0x1f')](function(_0x517573){_0x22c48d['count']=_0x517573;if(_0x50a99f[_0x7034('0x2c')]['includeAll']){_0x518de0[_0x7034('0x3c')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x7034('0x3d')](_0x518de0);})['then'](function(_0x192c9b){_0x22c48d['rows']=_0x192c9b;return _0x22c48d;})[_0x7034('0x1f')](respondWithFilteredResult(_0x423158,_0x518de0))[_0x7034('0x3e')](handleError(_0x423158,null));};exports[_0x7034('0x3f')]=function(_0x5ab693,_0x550f2f){var _0x35c74c={'raw':!![],'where':{'id':_0x5ab693['params']['id']}},_0x55cd0f={};_0x55cd0f['model']=_[_0x7034('0x2d')](db['CmContactHasItem'][_0x7034('0x28')]);_0x55cd0f['query']=_[_0x7034('0x2d')](_0x5ab693[_0x7034('0x2c')]);_0x55cd0f['filters']=_[_0x7034('0x2e')](_0x55cd0f[_0x7034('0x2b')],_0x55cd0f[_0x7034('0x2c')]);_0x35c74c[_0x7034('0x2f')]=_[_0x7034('0x2e')](_0x55cd0f[_0x7034('0x2b')],qs['fields'](_0x5ab693['query'][_0x7034('0x30')]));_0x35c74c[_0x7034('0x2f')]=_0x35c74c['attributes']['length']?_0x35c74c[_0x7034('0x2f')]:_0x55cd0f[_0x7034('0x2b')];if(_0x5ab693[_0x7034('0x2c')][_0x7034('0x40')]){_0x35c74c['include']=[{'all':!![]}];}_0x35c74c=_[_0x7034('0x39')]({},_0x35c74c,_0x5ab693[_0x7034('0x3b')]);return db[_0x7034('0x27')][_0x7034('0x41')](_0x35c74c)[_0x7034('0x1f')](handleEntityNotFound(_0x550f2f,null))[_0x7034('0x1f')](respondWithResult(_0x550f2f,null))[_0x7034('0x3e')](handleError(_0x550f2f,null));};exports[_0x7034('0x42')]=function(_0x1914fd,_0x5869b5){return db[_0x7034('0x27')]['create'](_0x1914fd[_0x7034('0x43')],{})['then'](function(_0x1e0d8c){var _0x44960d=_0x1914fd[_0x7034('0x44')][_0x7034('0x21')]({'plain':!![]});if(!_0x44960d)throw new Error(_0x7034('0x45'));if(_0x44960d['role']===_0x7034('0x44')){var _0x342b8a=_0x1e0d8c['get']({'plain':!![]});var _0x3c0fb5='CmContactHasItems';return db[_0x7034('0x46')][_0x7034('0x41')]({'where':{'name':_0x3c0fb5,'userProfileId':_0x44960d[_0x7034('0x47')]},'raw':!![]})[_0x7034('0x1f')](function(_0x47f176){if(_0x47f176&&_0x47f176['autoAssociation']===0x0){return db[_0x7034('0x48')]['create']({'name':_0x342b8a[_0x7034('0x24')],'resourceId':_0x342b8a['id'],'type':_0x47f176[_0x7034('0x24')],'sectionId':_0x47f176['id']},{})[_0x7034('0x1f')](function(){return _0x1e0d8c;});}else{return _0x1e0d8c;}})[_0x7034('0x3e')](function(_0xf5bb08){logger[_0x7034('0x49')](_0x7034('0x4a'),_0xf5bb08);throw _0xf5bb08;});}return _0x1e0d8c;})[_0x7034('0x1f')](respondWithResult(_0x5869b5,0xc9))['catch'](handleError(_0x5869b5,null));};exports[_0x7034('0x1e')]=function(_0x1eb8bf,_0x20b075){if(_0x1eb8bf['body']['id']){delete _0x1eb8bf[_0x7034('0x43')]['id'];}return db['CmContactHasItem'][_0x7034('0x41')]({'where':{'id':_0x1eb8bf['params']['id']}})['then'](handleEntityNotFound(_0x20b075,null))[_0x7034('0x1f')](saveUpdates(_0x1eb8bf[_0x7034('0x43')],null))['then'](respondWithResult(_0x20b075,null))['catch'](handleError(_0x20b075,null));};exports[_0x7034('0x20')]=function(_0x40af88,_0x242c44){return db['CmContactHasItem'][_0x7034('0x41')]({'where':{'id':_0x40af88[_0x7034('0x4b')]['id']}})['then'](handleEntityNotFound(_0x242c44,null))['then'](removeEntity(_0x242c44,null))['catch'](handleError(_0x242c44,null));}; \ No newline at end of file +var _0x2e9e=['role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','save','update','then','destroy','CmContactHasItems','UserProfileResource','end','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','CmContactHasItem','rows','catch','params','keys','options','find','create','get'];(function(_0x4504b6,_0x4d1226){var _0x3b6d91=function(_0x488f35){while(--_0x488f35){_0x4504b6['push'](_0x4504b6['shift']());}};_0x3b6d91(++_0x4d1226);}(_0x2e9e,0x1e1));var _0xe2e9=function(_0x2bf098,_0x2085c2){_0x2bf098=_0x2bf098-0x0;var _0x320315=_0x2e9e[_0x2bf098];return _0x320315;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe2e9('0x0'));var zipdir=require(_0xe2e9('0x1'));var jsonpatch=require(_0xe2e9('0x2'));var rp=require(_0xe2e9('0x3'));var moment=require(_0xe2e9('0x4'));var BPromise=require(_0xe2e9('0x5'));var Mustache=require(_0xe2e9('0x6'));var util=require(_0xe2e9('0x7'));var path=require(_0xe2e9('0x8'));var sox=require(_0xe2e9('0x9'));var csv=require(_0xe2e9('0xa'));var ejs=require(_0xe2e9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe2e9('0xc'));var crypto=require(_0xe2e9('0xd'));var jsforce=require(_0xe2e9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe2e9('0xa'));var querystring=require(_0xe2e9('0xf'));var Papa=require(_0xe2e9('0x10'));var Redis=require(_0xe2e9('0x11'));var authService=require(_0xe2e9('0x12'));var qs=require(_0xe2e9('0x13'));var as=require(_0xe2e9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe2e9('0x15'))(_0xe2e9('0x16'));var utils=require(_0xe2e9('0x17'));var config=require(_0xe2e9('0x18'));var db=require(_0xe2e9('0x19'))['db'];function respondWithStatusCode(_0x50eb64,_0x1be50a){_0x1be50a=_0x1be50a||0xcc;return function(_0x5c7f20){if(_0x5c7f20){return _0x50eb64[_0xe2e9('0x1a')](_0x1be50a);}return _0x50eb64[_0xe2e9('0x1b')](_0x1be50a)['end']();};}function respondWithResult(_0x3f4859,_0x23efcd){_0x23efcd=_0x23efcd||0xc8;return function(_0x2c09c9){if(_0x2c09c9){return _0x3f4859['status'](_0x23efcd)['json'](_0x2c09c9);}};}function respondWithFilteredResult(_0x797a9f,_0x4b9ee2){return function(_0x1f30f5){if(_0x1f30f5){var _0x9000e9=_0x1f30f5[_0xe2e9('0x1c')],_0x401191=_0x4b9ee2[_0xe2e9('0x1d')],_0xe7288d=_0x4b9ee2[_0xe2e9('0x1d')]+_0x4b9ee2[_0xe2e9('0x1e')],_0x58c056;if(_0xe7288d>=_0x9000e9){_0xe7288d=_0x9000e9;_0x58c056=0xc8;}else{_0x58c056=0xce;}_0x797a9f[_0xe2e9('0x1b')](_0x58c056);return _0x797a9f['set']('Content-Range',_0x401191+'-'+_0xe7288d+'/'+_0x9000e9)['json'](_0x1f30f5);}return null;};}function patchUpdates(_0x1efbe2){return function(_0x5a14c6){try{jsonpatch['apply'](_0x5a14c6,_0x1efbe2,!![]);}catch(_0x2ec5cb){return BPromise['reject'](_0x2ec5cb);}return _0x5a14c6[_0xe2e9('0x1f')]();};}function saveUpdates(_0x1ec8f5,_0x466648){return function(_0x52a122){if(_0x52a122){return _0x52a122[_0xe2e9('0x20')](_0x1ec8f5)[_0xe2e9('0x21')](function(_0x213c7d){return _0x213c7d;});}return null;};}function removeEntity(_0x2574db,_0x42a722){return function(_0x2011a9){if(_0x2011a9){return _0x2011a9[_0xe2e9('0x22')]()['then'](function(){var _0x266081=_0x2011a9['get']({'plain':!![]});var _0x1e029a=_0xe2e9('0x23');return db[_0xe2e9('0x24')][_0xe2e9('0x22')]({'where':{'type':_0x1e029a,'resourceId':_0x266081['id']}})[_0xe2e9('0x21')](function(){return _0x2011a9;});})['then'](function(){_0x2574db[_0xe2e9('0x1b')](0xcc)[_0xe2e9('0x25')]();});}};}function handleEntityNotFound(_0x50c724,_0x2de605){return function(_0x43d637){if(!_0x43d637){_0x50c724['sendStatus'](0x194);}return _0x43d637;};}function handleError(_0x1ee581,_0x42cf26){_0x42cf26=_0x42cf26||0x1f4;return function(_0x430281){logger['error'](_0x430281[_0xe2e9('0x26')]);if(_0x430281[_0xe2e9('0x27')]){delete _0x430281['name'];}_0x1ee581[_0xe2e9('0x1b')](_0x42cf26)[_0xe2e9('0x28')](_0x430281);};}exports[_0xe2e9('0x29')]=function(_0xd170b4,_0xcd3805){var _0x1554e9={},_0x29f7ca={},_0x4df50e={'count':0x0,'rows':[]};var _0xeae732=_[_0xe2e9('0x2a')](db['CmContactHasItem'][_0xe2e9('0x2b')],function(_0x6ab424){return{'name':_0x6ab424['fieldName'],'type':_0x6ab424[_0xe2e9('0x2c')][_0xe2e9('0x2d')]};});_0x29f7ca['model']=_[_0xe2e9('0x2a')](_0xeae732,_0xe2e9('0x27'));_0x29f7ca[_0xe2e9('0x2e')]=_['keys'](_0xd170b4[_0xe2e9('0x2e')]);_0x29f7ca[_0xe2e9('0x2f')]=_[_0xe2e9('0x30')](_0x29f7ca[_0xe2e9('0x31')],_0x29f7ca[_0xe2e9('0x2e')]);_0x1554e9[_0xe2e9('0x32')]=_[_0xe2e9('0x30')](_0x29f7ca[_0xe2e9('0x31')],qs[_0xe2e9('0x33')](_0xd170b4[_0xe2e9('0x2e')]['fields']));_0x1554e9['attributes']=_0x1554e9[_0xe2e9('0x32')][_0xe2e9('0x34')]?_0x1554e9[_0xe2e9('0x32')]:_0x29f7ca['model'];if(!_0xd170b4[_0xe2e9('0x2e')][_0xe2e9('0x35')]('nolimit')){_0x1554e9[_0xe2e9('0x1e')]=qs[_0xe2e9('0x1e')](_0xd170b4[_0xe2e9('0x2e')][_0xe2e9('0x1e')]);_0x1554e9['offset']=qs[_0xe2e9('0x1d')](_0xd170b4[_0xe2e9('0x2e')][_0xe2e9('0x1d')]);}_0x1554e9[_0xe2e9('0x36')]=qs[_0xe2e9('0x37')](_0xd170b4[_0xe2e9('0x2e')][_0xe2e9('0x37')]);_0x1554e9[_0xe2e9('0x38')]=qs[_0xe2e9('0x2f')](_[_0xe2e9('0x39')](_0xd170b4[_0xe2e9('0x2e')],_0x29f7ca[_0xe2e9('0x2f')]),_0xeae732);if(_0xd170b4[_0xe2e9('0x2e')][_0xe2e9('0x3a')]){_0x1554e9[_0xe2e9('0x38')]=_[_0xe2e9('0x3b')](_0x1554e9['where'],{'$or':_['map'](_0xeae732,function(_0xf7535b){if(_0xf7535b[_0xe2e9('0x2c')]!==_0xe2e9('0x3c')){var _0x2dd364={};_0x2dd364[_0xf7535b['name']]={'$like':'%'+_0xd170b4[_0xe2e9('0x2e')][_0xe2e9('0x3a')]+'%'};return _0x2dd364;}})});}_0x1554e9=_[_0xe2e9('0x3b')]({},_0x1554e9,_0xd170b4['options']);var _0x3c90e1={'where':_0x1554e9[_0xe2e9('0x38')]};return db['CmContactHasItem'][_0xe2e9('0x1c')](_0x3c90e1)[_0xe2e9('0x21')](function(_0x14e767){_0x4df50e[_0xe2e9('0x1c')]=_0x14e767;if(_0xd170b4['query'][_0xe2e9('0x3d')]){_0x1554e9[_0xe2e9('0x3e')]=[{'all':!![]}];}return db[_0xe2e9('0x3f')]['findAll'](_0x1554e9);})[_0xe2e9('0x21')](function(_0x295113){_0x4df50e[_0xe2e9('0x40')]=_0x295113;return _0x4df50e;})[_0xe2e9('0x21')](respondWithFilteredResult(_0xcd3805,_0x1554e9))[_0xe2e9('0x41')](handleError(_0xcd3805,null));};exports['show']=function(_0x566d93,_0x47c13e){var _0x5c9846={'raw':!![],'where':{'id':_0x566d93[_0xe2e9('0x42')]['id']}},_0x49b139={};_0x49b139[_0xe2e9('0x31')]=_['keys'](db[_0xe2e9('0x3f')][_0xe2e9('0x2b')]);_0x49b139[_0xe2e9('0x2e')]=_[_0xe2e9('0x43')](_0x566d93['query']);_0x49b139['filters']=_['intersection'](_0x49b139['model'],_0x49b139[_0xe2e9('0x2e')]);_0x5c9846[_0xe2e9('0x32')]=_[_0xe2e9('0x30')](_0x49b139[_0xe2e9('0x31')],qs['fields'](_0x566d93[_0xe2e9('0x2e')][_0xe2e9('0x33')]));_0x5c9846[_0xe2e9('0x32')]=_0x5c9846[_0xe2e9('0x32')][_0xe2e9('0x34')]?_0x5c9846['attributes']:_0x49b139[_0xe2e9('0x31')];if(_0x566d93[_0xe2e9('0x2e')][_0xe2e9('0x3d')]){_0x5c9846[_0xe2e9('0x3e')]=[{'all':!![]}];}_0x5c9846=_[_0xe2e9('0x3b')]({},_0x5c9846,_0x566d93[_0xe2e9('0x44')]);return db[_0xe2e9('0x3f')][_0xe2e9('0x45')](_0x5c9846)[_0xe2e9('0x21')](handleEntityNotFound(_0x47c13e,null))[_0xe2e9('0x21')](respondWithResult(_0x47c13e,null))[_0xe2e9('0x41')](handleError(_0x47c13e,null));};exports[_0xe2e9('0x46')]=function(_0x19ceb7,_0xdc9d5a){return db[_0xe2e9('0x3f')][_0xe2e9('0x46')](_0x19ceb7['body'],{})[_0xe2e9('0x21')](function(_0x5217f2){var _0x4709fb=_0x19ceb7['user'][_0xe2e9('0x47')]({'plain':!![]});if(!_0x4709fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4709fb[_0xe2e9('0x48')]===_0xe2e9('0x49')){var _0x29dc77=_0x5217f2['get']({'plain':!![]});var _0x27e4a8=_0xe2e9('0x23');return db[_0xe2e9('0x4a')][_0xe2e9('0x45')]({'where':{'name':_0x27e4a8,'userProfileId':_0x4709fb['userProfileId']},'raw':!![]})[_0xe2e9('0x21')](function(_0x154486){if(_0x154486&&_0x154486[_0xe2e9('0x4b')]===0x0){return db[_0xe2e9('0x24')][_0xe2e9('0x46')]({'name':_0x29dc77[_0xe2e9('0x27')],'resourceId':_0x29dc77['id'],'type':_0x154486[_0xe2e9('0x27')],'sectionId':_0x154486['id']},{})[_0xe2e9('0x21')](function(){return _0x5217f2;});}else{return _0x5217f2;}})[_0xe2e9('0x41')](function(_0x1d21f6){logger[_0xe2e9('0x4c')](_0xe2e9('0x4d'),_0x1d21f6);throw _0x1d21f6;});}return _0x5217f2;})[_0xe2e9('0x21')](respondWithResult(_0xdc9d5a,0xc9))['catch'](handleError(_0xdc9d5a,null));};exports[_0xe2e9('0x20')]=function(_0x5296b1,_0xdad23a){if(_0x5296b1[_0xe2e9('0x4e')]['id']){delete _0x5296b1[_0xe2e9('0x4e')]['id'];}return db[_0xe2e9('0x3f')][_0xe2e9('0x45')]({'where':{'id':_0x5296b1[_0xe2e9('0x42')]['id']}})[_0xe2e9('0x21')](handleEntityNotFound(_0xdad23a,null))[_0xe2e9('0x21')](saveUpdates(_0x5296b1[_0xe2e9('0x4e')],null))['then'](respondWithResult(_0xdad23a,null))[_0xe2e9('0x41')](handleError(_0xdad23a,null));};exports[_0xe2e9('0x22')]=function(_0x1bea22,_0x33b35e){return db[_0xe2e9('0x3f')][_0xe2e9('0x45')]({'where':{'id':_0x1bea22[_0xe2e9('0x42')]['id']}})[_0xe2e9('0x21')](handleEntityNotFound(_0x33b35e,null))[_0xe2e9('0x21')](removeEntity(_0x33b35e,null))[_0xe2e9('0x41')](handleError(_0x33b35e,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 6157115..15f8f1c 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa630=['define','CmContactHasItem','cm_contact_has_items','lodash','util','moment','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa630,0xbe));var _0x0a63=function(_0x343d43,_0x42a0bb){_0x343d43=_0x343d43-0x0;var _0x228c00=_0xa630[_0x343d43];return _0x228c00;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a63('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a63('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var attributes=require(_0x0a63('0x6'));module[_0x0a63('0x7')]=function(_0x37b4c9,_0x4b7474){return _0x37b4c9[_0x0a63('0x8')](_0x0a63('0x9'),attributes,{'tableName':_0x0a63('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b20=['../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x14ca3f,_0x31ebdc){var _0x50ec75=function(_0x53a99f){while(--_0x53a99f){_0x14ca3f['push'](_0x14ca3f['shift']());}};_0x50ec75(++_0x31ebdc);}(_0x1b20,0x66));var _0x01b2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1b20[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x01b2('0x0'));var logger=require(_0x01b2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x01b2('0x2'));var rp=require(_0x01b2('0x3'));var fs=require('fs');var path=require(_0x01b2('0x4'));var rimraf=require(_0x01b2('0x5'));var config=require(_0x01b2('0x6'));var attributes=require(_0x01b2('0x7'));module[_0x01b2('0x8')]=function(_0x28de4a,_0x46e745){return _0x28de4a[_0x01b2('0x9')](_0x01b2('0xa'),attributes,{'tableName':_0x01b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 68d26d7..9e14ad6 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6c6=['stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','debug','request\x20sent'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xf6c6,0xed));var _0x6f6c=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xf6c6[_0xb24a3e];return _0x4038d7;};'use strict';var _=require(_0x6f6c('0x0'));var util=require(_0x6f6c('0x1'));var moment=require(_0x6f6c('0x2'));var BPromise=require(_0x6f6c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f6c('0x4'));var db=require(_0x6f6c('0x5'))['db'];var utils=require(_0x6f6c('0x6'));var logger=require(_0x6f6c('0x7'))('rpc');var config=require(_0x6f6c('0x8'));var jayson=require(_0x6f6c('0x9'));var client=jayson[_0x6f6c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x158508,_0x10d84e,_0x4bb100){return new BPromise(function(_0x53f5c4,_0x4e57d1){return client[_0x6f6c('0xb')](_0x158508,_0x4bb100)['then'](function(_0x16c39d){logger[_0x6f6c('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x10d84e,'request\x20sent');logger[_0x6f6c('0xd')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x10d84e,_0x6f6c('0xe'),JSON[_0x6f6c('0xf')](_0x16c39d));if(_0x16c39d[_0x6f6c('0x10')]){if(_0x16c39d[_0x6f6c('0x10')][_0x6f6c('0x11')]===0x1f4){logger[_0x6f6c('0x10')](_0x6f6c('0x12'),_0x10d84e,_0x16c39d[_0x6f6c('0x10')]['message']);return _0x4e57d1(_0x16c39d['error'][_0x6f6c('0x13')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x10d84e,_0x16c39d[_0x6f6c('0x10')][_0x6f6c('0x13')]);return _0x53f5c4(_0x16c39d[_0x6f6c('0x10')][_0x6f6c('0x13')]);}else{logger[_0x6f6c('0xc')](_0x6f6c('0x12'),_0x10d84e,_0x6f6c('0xe'));_0x53f5c4(_0x16c39d[_0x6f6c('0x14')][_0x6f6c('0x13')]);}})['catch'](function(_0xe76fe9){logger[_0x6f6c('0x10')](_0x6f6c('0x12'),_0x10d84e,_0xe76fe9);_0x4e57d1(_0xe76fe9);});});} \ No newline at end of file +var _0x3a24=['message','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0x3a24,0x19f));var _0x43a2=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0x3a24[_0x1fdb40];return _0x281f93;};'use strict';var _=require(_0x43a2('0x0'));var util=require(_0x43a2('0x1'));var moment=require('moment');var BPromise=require(_0x43a2('0x2'));var rs=require(_0x43a2('0x3'));var fs=require('fs');var Redis=require(_0x43a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x43a2('0x5'));var config=require(_0x43a2('0x6'));var jayson=require(_0x43a2('0x7'));var client=jayson['client'][_0x43a2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ef998,_0x7484e,_0x563724){return new BPromise(function(_0x57c0f0,_0x3275c7){return client[_0x43a2('0x9')](_0x1ef998,_0x563724)[_0x43a2('0xa')](function(_0x4444b9){logger[_0x43a2('0xb')](_0x43a2('0xc'),_0x7484e,_0x43a2('0xd'));logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x7484e,'request\x20sent',JSON[_0x43a2('0xe')](_0x4444b9));if(_0x4444b9[_0x43a2('0xf')]){if(_0x4444b9[_0x43a2('0xf')][_0x43a2('0x10')]===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x7484e,_0x4444b9['error'][_0x43a2('0x11')]);return _0x3275c7(_0x4444b9[_0x43a2('0xf')][_0x43a2('0x11')]);}logger[_0x43a2('0xf')](_0x43a2('0xc'),_0x7484e,_0x4444b9[_0x43a2('0xf')][_0x43a2('0x11')]);return _0x57c0f0(_0x4444b9[_0x43a2('0xf')][_0x43a2('0x11')]);}else{logger[_0x43a2('0xb')](_0x43a2('0xc'),_0x7484e,_0x43a2('0xd'));_0x57c0f0(_0x4444b9['result'][_0x43a2('0x11')]);}})['catch'](function(_0xef8554){logger[_0x43a2('0xf')](_0x43a2('0xc'),_0x7484e,_0xef8554);_0x3275c7(_0xef8554);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 472282f..5debf75 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44c1=['isAuthenticated','show','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get'];(function(_0xf9c3cf,_0x23b4cd){var _0x4879eb=function(_0x459648){while(--_0x459648){_0xf9c3cf['push'](_0xf9c3cf['shift']());}};_0x4879eb(++_0x23b4cd);}(_0x44c1,0x18f));var _0x144c=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0x44c1[_0x2d8434];return _0x26b9e4;};'use strict';var multer=require('multer');var util=require(_0x144c('0x0'));var path=require(_0x144c('0x1'));var timeout=require(_0x144c('0x2'));var express=require(_0x144c('0x3'));var router=express[_0x144c('0x4')]();var auth=require(_0x144c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x144c('0x6'));var controller=require(_0x144c('0x7'));router[_0x144c('0x8')]('/',auth[_0x144c('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x144c('0xa')]);router['post']('/',auth[_0x144c('0x9')](),controller['create']);router[_0x144c('0xb')](_0x144c('0xc'),auth[_0x144c('0x9')](),controller[_0x144c('0xd')]);router[_0x144c('0xe')](_0x144c('0xc'),auth[_0x144c('0x9')](),controller[_0x144c('0xf')]);module[_0x144c('0x10')]=router; \ No newline at end of file +var _0xed9b=['/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','index'];(function(_0x3673bb,_0x538336){var _0x3ae507=function(_0xe79bc7){while(--_0xe79bc7){_0x3673bb['push'](_0x3673bb['shift']());}};_0x3ae507(++_0x538336);}(_0xed9b,0x75));var _0xbed9=function(_0x513545,_0x158f2e){_0x513545=_0x513545-0x0;var _0x18b7c5=_0xed9b[_0x513545];return _0x18b7c5;};'use strict';var multer=require(_0xbed9('0x0'));var util=require('util');var path=require(_0xbed9('0x1'));var timeout=require('connect-timeout');var express=require(_0xbed9('0x2'));var router=express[_0xbed9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbed9('0x4'));var config=require(_0xbed9('0x5'));var controller=require(_0xbed9('0x6'));router[_0xbed9('0x7')]('/',auth['isAuthenticated'](),controller[_0xbed9('0x8')]);router[_0xbed9('0x7')](_0xbed9('0x9'),auth[_0xbed9('0xa')](),controller[_0xbed9('0xb')]);router[_0xbed9('0xc')]('/',auth[_0xbed9('0xa')](),controller[_0xbed9('0xd')]);router[_0xbed9('0xe')]('/:id',auth[_0xbed9('0xa')](),controller[_0xbed9('0xf')]);router['delete']('/:id',auth[_0xbed9('0xa')](),controller[_0xbed9('0x10')]);module[_0xbed9('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 16e21b9..5357c3d 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb0a=['sequelize','exports','STRING'];(function(_0x1c45fe,_0xce1fac){var _0x395449=function(_0x1e7b92){while(--_0x1e7b92){_0x1c45fe['push'](_0x1c45fe['shift']());}};_0x395449(++_0xce1fac);}(_0xdb0a,0x1c5));var _0xadb0=function(_0x513aca,_0x42ec3b){_0x513aca=_0x513aca-0x0;var _0xa6994=_0xdb0a[_0x513aca];return _0xa6994;};'use strict';var Sequelize=require(_0xadb0('0x0'));module[_0xadb0('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'phone':{'type':Sequelize[_0xadb0('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x5cf0=['INTEGER','STRING','sequelize','exports'];(function(_0x5e5bfe,_0x1e69d0){var _0x2636de=function(_0x45da5a){while(--_0x45da5a){_0x5e5bfe['push'](_0x5e5bfe['shift']());}};_0x2636de(++_0x1e69d0);}(_0x5cf0,0x136));var _0x05cf=function(_0x1cac5a,_0x51c54a){_0x1cac5a=_0x1cac5a-0x0;var _0x89fc37=_0x5cf0[_0x1cac5a];return _0x89fc37;};'use strict';var Sequelize=require(_0x05cf('0x0'));module[_0x05cf('0x1')]={'CmContactId':{'type':Sequelize[_0x05cf('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x05cf('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index 1767da8..600ef43 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ab5=['destroy','CmContactHasPhones','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','CmContactHasPhone','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','status','end','json','count','offset','apply','reject','save','update','then'];(function(_0x5cb366,_0x2a3d54){var _0x4358cd=function(_0x1b1856){while(--_0x1b1856){_0x5cb366['push'](_0x5cb366['shift']());}};_0x4358cd(++_0x2a3d54);}(_0x2ab5,0x11e));var _0x52ab=function(_0xe083f3,_0x1282ac){_0xe083f3=_0xe083f3-0x0;var _0x1be0a7=_0x2ab5[_0xe083f3];return _0x1be0a7;};'use strict';var pdf=require(_0x52ab('0x0'));var emlformat=require(_0x52ab('0x1'));var rimraf=require(_0x52ab('0x2'));var zipdir=require(_0x52ab('0x3'));var jsonpatch=require(_0x52ab('0x4'));var rp=require(_0x52ab('0x5'));var moment=require(_0x52ab('0x6'));var BPromise=require(_0x52ab('0x7'));var Mustache=require(_0x52ab('0x8'));var util=require(_0x52ab('0x9'));var path=require(_0x52ab('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x52ab('0xb'));var squel=require(_0x52ab('0xc'));var crypto=require('crypto');var jsforce=require(_0x52ab('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x52ab('0xe'));var querystring=require(_0x52ab('0xf'));var Papa=require(_0x52ab('0x10'));var Redis=require(_0x52ab('0x11'));var authService=require(_0x52ab('0x12'));var qs=require(_0x52ab('0x13'));var as=require(_0x52ab('0x14'));var hardwareService=require(_0x52ab('0x15'));var logger=require('../../config/logger')(_0x52ab('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x52ab('0x17'))['db'];function respondWithStatusCode(_0x1a4d3c,_0x246ccb){_0x246ccb=_0x246ccb||0xcc;return function(_0x2c87f1){if(_0x2c87f1){return _0x1a4d3c['sendStatus'](_0x246ccb);}return _0x1a4d3c[_0x52ab('0x18')](_0x246ccb)[_0x52ab('0x19')]();};}function respondWithResult(_0x511b64,_0x1ed974){_0x1ed974=_0x1ed974||0xc8;return function(_0x48cc3c){if(_0x48cc3c){return _0x511b64[_0x52ab('0x18')](_0x1ed974)[_0x52ab('0x1a')](_0x48cc3c);}};}function respondWithFilteredResult(_0x49cfb8,_0xd4bcda){return function(_0xc1687){if(_0xc1687){var _0x35530a=_0xc1687[_0x52ab('0x1b')],_0x55323d=_0xd4bcda[_0x52ab('0x1c')],_0xab2ccb=_0xd4bcda[_0x52ab('0x1c')]+_0xd4bcda['limit'],_0x9dceab;if(_0xab2ccb>=_0x35530a){_0xab2ccb=_0x35530a;_0x9dceab=0xc8;}else{_0x9dceab=0xce;}_0x49cfb8['status'](_0x9dceab);return _0x49cfb8['set']('Content-Range',_0x55323d+'-'+_0xab2ccb+'/'+_0x35530a)[_0x52ab('0x1a')](_0xc1687);}return null;};}function patchUpdates(_0x197277){return function(_0x160743){try{jsonpatch[_0x52ab('0x1d')](_0x160743,_0x197277,!![]);}catch(_0x478d0a){return BPromise[_0x52ab('0x1e')](_0x478d0a);}return _0x160743[_0x52ab('0x1f')]();};}function saveUpdates(_0x2539e8,_0x49350e){return function(_0x244c77){if(_0x244c77){return _0x244c77[_0x52ab('0x20')](_0x2539e8)[_0x52ab('0x21')](function(_0x231cb4){return _0x231cb4;});}return null;};}function removeEntity(_0x24ea43,_0x5547e2){return function(_0xe46a17){if(_0xe46a17){return _0xe46a17[_0x52ab('0x22')]()[_0x52ab('0x21')](function(){var _0x31025b=_0xe46a17['get']({'plain':!![]});var _0x45d65a=_0x52ab('0x23');return db['UserProfileResource'][_0x52ab('0x22')]({'where':{'type':_0x45d65a,'resourceId':_0x31025b['id']}})['then'](function(){return _0xe46a17;});})['then'](function(){_0x24ea43[_0x52ab('0x18')](0xcc)[_0x52ab('0x19')]();});}};}function handleEntityNotFound(_0x9cce67,_0x5b01ec){return function(_0x5cc030){if(!_0x5cc030){_0x9cce67['sendStatus'](0x194);}return _0x5cc030;};}function handleError(_0x10f4d0,_0x2e5b4c){_0x2e5b4c=_0x2e5b4c||0x1f4;return function(_0x552460){logger[_0x52ab('0x24')](_0x552460[_0x52ab('0x25')]);if(_0x552460[_0x52ab('0x26')]){delete _0x552460['name'];}_0x10f4d0[_0x52ab('0x18')](_0x2e5b4c)[_0x52ab('0x27')](_0x552460);};}exports[_0x52ab('0x28')]=function(_0x54e271,_0x13285b){var _0x59e8b7={},_0x592cb9={},_0x3f2a2a={'count':0x0,'rows':[]};var _0x396324=_[_0x52ab('0x29')](db['CmContactHasPhone'][_0x52ab('0x2a')],function(_0x5c2c86){return{'name':_0x5c2c86[_0x52ab('0x2b')],'type':_0x5c2c86[_0x52ab('0x2c')][_0x52ab('0x2d')]};});_0x592cb9[_0x52ab('0x2e')]=_[_0x52ab('0x29')](_0x396324,_0x52ab('0x26'));_0x592cb9[_0x52ab('0x2f')]=_['keys'](_0x54e271[_0x52ab('0x2f')]);_0x592cb9['filters']=_[_0x52ab('0x30')](_0x592cb9[_0x52ab('0x2e')],_0x592cb9[_0x52ab('0x2f')]);_0x59e8b7['attributes']=_[_0x52ab('0x30')](_0x592cb9[_0x52ab('0x2e')],qs[_0x52ab('0x31')](_0x54e271[_0x52ab('0x2f')][_0x52ab('0x31')]));_0x59e8b7[_0x52ab('0x32')]=_0x59e8b7[_0x52ab('0x32')][_0x52ab('0x33')]?_0x59e8b7[_0x52ab('0x32')]:_0x592cb9[_0x52ab('0x2e')];if(!_0x54e271[_0x52ab('0x2f')][_0x52ab('0x34')]('nolimit')){_0x59e8b7[_0x52ab('0x35')]=qs[_0x52ab('0x35')](_0x54e271[_0x52ab('0x2f')][_0x52ab('0x35')]);_0x59e8b7[_0x52ab('0x1c')]=qs[_0x52ab('0x1c')](_0x54e271['query'][_0x52ab('0x1c')]);}_0x59e8b7[_0x52ab('0x36')]=qs[_0x52ab('0x37')](_0x54e271[_0x52ab('0x2f')][_0x52ab('0x37')]);_0x59e8b7[_0x52ab('0x38')]=qs[_0x52ab('0x39')](_[_0x52ab('0x3a')](_0x54e271[_0x52ab('0x2f')],_0x592cb9[_0x52ab('0x39')]),_0x396324);if(_0x54e271['query'][_0x52ab('0x3b')]){_0x59e8b7['where']=_[_0x52ab('0x3c')](_0x59e8b7[_0x52ab('0x38')],{'$or':_[_0x52ab('0x29')](_0x396324,function(_0x14f180){if(_0x14f180[_0x52ab('0x2c')]!==_0x52ab('0x3d')){var _0x1b199a={};_0x1b199a[_0x14f180[_0x52ab('0x26')]]={'$like':'%'+_0x54e271[_0x52ab('0x2f')][_0x52ab('0x3b')]+'%'};return _0x1b199a;}})});}_0x59e8b7=_['merge']({},_0x59e8b7,_0x54e271[_0x52ab('0x3e')]);var _0x5c4277={'where':_0x59e8b7['where']};return db[_0x52ab('0x3f')][_0x52ab('0x1b')](_0x5c4277)[_0x52ab('0x21')](function(_0x24782e){_0x3f2a2a[_0x52ab('0x1b')]=_0x24782e;if(_0x54e271['query'][_0x52ab('0x40')]){_0x59e8b7[_0x52ab('0x41')]=[{'all':!![]}];}return db[_0x52ab('0x3f')][_0x52ab('0x42')](_0x59e8b7);})[_0x52ab('0x21')](function(_0x49f14b){_0x3f2a2a[_0x52ab('0x43')]=_0x49f14b;return _0x3f2a2a;})[_0x52ab('0x21')](respondWithFilteredResult(_0x13285b,_0x59e8b7))[_0x52ab('0x44')](handleError(_0x13285b,null));};exports[_0x52ab('0x45')]=function(_0x564a98,_0x6ff5d6){var _0x42a55c={'raw':!![],'where':{'id':_0x564a98[_0x52ab('0x46')]['id']}},_0x1bc345={};_0x1bc345[_0x52ab('0x2e')]=_['keys'](db['CmContactHasPhone']['rawAttributes']);_0x1bc345[_0x52ab('0x2f')]=_[_0x52ab('0x47')](_0x564a98[_0x52ab('0x2f')]);_0x1bc345[_0x52ab('0x39')]=_[_0x52ab('0x30')](_0x1bc345['model'],_0x1bc345[_0x52ab('0x2f')]);_0x42a55c[_0x52ab('0x32')]=_[_0x52ab('0x30')](_0x1bc345[_0x52ab('0x2e')],qs[_0x52ab('0x31')](_0x564a98['query'][_0x52ab('0x31')]));_0x42a55c['attributes']=_0x42a55c['attributes'][_0x52ab('0x33')]?_0x42a55c['attributes']:_0x1bc345[_0x52ab('0x2e')];if(_0x564a98[_0x52ab('0x2f')][_0x52ab('0x40')]){_0x42a55c[_0x52ab('0x41')]=[{'all':!![]}];}_0x42a55c=_[_0x52ab('0x3c')]({},_0x42a55c,_0x564a98[_0x52ab('0x3e')]);return db[_0x52ab('0x3f')]['find'](_0x42a55c)[_0x52ab('0x21')](handleEntityNotFound(_0x6ff5d6,null))[_0x52ab('0x21')](respondWithResult(_0x6ff5d6,null))[_0x52ab('0x44')](handleError(_0x6ff5d6,null));};exports[_0x52ab('0x48')]=function(_0x191bce,_0x330b){return db[_0x52ab('0x3f')][_0x52ab('0x48')](_0x191bce[_0x52ab('0x49')],{})[_0x52ab('0x21')](function(_0x8353ab){var _0xef5133=_0x191bce[_0x52ab('0x4a')]['get']({'plain':!![]});if(!_0xef5133)throw new Error(_0x52ab('0x4b'));if(_0xef5133['role']===_0x52ab('0x4a')){var _0x5e5631=_0x8353ab['get']({'plain':!![]});var _0x23604d='CmContactHasPhones';return db[_0x52ab('0x4c')]['find']({'where':{'name':_0x23604d,'userProfileId':_0xef5133[_0x52ab('0x4d')]},'raw':!![]})[_0x52ab('0x21')](function(_0x3e294a){if(_0x3e294a&&_0x3e294a['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5e5631[_0x52ab('0x26')],'resourceId':_0x5e5631['id'],'type':_0x3e294a[_0x52ab('0x26')],'sectionId':_0x3e294a['id']},{})[_0x52ab('0x21')](function(){return _0x8353ab;});}else{return _0x8353ab;}})['catch'](function(_0x432b62){logger[_0x52ab('0x24')](_0x52ab('0x4e'),_0x432b62);throw _0x432b62;});}return _0x8353ab;})[_0x52ab('0x21')](respondWithResult(_0x330b,0xc9))[_0x52ab('0x44')](handleError(_0x330b,null));};exports[_0x52ab('0x20')]=function(_0x23d4d5,_0x5b6446){if(_0x23d4d5[_0x52ab('0x49')]['id']){delete _0x23d4d5[_0x52ab('0x49')]['id'];}return db[_0x52ab('0x3f')][_0x52ab('0x4f')]({'where':{'id':_0x23d4d5[_0x52ab('0x46')]['id']}})[_0x52ab('0x21')](handleEntityNotFound(_0x5b6446,null))[_0x52ab('0x21')](saveUpdates(_0x23d4d5[_0x52ab('0x49')],null))['then'](respondWithResult(_0x5b6446,null))[_0x52ab('0x44')](handleError(_0x5b6446,null));};exports[_0x52ab('0x22')]=function(_0x3d1620,_0x86ea44){return db[_0x52ab('0x3f')][_0x52ab('0x4f')]({'where':{'id':_0x3d1620['params']['id']}})[_0x52ab('0x21')](handleEntityNotFound(_0x86ea44,null))[_0x52ab('0x21')](removeEntity(_0x86ea44,null))[_0x52ab('0x44')](handleError(_0x86ea44,null));}; \ No newline at end of file +var _0x7bb8=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','reject','save','update','destroy','then','get','CmContactHasPhones','UserProfileResource','error','name','send','index','map','CmContactHasPhone','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7bb8,0xa2));var _0x87bb=function(_0x18c927,_0x636a49){_0x18c927=_0x18c927-0x0;var _0x5e1484=_0x7bb8[_0x18c927];return _0x5e1484;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x87bb('0x0'));var rimraf=require(_0x87bb('0x1'));var zipdir=require(_0x87bb('0x2'));var jsonpatch=require(_0x87bb('0x3'));var rp=require(_0x87bb('0x4'));var moment=require(_0x87bb('0x5'));var BPromise=require(_0x87bb('0x6'));var Mustache=require('mustache');var util=require(_0x87bb('0x7'));var path=require(_0x87bb('0x8'));var sox=require('sox');var csv=require(_0x87bb('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x87bb('0xa'));var squel=require(_0x87bb('0xb'));var crypto=require(_0x87bb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x87bb('0xd'));var toCsv=require(_0x87bb('0x9'));var querystring=require(_0x87bb('0xe'));var Papa=require(_0x87bb('0xf'));var Redis=require(_0x87bb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x87bb('0x11'));var as=require(_0x87bb('0x12'));var hardwareService=require(_0x87bb('0x13'));var logger=require('../../config/logger')(_0x87bb('0x14'));var utils=require('../../config/utils');var config=require(_0x87bb('0x15'));var db=require(_0x87bb('0x16'))['db'];function respondWithStatusCode(_0xc48a73,_0x1e9eea){_0x1e9eea=_0x1e9eea||0xcc;return function(_0x5427b1){if(_0x5427b1){return _0xc48a73[_0x87bb('0x17')](_0x1e9eea);}return _0xc48a73[_0x87bb('0x18')](_0x1e9eea)['end']();};}function respondWithResult(_0x1f843e,_0x1e0beb){_0x1e0beb=_0x1e0beb||0xc8;return function(_0x2922a8){if(_0x2922a8){return _0x1f843e[_0x87bb('0x18')](_0x1e0beb)[_0x87bb('0x19')](_0x2922a8);}};}function respondWithFilteredResult(_0xce19,_0x1093b4){return function(_0x461a1c){if(_0x461a1c){var _0x4b3319=_0x461a1c['count'],_0x157b12=_0x1093b4[_0x87bb('0x1a')],_0x28637f=_0x1093b4['offset']+_0x1093b4[_0x87bb('0x1b')],_0x6dad58;if(_0x28637f>=_0x4b3319){_0x28637f=_0x4b3319;_0x6dad58=0xc8;}else{_0x6dad58=0xce;}_0xce19[_0x87bb('0x18')](_0x6dad58);return _0xce19[_0x87bb('0x1c')]('Content-Range',_0x157b12+'-'+_0x28637f+'/'+_0x4b3319)[_0x87bb('0x19')](_0x461a1c);}return null;};}function patchUpdates(_0x246dae){return function(_0x240356){try{jsonpatch[_0x87bb('0x1d')](_0x240356,_0x246dae,!![]);}catch(_0x20ef4e){return BPromise[_0x87bb('0x1e')](_0x20ef4e);}return _0x240356[_0x87bb('0x1f')]();};}function saveUpdates(_0x2fccf6,_0x578894){return function(_0x26cbe3){if(_0x26cbe3){return _0x26cbe3[_0x87bb('0x20')](_0x2fccf6)['then'](function(_0x2625c6){return _0x2625c6;});}return null;};}function removeEntity(_0x5533e9,_0x356206){return function(_0x5824ce){if(_0x5824ce){return _0x5824ce[_0x87bb('0x21')]()[_0x87bb('0x22')](function(){var _0x217d6a=_0x5824ce[_0x87bb('0x23')]({'plain':!![]});var _0x27fdf9=_0x87bb('0x24');return db[_0x87bb('0x25')][_0x87bb('0x21')]({'where':{'type':_0x27fdf9,'resourceId':_0x217d6a['id']}})[_0x87bb('0x22')](function(){return _0x5824ce;});})[_0x87bb('0x22')](function(){_0x5533e9[_0x87bb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eb27e,_0x1c4b1e){return function(_0x1925b6){if(!_0x1925b6){_0x3eb27e[_0x87bb('0x17')](0x194);}return _0x1925b6;};}function handleError(_0x2ab518,_0x5d5819){_0x5d5819=_0x5d5819||0x1f4;return function(_0xf2452b){logger[_0x87bb('0x26')](_0xf2452b['stack']);if(_0xf2452b[_0x87bb('0x27')]){delete _0xf2452b['name'];}_0x2ab518['status'](_0x5d5819)[_0x87bb('0x28')](_0xf2452b);};}exports[_0x87bb('0x29')]=function(_0x4b0bf5,_0x598530){var _0x26543e={},_0x2e317d={},_0x53f033={'count':0x0,'rows':[]};var _0x4ad3de=_[_0x87bb('0x2a')](db[_0x87bb('0x2b')]['rawAttributes'],function(_0x5a3e42){return{'name':_0x5a3e42[_0x87bb('0x2c')],'type':_0x5a3e42[_0x87bb('0x2d')]['key']};});_0x2e317d[_0x87bb('0x2e')]=_[_0x87bb('0x2a')](_0x4ad3de,_0x87bb('0x27'));_0x2e317d[_0x87bb('0x2f')]=_[_0x87bb('0x30')](_0x4b0bf5[_0x87bb('0x2f')]);_0x2e317d[_0x87bb('0x31')]=_[_0x87bb('0x32')](_0x2e317d[_0x87bb('0x2e')],_0x2e317d[_0x87bb('0x2f')]);_0x26543e[_0x87bb('0x33')]=_[_0x87bb('0x32')](_0x2e317d[_0x87bb('0x2e')],qs[_0x87bb('0x34')](_0x4b0bf5[_0x87bb('0x2f')][_0x87bb('0x34')]));_0x26543e[_0x87bb('0x33')]=_0x26543e[_0x87bb('0x33')][_0x87bb('0x35')]?_0x26543e[_0x87bb('0x33')]:_0x2e317d[_0x87bb('0x2e')];if(!_0x4b0bf5[_0x87bb('0x2f')][_0x87bb('0x36')]('nolimit')){_0x26543e[_0x87bb('0x1b')]=qs[_0x87bb('0x1b')](_0x4b0bf5[_0x87bb('0x2f')]['limit']);_0x26543e[_0x87bb('0x1a')]=qs[_0x87bb('0x1a')](_0x4b0bf5[_0x87bb('0x2f')][_0x87bb('0x1a')]);}_0x26543e[_0x87bb('0x37')]=qs[_0x87bb('0x38')](_0x4b0bf5[_0x87bb('0x2f')]['sort']);_0x26543e[_0x87bb('0x39')]=qs['filters'](_[_0x87bb('0x3a')](_0x4b0bf5[_0x87bb('0x2f')],_0x2e317d[_0x87bb('0x31')]),_0x4ad3de);if(_0x4b0bf5[_0x87bb('0x2f')][_0x87bb('0x3b')]){_0x26543e['where']=_[_0x87bb('0x3c')](_0x26543e[_0x87bb('0x39')],{'$or':_['map'](_0x4ad3de,function(_0x28a658){if(_0x28a658[_0x87bb('0x2d')]!==_0x87bb('0x3d')){var _0x2407ff={};_0x2407ff[_0x28a658[_0x87bb('0x27')]]={'$like':'%'+_0x4b0bf5[_0x87bb('0x2f')][_0x87bb('0x3b')]+'%'};return _0x2407ff;}})});}_0x26543e=_[_0x87bb('0x3c')]({},_0x26543e,_0x4b0bf5[_0x87bb('0x3e')]);var _0x4546a7={'where':_0x26543e[_0x87bb('0x39')]};return db[_0x87bb('0x2b')][_0x87bb('0x3f')](_0x4546a7)[_0x87bb('0x22')](function(_0x288575){_0x53f033[_0x87bb('0x3f')]=_0x288575;if(_0x4b0bf5['query']['includeAll']){_0x26543e[_0x87bb('0x40')]=[{'all':!![]}];}return db[_0x87bb('0x2b')]['findAll'](_0x26543e);})['then'](function(_0x1c0530){_0x53f033['rows']=_0x1c0530;return _0x53f033;})['then'](respondWithFilteredResult(_0x598530,_0x26543e))[_0x87bb('0x41')](handleError(_0x598530,null));};exports[_0x87bb('0x42')]=function(_0x50231c,_0x2e445e){var _0x4950ad={'raw':!![],'where':{'id':_0x50231c[_0x87bb('0x43')]['id']}},_0x92191b={};_0x92191b[_0x87bb('0x2e')]=_['keys'](db['CmContactHasPhone'][_0x87bb('0x44')]);_0x92191b[_0x87bb('0x2f')]=_[_0x87bb('0x30')](_0x50231c[_0x87bb('0x2f')]);_0x92191b[_0x87bb('0x31')]=_[_0x87bb('0x32')](_0x92191b[_0x87bb('0x2e')],_0x92191b[_0x87bb('0x2f')]);_0x4950ad[_0x87bb('0x33')]=_[_0x87bb('0x32')](_0x92191b[_0x87bb('0x2e')],qs[_0x87bb('0x34')](_0x50231c['query'][_0x87bb('0x34')]));_0x4950ad[_0x87bb('0x33')]=_0x4950ad[_0x87bb('0x33')]['length']?_0x4950ad[_0x87bb('0x33')]:_0x92191b[_0x87bb('0x2e')];if(_0x50231c[_0x87bb('0x2f')][_0x87bb('0x45')]){_0x4950ad[_0x87bb('0x40')]=[{'all':!![]}];}_0x4950ad=_[_0x87bb('0x3c')]({},_0x4950ad,_0x50231c[_0x87bb('0x3e')]);return db['CmContactHasPhone'][_0x87bb('0x46')](_0x4950ad)['then'](handleEntityNotFound(_0x2e445e,null))[_0x87bb('0x22')](respondWithResult(_0x2e445e,null))[_0x87bb('0x41')](handleError(_0x2e445e,null));};exports[_0x87bb('0x47')]=function(_0x400f4c,_0x527015){return db[_0x87bb('0x2b')][_0x87bb('0x47')](_0x400f4c[_0x87bb('0x48')],{})[_0x87bb('0x22')](function(_0x3da6cb){var _0x19c991=_0x400f4c[_0x87bb('0x49')][_0x87bb('0x23')]({'plain':!![]});if(!_0x19c991)throw new Error(_0x87bb('0x4a'));if(_0x19c991[_0x87bb('0x4b')]==='user'){var _0x540c38=_0x3da6cb[_0x87bb('0x23')]({'plain':!![]});var _0x2ed408='CmContactHasPhones';return db[_0x87bb('0x4c')][_0x87bb('0x46')]({'where':{'name':_0x2ed408,'userProfileId':_0x19c991[_0x87bb('0x4d')]},'raw':!![]})['then'](function(_0x30e579){if(_0x30e579&&_0x30e579[_0x87bb('0x4e')]===0x0){return db[_0x87bb('0x25')][_0x87bb('0x47')]({'name':_0x540c38[_0x87bb('0x27')],'resourceId':_0x540c38['id'],'type':_0x30e579[_0x87bb('0x27')],'sectionId':_0x30e579['id']},{})[_0x87bb('0x22')](function(){return _0x3da6cb;});}else{return _0x3da6cb;}})[_0x87bb('0x41')](function(_0x2a9691){logger[_0x87bb('0x26')](_0x87bb('0x4f'),_0x2a9691);throw _0x2a9691;});}return _0x3da6cb;})[_0x87bb('0x22')](respondWithResult(_0x527015,0xc9))[_0x87bb('0x41')](handleError(_0x527015,null));};exports[_0x87bb('0x20')]=function(_0x4c6136,_0x3c564e){if(_0x4c6136[_0x87bb('0x48')]['id']){delete _0x4c6136[_0x87bb('0x48')]['id'];}return db[_0x87bb('0x2b')][_0x87bb('0x46')]({'where':{'id':_0x4c6136[_0x87bb('0x43')]['id']}})['then'](handleEntityNotFound(_0x3c564e,null))['then'](saveUpdates(_0x4c6136[_0x87bb('0x48')],null))[_0x87bb('0x22')](respondWithResult(_0x3c564e,null))['catch'](handleError(_0x3c564e,null));};exports['destroy']=function(_0x524e24,_0x554fd1){return db[_0x87bb('0x2b')]['find']({'where':{'id':_0x524e24[_0x87bb('0x43')]['id']}})['then'](handleEntityNotFound(_0x554fd1,null))[_0x87bb('0x22')](removeEntity(_0x554fd1,null))[_0x87bb('0x41')](handleError(_0x554fd1,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 1e30c0f..4f7a466 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.model.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad36=['rimraf','../../config/environment','exports','define','CmContactHasPhone','cm_contact_has_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4c6cf0,_0x826f70){var _0x108145=function(_0x299f69){while(--_0x299f69){_0x4c6cf0['push'](_0x4c6cf0['shift']());}};_0x108145(++_0x826f70);}(_0xad36,0x1c6));var _0x6ad3=function(_0xbe51b8,_0x23240a){_0xbe51b8=_0xbe51b8-0x0;var _0x51eea1=_0xad36[_0xbe51b8];return _0x51eea1;};'use strict';var _=require(_0x6ad3('0x0'));var util=require(_0x6ad3('0x1'));var logger=require(_0x6ad3('0x2'))(_0x6ad3('0x3'));var moment=require(_0x6ad3('0x4'));var BPromise=require(_0x6ad3('0x5'));var rp=require(_0x6ad3('0x6'));var fs=require('fs');var path=require(_0x6ad3('0x7'));var rimraf=require(_0x6ad3('0x8'));var config=require(_0x6ad3('0x9'));var attributes=require('./cmContactHasPhone.attributes');module[_0x6ad3('0xa')]=function(_0x52f6ee,_0x48c394){return _0x52f6ee[_0x6ad3('0xb')](_0x6ad3('0xc'),attributes,{'tableName':_0x6ad3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbf1=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','define','CmContactHasPhone','cm_contact_has_phones','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbf1,0x1a3));var _0x1fbf=function(_0x46f07b,_0x2d4152){_0x46f07b=_0x46f07b-0x0;var _0x525815=_0xfbf1[_0x46f07b];return _0x525815;};'use strict';var _=require(_0x1fbf('0x0'));var util=require(_0x1fbf('0x1'));var logger=require(_0x1fbf('0x2'))(_0x1fbf('0x3'));var moment=require(_0x1fbf('0x4'));var BPromise=require(_0x1fbf('0x5'));var rp=require(_0x1fbf('0x6'));var fs=require('fs');var path=require(_0x1fbf('0x7'));var rimraf=require(_0x1fbf('0x8'));var config=require(_0x1fbf('0x9'));var attributes=require(_0x1fbf('0xa'));module[_0x1fbf('0xb')]=function(_0x22c09c,_0x52aafe){return _0x22c09c[_0x1fbf('0xc')](_0x1fbf('0xd'),attributes,{'tableName':_0x1fbf('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index f915c23..9bb6cf5 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8df7=['then','info','request\x20sent','debug','stringify','error','CmContactHasPhone,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x42dcc7,_0x3d1cde){var _0x3ecf8f=function(_0x4a1a87){while(--_0x4a1a87){_0x42dcc7['push'](_0x42dcc7['shift']());}};_0x3ecf8f(++_0x3d1cde);}(_0x8df7,0xfb));var _0x78df=function(_0x460fff,_0x2fb381){_0x460fff=_0x460fff-0x0;var _0x561c8e=_0x8df7[_0x460fff];return _0x561c8e;};'use strict';var _=require(_0x78df('0x0'));var util=require(_0x78df('0x1'));var moment=require(_0x78df('0x2'));var BPromise=require(_0x78df('0x3'));var rs=require(_0x78df('0x4'));var fs=require('fs');var Redis=require(_0x78df('0x5'));var db=require(_0x78df('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x78df('0x7'))(_0x78df('0x8'));var config=require(_0x78df('0x9'));var jayson=require(_0x78df('0xa'));var client=jayson[_0x78df('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1734b3,_0x554ef9,_0x17de8d){return new BPromise(function(_0x33a881,_0x58ee38){return client[_0x78df('0xc')](_0x1734b3,_0x17de8d)[_0x78df('0xd')](function(_0xc9a961){logger[_0x78df('0xe')]('CmContactHasPhone,\x20%s,\x20%s',_0x554ef9,_0x78df('0xf'));logger[_0x78df('0x10')]('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x554ef9,'request\x20sent',JSON[_0x78df('0x11')](_0xc9a961));if(_0xc9a961[_0x78df('0x12')]){if(_0xc9a961[_0x78df('0x12')]['code']===0x1f4){logger[_0x78df('0x12')](_0x78df('0x13'),_0x554ef9,_0xc9a961[_0x78df('0x12')][_0x78df('0x14')]);return _0x58ee38(_0xc9a961['error'][_0x78df('0x14')]);}logger[_0x78df('0x12')](_0x78df('0x13'),_0x554ef9,_0xc9a961[_0x78df('0x12')]['message']);return _0x33a881(_0xc9a961['error'][_0x78df('0x14')]);}else{logger[_0x78df('0xe')](_0x78df('0x13'),_0x554ef9,_0x78df('0xf'));_0x33a881(_0xc9a961[_0x78df('0x15')]['message']);}})['catch'](function(_0xa7c80f){logger[_0x78df('0x12')]('CmContactHasPhone,\x20%s,\x20%s',_0x554ef9,_0xa7c80f);_0x58ee38(_0xa7c80f);});});} \ No newline at end of file +var _0x95f7=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info','CmContactHasPhone,\x20%s,\x20%s','CmContactHasPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x27fa6b,_0x42da89){var _0x2197ce=function(_0x172d25){while(--_0x172d25){_0x27fa6b['push'](_0x27fa6b['shift']());}};_0x2197ce(++_0x42da89);}(_0x95f7,0x143));var _0x795f=function(_0x495207,_0x58f561){_0x495207=_0x495207-0x0;var _0x41cbf9=_0x95f7[_0x495207];return _0x41cbf9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x795f('0x0'));var BPromise=require(_0x795f('0x1'));var rs=require(_0x795f('0x2'));var fs=require('fs');var Redis=require(_0x795f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x795f('0x4'))(_0x795f('0x5'));var config=require('../../config/environment');var jayson=require(_0x795f('0x6'));var client=jayson['client'][_0x795f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xd693b6,_0x27bfd2,_0x6e5860){return new BPromise(function(_0x35539c,_0xeda01){return client[_0x795f('0x8')](_0xd693b6,_0x6e5860)[_0x795f('0x9')](function(_0x55fbe5){logger[_0x795f('0xa')](_0x795f('0xb'),_0x27bfd2,'request\x20sent');logger['debug'](_0x795f('0xc'),_0x27bfd2,_0x795f('0xd'),JSON[_0x795f('0xe')](_0x55fbe5));if(_0x55fbe5[_0x795f('0xf')]){if(_0x55fbe5['error'][_0x795f('0x10')]===0x1f4){logger['error']('CmContactHasPhone,\x20%s,\x20%s',_0x27bfd2,_0x55fbe5[_0x795f('0xf')][_0x795f('0x11')]);return _0xeda01(_0x55fbe5[_0x795f('0xf')][_0x795f('0x11')]);}logger[_0x795f('0xf')]('CmContactHasPhone,\x20%s,\x20%s',_0x27bfd2,_0x55fbe5[_0x795f('0xf')]['message']);return _0x35539c(_0x55fbe5['error']['message']);}else{logger[_0x795f('0xa')](_0x795f('0xb'),_0x27bfd2,_0x795f('0xd'));_0x35539c(_0x55fbe5['result'][_0x795f('0x11')]);}})[_0x795f('0x12')](function(_0x3d96d2){logger[_0x795f('0xf')]('CmContactHasPhone,\x20%s,\x20%s',_0x27bfd2,_0x3d96d2);_0xeda01(_0x3d96d2);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 4d6f81c..afb4063 100644 --- a/server/api/cmContactHasPhone/index.js +++ b/server/api/cmContactHasPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fb9=['express','Router','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','multer','util','connect-timeout'];(function(_0x5c05a7,_0x19e412){var _0x50386a=function(_0x40f934){while(--_0x40f934){_0x5c05a7['push'](_0x5c05a7['shift']());}};_0x50386a(++_0x19e412);}(_0x8fb9,0x12f));var _0x98fb=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0x8fb9[_0x39772f];return _0xc9edbf;};'use strict';var multer=require(_0x98fb('0x0'));var util=require(_0x98fb('0x1'));var path=require('path');var timeout=require(_0x98fb('0x2'));var express=require(_0x98fb('0x3'));var router=express[_0x98fb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x98fb('0x5'));var config=require(_0x98fb('0x6'));var controller=require(_0x98fb('0x7'));router[_0x98fb('0x8')]('/',auth[_0x98fb('0x9')](),controller[_0x98fb('0xa')]);router[_0x98fb('0x8')](_0x98fb('0xb'),auth[_0x98fb('0x9')](),controller[_0x98fb('0xc')]);router[_0x98fb('0xd')]('/',auth[_0x98fb('0x9')](),controller[_0x98fb('0xe')]);router['put'](_0x98fb('0xb'),auth['isAuthenticated'](),controller[_0x98fb('0xf')]);router[_0x98fb('0x10')](_0x98fb('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x64b4=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','/:id','isAuthenticated','show','post','put','destroy','multer'];(function(_0x556bc0,_0x58a802){var _0x2a3462=function(_0x228dcc){while(--_0x228dcc){_0x556bc0['push'](_0x556bc0['shift']());}};_0x2a3462(++_0x58a802);}(_0x64b4,0x68));var _0x464b=function(_0x3f732a,_0x1b9502){_0x3f732a=_0x3f732a-0x0;var _0x3ef490=_0x64b4[_0x3f732a];return _0x3ef490;};'use strict';var multer=require(_0x464b('0x0'));var util=require(_0x464b('0x1'));var path=require(_0x464b('0x2'));var timeout=require('connect-timeout');var express=require(_0x464b('0x3'));var router=express['Router']();var auth=require(_0x464b('0x4'));var interaction=require(_0x464b('0x5'));var config=require(_0x464b('0x6'));var controller=require(_0x464b('0x7'));router[_0x464b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x464b('0x8')](_0x464b('0x9'),auth[_0x464b('0xa')](),controller[_0x464b('0xb')]);router[_0x464b('0xc')]('/',auth[_0x464b('0xa')](),controller['create']);router[_0x464b('0xd')](_0x464b('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x464b('0x9'),auth[_0x464b('0xa')](),controller[_0x464b('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index aec246d..e00eaab 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 _0x6c4f=['name','STRING','long','type','select','parse','values','isArray','stringify','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue'];(function(_0x916a95,_0x3655d2){var _0x5b94b0=function(_0x49055e){while(--_0x49055e){_0x916a95['push'](_0x916a95['shift']());}};_0x5b94b0(++_0x3655d2);}(_0x6c4f,0x69));var _0xf6c4=function(_0x480948,_0x26934e){_0x480948=_0x480948-0x0;var _0x27e1ec=_0x6c4f[_0x480948];return _0x27e1ec;};'use strict';var Sequelize=require(_0xf6c4('0x0'));var _=require(_0xf6c4('0x1'));module[_0xf6c4('0x2')]={'name':{'type':Sequelize[_0xf6c4('0x3')],'get':function(_0x38dfa1){return this[_0xf6c4('0x4')](_0xf6c4('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x149d26){this[_0xf6c4('0x6')](_0xf6c4('0x5'),_0x149d26?_0x149d26:this['getDataValue'](_0xf6c4('0x7')));}},'type':{'type':Sequelize[_0xf6c4('0x8')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xf6c4('0x9')),'get':function(){if(this['getDataValue'](_0xf6c4('0xa'))===_0xf6c4('0xb')){return JSON[_0xf6c4('0xc')](this[_0xf6c4('0x4')](_0xf6c4('0xd')));}else{return this[_0xf6c4('0x4')]('values');}},'set':function(_0x8716fd){if(Array[_0xf6c4('0xe')](_0x8716fd)){this['setDataValue'](_0xf6c4('0xd'),JSON[_0xf6c4('0xf')](_0x8716fd));}else{this[_0xf6c4('0x6')]('values',_0x8716fd);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9263=['VIRTUAL','STRING','setDataValue','alias','name','TEXT','long','getDataValue','type','select','values','isArray','stringify','BOOLEAN','sequelize','lodash','exports'];(function(_0x513f8,_0x4df54c){var _0x5df9b0=function(_0x257ba2){while(--_0x257ba2){_0x513f8['push'](_0x513f8['shift']());}};_0x5df9b0(++_0x4df54c);}(_0x9263,0xc9));var _0x3926=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x9263[_0x38ced4];return _0x547c07;};'use strict';var Sequelize=require(_0x3926('0x0'));var _=require(_0x3926('0x1'));module[_0x3926('0x2')]={'name':{'type':Sequelize[_0x3926('0x3')],'get':function(_0x436f59){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x3926('0x4')],'allowNull':![],'set':function(_0x18b4e0){this[_0x3926('0x5')](_0x3926('0x6'),_0x18b4e0?_0x18b4e0:this['getDataValue'](_0x3926('0x7')));}},'type':{'type':Sequelize[_0x3926('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x3926('0x8')](_0x3926('0x9')),'get':function(){if(this[_0x3926('0xa')](_0x3926('0xb'))===_0x3926('0xc')){return JSON['parse'](this[_0x3926('0xa')](_0x3926('0xd')));}else{return this[_0x3926('0xa')](_0x3926('0xd'));}},'set':function(_0x3553eb){if(Array[_0x3926('0xe')](_0x3553eb)){this[_0x3926('0x5')](_0x3926('0xd'),JSON[_0x3926('0xf')](_0x3553eb));}else{this[_0x3926('0x5')](_0x3926('0xd'),_0x3553eb);}}},'required':{'type':Sequelize[_0x3926('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 012436d..3be5a56 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 _0x538a=['where','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','find','catch','body','destroy','create','sequelize','transaction','Sequelize','TEXT','type','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','rimraf','fast-json-patch','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','stack','name','CmCustomField','rawAttributes','fieldName','key','differenceBy','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x2c3a8f,_0x374e56){var _0x189412=function(_0x560055){while(--_0x560055){_0x2c3a8f['push'](_0x2c3a8f['shift']());}};_0x189412(++_0x374e56);}(_0x538a,0x69));var _0xa538=function(_0x5d76b5,_0x49d055){_0x5d76b5=_0x5d76b5-0x0;var _0x1c4361=_0x538a[_0x5d76b5];return _0x1c4361;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa538('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa538('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa538('0x2'));var util=require(_0xa538('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xa538('0x4'));var ejs=require(_0xa538('0x5'));var fs=require('fs');var _=require(_0xa538('0x6'));var squel=require(_0xa538('0x7'));var crypto=require(_0xa538('0x8'));var jsforce=require(_0xa538('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa538('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa538('0xb'));var qs=require(_0xa538('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa538('0xd'));var logger=require(_0xa538('0xe'))(_0xa538('0xf'));var utils=require('../../config/utils');var config=require(_0xa538('0x10'));var db=require(_0xa538('0x11'))['db'];function respondWithStatusCode(_0x35c72c,_0x5ca4f8){_0x5ca4f8=_0x5ca4f8||0xcc;return function(_0x1b364f){if(_0x1b364f){return _0x35c72c[_0xa538('0x12')](_0x5ca4f8);}return _0x35c72c[_0xa538('0x13')](_0x5ca4f8)[_0xa538('0x14')]();};}function respondWithResult(_0x135a25,_0x82b381){_0x82b381=_0x82b381||0xc8;return function(_0x3f0476){if(_0x3f0476){return _0x135a25[_0xa538('0x13')](_0x82b381)[_0xa538('0x15')](_0x3f0476);}};}function respondWithFilteredResult(_0x2aae2b,_0x4237a2){return function(_0x52e168){if(_0x52e168){var _0x38e70=_0x52e168[_0xa538('0x16')],_0x28e215=_0x4237a2[_0xa538('0x17')],_0x1d2c44=_0x4237a2[_0xa538('0x17')]+_0x4237a2[_0xa538('0x18')],_0x2d2876;if(_0x1d2c44>=_0x38e70){_0x1d2c44=_0x38e70;_0x2d2876=0xc8;}else{_0x2d2876=0xce;}_0x2aae2b['status'](_0x2d2876);return _0x2aae2b[_0xa538('0x19')]('Content-Range',_0x28e215+'-'+_0x1d2c44+'/'+_0x38e70)[_0xa538('0x15')](_0x52e168);}return null;};}function patchUpdates(_0x7c47f9){return function(_0x54fcd2){try{jsonpatch[_0xa538('0x1a')](_0x54fcd2,_0x7c47f9,!![]);}catch(_0xd4dde6){return BPromise['reject'](_0xd4dde6);}return _0x54fcd2[_0xa538('0x1b')]();};}function saveUpdates(_0x11a314,_0x5c9398){return function(_0x3dab7c){if(_0x3dab7c){return _0x3dab7c[_0xa538('0x1c')](_0x11a314)[_0xa538('0x1d')](function(_0x19c123){return _0x19c123;});}return null;};}function removeEntity(_0xc6116b,_0x144471){return function(_0x22346f){if(_0x22346f){return _0x22346f['destroy']()[_0xa538('0x1d')](function(){_0xc6116b[_0xa538('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbf780f,_0x353627){return function(_0x4b63ee){if(!_0x4b63ee){_0xbf780f[_0xa538('0x12')](0x194);}return _0x4b63ee;};}function handleError(_0xb62c53,_0x513202){_0x513202=_0x513202||0x1f4;return function(_0x58bb57){logger['error'](_0x58bb57[_0xa538('0x1e')]);if(_0x58bb57[_0xa538('0x1f')]){delete _0x58bb57['name'];}_0xb62c53[_0xa538('0x13')](_0x513202)['send'](_0x58bb57);};}exports['index']=function(_0x215f46,_0x3b337a){var _0x1ad44a={},_0xceb00={},_0x457871={'count':0x0,'rows':[]};var _0x32b8af=_['map'](db[_0xa538('0x20')][_0xa538('0x21')],function(_0x4ec22d){return{'name':_0x4ec22d[_0xa538('0x22')],'type':_0x4ec22d['type'][_0xa538('0x23')]};});_0xceb00['model']=_[_0xa538('0x24')](_[_0xa538('0x25')](_0x32b8af,'name'),[_0xa538('0x1f')]);_0xceb00['query']=_[_0xa538('0x26')](_0x215f46[_0xa538('0x27')]);_0xceb00[_0xa538('0x28')]=_[_0xa538('0x29')](_0xceb00[_0xa538('0x2a')],_0xceb00[_0xa538('0x27')]);_0x1ad44a[_0xa538('0x2b')]=_[_0xa538('0x29')](_0xceb00[_0xa538('0x2a')],qs[_0xa538('0x2c')](_0x215f46[_0xa538('0x27')]['fields']));_0x1ad44a[_0xa538('0x2b')]=_0x1ad44a[_0xa538('0x2b')][_0xa538('0x2d')]?_0x1ad44a['attributes']:_0xceb00[_0xa538('0x2a')];if(!_0x215f46['query'][_0xa538('0x2e')]('nolimit')){_0x1ad44a[_0xa538('0x18')]=qs[_0xa538('0x18')](_0x215f46['query'][_0xa538('0x18')]);_0x1ad44a['offset']=qs[_0xa538('0x17')](_0x215f46[_0xa538('0x27')][_0xa538('0x17')]);}_0x1ad44a[_0xa538('0x2f')]=qs['sort'](_0x215f46['query'][_0xa538('0x30')]);_0x1ad44a[_0xa538('0x31')]=qs[_0xa538('0x28')](_[_0xa538('0x32')](_0x215f46[_0xa538('0x27')],_0xceb00[_0xa538('0x28')]),_0x32b8af);if(_0x215f46[_0xa538('0x27')]['filter']){_0x1ad44a[_0xa538('0x31')]=_[_0xa538('0x33')](_0x1ad44a[_0xa538('0x31')],{'$or':_[_0xa538('0x25')](_0x32b8af,function(_0x103857){if(_0x103857['type']!=='VIRTUAL'){var _0x30cbd1={};_0x30cbd1[_0x103857[_0xa538('0x1f')]]={'$like':'%'+_0x215f46[_0xa538('0x27')][_0xa538('0x34')]+'%'};return _0x30cbd1;}})});}_0x1ad44a=_['merge']({},_0x1ad44a,_0x215f46[_0xa538('0x35')]);var _0x577db2={'where':_0x1ad44a[_0xa538('0x31')]};return db[_0xa538('0x20')][_0xa538('0x16')](_0x577db2)[_0xa538('0x1d')](function(_0x297b60){_0x457871['count']=_0x297b60;if(_0x215f46[_0xa538('0x27')][_0xa538('0x36')]){_0x1ad44a[_0xa538('0x37')]=[{'all':!![]}];}return db[_0xa538('0x20')][_0xa538('0x38')](_0x1ad44a);})[_0xa538('0x1d')](function(_0xf8ddd8){_0x457871[_0xa538('0x39')]=_0xf8ddd8;return _0x457871;})[_0xa538('0x1d')](respondWithFilteredResult(_0x3b337a,_0x1ad44a))['catch'](handleError(_0x3b337a,null));};exports[_0xa538('0x3a')]=function(_0x5d0220,_0x4abaa0){var _0x46a3f6={'raw':!![],'where':{'id':_0x5d0220[_0xa538('0x3b')]['id']}},_0x2e9e15={};_0x2e9e15['model']=_[_0xa538('0x26')](db['CmCustomField'][_0xa538('0x21')]);_0x2e9e15['query']=_[_0xa538('0x26')](_0x5d0220['query']);_0x2e9e15['filters']=_['intersection'](_0x2e9e15[_0xa538('0x2a')],_0x2e9e15[_0xa538('0x27')]);_0x46a3f6[_0xa538('0x2b')]=_[_0xa538('0x29')](_0x2e9e15['model'],qs[_0xa538('0x2c')](_0x5d0220[_0xa538('0x27')][_0xa538('0x2c')]));_0x46a3f6[_0xa538('0x2b')]=_0x46a3f6[_0xa538('0x2b')][_0xa538('0x2d')]?_0x46a3f6['attributes']:_0x2e9e15[_0xa538('0x2a')];if(_0x5d0220[_0xa538('0x27')]['includeAll']){_0x46a3f6['include']=[{'all':!![]}];}_0x46a3f6=_[_0xa538('0x33')]({},_0x46a3f6,_0x5d0220[_0xa538('0x35')]);return db[_0xa538('0x20')][_0xa538('0x3c')](_0x46a3f6)[_0xa538('0x1d')](handleEntityNotFound(_0x4abaa0,null))[_0xa538('0x1d')](respondWithResult(_0x4abaa0,null))[_0xa538('0x3d')](handleError(_0x4abaa0,null));};exports['update']=function(_0x3ea5ab,_0x2fb21d){if(_0x3ea5ab[_0xa538('0x3e')]['id']){delete _0x3ea5ab[_0xa538('0x3e')]['id'];}return db[_0xa538('0x20')][_0xa538('0x3c')]({'where':{'id':_0x3ea5ab[_0xa538('0x3b')]['id']}})[_0xa538('0x1d')](handleEntityNotFound(_0x2fb21d,null))['then'](saveUpdates(_0x3ea5ab[_0xa538('0x3e')],null))[_0xa538('0x1d')](respondWithResult(_0x2fb21d,null))[_0xa538('0x3d')](handleError(_0x2fb21d,null));};exports[_0xa538('0x3f')]=function(_0x594b2e,_0x4a66b0){return db[_0xa538('0x20')][_0xa538('0x3c')]({'where':{'id':_0x594b2e['params']['id']}})[_0xa538('0x1d')](handleEntityNotFound(_0x4a66b0,null))[_0xa538('0x1d')](removeEntity(_0x4a66b0,null))[_0xa538('0x3d')](handleError(_0x4a66b0,null));};exports[_0xa538('0x40')]=function(_0x4613a7,_0x25c5d7){var _0x497cba;return db[_0xa538('0x41')][_0xa538('0x42')](function(_0x26a307){return db[_0xa538('0x20')][_0xa538('0x40')](_0x4613a7['body'],{'transaction':_0x26a307})[_0xa538('0x1d')](function(_0x175352){_0x497cba=_0x175352;var _0x462ef5={'type':db[_0xa538('0x43')][_0xa538('0x44')],'transaction':_0x26a307};switch(_0x4613a7['body'][_0xa538('0x45')]){case _0xa538('0x46'):_0x462ef5[_0xa538('0x45')]=db[_0xa538('0x43')][_0xa538('0x44')];break;case'number':_0x462ef5[_0xa538('0x45')]=db[_0xa538('0x43')][_0xa538('0x47')];break;case _0xa538('0x48'):_0x462ef5[_0xa538('0x45')]=db[_0xa538('0x43')][_0xa538('0x49')];_0x462ef5[_0xa538('0x4a')]=![];break;default:}return db[_0xa538('0x41')][_0xa538('0x4b')][_0xa538('0x4c')]('cm_contacts',util['format']('cf_%d',_0x497cba['id']),_0x462ef5);})[_0xa538('0x1d')](function(){return _0x497cba;});})[_0xa538('0x1d')](respondWithResult(_0x25c5d7,0xc9))['catch'](handleError(_0x25c5d7,null));}; \ No newline at end of file +var _0xe736=['html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','index','map','CmCustomField','rawAttributes','fieldName','differenceBy','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','update','find','body','create','sequelize','transaction','Sequelize','TEXT','type','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%d'];(function(_0x56375d,_0x5401d7){var _0x5d9446=function(_0x7ea37a){while(--_0x7ea37a){_0x56375d['push'](_0x56375d['shift']());}};_0x5d9446(++_0x5401d7);}(_0xe736,0x14c));var _0x6e73=function(_0x428abc,_0x1afe32){_0x428abc=_0x428abc-0x0;var _0x4064c1=_0xe736[_0x428abc];return _0x4064c1;};'use strict';var pdf=require(_0x6e73('0x0'));var emlformat=require(_0x6e73('0x1'));var rimraf=require(_0x6e73('0x2'));var zipdir=require(_0x6e73('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6e73('0x4'));var BPromise=require(_0x6e73('0x5'));var Mustache=require(_0x6e73('0x6'));var util=require('util');var path=require(_0x6e73('0x7'));var sox=require('sox');var csv=require(_0x6e73('0x8'));var ejs=require(_0x6e73('0x9'));var fs=require('fs');var _=require(_0x6e73('0xa'));var squel=require(_0x6e73('0xb'));var crypto=require(_0x6e73('0xc'));var jsforce=require(_0x6e73('0xd'));var deskjs=require(_0x6e73('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6e73('0xf'));var Papa=require(_0x6e73('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(_0x6e73('0x11'));var logger=require(_0x6e73('0x12'))(_0x6e73('0x13'));var utils=require(_0x6e73('0x14'));var config=require('../../config/environment');var db=require(_0x6e73('0x15'))['db'];function respondWithStatusCode(_0x4de718,_0x533808){_0x533808=_0x533808||0xcc;return function(_0x2694d7){if(_0x2694d7){return _0x4de718[_0x6e73('0x16')](_0x533808);}return _0x4de718[_0x6e73('0x17')](_0x533808)['end']();};}function respondWithResult(_0x5ec7a8,_0x575f90){_0x575f90=_0x575f90||0xc8;return function(_0x479377){if(_0x479377){return _0x5ec7a8[_0x6e73('0x17')](_0x575f90)[_0x6e73('0x18')](_0x479377);}};}function respondWithFilteredResult(_0x39fca2,_0x3a94a9){return function(_0x3c4f16){if(_0x3c4f16){var _0x37fec4=_0x3c4f16['count'],_0x1986ac=_0x3a94a9[_0x6e73('0x19')],_0xe8497a=_0x3a94a9[_0x6e73('0x19')]+_0x3a94a9[_0x6e73('0x1a')],_0x1bbbcc;if(_0xe8497a>=_0x37fec4){_0xe8497a=_0x37fec4;_0x1bbbcc=0xc8;}else{_0x1bbbcc=0xce;}_0x39fca2[_0x6e73('0x17')](_0x1bbbcc);return _0x39fca2[_0x6e73('0x1b')](_0x6e73('0x1c'),_0x1986ac+'-'+_0xe8497a+'/'+_0x37fec4)[_0x6e73('0x18')](_0x3c4f16);}return null;};}function patchUpdates(_0x1c6606){return function(_0x121b5e){try{jsonpatch['apply'](_0x121b5e,_0x1c6606,!![]);}catch(_0x48b1b9){return BPromise[_0x6e73('0x1d')](_0x48b1b9);}return _0x121b5e[_0x6e73('0x1e')]();};}function saveUpdates(_0x548ae3,_0x5927ef){return function(_0x399fd4){if(_0x399fd4){return _0x399fd4['update'](_0x548ae3)[_0x6e73('0x1f')](function(_0x21df78){return _0x21df78;});}return null;};}function removeEntity(_0x550d4f,_0x112179){return function(_0x2ea26b){if(_0x2ea26b){return _0x2ea26b[_0x6e73('0x20')]()[_0x6e73('0x1f')](function(){_0x550d4f[_0x6e73('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x561545,_0x39abe7){return function(_0x886515){if(!_0x886515){_0x561545[_0x6e73('0x16')](0x194);}return _0x886515;};}function handleError(_0x4b51b4,_0x48c1e1){_0x48c1e1=_0x48c1e1||0x1f4;return function(_0x2dc31d){logger['error'](_0x2dc31d['stack']);if(_0x2dc31d[_0x6e73('0x21')]){delete _0x2dc31d[_0x6e73('0x21')];}_0x4b51b4[_0x6e73('0x17')](_0x48c1e1)[_0x6e73('0x22')](_0x2dc31d);};}exports[_0x6e73('0x23')]=function(_0x387512,_0x17b263){var _0xc6095d={},_0x37a6f6={},_0x18b1f9={'count':0x0,'rows':[]};var _0x180f96=_[_0x6e73('0x24')](db[_0x6e73('0x25')][_0x6e73('0x26')],function(_0x138b72){return{'name':_0x138b72[_0x6e73('0x27')],'type':_0x138b72['type']['key']};});_0x37a6f6['model']=_[_0x6e73('0x28')](_['map'](_0x180f96,_0x6e73('0x21')),[_0x6e73('0x21')]);_0x37a6f6['query']=_[_0x6e73('0x29')](_0x387512[_0x6e73('0x2a')]);_0x37a6f6[_0x6e73('0x2b')]=_['intersection'](_0x37a6f6[_0x6e73('0x2c')],_0x37a6f6[_0x6e73('0x2a')]);_0xc6095d['attributes']=_[_0x6e73('0x2d')](_0x37a6f6[_0x6e73('0x2c')],qs['fields'](_0x387512[_0x6e73('0x2a')][_0x6e73('0x2e')]));_0xc6095d[_0x6e73('0x2f')]=_0xc6095d[_0x6e73('0x2f')][_0x6e73('0x30')]?_0xc6095d['attributes']:_0x37a6f6[_0x6e73('0x2c')];if(!_0x387512[_0x6e73('0x2a')][_0x6e73('0x31')](_0x6e73('0x32'))){_0xc6095d[_0x6e73('0x1a')]=qs[_0x6e73('0x1a')](_0x387512['query'][_0x6e73('0x1a')]);_0xc6095d['offset']=qs[_0x6e73('0x19')](_0x387512[_0x6e73('0x2a')][_0x6e73('0x19')]);}_0xc6095d[_0x6e73('0x33')]=qs[_0x6e73('0x34')](_0x387512[_0x6e73('0x2a')][_0x6e73('0x34')]);_0xc6095d[_0x6e73('0x35')]=qs['filters'](_['pick'](_0x387512[_0x6e73('0x2a')],_0x37a6f6[_0x6e73('0x2b')]),_0x180f96);if(_0x387512[_0x6e73('0x2a')][_0x6e73('0x36')]){_0xc6095d[_0x6e73('0x35')]=_[_0x6e73('0x37')](_0xc6095d[_0x6e73('0x35')],{'$or':_['map'](_0x180f96,function(_0x3a4e12){if(_0x3a4e12['type']!==_0x6e73('0x38')){var _0x528f06={};_0x528f06[_0x3a4e12['name']]={'$like':'%'+_0x387512['query']['filter']+'%'};return _0x528f06;}})});}_0xc6095d=_['merge']({},_0xc6095d,_0x387512[_0x6e73('0x39')]);var _0x279367={'where':_0xc6095d['where']};return db['CmCustomField'][_0x6e73('0x3a')](_0x279367)[_0x6e73('0x1f')](function(_0x5d900a){_0x18b1f9[_0x6e73('0x3a')]=_0x5d900a;if(_0x387512[_0x6e73('0x2a')][_0x6e73('0x3b')]){_0xc6095d[_0x6e73('0x3c')]=[{'all':!![]}];}return db[_0x6e73('0x25')][_0x6e73('0x3d')](_0xc6095d);})[_0x6e73('0x1f')](function(_0x51c693){_0x18b1f9[_0x6e73('0x3e')]=_0x51c693;return _0x18b1f9;})[_0x6e73('0x1f')](respondWithFilteredResult(_0x17b263,_0xc6095d))[_0x6e73('0x3f')](handleError(_0x17b263,null));};exports[_0x6e73('0x40')]=function(_0x4a47fd,_0x55e095){var _0x3d87ce={'raw':!![],'where':{'id':_0x4a47fd[_0x6e73('0x41')]['id']}},_0x3e7719={};_0x3e7719[_0x6e73('0x2c')]=_[_0x6e73('0x29')](db['CmCustomField']['rawAttributes']);_0x3e7719[_0x6e73('0x2a')]=_[_0x6e73('0x29')](_0x4a47fd[_0x6e73('0x2a')]);_0x3e7719['filters']=_['intersection'](_0x3e7719[_0x6e73('0x2c')],_0x3e7719[_0x6e73('0x2a')]);_0x3d87ce['attributes']=_['intersection'](_0x3e7719[_0x6e73('0x2c')],qs[_0x6e73('0x2e')](_0x4a47fd['query']['fields']));_0x3d87ce['attributes']=_0x3d87ce[_0x6e73('0x2f')][_0x6e73('0x30')]?_0x3d87ce[_0x6e73('0x2f')]:_0x3e7719[_0x6e73('0x2c')];if(_0x4a47fd[_0x6e73('0x2a')]['includeAll']){_0x3d87ce[_0x6e73('0x3c')]=[{'all':!![]}];}_0x3d87ce=_['merge']({},_0x3d87ce,_0x4a47fd['options']);return db[_0x6e73('0x25')]['find'](_0x3d87ce)[_0x6e73('0x1f')](handleEntityNotFound(_0x55e095,null))[_0x6e73('0x1f')](respondWithResult(_0x55e095,null))[_0x6e73('0x3f')](handleError(_0x55e095,null));};exports[_0x6e73('0x42')]=function(_0x423cde,_0x3ef7a4){if(_0x423cde['body']['id']){delete _0x423cde['body']['id'];}return db[_0x6e73('0x25')][_0x6e73('0x43')]({'where':{'id':_0x423cde['params']['id']}})['then'](handleEntityNotFound(_0x3ef7a4,null))[_0x6e73('0x1f')](saveUpdates(_0x423cde[_0x6e73('0x44')],null))[_0x6e73('0x1f')](respondWithResult(_0x3ef7a4,null))[_0x6e73('0x3f')](handleError(_0x3ef7a4,null));};exports[_0x6e73('0x20')]=function(_0x5e9aa8,_0x1d10a8){return db['CmCustomField'][_0x6e73('0x43')]({'where':{'id':_0x5e9aa8[_0x6e73('0x41')]['id']}})[_0x6e73('0x1f')](handleEntityNotFound(_0x1d10a8,null))['then'](removeEntity(_0x1d10a8,null))[_0x6e73('0x3f')](handleError(_0x1d10a8,null));};exports[_0x6e73('0x45')]=function(_0x185b68,_0x1b6590){var _0x3357ae;return db[_0x6e73('0x46')][_0x6e73('0x47')](function(_0x52c321){return db[_0x6e73('0x25')][_0x6e73('0x45')](_0x185b68[_0x6e73('0x44')],{'transaction':_0x52c321})[_0x6e73('0x1f')](function(_0x9567a4){_0x3357ae=_0x9567a4;var _0x11e4c0={'type':db[_0x6e73('0x48')][_0x6e73('0x49')],'transaction':_0x52c321};switch(_0x185b68['body'][_0x6e73('0x4a')]){case _0x6e73('0x4b'):_0x11e4c0[_0x6e73('0x4a')]=db['Sequelize']['TEXT'];break;case _0x6e73('0x4c'):_0x11e4c0[_0x6e73('0x4a')]=db[_0x6e73('0x48')][_0x6e73('0x4d')];break;case _0x6e73('0x4e'):_0x11e4c0[_0x6e73('0x4a')]=db[_0x6e73('0x48')]['BOOLEAN'];_0x11e4c0[_0x6e73('0x4f')]=![];break;default:}return db['sequelize'][_0x6e73('0x50')][_0x6e73('0x51')]('cm_contacts',util['format'](_0x6e73('0x52'),_0x3357ae['id']),_0x11e4c0);})[_0x6e73('0x1f')](function(){return _0x3357ae;});})['then'](respondWithResult(_0x1b6590,0xc9))[_0x6e73('0x3f')](handleError(_0x1b6590,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 8a9a479..bda9c43 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 _0x5360=['define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x4ffed8,_0x11f581){var _0x595563=function(_0x57115a){while(--_0x57115a){_0x4ffed8['push'](_0x4ffed8['shift']());}};_0x595563(++_0x11f581);}(_0x5360,0x157));var _0x0536=function(_0x3f1b99,_0x2f2a2e){_0x3f1b99=_0x3f1b99-0x0;var _0x4bb708=_0x5360[_0x3f1b99];return _0x4bb708;};'use strict';var _=require(_0x0536('0x0'));var util=require(_0x0536('0x1'));var logger=require(_0x0536('0x2'))(_0x0536('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0536('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0536('0x5'));var config=require(_0x0536('0x6'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x4fc885,_0x459432){return _0x4fc885[_0x0536('0x7')](_0x0536('0x8'),attributes,{'tableName':_0x0536('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ffc=['./cmCustomField.attributes','exports','define','cm_custom_fields','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5d2507,_0x556fac){var _0x198c07=function(_0x2e2b6b){while(--_0x2e2b6b){_0x5d2507['push'](_0x5d2507['shift']());}};_0x198c07(++_0x556fac);}(_0x0ffc,0x9e));var _0xc0ff=function(_0x3fe000,_0x1582ec){_0x3fe000=_0x3fe000-0x0;var _0x4da745=_0x0ffc[_0x3fe000];return _0x4da745;};'use strict';var _=require('lodash');var util=require(_0xc0ff('0x0'));var logger=require(_0xc0ff('0x1'))('api');var moment=require(_0xc0ff('0x2'));var BPromise=require('bluebird');var rp=require(_0xc0ff('0x3'));var fs=require('fs');var path=require(_0xc0ff('0x4'));var rimraf=require(_0xc0ff('0x5'));var config=require(_0xc0ff('0x6'));var attributes=require(_0xc0ff('0x7'));module[_0xc0ff('0x8')]=function(_0x2fe7a2,_0x1b69a1){return _0x2fe7a2[_0xc0ff('0x9')]('CmCustomField',attributes,{'tableName':_0xc0ff('0xa'),'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 9325815..5b7c0c1 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 _0xc3b5=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x7a319d,_0x235959){var _0x5c6b4e=function(_0x2e5b17){while(--_0x2e5b17){_0x7a319d['push'](_0x7a319d['shift']());}};_0x5c6b4e(++_0x235959);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x5d4448,_0x2a9a90){_0x5d4448=_0x5d4448-0x0;var _0x127b24=_0xc3b5[_0x5d4448];return _0x127b24;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5c3b('0x0'));var BPromise=require(_0x5c3b('0x1'));var rs=require(_0x5c3b('0x2'));var fs=require('fs');var Redis=require(_0x5c3b('0x3'));var db=require(_0x5c3b('0x4'))['db'];var utils=require(_0x5c3b('0x5'));var logger=require(_0x5c3b('0x6'))(_0x5c3b('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c3b('0x8'));var client=jayson[_0x5c3b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x568a28,_0x30a08f,_0x420839){return new BPromise(function(_0x3892ad,_0x5be9ee){return client[_0x5c3b('0xa')](_0x568a28,_0x420839)[_0x5c3b('0xb')](function(_0x159db5){logger[_0x5c3b('0xc')]('CmCustomField,\x20%s,\x20%s',_0x30a08f,_0x5c3b('0xd'));logger[_0x5c3b('0xe')](_0x5c3b('0xf'),_0x30a08f,_0x5c3b('0xd'),JSON[_0x5c3b('0x10')](_0x159db5));if(_0x159db5['error']){if(_0x159db5[_0x5c3b('0x11')][_0x5c3b('0x12')]===0x1f4){logger['error'](_0x5c3b('0x13'),_0x30a08f,_0x159db5[_0x5c3b('0x11')]['message']);return _0x5be9ee(_0x159db5[_0x5c3b('0x11')][_0x5c3b('0x14')]);}logger[_0x5c3b('0x11')](_0x5c3b('0x13'),_0x30a08f,_0x159db5[_0x5c3b('0x11')][_0x5c3b('0x14')]);return _0x3892ad(_0x159db5[_0x5c3b('0x11')]['message']);}else{logger[_0x5c3b('0xc')]('CmCustomField,\x20%s,\x20%s',_0x30a08f,'request\x20sent');_0x3892ad(_0x159db5[_0x5c3b('0x15')][_0x5c3b('0x14')]);}})[_0x5c3b('0x16')](function(_0x589797){logger[_0x5c3b('0x11')](_0x5c3b('0x13'),_0x30a08f,_0x589797);_0x5be9ee(_0x589797);});});} \ No newline at end of file +var _0xe5b3=['request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmCustomField,\x20%s,\x20%s'];(function(_0x4144c0,_0x253e2b){var _0x424d45=function(_0x5f1644){while(--_0x5f1644){_0x4144c0['push'](_0x4144c0['shift']());}};_0x424d45(++_0x253e2b);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3760f1,_0x498373){_0x3760f1=_0x3760f1-0x0;var _0x14d886=_0xe5b3[_0x3760f1];return _0x14d886;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('CmCustomField,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('CmCustomField,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index f9960ae..683567d 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 _0x2c64=['../../components/auth/service','./cmCustomField.controller','get','isAuthenticated','show','post','create','/:id','update','exports','multer','util','connect-timeout','express','Router'];(function(_0x53f8f5,_0x129002){var _0x17b128=function(_0x363aa9){while(--_0x363aa9){_0x53f8f5['push'](_0x53f8f5['shift']());}};_0x17b128(++_0x129002);}(_0x2c64,0x181));var _0x42c6=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x2c64[_0x341e0f];return _0x59555a;};'use strict';var multer=require(_0x42c6('0x0'));var util=require(_0x42c6('0x1'));var path=require('path');var timeout=require(_0x42c6('0x2'));var express=require(_0x42c6('0x3'));var router=express[_0x42c6('0x4')]();var auth=require(_0x42c6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x42c6('0x6'));router[_0x42c6('0x7')]('/',auth[_0x42c6('0x8')](),controller['index']);router['get']('/:id',auth[_0x42c6('0x8')](),controller[_0x42c6('0x9')]);router[_0x42c6('0xa')]('/',auth[_0x42c6('0x8')](),controller[_0x42c6('0xb')]);router['put'](_0x42c6('0xc'),auth[_0x42c6('0x8')](),controller[_0x42c6('0xd')]);router['delete'](_0x42c6('0xc'),auth[_0x42c6('0x8')](),controller['destroy']);module[_0x42c6('0xe')]=router; \ No newline at end of file +var _0x194f=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','post','create','put','/:id'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0x194f,0x188));var _0xf194=function(_0xa7f826,_0x508057){_0xa7f826=_0xa7f826-0x0;var _0x199210=_0x194f[_0xa7f826];return _0x199210;};'use strict';var multer=require(_0xf194('0x0'));var util=require(_0xf194('0x1'));var path=require('path');var timeout=require(_0xf194('0x2'));var express=require(_0xf194('0x3'));var router=express[_0xf194('0x4')]();var auth=require(_0xf194('0x5'));var interaction=require(_0xf194('0x6'));var config=require(_0xf194('0x7'));var controller=require(_0xf194('0x8'));router[_0xf194('0x9')]('/',auth[_0xf194('0xa')](),controller[_0xf194('0xb')]);router[_0xf194('0x9')]('/:id',auth[_0xf194('0xa')](),controller['show']);router[_0xf194('0xc')]('/',auth['isAuthenticated'](),controller[_0xf194('0xd')]);router[_0xf194('0xe')](_0xf194('0xf'),auth[_0xf194('0xa')](),controller['update']);router['delete'](_0xf194('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xf194('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 244e61d..4be07a4 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 _0x2675=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','moment','BOOLEAN','DATE'];(function(_0x15380b,_0x3fe355){var _0x2c3048=function(_0x27c206){while(--_0x27c206){_0x15380b['push'](_0x15380b['shift']());}};_0x2c3048(++_0x3fe355);}(_0x2675,0x75));var _0x5267=function(_0x162f28,_0x19d00b){_0x162f28=_0x162f28-0x0;var _0x1d68fc=_0x2675[_0x162f28];return _0x1d68fc;};'use strict';var moment=require(_0x5267('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x5267('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5267('0x2')],'defaultValue':moment()['format'](_0x5267('0x3'))},'countbusyretry':{'type':Sequelize[_0x5267('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5267('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x5267('0x1')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5267('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5267('0x2')]},'priority':{'type':Sequelize[_0x5267('0x4')](0x2)[_0x5267('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x5267('0x4')],'unique':_0x5267('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x5267('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x5267('0x4')],'unique':_0x5267('0x7')},'CampaignId':{'type':Sequelize[_0x5267('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5267('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5267('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5267('0x5')]}}; \ No newline at end of file +var _0x4819=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE'];(function(_0x17003a,_0x42e742){var _0xceb4a1=function(_0x3e2675){while(--_0x3e2675){_0x17003a['push'](_0x17003a['shift']());}};_0xceb4a1(++_0x42e742);}(_0x4819,0xcd));var _0x9481=function(_0xb4947e,_0x39de27){_0xb4947e=_0xb4947e-0x0;var _0x2af6df=_0x4819[_0xb4947e];return _0x2af6df;};'use strict';var moment=require('moment');var Sequelize=require(_0x9481('0x0'));module[_0x9481('0x1')]={'phone':{'type':Sequelize[_0x9481('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x9481('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9481('0x4')],'defaultValue':moment()[_0x9481('0x5')](_0x9481('0x6'))},'countbusyretry':{'type':Sequelize[_0x9481('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9481('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9481('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9481('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x9481('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9481('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9481('0x7')],'unique':_0x9481('0x9')},'ListId':{'type':Sequelize[_0x9481('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x9481('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x9481('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x9481('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9481('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9481('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9481('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9481('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9481('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index bc87920..9f2847b 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 _0x1e48=['DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','LOCK','Contact','CmCompany','CmList','List','Queue','dialActive','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/environment','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','$and','$or','$gt','$gte','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$any','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','show','params','length','options','find','catch','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','createdAt','state','statedesc','deleted','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','sequelize','transaction','direction','prev','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','ASC'];(function(_0x19cfe5,_0x4d1bcf){var _0x15b837=function(_0x2552e4){while(--_0x2552e4){_0x19cfe5['push'](_0x19cfe5['shift']());}};_0x15b837(++_0x4d1bcf);}(_0x1e48,0x139));var _0x81e4=function(_0x2577d9,_0x8f2f28){_0x2577d9=_0x2577d9-0x0;var _0x36fe58=_0x1e48[_0x2577d9];return _0x36fe58;};'use strict';var pdf=require(_0x81e4('0x0'));var emlformat=require(_0x81e4('0x1'));var rimraf=require(_0x81e4('0x2'));var zipdir=require(_0x81e4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x81e4('0x4'));var moment=require(_0x81e4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x81e4('0x6'));var path=require('path');var sox=require(_0x81e4('0x7'));var csv=require(_0x81e4('0x8'));var ejs=require(_0x81e4('0x9'));var fs=require('fs');var _=require(_0x81e4('0xa'));var squel=require(_0x81e4('0xb'));var crypto=require('crypto');var jsforce=require(_0x81e4('0xc'));var deskjs=require(_0x81e4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x81e4('0xe'));var Papa=require(_0x81e4('0xf'));var Redis=require(_0x81e4('0x10'));var shared=require(_0x81e4('0x11'));var authService=require(_0x81e4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x81e4('0x13'));var hardwareService=require(_0x81e4('0x14'));var logger=require(_0x81e4('0x15'))(_0x81e4('0x16'));var utils=require('../../config/utils');var config=require(_0x81e4('0x11'));var db=require(_0x81e4('0x17'))['db'];function respondWithStatusCode(_0x427c30,_0x2534bf){_0x2534bf=_0x2534bf||0xcc;return function(_0x54ae2a){if(_0x54ae2a){return _0x427c30[_0x81e4('0x18')](_0x2534bf);}return _0x427c30[_0x81e4('0x19')](_0x2534bf)[_0x81e4('0x1a')]();};}function respondWithResult(_0x513799,_0xe62da0){_0xe62da0=_0xe62da0||0xc8;return function(_0x12b644){if(_0x12b644){return _0x513799[_0x81e4('0x19')](_0xe62da0)[_0x81e4('0x1b')](_0x12b644);}};}function respondWithFilteredResult(_0x20cede,_0x54aaef){return function(_0x3799f2){if(_0x3799f2){var _0x5ae8a1=_0x3799f2['count'],_0x567c1f=_0x54aaef[_0x81e4('0x1c')],_0x2bbb8f=_0x54aaef[_0x81e4('0x1c')]+_0x54aaef[_0x81e4('0x1d')],_0x27df22;if(_0x2bbb8f>=_0x5ae8a1){_0x2bbb8f=_0x5ae8a1;_0x27df22=0xc8;}else{_0x27df22=0xce;}_0x20cede[_0x81e4('0x19')](_0x27df22);return _0x20cede['set'](_0x81e4('0x1e'),_0x567c1f+'-'+_0x2bbb8f+'/'+_0x5ae8a1)[_0x81e4('0x1b')](_0x3799f2);}return null;};}function patchUpdates(_0x353d2c){return function(_0x599931){try{jsonpatch[_0x81e4('0x1f')](_0x599931,_0x353d2c,!![]);}catch(_0x20edb2){return BPromise[_0x81e4('0x20')](_0x20edb2);}return _0x599931[_0x81e4('0x21')]();};}function saveUpdates(_0x28060c,_0x2f9685){return function(_0xade65){if(_0xade65){return _0xade65[_0x81e4('0x22')](_0x28060c)[_0x81e4('0x23')](function(_0x356e2f){return _0x356e2f;});}return null;};}function removeEntity(_0x2f0446,_0x2f2db9){return function(_0x2e2888){if(_0x2e2888){return _0x2e2888[_0x81e4('0x24')]()[_0x81e4('0x23')](function(){_0x2f0446[_0x81e4('0x19')](0xcc)[_0x81e4('0x1a')]();});}};}function handleEntityNotFound(_0x191670,_0x203a90){return function(_0x15ec26){if(!_0x15ec26){_0x191670[_0x81e4('0x18')](0x194);}return _0x15ec26;};}function handleError(_0x17f23e,_0x3d0522){_0x3d0522=_0x3d0522||0x1f4;return function(_0xb6acd5){logger[_0x81e4('0x25')](_0xb6acd5['stack']);if(_0xb6acd5[_0x81e4('0x26')]){delete _0xb6acd5['name'];}_0x17f23e['status'](_0x3d0522)[_0x81e4('0x27')](_0xb6acd5);};}exports['index']=function(_0x460a8f,_0x5f244d){var _0xc397f2={},_0x4f95d0={},_0x306a7b={'count':0x0,'rows':[]};var _0x576bfd=_[_0x81e4('0x28')](db[_0x81e4('0x29')][_0x81e4('0x2a')],function(_0x538759){return{'name':_0x538759[_0x81e4('0x2b')],'type':_0x538759[_0x81e4('0x2c')][_0x81e4('0x2d')]};});_0x4f95d0[_0x81e4('0x2e')]=_[_0x81e4('0x28')](_0x576bfd,_0x81e4('0x26'));_0x4f95d0[_0x81e4('0x2f')]=_[_0x81e4('0x30')](_0x460a8f[_0x81e4('0x2f')]);_0x4f95d0[_0x81e4('0x31')]=_['intersection'](_0x4f95d0[_0x81e4('0x2e')],_0x4f95d0[_0x81e4('0x2f')]);_0x4f95d0[_0x81e4('0x31')]=_['concat'](_0x4f95d0[_0x81e4('0x31')],[_0x81e4('0x32'),_0x81e4('0x33'),_0x81e4('0x34'),_0x81e4('0x35'),'$lt',_0x81e4('0x36'),_0x81e4('0x37'),_0x81e4('0x38'),'$not',_0x81e4('0x39'),_0x81e4('0x3a'),_0x81e4('0x3b'),_0x81e4('0x3c'),_0x81e4('0x3d'),_0x81e4('0x3e'),_0x81e4('0x3f'),'$notILike',_0x81e4('0x3d'),_0x81e4('0x40'),_0x81e4('0x41'),'$contained',_0x81e4('0x42')]);_0xc397f2[_0x81e4('0x43')]=_[_0x81e4('0x44')](_0x4f95d0[_0x81e4('0x2e')],qs[_0x81e4('0x45')](_0x460a8f[_0x81e4('0x2f')][_0x81e4('0x45')]));_0xc397f2[_0x81e4('0x43')]=_0xc397f2[_0x81e4('0x43')]['length']?_0xc397f2[_0x81e4('0x43')]:_0x4f95d0[_0x81e4('0x2e')];if(!_0x460a8f[_0x81e4('0x2f')][_0x81e4('0x46')](_0x81e4('0x47'))){_0xc397f2[_0x81e4('0x1d')]=qs['limit'](_0x460a8f[_0x81e4('0x2f')][_0x81e4('0x1d')]);_0xc397f2[_0x81e4('0x1c')]=qs[_0x81e4('0x1c')](_0x460a8f[_0x81e4('0x2f')][_0x81e4('0x1c')]);}_0xc397f2[_0x81e4('0x48')]=qs['sort'](_0x460a8f['query'][_0x81e4('0x49')]);_0xc397f2[_0x81e4('0x4a')]=qs['filters'](_[_0x81e4('0x4b')](_0x460a8f[_0x81e4('0x2f')],_0x4f95d0['filters']),_0x576bfd);if(_0x460a8f['query']['filter']){_0xc397f2[_0x81e4('0x4a')]=_[_0x81e4('0x4c')](_0xc397f2['where'],{'$or':_['map'](_0x576bfd,function(_0x996612){if(_0x996612['type']!==_0x81e4('0x4d')){var _0x34b525={};_0x34b525[_0x996612[_0x81e4('0x26')]]={'$like':'%'+_0x460a8f['query'][_0x81e4('0x4e')]+'%'};return _0x34b525;}})});}_0xc397f2=_[_0x81e4('0x4c')]({},_0xc397f2,_0x460a8f['options']);var _0x407cc8={'where':_0xc397f2[_0x81e4('0x4a')]};return db[_0x81e4('0x29')]['count'](_0x407cc8)[_0x81e4('0x23')](function(_0x1ba2e5){_0x306a7b[_0x81e4('0x4f')]=_0x1ba2e5;if(_0x460a8f[_0x81e4('0x2f')][_0x81e4('0x50')]){_0xc397f2[_0x81e4('0x51')]=[{'all':!![]}];}return db[_0x81e4('0x29')][_0x81e4('0x52')](_0xc397f2);})[_0x81e4('0x23')](function(_0x395a1e){_0x306a7b['rows']=_0x395a1e;return _0x306a7b;})['then'](respondWithFilteredResult(_0x5f244d,_0xc397f2))['catch'](handleError(_0x5f244d,null));};exports[_0x81e4('0x53')]=function(_0x2d9b8b,_0x593aad){var _0x1a6776={'raw':!![],'where':{'id':_0x2d9b8b[_0x81e4('0x54')]['id']}},_0xb990ac={};_0xb990ac[_0x81e4('0x2e')]=_[_0x81e4('0x30')](db['CmHopper']['rawAttributes']);_0xb990ac[_0x81e4('0x2f')]=_['keys'](_0x2d9b8b['query']);_0xb990ac[_0x81e4('0x31')]=_[_0x81e4('0x44')](_0xb990ac['model'],_0xb990ac['query']);_0x1a6776[_0x81e4('0x43')]=_['intersection'](_0xb990ac[_0x81e4('0x2e')],qs['fields'](_0x2d9b8b[_0x81e4('0x2f')][_0x81e4('0x45')]));_0x1a6776['attributes']=_0x1a6776[_0x81e4('0x43')][_0x81e4('0x55')]?_0x1a6776[_0x81e4('0x43')]:_0xb990ac[_0x81e4('0x2e')];if(_0x2d9b8b[_0x81e4('0x2f')]['includeAll']){_0x1a6776[_0x81e4('0x51')]=[{'all':!![]}];}_0x1a6776=_[_0x81e4('0x4c')]({},_0x1a6776,_0x2d9b8b[_0x81e4('0x56')]);return db[_0x81e4('0x29')][_0x81e4('0x57')](_0x1a6776)['then'](handleEntityNotFound(_0x593aad,null))[_0x81e4('0x23')](respondWithResult(_0x593aad,null))[_0x81e4('0x58')](handleError(_0x593aad,null));};exports['create']=function(_0x3fcd09,_0x1cba91){return db[_0x81e4('0x29')]['create'](_0x3fcd09['body'],{})[_0x81e4('0x23')](respondWithResult(_0x1cba91,0xc9))['catch'](handleError(_0x1cba91,null));};exports[_0x81e4('0x22')]=function(_0x3f3e45,_0x23a786){if(_0x3f3e45[_0x81e4('0x59')]['id']){delete _0x3f3e45[_0x81e4('0x59')]['id'];}return db[_0x81e4('0x29')][_0x81e4('0x57')]({'where':{'id':_0x3f3e45[_0x81e4('0x54')]['id']}})[_0x81e4('0x23')](handleEntityNotFound(_0x23a786,null))['then'](saveUpdates(_0x3f3e45[_0x81e4('0x59')],null))[_0x81e4('0x23')](respondWithResult(_0x23a786,null))['catch'](handleError(_0x23a786,null));};exports[_0x81e4('0x5a')]=function(_0x561cb3,_0xefd250){return db['CmHopper']['describe']()[_0x81e4('0x23')](respondWithResult(_0xefd250,null))[_0x81e4('0x58')](handleError(_0xefd250,null));};exports[_0x81e4('0x24')]=function(_0x2cbc41,_0x4aa2cf){var _0x4bc8fe;return db['CmHopper'][_0x81e4('0x57')]({'where':{'id':_0x2cbc41[_0x81e4('0x54')]['id']}})[_0x81e4('0x23')](handleEntityNotFound(_0x4aa2cf,null))[_0x81e4('0x23')](function(_0x386a6f){if(_0x386a6f){return _0x386a6f[_0x81e4('0x24')]()[_0x81e4('0x23')](function(_0x147042){return _0x147042;});}})[_0x81e4('0x23')](function(_0x423fd6){_0x4bc8fe=_0x423fd6;if(_0x423fd6){if(_0x423fd6[_0x81e4('0x5b')]||_0x423fd6[_0x81e4('0x5c')]){return db[_0x423fd6['VoiceQueueId']?_0x81e4('0x5d'):_0x81e4('0x5e')]['find']({'where':{'id':_0x423fd6[_0x81e4('0x5b')]?_0x423fd6[_0x81e4('0x5b')]:_0x423fd6[_0x81e4('0x5c')]},'attributes':['id',_0x81e4('0x26')],'raw':!![]});}}})[_0x81e4('0x23')](function(_0x5790d4){var _0x3f47d4={};if(_0x5790d4){_[_0x81e4('0x4c')](_0x3f47d4,_['omit'](_0x4bc8fe['dataValues'],[_0x81e4('0x5f'),'updatedAt','id']));_0x3f47d4[_0x81e4('0x60')]=0x15;_0x3f47d4[_0x81e4('0x61')]=_0x81e4('0x62');_0x3f47d4['campaign']=_0x5790d4[_0x81e4('0x26')];_0x3f47d4[_0x81e4('0x63')]=_0x2cbc41[_0x81e4('0x64')][_0x81e4('0x26')];_0x3f47d4[_0x81e4('0x65')]=_0x2cbc41['user']['id'];_0x3f47d4[_0x81e4('0x62')]=!![];_0x3f47d4['deletedat']=moment()[_0x81e4('0x66')](_0x81e4('0x67'));_0x3f47d4[_0x81e4('0x68')]=_0x4bc8fe[_0x81e4('0x69')];_0x3f47d4[_0x81e4('0x6a')]=_0x4bc8fe[_0x81e4('0x5b')]?'queue':_0x81e4('0x6b');return db[_0x81e4('0x6c')][_0x81e4('0x57')]({'where':{'id':_0x3f47d4[_0x81e4('0x6d')]},'attributes':[_0x81e4('0x6e'),_0x81e4('0x6f')]})[_0x81e4('0x23')](function(_0x161920){if(!_[_0x81e4('0x70')](_0x4aa2cf)&&!_['isNil'](_0x161920[_0x81e4('0x6e')])){_0x3f47d4[_0x81e4('0x71')]=_0x161920[_0x81e4('0x6e')];if(!_[_0x81e4('0x70')](_0x161920['lastName'])){_0x3f47d4[_0x81e4('0x71')]+='\x20'+_0x161920[_0x81e4('0x6f')];}}})['finally'](function(){return db[_0x81e4('0x72')]['create'](_0x3f47d4);});}})[_0x81e4('0x23')](function(){return _0x4aa2cf[_0x81e4('0x19')](0xcc)[_0x81e4('0x1a')]();})[_0x81e4('0x58')](handleError(_0x4aa2cf,null));};exports[_0x81e4('0x73')]=function(_0x49d2f8,_0x3a8e85,_0xdf6f44){var _0x3b7193=[];return db[_0x81e4('0x6c')][_0x81e4('0x5a')]()[_0x81e4('0x23')](function(_0x37d5f7){_0x3b7193=_[_0x81e4('0x30')](_0x37d5f7);return _0x49d2f8[_0x81e4('0x64')][_0x81e4('0x74')]({'where':{'type':_0x81e4('0x75'),'dialActive':!![],'dialMethod':_0x81e4('0x76')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x81e4('0x23')](function(_0x4e0d30){if(_0x4e0d30&&_0x4e0d30['length']){return db[_0x81e4('0x77')][_0x81e4('0x78')](function(_0x508262){var _0x516a3e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x81e4('0x66')](_0x81e4('0x67'))},'VoiceQueueId':{'$in':_[_0x81e4('0x28')](_0x4e0d30,'id')},'$or':[{'UserId':null},{'UserId':_0x49d2f8[_0x81e4('0x64')]['id']}]};var _0x121ef3=[];if(_0x49d2f8[_0x81e4('0x59')][_0x81e4('0x79')]&&_0x49d2f8[_0x81e4('0x59')][_0x81e4('0x79')]===_0x81e4('0x7a')){if(!_['isEmpty'](_0x49d2f8[_0x81e4('0x59')]['hopperIds'])){_0x516a3e['id']={'$in':_0x49d2f8[_0x81e4('0x59')][_0x81e4('0x7b')]};}_0x121ef3=[[_0x81e4('0x7c'),'ASC'],[_0x81e4('0x7d'),_0x4e0d30[0x0][_0x81e4('0x7e')]===_0x81e4('0x7f')?_0x81e4('0x80'):'ASC'],db[_0x81e4('0x77')][_0x81e4('0x81')](_0x81e4('0x82')),['id',_0x81e4('0x80')]];}else{if(!_['isEmpty'](_0x49d2f8[_0x81e4('0x59')]['hopperIds'])){_0x516a3e['id']={'$notIn':_0x49d2f8['body'][_0x81e4('0x7b')]};}_0x121ef3=[['priority','DESC'],[_0x81e4('0x7d'),_0x4e0d30[0x0]['dialOrderByScheduledAt']],db[_0x81e4('0x77')]['literal'](_0x81e4('0x83')),['id',_0x81e4('0x7f')]];}return db[_0x81e4('0x29')]['findOne']({'attributes':['id','scheduledat'],'where':_0x516a3e,'order':_0x121ef3,'transaction':_0x508262,'lock':_0x508262[_0x81e4('0x84')]['UPDATE'],'include':[{'model':db[_0x81e4('0x6c')],'as':_0x81e4('0x85'),'attributes':_0x3b7193,'include':[{'model':db[_0x81e4('0x86')],'as':'Company','attributes':['id',_0x81e4('0x26')]}]},{'model':db[_0x81e4('0x87')],'as':_0x81e4('0x88'),'attributes':['id',_0x81e4('0x26')]},{'model':db['VoiceQueue'],'as':_0x81e4('0x89'),'attributes':['id',_0x81e4('0x26'),_0x81e4('0x8a')]}]})[_0x81e4('0x23')](function(_0x38fbd3){if(_0x38fbd3){return _0x38fbd3['update']({'UserId':_0x49d2f8[_0x81e4('0x64')]['id']},{'transaction':_0x508262});}});});}})[_0x81e4('0x23')](handleEntityNotFound(_0x3a8e85,null))[_0x81e4('0x23')](respondWithResult(_0x3a8e85,null))['catch'](handleError(_0x3a8e85,null));};exports['getOpenContacts']=function(_0x968057,_0x342688,_0x4e509f){return _0x968057[_0x81e4('0x64')][_0x81e4('0x74')]({'where':{'type':_0x81e4('0x75'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0xd6bf78){if(_0xd6bf78&&_0xd6bf78[_0x81e4('0x55')]){return db[_0x81e4('0x29')][_0x81e4('0x4f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x81e4('0x66')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x81e4('0x28')](_0xd6bf78,'id')},'$or':[{'UserId':null},{'UserId':_0x968057['user']['id']}]}});}return 0x0;})[_0x81e4('0x23')](function(_0x29033f){if(!_['isNil'](_0x29033f)&&_['isNumber'](_0x29033f)){return _0x342688[_0x81e4('0x19')](0xc8)[_0x81e4('0x1b')]({'contacts':_0x29033f});}else{logger['error'](_0x81e4('0x8b'),_0x81e4('0x8c'),0x194,_0x81e4('0x8d'));_0x342688[_0x81e4('0x18')](0x194);}})[_0x81e4('0x58')](handleError(_0x342688,null));};exports[_0x81e4('0x8e')]=function(_0x4263d3,_0x32c868,_0x19ebcf){var _0x815c97=shared[_0x81e4('0x8f')];var _0x41258d=[];_[_0x81e4('0x28')](_0x815c97,function(_0x8151f9){_0x41258d[_0x81e4('0x90')]({'id':_0x8151f9[_0x81e4('0x26')],'name':_0x8151f9['name'],'utcOffset':_0x8151f9[_0x81e4('0x91')]});});return _0x32c868[_0x81e4('0x19')](0xc8)['json']({'tz':_0x41258d});};exports[_0x81e4('0x92')]=function(_0x2b25ac,_0x853515,_0x43da34){var _0x1db70d=shared[_0x81e4('0x8f')];var _0x2cce6f={};if(!_[_0x81e4('0x70')](_0x1db70d[_0x2b25ac['body']['id']]))_0x2cce6f=_0x1db70d[_0x2b25ac[_0x81e4('0x59')]['id']];return _0x853515['status'](0xc8)[_0x81e4('0x1b')](_0x2cce6f);}; \ No newline at end of file +var _0xa7bd=['$contained','$any','attributes','fields','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','end','getPreview','getVoiceQueues','dialOrderByScheduledAt','sequelize','direction','isEmpty','hopperIds','priority','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','literal','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getOpenContacts','outbound','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','push','utcOffset','timezones','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/environment','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','destroy','error','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','$and','$or','$gt','$gte','$lte','$ne','$eq','$not','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$contains'];(function(_0x4bc04d,_0x348a7d){var _0x5c7a77=function(_0x6886dd){while(--_0x6886dd){_0x4bc04d['push'](_0x4bc04d['shift']());}};_0x5c7a77(++_0x348a7d);}(_0xa7bd,0xe7));var _0xda7b=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0xa7bd[_0x1559a5];return _0x17a783;};'use strict';var pdf=require(_0xda7b('0x0'));var emlformat=require(_0xda7b('0x1'));var rimraf=require(_0xda7b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda7b('0x3'));var rp=require(_0xda7b('0x4'));var moment=require(_0xda7b('0x5'));var BPromise=require(_0xda7b('0x6'));var Mustache=require(_0xda7b('0x7'));var util=require(_0xda7b('0x8'));var path=require(_0xda7b('0x9'));var sox=require(_0xda7b('0xa'));var csv=require(_0xda7b('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xda7b('0xc'));var crypto=require(_0xda7b('0xd'));var jsforce=require(_0xda7b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xda7b('0xf'));var Papa=require(_0xda7b('0x10'));var Redis=require(_0xda7b('0x11'));var shared=require(_0xda7b('0x12'));var authService=require(_0xda7b('0x13'));var qs=require(_0xda7b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda7b('0x15'));var logger=require(_0xda7b('0x16'))(_0xda7b('0x17'));var utils=require(_0xda7b('0x18'));var config=require(_0xda7b('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40ba56,_0x2340d7){_0x2340d7=_0x2340d7||0xcc;return function(_0x4f5d79){if(_0x4f5d79){return _0x40ba56[_0xda7b('0x19')](_0x2340d7);}return _0x40ba56[_0xda7b('0x1a')](_0x2340d7)['end']();};}function respondWithResult(_0x490709,_0x3c2107){_0x3c2107=_0x3c2107||0xc8;return function(_0x3bb1df){if(_0x3bb1df){return _0x490709[_0xda7b('0x1a')](_0x3c2107)[_0xda7b('0x1b')](_0x3bb1df);}};}function respondWithFilteredResult(_0x27b26d,_0x2f21a3){return function(_0x50577f){if(_0x50577f){var _0x322144=_0x50577f[_0xda7b('0x1c')],_0x299c68=_0x2f21a3[_0xda7b('0x1d')],_0x6d3fbb=_0x2f21a3[_0xda7b('0x1d')]+_0x2f21a3[_0xda7b('0x1e')],_0x4d7299;if(_0x6d3fbb>=_0x322144){_0x6d3fbb=_0x322144;_0x4d7299=0xc8;}else{_0x4d7299=0xce;}_0x27b26d[_0xda7b('0x1a')](_0x4d7299);return _0x27b26d[_0xda7b('0x1f')]('Content-Range',_0x299c68+'-'+_0x6d3fbb+'/'+_0x322144)['json'](_0x50577f);}return null;};}function patchUpdates(_0xd2092e){return function(_0x440b92){try{jsonpatch['apply'](_0x440b92,_0xd2092e,!![]);}catch(_0x35d38c){return BPromise[_0xda7b('0x20')](_0x35d38c);}return _0x440b92[_0xda7b('0x21')]();};}function saveUpdates(_0x5134c8,_0x1f3530){return function(_0xad4b28){if(_0xad4b28){return _0xad4b28[_0xda7b('0x22')](_0x5134c8)[_0xda7b('0x23')](function(_0x5e8ba4){return _0x5e8ba4;});}return null;};}function removeEntity(_0x15f2ad,_0x1de261){return function(_0x57fa3f){if(_0x57fa3f){return _0x57fa3f[_0xda7b('0x24')]()[_0xda7b('0x23')](function(){_0x15f2ad[_0xda7b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1da32b,_0x1bcc16){return function(_0x2cdf55){if(!_0x2cdf55){_0x1da32b[_0xda7b('0x19')](0x194);}return _0x2cdf55;};}function handleError(_0x136046,_0x13bdea){_0x13bdea=_0x13bdea||0x1f4;return function(_0x18073d){logger[_0xda7b('0x25')](_0x18073d['stack']);if(_0x18073d[_0xda7b('0x26')]){delete _0x18073d['name'];}_0x136046[_0xda7b('0x1a')](_0x13bdea)[_0xda7b('0x27')](_0x18073d);};}exports[_0xda7b('0x28')]=function(_0x2bad4d,_0x288ed7){var _0x1c2a39={},_0x3c617a={},_0x5e1b69={'count':0x0,'rows':[]};var _0x30021e=_[_0xda7b('0x29')](db[_0xda7b('0x2a')][_0xda7b('0x2b')],function(_0x22aa08){return{'name':_0x22aa08[_0xda7b('0x2c')],'type':_0x22aa08[_0xda7b('0x2d')][_0xda7b('0x2e')]};});_0x3c617a[_0xda7b('0x2f')]=_[_0xda7b('0x29')](_0x30021e,_0xda7b('0x26'));_0x3c617a[_0xda7b('0x30')]=_[_0xda7b('0x31')](_0x2bad4d[_0xda7b('0x30')]);_0x3c617a[_0xda7b('0x32')]=_[_0xda7b('0x33')](_0x3c617a[_0xda7b('0x2f')],_0x3c617a[_0xda7b('0x30')]);_0x3c617a['filters']=_['concat'](_0x3c617a[_0xda7b('0x32')],[_0xda7b('0x34'),_0xda7b('0x35'),_0xda7b('0x36'),_0xda7b('0x37'),'$lt',_0xda7b('0x38'),_0xda7b('0x39'),_0xda7b('0x3a'),_0xda7b('0x3b'),'$between',_0xda7b('0x3c'),'$in',_0xda7b('0x3d'),_0xda7b('0x3e'),_0xda7b('0x3f'),_0xda7b('0x40'),_0xda7b('0x41'),'$like','$overlap',_0xda7b('0x42'),_0xda7b('0x43'),_0xda7b('0x44')]);_0x1c2a39[_0xda7b('0x45')]=_[_0xda7b('0x33')](_0x3c617a[_0xda7b('0x2f')],qs[_0xda7b('0x46')](_0x2bad4d[_0xda7b('0x30')][_0xda7b('0x46')]));_0x1c2a39[_0xda7b('0x45')]=_0x1c2a39[_0xda7b('0x45')]['length']?_0x1c2a39[_0xda7b('0x45')]:_0x3c617a[_0xda7b('0x2f')];if(!_0x2bad4d[_0xda7b('0x30')][_0xda7b('0x47')]('nolimit')){_0x1c2a39['limit']=qs[_0xda7b('0x1e')](_0x2bad4d[_0xda7b('0x30')][_0xda7b('0x1e')]);_0x1c2a39['offset']=qs[_0xda7b('0x1d')](_0x2bad4d[_0xda7b('0x30')][_0xda7b('0x1d')]);}_0x1c2a39[_0xda7b('0x48')]=qs[_0xda7b('0x49')](_0x2bad4d[_0xda7b('0x30')]['sort']);_0x1c2a39['where']=qs[_0xda7b('0x32')](_[_0xda7b('0x4a')](_0x2bad4d[_0xda7b('0x30')],_0x3c617a[_0xda7b('0x32')]),_0x30021e);if(_0x2bad4d[_0xda7b('0x30')]['filter']){_0x1c2a39[_0xda7b('0x4b')]=_[_0xda7b('0x4c')](_0x1c2a39[_0xda7b('0x4b')],{'$or':_[_0xda7b('0x29')](_0x30021e,function(_0x250ed8){if(_0x250ed8['type']!==_0xda7b('0x4d')){var _0x487faf={};_0x487faf[_0x250ed8[_0xda7b('0x26')]]={'$like':'%'+_0x2bad4d['query']['filter']+'%'};return _0x487faf;}})});}_0x1c2a39=_[_0xda7b('0x4c')]({},_0x1c2a39,_0x2bad4d[_0xda7b('0x4e')]);var _0x4609de={'where':_0x1c2a39['where']};return db[_0xda7b('0x2a')][_0xda7b('0x1c')](_0x4609de)[_0xda7b('0x23')](function(_0x5d04b7){_0x5e1b69[_0xda7b('0x1c')]=_0x5d04b7;if(_0x2bad4d[_0xda7b('0x30')]['includeAll']){_0x1c2a39[_0xda7b('0x4f')]=[{'all':!![]}];}return db[_0xda7b('0x2a')][_0xda7b('0x50')](_0x1c2a39);})[_0xda7b('0x23')](function(_0x23fe1a){_0x5e1b69[_0xda7b('0x51')]=_0x23fe1a;return _0x5e1b69;})[_0xda7b('0x23')](respondWithFilteredResult(_0x288ed7,_0x1c2a39))[_0xda7b('0x52')](handleError(_0x288ed7,null));};exports[_0xda7b('0x53')]=function(_0x15e8c4,_0x4eb253){var _0x4d469e={'raw':!![],'where':{'id':_0x15e8c4[_0xda7b('0x54')]['id']}},_0x20c8da={};_0x20c8da[_0xda7b('0x2f')]=_[_0xda7b('0x31')](db[_0xda7b('0x2a')][_0xda7b('0x2b')]);_0x20c8da[_0xda7b('0x30')]=_[_0xda7b('0x31')](_0x15e8c4[_0xda7b('0x30')]);_0x20c8da[_0xda7b('0x32')]=_['intersection'](_0x20c8da['model'],_0x20c8da['query']);_0x4d469e[_0xda7b('0x45')]=_[_0xda7b('0x33')](_0x20c8da[_0xda7b('0x2f')],qs[_0xda7b('0x46')](_0x15e8c4[_0xda7b('0x30')][_0xda7b('0x46')]));_0x4d469e[_0xda7b('0x45')]=_0x4d469e[_0xda7b('0x45')][_0xda7b('0x55')]?_0x4d469e['attributes']:_0x20c8da[_0xda7b('0x2f')];if(_0x15e8c4[_0xda7b('0x30')][_0xda7b('0x56')]){_0x4d469e[_0xda7b('0x4f')]=[{'all':!![]}];}_0x4d469e=_[_0xda7b('0x4c')]({},_0x4d469e,_0x15e8c4['options']);return db[_0xda7b('0x2a')][_0xda7b('0x57')](_0x4d469e)['then'](handleEntityNotFound(_0x4eb253,null))[_0xda7b('0x23')](respondWithResult(_0x4eb253,null))[_0xda7b('0x52')](handleError(_0x4eb253,null));};exports[_0xda7b('0x58')]=function(_0x57f06e,_0x530111){return db['CmHopper']['create'](_0x57f06e['body'],{})[_0xda7b('0x23')](respondWithResult(_0x530111,0xc9))[_0xda7b('0x52')](handleError(_0x530111,null));};exports[_0xda7b('0x22')]=function(_0x1fd282,_0x31c4e4){if(_0x1fd282[_0xda7b('0x59')]['id']){delete _0x1fd282[_0xda7b('0x59')]['id'];}return db[_0xda7b('0x2a')][_0xda7b('0x57')]({'where':{'id':_0x1fd282[_0xda7b('0x54')]['id']}})[_0xda7b('0x23')](handleEntityNotFound(_0x31c4e4,null))[_0xda7b('0x23')](saveUpdates(_0x1fd282[_0xda7b('0x59')],null))[_0xda7b('0x23')](respondWithResult(_0x31c4e4,null))[_0xda7b('0x52')](handleError(_0x31c4e4,null));};exports[_0xda7b('0x5a')]=function(_0xad35f4,_0x563a2c){return db[_0xda7b('0x2a')][_0xda7b('0x5a')]()['then'](respondWithResult(_0x563a2c,null))[_0xda7b('0x52')](handleError(_0x563a2c,null));};exports[_0xda7b('0x24')]=function(_0x1faaf4,_0x2d0dbb){var _0x67534a;return db['CmHopper']['find']({'where':{'id':_0x1faaf4[_0xda7b('0x54')]['id']}})[_0xda7b('0x23')](handleEntityNotFound(_0x2d0dbb,null))['then'](function(_0x5216a5){if(_0x5216a5){return _0x5216a5['destroy']()[_0xda7b('0x23')](function(_0x120125){return _0x120125;});}})[_0xda7b('0x23')](function(_0x15ec19){_0x67534a=_0x15ec19;if(_0x15ec19){if(_0x15ec19[_0xda7b('0x5b')]||_0x15ec19[_0xda7b('0x5c')]){return db[_0x15ec19['VoiceQueueId']?_0xda7b('0x5d'):_0xda7b('0x5e')][_0xda7b('0x57')]({'where':{'id':_0x15ec19['VoiceQueueId']?_0x15ec19[_0xda7b('0x5b')]:_0x15ec19[_0xda7b('0x5c')]},'attributes':['id',_0xda7b('0x26')],'raw':!![]});}}})['then'](function(_0x1b6dc2){var _0x2fd30c={};if(_0x1b6dc2){_[_0xda7b('0x4c')](_0x2fd30c,_[_0xda7b('0x5f')](_0x67534a[_0xda7b('0x60')],[_0xda7b('0x61'),_0xda7b('0x62'),'id']));_0x2fd30c[_0xda7b('0x63')]=0x15;_0x2fd30c['statedesc']='deleted';_0x2fd30c[_0xda7b('0x64')]=_0x1b6dc2[_0xda7b('0x26')];_0x2fd30c[_0xda7b('0x65')]=_0x1faaf4[_0xda7b('0x66')][_0xda7b('0x26')];_0x2fd30c[_0xda7b('0x67')]=_0x1faaf4[_0xda7b('0x66')]['id'];_0x2fd30c['deleted']=!![];_0x2fd30c['deletedat']=moment()[_0xda7b('0x68')](_0xda7b('0x69'));_0x2fd30c[_0xda7b('0x6a')]=_0x67534a['phone'];_0x2fd30c[_0xda7b('0x6b')]=_0x67534a[_0xda7b('0x5b')]?_0xda7b('0x6c'):'ivr';return db[_0xda7b('0x6d')][_0xda7b('0x57')]({'where':{'id':_0x2fd30c[_0xda7b('0x6e')]},'attributes':[_0xda7b('0x6f'),_0xda7b('0x70')]})[_0xda7b('0x23')](function(_0x364b55){if(!_[_0xda7b('0x71')](_0x2d0dbb)&&!_[_0xda7b('0x71')](_0x364b55[_0xda7b('0x6f')])){_0x2fd30c[_0xda7b('0x72')]=_0x364b55[_0xda7b('0x6f')];if(!_[_0xda7b('0x71')](_0x364b55[_0xda7b('0x70')])){_0x2fd30c['calleridname']+='\x20'+_0x364b55[_0xda7b('0x70')];}}})['finally'](function(){return db[_0xda7b('0x73')]['create'](_0x2fd30c);});}})[_0xda7b('0x23')](function(){return _0x2d0dbb[_0xda7b('0x1a')](0xcc)[_0xda7b('0x74')]();})[_0xda7b('0x52')](handleError(_0x2d0dbb,null));};exports[_0xda7b('0x75')]=function(_0x5ee305,_0x45a1a2,_0x1a4724){var _0x5dd7ba=[];return db[_0xda7b('0x6d')][_0xda7b('0x5a')]()[_0xda7b('0x23')](function(_0x13409b){_0x5dd7ba=_[_0xda7b('0x31')](_0x13409b);return _0x5ee305['user'][_0xda7b('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xda7b('0x77')],'raw':!![]});})[_0xda7b('0x23')](function(_0x2eb093){if(_0x2eb093&&_0x2eb093['length']){return db[_0xda7b('0x78')]['transaction'](function(_0x3baf55){var _0x377f79={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xda7b('0x68')](_0xda7b('0x69'))},'VoiceQueueId':{'$in':_[_0xda7b('0x29')](_0x2eb093,'id')},'$or':[{'UserId':null},{'UserId':_0x5ee305[_0xda7b('0x66')]['id']}]};var _0x31fff8=[];if(_0x5ee305[_0xda7b('0x59')][_0xda7b('0x79')]&&_0x5ee305['body']['direction']==='prev'){if(!_[_0xda7b('0x7a')](_0x5ee305[_0xda7b('0x59')]['hopperIds'])){_0x377f79['id']={'$in':_0x5ee305[_0xda7b('0x59')][_0xda7b('0x7b')]};}_0x31fff8=[[_0xda7b('0x7c'),_0xda7b('0x7d')],['scheduledAt',_0x2eb093[0x0]['dialOrderByScheduledAt']===_0xda7b('0x7d')?_0xda7b('0x7e'):'ASC'],db['sequelize']['literal'](_0xda7b('0x7f')),['id',_0xda7b('0x7e')]];}else{if(!_[_0xda7b('0x7a')](_0x5ee305[_0xda7b('0x59')][_0xda7b('0x7b')])){_0x377f79['id']={'$notIn':_0x5ee305[_0xda7b('0x59')][_0xda7b('0x7b')]};}_0x31fff8=[[_0xda7b('0x7c'),'DESC'],[_0xda7b('0x80'),_0x2eb093[0x0][_0xda7b('0x77')]],db['sequelize'][_0xda7b('0x81')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xda7b('0x7d')]];}return db[_0xda7b('0x2a')][_0xda7b('0x82')]({'attributes':['id',_0xda7b('0x83')],'where':_0x377f79,'order':_0x31fff8,'transaction':_0x3baf55,'lock':_0x3baf55[_0xda7b('0x84')][_0xda7b('0x85')],'include':[{'model':db[_0xda7b('0x6d')],'as':_0xda7b('0x86'),'attributes':_0x5dd7ba,'include':[{'model':db[_0xda7b('0x87')],'as':_0xda7b('0x88'),'attributes':['id',_0xda7b('0x26')]}]},{'model':db['CmList'],'as':_0xda7b('0x89'),'attributes':['id',_0xda7b('0x26')]},{'model':db[_0xda7b('0x5d')],'as':_0xda7b('0x8a'),'attributes':['id',_0xda7b('0x26'),_0xda7b('0x8b')]}]})[_0xda7b('0x23')](function(_0x50a64e){if(_0x50a64e){return _0x50a64e[_0xda7b('0x22')]({'UserId':_0x5ee305[_0xda7b('0x66')]['id']},{'transaction':_0x3baf55});}});});}})['then'](handleEntityNotFound(_0x45a1a2,null))[_0xda7b('0x23')](respondWithResult(_0x45a1a2,null))[_0xda7b('0x52')](handleError(_0x45a1a2,null));};exports[_0xda7b('0x8c')]=function(_0x2952fe,_0x4c03f3,_0x286a25){return _0x2952fe['user'][_0xda7b('0x76')]({'where':{'type':_0xda7b('0x8d'),'dialActive':!![],'dialMethod':_0xda7b('0x8e')},'attributes':['id'],'raw':!![]})[_0xda7b('0x23')](function(_0x51e627){if(_0x51e627&&_0x51e627[_0xda7b('0x55')]){return db['CmHopper'][_0xda7b('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xda7b('0x69'))},'VoiceQueueId':{'$in':_[_0xda7b('0x29')](_0x51e627,'id')},'$or':[{'UserId':null},{'UserId':_0x2952fe[_0xda7b('0x66')]['id']}]}});}return 0x0;})[_0xda7b('0x23')](function(_0x514ad2){if(!_['isNil'](_0x514ad2)&&_[_0xda7b('0x8f')](_0x514ad2)){return _0x4c03f3[_0xda7b('0x1a')](0xc8)[_0xda7b('0x1b')]({'contacts':_0x514ad2});}else{logger[_0xda7b('0x25')](_0xda7b('0x90'),_0xda7b('0x8c'),0x194,_0xda7b('0x91'));_0x4c03f3[_0xda7b('0x19')](0x194);}})[_0xda7b('0x52')](handleError(_0x4c03f3,null));};exports['getTimezones']=function(_0x49ba73,_0x1af20f,_0x243578){var _0x5d4b19=shared['timezones'];var _0x100bba=[];_['map'](_0x5d4b19,function(_0x448a2a){_0x100bba[_0xda7b('0x92')]({'id':_0x448a2a['name'],'name':_0x448a2a[_0xda7b('0x26')],'utcOffset':_0x448a2a[_0xda7b('0x93')]});});return _0x1af20f[_0xda7b('0x1a')](0xc8)[_0xda7b('0x1b')]({'tz':_0x100bba});};exports['getTimezone']=function(_0x3bed22,_0x1d1f8f,_0x487970){var _0x3d282e=shared[_0xda7b('0x94')];var _0x230b53={};if(!_[_0xda7b('0x71')](_0x3d282e[_0x3bed22[_0xda7b('0x59')]['id']]))_0x230b53=_0x3d282e[_0x3bed22[_0xda7b('0x59')]['id']];return _0x1d1f8f[_0xda7b('0x1a')](0xc8)[_0xda7b('0x1b')](_0x230b53);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index af8e082..859df1c 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 _0x7e15=['exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0x29d312,_0x951117){var _0x1fe04b=function(_0x26e53b){while(--_0x26e53b){_0x29d312['push'](_0x29d312['shift']());}};_0x1fe04b(++_0x951117);}(_0x7e15,0x138));var _0x57e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7e15[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x57e1('0x0'));var util=require(_0x57e1('0x1'));var logger=require(_0x57e1('0x2'))(_0x57e1('0x3'));var moment=require(_0x57e1('0x4'));var BPromise=require(_0x57e1('0x5'));var rp=require(_0x57e1('0x6'));var fs=require('fs');var path=require(_0x57e1('0x7'));var rimraf=require(_0x57e1('0x8'));var config=require(_0x57e1('0x9'));var attributes=require(_0x57e1('0xa'));module[_0x57e1('0xb')]=function(_0xc36303,_0x4b9c1c){return _0xc36303['define'](_0x57e1('0xc'),attributes,{'tableName':_0x57e1('0xd'),'paranoid':![],'indexes':[{'name':_0x57e1('0xe'),'fields':['scheduledat']},{'name':_0x57e1('0xf'),'fields':[_0x57e1('0xf')]},{'name':'priority','fields':[_0x57e1('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb6c4=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x4ebac4,_0x2498c1){var _0x487186=function(_0x40a954){while(--_0x40a954){_0x4ebac4['push'](_0x4ebac4['shift']());}};_0x487186(++_0x2498c1);}(_0xb6c4,0x1c2));var _0x4b6c=function(_0x19d561,_0x1dc2fe){_0x19d561=_0x19d561-0x0;var _0x4e486f=_0xb6c4[_0x19d561];return _0x4e486f;};'use strict';var _=require(_0x4b6c('0x0'));var util=require('util');var logger=require(_0x4b6c('0x1'))(_0x4b6c('0x2'));var moment=require(_0x4b6c('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b6c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b6c('0x5'));var config=require(_0x4b6c('0x6'));var attributes=require(_0x4b6c('0x7'));module[_0x4b6c('0x8')]=function(_0x680848,_0x6cf2fa){return _0x680848[_0x4b6c('0x9')](_0x4b6c('0xa'),attributes,{'tableName':_0x4b6c('0xb'),'paranoid':![],'indexes':[{'name':_0x4b6c('0xc'),'fields':['scheduledat']},{'name':_0x4b6c('0xd'),'fields':[_0x4b6c('0xd')]},{'name':_0x4b6c('0xe'),'fields':[_0x4b6c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index c63ceab..d22a79c 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 _0xde36=['../../config/logger','rpc','../../config/environment','client','http','then','info','CmHopper,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowCmHopper','find','create','body','CreateCmHopper','update','UpdateCmHopper','DestroyCmHopper','destroy','CmContact','describe','sequelize','order','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','all','GetContactDialer','transaction','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','LOCK','GetCmHopperPreview','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x94478b,_0x551ee1){var _0xe2d364=function(_0x287904){while(--_0x287904){_0x94478b['push'](_0x94478b['shift']());}};_0xe2d364(++_0x551ee1);}(_0xde36,0xd1));var _0x6de3=function(_0x3fcbf1,_0x8b6056){_0x3fcbf1=_0x3fcbf1-0x0;var _0x435faa=_0xde36[_0x3fcbf1];return _0x435faa;};'use strict';var _=require('lodash');var util=require(_0x6de3('0x0'));var moment=require(_0x6de3('0x1'));var BPromise=require(_0x6de3('0x2'));var rs=require(_0x6de3('0x3'));var fs=require('fs');var Redis=require(_0x6de3('0x4'));var db=require(_0x6de3('0x5'))['db'];var utils=require(_0x6de3('0x6'));var logger=require(_0x6de3('0x7'))(_0x6de3('0x8'));var config=require(_0x6de3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6de3('0xa')][_0x6de3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e488b,_0x5b8e39,_0x5da052){return new BPromise(function(_0x123bb2,_0x420115){return client['request'](_0x4e488b,_0x5da052)[_0x6de3('0xc')](function(_0x95ade3){logger[_0x6de3('0xd')](_0x6de3('0xe'),_0x5b8e39,'request\x20sent');logger[_0x6de3('0xf')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x5b8e39,_0x6de3('0x10'),JSON['stringify'](_0x95ade3));if(_0x95ade3[_0x6de3('0x11')]){if(_0x95ade3[_0x6de3('0x11')][_0x6de3('0x12')]===0x1f4){logger['error'](_0x6de3('0xe'),_0x5b8e39,_0x95ade3[_0x6de3('0x11')][_0x6de3('0x13')]);return _0x420115(_0x95ade3[_0x6de3('0x11')][_0x6de3('0x13')]);}logger[_0x6de3('0x11')](_0x6de3('0xe'),_0x5b8e39,_0x95ade3[_0x6de3('0x11')][_0x6de3('0x13')]);return _0x123bb2(_0x95ade3[_0x6de3('0x11')]['message']);}else{logger['info'](_0x6de3('0xe'),_0x5b8e39,_0x6de3('0x10'));_0x123bb2(_0x95ade3[_0x6de3('0x14')]['message']);}})[_0x6de3('0x15')](function(_0x226092){logger[_0x6de3('0x11')](_0x6de3('0xe'),_0x5b8e39,_0x226092);_0x420115(_0x226092);});});}exports[_0x6de3('0x16')]=function(_0x5ba9b4){var _0x112693=this;return new Promise(function(_0x437591,_0x62bc99){return db[_0x6de3('0x17')][_0x6de3('0x18')]({'raw':_0x5ba9b4[_0x6de3('0x19')]?_0x5ba9b4[_0x6de3('0x19')][_0x6de3('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ba9b4[_0x6de3('0x19')]?_0x5ba9b4['options'][_0x6de3('0x1b')]||null:null,'attributes':_0x5ba9b4[_0x6de3('0x19')]?_0x5ba9b4[_0x6de3('0x19')][_0x6de3('0x1c')]||null:null,'limit':_0x5ba9b4[_0x6de3('0x19')]?_0x5ba9b4[_0x6de3('0x19')][_0x6de3('0x1d')]||null:null,'include':_0x5ba9b4[_0x6de3('0x19')]?_0x5ba9b4['options'][_0x6de3('0x1e')]?_[_0x6de3('0x1f')](_0x5ba9b4[_0x6de3('0x19')][_0x6de3('0x1e')],function(_0x1fcc7c){return{'model':db[_0x1fcc7c['model']],'as':_0x1fcc7c['as'],'attributes':_0x1fcc7c[_0x6de3('0x1c')],'include':_0x1fcc7c[_0x6de3('0x1e')]?_[_0x6de3('0x1f')](_0x1fcc7c[_0x6de3('0x1e')],function(_0x2a425d){return{'model':db[_0x2a425d[_0x6de3('0x20')]],'as':_0x2a425d['as'],'attributes':_0x2a425d[_0x6de3('0x1c')],'include':_0x2a425d['include']?_[_0x6de3('0x1f')](_0x2a425d['include'],function(_0x44092c){return{'model':db[_0x44092c[_0x6de3('0x20')]],'as':_0x44092c['as'],'attributes':_0x44092c[_0x6de3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6de3('0xc')](function(_0xd8d03b){logger[_0x6de3('0xd')](_0x6de3('0x16'),_0x5ba9b4);logger['debug']('GetCmHopper',_0x5ba9b4,JSON[_0x6de3('0x21')](_0xd8d03b));_0x437591(_0xd8d03b);})[_0x6de3('0x15')](function(_0x523ebd){logger[_0x6de3('0x11')]('GetCmHopper',_0x523ebd['message'],_0x5ba9b4);_0x62bc99(_0x112693[_0x6de3('0x11')](0x1f4,_0x523ebd[_0x6de3('0x13')]));});});};exports[_0x6de3('0x22')]=function(_0x1b1de8){var _0x43fcf2=this;return new Promise(function(_0x4a4430,_0x208fdf){return db[_0x6de3('0x17')][_0x6de3('0x23')]({'raw':_0x1b1de8[_0x6de3('0x19')]?_0x1b1de8['options'][_0x6de3('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b1de8[_0x6de3('0x19')]?_0x1b1de8[_0x6de3('0x19')]['where']||null:null,'attributes':_0x1b1de8[_0x6de3('0x19')]?_0x1b1de8[_0x6de3('0x19')][_0x6de3('0x1c')]||null:null,'include':_0x1b1de8[_0x6de3('0x19')]?_0x1b1de8[_0x6de3('0x19')][_0x6de3('0x1e')]?_[_0x6de3('0x1f')](_0x1b1de8[_0x6de3('0x19')][_0x6de3('0x1e')],function(_0x4382dd){return{'model':db[_0x4382dd['model']],'as':_0x4382dd['as'],'attributes':_0x4382dd[_0x6de3('0x1c')],'include':_0x4382dd['include']?_[_0x6de3('0x1f')](_0x4382dd[_0x6de3('0x1e')],function(_0x30ae33){return{'model':db[_0x30ae33['model']],'as':_0x30ae33['as'],'attributes':_0x30ae33[_0x6de3('0x1c')],'include':_0x30ae33[_0x6de3('0x1e')]?_[_0x6de3('0x1f')](_0x30ae33['include'],function(_0x2902c6){return{'model':db[_0x2902c6['model']],'as':_0x2902c6['as'],'attributes':_0x2902c6[_0x6de3('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e9b8c){logger['info'](_0x6de3('0x22'),_0x1b1de8);logger[_0x6de3('0xf')](_0x6de3('0x22'),_0x1b1de8,JSON['stringify'](_0x3e9b8c));_0x4a4430(_0x3e9b8c);})['catch'](function(_0x5a131e){logger[_0x6de3('0x11')](_0x6de3('0x22'),_0x5a131e[_0x6de3('0x13')],_0x1b1de8);_0x208fdf(_0x43fcf2[_0x6de3('0x11')](0x1f4,_0x5a131e[_0x6de3('0x13')]));});});};exports['CreateCmHopper']=function(_0x17117a){var _0x58fe9f=this;return new Promise(function(_0x1ec263,_0x5c67e3){return db[_0x6de3('0x17')][_0x6de3('0x24')](_0x17117a[_0x6de3('0x25')],{'raw':_0x17117a[_0x6de3('0x19')]?_0x17117a[_0x6de3('0x19')][_0x6de3('0x1a')]===undefined?!![]:![]:!![]})[_0x6de3('0xc')](function(_0x4e6713){logger[_0x6de3('0xd')](_0x6de3('0x26'),_0x17117a);logger[_0x6de3('0xf')](_0x6de3('0x26'),_0x17117a,JSON[_0x6de3('0x21')](_0x4e6713));_0x1ec263(_0x4e6713);})[_0x6de3('0x15')](function(_0x4c1eb9){logger[_0x6de3('0x11')](_0x6de3('0x26'),_0x4c1eb9['message'],_0x17117a);_0x5c67e3(_0x58fe9f[_0x6de3('0x11')](0x1f4,_0x4c1eb9[_0x6de3('0x13')]));});});};exports['UpdateCmHopper']=function(_0x15181d){var _0x1a7d32=this;return new Promise(function(_0x31eaa6,_0x25a984){return db[_0x6de3('0x17')][_0x6de3('0x27')](_0x15181d['body'],{'raw':_0x15181d[_0x6de3('0x19')]?_0x15181d[_0x6de3('0x19')][_0x6de3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15181d[_0x6de3('0x19')]?_0x15181d[_0x6de3('0x19')][_0x6de3('0x1b')]||null:null,'attributes':_0x15181d['options']?_0x15181d[_0x6de3('0x19')][_0x6de3('0x1c')]||null:null,'limit':_0x15181d[_0x6de3('0x19')]?_0x15181d[_0x6de3('0x19')][_0x6de3('0x1d')]||null:null})[_0x6de3('0xc')](function(_0x26e3c0){logger['info'](_0x6de3('0x28'),_0x15181d);logger[_0x6de3('0xf')](_0x6de3('0x28'),_0x15181d,JSON[_0x6de3('0x21')](_0x26e3c0));_0x31eaa6(_0x26e3c0);})[_0x6de3('0x15')](function(_0x3e5438){logger[_0x6de3('0x11')]('UpdateCmHopper',_0x3e5438[_0x6de3('0x13')],_0x15181d);_0x25a984(_0x1a7d32[_0x6de3('0x11')](0x1f4,_0x3e5438['message']));});});};exports[_0x6de3('0x29')]=function(_0x3c5239){var _0x215630=this;return new Promise(function(_0x26efda,_0x5dccb8){return db['CmHopper'][_0x6de3('0x2a')]({'where':_0x3c5239[_0x6de3('0x19')]?_0x3c5239[_0x6de3('0x19')][_0x6de3('0x1b')]||null:null})[_0x6de3('0xc')](function(_0x50a744){logger[_0x6de3('0xd')](_0x6de3('0x29'),_0x3c5239);logger[_0x6de3('0xf')](_0x6de3('0x29'),_0x3c5239,JSON[_0x6de3('0x21')](_0x50a744));_0x26efda(_0x50a744);})[_0x6de3('0x15')](function(_0x33e055){logger[_0x6de3('0x11')](_0x6de3('0x29'),_0x33e055[_0x6de3('0x13')],_0x3c5239);_0x5dccb8(_0x215630['error'](0x1f4,_0x33e055['message']));});});};exports['GetContactDialer']=function(_0x1ae31a){var _0xadb8bd=this;return new Promise(function(_0x4ca735,_0x37887b){return db[_0x6de3('0x2b')][_0x6de3('0x2c')]()[_0x6de3('0xc')](function(_0x53ad06){return db[_0x6de3('0x2d')]['transaction'](function(_0x18e823){return db['CmHopper'][_0x6de3('0x18')]({'where':_0x1ae31a[_0x6de3('0x19')]?_0x1ae31a[_0x6de3('0x19')][_0x6de3('0x1b')]||null:null,'attributes':_0x1ae31a[_0x6de3('0x19')]?_0x1ae31a[_0x6de3('0x19')][_0x6de3('0x1c')]||null:null,'limit':_0x1ae31a[_0x6de3('0x19')]?_0x1ae31a['options'][_0x6de3('0x1d')]||null:null,'order':_0x1ae31a[_0x6de3('0x19')]?_0x1ae31a[_0x6de3('0x19')][_0x6de3('0x2e')]||null:null,'transaction':_0x18e823,'lock':_0x18e823['LOCK'][_0x6de3('0x2f')],'include':[{'model':db[_0x6de3('0x2b')],'as':_0x6de3('0x30'),'attributes':_[_0x6de3('0x31')](_0x53ad06)},{'model':db[_0x6de3('0x32')],'as':_0x6de3('0x33'),'attributes':['id',_0x6de3('0x34'),_0x6de3('0x35')]}]})[_0x6de3('0xc')](function(_0x47d788){var _0x5a705f=[];var _0xe10ea=[];for(var _0x47a3cc=0x0;_0x47a3cc<_0x47d788[_0x6de3('0x36')];_0x47a3cc+=0x1){if(!_0xe10ea['includes'](_0x47d788[_0x47a3cc][_0x6de3('0x37')])){_0xe10ea[_0x6de3('0x38')](_0x47d788[_0x47a3cc][_0x6de3('0x37')]);_0x5a705f['push'](_0x47d788[_0x47a3cc]['update'](_0x1ae31a[_0x6de3('0x25')],{'transaction':_0x18e823}));}}return BPromise[_0x6de3('0x39')](_0x5a705f);});})[_0x6de3('0xc')](function(_0x3f714b){logger[_0x6de3('0xd')](_0x6de3('0x3a'),_0x1ae31a);logger[_0x6de3('0xf')](_0x6de3('0x3a'),_0x1ae31a,JSON[_0x6de3('0x21')](_0x3f714b));_0x4ca735(_0x3f714b);})[_0x6de3('0x15')](function(_0x48150c){logger[_0x6de3('0x11')](_0x6de3('0x3a'),_0x48150c[_0x6de3('0x13')],_0x1ae31a);_0x37887b(_0xadb8bd[_0x6de3('0x11')](0x1f4,_0x48150c['message']));});});});};exports['MoveContactManagedDialer']=function(_0x31b6d1){var _0x4c7d51=this;return new Promise(function(_0x5cc867,_0x5b8eb0){return db[_0x6de3('0x2d')][_0x6de3('0x3b')](function(_0x18ea6b){return db['CmHopperFinal'][_0x6de3('0x24')](_0x31b6d1[_0x6de3('0x25')],{'raw':_0x31b6d1[_0x6de3('0x19')]?_0x31b6d1['options'][_0x6de3('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x18ea6b})[_0x6de3('0xc')](function(){return db[_0x6de3('0x17')][_0x6de3('0x2a')]({'where':_0x31b6d1[_0x6de3('0x19')]?_0x31b6d1[_0x6de3('0x19')][_0x6de3('0x1b')]||null:null,'transaction':_0x18ea6b});});})['then'](function(_0x1a51a5){logger[_0x6de3('0xd')]('MoveContactManagedDialer',_0x31b6d1);logger[_0x6de3('0xf')](_0x6de3('0x3c'),_0x31b6d1,JSON[_0x6de3('0x21')](_0x1a51a5));_0x5cc867(_0x1a51a5);})['catch'](function(_0x52be52){logger['error'](_0x6de3('0x3c'),_0x52be52[_0x6de3('0x13')],_0x31b6d1);_0x5b8eb0(_0x4c7d51[_0x6de3('0x11')](0x1f4,_0x52be52['message']));});});};exports[_0x6de3('0x3d')]=function(_0x5aa658){var _0x49adcc=this;return new Promise(function(_0x3bb8ff,_0x101210){return db[_0x6de3('0x17')][_0x6de3('0x18')]({'raw':_0x5aa658['options']?_0x5aa658['options'][_0x6de3('0x1a')]===undefined?!![]:![]:!![],'where':_0x5aa658[_0x6de3('0x19')]?_0x5aa658[_0x6de3('0x19')][_0x6de3('0x1b')]||null:null,'attributes':[[db[_0x6de3('0x2d')]['fn'](_0x6de3('0x3e'),db[_0x6de3('0x2d')]['fn']('IF',db[_0x6de3('0x2d')][_0x6de3('0x3f')](_0x6de3('0x40')+util[_0x6de3('0x41')](_0x6de3('0x42'),moment()[_0x6de3('0x41')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x6de3('0x43')))),_0x6de3('0x44')]]})[_0x6de3('0xc')](function(_0x52355c){logger['info'](_0x6de3('0x3d'),_0x5aa658);logger[_0x6de3('0xf')]('CountReScheduled',_0x5aa658,JSON[_0x6de3('0x21')](_0x52355c));_0x3bb8ff(_0x52355c);})[_0x6de3('0x15')](function(_0x53a04b){logger[_0x6de3('0x11')](_0x6de3('0x3d'),_0x53a04b[_0x6de3('0x13')],_0x5aa658);_0x101210(_0x49adcc[_0x6de3('0x11')](0x1f4,_0x53a04b['message']));});});};exports[_0x6de3('0x45')]=function(_0x184d34){var _0x522999=this;return new Promise(function(_0x193c0c,_0x47f2f1){return db[_0x6de3('0x2b')][_0x6de3('0x2c')]()[_0x6de3('0xc')](function(_0x265b0f){return db[_0x6de3('0x2d')][_0x6de3('0x3b')](function(_0x3c92ed){return db[_0x6de3('0x17')]['findAll']({'where':_0x184d34[_0x6de3('0x19')]?_0x184d34[_0x6de3('0x19')]['where']||null:null,'attributes':_0x184d34['options']?_0x184d34[_0x6de3('0x19')][_0x6de3('0x1c')]||null:null,'limit':0x1,'order':_0x184d34[_0x6de3('0x19')]?_0x184d34[_0x6de3('0x19')][_0x6de3('0x2e')]||null:null,'group':db[_0x6de3('0x17')]['UserId'],'transaction':_0x3c92ed,'lock':_0x3c92ed[_0x6de3('0x46')][_0x6de3('0x2f')],'include':_0x184d34['options']?_0x184d34['options'][_0x6de3('0x1e')]?_[_0x6de3('0x1f')](_0x184d34[_0x6de3('0x19')][_0x6de3('0x1e')],function(_0x223ab4){return{'model':db[_0x223ab4['model']],'as':_0x223ab4['as'],'attributes':_0x223ab4[_0x6de3('0x1c')],'include':_0x223ab4[_0x6de3('0x1e')]?_[_0x6de3('0x1f')](_0x223ab4[_0x6de3('0x1e')],function(_0x2fe4e3){return{'model':db[_0x2fe4e3[_0x6de3('0x20')]],'as':_0x2fe4e3['as'],'attributes':_0x2fe4e3[_0x6de3('0x1c')],'include':_0x2fe4e3['include']?_[_0x6de3('0x1f')](_0x2fe4e3[_0x6de3('0x1e')],function(_0x4c82de){return{'model':db[_0x4c82de[_0x6de3('0x20')]],'as':_0x4c82de['as'],'attributes':_0x4c82de[_0x6de3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6de3('0xc')](function(_0xaef0c9){var _0x451180=[];for(var _0x527430=0x0;_0x527430<_0xaef0c9[_0x6de3('0x36')];_0x527430+=0x1){_0x451180[_0x6de3('0x38')](_0xaef0c9[_0x527430][_0x6de3('0x27')](_0x184d34['body'],{'transaction':_0x3c92ed}));}return BPromise[_0x6de3('0x39')](_0x451180);});})[_0x6de3('0xc')](function(_0x4f2295){logger[_0x6de3('0xd')]('GetContactRecallMe',_0x184d34);logger[_0x6de3('0xf')]('GetContactRecallMe',_0x184d34,JSON[_0x6de3('0x21')](_0x4f2295));_0x193c0c(_0x4f2295);})[_0x6de3('0x15')](function(_0x22c3f8){logger[_0x6de3('0x11')](_0x6de3('0x45'),_0x22c3f8[_0x6de3('0x13')],_0x184d34);_0x47f2f1(_0x522999[_0x6de3('0x11')](0x1f4,_0x22c3f8[_0x6de3('0x13')]));});});});};exports[_0x6de3('0x47')]=function(_0x56cff4){var _0x19dbf7=this;return new Promise(function(_0x43a575,_0x795680){db[_0x6de3('0x2b')]['describe']()[_0x6de3('0xc')](function(_0x207097){return db['CmHopper']['findAll']({'raw':_0x56cff4[_0x6de3('0x19')]?_0x56cff4[_0x6de3('0x19')][_0x6de3('0x1a')]===undefined?!![]:![]:!![],'where':_0x56cff4[_0x6de3('0x19')]?_0x56cff4[_0x6de3('0x19')]['where']||null:null,'attributes':_0x56cff4[_0x6de3('0x19')]?_0x56cff4['options'][_0x6de3('0x1c')]||null:null,'limit':_0x56cff4[_0x6de3('0x19')]?_0x56cff4[_0x6de3('0x19')][_0x6de3('0x1d')]||null:null,'include':_0x56cff4[_0x6de3('0x19')]?_0x56cff4[_0x6de3('0x19')][_0x6de3('0x1e')]?_[_0x6de3('0x1f')](_0x56cff4[_0x6de3('0x19')][_0x6de3('0x1e')],function(_0x263cc2){return{'model':db[_0x263cc2[_0x6de3('0x20')]],'as':_0x263cc2['as'],'attributes':_0x263cc2['as']===_0x6de3('0x30')?_[_0x6de3('0x31')](_0x207097):_0x263cc2['attributes'],'include':_0x263cc2['include']?_[_0x6de3('0x1f')](_0x263cc2[_0x6de3('0x1e')],function(_0x395101){return{'model':db[_0x395101['model']],'as':_0x395101['as'],'attributes':_0x395101['attributes'],'include':_0x395101[_0x6de3('0x1e')]?_[_0x6de3('0x1f')](_0x395101[_0x6de3('0x1e')],function(_0x53cddf){return{'model':db[_0x53cddf['model']],'as':_0x53cddf['as'],'attributes':_0x53cddf[_0x6de3('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x161f2f){logger[_0x6de3('0xd')](_0x6de3('0x16'),_0x56cff4);logger[_0x6de3('0xf')](_0x6de3('0x16'),_0x56cff4,JSON[_0x6de3('0x21')](_0x161f2f));_0x43a575(_0x161f2f);})[_0x6de3('0x15')](function(_0x2ea9a8){logger[_0x6de3('0x11')](_0x6de3('0x16'),_0x2ea9a8[_0x6de3('0x13')],_0x56cff4);_0x795680(_0x19dbf7['error'](0x1f4,_0x2ea9a8[_0x6de3('0x13')]));});});});}; \ No newline at end of file +var _0x3826=['../../config/logger','../../config/environment','client','http','request','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','options','raw','where','attributes','include','map','model','then','ShowCmHopper','find','CreateCmHopper','CmHopper','body','UpdateCmHopper','update','limit','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','findAll','order','LOCK','Contact','User','Agent','name','voicePause','length','includes','UserId','push','all','create','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','\x22%s\x22','format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','CmContact','UPDATE','GetCmHopperPreview','keys','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5c0232,_0x1c449f){var _0x589366=function(_0x31cd62){while(--_0x31cd62){_0x5c0232['push'](_0x5c0232['shift']());}};_0x589366(++_0x1c449f);}(_0x3826,0x1aa));var _0x6382=function(_0x35fcb7,_0x3734c0){_0x35fcb7=_0x35fcb7-0x0;var _0x30f28a=_0x3826[_0x35fcb7];return _0x30f28a;};'use strict';var _=require('lodash');var util=require(_0x6382('0x0'));var moment=require('moment');var BPromise=require(_0x6382('0x1'));var rs=require(_0x6382('0x2'));var fs=require('fs');var Redis=require(_0x6382('0x3'));var db=require(_0x6382('0x4'))['db'];var utils=require(_0x6382('0x5'));var logger=require(_0x6382('0x6'))('rpc');var config=require(_0x6382('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6382('0x8')][_0x6382('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8984c9,_0x39c670,_0x973e24){return new BPromise(function(_0x151cd0,_0x246e2c){return client[_0x6382('0xa')](_0x8984c9,_0x973e24)['then'](function(_0xb7548){logger[_0x6382('0xb')](_0x6382('0xc'),_0x39c670,_0x6382('0xd'));logger[_0x6382('0xe')](_0x6382('0xf'),_0x39c670,_0x6382('0xd'),JSON[_0x6382('0x10')](_0xb7548));if(_0xb7548[_0x6382('0x11')]){if(_0xb7548[_0x6382('0x11')][_0x6382('0x12')]===0x1f4){logger[_0x6382('0x11')](_0x6382('0xc'),_0x39c670,_0xb7548[_0x6382('0x11')][_0x6382('0x13')]);return _0x246e2c(_0xb7548['error'][_0x6382('0x13')]);}logger['error']('CmHopper,\x20%s,\x20%s',_0x39c670,_0xb7548[_0x6382('0x11')][_0x6382('0x13')]);return _0x151cd0(_0xb7548[_0x6382('0x11')][_0x6382('0x13')]);}else{logger[_0x6382('0xb')](_0x6382('0xc'),_0x39c670,_0x6382('0xd'));_0x151cd0(_0xb7548[_0x6382('0x14')][_0x6382('0x13')]);}})[_0x6382('0x15')](function(_0x2bcde4){logger[_0x6382('0x11')]('CmHopper,\x20%s,\x20%s',_0x39c670,_0x2bcde4);_0x246e2c(_0x2bcde4);});});}exports[_0x6382('0x16')]=function(_0x190147){var _0x19e3ac=this;return new Promise(function(_0x2edc54,_0x1bb5ac){return db['CmHopper']['findAll']({'raw':_0x190147[_0x6382('0x17')]?_0x190147[_0x6382('0x17')][_0x6382('0x18')]===undefined?!![]:![]:!![],'where':_0x190147['options']?_0x190147[_0x6382('0x17')][_0x6382('0x19')]||null:null,'attributes':_0x190147['options']?_0x190147['options'][_0x6382('0x1a')]||null:null,'limit':_0x190147[_0x6382('0x17')]?_0x190147[_0x6382('0x17')]['limit']||null:null,'include':_0x190147[_0x6382('0x17')]?_0x190147[_0x6382('0x17')][_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x190147[_0x6382('0x17')][_0x6382('0x1b')],function(_0x223615){return{'model':db[_0x223615[_0x6382('0x1d')]],'as':_0x223615['as'],'attributes':_0x223615[_0x6382('0x1a')],'include':_0x223615[_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x223615[_0x6382('0x1b')],function(_0x5e3fef){return{'model':db[_0x5e3fef[_0x6382('0x1d')]],'as':_0x5e3fef['as'],'attributes':_0x5e3fef[_0x6382('0x1a')],'include':_0x5e3fef[_0x6382('0x1b')]?_['map'](_0x5e3fef['include'],function(_0x3172c7){return{'model':db[_0x3172c7['model']],'as':_0x3172c7['as'],'attributes':_0x3172c7[_0x6382('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6382('0x1e')](function(_0xe3fbca){logger[_0x6382('0xb')]('GetCmHopper',_0x190147);logger[_0x6382('0xe')](_0x6382('0x16'),_0x190147,JSON[_0x6382('0x10')](_0xe3fbca));_0x2edc54(_0xe3fbca);})[_0x6382('0x15')](function(_0x5a2187){logger['error'](_0x6382('0x16'),_0x5a2187[_0x6382('0x13')],_0x190147);_0x1bb5ac(_0x19e3ac['error'](0x1f4,_0x5a2187[_0x6382('0x13')]));});});};exports[_0x6382('0x1f')]=function(_0x271a19){var _0x135018=this;return new Promise(function(_0xa35e77,_0xc47894){return db['CmHopper'][_0x6382('0x20')]({'raw':_0x271a19[_0x6382('0x17')]?_0x271a19[_0x6382('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x271a19[_0x6382('0x17')]?_0x271a19[_0x6382('0x17')][_0x6382('0x19')]||null:null,'attributes':_0x271a19[_0x6382('0x17')]?_0x271a19[_0x6382('0x17')]['attributes']||null:null,'include':_0x271a19[_0x6382('0x17')]?_0x271a19['options'][_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x271a19[_0x6382('0x17')][_0x6382('0x1b')],function(_0x3462e0){return{'model':db[_0x3462e0[_0x6382('0x1d')]],'as':_0x3462e0['as'],'attributes':_0x3462e0[_0x6382('0x1a')],'include':_0x3462e0['include']?_[_0x6382('0x1c')](_0x3462e0[_0x6382('0x1b')],function(_0x3458a4){return{'model':db[_0x3458a4['model']],'as':_0x3458a4['as'],'attributes':_0x3458a4[_0x6382('0x1a')],'include':_0x3458a4[_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x3458a4[_0x6382('0x1b')],function(_0x153870){return{'model':db[_0x153870[_0x6382('0x1d')]],'as':_0x153870['as'],'attributes':_0x153870['attributes']};}):[]};}):[]};}):[]:[]})[_0x6382('0x1e')](function(_0x3de367){logger['info']('ShowCmHopper',_0x271a19);logger[_0x6382('0xe')]('ShowCmHopper',_0x271a19,JSON[_0x6382('0x10')](_0x3de367));_0xa35e77(_0x3de367);})[_0x6382('0x15')](function(_0x2605a7){logger[_0x6382('0x11')]('ShowCmHopper',_0x2605a7['message'],_0x271a19);_0xc47894(_0x135018['error'](0x1f4,_0x2605a7[_0x6382('0x13')]));});});};exports[_0x6382('0x21')]=function(_0x5b65b4){var _0x20d8bc=this;return new Promise(function(_0x18211f,_0xa3f58c){return db[_0x6382('0x22')]['create'](_0x5b65b4[_0x6382('0x23')],{'raw':_0x5b65b4[_0x6382('0x17')]?_0x5b65b4[_0x6382('0x17')][_0x6382('0x18')]===undefined?!![]:![]:!![]})[_0x6382('0x1e')](function(_0x14d86f){logger['info'](_0x6382('0x21'),_0x5b65b4);logger['debug'](_0x6382('0x21'),_0x5b65b4,JSON['stringify'](_0x14d86f));_0x18211f(_0x14d86f);})['catch'](function(_0x41bf0f){logger['error'](_0x6382('0x21'),_0x41bf0f[_0x6382('0x13')],_0x5b65b4);_0xa3f58c(_0x20d8bc[_0x6382('0x11')](0x1f4,_0x41bf0f[_0x6382('0x13')]));});});};exports[_0x6382('0x24')]=function(_0x274e9c){var _0x439b0b=this;return new Promise(function(_0x356eb6,_0x4559ad){return db[_0x6382('0x22')][_0x6382('0x25')](_0x274e9c[_0x6382('0x23')],{'raw':_0x274e9c[_0x6382('0x17')]?_0x274e9c[_0x6382('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x274e9c['options']?_0x274e9c[_0x6382('0x17')]['where']||null:null,'attributes':_0x274e9c[_0x6382('0x17')]?_0x274e9c[_0x6382('0x17')][_0x6382('0x1a')]||null:null,'limit':_0x274e9c['options']?_0x274e9c['options'][_0x6382('0x26')]||null:null})[_0x6382('0x1e')](function(_0x34592b){logger[_0x6382('0xb')]('UpdateCmHopper',_0x274e9c);logger[_0x6382('0xe')](_0x6382('0x24'),_0x274e9c,JSON[_0x6382('0x10')](_0x34592b));_0x356eb6(_0x34592b);})[_0x6382('0x15')](function(_0x3799e5){logger[_0x6382('0x11')](_0x6382('0x24'),_0x3799e5['message'],_0x274e9c);_0x4559ad(_0x439b0b[_0x6382('0x11')](0x1f4,_0x3799e5[_0x6382('0x13')]));});});};exports[_0x6382('0x27')]=function(_0x5ea537){var _0x1f097d=this;return new Promise(function(_0x56a9ab,_0x25fab6){return db[_0x6382('0x22')][_0x6382('0x28')]({'where':_0x5ea537[_0x6382('0x17')]?_0x5ea537[_0x6382('0x17')][_0x6382('0x19')]||null:null})['then'](function(_0x24b4a6){logger['info'](_0x6382('0x27'),_0x5ea537);logger[_0x6382('0xe')](_0x6382('0x27'),_0x5ea537,JSON[_0x6382('0x10')](_0x24b4a6));_0x56a9ab(_0x24b4a6);})[_0x6382('0x15')](function(_0x2273e7){logger[_0x6382('0x11')](_0x6382('0x27'),_0x2273e7[_0x6382('0x13')],_0x5ea537);_0x25fab6(_0x1f097d[_0x6382('0x11')](0x1f4,_0x2273e7[_0x6382('0x13')]));});});};exports[_0x6382('0x29')]=function(_0x749f82){var _0x23a29b=this;return new Promise(function(_0x181446,_0x46b793){return db['CmContact'][_0x6382('0x2a')]()[_0x6382('0x1e')](function(_0x1d3339){return db[_0x6382('0x2b')][_0x6382('0x2c')](function(_0x266a4e){return db[_0x6382('0x22')][_0x6382('0x2d')]({'where':_0x749f82[_0x6382('0x17')]?_0x749f82[_0x6382('0x17')][_0x6382('0x19')]||null:null,'attributes':_0x749f82['options']?_0x749f82[_0x6382('0x17')]['attributes']||null:null,'limit':_0x749f82[_0x6382('0x17')]?_0x749f82['options']['limit']||null:null,'order':_0x749f82[_0x6382('0x17')]?_0x749f82[_0x6382('0x17')][_0x6382('0x2e')]||null:null,'transaction':_0x266a4e,'lock':_0x266a4e[_0x6382('0x2f')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x6382('0x30'),'attributes':_['keys'](_0x1d3339)},{'model':db[_0x6382('0x31')],'as':_0x6382('0x32'),'attributes':['id',_0x6382('0x33'),_0x6382('0x34')]}]})['then'](function(_0x35e0e4){var _0x30978d=[];var _0x249af1=[];for(var _0x354327=0x0;_0x354327<_0x35e0e4[_0x6382('0x35')];_0x354327+=0x1){if(!_0x249af1[_0x6382('0x36')](_0x35e0e4[_0x354327][_0x6382('0x37')])){_0x249af1['push'](_0x35e0e4[_0x354327][_0x6382('0x37')]);_0x30978d[_0x6382('0x38')](_0x35e0e4[_0x354327][_0x6382('0x25')](_0x749f82[_0x6382('0x23')],{'transaction':_0x266a4e}));}}return BPromise[_0x6382('0x39')](_0x30978d);});})[_0x6382('0x1e')](function(_0x3bc641){logger[_0x6382('0xb')](_0x6382('0x29'),_0x749f82);logger[_0x6382('0xe')](_0x6382('0x29'),_0x749f82,JSON['stringify'](_0x3bc641));_0x181446(_0x3bc641);})['catch'](function(_0x1f59cc){logger[_0x6382('0x11')](_0x6382('0x29'),_0x1f59cc[_0x6382('0x13')],_0x749f82);_0x46b793(_0x23a29b[_0x6382('0x11')](0x1f4,_0x1f59cc[_0x6382('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x430b12){var _0x37332b=this;return new Promise(function(_0x2ae313,_0x205e25){return db[_0x6382('0x2b')]['transaction'](function(_0xabf101){return db['CmHopperFinal'][_0x6382('0x3a')](_0x430b12[_0x6382('0x23')],{'raw':_0x430b12[_0x6382('0x17')]?_0x430b12[_0x6382('0x17')][_0x6382('0x18')]===undefined?!![]:![]:!![],'transaction':_0xabf101})[_0x6382('0x1e')](function(){return db[_0x6382('0x22')][_0x6382('0x28')]({'where':_0x430b12[_0x6382('0x17')]?_0x430b12[_0x6382('0x17')][_0x6382('0x19')]||null:null,'transaction':_0xabf101});});})['then'](function(_0x53313c){logger[_0x6382('0xb')](_0x6382('0x3b'),_0x430b12);logger['debug'](_0x6382('0x3b'),_0x430b12,JSON[_0x6382('0x10')](_0x53313c));_0x2ae313(_0x53313c);})[_0x6382('0x15')](function(_0x389992){logger[_0x6382('0x11')](_0x6382('0x3b'),_0x389992['message'],_0x430b12);_0x205e25(_0x37332b[_0x6382('0x11')](0x1f4,_0x389992['message']));});});};exports[_0x6382('0x3c')]=function(_0x2c4887){var _0x4cb33e=this;return new Promise(function(_0x17d015,_0x545a1c){return db['CmHopper'][_0x6382('0x2d')]({'raw':_0x2c4887['options']?_0x2c4887['options'][_0x6382('0x18')]===undefined?!![]:![]:!![],'where':_0x2c4887[_0x6382('0x17')]?_0x2c4887[_0x6382('0x17')][_0x6382('0x19')]||null:null,'attributes':[[db['sequelize']['fn'](_0x6382('0x3d'),db['sequelize']['fn']('IF',db[_0x6382('0x2b')]['literal'](_0x6382('0x3e')+util['format'](_0x6382('0x3f'),moment()[_0x6382('0x40')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x6382('0x41')))),_0x6382('0x42')]]})[_0x6382('0x1e')](function(_0x11a6a5){logger[_0x6382('0xb')](_0x6382('0x3c'),_0x2c4887);logger[_0x6382('0xe')](_0x6382('0x3c'),_0x2c4887,JSON[_0x6382('0x10')](_0x11a6a5));_0x17d015(_0x11a6a5);})['catch'](function(_0xf0fb13){logger[_0x6382('0x11')]('CountReScheduled',_0xf0fb13[_0x6382('0x13')],_0x2c4887);_0x545a1c(_0x4cb33e[_0x6382('0x11')](0x1f4,_0xf0fb13['message']));});});};exports[_0x6382('0x43')]=function(_0x549868){var _0x430437=this;return new Promise(function(_0x1f1e8c,_0x1f8d96){return db[_0x6382('0x44')][_0x6382('0x2a')]()[_0x6382('0x1e')](function(_0x1fc174){return db[_0x6382('0x2b')]['transaction'](function(_0x5c5bf0){return db[_0x6382('0x22')][_0x6382('0x2d')]({'where':_0x549868['options']?_0x549868[_0x6382('0x17')][_0x6382('0x19')]||null:null,'attributes':_0x549868[_0x6382('0x17')]?_0x549868[_0x6382('0x17')][_0x6382('0x1a')]||null:null,'limit':0x1,'order':_0x549868[_0x6382('0x17')]?_0x549868[_0x6382('0x17')][_0x6382('0x2e')]||null:null,'group':db[_0x6382('0x22')][_0x6382('0x37')],'transaction':_0x5c5bf0,'lock':_0x5c5bf0[_0x6382('0x2f')][_0x6382('0x45')],'include':_0x549868[_0x6382('0x17')]?_0x549868[_0x6382('0x17')][_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x549868[_0x6382('0x17')]['include'],function(_0x25d9de){return{'model':db[_0x25d9de[_0x6382('0x1d')]],'as':_0x25d9de['as'],'attributes':_0x25d9de[_0x6382('0x1a')],'include':_0x25d9de['include']?_[_0x6382('0x1c')](_0x25d9de[_0x6382('0x1b')],function(_0x5e6d62){return{'model':db[_0x5e6d62[_0x6382('0x1d')]],'as':_0x5e6d62['as'],'attributes':_0x5e6d62[_0x6382('0x1a')],'include':_0x5e6d62[_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x5e6d62[_0x6382('0x1b')],function(_0xf3902e){return{'model':db[_0xf3902e[_0x6382('0x1d')]],'as':_0xf3902e['as'],'attributes':_0xf3902e[_0x6382('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6382('0x1e')](function(_0x48ce0d){var _0x1eb12b=[];for(var _0x39f435=0x0;_0x39f435<_0x48ce0d[_0x6382('0x35')];_0x39f435+=0x1){_0x1eb12b[_0x6382('0x38')](_0x48ce0d[_0x39f435][_0x6382('0x25')](_0x549868[_0x6382('0x23')],{'transaction':_0x5c5bf0}));}return BPromise[_0x6382('0x39')](_0x1eb12b);});})['then'](function(_0xab44ad){logger[_0x6382('0xb')](_0x6382('0x43'),_0x549868);logger[_0x6382('0xe')](_0x6382('0x43'),_0x549868,JSON[_0x6382('0x10')](_0xab44ad));_0x1f1e8c(_0xab44ad);})[_0x6382('0x15')](function(_0x26c04d){logger[_0x6382('0x11')](_0x6382('0x43'),_0x26c04d[_0x6382('0x13')],_0x549868);_0x1f8d96(_0x430437['error'](0x1f4,_0x26c04d[_0x6382('0x13')]));});});});};exports[_0x6382('0x46')]=function(_0x2cb2e9){var _0x4c2af0=this;return new Promise(function(_0x4ba5a6,_0x1e823a){db['CmContact']['describe']()['then'](function(_0xc76a92){return db[_0x6382('0x22')]['findAll']({'raw':_0x2cb2e9[_0x6382('0x17')]?_0x2cb2e9[_0x6382('0x17')][_0x6382('0x18')]===undefined?!![]:![]:!![],'where':_0x2cb2e9['options']?_0x2cb2e9[_0x6382('0x17')][_0x6382('0x19')]||null:null,'attributes':_0x2cb2e9[_0x6382('0x17')]?_0x2cb2e9[_0x6382('0x17')][_0x6382('0x1a')]||null:null,'limit':_0x2cb2e9[_0x6382('0x17')]?_0x2cb2e9[_0x6382('0x17')]['limit']||null:null,'include':_0x2cb2e9[_0x6382('0x17')]?_0x2cb2e9[_0x6382('0x17')][_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x2cb2e9['options']['include'],function(_0x18ea21){return{'model':db[_0x18ea21[_0x6382('0x1d')]],'as':_0x18ea21['as'],'attributes':_0x18ea21['as']===_0x6382('0x30')?_[_0x6382('0x47')](_0xc76a92):_0x18ea21[_0x6382('0x1a')],'include':_0x18ea21[_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x18ea21[_0x6382('0x1b')],function(_0x52999d){return{'model':db[_0x52999d['model']],'as':_0x52999d['as'],'attributes':_0x52999d[_0x6382('0x1a')],'include':_0x52999d[_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x52999d['include'],function(_0x2f2494){return{'model':db[_0x2f2494[_0x6382('0x1d')]],'as':_0x2f2494['as'],'attributes':_0x2f2494[_0x6382('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6382('0x1e')](function(_0x462657){logger['info']('GetCmHopper',_0x2cb2e9);logger[_0x6382('0xe')](_0x6382('0x16'),_0x2cb2e9,JSON[_0x6382('0x10')](_0x462657));_0x4ba5a6(_0x462657);})[_0x6382('0x15')](function(_0x2de8c9){logger[_0x6382('0x11')](_0x6382('0x16'),_0x2de8c9[_0x6382('0x13')],_0x2cb2e9);_0x1e823a(_0x4c2af0['error'](0x1f4,_0x2de8c9[_0x6382('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 0205929..b005585 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 _0xae24=['post','create','/preview','getPreview','/timezone','getTimezone','put','exports','multer','path','express','Router','../../config/environment','get','isAuthenticated','index','/describe','/opencontacts','/timezones','getTimezones','/:id'];(function(_0x3a3728,_0x875599){var _0x279db6=function(_0x5ca7f9){while(--_0x5ca7f9){_0x3a3728['push'](_0x3a3728['shift']());}};_0x279db6(++_0x875599);}(_0xae24,0x182));var _0x4ae2=function(_0x2ff83c,_0x118a59){_0x2ff83c=_0x2ff83c-0x0;var _0x24fc7d=_0xae24[_0x2ff83c];return _0x24fc7d;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ae2('0x4'));var controller=require('./cmHopper.controller');router[_0x4ae2('0x5')]('/',auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x7')]);router[_0x4ae2('0x5')](_0x4ae2('0x8'),auth[_0x4ae2('0x6')](),controller['describe']);router['get'](_0x4ae2('0x9'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x4ae2('0x5')](_0x4ae2('0xa'),auth['isAuthenticated'](),controller[_0x4ae2('0xb')]);router[_0x4ae2('0x5')](_0x4ae2('0xc'),auth[_0x4ae2('0x6')](),controller['show']);router[_0x4ae2('0xd')]('/',auth[_0x4ae2('0x6')](),controller[_0x4ae2('0xe')]);router['post'](_0x4ae2('0xf'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x10')]);router[_0x4ae2('0xd')](_0x4ae2('0x11'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x12')]);router[_0x4ae2('0x13')](_0x4ae2('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4ae2('0xc'),auth[_0x4ae2('0x6')](),controller['destroy']);module[_0x4ae2('0x14')]=router; \ No newline at end of file +var _0x5fd1=['../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','get','/describe','/opencontacts','getTimezones','show','post','create','/preview','getPreview','put','/:id','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5fd1,0x155));var _0x15fd=function(_0x1d6558,_0x19ff10){_0x1d6558=_0x1d6558-0x0;var _0x57f383=_0x5fd1[_0x1d6558];return _0x57f383;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x15fd('0x4'));var config=require(_0x15fd('0x5'));var controller=require(_0x15fd('0x6'));router['get']('/',auth[_0x15fd('0x7')](),controller[_0x15fd('0x8')]);router[_0x15fd('0x9')](_0x15fd('0xa'),auth[_0x15fd('0x7')](),controller['describe']);router[_0x15fd('0x9')](_0x15fd('0xb'),auth[_0x15fd('0x7')](),controller['getOpenContacts']);router[_0x15fd('0x9')]('/timezones',auth[_0x15fd('0x7')](),controller[_0x15fd('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x15fd('0xd')]);router[_0x15fd('0xe')]('/',auth[_0x15fd('0x7')](),controller[_0x15fd('0xf')]);router[_0x15fd('0xe')](_0x15fd('0x10'),auth[_0x15fd('0x7')](),controller[_0x15fd('0x11')]);router[_0x15fd('0xe')]('/timezone',auth['isAuthenticated'](),controller['getTimezone']);router[_0x15fd('0x12')](_0x15fd('0x13'),auth[_0x15fd('0x7')](),controller[_0x15fd('0x14')]);router[_0x15fd('0x15')](_0x15fd('0x13'),auth[_0x15fd('0x7')](),controller[_0x15fd('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index c8d071e..700ee56 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5640=['format','moment','sequelize','INTEGER','STRING'];(function(_0x53a18f,_0x19e911){var _0x26b28c=function(_0x50dd5e){while(--_0x50dd5e){_0x53a18f['push'](_0x53a18f['shift']());}};_0x26b28c(++_0x19e911);}(_0x5640,0x1e1));var _0x0564=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5640[_0x59ee6f];return _0x4c0979;};'use strict';var moment=require(_0x0564('0x0'));var Sequelize=require(_0x0564('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x0564('0x2')]},'phone':{'type':Sequelize[_0x0564('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x0564('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x0564('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0564('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x0564('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0564('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0564('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0564('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x00d9=['INTEGER','STRING','format','moment','sequelize','exports'];(function(_0x5985f7,_0x569722){var _0x3f76ba=function(_0x47d9cb){while(--_0x47d9cb){_0x5985f7['push'](_0x5985f7['shift']());}};_0x3f76ba(++_0x569722);}(_0x00d9,0x165));var _0x900d=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x00d9[_0xefd519];return _0x4bb882;};'use strict';var moment=require(_0x900d('0x0'));var Sequelize=require(_0x900d('0x1'));module[_0x900d('0x2')]={'CmHopperId':{'type':Sequelize[_0x900d('0x3')]},'phone':{'type':Sequelize[_0x900d('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x900d('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x900d('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x900d('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x900d('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x900d('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x900d('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x900d('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x900d('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 03c2baa..6e91b55 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe329=['order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','find','catch','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','map','CmHopperAdditionalPhone','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x42049c,_0x411e74){var _0x5c4eb2=function(_0x1c7254){while(--_0x1c7254){_0x42049c['push'](_0x42049c['shift']());}};_0x5c4eb2(++_0x411e74);}(_0xe329,0x69));var _0x9e32=function(_0x2bb512,_0x4b1d96){_0x2bb512=_0x2bb512-0x0;var _0x83d61b=_0xe329[_0x2bb512];return _0x83d61b;};'use strict';var pdf=require(_0x9e32('0x0'));var emlformat=require(_0x9e32('0x1'));var rimraf=require(_0x9e32('0x2'));var zipdir=require(_0x9e32('0x3'));var jsonpatch=require(_0x9e32('0x4'));var rp=require('request-promise');var moment=require(_0x9e32('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9e32('0x6'));var path=require('path');var sox=require(_0x9e32('0x7'));var csv=require(_0x9e32('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9e32('0x9'));var squel=require(_0x9e32('0xa'));var crypto=require(_0x9e32('0xb'));var jsforce=require(_0x9e32('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9e32('0x8'));var querystring=require(_0x9e32('0xd'));var Papa=require(_0x9e32('0xe'));var Redis=require(_0x9e32('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9e32('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e32('0x11'))(_0x9e32('0x12'));var utils=require(_0x9e32('0x13'));var config=require(_0x9e32('0x14'));var db=require(_0x9e32('0x15'))['db'];function respondWithStatusCode(_0x540b55,_0x14affa){_0x14affa=_0x14affa||0xcc;return function(_0x136a7d){if(_0x136a7d){return _0x540b55[_0x9e32('0x16')](_0x14affa);}return _0x540b55[_0x9e32('0x17')](_0x14affa)[_0x9e32('0x18')]();};}function respondWithResult(_0x41da58,_0x12b893){_0x12b893=_0x12b893||0xc8;return function(_0xc521ca){if(_0xc521ca){return _0x41da58[_0x9e32('0x17')](_0x12b893)[_0x9e32('0x19')](_0xc521ca);}};}function respondWithFilteredResult(_0x5f2983,_0x34c632){return function(_0x51c004){if(_0x51c004){var _0x5e7197=_0x51c004[_0x9e32('0x1a')],_0x4f195e=_0x34c632[_0x9e32('0x1b')],_0x12268f=_0x34c632[_0x9e32('0x1b')]+_0x34c632[_0x9e32('0x1c')],_0x32fa59;if(_0x12268f>=_0x5e7197){_0x12268f=_0x5e7197;_0x32fa59=0xc8;}else{_0x32fa59=0xce;}_0x5f2983[_0x9e32('0x17')](_0x32fa59);return _0x5f2983[_0x9e32('0x1d')](_0x9e32('0x1e'),_0x4f195e+'-'+_0x12268f+'/'+_0x5e7197)['json'](_0x51c004);}return null;};}function patchUpdates(_0x4cffe4){return function(_0x449197){try{jsonpatch[_0x9e32('0x1f')](_0x449197,_0x4cffe4,!![]);}catch(_0x1ccad5){return BPromise[_0x9e32('0x20')](_0x1ccad5);}return _0x449197['save']();};}function saveUpdates(_0x1f060b,_0xc46054){return function(_0x117b56){if(_0x117b56){return _0x117b56[_0x9e32('0x21')](_0x1f060b)[_0x9e32('0x22')](function(_0x4dc276){return _0x4dc276;});}return null;};}function removeEntity(_0x353ef5,_0x4e7445){return function(_0x23fdd4){if(_0x23fdd4){return _0x23fdd4[_0x9e32('0x23')]()[_0x9e32('0x22')](function(){var _0x1ec593=_0x23fdd4[_0x9e32('0x24')]({'plain':!![]});var _0x5703cb=_0x9e32('0x25');return db[_0x9e32('0x26')]['destroy']({'where':{'type':_0x5703cb,'resourceId':_0x1ec593['id']}})[_0x9e32('0x22')](function(){return _0x23fdd4;});})[_0x9e32('0x22')](function(){_0x353ef5[_0x9e32('0x17')](0xcc)[_0x9e32('0x18')]();});}};}function handleEntityNotFound(_0x3dfe21,_0x438f26){return function(_0x5da331){if(!_0x5da331){_0x3dfe21[_0x9e32('0x16')](0x194);}return _0x5da331;};}function handleError(_0x109dad,_0x293d82){_0x293d82=_0x293d82||0x1f4;return function(_0x42bff3){logger[_0x9e32('0x27')](_0x42bff3[_0x9e32('0x28')]);if(_0x42bff3['name']){delete _0x42bff3[_0x9e32('0x29')];}_0x109dad[_0x9e32('0x17')](_0x293d82)['send'](_0x42bff3);};}exports['index']=function(_0x389f60,_0x52e3a5){var _0xd3ffc7={},_0x1a59ce={},_0x58e1e8={'count':0x0,'rows':[]};var _0x59e96d=_[_0x9e32('0x2a')](db[_0x9e32('0x2b')][_0x9e32('0x2c')],function(_0x28fee1){return{'name':_0x28fee1[_0x9e32('0x2d')],'type':_0x28fee1['type'][_0x9e32('0x2e')]};});_0x1a59ce['model']=_[_0x9e32('0x2a')](_0x59e96d,_0x9e32('0x29'));_0x1a59ce[_0x9e32('0x2f')]=_[_0x9e32('0x30')](_0x389f60['query']);_0x1a59ce[_0x9e32('0x31')]=_[_0x9e32('0x32')](_0x1a59ce[_0x9e32('0x33')],_0x1a59ce[_0x9e32('0x2f')]);_0xd3ffc7['attributes']=_[_0x9e32('0x32')](_0x1a59ce[_0x9e32('0x33')],qs[_0x9e32('0x34')](_0x389f60[_0x9e32('0x2f')][_0x9e32('0x34')]));_0xd3ffc7[_0x9e32('0x35')]=_0xd3ffc7[_0x9e32('0x35')][_0x9e32('0x36')]?_0xd3ffc7['attributes']:_0x1a59ce[_0x9e32('0x33')];if(!_0x389f60['query'][_0x9e32('0x37')](_0x9e32('0x38'))){_0xd3ffc7[_0x9e32('0x1c')]=qs[_0x9e32('0x1c')](_0x389f60[_0x9e32('0x2f')]['limit']);_0xd3ffc7['offset']=qs['offset'](_0x389f60['query'][_0x9e32('0x1b')]);}_0xd3ffc7[_0x9e32('0x39')]=qs[_0x9e32('0x3a')](_0x389f60[_0x9e32('0x2f')][_0x9e32('0x3a')]);_0xd3ffc7['where']=qs[_0x9e32('0x31')](_['pick'](_0x389f60[_0x9e32('0x2f')],_0x1a59ce[_0x9e32('0x31')]),_0x59e96d);if(_0x389f60[_0x9e32('0x2f')][_0x9e32('0x3b')]){_0xd3ffc7['where']=_['merge'](_0xd3ffc7[_0x9e32('0x3c')],{'$or':_[_0x9e32('0x2a')](_0x59e96d,function(_0x4a57c8){if(_0x4a57c8[_0x9e32('0x3d')]!==_0x9e32('0x3e')){var _0x4dae53={};_0x4dae53[_0x4a57c8[_0x9e32('0x29')]]={'$like':'%'+_0x389f60[_0x9e32('0x2f')][_0x9e32('0x3b')]+'%'};return _0x4dae53;}})});}_0xd3ffc7=_[_0x9e32('0x3f')]({},_0xd3ffc7,_0x389f60[_0x9e32('0x40')]);var _0x5a8094={'where':_0xd3ffc7['where']};return db[_0x9e32('0x2b')][_0x9e32('0x1a')](_0x5a8094)['then'](function(_0x41da23){_0x58e1e8[_0x9e32('0x1a')]=_0x41da23;if(_0x389f60[_0x9e32('0x2f')][_0x9e32('0x41')]){_0xd3ffc7['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x9e32('0x42')](_0xd3ffc7);})['then'](function(_0x8e91bb){_0x58e1e8[_0x9e32('0x43')]=_0x8e91bb;return _0x58e1e8;})['then'](respondWithFilteredResult(_0x52e3a5,_0xd3ffc7))['catch'](handleError(_0x52e3a5,null));};exports[_0x9e32('0x44')]=function(_0xa45ddb,_0x74111b){var _0x1d56a0={'raw':!![],'where':{'id':_0xa45ddb[_0x9e32('0x45')]['id']}},_0x5905f9={};_0x5905f9[_0x9e32('0x33')]=_[_0x9e32('0x30')](db[_0x9e32('0x2b')][_0x9e32('0x2c')]);_0x5905f9[_0x9e32('0x2f')]=_[_0x9e32('0x30')](_0xa45ddb[_0x9e32('0x2f')]);_0x5905f9['filters']=_[_0x9e32('0x32')](_0x5905f9['model'],_0x5905f9[_0x9e32('0x2f')]);_0x1d56a0['attributes']=_[_0x9e32('0x32')](_0x5905f9['model'],qs['fields'](_0xa45ddb['query'][_0x9e32('0x34')]));_0x1d56a0['attributes']=_0x1d56a0[_0x9e32('0x35')][_0x9e32('0x36')]?_0x1d56a0[_0x9e32('0x35')]:_0x5905f9['model'];if(_0xa45ddb['query'][_0x9e32('0x41')]){_0x1d56a0['include']=[{'all':!![]}];}_0x1d56a0=_['merge']({},_0x1d56a0,_0xa45ddb['options']);return db[_0x9e32('0x2b')][_0x9e32('0x46')](_0x1d56a0)[_0x9e32('0x22')](handleEntityNotFound(_0x74111b,null))['then'](respondWithResult(_0x74111b,null))[_0x9e32('0x47')](handleError(_0x74111b,null));};exports['create']=function(_0x88a756,_0x4cd60a){return db[_0x9e32('0x2b')]['create'](_0x88a756['body'],{})['then'](function(_0x2cbebe){var _0x340438=_0x88a756[_0x9e32('0x48')][_0x9e32('0x24')]({'plain':!![]});if(!_0x340438)throw new Error(_0x9e32('0x49'));if(_0x340438[_0x9e32('0x4a')]===_0x9e32('0x48')){var _0x3cb141=_0x2cbebe[_0x9e32('0x24')]({'plain':!![]});var _0x2f3813=_0x9e32('0x25');return db[_0x9e32('0x4b')][_0x9e32('0x46')]({'where':{'name':_0x2f3813,'userProfileId':_0x340438[_0x9e32('0x4c')]},'raw':!![]})[_0x9e32('0x22')](function(_0x11d8bd){if(_0x11d8bd&&_0x11d8bd[_0x9e32('0x4d')]===0x0){return db[_0x9e32('0x26')][_0x9e32('0x4e')]({'name':_0x3cb141[_0x9e32('0x29')],'resourceId':_0x3cb141['id'],'type':_0x11d8bd[_0x9e32('0x29')],'sectionId':_0x11d8bd['id']},{})[_0x9e32('0x22')](function(){return _0x2cbebe;});}else{return _0x2cbebe;}})[_0x9e32('0x47')](function(_0x27c681){logger[_0x9e32('0x27')](_0x9e32('0x4f'),_0x27c681);throw _0x27c681;});}return _0x2cbebe;})[_0x9e32('0x22')](respondWithResult(_0x4cd60a,0xc9))[_0x9e32('0x47')](handleError(_0x4cd60a,null));};exports['update']=function(_0x5e16da,_0x4b997d){if(_0x5e16da[_0x9e32('0x50')]['id']){delete _0x5e16da[_0x9e32('0x50')]['id'];}return db[_0x9e32('0x2b')][_0x9e32('0x46')]({'where':{'id':_0x5e16da[_0x9e32('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b997d,null))[_0x9e32('0x22')](saveUpdates(_0x5e16da[_0x9e32('0x50')],null))[_0x9e32('0x22')](respondWithResult(_0x4b997d,null))[_0x9e32('0x47')](handleError(_0x4b997d,null));};exports[_0x9e32('0x23')]=function(_0x5ca700,_0x3211ad){return db['CmHopperAdditionalPhone'][_0x9e32('0x46')]({'where':{'id':_0x5ca700[_0x9e32('0x45')]['id']}})['then'](handleEntityNotFound(_0x3211ad,null))[_0x9e32('0x22')](removeEntity(_0x3211ad,null))['catch'](handleError(_0x3211ad,null));}; \ No newline at end of file +var _0xc13a=['merge','where','VIRTUAL','options','findAll','rows','catch','params','fields','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','end','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc13a,0xbd));var _0xac13=function(_0x2159b6,_0x475180){_0x2159b6=_0x2159b6-0x0;var _0x10ee92=_0xc13a[_0x2159b6];return _0x10ee92;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xac13('0x0'));var rimraf=require(_0xac13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac13('0x2'));var rp=require(_0xac13('0x3'));var moment=require(_0xac13('0x4'));var BPromise=require(_0xac13('0x5'));var Mustache=require(_0xac13('0x6'));var util=require(_0xac13('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xac13('0x8'));var ejs=require(_0xac13('0x9'));var fs=require('fs');var _=require(_0xac13('0xa'));var squel=require(_0xac13('0xb'));var crypto=require(_0xac13('0xc'));var jsforce=require(_0xac13('0xd'));var deskjs=require(_0xac13('0xe'));var toCsv=require('to-csv');var querystring=require(_0xac13('0xf'));var Papa=require(_0xac13('0x10'));var Redis=require(_0xac13('0x11'));var authService=require(_0xac13('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xac13('0x13'));var hardwareService=require(_0xac13('0x14'));var logger=require(_0xac13('0x15'))(_0xac13('0x16'));var utils=require('../../config/utils');var config=require(_0xac13('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30f63a,_0x4135c0){_0x4135c0=_0x4135c0||0xcc;return function(_0x102c37){if(_0x102c37){return _0x30f63a[_0xac13('0x18')](_0x4135c0);}return _0x30f63a[_0xac13('0x19')](_0x4135c0)['end']();};}function respondWithResult(_0xae7a1d,_0x321e2e){_0x321e2e=_0x321e2e||0xc8;return function(_0x2c82a5){if(_0x2c82a5){return _0xae7a1d[_0xac13('0x19')](_0x321e2e)['json'](_0x2c82a5);}};}function respondWithFilteredResult(_0x431dae,_0x1cfcfc){return function(_0x4aa789){if(_0x4aa789){var _0x4f90cb=_0x4aa789[_0xac13('0x1a')],_0x3c5000=_0x1cfcfc[_0xac13('0x1b')],_0x4f6bb7=_0x1cfcfc[_0xac13('0x1b')]+_0x1cfcfc[_0xac13('0x1c')],_0x5f2c7f;if(_0x4f6bb7>=_0x4f90cb){_0x4f6bb7=_0x4f90cb;_0x5f2c7f=0xc8;}else{_0x5f2c7f=0xce;}_0x431dae[_0xac13('0x19')](_0x5f2c7f);return _0x431dae[_0xac13('0x1d')](_0xac13('0x1e'),_0x3c5000+'-'+_0x4f6bb7+'/'+_0x4f90cb)['json'](_0x4aa789);}return null;};}function patchUpdates(_0x39316c){return function(_0x514d54){try{jsonpatch[_0xac13('0x1f')](_0x514d54,_0x39316c,!![]);}catch(_0x5f1425){return BPromise[_0xac13('0x20')](_0x5f1425);}return _0x514d54[_0xac13('0x21')]();};}function saveUpdates(_0x155289,_0x3ae857){return function(_0x30f793){if(_0x30f793){return _0x30f793[_0xac13('0x22')](_0x155289)[_0xac13('0x23')](function(_0x4dfe65){return _0x4dfe65;});}return null;};}function removeEntity(_0x201e01,_0x4be8d7){return function(_0x5eef5f){if(_0x5eef5f){return _0x5eef5f[_0xac13('0x24')]()[_0xac13('0x23')](function(){var _0x1dc516=_0x5eef5f[_0xac13('0x25')]({'plain':!![]});var _0xc0ae25=_0xac13('0x26');return db['UserProfileResource'][_0xac13('0x24')]({'where':{'type':_0xc0ae25,'resourceId':_0x1dc516['id']}})['then'](function(){return _0x5eef5f;});})[_0xac13('0x23')](function(){_0x201e01[_0xac13('0x19')](0xcc)[_0xac13('0x27')]();});}};}function handleEntityNotFound(_0x421914,_0x1dd53b){return function(_0x376994){if(!_0x376994){_0x421914[_0xac13('0x18')](0x194);}return _0x376994;};}function handleError(_0xc08003,_0x4aabb3){_0x4aabb3=_0x4aabb3||0x1f4;return function(_0x2f26b9){logger[_0xac13('0x28')](_0x2f26b9[_0xac13('0x29')]);if(_0x2f26b9[_0xac13('0x2a')]){delete _0x2f26b9[_0xac13('0x2a')];}_0xc08003[_0xac13('0x19')](_0x4aabb3)[_0xac13('0x2b')](_0x2f26b9);};}exports[_0xac13('0x2c')]=function(_0x146db2,_0x3deb10){var _0x274572={},_0x53263e={},_0x5c8642={'count':0x0,'rows':[]};var _0x2dc571=_[_0xac13('0x2d')](db[_0xac13('0x2e')][_0xac13('0x2f')],function(_0x3038ec){return{'name':_0x3038ec['fieldName'],'type':_0x3038ec[_0xac13('0x30')][_0xac13('0x31')]};});_0x53263e['model']=_['map'](_0x2dc571,_0xac13('0x2a'));_0x53263e[_0xac13('0x32')]=_[_0xac13('0x33')](_0x146db2[_0xac13('0x32')]);_0x53263e[_0xac13('0x34')]=_['intersection'](_0x53263e['model'],_0x53263e['query']);_0x274572[_0xac13('0x35')]=_[_0xac13('0x36')](_0x53263e[_0xac13('0x37')],qs['fields'](_0x146db2['query']['fields']));_0x274572[_0xac13('0x35')]=_0x274572[_0xac13('0x35')][_0xac13('0x38')]?_0x274572[_0xac13('0x35')]:_0x53263e['model'];if(!_0x146db2[_0xac13('0x32')][_0xac13('0x39')](_0xac13('0x3a'))){_0x274572[_0xac13('0x1c')]=qs[_0xac13('0x1c')](_0x146db2['query']['limit']);_0x274572[_0xac13('0x1b')]=qs[_0xac13('0x1b')](_0x146db2[_0xac13('0x32')][_0xac13('0x1b')]);}_0x274572[_0xac13('0x3b')]=qs[_0xac13('0x3c')](_0x146db2[_0xac13('0x32')]['sort']);_0x274572['where']=qs[_0xac13('0x34')](_[_0xac13('0x3d')](_0x146db2['query'],_0x53263e[_0xac13('0x34')]),_0x2dc571);if(_0x146db2[_0xac13('0x32')][_0xac13('0x3e')]){_0x274572['where']=_[_0xac13('0x3f')](_0x274572[_0xac13('0x40')],{'$or':_[_0xac13('0x2d')](_0x2dc571,function(_0x17707){if(_0x17707[_0xac13('0x30')]!==_0xac13('0x41')){var _0x3b0c29={};_0x3b0c29[_0x17707[_0xac13('0x2a')]]={'$like':'%'+_0x146db2['query'][_0xac13('0x3e')]+'%'};return _0x3b0c29;}})});}_0x274572=_[_0xac13('0x3f')]({},_0x274572,_0x146db2[_0xac13('0x42')]);var _0x2b55a1={'where':_0x274572[_0xac13('0x40')]};return db[_0xac13('0x2e')][_0xac13('0x1a')](_0x2b55a1)['then'](function(_0x53db13){_0x5c8642[_0xac13('0x1a')]=_0x53db13;if(_0x146db2[_0xac13('0x32')]['includeAll']){_0x274572['include']=[{'all':!![]}];}return db[_0xac13('0x2e')][_0xac13('0x43')](_0x274572);})['then'](function(_0x370dde){_0x5c8642[_0xac13('0x44')]=_0x370dde;return _0x5c8642;})['then'](respondWithFilteredResult(_0x3deb10,_0x274572))[_0xac13('0x45')](handleError(_0x3deb10,null));};exports['show']=function(_0x1a3d72,_0x52491d){var _0x346266={'raw':!![],'where':{'id':_0x1a3d72[_0xac13('0x46')]['id']}},_0x2089d3={};_0x2089d3[_0xac13('0x37')]=_[_0xac13('0x33')](db[_0xac13('0x2e')][_0xac13('0x2f')]);_0x2089d3['query']=_[_0xac13('0x33')](_0x1a3d72[_0xac13('0x32')]);_0x2089d3[_0xac13('0x34')]=_[_0xac13('0x36')](_0x2089d3['model'],_0x2089d3['query']);_0x346266[_0xac13('0x35')]=_[_0xac13('0x36')](_0x2089d3[_0xac13('0x37')],qs[_0xac13('0x47')](_0x1a3d72[_0xac13('0x32')][_0xac13('0x47')]));_0x346266[_0xac13('0x35')]=_0x346266[_0xac13('0x35')][_0xac13('0x38')]?_0x346266[_0xac13('0x35')]:_0x2089d3[_0xac13('0x37')];if(_0x1a3d72['query'][_0xac13('0x48')]){_0x346266[_0xac13('0x49')]=[{'all':!![]}];}_0x346266=_[_0xac13('0x3f')]({},_0x346266,_0x1a3d72['options']);return db[_0xac13('0x2e')][_0xac13('0x4a')](_0x346266)[_0xac13('0x23')](handleEntityNotFound(_0x52491d,null))['then'](respondWithResult(_0x52491d,null))['catch'](handleError(_0x52491d,null));};exports[_0xac13('0x4b')]=function(_0x2d075f,_0x5670b5){return db[_0xac13('0x2e')]['create'](_0x2d075f['body'],{})[_0xac13('0x23')](function(_0x351985){var _0x467636=_0x2d075f[_0xac13('0x4c')][_0xac13('0x25')]({'plain':!![]});if(!_0x467636)throw new Error(_0xac13('0x4d'));if(_0x467636[_0xac13('0x4e')]==='user'){var _0x3ef6ac=_0x351985[_0xac13('0x25')]({'plain':!![]});var _0x4684d0=_0xac13('0x26');return db[_0xac13('0x4f')][_0xac13('0x4a')]({'where':{'name':_0x4684d0,'userProfileId':_0x467636[_0xac13('0x50')]},'raw':!![]})[_0xac13('0x23')](function(_0x42c02a){if(_0x42c02a&&_0x42c02a[_0xac13('0x51')]===0x0){return db[_0xac13('0x52')]['create']({'name':_0x3ef6ac[_0xac13('0x2a')],'resourceId':_0x3ef6ac['id'],'type':_0x42c02a['name'],'sectionId':_0x42c02a['id']},{})[_0xac13('0x23')](function(){return _0x351985;});}else{return _0x351985;}})[_0xac13('0x45')](function(_0x32d703){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32d703);throw _0x32d703;});}return _0x351985;})[_0xac13('0x23')](respondWithResult(_0x5670b5,0xc9))['catch'](handleError(_0x5670b5,null));};exports[_0xac13('0x22')]=function(_0x480b97,_0x2f7d8d){if(_0x480b97['body']['id']){delete _0x480b97[_0xac13('0x53')]['id'];}return db[_0xac13('0x2e')]['find']({'where':{'id':_0x480b97[_0xac13('0x46')]['id']}})[_0xac13('0x23')](handleEntityNotFound(_0x2f7d8d,null))[_0xac13('0x23')](saveUpdates(_0x480b97[_0xac13('0x53')],null))[_0xac13('0x23')](respondWithResult(_0x2f7d8d,null))[_0xac13('0x45')](handleError(_0x2f7d8d,null));};exports[_0xac13('0x24')]=function(_0x423f71,_0x10b288){return db[_0xac13('0x2e')][_0xac13('0x4a')]({'where':{'id':_0x423f71[_0xac13('0x46')]['id']}})['then'](handleEntityNotFound(_0x10b288,null))[_0xac13('0x23')](removeEntity(_0x10b288,null))[_0xac13('0x45')](handleError(_0x10b288,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 43122ab..362b545 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1a7=['../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x45815e,_0x1d806b){var _0x417b60=function(_0x2530ba){while(--_0x2530ba){_0x45815e['push'](_0x45815e['shift']());}};_0x417b60(++_0x1d806b);}(_0xa1a7,0x67));var _0x7a1a=function(_0x54fe4e,_0x153ebc){_0x54fe4e=_0x54fe4e-0x0;var _0x21ceae=_0xa1a7[_0x54fe4e];return _0x21ceae;};'use strict';var _=require(_0x7a1a('0x0'));var util=require(_0x7a1a('0x1'));var logger=require(_0x7a1a('0x2'))(_0x7a1a('0x3'));var moment=require(_0x7a1a('0x4'));var BPromise=require(_0x7a1a('0x5'));var rp=require(_0x7a1a('0x6'));var fs=require('fs');var path=require(_0x7a1a('0x7'));var rimraf=require(_0x7a1a('0x8'));var config=require(_0x7a1a('0x9'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x7a1a('0xa')]=function(_0x1e204c,_0x25b113){return _0x1e204c[_0x7a1a('0xb')](_0x7a1a('0xc'),attributes,{'tableName':_0x7a1a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcf0=['CmHopperAdditionalPhone','cm_hopper_additional_phones','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcf0,0x122));var _0x0dcf=function(_0xc6130f,_0xa02ab4){_0xc6130f=_0xc6130f-0x0;var _0x4b9ee7=_0xdcf0[_0xc6130f];return _0x4b9ee7;};'use strict';var _=require('lodash');var util=require(_0x0dcf('0x0'));var logger=require(_0x0dcf('0x1'))('api');var moment=require(_0x0dcf('0x2'));var BPromise=require('bluebird');var rp=require(_0x0dcf('0x3'));var fs=require('fs');var path=require(_0x0dcf('0x4'));var rimraf=require(_0x0dcf('0x5'));var config=require(_0x0dcf('0x6'));var attributes=require(_0x0dcf('0x7'));module[_0x0dcf('0x8')]=function(_0x274a8c,_0x2a8edf){return _0x274a8c[_0x0dcf('0x9')](_0x0dcf('0xa'),attributes,{'tableName':_0x0dcf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 9c6646a..668e1c8 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba9c=['hopperToAdd','additionalToHop','update','IncrementPreviewCounters','field','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','findOne','countcongestionretry','countdropretry','CampaignId','duration','waitTime','scheduledat','add','minutes','countnosuchnumberretry','createdAt','updatedAt','phone'];(function(_0x369e27,_0x7f5136){var _0x15b494=function(_0x4bca8d){while(--_0x4bca8d){_0x369e27['push'](_0x369e27['shift']());}};_0x15b494(++_0x7f5136);}(_0xba9c,0xad));var _0xcba9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xcba9('0x0'));var moment=require(_0xcba9('0x1'));var BPromise=require(_0xcba9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcba9('0x3'));var db=require(_0xcba9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcba9('0x5'))(_0xcba9('0x6'));var config=require(_0xcba9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcba9('0x8')][_0xcba9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x98f66c,_0x2a3c6b,_0x5653bb){return new BPromise(function(_0x576e9c,_0x4a11da){return client[_0xcba9('0xa')](_0x98f66c,_0x5653bb)['then'](function(_0x39815f){logger[_0xcba9('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2a3c6b,'request\x20sent');logger[_0xcba9('0xc')](_0xcba9('0xd'),_0x2a3c6b,_0xcba9('0xe'),JSON['stringify'](_0x39815f));if(_0x39815f[_0xcba9('0xf')]){if(_0x39815f[_0xcba9('0xf')][_0xcba9('0x10')]===0x1f4){logger['error'](_0xcba9('0x11'),_0x2a3c6b,_0x39815f[_0xcba9('0xf')][_0xcba9('0x12')]);return _0x4a11da(_0x39815f[_0xcba9('0xf')][_0xcba9('0x12')]);}logger[_0xcba9('0xf')](_0xcba9('0x11'),_0x2a3c6b,_0x39815f[_0xcba9('0xf')][_0xcba9('0x12')]);return _0x576e9c(_0x39815f[_0xcba9('0xf')][_0xcba9('0x12')]);}else{logger['info'](_0xcba9('0x11'),_0x2a3c6b,_0xcba9('0xe'));_0x576e9c(_0x39815f[_0xcba9('0x13')][_0xcba9('0x12')]);}})[_0xcba9('0x14')](function(_0xc2d12c){logger[_0xcba9('0xf')](_0xcba9('0x11'),_0x2a3c6b,_0xc2d12c);_0x4a11da(_0xc2d12c);});});}exports[_0xcba9('0x15')]=function(_0xf22f9){var _0x523c53=this;return new Promise(function(_0x120761,_0x50a833){return db[_0xcba9('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0xf22f9[_0xcba9('0x17')][_0xcba9('0x18')],'ListId':_0xf22f9[_0xcba9('0x17')][_0xcba9('0x19')],'VoiceQueueId':_0xf22f9[_0xcba9('0x17')][_0xcba9('0x1a')]===undefined?null:_0xf22f9[_0xcba9('0x17')][_0xcba9('0x1a')],'CampaignId':_0xf22f9[_0xcba9('0x17')]['CampaignId']===undefined?null:_0xf22f9[_0xcba9('0x17')]['CampaignId']}})[_0xcba9('0x1b')](function(_0x4592af){if(_0x4592af!=null){return db[_0xcba9('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4592af['id'],'OrderBy':{'$gt':_0x4592af[_0xcba9('0x1d')]}},'order':[[_0xcba9('0x1d'),_0xcba9('0x1e')]]})[_0xcba9('0x1b')](function(_0x261b49){var _0xa4a3e1=0x0;if(_0x261b49){if(_0x261b49[_0xcba9('0x1f')]+_0x261b49['countcongestionretry']+_0x261b49[_0xcba9('0x20')]+_0x261b49['countnosuchnumberretry']+_0x261b49['countdropretry']+_0x261b49[_0xcba9('0x21')]+_0x261b49[_0xcba9('0x22')]+_0x261b49[_0xcba9('0x23')]<_0xf22f9[_0xcba9('0x24')][_0xcba9('0x25')])_0xa4a3e1=0x1;_0x120761({'additional':_0xa4a3e1});}else{return db[_0xcba9('0x1c')][_0xcba9('0x26')]({'raw':!![],'where':{'CmHopperId':_0x4592af['id']},'order':[[_0xcba9('0x1d'),_0xcba9('0x1e')]]})[_0xcba9('0x1b')](function(_0x3dbb0a){var _0x13b86f=0x0;if(_0x3dbb0a){if(_0x3dbb0a[_0xcba9('0x1f')]+_0x3dbb0a[_0xcba9('0x27')]+_0x3dbb0a['countnoanswerretry']+_0x3dbb0a['countnosuchnumberretry']+_0x3dbb0a[_0xcba9('0x28')]+_0x3dbb0a[_0xcba9('0x21')]+_0x3dbb0a['countmachineretry']+_0x3dbb0a[_0xcba9('0x23')]<_0xf22f9[_0xcba9('0x24')][_0xcba9('0x25')])_0x13b86f=0x1;_0x120761({'additional':_0x13b86f});}else{_0x120761({'additional':0x0});}})[_0xcba9('0x14')](function(_0x11a0b5){logger[_0xcba9('0xf')]('VerifyAdditionalPhones',_0x11a0b5['message'],_0xf22f9);_0x50a833(_0x523c53[_0xcba9('0xf')](0x1f4,_0x11a0b5['message']));});}})[_0xcba9('0x14')](function(_0x39a8bc){logger['error'](_0xcba9('0x15'),_0x39a8bc[_0xcba9('0x12')],_0xf22f9);_0x50a833(_0x523c53[_0xcba9('0xf')](0x1f4,_0x39a8bc[_0xcba9('0x12')]));});}else _0x120761({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x5644d4){var _0x539d3b=this;return new Promise(function(_0x363f5b,_0x5315f5){return db['CmHopper'][_0xcba9('0x26')]({'raw':!![],'where':{'ContactId':_0x5644d4['body'][_0xcba9('0x18')],'ListId':_0x5644d4[_0xcba9('0x17')][_0xcba9('0x19')],'VoiceQueueId':_0x5644d4[_0xcba9('0x17')]['VoiceQueueId']===undefined?null:_0x5644d4[_0xcba9('0x17')][_0xcba9('0x1a')],'CampaignId':_0x5644d4[_0xcba9('0x17')]['CampaignId']===undefined?null:_0x5644d4['body'][_0xcba9('0x29')]}})[_0xcba9('0x1b')](function(_0x1e5a76){if(_0x1e5a76!=null){return db[_0xcba9('0x1c')][_0xcba9('0x26')]({'raw':!![],'where':{'CmHopperId':_0x1e5a76['id'],'OrderBy':{'$gt':_0x1e5a76[_0xcba9('0x1d')]}},'order':[['OrderBy',_0xcba9('0x1e')]]})[_0xcba9('0x1b')](function(_0x17ca58){if(_0x17ca58)return activateAdditionalPhone(_0x1e5a76,_0x5644d4[_0xcba9('0x17')],_0x17ca58,_0x5644d4[_0xcba9('0x2a')],_0x5644d4['waitTime'])[_0xcba9('0x1b')](function(_0x547463){_0x363f5b(_0x547463);});else{return db[_0xcba9('0x1c')][_0xcba9('0x26')]({'raw':!![],'where':{'CmHopperId':_0x1e5a76['id']},'order':[[_0xcba9('0x1d'),'ASC']]})[_0xcba9('0x1b')](function(_0x2a16c5){if(_0x2a16c5)return activateAdditionalPhone(_0x1e5a76,_0x5644d4['body'],_0x2a16c5,_0x5644d4['duration'],_0x5644d4[_0xcba9('0x2b')])[_0xcba9('0x1b')](function(_0x404816){_0x363f5b(_0x404816);});else{_0x363f5b({'id':_0x1e5a76['id'],'phone':''});}})[_0xcba9('0x14')](function(_0xda9343){logger[_0xcba9('0xf')](_0xcba9('0x15'),_0xda9343[_0xcba9('0x12')],_0x5644d4);_0x5315f5(_0x539d3b[_0xcba9('0xf')](0x1f4,_0xda9343[_0xcba9('0x12')]));});}})[_0xcba9('0x14')](function(_0x49c8d3){logger[_0xcba9('0xf')]('VerifyAdditionalPhones',_0x49c8d3[_0xcba9('0x12')],_0x5644d4);_0x5315f5(_0x539d3b[_0xcba9('0xf')](0x1f4,_0x49c8d3[_0xcba9('0x12')]));});}else _0x363f5b(0x1);});});};function activateAdditionalPhone(_0x225590,_0x230bef,_0x31d8c6,_0x9b561e,_0x588a7f){return new Promise(function(_0x3e4149,_0x31bd1c){logger[_0xcba9('0xb')](_0xcba9('0x15'),_0x31d8c6);var _0x3856f2;if(moment()>moment(_0x31d8c6[_0xcba9('0x2c')])){_0x3856f2=moment()[_0xcba9('0x2d')](_0x588a7f||0x3,_0xcba9('0x2e'));}else{if(_0x31d8c6[_0xcba9('0x1d')]==0x0){_0x3856f2=moment(_0x31d8c6['scheduledat']);}else{_0x3856f2=moment()[_0xcba9('0x2d')](_0x588a7f||0x3,_0xcba9('0x2e'));}}var _0x361a38={'phone':_0x225590['phone'],'active':0x0,'OrderBy':_['isNil'](_0x225590[_0xcba9('0x1d')])?0x0:_0x225590[_0xcba9('0x1d')],'scheduledat':moment()[_0xcba9('0x2d')](_0x9b561e||0x1,_0xcba9('0x2e')),'countbusyretry':_0x230bef[_0xcba9('0x1f')],'countcongestionretry':_0x230bef[_0xcba9('0x27')],'countnoanswerretry':_0x230bef['countnoanswerretry'],'countnosuchnumberretry':_0x230bef[_0xcba9('0x2f')],'countdropretry':_0x230bef[_0xcba9('0x28')],'countabandonedretry':_0x230bef[_0xcba9('0x21')],'countmachineretry':_0x230bef[_0xcba9('0x22')],'countagentrejectretry':_0x230bef['countagentrejectretry'],'createdAt':_0x230bef[_0xcba9('0x30')],'updatedAt':_0x230bef[_0xcba9('0x31')]};var _0x39a586={'CmHopperId':_0x225590['id'],'phone':_0x31d8c6[_0xcba9('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x31d8c6['OrderBy'])?0x0:_0x31d8c6['OrderBy'],'scheduledat':_0x3856f2,'countbusyretry':_0x31d8c6[_0xcba9('0x1f')],'countcongestionretry':_0x31d8c6[_0xcba9('0x27')],'countnoanswerretry':_0x31d8c6['countnoanswerretry'],'countnosuchnumberretry':_0x230bef['countnosuchnumberretry'],'countdropretry':_0x230bef['countdropretry'],'countabandonedretry':_0x230bef[_0xcba9('0x21')],'countmachineretry':_0x230bef[_0xcba9('0x22')],'countagentrejectretry':_0x230bef[_0xcba9('0x23')],'createdAt':_0x31d8c6[_0xcba9('0x30')],'updatedAt':_0x31d8c6[_0xcba9('0x31')]};logger['info'](_0xcba9('0x33'),_0x361a38);logger['info'](_0xcba9('0x34'),_0x39a586);return db['sequelize']['transaction'](function(_0x3ad21e){return db[_0xcba9('0x1c')]['update'](_0x361a38,{'where':{'id':_0x31d8c6['id']}},{'transaction':_0x3ad21e})[_0xcba9('0x1b')](function(){return db[_0xcba9('0x16')][_0xcba9('0x35')](_0x39a586,{'where':{'id':_0x225590['id']}},{'transaction':_0x3ad21e});});})[_0xcba9('0x1b')](function(_0x10461a){_0x3e4149({'id':_0x225590['id'],'phone':_0x31d8c6[_0xcba9('0x32')]});})[_0xcba9('0x14')](function(_0xcc9c61){logger[_0xcba9('0xf')](_0xcba9('0x15'),_0xcc9c61[_0xcba9('0x12')],req);_0x31bd1c(_this[_0xcba9('0xf')](0x1f4,_0xcc9c61[_0xcba9('0x12')]));});});}exports[_0xcba9('0x36')]=function(_0x1899f6){var _0x3fc75e=this;return new Promise(function(_0x1519e0,_0x30e847){return db['CmHopper'][_0xcba9('0x35')](_0x1899f6[_0xcba9('0x17')][_0xcba9('0x37')],{'where':{'id':_0x1899f6[_0xcba9('0x17')]['id']}})['then'](function(_0x15a094){_0x1519e0(_0x15a094);})[_0xcba9('0x14')](function(_0x945aea){logger[_0xcba9('0xf')](_0xcba9('0x36'),_0x945aea[_0xcba9('0x12')],_0x1899f6);_0x30e847(_0x3fc75e[_0xcba9('0xf')](0x1f4,_0x945aea[_0xcba9('0x12')]));});});}; \ No newline at end of file +var _0x0519=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','dialGlobalMaxRetry','countdropretry','countagentrejectretry','entity','waitTime','duration','scheduledat','add','minutes','phone','isNil','countmachineretry','createdAt','updatedAt','hopperToAdd','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0x0519,0x1ae));var _0x9051=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0x0519[_0x1cc961];return _0x471d86;};'use strict';var _=require(_0x9051('0x0'));var util=require(_0x9051('0x1'));var moment=require(_0x9051('0x2'));var BPromise=require(_0x9051('0x3'));var rs=require(_0x9051('0x4'));var fs=require('fs');var Redis=require(_0x9051('0x5'));var db=require(_0x9051('0x6'))['db'];var utils=require(_0x9051('0x7'));var logger=require(_0x9051('0x8'))(_0x9051('0x9'));var config=require('../../config/environment');var jayson=require(_0x9051('0xa'));var client=jayson['client'][_0x9051('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc8fd32,_0x26d157,_0x3024b2){return new BPromise(function(_0x2c75c9,_0x4e393a){return client[_0x9051('0xc')](_0xc8fd32,_0x3024b2)['then'](function(_0xa8c7cf){logger[_0x9051('0xd')](_0x9051('0xe'),_0x26d157,_0x9051('0xf'));logger[_0x9051('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x26d157,_0x9051('0xf'),JSON['stringify'](_0xa8c7cf));if(_0xa8c7cf[_0x9051('0x11')]){if(_0xa8c7cf[_0x9051('0x11')]['code']===0x1f4){logger['error'](_0x9051('0xe'),_0x26d157,_0xa8c7cf[_0x9051('0x11')]['message']);return _0x4e393a(_0xa8c7cf[_0x9051('0x11')]['message']);}logger[_0x9051('0x11')](_0x9051('0xe'),_0x26d157,_0xa8c7cf[_0x9051('0x11')][_0x9051('0x12')]);return _0x2c75c9(_0xa8c7cf[_0x9051('0x11')][_0x9051('0x12')]);}else{logger['info'](_0x9051('0xe'),_0x26d157,'request\x20sent');_0x2c75c9(_0xa8c7cf[_0x9051('0x13')]['message']);}})[_0x9051('0x14')](function(_0x4ee921){logger[_0x9051('0x11')](_0x9051('0xe'),_0x26d157,_0x4ee921);_0x4e393a(_0x4ee921);});});}exports[_0x9051('0x15')]=function(_0x3a0e8a){var _0x500c2e=this;return new Promise(function(_0x226798,_0x289870){return db[_0x9051('0x16')][_0x9051('0x17')]({'raw':!![],'where':{'ContactId':_0x3a0e8a[_0x9051('0x18')][_0x9051('0x19')],'ListId':_0x3a0e8a[_0x9051('0x18')][_0x9051('0x1a')],'VoiceQueueId':_0x3a0e8a['body'][_0x9051('0x1b')]===undefined?null:_0x3a0e8a[_0x9051('0x18')][_0x9051('0x1b')],'CampaignId':_0x3a0e8a[_0x9051('0x18')][_0x9051('0x1c')]===undefined?null:_0x3a0e8a['body'][_0x9051('0x1c')]}})[_0x9051('0x1d')](function(_0x43e09e){if(_0x43e09e!=null){return db[_0x9051('0x1e')][_0x9051('0x17')]({'raw':!![],'where':{'CmHopperId':_0x43e09e['id'],'OrderBy':{'$gt':_0x43e09e[_0x9051('0x1f')]}},'order':[['OrderBy',_0x9051('0x20')]]})[_0x9051('0x1d')](function(_0x50d150){var _0x2f6179=0x0;if(_0x50d150){if(_0x50d150[_0x9051('0x21')]+_0x50d150[_0x9051('0x22')]+_0x50d150[_0x9051('0x23')]+_0x50d150[_0x9051('0x24')]+_0x50d150['countdropretry']+_0x50d150[_0x9051('0x25')]+_0x50d150['countmachineretry']+_0x50d150['countagentrejectretry']<_0x3a0e8a['entity'][_0x9051('0x26')])_0x2f6179=0x1;_0x226798({'additional':_0x2f6179});}else{return db[_0x9051('0x1e')][_0x9051('0x17')]({'raw':!![],'where':{'CmHopperId':_0x43e09e['id']},'order':[[_0x9051('0x1f'),_0x9051('0x20')]]})[_0x9051('0x1d')](function(_0x582552){var _0x3f7dac=0x0;if(_0x582552){if(_0x582552[_0x9051('0x21')]+_0x582552[_0x9051('0x22')]+_0x582552[_0x9051('0x23')]+_0x582552[_0x9051('0x24')]+_0x582552[_0x9051('0x27')]+_0x582552[_0x9051('0x25')]+_0x582552['countmachineretry']+_0x582552[_0x9051('0x28')]<_0x3a0e8a[_0x9051('0x29')]['dialGlobalMaxRetry'])_0x3f7dac=0x1;_0x226798({'additional':_0x3f7dac});}else{_0x226798({'additional':0x0});}})[_0x9051('0x14')](function(_0x585302){logger[_0x9051('0x11')](_0x9051('0x15'),_0x585302[_0x9051('0x12')],_0x3a0e8a);_0x289870(_0x500c2e[_0x9051('0x11')](0x1f4,_0x585302[_0x9051('0x12')]));});}})[_0x9051('0x14')](function(_0x37bb17){logger[_0x9051('0x11')](_0x9051('0x15'),_0x37bb17[_0x9051('0x12')],_0x3a0e8a);_0x289870(_0x500c2e[_0x9051('0x11')](0x1f4,_0x37bb17['message']));});}else _0x226798({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x2e6f45){var _0x2b6bd5=this;return new Promise(function(_0x19f802,_0x45453f){return db[_0x9051('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x2e6f45['body'][_0x9051('0x19')],'ListId':_0x2e6f45['body'][_0x9051('0x1a')],'VoiceQueueId':_0x2e6f45[_0x9051('0x18')][_0x9051('0x1b')]===undefined?null:_0x2e6f45[_0x9051('0x18')][_0x9051('0x1b')],'CampaignId':_0x2e6f45['body']['CampaignId']===undefined?null:_0x2e6f45[_0x9051('0x18')]['CampaignId']}})[_0x9051('0x1d')](function(_0x1661c5){if(_0x1661c5!=null){return db[_0x9051('0x1e')][_0x9051('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1661c5['id'],'OrderBy':{'$gt':_0x1661c5[_0x9051('0x1f')]}},'order':[['OrderBy',_0x9051('0x20')]]})[_0x9051('0x1d')](function(_0x5a2041){if(_0x5a2041)return activateAdditionalPhone(_0x1661c5,_0x2e6f45[_0x9051('0x18')],_0x5a2041,_0x2e6f45['duration'],_0x2e6f45[_0x9051('0x2a')])[_0x9051('0x1d')](function(_0x4c1776){_0x19f802(_0x4c1776);});else{return db[_0x9051('0x1e')][_0x9051('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1661c5['id']},'order':[[_0x9051('0x1f'),'ASC']]})['then'](function(_0x3545ea){if(_0x3545ea)return activateAdditionalPhone(_0x1661c5,_0x2e6f45['body'],_0x3545ea,_0x2e6f45[_0x9051('0x2b')],_0x2e6f45[_0x9051('0x2a')])['then'](function(_0x2d2180){_0x19f802(_0x2d2180);});else{_0x19f802({'id':_0x1661c5['id'],'phone':''});}})[_0x9051('0x14')](function(_0x50db3d){logger[_0x9051('0x11')](_0x9051('0x15'),_0x50db3d[_0x9051('0x12')],_0x2e6f45);_0x45453f(_0x2b6bd5[_0x9051('0x11')](0x1f4,_0x50db3d[_0x9051('0x12')]));});}})[_0x9051('0x14')](function(_0x33622e){logger[_0x9051('0x11')](_0x9051('0x15'),_0x33622e[_0x9051('0x12')],_0x2e6f45);_0x45453f(_0x2b6bd5[_0x9051('0x11')](0x1f4,_0x33622e[_0x9051('0x12')]));});}else _0x19f802(0x1);});});};function activateAdditionalPhone(_0xee4bb2,_0x772fec,_0x238876,_0x89e7f,_0x40bf88){return new Promise(function(_0x297477,_0x51a514){logger[_0x9051('0xd')](_0x9051('0x15'),_0x238876);var _0x53b205;if(moment()>moment(_0x238876[_0x9051('0x2c')])){_0x53b205=moment()[_0x9051('0x2d')](_0x40bf88||0x3,'minutes');}else{if(_0x238876[_0x9051('0x1f')]==0x0){_0x53b205=moment(_0x238876['scheduledat']);}else{_0x53b205=moment()[_0x9051('0x2d')](_0x40bf88||0x3,_0x9051('0x2e'));}}var _0x500b93={'phone':_0xee4bb2[_0x9051('0x2f')],'active':0x0,'OrderBy':_[_0x9051('0x30')](_0xee4bb2[_0x9051('0x1f')])?0x0:_0xee4bb2[_0x9051('0x1f')],'scheduledat':moment()[_0x9051('0x2d')](_0x89e7f||0x1,_0x9051('0x2e')),'countbusyretry':_0x772fec[_0x9051('0x21')],'countcongestionretry':_0x772fec[_0x9051('0x22')],'countnoanswerretry':_0x772fec[_0x9051('0x23')],'countnosuchnumberretry':_0x772fec[_0x9051('0x24')],'countdropretry':_0x772fec[_0x9051('0x27')],'countabandonedretry':_0x772fec['countabandonedretry'],'countmachineretry':_0x772fec[_0x9051('0x31')],'countagentrejectretry':_0x772fec[_0x9051('0x28')],'createdAt':_0x772fec[_0x9051('0x32')],'updatedAt':_0x772fec['updatedAt']};var _0x4cca85={'CmHopperId':_0xee4bb2['id'],'phone':_0x238876[_0x9051('0x2f')],'active':0x0,'OrderBy':_[_0x9051('0x30')](_0x238876[_0x9051('0x1f')])?0x0:_0x238876['OrderBy'],'scheduledat':_0x53b205,'countbusyretry':_0x238876['countbusyretry'],'countcongestionretry':_0x238876[_0x9051('0x22')],'countnoanswerretry':_0x238876[_0x9051('0x23')],'countnosuchnumberretry':_0x772fec['countnosuchnumberretry'],'countdropretry':_0x772fec[_0x9051('0x27')],'countabandonedretry':_0x772fec[_0x9051('0x25')],'countmachineretry':_0x772fec[_0x9051('0x31')],'countagentrejectretry':_0x772fec[_0x9051('0x28')],'createdAt':_0x238876[_0x9051('0x32')],'updatedAt':_0x238876[_0x9051('0x33')]};logger[_0x9051('0xd')](_0x9051('0x34'),_0x500b93);logger['info']('additionalToHop',_0x4cca85);return db[_0x9051('0x35')][_0x9051('0x36')](function(_0x220e92){return db[_0x9051('0x1e')]['update'](_0x500b93,{'where':{'id':_0x238876['id']}},{'transaction':_0x220e92})['then'](function(){return db['CmHopper'][_0x9051('0x37')](_0x4cca85,{'where':{'id':_0xee4bb2['id']}},{'transaction':_0x220e92});});})[_0x9051('0x1d')](function(_0x56c6b8){_0x297477({'id':_0xee4bb2['id'],'phone':_0x238876[_0x9051('0x2f')]});})[_0x9051('0x14')](function(_0xf7eb25){logger[_0x9051('0x11')](_0x9051('0x15'),_0xf7eb25['message'],req);_0x51a514(_this[_0x9051('0x11')](0x1f4,_0xf7eb25[_0x9051('0x12')]));});});}exports[_0x9051('0x38')]=function(_0x1227c9){var _0x12d976=this;return new Promise(function(_0x55d6db,_0x124f00){return db[_0x9051('0x16')][_0x9051('0x37')](_0x1227c9[_0x9051('0x18')][_0x9051('0x39')],{'where':{'id':_0x1227c9[_0x9051('0x18')]['id']}})[_0x9051('0x1d')](function(_0x281f46){_0x55d6db(_0x281f46);})[_0x9051('0x14')](function(_0x405a27){logger[_0x9051('0x11')](_0x9051('0x38'),_0x405a27[_0x9051('0x12')],_0x1227c9);_0x124f00(_0x12d976[_0x9051('0x11')](0x1f4,_0x405a27[_0x9051('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index e981375..cbaff7b 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc7b=['util','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x25537b,_0xa4df9d){var _0x971069=function(_0x46e745){while(--_0x46e745){_0x25537b['push'](_0x25537b['shift']());}};_0x971069(++_0xa4df9d);}(_0xbc7b,0x1ed));var _0xbbc7=function(_0x250c2e,_0x27642e){_0x250c2e=_0x250c2e-0x0;var _0x153d56=_0xbc7b[_0x250c2e];return _0x153d56;};'use strict';var multer=require('multer');var util=require(_0xbbc7('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbbc7('0x1'));var router=express[_0xbbc7('0x2')]();var auth=require(_0xbbc7('0x3'));var interaction=require(_0xbbc7('0x4'));var config=require('../../config/environment');var controller=require(_0xbbc7('0x5'));router[_0xbbc7('0x6')]('/',auth[_0xbbc7('0x7')](),controller[_0xbbc7('0x8')]);router[_0xbbc7('0x6')](_0xbbc7('0x9'),auth[_0xbbc7('0x7')](),controller[_0xbbc7('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbbc7('0xb')]);router[_0xbbc7('0xc')](_0xbbc7('0x9'),auth[_0xbbc7('0x7')](),controller[_0xbbc7('0xd')]);router[_0xbbc7('0xe')](_0xbbc7('0x9'),auth[_0xbbc7('0x7')](),controller[_0xbbc7('0xf')]);module[_0xbbc7('0x10')]=router; \ No newline at end of file +var _0x21f0=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','post','create','update','delete','exports','multer','path','connect-timeout'];(function(_0x19b5ed,_0x32ff8d){var _0x139dd5=function(_0x1d1f5b){while(--_0x1d1f5b){_0x19b5ed['push'](_0x19b5ed['shift']());}};_0x139dd5(++_0x32ff8d);}(_0x21f0,0x69));var _0x021f=function(_0x1cf638,_0x20fc2a){_0x1cf638=_0x1cf638-0x0;var _0x3a077c=_0x21f0[_0x1cf638];return _0x3a077c;};'use strict';var multer=require(_0x021f('0x0'));var util=require('util');var path=require(_0x021f('0x1'));var timeout=require(_0x021f('0x2'));var express=require(_0x021f('0x3'));var router=express[_0x021f('0x4')]();var auth=require(_0x021f('0x5'));var interaction=require(_0x021f('0x6'));var config=require(_0x021f('0x7'));var controller=require(_0x021f('0x8'));router[_0x021f('0x9')]('/',auth[_0x021f('0xa')](),controller[_0x021f('0xb')]);router[_0x021f('0x9')](_0x021f('0xc'),auth[_0x021f('0xa')](),controller['show']);router[_0x021f('0xd')]('/',auth[_0x021f('0xa')](),controller[_0x021f('0xe')]);router['put'](_0x021f('0xc'),auth[_0x021f('0xa')](),controller[_0x021f('0xf')]);router[_0x021f('0x10')](_0x021f('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x021f('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 581dd2d..bb78660 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 _0xcd61=['contactListQueue','sequelize','exports','INTEGER'];(function(_0x490bdb,_0x1ee49c){var _0x5aa1cc=function(_0x399d83){while(--_0x399d83){_0x490bdb['push'](_0x490bdb['shift']());}};_0x5aa1cc(++_0x1ee49c);}(_0xcd61,0x1a9));var _0x1cd6=function(_0x56dabd,_0x283fee){_0x56dabd=_0x56dabd-0x0;var _0x94031e=_0xcd61[_0x56dabd];return _0x94031e;};'use strict';var moment=require('moment');var Sequelize=require(_0x1cd6('0x0'));module[_0x1cd6('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x1cd6('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x1cd6('0x3')},'VoiceQueueId':{'type':Sequelize[_0x1cd6('0x2')],'unique':_0x1cd6('0x3')}}; \ No newline at end of file +var _0x959b=['STRING','INTEGER','contactListQueue','sequelize','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x959b,0xc6));var _0xb959=function(_0xab478e,_0x3a36d5){_0xab478e=_0xab478e-0x0;var _0x1aa516=_0x959b[_0xab478e];return _0x1aa516;};'use strict';var moment=require('moment');var Sequelize=require(_0xb959('0x0'));module[_0xb959('0x1')]={'phone':{'type':Sequelize[_0xb959('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb959('0x3')],'unique':_0xb959('0x4')},'ListId':{'type':Sequelize[_0xb959('0x3')],'unique':_0xb959('0x4')},'VoiceQueueId':{'type':Sequelize[_0xb959('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 17225a0..e2f0129 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.controller.js +++ b/server/api/cmHopperBlack/cmHopperBlack.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x374a97,_0x3e05df){var _0x1d79b7=function(_0x27d4be){while(--_0x27d4be){_0x374a97['push'](_0x374a97['shift']());}};_0x1d79b7(++_0x3e05df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x34316b,_0x308ad3){var _0xbde4b3=function(_0x285cd0){while(--_0x285cd0){_0x34316b['push'](_0x34316b['shift']());}};_0xbde4b3(++_0x308ad3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 2d82fcb..aba23b4 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','CmHopperBlack','util'];(function(_0x146114,_0x31cc72){var _0x442edc=function(_0x1d4cf4){while(--_0x1d4cf4){_0x146114['push'](_0x146114['shift']());}};_0x442edc(++_0x31cc72);}(_0xedd9,0xfc));var _0x9edd=function(_0x2d67b4,_0x4ca8fe){_0x2d67b4=_0x2d67b4-0x0;var _0x4cd582=_0xedd9[_0x2d67b4];return _0x4cd582;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['cm_hopper_black','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes'];(function(_0x215954,_0x59b51e){var _0x2f8a10=function(_0x5f0033){while(--_0x5f0033){_0x215954['push'](_0x215954['shift']());}};_0x2f8a10(++_0x59b51e);}(_0x70e0,0x17b));var _0x070e=function(_0x35669a,_0x2d2e20){_0x35669a=_0x35669a-0x0;var _0x4039d1=_0x70e0[_0x35669a];return _0x4039d1;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('CmHopperBlack',attributes,{'tableName':_0x070e('0x8'),'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 0bb4a96..e86617f 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 _0x74d4=['where','DestroyCmHopperBlack','destroy','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','limit','include','model','attributes','map','UpdateCmHopperBlack','update','body'];(function(_0x30eb5b,_0x234476){var _0x559d73=function(_0x35e62f){while(--_0x35e62f){_0x30eb5b['push'](_0x30eb5b['shift']());}};_0x559d73(++_0x234476);}(_0x74d4,0x78));var _0x474d=function(_0x149092,_0x21a767){_0x149092=_0x149092-0x0;var _0x2c6ed5=_0x74d4[_0x149092];return _0x2c6ed5;};'use strict';var _=require(_0x474d('0x0'));var util=require(_0x474d('0x1'));var moment=require('moment');var BPromise=require(_0x474d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x474d('0x3'));var db=require(_0x474d('0x4'))['db'];var utils=require(_0x474d('0x5'));var logger=require(_0x474d('0x6'))(_0x474d('0x7'));var config=require(_0x474d('0x8'));var jayson=require(_0x474d('0x9'));var client=jayson['client'][_0x474d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23c6fe,_0x28c69a,_0x2476b3){return new BPromise(function(_0x23a61a,_0x45f371){return client[_0x474d('0xb')](_0x23c6fe,_0x2476b3)[_0x474d('0xc')](function(_0x1309b6){logger[_0x474d('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x28c69a,_0x474d('0xe'));logger[_0x474d('0xf')](_0x474d('0x10'),_0x28c69a,_0x474d('0xe'),JSON[_0x474d('0x11')](_0x1309b6));if(_0x1309b6[_0x474d('0x12')]){if(_0x1309b6[_0x474d('0x12')][_0x474d('0x13')]===0x1f4){logger['error'](_0x474d('0x14'),_0x28c69a,_0x1309b6[_0x474d('0x12')][_0x474d('0x15')]);return _0x45f371(_0x1309b6[_0x474d('0x12')][_0x474d('0x15')]);}logger[_0x474d('0x12')](_0x474d('0x14'),_0x28c69a,_0x1309b6['error']['message']);return _0x23a61a(_0x1309b6[_0x474d('0x12')][_0x474d('0x15')]);}else{logger[_0x474d('0xd')](_0x474d('0x14'),_0x28c69a,'request\x20sent');_0x23a61a(_0x1309b6[_0x474d('0x16')][_0x474d('0x15')]);}})[_0x474d('0x17')](function(_0x106d79){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x28c69a,_0x106d79);_0x45f371(_0x106d79);});});}exports[_0x474d('0x18')]=function(_0x1d423d){var _0x4bfce1=this;return new Promise(function(_0x408887,_0x29c4bd){return db[_0x474d('0x19')]['findAll']({'raw':_0x1d423d[_0x474d('0x1a')]?_0x1d423d[_0x474d('0x1a')][_0x474d('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d423d[_0x474d('0x1a')]?_0x1d423d[_0x474d('0x1a')]['where']||null:null,'attributes':_0x1d423d[_0x474d('0x1a')]?_0x1d423d[_0x474d('0x1a')]['attributes']||null:null,'limit':_0x1d423d['options']?_0x1d423d['options'][_0x474d('0x1c')]||null:null,'include':_0x1d423d[_0x474d('0x1a')]?_0x1d423d[_0x474d('0x1a')][_0x474d('0x1d')]?_['map'](_0x1d423d[_0x474d('0x1a')]['include'],function(_0x5f4f6f){return{'model':db[_0x5f4f6f[_0x474d('0x1e')]],'as':_0x5f4f6f['as'],'attributes':_0x5f4f6f[_0x474d('0x1f')],'include':_0x5f4f6f[_0x474d('0x1d')]?_['map'](_0x5f4f6f['include'],function(_0x5b5be4){return{'model':db[_0x5b5be4['model']],'as':_0x5b5be4['as'],'attributes':_0x5b5be4[_0x474d('0x1f')],'include':_0x5b5be4[_0x474d('0x1d')]?_[_0x474d('0x20')](_0x5b5be4[_0x474d('0x1d')],function(_0x1d3bc1){return{'model':db[_0x1d3bc1[_0x474d('0x1e')]],'as':_0x1d3bc1['as'],'attributes':_0x1d3bc1[_0x474d('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x246c4f){logger[_0x474d('0xd')](_0x474d('0x18'),_0x1d423d);logger[_0x474d('0xf')](_0x474d('0x18'),_0x1d423d,JSON[_0x474d('0x11')](_0x246c4f));_0x408887(_0x246c4f);})[_0x474d('0x17')](function(_0x423dea){logger[_0x474d('0x12')](_0x474d('0x18'),_0x423dea[_0x474d('0x15')],_0x1d423d);_0x29c4bd(_0x4bfce1[_0x474d('0x12')](0x1f4,_0x423dea[_0x474d('0x15')]));});});};exports[_0x474d('0x21')]=function(_0x45e00b){var _0x1fadb6=this;return new Promise(function(_0x152ec0,_0xf17ecc){return db[_0x474d('0x19')][_0x474d('0x22')](_0x45e00b[_0x474d('0x23')],{'raw':_0x45e00b[_0x474d('0x1a')]?_0x45e00b[_0x474d('0x1a')][_0x474d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45e00b[_0x474d('0x1a')]?_0x45e00b[_0x474d('0x1a')][_0x474d('0x24')]||null:null,'attributes':_0x45e00b[_0x474d('0x1a')]?_0x45e00b[_0x474d('0x1a')][_0x474d('0x1f')]||null:null,'limit':_0x45e00b['options']?_0x45e00b['options']['limit']||null:null})['then'](function(_0x203efc){logger[_0x474d('0xd')](_0x474d('0x21'),_0x45e00b);logger[_0x474d('0xf')]('UpdateCmHopperBlack',_0x45e00b,JSON['stringify'](_0x203efc));_0x152ec0(_0x203efc);})[_0x474d('0x17')](function(_0x47a9e7){logger[_0x474d('0x12')](_0x474d('0x21'),_0x47a9e7[_0x474d('0x15')],_0x45e00b);_0xf17ecc(_0x1fadb6[_0x474d('0x12')](0x1f4,_0x47a9e7[_0x474d('0x15')]));});});};exports[_0x474d('0x25')]=function(_0x8cbc72){var _0xeca65d=this;return new Promise(function(_0x5ed0b0,_0xd9b795){return db[_0x474d('0x19')][_0x474d('0x26')]({'where':_0x8cbc72[_0x474d('0x1a')]?_0x8cbc72[_0x474d('0x1a')][_0x474d('0x24')]||null:null})[_0x474d('0xc')](function(_0x23cc37){logger[_0x474d('0xd')]('DestroyCmHopperBlack',_0x8cbc72);logger['debug'](_0x474d('0x25'),_0x8cbc72,JSON[_0x474d('0x11')](_0x23cc37));_0x5ed0b0(_0x23cc37);})[_0x474d('0x17')](function(_0x3f316e){logger[_0x474d('0x12')](_0x474d('0x25'),_0x3f316e[_0x474d('0x15')],_0x8cbc72);_0xd9b795(_0xeca65d[_0x474d('0x12')](0x1f4,_0x3f316e[_0x474d('0x15')]));});});}; \ No newline at end of file +var _0x0085=['destroy','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','include','model','attributes','map','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack'];(function(_0x42a206,_0x2b1612){var _0x35eb3b=function(_0x3e5c46){while(--_0x3e5c46){_0x42a206['push'](_0x42a206['shift']());}};_0x35eb3b(++_0x2b1612);}(_0x0085,0xf7));var _0x5008=function(_0x1db929,_0x270726){_0x1db929=_0x1db929-0x0;var _0x111a43=_0x0085[_0x1db929];return _0x111a43;};'use strict';var _=require(_0x5008('0x0'));var util=require(_0x5008('0x1'));var moment=require(_0x5008('0x2'));var BPromise=require(_0x5008('0x3'));var rs=require(_0x5008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5008('0x5'))['db'];var utils=require(_0x5008('0x6'));var logger=require(_0x5008('0x7'))(_0x5008('0x8'));var config=require('../../config/environment');var jayson=require(_0x5008('0x9'));var client=jayson[_0x5008('0xa')][_0x5008('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52e5b5,_0x481038,_0x4c29b2){return new BPromise(function(_0x2ebc94,_0x1918c){return client[_0x5008('0xc')](_0x52e5b5,_0x4c29b2)[_0x5008('0xd')](function(_0x152a2e){logger[_0x5008('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x481038,_0x5008('0xf'));logger[_0x5008('0x10')](_0x5008('0x11'),_0x481038,_0x5008('0xf'),JSON[_0x5008('0x12')](_0x152a2e));if(_0x152a2e[_0x5008('0x13')]){if(_0x152a2e[_0x5008('0x13')][_0x5008('0x14')]===0x1f4){logger[_0x5008('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x481038,_0x152a2e[_0x5008('0x13')][_0x5008('0x15')]);return _0x1918c(_0x152a2e[_0x5008('0x13')][_0x5008('0x15')]);}logger[_0x5008('0x13')](_0x5008('0x16'),_0x481038,_0x152a2e[_0x5008('0x13')]['message']);return _0x2ebc94(_0x152a2e[_0x5008('0x13')][_0x5008('0x15')]);}else{logger[_0x5008('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x481038,_0x5008('0xf'));_0x2ebc94(_0x152a2e[_0x5008('0x17')]['message']);}})[_0x5008('0x18')](function(_0x5da9a2){logger[_0x5008('0x13')](_0x5008('0x16'),_0x481038,_0x5da9a2);_0x1918c(_0x5da9a2);});});}exports[_0x5008('0x19')]=function(_0x5969de){var _0xc6fc59=this;return new Promise(function(_0x3aed40,_0x36cf39){return db[_0x5008('0x1a')][_0x5008('0x1b')]({'raw':_0x5969de['options']?_0x5969de[_0x5008('0x1c')][_0x5008('0x1d')]===undefined?!![]:![]:!![],'where':_0x5969de[_0x5008('0x1c')]?_0x5969de[_0x5008('0x1c')][_0x5008('0x1e')]||null:null,'attributes':_0x5969de[_0x5008('0x1c')]?_0x5969de[_0x5008('0x1c')]['attributes']||null:null,'limit':_0x5969de[_0x5008('0x1c')]?_0x5969de[_0x5008('0x1c')][_0x5008('0x1f')]||null:null,'include':_0x5969de[_0x5008('0x1c')]?_0x5969de['options'][_0x5008('0x20')]?_['map'](_0x5969de[_0x5008('0x1c')][_0x5008('0x20')],function(_0x4f57b5){return{'model':db[_0x4f57b5[_0x5008('0x21')]],'as':_0x4f57b5['as'],'attributes':_0x4f57b5[_0x5008('0x22')],'include':_0x4f57b5[_0x5008('0x20')]?_[_0x5008('0x23')](_0x4f57b5['include'],function(_0x8e995a){return{'model':db[_0x8e995a[_0x5008('0x21')]],'as':_0x8e995a['as'],'attributes':_0x8e995a[_0x5008('0x22')],'include':_0x8e995a[_0x5008('0x20')]?_[_0x5008('0x23')](_0x8e995a[_0x5008('0x20')],function(_0x3915cb){return{'model':db[_0x3915cb[_0x5008('0x21')]],'as':_0x3915cb['as'],'attributes':_0x3915cb[_0x5008('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5008('0xd')](function(_0x4622a2){logger[_0x5008('0xe')]('GetCmHopperBlack',_0x5969de);logger[_0x5008('0x10')](_0x5008('0x19'),_0x5969de,JSON[_0x5008('0x12')](_0x4622a2));_0x3aed40(_0x4622a2);})[_0x5008('0x18')](function(_0x72605f){logger[_0x5008('0x13')](_0x5008('0x19'),_0x72605f[_0x5008('0x15')],_0x5969de);_0x36cf39(_0xc6fc59[_0x5008('0x13')](0x1f4,_0x72605f[_0x5008('0x15')]));});});};exports[_0x5008('0x24')]=function(_0x545bea){var _0x48db1a=this;return new Promise(function(_0x2a6959,_0x3764a4){return db['CmHopperBlack'][_0x5008('0x25')](_0x545bea[_0x5008('0x26')],{'raw':_0x545bea['options']?_0x545bea[_0x5008('0x1c')][_0x5008('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x545bea[_0x5008('0x1c')]?_0x545bea['options'][_0x5008('0x1e')]||null:null,'attributes':_0x545bea[_0x5008('0x1c')]?_0x545bea[_0x5008('0x1c')][_0x5008('0x22')]||null:null,'limit':_0x545bea['options']?_0x545bea[_0x5008('0x1c')]['limit']||null:null})[_0x5008('0xd')](function(_0x3bf782){logger['info'](_0x5008('0x24'),_0x545bea);logger[_0x5008('0x10')]('UpdateCmHopperBlack',_0x545bea,JSON[_0x5008('0x12')](_0x3bf782));_0x2a6959(_0x3bf782);})['catch'](function(_0x5ec227){logger[_0x5008('0x13')]('UpdateCmHopperBlack',_0x5ec227[_0x5008('0x15')],_0x545bea);_0x3764a4(_0x48db1a['error'](0x1f4,_0x5ec227['message']));});});};exports[_0x5008('0x27')]=function(_0x21b5ac){var _0x5a6532=this;return new Promise(function(_0xc115a4,_0x4283a0){return db[_0x5008('0x1a')][_0x5008('0x28')]({'where':_0x21b5ac[_0x5008('0x1c')]?_0x21b5ac['options']['where']||null:null})[_0x5008('0xd')](function(_0x2bc4d5){logger[_0x5008('0xe')](_0x5008('0x27'),_0x21b5ac);logger[_0x5008('0x10')](_0x5008('0x27'),_0x21b5ac,JSON[_0x5008('0x12')](_0x2bc4d5));_0xc115a4(_0x2bc4d5);})[_0x5008('0x18')](function(_0x2101bb){logger[_0x5008('0x13')]('DestroyCmHopperBlack',_0x2101bb[_0x5008('0x15')],_0x21b5ac);_0x4283a0(_0x5a6532[_0x5008('0x13')](0x1f4,_0x2101bb[_0x5008('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 43d1e68..610aa91 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 _0x3e74=['connect-timeout','express','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','describe','/:id','put','update','delete','exports','multer','path'];(function(_0x3ee91e,_0x466a5a){var _0x239405=function(_0x3f2d09){while(--_0x3f2d09){_0x3ee91e['push'](_0x3ee91e['shift']());}};_0x239405(++_0x466a5a);}(_0x3e74,0x175));var _0x43e7=function(_0x437227,_0x144eae){_0x437227=_0x437227-0x0;var _0x23e68a=_0x3e74[_0x437227];return _0x23e68a;};'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('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xc')]);router[_0x43e7('0xd')]('/:id',auth[_0x43e7('0x7')](),controller['destroy']);module[_0x43e7('0xe')]=router; \ No newline at end of file +var _0x6aa7=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','index','/describe','isAuthenticated','describe','/:id','show','update','delete','destroy','exports','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6aa7,0x178));var _0x76aa=function(_0x258424,_0x313adf){_0x258424=_0x258424-0x0;var _0x445d2c=_0x6aa7[_0x258424];return _0x445d2c;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x76aa('0x5'));var config=require(_0x76aa('0x6'));var controller=require(_0x76aa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x76aa('0x8')]);router['get'](_0x76aa('0x9'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xb')]);router['get'](_0x76aa('0xc'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xd')]);router['put'](_0x76aa('0xc'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xe')]);router[_0x76aa('0xf')](_0x76aa('0xc'),auth[_0x76aa('0xa')](),controller[_0x76aa('0x10')]);module[_0x76aa('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 6055c37..126d20e 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 _0xda41=['moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize'];(function(_0x399bdd,_0x28232f){var _0x4221b1=function(_0x1883ef){while(--_0x1883ef){_0x399bdd['push'](_0x399bdd['shift']());}};_0x4221b1(++_0x28232f);}(_0xda41,0x137));var _0x1da4=function(_0x14d23c,_0x51fd18){_0x14d23c=_0x14d23c-0x0;var _0xe4b452=_0xda41[_0x14d23c];return _0xe4b452;};'use strict';var Sequelize=require(_0x1da4('0x0'));var moment=require(_0x1da4('0x1'));module[_0x1da4('0x2')]={'state':{'type':Sequelize[_0x1da4('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x1da4('0x4')]},'scheduledat':{'type':Sequelize[_0x1da4('0x5')]},'countbusyretry':{'type':Sequelize[_0x1da4('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1da4('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1da4('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1da4('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x1da4('0x4')]},'originatecalleridname':{'type':Sequelize[_0x1da4('0x4')]},'calleridnum':{'type':Sequelize[_0x1da4('0x4')]},'calleridname':{'type':Sequelize[_0x1da4('0x4')]},'starttime':{'type':Sequelize[_0x1da4('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x1da4('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x1da4('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1da4('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1da4('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1da4('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1da4('0x4')]},'campaign':{'type':Sequelize[_0x1da4('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1da4('0x4')]},'reason':{'type':Sequelize[_0x1da4('0x4')]},'disposition':{'type':Sequelize[_0x1da4('0x4')]},'dispositionat':{'type':Sequelize[_0x1da4('0x5')],'set':function(_0x432aad){var _0x458b34=this[_0x1da4('0x6')](_0x1da4('0x7'));if(_0x458b34&&_0x432aad){this['setDataValue'](_0x1da4('0x8'),moment(_0x432aad)[_0x1da4('0x9')](moment(_0x458b34),_0x1da4('0xa')));}return this['setDataValue'](_0x1da4('0xb'),_0x432aad);}},'amd':{'type':Sequelize[_0x1da4('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1da4('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x1da4('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x1da4('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1da4('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1da4('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x1da4('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x1da4('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x1da4('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1da4('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1da4('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1da4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8143=['STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x156451,_0x4e7f4a){var _0x3b75b1=function(_0x3d9986){while(--_0x3d9986){_0x156451['push'](_0x156451['shift']());}};_0x3b75b1(++_0x4e7f4a);}(_0x8143,0x135));var _0x3814=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8143[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x3814('0x0'));var moment=require('moment');module[_0x3814('0x1')]={'state':{'type':Sequelize[_0x3814('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3814('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3814('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x3814('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3814('0x3')]},'calleridname':{'type':Sequelize[_0x3814('0x3')]},'starttime':{'type':Sequelize[_0x3814('0x4')]},'responsetime':{'type':Sequelize[_0x3814('0x4')]},'answertime':{'type':Sequelize[_0x3814('0x4')]},'droptime':{'type':Sequelize[_0x3814('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x3814('0x3')]},'campaigntype':{'type':Sequelize[_0x3814('0x3')]},'membername':{'type':Sequelize[_0x3814('0x3')]},'reason':{'type':Sequelize[_0x3814('0x3')]},'disposition':{'type':Sequelize[_0x3814('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x15ccd8){var _0x3441ae=this[_0x3814('0x5')](_0x3814('0x6'));if(_0x3441ae&&_0x15ccd8){this[_0x3814('0x7')](_0x3814('0x8'),moment(_0x15ccd8)[_0x3814('0x9')](moment(_0x3441ae),_0x3814('0xa')));}return this[_0x3814('0x7')]('dispositionat',_0x15ccd8);}},'amd':{'type':Sequelize[_0x3814('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3814('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x3814('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x3814('0x4')]},'callback':{'type':Sequelize[_0x3814('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3814('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x3814('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x3814('0x4')]},'recallme':{'type':Sequelize[_0x3814('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3814('0x2')],'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 3c6a2dc..bb44965 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 _0x7ed1=['filter','merge','where','map','type','options','includeAll','include','findAll','rows','show','params','find','describe','catch','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2022,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','fromQuery','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','scheduledAt','ContactId','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','calleridnum','cm_hopper_final','state\x20=\x204','group','Campaign','CampaignId','ANY_VALUE(ContactId)','createdAt','state\x20=\x20?','CampaignId\x20=\x20?','CmHopper','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','json','reject','update','then','destroy','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick'];(function(_0x4be53f,_0x5aec1e){var _0x10d2b3=function(_0x3346a1){while(--_0x3346a1){_0x4be53f['push'](_0x4be53f['shift']());}};_0x10d2b3(++_0x5aec1e);}(_0x7ed1,0xca));var _0x17ed=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x7ed1[_0x4b73a2];return _0x383c66;};'use strict';var pdf=require(_0x17ed('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x17ed('0x1'));var zipdir=require(_0x17ed('0x2'));var jsonpatch=require(_0x17ed('0x3'));var rp=require(_0x17ed('0x4'));var moment=require(_0x17ed('0x5'));var BPromise=require(_0x17ed('0x6'));var Mustache=require('mustache');var util=require(_0x17ed('0x7'));var path=require(_0x17ed('0x8'));var sox=require(_0x17ed('0x9'));var csv=require(_0x17ed('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x17ed('0xb'));var crypto=require(_0x17ed('0xc'));var jsforce=require(_0x17ed('0xd'));var deskjs=require(_0x17ed('0xe'));var toCsv=require('to-csv');var querystring=require(_0x17ed('0xf'));var Papa=require(_0x17ed('0x10'));var Redis=require(_0x17ed('0x11'));var authService=require(_0x17ed('0x12'));var qs=require(_0x17ed('0x13'));var as=require(_0x17ed('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17ed('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x17ed('0x16'));var db=require(_0x17ed('0x17'))['db'];function respondWithStatusCode(_0x4533bc,_0x10d961){_0x10d961=_0x10d961||0xcc;return function(_0x3f2851){if(_0x3f2851){return _0x4533bc['sendStatus'](_0x10d961);}return _0x4533bc[_0x17ed('0x18')](_0x10d961)[_0x17ed('0x19')]();};}function respondWithResult(_0x197135,_0x5f408e){_0x5f408e=_0x5f408e||0xc8;return function(_0x2ae9aa){if(_0x2ae9aa){return _0x197135['status'](_0x5f408e)['json'](_0x2ae9aa);}};}function respondWithFilteredResult(_0x30a0c6,_0x570d98){return function(_0x41b741){if(_0x41b741){var _0x4782c3=_0x41b741[_0x17ed('0x1a')],_0xd10a00=_0x570d98[_0x17ed('0x1b')],_0x6ccf15=_0x570d98[_0x17ed('0x1b')]+_0x570d98['limit'],_0x5458ff;if(_0x6ccf15>=_0x4782c3){_0x6ccf15=_0x4782c3;_0x5458ff=0xc8;}else{_0x5458ff=0xce;}_0x30a0c6['status'](_0x5458ff);return _0x30a0c6[_0x17ed('0x1c')](_0x17ed('0x1d'),_0xd10a00+'-'+_0x6ccf15+'/'+_0x4782c3)[_0x17ed('0x1e')](_0x41b741);}return null;};}function patchUpdates(_0x22e43d){return function(_0x418f4e){try{jsonpatch['apply'](_0x418f4e,_0x22e43d,!![]);}catch(_0x427340){return BPromise[_0x17ed('0x1f')](_0x427340);}return _0x418f4e['save']();};}function saveUpdates(_0x2cac50,_0x3368aa){return function(_0x532b3a){if(_0x532b3a){return _0x532b3a[_0x17ed('0x20')](_0x2cac50)[_0x17ed('0x21')](function(_0x2298ea){return _0x2298ea;});}return null;};}function removeEntity(_0x390342,_0x3918e4){return function(_0x2e5f56){if(_0x2e5f56){return _0x2e5f56[_0x17ed('0x22')]()['then'](function(){_0x390342[_0x17ed('0x18')](0xcc)[_0x17ed('0x19')]();});}};}function handleEntityNotFound(_0x5e1602,_0x5e4f27){return function(_0x464799){if(!_0x464799){_0x5e1602['sendStatus'](0x194);}return _0x464799;};}function handleError(_0x5e03b3,_0x4f014b){_0x4f014b=_0x4f014b||0x1f4;return function(_0x284c72){logger['error'](_0x284c72[_0x17ed('0x23')]);if(_0x284c72[_0x17ed('0x24')]){delete _0x284c72[_0x17ed('0x24')];}_0x5e03b3['status'](_0x4f014b)[_0x17ed('0x25')](_0x284c72);};}exports[_0x17ed('0x26')]=function(_0x29049e,_0x4d1de9){var _0x57470d={},_0x170d4f={},_0xb3ea65={'count':0x0,'rows':[]};var _0x376f03=_['map'](db[_0x17ed('0x27')][_0x17ed('0x28')],function(_0x20ece2){return{'name':_0x20ece2[_0x17ed('0x29')],'type':_0x20ece2['type'][_0x17ed('0x2a')]};});_0x170d4f[_0x17ed('0x2b')]=_['map'](_0x376f03,_0x17ed('0x24'));_0x170d4f[_0x17ed('0x2c')]=_[_0x17ed('0x2d')](_0x29049e['query']);_0x170d4f[_0x17ed('0x2e')]=_[_0x17ed('0x2f')](_0x170d4f[_0x17ed('0x2b')],_0x170d4f[_0x17ed('0x2c')]);_0x57470d['attributes']=_[_0x17ed('0x2f')](_0x170d4f['model'],qs[_0x17ed('0x30')](_0x29049e[_0x17ed('0x2c')][_0x17ed('0x30')]));_0x57470d[_0x17ed('0x31')]=_0x57470d['attributes'][_0x17ed('0x32')]?_0x57470d[_0x17ed('0x31')]:_0x170d4f[_0x17ed('0x2b')];if(!_0x29049e[_0x17ed('0x2c')][_0x17ed('0x33')](_0x17ed('0x34'))){_0x57470d[_0x17ed('0x35')]=qs[_0x17ed('0x35')](_0x29049e['query'][_0x17ed('0x35')]);_0x57470d[_0x17ed('0x1b')]=qs[_0x17ed('0x1b')](_0x29049e[_0x17ed('0x2c')][_0x17ed('0x1b')]);}_0x57470d['order']=qs[_0x17ed('0x36')](_0x29049e[_0x17ed('0x2c')]['sort']);_0x57470d['where']=qs['filters'](_[_0x17ed('0x37')](_0x29049e['query'],_0x170d4f[_0x17ed('0x2e')]),_0x376f03);if(_0x29049e[_0x17ed('0x2c')][_0x17ed('0x38')]){_0x57470d['where']=_[_0x17ed('0x39')](_0x57470d[_0x17ed('0x3a')],{'$or':_[_0x17ed('0x3b')](_0x376f03,function(_0x471b09){if(_0x471b09[_0x17ed('0x3c')]!=='VIRTUAL'){var _0x245778={};_0x245778[_0x471b09[_0x17ed('0x24')]]={'$like':'%'+_0x29049e[_0x17ed('0x2c')][_0x17ed('0x38')]+'%'};return _0x245778;}})});}_0x57470d=_[_0x17ed('0x39')]({},_0x57470d,_0x29049e[_0x17ed('0x3d')]);var _0x54d037={'where':_0x57470d['where']};return db[_0x17ed('0x27')][_0x17ed('0x1a')](_0x54d037)['then'](function(_0x6b4bb4){_0xb3ea65[_0x17ed('0x1a')]=_0x6b4bb4;if(_0x29049e['query'][_0x17ed('0x3e')]){_0x57470d[_0x17ed('0x3f')]=[{'all':!![]}];}return db[_0x17ed('0x27')][_0x17ed('0x40')](_0x57470d);})[_0x17ed('0x21')](function(_0x369145){_0xb3ea65[_0x17ed('0x41')]=_0x369145;return _0xb3ea65;})[_0x17ed('0x21')](respondWithFilteredResult(_0x4d1de9,_0x57470d))['catch'](handleError(_0x4d1de9,null));};exports[_0x17ed('0x42')]=function(_0x20a05e,_0x37f91f){var _0xb6a76a={'raw':!![],'where':{'id':_0x20a05e[_0x17ed('0x43')]['id']}},_0x58c19a={};_0x58c19a[_0x17ed('0x2b')]=_[_0x17ed('0x2d')](db[_0x17ed('0x27')][_0x17ed('0x28')]);_0x58c19a[_0x17ed('0x2c')]=_[_0x17ed('0x2d')](_0x20a05e[_0x17ed('0x2c')]);_0x58c19a[_0x17ed('0x2e')]=_[_0x17ed('0x2f')](_0x58c19a[_0x17ed('0x2b')],_0x58c19a[_0x17ed('0x2c')]);_0xb6a76a[_0x17ed('0x31')]=_[_0x17ed('0x2f')](_0x58c19a['model'],qs[_0x17ed('0x30')](_0x20a05e[_0x17ed('0x2c')][_0x17ed('0x30')]));_0xb6a76a[_0x17ed('0x31')]=_0xb6a76a[_0x17ed('0x31')]['length']?_0xb6a76a[_0x17ed('0x31')]:_0x58c19a[_0x17ed('0x2b')];if(_0x20a05e[_0x17ed('0x2c')][_0x17ed('0x3e')]){_0xb6a76a[_0x17ed('0x3f')]=[{'all':!![]}];}_0xb6a76a=_[_0x17ed('0x39')]({},_0xb6a76a,_0x20a05e[_0x17ed('0x3d')]);return db[_0x17ed('0x27')][_0x17ed('0x44')](_0xb6a76a)[_0x17ed('0x21')](handleEntityNotFound(_0x37f91f,null))[_0x17ed('0x21')](respondWithResult(_0x37f91f,null))['catch'](handleError(_0x37f91f,null));};exports['describe']=function(_0xab7fc1,_0x4238bc){return db[_0x17ed('0x27')][_0x17ed('0x45')]()[_0x17ed('0x21')](respondWithResult(_0x4238bc,null))[_0x17ed('0x46')](handleError(_0x4238bc,null));};exports[_0x17ed('0x20')]=function(_0xc9b7c4,_0x2a63bc){if(_0xc9b7c4['body'][_0x17ed('0x47')]){delete _0xc9b7c4[_0x17ed('0x48')][_0x17ed('0x47')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0xc9b7c4[_0x17ed('0x43')]['id']}})[_0x17ed('0x21')](handleEntityNotFound(_0x2a63bc,null))['then'](saveUpdates(_0xc9b7c4['body'],null))['then'](respondWithResult(_0x2a63bc,null))[_0x17ed('0x46')](handleError(_0x2a63bc,null));};exports[_0x17ed('0x49')]=function(_0x2b2db0,_0x3888b7,_0x27f3b6){return db[_0x17ed('0x27')][_0x17ed('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x2b2db0[_0x17ed('0x43')]['id']},'attributes':[[db[_0x17ed('0x4a')]['fn'](_0x17ed('0x4b'),db[_0x17ed('0x4a')]['fn']('IF',db[_0x17ed('0x4a')]['literal'](_0x17ed('0x4c')))),_0x17ed('0x4d')],[db['sequelize']['fn'](_0x17ed('0x4b'),db[_0x17ed('0x4a')]['fn']('IF',db[_0x17ed('0x4a')][_0x17ed('0x4e')](_0x17ed('0x4f')))),_0x17ed('0x50')],[db['sequelize']['fn'](_0x17ed('0x4b'),db['sequelize']['fn']('IF',db[_0x17ed('0x4a')]['literal'](_0x17ed('0x51')))),_0x17ed('0x52')],[db[_0x17ed('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x17ed('0x4a')][_0x17ed('0x4e')](_0x17ed('0x53')))),_0x17ed('0x54')],[db[_0x17ed('0x4a')]['fn'](_0x17ed('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0x17ed('0x4e')](_0x17ed('0x55')))),_0x17ed('0x56')],[db[_0x17ed('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x17ed('0x4a')][_0x17ed('0x4e')](_0x17ed('0x57')))),_0x17ed('0x58')],[db[_0x17ed('0x4a')]['fn'](_0x17ed('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0x17ed('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x17ed('0x59')],[db['sequelize']['fn'](_0x17ed('0x4b'),db['sequelize']['fn']('IF',db[_0x17ed('0x4a')][_0x17ed('0x4e')](_0x17ed('0x5a')))),_0x17ed('0x5b')]]})['then'](handleEntityNotFound(_0x3888b7,null))[_0x17ed('0x21')](respondWithResult(_0x3888b7,null))[_0x17ed('0x46')](handleError(_0x3888b7,null));};exports[_0x17ed('0x5c')]=function(_0x4b10ad,_0x10821b,_0x2892bb){return db[_0x17ed('0x27')][_0x17ed('0x40')]({'raw':![],'where':{'CampaignId':_0x4b10ad['params']['id']},'attributes':[[db[_0x17ed('0x4a')]['fn']('COUNT',db[_0x17ed('0x4a')]['fn']('IF',db[_0x17ed('0x4a')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x17ed('0x4d')],[db[_0x17ed('0x4a')]['fn'](_0x17ed('0x4b'),db['sequelize']['fn']('IF',db[_0x17ed('0x4a')][_0x17ed('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x17ed('0x4a')]['fn'](_0x17ed('0x4b'),db[_0x17ed('0x4a')]['fn']('IF',db[_0x17ed('0x4a')][_0x17ed('0x4e')](_0x17ed('0x51')))),_0x17ed('0x52')],[db['sequelize']['fn']('COUNT',db[_0x17ed('0x4a')]['fn']('IF',db[_0x17ed('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x17ed('0x54')],[db['sequelize']['fn']('COUNT',db[_0x17ed('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x17ed('0x55')))),_0x17ed('0x56')],[db['sequelize']['fn'](_0x17ed('0x4b'),db[_0x17ed('0x4a')]['fn']('IF',db[_0x17ed('0x4a')][_0x17ed('0x4e')](_0x17ed('0x57')))),_0x17ed('0x58')],[db[_0x17ed('0x4a')]['fn']('COUNT',db[_0x17ed('0x4a')]['fn']('IF',db[_0x17ed('0x4a')][_0x17ed('0x4e')](_0x17ed('0x5d')))),_0x17ed('0x59')],[db[_0x17ed('0x4a')]['fn'](_0x17ed('0x4b'),db[_0x17ed('0x4a')]['fn']('IF',db[_0x17ed('0x4a')][_0x17ed('0x4e')](_0x17ed('0x5a')))),_0x17ed('0x5b')]]})['then'](handleEntityNotFound(_0x10821b,null))[_0x17ed('0x21')](respondWithResult(_0x10821b,null))['catch'](handleError(_0x10821b,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x49d90d,_0xf6f991,_0x70290c){return db[_0x17ed('0x5e')][_0x17ed('0x44')]({'where':{'id':_0x49d90d['params']['id']}})[_0x17ed('0x21')](handleEntityNotFound(_0xf6f991,null))[_0x17ed('0x21')](function(_0x17ac01){var _0x3156db;if(_0x17ac01){_0x3156db=squel[_0x17ed('0x5f')]()[_0x17ed('0x60')](_0x17ed('0x61'))[_0x17ed('0x62')](['phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt',_0x17ed('0x63')],squel[_0x17ed('0x64')]()[_0x17ed('0x65')](_0x17ed('0x66'),_0x17ed('0x67'))[_0x17ed('0x65')](_0x17ed('0x68'),_0x17ed('0x69'))['field']('ANY_VALUE(ContactId)',_0x17ed('0x6a'))[_0x17ed('0x65')](_0x17ed('0x6b'),_0x17ed('0x6c'))[_0x17ed('0x65')](_0x17ed('0x6d'),_0x17ed('0x6e'))[_0x17ed('0x65')](_0x17ed('0x68'),'createdAt')[_0x17ed('0x65')](_0x17ed('0x68'),_0x17ed('0x63'))[_0x17ed('0x6f')]('cm_hopper_final')[_0x17ed('0x3a')]('VoiceQueueId\x20=\x20?',_0x49d90d['params']['id'][_0x17ed('0x70')]())['where']('state\x20=\x20?',_0x49d90d[_0x17ed('0x48')][_0x17ed('0x71')][_0x17ed('0x70')]())[_0x17ed('0x3a')](_0x17ed('0x72'))[_0x17ed('0x3a')](_0x17ed('0x73'),squel[_0x17ed('0x64')]()[_0x17ed('0x65')](_0x17ed('0x67'))[_0x17ed('0x6f')](_0x17ed('0x61'))[_0x17ed('0x3a')](_0x17ed('0x74'),_0x49d90d[_0x17ed('0x43')]['id'][_0x17ed('0x70')]()))[_0x17ed('0x3a')](_0x17ed('0x73'),squel[_0x17ed('0x64')]()[_0x17ed('0x65')](_0x17ed('0x75'))[_0x17ed('0x6f')](_0x17ed('0x76'))['where'](_0x17ed('0x74'),_0x49d90d[_0x17ed('0x43')]['id']['toString']())[_0x17ed('0x3a')](_0x17ed('0x77')))[_0x17ed('0x78')](_0x17ed('0x6a')))[_0x17ed('0x70')]();return db[_0x17ed('0x4a')]['query'](_0x3156db);}return[];})[_0x17ed('0x21')](respondWithResult(_0xf6f991,null))['catch'](handleError(_0xf6f991,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x2458ea,_0x327cc4,_0x3e58e6){return db[_0x17ed('0x79')][_0x17ed('0x44')]({'where':{'id':_0x2458ea[_0x17ed('0x43')]['id']}})[_0x17ed('0x21')](handleEntityNotFound(_0x327cc4,null))[_0x17ed('0x21')](function(_0xa1ba59){var _0x1f4e83;if(_0xa1ba59){_0x1f4e83=squel[_0x17ed('0x5f')]()[_0x17ed('0x60')](_0x17ed('0x61'))['fromQuery'](['phone',_0x17ed('0x69'),_0x17ed('0x6a'),_0x17ed('0x6c'),_0x17ed('0x7a'),'createdAt',_0x17ed('0x63')],squel[_0x17ed('0x64')]()[_0x17ed('0x65')](_0x17ed('0x66'),_0x17ed('0x67'))[_0x17ed('0x65')](_0x17ed('0x68'),_0x17ed('0x69'))[_0x17ed('0x65')](_0x17ed('0x7b'),_0x17ed('0x6a'))[_0x17ed('0x65')](_0x17ed('0x6b'),_0x17ed('0x6c'))[_0x17ed('0x65')]('ANY_VALUE(CampaignId)',_0x17ed('0x7a'))[_0x17ed('0x65')](_0x17ed('0x68'),_0x17ed('0x7c'))[_0x17ed('0x65')]('NOW()',_0x17ed('0x63'))[_0x17ed('0x6f')]('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x2458ea[_0x17ed('0x43')]['id']['toString']())[_0x17ed('0x3a')](_0x17ed('0x7d'),_0x2458ea['body'][_0x17ed('0x71')][_0x17ed('0x70')]())[_0x17ed('0x3a')](_0x17ed('0x72'))[_0x17ed('0x3a')](_0x17ed('0x73'),squel[_0x17ed('0x64')]()[_0x17ed('0x65')](_0x17ed('0x67'))[_0x17ed('0x6f')]('cm_hopper')[_0x17ed('0x3a')](_0x17ed('0x7e'),_0x2458ea[_0x17ed('0x43')]['id'][_0x17ed('0x70')]()))[_0x17ed('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x17ed('0x75'))[_0x17ed('0x6f')](_0x17ed('0x76'))[_0x17ed('0x3a')]('CampaignId\x20=\x20?',_0x2458ea['params']['id'][_0x17ed('0x70')]())['where'](_0x17ed('0x77')))[_0x17ed('0x78')](_0x17ed('0x6a')))[_0x17ed('0x70')]();return db['sequelize'][_0x17ed('0x2c')](_0x1f4e83);}return[];})[_0x17ed('0x21')](respondWithResult(_0x327cc4,null))[_0x17ed('0x46')](handleError(_0x327cc4,null));};exports['checkContactHopper']=function(_0xa43beb,_0x51c06b,_0x1e7800){return db[_0x17ed('0x7f')][_0x17ed('0x80')]({'where':{'VoiceQueueId':_0xa43beb[_0x17ed('0x48')]['VoiceQueueId'],'CampaignId':_0xa43beb['body'][_0x17ed('0x7a')],'ContactId':_0xa43beb['body'][_0x17ed('0x6a')]}})[_0x17ed('0x21')](handleEntityNotFound(_0x51c06b,null))[_0x17ed('0x21')](function(_0x47f3fa){if(_0x47f3fa){return _0x47f3fa;}return null;})[_0x17ed('0x21')](respondWithResult(_0x51c06b,null))['catch'](handleError(_0x51c06b,null));}; \ No newline at end of file +var _0x75dc=['model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','VIRTUAL','options','CmHopperFinal','count','includeAll','include','rows','catch','show','find','body','uniqueid','params','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','into','cm_hopper','fromQuery','phone','scheduledAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','createdAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','from','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','limit','status','set','json','apply','reject','save','update','then','destroy','error','stack','name','rawAttributes','type','key'];(function(_0xca7609,_0x54d886){var _0x215ce0=function(_0x1ec445){while(--_0x1ec445){_0xca7609['push'](_0xca7609['shift']());}};_0x215ce0(++_0x54d886);}(_0x75dc,0x1d7));var _0xc75d=function(_0x203271,_0x542139){_0x203271=_0x203271-0x0;var _0x37b0dd=_0x75dc[_0x203271];return _0x37b0dd;};'use strict';var pdf=require(_0xc75d('0x0'));var emlformat=require(_0xc75d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc75d('0x2'));var moment=require(_0xc75d('0x3'));var BPromise=require(_0xc75d('0x4'));var Mustache=require(_0xc75d('0x5'));var util=require(_0xc75d('0x6'));var path=require(_0xc75d('0x7'));var sox=require('sox');var csv=require(_0xc75d('0x8'));var ejs=require(_0xc75d('0x9'));var fs=require('fs');var _=require(_0xc75d('0xa'));var squel=require('squel');var crypto=require(_0xc75d('0xb'));var jsforce=require(_0xc75d('0xc'));var deskjs=require(_0xc75d('0xd'));var toCsv=require(_0xc75d('0x8'));var querystring=require('querystring');var Papa=require(_0xc75d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc75d('0xf'));var as=require(_0xc75d('0x10'));var hardwareService=require(_0xc75d('0x11'));var logger=require(_0xc75d('0x12'))('api');var utils=require(_0xc75d('0x13'));var config=require(_0xc75d('0x14'));var db=require(_0xc75d('0x15'))['db'];function respondWithStatusCode(_0x1b0911,_0x1a7984){_0x1a7984=_0x1a7984||0xcc;return function(_0x2521fd){if(_0x2521fd){return _0x1b0911[_0xc75d('0x16')](_0x1a7984);}return _0x1b0911['status'](_0x1a7984)[_0xc75d('0x17')]();};}function respondWithResult(_0x2313be,_0x3f01a0){_0x3f01a0=_0x3f01a0||0xc8;return function(_0x421b53){if(_0x421b53){return _0x2313be['status'](_0x3f01a0)['json'](_0x421b53);}};}function respondWithFilteredResult(_0x1208d7,_0x182f56){return function(_0x174998){if(_0x174998){var _0x1b0bfc=_0x174998['count'],_0x1d49b9=_0x182f56[_0xc75d('0x18')],_0x331d68=_0x182f56[_0xc75d('0x18')]+_0x182f56[_0xc75d('0x19')],_0x2bd581;if(_0x331d68>=_0x1b0bfc){_0x331d68=_0x1b0bfc;_0x2bd581=0xc8;}else{_0x2bd581=0xce;}_0x1208d7[_0xc75d('0x1a')](_0x2bd581);return _0x1208d7[_0xc75d('0x1b')]('Content-Range',_0x1d49b9+'-'+_0x331d68+'/'+_0x1b0bfc)[_0xc75d('0x1c')](_0x174998);}return null;};}function patchUpdates(_0x50e44f){return function(_0x54f089){try{jsonpatch[_0xc75d('0x1d')](_0x54f089,_0x50e44f,!![]);}catch(_0x431948){return BPromise[_0xc75d('0x1e')](_0x431948);}return _0x54f089[_0xc75d('0x1f')]();};}function saveUpdates(_0x84ded6,_0x576117){return function(_0x3d4141){if(_0x3d4141){return _0x3d4141[_0xc75d('0x20')](_0x84ded6)[_0xc75d('0x21')](function(_0x20739f){return _0x20739f;});}return null;};}function removeEntity(_0x1ae4e9,_0x1b614f){return function(_0x2181e1){if(_0x2181e1){return _0x2181e1[_0xc75d('0x22')]()['then'](function(){_0x1ae4e9[_0xc75d('0x1a')](0xcc)[_0xc75d('0x17')]();});}};}function handleEntityNotFound(_0x18589b,_0x4314cc){return function(_0x5ef8d0){if(!_0x5ef8d0){_0x18589b[_0xc75d('0x16')](0x194);}return _0x5ef8d0;};}function handleError(_0x2f7741,_0xdb14e1){_0xdb14e1=_0xdb14e1||0x1f4;return function(_0x3b10cd){logger[_0xc75d('0x23')](_0x3b10cd[_0xc75d('0x24')]);if(_0x3b10cd['name']){delete _0x3b10cd[_0xc75d('0x25')];}_0x2f7741[_0xc75d('0x1a')](_0xdb14e1)['send'](_0x3b10cd);};}exports['index']=function(_0x4b5c88,_0xd2b678){var _0x452c51={},_0x393694={},_0x2bf10e={'count':0x0,'rows':[]};var _0x6bee54=_['map'](db['CmHopperFinal'][_0xc75d('0x26')],function(_0x17f45b){return{'name':_0x17f45b['fieldName'],'type':_0x17f45b[_0xc75d('0x27')][_0xc75d('0x28')]};});_0x393694[_0xc75d('0x29')]=_[_0xc75d('0x2a')](_0x6bee54,'name');_0x393694[_0xc75d('0x2b')]=_[_0xc75d('0x2c')](_0x4b5c88[_0xc75d('0x2b')]);_0x393694['filters']=_['intersection'](_0x393694[_0xc75d('0x29')],_0x393694[_0xc75d('0x2b')]);_0x452c51['attributes']=_[_0xc75d('0x2d')](_0x393694[_0xc75d('0x29')],qs[_0xc75d('0x2e')](_0x4b5c88[_0xc75d('0x2b')][_0xc75d('0x2e')]));_0x452c51[_0xc75d('0x2f')]=_0x452c51[_0xc75d('0x2f')][_0xc75d('0x30')]?_0x452c51[_0xc75d('0x2f')]:_0x393694[_0xc75d('0x29')];if(!_0x4b5c88[_0xc75d('0x2b')][_0xc75d('0x31')](_0xc75d('0x32'))){_0x452c51['limit']=qs[_0xc75d('0x19')](_0x4b5c88[_0xc75d('0x2b')][_0xc75d('0x19')]);_0x452c51[_0xc75d('0x18')]=qs['offset'](_0x4b5c88[_0xc75d('0x2b')][_0xc75d('0x18')]);}_0x452c51[_0xc75d('0x33')]=qs['sort'](_0x4b5c88['query']['sort']);_0x452c51['where']=qs[_0xc75d('0x34')](_[_0xc75d('0x35')](_0x4b5c88['query'],_0x393694[_0xc75d('0x34')]),_0x6bee54);if(_0x4b5c88[_0xc75d('0x2b')][_0xc75d('0x36')]){_0x452c51[_0xc75d('0x37')]=_[_0xc75d('0x38')](_0x452c51[_0xc75d('0x37')],{'$or':_[_0xc75d('0x2a')](_0x6bee54,function(_0x3a2e54){if(_0x3a2e54[_0xc75d('0x27')]!==_0xc75d('0x39')){var _0x5de483={};_0x5de483[_0x3a2e54['name']]={'$like':'%'+_0x4b5c88[_0xc75d('0x2b')][_0xc75d('0x36')]+'%'};return _0x5de483;}})});}_0x452c51=_[_0xc75d('0x38')]({},_0x452c51,_0x4b5c88[_0xc75d('0x3a')]);var _0x339972={'where':_0x452c51['where']};return db[_0xc75d('0x3b')][_0xc75d('0x3c')](_0x339972)[_0xc75d('0x21')](function(_0x1e432a){_0x2bf10e[_0xc75d('0x3c')]=_0x1e432a;if(_0x4b5c88['query'][_0xc75d('0x3d')]){_0x452c51[_0xc75d('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x452c51);})[_0xc75d('0x21')](function(_0x38509b){_0x2bf10e[_0xc75d('0x3f')]=_0x38509b;return _0x2bf10e;})[_0xc75d('0x21')](respondWithFilteredResult(_0xd2b678,_0x452c51))[_0xc75d('0x40')](handleError(_0xd2b678,null));};exports[_0xc75d('0x41')]=function(_0x81af32,_0x499918){var _0x1a5698={'raw':!![],'where':{'id':_0x81af32['params']['id']}},_0x13a89b={};_0x13a89b['model']=_[_0xc75d('0x2c')](db[_0xc75d('0x3b')][_0xc75d('0x26')]);_0x13a89b['query']=_[_0xc75d('0x2c')](_0x81af32[_0xc75d('0x2b')]);_0x13a89b[_0xc75d('0x34')]=_[_0xc75d('0x2d')](_0x13a89b[_0xc75d('0x29')],_0x13a89b[_0xc75d('0x2b')]);_0x1a5698['attributes']=_['intersection'](_0x13a89b[_0xc75d('0x29')],qs[_0xc75d('0x2e')](_0x81af32[_0xc75d('0x2b')][_0xc75d('0x2e')]));_0x1a5698[_0xc75d('0x2f')]=_0x1a5698[_0xc75d('0x2f')][_0xc75d('0x30')]?_0x1a5698[_0xc75d('0x2f')]:_0x13a89b[_0xc75d('0x29')];if(_0x81af32[_0xc75d('0x2b')][_0xc75d('0x3d')]){_0x1a5698[_0xc75d('0x3e')]=[{'all':!![]}];}_0x1a5698=_[_0xc75d('0x38')]({},_0x1a5698,_0x81af32[_0xc75d('0x3a')]);return db[_0xc75d('0x3b')][_0xc75d('0x42')](_0x1a5698)[_0xc75d('0x21')](handleEntityNotFound(_0x499918,null))[_0xc75d('0x21')](respondWithResult(_0x499918,null))[_0xc75d('0x40')](handleError(_0x499918,null));};exports['describe']=function(_0x3c64f4,_0x24234d){return db[_0xc75d('0x3b')]['describe']()['then'](respondWithResult(_0x24234d,null))[_0xc75d('0x40')](handleError(_0x24234d,null));};exports['update']=function(_0x58f81d,_0x255225){if(_0x58f81d[_0xc75d('0x43')][_0xc75d('0x44')]){delete _0x58f81d[_0xc75d('0x43')]['uniqueid'];}return db[_0xc75d('0x3b')]['find']({'where':{'uniqueid':_0x58f81d[_0xc75d('0x45')]['id']}})[_0xc75d('0x21')](handleEntityNotFound(_0x255225,null))[_0xc75d('0x21')](saveUpdates(_0x58f81d[_0xc75d('0x43')],null))[_0xc75d('0x21')](respondWithResult(_0x255225,null))[_0xc75d('0x40')](handleError(_0x255225,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x59e694,_0x3e0b23,_0x35e9cd){return db['CmHopperFinal'][_0xc75d('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x59e694['params']['id']},'attributes':[[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db[_0xc75d('0x47')]['fn']('IF',db[_0xc75d('0x47')]['literal'](_0xc75d('0x49')))),'noSuchContacts'],[db[_0xc75d('0x47')]['fn']('COUNT',db[_0xc75d('0x47')]['fn']('IF',db[_0xc75d('0x47')][_0xc75d('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0xc75d('0x4b')],[db['sequelize']['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db[_0xc75d('0x47')][_0xc75d('0x4a')](_0xc75d('0x4c')))),_0xc75d('0x4d')],[db['sequelize']['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db[_0xc75d('0x47')]['literal'](_0xc75d('0x4e')))),_0xc75d('0x4f')],[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db[_0xc75d('0x47')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db[_0xc75d('0x47')][_0xc75d('0x4a')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xc75d('0x50')],[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0xc75d('0x4a')](_0xc75d('0x51')))),_0xc75d('0x52')],[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db[_0xc75d('0x47')]['fn']('IF',db[_0xc75d('0x47')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0xc75d('0x53')]]})[_0xc75d('0x21')](handleEntityNotFound(_0x3e0b23,null))[_0xc75d('0x21')](respondWithResult(_0x3e0b23,null))[_0xc75d('0x40')](handleError(_0x3e0b23,null));};exports[_0xc75d('0x54')]=function(_0x3e5b46,_0x4ebf7d,_0x304161){return db[_0xc75d('0x3b')][_0xc75d('0x46')]({'raw':![],'where':{'CampaignId':_0x3e5b46[_0xc75d('0x45')]['id']},'attributes':[[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db[_0xc75d('0x47')][_0xc75d('0x4a')](_0xc75d('0x49')))),_0xc75d('0x55')],[db['sequelize']['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0xc75d('0x4a')](_0xc75d('0x56')))),_0xc75d('0x4b')],[db['sequelize']['fn']('COUNT',db[_0xc75d('0x47')]['fn']('IF',db[_0xc75d('0x47')]['literal'](_0xc75d('0x4c')))),'busyContacts'],[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db[_0xc75d('0x47')][_0xc75d('0x4a')](_0xc75d('0x4e')))),_0xc75d('0x4f')],[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0xc75d('0x4a')](_0xc75d('0x57')))),_0xc75d('0x58')],[db[_0xc75d('0x47')]['fn']('COUNT',db[_0xc75d('0x47')]['fn']('IF',db['sequelize'][_0xc75d('0x4a')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xc75d('0x50')],[db['sequelize']['fn']('COUNT',db[_0xc75d('0x47')]['fn']('IF',db['sequelize'][_0xc75d('0x4a')]('`state`\x20=\x2022,\x201,\x20null'))),_0xc75d('0x52')],[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db[_0xc75d('0x47')]['fn']('IF',db['sequelize']['literal'](_0xc75d('0x59')))),'answeringMachine']]})[_0xc75d('0x21')](handleEntityNotFound(_0x4ebf7d,null))['then'](respondWithResult(_0x4ebf7d,null))[_0xc75d('0x40')](handleError(_0x4ebf7d,null));};exports[_0xc75d('0x5a')]=function(_0x270e54,_0x5934c6,_0x52abb8){return db['VoiceQueue'][_0xc75d('0x42')]({'where':{'id':_0x270e54[_0xc75d('0x45')]['id']}})[_0xc75d('0x21')](handleEntityNotFound(_0x5934c6,null))[_0xc75d('0x21')](function(_0x4c77d){var _0x349011;if(_0x4c77d){_0x349011=squel['insert']()[_0xc75d('0x5b')](_0xc75d('0x5c'))[_0xc75d('0x5d')]([_0xc75d('0x5e'),_0xc75d('0x5f'),'ContactId','ListId','VoiceQueueId','createdAt',_0xc75d('0x60')],squel[_0xc75d('0x61')]()[_0xc75d('0x62')](_0xc75d('0x63'),_0xc75d('0x5e'))[_0xc75d('0x62')](_0xc75d('0x64'),_0xc75d('0x5f'))['field'](_0xc75d('0x65'),_0xc75d('0x66'))['field'](_0xc75d('0x67'),_0xc75d('0x68'))['field'](_0xc75d('0x69'),_0xc75d('0x6a'))['field'](_0xc75d('0x64'),_0xc75d('0x6b'))[_0xc75d('0x62')](_0xc75d('0x64'),_0xc75d('0x60'))['from'](_0xc75d('0x6c'))[_0xc75d('0x37')](_0xc75d('0x6d'),_0x270e54[_0xc75d('0x45')]['id'][_0xc75d('0x6e')]())[_0xc75d('0x37')](_0xc75d('0x6f'),_0x270e54[_0xc75d('0x43')][_0xc75d('0x70')][_0xc75d('0x6e')]())[_0xc75d('0x37')](_0xc75d('0x71'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xc75d('0x62')](_0xc75d('0x5e'))['from']('cm_hopper')[_0xc75d('0x37')](_0xc75d('0x6d'),_0x270e54[_0xc75d('0x45')]['id'][_0xc75d('0x6e')]()))['where'](_0xc75d('0x72'),squel[_0xc75d('0x61')]()['field'](_0xc75d('0x73'))[_0xc75d('0x74')](_0xc75d('0x6c'))[_0xc75d('0x37')](_0xc75d('0x6d'),_0x270e54[_0xc75d('0x45')]['id'][_0xc75d('0x6e')]())['where']('state\x20=\x204'))[_0xc75d('0x75')]('ContactId'))[_0xc75d('0x6e')]();return db[_0xc75d('0x47')][_0xc75d('0x2b')](_0x349011);}return[];})[_0xc75d('0x21')](respondWithResult(_0x5934c6,null))[_0xc75d('0x40')](handleError(_0x5934c6,null));};exports[_0xc75d('0x76')]=function(_0x2f7175,_0x5b0407,_0x238ef0){return db[_0xc75d('0x77')][_0xc75d('0x42')]({'where':{'id':_0x2f7175['params']['id']}})['then'](handleEntityNotFound(_0x5b0407,null))[_0xc75d('0x21')](function(_0x4c171d){var _0xce67c2;if(_0x4c171d){_0xce67c2=squel[_0xc75d('0x78')]()[_0xc75d('0x5b')](_0xc75d('0x5c'))['fromQuery'](['phone','scheduledAt',_0xc75d('0x66'),_0xc75d('0x68'),_0xc75d('0x79'),'createdAt',_0xc75d('0x60')],squel[_0xc75d('0x61')]()[_0xc75d('0x62')]('ANY_VALUE(calleridnum)',_0xc75d('0x5e'))[_0xc75d('0x62')]('NOW()',_0xc75d('0x5f'))[_0xc75d('0x62')](_0xc75d('0x65'),_0xc75d('0x66'))[_0xc75d('0x62')](_0xc75d('0x67'),'ListId')[_0xc75d('0x62')](_0xc75d('0x7a'),_0xc75d('0x79'))[_0xc75d('0x62')](_0xc75d('0x64'),_0xc75d('0x6b'))['field'](_0xc75d('0x64'),'updatedAt')[_0xc75d('0x74')](_0xc75d('0x6c'))[_0xc75d('0x37')](_0xc75d('0x7b'),_0x2f7175[_0xc75d('0x45')]['id'][_0xc75d('0x6e')]())[_0xc75d('0x37')](_0xc75d('0x6f'),_0x2f7175[_0xc75d('0x43')][_0xc75d('0x70')][_0xc75d('0x6e')]())[_0xc75d('0x37')](_0xc75d('0x71'))[_0xc75d('0x37')](_0xc75d('0x72'),squel[_0xc75d('0x61')]()[_0xc75d('0x62')](_0xc75d('0x5e'))['from']('cm_hopper')[_0xc75d('0x37')]('CampaignId\x20=\x20?',_0x2f7175['params']['id']['toString']()))[_0xc75d('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xc75d('0x61')]()['field'](_0xc75d('0x73'))['from']('cm_hopper_final')['where'](_0xc75d('0x7b'),_0x2f7175[_0xc75d('0x45')]['id'][_0xc75d('0x6e')]())['where'](_0xc75d('0x7c')))['group'](_0xc75d('0x66')))['toString']();return db[_0xc75d('0x47')]['query'](_0xce67c2);}return[];})[_0xc75d('0x21')](respondWithResult(_0x5b0407,null))['catch'](handleError(_0x5b0407,null));};exports[_0xc75d('0x7d')]=function(_0x4f8c86,_0x121f22,_0x3a831a){return db[_0xc75d('0x7e')][_0xc75d('0x7f')]({'where':{'VoiceQueueId':_0x4f8c86[_0xc75d('0x43')][_0xc75d('0x6a')],'CampaignId':_0x4f8c86[_0xc75d('0x43')][_0xc75d('0x79')],'ContactId':_0x4f8c86[_0xc75d('0x43')]['ContactId']}})[_0xc75d('0x21')](handleEntityNotFound(_0x121f22,null))['then'](function(_0x2c4dc5){if(_0x2c4dc5){return _0x2c4dc5;}return null;})['then'](respondWithResult(_0x121f22,null))[_0xc75d('0x40')](handleError(_0x121f22,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 0b0b726..42efad6 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 _0xb634=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid'];(function(_0xbec8e6,_0x2841b5){var _0x4aa6f2=function(_0x583a0a){while(--_0x583a0a){_0xbec8e6['push'](_0xbec8e6['shift']());}};_0x4aa6f2(++_0x2841b5);}(_0xb634,0x1c0));var _0x4b63=function(_0x15b1fb,_0xa26679){_0x15b1fb=_0x15b1fb-0x0;var _0x139d7d=_0xb634[_0x15b1fb];return _0x139d7d;};'use strict';var _=require(_0x4b63('0x0'));var util=require('util');var logger=require(_0x4b63('0x1'))(_0x4b63('0x2'));var moment=require(_0x4b63('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b63('0x4'));var fs=require('fs');var path=require(_0x4b63('0x5'));var rimraf=require(_0x4b63('0x6'));var config=require(_0x4b63('0x7'));var attributes=require(_0x4b63('0x8'));module[_0x4b63('0x9')]=function(_0x47abe1,_0x57fba1){return _0x47abe1[_0x4b63('0xa')]('CmHopperFinal',attributes,{'tableName':_0x4b63('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x4b63('0xc')]},{'name':_0x4b63('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x80d9=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','cm_hopper_final','calleridnum','uniqueid'];(function(_0x4c6fc5,_0x959960){var _0x41744a=function(_0x3e407c){while(--_0x3e407c){_0x4c6fc5['push'](_0x4c6fc5['shift']());}};_0x41744a(++_0x959960);}(_0x80d9,0x15c));var _0x980d=function(_0x5d8788,_0x1e66f8){_0x5d8788=_0x5d8788-0x0;var _0x45c275=_0x80d9[_0x5d8788];return _0x45c275;};'use strict';var _=require(_0x980d('0x0'));var util=require('util');var logger=require(_0x980d('0x1'))(_0x980d('0x2'));var moment=require(_0x980d('0x3'));var BPromise=require('bluebird');var rp=require(_0x980d('0x4'));var fs=require('fs');var path=require(_0x980d('0x5'));var rimraf=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var attributes=require(_0x980d('0x8'));module['exports']=function(_0x4c3533,_0x2fd4b9){return _0x4c3533['define']('CmHopperFinal',attributes,{'tableName':_0x980d('0x9'),'paranoid':![],'indexes':[{'name':_0x980d('0xa'),'fields':[_0x980d('0xa')]},{'name':_0x980d('0xb'),'fields':[_0x980d('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 80795fc..36e5e13 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 _0xc873=['http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','options','stringify','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xaa0dc9,_0x5c570c){var _0x1eb73a=function(_0xb97d45){while(--_0xb97d45){_0xaa0dc9['push'](_0xaa0dc9['shift']());}};_0x1eb73a(++_0x5c570c);}(_0xc873,0x15a));var _0x3c87=function(_0x50973b,_0x31e978){_0x50973b=_0x50973b-0x0;var _0x324eaf=_0xc873[_0x50973b];return _0x324eaf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3c87('0x0'));var BPromise=require('bluebird');var rs=require(_0x3c87('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c87('0x2'))['db'];var utils=require(_0x3c87('0x3'));var logger=require(_0x3c87('0x4'))(_0x3c87('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3c87('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3b8646,_0x458a3a,_0x3a23aa){return new BPromise(function(_0x16fb8c,_0x1728e3){return client[_0x3c87('0x7')](_0x3b8646,_0x3a23aa)[_0x3c87('0x8')](function(_0x396e68){logger[_0x3c87('0x9')](_0x3c87('0xa'),_0x458a3a,_0x3c87('0xb'));logger[_0x3c87('0xc')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x458a3a,'request\x20sent',JSON['stringify'](_0x396e68));if(_0x396e68[_0x3c87('0xd')]){if(_0x396e68['error']['code']===0x1f4){logger[_0x3c87('0xd')]('CmHopperFinal,\x20%s,\x20%s',_0x458a3a,_0x396e68['error'][_0x3c87('0xe')]);return _0x1728e3(_0x396e68[_0x3c87('0xd')][_0x3c87('0xe')]);}logger[_0x3c87('0xd')](_0x3c87('0xa'),_0x458a3a,_0x396e68[_0x3c87('0xd')][_0x3c87('0xe')]);return _0x16fb8c(_0x396e68['error'][_0x3c87('0xe')]);}else{logger[_0x3c87('0x9')](_0x3c87('0xa'),_0x458a3a,_0x3c87('0xb'));_0x16fb8c(_0x396e68[_0x3c87('0xf')][_0x3c87('0xe')]);}})[_0x3c87('0x10')](function(_0x3acc3e){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x458a3a,_0x3acc3e);_0x1728e3(_0x3acc3e);});});}exports[_0x3c87('0x11')]=function(_0x4467cd){var _0x6dcfbb=this;return new Promise(function(_0x2934c4,_0x2d2fa2){return db[_0x3c87('0x12')][_0x3c87('0x13')](_0x4467cd['body'],{'raw':_0x4467cd['options']?_0x4467cd[_0x3c87('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x3c87('0x8')](function(_0x369ed0){logger['info'](_0x3c87('0x11'),_0x4467cd);logger[_0x3c87('0xc')]('CreateCmHopperFinal',_0x4467cd,JSON[_0x3c87('0x15')](_0x369ed0));_0x2934c4(_0x369ed0);})[_0x3c87('0x10')](function(_0x1f8cae){logger[_0x3c87('0xd')](_0x3c87('0x11'),_0x1f8cae[_0x3c87('0xe')],_0x4467cd);_0x2d2fa2(_0x6dcfbb[_0x3c87('0xd')](0x1f4,_0x1f8cae[_0x3c87('0xe')]));});});}; \ No newline at end of file +var _0xae1c=['stringify','code','error','message','info','result','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xc594ba,_0x3e7bc6){var _0xd596e2=function(_0x1a7c7b){while(--_0x1a7c7b){_0xc594ba['push'](_0xc594ba['shift']());}};_0xd596e2(++_0x3e7bc6);}(_0xae1c,0xff));var _0xcae1=function(_0x22df14,_0x5bd7ea){_0x22df14=_0x22df14-0x0;var _0x52977b=_0xae1c[_0x22df14];return _0x52977b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcae1('0x0'));var fs=require('fs');var Redis=require(_0xcae1('0x1'));var db=require(_0xcae1('0x2'))['db'];var utils=require(_0xcae1('0x3'));var logger=require(_0xcae1('0x4'))(_0xcae1('0x5'));var config=require(_0xcae1('0x6'));var jayson=require(_0xcae1('0x7'));var client=jayson[_0xcae1('0x8')][_0xcae1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c35c7,_0x38099e,_0x7a27b8){return new BPromise(function(_0x50d451,_0x4e419d){return client[_0xcae1('0xa')](_0x3c35c7,_0x7a27b8)[_0xcae1('0xb')](function(_0x3284aa){logger['info'](_0xcae1('0xc'),_0x38099e,_0xcae1('0xd'));logger[_0xcae1('0xe')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x38099e,_0xcae1('0xd'),JSON[_0xcae1('0xf')](_0x3284aa));if(_0x3284aa['error']){if(_0x3284aa['error'][_0xcae1('0x10')]===0x1f4){logger[_0xcae1('0x11')](_0xcae1('0xc'),_0x38099e,_0x3284aa[_0xcae1('0x11')][_0xcae1('0x12')]);return _0x4e419d(_0x3284aa[_0xcae1('0x11')][_0xcae1('0x12')]);}logger[_0xcae1('0x11')](_0xcae1('0xc'),_0x38099e,_0x3284aa[_0xcae1('0x11')][_0xcae1('0x12')]);return _0x50d451(_0x3284aa[_0xcae1('0x11')][_0xcae1('0x12')]);}else{logger[_0xcae1('0x13')](_0xcae1('0xc'),_0x38099e,'request\x20sent');_0x50d451(_0x3284aa[_0xcae1('0x14')][_0xcae1('0x12')]);}})['catch'](function(_0x4a7ef7){logger[_0xcae1('0x11')](_0xcae1('0xc'),_0x38099e,_0x4a7ef7);_0x4e419d(_0x4a7ef7);});});}exports['CreateCmHopperFinal']=function(_0x5f18d5){var _0x73b7d=this;return new Promise(function(_0x4dcd4b,_0x15eac8){return db[_0xcae1('0x15')][_0xcae1('0x16')](_0x5f18d5[_0xcae1('0x17')],{'raw':_0x5f18d5[_0xcae1('0x18')]?_0x5f18d5[_0xcae1('0x18')][_0xcae1('0x19')]===undefined?!![]:![]:!![]})[_0xcae1('0xb')](function(_0x11fda8){logger[_0xcae1('0x13')](_0xcae1('0x1a'),_0x5f18d5);logger[_0xcae1('0xe')](_0xcae1('0x1a'),_0x5f18d5,JSON[_0xcae1('0xf')](_0x11fda8));_0x4dcd4b(_0x11fda8);})['catch'](function(_0x1f8beb){logger[_0xcae1('0x11')](_0xcae1('0x1a'),_0x1f8beb[_0xcae1('0x12')],_0x5f18d5);_0x15eac8(_0x73b7d['error'](0x1f4,_0x1f8beb[_0xcae1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 9b9c26c..a139166 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 _0xe07a=['/checkContactHopper','checkContactHopper','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','moveContactsIvrCampaignHopperFinal'];(function(_0x28666a,_0x3dc25d){var _0x19d752=function(_0x551e47){while(--_0x551e47){_0x28666a['push'](_0x28666a['shift']());}};_0x19d752(++_0x3dc25d);}(_0xe07a,0xfc));var _0xae07=function(_0x57096e,_0x57a241){_0x57096e=_0x57096e-0x0;var _0x4061db=_0xe07a[_0x57096e];return _0x4061db;};'use strict';var multer=require(_0xae07('0x0'));var util=require(_0xae07('0x1'));var path=require(_0xae07('0x2'));var timeout=require(_0xae07('0x3'));var express=require(_0xae07('0x4'));var router=express[_0xae07('0x5')]();var auth=require(_0xae07('0x6'));var interaction=require(_0xae07('0x7'));var config=require(_0xae07('0x8'));var controller=require(_0xae07('0x9'));router[_0xae07('0xa')]('/',auth[_0xae07('0xb')](),controller[_0xae07('0xc')]);router[_0xae07('0xa')]('/describe',auth[_0xae07('0xb')](),controller[_0xae07('0xd')]);router[_0xae07('0xa')](_0xae07('0xe'),auth[_0xae07('0xb')](),controller[_0xae07('0xf')]);router['get']('/voice/queue/countAttributes/:id',auth[_0xae07('0xb')](),controller[_0xae07('0x10')]);router['get'](_0xae07('0x11'),auth[_0xae07('0xb')](),controller[_0xae07('0x12')]);router['post'](_0xae07('0x13'),auth[_0xae07('0xb')](),controller[_0xae07('0x14')]);router[_0xae07('0x15')]('/voice/campaign/moveContacts/:id',auth[_0xae07('0xb')](),controller[_0xae07('0x16')]);router['post'](_0xae07('0x17'),auth[_0xae07('0xb')](),controller[_0xae07('0x18')]);router['put']('/:id',auth[_0xae07('0xb')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x22ec=['/describe','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','post','checkContactHopper','put','update','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated'];(function(_0xddafcc,_0x5e601f){var _0x511cb1=function(_0x58d3ad){while(--_0x58d3ad){_0xddafcc['push'](_0xddafcc['shift']());}};_0x511cb1(++_0x5e601f);}(_0x22ec,0x1ee));var _0xc22e=function(_0xc0dc76,_0x11956c){_0xc0dc76=_0xc0dc76-0x0;var _0x445af1=_0x22ec[_0xc0dc76];return _0x445af1;};'use strict';var multer=require('multer');var util=require(_0xc22e('0x0'));var path=require(_0xc22e('0x1'));var timeout=require('connect-timeout');var express=require(_0xc22e('0x2'));var router=express[_0xc22e('0x3')]();var auth=require(_0xc22e('0x4'));var interaction=require(_0xc22e('0x5'));var config=require(_0xc22e('0x6'));var controller=require(_0xc22e('0x7'));router[_0xc22e('0x8')]('/',auth[_0xc22e('0x9')](),controller['index']);router['get'](_0xc22e('0xa'),auth[_0xc22e('0x9')](),controller[_0xc22e('0xb')]);router['get'](_0xc22e('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc22e('0x8')](_0xc22e('0xd'),auth[_0xc22e('0x9')](),controller[_0xc22e('0xe')]);router['get'](_0xc22e('0xf'),auth[_0xc22e('0x9')](),controller[_0xc22e('0x10')]);router['post'](_0xc22e('0x11'),auth[_0xc22e('0x9')](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0xc22e('0x12'),auth[_0xc22e('0x9')](),controller[_0xc22e('0x13')]);router[_0xc22e('0x14')]('/checkContactHopper',auth[_0xc22e('0x9')](),controller[_0xc22e('0x15')]);router[_0xc22e('0x16')]('/:id',auth[_0xc22e('0x9')](),controller[_0xc22e('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index ee08fad..e78d96b 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 _0x3737=['BOOLEAN','INTEGER','STRING','DATE'];(function(_0xf5fa0d,_0x17485e){var _0x2633e3=function(_0x593a2f){while(--_0x593a2f){_0xf5fa0d['push'](_0xf5fa0d['shift']());}};_0x2633e3(++_0x17485e);}(_0x3737,0x69));var _0x7373=function(_0x49ae9b,_0xf8c269){_0x49ae9b=_0x49ae9b-0x0;var _0x125b30=_0x3737[_0x49ae9b];return _0x125b30;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x7373('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x7373('0x1')]},'scheduledat':{'type':Sequelize[_0x7373('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7373('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7373('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x7373('0x1')]},'originatecalleridname':{'type':Sequelize[_0x7373('0x1')]},'calleridnum':{'type':Sequelize[_0x7373('0x1')]},'calleridname':{'type':Sequelize[_0x7373('0x1')]},'starttime':{'type':Sequelize[_0x7373('0x2')]},'responsetime':{'type':Sequelize[_0x7373('0x2')]},'answertime':{'type':Sequelize[_0x7373('0x2')]},'droptime':{'type':Sequelize[_0x7373('0x2')]},'endtime':{'type':Sequelize[_0x7373('0x2')]},'ringtime':{'type':Sequelize[_0x7373('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7373('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7373('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7373('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7373('0x1')]},'campaign':{'type':Sequelize[_0x7373('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7373('0x1')]},'reason':{'type':Sequelize[_0x7373('0x1')]},'amd':{'type':Sequelize[_0x7373('0x3')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x7373('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7373('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7373('0x2')]},'recallme':{'type':Sequelize[_0x7373('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x7373('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x7373('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7373('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7373('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7373('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7373('0x0')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7373('0x1')]}}; \ No newline at end of file +var _0x8d3f=['STRING','DATE','INTEGER','BOOLEAN','exports'];(function(_0x595768,_0x90cee2){var _0x26c217=function(_0x35d477){while(--_0x35d477){_0x595768['push'](_0x595768['shift']());}};_0x26c217(++_0x90cee2);}(_0x8d3f,0x1c6));var _0xf8d3=function(_0x2068b1,_0x4c4fd9){_0x2068b1=_0x2068b1-0x0;var _0x266164=_0x8d3f[_0x2068b1];return _0x266164;};'use strict';var Sequelize=require('sequelize');module[_0xf8d3('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xf8d3('0x1')]},'scheduledat':{'type':Sequelize[_0xf8d3('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xf8d3('0x1')]},'originatecalleridname':{'type':Sequelize[_0xf8d3('0x1')]},'calleridnum':{'type':Sequelize[_0xf8d3('0x1')]},'calleridname':{'type':Sequelize[_0xf8d3('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xf8d3('0x2')]},'answertime':{'type':Sequelize[_0xf8d3('0x2')]},'droptime':{'type':Sequelize[_0xf8d3('0x2')]},'endtime':{'type':Sequelize[_0xf8d3('0x2')]},'ringtime':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf8d3('0x1')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xf8d3('0x1')]},'membername':{'type':Sequelize[_0xf8d3('0x1')]},'reason':{'type':Sequelize[_0xf8d3('0x1')]},'amd':{'type':Sequelize[_0xf8d3('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf8d3('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xf8d3('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf8d3('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf8d3('0x2')]},'recallme':{'type':Sequelize[_0xf8d3('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xf8d3('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 75745ef..98a53f0 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 _0xd4f1=['rows','catch','show','params','options','create','describe','body','uniqueid','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','then','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','merge','where','count','includeAll','include','findAll'];(function(_0x379eaf,_0x4eb489){var _0x326f1f=function(_0x4a8bc2){while(--_0x4a8bc2){_0x379eaf['push'](_0x379eaf['shift']());}};_0x326f1f(++_0x4eb489);}(_0xd4f1,0x181));var _0x1d4f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4f1[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x1d4f('0x0'));var emlformat=require(_0x1d4f('0x1'));var rimraf=require(_0x1d4f('0x2'));var zipdir=require(_0x1d4f('0x3'));var jsonpatch=require(_0x1d4f('0x4'));var rp=require('request-promise');var moment=require(_0x1d4f('0x5'));var BPromise=require(_0x1d4f('0x6'));var Mustache=require(_0x1d4f('0x7'));var util=require('util');var path=require(_0x1d4f('0x8'));var sox=require(_0x1d4f('0x9'));var csv=require(_0x1d4f('0xa'));var ejs=require(_0x1d4f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1d4f('0xc'));var crypto=require(_0x1d4f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1d4f('0xe'));var toCsv=require(_0x1d4f('0xa'));var querystring=require(_0x1d4f('0xf'));var Papa=require(_0x1d4f('0x10'));var Redis=require(_0x1d4f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1d4f('0x12'));var as=require(_0x1d4f('0x13'));var hardwareService=require(_0x1d4f('0x14'));var logger=require(_0x1d4f('0x15'))(_0x1d4f('0x16'));var utils=require(_0x1d4f('0x17'));var config=require(_0x1d4f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403ee7,_0x10c695){_0x10c695=_0x10c695||0xcc;return function(_0xb8b147){if(_0xb8b147){return _0x403ee7[_0x1d4f('0x19')](_0x10c695);}return _0x403ee7[_0x1d4f('0x1a')](_0x10c695)[_0x1d4f('0x1b')]();};}function respondWithResult(_0x5c4507,_0x590788){_0x590788=_0x590788||0xc8;return function(_0x19ea7a){if(_0x19ea7a){return _0x5c4507[_0x1d4f('0x1a')](_0x590788)[_0x1d4f('0x1c')](_0x19ea7a);}};}function respondWithFilteredResult(_0x3b781b,_0x338081){return function(_0x17c17b){if(_0x17c17b){var _0x5ee70c=_0x17c17b['count'],_0x585b85=_0x338081['offset'],_0x6b465d=_0x338081[_0x1d4f('0x1d')]+_0x338081[_0x1d4f('0x1e')],_0x10e29a;if(_0x6b465d>=_0x5ee70c){_0x6b465d=_0x5ee70c;_0x10e29a=0xc8;}else{_0x10e29a=0xce;}_0x3b781b[_0x1d4f('0x1a')](_0x10e29a);return _0x3b781b[_0x1d4f('0x1f')](_0x1d4f('0x20'),_0x585b85+'-'+_0x6b465d+'/'+_0x5ee70c)['json'](_0x17c17b);}return null;};}function patchUpdates(_0x2b8843){return function(_0x399e63){try{jsonpatch[_0x1d4f('0x21')](_0x399e63,_0x2b8843,!![]);}catch(_0x32c562){return BPromise[_0x1d4f('0x22')](_0x32c562);}return _0x399e63['save']();};}function saveUpdates(_0x10f5f3,_0x18f04f){return function(_0x1ecf42){if(_0x1ecf42){return _0x1ecf42['update'](_0x10f5f3)[_0x1d4f('0x23')](function(_0x4d032c){return _0x4d032c;});}return null;};}function removeEntity(_0x2845a2,_0x57ab13){return function(_0x52da3f){if(_0x52da3f){return _0x52da3f['destroy']()[_0x1d4f('0x23')](function(){_0x2845a2[_0x1d4f('0x1a')](0xcc)[_0x1d4f('0x1b')]();});}};}function handleEntityNotFound(_0x5acdb3,_0x36f847){return function(_0x2ca9f6){if(!_0x2ca9f6){_0x5acdb3[_0x1d4f('0x19')](0x194);}return _0x2ca9f6;};}function handleError(_0x2954e6,_0x55922b){_0x55922b=_0x55922b||0x1f4;return function(_0x8a462e){logger[_0x1d4f('0x24')](_0x8a462e[_0x1d4f('0x25')]);if(_0x8a462e[_0x1d4f('0x26')]){delete _0x8a462e['name'];}_0x2954e6[_0x1d4f('0x1a')](_0x55922b)[_0x1d4f('0x27')](_0x8a462e);};}exports[_0x1d4f('0x28')]=function(_0x35c057,_0x52a3a9){var _0x16182d={},_0x49ed54={},_0x16e659={'count':0x0,'rows':[]};var _0x41a0d8=_[_0x1d4f('0x29')](db[_0x1d4f('0x2a')][_0x1d4f('0x2b')],function(_0x3d3321){return{'name':_0x3d3321[_0x1d4f('0x2c')],'type':_0x3d3321[_0x1d4f('0x2d')][_0x1d4f('0x2e')]};});_0x49ed54[_0x1d4f('0x2f')]=_[_0x1d4f('0x29')](_0x41a0d8,'name');_0x49ed54[_0x1d4f('0x30')]=_[_0x1d4f('0x31')](_0x35c057[_0x1d4f('0x30')]);_0x49ed54[_0x1d4f('0x32')]=_[_0x1d4f('0x33')](_0x49ed54[_0x1d4f('0x2f')],_0x49ed54[_0x1d4f('0x30')]);_0x16182d[_0x1d4f('0x34')]=_[_0x1d4f('0x33')](_0x49ed54[_0x1d4f('0x2f')],qs[_0x1d4f('0x35')](_0x35c057[_0x1d4f('0x30')][_0x1d4f('0x35')]));_0x16182d['attributes']=_0x16182d[_0x1d4f('0x34')][_0x1d4f('0x36')]?_0x16182d[_0x1d4f('0x34')]:_0x49ed54[_0x1d4f('0x2f')];if(!_0x35c057[_0x1d4f('0x30')][_0x1d4f('0x37')]('nolimit')){_0x16182d[_0x1d4f('0x1e')]=qs['limit'](_0x35c057[_0x1d4f('0x30')][_0x1d4f('0x1e')]);_0x16182d['offset']=qs[_0x1d4f('0x1d')](_0x35c057['query'][_0x1d4f('0x1d')]);}_0x16182d['order']=qs['sort'](_0x35c057[_0x1d4f('0x30')][_0x1d4f('0x38')]);_0x16182d['where']=qs[_0x1d4f('0x32')](_[_0x1d4f('0x39')](_0x35c057[_0x1d4f('0x30')],_0x49ed54[_0x1d4f('0x32')]),_0x41a0d8);if(_0x35c057['query'][_0x1d4f('0x3a')]){_0x16182d['where']=_[_0x1d4f('0x3b')](_0x16182d[_0x1d4f('0x3c')],{'$or':_[_0x1d4f('0x29')](_0x41a0d8,function(_0x5ff17e){if(_0x5ff17e[_0x1d4f('0x2d')]!=='VIRTUAL'){var _0x1c8f23={};_0x1c8f23[_0x5ff17e[_0x1d4f('0x26')]]={'$like':'%'+_0x35c057[_0x1d4f('0x30')][_0x1d4f('0x3a')]+'%'};return _0x1c8f23;}})});}_0x16182d=_[_0x1d4f('0x3b')]({},_0x16182d,_0x35c057['options']);var _0x592574={'where':_0x16182d[_0x1d4f('0x3c')]};return db[_0x1d4f('0x2a')]['count'](_0x592574)[_0x1d4f('0x23')](function(_0x536bb0){_0x16e659[_0x1d4f('0x3d')]=_0x536bb0;if(_0x35c057['query'][_0x1d4f('0x3e')]){_0x16182d[_0x1d4f('0x3f')]=[{'all':!![]}];}return db[_0x1d4f('0x2a')][_0x1d4f('0x40')](_0x16182d);})[_0x1d4f('0x23')](function(_0x73b11f){_0x16e659[_0x1d4f('0x41')]=_0x73b11f;return _0x16e659;})[_0x1d4f('0x23')](respondWithFilteredResult(_0x52a3a9,_0x16182d))[_0x1d4f('0x42')](handleError(_0x52a3a9,null));};exports[_0x1d4f('0x43')]=function(_0x389b21,_0x5b2eb1){var _0x238800={'raw':!![],'where':{'id':_0x389b21[_0x1d4f('0x44')]['id']}},_0x232ccc={};_0x232ccc['model']=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x232ccc[_0x1d4f('0x30')]=_[_0x1d4f('0x31')](_0x389b21[_0x1d4f('0x30')]);_0x232ccc[_0x1d4f('0x32')]=_['intersection'](_0x232ccc[_0x1d4f('0x2f')],_0x232ccc[_0x1d4f('0x30')]);_0x238800[_0x1d4f('0x34')]=_[_0x1d4f('0x33')](_0x232ccc[_0x1d4f('0x2f')],qs[_0x1d4f('0x35')](_0x389b21[_0x1d4f('0x30')][_0x1d4f('0x35')]));_0x238800['attributes']=_0x238800['attributes'][_0x1d4f('0x36')]?_0x238800[_0x1d4f('0x34')]:_0x232ccc[_0x1d4f('0x2f')];if(_0x389b21[_0x1d4f('0x30')][_0x1d4f('0x3e')]){_0x238800[_0x1d4f('0x3f')]=[{'all':!![]}];}_0x238800=_[_0x1d4f('0x3b')]({},_0x238800,_0x389b21[_0x1d4f('0x45')]);return db[_0x1d4f('0x2a')]['find'](_0x238800)[_0x1d4f('0x23')](handleEntityNotFound(_0x5b2eb1,null))[_0x1d4f('0x23')](respondWithResult(_0x5b2eb1,null))[_0x1d4f('0x42')](handleError(_0x5b2eb1,null));};exports[_0x1d4f('0x46')]=function(_0x441b74,_0xf5531c){return db['CmHopperHistory'][_0x1d4f('0x46')](_0x441b74['body'],{})[_0x1d4f('0x23')](respondWithResult(_0xf5531c,0xc9))[_0x1d4f('0x42')](handleError(_0xf5531c,null));};exports[_0x1d4f('0x47')]=function(_0x1c1daa,_0x5d3a7b){return db['CmHopperHistory'][_0x1d4f('0x47')]()[_0x1d4f('0x23')](respondWithResult(_0x5d3a7b,null))[_0x1d4f('0x42')](handleError(_0x5d3a7b,null));};exports['update']=function(_0x1d09bd,_0x4c5d18){if(_0x1d09bd[_0x1d4f('0x48')]['uniqueid']){delete _0x1d09bd[_0x1d4f('0x48')][_0x1d4f('0x49')];}return db[_0x1d4f('0x2a')][_0x1d4f('0x4a')]({'where':{'uniqueid':_0x1d09bd[_0x1d4f('0x44')]['id']}})[_0x1d4f('0x23')](handleEntityNotFound(_0x4c5d18,null))['then'](saveUpdates(_0x1d09bd[_0x1d4f('0x48')],null))[_0x1d4f('0x23')](respondWithResult(_0x4c5d18,null))[_0x1d4f('0x42')](handleError(_0x4c5d18,null));}; \ No newline at end of file +var _0xbd8a=['set','apply','reject','save','then','destroy','error','stack','name','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','nolimit','limit','sort','where','filters','pick','merge','options','CmHopperHistory','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','describe','uniqueid','find','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset'];(function(_0x59cb86,_0x493f63){var _0x515d2a=function(_0x4208d3){while(--_0x4208d3){_0x59cb86['push'](_0x59cb86['shift']());}};_0x515d2a(++_0x493f63);}(_0xbd8a,0xb5));var _0xabd8=function(_0x59e7e0,_0x3ec148){_0x59e7e0=_0x59e7e0-0x0;var _0x26b058=_0xbd8a[_0x59e7e0];return _0x26b058;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xabd8('0x0'));var zipdir=require(_0xabd8('0x1'));var jsonpatch=require(_0xabd8('0x2'));var rp=require('request-promise');var moment=require(_0xabd8('0x3'));var BPromise=require(_0xabd8('0x4'));var Mustache=require(_0xabd8('0x5'));var util=require(_0xabd8('0x6'));var path=require(_0xabd8('0x7'));var sox=require('sox');var csv=require(_0xabd8('0x8'));var ejs=require(_0xabd8('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xabd8('0xa'));var crypto=require(_0xabd8('0xb'));var jsforce=require(_0xabd8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xabd8('0x8'));var querystring=require(_0xabd8('0xd'));var Papa=require(_0xabd8('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xabd8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabd8('0x10'));var logger=require(_0xabd8('0x11'))(_0xabd8('0x12'));var utils=require(_0xabd8('0x13'));var config=require(_0xabd8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40d0b9,_0x50e17c){_0x50e17c=_0x50e17c||0xcc;return function(_0x39adce){if(_0x39adce){return _0x40d0b9[_0xabd8('0x15')](_0x50e17c);}return _0x40d0b9['status'](_0x50e17c)[_0xabd8('0x16')]();};}function respondWithResult(_0x1b3bc6,_0x21b84c){_0x21b84c=_0x21b84c||0xc8;return function(_0x251147){if(_0x251147){return _0x1b3bc6[_0xabd8('0x17')](_0x21b84c)[_0xabd8('0x18')](_0x251147);}};}function respondWithFilteredResult(_0x50c7b5,_0x1830b9){return function(_0x5be710){if(_0x5be710){var _0x2afe22=_0x5be710['count'],_0x332952=_0x1830b9[_0xabd8('0x19')],_0x4f4454=_0x1830b9[_0xabd8('0x19')]+_0x1830b9['limit'],_0x181df2;if(_0x4f4454>=_0x2afe22){_0x4f4454=_0x2afe22;_0x181df2=0xc8;}else{_0x181df2=0xce;}_0x50c7b5[_0xabd8('0x17')](_0x181df2);return _0x50c7b5[_0xabd8('0x1a')]('Content-Range',_0x332952+'-'+_0x4f4454+'/'+_0x2afe22)[_0xabd8('0x18')](_0x5be710);}return null;};}function patchUpdates(_0xc6c779){return function(_0x3f685b){try{jsonpatch[_0xabd8('0x1b')](_0x3f685b,_0xc6c779,!![]);}catch(_0xe8589a){return BPromise[_0xabd8('0x1c')](_0xe8589a);}return _0x3f685b[_0xabd8('0x1d')]();};}function saveUpdates(_0x4aed91,_0x8a6ff6){return function(_0x1c6cc6){if(_0x1c6cc6){return _0x1c6cc6['update'](_0x4aed91)[_0xabd8('0x1e')](function(_0x38c725){return _0x38c725;});}return null;};}function removeEntity(_0x996a70,_0xe5c20a){return function(_0x235599){if(_0x235599){return _0x235599[_0xabd8('0x1f')]()['then'](function(){_0x996a70[_0xabd8('0x17')](0xcc)[_0xabd8('0x16')]();});}};}function handleEntityNotFound(_0x5db64c,_0x17aee7){return function(_0xf8bc1c){if(!_0xf8bc1c){_0x5db64c[_0xabd8('0x15')](0x194);}return _0xf8bc1c;};}function handleError(_0x202050,_0x279005){_0x279005=_0x279005||0x1f4;return function(_0x2636fe){logger[_0xabd8('0x20')](_0x2636fe[_0xabd8('0x21')]);if(_0x2636fe[_0xabd8('0x22')]){delete _0x2636fe[_0xabd8('0x22')];}_0x202050[_0xabd8('0x17')](_0x279005)['send'](_0x2636fe);};}exports[_0xabd8('0x23')]=function(_0x5a513e,_0x1f9a9){var _0x39c88c={},_0x17134b={},_0x51aff3={'count':0x0,'rows':[]};var _0x9c640a=_[_0xabd8('0x24')](db['CmHopperHistory']['rawAttributes'],function(_0x3e0f23){return{'name':_0x3e0f23[_0xabd8('0x25')],'type':_0x3e0f23[_0xabd8('0x26')][_0xabd8('0x27')]};});_0x17134b[_0xabd8('0x28')]=_[_0xabd8('0x24')](_0x9c640a,_0xabd8('0x22'));_0x17134b[_0xabd8('0x29')]=_[_0xabd8('0x2a')](_0x5a513e[_0xabd8('0x29')]);_0x17134b['filters']=_['intersection'](_0x17134b[_0xabd8('0x28')],_0x17134b[_0xabd8('0x29')]);_0x39c88c[_0xabd8('0x2b')]=_[_0xabd8('0x2c')](_0x17134b[_0xabd8('0x28')],qs[_0xabd8('0x2d')](_0x5a513e[_0xabd8('0x29')][_0xabd8('0x2d')]));_0x39c88c[_0xabd8('0x2b')]=_0x39c88c[_0xabd8('0x2b')]['length']?_0x39c88c['attributes']:_0x17134b[_0xabd8('0x28')];if(!_0x5a513e[_0xabd8('0x29')]['hasOwnProperty'](_0xabd8('0x2e'))){_0x39c88c['limit']=qs[_0xabd8('0x2f')](_0x5a513e[_0xabd8('0x29')]['limit']);_0x39c88c[_0xabd8('0x19')]=qs[_0xabd8('0x19')](_0x5a513e[_0xabd8('0x29')][_0xabd8('0x19')]);}_0x39c88c['order']=qs[_0xabd8('0x30')](_0x5a513e[_0xabd8('0x29')]['sort']);_0x39c88c[_0xabd8('0x31')]=qs[_0xabd8('0x32')](_[_0xabd8('0x33')](_0x5a513e[_0xabd8('0x29')],_0x17134b[_0xabd8('0x32')]),_0x9c640a);if(_0x5a513e[_0xabd8('0x29')]['filter']){_0x39c88c[_0xabd8('0x31')]=_[_0xabd8('0x34')](_0x39c88c[_0xabd8('0x31')],{'$or':_[_0xabd8('0x24')](_0x9c640a,function(_0x2ee451){if(_0x2ee451['type']!=='VIRTUAL'){var _0x310931={};_0x310931[_0x2ee451[_0xabd8('0x22')]]={'$like':'%'+_0x5a513e[_0xabd8('0x29')]['filter']+'%'};return _0x310931;}})});}_0x39c88c=_[_0xabd8('0x34')]({},_0x39c88c,_0x5a513e[_0xabd8('0x35')]);var _0x1dab98={'where':_0x39c88c[_0xabd8('0x31')]};return db[_0xabd8('0x36')]['count'](_0x1dab98)['then'](function(_0x25cc8d){_0x51aff3[_0xabd8('0x37')]=_0x25cc8d;if(_0x5a513e[_0xabd8('0x29')][_0xabd8('0x38')]){_0x39c88c[_0xabd8('0x39')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xabd8('0x3a')](_0x39c88c);})[_0xabd8('0x1e')](function(_0x469933){_0x51aff3[_0xabd8('0x3b')]=_0x469933;return _0x51aff3;})[_0xabd8('0x1e')](respondWithFilteredResult(_0x1f9a9,_0x39c88c))[_0xabd8('0x3c')](handleError(_0x1f9a9,null));};exports[_0xabd8('0x3d')]=function(_0x5e1928,_0xc00b30){var _0x4aee34={'raw':!![],'where':{'id':_0x5e1928[_0xabd8('0x3e')]['id']}},_0x352efc={};_0x352efc['model']=_['keys'](db['CmHopperHistory'][_0xabd8('0x3f')]);_0x352efc[_0xabd8('0x29')]=_['keys'](_0x5e1928[_0xabd8('0x29')]);_0x352efc[_0xabd8('0x32')]=_[_0xabd8('0x2c')](_0x352efc['model'],_0x352efc[_0xabd8('0x29')]);_0x4aee34[_0xabd8('0x2b')]=_['intersection'](_0x352efc[_0xabd8('0x28')],qs[_0xabd8('0x2d')](_0x5e1928[_0xabd8('0x29')][_0xabd8('0x2d')]));_0x4aee34[_0xabd8('0x2b')]=_0x4aee34[_0xabd8('0x2b')]['length']?_0x4aee34[_0xabd8('0x2b')]:_0x352efc['model'];if(_0x5e1928['query']['includeAll']){_0x4aee34[_0xabd8('0x39')]=[{'all':!![]}];}_0x4aee34=_[_0xabd8('0x34')]({},_0x4aee34,_0x5e1928[_0xabd8('0x35')]);return db[_0xabd8('0x36')]['find'](_0x4aee34)[_0xabd8('0x1e')](handleEntityNotFound(_0xc00b30,null))['then'](respondWithResult(_0xc00b30,null))[_0xabd8('0x3c')](handleError(_0xc00b30,null));};exports[_0xabd8('0x40')]=function(_0x18a939,_0x230a2d){return db[_0xabd8('0x36')]['create'](_0x18a939[_0xabd8('0x41')],{})[_0xabd8('0x1e')](respondWithResult(_0x230a2d,0xc9))[_0xabd8('0x3c')](handleError(_0x230a2d,null));};exports[_0xabd8('0x42')]=function(_0x80a80b,_0xe4e19e){return db[_0xabd8('0x36')][_0xabd8('0x42')]()[_0xabd8('0x1e')](respondWithResult(_0xe4e19e,null))[_0xabd8('0x3c')](handleError(_0xe4e19e,null));};exports['update']=function(_0x2778da,_0xae95aa){if(_0x2778da[_0xabd8('0x41')][_0xabd8('0x43')]){delete _0x2778da[_0xabd8('0x41')][_0xabd8('0x43')];}return db['CmHopperHistory'][_0xabd8('0x44')]({'where':{'uniqueid':_0x2778da[_0xabd8('0x3e')]['id']}})[_0xabd8('0x1e')](handleEntityNotFound(_0xae95aa,null))['then'](saveUpdates(_0x2778da['body'],null))[_0xabd8('0x1e')](respondWithResult(_0xae95aa,null))[_0xabd8('0x3c')](handleError(_0xae95aa,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 0cc93d7..48a0512 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 _0x4482=['../../config/environment','exports','define','CmHopperHistory','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x4482,0x184));var _0x2448=function(_0x370b04,_0x1f0815){_0x370b04=_0x370b04-0x0;var _0x3a4e77=_0x4482[_0x370b04];return _0x3a4e77;};'use strict';var _=require(_0x2448('0x0'));var util=require(_0x2448('0x1'));var logger=require(_0x2448('0x2'))(_0x2448('0x3'));var moment=require('moment');var BPromise=require(_0x2448('0x4'));var rp=require(_0x2448('0x5'));var fs=require('fs');var path=require(_0x2448('0x6'));var rimraf=require(_0x2448('0x7'));var config=require(_0x2448('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0x2448('0x9')]=function(_0x1ae533,_0xe790a7){return _0x1ae533[_0x2448('0xa')](_0x2448('0xb'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xde3b=['request-promise','path','rimraf','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','lodash','../../config/logger','api','moment','bluebird'];(function(_0x418634,_0x8542b){var _0x284cb0=function(_0x5f4b9b){while(--_0x5f4b9b){_0x418634['push'](_0x418634['shift']());}};_0x284cb0(++_0x8542b);}(_0xde3b,0x1dc));var _0xbde3=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xde3b[_0x3fba9f];return _0x192cf1;};'use strict';var _=require(_0xbde3('0x0'));var util=require('util');var logger=require(_0xbde3('0x1'))(_0xbde3('0x2'));var moment=require(_0xbde3('0x3'));var BPromise=require(_0xbde3('0x4'));var rp=require(_0xbde3('0x5'));var fs=require('fs');var path=require(_0xbde3('0x6'));var rimraf=require(_0xbde3('0x7'));var config=require('../../config/environment');var attributes=require(_0xbde3('0x8'));module['exports']=function(_0xa299a6,_0x4fac23){return _0xa299a6[_0xbde3('0x9')](_0xbde3('0xa'),attributes,{'tableName':_0xbde3('0xb'),'paranoid':![],'indexes':[{'name':_0xbde3('0xc'),'fields':[_0xbde3('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 f64a44a..b82b49f 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 _0x7916=['body','options','raw','sequelize','COUNT','col','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','AvgHandleTime','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','findAll','ivrAnswerCallsDay','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x7916,0x128));var _0x6791=function(_0x40e1ed,_0x297e89){_0x40e1ed=_0x40e1ed-0x0;var _0x220ddd=_0x7916[_0x40e1ed];return _0x220ddd;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var moment=require(_0x6791('0x1'));var BPromise=require(_0x6791('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6791('0x3'));var db=require(_0x6791('0x4'))['db'];var utils=require(_0x6791('0x5'));var logger=require(_0x6791('0x6'))('rpc');var config=require(_0x6791('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6791('0x8')][_0x6791('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ad8c0,_0x8b85ff,_0x5d2118){return new BPromise(function(_0x2b240c,_0x50c563){return client['request'](_0x5ad8c0,_0x5d2118)[_0x6791('0xa')](function(_0x198a64){logger['info'](_0x6791('0xb'),_0x8b85ff,_0x6791('0xc'));logger[_0x6791('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x8b85ff,_0x6791('0xc'),JSON[_0x6791('0xe')](_0x198a64));if(_0x198a64[_0x6791('0xf')]){if(_0x198a64[_0x6791('0xf')][_0x6791('0x10')]===0x1f4){logger[_0x6791('0xf')](_0x6791('0xb'),_0x8b85ff,_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);return _0x50c563(_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x8b85ff,_0x198a64[_0x6791('0xf')]['message']);return _0x2b240c(_0x198a64[_0x6791('0xf')]['message']);}else{logger[_0x6791('0x12')](_0x6791('0xb'),_0x8b85ff,'request\x20sent');_0x2b240c(_0x198a64[_0x6791('0x13')]['message']);}})[_0x6791('0x14')](function(_0x150d1f){logger['error'](_0x6791('0xb'),_0x8b85ff,_0x150d1f);_0x50c563(_0x150d1f);});});}exports[_0x6791('0x15')]=function(_0x5bec14){var _0x1872f5=this;return new Promise(function(_0x4d8a79,_0xe55dba){return db[_0x6791('0x16')][_0x6791('0x17')](_0x5bec14[_0x6791('0x18')],{'raw':_0x5bec14[_0x6791('0x19')]?_0x5bec14[_0x6791('0x19')][_0x6791('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4a2922){logger[_0x6791('0x12')]('CreateCmHopperHistory',_0x5bec14);logger[_0x6791('0xd')](_0x6791('0x15'),_0x5bec14,JSON['stringify'](_0x4a2922));_0x4d8a79(_0x4a2922);})[_0x6791('0x14')](function(_0x309610){logger[_0x6791('0xf')](_0x6791('0x15'),_0x309610['message'],_0x5bec14);_0xe55dba(_0x1872f5[_0x6791('0xf')](0x1f4,_0x309610[_0x6791('0x11')]));});});};exports['AvgHandleTime']=function(_0x53bb44){var _0x4b23bc=this;return new Promise(function(_0x372dae,_0x502043){return db[_0x6791('0x16')]['findAll']({'raw':_0x53bb44['options']?_0x53bb44['options'][_0x6791('0x1a')]===undefined?!![]:![]:!![],'where':_0x53bb44[_0x6791('0x19')]?_0x53bb44[_0x6791('0x19')]['where']||null:null,'attributes':[[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db['sequelize'][_0x6791('0x1d')]('id')),'predictiveIntervalTotalCalls'],[db[_0x6791('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6791('0x1b')]['literal'](_0x6791('0x1e')))),_0x6791('0x1f')],[db['sequelize']['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x6791('0x1b')]['fn']('COUNT',db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')](_0x6791('0x21')))),_0x6791('0x22')],[db[_0x6791('0x1b')]['fn'](_0x6791('0x23'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x6791('0x24')],[db[_0x6791('0x1b')]['fn'](_0x6791('0x23'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x1de770){logger[_0x6791('0x12')](_0x6791('0x25'),_0x53bb44);logger['debug']('AvgHandleTime',_0x53bb44,JSON[_0x6791('0xe')](_0x1de770));_0x372dae(_0x1de770);})[_0x6791('0x14')](function(_0x31a525){logger[_0x6791('0xf')]('AvgHandleTime',_0x31a525[_0x6791('0x11')],_0x53bb44);_0x502043(_0x4b23bc[_0x6791('0xf')](0x1f4,_0x31a525[_0x6791('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x31217d){var _0x567e36=this;return new Promise(function(_0x4ee010,_0x256c02){return db[_0x6791('0x16')]['findAll']({'raw':_0x31217d[_0x6791('0x19')]?_0x31217d[_0x6791('0x19')][_0x6791('0x1a')]===undefined?!![]:![]:!![],'where':_0x31217d[_0x6791('0x19')]?_0x31217d[_0x6791('0x19')]['where']||null:null,'attributes':[[_0x6791('0x26'),_0x6791('0x27')],[db[_0x6791('0x1b')]['fn']('COUNT',db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')]('`state`\x20=\x200,\x201,\x20null'))),_0x6791('0x28')],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db['sequelize'][_0x6791('0x20')](_0x6791('0x29')))),_0x6791('0x2a')],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')](_0x6791('0x1e')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db['sequelize'][_0x6791('0x20')](_0x6791('0x2b')))),_0x6791('0x2c')],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')]['literal'](_0x6791('0x2d')))),'outboundCongestionCallsDay'],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')]['literal'](_0x6791('0x2e')))),_0x6791('0x2f')],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')](_0x6791('0x30')))),'outboundDropCallsDayCallersExit'],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')]['literal'](_0x6791('0x31')))),_0x6791('0x32')],[db['sequelize']['fn'](_0x6791('0x1c'),db['sequelize']['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')](_0x6791('0x33')))),_0x6791('0x34')],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')]('`state`\x20=\x2014,\x201,\x20null'))),_0x6791('0x35')],[db['sequelize']['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')](_0x6791('0x36')))),'outboundRejectCallsDay'],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')][_0x6791('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0x6791('0x37')],[db[_0x6791('0x1b')]['fn']('COUNT',db[_0x6791('0x1b')]['fn']('IF',db['sequelize'][_0x6791('0x20')](_0x6791('0x38')))),_0x6791('0x39')],[db[_0x6791('0x1b')]['fn']('COUNT',db[_0x6791('0x1b')]['fn']('IF',db[_0x6791('0x1b')]['literal'](_0x6791('0x3a')))),_0x6791('0x3b')]],'group':[_0x6791('0x26')]})['then'](function(_0x355e97){logger[_0x6791('0x12')]('GetVoiceQueueHopperHistory',_0x31217d);logger[_0x6791('0xd')](_0x6791('0x3c'),_0x31217d,JSON['stringify'](_0x355e97));_0x4ee010(_0x355e97);})[_0x6791('0x14')](function(_0x216498){logger[_0x6791('0xf')](_0x6791('0x3c'),_0x216498['message'],_0x31217d);_0x256c02(_0x567e36[_0x6791('0xf')](0x1f4,_0x216498[_0x6791('0x11')]));});});};exports[_0x6791('0x3d')]=function(_0x5b534b){var _0x5a7a88=this;return new Promise(function(_0x1d6bec,_0x6b8acd){return db[_0x6791('0x16')][_0x6791('0x3e')]({'raw':_0x5b534b[_0x6791('0x19')]?_0x5b534b['options']['raw']===undefined?!![]:![]:!![],'where':_0x5b534b[_0x6791('0x19')]?_0x5b534b['options']['where']||null:null,'attributes':[[_0x6791('0x26'),_0x6791('0x27')],[db[_0x6791('0x1b')]['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')][_0x6791('0x1d')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x6791('0x1c'),db[_0x6791('0x1b')]['fn']('IF',db['sequelize'][_0x6791('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x6791('0x3f')]],'group':[_0x6791('0x26')]})['then'](function(_0x1ebfb6){logger[_0x6791('0x12')](_0x6791('0x3d'),_0x5b534b);logger['debug'](_0x6791('0x3d'),_0x5b534b,JSON[_0x6791('0xe')](_0x1ebfb6));_0x1d6bec(_0x1ebfb6);})[_0x6791('0x14')](function(_0x383853){logger[_0x6791('0xf')]('GetCampaignHopperHistory',_0x383853['message'],_0x5b534b);_0x6b8acd(_0x5a7a88[_0x6791('0xf')](0x1f4,_0x383853[_0x6791('0x11')]));});});}; \ No newline at end of file +var _0x4cf8=['`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','CreateCmHopperHistory','body','options','raw','AvgHandleTime','CmHopperHistory','findAll','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout'];(function(_0x32e8dd,_0x18b832){var _0x4eab85=function(_0x54a8ad){while(--_0x54a8ad){_0x32e8dd['push'](_0x32e8dd['shift']());}};_0x4eab85(++_0x18b832);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0x4cf8[_0x14490c];return _0x2f6825;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var moment=require(_0x84cf('0x2'));var BPromise=require(_0x84cf('0x3'));var rs=require(_0x84cf('0x4'));var fs=require('fs');var Redis=require(_0x84cf('0x5'));var db=require(_0x84cf('0x6'))['db'];var utils=require(_0x84cf('0x7'));var logger=require(_0x84cf('0x8'))(_0x84cf('0x9'));var config=require(_0x84cf('0xa'));var jayson=require(_0x84cf('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x455345,_0x56c5cc,_0x15ba85){return new BPromise(function(_0x2c11b0,_0x51b84c){return client[_0x84cf('0xc')](_0x455345,_0x15ba85)[_0x84cf('0xd')](function(_0x489063){logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));logger[_0x84cf('0x11')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x56c5cc,_0x84cf('0x10'),JSON[_0x84cf('0x12')](_0x489063));if(_0x489063['error']){if(_0x489063['error'][_0x84cf('0x13')]===0x1f4){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x51b84c(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x2c11b0(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}else{logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));_0x2c11b0(_0x489063[_0x84cf('0x16')][_0x84cf('0x15')]);}})[_0x84cf('0x17')](function(_0x5b8ac8){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x5b8ac8);_0x51b84c(_0x5b8ac8);});});}exports[_0x84cf('0x18')]=function(_0x1abe2d){var _0x1dad1a=this;return new Promise(function(_0x13ba16,_0xe6b5b6){return db['CmHopperHistory']['create'](_0x1abe2d[_0x84cf('0x19')],{'raw':_0x1abe2d[_0x84cf('0x1a')]?_0x1abe2d[_0x84cf('0x1a')][_0x84cf('0x1b')]===undefined?!![]:![]:!![]})[_0x84cf('0xd')](function(_0x5dda3f){logger[_0x84cf('0xe')](_0x84cf('0x18'),_0x1abe2d);logger[_0x84cf('0x11')](_0x84cf('0x18'),_0x1abe2d,JSON[_0x84cf('0x12')](_0x5dda3f));_0x13ba16(_0x5dda3f);})['catch'](function(_0x42fa45){logger[_0x84cf('0x14')](_0x84cf('0x18'),_0x42fa45[_0x84cf('0x15')],_0x1abe2d);_0xe6b5b6(_0x1dad1a[_0x84cf('0x14')](0x1f4,_0x42fa45[_0x84cf('0x15')]));});});};exports[_0x84cf('0x1c')]=function(_0x4c9d1c){var _0x2b2c90=this;return new Promise(function(_0x26db3f,_0x1c7747){return db[_0x84cf('0x1d')][_0x84cf('0x1e')]({'raw':_0x4c9d1c[_0x84cf('0x1a')]?_0x4c9d1c[_0x84cf('0x1a')][_0x84cf('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c9d1c[_0x84cf('0x1a')]?_0x4c9d1c[_0x84cf('0x1a')]['where']||null:null,'attributes':[[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')][_0x84cf('0x21')]('id')),'predictiveIntervalTotalCalls'],[db[_0x84cf('0x1f')]['fn']('COUNT',db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')](_0x84cf('0x23')))),_0x84cf('0x24')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')](_0x84cf('0x25')))),_0x84cf('0x26')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x84cf('0x22')](_0x84cf('0x27')))),_0x84cf('0x28')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x29'),db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x84cf('0x2a')],[db[_0x84cf('0x1f')]['fn']('AVG',db[_0x84cf('0x1f')]['fn']('IF',db['sequelize'][_0x84cf('0x22')](_0x84cf('0x2b')))),_0x84cf('0x2c')]]})[_0x84cf('0xd')](function(_0x172ce9){logger['info'](_0x84cf('0x1c'),_0x4c9d1c);logger['debug']('AvgHandleTime',_0x4c9d1c,JSON[_0x84cf('0x12')](_0x172ce9));_0x26db3f(_0x172ce9);})[_0x84cf('0x17')](function(_0x4c4676){logger[_0x84cf('0x14')](_0x84cf('0x1c'),_0x4c4676[_0x84cf('0x15')],_0x4c9d1c);_0x1c7747(_0x2b2c90[_0x84cf('0x14')](0x1f4,_0x4c4676[_0x84cf('0x15')]));});});};exports[_0x84cf('0x2d')]=function(_0x56f798){var _0x2d2d4b=this;return new Promise(function(_0xb6d12d,_0x275cac){return db[_0x84cf('0x1d')][_0x84cf('0x1e')]({'raw':_0x56f798[_0x84cf('0x1a')]?_0x56f798['options'][_0x84cf('0x1b')]===undefined?!![]:![]:!![],'where':_0x56f798['options']?_0x56f798[_0x84cf('0x1a')][_0x84cf('0x2e')]||null:null,'attributes':[[_0x84cf('0x2f'),_0x84cf('0x30')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x200,\x201,\x20null'))),_0x84cf('0x31')],[db['sequelize']['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db['sequelize'][_0x84cf('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0x84cf('0x32')],[db['sequelize']['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x84cf('0x33')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db[_0x84cf('0x1f')]['literal'](_0x84cf('0x34')))),'outboundBusyCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')]['literal'](_0x84cf('0x35')))),'outboundCongestionCallsDay'],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db[_0x84cf('0x1f')]['literal'](_0x84cf('0x36')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x84cf('0x37')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db['sequelize'][_0x84cf('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0x84cf('0x38')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x84cf('0x39')],[db[_0x84cf('0x1f')]['fn']('COUNT',db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')](_0x84cf('0x3a')))),_0x84cf('0x3b')],[db['sequelize']['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db[_0x84cf('0x1f')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0x84cf('0x3c')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x84cf('0x22')](_0x84cf('0x3d')))),_0x84cf('0x3b')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x84cf('0x3e')]],'group':['campaign']})['then'](function(_0x147194){logger[_0x84cf('0xe')]('GetVoiceQueueHopperHistory',_0x56f798);logger['debug'](_0x84cf('0x2d'),_0x56f798,JSON[_0x84cf('0x12')](_0x147194));_0xb6d12d(_0x147194);})[_0x84cf('0x17')](function(_0x1e2676){logger[_0x84cf('0x14')](_0x84cf('0x2d'),_0x1e2676[_0x84cf('0x15')],_0x56f798);_0x275cac(_0x2d2d4b[_0x84cf('0x14')](0x1f4,_0x1e2676['message']));});});};exports[_0x84cf('0x3f')]=function(_0x11f3cc){var _0x52991f=this;return new Promise(function(_0x5a4003,_0x1537f3){return db[_0x84cf('0x1d')][_0x84cf('0x1e')]({'raw':_0x11f3cc[_0x84cf('0x1a')]?_0x11f3cc[_0x84cf('0x1a')][_0x84cf('0x1b')]===undefined?!![]:![]:!![],'where':_0x11f3cc[_0x84cf('0x1a')]?_0x11f3cc['options'][_0x84cf('0x2e')]||null:null,'attributes':[['campaign',_0x84cf('0x30')],[db['sequelize']['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['col']('id')),_0x84cf('0x40')],[db[_0x84cf('0x1f')]['fn']('COUNT',db[_0x84cf('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x84cf('0x2f')]})[_0x84cf('0xd')](function(_0x10a229){logger[_0x84cf('0xe')]('GetCampaignHopperHistory',_0x11f3cc);logger[_0x84cf('0x11')](_0x84cf('0x3f'),_0x11f3cc,JSON['stringify'](_0x10a229));_0x5a4003(_0x10a229);})[_0x84cf('0x17')](function(_0x293fe9){logger[_0x84cf('0x14')](_0x84cf('0x3f'),_0x293fe9[_0x84cf('0x15')],_0x11f3cc);_0x1537f3(_0x52991f[_0x84cf('0x14')](0x1f4,_0x293fe9[_0x84cf('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 56c2bb0..2b28b3d 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 _0x0ea2=['post','update','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x269274,_0x44efa7){var _0x36ec0e=function(_0xe340b4){while(--_0xe340b4){_0x269274['push'](_0x269274['shift']());}};_0x36ec0e(++_0x44efa7);}(_0x0ea2,0x189));var _0x20ea=function(_0x381476,_0x1c520f){_0x381476=_0x381476-0x0;var _0x5b20fb=_0x0ea2[_0x381476];return _0x5b20fb;};'use strict';var multer=require(_0x20ea('0x0'));var util=require(_0x20ea('0x1'));var path=require(_0x20ea('0x2'));var timeout=require(_0x20ea('0x3'));var express=require('express');var router=express[_0x20ea('0x4')]();var auth=require(_0x20ea('0x5'));var interaction=require(_0x20ea('0x6'));var config=require(_0x20ea('0x7'));var controller=require(_0x20ea('0x8'));router[_0x20ea('0x9')]('/',auth[_0x20ea('0xa')](),controller[_0x20ea('0xb')]);router['get'](_0x20ea('0xc'),auth[_0x20ea('0xa')](),controller['describe']);router[_0x20ea('0x9')](_0x20ea('0xd'),auth['isAuthenticated'](),controller[_0x20ea('0xe')]);router[_0x20ea('0xf')]('/',auth[_0x20ea('0xa')](),controller['create']);router['put'](_0x20ea('0xd'),auth[_0x20ea('0xa')](),controller[_0x20ea('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd33c=['describe','post','create','put','/:id','update','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe'];(function(_0x580f48,_0x2e34c1){var _0x16133f=function(_0x1f1959){while(--_0x1f1959){_0x580f48['push'](_0x580f48['shift']());}};_0x16133f(++_0x2e34c1);}(_0xd33c,0x115));var _0xcd33=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xd33c[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0xcd33('0x0'));var util=require(_0xcd33('0x1'));var path=require('path');var timeout=require(_0xcd33('0x2'));var express=require(_0xcd33('0x3'));var router=express['Router']();var auth=require(_0xcd33('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcd33('0x5'));var controller=require(_0xcd33('0x6'));router[_0xcd33('0x7')]('/',auth[_0xcd33('0x8')](),controller[_0xcd33('0x9')]);router['get'](_0xcd33('0xa'),auth['isAuthenticated'](),controller[_0xcd33('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xcd33('0xc')]('/',auth[_0xcd33('0x8')](),controller[_0xcd33('0xd')]);router[_0xcd33('0xe')](_0xcd33('0xf'),auth[_0xcd33('0x8')](),controller[_0xcd33('0x10')]);module[_0xcd33('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index d25e07f..07990ac 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 _0x54d4=['sequelize','exports','STRING'];(function(_0x37ae2f,_0x36a07b){var _0x2f0b3d=function(_0x81c6bc){while(--_0x81c6bc){_0x37ae2f['push'](_0x37ae2f['shift']());}};_0x2f0b3d(++_0x36a07b);}(_0x54d4,0xff));var _0x454d=function(_0x121619,_0x293a7a){_0x121619=_0x121619-0x0;var _0x37ba1f=_0x54d4[_0x121619];return _0x37ba1f;};'use strict';var Sequelize=require(_0x454d('0x0'));module[_0x454d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x454d('0x2')]}}; \ No newline at end of file +var _0x006c=['STRING','name','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x006c,0x156));var _0xc006=function(_0x3c48b0,_0x327bfe){_0x3c48b0=_0x3c48b0-0x0;var _0x28a6e4=_0x006c[_0x3c48b0];return _0x28a6e4;};'use strict';var Sequelize=require(_0xc006('0x0'));module[_0xc006('0x1')]={'name':{'type':Sequelize[_0xc006('0x2')],'unique':_0xc006('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc006('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 4f3e2f3..7f120f2 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 _0x120a=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','length','ListId','filter','removeDispositions','CmContact','tags','isArray','join','each','omit','ids','success','push','dataValues','message','CmCustomField','CustomFields','format','cf_%d','getContacts','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','name','send','index','map','CmList','rawAttributes','type','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create'];(function(_0xfdeaaf,_0x50ba66){var _0xa18cd7=function(_0x14a111){while(--_0x14a111){_0xfdeaaf['push'](_0xfdeaaf['shift']());}};_0xa18cd7(++_0x50ba66);}(_0x120a,0x152));var _0xa120=function(_0x14ec75,_0x56a3d4){_0x14ec75=_0x14ec75-0x0;var _0x40b9e9=_0x120a[_0x14ec75];return _0x40b9e9;};'use strict';var pdf=require(_0xa120('0x0'));var emlformat=require(_0xa120('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa120('0x2'));var rp=require(_0xa120('0x3'));var moment=require(_0xa120('0x4'));var BPromise=require(_0xa120('0x5'));var Mustache=require(_0xa120('0x6'));var util=require(_0xa120('0x7'));var path=require(_0xa120('0x8'));var sox=require('sox');var csv=require(_0xa120('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa120('0xa'));var squel=require(_0xa120('0xb'));var crypto=require(_0xa120('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa120('0x9'));var querystring=require(_0xa120('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa120('0xe'));var qs=require(_0xa120('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa120('0x10'));var logger=require(_0xa120('0x11'))(_0xa120('0x12'));var utils=require(_0xa120('0x13'));var config=require(_0xa120('0x14'));var db=require(_0xa120('0x15'))['db'];config['redis']=_[_0xa120('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa120('0x17'))(new Redis(config['redis']));require('./cmList.socket')[_0xa120('0x18')](socket);function respondWithStatusCode(_0x19a4e4,_0x3003cc){_0x3003cc=_0x3003cc||0xcc;return function(_0x455852){if(_0x455852){return _0x19a4e4[_0xa120('0x19')](_0x3003cc);}return _0x19a4e4[_0xa120('0x1a')](_0x3003cc)[_0xa120('0x1b')]();};}function respondWithResult(_0x2b0518,_0x1129a6){_0x1129a6=_0x1129a6||0xc8;return function(_0x178751){if(_0x178751){return _0x2b0518[_0xa120('0x1a')](_0x1129a6)[_0xa120('0x1c')](_0x178751);}};}function respondWithFilteredResult(_0x3a1b4a,_0x5ede4d){return function(_0x151ee4){if(_0x151ee4){var _0x1782b4=_0x151ee4[_0xa120('0x1d')],_0x1e8291=_0x5ede4d[_0xa120('0x1e')],_0x2b1f93=_0x5ede4d['offset']+_0x5ede4d['limit'],_0x82e870;if(_0x2b1f93>=_0x1782b4){_0x2b1f93=_0x1782b4;_0x82e870=0xc8;}else{_0x82e870=0xce;}_0x3a1b4a['status'](_0x82e870);return _0x3a1b4a[_0xa120('0x1f')](_0xa120('0x20'),_0x1e8291+'-'+_0x2b1f93+'/'+_0x1782b4)[_0xa120('0x1c')](_0x151ee4);}return null;};}function patchUpdates(_0x22a740){return function(_0x5a848a){try{jsonpatch['apply'](_0x5a848a,_0x22a740,!![]);}catch(_0x4abb42){return BPromise[_0xa120('0x21')](_0x4abb42);}return _0x5a848a[_0xa120('0x22')]();};}function saveUpdates(_0x3c6f55,_0x4eda23){return function(_0x1076f2){if(_0x1076f2){return _0x1076f2[_0xa120('0x23')](_0x3c6f55)[_0xa120('0x24')](function(_0x1d4353){return _0x1d4353;});}return null;};}function removeEntity(_0x466476,_0x235a82){return function(_0x1a2dcb){if(_0x1a2dcb){return _0x1a2dcb[_0xa120('0x25')]()[_0xa120('0x24')](function(){var _0x48f63b=_0x1a2dcb[_0xa120('0x26')]({'plain':!![]});var _0x5ff11e=_0xa120('0x27');return db[_0xa120('0x28')][_0xa120('0x25')]({'where':{'type':_0x5ff11e,'resourceId':_0x48f63b['id']}})[_0xa120('0x24')](function(){return _0x1a2dcb;});})[_0xa120('0x24')](function(){_0x466476[_0xa120('0x1a')](0xcc)[_0xa120('0x1b')]();});}};}function handleEntityNotFound(_0x2b5bea,_0x2c3782){return function(_0x1e5647){if(!_0x1e5647){_0x2b5bea[_0xa120('0x19')](0x194);}return _0x1e5647;};}function handleError(_0x22650f,_0x561648){_0x561648=_0x561648||0x1f4;return function(_0x23a31b){logger[_0xa120('0x29')](_0x23a31b['stack']);if(_0x23a31b['name']){delete _0x23a31b[_0xa120('0x2a')];}_0x22650f[_0xa120('0x1a')](_0x561648)[_0xa120('0x2b')](_0x23a31b);};}exports[_0xa120('0x2c')]=function(_0x22a9ba,_0x5b7ce3){var _0x3d8eb1={},_0x524d62={},_0x1eb2ae={'count':0x0,'rows':[]};var _0x25b86a=_[_0xa120('0x2d')](db[_0xa120('0x2e')][_0xa120('0x2f')],function(_0x3c4dd5){return{'name':_0x3c4dd5['fieldName'],'type':_0x3c4dd5[_0xa120('0x30')][_0xa120('0x31')]};});_0x524d62['model']=_[_0xa120('0x2d')](_0x25b86a,_0xa120('0x2a'));_0x524d62['query']=_[_0xa120('0x32')](_0x22a9ba[_0xa120('0x33')]);_0x524d62['filters']=_[_0xa120('0x34')](_0x524d62[_0xa120('0x35')],_0x524d62['query']);_0x3d8eb1[_0xa120('0x36')]=_[_0xa120('0x34')](_0x524d62[_0xa120('0x35')],qs[_0xa120('0x37')](_0x22a9ba[_0xa120('0x33')][_0xa120('0x37')]));_0x3d8eb1[_0xa120('0x36')]=_0x3d8eb1[_0xa120('0x36')]['length']?_0x3d8eb1['attributes']:_0x524d62['model'];if(!_0x22a9ba[_0xa120('0x33')][_0xa120('0x38')](_0xa120('0x39'))){_0x3d8eb1['limit']=qs[_0xa120('0x3a')](_0x22a9ba[_0xa120('0x33')][_0xa120('0x3a')]);_0x3d8eb1['offset']=qs[_0xa120('0x1e')](_0x22a9ba[_0xa120('0x33')]['offset']);}_0x3d8eb1[_0xa120('0x3b')]=qs[_0xa120('0x3c')](_0x22a9ba[_0xa120('0x33')][_0xa120('0x3c')]);_0x3d8eb1[_0xa120('0x3d')]=qs[_0xa120('0x3e')](_[_0xa120('0x3f')](_0x22a9ba[_0xa120('0x33')],_0x524d62[_0xa120('0x3e')]),_0x25b86a);if(_0x22a9ba['query']['filter']){_0x3d8eb1['where']=_[_0xa120('0x40')](_0x3d8eb1[_0xa120('0x3d')],{'$or':_['map'](_0x25b86a,function(_0x3ef691){if(_0x3ef691[_0xa120('0x30')]!==_0xa120('0x41')){var _0x314af8={};_0x314af8[_0x3ef691[_0xa120('0x2a')]]={'$like':'%'+_0x22a9ba[_0xa120('0x33')]['filter']+'%'};return _0x314af8;}})});}_0x3d8eb1=_[_0xa120('0x40')]({},_0x3d8eb1,_0x22a9ba[_0xa120('0x42')]);var _0x57ef1c={'where':_0x3d8eb1[_0xa120('0x3d')]};return db[_0xa120('0x2e')]['count'](_0x57ef1c)[_0xa120('0x24')](function(_0x3b319d){_0x1eb2ae[_0xa120('0x1d')]=_0x3b319d;if(_0x22a9ba[_0xa120('0x33')][_0xa120('0x43')]){_0x3d8eb1[_0xa120('0x44')]=[{'all':!![]}];}return db[_0xa120('0x2e')][_0xa120('0x45')](_0x3d8eb1);})[_0xa120('0x24')](function(_0xcb4f0f){_0x1eb2ae[_0xa120('0x46')]=_0xcb4f0f;return _0x1eb2ae;})[_0xa120('0x24')](respondWithFilteredResult(_0x5b7ce3,_0x3d8eb1))[_0xa120('0x47')](handleError(_0x5b7ce3,null));};exports[_0xa120('0x48')]=function(_0x4f8fe3,_0x12ce0f){var _0x296c3d={'raw':![],'where':{'id':_0x4f8fe3[_0xa120('0x49')]['id']}},_0x255b3e={};_0x255b3e[_0xa120('0x35')]=_[_0xa120('0x32')](db[_0xa120('0x2e')][_0xa120('0x2f')]);_0x255b3e[_0xa120('0x33')]=_[_0xa120('0x32')](_0x4f8fe3[_0xa120('0x33')]);_0x255b3e[_0xa120('0x3e')]=_[_0xa120('0x34')](_0x255b3e[_0xa120('0x35')],_0x255b3e['query']);_0x296c3d[_0xa120('0x36')]=_['intersection'](_0x255b3e['model'],qs[_0xa120('0x37')](_0x4f8fe3[_0xa120('0x33')][_0xa120('0x37')]));_0x296c3d[_0xa120('0x36')]=_0x296c3d['attributes']['length']?_0x296c3d[_0xa120('0x36')]:_0x255b3e[_0xa120('0x35')];if(_0x4f8fe3[_0xa120('0x33')][_0xa120('0x43')]){_0x296c3d[_0xa120('0x44')]=[{'all':!![]}];}_0x296c3d=_[_0xa120('0x40')]({},_0x296c3d,_0x4f8fe3[_0xa120('0x42')]);return db[_0xa120('0x2e')][_0xa120('0x4a')](_0x296c3d)[_0xa120('0x24')](handleEntityNotFound(_0x12ce0f,null))[_0xa120('0x24')](respondWithResult(_0x12ce0f,null))[_0xa120('0x47')](handleError(_0x12ce0f,null));};exports[_0xa120('0x4b')]=function(_0x1a9813,_0x533b00){return db['CmList'][_0xa120('0x4b')](_0x1a9813[_0xa120('0x4c')],{})[_0xa120('0x24')](function(_0x6210a7){var _0x717b01=_0x1a9813[_0xa120('0x4d')]['get']({'plain':!![]});if(!_0x717b01)throw new Error(_0xa120('0x4e'));if(_0x717b01[_0xa120('0x4f')]===_0xa120('0x4d')){var _0x154e8f=_0x6210a7[_0xa120('0x26')]({'plain':!![]});var _0x11392e=_0xa120('0x27');return db[_0xa120('0x50')][_0xa120('0x4a')]({'where':{'name':_0x11392e,'userProfileId':_0x717b01['userProfileId']},'raw':!![]})[_0xa120('0x24')](function(_0xc04d0d){if(_0xc04d0d&&_0xc04d0d['autoAssociation']===0x0){return db['UserProfileResource'][_0xa120('0x4b')]({'name':_0x154e8f['name'],'resourceId':_0x154e8f['id'],'type':_0xc04d0d[_0xa120('0x2a')],'sectionId':_0xc04d0d['id']},{})['then'](function(){return _0x6210a7;});}else{return _0x6210a7;}})[_0xa120('0x47')](function(_0x4b2221){logger[_0xa120('0x29')](_0xa120('0x51'),_0x4b2221);throw _0x4b2221;});}return _0x6210a7;})[_0xa120('0x24')](respondWithResult(_0x533b00,0xc9))[_0xa120('0x47')](handleError(_0x533b00,null));};exports[_0xa120('0x23')]=function(_0x4b7b14,_0x9058b6){if(_0x4b7b14['body']['id']){delete _0x4b7b14['body']['id'];}return db[_0xa120('0x2e')][_0xa120('0x4a')]({'where':{'id':_0x4b7b14[_0xa120('0x49')]['id']}})['then'](handleEntityNotFound(_0x9058b6,null))[_0xa120('0x24')](saveUpdates(_0x4b7b14['body'],null))[_0xa120('0x24')](respondWithResult(_0x9058b6,null))[_0xa120('0x47')](handleError(_0x9058b6,null));};exports[_0xa120('0x25')]=function(_0x29f165,_0x54b80e){return db[_0xa120('0x2e')][_0xa120('0x4a')]({'where':{'id':_0x29f165[_0xa120('0x49')]['id']}})['then'](handleEntityNotFound(_0x54b80e,null))[_0xa120('0x24')](removeEntity(_0x54b80e,null))[_0xa120('0x47')](handleError(_0x54b80e,null));};exports[_0xa120('0x52')]=function(_0x3de6f6,_0x47ed69){return db[_0xa120('0x2e')][_0xa120('0x52')]()[_0xa120('0x24')](respondWithResult(_0x47ed69,null))['catch'](handleError(_0x47ed69,null));};exports['addDisposition']=function(_0x17ed93,_0x2987c1,_0x1b1189){if(_0x17ed93[_0xa120('0x4c')]['id']){delete _0x17ed93[_0xa120('0x4c')]['id'];}return db[_0xa120('0x2e')]['find']({'where':{'id':_0x17ed93[_0xa120('0x49')]['id']}})[_0xa120('0x24')](handleEntityNotFound(_0x2987c1,null))[_0xa120('0x24')](function(_0x57d430){if(_0x57d430){_0x17ed93['body']['ListId']=_0x57d430['id'];return db[_0xa120('0x53')][_0xa120('0x4b')](_0x17ed93[_0xa120('0x4c')]);}})[_0xa120('0x24')](respondWithResult(_0x2987c1,null))[_0xa120('0x47')](handleError(_0x2987c1,null));};exports[_0xa120('0x54')]=function(_0x3e8b17,_0x5dee9d,_0x2cef27){var _0x514c5f={'raw':![],'where':{}};var _0x408d0f={};var _0x4e03e2={'count':0x0,'rows':[]};return db['CmList'][_0xa120('0x55')]({'where':{'id':_0x3e8b17[_0xa120('0x49')]['id']}})[_0xa120('0x24')](handleEntityNotFound(_0x5dee9d,null))['then'](function(_0x203fa2){if(_0x203fa2){_0x408d0f[_0xa120('0x35')]=_[_0xa120('0x32')](db[_0xa120('0x53')][_0xa120('0x2f')]);_0x408d0f[_0xa120('0x33')]=_[_0xa120('0x32')](_0x3e8b17[_0xa120('0x33')]);_0x408d0f[_0xa120('0x3e')]=_['intersection'](_0x408d0f[_0xa120('0x35')],_0x408d0f[_0xa120('0x33')]);_0x514c5f[_0xa120('0x36')]=_[_0xa120('0x34')](_0x408d0f[_0xa120('0x35')],qs[_0xa120('0x37')](_0x3e8b17[_0xa120('0x33')][_0xa120('0x37')]));_0x514c5f[_0xa120('0x36')]=_0x514c5f[_0xa120('0x36')][_0xa120('0x56')]?_0x514c5f[_0xa120('0x36')]:_0x408d0f[_0xa120('0x35')];if(!_0x3e8b17['query'][_0xa120('0x38')]('nolimit')){_0x514c5f[_0xa120('0x3a')]=qs[_0xa120('0x3a')](_0x3e8b17[_0xa120('0x33')][_0xa120('0x3a')]);_0x514c5f[_0xa120('0x1e')]=qs[_0xa120('0x1e')](_0x3e8b17[_0xa120('0x33')][_0xa120('0x1e')]);}_0x514c5f[_0xa120('0x3b')]=qs[_0xa120('0x3c')](_0x3e8b17['query'][_0xa120('0x3c')]);_0x514c5f[_0xa120('0x3d')]=qs[_0xa120('0x3e')](_[_0xa120('0x3f')](_0x3e8b17[_0xa120('0x33')],_0x408d0f[_0xa120('0x3e')]));_0x514c5f[_0xa120('0x3d')][_0xa120('0x57')]=_0x203fa2['id'];if(_0x3e8b17['query']['filter']){_0x514c5f[_0xa120('0x3d')]=_[_0xa120('0x40')](_0x514c5f[_0xa120('0x3d')],{'$or':_[_0xa120('0x2d')](_0x514c5f[_0xa120('0x36')],function(_0x11e2f1){var _0x9ddf05={};_0x9ddf05[_0x11e2f1]={'$like':'%'+_0x3e8b17[_0xa120('0x33')][_0xa120('0x58')]+'%'};return _0x9ddf05;})});}_0x514c5f=_['merge']({},_0x514c5f,_0x3e8b17[_0xa120('0x42')]);return db[_0xa120('0x53')]['count']({'where':_0x514c5f[_0xa120('0x3d')]})[_0xa120('0x24')](function(_0x323962){_0x4e03e2[_0xa120('0x1d')]=_0x323962;if(_0x3e8b17[_0xa120('0x33')]['includeAll']){_0x514c5f['include']=[{'all':!![]}];}return db[_0xa120('0x53')][_0xa120('0x45')](_0x514c5f);})[_0xa120('0x24')](function(_0x47b158){_0x4e03e2[_0xa120('0x46')]=_0x47b158;return _0x4e03e2;});}})[_0xa120('0x24')](respondWithFilteredResult(_0x5dee9d,_0x514c5f))['catch'](handleError(_0x5dee9d,null));};exports[_0xa120('0x59')]=function(_0xbf2da,_0xba41a5,_0x4b98f0){return db[_0xa120('0x2e')][_0xa120('0x4a')]({'where':{'id':_0xbf2da[_0xa120('0x49')]['id']}})['then'](handleEntityNotFound(_0xba41a5,null))[_0xa120('0x24')](function(_0x1f5eb2){if(_0x1f5eb2){return _0x1f5eb2[_0xa120('0x59')](_0xbf2da[_0xa120('0x33')]['ids']);}})['then'](respondWithStatusCode(_0xba41a5,null))['catch'](handleError(_0xba41a5,null));};exports['addContacts']=function(_0x12bb7e,_0x468759,_0x48be35){return db['CmList'][_0xa120('0x4a')]({'where':{'id':_0x12bb7e[_0xa120('0x49')]['id']}})[_0xa120('0x24')](handleEntityNotFound(_0x468759,null))[_0xa120('0x24')](function(_0x108d22){if(_0x108d22){var _0x1b9a74=[];var _0x573a4e={'success':[],'errors':[]};return db[_0xa120('0x5a')][_0xa120('0x52')]()[_0xa120('0x24')](function(_0x54a036){if(_0x12bb7e['body'][_0xa120('0x5b')]&&_[_0xa120('0x5c')](_0x12bb7e[_0xa120('0x4c')][_0xa120('0x5b')])){if(_0x12bb7e[_0xa120('0x4c')]['tags'][_0xa120('0x56')]){_0x12bb7e[_0xa120('0x4c')]['tags']=_0x12bb7e[_0xa120('0x4c')][_0xa120('0x5b')][_0xa120('0x5d')](';')+';';}else{_0x12bb7e['body'][_0xa120('0x5b')]=null;}}else{_0x12bb7e['body']['tags']=null;}if(_0x12bb7e['body']&&_['isArray'](_0x12bb7e[_0xa120('0x4c')])){for(var _0x16fe45=0x0;_0x16fe45<_0x12bb7e[_0xa120('0x4c')][_0xa120('0x56')];_0x16fe45+=0x1){_0x12bb7e['body'][_0x16fe45][_0xa120('0x57')]=_0x12bb7e[_0xa120('0x49')]['id'];_0x1b9a74['push'](_0x12bb7e['body'][_0x16fe45]);}return BPromise[_0xa120('0x5e')](_0x1b9a74,function(_0xd2c0b3){return db['CmContact']['create'](_[_0xa120('0x5f')](_0xd2c0b3,[_0xa120('0x60'),'id'])||{},{'fields':_[_0xa120('0x32')](_0x54a036),'raw':!![]})['then'](function(_0x542e20){_0x573a4e[_0xa120('0x61')][_0xa120('0x62')](_0x542e20[_0xa120('0x63')]);})[_0xa120('0x47')](function(_0xf09200){_0x573a4e['errors']['push']({'data':_0xd2c0b3,'error':_0xf09200[_0xa120('0x64')]});});})[_0xa120('0x24')](function(_0x2d8cb6){return _0x573a4e;})[_0xa120('0x47')](function(_0x45ea98){return _0x45ea98;});}else{_0x468759['status'](0x190)[_0xa120('0x1c')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xa120('0x24')](respondWithResult(_0x468759,null))[_0xa120('0x47')](handleError(_0x468759,null));};exports['getContacts']=function(_0x399738,_0x327467,_0x5e0d33){var _0x113434;return db[_0xa120('0x2e')][_0xa120('0x4a')]({'where':{'id':_0x399738['params']['id']},'include':[{'model':db[_0xa120('0x65')],'as':'CustomFields'}]})[_0xa120('0x24')](handleEntityNotFound(_0x327467,null))[_0xa120('0x24')](function(_0x1f46f1){if(_0x1f46f1){_0x113434=_0x1f46f1;return db[_0xa120('0x5a')]['rawAttributes'];}})[_0xa120('0x24')](function(_0x13e92f){if(_0x13e92f){var _0x2713ae={};var _0x1b102b={};_0x1b102b[_0xa120('0x35')]=_['concat'](_[_0xa120('0x32')](_0x13e92f),_[_0xa120('0x2d')](_0x113434[_0xa120('0x66')],function(_0x446cda){return util[_0xa120('0x67')](_0xa120('0x68'),_0x446cda['id']);}));_0x1b102b[_0xa120('0x33')]=_[_0xa120('0x32')](_0x399738[_0xa120('0x33')]);_0x1b102b[_0xa120('0x3e')]=_[_0xa120('0x34')](_0x1b102b[_0xa120('0x35')],_0x1b102b['query']);_0x2713ae['attributes']=_[_0xa120('0x34')](_0x1b102b[_0xa120('0x35')],qs[_0xa120('0x37')](_0x399738[_0xa120('0x33')][_0xa120('0x37')]));_0x2713ae[_0xa120('0x36')]=_0x2713ae[_0xa120('0x36')]['length']?_0x2713ae[_0xa120('0x36')]:_0x1b102b[_0xa120('0x35')];if(!_0x399738[_0xa120('0x33')][_0xa120('0x38')](_0xa120('0x39'))){_0x2713ae[_0xa120('0x3a')]=qs[_0xa120('0x3a')](_0x399738['query'][_0xa120('0x3a')]);_0x2713ae[_0xa120('0x1e')]=qs[_0xa120('0x1e')](_0x399738[_0xa120('0x33')][_0xa120('0x1e')]);}_0x2713ae[_0xa120('0x3b')]=qs[_0xa120('0x3c')](_0x399738[_0xa120('0x33')][_0xa120('0x3c')]);_0x2713ae[_0xa120('0x3d')]=qs[_0xa120('0x3e')](_['pick'](_0x399738[_0xa120('0x33')],_0x1b102b[_0xa120('0x3e')]));_0x2713ae['raw']=!![];if(_0x399738[_0xa120('0x33')][_0xa120('0x58')]){_0x2713ae[_0xa120('0x3d')]=_[_0xa120('0x40')](_0x2713ae['where'],{'$or':_['map'](_0x2713ae[_0xa120('0x36')],function(_0x5598dc){var _0x7c998d={};_0x7c998d[_0x5598dc]={'$like':'%'+_0x399738[_0xa120('0x33')][_0xa120('0x58')]+'%'};return _0x7c998d;})});}_0x2713ae=_[_0xa120('0x40')]({},_0x2713ae,_0x399738[_0xa120('0x42')]);return _0x113434[_0xa120('0x69')](_0x2713ae);}})['then'](respondWithResult(_0x327467,null))[_0xa120('0x47')](handleError(_0x327467,null));};exports[_0xa120('0x6a')]=function(_0x8b0552,_0x2d7714,_0x302d6c){var _0x3bb5fc;return db[_0xa120('0x2e')]['find']({'where':{'id':_0x8b0552[_0xa120('0x49')]['id']},'include':[{'model':db[_0xa120('0x65')],'as':_0xa120('0x66')}]})[_0xa120('0x24')](handleEntityNotFound(_0x2d7714,null))[_0xa120('0x24')](function(_0x2ea609){if(_0x2ea609){_0x3bb5fc=_0x2ea609;return db['CmContact'][_0xa120('0x2f')];}})[_0xa120('0x24')](function(_0x4dd79b){if(_0x4dd79b){var _0x2a7cb8={};var _0x5311e1={};_0x5311e1[_0xa120('0x35')]=_['concat'](_[_0xa120('0x32')](_0x4dd79b),_[_0xa120('0x2d')](_0x3bb5fc['CustomFields'],function(_0x210641){return util['format']('cf_%d',_0x210641['id']);}));_0x5311e1['query']=_[_0xa120('0x32')](_0x8b0552[_0xa120('0x33')]);_0x5311e1[_0xa120('0x3e')]=_[_0xa120('0x34')](_0x5311e1[_0xa120('0x35')],_0x5311e1[_0xa120('0x33')]);_0x2a7cb8[_0xa120('0x36')]=_['intersection'](_0x5311e1[_0xa120('0x35')],qs[_0xa120('0x37')](_0x8b0552[_0xa120('0x33')]['fields']));_0x2a7cb8[_0xa120('0x36')]=_0x2a7cb8[_0xa120('0x36')]['length']?_0x2a7cb8['attributes']:_0x5311e1['model'];if(!_0x8b0552['query']['hasOwnProperty']('nolimit')){_0x2a7cb8[_0xa120('0x3a')]=qs[_0xa120('0x3a')](_0x8b0552['query'][_0xa120('0x3a')]);_0x2a7cb8[_0xa120('0x1e')]=qs['offset'](_0x8b0552[_0xa120('0x33')][_0xa120('0x1e')]);}_0x2a7cb8[_0xa120('0x3b')]=qs[_0xa120('0x3c')](_0x8b0552[_0xa120('0x33')][_0xa120('0x3c')]);_0x2a7cb8[_0xa120('0x3d')]=qs[_0xa120('0x3e')](_[_0xa120('0x3f')](_0x8b0552[_0xa120('0x33')],_0x5311e1['filters']));_0x2a7cb8['raw']=!![];if(_0x8b0552[_0xa120('0x33')][_0xa120('0x58')]){_0x2a7cb8[_0xa120('0x3d')]=_[_0xa120('0x40')](_0x2a7cb8['where'],{'$or':_[_0xa120('0x2d')](_0x2a7cb8['attributes'],function(_0x116847){var _0x4ed139={};_0x4ed139[_0x116847]={'$like':'%'+_0x8b0552[_0xa120('0x33')]['filter']+'%'};return _0x4ed139;})});}_0x2a7cb8=_['merge']({},_0x2a7cb8,_0x8b0552['options']);return _0x3bb5fc[_0xa120('0x69')](_0x2a7cb8);}})[_0xa120('0x24')](function(_0x75a271){if(!_[_0xa120('0x6b')](_0x75a271)){var _0x27151b=toCsv(_0x75a271);var _0x366f11=Date[_0xa120('0x6c')]();fs[_0xa120('0x6d')](util[_0xa120('0x67')](_0xa120('0x6e'),_0x3bb5fc['id'],_0x366f11),_0x27151b);_0x2d7714[_0xa120('0x6f')]('Content-disposition','attachment;\x20filename='+util['format'](_0xa120('0x70'),_0x3bb5fc['id'],_0x366f11));_0x2d7714['setHeader'](_0xa120('0x71'),'text/csv');return _0x2d7714[_0xa120('0x72')](util['format'](_0xa120('0x6e'),_0x3bb5fc['id'],_0x366f11));}else{return _0x2d7714[_0xa120('0x19')](0xcc);}})[_0xa120('0x47')](handleError(_0x2d7714,null));};exports[_0xa120('0x73')]=function(_0x47245d,_0x40e1a7,_0x3ed91c){var _0x2ea302;delete _0x47245d['body']['id'];return db['CmList'][_0xa120('0x55')]({'where':{'id':_0x47245d[_0xa120('0x49')]['id']}})['then'](handleEntityNotFound(_0x40e1a7,null))['then'](function(_0x2d7fd9){if(_0x2d7fd9){return db[_0xa120('0x74')]['transaction'](function(_0x1182c8){return db[_0xa120('0x65')][_0xa120('0x4b')](_0x47245d[_0xa120('0x4c')],{'transaction':_0x1182c8})[_0xa120('0x24')](function(_0x4dbfd5){_0x2ea302=_0x4dbfd5;return _0x2d7fd9[_0xa120('0x75')](_0x4dbfd5,{'transaction':_0x1182c8});})[_0xa120('0x24')](function(){var _0x289116={'type':db[_0xa120('0x76')][_0xa120('0x77')],'transaction':_0x1182c8};switch(_0x47245d[_0xa120('0x4c')]['type']){case'text':_0x289116[_0xa120('0x30')]=db[_0xa120('0x76')][_0xa120('0x77')];break;case _0xa120('0x78'):_0x289116[_0xa120('0x30')]=db['Sequelize'][_0xa120('0x79')];break;case _0xa120('0x7a'):_0x289116['type']=db[_0xa120('0x76')][_0xa120('0x7b')];_0x289116[_0xa120('0x7c')]=![];break;default:}return db[_0xa120('0x74')][_0xa120('0x7d')][_0xa120('0x7e')](_0xa120('0x7f'),util['format'](_0xa120('0x80'),_0x2ea302['id']),_0x289116);})['then'](function(){return _0x2ea302;});});}})[_0xa120('0x24')](respondWithResult(_0x40e1a7,null))[_0xa120('0x47')](handleError(_0x40e1a7,null));};exports[_0xa120('0x81')]=function(_0x18c972,_0x1005ce,_0x441958){var _0x40d637={};var _0x3c0d33={};var _0x36fdcb;var _0xee6410;return db[_0xa120('0x2e')][_0xa120('0x55')]({'where':{'id':_0x18c972[_0xa120('0x49')]['id']}})[_0xa120('0x24')](handleEntityNotFound(_0x1005ce,null))[_0xa120('0x24')](function(_0xdf5091){if(_0xdf5091){_0x36fdcb=_0xdf5091;_0x3c0d33[_0xa120('0x35')]=_['keys'](db[_0xa120('0x65')][_0xa120('0x2f')]);_0x3c0d33[_0xa120('0x33')]=_[_0xa120('0x32')](_0x18c972[_0xa120('0x33')]);_0x3c0d33[_0xa120('0x3e')]=_[_0xa120('0x34')](_0x3c0d33[_0xa120('0x35')],_0x3c0d33[_0xa120('0x33')]);_0x40d637[_0xa120('0x36')]=_[_0xa120('0x34')](_0x3c0d33[_0xa120('0x35')],qs[_0xa120('0x37')](_0x18c972[_0xa120('0x33')][_0xa120('0x37')]));_0x40d637[_0xa120('0x36')]=_0x40d637[_0xa120('0x36')][_0xa120('0x56')]?_0x40d637['attributes']:_0x3c0d33[_0xa120('0x35')];_0x40d637[_0xa120('0x3b')]=qs[_0xa120('0x3c')](_0x18c972['query'][_0xa120('0x3c')]);_0x40d637[_0xa120('0x3d')]=qs['filters'](_[_0xa120('0x3f')](_0x18c972[_0xa120('0x33')],_0x3c0d33[_0xa120('0x3e')]));_0x40d637[_0xa120('0x3d')]=_['merge'](_0x40d637[_0xa120('0x3d')],{'$or':[{'ListId':_0xdf5091['id']},{'ListId':null}]});if(_0x18c972['query'][_0xa120('0x58')]){_0x40d637[_0xa120('0x3d')]=_[_0xa120('0x40')](_0x40d637[_0xa120('0x3d')],{'$or':_['map'](_0x40d637[_0xa120('0x36')],function(_0x47d41c){var _0x1f9b62={};_0x1f9b62[_0x47d41c]={'$like':'%'+_0x18c972[_0xa120('0x33')][_0xa120('0x58')]+'%'};return _0x1f9b62;})});}_0x40d637=_[_0xa120('0x40')]({},_0x40d637,_0x18c972[_0xa120('0x42')]);return db[_0xa120('0x65')][_0xa120('0x82')](_0x40d637);}})[_0xa120('0x24')](respondWithResult(_0x1005ce,null))[_0xa120('0x47')](handleError(_0x1005ce,null));};exports['addAgents']=function(_0x320a6b,_0x14c42a,_0x274c93){return db[_0xa120('0x2e')][_0xa120('0x4a')]({'where':{'id':_0x320a6b[_0xa120('0x49')]['id']}})[_0xa120('0x24')](handleEntityNotFound(_0x14c42a,null))['then'](function(_0x3d7bf8){if(_0x3d7bf8){return _0x3d7bf8['addAgents'](_0x320a6b[_0xa120('0x4c')][_0xa120('0x60')],_[_0xa120('0x5f')](_0x320a6b['body'],[_0xa120('0x60'),'id'])||{})[_0xa120('0x83')](function(_0x44d14c){for(var _0x4ddcef=0x0;_0x4ddcef<_0x320a6b[_0xa120('0x4c')]['ids'][_0xa120('0x56')];_0x4ddcef+=0x1){socket[_0xa120('0x84')](_0xa120('0x85'),{'UserId':_0x320a6b[_0xa120('0x4c')][_0xa120('0x60')][_0x4ddcef],'CmListId':_0x320a6b[_0xa120('0x49')]['id']});}return _0x44d14c;});}})[_0xa120('0x24')](respondWithResult(_0x14c42a,null))[_0xa120('0x47')](handleError(_0x14c42a,null));};exports[_0xa120('0x86')]=function(_0x1d8914,_0x47ce5d,_0x4076d4){return db[_0xa120('0x2e')][_0xa120('0x4a')]({'where':{'id':_0x1d8914['params']['id']}})['then'](handleEntityNotFound(_0x47ce5d,null))[_0xa120('0x24')](function(_0x456b73){if(_0x456b73){return _0x456b73[_0xa120('0x86')](_0x1d8914[_0xa120('0x33')][_0xa120('0x60')])[_0xa120('0x24')](function(){if(_[_0xa120('0x5c')](_0x1d8914[_0xa120('0x33')][_0xa120('0x60')])){for(var _0x23602b=0x0;_0x23602b<_0x1d8914[_0xa120('0x33')][_0xa120('0x60')][_0xa120('0x56')];_0x23602b+=0x1){socket[_0xa120('0x84')](_0xa120('0x87'),{'UserId':Number(_0x1d8914[_0xa120('0x33')][_0xa120('0x60')][_0x23602b]),'CmListId':Number(_0x1d8914[_0xa120('0x49')]['id'])});}}else{socket[_0xa120('0x84')]('userCmList:remove',{'UserId':Number(_0x1d8914[_0xa120('0x33')][_0xa120('0x60')]),'CmListId':Number(_0x1d8914['params']['id'])});}});}})[_0xa120('0x24')](respondWithStatusCode(_0x47ce5d,null))[_0xa120('0x47')](handleError(_0x47ce5d,null));};exports[_0xa120('0x88')]=function(_0x18fea1,_0x37d464,_0xe48a5){var _0x3f6c0c={};var _0x28401b={};var _0x16e2fb;var _0x5ce01e;return db[_0xa120('0x2e')]['findOne']({'where':{'id':_0x18fea1[_0xa120('0x49')]['id']}})[_0xa120('0x24')](handleEntityNotFound(_0x37d464,null))[_0xa120('0x24')](function(_0x251500){if(_0x251500){_0x16e2fb=_0x251500;_0x28401b['model']=_[_0xa120('0x32')](db[_0xa120('0x89')][_0xa120('0x2f')]);_0x28401b['query']=_[_0xa120('0x32')](_0x18fea1[_0xa120('0x33')]);_0x28401b[_0xa120('0x3e')]=_[_0xa120('0x34')](_0x28401b[_0xa120('0x35')],_0x28401b[_0xa120('0x33')]);_0x3f6c0c[_0xa120('0x36')]=_[_0xa120('0x34')](_0x28401b['model'],qs[_0xa120('0x37')](_0x18fea1[_0xa120('0x33')][_0xa120('0x37')]));_0x3f6c0c['attributes']=_0x3f6c0c[_0xa120('0x36')][_0xa120('0x56')]?_0x3f6c0c['attributes']:_0x28401b[_0xa120('0x35')];_0x3f6c0c[_0xa120('0x3b')]=qs[_0xa120('0x3c')](_0x18fea1[_0xa120('0x33')][_0xa120('0x3c')]);_0x3f6c0c[_0xa120('0x3d')]=qs['filters'](_[_0xa120('0x3f')](_0x18fea1[_0xa120('0x33')],_0x28401b['filters']));if(_0x18fea1['query'][_0xa120('0x58')]){_0x3f6c0c[_0xa120('0x3d')]=_[_0xa120('0x40')](_0x3f6c0c[_0xa120('0x3d')],{'$or':_[_0xa120('0x2d')](_0x3f6c0c[_0xa120('0x36')],function(_0x1f39b8){var _0x5332d1={};_0x5332d1[_0x1f39b8]={'$like':'%'+_0x18fea1['query']['filter']+'%'};return _0x5332d1;})});}_0x3f6c0c=_[_0xa120('0x40')]({},_0x3f6c0c,_0x18fea1[_0xa120('0x42')]);return _0x16e2fb[_0xa120('0x88')](_0x3f6c0c);}})['then'](function(_0x1ea573){if(_0x1ea573){_0x5ce01e=_0x1ea573['length'];if(!_0x18fea1[_0xa120('0x33')]['hasOwnProperty'](_0xa120('0x39'))){_0x3f6c0c[_0xa120('0x3a')]=qs[_0xa120('0x3a')](_0x18fea1['query'][_0xa120('0x3a')]);_0x3f6c0c[_0xa120('0x1e')]=qs['offset'](_0x18fea1['query'][_0xa120('0x1e')]);}return _0x16e2fb[_0xa120('0x88')](_0x3f6c0c);}})['then'](function(_0xe4fce4){if(_0xe4fce4){return _0xe4fce4?{'count':_0x5ce01e,'rows':_0xe4fce4}:null;}})[_0xa120('0x24')](respondWithResult(_0x37d464,null))[_0xa120('0x47')](handleError(_0x37d464,null));}; \ No newline at end of file +var _0xe836=['socket.io-emitter','./cmList.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','findOne','length','nolimit','removeDispositions','ids','addContacts','CmContact','tags','isArray','omit','success','push','dataValues','errors','message','getContacts','CmCustomField','CustomFields','cf_%d','raw','concat','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x6e326a,_0x52e8c7){var _0x5062c2=function(_0x2b5a7e){while(--_0x2b5a7e){_0x6e326a['push'](_0x6e326a['shift']());}};_0x5062c2(++_0x52e8c7);}(_0xe836,0x7c));var _0x6e83=function(_0x16fec1,_0x37b93a){_0x16fec1=_0x16fec1-0x0;var _0x4fa79e=_0xe836[_0x16fec1];return _0x4fa79e;};'use strict';var pdf=require(_0x6e83('0x0'));var emlformat=require(_0x6e83('0x1'));var rimraf=require(_0x6e83('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e83('0x3'));var rp=require(_0x6e83('0x4'));var moment=require(_0x6e83('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6e83('0x6'));var path=require(_0x6e83('0x7'));var sox=require(_0x6e83('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6e83('0x9'));var crypto=require(_0x6e83('0xa'));var jsforce=require(_0x6e83('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6e83('0xc'));var querystring=require(_0x6e83('0xd'));var Papa=require(_0x6e83('0xe'));var Redis=require(_0x6e83('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6e83('0x10'));var as=require(_0x6e83('0x11'));var hardwareService=require(_0x6e83('0x12'));var logger=require(_0x6e83('0x13'))(_0x6e83('0x14'));var utils=require(_0x6e83('0x15'));var config=require(_0x6e83('0x16'));var db=require(_0x6e83('0x17'))['db'];config[_0x6e83('0x18')]=_[_0x6e83('0x19')](config['redis'],{'host':_0x6e83('0x1a'),'port':0x18eb});var socket=require(_0x6e83('0x1b'))(new Redis(config['redis']));require(_0x6e83('0x1c'))[_0x6e83('0x1d')](socket);function respondWithStatusCode(_0x50be70,_0x4d2974){_0x4d2974=_0x4d2974||0xcc;return function(_0x57c964){if(_0x57c964){return _0x50be70['sendStatus'](_0x4d2974);}return _0x50be70[_0x6e83('0x1e')](_0x4d2974)[_0x6e83('0x1f')]();};}function respondWithResult(_0x33f819,_0x3229a4){_0x3229a4=_0x3229a4||0xc8;return function(_0x542e8d){if(_0x542e8d){return _0x33f819['status'](_0x3229a4)[_0x6e83('0x20')](_0x542e8d);}};}function respondWithFilteredResult(_0x2907e,_0x7ffb47){return function(_0x529e29){if(_0x529e29){var _0x3326bd=_0x529e29[_0x6e83('0x21')],_0x1524e6=_0x7ffb47[_0x6e83('0x22')],_0x515df4=_0x7ffb47[_0x6e83('0x22')]+_0x7ffb47[_0x6e83('0x23')],_0xec49f4;if(_0x515df4>=_0x3326bd){_0x515df4=_0x3326bd;_0xec49f4=0xc8;}else{_0xec49f4=0xce;}_0x2907e[_0x6e83('0x1e')](_0xec49f4);return _0x2907e[_0x6e83('0x24')](_0x6e83('0x25'),_0x1524e6+'-'+_0x515df4+'/'+_0x3326bd)['json'](_0x529e29);}return null;};}function patchUpdates(_0x9b499a){return function(_0x18daa4){try{jsonpatch[_0x6e83('0x26')](_0x18daa4,_0x9b499a,!![]);}catch(_0x114163){return BPromise[_0x6e83('0x27')](_0x114163);}return _0x18daa4[_0x6e83('0x28')]();};}function saveUpdates(_0x4ccc81,_0x592ef9){return function(_0xd71856){if(_0xd71856){return _0xd71856[_0x6e83('0x29')](_0x4ccc81)[_0x6e83('0x2a')](function(_0x63b78d){return _0x63b78d;});}return null;};}function removeEntity(_0x12614d,_0x16a5c7){return function(_0x55d944){if(_0x55d944){return _0x55d944[_0x6e83('0x2b')]()[_0x6e83('0x2a')](function(){var _0x4201a7=_0x55d944[_0x6e83('0x2c')]({'plain':!![]});var _0x30a663=_0x6e83('0x2d');return db['UserProfileResource'][_0x6e83('0x2b')]({'where':{'type':_0x30a663,'resourceId':_0x4201a7['id']}})['then'](function(){return _0x55d944;});})['then'](function(){_0x12614d[_0x6e83('0x1e')](0xcc)[_0x6e83('0x1f')]();});}};}function handleEntityNotFound(_0x1993cd,_0x1e91bc){return function(_0x3fe1b0){if(!_0x3fe1b0){_0x1993cd[_0x6e83('0x2e')](0x194);}return _0x3fe1b0;};}function handleError(_0x4564c5,_0x5dc580){_0x5dc580=_0x5dc580||0x1f4;return function(_0x20982b){logger[_0x6e83('0x2f')](_0x20982b[_0x6e83('0x30')]);if(_0x20982b['name']){delete _0x20982b[_0x6e83('0x31')];}_0x4564c5[_0x6e83('0x1e')](_0x5dc580)[_0x6e83('0x32')](_0x20982b);};}exports[_0x6e83('0x33')]=function(_0x227603,_0x48e66d){var _0x187bbc={},_0x18d956={},_0x2c2ac2={'count':0x0,'rows':[]};var _0x21ce29=_[_0x6e83('0x34')](db[_0x6e83('0x35')][_0x6e83('0x36')],function(_0x4b6951){return{'name':_0x4b6951[_0x6e83('0x37')],'type':_0x4b6951[_0x6e83('0x38')][_0x6e83('0x39')]};});_0x18d956[_0x6e83('0x3a')]=_[_0x6e83('0x34')](_0x21ce29,_0x6e83('0x31'));_0x18d956[_0x6e83('0x3b')]=_[_0x6e83('0x3c')](_0x227603[_0x6e83('0x3b')]);_0x18d956[_0x6e83('0x3d')]=_[_0x6e83('0x3e')](_0x18d956['model'],_0x18d956[_0x6e83('0x3b')]);_0x187bbc[_0x6e83('0x3f')]=_['intersection'](_0x18d956[_0x6e83('0x3a')],qs[_0x6e83('0x40')](_0x227603[_0x6e83('0x3b')]['fields']));_0x187bbc[_0x6e83('0x3f')]=_0x187bbc[_0x6e83('0x3f')]['length']?_0x187bbc[_0x6e83('0x3f')]:_0x18d956['model'];if(!_0x227603[_0x6e83('0x3b')][_0x6e83('0x41')]('nolimit')){_0x187bbc[_0x6e83('0x23')]=qs[_0x6e83('0x23')](_0x227603[_0x6e83('0x3b')]['limit']);_0x187bbc[_0x6e83('0x22')]=qs[_0x6e83('0x22')](_0x227603[_0x6e83('0x3b')][_0x6e83('0x22')]);}_0x187bbc[_0x6e83('0x42')]=qs[_0x6e83('0x43')](_0x227603[_0x6e83('0x3b')]['sort']);_0x187bbc[_0x6e83('0x44')]=qs['filters'](_[_0x6e83('0x45')](_0x227603[_0x6e83('0x3b')],_0x18d956[_0x6e83('0x3d')]),_0x21ce29);if(_0x227603[_0x6e83('0x3b')]['filter']){_0x187bbc[_0x6e83('0x44')]=_['merge'](_0x187bbc[_0x6e83('0x44')],{'$or':_['map'](_0x21ce29,function(_0x159636){if(_0x159636[_0x6e83('0x38')]!=='VIRTUAL'){var _0x1b131f={};_0x1b131f[_0x159636[_0x6e83('0x31')]]={'$like':'%'+_0x227603[_0x6e83('0x3b')][_0x6e83('0x46')]+'%'};return _0x1b131f;}})});}_0x187bbc=_[_0x6e83('0x47')]({},_0x187bbc,_0x227603[_0x6e83('0x48')]);var _0x11cbdc={'where':_0x187bbc[_0x6e83('0x44')]};return db['CmList'][_0x6e83('0x21')](_0x11cbdc)[_0x6e83('0x2a')](function(_0x5bfb26){_0x2c2ac2[_0x6e83('0x21')]=_0x5bfb26;if(_0x227603[_0x6e83('0x3b')][_0x6e83('0x49')]){_0x187bbc['include']=[{'all':!![]}];}return db[_0x6e83('0x35')][_0x6e83('0x4a')](_0x187bbc);})[_0x6e83('0x2a')](function(_0x3909a3){_0x2c2ac2[_0x6e83('0x4b')]=_0x3909a3;return _0x2c2ac2;})['then'](respondWithFilteredResult(_0x48e66d,_0x187bbc))[_0x6e83('0x4c')](handleError(_0x48e66d,null));};exports[_0x6e83('0x4d')]=function(_0x2a863b,_0x4bebd7){var _0x311801={'raw':![],'where':{'id':_0x2a863b[_0x6e83('0x4e')]['id']}},_0x2fbd0a={};_0x2fbd0a[_0x6e83('0x3a')]=_[_0x6e83('0x3c')](db[_0x6e83('0x35')][_0x6e83('0x36')]);_0x2fbd0a['query']=_[_0x6e83('0x3c')](_0x2a863b[_0x6e83('0x3b')]);_0x2fbd0a['filters']=_[_0x6e83('0x3e')](_0x2fbd0a[_0x6e83('0x3a')],_0x2fbd0a[_0x6e83('0x3b')]);_0x311801[_0x6e83('0x3f')]=_[_0x6e83('0x3e')](_0x2fbd0a[_0x6e83('0x3a')],qs[_0x6e83('0x40')](_0x2a863b['query'][_0x6e83('0x40')]));_0x311801['attributes']=_0x311801['attributes']['length']?_0x311801[_0x6e83('0x3f')]:_0x2fbd0a['model'];if(_0x2a863b['query']['includeAll']){_0x311801[_0x6e83('0x4f')]=[{'all':!![]}];}_0x311801=_[_0x6e83('0x47')]({},_0x311801,_0x2a863b[_0x6e83('0x48')]);return db[_0x6e83('0x35')][_0x6e83('0x50')](_0x311801)[_0x6e83('0x2a')](handleEntityNotFound(_0x4bebd7,null))['then'](respondWithResult(_0x4bebd7,null))[_0x6e83('0x4c')](handleError(_0x4bebd7,null));};exports[_0x6e83('0x51')]=function(_0x32c6b2,_0x13abf8){return db[_0x6e83('0x35')]['create'](_0x32c6b2[_0x6e83('0x52')],{})[_0x6e83('0x2a')](function(_0x46d10c){var _0x23e83a=_0x32c6b2[_0x6e83('0x53')][_0x6e83('0x2c')]({'plain':!![]});if(!_0x23e83a)throw new Error(_0x6e83('0x54'));if(_0x23e83a[_0x6e83('0x55')]===_0x6e83('0x53')){var _0x243b7d=_0x46d10c[_0x6e83('0x2c')]({'plain':!![]});var _0x18fa1b=_0x6e83('0x2d');return db[_0x6e83('0x56')][_0x6e83('0x50')]({'where':{'name':_0x18fa1b,'userProfileId':_0x23e83a[_0x6e83('0x57')]},'raw':!![]})[_0x6e83('0x2a')](function(_0x5248d5){if(_0x5248d5&&_0x5248d5['autoAssociation']===0x0){return db[_0x6e83('0x58')]['create']({'name':_0x243b7d[_0x6e83('0x31')],'resourceId':_0x243b7d['id'],'type':_0x5248d5[_0x6e83('0x31')],'sectionId':_0x5248d5['id']},{})['then'](function(){return _0x46d10c;});}else{return _0x46d10c;}})[_0x6e83('0x4c')](function(_0x4a8276){logger[_0x6e83('0x2f')](_0x6e83('0x59'),_0x4a8276);throw _0x4a8276;});}return _0x46d10c;})[_0x6e83('0x2a')](respondWithResult(_0x13abf8,0xc9))[_0x6e83('0x4c')](handleError(_0x13abf8,null));};exports[_0x6e83('0x29')]=function(_0x1eb651,_0x1fbfd8){if(_0x1eb651[_0x6e83('0x52')]['id']){delete _0x1eb651[_0x6e83('0x52')]['id'];}return db[_0x6e83('0x35')][_0x6e83('0x50')]({'where':{'id':_0x1eb651[_0x6e83('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1fbfd8,null))[_0x6e83('0x2a')](saveUpdates(_0x1eb651[_0x6e83('0x52')],null))['then'](respondWithResult(_0x1fbfd8,null))[_0x6e83('0x4c')](handleError(_0x1fbfd8,null));};exports[_0x6e83('0x2b')]=function(_0x177344,_0x1af2de){return db[_0x6e83('0x35')][_0x6e83('0x50')]({'where':{'id':_0x177344[_0x6e83('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1af2de,null))[_0x6e83('0x2a')](removeEntity(_0x1af2de,null))[_0x6e83('0x4c')](handleError(_0x1af2de,null));};exports['describe']=function(_0x435f71,_0x422af1){return db['CmList'][_0x6e83('0x5a')]()[_0x6e83('0x2a')](respondWithResult(_0x422af1,null))[_0x6e83('0x4c')](handleError(_0x422af1,null));};exports[_0x6e83('0x5b')]=function(_0x136dad,_0x434f9c,_0x2a9cf1){if(_0x136dad['body']['id']){delete _0x136dad['body']['id'];}return db[_0x6e83('0x35')][_0x6e83('0x50')]({'where':{'id':_0x136dad[_0x6e83('0x4e')]['id']}})[_0x6e83('0x2a')](handleEntityNotFound(_0x434f9c,null))[_0x6e83('0x2a')](function(_0x4f1b05){if(_0x4f1b05){_0x136dad[_0x6e83('0x52')][_0x6e83('0x5c')]=_0x4f1b05['id'];return db[_0x6e83('0x5d')]['create'](_0x136dad[_0x6e83('0x52')]);}})[_0x6e83('0x2a')](respondWithResult(_0x434f9c,null))[_0x6e83('0x4c')](handleError(_0x434f9c,null));};exports['getDispositions']=function(_0x2c9556,_0x27052b,_0x154428){var _0x58b7aa={'raw':![],'where':{}};var _0x280742={};var _0x267a5f={'count':0x0,'rows':[]};return db[_0x6e83('0x35')][_0x6e83('0x5e')]({'where':{'id':_0x2c9556['params']['id']}})[_0x6e83('0x2a')](handleEntityNotFound(_0x27052b,null))[_0x6e83('0x2a')](function(_0x382231){if(_0x382231){_0x280742[_0x6e83('0x3a')]=_[_0x6e83('0x3c')](db[_0x6e83('0x5d')]['rawAttributes']);_0x280742['query']=_[_0x6e83('0x3c')](_0x2c9556[_0x6e83('0x3b')]);_0x280742['filters']=_[_0x6e83('0x3e')](_0x280742[_0x6e83('0x3a')],_0x280742[_0x6e83('0x3b')]);_0x58b7aa[_0x6e83('0x3f')]=_['intersection'](_0x280742[_0x6e83('0x3a')],qs[_0x6e83('0x40')](_0x2c9556[_0x6e83('0x3b')][_0x6e83('0x40')]));_0x58b7aa[_0x6e83('0x3f')]=_0x58b7aa[_0x6e83('0x3f')][_0x6e83('0x5f')]?_0x58b7aa[_0x6e83('0x3f')]:_0x280742[_0x6e83('0x3a')];if(!_0x2c9556['query']['hasOwnProperty'](_0x6e83('0x60'))){_0x58b7aa[_0x6e83('0x23')]=qs[_0x6e83('0x23')](_0x2c9556[_0x6e83('0x3b')][_0x6e83('0x23')]);_0x58b7aa[_0x6e83('0x22')]=qs[_0x6e83('0x22')](_0x2c9556[_0x6e83('0x3b')][_0x6e83('0x22')]);}_0x58b7aa[_0x6e83('0x42')]=qs[_0x6e83('0x43')](_0x2c9556[_0x6e83('0x3b')]['sort']);_0x58b7aa[_0x6e83('0x44')]=qs['filters'](_['pick'](_0x2c9556[_0x6e83('0x3b')],_0x280742[_0x6e83('0x3d')]));_0x58b7aa[_0x6e83('0x44')][_0x6e83('0x5c')]=_0x382231['id'];if(_0x2c9556[_0x6e83('0x3b')][_0x6e83('0x46')]){_0x58b7aa[_0x6e83('0x44')]=_[_0x6e83('0x47')](_0x58b7aa[_0x6e83('0x44')],{'$or':_[_0x6e83('0x34')](_0x58b7aa['attributes'],function(_0x2a17db){var _0x34649c={};_0x34649c[_0x2a17db]={'$like':'%'+_0x2c9556[_0x6e83('0x3b')][_0x6e83('0x46')]+'%'};return _0x34649c;})});}_0x58b7aa=_[_0x6e83('0x47')]({},_0x58b7aa,_0x2c9556[_0x6e83('0x48')]);return db[_0x6e83('0x5d')]['count']({'where':_0x58b7aa[_0x6e83('0x44')]})[_0x6e83('0x2a')](function(_0x273e3a){_0x267a5f['count']=_0x273e3a;if(_0x2c9556[_0x6e83('0x3b')]['includeAll']){_0x58b7aa['include']=[{'all':!![]}];}return db[_0x6e83('0x5d')][_0x6e83('0x4a')](_0x58b7aa);})[_0x6e83('0x2a')](function(_0x4117f9){_0x267a5f[_0x6e83('0x4b')]=_0x4117f9;return _0x267a5f;});}})['then'](respondWithFilteredResult(_0x27052b,_0x58b7aa))[_0x6e83('0x4c')](handleError(_0x27052b,null));};exports[_0x6e83('0x61')]=function(_0x581349,_0x4938d7,_0xd9124b){return db[_0x6e83('0x35')]['find']({'where':{'id':_0x581349[_0x6e83('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4938d7,null))[_0x6e83('0x2a')](function(_0x1006b4){if(_0x1006b4){return _0x1006b4[_0x6e83('0x61')](_0x581349[_0x6e83('0x3b')][_0x6e83('0x62')]);}})[_0x6e83('0x2a')](respondWithStatusCode(_0x4938d7,null))[_0x6e83('0x4c')](handleError(_0x4938d7,null));};exports[_0x6e83('0x63')]=function(_0x5e744a,_0x90f22c,_0x2795ea){return db['CmList'][_0x6e83('0x50')]({'where':{'id':_0x5e744a[_0x6e83('0x4e')]['id']}})[_0x6e83('0x2a')](handleEntityNotFound(_0x90f22c,null))['then'](function(_0x4790a7){if(_0x4790a7){var _0x511954=[];var _0x7dba34={'success':[],'errors':[]};return db[_0x6e83('0x64')]['describe']()[_0x6e83('0x2a')](function(_0x1a4010){if(_0x5e744a['body'][_0x6e83('0x65')]&&_[_0x6e83('0x66')](_0x5e744a['body'][_0x6e83('0x65')])){if(_0x5e744a['body'][_0x6e83('0x65')][_0x6e83('0x5f')]){_0x5e744a[_0x6e83('0x52')]['tags']=_0x5e744a[_0x6e83('0x52')]['tags']['join'](';')+';';}else{_0x5e744a[_0x6e83('0x52')][_0x6e83('0x65')]=null;}}else{_0x5e744a[_0x6e83('0x52')][_0x6e83('0x65')]=null;}if(_0x5e744a['body']&&_['isArray'](_0x5e744a[_0x6e83('0x52')])){for(var _0x5c00be=0x0;_0x5c00be<_0x5e744a[_0x6e83('0x52')][_0x6e83('0x5f')];_0x5c00be+=0x1){_0x5e744a[_0x6e83('0x52')][_0x5c00be]['ListId']=_0x5e744a[_0x6e83('0x4e')]['id'];_0x511954['push'](_0x5e744a[_0x6e83('0x52')][_0x5c00be]);}return BPromise['each'](_0x511954,function(_0xe45c68){return db[_0x6e83('0x64')][_0x6e83('0x51')](_[_0x6e83('0x67')](_0xe45c68,['ids','id'])||{},{'fields':_[_0x6e83('0x3c')](_0x1a4010),'raw':!![]})['then'](function(_0x362ba2){_0x7dba34[_0x6e83('0x68')][_0x6e83('0x69')](_0x362ba2[_0x6e83('0x6a')]);})['catch'](function(_0x1c5ade){_0x7dba34[_0x6e83('0x6b')][_0x6e83('0x69')]({'data':_0xe45c68,'error':_0x1c5ade[_0x6e83('0x6c')]});});})[_0x6e83('0x2a')](function(_0x329c77){return _0x7dba34;})[_0x6e83('0x4c')](function(_0x443440){return _0x443440;});}else{_0x90f22c[_0x6e83('0x1e')](0x190)[_0x6e83('0x20')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x90f22c,null))[_0x6e83('0x4c')](handleError(_0x90f22c,null));};exports[_0x6e83('0x6d')]=function(_0x1fa37b,_0x1313dd,_0x43290b){var _0x3a9d67;return db[_0x6e83('0x35')][_0x6e83('0x50')]({'where':{'id':_0x1fa37b['params']['id']},'include':[{'model':db[_0x6e83('0x6e')],'as':_0x6e83('0x6f')}]})[_0x6e83('0x2a')](handleEntityNotFound(_0x1313dd,null))['then'](function(_0x20ad27){if(_0x20ad27){_0x3a9d67=_0x20ad27;return db[_0x6e83('0x64')][_0x6e83('0x36')];}})[_0x6e83('0x2a')](function(_0x2a19e4){if(_0x2a19e4){var _0x1249e7={};var _0x474696={};_0x474696[_0x6e83('0x3a')]=_['concat'](_[_0x6e83('0x3c')](_0x2a19e4),_[_0x6e83('0x34')](_0x3a9d67[_0x6e83('0x6f')],function(_0x1d26a6){return util['format'](_0x6e83('0x70'),_0x1d26a6['id']);}));_0x474696[_0x6e83('0x3b')]=_['keys'](_0x1fa37b['query']);_0x474696[_0x6e83('0x3d')]=_[_0x6e83('0x3e')](_0x474696['model'],_0x474696[_0x6e83('0x3b')]);_0x1249e7[_0x6e83('0x3f')]=_[_0x6e83('0x3e')](_0x474696['model'],qs[_0x6e83('0x40')](_0x1fa37b[_0x6e83('0x3b')][_0x6e83('0x40')]));_0x1249e7[_0x6e83('0x3f')]=_0x1249e7[_0x6e83('0x3f')][_0x6e83('0x5f')]?_0x1249e7[_0x6e83('0x3f')]:_0x474696[_0x6e83('0x3a')];if(!_0x1fa37b['query'][_0x6e83('0x41')](_0x6e83('0x60'))){_0x1249e7[_0x6e83('0x23')]=qs[_0x6e83('0x23')](_0x1fa37b[_0x6e83('0x3b')][_0x6e83('0x23')]);_0x1249e7[_0x6e83('0x22')]=qs[_0x6e83('0x22')](_0x1fa37b[_0x6e83('0x3b')][_0x6e83('0x22')]);}_0x1249e7[_0x6e83('0x42')]=qs[_0x6e83('0x43')](_0x1fa37b[_0x6e83('0x3b')][_0x6e83('0x43')]);_0x1249e7[_0x6e83('0x44')]=qs['filters'](_['pick'](_0x1fa37b[_0x6e83('0x3b')],_0x474696[_0x6e83('0x3d')]));_0x1249e7[_0x6e83('0x71')]=!![];if(_0x1fa37b[_0x6e83('0x3b')][_0x6e83('0x46')]){_0x1249e7['where']=_['merge'](_0x1249e7[_0x6e83('0x44')],{'$or':_['map'](_0x1249e7[_0x6e83('0x3f')],function(_0x34da27){var _0x498490={};_0x498490[_0x34da27]={'$like':'%'+_0x1fa37b[_0x6e83('0x3b')][_0x6e83('0x46')]+'%'};return _0x498490;})});}_0x1249e7=_[_0x6e83('0x47')]({},_0x1249e7,_0x1fa37b['options']);return _0x3a9d67[_0x6e83('0x6d')](_0x1249e7);}})[_0x6e83('0x2a')](respondWithResult(_0x1313dd,null))['catch'](handleError(_0x1313dd,null));};exports['getContactsCsv']=function(_0x4ec464,_0x29d1eb,_0x201bc8){var _0x3d11ed;return db['CmList'][_0x6e83('0x50')]({'where':{'id':_0x4ec464['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x6e83('0x6f')}]})[_0x6e83('0x2a')](handleEntityNotFound(_0x29d1eb,null))[_0x6e83('0x2a')](function(_0x17b68e){if(_0x17b68e){_0x3d11ed=_0x17b68e;return db[_0x6e83('0x64')]['rawAttributes'];}})[_0x6e83('0x2a')](function(_0x597071){if(_0x597071){var _0x25e51c={};var _0x392b6f={};_0x392b6f[_0x6e83('0x3a')]=_[_0x6e83('0x72')](_['keys'](_0x597071),_['map'](_0x3d11ed['CustomFields'],function(_0x542587){return util['format'](_0x6e83('0x70'),_0x542587['id']);}));_0x392b6f[_0x6e83('0x3b')]=_[_0x6e83('0x3c')](_0x4ec464[_0x6e83('0x3b')]);_0x392b6f[_0x6e83('0x3d')]=_[_0x6e83('0x3e')](_0x392b6f[_0x6e83('0x3a')],_0x392b6f['query']);_0x25e51c['attributes']=_['intersection'](_0x392b6f['model'],qs[_0x6e83('0x40')](_0x4ec464[_0x6e83('0x3b')][_0x6e83('0x40')]));_0x25e51c[_0x6e83('0x3f')]=_0x25e51c[_0x6e83('0x3f')]['length']?_0x25e51c[_0x6e83('0x3f')]:_0x392b6f[_0x6e83('0x3a')];if(!_0x4ec464[_0x6e83('0x3b')]['hasOwnProperty'](_0x6e83('0x60'))){_0x25e51c[_0x6e83('0x23')]=qs['limit'](_0x4ec464[_0x6e83('0x3b')][_0x6e83('0x23')]);_0x25e51c[_0x6e83('0x22')]=qs[_0x6e83('0x22')](_0x4ec464[_0x6e83('0x3b')]['offset']);}_0x25e51c['order']=qs[_0x6e83('0x43')](_0x4ec464[_0x6e83('0x3b')][_0x6e83('0x43')]);_0x25e51c[_0x6e83('0x44')]=qs[_0x6e83('0x3d')](_[_0x6e83('0x45')](_0x4ec464[_0x6e83('0x3b')],_0x392b6f['filters']));_0x25e51c[_0x6e83('0x71')]=!![];if(_0x4ec464[_0x6e83('0x3b')][_0x6e83('0x46')]){_0x25e51c[_0x6e83('0x44')]=_[_0x6e83('0x47')](_0x25e51c[_0x6e83('0x44')],{'$or':_[_0x6e83('0x34')](_0x25e51c[_0x6e83('0x3f')],function(_0x4853d1){var _0x1b15df={};_0x1b15df[_0x4853d1]={'$like':'%'+_0x4ec464[_0x6e83('0x3b')]['filter']+'%'};return _0x1b15df;})});}_0x25e51c=_[_0x6e83('0x47')]({},_0x25e51c,_0x4ec464['options']);return _0x3d11ed[_0x6e83('0x6d')](_0x25e51c);}})[_0x6e83('0x2a')](function(_0x588231){if(!_[_0x6e83('0x73')](_0x588231)){var _0x592311=toCsv(_0x588231);var _0x2d11c9=Date[_0x6e83('0x74')]();fs[_0x6e83('0x75')](util[_0x6e83('0x76')](_0x6e83('0x77'),_0x3d11ed['id'],_0x2d11c9),_0x592311);_0x29d1eb[_0x6e83('0x78')](_0x6e83('0x79'),_0x6e83('0x7a')+util[_0x6e83('0x76')](_0x6e83('0x7b'),_0x3d11ed['id'],_0x2d11c9));_0x29d1eb[_0x6e83('0x78')](_0x6e83('0x7c'),_0x6e83('0x7d'));return _0x29d1eb[_0x6e83('0x7e')](util[_0x6e83('0x76')](_0x6e83('0x77'),_0x3d11ed['id'],_0x2d11c9));}else{return _0x29d1eb[_0x6e83('0x2e')](0xcc);}})[_0x6e83('0x4c')](handleError(_0x29d1eb,null));};exports[_0x6e83('0x7f')]=function(_0x117c1d,_0x2d1d8b,_0x2d2d07){var _0x171bb2;delete _0x117c1d['body']['id'];return db[_0x6e83('0x35')][_0x6e83('0x5e')]({'where':{'id':_0x117c1d[_0x6e83('0x4e')]['id']}})[_0x6e83('0x2a')](handleEntityNotFound(_0x2d1d8b,null))[_0x6e83('0x2a')](function(_0x205a99){if(_0x205a99){return db[_0x6e83('0x80')][_0x6e83('0x81')](function(_0x5561e1){return db[_0x6e83('0x6e')]['create'](_0x117c1d[_0x6e83('0x52')],{'transaction':_0x5561e1})['then'](function(_0x32c7e8){_0x171bb2=_0x32c7e8;return _0x205a99[_0x6e83('0x82')](_0x32c7e8,{'transaction':_0x5561e1});})[_0x6e83('0x2a')](function(){var _0xfb8013={'type':db['Sequelize'][_0x6e83('0x83')],'transaction':_0x5561e1};switch(_0x117c1d['body'][_0x6e83('0x38')]){case _0x6e83('0x84'):_0xfb8013['type']=db[_0x6e83('0x85')][_0x6e83('0x83')];break;case _0x6e83('0x86'):_0xfb8013[_0x6e83('0x38')]=db['Sequelize'][_0x6e83('0x87')];break;case _0x6e83('0x88'):_0xfb8013[_0x6e83('0x38')]=db[_0x6e83('0x85')][_0x6e83('0x89')];_0xfb8013[_0x6e83('0x8a')]=![];break;default:}return db[_0x6e83('0x80')][_0x6e83('0x8b')]['addColumn'](_0x6e83('0x8c'),util[_0x6e83('0x76')]('cf_%s',_0x171bb2['id']),_0xfb8013);})[_0x6e83('0x2a')](function(){return _0x171bb2;});});}})[_0x6e83('0x2a')](respondWithResult(_0x2d1d8b,null))[_0x6e83('0x4c')](handleError(_0x2d1d8b,null));};exports[_0x6e83('0x8d')]=function(_0x489eb6,_0x511bde,_0x89c9a2){var _0x970e43={};var _0x2bc93e={};var _0x5d67e4;var _0x562ddb;return db[_0x6e83('0x35')][_0x6e83('0x5e')]({'where':{'id':_0x489eb6[_0x6e83('0x4e')]['id']}})[_0x6e83('0x2a')](handleEntityNotFound(_0x511bde,null))[_0x6e83('0x2a')](function(_0xf63946){if(_0xf63946){_0x5d67e4=_0xf63946;_0x2bc93e['model']=_[_0x6e83('0x3c')](db['CmCustomField'][_0x6e83('0x36')]);_0x2bc93e[_0x6e83('0x3b')]=_[_0x6e83('0x3c')](_0x489eb6['query']);_0x2bc93e[_0x6e83('0x3d')]=_[_0x6e83('0x3e')](_0x2bc93e[_0x6e83('0x3a')],_0x2bc93e['query']);_0x970e43['attributes']=_[_0x6e83('0x3e')](_0x2bc93e[_0x6e83('0x3a')],qs['fields'](_0x489eb6[_0x6e83('0x3b')][_0x6e83('0x40')]));_0x970e43[_0x6e83('0x3f')]=_0x970e43[_0x6e83('0x3f')][_0x6e83('0x5f')]?_0x970e43['attributes']:_0x2bc93e['model'];_0x970e43[_0x6e83('0x42')]=qs['sort'](_0x489eb6[_0x6e83('0x3b')][_0x6e83('0x43')]);_0x970e43[_0x6e83('0x44')]=qs[_0x6e83('0x3d')](_[_0x6e83('0x45')](_0x489eb6[_0x6e83('0x3b')],_0x2bc93e[_0x6e83('0x3d')]));_0x970e43[_0x6e83('0x44')]=_[_0x6e83('0x47')](_0x970e43['where'],{'$or':[{'ListId':_0xf63946['id']},{'ListId':null}]});if(_0x489eb6[_0x6e83('0x3b')][_0x6e83('0x46')]){_0x970e43['where']=_[_0x6e83('0x47')](_0x970e43[_0x6e83('0x44')],{'$or':_[_0x6e83('0x34')](_0x970e43[_0x6e83('0x3f')],function(_0x5318c4){var _0x1f0fbe={};_0x1f0fbe[_0x5318c4]={'$like':'%'+_0x489eb6[_0x6e83('0x3b')][_0x6e83('0x46')]+'%'};return _0x1f0fbe;})});}_0x970e43=_[_0x6e83('0x47')]({},_0x970e43,_0x489eb6[_0x6e83('0x48')]);return db['CmCustomField'][_0x6e83('0x8e')](_0x970e43);}})[_0x6e83('0x2a')](respondWithResult(_0x511bde,null))[_0x6e83('0x4c')](handleError(_0x511bde,null));};exports[_0x6e83('0x8f')]=function(_0x544d92,_0x4ac6fc,_0x35cfdb){return db[_0x6e83('0x35')][_0x6e83('0x50')]({'where':{'id':_0x544d92['params']['id']}})[_0x6e83('0x2a')](handleEntityNotFound(_0x4ac6fc,null))[_0x6e83('0x2a')](function(_0x4f78a1){if(_0x4f78a1){return _0x4f78a1[_0x6e83('0x8f')](_0x544d92[_0x6e83('0x52')][_0x6e83('0x62')],_['omit'](_0x544d92['body'],['ids','id'])||{})[_0x6e83('0x90')](function(_0x1e5478){for(var _0x35ece3=0x0;_0x35ece3<_0x544d92[_0x6e83('0x52')][_0x6e83('0x62')][_0x6e83('0x5f')];_0x35ece3+=0x1){socket[_0x6e83('0x91')](_0x6e83('0x92'),{'UserId':_0x544d92[_0x6e83('0x52')][_0x6e83('0x62')][_0x35ece3],'CmListId':_0x544d92[_0x6e83('0x4e')]['id']});}return _0x1e5478;});}})[_0x6e83('0x2a')](respondWithResult(_0x4ac6fc,null))[_0x6e83('0x4c')](handleError(_0x4ac6fc,null));};exports[_0x6e83('0x93')]=function(_0x3631f5,_0x281b5c,_0x3c5f97){return db[_0x6e83('0x35')][_0x6e83('0x50')]({'where':{'id':_0x3631f5[_0x6e83('0x4e')]['id']}})[_0x6e83('0x2a')](handleEntityNotFound(_0x281b5c,null))[_0x6e83('0x2a')](function(_0x5342eb){if(_0x5342eb){return _0x5342eb[_0x6e83('0x93')](_0x3631f5[_0x6e83('0x3b')][_0x6e83('0x62')])['then'](function(){if(_[_0x6e83('0x66')](_0x3631f5['query'][_0x6e83('0x62')])){for(var _0x3488bb=0x0;_0x3488bb<_0x3631f5[_0x6e83('0x3b')][_0x6e83('0x62')][_0x6e83('0x5f')];_0x3488bb+=0x1){socket[_0x6e83('0x91')](_0x6e83('0x94'),{'UserId':Number(_0x3631f5[_0x6e83('0x3b')][_0x6e83('0x62')][_0x3488bb]),'CmListId':Number(_0x3631f5[_0x6e83('0x4e')]['id'])});}}else{socket['emit'](_0x6e83('0x94'),{'UserId':Number(_0x3631f5[_0x6e83('0x3b')][_0x6e83('0x62')]),'CmListId':Number(_0x3631f5['params']['id'])});}});}})['then'](respondWithStatusCode(_0x281b5c,null))[_0x6e83('0x4c')](handleError(_0x281b5c,null));};exports[_0x6e83('0x95')]=function(_0x36e7f7,_0x2e8030,_0xa71d12){var _0x51c94d={};var _0x44d5e8={};var _0x1e050b;var _0x1d6274;return db[_0x6e83('0x35')]['findOne']({'where':{'id':_0x36e7f7[_0x6e83('0x4e')]['id']}})[_0x6e83('0x2a')](handleEntityNotFound(_0x2e8030,null))[_0x6e83('0x2a')](function(_0x5d4a9b){if(_0x5d4a9b){_0x1e050b=_0x5d4a9b;_0x44d5e8[_0x6e83('0x3a')]=_['keys'](db[_0x6e83('0x96')][_0x6e83('0x36')]);_0x44d5e8[_0x6e83('0x3b')]=_[_0x6e83('0x3c')](_0x36e7f7['query']);_0x44d5e8[_0x6e83('0x3d')]=_['intersection'](_0x44d5e8[_0x6e83('0x3a')],_0x44d5e8[_0x6e83('0x3b')]);_0x51c94d[_0x6e83('0x3f')]=_[_0x6e83('0x3e')](_0x44d5e8['model'],qs[_0x6e83('0x40')](_0x36e7f7[_0x6e83('0x3b')][_0x6e83('0x40')]));_0x51c94d[_0x6e83('0x3f')]=_0x51c94d['attributes'][_0x6e83('0x5f')]?_0x51c94d[_0x6e83('0x3f')]:_0x44d5e8[_0x6e83('0x3a')];_0x51c94d['order']=qs[_0x6e83('0x43')](_0x36e7f7[_0x6e83('0x3b')][_0x6e83('0x43')]);_0x51c94d[_0x6e83('0x44')]=qs[_0x6e83('0x3d')](_[_0x6e83('0x45')](_0x36e7f7[_0x6e83('0x3b')],_0x44d5e8['filters']));if(_0x36e7f7[_0x6e83('0x3b')][_0x6e83('0x46')]){_0x51c94d[_0x6e83('0x44')]=_['merge'](_0x51c94d[_0x6e83('0x44')],{'$or':_[_0x6e83('0x34')](_0x51c94d['attributes'],function(_0x54fd3d){var _0x1ec157={};_0x1ec157[_0x54fd3d]={'$like':'%'+_0x36e7f7[_0x6e83('0x3b')][_0x6e83('0x46')]+'%'};return _0x1ec157;})});}_0x51c94d=_[_0x6e83('0x47')]({},_0x51c94d,_0x36e7f7[_0x6e83('0x48')]);return _0x1e050b[_0x6e83('0x95')](_0x51c94d);}})['then'](function(_0x288620){if(_0x288620){_0x1d6274=_0x288620[_0x6e83('0x5f')];if(!_0x36e7f7[_0x6e83('0x3b')][_0x6e83('0x41')](_0x6e83('0x60'))){_0x51c94d['limit']=qs[_0x6e83('0x23')](_0x36e7f7[_0x6e83('0x3b')][_0x6e83('0x23')]);_0x51c94d['offset']=qs[_0x6e83('0x22')](_0x36e7f7[_0x6e83('0x3b')][_0x6e83('0x22')]);}return _0x1e050b[_0x6e83('0x95')](_0x51c94d);}})['then'](function(_0x225dcb){if(_0x225dcb){return _0x225dcb?{'count':_0x1d6274,'rows':_0x225dcb}:null;}})[_0x6e83('0x2a')](respondWithResult(_0x2e8030,null))[_0x6e83('0x4c')](handleError(_0x2e8030,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 1bb6d9e..daa7e72 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 _0xb954=['CmList','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1079b7,_0x563ef6){var _0x3e8309=function(_0x559bc4){while(--_0x559bc4){_0x1079b7['push'](_0x1079b7['shift']());}};_0x3e8309(++_0x563ef6);}(_0xb954,0x169));var _0x4b95=function(_0x4eb6dc,_0x3dc261){_0x4eb6dc=_0x4eb6dc-0x0;var _0x3068b4=_0xb954[_0x4eb6dc];return _0x3068b4;};'use strict';var EventEmitter=require(_0x4b95('0x0'));var CmList=require(_0x4b95('0x1'))['db'][_0x4b95('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x4b95('0x3')](0x0);var events={'afterCreate':_0x4b95('0x4'),'afterUpdate':_0x4b95('0x5'),'afterDestroy':_0x4b95('0x6')};function emitEvent(_0x39a2c5){return function(_0x265273,_0x5b771e,_0x1cbd24){CmListEvents['emit'](_0x39a2c5+':'+_0x265273['id'],_0x265273);CmListEvents[_0x4b95('0x7')](_0x39a2c5,_0x265273);_0x1cbd24(null);};}for(var e in events){if(events[_0x4b95('0x8')](e)){var event=events[e];CmList[_0x4b95('0x9')](e,emitEvent(event));}}module[_0x4b95('0xa')]=CmListEvents; \ No newline at end of file +var _0xb62a=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save','update'];(function(_0x4e4ce2,_0x1bc008){var _0x173e4c=function(_0x41627e){while(--_0x41627e){_0x4e4ce2['push'](_0x4e4ce2['shift']());}};_0x173e4c(++_0x1bc008);}(_0xb62a,0x165));var _0xab62=function(_0x3d0bd4,_0x318324){_0x3d0bd4=_0x3d0bd4-0x0;var _0xe80876=_0xb62a[_0x3d0bd4];return _0xe80876;};'use strict';var EventEmitter=require(_0xab62('0x0'));var CmList=require(_0xab62('0x1'))['db'][_0xab62('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xab62('0x3')](0x0);var events={'afterCreate':_0xab62('0x4'),'afterUpdate':_0xab62('0x5'),'afterDestroy':_0xab62('0x6')};function emitEvent(_0x2d0916){return function(_0x50c058,_0x3a6017,_0x2773f3){CmListEvents[_0xab62('0x7')](_0x2d0916+':'+_0x50c058['id'],_0x50c058);CmListEvents[_0xab62('0x7')](_0x2d0916,_0x50c058);_0x2773f3(null);};}for(var e in events){if(events[_0xab62('0x8')](e)){var event=events[e];CmList[_0xab62('0x9')](e,emitEvent(event));}}module[_0xab62('0xa')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index ae8ed89..33a3495 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 _0x35d8=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash'];(function(_0x5eea00,_0x59bf6e){var _0xe049b5=function(_0x59840a){while(--_0x59840a){_0x5eea00['push'](_0x5eea00['shift']());}};_0xe049b5(++_0x59bf6e);}(_0x35d8,0x12b));var _0x835d=function(_0x4abb98,_0x21e2a8){_0x4abb98=_0x4abb98-0x0;var _0x2720c8=_0x35d8[_0x4abb98];return _0x2720c8;};'use strict';var _=require(_0x835d('0x0'));var util=require('util');var logger=require(_0x835d('0x1'))('api');var moment=require(_0x835d('0x2'));var BPromise=require(_0x835d('0x3'));var rp=require(_0x835d('0x4'));var fs=require('fs');var path=require(_0x835d('0x5'));var rimraf=require('rimraf');var config=require(_0x835d('0x6'));var attributes=require(_0x835d('0x7'));module[_0x835d('0x8')]=function(_0x462995,_0x2fcfb3){return _0x462995[_0x835d('0x9')](_0x835d('0xa'),attributes,{'tableName':_0x835d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8fe=['define','CmList','cm_lists','api','request-promise','path','rimraf','../../config/environment'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa8fe,0xbb));var _0xea8f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa8fe[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xea8f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xea8f('0x1'));var fs=require('fs');var path=require(_0xea8f('0x2'));var rimraf=require(_0xea8f('0x3'));var config=require(_0xea8f('0x4'));var attributes=require('./cmList.attributes');module['exports']=function(_0x32983e,_0x4893d9){return _0x32983e[_0xea8f('0x5')](_0xea8f('0x6'),attributes,{'tableName':_0xea8f('0x7'),'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 6910ae4..d860cc1 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 _0xb435=['stringify','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0xb435,0x1d9));var _0x5b43=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb435[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5b43('0x0'));var util=require(_0x5b43('0x1'));var moment=require(_0x5b43('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b43('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5b43('0x4'));var logger=require('../../config/logger')(_0x5b43('0x5'));var config=require(_0x5b43('0x6'));var jayson=require(_0x5b43('0x7'));var client=jayson[_0x5b43('0x8')][_0x5b43('0x9')]({'port':0x232a});config['redis']=_[_0x5b43('0xa')](config['redis'],{'host':_0x5b43('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5b43('0xc')]));require(_0x5b43('0xd'))[_0x5b43('0xe')](socket);function respondWithRpcPromise(_0x346454,_0x5dc73e,_0x1888b8){return new BPromise(function(_0x137575,_0x3444fb){return client[_0x5b43('0xf')](_0x346454,_0x1888b8)[_0x5b43('0x10')](function(_0x2a186b){logger['info'](_0x5b43('0x11'),_0x5dc73e,_0x5b43('0x12'));logger[_0x5b43('0x13')](_0x5b43('0x14'),_0x5dc73e,_0x5b43('0x12'),JSON[_0x5b43('0x15')](_0x2a186b));if(_0x2a186b['error']){if(_0x2a186b[_0x5b43('0x16')]['code']===0x1f4){logger[_0x5b43('0x16')]('CmList,\x20%s,\x20%s',_0x5dc73e,_0x2a186b['error'][_0x5b43('0x17')]);return _0x3444fb(_0x2a186b[_0x5b43('0x16')][_0x5b43('0x17')]);}logger[_0x5b43('0x16')]('CmList,\x20%s,\x20%s',_0x5dc73e,_0x2a186b[_0x5b43('0x16')][_0x5b43('0x17')]);return _0x137575(_0x2a186b[_0x5b43('0x16')]['message']);}else{logger['info']('CmList,\x20%s,\x20%s',_0x5dc73e,_0x5b43('0x12'));_0x137575(_0x2a186b[_0x5b43('0x18')][_0x5b43('0x17')]);}})[_0x5b43('0x19')](function(_0x4ca109){logger['error'](_0x5b43('0x11'),_0x5dc73e,_0x4ca109);_0x3444fb(_0x4ca109);});});} \ No newline at end of file +var _0xb011=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5f46ee,_0x550dbb){var _0x5f3804=function(_0x1fcd12){while(--_0x1fcd12){_0x5f46ee['push'](_0x5f46ee['shift']());}};_0x5f3804(++_0x550dbb);}(_0xb011,0x12a));var _0x1b01=function(_0x547ec1,_0x7a5a46){_0x547ec1=_0x547ec1-0x0;var _0x2a6069=_0xb011[_0x547ec1];return _0x2a6069;};'use strict';var _=require('lodash');var util=require(_0x1b01('0x0'));var moment=require(_0x1b01('0x1'));var BPromise=require(_0x1b01('0x2'));var rs=require(_0x1b01('0x3'));var fs=require('fs');var Redis=require(_0x1b01('0x4'));var db=require(_0x1b01('0x5'))['db'];var utils=require(_0x1b01('0x6'));var logger=require('../../config/logger')(_0x1b01('0x7'));var config=require(_0x1b01('0x8'));var jayson=require(_0x1b01('0x9'));var client=jayson[_0x1b01('0xa')][_0x1b01('0xb')]({'port':0x232a});config[_0x1b01('0xc')]=_[_0x1b01('0xd')](config[_0x1b01('0xc')],{'host':_0x1b01('0xe'),'port':0x18eb});var socket=require(_0x1b01('0xf'))(new Redis(config[_0x1b01('0xc')]));require('./cmList.socket')[_0x1b01('0x10')](socket);function respondWithRpcPromise(_0x22fa4c,_0x4d7b3a,_0x2d31ad){return new BPromise(function(_0x19aa77,_0x5b942b){return client[_0x1b01('0x11')](_0x22fa4c,_0x2d31ad)[_0x1b01('0x12')](function(_0x598c88){logger[_0x1b01('0x13')](_0x1b01('0x14'),_0x4d7b3a,_0x1b01('0x15'));logger[_0x1b01('0x16')]('CmList,\x20%s,\x20%s,\x20%s',_0x4d7b3a,_0x1b01('0x15'),JSON['stringify'](_0x598c88));if(_0x598c88[_0x1b01('0x17')]){if(_0x598c88['error'][_0x1b01('0x18')]===0x1f4){logger[_0x1b01('0x17')](_0x1b01('0x14'),_0x4d7b3a,_0x598c88[_0x1b01('0x17')]['message']);return _0x5b942b(_0x598c88[_0x1b01('0x17')][_0x1b01('0x19')]);}logger[_0x1b01('0x17')](_0x1b01('0x14'),_0x4d7b3a,_0x598c88['error'][_0x1b01('0x19')]);return _0x19aa77(_0x598c88['error'][_0x1b01('0x19')]);}else{logger[_0x1b01('0x13')](_0x1b01('0x14'),_0x4d7b3a,'request\x20sent');_0x19aa77(_0x598c88[_0x1b01('0x1a')][_0x1b01('0x19')]);}})[_0x1b01('0x1b')](function(_0x10dcbf){logger['error'](_0x1b01('0x14'),_0x4d7b3a,_0x10dcbf);_0x5b942b(_0x10dcbf);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 3d4a80c..c5696a1 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 _0x2cd0=['emit','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0xc5a1a2,_0x49df81){var _0x5d3fe6=function(_0x3d443d){while(--_0x3d443d){_0xc5a1a2['push'](_0xc5a1a2['shift']());}};_0x5d3fe6(++_0x49df81);}(_0x2cd0,0x8a));var _0x02cd=function(_0x5d5799,_0xae2a5b){_0x5d5799=_0x5d5799-0x0;var _0x1b38a4=_0x2cd0[_0x5d5799];return _0x1b38a4;};'use strict';var CmListEvents=require(_0x02cd('0x0'));var events=[_0x02cd('0x1'),'remove','update'];function createListener(_0x22baca,_0x573434){return function(_0x55565b){_0x573434[_0x02cd('0x2')](_0x22baca,_0x55565b);};}function removeListener(_0x291580,_0x3fba37){return function(){CmListEvents[_0x02cd('0x3')](_0x291580,_0x3fba37);};}exports[_0x02cd('0x4')]=function(_0x35144b){for(var _0x222904=0x0,_0x178a25=events[_0x02cd('0x5')];_0x222904<_0x178a25;_0x222904++){var _0x21bbe0=events[_0x222904];var _0x5ccfd4=createListener(_0x02cd('0x6')+_0x21bbe0,_0x35144b);CmListEvents['on'](_0x21bbe0,_0x5ccfd4);}}; \ No newline at end of file +var _0x4c9d=['removeListener','register','length','cmList:','./cmList.events','save','remove','emit'];(function(_0x641f18,_0x2919e8){var _0x16eefe=function(_0x578a89){while(--_0x578a89){_0x641f18['push'](_0x641f18['shift']());}};_0x16eefe(++_0x2919e8);}(_0x4c9d,0x7c));var _0xd4c9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4c9d[_0x3ab51d];return _0x29a04e;};'use strict';var CmListEvents=require(_0xd4c9('0x0'));var events=[_0xd4c9('0x1'),_0xd4c9('0x2'),'update'];function createListener(_0x11e4e7,_0x13c911){return function(_0x173031){_0x13c911[_0xd4c9('0x3')](_0x11e4e7,_0x173031);};}function removeListener(_0x102345,_0x2b30d0){return function(){CmListEvents[_0xd4c9('0x4')](_0x102345,_0x2b30d0);};}exports[_0xd4c9('0x5')]=function(_0x2c81cb){for(var _0x5980e0=0x0,_0x48b511=events[_0xd4c9('0x6')];_0x5980e0<_0x48b511;_0x5980e0++){var _0x37b94e=events[_0x5980e0];var _0x3f9d50=createListener(_0xd4c9('0x7')+_0x37b94e,_0x2c81cb);CmListEvents['on'](_0x37b94e,_0x3f9d50);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index c1b987a..34280d7 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 _0xb6d4=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','getContactsCsv','getCustomFields','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','put','update','delete','removeDispositions','removeAgents'];(function(_0x92924,_0x55d113){var _0x23b7aa=function(_0x4739b3){while(--_0x4739b3){_0x92924['push'](_0x92924['shift']());}};_0x23b7aa(++_0x55d113);}(_0xb6d4,0x16c));var _0x4b6d=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb6d4[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x4b6d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4b6d('0x1'));var express=require(_0x4b6d('0x2'));var router=express[_0x4b6d('0x3')]();var auth=require(_0x4b6d('0x4'));var interaction=require(_0x4b6d('0x5'));var config=require('../../config/environment');var controller=require(_0x4b6d('0x6'));router[_0x4b6d('0x7')]('/',auth[_0x4b6d('0x8')](),controller[_0x4b6d('0x9')]);router[_0x4b6d('0x7')](_0x4b6d('0xa'),auth[_0x4b6d('0x8')](),controller[_0x4b6d('0xb')]);router[_0x4b6d('0x7')](_0x4b6d('0xc'),auth[_0x4b6d('0x8')](),controller[_0x4b6d('0xd')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x4b6d('0x7')](_0x4b6d('0xe'),auth[_0x4b6d('0x8')](),controller[_0x4b6d('0xf')]);router[_0x4b6d('0x7')]('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0x4b6d('0x10')]);router[_0x4b6d('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x4b6d('0x11')]);router[_0x4b6d('0x7')](_0x4b6d('0x12'),auth[_0x4b6d('0x8')](),controller[_0x4b6d('0x13')]);router[_0x4b6d('0x14')]('/',auth[_0x4b6d('0x8')](),controller['create']);router['post'](_0x4b6d('0x15'),auth[_0x4b6d('0x8')](),controller[_0x4b6d('0x16')]);router[_0x4b6d('0x14')](_0x4b6d('0xe'),auth['isAuthenticated'](),controller[_0x4b6d('0x17')]);router[_0x4b6d('0x14')](_0x4b6d('0x18'),auth[_0x4b6d('0x8')](),controller[_0x4b6d('0x19')]);router['post'](_0x4b6d('0x12'),auth[_0x4b6d('0x8')](),controller[_0x4b6d('0x1a')]);router[_0x4b6d('0x1b')]('/:id',auth[_0x4b6d('0x8')](),controller[_0x4b6d('0x1c')]);router['delete']('/:id',auth[_0x4b6d('0x8')](),controller['destroy']);router[_0x4b6d('0x1d')](_0x4b6d('0x15'),auth[_0x4b6d('0x8')](),controller[_0x4b6d('0x1e')]);router[_0x4b6d('0x1d')](_0x4b6d('0x12'),auth[_0x4b6d('0x8')](),controller[_0x4b6d('0x1f')]);module[_0x4b6d('0x20')]=router; \ No newline at end of file +var _0x5e98=['isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','create','addDisposition','post','/:id/contacts','addContacts','addCustomField','addAgents','put','delete','removeDispositions','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x5e98,0x128));var _0x85e9=function(_0x5a7627,_0x1cbc06){_0x5a7627=_0x5a7627-0x0;var _0x263d7d=_0x5e98[_0x5a7627];return _0x263d7d;};'use strict';var multer=require('multer');var util=require(_0x85e9('0x0'));var path=require(_0x85e9('0x1'));var timeout=require(_0x85e9('0x2'));var express=require(_0x85e9('0x3'));var router=express[_0x85e9('0x4')]();var auth=require(_0x85e9('0x5'));var interaction=require(_0x85e9('0x6'));var config=require(_0x85e9('0x7'));var controller=require(_0x85e9('0x8'));router[_0x85e9('0x9')]('/',auth[_0x85e9('0xa')](),controller[_0x85e9('0xb')]);router['get'](_0x85e9('0xc'),auth[_0x85e9('0xa')](),controller[_0x85e9('0xd')]);router[_0x85e9('0x9')](_0x85e9('0xe'),auth[_0x85e9('0xa')](),controller[_0x85e9('0xf')]);router[_0x85e9('0x9')](_0x85e9('0x10'),auth[_0x85e9('0xa')](),controller['getDispositions']);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0x85e9('0x11')]);router[_0x85e9('0x9')](_0x85e9('0x12'),auth[_0x85e9('0xa')](),controller[_0x85e9('0x13')]);router[_0x85e9('0x9')](_0x85e9('0x14'),auth[_0x85e9('0xa')](),controller[_0x85e9('0x15')]);router['get'](_0x85e9('0x16'),auth[_0x85e9('0xa')](),controller['getAgents']);router['post']('/',auth[_0x85e9('0xa')](),controller[_0x85e9('0x17')]);router['post'](_0x85e9('0x10'),auth[_0x85e9('0xa')](),controller[_0x85e9('0x18')]);router[_0x85e9('0x19')](_0x85e9('0x1a'),auth[_0x85e9('0xa')](),controller[_0x85e9('0x1b')]);router[_0x85e9('0x19')](_0x85e9('0x14'),auth[_0x85e9('0xa')](),controller[_0x85e9('0x1c')]);router[_0x85e9('0x19')](_0x85e9('0x16'),auth['isAuthenticated'](),controller[_0x85e9('0x1d')]);router[_0x85e9('0x1e')](_0x85e9('0xe'),auth[_0x85e9('0xa')](),controller['update']);router[_0x85e9('0x1f')](_0x85e9('0xe'),auth[_0x85e9('0xa')](),controller['destroy']);router[_0x85e9('0x1f')](_0x85e9('0x10'),auth[_0x85e9('0xa')](),controller[_0x85e9('0x20')]);router[_0x85e9('0x1f')](_0x85e9('0x16'),auth[_0x85e9('0xa')](),controller['removeAgents']);module[_0x85e9('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 8e2ff79..83d3d4f 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(_0x3fd167,_0x948598){var _0x3d41e3=function(_0x45bb83){while(--_0x45bb83){_0x3fd167['push'](_0x3fd167['shift']());}};_0x3d41e3(++_0x948598);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x45d9c0,_0x1a9bd0){var _0x427cab=function(_0x3a20a8){while(--_0x3a20a8){_0x45d9c0['push'](_0x45d9c0['shift']());}};_0x427cab(++_0x1a9bd0);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 82b5ba3..a85c618 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 _0x7e96=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','update','then','destroy','name','send','body','Condition','find','params','catch','html-pdf','eml-format'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x7e96,0x1c6));var _0x67e9=function(_0x4452a0,_0x10b371){_0x4452a0=_0x4452a0-0x0;var _0x579a04=_0x7e96[_0x4452a0];return _0x579a04;};'use strict';var pdf=require(_0x67e9('0x0'));var emlformat=require(_0x67e9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x67e9('0x2'));var jsonpatch=require(_0x67e9('0x3'));var rp=require(_0x67e9('0x4'));var moment=require('moment');var BPromise=require(_0x67e9('0x5'));var Mustache=require(_0x67e9('0x6'));var util=require(_0x67e9('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x67e9('0x8'));var squel=require(_0x67e9('0x9'));var crypto=require(_0x67e9('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x67e9('0xb'));var querystring=require('querystring');var Papa=require(_0x67e9('0xc'));var Redis=require(_0x67e9('0xd'));var authService=require(_0x67e9('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x67e9('0xf'));var hardwareService=require(_0x67e9('0x10'));var logger=require(_0x67e9('0x11'))(_0x67e9('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x67e9('0x13'))['db'];function respondWithStatusCode(_0x1b8b11,_0x481001){_0x481001=_0x481001||0xcc;return function(_0x4cc7bd){if(_0x4cc7bd){return _0x1b8b11[_0x67e9('0x14')](_0x481001);}return _0x1b8b11[_0x67e9('0x15')](_0x481001)[_0x67e9('0x16')]();};}function respondWithResult(_0x416e42,_0x1c6474){_0x1c6474=_0x1c6474||0xc8;return function(_0x36a315){if(_0x36a315){return _0x416e42[_0x67e9('0x15')](_0x1c6474)[_0x67e9('0x17')](_0x36a315);}};}function respondWithFilteredResult(_0x2c280f,_0x1e3547){return function(_0x232434){if(_0x232434){var _0x19a226=_0x232434['count'],_0x199dea=_0x1e3547[_0x67e9('0x18')],_0x5461e8=_0x1e3547[_0x67e9('0x18')]+_0x1e3547[_0x67e9('0x19')],_0x57e7e1;if(_0x5461e8>=_0x19a226){_0x5461e8=_0x19a226;_0x57e7e1=0xc8;}else{_0x57e7e1=0xce;}_0x2c280f[_0x67e9('0x15')](_0x57e7e1);return _0x2c280f[_0x67e9('0x1a')](_0x67e9('0x1b'),_0x199dea+'-'+_0x5461e8+'/'+_0x19a226)[_0x67e9('0x17')](_0x232434);}return null;};}function patchUpdates(_0x4bff78){return function(_0x297a99){try{jsonpatch['apply'](_0x297a99,_0x4bff78,!![]);}catch(_0x529419){return BPromise['reject'](_0x529419);}return _0x297a99['save']();};}function saveUpdates(_0x3561da,_0x1a63f3){return function(_0x104453){if(_0x104453){return _0x104453[_0x67e9('0x1c')](_0x3561da)[_0x67e9('0x1d')](function(_0xb85f4b){return _0xb85f4b;});}return null;};}function removeEntity(_0x16449b,_0x4d82fd){return function(_0x547f0c){if(_0x547f0c){return _0x547f0c[_0x67e9('0x1e')]()[_0x67e9('0x1d')](function(){_0x16449b[_0x67e9('0x15')](0xcc)[_0x67e9('0x16')]();});}};}function handleEntityNotFound(_0x3c7b98,_0x671220){return function(_0x38cab7){if(!_0x38cab7){_0x3c7b98[_0x67e9('0x14')](0x194);}return _0x38cab7;};}function handleError(_0x5edcb1,_0x315a97){_0x315a97=_0x315a97||0x1f4;return function(_0x22f184){logger['error'](_0x22f184['stack']);if(_0x22f184['name']){delete _0x22f184[_0x67e9('0x1f')];}_0x5edcb1['status'](_0x315a97)[_0x67e9('0x20')](_0x22f184);};}exports[_0x67e9('0x1c')]=function(_0x193f33,_0x18776e){if(_0x193f33[_0x67e9('0x21')]['id']){delete _0x193f33[_0x67e9('0x21')]['id'];}return db[_0x67e9('0x22')][_0x67e9('0x23')]({'where':{'id':_0x193f33[_0x67e9('0x24')]['id']}})[_0x67e9('0x1d')](handleEntityNotFound(_0x18776e,null))['then'](saveUpdates(_0x193f33['body'],null))[_0x67e9('0x1d')](respondWithResult(_0x18776e,null))[_0x67e9('0x25')](handleError(_0x18776e,null));};exports[_0x67e9('0x1e')]=function(_0x5d63ff,_0x47c357){return db[_0x67e9('0x22')]['find']({'where':{'id':_0x5d63ff[_0x67e9('0x24')]['id']}})[_0x67e9('0x1d')](handleEntityNotFound(_0x47c357,null))[_0x67e9('0x1d')](removeEntity(_0x47c357,null))['catch'](handleError(_0x47c357,null));}; \ No newline at end of file +var _0xcdd2=['crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','body','find','params','Condition','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel'];(function(_0xff4dd9,_0xe27c95){var _0x1477e4=function(_0x3fd720){while(--_0x3fd720){_0xff4dd9['push'](_0xff4dd9['shift']());}};_0x1477e4(++_0xe27c95);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x2cdd('0x0'));var emlformat=require(_0x2cdd('0x1'));var rimraf=require(_0x2cdd('0x2'));var zipdir=require(_0x2cdd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cdd('0x4'));var moment=require(_0x2cdd('0x5'));var BPromise=require(_0x2cdd('0x6'));var Mustache=require(_0x2cdd('0x7'));var util=require('util');var path=require(_0x2cdd('0x8'));var sox=require(_0x2cdd('0x9'));var csv=require('to-csv');var ejs=require(_0x2cdd('0xa'));var fs=require('fs');var _=require(_0x2cdd('0xb'));var squel=require(_0x2cdd('0xc'));var crypto=require(_0x2cdd('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2cdd('0xe'));var Papa=require('papaparse');var Redis=require(_0x2cdd('0xf'));var authService=require(_0x2cdd('0x10'));var qs=require(_0x2cdd('0x11'));var as=require(_0x2cdd('0x12'));var hardwareService=require(_0x2cdd('0x13'));var logger=require(_0x2cdd('0x14'))(_0x2cdd('0x15'));var utils=require(_0x2cdd('0x16'));var config=require(_0x2cdd('0x17'));var db=require(_0x2cdd('0x18'))['db'];function respondWithStatusCode(_0x4a808b,_0x53ea0b){_0x53ea0b=_0x53ea0b||0xcc;return function(_0xfddd1e){if(_0xfddd1e){return _0x4a808b[_0x2cdd('0x19')](_0x53ea0b);}return _0x4a808b['status'](_0x53ea0b)[_0x2cdd('0x1a')]();};}function respondWithResult(_0x2557b9,_0x345b45){_0x345b45=_0x345b45||0xc8;return function(_0x2932b3){if(_0x2932b3){return _0x2557b9[_0x2cdd('0x1b')](_0x345b45)['json'](_0x2932b3);}};}function respondWithFilteredResult(_0x367111,_0x25c36d){return function(_0x4849bc){if(_0x4849bc){var _0x159f31=_0x4849bc[_0x2cdd('0x1c')],_0x1c6bc7=_0x25c36d[_0x2cdd('0x1d')],_0x1e8479=_0x25c36d['offset']+_0x25c36d[_0x2cdd('0x1e')],_0x1767d5;if(_0x1e8479>=_0x159f31){_0x1e8479=_0x159f31;_0x1767d5=0xc8;}else{_0x1767d5=0xce;}_0x367111[_0x2cdd('0x1b')](_0x1767d5);return _0x367111[_0x2cdd('0x1f')](_0x2cdd('0x20'),_0x1c6bc7+'-'+_0x1e8479+'/'+_0x159f31)['json'](_0x4849bc);}return null;};}function patchUpdates(_0x23f7a6){return function(_0x204543){try{jsonpatch[_0x2cdd('0x21')](_0x204543,_0x23f7a6,!![]);}catch(_0x315f5b){return BPromise[_0x2cdd('0x22')](_0x315f5b);}return _0x204543[_0x2cdd('0x23')]();};}function saveUpdates(_0x2b0691,_0x442c18){return function(_0x3dc9ec){if(_0x3dc9ec){return _0x3dc9ec[_0x2cdd('0x24')](_0x2b0691)['then'](function(_0x4fab7a){return _0x4fab7a;});}return null;};}function removeEntity(_0x206942,_0x5e874e){return function(_0x50fdcb){if(_0x50fdcb){return _0x50fdcb[_0x2cdd('0x25')]()[_0x2cdd('0x26')](function(){_0x206942[_0x2cdd('0x1b')](0xcc)[_0x2cdd('0x1a')]();});}};}function handleEntityNotFound(_0x5bb57e,_0x5a7b76){return function(_0x444a10){if(!_0x444a10){_0x5bb57e[_0x2cdd('0x19')](0x194);}return _0x444a10;};}function handleError(_0x340a47,_0x284337){_0x284337=_0x284337||0x1f4;return function(_0x7a0d70){logger[_0x2cdd('0x27')](_0x7a0d70[_0x2cdd('0x28')]);if(_0x7a0d70['name']){delete _0x7a0d70[_0x2cdd('0x29')];}_0x340a47[_0x2cdd('0x1b')](_0x284337)[_0x2cdd('0x2a')](_0x7a0d70);};}exports['update']=function(_0x4cbc21,_0x5ef69f){if(_0x4cbc21[_0x2cdd('0x2b')]['id']){delete _0x4cbc21[_0x2cdd('0x2b')]['id'];}return db['Condition'][_0x2cdd('0x2c')]({'where':{'id':_0x4cbc21[_0x2cdd('0x2d')]['id']}})[_0x2cdd('0x26')](handleEntityNotFound(_0x5ef69f,null))[_0x2cdd('0x26')](saveUpdates(_0x4cbc21[_0x2cdd('0x2b')],null))[_0x2cdd('0x26')](respondWithResult(_0x5ef69f,null))['catch'](handleError(_0x5ef69f,null));};exports[_0x2cdd('0x25')]=function(_0x239fad,_0x1f837a){return db[_0x2cdd('0x2e')]['find']({'where':{'id':_0x239fad[_0x2cdd('0x2d')]['id']}})[_0x2cdd('0x26')](handleEntityNotFound(_0x1f837a,null))['then'](removeEntity(_0x1f837a,null))[_0x2cdd('0x2f')](handleError(_0x1f837a,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 811c34a..da56e47 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 _0x0b7a=['request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','tools_conditions','../../config/logger','bluebird'];(function(_0x1dc8a1,_0x43450b){var _0x4e663e=function(_0x3409de){while(--_0x3409de){_0x1dc8a1['push'](_0x1dc8a1['shift']());}};_0x4e663e(++_0x43450b);}(_0x0b7a,0xbc));var _0xa0b7=function(_0x1c8539,_0x107438){_0x1c8539=_0x1c8539-0x0;var _0x5d9716=_0x0b7a[_0x1c8539];return _0x5d9716;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa0b7('0x0'))('api');var moment=require('moment');var BPromise=require(_0xa0b7('0x1'));var rp=require(_0xa0b7('0x2'));var fs=require('fs');var path=require(_0xa0b7('0x3'));var rimraf=require(_0xa0b7('0x4'));var config=require(_0xa0b7('0x5'));var attributes=require(_0xa0b7('0x6'));module[_0xa0b7('0x7')]=function(_0x5f4e88,_0x1457d0){return _0x5f4e88[_0xa0b7('0x8')]('Condition',attributes,{'tableName':_0xa0b7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8235=['moment','request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','util','api'];(function(_0x33ebf5,_0x258ec6){var _0x66957b=function(_0x49739a){while(--_0x49739a){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x66957b(++_0x258ec6);}(_0x8235,0x111));var _0x5823=function(_0x3a0c22,_0x3191e8){_0x3a0c22=_0x3a0c22-0x0;var _0x4a38f7=_0x8235[_0x3a0c22];return _0x4a38f7;};'use strict';var _=require('lodash');var util=require(_0x5823('0x0'));var logger=require('../../config/logger')(_0x5823('0x1'));var moment=require(_0x5823('0x2'));var BPromise=require('bluebird');var rp=require(_0x5823('0x3'));var fs=require('fs');var path=require(_0x5823('0x4'));var rimraf=require('rimraf');var config=require(_0x5823('0x5'));var attributes=require(_0x5823('0x6'));module[_0x5823('0x7')]=function(_0x2f0e60,_0x582a6a){return _0x2f0e60[_0x5823('0x8')](_0x5823('0x9'),attributes,{'tableName':_0x5823('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index e24cea1..73829af 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 _0xadca=['lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result'];(function(_0x4cc3e0,_0x1f07b7){var _0x2a0776=function(_0x4926e4){while(--_0x4926e4){_0x4cc3e0['push'](_0x4cc3e0['shift']());}};_0x2a0776(++_0x1f07b7);}(_0xadca,0x72));var _0xaadc=function(_0x31d707,_0x733c2b){_0x31d707=_0x31d707-0x0;var _0x3ff20d=_0xadca[_0x31d707];return _0x3ff20d;};'use strict';var _=require(_0xaadc('0x0'));var util=require(_0xaadc('0x1'));var moment=require(_0xaadc('0x2'));var BPromise=require('bluebird');var rs=require(_0xaadc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaadc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaadc('0x5'))(_0xaadc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaadc('0x7')][_0xaadc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2195a8,_0x24848f,_0x48981b){return new BPromise(function(_0x25c030,_0x75bf22){return client[_0xaadc('0x9')](_0x2195a8,_0x48981b)[_0xaadc('0xa')](function(_0x529a54){logger[_0xaadc('0xb')](_0xaadc('0xc'),_0x24848f,'request\x20sent');logger[_0xaadc('0xd')](_0xaadc('0xe'),_0x24848f,_0xaadc('0xf'),JSON['stringify'](_0x529a54));if(_0x529a54['error']){if(_0x529a54[_0xaadc('0x10')]['code']===0x1f4){logger[_0xaadc('0x10')]('Condition,\x20%s,\x20%s',_0x24848f,_0x529a54[_0xaadc('0x10')]['message']);return _0x75bf22(_0x529a54[_0xaadc('0x10')][_0xaadc('0x11')]);}logger[_0xaadc('0x10')](_0xaadc('0xc'),_0x24848f,_0x529a54['error']['message']);return _0x25c030(_0x529a54['error'][_0xaadc('0x11')]);}else{logger[_0xaadc('0xb')]('Condition,\x20%s,\x20%s',_0x24848f,_0xaadc('0xf'));_0x25c030(_0x529a54[_0xaadc('0x12')][_0xaadc('0x11')]);}})['catch'](function(_0x58308d){logger['error']('Condition,\x20%s,\x20%s',_0x24848f,_0x58308d);_0x75bf22(_0x58308d);});});} \ No newline at end of file +var _0xdefd=['catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2ca265,_0x294075){var _0x2444da=function(_0x5628d6){while(--_0x5628d6){_0x2ca265['push'](_0x2ca265['shift']());}};_0x2444da(++_0x294075);}(_0xdefd,0x1cf));var _0xddef=function(_0x11a498,_0xba2074){_0x11a498=_0x11a498-0x0;var _0x447d83=_0xdefd[_0x11a498];return _0x447d83;};'use strict';var _=require(_0xddef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xddef('0x1'));var fs=require('fs');var Redis=require(_0xddef('0x2'));var db=require(_0xddef('0x3'))['db'];var utils=require(_0xddef('0x4'));var logger=require(_0xddef('0x5'))(_0xddef('0x6'));var config=require(_0xddef('0x7'));var jayson=require(_0xddef('0x8'));var client=jayson['client'][_0xddef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7cc440,_0x584bcf,_0x44b307){return new BPromise(function(_0x9c09b9,_0x5cc980){return client[_0xddef('0xa')](_0x7cc440,_0x44b307)['then'](function(_0x408fa5){logger['info'](_0xddef('0xb'),_0x584bcf,_0xddef('0xc'));logger[_0xddef('0xd')](_0xddef('0xe'),_0x584bcf,_0xddef('0xc'),JSON[_0xddef('0xf')](_0x408fa5));if(_0x408fa5[_0xddef('0x10')]){if(_0x408fa5['error'][_0xddef('0x11')]===0x1f4){logger[_0xddef('0x10')]('Condition,\x20%s,\x20%s',_0x584bcf,_0x408fa5[_0xddef('0x10')][_0xddef('0x12')]);return _0x5cc980(_0x408fa5[_0xddef('0x10')]['message']);}logger['error']('Condition,\x20%s,\x20%s',_0x584bcf,_0x408fa5['error'][_0xddef('0x12')]);return _0x9c09b9(_0x408fa5[_0xddef('0x10')][_0xddef('0x12')]);}else{logger[_0xddef('0x13')]('Condition,\x20%s,\x20%s',_0x584bcf,'request\x20sent');_0x9c09b9(_0x408fa5[_0xddef('0x14')][_0xddef('0x12')]);}})[_0xddef('0x15')](function(_0x37eba4){logger[_0xddef('0x10')](_0xddef('0xb'),_0x584bcf,_0x37eba4);_0x5cc980(_0x37eba4);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 3dc7b94..c26b2a8 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 _0xe8e5=['put','/:id','isAuthenticated','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller'];(function(_0xc8c031,_0x22cf1a){var _0x5ed7ed=function(_0x5be705){while(--_0x5be705){_0xc8c031['push'](_0xc8c031['shift']());}};_0x5ed7ed(++_0x22cf1a);}(_0xe8e5,0x172));var _0x5e8e=function(_0x3dcd06,_0x2f21d6){_0x3dcd06=_0x3dcd06-0x0;var _0x1a3bde=_0xe8e5[_0x3dcd06];return _0x1a3bde;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5e8e('0x0'));var timeout=require(_0x5e8e('0x1'));var express=require(_0x5e8e('0x2'));var router=express[_0x5e8e('0x3')]();var auth=require(_0x5e8e('0x4'));var interaction=require(_0x5e8e('0x5'));var config=require(_0x5e8e('0x6'));var controller=require(_0x5e8e('0x7'));router[_0x5e8e('0x8')](_0x5e8e('0x9'),auth[_0x5e8e('0xa')](),controller[_0x5e8e('0xb')]);router[_0x5e8e('0xc')](_0x5e8e('0x9'),auth[_0x5e8e('0xa')](),controller[_0x5e8e('0xd')]);module['exports']=router; \ No newline at end of file +var _0x7176=['/:id','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete'];(function(_0x52f94e,_0x1f5e45){var _0x3b2ada=function(_0x4e9d5b){while(--_0x4e9d5b){_0x52f94e['push'](_0x52f94e['shift']());}};_0x3b2ada(++_0x1f5e45);}(_0x7176,0x1f1));var _0x6717=function(_0x341fb2,_0x1b8dd9){_0x341fb2=_0x341fb2-0x0;var _0x408d0a=_0x7176[_0x341fb2];return _0x408d0a;};'use strict';var multer=require('multer');var util=require(_0x6717('0x0'));var path=require(_0x6717('0x1'));var timeout=require(_0x6717('0x2'));var express=require(_0x6717('0x3'));var router=express[_0x6717('0x4')]();var auth=require(_0x6717('0x5'));var interaction=require(_0x6717('0x6'));var config=require(_0x6717('0x7'));var controller=require(_0x6717('0x8'));router[_0x6717('0x9')]('/:id',auth[_0x6717('0xa')](),controller[_0x6717('0xb')]);router[_0x6717('0xc')](_0x6717('0xd'),auth[_0x6717('0xa')](),controller[_0x6717('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 68b8d09..5861abf 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['sequelize','exports','STRING','name'];(function(_0x2d41ee,_0x4ea538){var _0x4efdd7=function(_0x5b707d){while(--_0x5b707d){_0x2d41ee['push'](_0x2d41ee['shift']());}};_0x4efdd7(++_0x4ea538);}(_0x34e8,0x12c));var _0x834e=function(_0x37ca0e,_0x1e908c){_0x37ca0e=_0x37ca0e-0x0;var _0x350345=_0x34e8[_0x37ca0e];return _0x350345;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'allowNull':![],'unique':_0x834e('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x834e('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x4f5d=['sequelize','exports','STRING','name','INTEGER'];(function(_0x5b47db,_0x1130a7){var _0x722a26=function(_0x456de3){while(--_0x456de3){_0x5b47db['push'](_0x5b47db['shift']());}};_0x722a26(++_0x1130a7);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4f5d[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require(_0xd4f5('0x0'));module[_0xd4f5('0x1')]={'name':{'type':Sequelize[_0xd4f5('0x2')],'allowNull':![],'unique':_0xd4f5('0x3')},'OrderBy':{'type':Sequelize[_0xd4f5('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xd4f5('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 112f320..a531ee1 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','save','update','get','ContactItemTypes','UserProfileResource','destroy','then','end','error','stack','send','index','map','ContactItemType','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','name','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel'];(function(_0x4f4e4b,_0x46ea73){var _0x23a628=function(_0x56791){while(--_0x56791){_0x4f4e4b['push'](_0x4f4e4b['shift']());}};_0x23a628(++_0x46ea73);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2d37a1,_0x1c3284){_0x2d37a1=_0x2d37a1-0x0;var _0x22c6be=_0x8ef6[_0x2d37a1];return _0x22c6be;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x46356f,_0x1e117a){_0x1e117a=_0x1e117a||0xcc;return function(_0x454ef4){if(_0x454ef4){return _0x46356f[_0x68ef('0x1b')](_0x1e117a);}return _0x46356f[_0x68ef('0x1c')](_0x1e117a)['end']();};}function respondWithResult(_0x3b48dd,_0xc50cce){_0xc50cce=_0xc50cce||0xc8;return function(_0x2657c5){if(_0x2657c5){return _0x3b48dd['status'](_0xc50cce)[_0x68ef('0x1d')](_0x2657c5);}};}function respondWithFilteredResult(_0x1764de,_0x24682d){return function(_0x5005ba){if(_0x5005ba){var _0x35493d=_0x5005ba['count'],_0x37c4cc=_0x24682d[_0x68ef('0x1e')],_0x3d1e90=_0x24682d['offset']+_0x24682d['limit'],_0x3780a4;if(_0x3d1e90>=_0x35493d){_0x3d1e90=_0x35493d;_0x3780a4=0xc8;}else{_0x3780a4=0xce;}_0x1764de[_0x68ef('0x1c')](_0x3780a4);return _0x1764de[_0x68ef('0x1f')]('Content-Range',_0x37c4cc+'-'+_0x3d1e90+'/'+_0x35493d)['json'](_0x5005ba);}return null;};}function patchUpdates(_0x3c4c1f){return function(_0x2cd92c){try{jsonpatch[_0x68ef('0x20')](_0x2cd92c,_0x3c4c1f,!![]);}catch(_0x4fad1c){return BPromise[_0x68ef('0x21')](_0x4fad1c);}return _0x2cd92c[_0x68ef('0x22')]();};}function saveUpdates(_0x183f5f,_0x5b246b){return function(_0x3c46d4){if(_0x3c46d4){return _0x3c46d4[_0x68ef('0x23')](_0x183f5f)['then'](function(_0x399da4){return _0x399da4;});}return null;};}function removeEntity(_0xf4760f,_0x19aa3d){return function(_0x5ddec7){if(_0x5ddec7){return _0x5ddec7['destroy']()['then'](function(){var _0x26018d=_0x5ddec7[_0x68ef('0x24')]({'plain':!![]});var _0x312cc9=_0x68ef('0x25');return db[_0x68ef('0x26')][_0x68ef('0x27')]({'where':{'type':_0x312cc9,'resourceId':_0x26018d['id']}})[_0x68ef('0x28')](function(){return _0x5ddec7;});})[_0x68ef('0x28')](function(){_0xf4760f[_0x68ef('0x1c')](0xcc)[_0x68ef('0x29')]();});}};}function handleEntityNotFound(_0x5e4dbe,_0x178460){return function(_0x57f9ee){if(!_0x57f9ee){_0x5e4dbe['sendStatus'](0x194);}return _0x57f9ee;};}function handleError(_0x55d8b0,_0x1a7ce1){_0x1a7ce1=_0x1a7ce1||0x1f4;return function(_0x268f32){logger[_0x68ef('0x2a')](_0x268f32[_0x68ef('0x2b')]);if(_0x268f32['name']){delete _0x268f32['name'];}_0x55d8b0[_0x68ef('0x1c')](_0x1a7ce1)[_0x68ef('0x2c')](_0x268f32);};}exports[_0x68ef('0x2d')]=function(_0x263b30,_0x22ef25){var _0x201884={},_0x26288a={},_0x4579cb={'count':0x0,'rows':[]};var _0x5a6dfd=_[_0x68ef('0x2e')](db[_0x68ef('0x2f')][_0x68ef('0x30')],function(_0x4c25aa){return{'name':_0x4c25aa[_0x68ef('0x31')],'type':_0x4c25aa['type'][_0x68ef('0x32')]};});_0x26288a[_0x68ef('0x33')]=_['map'](_0x5a6dfd,'name');_0x26288a[_0x68ef('0x34')]=_[_0x68ef('0x35')](_0x263b30['query']);_0x26288a[_0x68ef('0x36')]=_[_0x68ef('0x37')](_0x26288a[_0x68ef('0x33')],_0x26288a[_0x68ef('0x34')]);_0x201884['attributes']=_[_0x68ef('0x37')](_0x26288a[_0x68ef('0x33')],qs['fields'](_0x263b30[_0x68ef('0x34')]['fields']));_0x201884[_0x68ef('0x38')]=_0x201884[_0x68ef('0x38')]['length']?_0x201884[_0x68ef('0x38')]:_0x26288a['model'];if(!_0x263b30[_0x68ef('0x34')]['hasOwnProperty'](_0x68ef('0x39'))){_0x201884[_0x68ef('0x3a')]=qs[_0x68ef('0x3a')](_0x263b30['query'][_0x68ef('0x3a')]);_0x201884['offset']=qs[_0x68ef('0x1e')](_0x263b30['query'][_0x68ef('0x1e')]);}_0x201884[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_0x263b30[_0x68ef('0x34')][_0x68ef('0x3c')]);_0x201884[_0x68ef('0x3d')]=qs['filters'](_[_0x68ef('0x3e')](_0x263b30[_0x68ef('0x34')],_0x26288a[_0x68ef('0x36')]),_0x5a6dfd);if(_0x263b30['query'][_0x68ef('0x3f')]){_0x201884[_0x68ef('0x3d')]=_[_0x68ef('0x40')](_0x201884['where'],{'$or':_['map'](_0x5a6dfd,function(_0x14f0fc){if(_0x14f0fc[_0x68ef('0x41')]!==_0x68ef('0x42')){var _0x42fc8c={};_0x42fc8c[_0x14f0fc[_0x68ef('0x43')]]={'$like':'%'+_0x263b30[_0x68ef('0x34')][_0x68ef('0x3f')]+'%'};return _0x42fc8c;}})});}_0x201884=_['merge']({},_0x201884,_0x263b30[_0x68ef('0x44')]);var _0xd7f9ca={'where':_0x201884[_0x68ef('0x3d')]};return db[_0x68ef('0x2f')]['count'](_0xd7f9ca)[_0x68ef('0x28')](function(_0x3a2f53){_0x4579cb[_0x68ef('0x45')]=_0x3a2f53;if(_0x263b30[_0x68ef('0x34')][_0x68ef('0x46')]){_0x201884[_0x68ef('0x47')]=[{'all':!![]}];}return db['ContactItemType'][_0x68ef('0x48')](_0x201884);})[_0x68ef('0x28')](function(_0xf5010c){_0x4579cb[_0x68ef('0x49')]=_0xf5010c;return _0x4579cb;})[_0x68ef('0x28')](respondWithFilteredResult(_0x22ef25,_0x201884))[_0x68ef('0x4a')](handleError(_0x22ef25,null));};exports[_0x68ef('0x4b')]=function(_0xd6a0b5,_0xc687ab){var _0x531096={'raw':!![],'where':{'id':_0xd6a0b5[_0x68ef('0x4c')]['id']}},_0xad1a28={};_0xad1a28[_0x68ef('0x33')]=_[_0x68ef('0x35')](db[_0x68ef('0x2f')][_0x68ef('0x30')]);_0xad1a28[_0x68ef('0x34')]=_['keys'](_0xd6a0b5[_0x68ef('0x34')]);_0xad1a28['filters']=_[_0x68ef('0x37')](_0xad1a28[_0x68ef('0x33')],_0xad1a28[_0x68ef('0x34')]);_0x531096[_0x68ef('0x38')]=_['intersection'](_0xad1a28[_0x68ef('0x33')],qs['fields'](_0xd6a0b5[_0x68ef('0x34')]['fields']));_0x531096[_0x68ef('0x38')]=_0x531096[_0x68ef('0x38')][_0x68ef('0x4d')]?_0x531096['attributes']:_0xad1a28['model'];if(_0xd6a0b5[_0x68ef('0x34')][_0x68ef('0x46')]){_0x531096['include']=[{'all':!![]}];}_0x531096=_['merge']({},_0x531096,_0xd6a0b5['options']);return db[_0x68ef('0x2f')][_0x68ef('0x4e')](_0x531096)[_0x68ef('0x28')](handleEntityNotFound(_0xc687ab,null))[_0x68ef('0x28')](respondWithResult(_0xc687ab,null))[_0x68ef('0x4a')](handleError(_0xc687ab,null));};exports['create']=function(_0x55f385,_0xc39f5b){return db[_0x68ef('0x2f')][_0x68ef('0x4f')](_0x55f385[_0x68ef('0x50')],{})['then'](function(_0x810685){var _0x474e5a=_0x55f385[_0x68ef('0x51')][_0x68ef('0x24')]({'plain':!![]});if(!_0x474e5a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x474e5a['role']===_0x68ef('0x51')){var _0x3c3074=_0x810685['get']({'plain':!![]});var _0xfc7a74=_0x68ef('0x25');return db[_0x68ef('0x52')][_0x68ef('0x4e')]({'where':{'name':_0xfc7a74,'userProfileId':_0x474e5a[_0x68ef('0x53')]},'raw':!![]})['then'](function(_0x35d6bd){if(_0x35d6bd&&_0x35d6bd[_0x68ef('0x54')]===0x0){return db[_0x68ef('0x26')]['create']({'name':_0x3c3074[_0x68ef('0x43')],'resourceId':_0x3c3074['id'],'type':_0x35d6bd[_0x68ef('0x43')],'sectionId':_0x35d6bd['id']},{})[_0x68ef('0x28')](function(){return _0x810685;});}else{return _0x810685;}})['catch'](function(_0x7dce90){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7dce90);throw _0x7dce90;});}return _0x810685;})[_0x68ef('0x28')](respondWithResult(_0xc39f5b,0xc9))['catch'](handleError(_0xc39f5b,null));};exports[_0x68ef('0x23')]=function(_0xb33afd,_0x53ebd){if(_0xb33afd[_0x68ef('0x50')]['id']){delete _0xb33afd[_0x68ef('0x50')]['id'];}return db[_0x68ef('0x2f')][_0x68ef('0x4e')]({'where':{'id':_0xb33afd[_0x68ef('0x4c')]['id']}})[_0x68ef('0x28')](handleEntityNotFound(_0x53ebd,null))[_0x68ef('0x28')](saveUpdates(_0xb33afd['body'],null))['then'](respondWithResult(_0x53ebd,null))[_0x68ef('0x4a')](handleError(_0x53ebd,null));};exports[_0x68ef('0x27')]=function(_0x317b79,_0xdc83f4){return db[_0x68ef('0x2f')][_0x68ef('0x4e')]({'where':{'id':_0x317b79[_0x68ef('0x4c')]['id']}})[_0x68ef('0x28')](handleEntityNotFound(_0xdc83f4,null))[_0x68ef('0x28')](removeEntity(_0xdc83f4,null))['catch'](handleError(_0xdc83f4,null));}; \ No newline at end of file +var _0x34e8=['then','ContactItemTypes','destroy','sendStatus','error','stack','name','map','ContactItemType','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','include','findAll','catch','show','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34e8,0x12c));var _0x834e=function(_0x9bffd0,_0x24dce0){_0x9bffd0=_0x9bffd0-0x0;var _0x5b532d=_0x34e8[_0x9bffd0];return _0x5b532d;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var Redis=require(_0x834e('0x13'));var authService=require(_0x834e('0x14'));var qs=require(_0x834e('0x15'));var as=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var db=require(_0x834e('0x1c'))['db'];function respondWithStatusCode(_0x538bb3,_0x5e5b6d){_0x5e5b6d=_0x5e5b6d||0xcc;return function(_0x6cd9b9){if(_0x6cd9b9){return _0x538bb3['sendStatus'](_0x5e5b6d);}return _0x538bb3[_0x834e('0x1d')](_0x5e5b6d)[_0x834e('0x1e')]();};}function respondWithResult(_0x28e659,_0x21cc0a){_0x21cc0a=_0x21cc0a||0xc8;return function(_0x50e860){if(_0x50e860){return _0x28e659[_0x834e('0x1d')](_0x21cc0a)[_0x834e('0x1f')](_0x50e860);}};}function respondWithFilteredResult(_0x57274a,_0x316205){return function(_0x4a9cdc){if(_0x4a9cdc){var _0x38a8cd=_0x4a9cdc[_0x834e('0x20')],_0x36d443=_0x316205[_0x834e('0x21')],_0x478afe=_0x316205['offset']+_0x316205[_0x834e('0x22')],_0x43ac41;if(_0x478afe>=_0x38a8cd){_0x478afe=_0x38a8cd;_0x43ac41=0xc8;}else{_0x43ac41=0xce;}_0x57274a[_0x834e('0x1d')](_0x43ac41);return _0x57274a[_0x834e('0x23')](_0x834e('0x24'),_0x36d443+'-'+_0x478afe+'/'+_0x38a8cd)[_0x834e('0x1f')](_0x4a9cdc);}return null;};}function patchUpdates(_0x254677){return function(_0x1dd214){try{jsonpatch['apply'](_0x1dd214,_0x254677,!![]);}catch(_0x2545b4){return BPromise[_0x834e('0x25')](_0x2545b4);}return _0x1dd214[_0x834e('0x26')]();};}function saveUpdates(_0x325a99,_0x4ab05d){return function(_0x45a630){if(_0x45a630){return _0x45a630[_0x834e('0x27')](_0x325a99)['then'](function(_0x1b4bdf){return _0x1b4bdf;});}return null;};}function removeEntity(_0x28d687,_0x8d406e){return function(_0x5c55ca){if(_0x5c55ca){return _0x5c55ca['destroy']()[_0x834e('0x28')](function(){var _0x34563b=_0x5c55ca['get']({'plain':!![]});var _0x25ee1d=_0x834e('0x29');return db['UserProfileResource'][_0x834e('0x2a')]({'where':{'type':_0x25ee1d,'resourceId':_0x34563b['id']}})[_0x834e('0x28')](function(){return _0x5c55ca;});})[_0x834e('0x28')](function(){_0x28d687['status'](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x3e310f,_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x3e310f[_0x834e('0x2b')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x2c')](_0x3f1b0b[_0x834e('0x2d')]);if(_0x3f1b0b[_0x834e('0x2e')]){delete _0x3f1b0b[_0x834e('0x2e')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={},_0x106d6a={},_0x5dacc1={'count':0x0,'rows':[]};var _0xb5bc06=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x4551f5){return{'name':_0x4551f5[_0x834e('0x32')],'type':_0x4551f5[_0x834e('0x33')][_0x834e('0x34')]};});_0x106d6a[_0x834e('0x35')]=_['map'](_0xb5bc06,_0x834e('0x2e'));_0x106d6a['query']=_[_0x834e('0x36')](_0x58c1d7[_0x834e('0x37')]);_0x106d6a[_0x834e('0x38')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],_0x106d6a[_0x834e('0x37')]);_0x567cea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],qs[_0x834e('0x3b')](_0x58c1d7['query'][_0x834e('0x3b')]));_0x567cea[_0x834e('0x3a')]=_0x567cea[_0x834e('0x3a')][_0x834e('0x3c')]?_0x567cea['attributes']:_0x106d6a[_0x834e('0x35')];if(!_0x58c1d7[_0x834e('0x37')]['hasOwnProperty']('nolimit')){_0x567cea['limit']=qs[_0x834e('0x22')](_0x58c1d7[_0x834e('0x37')][_0x834e('0x22')]);_0x567cea[_0x834e('0x21')]=qs[_0x834e('0x21')](_0x58c1d7[_0x834e('0x37')]['offset']);}_0x567cea[_0x834e('0x3d')]=qs['sort'](_0x58c1d7[_0x834e('0x37')][_0x834e('0x3e')]);_0x567cea['where']=qs[_0x834e('0x38')](_[_0x834e('0x3f')](_0x58c1d7['query'],_0x106d6a['filters']),_0xb5bc06);if(_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]){_0x567cea[_0x834e('0x41')]=_[_0x834e('0x42')](_0x567cea[_0x834e('0x41')],{'$or':_['map'](_0xb5bc06,function(_0x1c5ed6){if(_0x1c5ed6['type']!=='VIRTUAL'){var _0x1b2edf={};_0x1b2edf[_0x1c5ed6['name']]={'$like':'%'+_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]+'%'};return _0x1b2edf;}})});}_0x567cea=_[_0x834e('0x42')]({},_0x567cea,_0x58c1d7[_0x834e('0x43')]);var _0x2b7933={'where':_0x567cea['where']};return db[_0x834e('0x30')][_0x834e('0x20')](_0x2b7933)[_0x834e('0x28')](function(_0x58c5fb){_0x5dacc1[_0x834e('0x20')]=_0x58c5fb;if(_0x58c1d7[_0x834e('0x37')]['includeAll']){_0x567cea[_0x834e('0x44')]=[{'all':!![]}];}return db['ContactItemType'][_0x834e('0x45')](_0x567cea);})[_0x834e('0x28')](function(_0x4a18bb){_0x5dacc1['rows']=_0x4a18bb;return _0x5dacc1;})[_0x834e('0x28')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x46')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x47')]=function(_0xbc1571,_0x8ad264){var _0x23feea={'raw':!![],'where':{'id':_0xbc1571['params']['id']}},_0x195204={};_0x195204[_0x834e('0x35')]=_['keys'](db[_0x834e('0x30')]['rawAttributes']);_0x195204[_0x834e('0x37')]=_['keys'](_0xbc1571[_0x834e('0x37')]);_0x195204[_0x834e('0x38')]=_['intersection'](_0x195204[_0x834e('0x35')],_0x195204[_0x834e('0x37')]);_0x23feea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x195204[_0x834e('0x35')],qs[_0x834e('0x3b')](_0xbc1571[_0x834e('0x37')][_0x834e('0x3b')]));_0x23feea[_0x834e('0x3a')]=_0x23feea[_0x834e('0x3a')]['length']?_0x23feea[_0x834e('0x3a')]:_0x195204[_0x834e('0x35')];if(_0xbc1571['query'][_0x834e('0x48')]){_0x23feea[_0x834e('0x44')]=[{'all':!![]}];}_0x23feea=_[_0x834e('0x42')]({},_0x23feea,_0xbc1571[_0x834e('0x43')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x23feea)['then'](handleEntityNotFound(_0x8ad264,null))['then'](respondWithResult(_0x8ad264,null))[_0x834e('0x46')](handleError(_0x8ad264,null));};exports[_0x834e('0x4a')]=function(_0x30568e,_0x40ff5a){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x30568e[_0x834e('0x4b')],{})[_0x834e('0x28')](function(_0x1419eb){var _0x390c45=_0x30568e[_0x834e('0x4c')][_0x834e('0x4d')]({'plain':!![]});if(!_0x390c45)throw new Error(_0x834e('0x4e'));if(_0x390c45[_0x834e('0x4f')]===_0x834e('0x4c')){var _0x1a3855=_0x1419eb[_0x834e('0x4d')]({'plain':!![]});var _0x32b8f7=_0x834e('0x29');return db[_0x834e('0x50')]['find']({'where':{'name':_0x32b8f7,'userProfileId':_0x390c45[_0x834e('0x51')]},'raw':!![]})[_0x834e('0x28')](function(_0x4e73e0){if(_0x4e73e0&&_0x4e73e0[_0x834e('0x52')]===0x0){return db[_0x834e('0x53')]['create']({'name':_0x1a3855[_0x834e('0x2e')],'resourceId':_0x1a3855['id'],'type':_0x4e73e0[_0x834e('0x2e')],'sectionId':_0x4e73e0['id']},{})[_0x834e('0x28')](function(){return _0x1419eb;});}else{return _0x1419eb;}})[_0x834e('0x46')](function(_0x4288e4){logger[_0x834e('0x2c')](_0x834e('0x54'),_0x4288e4);throw _0x4288e4;});}return _0x1419eb;})['then'](respondWithResult(_0x40ff5a,0xc9))[_0x834e('0x46')](handleError(_0x40ff5a,null));};exports[_0x834e('0x27')]=function(_0x3e0550,_0x363675){if(_0x3e0550[_0x834e('0x4b')]['id']){delete _0x3e0550[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x3e0550['params']['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x363675,null))['then'](saveUpdates(_0x3e0550[_0x834e('0x4b')],null))['then'](respondWithResult(_0x363675,null))[_0x834e('0x46')](handleError(_0x363675,null));};exports['destroy']=function(_0x527eef,_0x6c0b29){return db[_0x834e('0x30')]['find']({'where':{'id':_0x527eef['params']['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x6c0b29,null))[_0x834e('0x28')](removeEntity(_0x6c0b29,null))[_0x834e('0x46')](handleError(_0x6c0b29,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index e5f6fcb..c368c34 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5bb=['tools_contact_item_types','lodash','util','../../config/logger','moment','bluebird','ContactItemType'];(function(_0x3d773f,_0x3462b3){var _0x22bf3a=function(_0x2d295e){while(--_0x2d295e){_0x3d773f['push'](_0x3d773f['shift']());}};_0x22bf3a(++_0x3462b3);}(_0xb5bb,0x1ba));var _0xbb5b=function(_0x1fff1f,_0x556462){_0x1fff1f=_0x1fff1f-0x0;var _0x50efb1=_0xb5bb[_0x1fff1f];return _0x50efb1;};'use strict';var _=require(_0xbb5b('0x0'));var util=require(_0xbb5b('0x1'));var logger=require(_0xbb5b('0x2'))('api');var moment=require(_0xbb5b('0x3'));var BPromise=require(_0xbb5b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module['exports']=function(_0x1c9622,_0x161047){return _0x1c9622['define'](_0xbb5b('0x5'),attributes,{'tableName':_0xbb5b('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd2e=['./contactItemType.attributes','tools_contact_item_types','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1c5c32,_0x3e6148){var _0x4abe42=function(_0x5b7723){while(--_0x5b7723){_0x1c5c32['push'](_0x1c5c32['shift']());}};_0x4abe42(++_0x3e6148);}(_0xfd2e,0x6e));var _0xefd2=function(_0x7c1b9c,_0x3c6b9d){_0x7c1b9c=_0x7c1b9c-0x0;var _0x1b4a95=_0xfd2e[_0x7c1b9c];return _0x1b4a95;};'use strict';var _=require(_0xefd2('0x0'));var util=require('util');var logger=require(_0xefd2('0x1'))('api');var moment=require(_0xefd2('0x2'));var BPromise=require('bluebird');var rp=require(_0xefd2('0x3'));var fs=require('fs');var path=require(_0xefd2('0x4'));var rimraf=require(_0xefd2('0x5'));var config=require(_0xefd2('0x6'));var attributes=require(_0xefd2('0x7'));module['exports']=function(_0x5124c6,_0x40e76c){return _0x5124c6['define']('ContactItemType',attributes,{'tableName':_0xefd2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index b79c823..25c6af2 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe130=['ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x56d33f,_0xc31fba){var _0x495730=function(_0x21fd64){while(--_0x21fd64){_0x56d33f['push'](_0x56d33f['shift']());}};_0x495730(++_0xc31fba);}(_0xe130,0x127));var _0x0e13=function(_0x324cd0,_0x11fe56){_0x324cd0=_0x324cd0-0x0;var _0x43d346=_0xe130[_0x324cd0];return _0x43d346;};'use strict';var _=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var moment=require('moment');var BPromise=require(_0x0e13('0x2'));var rs=require(_0x0e13('0x3'));var fs=require('fs');var Redis=require(_0x0e13('0x4'));var db=require(_0x0e13('0x5'))['db'];var utils=require(_0x0e13('0x6'));var logger=require('../../config/logger')(_0x0e13('0x7'));var config=require(_0x0e13('0x8'));var jayson=require(_0x0e13('0x9'));var client=jayson[_0x0e13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1774a5,_0x5f0d09,_0x567031){return new BPromise(function(_0x5aaa22,_0x2faf49){return client[_0x0e13('0xb')](_0x1774a5,_0x567031)['then'](function(_0x5d066a){logger[_0x0e13('0xc')](_0x0e13('0xd'),_0x5f0d09,_0x0e13('0xe'));logger[_0x0e13('0xf')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x5f0d09,'request\x20sent',JSON[_0x0e13('0x10')](_0x5d066a));if(_0x5d066a[_0x0e13('0x11')]){if(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x12')]===0x1f4){logger['error'](_0x0e13('0xd'),_0x5f0d09,_0x5d066a['error'][_0x0e13('0x13')]);return _0x2faf49(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);}logger[_0x0e13('0x11')](_0x0e13('0xd'),_0x5f0d09,_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);return _0x5aaa22(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);}else{logger['info'](_0x0e13('0xd'),_0x5f0d09,_0x0e13('0xe'));_0x5aaa22(_0x5d066a[_0x0e13('0x14')][_0x0e13('0x13')]);}})[_0x0e13('0x15')](function(_0x32f76a){logger['error'](_0x0e13('0xd'),_0x5f0d09,_0x32f76a);_0x2faf49(_0x32f76a);});});} \ No newline at end of file +var _0xaaa2=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird'];(function(_0x58547b,_0x51dedc){var _0x13f848=function(_0xc8514c){while(--_0xc8514c){_0x58547b['push'](_0x58547b['shift']());}};_0x13f848(++_0x51dedc);}(_0xaaa2,0xac));var _0x2aaa=function(_0x10dd93,_0x1f2095){_0x10dd93=_0x10dd93-0x0;var _0x190b74=_0xaaa2[_0x10dd93];return _0x190b74;};'use strict';var _=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var moment=require(_0x2aaa('0x2'));var BPromise=require(_0x2aaa('0x3'));var rs=require(_0x2aaa('0x4'));var fs=require('fs');var Redis=require(_0x2aaa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2aaa('0x6'));var logger=require('../../config/logger')(_0x2aaa('0x7'));var config=require(_0x2aaa('0x8'));var jayson=require(_0x2aaa('0x9'));var client=jayson[_0x2aaa('0xa')][_0x2aaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x106af9,_0x4f51e6,_0x2f16d7){return new BPromise(function(_0x514c32,_0x505fe8){return client[_0x2aaa('0xc')](_0x106af9,_0x2f16d7)['then'](function(_0x1ad6e9){logger['info']('ContactItemType,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'));logger[_0x2aaa('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'),JSON[_0x2aaa('0xf')](_0x1ad6e9));if(_0x1ad6e9[_0x2aaa('0x10')]){if(_0x1ad6e9['error'][_0x2aaa('0x11')]===0x1f4){logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);return _0x505fe8(_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);}logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);return _0x514c32(_0x1ad6e9[_0x2aaa('0x10')]['message']);}else{logger[_0x2aaa('0x14')]('ContactItemType,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'));_0x514c32(_0x1ad6e9[_0x2aaa('0x15')]['message']);}})['catch'](function(_0x50a767){logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x50a767);_0x505fe8(_0x50a767);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 49fb782..bbb8a59 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9fa8=['post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show'];(function(_0x14f1f9,_0x353fe0){var _0x3b946a=function(_0xf63844){while(--_0xf63844){_0x14f1f9['push'](_0x14f1f9['shift']());}};_0x3b946a(++_0x353fe0);}(_0x9fa8,0x103));var _0x89fa=function(_0x239b66,_0x2cd713){_0x239b66=_0x239b66-0x0;var _0x48cf81=_0x9fa8[_0x239b66];return _0x48cf81;};'use strict';var multer=require(_0x89fa('0x0'));var util=require(_0x89fa('0x1'));var path=require('path');var timeout=require(_0x89fa('0x2'));var express=require(_0x89fa('0x3'));var router=express[_0x89fa('0x4')]();var auth=require(_0x89fa('0x5'));var interaction=require(_0x89fa('0x6'));var config=require(_0x89fa('0x7'));var controller=require(_0x89fa('0x8'));router[_0x89fa('0x9')]('/',auth[_0x89fa('0xa')](),controller[_0x89fa('0xb')]);router[_0x89fa('0x9')](_0x89fa('0xc'),auth[_0x89fa('0xa')](),controller[_0x89fa('0xd')]);router[_0x89fa('0xe')]('/',auth[_0x89fa('0xa')](),controller[_0x89fa('0xf')]);router[_0x89fa('0x10')](_0x89fa('0xc'),auth[_0x89fa('0xa')](),controller[_0x89fa('0x11')]);router[_0x89fa('0x12')]('/:id',auth[_0x89fa('0xa')](),controller[_0x89fa('0x13')]);module[_0x89fa('0x14')]=router; \ No newline at end of file +var _0xdabf=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','post','create','/:id','update','destroy','multer','util','path','express'];(function(_0x3fc4ef,_0x57e071){var _0x20d7e2=function(_0x231af4){while(--_0x231af4){_0x3fc4ef['push'](_0x3fc4ef['shift']());}};_0x20d7e2(++_0x57e071);}(_0xdabf,0x1c7));var _0xfdab=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xdabf[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0xfdab('0x0'));var util=require(_0xfdab('0x1'));var path=require(_0xfdab('0x2'));var timeout=require('connect-timeout');var express=require(_0xfdab('0x3'));var router=express[_0xfdab('0x4')]();var auth=require(_0xfdab('0x5'));var interaction=require(_0xfdab('0x6'));var config=require(_0xfdab('0x7'));var controller=require(_0xfdab('0x8'));router[_0xfdab('0x9')]('/',auth[_0xfdab('0xa')](),controller[_0xfdab('0xb')]);router['get']('/:id',auth[_0xfdab('0xa')](),controller['show']);router[_0xfdab('0xc')]('/',auth[_0xfdab('0xa')](),controller[_0xfdab('0xd')]);router['put'](_0xfdab('0xe'),auth[_0xfdab('0xa')](),controller[_0xfdab('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xfdab('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 4edbfa9..c156dc0 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 _0xb30f=['name','sequelize','exports','STRING'];(function(_0x3bce02,_0x3f7d7a){var _0x306140=function(_0x3eb4ec){while(--_0x3eb4ec){_0x3bce02['push'](_0x3bce02['shift']());}};_0x306140(++_0x3f7d7a);}(_0xb30f,0x109));var _0xfb30=function(_0x56344e,_0x44e5b2){_0x56344e=_0x56344e-0x0;var _0x4bbea1=_0xb30f[_0x56344e];return _0x4bbea1;};'use strict';var Sequelize=require(_0xfb30('0x0'));module[_0xfb30('0x1')]={'name':{'type':Sequelize[_0xfb30('0x2')],'allowNull':![],'unique':_0xfb30('0x3')},'description':{'type':Sequelize[_0xfb30('0x2')]}}; \ No newline at end of file +var _0xef17=['STRING','name','sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xef17,0x136));var _0x7ef1=function(_0x394ae9,_0x34bdd6){_0x394ae9=_0x394ae9-0x0;var _0x3b7586=_0xef17[_0x394ae9];return _0x3b7586;};'use strict';var Sequelize=require(_0x7ef1('0x0'));module[_0x7ef1('0x1')]={'name':{'type':Sequelize[_0x7ef1('0x2')],'allowNull':![],'unique':_0x7ef1('0x3')},'description':{'type':Sequelize[_0x7ef1('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 6b0805e..73654a1 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 _0x1c18=['then','destroy','CustomDashboards','UserProfileResource','error','stack','name','send','Dashboard','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','user','role','get','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x4c3c5e,_0x555c8d){var _0x4ee436=function(_0x2be2b9){while(--_0x2be2b9){_0x4c3c5e['push'](_0x4c3c5e['shift']());}};_0x4ee436(++_0x555c8d);}(_0x1c18,0x147));var _0x81c1=function(_0x9dd37c,_0x3e255e){_0x9dd37c=_0x9dd37c-0x0;var _0x2a522c=_0x1c18[_0x9dd37c];return _0x2a522c;};'use strict';var pdf=require(_0x81c1('0x0'));var emlformat=require(_0x81c1('0x1'));var rimraf=require(_0x81c1('0x2'));var zipdir=require(_0x81c1('0x3'));var jsonpatch=require(_0x81c1('0x4'));var rp=require(_0x81c1('0x5'));var moment=require(_0x81c1('0x6'));var BPromise=require(_0x81c1('0x7'));var Mustache=require(_0x81c1('0x8'));var util=require(_0x81c1('0x9'));var path=require(_0x81c1('0xa'));var sox=require(_0x81c1('0xb'));var csv=require(_0x81c1('0xc'));var ejs=require(_0x81c1('0xd'));var fs=require('fs');var _=require(_0x81c1('0xe'));var squel=require(_0x81c1('0xf'));var crypto=require(_0x81c1('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x81c1('0x11'));var toCsv=require(_0x81c1('0xc'));var querystring=require('querystring');var Papa=require(_0x81c1('0x12'));var Redis=require(_0x81c1('0x13'));var authService=require(_0x81c1('0x14'));var qs=require(_0x81c1('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x81c1('0x16'));var logger=require(_0x81c1('0x17'))(_0x81c1('0x18'));var utils=require(_0x81c1('0x19'));var config=require(_0x81c1('0x1a'));var db=require('../../mysqldb')['db'];config[_0x81c1('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x81c1('0x1b')]));require('./dashboard.socket')[_0x81c1('0x1c')](socket);function respondWithStatusCode(_0x450255,_0x3c4d75){_0x3c4d75=_0x3c4d75||0xcc;return function(_0xd69ebd){if(_0xd69ebd){return _0x450255[_0x81c1('0x1d')](_0x3c4d75);}return _0x450255['status'](_0x3c4d75)[_0x81c1('0x1e')]();};}function respondWithResult(_0x222c19,_0x408c8b){_0x408c8b=_0x408c8b||0xc8;return function(_0x3a030e){if(_0x3a030e){return _0x222c19[_0x81c1('0x1f')](_0x408c8b)[_0x81c1('0x20')](_0x3a030e);}};}function respondWithFilteredResult(_0x3b81ec,_0x4ec8be){return function(_0x445d08){if(_0x445d08){var _0x91228c=_0x445d08[_0x81c1('0x21')],_0x198452=_0x4ec8be['offset'],_0x4bfdd2=_0x4ec8be[_0x81c1('0x22')]+_0x4ec8be[_0x81c1('0x23')],_0x14ed88;if(_0x4bfdd2>=_0x91228c){_0x4bfdd2=_0x91228c;_0x14ed88=0xc8;}else{_0x14ed88=0xce;}_0x3b81ec[_0x81c1('0x1f')](_0x14ed88);return _0x3b81ec[_0x81c1('0x24')](_0x81c1('0x25'),_0x198452+'-'+_0x4bfdd2+'/'+_0x91228c)[_0x81c1('0x20')](_0x445d08);}return null;};}function patchUpdates(_0x2f2adb){return function(_0x17d958){try{jsonpatch[_0x81c1('0x26')](_0x17d958,_0x2f2adb,!![]);}catch(_0x213d1d){return BPromise[_0x81c1('0x27')](_0x213d1d);}return _0x17d958[_0x81c1('0x28')]();};}function saveUpdates(_0x45a8bc,_0x559ebf){return function(_0x1ab48f){if(_0x1ab48f){return _0x1ab48f[_0x81c1('0x29')](_0x45a8bc)[_0x81c1('0x2a')](function(_0x2ab4b1){return _0x2ab4b1;});}return null;};}function removeEntity(_0x1a6beb,_0x5a71af){return function(_0x135de7){if(_0x135de7){return _0x135de7[_0x81c1('0x2b')]()[_0x81c1('0x2a')](function(){var _0xe259a1=_0x135de7['get']({'plain':!![]});var _0x15e30e=_0x81c1('0x2c');return db[_0x81c1('0x2d')][_0x81c1('0x2b')]({'where':{'type':_0x15e30e,'resourceId':_0xe259a1['id']}})[_0x81c1('0x2a')](function(){return _0x135de7;});})[_0x81c1('0x2a')](function(){_0x1a6beb[_0x81c1('0x1f')](0xcc)[_0x81c1('0x1e')]();});}};}function handleEntityNotFound(_0x268de4,_0x5f080d){return function(_0x325374){if(!_0x325374){_0x268de4[_0x81c1('0x1d')](0x194);}return _0x325374;};}function handleError(_0x70d307,_0x90f05e){_0x90f05e=_0x90f05e||0x1f4;return function(_0x41c191){logger[_0x81c1('0x2e')](_0x41c191[_0x81c1('0x2f')]);if(_0x41c191[_0x81c1('0x30')]){delete _0x41c191['name'];}_0x70d307[_0x81c1('0x1f')](_0x90f05e)[_0x81c1('0x31')](_0x41c191);};}exports['index']=function(_0x4e100a,_0x3865d8){var _0x553c6a={},_0x4bb1f5={},_0x472dd8={'count':0x0,'rows':[]};var _0x36c6ef=_['map'](db[_0x81c1('0x32')][_0x81c1('0x33')],function(_0x3acb5b){return{'name':_0x3acb5b[_0x81c1('0x34')],'type':_0x3acb5b[_0x81c1('0x35')]['key']};});_0x4bb1f5[_0x81c1('0x36')]=_[_0x81c1('0x37')](_0x36c6ef,_0x81c1('0x30'));_0x4bb1f5[_0x81c1('0x38')]=_['keys'](_0x4e100a['query']);_0x4bb1f5[_0x81c1('0x39')]=_[_0x81c1('0x3a')](_0x4bb1f5[_0x81c1('0x36')],_0x4bb1f5[_0x81c1('0x38')]);_0x553c6a[_0x81c1('0x3b')]=_['intersection'](_0x4bb1f5['model'],qs[_0x81c1('0x3c')](_0x4e100a[_0x81c1('0x38')][_0x81c1('0x3c')]));_0x553c6a[_0x81c1('0x3b')]=_0x553c6a['attributes'][_0x81c1('0x3d')]?_0x553c6a[_0x81c1('0x3b')]:_0x4bb1f5[_0x81c1('0x36')];if(!_0x4e100a[_0x81c1('0x38')][_0x81c1('0x3e')](_0x81c1('0x3f'))){_0x553c6a['limit']=qs[_0x81c1('0x23')](_0x4e100a[_0x81c1('0x38')][_0x81c1('0x23')]);_0x553c6a[_0x81c1('0x22')]=qs[_0x81c1('0x22')](_0x4e100a[_0x81c1('0x38')][_0x81c1('0x22')]);}_0x553c6a['order']=qs[_0x81c1('0x40')](_0x4e100a['query']['sort']);_0x553c6a[_0x81c1('0x41')]=qs['filters'](_[_0x81c1('0x42')](_0x4e100a['query'],_0x4bb1f5[_0x81c1('0x39')]),_0x36c6ef);if(_0x4e100a[_0x81c1('0x38')]['filter']){_0x553c6a[_0x81c1('0x41')]=_[_0x81c1('0x43')](_0x553c6a[_0x81c1('0x41')],{'$or':_['map'](_0x36c6ef,function(_0x2e94e2){if(_0x2e94e2[_0x81c1('0x35')]!==_0x81c1('0x44')){var _0x16e7a2={};_0x16e7a2[_0x2e94e2[_0x81c1('0x30')]]={'$like':'%'+_0x4e100a['query'][_0x81c1('0x45')]+'%'};return _0x16e7a2;}})});}_0x553c6a=_[_0x81c1('0x43')]({},_0x553c6a,_0x4e100a['options']);var _0x4e1f06={'where':_0x553c6a[_0x81c1('0x41')]};return db[_0x81c1('0x32')][_0x81c1('0x21')](_0x4e1f06)[_0x81c1('0x2a')](function(_0x540bae){_0x472dd8['count']=_0x540bae;if(_0x4e100a[_0x81c1('0x38')][_0x81c1('0x46')]){_0x553c6a[_0x81c1('0x47')]=[{'all':!![]}];}return db[_0x81c1('0x32')][_0x81c1('0x48')](_0x553c6a);})[_0x81c1('0x2a')](function(_0x2a9ee2){_0x472dd8[_0x81c1('0x49')]=_0x2a9ee2;return _0x472dd8;})['then'](respondWithFilteredResult(_0x3865d8,_0x553c6a))[_0x81c1('0x4a')](handleError(_0x3865d8,null));};exports[_0x81c1('0x4b')]=function(_0x3031fd,_0x2d70d6){var _0x58cbfb={'raw':![],'where':{'id':_0x3031fd[_0x81c1('0x4c')]['id']}},_0x5eaf86={};_0x5eaf86['model']=_[_0x81c1('0x4d')](db[_0x81c1('0x32')][_0x81c1('0x33')]);_0x5eaf86[_0x81c1('0x38')]=_[_0x81c1('0x4d')](_0x3031fd['query']);_0x5eaf86[_0x81c1('0x39')]=_[_0x81c1('0x3a')](_0x5eaf86[_0x81c1('0x36')],_0x5eaf86[_0x81c1('0x38')]);_0x58cbfb['attributes']=_[_0x81c1('0x3a')](_0x5eaf86[_0x81c1('0x36')],qs[_0x81c1('0x3c')](_0x3031fd['query'][_0x81c1('0x3c')]));_0x58cbfb[_0x81c1('0x3b')]=_0x58cbfb[_0x81c1('0x3b')][_0x81c1('0x3d')]?_0x58cbfb[_0x81c1('0x3b')]:_0x5eaf86[_0x81c1('0x36')];if(_0x3031fd[_0x81c1('0x38')]['includeAll']){_0x58cbfb[_0x81c1('0x47')]=[{'all':!![]}];}_0x58cbfb=_[_0x81c1('0x43')]({},_0x58cbfb,_0x3031fd[_0x81c1('0x4e')]);return db[_0x81c1('0x32')]['find'](_0x58cbfb)['then'](handleEntityNotFound(_0x2d70d6,null))[_0x81c1('0x2a')](respondWithResult(_0x2d70d6,null))['catch'](handleError(_0x2d70d6,null));};exports[_0x81c1('0x4f')]=function(_0x56a001,_0x2a5218){return db['Dashboard'][_0x81c1('0x4f')](_0x56a001[_0x81c1('0x50')],{})['then'](function(_0x5a9fd2){var _0x1e43bc=_0x56a001[_0x81c1('0x51')]['get']({'plain':!![]});if(!_0x1e43bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e43bc[_0x81c1('0x52')]===_0x81c1('0x51')){var _0x14f017=_0x5a9fd2[_0x81c1('0x53')]({'plain':!![]});var _0x537cd0=_0x81c1('0x2c');return db[_0x81c1('0x54')][_0x81c1('0x55')]({'where':{'name':_0x537cd0,'userProfileId':_0x1e43bc[_0x81c1('0x56')]},'raw':!![]})[_0x81c1('0x2a')](function(_0x18349a){if(_0x18349a&&_0x18349a['autoAssociation']===0x0){return db['UserProfileResource'][_0x81c1('0x4f')]({'name':_0x14f017[_0x81c1('0x30')],'resourceId':_0x14f017['id'],'type':_0x18349a[_0x81c1('0x30')],'sectionId':_0x18349a['id']},{})[_0x81c1('0x2a')](function(){return _0x5a9fd2;});}else{return _0x5a9fd2;}})[_0x81c1('0x4a')](function(_0x525a08){logger[_0x81c1('0x2e')](_0x81c1('0x57'),_0x525a08);throw _0x525a08;});}return _0x5a9fd2;})['then'](respondWithResult(_0x2a5218,0xc9))[_0x81c1('0x4a')](handleError(_0x2a5218,null));};exports[_0x81c1('0x58')]=function(_0x13a048,_0x2f316c){var _0x5a34c6={'where':{'id':_0x13a048[_0x81c1('0x4c')]['id']}},_0xdaed63={};_0xdaed63[_0x81c1('0x36')]=_[_0x81c1('0x4d')](db[_0x81c1('0x32')][_0x81c1('0x33')]);_0x5a34c6[_0x81c1('0x3b')]=_[_0x81c1('0x3a')](_0xdaed63['model'],qs[_0x81c1('0x3c')](_0x13a048[_0x81c1('0x38')][_0x81c1('0x3c')]));_0x5a34c6[_0x81c1('0x3b')]=_0x5a34c6['attributes'][_0x81c1('0x3d')]?_0x5a34c6[_0x81c1('0x3b')]:_0xdaed63[_0x81c1('0x36')];if(_0x13a048[_0x81c1('0x38')][_0x81c1('0x46')]){_0x5a34c6[_0x81c1('0x47')]=[{'all':!![]}];}_0x5a34c6=_[_0x81c1('0x43')]({},_0x5a34c6,_0x13a048[_0x81c1('0x4e')]);return db['Dashboard']['find'](_0x5a34c6)[_0x81c1('0x2a')](handleEntityNotFound(_0x2f316c,null))['then'](function(_0x11fc95){if(_0x11fc95){var _0x321d16=_0x11fc95['get']({'plain':!![]});_0x321d16=qs[_0x81c1('0x59')](_0x321d16,['id',_0x81c1('0x5a'),_0x81c1('0x5b')]);_0x13a048[_0x81c1('0x50')]=_[_0x81c1('0x59')](_0x13a048[_0x81c1('0x50')],['id',_0x81c1('0x5a'),_0x81c1('0x5b')]);return db[_0x81c1('0x32')][_0x81c1('0x4f')](_[_0x81c1('0x43')](_0x321d16,_0x13a048[_0x81c1('0x50')]),{'include':_0x13a048[_0x81c1('0x38')][_0x81c1('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x32d720){var _0x362f67=_0x13a048[_0x81c1('0x51')][_0x81c1('0x53')]({'plain':!![]});if(!_0x362f67)throw new Error(_0x81c1('0x5c'));if(_0x362f67[_0x81c1('0x52')]===_0x81c1('0x51')){var _0xcb9d9=_0x32d720[_0x81c1('0x53')]({'plain':!![]});var _0x5fb0ef=_0x81c1('0x2c');return db[_0x81c1('0x54')]['find']({'where':{'name':_0x5fb0ef,'userProfileId':_0x362f67[_0x81c1('0x56')]},'raw':!![]})[_0x81c1('0x2a')](function(_0x5abb9f){if(_0x5abb9f&&_0x5abb9f[_0x81c1('0x5d')]===0x0){return db['UserProfileResource'][_0x81c1('0x4f')]({'name':_0xcb9d9[_0x81c1('0x30')],'resourceId':_0xcb9d9['id'],'type':_0x5abb9f['name'],'sectionId':_0x5abb9f['id']},{})['then'](function(){return _0x32d720;});}else{return _0x32d720;}})[_0x81c1('0x4a')](function(_0x221818){logger['error'](_0x81c1('0x57'),_0x221818);throw _0x221818;});}return _0x32d720;});}})[_0x81c1('0x2a')](respondWithResult(_0x2f316c,0xc9))[_0x81c1('0x4a')](handleError(_0x2f316c,null));};exports[_0x81c1('0x29')]=function(_0x4a7645,_0x5edf3c){if(_0x4a7645[_0x81c1('0x50')]['id']){delete _0x4a7645['body']['id'];}return db['Dashboard'][_0x81c1('0x55')]({'where':{'id':_0x4a7645[_0x81c1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5edf3c,null))[_0x81c1('0x2a')](saveUpdates(_0x4a7645[_0x81c1('0x50')],null))[_0x81c1('0x2a')](respondWithResult(_0x5edf3c,null))[_0x81c1('0x4a')](handleError(_0x5edf3c,null));};exports[_0x81c1('0x2b')]=function(_0x57d29f,_0x539250){return db[_0x81c1('0x32')][_0x81c1('0x55')]({'where':{'id':_0x57d29f[_0x81c1('0x4c')]['id']}})[_0x81c1('0x2a')](handleEntityNotFound(_0x539250,null))[_0x81c1('0x2a')](removeEntity(_0x539250,null))[_0x81c1('0x4a')](handleError(_0x539250,null));};function widgetAttributes(_0x3c0c87){try{switch(_0x3c0c87[_0x81c1('0x35')]){case'iframe':return[{'name':_0x81c1('0x5e'),'value':_0x3c0c87['attrUrl']||(_0x3c0c87[_0x81c1('0x5f')]&&_0x3c0c87['attrs'][0x0]?_0x3c0c87[_0x81c1('0x5f')][0x0]['value']:undefined)||_0x81c1('0x60')}];case _0x81c1('0x61'):return[{'name':_0x81c1('0x62'),'value':_0x3c0c87[_0x81c1('0x62')]||(_0x3c0c87['attrs']&&_0x3c0c87[_0x81c1('0x5f')][0x0]?_0x3c0c87[_0x81c1('0x5f')][0x0][_0x81c1('0x63')]:undefined)||''}];case _0x81c1('0x64'):return[{'name':_0x81c1('0x65'),'value':_0x3c0c87[_0x81c1('0x65')]||(_0x3c0c87[_0x81c1('0x5f')]&&_0x3c0c87[_0x81c1('0x5f')][0x0]?_0x3c0c87[_0x81c1('0x5f')][0x0][_0x81c1('0x63')]:undefined)||_0x81c1('0x66')},{'name':_0x81c1('0x67'),'value':_0x3c0c87[_0x81c1('0x67')]||(_0x3c0c87[_0x81c1('0x5f')]&&_0x3c0c87['attrs'][0x1]?_0x3c0c87[_0x81c1('0x5f')][0x1][_0x81c1('0x63')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x3c0c87[_0x81c1('0x68')]||(_0x3c0c87['attrs']&&_0x3c0c87['attrs'][0x2]?_0x3c0c87[_0x81c1('0x5f')][0x2][_0x81c1('0x63')]:undefined)||0xc}];case _0x81c1('0x69'):return[{'name':_0x81c1('0x6a'),'value':_0x3c0c87[_0x81c1('0x6a')]||(_0x3c0c87[_0x81c1('0x5f')]&&_0x3c0c87[_0x81c1('0x5f')][0x0]?_0x3c0c87[_0x81c1('0x5f')][0x0]['value']:undefined)||'total'},{'name':_0x81c1('0x6b'),'value':_0x3c0c87['attrVoiceQueues']||(_0x3c0c87[_0x81c1('0x5f')]&&_0x3c0c87[_0x81c1('0x5f')][0x1]?_0x3c0c87[_0x81c1('0x5f')][0x1]['value']:undefined)||[]},{'name':_0x81c1('0x68'),'value':_0x3c0c87[_0x81c1('0x68')]||(_0x3c0c87[_0x81c1('0x5f')]&&_0x3c0c87[_0x81c1('0x5f')][0x2]?_0x3c0c87[_0x81c1('0x5f')][0x2]['value']:undefined)||0x14}];case _0x81c1('0x6c'):case _0x81c1('0x6d'):return[{'name':_0x81c1('0x6e'),'value':_0x3c0c87[_0x81c1('0x6e')]||(_0x3c0c87['attrs']&&_0x3c0c87[_0x81c1('0x5f')][0x0]?_0x3c0c87[_0x81c1('0x5f')][0x0][_0x81c1('0x63')]:undefined)||_0x81c1('0x6f')},{'name':_0x81c1('0x70'),'value':_0x3c0c87[_0x81c1('0x70')]||(_0x3c0c87['attrs']&&_0x3c0c87[_0x81c1('0x5f')][0x1]?_0x3c0c87[_0x81c1('0x5f')][0x1]['value']:undefined)||null},{'name':_0x81c1('0x71'),'value':_0x3c0c87['attrSerie3']||(_0x3c0c87[_0x81c1('0x5f')]&&_0x3c0c87[_0x81c1('0x5f')][0x2]?_0x3c0c87[_0x81c1('0x5f')][0x2]['value']:undefined)||null},{'name':_0x81c1('0x6b'),'value':_0x3c0c87[_0x81c1('0x6b')]||(_0x3c0c87[_0x81c1('0x5f')]&&_0x3c0c87[_0x81c1('0x5f')][0x3]?_0x3c0c87[_0x81c1('0x5f')][0x3][_0x81c1('0x63')]:undefined)||[]}];case'web-report':return[{'name':_0x81c1('0x72'),'type':_0x3c0c87[_0x81c1('0x73')]||(_0x3c0c87['attrs']&&_0x3c0c87[_0x81c1('0x5f')][0x0]?_0x3c0c87['attrs'][0x0]['type']:undefined)||null,'value':_0x3c0c87[_0x81c1('0x72')]||(_0x3c0c87[_0x81c1('0x5f')]&&_0x3c0c87[_0x81c1('0x5f')][0x0]?_0x3c0c87['attrs'][0x0][_0x81c1('0x63')]:undefined)||null},{'name':'attrRefresh','value':_0x3c0c87[_0x81c1('0x74')]||(_0x3c0c87[_0x81c1('0x5f')]&&_0x3c0c87['attrs'][0x1]?_0x3c0c87[_0x81c1('0x5f')][0x1][_0x81c1('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x3f31fe){logger[_0x81c1('0x2e')](_0x81c1('0x75'),JSON[_0x81c1('0x76')](_0x3f31fe));return[];}}exports[_0x81c1('0x77')]=function(_0x3b2b25,_0x5d6bfa,_0x59676c){if(_0x3b2b25[_0x81c1('0x50')]['id']){delete _0x3b2b25[_0x81c1('0x50')]['id'];}return db[_0x81c1('0x32')]['find']({'where':{'id':_0x3b2b25[_0x81c1('0x4c')]['id']}})[_0x81c1('0x2a')](handleEntityNotFound(_0x5d6bfa,null))['then'](function(_0x248f00){if(_0x248f00){_0x3b2b25[_0x81c1('0x50')][_0x81c1('0x78')]=_0x248f00['id'];_0x3b2b25[_0x81c1('0x50')]['attrs']=widgetAttributes(_0x3b2b25[_0x81c1('0x50')]);return db['DashboardItem'][_0x81c1('0x4f')](_0x3b2b25[_0x81c1('0x50')]);}})[_0x81c1('0x2a')](respondWithResult(_0x5d6bfa,null))[_0x81c1('0x4a')](handleError(_0x5d6bfa,null));};exports[_0x81c1('0x79')]=function(_0x22a43e,_0x5079ab,_0x37913d){var _0x5f47a1={};var _0x25d538={};var _0x13428c;var _0x326bc4;return db['Dashboard'][_0x81c1('0x7a')]({'where':{'id':_0x22a43e[_0x81c1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5079ab,null))[_0x81c1('0x2a')](function(_0x5cbd6b){if(_0x5cbd6b){_0x13428c=_0x5cbd6b;_0x25d538[_0x81c1('0x36')]=_[_0x81c1('0x4d')](db['DashboardItem'][_0x81c1('0x33')]);_0x25d538[_0x81c1('0x38')]=_['keys'](_0x22a43e[_0x81c1('0x38')]);_0x25d538[_0x81c1('0x39')]=_[_0x81c1('0x3a')](_0x25d538[_0x81c1('0x36')],_0x25d538[_0x81c1('0x38')]);_0x5f47a1[_0x81c1('0x3b')]=_[_0x81c1('0x3a')](_0x25d538[_0x81c1('0x36')],qs[_0x81c1('0x3c')](_0x22a43e[_0x81c1('0x38')]['fields']));_0x5f47a1[_0x81c1('0x3b')]=_0x5f47a1['attributes'][_0x81c1('0x3d')]?_0x5f47a1[_0x81c1('0x3b')]:_0x25d538['model'];_0x5f47a1['order']=qs['sort'](_0x22a43e[_0x81c1('0x38')][_0x81c1('0x40')]);_0x5f47a1['where']=qs[_0x81c1('0x39')](_['pick'](_0x22a43e[_0x81c1('0x38')],_0x25d538['filters']));if(_0x22a43e[_0x81c1('0x38')][_0x81c1('0x45')]){_0x5f47a1[_0x81c1('0x41')]=_['merge'](_0x5f47a1[_0x81c1('0x41')],{'$or':_['map'](_0x5f47a1[_0x81c1('0x3b')],function(_0x47f60e){var _0x30f3fe={};_0x30f3fe[_0x47f60e]={'$like':'%'+_0x22a43e[_0x81c1('0x38')]['filter']+'%'};return _0x30f3fe;})});}_0x5f47a1=_['merge']({},_0x5f47a1,_0x22a43e[_0x81c1('0x4e')]);return _0x13428c[_0x81c1('0x79')](_0x5f47a1);}})[_0x81c1('0x2a')](function(_0x22aff2){if(_0x22aff2){_0x326bc4=_0x22aff2[_0x81c1('0x3d')];if(!_0x22a43e[_0x81c1('0x38')][_0x81c1('0x3e')](_0x81c1('0x3f'))){_0x5f47a1[_0x81c1('0x23')]=qs['limit'](_0x22a43e[_0x81c1('0x38')][_0x81c1('0x23')]);_0x5f47a1['offset']=qs[_0x81c1('0x22')](_0x22a43e[_0x81c1('0x38')][_0x81c1('0x22')]);}return _0x13428c['getItems'](_0x5f47a1);}})[_0x81c1('0x2a')](function(_0x1a49c5){if(_0x1a49c5){return _0x1a49c5?{'count':_0x326bc4,'rows':_0x1a49c5}:null;}})[_0x81c1('0x2a')](respondWithResult(_0x5079ab,null))[_0x81c1('0x4a')](handleError(_0x5079ab,null));}; \ No newline at end of file +var _0x69d8=['options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','updatedAt','omit','createdAt','CustomDashboards','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','getItems','findOne','DashboardItem','pick','nolimit','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/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','count','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','query','intersection','fields','attributes','hasOwnProperty','offset','sort','where','filter','VIRTUAL','merge','include','Dashboard','rows','catch','show','params','length'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x69d8,0x19c));var _0x869d=function(_0xf2992b,_0x8c0d4c){_0xf2992b=_0xf2992b-0x0;var _0x2e8306=_0x69d8[_0xf2992b];return _0x2e8306;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x869d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x869d('0x1'));var jsonpatch=require(_0x869d('0x2'));var rp=require(_0x869d('0x3'));var moment=require(_0x869d('0x4'));var BPromise=require(_0x869d('0x5'));var Mustache=require(_0x869d('0x6'));var util=require(_0x869d('0x7'));var path=require(_0x869d('0x8'));var sox=require(_0x869d('0x9'));var csv=require(_0x869d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x869d('0xb'));var squel=require(_0x869d('0xc'));var crypto=require(_0x869d('0xd'));var jsforce=require(_0x869d('0xe'));var deskjs=require(_0x869d('0xf'));var toCsv=require(_0x869d('0xa'));var querystring=require('querystring');var Papa=require(_0x869d('0x10'));var Redis=require(_0x869d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x869d('0x12'));var hardwareService=require(_0x869d('0x13'));var logger=require(_0x869d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x869d('0x15'));var db=require('../../mysqldb')['db'];config[_0x869d('0x16')]=_[_0x869d('0x17')](config[_0x869d('0x16')],{'host':_0x869d('0x18'),'port':0x18eb});var socket=require(_0x869d('0x19'))(new Redis(config[_0x869d('0x16')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x1fcf1b,_0x53bb0e){_0x53bb0e=_0x53bb0e||0xcc;return function(_0x5b9adc){if(_0x5b9adc){return _0x1fcf1b[_0x869d('0x1a')](_0x53bb0e);}return _0x1fcf1b[_0x869d('0x1b')](_0x53bb0e)[_0x869d('0x1c')]();};}function respondWithResult(_0x14b678,_0x27d5d6){_0x27d5d6=_0x27d5d6||0xc8;return function(_0x5d3a30){if(_0x5d3a30){return _0x14b678[_0x869d('0x1b')](_0x27d5d6)[_0x869d('0x1d')](_0x5d3a30);}};}function respondWithFilteredResult(_0x63ea6f,_0x1a1b54){return function(_0x4865d2){if(_0x4865d2){var _0x4fe5ec=_0x4865d2[_0x869d('0x1e')],_0x19889e=_0x1a1b54['offset'],_0x5514b2=_0x1a1b54['offset']+_0x1a1b54[_0x869d('0x1f')],_0x340cd9;if(_0x5514b2>=_0x4fe5ec){_0x5514b2=_0x4fe5ec;_0x340cd9=0xc8;}else{_0x340cd9=0xce;}_0x63ea6f[_0x869d('0x1b')](_0x340cd9);return _0x63ea6f[_0x869d('0x20')](_0x869d('0x21'),_0x19889e+'-'+_0x5514b2+'/'+_0x4fe5ec)['json'](_0x4865d2);}return null;};}function patchUpdates(_0x402155){return function(_0x2ccf92){try{jsonpatch['apply'](_0x2ccf92,_0x402155,!![]);}catch(_0x8dd922){return BPromise['reject'](_0x8dd922);}return _0x2ccf92[_0x869d('0x22')]();};}function saveUpdates(_0x9e80f3,_0x4cb4b9){return function(_0x13d323){if(_0x13d323){return _0x13d323[_0x869d('0x23')](_0x9e80f3)[_0x869d('0x24')](function(_0x283ac){return _0x283ac;});}return null;};}function removeEntity(_0x245fb8,_0x70ce62){return function(_0x28c4e8){if(_0x28c4e8){return _0x28c4e8[_0x869d('0x25')]()[_0x869d('0x24')](function(){var _0x207df4=_0x28c4e8['get']({'plain':!![]});var _0x404398='CustomDashboards';return db['UserProfileResource'][_0x869d('0x25')]({'where':{'type':_0x404398,'resourceId':_0x207df4['id']}})[_0x869d('0x24')](function(){return _0x28c4e8;});})[_0x869d('0x24')](function(){_0x245fb8['status'](0xcc)[_0x869d('0x1c')]();});}};}function handleEntityNotFound(_0x33c6b1,_0x23afef){return function(_0x3b0cc5){if(!_0x3b0cc5){_0x33c6b1['sendStatus'](0x194);}return _0x3b0cc5;};}function handleError(_0x14267d,_0x3f5b94){_0x3f5b94=_0x3f5b94||0x1f4;return function(_0x55b6f8){logger[_0x869d('0x26')](_0x55b6f8[_0x869d('0x27')]);if(_0x55b6f8[_0x869d('0x28')]){delete _0x55b6f8[_0x869d('0x28')];}_0x14267d['status'](_0x3f5b94)[_0x869d('0x29')](_0x55b6f8);};}exports[_0x869d('0x2a')]=function(_0x90e276,_0x7552cf){var _0x176f38={},_0x450a55={},_0xc21a2={'count':0x0,'rows':[]};var _0x2436d8=_[_0x869d('0x2b')](db['Dashboard'][_0x869d('0x2c')],function(_0x209c81){return{'name':_0x209c81[_0x869d('0x2d')],'type':_0x209c81[_0x869d('0x2e')]['key']};});_0x450a55[_0x869d('0x2f')]=_[_0x869d('0x2b')](_0x2436d8,_0x869d('0x28'));_0x450a55['query']=_[_0x869d('0x30')](_0x90e276['query']);_0x450a55[_0x869d('0x31')]=_['intersection'](_0x450a55[_0x869d('0x2f')],_0x450a55[_0x869d('0x32')]);_0x176f38['attributes']=_[_0x869d('0x33')](_0x450a55[_0x869d('0x2f')],qs[_0x869d('0x34')](_0x90e276['query'][_0x869d('0x34')]));_0x176f38[_0x869d('0x35')]=_0x176f38['attributes']['length']?_0x176f38[_0x869d('0x35')]:_0x450a55[_0x869d('0x2f')];if(!_0x90e276[_0x869d('0x32')][_0x869d('0x36')]('nolimit')){_0x176f38[_0x869d('0x1f')]=qs[_0x869d('0x1f')](_0x90e276[_0x869d('0x32')][_0x869d('0x1f')]);_0x176f38['offset']=qs['offset'](_0x90e276[_0x869d('0x32')][_0x869d('0x37')]);}_0x176f38['order']=qs[_0x869d('0x38')](_0x90e276[_0x869d('0x32')]['sort']);_0x176f38[_0x869d('0x39')]=qs['filters'](_['pick'](_0x90e276['query'],_0x450a55[_0x869d('0x31')]),_0x2436d8);if(_0x90e276[_0x869d('0x32')][_0x869d('0x3a')]){_0x176f38[_0x869d('0x39')]=_['merge'](_0x176f38['where'],{'$or':_['map'](_0x2436d8,function(_0x92f5d9){if(_0x92f5d9[_0x869d('0x2e')]!==_0x869d('0x3b')){var _0x3f8f42={};_0x3f8f42[_0x92f5d9[_0x869d('0x28')]]={'$like':'%'+_0x90e276[_0x869d('0x32')][_0x869d('0x3a')]+'%'};return _0x3f8f42;}})});}_0x176f38=_[_0x869d('0x3c')]({},_0x176f38,_0x90e276['options']);var _0x3a3a3b={'where':_0x176f38[_0x869d('0x39')]};return db['Dashboard']['count'](_0x3a3a3b)[_0x869d('0x24')](function(_0x299432){_0xc21a2['count']=_0x299432;if(_0x90e276[_0x869d('0x32')]['includeAll']){_0x176f38[_0x869d('0x3d')]=[{'all':!![]}];}return db[_0x869d('0x3e')]['findAll'](_0x176f38);})[_0x869d('0x24')](function(_0x5cb59c){_0xc21a2[_0x869d('0x3f')]=_0x5cb59c;return _0xc21a2;})[_0x869d('0x24')](respondWithFilteredResult(_0x7552cf,_0x176f38))[_0x869d('0x40')](handleError(_0x7552cf,null));};exports[_0x869d('0x41')]=function(_0x162e7f,_0x4ea410){var _0x501b23={'raw':![],'where':{'id':_0x162e7f[_0x869d('0x42')]['id']}},_0x12d394={};_0x12d394[_0x869d('0x2f')]=_[_0x869d('0x30')](db['Dashboard'][_0x869d('0x2c')]);_0x12d394[_0x869d('0x32')]=_[_0x869d('0x30')](_0x162e7f['query']);_0x12d394[_0x869d('0x31')]=_[_0x869d('0x33')](_0x12d394[_0x869d('0x2f')],_0x12d394[_0x869d('0x32')]);_0x501b23[_0x869d('0x35')]=_['intersection'](_0x12d394[_0x869d('0x2f')],qs[_0x869d('0x34')](_0x162e7f[_0x869d('0x32')][_0x869d('0x34')]));_0x501b23['attributes']=_0x501b23[_0x869d('0x35')][_0x869d('0x43')]?_0x501b23[_0x869d('0x35')]:_0x12d394[_0x869d('0x2f')];if(_0x162e7f['query']['includeAll']){_0x501b23[_0x869d('0x3d')]=[{'all':!![]}];}_0x501b23=_['merge']({},_0x501b23,_0x162e7f[_0x869d('0x44')]);return db[_0x869d('0x3e')][_0x869d('0x45')](_0x501b23)[_0x869d('0x24')](handleEntityNotFound(_0x4ea410,null))['then'](respondWithResult(_0x4ea410,null))[_0x869d('0x40')](handleError(_0x4ea410,null));};exports[_0x869d('0x46')]=function(_0x557f7d,_0x26c1c8){return db[_0x869d('0x3e')][_0x869d('0x46')](_0x557f7d[_0x869d('0x47')],{})[_0x869d('0x24')](function(_0x562fcd){var _0x2fcca2=_0x557f7d['user'][_0x869d('0x48')]({'plain':!![]});if(!_0x2fcca2)throw new Error(_0x869d('0x49'));if(_0x2fcca2[_0x869d('0x4a')]===_0x869d('0x4b')){var _0x20c7af=_0x562fcd['get']({'plain':!![]});var _0x528636='CustomDashboards';return db[_0x869d('0x4c')]['find']({'where':{'name':_0x528636,'userProfileId':_0x2fcca2[_0x869d('0x4d')]},'raw':!![]})[_0x869d('0x24')](function(_0xb4325f){if(_0xb4325f&&_0xb4325f[_0x869d('0x4e')]===0x0){return db[_0x869d('0x4f')][_0x869d('0x46')]({'name':_0x20c7af[_0x869d('0x28')],'resourceId':_0x20c7af['id'],'type':_0xb4325f[_0x869d('0x28')],'sectionId':_0xb4325f['id']},{})['then'](function(){return _0x562fcd;});}else{return _0x562fcd;}})['catch'](function(_0x4ef5b0){logger[_0x869d('0x26')](_0x869d('0x50'),_0x4ef5b0);throw _0x4ef5b0;});}return _0x562fcd;})['then'](respondWithResult(_0x26c1c8,0xc9))[_0x869d('0x40')](handleError(_0x26c1c8,null));};exports[_0x869d('0x51')]=function(_0x3e209f,_0x36518f){var _0x5f3eba={'where':{'id':_0x3e209f['params']['id']}},_0x2f7f00={};_0x2f7f00[_0x869d('0x2f')]=_['keys'](db[_0x869d('0x3e')]['rawAttributes']);_0x5f3eba['attributes']=_[_0x869d('0x33')](_0x2f7f00[_0x869d('0x2f')],qs[_0x869d('0x34')](_0x3e209f[_0x869d('0x32')]['fields']));_0x5f3eba[_0x869d('0x35')]=_0x5f3eba[_0x869d('0x35')][_0x869d('0x43')]?_0x5f3eba['attributes']:_0x2f7f00[_0x869d('0x2f')];if(_0x3e209f['query'][_0x869d('0x52')]){_0x5f3eba[_0x869d('0x3d')]=[{'all':!![]}];}_0x5f3eba=_[_0x869d('0x3c')]({},_0x5f3eba,_0x3e209f[_0x869d('0x44')]);return db[_0x869d('0x3e')][_0x869d('0x45')](_0x5f3eba)[_0x869d('0x24')](handleEntityNotFound(_0x36518f,null))[_0x869d('0x24')](function(_0xbc568c){if(_0xbc568c){var _0xf3ab7f=_0xbc568c[_0x869d('0x48')]({'plain':!![]});_0xf3ab7f=qs['omit'](_0xf3ab7f,['id','createdAt',_0x869d('0x53')]);_0x3e209f[_0x869d('0x47')]=_[_0x869d('0x54')](_0x3e209f['body'],['id',_0x869d('0x55'),_0x869d('0x53')]);return db['Dashboard'][_0x869d('0x46')](_[_0x869d('0x3c')](_0xf3ab7f,_0x3e209f['body']),{'include':_0x3e209f['query'][_0x869d('0x52')]?[{'all':!![]}]:undefined})[_0x869d('0x24')](function(_0x4923ec){var _0x4512a3=_0x3e209f[_0x869d('0x4b')][_0x869d('0x48')]({'plain':!![]});if(!_0x4512a3)throw new Error(_0x869d('0x49'));if(_0x4512a3[_0x869d('0x4a')]===_0x869d('0x4b')){var _0x5efad1=_0x4923ec[_0x869d('0x48')]({'plain':!![]});var _0x11cc50=_0x869d('0x56');return db[_0x869d('0x4c')][_0x869d('0x45')]({'where':{'name':_0x11cc50,'userProfileId':_0x4512a3[_0x869d('0x4d')]},'raw':!![]})['then'](function(_0x323d41){if(_0x323d41&&_0x323d41['autoAssociation']===0x0){return db[_0x869d('0x4f')][_0x869d('0x46')]({'name':_0x5efad1[_0x869d('0x28')],'resourceId':_0x5efad1['id'],'type':_0x323d41[_0x869d('0x28')],'sectionId':_0x323d41['id']},{})[_0x869d('0x24')](function(){return _0x4923ec;});}else{return _0x4923ec;}})[_0x869d('0x40')](function(_0x1dca77){logger[_0x869d('0x26')](_0x869d('0x50'),_0x1dca77);throw _0x1dca77;});}return _0x4923ec;});}})['then'](respondWithResult(_0x36518f,0xc9))['catch'](handleError(_0x36518f,null));};exports[_0x869d('0x23')]=function(_0x53d8f2,_0x14e181){if(_0x53d8f2[_0x869d('0x47')]['id']){delete _0x53d8f2[_0x869d('0x47')]['id'];}return db[_0x869d('0x3e')][_0x869d('0x45')]({'where':{'id':_0x53d8f2['params']['id']}})[_0x869d('0x24')](handleEntityNotFound(_0x14e181,null))['then'](saveUpdates(_0x53d8f2[_0x869d('0x47')],null))[_0x869d('0x24')](respondWithResult(_0x14e181,null))[_0x869d('0x40')](handleError(_0x14e181,null));};exports[_0x869d('0x25')]=function(_0x341793,_0x2f35d4){return db[_0x869d('0x3e')][_0x869d('0x45')]({'where':{'id':_0x341793['params']['id']}})[_0x869d('0x24')](handleEntityNotFound(_0x2f35d4,null))[_0x869d('0x24')](removeEntity(_0x2f35d4,null))[_0x869d('0x40')](handleError(_0x2f35d4,null));};function widgetAttributes(_0x23560d){try{switch(_0x23560d[_0x869d('0x2e')]){case _0x869d('0x57'):return[{'name':_0x869d('0x58'),'value':_0x23560d[_0x869d('0x58')]||(_0x23560d[_0x869d('0x59')]&&_0x23560d[_0x869d('0x59')][0x0]?_0x23560d[_0x869d('0x59')][0x0][_0x869d('0x5a')]:undefined)||_0x869d('0x5b')}];case _0x869d('0x5c'):return[{'name':_0x869d('0x5d'),'value':_0x23560d[_0x869d('0x5d')]||(_0x23560d[_0x869d('0x59')]&&_0x23560d[_0x869d('0x59')][0x0]?_0x23560d[_0x869d('0x59')][0x0][_0x869d('0x5a')]:undefined)||''}];case _0x869d('0x5e'):return[{'name':_0x869d('0x5f'),'value':_0x23560d[_0x869d('0x5f')]||(_0x23560d[_0x869d('0x59')]&&_0x23560d[_0x869d('0x59')][0x0]?_0x23560d[_0x869d('0x59')][0x0][_0x869d('0x5a')]:undefined)||_0x869d('0x60')},{'name':_0x869d('0x61'),'value':_0x23560d[_0x869d('0x61')]||(_0x23560d[_0x869d('0x59')]&&_0x23560d[_0x869d('0x59')][0x1]?_0x23560d[_0x869d('0x59')][0x1][_0x869d('0x5a')]:undefined)||_0x869d('0x62')},{'name':_0x869d('0x63'),'value':_0x23560d[_0x869d('0x63')]||(_0x23560d['attrs']&&_0x23560d[_0x869d('0x59')][0x2]?_0x23560d['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x869d('0x64'),'value':_0x23560d[_0x869d('0x64')]||(_0x23560d['attrs']&&_0x23560d[_0x869d('0x59')][0x0]?_0x23560d[_0x869d('0x59')][0x0]['value']:undefined)||_0x869d('0x65')},{'name':'attrVoiceQueues','value':_0x23560d[_0x869d('0x66')]||(_0x23560d['attrs']&&_0x23560d[_0x869d('0x59')][0x1]?_0x23560d['attrs'][0x1]['value']:undefined)||[]},{'name':_0x869d('0x63'),'value':_0x23560d[_0x869d('0x63')]||(_0x23560d[_0x869d('0x59')]&&_0x23560d[_0x869d('0x59')][0x2]?_0x23560d[_0x869d('0x59')][0x2][_0x869d('0x5a')]:undefined)||0x14}];case _0x869d('0x67'):case _0x869d('0x68'):return[{'name':_0x869d('0x69'),'value':_0x23560d['attrSerie1']||(_0x23560d[_0x869d('0x59')]&&_0x23560d[_0x869d('0x59')][0x0]?_0x23560d[_0x869d('0x59')][0x0][_0x869d('0x5a')]:undefined)||'total'},{'name':_0x869d('0x6a'),'value':_0x23560d['attrSerie2']||(_0x23560d['attrs']&&_0x23560d['attrs'][0x1]?_0x23560d['attrs'][0x1][_0x869d('0x5a')]:undefined)||null},{'name':_0x869d('0x6b'),'value':_0x23560d[_0x869d('0x6b')]||(_0x23560d['attrs']&&_0x23560d[_0x869d('0x59')][0x2]?_0x23560d[_0x869d('0x59')][0x2][_0x869d('0x5a')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x23560d[_0x869d('0x66')]||(_0x23560d['attrs']&&_0x23560d[_0x869d('0x59')][0x3]?_0x23560d[_0x869d('0x59')][0x3][_0x869d('0x5a')]:undefined)||[]}];case _0x869d('0x6c'):return[{'name':'attrReport','type':_0x23560d[_0x869d('0x6d')]||(_0x23560d[_0x869d('0x59')]&&_0x23560d[_0x869d('0x59')][0x0]?_0x23560d[_0x869d('0x59')][0x0]['type']:undefined)||null,'value':_0x23560d[_0x869d('0x6e')]||(_0x23560d['attrs']&&_0x23560d[_0x869d('0x59')][0x0]?_0x23560d[_0x869d('0x59')][0x0][_0x869d('0x5a')]:undefined)||null},{'name':_0x869d('0x6f'),'value':_0x23560d[_0x869d('0x6f')]||(_0x23560d[_0x869d('0x59')]&&_0x23560d[_0x869d('0x59')][0x1]?_0x23560d['attrs'][0x1][_0x869d('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x29a6c7){logger[_0x869d('0x26')](_0x869d('0x70'),JSON[_0x869d('0x71')](_0x29a6c7));return[];}}exports['addItem']=function(_0xb0375b,_0x15593b,_0x112f5b){if(_0xb0375b[_0x869d('0x47')]['id']){delete _0xb0375b['body']['id'];}return db['Dashboard'][_0x869d('0x45')]({'where':{'id':_0xb0375b[_0x869d('0x42')]['id']}})[_0x869d('0x24')](handleEntityNotFound(_0x15593b,null))[_0x869d('0x24')](function(_0xa40956){if(_0xa40956){_0xb0375b[_0x869d('0x47')][_0x869d('0x72')]=_0xa40956['id'];_0xb0375b[_0x869d('0x47')][_0x869d('0x59')]=widgetAttributes(_0xb0375b[_0x869d('0x47')]);return db['DashboardItem'][_0x869d('0x46')](_0xb0375b['body']);}})['then'](respondWithResult(_0x15593b,null))[_0x869d('0x40')](handleError(_0x15593b,null));};exports[_0x869d('0x73')]=function(_0x97e2d0,_0x381784,_0x114397){var _0x556946={};var _0x47d1b4={};var _0x46b232;var _0x1ce9da;return db[_0x869d('0x3e')][_0x869d('0x74')]({'where':{'id':_0x97e2d0['params']['id']}})[_0x869d('0x24')](handleEntityNotFound(_0x381784,null))[_0x869d('0x24')](function(_0x2b1dee){if(_0x2b1dee){_0x46b232=_0x2b1dee;_0x47d1b4['model']=_[_0x869d('0x30')](db[_0x869d('0x75')][_0x869d('0x2c')]);_0x47d1b4[_0x869d('0x32')]=_[_0x869d('0x30')](_0x97e2d0[_0x869d('0x32')]);_0x47d1b4[_0x869d('0x31')]=_['intersection'](_0x47d1b4[_0x869d('0x2f')],_0x47d1b4[_0x869d('0x32')]);_0x556946[_0x869d('0x35')]=_['intersection'](_0x47d1b4[_0x869d('0x2f')],qs['fields'](_0x97e2d0[_0x869d('0x32')][_0x869d('0x34')]));_0x556946[_0x869d('0x35')]=_0x556946['attributes'][_0x869d('0x43')]?_0x556946['attributes']:_0x47d1b4[_0x869d('0x2f')];_0x556946['order']=qs[_0x869d('0x38')](_0x97e2d0[_0x869d('0x32')][_0x869d('0x38')]);_0x556946[_0x869d('0x39')]=qs[_0x869d('0x31')](_[_0x869d('0x76')](_0x97e2d0['query'],_0x47d1b4[_0x869d('0x31')]));if(_0x97e2d0[_0x869d('0x32')]['filter']){_0x556946['where']=_[_0x869d('0x3c')](_0x556946['where'],{'$or':_[_0x869d('0x2b')](_0x556946[_0x869d('0x35')],function(_0x379334){var _0x546c0d={};_0x546c0d[_0x379334]={'$like':'%'+_0x97e2d0[_0x869d('0x32')]['filter']+'%'};return _0x546c0d;})});}_0x556946=_['merge']({},_0x556946,_0x97e2d0[_0x869d('0x44')]);return _0x46b232['getItems'](_0x556946);}})[_0x869d('0x24')](function(_0x38aaf2){if(_0x38aaf2){_0x1ce9da=_0x38aaf2[_0x869d('0x43')];if(!_0x97e2d0[_0x869d('0x32')][_0x869d('0x36')](_0x869d('0x77'))){_0x556946['limit']=qs[_0x869d('0x1f')](_0x97e2d0[_0x869d('0x32')]['limit']);_0x556946[_0x869d('0x37')]=qs[_0x869d('0x37')](_0x97e2d0[_0x869d('0x32')][_0x869d('0x37')]);}return _0x46b232['getItems'](_0x556946);}})['then'](function(_0x2bc39f){if(_0x2bc39f){return _0x2bc39f?{'count':_0x1ce9da,'rows':_0x2bc39f}:null;}})[_0x869d('0x24')](respondWithResult(_0x381784,null))[_0x869d('0x40')](handleError(_0x381784,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 1a3389c..9013391 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 _0xcfbe=['hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','remove','emit'];(function(_0x20e187,_0x1ef9e1){var _0x425928=function(_0x471806){while(--_0x471806){_0x20e187['push'](_0x20e187['shift']());}};_0x425928(++_0x1ef9e1);}(_0xcfbe,0x83));var _0xecfb=function(_0x5e7a86,_0x502364){_0x5e7a86=_0x5e7a86-0x0;var _0xbbdd3d=_0xcfbe[_0x5e7a86];return _0xbbdd3d;};'use strict';var EventEmitter=require(_0xecfb('0x0'));var Dashboard=require(_0xecfb('0x1'))['db'][_0xecfb('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xecfb('0x3')};function emitEvent(_0x3979c8){return function(_0x1296ee,_0x17643d,_0x110e74){DashboardEvents['emit'](_0x3979c8+':'+_0x1296ee['id'],_0x1296ee);DashboardEvents[_0xecfb('0x4')](_0x3979c8,_0x1296ee);_0x110e74(null);};}for(var e in events){if(events[_0xecfb('0x5')](e)){var event=events[e];Dashboard[_0xecfb('0x6')](e,emitEvent(event));}}module[_0xecfb('0x7')]=DashboardEvents; \ No newline at end of file +var _0x9797=['../../mysqldb','Dashboard','save','remove','emit','hasOwnProperty','exports'];(function(_0xbc2d9e,_0x40ef4f){var _0x2e315c=function(_0x57fc55){while(--_0x57fc55){_0xbc2d9e['push'](_0xbc2d9e['shift']());}};_0x2e315c(++_0x40ef4f);}(_0x9797,0x149));var _0x7979=function(_0xf4129c,_0x44fcf1){_0xf4129c=_0xf4129c-0x0;var _0x426611=_0x9797[_0xf4129c];return _0x426611;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x7979('0x0'))['db'][_0x7979('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7979('0x2'),'afterUpdate':'update','afterDestroy':_0x7979('0x3')};function emitEvent(_0x190833){return function(_0x4c4898,_0x5ee8b8,_0x56f3cd){DashboardEvents[_0x7979('0x4')](_0x190833+':'+_0x4c4898['id'],_0x4c4898);DashboardEvents[_0x7979('0x4')](_0x190833,_0x4c4898);_0x56f3cd(null);};}for(var e in events){if(events[_0x7979('0x5')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x7979('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 702a665..278f579 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 _0x91a9=['rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1ac96b,_0x900861){var _0xf31fb6=function(_0x5ae230){while(--_0x5ae230){_0x1ac96b['push'](_0x1ac96b['shift']());}};_0xf31fb6(++_0x900861);}(_0x91a9,0xbc));var _0x991a=function(_0x5a623f,_0x2403d2){_0x5a623f=_0x5a623f-0x0;var _0x18fda2=_0x91a9[_0x5a623f];return _0x18fda2;};'use strict';var _=require(_0x991a('0x0'));var util=require(_0x991a('0x1'));var logger=require(_0x991a('0x2'))(_0x991a('0x3'));var moment=require(_0x991a('0x4'));var BPromise=require(_0x991a('0x5'));var rp=require(_0x991a('0x6'));var fs=require('fs');var path=require(_0x991a('0x7'));var rimraf=require(_0x991a('0x8'));var config=require(_0x991a('0x9'));var attributes=require(_0x991a('0xa'));module[_0x991a('0xb')]=function(_0x370710,_0x2e5c49){return _0x370710[_0x991a('0xc')](_0x991a('0xd'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfadc=['../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','api','request-promise','path','rimraf'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0xfadc,0x8a));var _0xcfad=function(_0x38d940,_0x2f5291){_0x38d940=_0x38d940-0x0;var _0x4ea1b7=_0xfadc[_0x38d940];return _0x4ea1b7;};'use strict';var _=require(_0xcfad('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcfad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcfad('0x2'));var fs=require('fs');var path=require(_0xcfad('0x3'));var rimraf=require(_0xcfad('0x4'));var config=require(_0xcfad('0x5'));var attributes=require(_0xcfad('0x6'));module[_0xcfad('0x7')]=function(_0x7a56f5,_0x38a2c1){return _0x7a56f5[_0xcfad('0x8')](_0xcfad('0x9'),attributes,{'tableName':_0xcfad('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 6112434..e15efcb 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 _0x6192=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x34cbdb,_0x5793fb){var _0x5a20cf=function(_0x366e57){while(--_0x366e57){_0x34cbdb['push'](_0x34cbdb['shift']());}};_0x5a20cf(++_0x5793fb);}(_0x6192,0x10a));var _0x2619=function(_0x43e4de,_0x16d989){_0x43e4de=_0x43e4de-0x0;var _0x541f0a=_0x6192[_0x43e4de];return _0x541f0a;};'use strict';var _=require(_0x2619('0x0'));var util=require(_0x2619('0x1'));var moment=require(_0x2619('0x2'));var BPromise=require(_0x2619('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2619('0x4'));var db=require(_0x2619('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2619('0x6'))(_0x2619('0x7'));var config=require(_0x2619('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2619('0x9')]({'port':0x232a});config[_0x2619('0xa')]=_['defaults'](config['redis'],{'host':_0x2619('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2619('0xa')]));require(_0x2619('0xc'))['register'](socket);function respondWithRpcPromise(_0x1b4cb3,_0x415c86,_0x2cda3f){return new BPromise(function(_0x3119b4,_0x4b140b){return client[_0x2619('0xd')](_0x1b4cb3,_0x2cda3f)[_0x2619('0xe')](function(_0x59b625){logger[_0x2619('0xf')](_0x2619('0x10'),_0x415c86,_0x2619('0x11'));logger[_0x2619('0x12')](_0x2619('0x13'),_0x415c86,_0x2619('0x11'),JSON[_0x2619('0x14')](_0x59b625));if(_0x59b625['error']){if(_0x59b625[_0x2619('0x15')][_0x2619('0x16')]===0x1f4){logger[_0x2619('0x15')](_0x2619('0x10'),_0x415c86,_0x59b625[_0x2619('0x15')][_0x2619('0x17')]);return _0x4b140b(_0x59b625[_0x2619('0x15')][_0x2619('0x17')]);}logger[_0x2619('0x15')](_0x2619('0x10'),_0x415c86,_0x59b625[_0x2619('0x15')][_0x2619('0x17')]);return _0x3119b4(_0x59b625['error'][_0x2619('0x17')]);}else{logger[_0x2619('0xf')](_0x2619('0x10'),_0x415c86,_0x2619('0x11'));_0x3119b4(_0x59b625[_0x2619('0x18')][_0x2619('0x17')]);}})[_0x2619('0x19')](function(_0x345561){logger[_0x2619('0x15')](_0x2619('0x10'),_0x415c86,_0x345561);_0x4b140b(_0x345561);});});} \ No newline at end of file +var _0x52d2=['Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','register','then','info'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x52d2,0x12b));var _0x252d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x52d2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x252d('0x0'));var util=require('util');var moment=require(_0x252d('0x1'));var BPromise=require(_0x252d('0x2'));var rs=require(_0x252d('0x3'));var fs=require('fs');var Redis=require(_0x252d('0x4'));var db=require(_0x252d('0x5'))['db'];var utils=require(_0x252d('0x6'));var logger=require(_0x252d('0x7'))(_0x252d('0x8'));var config=require(_0x252d('0x9'));var jayson=require(_0x252d('0xa'));var client=jayson[_0x252d('0xb')][_0x252d('0xc')]({'port':0x232a});config[_0x252d('0xd')]=_[_0x252d('0xe')](config['redis'],{'host':_0x252d('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x252d('0xd')]));require(_0x252d('0x10'))[_0x252d('0x11')](socket);function respondWithRpcPromise(_0x9360f4,_0x2240d5,_0x4d36a7){return new BPromise(function(_0x28d440,_0x400c95){return client['request'](_0x9360f4,_0x4d36a7)[_0x252d('0x12')](function(_0x136566){logger[_0x252d('0x13')](_0x252d('0x14'),_0x2240d5,_0x252d('0x15'));logger[_0x252d('0x16')](_0x252d('0x17'),_0x2240d5,_0x252d('0x15'),JSON['stringify'](_0x136566));if(_0x136566['error']){if(_0x136566[_0x252d('0x18')][_0x252d('0x19')]===0x1f4){logger[_0x252d('0x18')](_0x252d('0x14'),_0x2240d5,_0x136566['error'][_0x252d('0x1a')]);return _0x400c95(_0x136566[_0x252d('0x18')][_0x252d('0x1a')]);}logger[_0x252d('0x18')](_0x252d('0x14'),_0x2240d5,_0x136566[_0x252d('0x18')][_0x252d('0x1a')]);return _0x28d440(_0x136566[_0x252d('0x18')][_0x252d('0x1a')]);}else{logger[_0x252d('0x13')]('Dashboard,\x20%s,\x20%s',_0x2240d5,_0x252d('0x15'));_0x28d440(_0x136566[_0x252d('0x1b')]['message']);}})[_0x252d('0x1c')](function(_0x3c6bf5){logger[_0x252d('0x18')](_0x252d('0x14'),_0x2240d5,_0x3c6bf5);_0x400c95(_0x3c6bf5);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index d4c0b1e..2dbf230 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 _0xf6f3=['save','remove','update','length','dashboard:','./dashboard.events'];(function(_0x2f2b36,_0x3b13ec){var _0x190bd8=function(_0x3230b2){while(--_0x3230b2){_0x2f2b36['push'](_0x2f2b36['shift']());}};_0x190bd8(++_0x3b13ec);}(_0xf6f3,0x6b));var _0x3f6f=function(_0x5d1d9f,_0x1ef696){_0x5d1d9f=_0x5d1d9f-0x0;var _0x2faa8e=_0xf6f3[_0x5d1d9f];return _0x2faa8e;};'use strict';var DashboardEvents=require(_0x3f6f('0x0'));var events=[_0x3f6f('0x1'),_0x3f6f('0x2'),_0x3f6f('0x3')];function createListener(_0x1006d6,_0xd0e81){return function(_0x421d71){_0xd0e81['emit'](_0x1006d6,_0x421d71);};}function removeListener(_0x69b9a6,_0x500ab7){return function(){DashboardEvents['removeListener'](_0x69b9a6,_0x500ab7);};}exports['register']=function(_0x26eb76){for(var _0x57cfad=0x0,_0x49f478=events[_0x3f6f('0x4')];_0x57cfad<_0x49f478;_0x57cfad++){var _0x5dc4bc=events[_0x57cfad];var _0x50c409=createListener(_0x3f6f('0x5')+_0x5dc4bc,_0x26eb76);DashboardEvents['on'](_0x5dc4bc,_0x50c409);}}; \ No newline at end of file +var _0xbc9b=['update','register','length','dashboard:','remove'];(function(_0x418250,_0x2dbdb1){var _0x59b8d5=function(_0x19a4f5){while(--_0x19a4f5){_0x418250['push'](_0x418250['shift']());}};_0x59b8d5(++_0x2dbdb1);}(_0xbc9b,0x162));var _0xbbc9=function(_0x2f59d0,_0x18a4af){_0x2f59d0=_0x2f59d0-0x0;var _0x56b707=_0xbc9b[_0x2f59d0];return _0x56b707;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xbbc9('0x0'),_0xbbc9('0x1')];function createListener(_0x2dd43a,_0x120d37){return function(_0xa970c7){_0x120d37['emit'](_0x2dd43a,_0xa970c7);};}function removeListener(_0x235ca5,_0x3cb7a1){return function(){DashboardEvents['removeListener'](_0x235ca5,_0x3cb7a1);};}exports[_0xbbc9('0x2')]=function(_0x5c5d0e){for(var _0x56bad4=0x0,_0xbd1c6b=events[_0xbbc9('0x3')];_0x56bad4<_0xbd1c6b;_0x56bad4++){var _0x40b360=events[_0x56bad4];var _0x254c61=createListener(_0xbbc9('0x4')+_0x40b360,_0x5c5d0e);DashboardEvents['on'](_0x40b360,_0x254c61);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 024398f..5263c66 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','multer','util','path','express','Router'];(function(_0x325a08,_0x571fff){var _0x436e01=function(_0x2c7719){while(--_0x2c7719){_0x325a08['push'](_0x325a08['shift']());}};_0x436e01(++_0x571fff);}(_0xe706,0xa3));var _0x6e70=function(_0x192cff,_0x361327){_0x192cff=_0x192cff-0x0;var _0x20d2f6=_0xe706[_0x192cff];return _0x20d2f6;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x10')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x10')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['post']('/:id/items',auth[_0x6e70('0xa')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _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(_0x5cd395,_0x507285){var _0x141227=function(_0x5893fe){while(--_0x5893fe){_0x5cd395['push'](_0x5cd395['shift']());}};_0x141227(++_0x507285);}(_0xe706,0xa3));var _0x6e70=function(_0x252550,_0x1ffe4d){_0x252550=_0x252550-0x0;var _0x352629=_0xe706[_0x252550];return _0x352629;};'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 1d2a84e..9e9883c 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 _0xeed0=['squel','lodash','exports','STRING','TEXT','parse','getDataValue','setDataValue','attrs','stringify','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x1adfae,_0x227da4){var _0x2f855d=function(_0x23a7ef){while(--_0x23a7ef){_0x1adfae['push'](_0x1adfae['shift']());}};_0x2f855d(++_0x227da4);}(_0xeed0,0xfb));var _0x0eed=function(_0x100c1c,_0x3fe733){_0x100c1c=_0x100c1c-0x0;var _0x5c3d11=_0xeed0[_0x100c1c];return _0x5c3d11;};'use strict';var Sequelize=require(_0x0eed('0x0'));var squel=require(_0x0eed('0x1'));var _=require(_0x0eed('0x2'));module[_0x0eed('0x3')]={'title':{'type':Sequelize[_0x0eed('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x0eed('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x0eed('0x5')]('long'),'get':function(){try{return JSON[_0x0eed('0x6')](this[_0x0eed('0x7')]('attrs'));}catch(_0x4250d2){return[];}},'set':function(_0x375419){try{this[_0x0eed('0x8')](_0x0eed('0x9'),JSON[_0x0eed('0xa')](_0x375419));}catch(_0x6f2a94){this[_0x0eed('0x8')](_0x0eed('0x9'),JSON[_0x0eed('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x0eed('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x0eed('0xb')]},'col':{'type':Sequelize[_0x0eed('0xb')]},'background':{'type':Sequelize[_0x0eed('0x4')],'allowNull':![],'defaultValue':_0x0eed('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x0eed('0x4')],'allowNull':![],'defaultValue':_0x0eed('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4d75=['long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','squel','lodash','exports','STRING','TEXT'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4d75,0x10f));var _0x54d7=function(_0x95203,_0x16b559){_0x95203=_0x95203-0x0;var _0x151e9d=_0x4d75[_0x95203];return _0x151e9d;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x54d7('0x0'));var _=require(_0x54d7('0x1'));module[_0x54d7('0x2')]={'title':{'type':Sequelize[_0x54d7('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x54d7('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x54d7('0x4')](_0x54d7('0x5')),'get':function(){try{return JSON[_0x54d7('0x6')](this[_0x54d7('0x7')](_0x54d7('0x8')));}catch(_0x42a57a){return[];}},'set':function(_0x552787){try{this[_0x54d7('0x9')](_0x54d7('0x8'),JSON[_0x54d7('0xa')](_0x552787));}catch(_0x14c33d){this[_0x54d7('0x9')](_0x54d7('0x8'),JSON[_0x54d7('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x54d7('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x54d7('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x54d7('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x54d7('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x54d7('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 4fdba72..105cd6b 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 _0x21bc=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','count','limit','set','save','then','error','stack','name','show','keys','DashboardItem','rawAttributes','query','filters','intersection','model','attributes','fields','includeAll','find','catch','destroy','params','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','total','attrSerie2','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x24dc31,_0x268d9e){var _0x17ecd5=function(_0x14b9bc){while(--_0x14b9bc){_0x24dc31['push'](_0x24dc31['shift']());}};_0x17ecd5(++_0x268d9e);}(_0x21bc,0x196));var _0xc21b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x21bc[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0xc21b('0x0'));var emlformat=require(_0xc21b('0x1'));var rimraf=require(_0xc21b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc21b('0x3'));var rp=require(_0xc21b('0x4'));var moment=require(_0xc21b('0x5'));var BPromise=require(_0xc21b('0x6'));var Mustache=require(_0xc21b('0x7'));var util=require(_0xc21b('0x8'));var path=require(_0xc21b('0x9'));var sox=require(_0xc21b('0xa'));var csv=require('to-csv');var ejs=require(_0xc21b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc21b('0xc'));var crypto=require(_0xc21b('0xd'));var jsforce=require(_0xc21b('0xe'));var deskjs=require(_0xc21b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc21b('0x10'));var Papa=require(_0xc21b('0x11'));var Redis=require('ioredis');var authService=require(_0xc21b('0x12'));var qs=require(_0xc21b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc21b('0x14'));var logger=require(_0xc21b('0x15'))(_0xc21b('0x16'));var utils=require(_0xc21b('0x17'));var config=require(_0xc21b('0x18'));var db=require(_0xc21b('0x19'))['db'];config[_0xc21b('0x1a')]=_[_0xc21b('0x1b')](config['redis'],{'host':_0xc21b('0x1c'),'port':0x18eb});var socket=require(_0xc21b('0x1d'))(new Redis(config[_0xc21b('0x1a')]));require(_0xc21b('0x1e'))['register'](socket);function respondWithStatusCode(_0x2e6583,_0x50eada){_0x50eada=_0x50eada||0xcc;return function(_0x327040){if(_0x327040){return _0x2e6583[_0xc21b('0x1f')](_0x50eada);}return _0x2e6583[_0xc21b('0x20')](_0x50eada)[_0xc21b('0x21')]();};}function respondWithResult(_0x13fda8,_0x2258fe){_0x2258fe=_0x2258fe||0xc8;return function(_0x482a3f){if(_0x482a3f){return _0x13fda8[_0xc21b('0x20')](_0x2258fe)[_0xc21b('0x22')](_0x482a3f);}};}function respondWithFilteredResult(_0x63c96e,_0x336044){return function(_0x49d79c){if(_0x49d79c){var _0x5d3f40=_0x49d79c[_0xc21b('0x23')],_0x4ffe22=_0x336044['offset'],_0x564738=_0x336044['offset']+_0x336044[_0xc21b('0x24')],_0x4121b9;if(_0x564738>=_0x5d3f40){_0x564738=_0x5d3f40;_0x4121b9=0xc8;}else{_0x4121b9=0xce;}_0x63c96e[_0xc21b('0x20')](_0x4121b9);return _0x63c96e[_0xc21b('0x25')]('Content-Range',_0x4ffe22+'-'+_0x564738+'/'+_0x5d3f40)[_0xc21b('0x22')](_0x49d79c);}return null;};}function patchUpdates(_0x1f4ce3){return function(_0x80e5fe){try{jsonpatch['apply'](_0x80e5fe,_0x1f4ce3,!![]);}catch(_0x1fda11){return BPromise['reject'](_0x1fda11);}return _0x80e5fe[_0xc21b('0x26')]();};}function saveUpdates(_0x45606b,_0x1b59b8){return function(_0x4dd052){if(_0x4dd052){return _0x4dd052['update'](_0x45606b)[_0xc21b('0x27')](function(_0x56fc2c){return _0x56fc2c;});}return null;};}function removeEntity(_0x51c667,_0x24346a){return function(_0xbfba13){if(_0xbfba13){return _0xbfba13['destroy']()['then'](function(){_0x51c667[_0xc21b('0x20')](0xcc)[_0xc21b('0x21')]();});}};}function handleEntityNotFound(_0x2cae37,_0x22a1fc){return function(_0x24e427){if(!_0x24e427){_0x2cae37[_0xc21b('0x1f')](0x194);}return _0x24e427;};}function handleError(_0x575d56,_0x26e3c6){_0x26e3c6=_0x26e3c6||0x1f4;return function(_0x500ba7){logger[_0xc21b('0x28')](_0x500ba7[_0xc21b('0x29')]);if(_0x500ba7[_0xc21b('0x2a')]){delete _0x500ba7['name'];}_0x575d56[_0xc21b('0x20')](_0x26e3c6)['send'](_0x500ba7);};}exports[_0xc21b('0x2b')]=function(_0x4fa411,_0x2571f0){var _0x233e7f={'raw':![],'where':{'id':_0x4fa411['params']['id']}},_0x93d0b7={};_0x93d0b7['model']=_[_0xc21b('0x2c')](db[_0xc21b('0x2d')][_0xc21b('0x2e')]);_0x93d0b7[_0xc21b('0x2f')]=_[_0xc21b('0x2c')](_0x4fa411[_0xc21b('0x2f')]);_0x93d0b7[_0xc21b('0x30')]=_[_0xc21b('0x31')](_0x93d0b7[_0xc21b('0x32')],_0x93d0b7['query']);_0x233e7f[_0xc21b('0x33')]=_[_0xc21b('0x31')](_0x93d0b7['model'],qs[_0xc21b('0x34')](_0x4fa411[_0xc21b('0x2f')]['fields']));_0x233e7f[_0xc21b('0x33')]=_0x233e7f[_0xc21b('0x33')]['length']?_0x233e7f[_0xc21b('0x33')]:_0x93d0b7['model'];if(_0x4fa411[_0xc21b('0x2f')][_0xc21b('0x35')]){_0x233e7f['include']=[{'all':!![]}];}_0x233e7f=_['merge']({},_0x233e7f,_0x4fa411['options']);return db[_0xc21b('0x2d')][_0xc21b('0x36')](_0x233e7f)[_0xc21b('0x27')](handleEntityNotFound(_0x2571f0,null))['then'](respondWithResult(_0x2571f0,null))[_0xc21b('0x37')](handleError(_0x2571f0,null));};exports[_0xc21b('0x38')]=function(_0x17253f,_0x2c7688){return db[_0xc21b('0x2d')][_0xc21b('0x36')]({'where':{'id':_0x17253f[_0xc21b('0x39')]['id']}})[_0xc21b('0x27')](handleEntityNotFound(_0x2c7688,null))[_0xc21b('0x27')](removeEntity(_0x2c7688,null))[_0xc21b('0x37')](handleError(_0x2c7688,null));};function widgetAttributes(_0x3220dc){try{switch(_0x3220dc[_0xc21b('0x3a')]){case _0xc21b('0x3b'):return[{'name':_0xc21b('0x3c'),'value':_0x3220dc['attrUrl']||(_0x3220dc['attrs']&&_0x3220dc[_0xc21b('0x3d')][0x0]?_0x3220dc[_0xc21b('0x3d')][0x0]['value']:undefined)||_0xc21b('0x3e')}];case _0xc21b('0x3f'):return[{'name':_0xc21b('0x40'),'value':_0x3220dc[_0xc21b('0x40')]||(_0x3220dc[_0xc21b('0x3d')]&&_0x3220dc['attrs'][0x0]?_0x3220dc[_0xc21b('0x3d')][0x0][_0xc21b('0x41')]:undefined)||''}];case _0xc21b('0x42'):return[{'name':_0xc21b('0x43'),'value':_0x3220dc[_0xc21b('0x43')]||(_0x3220dc[_0xc21b('0x3d')]&&_0x3220dc[_0xc21b('0x3d')][0x0]?_0x3220dc['attrs'][0x0][_0xc21b('0x41')]:undefined)||_0xc21b('0x44')},{'name':_0xc21b('0x45'),'value':_0x3220dc[_0xc21b('0x45')]||(_0x3220dc[_0xc21b('0x3d')]&&_0x3220dc[_0xc21b('0x3d')][0x1]?_0x3220dc['attrs'][0x1][_0xc21b('0x41')]:undefined)||'0.00'},{'name':_0xc21b('0x46'),'value':_0x3220dc['attrFontSize']||(_0x3220dc[_0xc21b('0x3d')]&&_0x3220dc['attrs'][0x2]?_0x3220dc[_0xc21b('0x3d')][0x2][_0xc21b('0x41')]:undefined)||0xc}];case _0xc21b('0x47'):return[{'name':_0xc21b('0x48'),'value':_0x3220dc[_0xc21b('0x48')]||(_0x3220dc[_0xc21b('0x3d')]&&_0x3220dc['attrs'][0x0]?_0x3220dc[_0xc21b('0x3d')][0x0]['value']:undefined)||'total'},{'name':_0xc21b('0x49'),'value':_0x3220dc['attrVoiceQueues']||(_0x3220dc[_0xc21b('0x3d')]&&_0x3220dc[_0xc21b('0x3d')][0x1]?_0x3220dc['attrs'][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x3220dc[_0xc21b('0x46')]||(_0x3220dc['attrs']&&_0x3220dc[_0xc21b('0x3d')][0x2]?_0x3220dc['attrs'][0x2][_0xc21b('0x41')]:undefined)||0x14}];case _0xc21b('0x4a'):case'pie-chart':return[{'name':'attrSerie1','value':_0x3220dc[_0xc21b('0x4b')]||(_0x3220dc['attrs']&&_0x3220dc[_0xc21b('0x3d')][0x0]?_0x3220dc[_0xc21b('0x3d')][0x0][_0xc21b('0x41')]:undefined)||_0xc21b('0x4c')},{'name':'attrSerie2','value':_0x3220dc[_0xc21b('0x4d')]||(_0x3220dc[_0xc21b('0x3d')]&&_0x3220dc['attrs'][0x1]?_0x3220dc[_0xc21b('0x3d')][0x1][_0xc21b('0x41')]:undefined)||null},{'name':'attrSerie3','value':_0x3220dc['attrSerie3']||(_0x3220dc[_0xc21b('0x3d')]&&_0x3220dc[_0xc21b('0x3d')][0x2]?_0x3220dc[_0xc21b('0x3d')][0x2]['value']:undefined)||null},{'name':_0xc21b('0x49'),'value':_0x3220dc['attrVoiceQueues']||(_0x3220dc[_0xc21b('0x3d')]&&_0x3220dc['attrs'][0x3]?_0x3220dc[_0xc21b('0x3d')][0x3]['value']:undefined)||[]}];case _0xc21b('0x4e'):return[{'name':_0xc21b('0x4f'),'type':_0x3220dc['reportType']||(_0x3220dc['attrs']&&_0x3220dc[_0xc21b('0x3d')][0x0]?_0x3220dc[_0xc21b('0x3d')][0x0][_0xc21b('0x3a')]:undefined)||null,'value':_0x3220dc[_0xc21b('0x4f')]||(_0x3220dc[_0xc21b('0x3d')]&&_0x3220dc[_0xc21b('0x3d')][0x0]?_0x3220dc[_0xc21b('0x3d')][0x0]['value']:undefined)||null},{'name':_0xc21b('0x50'),'value':_0x3220dc['attrRefresh']||(_0x3220dc['attrs']&&_0x3220dc[_0xc21b('0x3d')][0x1]?_0x3220dc[_0xc21b('0x3d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x25e4c0){logger[_0xc21b('0x28')](_0xc21b('0x51'),JSON['stringify'](_0x25e4c0));return[];}}exports[_0xc21b('0x52')]=function(_0x2388d6,_0x1ab00a){if(_0x2388d6[_0xc21b('0x53')]){_0x2388d6[_0xc21b('0x53')][_0xc21b('0x3d')]=widgetAttributes(_0x2388d6[_0xc21b('0x53')]);}return db['DashboardItem'][_0xc21b('0x52')](_0x2388d6[_0xc21b('0x53')],{})['then'](respondWithResult(_0x1ab00a,0xc9))[_0xc21b('0x37')](handleError(_0x1ab00a,null));};exports[_0xc21b('0x54')]=function(_0x47fe32,_0x9ee1e9){if(_0x47fe32[_0xc21b('0x53')]['id']){delete _0x47fe32[_0xc21b('0x53')]['id'];}_0x47fe32[_0xc21b('0x53')][_0xc21b('0x3d')]=widgetAttributes(_0x47fe32[_0xc21b('0x53')]);return db[_0xc21b('0x2d')][_0xc21b('0x36')]({'where':{'id':_0x47fe32[_0xc21b('0x39')]['id']}})[_0xc21b('0x27')](handleEntityNotFound(_0x9ee1e9,null))[_0xc21b('0x27')](saveUpdates(_0x47fe32[_0xc21b('0x53')],null))['then'](respondWithResult(_0x9ee1e9,null))[_0xc21b('0x37')](handleError(_0x9ee1e9,null));}; \ No newline at end of file +var _0x7117=['attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0x7117,0x153));var _0x7711=function(_0x3c7130,_0x4abee0){_0x3c7130=_0x3c7130-0x0;var _0x477bf1=_0x7117[_0x3c7130];return _0x477bf1;};'use strict';var pdf=require(_0x7711('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7711('0x1'));var zipdir=require(_0x7711('0x2'));var jsonpatch=require(_0x7711('0x3'));var rp=require('request-promise');var moment=require(_0x7711('0x4'));var BPromise=require(_0x7711('0x5'));var Mustache=require(_0x7711('0x6'));var util=require(_0x7711('0x7'));var path=require(_0x7711('0x8'));var sox=require(_0x7711('0x9'));var csv=require(_0x7711('0xa'));var ejs=require(_0x7711('0xb'));var fs=require('fs');var _=require(_0x7711('0xc'));var squel=require(_0x7711('0xd'));var crypto=require('crypto');var jsforce=require(_0x7711('0xe'));var deskjs=require(_0x7711('0xf'));var toCsv=require(_0x7711('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7711('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7711('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7711('0x12'));var logger=require(_0x7711('0x13'))(_0x7711('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7711('0x15'))['db'];config[_0x7711('0x16')]=_['defaults'](config[_0x7711('0x16')],{'host':_0x7711('0x17'),'port':0x18eb});var socket=require(_0x7711('0x18'))(new Redis(config[_0x7711('0x16')]));require('./dashboardItem.socket')[_0x7711('0x19')](socket);function respondWithStatusCode(_0x307917,_0x5b01de){_0x5b01de=_0x5b01de||0xcc;return function(_0xbade62){if(_0xbade62){return _0x307917['sendStatus'](_0x5b01de);}return _0x307917[_0x7711('0x1a')](_0x5b01de)[_0x7711('0x1b')]();};}function respondWithResult(_0x178058,_0x80ba3){_0x80ba3=_0x80ba3||0xc8;return function(_0x222f0c){if(_0x222f0c){return _0x178058[_0x7711('0x1a')](_0x80ba3)[_0x7711('0x1c')](_0x222f0c);}};}function respondWithFilteredResult(_0x3c1df7,_0x216478){return function(_0xd9f9e4){if(_0xd9f9e4){var _0x122ff7=_0xd9f9e4['count'],_0x52c310=_0x216478[_0x7711('0x1d')],_0xf78ad=_0x216478[_0x7711('0x1d')]+_0x216478['limit'],_0x559b85;if(_0xf78ad>=_0x122ff7){_0xf78ad=_0x122ff7;_0x559b85=0xc8;}else{_0x559b85=0xce;}_0x3c1df7[_0x7711('0x1a')](_0x559b85);return _0x3c1df7[_0x7711('0x1e')]('Content-Range',_0x52c310+'-'+_0xf78ad+'/'+_0x122ff7)[_0x7711('0x1c')](_0xd9f9e4);}return null;};}function patchUpdates(_0x762ce1){return function(_0x246475){try{jsonpatch[_0x7711('0x1f')](_0x246475,_0x762ce1,!![]);}catch(_0x1e80e3){return BPromise[_0x7711('0x20')](_0x1e80e3);}return _0x246475[_0x7711('0x21')]();};}function saveUpdates(_0x423046,_0x2f0254){return function(_0x5db123){if(_0x5db123){return _0x5db123[_0x7711('0x22')](_0x423046)[_0x7711('0x23')](function(_0x47474b){return _0x47474b;});}return null;};}function removeEntity(_0x470ebc,_0x4a235d){return function(_0x823c7a){if(_0x823c7a){return _0x823c7a[_0x7711('0x24')]()[_0x7711('0x23')](function(){_0x470ebc[_0x7711('0x1a')](0xcc)[_0x7711('0x1b')]();});}};}function handleEntityNotFound(_0x2ffb3c,_0x550694){return function(_0xf6a43d){if(!_0xf6a43d){_0x2ffb3c['sendStatus'](0x194);}return _0xf6a43d;};}function handleError(_0x277063,_0x620e20){_0x620e20=_0x620e20||0x1f4;return function(_0x14bc32){logger[_0x7711('0x25')](_0x14bc32[_0x7711('0x26')]);if(_0x14bc32[_0x7711('0x27')]){delete _0x14bc32[_0x7711('0x27')];}_0x277063[_0x7711('0x1a')](_0x620e20)[_0x7711('0x28')](_0x14bc32);};}exports[_0x7711('0x29')]=function(_0x5cd77e,_0x397fc6){var _0x23de94={'raw':![],'where':{'id':_0x5cd77e['params']['id']}},_0x383f92={};_0x383f92[_0x7711('0x2a')]=_[_0x7711('0x2b')](db[_0x7711('0x2c')][_0x7711('0x2d')]);_0x383f92[_0x7711('0x2e')]=_['keys'](_0x5cd77e[_0x7711('0x2e')]);_0x383f92[_0x7711('0x2f')]=_[_0x7711('0x30')](_0x383f92[_0x7711('0x2a')],_0x383f92[_0x7711('0x2e')]);_0x23de94[_0x7711('0x31')]=_[_0x7711('0x30')](_0x383f92[_0x7711('0x2a')],qs['fields'](_0x5cd77e[_0x7711('0x2e')][_0x7711('0x32')]));_0x23de94[_0x7711('0x31')]=_0x23de94['attributes']['length']?_0x23de94['attributes']:_0x383f92[_0x7711('0x2a')];if(_0x5cd77e['query']['includeAll']){_0x23de94['include']=[{'all':!![]}];}_0x23de94=_['merge']({},_0x23de94,_0x5cd77e[_0x7711('0x33')]);return db['DashboardItem'][_0x7711('0x34')](_0x23de94)[_0x7711('0x23')](handleEntityNotFound(_0x397fc6,null))[_0x7711('0x23')](respondWithResult(_0x397fc6,null))[_0x7711('0x35')](handleError(_0x397fc6,null));};exports[_0x7711('0x24')]=function(_0x50aa0f,_0x3ee48e){return db[_0x7711('0x2c')][_0x7711('0x34')]({'where':{'id':_0x50aa0f['params']['id']}})[_0x7711('0x23')](handleEntityNotFound(_0x3ee48e,null))['then'](removeEntity(_0x3ee48e,null))[_0x7711('0x35')](handleError(_0x3ee48e,null));};function widgetAttributes(_0x3b2c40){try{switch(_0x3b2c40[_0x7711('0x36')]){case _0x7711('0x37'):return[{'name':_0x7711('0x38'),'value':_0x3b2c40['attrUrl']||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40[_0x7711('0x39')][0x0]?_0x3b2c40[_0x7711('0x39')][0x0][_0x7711('0x3a')]:undefined)||_0x7711('0x3b')}];case _0x7711('0x3c'):return[{'name':_0x7711('0x3d'),'value':_0x3b2c40['attrPath']||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40[_0x7711('0x39')][0x0]?_0x3b2c40[_0x7711('0x39')][0x0][_0x7711('0x3a')]:undefined)||''}];case _0x7711('0x3e'):return[{'name':'attrHourFormat','value':_0x3b2c40[_0x7711('0x3f')]||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40[_0x7711('0x39')][0x0]?_0x3b2c40[_0x7711('0x39')][0x0][_0x7711('0x3a')]:undefined)||_0x7711('0x40')},{'name':'attrTimezone','value':_0x3b2c40['attrTimezone']||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40[_0x7711('0x39')][0x1]?_0x3b2c40['attrs'][0x1][_0x7711('0x3a')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x3b2c40[_0x7711('0x41')]||(_0x3b2c40['attrs']&&_0x3b2c40[_0x7711('0x39')][0x2]?_0x3b2c40[_0x7711('0x39')][0x2][_0x7711('0x3a')]:undefined)||0xc}];case _0x7711('0x42'):return[{'name':_0x7711('0x43'),'value':_0x3b2c40[_0x7711('0x43')]||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40[_0x7711('0x39')][0x0]?_0x3b2c40[_0x7711('0x39')][0x0][_0x7711('0x3a')]:undefined)||'total'},{'name':_0x7711('0x44'),'value':_0x3b2c40[_0x7711('0x44')]||(_0x3b2c40['attrs']&&_0x3b2c40[_0x7711('0x39')][0x1]?_0x3b2c40[_0x7711('0x39')][0x1][_0x7711('0x3a')]:undefined)||[]},{'name':_0x7711('0x41'),'value':_0x3b2c40[_0x7711('0x41')]||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40['attrs'][0x2]?_0x3b2c40[_0x7711('0x39')][0x2]['value']:undefined)||0x14}];case _0x7711('0x45'):case _0x7711('0x46'):return[{'name':_0x7711('0x47'),'value':_0x3b2c40[_0x7711('0x47')]||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40[_0x7711('0x39')][0x0]?_0x3b2c40[_0x7711('0x39')][0x0][_0x7711('0x3a')]:undefined)||'total'},{'name':_0x7711('0x48'),'value':_0x3b2c40['attrSerie2']||(_0x3b2c40['attrs']&&_0x3b2c40[_0x7711('0x39')][0x1]?_0x3b2c40['attrs'][0x1]['value']:undefined)||null},{'name':_0x7711('0x49'),'value':_0x3b2c40['attrSerie3']||(_0x3b2c40['attrs']&&_0x3b2c40['attrs'][0x2]?_0x3b2c40['attrs'][0x2]['value']:undefined)||null},{'name':_0x7711('0x44'),'value':_0x3b2c40[_0x7711('0x44')]||(_0x3b2c40['attrs']&&_0x3b2c40[_0x7711('0x39')][0x3]?_0x3b2c40[_0x7711('0x39')][0x3][_0x7711('0x3a')]:undefined)||[]}];case _0x7711('0x4a'):return[{'name':'attrReport','type':_0x3b2c40[_0x7711('0x4b')]||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40['attrs'][0x0]?_0x3b2c40[_0x7711('0x39')][0x0][_0x7711('0x36')]:undefined)||null,'value':_0x3b2c40[_0x7711('0x4c')]||(_0x3b2c40['attrs']&&_0x3b2c40[_0x7711('0x39')][0x0]?_0x3b2c40[_0x7711('0x39')][0x0][_0x7711('0x3a')]:undefined)||null},{'name':_0x7711('0x4d'),'value':_0x3b2c40[_0x7711('0x4d')]||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40[_0x7711('0x39')][0x1]?_0x3b2c40[_0x7711('0x39')][0x1][_0x7711('0x3a')]:undefined)||0x0}];default:return[];}}catch(_0x1dd90d){logger[_0x7711('0x25')](_0x7711('0x4e'),JSON[_0x7711('0x4f')](_0x1dd90d));return[];}}exports[_0x7711('0x50')]=function(_0x268fcb,_0x2c53d7){if(_0x268fcb[_0x7711('0x51')]){_0x268fcb[_0x7711('0x51')]['attrs']=widgetAttributes(_0x268fcb[_0x7711('0x51')]);}return db[_0x7711('0x2c')][_0x7711('0x50')](_0x268fcb[_0x7711('0x51')],{})[_0x7711('0x23')](respondWithResult(_0x2c53d7,0xc9))['catch'](handleError(_0x2c53d7,null));};exports[_0x7711('0x22')]=function(_0x5d2b1e,_0x2aeffd){if(_0x5d2b1e[_0x7711('0x51')]['id']){delete _0x5d2b1e[_0x7711('0x51')]['id'];}_0x5d2b1e[_0x7711('0x51')][_0x7711('0x39')]=widgetAttributes(_0x5d2b1e[_0x7711('0x51')]);return db[_0x7711('0x2c')][_0x7711('0x34')]({'where':{'id':_0x5d2b1e[_0x7711('0x52')]['id']}})[_0x7711('0x23')](handleEntityNotFound(_0x2aeffd,null))['then'](saveUpdates(_0x5d2b1e[_0x7711('0x51')],null))['then'](respondWithResult(_0x2aeffd,null))['catch'](handleError(_0x2aeffd,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 1d28a27..1fb493d 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 _0x60b0=['emit','exports','events','DashboardItem','save','update','remove'];(function(_0xf72786,_0x1a0ddd){var _0x113f3e=function(_0x57337a){while(--_0x57337a){_0xf72786['push'](_0xf72786['shift']());}};_0x113f3e(++_0x1a0ddd);}(_0x60b0,0x136));var _0x060b=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0x60b0[_0x454e6d];return _0x4bc294;};'use strict';var EventEmitter=require(_0x060b('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x060b('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x060b('0x2'),'afterUpdate':_0x060b('0x3'),'afterDestroy':_0x060b('0x4')};function emitEvent(_0x5d9613){return function(_0x551384,_0x2b159d,_0x37c57d){DashboardItemEvents[_0x060b('0x5')](_0x5d9613+':'+_0x551384['id'],_0x551384);DashboardItemEvents['emit'](_0x5d9613,_0x551384);_0x37c57d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x060b('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x7914=['save','update','remove','emit','hook','exports','../../mysqldb','DashboardItem'];(function(_0x38ed5a,_0x435a0b){var _0x520e83=function(_0x3eea7f){while(--_0x3eea7f){_0x38ed5a['push'](_0x38ed5a['shift']());}};_0x520e83(++_0x435a0b);}(_0x7914,0x136));var _0x4791=function(_0x4e13ef,_0x4976c8){_0x4e13ef=_0x4e13ef-0x0;var _0x113664=_0x7914[_0x4e13ef];return _0x113664;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x4791('0x0'))['db'][_0x4791('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4791('0x2'),'afterUpdate':_0x4791('0x3'),'afterDestroy':_0x4791('0x4')};function emitEvent(_0x1e331b){return function(_0x2bd076,_0xc9014f,_0x4eec55){DashboardItemEvents[_0x4791('0x5')](_0x1e331b+':'+_0x2bd076['id'],_0x2bd076);DashboardItemEvents[_0x4791('0x5')](_0x1e331b,_0x2bd076);_0x4eec55(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x4791('0x6')](e,emitEvent(event));}}module[_0x4791('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index f11b355..d83b795 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 _0xb5a5=['DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define'];(function(_0x49f252,_0x2241bf){var _0x57cb8b=function(_0x57f530){while(--_0x57f530){_0x49f252['push'](_0x49f252['shift']());}};_0x57cb8b(++_0x2241bf);}(_0xb5a5,0x17c));var _0x5b5a=function(_0x1b6c0e,_0x13dd5c){_0x1b6c0e=_0x1b6c0e-0x0;var _0x4d99e2=_0xb5a5[_0x1b6c0e];return _0x4d99e2;};'use strict';var _=require(_0x5b5a('0x0'));var util=require(_0x5b5a('0x1'));var logger=require(_0x5b5a('0x2'))(_0x5b5a('0x3'));var moment=require(_0x5b5a('0x4'));var BPromise=require(_0x5b5a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b5a('0x6'));var rimraf=require(_0x5b5a('0x7'));var config=require(_0x5b5a('0x8'));var attributes=require(_0x5b5a('0x9'));module[_0x5b5a('0xa')]=function(_0x3a7300,_0x2ef709){return _0x3a7300[_0x5b5a('0xb')](_0x5b5a('0xc'),attributes,{'tableName':_0x5b5a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac7c=['DashboardItem','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','define'];(function(_0x1cc1f5,_0x3ae510){var _0x5b70c7=function(_0x48d775){while(--_0x48d775){_0x1cc1f5['push'](_0x1cc1f5['shift']());}};_0x5b70c7(++_0x3ae510);}(_0xac7c,0x177));var _0xcac7=function(_0xb7cb72,_0x19d391){_0xb7cb72=_0xb7cb72-0x0;var _0x4b7570=_0xac7c[_0xb7cb72];return _0x4b7570;};'use strict';var _=require(_0xcac7('0x0'));var util=require('util');var logger=require(_0xcac7('0x1'))(_0xcac7('0x2'));var moment=require('moment');var BPromise=require(_0xcac7('0x3'));var rp=require(_0xcac7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcac7('0x5'));var config=require(_0xcac7('0x6'));var attributes=require(_0xcac7('0x7'));module[_0xcac7('0x8')]=function(_0x468afa,_0x5c7f90){return _0x468afa[_0xcac7('0x9')](_0xcac7('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 935744f..cff18b7 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 _0x8d96=['message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x381180,_0x228a5f){var _0x67796e=function(_0x4de131){while(--_0x4de131){_0x381180['push'](_0x381180['shift']());}};_0x67796e(++_0x228a5f);}(_0x8d96,0x91));var _0x68d9=function(_0x391e9c,_0x3b4958){_0x391e9c=_0x391e9c-0x0;var _0x1807da=_0x8d96[_0x391e9c];return _0x1807da;};'use strict';var _=require(_0x68d9('0x0'));var util=require(_0x68d9('0x1'));var moment=require(_0x68d9('0x2'));var BPromise=require(_0x68d9('0x3'));var rs=require(_0x68d9('0x4'));var fs=require('fs');var Redis=require(_0x68d9('0x5'));var db=require(_0x68d9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68d9('0x7'))('rpc');var config=require(_0x68d9('0x8'));var jayson=require(_0x68d9('0x9'));var client=jayson['client'][_0x68d9('0xa')]({'port':0x232a});config[_0x68d9('0xb')]=_[_0x68d9('0xc')](config[_0x68d9('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x68d9('0xb')]));require(_0x68d9('0xd'))[_0x68d9('0xe')](socket);function respondWithRpcPromise(_0x21cdf5,_0x56839d,_0x7bb0ae){return new BPromise(function(_0x515c99,_0x5ea834){return client['request'](_0x21cdf5,_0x7bb0ae)[_0x68d9('0xf')](function(_0x366ec0){logger[_0x68d9('0x10')](_0x68d9('0x11'),_0x56839d,_0x68d9('0x12'));logger[_0x68d9('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x56839d,_0x68d9('0x12'),JSON[_0x68d9('0x14')](_0x366ec0));if(_0x366ec0[_0x68d9('0x15')]){if(_0x366ec0[_0x68d9('0x15')][_0x68d9('0x16')]===0x1f4){logger[_0x68d9('0x15')]('DashboardItem,\x20%s,\x20%s',_0x56839d,_0x366ec0[_0x68d9('0x15')][_0x68d9('0x17')]);return _0x5ea834(_0x366ec0[_0x68d9('0x15')][_0x68d9('0x17')]);}logger[_0x68d9('0x15')](_0x68d9('0x11'),_0x56839d,_0x366ec0[_0x68d9('0x15')][_0x68d9('0x17')]);return _0x515c99(_0x366ec0[_0x68d9('0x15')]['message']);}else{logger[_0x68d9('0x10')](_0x68d9('0x11'),_0x56839d,_0x68d9('0x12'));_0x515c99(_0x366ec0['result']['message']);}})['catch'](function(_0x3ce072){logger[_0x68d9('0x15')]('DashboardItem,\x20%s,\x20%s',_0x56839d,_0x3ce072);_0x5ea834(_0x3ce072);});});} \ No newline at end of file +var _0x31b5=['../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31b5,0x1ab));var _0x531b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x31b5[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x531b('0x0'));var util=require(_0x531b('0x1'));var moment=require(_0x531b('0x2'));var BPromise=require(_0x531b('0x3'));var rs=require(_0x531b('0x4'));var fs=require('fs');var Redis=require(_0x531b('0x5'));var db=require(_0x531b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x531b('0x7'));var config=require(_0x531b('0x8'));var jayson=require(_0x531b('0x9'));var client=jayson[_0x531b('0xa')][_0x531b('0xb')]({'port':0x232a});config['redis']=_[_0x531b('0xc')](config[_0x531b('0xd')],{'host':_0x531b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x531b('0xd')]));require(_0x531b('0xf'))[_0x531b('0x10')](socket);function respondWithRpcPromise(_0x341a57,_0x1b5053,_0x1ac38a){return new BPromise(function(_0x1ca1fb,_0x2e2bd5){return client[_0x531b('0x11')](_0x341a57,_0x1ac38a)[_0x531b('0x12')](function(_0x25d698){logger[_0x531b('0x13')](_0x531b('0x14'),_0x1b5053,_0x531b('0x15'));logger[_0x531b('0x16')](_0x531b('0x17'),_0x1b5053,_0x531b('0x15'),JSON[_0x531b('0x18')](_0x25d698));if(_0x25d698[_0x531b('0x19')]){if(_0x25d698[_0x531b('0x19')]['code']===0x1f4){logger[_0x531b('0x19')](_0x531b('0x14'),_0x1b5053,_0x25d698[_0x531b('0x19')][_0x531b('0x1a')]);return _0x2e2bd5(_0x25d698[_0x531b('0x19')]['message']);}logger[_0x531b('0x19')](_0x531b('0x14'),_0x1b5053,_0x25d698[_0x531b('0x19')]['message']);return _0x1ca1fb(_0x25d698[_0x531b('0x19')][_0x531b('0x1a')]);}else{logger[_0x531b('0x13')]('DashboardItem,\x20%s,\x20%s',_0x1b5053,_0x531b('0x15'));_0x1ca1fb(_0x25d698[_0x531b('0x1b')][_0x531b('0x1a')]);}})[_0x531b('0x1c')](function(_0xd31cea){logger[_0x531b('0x19')](_0x531b('0x14'),_0x1b5053,_0xd31cea);_0x2e2bd5(_0xd31cea);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 04250d2..7031385 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 _0x8341=['remove','update','emit','register','dashboardItem:','./dashboardItem.events','save'];(function(_0x1a1393,_0x37302f){var _0x472c99=function(_0x4f47d2){while(--_0x4f47d2){_0x1a1393['push'](_0x1a1393['shift']());}};_0x472c99(++_0x37302f);}(_0x8341,0xfa));var _0x1834=function(_0x4200c2,_0x59360e){_0x4200c2=_0x4200c2-0x0;var _0x297802=_0x8341[_0x4200c2];return _0x297802;};'use strict';var DashboardItemEvents=require(_0x1834('0x0'));var events=[_0x1834('0x1'),_0x1834('0x2'),_0x1834('0x3')];function createListener(_0xf0cb55,_0x42be64){return function(_0x34f5cc){_0x42be64[_0x1834('0x4')](_0xf0cb55,_0x34f5cc);};}function removeListener(_0xba3eae,_0xb6663f){return function(){DashboardItemEvents['removeListener'](_0xba3eae,_0xb6663f);};}exports[_0x1834('0x5')]=function(_0x2d51e2){for(var _0xfebd71=0x0,_0x25cd0a=events['length'];_0xfebd71<_0x25cd0a;_0xfebd71++){var _0x1c3b31=events[_0xfebd71];var _0x214d0b=createListener(_0x1834('0x6')+_0x1c3b31,_0x2d51e2);DashboardItemEvents['on'](_0x1c3b31,_0x214d0b);}}; \ No newline at end of file +var _0x26f1=['removeListener','length','dashboardItem:','./dashboardItem.events','save','update','emit'];(function(_0x5349ce,_0x1e6ec2){var _0x156fd5=function(_0x58baf7){while(--_0x58baf7){_0x5349ce['push'](_0x5349ce['shift']());}};_0x156fd5(++_0x1e6ec2);}(_0x26f1,0x8f));var _0x126f=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x26f1[_0x2b5eae];return _0x5f3ac9;};'use strict';var DashboardItemEvents=require(_0x126f('0x0'));var events=[_0x126f('0x1'),'remove',_0x126f('0x2')];function createListener(_0x74668c,_0x413fc6){return function(_0x4d52b3){_0x413fc6[_0x126f('0x3')](_0x74668c,_0x4d52b3);};}function removeListener(_0x635df6,_0x1af352){return function(){DashboardItemEvents[_0x126f('0x4')](_0x635df6,_0x1af352);};}exports['register']=function(_0x52ccfa){for(var _0x1e19a8=0x0,_0x397a60=events[_0x126f('0x5')];_0x1e19a8<_0x397a60;_0x1e19a8++){var _0x75838=events[_0x1e19a8];var _0x3d98a5=createListener(_0x126f('0x6')+_0x75838,_0x52ccfa);DashboardItemEvents['on'](_0x75838,_0x3d98a5);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index b920d26..eeadbe8 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 _0x1261=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','show','post','create','put','/:id','isAuthenticated','update','destroy'];(function(_0x41d9fc,_0x41c73d){var _0x27812b=function(_0x276ba3){while(--_0x276ba3){_0x41d9fc['push'](_0x41d9fc['shift']());}};_0x27812b(++_0x41c73d);}(_0x1261,0x144));var _0x1126=function(_0x3bcf9e,_0x148a5d){_0x3bcf9e=_0x3bcf9e-0x0;var _0x1bb37c=_0x1261[_0x3bcf9e];return _0x1bb37c;};'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')]('/:id',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/',auth['isAuthenticated'](),controller[_0x1126('0xc')]);router[_0x1126('0xd')](_0x1126('0xe'),auth[_0x1126('0xf')](),controller[_0x1126('0x10')]);router['delete'](_0x1126('0xe'),auth[_0x1126('0xf')](),controller[_0x1126('0x11')]);module['exports']=router; \ No newline at end of file +var _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','post','create','put','/:id'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0xabce,0x103));var _0xeabc=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xabce[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xeabc('0x5'));var config=require(_0xeabc('0x6'));var controller=require(_0xeabc('0x7'));router['get']('/:id',auth[_0xeabc('0x8')](),controller['show']);router[_0xeabc('0x9')]('/',auth['isAuthenticated'](),controller[_0xeabc('0xa')]);router[_0xeabc('0xb')](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 4ae12bf..708c196 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 _0x0445=['STRING','sequelize','exports'];(function(_0x1934de,_0x16fdb2){var _0x4a79b4=function(_0x5a9f2f){while(--_0x5a9f2f){_0x1934de['push'](_0x1934de['shift']());}};_0x4a79b4(++_0x16fdb2);}(_0x0445,0x6d));var _0x5044=function(_0x5413f5,_0x3154c7){_0x5413f5=_0x5413f5-0x0;var _0x639288=_0x0445[_0x5413f5];return _0x639288;};'use strict';var Sequelize=require(_0x5044('0x0'));module[_0x5044('0x1')]={'name':{'type':Sequelize[_0x5044('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x05a3=['STRING'];(function(_0x3af74d,_0x1e7e2d){var _0x3811a7=function(_0x546cb2){while(--_0x546cb2){_0x3af74d['push'](_0x3af74d['shift']());}};_0x3811a7(++_0x1e7e2d);}(_0x05a3,0x1a3));var _0x305a=function(_0x7cd558,_0x39b5a4){_0x7cd558=_0x7cd558-0x0;var _0x95eeba=_0x05a3[_0x7cd558];return _0x95eeba;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x305a('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 98a400d..06c73ee 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 _0xde63=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','update','then','destroy','get','Dispositions','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','length','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','params','html-pdf'];(function(_0x213f8f,_0x1ff03d){var _0x34df14=function(_0x5e1b05){while(--_0x5e1b05){_0x213f8f['push'](_0x213f8f['shift']());}};_0x34df14(++_0x1ff03d);}(_0xde63,0x1d9));var _0x3de6=function(_0x1ba43c,_0x5bd2e8){_0x1ba43c=_0x1ba43c-0x0;var _0x2f60eb=_0xde63[_0x1ba43c];return _0x2f60eb;};'use strict';var pdf=require(_0x3de6('0x0'));var emlformat=require(_0x3de6('0x1'));var rimraf=require(_0x3de6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3de6('0x3'));var rp=require(_0x3de6('0x4'));var moment=require(_0x3de6('0x5'));var BPromise=require(_0x3de6('0x6'));var Mustache=require(_0x3de6('0x7'));var util=require(_0x3de6('0x8'));var path=require('path');var sox=require(_0x3de6('0x9'));var csv=require(_0x3de6('0xa'));var ejs=require(_0x3de6('0xb'));var fs=require('fs');var _=require(_0x3de6('0xc'));var squel=require(_0x3de6('0xd'));var crypto=require(_0x3de6('0xe'));var jsforce=require(_0x3de6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3de6('0xa'));var querystring=require(_0x3de6('0x10'));var Papa=require(_0x3de6('0x11'));var Redis=require(_0x3de6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3de6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3de6('0x14'));var logger=require(_0x3de6('0x15'))(_0x3de6('0x16'));var utils=require('../../config/utils');var config=require(_0x3de6('0x17'));var db=require(_0x3de6('0x18'))['db'];function respondWithStatusCode(_0x30bc68,_0x36e4b1){_0x36e4b1=_0x36e4b1||0xcc;return function(_0x4c5cf4){if(_0x4c5cf4){return _0x30bc68[_0x3de6('0x19')](_0x36e4b1);}return _0x30bc68[_0x3de6('0x1a')](_0x36e4b1)[_0x3de6('0x1b')]();};}function respondWithResult(_0x2e818a,_0x26e715){_0x26e715=_0x26e715||0xc8;return function(_0x4e7735){if(_0x4e7735){return _0x2e818a[_0x3de6('0x1a')](_0x26e715)[_0x3de6('0x1c')](_0x4e7735);}};}function respondWithFilteredResult(_0x76005d,_0x470494){return function(_0x1e7f63){if(_0x1e7f63){var _0x5dd2b7=_0x1e7f63[_0x3de6('0x1d')],_0x354308=_0x470494[_0x3de6('0x1e')],_0x41163f=_0x470494[_0x3de6('0x1e')]+_0x470494['limit'],_0x12468d;if(_0x41163f>=_0x5dd2b7){_0x41163f=_0x5dd2b7;_0x12468d=0xc8;}else{_0x12468d=0xce;}_0x76005d['status'](_0x12468d);return _0x76005d['set'](_0x3de6('0x1f'),_0x354308+'-'+_0x41163f+'/'+_0x5dd2b7)[_0x3de6('0x1c')](_0x1e7f63);}return null;};}function patchUpdates(_0x43a39c){return function(_0x4c560f){try{jsonpatch['apply'](_0x4c560f,_0x43a39c,!![]);}catch(_0x1daa42){return BPromise[_0x3de6('0x20')](_0x1daa42);}return _0x4c560f['save']();};}function saveUpdates(_0x392ba4,_0x39f347){return function(_0x420e07){if(_0x420e07){return _0x420e07[_0x3de6('0x21')](_0x392ba4)[_0x3de6('0x22')](function(_0x5737aa){return _0x5737aa;});}return null;};}function removeEntity(_0x2ee67e,_0x35f478){return function(_0x501b1f){if(_0x501b1f){return _0x501b1f[_0x3de6('0x23')]()[_0x3de6('0x22')](function(){var _0x58d3b9=_0x501b1f[_0x3de6('0x24')]({'plain':!![]});var _0xb59db7=_0x3de6('0x25');return db['UserProfileResource'][_0x3de6('0x23')]({'where':{'type':_0xb59db7,'resourceId':_0x58d3b9['id']}})[_0x3de6('0x22')](function(){return _0x501b1f;});})[_0x3de6('0x22')](function(){_0x2ee67e['status'](0xcc)[_0x3de6('0x1b')]();});}};}function handleEntityNotFound(_0x3d1992,_0x4234a5){return function(_0x7d5902){if(!_0x7d5902){_0x3d1992[_0x3de6('0x19')](0x194);}return _0x7d5902;};}function handleError(_0x21fab4,_0x3a2f92){_0x3a2f92=_0x3a2f92||0x1f4;return function(_0x53b442){logger[_0x3de6('0x26')](_0x53b442[_0x3de6('0x27')]);if(_0x53b442['name']){delete _0x53b442[_0x3de6('0x28')];}_0x21fab4[_0x3de6('0x1a')](_0x3a2f92)[_0x3de6('0x29')](_0x53b442);};}exports[_0x3de6('0x2a')]=function(_0x36ffcd,_0x455bf6){var _0x188bb1={},_0x165a39={},_0x17eb37={'count':0x0,'rows':[]};var _0x3a1fd3=_[_0x3de6('0x2b')](db[_0x3de6('0x2c')][_0x3de6('0x2d')],function(_0x3cc61c){return{'name':_0x3cc61c[_0x3de6('0x2e')],'type':_0x3cc61c[_0x3de6('0x2f')][_0x3de6('0x30')]};});_0x165a39[_0x3de6('0x31')]=_[_0x3de6('0x2b')](_0x3a1fd3,_0x3de6('0x28'));_0x165a39[_0x3de6('0x32')]=_[_0x3de6('0x33')](_0x36ffcd[_0x3de6('0x32')]);_0x165a39[_0x3de6('0x34')]=_[_0x3de6('0x35')](_0x165a39[_0x3de6('0x31')],_0x165a39[_0x3de6('0x32')]);_0x188bb1[_0x3de6('0x36')]=_['intersection'](_0x165a39['model'],qs[_0x3de6('0x37')](_0x36ffcd[_0x3de6('0x32')][_0x3de6('0x37')]));_0x188bb1['attributes']=_0x188bb1['attributes']['length']?_0x188bb1[_0x3de6('0x36')]:_0x165a39['model'];if(!_0x36ffcd[_0x3de6('0x32')][_0x3de6('0x38')](_0x3de6('0x39'))){_0x188bb1['limit']=qs[_0x3de6('0x3a')](_0x36ffcd['query'][_0x3de6('0x3a')]);_0x188bb1[_0x3de6('0x1e')]=qs[_0x3de6('0x1e')](_0x36ffcd[_0x3de6('0x32')][_0x3de6('0x1e')]);}_0x188bb1[_0x3de6('0x3b')]=qs[_0x3de6('0x3c')](_0x36ffcd[_0x3de6('0x32')]['sort']);_0x188bb1[_0x3de6('0x3d')]=qs[_0x3de6('0x34')](_[_0x3de6('0x3e')](_0x36ffcd['query'],_0x165a39[_0x3de6('0x34')]),_0x3a1fd3);if(_0x36ffcd['query'][_0x3de6('0x3f')]){_0x188bb1[_0x3de6('0x3d')]=_[_0x3de6('0x40')](_0x188bb1[_0x3de6('0x3d')],{'$or':_[_0x3de6('0x2b')](_0x3a1fd3,function(_0xaa734e){if(_0xaa734e[_0x3de6('0x2f')]!==_0x3de6('0x41')){var _0x50b7db={};_0x50b7db[_0xaa734e[_0x3de6('0x28')]]={'$like':'%'+_0x36ffcd[_0x3de6('0x32')][_0x3de6('0x3f')]+'%'};return _0x50b7db;}})});}_0x188bb1=_[_0x3de6('0x40')]({},_0x188bb1,_0x36ffcd['options']);var _0x3d1275={'where':_0x188bb1[_0x3de6('0x3d')]};return db[_0x3de6('0x2c')]['count'](_0x3d1275)['then'](function(_0x1a5296){_0x17eb37['count']=_0x1a5296;if(_0x36ffcd[_0x3de6('0x32')][_0x3de6('0x42')]){_0x188bb1['include']=[{'all':!![]}];}return db[_0x3de6('0x2c')][_0x3de6('0x43')](_0x188bb1);})[_0x3de6('0x22')](function(_0x498d19){_0x17eb37[_0x3de6('0x44')]=_0x498d19;return _0x17eb37;})[_0x3de6('0x22')](respondWithFilteredResult(_0x455bf6,_0x188bb1))[_0x3de6('0x45')](handleError(_0x455bf6,null));};exports[_0x3de6('0x46')]=function(_0x53cb07,_0x19b114){var _0x1d47ed={'raw':!![],'where':{'id':_0x53cb07['params']['id']}},_0x44e46e={};_0x44e46e['model']=_['keys'](db['Disposition'][_0x3de6('0x2d')]);_0x44e46e[_0x3de6('0x32')]=_[_0x3de6('0x33')](_0x53cb07[_0x3de6('0x32')]);_0x44e46e[_0x3de6('0x34')]=_['intersection'](_0x44e46e[_0x3de6('0x31')],_0x44e46e['query']);_0x1d47ed[_0x3de6('0x36')]=_[_0x3de6('0x35')](_0x44e46e['model'],qs[_0x3de6('0x37')](_0x53cb07[_0x3de6('0x32')][_0x3de6('0x37')]));_0x1d47ed[_0x3de6('0x36')]=_0x1d47ed[_0x3de6('0x36')][_0x3de6('0x47')]?_0x1d47ed[_0x3de6('0x36')]:_0x44e46e[_0x3de6('0x31')];if(_0x53cb07[_0x3de6('0x32')][_0x3de6('0x42')]){_0x1d47ed[_0x3de6('0x48')]=[{'all':!![]}];}_0x1d47ed=_['merge']({},_0x1d47ed,_0x53cb07['options']);return db[_0x3de6('0x2c')]['find'](_0x1d47ed)[_0x3de6('0x22')](handleEntityNotFound(_0x19b114,null))['then'](respondWithResult(_0x19b114,null))['catch'](handleError(_0x19b114,null));};exports[_0x3de6('0x49')]=function(_0x25b19e,_0x4f29cc){return db['Disposition'][_0x3de6('0x49')](_0x25b19e[_0x3de6('0x4a')],{})['then'](function(_0x1842ff){var _0x29e3ec=_0x25b19e['user'][_0x3de6('0x24')]({'plain':!![]});if(!_0x29e3ec)throw new Error(_0x3de6('0x4b'));if(_0x29e3ec['role']==='user'){var _0x13b82a=_0x1842ff[_0x3de6('0x24')]({'plain':!![]});var _0x305e99=_0x3de6('0x25');return db['UserProfileSection'][_0x3de6('0x4c')]({'where':{'name':_0x305e99,'userProfileId':_0x29e3ec['userProfileId']},'raw':!![]})[_0x3de6('0x22')](function(_0x1035ed){if(_0x1035ed&&_0x1035ed[_0x3de6('0x4d')]===0x0){return db['UserProfileResource'][_0x3de6('0x49')]({'name':_0x13b82a[_0x3de6('0x28')],'resourceId':_0x13b82a['id'],'type':_0x1035ed['name'],'sectionId':_0x1035ed['id']},{})['then'](function(){return _0x1842ff;});}else{return _0x1842ff;}})[_0x3de6('0x45')](function(_0x26a62b){logger[_0x3de6('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26a62b);throw _0x26a62b;});}return _0x1842ff;})[_0x3de6('0x22')](respondWithResult(_0x4f29cc,0xc9))[_0x3de6('0x45')](handleError(_0x4f29cc,null));};exports[_0x3de6('0x21')]=function(_0x49d2a0,_0x1a12b6){if(_0x49d2a0[_0x3de6('0x4a')]['id']){delete _0x49d2a0[_0x3de6('0x4a')]['id'];}return db['Disposition'][_0x3de6('0x4c')]({'where':{'id':_0x49d2a0[_0x3de6('0x4e')]['id']}})[_0x3de6('0x22')](handleEntityNotFound(_0x1a12b6,null))[_0x3de6('0x22')](saveUpdates(_0x49d2a0['body'],null))[_0x3de6('0x22')](respondWithResult(_0x1a12b6,null))[_0x3de6('0x45')](handleError(_0x1a12b6,null));};exports[_0x3de6('0x23')]=function(_0x195729,_0xfd0345){return db[_0x3de6('0x2c')][_0x3de6('0x4c')]({'where':{'id':_0x195729[_0x3de6('0x4e')]['id']}})['then'](handleEntityNotFound(_0xfd0345,null))[_0x3de6('0x22')](removeEntity(_0xfd0345,null))[_0x3de6('0x45')](handleError(_0xfd0345,null));}; \ No newline at end of file +var _0x8a5f=['error','stack','name','send','map','rawAttributes','fieldName','keys','query','filters','intersection','model','fields','attributes','nolimit','limit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Disposition','includeAll','include','findAll','rows','catch','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','set','Content-Range','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource'];(function(_0x444bef,_0xd0afd7){var _0x67aff7=function(_0x27f3cc){while(--_0x27f3cc){_0x444bef['push'](_0x444bef['shift']());}};_0x67aff7(++_0xd0afd7);}(_0x8a5f,0x1c6));var _0xf8a5=function(_0x11ed6d,_0x157fc0){_0x11ed6d=_0x11ed6d-0x0;var _0x12d2bc=_0x8a5f[_0x11ed6d];return _0x12d2bc;};'use strict';var pdf=require(_0xf8a5('0x0'));var emlformat=require(_0xf8a5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf8a5('0x2'));var jsonpatch=require(_0xf8a5('0x3'));var rp=require(_0xf8a5('0x4'));var moment=require(_0xf8a5('0x5'));var BPromise=require(_0xf8a5('0x6'));var Mustache=require(_0xf8a5('0x7'));var util=require(_0xf8a5('0x8'));var path=require(_0xf8a5('0x9'));var sox=require(_0xf8a5('0xa'));var csv=require('to-csv');var ejs=require(_0xf8a5('0xb'));var fs=require('fs');var _=require(_0xf8a5('0xc'));var squel=require(_0xf8a5('0xd'));var crypto=require('crypto');var jsforce=require(_0xf8a5('0xe'));var deskjs=require(_0xf8a5('0xf'));var toCsv=require(_0xf8a5('0x10'));var querystring=require(_0xf8a5('0x11'));var Papa=require(_0xf8a5('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf8a5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf8a5('0x14'))('api');var utils=require(_0xf8a5('0x15'));var config=require(_0xf8a5('0x16'));var db=require(_0xf8a5('0x17'))['db'];function respondWithStatusCode(_0x2ad1f3,_0x249295){_0x249295=_0x249295||0xcc;return function(_0x40a3c0){if(_0x40a3c0){return _0x2ad1f3['sendStatus'](_0x249295);}return _0x2ad1f3[_0xf8a5('0x18')](_0x249295)[_0xf8a5('0x19')]();};}function respondWithResult(_0x1be6b5,_0x2712e8){_0x2712e8=_0x2712e8||0xc8;return function(_0x15e2c5){if(_0x15e2c5){return _0x1be6b5['status'](_0x2712e8)[_0xf8a5('0x1a')](_0x15e2c5);}};}function respondWithFilteredResult(_0x287bdc,_0x58d560){return function(_0x16bf50){if(_0x16bf50){var _0x149dd1=_0x16bf50[_0xf8a5('0x1b')],_0x7ccd34=_0x58d560['offset'],_0x3b5643=_0x58d560['offset']+_0x58d560['limit'],_0x378143;if(_0x3b5643>=_0x149dd1){_0x3b5643=_0x149dd1;_0x378143=0xc8;}else{_0x378143=0xce;}_0x287bdc[_0xf8a5('0x18')](_0x378143);return _0x287bdc[_0xf8a5('0x1c')](_0xf8a5('0x1d'),_0x7ccd34+'-'+_0x3b5643+'/'+_0x149dd1)[_0xf8a5('0x1a')](_0x16bf50);}return null;};}function patchUpdates(_0x437194){return function(_0x29db3b){try{jsonpatch[_0xf8a5('0x1e')](_0x29db3b,_0x437194,!![]);}catch(_0x2f9ea6){return BPromise[_0xf8a5('0x1f')](_0x2f9ea6);}return _0x29db3b[_0xf8a5('0x20')]();};}function saveUpdates(_0x508433,_0x179ced){return function(_0x90b6d){if(_0x90b6d){return _0x90b6d[_0xf8a5('0x21')](_0x508433)[_0xf8a5('0x22')](function(_0x3a0251){return _0x3a0251;});}return null;};}function removeEntity(_0x2126df,_0x316653){return function(_0x1ec6f1){if(_0x1ec6f1){return _0x1ec6f1[_0xf8a5('0x23')]()['then'](function(){var _0x92c1ec=_0x1ec6f1['get']({'plain':!![]});var _0x4ee38c=_0xf8a5('0x24');return db[_0xf8a5('0x25')][_0xf8a5('0x23')]({'where':{'type':_0x4ee38c,'resourceId':_0x92c1ec['id']}})['then'](function(){return _0x1ec6f1;});})[_0xf8a5('0x22')](function(){_0x2126df[_0xf8a5('0x18')](0xcc)[_0xf8a5('0x19')]();});}};}function handleEntityNotFound(_0x3d156b,_0x236d5a){return function(_0x36b7e6){if(!_0x36b7e6){_0x3d156b['sendStatus'](0x194);}return _0x36b7e6;};}function handleError(_0x5f0a8a,_0x4c1424){_0x4c1424=_0x4c1424||0x1f4;return function(_0x29f76d){logger[_0xf8a5('0x26')](_0x29f76d[_0xf8a5('0x27')]);if(_0x29f76d[_0xf8a5('0x28')]){delete _0x29f76d[_0xf8a5('0x28')];}_0x5f0a8a[_0xf8a5('0x18')](_0x4c1424)[_0xf8a5('0x29')](_0x29f76d);};}exports['index']=function(_0x469e14,_0x3eb5a2){var _0x1114d9={},_0x177e6f={},_0x39c115={'count':0x0,'rows':[]};var _0x2cdf79=_[_0xf8a5('0x2a')](db['Disposition'][_0xf8a5('0x2b')],function(_0x29aca7){return{'name':_0x29aca7[_0xf8a5('0x2c')],'type':_0x29aca7['type']['key']};});_0x177e6f['model']=_[_0xf8a5('0x2a')](_0x2cdf79,'name');_0x177e6f['query']=_[_0xf8a5('0x2d')](_0x469e14[_0xf8a5('0x2e')]);_0x177e6f[_0xf8a5('0x2f')]=_[_0xf8a5('0x30')](_0x177e6f['model'],_0x177e6f[_0xf8a5('0x2e')]);_0x1114d9['attributes']=_['intersection'](_0x177e6f[_0xf8a5('0x31')],qs[_0xf8a5('0x32')](_0x469e14[_0xf8a5('0x2e')][_0xf8a5('0x32')]));_0x1114d9[_0xf8a5('0x33')]=_0x1114d9[_0xf8a5('0x33')]['length']?_0x1114d9[_0xf8a5('0x33')]:_0x177e6f[_0xf8a5('0x31')];if(!_0x469e14['query']['hasOwnProperty'](_0xf8a5('0x34'))){_0x1114d9['limit']=qs[_0xf8a5('0x35')](_0x469e14[_0xf8a5('0x2e')][_0xf8a5('0x35')]);_0x1114d9[_0xf8a5('0x36')]=qs['offset'](_0x469e14[_0xf8a5('0x2e')][_0xf8a5('0x36')]);}_0x1114d9[_0xf8a5('0x37')]=qs[_0xf8a5('0x38')](_0x469e14['query']['sort']);_0x1114d9[_0xf8a5('0x39')]=qs['filters'](_[_0xf8a5('0x3a')](_0x469e14[_0xf8a5('0x2e')],_0x177e6f[_0xf8a5('0x2f')]),_0x2cdf79);if(_0x469e14['query'][_0xf8a5('0x3b')]){_0x1114d9[_0xf8a5('0x39')]=_[_0xf8a5('0x3c')](_0x1114d9[_0xf8a5('0x39')],{'$or':_[_0xf8a5('0x2a')](_0x2cdf79,function(_0x566400){if(_0x566400[_0xf8a5('0x3d')]!==_0xf8a5('0x3e')){var _0x55ee02={};_0x55ee02[_0x566400[_0xf8a5('0x28')]]={'$like':'%'+_0x469e14[_0xf8a5('0x2e')]['filter']+'%'};return _0x55ee02;}})});}_0x1114d9=_['merge']({},_0x1114d9,_0x469e14[_0xf8a5('0x3f')]);var _0x149a94={'where':_0x1114d9['where']};return db[_0xf8a5('0x40')][_0xf8a5('0x1b')](_0x149a94)[_0xf8a5('0x22')](function(_0x234436){_0x39c115[_0xf8a5('0x1b')]=_0x234436;if(_0x469e14[_0xf8a5('0x2e')][_0xf8a5('0x41')]){_0x1114d9[_0xf8a5('0x42')]=[{'all':!![]}];}return db['Disposition'][_0xf8a5('0x43')](_0x1114d9);})['then'](function(_0x187b48){_0x39c115[_0xf8a5('0x44')]=_0x187b48;return _0x39c115;})[_0xf8a5('0x22')](respondWithFilteredResult(_0x3eb5a2,_0x1114d9))[_0xf8a5('0x45')](handleError(_0x3eb5a2,null));};exports['show']=function(_0x52b5ac,_0x389e4b){var _0x547e3a={'raw':!![],'where':{'id':_0x52b5ac['params']['id']}},_0x4c3b68={};_0x4c3b68['model']=_[_0xf8a5('0x2d')](db[_0xf8a5('0x40')][_0xf8a5('0x2b')]);_0x4c3b68[_0xf8a5('0x2e')]=_[_0xf8a5('0x2d')](_0x52b5ac[_0xf8a5('0x2e')]);_0x4c3b68[_0xf8a5('0x2f')]=_[_0xf8a5('0x30')](_0x4c3b68[_0xf8a5('0x31')],_0x4c3b68[_0xf8a5('0x2e')]);_0x547e3a[_0xf8a5('0x33')]=_['intersection'](_0x4c3b68['model'],qs['fields'](_0x52b5ac[_0xf8a5('0x2e')][_0xf8a5('0x32')]));_0x547e3a[_0xf8a5('0x33')]=_0x547e3a[_0xf8a5('0x33')][_0xf8a5('0x46')]?_0x547e3a[_0xf8a5('0x33')]:_0x4c3b68[_0xf8a5('0x31')];if(_0x52b5ac[_0xf8a5('0x2e')][_0xf8a5('0x41')]){_0x547e3a[_0xf8a5('0x42')]=[{'all':!![]}];}_0x547e3a=_['merge']({},_0x547e3a,_0x52b5ac[_0xf8a5('0x3f')]);return db[_0xf8a5('0x40')]['find'](_0x547e3a)[_0xf8a5('0x22')](handleEntityNotFound(_0x389e4b,null))[_0xf8a5('0x22')](respondWithResult(_0x389e4b,null))[_0xf8a5('0x45')](handleError(_0x389e4b,null));};exports[_0xf8a5('0x47')]=function(_0x20bea0,_0x4960d2){return db[_0xf8a5('0x40')][_0xf8a5('0x47')](_0x20bea0[_0xf8a5('0x48')],{})[_0xf8a5('0x22')](function(_0x568f19){var _0x3a791a=_0x20bea0[_0xf8a5('0x49')][_0xf8a5('0x4a')]({'plain':!![]});if(!_0x3a791a)throw new Error(_0xf8a5('0x4b'));if(_0x3a791a[_0xf8a5('0x4c')]===_0xf8a5('0x49')){var _0x243273=_0x568f19[_0xf8a5('0x4a')]({'plain':!![]});var _0xef339f=_0xf8a5('0x24');return db[_0xf8a5('0x4d')][_0xf8a5('0x4e')]({'where':{'name':_0xef339f,'userProfileId':_0x3a791a['userProfileId']},'raw':!![]})[_0xf8a5('0x22')](function(_0x1d1457){if(_0x1d1457&&_0x1d1457[_0xf8a5('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x243273[_0xf8a5('0x28')],'resourceId':_0x243273['id'],'type':_0x1d1457['name'],'sectionId':_0x1d1457['id']},{})[_0xf8a5('0x22')](function(){return _0x568f19;});}else{return _0x568f19;}})[_0xf8a5('0x45')](function(_0x2c176d){logger[_0xf8a5('0x26')](_0xf8a5('0x50'),_0x2c176d);throw _0x2c176d;});}return _0x568f19;})[_0xf8a5('0x22')](respondWithResult(_0x4960d2,0xc9))['catch'](handleError(_0x4960d2,null));};exports[_0xf8a5('0x21')]=function(_0x416449,_0x461c52){if(_0x416449[_0xf8a5('0x48')]['id']){delete _0x416449[_0xf8a5('0x48')]['id'];}return db[_0xf8a5('0x40')][_0xf8a5('0x4e')]({'where':{'id':_0x416449['params']['id']}})[_0xf8a5('0x22')](handleEntityNotFound(_0x461c52,null))[_0xf8a5('0x22')](saveUpdates(_0x416449[_0xf8a5('0x48')],null))[_0xf8a5('0x22')](respondWithResult(_0x461c52,null))['catch'](handleError(_0x461c52,null));};exports['destroy']=function(_0x51f4bc,_0x500a11){return db['Disposition']['find']({'where':{'id':_0x51f4bc[_0xf8a5('0x51')]['id']}})[_0xf8a5('0x22')](handleEntityNotFound(_0x500a11,null))[_0xf8a5('0x22')](removeEntity(_0x500a11,null))[_0xf8a5('0x45')](handleError(_0x500a11,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2316724..9a81f76 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 _0x3bf2=['path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1a3eff,_0x24f105){var _0x26b839=function(_0xf3fa70){while(--_0xf3fa70){_0x1a3eff['push'](_0x1a3eff['shift']());}};_0x26b839(++_0x24f105);}(_0x3bf2,0x167));var _0x23bf=function(_0x4322c6,_0x28f126){_0x4322c6=_0x4322c6-0x0;var _0x4e7537=_0x3bf2[_0x4322c6];return _0x4e7537;};'use strict';var _=require(_0x23bf('0x0'));var util=require('util');var logger=require(_0x23bf('0x1'))(_0x23bf('0x2'));var moment=require(_0x23bf('0x3'));var BPromise=require(_0x23bf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23bf('0x5'));var rimraf=require(_0x23bf('0x6'));var config=require(_0x23bf('0x7'));var attributes=require(_0x23bf('0x8'));module['exports']=function(_0x2292e8,_0x4c6a78){return _0x2292e8[_0x23bf('0x9')](_0x23bf('0xa'),attributes,{'tableName':_0x23bf('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x23bf('0xc'),'fields':[_0x23bf('0xd'),_0x23bf('0xe')]},{'unique':!![],'name':_0x23bf('0xf'),'fields':[_0x23bf('0xd'),_0x23bf('0x10')]},{'unique':!![],'name':_0x23bf('0x11'),'fields':[_0x23bf('0xd'),_0x23bf('0x12')]},{'unique':!![],'name':_0x23bf('0x13'),'fields':['name',_0x23bf('0x14')]},{'unique':!![],'name':_0x23bf('0x15'),'fields':[_0x23bf('0xd'),_0x23bf('0x16')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0x23bf('0x17')]},{'unique':!![],'name':_0x23bf('0x18'),'fields':[_0x23bf('0xd'),_0x23bf('0x19')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ac6=['name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x0ac6,0xd2));var _0x60ac=function(_0x42b27c,_0x4fd06b){_0x42b27c=_0x42b27c-0x0;var _0xd30c2=_0x0ac6[_0x42b27c];return _0xd30c2;};'use strict';var _=require(_0x60ac('0x0'));var util=require(_0x60ac('0x1'));var logger=require(_0x60ac('0x2'))('api');var moment=require('moment');var BPromise=require(_0x60ac('0x3'));var rp=require(_0x60ac('0x4'));var fs=require('fs');var path=require(_0x60ac('0x5'));var rimraf=require(_0x60ac('0x6'));var config=require(_0x60ac('0x7'));var attributes=require(_0x60ac('0x8'));module[_0x60ac('0x9')]=function(_0x3b5a8e,_0x440bd5){return _0x3b5a8e[_0x60ac('0xa')]('Disposition',attributes,{'tableName':_0x60ac('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x60ac('0xc'),'fields':[_0x60ac('0xd'),_0x60ac('0xe')]},{'unique':!![],'name':_0x60ac('0xf'),'fields':['name',_0x60ac('0x10')]},{'unique':!![],'name':_0x60ac('0x11'),'fields':[_0x60ac('0xd'),_0x60ac('0x12')]},{'unique':!![],'name':_0x60ac('0x13'),'fields':['name',_0x60ac('0x14')]},{'unique':!![],'name':_0x60ac('0x15'),'fields':[_0x60ac('0xd'),_0x60ac('0x16')]},{'unique':!![],'name':_0x60ac('0x17'),'fields':[_0x60ac('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':_0x60ac('0x18'),'fields':[_0x60ac('0xd'),_0x60ac('0x19')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 291b87b..4c8eeac 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 _0x2198=['Disposition,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xb58502,_0x5b30ab){var _0x466ce9=function(_0xd82d6c){while(--_0xd82d6c){_0xb58502['push'](_0xb58502['shift']());}};_0x466ce9(++_0x5b30ab);}(_0x2198,0x9f));var _0x8219=function(_0x25c019,_0xd5a5b8){_0x25c019=_0x25c019-0x0;var _0x41950d=_0x2198[_0x25c019];return _0x41950d;};'use strict';var _=require(_0x8219('0x0'));var util=require('util');var moment=require(_0x8219('0x1'));var BPromise=require(_0x8219('0x2'));var rs=require(_0x8219('0x3'));var fs=require('fs');var Redis=require(_0x8219('0x4'));var db=require(_0x8219('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8219('0x6'))('rpc');var config=require(_0x8219('0x7'));var jayson=require(_0x8219('0x8'));var client=jayson[_0x8219('0x9')][_0x8219('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x164944,_0x5d7abd,_0x2eeeb8){return new BPromise(function(_0x3a3e29,_0x1976a6){return client[_0x8219('0xb')](_0x164944,_0x2eeeb8)[_0x8219('0xc')](function(_0x45e41e){logger[_0x8219('0xd')](_0x8219('0xe'),_0x5d7abd,_0x8219('0xf'));logger[_0x8219('0x10')](_0x8219('0x11'),_0x5d7abd,'request\x20sent',JSON['stringify'](_0x45e41e));if(_0x45e41e[_0x8219('0x12')]){if(_0x45e41e[_0x8219('0x12')][_0x8219('0x13')]===0x1f4){logger[_0x8219('0x12')](_0x8219('0xe'),_0x5d7abd,_0x45e41e['error'][_0x8219('0x14')]);return _0x1976a6(_0x45e41e[_0x8219('0x12')]['message']);}logger[_0x8219('0x12')](_0x8219('0xe'),_0x5d7abd,_0x45e41e[_0x8219('0x12')]['message']);return _0x3a3e29(_0x45e41e['error'][_0x8219('0x14')]);}else{logger[_0x8219('0xd')]('Disposition,\x20%s,\x20%s',_0x5d7abd,_0x8219('0xf'));_0x3a3e29(_0x45e41e['result']['message']);}})[_0x8219('0x15')](function(_0x5bdf62){logger['error']('Disposition,\x20%s,\x20%s',_0x5d7abd,_0x5bdf62);_0x1976a6(_0x5bdf62);});});} \ No newline at end of file +var _0xcd99=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xa6b46b,_0x4dbf09){var _0x8cfe43=function(_0x3f4d9c){while(--_0x3f4d9c){_0xa6b46b['push'](_0xa6b46b['shift']());}};_0x8cfe43(++_0x4dbf09);}(_0xcd99,0x15d));var _0x9cd9=function(_0x4f5c17,_0x4e2658){_0x4f5c17=_0x4f5c17-0x0;var _0x1129da=_0xcd99[_0x4f5c17];return _0x1129da;};'use strict';var _=require(_0x9cd9('0x0'));var util=require(_0x9cd9('0x1'));var moment=require(_0x9cd9('0x2'));var BPromise=require(_0x9cd9('0x3'));var rs=require(_0x9cd9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9cd9('0x5'))['db'];var utils=require(_0x9cd9('0x6'));var logger=require('../../config/logger')(_0x9cd9('0x7'));var config=require(_0x9cd9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9cd9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f2cf4,_0x5f0f02,_0xd9ef14){return new BPromise(function(_0x1a9895,_0x4c164d){return client[_0x9cd9('0xa')](_0x5f2cf4,_0xd9ef14)[_0x9cd9('0xb')](function(_0x366c93){logger[_0x9cd9('0xc')](_0x9cd9('0xd'),_0x5f0f02,_0x9cd9('0xe'));logger[_0x9cd9('0xf')](_0x9cd9('0x10'),_0x5f0f02,'request\x20sent',JSON[_0x9cd9('0x11')](_0x366c93));if(_0x366c93[_0x9cd9('0x12')]){if(_0x366c93[_0x9cd9('0x12')][_0x9cd9('0x13')]===0x1f4){logger[_0x9cd9('0x12')](_0x9cd9('0xd'),_0x5f0f02,_0x366c93['error'][_0x9cd9('0x14')]);return _0x4c164d(_0x366c93[_0x9cd9('0x12')][_0x9cd9('0x14')]);}logger['error'](_0x9cd9('0xd'),_0x5f0f02,_0x366c93['error']['message']);return _0x1a9895(_0x366c93[_0x9cd9('0x12')][_0x9cd9('0x14')]);}else{logger[_0x9cd9('0xc')]('Disposition,\x20%s,\x20%s',_0x5f0f02,'request\x20sent');_0x1a9895(_0x366c93[_0x9cd9('0x15')][_0x9cd9('0x14')]);}})[_0x9cd9('0x16')](function(_0x1ae56c){logger[_0x9cd9('0x12')](_0x9cd9('0xd'),_0x5f0f02,_0x1ae56c);_0x4c164d(_0x1ae56c);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 504e8f5..63260bd 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 _0xbff2=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id','destroy','exports'];(function(_0x556f19,_0x15ea04){var _0x1add52=function(_0x105adf){while(--_0x105adf){_0x556f19['push'](_0x556f19['shift']());}};_0x1add52(++_0x15ea04);}(_0xbff2,0x10e));var _0x2bff=function(_0x1ef04f,_0x5ad9b8){_0x1ef04f=_0x1ef04f-0x0;var _0x5c3e79=_0xbff2[_0x1ef04f];return _0x5c3e79;};'use strict';var multer=require(_0x2bff('0x0'));var util=require(_0x2bff('0x1'));var path=require(_0x2bff('0x2'));var timeout=require(_0x2bff('0x3'));var express=require(_0x2bff('0x4'));var router=express[_0x2bff('0x5')]();var auth=require(_0x2bff('0x6'));var interaction=require(_0x2bff('0x7'));var config=require(_0x2bff('0x8'));var controller=require('./disposition.controller');router[_0x2bff('0x9')]('/',auth[_0x2bff('0xa')](),controller['index']);router['get']('/:id',auth[_0x2bff('0xa')](),controller[_0x2bff('0xb')]);router['post']('/',auth[_0x2bff('0xa')](),controller['create']);router['put'](_0x2bff('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x2bff('0xc'),auth['isAuthenticated'](),controller[_0x2bff('0xd')]);module[_0x2bff('0xe')]=router; \ No newline at end of file +var _0x39d2=['../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1f6adc,_0x27b160){var _0x3eeba6=function(_0x25910c){while(--_0x25910c){_0x1f6adc['push'](_0x1f6adc['shift']());}};_0x3eeba6(++_0x27b160);}(_0x39d2,0xf5));var _0x239d=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x39d2[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x239d('0x0'));var util=require('util');var path=require(_0x239d('0x1'));var timeout=require(_0x239d('0x2'));var express=require(_0x239d('0x3'));var router=express[_0x239d('0x4')]();var auth=require(_0x239d('0x5'));var interaction=require(_0x239d('0x6'));var config=require(_0x239d('0x7'));var controller=require(_0x239d('0x8'));router[_0x239d('0x9')]('/',auth[_0x239d('0xa')](),controller[_0x239d('0xb')]);router[_0x239d('0x9')](_0x239d('0xc'),auth['isAuthenticated'](),controller[_0x239d('0xd')]);router[_0x239d('0xe')]('/',auth[_0x239d('0xa')](),controller[_0x239d('0xf')]);router[_0x239d('0x10')](_0x239d('0xc'),auth[_0x239d('0xa')](),controller[_0x239d('0x11')]);router[_0x239d('0x12')](_0x239d('0xc'),auth[_0x239d('0xa')](),controller[_0x239d('0x13')]);module[_0x239d('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index bf0e444..3e5e0ee 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 _0x0767=['9600','12000','14400','v17,v27,v29','INTEGER','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','2400','4800','7200'];(function(_0xfe4d6f,_0x1488ce){var _0x5748e5=function(_0x13d546){while(--_0x13d546){_0xfe4d6f['push'](_0xfe4d6f['shift']());}};_0x5748e5(++_0x1488ce);}(_0x0767,0x1a0));var _0x7076=function(_0x18a078,_0xfb6032){_0x18a078=_0x18a078-0x0;var _0x27b869=_0x0767[_0x18a078];return _0x27b869;};'use strict';var Sequelize=require(_0x7076('0x0'));module[_0x7076('0x1')]={'name':{'type':Sequelize[_0x7076('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7076('0x2')]},'ecm':{'type':Sequelize[_0x7076('0x3')](_0x7076('0x4'),'no'),'defaultValue':_0x7076('0x4')},'headerinfo':{'type':Sequelize[_0x7076('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x7076('0x2')],'unique':_0x7076('0x5')},'minrate':{'type':Sequelize[_0x7076('0x3')](_0x7076('0x6'),_0x7076('0x7'),_0x7076('0x8'),_0x7076('0x9'),'12000','14400'),'defaultValue':_0x7076('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0x7076('0x6'),_0x7076('0x7'),_0x7076('0x8'),_0x7076('0x9'),_0x7076('0xa'),_0x7076('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x7076('0x2')],'defaultValue':_0x7076('0xc')},'gateway':{'type':Sequelize[_0x7076('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x7076('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x7076('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x7076('0x3')]('SIP','IAX',_0x7076('0xe'),_0x7076('0xf')),'defaultValue':_0x7076('0x10')},'key':{'type':Sequelize[_0x7076('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7076('0x11')],'defaultValue':function(){return _0x7076('0x12');}},'notificationSound':{'type':Sequelize[_0x7076('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7076('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7076('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7076('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7076('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7076('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x7076('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x7076('0x13')],'defaultValue':![],'comment':_0x7076('0x15'),'set':function(_0x2fcdfc){if(!_0x2fcdfc)this[_0x7076('0x16')](_0x7076('0x17'),null);this[_0x7076('0x16')](_0x7076('0x18'),_0x2fcdfc);}}}; \ No newline at end of file +var _0x0194=['7200','14400','9600','12000','v17,v27,v29','IAX','KHOMP','SIP','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800'];(function(_0x2e8c3a,_0x56ab17){var _0x4d7311=function(_0x12e45d){while(--_0x12e45d){_0x2e8c3a['push'](_0x2e8c3a['shift']());}};_0x4d7311(++_0x56ab17);}(_0x0194,0x101));var _0x4019=function(_0x28cb43,_0x226e0c){_0x28cb43=_0x28cb43-0x0;var _0x153f7a=_0x0194[_0x28cb43];return _0x153f7a;};'use strict';var Sequelize=require(_0x4019('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4019('0x1')]},'ecm':{'type':Sequelize[_0x4019('0x2')](_0x4019('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x4019('0x1')],'defaultValue':_0x4019('0x4')},'localstationid':{'type':Sequelize[_0x4019('0x1')],'unique':_0x4019('0x5')},'minrate':{'type':Sequelize[_0x4019('0x2')]('2400',_0x4019('0x6'),_0x4019('0x7'),'9600','12000',_0x4019('0x8')),'defaultValue':_0x4019('0x6')},'maxrate':{'type':Sequelize[_0x4019('0x2')]('2400',_0x4019('0x6'),'7200',_0x4019('0x9'),_0x4019('0xa'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x4019('0x1')],'defaultValue':_0x4019('0xb')},'gateway':{'type':Sequelize[_0x4019('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4019('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4019('0x2')]('SIP',_0x4019('0xc'),'DADHI',_0x4019('0xd')),'defaultValue':_0x4019('0xe')},'key':{'type':Sequelize[_0x4019('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4019('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4019('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4019('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4019('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4019('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4019('0x11')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4019('0x12'),'set':function(_0x3d6593){if(!_0x3d6593)this[_0x4019('0x13')](_0x4019('0x14'),null);this[_0x4019('0x13')](_0x4019('0x15'),_0x3d6593);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 80b7597..f5f2601 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 _0x3f3e=['Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','sequelize','VoiceExtension','updateAccountApplications','createdAt','updatedAt','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','send','List','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','defaults','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','options','create','body','user','role','FaxAccounts','UserProfileSection','autoAssociation','update','find','describe','FaxAccountId','getDispositions','findOne','Disposition','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','faxdetect','headerinfo','modem','t38timeout','FAXOPT('];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0x3f3e,0x1b8));var _0xe3f3=function(_0x5aa138,_0x35973c){_0x5aa138=_0x5aa138-0x0;var _0x515ddc=_0x3f3e[_0x5aa138];return _0x515ddc;};'use strict';var pdf=require(_0xe3f3('0x0'));var emlformat=require(_0xe3f3('0x1'));var rimraf=require(_0xe3f3('0x2'));var zipdir=require(_0xe3f3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe3f3('0x4'));var BPromise=require(_0xe3f3('0x5'));var Mustache=require(_0xe3f3('0x6'));var util=require(_0xe3f3('0x7'));var path=require(_0xe3f3('0x8'));var sox=require(_0xe3f3('0x9'));var csv=require(_0xe3f3('0xa'));var ejs=require(_0xe3f3('0xb'));var fs=require('fs');var _=require(_0xe3f3('0xc'));var squel=require('squel');var crypto=require(_0xe3f3('0xd'));var jsforce=require(_0xe3f3('0xe'));var deskjs=require(_0xe3f3('0xf'));var toCsv=require(_0xe3f3('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe3f3('0x10'));var authService=require(_0xe3f3('0x11'));var qs=require(_0xe3f3('0x12'));var as=require(_0xe3f3('0x13'));var hardwareService=require(_0xe3f3('0x14'));var logger=require(_0xe3f3('0x15'))('api');var utils=require(_0xe3f3('0x16'));var config=require(_0xe3f3('0x17'));var db=require(_0xe3f3('0x18'))['db'];config[_0xe3f3('0x19')]=_['defaults'](config[_0xe3f3('0x19')],{'host':_0xe3f3('0x1a'),'port':0x18eb});var socket=require(_0xe3f3('0x1b'))(new Redis(config[_0xe3f3('0x19')]));require(_0xe3f3('0x1c'))[_0xe3f3('0x1d')](socket);var jayson=require(_0xe3f3('0x1e'));var client=jayson[_0xe3f3('0x1f')][_0xe3f3('0x20')]({'port':0x232c});var client9002=jayson[_0xe3f3('0x1f')][_0xe3f3('0x20')]({'port':0x232a});function checkPasswordPattern(_0x106297,_0x3e30f9,_0x1c2221){if(_0x1c2221){var _0x5f3008=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5f3008[_0xe3f3('0x21')](_0x3e30f9)){return _0x106297;}else{throw new db['Sequelize'][(_0xe3f3('0x22'))](_0xe3f3('0x23'));}}else{return _0x106297;}}function respondWithRpcPromise(_0x505645,_0x622454,_0xb5ae4d,_0x2489a3){return new BPromise(function(_0x4bc5ae,_0x46766b){var _0xfe7463=_0x2489a3||client;return _0xfe7463[_0xe3f3('0x24')](_0x505645,_0xb5ae4d)['then'](function(_0xb0bcbd){logger[_0xe3f3('0x25')](_0xe3f3('0x26'),_0x622454,_0xe3f3('0x27'));logger[_0xe3f3('0x28')](_0xe3f3('0x29'),_0x622454,_0xe3f3('0x27'),JSON[_0xe3f3('0x2a')](_0xb0bcbd));if(_0xb0bcbd[_0xe3f3('0x2b')]){if(_0xb0bcbd[_0xe3f3('0x2b')]['code']===0x1f4){logger[_0xe3f3('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x622454,_0xb0bcbd[_0xe3f3('0x2b')][_0xe3f3('0x2c')]);return _0x46766b(_0xb0bcbd['error'][_0xe3f3('0x2c')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x622454,_0xb0bcbd[_0xe3f3('0x2b')][_0xe3f3('0x2c')]);return _0x4bc5ae(_0xb0bcbd['error'][_0xe3f3('0x2c')]);}else{logger[_0xe3f3('0x25')](_0xe3f3('0x26'),_0x622454,_0xe3f3('0x27'));_0x4bc5ae(_0xb0bcbd['result'][_0xe3f3('0x2c')]);}})[_0xe3f3('0x2d')](function(_0x5203f8){logger['error']('FaxAccount,\x20%s,\x20%s',_0x622454,_0x5203f8);_0x46766b(_0x5203f8);});});}function respondWithStatusCode(_0xa8da23,_0x3f7f6b){_0x3f7f6b=_0x3f7f6b||0xcc;return function(_0xc147ce){if(_0xc147ce){return _0xa8da23['sendStatus'](_0x3f7f6b);}return _0xa8da23[_0xe3f3('0x2e')](_0x3f7f6b)[_0xe3f3('0x2f')]();};}function respondWithResult(_0x92f38b,_0x78bbcf){_0x78bbcf=_0x78bbcf||0xc8;return function(_0x137a83){if(_0x137a83){return _0x92f38b['status'](_0x78bbcf)[_0xe3f3('0x30')](_0x137a83);}};}function respondWithFilteredResult(_0x585f4c,_0x45481a){return function(_0x17b0b5){if(_0x17b0b5){var _0x5136c2=_0x17b0b5[_0xe3f3('0x31')],_0x438bfb=_0x45481a[_0xe3f3('0x32')],_0x47a6a9=_0x45481a[_0xe3f3('0x32')]+_0x45481a[_0xe3f3('0x33')],_0x2a8c15;if(_0x47a6a9>=_0x5136c2){_0x47a6a9=_0x5136c2;_0x2a8c15=0xc8;}else{_0x2a8c15=0xce;}_0x585f4c[_0xe3f3('0x2e')](_0x2a8c15);return _0x585f4c['set'](_0xe3f3('0x34'),_0x438bfb+'-'+_0x47a6a9+'/'+_0x5136c2)[_0xe3f3('0x30')](_0x17b0b5);}return null;};}function patchUpdates(_0x10b4dd){return function(_0x354ddc){try{jsonpatch[_0xe3f3('0x35')](_0x354ddc,_0x10b4dd,!![]);}catch(_0x331206){return BPromise[_0xe3f3('0x36')](_0x331206);}return _0x354ddc[_0xe3f3('0x37')]();};}function saveUpdates(_0x4cba53,_0x362071){return function(_0x352e61){if(_0x352e61){return _0x352e61['update'](_0x4cba53)[_0xe3f3('0x38')](function(_0x4e356a){return _0x4e356a;});}return null;};}function removeEntity(_0x169ec1,_0x39a28f){return function(_0x449cd5){if(_0x449cd5){return _0x449cd5['destroy']()[_0xe3f3('0x38')](function(){var _0x133302=_0x449cd5[_0xe3f3('0x39')]({'plain':!![]});var _0x11bdf1='FaxAccounts';return db[_0xe3f3('0x3a')][_0xe3f3('0x3b')]({'where':{'type':_0x11bdf1,'resourceId':_0x133302['id']}})[_0xe3f3('0x38')](function(){return _0x449cd5;});})[_0xe3f3('0x38')](function(){_0x169ec1[_0xe3f3('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cd0dc,_0x6ef60){return function(_0x3d050c){if(!_0x3d050c){_0x4cd0dc['sendStatus'](0x194);}return _0x3d050c;};}function handleError(_0x1468ad,_0x57f4cb){_0x57f4cb=_0x57f4cb||0x1f4;return function(_0x537739){logger[_0xe3f3('0x2b')](_0x537739[_0xe3f3('0x3c')]);if(_0x537739[_0xe3f3('0x3d')]){delete _0x537739[_0xe3f3('0x3d')];}_0x1468ad[_0xe3f3('0x2e')](_0x57f4cb)['send'](_0x537739);};}exports[_0xe3f3('0x3e')]=function(_0x1bdeac,_0xda83f9){var _0x100bc8={'include':[{'model':db[_0xe3f3('0x3f')],'as':_0xe3f3('0x40')}]},_0x4793bd={},_0x7795b5={'count':0x0,'rows':[]};var _0x1176cd=_[_0xe3f3('0x41')](db[_0xe3f3('0x42')][_0xe3f3('0x43')],function(_0x2377a8){return{'name':_0x2377a8[_0xe3f3('0x44')],'type':_0x2377a8['type'][_0xe3f3('0x45')]};});_0x4793bd['model']=_[_0xe3f3('0x41')](_0x1176cd,_0xe3f3('0x3d'));_0x4793bd[_0xe3f3('0x46')]=_[_0xe3f3('0x47')](_0x1bdeac[_0xe3f3('0x46')]);_0x4793bd[_0xe3f3('0x48')]=_[_0xe3f3('0x49')](_0x4793bd[_0xe3f3('0x4a')],_0x4793bd[_0xe3f3('0x46')]);_0x100bc8[_0xe3f3('0x4b')]=_['intersection'](_0x4793bd[_0xe3f3('0x4a')],qs['fields'](_0x1bdeac[_0xe3f3('0x46')][_0xe3f3('0x4c')]));_0x100bc8['attributes']=_0x100bc8[_0xe3f3('0x4b')][_0xe3f3('0x4d')]?_0x100bc8[_0xe3f3('0x4b')]:_0x4793bd[_0xe3f3('0x4a')];if(!_0x1bdeac[_0xe3f3('0x46')][_0xe3f3('0x4e')]('nolimit')){_0x100bc8[_0xe3f3('0x33')]=qs['limit'](_0x1bdeac[_0xe3f3('0x46')]['limit']);_0x100bc8[_0xe3f3('0x32')]=qs['offset'](_0x1bdeac[_0xe3f3('0x46')][_0xe3f3('0x32')]);}_0x100bc8[_0xe3f3('0x4f')]=qs[_0xe3f3('0x50')](_0x1bdeac[_0xe3f3('0x46')][_0xe3f3('0x50')]);_0x100bc8[_0xe3f3('0x51')]=qs[_0xe3f3('0x48')](_[_0xe3f3('0x52')](_0x1bdeac[_0xe3f3('0x46')],_0x4793bd['filters']),_0x1176cd);if(_0x1bdeac['query'][_0xe3f3('0x53')]){_0x100bc8[_0xe3f3('0x51')]=_[_0xe3f3('0x54')](_0x100bc8[_0xe3f3('0x51')],{'$or':_[_0xe3f3('0x41')](_0x1176cd,function(_0xfd1438){if(_0xfd1438[_0xe3f3('0x55')]!==_0xe3f3('0x56')){var _0x562090={};_0x562090[_0xfd1438[_0xe3f3('0x3d')]]={'$like':'%'+_0x1bdeac[_0xe3f3('0x46')][_0xe3f3('0x53')]+'%'};return _0x562090;}})});}_0x100bc8=_[_0xe3f3('0x54')]({},_0x100bc8,_0x1bdeac['options']);var _0x20831d={'where':_0x100bc8[_0xe3f3('0x51')]};return db[_0xe3f3('0x42')][_0xe3f3('0x31')](_0x20831d)['then'](function(_0xc6be95){_0x7795b5[_0xe3f3('0x31')]=_0xc6be95;if(_0x1bdeac[_0xe3f3('0x46')][_0xe3f3('0x57')]){_0x100bc8[_0xe3f3('0x58')]=[{'all':!![]}];}return db[_0xe3f3('0x42')][_0xe3f3('0x59')](_0x100bc8);})[_0xe3f3('0x38')](function(_0x139d16){_0x7795b5[_0xe3f3('0x5a')]=_0x139d16;return _0x7795b5;})['then'](respondWithFilteredResult(_0xda83f9,_0x100bc8))[_0xe3f3('0x2d')](handleError(_0xda83f9,null));};exports['show']=function(_0x2da5db,_0x9a784c){var _0x23fa01={'raw':![],'where':{'id':_0x2da5db[_0xe3f3('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xe3f3('0x40')}]},_0x225726={};_0x225726[_0xe3f3('0x4a')]=_[_0xe3f3('0x47')](db['FaxAccount'][_0xe3f3('0x43')]);_0x225726[_0xe3f3('0x46')]=_[_0xe3f3('0x47')](_0x2da5db[_0xe3f3('0x46')]);_0x225726['filters']=_[_0xe3f3('0x49')](_0x225726[_0xe3f3('0x4a')],_0x225726[_0xe3f3('0x46')]);_0x23fa01[_0xe3f3('0x4b')]=_['intersection'](_0x225726['model'],qs['fields'](_0x2da5db[_0xe3f3('0x46')][_0xe3f3('0x4c')]));_0x23fa01[_0xe3f3('0x4b')]=_0x23fa01[_0xe3f3('0x4b')][_0xe3f3('0x4d')]?_0x23fa01[_0xe3f3('0x4b')]:_0x225726[_0xe3f3('0x4a')];if(_0x2da5db[_0xe3f3('0x46')][_0xe3f3('0x57')]){_0x23fa01[_0xe3f3('0x58')]=[{'all':!![]}];}_0x23fa01=_[_0xe3f3('0x54')]({},_0x23fa01,_0x2da5db[_0xe3f3('0x5c')]);return db[_0xe3f3('0x42')]['find'](_0x23fa01)[_0xe3f3('0x38')](handleEntityNotFound(_0x9a784c,null))[_0xe3f3('0x38')](respondWithResult(_0x9a784c,null))[_0xe3f3('0x2d')](handleError(_0x9a784c,null));};exports[_0xe3f3('0x5d')]=function(_0x1c58c6,_0xce8413){return db[_0xe3f3('0x42')][_0xe3f3('0x5d')](_0x1c58c6[_0xe3f3('0x5e')],{})[_0xe3f3('0x38')](function(_0x4b6a70){var _0x4fd286=_0x1c58c6[_0xe3f3('0x5f')]['get']({'plain':!![]});if(!_0x4fd286)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fd286[_0xe3f3('0x60')]===_0xe3f3('0x5f')){var _0x48746d=_0x4b6a70[_0xe3f3('0x39')]({'plain':!![]});var _0x2d03b7=_0xe3f3('0x61');return db[_0xe3f3('0x62')]['find']({'where':{'name':_0x2d03b7,'userProfileId':_0x4fd286['userProfileId']},'raw':!![]})[_0xe3f3('0x38')](function(_0x4751b3){if(_0x4751b3&&_0x4751b3[_0xe3f3('0x63')]===0x0){return db[_0xe3f3('0x3a')][_0xe3f3('0x5d')]({'name':_0x48746d['name'],'resourceId':_0x48746d['id'],'type':_0x4751b3[_0xe3f3('0x3d')],'sectionId':_0x4751b3['id']},{})[_0xe3f3('0x38')](function(){return _0x4b6a70;});}else{return _0x4b6a70;}})[_0xe3f3('0x2d')](function(_0xc5114b){logger[_0xe3f3('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc5114b);throw _0xc5114b;});}return _0x4b6a70;})[_0xe3f3('0x38')](respondWithResult(_0xce8413,0xc9))[_0xe3f3('0x2d')](handleError(_0xce8413,null));};exports[_0xe3f3('0x64')]=function(_0x43a02a,_0x56d1a5){if(_0x43a02a[_0xe3f3('0x5e')]['id']){delete _0x43a02a[_0xe3f3('0x5e')]['id'];}return db['FaxAccount'][_0xe3f3('0x65')]({'where':{'id':_0x43a02a['params']['id']},'include':[{'model':db[_0xe3f3('0x3f')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x56d1a5,null))[_0xe3f3('0x38')](saveUpdates(_0x43a02a[_0xe3f3('0x5e')],null))[_0xe3f3('0x38')](respondWithResult(_0x56d1a5,null))['catch'](handleError(_0x56d1a5,null));};exports['destroy']=function(_0x3d8a7e,_0x487f5e){return db[_0xe3f3('0x42')][_0xe3f3('0x65')]({'where':{'id':_0x3d8a7e[_0xe3f3('0x5b')]['id']}})[_0xe3f3('0x38')](handleEntityNotFound(_0x487f5e,null))[_0xe3f3('0x38')](removeEntity(_0x487f5e,null))[_0xe3f3('0x2d')](handleError(_0x487f5e,null));};exports[_0xe3f3('0x66')]=function(_0x1598f2,_0x1e4062){return db[_0xe3f3('0x42')]['describe']()['then'](respondWithResult(_0x1e4062,null))[_0xe3f3('0x2d')](handleError(_0x1e4062,null));};exports['addDisposition']=function(_0x2b3456,_0x1513b5,_0x56f7dd){if(_0x2b3456[_0xe3f3('0x5e')]['id']){delete _0x2b3456[_0xe3f3('0x5e')]['id'];}return db['FaxAccount'][_0xe3f3('0x65')]({'where':{'id':_0x2b3456['params']['id']}})['then'](handleEntityNotFound(_0x1513b5,null))[_0xe3f3('0x38')](function(_0x110646){if(_0x110646){_0x2b3456['body'][_0xe3f3('0x67')]=_0x110646['id'];return db['Disposition'][_0xe3f3('0x5d')](_0x2b3456[_0xe3f3('0x5e')]);}})['then'](respondWithResult(_0x1513b5,null))[_0xe3f3('0x2d')](handleError(_0x1513b5,null));};exports[_0xe3f3('0x68')]=function(_0x3a9494,_0x42aa3e,_0x2ffdea){var _0x5319bd={'raw':![],'where':{}};var _0x4b8072={};var _0x25ff6c={'count':0x0,'rows':[]};return db[_0xe3f3('0x42')][_0xe3f3('0x69')]({'where':{'id':_0x3a9494['params']['id']}})[_0xe3f3('0x38')](handleEntityNotFound(_0x42aa3e,null))[_0xe3f3('0x38')](function(_0x32d23b){if(_0x32d23b){_0x4b8072[_0xe3f3('0x4a')]=_['keys'](db[_0xe3f3('0x6a')]['rawAttributes']);_0x4b8072[_0xe3f3('0x46')]=_[_0xe3f3('0x47')](_0x3a9494[_0xe3f3('0x46')]);_0x4b8072[_0xe3f3('0x48')]=_[_0xe3f3('0x49')](_0x4b8072['model'],_0x4b8072[_0xe3f3('0x46')]);_0x5319bd[_0xe3f3('0x4b')]=_[_0xe3f3('0x49')](_0x4b8072['model'],qs['fields'](_0x3a9494[_0xe3f3('0x46')]['fields']));_0x5319bd[_0xe3f3('0x4b')]=_0x5319bd[_0xe3f3('0x4b')]['length']?_0x5319bd[_0xe3f3('0x4b')]:_0x4b8072[_0xe3f3('0x4a')];if(!_0x3a9494['query'][_0xe3f3('0x4e')](_0xe3f3('0x6b'))){_0x5319bd['limit']=qs['limit'](_0x3a9494[_0xe3f3('0x46')][_0xe3f3('0x33')]);_0x5319bd['offset']=qs[_0xe3f3('0x32')](_0x3a9494[_0xe3f3('0x46')][_0xe3f3('0x32')]);}_0x5319bd[_0xe3f3('0x4f')]=qs[_0xe3f3('0x50')](_0x3a9494['query']['sort']);_0x5319bd[_0xe3f3('0x51')]=qs[_0xe3f3('0x48')](_[_0xe3f3('0x52')](_0x3a9494[_0xe3f3('0x46')],_0x4b8072[_0xe3f3('0x48')]));_0x5319bd[_0xe3f3('0x51')]['FaxAccountId']=_0x32d23b['id'];if(_0x3a9494[_0xe3f3('0x46')][_0xe3f3('0x53')]){_0x5319bd[_0xe3f3('0x51')]=_[_0xe3f3('0x54')](_0x5319bd[_0xe3f3('0x51')],{'$or':_[_0xe3f3('0x41')](_0x5319bd[_0xe3f3('0x4b')],function(_0x2d8c3){var _0x5111e5={};_0x5111e5[_0x2d8c3]={'$like':'%'+_0x3a9494['query'][_0xe3f3('0x53')]+'%'};return _0x5111e5;})});}_0x5319bd=_[_0xe3f3('0x54')]({},_0x5319bd,_0x3a9494[_0xe3f3('0x5c')]);return db[_0xe3f3('0x6a')][_0xe3f3('0x31')]({'where':_0x5319bd[_0xe3f3('0x51')]})[_0xe3f3('0x38')](function(_0x3c8646){_0x25ff6c[_0xe3f3('0x31')]=_0x3c8646;if(_0x3a9494[_0xe3f3('0x46')][_0xe3f3('0x57')]){_0x5319bd[_0xe3f3('0x58')]=[{'all':!![]}];}return db[_0xe3f3('0x6a')][_0xe3f3('0x59')](_0x5319bd);})[_0xe3f3('0x38')](function(_0x2d31b6){_0x25ff6c['rows']=_0x2d31b6;return _0x25ff6c;});}})[_0xe3f3('0x38')](respondWithFilteredResult(_0x42aa3e,_0x5319bd))['catch'](handleError(_0x42aa3e,null));};exports[_0xe3f3('0x6c')]=function(_0x50557b,_0x1c47ca,_0x350d8d){return db[_0xe3f3('0x42')]['find']({'where':{'id':_0x50557b[_0xe3f3('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1c47ca,null))['then'](function(_0xc42306){if(_0xc42306){return _0xc42306[_0xe3f3('0x6c')](_0x50557b[_0xe3f3('0x46')][_0xe3f3('0x6d')]);}})[_0xe3f3('0x38')](respondWithStatusCode(_0x1c47ca,null))[_0xe3f3('0x2d')](handleError(_0x1c47ca,null));};exports[_0xe3f3('0x6e')]=function(_0x51bd8c,_0x5ae855,_0x36d08b){if(_0x51bd8c[_0xe3f3('0x5e')]['id']){delete _0x51bd8c['body']['id'];}return db[_0xe3f3('0x42')]['find']({'where':{'id':_0x51bd8c[_0xe3f3('0x5b')]['id']}})[_0xe3f3('0x38')](handleEntityNotFound(_0x5ae855,null))[_0xe3f3('0x38')](function(_0x18b81a){if(_0x18b81a){_0x51bd8c[_0xe3f3('0x5e')][_0xe3f3('0x67')]=_0x18b81a['id'];return db[_0xe3f3('0x6f')]['create'](_0x51bd8c[_0xe3f3('0x5e')]);}})[_0xe3f3('0x38')](respondWithResult(_0x5ae855,null))[_0xe3f3('0x2d')](handleError(_0x5ae855,null));};exports['getAnswers']=function(_0x24decc,_0x335ace,_0x22842b){var _0x2008ec={'raw':![],'where':{}};var _0x4cb648={};var _0x8cdfdb={'count':0x0,'rows':[]};return db[_0xe3f3('0x42')][_0xe3f3('0x69')]({'where':{'id':_0x24decc[_0xe3f3('0x5b')]['id']}})['then'](handleEntityNotFound(_0x335ace,null))['then'](function(_0x22ccab){if(_0x22ccab){_0x4cb648[_0xe3f3('0x4a')]=_['keys'](db[_0xe3f3('0x6f')]['rawAttributes']);_0x4cb648[_0xe3f3('0x46')]=_[_0xe3f3('0x47')](_0x24decc[_0xe3f3('0x46')]);_0x4cb648[_0xe3f3('0x48')]=_[_0xe3f3('0x49')](_0x4cb648[_0xe3f3('0x4a')],_0x4cb648[_0xe3f3('0x46')]);_0x2008ec['attributes']=_[_0xe3f3('0x49')](_0x4cb648['model'],qs[_0xe3f3('0x4c')](_0x24decc[_0xe3f3('0x46')][_0xe3f3('0x4c')]));_0x2008ec[_0xe3f3('0x4b')]=_0x2008ec[_0xe3f3('0x4b')][_0xe3f3('0x4d')]?_0x2008ec[_0xe3f3('0x4b')]:_0x4cb648[_0xe3f3('0x4a')];if(!_0x24decc[_0xe3f3('0x46')][_0xe3f3('0x4e')]('nolimit')){_0x2008ec[_0xe3f3('0x33')]=qs['limit'](_0x24decc[_0xe3f3('0x46')][_0xe3f3('0x33')]);_0x2008ec[_0xe3f3('0x32')]=qs['offset'](_0x24decc['query'][_0xe3f3('0x32')]);}_0x2008ec[_0xe3f3('0x4f')]=qs['sort'](_0x24decc['query'][_0xe3f3('0x50')]);_0x2008ec[_0xe3f3('0x51')]=qs['filters'](_[_0xe3f3('0x52')](_0x24decc[_0xe3f3('0x46')],_0x4cb648[_0xe3f3('0x48')]));_0x2008ec[_0xe3f3('0x51')][_0xe3f3('0x67')]=_0x22ccab['id'];if(_0x24decc[_0xe3f3('0x46')][_0xe3f3('0x53')]){_0x2008ec[_0xe3f3('0x51')]=_['merge'](_0x2008ec[_0xe3f3('0x51')],{'$or':_['map'](_0x2008ec[_0xe3f3('0x4b')],function(_0x27c218){var _0x795344={};_0x795344[_0x27c218]={'$like':'%'+_0x24decc[_0xe3f3('0x46')][_0xe3f3('0x53')]+'%'};return _0x795344;})});}_0x2008ec=_[_0xe3f3('0x54')]({},_0x2008ec,_0x24decc[_0xe3f3('0x5c')]);return db[_0xe3f3('0x6f')]['count']({'where':_0x2008ec[_0xe3f3('0x51')]})[_0xe3f3('0x38')](function(_0x36c7a6){_0x8cdfdb[_0xe3f3('0x31')]=_0x36c7a6;if(_0x24decc[_0xe3f3('0x46')][_0xe3f3('0x57')]){_0x2008ec['include']=[{'all':!![]}];}return db[_0xe3f3('0x6f')][_0xe3f3('0x59')](_0x2008ec);})['then'](function(_0x2d12e1){_0x8cdfdb['rows']=_0x2d12e1;return _0x8cdfdb;});}})[_0xe3f3('0x38')](respondWithFilteredResult(_0x335ace,_0x2008ec))[_0xe3f3('0x2d')](handleError(_0x335ace,null));};exports[_0xe3f3('0x70')]=function(_0x493f54,_0x3bcb85,_0x4ab474){return db[_0xe3f3('0x42')][_0xe3f3('0x65')]({'where':{'id':_0x493f54['params']['id']}})['then'](handleEntityNotFound(_0x3bcb85,null))[_0xe3f3('0x38')](function(_0x15ebf1){if(_0x15ebf1){return _0x15ebf1['removeAnswers'](_0x493f54[_0xe3f3('0x46')][_0xe3f3('0x6d')]);}})[_0xe3f3('0x38')](respondWithStatusCode(_0x3bcb85,null))[_0xe3f3('0x2d')](handleError(_0x3bcb85,null));};exports[_0xe3f3('0x71')]=function(_0x57dadd,_0x1b0873,_0x1aea11){return db[_0xe3f3('0x72')][_0xe3f3('0x65')]({'where':{'id':_0x57dadd['params']['id']}})[_0xe3f3('0x38')](handleEntityNotFound(_0x1b0873,null))['then'](function(_0x1f81e3){if(_0x1f81e3){return _0x1f81e3['addInteraction'](_0x57dadd['body'][_0xe3f3('0x6d')],_[_0xe3f3('0x73')](_0x57dadd[_0xe3f3('0x5e')],[_0xe3f3('0x6d'),'id'])||{});}})[_0xe3f3('0x38')](respondWithResult(_0x1b0873,null))[_0xe3f3('0x2d')](handleError(_0x1b0873,null));};exports[_0xe3f3('0x74')]=function(_0x208937,_0x38e4ab,_0x338f21){var _0x10290c={'raw':![],'where':{}};var _0x484714={};var _0x32572c={'count':0x0,'rows':[]};return db[_0xe3f3('0x42')][_0xe3f3('0x69')]({'where':{'id':_0x208937['params']['id']}})['then'](handleEntityNotFound(_0x38e4ab,null))['then'](function(_0x5798b8){if(_0x5798b8){_0x484714[_0xe3f3('0x4a')]=_[_0xe3f3('0x47')](db[_0xe3f3('0x72')]['rawAttributes']);_0x484714['query']=_[_0xe3f3('0x47')](_0x208937[_0xe3f3('0x46')]);_0x484714['filters']=_[_0xe3f3('0x49')](_0x484714[_0xe3f3('0x4a')],_0x484714['query']);_0x10290c[_0xe3f3('0x4b')]=_['intersection'](_0x484714[_0xe3f3('0x4a')],qs[_0xe3f3('0x4c')](_0x208937[_0xe3f3('0x46')][_0xe3f3('0x4c')]));_0x10290c[_0xe3f3('0x4b')]=_0x10290c[_0xe3f3('0x4b')][_0xe3f3('0x4d')]?_0x10290c[_0xe3f3('0x4b')]:_0x484714['model'];if(!_0x208937[_0xe3f3('0x46')][_0xe3f3('0x4e')](_0xe3f3('0x6b'))){_0x10290c[_0xe3f3('0x33')]=qs[_0xe3f3('0x33')](_0x208937['query'][_0xe3f3('0x33')]);_0x10290c['offset']=qs[_0xe3f3('0x32')](_0x208937[_0xe3f3('0x46')][_0xe3f3('0x32')]);}_0x10290c[_0xe3f3('0x4f')]=qs['sort'](_0x208937[_0xe3f3('0x46')][_0xe3f3('0x50')]);_0x10290c[_0xe3f3('0x51')]=qs[_0xe3f3('0x48')](_['pick'](_0x208937[_0xe3f3('0x46')],_0x484714[_0xe3f3('0x48')]));_0x10290c[_0xe3f3('0x51')][_0xe3f3('0x67')]=_0x5798b8['id'];if(_0x208937[_0xe3f3('0x46')][_0xe3f3('0x53')]){_0x10290c[_0xe3f3('0x51')]=_[_0xe3f3('0x54')](_0x10290c['where'],{'$or':_[_0xe3f3('0x41')](_0x10290c[_0xe3f3('0x4b')],function(_0x5abd58){var _0x2037d1={};_0x2037d1[_0x5abd58]={'$like':'%'+_0x208937['query'][_0xe3f3('0x53')]+'%'};return _0x2037d1;})});}_0x10290c=_[_0xe3f3('0x54')]({},_0x10290c,_0x208937[_0xe3f3('0x5c')]);return db[_0xe3f3('0x72')]['count']({'where':_0x10290c[_0xe3f3('0x51')]})['then'](function(_0x33e7e0){_0x32572c[_0xe3f3('0x31')]=_0x33e7e0;if(_0x208937['query'][_0xe3f3('0x57')]){_0x10290c['include']=[{'model':db[_0xe3f3('0x75')],'as':_0xe3f3('0x76'),'required':![]},{'model':db[_0xe3f3('0x77')],'as':_0xe3f3('0x78'),'attributes':[_0xe3f3('0x3d'),_0xe3f3('0x79'),_0xe3f3('0x7a')],'required':![]},{'model':db[_0xe3f3('0x7b')],'as':'Tags','attributes':['id',_0xe3f3('0x3d'),_0xe3f3('0x7c')],'where':_0x208937['query'][_0xe3f3('0x7d')]?{'id':_0x208937['query']['tag']}:undefined,'required':_0x208937[_0xe3f3('0x46')][_0xe3f3('0x7d')]?!![]:![]}];}return db[_0xe3f3('0x72')]['findAll'](_0x10290c);})[_0xe3f3('0x38')](function(_0x3011ff){_0x32572c[_0xe3f3('0x5a')]=_0x3011ff;return _0x32572c;});}})[_0xe3f3('0x38')](respondWithFilteredResult(_0x38e4ab,_0x10290c))['catch'](handleError(_0x38e4ab,null));};exports[_0xe3f3('0x7e')]=function(_0x21010e,_0x50a629,_0x1492fe){return db[_0xe3f3('0x42')][_0xe3f3('0x69')]({'where':{'id':_0x21010e[_0xe3f3('0x5b')]['id']}})[_0xe3f3('0x38')](handleEntityNotFound(_0x50a629,null))[_0xe3f3('0x38')](function(_0x4c9769){if(_0x4c9769){return db['sequelize'][_0xe3f3('0x7f')](function(_0x4b4dd7){return db[_0xe3f3('0x80')][_0xe3f3('0x3b')]({'where':{'FaxAccountId':_0x21010e[_0xe3f3('0x5b')]['id']},'transaction':_0x4b4dd7})[_0xe3f3('0x38')](function(_0x5f5b87){var _0x5afb27=_['map'](_0x21010e[_0xe3f3('0x5e')],function(_0xd93a75){_0xd93a75['FaxAccountId']=_0x21010e['params']['id'];return _0xd93a75;});return db[_0xe3f3('0x80')][_0xe3f3('0x81')](_0x5afb27,{'transaction':_0x4b4dd7});});})['then'](function(){return db[_0xe3f3('0x80')][_0xe3f3('0x82')]({'where':{'FaxAccountId':_0x21010e['params']['id']},'order':_0xe3f3('0x83')});});}})[_0xe3f3('0x38')](respondWithResult(_0x50a629,null))['catch'](handleError(_0x50a629,null));};exports[_0xe3f3('0x84')]=function(_0x1d2ee9,_0x51b2ff,_0x3d1105){var _0x2eab3a={};var _0x2a4dea={};var _0x32ed68;var _0x1e97cb;return db['FaxAccount'][_0xe3f3('0x69')]({'where':{'id':_0x1d2ee9['params']['id']}})[_0xe3f3('0x38')](handleEntityNotFound(_0x51b2ff,null))[_0xe3f3('0x38')](function(_0x59715f){if(_0x59715f){_0x32ed68=_0x59715f;_0x2a4dea['model']=_['keys'](db[_0xe3f3('0x80')][_0xe3f3('0x43')]);_0x2a4dea['query']=_[_0xe3f3('0x47')](_0x1d2ee9[_0xe3f3('0x46')]);_0x2a4dea[_0xe3f3('0x48')]=_['intersection'](_0x2a4dea[_0xe3f3('0x4a')],_0x2a4dea['query']);_0x2eab3a[_0xe3f3('0x4b')]=_['intersection'](_0x2a4dea[_0xe3f3('0x4a')],qs[_0xe3f3('0x4c')](_0x1d2ee9[_0xe3f3('0x46')][_0xe3f3('0x4c')]));_0x2eab3a[_0xe3f3('0x4b')]=_0x2eab3a[_0xe3f3('0x4b')]['length']?_0x2eab3a[_0xe3f3('0x4b')]:_0x2a4dea[_0xe3f3('0x4a')];_0x2eab3a['order']=qs[_0xe3f3('0x50')](_0x1d2ee9[_0xe3f3('0x46')][_0xe3f3('0x50')]);_0x2eab3a[_0xe3f3('0x51')]=qs[_0xe3f3('0x48')](_[_0xe3f3('0x52')](_0x1d2ee9[_0xe3f3('0x46')],_0x2a4dea[_0xe3f3('0x48')]));if(_0x1d2ee9[_0xe3f3('0x46')][_0xe3f3('0x53')]){_0x2eab3a[_0xe3f3('0x51')]=_['merge'](_0x2eab3a[_0xe3f3('0x51')],{'$or':_[_0xe3f3('0x41')](_0x2eab3a[_0xe3f3('0x4b')],function(_0x4d4b4f){var _0x31814f={};_0x31814f[_0x4d4b4f]={'$like':'%'+_0x1d2ee9[_0xe3f3('0x46')][_0xe3f3('0x53')]+'%'};return _0x31814f;})});}_0x2eab3a=_['merge']({},_0x2eab3a,_0x1d2ee9['options']);return _0x32ed68[_0xe3f3('0x84')](_0x2eab3a);}})[_0xe3f3('0x38')](function(_0x3ae75a){if(_0x3ae75a){_0x1e97cb=_0x3ae75a[_0xe3f3('0x4d')];if(!_0x1d2ee9['query'][_0xe3f3('0x4e')](_0xe3f3('0x6b'))){_0x2eab3a[_0xe3f3('0x33')]=qs[_0xe3f3('0x33')](_0x1d2ee9[_0xe3f3('0x46')]['limit']);_0x2eab3a['offset']=qs[_0xe3f3('0x32')](_0x1d2ee9[_0xe3f3('0x46')][_0xe3f3('0x32')]);}return _0x32ed68[_0xe3f3('0x84')](_0x2eab3a);}})[_0xe3f3('0x38')](function(_0x351789){if(_0x351789){return _0x351789?{'count':_0x1e97cb,'rows':_0x351789}:null;}})['then'](respondWithResult(_0x51b2ff,null))['catch'](handleError(_0x51b2ff,null));};function Extension(_0x34ec37,_0x2842e1,_0x74f6ec,_0x58d70e){this['context']=_0xe3f3('0x85');this[_0xe3f3('0x86')]=_0x34ec37[_0xe3f3('0x87')];this[_0xe3f3('0x88')]=_0x58d70e;this[_0xe3f3('0x55')]=_0xe3f3('0x89');this[_0xe3f3('0x8a')]=_0xe3f3('0x8b');this['FaxAccountId']=_0x34ec37['id'];this[_0xe3f3('0x83')]=_0x2842e1;this[_0xe3f3('0x8c')]=_0x74f6ec;}function createExtensionsReciveFax(_0x41b333){var _0x3aa3ff=0x1;var _0x3af365=[];_0x3af365[_0xe3f3('0x8d')](new Extension(_0x41b333,_0x3aa3ff,'',_0xe3f3('0x8e')));_0x3aa3ff+=0x1;_0x3af365[_0xe3f3('0x8d')](new Extension(_0x41b333,_0x3aa3ff,'CDR(type)=inbound-fax',_0xe3f3('0x8f')));_0x3aa3ff+=0x1;for(var _0x500092 in _0x41b333){if(_0x41b333[_0xe3f3('0x4e')](_0x500092)&&(_0x500092===_0xe3f3('0x90')||_0x500092==='localstationid'||_0x500092===_0xe3f3('0x91')||_0x500092===_0xe3f3('0x92')||_0x500092===_0xe3f3('0x93')||_0x500092==='maxrate'||_0x500092==='minrate'||_0x500092===_0xe3f3('0x94')||_0x500092===_0xe3f3('0x95'))){_0x3af365[_0xe3f3('0x8d')](new Extension(_0x41b333,_0x3aa3ff,_0xe3f3('0x96')+_0x500092+')='+_0x41b333[_0x500092],_0xe3f3('0x8f')));_0x3aa3ff+=0x1;}}_0x3af365['push'](new Extension(_0x41b333,_0x3aa3ff,'6',_0xe3f3('0x97')));_0x3aa3ff+=0x1;_0x3af365[_0xe3f3('0x8d')](new Extension(_0x41b333,_0x3aa3ff,_0xe3f3('0x98'),_0xe3f3('0x99')));_0x3aa3ff=0x0;return _0x3af365;}exports[_0xe3f3('0x9a')]=function(_0x50983a,_0xae95a0,_0xfea4ea){var _0x20d348;return db[_0xe3f3('0x9b')][_0xe3f3('0x7f')](function(_0x2b9505){return db[_0xe3f3('0x42')][_0xe3f3('0x5d')](_0x50983a['body'],{'transaction':_0x2b9505})[_0xe3f3('0x38')](function(_0x437002){_0x20d348=_0x437002[_0xe3f3('0x39')]({'plain':!![]});return db[_0xe3f3('0x9c')][_0xe3f3('0x81')](createExtensionsReciveFax(_0x20d348),{'transaction':_0x2b9505});});})[_0xe3f3('0x38')](function(){return _0x20d348;})[_0xe3f3('0x38')](respondWithResult(_0xae95a0,null))[_0xe3f3('0x2d')](handleError(_0xae95a0,null));};exports[_0xe3f3('0x9d')]=function(_0x1178e6,_0x4a4c16,_0x33c333){var _0x638512;return db[_0xe3f3('0x9b')][_0xe3f3('0x7f')](function(_0x3fff9f){return db['FaxAccount'][_0xe3f3('0x64')](_0x1178e6['body'],{'where':{'id':_0x1178e6['body']['id']},'transaction':_0x3fff9f})['then'](function(_0x15eda1){return db['VoiceExtension'][_0xe3f3('0x3b')]({'where':{'FaxAccountId':_0x1178e6['body']['id']},'transaction':_0x3fff9f})[_0xe3f3('0x38')](function(_0x3bd8a4){return db[_0xe3f3('0x9c')][_0xe3f3('0x81')](createExtensionsReciveFax(_[_0xe3f3('0x73')](_0x1178e6[_0xe3f3('0x5e')],['tech',_0xe3f3('0x45'),_0xe3f3('0x9e'),_0xe3f3('0x9f'),'TrunkId',_0xe3f3('0xa0')])),{'transaction':_0x3fff9f});});});})[_0xe3f3('0x38')](function(){return db[_0xe3f3('0x42')][_0xe3f3('0xa1')](_0x1178e6[_0xe3f3('0x5e')]['id']);})[_0xe3f3('0x38')](respondWithResult(_0x4a4c16,null))[_0xe3f3('0x2d')](handleError(_0x4a4c16,null));};exports[_0xe3f3('0xa2')]=function(_0x46995f,_0x11bc54,_0x276381){var _0x413c49={'raw':!![],'where':{}};var _0x2106d3={};var _0x3f6b22={'count':0x0,'rows':[]};return db[_0xe3f3('0x42')]['findOne']({'where':{'id':_0x46995f[_0xe3f3('0x5b')]['id']}})[_0xe3f3('0x38')](handleEntityNotFound(_0x11bc54,null))[_0xe3f3('0x38')](function(_0x7aa7d3){if(_0x7aa7d3){_0x2106d3[_0xe3f3('0x4a')]=_[_0xe3f3('0x47')](db['FaxMessage'][_0xe3f3('0x43')]);_0x2106d3[_0xe3f3('0x46')]=_[_0xe3f3('0x47')](_0x46995f[_0xe3f3('0x46')]);_0x2106d3[_0xe3f3('0x48')]=_[_0xe3f3('0x49')](_0x2106d3[_0xe3f3('0x4a')],_0x2106d3['query']);_0x413c49[_0xe3f3('0x4b')]=_[_0xe3f3('0x49')](_0x2106d3['model'],qs[_0xe3f3('0x4c')](_0x46995f[_0xe3f3('0x46')][_0xe3f3('0x4c')]));_0x413c49['attributes']=_0x413c49[_0xe3f3('0x4b')]['length']?_0x413c49[_0xe3f3('0x4b')]:_0x2106d3[_0xe3f3('0x4a')];if(!_0x46995f[_0xe3f3('0x46')][_0xe3f3('0x4e')](_0xe3f3('0x6b'))){_0x413c49['limit']=qs[_0xe3f3('0x33')](_0x46995f['query'][_0xe3f3('0x33')]);_0x413c49[_0xe3f3('0x32')]=qs[_0xe3f3('0x32')](_0x46995f['query']['offset']);}_0x413c49['order']=qs[_0xe3f3('0x50')](_0x46995f[_0xe3f3('0x46')][_0xe3f3('0x50')]);_0x413c49[_0xe3f3('0x51')]=qs[_0xe3f3('0x48')](_['pick'](_0x46995f[_0xe3f3('0x46')],_0x2106d3['filters']));_0x413c49[_0xe3f3('0x51')][_0xe3f3('0x67')]=_0x7aa7d3['id'];if(_0x46995f[_0xe3f3('0x46')][_0xe3f3('0x53')]){_0x413c49[_0xe3f3('0x51')]=_[_0xe3f3('0x54')](_0x413c49[_0xe3f3('0x51')],{'$or':_[_0xe3f3('0x41')](_0x413c49[_0xe3f3('0x4b')],function(_0x317c1a){var _0x2fe21b={};_0x2fe21b[_0x317c1a]={'$like':'%'+_0x46995f[_0xe3f3('0x46')]['filter']+'%'};return _0x2fe21b;})});}if(_0x46995f[_0xe3f3('0x46')][_0xe3f3('0xa3')]){var _0x56b110=_0x46995f[_0xe3f3('0x46')][_0xe3f3('0xa3')][_0xe3f3('0xa4')](',');var _0x49cd28={};_0x49cd28[_0x56b110[0x0]]={'$gte':moment(_0x56b110[0x1])[_0xe3f3('0xa5')](_0xe3f3('0xa6'))};_0x413c49[_0xe3f3('0x51')]=_[_0xe3f3('0x54')](_0x413c49[_0xe3f3('0x51')],_0x49cd28);}_0x413c49=_[_0xe3f3('0x54')]({},_0x413c49,_0x46995f[_0xe3f3('0x5c')]);return db[_0xe3f3('0xa7')][_0xe3f3('0x31')]({'where':_0x413c49[_0xe3f3('0x51')]})['then'](function(_0x38a6d2){_0x3f6b22[_0xe3f3('0x31')]=_0x38a6d2;if(_0x46995f['query'][_0xe3f3('0x57')]){_0x413c49['include']=[{'all':!![]}];}return db[_0xe3f3('0xa7')]['findAll'](_0x413c49);})['then'](function(_0x5b283d){_0x3f6b22[_0xe3f3('0x5a')]=_0x5b283d;return _0x3f6b22;});}})[_0xe3f3('0x38')](respondWithFilteredResult(_0x11bc54,_0x413c49))[_0xe3f3('0x2d')](handleError(_0x11bc54,null));};exports[_0xe3f3('0xa8')]=function(_0x5bc834,_0x443429,_0x4aa2f){var _0x57b869,_0x154fdb={},_0x4282c4;if(_0x5bc834[_0xe3f3('0x5e')]['to']){_0x4282c4=_0x5bc834[_0xe3f3('0x5e')]['to'][0x0];}return db[_0xe3f3('0x42')][_0xe3f3('0x65')]({'where':{'id':_0x5bc834[_0xe3f3('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0xe3f3('0xa9'),'include':[{'model':db[_0xe3f3('0x75')],'as':_0xe3f3('0xaa'),'where':{'fax':_0x4282c4},'limit':0x1,'order':[[_0xe3f3('0x9f'),_0xe3f3('0xab')]]}]}]})[_0xe3f3('0x38')](handleEntityNotFound(_0x443429,null))[_0xe3f3('0x38')](function(_0xfa5a12){_0x57b869=_0xfa5a12;if(_0x5bc834[_0xe3f3('0x5e')][_0xe3f3('0xac')]&&_0x5bc834[_0xe3f3('0x5e')][_0xe3f3('0xac')][_0xe3f3('0x4d')]){for(var _0x16180=0x0;_0x16180<_0x5bc834['body']['attachments'][_0xe3f3('0x4d')];_0x16180+=0x1){_0x5bc834['body'][_0xe3f3('0xac')][_0x16180]={'filename':_0x5bc834[_0xe3f3('0x5e')]['attachments'][_0x16180][_0xe3f3('0x3d')],'id':_0x5bc834[_0xe3f3('0x5e')]['attachments'][_0x16180]['id'],'path':path[_0xe3f3('0xad')](config['root'],_0xe3f3('0xae'),_0x5bc834[_0xe3f3('0x5e')][_0xe3f3('0xac')][_0x16180][_0xe3f3('0xaf')])};}}return respondWithRpcPromise(_0xe3f3('0xb0'),_0xe3f3('0xb0'),{'FaxAccountId':_[_0xe3f3('0xb1')](_0x5bc834[_0xe3f3('0x5b')]['id'])?undefined:_0x5bc834[_0xe3f3('0x5b')]['id'],'path':_[_0xe3f3('0xb1')](_0x5bc834[_0xe3f3('0x5e')][_0xe3f3('0xac')][0x0][_0xe3f3('0x8')])?undefined:_0x5bc834[_0xe3f3('0x5e')]['attachments'][0x0][_0xe3f3('0x8')],'fax':_[_0xe3f3('0xb1')](_0x5bc834[_0xe3f3('0x5e')]['to'][0x0])?undefined:_0x5bc834[_0xe3f3('0x5e')]['to'][0x0]},client9002);})['then'](function(){if(_0x57b869){if(_[_0xe3f3('0xb1')](_0x5bc834[_0xe3f3('0x5e')][_0xe3f3('0xb2')])){_0x5bc834[_0xe3f3('0x5e')][_0xe3f3('0xb2')]=util[_0xe3f3('0xa5')](_0xe3f3('0xb3'),_0x57b869['name'],_0x57b869[_0xe3f3('0xb4')]);}if(_0x57b869['List']){if(_0x57b869[_0xe3f3('0xa9')][_0xe3f3('0xaa')][_0xe3f3('0x4d')]){return _0x57b869[_0xe3f3('0xa9')][_0xe3f3('0xaa')][0x0];}else{return db[_0xe3f3('0x75')][_0xe3f3('0x5d')](_[_0xe3f3('0xb5')](_0x5bc834['body'],{'firstName':_0x5bc834[_0xe3f3('0x5e')]['to'][0x0],'phone':_0x5bc834[_0xe3f3('0x5e')]['to'][0x0],'fax':_0x5bc834[_0xe3f3('0x5e')]['to'][0x0],'ListId':_0x57b869[_0xe3f3('0xa0')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xe3f3('0xb6'));}})[_0xe3f3('0x38')](function(_0x44099f){if(_0x44099f){return db[_0xe3f3('0x72')][_0xe3f3('0x65')]({'where':{'ContactId':_0x44099f['id'],'closed':![],'FaxAccountId':_0x57b869['id']}})[_0xe3f3('0x38')](function(_0x553379){if(_0x553379){return[_0x553379,![]];}return db[_0xe3f3('0x72')]['create']({'UserId':_0x5bc834[_0xe3f3('0x5f')]['id'],'ContactId':_0x44099f['id'],'FaxAccountId':_0x57b869['id'],'fax':_0x5bc834[_0xe3f3('0x5e')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xe3f3('0x54')](_0x5bc834['body'],{'read':![],'body':_0x5bc834[_0xe3f3('0x5e')][_0xe3f3('0xac')][0x0][_0xe3f3('0xb7')],'FaxAccountId':_0x57b869['id'],'UserId':_0x5bc834['user']['id'],'ContactId':_0x44099f['id'],'AttachmentId':_0x5bc834[_0xe3f3('0x5e')][_0xe3f3('0xac')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xe3f3('0xb8')}]})[_0xe3f3('0x38')](function(_0x3bd4f2){return[_0x3bd4f2,!![]];});});}else{throw new Error(_0xe3f3('0xb9'));}})[_0xe3f3('0xba')](function(_0x318e69,_0x5a0462){if(_0x5a0462){return _0x318e69;}return db[_0xe3f3('0xa7')][_0xe3f3('0x5d')]({'direction':_0xe3f3('0xbb'),'read':![],'body':_0x5bc834[_0xe3f3('0x5e')]['attachments'][0x0][_0xe3f3('0xb7')],'FaxAccountId':_0x57b869['id'],'FaxInteractionId':_0x318e69['id'],'UserId':_0x5bc834[_0xe3f3('0x5f')]['id'],'ContactId':_0x318e69[_0xe3f3('0xbc')],'AttachmentId':_0x5bc834[_0xe3f3('0x5e')]['attachments'][0x0]['id']})[_0xe3f3('0x38')](function(_0x1f6484){_0x318e69['dataValues'][_0xe3f3('0xb8')]=[];_0x318e69[_0xe3f3('0xbd')]['Messages'][_0xe3f3('0x8d')](_0x1f6484[_0xe3f3('0xbd')]);return _0x318e69;});})[_0xe3f3('0x38')](function(_0x4ecdff){respondWithRpcPromise(_0xe3f3('0xbe'),'SendFax',{'FaxAccountId':_[_0xe3f3('0xb1')](_0x5bc834[_0xe3f3('0x5b')]['id'])?undefined:_0x5bc834[_0xe3f3('0x5b')]['id'],'path':_[_0xe3f3('0xb1')](_0x5bc834[_0xe3f3('0x5e')]['attachments'][0x0]['path'])?undefined:_0x5bc834[_0xe3f3('0x5e')][_0xe3f3('0xac')][0x0]['path'],'fax':_[_0xe3f3('0xb1')](_0x5bc834[_0xe3f3('0x5e')]['to'][0x0])?undefined:_0x5bc834['body']['to'][0x0],'AttachmentId':_0x5bc834[_0xe3f3('0x5e')][_0xe3f3('0xac')][0x0]['id']},client9002)['then'](function(_0x1c9e72){logger[_0xe3f3('0x25')]('SendFaxRpc,\x20%s',_0x1c9e72);})['catch'](function(_0x1cd6e9){logger[_0xe3f3('0x25')]('SendFaxRpc,\x20%s',_0x1cd6e9);});return _0x4ecdff;})['then'](respondWithResult(_0x443429,null))[_0xe3f3('0x2d')](handleError(_0x443429,null));};exports['addAgents']=function(_0x595e1a,_0xf2febb,_0x372de6){return db[_0xe3f3('0x42')][_0xe3f3('0x65')]({'where':{'id':_0x595e1a['params']['id']}})[_0xe3f3('0x38')](handleEntityNotFound(_0xf2febb,null))['then'](function(_0x67014c){if(_0x67014c){return _0x67014c[_0xe3f3('0xbf')](_0x595e1a[_0xe3f3('0x5e')][_0xe3f3('0x6d')],_['omit'](_0x595e1a['body'],[_0xe3f3('0x6d'),'id'])||{})[_0xe3f3('0xba')](function(_0x2a40f0){for(var _0x477212=0x0;_0x477212<_0x595e1a[_0xe3f3('0x5e')]['ids'][_0xe3f3('0x4d')];_0x477212+=0x1){socket[_0xe3f3('0xc0')]('userFaxAccount:save',{'UserId':_0x595e1a['body'][_0xe3f3('0x6d')][_0x477212],'FaxAccountId':_0x595e1a[_0xe3f3('0x5b')]['id']});}return _0x2a40f0;});}})[_0xe3f3('0x38')](respondWithResult(_0xf2febb,null))[_0xe3f3('0x2d')](handleError(_0xf2febb,null));};exports[_0xe3f3('0xc1')]=function(_0x4a5060,_0x443e2b,_0x53d427){return db[_0xe3f3('0x42')]['find']({'where':{'id':_0x4a5060['params']['id']}})[_0xe3f3('0x38')](handleEntityNotFound(_0x443e2b,null))[_0xe3f3('0x38')](function(_0x1e3b18){if(_0x1e3b18){return _0x1e3b18[_0xe3f3('0xc1')](_0x4a5060['query'][_0xe3f3('0x6d')])[_0xe3f3('0x38')](function(){if(_[_0xe3f3('0xc2')](_0x4a5060[_0xe3f3('0x46')]['ids'])){for(var _0x50cb2e=0x0;_0x50cb2e<_0x4a5060[_0xe3f3('0x46')][_0xe3f3('0x6d')][_0xe3f3('0x4d')];_0x50cb2e+=0x1){socket[_0xe3f3('0xc0')](_0xe3f3('0xc3'),{'UserId':Number(_0x4a5060[_0xe3f3('0x46')][_0xe3f3('0x6d')][_0x50cb2e]),'FaxAccountId':Number(_0x4a5060[_0xe3f3('0x5b')]['id'])});}}else{socket[_0xe3f3('0xc0')](_0xe3f3('0xc3'),{'UserId':Number(_0x4a5060[_0xe3f3('0x46')][_0xe3f3('0x6d')]),'FaxAccountId':Number(_0x4a5060[_0xe3f3('0x5b')]['id'])});}});}})[_0xe3f3('0x38')](respondWithStatusCode(_0x443e2b,null))['catch'](handleError(_0x443e2b,null));};exports[_0xe3f3('0xc4')]=function(_0x588368,_0x1aa900,_0x4d6ad9){var _0x251734={};var _0x5e0952={};var _0x199baa;var _0x12a162;return db[_0xe3f3('0x42')][_0xe3f3('0x69')]({'where':{'id':_0x588368[_0xe3f3('0x5b')]['id']}})[_0xe3f3('0x38')](handleEntityNotFound(_0x1aa900,null))[_0xe3f3('0x38')](function(_0x45078e){if(_0x45078e){_0x199baa=_0x45078e;_0x5e0952[_0xe3f3('0x4a')]=_[_0xe3f3('0x47')](db[_0xe3f3('0x77')][_0xe3f3('0x43')]);_0x5e0952['query']=_['keys'](_0x588368[_0xe3f3('0x46')]);_0x5e0952[_0xe3f3('0x48')]=_[_0xe3f3('0x49')](_0x5e0952[_0xe3f3('0x4a')],_0x5e0952['query']);_0x251734[_0xe3f3('0x4b')]=_[_0xe3f3('0x49')](_0x5e0952[_0xe3f3('0x4a')],qs[_0xe3f3('0x4c')](_0x588368[_0xe3f3('0x46')][_0xe3f3('0x4c')]));_0x251734[_0xe3f3('0x4b')]=_0x251734[_0xe3f3('0x4b')]['length']?_0x251734[_0xe3f3('0x4b')]:_0x5e0952[_0xe3f3('0x4a')];_0x251734['order']=qs['sort'](_0x588368['query'][_0xe3f3('0x50')]);_0x251734[_0xe3f3('0x51')]=qs[_0xe3f3('0x48')](_['pick'](_0x588368[_0xe3f3('0x46')],_0x5e0952[_0xe3f3('0x48')]));if(_0x588368[_0xe3f3('0x46')][_0xe3f3('0x53')]){_0x251734[_0xe3f3('0x51')]=_[_0xe3f3('0x54')](_0x251734[_0xe3f3('0x51')],{'$or':_[_0xe3f3('0x41')](_0x251734[_0xe3f3('0x4b')],function(_0x265287){var _0x298299={};_0x298299[_0x265287]={'$like':'%'+_0x588368['query'][_0xe3f3('0x53')]+'%'};return _0x298299;})});}_0x251734=_[_0xe3f3('0x54')]({},_0x251734,_0x588368[_0xe3f3('0x5c')]);return _0x199baa[_0xe3f3('0xc4')](_0x251734);}})[_0xe3f3('0x38')](function(_0x41ec7d){if(_0x41ec7d){_0x12a162=_0x41ec7d[_0xe3f3('0x4d')];if(!_0x588368[_0xe3f3('0x46')][_0xe3f3('0x4e')](_0xe3f3('0x6b'))){_0x251734[_0xe3f3('0x33')]=qs[_0xe3f3('0x33')](_0x588368[_0xe3f3('0x46')][_0xe3f3('0x33')]);_0x251734[_0xe3f3('0x32')]=qs['offset'](_0x588368[_0xe3f3('0x46')][_0xe3f3('0x32')]);}return _0x199baa['getAgents'](_0x251734);}})[_0xe3f3('0x38')](function(_0x5f359f){if(_0x5f359f){return _0x5f359f?{'count':_0x12a162,'rows':_0x5f359f}:null;}})[_0xe3f3('0x38')](respondWithResult(_0x1aa900,null))[_0xe3f3('0x2d')](handleError(_0x1aa900,null));}; \ No newline at end of file +var _0x2a9f=['ids','addAnswer','CannedAnswer','getAnswers','rawAttributes','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','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','updateAccountApplications','VoiceExtension','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','send','CmList','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','defaults','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','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','localhost','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','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','destroy','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','FaxAccount','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','count','include','findAll','rows','catch','show','params','Pause','keys','intersection','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','FaxAccountId','Disposition','findOne','removeDispositions'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x2a9f,0x1ec));var _0xf2a9=function(_0x16cd3a,_0x546c76){_0x16cd3a=_0x16cd3a-0x0;var _0x314c4c=_0x2a9f[_0x16cd3a];return _0x314c4c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf2a9('0x0'));var rimraf=require(_0xf2a9('0x1'));var zipdir=require(_0xf2a9('0x2'));var jsonpatch=require(_0xf2a9('0x3'));var rp=require(_0xf2a9('0x4'));var moment=require(_0xf2a9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf2a9('0x6'));var util=require(_0xf2a9('0x7'));var path=require(_0xf2a9('0x8'));var sox=require(_0xf2a9('0x9'));var csv=require(_0xf2a9('0xa'));var ejs=require(_0xf2a9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf2a9('0xc'));var crypto=require('crypto');var jsforce=require(_0xf2a9('0xd'));var deskjs=require(_0xf2a9('0xe'));var toCsv=require(_0xf2a9('0xa'));var querystring=require(_0xf2a9('0xf'));var Papa=require(_0xf2a9('0x10'));var Redis=require(_0xf2a9('0x11'));var authService=require(_0xf2a9('0x12'));var qs=require(_0xf2a9('0x13'));var as=require(_0xf2a9('0x14'));var hardwareService=require(_0xf2a9('0x15'));var logger=require(_0xf2a9('0x16'))(_0xf2a9('0x17'));var utils=require('../../config/utils');var config=require(_0xf2a9('0x18'));var db=require(_0xf2a9('0x19'))['db'];config[_0xf2a9('0x1a')]=_['defaults'](config[_0xf2a9('0x1a')],{'host':_0xf2a9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf2a9('0x1a')]));require('./faxAccount.socket')[_0xf2a9('0x1c')](socket);var jayson=require(_0xf2a9('0x1d'));var client=jayson[_0xf2a9('0x1e')][_0xf2a9('0x1f')]({'port':0x232c});var client9002=jayson[_0xf2a9('0x1e')][_0xf2a9('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x53790e,_0x28decc,_0x136a5c){if(_0x136a5c){var _0xc2eeae=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc2eeae[_0xf2a9('0x20')](_0x28decc)){return _0x53790e;}else{throw new db['Sequelize'][(_0xf2a9('0x21'))](_0xf2a9('0x22'));}}else{return _0x53790e;}}function respondWithRpcPromise(_0x110165,_0x31c7fe,_0x41dd90,_0x1d5283){return new BPromise(function(_0x2d83b6,_0x21a3ac){var _0x910b4c=_0x1d5283||client;return _0x910b4c[_0xf2a9('0x23')](_0x110165,_0x41dd90)[_0xf2a9('0x24')](function(_0x4b1be7){logger[_0xf2a9('0x25')]('FaxAccount,\x20%s,\x20%s',_0x31c7fe,_0xf2a9('0x26'));logger[_0xf2a9('0x27')](_0xf2a9('0x28'),_0x31c7fe,_0xf2a9('0x26'),JSON[_0xf2a9('0x29')](_0x4b1be7));if(_0x4b1be7['error']){if(_0x4b1be7[_0xf2a9('0x2a')][_0xf2a9('0x2b')]===0x1f4){logger['error'](_0xf2a9('0x2c'),_0x31c7fe,_0x4b1be7['error'][_0xf2a9('0x2d')]);return _0x21a3ac(_0x4b1be7[_0xf2a9('0x2a')]['message']);}logger[_0xf2a9('0x2a')](_0xf2a9('0x2c'),_0x31c7fe,_0x4b1be7[_0xf2a9('0x2a')][_0xf2a9('0x2d')]);return _0x2d83b6(_0x4b1be7[_0xf2a9('0x2a')][_0xf2a9('0x2d')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x31c7fe,_0xf2a9('0x26'));_0x2d83b6(_0x4b1be7[_0xf2a9('0x2e')][_0xf2a9('0x2d')]);}})['catch'](function(_0x38f4b3){logger[_0xf2a9('0x2a')](_0xf2a9('0x2c'),_0x31c7fe,_0x38f4b3);_0x21a3ac(_0x38f4b3);});});}function respondWithStatusCode(_0x56c2fc,_0x1b1ba0){_0x1b1ba0=_0x1b1ba0||0xcc;return function(_0x48b502){if(_0x48b502){return _0x56c2fc[_0xf2a9('0x2f')](_0x1b1ba0);}return _0x56c2fc[_0xf2a9('0x30')](_0x1b1ba0)[_0xf2a9('0x31')]();};}function respondWithResult(_0xe1d245,_0x4ed903){_0x4ed903=_0x4ed903||0xc8;return function(_0xe41cff){if(_0xe41cff){return _0xe1d245[_0xf2a9('0x30')](_0x4ed903)[_0xf2a9('0x32')](_0xe41cff);}};}function respondWithFilteredResult(_0x3bc74c,_0x40834e){return function(_0x2d4093){if(_0x2d4093){var _0x4c1fe1=_0x2d4093['count'],_0x237e5e=_0x40834e[_0xf2a9('0x33')],_0x4a08ce=_0x40834e[_0xf2a9('0x33')]+_0x40834e[_0xf2a9('0x34')],_0x35606d;if(_0x4a08ce>=_0x4c1fe1){_0x4a08ce=_0x4c1fe1;_0x35606d=0xc8;}else{_0x35606d=0xce;}_0x3bc74c[_0xf2a9('0x30')](_0x35606d);return _0x3bc74c[_0xf2a9('0x35')](_0xf2a9('0x36'),_0x237e5e+'-'+_0x4a08ce+'/'+_0x4c1fe1)['json'](_0x2d4093);}return null;};}function patchUpdates(_0x5500de){return function(_0x18a196){try{jsonpatch['apply'](_0x18a196,_0x5500de,!![]);}catch(_0x20d137){return BPromise[_0xf2a9('0x37')](_0x20d137);}return _0x18a196['save']();};}function saveUpdates(_0x163474,_0x2d48d5){return function(_0x48eb10){if(_0x48eb10){return _0x48eb10[_0xf2a9('0x38')](_0x163474)[_0xf2a9('0x24')](function(_0x4d0615){return _0x4d0615;});}return null;};}function removeEntity(_0x4efbb6,_0x11af86){return function(_0x132e31){if(_0x132e31){return _0x132e31[_0xf2a9('0x39')]()[_0xf2a9('0x24')](function(){var _0x384198=_0x132e31['get']({'plain':!![]});var _0x2f2be0='FaxAccounts';return db[_0xf2a9('0x3a')]['destroy']({'where':{'type':_0x2f2be0,'resourceId':_0x384198['id']}})[_0xf2a9('0x24')](function(){return _0x132e31;});})[_0xf2a9('0x24')](function(){_0x4efbb6[_0xf2a9('0x30')](0xcc)[_0xf2a9('0x31')]();});}};}function handleEntityNotFound(_0x382fc3,_0x79c73b){return function(_0x2483d1){if(!_0x2483d1){_0x382fc3[_0xf2a9('0x2f')](0x194);}return _0x2483d1;};}function handleError(_0x25bf36,_0x574811){_0x574811=_0x574811||0x1f4;return function(_0x489037){logger['error'](_0x489037[_0xf2a9('0x3b')]);if(_0x489037[_0xf2a9('0x3c')]){delete _0x489037[_0xf2a9('0x3c')];}_0x25bf36[_0xf2a9('0x30')](_0x574811)['send'](_0x489037);};}exports[_0xf2a9('0x3d')]=function(_0x2b34f5,_0x3f1e0e){var _0x2727eb={'include':[{'model':db['Pause'],'as':_0xf2a9('0x3e')}]},_0x398b5f={},_0x4ce210={'count':0x0,'rows':[]};var _0x16191e=_[_0xf2a9('0x3f')](db[_0xf2a9('0x40')]['rawAttributes'],function(_0xc6a495){return{'name':_0xc6a495[_0xf2a9('0x41')],'type':_0xc6a495[_0xf2a9('0x42')]['key']};});_0x398b5f[_0xf2a9('0x43')]=_[_0xf2a9('0x3f')](_0x16191e,'name');_0x398b5f[_0xf2a9('0x44')]=_['keys'](_0x2b34f5[_0xf2a9('0x44')]);_0x398b5f[_0xf2a9('0x45')]=_['intersection'](_0x398b5f[_0xf2a9('0x43')],_0x398b5f['query']);_0x2727eb[_0xf2a9('0x46')]=_['intersection'](_0x398b5f['model'],qs['fields'](_0x2b34f5[_0xf2a9('0x44')][_0xf2a9('0x47')]));_0x2727eb['attributes']=_0x2727eb[_0xf2a9('0x46')]['length']?_0x2727eb['attributes']:_0x398b5f[_0xf2a9('0x43')];if(!_0x2b34f5[_0xf2a9('0x44')][_0xf2a9('0x48')](_0xf2a9('0x49'))){_0x2727eb['limit']=qs[_0xf2a9('0x34')](_0x2b34f5[_0xf2a9('0x44')][_0xf2a9('0x34')]);_0x2727eb[_0xf2a9('0x33')]=qs[_0xf2a9('0x33')](_0x2b34f5[_0xf2a9('0x44')][_0xf2a9('0x33')]);}_0x2727eb[_0xf2a9('0x4a')]=qs[_0xf2a9('0x4b')](_0x2b34f5[_0xf2a9('0x44')]['sort']);_0x2727eb['where']=qs[_0xf2a9('0x45')](_[_0xf2a9('0x4c')](_0x2b34f5[_0xf2a9('0x44')],_0x398b5f[_0xf2a9('0x45')]),_0x16191e);if(_0x2b34f5[_0xf2a9('0x44')][_0xf2a9('0x4d')]){_0x2727eb['where']=_['merge'](_0x2727eb[_0xf2a9('0x4e')],{'$or':_['map'](_0x16191e,function(_0x2d7601){if(_0x2d7601[_0xf2a9('0x42')]!==_0xf2a9('0x4f')){var _0x269c6e={};_0x269c6e[_0x2d7601[_0xf2a9('0x3c')]]={'$like':'%'+_0x2b34f5[_0xf2a9('0x44')][_0xf2a9('0x4d')]+'%'};return _0x269c6e;}})});}_0x2727eb=_[_0xf2a9('0x50')]({},_0x2727eb,_0x2b34f5[_0xf2a9('0x51')]);var _0x2a5aa1={'where':_0x2727eb[_0xf2a9('0x4e')]};return db[_0xf2a9('0x40')]['count'](_0x2a5aa1)[_0xf2a9('0x24')](function(_0x58308f){_0x4ce210[_0xf2a9('0x52')]=_0x58308f;if(_0x2b34f5['query']['includeAll']){_0x2727eb[_0xf2a9('0x53')]=[{'all':!![]}];}return db['FaxAccount'][_0xf2a9('0x54')](_0x2727eb);})[_0xf2a9('0x24')](function(_0x38aec1){_0x4ce210[_0xf2a9('0x55')]=_0x38aec1;return _0x4ce210;})[_0xf2a9('0x24')](respondWithFilteredResult(_0x3f1e0e,_0x2727eb))[_0xf2a9('0x56')](handleError(_0x3f1e0e,null));};exports[_0xf2a9('0x57')]=function(_0x49dd66,_0x6b29b0){var _0x5b3799={'raw':![],'where':{'id':_0x49dd66[_0xf2a9('0x58')]['id']},'include':[{'model':db[_0xf2a9('0x59')],'as':'mandatoryDispositionPause'}]},_0xdf6304={};_0xdf6304[_0xf2a9('0x43')]=_['keys'](db[_0xf2a9('0x40')]['rawAttributes']);_0xdf6304[_0xf2a9('0x44')]=_[_0xf2a9('0x5a')](_0x49dd66[_0xf2a9('0x44')]);_0xdf6304['filters']=_[_0xf2a9('0x5b')](_0xdf6304[_0xf2a9('0x43')],_0xdf6304['query']);_0x5b3799[_0xf2a9('0x46')]=_[_0xf2a9('0x5b')](_0xdf6304[_0xf2a9('0x43')],qs['fields'](_0x49dd66[_0xf2a9('0x44')]['fields']));_0x5b3799[_0xf2a9('0x46')]=_0x5b3799[_0xf2a9('0x46')][_0xf2a9('0x5c')]?_0x5b3799[_0xf2a9('0x46')]:_0xdf6304[_0xf2a9('0x43')];if(_0x49dd66[_0xf2a9('0x44')][_0xf2a9('0x5d')]){_0x5b3799[_0xf2a9('0x53')]=[{'all':!![]}];}_0x5b3799=_['merge']({},_0x5b3799,_0x49dd66['options']);return db['FaxAccount'][_0xf2a9('0x5e')](_0x5b3799)[_0xf2a9('0x24')](handleEntityNotFound(_0x6b29b0,null))[_0xf2a9('0x24')](respondWithResult(_0x6b29b0,null))[_0xf2a9('0x56')](handleError(_0x6b29b0,null));};exports['create']=function(_0x48a7ba,_0x121632){return db[_0xf2a9('0x40')][_0xf2a9('0x5f')](_0x48a7ba['body'],{})['then'](function(_0x5ec997){var _0x4b461d=_0x48a7ba[_0xf2a9('0x60')]['get']({'plain':!![]});if(!_0x4b461d)throw new Error(_0xf2a9('0x61'));if(_0x4b461d['role']===_0xf2a9('0x60')){var _0x5c9703=_0x5ec997[_0xf2a9('0x62')]({'plain':!![]});var _0x2c9288='FaxAccounts';return db[_0xf2a9('0x63')]['find']({'where':{'name':_0x2c9288,'userProfileId':_0x4b461d['userProfileId']},'raw':!![]})[_0xf2a9('0x24')](function(_0x44008a){if(_0x44008a&&_0x44008a[_0xf2a9('0x64')]===0x0){return db[_0xf2a9('0x3a')][_0xf2a9('0x5f')]({'name':_0x5c9703['name'],'resourceId':_0x5c9703['id'],'type':_0x44008a[_0xf2a9('0x3c')],'sectionId':_0x44008a['id']},{})[_0xf2a9('0x24')](function(){return _0x5ec997;});}else{return _0x5ec997;}})[_0xf2a9('0x56')](function(_0x5978d9){logger[_0xf2a9('0x2a')](_0xf2a9('0x65'),_0x5978d9);throw _0x5978d9;});}return _0x5ec997;})[_0xf2a9('0x24')](respondWithResult(_0x121632,0xc9))[_0xf2a9('0x56')](handleError(_0x121632,null));};exports[_0xf2a9('0x38')]=function(_0x307753,_0x985cd4){if(_0x307753['body']['id']){delete _0x307753[_0xf2a9('0x66')]['id'];}return db[_0xf2a9('0x40')][_0xf2a9('0x5e')]({'where':{'id':_0x307753[_0xf2a9('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x985cd4,null))['then'](saveUpdates(_0x307753[_0xf2a9('0x66')],null))['then'](respondWithResult(_0x985cd4,null))['catch'](handleError(_0x985cd4,null));};exports[_0xf2a9('0x39')]=function(_0x483d15,_0x5d96f0){return db['FaxAccount'][_0xf2a9('0x5e')]({'where':{'id':_0x483d15[_0xf2a9('0x58')]['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x5d96f0,null))[_0xf2a9('0x24')](removeEntity(_0x5d96f0,null))['catch'](handleError(_0x5d96f0,null));};exports[_0xf2a9('0x67')]=function(_0x2d288f,_0x22dbf1){return db[_0xf2a9('0x40')][_0xf2a9('0x67')]()[_0xf2a9('0x24')](respondWithResult(_0x22dbf1,null))[_0xf2a9('0x56')](handleError(_0x22dbf1,null));};exports['addDisposition']=function(_0x19ddc3,_0x4270c5,_0x36d463){if(_0x19ddc3[_0xf2a9('0x66')]['id']){delete _0x19ddc3[_0xf2a9('0x66')]['id'];}return db[_0xf2a9('0x40')][_0xf2a9('0x5e')]({'where':{'id':_0x19ddc3[_0xf2a9('0x58')]['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x4270c5,null))['then'](function(_0x429e3d){if(_0x429e3d){_0x19ddc3['body'][_0xf2a9('0x68')]=_0x429e3d['id'];return db[_0xf2a9('0x69')][_0xf2a9('0x5f')](_0x19ddc3[_0xf2a9('0x66')]);}})[_0xf2a9('0x24')](respondWithResult(_0x4270c5,null))[_0xf2a9('0x56')](handleError(_0x4270c5,null));};exports['getDispositions']=function(_0x358120,_0x5819ff,_0x2e2c3f){var _0x4c4846={'raw':![],'where':{}};var _0x3e6cad={};var _0x1b601f={'count':0x0,'rows':[]};return db[_0xf2a9('0x40')][_0xf2a9('0x6a')]({'where':{'id':_0x358120[_0xf2a9('0x58')]['id']}})['then'](handleEntityNotFound(_0x5819ff,null))['then'](function(_0x2abcbc){if(_0x2abcbc){_0x3e6cad['model']=_[_0xf2a9('0x5a')](db[_0xf2a9('0x69')]['rawAttributes']);_0x3e6cad[_0xf2a9('0x44')]=_[_0xf2a9('0x5a')](_0x358120[_0xf2a9('0x44')]);_0x3e6cad[_0xf2a9('0x45')]=_[_0xf2a9('0x5b')](_0x3e6cad[_0xf2a9('0x43')],_0x3e6cad[_0xf2a9('0x44')]);_0x4c4846[_0xf2a9('0x46')]=_[_0xf2a9('0x5b')](_0x3e6cad['model'],qs[_0xf2a9('0x47')](_0x358120[_0xf2a9('0x44')][_0xf2a9('0x47')]));_0x4c4846[_0xf2a9('0x46')]=_0x4c4846[_0xf2a9('0x46')][_0xf2a9('0x5c')]?_0x4c4846[_0xf2a9('0x46')]:_0x3e6cad[_0xf2a9('0x43')];if(!_0x358120['query'][_0xf2a9('0x48')](_0xf2a9('0x49'))){_0x4c4846['limit']=qs[_0xf2a9('0x34')](_0x358120[_0xf2a9('0x44')][_0xf2a9('0x34')]);_0x4c4846[_0xf2a9('0x33')]=qs[_0xf2a9('0x33')](_0x358120[_0xf2a9('0x44')]['offset']);}_0x4c4846['order']=qs[_0xf2a9('0x4b')](_0x358120[_0xf2a9('0x44')]['sort']);_0x4c4846[_0xf2a9('0x4e')]=qs[_0xf2a9('0x45')](_[_0xf2a9('0x4c')](_0x358120[_0xf2a9('0x44')],_0x3e6cad[_0xf2a9('0x45')]));_0x4c4846['where']['FaxAccountId']=_0x2abcbc['id'];if(_0x358120[_0xf2a9('0x44')][_0xf2a9('0x4d')]){_0x4c4846[_0xf2a9('0x4e')]=_[_0xf2a9('0x50')](_0x4c4846['where'],{'$or':_[_0xf2a9('0x3f')](_0x4c4846[_0xf2a9('0x46')],function(_0x1da709){var _0x30bc50={};_0x30bc50[_0x1da709]={'$like':'%'+_0x358120[_0xf2a9('0x44')][_0xf2a9('0x4d')]+'%'};return _0x30bc50;})});}_0x4c4846=_[_0xf2a9('0x50')]({},_0x4c4846,_0x358120[_0xf2a9('0x51')]);return db[_0xf2a9('0x69')][_0xf2a9('0x52')]({'where':_0x4c4846[_0xf2a9('0x4e')]})[_0xf2a9('0x24')](function(_0x3d93cb){_0x1b601f[_0xf2a9('0x52')]=_0x3d93cb;if(_0x358120[_0xf2a9('0x44')][_0xf2a9('0x5d')]){_0x4c4846['include']=[{'all':!![]}];}return db[_0xf2a9('0x69')][_0xf2a9('0x54')](_0x4c4846);})[_0xf2a9('0x24')](function(_0x38bc69){_0x1b601f['rows']=_0x38bc69;return _0x1b601f;});}})[_0xf2a9('0x24')](respondWithFilteredResult(_0x5819ff,_0x4c4846))[_0xf2a9('0x56')](handleError(_0x5819ff,null));};exports[_0xf2a9('0x6b')]=function(_0x25d9bc,_0x214dfa,_0x137510){return db[_0xf2a9('0x40')][_0xf2a9('0x5e')]({'where':{'id':_0x25d9bc['params']['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x214dfa,null))['then'](function(_0x4f378e){if(_0x4f378e){return _0x4f378e[_0xf2a9('0x6b')](_0x25d9bc[_0xf2a9('0x44')][_0xf2a9('0x6c')]);}})[_0xf2a9('0x24')](respondWithStatusCode(_0x214dfa,null))[_0xf2a9('0x56')](handleError(_0x214dfa,null));};exports[_0xf2a9('0x6d')]=function(_0x1424dc,_0xf9069a,_0xa3a12f){if(_0x1424dc[_0xf2a9('0x66')]['id']){delete _0x1424dc[_0xf2a9('0x66')]['id'];}return db[_0xf2a9('0x40')][_0xf2a9('0x5e')]({'where':{'id':_0x1424dc[_0xf2a9('0x58')]['id']}})['then'](handleEntityNotFound(_0xf9069a,null))[_0xf2a9('0x24')](function(_0x448033){if(_0x448033){_0x1424dc['body'][_0xf2a9('0x68')]=_0x448033['id'];return db[_0xf2a9('0x6e')][_0xf2a9('0x5f')](_0x1424dc['body']);}})['then'](respondWithResult(_0xf9069a,null))['catch'](handleError(_0xf9069a,null));};exports[_0xf2a9('0x6f')]=function(_0x22bb57,_0xb7ed45,_0x9e8f62){var _0xe84308={'raw':![],'where':{}};var _0x47c849={};var _0x2716ff={'count':0x0,'rows':[]};return db[_0xf2a9('0x40')][_0xf2a9('0x6a')]({'where':{'id':_0x22bb57['params']['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0xb7ed45,null))[_0xf2a9('0x24')](function(_0x8a414f){if(_0x8a414f){_0x47c849['model']=_['keys'](db[_0xf2a9('0x6e')][_0xf2a9('0x70')]);_0x47c849[_0xf2a9('0x44')]=_[_0xf2a9('0x5a')](_0x22bb57[_0xf2a9('0x44')]);_0x47c849[_0xf2a9('0x45')]=_[_0xf2a9('0x5b')](_0x47c849['model'],_0x47c849[_0xf2a9('0x44')]);_0xe84308['attributes']=_['intersection'](_0x47c849[_0xf2a9('0x43')],qs['fields'](_0x22bb57[_0xf2a9('0x44')][_0xf2a9('0x47')]));_0xe84308['attributes']=_0xe84308[_0xf2a9('0x46')][_0xf2a9('0x5c')]?_0xe84308['attributes']:_0x47c849[_0xf2a9('0x43')];if(!_0x22bb57[_0xf2a9('0x44')][_0xf2a9('0x48')](_0xf2a9('0x49'))){_0xe84308[_0xf2a9('0x34')]=qs[_0xf2a9('0x34')](_0x22bb57[_0xf2a9('0x44')][_0xf2a9('0x34')]);_0xe84308[_0xf2a9('0x33')]=qs[_0xf2a9('0x33')](_0x22bb57[_0xf2a9('0x44')][_0xf2a9('0x33')]);}_0xe84308[_0xf2a9('0x4a')]=qs['sort'](_0x22bb57['query'][_0xf2a9('0x4b')]);_0xe84308[_0xf2a9('0x4e')]=qs['filters'](_[_0xf2a9('0x4c')](_0x22bb57[_0xf2a9('0x44')],_0x47c849['filters']));_0xe84308[_0xf2a9('0x4e')][_0xf2a9('0x68')]=_0x8a414f['id'];if(_0x22bb57['query'][_0xf2a9('0x4d')]){_0xe84308[_0xf2a9('0x4e')]=_[_0xf2a9('0x50')](_0xe84308[_0xf2a9('0x4e')],{'$or':_[_0xf2a9('0x3f')](_0xe84308[_0xf2a9('0x46')],function(_0x2da4d5){var _0x16436e={};_0x16436e[_0x2da4d5]={'$like':'%'+_0x22bb57['query']['filter']+'%'};return _0x16436e;})});}_0xe84308=_[_0xf2a9('0x50')]({},_0xe84308,_0x22bb57[_0xf2a9('0x51')]);return db[_0xf2a9('0x6e')][_0xf2a9('0x52')]({'where':_0xe84308['where']})[_0xf2a9('0x24')](function(_0x3f056e){_0x2716ff[_0xf2a9('0x52')]=_0x3f056e;if(_0x22bb57[_0xf2a9('0x44')]['includeAll']){_0xe84308['include']=[{'all':!![]}];}return db[_0xf2a9('0x6e')][_0xf2a9('0x54')](_0xe84308);})['then'](function(_0x1be190){_0x2716ff[_0xf2a9('0x55')]=_0x1be190;return _0x2716ff;});}})['then'](respondWithFilteredResult(_0xb7ed45,_0xe84308))[_0xf2a9('0x56')](handleError(_0xb7ed45,null));};exports[_0xf2a9('0x71')]=function(_0x15a5d5,_0x2568b5,_0x33b966){return db[_0xf2a9('0x40')]['find']({'where':{'id':_0x15a5d5['params']['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x2568b5,null))[_0xf2a9('0x24')](function(_0x1de22c){if(_0x1de22c){return _0x1de22c[_0xf2a9('0x71')](_0x15a5d5[_0xf2a9('0x44')][_0xf2a9('0x6c')]);}})[_0xf2a9('0x24')](respondWithStatusCode(_0x2568b5,null))[_0xf2a9('0x56')](handleError(_0x2568b5,null));};exports[_0xf2a9('0x72')]=function(_0x4c0e37,_0x384c0d,_0x4ebdf8){return db['FaxInteraction']['find']({'where':{'id':_0x4c0e37[_0xf2a9('0x58')]['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x384c0d,null))['then'](function(_0x51657c){if(_0x51657c){return _0x51657c['addInteraction'](_0x4c0e37[_0xf2a9('0x66')][_0xf2a9('0x6c')],_[_0xf2a9('0x73')](_0x4c0e37['body'],[_0xf2a9('0x6c'),'id'])||{});}})[_0xf2a9('0x24')](respondWithResult(_0x384c0d,null))[_0xf2a9('0x56')](handleError(_0x384c0d,null));};exports[_0xf2a9('0x74')]=function(_0x246edd,_0x2fddab,_0x540084){var _0x48d5b8={'raw':![],'where':{}};var _0xd9760c={};var _0x2d6ae9={'count':0x0,'rows':[]};return db[_0xf2a9('0x40')][_0xf2a9('0x6a')]({'where':{'id':_0x246edd[_0xf2a9('0x58')]['id']}})['then'](handleEntityNotFound(_0x2fddab,null))['then'](function(_0x4d4589){if(_0x4d4589){_0xd9760c[_0xf2a9('0x43')]=_[_0xf2a9('0x5a')](db[_0xf2a9('0x75')][_0xf2a9('0x70')]);_0xd9760c[_0xf2a9('0x44')]=_[_0xf2a9('0x5a')](_0x246edd['query']);_0xd9760c[_0xf2a9('0x45')]=_[_0xf2a9('0x5b')](_0xd9760c[_0xf2a9('0x43')],_0xd9760c[_0xf2a9('0x44')]);_0x48d5b8[_0xf2a9('0x46')]=_['intersection'](_0xd9760c['model'],qs[_0xf2a9('0x47')](_0x246edd[_0xf2a9('0x44')][_0xf2a9('0x47')]));_0x48d5b8[_0xf2a9('0x46')]=_0x48d5b8[_0xf2a9('0x46')][_0xf2a9('0x5c')]?_0x48d5b8['attributes']:_0xd9760c[_0xf2a9('0x43')];if(!_0x246edd[_0xf2a9('0x44')][_0xf2a9('0x48')](_0xf2a9('0x49'))){_0x48d5b8[_0xf2a9('0x34')]=qs['limit'](_0x246edd[_0xf2a9('0x44')]['limit']);_0x48d5b8['offset']=qs[_0xf2a9('0x33')](_0x246edd[_0xf2a9('0x44')][_0xf2a9('0x33')]);}_0x48d5b8[_0xf2a9('0x4a')]=qs['sort'](_0x246edd[_0xf2a9('0x44')][_0xf2a9('0x4b')]);_0x48d5b8[_0xf2a9('0x4e')]=qs[_0xf2a9('0x45')](_['pick'](_0x246edd[_0xf2a9('0x44')],_0xd9760c[_0xf2a9('0x45')]));_0x48d5b8['where'][_0xf2a9('0x68')]=_0x4d4589['id'];if(_0x246edd[_0xf2a9('0x44')][_0xf2a9('0x4d')]){_0x48d5b8[_0xf2a9('0x4e')]=_[_0xf2a9('0x50')](_0x48d5b8['where'],{'$or':_['map'](_0x48d5b8['attributes'],function(_0x5cc581){var _0x79e254={};_0x79e254[_0x5cc581]={'$like':'%'+_0x246edd[_0xf2a9('0x44')][_0xf2a9('0x4d')]+'%'};return _0x79e254;})});}_0x48d5b8=_[_0xf2a9('0x50')]({},_0x48d5b8,_0x246edd[_0xf2a9('0x51')]);return db[_0xf2a9('0x75')][_0xf2a9('0x52')]({'where':_0x48d5b8[_0xf2a9('0x4e')]})[_0xf2a9('0x24')](function(_0x252806){_0x2d6ae9[_0xf2a9('0x52')]=_0x252806;if(_0x246edd['query'][_0xf2a9('0x5d')]){_0x48d5b8['include']=[{'model':db[_0xf2a9('0x76')],'as':_0xf2a9('0x77'),'required':![]},{'model':db[_0xf2a9('0x78')],'as':'Owner','attributes':[_0xf2a9('0x3c'),_0xf2a9('0x79'),_0xf2a9('0x7a')],'required':![]},{'model':db[_0xf2a9('0x7b')],'as':_0xf2a9('0x7c'),'attributes':['id','name','color'],'where':_0x246edd['query'][_0xf2a9('0x7d')]?{'id':_0x246edd[_0xf2a9('0x44')]['tag']}:undefined,'required':_0x246edd[_0xf2a9('0x44')][_0xf2a9('0x7d')]?!![]:![]}];}return db[_0xf2a9('0x75')][_0xf2a9('0x54')](_0x48d5b8);})[_0xf2a9('0x24')](function(_0xf9f1e2){_0x2d6ae9['rows']=_0xf9f1e2;return _0x2d6ae9;});}})[_0xf2a9('0x24')](respondWithFilteredResult(_0x2fddab,_0x48d5b8))[_0xf2a9('0x56')](handleError(_0x2fddab,null));};exports[_0xf2a9('0x7e')]=function(_0x33d2a4,_0x31f13e,_0xfa897e){return db[_0xf2a9('0x40')][_0xf2a9('0x6a')]({'where':{'id':_0x33d2a4['params']['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x31f13e,null))[_0xf2a9('0x24')](function(_0x43419f){if(_0x43419f){return db[_0xf2a9('0x7f')][_0xf2a9('0x80')](function(_0x4acefe){return db[_0xf2a9('0x81')][_0xf2a9('0x39')]({'where':{'FaxAccountId':_0x33d2a4[_0xf2a9('0x58')]['id']},'transaction':_0x4acefe})[_0xf2a9('0x24')](function(_0x3a3477){var _0x469da7=_[_0xf2a9('0x3f')](_0x33d2a4[_0xf2a9('0x66')],function(_0x588f73){_0x588f73[_0xf2a9('0x68')]=_0x33d2a4[_0xf2a9('0x58')]['id'];return _0x588f73;});return db[_0xf2a9('0x81')][_0xf2a9('0x82')](_0x469da7,{'transaction':_0x4acefe});});})[_0xf2a9('0x24')](function(){return db[_0xf2a9('0x81')][_0xf2a9('0x83')]({'where':{'FaxAccountId':_0x33d2a4[_0xf2a9('0x58')]['id']},'order':_0xf2a9('0x84')});});}})['then'](respondWithResult(_0x31f13e,null))[_0xf2a9('0x56')](handleError(_0x31f13e,null));};exports[_0xf2a9('0x85')]=function(_0x28be5f,_0x393a5e,_0x75be2e){var _0x3cc912={};var _0x3ef0b4={};var _0x292bcf;var _0x2d902f;return db[_0xf2a9('0x40')][_0xf2a9('0x6a')]({'where':{'id':_0x28be5f[_0xf2a9('0x58')]['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x393a5e,null))[_0xf2a9('0x24')](function(_0xdb67fb){if(_0xdb67fb){_0x292bcf=_0xdb67fb;_0x3ef0b4[_0xf2a9('0x43')]=_[_0xf2a9('0x5a')](db[_0xf2a9('0x81')]['rawAttributes']);_0x3ef0b4[_0xf2a9('0x44')]=_[_0xf2a9('0x5a')](_0x28be5f[_0xf2a9('0x44')]);_0x3ef0b4[_0xf2a9('0x45')]=_[_0xf2a9('0x5b')](_0x3ef0b4[_0xf2a9('0x43')],_0x3ef0b4[_0xf2a9('0x44')]);_0x3cc912['attributes']=_[_0xf2a9('0x5b')](_0x3ef0b4[_0xf2a9('0x43')],qs[_0xf2a9('0x47')](_0x28be5f[_0xf2a9('0x44')][_0xf2a9('0x47')]));_0x3cc912[_0xf2a9('0x46')]=_0x3cc912[_0xf2a9('0x46')][_0xf2a9('0x5c')]?_0x3cc912[_0xf2a9('0x46')]:_0x3ef0b4['model'];_0x3cc912[_0xf2a9('0x4a')]=qs[_0xf2a9('0x4b')](_0x28be5f[_0xf2a9('0x44')][_0xf2a9('0x4b')]);_0x3cc912['where']=qs['filters'](_[_0xf2a9('0x4c')](_0x28be5f[_0xf2a9('0x44')],_0x3ef0b4[_0xf2a9('0x45')]));if(_0x28be5f['query'][_0xf2a9('0x4d')]){_0x3cc912[_0xf2a9('0x4e')]=_[_0xf2a9('0x50')](_0x3cc912[_0xf2a9('0x4e')],{'$or':_['map'](_0x3cc912[_0xf2a9('0x46')],function(_0x5c1d29){var _0x3ddeff={};_0x3ddeff[_0x5c1d29]={'$like':'%'+_0x28be5f['query'][_0xf2a9('0x4d')]+'%'};return _0x3ddeff;})});}_0x3cc912=_['merge']({},_0x3cc912,_0x28be5f[_0xf2a9('0x51')]);return _0x292bcf['getApplications'](_0x3cc912);}})[_0xf2a9('0x24')](function(_0xfdb9e1){if(_0xfdb9e1){_0x2d902f=_0xfdb9e1[_0xf2a9('0x5c')];if(!_0x28be5f['query'][_0xf2a9('0x48')](_0xf2a9('0x49'))){_0x3cc912[_0xf2a9('0x34')]=qs['limit'](_0x28be5f[_0xf2a9('0x44')][_0xf2a9('0x34')]);_0x3cc912[_0xf2a9('0x33')]=qs[_0xf2a9('0x33')](_0x28be5f[_0xf2a9('0x44')]['offset']);}return _0x292bcf[_0xf2a9('0x85')](_0x3cc912);}})[_0xf2a9('0x24')](function(_0x5b2b41){if(_0x5b2b41){return _0x5b2b41?{'count':_0x2d902f,'rows':_0x5b2b41}:null;}})[_0xf2a9('0x24')](respondWithResult(_0x393a5e,null))[_0xf2a9('0x56')](handleError(_0x393a5e,null));};function Extension(_0x102d3a,_0x119ec8,_0xd91de8,_0x21b279){this[_0xf2a9('0x86')]='from-voip-provider';this[_0xf2a9('0x87')]=_0x102d3a[_0xf2a9('0x88')];this[_0xf2a9('0x89')]=_0x21b279;this[_0xf2a9('0x42')]=_0xf2a9('0x8a');this[_0xf2a9('0x8b')]=_0xf2a9('0x8c');this[_0xf2a9('0x68')]=_0x102d3a['id'];this['priority']=_0x119ec8;this[_0xf2a9('0x8d')]=_0xd91de8;}function createExtensionsReciveFax(_0x403558){var _0x145d07=0x1;var _0x13b353=[];_0x13b353[_0xf2a9('0x8e')](new Extension(_0x403558,_0x145d07,'',_0xf2a9('0x8f')));_0x145d07+=0x1;_0x13b353['push'](new Extension(_0x403558,_0x145d07,_0xf2a9('0x90'),_0xf2a9('0x91')));_0x145d07+=0x1;for(var _0x4b6d08 in _0x403558){if(_0x403558[_0xf2a9('0x48')](_0x4b6d08)&&(_0x4b6d08==='ecm'||_0x4b6d08===_0xf2a9('0x88')||_0x4b6d08===_0xf2a9('0x92')||_0x4b6d08===_0xf2a9('0x93')||_0x4b6d08===_0xf2a9('0x94')||_0x4b6d08===_0xf2a9('0x95')||_0x4b6d08===_0xf2a9('0x96')||_0x4b6d08===_0xf2a9('0x97')||_0x4b6d08===_0xf2a9('0x98'))){_0x13b353['push'](new Extension(_0x403558,_0x145d07,'FAXOPT('+_0x4b6d08+')='+_0x403558[_0x4b6d08],_0xf2a9('0x91')));_0x145d07+=0x1;}}_0x13b353[_0xf2a9('0x8e')](new Extension(_0x403558,_0x145d07,'6',_0xf2a9('0x99')));_0x145d07+=0x1;_0x13b353[_0xf2a9('0x8e')](new Extension(_0x403558,_0x145d07,_0xf2a9('0x9a'),'ReceiveFax'));_0x145d07=0x0;return _0x13b353;}exports[_0xf2a9('0x9b')]=function(_0x245d5c,_0x36e8b4,_0x9f0686){var _0x36c4d5;return db['sequelize'][_0xf2a9('0x80')](function(_0x39312c){return db[_0xf2a9('0x40')]['create'](_0x245d5c[_0xf2a9('0x66')],{'transaction':_0x39312c})[_0xf2a9('0x24')](function(_0x20bce8){_0x36c4d5=_0x20bce8[_0xf2a9('0x62')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x36c4d5),{'transaction':_0x39312c});});})[_0xf2a9('0x24')](function(){return _0x36c4d5;})['then'](respondWithResult(_0x36e8b4,null))[_0xf2a9('0x56')](handleError(_0x36e8b4,null));};exports[_0xf2a9('0x9c')]=function(_0x4ee5ca,_0x15a5ac,_0x4ae347){var _0x2cf81f;return db[_0xf2a9('0x7f')][_0xf2a9('0x80')](function(_0x4053e7){return db[_0xf2a9('0x40')][_0xf2a9('0x38')](_0x4ee5ca['body'],{'where':{'id':_0x4ee5ca['body']['id']},'transaction':_0x4053e7})[_0xf2a9('0x24')](function(_0x222a1e){return db['VoiceExtension'][_0xf2a9('0x39')]({'where':{'FaxAccountId':_0x4ee5ca[_0xf2a9('0x66')]['id']},'transaction':_0x4053e7})[_0xf2a9('0x24')](function(_0x204a66){return db[_0xf2a9('0x9d')][_0xf2a9('0x82')](createExtensionsReciveFax(_[_0xf2a9('0x73')](_0x4ee5ca[_0xf2a9('0x66')],['tech','key',_0xf2a9('0x9e'),_0xf2a9('0x9f'),_0xf2a9('0xa0'),_0xf2a9('0xa1')])),{'transaction':_0x4053e7});});});})[_0xf2a9('0x24')](function(){return db['FaxAccount'][_0xf2a9('0xa2')](_0x4ee5ca[_0xf2a9('0x66')]['id']);})[_0xf2a9('0x24')](respondWithResult(_0x15a5ac,null))[_0xf2a9('0x56')](handleError(_0x15a5ac,null));};exports[_0xf2a9('0xa3')]=function(_0x389a26,_0x43333c,_0x41537a){var _0x150722={'raw':!![],'where':{}};var _0x32da86={};var _0x50ac73={'count':0x0,'rows':[]};return db[_0xf2a9('0x40')][_0xf2a9('0x6a')]({'where':{'id':_0x389a26['params']['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x43333c,null))[_0xf2a9('0x24')](function(_0x1142f3){if(_0x1142f3){_0x32da86[_0xf2a9('0x43')]=_[_0xf2a9('0x5a')](db['FaxMessage'][_0xf2a9('0x70')]);_0x32da86[_0xf2a9('0x44')]=_['keys'](_0x389a26[_0xf2a9('0x44')]);_0x32da86[_0xf2a9('0x45')]=_[_0xf2a9('0x5b')](_0x32da86[_0xf2a9('0x43')],_0x32da86[_0xf2a9('0x44')]);_0x150722[_0xf2a9('0x46')]=_['intersection'](_0x32da86[_0xf2a9('0x43')],qs['fields'](_0x389a26[_0xf2a9('0x44')][_0xf2a9('0x47')]));_0x150722[_0xf2a9('0x46')]=_0x150722['attributes']['length']?_0x150722[_0xf2a9('0x46')]:_0x32da86[_0xf2a9('0x43')];if(!_0x389a26[_0xf2a9('0x44')][_0xf2a9('0x48')]('nolimit')){_0x150722[_0xf2a9('0x34')]=qs[_0xf2a9('0x34')](_0x389a26[_0xf2a9('0x44')][_0xf2a9('0x34')]);_0x150722[_0xf2a9('0x33')]=qs[_0xf2a9('0x33')](_0x389a26[_0xf2a9('0x44')][_0xf2a9('0x33')]);}_0x150722[_0xf2a9('0x4a')]=qs['sort'](_0x389a26[_0xf2a9('0x44')]['sort']);_0x150722[_0xf2a9('0x4e')]=qs[_0xf2a9('0x45')](_[_0xf2a9('0x4c')](_0x389a26['query'],_0x32da86[_0xf2a9('0x45')]));_0x150722[_0xf2a9('0x4e')][_0xf2a9('0x68')]=_0x1142f3['id'];if(_0x389a26[_0xf2a9('0x44')][_0xf2a9('0x4d')]){_0x150722[_0xf2a9('0x4e')]=_[_0xf2a9('0x50')](_0x150722['where'],{'$or':_[_0xf2a9('0x3f')](_0x150722[_0xf2a9('0x46')],function(_0x1faccd){var _0x2365cf={};_0x2365cf[_0x1faccd]={'$like':'%'+_0x389a26[_0xf2a9('0x44')]['filter']+'%'};return _0x2365cf;})});}if(_0x389a26[_0xf2a9('0x44')][_0xf2a9('0xa4')]){var _0x312a02=_0x389a26[_0xf2a9('0x44')]['$gte'][_0xf2a9('0xa5')](',');var _0x4b37f4={};_0x4b37f4[_0x312a02[0x0]]={'$gte':moment(_0x312a02[0x1])[_0xf2a9('0xa6')](_0xf2a9('0xa7'))};_0x150722[_0xf2a9('0x4e')]=_[_0xf2a9('0x50')](_0x150722[_0xf2a9('0x4e')],_0x4b37f4);}_0x150722=_[_0xf2a9('0x50')]({},_0x150722,_0x389a26[_0xf2a9('0x51')]);return db[_0xf2a9('0xa8')]['count']({'where':_0x150722[_0xf2a9('0x4e')]})[_0xf2a9('0x24')](function(_0x40c047){_0x50ac73[_0xf2a9('0x52')]=_0x40c047;if(_0x389a26[_0xf2a9('0x44')][_0xf2a9('0x5d')]){_0x150722[_0xf2a9('0x53')]=[{'all':!![]}];}return db['FaxMessage'][_0xf2a9('0x54')](_0x150722);})[_0xf2a9('0x24')](function(_0x7ac5b0){_0x50ac73[_0xf2a9('0x55')]=_0x7ac5b0;return _0x50ac73;});}})['then'](respondWithFilteredResult(_0x43333c,_0x150722))['catch'](handleError(_0x43333c,null));};exports[_0xf2a9('0xa9')]=function(_0x55a669,_0x232347,_0x4abfff){var _0x13a289,_0x36528b={},_0x506304;if(_0x55a669[_0xf2a9('0x66')]['to']){_0x506304=_0x55a669[_0xf2a9('0x66')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x55a669[_0xf2a9('0x58')]['id']},'include':[{'model':db[_0xf2a9('0xaa')],'as':'List','include':[{'model':db[_0xf2a9('0x76')],'as':_0xf2a9('0xab'),'where':{'fax':_0x506304},'limit':0x1,'order':[[_0xf2a9('0x9f'),_0xf2a9('0xac')]]}]}]})[_0xf2a9('0x24')](handleEntityNotFound(_0x232347,null))[_0xf2a9('0x24')](function(_0x307f70){_0x13a289=_0x307f70;if(_0x55a669['body'][_0xf2a9('0xad')]&&_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')]['length']){for(var _0x5be22c=0x0;_0x5be22c<_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][_0xf2a9('0x5c')];_0x5be22c+=0x1){_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][_0x5be22c]={'filename':_0x55a669['body'][_0xf2a9('0xad')][_0x5be22c][_0xf2a9('0x3c')],'id':_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][_0x5be22c]['id'],'path':path['join'](config[_0xf2a9('0xae')],_0xf2a9('0xaf'),_0x55a669['body'][_0xf2a9('0xad')][_0x5be22c][_0xf2a9('0xb0')])};}}return respondWithRpcPromise(_0xf2a9('0xb1'),_0xf2a9('0xb1'),{'FaxAccountId':_['isNil'](_0x55a669[_0xf2a9('0x58')]['id'])?undefined:_0x55a669['params']['id'],'path':_[_0xf2a9('0xb2')](_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][0x0][_0xf2a9('0x8')])?undefined:_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][0x0][_0xf2a9('0x8')],'fax':_[_0xf2a9('0xb2')](_0x55a669['body']['to'][0x0])?undefined:_0x55a669[_0xf2a9('0x66')]['to'][0x0]},client9002);})[_0xf2a9('0x24')](function(){if(_0x13a289){if(_[_0xf2a9('0xb2')](_0x55a669['body']['from'])){_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xb3')]=util[_0xf2a9('0xa6')](_0xf2a9('0xb4'),_0x13a289[_0xf2a9('0x3c')],_0x13a289[_0xf2a9('0xb5')]);}if(_0x13a289[_0xf2a9('0xb6')]){if(_0x13a289[_0xf2a9('0xb6')][_0xf2a9('0xab')][_0xf2a9('0x5c')]){return _0x13a289[_0xf2a9('0xb6')][_0xf2a9('0xab')][0x0];}else{return db[_0xf2a9('0x76')][_0xf2a9('0x5f')](_[_0xf2a9('0xb7')](_0x55a669['body'],{'firstName':_0x55a669[_0xf2a9('0x66')]['to'][0x0],'phone':_0x55a669[_0xf2a9('0x66')]['to'][0x0],'fax':_0x55a669[_0xf2a9('0x66')]['to'][0x0],'ListId':_0x13a289['ListId']}));}}else{throw new Error(_0xf2a9('0xb8'));}}else{throw new Error(_0xf2a9('0xb9'));}})[_0xf2a9('0x24')](function(_0x1d83df){if(_0x1d83df){return db['FaxInteraction']['find']({'where':{'ContactId':_0x1d83df['id'],'closed':![],'FaxAccountId':_0x13a289['id']}})[_0xf2a9('0x24')](function(_0x11dc8f){if(_0x11dc8f){return[_0x11dc8f,![]];}return db[_0xf2a9('0x75')][_0xf2a9('0x5f')]({'UserId':_0x55a669[_0xf2a9('0x60')]['id'],'ContactId':_0x1d83df['id'],'FaxAccountId':_0x13a289['id'],'fax':_0x55a669[_0xf2a9('0x66')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xf2a9('0x50')](_0x55a669['body'],{'read':![],'body':_0x55a669['body']['attachments'][0x0][_0xf2a9('0xba')],'FaxAccountId':_0x13a289['id'],'UserId':_0x55a669[_0xf2a9('0x60')]['id'],'ContactId':_0x1d83df['id'],'AttachmentId':_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][0x0]['id']})]},{'include':[{'model':db[_0xf2a9('0xa8')],'as':_0xf2a9('0xbb')}]})[_0xf2a9('0x24')](function(_0x49dc87){return[_0x49dc87,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf2a9('0xbc')](function(_0x5569dc,_0x1b02f1){if(_0x1b02f1){return _0x5569dc;}return db['FaxMessage'][_0xf2a9('0x5f')]({'direction':_0xf2a9('0xbd'),'read':![],'body':_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][0x0][_0xf2a9('0xba')],'FaxAccountId':_0x13a289['id'],'FaxInteractionId':_0x5569dc['id'],'UserId':_0x55a669['user']['id'],'ContactId':_0x5569dc[_0xf2a9('0xbe')],'AttachmentId':_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][0x0]['id']})[_0xf2a9('0x24')](function(_0x51fbc4){_0x5569dc[_0xf2a9('0xbf')][_0xf2a9('0xbb')]=[];_0x5569dc['dataValues'][_0xf2a9('0xbb')][_0xf2a9('0x8e')](_0x51fbc4[_0xf2a9('0xbf')]);return _0x5569dc;});})[_0xf2a9('0x24')](function(_0x2f0fec){respondWithRpcPromise(_0xf2a9('0xc0'),_0xf2a9('0xc0'),{'FaxAccountId':_[_0xf2a9('0xb2')](_0x55a669['params']['id'])?undefined:_0x55a669['params']['id'],'path':_[_0xf2a9('0xb2')](_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][0x0]['path'])?undefined:_0x55a669['body'][_0xf2a9('0xad')][0x0][_0xf2a9('0x8')],'fax':_[_0xf2a9('0xb2')](_0x55a669[_0xf2a9('0x66')]['to'][0x0])?undefined:_0x55a669['body']['to'][0x0],'AttachmentId':_0x55a669[_0xf2a9('0x66')]['attachments'][0x0]['id']},client9002)[_0xf2a9('0x24')](function(_0x2a2738){logger[_0xf2a9('0x25')](_0xf2a9('0xc1'),_0x2a2738);})[_0xf2a9('0x56')](function(_0x486156){logger[_0xf2a9('0x25')]('SendFaxRpc,\x20%s',_0x486156);});return _0x2f0fec;})[_0xf2a9('0x24')](respondWithResult(_0x232347,null))[_0xf2a9('0x56')](handleError(_0x232347,null));};exports[_0xf2a9('0xc2')]=function(_0x128fe5,_0x302a9c,_0x2e51d7){return db[_0xf2a9('0x40')][_0xf2a9('0x5e')]({'where':{'id':_0x128fe5[_0xf2a9('0x58')]['id']}})['then'](handleEntityNotFound(_0x302a9c,null))[_0xf2a9('0x24')](function(_0x18e14a){if(_0x18e14a){return _0x18e14a[_0xf2a9('0xc2')](_0x128fe5[_0xf2a9('0x66')][_0xf2a9('0x6c')],_['omit'](_0x128fe5[_0xf2a9('0x66')],['ids','id'])||{})[_0xf2a9('0xbc')](function(_0xcaf195){for(var _0x36efe7=0x0;_0x36efe7<_0x128fe5[_0xf2a9('0x66')][_0xf2a9('0x6c')][_0xf2a9('0x5c')];_0x36efe7+=0x1){socket[_0xf2a9('0xc3')](_0xf2a9('0xc4'),{'UserId':_0x128fe5[_0xf2a9('0x66')][_0xf2a9('0x6c')][_0x36efe7],'FaxAccountId':_0x128fe5['params']['id']});}return _0xcaf195;});}})[_0xf2a9('0x24')](respondWithResult(_0x302a9c,null))[_0xf2a9('0x56')](handleError(_0x302a9c,null));};exports['removeAgents']=function(_0x9388f7,_0x53e872,_0x2a0759){return db[_0xf2a9('0x40')][_0xf2a9('0x5e')]({'where':{'id':_0x9388f7[_0xf2a9('0x58')]['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x53e872,null))[_0xf2a9('0x24')](function(_0x19b9f5){if(_0x19b9f5){return _0x19b9f5[_0xf2a9('0xc5')](_0x9388f7['query'][_0xf2a9('0x6c')])[_0xf2a9('0x24')](function(){if(_['isArray'](_0x9388f7['query'][_0xf2a9('0x6c')])){for(var _0xb4b695=0x0;_0xb4b695<_0x9388f7[_0xf2a9('0x44')][_0xf2a9('0x6c')][_0xf2a9('0x5c')];_0xb4b695+=0x1){socket[_0xf2a9('0xc3')](_0xf2a9('0xc6'),{'UserId':Number(_0x9388f7['query'][_0xf2a9('0x6c')][_0xb4b695]),'FaxAccountId':Number(_0x9388f7[_0xf2a9('0x58')]['id'])});}}else{socket[_0xf2a9('0xc3')]('userFaxAccount:remove',{'UserId':Number(_0x9388f7[_0xf2a9('0x44')]['ids']),'FaxAccountId':Number(_0x9388f7[_0xf2a9('0x58')]['id'])});}});}})[_0xf2a9('0x24')](respondWithStatusCode(_0x53e872,null))[_0xf2a9('0x56')](handleError(_0x53e872,null));};exports['getAgents']=function(_0x24c8a7,_0x20db89,_0x3c851c){var _0x5a1311={};var _0x5ba011={};var _0x29a8a8;var _0x1869cd;return db['FaxAccount'][_0xf2a9('0x6a')]({'where':{'id':_0x24c8a7[_0xf2a9('0x58')]['id']}})['then'](handleEntityNotFound(_0x20db89,null))[_0xf2a9('0x24')](function(_0x210dba){if(_0x210dba){_0x29a8a8=_0x210dba;_0x5ba011[_0xf2a9('0x43')]=_[_0xf2a9('0x5a')](db[_0xf2a9('0x78')][_0xf2a9('0x70')]);_0x5ba011[_0xf2a9('0x44')]=_['keys'](_0x24c8a7[_0xf2a9('0x44')]);_0x5ba011['filters']=_[_0xf2a9('0x5b')](_0x5ba011[_0xf2a9('0x43')],_0x5ba011['query']);_0x5a1311[_0xf2a9('0x46')]=_['intersection'](_0x5ba011[_0xf2a9('0x43')],qs[_0xf2a9('0x47')](_0x24c8a7['query']['fields']));_0x5a1311[_0xf2a9('0x46')]=_0x5a1311[_0xf2a9('0x46')]['length']?_0x5a1311[_0xf2a9('0x46')]:_0x5ba011[_0xf2a9('0x43')];_0x5a1311['order']=qs[_0xf2a9('0x4b')](_0x24c8a7[_0xf2a9('0x44')][_0xf2a9('0x4b')]);_0x5a1311['where']=qs['filters'](_[_0xf2a9('0x4c')](_0x24c8a7[_0xf2a9('0x44')],_0x5ba011[_0xf2a9('0x45')]));if(_0x24c8a7[_0xf2a9('0x44')][_0xf2a9('0x4d')]){_0x5a1311[_0xf2a9('0x4e')]=_[_0xf2a9('0x50')](_0x5a1311['where'],{'$or':_[_0xf2a9('0x3f')](_0x5a1311[_0xf2a9('0x46')],function(_0x27c3e1){var _0x20df0d={};_0x20df0d[_0x27c3e1]={'$like':'%'+_0x24c8a7[_0xf2a9('0x44')][_0xf2a9('0x4d')]+'%'};return _0x20df0d;})});}_0x5a1311=_['merge']({},_0x5a1311,_0x24c8a7[_0xf2a9('0x51')]);return _0x29a8a8[_0xf2a9('0xc7')](_0x5a1311);}})[_0xf2a9('0x24')](function(_0xc44256){if(_0xc44256){_0x1869cd=_0xc44256[_0xf2a9('0x5c')];if(!_0x24c8a7[_0xf2a9('0x44')][_0xf2a9('0x48')](_0xf2a9('0x49'))){_0x5a1311[_0xf2a9('0x34')]=qs[_0xf2a9('0x34')](_0x24c8a7['query'][_0xf2a9('0x34')]);_0x5a1311[_0xf2a9('0x33')]=qs['offset'](_0x24c8a7['query']['offset']);}return _0x29a8a8[_0xf2a9('0xc7')](_0x5a1311);}})[_0xf2a9('0x24')](function(_0x5d62fe){if(_0x5d62fe){return _0x5d62fe?{'count':_0x1869cd,'rows':_0x5d62fe}:null;}})[_0xf2a9('0x24')](respondWithResult(_0x20db89,null))['catch'](handleError(_0x20db89,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 2c070db..73dd5a0 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 _0xcab6=['update','remove','emit','hasOwnProperty','exports','events','FaxAccount','setMaxListeners','save'];(function(_0x1f23b1,_0x57c83f){var _0x3c9197=function(_0x2f6e4a){while(--_0x2f6e4a){_0x1f23b1['push'](_0x1f23b1['shift']());}};_0x3c9197(++_0x57c83f);}(_0xcab6,0xd4));var _0x6cab=function(_0x58a7a2,_0x52b127){_0x58a7a2=_0x58a7a2-0x0;var _0x4fe6b6=_0xcab6[_0x58a7a2];return _0x4fe6b6;};'use strict';var EventEmitter=require(_0x6cab('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x6cab('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x6cab('0x2')](0x0);var events={'afterCreate':_0x6cab('0x3'),'afterUpdate':_0x6cab('0x4'),'afterDestroy':_0x6cab('0x5')};function emitEvent(_0x129d57){return function(_0x5ea2d8,_0xa8b534,_0x4c79f1){FaxAccountEvents[_0x6cab('0x6')](_0x129d57+':'+_0x5ea2d8['id'],_0x5ea2d8);FaxAccountEvents[_0x6cab('0x6')](_0x129d57,_0x5ea2d8);_0x4c79f1(null);};}for(var e in events){if(events[_0x6cab('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x6cab('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x3442=['hook','exports','events','../../mysqldb','FaxAccount','save','update','remove','hasOwnProperty'];(function(_0x2499e5,_0x41bdf0){var _0x496e0c=function(_0x40a6f){while(--_0x40a6f){_0x2499e5['push'](_0x2499e5['shift']());}};_0x496e0c(++_0x41bdf0);}(_0x3442,0xa4));var _0x2344=function(_0x4d5478,_0x17a715){_0x4d5478=_0x4d5478-0x0;var _0x1aa230=_0x3442[_0x4d5478];return _0x1aa230;};'use strict';var EventEmitter=require(_0x2344('0x0'));var FaxAccount=require(_0x2344('0x1'))['db'][_0x2344('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2344('0x3'),'afterUpdate':_0x2344('0x4'),'afterDestroy':_0x2344('0x5')};function emitEvent(_0x101639){return function(_0x192572,_0x34d87a,_0x15be17){FaxAccountEvents['emit'](_0x101639+':'+_0x192572['id'],_0x192572);FaxAccountEvents['emit'](_0x101639,_0x192572);_0x15be17(null);};}for(var e in events){if(events[_0x2344('0x6')](e)){var event=events[e];FaxAccount[_0x2344('0x7')](e,emitEvent(event));}}module[_0x2344('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index a877734..443def8 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 _0x02bd=['FaxAccount','fax_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','define'];(function(_0x566200,_0x126fd1){var _0x189ac0=function(_0x34b0ae){while(--_0x34b0ae){_0x566200['push'](_0x566200['shift']());}};_0x189ac0(++_0x126fd1);}(_0x02bd,0x183));var _0xd02b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x02bd[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xd02b('0x0'));var util=require('util');var logger=require(_0xd02b('0x1'))(_0xd02b('0x2'));var moment=require('moment');var BPromise=require(_0xd02b('0x3'));var rp=require(_0xd02b('0x4'));var fs=require('fs');var path=require(_0xd02b('0x5'));var rimraf=require('rimraf');var config=require(_0xd02b('0x6'));var attributes=require(_0xd02b('0x7'));module['exports']=function(_0x2cd0f0,_0x376f9e){return _0x2cd0f0[_0xd02b('0x8')](_0xd02b('0x9'),attributes,{'tableName':_0xd02b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa745=['fax_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x4e11e7,_0x42d0b6){var _0x1d7d39=function(_0x416030){while(--_0x416030){_0x4e11e7['push'](_0x4e11e7['shift']());}};_0x1d7d39(++_0x42d0b6);}(_0xa745,0x1ef));var _0x5a74=function(_0x83b552,_0x29c8c7){_0x83b552=_0x83b552-0x0;var _0x150412=_0xa745[_0x83b552];return _0x150412;};'use strict';var _=require('lodash');var util=require(_0x5a74('0x0'));var logger=require(_0x5a74('0x1'))(_0x5a74('0x2'));var moment=require(_0x5a74('0x3'));var BPromise=require(_0x5a74('0x4'));var rp=require(_0x5a74('0x5'));var fs=require('fs');var path=require(_0x5a74('0x6'));var rimraf=require(_0x5a74('0x7'));var config=require('../../config/environment');var attributes=require(_0x5a74('0x8'));module[_0x5a74('0x9')]=function(_0x2795ef,_0x19017e){return _0x2795ef[_0x5a74('0xa')](_0x5a74('0xb'),attributes,{'tableName':_0x5a74('0xc'),'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 234e938..b434d3e 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 _0x5482=['raw','where','attributes','limit','include','map','model','debug','stringify','NotifyFaxAccount','body','fax','CmContact','Sequelize','keys','updatedAt','createdAt','CompanyId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','DESC','FaxApplication','List','get','Applications','list','applications','orderBy','priority','asc','defaults','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','length','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options'];(function(_0x7ce717,_0x53da6c){var _0x2b09c6=function(_0x5e733c){while(--_0x5e733c){_0x7ce717['push'](_0x7ce717['shift']());}};_0x2b09c6(++_0x53da6c);}(_0x5482,0xf8));var _0x2548=function(_0x56a1d0,_0x16a437){_0x56a1d0=_0x56a1d0-0x0;var _0x5952c4=_0x5482[_0x56a1d0];return _0x5952c4;};'use strict';var _=require(_0x2548('0x0'));var util=require(_0x2548('0x1'));var moment=require(_0x2548('0x2'));var BPromise=require(_0x2548('0x3'));var rs=require(_0x2548('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2548('0x5'))['db'];var utils=require(_0x2548('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2548('0x7'));var client=jayson[_0x2548('0x8')][_0x2548('0x9')]({'port':0x232c});config[_0x2548('0xa')]=_['defaults'](config[_0x2548('0xa')],{'host':_0x2548('0xb'),'port':0x18eb});var socket=require(_0x2548('0xc'))(new Redis(config[_0x2548('0xa')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2077b7,_0x4afdd5,_0x586076){return new BPromise(function(_0x168649,_0x2cc147){return client[_0x2548('0xd')](_0x2077b7,_0x586076)[_0x2548('0xe')](function(_0x157500){logger[_0x2548('0xf')]('FaxAccount,\x20%s,\x20%s',_0x4afdd5,_0x2548('0x10'));logger['debug'](_0x2548('0x11'),_0x4afdd5,_0x2548('0x10'),JSON['stringify'](_0x157500));if(_0x157500['error']){if(_0x157500[_0x2548('0x12')][_0x2548('0x13')]===0x1f4){logger[_0x2548('0x12')](_0x2548('0x14'),_0x4afdd5,_0x157500[_0x2548('0x12')][_0x2548('0x15')]);return _0x2cc147(_0x157500[_0x2548('0x12')]['message']);}logger[_0x2548('0x12')](_0x2548('0x14'),_0x4afdd5,_0x157500['error'][_0x2548('0x15')]);return _0x168649(_0x157500['error']['message']);}else{logger[_0x2548('0xf')](_0x2548('0x14'),_0x4afdd5,_0x2548('0x10'));_0x168649(_0x157500[_0x2548('0x16')][_0x2548('0x15')]);}})[_0x2548('0x17')](function(_0xc7ca0d){logger[_0x2548('0x12')]('FaxAccount,\x20%s,\x20%s',_0x4afdd5,_0xc7ca0d);_0x2cc147(_0xc7ca0d);});});}exports[_0x2548('0x18')]=function(_0x31c815){var _0x46b458=this;return new Promise(function(_0x4729f0,_0x439251){return db[_0x2548('0x19')][_0x2548('0x1a')]({'raw':_0x31c815[_0x2548('0x1b')]?_0x31c815[_0x2548('0x1b')][_0x2548('0x1c')]===undefined?!![]:![]:!![],'where':_0x31c815[_0x2548('0x1b')]?_0x31c815[_0x2548('0x1b')][_0x2548('0x1d')]||null:null,'attributes':_0x31c815['options']?_0x31c815[_0x2548('0x1b')][_0x2548('0x1e')]||null:null,'limit':_0x31c815[_0x2548('0x1b')]?_0x31c815[_0x2548('0x1b')][_0x2548('0x1f')]||null:null,'include':_0x31c815['options']?_0x31c815['options'][_0x2548('0x20')]?_[_0x2548('0x21')](_0x31c815[_0x2548('0x1b')]['include'],function(_0x4fa0d0){return{'model':db[_0x4fa0d0[_0x2548('0x22')]],'as':_0x4fa0d0['as'],'attributes':_0x4fa0d0['attributes'],'include':_0x4fa0d0[_0x2548('0x20')]?_[_0x2548('0x21')](_0x4fa0d0[_0x2548('0x20')],function(_0x4f9af7){return{'model':db[_0x4f9af7[_0x2548('0x22')]],'as':_0x4f9af7['as'],'attributes':_0x4f9af7[_0x2548('0x1e')],'include':_0x4f9af7[_0x2548('0x20')]?_[_0x2548('0x21')](_0x4f9af7[_0x2548('0x20')],function(_0x5c1dc5){return{'model':db[_0x5c1dc5[_0x2548('0x22')]],'as':_0x5c1dc5['as'],'attributes':_0x5c1dc5[_0x2548('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2548('0xe')](function(_0x3b80b1){logger[_0x2548('0xf')]('GetFaxAccount',_0x31c815);logger[_0x2548('0x23')](_0x2548('0x18'),_0x31c815,JSON[_0x2548('0x24')](_0x3b80b1));_0x4729f0(_0x3b80b1);})[_0x2548('0x17')](function(_0x5524a7){logger[_0x2548('0x12')]('GetFaxAccount',_0x5524a7[_0x2548('0x15')],_0x31c815);_0x439251(_0x46b458[_0x2548('0x12')](0x1f4,_0x5524a7[_0x2548('0x15')]));});});};exports[_0x2548('0x25')]=function(_0x895db3,_0x340ef7,_0x2f2cfb){var _0x4f1931=this;return new Promise(function(_0x2060f2,_0x42d37a){var _0x1cf709={'body':_0x895db3[_0x2548('0x26')],'channel':_0x2548('0x27')};var _0x5c6af6=[];var _0x58f80b=[];var _0x44accf={};return db[_0x2548('0x28')]['describe']()[_0x2548('0xe')](function(_0x283f86){if(!_0x283f86){throw new db[(_0x2548('0x29'))]['ValidationError']('no\x20available\x20attributes');}_0x5c6af6=_['difference'](_[_0x2548('0x2a')](_0x283f86),['createdAt',_0x2548('0x2b')]);_0x58f80b=_['difference'](_[_0x2548('0x2a')](_0x283f86),[_0x2548('0x2c'),_0x2548('0x2b'),_0x2548('0x2d'),'ListId']);if(_0x895db3[_0x2548('0x26')]['id']){delete _0x895db3['body']['id'];}if(_[_0x2548('0x2e')](_0x895db3['body'][_0x2548('0x2f')])){throw new db['Sequelize'][(_0x2548('0x30'))](_0x2548('0x31'));}if(_[_0x2548('0x2e')](_0x895db3[_0x2548('0x26')]['body'])||_0x895db3[_0x2548('0x26')][_0x2548('0x26')]===''){throw new db['Sequelize'][(_0x2548('0x30'))](_0x2548('0x32'));}if(_[_0x2548('0x2e')](_0x895db3[_0x2548('0x26')]['mapKey'])){throw new db[(_0x2548('0x29'))][(_0x2548('0x30'))](_0x2548('0x33')+_0x58f80b);}if(!_[_0x2548('0x34')](_0x58f80b,_0x895db3[_0x2548('0x26')][_0x2548('0x35')])){throw new db[(_0x2548('0x29'))]['ValidationError'](_0x2548('0x36')+_0x58f80b);}_0x44accf[_0x895db3[_0x2548('0x26')][_0x2548('0x35')]]=_0x895db3[_0x2548('0x26')]['from'];})[_0x2548('0xe')](function(){return db[_0x2548('0x19')]['find']({'where':{'id':_0x895db3[_0x2548('0x37')]['id']},'include':[{'model':db[_0x2548('0x38')],'as':'List','include':[{'model':db[_0x2548('0x28')],'as':_0x2548('0x39'),'where':_0x44accf,'limit':0x1,'order':[[_0x2548('0x2b'),_0x2548('0x3a')]]}]},{'model':db[_0x2548('0x3b')],'as':'Applications'}]});})[_0x2548('0xe')](function(_0x476ae8){if(_0x476ae8&&_0x476ae8[_0x2548('0x3c')]){var _0xe2312b=_0x476ae8[_0x2548('0x3d')]({'plain':!![]});_0x1cf709[_0x2548('0x37')]=_0xe2312b;_0x1cf709['applications']=_0xe2312b[_0x2548('0x3e')];_0x1cf709[_0x2548('0x3f')]=_0xe2312b['List'];_0x1cf709[_0x2548('0x40')]=_[_0x2548('0x41')](_0x1cf709[_0x2548('0x40')],[_0x2548('0x42')],[_0x2548('0x43')]);if(_0x1cf709['account'][_0x2548('0x3e')]){delete _0x1cf709['account']['Applications'];}if(_0x1cf709[_0x2548('0x37')][_0x2548('0x3c')]&&_0x1cf709[_0x2548('0x37')][_0x2548('0x3c')][_0x2548('0x39')]['length']){return _0x1cf709[_0x2548('0x37')]['List'][_0x2548('0x39')][0x0];}var _0x4a8dfb=_[_0x2548('0x44')](_0x895db3[_0x2548('0x26')],{'firstName':_0x895db3['body'][_0x2548('0x2f')],'ListId':_0xe2312b['ListId']});_0x4a8dfb[_0x895db3[_0x2548('0x26')][_0x2548('0x35')]]=_0x895db3['body']['from'];return db[_0x2548('0x28')][_0x2548('0x45')](_0x4a8dfb,{'fields':_0x5c6af6,'raw':!![]});}})[_0x2548('0xe')](function(_0x102625){_0x1cf709[_0x2548('0x46')]=_0x102625;if(_0x102625){var _0x664d40={'ContactId':_0x102625['id'],'FaxAccountId':_0x895db3['account']['id'],'fax':_0x102625[_0x2548('0x27')]};return db[_0x2548('0x47')][_0x2548('0x48')]({'where':{'ContactId':_0x102625['id'],'closed':![],'FaxAccountId':_0x895db3['account']['id']}})[_0x2548('0xe')](function(_0x3d35f1){if(_0x3d35f1){return[_0x3d35f1,![]];}return db['FaxInteraction'][_0x2548('0x45')](_0x664d40)['then'](function(_0x35eb61){return[_0x35eb61,!![]];});});}else{throw new Error(_0x2548('0x49'));}})[_0x2548('0x4a')](function(_0x4bd47b,_0x5f55d3){var _0x11028e=_0x4bd47b[_0x2548('0x3d')]({'plain':!![]});if(_0x5f55d3){if(_0x1cf709[_0x2548('0x37')]['autoclose']){_0x1cf709[_0x2548('0x40')]['push']({'id':0x0,'priority':_0x1cf709[_0x2548('0x40')][_0x2548('0x4b')]+0x1,'app':_0x2548('0x4c'),'appdata':_0x2548('0x4d'),'interval':_0x2548('0x4e')});}_0x11028e[_0x2548('0x4f')]=!![];}else{_0x11028e[_0x2548('0x4f')]=![];}_0x1cf709['interaction']=_0x11028e;return db[_0x2548('0x50')][_0x2548('0x45')]({'body':_0x895db3[_0x2548('0x26')]['body'],'FaxAccountId':_0x895db3[_0x2548('0x37')]['id'],'FaxInteractionId':_0x4bd47b['id'],'direction':'in','ContactId':_0x4bd47b[_0x2548('0x51')],'AttachmentId':_0x895db3[_0x2548('0x26')][_0x2548('0x52')]});})[_0x2548('0xe')](function(_0x4b508b){_0x1cf709[_0x2548('0x15')]=_0x4b508b;if(_0x1cf709[_0x2548('0x53')][_0x2548('0x54')]){return db[_0x2548('0x55')]['find']({'attributes':['id','name'],'where':{'id':_0x1cf709[_0x2548('0x53')]['UserId']}})[_0x2548('0xe')](function(_0x489443){if(_0x489443){_0x1cf709['applications'][_0x2548('0x56')]({'id':0x0,'priority':0x0,'app':_0x2548('0x57'),'appdata':_0x489443[_0x2548('0x58')]+','+(_0x1cf709['account'][_0x2548('0x59')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x2548('0x5a'),_0x2548('0x5b'),_0x1cf709);});}return respondWithRpcPromise(_0x2548('0x5a'),_0x2548('0x5b'),_0x1cf709);})[_0x2548('0xe')](function(_0x1ea9fe){_0x2060f2(_0x1ea9fe);})[_0x2548('0x17')](function(_0x449a24){_0x42d37a(_0x4f1931[_0x2548('0x12')](0x1f4,_0x449a24['message']));});});}; \ No newline at end of file +var _0x7ba4=['agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','register','request','then','info','request\x20sent','debug','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','CompanyId','ListId','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','FaxApplication','Applications','get','applications','orderBy','priority','asc','Contacts','length','from','CmContact','contact','FaxInteraction','create','Contact\x20not\x20found','push','close','unmanaged','created','FaxMessage','AttachmentId','interaction','UserId','name','unshift'];(function(_0x380c46,_0x4bcad1){var _0x4f0ee2=function(_0x4e0a53){while(--_0x4e0a53){_0x380c46['push'](_0x380c46['shift']());}};_0x4f0ee2(++_0x4bcad1);}(_0x7ba4,0x104));var _0x47ba=function(_0x346148,_0x51ddc4){_0x346148=_0x346148-0x0;var _0x3ad67d=_0x7ba4[_0x346148];return _0x3ad67d;};'use strict';var _=require(_0x47ba('0x0'));var util=require('util');var moment=require(_0x47ba('0x1'));var BPromise=require(_0x47ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47ba('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x47ba('0x4'));var logger=require(_0x47ba('0x5'))(_0x47ba('0x6'));var config=require(_0x47ba('0x7'));var jayson=require(_0x47ba('0x8'));var client=jayson[_0x47ba('0x9')]['http']({'port':0x232c});config['redis']=_[_0x47ba('0xa')](config[_0x47ba('0xb')],{'host':_0x47ba('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47ba('0xb')]));require('./faxAccount.socket')[_0x47ba('0xd')](socket);function respondWithRpcPromise(_0x1ee6b4,_0x1ad74f,_0x398943){return new BPromise(function(_0x4d873b,_0x5eeb7d){return client[_0x47ba('0xe')](_0x1ee6b4,_0x398943)[_0x47ba('0xf')](function(_0x52cb91){logger[_0x47ba('0x10')]('FaxAccount,\x20%s,\x20%s',_0x1ad74f,_0x47ba('0x11'));logger[_0x47ba('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1ad74f,_0x47ba('0x11'),JSON[_0x47ba('0x13')](_0x52cb91));if(_0x52cb91['error']){if(_0x52cb91[_0x47ba('0x14')]['code']===0x1f4){logger[_0x47ba('0x14')](_0x47ba('0x15'),_0x1ad74f,_0x52cb91['error']['message']);return _0x5eeb7d(_0x52cb91['error'][_0x47ba('0x16')]);}logger[_0x47ba('0x14')](_0x47ba('0x15'),_0x1ad74f,_0x52cb91[_0x47ba('0x14')]['message']);return _0x4d873b(_0x52cb91['error'][_0x47ba('0x16')]);}else{logger[_0x47ba('0x10')](_0x47ba('0x15'),_0x1ad74f,'request\x20sent');_0x4d873b(_0x52cb91[_0x47ba('0x17')][_0x47ba('0x16')]);}})[_0x47ba('0x18')](function(_0x7e7c01){logger[_0x47ba('0x14')](_0x47ba('0x15'),_0x1ad74f,_0x7e7c01);_0x5eeb7d(_0x7e7c01);});});}exports[_0x47ba('0x19')]=function(_0x11e85b){var _0x1c41d1=this;return new Promise(function(_0x22bb7a,_0x180c04){return db[_0x47ba('0x1a')][_0x47ba('0x1b')]({'raw':_0x11e85b[_0x47ba('0x1c')]?_0x11e85b[_0x47ba('0x1c')][_0x47ba('0x1d')]===undefined?!![]:![]:!![],'where':_0x11e85b[_0x47ba('0x1c')]?_0x11e85b[_0x47ba('0x1c')][_0x47ba('0x1e')]||null:null,'attributes':_0x11e85b[_0x47ba('0x1c')]?_0x11e85b['options'][_0x47ba('0x1f')]||null:null,'limit':_0x11e85b[_0x47ba('0x1c')]?_0x11e85b['options'][_0x47ba('0x20')]||null:null,'include':_0x11e85b[_0x47ba('0x1c')]?_0x11e85b['options'][_0x47ba('0x21')]?_[_0x47ba('0x22')](_0x11e85b[_0x47ba('0x1c')][_0x47ba('0x21')],function(_0x263bdf){return{'model':db[_0x263bdf[_0x47ba('0x23')]],'as':_0x263bdf['as'],'attributes':_0x263bdf[_0x47ba('0x1f')],'include':_0x263bdf[_0x47ba('0x21')]?_[_0x47ba('0x22')](_0x263bdf[_0x47ba('0x21')],function(_0x8f7821){return{'model':db[_0x8f7821[_0x47ba('0x23')]],'as':_0x8f7821['as'],'attributes':_0x8f7821[_0x47ba('0x1f')],'include':_0x8f7821[_0x47ba('0x21')]?_['map'](_0x8f7821[_0x47ba('0x21')],function(_0x2a7b5f){return{'model':db[_0x2a7b5f[_0x47ba('0x23')]],'as':_0x2a7b5f['as'],'attributes':_0x2a7b5f[_0x47ba('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x47ba('0xf')](function(_0x45eaa5){logger[_0x47ba('0x10')](_0x47ba('0x19'),_0x11e85b);logger[_0x47ba('0x12')](_0x47ba('0x19'),_0x11e85b,JSON['stringify'](_0x45eaa5));_0x22bb7a(_0x45eaa5);})[_0x47ba('0x18')](function(_0x2252da){logger[_0x47ba('0x14')](_0x47ba('0x19'),_0x2252da[_0x47ba('0x16')],_0x11e85b);_0x180c04(_0x1c41d1[_0x47ba('0x14')](0x1f4,_0x2252da[_0x47ba('0x16')]));});});};exports[_0x47ba('0x24')]=function(_0x54e615,_0xbb27a2,_0x12f455){var _0x16b419=this;return new Promise(function(_0x7a1343,_0x33130b){var _0x3e16dc={'body':_0x54e615[_0x47ba('0x25')],'channel':_0x47ba('0x26')};var _0x286cba=[];var _0x11c337=[];var _0x4ce3aa={};return db['CmContact']['describe']()[_0x47ba('0xf')](function(_0x7bc918){if(!_0x7bc918){throw new db[(_0x47ba('0x27'))][(_0x47ba('0x28'))](_0x47ba('0x29'));}_0x286cba=_[_0x47ba('0x2a')](_[_0x47ba('0x2b')](_0x7bc918),['createdAt',_0x47ba('0x2c')]);_0x11c337=_[_0x47ba('0x2a')](_[_0x47ba('0x2b')](_0x7bc918),['createdAt','updatedAt',_0x47ba('0x2d'),_0x47ba('0x2e')]);if(_0x54e615[_0x47ba('0x25')]['id']){delete _0x54e615['body']['id'];}if(_[_0x47ba('0x2f')](_0x54e615['body']['from'])){throw new db[(_0x47ba('0x27'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x47ba('0x2f')](_0x54e615['body'][_0x47ba('0x25')])||_0x54e615[_0x47ba('0x25')][_0x47ba('0x25')]===''){throw new db[(_0x47ba('0x27'))][(_0x47ba('0x28'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47ba('0x2f')](_0x54e615[_0x47ba('0x25')]['mapKey'])){throw new db[(_0x47ba('0x27'))][(_0x47ba('0x28'))](_0x47ba('0x30')+_0x11c337);}if(!_[_0x47ba('0x31')](_0x11c337,_0x54e615[_0x47ba('0x25')][_0x47ba('0x32')])){throw new db[(_0x47ba('0x27'))][(_0x47ba('0x28'))](_0x47ba('0x33')+_0x11c337);}_0x4ce3aa[_0x54e615['body']['mapKey']]=_0x54e615[_0x47ba('0x25')]['from'];})['then'](function(){return db[_0x47ba('0x1a')][_0x47ba('0x34')]({'where':{'id':_0x54e615[_0x47ba('0x35')]['id']},'include':[{'model':db['CmList'],'as':_0x47ba('0x36'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4ce3aa,'limit':0x1,'order':[[_0x47ba('0x2c'),'DESC']]}]},{'model':db[_0x47ba('0x37')],'as':_0x47ba('0x38')}]});})['then'](function(_0x5434ad){if(_0x5434ad&&_0x5434ad[_0x47ba('0x36')]){var _0x37f8d5=_0x5434ad[_0x47ba('0x39')]({'plain':!![]});_0x3e16dc[_0x47ba('0x35')]=_0x37f8d5;_0x3e16dc[_0x47ba('0x3a')]=_0x37f8d5['Applications'];_0x3e16dc['list']=_0x37f8d5[_0x47ba('0x36')];_0x3e16dc['applications']=_[_0x47ba('0x3b')](_0x3e16dc['applications'],[_0x47ba('0x3c')],[_0x47ba('0x3d')]);if(_0x3e16dc[_0x47ba('0x35')][_0x47ba('0x38')]){delete _0x3e16dc[_0x47ba('0x35')][_0x47ba('0x38')];}if(_0x3e16dc[_0x47ba('0x35')]['List']&&_0x3e16dc['account'][_0x47ba('0x36')][_0x47ba('0x3e')][_0x47ba('0x3f')]){return _0x3e16dc[_0x47ba('0x35')][_0x47ba('0x36')][_0x47ba('0x3e')][0x0];}var _0x59558e=_[_0x47ba('0xa')](_0x54e615[_0x47ba('0x25')],{'firstName':_0x54e615['body'][_0x47ba('0x40')],'ListId':_0x37f8d5['ListId']});_0x59558e[_0x54e615[_0x47ba('0x25')][_0x47ba('0x32')]]=_0x54e615[_0x47ba('0x25')][_0x47ba('0x40')];return db[_0x47ba('0x41')]['create'](_0x59558e,{'fields':_0x286cba,'raw':!![]});}})['then'](function(_0x2c209e){_0x3e16dc[_0x47ba('0x42')]=_0x2c209e;if(_0x2c209e){var _0x322e82={'ContactId':_0x2c209e['id'],'FaxAccountId':_0x54e615['account']['id'],'fax':_0x2c209e[_0x47ba('0x26')]};return db[_0x47ba('0x43')][_0x47ba('0x34')]({'where':{'ContactId':_0x2c209e['id'],'closed':![],'FaxAccountId':_0x54e615[_0x47ba('0x35')]['id']}})[_0x47ba('0xf')](function(_0x401fcb){if(_0x401fcb){return[_0x401fcb,![]];}return db[_0x47ba('0x43')][_0x47ba('0x44')](_0x322e82)[_0x47ba('0xf')](function(_0xa1bda6){return[_0xa1bda6,!![]];});});}else{throw new Error(_0x47ba('0x45'));}})['spread'](function(_0x3e8809,_0x1cf5fa){var _0x4811ba=_0x3e8809[_0x47ba('0x39')]({'plain':!![]});if(_0x1cf5fa){if(_0x3e16dc[_0x47ba('0x35')]['autoclose']){_0x3e16dc[_0x47ba('0x3a')][_0x47ba('0x46')]({'id':0x0,'priority':_0x3e16dc[_0x47ba('0x3a')][_0x47ba('0x3f')]+0x1,'app':_0x47ba('0x47'),'appdata':_0x47ba('0x48'),'interval':'*,*,*,*'});}_0x4811ba[_0x47ba('0x49')]=!![];}else{_0x4811ba[_0x47ba('0x49')]=![];}_0x3e16dc['interaction']=_0x4811ba;return db[_0x47ba('0x4a')][_0x47ba('0x44')]({'body':_0x54e615[_0x47ba('0x25')]['body'],'FaxAccountId':_0x54e615[_0x47ba('0x35')]['id'],'FaxInteractionId':_0x3e8809['id'],'direction':'in','ContactId':_0x3e8809['ContactId'],'AttachmentId':_0x54e615['body'][_0x47ba('0x4b')]});})[_0x47ba('0xf')](function(_0xe57c2f){_0x3e16dc['message']=_0xe57c2f;if(_0x3e16dc[_0x47ba('0x4c')][_0x47ba('0x4d')]){return db['User'][_0x47ba('0x34')]({'attributes':['id',_0x47ba('0x4e')],'where':{'id':_0x3e16dc[_0x47ba('0x4c')][_0x47ba('0x4d')]}})[_0x47ba('0xf')](function(_0x158385){if(_0x158385){_0x3e16dc[_0x47ba('0x3a')][_0x47ba('0x4f')]({'id':0x0,'priority':0x0,'app':_0x47ba('0x50'),'appdata':_0x158385[_0x47ba('0x4e')]+','+(_0x3e16dc[_0x47ba('0x35')][_0x47ba('0x51')]||0xa),'interval':_0x47ba('0x52')});}return respondWithRpcPromise(_0x47ba('0x53'),_0x47ba('0x54'),_0x3e16dc);});}return respondWithRpcPromise(_0x47ba('0x53'),'startRouting',_0x3e16dc);})[_0x47ba('0xf')](function(_0x3f8db2){_0x7a1343(_0x3f8db2);})['catch'](function(_0x4198e7){_0x33130b(_0x16b419['error'](0x1f4,_0x4198e7['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 69e2d38..45fec1b 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 _0xd117=['save','remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x2ed550,_0x4a9a50){var _0x3d63cf=function(_0x386c6d){while(--_0x386c6d){_0x2ed550['push'](_0x2ed550['shift']());}};_0x3d63cf(++_0x4a9a50);}(_0xd117,0x182));var _0x7d11=function(_0x544072,_0xc41ee1){_0x544072=_0x544072-0x0;var _0x590bf6=_0xd117[_0x544072];return _0x590bf6;};'use strict';var FaxAccountEvents=require(_0x7d11('0x0'));var events=[_0x7d11('0x1'),_0x7d11('0x2'),_0x7d11('0x3')];function createListener(_0x454387,_0x26e0f0){return function(_0x306ae4){_0x26e0f0[_0x7d11('0x4')](_0x454387,_0x306ae4);};}function removeListener(_0x3c07be,_0x31fcb0){return function(){FaxAccountEvents[_0x7d11('0x5')](_0x3c07be,_0x31fcb0);};}exports[_0x7d11('0x6')]=function(_0x27d7e8){for(var _0x40c3c4=0x0,_0x345602=events[_0x7d11('0x7')];_0x40c3c4<_0x345602;_0x40c3c4++){var _0x47b5e6=events[_0x40c3c4];var _0x3803b5=createListener(_0x7d11('0x8')+_0x47b5e6,_0x27d7e8);FaxAccountEvents['on'](_0x47b5e6,_0x3803b5);}}; \ No newline at end of file +var _0xa456=['remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa456,0x142));var _0x6a45=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xa456[_0x29d915];return _0x160f86;};'use strict';var FaxAccountEvents=require(_0x6a45('0x0'));var events=[_0x6a45('0x1'),_0x6a45('0x2'),_0x6a45('0x3')];function createListener(_0x587626,_0x3bfbe6){return function(_0x206f6b){_0x3bfbe6[_0x6a45('0x4')](_0x587626,_0x206f6b);};}function removeListener(_0x500c72,_0x1f0701){return function(){FaxAccountEvents[_0x6a45('0x5')](_0x500c72,_0x1f0701);};}exports[_0x6a45('0x6')]=function(_0x14da6b){for(var _0x4dfbfa=0x0,_0x25cf8d=events[_0x6a45('0x7')];_0x4dfbfa<_0x25cf8d;_0x4dfbfa++){var _0x214514=events[_0x4dfbfa];var _0x19e67c=createListener(_0x6a45('0x8')+_0x214514,_0x14da6b);FaxAccountEvents['on'](_0x214514,_0x19e67c);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index e84ad4a..064d00f 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 _0xd4d8=['show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id'];(function(_0x33d967,_0x625b){var _0x1168ab=function(_0x1369f0){while(--_0x1369f0){_0x33d967['push'](_0x33d967['shift']());}};_0x1168ab(++_0x625b);}(_0xd4d8,0xbb));var _0x8d4d=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0xd4d8[_0x52f159];return _0x156799;};'use strict';var multer=require(_0x8d4d('0x0'));var util=require(_0x8d4d('0x1'));var path=require(_0x8d4d('0x2'));var timeout=require(_0x8d4d('0x3'));var express=require(_0x8d4d('0x4'));var router=express[_0x8d4d('0x5')]();var auth=require(_0x8d4d('0x6'));var interaction=require(_0x8d4d('0x7'));var config=require(_0x8d4d('0x8'));var controller=require('./faxAccount.controller');router[_0x8d4d('0x9')]('/',auth[_0x8d4d('0xa')](),controller['index']);router[_0x8d4d('0x9')](_0x8d4d('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x8d4d('0x9')](_0x8d4d('0xc'),auth[_0x8d4d('0xa')](),controller[_0x8d4d('0xd')]);router['get'](_0x8d4d('0xe'),auth[_0x8d4d('0xa')](),controller[_0x8d4d('0xf')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x8d4d('0x10')]);router['get']('/:id/interactions',auth[_0x8d4d('0xa')](),controller['getInteractions']);router[_0x8d4d('0x9')](_0x8d4d('0x11'),auth[_0x8d4d('0xa')](),controller[_0x8d4d('0x12')]);router[_0x8d4d('0x9')](_0x8d4d('0x13'),auth[_0x8d4d('0xa')](),controller['getMessages']);router['get'](_0x8d4d('0x14'),auth[_0x8d4d('0xa')](),controller[_0x8d4d('0x15')]);router[_0x8d4d('0x16')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x8d4d('0xe'),auth['isAuthenticated'](),controller[_0x8d4d('0x17')]);router[_0x8d4d('0x16')](_0x8d4d('0x18'),auth[_0x8d4d('0xa')](),controller[_0x8d4d('0x19')]);router[_0x8d4d('0x16')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x8d4d('0x1a')]);router['post']('/:id/applications',auth[_0x8d4d('0xa')](),controller[_0x8d4d('0x1b')]);router[_0x8d4d('0x16')]('/addaccountapplications',auth[_0x8d4d('0xa')](),controller[_0x8d4d('0x1c')]);router[_0x8d4d('0x16')](_0x8d4d('0x1d'),auth[_0x8d4d('0xa')](),controller[_0x8d4d('0x1e')]);router[_0x8d4d('0x16')](_0x8d4d('0x1f'),auth['isAuthenticated'](),controller['send']);router[_0x8d4d('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x8d4d('0x20')]);router['put']('/:id',auth[_0x8d4d('0xa')](),controller[_0x8d4d('0x21')]);router[_0x8d4d('0x22')]('/:id',auth['isAuthenticated'](),controller[_0x8d4d('0x23')]);router[_0x8d4d('0x22')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x8d4d('0x24')]);router[_0x8d4d('0x22')]('/:id/canned_answers',auth[_0x8d4d('0xa')](),controller[_0x8d4d('0x25')]);router[_0x8d4d('0x22')]('/:id/users',auth['isAuthenticated'](),controller[_0x8d4d('0x26')]);module[_0x8d4d('0x27')]=router; \ No newline at end of file +var _0x1a89=['/:id/users','removeAgents','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','destroy','delete','removeAnswers'];(function(_0x430535,_0x2753fb){var _0x568c4a=function(_0x1c935c){while(--_0x1c935c){_0x430535['push'](_0x430535['shift']());}};_0x568c4a(++_0x2753fb);}(_0x1a89,0x1bb));var _0x91a8=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x1a89[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0x91a8('0x0'));var util=require(_0x91a8('0x1'));var path=require(_0x91a8('0x2'));var timeout=require('connect-timeout');var express=require(_0x91a8('0x3'));var router=express['Router']();var auth=require(_0x91a8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x91a8('0x5'));var controller=require(_0x91a8('0x6'));router[_0x91a8('0x7')]('/',auth[_0x91a8('0x8')](),controller[_0x91a8('0x9')]);router[_0x91a8('0x7')](_0x91a8('0xa'),auth[_0x91a8('0x8')](),controller[_0x91a8('0xb')]);router[_0x91a8('0x7')](_0x91a8('0xc'),auth[_0x91a8('0x8')](),controller[_0x91a8('0xd')]);router[_0x91a8('0x7')]('/:id/dispositions',auth[_0x91a8('0x8')](),controller[_0x91a8('0xe')]);router['get'](_0x91a8('0xf'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x10')]);router[_0x91a8('0x7')](_0x91a8('0x11'),auth[_0x91a8('0x8')](),controller['getInteractions']);router['get'](_0x91a8('0x12'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x13')]);router[_0x91a8('0x7')](_0x91a8('0x14'),auth['isAuthenticated'](),controller[_0x91a8('0x15')]);router['get']('/:id/users',auth[_0x91a8('0x8')](),controller[_0x91a8('0x16')]);router[_0x91a8('0x17')]('/',auth[_0x91a8('0x8')](),controller[_0x91a8('0x18')]);router[_0x91a8('0x17')](_0x91a8('0x19'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x1a')]);router[_0x91a8('0x17')](_0x91a8('0xf'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x1b')]);router[_0x91a8('0x17')](_0x91a8('0x11'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x91a8('0x17')](_0x91a8('0x12'),auth['isAuthenticated'](),controller[_0x91a8('0x1c')]);router['post'](_0x91a8('0x1d'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x1e')]);router[_0x91a8('0x17')](_0x91a8('0x1f'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x20')]);router[_0x91a8('0x17')](_0x91a8('0x21'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x22')]);router[_0x91a8('0x17')]('/:id/users',auth[_0x91a8('0x8')](),controller[_0x91a8('0x23')]);router[_0x91a8('0x24')]('/:id',auth['isAuthenticated'](),controller[_0x91a8('0x25')]);router['delete'](_0x91a8('0xc'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x26')]);router[_0x91a8('0x27')](_0x91a8('0x19'),auth[_0x91a8('0x8')](),controller['removeDispositions']);router[_0x91a8('0x27')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x91a8('0x28')]);router[_0x91a8('0x27')](_0x91a8('0x29'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x2a')]);module[_0x91a8('0x2b')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 0bcc999..0f54e6b 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 _0x3dcc=['*,*,*,*','sequelize','TEXT','STRING'];(function(_0x54153d,_0x59d077){var _0x1ea5d2=function(_0x49d838){while(--_0x49d838){_0x54153d['push'](_0x54153d['shift']());}};_0x1ea5d2(++_0x59d077);}(_0x3dcc,0xf5));var _0xc3dc=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0x3dcc[_0x86b219];return _0x1f320c;};'use strict';var Sequelize=require(_0xc3dc('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xc3dc('0x1')]()},'description':{'type':Sequelize[_0xc3dc('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc3dc('0x3')}}; \ No newline at end of file +var _0xcaf2=['STRING','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x4654d5,_0x55fdf3){var _0x2da3f9=function(_0x8cd30a){while(--_0x8cd30a){_0x4654d5['push'](_0x4654d5['shift']());}};_0x2da3f9(++_0x55fdf3);}(_0xcaf2,0x8a));var _0x2caf=function(_0x2226c1,_0x2bed75){_0x2226c1=_0x2226c1-0x0;var _0x178716=_0xcaf2[_0x2226c1];return _0x178716;};'use strict';var Sequelize=require(_0x2caf('0x0'));module['exports']={'priority':{'type':Sequelize[_0x2caf('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2caf('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2caf('0x3')]()},'description':{'type':Sequelize[_0x2caf('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2caf('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index f4f6301..f3bfa4c 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 _0x814b=['destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','FaxApplication','options','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update'];(function(_0x2e2bd1,_0x3717c2){var _0x51da1e=function(_0x1be9d4){while(--_0x1be9d4){_0x2e2bd1['push'](_0x2e2bd1['shift']());}};_0x51da1e(++_0x3717c2);}(_0x814b,0x1a2));var _0xb814=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0x814b[_0x1ae491];return _0x4958a5;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['FaxApplication'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['FaxApplication'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['FaxApplication'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));}; \ No newline at end of file +var _0x8ef6=['sort','filters','filter','where','merge','options','count','then','includeAll','include','rows','catch','show','params','keys','length','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','save','update','end','error','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','hasOwnProperty','limit','order'];(function(_0x4ec596,_0x1d03ce){var _0x26e5db=function(_0x176d6b){while(--_0x176d6b){_0x4ec596['push'](_0x4ec596['shift']());}};_0x26e5db(++_0x1d03ce);}(_0x8ef6,0xf2));var _0x68ef=function(_0x457022,_0xf9a1fa){_0x457022=_0x457022-0x0;var _0x3e1186=_0x8ef6[_0x457022];return _0x3e1186;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x46356f,_0x1e117a){_0x1e117a=_0x1e117a||0xcc;return function(_0x454ef4){if(_0x454ef4){return _0x46356f[_0x68ef('0x1b')](_0x1e117a);}return _0x46356f[_0x68ef('0x1c')](_0x1e117a)['end']();};}function respondWithResult(_0x3b48dd,_0xc50cce){_0xc50cce=_0xc50cce||0xc8;return function(_0x2657c5){if(_0x2657c5){return _0x3b48dd['status'](_0xc50cce)[_0x68ef('0x1d')](_0x2657c5);}};}function respondWithFilteredResult(_0x1764de,_0x24682d){return function(_0x5005ba){if(_0x5005ba){var _0x35493d=_0x5005ba['count'],_0x37c4cc=_0x24682d[_0x68ef('0x1e')],_0x3d1e90=_0x24682d['offset']+_0x24682d['limit'],_0x3780a4;if(_0x3d1e90>=_0x35493d){_0x3d1e90=_0x35493d;_0x3780a4=0xc8;}else{_0x3780a4=0xce;}_0x1764de[_0x68ef('0x1c')](_0x3780a4);return _0x1764de[_0x68ef('0x1f')]('Content-Range',_0x37c4cc+'-'+_0x3d1e90+'/'+_0x35493d)['json'](_0x5005ba);}return null;};}function patchUpdates(_0x3c4c1f){return function(_0x2cd92c){try{jsonpatch[_0x68ef('0x20')](_0x2cd92c,_0x3c4c1f,!![]);}catch(_0x4fad1c){return BPromise[_0x68ef('0x21')](_0x4fad1c);}return _0x2cd92c[_0x68ef('0x22')]();};}function saveUpdates(_0x183f5f,_0x5b246b){return function(_0x3c46d4){if(_0x3c46d4){return _0x3c46d4[_0x68ef('0x23')](_0x183f5f)['then'](function(_0x399da4){return _0x399da4;});}return null;};}function removeEntity(_0xf4760f,_0x19aa3d){return function(_0x5ddec7){if(_0x5ddec7){return _0x5ddec7['destroy']()['then'](function(){_0xf4760f[_0x68ef('0x1c')](0xcc)[_0x68ef('0x24')]();});}};}function handleEntityNotFound(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(!_0x438b4c){_0x312cc9[_0x68ef('0x1b')](0x194);}return _0x438b4c;};}function handleError(_0x258cd5,_0x49374f){_0x49374f=_0x49374f||0x1f4;return function(_0x65fd09){logger[_0x68ef('0x25')](_0x65fd09['stack']);if(_0x65fd09[_0x68ef('0x26')]){delete _0x65fd09['name'];}_0x258cd5['status'](_0x49374f)['send'](_0x65fd09);};}exports[_0x68ef('0x27')]=function(_0x268f32,_0x123041){var _0x29518e={},_0x52e67e={},_0x4a0550={'count':0x0,'rows':[]};var _0x1cbe4f=_[_0x68ef('0x28')](db[_0x68ef('0x29')][_0x68ef('0x2a')],function(_0x22ef25){return{'name':_0x22ef25[_0x68ef('0x2b')],'type':_0x22ef25[_0x68ef('0x2c')][_0x68ef('0x2d')]};});_0x52e67e['model']=_[_0x68ef('0x28')](_0x1cbe4f,_0x68ef('0x26'));_0x52e67e[_0x68ef('0x2e')]=_['keys'](_0x268f32[_0x68ef('0x2e')]);_0x52e67e['filters']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],_0x52e67e['query']);_0x29518e['attributes']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],qs['fields'](_0x268f32[_0x68ef('0x2e')][_0x68ef('0x31')]));_0x29518e[_0x68ef('0x32')]=_0x29518e[_0x68ef('0x32')]['length']?_0x29518e[_0x68ef('0x32')]:_0x52e67e[_0x68ef('0x30')];if(!_0x268f32['query'][_0x68ef('0x33')]('nolimit')){_0x29518e[_0x68ef('0x34')]=qs[_0x68ef('0x34')](_0x268f32['query'][_0x68ef('0x34')]);_0x29518e['offset']=qs[_0x68ef('0x1e')](_0x268f32['query'][_0x68ef('0x1e')]);}_0x29518e[_0x68ef('0x35')]=qs[_0x68ef('0x36')](_0x268f32['query'][_0x68ef('0x36')]);_0x29518e['where']=qs[_0x68ef('0x37')](_['pick'](_0x268f32[_0x68ef('0x2e')],_0x52e67e[_0x68ef('0x37')]),_0x1cbe4f);if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x38')]){_0x29518e[_0x68ef('0x39')]=_[_0x68ef('0x3a')](_0x29518e['where'],{'$or':_[_0x68ef('0x28')](_0x1cbe4f,function(_0x15a6ab){if(_0x15a6ab[_0x68ef('0x2c')]!=='VIRTUAL'){var _0x32eddd={};_0x32eddd[_0x15a6ab[_0x68ef('0x26')]]={'$like':'%'+_0x268f32[_0x68ef('0x2e')]['filter']+'%'};return _0x32eddd;}})});}_0x29518e=_['merge']({},_0x29518e,_0x268f32[_0x68ef('0x3b')]);var _0xec7de3={'where':_0x29518e[_0x68ef('0x39')]};return db[_0x68ef('0x29')][_0x68ef('0x3c')](_0xec7de3)[_0x68ef('0x3d')](function(_0x41ffe0){_0x4a0550['count']=_0x41ffe0;if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x3e')]){_0x29518e[_0x68ef('0x3f')]=[{'all':!![]}];}return db[_0x68ef('0x29')]['findAll'](_0x29518e);})[_0x68ef('0x3d')](function(_0x3a2f53){_0x4a0550[_0x68ef('0x40')]=_0x3a2f53;return _0x4a0550;})[_0x68ef('0x3d')](respondWithFilteredResult(_0x123041,_0x29518e))[_0x68ef('0x41')](handleError(_0x123041,null));};exports[_0x68ef('0x42')]=function(_0x558efb,_0x3f000f){var _0x3f7699={'raw':!![],'where':{'id':_0x558efb[_0x68ef('0x43')]['id']}},_0xf5010c={};_0xf5010c[_0x68ef('0x30')]=_[_0x68ef('0x44')](db[_0x68ef('0x29')][_0x68ef('0x2a')]);_0xf5010c[_0x68ef('0x2e')]=_['keys'](_0x558efb[_0x68ef('0x2e')]);_0xf5010c[_0x68ef('0x37')]=_[_0x68ef('0x2f')](_0xf5010c[_0x68ef('0x30')],_0xf5010c[_0x68ef('0x2e')]);_0x3f7699[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0xf5010c['model'],qs[_0x68ef('0x31')](_0x558efb['query'][_0x68ef('0x31')]));_0x3f7699[_0x68ef('0x32')]=_0x3f7699[_0x68ef('0x32')][_0x68ef('0x45')]?_0x3f7699['attributes']:_0xf5010c[_0x68ef('0x30')];if(_0x558efb['query'][_0x68ef('0x3e')]){_0x3f7699['include']=[{'all':!![]}];}_0x3f7699=_[_0x68ef('0x3a')]({},_0x3f7699,_0x558efb[_0x68ef('0x3b')]);return db[_0x68ef('0x29')]['find'](_0x3f7699)['then'](handleEntityNotFound(_0x3f000f,null))[_0x68ef('0x3d')](respondWithResult(_0x3f000f,null))[_0x68ef('0x41')](handleError(_0x3f000f,null));};exports['create']=function(_0x589688,_0x4b4d6b){return db[_0x68ef('0x29')][_0x68ef('0x46')](_0x589688[_0x68ef('0x47')],{})[_0x68ef('0x3d')](respondWithResult(_0x4b4d6b,0xc9))[_0x68ef('0x41')](handleError(_0x4b4d6b,null));};exports['update']=function(_0x55f385,_0xc39f5b){if(_0x55f385[_0x68ef('0x47')]['id']){delete _0x55f385[_0x68ef('0x47')]['id'];}return db[_0x68ef('0x29')]['find']({'where':{'id':_0x55f385[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0xc39f5b,null))[_0x68ef('0x3d')](saveUpdates(_0x55f385[_0x68ef('0x47')],null))['then'](respondWithResult(_0xc39f5b,null))['catch'](handleError(_0xc39f5b,null));};exports[_0x68ef('0x48')]=function(_0x3c3074,_0x566e7c){return db[_0x68ef('0x29')][_0x68ef('0x49')]({'where':{'id':_0x3c3074[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x3d')](removeEntity(_0x566e7c,null))['catch'](handleError(_0x566e7c,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 5d203c6..4c07dd9 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 _0x571d=['utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0x337d6f,_0x5d47aa){var _0x1b2f88=function(_0x34a084){while(--_0x34a084){_0x337d6f['push'](_0x337d6f['shift']());}};_0x1b2f88(++_0x5d47aa);}(_0x571d,0x1eb));var _0xd571=function(_0x3987d0,_0x39166d){_0x3987d0=_0x3987d0-0x0;var _0x284b44=_0x571d[_0x3987d0];return _0x284b44;};'use strict';var _=require(_0xd571('0x0'));var util=require(_0xd571('0x1'));var logger=require(_0xd571('0x2'))('api');var moment=require(_0xd571('0x3'));var BPromise=require(_0xd571('0x4'));var rp=require(_0xd571('0x5'));var fs=require('fs');var path=require(_0xd571('0x6'));var rimraf=require(_0xd571('0x7'));var config=require(_0xd571('0x8'));var attributes=require(_0xd571('0x9'));module[_0xd571('0xa')]=function(_0x4c98cc,_0x3b9a31){return _0x4c98cc[_0xd571('0xb')](_0xd571('0xc'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd571('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x34af=['FaxApplication','fax_applications','utf8mb4_unicode_ci','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0xc29e65,_0x7f1e9e){var _0x36240d=function(_0x29a1ce){while(--_0x29a1ce){_0xc29e65['push'](_0xc29e65['shift']());}};_0x36240d(++_0x7f1e9e);}(_0x34af,0xfd));var _0xf34a=function(_0x14a87e,_0x20d331){_0x14a87e=_0x14a87e-0x0;var _0x5509c2=_0x34af[_0x14a87e];return _0x5509c2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf34a('0x0'));var moment=require(_0xf34a('0x1'));var BPromise=require(_0xf34a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf34a('0x3'));var rimraf=require('rimraf');var config=require(_0xf34a('0x4'));var attributes=require('./faxApplication.attributes');module[_0xf34a('0x5')]=function(_0x2bdf6b,_0x4610fb){return _0x2bdf6b[_0xf34a('0x6')](_0xf34a('0x7'),attributes,{'tableName':_0xf34a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf34a('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 77a2f9e..c413871 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 _0x1855=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x34e85e,_0x5b8ca2){var _0x3e5347=function(_0x34a58d){while(--_0x34a58d){_0x34e85e['push'](_0x34e85e['shift']());}};_0x3e5347(++_0x5b8ca2);}(_0x1855,0x19a));var _0x5185=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x1855[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x5185('0x0'));var util=require(_0x5185('0x1'));var moment=require(_0x5185('0x2'));var BPromise=require(_0x5185('0x3'));var rs=require(_0x5185('0x4'));var fs=require('fs');var Redis=require(_0x5185('0x5'));var db=require(_0x5185('0x6'))['db'];var utils=require(_0x5185('0x7'));var logger=require('../../config/logger')(_0x5185('0x8'));var config=require('../../config/environment');var jayson=require(_0x5185('0x9'));var client=jayson[_0x5185('0xa')][_0x5185('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x243e9e,_0x13e2f0,_0x3a8b46){return new BPromise(function(_0x408d63,_0x16e0eb){return client[_0x5185('0xc')](_0x243e9e,_0x3a8b46)[_0x5185('0xd')](function(_0x11feb2){logger[_0x5185('0xe')](_0x5185('0xf'),_0x13e2f0,_0x5185('0x10'));logger['debug'](_0x5185('0x11'),_0x13e2f0,_0x5185('0x10'),JSON['stringify'](_0x11feb2));if(_0x11feb2[_0x5185('0x12')]){if(_0x11feb2[_0x5185('0x12')]['code']===0x1f4){logger[_0x5185('0x12')]('FaxApplication,\x20%s,\x20%s',_0x13e2f0,_0x11feb2[_0x5185('0x12')][_0x5185('0x13')]);return _0x16e0eb(_0x11feb2[_0x5185('0x12')]['message']);}logger[_0x5185('0x12')]('FaxApplication,\x20%s,\x20%s',_0x13e2f0,_0x11feb2[_0x5185('0x12')][_0x5185('0x13')]);return _0x408d63(_0x11feb2[_0x5185('0x12')][_0x5185('0x13')]);}else{logger[_0x5185('0xe')]('FaxApplication,\x20%s,\x20%s',_0x13e2f0,_0x5185('0x10'));_0x408d63(_0x11feb2[_0x5185('0x14')][_0x5185('0x13')]);}})[_0x5185('0x15')](function(_0x1c034c){logger[_0x5185('0x12')]('FaxApplication,\x20%s,\x20%s',_0x13e2f0,_0x1c034c);_0x16e0eb(_0x1c034c);});});}exports[_0x5185('0x16')]=function(_0xc4ae31){var _0x818255=this;return new Promise(function(_0x187f8a,_0x265f3c){return db[_0x5185('0x17')][_0x5185('0x18')](_0xc4ae31[_0x5185('0x19')],{'raw':_0xc4ae31[_0x5185('0x1a')]?_0xc4ae31[_0x5185('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc4ae31[_0x5185('0x1a')]?_0xc4ae31[_0x5185('0x1a')][_0x5185('0x1b')]||null:null,'attributes':_0xc4ae31[_0x5185('0x1a')]?_0xc4ae31['options'][_0x5185('0x1c')]||null:null,'limit':_0xc4ae31[_0x5185('0x1a')]?_0xc4ae31[_0x5185('0x1a')][_0x5185('0x1d')]||null:null})['then'](function(_0x56b726){logger[_0x5185('0xe')](_0x5185('0x16'),_0xc4ae31);logger[_0x5185('0x1e')](_0x5185('0x16'),_0xc4ae31,JSON[_0x5185('0x1f')](_0x56b726));_0x187f8a(_0x56b726);})[_0x5185('0x15')](function(_0x59f339){logger[_0x5185('0x12')]('UpdateFaxApplication',_0x59f339[_0x5185('0x13')],_0xc4ae31);_0x265f3c(_0x818255[_0x5185('0x12')](0x1f4,_0x59f339[_0x5185('0x13')]));});});}; \ No newline at end of file +var _0x5c49=['stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','UpdateFaxApplication','update','body','options','where','attributes','limit','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s'];(function(_0x26c4ec,_0x292d7c){var _0x455b9c=function(_0x27400f){while(--_0x27400f){_0x26c4ec['push'](_0x26c4ec['shift']());}};_0x455b9c(++_0x292d7c);}(_0x5c49,0x176));var _0x95c4=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0x5c49[_0xd2d54];return _0x78b113;};'use strict';var _=require(_0x95c4('0x0'));var util=require(_0x95c4('0x1'));var moment=require('moment');var BPromise=require(_0x95c4('0x2'));var rs=require(_0x95c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95c4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x95c4('0x5'))('rpc');var config=require(_0x95c4('0x6'));var jayson=require(_0x95c4('0x7'));var client=jayson[_0x95c4('0x8')][_0x95c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5983fc,_0xd7f1a4,_0x33351d){return new BPromise(function(_0x3c1a39,_0x55838a){return client[_0x95c4('0xa')](_0x5983fc,_0x33351d)[_0x95c4('0xb')](function(_0x2bfe64){logger[_0x95c4('0xc')]('FaxApplication,\x20%s,\x20%s',_0xd7f1a4,_0x95c4('0xd'));logger[_0x95c4('0xe')](_0x95c4('0xf'),_0xd7f1a4,_0x95c4('0xd'),JSON[_0x95c4('0x10')](_0x2bfe64));if(_0x2bfe64[_0x95c4('0x11')]){if(_0x2bfe64['error'][_0x95c4('0x12')]===0x1f4){logger[_0x95c4('0x11')](_0x95c4('0x13'),_0xd7f1a4,_0x2bfe64[_0x95c4('0x11')][_0x95c4('0x14')]);return _0x55838a(_0x2bfe64[_0x95c4('0x11')][_0x95c4('0x14')]);}logger[_0x95c4('0x11')](_0x95c4('0x13'),_0xd7f1a4,_0x2bfe64[_0x95c4('0x11')]['message']);return _0x3c1a39(_0x2bfe64['error']['message']);}else{logger[_0x95c4('0xc')]('FaxApplication,\x20%s,\x20%s',_0xd7f1a4,_0x95c4('0xd'));_0x3c1a39(_0x2bfe64[_0x95c4('0x15')][_0x95c4('0x14')]);}})['catch'](function(_0x3d8ff0){logger[_0x95c4('0x11')](_0x95c4('0x13'),_0xd7f1a4,_0x3d8ff0);_0x55838a(_0x3d8ff0);});});}exports[_0x95c4('0x16')]=function(_0x169bd7){var _0x25a468=this;return new Promise(function(_0x55bc90,_0x150f2b){return db['FaxApplication'][_0x95c4('0x17')](_0x169bd7[_0x95c4('0x18')],{'raw':_0x169bd7['options']?_0x169bd7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x169bd7[_0x95c4('0x19')]?_0x169bd7[_0x95c4('0x19')][_0x95c4('0x1a')]||null:null,'attributes':_0x169bd7[_0x95c4('0x19')]?_0x169bd7[_0x95c4('0x19')][_0x95c4('0x1b')]||null:null,'limit':_0x169bd7[_0x95c4('0x19')]?_0x169bd7[_0x95c4('0x19')][_0x95c4('0x1c')]||null:null})[_0x95c4('0xb')](function(_0x422149){logger['info'](_0x95c4('0x16'),_0x169bd7);logger[_0x95c4('0xe')](_0x95c4('0x16'),_0x169bd7,JSON['stringify'](_0x422149));_0x55bc90(_0x422149);})[_0x95c4('0x1d')](function(_0x46713a){logger['error'](_0x95c4('0x16'),_0x46713a[_0x95c4('0x14')],_0x169bd7);_0x150f2b(_0x25a468[_0x95c4('0x11')](0x1f4,_0x46713a['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index ffc4839..86acb34 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 _0x207c=['./faxApplication.controller','get','/:id','isAuthenticated','post','create','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4dbe44,_0x3b786e){var _0x4eaa3b=function(_0x5e234a){while(--_0x5e234a){_0x4dbe44['push'](_0x4dbe44['shift']());}};_0x4eaa3b(++_0x3b786e);}(_0x207c,0x1e8));var _0xc207=function(_0x1b33ec,_0x4c5bb3){_0x1b33ec=_0x1b33ec-0x0;var _0x36c0a4=_0x207c[_0x1b33ec];return _0x36c0a4;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var auth=require(_0xc207('0x5'));var interaction=require(_0xc207('0x6'));var config=require('../../config/environment');var controller=require(_0xc207('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc207('0x8')](_0xc207('0x9'),auth[_0xc207('0xa')](),controller['show']);router[_0xc207('0xb')]('/',auth[_0xc207('0xa')](),controller[_0xc207('0xc')]);router['put'](_0xc207('0x9'),auth[_0xc207('0xa')](),controller[_0xc207('0xd')]);router[_0xc207('0xe')](_0xc207('0x9'),auth[_0xc207('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3f8a=['index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated'];(function(_0x1ae6b3,_0x3290bb){var _0x311586=function(_0x5f3978){while(--_0x5f3978){_0x1ae6b3['push'](_0x1ae6b3['shift']());}};_0x311586(++_0x3290bb);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x4ff30d,_0x822aa){_0x4ff30d=_0x4ff30d-0x0;var _0x15b604=_0x3f8a[_0x4ff30d];return _0x15b604;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xb')]);router[_0xa3f8('0x9')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xc'),auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['destroy']);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index a7650ee..966069c 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 _0xbb1d=['STRING','ENUM','sequelize','exports','BOOLEAN','DATE'];(function(_0x4128bb,_0x4f9c32){var _0x293df0=function(_0x22b29b){while(--_0x22b29b){_0x4128bb['push'](_0x4128bb['shift']());}};_0x293df0(++_0x4f9c32);}(_0xbb1d,0x18e));var _0xdbb1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbb1d[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xdbb1('0x0'));module[_0xdbb1('0x1')]={'closed':{'type':Sequelize[_0xdbb1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdbb1('0x3')]},'disposition':{'type':Sequelize[_0xdbb1('0x4')]},'note':{'type':Sequelize[_0xdbb1('0x4')]},'read1stAt':{'type':Sequelize[_0xdbb1('0x3')]},'fax':{'type':Sequelize[_0xdbb1('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xdbb1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdbb1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xdbb1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xffdf=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffdf,0xc0));var _0xfffd=function(_0xe563d5,_0x417bf7){_0xe563d5=_0xe563d5-0x0;var _0x1572c8=_0xffdf[_0xe563d5];return _0x1572c8;};'use strict';var Sequelize=require(_0xfffd('0x0'));module[_0xfffd('0x1')]={'closed':{'type':Sequelize[_0xfffd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfffd('0x3')]},'disposition':{'type':Sequelize[_0xfffd('0x4')]},'note':{'type':Sequelize[_0xfffd('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xfffd('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xfffd('0x5')]('in',_0xfffd('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfffd('0x5')]('in',_0xfffd('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 70e1d85..d451718 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 _0xcecc=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','TagIds','Tags','forEach','push','catch','index','FaxInteraction','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','limit','order','sort','where','field','from','tools_tags','select','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','union','User','$substring','UserId','compact','FaxAccountId','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','toString','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','include','merge','options','body','params','describe','addMessage','FaxMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','findAll','faxInteractionTags:save','removeTags','unix','join','root','server','files','format','transcript-%d-%s.zip','Messages','get','mkdirSync','Attachment','basename','existsSync','createReadStream','pipe','download','log','unlinkSync','html-pdf','rimraf','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','jsforce','desk.js'];(function(_0x4f51f9,_0x5d5613){var _0x533984=function(_0x578319){while(--_0x578319){_0x4f51f9['push'](_0x4f51f9['shift']());}};_0x533984(++_0x5d5613);}(_0xcecc,0x186));var _0xccec=function(_0x30c9da,_0x545460){_0x30c9da=_0x30c9da-0x0;var _0x33708f=_0xcecc[_0x30c9da];return _0x33708f;};'use strict';var pdf=require(_0xccec('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xccec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xccec('0x2'));var moment=require(_0xccec('0x3'));var BPromise=require(_0xccec('0x4'));var Mustache=require(_0xccec('0x5'));var util=require('util');var path=require('path');var sox=require(_0xccec('0x6'));var csv=require('to-csv');var ejs=require(_0xccec('0x7'));var fs=require('fs');var _=require(_0xccec('0x8'));var squel=require(_0xccec('0x9'));var crypto=require('crypto');var jsforce=require(_0xccec('0xa'));var deskjs=require(_0xccec('0xb'));var toCsv=require('to-csv');var querystring=require(_0xccec('0xc'));var Papa=require(_0xccec('0xd'));var Redis=require(_0xccec('0xe'));var authService=require(_0xccec('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xccec('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccec('0x11'))(_0xccec('0x12'));var utils=require('../../config/utils');var config=require(_0xccec('0x13'));var db=require(_0xccec('0x14'))['db'];config[_0xccec('0x15')]=_['defaults'](config[_0xccec('0x15')],{'host':_0xccec('0x16'),'port':0x18eb});var socket=require(_0xccec('0x17'))(new Redis(config[_0xccec('0x15')]));require(_0xccec('0x18'))['register'](socket);function respondWithStatusCode(_0x2882d9,_0x566a81){_0x566a81=_0x566a81||0xcc;return function(_0x4d0145){if(_0x4d0145){return _0x2882d9['sendStatus'](_0x566a81);}return _0x2882d9[_0xccec('0x19')](_0x566a81)[_0xccec('0x1a')]();};}function respondWithResult(_0x18e7d0,_0x69a776){_0x69a776=_0x69a776||0xc8;return function(_0x1d588f){if(_0x1d588f){return _0x18e7d0[_0xccec('0x19')](_0x69a776)[_0xccec('0x1b')](_0x1d588f);}};}function respondWithFilteredResult(_0x1b7235,_0x199e52){return function(_0x5f0be1){if(_0x5f0be1){var _0x518016=_0x5f0be1[_0xccec('0x1c')],_0x56b926=_0x199e52[_0xccec('0x1d')],_0x970c66=_0x199e52[_0xccec('0x1d')]+_0x199e52['limit'],_0x551d33;if(_0x970c66>=_0x518016){_0x970c66=_0x518016;_0x551d33=0xc8;}else{_0x551d33=0xce;}_0x1b7235[_0xccec('0x19')](_0x551d33);return _0x1b7235[_0xccec('0x1e')](_0xccec('0x1f'),_0x56b926+'-'+_0x970c66+'/'+_0x518016)['json'](_0x5f0be1);}return null;};}function patchUpdates(_0x2fedff){return function(_0x3bd5fa){try{jsonpatch[_0xccec('0x20')](_0x3bd5fa,_0x2fedff,!![]);}catch(_0x57926a){return BPromise[_0xccec('0x21')](_0x57926a);}return _0x3bd5fa['save']();};}function saveUpdates(_0x9065a3,_0x4b2666){return function(_0x23ddf8){if(_0x23ddf8){return _0x23ddf8[_0xccec('0x22')](_0x9065a3)[_0xccec('0x23')](function(_0x50794d){return _0x50794d;});}return null;};}function removeEntity(_0x3d83e1,_0x6be7ac){return function(_0x2412f3){if(_0x2412f3){return _0x2412f3[_0xccec('0x24')]()[_0xccec('0x23')](function(){_0x3d83e1['status'](0xcc)[_0xccec('0x1a')]();});}};}function handleEntityNotFound(_0xb0b0da,_0x2d8fa0){return function(_0x15d495){if(!_0x15d495){_0xb0b0da['sendStatus'](0x194);}return _0x15d495;};}function handleError(_0x27b541,_0x52ddd7){_0x52ddd7=_0x52ddd7||0x1f4;return function(_0x4e00c6){logger['error'](_0x4e00c6[_0xccec('0x25')]);if(_0x4e00c6[_0xccec('0x26')]){delete _0x4e00c6[_0xccec('0x26')];}_0x27b541[_0xccec('0x19')](_0x52ddd7)[_0xccec('0x27')](_0x4e00c6);};}function getInteractionUsers(_0x3e8557,_0x3ca9c7){return new BPromise(function(_0x59bb66,_0x11085d){try{if(_0x3ca9c7[_0x3e8557['id']]){_0x3e8557['Users']=_[_0xccec('0x28')](_0x3ca9c7[_0x3e8557['id']],function(_0xc6db88){return{'id':_0xc6db88['id'],'fullname':_0xc6db88['fullname']};});}}catch(_0x55a53a){_0x11085d(_0x55a53a);}_0x59bb66(_0x3e8557);});}function getInteractionTags(_0x1e93e3,_0x190786){return new BPromise(function(_0x53be76,_0x3e9ef5){try{if(_0x1e93e3[_0xccec('0x29')]){_0x1e93e3[_0xccec('0x2a')]=[];_0x1e93e3[_0xccec('0x29')]['split'](',')[_0xccec('0x2b')](function(_0x1bcdd1){_0x1e93e3[_0xccec('0x2a')][_0xccec('0x2c')](_0x190786[_0x1bcdd1]);});}delete _0x1e93e3[_0xccec('0x29')];}catch(_0x235219){_0x3e9ef5(_0x235219);}_0x53be76(_0x1e93e3);});}function updateFaxInteraction(_0x180367,_0x173ebc,_0x576df7){return new BPromise(function(_0x2d2be9,_0x293ed1){return getInteractionUsers(_0x180367,_0x576df7)[_0xccec('0x23')](function(_0x4a63e7){return getInteractionTags(_0x4a63e7,_0x173ebc);})['then'](function(_0xf2311c){_0x2d2be9(_0xf2311c);})[_0xccec('0x2d')](function(_0x7b2585){_0x293ed1(_0x7b2585);});});}exports[_0xccec('0x2e')]=function(_0x5373df,_0xb0a4a7){var _0x5952ba={},_0x4ece41={},_0x324ca1={'count':0x0,'rows':[]};var _0x87d6d3=_[_0xccec('0x28')](db[_0xccec('0x2f')][_0xccec('0x30')],function(_0x263209){return{'name':_0x263209['fieldName'],'type':_0x263209['type'][_0xccec('0x31')]};});_0x4ece41[_0xccec('0x32')]=_[_0xccec('0x28')](_0x87d6d3,_0xccec('0x26'));_0x4ece41['query']=_[_0xccec('0x33')](_0x5373df['query']);_0x4ece41[_0xccec('0x34')]=_[_0xccec('0x35')](_0x4ece41[_0xccec('0x32')],_0x4ece41[_0xccec('0x36')]);_0x5952ba[_0xccec('0x37')]=_['intersection'](_0x4ece41[_0xccec('0x32')],qs[_0xccec('0x38')](_0x5373df['query'][_0xccec('0x38')]));_0x5952ba[_0xccec('0x37')]=_0x5952ba[_0xccec('0x37')][_0xccec('0x39')]?_0x5952ba['attributes']:_0x4ece41[_0xccec('0x32')];if(!_0x5373df[_0xccec('0x36')][_0xccec('0x3a')]('nolimit')){_0x5952ba[_0xccec('0x3b')]=qs['limit'](_0x5373df[_0xccec('0x36')][_0xccec('0x3b')]);_0x5952ba[_0xccec('0x1d')]=qs['offset'](_0x5373df['query'][_0xccec('0x1d')]);}_0x5952ba[_0xccec('0x3c')]=qs[_0xccec('0x3d')](_0x5373df['query'][_0xccec('0x3d')]);_0x5952ba[_0xccec('0x3e')]=qs[_0xccec('0x34')](_['pick'](_0x5373df[_0xccec('0x36')],_0x4ece41[_0xccec('0x34')]),_0x87d6d3);var _0x262e25=[];var _0x1dfd34=squel['select']()['field']('id')[_0xccec('0x3f')](_0xccec('0x26'))[_0xccec('0x3f')]('color')[_0xccec('0x40')](_0xccec('0x41'));var _0x42ed1c=squel[_0xccec('0x42')]()[_0xccec('0x3f')](_0xccec('0x43'))['field'](_0xccec('0x44'))[_0xccec('0x3f')](_0xccec('0x45'))[_0xccec('0x40')](_0xccec('0x46'),'ui')[_0xccec('0x47')](_0xccec('0x48'),'u',_0xccec('0x49'));var _0x57c8ab=squel[_0xccec('0x42')]()[_0xccec('0x40')](_0xccec('0x4a'),'i')[_0xccec('0x47')]('cm_contacts','c',_0xccec('0x4b'))[_0xccec('0x47')](_0xccec('0x48'),'o','o.id\x20=\x20i.UserId')[_0xccec('0x47')]('fax_accounts','a',_0xccec('0x4c'))[_0xccec('0x47')](_0xccec('0x4d'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xccec('0x47')](_0xccec('0x4e'),'it',_0xccec('0x4f'))['left_join'](_0xccec('0x41'),'t',_0xccec('0x50'));var _0x25c627=squel[_0xccec('0x51')]();var _0x415238=[];var _0x5d299c=squel['expr']();var _0x486034;if(_0x5373df[_0xccec('0x36')][_0xccec('0x52')]){_0x486034=as[_0xccec('0x53')](_0x5373df[_0xccec('0x36')][_0xccec('0x52')]);var _0x1b16ed=_0x486034['sqlOperator'];for(var _0x1ddc01=0x0;_0x1ddc01<_0x486034['conditions'][_0xccec('0x39')];_0x1ddc01++){var _0xff9e72=_0x486034['conditions'][_0x1ddc01];var _0x303aa6='i';var _0x362844=_[_0xccec('0x54')](_0x87d6d3,[_0xccec('0x26'),_0xff9e72[_0xccec('0x3f')]]);if(!_0x362844){switch(_0xff9e72[_0xccec('0x3f')]){case _0xccec('0x55'):if(_0xff9e72[_0xccec('0x56')]==0x1){_0x57c8ab['having']('`'+_0xff9e72['field']+'`\x20=\x200');}else{_0x57c8ab[_0xccec('0x57')]('`'+_0xff9e72[_0xccec('0x3f')]+_0xccec('0x58'));}break;case _0xccec('0x59'):if(_0xff9e72[_0xccec('0x5a')]==='$substring'){if(_0xff9e72[_0xccec('0x56')][_0xccec('0x5b')]('\x20')['length']>0x1){_0x25c627[_0x1b16ed](_0xccec('0x5c'),qs[_0xccec('0x5d')](_0xff9e72[_0xccec('0x56')]),null);}else{var _0x50474d='%'+_0xff9e72['value']+'%';_0x25c627[_0x1b16ed](_0xccec('0x5e'),_0x50474d,_0x50474d,_0x50474d);}}else{_0x362844=_['find'](_0x87d6d3,[_0xccec('0x26'),_0xccec('0x5f')]);_0xff9e72['field']=_0xccec('0x5f');_0x21cf28=as[_0xccec('0x60')](_0x303aa6,_0x362844[_0xccec('0x61')],_0xff9e72);_0x25c627[_0x1b16ed](_0x21cf28[_0xccec('0x62')],_0x21cf28[_0xccec('0x56')][_0xccec('0x63')],_0x21cf28[_0xccec('0x56')][_0xccec('0x1a')]);}break;case _0xccec('0x64'):var _0x449106=_0xff9e72[_0xccec('0x56')][_0xccec('0x5b')](',')[_0xccec('0x28')](function(_0x1c4f9b){return Number(_0x1c4f9b);});_0x449106['forEach'](function(_0x25c1ef){_0x5d299c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x25c1ef+',%');});_0x415238=_[_0xccec('0x65')](_0x415238,_0x449106);break;case _0xccec('0x66'):if(_0xff9e72[_0xccec('0x5a')]===_0xccec('0x67')){_0x25c627[_0x1b16ed]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xff9e72['value']+'%',null);}else{_0x362844=_['find'](_0x87d6d3,[_0xccec('0x26'),_0xccec('0x68')]);_0xff9e72[_0xccec('0x3f')]=_0xccec('0x68');_0x21cf28=as['buildExpression'](_0x303aa6,_0x362844['type'],_0xff9e72);_0x25c627[_0x1b16ed](_0x21cf28['text'],_0x21cf28[_0xccec('0x56')]['start'],_0x21cf28[_0xccec('0x56')][_0xccec('0x1a')]);}break;case'body':_0x21cf28=as[_0xccec('0x60')]('me',null,_0xff9e72);_0x25c627[_0x1b16ed](_0x21cf28[_0xccec('0x62')],_0x21cf28['value'][_0xccec('0x63')],_0x21cf28[_0xccec('0x56')][_0xccec('0x1a')]);break;}}else{var _0x21cf28=as[_0xccec('0x60')](_0x303aa6,_0x362844[_0xccec('0x61')],_0xff9e72);_0x25c627[_0x1b16ed](_0x21cf28[_0xccec('0x62')],_0x21cf28[_0xccec('0x56')][_0xccec('0x63')],_0x21cf28[_0xccec('0x56')]['end']);}}}else{var _0x10f944=_(_0x5373df[_0xccec('0x36')])[_0xccec('0x33')]()[_0xccec('0x28')](function(_0x2d5f33){return _['some'](_0x87d6d3,[_0xccec('0x26'),_0x2d5f33])?_0x2d5f33:undefined;})[_0xccec('0x69')]()[_0xccec('0x56')]();if(!_['isEmpty'](_0x10f944)){_0x10f944[_0xccec('0x2b')](function(_0x128b63){if(_0x128b63===_0xccec('0x6a')){_0x57c8ab[_0xccec('0x3e')]('i.FaxAccountId\x20IN\x20?',[][_0xccec('0x6b')](_0x5373df[_0xccec('0x36')][_0x128b63]));}else if(_0x128b63===_0xccec('0x6c')){var _0x33c721=JSON['parse'](_0x5373df[_0xccec('0x36')][_0x128b63])[_0xccec('0x6d')];var _0x395ebc=JSON[_0xccec('0x6e')](_0x5373df['query'][_0x128b63])[_0xccec('0x6f')];_0x57c8ab[_0xccec('0x3e')](_0xccec('0x70'),_0x33c721,_0x395ebc);}else{if(_0x5373df['query'][_0x128b63]===_0xccec('0x71')){_0x57c8ab[_0xccec('0x3e')]('i.'+_0x128b63+'\x20IS\x20NULL');}else{_0x57c8ab[_0xccec('0x3e')]('i.'+_0x128b63+_0xccec('0x72'),_0x5373df[_0xccec('0x36')][_0x128b63]);}}});}if(_0x5373df[_0xccec('0x36')][_0xccec('0x73')]){if(_0x5373df['query'][_0xccec('0x73')]==0x1){_0x57c8ab[_0xccec('0x57')](_0xccec('0x74'));}else{_0x57c8ab['having'](_0xccec('0x75'));}}if(_0x5373df[_0xccec('0x36')][_0xccec('0x76')]){_0x415238=_[_0xccec('0x77')](_0x5373df[_0xccec('0x36')][_0xccec('0x76')])?_0x5373df['query'][_0xccec('0x76')]:new Array(_0x5373df[_0xccec('0x36')][_0xccec('0x76')]);_0x415238[_0xccec('0x2b')](function(_0x59e15e){_0x5d299c['or'](_0xccec('0x78'),'%,'+_0x59e15e+',%');});}if(_0x5373df['query'][_0xccec('0x79')]){var _0x276410=_0x5373df[_0xccec('0x36')]['filter'][_0xccec('0x7a')]('\x5c','\x5c\x5c')[_0xccec('0x7a')]('\x27\x27',_0xccec('0x7b'));if(qs['isNumeric'](_0x276410)){_0x25c627['or'](_0xccec('0x7c'),_0x276410+'%')['or'](_0xccec('0x7d'),_0x276410+'%');}_0x25c627['or'](_0xccec('0x7e'),_0x276410+'%');}}_0x57c8ab[_0xccec('0x3e')](_0x25c627);_0x57c8ab[_0xccec('0x7f')]('i.id');var _0x527369={'type':db[_0xccec('0x80')][_0xccec('0x81')]['SELECT'],'raw':!![]};var _0x1a922c=_0x57c8ab['clone']();_0x1a922c[_0xccec('0x3f')](_0xccec('0x82'));_0x1a922c[_0xccec('0x3f')](_0xccec('0x83'),_0xccec('0x55'));if(_0x5952ba[_0xccec('0x3c')]){_0x5952ba[_0xccec('0x3c')][_0xccec('0x2b')](function(_0x2c47e0){_0x57c8ab['order']('i.'+_0x2c47e0[0x0],_0x2c47e0[0x1]===_0xccec('0x84')?![]:!![]);});}if(!_[_0xccec('0x85')](_0x415238)){_0x57c8ab[_0xccec('0x57')](_0x5d299c);_0x1a922c[_0xccec('0x3e')](_0xccec('0x86'),_0x415238);}BPromise[_0xccec('0x87')]()['then'](function(){if(!_0x486034){if(_0x5373df[_0xccec('0x36')]['FaxAccountId']||_0x5373df[_0xccec('0x36')][_0xccec('0x88')])return;_0x1a922c[_0xccec('0x3e')](_0xccec('0x89'));_0x57c8ab['where'](_0xccec('0x89'));return;}return _0x5373df[_0xccec('0x8a')][_0xccec('0x8b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x16a0cc){if(_[_0xccec('0x85')](_0x16a0cc)){_0x1a922c[_0xccec('0x3e')](_0xccec('0x8c'));_0x57c8ab[_0xccec('0x3e')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x1a922c[_0xccec('0x3e')](_0xccec('0x8d'),_['map'](_0x16a0cc,'id'));_0x57c8ab[_0xccec('0x3e')](_0xccec('0x8d'),_[_0xccec('0x28')](_0x16a0cc,'id'));}});})[_0xccec('0x23')](function(){db['sequelize'][_0xccec('0x36')](_0x1a922c[_0xccec('0x8e')](),_0x527369)[_0xccec('0x23')](function(_0x3eb21a){_0x324ca1['count']=_0x3eb21a['length'];if(_0x324ca1[_0xccec('0x1c')]===0x0)return[];return db['sequelize'][_0xccec('0x36')](_0x1dfd34[_0xccec('0x8e')](),_0x527369)[_0xccec('0x23')](function(_0x1fd3f0){_0x262e25=_['keyBy'](_0x1fd3f0,'id');_0x527369=_['merge'](_0x527369,{'model':db[_0xccec('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5373df['query'][_0xccec('0x38')]){_0x5952ba['attributes'][_0xccec('0x2b')](function(_0x47e7b2){_0x57c8ab[_0xccec('0x3f')]('i.'+_0x47e7b2);});}else{_0x57c8ab[_0xccec('0x3f')](_0xccec('0x83'),_0xccec('0x55'));_0x57c8ab[_0xccec('0x3f')]('a.key',_0xccec('0x8f'));_0x57c8ab['field'](_0xccec('0x90'),_0xccec('0x91'));_0x57c8ab[_0xccec('0x3f')](_0xccec('0x92'));_0x57c8ab['field'](_0xccec('0x93'),_0xccec('0x94'));_0x57c8ab['field'](_0xccec('0x95'),_0xccec('0x96'));_0x57c8ab[_0xccec('0x3f')](_0xccec('0x97'),_0xccec('0x98'));_0x57c8ab[_0xccec('0x3f')](_0xccec('0x99'),_0xccec('0x9a'));_0x57c8ab[_0xccec('0x3f')]('c.mobile',_0xccec('0x9b'));_0x57c8ab[_0xccec('0x3f')](_0xccec('0x9c'),_0xccec('0x9d'));_0x57c8ab['field']('o.fullname','Owner.fullname');_0x57c8ab[_0xccec('0x3f')]('o.internal',_0xccec('0x9e'));_0x57c8ab[_0xccec('0x3f')](_0xccec('0x9f'),_0xccec('0x29'));}if(_0x5952ba['limit'])_0x57c8ab[_0xccec('0x3b')](_0x5952ba[_0xccec('0x3b')]);if(_0x5952ba[_0xccec('0x1d')])_0x57c8ab[_0xccec('0x1d')](_0x5952ba[_0xccec('0x1d')]);return db[_0xccec('0xa0')]['query'](_0x57c8ab['toString'](),_0x527369);})['then'](function(_0x280b04){_0x42ed1c[_0xccec('0x3e')](_0xccec('0xa1'),_['map'](_0x280b04,'id'));return db['sequelize'][_0xccec('0x36')](_0x42ed1c[_0xccec('0x8e')](),_0x527369)['then'](function(_0x1c93d9){var _0x8367c4=_[_0xccec('0xa2')](_0x1c93d9,_0xccec('0xa3'));var _0x108d43=[];_0x280b04[_0xccec('0x2b')](function(_0x1a52dc){_0x108d43[_0xccec('0x2c')](updateFaxInteraction(_0x1a52dc,_0x262e25,_0x8367c4));});return BPromise[_0xccec('0xa4')](_0x108d43);});});})[_0xccec('0x23')](function(_0xab8528){_0x324ca1[_0xccec('0xa5')]=_0xab8528;return _0x324ca1;})[_0xccec('0x23')](respondWithFilteredResult(_0xb0a4a7,_0x5952ba));})['catch'](handleError(_0xb0a4a7,null));};exports['show']=function(_0x2e619c,_0xe4967d){var _0x21e4e2={'raw':![],'where':{'id':_0x2e619c['params']['id']}},_0x386c7b={};_0x386c7b['model']=_['keys'](db['FaxInteraction'][_0xccec('0x30')]);_0x386c7b[_0xccec('0x36')]=_['keys'](_0x2e619c[_0xccec('0x36')]);_0x386c7b[_0xccec('0x34')]=_[_0xccec('0x35')](_0x386c7b[_0xccec('0x32')],_0x386c7b[_0xccec('0x36')]);_0x21e4e2[_0xccec('0x37')]=_['intersection'](_0x386c7b[_0xccec('0x32')],qs[_0xccec('0x38')](_0x2e619c['query']['fields']));_0x21e4e2['attributes']=_0x21e4e2[_0xccec('0x37')][_0xccec('0x39')]?_0x21e4e2[_0xccec('0x37')]:_0x386c7b[_0xccec('0x32')];if(_0x2e619c[_0xccec('0x36')]['includeAll']){_0x21e4e2[_0xccec('0xa6')]=[{'all':!![]}];}_0x21e4e2=_[_0xccec('0xa7')]({},_0x21e4e2,_0x2e619c[_0xccec('0xa8')]);return db['FaxInteraction']['find'](_0x21e4e2)[_0xccec('0x23')](handleEntityNotFound(_0xe4967d,null))[_0xccec('0x23')](respondWithResult(_0xe4967d,null))[_0xccec('0x2d')](handleError(_0xe4967d,null));};exports['create']=function(_0x52c5cc,_0x412851){return db[_0xccec('0x2f')]['create'](_0x52c5cc[_0xccec('0xa9')],{})[_0xccec('0x23')](respondWithResult(_0x412851,0xc9))[_0xccec('0x2d')](handleError(_0x412851,null));};exports['update']=function(_0x241b19,_0x3fa549){if(_0x241b19[_0xccec('0xa9')]['id']){delete _0x241b19[_0xccec('0xa9')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x241b19[_0xccec('0xaa')]['id']}})[_0xccec('0x23')](handleEntityNotFound(_0x3fa549,null))[_0xccec('0x23')](saveUpdates(_0x241b19[_0xccec('0xa9')],null))[_0xccec('0x23')](respondWithResult(_0x3fa549,null))['catch'](handleError(_0x3fa549,null));};exports[_0xccec('0x24')]=function(_0xb7ffd2,_0x501bd6){return db[_0xccec('0x2f')]['find']({'where':{'id':_0xb7ffd2[_0xccec('0xaa')]['id']}})[_0xccec('0x23')](handleEntityNotFound(_0x501bd6,null))[_0xccec('0x23')](removeEntity(_0x501bd6,null))[_0xccec('0x2d')](handleError(_0x501bd6,null));};exports['describe']=function(_0x12faa3,_0x374a51){return db[_0xccec('0x2f')][_0xccec('0xab')]()[_0xccec('0x23')](respondWithResult(_0x374a51,null))[_0xccec('0x2d')](handleError(_0x374a51,null));};exports[_0xccec('0xac')]=function(_0x97407d,_0xf70c0,_0x10f019){return db[_0xccec('0xad')]['find']({'where':{'id':_0x97407d['params']['id']}})[_0xccec('0x23')](handleEntityNotFound(_0xf70c0,null))[_0xccec('0x23')](function(_0x267109){if(_0x267109){return _0x267109[_0xccec('0xac')](_0x97407d[_0xccec('0xa9')][_0xccec('0xae')],_['omit'](_0x97407d[_0xccec('0xa9')],[_0xccec('0xae'),'id'])||{});}})[_0xccec('0x23')](respondWithResult(_0xf70c0,null))['catch'](handleError(_0xf70c0,null));};exports[_0xccec('0xaf')]=function(_0x48dfa9,_0x5900e2,_0x3de700){var _0x3f4af8={'raw':![],'where':{}};var _0x48a35a={};var _0x2c244d={'count':0x0,'rows':[]};return db[_0xccec('0x2f')][_0xccec('0xb0')]({'where':{'id':_0x48dfa9[_0xccec('0xaa')]['id']}})[_0xccec('0x23')](handleEntityNotFound(_0x5900e2,null))[_0xccec('0x23')](function(_0x1767fd){if(_0x1767fd){_0x48a35a[_0xccec('0x32')]=_[_0xccec('0x33')](db[_0xccec('0xad')][_0xccec('0x30')]);_0x48a35a[_0xccec('0x36')]=_[_0xccec('0x33')](_0x48dfa9['query']);_0x48a35a[_0xccec('0x34')]=_[_0xccec('0x35')](_0x48a35a[_0xccec('0x32')],_0x48a35a[_0xccec('0x36')]);_0x3f4af8['attributes']=_[_0xccec('0x35')](_0x48a35a[_0xccec('0x32')],qs['fields'](_0x48dfa9[_0xccec('0x36')][_0xccec('0x38')]));_0x3f4af8[_0xccec('0x37')]=_0x3f4af8[_0xccec('0x37')][_0xccec('0x39')]?_0x3f4af8[_0xccec('0x37')]:_0x48a35a[_0xccec('0x32')];if(!_0x48dfa9[_0xccec('0x36')][_0xccec('0x3a')]('nolimit')){_0x3f4af8[_0xccec('0x3b')]=qs[_0xccec('0x3b')](_0x48dfa9['query'][_0xccec('0x3b')]);_0x3f4af8[_0xccec('0x1d')]=qs[_0xccec('0x1d')](_0x48dfa9[_0xccec('0x36')][_0xccec('0x1d')]);}_0x3f4af8['order']=qs[_0xccec('0x3d')](_0x48dfa9[_0xccec('0x36')][_0xccec('0x3d')]);_0x3f4af8['where']=qs[_0xccec('0x34')](_['pick'](_0x48dfa9[_0xccec('0x36')],_0x48a35a[_0xccec('0x34')]));_0x3f4af8['where'][_0xccec('0xa3')]=_0x1767fd['id'];if(_0x48dfa9[_0xccec('0x36')]['filter']){_0x3f4af8[_0xccec('0x3e')]=_[_0xccec('0xa7')](_0x3f4af8[_0xccec('0x3e')],{'$or':_[_0xccec('0x28')](_0x3f4af8['attributes'],function(_0x1d6922){var _0x5e16de={};_0x5e16de[_0x1d6922]={'$like':'%'+_0x48dfa9[_0xccec('0x36')][_0xccec('0x79')]+'%'};return _0x5e16de;})});}if(_0x48dfa9[_0xccec('0x36')][_0xccec('0x6d')]){var _0x855870=_0x48dfa9['query']['$gte'][_0xccec('0x5b')](',');var _0x3177b9={};_0x3177b9[_0x855870[0x0]]={'$gte':moment(_0x855870[0x1])['format'](_0xccec('0xb1'))};_0x3f4af8[_0xccec('0x3e')]=_[_0xccec('0xa7')](_0x3f4af8[_0xccec('0x3e')],_0x3177b9);}_0x3f4af8=_[_0xccec('0xa7')]({},_0x3f4af8,_0x48dfa9[_0xccec('0xa8')]);return db[_0xccec('0xad')][_0xccec('0x1c')]({'where':_0x3f4af8[_0xccec('0x3e')]})[_0xccec('0x23')](function(_0x36e37e){_0x2c244d['count']=_0x36e37e;if(_0x48dfa9['query'][_0xccec('0xb2')]){_0x3f4af8[_0xccec('0xa6')]=[{'all':!![]}];}return db[_0xccec('0xad')]['findAll'](_0x3f4af8);})['then'](function(_0x14e396){_0x2c244d['rows']=_0x14e396;return _0x2c244d;});}})[_0xccec('0x23')](respondWithFilteredResult(_0x5900e2,_0x3f4af8))[_0xccec('0x2d')](handleError(_0x5900e2,null));};exports[_0xccec('0xb3')]=function(_0x49bf95,_0x493251,_0xdba0a0){return db[_0xccec('0x2f')][_0xccec('0x54')]({'where':{'id':_0x49bf95[_0xccec('0xaa')]['id']}})['then'](handleEntityNotFound(_0x493251,null))[_0xccec('0x23')](function(_0x3eb6c7){if(_0x3eb6c7){return _0x3eb6c7['setTags'](_0x49bf95[_0xccec('0xa9')][_0xccec('0xae')],_['omit'](_0x49bf95[_0xccec('0xa9')],[_0xccec('0xae'),'id'])||{})['spread'](function(){return db[_0xccec('0x64')][_0xccec('0xb4')]({'attributes':['id',_0xccec('0x26'),'color'],'where':{'id':_0x49bf95['body'][_0xccec('0xae')]}});})['then'](function(_0x1b92bf){socket['emit'](_0xccec('0xb5'),{'id':Number(_0x49bf95[_0xccec('0xaa')]['id']),'tags':_0x1b92bf||[]});return{'id':Number(_0x49bf95[_0xccec('0xaa')]['id']),'tags':_0x1b92bf||[]};});}})[_0xccec('0x23')](respondWithResult(_0x493251,null))[_0xccec('0x2d')](handleError(_0x493251,null));};exports[_0xccec('0xb6')]=function(_0x57ac9b,_0x147f3b,_0x125abf){return db['FaxInteraction'][_0xccec('0x54')]({'where':{'id':_0x57ac9b[_0xccec('0xaa')]['id']}})['then'](handleEntityNotFound(_0x147f3b,null))[_0xccec('0x23')](function(_0x2e8ab9){if(_0x2e8ab9){return _0x2e8ab9[_0xccec('0xb6')](_0x57ac9b['query'][_0xccec('0xae')]);}})[_0xccec('0x23')](respondWithStatusCode(_0x147f3b,null))[_0xccec('0x2d')](handleError(_0x147f3b,null));};exports['download']=function(_0x31b21e,_0x4bacbe){var _0xf4e89=moment()[_0xccec('0xb7')]()[_0xccec('0x8e')]();var _0x368b09=path[_0xccec('0xb8')](config[_0xccec('0xb9')],_0xccec('0xba'),_0xccec('0xbb'),'tmp');var _0x171b21=path[_0xccec('0xb8')](config[_0xccec('0xb9')],'server','files','attachments');var _0x5cab0e=path[_0xccec('0xb8')](_0x368b09,_0xf4e89);var _0x24669a=util[_0xccec('0xbc')](_0xccec('0xbd'),_0x31b21e[_0xccec('0xaa')]['id'],_0xf4e89);var _0x4d7830=path[_0xccec('0xb8')](_0x368b09,_0x24669a);var _0xa0fdda=[];_0xa0fdda['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x4e030e=[{'model':db[_0xccec('0xad')],'as':_0xccec('0xbe'),'attributes':['id','body',_0xccec('0x6c')],'include':_0xa0fdda}];return db[_0xccec('0x2f')][_0xccec('0x54')]({'where':{'id':_0x31b21e[_0xccec('0xaa')]['id']},'include':_0x4e030e})['then'](handleEntityNotFound(_0x4bacbe,null))['then'](function(_0x5d355e){if(_0x5d355e&&_0x5d355e['Messages']){var _0xe31042=_0x5d355e[_0xccec('0xbf')]({'plain':!![]});fs[_0xccec('0xc0')](_0x5cab0e);for(var _0x1b1643=0x0;_0x1b1643<_0xe31042[_0xccec('0xbe')]['length'];_0x1b1643++){var _0x1454f5=_0xe31042['Messages'][_0x1b1643][_0xccec('0xc1')];if(_0x1454f5){var _0x33b964=path[_0xccec('0xb8')](_0x171b21,_0x1454f5[_0xccec('0xc2')]);if(fs[_0xccec('0xc3')](_0x33b964)){fs[_0xccec('0xc4')](_0x33b964)[_0xccec('0xc5')](fs['createWriteStream'](path[_0xccec('0xb8')](_0x5cab0e,_0x1454f5[_0xccec('0xc2')])));}}}return BPromise[_0xccec('0x87')]()['then'](function(){return new BPromise(function(_0x469316,_0x368f3c){zipdir(_0x5cab0e,{'saveTo':_0x4d7830},function(_0x1f1f3b,_0x3b9dcd){if(_0x1f1f3b)return _0x368f3c(_0x1f1f3b);return _0x469316(_0x3b9dcd);});})[_0xccec('0x23')](function(){return new BPromise(function(_0x4ae550,_0x4df6a3){rimraf(_0x5cab0e,function(_0xc784c1){if(_0xc784c1)_0x4df6a3(_0xc784c1);return _0x4ae550();});});})['then'](function(){return _0x4bacbe[_0xccec('0xc6')](_0x4d7830,_0x24669a,function(_0x35ac58){if(_0x35ac58){console[_0xccec('0xc7')]('err',_0x35ac58);}else{fs[_0xccec('0xc8')](_0x4d7830);}});});});}else{return _0x4bacbe['sendStatus'](0xc8);}})[_0xccec('0x2d')](handleError(_0x4bacbe,null));}; \ No newline at end of file +var _0xbd20=['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','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','keys','some','isEmpty','concat','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','count','keyBy','FaxInteraction','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','include','options','create','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','merge','findAll','setTags','emit','faxInteractionTags:save','removeTags','download','unix','join','tmp','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','fullname','TagIds','Tags','forEach','push','catch','index','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','left_join','users','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','split'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0xbd20,0x14a));var _0x0bd2=function(_0x103762,_0x39d529){_0x103762=_0x103762-0x0;var _0x24844e=_0xbd20[_0x103762];return _0x24844e;};'use strict';var pdf=require(_0x0bd2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0bd2('0x1'));var jsonpatch=require(_0x0bd2('0x2'));var rp=require(_0x0bd2('0x3'));var moment=require(_0x0bd2('0x4'));var BPromise=require(_0x0bd2('0x5'));var Mustache=require('mustache');var util=require(_0x0bd2('0x6'));var path=require(_0x0bd2('0x7'));var sox=require(_0x0bd2('0x8'));var csv=require('to-csv');var ejs=require(_0x0bd2('0x9'));var fs=require('fs');var _=require(_0x0bd2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0bd2('0xb'));var deskjs=require(_0x0bd2('0xc'));var toCsv=require(_0x0bd2('0xd'));var querystring=require(_0x0bd2('0xe'));var Papa=require(_0x0bd2('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0bd2('0x10'));var as=require(_0x0bd2('0x11'));var hardwareService=require(_0x0bd2('0x12'));var logger=require(_0x0bd2('0x13'))(_0x0bd2('0x14'));var utils=require('../../config/utils');var config=require(_0x0bd2('0x15'));var db=require('../../mysqldb')['db'];config[_0x0bd2('0x16')]=_[_0x0bd2('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0bd2('0x18'))(new Redis(config[_0x0bd2('0x16')]));require(_0x0bd2('0x19'))[_0x0bd2('0x1a')](socket);function respondWithStatusCode(_0x2abcc8,_0x561b0f){_0x561b0f=_0x561b0f||0xcc;return function(_0x5009b4){if(_0x5009b4){return _0x2abcc8[_0x0bd2('0x1b')](_0x561b0f);}return _0x2abcc8[_0x0bd2('0x1c')](_0x561b0f)['end']();};}function respondWithResult(_0x283f31,_0xd988bb){_0xd988bb=_0xd988bb||0xc8;return function(_0x26dbe1){if(_0x26dbe1){return _0x283f31[_0x0bd2('0x1c')](_0xd988bb)[_0x0bd2('0x1d')](_0x26dbe1);}};}function respondWithFilteredResult(_0x19e2e3,_0x36001b){return function(_0x51d4d6){if(_0x51d4d6){var _0x56902d=_0x51d4d6['count'],_0x21aedf=_0x36001b[_0x0bd2('0x1e')],_0x5d6cef=_0x36001b['offset']+_0x36001b[_0x0bd2('0x1f')],_0x452a9b;if(_0x5d6cef>=_0x56902d){_0x5d6cef=_0x56902d;_0x452a9b=0xc8;}else{_0x452a9b=0xce;}_0x19e2e3['status'](_0x452a9b);return _0x19e2e3[_0x0bd2('0x20')](_0x0bd2('0x21'),_0x21aedf+'-'+_0x5d6cef+'/'+_0x56902d)[_0x0bd2('0x1d')](_0x51d4d6);}return null;};}function patchUpdates(_0x4b1a3e){return function(_0x21206b){try{jsonpatch[_0x0bd2('0x22')](_0x21206b,_0x4b1a3e,!![]);}catch(_0x18336d){return BPromise[_0x0bd2('0x23')](_0x18336d);}return _0x21206b[_0x0bd2('0x24')]();};}function saveUpdates(_0x5cdac7,_0x36b3c4){return function(_0x318b7d){if(_0x318b7d){return _0x318b7d[_0x0bd2('0x25')](_0x5cdac7)[_0x0bd2('0x26')](function(_0x277ae9){return _0x277ae9;});}return null;};}function removeEntity(_0x343a99,_0xe47fb){return function(_0x2cd160){if(_0x2cd160){return _0x2cd160[_0x0bd2('0x27')]()[_0x0bd2('0x26')](function(){_0x343a99[_0x0bd2('0x1c')](0xcc)[_0x0bd2('0x28')]();});}};}function handleEntityNotFound(_0x3760a4,_0x3a3eff){return function(_0x1b4c9e){if(!_0x1b4c9e){_0x3760a4[_0x0bd2('0x1b')](0x194);}return _0x1b4c9e;};}function handleError(_0x3d63f2,_0x5f0514){_0x5f0514=_0x5f0514||0x1f4;return function(_0x5b8061){logger[_0x0bd2('0x29')](_0x5b8061[_0x0bd2('0x2a')]);if(_0x5b8061[_0x0bd2('0x2b')]){delete _0x5b8061[_0x0bd2('0x2b')];}_0x3d63f2[_0x0bd2('0x1c')](_0x5f0514)[_0x0bd2('0x2c')](_0x5b8061);};}function getInteractionUsers(_0x4d7ba1,_0x459bd6){return new BPromise(function(_0x507a1e,_0x37e5a4){try{if(_0x459bd6[_0x4d7ba1['id']]){_0x4d7ba1['Users']=_[_0x0bd2('0x2d')](_0x459bd6[_0x4d7ba1['id']],function(_0x4a4e46){return{'id':_0x4a4e46['id'],'fullname':_0x4a4e46[_0x0bd2('0x2e')]};});}}catch(_0x2c7196){_0x37e5a4(_0x2c7196);}_0x507a1e(_0x4d7ba1);});}function getInteractionTags(_0x5bdbf5,_0x28d658){return new BPromise(function(_0x5681a0,_0x4ebc65){try{if(_0x5bdbf5[_0x0bd2('0x2f')]){_0x5bdbf5[_0x0bd2('0x30')]=[];_0x5bdbf5[_0x0bd2('0x2f')]['split'](',')[_0x0bd2('0x31')](function(_0x472414){_0x5bdbf5['Tags'][_0x0bd2('0x32')](_0x28d658[_0x472414]);});}delete _0x5bdbf5[_0x0bd2('0x2f')];}catch(_0x255afe){_0x4ebc65(_0x255afe);}_0x5681a0(_0x5bdbf5);});}function updateFaxInteraction(_0x5e60ee,_0x179786,_0x4138f2){return new BPromise(function(_0xce45ca,_0x2bf436){return getInteractionUsers(_0x5e60ee,_0x4138f2)[_0x0bd2('0x26')](function(_0x546ff3){return getInteractionTags(_0x546ff3,_0x179786);})[_0x0bd2('0x26')](function(_0x5adb10){_0xce45ca(_0x5adb10);})[_0x0bd2('0x33')](function(_0x344cff){_0x2bf436(_0x344cff);});});}exports[_0x0bd2('0x34')]=function(_0x350151,_0x377489){var _0x2c84d3={},_0x55bf9d={},_0x3e0e0e={'count':0x0,'rows':[]};var _0x469399=_[_0x0bd2('0x2d')](db['FaxInteraction']['rawAttributes'],function(_0x20d02a){return{'name':_0x20d02a[_0x0bd2('0x35')],'type':_0x20d02a[_0x0bd2('0x36')][_0x0bd2('0x37')]};});_0x55bf9d['model']=_['map'](_0x469399,_0x0bd2('0x2b'));_0x55bf9d[_0x0bd2('0x38')]=_['keys'](_0x350151[_0x0bd2('0x38')]);_0x55bf9d[_0x0bd2('0x39')]=_[_0x0bd2('0x3a')](_0x55bf9d[_0x0bd2('0x3b')],_0x55bf9d[_0x0bd2('0x38')]);_0x2c84d3[_0x0bd2('0x3c')]=_['intersection'](_0x55bf9d[_0x0bd2('0x3b')],qs[_0x0bd2('0x3d')](_0x350151[_0x0bd2('0x38')][_0x0bd2('0x3d')]));_0x2c84d3[_0x0bd2('0x3c')]=_0x2c84d3[_0x0bd2('0x3c')][_0x0bd2('0x3e')]?_0x2c84d3[_0x0bd2('0x3c')]:_0x55bf9d[_0x0bd2('0x3b')];if(!_0x350151['query'][_0x0bd2('0x3f')](_0x0bd2('0x40'))){_0x2c84d3[_0x0bd2('0x1f')]=qs['limit'](_0x350151[_0x0bd2('0x38')][_0x0bd2('0x1f')]);_0x2c84d3[_0x0bd2('0x1e')]=qs['offset'](_0x350151[_0x0bd2('0x38')]['offset']);}_0x2c84d3[_0x0bd2('0x41')]=qs[_0x0bd2('0x42')](_0x350151[_0x0bd2('0x38')]['sort']);_0x2c84d3['where']=qs['filters'](_[_0x0bd2('0x43')](_0x350151['query'],_0x55bf9d[_0x0bd2('0x39')]),_0x469399);var _0x31d7f6=[];var _0x385dec=squel[_0x0bd2('0x44')]()[_0x0bd2('0x45')]('id')[_0x0bd2('0x45')](_0x0bd2('0x2b'))[_0x0bd2('0x45')](_0x0bd2('0x46'))[_0x0bd2('0x47')](_0x0bd2('0x48'));var _0xc7bc8e=squel[_0x0bd2('0x44')]()[_0x0bd2('0x45')](_0x0bd2('0x49'))[_0x0bd2('0x45')](_0x0bd2('0x4a'))[_0x0bd2('0x45')](_0x0bd2('0x4b'))[_0x0bd2('0x47')]('user_has_fax_interactions','ui')[_0x0bd2('0x4c')](_0x0bd2('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x4fef17=squel['select']()[_0x0bd2('0x47')](_0x0bd2('0x4e'),'i')[_0x0bd2('0x4c')](_0x0bd2('0x4f'),'c',_0x0bd2('0x50'))[_0x0bd2('0x4c')]('users','o',_0x0bd2('0x51'))[_0x0bd2('0x4c')](_0x0bd2('0x52'),'a',_0x0bd2('0x53'))['left_join']('fax_messages','me',_0x0bd2('0x54'))[_0x0bd2('0x4c')](_0x0bd2('0x55'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x0bd2('0x4c')](_0x0bd2('0x48'),'t',_0x0bd2('0x56'));var _0x59bbfb=squel[_0x0bd2('0x57')]();var _0x47475=[];var _0x286cb4=squel[_0x0bd2('0x57')]();var _0x54709c;if(_0x350151['query'][_0x0bd2('0x58')]){_0x54709c=as[_0x0bd2('0x59')](_0x350151['query']['search']);var _0x3f46b1=_0x54709c['sqlOperator'];for(var _0x4dbf8e=0x0;_0x4dbf8e<_0x54709c[_0x0bd2('0x5a')][_0x0bd2('0x3e')];_0x4dbf8e++){var _0x6a468b=_0x54709c[_0x0bd2('0x5a')][_0x4dbf8e];var _0x32f00e='i';var _0x5de5b4=_[_0x0bd2('0x5b')](_0x469399,[_0x0bd2('0x2b'),_0x6a468b['field']]);if(!_0x5de5b4){switch(_0x6a468b[_0x0bd2('0x45')]){case _0x0bd2('0x5c'):if(_0x6a468b[_0x0bd2('0x5d')]==0x1){_0x4fef17[_0x0bd2('0x5e')]('`'+_0x6a468b[_0x0bd2('0x45')]+_0x0bd2('0x5f'));}else{_0x4fef17['having']('`'+_0x6a468b[_0x0bd2('0x45')]+_0x0bd2('0x60'));}break;case _0x0bd2('0x61'):if(_0x6a468b['operator']===_0x0bd2('0x62')){if(_0x6a468b['value'][_0x0bd2('0x63')]('\x20')[_0x0bd2('0x3e')]>0x1){_0x59bbfb[_0x3f46b1]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0bd2('0x64')](_0x6a468b[_0x0bd2('0x5d')]),null);}else{var _0x51af04='%'+_0x6a468b[_0x0bd2('0x5d')]+'%';_0x59bbfb[_0x3f46b1](_0x0bd2('0x65'),_0x51af04,_0x51af04,_0x51af04);}}else{_0x5de5b4=_['find'](_0x469399,[_0x0bd2('0x2b'),'ContactId']);_0x6a468b[_0x0bd2('0x45')]=_0x0bd2('0x66');_0x2224ae=as[_0x0bd2('0x67')](_0x32f00e,_0x5de5b4[_0x0bd2('0x36')],_0x6a468b);_0x59bbfb[_0x3f46b1](_0x2224ae[_0x0bd2('0x68')],_0x2224ae['value']['start'],_0x2224ae[_0x0bd2('0x5d')][_0x0bd2('0x28')]);}break;case _0x0bd2('0x69'):var _0x5c6345=_0x6a468b[_0x0bd2('0x5d')]['split'](',')[_0x0bd2('0x2d')](function(_0x5b7fb6){return Number(_0x5b7fb6);});_0x5c6345[_0x0bd2('0x31')](function(_0x59e226){_0x286cb4['or'](_0x0bd2('0x6a'),'%,'+_0x59e226+',%');});_0x47475=_[_0x0bd2('0x6b')](_0x47475,_0x5c6345);break;case _0x0bd2('0x6c'):if(_0x6a468b[_0x0bd2('0x6d')]===_0x0bd2('0x62')){_0x59bbfb[_0x3f46b1](_0x0bd2('0x6e'),'%'+_0x6a468b[_0x0bd2('0x5d')]+'%',null);}else{_0x5de5b4=_[_0x0bd2('0x5b')](_0x469399,[_0x0bd2('0x2b'),_0x0bd2('0x6f')]);_0x6a468b[_0x0bd2('0x45')]='UserId';_0x2224ae=as[_0x0bd2('0x67')](_0x32f00e,_0x5de5b4['type'],_0x6a468b);_0x59bbfb[_0x3f46b1](_0x2224ae['text'],_0x2224ae[_0x0bd2('0x5d')][_0x0bd2('0x70')],_0x2224ae[_0x0bd2('0x5d')]['end']);}break;case _0x0bd2('0x71'):_0x2224ae=as['buildExpression']('me',null,_0x6a468b);_0x59bbfb[_0x3f46b1](_0x2224ae[_0x0bd2('0x68')],_0x2224ae['value'][_0x0bd2('0x70')],_0x2224ae[_0x0bd2('0x5d')][_0x0bd2('0x28')]);break;}}else{var _0x2224ae=as[_0x0bd2('0x67')](_0x32f00e,_0x5de5b4[_0x0bd2('0x36')],_0x6a468b);_0x59bbfb[_0x3f46b1](_0x2224ae[_0x0bd2('0x68')],_0x2224ae[_0x0bd2('0x5d')][_0x0bd2('0x70')],_0x2224ae[_0x0bd2('0x5d')][_0x0bd2('0x28')]);}}}else{var _0x12e435=_(_0x350151['query'])[_0x0bd2('0x72')]()[_0x0bd2('0x2d')](function(_0x361fd8){return _[_0x0bd2('0x73')](_0x469399,[_0x0bd2('0x2b'),_0x361fd8])?_0x361fd8:undefined;})['compact']()['value']();if(!_[_0x0bd2('0x74')](_0x12e435)){_0x12e435[_0x0bd2('0x31')](function(_0x559d44){if(_0x559d44==='FaxAccountId'){_0x4fef17['where']('i.FaxAccountId\x20IN\x20?',[][_0x0bd2('0x75')](_0x350151[_0x0bd2('0x38')][_0x559d44]));}else if(_0x559d44==='createdAt'){var _0x1a060d=JSON[_0x0bd2('0x76')](_0x350151[_0x0bd2('0x38')][_0x559d44])[_0x0bd2('0x77')];var _0xdf2d06=JSON['parse'](_0x350151[_0x0bd2('0x38')][_0x559d44])[_0x0bd2('0x78')];_0x4fef17[_0x0bd2('0x79')](_0x0bd2('0x7a'),_0x1a060d,_0xdf2d06);}else{if(_0x350151['query'][_0x559d44]==='null'){_0x4fef17[_0x0bd2('0x79')]('i.'+_0x559d44+'\x20IS\x20NULL');}else{_0x4fef17['where']('i.'+_0x559d44+_0x0bd2('0x7b'),_0x350151[_0x0bd2('0x38')][_0x559d44]);}}});}if(_0x350151[_0x0bd2('0x38')][_0x0bd2('0x7c')]){if(_0x350151['query'][_0x0bd2('0x7c')]==0x1){_0x4fef17[_0x0bd2('0x5e')](_0x0bd2('0x7d'));}else{_0x4fef17[_0x0bd2('0x5e')](_0x0bd2('0x7e'));}}if(_0x350151['query'][_0x0bd2('0x7f')]){_0x47475=_[_0x0bd2('0x80')](_0x350151['query'][_0x0bd2('0x7f')])?_0x350151[_0x0bd2('0x38')]['tag']:new Array(_0x350151[_0x0bd2('0x38')][_0x0bd2('0x7f')]);_0x47475[_0x0bd2('0x31')](function(_0x20b4c2){_0x286cb4['or'](_0x0bd2('0x6a'),'%,'+_0x20b4c2+',%');});}if(_0x350151['query'][_0x0bd2('0x81')]){var _0x426900=_0x350151[_0x0bd2('0x38')][_0x0bd2('0x81')][_0x0bd2('0x82')]('\x5c','\x5c\x5c')[_0x0bd2('0x82')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x0bd2('0x83')](_0x426900)){_0x59bbfb['or'](_0x0bd2('0x84'),_0x426900+'%')['or'](_0x0bd2('0x85'),_0x426900+'%');}_0x59bbfb['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x426900+'%');}}_0x4fef17[_0x0bd2('0x79')](_0x59bbfb);_0x4fef17[_0x0bd2('0x86')]('i.id');var _0x204408={'type':db[_0x0bd2('0x87')][_0x0bd2('0x88')][_0x0bd2('0x89')],'raw':!![]};var _0x59646c=_0x4fef17[_0x0bd2('0x8a')]();_0x59646c[_0x0bd2('0x45')](_0x0bd2('0x8b'));_0x59646c[_0x0bd2('0x45')](_0x0bd2('0x8c'),'unreadMessages');if(_0x2c84d3['order']){_0x2c84d3[_0x0bd2('0x41')]['forEach'](function(_0x3bc572){_0x4fef17[_0x0bd2('0x41')]('i.'+_0x3bc572[0x0],_0x3bc572[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0bd2('0x74')](_0x47475)){_0x4fef17[_0x0bd2('0x5e')](_0x286cb4);_0x59646c[_0x0bd2('0x79')](_0x0bd2('0x8d'),_0x47475);}BPromise[_0x0bd2('0x8e')]()[_0x0bd2('0x26')](function(){if(!_0x54709c){if(_0x350151[_0x0bd2('0x38')]['FaxAccountId']||_0x350151[_0x0bd2('0x38')][_0x0bd2('0x8f')])return;_0x59646c[_0x0bd2('0x79')](_0x0bd2('0x90'));_0x4fef17[_0x0bd2('0x79')](_0x0bd2('0x90'));return;}return _0x350151[_0x0bd2('0x91')][_0x0bd2('0x92')]({'attributes':['id'],'raw':!![]})[_0x0bd2('0x26')](function(_0x2753a3){if(_[_0x0bd2('0x74')](_0x2753a3)){_0x59646c[_0x0bd2('0x79')](_0x0bd2('0x93'));_0x4fef17['where'](_0x0bd2('0x93'));}else{_0x59646c[_0x0bd2('0x79')](_0x0bd2('0x94'),_[_0x0bd2('0x2d')](_0x2753a3,'id'));_0x4fef17[_0x0bd2('0x79')]('i.FaxAccountId\x20IN\x20?',_[_0x0bd2('0x2d')](_0x2753a3,'id'));}});})[_0x0bd2('0x26')](function(){db[_0x0bd2('0x95')][_0x0bd2('0x38')](_0x59646c[_0x0bd2('0x96')](),_0x204408)[_0x0bd2('0x26')](function(_0x34911b){_0x3e0e0e[_0x0bd2('0x97')]=_0x34911b[_0x0bd2('0x3e')];if(_0x3e0e0e[_0x0bd2('0x97')]===0x0)return[];return db[_0x0bd2('0x95')][_0x0bd2('0x38')](_0x385dec['toString'](),_0x204408)[_0x0bd2('0x26')](function(_0x55856e){_0x31d7f6=_[_0x0bd2('0x98')](_0x55856e,'id');_0x204408=_['merge'](_0x204408,{'model':db[_0x0bd2('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x350151[_0x0bd2('0x38')][_0x0bd2('0x3d')]){_0x2c84d3[_0x0bd2('0x3c')][_0x0bd2('0x31')](function(_0x592e23){_0x4fef17['field']('i.'+_0x592e23);});}else{_0x4fef17['field'](_0x0bd2('0x8c'),_0x0bd2('0x5c'));_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0x9a'),'Account.key');_0x4fef17['field'](_0x0bd2('0x9b'),_0x0bd2('0x9c'));_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0x9d'));_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0x9e'),'Contact.firstName');_0x4fef17[_0x0bd2('0x45')]('c.lastName',_0x0bd2('0x9f'));_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0xa0'),_0x0bd2('0xa1'));_0x4fef17['field'](_0x0bd2('0xa2'),_0x0bd2('0xa3'));_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0xa4'),'Contact.mobile');_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0xa5'),_0x0bd2('0xa6'));_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0xa7'),_0x0bd2('0xa8'));_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0xa9'),'Owner.internal');_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0xaa'),'TagIds');}if(_0x2c84d3[_0x0bd2('0x1f')])_0x4fef17[_0x0bd2('0x1f')](_0x2c84d3[_0x0bd2('0x1f')]);if(_0x2c84d3[_0x0bd2('0x1e')])_0x4fef17[_0x0bd2('0x1e')](_0x2c84d3['offset']);return db[_0x0bd2('0x95')][_0x0bd2('0x38')](_0x4fef17[_0x0bd2('0x96')](),_0x204408);})[_0x0bd2('0x26')](function(_0x4fcef1){_0xc7bc8e[_0x0bd2('0x79')](_0x0bd2('0xab'),_[_0x0bd2('0x2d')](_0x4fcef1,'id'));return db[_0x0bd2('0x95')][_0x0bd2('0x38')](_0xc7bc8e[_0x0bd2('0x96')](),_0x204408)[_0x0bd2('0x26')](function(_0x176ab0){var _0x1d90a1=_[_0x0bd2('0xac')](_0x176ab0,'FaxInteractionId');var _0x45431c=[];_0x4fcef1[_0x0bd2('0x31')](function(_0x93eeaf){_0x45431c[_0x0bd2('0x32')](updateFaxInteraction(_0x93eeaf,_0x31d7f6,_0x1d90a1));});return BPromise[_0x0bd2('0xad')](_0x45431c);});});})['then'](function(_0x973f4){_0x3e0e0e[_0x0bd2('0xae')]=_0x973f4;return _0x3e0e0e;})['then'](respondWithFilteredResult(_0x377489,_0x2c84d3));})[_0x0bd2('0x33')](handleError(_0x377489,null));};exports[_0x0bd2('0xaf')]=function(_0x3574b9,_0x2b5058){var _0x462271={'raw':![],'where':{'id':_0x3574b9[_0x0bd2('0xb0')]['id']}},_0x38f791={};_0x38f791[_0x0bd2('0x3b')]=_[_0x0bd2('0x72')](db['FaxInteraction']['rawAttributes']);_0x38f791['query']=_[_0x0bd2('0x72')](_0x3574b9[_0x0bd2('0x38')]);_0x38f791[_0x0bd2('0x39')]=_[_0x0bd2('0x3a')](_0x38f791[_0x0bd2('0x3b')],_0x38f791[_0x0bd2('0x38')]);_0x462271[_0x0bd2('0x3c')]=_[_0x0bd2('0x3a')](_0x38f791[_0x0bd2('0x3b')],qs['fields'](_0x3574b9[_0x0bd2('0x38')][_0x0bd2('0x3d')]));_0x462271['attributes']=_0x462271['attributes']['length']?_0x462271[_0x0bd2('0x3c')]:_0x38f791[_0x0bd2('0x3b')];if(_0x3574b9['query'][_0x0bd2('0xb1')]){_0x462271[_0x0bd2('0xb2')]=[{'all':!![]}];}_0x462271=_['merge']({},_0x462271,_0x3574b9[_0x0bd2('0xb3')]);return db[_0x0bd2('0x99')][_0x0bd2('0x5b')](_0x462271)[_0x0bd2('0x26')](handleEntityNotFound(_0x2b5058,null))[_0x0bd2('0x26')](respondWithResult(_0x2b5058,null))[_0x0bd2('0x33')](handleError(_0x2b5058,null));};exports['create']=function(_0x7789b1,_0x1498aa){return db[_0x0bd2('0x99')][_0x0bd2('0xb4')](_0x7789b1[_0x0bd2('0x71')],{})[_0x0bd2('0x26')](respondWithResult(_0x1498aa,0xc9))[_0x0bd2('0x33')](handleError(_0x1498aa,null));};exports[_0x0bd2('0x25')]=function(_0x5c080a,_0x5c147){if(_0x5c080a[_0x0bd2('0x71')]['id']){delete _0x5c080a[_0x0bd2('0x71')]['id'];}return db[_0x0bd2('0x99')][_0x0bd2('0x5b')]({'where':{'id':_0x5c080a[_0x0bd2('0xb0')]['id']}})[_0x0bd2('0x26')](handleEntityNotFound(_0x5c147,null))[_0x0bd2('0x26')](saveUpdates(_0x5c080a['body'],null))['then'](respondWithResult(_0x5c147,null))[_0x0bd2('0x33')](handleError(_0x5c147,null));};exports[_0x0bd2('0x27')]=function(_0x1298d2,_0x8baac6){return db[_0x0bd2('0x99')][_0x0bd2('0x5b')]({'where':{'id':_0x1298d2['params']['id']}})[_0x0bd2('0x26')](handleEntityNotFound(_0x8baac6,null))[_0x0bd2('0x26')](removeEntity(_0x8baac6,null))[_0x0bd2('0x33')](handleError(_0x8baac6,null));};exports[_0x0bd2('0xb5')]=function(_0xedb4f7,_0x49f982){return db[_0x0bd2('0x99')][_0x0bd2('0xb5')]()[_0x0bd2('0x26')](respondWithResult(_0x49f982,null))[_0x0bd2('0x33')](handleError(_0x49f982,null));};exports['addMessage']=function(_0x4d7a9d,_0x21570c,_0x3a5e1e){return db['FaxMessage'][_0x0bd2('0x5b')]({'where':{'id':_0x4d7a9d['params']['id']}})[_0x0bd2('0x26')](handleEntityNotFound(_0x21570c,null))[_0x0bd2('0x26')](function(_0x36be7a){if(_0x36be7a){return _0x36be7a[_0x0bd2('0xb6')](_0x4d7a9d[_0x0bd2('0x71')][_0x0bd2('0xb7')],_[_0x0bd2('0xb8')](_0x4d7a9d[_0x0bd2('0x71')],[_0x0bd2('0xb7'),'id'])||{});}})['then'](respondWithResult(_0x21570c,null))[_0x0bd2('0x33')](handleError(_0x21570c,null));};exports[_0x0bd2('0xb9')]=function(_0x1a6f09,_0x1a42cf,_0x447d4d){var _0x4edf87={'raw':![],'where':{}};var _0x114771={};var _0x1c4cf4={'count':0x0,'rows':[]};return db[_0x0bd2('0x99')][_0x0bd2('0xba')]({'where':{'id':_0x1a6f09[_0x0bd2('0xb0')]['id']}})[_0x0bd2('0x26')](handleEntityNotFound(_0x1a42cf,null))[_0x0bd2('0x26')](function(_0x2fee87){if(_0x2fee87){_0x114771[_0x0bd2('0x3b')]=_[_0x0bd2('0x72')](db[_0x0bd2('0xbb')]['rawAttributes']);_0x114771[_0x0bd2('0x38')]=_[_0x0bd2('0x72')](_0x1a6f09[_0x0bd2('0x38')]);_0x114771[_0x0bd2('0x39')]=_[_0x0bd2('0x3a')](_0x114771[_0x0bd2('0x3b')],_0x114771[_0x0bd2('0x38')]);_0x4edf87[_0x0bd2('0x3c')]=_['intersection'](_0x114771[_0x0bd2('0x3b')],qs[_0x0bd2('0x3d')](_0x1a6f09['query'][_0x0bd2('0x3d')]));_0x4edf87[_0x0bd2('0x3c')]=_0x4edf87['attributes'][_0x0bd2('0x3e')]?_0x4edf87[_0x0bd2('0x3c')]:_0x114771[_0x0bd2('0x3b')];if(!_0x1a6f09[_0x0bd2('0x38')][_0x0bd2('0x3f')](_0x0bd2('0x40'))){_0x4edf87[_0x0bd2('0x1f')]=qs[_0x0bd2('0x1f')](_0x1a6f09[_0x0bd2('0x38')]['limit']);_0x4edf87[_0x0bd2('0x1e')]=qs['offset'](_0x1a6f09[_0x0bd2('0x38')][_0x0bd2('0x1e')]);}_0x4edf87['order']=qs[_0x0bd2('0x42')](_0x1a6f09[_0x0bd2('0x38')]['sort']);_0x4edf87[_0x0bd2('0x79')]=qs[_0x0bd2('0x39')](_['pick'](_0x1a6f09['query'],_0x114771[_0x0bd2('0x39')]));_0x4edf87[_0x0bd2('0x79')][_0x0bd2('0xbc')]=_0x2fee87['id'];if(_0x1a6f09[_0x0bd2('0x38')]['filter']){_0x4edf87['where']=_['merge'](_0x4edf87['where'],{'$or':_[_0x0bd2('0x2d')](_0x4edf87[_0x0bd2('0x3c')],function(_0x3b6f77){var _0x4b2f8b={};_0x4b2f8b[_0x3b6f77]={'$like':'%'+_0x1a6f09['query']['filter']+'%'};return _0x4b2f8b;})});}if(_0x1a6f09[_0x0bd2('0x38')][_0x0bd2('0x77')]){var _0x35f756=_0x1a6f09[_0x0bd2('0x38')][_0x0bd2('0x77')]['split'](',');var _0x2c5613={};_0x2c5613[_0x35f756[0x0]]={'$gte':moment(_0x35f756[0x1])[_0x0bd2('0xbd')](_0x0bd2('0xbe'))};_0x4edf87[_0x0bd2('0x79')]=_[_0x0bd2('0xbf')](_0x4edf87[_0x0bd2('0x79')],_0x2c5613);}_0x4edf87=_['merge']({},_0x4edf87,_0x1a6f09['options']);return db['FaxMessage'][_0x0bd2('0x97')]({'where':_0x4edf87['where']})[_0x0bd2('0x26')](function(_0x222154){_0x1c4cf4[_0x0bd2('0x97')]=_0x222154;if(_0x1a6f09[_0x0bd2('0x38')][_0x0bd2('0xb1')]){_0x4edf87[_0x0bd2('0xb2')]=[{'all':!![]}];}return db[_0x0bd2('0xbb')][_0x0bd2('0xc0')](_0x4edf87);})['then'](function(_0x1a2b47){_0x1c4cf4['rows']=_0x1a2b47;return _0x1c4cf4;});}})[_0x0bd2('0x26')](respondWithFilteredResult(_0x1a42cf,_0x4edf87))['catch'](handleError(_0x1a42cf,null));};exports['addTags']=function(_0x1f334c,_0x35a664,_0x52c02a){return db['FaxInteraction']['find']({'where':{'id':_0x1f334c[_0x0bd2('0xb0')]['id']}})[_0x0bd2('0x26')](handleEntityNotFound(_0x35a664,null))[_0x0bd2('0x26')](function(_0x4464a6){if(_0x4464a6){return _0x4464a6[_0x0bd2('0xc1')](_0x1f334c[_0x0bd2('0x71')][_0x0bd2('0xb7')],_[_0x0bd2('0xb8')](_0x1f334c[_0x0bd2('0x71')],[_0x0bd2('0xb7'),'id'])||{})['spread'](function(){return db['Tag'][_0x0bd2('0xc0')]({'attributes':['id',_0x0bd2('0x2b'),_0x0bd2('0x46')],'where':{'id':_0x1f334c[_0x0bd2('0x71')][_0x0bd2('0xb7')]}});})[_0x0bd2('0x26')](function(_0x302976){socket[_0x0bd2('0xc2')](_0x0bd2('0xc3'),{'id':Number(_0x1f334c['params']['id']),'tags':_0x302976||[]});return{'id':Number(_0x1f334c[_0x0bd2('0xb0')]['id']),'tags':_0x302976||[]};});}})[_0x0bd2('0x26')](respondWithResult(_0x35a664,null))[_0x0bd2('0x33')](handleError(_0x35a664,null));};exports[_0x0bd2('0xc4')]=function(_0x46532c,_0x439e6f,_0x1174ee){return db[_0x0bd2('0x99')][_0x0bd2('0x5b')]({'where':{'id':_0x46532c[_0x0bd2('0xb0')]['id']}})[_0x0bd2('0x26')](handleEntityNotFound(_0x439e6f,null))[_0x0bd2('0x26')](function(_0x401cf3){if(_0x401cf3){return _0x401cf3[_0x0bd2('0xc4')](_0x46532c[_0x0bd2('0x38')][_0x0bd2('0xb7')]);}})[_0x0bd2('0x26')](respondWithStatusCode(_0x439e6f,null))['catch'](handleError(_0x439e6f,null));};exports[_0x0bd2('0xc5')]=function(_0x443b51,_0x23e8b0){var _0x2046bd=moment()[_0x0bd2('0xc6')]()[_0x0bd2('0x96')]();var _0x179af2=path[_0x0bd2('0xc7')](config['root'],'server','files',_0x0bd2('0xc8'));var _0x13ee3f=path[_0x0bd2('0xc7')](config['root'],_0x0bd2('0xc9'),_0x0bd2('0xca'),_0x0bd2('0xcb'));var _0x31a6f7=path[_0x0bd2('0xc7')](_0x179af2,_0x2046bd);var _0x4b743f=util['format'](_0x0bd2('0xcc'),_0x443b51[_0x0bd2('0xb0')]['id'],_0x2046bd);var _0x163821=path[_0x0bd2('0xc7')](_0x179af2,_0x4b743f);var _0x580256=[];_0x580256[_0x0bd2('0x32')]({'model':db[_0x0bd2('0xcd')],'as':_0x0bd2('0xcd'),'raw':!![]});var _0x186206=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id',_0x0bd2('0x71'),'createdAt'],'include':_0x580256}];return db[_0x0bd2('0x99')][_0x0bd2('0x5b')]({'where':{'id':_0x443b51['params']['id']},'include':_0x186206})[_0x0bd2('0x26')](handleEntityNotFound(_0x23e8b0,null))['then'](function(_0x3898ce){if(_0x3898ce&&_0x3898ce[_0x0bd2('0xce')]){var _0x236340=_0x3898ce[_0x0bd2('0xcf')]({'plain':!![]});fs[_0x0bd2('0xd0')](_0x31a6f7);for(var _0x47965f=0x0;_0x47965f<_0x236340[_0x0bd2('0xce')]['length'];_0x47965f++){var _0x3fc3c8=_0x236340[_0x0bd2('0xce')][_0x47965f][_0x0bd2('0xcd')];if(_0x3fc3c8){var _0x565a47=path[_0x0bd2('0xc7')](_0x13ee3f,_0x3fc3c8[_0x0bd2('0xd1')]);if(fs[_0x0bd2('0xd2')](_0x565a47)){fs[_0x0bd2('0xd3')](_0x565a47)[_0x0bd2('0xd4')](fs[_0x0bd2('0xd5')](path[_0x0bd2('0xc7')](_0x31a6f7,_0x3fc3c8[_0x0bd2('0xd1')])));}}}return BPromise[_0x0bd2('0x8e')]()['then'](function(){return new BPromise(function(_0x4b4ef7,_0x368356){zipdir(_0x31a6f7,{'saveTo':_0x163821},function(_0x4b81e8,_0x2a85af){if(_0x4b81e8)return _0x368356(_0x4b81e8);return _0x4b4ef7(_0x2a85af);});})[_0x0bd2('0x26')](function(){return new BPromise(function(_0x550211,_0x5d29c9){rimraf(_0x31a6f7,function(_0x5daafa){if(_0x5daafa)_0x5d29c9(_0x5daafa);return _0x550211();});});})[_0x0bd2('0x26')](function(){return _0x23e8b0['download'](_0x163821,_0x4b743f,function(_0x1aba49){if(_0x1aba49){console['log']('err',_0x1aba49);}else{fs[_0x0bd2('0xd6')](_0x163821);}});});});}else{return _0x23e8b0[_0x0bd2('0x1b')](0xc8);}})[_0x0bd2('0x33')](handleError(_0x23e8b0,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 010535c..0672666 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['setDataValue','map','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0x194f9a,_0x4378c4){var _0x5702e1=function(_0x1472ed){while(--_0x1472ed){_0x194f9a['push'](_0x194f9a['shift']());}};_0x5702e1(++_0x4378c4);}(_0x7a54,0x106));var _0x47a5=function(_0x348058,_0x87f573){_0x348058=_0x348058-0x0;var _0x23e141=_0x7a54[_0x348058];return _0x23e141;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var FaxInteraction=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x47a5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x47a5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47a5('0x5'),'afterDestroy':_0x47a5('0x6')};function emitEvent(_0x2a1a7e){return function(_0x3717e1,_0xfdf934,_0x545a97){_0x3717e1[_0x47a5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x343372){_0x3717e1[_0x47a5('0x8')]('Users',_0x343372[_0x47a5('0x9')](function(_0x5077f3){return{'id':_0x5077f3['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3717e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a0e98){_0x3717e1[_0x47a5('0x8')]('unreadMessages',_0x2a0e98[_0x47a5('0xa')]);FaxInteractionEvents['emit'](_0x2a1a7e+':'+_0x3717e1['id'],_0x3717e1);FaxInteractionEvents['emit'](_0x2a1a7e,_0x3717e1);_0x545a97(null);})[_0x47a5('0xb')](_0x545a97(null));};}for(var e in events){if(events[_0x47a5('0xc')](e)){var event=events[e];FaxInteraction[_0x47a5('0xd')](e,emitEvent(event));}}module[_0x47a5('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x2563f5,_0xe731c9){var _0x83a44f=function(_0x5d4ec8){while(--_0x5d4ec8){_0x2563f5['push'](_0x2563f5['shift']());}};_0x83a44f(++_0xe731c9);}(_0x1261,0x144));var _0x1126=function(_0xe95af,_0x4b849b){_0xe95af=_0xe95af-0x0;var _0x16effb=_0x1261[_0xe95af];return _0x16effb;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index f70ce5d..0452609 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 _0xb4e6=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports','define','changed'];(function(_0x280141,_0x220806){var _0x38fd1e=function(_0x182c8c){while(--_0x182c8c){_0x280141['push'](_0x280141['shift']());}};_0x38fd1e(++_0x220806);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0xb4e6[_0x37cc52];return _0x2b4a90;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2311d9,_0x48c870,_0x53a71f){if(_0x2311d9[_0x6b4e('0xb')](_0x6b4e('0xc'))){_0x2311d9[_0x6b4e('0xd')]=moment()[_0x6b4e('0xe')](_0x6b4e('0xf'));}_0x53a71f(null,_0x2311d9);}}});}; \ No newline at end of file +var _0xe706=['../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x42ad8b,_0x50b99c){var _0x1ef86a=function(_0x3a682d){while(--_0x3a682d){_0x42ad8b['push'](_0x42ad8b['shift']());}};_0x1ef86a(++_0x50b99c);}(_0xe706,0xa3));var _0x6e70=function(_0x54b4a8,_0x3abef0){_0x54b4a8=_0x54b4a8-0x0;var _0x4c7a5f=_0xe706[_0x54b4a8];return _0x4c7a5f;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x188ed3,_0x3c4843,_0x449b48){if(_0x188ed3[_0x6e70('0xe')](_0x6e70('0xf'))){_0x188ed3[_0x6e70('0x10')]=moment()[_0x6e70('0x11')](_0x6e70('0x12'));}_0x449b48(null,_0x188ed3);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 230ff68..d04d308 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 _0xa5e9=['request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxInteraction','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction','catch','find','addTags','ids','omit','spread','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa5e9,0xec));var _0x9a5e=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0xa5e9[_0x245afe];return _0x4eefde;};'use strict';var _=require(_0x9a5e('0x0'));var util=require(_0x9a5e('0x1'));var moment=require(_0x9a5e('0x2'));var BPromise=require('bluebird');var rs=require(_0x9a5e('0x3'));var fs=require('fs');var Redis=require(_0x9a5e('0x4'));var db=require(_0x9a5e('0x5'))['db'];var utils=require(_0x9a5e('0x6'));var logger=require(_0x9a5e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9a5e('0x8'));var client=jayson[_0x9a5e('0x9')][_0x9a5e('0xa')]({'port':0x232a});config[_0x9a5e('0xb')]=_['defaults'](config['redis'],{'host':_0x9a5e('0xc'),'port':0x18eb});var socket=require(_0x9a5e('0xd'))(new Redis(config['redis']));require(_0x9a5e('0xe'))[_0x9a5e('0xf')](socket);function respondWithRpcPromise(_0x36ce72,_0x42d1be,_0x36788b){return new BPromise(function(_0x165a68,_0x3fab30){return client[_0x9a5e('0x10')](_0x36ce72,_0x36788b)[_0x9a5e('0x11')](function(_0x325f25){logger[_0x9a5e('0x12')](_0x9a5e('0x13'),_0x42d1be,_0x9a5e('0x14'));logger[_0x9a5e('0x15')](_0x9a5e('0x16'),_0x42d1be,_0x9a5e('0x14'),JSON[_0x9a5e('0x17')](_0x325f25));if(_0x325f25[_0x9a5e('0x18')]){if(_0x325f25[_0x9a5e('0x18')][_0x9a5e('0x19')]===0x1f4){logger[_0x9a5e('0x18')](_0x9a5e('0x13'),_0x42d1be,_0x325f25[_0x9a5e('0x18')]['message']);return _0x3fab30(_0x325f25[_0x9a5e('0x18')][_0x9a5e('0x1a')]);}logger[_0x9a5e('0x18')](_0x9a5e('0x13'),_0x42d1be,_0x325f25[_0x9a5e('0x18')][_0x9a5e('0x1a')]);return _0x165a68(_0x325f25[_0x9a5e('0x18')][_0x9a5e('0x1a')]);}else{logger[_0x9a5e('0x12')](_0x9a5e('0x13'),_0x42d1be,_0x9a5e('0x14'));_0x165a68(_0x325f25['result'][_0x9a5e('0x1a')]);}})['catch'](function(_0x237fa7){logger[_0x9a5e('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x42d1be,_0x237fa7);_0x3fab30(_0x237fa7);});});}exports['UpdateFaxInteraction']=function(_0x592eef){var _0x3e9e94=this;return new Promise(function(_0x4f0856,_0x2a2464){return db[_0x9a5e('0x1b')][_0x9a5e('0x1c')](_0x592eef[_0x9a5e('0x1d')],{'raw':_0x592eef[_0x9a5e('0x1e')]?_0x592eef['options'][_0x9a5e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x592eef[_0x9a5e('0x1e')]?_0x592eef[_0x9a5e('0x1e')][_0x9a5e('0x20')]||null:null,'attributes':_0x592eef[_0x9a5e('0x1e')]?_0x592eef['options'][_0x9a5e('0x21')]||null:null,'limit':_0x592eef[_0x9a5e('0x1e')]?_0x592eef[_0x9a5e('0x1e')][_0x9a5e('0x22')]||null:null})[_0x9a5e('0x11')](function(_0x1141b9){logger[_0x9a5e('0x12')](_0x9a5e('0x23'),_0x592eef);logger[_0x9a5e('0x15')](_0x9a5e('0x23'),_0x592eef,JSON[_0x9a5e('0x17')](_0x1141b9));_0x4f0856(_0x1141b9);})[_0x9a5e('0x24')](function(_0x343389){logger['error'](_0x9a5e('0x23'),_0x343389[_0x9a5e('0x1a')],_0x592eef);_0x2a2464(_0x3e9e94[_0x9a5e('0x18')](0x1f4,_0x343389[_0x9a5e('0x1a')]));});});};exports['AddTagsToFaxInteraction']=function(_0x2bf9a2){return new Promise(function(_0x22b69f,_0x29dd6b){return db['FaxInteraction'][_0x9a5e('0x25')]({'where':_0x2bf9a2['options']?_0x2bf9a2['options']['where']||null:null})[_0x9a5e('0x11')](function(_0x199741){if(_0x199741){return _0x199741[_0x9a5e('0x26')](_0x2bf9a2['body'][_0x9a5e('0x27')],_[_0x9a5e('0x28')](_0x2bf9a2['body'],[_0x9a5e('0x27'),'id'])||{});}})[_0x9a5e('0x29')](function(_0x472059){logger[_0x9a5e('0x12')]('AddTags',_0x2bf9a2);logger['debug']('AddTags',_0x2bf9a2,JSON[_0x9a5e('0x17')](_0x472059));_0x22b69f(_0x472059);})[_0x9a5e('0x24')](function(_0x18dd1a){logger['error']('AddTags',_0x18dd1a[_0x9a5e('0x1a')],_0x2bf9a2);_0x29dd6b(_this['error'](0x1f4,_0x18dd1a[_0x9a5e('0x1a')]));});});}; \ No newline at end of file +var _0x5dba=['error','code','message','result','update','options','raw','where','limit','info','UpdateFaxInteraction','catch','AddTagsToFaxInteraction','FaxInteraction','find','addTags','body','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x5dba,0x110));var _0xa5db=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0x5dba[_0x51bda1];return _0x1ce08c;};'use strict';var _=require(_0xa5db('0x0'));var util=require('util');var moment=require(_0xa5db('0x1'));var BPromise=require(_0xa5db('0x2'));var rs=require(_0xa5db('0x3'));var fs=require('fs');var Redis=require(_0xa5db('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa5db('0x5'))('rpc');var config=require(_0xa5db('0x6'));var jayson=require(_0xa5db('0x7'));var client=jayson[_0xa5db('0x8')][_0xa5db('0x9')]({'port':0x232a});config[_0xa5db('0xa')]=_[_0xa5db('0xb')](config['redis'],{'host':_0xa5db('0xc'),'port':0x18eb});var socket=require(_0xa5db('0xd'))(new Redis(config[_0xa5db('0xa')]));require(_0xa5db('0xe'))['register'](socket);function respondWithRpcPromise(_0x1b9b95,_0x405301,_0x65fa6b){return new BPromise(function(_0x7681c,_0xa94b20){return client[_0xa5db('0xf')](_0x1b9b95,_0x65fa6b)[_0xa5db('0x10')](function(_0x41e14a){logger['info'](_0xa5db('0x11'),_0x405301,'request\x20sent');logger[_0xa5db('0x12')](_0xa5db('0x13'),_0x405301,_0xa5db('0x14'),JSON[_0xa5db('0x15')](_0x41e14a));if(_0x41e14a[_0xa5db('0x16')]){if(_0x41e14a[_0xa5db('0x16')][_0xa5db('0x17')]===0x1f4){logger['error'](_0xa5db('0x11'),_0x405301,_0x41e14a['error']['message']);return _0xa94b20(_0x41e14a['error'][_0xa5db('0x18')]);}logger['error'](_0xa5db('0x11'),_0x405301,_0x41e14a[_0xa5db('0x16')]['message']);return _0x7681c(_0x41e14a[_0xa5db('0x16')][_0xa5db('0x18')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x405301,_0xa5db('0x14'));_0x7681c(_0x41e14a[_0xa5db('0x19')][_0xa5db('0x18')]);}})['catch'](function(_0x534db6){logger[_0xa5db('0x16')](_0xa5db('0x11'),_0x405301,_0x534db6);_0xa94b20(_0x534db6);});});}exports['UpdateFaxInteraction']=function(_0x1945c2){var _0x522e78=this;return new Promise(function(_0x15c22d,_0x321187){return db['FaxInteraction'][_0xa5db('0x1a')](_0x1945c2['body'],{'raw':_0x1945c2[_0xa5db('0x1b')]?_0x1945c2[_0xa5db('0x1b')][_0xa5db('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1945c2[_0xa5db('0x1b')]?_0x1945c2[_0xa5db('0x1b')][_0xa5db('0x1d')]||null:null,'attributes':_0x1945c2[_0xa5db('0x1b')]?_0x1945c2[_0xa5db('0x1b')]['attributes']||null:null,'limit':_0x1945c2[_0xa5db('0x1b')]?_0x1945c2['options'][_0xa5db('0x1e')]||null:null})[_0xa5db('0x10')](function(_0x330b04){logger[_0xa5db('0x1f')](_0xa5db('0x20'),_0x1945c2);logger['debug'](_0xa5db('0x20'),_0x1945c2,JSON['stringify'](_0x330b04));_0x15c22d(_0x330b04);})[_0xa5db('0x21')](function(_0x2f8532){logger['error'](_0xa5db('0x20'),_0x2f8532[_0xa5db('0x18')],_0x1945c2);_0x321187(_0x522e78[_0xa5db('0x16')](0x1f4,_0x2f8532[_0xa5db('0x18')]));});});};exports[_0xa5db('0x22')]=function(_0x11f173){return new Promise(function(_0x2f297a,_0x1c9fe3){return db[_0xa5db('0x23')][_0xa5db('0x24')]({'where':_0x11f173[_0xa5db('0x1b')]?_0x11f173['options'][_0xa5db('0x1d')]||null:null})[_0xa5db('0x10')](function(_0x37b0b2){if(_0x37b0b2){return _0x37b0b2[_0xa5db('0x25')](_0x11f173[_0xa5db('0x26')][_0xa5db('0x27')],_[_0xa5db('0x28')](_0x11f173['body'],['ids','id'])||{});}})['spread'](function(_0x7c6df){logger['info'](_0xa5db('0x29'),_0x11f173);logger[_0xa5db('0x12')](_0xa5db('0x29'),_0x11f173,JSON[_0xa5db('0x15')](_0x7c6df));_0x2f297a(_0x7c6df);})['catch'](function(_0x16f2b5){logger[_0xa5db('0x16')](_0xa5db('0x29'),_0x16f2b5['message'],_0x11f173);_0x1c9fe3(_this['error'](0x1f4,_0x16f2b5[_0xa5db('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index bcf4804..742bf69 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 _0x1745=['removeListener','register','length','faxInteraction:','save','remove','update'];(function(_0x33f7e1,_0x48d209){var _0x23bab4=function(_0xd532b0){while(--_0xd532b0){_0x33f7e1['push'](_0x33f7e1['shift']());}};_0x23bab4(++_0x48d209);}(_0x1745,0x177));var _0x5174=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1745[_0x4cf98e];return _0x1623ac;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x5174('0x0'),_0x5174('0x1'),_0x5174('0x2')];function createListener(_0x216859,_0x448f4f){return function(_0xb0fe72){_0x448f4f['emit'](_0x216859,_0xb0fe72);};}function removeListener(_0x20dd63,_0x12d2c8){return function(){FaxInteractionEvents[_0x5174('0x3')](_0x20dd63,_0x12d2c8);};}exports[_0x5174('0x4')]=function(_0x11aea7){for(var _0x326111=0x0,_0x3d34d0=events[_0x5174('0x5')];_0x326111<_0x3d34d0;_0x326111++){var _0x29827e=events[_0x326111];var _0x270891=createListener(_0x5174('0x6')+_0x29827e,_0x11aea7);FaxInteractionEvents['on'](_0x29827e,_0x270891);}}; \ No newline at end of file +var _0x0c87=['removeListener','register','length','save','remove','update','emit'];(function(_0x4b7ef2,_0x17854d){var _0xf61f45=function(_0x114e5c){while(--_0x114e5c){_0x4b7ef2['push'](_0x4b7ef2['shift']());}};_0xf61f45(++_0x17854d);}(_0x0c87,0x10d));var _0x70c8=function(_0x431988,_0x290e33){_0x431988=_0x431988-0x0;var _0x113194=_0x0c87[_0x431988];return _0x113194;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x70c8('0x0'),_0x70c8('0x1'),_0x70c8('0x2')];function createListener(_0x3470fb,_0x51cb78){return function(_0x2ce6fb){_0x51cb78[_0x70c8('0x3')](_0x3470fb,_0x2ce6fb);};}function removeListener(_0x1aa15d,_0x152108){return function(){FaxInteractionEvents[_0x70c8('0x4')](_0x1aa15d,_0x152108);};}exports[_0x70c8('0x5')]=function(_0x2f0bf6){for(var _0x250d5b=0x0,_0x1ea93f=events[_0x70c8('0x6')];_0x250d5b<_0x1ea93f;_0x250d5b++){var _0x3083e8=events[_0x250d5b];var _0x564e61=createListener('faxInteraction:'+_0x3083e8,_0x2f0bf6);FaxInteractionEvents['on'](_0x3083e8,_0x564e61);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 3471b81..7e59f65 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 _0x7264=['/:id/tags','tracked','fax','put','update','faxinteraction:destroy','delete','removeTags','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','/:id','isAuthenticated','show','getMessages','/:id/download','download','create','post','addMessage'];(function(_0x479011,_0x3f5155){var _0x4f3c39=function(_0x4e250c){while(--_0x4e250c){_0x479011['push'](_0x479011['shift']());}};_0x4f3c39(++_0x3f5155);}(_0x7264,0xf0));var _0x4726=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7264[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x4726('0x0'));var util=require('util');var path=require(_0x4726('0x1'));var timeout=require(_0x4726('0x2'));var express=require(_0x4726('0x3'));var router=express[_0x4726('0x4')]();var auth=require(_0x4726('0x5'));var interaction=require(_0x4726('0x6'));var config=require(_0x4726('0x7'));var controller=require(_0x4726('0x8'));router[_0x4726('0x9')]('/',auth['isAuthenticated'](),controller[_0x4726('0xa')]);router[_0x4726('0x9')](_0x4726('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x4726('0x9')](_0x4726('0xc'),auth[_0x4726('0xd')](),controller[_0x4726('0xe')]);router[_0x4726('0x9')]('/:id/messages',auth[_0x4726('0xd')](),controller[_0x4726('0xf')]);router[_0x4726('0x9')](_0x4726('0x10'),auth[_0x4726('0xd')](),controller[_0x4726('0x11')]);router['post']('/',auth[_0x4726('0xd')](),controller[_0x4726('0x12')]);router[_0x4726('0x13')]('/:id/messages',auth[_0x4726('0xd')](),controller[_0x4726('0x14')]);router[_0x4726('0x13')](_0x4726('0x15'),auth[_0x4726('0xd')](),interaction[_0x4726('0x16')](_0x4726('0x17'),'faxinteraction:addtags'),controller['addTags']);router[_0x4726('0x18')]('/:id',auth['isAuthenticated'](),interaction[_0x4726('0x16')](_0x4726('0x17'),'faxinteraction:update'),controller[_0x4726('0x19')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x4726('0x16')]('fax',_0x4726('0x1a')),controller['destroy']);router[_0x4726('0x1b')](_0x4726('0x15'),auth[_0x4726('0xd')](),controller[_0x4726('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x9362=['post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','removeTags','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','index','get','/describe','/:id','/:id/messages','getMessages','/:id/download','download'];(function(_0xe5d5e5,_0x53e13a){var _0x26d457=function(_0x105fd8){while(--_0x105fd8){_0xe5d5e5['push'](_0xe5d5e5['shift']());}};_0x26d457(++_0x53e13a);}(_0x9362,0x169));var _0x2936=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9362[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x2936('0x0'));var util=require('util');var path=require(_0x2936('0x1'));var timeout=require('connect-timeout');var express=require(_0x2936('0x2'));var router=express[_0x2936('0x3')]();var auth=require(_0x2936('0x4'));var interaction=require(_0x2936('0x5'));var config=require('../../config/environment');var controller=require(_0x2936('0x6'));router['get']('/',auth[_0x2936('0x7')](),controller[_0x2936('0x8')]);router[_0x2936('0x9')](_0x2936('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x2936('0x9')](_0x2936('0xb'),auth[_0x2936('0x7')](),controller['show']);router[_0x2936('0x9')](_0x2936('0xc'),auth[_0x2936('0x7')](),controller[_0x2936('0xd')]);router['get'](_0x2936('0xe'),auth[_0x2936('0x7')](),controller[_0x2936('0xf')]);router[_0x2936('0x10')]('/',auth[_0x2936('0x7')](),controller[_0x2936('0x11')]);router[_0x2936('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0x2936('0x12')]);router[_0x2936('0x10')](_0x2936('0x13'),auth['isAuthenticated'](),interaction[_0x2936('0x14')](_0x2936('0x15'),_0x2936('0x16')),controller[_0x2936('0x17')]);router[_0x2936('0x18')](_0x2936('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x2936('0x15'),_0x2936('0x19')),controller[_0x2936('0x1a')]);router[_0x2936('0x1b')](_0x2936('0xb'),auth['isAuthenticated'](),interaction[_0x2936('0x14')]('fax','faxinteraction:destroy'),controller['destroy']);router[_0x2936('0x1b')](_0x2936('0x13'),auth[_0x2936('0x7')](),controller[_0x2936('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index ce8f98c..e9716a1 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 _0x9458=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x9458,0x188));var _0x8945=function(_0x1f0cfe,_0x33fa8e){_0x1f0cfe=_0x1f0cfe-0x0;var _0x4e6421=_0x9458[_0x1f0cfe];return _0x4e6421;};'use strict';var Sequelize=require('sequelize');module[_0x8945('0x0')]={'body':{'type':Sequelize[_0x8945('0x1')](_0x8945('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8945('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8945('0x4')]('in','out'),'defaultValue':_0x8945('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x8945('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x8945('0x6')]}}; \ No newline at end of file +var _0x5c5a=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0xccdffb,_0x17b96f){var _0x3b3bca=function(_0x2c9198){while(--_0x2c9198){_0xccdffb['push'](_0xccdffb['shift']());}};_0x3b3bca(++_0x17b96f);}(_0x5c5a,0x12f));var _0xa5c5=function(_0x40ae98,_0xd089a){_0x40ae98=_0x40ae98-0x0;var _0x507f6c=_0x5c5a[_0x40ae98];return _0x507f6c;};'use strict';var Sequelize=require(_0xa5c5('0x0'));module[_0xa5c5('0x1')]={'body':{'type':Sequelize[_0xa5c5('0x2')](_0xa5c5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa5c5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa5c5('0x5')]('in',_0xa5c5('0x6')),'defaultValue':_0xa5c5('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xa5c5('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xa5c5('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index b04cd7f..a032664 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 _0x6f98=['describe','fax-interactions','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','agent','FaxInteraction','role','RejectMessage','rejectMessage','SIP/%s','rejectmessage','create','ContactId','findOne','AttachmentId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','files','attachments','Attachment','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','ValidationError','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','name','options','includeAll','include','findAll','rows','params','length','body','find'];(function(_0xf5aede,_0x5b2e7f){var _0x5c6890=function(_0x12db0f){while(--_0x12db0f){_0xf5aede['push'](_0xf5aede['shift']());}};_0x5c6890(++_0x5b2e7f);}(_0x6f98,0x1ca));var _0x86f9=function(_0x13f908,_0x30eab0){_0x13f908=_0x13f908-0x0;var _0x14b5f2=_0x6f98[_0x13f908];return _0x14b5f2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x86f9('0x0'));var rimraf=require(_0x86f9('0x1'));var zipdir=require(_0x86f9('0x2'));var jsonpatch=require(_0x86f9('0x3'));var rp=require('request-promise');var moment=require(_0x86f9('0x4'));var BPromise=require(_0x86f9('0x5'));var Mustache=require(_0x86f9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x86f9('0x7'));var csv=require(_0x86f9('0x8'));var ejs=require(_0x86f9('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x86f9('0xa'));var crypto=require(_0x86f9('0xb'));var jsforce=require(_0x86f9('0xc'));var deskjs=require(_0x86f9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x86f9('0xe'));var Papa=require(_0x86f9('0xf'));var Redis=require(_0x86f9('0x10'));var authService=require(_0x86f9('0x11'));var qs=require(_0x86f9('0x12'));var as=require(_0x86f9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x86f9('0x14'))(_0x86f9('0x15'));var utils=require(_0x86f9('0x16'));var config=require(_0x86f9('0x17'));var db=require('../../mysqldb')['db'];config[_0x86f9('0x18')]=_[_0x86f9('0x19')](config['redis'],{'host':_0x86f9('0x1a'),'port':0x18eb});var socket=require(_0x86f9('0x1b'))(new Redis(config[_0x86f9('0x18')]));require(_0x86f9('0x1c'))[_0x86f9('0x1d')](socket);var jayson=require(_0x86f9('0x1e'));var client=jayson[_0x86f9('0x1f')][_0x86f9('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x86f9('0x20')]({'port':0x232a});function checkPasswordPattern(_0x29815e,_0x40f99e,_0x4b5068){if(_0x4b5068){var _0x439361=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x439361['test'](_0x40f99e)){return _0x29815e;}else{throw new db['Sequelize'][(_0x86f9('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 _0x29815e;}}function respondWithRpcPromise(_0x14beaf,_0x385ea5,_0x3051bd,_0x59a759){return new BPromise(function(_0x18459a,_0x4cd2aa){var _0x5a1ddb=_0x59a759||client;return _0x5a1ddb['request'](_0x14beaf,_0x3051bd)[_0x86f9('0x22')](function(_0x34e404){logger[_0x86f9('0x23')]('FaxMessage,\x20%s,\x20%s',_0x385ea5,_0x86f9('0x24'));logger[_0x86f9('0x25')](_0x86f9('0x26'),_0x385ea5,_0x86f9('0x24'),JSON[_0x86f9('0x27')](_0x34e404));if(_0x34e404[_0x86f9('0x28')]){if(_0x34e404[_0x86f9('0x28')][_0x86f9('0x29')]===0x1f4){logger[_0x86f9('0x28')](_0x86f9('0x2a'),_0x385ea5,_0x34e404[_0x86f9('0x28')][_0x86f9('0x2b')]);return _0x4cd2aa(_0x34e404[_0x86f9('0x28')][_0x86f9('0x2b')]);}logger[_0x86f9('0x28')](_0x86f9('0x2a'),_0x385ea5,_0x34e404[_0x86f9('0x28')][_0x86f9('0x2b')]);return _0x18459a(_0x34e404[_0x86f9('0x28')][_0x86f9('0x2b')]);}else{logger[_0x86f9('0x23')](_0x86f9('0x2a'),_0x385ea5,_0x86f9('0x24'));_0x18459a(_0x34e404[_0x86f9('0x2c')]['message']);}})[_0x86f9('0x2d')](function(_0x435fe8){logger['error'](_0x86f9('0x2a'),_0x385ea5,_0x435fe8);_0x4cd2aa(_0x435fe8);});});}function respondWithStatusCode(_0x57f019,_0x4db919){_0x4db919=_0x4db919||0xcc;return function(_0xfe9a60){if(_0xfe9a60){return _0x57f019[_0x86f9('0x2e')](_0x4db919);}return _0x57f019['status'](_0x4db919)[_0x86f9('0x2f')]();};}function respondWithResult(_0x160da5,_0x23bd2a){_0x23bd2a=_0x23bd2a||0xc8;return function(_0x3c9584){if(_0x3c9584){return _0x160da5[_0x86f9('0x30')](_0x23bd2a)[_0x86f9('0x31')](_0x3c9584);}};}function respondWithFilteredResult(_0xaf74c5,_0x53f577){return function(_0xb9c7e5){if(_0xb9c7e5){var _0xc69ac=_0xb9c7e5[_0x86f9('0x32')],_0x1ff830=_0x53f577[_0x86f9('0x33')],_0x7731d3=_0x53f577[_0x86f9('0x33')]+_0x53f577[_0x86f9('0x34')],_0x52cfcc;if(_0x7731d3>=_0xc69ac){_0x7731d3=_0xc69ac;_0x52cfcc=0xc8;}else{_0x52cfcc=0xce;}_0xaf74c5[_0x86f9('0x30')](_0x52cfcc);return _0xaf74c5[_0x86f9('0x35')](_0x86f9('0x36'),_0x1ff830+'-'+_0x7731d3+'/'+_0xc69ac)[_0x86f9('0x31')](_0xb9c7e5);}return null;};}function patchUpdates(_0x397dbb){return function(_0x326529){try{jsonpatch[_0x86f9('0x37')](_0x326529,_0x397dbb,!![]);}catch(_0x12ca11){return BPromise[_0x86f9('0x38')](_0x12ca11);}return _0x326529[_0x86f9('0x39')]();};}function saveUpdates(_0x14e60f,_0x1a00e4){return function(_0x515fa2){if(_0x515fa2){return _0x515fa2[_0x86f9('0x3a')](_0x14e60f)[_0x86f9('0x22')](function(_0x2b6a09){return _0x2b6a09;});}return null;};}function removeEntity(_0x384dcf,_0x2dbf8a){return function(_0x3a1cfc){if(_0x3a1cfc){return _0x3a1cfc[_0x86f9('0x3b')]()['then'](function(){_0x384dcf[_0x86f9('0x30')](0xcc)[_0x86f9('0x2f')]();});}};}function handleEntityNotFound(_0x4dc2f8,_0x3a0944){return function(_0x5e16d8){if(!_0x5e16d8){_0x4dc2f8[_0x86f9('0x2e')](0x194);}return _0x5e16d8;};}function handleError(_0x1a5c34,_0x2c3710){_0x2c3710=_0x2c3710||0x1f4;return function(_0x2ceef0){logger[_0x86f9('0x28')](_0x2ceef0[_0x86f9('0x3c')]);if(_0x2ceef0['name']){delete _0x2ceef0['name'];}_0x1a5c34[_0x86f9('0x30')](_0x2c3710)[_0x86f9('0x3d')](_0x2ceef0);};}exports[_0x86f9('0x3e')]=function(_0x1cff58,_0x1e1315){var _0x4ec633={},_0x1a5493={},_0x55d7ff={'count':0x0,'rows':[]};var _0x2c1472=_[_0x86f9('0x3f')](db[_0x86f9('0x40')][_0x86f9('0x41')],function(_0x1e57c6){return{'name':_0x1e57c6[_0x86f9('0x42')],'type':_0x1e57c6[_0x86f9('0x43')][_0x86f9('0x44')]};});_0x1a5493['model']=_[_0x86f9('0x3f')](_0x2c1472,'name');_0x1a5493[_0x86f9('0x45')]=_[_0x86f9('0x46')](_0x1cff58[_0x86f9('0x45')]);_0x1a5493['filters']=_[_0x86f9('0x47')](_0x1a5493[_0x86f9('0x48')],_0x1a5493[_0x86f9('0x45')]);_0x4ec633['attributes']=_[_0x86f9('0x47')](_0x1a5493['model'],qs[_0x86f9('0x49')](_0x1cff58[_0x86f9('0x45')][_0x86f9('0x49')]));_0x4ec633['attributes']=_0x4ec633[_0x86f9('0x4a')]['length']?_0x4ec633[_0x86f9('0x4a')]:_0x1a5493[_0x86f9('0x48')];if(!_0x1cff58['query'][_0x86f9('0x4b')](_0x86f9('0x4c'))){_0x4ec633[_0x86f9('0x34')]=qs[_0x86f9('0x34')](_0x1cff58['query'][_0x86f9('0x34')]);_0x4ec633[_0x86f9('0x33')]=qs[_0x86f9('0x33')](_0x1cff58[_0x86f9('0x45')][_0x86f9('0x33')]);}_0x4ec633[_0x86f9('0x4d')]=qs['sort'](_0x1cff58['query'][_0x86f9('0x4e')]);_0x4ec633['where']=qs[_0x86f9('0x4f')](_[_0x86f9('0x50')](_0x1cff58[_0x86f9('0x45')],_0x1a5493[_0x86f9('0x4f')]),_0x2c1472);if(_0x1cff58[_0x86f9('0x45')][_0x86f9('0x51')]){_0x4ec633['where']=_[_0x86f9('0x52')](_0x4ec633[_0x86f9('0x53')],{'$or':_['map'](_0x2c1472,function(_0x911c20){if(_0x911c20['type']!=='VIRTUAL'){var _0x59aafa={};_0x59aafa[_0x911c20[_0x86f9('0x54')]]={'$like':'%'+_0x1cff58[_0x86f9('0x45')][_0x86f9('0x51')]+'%'};return _0x59aafa;}})});}_0x4ec633=_['merge']({},_0x4ec633,_0x1cff58[_0x86f9('0x55')]);var _0x18abce={'where':_0x4ec633[_0x86f9('0x53')]};return db['FaxMessage']['count'](_0x18abce)['then'](function(_0x20a7ab){_0x55d7ff[_0x86f9('0x32')]=_0x20a7ab;if(_0x1cff58[_0x86f9('0x45')][_0x86f9('0x56')]){_0x4ec633[_0x86f9('0x57')]=[{'all':!![]}];}return db['FaxMessage'][_0x86f9('0x58')](_0x4ec633);})[_0x86f9('0x22')](function(_0x4d4f84){_0x55d7ff[_0x86f9('0x59')]=_0x4d4f84;return _0x55d7ff;})['then'](respondWithFilteredResult(_0x1e1315,_0x4ec633))[_0x86f9('0x2d')](handleError(_0x1e1315,null));};exports['show']=function(_0x1695cc,_0x388ceb){var _0x528b63={'raw':!![],'where':{'id':_0x1695cc[_0x86f9('0x5a')]['id']}},_0x15112f={};_0x15112f[_0x86f9('0x48')]=_[_0x86f9('0x46')](db[_0x86f9('0x40')][_0x86f9('0x41')]);_0x15112f[_0x86f9('0x45')]=_[_0x86f9('0x46')](_0x1695cc[_0x86f9('0x45')]);_0x15112f[_0x86f9('0x4f')]=_[_0x86f9('0x47')](_0x15112f[_0x86f9('0x48')],_0x15112f[_0x86f9('0x45')]);_0x528b63[_0x86f9('0x4a')]=_[_0x86f9('0x47')](_0x15112f[_0x86f9('0x48')],qs[_0x86f9('0x49')](_0x1695cc[_0x86f9('0x45')][_0x86f9('0x49')]));_0x528b63['attributes']=_0x528b63['attributes'][_0x86f9('0x5b')]?_0x528b63['attributes']:_0x15112f['model'];if(_0x1695cc[_0x86f9('0x45')]['includeAll']){_0x528b63[_0x86f9('0x57')]=[{'all':!![]}];}_0x528b63=_[_0x86f9('0x52')]({},_0x528b63,_0x1695cc[_0x86f9('0x55')]);return db[_0x86f9('0x40')]['find'](_0x528b63)[_0x86f9('0x22')](handleEntityNotFound(_0x388ceb,null))[_0x86f9('0x22')](respondWithResult(_0x388ceb,null))[_0x86f9('0x2d')](handleError(_0x388ceb,null));};exports['update']=function(_0x3d0db8,_0x136c2e){if(_0x3d0db8[_0x86f9('0x5c')]['id']){delete _0x3d0db8[_0x86f9('0x5c')]['id'];}return db['FaxMessage'][_0x86f9('0x5d')]({'where':{'id':_0x3d0db8[_0x86f9('0x5a')]['id']}})[_0x86f9('0x22')](handleEntityNotFound(_0x136c2e,null))[_0x86f9('0x22')](saveUpdates(_0x3d0db8['body'],null))[_0x86f9('0x22')](respondWithResult(_0x136c2e,null))['catch'](handleError(_0x136c2e,null));};exports['destroy']=function(_0x6a7f69,_0x1b173f){return db[_0x86f9('0x40')][_0x86f9('0x5d')]({'where':{'id':_0x6a7f69[_0x86f9('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1b173f,null))[_0x86f9('0x22')](removeEntity(_0x1b173f,null))[_0x86f9('0x2d')](handleError(_0x1b173f,null));};exports[_0x86f9('0x5e')]=function(_0x3b7681,_0x1cd0f0){return db['FaxMessage'][_0x86f9('0x5e')]()[_0x86f9('0x22')](respondWithResult(_0x1cd0f0,null))[_0x86f9('0x2d')](handleError(_0x1cd0f0,null));};var interaction_log=require(_0x86f9('0x14'))(_0x86f9('0x5f'));exports['accept']=function(_0x2c8745,_0x2ea56a,_0x130e12){var _0x333e45={'channel':_0x86f9('0x60')};if(_0x2c8745[_0x86f9('0x5c')]['id']){delete _0x2c8745[_0x86f9('0x5c')]['id'];}_0x2c8745[_0x86f9('0x5c')][_0x86f9('0x61')]=!![];_0x2c8745[_0x86f9('0x5c')][_0x86f9('0x62')]=moment()[_0x86f9('0x63')](_0x86f9('0x64'));_0x2c8745[_0x86f9('0x5c')][_0x86f9('0x65')]=_0x2c8745[_0x86f9('0x5c')][_0x86f9('0x65')]||_0x2c8745[_0x86f9('0x66')]['id'];return db[_0x86f9('0x40')]['find']({'where':{'id':_0x2c8745[_0x86f9('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x86f9('0x67')],'as':_0x86f9('0x68')}]})[_0x86f9('0x22')](handleEntityNotFound(_0x2ea56a,null))[_0x86f9('0x22')](saveUpdates(_0x2c8745[_0x86f9('0x5c')],null))[_0x86f9('0x22')](function(_0x19d94a){if(_0x19d94a){_0x333e45[_0x86f9('0x2b')]=_0x19d94a[_0x86f9('0x69')]({'plain':!![]});return db['FaxInteraction'][_0x86f9('0x5d')]({'where':{'id':_0x19d94a['FaxInteractionId']}});}return null;})[_0x86f9('0x22')](handleEntityNotFound(_0x2ea56a,null))[_0x86f9('0x22')](function(_0x566b6b){if(_0x566b6b){return _0x566b6b['update']({'UserId':_0x2c8745[_0x86f9('0x5c')][_0x86f9('0x65')],'read1stAt':_[_0x86f9('0x6a')](_0x566b6b[_0x86f9('0x6b')])?moment()[_0x86f9('0x63')](_0x86f9('0x64')):undefined});}return null;})[_0x86f9('0x22')](function(_0x45fba2){if(_0x45fba2){_0x333e45[_0x86f9('0x6c')]=_0x45fba2['get']({'plain':!![]});interaction_log['info'](_0x86f9('0x6d'),_0x2c8745['user']['id'],_0x2c8745[_0x86f9('0x66')][_0x86f9('0x54')],_0x2c8745[_0x86f9('0x66')]['role'],_0x333e45[_0x86f9('0x6c')]['id'],_0x2c8745[_0x86f9('0x5c')]?JSON[_0x86f9('0x27')](_0x2c8745['body']):_0x86f9('0x6e'));return respondWithRpcPromise('AcceptMessage',_0x86f9('0x6f'),_0x333e45);}return null;})[_0x86f9('0x22')](function(_0x4e4fda){if(_0x4e4fda){if(_0x2c8745['body'][_0x86f9('0x70')]){_0x333e45[_0x86f9('0x2b')][_0x86f9('0x71')]=util['format']('SIP/%s',_0x2c8745[_0x86f9('0x66')][_0x86f9('0x54')]);_0x333e45['message'][_0x86f9('0x72')]=_0x333e45[_0x86f9('0x72')];_0x333e45[_0x86f9('0x2b')][_0x86f9('0x73')]='accept';return respondWithRpcPromise(_0x86f9('0x74'),_0x86f9('0x74'),{'event':_0x86f9('0x75'),'message':_0x333e45[_0x86f9('0x2b')]},client9002)[_0x86f9('0x22')](function(){return _0x333e45;});}return _0x333e45;}return null;})[_0x86f9('0x22')](respondWithResult(_0x2ea56a,null))[_0x86f9('0x2d')](handleError(_0x2ea56a,null));};var interaction_log=require(_0x86f9('0x14'))(_0x86f9('0x5f'));exports[_0x86f9('0x38')]=function(_0x205a69,_0x36b35f,_0x2c3339){var _0xb83927={'agent':{},'channel':_0x86f9('0x60')};if(_0x205a69['body']['id']){delete _0x205a69[_0x86f9('0x5c')]['id'];}_0x205a69[_0x86f9('0x5c')]['UserId']=_0x205a69[_0x86f9('0x5c')][_0x86f9('0x65')]||_0x205a69['user']['id'];_0xb83927[_0x86f9('0x76')]['id']=_0x205a69['body'][_0x86f9('0x65')];return db[_0x86f9('0x40')][_0x86f9('0x5d')]({'where':{'id':_0x205a69[_0x86f9('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x36b35f,null))['then'](function(_0x17d0e9){if(_0x17d0e9){_0xb83927['message']=_0x17d0e9['get']({'plain':!![]});return db[_0x86f9('0x77')][_0x86f9('0x5d')]({'where':{'id':_0x17d0e9['FaxInteractionId']}});}return null;})[_0x86f9('0x22')](handleEntityNotFound(_0x36b35f,null))[_0x86f9('0x22')](function(_0xa6d4ff){if(_0xa6d4ff){_0xb83927[_0x86f9('0x6c')]=_0xa6d4ff[_0x86f9('0x69')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x205a69[_0x86f9('0x66')]['id'],_0x205a69[_0x86f9('0x66')][_0x86f9('0x54')],_0x205a69[_0x86f9('0x66')][_0x86f9('0x78')],_0xb83927[_0x86f9('0x6c')]['id'],_0x205a69[_0x86f9('0x5c')]?JSON[_0x86f9('0x27')](_0x205a69[_0x86f9('0x5c')]):'null');return respondWithRpcPromise(_0x86f9('0x79'),_0x86f9('0x7a'),_0xb83927);}return null;})[_0x86f9('0x22')](function(_0x5deec6){if(_0x5deec6){_0x5deec6[_0x86f9('0x2b')][_0x86f9('0x71')]=util[_0x86f9('0x63')](_0x86f9('0x7b'),_0x205a69[_0x86f9('0x66')]['name']);_0x5deec6[_0x86f9('0x2b')][_0x86f9('0x72')]=_0xb83927[_0x86f9('0x72')];_0x5deec6[_0x86f9('0x2b')]['event']='reject';respondWithRpcPromise('EventManager',_0x86f9('0x74'),{'event':_0x86f9('0x7c'),'message':_0x5deec6[_0x86f9('0x2b')]},client9002);return _0xb83927;}return null;})[_0x86f9('0x22')](respondWithResult(_0x36b35f,null))['catch'](handleError(_0x36b35f,null));};exports[_0x86f9('0x7d')]=function(_0x16b8b3,_0x8f57d1){var _0x13e6fb;return db[_0x86f9('0x40')]['create'](_0x16b8b3[_0x86f9('0x5c')],{})[_0x86f9('0x22')](function(_0x19085e){_0x13e6fb=_0x19085e;return db[_0x86f9('0x67')]['findOne']({'where':{'id':_0x13e6fb[_0x86f9('0x7e')]}});})[_0x86f9('0x22')](function(_0x1f882a){if(_[_0x86f9('0x6a')](_0x1f882a)){return;}else{_0x13e6fb[_0x86f9('0x60')]=_0x1f882a[_0x86f9('0x60')];return db['Attachment'][_0x86f9('0x7f')]({'where':{'id':_0x13e6fb[_0x86f9('0x80')]}});}})[_0x86f9('0x22')](function(_0x21bbbe){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_['isNil'](_0x16b8b3['body'])?undefined:_0x16b8b3[_0x86f9('0x5c')]['FaxAccountId'],'path':_[_0x86f9('0x6a')](_0x21bbbe)?undefined:util['format'](_0x86f9('0x81'),_0x21bbbe[_0x86f9('0x82')]),'fax':_['isNil'](_0x13e6fb[_0x86f9('0x60')])?undefined:_0x13e6fb[_0x86f9('0x60')],'AttachmentId':_0x13e6fb[_0x86f9('0x80')]},client9002);})['then'](respondWithResult(_0x8f57d1,0xc9))[_0x86f9('0x2d')](handleError(_0x8f57d1,null));};exports['download']=function(_0xa3674,_0x369d59){var _0x2b4275=path[_0x86f9('0x83')](config[_0x86f9('0x84')],_0x86f9('0x85'),_0x86f9('0x86'),_0x86f9('0x87'));return db['FaxMessage']['find']({'where':{'id':_0xa3674['params']['id']},'include':[{'model':db['Attachment'],'as':_0x86f9('0x88')}]})[_0x86f9('0x22')](handleEntityNotFound(_0x369d59,null))[_0x86f9('0x22')](function(_0x2b83ba){if(_0x2b83ba){return _0x369d59[_0x86f9('0x89')](path[_0x86f9('0x83')](_0x2b4275,_0x2b83ba[_0x86f9('0x88')][_0x86f9('0x82')]));}})[_0x86f9('0x2d')](handleError(_0x369d59,null));}; \ No newline at end of file +var _0xa020=['register','jayson/promise','client','http','test','Sequelize','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','sendStatus','stack','send','index','FaxMessage','rawAttributes','fieldName','type','model','map','name','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','params','includeAll','find','body','describe','fax-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','info','role','interaction','AcceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','fax','agent','null','RejectMessage','rejectMessage','event','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','join','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0xa020,0x1eb));var _0x0a02=function(_0xd6ccc2,_0x23c534){_0xd6ccc2=_0xd6ccc2-0x0;var _0x228768=_0xa020[_0xd6ccc2];return _0x228768;};'use strict';var pdf=require(_0x0a02('0x0'));var emlformat=require(_0x0a02('0x1'));var rimraf=require(_0x0a02('0x2'));var zipdir=require(_0x0a02('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a02('0x4'));var moment=require(_0x0a02('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0a02('0x6'));var util=require('util');var path=require(_0x0a02('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0a02('0x8'));var fs=require('fs');var _=require(_0x0a02('0x9'));var squel=require(_0x0a02('0xa'));var crypto=require('crypto');var jsforce=require(_0x0a02('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a02('0xc'));var Papa=require(_0x0a02('0xd'));var Redis=require(_0x0a02('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0a02('0xf'));var hardwareService=require(_0x0a02('0x10'));var logger=require(_0x0a02('0x11'))('api');var utils=require(_0x0a02('0x12'));var config=require(_0x0a02('0x13'));var db=require(_0x0a02('0x14'))['db'];config[_0x0a02('0x15')]=_[_0x0a02('0x16')](config[_0x0a02('0x15')],{'host':_0x0a02('0x17'),'port':0x18eb});var socket=require(_0x0a02('0x18'))(new Redis(config[_0x0a02('0x15')]));require('./faxMessage.socket')[_0x0a02('0x19')](socket);var jayson=require(_0x0a02('0x1a'));var client=jayson[_0x0a02('0x1b')][_0x0a02('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a02('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x54318f,_0xdfc5f5,_0x4650c7){if(_0x4650c7){var _0x4d03c2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d03c2[_0x0a02('0x1d')](_0xdfc5f5)){return _0x54318f;}else{throw new db[(_0x0a02('0x1e'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x54318f;}}function respondWithRpcPromise(_0x536c0d,_0x57faea,_0x2aacec,_0x1e6c9a){return new BPromise(function(_0x4ca66f,_0x2d0469){var _0x59b38b=_0x1e6c9a||client;return _0x59b38b[_0x0a02('0x1f')](_0x536c0d,_0x2aacec)[_0x0a02('0x20')](function(_0x2e1eda){logger['info'](_0x0a02('0x21'),_0x57faea,_0x0a02('0x22'));logger[_0x0a02('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x57faea,_0x0a02('0x22'),JSON[_0x0a02('0x24')](_0x2e1eda));if(_0x2e1eda[_0x0a02('0x25')]){if(_0x2e1eda[_0x0a02('0x25')]['code']===0x1f4){logger[_0x0a02('0x25')]('FaxMessage,\x20%s,\x20%s',_0x57faea,_0x2e1eda[_0x0a02('0x25')][_0x0a02('0x26')]);return _0x2d0469(_0x2e1eda[_0x0a02('0x25')]['message']);}logger[_0x0a02('0x25')](_0x0a02('0x21'),_0x57faea,_0x2e1eda[_0x0a02('0x25')][_0x0a02('0x26')]);return _0x4ca66f(_0x2e1eda[_0x0a02('0x25')][_0x0a02('0x26')]);}else{logger['info'](_0x0a02('0x21'),_0x57faea,_0x0a02('0x22'));_0x4ca66f(_0x2e1eda[_0x0a02('0x27')]['message']);}})['catch'](function(_0x7a783e){logger[_0x0a02('0x25')](_0x0a02('0x21'),_0x57faea,_0x7a783e);_0x2d0469(_0x7a783e);});});}function respondWithStatusCode(_0x3eb4f0,_0x2a0498){_0x2a0498=_0x2a0498||0xcc;return function(_0x2f2d61){if(_0x2f2d61){return _0x3eb4f0['sendStatus'](_0x2a0498);}return _0x3eb4f0[_0x0a02('0x28')](_0x2a0498)[_0x0a02('0x29')]();};}function respondWithResult(_0x442e73,_0x2e781e){_0x2e781e=_0x2e781e||0xc8;return function(_0x36d1e8){if(_0x36d1e8){return _0x442e73['status'](_0x2e781e)[_0x0a02('0x2a')](_0x36d1e8);}};}function respondWithFilteredResult(_0x3ca1e2,_0x29465c){return function(_0x3dde39){if(_0x3dde39){var _0x11f38d=_0x3dde39[_0x0a02('0x2b')],_0x553b13=_0x29465c[_0x0a02('0x2c')],_0x411760=_0x29465c[_0x0a02('0x2c')]+_0x29465c[_0x0a02('0x2d')],_0xb7009e;if(_0x411760>=_0x11f38d){_0x411760=_0x11f38d;_0xb7009e=0xc8;}else{_0xb7009e=0xce;}_0x3ca1e2[_0x0a02('0x28')](_0xb7009e);return _0x3ca1e2[_0x0a02('0x2e')](_0x0a02('0x2f'),_0x553b13+'-'+_0x411760+'/'+_0x11f38d)[_0x0a02('0x2a')](_0x3dde39);}return null;};}function patchUpdates(_0x1ed82e){return function(_0x389cac){try{jsonpatch['apply'](_0x389cac,_0x1ed82e,!![]);}catch(_0x24d2d3){return BPromise[_0x0a02('0x30')](_0x24d2d3);}return _0x389cac['save']();};}function saveUpdates(_0x34ff7f,_0x9d11b2){return function(_0x3b3665){if(_0x3b3665){return _0x3b3665[_0x0a02('0x31')](_0x34ff7f)[_0x0a02('0x20')](function(_0xe2eab){return _0xe2eab;});}return null;};}function removeEntity(_0x4affa1,_0x5cc97b){return function(_0x5b7ac1){if(_0x5b7ac1){return _0x5b7ac1[_0x0a02('0x32')]()[_0x0a02('0x20')](function(){_0x4affa1[_0x0a02('0x28')](0xcc)[_0x0a02('0x29')]();});}};}function handleEntityNotFound(_0x520948,_0x302d51){return function(_0x23329a){if(!_0x23329a){_0x520948[_0x0a02('0x33')](0x194);}return _0x23329a;};}function handleError(_0x2c0058,_0x1743be){_0x1743be=_0x1743be||0x1f4;return function(_0x339285){logger['error'](_0x339285[_0x0a02('0x34')]);if(_0x339285['name']){delete _0x339285['name'];}_0x2c0058[_0x0a02('0x28')](_0x1743be)[_0x0a02('0x35')](_0x339285);};}exports[_0x0a02('0x36')]=function(_0x4f2e0f,_0x8700d2){var _0x5ba31e={},_0xe2ec52={},_0x123dbb={'count':0x0,'rows':[]};var _0x479d53=_['map'](db[_0x0a02('0x37')][_0x0a02('0x38')],function(_0x66f011){return{'name':_0x66f011[_0x0a02('0x39')],'type':_0x66f011[_0x0a02('0x3a')]['key']};});_0xe2ec52[_0x0a02('0x3b')]=_[_0x0a02('0x3c')](_0x479d53,_0x0a02('0x3d'));_0xe2ec52['query']=_[_0x0a02('0x3e')](_0x4f2e0f[_0x0a02('0x3f')]);_0xe2ec52[_0x0a02('0x40')]=_[_0x0a02('0x41')](_0xe2ec52[_0x0a02('0x3b')],_0xe2ec52[_0x0a02('0x3f')]);_0x5ba31e['attributes']=_[_0x0a02('0x41')](_0xe2ec52[_0x0a02('0x3b')],qs[_0x0a02('0x42')](_0x4f2e0f[_0x0a02('0x3f')][_0x0a02('0x42')]));_0x5ba31e[_0x0a02('0x43')]=_0x5ba31e['attributes'][_0x0a02('0x44')]?_0x5ba31e[_0x0a02('0x43')]:_0xe2ec52[_0x0a02('0x3b')];if(!_0x4f2e0f['query']['hasOwnProperty'](_0x0a02('0x45'))){_0x5ba31e[_0x0a02('0x2d')]=qs[_0x0a02('0x2d')](_0x4f2e0f['query'][_0x0a02('0x2d')]);_0x5ba31e[_0x0a02('0x2c')]=qs[_0x0a02('0x2c')](_0x4f2e0f[_0x0a02('0x3f')][_0x0a02('0x2c')]);}_0x5ba31e[_0x0a02('0x46')]=qs[_0x0a02('0x47')](_0x4f2e0f['query']['sort']);_0x5ba31e[_0x0a02('0x48')]=qs[_0x0a02('0x40')](_[_0x0a02('0x49')](_0x4f2e0f['query'],_0xe2ec52[_0x0a02('0x40')]),_0x479d53);if(_0x4f2e0f['query']['filter']){_0x5ba31e[_0x0a02('0x48')]=_[_0x0a02('0x4a')](_0x5ba31e[_0x0a02('0x48')],{'$or':_[_0x0a02('0x3c')](_0x479d53,function(_0x30ed1c){if(_0x30ed1c[_0x0a02('0x3a')]!==_0x0a02('0x4b')){var _0x43b339={};_0x43b339[_0x30ed1c['name']]={'$like':'%'+_0x4f2e0f[_0x0a02('0x3f')][_0x0a02('0x4c')]+'%'};return _0x43b339;}})});}_0x5ba31e=_[_0x0a02('0x4a')]({},_0x5ba31e,_0x4f2e0f[_0x0a02('0x4d')]);var _0xb4ab50={'where':_0x5ba31e['where']};return db[_0x0a02('0x37')][_0x0a02('0x2b')](_0xb4ab50)[_0x0a02('0x20')](function(_0x172511){_0x123dbb[_0x0a02('0x2b')]=_0x172511;if(_0x4f2e0f[_0x0a02('0x3f')]['includeAll']){_0x5ba31e[_0x0a02('0x4e')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x5ba31e);})[_0x0a02('0x20')](function(_0x321783){_0x123dbb[_0x0a02('0x4f')]=_0x321783;return _0x123dbb;})[_0x0a02('0x20')](respondWithFilteredResult(_0x8700d2,_0x5ba31e))[_0x0a02('0x50')](handleError(_0x8700d2,null));};exports['show']=function(_0x4fffcd,_0x21a6f7){var _0xefd5c0={'raw':!![],'where':{'id':_0x4fffcd[_0x0a02('0x51')]['id']}},_0x27041e={};_0x27041e[_0x0a02('0x3b')]=_[_0x0a02('0x3e')](db[_0x0a02('0x37')][_0x0a02('0x38')]);_0x27041e[_0x0a02('0x3f')]=_[_0x0a02('0x3e')](_0x4fffcd[_0x0a02('0x3f')]);_0x27041e[_0x0a02('0x40')]=_[_0x0a02('0x41')](_0x27041e[_0x0a02('0x3b')],_0x27041e[_0x0a02('0x3f')]);_0xefd5c0[_0x0a02('0x43')]=_['intersection'](_0x27041e[_0x0a02('0x3b')],qs[_0x0a02('0x42')](_0x4fffcd[_0x0a02('0x3f')]['fields']));_0xefd5c0[_0x0a02('0x43')]=_0xefd5c0[_0x0a02('0x43')][_0x0a02('0x44')]?_0xefd5c0[_0x0a02('0x43')]:_0x27041e[_0x0a02('0x3b')];if(_0x4fffcd[_0x0a02('0x3f')][_0x0a02('0x52')]){_0xefd5c0['include']=[{'all':!![]}];}_0xefd5c0=_['merge']({},_0xefd5c0,_0x4fffcd[_0x0a02('0x4d')]);return db['FaxMessage'][_0x0a02('0x53')](_0xefd5c0)[_0x0a02('0x20')](handleEntityNotFound(_0x21a6f7,null))[_0x0a02('0x20')](respondWithResult(_0x21a6f7,null))[_0x0a02('0x50')](handleError(_0x21a6f7,null));};exports['update']=function(_0x1e357d,_0x2dc238){if(_0x1e357d[_0x0a02('0x54')]['id']){delete _0x1e357d['body']['id'];}return db[_0x0a02('0x37')][_0x0a02('0x53')]({'where':{'id':_0x1e357d[_0x0a02('0x51')]['id']}})[_0x0a02('0x20')](handleEntityNotFound(_0x2dc238,null))['then'](saveUpdates(_0x1e357d['body'],null))[_0x0a02('0x20')](respondWithResult(_0x2dc238,null))[_0x0a02('0x50')](handleError(_0x2dc238,null));};exports['destroy']=function(_0x55014c,_0xaf1fcc){return db[_0x0a02('0x37')][_0x0a02('0x53')]({'where':{'id':_0x55014c[_0x0a02('0x51')]['id']}})['then'](handleEntityNotFound(_0xaf1fcc,null))[_0x0a02('0x20')](removeEntity(_0xaf1fcc,null))['catch'](handleError(_0xaf1fcc,null));};exports[_0x0a02('0x55')]=function(_0x27a360,_0x1943f6){return db['FaxMessage'][_0x0a02('0x55')]()['then'](respondWithResult(_0x1943f6,null))[_0x0a02('0x50')](handleError(_0x1943f6,null));};var interaction_log=require(_0x0a02('0x11'))(_0x0a02('0x56'));exports[_0x0a02('0x57')]=function(_0x1b32c7,_0x31c2f1,_0x12771e){var _0x5644c1={'channel':'fax'};if(_0x1b32c7[_0x0a02('0x54')]['id']){delete _0x1b32c7[_0x0a02('0x54')]['id'];}_0x1b32c7['body']['read']=!![];_0x1b32c7['body'][_0x0a02('0x58')]=moment()[_0x0a02('0x59')](_0x0a02('0x5a'));_0x1b32c7[_0x0a02('0x54')][_0x0a02('0x5b')]=_0x1b32c7['body'][_0x0a02('0x5b')]||_0x1b32c7[_0x0a02('0x5c')]['id'];return db[_0x0a02('0x37')][_0x0a02('0x53')]({'where':{'id':_0x1b32c7[_0x0a02('0x51')]['id'],'UserId':null},'include':[{'model':db[_0x0a02('0x5d')],'as':_0x0a02('0x5e')}]})[_0x0a02('0x20')](handleEntityNotFound(_0x31c2f1,null))[_0x0a02('0x20')](saveUpdates(_0x1b32c7['body'],null))[_0x0a02('0x20')](function(_0x70aae1){if(_0x70aae1){_0x5644c1[_0x0a02('0x26')]=_0x70aae1[_0x0a02('0x5f')]({'plain':!![]});return db[_0x0a02('0x60')][_0x0a02('0x53')]({'where':{'id':_0x70aae1[_0x0a02('0x61')]}});}return null;})[_0x0a02('0x20')](handleEntityNotFound(_0x31c2f1,null))[_0x0a02('0x20')](function(_0x1ef4f1){if(_0x1ef4f1){return _0x1ef4f1[_0x0a02('0x31')]({'UserId':_0x1b32c7[_0x0a02('0x54')][_0x0a02('0x5b')],'read1stAt':_[_0x0a02('0x62')](_0x1ef4f1[_0x0a02('0x63')])?moment()[_0x0a02('0x59')](_0x0a02('0x5a')):undefined});}return null;})[_0x0a02('0x20')](function(_0x2b879e){if(_0x2b879e){_0x5644c1['interaction']=_0x2b879e[_0x0a02('0x5f')]({'plain':!![]});interaction_log[_0x0a02('0x64')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b32c7['user']['id'],_0x1b32c7[_0x0a02('0x5c')][_0x0a02('0x3d')],_0x1b32c7[_0x0a02('0x5c')][_0x0a02('0x65')],_0x5644c1[_0x0a02('0x66')]['id'],_0x1b32c7['body']?JSON[_0x0a02('0x24')](_0x1b32c7[_0x0a02('0x54')]):'null');return respondWithRpcPromise(_0x0a02('0x67'),'acceptMessage',_0x5644c1);}return null;})['then'](function(_0x1e5e19){if(_0x1e5e19){if(_0x1b32c7[_0x0a02('0x54')][_0x0a02('0x68')]){_0x5644c1[_0x0a02('0x26')][_0x0a02('0x69')]=util['format'](_0x0a02('0x6a'),_0x1b32c7[_0x0a02('0x5c')][_0x0a02('0x3d')]);_0x5644c1[_0x0a02('0x26')][_0x0a02('0x6b')]=_0x5644c1[_0x0a02('0x6b')];_0x5644c1['message']['event']=_0x0a02('0x57');return respondWithRpcPromise(_0x0a02('0x6c'),'EventManager',{'event':_0x0a02('0x6d'),'message':_0x5644c1[_0x0a02('0x26')]},client9002)[_0x0a02('0x20')](function(){return _0x5644c1;});}return _0x5644c1;}return null;})[_0x0a02('0x20')](respondWithResult(_0x31c2f1,null))[_0x0a02('0x50')](handleError(_0x31c2f1,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x0a02('0x30')]=function(_0xb2ff9e,_0xcb6d5e,_0x4ca7d7){var _0x112f23={'agent':{},'channel':_0x0a02('0x6e')};if(_0xb2ff9e[_0x0a02('0x54')]['id']){delete _0xb2ff9e['body']['id'];}_0xb2ff9e['body'][_0x0a02('0x5b')]=_0xb2ff9e['body']['UserId']||_0xb2ff9e[_0x0a02('0x5c')]['id'];_0x112f23[_0x0a02('0x6f')]['id']=_0xb2ff9e[_0x0a02('0x54')][_0x0a02('0x5b')];return db['FaxMessage'][_0x0a02('0x53')]({'where':{'id':_0xb2ff9e[_0x0a02('0x51')]['id'],'UserId':null}})[_0x0a02('0x20')](handleEntityNotFound(_0xcb6d5e,null))[_0x0a02('0x20')](function(_0x4cbbec){if(_0x4cbbec){_0x112f23[_0x0a02('0x26')]=_0x4cbbec[_0x0a02('0x5f')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x4cbbec[_0x0a02('0x61')]}});}return null;})[_0x0a02('0x20')](handleEntityNotFound(_0xcb6d5e,null))['then'](function(_0x3d6eb2){if(_0x3d6eb2){_0x112f23[_0x0a02('0x66')]=_0x3d6eb2[_0x0a02('0x5f')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xb2ff9e['user']['id'],_0xb2ff9e['user'][_0x0a02('0x3d')],_0xb2ff9e[_0x0a02('0x5c')][_0x0a02('0x65')],_0x112f23[_0x0a02('0x66')]['id'],_0xb2ff9e['body']?JSON[_0x0a02('0x24')](_0xb2ff9e[_0x0a02('0x54')]):_0x0a02('0x70'));return respondWithRpcPromise(_0x0a02('0x71'),_0x0a02('0x72'),_0x112f23);}return null;})[_0x0a02('0x20')](function(_0x7073c7){if(_0x7073c7){_0x7073c7['message'][_0x0a02('0x69')]=util['format']('SIP/%s',_0xb2ff9e['user'][_0x0a02('0x3d')]);_0x7073c7[_0x0a02('0x26')][_0x0a02('0x6b')]=_0x112f23['channel'];_0x7073c7[_0x0a02('0x26')][_0x0a02('0x73')]=_0x0a02('0x30');respondWithRpcPromise('EventManager',_0x0a02('0x6c'),{'event':'rejectmessage','message':_0x7073c7[_0x0a02('0x26')]},client9002);return _0x112f23;}return null;})[_0x0a02('0x20')](respondWithResult(_0xcb6d5e,null))[_0x0a02('0x50')](handleError(_0xcb6d5e,null));};exports[_0x0a02('0x74')]=function(_0x44bb49,_0x2edab1){var _0x256d16;return db[_0x0a02('0x37')][_0x0a02('0x74')](_0x44bb49[_0x0a02('0x54')],{})[_0x0a02('0x20')](function(_0x35fc41){_0x256d16=_0x35fc41;return db[_0x0a02('0x5d')][_0x0a02('0x75')]({'where':{'id':_0x256d16['ContactId']}});})[_0x0a02('0x20')](function(_0xc286ce){if(_[_0x0a02('0x62')](_0xc286ce)){return;}else{_0x256d16[_0x0a02('0x6e')]=_0xc286ce[_0x0a02('0x6e')];return db[_0x0a02('0x76')][_0x0a02('0x75')]({'where':{'id':_0x256d16[_0x0a02('0x77')]}});}})[_0x0a02('0x20')](function(_0x2c3c04){return respondWithRpcPromise('SendFax',_0x0a02('0x78'),{'FaxAccountId':_['isNil'](_0x44bb49[_0x0a02('0x54')])?undefined:_0x44bb49['body'][_0x0a02('0x79')],'path':_[_0x0a02('0x62')](_0x2c3c04)?undefined:util[_0x0a02('0x59')](_0x0a02('0x7a'),_0x2c3c04[_0x0a02('0x7b')]),'fax':_['isNil'](_0x256d16[_0x0a02('0x6e')])?undefined:_0x256d16[_0x0a02('0x6e')],'AttachmentId':_0x256d16[_0x0a02('0x77')]},client9002);})['then'](respondWithResult(_0x2edab1,0xc9))['catch'](handleError(_0x2edab1,null));};exports[_0x0a02('0x7c')]=function(_0x336b40,_0x5f539e){var _0x3825ab=path['join'](config[_0x0a02('0x7d')],_0x0a02('0x7e'),_0x0a02('0x7f'),'attachments');return db[_0x0a02('0x37')][_0x0a02('0x53')]({'where':{'id':_0x336b40[_0x0a02('0x51')]['id']},'include':[{'model':db['Attachment'],'as':_0x0a02('0x76')}]})[_0x0a02('0x20')](handleEntityNotFound(_0x5f539e,null))[_0x0a02('0x20')](function(_0x2d4fbd){if(_0x2d4fbd){return _0x5f539e[_0x0a02('0x7c')](path[_0x0a02('0x80')](_0x3825ab,_0x2d4fbd[_0x0a02('0x76')]['basename']));}})['catch'](handleError(_0x5f539e,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index bc75292..c0693c6 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x3a06b6,_0x50e5cd){var _0x229e2a=function(_0x51c86c){while(--_0x51c86c){_0x3a06b6['push'](_0x3a06b6['shift']());}};_0x229e2a(++_0x50e5cd);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x34bc1e,_0x308714){var _0x4c402a=function(_0x533f8c){while(--_0x533f8c){_0x34bc1e['push'](_0x34bc1e['shift']());}};_0x4c402a(++_0x308714);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index efe93ef..76c916d 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 _0x72df=['catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','toLowerCase','direction','isNil','UserId','FaxInteraction','FaxInteractionId','update'];(function(_0x16a9e3,_0x2e0676){var _0x2fd8cf=function(_0x77a40d){while(--_0x77a40d){_0x16a9e3['push'](_0x16a9e3['shift']());}};_0x2fd8cf(++_0x2e0676);}(_0x72df,0xf6));var _0xf72d=function(_0x30e620,_0x47b066){_0x30e620=_0x30e620-0x0;var _0x54591b=_0x72df[_0x30e620];return _0x54591b;};'use strict';var _=require(_0xf72d('0x0'));var util=require(_0xf72d('0x1'));var logger=require(_0xf72d('0x2'))(_0xf72d('0x3'));var moment=require('moment');var BPromise=require(_0xf72d('0x4'));var rp=require(_0xf72d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf72d('0x6'));var config=require(_0xf72d('0x7'));var attributes=require(_0xf72d('0x8'));module[_0xf72d('0x9')]=function(_0x584c50,_0x2a8047){return _0x584c50[_0xf72d('0xa')](_0xf72d('0xb'),attributes,{'tableName':_0xf72d('0xc'),'paranoid':![],'indexes':[{'name':_0xf72d('0xd'),'fields':[_0xf72d('0xe')],'type':_0xf72d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c10db,_0x2b7043,_0x1e0f5f){var _0x5d3b09=_0x584c50[_0xf72d('0x10')];var _0x31b541=_0x2c10db['get']({'plain':!![]});if(_0x31b541['direction'][_0xf72d('0x11')]()==='in'||_0x31b541[_0xf72d('0x12')]['toLowerCase']()==='out'&&!_0x31b541['secret']&&!_[_0xf72d('0x13')](_0x31b541[_0xf72d('0x14')])){_0x5d3b09[_0xf72d('0x15')]['findOne']({'where':{'id':_0x31b541[_0xf72d('0x16')]}})['then'](function(_0x29ef66){if(_0x29ef66){_0x29ef66[_0xf72d('0x17')]({'lastMsgAt':_0x31b541['createdAt'],'lastMsgDirection':_0x31b541[_0xf72d('0x12')]['toLowerCase']()});}})[_0xf72d('0x18')](function(_0x11a8c){console[_0xf72d('0x19')](_0x11a8c);});}_0x1e0f5f();}},'charset':'utf8mb4','collate':_0xf72d('0x1a')});}; \ No newline at end of file +var _0x6561=['error','utf8mb4','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fti_fax_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','catch'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x6561,0x6e));var _0x1656=function(_0x39551a,_0x116007){_0x39551a=_0x39551a-0x0;var _0x4b0b62=_0x6561[_0x39551a];return _0x4b0b62;};'use strict';var _=require(_0x1656('0x0'));var util=require(_0x1656('0x1'));var logger=require('../../config/logger')(_0x1656('0x2'));var moment=require(_0x1656('0x3'));var BPromise=require(_0x1656('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1656('0x5'));var config=require(_0x1656('0x6'));var attributes=require(_0x1656('0x7'));module['exports']=function(_0x1c76f1,_0xe37e54){return _0x1c76f1[_0x1656('0x8')](_0x1656('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x1656('0xa'),'fields':['body'],'type':_0x1656('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c994f,_0x1e3ff4,_0x4d76b8){var _0x4dfa81=_0x1c76f1['models'];var _0x7c4cc3=_0x2c994f[_0x1656('0xc')]({'plain':!![]});if(_0x7c4cc3[_0x1656('0xd')][_0x1656('0xe')]()==='in'||_0x7c4cc3['direction'][_0x1656('0xe')]()===_0x1656('0xf')&&!_0x7c4cc3[_0x1656('0x10')]&&!_[_0x1656('0x11')](_0x7c4cc3[_0x1656('0x12')])){_0x4dfa81[_0x1656('0x13')]['findOne']({'where':{'id':_0x7c4cc3[_0x1656('0x14')]}})[_0x1656('0x15')](function(_0x44bf5f){if(_0x44bf5f){_0x44bf5f[_0x1656('0x16')]({'lastMsgAt':_0x7c4cc3[_0x1656('0x17')],'lastMsgDirection':_0x7c4cc3['direction']['toLowerCase']()});}})[_0x1656('0x18')](function(_0x4c857d){console[_0x1656('0x19')](_0x4c857d);});}_0x4d76b8();}},'charset':_0x1656('0x1a'),'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 b671692..a68dd4a 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 _0x8ee5=['message','info','CreateFaxMessage','FaxMessage','options','raw','update','body','where','attributes','limit','UpdateFaxMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','FaxMessage,\x20%s,\x20%s'];(function(_0x22f164,_0xaa4f80){var _0x51ab95=function(_0x190b68){while(--_0x190b68){_0x22f164['push'](_0x22f164['shift']());}};_0x51ab95(++_0xaa4f80);}(_0x8ee5,0xbc));var _0x58ee=function(_0x1f18d9,_0x317307){_0x1f18d9=_0x1f18d9-0x0;var _0x10d8d7=_0x8ee5[_0x1f18d9];return _0x10d8d7;};'use strict';var _=require(_0x58ee('0x0'));var util=require(_0x58ee('0x1'));var moment=require(_0x58ee('0x2'));var BPromise=require(_0x58ee('0x3'));var rs=require(_0x58ee('0x4'));var fs=require('fs');var Redis=require(_0x58ee('0x5'));var db=require(_0x58ee('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x58ee('0x7'))(_0x58ee('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x58ee('0x9')]({'port':0x232a});config[_0x58ee('0xa')]=_['defaults'](config[_0x58ee('0xa')],{'host':_0x58ee('0xb'),'port':0x18eb});var socket=require(_0x58ee('0xc'))(new Redis(config[_0x58ee('0xa')]));require(_0x58ee('0xd'))[_0x58ee('0xe')](socket);function respondWithRpcPromise(_0x1006b5,_0x2fc166,_0x4abc18){return new BPromise(function(_0x403f73,_0x296d10){return client['request'](_0x1006b5,_0x4abc18)[_0x58ee('0xf')](function(_0x5224be){logger['info']('FaxMessage,\x20%s,\x20%s',_0x2fc166,_0x58ee('0x10'));logger[_0x58ee('0x11')](_0x58ee('0x12'),_0x2fc166,_0x58ee('0x10'),JSON[_0x58ee('0x13')](_0x5224be));if(_0x5224be[_0x58ee('0x14')]){if(_0x5224be[_0x58ee('0x14')]['code']===0x1f4){logger[_0x58ee('0x14')](_0x58ee('0x15'),_0x2fc166,_0x5224be[_0x58ee('0x14')][_0x58ee('0x16')]);return _0x296d10(_0x5224be[_0x58ee('0x14')][_0x58ee('0x16')]);}logger['error'](_0x58ee('0x15'),_0x2fc166,_0x5224be[_0x58ee('0x14')][_0x58ee('0x16')]);return _0x403f73(_0x5224be['error'][_0x58ee('0x16')]);}else{logger[_0x58ee('0x17')](_0x58ee('0x15'),_0x2fc166,'request\x20sent');_0x403f73(_0x5224be['result'][_0x58ee('0x16')]);}})['catch'](function(_0x2635ab){logger[_0x58ee('0x14')](_0x58ee('0x15'),_0x2fc166,_0x2635ab);_0x296d10(_0x2635ab);});});}exports[_0x58ee('0x18')]=function(_0x423a5e){var _0x54fd16=this;return new Promise(function(_0x16c0bf,_0x53d3c5){return db[_0x58ee('0x19')]['create'](_0x423a5e['body'],{'raw':_0x423a5e[_0x58ee('0x1a')]?_0x423a5e['options'][_0x58ee('0x1b')]===undefined?!![]:![]:!![]})[_0x58ee('0xf')](function(_0x416446){logger['info'](_0x58ee('0x18'),_0x423a5e);logger[_0x58ee('0x11')]('CreateFaxMessage',_0x423a5e,JSON[_0x58ee('0x13')](_0x416446));_0x16c0bf(_0x416446);})['catch'](function(_0x48589c){logger[_0x58ee('0x14')]('CreateFaxMessage',_0x48589c[_0x58ee('0x16')],_0x423a5e);_0x53d3c5(_0x54fd16[_0x58ee('0x14')](0x1f4,_0x48589c[_0x58ee('0x16')]));});});};exports['UpdateFaxMessage']=function(_0x5339ef){var _0x486d12=this;return new Promise(function(_0x13287d,_0x4f94ae){return db[_0x58ee('0x19')][_0x58ee('0x1c')](_0x5339ef[_0x58ee('0x1d')],{'raw':_0x5339ef[_0x58ee('0x1a')]?_0x5339ef[_0x58ee('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5339ef['options']?_0x5339ef[_0x58ee('0x1a')][_0x58ee('0x1e')]||null:null,'attributes':_0x5339ef['options']?_0x5339ef['options'][_0x58ee('0x1f')]||null:null,'limit':_0x5339ef['options']?_0x5339ef[_0x58ee('0x1a')][_0x58ee('0x20')]||null:null})[_0x58ee('0xf')](function(_0x207286){logger[_0x58ee('0x17')](_0x58ee('0x21'),_0x5339ef);logger['debug'](_0x58ee('0x21'),_0x5339ef,JSON[_0x58ee('0x13')](_0x207286));_0x13287d(_0x207286);})[_0x58ee('0x22')](function(_0x10567d){logger['error'](_0x58ee('0x21'),_0x10567d[_0x58ee('0x16')],_0x5339ef);_0x4f94ae(_0x486d12[_0x58ee('0x14')](0x1f4,_0x10567d['message']));});});}; \ No newline at end of file +var _0x8b2b=['rpc','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','debug','stringify','update','where','attributes','UpdateFaxMessage','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x23c569,_0x2440cf){_0x23c569=_0x23c569-0x0;var _0x19cb4b=_0x8b2b[_0x23c569];return _0x19cb4b;};'use strict';var _=require(_0xb8b2('0x0'));var util=require(_0xb8b2('0x1'));var moment=require(_0xb8b2('0x2'));var BPromise=require('bluebird');var rs=require(_0xb8b2('0x3'));var fs=require('fs');var Redis=require(_0xb8b2('0x4'));var db=require(_0xb8b2('0x5'))['db'];var utils=require(_0xb8b2('0x6'));var logger=require(_0xb8b2('0x7'))(_0xb8b2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb8b2('0x9')][_0xb8b2('0xa')]({'port':0x232a});config[_0xb8b2('0xb')]=_[_0xb8b2('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb8b2('0xd'))(new Redis(config[_0xb8b2('0xb')]));require(_0xb8b2('0xe'))[_0xb8b2('0xf')](socket);function respondWithRpcPromise(_0x3542b6,_0x564fe2,_0x3adebc){return new BPromise(function(_0x501001,_0x51cae3){return client[_0xb8b2('0x10')](_0x3542b6,_0x3adebc)[_0xb8b2('0x11')](function(_0x58b67){logger[_0xb8b2('0x12')](_0xb8b2('0x13'),_0x564fe2,_0xb8b2('0x14'));logger['debug'](_0xb8b2('0x15'),_0x564fe2,'request\x20sent',JSON['stringify'](_0x58b67));if(_0x58b67['error']){if(_0x58b67[_0xb8b2('0x16')][_0xb8b2('0x17')]===0x1f4){logger['error'](_0xb8b2('0x13'),_0x564fe2,_0x58b67[_0xb8b2('0x16')][_0xb8b2('0x18')]);return _0x51cae3(_0x58b67[_0xb8b2('0x16')][_0xb8b2('0x18')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x564fe2,_0x58b67[_0xb8b2('0x16')][_0xb8b2('0x18')]);return _0x501001(_0x58b67[_0xb8b2('0x16')][_0xb8b2('0x18')]);}else{logger[_0xb8b2('0x12')]('FaxMessage,\x20%s,\x20%s',_0x564fe2,'request\x20sent');_0x501001(_0x58b67[_0xb8b2('0x19')][_0xb8b2('0x18')]);}})[_0xb8b2('0x1a')](function(_0x100f52){logger['error'](_0xb8b2('0x13'),_0x564fe2,_0x100f52);_0x51cae3(_0x100f52);});});}exports[_0xb8b2('0x1b')]=function(_0x9f4388){var _0x30c67f=this;return new Promise(function(_0x3d0be7,_0x1cbc65){return db[_0xb8b2('0x1c')]['create'](_0x9f4388[_0xb8b2('0x1d')],{'raw':_0x9f4388[_0xb8b2('0x1e')]?_0x9f4388[_0xb8b2('0x1e')][_0xb8b2('0x1f')]===undefined?!![]:![]:!![]})[_0xb8b2('0x11')](function(_0x5a0a43){logger[_0xb8b2('0x12')]('CreateFaxMessage',_0x9f4388);logger[_0xb8b2('0x20')](_0xb8b2('0x1b'),_0x9f4388,JSON[_0xb8b2('0x21')](_0x5a0a43));_0x3d0be7(_0x5a0a43);})[_0xb8b2('0x1a')](function(_0x5dc876){logger[_0xb8b2('0x16')](_0xb8b2('0x1b'),_0x5dc876[_0xb8b2('0x18')],_0x9f4388);_0x1cbc65(_0x30c67f['error'](0x1f4,_0x5dc876['message']));});});};exports['UpdateFaxMessage']=function(_0x585d5b){var _0x36ae2d=this;return new Promise(function(_0x10d8f3,_0x3bdb27){return db[_0xb8b2('0x1c')][_0xb8b2('0x22')](_0x585d5b[_0xb8b2('0x1d')],{'raw':_0x585d5b[_0xb8b2('0x1e')]?_0x585d5b[_0xb8b2('0x1e')][_0xb8b2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x585d5b[_0xb8b2('0x1e')]?_0x585d5b[_0xb8b2('0x1e')][_0xb8b2('0x23')]||null:null,'attributes':_0x585d5b[_0xb8b2('0x1e')]?_0x585d5b[_0xb8b2('0x1e')][_0xb8b2('0x24')]||null:null,'limit':_0x585d5b[_0xb8b2('0x1e')]?_0x585d5b[_0xb8b2('0x1e')]['limit']||null:null})[_0xb8b2('0x11')](function(_0x1899d9){logger[_0xb8b2('0x12')](_0xb8b2('0x25'),_0x585d5b);logger[_0xb8b2('0x20')]('UpdateFaxMessage',_0x585d5b,JSON[_0xb8b2('0x21')](_0x1899d9));_0x10d8f3(_0x1899d9);})[_0xb8b2('0x1a')](function(_0x26309e){logger['error'](_0xb8b2('0x25'),_0x26309e[_0xb8b2('0x18')],_0x585d5b);_0x3bdb27(_0x36ae2d['error'](0x1f4,_0x26309e[_0xb8b2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index a9cbf8c..b725a6c 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 bca393f..32c6c53 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 _0xb25b=['isAuthenticated','index','/describe','describe','/:id','show','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get'];(function(_0x883d7,_0x28edb8){var _0x1559d6=function(_0x2a245b){while(--_0x2a245b){_0x883d7['push'](_0x883d7['shift']());}};_0x1559d6(++_0x28edb8);}(_0xb25b,0x12b));var _0xbb25=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb25b[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xbb25('0x0'));var util=require(_0xbb25('0x1'));var path=require(_0xbb25('0x2'));var timeout=require(_0xbb25('0x3'));var express=require(_0xbb25('0x4'));var router=express[_0xbb25('0x5')]();var auth=require(_0xbb25('0x6'));var interaction=require(_0xbb25('0x7'));var config=require(_0xbb25('0x8'));var controller=require(_0xbb25('0x9'));router[_0xbb25('0xa')]('/',auth[_0xbb25('0xb')](),controller[_0xbb25('0xc')]);router[_0xbb25('0xa')](_0xbb25('0xd'),auth[_0xbb25('0xb')](),controller[_0xbb25('0xe')]);router[_0xbb25('0xa')](_0xbb25('0xf'),auth['isAuthenticated'](),controller[_0xbb25('0x10')]);router[_0xbb25('0xa')]('/:id/download',auth[_0xbb25('0xb')](),controller[_0xbb25('0x11')]);router[_0xbb25('0x12')]('/',auth[_0xbb25('0xb')](),interaction[_0xbb25('0x13')](_0xbb25('0x14'),_0xbb25('0x15')),controller[_0xbb25('0x16')]);router[_0xbb25('0x17')]('/:id',auth[_0xbb25('0xb')](),controller[_0xbb25('0x18')]);router[_0xbb25('0x17')](_0xbb25('0x19'),auth['isAuthenticated'](),controller[_0xbb25('0x1a')]);router[_0xbb25('0x17')](_0xbb25('0x1b'),auth[_0xbb25('0xb')](),controller['reject']);router[_0xbb25('0x1c')]('/:id',auth[_0xbb25('0xb')](),controller[_0xbb25('0x1d')]);module[_0xbb25('0x1e')]=router; \ No newline at end of file +var _0x2470=['get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','reject','delete','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./faxMessage.controller'];(function(_0x54e6f5,_0x4f4e99){var _0x5e8794=function(_0x27512b){while(--_0x27512b){_0x54e6f5['push'](_0x54e6f5['shift']());}};_0x5e8794(++_0x4f4e99);}(_0x2470,0xb6));var _0x0247=function(_0x4745a7,_0x37a893){_0x4745a7=_0x4745a7-0x0;var _0x8c5686=_0x2470[_0x4745a7];return _0x8c5686;};'use strict';var multer=require(_0x0247('0x0'));var util=require(_0x0247('0x1'));var path=require('path');var timeout=require(_0x0247('0x2'));var express=require(_0x0247('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0247('0x4'));var config=require(_0x0247('0x5'));var controller=require(_0x0247('0x6'));router[_0x0247('0x7')]('/',auth['isAuthenticated'](),controller[_0x0247('0x8')]);router[_0x0247('0x7')](_0x0247('0x9'),auth[_0x0247('0xa')](),controller[_0x0247('0xb')]);router['get'](_0x0247('0xc'),auth[_0x0247('0xa')](),controller[_0x0247('0xd')]);router['get'](_0x0247('0xe'),auth[_0x0247('0xa')](),controller[_0x0247('0xf')]);router[_0x0247('0x10')]('/',auth['isAuthenticated'](),interaction[_0x0247('0x11')](_0x0247('0x12'),_0x0247('0x13')),controller[_0x0247('0x14')]);router[_0x0247('0x15')](_0x0247('0xc'),auth[_0x0247('0xa')](),controller[_0x0247('0x16')]);router['put'](_0x0247('0x17'),auth['isAuthenticated'](),controller[_0x0247('0x18')]);router[_0x0247('0x15')]('/:id/reject',auth[_0x0247('0xa')](),controller[_0x0247('0x19')]);router[_0x0247('0x1a')](_0x0247('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a19e17a..90a649f 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 _0xb59d=['name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xb59d,0x6d));var _0xdb59=function(_0x2913f6,_0x265243){_0x2913f6=_0x2913f6-0x0;var _0x213194=_0xb59d[_0x2913f6];return _0x213194;};'use strict';var Sequelize=require(_0xdb59('0x0'));module[_0xdb59('0x1')]={'name':{'type':Sequelize[_0xdb59('0x2')],'unique':_0xdb59('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdb59('0x2')]},'timeout':{'type':Sequelize[_0xdb59('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdb59('0x5')](_0xdb59('0x6'),'beepall',_0xdb59('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xca74=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x459919,_0x5f4fe9){var _0x5a0f3e=function(_0xe3000c){while(--_0xe3000c){_0x459919['push'](_0x459919['shift']());}};_0x5a0f3e(++_0x5f4fe9);}(_0xca74,0x170));var _0x4ca7=function(_0x1e399a,_0x351c59){_0x1e399a=_0x1e399a-0x0;var _0x539897=_0xca74[_0x1e399a];return _0x539897;};'use strict';var Sequelize=require(_0x4ca7('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ca7('0x1')],'unique':_0x4ca7('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4ca7('0x1')]},'timeout':{'type':Sequelize[_0x4ca7('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4ca7('0x4')](_0x4ca7('0x5'),_0x4ca7('0x6'),_0x4ca7('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x4ca7('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 8101e7e..da68f17 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 _0x8580=['tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','transaction','isEmpty','forEach','emit','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','set','apply','reject','save','then','destroy','get','FaxQueues','UserProfileResource','error','name','send','index','map','FaxQueue','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','rawAttributes','FaxQueueId','findAll','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','SIP','faxPause','createdAt','getTeams','order','ids','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','userFaxQueue:save','removeTeams','select','field'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x8580,0x1c7));var _0x0858=function(_0x3914e9,_0x22e093){_0x3914e9=_0x3914e9-0x0;var _0x2e3c52=_0x8580[_0x3914e9];return _0x2e3c52;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0858('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0858('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0858('0x2'));var BPromise=require(_0x0858('0x3'));var Mustache=require('mustache');var util=require(_0x0858('0x4'));var path=require(_0x0858('0x5'));var sox=require('sox');var csv=require(_0x0858('0x6'));var ejs=require(_0x0858('0x7'));var fs=require('fs');var _=require(_0x0858('0x8'));var squel=require(_0x0858('0x9'));var crypto=require('crypto');var jsforce=require(_0x0858('0xa'));var deskjs=require(_0x0858('0xb'));var toCsv=require(_0x0858('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0858('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x0858('0xd'));var as=require(_0x0858('0xe'));var hardwareService=require(_0x0858('0xf'));var logger=require(_0x0858('0x10'))(_0x0858('0x11'));var utils=require(_0x0858('0x12'));var config=require(_0x0858('0x13'));var db=require(_0x0858('0x14'))['db'];config['redis']=_['defaults'](config[_0x0858('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0858('0x16'))[_0x0858('0x17')](socket);function respondWithStatusCode(_0x4a869f,_0x23bc2d){_0x23bc2d=_0x23bc2d||0xcc;return function(_0x69ceda){if(_0x69ceda){return _0x4a869f[_0x0858('0x18')](_0x23bc2d);}return _0x4a869f[_0x0858('0x19')](_0x23bc2d)[_0x0858('0x1a')]();};}function respondWithResult(_0x306170,_0xca6a95){_0xca6a95=_0xca6a95||0xc8;return function(_0x2ed26b){if(_0x2ed26b){return _0x306170[_0x0858('0x19')](_0xca6a95)[_0x0858('0x1b')](_0x2ed26b);}};}function respondWithFilteredResult(_0x163a6e,_0x3ad059){return function(_0x538831){if(_0x538831){var _0x2b73c2=_0x538831[_0x0858('0x1c')],_0x4d376b=_0x3ad059[_0x0858('0x1d')],_0x284ebd=_0x3ad059[_0x0858('0x1d')]+_0x3ad059['limit'],_0x37f90b;if(_0x284ebd>=_0x2b73c2){_0x284ebd=_0x2b73c2;_0x37f90b=0xc8;}else{_0x37f90b=0xce;}_0x163a6e[_0x0858('0x19')](_0x37f90b);return _0x163a6e[_0x0858('0x1e')]('Content-Range',_0x4d376b+'-'+_0x284ebd+'/'+_0x2b73c2)[_0x0858('0x1b')](_0x538831);}return null;};}function patchUpdates(_0x4896c0){return function(_0x523c04){try{jsonpatch[_0x0858('0x1f')](_0x523c04,_0x4896c0,!![]);}catch(_0x318fc8){return BPromise[_0x0858('0x20')](_0x318fc8);}return _0x523c04[_0x0858('0x21')]();};}function saveUpdates(_0x29ac2b,_0x58d7f8){return function(_0x116e45){if(_0x116e45){return _0x116e45['update'](_0x29ac2b)[_0x0858('0x22')](function(_0x5f5b52){return _0x5f5b52;});}return null;};}function removeEntity(_0xea7f7f,_0x425745){return function(_0x32d21d){if(_0x32d21d){return _0x32d21d[_0x0858('0x23')]()['then'](function(){var _0x1fac3f=_0x32d21d[_0x0858('0x24')]({'plain':!![]});var _0x38046e=_0x0858('0x25');return db[_0x0858('0x26')][_0x0858('0x23')]({'where':{'type':_0x38046e,'resourceId':_0x1fac3f['id']}})[_0x0858('0x22')](function(){return _0x32d21d;});})[_0x0858('0x22')](function(){_0xea7f7f[_0x0858('0x19')](0xcc)[_0x0858('0x1a')]();});}};}function handleEntityNotFound(_0x1256df,_0x39fb6f){return function(_0x35eb3e){if(!_0x35eb3e){_0x1256df[_0x0858('0x18')](0x194);}return _0x35eb3e;};}function handleError(_0xc45871,_0x410e7d){_0x410e7d=_0x410e7d||0x1f4;return function(_0x2607c1){logger[_0x0858('0x27')](_0x2607c1['stack']);if(_0x2607c1[_0x0858('0x28')]){delete _0x2607c1[_0x0858('0x28')];}_0xc45871[_0x0858('0x19')](_0x410e7d)[_0x0858('0x29')](_0x2607c1);};}exports[_0x0858('0x2a')]=function(_0x46d304,_0x15e94b){var _0x18c02f={},_0x59c7a6={},_0x138a63={'count':0x0,'rows':[]};var _0x6ab7c0=_[_0x0858('0x2b')](db[_0x0858('0x2c')]['rawAttributes'],function(_0x12b2c9){return{'name':_0x12b2c9[_0x0858('0x2d')],'type':_0x12b2c9['type'][_0x0858('0x2e')]};});_0x59c7a6[_0x0858('0x2f')]=_['map'](_0x6ab7c0,_0x0858('0x28'));_0x59c7a6[_0x0858('0x30')]=_[_0x0858('0x31')](_0x46d304[_0x0858('0x30')]);_0x59c7a6[_0x0858('0x32')]=_[_0x0858('0x33')](_0x59c7a6[_0x0858('0x2f')],_0x59c7a6[_0x0858('0x30')]);_0x18c02f[_0x0858('0x34')]=_['intersection'](_0x59c7a6['model'],qs[_0x0858('0x35')](_0x46d304[_0x0858('0x30')][_0x0858('0x35')]));_0x18c02f[_0x0858('0x34')]=_0x18c02f[_0x0858('0x34')][_0x0858('0x36')]?_0x18c02f[_0x0858('0x34')]:_0x59c7a6[_0x0858('0x2f')];if(!_0x46d304[_0x0858('0x30')][_0x0858('0x37')](_0x0858('0x38'))){_0x18c02f[_0x0858('0x39')]=qs[_0x0858('0x39')](_0x46d304[_0x0858('0x30')][_0x0858('0x39')]);_0x18c02f[_0x0858('0x1d')]=qs[_0x0858('0x1d')](_0x46d304[_0x0858('0x30')]['offset']);}_0x18c02f['order']=qs['sort'](_0x46d304['query'][_0x0858('0x3a')]);_0x18c02f[_0x0858('0x3b')]=qs[_0x0858('0x32')](_[_0x0858('0x3c')](_0x46d304[_0x0858('0x30')],_0x59c7a6[_0x0858('0x32')]),_0x6ab7c0);if(_0x46d304[_0x0858('0x30')][_0x0858('0x3d')]){_0x18c02f['where']=_['merge'](_0x18c02f['where'],{'$or':_[_0x0858('0x2b')](_0x6ab7c0,function(_0x262e0d){if(_0x262e0d['type']!=='VIRTUAL'){var _0x3a55dc={};_0x3a55dc[_0x262e0d[_0x0858('0x28')]]={'$like':'%'+_0x46d304[_0x0858('0x30')]['filter']+'%'};return _0x3a55dc;}})});}_0x18c02f=_[_0x0858('0x3e')]({},_0x18c02f,_0x46d304[_0x0858('0x3f')]);var _0x13784c={'where':_0x18c02f['where']};return db[_0x0858('0x2c')]['count'](_0x13784c)[_0x0858('0x22')](function(_0x2816cb){_0x138a63[_0x0858('0x1c')]=_0x2816cb;if(_0x46d304[_0x0858('0x30')][_0x0858('0x40')]){_0x18c02f['include']=[{'all':!![]}];}return db[_0x0858('0x2c')]['findAll'](_0x18c02f);})[_0x0858('0x22')](function(_0x48968a){_0x138a63[_0x0858('0x41')]=_0x48968a;return _0x138a63;})[_0x0858('0x22')](respondWithFilteredResult(_0x15e94b,_0x18c02f))[_0x0858('0x42')](handleError(_0x15e94b,null));};exports[_0x0858('0x43')]=function(_0x58ab2e,_0x1dd91c){var _0x20b9d4={'raw':!![],'where':{'id':_0x58ab2e[_0x0858('0x44')]['id']}},_0x5144d4={};_0x5144d4[_0x0858('0x2f')]=_[_0x0858('0x31')](db['FaxQueue']['rawAttributes']);_0x5144d4[_0x0858('0x30')]=_[_0x0858('0x31')](_0x58ab2e['query']);_0x5144d4[_0x0858('0x32')]=_[_0x0858('0x33')](_0x5144d4[_0x0858('0x2f')],_0x5144d4[_0x0858('0x30')]);_0x20b9d4[_0x0858('0x34')]=_['intersection'](_0x5144d4['model'],qs[_0x0858('0x35')](_0x58ab2e[_0x0858('0x30')][_0x0858('0x35')]));_0x20b9d4[_0x0858('0x34')]=_0x20b9d4[_0x0858('0x34')][_0x0858('0x36')]?_0x20b9d4[_0x0858('0x34')]:_0x5144d4[_0x0858('0x2f')];if(_0x58ab2e[_0x0858('0x30')][_0x0858('0x40')]){_0x20b9d4[_0x0858('0x45')]=[{'all':!![]}];}_0x20b9d4=_[_0x0858('0x3e')]({},_0x20b9d4,_0x58ab2e[_0x0858('0x3f')]);return db['FaxQueue'][_0x0858('0x46')](_0x20b9d4)['then'](handleEntityNotFound(_0x1dd91c,null))[_0x0858('0x22')](respondWithResult(_0x1dd91c,null))[_0x0858('0x42')](handleError(_0x1dd91c,null));};exports[_0x0858('0x47')]=function(_0x47ec83,_0x59839c){return db[_0x0858('0x2c')]['create'](_0x47ec83[_0x0858('0x48')],{})['then'](function(_0x4307b7){var _0x1cbbf2=_0x47ec83[_0x0858('0x49')][_0x0858('0x24')]({'plain':!![]});if(!_0x1cbbf2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cbbf2[_0x0858('0x4a')]===_0x0858('0x49')){var _0x2da36f=_0x4307b7[_0x0858('0x24')]({'plain':!![]});var _0x43764b=_0x0858('0x25');return db[_0x0858('0x4b')][_0x0858('0x46')]({'where':{'name':_0x43764b,'userProfileId':_0x1cbbf2[_0x0858('0x4c')]},'raw':!![]})[_0x0858('0x22')](function(_0x396831){if(_0x396831&&_0x396831[_0x0858('0x4d')]===0x0){return db[_0x0858('0x26')][_0x0858('0x47')]({'name':_0x2da36f['name'],'resourceId':_0x2da36f['id'],'type':_0x396831[_0x0858('0x28')],'sectionId':_0x396831['id']},{})[_0x0858('0x22')](function(){return _0x4307b7;});}else{return _0x4307b7;}})[_0x0858('0x42')](function(_0x20140e){logger[_0x0858('0x27')](_0x0858('0x4e'),_0x20140e);throw _0x20140e;});}return _0x4307b7;})['then'](respondWithResult(_0x59839c,0xc9))[_0x0858('0x42')](handleError(_0x59839c,null));};exports[_0x0858('0x4f')]=function(_0x5843eb,_0x473a47){if(_0x5843eb[_0x0858('0x48')]['id']){delete _0x5843eb[_0x0858('0x48')]['id'];}return db[_0x0858('0x2c')][_0x0858('0x46')]({'where':{'id':_0x5843eb[_0x0858('0x44')]['id']}})[_0x0858('0x22')](handleEntityNotFound(_0x473a47,null))['then'](saveUpdates(_0x5843eb[_0x0858('0x48')],null))[_0x0858('0x22')](respondWithResult(_0x473a47,null))[_0x0858('0x42')](handleError(_0x473a47,null));};exports[_0x0858('0x23')]=function(_0x412e45,_0x53352e){return db['FaxQueue'][_0x0858('0x46')]({'where':{'id':_0x412e45['params']['id']}})[_0x0858('0x22')](handleEntityNotFound(_0x53352e,null))[_0x0858('0x22')](removeEntity(_0x53352e,null))[_0x0858('0x42')](handleError(_0x53352e,null));};exports[_0x0858('0x50')]=function(_0x7c173,_0xe20999){return db[_0x0858('0x2c')]['describe']()['then'](respondWithResult(_0xe20999,null))[_0x0858('0x42')](handleError(_0xe20999,null));};exports[_0x0858('0x51')]=function(_0x59caa4,_0x327ab0,_0x4b5fe7){var _0x4e07a4={'raw':!![],'where':{}},_0x3887b3={},_0x1e6b7b;return db['FaxQueue'][_0x0858('0x52')]({'where':{'id':_0x59caa4['params']['id']}})['then'](handleEntityNotFound(_0x327ab0,null))[_0x0858('0x22')](function(_0x3ad02c){if(_0x3ad02c){_0x1e6b7b=_0x3ad02c[_0x0858('0x24')]({'plain':!![]});_0x3887b3[_0x0858('0x2f')]=_[_0x0858('0x31')](db['UserFaxQueue'][_0x0858('0x53')]);_0x3887b3[_0x0858('0x30')]=_[_0x0858('0x31')](_0x59caa4[_0x0858('0x30')]);_0x3887b3[_0x0858('0x32')]=_[_0x0858('0x33')](_0x3887b3[_0x0858('0x2f')],_0x3887b3[_0x0858('0x30')]);_0x4e07a4['attributes']=_[_0x0858('0x33')](_0x3887b3[_0x0858('0x2f')],qs['fields'](_0x59caa4[_0x0858('0x30')][_0x0858('0x35')]));_0x4e07a4[_0x0858('0x34')]=_0x4e07a4[_0x0858('0x34')][_0x0858('0x36')]?_0x4e07a4[_0x0858('0x34')]:_0x3887b3[_0x0858('0x2f')];if(!_0x59caa4['query'][_0x0858('0x37')](_0x0858('0x38'))){_0x4e07a4[_0x0858('0x39')]=qs[_0x0858('0x39')](_0x59caa4[_0x0858('0x30')][_0x0858('0x39')]);_0x4e07a4['offset']=qs[_0x0858('0x1d')](_0x59caa4['query']['offset']);}_0x4e07a4['order']=qs[_0x0858('0x3a')](_0x59caa4[_0x0858('0x30')]['sort']);_0x4e07a4[_0x0858('0x3b')]=qs['filters'](_[_0x0858('0x3c')](_0x59caa4[_0x0858('0x30')],_0x3887b3[_0x0858('0x32')]));_0x4e07a4[_0x0858('0x3b')][_0x0858('0x54')]=_0x3ad02c['id'];if(_0x59caa4['query']['filter']){_0x4e07a4[_0x0858('0x3b')]=_[_0x0858('0x3e')](_0x4e07a4[_0x0858('0x3b')],{'$or':_[_0x0858('0x2b')](_0x4e07a4[_0x0858('0x34')],function(_0x30e47c){var _0x3e53ae={};_0x3e53ae[_0x30e47c]={'$like':'%'+_0x59caa4[_0x0858('0x30')]['filter']+'%'};return _0x3e53ae;})});}_0x4e07a4=_[_0x0858('0x3e')]({},_0x4e07a4,_0x59caa4['options']);return db['UserFaxQueue'][_0x0858('0x55')](_0x4e07a4);}})[_0x0858('0x22')](function(_0x1dfabd){if(_0x1dfabd){return db['User'][_0x0858('0x56')]({'where':{'id':_[_0x0858('0x2b')](_0x1dfabd,_0x0858('0x57')),'role':_0x0858('0x58')},'attributes':['id',_0x0858('0x28'),'faxPause',_0x0858('0x59'),'createdAt']});}})[_0x0858('0x22')](function(_0x1f1427){if(_0x1f1427){return{'count':_0x1f1427[_0x0858('0x1c')],'rows':_[_0x0858('0x2b')](_0x1f1427[_0x0858('0x41')],function(_0x4e27f7){return{'membername':_0x4e27f7[_0x0858('0x28')],'UserId':_0x4e27f7['id'],'queue_name':_0x1e6b7b[_0x0858('0x28')],'FaxQueueId':_0x1e6b7b['id'],'interface':util[_0x0858('0x5a')](_0x0858('0x5b'),_0x0858('0x5c'),_0x4e27f7[_0x0858('0x28')]),'penalty':0x0,'paused':_0x4e27f7[_0x0858('0x5d')],'createdAt':_0x4e27f7[_0x0858('0x5e')],'updatedAt':_0x4e27f7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x327ab0,_0x4e07a4))[_0x0858('0x42')](handleError(_0x327ab0,null));};exports[_0x0858('0x5f')]=function(_0x8de23c,_0x33529a,_0x5df737){var _0x561637={};var _0x2fe267={};var _0x13b0b9;var _0x39456a;return db['FaxQueue']['findOne']({'where':{'id':_0x8de23c[_0x0858('0x44')]['id']}})['then'](handleEntityNotFound(_0x33529a,null))[_0x0858('0x22')](function(_0x1ff280){if(_0x1ff280){_0x13b0b9=_0x1ff280;_0x2fe267[_0x0858('0x2f')]=_['keys'](db['Team'][_0x0858('0x53')]);_0x2fe267[_0x0858('0x30')]=_['keys'](_0x8de23c[_0x0858('0x30')]);_0x2fe267['filters']=_[_0x0858('0x33')](_0x2fe267['model'],_0x2fe267[_0x0858('0x30')]);_0x561637[_0x0858('0x34')]=_['intersection'](_0x2fe267['model'],qs[_0x0858('0x35')](_0x8de23c[_0x0858('0x30')][_0x0858('0x35')]));_0x561637[_0x0858('0x34')]=_0x561637[_0x0858('0x34')][_0x0858('0x36')]?_0x561637[_0x0858('0x34')]:_0x2fe267[_0x0858('0x2f')];_0x561637[_0x0858('0x60')]=qs[_0x0858('0x3a')](_0x8de23c[_0x0858('0x30')][_0x0858('0x3a')]);_0x561637[_0x0858('0x3b')]=qs[_0x0858('0x32')](_[_0x0858('0x3c')](_0x8de23c['query'],_0x2fe267[_0x0858('0x32')]));if(_0x8de23c[_0x0858('0x30')][_0x0858('0x3d')]){_0x561637[_0x0858('0x3b')]=_[_0x0858('0x3e')](_0x561637[_0x0858('0x3b')],{'$or':_[_0x0858('0x2b')](_0x561637[_0x0858('0x34')],function(_0x3b4df4){var _0x36f856={};_0x36f856[_0x3b4df4]={'$like':'%'+_0x8de23c['query'][_0x0858('0x3d')]+'%'};return _0x36f856;})});}_0x561637=_[_0x0858('0x3e')]({},_0x561637,_0x8de23c['options']);return _0x13b0b9[_0x0858('0x5f')](_0x561637);}})[_0x0858('0x22')](function(_0x4f0125){if(_0x4f0125){_0x39456a=_0x4f0125['length'];if(!_0x8de23c[_0x0858('0x30')][_0x0858('0x37')]('nolimit')){_0x561637[_0x0858('0x39')]=qs['limit'](_0x8de23c['query'][_0x0858('0x39')]);_0x561637['offset']=qs[_0x0858('0x1d')](_0x8de23c['query']['offset']);}return _0x13b0b9[_0x0858('0x5f')](_0x561637);}})['then'](function(_0x4e9ff9){if(_0x4e9ff9){return _0x4e9ff9?{'count':_0x39456a,'rows':_0x4e9ff9}:null;}})['then'](respondWithResult(_0x33529a,null))[_0x0858('0x42')](handleError(_0x33529a,null));};exports['addTeams']=function(_0x184801,_0x28a782,_0x5b8d14){var _0xd45232=_0x184801[_0x0858('0x48')][_0x0858('0x61')];return db[_0x0858('0x62')]['findAll']({'where':{'id':_0xd45232},'attributes':['id'],'include':[{'model':db[_0x0858('0x63')],'as':_0x0858('0x64'),'attributes':['id',_0x0858('0x28'),_0x0858('0x65'),_0x0858('0x66'),_0x0858('0x67')],'raw':!![]}]})[_0x0858('0x22')](function(_0x29363c){if(_0x29363c){var _0x3328e6=_[_0x0858('0x68')](_0x29363c,function(_0x4d1758){var _0x184c86=_0x4d1758[_0x0858('0x24')]({'plain':!![]});return _0x184c86[_0x0858('0x64')];});return db[_0x0858('0x2c')][_0x0858('0x46')]({'where':{'id':_0x184801[_0x0858('0x44')]['id']}})[_0x0858('0x22')](function(_0x13a8c5){return db[_0x0858('0x69')]['transaction'](function(_0xf807a1){return _0x13a8c5[_0x0858('0x6a')](_0xd45232,{'transaction':_0xf807a1})[_0x0858('0x22')](function(){return BPromise[_0x0858('0x6b')](_0x3328e6,function(_0x3e9109){return db['UserFaxQueue'][_0x0858('0x6c')]({'where':{'UserId':_0x3e9109['id'],'FaxQueueId':_0x184801[_0x0858('0x44')]['id']},'transaction':_0xf807a1});});})[_0x0858('0x22')](function(){_0x3328e6['forEach'](function(_0x4c3023){socket['emit'](_0x0858('0x6d'),{'UserId':_0x4c3023['id'],'FaxQueueId':_0x13a8c5['id']});});});});});}})[_0x0858('0x22')](respondWithStatusCode(_0x28a782,null))[_0x0858('0x42')](handleError(_0x28a782,null));};exports[_0x0858('0x6e')]=function(_0x1731cc,_0x110a4d,_0x176f09){return db[_0x0858('0x62')]['findAll']({'where':{'id':_0x1731cc[_0x0858('0x30')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0858('0x64'),'attributes':['id'],'raw':!![]}]})[_0x0858('0x22')](handleEntityNotFound(_0x110a4d,null))['then'](function(_0x230565){var _0x13615d=_[_0x0858('0x2b')](_0x230565,'id');var _0x45f4ad=[];var _0xa2fcd1=[];var _0x28feef=squel[_0x0858('0x6f')]();_0x28feef[_0x0858('0x70')](_0x0858('0x71'))[_0x0858('0x72')](_0x0858('0x73'),'tq')[_0x0858('0x74')](_0x0858('0x75'),'ut',_0x0858('0x76'))[_0x0858('0x3b')](_0x0858('0x77'),_0x1731cc[_0x0858('0x44')]['id']);for(var _0x2be2a6=0x0;_0x2be2a6<_0x230565['length'];_0x2be2a6+=0x1){let _0x5e63f1=_0x230565[_0x2be2a6];for(var _0x3dca3d=0x0;_0x3dca3d<_0x5e63f1[_0x0858('0x64')][_0x0858('0x36')];_0x3dca3d+=0x1){let _0x66adc5=_0x5e63f1[_0x0858('0x64')][_0x3dca3d];var _0x192c56=_0x28feef[_0x0858('0x78')]();_0x192c56[_0x0858('0x3b')](_0x0858('0x79'),_0x66adc5['id']);_0xa2fcd1['push'](db[_0x0858('0x69')][_0x0858('0x30')](_0x192c56[_0x0858('0x7a')](),{'type':db['sequelize'][_0x0858('0x7b')][_0x0858('0x7c')]})[_0x0858('0x22')](function(_0x43bc96){if(_0x43bc96['length']===0x1){return _0x66adc5['id'];}else{var _0x304523=_[_0x0858('0x7d')](_['map'](_0x43bc96,_0x0858('0x7e')),function(_0x23e76b){return _[_0x0858('0x7f')](_0x13615d,_0x23e76b);});if(_0x304523){return _0x66adc5['id'];}}}));}}return BPromise[_0x0858('0x80')](_0xa2fcd1)[_0x0858('0x22')](function(_0x35eea9){_0x45f4ad=_(_0x45f4ad)['union'](_0x35eea9)[_0x0858('0x81')]()[_0x0858('0x82')]();return db[_0x0858('0x2c')][_0x0858('0x46')]({'where':{'id':_0x1731cc[_0x0858('0x44')]['id']}})[_0x0858('0x22')](function(_0xac9320){return db[_0x0858('0x69')][_0x0858('0x83')](function(_0x5567b6){return _0xac9320[_0x0858('0x6e')](_0x1731cc['query']['ids'],{'transaction':_0x5567b6})[_0x0858('0x22')](function(){if(!_[_0x0858('0x84')](_0x45f4ad)){return _0xac9320['removeAgents'](_0x45f4ad,{'transaction':_0x5567b6});}})[_0x0858('0x22')](function(){_0x45f4ad[_0x0858('0x85')](function(_0x56f7a0){socket[_0x0858('0x86')](_0x0858('0x87'),{'UserId':_0x56f7a0,'FaxQueueId':_0xac9320['id']});});});});});});})[_0x0858('0x22')](respondWithStatusCode(_0x110a4d,null))['catch'](handleError(_0x110a4d,null));};exports[_0x0858('0x88')]=function(_0x42dac6,_0x154e8f,_0x40c70c){return db[_0x0858('0x2c')][_0x0858('0x46')]({'where':{'id':_0x42dac6[_0x0858('0x44')]['id']}})[_0x0858('0x22')](handleEntityNotFound(_0x154e8f,null))['then'](function(_0x37af2a){if(_0x37af2a){return _0x37af2a['addAgents'](_0x42dac6[_0x0858('0x48')][_0x0858('0x61')],_[_0x0858('0x89')](_0x42dac6['body'],[_0x0858('0x61'),'id'])||{})[_0x0858('0x8a')](function(_0x393424){for(var _0x504aca=0x0;_0x504aca<_0x42dac6[_0x0858('0x48')]['ids']['length'];_0x504aca+=0x1){socket[_0x0858('0x86')](_0x0858('0x6d'),{'UserId':_0x42dac6[_0x0858('0x48')][_0x0858('0x61')][_0x504aca],'FaxQueueId':_0x42dac6['params']['id']});}return _0x393424;});}})[_0x0858('0x22')](respondWithResult(_0x154e8f,null))['catch'](handleError(_0x154e8f,null));};exports[_0x0858('0x8b')]=function(_0x4962e6,_0x635fab,_0x219bbd){return db[_0x0858('0x2c')][_0x0858('0x46')]({'where':{'id':_0x4962e6[_0x0858('0x44')]['id']}})[_0x0858('0x22')](handleEntityNotFound(_0x635fab,null))[_0x0858('0x22')](function(_0x338b15){if(_0x338b15){return _0x338b15[_0x0858('0x8b')](_0x4962e6[_0x0858('0x30')][_0x0858('0x61')])['then'](function(){if(_[_0x0858('0x8c')](_0x4962e6[_0x0858('0x30')]['ids'])){for(var _0x1c8584=0x0;_0x1c8584<_0x4962e6[_0x0858('0x30')][_0x0858('0x61')][_0x0858('0x36')];_0x1c8584+=0x1){socket[_0x0858('0x86')](_0x0858('0x87'),{'UserId':Number(_0x4962e6[_0x0858('0x30')][_0x0858('0x61')][_0x1c8584]),'FaxQueueId':Number(_0x4962e6[_0x0858('0x44')]['id'])});}}else{socket['emit'](_0x0858('0x87'),{'UserId':Number(_0x4962e6['query'][_0x0858('0x61')]),'FaxQueueId':Number(_0x4962e6[_0x0858('0x44')]['id'])});}});}})[_0x0858('0x22')](respondWithStatusCode(_0x635fab,null))[_0x0858('0x42')](handleError(_0x635fab,null));};exports[_0x0858('0x8d')]=function(_0x30b99b,_0x55ae4f,_0xd6937d){var _0x5eea28={};var _0x370804={};var _0x1a5964;var _0x53e363;return db[_0x0858('0x2c')]['findOne']({'where':{'id':_0x30b99b[_0x0858('0x44')]['id']}})[_0x0858('0x22')](handleEntityNotFound(_0x55ae4f,null))[_0x0858('0x22')](function(_0x2d7640){if(_0x2d7640){_0x1a5964=_0x2d7640;_0x370804[_0x0858('0x2f')]=_[_0x0858('0x31')](db[_0x0858('0x63')][_0x0858('0x53')]);_0x370804['query']=_[_0x0858('0x31')](_0x30b99b[_0x0858('0x30')]);_0x370804[_0x0858('0x32')]=_[_0x0858('0x33')](_0x370804['model'],_0x370804[_0x0858('0x30')]);_0x5eea28[_0x0858('0x34')]=_[_0x0858('0x33')](_0x370804[_0x0858('0x2f')],qs[_0x0858('0x35')](_0x30b99b['query'][_0x0858('0x35')]));_0x5eea28[_0x0858('0x34')]=_0x5eea28[_0x0858('0x34')][_0x0858('0x36')]?_0x5eea28[_0x0858('0x34')]:_0x370804[_0x0858('0x2f')];_0x5eea28[_0x0858('0x60')]=qs[_0x0858('0x3a')](_0x30b99b[_0x0858('0x30')]['sort']);_0x5eea28['where']=qs[_0x0858('0x32')](_[_0x0858('0x3c')](_0x30b99b[_0x0858('0x30')],_0x370804['filters']));if(_0x30b99b[_0x0858('0x30')]['filter']){_0x5eea28[_0x0858('0x3b')]=_[_0x0858('0x3e')](_0x5eea28['where'],{'$or':_[_0x0858('0x2b')](_0x5eea28[_0x0858('0x34')],function(_0x5ed079){var _0x108768={};_0x108768[_0x5ed079]={'$like':'%'+_0x30b99b[_0x0858('0x30')][_0x0858('0x3d')]+'%'};return _0x108768;})});}_0x5eea28=_['merge']({},_0x5eea28,_0x30b99b[_0x0858('0x3f')]);return _0x1a5964['getAgents'](_0x5eea28);}})[_0x0858('0x22')](function(_0x2c226f){if(_0x2c226f){_0x53e363=_0x2c226f[_0x0858('0x36')];if(!_0x30b99b[_0x0858('0x30')]['hasOwnProperty'](_0x0858('0x38'))){_0x5eea28[_0x0858('0x39')]=qs[_0x0858('0x39')](_0x30b99b[_0x0858('0x30')]['limit']);_0x5eea28[_0x0858('0x1d')]=qs[_0x0858('0x1d')](_0x30b99b[_0x0858('0x30')][_0x0858('0x1d')]);}return _0x1a5964[_0x0858('0x8d')](_0x5eea28);}})[_0x0858('0x22')](function(_0x4e5e5a){if(_0x4e5e5a){return _0x4e5e5a?{'count':_0x53e363,'rows':_0x4e5e5a}:null;}})[_0x0858('0x22')](respondWithResult(_0x55ae4f,null))[_0x0858('0x42')](handleError(_0x55ae4f,null));}; \ No newline at end of file +var _0xc638=['moment','bluebird','mustache','util','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','json','count','offset','set','Content-Range','apply','update','then','destroy','FaxQueues','end','error','stack','name','FaxQueue','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','userFaxQueue:save','select','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','includes','all','value','removeTeams','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','request-promise'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0xc638,0x112));var _0x8c63=function(_0x219c8c,_0x407e2e){_0x219c8c=_0x219c8c-0x0;var _0x3e57d1=_0xc638[_0x219c8c];return _0x3e57d1;};'use strict';var pdf=require(_0x8c63('0x0'));var emlformat=require(_0x8c63('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8c63('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c63('0x3'));var moment=require(_0x8c63('0x4'));var BPromise=require(_0x8c63('0x5'));var Mustache=require(_0x8c63('0x6'));var util=require(_0x8c63('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8c63('0x8'));var squel=require(_0x8c63('0x9'));var crypto=require(_0x8c63('0xa'));var jsforce=require(_0x8c63('0xb'));var deskjs=require(_0x8c63('0xc'));var toCsv=require(_0x8c63('0xd'));var querystring=require(_0x8c63('0xe'));var Papa=require(_0x8c63('0xf'));var Redis=require(_0x8c63('0x10'));var authService=require(_0x8c63('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8c63('0x12'));var hardwareService=require(_0x8c63('0x13'));var logger=require(_0x8c63('0x14'))('api');var utils=require(_0x8c63('0x15'));var config=require(_0x8c63('0x16'));var db=require(_0x8c63('0x17'))['db'];config[_0x8c63('0x18')]=_[_0x8c63('0x19')](config['redis'],{'host':_0x8c63('0x1a'),'port':0x18eb});var socket=require(_0x8c63('0x1b'))(new Redis(config[_0x8c63('0x18')]));require(_0x8c63('0x1c'))['register'](socket);function respondWithStatusCode(_0x237fd5,_0x4e02ba){_0x4e02ba=_0x4e02ba||0xcc;return function(_0x3c9a1e){if(_0x3c9a1e){return _0x237fd5[_0x8c63('0x1d')](_0x4e02ba);}return _0x237fd5[_0x8c63('0x1e')](_0x4e02ba)['end']();};}function respondWithResult(_0x5e59be,_0x111164){_0x111164=_0x111164||0xc8;return function(_0x407b64){if(_0x407b64){return _0x5e59be[_0x8c63('0x1e')](_0x111164)[_0x8c63('0x1f')](_0x407b64);}};}function respondWithFilteredResult(_0x1bccf1,_0x5af29c){return function(_0x5b87fa){if(_0x5b87fa){var _0x199c30=_0x5b87fa[_0x8c63('0x20')],_0x58a381=_0x5af29c[_0x8c63('0x21')],_0x1f2d0e=_0x5af29c['offset']+_0x5af29c['limit'],_0x16d528;if(_0x1f2d0e>=_0x199c30){_0x1f2d0e=_0x199c30;_0x16d528=0xc8;}else{_0x16d528=0xce;}_0x1bccf1[_0x8c63('0x1e')](_0x16d528);return _0x1bccf1[_0x8c63('0x22')](_0x8c63('0x23'),_0x58a381+'-'+_0x1f2d0e+'/'+_0x199c30)['json'](_0x5b87fa);}return null;};}function patchUpdates(_0x32febd){return function(_0x241994){try{jsonpatch[_0x8c63('0x24')](_0x241994,_0x32febd,!![]);}catch(_0x30faac){return BPromise['reject'](_0x30faac);}return _0x241994['save']();};}function saveUpdates(_0x4f40df,_0x51db3e){return function(_0x2313cf){if(_0x2313cf){return _0x2313cf[_0x8c63('0x25')](_0x4f40df)[_0x8c63('0x26')](function(_0x48e1f9){return _0x48e1f9;});}return null;};}function removeEntity(_0x162832,_0x1c99de){return function(_0x16badb){if(_0x16badb){return _0x16badb[_0x8c63('0x27')]()[_0x8c63('0x26')](function(){var _0x527aa0=_0x16badb['get']({'plain':!![]});var _0x448450=_0x8c63('0x28');return db['UserProfileResource'][_0x8c63('0x27')]({'where':{'type':_0x448450,'resourceId':_0x527aa0['id']}})[_0x8c63('0x26')](function(){return _0x16badb;});})[_0x8c63('0x26')](function(){_0x162832['status'](0xcc)[_0x8c63('0x29')]();});}};}function handleEntityNotFound(_0x89c1e6,_0x4d2dab){return function(_0x366060){if(!_0x366060){_0x89c1e6[_0x8c63('0x1d')](0x194);}return _0x366060;};}function handleError(_0x140c6e,_0x6d600c){_0x6d600c=_0x6d600c||0x1f4;return function(_0x17e7e5){logger[_0x8c63('0x2a')](_0x17e7e5[_0x8c63('0x2b')]);if(_0x17e7e5[_0x8c63('0x2c')]){delete _0x17e7e5[_0x8c63('0x2c')];}_0x140c6e[_0x8c63('0x1e')](_0x6d600c)['send'](_0x17e7e5);};}exports['index']=function(_0x1a01d9,_0x786966){var _0x15a7f1={},_0x395a93={},_0x4a83a6={'count':0x0,'rows':[]};var _0x36944b=_['map'](db[_0x8c63('0x2d')][_0x8c63('0x2e')],function(_0x183af2){return{'name':_0x183af2[_0x8c63('0x2f')],'type':_0x183af2[_0x8c63('0x30')]['key']};});_0x395a93[_0x8c63('0x31')]=_['map'](_0x36944b,_0x8c63('0x2c'));_0x395a93['query']=_[_0x8c63('0x32')](_0x1a01d9[_0x8c63('0x33')]);_0x395a93[_0x8c63('0x34')]=_['intersection'](_0x395a93[_0x8c63('0x31')],_0x395a93[_0x8c63('0x33')]);_0x15a7f1['attributes']=_[_0x8c63('0x35')](_0x395a93['model'],qs[_0x8c63('0x36')](_0x1a01d9['query']['fields']));_0x15a7f1[_0x8c63('0x37')]=_0x15a7f1[_0x8c63('0x37')][_0x8c63('0x38')]?_0x15a7f1[_0x8c63('0x37')]:_0x395a93[_0x8c63('0x31')];if(!_0x1a01d9[_0x8c63('0x33')][_0x8c63('0x39')](_0x8c63('0x3a'))){_0x15a7f1[_0x8c63('0x3b')]=qs[_0x8c63('0x3b')](_0x1a01d9[_0x8c63('0x33')][_0x8c63('0x3b')]);_0x15a7f1[_0x8c63('0x21')]=qs[_0x8c63('0x21')](_0x1a01d9[_0x8c63('0x33')][_0x8c63('0x21')]);}_0x15a7f1[_0x8c63('0x3c')]=qs[_0x8c63('0x3d')](_0x1a01d9[_0x8c63('0x33')][_0x8c63('0x3d')]);_0x15a7f1[_0x8c63('0x3e')]=qs[_0x8c63('0x34')](_[_0x8c63('0x3f')](_0x1a01d9[_0x8c63('0x33')],_0x395a93[_0x8c63('0x34')]),_0x36944b);if(_0x1a01d9['query'][_0x8c63('0x40')]){_0x15a7f1[_0x8c63('0x3e')]=_[_0x8c63('0x41')](_0x15a7f1[_0x8c63('0x3e')],{'$or':_[_0x8c63('0x42')](_0x36944b,function(_0x3b4f3c){if(_0x3b4f3c[_0x8c63('0x30')]!==_0x8c63('0x43')){var _0x397aca={};_0x397aca[_0x3b4f3c[_0x8c63('0x2c')]]={'$like':'%'+_0x1a01d9['query'][_0x8c63('0x40')]+'%'};return _0x397aca;}})});}_0x15a7f1=_[_0x8c63('0x41')]({},_0x15a7f1,_0x1a01d9[_0x8c63('0x44')]);var _0x1cb9ca={'where':_0x15a7f1[_0x8c63('0x3e')]};return db['FaxQueue'][_0x8c63('0x20')](_0x1cb9ca)[_0x8c63('0x26')](function(_0x328f83){_0x4a83a6[_0x8c63('0x20')]=_0x328f83;if(_0x1a01d9[_0x8c63('0x33')][_0x8c63('0x45')]){_0x15a7f1[_0x8c63('0x46')]=[{'all':!![]}];}return db[_0x8c63('0x2d')][_0x8c63('0x47')](_0x15a7f1);})['then'](function(_0x27c1e0){_0x4a83a6[_0x8c63('0x48')]=_0x27c1e0;return _0x4a83a6;})['then'](respondWithFilteredResult(_0x786966,_0x15a7f1))[_0x8c63('0x49')](handleError(_0x786966,null));};exports[_0x8c63('0x4a')]=function(_0x3dbb7e,_0x2d3ee6){var _0x53c761={'raw':!![],'where':{'id':_0x3dbb7e[_0x8c63('0x4b')]['id']}},_0x1c600f={};_0x1c600f[_0x8c63('0x31')]=_[_0x8c63('0x32')](db[_0x8c63('0x2d')][_0x8c63('0x2e')]);_0x1c600f['query']=_['keys'](_0x3dbb7e[_0x8c63('0x33')]);_0x1c600f[_0x8c63('0x34')]=_[_0x8c63('0x35')](_0x1c600f[_0x8c63('0x31')],_0x1c600f[_0x8c63('0x33')]);_0x53c761['attributes']=_['intersection'](_0x1c600f[_0x8c63('0x31')],qs[_0x8c63('0x36')](_0x3dbb7e[_0x8c63('0x33')]['fields']));_0x53c761[_0x8c63('0x37')]=_0x53c761['attributes']['length']?_0x53c761[_0x8c63('0x37')]:_0x1c600f[_0x8c63('0x31')];if(_0x3dbb7e['query'][_0x8c63('0x45')]){_0x53c761[_0x8c63('0x46')]=[{'all':!![]}];}_0x53c761=_[_0x8c63('0x41')]({},_0x53c761,_0x3dbb7e[_0x8c63('0x44')]);return db[_0x8c63('0x2d')][_0x8c63('0x4c')](_0x53c761)[_0x8c63('0x26')](handleEntityNotFound(_0x2d3ee6,null))[_0x8c63('0x26')](respondWithResult(_0x2d3ee6,null))[_0x8c63('0x49')](handleError(_0x2d3ee6,null));};exports[_0x8c63('0x4d')]=function(_0x56213a,_0x32e7e8){return db['FaxQueue'][_0x8c63('0x4d')](_0x56213a[_0x8c63('0x4e')],{})[_0x8c63('0x26')](function(_0x11aa92){var _0x599055=_0x56213a[_0x8c63('0x4f')][_0x8c63('0x50')]({'plain':!![]});if(!_0x599055)throw new Error(_0x8c63('0x51'));if(_0x599055[_0x8c63('0x52')]==='user'){var _0x3fd314=_0x11aa92[_0x8c63('0x50')]({'plain':!![]});var _0xae26d1=_0x8c63('0x28');return db[_0x8c63('0x53')][_0x8c63('0x4c')]({'where':{'name':_0xae26d1,'userProfileId':_0x599055['userProfileId']},'raw':!![]})[_0x8c63('0x26')](function(_0x4d4050){if(_0x4d4050&&_0x4d4050[_0x8c63('0x54')]===0x0){return db['UserProfileResource'][_0x8c63('0x4d')]({'name':_0x3fd314[_0x8c63('0x2c')],'resourceId':_0x3fd314['id'],'type':_0x4d4050[_0x8c63('0x2c')],'sectionId':_0x4d4050['id']},{})[_0x8c63('0x26')](function(){return _0x11aa92;});}else{return _0x11aa92;}})[_0x8c63('0x49')](function(_0x499c90){logger[_0x8c63('0x2a')](_0x8c63('0x55'),_0x499c90);throw _0x499c90;});}return _0x11aa92;})[_0x8c63('0x26')](respondWithResult(_0x32e7e8,0xc9))[_0x8c63('0x49')](handleError(_0x32e7e8,null));};exports['update']=function(_0x4e6229,_0x589500){if(_0x4e6229[_0x8c63('0x4e')]['id']){delete _0x4e6229[_0x8c63('0x4e')]['id'];}return db[_0x8c63('0x2d')][_0x8c63('0x4c')]({'where':{'id':_0x4e6229[_0x8c63('0x4b')]['id']}})[_0x8c63('0x26')](handleEntityNotFound(_0x589500,null))['then'](saveUpdates(_0x4e6229[_0x8c63('0x4e')],null))['then'](respondWithResult(_0x589500,null))[_0x8c63('0x49')](handleError(_0x589500,null));};exports[_0x8c63('0x27')]=function(_0x1e4b38,_0x222e9b){return db['FaxQueue'][_0x8c63('0x4c')]({'where':{'id':_0x1e4b38['params']['id']}})[_0x8c63('0x26')](handleEntityNotFound(_0x222e9b,null))[_0x8c63('0x26')](removeEntity(_0x222e9b,null))['catch'](handleError(_0x222e9b,null));};exports['describe']=function(_0x553a7e,_0x198946){return db['FaxQueue'][_0x8c63('0x56')]()[_0x8c63('0x26')](respondWithResult(_0x198946,null))[_0x8c63('0x49')](handleError(_0x198946,null));};exports[_0x8c63('0x57')]=function(_0x4fccc5,_0x20eee1,_0x5db747){var _0x5d26fe={'raw':!![],'where':{}},_0x54e85a={},_0x40f21f;return db[_0x8c63('0x2d')][_0x8c63('0x58')]({'where':{'id':_0x4fccc5[_0x8c63('0x4b')]['id']}})[_0x8c63('0x26')](handleEntityNotFound(_0x20eee1,null))[_0x8c63('0x26')](function(_0x4b6c6b){if(_0x4b6c6b){_0x40f21f=_0x4b6c6b[_0x8c63('0x50')]({'plain':!![]});_0x54e85a['model']=_[_0x8c63('0x32')](db[_0x8c63('0x59')][_0x8c63('0x2e')]);_0x54e85a['query']=_['keys'](_0x4fccc5[_0x8c63('0x33')]);_0x54e85a[_0x8c63('0x34')]=_['intersection'](_0x54e85a[_0x8c63('0x31')],_0x54e85a[_0x8c63('0x33')]);_0x5d26fe[_0x8c63('0x37')]=_['intersection'](_0x54e85a['model'],qs['fields'](_0x4fccc5[_0x8c63('0x33')][_0x8c63('0x36')]));_0x5d26fe['attributes']=_0x5d26fe[_0x8c63('0x37')]['length']?_0x5d26fe[_0x8c63('0x37')]:_0x54e85a[_0x8c63('0x31')];if(!_0x4fccc5['query'][_0x8c63('0x39')](_0x8c63('0x3a'))){_0x5d26fe[_0x8c63('0x3b')]=qs[_0x8c63('0x3b')](_0x4fccc5[_0x8c63('0x33')][_0x8c63('0x3b')]);_0x5d26fe[_0x8c63('0x21')]=qs['offset'](_0x4fccc5['query'][_0x8c63('0x21')]);}_0x5d26fe[_0x8c63('0x3c')]=qs[_0x8c63('0x3d')](_0x4fccc5['query'][_0x8c63('0x3d')]);_0x5d26fe[_0x8c63('0x3e')]=qs['filters'](_[_0x8c63('0x3f')](_0x4fccc5[_0x8c63('0x33')],_0x54e85a[_0x8c63('0x34')]));_0x5d26fe[_0x8c63('0x3e')][_0x8c63('0x5a')]=_0x4b6c6b['id'];if(_0x4fccc5[_0x8c63('0x33')][_0x8c63('0x40')]){_0x5d26fe[_0x8c63('0x3e')]=_[_0x8c63('0x41')](_0x5d26fe[_0x8c63('0x3e')],{'$or':_[_0x8c63('0x42')](_0x5d26fe[_0x8c63('0x37')],function(_0x1ff335){var _0x1e76b5={};_0x1e76b5[_0x1ff335]={'$like':'%'+_0x4fccc5[_0x8c63('0x33')][_0x8c63('0x40')]+'%'};return _0x1e76b5;})});}_0x5d26fe=_['merge']({},_0x5d26fe,_0x4fccc5[_0x8c63('0x44')]);return db['UserFaxQueue'][_0x8c63('0x47')](_0x5d26fe);}})[_0x8c63('0x26')](function(_0x2d8039){if(_0x2d8039){return db[_0x8c63('0x5b')][_0x8c63('0x5c')]({'where':{'id':_['map'](_0x2d8039,_0x8c63('0x5d')),'role':_0x8c63('0x5e')},'attributes':['id',_0x8c63('0x2c'),_0x8c63('0x5f'),_0x8c63('0x60'),_0x8c63('0x61')]});}})[_0x8c63('0x26')](function(_0x5a0e2c){if(_0x5a0e2c){return{'count':_0x5a0e2c[_0x8c63('0x20')],'rows':_[_0x8c63('0x42')](_0x5a0e2c[_0x8c63('0x48')],function(_0x346d98){return{'membername':_0x346d98[_0x8c63('0x2c')],'UserId':_0x346d98['id'],'queue_name':_0x40f21f['name'],'FaxQueueId':_0x40f21f['id'],'interface':util[_0x8c63('0x62')](_0x8c63('0x63'),_0x8c63('0x64'),_0x346d98[_0x8c63('0x2c')]),'penalty':0x0,'paused':_0x346d98[_0x8c63('0x5f')],'createdAt':_0x346d98[_0x8c63('0x61')],'updatedAt':_0x346d98['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8c63('0x26')](respondWithFilteredResult(_0x20eee1,_0x5d26fe))[_0x8c63('0x49')](handleError(_0x20eee1,null));};exports[_0x8c63('0x65')]=function(_0x4963f6,_0x514f21,_0x29d43b){var _0x5ddf9c={};var _0x1b97c1={};var _0x13d049;var _0x3093c2;return db[_0x8c63('0x2d')][_0x8c63('0x58')]({'where':{'id':_0x4963f6[_0x8c63('0x4b')]['id']}})[_0x8c63('0x26')](handleEntityNotFound(_0x514f21,null))[_0x8c63('0x26')](function(_0x2db96d){if(_0x2db96d){_0x13d049=_0x2db96d;_0x1b97c1[_0x8c63('0x31')]=_[_0x8c63('0x32')](db[_0x8c63('0x66')][_0x8c63('0x2e')]);_0x1b97c1[_0x8c63('0x33')]=_[_0x8c63('0x32')](_0x4963f6[_0x8c63('0x33')]);_0x1b97c1[_0x8c63('0x34')]=_[_0x8c63('0x35')](_0x1b97c1[_0x8c63('0x31')],_0x1b97c1['query']);_0x5ddf9c['attributes']=_[_0x8c63('0x35')](_0x1b97c1[_0x8c63('0x31')],qs['fields'](_0x4963f6[_0x8c63('0x33')][_0x8c63('0x36')]));_0x5ddf9c[_0x8c63('0x37')]=_0x5ddf9c['attributes'][_0x8c63('0x38')]?_0x5ddf9c[_0x8c63('0x37')]:_0x1b97c1['model'];_0x5ddf9c[_0x8c63('0x3c')]=qs['sort'](_0x4963f6[_0x8c63('0x33')]['sort']);_0x5ddf9c['where']=qs[_0x8c63('0x34')](_[_0x8c63('0x3f')](_0x4963f6[_0x8c63('0x33')],_0x1b97c1[_0x8c63('0x34')]));if(_0x4963f6[_0x8c63('0x33')][_0x8c63('0x40')]){_0x5ddf9c['where']=_[_0x8c63('0x41')](_0x5ddf9c[_0x8c63('0x3e')],{'$or':_['map'](_0x5ddf9c[_0x8c63('0x37')],function(_0x4a5bc5){var _0xdfc9e1={};_0xdfc9e1[_0x4a5bc5]={'$like':'%'+_0x4963f6[_0x8c63('0x33')]['filter']+'%'};return _0xdfc9e1;})});}_0x5ddf9c=_[_0x8c63('0x41')]({},_0x5ddf9c,_0x4963f6[_0x8c63('0x44')]);return _0x13d049[_0x8c63('0x65')](_0x5ddf9c);}})[_0x8c63('0x26')](function(_0x3dc4b3){if(_0x3dc4b3){_0x3093c2=_0x3dc4b3[_0x8c63('0x38')];if(!_0x4963f6[_0x8c63('0x33')][_0x8c63('0x39')]('nolimit')){_0x5ddf9c[_0x8c63('0x3b')]=qs[_0x8c63('0x3b')](_0x4963f6[_0x8c63('0x33')]['limit']);_0x5ddf9c[_0x8c63('0x21')]=qs[_0x8c63('0x21')](_0x4963f6[_0x8c63('0x33')]['offset']);}return _0x13d049[_0x8c63('0x65')](_0x5ddf9c);}})[_0x8c63('0x26')](function(_0x4949fc){if(_0x4949fc){return _0x4949fc?{'count':_0x3093c2,'rows':_0x4949fc}:null;}})['then'](respondWithResult(_0x514f21,null))[_0x8c63('0x49')](handleError(_0x514f21,null));};exports[_0x8c63('0x67')]=function(_0x3468b9,_0x108f7d,_0x27b7db){var _0x4971db=_0x3468b9[_0x8c63('0x4e')][_0x8c63('0x68')];return db[_0x8c63('0x66')][_0x8c63('0x47')]({'where':{'id':_0x4971db},'attributes':['id'],'include':[{'model':db[_0x8c63('0x5b')],'as':_0x8c63('0x69'),'attributes':['id',_0x8c63('0x2c'),_0x8c63('0x6a'),_0x8c63('0x6b'),_0x8c63('0x6c')],'raw':!![]}]})['then'](function(_0x8d24ee){if(_0x8d24ee){var _0xd3c84d=_[_0x8c63('0x6d')](_0x8d24ee,function(_0xf0d4a9){var _0x4944ac=_0xf0d4a9['get']({'plain':!![]});return _0x4944ac[_0x8c63('0x69')];});return db[_0x8c63('0x2d')][_0x8c63('0x4c')]({'where':{'id':_0x3468b9['params']['id']}})['then'](function(_0x20e8da){return db['sequelize'][_0x8c63('0x6e')](function(_0x299c00){return _0x20e8da['addTeams'](_0x4971db,{'transaction':_0x299c00})[_0x8c63('0x26')](function(){return BPromise[_0x8c63('0x6f')](_0xd3c84d,function(_0x2f5c77){return db['UserFaxQueue'][_0x8c63('0x70')]({'where':{'UserId':_0x2f5c77['id'],'FaxQueueId':_0x3468b9[_0x8c63('0x4b')]['id']},'transaction':_0x299c00});});})['then'](function(){_0xd3c84d[_0x8c63('0x71')](function(_0xe93d1d){socket['emit'](_0x8c63('0x72'),{'UserId':_0xe93d1d['id'],'FaxQueueId':_0x20e8da['id']});});});});});}})['then'](respondWithStatusCode(_0x108f7d,null))[_0x8c63('0x49')](handleError(_0x108f7d,null));};exports['removeTeams']=function(_0x47bffc,_0x23418c,_0x2904a8){return db[_0x8c63('0x66')][_0x8c63('0x47')]({'where':{'id':_0x47bffc['query'][_0x8c63('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8c63('0x69'),'attributes':['id'],'raw':!![]}]})[_0x8c63('0x26')](handleEntityNotFound(_0x23418c,null))[_0x8c63('0x26')](function(_0x3ee85c){var _0x45bcee=_[_0x8c63('0x42')](_0x3ee85c,'id');var _0x2ef88a=[];var _0x4975af=[];var _0x4ea380=squel[_0x8c63('0x73')]();_0x4ea380['field']('tq.TeamId')[_0x8c63('0x74')](_0x8c63('0x75'),'tq')[_0x8c63('0x76')](_0x8c63('0x77'),'ut',_0x8c63('0x78'))[_0x8c63('0x3e')](_0x8c63('0x79'),_0x47bffc[_0x8c63('0x4b')]['id']);for(var _0x3aaf45=0x0;_0x3aaf45<_0x3ee85c['length'];_0x3aaf45+=0x1){let _0xfb768f=_0x3ee85c[_0x3aaf45];for(var _0x3943dd=0x0;_0x3943dd<_0xfb768f[_0x8c63('0x69')][_0x8c63('0x38')];_0x3943dd+=0x1){let _0x3d14dd=_0xfb768f[_0x8c63('0x69')][_0x3943dd];var _0x363f86=_0x4ea380['clone']();_0x363f86[_0x8c63('0x3e')](_0x8c63('0x7a'),_0x3d14dd['id']);_0x4975af['push'](db[_0x8c63('0x7b')][_0x8c63('0x33')](_0x363f86[_0x8c63('0x7c')](),{'type':db[_0x8c63('0x7b')][_0x8c63('0x7d')][_0x8c63('0x7e')]})[_0x8c63('0x26')](function(_0x375bdb){if(_0x375bdb[_0x8c63('0x38')]===0x1){return _0x3d14dd['id'];}else{var _0x53867c=_['every'](_[_0x8c63('0x42')](_0x375bdb,'TeamId'),function(_0x16aa31){return _[_0x8c63('0x7f')](_0x45bcee,_0x16aa31);});if(_0x53867c){return _0x3d14dd['id'];}}}));}}return BPromise[_0x8c63('0x80')](_0x4975af)[_0x8c63('0x26')](function(_0x471d9e){_0x2ef88a=_(_0x2ef88a)['union'](_0x471d9e)['compact']()[_0x8c63('0x81')]();return db[_0x8c63('0x2d')][_0x8c63('0x4c')]({'where':{'id':_0x47bffc[_0x8c63('0x4b')]['id']}})[_0x8c63('0x26')](function(_0x48767b){return db[_0x8c63('0x7b')][_0x8c63('0x6e')](function(_0x303e07){return _0x48767b[_0x8c63('0x82')](_0x47bffc['query'][_0x8c63('0x68')],{'transaction':_0x303e07})[_0x8c63('0x26')](function(){if(!_['isEmpty'](_0x2ef88a)){return _0x48767b[_0x8c63('0x83')](_0x2ef88a,{'transaction':_0x303e07});}})[_0x8c63('0x26')](function(){_0x2ef88a[_0x8c63('0x71')](function(_0x595d39){socket[_0x8c63('0x84')](_0x8c63('0x85'),{'UserId':_0x595d39,'FaxQueueId':_0x48767b['id']});});});});});});})[_0x8c63('0x26')](respondWithStatusCode(_0x23418c,null))[_0x8c63('0x49')](handleError(_0x23418c,null));};exports[_0x8c63('0x86')]=function(_0x2e1535,_0x15a2c5,_0xfd5be6){return db[_0x8c63('0x2d')]['find']({'where':{'id':_0x2e1535[_0x8c63('0x4b')]['id']}})[_0x8c63('0x26')](handleEntityNotFound(_0x15a2c5,null))[_0x8c63('0x26')](function(_0x5efc1f){if(_0x5efc1f){return _0x5efc1f[_0x8c63('0x86')](_0x2e1535[_0x8c63('0x4e')][_0x8c63('0x68')],_[_0x8c63('0x87')](_0x2e1535[_0x8c63('0x4e')],[_0x8c63('0x68'),'id'])||{})[_0x8c63('0x88')](function(_0x257156){for(var _0x501618=0x0;_0x501618<_0x2e1535[_0x8c63('0x4e')][_0x8c63('0x68')][_0x8c63('0x38')];_0x501618+=0x1){socket[_0x8c63('0x84')]('userFaxQueue:save',{'UserId':_0x2e1535['body'][_0x8c63('0x68')][_0x501618],'FaxQueueId':_0x2e1535['params']['id']});}return _0x257156;});}})['then'](respondWithResult(_0x15a2c5,null))[_0x8c63('0x49')](handleError(_0x15a2c5,null));};exports[_0x8c63('0x83')]=function(_0x3a1d76,_0x6da194,_0x161bd2){return db[_0x8c63('0x2d')][_0x8c63('0x4c')]({'where':{'id':_0x3a1d76['params']['id']}})[_0x8c63('0x26')](handleEntityNotFound(_0x6da194,null))[_0x8c63('0x26')](function(_0x162bed){if(_0x162bed){return _0x162bed[_0x8c63('0x83')](_0x3a1d76[_0x8c63('0x33')][_0x8c63('0x68')])[_0x8c63('0x26')](function(){if(_[_0x8c63('0x89')](_0x3a1d76[_0x8c63('0x33')][_0x8c63('0x68')])){for(var _0x25c70f=0x0;_0x25c70f<_0x3a1d76[_0x8c63('0x33')][_0x8c63('0x68')]['length'];_0x25c70f+=0x1){socket[_0x8c63('0x84')](_0x8c63('0x85'),{'UserId':Number(_0x3a1d76['query'][_0x8c63('0x68')][_0x25c70f]),'FaxQueueId':Number(_0x3a1d76[_0x8c63('0x4b')]['id'])});}}else{socket[_0x8c63('0x84')](_0x8c63('0x85'),{'UserId':Number(_0x3a1d76['query'][_0x8c63('0x68')]),'FaxQueueId':Number(_0x3a1d76['params']['id'])});}});}})[_0x8c63('0x26')](respondWithStatusCode(_0x6da194,null))[_0x8c63('0x49')](handleError(_0x6da194,null));};exports[_0x8c63('0x8a')]=function(_0x18b7f3,_0x40c933,_0x1db692){var _0xfcb8e0={};var _0x1c76d4={};var _0x1e1c35;var _0x4b4414;return db[_0x8c63('0x2d')]['findOne']({'where':{'id':_0x18b7f3[_0x8c63('0x4b')]['id']}})[_0x8c63('0x26')](handleEntityNotFound(_0x40c933,null))[_0x8c63('0x26')](function(_0x2490f3){if(_0x2490f3){_0x1e1c35=_0x2490f3;_0x1c76d4[_0x8c63('0x31')]=_[_0x8c63('0x32')](db[_0x8c63('0x5b')][_0x8c63('0x2e')]);_0x1c76d4[_0x8c63('0x33')]=_['keys'](_0x18b7f3[_0x8c63('0x33')]);_0x1c76d4[_0x8c63('0x34')]=_[_0x8c63('0x35')](_0x1c76d4[_0x8c63('0x31')],_0x1c76d4['query']);_0xfcb8e0[_0x8c63('0x37')]=_['intersection'](_0x1c76d4[_0x8c63('0x31')],qs[_0x8c63('0x36')](_0x18b7f3['query']['fields']));_0xfcb8e0[_0x8c63('0x37')]=_0xfcb8e0['attributes'][_0x8c63('0x38')]?_0xfcb8e0[_0x8c63('0x37')]:_0x1c76d4[_0x8c63('0x31')];_0xfcb8e0[_0x8c63('0x3c')]=qs[_0x8c63('0x3d')](_0x18b7f3[_0x8c63('0x33')][_0x8c63('0x3d')]);_0xfcb8e0[_0x8c63('0x3e')]=qs[_0x8c63('0x34')](_['pick'](_0x18b7f3['query'],_0x1c76d4['filters']));if(_0x18b7f3[_0x8c63('0x33')][_0x8c63('0x40')]){_0xfcb8e0[_0x8c63('0x3e')]=_[_0x8c63('0x41')](_0xfcb8e0[_0x8c63('0x3e')],{'$or':_['map'](_0xfcb8e0['attributes'],function(_0x3c5394){var _0x1363cc={};_0x1363cc[_0x3c5394]={'$like':'%'+_0x18b7f3['query'][_0x8c63('0x40')]+'%'};return _0x1363cc;})});}_0xfcb8e0=_[_0x8c63('0x41')]({},_0xfcb8e0,_0x18b7f3[_0x8c63('0x44')]);return _0x1e1c35[_0x8c63('0x8a')](_0xfcb8e0);}})[_0x8c63('0x26')](function(_0x491f9e){if(_0x491f9e){_0x4b4414=_0x491f9e[_0x8c63('0x38')];if(!_0x18b7f3[_0x8c63('0x33')][_0x8c63('0x39')](_0x8c63('0x3a'))){_0xfcb8e0[_0x8c63('0x3b')]=qs[_0x8c63('0x3b')](_0x18b7f3[_0x8c63('0x33')]['limit']);_0xfcb8e0['offset']=qs[_0x8c63('0x21')](_0x18b7f3[_0x8c63('0x33')][_0x8c63('0x21')]);}return _0x1e1c35[_0x8c63('0x8a')](_0xfcb8e0);}})[_0x8c63('0x26')](function(_0x4ced60){if(_0x4ced60){return _0x4ced60?{'count':_0x4b4414,'rows':_0x4ced60}:null;}})['then'](respondWithResult(_0x40c933,null))['catch'](handleError(_0x40c933,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 5193aa0..c2e2643 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 _0xe071=['hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','remove','emit'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xe071,0x6a));var _0x1e07=function(_0x1a2ef3,_0x21186c){_0x1a2ef3=_0x1a2ef3-0x0;var _0x34f4a4=_0xe071[_0x1a2ef3];return _0x34f4a4;};'use strict';var EventEmitter=require(_0x1e07('0x0'));var FaxQueue=require(_0x1e07('0x1'))['db'][_0x1e07('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1e07('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1e07('0x4')};function emitEvent(_0x9e181){return function(_0x4324dd,_0x488f6e,_0xf7c883){FaxQueueEvents[_0x1e07('0x5')](_0x9e181+':'+_0x4324dd['id'],_0x4324dd);FaxQueueEvents[_0x1e07('0x5')](_0x9e181,_0x4324dd);_0xf7c883(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x1e07('0x6')](e,emitEvent(event));}}module[_0x1e07('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x9c53=['../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4db631,_0x4a82b6){var _0x46a3a9=function(_0xa2537d){while(--_0xa2537d){_0x4db631['push'](_0x4db631['shift']());}};_0x46a3a9(++_0x4a82b6);}(_0x9c53,0x1ae));var _0x39c5=function(_0x579bdf,_0x570502){_0x579bdf=_0x579bdf-0x0;var _0x15ae27=_0x9c53[_0x579bdf];return _0x15ae27;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x39c5('0x0'))['db'][_0x39c5('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x39c5('0x2')](0x0);var events={'afterCreate':_0x39c5('0x3'),'afterUpdate':_0x39c5('0x4'),'afterDestroy':_0x39c5('0x5')};function emitEvent(_0x43964f){return function(_0x42fa7a,_0x6beaab,_0x4ae2fd){FaxQueueEvents[_0x39c5('0x6')](_0x43964f+':'+_0x42fa7a['id'],_0x42fa7a);FaxQueueEvents[_0x39c5('0x6')](_0x43964f,_0x42fa7a);_0x4ae2fd(null);};}for(var e in events){if(events[_0x39c5('0x7')](e)){var event=events[e];FaxQueue[_0x39c5('0x8')](e,emitEvent(event));}}module[_0x39c5('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index c2b7e51..daf1f14 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 _0xd77c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxQueue','fax_queues','util','../../config/logger'];(function(_0x490451,_0x2c5f41){var _0x20ebe0=function(_0x56c321){while(--_0x56c321){_0x490451['push'](_0x490451['shift']());}};_0x20ebe0(++_0x2c5f41);}(_0xd77c,0xee));var _0xcd77=function(_0x19f0dc,_0x4de96b){_0x19f0dc=_0x19f0dc-0x0;var _0x56c8ec=_0xd77c[_0x19f0dc];return _0x56c8ec;};'use strict';var _=require('lodash');var util=require(_0xcd77('0x0'));var logger=require(_0xcd77('0x1'))(_0xcd77('0x2'));var moment=require(_0xcd77('0x3'));var BPromise=require(_0xcd77('0x4'));var rp=require(_0xcd77('0x5'));var fs=require('fs');var path=require(_0xcd77('0x6'));var rimraf=require(_0xcd77('0x7'));var config=require(_0xcd77('0x8'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x171360,_0x4a803f){return _0x171360[_0xcd77('0x9')](_0xcd77('0xa'),attributes,{'tableName':_0xcd77('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02b2=['request-promise','path','rimraf','./faxQueue.attributes','exports','define','fax_queues','lodash','../../config/logger','moment','bluebird'];(function(_0xa9cc9c,_0x1f82d3){var _0x266274=function(_0x2907ca){while(--_0x2907ca){_0xa9cc9c['push'](_0xa9cc9c['shift']());}};_0x266274(++_0x1f82d3);}(_0x02b2,0x172));var _0x202b=function(_0xb7c6b4,_0x3e275c){_0xb7c6b4=_0xb7c6b4-0x0;var _0x51e8e0=_0x02b2[_0xb7c6b4];return _0x51e8e0;};'use strict';var _=require(_0x202b('0x0'));var util=require('util');var logger=require(_0x202b('0x1'))('api');var moment=require(_0x202b('0x2'));var BPromise=require(_0x202b('0x3'));var rp=require(_0x202b('0x4'));var fs=require('fs');var path=require(_0x202b('0x5'));var rimraf=require(_0x202b('0x6'));var config=require('../../config/environment');var attributes=require(_0x202b('0x7'));module[_0x202b('0x8')]=function(_0x518f17,_0x12a3e0){return _0x518f17[_0x202b('0x9')]('FaxQueue',attributes,{'tableName':_0x202b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 2bb3816..830861a 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 _0x8a3e=['util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','stringify','ShowFaxQueue','find','debug','lodash'];(function(_0x5efbd0,_0x299553){var _0x475ec9=function(_0x3752ec){while(--_0x3752ec){_0x5efbd0['push'](_0x5efbd0['shift']());}};_0x475ec9(++_0x299553);}(_0x8a3e,0x167));var _0xe8a3=function(_0x225d9f,_0x280e04){_0x225d9f=_0x225d9f-0x0;var _0x24e55f=_0x8a3e[_0x225d9f];return _0x24e55f;};'use strict';var _=require(_0xe8a3('0x0'));var util=require(_0xe8a3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe8a3('0x2'));var fs=require('fs');var Redis=require(_0xe8a3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe8a3('0x4'));var logger=require(_0xe8a3('0x5'))(_0xe8a3('0x6'));var config=require(_0xe8a3('0x7'));var jayson=require(_0xe8a3('0x8'));var client=jayson['client'][_0xe8a3('0x9')]({'port':0x232a});config[_0xe8a3('0xa')]=_[_0xe8a3('0xb')](config[_0xe8a3('0xa')],{'host':_0xe8a3('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe8a3('0xa')]));require(_0xe8a3('0xd'))['register'](socket);function respondWithRpcPromise(_0x4ff097,_0x4926ae,_0x355327){return new BPromise(function(_0x345973,_0x624e5f){return client[_0xe8a3('0xe')](_0x4ff097,_0x355327)[_0xe8a3('0xf')](function(_0x3dad49){logger[_0xe8a3('0x10')](_0xe8a3('0x11'),_0x4926ae,_0xe8a3('0x12'));logger['debug'](_0xe8a3('0x13'),_0x4926ae,_0xe8a3('0x12'),JSON['stringify'](_0x3dad49));if(_0x3dad49[_0xe8a3('0x14')]){if(_0x3dad49['error'][_0xe8a3('0x15')]===0x1f4){logger[_0xe8a3('0x14')](_0xe8a3('0x11'),_0x4926ae,_0x3dad49[_0xe8a3('0x14')][_0xe8a3('0x16')]);return _0x624e5f(_0x3dad49[_0xe8a3('0x14')][_0xe8a3('0x16')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x4926ae,_0x3dad49[_0xe8a3('0x14')][_0xe8a3('0x16')]);return _0x345973(_0x3dad49['error']['message']);}else{logger[_0xe8a3('0x10')]('FaxQueue,\x20%s,\x20%s',_0x4926ae,_0xe8a3('0x12'));_0x345973(_0x3dad49[_0xe8a3('0x17')][_0xe8a3('0x16')]);}})[_0xe8a3('0x18')](function(_0x3291e1){logger[_0xe8a3('0x14')](_0xe8a3('0x11'),_0x4926ae,_0x3291e1);_0x624e5f(_0x3291e1);});});}exports[_0xe8a3('0x19')]=function(_0x21cd5d){var _0x4bb708=this;return new Promise(function(_0x9f57f4,_0x58ca24){return db[_0xe8a3('0x1a')][_0xe8a3('0x1b')]({'raw':_0x21cd5d[_0xe8a3('0x1c')]?_0x21cd5d[_0xe8a3('0x1c')][_0xe8a3('0x1d')]===undefined?!![]:![]:!![],'where':_0x21cd5d[_0xe8a3('0x1c')]?_0x21cd5d['options'][_0xe8a3('0x1e')]||null:null,'attributes':_0x21cd5d['options']?_0x21cd5d['options'][_0xe8a3('0x1f')]||null:null,'limit':_0x21cd5d[_0xe8a3('0x1c')]?_0x21cd5d['options'][_0xe8a3('0x20')]||null:null,'include':_0x21cd5d[_0xe8a3('0x1c')]?_0x21cd5d[_0xe8a3('0x1c')]['include']?_[_0xe8a3('0x21')](_0x21cd5d[_0xe8a3('0x1c')][_0xe8a3('0x22')],function(_0x1e434f){return{'model':db[_0x1e434f[_0xe8a3('0x23')]],'as':_0x1e434f['as'],'attributes':_0x1e434f[_0xe8a3('0x1f')],'include':_0x1e434f[_0xe8a3('0x22')]?_[_0xe8a3('0x21')](_0x1e434f[_0xe8a3('0x22')],function(_0x26a676){return{'model':db[_0x26a676[_0xe8a3('0x23')]],'as':_0x26a676['as'],'attributes':_0x26a676[_0xe8a3('0x1f')],'include':_0x26a676[_0xe8a3('0x22')]?_[_0xe8a3('0x21')](_0x26a676['include'],function(_0x420ad3){return{'model':db[_0x420ad3[_0xe8a3('0x23')]],'as':_0x420ad3['as'],'attributes':_0x420ad3[_0xe8a3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe8a3('0xf')](function(_0xb67498){logger[_0xe8a3('0x10')](_0xe8a3('0x19'),_0x21cd5d);logger['debug'](_0xe8a3('0x19'),_0x21cd5d,JSON[_0xe8a3('0x24')](_0xb67498));_0x9f57f4(_0xb67498);})[_0xe8a3('0x18')](function(_0x1b0455){logger[_0xe8a3('0x14')](_0xe8a3('0x19'),_0x1b0455[_0xe8a3('0x16')],_0x21cd5d);_0x58ca24(_0x4bb708['error'](0x1f4,_0x1b0455['message']));});});};exports[_0xe8a3('0x25')]=function(_0x3df400){var _0x26834f=this;return new Promise(function(_0x2041fa,_0x436469){return db[_0xe8a3('0x1a')][_0xe8a3('0x26')]({'raw':_0x3df400[_0xe8a3('0x1c')]?_0x3df400[_0xe8a3('0x1c')][_0xe8a3('0x1d')]===undefined?!![]:![]:!![],'where':_0x3df400[_0xe8a3('0x1c')]?_0x3df400['options'][_0xe8a3('0x1e')]||null:null,'attributes':_0x3df400[_0xe8a3('0x1c')]?_0x3df400[_0xe8a3('0x1c')]['attributes']||null:null,'include':_0x3df400[_0xe8a3('0x1c')]?_0x3df400[_0xe8a3('0x1c')][_0xe8a3('0x22')]?_[_0xe8a3('0x21')](_0x3df400[_0xe8a3('0x1c')][_0xe8a3('0x22')],function(_0x3907dd){return{'model':db[_0x3907dd[_0xe8a3('0x23')]],'as':_0x3907dd['as'],'attributes':_0x3907dd[_0xe8a3('0x1f')],'include':_0x3907dd[_0xe8a3('0x22')]?_[_0xe8a3('0x21')](_0x3907dd[_0xe8a3('0x22')],function(_0x3e8b9a){return{'model':db[_0x3e8b9a['model']],'as':_0x3e8b9a['as'],'attributes':_0x3e8b9a[_0xe8a3('0x1f')],'include':_0x3e8b9a[_0xe8a3('0x22')]?_[_0xe8a3('0x21')](_0x3e8b9a[_0xe8a3('0x22')],function(_0x2bc5df){return{'model':db[_0x2bc5df['model']],'as':_0x2bc5df['as'],'attributes':_0x2bc5df['attributes']};}):[]};}):[]};}):[]:[]})[_0xe8a3('0xf')](function(_0x3900fd){logger[_0xe8a3('0x10')]('ShowFaxQueue',_0x3df400);logger[_0xe8a3('0x27')]('ShowFaxQueue',_0x3df400,JSON[_0xe8a3('0x24')](_0x3900fd));_0x2041fa(_0x3900fd);})[_0xe8a3('0x18')](function(_0x55a24b){logger['error'](_0xe8a3('0x25'),_0x55a24b['message'],_0x3df400);_0x436469(_0x26834f['error'](0x1f4,_0x55a24b[_0xe8a3('0x16')]));});});}; \ No newline at end of file +var _0xdbaf=['then','info','request\x20sent','debug','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','catch','FaxQueue','options','raw','where','limit','model','attributes','include','map','GetFaxQueue','find','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket'];(function(_0x2a88ce,_0x4eaced){var _0x3ba682=function(_0x3cbcce){while(--_0x3cbcce){_0x2a88ce['push'](_0x2a88ce['shift']());}};_0x3ba682(++_0x4eaced);}(_0xdbaf,0x1ce));var _0xfdba=function(_0x290566,_0x229ea2){_0x290566=_0x290566-0x0;var _0x7e4a50=_0xdbaf[_0x290566];return _0x7e4a50;};'use strict';var _=require(_0xfdba('0x0'));var util=require(_0xfdba('0x1'));var moment=require(_0xfdba('0x2'));var BPromise=require(_0xfdba('0x3'));var rs=require(_0xfdba('0x4'));var fs=require('fs');var Redis=require(_0xfdba('0x5'));var db=require(_0xfdba('0x6'))['db'];var utils=require(_0xfdba('0x7'));var logger=require('../../config/logger')(_0xfdba('0x8'));var config=require(_0xfdba('0x9'));var jayson=require(_0xfdba('0xa'));var client=jayson[_0xfdba('0xb')][_0xfdba('0xc')]({'port':0x232a});config[_0xfdba('0xd')]=_[_0xfdba('0xe')](config['redis'],{'host':_0xfdba('0xf'),'port':0x18eb});var socket=require(_0xfdba('0x10'))(new Redis(config['redis']));require(_0xfdba('0x11'))['register'](socket);function respondWithRpcPromise(_0x1d69d6,_0x2fdee9,_0x13b962){return new BPromise(function(_0x5276f8,_0x59ad0b){return client['request'](_0x1d69d6,_0x13b962)[_0xfdba('0x12')](function(_0xd805eb){logger[_0xfdba('0x13')]('FaxQueue,\x20%s,\x20%s',_0x2fdee9,_0xfdba('0x14'));logger[_0xfdba('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x2fdee9,_0xfdba('0x14'),JSON[_0xfdba('0x16')](_0xd805eb));if(_0xd805eb[_0xfdba('0x17')]){if(_0xd805eb[_0xfdba('0x17')][_0xfdba('0x18')]===0x1f4){logger[_0xfdba('0x17')](_0xfdba('0x19'),_0x2fdee9,_0xd805eb[_0xfdba('0x17')]['message']);return _0x59ad0b(_0xd805eb[_0xfdba('0x17')]['message']);}logger[_0xfdba('0x17')](_0xfdba('0x19'),_0x2fdee9,_0xd805eb[_0xfdba('0x17')][_0xfdba('0x1a')]);return _0x5276f8(_0xd805eb[_0xfdba('0x17')][_0xfdba('0x1a')]);}else{logger[_0xfdba('0x13')](_0xfdba('0x19'),_0x2fdee9,_0xfdba('0x14'));_0x5276f8(_0xd805eb['result']['message']);}})[_0xfdba('0x1b')](function(_0x58bf17){logger[_0xfdba('0x17')](_0xfdba('0x19'),_0x2fdee9,_0x58bf17);_0x59ad0b(_0x58bf17);});});}exports['GetFaxQueue']=function(_0x463aaa){var _0x5c592e=this;return new Promise(function(_0x291cf2,_0x220377){return db[_0xfdba('0x1c')]['findAll']({'raw':_0x463aaa[_0xfdba('0x1d')]?_0x463aaa[_0xfdba('0x1d')][_0xfdba('0x1e')]===undefined?!![]:![]:!![],'where':_0x463aaa[_0xfdba('0x1d')]?_0x463aaa[_0xfdba('0x1d')][_0xfdba('0x1f')]||null:null,'attributes':_0x463aaa[_0xfdba('0x1d')]?_0x463aaa[_0xfdba('0x1d')]['attributes']||null:null,'limit':_0x463aaa[_0xfdba('0x1d')]?_0x463aaa[_0xfdba('0x1d')][_0xfdba('0x20')]||null:null,'include':_0x463aaa['options']?_0x463aaa[_0xfdba('0x1d')]['include']?_['map'](_0x463aaa[_0xfdba('0x1d')]['include'],function(_0x2d7afd){return{'model':db[_0x2d7afd[_0xfdba('0x21')]],'as':_0x2d7afd['as'],'attributes':_0x2d7afd[_0xfdba('0x22')],'include':_0x2d7afd[_0xfdba('0x23')]?_[_0xfdba('0x24')](_0x2d7afd[_0xfdba('0x23')],function(_0x3af858){return{'model':db[_0x3af858[_0xfdba('0x21')]],'as':_0x3af858['as'],'attributes':_0x3af858[_0xfdba('0x22')],'include':_0x3af858[_0xfdba('0x23')]?_['map'](_0x3af858[_0xfdba('0x23')],function(_0x330786){return{'model':db[_0x330786[_0xfdba('0x21')]],'as':_0x330786['as'],'attributes':_0x330786['attributes']};}):[]};}):[]};}):[]:[]})[_0xfdba('0x12')](function(_0x793d74){logger['info'](_0xfdba('0x25'),_0x463aaa);logger['debug']('GetFaxQueue',_0x463aaa,JSON[_0xfdba('0x16')](_0x793d74));_0x291cf2(_0x793d74);})[_0xfdba('0x1b')](function(_0x20b06f){logger['error']('GetFaxQueue',_0x20b06f[_0xfdba('0x1a')],_0x463aaa);_0x220377(_0x5c592e['error'](0x1f4,_0x20b06f[_0xfdba('0x1a')]));});});};exports['ShowFaxQueue']=function(_0x4a1d97){var _0x7a85bc=this;return new Promise(function(_0x4bd8a4,_0x5f1e5e){return db[_0xfdba('0x1c')][_0xfdba('0x26')]({'raw':_0x4a1d97[_0xfdba('0x1d')]?_0x4a1d97[_0xfdba('0x1d')][_0xfdba('0x1e')]===undefined?!![]:![]:!![],'where':_0x4a1d97[_0xfdba('0x1d')]?_0x4a1d97['options'][_0xfdba('0x1f')]||null:null,'attributes':_0x4a1d97[_0xfdba('0x1d')]?_0x4a1d97[_0xfdba('0x1d')]['attributes']||null:null,'include':_0x4a1d97[_0xfdba('0x1d')]?_0x4a1d97[_0xfdba('0x1d')]['include']?_[_0xfdba('0x24')](_0x4a1d97['options'][_0xfdba('0x23')],function(_0x5a3f40){return{'model':db[_0x5a3f40[_0xfdba('0x21')]],'as':_0x5a3f40['as'],'attributes':_0x5a3f40[_0xfdba('0x22')],'include':_0x5a3f40[_0xfdba('0x23')]?_['map'](_0x5a3f40[_0xfdba('0x23')],function(_0x57bc0c){return{'model':db[_0x57bc0c[_0xfdba('0x21')]],'as':_0x57bc0c['as'],'attributes':_0x57bc0c[_0xfdba('0x22')],'include':_0x57bc0c[_0xfdba('0x23')]?_[_0xfdba('0x24')](_0x57bc0c[_0xfdba('0x23')],function(_0x10e4ab){return{'model':db[_0x10e4ab['model']],'as':_0x10e4ab['as'],'attributes':_0x10e4ab[_0xfdba('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfdba('0x12')](function(_0x187f0e){logger['info'](_0xfdba('0x27'),_0x4a1d97);logger[_0xfdba('0x15')](_0xfdba('0x27'),_0x4a1d97,JSON['stringify'](_0x187f0e));_0x4bd8a4(_0x187f0e);})[_0xfdba('0x1b')](function(_0x33b367){logger['error']('ShowFaxQueue',_0x33b367['message'],_0x4a1d97);_0x5f1e5e(_0x7a85bc[_0xfdba('0x17')](0x1f4,_0x33b367[_0xfdba('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 22800f6..500922b 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 _0x0d20=['register','faxQueue:','./faxQueue.events','remove','update','emit','removeListener'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x0d20,0x6b));var _0x00d2=function(_0x4d67ad,_0x82e1ff){_0x4d67ad=_0x4d67ad-0x0;var _0x5e29c1=_0x0d20[_0x4d67ad];return _0x5e29c1;};'use strict';var FaxQueueEvents=require(_0x00d2('0x0'));var events=['save',_0x00d2('0x1'),_0x00d2('0x2')];function createListener(_0x1755e7,_0x5cd67b){return function(_0x537e31){_0x5cd67b[_0x00d2('0x3')](_0x1755e7,_0x537e31);};}function removeListener(_0x36eb0b,_0x18af6c){return function(){FaxQueueEvents[_0x00d2('0x4')](_0x36eb0b,_0x18af6c);};}exports[_0x00d2('0x5')]=function(_0x99a166){for(var _0x4f6dbc=0x0,_0x3cc257=events['length'];_0x4f6dbc<_0x3cc257;_0x4f6dbc++){var _0x27faf9=events[_0x4f6dbc];var _0x5418e2=createListener(_0x00d2('0x6')+_0x27faf9,_0x99a166);FaxQueueEvents['on'](_0x27faf9,_0x5418e2);}}; \ No newline at end of file +var _0x5cff=['remove','emit','removeListener','length','faxQueue:','save'];(function(_0x2e3545,_0x20a6ec){var _0xcf18f=function(_0x3c85dd){while(--_0x3c85dd){_0x2e3545['push'](_0x2e3545['shift']());}};_0xcf18f(++_0x20a6ec);}(_0x5cff,0x107));var _0xf5cf=function(_0x520f86,_0x240cc0){_0x520f86=_0x520f86-0x0;var _0x4b6523=_0x5cff[_0x520f86];return _0x4b6523;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xf5cf('0x0'),_0xf5cf('0x1'),'update'];function createListener(_0x403fe9,_0x49b105){return function(_0xf35361){_0x49b105[_0xf5cf('0x2')](_0x403fe9,_0xf35361);};}function removeListener(_0x5b803c,_0x3bf260){return function(){FaxQueueEvents[_0xf5cf('0x3')](_0x5b803c,_0x3bf260);};}exports['register']=function(_0x326b54){for(var _0x3cce6f=0x0,_0x36e2f7=events[_0xf5cf('0x4')];_0x3cce6f<_0x36e2f7;_0x3cce6f++){var _0x47d518=events[_0x3cce6f];var _0x1eb3df=createListener(_0xf5cf('0x5')+_0x47d518,_0x326b54);FaxQueueEvents['on'](_0x47d518,_0x1eb3df);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 7c496cd..ce68a98 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(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xb10b,0x12a));var _0xbb10=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0xb10b[_0x149ca0];return _0x56b6b9;};'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 _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x56d3a2,_0x5f191b){var _0x2c14d0=function(_0xb776e2){while(--_0xb776e2){_0x56d3a2['push'](_0x56d3a2['shift']());}};_0x2c14d0(++_0x5f191b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 92a3da2..13f6ebc 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 _0x2b5a=['exports','STRING','DATE','moment','sequelize'];(function(_0x9733df,_0x450c75){var _0x1abfad=function(_0x536974){while(--_0x536974){_0x9733df['push'](_0x9733df['shift']());}};_0x1abfad(++_0x450c75);}(_0x2b5a,0x1c0));var _0xa2b5=function(_0x2049fd,_0x35f359){_0x2049fd=_0x2049fd-0x0;var _0x52dc67=_0x2b5a[_0x2049fd];return _0x52dc67;};'use strict';var moment=require(_0xa2b5('0x0'));var Sequelize=require(_0xa2b5('0x1'));module[_0xa2b5('0x2')]={'uniqueid':{'type':Sequelize[_0xa2b5('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa2b5('0x3')]},'joinAt':{'type':Sequelize[_0xa2b5('0x4')]},'leaveAt':{'type':Sequelize[_0xa2b5('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa2b5('0x3')]}}; \ No newline at end of file +var _0xc2e3=['DATE','moment','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc2e3,0xe1));var _0x3c2e=function(_0x151b87,_0x2af01f){_0x151b87=_0x151b87-0x0;var _0x3a450b=_0xc2e3[_0x151b87];return _0x3a450b;};'use strict';var moment=require(_0x3c2e('0x0'));var Sequelize=require('sequelize');module[_0x3c2e('0x1')]={'uniqueid':{'type':Sequelize[_0x3c2e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3c2e('0x2')]},'joinAt':{'type':Sequelize[_0x3c2e('0x3')]},'leaveAt':{'type':Sequelize[_0x3c2e('0x3')]},'acceptAt':{'type':Sequelize[_0x3c2e('0x3')]},'exitAt':{'type':Sequelize['DATE']},'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 04af6bd..1fbddf3 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 _0xea80=['destroy','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','then','includeAll','include','catch','show','params','intersection','find','create','update','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save'];(function(_0x581255,_0x52439b){var _0x270a32=function(_0x5ee9ee){while(--_0x5ee9ee){_0x581255['push'](_0x581255['shift']());}};_0x270a32(++_0x52439b);}(_0xea80,0x1d7));var _0x0ea8=function(_0xf2b559,_0x5e5e1b){_0xf2b559=_0xf2b559-0x0;var _0x49f356=_0xea80[_0xf2b559];return _0x49f356;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0ea8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ea8('0x1'));var jsonpatch=require(_0x0ea8('0x2'));var rp=require(_0x0ea8('0x3'));var moment=require(_0x0ea8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0ea8('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0ea8('0x6'));var ejs=require(_0x0ea8('0x7'));var fs=require('fs');var _=require(_0x0ea8('0x8'));var squel=require('squel');var crypto=require(_0x0ea8('0x9'));var jsforce=require(_0x0ea8('0xa'));var deskjs=require(_0x0ea8('0xb'));var toCsv=require(_0x0ea8('0x6'));var querystring=require(_0x0ea8('0xc'));var Papa=require(_0x0ea8('0xd'));var Redis=require(_0x0ea8('0xe'));var authService=require(_0x0ea8('0xf'));var qs=require(_0x0ea8('0x10'));var as=require(_0x0ea8('0x11'));var hardwareService=require(_0x0ea8('0x12'));var logger=require(_0x0ea8('0x13'))(_0x0ea8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0ea8('0x15'))['db'];function respondWithStatusCode(_0x4b2de5,_0x4063a2){_0x4063a2=_0x4063a2||0xcc;return function(_0x1c507c){if(_0x1c507c){return _0x4b2de5[_0x0ea8('0x16')](_0x4063a2);}return _0x4b2de5['status'](_0x4063a2)[_0x0ea8('0x17')]();};}function respondWithResult(_0x3e8f63,_0x39f69f){_0x39f69f=_0x39f69f||0xc8;return function(_0x370c28){if(_0x370c28){return _0x3e8f63[_0x0ea8('0x18')](_0x39f69f)[_0x0ea8('0x19')](_0x370c28);}};}function respondWithFilteredResult(_0x4ff877,_0x2f9803){return function(_0x16bf27){if(_0x16bf27){var _0x51076d=_0x16bf27[_0x0ea8('0x1a')],_0x269ca1=_0x2f9803[_0x0ea8('0x1b')],_0x117c59=_0x2f9803['offset']+_0x2f9803[_0x0ea8('0x1c')],_0x34a531;if(_0x117c59>=_0x51076d){_0x117c59=_0x51076d;_0x34a531=0xc8;}else{_0x34a531=0xce;}_0x4ff877[_0x0ea8('0x18')](_0x34a531);return _0x4ff877[_0x0ea8('0x1d')]('Content-Range',_0x269ca1+'-'+_0x117c59+'/'+_0x51076d)[_0x0ea8('0x19')](_0x16bf27);}return null;};}function patchUpdates(_0x3e7c14){return function(_0x3b1a06){try{jsonpatch[_0x0ea8('0x1e')](_0x3b1a06,_0x3e7c14,!![]);}catch(_0x102618){return BPromise[_0x0ea8('0x1f')](_0x102618);}return _0x3b1a06[_0x0ea8('0x20')]();};}function saveUpdates(_0x50586c,_0xc122a1){return function(_0x4a848f){if(_0x4a848f){return _0x4a848f['update'](_0x50586c)['then'](function(_0x34078f){return _0x34078f;});}return null;};}function removeEntity(_0x2a9520,_0x4a01c4){return function(_0x44a7ad){if(_0x44a7ad){return _0x44a7ad[_0x0ea8('0x21')]()['then'](function(){_0x2a9520[_0x0ea8('0x18')](0xcc)[_0x0ea8('0x17')]();});}};}function handleEntityNotFound(_0x58b07a,_0x1e8269){return function(_0x3bf98b){if(!_0x3bf98b){_0x58b07a['sendStatus'](0x194);}return _0x3bf98b;};}function handleError(_0x2e4aa4,_0x2a28d2){_0x2a28d2=_0x2a28d2||0x1f4;return function(_0xaebef4){logger[_0x0ea8('0x22')](_0xaebef4[_0x0ea8('0x23')]);if(_0xaebef4[_0x0ea8('0x24')]){delete _0xaebef4[_0x0ea8('0x24')];}_0x2e4aa4['status'](_0x2a28d2)[_0x0ea8('0x25')](_0xaebef4);};}exports[_0x0ea8('0x26')]=function(_0x544d20,_0x41c4ef){var _0x529c97={},_0x328f44={},_0xa2f1de={'count':0x0,'rows':[]};var _0x211cd7=_[_0x0ea8('0x27')](db[_0x0ea8('0x28')][_0x0ea8('0x29')],function(_0x3b8f1d){return{'name':_0x3b8f1d['fieldName'],'type':_0x3b8f1d[_0x0ea8('0x2a')][_0x0ea8('0x2b')]};});_0x328f44[_0x0ea8('0x2c')]=_[_0x0ea8('0x27')](_0x211cd7,_0x0ea8('0x24'));_0x328f44[_0x0ea8('0x2d')]=_[_0x0ea8('0x2e')](_0x544d20['query']);_0x328f44['filters']=_['intersection'](_0x328f44[_0x0ea8('0x2c')],_0x328f44['query']);_0x529c97[_0x0ea8('0x2f')]=_['intersection'](_0x328f44['model'],qs['fields'](_0x544d20['query'][_0x0ea8('0x30')]));_0x529c97['attributes']=_0x529c97[_0x0ea8('0x2f')][_0x0ea8('0x31')]?_0x529c97[_0x0ea8('0x2f')]:_0x328f44['model'];if(!_0x544d20[_0x0ea8('0x2d')][_0x0ea8('0x32')](_0x0ea8('0x33'))){_0x529c97[_0x0ea8('0x1c')]=qs['limit'](_0x544d20[_0x0ea8('0x2d')]['limit']);_0x529c97[_0x0ea8('0x1b')]=qs[_0x0ea8('0x1b')](_0x544d20['query']['offset']);}_0x529c97['order']=qs[_0x0ea8('0x34')](_0x544d20['query'][_0x0ea8('0x34')]);_0x529c97[_0x0ea8('0x35')]=qs['filters'](_[_0x0ea8('0x36')](_0x544d20[_0x0ea8('0x2d')],_0x328f44[_0x0ea8('0x37')]),_0x211cd7);if(_0x544d20[_0x0ea8('0x2d')][_0x0ea8('0x38')]){_0x529c97[_0x0ea8('0x35')]=_[_0x0ea8('0x39')](_0x529c97[_0x0ea8('0x35')],{'$or':_['map'](_0x211cd7,function(_0x2cdbe9){if(_0x2cdbe9['type']!==_0x0ea8('0x3a')){var _0x1a09dd={};_0x1a09dd[_0x2cdbe9['name']]={'$like':'%'+_0x544d20[_0x0ea8('0x2d')][_0x0ea8('0x38')]+'%'};return _0x1a09dd;}})});}_0x529c97=_['merge']({},_0x529c97,_0x544d20[_0x0ea8('0x3b')]);var _0xcedec3={'where':_0x529c97[_0x0ea8('0x35')]};return db[_0x0ea8('0x28')][_0x0ea8('0x1a')](_0xcedec3)[_0x0ea8('0x3c')](function(_0x89c302){_0xa2f1de['count']=_0x89c302;if(_0x544d20[_0x0ea8('0x2d')][_0x0ea8('0x3d')]){_0x529c97[_0x0ea8('0x3e')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x529c97);})[_0x0ea8('0x3c')](function(_0x32ca73){_0xa2f1de['rows']=_0x32ca73;return _0xa2f1de;})[_0x0ea8('0x3c')](respondWithFilteredResult(_0x41c4ef,_0x529c97))[_0x0ea8('0x3f')](handleError(_0x41c4ef,null));};exports[_0x0ea8('0x40')]=function(_0x5f58e5,_0xc0ffd8){var _0x41510f={'raw':!![],'where':{'id':_0x5f58e5[_0x0ea8('0x41')]['id']}},_0x3ada5e={};_0x3ada5e['model']=_['keys'](db[_0x0ea8('0x28')][_0x0ea8('0x29')]);_0x3ada5e[_0x0ea8('0x2d')]=_[_0x0ea8('0x2e')](_0x5f58e5[_0x0ea8('0x2d')]);_0x3ada5e[_0x0ea8('0x37')]=_[_0x0ea8('0x42')](_0x3ada5e['model'],_0x3ada5e[_0x0ea8('0x2d')]);_0x41510f[_0x0ea8('0x2f')]=_[_0x0ea8('0x42')](_0x3ada5e['model'],qs[_0x0ea8('0x30')](_0x5f58e5[_0x0ea8('0x2d')][_0x0ea8('0x30')]));_0x41510f[_0x0ea8('0x2f')]=_0x41510f[_0x0ea8('0x2f')]['length']?_0x41510f[_0x0ea8('0x2f')]:_0x3ada5e[_0x0ea8('0x2c')];if(_0x5f58e5[_0x0ea8('0x2d')][_0x0ea8('0x3d')]){_0x41510f[_0x0ea8('0x3e')]=[{'all':!![]}];}_0x41510f=_[_0x0ea8('0x39')]({},_0x41510f,_0x5f58e5['options']);return db[_0x0ea8('0x28')][_0x0ea8('0x43')](_0x41510f)[_0x0ea8('0x3c')](handleEntityNotFound(_0xc0ffd8,null))[_0x0ea8('0x3c')](respondWithResult(_0xc0ffd8,null))['catch'](handleError(_0xc0ffd8,null));};exports[_0x0ea8('0x44')]=function(_0x2bdadd,_0x360970){return db[_0x0ea8('0x28')][_0x0ea8('0x44')](_0x2bdadd['body'],{})['then'](respondWithResult(_0x360970,0xc9))[_0x0ea8('0x3f')](handleError(_0x360970,null));};exports[_0x0ea8('0x45')]=function(_0x5e0e63,_0x3c9a5c){if(_0x5e0e63[_0x0ea8('0x46')]['id']){delete _0x5e0e63[_0x0ea8('0x46')]['id'];}return db[_0x0ea8('0x28')][_0x0ea8('0x43')]({'where':{'id':_0x5e0e63[_0x0ea8('0x41')]['id']}})[_0x0ea8('0x3c')](handleEntityNotFound(_0x3c9a5c,null))[_0x0ea8('0x3c')](saveUpdates(_0x5e0e63[_0x0ea8('0x46')],null))[_0x0ea8('0x3c')](respondWithResult(_0x3c9a5c,null))[_0x0ea8('0x3f')](handleError(_0x3c9a5c,null));};exports['destroy']=function(_0x2f7037,_0x176bdd){return db[_0x0ea8('0x28')]['find']({'where':{'id':_0x2f7037[_0x0ea8('0x41')]['id']}})[_0x0ea8('0x3c')](handleEntityNotFound(_0x176bdd,null))[_0x0ea8('0x3c')](removeEntity(_0x176bdd,null))[_0x0ea8('0x3f')](handleError(_0x176bdd,null));};exports[_0x0ea8('0x47')]=function(_0x14b128,_0x501512){return db[_0x0ea8('0x28')][_0x0ea8('0x47')]()[_0x0ea8('0x3c')](respondWithResult(_0x501512,null))['catch'](handleError(_0x501512,null));}; \ No newline at end of file +var _0x0ffd=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','update','destroy','then','sendStatus','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body'];(function(_0x46857f,_0x1c73ad){var _0x30bebc=function(_0x38e9bd){while(--_0x38e9bd){_0x46857f['push'](_0x46857f['shift']());}};_0x30bebc(++_0x1c73ad);}(_0x0ffd,0x129));var _0xd0ff=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x0ffd[_0x3054be];return _0x3df150;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd0ff('0x0'));var rimraf=require(_0xd0ff('0x1'));var zipdir=require(_0xd0ff('0x2'));var jsonpatch=require(_0xd0ff('0x3'));var rp=require(_0xd0ff('0x4'));var moment=require(_0xd0ff('0x5'));var BPromise=require(_0xd0ff('0x6'));var Mustache=require(_0xd0ff('0x7'));var util=require(_0xd0ff('0x8'));var path=require(_0xd0ff('0x9'));var sox=require(_0xd0ff('0xa'));var csv=require(_0xd0ff('0xb'));var ejs=require(_0xd0ff('0xc'));var fs=require('fs');var _=require(_0xd0ff('0xd'));var squel=require(_0xd0ff('0xe'));var crypto=require(_0xd0ff('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd0ff('0x10'));var toCsv=require(_0xd0ff('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd0ff('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd0ff('0x12'));var as=require(_0xd0ff('0x13'));var hardwareService=require(_0xd0ff('0x14'));var logger=require(_0xd0ff('0x15'))('api');var utils=require(_0xd0ff('0x16'));var config=require(_0xd0ff('0x17'));var db=require(_0xd0ff('0x18'))['db'];function respondWithStatusCode(_0x2db806,_0x565f64){_0x565f64=_0x565f64||0xcc;return function(_0xbcd8cb){if(_0xbcd8cb){return _0x2db806['sendStatus'](_0x565f64);}return _0x2db806[_0xd0ff('0x19')](_0x565f64)[_0xd0ff('0x1a')]();};}function respondWithResult(_0x253906,_0xcc2008){_0xcc2008=_0xcc2008||0xc8;return function(_0x2616b1){if(_0x2616b1){return _0x253906[_0xd0ff('0x19')](_0xcc2008)['json'](_0x2616b1);}};}function respondWithFilteredResult(_0x1d927b,_0x44f694){return function(_0x432a7b){if(_0x432a7b){var _0x1ba5be=_0x432a7b[_0xd0ff('0x1b')],_0xa9180b=_0x44f694['offset'],_0x22af58=_0x44f694[_0xd0ff('0x1c')]+_0x44f694[_0xd0ff('0x1d')],_0x9ea1c7;if(_0x22af58>=_0x1ba5be){_0x22af58=_0x1ba5be;_0x9ea1c7=0xc8;}else{_0x9ea1c7=0xce;}_0x1d927b[_0xd0ff('0x19')](_0x9ea1c7);return _0x1d927b[_0xd0ff('0x1e')](_0xd0ff('0x1f'),_0xa9180b+'-'+_0x22af58+'/'+_0x1ba5be)[_0xd0ff('0x20')](_0x432a7b);}return null;};}function patchUpdates(_0x576825){return function(_0x19b2a4){try{jsonpatch['apply'](_0x19b2a4,_0x576825,!![]);}catch(_0x4c03b4){return BPromise[_0xd0ff('0x21')](_0x4c03b4);}return _0x19b2a4['save']();};}function saveUpdates(_0x296bc8,_0x5d0f9a){return function(_0x1a7612){if(_0x1a7612){return _0x1a7612[_0xd0ff('0x22')](_0x296bc8)['then'](function(_0x361105){return _0x361105;});}return null;};}function removeEntity(_0x71312f,_0x1b575b){return function(_0x1f6bad){if(_0x1f6bad){return _0x1f6bad[_0xd0ff('0x23')]()[_0xd0ff('0x24')](function(){_0x71312f[_0xd0ff('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16772f,_0x4e971d){return function(_0x47c2ce){if(!_0x47c2ce){_0x16772f[_0xd0ff('0x25')](0x194);}return _0x47c2ce;};}function handleError(_0x11e3d5,_0x4c3a89){_0x4c3a89=_0x4c3a89||0x1f4;return function(_0x452ebe){logger['error'](_0x452ebe[_0xd0ff('0x26')]);if(_0x452ebe[_0xd0ff('0x27')]){delete _0x452ebe[_0xd0ff('0x27')];}_0x11e3d5[_0xd0ff('0x19')](_0x4c3a89)['send'](_0x452ebe);};}exports[_0xd0ff('0x28')]=function(_0x4de9e5,_0x38f023){var _0x512b32={},_0x10d6ae={},_0x5a09c1={'count':0x0,'rows':[]};var _0x4c07f9=_[_0xd0ff('0x29')](db[_0xd0ff('0x2a')][_0xd0ff('0x2b')],function(_0x21aa7f){return{'name':_0x21aa7f[_0xd0ff('0x2c')],'type':_0x21aa7f[_0xd0ff('0x2d')][_0xd0ff('0x2e')]};});_0x10d6ae['model']=_[_0xd0ff('0x29')](_0x4c07f9,_0xd0ff('0x27'));_0x10d6ae['query']=_['keys'](_0x4de9e5[_0xd0ff('0x2f')]);_0x10d6ae['filters']=_['intersection'](_0x10d6ae[_0xd0ff('0x30')],_0x10d6ae['query']);_0x512b32[_0xd0ff('0x31')]=_[_0xd0ff('0x32')](_0x10d6ae['model'],qs[_0xd0ff('0x33')](_0x4de9e5[_0xd0ff('0x2f')][_0xd0ff('0x33')]));_0x512b32[_0xd0ff('0x31')]=_0x512b32[_0xd0ff('0x31')][_0xd0ff('0x34')]?_0x512b32[_0xd0ff('0x31')]:_0x10d6ae[_0xd0ff('0x30')];if(!_0x4de9e5[_0xd0ff('0x2f')][_0xd0ff('0x35')]('nolimit')){_0x512b32[_0xd0ff('0x1d')]=qs[_0xd0ff('0x1d')](_0x4de9e5[_0xd0ff('0x2f')][_0xd0ff('0x1d')]);_0x512b32[_0xd0ff('0x1c')]=qs['offset'](_0x4de9e5[_0xd0ff('0x2f')]['offset']);}_0x512b32[_0xd0ff('0x36')]=qs[_0xd0ff('0x37')](_0x4de9e5[_0xd0ff('0x2f')][_0xd0ff('0x37')]);_0x512b32['where']=qs[_0xd0ff('0x38')](_[_0xd0ff('0x39')](_0x4de9e5[_0xd0ff('0x2f')],_0x10d6ae[_0xd0ff('0x38')]),_0x4c07f9);if(_0x4de9e5[_0xd0ff('0x2f')][_0xd0ff('0x3a')]){_0x512b32[_0xd0ff('0x3b')]=_[_0xd0ff('0x3c')](_0x512b32['where'],{'$or':_['map'](_0x4c07f9,function(_0x47e9e8){if(_0x47e9e8[_0xd0ff('0x2d')]!==_0xd0ff('0x3d')){var _0x324809={};_0x324809[_0x47e9e8[_0xd0ff('0x27')]]={'$like':'%'+_0x4de9e5['query']['filter']+'%'};return _0x324809;}})});}_0x512b32=_[_0xd0ff('0x3c')]({},_0x512b32,_0x4de9e5[_0xd0ff('0x3e')]);var _0x23cff3={'where':_0x512b32[_0xd0ff('0x3b')]};return db['FaxQueueReport'][_0xd0ff('0x1b')](_0x23cff3)[_0xd0ff('0x24')](function(_0x1559de){_0x5a09c1[_0xd0ff('0x1b')]=_0x1559de;if(_0x4de9e5[_0xd0ff('0x2f')]['includeAll']){_0x512b32[_0xd0ff('0x3f')]=[{'all':!![]}];}return db[_0xd0ff('0x2a')][_0xd0ff('0x40')](_0x512b32);})[_0xd0ff('0x24')](function(_0x3671f8){_0x5a09c1[_0xd0ff('0x41')]=_0x3671f8;return _0x5a09c1;})['then'](respondWithFilteredResult(_0x38f023,_0x512b32))['catch'](handleError(_0x38f023,null));};exports[_0xd0ff('0x42')]=function(_0x1c5b2e,_0xde9281){var _0x3f7312={'raw':!![],'where':{'id':_0x1c5b2e[_0xd0ff('0x43')]['id']}},_0x4650e8={};_0x4650e8[_0xd0ff('0x30')]=_['keys'](db['FaxQueueReport'][_0xd0ff('0x2b')]);_0x4650e8['query']=_['keys'](_0x1c5b2e['query']);_0x4650e8['filters']=_[_0xd0ff('0x32')](_0x4650e8[_0xd0ff('0x30')],_0x4650e8['query']);_0x3f7312[_0xd0ff('0x31')]=_[_0xd0ff('0x32')](_0x4650e8[_0xd0ff('0x30')],qs['fields'](_0x1c5b2e[_0xd0ff('0x2f')][_0xd0ff('0x33')]));_0x3f7312['attributes']=_0x3f7312[_0xd0ff('0x31')]['length']?_0x3f7312[_0xd0ff('0x31')]:_0x4650e8['model'];if(_0x1c5b2e[_0xd0ff('0x2f')][_0xd0ff('0x44')]){_0x3f7312[_0xd0ff('0x3f')]=[{'all':!![]}];}_0x3f7312=_[_0xd0ff('0x3c')]({},_0x3f7312,_0x1c5b2e['options']);return db[_0xd0ff('0x2a')][_0xd0ff('0x45')](_0x3f7312)[_0xd0ff('0x24')](handleEntityNotFound(_0xde9281,null))[_0xd0ff('0x24')](respondWithResult(_0xde9281,null))[_0xd0ff('0x46')](handleError(_0xde9281,null));};exports[_0xd0ff('0x47')]=function(_0x173a40,_0x2ed46d){return db['FaxQueueReport'][_0xd0ff('0x47')](_0x173a40['body'],{})[_0xd0ff('0x24')](respondWithResult(_0x2ed46d,0xc9))['catch'](handleError(_0x2ed46d,null));};exports[_0xd0ff('0x22')]=function(_0x271cbb,_0x2be3ba){if(_0x271cbb[_0xd0ff('0x48')]['id']){delete _0x271cbb[_0xd0ff('0x48')]['id'];}return db['FaxQueueReport'][_0xd0ff('0x45')]({'where':{'id':_0x271cbb[_0xd0ff('0x43')]['id']}})[_0xd0ff('0x24')](handleEntityNotFound(_0x2be3ba,null))[_0xd0ff('0x24')](saveUpdates(_0x271cbb['body'],null))[_0xd0ff('0x24')](respondWithResult(_0x2be3ba,null))['catch'](handleError(_0x2be3ba,null));};exports[_0xd0ff('0x23')]=function(_0x8d4c51,_0xc16570){return db[_0xd0ff('0x2a')]['find']({'where':{'id':_0x8d4c51['params']['id']}})[_0xd0ff('0x24')](handleEntityNotFound(_0xc16570,null))['then'](removeEntity(_0xc16570,null))['catch'](handleError(_0xc16570,null));};exports[_0xd0ff('0x49')]=function(_0x456c3d,_0x37f696){return db['FaxQueueReport']['describe']()['then'](respondWithResult(_0x37f696,null))[_0xd0ff('0x46')](handleError(_0x37f696,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 1dd5b22..bc51613 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 _0x77e6=['define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes'];(function(_0x224785,_0x28c2bc){var _0x390f56=function(_0x224113){while(--_0x224113){_0x224785['push'](_0x224785['shift']());}};_0x390f56(++_0x28c2bc);}(_0x77e6,0x1a6));var _0x677e=function(_0x5bb636,_0x110a54){_0x5bb636=_0x5bb636-0x0;var _0x510d35=_0x77e6[_0x5bb636];return _0x510d35;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var logger=require(_0x677e('0x2'))(_0x677e('0x3'));var moment=require(_0x677e('0x4'));var BPromise=require(_0x677e('0x5'));var rp=require(_0x677e('0x6'));var fs=require('fs');var path=require(_0x677e('0x7'));var rimraf=require('rimraf');var config=require(_0x677e('0x8'));var attributes=require(_0x677e('0x9'));module['exports']=function(_0x18c5e1,_0x591b21){return _0x18c5e1[_0x677e('0xa')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x677e('0xb'),'fields':[_0x677e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d11=['exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','moment','request-promise','path','./faxQueueReport.attributes'];(function(_0x18bf71,_0x29dfd0){var _0x928504=function(_0x45f5fa){while(--_0x45f5fa){_0x18bf71['push'](_0x18bf71['shift']());}};_0x928504(++_0x29dfd0);}(_0x6d11,0xbf));var _0x16d1=function(_0x576e35,_0x36fbe4){_0x576e35=_0x576e35-0x0;var _0x2c870c=_0x6d11[_0x576e35];return _0x2c870c;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var logger=require(_0x16d1('0x2'))('api');var moment=require(_0x16d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x16d1('0x4'));var fs=require('fs');var path=require(_0x16d1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x16d1('0x6'));module[_0x16d1('0x7')]=function(_0x3eb9e2,_0x38626d){return _0x3eb9e2[_0x16d1('0x8')](_0x16d1('0x9'),attributes,{'tableName':_0x16d1('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 88c6014..48ad853 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 _0x7527=['info','result','catch','FaxQueueReport','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','attributes','limit','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x561f42,_0x44d837){var _0x5d66c7=function(_0x100ce9){while(--_0x100ce9){_0x561f42['push'](_0x561f42['shift']());}};_0x5d66c7(++_0x44d837);}(_0x7527,0x1ec));var _0x7752=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7527[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7752('0x0'));var fs=require('fs');var Redis=require(_0x7752('0x1'));var db=require(_0x7752('0x2'))['db'];var utils=require(_0x7752('0x3'));var logger=require(_0x7752('0x4'))(_0x7752('0x5'));var config=require(_0x7752('0x6'));var jayson=require(_0x7752('0x7'));var client=jayson['client'][_0x7752('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a8868,_0x53b50e,_0x190902){return new BPromise(function(_0x43e199,_0x1e75b0){return client[_0x7752('0x9')](_0x3a8868,_0x190902)[_0x7752('0xa')](function(_0x3bce1f){logger['info'](_0x7752('0xb'),_0x53b50e,_0x7752('0xc'));logger[_0x7752('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x53b50e,'request\x20sent',JSON[_0x7752('0xe')](_0x3bce1f));if(_0x3bce1f[_0x7752('0xf')]){if(_0x3bce1f['error'][_0x7752('0x10')]===0x1f4){logger[_0x7752('0xf')](_0x7752('0xb'),_0x53b50e,_0x3bce1f[_0x7752('0xf')]['message']);return _0x1e75b0(_0x3bce1f[_0x7752('0xf')]['message']);}logger[_0x7752('0xf')](_0x7752('0xb'),_0x53b50e,_0x3bce1f[_0x7752('0xf')][_0x7752('0x11')]);return _0x43e199(_0x3bce1f['error']['message']);}else{logger[_0x7752('0x12')](_0x7752('0xb'),_0x53b50e,_0x7752('0xc'));_0x43e199(_0x3bce1f[_0x7752('0x13')]['message']);}})[_0x7752('0x14')](function(_0x5304b8){logger[_0x7752('0xf')](_0x7752('0xb'),_0x53b50e,_0x5304b8);_0x1e75b0(_0x5304b8);});});}exports['CreateFaxQueueReport']=function(_0x7e7ef9){var _0x47124f=this;return new Promise(function(_0x53ae9e,_0x18dd9d){return db[_0x7752('0x15')]['create'](_0x7e7ef9[_0x7752('0x16')],{'raw':_0x7e7ef9[_0x7752('0x17')]?_0x7e7ef9[_0x7752('0x17')][_0x7752('0x18')]===undefined?!![]:![]:!![]})[_0x7752('0xa')](function(_0x112698){logger[_0x7752('0x12')](_0x7752('0x19'),_0x7e7ef9);logger['debug']('CreateFaxQueueReport',_0x7e7ef9,JSON[_0x7752('0xe')](_0x112698));_0x53ae9e(_0x112698);})[_0x7752('0x14')](function(_0x56364a){logger[_0x7752('0xf')](_0x7752('0x19'),_0x56364a[_0x7752('0x11')],_0x7e7ef9);_0x18dd9d(_0x47124f['error'](0x1f4,_0x56364a[_0x7752('0x11')]));});});};exports[_0x7752('0x1a')]=function(_0x59aa82){var _0xd67e51=this;return new Promise(function(_0x371b92,_0x331436){return db['FaxQueueReport'][_0x7752('0x1b')](_0x59aa82[_0x7752('0x16')],{'raw':_0x59aa82['options']?_0x59aa82[_0x7752('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59aa82['options']?_0x59aa82[_0x7752('0x17')]['where']||null:null,'attributes':_0x59aa82[_0x7752('0x17')]?_0x59aa82[_0x7752('0x17')][_0x7752('0x1c')]||null:null,'limit':_0x59aa82['options']?_0x59aa82[_0x7752('0x17')][_0x7752('0x1d')]||null:null})[_0x7752('0xa')](function(_0x278d42){logger[_0x7752('0x12')](_0x7752('0x1a'),_0x59aa82);logger[_0x7752('0xd')](_0x7752('0x1a'),_0x59aa82,JSON[_0x7752('0xe')](_0x278d42));_0x371b92(_0x278d42);})[_0x7752('0x14')](function(_0x24f867){logger[_0x7752('0xf')](_0x7752('0x1a'),_0x24f867['message'],_0x59aa82);_0x331436(_0xd67e51[_0x7752('0xf')](0x1f4,_0x24f867[_0x7752('0x11')]));});});}; \ No newline at end of file +var _0x2e88=['body','options','debug','UpdateFaxQueueReport','update','raw','where','attributes','limit','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','result','CreateFaxQueueReport','FaxQueueReport','create'];(function(_0x165d6d,_0x29eda1){var _0x164c91=function(_0x509a85){while(--_0x509a85){_0x165d6d['push'](_0x165d6d['shift']());}};_0x164c91(++_0x29eda1);}(_0x2e88,0x15e));var _0x82e8=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0x2e88[_0x4551f6];return _0x581dc2;};'use strict';var _=require(_0x82e8('0x0'));var util=require(_0x82e8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x82e8('0x2'));var fs=require('fs');var Redis=require(_0x82e8('0x3'));var db=require(_0x82e8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82e8('0x5'))(_0x82e8('0x6'));var config=require(_0x82e8('0x7'));var jayson=require(_0x82e8('0x8'));var client=jayson[_0x82e8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bb11b,_0x2a5f2b,_0x3f3cb5){return new BPromise(function(_0x1546be,_0x246ba0){return client[_0x82e8('0xa')](_0x4bb11b,_0x3f3cb5)[_0x82e8('0xb')](function(_0x452cab){logger[_0x82e8('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x2a5f2b,'request\x20sent');logger['debug'](_0x82e8('0xd'),_0x2a5f2b,_0x82e8('0xe'),JSON[_0x82e8('0xf')](_0x452cab));if(_0x452cab[_0x82e8('0x10')]){if(_0x452cab[_0x82e8('0x10')][_0x82e8('0x11')]===0x1f4){logger[_0x82e8('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x2a5f2b,_0x452cab['error'][_0x82e8('0x12')]);return _0x246ba0(_0x452cab[_0x82e8('0x10')][_0x82e8('0x12')]);}logger[_0x82e8('0x10')](_0x82e8('0x13'),_0x2a5f2b,_0x452cab[_0x82e8('0x10')][_0x82e8('0x12')]);return _0x1546be(_0x452cab[_0x82e8('0x10')][_0x82e8('0x12')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x2a5f2b,_0x82e8('0xe'));_0x1546be(_0x452cab[_0x82e8('0x14')]['message']);}})['catch'](function(_0x3d9ee5){logger[_0x82e8('0x10')](_0x82e8('0x13'),_0x2a5f2b,_0x3d9ee5);_0x246ba0(_0x3d9ee5);});});}exports[_0x82e8('0x15')]=function(_0x2dedb7){var _0x51169b=this;return new Promise(function(_0xf00abe,_0x4d2ffb){return db[_0x82e8('0x16')][_0x82e8('0x17')](_0x2dedb7[_0x82e8('0x18')],{'raw':_0x2dedb7[_0x82e8('0x19')]?_0x2dedb7['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x408fec){logger[_0x82e8('0xc')]('CreateFaxQueueReport',_0x2dedb7);logger[_0x82e8('0x1a')](_0x82e8('0x15'),_0x2dedb7,JSON[_0x82e8('0xf')](_0x408fec));_0xf00abe(_0x408fec);})['catch'](function(_0x1c81ba){logger['error']('CreateFaxQueueReport',_0x1c81ba['message'],_0x2dedb7);_0x4d2ffb(_0x51169b['error'](0x1f4,_0x1c81ba[_0x82e8('0x12')]));});});};exports[_0x82e8('0x1b')]=function(_0x520d13){var _0x2bae1d=this;return new Promise(function(_0x40d8e4,_0x1f0cdc){return db[_0x82e8('0x16')][_0x82e8('0x1c')](_0x520d13[_0x82e8('0x18')],{'raw':_0x520d13[_0x82e8('0x19')]?_0x520d13[_0x82e8('0x19')][_0x82e8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x520d13[_0x82e8('0x19')]?_0x520d13[_0x82e8('0x19')][_0x82e8('0x1e')]||null:null,'attributes':_0x520d13[_0x82e8('0x19')]?_0x520d13[_0x82e8('0x19')][_0x82e8('0x1f')]||null:null,'limit':_0x520d13[_0x82e8('0x19')]?_0x520d13[_0x82e8('0x19')][_0x82e8('0x20')]||null:null})[_0x82e8('0xb')](function(_0x3e1042){logger[_0x82e8('0xc')](_0x82e8('0x1b'),_0x520d13);logger[_0x82e8('0x1a')](_0x82e8('0x1b'),_0x520d13,JSON['stringify'](_0x3e1042));_0x40d8e4(_0x3e1042);})[_0x82e8('0x21')](function(_0x504ecb){logger[_0x82e8('0x10')]('UpdateFaxQueueReport',_0x504ecb[_0x82e8('0x12')],_0x520d13);_0x1f0cdc(_0x2bae1d['error'](0x1f4,_0x504ecb['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 31dc712..ee7c6fb 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 _0xcde0=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update','destroy'];(function(_0xb1baff,_0x3b8591){var _0x5a7dfe=function(_0x55abd3){while(--_0x55abd3){_0xb1baff['push'](_0xb1baff['shift']());}};_0x5a7dfe(++_0x3b8591);}(_0xcde0,0x133));var _0x0cde=function(_0x56dba7,_0x597030){_0x56dba7=_0x56dba7-0x0;var _0x32e3ed=_0xcde0[_0x56dba7];return _0x32e3ed;};'use strict';var multer=require(_0x0cde('0x0'));var util=require(_0x0cde('0x1'));var path=require(_0x0cde('0x2'));var timeout=require(_0x0cde('0x3'));var express=require(_0x0cde('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0cde('0x5'));var config=require('../../config/environment');var controller=require(_0x0cde('0x6'));router[_0x0cde('0x7')]('/',auth[_0x0cde('0x8')](),controller[_0x0cde('0x9')]);router[_0x0cde('0x7')](_0x0cde('0xa'),auth[_0x0cde('0x8')](),controller['describe']);router[_0x0cde('0x7')](_0x0cde('0xb'),auth[_0x0cde('0x8')](),controller['show']);router[_0x0cde('0xc')]('/',auth[_0x0cde('0x8')](),controller[_0x0cde('0xd')]);router[_0x0cde('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x0cde('0xf')]);router['delete'](_0x0cde('0xb'),auth[_0x0cde('0x8')](),controller[_0x0cde('0x10')]);module[_0x0cde('0x11')]=router; \ No newline at end of file +var _0xf444=['update','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','create','put'];(function(_0x11fd2b,_0x5c77b2){var _0x1d948c=function(_0x324cf1){while(--_0x324cf1){_0x11fd2b['push'](_0x11fd2b['shift']());}};_0x1d948c(++_0x5c77b2);}(_0xf444,0x17a));var _0x4f44=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xf444[_0x47b58b];return _0x46bebe;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4f44('0x0'));var router=express[_0x4f44('0x1')]();var auth=require(_0x4f44('0x2'));var interaction=require(_0x4f44('0x3'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x4f44('0x4')]('/',auth[_0x4f44('0x5')](),controller[_0x4f44('0x6')]);router[_0x4f44('0x4')](_0x4f44('0x7'),auth[_0x4f44('0x5')](),controller[_0x4f44('0x8')]);router['get'](_0x4f44('0x9'),auth[_0x4f44('0x5')](),controller['show']);router['post']('/',auth[_0x4f44('0x5')](),controller[_0x4f44('0xa')]);router[_0x4f44('0xb')](_0x4f44('0x9'),auth[_0x4f44('0x5')](),controller[_0x4f44('0xc')]);router['delete'](_0x4f44('0x9'),auth[_0x4f44('0x5')](),controller[_0x4f44('0xd')]);module[_0x4f44('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 6416bbf..5bdf57a 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 _0xcae8=['DATE','moment','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x298b71,_0x59291a){var _0x4adcd6=function(_0x325152){while(--_0x325152){_0x298b71['push'](_0x298b71['shift']());}};_0x4adcd6(++_0x59291a);}(_0xcae8,0x121));var _0x8cae=function(_0x16bb0e,_0x343132){_0x16bb0e=_0x16bb0e-0x0;var _0x102b8b=_0xcae8[_0x16bb0e];return _0x102b8b;};'use strict';var moment=require(_0x8cae('0x0'));var Sequelize=require(_0x8cae('0x1'));module[_0x8cae('0x2')]={'uniqueid':{'type':Sequelize[_0x8cae('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8cae('0x4')](_0x8cae('0x5'),_0x8cae('0x6'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x8cae('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xae40=['ENUM','account','agent','DATE','NOW','sequelize','exports','STRING'];(function(_0x4716b1,_0x1bb2b7){var _0x4f7045=function(_0x3bc1bb){while(--_0x3bc1bb){_0x4716b1['push'](_0x4716b1['shift']());}};_0x4f7045(++_0x1bb2b7);}(_0xae40,0xf5));var _0x0ae4=function(_0x2f8f78,_0x19c238){_0x2f8f78=_0x2f8f78-0x0;var _0x33c2d6=_0xae40[_0x2f8f78];return _0x33c2d6;};'use strict';var moment=require('moment');var Sequelize=require(_0x0ae4('0x0'));module[_0x0ae4('0x1')]={'uniqueid':{'type':Sequelize[_0x0ae4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0ae4('0x3')](_0x0ae4('0x4'),_0x0ae4('0x5'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x0ae4('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x0ae4('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 24da8e9..b9d7ac9 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 _0x5f2f=['set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','FaxTransferReport','then','include','rows','catch','show','params','intersection','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x128f3a,_0x929550){_0x128f3a=_0x128f3a-0x0;var _0x523696=_0x5f2f[_0x128f3a];return _0x523696;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(!_0x287ad5){_0x4e8bda['sendStatus'](0x194);}return _0x287ad5;};}function handleError(_0x529f07,_0x5f1124){_0x5f1124=_0x5f1124||0x1f4;return function(_0x3f79d5){logger[_0xf5f2('0x25')](_0x3f79d5[_0xf5f2('0x26')]);if(_0x3f79d5[_0xf5f2('0x27')]){delete _0x3f79d5[_0xf5f2('0x27')];}_0x529f07[_0xf5f2('0x18')](_0x5f1124)[_0xf5f2('0x28')](_0x3f79d5);};}exports[_0xf5f2('0x29')]=function(_0x4ab014,_0xaa2602){var _0x102449={},_0x375ca8={},_0x31bfcb={'count':0x0,'rows':[]};var _0x198c73=_[_0xf5f2('0x2a')](db['FaxTransferReport']['rawAttributes'],function(_0x22c826){return{'name':_0x22c826[_0xf5f2('0x2b')],'type':_0x22c826[_0xf5f2('0x2c')]['key']};});_0x375ca8['model']=_[_0xf5f2('0x2a')](_0x198c73,_0xf5f2('0x27'));_0x375ca8[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x4ab014[_0xf5f2('0x2d')]);_0x375ca8['filters']=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],_0x375ca8['query']);_0x102449[_0xf5f2('0x30')]=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x102449[_0xf5f2('0x30')]=_0x102449[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x102449[_0xf5f2('0x30')]:_0x375ca8['model'];if(!_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x33')](_0xf5f2('0x34'))){_0x102449[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x1c')]);_0x102449['offset']=qs[_0xf5f2('0x1b')](_0x4ab014[_0xf5f2('0x2d')]['offset']);}_0x102449[_0xf5f2('0x35')]=qs['sort'](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x36')]);_0x102449[_0xf5f2('0x37')]=qs[_0xf5f2('0x38')](_['pick'](_0x4ab014['query'],_0x375ca8[_0xf5f2('0x38')]),_0x198c73);if(_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]){_0x102449['where']=_[_0xf5f2('0x3a')](_0x102449['where'],{'$or':_[_0xf5f2('0x2a')](_0x198c73,function(_0x566c47){if(_0x566c47[_0xf5f2('0x2c')]!==_0xf5f2('0x3b')){var _0x5337a6={};_0x5337a6[_0x566c47[_0xf5f2('0x27')]]={'$like':'%'+_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]+'%'};return _0x5337a6;}})});}_0x102449=_[_0xf5f2('0x3a')]({},_0x102449,_0x4ab014['options']);var _0x5d2d82={'where':_0x102449[_0xf5f2('0x37')]};return db[_0xf5f2('0x3c')][_0xf5f2('0x1a')](_0x5d2d82)[_0xf5f2('0x3d')](function(_0x2c7f65){_0x31bfcb[_0xf5f2('0x1a')]=_0x2c7f65;if(_0x4ab014[_0xf5f2('0x2d')]['includeAll']){_0x102449[_0xf5f2('0x3e')]=[{'all':!![]}];}return db[_0xf5f2('0x3c')]['findAll'](_0x102449);})[_0xf5f2('0x3d')](function(_0x3f3895){_0x31bfcb[_0xf5f2('0x3f')]=_0x3f3895;return _0x31bfcb;})[_0xf5f2('0x3d')](respondWithFilteredResult(_0xaa2602,_0x102449))[_0xf5f2('0x40')](handleError(_0xaa2602,null));};exports[_0xf5f2('0x41')]=function(_0x462ea3,_0x2083b3){var _0x574f24={'raw':!![],'where':{'id':_0x462ea3[_0xf5f2('0x42')]['id']}},_0x31c3c={};_0x31c3c[_0xf5f2('0x2f')]=_['keys'](db['FaxTransferReport']['rawAttributes']);_0x31c3c[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x462ea3['query']);_0x31c3c[_0xf5f2('0x38')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],_0x31c3c[_0xf5f2('0x2d')]);_0x574f24[_0xf5f2('0x30')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x462ea3[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x574f24[_0xf5f2('0x30')]=_0x574f24[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x574f24[_0xf5f2('0x30')]:_0x31c3c['model'];if(_0x462ea3[_0xf5f2('0x2d')]['includeAll']){_0x574f24[_0xf5f2('0x3e')]=[{'all':!![]}];}_0x574f24=_[_0xf5f2('0x3a')]({},_0x574f24,_0x462ea3[_0xf5f2('0x44')]);return db[_0xf5f2('0x3c')][_0xf5f2('0x45')](_0x574f24)[_0xf5f2('0x3d')](handleEntityNotFound(_0x2083b3,null))['then'](respondWithResult(_0x2083b3,null))[_0xf5f2('0x40')](handleError(_0x2083b3,null));};exports[_0xf5f2('0x46')]=function(_0x1c1497,_0x29b108){return db[_0xf5f2('0x3c')][_0xf5f2('0x46')](_0x1c1497[_0xf5f2('0x47')],{})[_0xf5f2('0x3d')](respondWithResult(_0x29b108,0xc9))['catch'](handleError(_0x29b108,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x47')]['id'];}return db[_0xf5f2('0x3c')][_0xf5f2('0x45')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x3d')](saveUpdates(_0x33ec29[_0xf5f2('0x47')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x40')](handleError(_0x45db9a,null));};exports['destroy']=function(_0x740321,_0x497eb8){return db[_0xf5f2('0x3c')]['find']({'where':{'id':_0x740321[_0xf5f2('0x42')]['id']}})[_0xf5f2('0x3d')](handleEntityNotFound(_0x497eb8,null))[_0xf5f2('0x3d')](removeEntity(_0x497eb8,null))[_0xf5f2('0x40')](handleError(_0x497eb8,null));};exports['describe']=function(_0x3154c1,_0x2b782f){return db['FaxTransferReport']['describe']()[_0xf5f2('0x3d')](respondWithResult(_0x2b782f,null))[_0xf5f2('0x40')](handleError(_0x2b782f,null));}; \ No newline at end of file +var _0x5f2f=['set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','FaxTransferReport','then','include','rows','catch','show','params','intersection','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x5f2f,0x73));var _0xf5f2=function(_0x55d86b,_0x55a8cb){_0x55d86b=_0x55d86b-0x0;var _0x487cc8=_0x5f2f[_0x55d86b];return _0x487cc8;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(!_0x287ad5){_0x4e8bda['sendStatus'](0x194);}return _0x287ad5;};}function handleError(_0x529f07,_0x5f1124){_0x5f1124=_0x5f1124||0x1f4;return function(_0x3f79d5){logger[_0xf5f2('0x25')](_0x3f79d5[_0xf5f2('0x26')]);if(_0x3f79d5[_0xf5f2('0x27')]){delete _0x3f79d5[_0xf5f2('0x27')];}_0x529f07[_0xf5f2('0x18')](_0x5f1124)[_0xf5f2('0x28')](_0x3f79d5);};}exports[_0xf5f2('0x29')]=function(_0x4ab014,_0xaa2602){var _0x102449={},_0x375ca8={},_0x31bfcb={'count':0x0,'rows':[]};var _0x198c73=_[_0xf5f2('0x2a')](db['FaxTransferReport']['rawAttributes'],function(_0x22c826){return{'name':_0x22c826[_0xf5f2('0x2b')],'type':_0x22c826[_0xf5f2('0x2c')]['key']};});_0x375ca8['model']=_[_0xf5f2('0x2a')](_0x198c73,_0xf5f2('0x27'));_0x375ca8[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x4ab014[_0xf5f2('0x2d')]);_0x375ca8['filters']=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],_0x375ca8['query']);_0x102449[_0xf5f2('0x30')]=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x102449[_0xf5f2('0x30')]=_0x102449[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x102449[_0xf5f2('0x30')]:_0x375ca8['model'];if(!_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x33')](_0xf5f2('0x34'))){_0x102449[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x1c')]);_0x102449['offset']=qs[_0xf5f2('0x1b')](_0x4ab014[_0xf5f2('0x2d')]['offset']);}_0x102449[_0xf5f2('0x35')]=qs['sort'](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x36')]);_0x102449[_0xf5f2('0x37')]=qs[_0xf5f2('0x38')](_['pick'](_0x4ab014['query'],_0x375ca8[_0xf5f2('0x38')]),_0x198c73);if(_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]){_0x102449['where']=_[_0xf5f2('0x3a')](_0x102449['where'],{'$or':_[_0xf5f2('0x2a')](_0x198c73,function(_0x566c47){if(_0x566c47[_0xf5f2('0x2c')]!==_0xf5f2('0x3b')){var _0x5337a6={};_0x5337a6[_0x566c47[_0xf5f2('0x27')]]={'$like':'%'+_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]+'%'};return _0x5337a6;}})});}_0x102449=_[_0xf5f2('0x3a')]({},_0x102449,_0x4ab014['options']);var _0x5d2d82={'where':_0x102449[_0xf5f2('0x37')]};return db[_0xf5f2('0x3c')][_0xf5f2('0x1a')](_0x5d2d82)[_0xf5f2('0x3d')](function(_0x2c7f65){_0x31bfcb[_0xf5f2('0x1a')]=_0x2c7f65;if(_0x4ab014[_0xf5f2('0x2d')]['includeAll']){_0x102449[_0xf5f2('0x3e')]=[{'all':!![]}];}return db[_0xf5f2('0x3c')]['findAll'](_0x102449);})[_0xf5f2('0x3d')](function(_0x3f3895){_0x31bfcb[_0xf5f2('0x3f')]=_0x3f3895;return _0x31bfcb;})[_0xf5f2('0x3d')](respondWithFilteredResult(_0xaa2602,_0x102449))[_0xf5f2('0x40')](handleError(_0xaa2602,null));};exports[_0xf5f2('0x41')]=function(_0x462ea3,_0x2083b3){var _0x574f24={'raw':!![],'where':{'id':_0x462ea3[_0xf5f2('0x42')]['id']}},_0x31c3c={};_0x31c3c[_0xf5f2('0x2f')]=_['keys'](db['FaxTransferReport']['rawAttributes']);_0x31c3c[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x462ea3['query']);_0x31c3c[_0xf5f2('0x38')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],_0x31c3c[_0xf5f2('0x2d')]);_0x574f24[_0xf5f2('0x30')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x462ea3[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x574f24[_0xf5f2('0x30')]=_0x574f24[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x574f24[_0xf5f2('0x30')]:_0x31c3c['model'];if(_0x462ea3[_0xf5f2('0x2d')]['includeAll']){_0x574f24[_0xf5f2('0x3e')]=[{'all':!![]}];}_0x574f24=_[_0xf5f2('0x3a')]({},_0x574f24,_0x462ea3[_0xf5f2('0x44')]);return db[_0xf5f2('0x3c')][_0xf5f2('0x45')](_0x574f24)[_0xf5f2('0x3d')](handleEntityNotFound(_0x2083b3,null))['then'](respondWithResult(_0x2083b3,null))[_0xf5f2('0x40')](handleError(_0x2083b3,null));};exports[_0xf5f2('0x46')]=function(_0x1c1497,_0x29b108){return db[_0xf5f2('0x3c')][_0xf5f2('0x46')](_0x1c1497[_0xf5f2('0x47')],{})[_0xf5f2('0x3d')](respondWithResult(_0x29b108,0xc9))['catch'](handleError(_0x29b108,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x47')]['id'];}return db[_0xf5f2('0x3c')][_0xf5f2('0x45')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x3d')](saveUpdates(_0x33ec29[_0xf5f2('0x47')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x40')](handleError(_0x45db9a,null));};exports['destroy']=function(_0x740321,_0x497eb8){return db[_0xf5f2('0x3c')]['find']({'where':{'id':_0x740321[_0xf5f2('0x42')]['id']}})[_0xf5f2('0x3d')](handleEntityNotFound(_0x497eb8,null))[_0xf5f2('0x3d')](removeEntity(_0x497eb8,null))[_0xf5f2('0x40')](handleError(_0x497eb8,null));};exports['describe']=function(_0x3154c1,_0x2b782f){return db['FaxTransferReport']['describe']()[_0xf5f2('0x3d')](respondWithResult(_0x2b782f,null))[_0xf5f2('0x40')](handleError(_0x2b782f,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 21b20fd..3591acc 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 _0x2242=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./faxTransferReport.attributes','exports','define'];(function(_0x2dacca,_0x3b55a5){var _0x4e8745=function(_0x4c4515){while(--_0x4c4515){_0x2dacca['push'](_0x2dacca['shift']());}};_0x4e8745(++_0x3b55a5);}(_0x2242,0x1a3));var _0x2224=function(_0x3ce7e5,_0x33960a){_0x3ce7e5=_0x3ce7e5-0x0;var _0x2425cc=_0x2242[_0x3ce7e5];return _0x2425cc;};'use strict';var _=require(_0x2224('0x0'));var util=require(_0x2224('0x1'));var logger=require(_0x2224('0x2'))('api');var moment=require(_0x2224('0x3'));var BPromise=require(_0x2224('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2224('0x5'));var rimraf=require(_0x2224('0x6'));var config=require('../../config/environment');var attributes=require(_0x2224('0x7'));module[_0x2224('0x8')]=function(_0x23a873,_0x54d057){return _0x23a873[_0x2224('0x9')](_0x2224('0xa'),attributes,{'tableName':_0x2224('0xb'),'paranoid':![],'indexes':[{'name':_0x2224('0xc'),'fields':[_0x2224('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xec08=['exports','define','FaxTransferReport','report_fax_transfer','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x5dac08,_0x4b11a1){var _0x1ad882=function(_0x3b2f3e){while(--_0x3b2f3e){_0x5dac08['push'](_0x5dac08['shift']());}};_0x1ad882(++_0x4b11a1);}(_0xec08,0xad));var _0x8ec0=function(_0x35e2e8,_0x1d90ec){_0x35e2e8=_0x35e2e8-0x0;var _0x4bc1d=_0xec08[_0x35e2e8];return _0x4bc1d;};'use strict';var _=require('lodash');var util=require(_0x8ec0('0x0'));var logger=require('../../config/logger')(_0x8ec0('0x1'));var moment=require(_0x8ec0('0x2'));var BPromise=require(_0x8ec0('0x3'));var rp=require(_0x8ec0('0x4'));var fs=require('fs');var path=require(_0x8ec0('0x5'));var rimraf=require(_0x8ec0('0x6'));var config=require(_0x8ec0('0x7'));var attributes=require(_0x8ec0('0x8'));module[_0x8ec0('0x9')]=function(_0xb911ef,_0x3e50c7){return _0xb911ef[_0x8ec0('0xa')](_0x8ec0('0xb'),attributes,{'tableName':_0x8ec0('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8ec0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 19a13d1..baf0177 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 _0x00fd=['request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x00fd,0x68));var _0xd00f=function(_0xd45f89,_0x49ec14){_0xd45f89=_0xd45f89-0x0;var _0x1b99b3=_0x00fd[_0xd45f89];return _0x1b99b3;};'use strict';var _=require(_0xd00f('0x0'));var util=require(_0xd00f('0x1'));var moment=require(_0xd00f('0x2'));var BPromise=require(_0xd00f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd00f('0x4'));var db=require(_0xd00f('0x5'))['db'];var utils=require(_0xd00f('0x6'));var logger=require(_0xd00f('0x7'))(_0xd00f('0x8'));var config=require(_0xd00f('0x9'));var jayson=require(_0xd00f('0xa'));var client=jayson[_0xd00f('0xb')][_0xd00f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c6855,_0x598b14,_0x257282){return new BPromise(function(_0xd60221,_0x33e124){return client['request'](_0x5c6855,_0x257282)[_0xd00f('0xd')](function(_0xeb7d20){logger[_0xd00f('0xe')](_0xd00f('0xf'),_0x598b14,_0xd00f('0x10'));logger[_0xd00f('0x11')](_0xd00f('0x12'),_0x598b14,'request\x20sent',JSON[_0xd00f('0x13')](_0xeb7d20));if(_0xeb7d20[_0xd00f('0x14')]){if(_0xeb7d20[_0xd00f('0x14')][_0xd00f('0x15')]===0x1f4){logger[_0xd00f('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x598b14,_0xeb7d20[_0xd00f('0x14')][_0xd00f('0x16')]);return _0x33e124(_0xeb7d20[_0xd00f('0x14')][_0xd00f('0x16')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x598b14,_0xeb7d20[_0xd00f('0x14')][_0xd00f('0x16')]);return _0xd60221(_0xeb7d20[_0xd00f('0x14')][_0xd00f('0x16')]);}else{logger[_0xd00f('0xe')](_0xd00f('0xf'),_0x598b14,_0xd00f('0x10'));_0xd60221(_0xeb7d20['result'][_0xd00f('0x16')]);}})[_0xd00f('0x17')](function(_0x1767ab){logger[_0xd00f('0x14')](_0xd00f('0xf'),_0x598b14,_0x1767ab);_0x33e124(_0x1767ab);});});} \ No newline at end of file +var _0xe800=['jayson/promise','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe800,0xb7));var _0x0e80=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xe800[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0e80('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e80('0x1'));var db=require(_0x0e80('0x2'))['db'];var utils=require(_0x0e80('0x3'));var logger=require(_0x0e80('0x4'))(_0x0e80('0x5'));var config=require(_0x0e80('0x6'));var jayson=require(_0x0e80('0x7'));var client=jayson['client'][_0x0e80('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x440c35,_0x346bcd,_0x2f0f41){return new BPromise(function(_0x45dde1,_0x5070a4){return client['request'](_0x440c35,_0x2f0f41)[_0x0e80('0x9')](function(_0x30db9c){logger[_0x0e80('0xa')](_0x0e80('0xb'),_0x346bcd,_0x0e80('0xc'));logger[_0x0e80('0xd')](_0x0e80('0xe'),_0x346bcd,'request\x20sent',JSON[_0x0e80('0xf')](_0x30db9c));if(_0x30db9c[_0x0e80('0x10')]){if(_0x30db9c['error'][_0x0e80('0x11')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x346bcd,_0x30db9c['error'][_0x0e80('0x12')]);return _0x5070a4(_0x30db9c[_0x0e80('0x10')]['message']);}logger[_0x0e80('0x10')](_0x0e80('0xb'),_0x346bcd,_0x30db9c[_0x0e80('0x10')][_0x0e80('0x12')]);return _0x45dde1(_0x30db9c[_0x0e80('0x10')][_0x0e80('0x12')]);}else{logger[_0x0e80('0xa')](_0x0e80('0xb'),_0x346bcd,'request\x20sent');_0x45dde1(_0x30db9c['result'][_0x0e80('0x12')]);}})['catch'](function(_0x37aed8){logger[_0x0e80('0x10')](_0x0e80('0xb'),_0x346bcd,_0x37aed8);_0x5070a4(_0x37aed8);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index bdef35e..1ec7202 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 _0x0743=['update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','./faxTransferReport.controller','get','index','describe','/:id','isAuthenticated','show','post','create','put'];(function(_0x4b951a,_0x22d91c){var _0x1556c8=function(_0x5d8e79){while(--_0x5d8e79){_0x4b951a['push'](_0x4b951a['shift']());}};_0x1556c8(++_0x22d91c);}(_0x0743,0x1a6));var _0x3074=function(_0xf0c749,_0x3ec299){_0xf0c749=_0xf0c749-0x0;var _0x49d64c=_0x0743[_0xf0c749];return _0x49d64c;};'use strict';var multer=require(_0x3074('0x0'));var util=require(_0x3074('0x1'));var path=require(_0x3074('0x2'));var timeout=require(_0x3074('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3074('0x4'));var config=require('../../config/environment');var controller=require(_0x3074('0x5'));router[_0x3074('0x6')]('/',auth['isAuthenticated'](),controller[_0x3074('0x7')]);router[_0x3074('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x3074('0x8')]);router[_0x3074('0x6')](_0x3074('0x9'),auth[_0x3074('0xa')](),controller[_0x3074('0xb')]);router[_0x3074('0xc')]('/',auth[_0x3074('0xa')](),controller[_0x3074('0xd')]);router[_0x3074('0xe')](_0x3074('0x9'),auth[_0x3074('0xa')](),controller[_0x3074('0xf')]);router[_0x3074('0x10')](_0x3074('0x9'),auth[_0x3074('0xa')](),controller[_0x3074('0x11')]);module[_0x3074('0x12')]=router; \ No newline at end of file +var _0x49a7=['describe','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated'];(function(_0x552a40,_0x5d3c91){var _0x3164b8=function(_0x3fcb0c){while(--_0x3fcb0c){_0x552a40['push'](_0x552a40['shift']());}};_0x3164b8(++_0x5d3c91);}(_0x49a7,0x119));var _0x749a=function(_0x4f48d2,_0x4b30a6){_0x4f48d2=_0x4f48d2-0x0;var _0x219bf9=_0x49a7[_0x4f48d2];return _0x219bf9;};'use strict';var multer=require(_0x749a('0x0'));var util=require(_0x749a('0x1'));var path=require('path');var timeout=require(_0x749a('0x2'));var express=require(_0x749a('0x3'));var router=express[_0x749a('0x4')]();var auth=require(_0x749a('0x5'));var interaction=require(_0x749a('0x6'));var config=require(_0x749a('0x7'));var controller=require(_0x749a('0x8'));router[_0x749a('0x9')]('/',auth['isAuthenticated'](),controller[_0x749a('0xa')]);router[_0x749a('0x9')](_0x749a('0xb'),auth[_0x749a('0xc')](),controller[_0x749a('0xd')]);router[_0x749a('0x9')](_0x749a('0xe'),auth[_0x749a('0xc')](),controller[_0x749a('0xf')]);router[_0x749a('0x10')]('/',auth[_0x749a('0xc')](),controller['create']);router[_0x749a('0x11')](_0x749a('0xe'),auth[_0x749a('0xc')](),controller[_0x749a('0x12')]);router[_0x749a('0x13')]('/:id',auth[_0x749a('0xc')](),controller['destroy']);module[_0x749a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 563d4d7..5c31e6b 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 _0x7118=['get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7118,0x159));var _0x8711=function(_0x47db57,_0x502179){_0x47db57=_0x47db57-0x0;var _0x59aa44=_0x7118[_0x47db57];return _0x59aa44;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8711('0x0'));var timeout=require(_0x8711('0x1'));var express=require('express');var router=express[_0x8711('0x2')]();var auth=require(_0x8711('0x3'));var interaction=require(_0x8711('0x4'));var config=require(_0x8711('0x5'));var controller=require(_0x8711('0x6'));router[_0x8711('0x7')]('/',auth[_0x8711('0x8')](),controller['index']);router[_0x8711('0x7')](_0x8711('0x9'),auth[_0x8711('0x8')](),controller[_0x8711('0xa')]);router[_0x8711('0x7')](_0x8711('0xb'),auth[_0x8711('0x8')](),controller[_0x8711('0xc')]);router[_0x8711('0x7')](_0x8711('0xd'),auth[_0x8711('0x8')](),controller['getFields']);router['post']('/',auth[_0x8711('0x8')](),controller[_0x8711('0xe')]);router[_0x8711('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8711('0x10')]);router[_0x8711('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8711('0x12')]);router[_0x8711('0x13')](_0x8711('0x9'),auth[_0x8711('0x8')](),controller[_0x8711('0x14')]);module[_0x8711('0x15')]=router; \ No newline at end of file +var _0x3eea=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','getFields','post','create','addConfiguration','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5a0613,_0x4bac4c){var _0x3e7796=function(_0x2c8196){while(--_0x2c8196){_0x5a0613['push'](_0x5a0613['shift']());}};_0x3e7796(++_0x4bac4c);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x1d4b85,_0x3d86aa){_0x1d4b85=_0x1d4b85-0x0;var _0x5d0e7e=_0x3eea[_0x1d4b85];return _0x5d0e7e;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var auth=require(_0xa3ee('0x5'));var interaction=require(_0xa3ee('0x6'));var config=require(_0xa3ee('0x7'));var controller=require(_0xa3ee('0x8'));router[_0xa3ee('0x9')]('/',auth[_0xa3ee('0xa')](),controller[_0xa3ee('0xb')]);router['get']('/:id',auth[_0xa3ee('0xa')](),controller['show']);router[_0xa3ee('0x9')]('/:id/configurations',auth[_0xa3ee('0xa')](),controller['getConfigurations']);router[_0xa3ee('0x9')]('/:id/fields',auth[_0xa3ee('0xa')](),controller[_0xa3ee('0xc')]);router[_0xa3ee('0xd')]('/',auth['isAuthenticated'](),controller[_0xa3ee('0xe')]);router[_0xa3ee('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xa3ee('0xf')]);router[_0xa3ee('0x10')](_0xa3ee('0x11'),auth[_0xa3ee('0xa')](),controller['update']);router[_0xa3ee('0x12')]('/:id',auth[_0xa3ee('0xa')](),controller[_0xa3ee('0x13')]);module[_0xa3ee('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index e62b406..a5019d6 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 _0xa07f=['integrationTab','sequelize','exports','STRING','basic','ENUM'];(function(_0x2d94db,_0x200b78){var _0x2a4663=function(_0x411120){while(--_0x411120){_0x2d94db['push'](_0x2d94db['shift']());}};_0x2a4663(++_0x200b78);}(_0xa07f,0xeb));var _0xfa07=function(_0xcc3729,_0x785082){_0xcc3729=_0xcc3729-0x0;var _0x16b4aa=_0xa07f[_0xcc3729];return _0x16b4aa;};'use strict';var Sequelize=require(_0xfa07('0x0'));module[_0xfa07('0x1')]={'name':{'type':Sequelize[_0xfa07('0x2')]},'description':{'type':Sequelize[_0xfa07('0x2')]},'username':{'type':Sequelize[_0xfa07('0x2')]},'remoteUri':{'type':Sequelize[_0xfa07('0x2')]},'authType':{'type':Sequelize['ENUM'](_0xfa07('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xfa07('0x2')]},'consumerKey':{'type':Sequelize[_0xfa07('0x2')]},'consumerSecret':{'type':Sequelize[_0xfa07('0x2')]},'token':{'type':Sequelize[_0xfa07('0x2')]},'tokenSecret':{'type':Sequelize[_0xfa07('0x2')]},'serverUrl':{'type':Sequelize[_0xfa07('0x2')]},'type':{'type':Sequelize[_0xfa07('0x4')](_0xfa07('0x5'),'newTab'),'defaultValue':_0xfa07('0x5')}}; \ No newline at end of file +var _0x16ff=['exports','STRING','basic','ENUM','integrationTab','newTab','sequelize'];(function(_0x17dcb2,_0x92191a){var _0x1262d4=function(_0x572661){while(--_0x572661){_0x17dcb2['push'](_0x17dcb2['shift']());}};_0x1262d4(++_0x92191a);}(_0x16ff,0x8b));var _0xf16f=function(_0x4ca4ef,_0x9e82fa){_0x4ca4ef=_0x4ca4ef-0x0;var _0x3e9f35=_0x16ff[_0x4ca4ef];return _0x3e9f35;};'use strict';var Sequelize=require(_0xf16f('0x0'));module[_0xf16f('0x1')]={'name':{'type':Sequelize[_0xf16f('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf16f('0x2')]},'remoteUri':{'type':Sequelize[_0xf16f('0x2')]},'authType':{'type':Sequelize['ENUM'](_0xf16f('0x3')),'defaultValue':_0xf16f('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xf16f('0x2')]},'consumerSecret':{'type':Sequelize[_0xf16f('0x2')]},'token':{'type':Sequelize[_0xf16f('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf16f('0x4')](_0xf16f('0x5'),_0xf16f('0x6')),'defaultValue':_0xf16f('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 37bd2f1..1635304 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 _0xdb16=['catch','sendStatus','status','end','json','count','set','reject','save','update','destroy','stack','name','send','map','DeskAccount','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','offset','order','sort','filter','merge','type','VIRTUAL','options','where','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','format','application/json','basic','headers','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x549e49,_0x94ee2f){var _0x53fdd3=function(_0x3a7710){while(--_0x3a7710){_0x549e49['push'](_0x549e49['shift']());}};_0x53fdd3(++_0x94ee2f);}(_0xdb16,0x153));var _0x6db1=function(_0x324fe8,_0x1ccb46){_0x324fe8=_0x324fe8-0x0;var _0x4a1cd9=_0xdb16[_0x324fe8];return _0x4a1cd9;};'use strict';var pdf=require(_0x6db1('0x0'));var emlformat=require(_0x6db1('0x1'));var rimraf=require(_0x6db1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6db1('0x3'));var moment=require(_0x6db1('0x4'));var BPromise=require(_0x6db1('0x5'));var Mustache=require(_0x6db1('0x6'));var util=require('util');var path=require(_0x6db1('0x7'));var sox=require(_0x6db1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6db1('0x9'));var squel=require(_0x6db1('0xa'));var crypto=require(_0x6db1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6db1('0xc'));var toCsv=require(_0x6db1('0xd'));var querystring=require(_0x6db1('0xe'));var Papa=require('papaparse');var Redis=require(_0x6db1('0xf'));var authService=require(_0x6db1('0x10'));var qs=require(_0x6db1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6db1('0x12'));var config=require(_0x6db1('0x13'));var db=require(_0x6db1('0x14'))['db'];var integrations=require(_0x6db1('0x15'));var jayson=require(_0x6db1('0x16'));var client=jayson[_0x6db1('0x17')][_0x6db1('0x18')]({'port':0x232a});function checkPasswordPattern(_0x3019a0,_0xc5bc2d,_0x102f66){if(_0x102f66){var _0x3c396f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c396f[_0x6db1('0x19')](_0xc5bc2d)){return _0x3019a0;}else{throw new db[(_0x6db1('0x1a'))][(_0x6db1('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 _0x3019a0;}}function respondWithRpcPromise(_0x1880fb,_0x3b1b41,_0x4c6c16,_0xb43928){return new BPromise(function(_0x387388,_0x873594){var _0x56ff6e=_0xb43928||client;return _0x56ff6e[_0x6db1('0x1c')](_0x1880fb,_0x4c6c16)[_0x6db1('0x1d')](function(_0x2aa56c){logger[_0x6db1('0x1e')](_0x6db1('0x1f'),_0x3b1b41,_0x6db1('0x20'));logger['debug'](_0x6db1('0x21'),_0x3b1b41,_0x6db1('0x20'),JSON[_0x6db1('0x22')](_0x2aa56c));if(_0x2aa56c[_0x6db1('0x23')]){if(_0x2aa56c[_0x6db1('0x23')][_0x6db1('0x24')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x3b1b41,_0x2aa56c[_0x6db1('0x23')][_0x6db1('0x25')]);return _0x873594(_0x2aa56c[_0x6db1('0x23')]['message']);}logger[_0x6db1('0x23')]('DeskAccount,\x20%s,\x20%s',_0x3b1b41,_0x2aa56c[_0x6db1('0x23')][_0x6db1('0x25')]);return _0x387388(_0x2aa56c[_0x6db1('0x23')]['message']);}else{logger[_0x6db1('0x1e')](_0x6db1('0x1f'),_0x3b1b41,'request\x20sent');_0x387388(_0x2aa56c[_0x6db1('0x26')][_0x6db1('0x25')]);}})[_0x6db1('0x27')](function(_0xdcfe08){logger[_0x6db1('0x23')](_0x6db1('0x1f'),_0x3b1b41,_0xdcfe08);_0x873594(_0xdcfe08);});});}function respondWithStatusCode(_0x213818,_0x2667eb){_0x2667eb=_0x2667eb||0xcc;return function(_0x2053d2){if(_0x2053d2){return _0x213818[_0x6db1('0x28')](_0x2667eb);}return _0x213818[_0x6db1('0x29')](_0x2667eb)[_0x6db1('0x2a')]();};}function respondWithResult(_0x22e583,_0x24fd52){_0x24fd52=_0x24fd52||0xc8;return function(_0x414292){if(_0x414292){return _0x22e583[_0x6db1('0x29')](_0x24fd52)[_0x6db1('0x2b')](_0x414292);}};}function respondWithFilteredResult(_0x29f2f6,_0x253a13){return function(_0x18c94a){if(_0x18c94a){var _0x565b51=_0x18c94a[_0x6db1('0x2c')],_0x103b2b=_0x253a13['offset'],_0x35e24d=_0x253a13['offset']+_0x253a13['limit'],_0x380009;if(_0x35e24d>=_0x565b51){_0x35e24d=_0x565b51;_0x380009=0xc8;}else{_0x380009=0xce;}_0x29f2f6[_0x6db1('0x29')](_0x380009);return _0x29f2f6[_0x6db1('0x2d')]('Content-Range',_0x103b2b+'-'+_0x35e24d+'/'+_0x565b51)['json'](_0x18c94a);}return null;};}function patchUpdates(_0x5bf790){return function(_0x1da629){try{jsonpatch['apply'](_0x1da629,_0x5bf790,!![]);}catch(_0x1c9fcd){return BPromise[_0x6db1('0x2e')](_0x1c9fcd);}return _0x1da629[_0x6db1('0x2f')]();};}function saveUpdates(_0x437d89,_0x21dc22){return function(_0x49cb9a){if(_0x49cb9a){return _0x49cb9a[_0x6db1('0x30')](_0x437d89)['then'](function(_0x33f117){return _0x33f117;});}return null;};}function removeEntity(_0x42f90c,_0x2f767f){return function(_0x3c716d){if(_0x3c716d){return _0x3c716d[_0x6db1('0x31')]()[_0x6db1('0x1d')](function(){_0x42f90c[_0x6db1('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b3d50,_0x2ff9d3){return function(_0x3f5211){if(!_0x3f5211){_0x3b3d50[_0x6db1('0x28')](0x194);}return _0x3f5211;};}function handleError(_0x2c938d,_0x3db869){_0x3db869=_0x3db869||0x1f4;return function(_0xba0572){logger[_0x6db1('0x23')](_0xba0572[_0x6db1('0x32')]);if(_0xba0572['name']){delete _0xba0572[_0x6db1('0x33')];}_0x2c938d[_0x6db1('0x29')](_0x3db869)[_0x6db1('0x34')](_0xba0572);};}exports['index']=function(_0x123dd9,_0x3455fe){var _0x5351b0={},_0x15471a={},_0x5a38c1={'count':0x0,'rows':[]};var _0x371913=_[_0x6db1('0x35')](db[_0x6db1('0x36')][_0x6db1('0x37')],function(_0x1c8d98){return{'name':_0x1c8d98['fieldName'],'type':_0x1c8d98['type'][_0x6db1('0x38')]};});_0x15471a[_0x6db1('0x39')]=_[_0x6db1('0x35')](_0x371913,_0x6db1('0x33'));_0x15471a[_0x6db1('0x3a')]=_[_0x6db1('0x3b')](_0x123dd9[_0x6db1('0x3a')]);_0x15471a[_0x6db1('0x3c')]=_[_0x6db1('0x3d')](_0x15471a['model'],_0x15471a[_0x6db1('0x3a')]);_0x5351b0['attributes']=_[_0x6db1('0x3d')](_0x15471a[_0x6db1('0x39')],qs[_0x6db1('0x3e')](_0x123dd9['query'][_0x6db1('0x3e')]));_0x5351b0[_0x6db1('0x3f')]=_0x5351b0['attributes'][_0x6db1('0x40')]?_0x5351b0[_0x6db1('0x3f')]:_0x15471a[_0x6db1('0x39')];if(!_0x123dd9[_0x6db1('0x3a')][_0x6db1('0x41')]('nolimit')){_0x5351b0[_0x6db1('0x42')]=qs[_0x6db1('0x42')](_0x123dd9[_0x6db1('0x3a')][_0x6db1('0x42')]);_0x5351b0[_0x6db1('0x43')]=qs[_0x6db1('0x43')](_0x123dd9['query']['offset']);}_0x5351b0[_0x6db1('0x44')]=qs[_0x6db1('0x45')](_0x123dd9[_0x6db1('0x3a')][_0x6db1('0x45')]);_0x5351b0['where']=qs['filters'](_['pick'](_0x123dd9[_0x6db1('0x3a')],_0x15471a[_0x6db1('0x3c')]),_0x371913);if(_0x123dd9['query'][_0x6db1('0x46')]){_0x5351b0['where']=_[_0x6db1('0x47')](_0x5351b0['where'],{'$or':_[_0x6db1('0x35')](_0x371913,function(_0x5511ea){if(_0x5511ea[_0x6db1('0x48')]!==_0x6db1('0x49')){var _0x4b1a13={};_0x4b1a13[_0x5511ea[_0x6db1('0x33')]]={'$like':'%'+_0x123dd9[_0x6db1('0x3a')][_0x6db1('0x46')]+'%'};return _0x4b1a13;}})});}_0x5351b0=_[_0x6db1('0x47')]({},_0x5351b0,_0x123dd9[_0x6db1('0x4a')]);var _0x3d85d0={'where':_0x5351b0[_0x6db1('0x4b')]};return db[_0x6db1('0x36')]['count'](_0x3d85d0)[_0x6db1('0x1d')](function(_0xa7dea5){_0x5a38c1[_0x6db1('0x2c')]=_0xa7dea5;if(_0x123dd9[_0x6db1('0x3a')][_0x6db1('0x4c')]){_0x5351b0[_0x6db1('0x4d')]=[{'all':!![]}];}return db[_0x6db1('0x36')][_0x6db1('0x4e')](_0x5351b0);})[_0x6db1('0x1d')](function(_0x1c30d3){_0x5a38c1[_0x6db1('0x4f')]=_0x1c30d3;return _0x5a38c1;})['then'](respondWithFilteredResult(_0x3455fe,_0x5351b0))[_0x6db1('0x27')](handleError(_0x3455fe,null));};exports[_0x6db1('0x50')]=function(_0x35e7d8,_0x529708){var _0x7aa1e={'raw':![],'where':{'id':_0x35e7d8[_0x6db1('0x51')]['id']}},_0x16a923={};_0x16a923[_0x6db1('0x39')]=_[_0x6db1('0x3b')](db[_0x6db1('0x36')]['rawAttributes']);_0x16a923['query']=_['keys'](_0x35e7d8[_0x6db1('0x3a')]);_0x16a923[_0x6db1('0x3c')]=_[_0x6db1('0x3d')](_0x16a923[_0x6db1('0x39')],_0x16a923[_0x6db1('0x3a')]);_0x7aa1e[_0x6db1('0x3f')]=_[_0x6db1('0x3d')](_0x16a923[_0x6db1('0x39')],qs[_0x6db1('0x3e')](_0x35e7d8[_0x6db1('0x3a')][_0x6db1('0x3e')]));_0x7aa1e[_0x6db1('0x3f')]=_0x7aa1e['attributes'][_0x6db1('0x40')]?_0x7aa1e[_0x6db1('0x3f')]:_0x16a923[_0x6db1('0x39')];if(_0x35e7d8[_0x6db1('0x3a')]['includeAll']){_0x7aa1e[_0x6db1('0x4d')]=[{'all':!![]}];}_0x7aa1e=_['merge']({},_0x7aa1e,_0x35e7d8[_0x6db1('0x4a')]);return db['DeskAccount'][_0x6db1('0x52')](_0x7aa1e)[_0x6db1('0x1d')](handleEntityNotFound(_0x529708,null))[_0x6db1('0x1d')](respondWithResult(_0x529708,null))[_0x6db1('0x27')](handleError(_0x529708,null));};exports[_0x6db1('0x53')]=function(_0x13df68,_0x38d5ae){return db[_0x6db1('0x36')]['create'](_0x13df68[_0x6db1('0x54')],{})['then'](respondWithResult(_0x38d5ae,0xc9))['catch'](handleError(_0x38d5ae,null));};exports[_0x6db1('0x30')]=function(_0x4c0ab9,_0x33517f){if(_0x4c0ab9[_0x6db1('0x54')]['id']){delete _0x4c0ab9['body']['id'];}return db[_0x6db1('0x36')][_0x6db1('0x52')]({'where':{'id':_0x4c0ab9[_0x6db1('0x51')]['id']}})['then'](handleEntityNotFound(_0x33517f,null))[_0x6db1('0x1d')](saveUpdates(_0x4c0ab9['body'],null))[_0x6db1('0x1d')](respondWithResult(_0x33517f,null))[_0x6db1('0x27')](handleError(_0x33517f,null));};exports[_0x6db1('0x31')]=function(_0x45e24d,_0x3e8c9f){return db[_0x6db1('0x36')]['find']({'where':{'id':_0x45e24d['params']['id']}})[_0x6db1('0x1d')](handleEntityNotFound(_0x3e8c9f,null))[_0x6db1('0x1d')](removeEntity(_0x3e8c9f,null))[_0x6db1('0x27')](handleError(_0x3e8c9f,null));};exports[_0x6db1('0x55')]=function(_0xd21591,_0x1ad9f7,_0x1250c9){var _0xf5f72c={};var _0x467776={};var _0xa37fd0;var _0x419873;return db['DeskAccount'][_0x6db1('0x56')]({'where':{'id':_0xd21591['params']['id']}})[_0x6db1('0x1d')](handleEntityNotFound(_0x1ad9f7,null))[_0x6db1('0x1d')](function(_0x5c83b1){if(_0x5c83b1){_0xa37fd0=_0x5c83b1;_0x467776['model']=_['keys'](db[_0x6db1('0x57')][_0x6db1('0x37')]);_0x467776['query']=_[_0x6db1('0x3b')](_0xd21591['query']);_0x467776['filters']=_[_0x6db1('0x3d')](_0x467776['model'],_0x467776[_0x6db1('0x3a')]);_0xf5f72c[_0x6db1('0x3f')]=_[_0x6db1('0x3d')](_0x467776[_0x6db1('0x39')],qs['fields'](_0xd21591[_0x6db1('0x3a')][_0x6db1('0x3e')]));_0xf5f72c['attributes']=_0xf5f72c['attributes']['length']?_0xf5f72c[_0x6db1('0x3f')]:_0x467776[_0x6db1('0x39')];_0xf5f72c[_0x6db1('0x44')]=qs[_0x6db1('0x45')](_0xd21591[_0x6db1('0x3a')][_0x6db1('0x45')]);_0xf5f72c[_0x6db1('0x4b')]=qs[_0x6db1('0x3c')](_[_0x6db1('0x58')](_0xd21591[_0x6db1('0x3a')],_0x467776[_0x6db1('0x3c')]));if(_0xd21591['query']['filter']){_0xf5f72c[_0x6db1('0x4b')]=_[_0x6db1('0x47')](_0xf5f72c[_0x6db1('0x4b')],{'$or':_[_0x6db1('0x35')](_0xf5f72c[_0x6db1('0x3f')],function(_0x3a66e4){var _0x2a2660={};_0x2a2660[_0x3a66e4]={'$like':'%'+_0xd21591[_0x6db1('0x3a')][_0x6db1('0x46')]+'%'};return _0x2a2660;})});}_0xf5f72c=_[_0x6db1('0x47')]({},_0xf5f72c,_0xd21591[_0x6db1('0x4a')]);return _0xa37fd0[_0x6db1('0x55')](_0xf5f72c);}})[_0x6db1('0x1d')](function(_0x1cbd82){if(_0x1cbd82){_0x419873=_0x1cbd82[_0x6db1('0x40')];if(!_0xd21591['query'][_0x6db1('0x41')](_0x6db1('0x59'))){_0xf5f72c[_0x6db1('0x42')]=qs[_0x6db1('0x42')](_0xd21591['query']['limit']);_0xf5f72c['offset']=qs[_0x6db1('0x43')](_0xd21591[_0x6db1('0x3a')]['offset']);}return _0xa37fd0[_0x6db1('0x55')](_0xf5f72c);}})[_0x6db1('0x1d')](function(_0x167f4e){if(_0x167f4e){return _0x167f4e?{'count':_0x419873,'rows':_0x167f4e}:null;}})['then'](respondWithResult(_0x1ad9f7,null))['catch'](handleError(_0x1ad9f7,null));};exports[_0x6db1('0x5a')]=function(_0x39f6e5,_0x372a23,_0x5decd5){if(_0x39f6e5['body']['id']){delete _0x39f6e5[_0x6db1('0x54')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x39f6e5[_0x6db1('0x51')]['id']}})[_0x6db1('0x1d')](handleEntityNotFound(_0x372a23,null))[_0x6db1('0x1d')](function(_0xd741a4){if(_0xd741a4){_0x39f6e5['body'][_0x6db1('0x5b')]=_0xd741a4['id'];_0x39f6e5[_0x6db1('0x54')][_0x6db1('0x5c')]=integrations[_0x6db1('0x5d')](_0x39f6e5[_0x6db1('0x54')][_0x6db1('0x5e')],_0x39f6e5[_0x6db1('0x54')][_0x6db1('0x48')]);_0x39f6e5[_0x6db1('0x54')]['Descriptions']=integrations[_0x6db1('0x5f')](_0x39f6e5[_0x6db1('0x54')][_0x6db1('0x5e')],_0x39f6e5[_0x6db1('0x54')]['type']);return db[_0x6db1('0x57')][_0x6db1('0x53')](_0x39f6e5[_0x6db1('0x54')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db['DeskField'],'as':_0x6db1('0x60')}]});}return null;})[_0x6db1('0x1d')](respondWithResult(_0x372a23,null))['catch'](handleError(_0x372a23,null));};exports[_0x6db1('0x61')]=function(_0x327bec,_0x35020b,_0x290c5e){var _0x2d3fca=[{'name':_0x6db1('0x62'),'label':_0x6db1('0x62'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x406d2c='';return db[_0x6db1('0x36')][_0x6db1('0x56')]({'where':{'id':_0x327bec[_0x6db1('0x51')]['id']},'attributes':['id',_0x6db1('0x63'),_0x6db1('0x64'),_0x6db1('0x65'),_0x6db1('0x66'),_0x6db1('0x67'),'consumerSecret',_0x6db1('0x68'),_0x6db1('0x69')]})[_0x6db1('0x1d')](handleEntityNotFound(_0x35020b,null))[_0x6db1('0x1d')](function(_0x50b660){if(_0x50b660){_0x406d2c=_0x50b660[_0x6db1('0x63')];var _0x4d24f1=_0x406d2c[_0x6db1('0x6a')](-0x1);if(_0x4d24f1==='/'){_0x406d2c=_0x406d2c[_0x6db1('0x6b')](0x0,_0x406d2c[_0x6db1('0x6c')](_0x4d24f1));}var _0xa1372d={'method':_0x6db1('0x6d'),'uri':util[_0x6db1('0x6e')]('%s/custom_fields',_0x406d2c),'headers':{'Content-Type':_0x6db1('0x6f'),'Accept':_0x6db1('0x6f')},'json':!![]};if(_0x50b660['authType']===_0x6db1('0x70')){_0xa1372d[_0x6db1('0x71')]['Authorization']=util['format'](_0x6db1('0x72'),new Buffer(util[_0x6db1('0x6e')](_0x6db1('0x73'),_0x50b660[_0x6db1('0x65')],_0x50b660['password']))[_0x6db1('0x74')](_0x6db1('0x75')));}return rp(_0xa1372d)[_0x6db1('0x1d')](function(_0x2de178){return _0x2d3fca[_0x6db1('0x76')](_[_0x6db1('0x35')](_0x2de178[_0x6db1('0x77')][_0x6db1('0x78')],function(_0x56ecee){return{'id':_0x56ecee[_0x6db1('0x33')],'name':_0x56ecee[_0x6db1('0x33')],'type':_0x56ecee[_0x6db1('0x48')],'active':_0x56ecee[_0x6db1('0x79')],'label':_0x56ecee[_0x6db1('0x7a')],'custom':!![]};}));});}})[_0x6db1('0x1d')](function(_0x96da44){return{'count':_0x96da44['length'],'rows':_0x96da44};})[_0x6db1('0x1d')](respondWithResult(_0x35020b,null))[_0x6db1('0x27')](function(_0x55c5a9){var _0x3f43cc=_0x327bec[_0x6db1('0x3a')][_0x6db1('0x19')]?0x1f4:_0x55c5a9[_0x6db1('0x7b')]||0x1f4;logger['error'](_0x6db1('0x7c'),_0x6db1('0x61'),_0x3f43cc,JSON[_0x6db1('0x22')](_0x55c5a9));delete _0x55c5a9[_0x6db1('0x33')];if(_0x3f43cc===0x191){_0x3f43cc=0x190;}_0x35020b[_0x6db1('0x29')](_0x3f43cc)[_0x6db1('0x34')](_0x327bec[_0x6db1('0x3a')]['test']?{'message':_0x6db1('0x7d'),'statusCode':_0x55c5a9[_0x6db1('0x7b')]}:_0x55c5a9);});}; \ No newline at end of file +var _0x6bc4=['apply','save','update','then','destroy','end','stack','send','map','DeskAccount','rawAttributes','fieldName','type','key','name','query','filters','intersection','attributes','model','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','keys','fields','includeAll','find','create','body','params','getConfigurations','DeskConfiguration','nolimit','Subjects','getSubjects','channel','getDescriptions','DeskField','priority','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','toString','base64','concat','label','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json'];(function(_0x4bb19c,_0x154418){var _0x4bc00d=function(_0x12b906){while(--_0x12b906){_0x4bb19c['push'](_0x4bb19c['shift']());}};_0x4bc00d(++_0x154418);}(_0x6bc4,0xc6));var _0x46bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6bc4[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x46bc('0x0'));var emlformat=require(_0x46bc('0x1'));var rimraf=require(_0x46bc('0x2'));var zipdir=require(_0x46bc('0x3'));var jsonpatch=require(_0x46bc('0x4'));var rp=require(_0x46bc('0x5'));var moment=require(_0x46bc('0x6'));var BPromise=require(_0x46bc('0x7'));var Mustache=require('mustache');var util=require(_0x46bc('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x46bc('0x9'));var ejs=require(_0x46bc('0xa'));var fs=require('fs');var _=require(_0x46bc('0xb'));var squel=require(_0x46bc('0xc'));var crypto=require(_0x46bc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x46bc('0xe'));var toCsv=require(_0x46bc('0x9'));var querystring=require(_0x46bc('0xf'));var Papa=require(_0x46bc('0x10'));var Redis=require(_0x46bc('0x11'));var authService=require(_0x46bc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x46bc('0x13'));var hardwareService=require(_0x46bc('0x14'));var logger=require(_0x46bc('0x15'))(_0x46bc('0x16'));var utils=require(_0x46bc('0x17'));var config=require('../../config/environment');var db=require(_0x46bc('0x18'))['db'];var integrations=require(_0x46bc('0x19'));var jayson=require(_0x46bc('0x1a'));var client=jayson[_0x46bc('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x4fa982,_0x2e87f8,_0x6d6bae){if(_0x6d6bae){var _0x6f96a5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6f96a5[_0x46bc('0x1c')](_0x2e87f8)){return _0x4fa982;}else{throw new db['Sequelize']['ValidationError'](_0x46bc('0x1d'));}}else{return _0x4fa982;}}function respondWithRpcPromise(_0x368292,_0x51fc85,_0x376343,_0x40650a){return new BPromise(function(_0x5a4bff,_0x338d72){var _0x2594c4=_0x40650a||client;return _0x2594c4[_0x46bc('0x1e')](_0x368292,_0x376343)['then'](function(_0x35780c){logger[_0x46bc('0x1f')](_0x46bc('0x20'),_0x51fc85,'request\x20sent');logger['debug'](_0x46bc('0x21'),_0x51fc85,_0x46bc('0x22'),JSON['stringify'](_0x35780c));if(_0x35780c[_0x46bc('0x23')]){if(_0x35780c['error'][_0x46bc('0x24')]===0x1f4){logger[_0x46bc('0x23')](_0x46bc('0x20'),_0x51fc85,_0x35780c[_0x46bc('0x23')][_0x46bc('0x25')]);return _0x338d72(_0x35780c[_0x46bc('0x23')]['message']);}logger[_0x46bc('0x23')](_0x46bc('0x20'),_0x51fc85,_0x35780c['error'][_0x46bc('0x25')]);return _0x5a4bff(_0x35780c[_0x46bc('0x23')][_0x46bc('0x25')]);}else{logger['info'](_0x46bc('0x20'),_0x51fc85,_0x46bc('0x22'));_0x5a4bff(_0x35780c[_0x46bc('0x26')][_0x46bc('0x25')]);}})[_0x46bc('0x27')](function(_0x290ec4){logger[_0x46bc('0x23')](_0x46bc('0x20'),_0x51fc85,_0x290ec4);_0x338d72(_0x290ec4);});});}function respondWithStatusCode(_0x3db2a,_0x12ef35){_0x12ef35=_0x12ef35||0xcc;return function(_0x2911b6){if(_0x2911b6){return _0x3db2a[_0x46bc('0x28')](_0x12ef35);}return _0x3db2a[_0x46bc('0x29')](_0x12ef35)['end']();};}function respondWithResult(_0x26604c,_0x3d7d87){_0x3d7d87=_0x3d7d87||0xc8;return function(_0x267e9e){if(_0x267e9e){return _0x26604c[_0x46bc('0x29')](_0x3d7d87)['json'](_0x267e9e);}};}function respondWithFilteredResult(_0x9f6bf,_0x411809){return function(_0x52768a){if(_0x52768a){var _0x479cbe=_0x52768a[_0x46bc('0x2a')],_0xcd5c83=_0x411809[_0x46bc('0x2b')],_0xb8cf1d=_0x411809[_0x46bc('0x2b')]+_0x411809[_0x46bc('0x2c')],_0x24ac79;if(_0xb8cf1d>=_0x479cbe){_0xb8cf1d=_0x479cbe;_0x24ac79=0xc8;}else{_0x24ac79=0xce;}_0x9f6bf[_0x46bc('0x29')](_0x24ac79);return _0x9f6bf[_0x46bc('0x2d')](_0x46bc('0x2e'),_0xcd5c83+'-'+_0xb8cf1d+'/'+_0x479cbe)[_0x46bc('0x2f')](_0x52768a);}return null;};}function patchUpdates(_0x12a943){return function(_0x22f0b0){try{jsonpatch[_0x46bc('0x30')](_0x22f0b0,_0x12a943,!![]);}catch(_0x3bb604){return BPromise['reject'](_0x3bb604);}return _0x22f0b0[_0x46bc('0x31')]();};}function saveUpdates(_0x1cdcaf,_0x1d32d4){return function(_0x5dbbc2){if(_0x5dbbc2){return _0x5dbbc2[_0x46bc('0x32')](_0x1cdcaf)[_0x46bc('0x33')](function(_0x187ba7){return _0x187ba7;});}return null;};}function removeEntity(_0x5d1037,_0x236cae){return function(_0xed404a){if(_0xed404a){return _0xed404a[_0x46bc('0x34')]()[_0x46bc('0x33')](function(){_0x5d1037[_0x46bc('0x29')](0xcc)[_0x46bc('0x35')]();});}};}function handleEntityNotFound(_0x10837b,_0x140e8d){return function(_0x26640f){if(!_0x26640f){_0x10837b[_0x46bc('0x28')](0x194);}return _0x26640f;};}function handleError(_0x4339b7,_0x30f481){_0x30f481=_0x30f481||0x1f4;return function(_0x59b313){logger['error'](_0x59b313[_0x46bc('0x36')]);if(_0x59b313['name']){delete _0x59b313['name'];}_0x4339b7['status'](_0x30f481)[_0x46bc('0x37')](_0x59b313);};}exports['index']=function(_0x59926f,_0x5c5cc1){var _0x3a6b88={},_0x177ed1={},_0x3e8412={'count':0x0,'rows':[]};var _0x27a0ba=_[_0x46bc('0x38')](db[_0x46bc('0x39')][_0x46bc('0x3a')],function(_0x2d5bd2){return{'name':_0x2d5bd2[_0x46bc('0x3b')],'type':_0x2d5bd2[_0x46bc('0x3c')][_0x46bc('0x3d')]};});_0x177ed1['model']=_[_0x46bc('0x38')](_0x27a0ba,_0x46bc('0x3e'));_0x177ed1[_0x46bc('0x3f')]=_['keys'](_0x59926f[_0x46bc('0x3f')]);_0x177ed1[_0x46bc('0x40')]=_[_0x46bc('0x41')](_0x177ed1['model'],_0x177ed1[_0x46bc('0x3f')]);_0x3a6b88[_0x46bc('0x42')]=_[_0x46bc('0x41')](_0x177ed1[_0x46bc('0x43')],qs['fields'](_0x59926f[_0x46bc('0x3f')]['fields']));_0x3a6b88[_0x46bc('0x42')]=_0x3a6b88[_0x46bc('0x42')][_0x46bc('0x44')]?_0x3a6b88[_0x46bc('0x42')]:_0x177ed1[_0x46bc('0x43')];if(!_0x59926f[_0x46bc('0x3f')][_0x46bc('0x45')]('nolimit')){_0x3a6b88['limit']=qs[_0x46bc('0x2c')](_0x59926f['query'][_0x46bc('0x2c')]);_0x3a6b88['offset']=qs[_0x46bc('0x2b')](_0x59926f['query'][_0x46bc('0x2b')]);}_0x3a6b88[_0x46bc('0x46')]=qs[_0x46bc('0x47')](_0x59926f[_0x46bc('0x3f')][_0x46bc('0x47')]);_0x3a6b88[_0x46bc('0x48')]=qs['filters'](_[_0x46bc('0x49')](_0x59926f['query'],_0x177ed1[_0x46bc('0x40')]),_0x27a0ba);if(_0x59926f[_0x46bc('0x3f')][_0x46bc('0x4a')]){_0x3a6b88[_0x46bc('0x48')]=_[_0x46bc('0x4b')](_0x3a6b88[_0x46bc('0x48')],{'$or':_[_0x46bc('0x38')](_0x27a0ba,function(_0x38c30e){if(_0x38c30e[_0x46bc('0x3c')]!==_0x46bc('0x4c')){var _0xa6490={};_0xa6490[_0x38c30e[_0x46bc('0x3e')]]={'$like':'%'+_0x59926f['query'][_0x46bc('0x4a')]+'%'};return _0xa6490;}})});}_0x3a6b88=_[_0x46bc('0x4b')]({},_0x3a6b88,_0x59926f[_0x46bc('0x4d')]);var _0xb7265={'where':_0x3a6b88[_0x46bc('0x48')]};return db[_0x46bc('0x39')][_0x46bc('0x2a')](_0xb7265)[_0x46bc('0x33')](function(_0x1b5bd9){_0x3e8412[_0x46bc('0x2a')]=_0x1b5bd9;if(_0x59926f['query']['includeAll']){_0x3a6b88['include']=[{'all':!![]}];}return db['DeskAccount'][_0x46bc('0x4e')](_0x3a6b88);})[_0x46bc('0x33')](function(_0x21c9e7){_0x3e8412[_0x46bc('0x4f')]=_0x21c9e7;return _0x3e8412;})[_0x46bc('0x33')](respondWithFilteredResult(_0x5c5cc1,_0x3a6b88))[_0x46bc('0x27')](handleError(_0x5c5cc1,null));};exports[_0x46bc('0x50')]=function(_0x135a5d,_0x4fa88f){var _0x4e76d0={'raw':![],'where':{'id':_0x135a5d['params']['id']}},_0x56f3b7={};_0x56f3b7[_0x46bc('0x43')]=_[_0x46bc('0x51')](db[_0x46bc('0x39')][_0x46bc('0x3a')]);_0x56f3b7[_0x46bc('0x3f')]=_['keys'](_0x135a5d['query']);_0x56f3b7[_0x46bc('0x40')]=_[_0x46bc('0x41')](_0x56f3b7[_0x46bc('0x43')],_0x56f3b7['query']);_0x4e76d0[_0x46bc('0x42')]=_['intersection'](_0x56f3b7[_0x46bc('0x43')],qs['fields'](_0x135a5d[_0x46bc('0x3f')][_0x46bc('0x52')]));_0x4e76d0[_0x46bc('0x42')]=_0x4e76d0[_0x46bc('0x42')][_0x46bc('0x44')]?_0x4e76d0[_0x46bc('0x42')]:_0x56f3b7[_0x46bc('0x43')];if(_0x135a5d[_0x46bc('0x3f')][_0x46bc('0x53')]){_0x4e76d0['include']=[{'all':!![]}];}_0x4e76d0=_[_0x46bc('0x4b')]({},_0x4e76d0,_0x135a5d[_0x46bc('0x4d')]);return db[_0x46bc('0x39')][_0x46bc('0x54')](_0x4e76d0)[_0x46bc('0x33')](handleEntityNotFound(_0x4fa88f,null))[_0x46bc('0x33')](respondWithResult(_0x4fa88f,null))[_0x46bc('0x27')](handleError(_0x4fa88f,null));};exports[_0x46bc('0x55')]=function(_0x4852e5,_0x517b39){return db[_0x46bc('0x39')][_0x46bc('0x55')](_0x4852e5[_0x46bc('0x56')],{})['then'](respondWithResult(_0x517b39,0xc9))[_0x46bc('0x27')](handleError(_0x517b39,null));};exports[_0x46bc('0x32')]=function(_0x2e0762,_0x411b36){if(_0x2e0762[_0x46bc('0x56')]['id']){delete _0x2e0762['body']['id'];}return db['DeskAccount']['find']({'where':{'id':_0x2e0762[_0x46bc('0x57')]['id']}})['then'](handleEntityNotFound(_0x411b36,null))['then'](saveUpdates(_0x2e0762[_0x46bc('0x56')],null))[_0x46bc('0x33')](respondWithResult(_0x411b36,null))[_0x46bc('0x27')](handleError(_0x411b36,null));};exports[_0x46bc('0x34')]=function(_0x2b97ca,_0x506dc5){return db[_0x46bc('0x39')][_0x46bc('0x54')]({'where':{'id':_0x2b97ca['params']['id']}})[_0x46bc('0x33')](handleEntityNotFound(_0x506dc5,null))[_0x46bc('0x33')](removeEntity(_0x506dc5,null))[_0x46bc('0x27')](handleError(_0x506dc5,null));};exports[_0x46bc('0x58')]=function(_0x21a9a7,_0x55dc3d,_0x11896b){var _0x1b9ae0={};var _0x1c7a06={};var _0x4b594e;var _0x46ec40;return db[_0x46bc('0x39')]['findOne']({'where':{'id':_0x21a9a7[_0x46bc('0x57')]['id']}})[_0x46bc('0x33')](handleEntityNotFound(_0x55dc3d,null))[_0x46bc('0x33')](function(_0x47187d){if(_0x47187d){_0x4b594e=_0x47187d;_0x1c7a06[_0x46bc('0x43')]=_[_0x46bc('0x51')](db[_0x46bc('0x59')]['rawAttributes']);_0x1c7a06[_0x46bc('0x3f')]=_['keys'](_0x21a9a7[_0x46bc('0x3f')]);_0x1c7a06[_0x46bc('0x40')]=_['intersection'](_0x1c7a06['model'],_0x1c7a06[_0x46bc('0x3f')]);_0x1b9ae0['attributes']=_[_0x46bc('0x41')](_0x1c7a06[_0x46bc('0x43')],qs[_0x46bc('0x52')](_0x21a9a7[_0x46bc('0x3f')][_0x46bc('0x52')]));_0x1b9ae0['attributes']=_0x1b9ae0[_0x46bc('0x42')][_0x46bc('0x44')]?_0x1b9ae0['attributes']:_0x1c7a06[_0x46bc('0x43')];_0x1b9ae0['order']=qs[_0x46bc('0x47')](_0x21a9a7[_0x46bc('0x3f')][_0x46bc('0x47')]);_0x1b9ae0[_0x46bc('0x48')]=qs[_0x46bc('0x40')](_[_0x46bc('0x49')](_0x21a9a7[_0x46bc('0x3f')],_0x1c7a06['filters']));if(_0x21a9a7[_0x46bc('0x3f')][_0x46bc('0x4a')]){_0x1b9ae0[_0x46bc('0x48')]=_[_0x46bc('0x4b')](_0x1b9ae0[_0x46bc('0x48')],{'$or':_[_0x46bc('0x38')](_0x1b9ae0[_0x46bc('0x42')],function(_0x4edfc9){var _0x178cd7={};_0x178cd7[_0x4edfc9]={'$like':'%'+_0x21a9a7['query'][_0x46bc('0x4a')]+'%'};return _0x178cd7;})});}_0x1b9ae0=_[_0x46bc('0x4b')]({},_0x1b9ae0,_0x21a9a7[_0x46bc('0x4d')]);return _0x4b594e[_0x46bc('0x58')](_0x1b9ae0);}})[_0x46bc('0x33')](function(_0x3c0520){if(_0x3c0520){_0x46ec40=_0x3c0520[_0x46bc('0x44')];if(!_0x21a9a7['query'][_0x46bc('0x45')](_0x46bc('0x5a'))){_0x1b9ae0[_0x46bc('0x2c')]=qs['limit'](_0x21a9a7['query'][_0x46bc('0x2c')]);_0x1b9ae0[_0x46bc('0x2b')]=qs[_0x46bc('0x2b')](_0x21a9a7['query'][_0x46bc('0x2b')]);}return _0x4b594e[_0x46bc('0x58')](_0x1b9ae0);}})[_0x46bc('0x33')](function(_0x4d7a38){if(_0x4d7a38){return _0x4d7a38?{'count':_0x46ec40,'rows':_0x4d7a38}:null;}})[_0x46bc('0x33')](respondWithResult(_0x55dc3d,null))['catch'](handleError(_0x55dc3d,null));};exports['addConfiguration']=function(_0x404498,_0x2021e6,_0x2ec578){if(_0x404498[_0x46bc('0x56')]['id']){delete _0x404498[_0x46bc('0x56')]['id'];}return db[_0x46bc('0x39')]['findOne']({'where':{'id':_0x404498['params']['id']}})[_0x46bc('0x33')](handleEntityNotFound(_0x2021e6,null))[_0x46bc('0x33')](function(_0x2966e3){if(_0x2966e3){_0x404498[_0x46bc('0x56')]['AccountId']=_0x2966e3['id'];_0x404498['body'][_0x46bc('0x5b')]=integrations[_0x46bc('0x5c')](_0x404498[_0x46bc('0x56')][_0x46bc('0x5d')],_0x404498[_0x46bc('0x56')][_0x46bc('0x3c')]);_0x404498[_0x46bc('0x56')]['Descriptions']=integrations[_0x46bc('0x5e')](_0x404498[_0x46bc('0x56')][_0x46bc('0x5d')],_0x404498['body'][_0x46bc('0x3c')]);return db[_0x46bc('0x59')][_0x46bc('0x55')](_0x404498[_0x46bc('0x56')],{'include':[{'model':db[_0x46bc('0x5f')],'as':_0x46bc('0x5b')},{'model':db[_0x46bc('0x5f')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2021e6,null))[_0x46bc('0x27')](handleError(_0x2021e6,null));};exports['getFields']=function(_0x1b318b,_0x5ea97f,_0x2b5c84){var _0x33cffd=[{'name':'priority','label':_0x46bc('0x60'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x39e661='';return db[_0x46bc('0x39')]['findOne']({'where':{'id':_0x1b318b[_0x46bc('0x57')]['id']},'attributes':['id','remoteUri',_0x46bc('0x61'),_0x46bc('0x62'),_0x46bc('0x63'),_0x46bc('0x64'),_0x46bc('0x65'),_0x46bc('0x66'),_0x46bc('0x67')]})[_0x46bc('0x33')](handleEntityNotFound(_0x5ea97f,null))[_0x46bc('0x33')](function(_0x4eb227){if(_0x4eb227){_0x39e661=_0x4eb227[_0x46bc('0x68')];var _0x4dd3d6=_0x39e661[_0x46bc('0x69')](-0x1);if(_0x4dd3d6==='/'){_0x39e661=_0x39e661[_0x46bc('0x6a')](0x0,_0x39e661['lastIndexOf'](_0x4dd3d6));}var _0x27ab48={'method':_0x46bc('0x6b'),'uri':util[_0x46bc('0x6c')](_0x46bc('0x6d'),_0x39e661),'headers':{'Content-Type':'application/json','Accept':_0x46bc('0x6e')},'json':!![]};if(_0x4eb227[_0x46bc('0x61')]===_0x46bc('0x6f')){_0x27ab48['headers'][_0x46bc('0x70')]=util[_0x46bc('0x6c')](_0x46bc('0x71'),new Buffer(util[_0x46bc('0x6c')]('%s:%s',_0x4eb227[_0x46bc('0x62')],_0x4eb227[_0x46bc('0x63')]))[_0x46bc('0x72')](_0x46bc('0x73')));}return rp(_0x27ab48)[_0x46bc('0x33')](function(_0x57a0c1){return _0x33cffd[_0x46bc('0x74')](_[_0x46bc('0x38')](_0x57a0c1['_embedded']['entries'],function(_0x5281fa){return{'id':_0x5281fa['name'],'name':_0x5281fa[_0x46bc('0x3e')],'type':_0x5281fa[_0x46bc('0x3c')],'active':_0x5281fa['active'],'label':_0x5281fa[_0x46bc('0x75')],'custom':!![]};}));});}})[_0x46bc('0x33')](function(_0x5d9d9e){return{'count':_0x5d9d9e[_0x46bc('0x44')],'rows':_0x5d9d9e};})[_0x46bc('0x33')](respondWithResult(_0x5ea97f,null))['catch'](function(_0x5a0580){var _0xcc475e=_0x1b318b['query'][_0x46bc('0x1c')]?0x1f4:_0x5a0580['statusCode']||0x1f4;logger[_0x46bc('0x23')](_0x46bc('0x76'),_0x46bc('0x77'),_0xcc475e,JSON[_0x46bc('0x78')](_0x5a0580));delete _0x5a0580[_0x46bc('0x3e')];if(_0xcc475e===0x191){_0xcc475e=0x190;}_0x5ea97f[_0x46bc('0x29')](_0xcc475e)[_0x46bc('0x37')](_0x1b318b['query'][_0x46bc('0x1c')]?{'message':_0x46bc('0x79'),'statusCode':_0x5a0580[_0x46bc('0x7a')]}:_0x5a0580);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index b6165ba..5394678 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 _0xbf2b=['path','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','lodash','util','../../config/logger','api','moment'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0xbf2b,0x103));var _0xbbf2=function(_0xa65d4a,_0x188ffe){_0xa65d4a=_0xa65d4a-0x0;var _0x5f5993=_0xbf2b[_0xa65d4a];return _0x5f5993;};'use strict';var _=require(_0xbbf2('0x0'));var util=require(_0xbbf2('0x1'));var logger=require(_0xbbf2('0x2'))(_0xbbf2('0x3'));var moment=require(_0xbbf2('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbbf2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbbf2('0x6'));var integrations=require(_0xbbf2('0x7'));module[_0xbbf2('0x8')]=function(_0x2960cc,_0x35a355){return _0x2960cc[_0xbbf2('0x9')](_0xbbf2('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4832=['util','../../config/logger','api','moment','request-promise','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash'];(function(_0x496013,_0x34865a){var _0x419838=function(_0x177a7b){while(--_0x177a7b){_0x496013['push'](_0x496013['shift']());}};_0x419838(++_0x34865a);}(_0x4832,0x12b));var _0x2483=function(_0x24cc72,_0x4dc73a){_0x24cc72=_0x24cc72-0x0;var _0xd49f1e=_0x4832[_0x24cc72];return _0xd49f1e;};'use strict';var _=require(_0x2483('0x0'));var util=require(_0x2483('0x1'));var logger=require(_0x2483('0x2'))(_0x2483('0x3'));var moment=require(_0x2483('0x4'));var BPromise=require('bluebird');var rp=require(_0x2483('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2483('0x6'));var attributes=require(_0x2483('0x7'));var integrations=require(_0x2483('0x8'));module[_0x2483('0x9')]=function(_0x309728,_0x174e9f){return _0x309728['define'](_0x2483('0xa'),attributes,{'tableName':_0x2483('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 74e0c33..07762aa 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 _0x14cd=['ioredis','../../config/utils','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','include','map','model','GetDeskAccount','ShowDeskAccount','lodash','moment','bluebird','randomstring'];(function(_0x4dec3b,_0x1acb3d){var _0x76fe18=function(_0x5f5b17){while(--_0x5f5b17){_0x4dec3b['push'](_0x4dec3b['shift']());}};_0x76fe18(++_0x1acb3d);}(_0x14cd,0x1eb));var _0xd14c=function(_0x2b1fe5,_0x2968e2){_0x2b1fe5=_0x2b1fe5-0x0;var _0x5eb2af=_0x14cd[_0x2b1fe5];return _0x5eb2af;};'use strict';var _=require(_0xd14c('0x0'));var util=require('util');var moment=require(_0xd14c('0x1'));var BPromise=require(_0xd14c('0x2'));var rs=require(_0xd14c('0x3'));var fs=require('fs');var Redis=require(_0xd14c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd14c('0x5'));var logger=require('../../config/logger')(_0xd14c('0x6'));var config=require(_0xd14c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd14c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28700c,_0x580195,_0x1b1c6d){return new BPromise(function(_0x326c3b,_0x5e2373){return client[_0xd14c('0x9')](_0x28700c,_0x1b1c6d)[_0xd14c('0xa')](function(_0x230fd7){logger[_0xd14c('0xb')]('DeskAccount,\x20%s,\x20%s',_0x580195,_0xd14c('0xc'));logger[_0xd14c('0xd')](_0xd14c('0xe'),_0x580195,_0xd14c('0xc'),JSON[_0xd14c('0xf')](_0x230fd7));if(_0x230fd7[_0xd14c('0x10')]){if(_0x230fd7[_0xd14c('0x10')][_0xd14c('0x11')]===0x1f4){logger[_0xd14c('0x10')]('DeskAccount,\x20%s,\x20%s',_0x580195,_0x230fd7[_0xd14c('0x10')]['message']);return _0x5e2373(_0x230fd7[_0xd14c('0x10')]['message']);}logger['error'](_0xd14c('0x12'),_0x580195,_0x230fd7['error'][_0xd14c('0x13')]);return _0x326c3b(_0x230fd7[_0xd14c('0x10')][_0xd14c('0x13')]);}else{logger[_0xd14c('0xb')](_0xd14c('0x12'),_0x580195,_0xd14c('0xc'));_0x326c3b(_0x230fd7[_0xd14c('0x14')][_0xd14c('0x13')]);}})[_0xd14c('0x15')](function(_0x2e7028){logger[_0xd14c('0x10')]('DeskAccount,\x20%s,\x20%s',_0x580195,_0x2e7028);_0x5e2373(_0x2e7028);});});}exports['GetDeskAccount']=function(_0x1e922f){var _0x3f23ed=this;return new Promise(function(_0x21c3d9,_0x4199e9){return db[_0xd14c('0x16')][_0xd14c('0x17')]({'raw':_0x1e922f['options']?_0x1e922f[_0xd14c('0x18')][_0xd14c('0x19')]===undefined?!![]:![]:!![],'where':_0x1e922f['options']?_0x1e922f[_0xd14c('0x18')][_0xd14c('0x1a')]||null:null,'attributes':_0x1e922f[_0xd14c('0x18')]?_0x1e922f['options'][_0xd14c('0x1b')]||null:null,'limit':_0x1e922f[_0xd14c('0x18')]?_0x1e922f[_0xd14c('0x18')]['limit']||null:null,'include':_0x1e922f['options']?_0x1e922f[_0xd14c('0x18')][_0xd14c('0x1c')]?_[_0xd14c('0x1d')](_0x1e922f[_0xd14c('0x18')][_0xd14c('0x1c')],function(_0x42d3a8){return{'model':db[_0x42d3a8[_0xd14c('0x1e')]],'as':_0x42d3a8['as'],'attributes':_0x42d3a8[_0xd14c('0x1b')],'include':_0x42d3a8[_0xd14c('0x1c')]?_[_0xd14c('0x1d')](_0x42d3a8[_0xd14c('0x1c')],function(_0x36d579){return{'model':db[_0x36d579[_0xd14c('0x1e')]],'as':_0x36d579['as'],'attributes':_0x36d579[_0xd14c('0x1b')],'include':_0x36d579['include']?_['map'](_0x36d579[_0xd14c('0x1c')],function(_0x5a57b8){return{'model':db[_0x5a57b8['model']],'as':_0x5a57b8['as'],'attributes':_0x5a57b8[_0xd14c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd14c('0xa')](function(_0x22e2d6){logger[_0xd14c('0xb')](_0xd14c('0x1f'),_0x1e922f);logger['debug'](_0xd14c('0x1f'),_0x1e922f,JSON[_0xd14c('0xf')](_0x22e2d6));_0x21c3d9(_0x22e2d6);})[_0xd14c('0x15')](function(_0x24e474){logger['error'](_0xd14c('0x1f'),_0x24e474[_0xd14c('0x13')],_0x1e922f);_0x4199e9(_0x3f23ed[_0xd14c('0x10')](0x1f4,_0x24e474['message']));});});};exports[_0xd14c('0x20')]=function(_0x250001){var _0x410689=this;return new Promise(function(_0x559e7c,_0xe21091){return db[_0xd14c('0x16')]['find']({'raw':_0x250001['options']?_0x250001[_0xd14c('0x18')][_0xd14c('0x19')]===undefined?!![]:![]:!![],'where':_0x250001[_0xd14c('0x18')]?_0x250001['options'][_0xd14c('0x1a')]||null:null,'attributes':_0x250001[_0xd14c('0x18')]?_0x250001[_0xd14c('0x18')][_0xd14c('0x1b')]||null:null,'include':_0x250001[_0xd14c('0x18')]?_0x250001[_0xd14c('0x18')][_0xd14c('0x1c')]?_['map'](_0x250001[_0xd14c('0x18')][_0xd14c('0x1c')],function(_0x24da69){return{'model':db[_0x24da69['model']],'as':_0x24da69['as'],'attributes':_0x24da69[_0xd14c('0x1b')],'include':_0x24da69[_0xd14c('0x1c')]?_['map'](_0x24da69[_0xd14c('0x1c')],function(_0x40ea67){return{'model':db[_0x40ea67['model']],'as':_0x40ea67['as'],'attributes':_0x40ea67[_0xd14c('0x1b')],'include':_0x40ea67[_0xd14c('0x1c')]?_['map'](_0x40ea67[_0xd14c('0x1c')],function(_0x5717d2){return{'model':db[_0x5717d2[_0xd14c('0x1e')]],'as':_0x5717d2['as'],'attributes':_0x5717d2[_0xd14c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd14c('0xa')](function(_0x542241){logger[_0xd14c('0xb')](_0xd14c('0x20'),_0x250001);logger[_0xd14c('0xd')](_0xd14c('0x20'),_0x250001,JSON['stringify'](_0x542241));_0x559e7c(_0x542241);})[_0xd14c('0x15')](function(_0xf70bd1){logger['error'](_0xd14c('0x20'),_0xf70bd1[_0xd14c('0x13')],_0x250001);_0xe21091(_0x410689[_0xd14c('0x10')](0x1f4,_0xf70bd1[_0xd14c('0x13')]));});});}; \ No newline at end of file +var _0xc771=['stringify','error','code','DeskAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','include','map','model','ShowDeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug'];(function(_0x1cd267,_0x3c432d){var _0x1f5c90=function(_0x430400){while(--_0x430400){_0x1cd267['push'](_0x1cd267['shift']());}};_0x1f5c90(++_0x3c432d);}(_0xc771,0x1ef));var _0x1c77=function(_0x4c351c,_0x358a56){_0x4c351c=_0x4c351c-0x0;var _0xc76f5d=_0xc771[_0x4c351c];return _0xc76f5d;};'use strict';var _=require(_0x1c77('0x0'));var util=require(_0x1c77('0x1'));var moment=require('moment');var BPromise=require(_0x1c77('0x2'));var rs=require(_0x1c77('0x3'));var fs=require('fs');var Redis=require(_0x1c77('0x4'));var db=require(_0x1c77('0x5'))['db'];var utils=require(_0x1c77('0x6'));var logger=require(_0x1c77('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1c77('0x8'));var client=jayson[_0x1c77('0x9')][_0x1c77('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x149922,_0xee59f7,_0x4a8b58){return new BPromise(function(_0x1aaf7e,_0x35404e){return client[_0x1c77('0xb')](_0x149922,_0x4a8b58)[_0x1c77('0xc')](function(_0x59bc82){logger[_0x1c77('0xd')]('DeskAccount,\x20%s,\x20%s',_0xee59f7,'request\x20sent');logger[_0x1c77('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0xee59f7,'request\x20sent',JSON[_0x1c77('0xf')](_0x59bc82));if(_0x59bc82[_0x1c77('0x10')]){if(_0x59bc82['error'][_0x1c77('0x11')]===0x1f4){logger['error'](_0x1c77('0x12'),_0xee59f7,_0x59bc82[_0x1c77('0x10')][_0x1c77('0x13')]);return _0x35404e(_0x59bc82[_0x1c77('0x10')][_0x1c77('0x13')]);}logger[_0x1c77('0x10')]('DeskAccount,\x20%s,\x20%s',_0xee59f7,_0x59bc82[_0x1c77('0x10')]['message']);return _0x1aaf7e(_0x59bc82[_0x1c77('0x10')][_0x1c77('0x13')]);}else{logger['info'](_0x1c77('0x12'),_0xee59f7,_0x1c77('0x14'));_0x1aaf7e(_0x59bc82[_0x1c77('0x15')]['message']);}})[_0x1c77('0x16')](function(_0xeaf11){logger['error']('DeskAccount,\x20%s,\x20%s',_0xee59f7,_0xeaf11);_0x35404e(_0xeaf11);});});}exports[_0x1c77('0x17')]=function(_0x4c5d2a){var _0x483724=this;return new Promise(function(_0x24317f,_0x4361ef){return db[_0x1c77('0x18')]['findAll']({'raw':_0x4c5d2a['options']?_0x4c5d2a[_0x1c77('0x19')][_0x1c77('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c5d2a[_0x1c77('0x19')]?_0x4c5d2a[_0x1c77('0x19')][_0x1c77('0x1b')]||null:null,'attributes':_0x4c5d2a[_0x1c77('0x19')]?_0x4c5d2a[_0x1c77('0x19')][_0x1c77('0x1c')]||null:null,'limit':_0x4c5d2a[_0x1c77('0x19')]?_0x4c5d2a[_0x1c77('0x19')]['limit']||null:null,'include':_0x4c5d2a[_0x1c77('0x19')]?_0x4c5d2a[_0x1c77('0x19')][_0x1c77('0x1d')]?_[_0x1c77('0x1e')](_0x4c5d2a[_0x1c77('0x19')][_0x1c77('0x1d')],function(_0x1430fc){return{'model':db[_0x1430fc['model']],'as':_0x1430fc['as'],'attributes':_0x1430fc[_0x1c77('0x1c')],'include':_0x1430fc[_0x1c77('0x1d')]?_[_0x1c77('0x1e')](_0x1430fc[_0x1c77('0x1d')],function(_0x4bc824){return{'model':db[_0x4bc824['model']],'as':_0x4bc824['as'],'attributes':_0x4bc824['attributes'],'include':_0x4bc824[_0x1c77('0x1d')]?_[_0x1c77('0x1e')](_0x4bc824['include'],function(_0x5337e8){return{'model':db[_0x5337e8[_0x1c77('0x1f')]],'as':_0x5337e8['as'],'attributes':_0x5337e8[_0x1c77('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1c77('0xc')](function(_0x3af54c){logger['info'](_0x1c77('0x17'),_0x4c5d2a);logger[_0x1c77('0xe')](_0x1c77('0x17'),_0x4c5d2a,JSON[_0x1c77('0xf')](_0x3af54c));_0x24317f(_0x3af54c);})[_0x1c77('0x16')](function(_0x2993d){logger['error'](_0x1c77('0x17'),_0x2993d[_0x1c77('0x13')],_0x4c5d2a);_0x4361ef(_0x483724[_0x1c77('0x10')](0x1f4,_0x2993d[_0x1c77('0x13')]));});});};exports[_0x1c77('0x20')]=function(_0x2f00bf){var _0x42e22d=this;return new Promise(function(_0x222022,_0x4e56fd){return db['DeskAccount'][_0x1c77('0x21')]({'raw':_0x2f00bf[_0x1c77('0x19')]?_0x2f00bf[_0x1c77('0x19')][_0x1c77('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f00bf[_0x1c77('0x19')]?_0x2f00bf[_0x1c77('0x19')]['where']||null:null,'attributes':_0x2f00bf[_0x1c77('0x19')]?_0x2f00bf[_0x1c77('0x19')][_0x1c77('0x1c')]||null:null,'include':_0x2f00bf[_0x1c77('0x19')]?_0x2f00bf[_0x1c77('0x19')]['include']?_[_0x1c77('0x1e')](_0x2f00bf[_0x1c77('0x19')]['include'],function(_0x262917){return{'model':db[_0x262917[_0x1c77('0x1f')]],'as':_0x262917['as'],'attributes':_0x262917[_0x1c77('0x1c')],'include':_0x262917[_0x1c77('0x1d')]?_['map'](_0x262917['include'],function(_0x2fed6e){return{'model':db[_0x2fed6e[_0x1c77('0x1f')]],'as':_0x2fed6e['as'],'attributes':_0x2fed6e[_0x1c77('0x1c')],'include':_0x2fed6e[_0x1c77('0x1d')]?_[_0x1c77('0x1e')](_0x2fed6e[_0x1c77('0x1d')],function(_0x283524){return{'model':db[_0x283524[_0x1c77('0x1f')]],'as':_0x283524['as'],'attributes':_0x283524[_0x1c77('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1c77('0xc')](function(_0x2bf319){logger[_0x1c77('0xd')]('ShowDeskAccount',_0x2f00bf);logger['debug'](_0x1c77('0x20'),_0x2f00bf,JSON[_0x1c77('0xf')](_0x2bf319));_0x222022(_0x2bf319);})['catch'](function(_0x38eb62){logger['error']('ShowDeskAccount',_0x38eb62['message'],_0x2f00bf);_0x4e56fd(_0x42e22d[_0x1c77('0x10')](0x1f4,_0x38eb62[_0x1c77('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 354929e..833ef24 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 _0xb931=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','setTags','put','update','destroy','exports','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x999f2c,_0x184b5e){var _0x5a1554=function(_0x26aa9e){while(--_0x26aa9e){_0x999f2c['push'](_0x999f2c['shift']());}};_0x5a1554(++_0x184b5e);}(_0xb931,0x155));var _0x1b93=function(_0x2fdba9,_0x465e36){_0x2fdba9=_0x2fdba9-0x0;var _0x4b4f8b=_0xb931[_0x2fdba9];return _0x4b4f8b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1b93('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b93('0x1')]();var auth=require(_0x1b93('0x2'));var interaction=require(_0x1b93('0x3'));var config=require(_0x1b93('0x4'));var controller=require(_0x1b93('0x5'));router[_0x1b93('0x6')]('/',auth[_0x1b93('0x7')](),controller[_0x1b93('0x8')]);router[_0x1b93('0x6')](_0x1b93('0x9'),auth[_0x1b93('0x7')](),controller[_0x1b93('0xa')]);router[_0x1b93('0x6')](_0x1b93('0xb'),auth[_0x1b93('0x7')](),controller['getFields']);router['get'](_0x1b93('0xc'),auth[_0x1b93('0x7')](),controller[_0x1b93('0xd')]);router['get'](_0x1b93('0xe'),auth['isAuthenticated'](),controller[_0x1b93('0xf')]);router[_0x1b93('0x6')]('/:id/tags',auth['isAuthenticated'](),controller[_0x1b93('0x10')]);router[_0x1b93('0x11')]('/',auth[_0x1b93('0x7')](),controller['create']);router[_0x1b93('0x11')]('/:id/tags',auth[_0x1b93('0x7')](),controller[_0x1b93('0x12')]);router[_0x1b93('0x13')](_0x1b93('0x9'),auth[_0x1b93('0x7')](),controller[_0x1b93('0x14')]);router['delete'](_0x1b93('0x9'),auth[_0x1b93('0x7')](),controller[_0x1b93('0x15')]);module[_0x1b93('0x16')]=router; \ No newline at end of file +var _0x4ccb=['isAuthenticated','index','get','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','/:id','update','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller'];(function(_0x5bc57b,_0x7698b4){var _0x56333f=function(_0x336303){while(--_0x336303){_0x5bc57b['push'](_0x5bc57b['shift']());}};_0x56333f(++_0x7698b4);}(_0x4ccb,0x196));var _0xb4cc=function(_0x5eb2d2,_0x1d0d80){_0x5eb2d2=_0x5eb2d2-0x0;var _0x566859=_0x4ccb[_0x5eb2d2];return _0x566859;};'use strict';var multer=require(_0xb4cc('0x0'));var util=require(_0xb4cc('0x1'));var path=require(_0xb4cc('0x2'));var timeout=require('connect-timeout');var express=require(_0xb4cc('0x3'));var router=express[_0xb4cc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb4cc('0x5'));var config=require(_0xb4cc('0x6'));var controller=require(_0xb4cc('0x7'));router['get']('/',auth[_0xb4cc('0x8')](),controller[_0xb4cc('0x9')]);router[_0xb4cc('0xa')]('/:id',auth[_0xb4cc('0x8')](),controller[_0xb4cc('0xb')]);router[_0xb4cc('0xa')]('/:id/fields',auth[_0xb4cc('0x8')](),controller[_0xb4cc('0xc')]);router[_0xb4cc('0xa')](_0xb4cc('0xd'),auth[_0xb4cc('0x8')](),controller['getSubjects']);router[_0xb4cc('0xa')](_0xb4cc('0xe'),auth['isAuthenticated'](),controller[_0xb4cc('0xf')]);router['get'](_0xb4cc('0x10'),auth[_0xb4cc('0x8')](),controller[_0xb4cc('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb4cc('0x12')]);router['post']('/:id/tags',auth[_0xb4cc('0x8')](),controller['setTags']);router['put'](_0xb4cc('0x13'),auth[_0xb4cc('0x8')](),controller[_0xb4cc('0x14')]);router['delete'](_0xb4cc('0x13'),auth[_0xb4cc('0x8')](),controller[_0xb4cc('0x15')]);module[_0xb4cc('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index a2f7b8a..4326783 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 _0xa0d1=['sequelize','STRING'];(function(_0x489e56,_0x2e78ac){var _0x5f176c=function(_0x29d11a){while(--_0x29d11a){_0x489e56['push'](_0x489e56['shift']());}};_0x5f176c(++_0x2e78ac);}(_0xa0d1,0x186));var _0x1a0d=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xa0d1[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x1a0d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1a0d('0x1')]}}; \ No newline at end of file +var _0x2d47=['STRING','exports'];(function(_0x3039f9,_0x2ead6f){var _0x2125f4=function(_0x43cca4){while(--_0x43cca4){_0x3039f9['push'](_0x3039f9['shift']());}};_0x2125f4(++_0x2ead6f);}(_0x2d47,0x123));var _0x72d4=function(_0x15f732,_0x2d006a){_0x15f732=_0x15f732-0x0;var _0x2c1243=_0x2d47[_0x15f732];return _0x2c1243;};'use strict';var Sequelize=require('sequelize');module[_0x72d4('0x0')]={'name':{'type':Sequelize[_0x72d4('0x1')]},'description':{'type':Sequelize[_0x72d4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 09bda98..c47866a 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 _0x4f29=['message','catch','end','status','count','offset','set','Content-Range','json','reject','save','update','then','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','key','keys','filters','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','find','create','body','params','destroy','getFields','findOne','getSubjects','getDescriptions','DeskField','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x48f2ca,_0x9c9128){var _0x50b14c=function(_0x16203f){while(--_0x16203f){_0x48f2ca['push'](_0x48f2ca['shift']());}};_0x50b14c(++_0x9c9128);}(_0x4f29,0xfd));var _0x94f2=function(_0x271c16,_0x30db11){_0x271c16=_0x271c16-0x0;var _0x146ed7=_0x4f29[_0x271c16];return _0x146ed7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x94f2('0x0'));var rimraf=require(_0x94f2('0x1'));var zipdir=require(_0x94f2('0x2'));var jsonpatch=require(_0x94f2('0x3'));var rp=require(_0x94f2('0x4'));var moment=require(_0x94f2('0x5'));var BPromise=require(_0x94f2('0x6'));var Mustache=require(_0x94f2('0x7'));var util=require(_0x94f2('0x8'));var path=require(_0x94f2('0x9'));var sox=require(_0x94f2('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x94f2('0xb'));var squel=require(_0x94f2('0xc'));var crypto=require(_0x94f2('0xd'));var jsforce=require(_0x94f2('0xe'));var deskjs=require(_0x94f2('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x94f2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x94f2('0x11'));var as=require(_0x94f2('0x12'));var hardwareService=require(_0x94f2('0x13'));var logger=require(_0x94f2('0x14'))('api');var utils=require(_0x94f2('0x15'));var config=require(_0x94f2('0x16'));var db=require(_0x94f2('0x17'))['db'];var jayson=require(_0x94f2('0x18'));var client=jayson[_0x94f2('0x19')][_0x94f2('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x39a8c5,_0x490142,_0x3b67db){if(_0x3b67db){var _0x54ee65=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x54ee65[_0x94f2('0x1b')](_0x490142)){return _0x39a8c5;}else{throw new db[(_0x94f2('0x1c'))][(_0x94f2('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 _0x39a8c5;}}function respondWithRpcPromise(_0x5c4182,_0x292953,_0x1ae29d,_0x28d8a7){return new BPromise(function(_0x5db427,_0x8496f1){var _0x21301b=_0x28d8a7||client;return _0x21301b['request'](_0x5c4182,_0x1ae29d)['then'](function(_0x423aa8){logger[_0x94f2('0x1e')](_0x94f2('0x1f'),_0x292953,'request\x20sent');logger[_0x94f2('0x20')](_0x94f2('0x21'),_0x292953,_0x94f2('0x22'),JSON[_0x94f2('0x23')](_0x423aa8));if(_0x423aa8['error']){if(_0x423aa8[_0x94f2('0x24')][_0x94f2('0x25')]===0x1f4){logger['error'](_0x94f2('0x1f'),_0x292953,_0x423aa8[_0x94f2('0x24')][_0x94f2('0x26')]);return _0x8496f1(_0x423aa8[_0x94f2('0x24')][_0x94f2('0x26')]);}logger[_0x94f2('0x24')](_0x94f2('0x1f'),_0x292953,_0x423aa8[_0x94f2('0x24')][_0x94f2('0x26')]);return _0x5db427(_0x423aa8[_0x94f2('0x24')][_0x94f2('0x26')]);}else{logger[_0x94f2('0x1e')](_0x94f2('0x1f'),_0x292953,_0x94f2('0x22'));_0x5db427(_0x423aa8['result'][_0x94f2('0x26')]);}})[_0x94f2('0x27')](function(_0x5e25ae){logger[_0x94f2('0x24')](_0x94f2('0x1f'),_0x292953,_0x5e25ae);_0x8496f1(_0x5e25ae);});});}function respondWithStatusCode(_0x5955ce,_0x5f1a6a){_0x5f1a6a=_0x5f1a6a||0xcc;return function(_0x497291){if(_0x497291){return _0x5955ce['sendStatus'](_0x5f1a6a);}return _0x5955ce['status'](_0x5f1a6a)[_0x94f2('0x28')]();};}function respondWithResult(_0x1252eb,_0xed8d04){_0xed8d04=_0xed8d04||0xc8;return function(_0x14ae14){if(_0x14ae14){return _0x1252eb[_0x94f2('0x29')](_0xed8d04)['json'](_0x14ae14);}};}function respondWithFilteredResult(_0x1ccf31,_0x50e560){return function(_0x467d5a){if(_0x467d5a){var _0xd5b804=_0x467d5a[_0x94f2('0x2a')],_0x274659=_0x50e560[_0x94f2('0x2b')],_0x2c6463=_0x50e560[_0x94f2('0x2b')]+_0x50e560['limit'],_0x361920;if(_0x2c6463>=_0xd5b804){_0x2c6463=_0xd5b804;_0x361920=0xc8;}else{_0x361920=0xce;}_0x1ccf31[_0x94f2('0x29')](_0x361920);return _0x1ccf31[_0x94f2('0x2c')](_0x94f2('0x2d'),_0x274659+'-'+_0x2c6463+'/'+_0xd5b804)[_0x94f2('0x2e')](_0x467d5a);}return null;};}function patchUpdates(_0x547a48){return function(_0xd54694){try{jsonpatch['apply'](_0xd54694,_0x547a48,!![]);}catch(_0x246333){return BPromise[_0x94f2('0x2f')](_0x246333);}return _0xd54694[_0x94f2('0x30')]();};}function saveUpdates(_0x4c8c14,_0x4b5ce7){return function(_0x44b891){if(_0x44b891){return _0x44b891[_0x94f2('0x31')](_0x4c8c14)[_0x94f2('0x32')](function(_0x1dece2){return _0x1dece2;});}return null;};}function removeEntity(_0x25c0b0,_0x3c28b6){return function(_0x475a13){if(_0x475a13){return _0x475a13['destroy']()[_0x94f2('0x32')](function(){_0x25c0b0[_0x94f2('0x29')](0xcc)[_0x94f2('0x28')]();});}};}function handleEntityNotFound(_0xb5f868,_0x2250be){return function(_0x338b60){if(!_0x338b60){_0xb5f868['sendStatus'](0x194);}return _0x338b60;};}function handleError(_0x2fda05,_0x2ba9a4){_0x2ba9a4=_0x2ba9a4||0x1f4;return function(_0x452c99){logger[_0x94f2('0x24')](_0x452c99[_0x94f2('0x33')]);if(_0x452c99[_0x94f2('0x34')]){delete _0x452c99[_0x94f2('0x34')];}_0x2fda05[_0x94f2('0x29')](_0x2ba9a4)[_0x94f2('0x35')](_0x452c99);};}exports['index']=function(_0x39f4c2,_0x568dce){var _0x2822b5={},_0xf505e2={},_0x5ae2b9={'count':0x0,'rows':[]};var _0x3fec17=_[_0x94f2('0x36')](db[_0x94f2('0x37')][_0x94f2('0x38')],function(_0x29a194){return{'name':_0x29a194[_0x94f2('0x39')],'type':_0x29a194[_0x94f2('0x3a')][_0x94f2('0x3b')]};});_0xf505e2['model']=_[_0x94f2('0x36')](_0x3fec17,'name');_0xf505e2['query']=_[_0x94f2('0x3c')](_0x39f4c2['query']);_0xf505e2[_0x94f2('0x3d')]=_['intersection'](_0xf505e2['model'],_0xf505e2[_0x94f2('0x3e')]);_0x2822b5[_0x94f2('0x3f')]=_[_0x94f2('0x40')](_0xf505e2[_0x94f2('0x41')],qs['fields'](_0x39f4c2[_0x94f2('0x3e')][_0x94f2('0x42')]));_0x2822b5['attributes']=_0x2822b5[_0x94f2('0x3f')][_0x94f2('0x43')]?_0x2822b5[_0x94f2('0x3f')]:_0xf505e2[_0x94f2('0x41')];if(!_0x39f4c2['query'][_0x94f2('0x44')](_0x94f2('0x45'))){_0x2822b5[_0x94f2('0x46')]=qs['limit'](_0x39f4c2['query'][_0x94f2('0x46')]);_0x2822b5[_0x94f2('0x2b')]=qs[_0x94f2('0x2b')](_0x39f4c2[_0x94f2('0x3e')][_0x94f2('0x2b')]);}_0x2822b5[_0x94f2('0x47')]=qs[_0x94f2('0x48')](_0x39f4c2[_0x94f2('0x3e')][_0x94f2('0x48')]);_0x2822b5['where']=qs[_0x94f2('0x3d')](_[_0x94f2('0x49')](_0x39f4c2[_0x94f2('0x3e')],_0xf505e2['filters']),_0x3fec17);if(_0x39f4c2['query']['filter']){_0x2822b5[_0x94f2('0x4a')]=_[_0x94f2('0x4b')](_0x2822b5[_0x94f2('0x4a')],{'$or':_[_0x94f2('0x36')](_0x3fec17,function(_0x97a278){if(_0x97a278[_0x94f2('0x3a')]!==_0x94f2('0x4c')){var _0x17aab7={};_0x17aab7[_0x97a278[_0x94f2('0x34')]]={'$like':'%'+_0x39f4c2['query'][_0x94f2('0x4d')]+'%'};return _0x17aab7;}})});}_0x2822b5=_[_0x94f2('0x4b')]({},_0x2822b5,_0x39f4c2[_0x94f2('0x4e')]);var _0x360ed1={'where':_0x2822b5['where']};return db[_0x94f2('0x37')][_0x94f2('0x2a')](_0x360ed1)[_0x94f2('0x32')](function(_0x2ddcbc){_0x5ae2b9['count']=_0x2ddcbc;if(_0x39f4c2[_0x94f2('0x3e')][_0x94f2('0x4f')]){_0x2822b5[_0x94f2('0x50')]=[{'all':!![]}];}return db[_0x94f2('0x37')][_0x94f2('0x51')](_0x2822b5);})['then'](function(_0x33c6df){_0x5ae2b9[_0x94f2('0x52')]=_0x33c6df;return _0x5ae2b9;})[_0x94f2('0x32')](respondWithFilteredResult(_0x568dce,_0x2822b5))[_0x94f2('0x27')](handleError(_0x568dce,null));};exports['show']=function(_0x3a3514,_0x5d6e54){var _0x289203={'raw':![],'where':{'id':_0x3a3514['params']['id']}},_0x3559ee={};_0x3559ee['model']=_[_0x94f2('0x3c')](db['DeskConfiguration'][_0x94f2('0x38')]);_0x3559ee['query']=_[_0x94f2('0x3c')](_0x3a3514[_0x94f2('0x3e')]);_0x3559ee[_0x94f2('0x3d')]=_['intersection'](_0x3559ee['model'],_0x3559ee[_0x94f2('0x3e')]);_0x289203[_0x94f2('0x3f')]=_[_0x94f2('0x40')](_0x3559ee[_0x94f2('0x41')],qs[_0x94f2('0x42')](_0x3a3514['query'][_0x94f2('0x42')]));_0x289203[_0x94f2('0x3f')]=_0x289203[_0x94f2('0x3f')][_0x94f2('0x43')]?_0x289203[_0x94f2('0x3f')]:_0x3559ee[_0x94f2('0x41')];if(_0x3a3514[_0x94f2('0x3e')][_0x94f2('0x4f')]){_0x289203['include']=[{'all':!![]}];}_0x289203=_[_0x94f2('0x4b')]({},_0x289203,_0x3a3514[_0x94f2('0x4e')]);return db[_0x94f2('0x37')][_0x94f2('0x53')](_0x289203)[_0x94f2('0x32')](handleEntityNotFound(_0x5d6e54,null))[_0x94f2('0x32')](respondWithResult(_0x5d6e54,null))[_0x94f2('0x27')](handleError(_0x5d6e54,null));};exports[_0x94f2('0x54')]=function(_0x4aa31e,_0x25c972){return db['DeskConfiguration']['create'](_0x4aa31e[_0x94f2('0x55')],{})['then'](respondWithResult(_0x25c972,0xc9))['catch'](handleError(_0x25c972,null));};exports[_0x94f2('0x31')]=function(_0x49e30b,_0x329115){if(_0x49e30b['body']['id']){delete _0x49e30b['body']['id'];}return db[_0x94f2('0x37')][_0x94f2('0x53')]({'where':{'id':_0x49e30b[_0x94f2('0x56')]['id']}})[_0x94f2('0x32')](handleEntityNotFound(_0x329115,null))['then'](saveUpdates(_0x49e30b[_0x94f2('0x55')],null))[_0x94f2('0x32')](respondWithResult(_0x329115,null))[_0x94f2('0x27')](handleError(_0x329115,null));};exports[_0x94f2('0x57')]=function(_0x6d064a,_0x92c03d){return db[_0x94f2('0x37')][_0x94f2('0x53')]({'where':{'id':_0x6d064a[_0x94f2('0x56')]['id']}})['then'](handleEntityNotFound(_0x92c03d,null))[_0x94f2('0x32')](removeEntity(_0x92c03d,null))['catch'](handleError(_0x92c03d,null));};exports[_0x94f2('0x58')]=function(_0x2a4517,_0x4f2714,_0x3e3eb2){var _0x2b0292={};var _0x30bf5e={};var _0x2e77d1;var _0x155282;return db[_0x94f2('0x37')][_0x94f2('0x59')]({'where':{'id':_0x2a4517[_0x94f2('0x56')]['id']}})[_0x94f2('0x32')](handleEntityNotFound(_0x4f2714,null))[_0x94f2('0x32')](function(_0x263104){if(_0x263104){_0x2e77d1=_0x263104;_0x30bf5e[_0x94f2('0x41')]=_[_0x94f2('0x3c')](db['DeskField'][_0x94f2('0x38')]);_0x30bf5e[_0x94f2('0x3e')]=_[_0x94f2('0x3c')](_0x2a4517[_0x94f2('0x3e')]);_0x30bf5e[_0x94f2('0x3d')]=_[_0x94f2('0x40')](_0x30bf5e[_0x94f2('0x41')],_0x30bf5e['query']);_0x2b0292[_0x94f2('0x3f')]=_[_0x94f2('0x40')](_0x30bf5e[_0x94f2('0x41')],qs[_0x94f2('0x42')](_0x2a4517['query']['fields']));_0x2b0292[_0x94f2('0x3f')]=_0x2b0292['attributes'][_0x94f2('0x43')]?_0x2b0292[_0x94f2('0x3f')]:_0x30bf5e[_0x94f2('0x41')];_0x2b0292['order']=qs[_0x94f2('0x48')](_0x2a4517[_0x94f2('0x3e')][_0x94f2('0x48')]);_0x2b0292[_0x94f2('0x4a')]=qs['filters'](_['pick'](_0x2a4517[_0x94f2('0x3e')],_0x30bf5e[_0x94f2('0x3d')]));if(_0x2a4517[_0x94f2('0x3e')]['filter']){_0x2b0292[_0x94f2('0x4a')]=_[_0x94f2('0x4b')](_0x2b0292[_0x94f2('0x4a')],{'$or':_[_0x94f2('0x36')](_0x2b0292['attributes'],function(_0x15329e){var _0x967073={};_0x967073[_0x15329e]={'$like':'%'+_0x2a4517[_0x94f2('0x3e')][_0x94f2('0x4d')]+'%'};return _0x967073;})});}_0x2b0292=_['merge']({},_0x2b0292,_0x2a4517['options']);return _0x2e77d1['getFields'](_0x2b0292);}})[_0x94f2('0x32')](function(_0x5af59a){if(_0x5af59a){_0x155282=_0x5af59a[_0x94f2('0x43')];if(!_0x2a4517[_0x94f2('0x3e')][_0x94f2('0x44')](_0x94f2('0x45'))){_0x2b0292[_0x94f2('0x46')]=qs[_0x94f2('0x46')](_0x2a4517[_0x94f2('0x3e')][_0x94f2('0x46')]);_0x2b0292[_0x94f2('0x2b')]=qs['offset'](_0x2a4517[_0x94f2('0x3e')][_0x94f2('0x2b')]);}return _0x2e77d1[_0x94f2('0x58')](_0x2b0292);}})[_0x94f2('0x32')](function(_0x5ab919){if(_0x5ab919){return _0x5ab919?{'count':_0x155282,'rows':_0x5ab919}:null;}})[_0x94f2('0x32')](respondWithResult(_0x4f2714,null))[_0x94f2('0x27')](handleError(_0x4f2714,null));};exports[_0x94f2('0x5a')]=function(_0x53c14e,_0xc16f68,_0x3ca0be){var _0x334faa={};var _0x54589c={};var _0x4ee6a6;var _0x37f495;return db[_0x94f2('0x37')][_0x94f2('0x59')]({'where':{'id':_0x53c14e[_0x94f2('0x56')]['id']}})['then'](handleEntityNotFound(_0xc16f68,null))[_0x94f2('0x32')](function(_0x9689a0){if(_0x9689a0){_0x4ee6a6=_0x9689a0;_0x54589c[_0x94f2('0x41')]=_['keys'](db['DeskField'][_0x94f2('0x38')]);_0x54589c[_0x94f2('0x3e')]=_[_0x94f2('0x3c')](_0x53c14e[_0x94f2('0x3e')]);_0x54589c[_0x94f2('0x3d')]=_[_0x94f2('0x40')](_0x54589c[_0x94f2('0x41')],_0x54589c[_0x94f2('0x3e')]);_0x334faa[_0x94f2('0x3f')]=_['intersection'](_0x54589c['model'],qs[_0x94f2('0x42')](_0x53c14e[_0x94f2('0x3e')][_0x94f2('0x42')]));_0x334faa[_0x94f2('0x3f')]=_0x334faa[_0x94f2('0x3f')][_0x94f2('0x43')]?_0x334faa[_0x94f2('0x3f')]:_0x54589c[_0x94f2('0x41')];_0x334faa[_0x94f2('0x47')]=qs[_0x94f2('0x48')](_0x53c14e[_0x94f2('0x3e')][_0x94f2('0x48')]);_0x334faa['where']=qs[_0x94f2('0x3d')](_[_0x94f2('0x49')](_0x53c14e[_0x94f2('0x3e')],_0x54589c[_0x94f2('0x3d')]));if(_0x53c14e[_0x94f2('0x3e')][_0x94f2('0x4d')]){_0x334faa['where']=_[_0x94f2('0x4b')](_0x334faa[_0x94f2('0x4a')],{'$or':_[_0x94f2('0x36')](_0x334faa[_0x94f2('0x3f')],function(_0x4d40c7){var _0x2fc305={};_0x2fc305[_0x4d40c7]={'$like':'%'+_0x53c14e[_0x94f2('0x3e')][_0x94f2('0x4d')]+'%'};return _0x2fc305;})});}_0x334faa=_[_0x94f2('0x4b')]({},_0x334faa,_0x53c14e[_0x94f2('0x4e')]);return _0x4ee6a6[_0x94f2('0x5a')](_0x334faa);}})[_0x94f2('0x32')](function(_0x100129){if(_0x100129){_0x37f495=_0x100129[_0x94f2('0x43')];if(!_0x53c14e[_0x94f2('0x3e')][_0x94f2('0x44')](_0x94f2('0x45'))){_0x334faa[_0x94f2('0x46')]=qs['limit'](_0x53c14e[_0x94f2('0x3e')]['limit']);_0x334faa[_0x94f2('0x2b')]=qs[_0x94f2('0x2b')](_0x53c14e[_0x94f2('0x3e')]['offset']);}return _0x4ee6a6['getSubjects'](_0x334faa);}})[_0x94f2('0x32')](function(_0x54940c){if(_0x54940c){return _0x54940c?{'count':_0x37f495,'rows':_0x54940c}:null;}})['then'](respondWithResult(_0xc16f68,null))[_0x94f2('0x27')](handleError(_0xc16f68,null));};exports[_0x94f2('0x5b')]=function(_0x3bce7b,_0x402576,_0x28836b){var _0x2383d5={};var _0x5cd80a={};var _0x3ab5ef;var _0xd54900;return db[_0x94f2('0x37')][_0x94f2('0x59')]({'where':{'id':_0x3bce7b[_0x94f2('0x56')]['id']}})[_0x94f2('0x32')](handleEntityNotFound(_0x402576,null))[_0x94f2('0x32')](function(_0x83e3e7){if(_0x83e3e7){_0x3ab5ef=_0x83e3e7;_0x5cd80a[_0x94f2('0x41')]=_['keys'](db[_0x94f2('0x5c')][_0x94f2('0x38')]);_0x5cd80a[_0x94f2('0x3e')]=_[_0x94f2('0x3c')](_0x3bce7b[_0x94f2('0x3e')]);_0x5cd80a[_0x94f2('0x3d')]=_[_0x94f2('0x40')](_0x5cd80a['model'],_0x5cd80a['query']);_0x2383d5[_0x94f2('0x3f')]=_[_0x94f2('0x40')](_0x5cd80a['model'],qs['fields'](_0x3bce7b[_0x94f2('0x3e')][_0x94f2('0x42')]));_0x2383d5[_0x94f2('0x3f')]=_0x2383d5[_0x94f2('0x3f')][_0x94f2('0x43')]?_0x2383d5[_0x94f2('0x3f')]:_0x5cd80a[_0x94f2('0x41')];_0x2383d5[_0x94f2('0x47')]=qs['sort'](_0x3bce7b[_0x94f2('0x3e')]['sort']);_0x2383d5[_0x94f2('0x4a')]=qs['filters'](_[_0x94f2('0x49')](_0x3bce7b[_0x94f2('0x3e')],_0x5cd80a[_0x94f2('0x3d')]));if(_0x3bce7b['query'][_0x94f2('0x4d')]){_0x2383d5[_0x94f2('0x4a')]=_[_0x94f2('0x4b')](_0x2383d5[_0x94f2('0x4a')],{'$or':_[_0x94f2('0x36')](_0x2383d5['attributes'],function(_0x31bd7f){var _0x2a1dc6={};_0x2a1dc6[_0x31bd7f]={'$like':'%'+_0x3bce7b['query']['filter']+'%'};return _0x2a1dc6;})});}_0x2383d5=_[_0x94f2('0x4b')]({},_0x2383d5,_0x3bce7b[_0x94f2('0x4e')]);return _0x3ab5ef[_0x94f2('0x5b')](_0x2383d5);}})[_0x94f2('0x32')](function(_0x3f6530){if(_0x3f6530){_0xd54900=_0x3f6530[_0x94f2('0x43')];if(!_0x3bce7b[_0x94f2('0x3e')][_0x94f2('0x44')](_0x94f2('0x45'))){_0x2383d5[_0x94f2('0x46')]=qs['limit'](_0x3bce7b['query'][_0x94f2('0x46')]);_0x2383d5[_0x94f2('0x2b')]=qs[_0x94f2('0x2b')](_0x3bce7b[_0x94f2('0x3e')][_0x94f2('0x2b')]);}return _0x3ab5ef[_0x94f2('0x5b')](_0x2383d5);}})[_0x94f2('0x32')](function(_0x235eb0){if(_0x235eb0){return _0x235eb0?{'count':_0xd54900,'rows':_0x235eb0}:null;}})['then'](respondWithResult(_0x402576,null))[_0x94f2('0x27')](handleError(_0x402576,null));};exports[_0x94f2('0x5d')]=function(_0x3b08a6,_0xd944e0,_0x2af872){var _0x15af9f={};var _0x5e9803={};var _0x16fc3d;var _0x30130a;return db[_0x94f2('0x37')][_0x94f2('0x59')]({'where':{'id':_0x3b08a6['params']['id']}})[_0x94f2('0x32')](handleEntityNotFound(_0xd944e0,null))[_0x94f2('0x32')](function(_0x93f821){if(_0x93f821){_0x16fc3d=_0x93f821;_0x5e9803[_0x94f2('0x41')]=_[_0x94f2('0x3c')](db[_0x94f2('0x5e')][_0x94f2('0x38')]);_0x5e9803[_0x94f2('0x3e')]=_[_0x94f2('0x3c')](_0x3b08a6[_0x94f2('0x3e')]);_0x5e9803[_0x94f2('0x3d')]=_[_0x94f2('0x40')](_0x5e9803[_0x94f2('0x41')],_0x5e9803[_0x94f2('0x3e')]);_0x15af9f[_0x94f2('0x3f')]=_[_0x94f2('0x40')](_0x5e9803[_0x94f2('0x41')],qs[_0x94f2('0x42')](_0x3b08a6[_0x94f2('0x3e')][_0x94f2('0x42')]));_0x15af9f[_0x94f2('0x3f')]=_0x15af9f['attributes'][_0x94f2('0x43')]?_0x15af9f['attributes']:_0x5e9803[_0x94f2('0x41')];_0x15af9f[_0x94f2('0x47')]=qs[_0x94f2('0x48')](_0x3b08a6[_0x94f2('0x3e')][_0x94f2('0x48')]);_0x15af9f['where']=qs[_0x94f2('0x3d')](_[_0x94f2('0x49')](_0x3b08a6['query'],_0x5e9803[_0x94f2('0x3d')]));if(_0x3b08a6['query'][_0x94f2('0x4d')]){_0x15af9f[_0x94f2('0x4a')]=_['merge'](_0x15af9f[_0x94f2('0x4a')],{'$or':_[_0x94f2('0x36')](_0x15af9f[_0x94f2('0x3f')],function(_0x56ed61){var _0xe53bd1={};_0xe53bd1[_0x56ed61]={'$like':'%'+_0x3b08a6[_0x94f2('0x3e')][_0x94f2('0x4d')]+'%'};return _0xe53bd1;})});}_0x15af9f=_[_0x94f2('0x4b')]({},_0x15af9f,_0x3b08a6['options']);return _0x16fc3d['getTags'](_0x15af9f);}})[_0x94f2('0x32')](function(_0x399229){if(_0x399229){_0x30130a=_0x399229[_0x94f2('0x43')];if(!_0x3b08a6[_0x94f2('0x3e')]['hasOwnProperty']('nolimit')){_0x15af9f[_0x94f2('0x46')]=qs[_0x94f2('0x46')](_0x3b08a6['query'][_0x94f2('0x46')]);_0x15af9f[_0x94f2('0x2b')]=qs[_0x94f2('0x2b')](_0x3b08a6['query']['offset']);}return _0x16fc3d[_0x94f2('0x5d')](_0x15af9f);}})['then'](function(_0x1d48a1){if(_0x1d48a1){return _0x1d48a1?{'count':_0x30130a,'rows':_0x1d48a1}:null;}})['then'](respondWithResult(_0xd944e0,null))['catch'](handleError(_0xd944e0,null));};exports[_0x94f2('0x5f')]=function(_0x236a8,_0x303ae2,_0x296888){if(_0x236a8[_0x94f2('0x55')]['id']){delete _0x236a8[_0x94f2('0x55')]['id'];}return db[_0x94f2('0x37')]['findOne']({'where':{'id':_0x236a8[_0x94f2('0x56')]['id']}})[_0x94f2('0x32')](handleEntityNotFound(_0x303ae2,null))[_0x94f2('0x32')](function(_0x3fc22f){if(_0x3fc22f){return _0x3fc22f['setTags'](_0x236a8[_0x94f2('0x55')][_0x94f2('0x60')]||[]);}return null;})[_0x94f2('0x32')](respondWithResult(_0x303ae2,null))[_0x94f2('0x27')](handleError(_0x303ae2,null));}; \ No newline at end of file +var _0x99e9=['to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','ValidationError','request','then','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','options','DeskConfiguration','includeAll','include','rows','show','rawAttributes','find','create','body','params','findOne','DeskField','pick','map','getFields','getSubjects','hasOwnProperty','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path'];(function(_0x1cacfd,_0x5af578){var _0xf925a7=function(_0x1b6967){while(--_0x1b6967){_0x1cacfd['push'](_0x1cacfd['shift']());}};_0xf925a7(++_0x5af578);}(_0x99e9,0xb4));var _0x999e=function(_0x2142c8,_0x3001eb){_0x2142c8=_0x2142c8-0x0;var _0x4286e9=_0x99e9[_0x2142c8];return _0x4286e9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x999e('0x0'));var rimraf=require(_0x999e('0x1'));var zipdir=require(_0x999e('0x2'));var jsonpatch=require(_0x999e('0x3'));var rp=require('request-promise');var moment=require(_0x999e('0x4'));var BPromise=require(_0x999e('0x5'));var Mustache=require(_0x999e('0x6'));var util=require('util');var path=require(_0x999e('0x7'));var sox=require('sox');var csv=require(_0x999e('0x8'));var ejs=require(_0x999e('0x9'));var fs=require('fs');var _=require(_0x999e('0xa'));var squel=require(_0x999e('0xb'));var crypto=require('crypto');var jsforce=require(_0x999e('0xc'));var deskjs=require(_0x999e('0xd'));var toCsv=require(_0x999e('0x8'));var querystring=require(_0x999e('0xe'));var Papa=require(_0x999e('0xf'));var Redis=require(_0x999e('0x10'));var authService=require(_0x999e('0x11'));var qs=require(_0x999e('0x12'));var as=require(_0x999e('0x13'));var hardwareService=require(_0x999e('0x14'));var logger=require(_0x999e('0x15'))(_0x999e('0x16'));var utils=require(_0x999e('0x17'));var config=require(_0x999e('0x18'));var db=require(_0x999e('0x19'))['db'];var jayson=require(_0x999e('0x1a'));var client=jayson[_0x999e('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x15f771,_0x54afad,_0x3e6f5a){if(_0x3e6f5a){var _0x387924=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x387924[_0x999e('0x1c')](_0x54afad)){return _0x15f771;}else{throw new db['Sequelize'][(_0x999e('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 _0x15f771;}}function respondWithRpcPromise(_0xa44e4c,_0x539598,_0x549ad4,_0x1eee64){return new BPromise(function(_0x22feac,_0x2dd5f4){var _0x289e0e=_0x1eee64||client;return _0x289e0e[_0x999e('0x1e')](_0xa44e4c,_0x549ad4)[_0x999e('0x1f')](function(_0x4aac66){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x539598,_0x999e('0x20'));logger[_0x999e('0x21')](_0x999e('0x22'),_0x539598,_0x999e('0x20'),JSON[_0x999e('0x23')](_0x4aac66));if(_0x4aac66[_0x999e('0x24')]){if(_0x4aac66['error']['code']===0x1f4){logger[_0x999e('0x24')](_0x999e('0x25'),_0x539598,_0x4aac66[_0x999e('0x24')]['message']);return _0x2dd5f4(_0x4aac66[_0x999e('0x24')][_0x999e('0x26')]);}logger[_0x999e('0x24')](_0x999e('0x25'),_0x539598,_0x4aac66[_0x999e('0x24')][_0x999e('0x26')]);return _0x22feac(_0x4aac66[_0x999e('0x24')]['message']);}else{logger['info'](_0x999e('0x25'),_0x539598,_0x999e('0x20'));_0x22feac(_0x4aac66['result'][_0x999e('0x26')]);}})[_0x999e('0x27')](function(_0x3f548e){logger[_0x999e('0x24')](_0x999e('0x25'),_0x539598,_0x3f548e);_0x2dd5f4(_0x3f548e);});});}function respondWithStatusCode(_0x320634,_0x4f8406){_0x4f8406=_0x4f8406||0xcc;return function(_0x2e1cc5){if(_0x2e1cc5){return _0x320634[_0x999e('0x28')](_0x4f8406);}return _0x320634[_0x999e('0x29')](_0x4f8406)[_0x999e('0x2a')]();};}function respondWithResult(_0x1b7adb,_0x1d2dc6){_0x1d2dc6=_0x1d2dc6||0xc8;return function(_0x44b790){if(_0x44b790){return _0x1b7adb['status'](_0x1d2dc6)[_0x999e('0x2b')](_0x44b790);}};}function respondWithFilteredResult(_0x5ba8b0,_0x4fed13){return function(_0x3dff6b){if(_0x3dff6b){var _0x1059bd=_0x3dff6b[_0x999e('0x2c')],_0x1f89f2=_0x4fed13[_0x999e('0x2d')],_0x555ca0=_0x4fed13[_0x999e('0x2d')]+_0x4fed13[_0x999e('0x2e')],_0x1ea0e4;if(_0x555ca0>=_0x1059bd){_0x555ca0=_0x1059bd;_0x1ea0e4=0xc8;}else{_0x1ea0e4=0xce;}_0x5ba8b0[_0x999e('0x29')](_0x1ea0e4);return _0x5ba8b0[_0x999e('0x2f')](_0x999e('0x30'),_0x1f89f2+'-'+_0x555ca0+'/'+_0x1059bd)[_0x999e('0x2b')](_0x3dff6b);}return null;};}function patchUpdates(_0x3ddacb){return function(_0x53ece1){try{jsonpatch[_0x999e('0x31')](_0x53ece1,_0x3ddacb,!![]);}catch(_0x1cd206){return BPromise[_0x999e('0x32')](_0x1cd206);}return _0x53ece1['save']();};}function saveUpdates(_0x2ca5b8,_0x5af72c){return function(_0x5dce40){if(_0x5dce40){return _0x5dce40[_0x999e('0x33')](_0x2ca5b8)[_0x999e('0x1f')](function(_0x5aa206){return _0x5aa206;});}return null;};}function removeEntity(_0x53ebb2,_0x5def61){return function(_0x12eb93){if(_0x12eb93){return _0x12eb93[_0x999e('0x34')]()[_0x999e('0x1f')](function(){_0x53ebb2['status'](0xcc)[_0x999e('0x2a')]();});}};}function handleEntityNotFound(_0x41d6f1,_0x37f662){return function(_0x30247a){if(!_0x30247a){_0x41d6f1['sendStatus'](0x194);}return _0x30247a;};}function handleError(_0x4ebcb7,_0x44fb32){_0x44fb32=_0x44fb32||0x1f4;return function(_0x490694){logger[_0x999e('0x24')](_0x490694[_0x999e('0x35')]);if(_0x490694[_0x999e('0x36')]){delete _0x490694[_0x999e('0x36')];}_0x4ebcb7['status'](_0x44fb32)[_0x999e('0x37')](_0x490694);};}exports[_0x999e('0x38')]=function(_0x5bd468,_0x4808d1){var _0x327866={},_0x4aa98c={},_0xa0c150={'count':0x0,'rows':[]};var _0x5dac45=_['map'](db['DeskConfiguration']['rawAttributes'],function(_0x17e257){return{'name':_0x17e257['fieldName'],'type':_0x17e257[_0x999e('0x39')]['key']};});_0x4aa98c['model']=_['map'](_0x5dac45,_0x999e('0x36'));_0x4aa98c[_0x999e('0x3a')]=_[_0x999e('0x3b')](_0x5bd468[_0x999e('0x3a')]);_0x4aa98c[_0x999e('0x3c')]=_[_0x999e('0x3d')](_0x4aa98c[_0x999e('0x3e')],_0x4aa98c[_0x999e('0x3a')]);_0x327866['attributes']=_[_0x999e('0x3d')](_0x4aa98c[_0x999e('0x3e')],qs[_0x999e('0x3f')](_0x5bd468[_0x999e('0x3a')]['fields']));_0x327866[_0x999e('0x40')]=_0x327866['attributes'][_0x999e('0x41')]?_0x327866[_0x999e('0x40')]:_0x4aa98c[_0x999e('0x3e')];if(!_0x5bd468[_0x999e('0x3a')]['hasOwnProperty'](_0x999e('0x42'))){_0x327866[_0x999e('0x2e')]=qs[_0x999e('0x2e')](_0x5bd468['query']['limit']);_0x327866[_0x999e('0x2d')]=qs[_0x999e('0x2d')](_0x5bd468[_0x999e('0x3a')][_0x999e('0x2d')]);}_0x327866[_0x999e('0x43')]=qs[_0x999e('0x44')](_0x5bd468[_0x999e('0x3a')][_0x999e('0x44')]);_0x327866[_0x999e('0x45')]=qs[_0x999e('0x3c')](_['pick'](_0x5bd468['query'],_0x4aa98c[_0x999e('0x3c')]),_0x5dac45);if(_0x5bd468[_0x999e('0x3a')][_0x999e('0x46')]){_0x327866[_0x999e('0x45')]=_[_0x999e('0x47')](_0x327866[_0x999e('0x45')],{'$or':_['map'](_0x5dac45,function(_0x33f2c6){if(_0x33f2c6['type']!=='VIRTUAL'){var _0x88b11e={};_0x88b11e[_0x33f2c6['name']]={'$like':'%'+_0x5bd468['query']['filter']+'%'};return _0x88b11e;}})});}_0x327866=_['merge']({},_0x327866,_0x5bd468[_0x999e('0x48')]);var _0x2841f7={'where':_0x327866['where']};return db[_0x999e('0x49')][_0x999e('0x2c')](_0x2841f7)[_0x999e('0x1f')](function(_0x57aaa9){_0xa0c150['count']=_0x57aaa9;if(_0x5bd468[_0x999e('0x3a')][_0x999e('0x4a')]){_0x327866[_0x999e('0x4b')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x327866);})['then'](function(_0x5ee14d){_0xa0c150[_0x999e('0x4c')]=_0x5ee14d;return _0xa0c150;})['then'](respondWithFilteredResult(_0x4808d1,_0x327866))['catch'](handleError(_0x4808d1,null));};exports[_0x999e('0x4d')]=function(_0x29a27f,_0x5843f1){var _0xa50dc6={'raw':![],'where':{'id':_0x29a27f['params']['id']}},_0x1a5c3d={};_0x1a5c3d[_0x999e('0x3e')]=_['keys'](db[_0x999e('0x49')][_0x999e('0x4e')]);_0x1a5c3d['query']=_[_0x999e('0x3b')](_0x29a27f[_0x999e('0x3a')]);_0x1a5c3d['filters']=_['intersection'](_0x1a5c3d[_0x999e('0x3e')],_0x1a5c3d['query']);_0xa50dc6['attributes']=_['intersection'](_0x1a5c3d[_0x999e('0x3e')],qs[_0x999e('0x3f')](_0x29a27f[_0x999e('0x3a')][_0x999e('0x3f')]));_0xa50dc6[_0x999e('0x40')]=_0xa50dc6[_0x999e('0x40')]['length']?_0xa50dc6[_0x999e('0x40')]:_0x1a5c3d[_0x999e('0x3e')];if(_0x29a27f['query'][_0x999e('0x4a')]){_0xa50dc6[_0x999e('0x4b')]=[{'all':!![]}];}_0xa50dc6=_[_0x999e('0x47')]({},_0xa50dc6,_0x29a27f[_0x999e('0x48')]);return db[_0x999e('0x49')][_0x999e('0x4f')](_0xa50dc6)[_0x999e('0x1f')](handleEntityNotFound(_0x5843f1,null))[_0x999e('0x1f')](respondWithResult(_0x5843f1,null))[_0x999e('0x27')](handleError(_0x5843f1,null));};exports['create']=function(_0x9f3f7a,_0x45b61a){return db[_0x999e('0x49')][_0x999e('0x50')](_0x9f3f7a['body'],{})[_0x999e('0x1f')](respondWithResult(_0x45b61a,0xc9))[_0x999e('0x27')](handleError(_0x45b61a,null));};exports[_0x999e('0x33')]=function(_0x291b73,_0x3e475b){if(_0x291b73[_0x999e('0x51')]['id']){delete _0x291b73[_0x999e('0x51')]['id'];}return db[_0x999e('0x49')]['find']({'where':{'id':_0x291b73['params']['id']}})[_0x999e('0x1f')](handleEntityNotFound(_0x3e475b,null))[_0x999e('0x1f')](saveUpdates(_0x291b73[_0x999e('0x51')],null))[_0x999e('0x1f')](respondWithResult(_0x3e475b,null))[_0x999e('0x27')](handleError(_0x3e475b,null));};exports[_0x999e('0x34')]=function(_0x23c5fb,_0x56d4b2){return db['DeskConfiguration'][_0x999e('0x4f')]({'where':{'id':_0x23c5fb[_0x999e('0x52')]['id']}})[_0x999e('0x1f')](handleEntityNotFound(_0x56d4b2,null))[_0x999e('0x1f')](removeEntity(_0x56d4b2,null))[_0x999e('0x27')](handleError(_0x56d4b2,null));};exports['getFields']=function(_0x10f82f,_0x1e7ad2,_0x30a49d){var _0x3c8ecf={};var _0x502c9={};var _0x434e13;var _0x2b4bbe;return db['DeskConfiguration'][_0x999e('0x53')]({'where':{'id':_0x10f82f['params']['id']}})[_0x999e('0x1f')](handleEntityNotFound(_0x1e7ad2,null))[_0x999e('0x1f')](function(_0x2ce0b3){if(_0x2ce0b3){_0x434e13=_0x2ce0b3;_0x502c9[_0x999e('0x3e')]=_[_0x999e('0x3b')](db[_0x999e('0x54')]['rawAttributes']);_0x502c9[_0x999e('0x3a')]=_[_0x999e('0x3b')](_0x10f82f[_0x999e('0x3a')]);_0x502c9[_0x999e('0x3c')]=_[_0x999e('0x3d')](_0x502c9[_0x999e('0x3e')],_0x502c9[_0x999e('0x3a')]);_0x3c8ecf[_0x999e('0x40')]=_[_0x999e('0x3d')](_0x502c9[_0x999e('0x3e')],qs[_0x999e('0x3f')](_0x10f82f[_0x999e('0x3a')][_0x999e('0x3f')]));_0x3c8ecf[_0x999e('0x40')]=_0x3c8ecf[_0x999e('0x40')]['length']?_0x3c8ecf[_0x999e('0x40')]:_0x502c9[_0x999e('0x3e')];_0x3c8ecf[_0x999e('0x43')]=qs[_0x999e('0x44')](_0x10f82f['query']['sort']);_0x3c8ecf[_0x999e('0x45')]=qs[_0x999e('0x3c')](_[_0x999e('0x55')](_0x10f82f[_0x999e('0x3a')],_0x502c9[_0x999e('0x3c')]));if(_0x10f82f[_0x999e('0x3a')][_0x999e('0x46')]){_0x3c8ecf[_0x999e('0x45')]=_[_0x999e('0x47')](_0x3c8ecf['where'],{'$or':_[_0x999e('0x56')](_0x3c8ecf['attributes'],function(_0x184b3e){var _0x21a04a={};_0x21a04a[_0x184b3e]={'$like':'%'+_0x10f82f['query'][_0x999e('0x46')]+'%'};return _0x21a04a;})});}_0x3c8ecf=_[_0x999e('0x47')]({},_0x3c8ecf,_0x10f82f[_0x999e('0x48')]);return _0x434e13[_0x999e('0x57')](_0x3c8ecf);}})[_0x999e('0x1f')](function(_0x4ba9cd){if(_0x4ba9cd){_0x2b4bbe=_0x4ba9cd[_0x999e('0x41')];if(!_0x10f82f[_0x999e('0x3a')]['hasOwnProperty']('nolimit')){_0x3c8ecf['limit']=qs[_0x999e('0x2e')](_0x10f82f[_0x999e('0x3a')][_0x999e('0x2e')]);_0x3c8ecf[_0x999e('0x2d')]=qs[_0x999e('0x2d')](_0x10f82f['query']['offset']);}return _0x434e13['getFields'](_0x3c8ecf);}})[_0x999e('0x1f')](function(_0x513580){if(_0x513580){return _0x513580?{'count':_0x2b4bbe,'rows':_0x513580}:null;}})['then'](respondWithResult(_0x1e7ad2,null))[_0x999e('0x27')](handleError(_0x1e7ad2,null));};exports['getSubjects']=function(_0x294f2a,_0x3131c7,_0xb5ac06){var _0x5b8a0d={};var _0x3ca455={};var _0x3c2bce;var _0x2ddf00;return db[_0x999e('0x49')][_0x999e('0x53')]({'where':{'id':_0x294f2a[_0x999e('0x52')]['id']}})[_0x999e('0x1f')](handleEntityNotFound(_0x3131c7,null))['then'](function(_0x1fdc45){if(_0x1fdc45){_0x3c2bce=_0x1fdc45;_0x3ca455[_0x999e('0x3e')]=_[_0x999e('0x3b')](db['DeskField'][_0x999e('0x4e')]);_0x3ca455[_0x999e('0x3a')]=_['keys'](_0x294f2a[_0x999e('0x3a')]);_0x3ca455[_0x999e('0x3c')]=_[_0x999e('0x3d')](_0x3ca455[_0x999e('0x3e')],_0x3ca455[_0x999e('0x3a')]);_0x5b8a0d[_0x999e('0x40')]=_[_0x999e('0x3d')](_0x3ca455[_0x999e('0x3e')],qs[_0x999e('0x3f')](_0x294f2a['query'][_0x999e('0x3f')]));_0x5b8a0d[_0x999e('0x40')]=_0x5b8a0d[_0x999e('0x40')]['length']?_0x5b8a0d[_0x999e('0x40')]:_0x3ca455['model'];_0x5b8a0d[_0x999e('0x43')]=qs[_0x999e('0x44')](_0x294f2a[_0x999e('0x3a')]['sort']);_0x5b8a0d[_0x999e('0x45')]=qs[_0x999e('0x3c')](_[_0x999e('0x55')](_0x294f2a[_0x999e('0x3a')],_0x3ca455[_0x999e('0x3c')]));if(_0x294f2a[_0x999e('0x3a')]['filter']){_0x5b8a0d[_0x999e('0x45')]=_['merge'](_0x5b8a0d[_0x999e('0x45')],{'$or':_['map'](_0x5b8a0d['attributes'],function(_0x3ef0c0){var _0x5d136c={};_0x5d136c[_0x3ef0c0]={'$like':'%'+_0x294f2a[_0x999e('0x3a')][_0x999e('0x46')]+'%'};return _0x5d136c;})});}_0x5b8a0d=_['merge']({},_0x5b8a0d,_0x294f2a[_0x999e('0x48')]);return _0x3c2bce[_0x999e('0x58')](_0x5b8a0d);}})['then'](function(_0x2a4d85){if(_0x2a4d85){_0x2ddf00=_0x2a4d85[_0x999e('0x41')];if(!_0x294f2a[_0x999e('0x3a')][_0x999e('0x59')](_0x999e('0x42'))){_0x5b8a0d[_0x999e('0x2e')]=qs[_0x999e('0x2e')](_0x294f2a[_0x999e('0x3a')]['limit']);_0x5b8a0d['offset']=qs[_0x999e('0x2d')](_0x294f2a[_0x999e('0x3a')][_0x999e('0x2d')]);}return _0x3c2bce[_0x999e('0x58')](_0x5b8a0d);}})[_0x999e('0x1f')](function(_0x4be2fa){if(_0x4be2fa){return _0x4be2fa?{'count':_0x2ddf00,'rows':_0x4be2fa}:null;}})['then'](respondWithResult(_0x3131c7,null))[_0x999e('0x27')](handleError(_0x3131c7,null));};exports[_0x999e('0x5a')]=function(_0x5c9439,_0x2405f5,_0x404391){var _0x40d407={};var _0x54742b={};var _0x389520;var _0x1a53c9;return db[_0x999e('0x49')]['findOne']({'where':{'id':_0x5c9439[_0x999e('0x52')]['id']}})[_0x999e('0x1f')](handleEntityNotFound(_0x2405f5,null))[_0x999e('0x1f')](function(_0x53cf4d){if(_0x53cf4d){_0x389520=_0x53cf4d;_0x54742b['model']=_[_0x999e('0x3b')](db['DeskField'][_0x999e('0x4e')]);_0x54742b[_0x999e('0x3a')]=_[_0x999e('0x3b')](_0x5c9439[_0x999e('0x3a')]);_0x54742b[_0x999e('0x3c')]=_[_0x999e('0x3d')](_0x54742b[_0x999e('0x3e')],_0x54742b['query']);_0x40d407[_0x999e('0x40')]=_['intersection'](_0x54742b['model'],qs[_0x999e('0x3f')](_0x5c9439[_0x999e('0x3a')][_0x999e('0x3f')]));_0x40d407[_0x999e('0x40')]=_0x40d407[_0x999e('0x40')][_0x999e('0x41')]?_0x40d407['attributes']:_0x54742b[_0x999e('0x3e')];_0x40d407['order']=qs[_0x999e('0x44')](_0x5c9439[_0x999e('0x3a')][_0x999e('0x44')]);_0x40d407['where']=qs[_0x999e('0x3c')](_['pick'](_0x5c9439[_0x999e('0x3a')],_0x54742b[_0x999e('0x3c')]));if(_0x5c9439[_0x999e('0x3a')][_0x999e('0x46')]){_0x40d407[_0x999e('0x45')]=_['merge'](_0x40d407['where'],{'$or':_[_0x999e('0x56')](_0x40d407[_0x999e('0x40')],function(_0x34e2be){var _0x283d61={};_0x283d61[_0x34e2be]={'$like':'%'+_0x5c9439[_0x999e('0x3a')][_0x999e('0x46')]+'%'};return _0x283d61;})});}_0x40d407=_[_0x999e('0x47')]({},_0x40d407,_0x5c9439[_0x999e('0x48')]);return _0x389520['getDescriptions'](_0x40d407);}})[_0x999e('0x1f')](function(_0xaed39c){if(_0xaed39c){_0x1a53c9=_0xaed39c[_0x999e('0x41')];if(!_0x5c9439[_0x999e('0x3a')][_0x999e('0x59')](_0x999e('0x42'))){_0x40d407[_0x999e('0x2e')]=qs[_0x999e('0x2e')](_0x5c9439['query'][_0x999e('0x2e')]);_0x40d407[_0x999e('0x2d')]=qs[_0x999e('0x2d')](_0x5c9439[_0x999e('0x3a')][_0x999e('0x2d')]);}return _0x389520[_0x999e('0x5a')](_0x40d407);}})[_0x999e('0x1f')](function(_0x360ce9){if(_0x360ce9){return _0x360ce9?{'count':_0x1a53c9,'rows':_0x360ce9}:null;}})['then'](respondWithResult(_0x2405f5,null))[_0x999e('0x27')](handleError(_0x2405f5,null));};exports[_0x999e('0x5b')]=function(_0x34d75e,_0x4b0d85,_0x2b036d){var _0x3edea2={};var _0x3b5b20={};var _0x2cd575;var _0x35fcd5;return db[_0x999e('0x49')][_0x999e('0x53')]({'where':{'id':_0x34d75e[_0x999e('0x52')]['id']}})[_0x999e('0x1f')](handleEntityNotFound(_0x4b0d85,null))['then'](function(_0xbd2dac){if(_0xbd2dac){_0x2cd575=_0xbd2dac;_0x3b5b20[_0x999e('0x3e')]=_[_0x999e('0x3b')](db['Tag']['rawAttributes']);_0x3b5b20[_0x999e('0x3a')]=_[_0x999e('0x3b')](_0x34d75e[_0x999e('0x3a')]);_0x3b5b20['filters']=_[_0x999e('0x3d')](_0x3b5b20[_0x999e('0x3e')],_0x3b5b20[_0x999e('0x3a')]);_0x3edea2['attributes']=_[_0x999e('0x3d')](_0x3b5b20[_0x999e('0x3e')],qs['fields'](_0x34d75e[_0x999e('0x3a')]['fields']));_0x3edea2['attributes']=_0x3edea2[_0x999e('0x40')][_0x999e('0x41')]?_0x3edea2[_0x999e('0x40')]:_0x3b5b20[_0x999e('0x3e')];_0x3edea2['order']=qs[_0x999e('0x44')](_0x34d75e[_0x999e('0x3a')][_0x999e('0x44')]);_0x3edea2[_0x999e('0x45')]=qs[_0x999e('0x3c')](_['pick'](_0x34d75e[_0x999e('0x3a')],_0x3b5b20[_0x999e('0x3c')]));if(_0x34d75e[_0x999e('0x3a')]['filter']){_0x3edea2[_0x999e('0x45')]=_[_0x999e('0x47')](_0x3edea2[_0x999e('0x45')],{'$or':_[_0x999e('0x56')](_0x3edea2[_0x999e('0x40')],function(_0x1b6cfd){var _0x1d885d={};_0x1d885d[_0x1b6cfd]={'$like':'%'+_0x34d75e[_0x999e('0x3a')]['filter']+'%'};return _0x1d885d;})});}_0x3edea2=_[_0x999e('0x47')]({},_0x3edea2,_0x34d75e[_0x999e('0x48')]);return _0x2cd575[_0x999e('0x5b')](_0x3edea2);}})[_0x999e('0x1f')](function(_0x4787d3){if(_0x4787d3){_0x35fcd5=_0x4787d3[_0x999e('0x41')];if(!_0x34d75e[_0x999e('0x3a')][_0x999e('0x59')](_0x999e('0x42'))){_0x3edea2[_0x999e('0x2e')]=qs['limit'](_0x34d75e[_0x999e('0x3a')][_0x999e('0x2e')]);_0x3edea2[_0x999e('0x2d')]=qs[_0x999e('0x2d')](_0x34d75e[_0x999e('0x3a')][_0x999e('0x2d')]);}return _0x2cd575['getTags'](_0x3edea2);}})['then'](function(_0x2b2368){if(_0x2b2368){return _0x2b2368?{'count':_0x35fcd5,'rows':_0x2b2368}:null;}})[_0x999e('0x1f')](respondWithResult(_0x4b0d85,null))['catch'](handleError(_0x4b0d85,null));};exports[_0x999e('0x5c')]=function(_0x346afc,_0x593111,_0x413c81){if(_0x346afc[_0x999e('0x51')]['id']){delete _0x346afc[_0x999e('0x51')]['id'];}return db[_0x999e('0x49')][_0x999e('0x53')]({'where':{'id':_0x346afc['params']['id']}})[_0x999e('0x1f')](handleEntityNotFound(_0x593111,null))[_0x999e('0x1f')](function(_0x2e86ac){if(_0x2e86ac){return _0x2e86ac[_0x999e('0x5c')](_0x346afc[_0x999e('0x51')][_0x999e('0x5d')]||[]);}return null;})[_0x999e('0x1f')](respondWithResult(_0x593111,null))['catch'](handleError(_0x593111,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 6e8e7c5..2f528a2 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 _0x5064=['api','moment','bluebird','path','rimraf','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger'];(function(_0x384295,_0x1f5064){var _0x39e77f=function(_0x113344){while(--_0x113344){_0x384295['push'](_0x384295['shift']());}};_0x39e77f(++_0x1f5064);}(_0x5064,0xa5));var _0x4506=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5064[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x4506('0x0'));var util=require(_0x4506('0x1'));var logger=require(_0x4506('0x2'))(_0x4506('0x3'));var moment=require(_0x4506('0x4'));var BPromise=require(_0x4506('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4506('0x6'));var rimraf=require(_0x4506('0x7'));var config=require('../../config/environment');var attributes=require(_0x4506('0x8'));module[_0x4506('0x9')]=function(_0x4df31f,_0x4534c1){return _0x4df31f['define'](_0x4506('0xa'),attributes,{'tableName':_0x4506('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36a7=['exports','define','DeskConfiguration','int_desk_configurations','../../config/logger','api','moment','request-promise','path','rimraf','./intDeskConfiguration.attributes'];(function(_0x4f9ea8,_0x12d448){var _0x35baef=function(_0x33593d){while(--_0x33593d){_0x4f9ea8['push'](_0x4f9ea8['shift']());}};_0x35baef(++_0x12d448);}(_0x36a7,0x138));var _0x736a=function(_0x331f4e,_0x1a3ea4){_0x331f4e=_0x331f4e-0x0;var _0x50fa46=_0x36a7[_0x331f4e];return _0x50fa46;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x736a('0x0'))(_0x736a('0x1'));var moment=require(_0x736a('0x2'));var BPromise=require('bluebird');var rp=require(_0x736a('0x3'));var fs=require('fs');var path=require(_0x736a('0x4'));var rimraf=require(_0x736a('0x5'));var config=require('../../config/environment');var attributes=require(_0x736a('0x6'));module[_0x736a('0x7')]=function(_0x5b9808,_0x2b19fc){return _0x5b9808[_0x736a('0x8')](_0x736a('0x9'),attributes,{'tableName':_0x736a('0xa'),'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 7293714..9227683 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 _0x9bb4=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9bb4,0xd5));var _0x49bb=function(_0x128f02,_0x3183d3){_0x128f02=_0x128f02-0x0;var _0x3869c1=_0x9bb4[_0x128f02];return _0x3869c1;};'use strict';var _=require(_0x49bb('0x0'));var util=require(_0x49bb('0x1'));var moment=require(_0x49bb('0x2'));var BPromise=require(_0x49bb('0x3'));var rs=require(_0x49bb('0x4'));var fs=require('fs');var Redis=require(_0x49bb('0x5'));var db=require(_0x49bb('0x6'))['db'];var utils=require(_0x49bb('0x7'));var logger=require(_0x49bb('0x8'))('rpc');var config=require(_0x49bb('0x9'));var jayson=require(_0x49bb('0xa'));var client=jayson[_0x49bb('0xb')][_0x49bb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d603d,_0x15c24c,_0x353853){return new BPromise(function(_0x1a4094,_0x2967d4){return client[_0x49bb('0xd')](_0x4d603d,_0x353853)['then'](function(_0x6ba4a2){logger['info'](_0x49bb('0xe'),_0x15c24c,_0x49bb('0xf'));logger['debug'](_0x49bb('0x10'),_0x15c24c,'request\x20sent',JSON['stringify'](_0x6ba4a2));if(_0x6ba4a2[_0x49bb('0x11')]){if(_0x6ba4a2['error'][_0x49bb('0x12')]===0x1f4){logger[_0x49bb('0x11')](_0x49bb('0xe'),_0x15c24c,_0x6ba4a2[_0x49bb('0x11')][_0x49bb('0x13')]);return _0x2967d4(_0x6ba4a2[_0x49bb('0x11')][_0x49bb('0x13')]);}logger[_0x49bb('0x11')](_0x49bb('0xe'),_0x15c24c,_0x6ba4a2['error'][_0x49bb('0x13')]);return _0x1a4094(_0x6ba4a2['error'][_0x49bb('0x13')]);}else{logger[_0x49bb('0x14')](_0x49bb('0xe'),_0x15c24c,_0x49bb('0xf'));_0x1a4094(_0x6ba4a2[_0x49bb('0x15')][_0x49bb('0x13')]);}})[_0x49bb('0x16')](function(_0x11bc5f){logger['error'](_0x49bb('0xe'),_0x15c24c,_0x11bc5f);_0x2967d4(_0x11bc5f);});});} \ No newline at end of file +var _0x0713=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\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(_0x462f62,_0x48db92){var _0x5724e5=function(_0x223639){while(--_0x223639){_0x462f62['push'](_0x462f62['shift']());}};_0x5724e5(++_0x48db92);}(_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')]('DeskConfiguration,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('DeskConfiguration,\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')]('DeskConfiguration,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 2fdd860..7414469 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 _0x13ca=['./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','Router'];(function(_0x399552,_0x498cb1){var _0x236cfd=function(_0x2f4a9b){while(--_0x2f4a9b){_0x399552['push'](_0x399552['shift']());}};_0x236cfd(++_0x498cb1);}(_0x13ca,0x1bc));var _0xa13c=function(_0x14de14,_0xf2445e){_0x14de14=_0x14de14-0x0;var _0x150dd5=_0x13ca[_0x14de14];return _0x150dd5;};'use strict';var multer=require(_0xa13c('0x0'));var util=require('util');var path=require(_0xa13c('0x1'));var timeout=require(_0xa13c('0x2'));var express=require('express');var router=express[_0xa13c('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa13c('0x4'));router[_0xa13c('0x5')]('/',auth[_0xa13c('0x6')](),controller[_0xa13c('0x7')]);router[_0xa13c('0x5')](_0xa13c('0x8'),auth[_0xa13c('0x6')](),controller[_0xa13c('0x9')]);router[_0xa13c('0xa')]('/',auth[_0xa13c('0x6')](),controller[_0xa13c('0xb')]);router[_0xa13c('0xc')](_0xa13c('0x8'),auth[_0xa13c('0x6')](),controller[_0xa13c('0xd')]);router[_0xa13c('0xe')](_0xa13c('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xa13c('0xf')]=router; \ No newline at end of file +var _0x8016=['get','index','isAuthenticated','show','post','/:id','update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller'];(function(_0x5d7ff0,_0x39a2a7){var _0x31cf71=function(_0x14a802){while(--_0x14a802){_0x5d7ff0['push'](_0x5d7ff0['shift']());}};_0x31cf71(++_0x39a2a7);}(_0x8016,0x70));var _0x6801=function(_0x3e27ba,_0x46b120){_0x3e27ba=_0x3e27ba-0x0;var _0x10b3f2=_0x8016[_0x3e27ba];return _0x10b3f2;};'use strict';var multer=require('multer');var util=require(_0x6801('0x0'));var path=require(_0x6801('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6801('0x2')]();var auth=require(_0x6801('0x3'));var interaction=require(_0x6801('0x4'));var config=require(_0x6801('0x5'));var controller=require(_0x6801('0x6'));router[_0x6801('0x7')]('/',auth['isAuthenticated'](),controller[_0x6801('0x8')]);router['get']('/:id',auth[_0x6801('0x9')](),controller[_0x6801('0xa')]);router[_0x6801('0xb')]('/',auth[_0x6801('0x9')](),controller['create']);router['put'](_0x6801('0xc'),auth[_0x6801('0x9')](),controller[_0x6801('0xd')]);router[_0x6801('0xe')](_0x6801('0xc'),auth[_0x6801('0x9')](),controller[_0x6801('0xf')]);module[_0x6801('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index c0bde96..3ef65ba 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 _0xf94a=['BOOLEAN','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x189da6,_0x5d2378){var _0x259e67=function(_0x5e8c95){while(--_0x5e8c95){_0x189da6['push'](_0x189da6['shift']());}};_0x259e67(++_0x5d2378);}(_0xf94a,0x1c1));var _0xaf94=function(_0x279897,_0x568eea){_0x279897=_0x279897-0x0;var _0x5997ac=_0xf94a[_0x279897];return _0x5997ac;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xaf94('0x0')](_0xaf94('0x1'),_0xaf94('0x2'),_0xaf94('0x3'),_0xaf94('0x4')),'defaultValue':_0xaf94('0x1')},'content':{'type':Sequelize[_0xaf94('0x5')]},'key':{'type':Sequelize[_0xaf94('0x5')]},'keyType':{'type':Sequelize[_0xaf94('0x0')](_0xaf94('0x1'),_0xaf94('0x2'),_0xaf94('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xaf94('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xaf94('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaf94('0x5')]}}; \ No newline at end of file +var _0xef48=['customVariable','keyValue','STRING','sequelize','ENUM','string','variable'];(function(_0x54b301,_0x3c7d79){var _0x30a7a8=function(_0x43d742){while(--_0x43d742){_0x54b301['push'](_0x54b301['shift']());}};_0x30a7a8(++_0x3c7d79);}(_0xef48,0x184));var _0x8ef4=function(_0x50afc8,_0x534c32){_0x50afc8=_0x50afc8-0x0;var _0x1d56cd=_0xef48[_0x50afc8];return _0x1d56cd;};'use strict';var Sequelize=require(_0x8ef4('0x0'));module['exports']={'type':{'type':Sequelize[_0x8ef4('0x1')](_0x8ef4('0x2'),_0x8ef4('0x3'),_0x8ef4('0x4'),_0x8ef4('0x5')),'defaultValue':_0x8ef4('0x2')},'content':{'type':Sequelize[_0x8ef4('0x6')]},'key':{'type':Sequelize[_0x8ef4('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x8ef4('0x2'),_0x8ef4('0x3'),_0x8ef4('0x4'))},'keyContent':{'type':Sequelize[_0x8ef4('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8ef4('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8ef4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 60820d2..124e788 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 _0x1dc8=['create','body','find','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params'];(function(_0x22abc4,_0x289b22){var _0x500358=function(_0x5d98de){while(--_0x5d98de){_0x22abc4['push'](_0x22abc4['shift']());}};_0x500358(++_0x289b22);}(_0x1dc8,0xe1));var _0x81dc=function(_0xb2100,_0x564756){_0xb2100=_0xb2100-0x0;var _0x1e0748=_0x1dc8[_0xb2100];return _0x1e0748;};'use strict';var pdf=require(_0x81dc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x81dc('0x1'));var jsonpatch=require(_0x81dc('0x2'));var rp=require(_0x81dc('0x3'));var moment=require('moment');var BPromise=require(_0x81dc('0x4'));var Mustache=require(_0x81dc('0x5'));var util=require('util');var path=require(_0x81dc('0x6'));var sox=require(_0x81dc('0x7'));var csv=require(_0x81dc('0x8'));var ejs=require(_0x81dc('0x9'));var fs=require('fs');var _=require(_0x81dc('0xa'));var squel=require(_0x81dc('0xb'));var crypto=require('crypto');var jsforce=require(_0x81dc('0xc'));var deskjs=require(_0x81dc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x81dc('0xe'));var Papa=require(_0x81dc('0xf'));var Redis=require('ioredis');var authService=require(_0x81dc('0x10'));var qs=require(_0x81dc('0x11'));var as=require(_0x81dc('0x12'));var hardwareService=require(_0x81dc('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x81dc('0x14'));var db=require(_0x81dc('0x15'))['db'];function respondWithStatusCode(_0x2980c7,_0x2d0588){_0x2d0588=_0x2d0588||0xcc;return function(_0x188b37){if(_0x188b37){return _0x2980c7[_0x81dc('0x16')](_0x2d0588);}return _0x2980c7[_0x81dc('0x17')](_0x2d0588)[_0x81dc('0x18')]();};}function respondWithResult(_0x1f46d6,_0x439c34){_0x439c34=_0x439c34||0xc8;return function(_0x1cc8d2){if(_0x1cc8d2){return _0x1f46d6[_0x81dc('0x17')](_0x439c34)[_0x81dc('0x19')](_0x1cc8d2);}};}function respondWithFilteredResult(_0xbe1c78,_0x3754d5){return function(_0x175586){if(_0x175586){var _0x34344c=_0x175586[_0x81dc('0x1a')],_0x4faf4f=_0x3754d5[_0x81dc('0x1b')],_0x3bab0e=_0x3754d5['offset']+_0x3754d5[_0x81dc('0x1c')],_0x5c1cb7;if(_0x3bab0e>=_0x34344c){_0x3bab0e=_0x34344c;_0x5c1cb7=0xc8;}else{_0x5c1cb7=0xce;}_0xbe1c78[_0x81dc('0x17')](_0x5c1cb7);return _0xbe1c78[_0x81dc('0x1d')](_0x81dc('0x1e'),_0x4faf4f+'-'+_0x3bab0e+'/'+_0x34344c)[_0x81dc('0x19')](_0x175586);}return null;};}function patchUpdates(_0x1fd263){return function(_0x35fc32){try{jsonpatch[_0x81dc('0x1f')](_0x35fc32,_0x1fd263,!![]);}catch(_0x53819f){return BPromise[_0x81dc('0x20')](_0x53819f);}return _0x35fc32[_0x81dc('0x21')]();};}function saveUpdates(_0x54ccee,_0x4803f6){return function(_0x41d49c){if(_0x41d49c){return _0x41d49c[_0x81dc('0x22')](_0x54ccee)[_0x81dc('0x23')](function(_0xf79644){return _0xf79644;});}return null;};}function removeEntity(_0x45237e,_0x17dff0){return function(_0x51fe78){if(_0x51fe78){return _0x51fe78[_0x81dc('0x24')]()[_0x81dc('0x23')](function(){_0x45237e[_0x81dc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ab048,_0x4c5bd0){return function(_0x42ece7){if(!_0x42ece7){_0x3ab048[_0x81dc('0x16')](0x194);}return _0x42ece7;};}function handleError(_0x5b916f,_0x257120){_0x257120=_0x257120||0x1f4;return function(_0x4c84fd){logger[_0x81dc('0x25')](_0x4c84fd[_0x81dc('0x26')]);if(_0x4c84fd[_0x81dc('0x27')]){delete _0x4c84fd['name'];}_0x5b916f['status'](_0x257120)[_0x81dc('0x28')](_0x4c84fd);};}exports[_0x81dc('0x29')]=function(_0x58cc54,_0x5bd8be){var _0xe6f4df={},_0x440cb2={},_0x1a8381={'count':0x0,'rows':[]};var _0x50c48e=_[_0x81dc('0x2a')](db[_0x81dc('0x2b')][_0x81dc('0x2c')],function(_0x71116d){return{'name':_0x71116d[_0x81dc('0x2d')],'type':_0x71116d['type'][_0x81dc('0x2e')]};});_0x440cb2[_0x81dc('0x2f')]=_[_0x81dc('0x2a')](_0x50c48e,'name');_0x440cb2['query']=_[_0x81dc('0x30')](_0x58cc54['query']);_0x440cb2[_0x81dc('0x31')]=_[_0x81dc('0x32')](_0x440cb2[_0x81dc('0x2f')],_0x440cb2[_0x81dc('0x33')]);_0xe6f4df[_0x81dc('0x34')]=_[_0x81dc('0x32')](_0x440cb2[_0x81dc('0x2f')],qs[_0x81dc('0x35')](_0x58cc54[_0x81dc('0x33')][_0x81dc('0x35')]));_0xe6f4df[_0x81dc('0x34')]=_0xe6f4df[_0x81dc('0x34')][_0x81dc('0x36')]?_0xe6f4df['attributes']:_0x440cb2['model'];if(!_0x58cc54[_0x81dc('0x33')][_0x81dc('0x37')](_0x81dc('0x38'))){_0xe6f4df[_0x81dc('0x1c')]=qs['limit'](_0x58cc54[_0x81dc('0x33')][_0x81dc('0x1c')]);_0xe6f4df[_0x81dc('0x1b')]=qs[_0x81dc('0x1b')](_0x58cc54[_0x81dc('0x33')][_0x81dc('0x1b')]);}_0xe6f4df[_0x81dc('0x39')]=qs['sort'](_0x58cc54[_0x81dc('0x33')][_0x81dc('0x3a')]);_0xe6f4df[_0x81dc('0x3b')]=qs[_0x81dc('0x31')](_[_0x81dc('0x3c')](_0x58cc54[_0x81dc('0x33')],_0x440cb2[_0x81dc('0x31')]),_0x50c48e);if(_0x58cc54[_0x81dc('0x33')][_0x81dc('0x3d')]){_0xe6f4df[_0x81dc('0x3b')]=_['merge'](_0xe6f4df[_0x81dc('0x3b')],{'$or':_[_0x81dc('0x2a')](_0x50c48e,function(_0x51f476){if(_0x51f476['type']!==_0x81dc('0x3e')){var _0x1885f9={};_0x1885f9[_0x51f476[_0x81dc('0x27')]]={'$like':'%'+_0x58cc54[_0x81dc('0x33')][_0x81dc('0x3d')]+'%'};return _0x1885f9;}})});}_0xe6f4df=_[_0x81dc('0x3f')]({},_0xe6f4df,_0x58cc54[_0x81dc('0x40')]);var _0x4457e4={'where':_0xe6f4df[_0x81dc('0x3b')]};return db[_0x81dc('0x2b')][_0x81dc('0x1a')](_0x4457e4)[_0x81dc('0x23')](function(_0x1a5fc8){_0x1a8381[_0x81dc('0x1a')]=_0x1a5fc8;if(_0x58cc54[_0x81dc('0x33')][_0x81dc('0x41')]){_0xe6f4df[_0x81dc('0x42')]=[{'all':!![]}];}return db[_0x81dc('0x2b')][_0x81dc('0x43')](_0xe6f4df);})[_0x81dc('0x23')](function(_0x169916){_0x1a8381[_0x81dc('0x44')]=_0x169916;return _0x1a8381;})[_0x81dc('0x23')](respondWithFilteredResult(_0x5bd8be,_0xe6f4df))[_0x81dc('0x45')](handleError(_0x5bd8be,null));};exports['show']=function(_0x1cbe04,_0x594586){var _0xeb29f0={'raw':!![],'where':{'id':_0x1cbe04[_0x81dc('0x46')]['id']}},_0x1e0b73={};_0x1e0b73[_0x81dc('0x2f')]=_[_0x81dc('0x30')](db[_0x81dc('0x2b')][_0x81dc('0x2c')]);_0x1e0b73[_0x81dc('0x33')]=_[_0x81dc('0x30')](_0x1cbe04['query']);_0x1e0b73[_0x81dc('0x31')]=_['intersection'](_0x1e0b73[_0x81dc('0x2f')],_0x1e0b73[_0x81dc('0x33')]);_0xeb29f0['attributes']=_[_0x81dc('0x32')](_0x1e0b73[_0x81dc('0x2f')],qs[_0x81dc('0x35')](_0x1cbe04['query'][_0x81dc('0x35')]));_0xeb29f0[_0x81dc('0x34')]=_0xeb29f0['attributes']['length']?_0xeb29f0[_0x81dc('0x34')]:_0x1e0b73[_0x81dc('0x2f')];if(_0x1cbe04[_0x81dc('0x33')]['includeAll']){_0xeb29f0[_0x81dc('0x42')]=[{'all':!![]}];}_0xeb29f0=_['merge']({},_0xeb29f0,_0x1cbe04[_0x81dc('0x40')]);return db[_0x81dc('0x2b')]['find'](_0xeb29f0)[_0x81dc('0x23')](handleEntityNotFound(_0x594586,null))['then'](respondWithResult(_0x594586,null))[_0x81dc('0x45')](handleError(_0x594586,null));};exports[_0x81dc('0x47')]=function(_0x364ce6,_0x769d2c){return db['DeskField']['create'](_0x364ce6[_0x81dc('0x48')],{})[_0x81dc('0x23')](respondWithResult(_0x769d2c,0xc9))[_0x81dc('0x45')](handleError(_0x769d2c,null));};exports[_0x81dc('0x22')]=function(_0x5cbf2d,_0x446d77){if(_0x5cbf2d[_0x81dc('0x48')]['id']){delete _0x5cbf2d['body']['id'];}return db[_0x81dc('0x2b')][_0x81dc('0x49')]({'where':{'id':_0x5cbf2d[_0x81dc('0x46')]['id']}})['then'](handleEntityNotFound(_0x446d77,null))[_0x81dc('0x23')](saveUpdates(_0x5cbf2d['body'],null))[_0x81dc('0x23')](respondWithResult(_0x446d77,null))[_0x81dc('0x45')](handleError(_0x446d77,null));};exports[_0x81dc('0x24')]=function(_0x2e08ab,_0x2d6085){return db[_0x81dc('0x2b')][_0x81dc('0x49')]({'where':{'id':_0x2e08ab[_0x81dc('0x46')]['id']}})[_0x81dc('0x23')](handleEntityNotFound(_0x2d6085,null))[_0x81dc('0x23')](removeEntity(_0x2d6085,null))['catch'](handleError(_0x2d6085,null));}; \ No newline at end of file +var _0x1928=['moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','send','map','DeskField','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1928,0x1ab));var _0x8192=function(_0x4f1cd3,_0x354c89){_0x4f1cd3=_0x4f1cd3-0x0;var _0x1d671c=_0x1928[_0x4f1cd3];return _0x1d671c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8192('0x0'));var rimraf=require(_0x8192('0x1'));var zipdir=require(_0x8192('0x2'));var jsonpatch=require(_0x8192('0x3'));var rp=require(_0x8192('0x4'));var moment=require(_0x8192('0x5'));var BPromise=require(_0x8192('0x6'));var Mustache=require(_0x8192('0x7'));var util=require(_0x8192('0x8'));var path=require(_0x8192('0x9'));var sox=require(_0x8192('0xa'));var csv=require(_0x8192('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8192('0xc'));var squel=require(_0x8192('0xd'));var crypto=require(_0x8192('0xe'));var jsforce=require(_0x8192('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8192('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8192('0x11'));var as=require(_0x8192('0x12'));var hardwareService=require(_0x8192('0x13'));var logger=require(_0x8192('0x14'))(_0x8192('0x15'));var utils=require(_0x8192('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5aedaa,_0xcb204e){_0xcb204e=_0xcb204e||0xcc;return function(_0x275d){if(_0x275d){return _0x5aedaa[_0x8192('0x17')](_0xcb204e);}return _0x5aedaa[_0x8192('0x18')](_0xcb204e)[_0x8192('0x19')]();};}function respondWithResult(_0x599202,_0x190c32){_0x190c32=_0x190c32||0xc8;return function(_0x40e83b){if(_0x40e83b){return _0x599202['status'](_0x190c32)[_0x8192('0x1a')](_0x40e83b);}};}function respondWithFilteredResult(_0x2a181e,_0x1f3261){return function(_0x378e1d){if(_0x378e1d){var _0x11db8d=_0x378e1d[_0x8192('0x1b')],_0x41f602=_0x1f3261[_0x8192('0x1c')],_0x1c9926=_0x1f3261[_0x8192('0x1c')]+_0x1f3261[_0x8192('0x1d')],_0x598b1d;if(_0x1c9926>=_0x11db8d){_0x1c9926=_0x11db8d;_0x598b1d=0xc8;}else{_0x598b1d=0xce;}_0x2a181e[_0x8192('0x18')](_0x598b1d);return _0x2a181e[_0x8192('0x1e')]('Content-Range',_0x41f602+'-'+_0x1c9926+'/'+_0x11db8d)['json'](_0x378e1d);}return null;};}function patchUpdates(_0x29aa0b){return function(_0x5d7047){try{jsonpatch[_0x8192('0x1f')](_0x5d7047,_0x29aa0b,!![]);}catch(_0x513ad3){return BPromise[_0x8192('0x20')](_0x513ad3);}return _0x5d7047['save']();};}function saveUpdates(_0x4c199e,_0x49cc84){return function(_0x241ef5){if(_0x241ef5){return _0x241ef5[_0x8192('0x21')](_0x4c199e)[_0x8192('0x22')](function(_0x444312){return _0x444312;});}return null;};}function removeEntity(_0x41ae50,_0x44c03a){return function(_0x51b5e4){if(_0x51b5e4){return _0x51b5e4[_0x8192('0x23')]()[_0x8192('0x22')](function(){_0x41ae50['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x197b5c,_0x491e51){return function(_0x1ea6f8){if(!_0x1ea6f8){_0x197b5c[_0x8192('0x17')](0x194);}return _0x1ea6f8;};}function handleError(_0x56b037,_0x2a291a){_0x2a291a=_0x2a291a||0x1f4;return function(_0xe60f43){logger[_0x8192('0x24')](_0xe60f43[_0x8192('0x25')]);if(_0xe60f43['name']){delete _0xe60f43[_0x8192('0x26')];}_0x56b037['status'](_0x2a291a)[_0x8192('0x27')](_0xe60f43);};}exports['index']=function(_0x47f632,_0x31066a){var _0xa97b5d={},_0x12f08c={},_0xe52f9f={'count':0x0,'rows':[]};var _0x4a3628=_[_0x8192('0x28')](db[_0x8192('0x29')][_0x8192('0x2a')],function(_0x1576cd){return{'name':_0x1576cd[_0x8192('0x2b')],'type':_0x1576cd[_0x8192('0x2c')]['key']};});_0x12f08c[_0x8192('0x2d')]=_[_0x8192('0x28')](_0x4a3628,_0x8192('0x26'));_0x12f08c['query']=_[_0x8192('0x2e')](_0x47f632[_0x8192('0x2f')]);_0x12f08c['filters']=_[_0x8192('0x30')](_0x12f08c[_0x8192('0x2d')],_0x12f08c[_0x8192('0x2f')]);_0xa97b5d[_0x8192('0x31')]=_[_0x8192('0x30')](_0x12f08c[_0x8192('0x2d')],qs[_0x8192('0x32')](_0x47f632[_0x8192('0x2f')]['fields']));_0xa97b5d[_0x8192('0x31')]=_0xa97b5d[_0x8192('0x31')]['length']?_0xa97b5d[_0x8192('0x31')]:_0x12f08c[_0x8192('0x2d')];if(!_0x47f632[_0x8192('0x2f')][_0x8192('0x33')](_0x8192('0x34'))){_0xa97b5d['limit']=qs[_0x8192('0x1d')](_0x47f632['query'][_0x8192('0x1d')]);_0xa97b5d[_0x8192('0x1c')]=qs['offset'](_0x47f632['query'][_0x8192('0x1c')]);}_0xa97b5d[_0x8192('0x35')]=qs[_0x8192('0x36')](_0x47f632[_0x8192('0x2f')][_0x8192('0x36')]);_0xa97b5d[_0x8192('0x37')]=qs['filters'](_[_0x8192('0x38')](_0x47f632[_0x8192('0x2f')],_0x12f08c[_0x8192('0x39')]),_0x4a3628);if(_0x47f632[_0x8192('0x2f')][_0x8192('0x3a')]){_0xa97b5d[_0x8192('0x37')]=_['merge'](_0xa97b5d[_0x8192('0x37')],{'$or':_['map'](_0x4a3628,function(_0x4a44e8){if(_0x4a44e8[_0x8192('0x2c')]!==_0x8192('0x3b')){var _0x962a4a={};_0x962a4a[_0x4a44e8[_0x8192('0x26')]]={'$like':'%'+_0x47f632[_0x8192('0x2f')][_0x8192('0x3a')]+'%'};return _0x962a4a;}})});}_0xa97b5d=_[_0x8192('0x3c')]({},_0xa97b5d,_0x47f632[_0x8192('0x3d')]);var _0x9f83d1={'where':_0xa97b5d[_0x8192('0x37')]};return db[_0x8192('0x29')][_0x8192('0x1b')](_0x9f83d1)[_0x8192('0x22')](function(_0x5b5b47){_0xe52f9f[_0x8192('0x1b')]=_0x5b5b47;if(_0x47f632[_0x8192('0x2f')][_0x8192('0x3e')]){_0xa97b5d['include']=[{'all':!![]}];}return db[_0x8192('0x29')][_0x8192('0x3f')](_0xa97b5d);})[_0x8192('0x22')](function(_0xf3e012){_0xe52f9f['rows']=_0xf3e012;return _0xe52f9f;})[_0x8192('0x22')](respondWithFilteredResult(_0x31066a,_0xa97b5d))[_0x8192('0x40')](handleError(_0x31066a,null));};exports[_0x8192('0x41')]=function(_0x135415,_0x2c2204){var _0x55024e={'raw':!![],'where':{'id':_0x135415[_0x8192('0x42')]['id']}},_0x5430d0={};_0x5430d0[_0x8192('0x2d')]=_[_0x8192('0x2e')](db['DeskField']['rawAttributes']);_0x5430d0[_0x8192('0x2f')]=_[_0x8192('0x2e')](_0x135415[_0x8192('0x2f')]);_0x5430d0[_0x8192('0x39')]=_['intersection'](_0x5430d0['model'],_0x5430d0[_0x8192('0x2f')]);_0x55024e[_0x8192('0x31')]=_[_0x8192('0x30')](_0x5430d0[_0x8192('0x2d')],qs[_0x8192('0x32')](_0x135415[_0x8192('0x2f')][_0x8192('0x32')]));_0x55024e[_0x8192('0x31')]=_0x55024e['attributes'][_0x8192('0x43')]?_0x55024e[_0x8192('0x31')]:_0x5430d0[_0x8192('0x2d')];if(_0x135415[_0x8192('0x2f')][_0x8192('0x3e')]){_0x55024e[_0x8192('0x44')]=[{'all':!![]}];}_0x55024e=_[_0x8192('0x3c')]({},_0x55024e,_0x135415['options']);return db[_0x8192('0x29')][_0x8192('0x45')](_0x55024e)[_0x8192('0x22')](handleEntityNotFound(_0x2c2204,null))['then'](respondWithResult(_0x2c2204,null))[_0x8192('0x40')](handleError(_0x2c2204,null));};exports[_0x8192('0x46')]=function(_0x16905d,_0x520c3d){return db[_0x8192('0x29')]['create'](_0x16905d[_0x8192('0x47')],{})['then'](respondWithResult(_0x520c3d,0xc9))[_0x8192('0x40')](handleError(_0x520c3d,null));};exports['update']=function(_0x118805,_0x439d73){if(_0x118805[_0x8192('0x47')]['id']){delete _0x118805[_0x8192('0x47')]['id'];}return db[_0x8192('0x29')][_0x8192('0x45')]({'where':{'id':_0x118805['params']['id']}})['then'](handleEntityNotFound(_0x439d73,null))[_0x8192('0x22')](saveUpdates(_0x118805['body'],null))[_0x8192('0x22')](respondWithResult(_0x439d73,null))['catch'](handleError(_0x439d73,null));};exports[_0x8192('0x23')]=function(_0x42fd58,_0xbf6188){return db['DeskField'][_0x8192('0x45')]({'where':{'id':_0x42fd58[_0x8192('0x42')]['id']}})['then'](handleEntityNotFound(_0xbf6188,null))[_0x8192('0x22')](removeEntity(_0xbf6188,null))['catch'](handleError(_0xbf6188,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 4e3b8d4..086bfa7 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 _0x4203=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','define','int_desk_fields','desk_unique_index','idField','FieldId','lodash'];(function(_0x480c83,_0x1f8665){var _0x3368e0=function(_0xfb83fd){while(--_0xfb83fd){_0x480c83['push'](_0x480c83['shift']());}};_0x3368e0(++_0x1f8665);}(_0x4203,0x178));var _0x3420=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x4203[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0x3420('0x0'));var util=require(_0x3420('0x1'));var logger=require('../../config/logger')(_0x3420('0x2'));var moment=require('moment');var BPromise=require(_0x3420('0x3'));var rp=require(_0x3420('0x4'));var fs=require('fs');var path=require(_0x3420('0x5'));var rimraf=require(_0x3420('0x6'));var config=require(_0x3420('0x7'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x279b3f,_0x2892e9){return _0x279b3f[_0x3420('0x8')]('DeskField',attributes,{'tableName':_0x3420('0x9'),'paranoid':![],'indexes':[{'name':_0x3420('0xa'),'fields':[_0x3420('0xb'),_0x3420('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb93a=['rimraf','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5223bf,_0x109da4){var _0x181da4=function(_0x5d7047){while(--_0x5d7047){_0x5223bf['push'](_0x5223bf['shift']());}};_0x181da4(++_0x109da4);}(_0xb93a,0x104));var _0xab93=function(_0x18d7cb,_0xe8fb8d){_0x18d7cb=_0x18d7cb-0x0;var _0x548013=_0xb93a[_0x18d7cb];return _0x548013;};'use strict';var _=require(_0xab93('0x0'));var util=require(_0xab93('0x1'));var logger=require(_0xab93('0x2'))(_0xab93('0x3'));var moment=require(_0xab93('0x4'));var BPromise=require('bluebird');var rp=require(_0xab93('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab93('0x6'));var config=require('../../config/environment');var attributes=require(_0xab93('0x7'));module[_0xab93('0x8')]=function(_0x1601f1,_0x191a45){return _0x1601f1[_0xab93('0x9')]('DeskField',attributes,{'tableName':_0xab93('0xa'),'paranoid':![],'indexes':[{'name':_0xab93('0xb'),'fields':[_0xab93('0xc'),_0xab93('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index e4ceecd..a7f14d3 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 _0x5539=['http','request','then','info','DeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x383da5,_0x4d042b){var _0x38343b=function(_0x36a6bb){while(--_0x36a6bb){_0x383da5['push'](_0x383da5['shift']());}};_0x38343b(++_0x4d042b);}(_0x5539,0x172));var _0x9553=function(_0x4a7bf7,_0x34ffcc){_0x4a7bf7=_0x4a7bf7-0x0;var _0xbbd36c=_0x5539[_0x4a7bf7];return _0xbbd36c;};'use strict';var _=require(_0x9553('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9553('0x1'));var rs=require(_0x9553('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9553('0x3'));var logger=require(_0x9553('0x4'))(_0x9553('0x5'));var config=require('../../config/environment');var jayson=require(_0x9553('0x6'));var client=jayson[_0x9553('0x7')][_0x9553('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd5ae6d,_0x153e3d,_0x119f5b){return new BPromise(function(_0x4ece13,_0x1af209){return client[_0x9553('0x9')](_0xd5ae6d,_0x119f5b)[_0x9553('0xa')](function(_0x45aadc){logger[_0x9553('0xb')](_0x9553('0xc'),_0x153e3d,'request\x20sent');logger[_0x9553('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x153e3d,'request\x20sent',JSON[_0x9553('0xe')](_0x45aadc));if(_0x45aadc[_0x9553('0xf')]){if(_0x45aadc[_0x9553('0xf')][_0x9553('0x10')]===0x1f4){logger[_0x9553('0xf')](_0x9553('0xc'),_0x153e3d,_0x45aadc[_0x9553('0xf')]['message']);return _0x1af209(_0x45aadc[_0x9553('0xf')][_0x9553('0x11')]);}logger['error'](_0x9553('0xc'),_0x153e3d,_0x45aadc[_0x9553('0xf')][_0x9553('0x11')]);return _0x4ece13(_0x45aadc[_0x9553('0xf')][_0x9553('0x11')]);}else{logger[_0x9553('0xb')](_0x9553('0xc'),_0x153e3d,_0x9553('0x12'));_0x4ece13(_0x45aadc[_0x9553('0x13')]['message']);}})[_0x9553('0x14')](function(_0x4c2e29){logger[_0x9553('0xf')](_0x9553('0xc'),_0x153e3d,_0x4c2e29);_0x1af209(_0x4c2e29);});});} \ No newline at end of file +var _0x77d9=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x2cfd2a,_0x426163){var _0x47d0d1=function(_0x25ea39){while(--_0x25ea39){_0x2cfd2a['push'](_0x2cfd2a['shift']());}};_0x47d0d1(++_0x426163);}(_0x77d9,0x1b7));var _0x977d=function(_0x406e9f,_0x49adee){_0x406e9f=_0x406e9f-0x0;var _0x500565=_0x77d9[_0x406e9f];return _0x500565;};'use strict';var _=require(_0x977d('0x0'));var util=require(_0x977d('0x1'));var moment=require(_0x977d('0x2'));var BPromise=require(_0x977d('0x3'));var rs=require(_0x977d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x977d('0x5'))['db'];var utils=require(_0x977d('0x6'));var logger=require('../../config/logger')(_0x977d('0x7'));var config=require(_0x977d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x977d('0x9')][_0x977d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x340552,_0x152a0b,_0x44c1b6){return new BPromise(function(_0x2c9aab,_0x5480f1){return client[_0x977d('0xb')](_0x340552,_0x44c1b6)[_0x977d('0xc')](function(_0x2fd537){logger['info'](_0x977d('0xd'),_0x152a0b,_0x977d('0xe'));logger['debug'](_0x977d('0xf'),_0x152a0b,_0x977d('0xe'),JSON[_0x977d('0x10')](_0x2fd537));if(_0x2fd537[_0x977d('0x11')]){if(_0x2fd537[_0x977d('0x11')][_0x977d('0x12')]===0x1f4){logger[_0x977d('0x11')](_0x977d('0xd'),_0x152a0b,_0x2fd537[_0x977d('0x11')][_0x977d('0x13')]);return _0x5480f1(_0x2fd537[_0x977d('0x11')]['message']);}logger[_0x977d('0x11')](_0x977d('0xd'),_0x152a0b,_0x2fd537['error'][_0x977d('0x13')]);return _0x2c9aab(_0x2fd537['error'][_0x977d('0x13')]);}else{logger[_0x977d('0x14')](_0x977d('0xd'),_0x152a0b,_0x977d('0xe'));_0x2c9aab(_0x2fd537[_0x977d('0x15')][_0x977d('0x13')]);}})[_0x977d('0x16')](function(_0x20906e){logger[_0x977d('0x11')](_0x977d('0xd'),_0x152a0b,_0x20906e);_0x5480f1(_0x20906e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 9d78624..09ec797 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 _0xf6e5=['../../config/environment','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xf6e5,0xa8));var _0x5f6e=function(_0x33fcba,_0x36cf87){_0x33fcba=_0x33fcba-0x0;var _0xfd2c1a=_0xf6e5[_0x33fcba];return _0xfd2c1a;};'use strict';var multer=require(_0x5f6e('0x0'));var util=require(_0x5f6e('0x1'));var path=require(_0x5f6e('0x2'));var timeout=require(_0x5f6e('0x3'));var express=require('express');var router=express[_0x5f6e('0x4')]();var auth=require(_0x5f6e('0x5'));var interaction=require(_0x5f6e('0x6'));var config=require(_0x5f6e('0x7'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0x5f6e('0x8')](),controller[_0x5f6e('0x9')]);router['get'](_0x5f6e('0xa'),auth[_0x5f6e('0x8')](),controller[_0x5f6e('0xb')]);router[_0x5f6e('0xc')](_0x5f6e('0xd'),auth['isAuthenticated'](),controller[_0x5f6e('0xe')]);router[_0x5f6e('0xc')](_0x5f6e('0xf'),auth[_0x5f6e('0x8')](),controller[_0x5f6e('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5f6e('0x11')]);router[_0x5f6e('0x12')](_0x5f6e('0xd'),auth[_0x5f6e('0x8')](),controller[_0x5f6e('0x13')]);router[_0x5f6e('0x14')](_0x5f6e('0xa'),auth[_0x5f6e('0x8')](),controller[_0x5f6e('0x15')]);router[_0x5f6e('0x16')](_0x5f6e('0xa'),auth['isAuthenticated'](),controller[_0x5f6e('0x17')]);module[_0x5f6e('0x18')]=router; \ No newline at end of file +var _0x5192=['get','/:id/fields','getFields','post','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','index','isAuthenticated','show','/:id/configurations'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0x5192,0x153));var _0x2519=function(_0x326393,_0x62ce5a){_0x326393=_0x326393-0x0;var _0x4037a2=_0x5192[_0x326393];return _0x4037a2;};'use strict';var multer=require(_0x2519('0x0'));var util=require(_0x2519('0x1'));var path=require(_0x2519('0x2'));var timeout=require(_0x2519('0x3'));var express=require(_0x2519('0x4'));var router=express['Router']();var auth=require(_0x2519('0x5'));var interaction=require(_0x2519('0x6'));var config=require(_0x2519('0x7'));var controller=require(_0x2519('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2519('0x9')]);router['get']('/:id',auth[_0x2519('0xa')](),controller[_0x2519('0xb')]);router['get'](_0x2519('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x2519('0xd')](_0x2519('0xe'),auth[_0x2519('0xa')](),controller[_0x2519('0xf')]);router[_0x2519('0x10')]('/',auth[_0x2519('0xa')](),controller['create']);router[_0x2519('0x10')](_0x2519('0xc'),auth[_0x2519('0xa')](),controller['addConfiguration']);router[_0x2519('0x11')](_0x2519('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x2519('0x13')](_0x2519('0x12'),auth['isAuthenticated'](),controller[_0x2519('0x14')]);module[_0x2519('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 7395ff6..f9f6f38 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 _0x9b32=['STRING','sequelize','exports'];(function(_0x302b5e,_0x564a8e){var _0x523ab7=function(_0x6aec8f){while(--_0x6aec8f){_0x302b5e['push'](_0x302b5e['shift']());}};_0x523ab7(++_0x564a8e);}(_0x9b32,0x1ab));var _0x29b3=function(_0x5a6f46,_0x193831){_0x5a6f46=_0x5a6f46-0x0;var _0x117532=_0x9b32[_0x5a6f46];return _0x117532;};'use strict';var Sequelize=require(_0x29b3('0x0'));module[_0x29b3('0x1')]={'name':{'type':Sequelize[_0x29b3('0x2')]},'username':{'type':Sequelize[_0x29b3('0x2')]},'password':{'type':Sequelize[_0x29b3('0x2')]},'remoteUri':{'type':Sequelize[_0x29b3('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x29b3('0x2')]},'serverUrl':{'type':Sequelize[_0x29b3('0x2')]},'description':{'type':Sequelize[_0x29b3('0x2')]}}; \ No newline at end of file +var _0xead0=['STRING','sequelize'];(function(_0x31c3d5,_0x40a38c){var _0x5424ba=function(_0x15b7fa){while(--_0x15b7fa){_0x31c3d5['push'](_0x31c3d5['shift']());}};_0x5424ba(++_0x40a38c);}(_0xead0,0x193));var _0x0ead=function(_0x456b77,_0x4fed12){_0x456b77=_0x456b77-0x0;var _0x118bb6=_0xead0[_0x456b77];return _0x118bb6;};'use strict';var Sequelize=require(_0x0ead('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0ead('0x1')]},'password':{'type':Sequelize[_0x0ead('0x1')]},'remoteUri':{'type':Sequelize[_0x0ead('0x1')]},'tenantId':{'type':Sequelize[_0x0ead('0x1')]},'clientId':{'type':Sequelize[_0x0ead('0x1')]},'clientSecret':{'type':Sequelize[_0x0ead('0x1')]},'serverUrl':{'type':Sequelize[_0x0ead('0x1')]},'description':{'type':Sequelize[_0x0ead('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index f6a18ab..e860041 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 _0x0d94=['status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','include','rows','show','length','includeAll','find','catch','create','body','params','getConfigurations','findOne','pick','merge','AccountId','channel','Descriptions','Dynamics365Configuration','Dynamics365Field','Subjects','getFields','incident','Incident','PhoneCall','title','description','customerid','ownerid','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','clientId','remoteUri','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','Wrong\x20credentials',')/Attributes(','4.0','Options','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','end'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x0d94,0xb5));var _0x40d9=function(_0x2754e2,_0x3279c9){_0x2754e2=_0x2754e2-0x0;var _0x1a40a0=_0x0d94[_0x2754e2];return _0x1a40a0;};'use strict';var pdf=require(_0x40d9('0x0'));var emlformat=require(_0x40d9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x40d9('0x2'));var jsonpatch=require(_0x40d9('0x3'));var rp=require('request-promise');var moment=require(_0x40d9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x40d9('0x5'));var path=require('path');var sox=require(_0x40d9('0x6'));var csv=require(_0x40d9('0x7'));var ejs=require(_0x40d9('0x8'));var fs=require('fs');var _=require(_0x40d9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x40d9('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x40d9('0x7'));var querystring=require(_0x40d9('0xb'));var Papa=require('papaparse');var Redis=require(_0x40d9('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x40d9('0xd'));var logger=require(_0x40d9('0xe'))(_0x40d9('0xf'));var utils=require(_0x40d9('0x10'));var config=require('../../config/environment');var db=require(_0x40d9('0x11'))['db'];var integrations=require(_0x40d9('0x12'));var jayson=require('jayson/promise');var client=jayson[_0x40d9('0x13')][_0x40d9('0x14')]({'port':0x232a});function checkPasswordPattern(_0x2f7ce6,_0x34eb65,_0x45758f){if(_0x45758f){var _0x16c7a8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16c7a8[_0x40d9('0x15')](_0x34eb65)){return _0x2f7ce6;}else{throw new db[(_0x40d9('0x16'))][(_0x40d9('0x17'))](_0x40d9('0x18'));}}else{return _0x2f7ce6;}}function respondWithRpcPromise(_0x3f8f78,_0x4f01b4,_0x4257bb,_0x2127ae){return new BPromise(function(_0x3e2afb,_0x30ec2e){var _0x2630f3=_0x2127ae||client;return _0x2630f3[_0x40d9('0x19')](_0x3f8f78,_0x4257bb)['then'](function(_0x95aef9){logger['info'](_0x40d9('0x1a'),_0x4f01b4,_0x40d9('0x1b'));logger[_0x40d9('0x1c')](_0x40d9('0x1d'),_0x4f01b4,_0x40d9('0x1b'),JSON[_0x40d9('0x1e')](_0x95aef9));if(_0x95aef9[_0x40d9('0x1f')]){if(_0x95aef9[_0x40d9('0x1f')][_0x40d9('0x20')]===0x1f4){logger['error'](_0x40d9('0x1a'),_0x4f01b4,_0x95aef9[_0x40d9('0x1f')][_0x40d9('0x21')]);return _0x30ec2e(_0x95aef9[_0x40d9('0x1f')][_0x40d9('0x21')]);}logger[_0x40d9('0x1f')](_0x40d9('0x1a'),_0x4f01b4,_0x95aef9[_0x40d9('0x1f')][_0x40d9('0x21')]);return _0x3e2afb(_0x95aef9[_0x40d9('0x1f')]['message']);}else{logger['info'](_0x40d9('0x1a'),_0x4f01b4,_0x40d9('0x1b'));_0x3e2afb(_0x95aef9[_0x40d9('0x22')][_0x40d9('0x21')]);}})['catch'](function(_0x4e8c14){logger[_0x40d9('0x1f')](_0x40d9('0x1a'),_0x4f01b4,_0x4e8c14);_0x30ec2e(_0x4e8c14);});});}function respondWithStatusCode(_0x53c239,_0x2279b7){_0x2279b7=_0x2279b7||0xcc;return function(_0x528b23){if(_0x528b23){return _0x53c239['sendStatus'](_0x2279b7);}return _0x53c239['status'](_0x2279b7)[_0x40d9('0x23')]();};}function respondWithResult(_0x5c0000,_0x1998e7){_0x1998e7=_0x1998e7||0xc8;return function(_0x54cdae){if(_0x54cdae){return _0x5c0000[_0x40d9('0x24')](_0x1998e7)[_0x40d9('0x25')](_0x54cdae);}};}function respondWithFilteredResult(_0x4c9eeb,_0x286d9f){return function(_0x1e1fcf){if(_0x1e1fcf){var _0x4cf8f7=_0x1e1fcf[_0x40d9('0x26')],_0x3a63d8=_0x286d9f[_0x40d9('0x27')],_0x37e9c1=_0x286d9f['offset']+_0x286d9f[_0x40d9('0x28')],_0x3fdb69;if(_0x37e9c1>=_0x4cf8f7){_0x37e9c1=_0x4cf8f7;_0x3fdb69=0xc8;}else{_0x3fdb69=0xce;}_0x4c9eeb[_0x40d9('0x24')](_0x3fdb69);return _0x4c9eeb[_0x40d9('0x29')](_0x40d9('0x2a'),_0x3a63d8+'-'+_0x37e9c1+'/'+_0x4cf8f7)[_0x40d9('0x25')](_0x1e1fcf);}return null;};}function patchUpdates(_0x4b8be0){return function(_0x4a8a15){try{jsonpatch[_0x40d9('0x2b')](_0x4a8a15,_0x4b8be0,!![]);}catch(_0x5b395f){return BPromise['reject'](_0x5b395f);}return _0x4a8a15[_0x40d9('0x2c')]();};}function saveUpdates(_0x37be57,_0x4309c9){return function(_0x66f51a){if(_0x66f51a){return _0x66f51a[_0x40d9('0x2d')](_0x37be57)[_0x40d9('0x2e')](function(_0x3d9d3e){return _0x3d9d3e;});}return null;};}function removeEntity(_0x3c18ae,_0x2b9956){return function(_0x16ba0e){if(_0x16ba0e){return _0x16ba0e[_0x40d9('0x2f')]()['then'](function(){_0x3c18ae[_0x40d9('0x24')](0xcc)[_0x40d9('0x23')]();});}};}function handleEntityNotFound(_0x354826,_0x433a0f){return function(_0x1653bc){if(!_0x1653bc){_0x354826[_0x40d9('0x30')](0x194);}return _0x1653bc;};}function handleError(_0xb26f7e,_0xb5f191){_0xb5f191=_0xb5f191||0x1f4;return function(_0x2cf5a7){logger[_0x40d9('0x1f')](_0x2cf5a7[_0x40d9('0x31')]);if(_0x2cf5a7[_0x40d9('0x32')]){delete _0x2cf5a7[_0x40d9('0x32')];}_0xb26f7e[_0x40d9('0x24')](_0xb5f191)[_0x40d9('0x33')](_0x2cf5a7);};}exports[_0x40d9('0x34')]=function(_0x1e23cc,_0xb14e4c){var _0x37a784={},_0x48c3cf={},_0x2c9848={'count':0x0,'rows':[]};var _0x5d8242=_[_0x40d9('0x35')](db[_0x40d9('0x36')][_0x40d9('0x37')],function(_0x2b6c76){return{'name':_0x2b6c76['fieldName'],'type':_0x2b6c76[_0x40d9('0x38')][_0x40d9('0x39')]};});_0x48c3cf[_0x40d9('0x3a')]=_['map'](_0x5d8242,_0x40d9('0x32'));_0x48c3cf[_0x40d9('0x3b')]=_[_0x40d9('0x3c')](_0x1e23cc[_0x40d9('0x3b')]);_0x48c3cf[_0x40d9('0x3d')]=_[_0x40d9('0x3e')](_0x48c3cf[_0x40d9('0x3a')],_0x48c3cf[_0x40d9('0x3b')]);_0x37a784[_0x40d9('0x3f')]=_[_0x40d9('0x3e')](_0x48c3cf[_0x40d9('0x3a')],qs[_0x40d9('0x40')](_0x1e23cc[_0x40d9('0x3b')][_0x40d9('0x40')]));_0x37a784[_0x40d9('0x3f')]=_0x37a784[_0x40d9('0x3f')]['length']?_0x37a784[_0x40d9('0x3f')]:_0x48c3cf[_0x40d9('0x3a')];if(!_0x1e23cc[_0x40d9('0x3b')][_0x40d9('0x41')](_0x40d9('0x42'))){_0x37a784[_0x40d9('0x28')]=qs['limit'](_0x1e23cc[_0x40d9('0x3b')][_0x40d9('0x28')]);_0x37a784[_0x40d9('0x27')]=qs[_0x40d9('0x27')](_0x1e23cc[_0x40d9('0x3b')][_0x40d9('0x27')]);}_0x37a784['order']=qs[_0x40d9('0x43')](_0x1e23cc[_0x40d9('0x3b')][_0x40d9('0x43')]);_0x37a784[_0x40d9('0x44')]=qs['filters'](_['pick'](_0x1e23cc[_0x40d9('0x3b')],_0x48c3cf[_0x40d9('0x3d')]),_0x5d8242);if(_0x1e23cc[_0x40d9('0x3b')][_0x40d9('0x45')]){_0x37a784['where']=_['merge'](_0x37a784[_0x40d9('0x44')],{'$or':_[_0x40d9('0x35')](_0x5d8242,function(_0x8d636f){if(_0x8d636f['type']!==_0x40d9('0x46')){var _0x49ee82={};_0x49ee82[_0x8d636f[_0x40d9('0x32')]]={'$like':'%'+_0x1e23cc[_0x40d9('0x3b')]['filter']+'%'};return _0x49ee82;}})});}_0x37a784=_['merge']({},_0x37a784,_0x1e23cc[_0x40d9('0x47')]);var _0x3f599a={'where':_0x37a784[_0x40d9('0x44')]};return db[_0x40d9('0x36')]['count'](_0x3f599a)['then'](function(_0x31fb3d){_0x2c9848[_0x40d9('0x26')]=_0x31fb3d;if(_0x1e23cc[_0x40d9('0x3b')]['includeAll']){_0x37a784[_0x40d9('0x48')]=[{'all':!![]}];}return db[_0x40d9('0x36')]['findAll'](_0x37a784);})[_0x40d9('0x2e')](function(_0x14b89d){_0x2c9848[_0x40d9('0x49')]=_0x14b89d;return _0x2c9848;})[_0x40d9('0x2e')](respondWithFilteredResult(_0xb14e4c,_0x37a784))['catch'](handleError(_0xb14e4c,null));};exports[_0x40d9('0x4a')]=function(_0x3f30d8,_0x2e3d8a){var _0xb4654b={'raw':![],'where':{'id':_0x3f30d8['params']['id']}},_0xc7e65f={};_0xc7e65f[_0x40d9('0x3a')]=_[_0x40d9('0x3c')](db[_0x40d9('0x36')][_0x40d9('0x37')]);_0xc7e65f[_0x40d9('0x3b')]=_[_0x40d9('0x3c')](_0x3f30d8[_0x40d9('0x3b')]);_0xc7e65f[_0x40d9('0x3d')]=_[_0x40d9('0x3e')](_0xc7e65f['model'],_0xc7e65f[_0x40d9('0x3b')]);_0xb4654b[_0x40d9('0x3f')]=_[_0x40d9('0x3e')](_0xc7e65f[_0x40d9('0x3a')],qs[_0x40d9('0x40')](_0x3f30d8['query'][_0x40d9('0x40')]));_0xb4654b[_0x40d9('0x3f')]=_0xb4654b[_0x40d9('0x3f')][_0x40d9('0x4b')]?_0xb4654b['attributes']:_0xc7e65f[_0x40d9('0x3a')];if(_0x3f30d8[_0x40d9('0x3b')][_0x40d9('0x4c')]){_0xb4654b['include']=[{'all':!![]}];}_0xb4654b=_['merge']({},_0xb4654b,_0x3f30d8[_0x40d9('0x47')]);return db[_0x40d9('0x36')][_0x40d9('0x4d')](_0xb4654b)[_0x40d9('0x2e')](handleEntityNotFound(_0x2e3d8a,null))[_0x40d9('0x2e')](respondWithResult(_0x2e3d8a,null))[_0x40d9('0x4e')](handleError(_0x2e3d8a,null));};exports['create']=function(_0x318191,_0x274aea){return db[_0x40d9('0x36')][_0x40d9('0x4f')](_0x318191[_0x40d9('0x50')],{})[_0x40d9('0x2e')](respondWithResult(_0x274aea,0xc9))[_0x40d9('0x4e')](handleError(_0x274aea,null));};exports['update']=function(_0x2c7422,_0x192c34){if(_0x2c7422[_0x40d9('0x50')]['id']){delete _0x2c7422[_0x40d9('0x50')]['id'];}return db[_0x40d9('0x36')][_0x40d9('0x4d')]({'where':{'id':_0x2c7422[_0x40d9('0x51')]['id']}})[_0x40d9('0x2e')](handleEntityNotFound(_0x192c34,null))[_0x40d9('0x2e')](saveUpdates(_0x2c7422[_0x40d9('0x50')],null))[_0x40d9('0x2e')](respondWithResult(_0x192c34,null))[_0x40d9('0x4e')](handleError(_0x192c34,null));};exports[_0x40d9('0x2f')]=function(_0x49a5e1,_0xbc1d4d){return db[_0x40d9('0x36')][_0x40d9('0x4d')]({'where':{'id':_0x49a5e1[_0x40d9('0x51')]['id']}})[_0x40d9('0x2e')](handleEntityNotFound(_0xbc1d4d,null))[_0x40d9('0x2e')](removeEntity(_0xbc1d4d,null))['catch'](handleError(_0xbc1d4d,null));};exports[_0x40d9('0x52')]=function(_0x376f8b,_0x5aafb0,_0x518534){var _0x4bb90f={};var _0x481f0e={};var _0x4f7fd3;var _0x94b616;return db[_0x40d9('0x36')][_0x40d9('0x53')]({'where':{'id':_0x376f8b['params']['id']}})[_0x40d9('0x2e')](handleEntityNotFound(_0x5aafb0,null))[_0x40d9('0x2e')](function(_0x4cb4f1){if(_0x4cb4f1){_0x4f7fd3=_0x4cb4f1;_0x481f0e[_0x40d9('0x3a')]=_[_0x40d9('0x3c')](db['Dynamics365Configuration']['rawAttributes']);_0x481f0e[_0x40d9('0x3b')]=_[_0x40d9('0x3c')](_0x376f8b['query']);_0x481f0e['filters']=_['intersection'](_0x481f0e['model'],_0x481f0e[_0x40d9('0x3b')]);_0x4bb90f[_0x40d9('0x3f')]=_['intersection'](_0x481f0e[_0x40d9('0x3a')],qs[_0x40d9('0x40')](_0x376f8b[_0x40d9('0x3b')]['fields']));_0x4bb90f[_0x40d9('0x3f')]=_0x4bb90f[_0x40d9('0x3f')][_0x40d9('0x4b')]?_0x4bb90f[_0x40d9('0x3f')]:_0x481f0e['model'];_0x4bb90f['order']=qs[_0x40d9('0x43')](_0x376f8b[_0x40d9('0x3b')]['sort']);_0x4bb90f[_0x40d9('0x44')]=qs[_0x40d9('0x3d')](_[_0x40d9('0x54')](_0x376f8b[_0x40d9('0x3b')],_0x481f0e[_0x40d9('0x3d')]));if(_0x376f8b[_0x40d9('0x3b')][_0x40d9('0x45')]){_0x4bb90f['where']=_[_0x40d9('0x55')](_0x4bb90f['where'],{'$or':_[_0x40d9('0x35')](_0x4bb90f[_0x40d9('0x3f')],function(_0x2a7b80){var _0x300e70={};_0x300e70[_0x2a7b80]={'$like':'%'+_0x376f8b[_0x40d9('0x3b')][_0x40d9('0x45')]+'%'};return _0x300e70;})});}_0x4bb90f=_['merge']({},_0x4bb90f,_0x376f8b[_0x40d9('0x47')]);return _0x4f7fd3[_0x40d9('0x52')](_0x4bb90f);}})['then'](function(_0x2edae9){if(_0x2edae9){_0x94b616=_0x2edae9[_0x40d9('0x4b')];if(!_0x376f8b[_0x40d9('0x3b')][_0x40d9('0x41')](_0x40d9('0x42'))){_0x4bb90f[_0x40d9('0x28')]=qs[_0x40d9('0x28')](_0x376f8b['query'][_0x40d9('0x28')]);_0x4bb90f[_0x40d9('0x27')]=qs[_0x40d9('0x27')](_0x376f8b[_0x40d9('0x3b')][_0x40d9('0x27')]);}return _0x4f7fd3[_0x40d9('0x52')](_0x4bb90f);}})[_0x40d9('0x2e')](function(_0x1fd6ca){if(_0x1fd6ca){return _0x1fd6ca?{'count':_0x94b616,'rows':_0x1fd6ca}:null;}})[_0x40d9('0x2e')](respondWithResult(_0x5aafb0,null))[_0x40d9('0x4e')](handleError(_0x5aafb0,null));};exports['addConfiguration']=function(_0x182771,_0x297ece,_0x48ebbb){if(_0x182771['body']['id']){delete _0x182771['body']['id'];}return db[_0x40d9('0x36')]['findOne']({'where':{'id':_0x182771[_0x40d9('0x51')]['id']}})[_0x40d9('0x2e')](handleEntityNotFound(_0x297ece,null))[_0x40d9('0x2e')](function(_0x6da1f1){if(_0x6da1f1){_0x182771[_0x40d9('0x50')][_0x40d9('0x56')]=_0x6da1f1['id'];_0x182771['body']['Subjects']=integrations['getSubjects'](_0x182771[_0x40d9('0x50')][_0x40d9('0x57')],_0x182771[_0x40d9('0x50')][_0x40d9('0x38')]);_0x182771[_0x40d9('0x50')][_0x40d9('0x58')]=integrations['getDescriptions'](_0x182771['body'][_0x40d9('0x57')],_0x182771[_0x40d9('0x50')][_0x40d9('0x38')]);return db[_0x40d9('0x59')][_0x40d9('0x4f')](_0x182771[_0x40d9('0x50')],{'include':[{'model':db[_0x40d9('0x5a')],'as':_0x40d9('0x5b')},{'model':db[_0x40d9('0x5a')],'as':_0x40d9('0x58')}]});}return null;})[_0x40d9('0x2e')](respondWithResult(_0x297ece,null))[_0x40d9('0x4e')](handleError(_0x297ece,null));};exports[_0x40d9('0x5c')]=function(_0xc4f14b,_0x4144f0,_0x212556){var _0x331a94=_0xc4f14b[_0x40d9('0x3b')]['ticketType'];var _0x543f2e=_0x331a94===_0x40d9('0x5d')?_0x40d9('0x5e'):_0x40d9('0x5f');var _0x17497e='';var _0xc19e26='';var _0x38a763='';var _0x6e38b9='';var _0x5d729c='';var _0x550d6e='';var _0x3e944b='';var _0x2834b5='';var _0xba8205=[_0x40d9('0x60'),_0x40d9('0x61'),_0x40d9('0x62'),_0x40d9('0x63'),'caseorigincode','subject',_0x40d9('0x64'),'regardingobjectid',_0x40d9('0x65'),_0x40d9('0x66')];var _0x3b9eee=[_0x40d9('0x67'),_0x40d9('0x68'),'actualserviceunits',_0x40d9('0x69'),_0x40d9('0x6a'),'contactidyominame',_0x40d9('0x6b'),_0x40d9('0x6c'),_0x40d9('0x6d'),'createdbyexternalpartyyominame',_0x40d9('0x6e'),_0x40d9('0x6f'),'createdon',_0x40d9('0x70'),_0x40d9('0x71'),_0x40d9('0x72'),_0x40d9('0x73'),'customeridyominame',_0x40d9('0x74'),_0x40d9('0x75'),_0x40d9('0x76'),_0x40d9('0x77'),_0x40d9('0x78'),_0x40d9('0x79'),'firstresponsebykpiidname',_0x40d9('0x7a'),_0x40d9('0x7b'),_0x40d9('0x7c'),'kbarticleidname',_0x40d9('0x7d'),_0x40d9('0x7e'),_0x40d9('0x7f'),_0x40d9('0x80'),_0x40d9('0x81'),_0x40d9('0x82'),_0x40d9('0x83'),_0x40d9('0x84'),_0x40d9('0x85'),_0x40d9('0x86'),'msdyn_iotalertname','numberofchildincidents',_0x40d9('0x87'),_0x40d9('0x88'),_0x40d9('0x89'),_0x40d9('0x8a'),'owneridyominame',_0x40d9('0x8b'),_0x40d9('0x8c'),_0x40d9('0x8d'),_0x40d9('0x8e'),_0x40d9('0x8f'),_0x40d9('0x90'),_0x40d9('0x91'),_0x40d9('0x92'),_0x40d9('0x93'),_0x40d9('0x94'),_0x40d9('0x95'),_0x40d9('0x96'),_0x40d9('0x97'),_0x40d9('0x98'),_0x40d9('0x99'),_0x40d9('0x9a'),'statuscode',_0x40d9('0x9b'),_0x40d9('0x9c'),_0x40d9('0x9d'),_0x40d9('0x9e'),_0x40d9('0x9f'),_0x40d9('0xa0'),_0x40d9('0xa1')];var _0x41b918=_0xba8205['concat'](_0x3b9eee);return db[_0x40d9('0x36')][_0x40d9('0x53')]({'where':{'id':_0xc4f14b['params']['id']},'attributes':['id',_0x40d9('0xa2'),'password','remoteUri','tenantId',_0x40d9('0xa3'),'clientSecret']})['then'](handleEntityNotFound(_0x4144f0,null))['then'](function(_0x2536f7){if(_0x2536f7){_0x2834b5=_0x2536f7[_0x40d9('0xa4')];var _0x1ee2d9=_0x2834b5['slice'](-0x1);if(_0x1ee2d9==='/'){_0x2834b5=_0x2834b5[_0x40d9('0xa5')](0x0,_0x2834b5[_0x40d9('0xa6')](_0x1ee2d9));}_0x3e944b=util[_0x40d9('0xa7')](_0x40d9('0xa8'),_0x2834b5);var _0x34b4cb={'method':_0x40d9('0xa9'),'uri':_0x40d9('0xaa')+_0x2536f7[_0x40d9('0xab')]+_0x40d9('0xac'),'form':{'client_id':_0x2536f7[_0x40d9('0xa3')],'resource':_0x2834b5,'username':_0x2536f7[_0x40d9('0xa2')],'password':_0x2536f7[_0x40d9('0xad')],'grant_type':_0x40d9('0xad'),'client_secret':_0x2536f7['clientSecret']},'json':!![]};return rp(_0x34b4cb);}})[_0x40d9('0x2e')](function(_0x9502c0){_0x550d6e=_0x9502c0[_0x40d9('0xae')];var _0x293aa9={'method':_0x40d9('0xaf'),'uri':encodeURI(_0x3e944b+_0x40d9('0xb0')+_0x543f2e+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x550d6e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x293aa9);})[_0x40d9('0x2e')](function(_0x239130){var _0x54fa7f=_0x239130['value'][0x0];var _0xbf7bc8=_0x54fa7f[_0x40d9('0xb1')];var _0x1cae47={'method':_0x40d9('0xaf'),'uri':_0x3e944b+_0x40d9('0xb2')+_0xbf7bc8+_0x40d9('0xb3'),'headers':{'Authorization':_0x40d9('0xb4')+_0x550d6e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1cae47);})[_0x40d9('0x2e')](function(_0xe2036e){_0x17497e=_0xe2036e;_0xc19e26=_0x17497e[_0x40d9('0xb5')];_0xc19e26=_[_0x40d9('0xb6')](_0xc19e26,function(_0x20c0b1){return!_0x41b918[_0x40d9('0xb7')](_0x20c0b1[_0x40d9('0xb8')]);});var _0x2c2c22=[];var _0x4e8224=[];_0xc19e26['forEach'](function(_0xb2751a){if(_0xb2751a[_0x40d9('0xb9')]){var _0x5b78c6=_0xb2751a[_0x40d9('0xb9')][_0x40d9('0xa5')](_0xb2751a[_0x40d9('0xb9')][_0x40d9('0xa6')]('.')+0x1);if(_0x5b78c6===_0x40d9('0xba')){_0x2c2c22[_0x40d9('0xbb')](getSelectList(_0x3e944b,_0x331a94,_0x4e8224,_0x17497e[_0x40d9('0xb1')],_0xb2751a[_0x40d9('0xb1')],_0x550d6e));}}});return Promise[_0x40d9('0xbc')](_0x2c2c22);})['then'](function(_0x388f8f){_0x38a763=_0x388f8f[0x0];var _0x59f0b2=[];var _0x5bb9ba=[];_0xc19e26[_0x40d9('0xbd')](function(_0x5c9be2){if(!_[_0x40d9('0xbe')](_0x5c9be2[_0x40d9('0xb9')])){var _0x33c681=_0x5c9be2[_0x40d9('0xb9')][_0x40d9('0xa5')](_0x5c9be2['@odata.type'][_0x40d9('0xa6')]('.')+0x1);if(_0x33c681===_0x40d9('0xbf')){_0x59f0b2[_0x40d9('0xbb')](getBooleanList(_0x3e944b,_0x331a94,_0x5bb9ba,_0x17497e[_0x40d9('0xb1')],_0x5c9be2[_0x40d9('0xb1')],_0x550d6e));}}});return Promise['all'](_0x59f0b2);})['then'](function(_0x43bb8e){_0x6e38b9=_0x43bb8e[0x0];var _0x56094c=[];var _0x2763d8=[];_0xc19e26[_0x40d9('0xbd')](function(_0x1cc175){if(_0x1cc175['@odata.type']){var _0x57225c=_0x1cc175['@odata.type'][_0x40d9('0xa5')](_0x1cc175[_0x40d9('0xb9')][_0x40d9('0xa6')]('.')+0x1);if(_0x57225c===_0x40d9('0xc0')||_0x57225c===_0x40d9('0xc1')||_0x57225c===_0x40d9('0xc2')||_0x57225c===_0x40d9('0xc3')||_0x57225c===_0x40d9('0xc4')||_0x57225c===_0x40d9('0xc5')||_0x57225c===_0x40d9('0xc6')||_0x57225c==='EntityNameAttributeMetadata'||_0x57225c===_0x40d9('0xc7')||_0x57225c===_0x40d9('0xc8')){_0x56094c['push'](getInputList(_0x3e944b,_0x331a94,_0x57225c,_0x2763d8,_0x17497e[_0x40d9('0xb1')],_0x1cc175[_0x40d9('0xb1')],_0x550d6e));}}});return Promise[_0x40d9('0xbc')](_0x56094c);})[_0x40d9('0x2e')](function(_0x32a445){_0x5d729c=_0x32a445[0x0];var _0x130d68=_0x38a763[_0x40d9('0xc9')](_0x6e38b9)[_0x40d9('0xc9')](_0x5d729c);var _0x8e8a7f={'count':_0x130d68[_0x40d9('0x4b')],'rows':_0x130d68};return _0x8e8a7f;})[_0x40d9('0x2e')](respondWithResult(_0x4144f0,null))[_0x40d9('0x4e')](function(_0x10e9d6){var _0x47b3e5=_0xc4f14b[_0x40d9('0x3b')][_0x40d9('0x15')]?0x1f4:_0x10e9d6[_0x40d9('0xca')]||0x1f4;logger[_0x40d9('0x1f')](_0x10e9d6[_0x40d9('0x31')]);delete _0x10e9d6[_0x40d9('0x32')];if(_0x47b3e5===0x191){_0x47b3e5=0x190;}_0x4144f0[_0x40d9('0x24')](_0x47b3e5)[_0x40d9('0x33')](_0xc4f14b['query']['test']?{'message':_0x40d9('0xcb'),'statusCode':_0x10e9d6[_0x40d9('0xca')]}:_0x10e9d6);});};function getSelectList(_0x58bae1,_0x48ab67,_0x392ed4,_0x181b20,_0x212068,_0x4175ea){var _0x4e7633={'method':_0x40d9('0xaf'),'uri':_0x58bae1+_0x40d9('0xb2')+_0x181b20+_0x40d9('0xcc')+_0x212068+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x40d9('0xb4')+_0x4175ea,'If-None-Match':null,'OData-Version':_0x40d9('0xcd')},'json':!![]};return rp(_0x4e7633)[_0x40d9('0x2e')](function(_0x24e609){var _0x600ec=[];var _0x339bfe=_0x24e609['OptionSet'][_0x40d9('0xce')];_0x339bfe[_0x40d9('0xbd')](function(_0x1004a2){_0x600ec['push']({'name':_0x1004a2[_0x40d9('0xcf')][_0x40d9('0xd0')][_0x40d9('0xcf')],'value':String(_0x1004a2['Value'])});});var _0x22dd73={'id':_0x48ab67+'_'+_0x24e609[_0x40d9('0xb8')],'name':_0x24e609[_0x40d9('0xd1')][_0x40d9('0xd0')][_0x40d9('0xcf')],'custom':![],'options':_0x600ec};_0x392ed4['push'](_0x22dd73);return _0x392ed4;});}function getBooleanList(_0x3a619a,_0x5bd6de,_0x7b9616,_0x4ad24d,_0x1900fe,_0x28a6c2){var _0x406e2f={'method':_0x40d9('0xaf'),'uri':_0x3a619a+_0x40d9('0xb2')+_0x4ad24d+_0x40d9('0xcc')+_0x1900fe+_0x40d9('0xd2'),'headers':{'Authorization':'Bearer\x20'+_0x28a6c2,'If-None-Match':null,'OData-Version':_0x40d9('0xcd')},'json':!![]};return rp(_0x406e2f)[_0x40d9('0x2e')](function(_0x53cdc4){var _0x35c0d5=[];_0x35c0d5[_0x40d9('0xbb')]({'name':_0x53cdc4[_0x40d9('0xd3')][_0x40d9('0xd4')][_0x40d9('0xcf')][_0x40d9('0xd0')][_0x40d9('0xcf')],'value':_0x40d9('0xd5')},{'name':_0x53cdc4[_0x40d9('0xd3')][_0x40d9('0xd6')][_0x40d9('0xcf')]['UserLocalizedLabel'][_0x40d9('0xcf')],'value':'false'});var _0x578abd={'id':_0x5bd6de+'_'+_0x53cdc4[_0x40d9('0xb8')],'name':_0x53cdc4[_0x40d9('0xd1')][_0x40d9('0xd0')][_0x40d9('0xcf')],'custom':![],'options':_0x35c0d5};_0x7b9616[_0x40d9('0xbb')](_0x578abd);return _0x7b9616;});}function getInputList(_0x47cc70,_0x2f1110,_0x2cabee,_0x431e85,_0x52d425,_0x1df99a,_0x252a50){var _0x5c2195={'method':_0x40d9('0xaf'),'uri':_0x47cc70+_0x40d9('0xb2')+_0x52d425+')/Attributes('+_0x1df99a+_0x40d9('0xd7')+_0x2cabee+_0x40d9('0xd8'),'headers':{'Authorization':_0x40d9('0xb4')+_0x252a50,'If-None-Match':null,'OData-Version':_0x40d9('0xcd')},'json':!![]};return rp(_0x5c2195)[_0x40d9('0x2e')](function(_0x37ef81){var _0x323bfb={'id':_0x2f1110+'_'+_0x37ef81[_0x40d9('0xb8')],'name':_0x37ef81[_0x40d9('0xd1')]['UserLocalizedLabel']?_0x37ef81[_0x40d9('0xd1')]['UserLocalizedLabel'][_0x40d9('0xcf')]:_0x37ef81['LogicalName'],'custom':![],'options':[]};_0x431e85['push'](_0x323bfb);return _0x431e85;});} \ No newline at end of file +var _0x4c6e=['timezoneruleversionnumber','traversedpath','versionnumber','concat','username','remoteUri','clientId','clientSecret','slice','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','password','access_token','GET','Bearer\x20','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','statusCode','stack','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','update','destroy','name','send','map','Dynamics365Account','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','type','Descriptions','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','incident','Incident','description','customerid','ownerid','caseorigincode','phonenumber','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','resolveby','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber'];(function(_0x13c5df,_0xc3bfde){var _0x170647=function(_0x2c885b){while(--_0x2c885b){_0x13c5df['push'](_0x13c5df['shift']());}};_0x170647(++_0xc3bfde);}(_0x4c6e,0x105));var _0xe4c6=function(_0x729164,_0x55025a){_0x729164=_0x729164-0x0;var _0x4e677a=_0x4c6e[_0x729164];return _0x4e677a;};'use strict';var pdf=require(_0xe4c6('0x0'));var emlformat=require(_0xe4c6('0x1'));var rimraf=require(_0xe4c6('0x2'));var zipdir=require(_0xe4c6('0x3'));var jsonpatch=require(_0xe4c6('0x4'));var rp=require('request-promise');var moment=require(_0xe4c6('0x5'));var BPromise=require(_0xe4c6('0x6'));var Mustache=require(_0xe4c6('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe4c6('0x8'));var ejs=require(_0xe4c6('0x9'));var fs=require('fs');var _=require(_0xe4c6('0xa'));var squel=require(_0xe4c6('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe4c6('0x8'));var querystring=require('querystring');var Papa=require(_0xe4c6('0xc'));var Redis=require(_0xe4c6('0xd'));var authService=require(_0xe4c6('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xe4c6('0xf'));var hardwareService=require(_0xe4c6('0x10'));var logger=require(_0xe4c6('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe4c6('0x12'));var db=require(_0xe4c6('0x13'))['db'];var integrations=require(_0xe4c6('0x14'));var jayson=require(_0xe4c6('0x15'));var client=jayson['client'][_0xe4c6('0x16')]({'port':0x232a});function checkPasswordPattern(_0x118b6b,_0x3fdb0e,_0x503be3){if(_0x503be3){var _0x455e13=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x455e13[_0xe4c6('0x17')](_0x3fdb0e)){return _0x118b6b;}else{throw new db[(_0xe4c6('0x18'))][(_0xe4c6('0x19'))](_0xe4c6('0x1a'));}}else{return _0x118b6b;}}function respondWithRpcPromise(_0xbc4e4a,_0x3c2c9a,_0x4889a3,_0x4adf00){return new BPromise(function(_0x12c15e,_0x358a1e){var _0x563de3=_0x4adf00||client;return _0x563de3['request'](_0xbc4e4a,_0x4889a3)[_0xe4c6('0x1b')](function(_0xbb448c){logger[_0xe4c6('0x1c')](_0xe4c6('0x1d'),_0x3c2c9a,_0xe4c6('0x1e'));logger[_0xe4c6('0x1f')](_0xe4c6('0x20'),_0x3c2c9a,_0xe4c6('0x1e'),JSON[_0xe4c6('0x21')](_0xbb448c));if(_0xbb448c[_0xe4c6('0x22')]){if(_0xbb448c[_0xe4c6('0x22')][_0xe4c6('0x23')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x3c2c9a,_0xbb448c[_0xe4c6('0x22')][_0xe4c6('0x24')]);return _0x358a1e(_0xbb448c[_0xe4c6('0x22')][_0xe4c6('0x24')]);}logger['error'](_0xe4c6('0x1d'),_0x3c2c9a,_0xbb448c[_0xe4c6('0x22')][_0xe4c6('0x24')]);return _0x12c15e(_0xbb448c[_0xe4c6('0x22')][_0xe4c6('0x24')]);}else{logger[_0xe4c6('0x1c')]('Dynamics365Account,\x20%s,\x20%s',_0x3c2c9a,_0xe4c6('0x1e'));_0x12c15e(_0xbb448c[_0xe4c6('0x25')][_0xe4c6('0x24')]);}})['catch'](function(_0x2d7a8a){logger[_0xe4c6('0x22')](_0xe4c6('0x1d'),_0x3c2c9a,_0x2d7a8a);_0x358a1e(_0x2d7a8a);});});}function respondWithStatusCode(_0x1d1d3b,_0x2464d5){_0x2464d5=_0x2464d5||0xcc;return function(_0x24d7a2){if(_0x24d7a2){return _0x1d1d3b[_0xe4c6('0x26')](_0x2464d5);}return _0x1d1d3b[_0xe4c6('0x27')](_0x2464d5)[_0xe4c6('0x28')]();};}function respondWithResult(_0x46b180,_0x414f52){_0x414f52=_0x414f52||0xc8;return function(_0x59555b){if(_0x59555b){return _0x46b180['status'](_0x414f52)['json'](_0x59555b);}};}function respondWithFilteredResult(_0x1ce1c8,_0x17d842){return function(_0x19cbd5){if(_0x19cbd5){var _0x2a1bb8=_0x19cbd5[_0xe4c6('0x29')],_0x295da7=_0x17d842['offset'],_0xaa0b98=_0x17d842[_0xe4c6('0x2a')]+_0x17d842['limit'],_0x26232a;if(_0xaa0b98>=_0x2a1bb8){_0xaa0b98=_0x2a1bb8;_0x26232a=0xc8;}else{_0x26232a=0xce;}_0x1ce1c8[_0xe4c6('0x27')](_0x26232a);return _0x1ce1c8['set'](_0xe4c6('0x2b'),_0x295da7+'-'+_0xaa0b98+'/'+_0x2a1bb8)[_0xe4c6('0x2c')](_0x19cbd5);}return null;};}function patchUpdates(_0x4d3707){return function(_0x5eb190){try{jsonpatch[_0xe4c6('0x2d')](_0x5eb190,_0x4d3707,!![]);}catch(_0x57e372){return BPromise[_0xe4c6('0x2e')](_0x57e372);}return _0x5eb190['save']();};}function saveUpdates(_0xac7548,_0x295dfa){return function(_0x5a9132){if(_0x5a9132){return _0x5a9132[_0xe4c6('0x2f')](_0xac7548)[_0xe4c6('0x1b')](function(_0x4b3e78){return _0x4b3e78;});}return null;};}function removeEntity(_0x230daf,_0x1d484b){return function(_0x347d33){if(_0x347d33){return _0x347d33[_0xe4c6('0x30')]()[_0xe4c6('0x1b')](function(){_0x230daf['status'](0xcc)[_0xe4c6('0x28')]();});}};}function handleEntityNotFound(_0x3e93c8,_0x2dabae){return function(_0x5aa468){if(!_0x5aa468){_0x3e93c8[_0xe4c6('0x26')](0x194);}return _0x5aa468;};}function handleError(_0x4061e9,_0x1a5c66){_0x1a5c66=_0x1a5c66||0x1f4;return function(_0xf6d54){logger[_0xe4c6('0x22')](_0xf6d54['stack']);if(_0xf6d54[_0xe4c6('0x31')]){delete _0xf6d54[_0xe4c6('0x31')];}_0x4061e9[_0xe4c6('0x27')](_0x1a5c66)[_0xe4c6('0x32')](_0xf6d54);};}exports['index']=function(_0x4bb787,_0x20dc13){var _0xc59ba9={},_0x2d7aa3={},_0x1110f8={'count':0x0,'rows':[]};var _0x50f833=_[_0xe4c6('0x33')](db[_0xe4c6('0x34')]['rawAttributes'],function(_0x34b98f){return{'name':_0x34b98f[_0xe4c6('0x35')],'type':_0x34b98f['type'][_0xe4c6('0x36')]};});_0x2d7aa3[_0xe4c6('0x37')]=_[_0xe4c6('0x33')](_0x50f833,'name');_0x2d7aa3['query']=_[_0xe4c6('0x38')](_0x4bb787[_0xe4c6('0x39')]);_0x2d7aa3[_0xe4c6('0x3a')]=_[_0xe4c6('0x3b')](_0x2d7aa3[_0xe4c6('0x37')],_0x2d7aa3['query']);_0xc59ba9[_0xe4c6('0x3c')]=_[_0xe4c6('0x3b')](_0x2d7aa3[_0xe4c6('0x37')],qs[_0xe4c6('0x3d')](_0x4bb787[_0xe4c6('0x39')][_0xe4c6('0x3d')]));_0xc59ba9['attributes']=_0xc59ba9[_0xe4c6('0x3c')][_0xe4c6('0x3e')]?_0xc59ba9[_0xe4c6('0x3c')]:_0x2d7aa3[_0xe4c6('0x37')];if(!_0x4bb787[_0xe4c6('0x39')][_0xe4c6('0x3f')](_0xe4c6('0x40'))){_0xc59ba9[_0xe4c6('0x41')]=qs['limit'](_0x4bb787[_0xe4c6('0x39')]['limit']);_0xc59ba9[_0xe4c6('0x2a')]=qs['offset'](_0x4bb787[_0xe4c6('0x39')][_0xe4c6('0x2a')]);}_0xc59ba9[_0xe4c6('0x42')]=qs[_0xe4c6('0x43')](_0x4bb787[_0xe4c6('0x39')][_0xe4c6('0x43')]);_0xc59ba9[_0xe4c6('0x44')]=qs[_0xe4c6('0x3a')](_[_0xe4c6('0x45')](_0x4bb787[_0xe4c6('0x39')],_0x2d7aa3[_0xe4c6('0x3a')]),_0x50f833);if(_0x4bb787[_0xe4c6('0x39')][_0xe4c6('0x46')]){_0xc59ba9[_0xe4c6('0x44')]=_['merge'](_0xc59ba9[_0xe4c6('0x44')],{'$or':_[_0xe4c6('0x33')](_0x50f833,function(_0x1887a7){if(_0x1887a7['type']!==_0xe4c6('0x47')){var _0x1bd6e8={};_0x1bd6e8[_0x1887a7[_0xe4c6('0x31')]]={'$like':'%'+_0x4bb787[_0xe4c6('0x39')][_0xe4c6('0x46')]+'%'};return _0x1bd6e8;}})});}_0xc59ba9=_['merge']({},_0xc59ba9,_0x4bb787[_0xe4c6('0x48')]);var _0x31932e={'where':_0xc59ba9[_0xe4c6('0x44')]};return db[_0xe4c6('0x34')][_0xe4c6('0x29')](_0x31932e)['then'](function(_0x204fb1){_0x1110f8[_0xe4c6('0x29')]=_0x204fb1;if(_0x4bb787['query'][_0xe4c6('0x49')]){_0xc59ba9[_0xe4c6('0x4a')]=[{'all':!![]}];}return db[_0xe4c6('0x34')][_0xe4c6('0x4b')](_0xc59ba9);})['then'](function(_0x2e6114){_0x1110f8[_0xe4c6('0x4c')]=_0x2e6114;return _0x1110f8;})[_0xe4c6('0x1b')](respondWithFilteredResult(_0x20dc13,_0xc59ba9))[_0xe4c6('0x4d')](handleError(_0x20dc13,null));};exports['show']=function(_0x5840ad,_0x1f89ba){var _0x28a081={'raw':![],'where':{'id':_0x5840ad[_0xe4c6('0x4e')]['id']}},_0x47f624={};_0x47f624['model']=_['keys'](db[_0xe4c6('0x34')][_0xe4c6('0x4f')]);_0x47f624['query']=_['keys'](_0x5840ad[_0xe4c6('0x39')]);_0x47f624[_0xe4c6('0x3a')]=_['intersection'](_0x47f624[_0xe4c6('0x37')],_0x47f624[_0xe4c6('0x39')]);_0x28a081[_0xe4c6('0x3c')]=_['intersection'](_0x47f624[_0xe4c6('0x37')],qs[_0xe4c6('0x3d')](_0x5840ad[_0xe4c6('0x39')][_0xe4c6('0x3d')]));_0x28a081[_0xe4c6('0x3c')]=_0x28a081[_0xe4c6('0x3c')][_0xe4c6('0x3e')]?_0x28a081[_0xe4c6('0x3c')]:_0x47f624[_0xe4c6('0x37')];if(_0x5840ad[_0xe4c6('0x39')]['includeAll']){_0x28a081[_0xe4c6('0x4a')]=[{'all':!![]}];}_0x28a081=_[_0xe4c6('0x50')]({},_0x28a081,_0x5840ad[_0xe4c6('0x48')]);return db[_0xe4c6('0x34')][_0xe4c6('0x51')](_0x28a081)['then'](handleEntityNotFound(_0x1f89ba,null))[_0xe4c6('0x1b')](respondWithResult(_0x1f89ba,null))[_0xe4c6('0x4d')](handleError(_0x1f89ba,null));};exports[_0xe4c6('0x52')]=function(_0xc390d9,_0x53d41d){return db[_0xe4c6('0x34')][_0xe4c6('0x52')](_0xc390d9[_0xe4c6('0x53')],{})[_0xe4c6('0x1b')](respondWithResult(_0x53d41d,0xc9))[_0xe4c6('0x4d')](handleError(_0x53d41d,null));};exports[_0xe4c6('0x2f')]=function(_0x155f15,_0x422b61){if(_0x155f15[_0xe4c6('0x53')]['id']){delete _0x155f15['body']['id'];}return db[_0xe4c6('0x34')][_0xe4c6('0x51')]({'where':{'id':_0x155f15[_0xe4c6('0x4e')]['id']}})[_0xe4c6('0x1b')](handleEntityNotFound(_0x422b61,null))[_0xe4c6('0x1b')](saveUpdates(_0x155f15[_0xe4c6('0x53')],null))['then'](respondWithResult(_0x422b61,null))[_0xe4c6('0x4d')](handleError(_0x422b61,null));};exports[_0xe4c6('0x30')]=function(_0x3a36be,_0x5f223b){return db[_0xe4c6('0x34')][_0xe4c6('0x51')]({'where':{'id':_0x3a36be['params']['id']}})[_0xe4c6('0x1b')](handleEntityNotFound(_0x5f223b,null))[_0xe4c6('0x1b')](removeEntity(_0x5f223b,null))['catch'](handleError(_0x5f223b,null));};exports[_0xe4c6('0x54')]=function(_0x325ada,_0x2967a7,_0x249b20){var _0x1a23f5={};var _0x5bb8a2={};var _0x3e6a43;var _0x2e404e;return db['Dynamics365Account']['findOne']({'where':{'id':_0x325ada['params']['id']}})[_0xe4c6('0x1b')](handleEntityNotFound(_0x2967a7,null))[_0xe4c6('0x1b')](function(_0x5565a0){if(_0x5565a0){_0x3e6a43=_0x5565a0;_0x5bb8a2['model']=_[_0xe4c6('0x38')](db['Dynamics365Configuration'][_0xe4c6('0x4f')]);_0x5bb8a2[_0xe4c6('0x39')]=_[_0xe4c6('0x38')](_0x325ada[_0xe4c6('0x39')]);_0x5bb8a2[_0xe4c6('0x3a')]=_['intersection'](_0x5bb8a2[_0xe4c6('0x37')],_0x5bb8a2[_0xe4c6('0x39')]);_0x1a23f5[_0xe4c6('0x3c')]=_[_0xe4c6('0x3b')](_0x5bb8a2[_0xe4c6('0x37')],qs[_0xe4c6('0x3d')](_0x325ada[_0xe4c6('0x39')][_0xe4c6('0x3d')]));_0x1a23f5[_0xe4c6('0x3c')]=_0x1a23f5[_0xe4c6('0x3c')][_0xe4c6('0x3e')]?_0x1a23f5[_0xe4c6('0x3c')]:_0x5bb8a2[_0xe4c6('0x37')];_0x1a23f5[_0xe4c6('0x42')]=qs['sort'](_0x325ada[_0xe4c6('0x39')]['sort']);_0x1a23f5[_0xe4c6('0x44')]=qs[_0xe4c6('0x3a')](_[_0xe4c6('0x45')](_0x325ada[_0xe4c6('0x39')],_0x5bb8a2[_0xe4c6('0x3a')]));if(_0x325ada['query']['filter']){_0x1a23f5[_0xe4c6('0x44')]=_[_0xe4c6('0x50')](_0x1a23f5['where'],{'$or':_[_0xe4c6('0x33')](_0x1a23f5[_0xe4c6('0x3c')],function(_0x1c7195){var _0x2b5520={};_0x2b5520[_0x1c7195]={'$like':'%'+_0x325ada[_0xe4c6('0x39')][_0xe4c6('0x46')]+'%'};return _0x2b5520;})});}_0x1a23f5=_[_0xe4c6('0x50')]({},_0x1a23f5,_0x325ada['options']);return _0x3e6a43[_0xe4c6('0x54')](_0x1a23f5);}})[_0xe4c6('0x1b')](function(_0x5b1264){if(_0x5b1264){_0x2e404e=_0x5b1264['length'];if(!_0x325ada[_0xe4c6('0x39')]['hasOwnProperty'](_0xe4c6('0x40'))){_0x1a23f5[_0xe4c6('0x41')]=qs[_0xe4c6('0x41')](_0x325ada['query']['limit']);_0x1a23f5[_0xe4c6('0x2a')]=qs[_0xe4c6('0x2a')](_0x325ada[_0xe4c6('0x39')][_0xe4c6('0x2a')]);}return _0x3e6a43['getConfigurations'](_0x1a23f5);}})[_0xe4c6('0x1b')](function(_0x51c6d2){if(_0x51c6d2){return _0x51c6d2?{'count':_0x2e404e,'rows':_0x51c6d2}:null;}})[_0xe4c6('0x1b')](respondWithResult(_0x2967a7,null))[_0xe4c6('0x4d')](handleError(_0x2967a7,null));};exports[_0xe4c6('0x55')]=function(_0x2d5c33,_0x1a3b68,_0x4a175c){if(_0x2d5c33['body']['id']){delete _0x2d5c33[_0xe4c6('0x53')]['id'];}return db['Dynamics365Account'][_0xe4c6('0x56')]({'where':{'id':_0x2d5c33[_0xe4c6('0x4e')]['id']}})[_0xe4c6('0x1b')](handleEntityNotFound(_0x1a3b68,null))[_0xe4c6('0x1b')](function(_0x2c60fd){if(_0x2c60fd){_0x2d5c33[_0xe4c6('0x53')][_0xe4c6('0x57')]=_0x2c60fd['id'];_0x2d5c33['body']['Subjects']=integrations[_0xe4c6('0x58')](_0x2d5c33[_0xe4c6('0x53')][_0xe4c6('0x59')],_0x2d5c33['body'][_0xe4c6('0x5a')]);_0x2d5c33['body'][_0xe4c6('0x5b')]=integrations['getDescriptions'](_0x2d5c33[_0xe4c6('0x53')][_0xe4c6('0x59')],_0x2d5c33[_0xe4c6('0x53')][_0xe4c6('0x5a')]);return db[_0xe4c6('0x5c')][_0xe4c6('0x52')](_0x2d5c33[_0xe4c6('0x53')],{'include':[{'model':db[_0xe4c6('0x5d')],'as':'Subjects'},{'model':db[_0xe4c6('0x5d')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1a3b68,null))[_0xe4c6('0x4d')](handleError(_0x1a3b68,null));};exports[_0xe4c6('0x5e')]=function(_0xffc7aa,_0x81a5d7,_0x200b95){var _0x2d1d02=_0xffc7aa[_0xe4c6('0x39')][_0xe4c6('0x5f')];var _0xdd1d58=_0x2d1d02===_0xe4c6('0x60')?_0xe4c6('0x61'):'PhoneCall';var _0x58bf59='';var _0x442bdd='';var _0x17b905='';var _0x99a6c4='';var _0x109875='';var _0x92b507='';var _0x5388e5='';var _0x1ed9ab='';var _0x382238=['title',_0xe4c6('0x62'),_0xe4c6('0x63'),_0xe4c6('0x64'),_0xe4c6('0x65'),'subject',_0xe4c6('0x66'),'regardingobjectid',_0xe4c6('0x67'),_0xe4c6('0x68')];var _0x38706c=[_0xe4c6('0x69'),'accountidyominame',_0xe4c6('0x6a'),'billedserviceunits','contactidname',_0xe4c6('0x6b'),_0xe4c6('0x6c'),'contractidname',_0xe4c6('0x6d'),'createdbyexternalpartyyominame',_0xe4c6('0x6e'),_0xe4c6('0x6f'),'createdon','createdonbehalfbyname','createdonbehalfbyyominame',_0xe4c6('0x70'),_0xe4c6('0x71'),_0xe4c6('0x72'),'emailaddress',_0xe4c6('0x73'),'entityimage_timestamp','entityimage_url',_0xe4c6('0x74'),_0xe4c6('0x75'),'firstresponsebykpiidname',_0xe4c6('0x76'),_0xe4c6('0x77'),_0xe4c6('0x78'),_0xe4c6('0x79'),_0xe4c6('0x7a'),_0xe4c6('0x7b'),_0xe4c6('0x7c'),_0xe4c6('0x7d'),_0xe4c6('0x7e'),_0xe4c6('0x7f'),_0xe4c6('0x80'),'modifiedonbehalfbyname',_0xe4c6('0x81'),_0xe4c6('0x82'),_0xe4c6('0x83'),'numberofchildincidents',_0xe4c6('0x84'),'overriddencreatedon','owneridname',_0xe4c6('0x85'),'owneridyominame',_0xe4c6('0x86'),_0xe4c6('0x87'),_0xe4c6('0x88'),'prioritycodename',_0xe4c6('0x89'),'productserialnumber',_0xe4c6('0x8a'),'resolvebykpiidname',_0xe4c6('0x8b'),_0xe4c6('0x8c'),'responsiblecontactidyominame',_0xe4c6('0x8d'),_0xe4c6('0x8e'),_0xe4c6('0x8f'),_0xe4c6('0x90'),'statecode',_0xe4c6('0x91'),'subjectidname',_0xe4c6('0x92'),_0xe4c6('0x93'),'transactioncurrencyidname',_0xe4c6('0x94'),'utcconversiontimezonecode',_0xe4c6('0x95')];var _0x6670c5=_0x382238[_0xe4c6('0x96')](_0x38706c);return db['Dynamics365Account'][_0xe4c6('0x56')]({'where':{'id':_0xffc7aa[_0xe4c6('0x4e')]['id']},'attributes':['id',_0xe4c6('0x97'),'password',_0xe4c6('0x98'),'tenantId',_0xe4c6('0x99'),_0xe4c6('0x9a')]})['then'](handleEntityNotFound(_0x81a5d7,null))[_0xe4c6('0x1b')](function(_0xa04e3){if(_0xa04e3){_0x1ed9ab=_0xa04e3[_0xe4c6('0x98')];var _0xabac87=_0x1ed9ab[_0xe4c6('0x9b')](-0x1);if(_0xabac87==='/'){_0x1ed9ab=_0x1ed9ab['substring'](0x0,_0x1ed9ab[_0xe4c6('0x9c')](_0xabac87));}_0x5388e5=util[_0xe4c6('0x9d')](_0xe4c6('0x9e'),_0x1ed9ab);var _0x5e45d2={'method':'POST','uri':_0xe4c6('0x9f')+_0xa04e3['tenantId']+_0xe4c6('0xa0'),'form':{'client_id':_0xa04e3['clientId'],'resource':_0x1ed9ab,'username':_0xa04e3[_0xe4c6('0x97')],'password':_0xa04e3[_0xe4c6('0xa1')],'grant_type':_0xe4c6('0xa1'),'client_secret':_0xa04e3[_0xe4c6('0x9a')]},'json':!![]};return rp(_0x5e45d2);}})[_0xe4c6('0x1b')](function(_0x598897){_0x92b507=_0x598897[_0xe4c6('0xa2')];var _0x241e58={'method':_0xe4c6('0xa3'),'uri':encodeURI(_0x5388e5+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0xdd1d58+'\x27'),'headers':{'Authorization':_0xe4c6('0xa4')+_0x92b507,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x241e58);})[_0xe4c6('0x1b')](function(_0x3c2f0c){var _0x32ce72=_0x3c2f0c['value'][0x0];var _0x9e0406=_0x32ce72[_0xe4c6('0xa5')];var _0x18dd5d={'method':_0xe4c6('0xa3'),'uri':_0x5388e5+'EntityDefinitions('+_0x9e0406+_0xe4c6('0xa6'),'headers':{'Authorization':_0xe4c6('0xa4')+_0x92b507,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x18dd5d);})[_0xe4c6('0x1b')](function(_0x22ba1d){_0x58bf59=_0x22ba1d;_0x442bdd=_0x58bf59[_0xe4c6('0xa7')];_0x442bdd=_['remove'](_0x442bdd,function(_0x3ff03f){return!_0x6670c5['includes'](_0x3ff03f[_0xe4c6('0xa8')]);});var _0x496606=[];var _0x3f0e40=[];_0x442bdd[_0xe4c6('0xa9')](function(_0x5b81fa){if(_0x5b81fa['@odata.type']){var _0x319fcc=_0x5b81fa[_0xe4c6('0xaa')][_0xe4c6('0xab')](_0x5b81fa[_0xe4c6('0xaa')]['lastIndexOf']('.')+0x1);if(_0x319fcc===_0xe4c6('0xac')){_0x496606['push'](getSelectList(_0x5388e5,_0x2d1d02,_0x3f0e40,_0x58bf59[_0xe4c6('0xa5')],_0x5b81fa[_0xe4c6('0xa5')],_0x92b507));}}});return Promise[_0xe4c6('0xad')](_0x496606);})[_0xe4c6('0x1b')](function(_0x3f19cf){_0x17b905=_0x3f19cf[0x0];var _0x2dc458=[];var _0x516e07=[];_0x442bdd['forEach'](function(_0x14b6c9){if(!_[_0xe4c6('0xae')](_0x14b6c9[_0xe4c6('0xaa')])){var _0x211fdb=_0x14b6c9[_0xe4c6('0xaa')]['substring'](_0x14b6c9[_0xe4c6('0xaa')]['lastIndexOf']('.')+0x1);if(_0x211fdb===_0xe4c6('0xaf')){_0x2dc458[_0xe4c6('0xb0')](getBooleanList(_0x5388e5,_0x2d1d02,_0x516e07,_0x58bf59[_0xe4c6('0xa5')],_0x14b6c9[_0xe4c6('0xa5')],_0x92b507));}}});return Promise[_0xe4c6('0xad')](_0x2dc458);})[_0xe4c6('0x1b')](function(_0x25680a){_0x99a6c4=_0x25680a[0x0];var _0x1f897b=[];var _0x3ffa1d=[];_0x442bdd[_0xe4c6('0xa9')](function(_0x206fb8){if(_0x206fb8[_0xe4c6('0xaa')]){var _0x1e24f5=_0x206fb8[_0xe4c6('0xaa')]['substring'](_0x206fb8[_0xe4c6('0xaa')]['lastIndexOf']('.')+0x1);if(_0x1e24f5===_0xe4c6('0xb1')||_0x1e24f5===_0xe4c6('0xb2')||_0x1e24f5==='BigIntAttributeMetadata'||_0x1e24f5===_0xe4c6('0xb3')||_0x1e24f5===_0xe4c6('0xb4')||_0x1e24f5===_0xe4c6('0xb5')||_0x1e24f5===_0xe4c6('0xb6')||_0x1e24f5===_0xe4c6('0xb7')||_0x1e24f5===_0xe4c6('0xb8')||_0x1e24f5==='DecimalAttributeMetadata'){_0x1f897b[_0xe4c6('0xb0')](getInputList(_0x5388e5,_0x2d1d02,_0x1e24f5,_0x3ffa1d,_0x58bf59[_0xe4c6('0xa5')],_0x206fb8['MetadataId'],_0x92b507));}}});return Promise[_0xe4c6('0xad')](_0x1f897b);})[_0xe4c6('0x1b')](function(_0x844f21){_0x109875=_0x844f21[0x0];var _0x3a4dce=_0x17b905[_0xe4c6('0x96')](_0x99a6c4)['concat'](_0x109875);var _0xdbd627={'count':_0x3a4dce[_0xe4c6('0x3e')],'rows':_0x3a4dce};return _0xdbd627;})[_0xe4c6('0x1b')](respondWithResult(_0x81a5d7,null))[_0xe4c6('0x4d')](function(_0x43940a){var _0x337ab5=_0xffc7aa[_0xe4c6('0x39')]['test']?0x1f4:_0x43940a[_0xe4c6('0xb9')]||0x1f4;logger[_0xe4c6('0x22')](_0x43940a[_0xe4c6('0xba')]);delete _0x43940a['name'];if(_0x337ab5===0x191){_0x337ab5=0x190;}_0x81a5d7[_0xe4c6('0x27')](_0x337ab5)[_0xe4c6('0x32')](_0xffc7aa[_0xe4c6('0x39')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x43940a[_0xe4c6('0xb9')]}:_0x43940a);});};function getSelectList(_0x4936b3,_0x5f3963,_0x581563,_0x3405ec,_0x42c859,_0x358c25){var _0x4b2af0={'method':_0xe4c6('0xa3'),'uri':_0x4936b3+_0xe4c6('0xbb')+_0x3405ec+_0xe4c6('0xbc')+_0x42c859+_0xe4c6('0xbd')+_0xe4c6('0xbe'),'headers':{'Authorization':_0xe4c6('0xa4')+_0x358c25,'If-None-Match':null,'OData-Version':_0xe4c6('0xbf')},'json':!![]};return rp(_0x4b2af0)[_0xe4c6('0x1b')](function(_0x1a0466){var _0x1847de=[];var _0x2d336b=_0x1a0466[_0xe4c6('0xc0')][_0xe4c6('0xc1')];_0x2d336b[_0xe4c6('0xa9')](function(_0x3bed0a){_0x1847de[_0xe4c6('0xb0')]({'name':_0x3bed0a[_0xe4c6('0xc2')][_0xe4c6('0xc3')][_0xe4c6('0xc2')],'value':String(_0x3bed0a[_0xe4c6('0xc4')])});});var _0x122222={'id':_0x5f3963+'_'+_0x1a0466['LogicalName'],'name':_0x1a0466[_0xe4c6('0xc5')][_0xe4c6('0xc3')][_0xe4c6('0xc2')],'custom':![],'options':_0x1847de};_0x581563[_0xe4c6('0xb0')](_0x122222);return _0x581563;});}function getBooleanList(_0x3acfac,_0x42d2c0,_0x322c84,_0x23c07d,_0x3ac2e0,_0x54a6d5){var _0x2d121c={'method':_0xe4c6('0xa3'),'uri':_0x3acfac+_0xe4c6('0xbb')+_0x23c07d+')/Attributes('+_0x3ac2e0+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xe4c6('0xa4')+_0x54a6d5,'If-None-Match':null,'OData-Version':_0xe4c6('0xbf')},'json':!![]};return rp(_0x2d121c)[_0xe4c6('0x1b')](function(_0x5bcc0d){var _0x4b6022=[];_0x4b6022[_0xe4c6('0xb0')]({'name':_0x5bcc0d['OptionSet'][_0xe4c6('0xc6')]['Label']['UserLocalizedLabel'][_0xe4c6('0xc2')],'value':_0xe4c6('0xc7')},{'name':_0x5bcc0d[_0xe4c6('0xc0')][_0xe4c6('0xc8')]['Label']['UserLocalizedLabel'][_0xe4c6('0xc2')],'value':_0xe4c6('0xc9')});var _0x1fa27e={'id':_0x42d2c0+'_'+_0x5bcc0d[_0xe4c6('0xa8')],'name':_0x5bcc0d['DisplayName']['UserLocalizedLabel'][_0xe4c6('0xc2')],'custom':![],'options':_0x4b6022};_0x322c84[_0xe4c6('0xb0')](_0x1fa27e);return _0x322c84;});}function getInputList(_0x1273b3,_0x4b96f3,_0x50bf65,_0x3a6469,_0x4a0649,_0xf51806,_0x3364d4){var _0x2ecab5={'method':_0xe4c6('0xa3'),'uri':_0x1273b3+_0xe4c6('0xbb')+_0x4a0649+_0xe4c6('0xbc')+_0xf51806+_0xe4c6('0xca')+_0x50bf65+_0xe4c6('0xcb'),'headers':{'Authorization':_0xe4c6('0xa4')+_0x3364d4,'If-None-Match':null,'OData-Version':_0xe4c6('0xbf')},'json':!![]};return rp(_0x2ecab5)[_0xe4c6('0x1b')](function(_0x55a796){var _0x1bde73={'id':_0x4b96f3+'_'+_0x55a796['LogicalName'],'name':_0x55a796['DisplayName'][_0xe4c6('0xc3')]?_0x55a796[_0xe4c6('0xc5')][_0xe4c6('0xc3')][_0xe4c6('0xc2')]:_0x55a796[_0xe4c6('0xa8')],'custom':![],'options':[]};_0x3a6469[_0xe4c6('0xb0')](_0x1bde73);return _0x3a6469;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 4b96941..2272d29 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 _0x97dd=['moment','bluebird','request-promise','rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','define','int_dynamics365_accounts','lodash','util','api'];(function(_0x578817,_0x48015a){var _0x52d645=function(_0x18e729){while(--_0x18e729){_0x578817['push'](_0x578817['shift']());}};_0x52d645(++_0x48015a);}(_0x97dd,0xef));var _0xd97d=function(_0x3172ef,_0x550ad4){_0x3172ef=_0x3172ef-0x0;var _0x513a7f=_0x97dd[_0x3172ef];return _0x513a7f;};'use strict';var _=require(_0xd97d('0x0'));var util=require(_0xd97d('0x1'));var logger=require('../../config/logger')(_0xd97d('0x2'));var moment=require(_0xd97d('0x3'));var BPromise=require(_0xd97d('0x4'));var rp=require(_0xd97d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd97d('0x6'));var config=require('../../config/environment');var attributes=require(_0xd97d('0x7'));var integrations=require(_0xd97d('0x8'));module['exports']=function(_0x2f1347,_0x362659){return _0x2f1347[_0xd97d('0x9')]('Dynamics365Account',attributes,{'tableName':_0xd97d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x183e=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_dynamics365_accounts'];(function(_0x47581f,_0x2cbf9c){var _0x169d4d=function(_0x43d3dd){while(--_0x43d3dd){_0x47581f['push'](_0x47581f['shift']());}};_0x169d4d(++_0x2cbf9c);}(_0x183e,0x193));var _0xe183=function(_0x3d492e,_0x3843b5){_0x3d492e=_0x3d492e-0x0;var _0x220848=_0x183e[_0x3d492e];return _0x220848;};'use strict';var _=require(_0xe183('0x0'));var util=require(_0xe183('0x1'));var logger=require(_0xe183('0x2'))('api');var moment=require(_0xe183('0x3'));var BPromise=require(_0xe183('0x4'));var rp=require(_0xe183('0x5'));var fs=require('fs');var path=require(_0xe183('0x6'));var rimraf=require(_0xe183('0x7'));var config=require(_0xe183('0x8'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0xe183('0x9'));module[_0xe183('0xa')]=function(_0x5e08ee,_0x1692c8){return _0x5e08ee[_0xe183('0xb')]('Dynamics365Account',attributes,{'tableName':_0xe183('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 7891efc..ee7fcac 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 _0x229c=['include','map','model','attributes','ShowDynamics365Account','find','raw','where','then','util','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','limit'];(function(_0x5d3641,_0x333ed9){var _0x447226=function(_0x2621ce){while(--_0x2621ce){_0x5d3641['push'](_0x5d3641['shift']());}};_0x447226(++_0x333ed9);}(_0x229c,0xcf));var _0xc229=function(_0x17cce2,_0x4210dc){_0x17cce2=_0x17cce2-0x0;var _0x41ad88=_0x229c[_0x17cce2];return _0x41ad88;};'use strict';var _=require('lodash');var util=require(_0xc229('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc229('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc229('0x2'));var logger=require('../../config/logger')(_0xc229('0x3'));var config=require(_0xc229('0x4'));var jayson=require(_0xc229('0x5'));var client=jayson['client'][_0xc229('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x52978a,_0x41ede5,_0x14cd26){return new BPromise(function(_0x504d48,_0x3fb59d){return client[_0xc229('0x7')](_0x52978a,_0x14cd26)['then'](function(_0x529822){logger[_0xc229('0x8')]('Dynamics365Account,\x20%s,\x20%s',_0x41ede5,'request\x20sent');logger[_0xc229('0x9')](_0xc229('0xa'),_0x41ede5,_0xc229('0xb'),JSON[_0xc229('0xc')](_0x529822));if(_0x529822[_0xc229('0xd')]){if(_0x529822[_0xc229('0xd')][_0xc229('0xe')]===0x1f4){logger[_0xc229('0xd')](_0xc229('0xf'),_0x41ede5,_0x529822[_0xc229('0xd')][_0xc229('0x10')]);return _0x3fb59d(_0x529822[_0xc229('0xd')][_0xc229('0x10')]);}logger['error'](_0xc229('0xf'),_0x41ede5,_0x529822['error'][_0xc229('0x10')]);return _0x504d48(_0x529822[_0xc229('0xd')][_0xc229('0x10')]);}else{logger[_0xc229('0x8')](_0xc229('0xf'),_0x41ede5,_0xc229('0xb'));_0x504d48(_0x529822[_0xc229('0x11')][_0xc229('0x10')]);}})[_0xc229('0x12')](function(_0x3c3b1c){logger[_0xc229('0xd')](_0xc229('0xf'),_0x41ede5,_0x3c3b1c);_0x3fb59d(_0x3c3b1c);});});}exports[_0xc229('0x13')]=function(_0x4cae05){var _0x379e41=this;return new Promise(function(_0x10339a,_0x393e8c){return db[_0xc229('0x14')][_0xc229('0x15')]({'raw':_0x4cae05[_0xc229('0x16')]?_0x4cae05[_0xc229('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4cae05['options']?_0x4cae05[_0xc229('0x16')]['where']||null:null,'attributes':_0x4cae05[_0xc229('0x16')]?_0x4cae05[_0xc229('0x16')]['attributes']||null:null,'limit':_0x4cae05['options']?_0x4cae05[_0xc229('0x16')][_0xc229('0x17')]||null:null,'include':_0x4cae05[_0xc229('0x16')]?_0x4cae05[_0xc229('0x16')][_0xc229('0x18')]?_[_0xc229('0x19')](_0x4cae05[_0xc229('0x16')]['include'],function(_0x5cb52f){return{'model':db[_0x5cb52f[_0xc229('0x1a')]],'as':_0x5cb52f['as'],'attributes':_0x5cb52f[_0xc229('0x1b')],'include':_0x5cb52f['include']?_['map'](_0x5cb52f[_0xc229('0x18')],function(_0x30c711){return{'model':db[_0x30c711[_0xc229('0x1a')]],'as':_0x30c711['as'],'attributes':_0x30c711[_0xc229('0x1b')],'include':_0x30c711[_0xc229('0x18')]?_[_0xc229('0x19')](_0x30c711['include'],function(_0x103d43){return{'model':db[_0x103d43[_0xc229('0x1a')]],'as':_0x103d43['as'],'attributes':_0x103d43[_0xc229('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x524908){logger[_0xc229('0x8')]('GetDynamics365Account',_0x4cae05);logger[_0xc229('0x9')](_0xc229('0x13'),_0x4cae05,JSON[_0xc229('0xc')](_0x524908));_0x10339a(_0x524908);})[_0xc229('0x12')](function(_0xfa1ba2){logger[_0xc229('0xd')](_0xc229('0x13'),_0xfa1ba2[_0xc229('0x10')],_0x4cae05);_0x393e8c(_0x379e41[_0xc229('0xd')](0x1f4,_0xfa1ba2[_0xc229('0x10')]));});});};exports[_0xc229('0x1c')]=function(_0x3aef16){var _0x4192d0=this;return new Promise(function(_0x25cd16,_0x2e7fe7){return db[_0xc229('0x14')][_0xc229('0x1d')]({'raw':_0x3aef16[_0xc229('0x16')]?_0x3aef16[_0xc229('0x16')][_0xc229('0x1e')]===undefined?!![]:![]:!![],'where':_0x3aef16[_0xc229('0x16')]?_0x3aef16['options'][_0xc229('0x1f')]||null:null,'attributes':_0x3aef16['options']?_0x3aef16[_0xc229('0x16')][_0xc229('0x1b')]||null:null,'include':_0x3aef16['options']?_0x3aef16[_0xc229('0x16')][_0xc229('0x18')]?_[_0xc229('0x19')](_0x3aef16[_0xc229('0x16')][_0xc229('0x18')],function(_0x42b7a3){return{'model':db[_0x42b7a3['model']],'as':_0x42b7a3['as'],'attributes':_0x42b7a3[_0xc229('0x1b')],'include':_0x42b7a3[_0xc229('0x18')]?_[_0xc229('0x19')](_0x42b7a3[_0xc229('0x18')],function(_0x39a7c2){return{'model':db[_0x39a7c2[_0xc229('0x1a')]],'as':_0x39a7c2['as'],'attributes':_0x39a7c2[_0xc229('0x1b')],'include':_0x39a7c2[_0xc229('0x18')]?_[_0xc229('0x19')](_0x39a7c2[_0xc229('0x18')],function(_0x31d5bb){return{'model':db[_0x31d5bb['model']],'as':_0x31d5bb['as'],'attributes':_0x31d5bb[_0xc229('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc229('0x20')](function(_0x251b4b){logger['info'](_0xc229('0x1c'),_0x3aef16);logger[_0xc229('0x9')]('ShowDynamics365Account',_0x3aef16,JSON['stringify'](_0x251b4b));_0x25cd16(_0x251b4b);})[_0xc229('0x12')](function(_0x4eafbd){logger['error']('ShowDynamics365Account',_0x4eafbd[_0xc229('0x10')],_0x3aef16);_0x2e7fe7(_0x4192d0['error'](0x1f4,_0x4eafbd['message']));});});}; \ No newline at end of file +var _0x5502=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','attributes','limit','include','map','model','stringify','ShowDynamics365Account','find','where','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x314085,_0x4235c6){var _0x26190a=function(_0x2314a2){while(--_0x2314a2){_0x314085['push'](_0x314085['shift']());}};_0x26190a(++_0x4235c6);}(_0x5502,0x69));var _0x2550=function(_0x3862d9,_0x483475){_0x3862d9=_0x3862d9-0x0;var _0x46877c=_0x5502[_0x3862d9];return _0x46877c;};'use strict';var _=require(_0x2550('0x0'));var util=require(_0x2550('0x1'));var moment=require(_0x2550('0x2'));var BPromise=require(_0x2550('0x3'));var rs=require(_0x2550('0x4'));var fs=require('fs');var Redis=require(_0x2550('0x5'));var db=require(_0x2550('0x6'))['db'];var utils=require(_0x2550('0x7'));var logger=require(_0x2550('0x8'))(_0x2550('0x9'));var config=require(_0x2550('0xa'));var jayson=require(_0x2550('0xb'));var client=jayson[_0x2550('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fdfc5,_0x557e76,_0x51a38d){return new BPromise(function(_0x410692,_0x40ead6){return client['request'](_0x1fdfc5,_0x51a38d)[_0x2550('0xd')](function(_0x59ac75){logger[_0x2550('0xe')](_0x2550('0xf'),_0x557e76,_0x2550('0x10'));logger[_0x2550('0x11')](_0x2550('0x12'),_0x557e76,_0x2550('0x10'),JSON['stringify'](_0x59ac75));if(_0x59ac75[_0x2550('0x13')]){if(_0x59ac75[_0x2550('0x13')][_0x2550('0x14')]===0x1f4){logger[_0x2550('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x557e76,_0x59ac75[_0x2550('0x13')][_0x2550('0x15')]);return _0x40ead6(_0x59ac75['error'][_0x2550('0x15')]);}logger[_0x2550('0x13')](_0x2550('0xf'),_0x557e76,_0x59ac75[_0x2550('0x13')][_0x2550('0x15')]);return _0x410692(_0x59ac75[_0x2550('0x13')]['message']);}else{logger[_0x2550('0xe')](_0x2550('0xf'),_0x557e76,_0x2550('0x10'));_0x410692(_0x59ac75[_0x2550('0x16')][_0x2550('0x15')]);}})[_0x2550('0x17')](function(_0x4fcabb){logger[_0x2550('0x13')](_0x2550('0xf'),_0x557e76,_0x4fcabb);_0x40ead6(_0x4fcabb);});});}exports[_0x2550('0x18')]=function(_0x5c1bcb){var _0x98f713=this;return new Promise(function(_0x5451de,_0x50d45d){return db[_0x2550('0x19')]['findAll']({'raw':_0x5c1bcb[_0x2550('0x1a')]?_0x5c1bcb[_0x2550('0x1a')][_0x2550('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c1bcb[_0x2550('0x1a')]?_0x5c1bcb[_0x2550('0x1a')]['where']||null:null,'attributes':_0x5c1bcb['options']?_0x5c1bcb['options'][_0x2550('0x1c')]||null:null,'limit':_0x5c1bcb[_0x2550('0x1a')]?_0x5c1bcb[_0x2550('0x1a')][_0x2550('0x1d')]||null:null,'include':_0x5c1bcb[_0x2550('0x1a')]?_0x5c1bcb[_0x2550('0x1a')][_0x2550('0x1e')]?_[_0x2550('0x1f')](_0x5c1bcb[_0x2550('0x1a')]['include'],function(_0x3dadc8){return{'model':db[_0x3dadc8[_0x2550('0x20')]],'as':_0x3dadc8['as'],'attributes':_0x3dadc8['attributes'],'include':_0x3dadc8[_0x2550('0x1e')]?_[_0x2550('0x1f')](_0x3dadc8['include'],function(_0x418828){return{'model':db[_0x418828[_0x2550('0x20')]],'as':_0x418828['as'],'attributes':_0x418828[_0x2550('0x1c')],'include':_0x418828[_0x2550('0x1e')]?_[_0x2550('0x1f')](_0x418828[_0x2550('0x1e')],function(_0x66ac37){return{'model':db[_0x66ac37[_0x2550('0x20')]],'as':_0x66ac37['as'],'attributes':_0x66ac37[_0x2550('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2550('0xd')](function(_0xe2744b){logger[_0x2550('0xe')](_0x2550('0x18'),_0x5c1bcb);logger['debug'](_0x2550('0x18'),_0x5c1bcb,JSON[_0x2550('0x21')](_0xe2744b));_0x5451de(_0xe2744b);})[_0x2550('0x17')](function(_0x38f07a){logger[_0x2550('0x13')](_0x2550('0x18'),_0x38f07a[_0x2550('0x15')],_0x5c1bcb);_0x50d45d(_0x98f713[_0x2550('0x13')](0x1f4,_0x38f07a[_0x2550('0x15')]));});});};exports[_0x2550('0x22')]=function(_0x222f62){var _0x3c6613=this;return new Promise(function(_0x561e7d,_0x3edad6){return db[_0x2550('0x19')][_0x2550('0x23')]({'raw':_0x222f62[_0x2550('0x1a')]?_0x222f62[_0x2550('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x222f62['options']?_0x222f62[_0x2550('0x1a')][_0x2550('0x24')]||null:null,'attributes':_0x222f62[_0x2550('0x1a')]?_0x222f62['options'][_0x2550('0x1c')]||null:null,'include':_0x222f62[_0x2550('0x1a')]?_0x222f62[_0x2550('0x1a')]['include']?_[_0x2550('0x1f')](_0x222f62[_0x2550('0x1a')][_0x2550('0x1e')],function(_0x5bce72){return{'model':db[_0x5bce72[_0x2550('0x20')]],'as':_0x5bce72['as'],'attributes':_0x5bce72['attributes'],'include':_0x5bce72[_0x2550('0x1e')]?_[_0x2550('0x1f')](_0x5bce72[_0x2550('0x1e')],function(_0x5dcf5a){return{'model':db[_0x5dcf5a[_0x2550('0x20')]],'as':_0x5dcf5a['as'],'attributes':_0x5dcf5a[_0x2550('0x1c')],'include':_0x5dcf5a['include']?_['map'](_0x5dcf5a[_0x2550('0x1e')],function(_0x40105b){return{'model':db[_0x40105b[_0x2550('0x20')]],'as':_0x40105b['as'],'attributes':_0x40105b[_0x2550('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2550('0xd')](function(_0x254456){logger[_0x2550('0xe')](_0x2550('0x22'),_0x222f62);logger[_0x2550('0x11')](_0x2550('0x22'),_0x222f62,JSON[_0x2550('0x21')](_0x254456));_0x561e7d(_0x254456);})[_0x2550('0x17')](function(_0x1f7e04){logger[_0x2550('0x13')](_0x2550('0x22'),_0x1f7e04['message'],_0x222f62);_0x3edad6(_0x3c6613['error'](0x1f4,_0x1f7e04[_0x2550('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index f6c1f5d..a0d8717 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 _0xb063=['/:id/subjects','/:id/descriptions','getDescriptions','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x89bddd,_0x5c50e8){var _0x3a10e6=function(_0x2c887f){while(--_0x2c887f){_0x89bddd['push'](_0x89bddd['shift']());}};_0x3a10e6(++_0x5c50e8);}(_0xb063,0x14a));var _0x3b06=function(_0x25df72,_0x3bc51e){_0x25df72=_0x25df72-0x0;var _0x4d9705=_0xb063[_0x25df72];return _0x4d9705;};'use strict';var multer=require('multer');var util=require(_0x3b06('0x0'));var path=require(_0x3b06('0x1'));var timeout=require(_0x3b06('0x2'));var express=require(_0x3b06('0x3'));var router=express[_0x3b06('0x4')]();var auth=require(_0x3b06('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3b06('0x6'));var controller=require(_0x3b06('0x7'));router[_0x3b06('0x8')]('/',auth[_0x3b06('0x9')](),controller[_0x3b06('0xa')]);router[_0x3b06('0x8')](_0x3b06('0xb'),auth[_0x3b06('0x9')](),controller[_0x3b06('0xc')]);router[_0x3b06('0x8')](_0x3b06('0xd'),auth[_0x3b06('0x9')](),controller[_0x3b06('0xe')]);router[_0x3b06('0x8')](_0x3b06('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x3b06('0x8')](_0x3b06('0x10'),auth[_0x3b06('0x9')](),controller[_0x3b06('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3b06('0x12')]);router[_0x3b06('0x13')](_0x3b06('0xb'),auth[_0x3b06('0x9')](),controller['update']);router[_0x3b06('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3b06('0x15')]);module[_0x3b06('0x16')]=router; \ No newline at end of file +var _0x48f9=['exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','destroy'];(function(_0x1381ad,_0x153441){var _0x7f4eec=function(_0x256cea){while(--_0x256cea){_0x1381ad['push'](_0x1381ad['shift']());}};_0x7f4eec(++_0x153441);}(_0x48f9,0x127));var _0x948f=function(_0x4bfbe7,_0x183140){_0x4bfbe7=_0x4bfbe7-0x0;var _0x5cb49f=_0x48f9[_0x4bfbe7];return _0x5cb49f;};'use strict';var multer=require(_0x948f('0x0'));var util=require(_0x948f('0x1'));var path=require(_0x948f('0x2'));var timeout=require(_0x948f('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x948f('0x4'));var interaction=require(_0x948f('0x5'));var config=require('../../config/environment');var controller=require(_0x948f('0x6'));router[_0x948f('0x7')]('/',auth[_0x948f('0x8')](),controller['index']);router[_0x948f('0x7')](_0x948f('0x9'),auth[_0x948f('0x8')](),controller[_0x948f('0xa')]);router[_0x948f('0x7')](_0x948f('0xb'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x948f('0xc'),auth[_0x948f('0x8')](),controller[_0x948f('0xd')]);router[_0x948f('0x7')](_0x948f('0xe'),auth[_0x948f('0x8')](),controller['getDescriptions']);router[_0x948f('0xf')]('/',auth[_0x948f('0x8')](),controller[_0x948f('0x10')]);router[_0x948f('0x11')]('/:id',auth[_0x948f('0x8')](),controller[_0x948f('0x12')]);router['delete'](_0x948f('0x9'),auth[_0x948f('0x8')](),controller[_0x948f('0x13')]);module[_0x948f('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 576233f..b27f5f7 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 _0x2838=['incident','phonecall','sequelize','STRING','ENUM'];(function(_0x214f72,_0x25a2c0){var _0x2398a8=function(_0x35e8db){while(--_0x35e8db){_0x214f72['push'](_0x214f72['shift']());}};_0x2398a8(++_0x25a2c0);}(_0x2838,0x98));var _0x8283=function(_0x5ad190,_0xd39c9e){_0x5ad190=_0x5ad190-0x0;var _0x518ed3=_0x2838[_0x5ad190];return _0x518ed3;};'use strict';var Sequelize=require(_0x8283('0x0'));module['exports']={'name':{'type':Sequelize[_0x8283('0x1')]},'description':{'type':Sequelize[_0x8283('0x1')]},'ticketType':{'type':Sequelize[_0x8283('0x2')](_0x8283('0x3'),_0x8283('0x4')),'defaultValue':_0x8283('0x3')}}; \ No newline at end of file +var _0x83be=['exports','STRING','ENUM','incident','phonecall','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x83be,0xa1));var _0xe83b=function(_0x515998,_0x2625ba){_0x515998=_0x515998-0x0;var _0x128304=_0x83be[_0x515998];return _0x128304;};'use strict';var Sequelize=require(_0xe83b('0x0'));module[_0xe83b('0x1')]={'name':{'type':Sequelize[_0xe83b('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xe83b('0x3')](_0xe83b('0x4'),_0xe83b('0x5')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index e707cdc..0da9c76 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 _0xc8bd=['VIRTUAL','options','Dynamics365Configuration','count','includeAll','include','rows','catch','show','params','keys','intersection','find','create','body','update','destroy','findOne','Dynamics365Field','getFields','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','jayson/promise','http','test','Sequelize','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','json','offset','limit','set','reject','save','end','stack','name','send','index','map','rawAttributes','type','key','query','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x228967,_0x170481){var _0x2492a5=function(_0x26a165){while(--_0x26a165){_0x228967['push'](_0x228967['shift']());}};_0x2492a5(++_0x170481);}(_0xc8bd,0x70));var _0xdc8b=function(_0x32083e,_0x130a41){_0x32083e=_0x32083e-0x0;var _0x1efcc7=_0xc8bd[_0x32083e];return _0x1efcc7;};'use strict';var pdf=require(_0xdc8b('0x0'));var emlformat=require(_0xdc8b('0x1'));var rimraf=require(_0xdc8b('0x2'));var zipdir=require(_0xdc8b('0x3'));var jsonpatch=require(_0xdc8b('0x4'));var rp=require(_0xdc8b('0x5'));var moment=require(_0xdc8b('0x6'));var BPromise=require(_0xdc8b('0x7'));var Mustache=require(_0xdc8b('0x8'));var util=require('util');var path=require('path');var sox=require(_0xdc8b('0x9'));var csv=require(_0xdc8b('0xa'));var ejs=require(_0xdc8b('0xb'));var fs=require('fs');var _=require(_0xdc8b('0xc'));var squel=require(_0xdc8b('0xd'));var crypto=require(_0xdc8b('0xe'));var jsforce=require(_0xdc8b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdc8b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdc8b('0x10'));var authService=require(_0xdc8b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc8b('0x12'))(_0xdc8b('0x13'));var utils=require('../../config/utils');var config=require(_0xdc8b('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xdc8b('0x15'));var client=jayson['client'][_0xdc8b('0x16')]({'port':0x232a});function checkPasswordPattern(_0x4ae68a,_0x4235ac,_0xa4b70c){if(_0xa4b70c){var _0x16d3a8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16d3a8[_0xdc8b('0x17')](_0x4235ac)){return _0x4ae68a;}else{throw new db[(_0xdc8b('0x18'))]['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 _0x4ae68a;}}function respondWithRpcPromise(_0x209206,_0x5d3100,_0x37b2de,_0x136247){return new BPromise(function(_0x3108f4,_0x1fcc68){var _0x33eca2=_0x136247||client;return _0x33eca2[_0xdc8b('0x19')](_0x209206,_0x37b2de)[_0xdc8b('0x1a')](function(_0x37349c){logger['info'](_0xdc8b('0x1b'),_0x5d3100,_0xdc8b('0x1c'));logger[_0xdc8b('0x1d')](_0xdc8b('0x1e'),_0x5d3100,'request\x20sent',JSON[_0xdc8b('0x1f')](_0x37349c));if(_0x37349c[_0xdc8b('0x20')]){if(_0x37349c[_0xdc8b('0x20')]['code']===0x1f4){logger[_0xdc8b('0x20')](_0xdc8b('0x1b'),_0x5d3100,_0x37349c[_0xdc8b('0x20')][_0xdc8b('0x21')]);return _0x1fcc68(_0x37349c['error'][_0xdc8b('0x21')]);}logger[_0xdc8b('0x20')](_0xdc8b('0x1b'),_0x5d3100,_0x37349c['error'][_0xdc8b('0x21')]);return _0x3108f4(_0x37349c[_0xdc8b('0x20')]['message']);}else{logger[_0xdc8b('0x22')](_0xdc8b('0x1b'),_0x5d3100,_0xdc8b('0x1c'));_0x3108f4(_0x37349c[_0xdc8b('0x23')][_0xdc8b('0x21')]);}})['catch'](function(_0x2cda3a){logger[_0xdc8b('0x20')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5d3100,_0x2cda3a);_0x1fcc68(_0x2cda3a);});});}function respondWithStatusCode(_0x14367a,_0x585b12){_0x585b12=_0x585b12||0xcc;return function(_0x3da890){if(_0x3da890){return _0x14367a[_0xdc8b('0x24')](_0x585b12);}return _0x14367a[_0xdc8b('0x25')](_0x585b12)['end']();};}function respondWithResult(_0x2b08d5,_0x129dc6){_0x129dc6=_0x129dc6||0xc8;return function(_0x34bee1){if(_0x34bee1){return _0x2b08d5['status'](_0x129dc6)[_0xdc8b('0x26')](_0x34bee1);}};}function respondWithFilteredResult(_0x7b86fc,_0x24895e){return function(_0x5c3a0e){if(_0x5c3a0e){var _0x9d0d80=_0x5c3a0e['count'],_0x53b1e0=_0x24895e['offset'],_0x49fd3b=_0x24895e[_0xdc8b('0x27')]+_0x24895e[_0xdc8b('0x28')],_0x4e9867;if(_0x49fd3b>=_0x9d0d80){_0x49fd3b=_0x9d0d80;_0x4e9867=0xc8;}else{_0x4e9867=0xce;}_0x7b86fc['status'](_0x4e9867);return _0x7b86fc[_0xdc8b('0x29')]('Content-Range',_0x53b1e0+'-'+_0x49fd3b+'/'+_0x9d0d80)[_0xdc8b('0x26')](_0x5c3a0e);}return null;};}function patchUpdates(_0x2243b9){return function(_0x1322a0){try{jsonpatch['apply'](_0x1322a0,_0x2243b9,!![]);}catch(_0x548457){return BPromise[_0xdc8b('0x2a')](_0x548457);}return _0x1322a0[_0xdc8b('0x2b')]();};}function saveUpdates(_0x4b5bf7,_0x3cf77a){return function(_0xfa8a16){if(_0xfa8a16){return _0xfa8a16['update'](_0x4b5bf7)[_0xdc8b('0x1a')](function(_0x557e2b){return _0x557e2b;});}return null;};}function removeEntity(_0x536c12,_0x226bc5){return function(_0x26f62b){if(_0x26f62b){return _0x26f62b['destroy']()[_0xdc8b('0x1a')](function(){_0x536c12[_0xdc8b('0x25')](0xcc)[_0xdc8b('0x2c')]();});}};}function handleEntityNotFound(_0x1ba8d8,_0x1d1114){return function(_0x1723a2){if(!_0x1723a2){_0x1ba8d8['sendStatus'](0x194);}return _0x1723a2;};}function handleError(_0x51cbbe,_0x1f2869){_0x1f2869=_0x1f2869||0x1f4;return function(_0x4c8d3e){logger[_0xdc8b('0x20')](_0x4c8d3e[_0xdc8b('0x2d')]);if(_0x4c8d3e[_0xdc8b('0x2e')]){delete _0x4c8d3e[_0xdc8b('0x2e')];}_0x51cbbe[_0xdc8b('0x25')](_0x1f2869)[_0xdc8b('0x2f')](_0x4c8d3e);};}exports[_0xdc8b('0x30')]=function(_0x52aad9,_0xaf5a1b){var _0x5436c5={},_0x523c04={},_0x310311={'count':0x0,'rows':[]};var _0x3224dc=_[_0xdc8b('0x31')](db['Dynamics365Configuration'][_0xdc8b('0x32')],function(_0x1c0842){return{'name':_0x1c0842['fieldName'],'type':_0x1c0842[_0xdc8b('0x33')][_0xdc8b('0x34')]};});_0x523c04['model']=_[_0xdc8b('0x31')](_0x3224dc,_0xdc8b('0x2e'));_0x523c04[_0xdc8b('0x35')]=_['keys'](_0x52aad9[_0xdc8b('0x35')]);_0x523c04[_0xdc8b('0x36')]=_['intersection'](_0x523c04[_0xdc8b('0x37')],_0x523c04[_0xdc8b('0x35')]);_0x5436c5[_0xdc8b('0x38')]=_['intersection'](_0x523c04[_0xdc8b('0x37')],qs[_0xdc8b('0x39')](_0x52aad9[_0xdc8b('0x35')][_0xdc8b('0x39')]));_0x5436c5[_0xdc8b('0x38')]=_0x5436c5[_0xdc8b('0x38')][_0xdc8b('0x3a')]?_0x5436c5[_0xdc8b('0x38')]:_0x523c04['model'];if(!_0x52aad9[_0xdc8b('0x35')][_0xdc8b('0x3b')]('nolimit')){_0x5436c5[_0xdc8b('0x28')]=qs['limit'](_0x52aad9[_0xdc8b('0x35')][_0xdc8b('0x28')]);_0x5436c5[_0xdc8b('0x27')]=qs['offset'](_0x52aad9[_0xdc8b('0x35')][_0xdc8b('0x27')]);}_0x5436c5[_0xdc8b('0x3c')]=qs['sort'](_0x52aad9[_0xdc8b('0x35')][_0xdc8b('0x3d')]);_0x5436c5[_0xdc8b('0x3e')]=qs[_0xdc8b('0x36')](_[_0xdc8b('0x3f')](_0x52aad9[_0xdc8b('0x35')],_0x523c04['filters']),_0x3224dc);if(_0x52aad9[_0xdc8b('0x35')][_0xdc8b('0x40')]){_0x5436c5[_0xdc8b('0x3e')]=_[_0xdc8b('0x41')](_0x5436c5[_0xdc8b('0x3e')],{'$or':_[_0xdc8b('0x31')](_0x3224dc,function(_0x132552){if(_0x132552['type']!==_0xdc8b('0x42')){var _0x228286={};_0x228286[_0x132552[_0xdc8b('0x2e')]]={'$like':'%'+_0x52aad9['query'][_0xdc8b('0x40')]+'%'};return _0x228286;}})});}_0x5436c5=_['merge']({},_0x5436c5,_0x52aad9[_0xdc8b('0x43')]);var _0x28d0ad={'where':_0x5436c5[_0xdc8b('0x3e')]};return db[_0xdc8b('0x44')][_0xdc8b('0x45')](_0x28d0ad)[_0xdc8b('0x1a')](function(_0x170538){_0x310311[_0xdc8b('0x45')]=_0x170538;if(_0x52aad9['query'][_0xdc8b('0x46')]){_0x5436c5[_0xdc8b('0x47')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x5436c5);})[_0xdc8b('0x1a')](function(_0x21b62f){_0x310311[_0xdc8b('0x48')]=_0x21b62f;return _0x310311;})[_0xdc8b('0x1a')](respondWithFilteredResult(_0xaf5a1b,_0x5436c5))[_0xdc8b('0x49')](handleError(_0xaf5a1b,null));};exports[_0xdc8b('0x4a')]=function(_0x4bf6d7,_0x2653a2){var _0x218f1b={'raw':![],'where':{'id':_0x4bf6d7[_0xdc8b('0x4b')]['id']}},_0x388914={};_0x388914['model']=_[_0xdc8b('0x4c')](db[_0xdc8b('0x44')][_0xdc8b('0x32')]);_0x388914[_0xdc8b('0x35')]=_[_0xdc8b('0x4c')](_0x4bf6d7[_0xdc8b('0x35')]);_0x388914[_0xdc8b('0x36')]=_[_0xdc8b('0x4d')](_0x388914['model'],_0x388914[_0xdc8b('0x35')]);_0x218f1b['attributes']=_['intersection'](_0x388914[_0xdc8b('0x37')],qs[_0xdc8b('0x39')](_0x4bf6d7[_0xdc8b('0x35')][_0xdc8b('0x39')]));_0x218f1b[_0xdc8b('0x38')]=_0x218f1b[_0xdc8b('0x38')][_0xdc8b('0x3a')]?_0x218f1b[_0xdc8b('0x38')]:_0x388914[_0xdc8b('0x37')];if(_0x4bf6d7[_0xdc8b('0x35')][_0xdc8b('0x46')]){_0x218f1b[_0xdc8b('0x47')]=[{'all':!![]}];}_0x218f1b=_[_0xdc8b('0x41')]({},_0x218f1b,_0x4bf6d7[_0xdc8b('0x43')]);return db[_0xdc8b('0x44')][_0xdc8b('0x4e')](_0x218f1b)['then'](handleEntityNotFound(_0x2653a2,null))['then'](respondWithResult(_0x2653a2,null))[_0xdc8b('0x49')](handleError(_0x2653a2,null));};exports[_0xdc8b('0x4f')]=function(_0x3b6d65,_0x545e47){return db['Dynamics365Configuration'][_0xdc8b('0x4f')](_0x3b6d65[_0xdc8b('0x50')],{})[_0xdc8b('0x1a')](respondWithResult(_0x545e47,0xc9))[_0xdc8b('0x49')](handleError(_0x545e47,null));};exports[_0xdc8b('0x51')]=function(_0x45d6fb,_0x4f70eb){if(_0x45d6fb['body']['id']){delete _0x45d6fb[_0xdc8b('0x50')]['id'];}return db['Dynamics365Configuration'][_0xdc8b('0x4e')]({'where':{'id':_0x45d6fb[_0xdc8b('0x4b')]['id']}})[_0xdc8b('0x1a')](handleEntityNotFound(_0x4f70eb,null))[_0xdc8b('0x1a')](saveUpdates(_0x45d6fb[_0xdc8b('0x50')],null))['then'](respondWithResult(_0x4f70eb,null))[_0xdc8b('0x49')](handleError(_0x4f70eb,null));};exports[_0xdc8b('0x52')]=function(_0x43b8b9,_0x25b792){return db[_0xdc8b('0x44')][_0xdc8b('0x4e')]({'where':{'id':_0x43b8b9[_0xdc8b('0x4b')]['id']}})[_0xdc8b('0x1a')](handleEntityNotFound(_0x25b792,null))[_0xdc8b('0x1a')](removeEntity(_0x25b792,null))[_0xdc8b('0x49')](handleError(_0x25b792,null));};exports['getFields']=function(_0x3c857b,_0x4baa74,_0x296bba){var _0x10e0d0={};var _0x2cf331={};var _0x469f78;var _0xf3ecd4;return db['Dynamics365Configuration'][_0xdc8b('0x53')]({'where':{'id':_0x3c857b[_0xdc8b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4baa74,null))[_0xdc8b('0x1a')](function(_0xacad96){if(_0xacad96){_0x469f78=_0xacad96;_0x2cf331[_0xdc8b('0x37')]=_[_0xdc8b('0x4c')](db[_0xdc8b('0x54')]['rawAttributes']);_0x2cf331['query']=_['keys'](_0x3c857b[_0xdc8b('0x35')]);_0x2cf331[_0xdc8b('0x36')]=_['intersection'](_0x2cf331['model'],_0x2cf331['query']);_0x10e0d0['attributes']=_[_0xdc8b('0x4d')](_0x2cf331[_0xdc8b('0x37')],qs[_0xdc8b('0x39')](_0x3c857b[_0xdc8b('0x35')][_0xdc8b('0x39')]));_0x10e0d0[_0xdc8b('0x38')]=_0x10e0d0[_0xdc8b('0x38')][_0xdc8b('0x3a')]?_0x10e0d0[_0xdc8b('0x38')]:_0x2cf331['model'];_0x10e0d0['order']=qs[_0xdc8b('0x3d')](_0x3c857b['query'][_0xdc8b('0x3d')]);_0x10e0d0[_0xdc8b('0x3e')]=qs['filters'](_[_0xdc8b('0x3f')](_0x3c857b[_0xdc8b('0x35')],_0x2cf331['filters']));if(_0x3c857b[_0xdc8b('0x35')][_0xdc8b('0x40')]){_0x10e0d0['where']=_[_0xdc8b('0x41')](_0x10e0d0[_0xdc8b('0x3e')],{'$or':_['map'](_0x10e0d0[_0xdc8b('0x38')],function(_0x495289){var _0x499762={};_0x499762[_0x495289]={'$like':'%'+_0x3c857b[_0xdc8b('0x35')]['filter']+'%'};return _0x499762;})});}_0x10e0d0=_[_0xdc8b('0x41')]({},_0x10e0d0,_0x3c857b['options']);return _0x469f78[_0xdc8b('0x55')](_0x10e0d0);}})['then'](function(_0xd0039d){if(_0xd0039d){_0xf3ecd4=_0xd0039d[_0xdc8b('0x3a')];if(!_0x3c857b[_0xdc8b('0x35')][_0xdc8b('0x3b')](_0xdc8b('0x56'))){_0x10e0d0[_0xdc8b('0x28')]=qs[_0xdc8b('0x28')](_0x3c857b[_0xdc8b('0x35')]['limit']);_0x10e0d0[_0xdc8b('0x27')]=qs['offset'](_0x3c857b[_0xdc8b('0x35')]['offset']);}return _0x469f78[_0xdc8b('0x55')](_0x10e0d0);}})[_0xdc8b('0x1a')](function(_0x2b2236){if(_0x2b2236){return _0x2b2236?{'count':_0xf3ecd4,'rows':_0x2b2236}:null;}})[_0xdc8b('0x1a')](respondWithResult(_0x4baa74,null))[_0xdc8b('0x49')](handleError(_0x4baa74,null));};exports[_0xdc8b('0x57')]=function(_0x56222f,_0x377c79,_0x451ed1){var _0x1c9c43={};var _0x3da95d={};var _0x23a1ab;var _0x227a6e;return db[_0xdc8b('0x44')][_0xdc8b('0x53')]({'where':{'id':_0x56222f[_0xdc8b('0x4b')]['id']}})[_0xdc8b('0x1a')](handleEntityNotFound(_0x377c79,null))['then'](function(_0x1efbd8){if(_0x1efbd8){_0x23a1ab=_0x1efbd8;_0x3da95d['model']=_[_0xdc8b('0x4c')](db[_0xdc8b('0x54')]['rawAttributes']);_0x3da95d[_0xdc8b('0x35')]=_[_0xdc8b('0x4c')](_0x56222f[_0xdc8b('0x35')]);_0x3da95d[_0xdc8b('0x36')]=_[_0xdc8b('0x4d')](_0x3da95d[_0xdc8b('0x37')],_0x3da95d[_0xdc8b('0x35')]);_0x1c9c43[_0xdc8b('0x38')]=_[_0xdc8b('0x4d')](_0x3da95d[_0xdc8b('0x37')],qs[_0xdc8b('0x39')](_0x56222f[_0xdc8b('0x35')][_0xdc8b('0x39')]));_0x1c9c43[_0xdc8b('0x38')]=_0x1c9c43['attributes'][_0xdc8b('0x3a')]?_0x1c9c43[_0xdc8b('0x38')]:_0x3da95d[_0xdc8b('0x37')];_0x1c9c43[_0xdc8b('0x3c')]=qs[_0xdc8b('0x3d')](_0x56222f['query']['sort']);_0x1c9c43['where']=qs[_0xdc8b('0x36')](_[_0xdc8b('0x3f')](_0x56222f[_0xdc8b('0x35')],_0x3da95d[_0xdc8b('0x36')]));if(_0x56222f[_0xdc8b('0x35')][_0xdc8b('0x40')]){_0x1c9c43[_0xdc8b('0x3e')]=_[_0xdc8b('0x41')](_0x1c9c43['where'],{'$or':_['map'](_0x1c9c43[_0xdc8b('0x38')],function(_0x3f0740){var _0x643dfb={};_0x643dfb[_0x3f0740]={'$like':'%'+_0x56222f[_0xdc8b('0x35')][_0xdc8b('0x40')]+'%'};return _0x643dfb;})});}_0x1c9c43=_[_0xdc8b('0x41')]({},_0x1c9c43,_0x56222f[_0xdc8b('0x43')]);return _0x23a1ab[_0xdc8b('0x57')](_0x1c9c43);}})[_0xdc8b('0x1a')](function(_0x33e0ff){if(_0x33e0ff){_0x227a6e=_0x33e0ff['length'];if(!_0x56222f[_0xdc8b('0x35')]['hasOwnProperty'](_0xdc8b('0x56'))){_0x1c9c43[_0xdc8b('0x28')]=qs['limit'](_0x56222f[_0xdc8b('0x35')]['limit']);_0x1c9c43['offset']=qs['offset'](_0x56222f[_0xdc8b('0x35')][_0xdc8b('0x27')]);}return _0x23a1ab[_0xdc8b('0x57')](_0x1c9c43);}})[_0xdc8b('0x1a')](function(_0xd76f30){if(_0xd76f30){return _0xd76f30?{'count':_0x227a6e,'rows':_0xd76f30}:null;}})[_0xdc8b('0x1a')](respondWithResult(_0x377c79,null))['catch'](handleError(_0x377c79,null));};exports['getDescriptions']=function(_0x5c0e8a,_0x162769,_0x24cd5f){var _0x5cc534={};var _0x1694bf={};var _0x4a26a3;var _0x124951;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x5c0e8a[_0xdc8b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x162769,null))[_0xdc8b('0x1a')](function(_0x57e123){if(_0x57e123){_0x4a26a3=_0x57e123;_0x1694bf[_0xdc8b('0x37')]=_[_0xdc8b('0x4c')](db[_0xdc8b('0x54')]['rawAttributes']);_0x1694bf['query']=_['keys'](_0x5c0e8a['query']);_0x1694bf[_0xdc8b('0x36')]=_['intersection'](_0x1694bf['model'],_0x1694bf[_0xdc8b('0x35')]);_0x5cc534['attributes']=_['intersection'](_0x1694bf[_0xdc8b('0x37')],qs['fields'](_0x5c0e8a[_0xdc8b('0x35')]['fields']));_0x5cc534[_0xdc8b('0x38')]=_0x5cc534['attributes'][_0xdc8b('0x3a')]?_0x5cc534[_0xdc8b('0x38')]:_0x1694bf[_0xdc8b('0x37')];_0x5cc534[_0xdc8b('0x3c')]=qs[_0xdc8b('0x3d')](_0x5c0e8a[_0xdc8b('0x35')][_0xdc8b('0x3d')]);_0x5cc534[_0xdc8b('0x3e')]=qs[_0xdc8b('0x36')](_[_0xdc8b('0x3f')](_0x5c0e8a[_0xdc8b('0x35')],_0x1694bf[_0xdc8b('0x36')]));if(_0x5c0e8a[_0xdc8b('0x35')][_0xdc8b('0x40')]){_0x5cc534[_0xdc8b('0x3e')]=_[_0xdc8b('0x41')](_0x5cc534[_0xdc8b('0x3e')],{'$or':_['map'](_0x5cc534[_0xdc8b('0x38')],function(_0xe1214c){var _0x110604={};_0x110604[_0xe1214c]={'$like':'%'+_0x5c0e8a[_0xdc8b('0x35')]['filter']+'%'};return _0x110604;})});}_0x5cc534=_['merge']({},_0x5cc534,_0x5c0e8a['options']);return _0x4a26a3[_0xdc8b('0x58')](_0x5cc534);}})[_0xdc8b('0x1a')](function(_0x43a56d){if(_0x43a56d){_0x124951=_0x43a56d[_0xdc8b('0x3a')];if(!_0x5c0e8a['query']['hasOwnProperty'](_0xdc8b('0x56'))){_0x5cc534[_0xdc8b('0x28')]=qs[_0xdc8b('0x28')](_0x5c0e8a[_0xdc8b('0x35')][_0xdc8b('0x28')]);_0x5cc534['offset']=qs['offset'](_0x5c0e8a[_0xdc8b('0x35')]['offset']);}return _0x4a26a3[_0xdc8b('0x58')](_0x5cc534);}})['then'](function(_0x3ab43e){if(_0x3ab43e){return _0x3ab43e?{'count':_0x124951,'rows':_0x3ab43e}:null;}})[_0xdc8b('0x1a')](respondWithResult(_0x162769,null))[_0xdc8b('0x49')](handleError(_0x162769,null));}; \ No newline at end of file +var _0x5dd6=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','Content-Range','apply','reject','update','end','stack','name','send','index','Dynamics365Configuration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','filter','map','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','keys','find','create','body','destroy','findOne','Dynamics365Field','order','getFields','getSubjects','hasOwnProperty','length','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x5dd6,0x1b3));var _0x65dd=function(_0x480ee3,_0x4ce5b6){_0x480ee3=_0x480ee3-0x0;var _0x378987=_0x5dd6[_0x480ee3];return _0x378987;};'use strict';var pdf=require(_0x65dd('0x0'));var emlformat=require(_0x65dd('0x1'));var rimraf=require(_0x65dd('0x2'));var zipdir=require(_0x65dd('0x3'));var jsonpatch=require(_0x65dd('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x65dd('0x5'));var path=require(_0x65dd('0x6'));var sox=require(_0x65dd('0x7'));var csv=require(_0x65dd('0x8'));var ejs=require(_0x65dd('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x65dd('0xa'));var crypto=require(_0x65dd('0xb'));var jsforce=require(_0x65dd('0xc'));var deskjs=require(_0x65dd('0xd'));var toCsv=require(_0x65dd('0x8'));var querystring=require(_0x65dd('0xe'));var Papa=require(_0x65dd('0xf'));var Redis=require(_0x65dd('0x10'));var authService=require(_0x65dd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x65dd('0x12'));var hardwareService=require(_0x65dd('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x65dd('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x65dd('0x15'));var client=jayson[_0x65dd('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0xcd14b0,_0xc0401c,_0x375e8f){if(_0x375e8f){var _0x2ddab7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ddab7[_0x65dd('0x17')](_0xc0401c)){return _0xcd14b0;}else{throw new db[(_0x65dd('0x18'))][(_0x65dd('0x19'))](_0x65dd('0x1a'));}}else{return _0xcd14b0;}}function respondWithRpcPromise(_0x4fba64,_0x7d0d36,_0x1a5ed7,_0x377823){return new BPromise(function(_0x455f0a,_0x264c41){var _0x2929b5=_0x377823||client;return _0x2929b5[_0x65dd('0x1b')](_0x4fba64,_0x1a5ed7)[_0x65dd('0x1c')](function(_0x8e67f7){logger[_0x65dd('0x1d')](_0x65dd('0x1e'),_0x7d0d36,_0x65dd('0x1f'));logger[_0x65dd('0x20')](_0x65dd('0x21'),_0x7d0d36,_0x65dd('0x1f'),JSON[_0x65dd('0x22')](_0x8e67f7));if(_0x8e67f7[_0x65dd('0x23')]){if(_0x8e67f7['error'][_0x65dd('0x24')]===0x1f4){logger[_0x65dd('0x23')](_0x65dd('0x1e'),_0x7d0d36,_0x8e67f7['error'][_0x65dd('0x25')]);return _0x264c41(_0x8e67f7[_0x65dd('0x23')][_0x65dd('0x25')]);}logger[_0x65dd('0x23')](_0x65dd('0x1e'),_0x7d0d36,_0x8e67f7[_0x65dd('0x23')][_0x65dd('0x25')]);return _0x455f0a(_0x8e67f7[_0x65dd('0x23')][_0x65dd('0x25')]);}else{logger['info'](_0x65dd('0x1e'),_0x7d0d36,_0x65dd('0x1f'));_0x455f0a(_0x8e67f7[_0x65dd('0x26')][_0x65dd('0x25')]);}})[_0x65dd('0x27')](function(_0x5d2db5){logger[_0x65dd('0x23')](_0x65dd('0x1e'),_0x7d0d36,_0x5d2db5);_0x264c41(_0x5d2db5);});});}function respondWithStatusCode(_0x11e77e,_0x755344){_0x755344=_0x755344||0xcc;return function(_0x4f041a){if(_0x4f041a){return _0x11e77e[_0x65dd('0x28')](_0x755344);}return _0x11e77e[_0x65dd('0x29')](_0x755344)['end']();};}function respondWithResult(_0xbba743,_0x39bb28){_0x39bb28=_0x39bb28||0xc8;return function(_0x3b8e1d){if(_0x3b8e1d){return _0xbba743[_0x65dd('0x29')](_0x39bb28)[_0x65dd('0x2a')](_0x3b8e1d);}};}function respondWithFilteredResult(_0x4b3f38,_0x5798a5){return function(_0x4d68f8){if(_0x4d68f8){var _0x2de836=_0x4d68f8['count'],_0x352b02=_0x5798a5[_0x65dd('0x2b')],_0x503ea1=_0x5798a5[_0x65dd('0x2b')]+_0x5798a5['limit'],_0x483a4e;if(_0x503ea1>=_0x2de836){_0x503ea1=_0x2de836;_0x483a4e=0xc8;}else{_0x483a4e=0xce;}_0x4b3f38[_0x65dd('0x29')](_0x483a4e);return _0x4b3f38['set'](_0x65dd('0x2c'),_0x352b02+'-'+_0x503ea1+'/'+_0x2de836)[_0x65dd('0x2a')](_0x4d68f8);}return null;};}function patchUpdates(_0x1fe927){return function(_0x581e4a){try{jsonpatch[_0x65dd('0x2d')](_0x581e4a,_0x1fe927,!![]);}catch(_0x34317b){return BPromise[_0x65dd('0x2e')](_0x34317b);}return _0x581e4a['save']();};}function saveUpdates(_0x1bb030,_0x58077c){return function(_0x109464){if(_0x109464){return _0x109464[_0x65dd('0x2f')](_0x1bb030)[_0x65dd('0x1c')](function(_0x433e87){return _0x433e87;});}return null;};}function removeEntity(_0x966a31,_0x358168){return function(_0x75fedc){if(_0x75fedc){return _0x75fedc['destroy']()['then'](function(){_0x966a31['status'](0xcc)[_0x65dd('0x30')]();});}};}function handleEntityNotFound(_0x2ed8c0,_0x2f73c6){return function(_0x1212b7){if(!_0x1212b7){_0x2ed8c0[_0x65dd('0x28')](0x194);}return _0x1212b7;};}function handleError(_0x6b587a,_0x1bebb1){_0x1bebb1=_0x1bebb1||0x1f4;return function(_0x52569c){logger[_0x65dd('0x23')](_0x52569c[_0x65dd('0x31')]);if(_0x52569c[_0x65dd('0x32')]){delete _0x52569c[_0x65dd('0x32')];}_0x6b587a['status'](_0x1bebb1)[_0x65dd('0x33')](_0x52569c);};}exports[_0x65dd('0x34')]=function(_0x578a6a,_0x557836){var _0x3f3e54={},_0x421540={},_0x4d98b8={'count':0x0,'rows':[]};var _0xc9eebf=_['map'](db[_0x65dd('0x35')][_0x65dd('0x36')],function(_0x47ea2a){return{'name':_0x47ea2a['fieldName'],'type':_0x47ea2a[_0x65dd('0x37')][_0x65dd('0x38')]};});_0x421540[_0x65dd('0x39')]=_['map'](_0xc9eebf,_0x65dd('0x32'));_0x421540[_0x65dd('0x3a')]=_['keys'](_0x578a6a['query']);_0x421540[_0x65dd('0x3b')]=_[_0x65dd('0x3c')](_0x421540['model'],_0x421540['query']);_0x3f3e54[_0x65dd('0x3d')]=_[_0x65dd('0x3c')](_0x421540[_0x65dd('0x39')],qs[_0x65dd('0x3e')](_0x578a6a[_0x65dd('0x3a')][_0x65dd('0x3e')]));_0x3f3e54[_0x65dd('0x3d')]=_0x3f3e54[_0x65dd('0x3d')]['length']?_0x3f3e54['attributes']:_0x421540[_0x65dd('0x39')];if(!_0x578a6a['query']['hasOwnProperty'](_0x65dd('0x3f'))){_0x3f3e54[_0x65dd('0x40')]=qs[_0x65dd('0x40')](_0x578a6a[_0x65dd('0x3a')][_0x65dd('0x40')]);_0x3f3e54[_0x65dd('0x2b')]=qs['offset'](_0x578a6a[_0x65dd('0x3a')][_0x65dd('0x2b')]);}_0x3f3e54['order']=qs[_0x65dd('0x41')](_0x578a6a[_0x65dd('0x3a')]['sort']);_0x3f3e54[_0x65dd('0x42')]=qs[_0x65dd('0x3b')](_[_0x65dd('0x43')](_0x578a6a[_0x65dd('0x3a')],_0x421540['filters']),_0xc9eebf);if(_0x578a6a[_0x65dd('0x3a')][_0x65dd('0x44')]){_0x3f3e54[_0x65dd('0x42')]=_['merge'](_0x3f3e54[_0x65dd('0x42')],{'$or':_[_0x65dd('0x45')](_0xc9eebf,function(_0x38fc1d){if(_0x38fc1d['type']!==_0x65dd('0x46')){var _0x43b45c={};_0x43b45c[_0x38fc1d[_0x65dd('0x32')]]={'$like':'%'+_0x578a6a['query']['filter']+'%'};return _0x43b45c;}})});}_0x3f3e54=_[_0x65dd('0x47')]({},_0x3f3e54,_0x578a6a[_0x65dd('0x48')]);var _0x4e4c6e={'where':_0x3f3e54[_0x65dd('0x42')]};return db[_0x65dd('0x35')]['count'](_0x4e4c6e)[_0x65dd('0x1c')](function(_0x149470){_0x4d98b8[_0x65dd('0x49')]=_0x149470;if(_0x578a6a['query'][_0x65dd('0x4a')]){_0x3f3e54[_0x65dd('0x4b')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x65dd('0x4c')](_0x3f3e54);})['then'](function(_0x25170a){_0x4d98b8[_0x65dd('0x4d')]=_0x25170a;return _0x4d98b8;})[_0x65dd('0x1c')](respondWithFilteredResult(_0x557836,_0x3f3e54))[_0x65dd('0x27')](handleError(_0x557836,null));};exports[_0x65dd('0x4e')]=function(_0x5f4ba2,_0x224a99){var _0x3b801c={'raw':![],'where':{'id':_0x5f4ba2[_0x65dd('0x4f')]['id']}},_0x687c12={};_0x687c12[_0x65dd('0x39')]=_[_0x65dd('0x50')](db[_0x65dd('0x35')][_0x65dd('0x36')]);_0x687c12['query']=_['keys'](_0x5f4ba2[_0x65dd('0x3a')]);_0x687c12['filters']=_[_0x65dd('0x3c')](_0x687c12[_0x65dd('0x39')],_0x687c12[_0x65dd('0x3a')]);_0x3b801c[_0x65dd('0x3d')]=_['intersection'](_0x687c12['model'],qs[_0x65dd('0x3e')](_0x5f4ba2[_0x65dd('0x3a')][_0x65dd('0x3e')]));_0x3b801c[_0x65dd('0x3d')]=_0x3b801c[_0x65dd('0x3d')]['length']?_0x3b801c['attributes']:_0x687c12[_0x65dd('0x39')];if(_0x5f4ba2[_0x65dd('0x3a')][_0x65dd('0x4a')]){_0x3b801c['include']=[{'all':!![]}];}_0x3b801c=_[_0x65dd('0x47')]({},_0x3b801c,_0x5f4ba2['options']);return db[_0x65dd('0x35')][_0x65dd('0x51')](_0x3b801c)[_0x65dd('0x1c')](handleEntityNotFound(_0x224a99,null))[_0x65dd('0x1c')](respondWithResult(_0x224a99,null))[_0x65dd('0x27')](handleError(_0x224a99,null));};exports[_0x65dd('0x52')]=function(_0x3b5fda,_0x2728e0){return db[_0x65dd('0x35')]['create'](_0x3b5fda['body'],{})[_0x65dd('0x1c')](respondWithResult(_0x2728e0,0xc9))['catch'](handleError(_0x2728e0,null));};exports['update']=function(_0x495fcf,_0x4b22e8){if(_0x495fcf[_0x65dd('0x53')]['id']){delete _0x495fcf[_0x65dd('0x53')]['id'];}return db[_0x65dd('0x35')][_0x65dd('0x51')]({'where':{'id':_0x495fcf[_0x65dd('0x4f')]['id']}})[_0x65dd('0x1c')](handleEntityNotFound(_0x4b22e8,null))[_0x65dd('0x1c')](saveUpdates(_0x495fcf[_0x65dd('0x53')],null))[_0x65dd('0x1c')](respondWithResult(_0x4b22e8,null))['catch'](handleError(_0x4b22e8,null));};exports[_0x65dd('0x54')]=function(_0x173767,_0x38f906){return db['Dynamics365Configuration'][_0x65dd('0x51')]({'where':{'id':_0x173767[_0x65dd('0x4f')]['id']}})[_0x65dd('0x1c')](handleEntityNotFound(_0x38f906,null))[_0x65dd('0x1c')](removeEntity(_0x38f906,null))[_0x65dd('0x27')](handleError(_0x38f906,null));};exports['getFields']=function(_0x4864aa,_0x58520a,_0x28de5a){var _0xf8522f={};var _0x4a8761={};var _0x345e64;var _0x4fe7c8;return db[_0x65dd('0x35')][_0x65dd('0x55')]({'where':{'id':_0x4864aa[_0x65dd('0x4f')]['id']}})[_0x65dd('0x1c')](handleEntityNotFound(_0x58520a,null))[_0x65dd('0x1c')](function(_0x5cdd6f){if(_0x5cdd6f){_0x345e64=_0x5cdd6f;_0x4a8761['model']=_[_0x65dd('0x50')](db[_0x65dd('0x56')][_0x65dd('0x36')]);_0x4a8761[_0x65dd('0x3a')]=_[_0x65dd('0x50')](_0x4864aa['query']);_0x4a8761['filters']=_[_0x65dd('0x3c')](_0x4a8761[_0x65dd('0x39')],_0x4a8761[_0x65dd('0x3a')]);_0xf8522f['attributes']=_[_0x65dd('0x3c')](_0x4a8761['model'],qs['fields'](_0x4864aa[_0x65dd('0x3a')][_0x65dd('0x3e')]));_0xf8522f[_0x65dd('0x3d')]=_0xf8522f[_0x65dd('0x3d')]['length']?_0xf8522f['attributes']:_0x4a8761[_0x65dd('0x39')];_0xf8522f[_0x65dd('0x57')]=qs['sort'](_0x4864aa[_0x65dd('0x3a')][_0x65dd('0x41')]);_0xf8522f['where']=qs['filters'](_[_0x65dd('0x43')](_0x4864aa['query'],_0x4a8761[_0x65dd('0x3b')]));if(_0x4864aa[_0x65dd('0x3a')][_0x65dd('0x44')]){_0xf8522f[_0x65dd('0x42')]=_[_0x65dd('0x47')](_0xf8522f['where'],{'$or':_[_0x65dd('0x45')](_0xf8522f['attributes'],function(_0x2e544a){var _0x407b6c={};_0x407b6c[_0x2e544a]={'$like':'%'+_0x4864aa[_0x65dd('0x3a')][_0x65dd('0x44')]+'%'};return _0x407b6c;})});}_0xf8522f=_['merge']({},_0xf8522f,_0x4864aa['options']);return _0x345e64[_0x65dd('0x58')](_0xf8522f);}})['then'](function(_0x559698){if(_0x559698){_0x4fe7c8=_0x559698['length'];if(!_0x4864aa[_0x65dd('0x3a')]['hasOwnProperty'](_0x65dd('0x3f'))){_0xf8522f[_0x65dd('0x40')]=qs['limit'](_0x4864aa[_0x65dd('0x3a')][_0x65dd('0x40')]);_0xf8522f['offset']=qs['offset'](_0x4864aa[_0x65dd('0x3a')]['offset']);}return _0x345e64['getFields'](_0xf8522f);}})[_0x65dd('0x1c')](function(_0x16a08c){if(_0x16a08c){return _0x16a08c?{'count':_0x4fe7c8,'rows':_0x16a08c}:null;}})[_0x65dd('0x1c')](respondWithResult(_0x58520a,null))[_0x65dd('0x27')](handleError(_0x58520a,null));};exports[_0x65dd('0x59')]=function(_0x3b1d1f,_0x5ee564,_0x5638dc){var _0x4e6d9d={};var _0x22be20={};var _0x2e265f;var _0x17f010;return db[_0x65dd('0x35')][_0x65dd('0x55')]({'where':{'id':_0x3b1d1f[_0x65dd('0x4f')]['id']}})[_0x65dd('0x1c')](handleEntityNotFound(_0x5ee564,null))[_0x65dd('0x1c')](function(_0x3dc814){if(_0x3dc814){_0x2e265f=_0x3dc814;_0x22be20[_0x65dd('0x39')]=_[_0x65dd('0x50')](db[_0x65dd('0x56')][_0x65dd('0x36')]);_0x22be20['query']=_[_0x65dd('0x50')](_0x3b1d1f['query']);_0x22be20[_0x65dd('0x3b')]=_[_0x65dd('0x3c')](_0x22be20[_0x65dd('0x39')],_0x22be20[_0x65dd('0x3a')]);_0x4e6d9d[_0x65dd('0x3d')]=_[_0x65dd('0x3c')](_0x22be20[_0x65dd('0x39')],qs['fields'](_0x3b1d1f[_0x65dd('0x3a')]['fields']));_0x4e6d9d[_0x65dd('0x3d')]=_0x4e6d9d[_0x65dd('0x3d')]['length']?_0x4e6d9d['attributes']:_0x22be20[_0x65dd('0x39')];_0x4e6d9d['order']=qs[_0x65dd('0x41')](_0x3b1d1f['query']['sort']);_0x4e6d9d[_0x65dd('0x42')]=qs[_0x65dd('0x3b')](_[_0x65dd('0x43')](_0x3b1d1f[_0x65dd('0x3a')],_0x22be20[_0x65dd('0x3b')]));if(_0x3b1d1f[_0x65dd('0x3a')][_0x65dd('0x44')]){_0x4e6d9d[_0x65dd('0x42')]=_[_0x65dd('0x47')](_0x4e6d9d['where'],{'$or':_['map'](_0x4e6d9d[_0x65dd('0x3d')],function(_0x2b1295){var _0x2b66ce={};_0x2b66ce[_0x2b1295]={'$like':'%'+_0x3b1d1f['query']['filter']+'%'};return _0x2b66ce;})});}_0x4e6d9d=_[_0x65dd('0x47')]({},_0x4e6d9d,_0x3b1d1f['options']);return _0x2e265f['getSubjects'](_0x4e6d9d);}})[_0x65dd('0x1c')](function(_0x2ca190){if(_0x2ca190){_0x17f010=_0x2ca190['length'];if(!_0x3b1d1f[_0x65dd('0x3a')][_0x65dd('0x5a')](_0x65dd('0x3f'))){_0x4e6d9d['limit']=qs[_0x65dd('0x40')](_0x3b1d1f[_0x65dd('0x3a')][_0x65dd('0x40')]);_0x4e6d9d[_0x65dd('0x2b')]=qs['offset'](_0x3b1d1f['query'][_0x65dd('0x2b')]);}return _0x2e265f[_0x65dd('0x59')](_0x4e6d9d);}})[_0x65dd('0x1c')](function(_0x1050b3){if(_0x1050b3){return _0x1050b3?{'count':_0x17f010,'rows':_0x1050b3}:null;}})['then'](respondWithResult(_0x5ee564,null))[_0x65dd('0x27')](handleError(_0x5ee564,null));};exports['getDescriptions']=function(_0x5dcb5c,_0x468961,_0x4b07e6){var _0x16fb29={};var _0x410c5a={};var _0x16c666;var _0x516943;return db[_0x65dd('0x35')]['findOne']({'where':{'id':_0x5dcb5c[_0x65dd('0x4f')]['id']}})[_0x65dd('0x1c')](handleEntityNotFound(_0x468961,null))[_0x65dd('0x1c')](function(_0x1bec42){if(_0x1bec42){_0x16c666=_0x1bec42;_0x410c5a[_0x65dd('0x39')]=_['keys'](db['Dynamics365Field'][_0x65dd('0x36')]);_0x410c5a[_0x65dd('0x3a')]=_[_0x65dd('0x50')](_0x5dcb5c[_0x65dd('0x3a')]);_0x410c5a['filters']=_[_0x65dd('0x3c')](_0x410c5a['model'],_0x410c5a['query']);_0x16fb29['attributes']=_[_0x65dd('0x3c')](_0x410c5a['model'],qs[_0x65dd('0x3e')](_0x5dcb5c[_0x65dd('0x3a')]['fields']));_0x16fb29[_0x65dd('0x3d')]=_0x16fb29[_0x65dd('0x3d')][_0x65dd('0x5b')]?_0x16fb29[_0x65dd('0x3d')]:_0x410c5a[_0x65dd('0x39')];_0x16fb29[_0x65dd('0x57')]=qs[_0x65dd('0x41')](_0x5dcb5c[_0x65dd('0x3a')][_0x65dd('0x41')]);_0x16fb29[_0x65dd('0x42')]=qs[_0x65dd('0x3b')](_[_0x65dd('0x43')](_0x5dcb5c[_0x65dd('0x3a')],_0x410c5a['filters']));if(_0x5dcb5c['query'][_0x65dd('0x44')]){_0x16fb29[_0x65dd('0x42')]=_[_0x65dd('0x47')](_0x16fb29[_0x65dd('0x42')],{'$or':_[_0x65dd('0x45')](_0x16fb29[_0x65dd('0x3d')],function(_0x5e4a3f){var _0x3f4722={};_0x3f4722[_0x5e4a3f]={'$like':'%'+_0x5dcb5c[_0x65dd('0x3a')][_0x65dd('0x44')]+'%'};return _0x3f4722;})});}_0x16fb29=_[_0x65dd('0x47')]({},_0x16fb29,_0x5dcb5c[_0x65dd('0x48')]);return _0x16c666[_0x65dd('0x5c')](_0x16fb29);}})[_0x65dd('0x1c')](function(_0x39c0bf){if(_0x39c0bf){_0x516943=_0x39c0bf['length'];if(!_0x5dcb5c[_0x65dd('0x3a')][_0x65dd('0x5a')](_0x65dd('0x3f'))){_0x16fb29['limit']=qs[_0x65dd('0x40')](_0x5dcb5c[_0x65dd('0x3a')][_0x65dd('0x40')]);_0x16fb29[_0x65dd('0x2b')]=qs['offset'](_0x5dcb5c[_0x65dd('0x3a')][_0x65dd('0x2b')]);}return _0x16c666[_0x65dd('0x5c')](_0x16fb29);}})[_0x65dd('0x1c')](function(_0x22d3cf){if(_0x22d3cf){return _0x22d3cf?{'count':_0x516943,'rows':_0x22d3cf}:null;}})[_0x65dd('0x1c')](respondWithResult(_0x468961,null))['catch'](handleError(_0x468961,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index c5859ed..acaea2e 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 _0x040f=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','int_dynamics365_configurations','lodash','util'];(function(_0x1f9259,_0x49bd57){var _0x111ec7=function(_0xc7e0e5){while(--_0xc7e0e5){_0x1f9259['push'](_0x1f9259['shift']());}};_0x111ec7(++_0x49bd57);}(_0x040f,0x6a));var _0xf040=function(_0x37fdf7,_0x34600f){_0x37fdf7=_0x37fdf7-0x0;var _0x1e8998=_0x040f[_0x37fdf7];return _0x1e8998;};'use strict';var _=require(_0xf040('0x0'));var util=require(_0xf040('0x1'));var logger=require(_0xf040('0x2'))(_0xf040('0x3'));var moment=require(_0xf040('0x4'));var BPromise=require(_0xf040('0x5'));var rp=require(_0xf040('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf040('0x7'));var config=require(_0xf040('0x8'));var attributes=require(_0xf040('0x9'));module[_0xf040('0xa')]=function(_0x4ceed0,_0x2ed3cb){return _0x4ceed0['define']('Dynamics365Configuration',attributes,{'tableName':_0xf040('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0986=['lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','define','Dynamics365Configuration','int_dynamics365_configurations'];(function(_0xb85b0e,_0x42fc5d){var _0x2b4c68=function(_0x1b0938){while(--_0x1b0938){_0xb85b0e['push'](_0xb85b0e['shift']());}};_0x2b4c68(++_0x42fc5d);}(_0x0986,0x82));var _0x6098=function(_0x19addb,_0x54191f){_0x19addb=_0x19addb-0x0;var _0x17529c=_0x0986[_0x19addb];return _0x17529c;};'use strict';var _=require(_0x6098('0x0'));var util=require(_0x6098('0x1'));var logger=require(_0x6098('0x2'))('api');var moment=require(_0x6098('0x3'));var BPromise=require(_0x6098('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6098('0x5'));var rimraf=require('rimraf');var config=require(_0x6098('0x6'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x19f183,_0x503188){return _0x19f183[_0x6098('0x7')](_0x6098('0x8'),attributes,{'tableName':_0x6098('0x9'),'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 78c4ce1..af0ab3f 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 _0x7a5d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x7a5d,0x1f4));var _0xd7a5=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7a5d[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xd7a5('0x0'));var util=require(_0xd7a5('0x1'));var moment=require(_0xd7a5('0x2'));var BPromise=require(_0xd7a5('0x3'));var rs=require(_0xd7a5('0x4'));var fs=require('fs');var Redis=require(_0xd7a5('0x5'));var db=require(_0xd7a5('0x6'))['db'];var utils=require(_0xd7a5('0x7'));var logger=require(_0xd7a5('0x8'))(_0xd7a5('0x9'));var config=require(_0xd7a5('0xa'));var jayson=require(_0xd7a5('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x126f6c,_0x228210,_0x2f7c49){return new BPromise(function(_0x177983,_0x312ad5){return client[_0xd7a5('0xc')](_0x126f6c,_0x2f7c49)[_0xd7a5('0xd')](function(_0x44649a){logger[_0xd7a5('0xe')](_0xd7a5('0xf'),_0x228210,'request\x20sent');logger[_0xd7a5('0x10')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x228210,_0xd7a5('0x11'),JSON['stringify'](_0x44649a));if(_0x44649a[_0xd7a5('0x12')]){if(_0x44649a[_0xd7a5('0x12')][_0xd7a5('0x13')]===0x1f4){logger[_0xd7a5('0x12')](_0xd7a5('0xf'),_0x228210,_0x44649a[_0xd7a5('0x12')][_0xd7a5('0x14')]);return _0x312ad5(_0x44649a[_0xd7a5('0x12')][_0xd7a5('0x14')]);}logger['error'](_0xd7a5('0xf'),_0x228210,_0x44649a[_0xd7a5('0x12')][_0xd7a5('0x14')]);return _0x177983(_0x44649a[_0xd7a5('0x12')][_0xd7a5('0x14')]);}else{logger[_0xd7a5('0xe')](_0xd7a5('0xf'),_0x228210,_0xd7a5('0x11'));_0x177983(_0x44649a['result'][_0xd7a5('0x14')]);}})[_0xd7a5('0x15')](function(_0x593a24){logger[_0xd7a5('0x12')](_0xd7a5('0xf'),_0x228210,_0x593a24);_0x312ad5(_0x593a24);});});} \ No newline at end of file +var _0x4bd8=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x2fb1e4,_0x499f49){var _0xc0aad2=function(_0x285376){while(--_0x285376){_0x2fb1e4['push'](_0x2fb1e4['shift']());}};_0xc0aad2(++_0x499f49);}(_0x4bd8,0x86));var _0x84bd=function(_0x89e67a,_0xd56842){_0x89e67a=_0x89e67a-0x0;var _0x331078=_0x4bd8[_0x89e67a];return _0x331078;};'use strict';var _=require(_0x84bd('0x0'));var util=require('util');var moment=require(_0x84bd('0x1'));var BPromise=require('bluebird');var rs=require(_0x84bd('0x2'));var fs=require('fs');var Redis=require(_0x84bd('0x3'));var db=require(_0x84bd('0x4'))['db'];var utils=require(_0x84bd('0x5'));var logger=require(_0x84bd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x84bd('0x7'));var client=jayson['client'][_0x84bd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d2140,_0x32e9b0,_0x5f421e){return new BPromise(function(_0x45f384,_0x1ecc3b){return client[_0x84bd('0x9')](_0x3d2140,_0x5f421e)[_0x84bd('0xa')](function(_0x2ec86c){logger['info'](_0x84bd('0xb'),_0x32e9b0,_0x84bd('0xc'));logger[_0x84bd('0xd')](_0x84bd('0xe'),_0x32e9b0,_0x84bd('0xc'),JSON[_0x84bd('0xf')](_0x2ec86c));if(_0x2ec86c['error']){if(_0x2ec86c[_0x84bd('0x10')][_0x84bd('0x11')]===0x1f4){logger[_0x84bd('0x10')](_0x84bd('0xb'),_0x32e9b0,_0x2ec86c[_0x84bd('0x10')][_0x84bd('0x12')]);return _0x1ecc3b(_0x2ec86c['error'][_0x84bd('0x12')]);}logger['error'](_0x84bd('0xb'),_0x32e9b0,_0x2ec86c[_0x84bd('0x10')][_0x84bd('0x12')]);return _0x45f384(_0x2ec86c[_0x84bd('0x10')][_0x84bd('0x12')]);}else{logger['info'](_0x84bd('0xb'),_0x32e9b0,_0x84bd('0xc'));_0x45f384(_0x2ec86c[_0x84bd('0x13')][_0x84bd('0x12')]);}})[_0x84bd('0x14')](function(_0x1cbd01){logger[_0x84bd('0x10')](_0x84bd('0xb'),_0x32e9b0,_0x1cbd01);_0x1ecc3b(_0x1cbd01);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index bda2b8d..4c6f7d3 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 _0x6c76=['update','delete','destroy','exports','multer','util','path','express','Router','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','/:id','post','create'];(function(_0x4b13ce,_0x339cb0){var _0x427d4b=function(_0x26aaad){while(--_0x26aaad){_0x4b13ce['push'](_0x4b13ce['shift']());}};_0x427d4b(++_0x339cb0);}(_0x6c76,0x184));var _0x66c7=function(_0x172135,_0x3ee287){_0x172135=_0x172135-0x0;var _0x4cbbcb=_0x6c76[_0x172135];return _0x4cbbcb;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x66c7('0x5'));var controller=require(_0x66c7('0x6'));router['get']('/',auth[_0x66c7('0x7')](),controller[_0x66c7('0x8')]);router['get'](_0x66c7('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x66c7('0xa')]('/',auth[_0x66c7('0x7')](),controller[_0x66c7('0xb')]);router['put'](_0x66c7('0x9'),auth[_0x66c7('0x7')](),controller[_0x66c7('0xc')]);router[_0x66c7('0xd')]('/:id',auth[_0x66c7('0x7')](),controller[_0x66c7('0xe')]);module[_0x66c7('0xf')]=router; \ No newline at end of file +var _0xc788=['isAuthenticated','index','get','/:id','post','create','put','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0xc788,0xc4));var _0x8c78=function(_0x11090e,_0x2f1226){_0x11090e=_0x11090e-0x0;var _0x103e19=_0xc788[_0x11090e];return _0x103e19;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var auth=require(_0x8c78('0x4'));var interaction=require(_0x8c78('0x5'));var config=require(_0x8c78('0x6'));var controller=require(_0x8c78('0x7'));router['get']('/',auth[_0x8c78('0x8')](),controller[_0x8c78('0x9')]);router[_0x8c78('0xa')](_0x8c78('0xb'),auth[_0x8c78('0x8')](),controller['show']);router[_0x8c78('0xc')]('/',auth[_0x8c78('0x8')](),controller[_0x8c78('0xd')]);router[_0x8c78('0xe')](_0x8c78('0xb'),auth[_0x8c78('0x8')](),controller['update']);router[_0x8c78('0xf')]('/:id',auth[_0x8c78('0x8')](),controller[_0x8c78('0x10')]);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 a7be698..a50b4b3 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 _0x5ab4=['string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x135a56,_0x3d72e9){var _0x23e9b0=function(_0x112c32){while(--_0x112c32){_0x135a56['push'](_0x135a56['shift']());}};_0x23e9b0(++_0x3d72e9);}(_0x5ab4,0x9f));var _0x45ab=function(_0x32c560,_0xfc8c30){_0x32c560=_0x32c560-0x0;var _0x39d9cf=_0x5ab4[_0x32c560];return _0x39d9cf;};'use strict';var Sequelize=require(_0x45ab('0x0'));module[_0x45ab('0x1')]={'type':{'type':Sequelize[_0x45ab('0x2')](_0x45ab('0x3'),_0x45ab('0x4'),'customVariable',_0x45ab('0x5')),'defaultValue':_0x45ab('0x3')},'content':{'type':Sequelize[_0x45ab('0x6')]},'key':{'type':Sequelize[_0x45ab('0x6')]},'keyType':{'type':Sequelize[_0x45ab('0x2')](_0x45ab('0x3'),'variable',_0x45ab('0x7'))},'keyContent':{'type':Sequelize[_0x45ab('0x6')]},'idField':{'type':Sequelize[_0x45ab('0x6')]},'nameField':{'type':Sequelize[_0x45ab('0x6')]},'customField':{'type':Sequelize[_0x45ab('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x45ab('0x6')]}}; \ No newline at end of file +var _0x1b2c=['sequelize','exports','string','customVariable','keyValue','STRING','ENUM','variable','BOOLEAN'];(function(_0x59f283,_0x363ada){var _0x2b8db4=function(_0x2ec2df){while(--_0x2ec2df){_0x59f283['push'](_0x59f283['shift']());}};_0x2b8db4(++_0x363ada);}(_0x1b2c,0x105));var _0xc1b2=function(_0x1bb191,_0x552afb){_0x1bb191=_0x1bb191-0x0;var _0x31b09f=_0x1b2c[_0x1bb191];return _0x31b09f;};'use strict';var Sequelize=require(_0xc1b2('0x0'));module[_0xc1b2('0x1')]={'type':{'type':Sequelize['ENUM'](_0xc1b2('0x2'),'variable',_0xc1b2('0x3'),_0xc1b2('0x4')),'defaultValue':_0xc1b2('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc1b2('0x5')]},'keyType':{'type':Sequelize[_0xc1b2('0x6')](_0xc1b2('0x2'),_0xc1b2('0x7'),_0xc1b2('0x3'))},'keyContent':{'type':Sequelize[_0xc1b2('0x5')]},'idField':{'type':Sequelize[_0xc1b2('0x5')]},'nameField':{'type':Sequelize[_0xc1b2('0x5')]},'customField':{'type':Sequelize[_0xc1b2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc1b2('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 05f7ee5..a848c79 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 _0xfacc=['path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','Dynamics365Field','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x4dca38,_0x5dfae1){var _0x44656c=function(_0x538a62){while(--_0x538a62){_0x4dca38['push'](_0x4dca38['shift']());}};_0x44656c(++_0x5dfae1);}(_0xfacc,0x8a));var _0xcfac=function(_0xb8e44,_0x2a6a20){_0xb8e44=_0xb8e44-0x0;var _0x3dbb16=_0xfacc[_0xb8e44];return _0x3dbb16;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xcfac('0x0'));var zipdir=require(_0xcfac('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcfac('0x2'));var moment=require(_0xcfac('0x3'));var BPromise=require(_0xcfac('0x4'));var Mustache=require(_0xcfac('0x5'));var util=require('util');var path=require(_0xcfac('0x6'));var sox=require(_0xcfac('0x7'));var csv=require(_0xcfac('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xcfac('0x9'));var crypto=require('crypto');var jsforce=require(_0xcfac('0xa'));var deskjs=require(_0xcfac('0xb'));var toCsv=require(_0xcfac('0x8'));var querystring=require(_0xcfac('0xc'));var Papa=require(_0xcfac('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcfac('0xe'));var as=require(_0xcfac('0xf'));var hardwareService=require(_0xcfac('0x10'));var logger=require(_0xcfac('0x11'))(_0xcfac('0x12'));var utils=require(_0xcfac('0x13'));var config=require(_0xcfac('0x14'));var db=require(_0xcfac('0x15'))['db'];function respondWithStatusCode(_0x37ac45,_0x20b82f){_0x20b82f=_0x20b82f||0xcc;return function(_0x1893a9){if(_0x1893a9){return _0x37ac45[_0xcfac('0x16')](_0x20b82f);}return _0x37ac45['status'](_0x20b82f)[_0xcfac('0x17')]();};}function respondWithResult(_0x282f87,_0x4a8ced){_0x4a8ced=_0x4a8ced||0xc8;return function(_0x3cce0f){if(_0x3cce0f){return _0x282f87[_0xcfac('0x18')](_0x4a8ced)[_0xcfac('0x19')](_0x3cce0f);}};}function respondWithFilteredResult(_0x191ce2,_0x556d42){return function(_0x35ddd5){if(_0x35ddd5){var _0x21ec5e=_0x35ddd5[_0xcfac('0x1a')],_0x38434a=_0x556d42[_0xcfac('0x1b')],_0x65af40=_0x556d42['offset']+_0x556d42[_0xcfac('0x1c')],_0x4d870f;if(_0x65af40>=_0x21ec5e){_0x65af40=_0x21ec5e;_0x4d870f=0xc8;}else{_0x4d870f=0xce;}_0x191ce2[_0xcfac('0x18')](_0x4d870f);return _0x191ce2[_0xcfac('0x1d')](_0xcfac('0x1e'),_0x38434a+'-'+_0x65af40+'/'+_0x21ec5e)[_0xcfac('0x19')](_0x35ddd5);}return null;};}function patchUpdates(_0x143187){return function(_0x153c92){try{jsonpatch[_0xcfac('0x1f')](_0x153c92,_0x143187,!![]);}catch(_0x2cc764){return BPromise['reject'](_0x2cc764);}return _0x153c92[_0xcfac('0x20')]();};}function saveUpdates(_0x36bc98,_0x10228b){return function(_0x37303d){if(_0x37303d){return _0x37303d[_0xcfac('0x21')](_0x36bc98)[_0xcfac('0x22')](function(_0x28a5f2){return _0x28a5f2;});}return null;};}function removeEntity(_0xeecc2f,_0x2f1d20){return function(_0x23a2fa){if(_0x23a2fa){return _0x23a2fa[_0xcfac('0x23')]()[_0xcfac('0x22')](function(){_0xeecc2f['status'](0xcc)[_0xcfac('0x17')]();});}};}function handleEntityNotFound(_0x2474a6,_0x26a4fd){return function(_0x2ee083){if(!_0x2ee083){_0x2474a6[_0xcfac('0x16')](0x194);}return _0x2ee083;};}function handleError(_0x320069,_0x56296f){_0x56296f=_0x56296f||0x1f4;return function(_0x279844){logger[_0xcfac('0x24')](_0x279844[_0xcfac('0x25')]);if(_0x279844[_0xcfac('0x26')]){delete _0x279844[_0xcfac('0x26')];}_0x320069[_0xcfac('0x18')](_0x56296f)['send'](_0x279844);};}exports[_0xcfac('0x27')]=function(_0xce4b3f,_0x2d89be){var _0x3216f0={},_0xa4e0bc={},_0x40d028={'count':0x0,'rows':[]};var _0x120fca=_['map'](db['Dynamics365Field'][_0xcfac('0x28')],function(_0x16a7e6){return{'name':_0x16a7e6[_0xcfac('0x29')],'type':_0x16a7e6['type'][_0xcfac('0x2a')]};});_0xa4e0bc[_0xcfac('0x2b')]=_['map'](_0x120fca,_0xcfac('0x26'));_0xa4e0bc[_0xcfac('0x2c')]=_[_0xcfac('0x2d')](_0xce4b3f['query']);_0xa4e0bc[_0xcfac('0x2e')]=_['intersection'](_0xa4e0bc[_0xcfac('0x2b')],_0xa4e0bc[_0xcfac('0x2c')]);_0x3216f0[_0xcfac('0x2f')]=_[_0xcfac('0x30')](_0xa4e0bc[_0xcfac('0x2b')],qs[_0xcfac('0x31')](_0xce4b3f['query']['fields']));_0x3216f0[_0xcfac('0x2f')]=_0x3216f0[_0xcfac('0x2f')][_0xcfac('0x32')]?_0x3216f0[_0xcfac('0x2f')]:_0xa4e0bc[_0xcfac('0x2b')];if(!_0xce4b3f[_0xcfac('0x2c')][_0xcfac('0x33')](_0xcfac('0x34'))){_0x3216f0[_0xcfac('0x1c')]=qs[_0xcfac('0x1c')](_0xce4b3f['query'][_0xcfac('0x1c')]);_0x3216f0[_0xcfac('0x1b')]=qs['offset'](_0xce4b3f['query'][_0xcfac('0x1b')]);}_0x3216f0[_0xcfac('0x35')]=qs['sort'](_0xce4b3f[_0xcfac('0x2c')][_0xcfac('0x36')]);_0x3216f0[_0xcfac('0x37')]=qs[_0xcfac('0x2e')](_[_0xcfac('0x38')](_0xce4b3f[_0xcfac('0x2c')],_0xa4e0bc[_0xcfac('0x2e')]),_0x120fca);if(_0xce4b3f[_0xcfac('0x2c')]['filter']){_0x3216f0[_0xcfac('0x37')]=_[_0xcfac('0x39')](_0x3216f0[_0xcfac('0x37')],{'$or':_[_0xcfac('0x3a')](_0x120fca,function(_0x496603){if(_0x496603['type']!=='VIRTUAL'){var _0x14c58c={};_0x14c58c[_0x496603[_0xcfac('0x26')]]={'$like':'%'+_0xce4b3f['query'][_0xcfac('0x3b')]+'%'};return _0x14c58c;}})});}_0x3216f0=_[_0xcfac('0x39')]({},_0x3216f0,_0xce4b3f['options']);var _0x2b30be={'where':_0x3216f0['where']};return db[_0xcfac('0x3c')][_0xcfac('0x1a')](_0x2b30be)[_0xcfac('0x22')](function(_0x218272){_0x40d028[_0xcfac('0x1a')]=_0x218272;if(_0xce4b3f[_0xcfac('0x2c')][_0xcfac('0x3d')]){_0x3216f0[_0xcfac('0x3e')]=[{'all':!![]}];}return db[_0xcfac('0x3c')][_0xcfac('0x3f')](_0x3216f0);})[_0xcfac('0x22')](function(_0x1ac17c){_0x40d028[_0xcfac('0x40')]=_0x1ac17c;return _0x40d028;})[_0xcfac('0x22')](respondWithFilteredResult(_0x2d89be,_0x3216f0))[_0xcfac('0x41')](handleError(_0x2d89be,null));};exports[_0xcfac('0x42')]=function(_0x47127e,_0x1d5787){var _0x342eab={'raw':!![],'where':{'id':_0x47127e['params']['id']}},_0x107d8b={};_0x107d8b['model']=_['keys'](db[_0xcfac('0x3c')]['rawAttributes']);_0x107d8b['query']=_[_0xcfac('0x2d')](_0x47127e[_0xcfac('0x2c')]);_0x107d8b[_0xcfac('0x2e')]=_[_0xcfac('0x30')](_0x107d8b[_0xcfac('0x2b')],_0x107d8b['query']);_0x342eab[_0xcfac('0x2f')]=_[_0xcfac('0x30')](_0x107d8b['model'],qs[_0xcfac('0x31')](_0x47127e[_0xcfac('0x2c')][_0xcfac('0x31')]));_0x342eab[_0xcfac('0x2f')]=_0x342eab[_0xcfac('0x2f')][_0xcfac('0x32')]?_0x342eab[_0xcfac('0x2f')]:_0x107d8b[_0xcfac('0x2b')];if(_0x47127e[_0xcfac('0x2c')]['includeAll']){_0x342eab[_0xcfac('0x3e')]=[{'all':!![]}];}_0x342eab=_['merge']({},_0x342eab,_0x47127e[_0xcfac('0x43')]);return db['Dynamics365Field'][_0xcfac('0x44')](_0x342eab)['then'](handleEntityNotFound(_0x1d5787,null))[_0xcfac('0x22')](respondWithResult(_0x1d5787,null))['catch'](handleError(_0x1d5787,null));};exports[_0xcfac('0x45')]=function(_0x8fe37,_0x509af1){return db[_0xcfac('0x3c')][_0xcfac('0x45')](_0x8fe37[_0xcfac('0x46')],{})[_0xcfac('0x22')](respondWithResult(_0x509af1,0xc9))[_0xcfac('0x41')](handleError(_0x509af1,null));};exports[_0xcfac('0x21')]=function(_0x1119d2,_0x210d17){if(_0x1119d2[_0xcfac('0x46')]['id']){delete _0x1119d2[_0xcfac('0x46')]['id'];}return db['Dynamics365Field'][_0xcfac('0x44')]({'where':{'id':_0x1119d2[_0xcfac('0x47')]['id']}})[_0xcfac('0x22')](handleEntityNotFound(_0x210d17,null))['then'](saveUpdates(_0x1119d2[_0xcfac('0x46')],null))[_0xcfac('0x22')](respondWithResult(_0x210d17,null))[_0xcfac('0x41')](handleError(_0x210d17,null));};exports[_0xcfac('0x23')]=function(_0x1a3deb,_0x491768){return db[_0xcfac('0x3c')][_0xcfac('0x44')]({'where':{'id':_0x1a3deb['params']['id']}})[_0xcfac('0x22')](handleEntityNotFound(_0x491768,null))[_0xcfac('0x22')](removeEntity(_0x491768,null))[_0xcfac('0x41')](handleError(_0x491768,null));}; \ No newline at end of file +var _0xde64=['query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','merge','options','then','findAll','catch','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key'];(function(_0x3e3d12,_0x5d8c29){var _0x2685a8=function(_0x10943b){while(--_0x10943b){_0x3e3d12['push'](_0x3e3d12['shift']());}};_0x2685a8(++_0x5d8c29);}(_0xde64,0x17c));var _0x4de6=function(_0x441f4b,_0x2f1443){_0x441f4b=_0x441f4b-0x0;var _0x6e3970=_0xde64[_0x441f4b];return _0x6e3970;};'use strict';var pdf=require(_0x4de6('0x0'));var emlformat=require(_0x4de6('0x1'));var rimraf=require(_0x4de6('0x2'));var zipdir=require(_0x4de6('0x3'));var jsonpatch=require(_0x4de6('0x4'));var rp=require(_0x4de6('0x5'));var moment=require('moment');var BPromise=require(_0x4de6('0x6'));var Mustache=require(_0x4de6('0x7'));var util=require('util');var path=require('path');var sox=require(_0x4de6('0x8'));var csv=require(_0x4de6('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4de6('0xa'));var crypto=require(_0x4de6('0xb'));var jsforce=require(_0x4de6('0xc'));var deskjs=require(_0x4de6('0xd'));var toCsv=require(_0x4de6('0x9'));var querystring=require(_0x4de6('0xe'));var Papa=require('papaparse');var Redis=require(_0x4de6('0xf'));var authService=require(_0x4de6('0x10'));var qs=require(_0x4de6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4de6('0x12'));var logger=require(_0x4de6('0x13'))(_0x4de6('0x14'));var utils=require(_0x4de6('0x15'));var config=require(_0x4de6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x222272,_0x3baa31){_0x3baa31=_0x3baa31||0xcc;return function(_0xb8e256){if(_0xb8e256){return _0x222272['sendStatus'](_0x3baa31);}return _0x222272[_0x4de6('0x17')](_0x3baa31)[_0x4de6('0x18')]();};}function respondWithResult(_0x27c108,_0x2bd121){_0x2bd121=_0x2bd121||0xc8;return function(_0x58b0c1){if(_0x58b0c1){return _0x27c108[_0x4de6('0x17')](_0x2bd121)[_0x4de6('0x19')](_0x58b0c1);}};}function respondWithFilteredResult(_0x43d59b,_0x4dd3b5){return function(_0x33fd67){if(_0x33fd67){var _0x54e2f2=_0x33fd67[_0x4de6('0x1a')],_0x4cbb5c=_0x4dd3b5[_0x4de6('0x1b')],_0x30b3b8=_0x4dd3b5[_0x4de6('0x1b')]+_0x4dd3b5[_0x4de6('0x1c')],_0x3ef217;if(_0x30b3b8>=_0x54e2f2){_0x30b3b8=_0x54e2f2;_0x3ef217=0xc8;}else{_0x3ef217=0xce;}_0x43d59b[_0x4de6('0x17')](_0x3ef217);return _0x43d59b['set'](_0x4de6('0x1d'),_0x4cbb5c+'-'+_0x30b3b8+'/'+_0x54e2f2)[_0x4de6('0x19')](_0x33fd67);}return null;};}function patchUpdates(_0x2c7e57){return function(_0x23294d){try{jsonpatch[_0x4de6('0x1e')](_0x23294d,_0x2c7e57,!![]);}catch(_0x360cf7){return BPromise[_0x4de6('0x1f')](_0x360cf7);}return _0x23294d[_0x4de6('0x20')]();};}function saveUpdates(_0x1b935f,_0x15c923){return function(_0x4c4d13){if(_0x4c4d13){return _0x4c4d13[_0x4de6('0x21')](_0x1b935f)['then'](function(_0x1a6e5a){return _0x1a6e5a;});}return null;};}function removeEntity(_0x7af040,_0x43771b){return function(_0x5de99f){if(_0x5de99f){return _0x5de99f[_0x4de6('0x22')]()['then'](function(){_0x7af040[_0x4de6('0x17')](0xcc)[_0x4de6('0x18')]();});}};}function handleEntityNotFound(_0x1a64e9,_0x5ddbab){return function(_0x478d83){if(!_0x478d83){_0x1a64e9[_0x4de6('0x23')](0x194);}return _0x478d83;};}function handleError(_0x2191db,_0x3be904){_0x3be904=_0x3be904||0x1f4;return function(_0x8d0007){logger[_0x4de6('0x24')](_0x8d0007[_0x4de6('0x25')]);if(_0x8d0007['name']){delete _0x8d0007[_0x4de6('0x26')];}_0x2191db[_0x4de6('0x17')](_0x3be904)[_0x4de6('0x27')](_0x8d0007);};}exports[_0x4de6('0x28')]=function(_0x3e131a,_0x281060){var _0xa2b88c={},_0x7bc61e={},_0x28cf1e={'count':0x0,'rows':[]};var _0x4f168b=_[_0x4de6('0x29')](db[_0x4de6('0x2a')][_0x4de6('0x2b')],function(_0x29618d){return{'name':_0x29618d[_0x4de6('0x2c')],'type':_0x29618d['type'][_0x4de6('0x2d')]};});_0x7bc61e['model']=_[_0x4de6('0x29')](_0x4f168b,_0x4de6('0x26'));_0x7bc61e[_0x4de6('0x2e')]=_[_0x4de6('0x2f')](_0x3e131a['query']);_0x7bc61e['filters']=_['intersection'](_0x7bc61e['model'],_0x7bc61e['query']);_0xa2b88c[_0x4de6('0x30')]=_[_0x4de6('0x31')](_0x7bc61e[_0x4de6('0x32')],qs[_0x4de6('0x33')](_0x3e131a[_0x4de6('0x2e')][_0x4de6('0x33')]));_0xa2b88c[_0x4de6('0x30')]=_0xa2b88c[_0x4de6('0x30')][_0x4de6('0x34')]?_0xa2b88c[_0x4de6('0x30')]:_0x7bc61e[_0x4de6('0x32')];if(!_0x3e131a[_0x4de6('0x2e')][_0x4de6('0x35')](_0x4de6('0x36'))){_0xa2b88c[_0x4de6('0x1c')]=qs[_0x4de6('0x1c')](_0x3e131a[_0x4de6('0x2e')][_0x4de6('0x1c')]);_0xa2b88c[_0x4de6('0x1b')]=qs[_0x4de6('0x1b')](_0x3e131a[_0x4de6('0x2e')][_0x4de6('0x1b')]);}_0xa2b88c[_0x4de6('0x37')]=qs[_0x4de6('0x38')](_0x3e131a[_0x4de6('0x2e')][_0x4de6('0x38')]);_0xa2b88c[_0x4de6('0x39')]=qs[_0x4de6('0x3a')](_[_0x4de6('0x3b')](_0x3e131a['query'],_0x7bc61e[_0x4de6('0x3a')]),_0x4f168b);if(_0x3e131a[_0x4de6('0x2e')][_0x4de6('0x3c')]){_0xa2b88c[_0x4de6('0x39')]=_['merge'](_0xa2b88c[_0x4de6('0x39')],{'$or':_[_0x4de6('0x29')](_0x4f168b,function(_0x74dc14){if(_0x74dc14[_0x4de6('0x3d')]!=='VIRTUAL'){var _0x266e67={};_0x266e67[_0x74dc14['name']]={'$like':'%'+_0x3e131a[_0x4de6('0x2e')][_0x4de6('0x3c')]+'%'};return _0x266e67;}})});}_0xa2b88c=_[_0x4de6('0x3e')]({},_0xa2b88c,_0x3e131a[_0x4de6('0x3f')]);var _0x37feb0={'where':_0xa2b88c[_0x4de6('0x39')]};return db[_0x4de6('0x2a')][_0x4de6('0x1a')](_0x37feb0)[_0x4de6('0x40')](function(_0xdfa5ed){_0x28cf1e[_0x4de6('0x1a')]=_0xdfa5ed;if(_0x3e131a[_0x4de6('0x2e')]['includeAll']){_0xa2b88c['include']=[{'all':!![]}];}return db[_0x4de6('0x2a')][_0x4de6('0x41')](_0xa2b88c);})[_0x4de6('0x40')](function(_0x195630){_0x28cf1e['rows']=_0x195630;return _0x28cf1e;})['then'](respondWithFilteredResult(_0x281060,_0xa2b88c))[_0x4de6('0x42')](handleError(_0x281060,null));};exports['show']=function(_0x22fe9c,_0x54f4d2){var _0x3696c8={'raw':!![],'where':{'id':_0x22fe9c[_0x4de6('0x43')]['id']}},_0x52100f={};_0x52100f[_0x4de6('0x32')]=_[_0x4de6('0x2f')](db[_0x4de6('0x2a')]['rawAttributes']);_0x52100f[_0x4de6('0x2e')]=_[_0x4de6('0x2f')](_0x22fe9c['query']);_0x52100f['filters']=_[_0x4de6('0x31')](_0x52100f['model'],_0x52100f[_0x4de6('0x2e')]);_0x3696c8[_0x4de6('0x30')]=_[_0x4de6('0x31')](_0x52100f[_0x4de6('0x32')],qs[_0x4de6('0x33')](_0x22fe9c[_0x4de6('0x2e')][_0x4de6('0x33')]));_0x3696c8[_0x4de6('0x30')]=_0x3696c8[_0x4de6('0x30')][_0x4de6('0x34')]?_0x3696c8[_0x4de6('0x30')]:_0x52100f[_0x4de6('0x32')];if(_0x22fe9c['query']['includeAll']){_0x3696c8['include']=[{'all':!![]}];}_0x3696c8=_[_0x4de6('0x3e')]({},_0x3696c8,_0x22fe9c[_0x4de6('0x3f')]);return db['Dynamics365Field']['find'](_0x3696c8)[_0x4de6('0x40')](handleEntityNotFound(_0x54f4d2,null))['then'](respondWithResult(_0x54f4d2,null))[_0x4de6('0x42')](handleError(_0x54f4d2,null));};exports[_0x4de6('0x44')]=function(_0x4ec6ee,_0x34bc6f){return db[_0x4de6('0x2a')][_0x4de6('0x44')](_0x4ec6ee[_0x4de6('0x45')],{})[_0x4de6('0x40')](respondWithResult(_0x34bc6f,0xc9))['catch'](handleError(_0x34bc6f,null));};exports[_0x4de6('0x21')]=function(_0x388b78,_0x2e23ad){if(_0x388b78[_0x4de6('0x45')]['id']){delete _0x388b78[_0x4de6('0x45')]['id'];}return db[_0x4de6('0x2a')][_0x4de6('0x46')]({'where':{'id':_0x388b78[_0x4de6('0x43')]['id']}})[_0x4de6('0x40')](handleEntityNotFound(_0x2e23ad,null))[_0x4de6('0x40')](saveUpdates(_0x388b78[_0x4de6('0x45')],null))[_0x4de6('0x40')](respondWithResult(_0x2e23ad,null))[_0x4de6('0x42')](handleError(_0x2e23ad,null));};exports[_0x4de6('0x22')]=function(_0x354558,_0x12ce25){return db[_0x4de6('0x2a')]['find']({'where':{'id':_0x354558['params']['id']}})[_0x4de6('0x40')](handleEntityNotFound(_0x12ce25,null))[_0x4de6('0x40')](removeEntity(_0x12ce25,null))['catch'](handleError(_0x12ce25,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 9f1269c..da90230 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 _0x3152=['path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','../../config/logger','api','bluebird','request-promise'];(function(_0x30f323,_0x587ab7){var _0x442877=function(_0x4bc180){while(--_0x4bc180){_0x30f323['push'](_0x30f323['shift']());}};_0x442877(++_0x587ab7);}(_0x3152,0x64));var _0x2315=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x3152[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2315('0x0'))(_0x2315('0x1'));var moment=require('moment');var BPromise=require(_0x2315('0x2'));var rp=require(_0x2315('0x3'));var fs=require('fs');var path=require(_0x2315('0x4'));var rimraf=require(_0x2315('0x5'));var config=require(_0x2315('0x6'));var attributes=require(_0x2315('0x7'));module['exports']=function(_0x30ecc7,_0x29b651){return _0x30ecc7[_0x2315('0x8')](_0x2315('0x9'),attributes,{'tableName':_0x2315('0xa'),'paranoid':![],'indexes':[{'name':_0x2315('0xb'),'fields':[_0x2315('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x31c5=['int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','Dynamics365Field'];(function(_0x53e654,_0xf5d2a0){var _0xed8977=function(_0x35a504){while(--_0x35a504){_0x53e654['push'](_0x53e654['shift']());}};_0xed8977(++_0xf5d2a0);}(_0x31c5,0x86));var _0x531c=function(_0x4dd2e5,_0x29a49b){_0x4dd2e5=_0x4dd2e5-0x0;var _0x5eb6ce=_0x31c5[_0x4dd2e5];return _0x5eb6ce;};'use strict';var _=require(_0x531c('0x0'));var util=require('util');var logger=require(_0x531c('0x1'))(_0x531c('0x2'));var moment=require(_0x531c('0x3'));var BPromise=require(_0x531c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x531c('0x5'));var config=require(_0x531c('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0x531c('0x7')]=function(_0xf6c32e,_0x29c2c7){return _0xf6c32e['define'](_0x531c('0x8'),attributes,{'tableName':_0x531c('0x9'),'paranoid':![],'indexes':[{'name':_0x531c('0xa'),'fields':[_0x531c('0xb'),_0x531c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index f6ab487..c6de6c3 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 _0xfe39=['../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x3502e2,_0x111b54){var _0x5a4aea=function(_0x5375e4){while(--_0x5375e4){_0x3502e2['push'](_0x3502e2['shift']());}};_0x5a4aea(++_0x111b54);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xfe39[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x9fe3('0x0'));var util=require(_0x9fe3('0x1'));var moment=require('moment');var BPromise=require(_0x9fe3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fe3('0x3'))['db'];var utils=require(_0x9fe3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9fe3('0x5'));var jayson=require(_0x9fe3('0x6'));var client=jayson[_0x9fe3('0x7')][_0x9fe3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc469b7,_0x4183ce,_0x25868f){return new BPromise(function(_0x5a3bd6,_0x211eb2){return client[_0x9fe3('0x9')](_0xc469b7,_0x25868f)[_0x9fe3('0xa')](function(_0x35c391){logger[_0x9fe3('0xb')](_0x9fe3('0xc'),_0x4183ce,'request\x20sent');logger['debug'](_0x9fe3('0xd'),_0x4183ce,_0x9fe3('0xe'),JSON['stringify'](_0x35c391));if(_0x35c391[_0x9fe3('0xf')]){if(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x10')]===0x1f4){logger[_0x9fe3('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x4183ce,_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);return _0x211eb2(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x4183ce,_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);return _0x5a3bd6(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);}else{logger[_0x9fe3('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x4183ce,'request\x20sent');_0x5a3bd6(_0x35c391[_0x9fe3('0x12')][_0x9fe3('0x11')]);}})[_0x9fe3('0x13')](function(_0x2d28d4){logger['error'](_0x9fe3('0xc'),_0x4183ce,_0x2d28d4);_0x211eb2(_0x2d28d4);});});} \ No newline at end of file +var _0xda81=['then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request'];(function(_0x17d314,_0x4c6cc8){var _0x58e7d3=function(_0x33a2c3){while(--_0x33a2c3){_0x17d314['push'](_0x17d314['shift']());}};_0x58e7d3(++_0x4c6cc8);}(_0xda81,0x1c3));var _0x1da8=function(_0x20742a,_0x17e90){_0x20742a=_0x20742a-0x0;var _0x24e35a=_0xda81[_0x20742a];return _0x24e35a;};'use strict';var _=require(_0x1da8('0x0'));var util=require(_0x1da8('0x1'));var moment=require(_0x1da8('0x2'));var BPromise=require('bluebird');var rs=require(_0x1da8('0x3'));var fs=require('fs');var Redis=require(_0x1da8('0x4'));var db=require(_0x1da8('0x5'))['db'];var utils=require(_0x1da8('0x6'));var logger=require('../../config/logger')(_0x1da8('0x7'));var config=require(_0x1da8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1da8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x891482,_0x2c2bb4,_0xea1eb1){return new BPromise(function(_0x1a3278,_0x11dc1e){return client[_0x1da8('0xa')](_0x891482,_0xea1eb1)[_0x1da8('0xb')](function(_0x17a7fc){logger[_0x1da8('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x2c2bb4,_0x1da8('0xd'));logger[_0x1da8('0xe')](_0x1da8('0xf'),_0x2c2bb4,_0x1da8('0xd'),JSON[_0x1da8('0x10')](_0x17a7fc));if(_0x17a7fc['error']){if(_0x17a7fc[_0x1da8('0x11')]['code']===0x1f4){logger[_0x1da8('0x11')](_0x1da8('0x12'),_0x2c2bb4,_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);return _0x11dc1e(_0x17a7fc[_0x1da8('0x11')]['message']);}logger[_0x1da8('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x2c2bb4,_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);return _0x1a3278(_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);}else{logger[_0x1da8('0xc')](_0x1da8('0x12'),_0x2c2bb4,'request\x20sent');_0x1a3278(_0x17a7fc[_0x1da8('0x14')][_0x1da8('0x13')]);}})[_0x1da8('0x15')](function(_0x197b09){logger[_0x1da8('0x11')](_0x1da8('0x12'),_0x2c2bb4,_0x197b09);_0x11dc1e(_0x197b09);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 61ad688..9a61f6e 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 _0x42fe=['show','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','addConfiguration','put','/:id','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0x42fe,0x161));var _0xe42f=function(_0x4271f1,_0xdbdc80){_0x4271f1=_0x4271f1-0x0;var _0x1bc9c9=_0x42fe[_0x4271f1];return _0x1bc9c9;};'use strict';var multer=require('multer');var util=require(_0xe42f('0x0'));var path=require(_0xe42f('0x1'));var timeout=require('connect-timeout');var express=require(_0xe42f('0x2'));var router=express[_0xe42f('0x3')]();var auth=require(_0xe42f('0x4'));var interaction=require(_0xe42f('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xe42f('0x6')]('/',auth['isAuthenticated'](),controller[_0xe42f('0x7')]);router[_0xe42f('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xe42f('0x8')]);router['get'](_0xe42f('0x9'),auth['isAuthenticated'](),controller[_0xe42f('0xa')]);router[_0xe42f('0x6')](_0xe42f('0xb'),auth[_0xe42f('0xc')](),controller['getFields']);router['post']('/',auth[_0xe42f('0xc')](),controller['create']);router['post']('/:id/configurations',auth[_0xe42f('0xc')](),controller[_0xe42f('0xd')]);router[_0xe42f('0xe')](_0xe42f('0xf'),auth[_0xe42f('0xc')](),controller[_0xe42f('0x10')]);router[_0xe42f('0x11')]('/:id',auth[_0xe42f('0xc')](),controller['destroy']);module[_0xe42f('0x12')]=router; \ No newline at end of file +var _0x868a=['./intFreshdeskAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x3c4df3,_0x4431f2){var _0x4ecdfb=function(_0x437953){while(--_0x437953){_0x3c4df3['push'](_0x3c4df3['shift']());}};_0x4ecdfb(++_0x4431f2);}(_0x868a,0x118));var _0xa868=function(_0x3dd92a,_0x45fb73){_0x3dd92a=_0x3dd92a-0x0;var _0x3a9524=_0x868a[_0x3dd92a];return _0x3a9524;};'use strict';var multer=require('multer');var util=require(_0xa868('0x0'));var path=require('path');var timeout=require(_0xa868('0x1'));var express=require(_0xa868('0x2'));var router=express[_0xa868('0x3')]();var auth=require(_0xa868('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa868('0x5'));var controller=require(_0xa868('0x6'));router[_0xa868('0x7')]('/',auth['isAuthenticated'](),controller[_0xa868('0x8')]);router[_0xa868('0x7')]('/:id',auth[_0xa868('0x9')](),controller[_0xa868('0xa')]);router['get'](_0xa868('0xb'),auth[_0xa868('0x9')](),controller[_0xa868('0xc')]);router[_0xa868('0x7')](_0xa868('0xd'),auth[_0xa868('0x9')](),controller[_0xa868('0xe')]);router[_0xa868('0xf')]('/',auth[_0xa868('0x9')](),controller[_0xa868('0x10')]);router[_0xa868('0xf')](_0xa868('0xb'),auth[_0xa868('0x9')](),controller[_0xa868('0x11')]);router[_0xa868('0x12')](_0xa868('0x13'),auth[_0xa868('0x9')](),controller['update']);router[_0xa868('0x14')](_0xa868('0x13'),auth[_0xa868('0x9')](),controller['destroy']);module[_0xa868('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index f588cc4..b639035 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 _0x866a=['username','remoteUri','exports','STRING'];(function(_0x1e974b,_0x132f0d){var _0x387899=function(_0x141df5){while(--_0x141df5){_0x1e974b['push'](_0x1e974b['shift']());}};_0x387899(++_0x132f0d);}(_0x866a,0x156));var _0xa866=function(_0xe4ee1e,_0xea8b9b){_0xe4ee1e=_0xe4ee1e-0x0;var _0x22f903=_0x866a[_0xe4ee1e];return _0x22f903;};'use strict';var Sequelize=require('sequelize');module[_0xa866('0x0')]={'name':{'type':Sequelize[_0xa866('0x1')]},'description':{'type':Sequelize[_0xa866('0x1')]},'username':{'type':Sequelize[_0xa866('0x1')],'unique':_0xa866('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa866('0x1')],'unique':_0xa866('0x3')},'serverUrl':{'type':Sequelize[_0xa866('0x1')]}}; \ No newline at end of file +var _0x6a95=['exports','STRING','username','sequelize'];(function(_0x3f3519,_0xd53cae){var _0x23b6bf=function(_0x3b3e52){while(--_0x3b3e52){_0x3f3519['push'](_0x3f3519['shift']());}};_0x23b6bf(++_0xd53cae);}(_0x6a95,0x1db));var _0x56a9=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x6a95[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'name':{'type':Sequelize[_0x56a9('0x2')]},'description':{'type':Sequelize[_0x56a9('0x2')]},'username':{'type':Sequelize[_0x56a9('0x2')],'unique':_0x56a9('0x3')},'apiKey':{'type':Sequelize[_0x56a9('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 678ebee..f03b904 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['reject','save','update','destroy','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','keys','include','find','create','body','params','getConfigurations','findOne','order','pick','addConfiguration','AccountId','Descriptions','channel','FreshdeskConfiguration','Subjects','FreshdeskField','getFields','remoteUri','slice','substring','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','Sequelize','ValidationError','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','sendStatus','end','status','offset','limit','set','Content-Range','json','apply'];(function(_0x1317ed,_0x57217d){var _0xbaeca=function(_0x24e517){while(--_0x24e517){_0x1317ed['push'](_0x1317ed['shift']());}};_0xbaeca(++_0x57217d);}(_0x1cb9,0x14e));var _0x91cb=function(_0xc7a4c5,_0x170138){_0xc7a4c5=_0xc7a4c5-0x0;var _0x3c86a6=_0x1cb9[_0xc7a4c5];return _0x3c86a6;};'use strict';var pdf=require(_0x91cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x91cb('0x1'));var zipdir=require(_0x91cb('0x2'));var jsonpatch=require(_0x91cb('0x3'));var rp=require(_0x91cb('0x4'));var moment=require('moment');var BPromise=require(_0x91cb('0x5'));var Mustache=require(_0x91cb('0x6'));var util=require('util');var path=require(_0x91cb('0x7'));var sox=require(_0x91cb('0x8'));var csv=require(_0x91cb('0x9'));var ejs=require(_0x91cb('0xa'));var fs=require('fs');var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x9'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x91cb('0x18'));var jayson=require(_0x91cb('0x19'));var client=jayson['client'][_0x91cb('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3ea707,_0x44f2e9,_0x2c7d40){if(_0x2c7d40){var _0x4a7d45=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a7d45['test'](_0x44f2e9)){return _0x3ea707;}else{throw new db[(_0x91cb('0x1b'))][(_0x91cb('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3ea707;}}function respondWithRpcPromise(_0x528f73,_0x576369,_0xc3629e,_0x347980){return new BPromise(function(_0x5ea796,_0x238f11){var _0x135890=_0x347980||client;return _0x135890['request'](_0x528f73,_0xc3629e)[_0x91cb('0x1d')](function(_0x139f4b){logger[_0x91cb('0x1e')](_0x91cb('0x1f'),_0x576369,'request\x20sent');logger[_0x91cb('0x20')](_0x91cb('0x21'),_0x576369,'request\x20sent',JSON[_0x91cb('0x22')](_0x139f4b));if(_0x139f4b['error']){if(_0x139f4b['error'][_0x91cb('0x23')]===0x1f4){logger[_0x91cb('0x24')]('FreshdeskAccount,\x20%s,\x20%s',_0x576369,_0x139f4b['error']['message']);return _0x238f11(_0x139f4b[_0x91cb('0x24')][_0x91cb('0x25')]);}logger[_0x91cb('0x24')](_0x91cb('0x1f'),_0x576369,_0x139f4b['error'][_0x91cb('0x25')]);return _0x5ea796(_0x139f4b[_0x91cb('0x24')][_0x91cb('0x25')]);}else{logger['info'](_0x91cb('0x1f'),_0x576369,_0x91cb('0x26'));_0x5ea796(_0x139f4b[_0x91cb('0x27')][_0x91cb('0x25')]);}})[_0x91cb('0x28')](function(_0x7ad361){logger[_0x91cb('0x24')](_0x91cb('0x1f'),_0x576369,_0x7ad361);_0x238f11(_0x7ad361);});});}function respondWithStatusCode(_0x264e9b,_0x4c8438){_0x4c8438=_0x4c8438||0xcc;return function(_0x59bf3a){if(_0x59bf3a){return _0x264e9b[_0x91cb('0x29')](_0x4c8438);}return _0x264e9b['status'](_0x4c8438)[_0x91cb('0x2a')]();};}function respondWithResult(_0x34d372,_0x318031){_0x318031=_0x318031||0xc8;return function(_0x5595c5){if(_0x5595c5){return _0x34d372[_0x91cb('0x2b')](_0x318031)['json'](_0x5595c5);}};}function respondWithFilteredResult(_0x4572f6,_0x308e8c){return function(_0x3b3ee6){if(_0x3b3ee6){var _0x2fb473=_0x3b3ee6['count'],_0x468908=_0x308e8c[_0x91cb('0x2c')],_0x504275=_0x308e8c[_0x91cb('0x2c')]+_0x308e8c[_0x91cb('0x2d')],_0x2f04a3;if(_0x504275>=_0x2fb473){_0x504275=_0x2fb473;_0x2f04a3=0xc8;}else{_0x2f04a3=0xce;}_0x4572f6['status'](_0x2f04a3);return _0x4572f6[_0x91cb('0x2e')](_0x91cb('0x2f'),_0x468908+'-'+_0x504275+'/'+_0x2fb473)[_0x91cb('0x30')](_0x3b3ee6);}return null;};}function patchUpdates(_0x361e4c){return function(_0xf296bc){try{jsonpatch[_0x91cb('0x31')](_0xf296bc,_0x361e4c,!![]);}catch(_0x1e5bf1){return BPromise[_0x91cb('0x32')](_0x1e5bf1);}return _0xf296bc[_0x91cb('0x33')]();};}function saveUpdates(_0x5e6ed3,_0x2ccf6e){return function(_0x474a15){if(_0x474a15){return _0x474a15[_0x91cb('0x34')](_0x5e6ed3)[_0x91cb('0x1d')](function(_0x440060){return _0x440060;});}return null;};}function removeEntity(_0x4e70cd,_0x2409d3){return function(_0x74b443){if(_0x74b443){return _0x74b443[_0x91cb('0x35')]()[_0x91cb('0x1d')](function(){_0x4e70cd[_0x91cb('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x121c37,_0x5927cb){return function(_0x47fc17){if(!_0x47fc17){_0x121c37['sendStatus'](0x194);}return _0x47fc17;};}function handleError(_0x2011fc,_0x4bba88){_0x4bba88=_0x4bba88||0x1f4;return function(_0x341ebe){logger['error'](_0x341ebe['stack']);if(_0x341ebe[_0x91cb('0x36')]){delete _0x341ebe[_0x91cb('0x36')];}_0x2011fc[_0x91cb('0x2b')](_0x4bba88)[_0x91cb('0x37')](_0x341ebe);};}exports[_0x91cb('0x38')]=function(_0x4b0ca6,_0x8beb3a){var _0x3ddc0b={},_0x13a5ea={},_0x8496a3={'count':0x0,'rows':[]};var _0x486a89=_['map'](db[_0x91cb('0x39')][_0x91cb('0x3a')],function(_0x56d614){return{'name':_0x56d614[_0x91cb('0x3b')],'type':_0x56d614[_0x91cb('0x3c')]['key']};});_0x13a5ea[_0x91cb('0x3d')]=_[_0x91cb('0x3e')](_0x486a89,'name');_0x13a5ea[_0x91cb('0x3f')]=_['keys'](_0x4b0ca6[_0x91cb('0x3f')]);_0x13a5ea[_0x91cb('0x40')]=_[_0x91cb('0x41')](_0x13a5ea[_0x91cb('0x3d')],_0x13a5ea[_0x91cb('0x3f')]);_0x3ddc0b[_0x91cb('0x42')]=_['intersection'](_0x13a5ea[_0x91cb('0x3d')],qs[_0x91cb('0x43')](_0x4b0ca6['query'][_0x91cb('0x43')]));_0x3ddc0b['attributes']=_0x3ddc0b[_0x91cb('0x42')][_0x91cb('0x44')]?_0x3ddc0b[_0x91cb('0x42')]:_0x13a5ea[_0x91cb('0x3d')];if(!_0x4b0ca6['query'][_0x91cb('0x45')](_0x91cb('0x46'))){_0x3ddc0b[_0x91cb('0x2d')]=qs[_0x91cb('0x2d')](_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x2d')]);_0x3ddc0b[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x2c')]);}_0x3ddc0b['order']=qs[_0x91cb('0x47')](_0x4b0ca6['query'][_0x91cb('0x47')]);_0x3ddc0b['where']=qs[_0x91cb('0x40')](_['pick'](_0x4b0ca6[_0x91cb('0x3f')],_0x13a5ea[_0x91cb('0x40')]),_0x486a89);if(_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x48')]){_0x3ddc0b['where']=_[_0x91cb('0x49')](_0x3ddc0b[_0x91cb('0x4a')],{'$or':_['map'](_0x486a89,function(_0x461e1e){if(_0x461e1e[_0x91cb('0x3c')]!==_0x91cb('0x4b')){var _0x32517d={};_0x32517d[_0x461e1e[_0x91cb('0x36')]]={'$like':'%'+_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x48')]+'%'};return _0x32517d;}})});}_0x3ddc0b=_[_0x91cb('0x49')]({},_0x3ddc0b,_0x4b0ca6[_0x91cb('0x4c')]);var _0x4b26f6={'where':_0x3ddc0b[_0x91cb('0x4a')]};return db[_0x91cb('0x39')][_0x91cb('0x4d')](_0x4b26f6)[_0x91cb('0x1d')](function(_0x3314cc){_0x8496a3[_0x91cb('0x4d')]=_0x3314cc;if(_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x4e')]){_0x3ddc0b['include']=[{'all':!![]}];}return db[_0x91cb('0x39')][_0x91cb('0x4f')](_0x3ddc0b);})[_0x91cb('0x1d')](function(_0x3b8cfd){_0x8496a3['rows']=_0x3b8cfd;return _0x8496a3;})[_0x91cb('0x1d')](respondWithFilteredResult(_0x8beb3a,_0x3ddc0b))[_0x91cb('0x28')](handleError(_0x8beb3a,null));};exports['show']=function(_0x212473,_0x47cdb7){var _0x2c419b={'raw':![],'where':{'id':_0x212473['params']['id']}},_0x4c0acd={};_0x4c0acd['model']=_[_0x91cb('0x50')](db[_0x91cb('0x39')][_0x91cb('0x3a')]);_0x4c0acd[_0x91cb('0x3f')]=_[_0x91cb('0x50')](_0x212473['query']);_0x4c0acd['filters']=_[_0x91cb('0x41')](_0x4c0acd[_0x91cb('0x3d')],_0x4c0acd[_0x91cb('0x3f')]);_0x2c419b[_0x91cb('0x42')]=_['intersection'](_0x4c0acd['model'],qs['fields'](_0x212473[_0x91cb('0x3f')]['fields']));_0x2c419b[_0x91cb('0x42')]=_0x2c419b['attributes'][_0x91cb('0x44')]?_0x2c419b[_0x91cb('0x42')]:_0x4c0acd[_0x91cb('0x3d')];if(_0x212473[_0x91cb('0x3f')][_0x91cb('0x4e')]){_0x2c419b[_0x91cb('0x51')]=[{'all':!![]}];}_0x2c419b=_[_0x91cb('0x49')]({},_0x2c419b,_0x212473[_0x91cb('0x4c')]);return db[_0x91cb('0x39')][_0x91cb('0x52')](_0x2c419b)[_0x91cb('0x1d')](handleEntityNotFound(_0x47cdb7,null))['then'](respondWithResult(_0x47cdb7,null))[_0x91cb('0x28')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x53')]=function(_0x4d7a34,_0x3f719b){return db[_0x91cb('0x39')]['create'](_0x4d7a34[_0x91cb('0x54')],{})[_0x91cb('0x1d')](respondWithResult(_0x3f719b,0xc9))[_0x91cb('0x28')](handleError(_0x3f719b,null));};exports[_0x91cb('0x34')]=function(_0x43ddee,_0x42a9ef){if(_0x43ddee[_0x91cb('0x54')]['id']){delete _0x43ddee[_0x91cb('0x54')]['id'];}return db[_0x91cb('0x39')][_0x91cb('0x52')]({'where':{'id':_0x43ddee[_0x91cb('0x55')]['id']}})['then'](handleEntityNotFound(_0x42a9ef,null))[_0x91cb('0x1d')](saveUpdates(_0x43ddee['body'],null))[_0x91cb('0x1d')](respondWithResult(_0x42a9ef,null))['catch'](handleError(_0x42a9ef,null));};exports[_0x91cb('0x35')]=function(_0x1b2fec,_0x1986d7){return db['FreshdeskAccount'][_0x91cb('0x52')]({'where':{'id':_0x1b2fec[_0x91cb('0x55')]['id']}})['then'](handleEntityNotFound(_0x1986d7,null))[_0x91cb('0x1d')](removeEntity(_0x1986d7,null))[_0x91cb('0x28')](handleError(_0x1986d7,null));};exports[_0x91cb('0x56')]=function(_0x25548b,_0x48e825,_0x2f5658){var _0x3854e9={};var _0x4250c2={};var _0x373076;var _0x55a0e3;return db[_0x91cb('0x39')][_0x91cb('0x57')]({'where':{'id':_0x25548b['params']['id']}})['then'](handleEntityNotFound(_0x48e825,null))[_0x91cb('0x1d')](function(_0x525021){if(_0x525021){_0x373076=_0x525021;_0x4250c2[_0x91cb('0x3d')]=_[_0x91cb('0x50')](db['FreshdeskConfiguration']['rawAttributes']);_0x4250c2[_0x91cb('0x3f')]=_['keys'](_0x25548b[_0x91cb('0x3f')]);_0x4250c2[_0x91cb('0x40')]=_[_0x91cb('0x41')](_0x4250c2['model'],_0x4250c2[_0x91cb('0x3f')]);_0x3854e9['attributes']=_[_0x91cb('0x41')](_0x4250c2[_0x91cb('0x3d')],qs[_0x91cb('0x43')](_0x25548b[_0x91cb('0x3f')]['fields']));_0x3854e9[_0x91cb('0x42')]=_0x3854e9[_0x91cb('0x42')][_0x91cb('0x44')]?_0x3854e9[_0x91cb('0x42')]:_0x4250c2[_0x91cb('0x3d')];_0x3854e9[_0x91cb('0x58')]=qs[_0x91cb('0x47')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x47')]);_0x3854e9[_0x91cb('0x4a')]=qs[_0x91cb('0x40')](_[_0x91cb('0x59')](_0x25548b['query'],_0x4250c2[_0x91cb('0x40')]));if(_0x25548b[_0x91cb('0x3f')][_0x91cb('0x48')]){_0x3854e9[_0x91cb('0x4a')]=_[_0x91cb('0x49')](_0x3854e9[_0x91cb('0x4a')],{'$or':_[_0x91cb('0x3e')](_0x3854e9['attributes'],function(_0x325b2d){var _0x5a3c7d={};_0x5a3c7d[_0x325b2d]={'$like':'%'+_0x25548b[_0x91cb('0x3f')][_0x91cb('0x48')]+'%'};return _0x5a3c7d;})});}_0x3854e9=_[_0x91cb('0x49')]({},_0x3854e9,_0x25548b[_0x91cb('0x4c')]);return _0x373076['getConfigurations'](_0x3854e9);}})[_0x91cb('0x1d')](function(_0x22ab40){if(_0x22ab40){_0x55a0e3=_0x22ab40[_0x91cb('0x44')];if(!_0x25548b[_0x91cb('0x3f')][_0x91cb('0x45')](_0x91cb('0x46'))){_0x3854e9['limit']=qs[_0x91cb('0x2d')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x2d')]);_0x3854e9[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x2c')]);}return _0x373076[_0x91cb('0x56')](_0x3854e9);}})[_0x91cb('0x1d')](function(_0x457f81){if(_0x457f81){return _0x457f81?{'count':_0x55a0e3,'rows':_0x457f81}:null;}})[_0x91cb('0x1d')](respondWithResult(_0x48e825,null))[_0x91cb('0x28')](handleError(_0x48e825,null));};exports[_0x91cb('0x5a')]=function(_0x3eead5,_0x2d2613,_0x2605c3){if(_0x3eead5[_0x91cb('0x54')]['id']){delete _0x3eead5['body']['id'];}return db[_0x91cb('0x39')][_0x91cb('0x57')]({'where':{'id':_0x3eead5['params']['id']}})[_0x91cb('0x1d')](handleEntityNotFound(_0x2d2613,null))[_0x91cb('0x1d')](function(_0x1c3e0a){if(_0x1c3e0a){_0x3eead5['body'][_0x91cb('0x5b')]=_0x1c3e0a['id'];_0x3eead5[_0x91cb('0x54')]['Subjects']=integrations['getSubjects'](_0x3eead5[_0x91cb('0x54')]['channel'],_0x3eead5[_0x91cb('0x54')][_0x91cb('0x3c')]);_0x3eead5['body'][_0x91cb('0x5c')]=integrations['getDescriptions'](_0x3eead5[_0x91cb('0x54')][_0x91cb('0x5d')],_0x3eead5['body']['type']);return db[_0x91cb('0x5e')][_0x91cb('0x53')](_0x3eead5[_0x91cb('0x54')],{'include':[{'model':db['FreshdeskField'],'as':_0x91cb('0x5f')},{'model':db[_0x91cb('0x60')],'as':_0x91cb('0x5c')}]});}return null;})[_0x91cb('0x1d')](respondWithResult(_0x2d2613,null))['catch'](handleError(_0x2d2613,null));};exports[_0x91cb('0x61')]=function(_0x4ee1e3,_0x342587,_0x4118eb){var _0x30c607='';return db[_0x91cb('0x39')]['findOne']({'where':{'id':_0x4ee1e3['params']['id']},'attributes':['id',_0x91cb('0x62'),'apiKey']})[_0x91cb('0x1d')](handleEntityNotFound(_0x342587,null))[_0x91cb('0x1d')](function(_0x2ede77){if(_0x2ede77){_0x30c607=_0x2ede77[_0x91cb('0x62')];var _0x33d4ab=_0x30c607[_0x91cb('0x63')](-0x1);if(_0x33d4ab==='/'){_0x30c607=_0x30c607[_0x91cb('0x64')](0x0,_0x30c607['lastIndexOf'](_0x33d4ab));}return rp({'method':_0x91cb('0x65'),'uri':util[_0x91cb('0x66')]('%s/%s',_0x30c607,_0x91cb('0x67')),'headers':{'Authorization':util['format'](_0x91cb('0x68'),new Buffer(util[_0x91cb('0x66')](_0x91cb('0x69'),_0x2ede77[_0x91cb('0x6a')]))[_0x91cb('0x6b')](_0x91cb('0x6c')))},'json':!![]});}})[_0x91cb('0x1d')](function(_0x30259d){if(_0x30259d){var _0x23380a=[_0x91cb('0x6d'),_0x91cb('0x6e'),_0x91cb('0x6f'),_0x91cb('0x70'),_0x91cb('0x2b'),_0x91cb('0x71'),_0x91cb('0x72'),'source',_0x91cb('0x73'),'group',_0x91cb('0x74')];_[_0x91cb('0x75')](_0x30259d,function(_0x13f358){return _0x23380a[_0x91cb('0x76')](_0x13f358[_0x91cb('0x36')])||!_0x13f358[_0x91cb('0x77')]&&_0x13f358[_0x91cb('0x3c')]!==_0x91cb('0x78')&&_0x13f358['type']!==_0x91cb('0x79');});return{'count':_0x30259d[_0x91cb('0x44')],'rows':_['map'](_0x30259d,function(_0x4fb3c0){return{'id':_0x4fb3c0[_0x91cb('0x36')],'name':_0x4fb3c0['label'],'custom':!_0x4fb3c0['default'],'options':_0x4fb3c0[_0x91cb('0x7a')]?_['map'](_0x4fb3c0[_0x91cb('0x7a')],function(_0x498382){return{'name':_[_0x91cb('0x7b')](_0x498382),'value':_0x498382};}):[]};})};}})[_0x91cb('0x1d')](respondWithResult(_0x342587,null))[_0x91cb('0x28')](function(_0x443c01){var _0x4e899c=_0x4ee1e3[_0x91cb('0x3f')][_0x91cb('0x7c')]?0x1f4:_0x443c01[_0x91cb('0x7d')]||0x1f4;logger[_0x91cb('0x24')](_0x91cb('0x7e'),_0x91cb('0x61'),_0x4e899c,JSON[_0x91cb('0x22')](_0x443c01));delete _0x443c01[_0x91cb('0x36')];if(_0x4e899c===0x191){_0x4e899c=0x190;}_0x342587[_0x91cb('0x2b')](_0x4e899c)[_0x91cb('0x37')](_0x4ee1e3[_0x91cb('0x3f')][_0x91cb('0x7c')]?{'message':_0x91cb('0x7f'),'statusCode':_0x443c01[_0x91cb('0x7d')]}:_0x443c01);});}; \ No newline at end of file +var _0x6aa7=['%s/%s','api/v2/ticket_fields','%s:X','apiKey','base64','requester','agent','priority','group','source','ticket_type','default','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','ValidationError','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','map','FreshdeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','show','params','rawAttributes','length','includeAll','find','create','body','getConfigurations','FreshdeskConfiguration','order','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','findOne','remoteUri','slice','lastIndexOf','GET','format'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x6aa7,0x178));var _0x76aa=function(_0x5170d8,_0x52d96e){_0x5170d8=_0x5170d8-0x0;var _0x238d8b=_0x6aa7[_0x5170d8];return _0x238d8b;};'use strict';var pdf=require(_0x76aa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x76aa('0x1'));var zipdir=require(_0x76aa('0x2'));var jsonpatch=require(_0x76aa('0x3'));var rp=require(_0x76aa('0x4'));var moment=require('moment');var BPromise=require(_0x76aa('0x5'));var Mustache=require(_0x76aa('0x6'));var util=require(_0x76aa('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x76aa('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0x8'));var querystring=require(_0x76aa('0xd'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xe'));var authService=require(_0x76aa('0xf'));var qs=require(_0x76aa('0x10'));var as=require(_0x76aa('0x11'));var hardwareService=require(_0x76aa('0x12'));var logger=require(_0x76aa('0x13'))(_0x76aa('0x14'));var utils=require(_0x76aa('0x15'));var config=require(_0x76aa('0x16'));var db=require(_0x76aa('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x76aa('0x18'));var client=jayson['client'][_0x76aa('0x19')]({'port':0x232a});function checkPasswordPattern(_0x12dde0,_0x3f8f6b,_0x8e44ed){if(_0x8e44ed){var _0x10432c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x10432c['test'](_0x3f8f6b)){return _0x12dde0;}else{throw new db['Sequelize'][(_0x76aa('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 _0x12dde0;}}function respondWithRpcPromise(_0x180d92,_0x319bf1,_0x5cf594,_0x2111c7){return new BPromise(function(_0x550d9a,_0x328381){var _0x5181d2=_0x2111c7||client;return _0x5181d2[_0x76aa('0x1b')](_0x180d92,_0x5cf594)[_0x76aa('0x1c')](function(_0x2ab30b){logger[_0x76aa('0x1d')](_0x76aa('0x1e'),_0x319bf1,_0x76aa('0x1f'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x319bf1,_0x76aa('0x1f'),JSON[_0x76aa('0x20')](_0x2ab30b));if(_0x2ab30b[_0x76aa('0x21')]){if(_0x2ab30b[_0x76aa('0x21')][_0x76aa('0x22')]===0x1f4){logger[_0x76aa('0x21')](_0x76aa('0x1e'),_0x319bf1,_0x2ab30b[_0x76aa('0x21')][_0x76aa('0x23')]);return _0x328381(_0x2ab30b['error'][_0x76aa('0x23')]);}logger[_0x76aa('0x21')](_0x76aa('0x1e'),_0x319bf1,_0x2ab30b['error'][_0x76aa('0x23')]);return _0x550d9a(_0x2ab30b[_0x76aa('0x21')][_0x76aa('0x23')]);}else{logger[_0x76aa('0x1d')](_0x76aa('0x1e'),_0x319bf1,_0x76aa('0x1f'));_0x550d9a(_0x2ab30b[_0x76aa('0x24')][_0x76aa('0x23')]);}})[_0x76aa('0x25')](function(_0x2cba6d){logger[_0x76aa('0x21')](_0x76aa('0x1e'),_0x319bf1,_0x2cba6d);_0x328381(_0x2cba6d);});});}function respondWithStatusCode(_0x3599a9,_0x4ef9b0){_0x4ef9b0=_0x4ef9b0||0xcc;return function(_0xb5e8a9){if(_0xb5e8a9){return _0x3599a9[_0x76aa('0x26')](_0x4ef9b0);}return _0x3599a9[_0x76aa('0x27')](_0x4ef9b0)[_0x76aa('0x28')]();};}function respondWithResult(_0xa1e6,_0x2f9316){_0x2f9316=_0x2f9316||0xc8;return function(_0x25a803){if(_0x25a803){return _0xa1e6[_0x76aa('0x27')](_0x2f9316)[_0x76aa('0x29')](_0x25a803);}};}function respondWithFilteredResult(_0x1bdc3d,_0x545b06){return function(_0x3fcb7f){if(_0x3fcb7f){var _0x5a8030=_0x3fcb7f[_0x76aa('0x2a')],_0x994550=_0x545b06[_0x76aa('0x2b')],_0x365ff8=_0x545b06[_0x76aa('0x2b')]+_0x545b06[_0x76aa('0x2c')],_0x2dec94;if(_0x365ff8>=_0x5a8030){_0x365ff8=_0x5a8030;_0x2dec94=0xc8;}else{_0x2dec94=0xce;}_0x1bdc3d[_0x76aa('0x27')](_0x2dec94);return _0x1bdc3d[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x994550+'-'+_0x365ff8+'/'+_0x5a8030)['json'](_0x3fcb7f);}return null;};}function patchUpdates(_0x430ad6){return function(_0x5532c7){try{jsonpatch[_0x76aa('0x2f')](_0x5532c7,_0x430ad6,!![]);}catch(_0x928ccf){return BPromise[_0x76aa('0x30')](_0x928ccf);}return _0x5532c7[_0x76aa('0x31')]();};}function saveUpdates(_0x35a705,_0x4eb57a){return function(_0x258624){if(_0x258624){return _0x258624[_0x76aa('0x32')](_0x35a705)['then'](function(_0x2ee338){return _0x2ee338;});}return null;};}function removeEntity(_0x58d860,_0x2e2ba3){return function(_0x4c90b6){if(_0x4c90b6){return _0x4c90b6[_0x76aa('0x33')]()['then'](function(){_0x58d860['status'](0xcc)[_0x76aa('0x28')]();});}};}function handleEntityNotFound(_0x282c56,_0x198fcb){return function(_0x37dfab){if(!_0x37dfab){_0x282c56['sendStatus'](0x194);}return _0x37dfab;};}function handleError(_0x592596,_0xdb18d3){_0xdb18d3=_0xdb18d3||0x1f4;return function(_0x1c7b6f){logger[_0x76aa('0x21')](_0x1c7b6f[_0x76aa('0x34')]);if(_0x1c7b6f[_0x76aa('0x35')]){delete _0x1c7b6f['name'];}_0x592596[_0x76aa('0x27')](_0xdb18d3)['send'](_0x1c7b6f);};}exports['index']=function(_0x4fdbde,_0x36d64e){var _0x181216={},_0x127bc4={},_0x48cf51={'count':0x0,'rows':[]};var _0x401c07=_[_0x76aa('0x36')](db[_0x76aa('0x37')]['rawAttributes'],function(_0x113770){return{'name':_0x113770[_0x76aa('0x38')],'type':_0x113770[_0x76aa('0x39')][_0x76aa('0x3a')]};});_0x127bc4[_0x76aa('0x3b')]=_[_0x76aa('0x36')](_0x401c07,_0x76aa('0x35'));_0x127bc4[_0x76aa('0x3c')]=_[_0x76aa('0x3d')](_0x4fdbde['query']);_0x127bc4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x127bc4[_0x76aa('0x3b')],_0x127bc4[_0x76aa('0x3c')]);_0x181216[_0x76aa('0x40')]=_[_0x76aa('0x3f')](_0x127bc4['model'],qs['fields'](_0x4fdbde[_0x76aa('0x3c')][_0x76aa('0x41')]));_0x181216[_0x76aa('0x40')]=_0x181216[_0x76aa('0x40')]['length']?_0x181216[_0x76aa('0x40')]:_0x127bc4[_0x76aa('0x3b')];if(!_0x4fdbde[_0x76aa('0x3c')][_0x76aa('0x42')](_0x76aa('0x43'))){_0x181216['limit']=qs[_0x76aa('0x2c')](_0x4fdbde['query'][_0x76aa('0x2c')]);_0x181216['offset']=qs['offset'](_0x4fdbde['query'][_0x76aa('0x2b')]);}_0x181216['order']=qs['sort'](_0x4fdbde['query'][_0x76aa('0x44')]);_0x181216[_0x76aa('0x45')]=qs[_0x76aa('0x3e')](_[_0x76aa('0x46')](_0x4fdbde[_0x76aa('0x3c')],_0x127bc4['filters']),_0x401c07);if(_0x4fdbde[_0x76aa('0x3c')][_0x76aa('0x47')]){_0x181216[_0x76aa('0x45')]=_[_0x76aa('0x48')](_0x181216[_0x76aa('0x45')],{'$or':_['map'](_0x401c07,function(_0x2f695c){if(_0x2f695c[_0x76aa('0x39')]!=='VIRTUAL'){var _0x2d3441={};_0x2d3441[_0x2f695c['name']]={'$like':'%'+_0x4fdbde[_0x76aa('0x3c')][_0x76aa('0x47')]+'%'};return _0x2d3441;}})});}_0x181216=_[_0x76aa('0x48')]({},_0x181216,_0x4fdbde[_0x76aa('0x49')]);var _0x2d0bc4={'where':_0x181216[_0x76aa('0x45')]};return db[_0x76aa('0x37')][_0x76aa('0x2a')](_0x2d0bc4)[_0x76aa('0x1c')](function(_0x3946bd){_0x48cf51['count']=_0x3946bd;if(_0x4fdbde[_0x76aa('0x3c')]['includeAll']){_0x181216[_0x76aa('0x4a')]=[{'all':!![]}];}return db[_0x76aa('0x37')][_0x76aa('0x4b')](_0x181216);})[_0x76aa('0x1c')](function(_0x5ca721){_0x48cf51['rows']=_0x5ca721;return _0x48cf51;})[_0x76aa('0x1c')](respondWithFilteredResult(_0x36d64e,_0x181216))['catch'](handleError(_0x36d64e,null));};exports[_0x76aa('0x4c')]=function(_0x302a0c,_0x4315b3){var _0x2e5633={'raw':![],'where':{'id':_0x302a0c[_0x76aa('0x4d')]['id']}},_0x30c577={};_0x30c577['model']=_['keys'](db[_0x76aa('0x37')][_0x76aa('0x4e')]);_0x30c577[_0x76aa('0x3c')]=_[_0x76aa('0x3d')](_0x302a0c[_0x76aa('0x3c')]);_0x30c577[_0x76aa('0x3e')]=_['intersection'](_0x30c577[_0x76aa('0x3b')],_0x30c577[_0x76aa('0x3c')]);_0x2e5633[_0x76aa('0x40')]=_['intersection'](_0x30c577[_0x76aa('0x3b')],qs['fields'](_0x302a0c[_0x76aa('0x3c')]['fields']));_0x2e5633[_0x76aa('0x40')]=_0x2e5633[_0x76aa('0x40')][_0x76aa('0x4f')]?_0x2e5633[_0x76aa('0x40')]:_0x30c577[_0x76aa('0x3b')];if(_0x302a0c[_0x76aa('0x3c')][_0x76aa('0x50')]){_0x2e5633['include']=[{'all':!![]}];}_0x2e5633=_[_0x76aa('0x48')]({},_0x2e5633,_0x302a0c['options']);return db[_0x76aa('0x37')][_0x76aa('0x51')](_0x2e5633)[_0x76aa('0x1c')](handleEntityNotFound(_0x4315b3,null))[_0x76aa('0x1c')](respondWithResult(_0x4315b3,null))[_0x76aa('0x25')](handleError(_0x4315b3,null));};exports[_0x76aa('0x52')]=function(_0x336024,_0x57941d){return db[_0x76aa('0x37')][_0x76aa('0x52')](_0x336024[_0x76aa('0x53')],{})[_0x76aa('0x1c')](respondWithResult(_0x57941d,0xc9))['catch'](handleError(_0x57941d,null));};exports[_0x76aa('0x32')]=function(_0x163440,_0x8dc601){if(_0x163440[_0x76aa('0x53')]['id']){delete _0x163440[_0x76aa('0x53')]['id'];}return db[_0x76aa('0x37')]['find']({'where':{'id':_0x163440[_0x76aa('0x4d')]['id']}})[_0x76aa('0x1c')](handleEntityNotFound(_0x8dc601,null))[_0x76aa('0x1c')](saveUpdates(_0x163440[_0x76aa('0x53')],null))[_0x76aa('0x1c')](respondWithResult(_0x8dc601,null))[_0x76aa('0x25')](handleError(_0x8dc601,null));};exports[_0x76aa('0x33')]=function(_0x51893b,_0x4910fb){return db[_0x76aa('0x37')][_0x76aa('0x51')]({'where':{'id':_0x51893b['params']['id']}})[_0x76aa('0x1c')](handleEntityNotFound(_0x4910fb,null))[_0x76aa('0x1c')](removeEntity(_0x4910fb,null))['catch'](handleError(_0x4910fb,null));};exports[_0x76aa('0x54')]=function(_0x5e5993,_0x1928c2,_0x22de7c){var _0x24662d={};var _0x1f5010={};var _0x3376ec;var _0x30573a;return db[_0x76aa('0x37')]['findOne']({'where':{'id':_0x5e5993[_0x76aa('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1928c2,null))[_0x76aa('0x1c')](function(_0x46dbac){if(_0x46dbac){_0x3376ec=_0x46dbac;_0x1f5010[_0x76aa('0x3b')]=_[_0x76aa('0x3d')](db[_0x76aa('0x55')][_0x76aa('0x4e')]);_0x1f5010[_0x76aa('0x3c')]=_[_0x76aa('0x3d')](_0x5e5993[_0x76aa('0x3c')]);_0x1f5010['filters']=_[_0x76aa('0x3f')](_0x1f5010[_0x76aa('0x3b')],_0x1f5010[_0x76aa('0x3c')]);_0x24662d[_0x76aa('0x40')]=_[_0x76aa('0x3f')](_0x1f5010[_0x76aa('0x3b')],qs[_0x76aa('0x41')](_0x5e5993[_0x76aa('0x3c')]['fields']));_0x24662d[_0x76aa('0x40')]=_0x24662d['attributes'][_0x76aa('0x4f')]?_0x24662d[_0x76aa('0x40')]:_0x1f5010[_0x76aa('0x3b')];_0x24662d[_0x76aa('0x56')]=qs[_0x76aa('0x44')](_0x5e5993[_0x76aa('0x3c')][_0x76aa('0x44')]);_0x24662d['where']=qs[_0x76aa('0x3e')](_[_0x76aa('0x46')](_0x5e5993['query'],_0x1f5010['filters']));if(_0x5e5993[_0x76aa('0x3c')][_0x76aa('0x47')]){_0x24662d['where']=_[_0x76aa('0x48')](_0x24662d[_0x76aa('0x45')],{'$or':_[_0x76aa('0x36')](_0x24662d['attributes'],function(_0x446073){var _0x47f733={};_0x47f733[_0x446073]={'$like':'%'+_0x5e5993[_0x76aa('0x3c')][_0x76aa('0x47')]+'%'};return _0x47f733;})});}_0x24662d=_[_0x76aa('0x48')]({},_0x24662d,_0x5e5993[_0x76aa('0x49')]);return _0x3376ec['getConfigurations'](_0x24662d);}})['then'](function(_0x40b8f4){if(_0x40b8f4){_0x30573a=_0x40b8f4['length'];if(!_0x5e5993[_0x76aa('0x3c')][_0x76aa('0x42')](_0x76aa('0x43'))){_0x24662d[_0x76aa('0x2c')]=qs[_0x76aa('0x2c')](_0x5e5993[_0x76aa('0x3c')][_0x76aa('0x2c')]);_0x24662d[_0x76aa('0x2b')]=qs[_0x76aa('0x2b')](_0x5e5993['query'][_0x76aa('0x2b')]);}return _0x3376ec[_0x76aa('0x54')](_0x24662d);}})[_0x76aa('0x1c')](function(_0x45ae9f){if(_0x45ae9f){return _0x45ae9f?{'count':_0x30573a,'rows':_0x45ae9f}:null;}})['then'](respondWithResult(_0x1928c2,null))['catch'](handleError(_0x1928c2,null));};exports['addConfiguration']=function(_0x1a01ac,_0x540751,_0xb61e5){if(_0x1a01ac[_0x76aa('0x53')]['id']){delete _0x1a01ac[_0x76aa('0x53')]['id'];}return db[_0x76aa('0x37')]['findOne']({'where':{'id':_0x1a01ac[_0x76aa('0x4d')]['id']}})['then'](handleEntityNotFound(_0x540751,null))[_0x76aa('0x1c')](function(_0x315aa7){if(_0x315aa7){_0x1a01ac[_0x76aa('0x53')][_0x76aa('0x57')]=_0x315aa7['id'];_0x1a01ac[_0x76aa('0x53')]['Subjects']=integrations[_0x76aa('0x58')](_0x1a01ac[_0x76aa('0x53')][_0x76aa('0x59')],_0x1a01ac[_0x76aa('0x53')][_0x76aa('0x39')]);_0x1a01ac[_0x76aa('0x53')][_0x76aa('0x5a')]=integrations[_0x76aa('0x5b')](_0x1a01ac['body'][_0x76aa('0x59')],_0x1a01ac[_0x76aa('0x53')]['type']);return db[_0x76aa('0x55')][_0x76aa('0x52')](_0x1a01ac[_0x76aa('0x53')],{'include':[{'model':db[_0x76aa('0x5c')],'as':_0x76aa('0x5d')},{'model':db[_0x76aa('0x5c')],'as':_0x76aa('0x5a')}]});}return null;})['then'](respondWithResult(_0x540751,null))[_0x76aa('0x25')](handleError(_0x540751,null));};exports['getFields']=function(_0x52f05d,_0x482864,_0x98e574){var _0x5d8947='';return db['FreshdeskAccount'][_0x76aa('0x5e')]({'where':{'id':_0x52f05d[_0x76aa('0x4d')]['id']},'attributes':['id',_0x76aa('0x5f'),'apiKey']})['then'](handleEntityNotFound(_0x482864,null))[_0x76aa('0x1c')](function(_0xb2856c){if(_0xb2856c){_0x5d8947=_0xb2856c[_0x76aa('0x5f')];var _0x5d65ec=_0x5d8947[_0x76aa('0x60')](-0x1);if(_0x5d65ec==='/'){_0x5d8947=_0x5d8947['substring'](0x0,_0x5d8947[_0x76aa('0x61')](_0x5d65ec));}return rp({'method':_0x76aa('0x62'),'uri':util[_0x76aa('0x63')](_0x76aa('0x64'),_0x5d8947,_0x76aa('0x65')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x76aa('0x63')](_0x76aa('0x66'),_0xb2856c[_0x76aa('0x67')]))['toString'](_0x76aa('0x68')))},'json':!![]});}})[_0x76aa('0x1c')](function(_0x2ce07f){if(_0x2ce07f){var _0x42cfc3=[_0x76aa('0x69'),'subject',_0x76aa('0x6a'),'description',_0x76aa('0x27'),_0x76aa('0x6b'),_0x76aa('0x6c'),_0x76aa('0x6d'),_0x76aa('0x6e'),_0x76aa('0x6c'),'company'];_['remove'](_0x2ce07f,function(_0x547411){return _0x42cfc3['includes'](_0x547411['name'])||!_0x547411[_0x76aa('0x6f')]&&_0x547411[_0x76aa('0x39')]!=='custom_text'&&_0x547411['type']!=='custom_dropdown';});return{'count':_0x2ce07f[_0x76aa('0x4f')],'rows':_[_0x76aa('0x36')](_0x2ce07f,function(_0x161593){return{'id':_0x161593['name'],'name':_0x161593['label'],'custom':!_0x161593[_0x76aa('0x6f')],'options':_0x161593[_0x76aa('0x70')]?_[_0x76aa('0x36')](_0x161593[_0x76aa('0x70')],function(_0x354c7b){return{'name':_['capitalize'](_0x354c7b),'value':_0x354c7b};}):[]};})};}})['then'](respondWithResult(_0x482864,null))[_0x76aa('0x25')](function(_0x5c18b4){var _0x5d9381=_0x52f05d['query'][_0x76aa('0x71')]?0x1f4:_0x5c18b4[_0x76aa('0x72')]||0x1f4;logger['error'](_0x76aa('0x73'),_0x76aa('0x74'),_0x5d9381,JSON['stringify'](_0x5c18b4));delete _0x5c18b4[_0x76aa('0x35')];if(_0x5d9381===0x191){_0x5d9381=0x190;}_0x482864[_0x76aa('0x27')](_0x5d9381)[_0x76aa('0x75')](_0x52f05d[_0x76aa('0x3c')][_0x76aa('0x71')]?{'message':_0x76aa('0x76'),'statusCode':_0x5c18b4[_0x76aa('0x72')]}:_0x5c18b4);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 7033ec4..f7d1540 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 _0x9e63=['api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util'];(function(_0x33a8e5,_0x928308){var _0x1b76c8=function(_0x132e58){while(--_0x132e58){_0x33a8e5['push'](_0x33a8e5['shift']());}};_0x1b76c8(++_0x928308);}(_0x9e63,0x1d2));var _0x39e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9e63[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x39e6('0x0'));var util=require(_0x39e6('0x1'));var logger=require('../../config/logger')(_0x39e6('0x2'));var moment=require(_0x39e6('0x3'));var BPromise=require('bluebird');var rp=require(_0x39e6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39e6('0x5'));var config=require(_0x39e6('0x6'));var attributes=require(_0x39e6('0x7'));var integrations=require(_0x39e6('0x8'));module[_0x39e6('0x9')]=function(_0x27275c,_0x3e284a){return _0x27275c[_0x39e6('0xa')](_0x39e6('0xb'),attributes,{'tableName':_0x39e6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc262=['util','api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','int_freshdesk_accounts','lodash'];(function(_0x376dd6,_0x2cc7b7){var _0x45cb12=function(_0x150f7e){while(--_0x150f7e){_0x376dd6['push'](_0x376dd6['shift']());}};_0x45cb12(++_0x2cc7b7);}(_0xc262,0xa4));var _0x2c26=function(_0x34eddf,_0x386e8a){_0x34eddf=_0x34eddf-0x0;var _0x2e87ee=_0xc262[_0x34eddf];return _0x2e87ee;};'use strict';var _=require(_0x2c26('0x0'));var util=require(_0x2c26('0x1'));var logger=require('../../config/logger')(_0x2c26('0x2'));var moment=require(_0x2c26('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c26('0x4'));var fs=require('fs');var path=require(_0x2c26('0x5'));var rimraf=require(_0x2c26('0x6'));var config=require(_0x2c26('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x2c26('0x8'));module[_0x2c26('0x9')]=function(_0x346fa2,_0x39da1b){return _0x346fa2['define']('FreshdeskAccount',attributes,{'tableName':_0x2c26('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 fb2d4ed..eab9f07 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 _0xcedc=['raw','lodash','moment','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','options','where','attributes','limit','include','map','model','then','info','ShowFreshdeskAccount'];(function(_0x200045,_0x4e5da1){var _0x566a8d=function(_0x46b5a1){while(--_0x46b5a1){_0x200045['push'](_0x200045['shift']());}};_0x566a8d(++_0x4e5da1);}(_0xcedc,0x197));var _0xcced=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcedc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcced('0x0'));var util=require('util');var moment=require(_0xcced('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcced('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xcced('0x3'));var logger=require(_0xcced('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcced('0x5'));var client=jayson['client'][_0xcced('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3fd996,_0x1154c5,_0x260f1d){return new BPromise(function(_0x3179b6,_0xec0a63){return client[_0xcced('0x7')](_0x3fd996,_0x260f1d)['then'](function(_0x566bdd){logger['info'](_0xcced('0x8'),_0x1154c5,_0xcced('0x9'));logger[_0xcced('0xa')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x1154c5,_0xcced('0x9'),JSON[_0xcced('0xb')](_0x566bdd));if(_0x566bdd[_0xcced('0xc')]){if(_0x566bdd[_0xcced('0xc')][_0xcced('0xd')]===0x1f4){logger['error'](_0xcced('0x8'),_0x1154c5,_0x566bdd[_0xcced('0xc')][_0xcced('0xe')]);return _0xec0a63(_0x566bdd[_0xcced('0xc')]['message']);}logger[_0xcced('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x1154c5,_0x566bdd[_0xcced('0xc')][_0xcced('0xe')]);return _0x3179b6(_0x566bdd[_0xcced('0xc')][_0xcced('0xe')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x1154c5,'request\x20sent');_0x3179b6(_0x566bdd[_0xcced('0xf')]['message']);}})['catch'](function(_0x59dabe){logger[_0xcced('0xc')](_0xcced('0x8'),_0x1154c5,_0x59dabe);_0xec0a63(_0x59dabe);});});}exports[_0xcced('0x10')]=function(_0x50ee18){var _0x17744a=this;return new Promise(function(_0x28e2c2,_0x5a9ab8){return db[_0xcced('0x11')]['findAll']({'raw':_0x50ee18[_0xcced('0x12')]?_0x50ee18[_0xcced('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x50ee18[_0xcced('0x12')]?_0x50ee18['options'][_0xcced('0x13')]||null:null,'attributes':_0x50ee18[_0xcced('0x12')]?_0x50ee18[_0xcced('0x12')][_0xcced('0x14')]||null:null,'limit':_0x50ee18[_0xcced('0x12')]?_0x50ee18[_0xcced('0x12')][_0xcced('0x15')]||null:null,'include':_0x50ee18[_0xcced('0x12')]?_0x50ee18['options'][_0xcced('0x16')]?_['map'](_0x50ee18[_0xcced('0x12')][_0xcced('0x16')],function(_0x3eda0a){return{'model':db[_0x3eda0a['model']],'as':_0x3eda0a['as'],'attributes':_0x3eda0a[_0xcced('0x14')],'include':_0x3eda0a[_0xcced('0x16')]?_[_0xcced('0x17')](_0x3eda0a[_0xcced('0x16')],function(_0x1ddde0){return{'model':db[_0x1ddde0['model']],'as':_0x1ddde0['as'],'attributes':_0x1ddde0[_0xcced('0x14')],'include':_0x1ddde0[_0xcced('0x16')]?_[_0xcced('0x17')](_0x1ddde0[_0xcced('0x16')],function(_0x4fe2bb){return{'model':db[_0x4fe2bb[_0xcced('0x18')]],'as':_0x4fe2bb['as'],'attributes':_0x4fe2bb['attributes']};}):[]};}):[]};}):[]:[]})[_0xcced('0x19')](function(_0x417baa){logger[_0xcced('0x1a')]('GetFreshdeskAccount',_0x50ee18);logger['debug'](_0xcced('0x10'),_0x50ee18,JSON[_0xcced('0xb')](_0x417baa));_0x28e2c2(_0x417baa);})['catch'](function(_0x557fed){logger[_0xcced('0xc')](_0xcced('0x10'),_0x557fed[_0xcced('0xe')],_0x50ee18);_0x5a9ab8(_0x17744a[_0xcced('0xc')](0x1f4,_0x557fed[_0xcced('0xe')]));});});};exports[_0xcced('0x1b')]=function(_0x25afb2){var _0x158118=this;return new Promise(function(_0x229fab,_0x180915){return db[_0xcced('0x11')]['find']({'raw':_0x25afb2[_0xcced('0x12')]?_0x25afb2[_0xcced('0x12')][_0xcced('0x1c')]===undefined?!![]:![]:!![],'where':_0x25afb2['options']?_0x25afb2[_0xcced('0x12')][_0xcced('0x13')]||null:null,'attributes':_0x25afb2[_0xcced('0x12')]?_0x25afb2['options'][_0xcced('0x14')]||null:null,'include':_0x25afb2[_0xcced('0x12')]?_0x25afb2[_0xcced('0x12')][_0xcced('0x16')]?_[_0xcced('0x17')](_0x25afb2[_0xcced('0x12')][_0xcced('0x16')],function(_0x3220a2){return{'model':db[_0x3220a2[_0xcced('0x18')]],'as':_0x3220a2['as'],'attributes':_0x3220a2['attributes'],'include':_0x3220a2[_0xcced('0x16')]?_[_0xcced('0x17')](_0x3220a2[_0xcced('0x16')],function(_0x441245){return{'model':db[_0x441245['model']],'as':_0x441245['as'],'attributes':_0x441245[_0xcced('0x14')],'include':_0x441245[_0xcced('0x16')]?_[_0xcced('0x17')](_0x441245[_0xcced('0x16')],function(_0x4c27f9){return{'model':db[_0x4c27f9['model']],'as':_0x4c27f9['as'],'attributes':_0x4c27f9[_0xcced('0x14')]};}):[]};}):[]};}):[]:[]})[_0xcced('0x19')](function(_0x341777){logger['info']('ShowFreshdeskAccount',_0x25afb2);logger['debug'](_0xcced('0x1b'),_0x25afb2,JSON[_0xcced('0xb')](_0x341777));_0x229fab(_0x341777);})['catch'](function(_0x2d49bf){logger[_0xcced('0xc')](_0xcced('0x1b'),_0x2d49bf[_0xcced('0xe')],_0x25afb2);_0x180915(_0x158118[_0xcced('0xc')](0x1f4,_0x2d49bf['message']));});});}; \ No newline at end of file +var _0x220c=['include','map','model','GetFreshdeskAccount','catch','ShowFreshdeskAccount','FreshdeskAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','info','result','options','where','attributes','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x220c,0x14d));var _0xc220=function(_0x229f1b,_0x1eca63){_0x229f1b=_0x229f1b-0x0;var _0x7e7505=_0x220c[_0x229f1b];return _0x7e7505;};'use strict';var _=require('lodash');var util=require(_0xc220('0x0'));var moment=require(_0xc220('0x1'));var BPromise=require(_0xc220('0x2'));var rs=require(_0xc220('0x3'));var fs=require('fs');var Redis=require(_0xc220('0x4'));var db=require(_0xc220('0x5'))['db'];var utils=require(_0xc220('0x6'));var logger=require(_0xc220('0x7'))(_0xc220('0x8'));var config=require('../../config/environment');var jayson=require(_0xc220('0x9'));var client=jayson[_0xc220('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfb95bc,_0x4ea5ba,_0x3be979){return new BPromise(function(_0x534561,_0x50dfbe){return client[_0xc220('0xb')](_0xfb95bc,_0x3be979)[_0xc220('0xc')](function(_0x27aeca){logger['info'](_0xc220('0xd'),_0x4ea5ba,'request\x20sent');logger[_0xc220('0xe')](_0xc220('0xf'),_0x4ea5ba,_0xc220('0x10'),JSON[_0xc220('0x11')](_0x27aeca));if(_0x27aeca['error']){if(_0x27aeca['error'][_0xc220('0x12')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x4ea5ba,_0x27aeca['error'][_0xc220('0x13')]);return _0x50dfbe(_0x27aeca[_0xc220('0x14')]['message']);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x4ea5ba,_0x27aeca['error'][_0xc220('0x13')]);return _0x534561(_0x27aeca[_0xc220('0x14')][_0xc220('0x13')]);}else{logger[_0xc220('0x15')]('FreshdeskAccount,\x20%s,\x20%s',_0x4ea5ba,_0xc220('0x10'));_0x534561(_0x27aeca[_0xc220('0x16')][_0xc220('0x13')]);}})['catch'](function(_0x57831b){logger[_0xc220('0x14')](_0xc220('0xd'),_0x4ea5ba,_0x57831b);_0x50dfbe(_0x57831b);});});}exports['GetFreshdeskAccount']=function(_0x37e4f7){var _0x461063=this;return new Promise(function(_0x29ab7d,_0x19c4d3){return db['FreshdeskAccount']['findAll']({'raw':_0x37e4f7[_0xc220('0x17')]?_0x37e4f7[_0xc220('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x37e4f7[_0xc220('0x17')]?_0x37e4f7[_0xc220('0x17')][_0xc220('0x18')]||null:null,'attributes':_0x37e4f7[_0xc220('0x17')]?_0x37e4f7['options'][_0xc220('0x19')]||null:null,'limit':_0x37e4f7[_0xc220('0x17')]?_0x37e4f7[_0xc220('0x17')][_0xc220('0x1a')]||null:null,'include':_0x37e4f7[_0xc220('0x17')]?_0x37e4f7[_0xc220('0x17')][_0xc220('0x1b')]?_[_0xc220('0x1c')](_0x37e4f7[_0xc220('0x17')]['include'],function(_0x2a2fcf){return{'model':db[_0x2a2fcf['model']],'as':_0x2a2fcf['as'],'attributes':_0x2a2fcf[_0xc220('0x19')],'include':_0x2a2fcf['include']?_[_0xc220('0x1c')](_0x2a2fcf[_0xc220('0x1b')],function(_0x10de3a){return{'model':db[_0x10de3a['model']],'as':_0x10de3a['as'],'attributes':_0x10de3a[_0xc220('0x19')],'include':_0x10de3a[_0xc220('0x1b')]?_[_0xc220('0x1c')](_0x10de3a[_0xc220('0x1b')],function(_0x17c091){return{'model':db[_0x17c091[_0xc220('0x1d')]],'as':_0x17c091['as'],'attributes':_0x17c091['attributes']};}):[]};}):[]};}):[]:[]})[_0xc220('0xc')](function(_0x22db65){logger[_0xc220('0x15')]('GetFreshdeskAccount',_0x37e4f7);logger['debug'](_0xc220('0x1e'),_0x37e4f7,JSON[_0xc220('0x11')](_0x22db65));_0x29ab7d(_0x22db65);})[_0xc220('0x1f')](function(_0x722025){logger[_0xc220('0x14')]('GetFreshdeskAccount',_0x722025[_0xc220('0x13')],_0x37e4f7);_0x19c4d3(_0x461063['error'](0x1f4,_0x722025[_0xc220('0x13')]));});});};exports[_0xc220('0x20')]=function(_0x6634b5){var _0x1a19bd=this;return new Promise(function(_0x24c914,_0x4996f0){return db[_0xc220('0x21')][_0xc220('0x22')]({'raw':_0x6634b5['options']?_0x6634b5['options'][_0xc220('0x23')]===undefined?!![]:![]:!![],'where':_0x6634b5[_0xc220('0x17')]?_0x6634b5['options']['where']||null:null,'attributes':_0x6634b5[_0xc220('0x17')]?_0x6634b5['options'][_0xc220('0x19')]||null:null,'include':_0x6634b5['options']?_0x6634b5[_0xc220('0x17')][_0xc220('0x1b')]?_['map'](_0x6634b5['options'][_0xc220('0x1b')],function(_0x47935c){return{'model':db[_0x47935c[_0xc220('0x1d')]],'as':_0x47935c['as'],'attributes':_0x47935c[_0xc220('0x19')],'include':_0x47935c[_0xc220('0x1b')]?_[_0xc220('0x1c')](_0x47935c[_0xc220('0x1b')],function(_0x4dac66){return{'model':db[_0x4dac66[_0xc220('0x1d')]],'as':_0x4dac66['as'],'attributes':_0x4dac66['attributes'],'include':_0x4dac66[_0xc220('0x1b')]?_[_0xc220('0x1c')](_0x4dac66[_0xc220('0x1b')],function(_0x5adc73){return{'model':db[_0x5adc73[_0xc220('0x1d')]],'as':_0x5adc73['as'],'attributes':_0x5adc73['attributes']};}):[]};}):[]};}):[]:[]})[_0xc220('0xc')](function(_0x555f90){logger[_0xc220('0x15')](_0xc220('0x20'),_0x6634b5);logger[_0xc220('0xe')](_0xc220('0x20'),_0x6634b5,JSON[_0xc220('0x11')](_0x555f90));_0x24c914(_0x555f90);})['catch'](function(_0x13741b){logger[_0xc220('0x14')]('ShowFreshdeskAccount',_0x13741b[_0xc220('0x13')],_0x6634b5);_0x4996f0(_0x1a19bd[_0xc220('0x14')](0x1f4,_0x13741b[_0xc220('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 516c798..b4408bf 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 _0x824c=['../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','/:id/tags','setTags','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x562b5f,_0x533966){var _0x128a56=function(_0x493447){while(--_0x493447){_0x562b5f['push'](_0x562b5f['shift']());}};_0x128a56(++_0x533966);}(_0x824c,0x1ce));var _0xc824=function(_0x1c807a,_0x5e6b1f){_0x1c807a=_0x1c807a-0x0;var _0x7b9227=_0x824c[_0x1c807a];return _0x7b9227;};'use strict';var multer=require(_0xc824('0x0'));var util=require(_0xc824('0x1'));var path=require(_0xc824('0x2'));var timeout=require(_0xc824('0x3'));var express=require('express');var router=express[_0xc824('0x4')]();var auth=require(_0xc824('0x5'));var interaction=require(_0xc824('0x6'));var config=require(_0xc824('0x7'));var controller=require(_0xc824('0x8'));router[_0xc824('0x9')]('/',auth[_0xc824('0xa')](),controller[_0xc824('0xb')]);router['get']('/:id',auth[_0xc824('0xa')](),controller['show']);router[_0xc824('0x9')](_0xc824('0xc'),auth[_0xc824('0xa')](),controller[_0xc824('0xd')]);router['get'](_0xc824('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xc824('0x9')](_0xc824('0xf'),auth[_0xc824('0xa')](),controller[_0xc824('0x10')]);router['get']('/:id/tags',auth[_0xc824('0xa')](),controller['getTags']);router[_0xc824('0x11')]('/',auth[_0xc824('0xa')](),controller[_0xc824('0x12')]);router['post'](_0xc824('0x13'),auth['isAuthenticated'](),controller[_0xc824('0x14')]);router[_0xc824('0x15')](_0xc824('0x16'),auth['isAuthenticated'](),controller['update']);router[_0xc824('0x17')](_0xc824('0x16'),auth[_0xc824('0xa')](),controller[_0xc824('0x18')]);module[_0xc824('0x19')]=router; \ No newline at end of file +var _0xc86a=['getDescriptions','/:id/tags','getTags','post','create','update','delete','destroy','exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions'];(function(_0x530d32,_0x298dfc){var _0x198ed1=function(_0x31f586){while(--_0x31f586){_0x530d32['push'](_0x530d32['shift']());}};_0x198ed1(++_0x298dfc);}(_0xc86a,0x1d5));var _0xac86=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0xc86a[_0x3a7a9c];return _0x59156e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xac86('0x0'));var express=require(_0xac86('0x1'));var router=express['Router']();var auth=require(_0xac86('0x2'));var interaction=require(_0xac86('0x3'));var config=require('../../config/environment');var controller=require(_0xac86('0x4'));router[_0xac86('0x5')]('/',auth[_0xac86('0x6')](),controller[_0xac86('0x7')]);router[_0xac86('0x5')](_0xac86('0x8'),auth['isAuthenticated'](),controller[_0xac86('0x9')]);router['get'](_0xac86('0xa'),auth[_0xac86('0x6')](),controller[_0xac86('0xb')]);router[_0xac86('0x5')](_0xac86('0xc'),auth[_0xac86('0x6')](),controller['getSubjects']);router[_0xac86('0x5')](_0xac86('0xd'),auth[_0xac86('0x6')](),controller[_0xac86('0xe')]);router[_0xac86('0x5')](_0xac86('0xf'),auth[_0xac86('0x6')](),controller[_0xac86('0x10')]);router[_0xac86('0x11')]('/',auth[_0xac86('0x6')](),controller[_0xac86('0x12')]);router[_0xac86('0x11')](_0xac86('0xf'),auth[_0xac86('0x6')](),controller['setTags']);router['put'](_0xac86('0x8'),auth['isAuthenticated'](),controller[_0xac86('0x13')]);router[_0xac86('0x14')](_0xac86('0x8'),auth[_0xac86('0x6')](),controller[_0xac86('0x15')]);module[_0xac86('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index eff82af..b296cbe 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 _0x4e48=['STRING','sequelize','exports'];(function(_0x3210fa,_0x5d2edf){var _0xebc2d9=function(_0x4b4216){while(--_0x4b4216){_0x3210fa['push'](_0x3210fa['shift']());}};_0xebc2d9(++_0x5d2edf);}(_0x4e48,0xd9));var _0x84e4=function(_0x3f48f5,_0x3a7dd6){_0x3f48f5=_0x3f48f5-0x0;var _0x25d660=_0x4e48[_0x3f48f5];return _0x25d660;};'use strict';var Sequelize=require(_0x84e4('0x0'));module[_0x84e4('0x1')]={'name':{'type':Sequelize[_0x84e4('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb97d=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb97d,0x132));var _0xdb97=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xb97d[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0xdb97('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb97('0x1')]},'description':{'type':Sequelize[_0xdb97('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index cdd1480..e2a2c32 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 _0x6b1d=['find','create','body','getFields','FreshdeskField','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','setTags','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','index','map','FreshdeskConfiguration','type','key','model','name','keys','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x6b1d,0xc9));var _0xd6b1=function(_0x705b98,_0x1c345b){_0x705b98=_0x705b98-0x0;var _0x47b72f=_0x6b1d[_0x705b98];return _0x47b72f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd6b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd6b1('0x1'));var jsonpatch=require(_0xd6b1('0x2'));var rp=require(_0xd6b1('0x3'));var moment=require(_0xd6b1('0x4'));var BPromise=require(_0xd6b1('0x5'));var Mustache=require('mustache');var util=require(_0xd6b1('0x6'));var path=require('path');var sox=require(_0xd6b1('0x7'));var csv=require(_0xd6b1('0x8'));var ejs=require(_0xd6b1('0x9'));var fs=require('fs');var _=require(_0xd6b1('0xa'));var squel=require(_0xd6b1('0xb'));var crypto=require(_0xd6b1('0xc'));var jsforce=require(_0xd6b1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd6b1('0x8'));var querystring=require(_0xd6b1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd6b1('0xf'));var qs=require(_0xd6b1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6b1('0x11'));var logger=require(_0xd6b1('0x12'))(_0xd6b1('0x13'));var utils=require(_0xd6b1('0x14'));var config=require(_0xd6b1('0x15'));var db=require(_0xd6b1('0x16'))['db'];var jayson=require(_0xd6b1('0x17'));var client=jayson[_0xd6b1('0x18')][_0xd6b1('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1a2341,_0x2c3269,_0x506f09){if(_0x506f09){var _0x20210b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20210b[_0xd6b1('0x1a')](_0x2c3269)){return _0x1a2341;}else{throw new db[(_0xd6b1('0x1b'))][(_0xd6b1('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1a2341;}}function respondWithRpcPromise(_0x2ca32b,_0x26a6ad,_0x5115ff,_0x426e9e){return new BPromise(function(_0x2ad390,_0x25452e){var _0x563651=_0x426e9e||client;return _0x563651[_0xd6b1('0x1d')](_0x2ca32b,_0x5115ff)[_0xd6b1('0x1e')](function(_0x3cbdfe){logger[_0xd6b1('0x1f')](_0xd6b1('0x20'),_0x26a6ad,'request\x20sent');logger[_0xd6b1('0x21')](_0xd6b1('0x22'),_0x26a6ad,'request\x20sent',JSON[_0xd6b1('0x23')](_0x3cbdfe));if(_0x3cbdfe['error']){if(_0x3cbdfe['error'][_0xd6b1('0x24')]===0x1f4){logger[_0xd6b1('0x25')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x26a6ad,_0x3cbdfe[_0xd6b1('0x25')][_0xd6b1('0x26')]);return _0x25452e(_0x3cbdfe['error'][_0xd6b1('0x26')]);}logger[_0xd6b1('0x25')](_0xd6b1('0x20'),_0x26a6ad,_0x3cbdfe[_0xd6b1('0x25')][_0xd6b1('0x26')]);return _0x2ad390(_0x3cbdfe['error'][_0xd6b1('0x26')]);}else{logger[_0xd6b1('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x26a6ad,_0xd6b1('0x27'));_0x2ad390(_0x3cbdfe[_0xd6b1('0x28')][_0xd6b1('0x26')]);}})[_0xd6b1('0x29')](function(_0x44c160){logger[_0xd6b1('0x25')](_0xd6b1('0x20'),_0x26a6ad,_0x44c160);_0x25452e(_0x44c160);});});}function respondWithStatusCode(_0x88a845,_0x522c1e){_0x522c1e=_0x522c1e||0xcc;return function(_0x2bee7b){if(_0x2bee7b){return _0x88a845[_0xd6b1('0x2a')](_0x522c1e);}return _0x88a845[_0xd6b1('0x2b')](_0x522c1e)[_0xd6b1('0x2c')]();};}function respondWithResult(_0xd01925,_0x3a40a8){_0x3a40a8=_0x3a40a8||0xc8;return function(_0x3fbfdf){if(_0x3fbfdf){return _0xd01925[_0xd6b1('0x2b')](_0x3a40a8)[_0xd6b1('0x2d')](_0x3fbfdf);}};}function respondWithFilteredResult(_0x72fbe0,_0x35298f){return function(_0x102ca1){if(_0x102ca1){var _0xd1280f=_0x102ca1[_0xd6b1('0x2e')],_0x5c69e2=_0x35298f['offset'],_0x1f7cc9=_0x35298f[_0xd6b1('0x2f')]+_0x35298f[_0xd6b1('0x30')],_0x343c29;if(_0x1f7cc9>=_0xd1280f){_0x1f7cc9=_0xd1280f;_0x343c29=0xc8;}else{_0x343c29=0xce;}_0x72fbe0[_0xd6b1('0x2b')](_0x343c29);return _0x72fbe0[_0xd6b1('0x31')](_0xd6b1('0x32'),_0x5c69e2+'-'+_0x1f7cc9+'/'+_0xd1280f)[_0xd6b1('0x2d')](_0x102ca1);}return null;};}function patchUpdates(_0x1cfe9a){return function(_0x1ed884){try{jsonpatch['apply'](_0x1ed884,_0x1cfe9a,!![]);}catch(_0x5179a9){return BPromise[_0xd6b1('0x33')](_0x5179a9);}return _0x1ed884[_0xd6b1('0x34')]();};}function saveUpdates(_0x1bd144,_0x3192f0){return function(_0x2d74e1){if(_0x2d74e1){return _0x2d74e1[_0xd6b1('0x35')](_0x1bd144)[_0xd6b1('0x1e')](function(_0x4a1027){return _0x4a1027;});}return null;};}function removeEntity(_0x4df3b1,_0x173ef4){return function(_0xc43c61){if(_0xc43c61){return _0xc43c61[_0xd6b1('0x36')]()[_0xd6b1('0x1e')](function(){_0x4df3b1[_0xd6b1('0x2b')](0xcc)[_0xd6b1('0x2c')]();});}};}function handleEntityNotFound(_0x5aad30,_0x3a7b5f){return function(_0x325673){if(!_0x325673){_0x5aad30[_0xd6b1('0x2a')](0x194);}return _0x325673;};}function handleError(_0x175394,_0x3f2f0e){_0x3f2f0e=_0x3f2f0e||0x1f4;return function(_0x500f80){logger[_0xd6b1('0x25')](_0x500f80[_0xd6b1('0x37')]);if(_0x500f80['name']){delete _0x500f80['name'];}_0x175394['status'](_0x3f2f0e)['send'](_0x500f80);};}exports[_0xd6b1('0x38')]=function(_0x2898b5,_0x398150){var _0x2b02dc={},_0x21d248={},_0x14cd4e={'count':0x0,'rows':[]};var _0x2c030d=_[_0xd6b1('0x39')](db[_0xd6b1('0x3a')]['rawAttributes'],function(_0x202d98){return{'name':_0x202d98['fieldName'],'type':_0x202d98[_0xd6b1('0x3b')][_0xd6b1('0x3c')]};});_0x21d248[_0xd6b1('0x3d')]=_['map'](_0x2c030d,_0xd6b1('0x3e'));_0x21d248['query']=_[_0xd6b1('0x3f')](_0x2898b5['query']);_0x21d248['filters']=_['intersection'](_0x21d248[_0xd6b1('0x3d')],_0x21d248[_0xd6b1('0x40')]);_0x2b02dc[_0xd6b1('0x41')]=_[_0xd6b1('0x42')](_0x21d248['model'],qs[_0xd6b1('0x43')](_0x2898b5[_0xd6b1('0x40')][_0xd6b1('0x43')]));_0x2b02dc[_0xd6b1('0x41')]=_0x2b02dc[_0xd6b1('0x41')][_0xd6b1('0x44')]?_0x2b02dc['attributes']:_0x21d248['model'];if(!_0x2898b5['query']['hasOwnProperty'](_0xd6b1('0x45'))){_0x2b02dc[_0xd6b1('0x30')]=qs[_0xd6b1('0x30')](_0x2898b5[_0xd6b1('0x40')][_0xd6b1('0x30')]);_0x2b02dc[_0xd6b1('0x2f')]=qs[_0xd6b1('0x2f')](_0x2898b5[_0xd6b1('0x40')][_0xd6b1('0x2f')]);}_0x2b02dc[_0xd6b1('0x46')]=qs['sort'](_0x2898b5[_0xd6b1('0x40')][_0xd6b1('0x47')]);_0x2b02dc[_0xd6b1('0x48')]=qs[_0xd6b1('0x49')](_[_0xd6b1('0x4a')](_0x2898b5[_0xd6b1('0x40')],_0x21d248['filters']),_0x2c030d);if(_0x2898b5[_0xd6b1('0x40')][_0xd6b1('0x4b')]){_0x2b02dc['where']=_[_0xd6b1('0x4c')](_0x2b02dc[_0xd6b1('0x48')],{'$or':_[_0xd6b1('0x39')](_0x2c030d,function(_0x114840){if(_0x114840['type']!=='VIRTUAL'){var _0x208a4b={};_0x208a4b[_0x114840[_0xd6b1('0x3e')]]={'$like':'%'+_0x2898b5['query'][_0xd6b1('0x4b')]+'%'};return _0x208a4b;}})});}_0x2b02dc=_[_0xd6b1('0x4c')]({},_0x2b02dc,_0x2898b5[_0xd6b1('0x4d')]);var _0x5cfcb8={'where':_0x2b02dc['where']};return db[_0xd6b1('0x3a')]['count'](_0x5cfcb8)['then'](function(_0x56f5ec){_0x14cd4e['count']=_0x56f5ec;if(_0x2898b5['query'][_0xd6b1('0x4e')]){_0x2b02dc[_0xd6b1('0x4f')]=[{'all':!![]}];}return db[_0xd6b1('0x3a')][_0xd6b1('0x50')](_0x2b02dc);})[_0xd6b1('0x1e')](function(_0x1e957f){_0x14cd4e['rows']=_0x1e957f;return _0x14cd4e;})[_0xd6b1('0x1e')](respondWithFilteredResult(_0x398150,_0x2b02dc))[_0xd6b1('0x29')](handleError(_0x398150,null));};exports[_0xd6b1('0x51')]=function(_0x1a2a93,_0x12ad7f){var _0x2d568c={'raw':![],'where':{'id':_0x1a2a93[_0xd6b1('0x52')]['id']}},_0x2bd643={};_0x2bd643[_0xd6b1('0x3d')]=_[_0xd6b1('0x3f')](db[_0xd6b1('0x3a')][_0xd6b1('0x53')]);_0x2bd643[_0xd6b1('0x40')]=_[_0xd6b1('0x3f')](_0x1a2a93[_0xd6b1('0x40')]);_0x2bd643[_0xd6b1('0x49')]=_[_0xd6b1('0x42')](_0x2bd643[_0xd6b1('0x3d')],_0x2bd643[_0xd6b1('0x40')]);_0x2d568c[_0xd6b1('0x41')]=_[_0xd6b1('0x42')](_0x2bd643[_0xd6b1('0x3d')],qs[_0xd6b1('0x43')](_0x1a2a93['query'][_0xd6b1('0x43')]));_0x2d568c[_0xd6b1('0x41')]=_0x2d568c[_0xd6b1('0x41')][_0xd6b1('0x44')]?_0x2d568c['attributes']:_0x2bd643[_0xd6b1('0x3d')];if(_0x1a2a93[_0xd6b1('0x40')][_0xd6b1('0x4e')]){_0x2d568c[_0xd6b1('0x4f')]=[{'all':!![]}];}_0x2d568c=_['merge']({},_0x2d568c,_0x1a2a93[_0xd6b1('0x4d')]);return db[_0xd6b1('0x3a')][_0xd6b1('0x54')](_0x2d568c)[_0xd6b1('0x1e')](handleEntityNotFound(_0x12ad7f,null))[_0xd6b1('0x1e')](respondWithResult(_0x12ad7f,null))[_0xd6b1('0x29')](handleError(_0x12ad7f,null));};exports['create']=function(_0x2f4a9f,_0x5b2f4d){return db[_0xd6b1('0x3a')][_0xd6b1('0x55')](_0x2f4a9f[_0xd6b1('0x56')],{})['then'](respondWithResult(_0x5b2f4d,0xc9))['catch'](handleError(_0x5b2f4d,null));};exports['update']=function(_0x12a642,_0x35b515){if(_0x12a642[_0xd6b1('0x56')]['id']){delete _0x12a642[_0xd6b1('0x56')]['id'];}return db[_0xd6b1('0x3a')]['find']({'where':{'id':_0x12a642[_0xd6b1('0x52')]['id']}})[_0xd6b1('0x1e')](handleEntityNotFound(_0x35b515,null))[_0xd6b1('0x1e')](saveUpdates(_0x12a642[_0xd6b1('0x56')],null))[_0xd6b1('0x1e')](respondWithResult(_0x35b515,null))[_0xd6b1('0x29')](handleError(_0x35b515,null));};exports[_0xd6b1('0x36')]=function(_0x39aa54,_0x3c005f){return db[_0xd6b1('0x3a')][_0xd6b1('0x54')]({'where':{'id':_0x39aa54[_0xd6b1('0x52')]['id']}})[_0xd6b1('0x1e')](handleEntityNotFound(_0x3c005f,null))[_0xd6b1('0x1e')](removeEntity(_0x3c005f,null))[_0xd6b1('0x29')](handleError(_0x3c005f,null));};exports[_0xd6b1('0x57')]=function(_0x2c17f3,_0x5e8bac,_0xaaf2d5){var _0x1a850e={};var _0x3c4dcc={};var _0x98da8b;var _0x474bd2;return db[_0xd6b1('0x3a')]['findOne']({'where':{'id':_0x2c17f3['params']['id']}})[_0xd6b1('0x1e')](handleEntityNotFound(_0x5e8bac,null))[_0xd6b1('0x1e')](function(_0x5e5ede){if(_0x5e5ede){_0x98da8b=_0x5e5ede;_0x3c4dcc[_0xd6b1('0x3d')]=_[_0xd6b1('0x3f')](db[_0xd6b1('0x58')]['rawAttributes']);_0x3c4dcc[_0xd6b1('0x40')]=_[_0xd6b1('0x3f')](_0x2c17f3[_0xd6b1('0x40')]);_0x3c4dcc[_0xd6b1('0x49')]=_[_0xd6b1('0x42')](_0x3c4dcc[_0xd6b1('0x3d')],_0x3c4dcc[_0xd6b1('0x40')]);_0x1a850e[_0xd6b1('0x41')]=_[_0xd6b1('0x42')](_0x3c4dcc['model'],qs['fields'](_0x2c17f3[_0xd6b1('0x40')][_0xd6b1('0x43')]));_0x1a850e[_0xd6b1('0x41')]=_0x1a850e['attributes'][_0xd6b1('0x44')]?_0x1a850e[_0xd6b1('0x41')]:_0x3c4dcc['model'];_0x1a850e[_0xd6b1('0x46')]=qs[_0xd6b1('0x47')](_0x2c17f3[_0xd6b1('0x40')][_0xd6b1('0x47')]);_0x1a850e[_0xd6b1('0x48')]=qs['filters'](_[_0xd6b1('0x4a')](_0x2c17f3[_0xd6b1('0x40')],_0x3c4dcc['filters']));if(_0x2c17f3[_0xd6b1('0x40')]['filter']){_0x1a850e[_0xd6b1('0x48')]=_[_0xd6b1('0x4c')](_0x1a850e[_0xd6b1('0x48')],{'$or':_[_0xd6b1('0x39')](_0x1a850e['attributes'],function(_0x370620){var _0x163981={};_0x163981[_0x370620]={'$like':'%'+_0x2c17f3[_0xd6b1('0x40')][_0xd6b1('0x4b')]+'%'};return _0x163981;})});}_0x1a850e=_[_0xd6b1('0x4c')]({},_0x1a850e,_0x2c17f3[_0xd6b1('0x4d')]);return _0x98da8b[_0xd6b1('0x57')](_0x1a850e);}})['then'](function(_0x4e5b25){if(_0x4e5b25){_0x474bd2=_0x4e5b25[_0xd6b1('0x44')];if(!_0x2c17f3[_0xd6b1('0x40')][_0xd6b1('0x59')](_0xd6b1('0x45'))){_0x1a850e[_0xd6b1('0x30')]=qs[_0xd6b1('0x30')](_0x2c17f3['query'][_0xd6b1('0x30')]);_0x1a850e[_0xd6b1('0x2f')]=qs[_0xd6b1('0x2f')](_0x2c17f3[_0xd6b1('0x40')][_0xd6b1('0x2f')]);}return _0x98da8b['getFields'](_0x1a850e);}})[_0xd6b1('0x1e')](function(_0x50884b){if(_0x50884b){return _0x50884b?{'count':_0x474bd2,'rows':_0x50884b}:null;}})[_0xd6b1('0x1e')](respondWithResult(_0x5e8bac,null))[_0xd6b1('0x29')](handleError(_0x5e8bac,null));};exports[_0xd6b1('0x5a')]=function(_0x4fa51b,_0x2dd4c7,_0x3c8679){var _0x597438={};var _0x2b808a={};var _0x38ac1c;var _0x103d5c;return db[_0xd6b1('0x3a')][_0xd6b1('0x5b')]({'where':{'id':_0x4fa51b['params']['id']}})[_0xd6b1('0x1e')](handleEntityNotFound(_0x2dd4c7,null))[_0xd6b1('0x1e')](function(_0x1d3045){if(_0x1d3045){_0x38ac1c=_0x1d3045;_0x2b808a['model']=_[_0xd6b1('0x3f')](db[_0xd6b1('0x58')][_0xd6b1('0x53')]);_0x2b808a[_0xd6b1('0x40')]=_[_0xd6b1('0x3f')](_0x4fa51b[_0xd6b1('0x40')]);_0x2b808a[_0xd6b1('0x49')]=_[_0xd6b1('0x42')](_0x2b808a['model'],_0x2b808a['query']);_0x597438[_0xd6b1('0x41')]=_['intersection'](_0x2b808a[_0xd6b1('0x3d')],qs[_0xd6b1('0x43')](_0x4fa51b[_0xd6b1('0x40')]['fields']));_0x597438[_0xd6b1('0x41')]=_0x597438['attributes'][_0xd6b1('0x44')]?_0x597438[_0xd6b1('0x41')]:_0x2b808a[_0xd6b1('0x3d')];_0x597438[_0xd6b1('0x46')]=qs[_0xd6b1('0x47')](_0x4fa51b[_0xd6b1('0x40')][_0xd6b1('0x47')]);_0x597438[_0xd6b1('0x48')]=qs['filters'](_[_0xd6b1('0x4a')](_0x4fa51b[_0xd6b1('0x40')],_0x2b808a[_0xd6b1('0x49')]));if(_0x4fa51b[_0xd6b1('0x40')]['filter']){_0x597438['where']=_['merge'](_0x597438[_0xd6b1('0x48')],{'$or':_['map'](_0x597438['attributes'],function(_0x55e38d){var _0x4065cc={};_0x4065cc[_0x55e38d]={'$like':'%'+_0x4fa51b[_0xd6b1('0x40')][_0xd6b1('0x4b')]+'%'};return _0x4065cc;})});}_0x597438=_[_0xd6b1('0x4c')]({},_0x597438,_0x4fa51b[_0xd6b1('0x4d')]);return _0x38ac1c['getSubjects'](_0x597438);}})[_0xd6b1('0x1e')](function(_0x3b0f83){if(_0x3b0f83){_0x103d5c=_0x3b0f83[_0xd6b1('0x44')];if(!_0x4fa51b[_0xd6b1('0x40')][_0xd6b1('0x59')](_0xd6b1('0x45'))){_0x597438['limit']=qs[_0xd6b1('0x30')](_0x4fa51b[_0xd6b1('0x40')][_0xd6b1('0x30')]);_0x597438['offset']=qs[_0xd6b1('0x2f')](_0x4fa51b[_0xd6b1('0x40')]['offset']);}return _0x38ac1c['getSubjects'](_0x597438);}})[_0xd6b1('0x1e')](function(_0x4d11a4){if(_0x4d11a4){return _0x4d11a4?{'count':_0x103d5c,'rows':_0x4d11a4}:null;}})[_0xd6b1('0x1e')](respondWithResult(_0x2dd4c7,null))[_0xd6b1('0x29')](handleError(_0x2dd4c7,null));};exports[_0xd6b1('0x5c')]=function(_0x3c2e43,_0x34ec1b,_0x659201){var _0x3804ac={};var _0x422c2b={};var _0xfbdaf5;var _0x3b1539;return db[_0xd6b1('0x3a')][_0xd6b1('0x5b')]({'where':{'id':_0x3c2e43['params']['id']}})[_0xd6b1('0x1e')](handleEntityNotFound(_0x34ec1b,null))['then'](function(_0x1eb637){if(_0x1eb637){_0xfbdaf5=_0x1eb637;_0x422c2b[_0xd6b1('0x3d')]=_[_0xd6b1('0x3f')](db[_0xd6b1('0x58')][_0xd6b1('0x53')]);_0x422c2b[_0xd6b1('0x40')]=_[_0xd6b1('0x3f')](_0x3c2e43['query']);_0x422c2b[_0xd6b1('0x49')]=_[_0xd6b1('0x42')](_0x422c2b['model'],_0x422c2b[_0xd6b1('0x40')]);_0x3804ac[_0xd6b1('0x41')]=_[_0xd6b1('0x42')](_0x422c2b[_0xd6b1('0x3d')],qs['fields'](_0x3c2e43['query'][_0xd6b1('0x43')]));_0x3804ac['attributes']=_0x3804ac[_0xd6b1('0x41')]['length']?_0x3804ac[_0xd6b1('0x41')]:_0x422c2b[_0xd6b1('0x3d')];_0x3804ac['order']=qs['sort'](_0x3c2e43[_0xd6b1('0x40')][_0xd6b1('0x47')]);_0x3804ac[_0xd6b1('0x48')]=qs['filters'](_[_0xd6b1('0x4a')](_0x3c2e43['query'],_0x422c2b[_0xd6b1('0x49')]));if(_0x3c2e43['query'][_0xd6b1('0x4b')]){_0x3804ac[_0xd6b1('0x48')]=_[_0xd6b1('0x4c')](_0x3804ac['where'],{'$or':_[_0xd6b1('0x39')](_0x3804ac['attributes'],function(_0x2a37d5){var _0x394488={};_0x394488[_0x2a37d5]={'$like':'%'+_0x3c2e43['query']['filter']+'%'};return _0x394488;})});}_0x3804ac=_['merge']({},_0x3804ac,_0x3c2e43[_0xd6b1('0x4d')]);return _0xfbdaf5[_0xd6b1('0x5c')](_0x3804ac);}})[_0xd6b1('0x1e')](function(_0x3647fd){if(_0x3647fd){_0x3b1539=_0x3647fd[_0xd6b1('0x44')];if(!_0x3c2e43[_0xd6b1('0x40')]['hasOwnProperty'](_0xd6b1('0x45'))){_0x3804ac[_0xd6b1('0x30')]=qs[_0xd6b1('0x30')](_0x3c2e43[_0xd6b1('0x40')]['limit']);_0x3804ac[_0xd6b1('0x2f')]=qs[_0xd6b1('0x2f')](_0x3c2e43[_0xd6b1('0x40')][_0xd6b1('0x2f')]);}return _0xfbdaf5[_0xd6b1('0x5c')](_0x3804ac);}})[_0xd6b1('0x1e')](function(_0xd4167b){if(_0xd4167b){return _0xd4167b?{'count':_0x3b1539,'rows':_0xd4167b}:null;}})['then'](respondWithResult(_0x34ec1b,null))[_0xd6b1('0x29')](handleError(_0x34ec1b,null));};exports[_0xd6b1('0x5d')]=function(_0x223e4a,_0x59bc1e,_0x5cccf5){var _0x47d369={};var _0x36d1f2={};var _0x5d8996;var _0x3a0306;return db[_0xd6b1('0x3a')][_0xd6b1('0x5b')]({'where':{'id':_0x223e4a[_0xd6b1('0x52')]['id']}})[_0xd6b1('0x1e')](handleEntityNotFound(_0x59bc1e,null))['then'](function(_0x388272){if(_0x388272){_0x5d8996=_0x388272;_0x36d1f2[_0xd6b1('0x3d')]=_[_0xd6b1('0x3f')](db['Tag'][_0xd6b1('0x53')]);_0x36d1f2[_0xd6b1('0x40')]=_['keys'](_0x223e4a[_0xd6b1('0x40')]);_0x36d1f2[_0xd6b1('0x49')]=_['intersection'](_0x36d1f2['model'],_0x36d1f2[_0xd6b1('0x40')]);_0x47d369['attributes']=_[_0xd6b1('0x42')](_0x36d1f2[_0xd6b1('0x3d')],qs['fields'](_0x223e4a[_0xd6b1('0x40')][_0xd6b1('0x43')]));_0x47d369['attributes']=_0x47d369[_0xd6b1('0x41')][_0xd6b1('0x44')]?_0x47d369[_0xd6b1('0x41')]:_0x36d1f2[_0xd6b1('0x3d')];_0x47d369['order']=qs[_0xd6b1('0x47')](_0x223e4a[_0xd6b1('0x40')]['sort']);_0x47d369[_0xd6b1('0x48')]=qs['filters'](_[_0xd6b1('0x4a')](_0x223e4a[_0xd6b1('0x40')],_0x36d1f2[_0xd6b1('0x49')]));if(_0x223e4a[_0xd6b1('0x40')][_0xd6b1('0x4b')]){_0x47d369['where']=_[_0xd6b1('0x4c')](_0x47d369[_0xd6b1('0x48')],{'$or':_[_0xd6b1('0x39')](_0x47d369[_0xd6b1('0x41')],function(_0x30b9f4){var _0x3ac767={};_0x3ac767[_0x30b9f4]={'$like':'%'+_0x223e4a[_0xd6b1('0x40')][_0xd6b1('0x4b')]+'%'};return _0x3ac767;})});}_0x47d369=_[_0xd6b1('0x4c')]({},_0x47d369,_0x223e4a[_0xd6b1('0x4d')]);return _0x5d8996[_0xd6b1('0x5d')](_0x47d369);}})[_0xd6b1('0x1e')](function(_0x565432){if(_0x565432){_0x3a0306=_0x565432[_0xd6b1('0x44')];if(!_0x223e4a[_0xd6b1('0x40')][_0xd6b1('0x59')](_0xd6b1('0x45'))){_0x47d369[_0xd6b1('0x30')]=qs[_0xd6b1('0x30')](_0x223e4a['query'][_0xd6b1('0x30')]);_0x47d369[_0xd6b1('0x2f')]=qs[_0xd6b1('0x2f')](_0x223e4a[_0xd6b1('0x40')][_0xd6b1('0x2f')]);}return _0x5d8996['getTags'](_0x47d369);}})[_0xd6b1('0x1e')](function(_0x5cb128){if(_0x5cb128){return _0x5cb128?{'count':_0x3a0306,'rows':_0x5cb128}:null;}})['then'](respondWithResult(_0x59bc1e,null))[_0xd6b1('0x29')](handleError(_0x59bc1e,null));};exports[_0xd6b1('0x5e')]=function(_0xd34f08,_0x24b6bf,_0x35f04b){if(_0xd34f08[_0xd6b1('0x56')]['id']){delete _0xd34f08['body']['id'];}return db[_0xd6b1('0x3a')]['findOne']({'where':{'id':_0xd34f08[_0xd6b1('0x52')]['id']}})[_0xd6b1('0x1e')](handleEntityNotFound(_0x24b6bf,null))[_0xd6b1('0x1e')](function(_0x4b77de){if(_0x4b77de){return _0x4b77de['setTags'](_0xd34f08[_0xd6b1('0x56')]['ids']||[]);}return null;})[_0xd6b1('0x1e')](respondWithResult(_0x24b6bf,null))[_0xd6b1('0x29')](handleError(_0x24b6bf,null));}; \ No newline at end of file +var _0xc746=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','json','count','offset','limit','apply','update','then','end','stack','name','send','FreshdeskConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc746,0xc9));var _0x6c74=function(_0x4edbe6,_0x9234aa){_0x4edbe6=_0x4edbe6-0x0;var _0x32edbb=_0xc746[_0x4edbe6];return _0x32edbb;};'use strict';var pdf=require(_0x6c74('0x0'));var emlformat=require(_0x6c74('0x1'));var rimraf=require(_0x6c74('0x2'));var zipdir=require(_0x6c74('0x3'));var jsonpatch=require(_0x6c74('0x4'));var rp=require(_0x6c74('0x5'));var moment=require(_0x6c74('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6c74('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6c74('0x8'));var ejs=require(_0x6c74('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6c74('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6c74('0x8'));var querystring=require(_0x6c74('0xb'));var Papa=require(_0x6c74('0xc'));var Redis=require(_0x6c74('0xd'));var authService=require(_0x6c74('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6c74('0xf'));var hardwareService=require(_0x6c74('0x10'));var logger=require(_0x6c74('0x11'))('api');var utils=require(_0x6c74('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x6c74('0x13')]['http']({'port':0x232a});function checkPasswordPattern(_0x4a534d,_0x2e93a5,_0x34adfb){if(_0x34adfb){var _0x23bd7e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x23bd7e[_0x6c74('0x14')](_0x2e93a5)){return _0x4a534d;}else{throw new db['Sequelize'][(_0x6c74('0x15'))](_0x6c74('0x16'));}}else{return _0x4a534d;}}function respondWithRpcPromise(_0x663634,_0x3f7b2a,_0x19bb25,_0x1d2ae1){return new BPromise(function(_0x55ec61,_0x3820a0){var _0x5b91c8=_0x1d2ae1||client;return _0x5b91c8[_0x6c74('0x17')](_0x663634,_0x19bb25)['then'](function(_0x2cc3be){logger[_0x6c74('0x18')](_0x6c74('0x19'),_0x3f7b2a,_0x6c74('0x1a'));logger[_0x6c74('0x1b')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3f7b2a,_0x6c74('0x1a'),JSON[_0x6c74('0x1c')](_0x2cc3be));if(_0x2cc3be['error']){if(_0x2cc3be[_0x6c74('0x1d')][_0x6c74('0x1e')]===0x1f4){logger[_0x6c74('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3f7b2a,_0x2cc3be[_0x6c74('0x1d')][_0x6c74('0x1f')]);return _0x3820a0(_0x2cc3be[_0x6c74('0x1d')][_0x6c74('0x1f')]);}logger[_0x6c74('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3f7b2a,_0x2cc3be[_0x6c74('0x1d')][_0x6c74('0x1f')]);return _0x55ec61(_0x2cc3be[_0x6c74('0x1d')][_0x6c74('0x1f')]);}else{logger[_0x6c74('0x18')](_0x6c74('0x19'),_0x3f7b2a,_0x6c74('0x1a'));_0x55ec61(_0x2cc3be[_0x6c74('0x20')]['message']);}})['catch'](function(_0x3dc841){logger[_0x6c74('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3f7b2a,_0x3dc841);_0x3820a0(_0x3dc841);});});}function respondWithStatusCode(_0x56c7d3,_0x1d1cea){_0x1d1cea=_0x1d1cea||0xcc;return function(_0x377282){if(_0x377282){return _0x56c7d3[_0x6c74('0x21')](_0x1d1cea);}return _0x56c7d3[_0x6c74('0x22')](_0x1d1cea)['end']();};}function respondWithResult(_0x5f53c9,_0x1731b3){_0x1731b3=_0x1731b3||0xc8;return function(_0x92e6df){if(_0x92e6df){return _0x5f53c9[_0x6c74('0x22')](_0x1731b3)[_0x6c74('0x23')](_0x92e6df);}};}function respondWithFilteredResult(_0x426d4f,_0x42c451){return function(_0x21f019){if(_0x21f019){var _0x2b422c=_0x21f019[_0x6c74('0x24')],_0x106bd4=_0x42c451[_0x6c74('0x25')],_0x37112f=_0x42c451[_0x6c74('0x25')]+_0x42c451[_0x6c74('0x26')],_0x1a67e3;if(_0x37112f>=_0x2b422c){_0x37112f=_0x2b422c;_0x1a67e3=0xc8;}else{_0x1a67e3=0xce;}_0x426d4f['status'](_0x1a67e3);return _0x426d4f['set']('Content-Range',_0x106bd4+'-'+_0x37112f+'/'+_0x2b422c)[_0x6c74('0x23')](_0x21f019);}return null;};}function patchUpdates(_0x41e5f5){return function(_0x5120b5){try{jsonpatch[_0x6c74('0x27')](_0x5120b5,_0x41e5f5,!![]);}catch(_0x2a9257){return BPromise['reject'](_0x2a9257);}return _0x5120b5['save']();};}function saveUpdates(_0x1d326c,_0xf36af3){return function(_0x4a148d){if(_0x4a148d){return _0x4a148d[_0x6c74('0x28')](_0x1d326c)['then'](function(_0x5d1970){return _0x5d1970;});}return null;};}function removeEntity(_0x51620a,_0x8cf5ac){return function(_0x404e9f){if(_0x404e9f){return _0x404e9f['destroy']()[_0x6c74('0x29')](function(){_0x51620a[_0x6c74('0x22')](0xcc)[_0x6c74('0x2a')]();});}};}function handleEntityNotFound(_0x24414a,_0x1d8428){return function(_0x9a338d){if(!_0x9a338d){_0x24414a[_0x6c74('0x21')](0x194);}return _0x9a338d;};}function handleError(_0x3a9acc,_0x10803b){_0x10803b=_0x10803b||0x1f4;return function(_0x1e4dce){logger[_0x6c74('0x1d')](_0x1e4dce[_0x6c74('0x2b')]);if(_0x1e4dce[_0x6c74('0x2c')]){delete _0x1e4dce[_0x6c74('0x2c')];}_0x3a9acc[_0x6c74('0x22')](_0x10803b)[_0x6c74('0x2d')](_0x1e4dce);};}exports['index']=function(_0x32bafa,_0x1a9bb9){var _0x34c3dc={},_0x1ec89c={},_0x295641={'count':0x0,'rows':[]};var _0x30c2b1=_['map'](db[_0x6c74('0x2e')][_0x6c74('0x2f')],function(_0x1a2ab2){return{'name':_0x1a2ab2['fieldName'],'type':_0x1a2ab2[_0x6c74('0x30')][_0x6c74('0x31')]};});_0x1ec89c[_0x6c74('0x32')]=_[_0x6c74('0x33')](_0x30c2b1,_0x6c74('0x2c'));_0x1ec89c[_0x6c74('0x34')]=_[_0x6c74('0x35')](_0x32bafa[_0x6c74('0x34')]);_0x1ec89c[_0x6c74('0x36')]=_[_0x6c74('0x37')](_0x1ec89c[_0x6c74('0x32')],_0x1ec89c['query']);_0x34c3dc[_0x6c74('0x38')]=_['intersection'](_0x1ec89c['model'],qs[_0x6c74('0x39')](_0x32bafa[_0x6c74('0x34')][_0x6c74('0x39')]));_0x34c3dc[_0x6c74('0x38')]=_0x34c3dc[_0x6c74('0x38')][_0x6c74('0x3a')]?_0x34c3dc[_0x6c74('0x38')]:_0x1ec89c[_0x6c74('0x32')];if(!_0x32bafa[_0x6c74('0x34')][_0x6c74('0x3b')](_0x6c74('0x3c'))){_0x34c3dc['limit']=qs['limit'](_0x32bafa[_0x6c74('0x34')][_0x6c74('0x26')]);_0x34c3dc[_0x6c74('0x25')]=qs[_0x6c74('0x25')](_0x32bafa[_0x6c74('0x34')][_0x6c74('0x25')]);}_0x34c3dc[_0x6c74('0x3d')]=qs[_0x6c74('0x3e')](_0x32bafa['query'][_0x6c74('0x3e')]);_0x34c3dc[_0x6c74('0x3f')]=qs[_0x6c74('0x36')](_[_0x6c74('0x40')](_0x32bafa[_0x6c74('0x34')],_0x1ec89c['filters']),_0x30c2b1);if(_0x32bafa[_0x6c74('0x34')][_0x6c74('0x41')]){_0x34c3dc[_0x6c74('0x3f')]=_[_0x6c74('0x42')](_0x34c3dc[_0x6c74('0x3f')],{'$or':_[_0x6c74('0x33')](_0x30c2b1,function(_0x404c4e){if(_0x404c4e[_0x6c74('0x30')]!==_0x6c74('0x43')){var _0x208eb3={};_0x208eb3[_0x404c4e[_0x6c74('0x2c')]]={'$like':'%'+_0x32bafa[_0x6c74('0x34')][_0x6c74('0x41')]+'%'};return _0x208eb3;}})});}_0x34c3dc=_[_0x6c74('0x42')]({},_0x34c3dc,_0x32bafa['options']);var _0x2ab3fc={'where':_0x34c3dc['where']};return db[_0x6c74('0x2e')][_0x6c74('0x24')](_0x2ab3fc)['then'](function(_0x5755eb){_0x295641[_0x6c74('0x24')]=_0x5755eb;if(_0x32bafa['query'][_0x6c74('0x44')]){_0x34c3dc[_0x6c74('0x45')]=[{'all':!![]}];}return db[_0x6c74('0x2e')][_0x6c74('0x46')](_0x34c3dc);})['then'](function(_0x5bd50a){_0x295641['rows']=_0x5bd50a;return _0x295641;})[_0x6c74('0x29')](respondWithFilteredResult(_0x1a9bb9,_0x34c3dc))[_0x6c74('0x47')](handleError(_0x1a9bb9,null));};exports[_0x6c74('0x48')]=function(_0x8569d3,_0x5d46f4){var _0x204d7d={'raw':![],'where':{'id':_0x8569d3[_0x6c74('0x49')]['id']}},_0x207148={};_0x207148['model']=_[_0x6c74('0x35')](db[_0x6c74('0x2e')][_0x6c74('0x2f')]);_0x207148[_0x6c74('0x34')]=_['keys'](_0x8569d3[_0x6c74('0x34')]);_0x207148[_0x6c74('0x36')]=_[_0x6c74('0x37')](_0x207148['model'],_0x207148[_0x6c74('0x34')]);_0x204d7d[_0x6c74('0x38')]=_['intersection'](_0x207148['model'],qs[_0x6c74('0x39')](_0x8569d3[_0x6c74('0x34')]['fields']));_0x204d7d[_0x6c74('0x38')]=_0x204d7d[_0x6c74('0x38')]['length']?_0x204d7d['attributes']:_0x207148[_0x6c74('0x32')];if(_0x8569d3['query'][_0x6c74('0x44')]){_0x204d7d[_0x6c74('0x45')]=[{'all':!![]}];}_0x204d7d=_[_0x6c74('0x42')]({},_0x204d7d,_0x8569d3[_0x6c74('0x4a')]);return db[_0x6c74('0x2e')][_0x6c74('0x4b')](_0x204d7d)[_0x6c74('0x29')](handleEntityNotFound(_0x5d46f4,null))[_0x6c74('0x29')](respondWithResult(_0x5d46f4,null))[_0x6c74('0x47')](handleError(_0x5d46f4,null));};exports['create']=function(_0x214330,_0x487588){return db[_0x6c74('0x2e')][_0x6c74('0x4c')](_0x214330['body'],{})[_0x6c74('0x29')](respondWithResult(_0x487588,0xc9))[_0x6c74('0x47')](handleError(_0x487588,null));};exports[_0x6c74('0x28')]=function(_0x36fa53,_0x41f1ec){if(_0x36fa53[_0x6c74('0x4d')]['id']){delete _0x36fa53[_0x6c74('0x4d')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x36fa53[_0x6c74('0x49')]['id']}})[_0x6c74('0x29')](handleEntityNotFound(_0x41f1ec,null))[_0x6c74('0x29')](saveUpdates(_0x36fa53[_0x6c74('0x4d')],null))[_0x6c74('0x29')](respondWithResult(_0x41f1ec,null))['catch'](handleError(_0x41f1ec,null));};exports[_0x6c74('0x4e')]=function(_0x25b4c1,_0x57d71f){return db[_0x6c74('0x2e')]['find']({'where':{'id':_0x25b4c1[_0x6c74('0x49')]['id']}})[_0x6c74('0x29')](handleEntityNotFound(_0x57d71f,null))[_0x6c74('0x29')](removeEntity(_0x57d71f,null))[_0x6c74('0x47')](handleError(_0x57d71f,null));};exports[_0x6c74('0x4f')]=function(_0x3cfcdd,_0x461573,_0x443993){var _0xbb4994={};var _0x5ae319={};var _0x4c0e73;var _0x12a3aa;return db[_0x6c74('0x2e')][_0x6c74('0x50')]({'where':{'id':_0x3cfcdd[_0x6c74('0x49')]['id']}})[_0x6c74('0x29')](handleEntityNotFound(_0x461573,null))[_0x6c74('0x29')](function(_0x70aeca){if(_0x70aeca){_0x4c0e73=_0x70aeca;_0x5ae319[_0x6c74('0x32')]=_[_0x6c74('0x35')](db[_0x6c74('0x51')][_0x6c74('0x2f')]);_0x5ae319[_0x6c74('0x34')]=_[_0x6c74('0x35')](_0x3cfcdd[_0x6c74('0x34')]);_0x5ae319[_0x6c74('0x36')]=_[_0x6c74('0x37')](_0x5ae319[_0x6c74('0x32')],_0x5ae319[_0x6c74('0x34')]);_0xbb4994[_0x6c74('0x38')]=_[_0x6c74('0x37')](_0x5ae319['model'],qs['fields'](_0x3cfcdd[_0x6c74('0x34')][_0x6c74('0x39')]));_0xbb4994['attributes']=_0xbb4994[_0x6c74('0x38')]['length']?_0xbb4994[_0x6c74('0x38')]:_0x5ae319[_0x6c74('0x32')];_0xbb4994[_0x6c74('0x3d')]=qs[_0x6c74('0x3e')](_0x3cfcdd[_0x6c74('0x34')]['sort']);_0xbb4994['where']=qs[_0x6c74('0x36')](_[_0x6c74('0x40')](_0x3cfcdd['query'],_0x5ae319[_0x6c74('0x36')]));if(_0x3cfcdd[_0x6c74('0x34')][_0x6c74('0x41')]){_0xbb4994[_0x6c74('0x3f')]=_[_0x6c74('0x42')](_0xbb4994['where'],{'$or':_[_0x6c74('0x33')](_0xbb4994[_0x6c74('0x38')],function(_0x1d3dd8){var _0x59c3f1={};_0x59c3f1[_0x1d3dd8]={'$like':'%'+_0x3cfcdd[_0x6c74('0x34')][_0x6c74('0x41')]+'%'};return _0x59c3f1;})});}_0xbb4994=_[_0x6c74('0x42')]({},_0xbb4994,_0x3cfcdd['options']);return _0x4c0e73[_0x6c74('0x4f')](_0xbb4994);}})['then'](function(_0x39b1fb){if(_0x39b1fb){_0x12a3aa=_0x39b1fb['length'];if(!_0x3cfcdd[_0x6c74('0x34')][_0x6c74('0x3b')](_0x6c74('0x3c'))){_0xbb4994['limit']=qs['limit'](_0x3cfcdd['query'][_0x6c74('0x26')]);_0xbb4994[_0x6c74('0x25')]=qs[_0x6c74('0x25')](_0x3cfcdd['query'][_0x6c74('0x25')]);}return _0x4c0e73[_0x6c74('0x4f')](_0xbb4994);}})['then'](function(_0x22caa3){if(_0x22caa3){return _0x22caa3?{'count':_0x12a3aa,'rows':_0x22caa3}:null;}})[_0x6c74('0x29')](respondWithResult(_0x461573,null))['catch'](handleError(_0x461573,null));};exports['getSubjects']=function(_0xd5cd1,_0x34d843,_0x3ed124){var _0x65ab0f={};var _0x36d9ae={};var _0x1a8cd6;var _0x3779c;return db[_0x6c74('0x2e')][_0x6c74('0x50')]({'where':{'id':_0xd5cd1[_0x6c74('0x49')]['id']}})[_0x6c74('0x29')](handleEntityNotFound(_0x34d843,null))['then'](function(_0x3ae0b9){if(_0x3ae0b9){_0x1a8cd6=_0x3ae0b9;_0x36d9ae[_0x6c74('0x32')]=_['keys'](db[_0x6c74('0x51')][_0x6c74('0x2f')]);_0x36d9ae[_0x6c74('0x34')]=_[_0x6c74('0x35')](_0xd5cd1['query']);_0x36d9ae[_0x6c74('0x36')]=_[_0x6c74('0x37')](_0x36d9ae[_0x6c74('0x32')],_0x36d9ae[_0x6c74('0x34')]);_0x65ab0f['attributes']=_[_0x6c74('0x37')](_0x36d9ae[_0x6c74('0x32')],qs[_0x6c74('0x39')](_0xd5cd1[_0x6c74('0x34')][_0x6c74('0x39')]));_0x65ab0f[_0x6c74('0x38')]=_0x65ab0f[_0x6c74('0x38')]['length']?_0x65ab0f['attributes']:_0x36d9ae[_0x6c74('0x32')];_0x65ab0f['order']=qs['sort'](_0xd5cd1[_0x6c74('0x34')][_0x6c74('0x3e')]);_0x65ab0f[_0x6c74('0x3f')]=qs[_0x6c74('0x36')](_[_0x6c74('0x40')](_0xd5cd1[_0x6c74('0x34')],_0x36d9ae[_0x6c74('0x36')]));if(_0xd5cd1['query'][_0x6c74('0x41')]){_0x65ab0f[_0x6c74('0x3f')]=_[_0x6c74('0x42')](_0x65ab0f[_0x6c74('0x3f')],{'$or':_['map'](_0x65ab0f[_0x6c74('0x38')],function(_0x2e2a36){var _0x4d4341={};_0x4d4341[_0x2e2a36]={'$like':'%'+_0xd5cd1['query'][_0x6c74('0x41')]+'%'};return _0x4d4341;})});}_0x65ab0f=_[_0x6c74('0x42')]({},_0x65ab0f,_0xd5cd1[_0x6c74('0x4a')]);return _0x1a8cd6[_0x6c74('0x52')](_0x65ab0f);}})[_0x6c74('0x29')](function(_0x6ef144){if(_0x6ef144){_0x3779c=_0x6ef144[_0x6c74('0x3a')];if(!_0xd5cd1[_0x6c74('0x34')][_0x6c74('0x3b')](_0x6c74('0x3c'))){_0x65ab0f['limit']=qs[_0x6c74('0x26')](_0xd5cd1[_0x6c74('0x34')]['limit']);_0x65ab0f['offset']=qs['offset'](_0xd5cd1['query'][_0x6c74('0x25')]);}return _0x1a8cd6['getSubjects'](_0x65ab0f);}})[_0x6c74('0x29')](function(_0x5ccd0c){if(_0x5ccd0c){return _0x5ccd0c?{'count':_0x3779c,'rows':_0x5ccd0c}:null;}})[_0x6c74('0x29')](respondWithResult(_0x34d843,null))[_0x6c74('0x47')](handleError(_0x34d843,null));};exports['getDescriptions']=function(_0x275573,_0x36ac06,_0x520160){var _0x46c5e8={};var _0x137af5={};var _0x3a30f5;var _0x5d9ce5;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x275573[_0x6c74('0x49')]['id']}})['then'](handleEntityNotFound(_0x36ac06,null))[_0x6c74('0x29')](function(_0x38730c){if(_0x38730c){_0x3a30f5=_0x38730c;_0x137af5[_0x6c74('0x32')]=_['keys'](db[_0x6c74('0x51')][_0x6c74('0x2f')]);_0x137af5[_0x6c74('0x34')]=_[_0x6c74('0x35')](_0x275573[_0x6c74('0x34')]);_0x137af5['filters']=_[_0x6c74('0x37')](_0x137af5['model'],_0x137af5['query']);_0x46c5e8[_0x6c74('0x38')]=_[_0x6c74('0x37')](_0x137af5[_0x6c74('0x32')],qs[_0x6c74('0x39')](_0x275573[_0x6c74('0x34')][_0x6c74('0x39')]));_0x46c5e8[_0x6c74('0x38')]=_0x46c5e8[_0x6c74('0x38')][_0x6c74('0x3a')]?_0x46c5e8['attributes']:_0x137af5[_0x6c74('0x32')];_0x46c5e8[_0x6c74('0x3d')]=qs[_0x6c74('0x3e')](_0x275573[_0x6c74('0x34')][_0x6c74('0x3e')]);_0x46c5e8['where']=qs[_0x6c74('0x36')](_['pick'](_0x275573[_0x6c74('0x34')],_0x137af5[_0x6c74('0x36')]));if(_0x275573[_0x6c74('0x34')][_0x6c74('0x41')]){_0x46c5e8[_0x6c74('0x3f')]=_[_0x6c74('0x42')](_0x46c5e8[_0x6c74('0x3f')],{'$or':_[_0x6c74('0x33')](_0x46c5e8[_0x6c74('0x38')],function(_0x30be70){var _0x12330b={};_0x12330b[_0x30be70]={'$like':'%'+_0x275573[_0x6c74('0x34')][_0x6c74('0x41')]+'%'};return _0x12330b;})});}_0x46c5e8=_[_0x6c74('0x42')]({},_0x46c5e8,_0x275573['options']);return _0x3a30f5[_0x6c74('0x53')](_0x46c5e8);}})[_0x6c74('0x29')](function(_0x9ea77c){if(_0x9ea77c){_0x5d9ce5=_0x9ea77c[_0x6c74('0x3a')];if(!_0x275573[_0x6c74('0x34')][_0x6c74('0x3b')](_0x6c74('0x3c'))){_0x46c5e8[_0x6c74('0x26')]=qs[_0x6c74('0x26')](_0x275573['query'][_0x6c74('0x26')]);_0x46c5e8[_0x6c74('0x25')]=qs[_0x6c74('0x25')](_0x275573[_0x6c74('0x34')]['offset']);}return _0x3a30f5[_0x6c74('0x53')](_0x46c5e8);}})[_0x6c74('0x29')](function(_0x1e19f9){if(_0x1e19f9){return _0x1e19f9?{'count':_0x5d9ce5,'rows':_0x1e19f9}:null;}})[_0x6c74('0x29')](respondWithResult(_0x36ac06,null))[_0x6c74('0x47')](handleError(_0x36ac06,null));};exports['getTags']=function(_0x469671,_0x394b5e,_0x27590d){var _0x1e3f75={};var _0x36247f={};var _0x223d26;var _0x8cfcc1;return db[_0x6c74('0x2e')][_0x6c74('0x50')]({'where':{'id':_0x469671['params']['id']}})[_0x6c74('0x29')](handleEntityNotFound(_0x394b5e,null))['then'](function(_0x1803ba){if(_0x1803ba){_0x223d26=_0x1803ba;_0x36247f['model']=_['keys'](db['Tag']['rawAttributes']);_0x36247f['query']=_[_0x6c74('0x35')](_0x469671[_0x6c74('0x34')]);_0x36247f['filters']=_[_0x6c74('0x37')](_0x36247f[_0x6c74('0x32')],_0x36247f[_0x6c74('0x34')]);_0x1e3f75['attributes']=_[_0x6c74('0x37')](_0x36247f[_0x6c74('0x32')],qs[_0x6c74('0x39')](_0x469671[_0x6c74('0x34')][_0x6c74('0x39')]));_0x1e3f75[_0x6c74('0x38')]=_0x1e3f75[_0x6c74('0x38')][_0x6c74('0x3a')]?_0x1e3f75[_0x6c74('0x38')]:_0x36247f['model'];_0x1e3f75[_0x6c74('0x3d')]=qs[_0x6c74('0x3e')](_0x469671[_0x6c74('0x34')][_0x6c74('0x3e')]);_0x1e3f75[_0x6c74('0x3f')]=qs['filters'](_[_0x6c74('0x40')](_0x469671[_0x6c74('0x34')],_0x36247f['filters']));if(_0x469671[_0x6c74('0x34')][_0x6c74('0x41')]){_0x1e3f75[_0x6c74('0x3f')]=_[_0x6c74('0x42')](_0x1e3f75[_0x6c74('0x3f')],{'$or':_[_0x6c74('0x33')](_0x1e3f75[_0x6c74('0x38')],function(_0xd409a8){var _0x2dc0d6={};_0x2dc0d6[_0xd409a8]={'$like':'%'+_0x469671[_0x6c74('0x34')][_0x6c74('0x41')]+'%'};return _0x2dc0d6;})});}_0x1e3f75=_['merge']({},_0x1e3f75,_0x469671[_0x6c74('0x4a')]);return _0x223d26[_0x6c74('0x54')](_0x1e3f75);}})[_0x6c74('0x29')](function(_0xe326e7){if(_0xe326e7){_0x8cfcc1=_0xe326e7[_0x6c74('0x3a')];if(!_0x469671['query'][_0x6c74('0x3b')](_0x6c74('0x3c'))){_0x1e3f75['limit']=qs[_0x6c74('0x26')](_0x469671[_0x6c74('0x34')][_0x6c74('0x26')]);_0x1e3f75['offset']=qs['offset'](_0x469671['query'][_0x6c74('0x25')]);}return _0x223d26[_0x6c74('0x54')](_0x1e3f75);}})['then'](function(_0x489f40){if(_0x489f40){return _0x489f40?{'count':_0x8cfcc1,'rows':_0x489f40}:null;}})['then'](respondWithResult(_0x394b5e,null))['catch'](handleError(_0x394b5e,null));};exports['setTags']=function(_0x5b57c3,_0x4a7810,_0x14f71e){if(_0x5b57c3[_0x6c74('0x4d')]['id']){delete _0x5b57c3[_0x6c74('0x4d')]['id'];}return db[_0x6c74('0x2e')][_0x6c74('0x50')]({'where':{'id':_0x5b57c3['params']['id']}})[_0x6c74('0x29')](handleEntityNotFound(_0x4a7810,null))[_0x6c74('0x29')](function(_0x563189){if(_0x563189){return _0x563189[_0x6c74('0x55')](_0x5b57c3['body'][_0x6c74('0x56')]||[]);}return null;})[_0x6c74('0x29')](respondWithResult(_0x4a7810,null))[_0x6c74('0x47')](handleError(_0x4a7810,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 5a2edb9..d684f68 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 _0x9957=['exports','define','FreshdeskConfiguration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','FreshdeskConfiguration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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_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 c15301f..78a8669 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 _0x9204=['FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info'];(function(_0x535fb4,_0x4c60bb){var _0x3da227=function(_0x374fde){while(--_0x374fde){_0x535fb4['push'](_0x535fb4['shift']());}};_0x3da227(++_0x4c60bb);}(_0x9204,0x9e));var _0x4920=function(_0x1d9974,_0x3ededa){_0x1d9974=_0x1d9974-0x0;var _0x4cb52f=_0x9204[_0x1d9974];return _0x4cb52f;};'use strict';var _=require(_0x4920('0x0'));var util=require(_0x4920('0x1'));var moment=require(_0x4920('0x2'));var BPromise=require('bluebird');var rs=require(_0x4920('0x3'));var fs=require('fs');var Redis=require(_0x4920('0x4'));var db=require(_0x4920('0x5'))['db'];var utils=require(_0x4920('0x6'));var logger=require(_0x4920('0x7'))(_0x4920('0x8'));var config=require(_0x4920('0x9'));var jayson=require(_0x4920('0xa'));var client=jayson['client'][_0x4920('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x133e22,_0x20b212,_0x4d90ad){return new BPromise(function(_0x21f3ce,_0x530bab){return client['request'](_0x133e22,_0x4d90ad)['then'](function(_0x511e13){logger[_0x4920('0xc')](_0x4920('0xd'),_0x20b212,_0x4920('0xe'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x20b212,_0x4920('0xe'),JSON[_0x4920('0xf')](_0x511e13));if(_0x511e13['error']){if(_0x511e13[_0x4920('0x10')]['code']===0x1f4){logger[_0x4920('0x10')](_0x4920('0xd'),_0x20b212,_0x511e13['error'][_0x4920('0x11')]);return _0x530bab(_0x511e13[_0x4920('0x10')][_0x4920('0x11')]);}logger['error'](_0x4920('0xd'),_0x20b212,_0x511e13[_0x4920('0x10')][_0x4920('0x11')]);return _0x21f3ce(_0x511e13['error'][_0x4920('0x11')]);}else{logger[_0x4920('0xc')](_0x4920('0xd'),_0x20b212,_0x4920('0xe'));_0x21f3ce(_0x511e13['result'][_0x4920('0x11')]);}})[_0x4920('0x12')](function(_0x163ee7){logger[_0x4920('0x10')](_0x4920('0xd'),_0x20b212,_0x163ee7);_0x530bab(_0x163ee7);});});} \ No newline at end of file +var _0xe1a3=['http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','../../config/utils','jayson/promise','client'];(function(_0x40fd2b,_0x365d8b){var _0x114adc=function(_0x34ed35){while(--_0x34ed35){_0x40fd2b['push'](_0x40fd2b['shift']());}};_0x114adc(++_0x365d8b);}(_0xe1a3,0x19b));var _0x3e1a=function(_0x5ab34a,_0x2547c4){_0x5ab34a=_0x5ab34a-0x0;var _0x4a3d81=_0xe1a3[_0x5ab34a];return _0x4a3d81;};'use strict';var _=require(_0x3e1a('0x0'));var util=require(_0x3e1a('0x1'));var moment=require('moment');var BPromise=require(_0x3e1a('0x2'));var rs=require(_0x3e1a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3e1a('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3e1a('0x5'));var client=jayson[_0x3e1a('0x6')][_0x3e1a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21b8a0,_0x1fa13b,_0x29513c){return new BPromise(function(_0x340af1,_0x211215){return client[_0x3e1a('0x8')](_0x21b8a0,_0x29513c)[_0x3e1a('0x9')](function(_0x3c5ca8){logger[_0x3e1a('0xa')](_0x3e1a('0xb'),_0x1fa13b,_0x3e1a('0xc'));logger[_0x3e1a('0xd')](_0x3e1a('0xe'),_0x1fa13b,_0x3e1a('0xc'),JSON['stringify'](_0x3c5ca8));if(_0x3c5ca8[_0x3e1a('0xf')]){if(_0x3c5ca8[_0x3e1a('0xf')][_0x3e1a('0x10')]===0x1f4){logger['error'](_0x3e1a('0xb'),_0x1fa13b,_0x3c5ca8[_0x3e1a('0xf')]['message']);return _0x211215(_0x3c5ca8[_0x3e1a('0xf')][_0x3e1a('0x11')]);}logger[_0x3e1a('0xf')](_0x3e1a('0xb'),_0x1fa13b,_0x3c5ca8[_0x3e1a('0xf')][_0x3e1a('0x11')]);return _0x340af1(_0x3c5ca8[_0x3e1a('0xf')][_0x3e1a('0x11')]);}else{logger[_0x3e1a('0xa')](_0x3e1a('0xb'),_0x1fa13b,_0x3e1a('0xc'));_0x340af1(_0x3c5ca8['result']['message']);}})[_0x3e1a('0x12')](function(_0x3ef48b){logger[_0x3e1a('0xf')](_0x3e1a('0xb'),_0x1fa13b,_0x3ef48b);_0x211215(_0x3ef48b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index d0c91b6..42ab4fc 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 _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x2d48fa,_0x103065){var _0x4645b7=function(_0x5c8751){while(--_0x5c8751){_0x2d48fa['push'](_0x2d48fa['shift']());}};_0x4645b7(++_0x103065);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'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('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file +var _0xcb91=['post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5ae8f7,_0x330d91){_0x5ae8f7=_0x5ae8f7-0x0;var _0x54c636=_0xcb91[_0x5ae8f7];return _0x54c636;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./intFreshdeskField.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['put']('/:id',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller['destroy']);module[_0x1cb9('0xe')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 687ba44..457b918 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 _0x297b=['string','variable','STRING','sequelize','ENUM'];(function(_0x272ac4,_0x399959){var _0x43167d=function(_0x52e1f5){while(--_0x52e1f5){_0x272ac4['push'](_0x272ac4['shift']());}};_0x43167d(++_0x399959);}(_0x297b,0x85));var _0xb297=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x297b[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0xb297('0x0'));module['exports']={'type':{'type':Sequelize[_0xb297('0x1')](_0xb297('0x2'),_0xb297('0x3'),'customVariable','keyValue'),'defaultValue':_0xb297('0x2')},'content':{'type':Sequelize[_0xb297('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb297('0x1')](_0xb297('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb297('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb297('0x4')]}}; \ No newline at end of file +var _0x668b=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x572989,_0x4f8cb4){var _0x4760e3=function(_0x5067ae){while(--_0x5067ae){_0x572989['push'](_0x572989['shift']());}};_0x4760e3(++_0x4f8cb4);}(_0x668b,0x8d));var _0xb668=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0x668b[_0x2d8434];return _0x26b9e4;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'type':{'type':Sequelize[_0xb668('0x2')](_0xb668('0x3'),_0xb668('0x4'),_0xb668('0x5'),_0xb668('0x6')),'defaultValue':_0xb668('0x3')},'content':{'type':Sequelize[_0xb668('0x7')]},'key':{'type':Sequelize[_0xb668('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xb668('0x3'),_0xb668('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xb668('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb668('0x7')]},'customField':{'type':Sequelize[_0xb668('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb668('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index d4cf268..e4b8d5b 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 _0x4d02=['model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','create','update','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','util','path','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','count','limit','set','json','apply','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','FreshdeskField','fieldName','type','key'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0x4d02,0x142));var _0x24d0=function(_0x48b99d,_0x5bacc5){_0x48b99d=_0x48b99d-0x0;var _0x162026=_0x4d02[_0x48b99d];return _0x162026;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x24d0('0x0'));var zipdir=require(_0x24d0('0x1'));var jsonpatch=require(_0x24d0('0x2'));var rp=require(_0x24d0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x24d0('0x4'));var path=require(_0x24d0('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x24d0('0x6'));var fs=require('fs');var _=require(_0x24d0('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x24d0('0x8'));var deskjs=require(_0x24d0('0x9'));var toCsv=require(_0x24d0('0xa'));var querystring=require(_0x24d0('0xb'));var Papa=require(_0x24d0('0xc'));var Redis=require(_0x24d0('0xd'));var authService=require(_0x24d0('0xe'));var qs=require(_0x24d0('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24d0('0x10'));var logger=require(_0x24d0('0x11'))(_0x24d0('0x12'));var utils=require(_0x24d0('0x13'));var config=require(_0x24d0('0x14'));var db=require(_0x24d0('0x15'))['db'];function respondWithStatusCode(_0x9815d7,_0x241da7){_0x241da7=_0x241da7||0xcc;return function(_0x29c554){if(_0x29c554){return _0x9815d7['sendStatus'](_0x241da7);}return _0x9815d7[_0x24d0('0x16')](_0x241da7)['end']();};}function respondWithResult(_0x21d2ae,_0x2b45f3){_0x2b45f3=_0x2b45f3||0xc8;return function(_0x3c89cf){if(_0x3c89cf){return _0x21d2ae[_0x24d0('0x16')](_0x2b45f3)['json'](_0x3c89cf);}};}function respondWithFilteredResult(_0x6d52cd,_0x1aa392){return function(_0xd88607){if(_0xd88607){var _0x6c902=_0xd88607[_0x24d0('0x17')],_0x59af22=_0x1aa392['offset'],_0x484d7a=_0x1aa392['offset']+_0x1aa392[_0x24d0('0x18')],_0x595e8b;if(_0x484d7a>=_0x6c902){_0x484d7a=_0x6c902;_0x595e8b=0xc8;}else{_0x595e8b=0xce;}_0x6d52cd[_0x24d0('0x16')](_0x595e8b);return _0x6d52cd[_0x24d0('0x19')]('Content-Range',_0x59af22+'-'+_0x484d7a+'/'+_0x6c902)[_0x24d0('0x1a')](_0xd88607);}return null;};}function patchUpdates(_0x38a44b){return function(_0x37a90a){try{jsonpatch[_0x24d0('0x1b')](_0x37a90a,_0x38a44b,!![]);}catch(_0x445da5){return BPromise['reject'](_0x445da5);}return _0x37a90a[_0x24d0('0x1c')]();};}function saveUpdates(_0x24b985,_0x48e1ef){return function(_0x268038){if(_0x268038){return _0x268038['update'](_0x24b985)[_0x24d0('0x1d')](function(_0x4d1a06){return _0x4d1a06;});}return null;};}function removeEntity(_0x55ce03,_0x3a3f66){return function(_0x528785){if(_0x528785){return _0x528785[_0x24d0('0x1e')]()[_0x24d0('0x1d')](function(){_0x55ce03['status'](0xcc)[_0x24d0('0x1f')]();});}};}function handleEntityNotFound(_0x2a40ea,_0x33879d){return function(_0x581f44){if(!_0x581f44){_0x2a40ea[_0x24d0('0x20')](0x194);}return _0x581f44;};}function handleError(_0xa20fd5,_0x15b628){_0x15b628=_0x15b628||0x1f4;return function(_0x297f5a){logger[_0x24d0('0x21')](_0x297f5a[_0x24d0('0x22')]);if(_0x297f5a[_0x24d0('0x23')]){delete _0x297f5a[_0x24d0('0x23')];}_0xa20fd5[_0x24d0('0x16')](_0x15b628)[_0x24d0('0x24')](_0x297f5a);};}exports[_0x24d0('0x25')]=function(_0x5dec7b,_0x3c40ba){var _0x5edbc0={},_0x2d2499={},_0x5e4cae={'count':0x0,'rows':[]};var _0xc12fbc=_[_0x24d0('0x26')](db[_0x24d0('0x27')]['rawAttributes'],function(_0x558fa9){return{'name':_0x558fa9[_0x24d0('0x28')],'type':_0x558fa9[_0x24d0('0x29')][_0x24d0('0x2a')]};});_0x2d2499[_0x24d0('0x2b')]=_[_0x24d0('0x26')](_0xc12fbc,_0x24d0('0x23'));_0x2d2499['query']=_[_0x24d0('0x2c')](_0x5dec7b[_0x24d0('0x2d')]);_0x2d2499[_0x24d0('0x2e')]=_[_0x24d0('0x2f')](_0x2d2499[_0x24d0('0x2b')],_0x2d2499[_0x24d0('0x2d')]);_0x5edbc0[_0x24d0('0x30')]=_['intersection'](_0x2d2499[_0x24d0('0x2b')],qs[_0x24d0('0x31')](_0x5dec7b[_0x24d0('0x2d')][_0x24d0('0x31')]));_0x5edbc0[_0x24d0('0x30')]=_0x5edbc0[_0x24d0('0x30')][_0x24d0('0x32')]?_0x5edbc0['attributes']:_0x2d2499['model'];if(!_0x5dec7b[_0x24d0('0x2d')][_0x24d0('0x33')](_0x24d0('0x34'))){_0x5edbc0[_0x24d0('0x18')]=qs['limit'](_0x5dec7b[_0x24d0('0x2d')][_0x24d0('0x18')]);_0x5edbc0[_0x24d0('0x35')]=qs['offset'](_0x5dec7b[_0x24d0('0x2d')][_0x24d0('0x35')]);}_0x5edbc0[_0x24d0('0x36')]=qs[_0x24d0('0x37')](_0x5dec7b[_0x24d0('0x2d')][_0x24d0('0x37')]);_0x5edbc0['where']=qs[_0x24d0('0x2e')](_[_0x24d0('0x38')](_0x5dec7b['query'],_0x2d2499[_0x24d0('0x2e')]),_0xc12fbc);if(_0x5dec7b['query'][_0x24d0('0x39')]){_0x5edbc0[_0x24d0('0x3a')]=_[_0x24d0('0x3b')](_0x5edbc0[_0x24d0('0x3a')],{'$or':_[_0x24d0('0x26')](_0xc12fbc,function(_0x112802){if(_0x112802[_0x24d0('0x29')]!==_0x24d0('0x3c')){var _0x4859c3={};_0x4859c3[_0x112802['name']]={'$like':'%'+_0x5dec7b[_0x24d0('0x2d')]['filter']+'%'};return _0x4859c3;}})});}_0x5edbc0=_[_0x24d0('0x3b')]({},_0x5edbc0,_0x5dec7b[_0x24d0('0x3d')]);var _0x143a5f={'where':_0x5edbc0[_0x24d0('0x3a')]};return db[_0x24d0('0x27')][_0x24d0('0x17')](_0x143a5f)[_0x24d0('0x1d')](function(_0x44cebe){_0x5e4cae[_0x24d0('0x17')]=_0x44cebe;if(_0x5dec7b['query'][_0x24d0('0x3e')]){_0x5edbc0[_0x24d0('0x3f')]=[{'all':!![]}];}return db[_0x24d0('0x27')]['findAll'](_0x5edbc0);})[_0x24d0('0x1d')](function(_0x586c3f){_0x5e4cae[_0x24d0('0x40')]=_0x586c3f;return _0x5e4cae;})['then'](respondWithFilteredResult(_0x3c40ba,_0x5edbc0))[_0x24d0('0x41')](handleError(_0x3c40ba,null));};exports[_0x24d0('0x42')]=function(_0x274439,_0x204ec7){var _0x467e87={'raw':!![],'where':{'id':_0x274439['params']['id']}},_0x1d0ab5={};_0x1d0ab5[_0x24d0('0x2b')]=_[_0x24d0('0x2c')](db[_0x24d0('0x27')][_0x24d0('0x43')]);_0x1d0ab5['query']=_['keys'](_0x274439[_0x24d0('0x2d')]);_0x1d0ab5['filters']=_[_0x24d0('0x2f')](_0x1d0ab5[_0x24d0('0x2b')],_0x1d0ab5[_0x24d0('0x2d')]);_0x467e87['attributes']=_[_0x24d0('0x2f')](_0x1d0ab5['model'],qs[_0x24d0('0x31')](_0x274439[_0x24d0('0x2d')]['fields']));_0x467e87[_0x24d0('0x30')]=_0x467e87[_0x24d0('0x30')][_0x24d0('0x32')]?_0x467e87['attributes']:_0x1d0ab5[_0x24d0('0x2b')];if(_0x274439[_0x24d0('0x2d')][_0x24d0('0x3e')]){_0x467e87['include']=[{'all':!![]}];}_0x467e87=_[_0x24d0('0x3b')]({},_0x467e87,_0x274439[_0x24d0('0x3d')]);return db[_0x24d0('0x27')]['find'](_0x467e87)[_0x24d0('0x1d')](handleEntityNotFound(_0x204ec7,null))[_0x24d0('0x1d')](respondWithResult(_0x204ec7,null))[_0x24d0('0x41')](handleError(_0x204ec7,null));};exports[_0x24d0('0x44')]=function(_0x5a8f44,_0xd35985){return db[_0x24d0('0x27')][_0x24d0('0x44')](_0x5a8f44['body'],{})['then'](respondWithResult(_0xd35985,0xc9))['catch'](handleError(_0xd35985,null));};exports[_0x24d0('0x45')]=function(_0x3655d5,_0x5d9070){if(_0x3655d5[_0x24d0('0x46')]['id']){delete _0x3655d5[_0x24d0('0x46')]['id'];}return db['FreshdeskField'][_0x24d0('0x47')]({'where':{'id':_0x3655d5[_0x24d0('0x48')]['id']}})[_0x24d0('0x1d')](handleEntityNotFound(_0x5d9070,null))[_0x24d0('0x1d')](saveUpdates(_0x3655d5['body'],null))[_0x24d0('0x1d')](respondWithResult(_0x5d9070,null))[_0x24d0('0x41')](handleError(_0x5d9070,null));};exports[_0x24d0('0x1e')]=function(_0xcfb675,_0x3522a0){return db[_0x24d0('0x27')]['find']({'where':{'id':_0xcfb675[_0x24d0('0x48')]['id']}})[_0x24d0('0x1d')](handleEntityNotFound(_0x3522a0,null))[_0x24d0('0x1d')](removeEntity(_0x3522a0,null))[_0x24d0('0x41')](handleError(_0x3522a0,null));}; \ No newline at end of file +var _0x9946=['type','key','model','map','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','update','then','destroy','stack','name','send','index','FreshdeskField','rawAttributes','fieldName'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9946,0xb0));var _0x6994=function(_0x456322,_0x16285b){_0x456322=_0x456322-0x0;var _0x3a0313=_0x9946[_0x456322];return _0x3a0313;};'use strict';var pdf=require(_0x6994('0x0'));var emlformat=require(_0x6994('0x1'));var rimraf=require(_0x6994('0x2'));var zipdir=require(_0x6994('0x3'));var jsonpatch=require(_0x6994('0x4'));var rp=require(_0x6994('0x5'));var moment=require(_0x6994('0x6'));var BPromise=require(_0x6994('0x7'));var Mustache=require(_0x6994('0x8'));var util=require(_0x6994('0x9'));var path=require(_0x6994('0xa'));var sox=require('sox');var csv=require(_0x6994('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6994('0xc'));var squel=require('squel');var crypto=require(_0x6994('0xd'));var jsforce=require(_0x6994('0xe'));var deskjs=require(_0x6994('0xf'));var toCsv=require(_0x6994('0xb'));var querystring=require(_0x6994('0x10'));var Papa=require('papaparse');var Redis=require(_0x6994('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6994('0x12'));var as=require(_0x6994('0x13'));var hardwareService=require(_0x6994('0x14'));var logger=require(_0x6994('0x15'))(_0x6994('0x16'));var utils=require(_0x6994('0x17'));var config=require('../../config/environment');var db=require(_0x6994('0x18'))['db'];function respondWithStatusCode(_0x5a1650,_0x54cc22){_0x54cc22=_0x54cc22||0xcc;return function(_0x2d03d2){if(_0x2d03d2){return _0x5a1650[_0x6994('0x19')](_0x54cc22);}return _0x5a1650['status'](_0x54cc22)[_0x6994('0x1a')]();};}function respondWithResult(_0x41a2be,_0x790d6f){_0x790d6f=_0x790d6f||0xc8;return function(_0x40859f){if(_0x40859f){return _0x41a2be['status'](_0x790d6f)[_0x6994('0x1b')](_0x40859f);}};}function respondWithFilteredResult(_0x101a13,_0x337c4e){return function(_0x1c5138){if(_0x1c5138){var _0x370c0e=_0x1c5138[_0x6994('0x1c')],_0x2b9bb7=_0x337c4e['offset'],_0x316c58=_0x337c4e[_0x6994('0x1d')]+_0x337c4e[_0x6994('0x1e')],_0x4183b1;if(_0x316c58>=_0x370c0e){_0x316c58=_0x370c0e;_0x4183b1=0xc8;}else{_0x4183b1=0xce;}_0x101a13[_0x6994('0x1f')](_0x4183b1);return _0x101a13[_0x6994('0x20')]('Content-Range',_0x2b9bb7+'-'+_0x316c58+'/'+_0x370c0e)[_0x6994('0x1b')](_0x1c5138);}return null;};}function patchUpdates(_0x38b3f7){return function(_0x336464){try{jsonpatch[_0x6994('0x21')](_0x336464,_0x38b3f7,!![]);}catch(_0x218d91){return BPromise[_0x6994('0x22')](_0x218d91);}return _0x336464[_0x6994('0x23')]();};}function saveUpdates(_0x580757,_0x5c454c){return function(_0x68255e){if(_0x68255e){return _0x68255e[_0x6994('0x24')](_0x580757)[_0x6994('0x25')](function(_0x31705f){return _0x31705f;});}return null;};}function removeEntity(_0x20c943,_0xf6c422){return function(_0x5f24dd){if(_0x5f24dd){return _0x5f24dd[_0x6994('0x26')]()[_0x6994('0x25')](function(){_0x20c943[_0x6994('0x1f')](0xcc)[_0x6994('0x1a')]();});}};}function handleEntityNotFound(_0x3099d2,_0x5620bb){return function(_0x2dfacd){if(!_0x2dfacd){_0x3099d2[_0x6994('0x19')](0x194);}return _0x2dfacd;};}function handleError(_0x34aa0d,_0x209a6e){_0x209a6e=_0x209a6e||0x1f4;return function(_0x43da83){logger['error'](_0x43da83[_0x6994('0x27')]);if(_0x43da83[_0x6994('0x28')]){delete _0x43da83['name'];}_0x34aa0d[_0x6994('0x1f')](_0x209a6e)[_0x6994('0x29')](_0x43da83);};}exports[_0x6994('0x2a')]=function(_0x17abd7,_0x2d2265){var _0x44be12={},_0x3a449f={},_0x501366={'count':0x0,'rows':[]};var _0x203f85=_['map'](db[_0x6994('0x2b')][_0x6994('0x2c')],function(_0x8d8536){return{'name':_0x8d8536[_0x6994('0x2d')],'type':_0x8d8536[_0x6994('0x2e')][_0x6994('0x2f')]};});_0x3a449f[_0x6994('0x30')]=_[_0x6994('0x31')](_0x203f85,_0x6994('0x28'));_0x3a449f[_0x6994('0x32')]=_[_0x6994('0x33')](_0x17abd7[_0x6994('0x32')]);_0x3a449f['filters']=_[_0x6994('0x34')](_0x3a449f['model'],_0x3a449f['query']);_0x44be12[_0x6994('0x35')]=_[_0x6994('0x34')](_0x3a449f[_0x6994('0x30')],qs[_0x6994('0x36')](_0x17abd7[_0x6994('0x32')][_0x6994('0x36')]));_0x44be12[_0x6994('0x35')]=_0x44be12[_0x6994('0x35')]['length']?_0x44be12[_0x6994('0x35')]:_0x3a449f[_0x6994('0x30')];if(!_0x17abd7[_0x6994('0x32')]['hasOwnProperty'](_0x6994('0x37'))){_0x44be12['limit']=qs[_0x6994('0x1e')](_0x17abd7[_0x6994('0x32')][_0x6994('0x1e')]);_0x44be12[_0x6994('0x1d')]=qs['offset'](_0x17abd7[_0x6994('0x32')][_0x6994('0x1d')]);}_0x44be12['order']=qs[_0x6994('0x38')](_0x17abd7[_0x6994('0x32')][_0x6994('0x38')]);_0x44be12[_0x6994('0x39')]=qs['filters'](_['pick'](_0x17abd7['query'],_0x3a449f[_0x6994('0x3a')]),_0x203f85);if(_0x17abd7['query'][_0x6994('0x3b')]){_0x44be12['where']=_[_0x6994('0x3c')](_0x44be12[_0x6994('0x39')],{'$or':_[_0x6994('0x31')](_0x203f85,function(_0x105ee8){if(_0x105ee8[_0x6994('0x2e')]!==_0x6994('0x3d')){var _0x1f866f={};_0x1f866f[_0x105ee8[_0x6994('0x28')]]={'$like':'%'+_0x17abd7[_0x6994('0x32')][_0x6994('0x3b')]+'%'};return _0x1f866f;}})});}_0x44be12=_[_0x6994('0x3c')]({},_0x44be12,_0x17abd7[_0x6994('0x3e')]);var _0x39862e={'where':_0x44be12['where']};return db['FreshdeskField']['count'](_0x39862e)[_0x6994('0x25')](function(_0x33f0ce){_0x501366[_0x6994('0x1c')]=_0x33f0ce;if(_0x17abd7[_0x6994('0x32')][_0x6994('0x3f')]){_0x44be12[_0x6994('0x40')]=[{'all':!![]}];}return db['FreshdeskField'][_0x6994('0x41')](_0x44be12);})[_0x6994('0x25')](function(_0x47e5d6){_0x501366[_0x6994('0x42')]=_0x47e5d6;return _0x501366;})[_0x6994('0x25')](respondWithFilteredResult(_0x2d2265,_0x44be12))[_0x6994('0x43')](handleError(_0x2d2265,null));};exports[_0x6994('0x44')]=function(_0x372b5c,_0x28491d){var _0x2cfd8a={'raw':!![],'where':{'id':_0x372b5c['params']['id']}},_0x591822={};_0x591822[_0x6994('0x30')]=_[_0x6994('0x33')](db['FreshdeskField']['rawAttributes']);_0x591822[_0x6994('0x32')]=_[_0x6994('0x33')](_0x372b5c[_0x6994('0x32')]);_0x591822['filters']=_[_0x6994('0x34')](_0x591822[_0x6994('0x30')],_0x591822[_0x6994('0x32')]);_0x2cfd8a[_0x6994('0x35')]=_[_0x6994('0x34')](_0x591822[_0x6994('0x30')],qs[_0x6994('0x36')](_0x372b5c[_0x6994('0x32')][_0x6994('0x36')]));_0x2cfd8a['attributes']=_0x2cfd8a[_0x6994('0x35')][_0x6994('0x45')]?_0x2cfd8a[_0x6994('0x35')]:_0x591822[_0x6994('0x30')];if(_0x372b5c[_0x6994('0x32')][_0x6994('0x3f')]){_0x2cfd8a[_0x6994('0x40')]=[{'all':!![]}];}_0x2cfd8a=_[_0x6994('0x3c')]({},_0x2cfd8a,_0x372b5c[_0x6994('0x3e')]);return db['FreshdeskField'][_0x6994('0x46')](_0x2cfd8a)['then'](handleEntityNotFound(_0x28491d,null))['then'](respondWithResult(_0x28491d,null))[_0x6994('0x43')](handleError(_0x28491d,null));};exports[_0x6994('0x47')]=function(_0xd114c4,_0x371caf){return db[_0x6994('0x2b')][_0x6994('0x47')](_0xd114c4[_0x6994('0x48')],{})['then'](respondWithResult(_0x371caf,0xc9))[_0x6994('0x43')](handleError(_0x371caf,null));};exports['update']=function(_0x1d61ff,_0x5518c1){if(_0x1d61ff[_0x6994('0x48')]['id']){delete _0x1d61ff[_0x6994('0x48')]['id'];}return db[_0x6994('0x2b')]['find']({'where':{'id':_0x1d61ff[_0x6994('0x49')]['id']}})[_0x6994('0x25')](handleEntityNotFound(_0x5518c1,null))[_0x6994('0x25')](saveUpdates(_0x1d61ff[_0x6994('0x48')],null))['then'](respondWithResult(_0x5518c1,null))['catch'](handleError(_0x5518c1,null));};exports[_0x6994('0x26')]=function(_0x11e3bd,_0x3fb29a){return db[_0x6994('0x2b')][_0x6994('0x46')]({'where':{'id':_0x11e3bd[_0x6994('0x49')]['id']}})[_0x6994('0x25')](handleEntityNotFound(_0x3fb29a,null))[_0x6994('0x25')](removeEntity(_0x3fb29a,null))[_0x6994('0x43')](handleError(_0x3fb29a,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index ca34562..a98e7b7 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 _0xee04=['rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x3b0dfe,_0x17e497){var _0x39b508=function(_0x475b0a){while(--_0x475b0a){_0x3b0dfe['push'](_0x3b0dfe['shift']());}};_0x39b508(++_0x17e497);}(_0xee04,0x1cb));var _0x4ee0=function(_0x1cc066,_0x23411e){_0x1cc066=_0x1cc066-0x0;var _0x2b058b=_0xee04[_0x1cc066];return _0x2b058b;};'use strict';var _=require(_0x4ee0('0x0'));var util=require(_0x4ee0('0x1'));var logger=require(_0x4ee0('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4ee0('0x3'));var rp=require(_0x4ee0('0x4'));var fs=require('fs');var path=require(_0x4ee0('0x5'));var rimraf=require(_0x4ee0('0x6'));var config=require(_0x4ee0('0x7'));var attributes=require(_0x4ee0('0x8'));module[_0x4ee0('0x9')]=function(_0x18e2e2,_0x113df7){return _0x18e2e2[_0x4ee0('0xa')](_0x4ee0('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x4ee0('0xc'),'fields':[_0x4ee0('0xd'),_0x4ee0('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb050=['util','../../config/logger','api','request-promise','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x56f709,_0x49b81c){var _0xf2a807=function(_0x328a09){while(--_0x328a09){_0x56f709['push'](_0x56f709['shift']());}};_0xf2a807(++_0x49b81c);}(_0xb050,0x114));var _0x0b05=function(_0x40dfc2,_0x4acade){_0x40dfc2=_0x40dfc2-0x0;var _0x1bd738=_0xb050[_0x40dfc2];return _0x1bd738;};'use strict';var _=require('lodash');var util=require(_0x0b05('0x0'));var logger=require(_0x0b05('0x1'))(_0x0b05('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0b05('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b05('0x4'));var config=require('../../config/environment');var attributes=require(_0x0b05('0x5'));module[_0x0b05('0x6')]=function(_0x1a4a8b,_0x32aebc){return _0x1a4a8b[_0x0b05('0x7')](_0x0b05('0x8'),attributes,{'tableName':_0x0b05('0x9'),'paranoid':![],'indexes':[{'name':_0x0b05('0xa'),'fields':[_0x0b05('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 13d9eae..9c5c973 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(_0x29a963,_0x3d73ee){var _0x392db7=function(_0x3cb7a4){while(--_0x3cb7a4){_0x29a963['push'](_0x29a963['shift']());}};_0x392db7(++_0x3d73ee);}(_0xb10b,0x12a));var _0xbb10=function(_0x382987,_0x58058b){_0x382987=_0x382987-0x0;var _0x29eb57=_0xb10b[_0x382987];return _0x29eb57;};'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 _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x5ee009,_0x13b1b9){_0x5ee009=_0x5ee009-0x0;var _0xf417de=_0x7a54[_0x5ee009];return _0xf417de;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 6b4580a..b54e343 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 _0xe9e1=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','delete'];(function(_0x4df9a0,_0xfed92){var _0x9c6e43=function(_0x4c4dde){while(--_0x4c4dde){_0x4df9a0['push'](_0x4df9a0['shift']());}};_0x9c6e43(++_0xfed92);}(_0xe9e1,0xb0));var _0x1e9e=function(_0x50cd37,_0x5f3b94){_0x50cd37=_0x50cd37-0x0;var _0x4492b4=_0xe9e1[_0x50cd37];return _0x4492b4;};'use strict';var multer=require(_0x1e9e('0x0'));var util=require(_0x1e9e('0x1'));var path=require(_0x1e9e('0x2'));var timeout=require(_0x1e9e('0x3'));var express=require('express');var router=express[_0x1e9e('0x4')]();var auth=require(_0x1e9e('0x5'));var interaction=require(_0x1e9e('0x6'));var config=require(_0x1e9e('0x7'));var controller=require(_0x1e9e('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1e9e('0x9')]);router[_0x1e9e('0xa')]('/:id',auth[_0x1e9e('0xb')](),controller[_0x1e9e('0xc')]);router['get'](_0x1e9e('0xd'),auth[_0x1e9e('0xb')](),controller[_0x1e9e('0xe')]);router[_0x1e9e('0xa')](_0x1e9e('0xf'),auth[_0x1e9e('0xb')](),controller[_0x1e9e('0x10')]);router[_0x1e9e('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1e9e('0x11')](_0x1e9e('0xd'),auth[_0x1e9e('0xb')](),controller[_0x1e9e('0x12')]);router[_0x1e9e('0x13')](_0x1e9e('0x14'),auth[_0x1e9e('0xb')](),controller['update']);router[_0x1e9e('0x15')](_0x1e9e('0x14'),auth[_0x1e9e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xad1e=['show','get','/:id/configurations','getConfigurations','/:id/fields','post','create','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','/:id'];(function(_0xbae966,_0x1e93ed){var _0x5764a4=function(_0x16025b){while(--_0x16025b){_0xbae966['push'](_0xbae966['shift']());}};_0x5764a4(++_0x1e93ed);}(_0xad1e,0x1c3));var _0xead1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xad1e[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xead1('0x0'));var util=require(_0xead1('0x1'));var path=require('path');var timeout=require(_0xead1('0x2'));var express=require(_0xead1('0x3'));var router=express['Router']();var auth=require(_0xead1('0x4'));var interaction=require(_0xead1('0x5'));var config=require(_0xead1('0x6'));var controller=require(_0xead1('0x7'));router['get']('/',auth[_0xead1('0x8')](),controller[_0xead1('0x9')]);router['get'](_0xead1('0xa'),auth[_0xead1('0x8')](),controller[_0xead1('0xb')]);router[_0xead1('0xc')](_0xead1('0xd'),auth[_0xead1('0x8')](),controller[_0xead1('0xe')]);router[_0xead1('0xc')](_0xead1('0xf'),auth[_0xead1('0x8')](),controller['getFields']);router[_0xead1('0x10')]('/',auth['isAuthenticated'](),controller[_0xead1('0x11')]);router[_0xead1('0x10')](_0xead1('0xd'),auth[_0xead1('0x8')](),controller['addConfiguration']);router['put'](_0xead1('0xa'),auth['isAuthenticated'](),controller[_0xead1('0x12')]);router['delete'](_0xead1('0xa'),auth[_0xead1('0x8')](),controller[_0xead1('0x13')]);module[_0xead1('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 1113370..bb48956 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 _0xf61e=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3ea0af,_0x462535){var _0x37b9ab=function(_0x42d565){while(--_0x42d565){_0x3ea0af['push'](_0x3ea0af['shift']());}};_0x37b9ab(++_0x462535);}(_0xf61e,0x191));var _0xef61=function(_0x31ea24,_0x18364e){_0x31ea24=_0x31ea24-0x0;var _0x1fb0ca=_0xf61e[_0x31ea24];return _0x1fb0ca;};'use strict';var Sequelize=require(_0xef61('0x0'));module[_0xef61('0x1')]={'name':{'type':Sequelize[_0xef61('0x2')]},'description':{'type':Sequelize[_0xef61('0x2')]},'username':{'type':Sequelize[_0xef61('0x2')],'unique':_0xef61('0x3')},'apiKey':{'type':Sequelize[_0xef61('0x2')]},'remoteUri':{'type':Sequelize[_0xef61('0x2')],'unique':_0xef61('0x4')},'serverUrl':{'type':Sequelize[_0xef61('0x2')]}}; \ No newline at end of file +var _0x8a9a=['STRING','username','remoteUri','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x8a9a[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require('sequelize');module[_0xa8a9('0x0')]={'name':{'type':Sequelize[_0xa8a9('0x1')]},'description':{'type':Sequelize[_0xa8a9('0x1')]},'username':{'type':Sequelize[_0xa8a9('0x1')],'unique':_0xa8a9('0x2')},'apiKey':{'type':Sequelize[_0xa8a9('0x1')]},'remoteUri':{'type':Sequelize[_0xa8a9('0x1')],'unique':_0xa8a9('0x3')},'serverUrl':{'type':Sequelize[_0xa8a9('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 42af4b9..d5eaed6 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 _0x4262=['VIRTUAL','options','includeAll','params','include','find','create','body','destroy','getConfigurations','findOne','rawAttributes','order','merge','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','apiKey','slice','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','sendStatus','name','index','map','FreshsalesAccount','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x24baf9,_0x38f142){var _0xbccc3d=function(_0x339615){while(--_0x339615){_0x24baf9['push'](_0x24baf9['shift']());}};_0xbccc3d(++_0x38f142);}(_0x4262,0x95));var _0x2426=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4262[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x2426('0x0'));var emlformat=require(_0x2426('0x1'));var rimraf=require(_0x2426('0x2'));var zipdir=require(_0x2426('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2426('0x4'));var moment=require(_0x2426('0x5'));var BPromise=require(_0x2426('0x6'));var Mustache=require(_0x2426('0x7'));var util=require(_0x2426('0x8'));var path=require(_0x2426('0x9'));var sox=require(_0x2426('0xa'));var csv=require(_0x2426('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2426('0xc'));var crypto=require('crypto');var jsforce=require(_0x2426('0xd'));var deskjs=require(_0x2426('0xe'));var toCsv=require(_0x2426('0xb'));var querystring=require(_0x2426('0xf'));var Papa=require(_0x2426('0x10'));var Redis=require(_0x2426('0x11'));var authService=require(_0x2426('0x12'));var qs=require(_0x2426('0x13'));var as=require(_0x2426('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2426('0x15'))(_0x2426('0x16'));var utils=require(_0x2426('0x17'));var config=require(_0x2426('0x18'));var db=require(_0x2426('0x19'))['db'];var integrations=require(_0x2426('0x1a'));var jayson=require(_0x2426('0x1b'));var client=jayson['client'][_0x2426('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x139f73,_0x43c378,_0x183d5c){if(_0x183d5c){var _0x1d6307=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1d6307[_0x2426('0x1d')](_0x43c378)){return _0x139f73;}else{throw new db[(_0x2426('0x1e'))][(_0x2426('0x1f'))](_0x2426('0x20'));}}else{return _0x139f73;}}function respondWithRpcPromise(_0x3fb4e8,_0x3b49d7,_0x4247a5,_0x14de12){return new BPromise(function(_0x37f8a0,_0x494762){var _0x58c6ee=_0x14de12||client;return _0x58c6ee[_0x2426('0x21')](_0x3fb4e8,_0x4247a5)[_0x2426('0x22')](function(_0x12f0f6){logger[_0x2426('0x23')]('FreshsalesAccount,\x20%s,\x20%s',_0x3b49d7,_0x2426('0x24'));logger[_0x2426('0x25')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3b49d7,_0x2426('0x24'),JSON['stringify'](_0x12f0f6));if(_0x12f0f6[_0x2426('0x26')]){if(_0x12f0f6[_0x2426('0x26')][_0x2426('0x27')]===0x1f4){logger['error'](_0x2426('0x28'),_0x3b49d7,_0x12f0f6[_0x2426('0x26')]['message']);return _0x494762(_0x12f0f6[_0x2426('0x26')][_0x2426('0x29')]);}logger[_0x2426('0x26')](_0x2426('0x28'),_0x3b49d7,_0x12f0f6[_0x2426('0x26')][_0x2426('0x29')]);return _0x37f8a0(_0x12f0f6[_0x2426('0x26')][_0x2426('0x29')]);}else{logger[_0x2426('0x23')](_0x2426('0x28'),_0x3b49d7,_0x2426('0x24'));_0x37f8a0(_0x12f0f6[_0x2426('0x2a')][_0x2426('0x29')]);}})[_0x2426('0x2b')](function(_0x15849d){logger[_0x2426('0x26')]('FreshsalesAccount,\x20%s,\x20%s',_0x3b49d7,_0x15849d);_0x494762(_0x15849d);});});}function respondWithStatusCode(_0x5285ea,_0x73d524){_0x73d524=_0x73d524||0xcc;return function(_0x155a3c){if(_0x155a3c){return _0x5285ea['sendStatus'](_0x73d524);}return _0x5285ea[_0x2426('0x2c')](_0x73d524)[_0x2426('0x2d')]();};}function respondWithResult(_0x136972,_0x1fc92f){_0x1fc92f=_0x1fc92f||0xc8;return function(_0x4a56da){if(_0x4a56da){return _0x136972[_0x2426('0x2c')](_0x1fc92f)[_0x2426('0x2e')](_0x4a56da);}};}function respondWithFilteredResult(_0x17822c,_0x11d098){return function(_0x467249){if(_0x467249){var _0x44b7bb=_0x467249[_0x2426('0x2f')],_0x4a586c=_0x11d098[_0x2426('0x30')],_0xbde823=_0x11d098[_0x2426('0x30')]+_0x11d098[_0x2426('0x31')],_0x1d76ee;if(_0xbde823>=_0x44b7bb){_0xbde823=_0x44b7bb;_0x1d76ee=0xc8;}else{_0x1d76ee=0xce;}_0x17822c['status'](_0x1d76ee);return _0x17822c[_0x2426('0x32')](_0x2426('0x33'),_0x4a586c+'-'+_0xbde823+'/'+_0x44b7bb)[_0x2426('0x2e')](_0x467249);}return null;};}function patchUpdates(_0x49c6a0){return function(_0x37d7d2){try{jsonpatch[_0x2426('0x34')](_0x37d7d2,_0x49c6a0,!![]);}catch(_0x37e145){return BPromise[_0x2426('0x35')](_0x37e145);}return _0x37d7d2[_0x2426('0x36')]();};}function saveUpdates(_0x2df44d,_0x320314){return function(_0x52c64a){if(_0x52c64a){return _0x52c64a[_0x2426('0x37')](_0x2df44d)['then'](function(_0x3692eb){return _0x3692eb;});}return null;};}function removeEntity(_0x562ce5,_0x377ba1){return function(_0x3ee90f){if(_0x3ee90f){return _0x3ee90f['destroy']()[_0x2426('0x22')](function(){_0x562ce5[_0x2426('0x2c')](0xcc)[_0x2426('0x2d')]();});}};}function handleEntityNotFound(_0x5ac986,_0x4badcd){return function(_0xeb65b5){if(!_0xeb65b5){_0x5ac986[_0x2426('0x38')](0x194);}return _0xeb65b5;};}function handleError(_0xb72a0b,_0xd34d71){_0xd34d71=_0xd34d71||0x1f4;return function(_0x1d162c){logger['error'](_0x1d162c['stack']);if(_0x1d162c['name']){delete _0x1d162c[_0x2426('0x39')];}_0xb72a0b[_0x2426('0x2c')](_0xd34d71)['send'](_0x1d162c);};}exports[_0x2426('0x3a')]=function(_0x20b5e4,_0x588435){var _0x2a155b={},_0x3bacd9={},_0x10f1ad={'count':0x0,'rows':[]};var _0x45a493=_[_0x2426('0x3b')](db[_0x2426('0x3c')]['rawAttributes'],function(_0x551bee){return{'name':_0x551bee['fieldName'],'type':_0x551bee[_0x2426('0x3d')][_0x2426('0x3e')]};});_0x3bacd9[_0x2426('0x3f')]=_['map'](_0x45a493,'name');_0x3bacd9['query']=_[_0x2426('0x40')](_0x20b5e4['query']);_0x3bacd9[_0x2426('0x41')]=_['intersection'](_0x3bacd9[_0x2426('0x3f')],_0x3bacd9[_0x2426('0x42')]);_0x2a155b[_0x2426('0x43')]=_[_0x2426('0x44')](_0x3bacd9[_0x2426('0x3f')],qs[_0x2426('0x45')](_0x20b5e4[_0x2426('0x42')][_0x2426('0x45')]));_0x2a155b[_0x2426('0x43')]=_0x2a155b[_0x2426('0x43')][_0x2426('0x46')]?_0x2a155b[_0x2426('0x43')]:_0x3bacd9[_0x2426('0x3f')];if(!_0x20b5e4[_0x2426('0x42')][_0x2426('0x47')](_0x2426('0x48'))){_0x2a155b[_0x2426('0x31')]=qs[_0x2426('0x31')](_0x20b5e4[_0x2426('0x42')][_0x2426('0x31')]);_0x2a155b['offset']=qs[_0x2426('0x30')](_0x20b5e4[_0x2426('0x42')][_0x2426('0x30')]);}_0x2a155b['order']=qs['sort'](_0x20b5e4[_0x2426('0x42')][_0x2426('0x49')]);_0x2a155b[_0x2426('0x4a')]=qs[_0x2426('0x41')](_[_0x2426('0x4b')](_0x20b5e4['query'],_0x3bacd9[_0x2426('0x41')]),_0x45a493);if(_0x20b5e4[_0x2426('0x42')][_0x2426('0x4c')]){_0x2a155b['where']=_['merge'](_0x2a155b[_0x2426('0x4a')],{'$or':_[_0x2426('0x3b')](_0x45a493,function(_0x47c67c){if(_0x47c67c[_0x2426('0x3d')]!==_0x2426('0x4d')){var _0x1ef176={};_0x1ef176[_0x47c67c[_0x2426('0x39')]]={'$like':'%'+_0x20b5e4[_0x2426('0x42')][_0x2426('0x4c')]+'%'};return _0x1ef176;}})});}_0x2a155b=_['merge']({},_0x2a155b,_0x20b5e4[_0x2426('0x4e')]);var _0x4ffafe={'where':_0x2a155b[_0x2426('0x4a')]};return db[_0x2426('0x3c')][_0x2426('0x2f')](_0x4ffafe)['then'](function(_0x447530){_0x10f1ad[_0x2426('0x2f')]=_0x447530;if(_0x20b5e4['query'][_0x2426('0x4f')]){_0x2a155b['include']=[{'all':!![]}];}return db[_0x2426('0x3c')]['findAll'](_0x2a155b);})[_0x2426('0x22')](function(_0x4be5bc){_0x10f1ad['rows']=_0x4be5bc;return _0x10f1ad;})['then'](respondWithFilteredResult(_0x588435,_0x2a155b))[_0x2426('0x2b')](handleError(_0x588435,null));};exports['show']=function(_0x2a70d9,_0x4c3518){var _0x33155f={'raw':![],'where':{'id':_0x2a70d9[_0x2426('0x50')]['id']}},_0x4c4e90={};_0x4c4e90[_0x2426('0x3f')]=_[_0x2426('0x40')](db[_0x2426('0x3c')]['rawAttributes']);_0x4c4e90[_0x2426('0x42')]=_['keys'](_0x2a70d9[_0x2426('0x42')]);_0x4c4e90[_0x2426('0x41')]=_[_0x2426('0x44')](_0x4c4e90[_0x2426('0x3f')],_0x4c4e90['query']);_0x33155f[_0x2426('0x43')]=_[_0x2426('0x44')](_0x4c4e90[_0x2426('0x3f')],qs[_0x2426('0x45')](_0x2a70d9[_0x2426('0x42')][_0x2426('0x45')]));_0x33155f['attributes']=_0x33155f[_0x2426('0x43')][_0x2426('0x46')]?_0x33155f[_0x2426('0x43')]:_0x4c4e90[_0x2426('0x3f')];if(_0x2a70d9[_0x2426('0x42')]['includeAll']){_0x33155f[_0x2426('0x51')]=[{'all':!![]}];}_0x33155f=_['merge']({},_0x33155f,_0x2a70d9[_0x2426('0x4e')]);return db[_0x2426('0x3c')][_0x2426('0x52')](_0x33155f)[_0x2426('0x22')](handleEntityNotFound(_0x4c3518,null))[_0x2426('0x22')](respondWithResult(_0x4c3518,null))[_0x2426('0x2b')](handleError(_0x4c3518,null));};exports[_0x2426('0x53')]=function(_0x2b6642,_0x284fd1){return db[_0x2426('0x3c')][_0x2426('0x53')](_0x2b6642[_0x2426('0x54')],{})[_0x2426('0x22')](respondWithResult(_0x284fd1,0xc9))['catch'](handleError(_0x284fd1,null));};exports[_0x2426('0x37')]=function(_0x52a1df,_0x87be25){if(_0x52a1df[_0x2426('0x54')]['id']){delete _0x52a1df[_0x2426('0x54')]['id'];}return db[_0x2426('0x3c')][_0x2426('0x52')]({'where':{'id':_0x52a1df['params']['id']}})[_0x2426('0x22')](handleEntityNotFound(_0x87be25,null))['then'](saveUpdates(_0x52a1df[_0x2426('0x54')],null))[_0x2426('0x22')](respondWithResult(_0x87be25,null))[_0x2426('0x2b')](handleError(_0x87be25,null));};exports[_0x2426('0x55')]=function(_0x1f2dfe,_0x5448d4){return db['FreshsalesAccount'][_0x2426('0x52')]({'where':{'id':_0x1f2dfe[_0x2426('0x50')]['id']}})[_0x2426('0x22')](handleEntityNotFound(_0x5448d4,null))[_0x2426('0x22')](removeEntity(_0x5448d4,null))['catch'](handleError(_0x5448d4,null));};exports[_0x2426('0x56')]=function(_0x16eefd,_0x30ede7,_0x288996){var _0x35668e={};var _0x7a6120={};var _0x2ae55b;var _0x9974a8;return db[_0x2426('0x3c')][_0x2426('0x57')]({'where':{'id':_0x16eefd[_0x2426('0x50')]['id']}})[_0x2426('0x22')](handleEntityNotFound(_0x30ede7,null))[_0x2426('0x22')](function(_0x3dfb33){if(_0x3dfb33){_0x2ae55b=_0x3dfb33;_0x7a6120[_0x2426('0x3f')]=_[_0x2426('0x40')](db['FreshsalesConfiguration'][_0x2426('0x58')]);_0x7a6120[_0x2426('0x42')]=_[_0x2426('0x40')](_0x16eefd['query']);_0x7a6120['filters']=_[_0x2426('0x44')](_0x7a6120[_0x2426('0x3f')],_0x7a6120[_0x2426('0x42')]);_0x35668e[_0x2426('0x43')]=_['intersection'](_0x7a6120[_0x2426('0x3f')],qs[_0x2426('0x45')](_0x16eefd[_0x2426('0x42')]['fields']));_0x35668e[_0x2426('0x43')]=_0x35668e[_0x2426('0x43')][_0x2426('0x46')]?_0x35668e[_0x2426('0x43')]:_0x7a6120['model'];_0x35668e[_0x2426('0x59')]=qs[_0x2426('0x49')](_0x16eefd[_0x2426('0x42')]['sort']);_0x35668e[_0x2426('0x4a')]=qs[_0x2426('0x41')](_[_0x2426('0x4b')](_0x16eefd['query'],_0x7a6120[_0x2426('0x41')]));if(_0x16eefd[_0x2426('0x42')]['filter']){_0x35668e['where']=_['merge'](_0x35668e[_0x2426('0x4a')],{'$or':_[_0x2426('0x3b')](_0x35668e['attributes'],function(_0x2f5468){var _0x92535={};_0x92535[_0x2f5468]={'$like':'%'+_0x16eefd[_0x2426('0x42')][_0x2426('0x4c')]+'%'};return _0x92535;})});}_0x35668e=_[_0x2426('0x5a')]({},_0x35668e,_0x16eefd[_0x2426('0x4e')]);return _0x2ae55b['getConfigurations'](_0x35668e);}})[_0x2426('0x22')](function(_0x39582f){if(_0x39582f){_0x9974a8=_0x39582f[_0x2426('0x46')];if(!_0x16eefd[_0x2426('0x42')]['hasOwnProperty'](_0x2426('0x48'))){_0x35668e[_0x2426('0x31')]=qs[_0x2426('0x31')](_0x16eefd[_0x2426('0x42')][_0x2426('0x31')]);_0x35668e[_0x2426('0x30')]=qs[_0x2426('0x30')](_0x16eefd[_0x2426('0x42')][_0x2426('0x30')]);}return _0x2ae55b[_0x2426('0x56')](_0x35668e);}})['then'](function(_0x470587){if(_0x470587){return _0x470587?{'count':_0x9974a8,'rows':_0x470587}:null;}})[_0x2426('0x22')](respondWithResult(_0x30ede7,null))[_0x2426('0x2b')](handleError(_0x30ede7,null));};exports[_0x2426('0x5b')]=function(_0xb1705a,_0x1a0c03,_0x23c605){if(_0xb1705a[_0x2426('0x54')]['id']){delete _0xb1705a[_0x2426('0x54')]['id'];}return db[_0x2426('0x3c')]['findOne']({'where':{'id':_0xb1705a[_0x2426('0x50')]['id']}})['then'](handleEntityNotFound(_0x1a0c03,null))[_0x2426('0x22')](function(_0x6905dd){if(_0x6905dd){_0xb1705a['body'][_0x2426('0x5c')]=_0x6905dd['id'];_0xb1705a[_0x2426('0x54')][_0x2426('0x5d')]=integrations[_0x2426('0x5e')](_0xb1705a[_0x2426('0x54')][_0x2426('0x5f')],_0xb1705a[_0x2426('0x54')][_0x2426('0x3d')]);_0xb1705a[_0x2426('0x54')][_0x2426('0x60')]=integrations['getDescriptions'](_0xb1705a[_0x2426('0x54')][_0x2426('0x5f')],_0xb1705a[_0x2426('0x54')][_0x2426('0x3d')]);return db[_0x2426('0x61')][_0x2426('0x53')](_0xb1705a['body'],{'include':[{'model':db[_0x2426('0x62')],'as':_0x2426('0x5d')},{'model':db[_0x2426('0x62')],'as':_0x2426('0x60')}]});}return null;})['then'](respondWithResult(_0x1a0c03,null))['catch'](handleError(_0x1a0c03,null));};exports[_0x2426('0x63')]=function(_0x3a0e80,_0x4b7a00,_0xa1f27b){var _0x3df568='';var _0x597bd8='';return db[_0x2426('0x3c')]['findOne']({'where':{'id':_0x3a0e80['params']['id']},'attributes':['id',_0x2426('0x64'),'remoteUri',_0x2426('0x65')]})[_0x2426('0x22')](handleEntityNotFound(_0x4b7a00,null))[_0x2426('0x22')](function(_0x307e68){if(_0x307e68){_0x597bd8=_0x307e68[_0x2426('0x64')];_0x3df568=_0x307e68['remoteUri'];var _0x243d44=_0x307e68['remoteUri'][_0x2426('0x66')](-0x1);if(_0x243d44==='/'){_0x3df568=_0x3df568['substring'](0x0,_0x3df568['lastIndexOf'](_0x243d44));}return rp({'method':_0x2426('0x67'),'uri':util[_0x2426('0x68')](_0x2426('0x69'),_0x3df568,_0x2426('0x6a')),'headers':{'Authorization':_0x2426('0x6b')+_0x307e68[_0x2426('0x65')]},'json':!![]});}})[_0x2426('0x22')](function(_0x135ae7){if(_0x135ae7){var _0xf06aa4=_0x135ae7['users'];var _0xc80cef=![];var _0x121f45=null;for(_0x121f45=0x0;_0x121f45<_0xf06aa4['length'];_0x121f45++){if(_0xf06aa4[_0x121f45][_0x2426('0x6c')]===_0x597bd8){_0xc80cef=!![];}}if(_0xc80cef){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x2426('0x22')](respondWithResult(_0x4b7a00,null))['catch'](function(_0x2eba97){var _0x1c0a6e=_0x3a0e80[_0x2426('0x42')][_0x2426('0x1d')]?0x1f4:_0x2eba97[_0x2426('0x6d')]||0x1f4;logger[_0x2426('0x26')](_0x2426('0x6e'),_0x2426('0x63'),_0x1c0a6e,JSON[_0x2426('0x6f')](_0x2eba97));delete _0x2eba97[_0x2426('0x39')];if(_0x1c0a6e===0x191){_0x1c0a6e=0x190;}_0x4b7a00[_0x2426('0x2c')](_0x1c0a6e)['send'](_0x3a0e80[_0x2426('0x42')][_0x2426('0x1d')]?{'message':_0x2426('0x70'),'statusCode':_0x2eba97[_0x2426('0x6d')]}:_0x2eba97);});}; \ No newline at end of file +var _0xf1e0=['Subjects','getSubjects','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','offset','set','Content-Range','reject','save','destroy','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','VIRTUAL','filter','merge','count','findAll','catch','show','keys','rawAttributes','include','options','find','create','body','update','params','getConfigurations','findOne','FreshsalesConfiguration','order','nolimit','addConfiguration'];(function(_0x28b3a4,_0x3eef59){var _0x37ed76=function(_0xda9bd4){while(--_0xda9bd4){_0x28b3a4['push'](_0x28b3a4['shift']());}};_0x37ed76(++_0x3eef59);}(_0xf1e0,0x1e3));var _0x0f1e=function(_0x567f86,_0x45c97b){_0x567f86=_0x567f86-0x0;var _0x3a1c35=_0xf1e0[_0x567f86];return _0x3a1c35;};'use strict';var pdf=require(_0x0f1e('0x0'));var emlformat=require(_0x0f1e('0x1'));var rimraf=require(_0x0f1e('0x2'));var zipdir=require(_0x0f1e('0x3'));var jsonpatch=require(_0x0f1e('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0f1e('0x5'));var Mustache=require(_0x0f1e('0x6'));var util=require(_0x0f1e('0x7'));var path=require('path');var sox=require(_0x0f1e('0x8'));var csv=require(_0x0f1e('0x9'));var ejs=require(_0x0f1e('0xa'));var fs=require('fs');var _=require(_0x0f1e('0xb'));var squel=require(_0x0f1e('0xc'));var crypto=require(_0x0f1e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0f1e('0xe'));var toCsv=require(_0x0f1e('0x9'));var querystring=require(_0x0f1e('0xf'));var Papa=require(_0x0f1e('0x10'));var Redis=require(_0x0f1e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0f1e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f1e('0x13'))(_0x0f1e('0x14'));var utils=require(_0x0f1e('0x15'));var config=require('../../config/environment');var db=require(_0x0f1e('0x16'))['db'];var integrations=require(_0x0f1e('0x17'));var jayson=require(_0x0f1e('0x18'));var client=jayson[_0x0f1e('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x40bb07,_0x59bad0,_0x4f865a){if(_0x4f865a){var _0xf7f785=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xf7f785['test'](_0x59bad0)){return _0x40bb07;}else{throw new db[(_0x0f1e('0x1a'))][(_0x0f1e('0x1b'))](_0x0f1e('0x1c'));}}else{return _0x40bb07;}}function respondWithRpcPromise(_0x24bb37,_0x5e2300,_0x4b739e,_0x5e3ff6){return new BPromise(function(_0x6d3d4b,_0x45df74){var _0x1c6976=_0x5e3ff6||client;return _0x1c6976[_0x0f1e('0x1d')](_0x24bb37,_0x4b739e)[_0x0f1e('0x1e')](function(_0x3754e1){logger[_0x0f1e('0x1f')](_0x0f1e('0x20'),_0x5e2300,_0x0f1e('0x21'));logger['debug'](_0x0f1e('0x22'),_0x5e2300,_0x0f1e('0x21'),JSON['stringify'](_0x3754e1));if(_0x3754e1[_0x0f1e('0x23')]){if(_0x3754e1['error'][_0x0f1e('0x24')]===0x1f4){logger['error'](_0x0f1e('0x20'),_0x5e2300,_0x3754e1[_0x0f1e('0x23')]['message']);return _0x45df74(_0x3754e1[_0x0f1e('0x23')][_0x0f1e('0x25')]);}logger[_0x0f1e('0x23')](_0x0f1e('0x20'),_0x5e2300,_0x3754e1['error'][_0x0f1e('0x25')]);return _0x6d3d4b(_0x3754e1['error'][_0x0f1e('0x25')]);}else{logger[_0x0f1e('0x1f')](_0x0f1e('0x20'),_0x5e2300,'request\x20sent');_0x6d3d4b(_0x3754e1[_0x0f1e('0x26')]['message']);}})['catch'](function(_0x381908){logger[_0x0f1e('0x23')](_0x0f1e('0x20'),_0x5e2300,_0x381908);_0x45df74(_0x381908);});});}function respondWithStatusCode(_0x59a015,_0x25c6fe){_0x25c6fe=_0x25c6fe||0xcc;return function(_0x354091){if(_0x354091){return _0x59a015[_0x0f1e('0x27')](_0x25c6fe);}return _0x59a015[_0x0f1e('0x28')](_0x25c6fe)[_0x0f1e('0x29')]();};}function respondWithResult(_0x46b73e,_0x4cd4ab){_0x4cd4ab=_0x4cd4ab||0xc8;return function(_0x3aecbf){if(_0x3aecbf){return _0x46b73e['status'](_0x4cd4ab)[_0x0f1e('0x2a')](_0x3aecbf);}};}function respondWithFilteredResult(_0x5185d2,_0x58c06e){return function(_0x1c2850){if(_0x1c2850){var _0x15b7ad=_0x1c2850['count'],_0x4939c9=_0x58c06e[_0x0f1e('0x2b')],_0x4e65df=_0x58c06e[_0x0f1e('0x2b')]+_0x58c06e['limit'],_0x31035d;if(_0x4e65df>=_0x15b7ad){_0x4e65df=_0x15b7ad;_0x31035d=0xc8;}else{_0x31035d=0xce;}_0x5185d2[_0x0f1e('0x28')](_0x31035d);return _0x5185d2[_0x0f1e('0x2c')](_0x0f1e('0x2d'),_0x4939c9+'-'+_0x4e65df+'/'+_0x15b7ad)[_0x0f1e('0x2a')](_0x1c2850);}return null;};}function patchUpdates(_0xdd29ff){return function(_0x315a81){try{jsonpatch['apply'](_0x315a81,_0xdd29ff,!![]);}catch(_0x3ba8dd){return BPromise[_0x0f1e('0x2e')](_0x3ba8dd);}return _0x315a81[_0x0f1e('0x2f')]();};}function saveUpdates(_0x8dd12f,_0x2b1bd2){return function(_0x2b3f64){if(_0x2b3f64){return _0x2b3f64['update'](_0x8dd12f)[_0x0f1e('0x1e')](function(_0x18acde){return _0x18acde;});}return null;};}function removeEntity(_0x21c078,_0x148833){return function(_0x15ddc9){if(_0x15ddc9){return _0x15ddc9[_0x0f1e('0x30')]()[_0x0f1e('0x1e')](function(){_0x21c078[_0x0f1e('0x28')](0xcc)[_0x0f1e('0x29')]();});}};}function handleEntityNotFound(_0x45e65a,_0x3e9922){return function(_0x2412b2){if(!_0x2412b2){_0x45e65a[_0x0f1e('0x27')](0x194);}return _0x2412b2;};}function handleError(_0x2f5714,_0x409471){_0x409471=_0x409471||0x1f4;return function(_0x1ff660){logger[_0x0f1e('0x23')](_0x1ff660[_0x0f1e('0x31')]);if(_0x1ff660[_0x0f1e('0x32')]){delete _0x1ff660[_0x0f1e('0x32')];}_0x2f5714['status'](_0x409471)[_0x0f1e('0x33')](_0x1ff660);};}exports[_0x0f1e('0x34')]=function(_0x48b8a9,_0x4de21f){var _0x154463={},_0x37d62e={},_0x5564d3={'count':0x0,'rows':[]};var _0x3fda9a=_[_0x0f1e('0x35')](db[_0x0f1e('0x36')]['rawAttributes'],function(_0xda6d4f){return{'name':_0xda6d4f[_0x0f1e('0x37')],'type':_0xda6d4f[_0x0f1e('0x38')][_0x0f1e('0x39')]};});_0x37d62e[_0x0f1e('0x3a')]=_[_0x0f1e('0x35')](_0x3fda9a,_0x0f1e('0x32'));_0x37d62e[_0x0f1e('0x3b')]=_['keys'](_0x48b8a9[_0x0f1e('0x3b')]);_0x37d62e[_0x0f1e('0x3c')]=_['intersection'](_0x37d62e[_0x0f1e('0x3a')],_0x37d62e['query']);_0x154463[_0x0f1e('0x3d')]=_[_0x0f1e('0x3e')](_0x37d62e[_0x0f1e('0x3a')],qs[_0x0f1e('0x3f')](_0x48b8a9[_0x0f1e('0x3b')][_0x0f1e('0x3f')]));_0x154463[_0x0f1e('0x3d')]=_0x154463[_0x0f1e('0x3d')][_0x0f1e('0x40')]?_0x154463[_0x0f1e('0x3d')]:_0x37d62e['model'];if(!_0x48b8a9[_0x0f1e('0x3b')][_0x0f1e('0x41')]('nolimit')){_0x154463[_0x0f1e('0x42')]=qs[_0x0f1e('0x42')](_0x48b8a9[_0x0f1e('0x3b')][_0x0f1e('0x42')]);_0x154463['offset']=qs[_0x0f1e('0x2b')](_0x48b8a9[_0x0f1e('0x3b')][_0x0f1e('0x2b')]);}_0x154463['order']=qs[_0x0f1e('0x43')](_0x48b8a9[_0x0f1e('0x3b')]['sort']);_0x154463[_0x0f1e('0x44')]=qs[_0x0f1e('0x3c')](_[_0x0f1e('0x45')](_0x48b8a9['query'],_0x37d62e[_0x0f1e('0x3c')]),_0x3fda9a);if(_0x48b8a9[_0x0f1e('0x3b')]['filter']){_0x154463[_0x0f1e('0x44')]=_['merge'](_0x154463[_0x0f1e('0x44')],{'$or':_['map'](_0x3fda9a,function(_0x28a7d6){if(_0x28a7d6[_0x0f1e('0x38')]!==_0x0f1e('0x46')){var _0x18cf84={};_0x18cf84[_0x28a7d6[_0x0f1e('0x32')]]={'$like':'%'+_0x48b8a9[_0x0f1e('0x3b')][_0x0f1e('0x47')]+'%'};return _0x18cf84;}})});}_0x154463=_[_0x0f1e('0x48')]({},_0x154463,_0x48b8a9['options']);var _0xcb1c24={'where':_0x154463[_0x0f1e('0x44')]};return db[_0x0f1e('0x36')]['count'](_0xcb1c24)['then'](function(_0xa0028c){_0x5564d3[_0x0f1e('0x49')]=_0xa0028c;if(_0x48b8a9['query']['includeAll']){_0x154463['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x0f1e('0x4a')](_0x154463);})[_0x0f1e('0x1e')](function(_0x109b1e){_0x5564d3['rows']=_0x109b1e;return _0x5564d3;})[_0x0f1e('0x1e')](respondWithFilteredResult(_0x4de21f,_0x154463))[_0x0f1e('0x4b')](handleError(_0x4de21f,null));};exports[_0x0f1e('0x4c')]=function(_0x58e251,_0x2563d8){var _0x334d08={'raw':![],'where':{'id':_0x58e251['params']['id']}},_0x1aae2f={};_0x1aae2f[_0x0f1e('0x3a')]=_[_0x0f1e('0x4d')](db[_0x0f1e('0x36')][_0x0f1e('0x4e')]);_0x1aae2f[_0x0f1e('0x3b')]=_[_0x0f1e('0x4d')](_0x58e251[_0x0f1e('0x3b')]);_0x1aae2f[_0x0f1e('0x3c')]=_[_0x0f1e('0x3e')](_0x1aae2f['model'],_0x1aae2f['query']);_0x334d08[_0x0f1e('0x3d')]=_[_0x0f1e('0x3e')](_0x1aae2f[_0x0f1e('0x3a')],qs[_0x0f1e('0x3f')](_0x58e251['query'][_0x0f1e('0x3f')]));_0x334d08[_0x0f1e('0x3d')]=_0x334d08['attributes'][_0x0f1e('0x40')]?_0x334d08[_0x0f1e('0x3d')]:_0x1aae2f['model'];if(_0x58e251[_0x0f1e('0x3b')]['includeAll']){_0x334d08[_0x0f1e('0x4f')]=[{'all':!![]}];}_0x334d08=_['merge']({},_0x334d08,_0x58e251[_0x0f1e('0x50')]);return db['FreshsalesAccount'][_0x0f1e('0x51')](_0x334d08)['then'](handleEntityNotFound(_0x2563d8,null))[_0x0f1e('0x1e')](respondWithResult(_0x2563d8,null))[_0x0f1e('0x4b')](handleError(_0x2563d8,null));};exports[_0x0f1e('0x52')]=function(_0x2bd517,_0x39ec1e){return db[_0x0f1e('0x36')][_0x0f1e('0x52')](_0x2bd517[_0x0f1e('0x53')],{})[_0x0f1e('0x1e')](respondWithResult(_0x39ec1e,0xc9))['catch'](handleError(_0x39ec1e,null));};exports[_0x0f1e('0x54')]=function(_0x5011cc,_0x57ed39){if(_0x5011cc[_0x0f1e('0x53')]['id']){delete _0x5011cc[_0x0f1e('0x53')]['id'];}return db[_0x0f1e('0x36')][_0x0f1e('0x51')]({'where':{'id':_0x5011cc[_0x0f1e('0x55')]['id']}})[_0x0f1e('0x1e')](handleEntityNotFound(_0x57ed39,null))['then'](saveUpdates(_0x5011cc['body'],null))[_0x0f1e('0x1e')](respondWithResult(_0x57ed39,null))[_0x0f1e('0x4b')](handleError(_0x57ed39,null));};exports[_0x0f1e('0x30')]=function(_0x33cb65,_0x410dbe){return db['FreshsalesAccount']['find']({'where':{'id':_0x33cb65[_0x0f1e('0x55')]['id']}})[_0x0f1e('0x1e')](handleEntityNotFound(_0x410dbe,null))['then'](removeEntity(_0x410dbe,null))[_0x0f1e('0x4b')](handleError(_0x410dbe,null));};exports[_0x0f1e('0x56')]=function(_0x2599e4,_0x413c42,_0x5c200c){var _0x3cfca6={};var _0x12262f={};var _0x119876;var _0x687256;return db['FreshsalesAccount'][_0x0f1e('0x57')]({'where':{'id':_0x2599e4[_0x0f1e('0x55')]['id']}})[_0x0f1e('0x1e')](handleEntityNotFound(_0x413c42,null))[_0x0f1e('0x1e')](function(_0xa13a29){if(_0xa13a29){_0x119876=_0xa13a29;_0x12262f[_0x0f1e('0x3a')]=_[_0x0f1e('0x4d')](db[_0x0f1e('0x58')][_0x0f1e('0x4e')]);_0x12262f['query']=_[_0x0f1e('0x4d')](_0x2599e4[_0x0f1e('0x3b')]);_0x12262f[_0x0f1e('0x3c')]=_[_0x0f1e('0x3e')](_0x12262f[_0x0f1e('0x3a')],_0x12262f[_0x0f1e('0x3b')]);_0x3cfca6[_0x0f1e('0x3d')]=_['intersection'](_0x12262f[_0x0f1e('0x3a')],qs[_0x0f1e('0x3f')](_0x2599e4[_0x0f1e('0x3b')]['fields']));_0x3cfca6['attributes']=_0x3cfca6['attributes'][_0x0f1e('0x40')]?_0x3cfca6[_0x0f1e('0x3d')]:_0x12262f['model'];_0x3cfca6[_0x0f1e('0x59')]=qs['sort'](_0x2599e4[_0x0f1e('0x3b')]['sort']);_0x3cfca6['where']=qs['filters'](_['pick'](_0x2599e4[_0x0f1e('0x3b')],_0x12262f['filters']));if(_0x2599e4['query'][_0x0f1e('0x47')]){_0x3cfca6[_0x0f1e('0x44')]=_[_0x0f1e('0x48')](_0x3cfca6[_0x0f1e('0x44')],{'$or':_['map'](_0x3cfca6['attributes'],function(_0x2e5519){var _0x32d074={};_0x32d074[_0x2e5519]={'$like':'%'+_0x2599e4[_0x0f1e('0x3b')][_0x0f1e('0x47')]+'%'};return _0x32d074;})});}_0x3cfca6=_[_0x0f1e('0x48')]({},_0x3cfca6,_0x2599e4['options']);return _0x119876[_0x0f1e('0x56')](_0x3cfca6);}})['then'](function(_0x9a2b55){if(_0x9a2b55){_0x687256=_0x9a2b55[_0x0f1e('0x40')];if(!_0x2599e4['query'][_0x0f1e('0x41')](_0x0f1e('0x5a'))){_0x3cfca6[_0x0f1e('0x42')]=qs['limit'](_0x2599e4['query'][_0x0f1e('0x42')]);_0x3cfca6[_0x0f1e('0x2b')]=qs[_0x0f1e('0x2b')](_0x2599e4['query'][_0x0f1e('0x2b')]);}return _0x119876[_0x0f1e('0x56')](_0x3cfca6);}})['then'](function(_0x1f74d3){if(_0x1f74d3){return _0x1f74d3?{'count':_0x687256,'rows':_0x1f74d3}:null;}})[_0x0f1e('0x1e')](respondWithResult(_0x413c42,null))[_0x0f1e('0x4b')](handleError(_0x413c42,null));};exports[_0x0f1e('0x5b')]=function(_0x5a9a05,_0x5c45e9,_0x5be985){if(_0x5a9a05[_0x0f1e('0x53')]['id']){delete _0x5a9a05['body']['id'];}return db[_0x0f1e('0x36')][_0x0f1e('0x57')]({'where':{'id':_0x5a9a05[_0x0f1e('0x55')]['id']}})[_0x0f1e('0x1e')](handleEntityNotFound(_0x5c45e9,null))[_0x0f1e('0x1e')](function(_0x2d8d01){if(_0x2d8d01){_0x5a9a05[_0x0f1e('0x53')]['AccountId']=_0x2d8d01['id'];_0x5a9a05[_0x0f1e('0x53')][_0x0f1e('0x5c')]=integrations[_0x0f1e('0x5d')](_0x5a9a05[_0x0f1e('0x53')]['channel'],_0x5a9a05[_0x0f1e('0x53')][_0x0f1e('0x38')]);_0x5a9a05[_0x0f1e('0x53')][_0x0f1e('0x5e')]=integrations[_0x0f1e('0x5f')](_0x5a9a05[_0x0f1e('0x53')]['channel'],_0x5a9a05[_0x0f1e('0x53')][_0x0f1e('0x38')]);return db['FreshsalesConfiguration'][_0x0f1e('0x52')](_0x5a9a05[_0x0f1e('0x53')],{'include':[{'model':db['FreshsalesField'],'as':_0x0f1e('0x5c')},{'model':db[_0x0f1e('0x60')],'as':_0x0f1e('0x5e')}]});}return null;})['then'](respondWithResult(_0x5c45e9,null))[_0x0f1e('0x4b')](handleError(_0x5c45e9,null));};exports[_0x0f1e('0x61')]=function(_0x519594,_0x2d6bc2,_0x271201){var _0x224d08='';var _0x47a894='';return db[_0x0f1e('0x36')][_0x0f1e('0x57')]({'where':{'id':_0x519594[_0x0f1e('0x55')]['id']},'attributes':['id',_0x0f1e('0x62'),_0x0f1e('0x63'),_0x0f1e('0x64')]})[_0x0f1e('0x1e')](handleEntityNotFound(_0x2d6bc2,null))[_0x0f1e('0x1e')](function(_0x3fb658){if(_0x3fb658){_0x47a894=_0x3fb658[_0x0f1e('0x62')];_0x224d08=_0x3fb658[_0x0f1e('0x63')];var _0x5785ef=_0x3fb658['remoteUri'][_0x0f1e('0x65')](-0x1);if(_0x5785ef==='/'){_0x224d08=_0x224d08[_0x0f1e('0x66')](0x0,_0x224d08[_0x0f1e('0x67')](_0x5785ef));}return rp({'method':_0x0f1e('0x68'),'uri':util[_0x0f1e('0x69')](_0x0f1e('0x6a'),_0x224d08,_0x0f1e('0x6b')),'headers':{'Authorization':_0x0f1e('0x6c')+_0x3fb658[_0x0f1e('0x64')]},'json':!![]});}})[_0x0f1e('0x1e')](function(_0x507a3d){if(_0x507a3d){var _0x5ac4e8=_0x507a3d['users'];var _0x1919c1=![];var _0x173cc2=null;for(_0x173cc2=0x0;_0x173cc2<_0x5ac4e8[_0x0f1e('0x40')];_0x173cc2++){if(_0x5ac4e8[_0x173cc2][_0x0f1e('0x6d')]===_0x47a894){_0x1919c1=!![];}}if(_0x1919c1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0f1e('0x6e')});}}})[_0x0f1e('0x1e')](respondWithResult(_0x2d6bc2,null))['catch'](function(_0x2bebfb){var _0xcfbf0a=_0x519594[_0x0f1e('0x3b')][_0x0f1e('0x6f')]?0x1f4:_0x2bebfb[_0x0f1e('0x70')]||0x1f4;logger[_0x0f1e('0x23')](_0x0f1e('0x71'),'getFields',_0xcfbf0a,JSON['stringify'](_0x2bebfb));delete _0x2bebfb['name'];if(_0xcfbf0a===0x191){_0xcfbf0a=0x190;}_0x2d6bc2[_0x0f1e('0x28')](_0xcfbf0a)[_0x0f1e('0x33')](_0x519594[_0x0f1e('0x3b')][_0x0f1e('0x6f')]?{'message':_0x0f1e('0x72'),'statusCode':_0x2bebfb[_0x0f1e('0x70')]}:_0x2bebfb);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index c799d9d..9a7546e 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 _0x5ad3=['../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4839a2,_0x1f67eb){var _0x465147=function(_0x4eae2e){while(--_0x4eae2e){_0x4839a2['push'](_0x4839a2['shift']());}};_0x465147(++_0x1f67eb);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x217a6f,_0x3ecd8b){_0x217a6f=_0x217a6f-0x0;var _0x5553f3=_0x5ad3[_0x217a6f];return _0x5553f3;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var moment=require('moment');var BPromise=require(_0x35ad('0x4'));var rp=require(_0x35ad('0x5'));var fs=require('fs');var path=require(_0x35ad('0x6'));var rimraf=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var attributes=require(_0x35ad('0x9'));var integrations=require(_0x35ad('0xa'));module[_0x35ad('0xb')]=function(_0x36c606,_0x31cc6a){return _0x36c606['define'](_0x35ad('0xc'),attributes,{'tableName':_0x35ad('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bc3=['rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','int_freshsales_accounts','lodash','util','api','moment','request-promise','path'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x4bc3,0x16e));var _0x34bc=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x4bc3[_0x20a558];return _0x53d3f7;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var logger=require('../../config/logger')(_0x34bc('0x2'));var moment=require(_0x34bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x34bc('0x4'));var fs=require('fs');var path=require(_0x34bc('0x5'));var rimraf=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var attributes=require(_0x34bc('0x8'));var integrations=require(_0x34bc('0x9'));module[_0x34bc('0xa')]=function(_0x4c63a1,_0x21451b){return _0x4c63a1['define']('FreshsalesAccount',attributes,{'tableName':_0x34bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 3e7f685..bd69012 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 _0xd05a=['request','then','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowFreshsalesAccount','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3e653a,_0x4998c8){var _0x4bc53b=function(_0x20bd60){while(--_0x20bd60){_0x3e653a['push'](_0x3e653a['shift']());}};_0x4bc53b(++_0x4998c8);}(_0xd05a,0x143));var _0xad05=function(_0x399d40,_0x3e7056){_0x399d40=_0x399d40-0x0;var _0xd9e9f0=_0xd05a[_0x399d40];return _0xd9e9f0;};'use strict';var _=require('lodash');var util=require(_0xad05('0x0'));var moment=require(_0xad05('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xad05('0x2'));var logger=require(_0xad05('0x3'))(_0xad05('0x4'));var config=require(_0xad05('0x5'));var jayson=require(_0xad05('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39ddaf,_0x45303c,_0xd12d76){return new BPromise(function(_0x565f85,_0x17ec26){return client[_0xad05('0x7')](_0x39ddaf,_0xd12d76)[_0xad05('0x8')](function(_0x573acb){logger['info'](_0xad05('0x9'),_0x45303c,'request\x20sent');logger[_0xad05('0xa')](_0xad05('0xb'),_0x45303c,_0xad05('0xc'),JSON[_0xad05('0xd')](_0x573acb));if(_0x573acb[_0xad05('0xe')]){if(_0x573acb[_0xad05('0xe')][_0xad05('0xf')]===0x1f4){logger[_0xad05('0xe')](_0xad05('0x9'),_0x45303c,_0x573acb[_0xad05('0xe')]['message']);return _0x17ec26(_0x573acb[_0xad05('0xe')]['message']);}logger[_0xad05('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x45303c,_0x573acb[_0xad05('0xe')][_0xad05('0x10')]);return _0x565f85(_0x573acb[_0xad05('0xe')]['message']);}else{logger[_0xad05('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x45303c,_0xad05('0xc'));_0x565f85(_0x573acb[_0xad05('0x12')][_0xad05('0x10')]);}})[_0xad05('0x13')](function(_0x43ab03){logger[_0xad05('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x45303c,_0x43ab03);_0x17ec26(_0x43ab03);});});}exports[_0xad05('0x14')]=function(_0x6c363b){var _0x9dc4d3=this;return new Promise(function(_0x3ef8c1,_0x1c9e62){return db[_0xad05('0x15')][_0xad05('0x16')]({'raw':_0x6c363b[_0xad05('0x17')]?_0x6c363b[_0xad05('0x17')][_0xad05('0x18')]===undefined?!![]:![]:!![],'where':_0x6c363b[_0xad05('0x17')]?_0x6c363b['options'][_0xad05('0x19')]||null:null,'attributes':_0x6c363b[_0xad05('0x17')]?_0x6c363b[_0xad05('0x17')]['attributes']||null:null,'limit':_0x6c363b[_0xad05('0x17')]?_0x6c363b['options'][_0xad05('0x1a')]||null:null,'include':_0x6c363b[_0xad05('0x17')]?_0x6c363b[_0xad05('0x17')][_0xad05('0x1b')]?_[_0xad05('0x1c')](_0x6c363b[_0xad05('0x17')][_0xad05('0x1b')],function(_0x2020d7){return{'model':db[_0x2020d7[_0xad05('0x1d')]],'as':_0x2020d7['as'],'attributes':_0x2020d7[_0xad05('0x1e')],'include':_0x2020d7['include']?_[_0xad05('0x1c')](_0x2020d7[_0xad05('0x1b')],function(_0x2a4620){return{'model':db[_0x2a4620[_0xad05('0x1d')]],'as':_0x2a4620['as'],'attributes':_0x2a4620['attributes'],'include':_0x2a4620[_0xad05('0x1b')]?_[_0xad05('0x1c')](_0x2a4620[_0xad05('0x1b')],function(_0x96b484){return{'model':db[_0x96b484[_0xad05('0x1d')]],'as':_0x96b484['as'],'attributes':_0x96b484[_0xad05('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xad05('0x8')](function(_0x5c04f3){logger['info'](_0xad05('0x14'),_0x6c363b);logger[_0xad05('0xa')](_0xad05('0x14'),_0x6c363b,JSON['stringify'](_0x5c04f3));_0x3ef8c1(_0x5c04f3);})['catch'](function(_0x30624d){logger[_0xad05('0xe')](_0xad05('0x14'),_0x30624d['message'],_0x6c363b);_0x1c9e62(_0x9dc4d3[_0xad05('0xe')](0x1f4,_0x30624d[_0xad05('0x10')]));});});};exports['ShowFreshsalesAccount']=function(_0x206a17){var _0x19b9f1=this;return new Promise(function(_0x203158,_0x36face){return db[_0xad05('0x15')][_0xad05('0x1f')]({'raw':_0x206a17[_0xad05('0x17')]?_0x206a17['options'][_0xad05('0x18')]===undefined?!![]:![]:!![],'where':_0x206a17[_0xad05('0x17')]?_0x206a17['options'][_0xad05('0x19')]||null:null,'attributes':_0x206a17[_0xad05('0x17')]?_0x206a17['options'][_0xad05('0x1e')]||null:null,'include':_0x206a17[_0xad05('0x17')]?_0x206a17[_0xad05('0x17')][_0xad05('0x1b')]?_[_0xad05('0x1c')](_0x206a17[_0xad05('0x17')][_0xad05('0x1b')],function(_0x2ab56d){return{'model':db[_0x2ab56d[_0xad05('0x1d')]],'as':_0x2ab56d['as'],'attributes':_0x2ab56d[_0xad05('0x1e')],'include':_0x2ab56d[_0xad05('0x1b')]?_['map'](_0x2ab56d['include'],function(_0x49ae8a){return{'model':db[_0x49ae8a['model']],'as':_0x49ae8a['as'],'attributes':_0x49ae8a[_0xad05('0x1e')],'include':_0x49ae8a[_0xad05('0x1b')]?_[_0xad05('0x1c')](_0x49ae8a[_0xad05('0x1b')],function(_0x5ac92d){return{'model':db[_0x5ac92d[_0xad05('0x1d')]],'as':_0x5ac92d['as'],'attributes':_0x5ac92d[_0xad05('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xad05('0x8')](function(_0x444a4f){logger['info'](_0xad05('0x20'),_0x206a17);logger['debug'](_0xad05('0x20'),_0x206a17,JSON[_0xad05('0xd')](_0x444a4f));_0x203158(_0x444a4f);})[_0xad05('0x13')](function(_0x485081){logger[_0xad05('0xe')](_0xad05('0x20'),_0x485081[_0xad05('0x10')],_0x206a17);_0x36face(_0x19b9f1[_0xad05('0xe')](0x1f4,_0x485081[_0xad05('0x10')]));});});}; \ No newline at end of file +var _0x5ea2=['client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','limit','include','attributes','model','map','find','raw','ShowFreshsalesAccount','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x15852b,_0xe912b5){var _0x440508=function(_0xf417da){while(--_0xf417da){_0x15852b['push'](_0x15852b['shift']());}};_0x440508(++_0xe912b5);}(_0x5ea2,0x99));var _0x25ea=function(_0xbd5396,_0x1e2044){_0xbd5396=_0xbd5396-0x0;var _0x38853e=_0x5ea2[_0xbd5396];return _0x38853e;};'use strict';var _=require(_0x25ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x25ea('0x1'));var rs=require(_0x25ea('0x2'));var fs=require('fs');var Redis=require(_0x25ea('0x3'));var db=require(_0x25ea('0x4'))['db'];var utils=require(_0x25ea('0x5'));var logger=require('../../config/logger')(_0x25ea('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25ea('0x7')][_0x25ea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ca48f,_0x214ed8,_0x274f48){return new BPromise(function(_0x254d54,_0x1c5b5d){return client[_0x25ea('0x9')](_0x3ca48f,_0x274f48)[_0x25ea('0xa')](function(_0x52b281){logger[_0x25ea('0xb')](_0x25ea('0xc'),_0x214ed8,_0x25ea('0xd'));logger[_0x25ea('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x214ed8,_0x25ea('0xd'),JSON[_0x25ea('0xf')](_0x52b281));if(_0x52b281[_0x25ea('0x10')]){if(_0x52b281[_0x25ea('0x10')][_0x25ea('0x11')]===0x1f4){logger[_0x25ea('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x214ed8,_0x52b281['error'][_0x25ea('0x12')]);return _0x1c5b5d(_0x52b281[_0x25ea('0x10')]['message']);}logger[_0x25ea('0x10')](_0x25ea('0xc'),_0x214ed8,_0x52b281[_0x25ea('0x10')][_0x25ea('0x12')]);return _0x254d54(_0x52b281[_0x25ea('0x10')][_0x25ea('0x12')]);}else{logger['info'](_0x25ea('0xc'),_0x214ed8,_0x25ea('0xd'));_0x254d54(_0x52b281['result'][_0x25ea('0x12')]);}})[_0x25ea('0x13')](function(_0x111c5b){logger[_0x25ea('0x10')](_0x25ea('0xc'),_0x214ed8,_0x111c5b);_0x1c5b5d(_0x111c5b);});});}exports[_0x25ea('0x14')]=function(_0x586d4d){var _0x29878b=this;return new Promise(function(_0x454b8e,_0x3b327e){return db[_0x25ea('0x15')][_0x25ea('0x16')]({'raw':_0x586d4d[_0x25ea('0x17')]?_0x586d4d[_0x25ea('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x586d4d[_0x25ea('0x17')]?_0x586d4d[_0x25ea('0x17')]['where']||null:null,'attributes':_0x586d4d[_0x25ea('0x17')]?_0x586d4d['options']['attributes']||null:null,'limit':_0x586d4d[_0x25ea('0x17')]?_0x586d4d['options'][_0x25ea('0x18')]||null:null,'include':_0x586d4d[_0x25ea('0x17')]?_0x586d4d[_0x25ea('0x17')][_0x25ea('0x19')]?_['map'](_0x586d4d[_0x25ea('0x17')][_0x25ea('0x19')],function(_0xf34d84){return{'model':db[_0xf34d84['model']],'as':_0xf34d84['as'],'attributes':_0xf34d84[_0x25ea('0x1a')],'include':_0xf34d84[_0x25ea('0x19')]?_['map'](_0xf34d84[_0x25ea('0x19')],function(_0x2b5351){return{'model':db[_0x2b5351[_0x25ea('0x1b')]],'as':_0x2b5351['as'],'attributes':_0x2b5351[_0x25ea('0x1a')],'include':_0x2b5351[_0x25ea('0x19')]?_[_0x25ea('0x1c')](_0x2b5351[_0x25ea('0x19')],function(_0x20c65b){return{'model':db[_0x20c65b[_0x25ea('0x1b')]],'as':_0x20c65b['as'],'attributes':_0x20c65b[_0x25ea('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x25ea('0xa')](function(_0x12e061){logger[_0x25ea('0xb')](_0x25ea('0x14'),_0x586d4d);logger[_0x25ea('0xe')](_0x25ea('0x14'),_0x586d4d,JSON['stringify'](_0x12e061));_0x454b8e(_0x12e061);})['catch'](function(_0x3599c3){logger[_0x25ea('0x10')]('GetFreshsalesAccount',_0x3599c3[_0x25ea('0x12')],_0x586d4d);_0x3b327e(_0x29878b[_0x25ea('0x10')](0x1f4,_0x3599c3[_0x25ea('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x54459c){var _0x9b5919=this;return new Promise(function(_0x2a71aa,_0x51e3ee){return db[_0x25ea('0x15')][_0x25ea('0x1d')]({'raw':_0x54459c['options']?_0x54459c[_0x25ea('0x17')][_0x25ea('0x1e')]===undefined?!![]:![]:!![],'where':_0x54459c[_0x25ea('0x17')]?_0x54459c[_0x25ea('0x17')]['where']||null:null,'attributes':_0x54459c[_0x25ea('0x17')]?_0x54459c['options'][_0x25ea('0x1a')]||null:null,'include':_0x54459c[_0x25ea('0x17')]?_0x54459c[_0x25ea('0x17')][_0x25ea('0x19')]?_['map'](_0x54459c['options'][_0x25ea('0x19')],function(_0x4bed9e){return{'model':db[_0x4bed9e[_0x25ea('0x1b')]],'as':_0x4bed9e['as'],'attributes':_0x4bed9e[_0x25ea('0x1a')],'include':_0x4bed9e['include']?_[_0x25ea('0x1c')](_0x4bed9e['include'],function(_0x54e37c){return{'model':db[_0x54e37c[_0x25ea('0x1b')]],'as':_0x54e37c['as'],'attributes':_0x54e37c[_0x25ea('0x1a')],'include':_0x54e37c[_0x25ea('0x19')]?_[_0x25ea('0x1c')](_0x54e37c[_0x25ea('0x19')],function(_0x22ea49){return{'model':db[_0x22ea49['model']],'as':_0x22ea49['as'],'attributes':_0x22ea49['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1da04e){logger[_0x25ea('0xb')](_0x25ea('0x1f'),_0x54459c);logger[_0x25ea('0xe')](_0x25ea('0x1f'),_0x54459c,JSON['stringify'](_0x1da04e));_0x2a71aa(_0x1da04e);})[_0x25ea('0x13')](function(_0x2ecbf8){logger[_0x25ea('0x10')](_0x25ea('0x1f'),_0x2ecbf8[_0x25ea('0x12')],_0x54459c);_0x51e3ee(_0x9b5919['error'](0x1f4,_0x2ecbf8[_0x25ea('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 8d66fd0..daea7ab 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 _0x086d=['express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','/:id/fields','getFields','post','put','update','destroy','exports','util','path','connect-timeout'];(function(_0xb357e2,_0x2ea5cd){var _0x30b79a=function(_0x5b03c4){while(--_0x5b03c4){_0xb357e2['push'](_0xb357e2['shift']());}};_0x30b79a(++_0x2ea5cd);}(_0x086d,0xa5));var _0xd086=function(_0x138f12,_0x4b87ec){_0x138f12=_0x138f12-0x0;var _0x29eeae=_0x086d[_0x138f12];return _0x29eeae;};'use strict';var multer=require('multer');var util=require(_0xd086('0x0'));var path=require(_0xd086('0x1'));var timeout=require(_0xd086('0x2'));var express=require(_0xd086('0x3'));var router=express[_0xd086('0x4')]();var auth=require(_0xd086('0x5'));var interaction=require(_0xd086('0x6'));var config=require('../../config/environment');var controller=require(_0xd086('0x7'));router[_0xd086('0x8')]('/',auth[_0xd086('0x9')](),controller[_0xd086('0xa')]);router[_0xd086('0x8')](_0xd086('0xb'),auth[_0xd086('0x9')](),controller[_0xd086('0xc')]);router[_0xd086('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xd086('0xd')]);router[_0xd086('0x8')]('/:id/descriptions',auth[_0xd086('0x9')](),controller['getDescriptions']);router[_0xd086('0x8')](_0xd086('0xe'),auth[_0xd086('0x9')](),controller[_0xd086('0xf')]);router[_0xd086('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd086('0x11')](_0xd086('0xb'),auth['isAuthenticated'](),controller[_0xd086('0x12')]);router['delete']('/:id',auth[_0xd086('0x9')](),controller[_0xd086('0x13')]);module[_0xd086('0x14')]=router; \ No newline at end of file +var _0x7f39=['create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSubjects','/:id/fields','getFields','post'];(function(_0x30270c,_0x54e186){var _0x17cc89=function(_0x2d31d5){while(--_0x2d31d5){_0x30270c['push'](_0x30270c['shift']());}};_0x17cc89(++_0x54e186);}(_0x7f39,0xcb));var _0x97f3=function(_0x466e89,_0x237ae3){_0x466e89=_0x466e89-0x0;var _0x580986=_0x7f39[_0x466e89];return _0x580986;};'use strict';var multer=require(_0x97f3('0x0'));var util=require(_0x97f3('0x1'));var path=require('path');var timeout=require(_0x97f3('0x2'));var express=require(_0x97f3('0x3'));var router=express[_0x97f3('0x4')]();var auth=require(_0x97f3('0x5'));var interaction=require(_0x97f3('0x6'));var config=require(_0x97f3('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x97f3('0x8')]('/',auth[_0x97f3('0x9')](),controller[_0x97f3('0xa')]);router[_0x97f3('0x8')](_0x97f3('0xb'),auth[_0x97f3('0x9')](),controller[_0x97f3('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x97f3('0xd')]);router[_0x97f3('0x8')]('/:id/descriptions',auth[_0x97f3('0x9')](),controller['getDescriptions']);router[_0x97f3('0x8')](_0x97f3('0xe'),auth[_0x97f3('0x9')](),controller[_0x97f3('0xf')]);router[_0x97f3('0x10')]('/',auth[_0x97f3('0x9')](),controller[_0x97f3('0x11')]);router['put'](_0x97f3('0xb'),auth[_0x97f3('0x9')](),controller[_0x97f3('0x12')]);router[_0x97f3('0x13')](_0x97f3('0xb'),auth[_0x97f3('0x9')](),controller[_0x97f3('0x14')]);module[_0x97f3('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 cd54f58..31d6e14 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 _0xfdb8=['STRING'];(function(_0x340ae7,_0x173679){var _0x2aa6c6=function(_0x32d168){while(--_0x32d168){_0x340ae7['push'](_0x340ae7['shift']());}};_0x2aa6c6(++_0x173679);}(_0xfdb8,0x1e1));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8fdb('0x0')]},'description':{'type':Sequelize[_0x8fdb('0x0')]}}; \ No newline at end of file +var _0xc2ae=['STRING','sequelize','exports'];(function(_0x3aeb17,_0x2fb375){var _0x3e4ac3=function(_0x2ef73e){while(--_0x2ef73e){_0x3aeb17['push'](_0x3aeb17['shift']());}};_0x3e4ac3(++_0x2fb375);}(_0xc2ae,0x184));var _0xec2a=function(_0x44cb05,_0x260296){_0x44cb05=_0x44cb05-0x0;var _0x1f3e80=_0xc2ae[_0x44cb05];return _0x1f3e80;};'use strict';var Sequelize=require(_0xec2a('0x0'));module[_0xec2a('0x1')]={'name':{'type':Sequelize[_0xec2a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 9c580ec..dccae20 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 _0x5a24=['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','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','count','offset','limit','set','Content-Range','apply','reject','then','destroy','sendStatus','stack','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','name','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','rows','keys','include','find','catch','create','body','update','params','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb'];(function(_0x2d9ee5,_0x5019b8){var _0x3e2ba2=function(_0x6573f5){while(--_0x6573f5){_0x2d9ee5['push'](_0x2d9ee5['shift']());}};_0x3e2ba2(++_0x5019b8);}(_0x5a24,0x1c1));var _0x45a2=function(_0x178216,_0x3e916e){_0x178216=_0x178216-0x0;var _0x4ce231=_0x5a24[_0x178216];return _0x4ce231;};'use strict';var pdf=require(_0x45a2('0x0'));var emlformat=require(_0x45a2('0x1'));var rimraf=require(_0x45a2('0x2'));var zipdir=require(_0x45a2('0x3'));var jsonpatch=require(_0x45a2('0x4'));var rp=require('request-promise');var moment=require(_0x45a2('0x5'));var BPromise=require(_0x45a2('0x6'));var Mustache=require(_0x45a2('0x7'));var util=require(_0x45a2('0x8'));var path=require(_0x45a2('0x9'));var sox=require(_0x45a2('0xa'));var csv=require(_0x45a2('0xb'));var ejs=require(_0x45a2('0xc'));var fs=require('fs');var _=require(_0x45a2('0xd'));var squel=require('squel');var crypto=require(_0x45a2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x45a2('0xf'));var toCsv=require(_0x45a2('0xb'));var querystring=require(_0x45a2('0x10'));var Papa=require(_0x45a2('0x11'));var Redis=require(_0x45a2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x45a2('0x13'));var as=require(_0x45a2('0x14'));var hardwareService=require(_0x45a2('0x15'));var logger=require(_0x45a2('0x16'))(_0x45a2('0x17'));var utils=require(_0x45a2('0x18'));var config=require('../../config/environment');var db=require(_0x45a2('0x19'))['db'];var jayson=require(_0x45a2('0x1a'));var client=jayson['client'][_0x45a2('0x1b')]({'port':0x232a});function checkPasswordPattern(_0xa5db23,_0x40c7a5,_0x19d46c){if(_0x19d46c){var _0x20a39d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20a39d[_0x45a2('0x1c')](_0x40c7a5)){return _0xa5db23;}else{throw new db[(_0x45a2('0x1d'))][(_0x45a2('0x1e'))](_0x45a2('0x1f'));}}else{return _0xa5db23;}}function respondWithRpcPromise(_0xa58ef1,_0x1a6ed2,_0x327053,_0x269e61){return new BPromise(function(_0x517a4b,_0x5aa577){var _0x5d221f=_0x269e61||client;return _0x5d221f[_0x45a2('0x20')](_0xa58ef1,_0x327053)['then'](function(_0x9b5b7d){logger[_0x45a2('0x21')](_0x45a2('0x22'),_0x1a6ed2,_0x45a2('0x23'));logger[_0x45a2('0x24')](_0x45a2('0x25'),_0x1a6ed2,_0x45a2('0x23'),JSON[_0x45a2('0x26')](_0x9b5b7d));if(_0x9b5b7d[_0x45a2('0x27')]){if(_0x9b5b7d['error'][_0x45a2('0x28')]===0x1f4){logger[_0x45a2('0x27')](_0x45a2('0x22'),_0x1a6ed2,_0x9b5b7d[_0x45a2('0x27')][_0x45a2('0x29')]);return _0x5aa577(_0x9b5b7d['error'][_0x45a2('0x29')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1a6ed2,_0x9b5b7d[_0x45a2('0x27')][_0x45a2('0x29')]);return _0x517a4b(_0x9b5b7d[_0x45a2('0x27')][_0x45a2('0x29')]);}else{logger[_0x45a2('0x21')](_0x45a2('0x22'),_0x1a6ed2,_0x45a2('0x23'));_0x517a4b(_0x9b5b7d[_0x45a2('0x2a')][_0x45a2('0x29')]);}})['catch'](function(_0x48c194){logger[_0x45a2('0x27')](_0x45a2('0x22'),_0x1a6ed2,_0x48c194);_0x5aa577(_0x48c194);});});}function respondWithStatusCode(_0x3a5ce2,_0x2e6367){_0x2e6367=_0x2e6367||0xcc;return function(_0x4c41bf){if(_0x4c41bf){return _0x3a5ce2['sendStatus'](_0x2e6367);}return _0x3a5ce2[_0x45a2('0x2b')](_0x2e6367)[_0x45a2('0x2c')]();};}function respondWithResult(_0x92705f,_0x1e1740){_0x1e1740=_0x1e1740||0xc8;return function(_0x2fa296){if(_0x2fa296){return _0x92705f[_0x45a2('0x2b')](_0x1e1740)['json'](_0x2fa296);}};}function respondWithFilteredResult(_0x301883,_0x50174f){return function(_0x44b9f5){if(_0x44b9f5){var _0x1a041f=_0x44b9f5[_0x45a2('0x2d')],_0x3b41df=_0x50174f['offset'],_0x15f978=_0x50174f[_0x45a2('0x2e')]+_0x50174f[_0x45a2('0x2f')],_0x38fdd7;if(_0x15f978>=_0x1a041f){_0x15f978=_0x1a041f;_0x38fdd7=0xc8;}else{_0x38fdd7=0xce;}_0x301883[_0x45a2('0x2b')](_0x38fdd7);return _0x301883[_0x45a2('0x30')](_0x45a2('0x31'),_0x3b41df+'-'+_0x15f978+'/'+_0x1a041f)['json'](_0x44b9f5);}return null;};}function patchUpdates(_0x505d65){return function(_0x4e6b8d){try{jsonpatch[_0x45a2('0x32')](_0x4e6b8d,_0x505d65,!![]);}catch(_0x49762a){return BPromise[_0x45a2('0x33')](_0x49762a);}return _0x4e6b8d['save']();};}function saveUpdates(_0xb31dd7,_0x65854f){return function(_0x42252a){if(_0x42252a){return _0x42252a['update'](_0xb31dd7)[_0x45a2('0x34')](function(_0x16ad2d){return _0x16ad2d;});}return null;};}function removeEntity(_0x50e84c,_0x219d01){return function(_0x56b2d9){if(_0x56b2d9){return _0x56b2d9[_0x45a2('0x35')]()[_0x45a2('0x34')](function(){_0x50e84c[_0x45a2('0x2b')](0xcc)[_0x45a2('0x2c')]();});}};}function handleEntityNotFound(_0x13f845,_0x1d2f06){return function(_0x1e46de){if(!_0x1e46de){_0x13f845[_0x45a2('0x36')](0x194);}return _0x1e46de;};}function handleError(_0x1eb19a,_0x3919e4){_0x3919e4=_0x3919e4||0x1f4;return function(_0x5cc405){logger[_0x45a2('0x27')](_0x5cc405[_0x45a2('0x37')]);if(_0x5cc405['name']){delete _0x5cc405['name'];}_0x1eb19a[_0x45a2('0x2b')](_0x3919e4)[_0x45a2('0x38')](_0x5cc405);};}exports[_0x45a2('0x39')]=function(_0xb1a33a,_0x37fa6c){var _0x117aba={},_0x29d9d4={},_0x5dcc75={'count':0x0,'rows':[]};var _0x3059f8=_[_0x45a2('0x3a')](db[_0x45a2('0x3b')][_0x45a2('0x3c')],function(_0x139209){return{'name':_0x139209['fieldName'],'type':_0x139209[_0x45a2('0x3d')][_0x45a2('0x3e')]};});_0x29d9d4[_0x45a2('0x3f')]=_['map'](_0x3059f8,_0x45a2('0x40'));_0x29d9d4[_0x45a2('0x41')]=_['keys'](_0xb1a33a[_0x45a2('0x41')]);_0x29d9d4[_0x45a2('0x42')]=_[_0x45a2('0x43')](_0x29d9d4[_0x45a2('0x3f')],_0x29d9d4[_0x45a2('0x41')]);_0x117aba['attributes']=_['intersection'](_0x29d9d4['model'],qs[_0x45a2('0x44')](_0xb1a33a['query']['fields']));_0x117aba[_0x45a2('0x45')]=_0x117aba['attributes'][_0x45a2('0x46')]?_0x117aba[_0x45a2('0x45')]:_0x29d9d4[_0x45a2('0x3f')];if(!_0xb1a33a[_0x45a2('0x41')]['hasOwnProperty'](_0x45a2('0x47'))){_0x117aba[_0x45a2('0x2f')]=qs[_0x45a2('0x2f')](_0xb1a33a[_0x45a2('0x41')][_0x45a2('0x2f')]);_0x117aba[_0x45a2('0x2e')]=qs[_0x45a2('0x2e')](_0xb1a33a[_0x45a2('0x41')][_0x45a2('0x2e')]);}_0x117aba[_0x45a2('0x48')]=qs[_0x45a2('0x49')](_0xb1a33a['query']['sort']);_0x117aba['where']=qs[_0x45a2('0x42')](_[_0x45a2('0x4a')](_0xb1a33a[_0x45a2('0x41')],_0x29d9d4[_0x45a2('0x42')]),_0x3059f8);if(_0xb1a33a[_0x45a2('0x41')][_0x45a2('0x4b')]){_0x117aba[_0x45a2('0x4c')]=_['merge'](_0x117aba[_0x45a2('0x4c')],{'$or':_[_0x45a2('0x3a')](_0x3059f8,function(_0x37f826){if(_0x37f826[_0x45a2('0x3d')]!==_0x45a2('0x4d')){var _0x56c65d={};_0x56c65d[_0x37f826[_0x45a2('0x40')]]={'$like':'%'+_0xb1a33a[_0x45a2('0x41')][_0x45a2('0x4b')]+'%'};return _0x56c65d;}})});}_0x117aba=_[_0x45a2('0x4e')]({},_0x117aba,_0xb1a33a[_0x45a2('0x4f')]);var _0x3c9432={'where':_0x117aba[_0x45a2('0x4c')]};return db[_0x45a2('0x3b')][_0x45a2('0x2d')](_0x3c9432)[_0x45a2('0x34')](function(_0x5d454a){_0x5dcc75[_0x45a2('0x2d')]=_0x5d454a;if(_0xb1a33a[_0x45a2('0x41')]['includeAll']){_0x117aba['include']=[{'all':!![]}];}return db[_0x45a2('0x3b')]['findAll'](_0x117aba);})[_0x45a2('0x34')](function(_0xbabd5){_0x5dcc75[_0x45a2('0x50')]=_0xbabd5;return _0x5dcc75;})['then'](respondWithFilteredResult(_0x37fa6c,_0x117aba))['catch'](handleError(_0x37fa6c,null));};exports['show']=function(_0x22a443,_0x1baeba){var _0x3a7f29={'raw':![],'where':{'id':_0x22a443['params']['id']}},_0x44a8a7={};_0x44a8a7[_0x45a2('0x3f')]=_[_0x45a2('0x51')](db[_0x45a2('0x3b')][_0x45a2('0x3c')]);_0x44a8a7[_0x45a2('0x41')]=_['keys'](_0x22a443['query']);_0x44a8a7[_0x45a2('0x42')]=_['intersection'](_0x44a8a7[_0x45a2('0x3f')],_0x44a8a7[_0x45a2('0x41')]);_0x3a7f29[_0x45a2('0x45')]=_[_0x45a2('0x43')](_0x44a8a7[_0x45a2('0x3f')],qs[_0x45a2('0x44')](_0x22a443[_0x45a2('0x41')]['fields']));_0x3a7f29[_0x45a2('0x45')]=_0x3a7f29['attributes']['length']?_0x3a7f29['attributes']:_0x44a8a7[_0x45a2('0x3f')];if(_0x22a443[_0x45a2('0x41')]['includeAll']){_0x3a7f29[_0x45a2('0x52')]=[{'all':!![]}];}_0x3a7f29=_[_0x45a2('0x4e')]({},_0x3a7f29,_0x22a443[_0x45a2('0x4f')]);return db[_0x45a2('0x3b')][_0x45a2('0x53')](_0x3a7f29)[_0x45a2('0x34')](handleEntityNotFound(_0x1baeba,null))[_0x45a2('0x34')](respondWithResult(_0x1baeba,null))[_0x45a2('0x54')](handleError(_0x1baeba,null));};exports[_0x45a2('0x55')]=function(_0x277e95,_0x3fb31a){return db[_0x45a2('0x3b')][_0x45a2('0x55')](_0x277e95[_0x45a2('0x56')],{})[_0x45a2('0x34')](respondWithResult(_0x3fb31a,0xc9))[_0x45a2('0x54')](handleError(_0x3fb31a,null));};exports[_0x45a2('0x57')]=function(_0x43b687,_0x3f8e42){if(_0x43b687[_0x45a2('0x56')]['id']){delete _0x43b687[_0x45a2('0x56')]['id'];}return db[_0x45a2('0x3b')][_0x45a2('0x53')]({'where':{'id':_0x43b687[_0x45a2('0x58')]['id']}})[_0x45a2('0x34')](handleEntityNotFound(_0x3f8e42,null))['then'](saveUpdates(_0x43b687[_0x45a2('0x56')],null))[_0x45a2('0x34')](respondWithResult(_0x3f8e42,null))[_0x45a2('0x54')](handleError(_0x3f8e42,null));};exports['destroy']=function(_0x48da42,_0x2eb4d0){return db[_0x45a2('0x3b')][_0x45a2('0x53')]({'where':{'id':_0x48da42[_0x45a2('0x58')]['id']}})[_0x45a2('0x34')](handleEntityNotFound(_0x2eb4d0,null))[_0x45a2('0x34')](removeEntity(_0x2eb4d0,null))[_0x45a2('0x54')](handleError(_0x2eb4d0,null));};exports[_0x45a2('0x59')]=function(_0x2f9555,_0x587d29,_0x52c465){var _0x2eaf0d={};var _0x3bdefa={};var _0xccf193;var _0x4a3307;return db[_0x45a2('0x3b')][_0x45a2('0x5a')]({'where':{'id':_0x2f9555[_0x45a2('0x58')]['id']}})[_0x45a2('0x34')](handleEntityNotFound(_0x587d29,null))['then'](function(_0x74114e){if(_0x74114e){_0xccf193=_0x74114e;_0x3bdefa[_0x45a2('0x3f')]=_[_0x45a2('0x51')](db[_0x45a2('0x5b')][_0x45a2('0x3c')]);_0x3bdefa[_0x45a2('0x41')]=_[_0x45a2('0x51')](_0x2f9555[_0x45a2('0x41')]);_0x3bdefa[_0x45a2('0x42')]=_[_0x45a2('0x43')](_0x3bdefa[_0x45a2('0x3f')],_0x3bdefa['query']);_0x2eaf0d[_0x45a2('0x45')]=_[_0x45a2('0x43')](_0x3bdefa['model'],qs[_0x45a2('0x44')](_0x2f9555[_0x45a2('0x41')]['fields']));_0x2eaf0d[_0x45a2('0x45')]=_0x2eaf0d['attributes'][_0x45a2('0x46')]?_0x2eaf0d[_0x45a2('0x45')]:_0x3bdefa[_0x45a2('0x3f')];_0x2eaf0d['order']=qs['sort'](_0x2f9555[_0x45a2('0x41')]['sort']);_0x2eaf0d[_0x45a2('0x4c')]=qs[_0x45a2('0x42')](_[_0x45a2('0x4a')](_0x2f9555[_0x45a2('0x41')],_0x3bdefa[_0x45a2('0x42')]));if(_0x2f9555['query'][_0x45a2('0x4b')]){_0x2eaf0d[_0x45a2('0x4c')]=_[_0x45a2('0x4e')](_0x2eaf0d[_0x45a2('0x4c')],{'$or':_['map'](_0x2eaf0d['attributes'],function(_0x793688){var _0x896fa9={};_0x896fa9[_0x793688]={'$like':'%'+_0x2f9555[_0x45a2('0x41')]['filter']+'%'};return _0x896fa9;})});}_0x2eaf0d=_[_0x45a2('0x4e')]({},_0x2eaf0d,_0x2f9555[_0x45a2('0x4f')]);return _0xccf193[_0x45a2('0x59')](_0x2eaf0d);}})[_0x45a2('0x34')](function(_0x352a76){if(_0x352a76){_0x4a3307=_0x352a76[_0x45a2('0x46')];if(!_0x2f9555[_0x45a2('0x41')][_0x45a2('0x5c')](_0x45a2('0x47'))){_0x2eaf0d[_0x45a2('0x2f')]=qs[_0x45a2('0x2f')](_0x2f9555[_0x45a2('0x41')][_0x45a2('0x2f')]);_0x2eaf0d[_0x45a2('0x2e')]=qs[_0x45a2('0x2e')](_0x2f9555['query'][_0x45a2('0x2e')]);}return _0xccf193[_0x45a2('0x59')](_0x2eaf0d);}})[_0x45a2('0x34')](function(_0x543485){if(_0x543485){return _0x543485?{'count':_0x4a3307,'rows':_0x543485}:null;}})['then'](respondWithResult(_0x587d29,null))[_0x45a2('0x54')](handleError(_0x587d29,null));};exports['getDescriptions']=function(_0xb177ba,_0x2761ca,_0x57c426){var _0x171068={};var _0x545843={};var _0x88c232;var _0x56bc50;return db[_0x45a2('0x3b')][_0x45a2('0x5a')]({'where':{'id':_0xb177ba['params']['id']}})[_0x45a2('0x34')](handleEntityNotFound(_0x2761ca,null))['then'](function(_0x1d4221){if(_0x1d4221){_0x88c232=_0x1d4221;_0x545843[_0x45a2('0x3f')]=_[_0x45a2('0x51')](db[_0x45a2('0x5b')][_0x45a2('0x3c')]);_0x545843[_0x45a2('0x41')]=_[_0x45a2('0x51')](_0xb177ba[_0x45a2('0x41')]);_0x545843[_0x45a2('0x42')]=_[_0x45a2('0x43')](_0x545843[_0x45a2('0x3f')],_0x545843['query']);_0x171068[_0x45a2('0x45')]=_[_0x45a2('0x43')](_0x545843[_0x45a2('0x3f')],qs[_0x45a2('0x44')](_0xb177ba[_0x45a2('0x41')][_0x45a2('0x44')]));_0x171068[_0x45a2('0x45')]=_0x171068['attributes'][_0x45a2('0x46')]?_0x171068['attributes']:_0x545843[_0x45a2('0x3f')];_0x171068['order']=qs[_0x45a2('0x49')](_0xb177ba[_0x45a2('0x41')][_0x45a2('0x49')]);_0x171068['where']=qs['filters'](_[_0x45a2('0x4a')](_0xb177ba[_0x45a2('0x41')],_0x545843[_0x45a2('0x42')]));if(_0xb177ba[_0x45a2('0x41')][_0x45a2('0x4b')]){_0x171068[_0x45a2('0x4c')]=_[_0x45a2('0x4e')](_0x171068[_0x45a2('0x4c')],{'$or':_[_0x45a2('0x3a')](_0x171068[_0x45a2('0x45')],function(_0x386c0f){var _0x5e540f={};_0x5e540f[_0x386c0f]={'$like':'%'+_0xb177ba[_0x45a2('0x41')][_0x45a2('0x4b')]+'%'};return _0x5e540f;})});}_0x171068=_[_0x45a2('0x4e')]({},_0x171068,_0xb177ba[_0x45a2('0x4f')]);return _0x88c232[_0x45a2('0x5d')](_0x171068);}})[_0x45a2('0x34')](function(_0x16413a){if(_0x16413a){_0x56bc50=_0x16413a[_0x45a2('0x46')];if(!_0xb177ba[_0x45a2('0x41')][_0x45a2('0x5c')](_0x45a2('0x47'))){_0x171068[_0x45a2('0x2f')]=qs[_0x45a2('0x2f')](_0xb177ba[_0x45a2('0x41')][_0x45a2('0x2f')]);_0x171068[_0x45a2('0x2e')]=qs['offset'](_0xb177ba['query'][_0x45a2('0x2e')]);}return _0x88c232['getDescriptions'](_0x171068);}})[_0x45a2('0x34')](function(_0x3729d8){if(_0x3729d8){return _0x3729d8?{'count':_0x56bc50,'rows':_0x3729d8}:null;}})[_0x45a2('0x34')](respondWithResult(_0x2761ca,null))[_0x45a2('0x54')](handleError(_0x2761ca,null));};exports[_0x45a2('0x5e')]=function(_0x51fcfa,_0x8bd586,_0x322030){var _0x4e5f2b={};var _0x2d2c17={};var _0x253e95;var _0x2d8200;return db[_0x45a2('0x3b')][_0x45a2('0x5a')]({'where':{'id':_0x51fcfa['params']['id']}})[_0x45a2('0x34')](handleEntityNotFound(_0x8bd586,null))[_0x45a2('0x34')](function(_0x4da9a7){if(_0x4da9a7){_0x253e95=_0x4da9a7;_0x2d2c17[_0x45a2('0x3f')]=_[_0x45a2('0x51')](db[_0x45a2('0x5b')]['rawAttributes']);_0x2d2c17[_0x45a2('0x41')]=_[_0x45a2('0x51')](_0x51fcfa[_0x45a2('0x41')]);_0x2d2c17[_0x45a2('0x42')]=_[_0x45a2('0x43')](_0x2d2c17[_0x45a2('0x3f')],_0x2d2c17['query']);_0x4e5f2b[_0x45a2('0x45')]=_[_0x45a2('0x43')](_0x2d2c17[_0x45a2('0x3f')],qs[_0x45a2('0x44')](_0x51fcfa[_0x45a2('0x41')][_0x45a2('0x44')]));_0x4e5f2b[_0x45a2('0x45')]=_0x4e5f2b[_0x45a2('0x45')][_0x45a2('0x46')]?_0x4e5f2b[_0x45a2('0x45')]:_0x2d2c17['model'];_0x4e5f2b[_0x45a2('0x48')]=qs[_0x45a2('0x49')](_0x51fcfa['query'][_0x45a2('0x49')]);_0x4e5f2b[_0x45a2('0x4c')]=qs[_0x45a2('0x42')](_[_0x45a2('0x4a')](_0x51fcfa[_0x45a2('0x41')],_0x2d2c17[_0x45a2('0x42')]));if(_0x51fcfa[_0x45a2('0x41')][_0x45a2('0x4b')]){_0x4e5f2b[_0x45a2('0x4c')]=_[_0x45a2('0x4e')](_0x4e5f2b[_0x45a2('0x4c')],{'$or':_['map'](_0x4e5f2b[_0x45a2('0x45')],function(_0x31e16a){var _0x26a25b={};_0x26a25b[_0x31e16a]={'$like':'%'+_0x51fcfa[_0x45a2('0x41')]['filter']+'%'};return _0x26a25b;})});}_0x4e5f2b=_['merge']({},_0x4e5f2b,_0x51fcfa[_0x45a2('0x4f')]);return _0x253e95['getFields'](_0x4e5f2b);}})['then'](function(_0x5bec82){if(_0x5bec82){_0x2d8200=_0x5bec82[_0x45a2('0x46')];if(!_0x51fcfa[_0x45a2('0x41')][_0x45a2('0x5c')](_0x45a2('0x47'))){_0x4e5f2b['limit']=qs[_0x45a2('0x2f')](_0x51fcfa[_0x45a2('0x41')][_0x45a2('0x2f')]);_0x4e5f2b[_0x45a2('0x2e')]=qs[_0x45a2('0x2e')](_0x51fcfa['query']['offset']);}return _0x253e95[_0x45a2('0x5e')](_0x4e5f2b);}})[_0x45a2('0x34')](function(_0x462898){if(_0x462898){return _0x462898?{'count':_0x2d8200,'rows':_0x462898}:null;}})[_0x45a2('0x34')](respondWithResult(_0x8bd586,null))[_0x45a2('0x54')](handleError(_0x8bd586,null));}; \ No newline at end of file +var _0x6513=['params','findOne','FreshsalesField','order','options','getSubjects','nolimit','getDescriptions','pick','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','FreshsalesConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','fields','find','create','body'];(function(_0x264744,_0x3be9c9){var _0x547fcf=function(_0x351cd4){while(--_0x351cd4){_0x264744['push'](_0x264744['shift']());}};_0x547fcf(++_0x3be9c9);}(_0x6513,0xc8));var _0x3651=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0x6513[_0x5beda8];return _0x2aa042;};'use strict';var pdf=require(_0x3651('0x0'));var emlformat=require(_0x3651('0x1'));var rimraf=require(_0x3651('0x2'));var zipdir=require(_0x3651('0x3'));var jsonpatch=require(_0x3651('0x4'));var rp=require(_0x3651('0x5'));var moment=require(_0x3651('0x6'));var BPromise=require(_0x3651('0x7'));var Mustache=require(_0x3651('0x8'));var util=require(_0x3651('0x9'));var path=require(_0x3651('0xa'));var sox=require('sox');var csv=require(_0x3651('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3651('0xc'));var squel=require(_0x3651('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3651('0xb'));var querystring=require(_0x3651('0xe'));var Papa=require(_0x3651('0xf'));var Redis=require(_0x3651('0x10'));var authService=require(_0x3651('0x11'));var qs=require(_0x3651('0x12'));var as=require(_0x3651('0x13'));var hardwareService=require(_0x3651('0x14'));var logger=require(_0x3651('0x15'))(_0x3651('0x16'));var utils=require(_0x3651('0x17'));var config=require(_0x3651('0x18'));var db=require(_0x3651('0x19'))['db'];var jayson=require(_0x3651('0x1a'));var client=jayson[_0x3651('0x1b')][_0x3651('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3c1c90,_0xac75a4,_0x2e885d){if(_0x2e885d){var _0x4b14d9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b14d9[_0x3651('0x1d')](_0xac75a4)){return _0x3c1c90;}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 _0x3c1c90;}}function respondWithRpcPromise(_0x4f1b67,_0x3f0dce,_0x242d61,_0x426629){return new BPromise(function(_0x5c2fb7,_0x2beac4){var _0x2e4313=_0x426629||client;return _0x2e4313['request'](_0x4f1b67,_0x242d61)[_0x3651('0x1e')](function(_0x5383c2){logger[_0x3651('0x1f')](_0x3651('0x20'),_0x3f0dce,_0x3651('0x21'));logger['debug'](_0x3651('0x22'),_0x3f0dce,_0x3651('0x21'),JSON[_0x3651('0x23')](_0x5383c2));if(_0x5383c2['error']){if(_0x5383c2[_0x3651('0x24')][_0x3651('0x25')]===0x1f4){logger[_0x3651('0x24')](_0x3651('0x20'),_0x3f0dce,_0x5383c2[_0x3651('0x24')][_0x3651('0x26')]);return _0x2beac4(_0x5383c2[_0x3651('0x24')][_0x3651('0x26')]);}logger['error'](_0x3651('0x20'),_0x3f0dce,_0x5383c2[_0x3651('0x24')][_0x3651('0x26')]);return _0x5c2fb7(_0x5383c2['error']['message']);}else{logger[_0x3651('0x1f')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3f0dce,_0x3651('0x21'));_0x5c2fb7(_0x5383c2[_0x3651('0x27')][_0x3651('0x26')]);}})[_0x3651('0x28')](function(_0x8f95ef){logger[_0x3651('0x24')](_0x3651('0x20'),_0x3f0dce,_0x8f95ef);_0x2beac4(_0x8f95ef);});});}function respondWithStatusCode(_0x47ca13,_0x44e523){_0x44e523=_0x44e523||0xcc;return function(_0x4d6940){if(_0x4d6940){return _0x47ca13['sendStatus'](_0x44e523);}return _0x47ca13[_0x3651('0x29')](_0x44e523)[_0x3651('0x2a')]();};}function respondWithResult(_0x219184,_0x1e2a22){_0x1e2a22=_0x1e2a22||0xc8;return function(_0x1da8a2){if(_0x1da8a2){return _0x219184['status'](_0x1e2a22)[_0x3651('0x2b')](_0x1da8a2);}};}function respondWithFilteredResult(_0x37b67d,_0x53f260){return function(_0x147780){if(_0x147780){var _0x3b18b1=_0x147780[_0x3651('0x2c')],_0x8011d8=_0x53f260[_0x3651('0x2d')],_0x53d59e=_0x53f260['offset']+_0x53f260[_0x3651('0x2e')],_0x548933;if(_0x53d59e>=_0x3b18b1){_0x53d59e=_0x3b18b1;_0x548933=0xc8;}else{_0x548933=0xce;}_0x37b67d[_0x3651('0x29')](_0x548933);return _0x37b67d[_0x3651('0x2f')](_0x3651('0x30'),_0x8011d8+'-'+_0x53d59e+'/'+_0x3b18b1)[_0x3651('0x2b')](_0x147780);}return null;};}function patchUpdates(_0x3ab390){return function(_0x600524){try{jsonpatch[_0x3651('0x31')](_0x600524,_0x3ab390,!![]);}catch(_0x5783ae){return BPromise[_0x3651('0x32')](_0x5783ae);}return _0x600524[_0x3651('0x33')]();};}function saveUpdates(_0x1ee7c0,_0x39b006){return function(_0x2cd25b){if(_0x2cd25b){return _0x2cd25b[_0x3651('0x34')](_0x1ee7c0)[_0x3651('0x1e')](function(_0x429e46){return _0x429e46;});}return null;};}function removeEntity(_0x508ac8,_0x434f79){return function(_0x129ee7){if(_0x129ee7){return _0x129ee7[_0x3651('0x35')]()[_0x3651('0x1e')](function(){_0x508ac8['status'](0xcc)[_0x3651('0x2a')]();});}};}function handleEntityNotFound(_0x439925,_0x2a309d){return function(_0x96a441){if(!_0x96a441){_0x439925[_0x3651('0x36')](0x194);}return _0x96a441;};}function handleError(_0x2ad34d,_0x5f46b4){_0x5f46b4=_0x5f46b4||0x1f4;return function(_0x2c6056){logger[_0x3651('0x24')](_0x2c6056[_0x3651('0x37')]);if(_0x2c6056[_0x3651('0x38')]){delete _0x2c6056[_0x3651('0x38')];}_0x2ad34d['status'](_0x5f46b4)['send'](_0x2c6056);};}exports[_0x3651('0x39')]=function(_0x13abc2,_0x5bb9c1){var _0x23543a={},_0x13c798={},_0x4787d8={'count':0x0,'rows':[]};var _0x25889e=_['map'](db[_0x3651('0x3a')][_0x3651('0x3b')],function(_0x5e0de1){return{'name':_0x5e0de1[_0x3651('0x3c')],'type':_0x5e0de1['type'][_0x3651('0x3d')]};});_0x13c798[_0x3651('0x3e')]=_[_0x3651('0x3f')](_0x25889e,_0x3651('0x38'));_0x13c798[_0x3651('0x40')]=_[_0x3651('0x41')](_0x13abc2[_0x3651('0x40')]);_0x13c798[_0x3651('0x42')]=_['intersection'](_0x13c798[_0x3651('0x3e')],_0x13c798[_0x3651('0x40')]);_0x23543a[_0x3651('0x43')]=_[_0x3651('0x44')](_0x13c798['model'],qs['fields'](_0x13abc2[_0x3651('0x40')]['fields']));_0x23543a['attributes']=_0x23543a[_0x3651('0x43')][_0x3651('0x45')]?_0x23543a['attributes']:_0x13c798[_0x3651('0x3e')];if(!_0x13abc2[_0x3651('0x40')][_0x3651('0x46')]('nolimit')){_0x23543a[_0x3651('0x2e')]=qs[_0x3651('0x2e')](_0x13abc2[_0x3651('0x40')][_0x3651('0x2e')]);_0x23543a[_0x3651('0x2d')]=qs[_0x3651('0x2d')](_0x13abc2[_0x3651('0x40')][_0x3651('0x2d')]);}_0x23543a['order']=qs[_0x3651('0x47')](_0x13abc2[_0x3651('0x40')]['sort']);_0x23543a[_0x3651('0x48')]=qs['filters'](_['pick'](_0x13abc2['query'],_0x13c798['filters']),_0x25889e);if(_0x13abc2['query'][_0x3651('0x49')]){_0x23543a[_0x3651('0x48')]=_[_0x3651('0x4a')](_0x23543a[_0x3651('0x48')],{'$or':_[_0x3651('0x3f')](_0x25889e,function(_0x55a9e9){if(_0x55a9e9[_0x3651('0x4b')]!==_0x3651('0x4c')){var _0xb70b0e={};_0xb70b0e[_0x55a9e9['name']]={'$like':'%'+_0x13abc2[_0x3651('0x40')][_0x3651('0x49')]+'%'};return _0xb70b0e;}})});}_0x23543a=_[_0x3651('0x4a')]({},_0x23543a,_0x13abc2['options']);var _0x4be364={'where':_0x23543a[_0x3651('0x48')]};return db[_0x3651('0x3a')][_0x3651('0x2c')](_0x4be364)['then'](function(_0x267dbe){_0x4787d8[_0x3651('0x2c')]=_0x267dbe;if(_0x13abc2['query'][_0x3651('0x4d')]){_0x23543a[_0x3651('0x4e')]=[{'all':!![]}];}return db[_0x3651('0x3a')][_0x3651('0x4f')](_0x23543a);})['then'](function(_0x127d93){_0x4787d8[_0x3651('0x50')]=_0x127d93;return _0x4787d8;})[_0x3651('0x1e')](respondWithFilteredResult(_0x5bb9c1,_0x23543a))[_0x3651('0x28')](handleError(_0x5bb9c1,null));};exports['show']=function(_0x29299e,_0x37d631){var _0x468ba2={'raw':![],'where':{'id':_0x29299e['params']['id']}},_0x1c8d75={};_0x1c8d75[_0x3651('0x3e')]=_[_0x3651('0x41')](db['FreshsalesConfiguration'][_0x3651('0x3b')]);_0x1c8d75[_0x3651('0x40')]=_['keys'](_0x29299e[_0x3651('0x40')]);_0x1c8d75[_0x3651('0x42')]=_[_0x3651('0x44')](_0x1c8d75['model'],_0x1c8d75[_0x3651('0x40')]);_0x468ba2[_0x3651('0x43')]=_[_0x3651('0x44')](_0x1c8d75['model'],qs['fields'](_0x29299e[_0x3651('0x40')][_0x3651('0x51')]));_0x468ba2[_0x3651('0x43')]=_0x468ba2[_0x3651('0x43')]['length']?_0x468ba2[_0x3651('0x43')]:_0x1c8d75[_0x3651('0x3e')];if(_0x29299e['query'][_0x3651('0x4d')]){_0x468ba2[_0x3651('0x4e')]=[{'all':!![]}];}_0x468ba2=_['merge']({},_0x468ba2,_0x29299e['options']);return db[_0x3651('0x3a')][_0x3651('0x52')](_0x468ba2)['then'](handleEntityNotFound(_0x37d631,null))['then'](respondWithResult(_0x37d631,null))[_0x3651('0x28')](handleError(_0x37d631,null));};exports['create']=function(_0x516d3f,_0x2f479d){return db['FreshsalesConfiguration'][_0x3651('0x53')](_0x516d3f[_0x3651('0x54')],{})['then'](respondWithResult(_0x2f479d,0xc9))[_0x3651('0x28')](handleError(_0x2f479d,null));};exports['update']=function(_0x4565a5,_0x280851){if(_0x4565a5[_0x3651('0x54')]['id']){delete _0x4565a5[_0x3651('0x54')]['id'];}return db[_0x3651('0x3a')][_0x3651('0x52')]({'where':{'id':_0x4565a5['params']['id']}})[_0x3651('0x1e')](handleEntityNotFound(_0x280851,null))['then'](saveUpdates(_0x4565a5[_0x3651('0x54')],null))[_0x3651('0x1e')](respondWithResult(_0x280851,null))[_0x3651('0x28')](handleError(_0x280851,null));};exports[_0x3651('0x35')]=function(_0x39cfee,_0x3ce68b){return db['FreshsalesConfiguration'][_0x3651('0x52')]({'where':{'id':_0x39cfee[_0x3651('0x55')]['id']}})[_0x3651('0x1e')](handleEntityNotFound(_0x3ce68b,null))['then'](removeEntity(_0x3ce68b,null))[_0x3651('0x28')](handleError(_0x3ce68b,null));};exports['getSubjects']=function(_0x58c47a,_0x47484a,_0x323924){var _0x492549={};var _0x4d92bc={};var _0x20ae0e;var _0x46674e;return db[_0x3651('0x3a')][_0x3651('0x56')]({'where':{'id':_0x58c47a[_0x3651('0x55')]['id']}})[_0x3651('0x1e')](handleEntityNotFound(_0x47484a,null))[_0x3651('0x1e')](function(_0x1df85f){if(_0x1df85f){_0x20ae0e=_0x1df85f;_0x4d92bc[_0x3651('0x3e')]=_[_0x3651('0x41')](db[_0x3651('0x57')][_0x3651('0x3b')]);_0x4d92bc[_0x3651('0x40')]=_[_0x3651('0x41')](_0x58c47a[_0x3651('0x40')]);_0x4d92bc[_0x3651('0x42')]=_[_0x3651('0x44')](_0x4d92bc[_0x3651('0x3e')],_0x4d92bc['query']);_0x492549[_0x3651('0x43')]=_[_0x3651('0x44')](_0x4d92bc[_0x3651('0x3e')],qs[_0x3651('0x51')](_0x58c47a['query'][_0x3651('0x51')]));_0x492549[_0x3651('0x43')]=_0x492549[_0x3651('0x43')][_0x3651('0x45')]?_0x492549['attributes']:_0x4d92bc[_0x3651('0x3e')];_0x492549[_0x3651('0x58')]=qs[_0x3651('0x47')](_0x58c47a[_0x3651('0x40')]['sort']);_0x492549[_0x3651('0x48')]=qs['filters'](_['pick'](_0x58c47a[_0x3651('0x40')],_0x4d92bc[_0x3651('0x42')]));if(_0x58c47a[_0x3651('0x40')]['filter']){_0x492549[_0x3651('0x48')]=_[_0x3651('0x4a')](_0x492549['where'],{'$or':_['map'](_0x492549['attributes'],function(_0x4bd53d){var _0x1c52a3={};_0x1c52a3[_0x4bd53d]={'$like':'%'+_0x58c47a[_0x3651('0x40')][_0x3651('0x49')]+'%'};return _0x1c52a3;})});}_0x492549=_[_0x3651('0x4a')]({},_0x492549,_0x58c47a[_0x3651('0x59')]);return _0x20ae0e[_0x3651('0x5a')](_0x492549);}})[_0x3651('0x1e')](function(_0x337cde){if(_0x337cde){_0x46674e=_0x337cde[_0x3651('0x45')];if(!_0x58c47a[_0x3651('0x40')][_0x3651('0x46')](_0x3651('0x5b'))){_0x492549['limit']=qs[_0x3651('0x2e')](_0x58c47a[_0x3651('0x40')][_0x3651('0x2e')]);_0x492549[_0x3651('0x2d')]=qs[_0x3651('0x2d')](_0x58c47a[_0x3651('0x40')][_0x3651('0x2d')]);}return _0x20ae0e[_0x3651('0x5a')](_0x492549);}})[_0x3651('0x1e')](function(_0x3fe528){if(_0x3fe528){return _0x3fe528?{'count':_0x46674e,'rows':_0x3fe528}:null;}})[_0x3651('0x1e')](respondWithResult(_0x47484a,null))[_0x3651('0x28')](handleError(_0x47484a,null));};exports[_0x3651('0x5c')]=function(_0x1c013f,_0x201b7a,_0x1604a6){var _0x27d695={};var _0x5f0de9={};var _0x4154ca;var _0x343252;return db['FreshsalesConfiguration'][_0x3651('0x56')]({'where':{'id':_0x1c013f['params']['id']}})[_0x3651('0x1e')](handleEntityNotFound(_0x201b7a,null))[_0x3651('0x1e')](function(_0x3c9f61){if(_0x3c9f61){_0x4154ca=_0x3c9f61;_0x5f0de9[_0x3651('0x3e')]=_['keys'](db[_0x3651('0x57')][_0x3651('0x3b')]);_0x5f0de9[_0x3651('0x40')]=_[_0x3651('0x41')](_0x1c013f[_0x3651('0x40')]);_0x5f0de9[_0x3651('0x42')]=_[_0x3651('0x44')](_0x5f0de9[_0x3651('0x3e')],_0x5f0de9[_0x3651('0x40')]);_0x27d695[_0x3651('0x43')]=_[_0x3651('0x44')](_0x5f0de9['model'],qs[_0x3651('0x51')](_0x1c013f[_0x3651('0x40')]['fields']));_0x27d695['attributes']=_0x27d695[_0x3651('0x43')][_0x3651('0x45')]?_0x27d695[_0x3651('0x43')]:_0x5f0de9[_0x3651('0x3e')];_0x27d695[_0x3651('0x58')]=qs[_0x3651('0x47')](_0x1c013f[_0x3651('0x40')][_0x3651('0x47')]);_0x27d695[_0x3651('0x48')]=qs[_0x3651('0x42')](_[_0x3651('0x5d')](_0x1c013f[_0x3651('0x40')],_0x5f0de9[_0x3651('0x42')]));if(_0x1c013f[_0x3651('0x40')][_0x3651('0x49')]){_0x27d695[_0x3651('0x48')]=_[_0x3651('0x4a')](_0x27d695[_0x3651('0x48')],{'$or':_[_0x3651('0x3f')](_0x27d695['attributes'],function(_0x1ecfd2){var _0x5ceb78={};_0x5ceb78[_0x1ecfd2]={'$like':'%'+_0x1c013f[_0x3651('0x40')][_0x3651('0x49')]+'%'};return _0x5ceb78;})});}_0x27d695=_['merge']({},_0x27d695,_0x1c013f['options']);return _0x4154ca[_0x3651('0x5c')](_0x27d695);}})[_0x3651('0x1e')](function(_0x10a475){if(_0x10a475){_0x343252=_0x10a475['length'];if(!_0x1c013f[_0x3651('0x40')]['hasOwnProperty'](_0x3651('0x5b'))){_0x27d695[_0x3651('0x2e')]=qs[_0x3651('0x2e')](_0x1c013f['query'][_0x3651('0x2e')]);_0x27d695[_0x3651('0x2d')]=qs['offset'](_0x1c013f[_0x3651('0x40')][_0x3651('0x2d')]);}return _0x4154ca[_0x3651('0x5c')](_0x27d695);}})[_0x3651('0x1e')](function(_0x543e71){if(_0x543e71){return _0x543e71?{'count':_0x343252,'rows':_0x543e71}:null;}})[_0x3651('0x1e')](respondWithResult(_0x201b7a,null))['catch'](handleError(_0x201b7a,null));};exports['getFields']=function(_0x281daa,_0x2b745e,_0x4aa66c){var _0x4172b8={};var _0xc12c3a={};var _0x133f7e;var _0x2a263c;return db['FreshsalesConfiguration'][_0x3651('0x56')]({'where':{'id':_0x281daa[_0x3651('0x55')]['id']}})[_0x3651('0x1e')](handleEntityNotFound(_0x2b745e,null))[_0x3651('0x1e')](function(_0x3fb520){if(_0x3fb520){_0x133f7e=_0x3fb520;_0xc12c3a[_0x3651('0x3e')]=_[_0x3651('0x41')](db[_0x3651('0x57')][_0x3651('0x3b')]);_0xc12c3a[_0x3651('0x40')]=_[_0x3651('0x41')](_0x281daa['query']);_0xc12c3a[_0x3651('0x42')]=_[_0x3651('0x44')](_0xc12c3a[_0x3651('0x3e')],_0xc12c3a[_0x3651('0x40')]);_0x4172b8['attributes']=_[_0x3651('0x44')](_0xc12c3a[_0x3651('0x3e')],qs[_0x3651('0x51')](_0x281daa['query'][_0x3651('0x51')]));_0x4172b8['attributes']=_0x4172b8[_0x3651('0x43')][_0x3651('0x45')]?_0x4172b8[_0x3651('0x43')]:_0xc12c3a['model'];_0x4172b8[_0x3651('0x58')]=qs[_0x3651('0x47')](_0x281daa['query'][_0x3651('0x47')]);_0x4172b8['where']=qs['filters'](_['pick'](_0x281daa[_0x3651('0x40')],_0xc12c3a[_0x3651('0x42')]));if(_0x281daa[_0x3651('0x40')][_0x3651('0x49')]){_0x4172b8[_0x3651('0x48')]=_['merge'](_0x4172b8[_0x3651('0x48')],{'$or':_[_0x3651('0x3f')](_0x4172b8[_0x3651('0x43')],function(_0x2b694b){var _0x40d5b6={};_0x40d5b6[_0x2b694b]={'$like':'%'+_0x281daa[_0x3651('0x40')][_0x3651('0x49')]+'%'};return _0x40d5b6;})});}_0x4172b8=_[_0x3651('0x4a')]({},_0x4172b8,_0x281daa[_0x3651('0x59')]);return _0x133f7e[_0x3651('0x5e')](_0x4172b8);}})[_0x3651('0x1e')](function(_0x571722){if(_0x571722){_0x2a263c=_0x571722[_0x3651('0x45')];if(!_0x281daa['query'][_0x3651('0x46')](_0x3651('0x5b'))){_0x4172b8['limit']=qs[_0x3651('0x2e')](_0x281daa[_0x3651('0x40')][_0x3651('0x2e')]);_0x4172b8[_0x3651('0x2d')]=qs[_0x3651('0x2d')](_0x281daa[_0x3651('0x40')]['offset']);}return _0x133f7e['getFields'](_0x4172b8);}})[_0x3651('0x1e')](function(_0x5cdb6b){if(_0x5cdb6b){return _0x5cdb6b?{'count':_0x2a263c,'rows':_0x5cdb6b}:null;}})[_0x3651('0x1e')](respondWithResult(_0x2b745e,null))['catch'](handleError(_0x2b745e,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index fe63016..ce6a067 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 _0xc778=['exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0xc778,0x149));var _0x8c77=function(_0x2e6812,_0x329578){_0x2e6812=_0x2e6812-0x0;var _0x49ccd5=_0xc778[_0x2e6812];return _0x49ccd5;};'use strict';var _=require(_0x8c77('0x0'));var util=require('util');var logger=require(_0x8c77('0x1'))(_0x8c77('0x2'));var moment=require(_0x8c77('0x3'));var BPromise=require(_0x8c77('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c77('0x5'));var rimraf=require(_0x8c77('0x6'));var config=require(_0x8c77('0x7'));var attributes=require(_0x8c77('0x8'));module[_0x8c77('0x9')]=function(_0x493c5f,_0x53848d){return _0x493c5f[_0x8c77('0xa')](_0x8c77('0xb'),attributes,{'tableName':_0x8c77('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x383f=['api','moment','bluebird','request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger'];(function(_0x44da01,_0x57c833){var _0x544d85=function(_0x128edf){while(--_0x128edf){_0x44da01['push'](_0x44da01['shift']());}};_0x544d85(++_0x57c833);}(_0x383f,0x9a));var _0xf383=function(_0x5469e2,_0x1cb459){_0x5469e2=_0x5469e2-0x0;var _0x5849a2=_0x383f[_0x5469e2];return _0x5849a2;};'use strict';var _=require('lodash');var util=require(_0xf383('0x0'));var logger=require(_0xf383('0x1'))(_0xf383('0x2'));var moment=require(_0xf383('0x3'));var BPromise=require(_0xf383('0x4'));var rp=require(_0xf383('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf383('0x6'));var attributes=require(_0xf383('0x7'));module[_0xf383('0x8')]=function(_0x2e4438,_0xdbec68){return _0x2e4438[_0xf383('0x9')](_0xf383('0xa'),attributes,{'tableName':_0xf383('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 2d23f05..912bf18 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 _0x151b=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x18dc83,_0x462295){var _0x8236a2=function(_0x448df4){while(--_0x448df4){_0x18dc83['push'](_0x18dc83['shift']());}};_0x8236a2(++_0x462295);}(_0x151b,0x153));var _0xb151=function(_0x1c8e2b,_0x56d423){_0x1c8e2b=_0x1c8e2b-0x0;var _0x44b490=_0x151b[_0x1c8e2b];return _0x44b490;};'use strict';var _=require(_0xb151('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb151('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb151('0x2'));var db=require(_0xb151('0x3'))['db'];var utils=require(_0xb151('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb151('0x5'));var jayson=require(_0xb151('0x6'));var client=jayson['client'][_0xb151('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ba994,_0xd89657,_0x352713){return new BPromise(function(_0x46fdb0,_0x484caf){return client['request'](_0x4ba994,_0x352713)[_0xb151('0x8')](function(_0x20f1b2){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0xd89657,_0xb151('0x9'));logger[_0xb151('0xa')](_0xb151('0xb'),_0xd89657,_0xb151('0x9'),JSON[_0xb151('0xc')](_0x20f1b2));if(_0x20f1b2[_0xb151('0xd')]){if(_0x20f1b2[_0xb151('0xd')][_0xb151('0xe')]===0x1f4){logger[_0xb151('0xd')](_0xb151('0xf'),_0xd89657,_0x20f1b2['error'][_0xb151('0x10')]);return _0x484caf(_0x20f1b2['error'][_0xb151('0x10')]);}logger[_0xb151('0xd')](_0xb151('0xf'),_0xd89657,_0x20f1b2[_0xb151('0xd')]['message']);return _0x46fdb0(_0x20f1b2[_0xb151('0xd')][_0xb151('0x10')]);}else{logger[_0xb151('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xd89657,'request\x20sent');_0x46fdb0(_0x20f1b2[_0xb151('0x12')]['message']);}})[_0xb151('0x13')](function(_0x4ca435){logger[_0xb151('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xd89657,_0x4ca435);_0x484caf(_0x4ca435);});});} \ No newline at end of file +var _0x2977=['client','request','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x2977,0xa5));var _0x7297=function(_0x21d067,_0x237d1a){_0x21d067=_0x21d067-0x0;var _0x542ad6=_0x2977[_0x21d067];return _0x542ad6;};'use strict';var _=require(_0x7297('0x0'));var util=require('util');var moment=require(_0x7297('0x1'));var BPromise=require(_0x7297('0x2'));var rs=require(_0x7297('0x3'));var fs=require('fs');var Redis=require(_0x7297('0x4'));var db=require(_0x7297('0x5'))['db'];var utils=require(_0x7297('0x6'));var logger=require(_0x7297('0x7'))(_0x7297('0x8'));var config=require(_0x7297('0x9'));var jayson=require(_0x7297('0xa'));var client=jayson[_0x7297('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc9e570,_0x581d60,_0x2be768){return new BPromise(function(_0x4fc888,_0x4c5832){return client[_0x7297('0xc')](_0xc9e570,_0x2be768)['then'](function(_0x909a14){logger[_0x7297('0xd')](_0x7297('0xe'),_0x581d60,'request\x20sent');logger['debug'](_0x7297('0xf'),_0x581d60,_0x7297('0x10'),JSON[_0x7297('0x11')](_0x909a14));if(_0x909a14[_0x7297('0x12')]){if(_0x909a14['error'][_0x7297('0x13')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x581d60,_0x909a14[_0x7297('0x12')]['message']);return _0x4c5832(_0x909a14[_0x7297('0x12')]['message']);}logger[_0x7297('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x581d60,_0x909a14['error'][_0x7297('0x14')]);return _0x4fc888(_0x909a14[_0x7297('0x12')][_0x7297('0x14')]);}else{logger[_0x7297('0xd')](_0x7297('0xe'),_0x581d60,_0x7297('0x10'));_0x4fc888(_0x909a14[_0x7297('0x15')][_0x7297('0x14')]);}})['catch'](function(_0x558f04){logger[_0x7297('0x12')](_0x7297('0xe'),_0x581d60,_0x558f04);_0x4c5832(_0x558f04);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index e6646d6..c8c323b 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 _0xeacb=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x3da9b1,_0x7db7b8){var _0x4c7061=function(_0x23da67){while(--_0x23da67){_0x3da9b1['push'](_0x3da9b1['shift']());}};_0x4c7061(++_0x7db7b8);}(_0xeacb,0x1b4));var _0xbeac=function(_0x5ca8a1,_0x4a1863){_0x5ca8a1=_0x5ca8a1-0x0;var _0x35838a=_0xeacb[_0x5ca8a1];return _0x35838a;};'use strict';var multer=require(_0xbeac('0x0'));var util=require(_0xbeac('0x1'));var path=require(_0xbeac('0x2'));var timeout=require(_0xbeac('0x3'));var express=require(_0xbeac('0x4'));var router=express[_0xbeac('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xbeac('0x6'));var config=require(_0xbeac('0x7'));var controller=require(_0xbeac('0x8'));router[_0xbeac('0x9')]('/',auth[_0xbeac('0xa')](),controller['index']);router['get'](_0xbeac('0xb'),auth['isAuthenticated'](),controller[_0xbeac('0xc')]);router[_0xbeac('0xd')]('/',auth[_0xbeac('0xa')](),controller[_0xbeac('0xe')]);router['put'](_0xbeac('0xb'),auth['isAuthenticated'](),controller[_0xbeac('0xf')]);router[_0xbeac('0x10')](_0xbeac('0xb'),auth['isAuthenticated'](),controller[_0xbeac('0x11')]);module[_0xbeac('0x12')]=router; \ No newline at end of file +var _0xf274=['isAuthenticated','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get'];(function(_0x446f11,_0x95cf21){var _0x385cb5=function(_0x426715){while(--_0x426715){_0x446f11['push'](_0x446f11['shift']());}};_0x385cb5(++_0x95cf21);}(_0xf274,0x1ca));var _0x4f27=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xf274[_0x172747];return _0x509692;};'use strict';var multer=require(_0x4f27('0x0'));var util=require(_0x4f27('0x1'));var path=require(_0x4f27('0x2'));var timeout=require(_0x4f27('0x3'));var express=require(_0x4f27('0x4'));var router=express['Router']();var auth=require(_0x4f27('0x5'));var interaction=require(_0x4f27('0x6'));var config=require(_0x4f27('0x7'));var controller=require(_0x4f27('0x8'));router[_0x4f27('0x9')]('/',auth[_0x4f27('0xa')](),controller['index']);router[_0x4f27('0x9')](_0x4f27('0xb'),auth[_0x4f27('0xa')](),controller['show']);router[_0x4f27('0xc')]('/',auth[_0x4f27('0xa')](),controller[_0x4f27('0xd')]);router[_0x4f27('0xe')](_0x4f27('0xb'),auth[_0x4f27('0xa')](),controller[_0x4f27('0xf')]);router[_0x4f27('0x10')](_0x4f27('0xb'),auth[_0x4f27('0xa')](),controller[_0x4f27('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 4dcfee7..8a123e5 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 _0x4cbc=['BOOLEAN','exports','string','variable','customVariable','STRING'];(function(_0x350d02,_0x5eb6f9){var _0x2cd70e=function(_0x351419){while(--_0x351419){_0x350d02['push'](_0x350d02['shift']());}};_0x2cd70e(++_0x5eb6f9);}(_0x4cbc,0x127));var _0xc4cb=function(_0x1a5b50,_0x178c12){_0x1a5b50=_0x1a5b50-0x0;var _0x1c325f=_0x4cbc[_0x1a5b50];return _0x1c325f;};'use strict';var Sequelize=require('sequelize');module[_0xc4cb('0x0')]={'type':{'type':Sequelize['ENUM'](_0xc4cb('0x1'),_0xc4cb('0x2'),_0xc4cb('0x3'),'keyValue'),'defaultValue':_0xc4cb('0x1')},'content':{'type':Sequelize[_0xc4cb('0x4')]},'key':{'type':Sequelize[_0xc4cb('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xc4cb('0x1'),'variable',_0xc4cb('0x3'))},'keyContent':{'type':Sequelize[_0xc4cb('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc4cb('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc4cb('0x4')]}}; \ No newline at end of file +var _0x546c=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x24d9c8,_0x5d98a2){var _0x3ffe8b=function(_0x544210){while(--_0x544210){_0x24d9c8['push'](_0x24d9c8['shift']());}};_0x3ffe8b(++_0x5d98a2);}(_0x546c,0x1c9));var _0xc546=function(_0x3dd963,_0x5a3208){_0x3dd963=_0x3dd963-0x0;var _0x352294=_0x546c[_0x3dd963];return _0x352294;};'use strict';var Sequelize=require(_0xc546('0x0'));module[_0xc546('0x1')]={'type':{'type':Sequelize[_0xc546('0x2')](_0xc546('0x3'),_0xc546('0x4'),_0xc546('0x5'),_0xc546('0x6')),'defaultValue':_0xc546('0x3')},'content':{'type':Sequelize[_0xc546('0x7')]},'key':{'type':Sequelize[_0xc546('0x7')]},'keyType':{'type':Sequelize[_0xc546('0x2')]('string',_0xc546('0x4'),_0xc546('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc546('0x7')]},'customField':{'type':Sequelize[_0xc546('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc546('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index c181a6c..119c854 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 _0x69e8=['apply','reject','update','then','destroy','error','send','index','FreshsalesField','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','includeAll','include','rows','show','params','find','create','catch','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','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x4bcc13,_0x3faaff){var _0x5f1ccc=function(_0x211dc4){while(--_0x211dc4){_0x4bcc13['push'](_0x4bcc13['shift']());}};_0x5f1ccc(++_0x3faaff);}(_0x69e8,0x1c3));var _0x869e=function(_0x1b97f9,_0x3c3c1c){_0x1b97f9=_0x1b97f9-0x0;var _0x34f1ce=_0x69e8[_0x1b97f9];return _0x34f1ce;};'use strict';var pdf=require(_0x869e('0x0'));var emlformat=require(_0x869e('0x1'));var rimraf=require(_0x869e('0x2'));var zipdir=require(_0x869e('0x3'));var jsonpatch=require(_0x869e('0x4'));var rp=require(_0x869e('0x5'));var moment=require('moment');var BPromise=require(_0x869e('0x6'));var Mustache=require('mustache');var util=require(_0x869e('0x7'));var path=require(_0x869e('0x8'));var sox=require(_0x869e('0x9'));var csv=require(_0x869e('0xa'));var ejs=require(_0x869e('0xb'));var fs=require('fs');var _=require(_0x869e('0xc'));var squel=require(_0x869e('0xd'));var crypto=require(_0x869e('0xe'));var jsforce=require(_0x869e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x869e('0xa'));var querystring=require(_0x869e('0x10'));var Papa=require(_0x869e('0x11'));var Redis=require('ioredis');var authService=require(_0x869e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x869e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x869e('0x14'))('api');var utils=require(_0x869e('0x15'));var config=require('../../config/environment');var db=require(_0x869e('0x16'))['db'];function respondWithStatusCode(_0x331b86,_0x4314ce){_0x4314ce=_0x4314ce||0xcc;return function(_0x19eb15){if(_0x19eb15){return _0x331b86[_0x869e('0x17')](_0x4314ce);}return _0x331b86[_0x869e('0x18')](_0x4314ce)[_0x869e('0x19')]();};}function respondWithResult(_0x44b717,_0x576242){_0x576242=_0x576242||0xc8;return function(_0x5e8076){if(_0x5e8076){return _0x44b717['status'](_0x576242)[_0x869e('0x1a')](_0x5e8076);}};}function respondWithFilteredResult(_0x169c7f,_0xa2119){return function(_0x2d789e){if(_0x2d789e){var _0x31239d=_0x2d789e[_0x869e('0x1b')],_0x8bdb89=_0xa2119[_0x869e('0x1c')],_0xf42dac=_0xa2119[_0x869e('0x1c')]+_0xa2119[_0x869e('0x1d')],_0xe6e450;if(_0xf42dac>=_0x31239d){_0xf42dac=_0x31239d;_0xe6e450=0xc8;}else{_0xe6e450=0xce;}_0x169c7f[_0x869e('0x18')](_0xe6e450);return _0x169c7f[_0x869e('0x1e')](_0x869e('0x1f'),_0x8bdb89+'-'+_0xf42dac+'/'+_0x31239d)[_0x869e('0x1a')](_0x2d789e);}return null;};}function patchUpdates(_0x303607){return function(_0x1a1efa){try{jsonpatch[_0x869e('0x20')](_0x1a1efa,_0x303607,!![]);}catch(_0x9f7504){return BPromise[_0x869e('0x21')](_0x9f7504);}return _0x1a1efa['save']();};}function saveUpdates(_0x1c8416,_0x10244e){return function(_0x5d60bd){if(_0x5d60bd){return _0x5d60bd[_0x869e('0x22')](_0x1c8416)[_0x869e('0x23')](function(_0x45bcb4){return _0x45bcb4;});}return null;};}function removeEntity(_0x4297f9,_0x59dc9e){return function(_0x4cb3e7){if(_0x4cb3e7){return _0x4cb3e7[_0x869e('0x24')]()[_0x869e('0x23')](function(){_0x4297f9[_0x869e('0x18')](0xcc)[_0x869e('0x19')]();});}};}function handleEntityNotFound(_0x509432,_0x5b5c56){return function(_0xe38b91){if(!_0xe38b91){_0x509432[_0x869e('0x17')](0x194);}return _0xe38b91;};}function handleError(_0x43b1d9,_0x13607a){_0x13607a=_0x13607a||0x1f4;return function(_0x5e7ee8){logger[_0x869e('0x25')](_0x5e7ee8['stack']);if(_0x5e7ee8['name']){delete _0x5e7ee8['name'];}_0x43b1d9[_0x869e('0x18')](_0x13607a)[_0x869e('0x26')](_0x5e7ee8);};}exports[_0x869e('0x27')]=function(_0x10fc89,_0x42b290){var _0x1dc337={},_0x277fc3={},_0x311937={'count':0x0,'rows':[]};var _0x3b2a00=_['map'](db[_0x869e('0x28')][_0x869e('0x29')],function(_0x4df0e8){return{'name':_0x4df0e8[_0x869e('0x2a')],'type':_0x4df0e8[_0x869e('0x2b')][_0x869e('0x2c')]};});_0x277fc3[_0x869e('0x2d')]=_[_0x869e('0x2e')](_0x3b2a00,_0x869e('0x2f'));_0x277fc3[_0x869e('0x30')]=_[_0x869e('0x31')](_0x10fc89[_0x869e('0x30')]);_0x277fc3[_0x869e('0x32')]=_[_0x869e('0x33')](_0x277fc3['model'],_0x277fc3['query']);_0x1dc337[_0x869e('0x34')]=_[_0x869e('0x33')](_0x277fc3[_0x869e('0x2d')],qs[_0x869e('0x35')](_0x10fc89['query']['fields']));_0x1dc337[_0x869e('0x34')]=_0x1dc337[_0x869e('0x34')][_0x869e('0x36')]?_0x1dc337[_0x869e('0x34')]:_0x277fc3['model'];if(!_0x10fc89['query'][_0x869e('0x37')](_0x869e('0x38'))){_0x1dc337[_0x869e('0x1d')]=qs[_0x869e('0x1d')](_0x10fc89[_0x869e('0x30')]['limit']);_0x1dc337[_0x869e('0x1c')]=qs[_0x869e('0x1c')](_0x10fc89[_0x869e('0x30')]['offset']);}_0x1dc337['order']=qs[_0x869e('0x39')](_0x10fc89[_0x869e('0x30')]['sort']);_0x1dc337['where']=qs[_0x869e('0x32')](_['pick'](_0x10fc89[_0x869e('0x30')],_0x277fc3[_0x869e('0x32')]),_0x3b2a00);if(_0x10fc89[_0x869e('0x30')][_0x869e('0x3a')]){_0x1dc337['where']=_[_0x869e('0x3b')](_0x1dc337[_0x869e('0x3c')],{'$or':_['map'](_0x3b2a00,function(_0x30e1f0){if(_0x30e1f0[_0x869e('0x2b')]!=='VIRTUAL'){var _0x27288d={};_0x27288d[_0x30e1f0[_0x869e('0x2f')]]={'$like':'%'+_0x10fc89[_0x869e('0x30')][_0x869e('0x3a')]+'%'};return _0x27288d;}})});}_0x1dc337=_[_0x869e('0x3b')]({},_0x1dc337,_0x10fc89['options']);var _0x2ec0a5={'where':_0x1dc337['where']};return db[_0x869e('0x28')]['count'](_0x2ec0a5)[_0x869e('0x23')](function(_0x45132f){_0x311937[_0x869e('0x1b')]=_0x45132f;if(_0x10fc89[_0x869e('0x30')][_0x869e('0x3d')]){_0x1dc337[_0x869e('0x3e')]=[{'all':!![]}];}return db[_0x869e('0x28')]['findAll'](_0x1dc337);})[_0x869e('0x23')](function(_0x4a25ab){_0x311937[_0x869e('0x3f')]=_0x4a25ab;return _0x311937;})['then'](respondWithFilteredResult(_0x42b290,_0x1dc337))['catch'](handleError(_0x42b290,null));};exports[_0x869e('0x40')]=function(_0x5288b1,_0x2dcf17){var _0x4b80bb={'raw':!![],'where':{'id':_0x5288b1[_0x869e('0x41')]['id']}},_0x5c4ff5={};_0x5c4ff5['model']=_[_0x869e('0x31')](db[_0x869e('0x28')]['rawAttributes']);_0x5c4ff5[_0x869e('0x30')]=_[_0x869e('0x31')](_0x5288b1[_0x869e('0x30')]);_0x5c4ff5[_0x869e('0x32')]=_[_0x869e('0x33')](_0x5c4ff5[_0x869e('0x2d')],_0x5c4ff5['query']);_0x4b80bb[_0x869e('0x34')]=_[_0x869e('0x33')](_0x5c4ff5[_0x869e('0x2d')],qs[_0x869e('0x35')](_0x5288b1[_0x869e('0x30')]['fields']));_0x4b80bb['attributes']=_0x4b80bb[_0x869e('0x34')]['length']?_0x4b80bb[_0x869e('0x34')]:_0x5c4ff5[_0x869e('0x2d')];if(_0x5288b1[_0x869e('0x30')]['includeAll']){_0x4b80bb['include']=[{'all':!![]}];}_0x4b80bb=_[_0x869e('0x3b')]({},_0x4b80bb,_0x5288b1['options']);return db[_0x869e('0x28')][_0x869e('0x42')](_0x4b80bb)['then'](handleEntityNotFound(_0x2dcf17,null))['then'](respondWithResult(_0x2dcf17,null))['catch'](handleError(_0x2dcf17,null));};exports['create']=function(_0xc4e3e3,_0xb3921d){return db[_0x869e('0x28')][_0x869e('0x43')](_0xc4e3e3['body'],{})[_0x869e('0x23')](respondWithResult(_0xb3921d,0xc9))[_0x869e('0x44')](handleError(_0xb3921d,null));};exports['update']=function(_0x669a5c,_0x33433e){if(_0x669a5c['body']['id']){delete _0x669a5c['body']['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x669a5c[_0x869e('0x41')]['id']}})[_0x869e('0x23')](handleEntityNotFound(_0x33433e,null))['then'](saveUpdates(_0x669a5c['body'],null))[_0x869e('0x23')](respondWithResult(_0x33433e,null))[_0x869e('0x44')](handleError(_0x33433e,null));};exports[_0x869e('0x24')]=function(_0x30b524,_0x2b3565){return db[_0x869e('0x28')][_0x869e('0x42')]({'where':{'id':_0x30b524[_0x869e('0x41')]['id']}})[_0x869e('0x23')](handleEntityNotFound(_0x2b3565,null))[_0x869e('0x23')](removeEntity(_0x2b3565,null))[_0x869e('0x44')](handleError(_0x2b3565,null));}; \ No newline at end of file +var _0x4768=['../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','FreshsalesField','type','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4768,0xc6));var _0x8476=function(_0x2b3708,_0x150567){_0x2b3708=_0x2b3708-0x0;var _0xef7bd0=_0x4768[_0x2b3708];return _0xef7bd0;};'use strict';var pdf=require(_0x8476('0x0'));var emlformat=require(_0x8476('0x1'));var rimraf=require(_0x8476('0x2'));var zipdir=require(_0x8476('0x3'));var jsonpatch=require(_0x8476('0x4'));var rp=require(_0x8476('0x5'));var moment=require(_0x8476('0x6'));var BPromise=require(_0x8476('0x7'));var Mustache=require(_0x8476('0x8'));var util=require(_0x8476('0x9'));var path=require('path');var sox=require(_0x8476('0xa'));var csv=require(_0x8476('0xb'));var ejs=require(_0x8476('0xc'));var fs=require('fs');var _=require(_0x8476('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8476('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8476('0xb'));var querystring=require(_0x8476('0xf'));var Papa=require(_0x8476('0x10'));var Redis=require(_0x8476('0x11'));var authService=require(_0x8476('0x12'));var qs=require(_0x8476('0x13'));var as=require(_0x8476('0x14'));var hardwareService=require(_0x8476('0x15'));var logger=require(_0x8476('0x16'))(_0x8476('0x17'));var utils=require('../../config/utils');var config=require(_0x8476('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aad5b,_0x57df90){_0x57df90=_0x57df90||0xcc;return function(_0x154166){if(_0x154166){return _0x1aad5b[_0x8476('0x19')](_0x57df90);}return _0x1aad5b[_0x8476('0x1a')](_0x57df90)[_0x8476('0x1b')]();};}function respondWithResult(_0x2cd73b,_0x2765ae){_0x2765ae=_0x2765ae||0xc8;return function(_0x47f1be){if(_0x47f1be){return _0x2cd73b[_0x8476('0x1a')](_0x2765ae)[_0x8476('0x1c')](_0x47f1be);}};}function respondWithFilteredResult(_0x518411,_0xe66752){return function(_0x398d4a){if(_0x398d4a){var _0x14d371=_0x398d4a[_0x8476('0x1d')],_0x14653e=_0xe66752[_0x8476('0x1e')],_0x5eaae0=_0xe66752[_0x8476('0x1e')]+_0xe66752[_0x8476('0x1f')],_0x25753d;if(_0x5eaae0>=_0x14d371){_0x5eaae0=_0x14d371;_0x25753d=0xc8;}else{_0x25753d=0xce;}_0x518411[_0x8476('0x1a')](_0x25753d);return _0x518411['set'](_0x8476('0x20'),_0x14653e+'-'+_0x5eaae0+'/'+_0x14d371)[_0x8476('0x1c')](_0x398d4a);}return null;};}function patchUpdates(_0x19b405){return function(_0x1a75ef){try{jsonpatch[_0x8476('0x21')](_0x1a75ef,_0x19b405,!![]);}catch(_0x50f297){return BPromise[_0x8476('0x22')](_0x50f297);}return _0x1a75ef[_0x8476('0x23')]();};}function saveUpdates(_0x1fc6d1,_0x25b7e6){return function(_0x251833){if(_0x251833){return _0x251833['update'](_0x1fc6d1)['then'](function(_0x5dee23){return _0x5dee23;});}return null;};}function removeEntity(_0x2032ca,_0x33c7bd){return function(_0x54f0e5){if(_0x54f0e5){return _0x54f0e5[_0x8476('0x24')]()[_0x8476('0x25')](function(){_0x2032ca[_0x8476('0x1a')](0xcc)[_0x8476('0x1b')]();});}};}function handleEntityNotFound(_0x3a4a6a,_0x4af1e4){return function(_0x3cac1b){if(!_0x3cac1b){_0x3a4a6a[_0x8476('0x19')](0x194);}return _0x3cac1b;};}function handleError(_0x4f389e,_0x323209){_0x323209=_0x323209||0x1f4;return function(_0x1aa159){logger[_0x8476('0x26')](_0x1aa159[_0x8476('0x27')]);if(_0x1aa159[_0x8476('0x28')]){delete _0x1aa159[_0x8476('0x28')];}_0x4f389e[_0x8476('0x1a')](_0x323209)[_0x8476('0x29')](_0x1aa159);};}exports['index']=function(_0x57a90d,_0x88a4f7){var _0x4d763b={},_0x227973={},_0x3d3ab6={'count':0x0,'rows':[]};var _0x52fe4c=_['map'](db[_0x8476('0x2a')]['rawAttributes'],function(_0x597765){return{'name':_0x597765['fieldName'],'type':_0x597765[_0x8476('0x2b')]['key']};});_0x227973[_0x8476('0x2c')]=_[_0x8476('0x2d')](_0x52fe4c,_0x8476('0x28'));_0x227973[_0x8476('0x2e')]=_['keys'](_0x57a90d[_0x8476('0x2e')]);_0x227973[_0x8476('0x2f')]=_['intersection'](_0x227973[_0x8476('0x2c')],_0x227973[_0x8476('0x2e')]);_0x4d763b[_0x8476('0x30')]=_['intersection'](_0x227973[_0x8476('0x2c')],qs[_0x8476('0x31')](_0x57a90d[_0x8476('0x2e')][_0x8476('0x31')]));_0x4d763b[_0x8476('0x30')]=_0x4d763b[_0x8476('0x30')][_0x8476('0x32')]?_0x4d763b['attributes']:_0x227973[_0x8476('0x2c')];if(!_0x57a90d['query'][_0x8476('0x33')](_0x8476('0x34'))){_0x4d763b[_0x8476('0x1f')]=qs[_0x8476('0x1f')](_0x57a90d[_0x8476('0x2e')][_0x8476('0x1f')]);_0x4d763b[_0x8476('0x1e')]=qs[_0x8476('0x1e')](_0x57a90d[_0x8476('0x2e')][_0x8476('0x1e')]);}_0x4d763b[_0x8476('0x35')]=qs[_0x8476('0x36')](_0x57a90d[_0x8476('0x2e')][_0x8476('0x36')]);_0x4d763b[_0x8476('0x37')]=qs[_0x8476('0x2f')](_[_0x8476('0x38')](_0x57a90d[_0x8476('0x2e')],_0x227973['filters']),_0x52fe4c);if(_0x57a90d[_0x8476('0x2e')][_0x8476('0x39')]){_0x4d763b[_0x8476('0x37')]=_['merge'](_0x4d763b['where'],{'$or':_['map'](_0x52fe4c,function(_0x1df4a8){if(_0x1df4a8[_0x8476('0x2b')]!==_0x8476('0x3a')){var _0x470fd1={};_0x470fd1[_0x1df4a8['name']]={'$like':'%'+_0x57a90d[_0x8476('0x2e')][_0x8476('0x39')]+'%'};return _0x470fd1;}})});}_0x4d763b=_[_0x8476('0x3b')]({},_0x4d763b,_0x57a90d[_0x8476('0x3c')]);var _0x579d76={'where':_0x4d763b['where']};return db[_0x8476('0x2a')]['count'](_0x579d76)[_0x8476('0x25')](function(_0x44b7bc){_0x3d3ab6[_0x8476('0x1d')]=_0x44b7bc;if(_0x57a90d['query'][_0x8476('0x3d')]){_0x4d763b[_0x8476('0x3e')]=[{'all':!![]}];}return db[_0x8476('0x2a')][_0x8476('0x3f')](_0x4d763b);})[_0x8476('0x25')](function(_0x2f6786){_0x3d3ab6[_0x8476('0x40')]=_0x2f6786;return _0x3d3ab6;})[_0x8476('0x25')](respondWithFilteredResult(_0x88a4f7,_0x4d763b))[_0x8476('0x41')](handleError(_0x88a4f7,null));};exports[_0x8476('0x42')]=function(_0x39620b,_0x568f8a){var _0x2fc0d1={'raw':!![],'where':{'id':_0x39620b[_0x8476('0x43')]['id']}},_0x15da82={};_0x15da82[_0x8476('0x2c')]=_[_0x8476('0x44')](db[_0x8476('0x2a')][_0x8476('0x45')]);_0x15da82[_0x8476('0x2e')]=_['keys'](_0x39620b[_0x8476('0x2e')]);_0x15da82[_0x8476('0x2f')]=_['intersection'](_0x15da82['model'],_0x15da82[_0x8476('0x2e')]);_0x2fc0d1['attributes']=_[_0x8476('0x46')](_0x15da82['model'],qs[_0x8476('0x31')](_0x39620b[_0x8476('0x2e')][_0x8476('0x31')]));_0x2fc0d1[_0x8476('0x30')]=_0x2fc0d1['attributes'][_0x8476('0x32')]?_0x2fc0d1['attributes']:_0x15da82[_0x8476('0x2c')];if(_0x39620b[_0x8476('0x2e')][_0x8476('0x3d')]){_0x2fc0d1[_0x8476('0x3e')]=[{'all':!![]}];}_0x2fc0d1=_['merge']({},_0x2fc0d1,_0x39620b[_0x8476('0x3c')]);return db[_0x8476('0x2a')][_0x8476('0x47')](_0x2fc0d1)[_0x8476('0x25')](handleEntityNotFound(_0x568f8a,null))['then'](respondWithResult(_0x568f8a,null))['catch'](handleError(_0x568f8a,null));};exports[_0x8476('0x48')]=function(_0x182988,_0x3d7430){return db[_0x8476('0x2a')][_0x8476('0x48')](_0x182988[_0x8476('0x49')],{})[_0x8476('0x25')](respondWithResult(_0x3d7430,0xc9))[_0x8476('0x41')](handleError(_0x3d7430,null));};exports['update']=function(_0x371f3a,_0x365352){if(_0x371f3a[_0x8476('0x49')]['id']){delete _0x371f3a['body']['id'];}return db['FreshsalesField'][_0x8476('0x47')]({'where':{'id':_0x371f3a['params']['id']}})[_0x8476('0x25')](handleEntityNotFound(_0x365352,null))[_0x8476('0x25')](saveUpdates(_0x371f3a[_0x8476('0x49')],null))[_0x8476('0x25')](respondWithResult(_0x365352,null))[_0x8476('0x41')](handleError(_0x365352,null));};exports['destroy']=function(_0x556311,_0x12442f){return db[_0x8476('0x2a')][_0x8476('0x47')]({'where':{'id':_0x556311[_0x8476('0x43')]['id']}})[_0x8476('0x25')](handleEntityNotFound(_0x12442f,null))[_0x8476('0x25')](removeEntity(_0x12442f,null))[_0x8476('0x41')](handleError(_0x12442f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7d97ff3..d0c9af0 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 _0x92ca=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId'];(function(_0x3d1c2a,_0x2ac29c){var _0x503dd4=function(_0xd2a322){while(--_0xd2a322){_0x3d1c2a['push'](_0x3d1c2a['shift']());}};_0x503dd4(++_0x2ac29c);}(_0x92ca,0xf7));var _0xa92c=function(_0x11c1a1,_0x17ba8c){_0x11c1a1=_0x11c1a1-0x0;var _0x483746=_0x92ca[_0x11c1a1];return _0x483746;};'use strict';var _=require(_0xa92c('0x0'));var util=require(_0xa92c('0x1'));var logger=require(_0xa92c('0x2'))('api');var moment=require(_0xa92c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa92c('0x4'));var fs=require('fs');var path=require(_0xa92c('0x5'));var rimraf=require('rimraf');var config=require(_0xa92c('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xa92c('0x7')]=function(_0x5680ae,_0x20772f){return _0x5680ae[_0xa92c('0x8')](_0xa92c('0x9'),attributes,{'tableName':_0xa92c('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xa92c('0xb'),_0xa92c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3a77=['exports','define','FreshsalesField','idField','util','api','moment','bluebird','request-promise','./intFreshsalesField.attributes'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x3a77,0x1c6));var _0x73a7=function(_0x239904,_0x4b11e2){_0x239904=_0x239904-0x0;var _0x259609=_0x3a77[_0x239904];return _0x259609;};'use strict';var _=require('lodash');var util=require(_0x73a7('0x0'));var logger=require('../../config/logger')(_0x73a7('0x1'));var moment=require(_0x73a7('0x2'));var BPromise=require(_0x73a7('0x3'));var rp=require(_0x73a7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x73a7('0x5'));module[_0x73a7('0x6')]=function(_0x18d238,_0xc61fa9){return _0x18d238[_0x73a7('0x7')](_0x73a7('0x8'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x73a7('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index e2c4b3c..2a3000d 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 _0x51ef=['message','FreshsalesField,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x51ef,0x18f));var _0xf51e=function(_0x46392f,_0x43e275){_0x46392f=_0x46392f-0x0;var _0x39e145=_0x51ef[_0x46392f];return _0x39e145;};'use strict';var _=require(_0xf51e('0x0'));var util=require('util');var moment=require(_0xf51e('0x1'));var BPromise=require(_0xf51e('0x2'));var rs=require(_0xf51e('0x3'));var fs=require('fs');var Redis=require(_0xf51e('0x4'));var db=require(_0xf51e('0x5'))['db'];var utils=require(_0xf51e('0x6'));var logger=require(_0xf51e('0x7'))(_0xf51e('0x8'));var config=require(_0xf51e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf51e('0xa')][_0xf51e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c8c79,_0x5145e8,_0x4f63ca){return new BPromise(function(_0x14d636,_0x3090b5){return client['request'](_0x4c8c79,_0x4f63ca)[_0xf51e('0xc')](function(_0x4017fe){logger[_0xf51e('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x5145e8,_0xf51e('0xe'));logger[_0xf51e('0xf')](_0xf51e('0x10'),_0x5145e8,'request\x20sent',JSON[_0xf51e('0x11')](_0x4017fe));if(_0x4017fe[_0xf51e('0x12')]){if(_0x4017fe['error']['code']===0x1f4){logger[_0xf51e('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x5145e8,_0x4017fe['error'][_0xf51e('0x13')]);return _0x3090b5(_0x4017fe[_0xf51e('0x12')]['message']);}logger[_0xf51e('0x12')](_0xf51e('0x14'),_0x5145e8,_0x4017fe[_0xf51e('0x12')][_0xf51e('0x13')]);return _0x14d636(_0x4017fe[_0xf51e('0x12')][_0xf51e('0x13')]);}else{logger[_0xf51e('0xd')](_0xf51e('0x14'),_0x5145e8,_0xf51e('0xe'));_0x14d636(_0x4017fe['result'][_0xf51e('0x13')]);}})[_0xf51e('0x15')](function(_0x235de9){logger[_0xf51e('0x12')](_0xf51e('0x14'),_0x5145e8,_0x235de9);_0x3090b5(_0x235de9);});});} \ No newline at end of file +var _0x6a90=['request','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x6a90,0x14e));var _0x06a9=function(_0x5e8653,_0x368047){_0x5e8653=_0x5e8653-0x0;var _0x3291d7=_0x6a90[_0x5e8653];return _0x3291d7;};'use strict';var _=require('lodash');var util=require(_0x06a9('0x0'));var moment=require(_0x06a9('0x1'));var BPromise=require(_0x06a9('0x2'));var rs=require(_0x06a9('0x3'));var fs=require('fs');var Redis=require(_0x06a9('0x4'));var db=require(_0x06a9('0x5'))['db'];var utils=require(_0x06a9('0x6'));var logger=require(_0x06a9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x06a9('0x8'));var client=jayson[_0x06a9('0x9')][_0x06a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ad8db,_0x242016,_0x47529c){return new BPromise(function(_0x5bfc28,_0x54b797){return client[_0x06a9('0xb')](_0x5ad8db,_0x47529c)['then'](function(_0x1e84a5){logger[_0x06a9('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x242016,_0x06a9('0xd'));logger[_0x06a9('0xe')](_0x06a9('0xf'),_0x242016,_0x06a9('0xd'),JSON[_0x06a9('0x10')](_0x1e84a5));if(_0x1e84a5['error']){if(_0x1e84a5[_0x06a9('0x11')][_0x06a9('0x12')]===0x1f4){logger['error'](_0x06a9('0x13'),_0x242016,_0x1e84a5[_0x06a9('0x11')]['message']);return _0x54b797(_0x1e84a5[_0x06a9('0x11')]['message']);}logger[_0x06a9('0x11')](_0x06a9('0x13'),_0x242016,_0x1e84a5[_0x06a9('0x11')][_0x06a9('0x14')]);return _0x5bfc28(_0x1e84a5[_0x06a9('0x11')][_0x06a9('0x14')]);}else{logger[_0x06a9('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x242016,_0x06a9('0xd'));_0x5bfc28(_0x1e84a5[_0x06a9('0x15')][_0x06a9('0x14')]);}})[_0x06a9('0x16')](function(_0x13c551){logger['error'](_0x06a9('0x13'),_0x242016,_0x13c551);_0x54b797(_0x13c551);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index eb7f077..326643a 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 _0xc9cc=['multer','util','path','connect-timeout','express','Router','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x5b0f75,_0x100783){var _0x419005=function(_0x25bd32){while(--_0x25bd32){_0x5b0f75['push'](_0x5b0f75['shift']());}};_0x419005(++_0x100783);}(_0xc9cc,0xb0));var _0xcc9c=function(_0x48671c,_0x2b44a3){_0x48671c=_0x48671c-0x0;var _0x32d5e5=_0xc9cc[_0x48671c];return _0x32d5e5;};'use strict';var multer=require(_0xcc9c('0x0'));var util=require(_0xcc9c('0x1'));var path=require(_0xcc9c('0x2'));var timeout=require(_0xcc9c('0x3'));var express=require(_0xcc9c('0x4'));var router=express[_0xcc9c('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcc9c('0x6'));var controller=require('./intSalesforceAccount.controller');router[_0xcc9c('0x7')]('/',auth['isAuthenticated'](),controller[_0xcc9c('0x8')]);router['get'](_0xcc9c('0x9'),auth[_0xcc9c('0xa')](),controller[_0xcc9c('0xb')]);router[_0xcc9c('0x7')](_0xcc9c('0xc'),auth[_0xcc9c('0xa')](),controller['getConfigurations']);router['get'](_0xcc9c('0xd'),auth['isAuthenticated'](),controller[_0xcc9c('0xe')]);router['post']('/',auth[_0xcc9c('0xa')](),controller[_0xcc9c('0xf')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xcc9c('0x10')]);router[_0xcc9c('0x11')](_0xcc9c('0x9'),auth[_0xcc9c('0xa')](),controller[_0xcc9c('0x12')]);router[_0xcc9c('0x13')](_0xcc9c('0x9'),auth['isAuthenticated'](),controller[_0xcc9c('0x14')]);module[_0xcc9c('0x15')]=router; \ No newline at end of file +var _0x818f=['isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get'];(function(_0xd13cad,_0xea397a){var _0xc744f2=function(_0x770ba1){while(--_0x770ba1){_0xd13cad['push'](_0xd13cad['shift']());}};_0xc744f2(++_0xea397a);}(_0x818f,0x1da));var _0xf818=function(_0x20bfe4,_0x2a5b58){_0x20bfe4=_0x20bfe4-0x0;var _0x3a23b6=_0x818f[_0x20bfe4];return _0x3a23b6;};'use strict';var multer=require(_0xf818('0x0'));var util=require(_0xf818('0x1'));var path=require(_0xf818('0x2'));var timeout=require(_0xf818('0x3'));var express=require(_0xf818('0x4'));var router=express[_0xf818('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf818('0x6'));var config=require(_0xf818('0x7'));var controller=require(_0xf818('0x8'));router[_0xf818('0x9')]('/',auth[_0xf818('0xa')](),controller[_0xf818('0xb')]);router[_0xf818('0x9')](_0xf818('0xc'),auth[_0xf818('0xa')](),controller['show']);router[_0xf818('0x9')](_0xf818('0xd'),auth[_0xf818('0xa')](),controller['getConfigurations']);router['get'](_0xf818('0xe'),auth[_0xf818('0xa')](),controller[_0xf818('0xf')]);router[_0xf818('0x10')]('/',auth[_0xf818('0xa')](),controller['create']);router[_0xf818('0x10')](_0xf818('0xd'),auth[_0xf818('0xa')](),controller[_0xf818('0x11')]);router[_0xf818('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xf818('0x13')]);router[_0xf818('0x14')](_0xf818('0xc'),auth[_0xf818('0xa')](),controller['destroy']);module[_0xf818('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 273eda8..c1ac856 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['sequelize','STRING','username','ENUM','integrationTab','newTab'];(function(_0x5d27c3,_0x5ac158){var _0xed73f8=function(_0xc9c3d2){while(--_0xc9c3d2){_0x5d27c3['push'](_0x5d27c3['shift']());}};_0xed73f8(++_0x5ac158);}(_0x7217,0x19e));var _0x7721=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x7217[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')]},'description':{'type':Sequelize[_0x7721('0x1')]},'username':{'type':Sequelize[_0x7721('0x1')],'unique':_0x7721('0x2')},'remoteUri':{'type':Sequelize[_0x7721('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x7721('0x1')]},'securityToken':{'type':Sequelize[_0x7721('0x1')]},'serverUrl':{'type':Sequelize[_0x7721('0x1')]},'type':{'type':Sequelize[_0x7721('0x3')](_0x7721('0x4'),_0x7721('0x5')),'defaultValue':_0x7721('0x4')}}; \ No newline at end of file +var _0x5fc3=['STRING','username','newTab','sequelize','exports'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5bc5fe,_0x2afaef){_0x5bc5fe=_0x5bc5fe-0x0;var _0x298ea7=_0x5fc3[_0x5bc5fe];return _0x298ea7;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x35fc('0x2')]},'username':{'type':Sequelize[_0x35fc('0x2')],'unique':_0x35fc('0x3')},'remoteUri':{'type':Sequelize[_0x35fc('0x2')]},'password':{'type':Sequelize[_0x35fc('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x35fc('0x2')]},'securityToken':{'type':Sequelize[_0x35fc('0x2')]},'serverUrl':{'type':Sequelize[_0x35fc('0x2')]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x35fc('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index f16e774..be3044e 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 _0xf404=['attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','SalesforceAccount','includeAll','rows','show','keys','fields','include','find','create','body','update','params','getConfigurations','findOne','SalesforceConfiguration','order','pick','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login','concat','isNil','ticketType','describe','CallObject','IsArchived','Priority','Status','Type','Case','Origin','Reason','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','value','boolean','True','true','False','false','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','result','catch','status','end','count','offset','limit','set','Content-Range','json','apply','save','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','query','model','intersection'];(function(_0x3255c2,_0x36cae0){var _0x3742a7=function(_0x1fe5c4){while(--_0x1fe5c4){_0x3255c2['push'](_0x3255c2['shift']());}};_0x3742a7(++_0x36cae0);}(_0xf404,0x1f2));var _0x4f40=function(_0x56312c,_0x366006){_0x56312c=_0x56312c-0x0;var _0x1fc746=_0xf404[_0x56312c];return _0x1fc746;};'use strict';var pdf=require(_0x4f40('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4f40('0x1'));var zipdir=require(_0x4f40('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4f40('0x3'));var BPromise=require(_0x4f40('0x4'));var Mustache=require(_0x4f40('0x5'));var util=require(_0x4f40('0x6'));var path=require(_0x4f40('0x7'));var sox=require(_0x4f40('0x8'));var csv=require(_0x4f40('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4f40('0xa'));var squel=require(_0x4f40('0xb'));var crypto=require(_0x4f40('0xc'));var jsforce=require(_0x4f40('0xd'));var deskjs=require(_0x4f40('0xe'));var toCsv=require(_0x4f40('0x9'));var querystring=require('querystring');var Papa=require(_0x4f40('0xf'));var Redis=require(_0x4f40('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f40('0x11'));var as=require(_0x4f40('0x12'));var hardwareService=require(_0x4f40('0x13'));var logger=require('../../config/logger')(_0x4f40('0x14'));var utils=require(_0x4f40('0x15'));var config=require(_0x4f40('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4f40('0x17'));var jayson=require(_0x4f40('0x18'));var client=jayson['client'][_0x4f40('0x19')]({'port':0x232a});function checkPasswordPattern(_0xd5e268,_0x28b48d,_0x587c55){if(_0x587c55){var _0x212ffd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x212ffd[_0x4f40('0x1a')](_0x28b48d)){return _0xd5e268;}else{throw new db[(_0x4f40('0x1b'))][(_0x4f40('0x1c'))](_0x4f40('0x1d'));}}else{return _0xd5e268;}}function respondWithRpcPromise(_0x43b6df,_0x3c7962,_0x46e4df,_0x120089){return new BPromise(function(_0x57ed33,_0x3a4bf9){var _0x36c8d0=_0x120089||client;return _0x36c8d0[_0x4f40('0x1e')](_0x43b6df,_0x46e4df)[_0x4f40('0x1f')](function(_0x5b3f02){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x3c7962,_0x4f40('0x20'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x3c7962,_0x4f40('0x20'),JSON['stringify'](_0x5b3f02));if(_0x5b3f02[_0x4f40('0x21')]){if(_0x5b3f02[_0x4f40('0x21')][_0x4f40('0x22')]===0x1f4){logger[_0x4f40('0x21')](_0x4f40('0x23'),_0x3c7962,_0x5b3f02[_0x4f40('0x21')][_0x4f40('0x24')]);return _0x3a4bf9(_0x5b3f02[_0x4f40('0x21')]['message']);}logger['error'](_0x4f40('0x23'),_0x3c7962,_0x5b3f02[_0x4f40('0x21')][_0x4f40('0x24')]);return _0x57ed33(_0x5b3f02[_0x4f40('0x21')][_0x4f40('0x24')]);}else{logger[_0x4f40('0x25')](_0x4f40('0x23'),_0x3c7962,'request\x20sent');_0x57ed33(_0x5b3f02[_0x4f40('0x26')][_0x4f40('0x24')]);}})[_0x4f40('0x27')](function(_0x383d79){logger[_0x4f40('0x21')](_0x4f40('0x23'),_0x3c7962,_0x383d79);_0x3a4bf9(_0x383d79);});});}function respondWithStatusCode(_0x5dc175,_0x450a66){_0x450a66=_0x450a66||0xcc;return function(_0x593f5b){if(_0x593f5b){return _0x5dc175['sendStatus'](_0x450a66);}return _0x5dc175[_0x4f40('0x28')](_0x450a66)[_0x4f40('0x29')]();};}function respondWithResult(_0x58c08b,_0xfbbee0){_0xfbbee0=_0xfbbee0||0xc8;return function(_0x35e913){if(_0x35e913){return _0x58c08b[_0x4f40('0x28')](_0xfbbee0)['json'](_0x35e913);}};}function respondWithFilteredResult(_0x9f9ae1,_0x5f0aa6){return function(_0x5dc358){if(_0x5dc358){var _0x2b771d=_0x5dc358[_0x4f40('0x2a')],_0x150e4f=_0x5f0aa6[_0x4f40('0x2b')],_0x5db93f=_0x5f0aa6['offset']+_0x5f0aa6[_0x4f40('0x2c')],_0x8b5421;if(_0x5db93f>=_0x2b771d){_0x5db93f=_0x2b771d;_0x8b5421=0xc8;}else{_0x8b5421=0xce;}_0x9f9ae1[_0x4f40('0x28')](_0x8b5421);return _0x9f9ae1[_0x4f40('0x2d')](_0x4f40('0x2e'),_0x150e4f+'-'+_0x5db93f+'/'+_0x2b771d)[_0x4f40('0x2f')](_0x5dc358);}return null;};}function patchUpdates(_0x382677){return function(_0x55916f){try{jsonpatch[_0x4f40('0x30')](_0x55916f,_0x382677,!![]);}catch(_0x296f28){return BPromise['reject'](_0x296f28);}return _0x55916f[_0x4f40('0x31')]();};}function saveUpdates(_0x2c2cf2,_0x3acf7d){return function(_0x17051a){if(_0x17051a){return _0x17051a['update'](_0x2c2cf2)[_0x4f40('0x1f')](function(_0x2c6750){return _0x2c6750;});}return null;};}function removeEntity(_0x82cc1d,_0x2c2ae3){return function(_0x4377e6){if(_0x4377e6){return _0x4377e6[_0x4f40('0x32')]()[_0x4f40('0x1f')](function(){_0x82cc1d[_0x4f40('0x28')](0xcc)[_0x4f40('0x29')]();});}};}function handleEntityNotFound(_0x341697,_0x59c611){return function(_0xc6a0d1){if(!_0xc6a0d1){_0x341697[_0x4f40('0x33')](0x194);}return _0xc6a0d1;};}function handleError(_0x5d92c4,_0x355737){_0x355737=_0x355737||0x1f4;return function(_0x41c617){logger[_0x4f40('0x21')](_0x41c617[_0x4f40('0x34')]);if(_0x41c617[_0x4f40('0x35')]){delete _0x41c617['name'];}_0x5d92c4['status'](_0x355737)[_0x4f40('0x36')](_0x41c617);};}exports[_0x4f40('0x37')]=function(_0x2563be,_0x1d9693){var _0x1d1f17={},_0x5a738a={},_0x3ff9de={'count':0x0,'rows':[]};var _0x290cef=_[_0x4f40('0x38')](db['SalesforceAccount'][_0x4f40('0x39')],function(_0x363e9e){return{'name':_0x363e9e[_0x4f40('0x3a')],'type':_0x363e9e['type']['key']};});_0x5a738a['model']=_[_0x4f40('0x38')](_0x290cef,_0x4f40('0x35'));_0x5a738a[_0x4f40('0x3b')]=_['keys'](_0x2563be[_0x4f40('0x3b')]);_0x5a738a['filters']=_['intersection'](_0x5a738a[_0x4f40('0x3c')],_0x5a738a[_0x4f40('0x3b')]);_0x1d1f17['attributes']=_[_0x4f40('0x3d')](_0x5a738a['model'],qs['fields'](_0x2563be['query']['fields']));_0x1d1f17[_0x4f40('0x3e')]=_0x1d1f17[_0x4f40('0x3e')][_0x4f40('0x3f')]?_0x1d1f17[_0x4f40('0x3e')]:_0x5a738a[_0x4f40('0x3c')];if(!_0x2563be[_0x4f40('0x3b')][_0x4f40('0x40')](_0x4f40('0x41'))){_0x1d1f17[_0x4f40('0x2c')]=qs[_0x4f40('0x2c')](_0x2563be[_0x4f40('0x3b')][_0x4f40('0x2c')]);_0x1d1f17['offset']=qs[_0x4f40('0x2b')](_0x2563be['query'][_0x4f40('0x2b')]);}_0x1d1f17['order']=qs[_0x4f40('0x42')](_0x2563be['query'][_0x4f40('0x42')]);_0x1d1f17[_0x4f40('0x43')]=qs[_0x4f40('0x44')](_['pick'](_0x2563be['query'],_0x5a738a['filters']),_0x290cef);if(_0x2563be[_0x4f40('0x3b')][_0x4f40('0x45')]){_0x1d1f17[_0x4f40('0x43')]=_[_0x4f40('0x46')](_0x1d1f17['where'],{'$or':_['map'](_0x290cef,function(_0x2c68c3){if(_0x2c68c3[_0x4f40('0x47')]!==_0x4f40('0x48')){var _0x50f09a={};_0x50f09a[_0x2c68c3[_0x4f40('0x35')]]={'$like':'%'+_0x2563be[_0x4f40('0x3b')][_0x4f40('0x45')]+'%'};return _0x50f09a;}})});}_0x1d1f17=_['merge']({},_0x1d1f17,_0x2563be[_0x4f40('0x49')]);var _0x3a49ad={'where':_0x1d1f17[_0x4f40('0x43')]};return db[_0x4f40('0x4a')][_0x4f40('0x2a')](_0x3a49ad)['then'](function(_0x58752a){_0x3ff9de[_0x4f40('0x2a')]=_0x58752a;if(_0x2563be[_0x4f40('0x3b')][_0x4f40('0x4b')]){_0x1d1f17['include']=[{'all':!![]}];}return db[_0x4f40('0x4a')]['findAll'](_0x1d1f17);})[_0x4f40('0x1f')](function(_0x5356fe){_0x3ff9de[_0x4f40('0x4c')]=_0x5356fe;return _0x3ff9de;})[_0x4f40('0x1f')](respondWithFilteredResult(_0x1d9693,_0x1d1f17))[_0x4f40('0x27')](handleError(_0x1d9693,null));};exports[_0x4f40('0x4d')]=function(_0x5a65e7,_0x42dfc4){var _0x33e8a2={'raw':![],'where':{'id':_0x5a65e7['params']['id']}},_0x4bdef6={};_0x4bdef6[_0x4f40('0x3c')]=_[_0x4f40('0x4e')](db['SalesforceAccount'][_0x4f40('0x39')]);_0x4bdef6[_0x4f40('0x3b')]=_[_0x4f40('0x4e')](_0x5a65e7['query']);_0x4bdef6['filters']=_[_0x4f40('0x3d')](_0x4bdef6[_0x4f40('0x3c')],_0x4bdef6[_0x4f40('0x3b')]);_0x33e8a2['attributes']=_[_0x4f40('0x3d')](_0x4bdef6[_0x4f40('0x3c')],qs[_0x4f40('0x4f')](_0x5a65e7['query'][_0x4f40('0x4f')]));_0x33e8a2[_0x4f40('0x3e')]=_0x33e8a2['attributes'][_0x4f40('0x3f')]?_0x33e8a2['attributes']:_0x4bdef6[_0x4f40('0x3c')];if(_0x5a65e7[_0x4f40('0x3b')][_0x4f40('0x4b')]){_0x33e8a2[_0x4f40('0x50')]=[{'all':!![]}];}_0x33e8a2=_[_0x4f40('0x46')]({},_0x33e8a2,_0x5a65e7[_0x4f40('0x49')]);return db[_0x4f40('0x4a')][_0x4f40('0x51')](_0x33e8a2)['then'](handleEntityNotFound(_0x42dfc4,null))['then'](respondWithResult(_0x42dfc4,null))[_0x4f40('0x27')](handleError(_0x42dfc4,null));};exports[_0x4f40('0x52')]=function(_0x519ee0,_0x3690f3){return db[_0x4f40('0x4a')]['create'](_0x519ee0[_0x4f40('0x53')],{})['then'](respondWithResult(_0x3690f3,0xc9))[_0x4f40('0x27')](handleError(_0x3690f3,null));};exports[_0x4f40('0x54')]=function(_0x536583,_0x3c3c66){if(_0x536583[_0x4f40('0x53')]['id']){delete _0x536583[_0x4f40('0x53')]['id'];}return db[_0x4f40('0x4a')][_0x4f40('0x51')]({'where':{'id':_0x536583[_0x4f40('0x55')]['id']}})[_0x4f40('0x1f')](handleEntityNotFound(_0x3c3c66,null))[_0x4f40('0x1f')](saveUpdates(_0x536583['body'],null))[_0x4f40('0x1f')](respondWithResult(_0x3c3c66,null))[_0x4f40('0x27')](handleError(_0x3c3c66,null));};exports[_0x4f40('0x32')]=function(_0x2464bf,_0x23ff24){return db[_0x4f40('0x4a')][_0x4f40('0x51')]({'where':{'id':_0x2464bf['params']['id']}})[_0x4f40('0x1f')](handleEntityNotFound(_0x23ff24,null))[_0x4f40('0x1f')](removeEntity(_0x23ff24,null))[_0x4f40('0x27')](handleError(_0x23ff24,null));};exports[_0x4f40('0x56')]=function(_0x2e46a1,_0x5c081a,_0x305753){var _0x2188d5={};var _0x4a98e6={};var _0x238db7;var _0x3324b3;return db['SalesforceAccount'][_0x4f40('0x57')]({'where':{'id':_0x2e46a1['params']['id']}})[_0x4f40('0x1f')](handleEntityNotFound(_0x5c081a,null))['then'](function(_0x53c191){if(_0x53c191){_0x238db7=_0x53c191;_0x4a98e6['model']=_['keys'](db[_0x4f40('0x58')][_0x4f40('0x39')]);_0x4a98e6[_0x4f40('0x3b')]=_[_0x4f40('0x4e')](_0x2e46a1[_0x4f40('0x3b')]);_0x4a98e6[_0x4f40('0x44')]=_[_0x4f40('0x3d')](_0x4a98e6['model'],_0x4a98e6[_0x4f40('0x3b')]);_0x2188d5['attributes']=_[_0x4f40('0x3d')](_0x4a98e6[_0x4f40('0x3c')],qs[_0x4f40('0x4f')](_0x2e46a1[_0x4f40('0x3b')][_0x4f40('0x4f')]));_0x2188d5[_0x4f40('0x3e')]=_0x2188d5[_0x4f40('0x3e')][_0x4f40('0x3f')]?_0x2188d5[_0x4f40('0x3e')]:_0x4a98e6[_0x4f40('0x3c')];_0x2188d5[_0x4f40('0x59')]=qs[_0x4f40('0x42')](_0x2e46a1[_0x4f40('0x3b')][_0x4f40('0x42')]);_0x2188d5[_0x4f40('0x43')]=qs[_0x4f40('0x44')](_[_0x4f40('0x5a')](_0x2e46a1[_0x4f40('0x3b')],_0x4a98e6[_0x4f40('0x44')]));if(_0x2e46a1[_0x4f40('0x3b')][_0x4f40('0x45')]){_0x2188d5[_0x4f40('0x43')]=_[_0x4f40('0x46')](_0x2188d5[_0x4f40('0x43')],{'$or':_[_0x4f40('0x38')](_0x2188d5[_0x4f40('0x3e')],function(_0x524c16){var _0x22111b={};_0x22111b[_0x524c16]={'$like':'%'+_0x2e46a1[_0x4f40('0x3b')][_0x4f40('0x45')]+'%'};return _0x22111b;})});}_0x2188d5=_['merge']({},_0x2188d5,_0x2e46a1[_0x4f40('0x49')]);return _0x238db7['getConfigurations'](_0x2188d5);}})['then'](function(_0x465c04){if(_0x465c04){_0x3324b3=_0x465c04[_0x4f40('0x3f')];if(!_0x2e46a1['query'][_0x4f40('0x40')](_0x4f40('0x41'))){_0x2188d5[_0x4f40('0x2c')]=qs['limit'](_0x2e46a1[_0x4f40('0x3b')]['limit']);_0x2188d5[_0x4f40('0x2b')]=qs[_0x4f40('0x2b')](_0x2e46a1['query'][_0x4f40('0x2b')]);}return _0x238db7[_0x4f40('0x56')](_0x2188d5);}})['then'](function(_0x3674b2){if(_0x3674b2){return _0x3674b2?{'count':_0x3324b3,'rows':_0x3674b2}:null;}})['then'](respondWithResult(_0x5c081a,null))[_0x4f40('0x27')](handleError(_0x5c081a,null));};exports[_0x4f40('0x5b')]=function(_0x3ff5bd,_0x6c87a4,_0x4d43df){if(_0x3ff5bd['body']['id']){delete _0x3ff5bd[_0x4f40('0x53')]['id'];}return db['SalesforceAccount'][_0x4f40('0x57')]({'where':{'id':_0x3ff5bd['params']['id']}})['then'](handleEntityNotFound(_0x6c87a4,null))[_0x4f40('0x1f')](function(_0x3f8928){if(_0x3f8928){_0x3ff5bd[_0x4f40('0x53')]['AccountId']=_0x3f8928['id'];_0x3ff5bd[_0x4f40('0x53')][_0x4f40('0x5c')]=integrations[_0x4f40('0x5d')](_0x3ff5bd[_0x4f40('0x53')][_0x4f40('0x5e')],_0x3ff5bd['body'][_0x4f40('0x47')]);_0x3ff5bd[_0x4f40('0x53')][_0x4f40('0x5f')]=integrations[_0x4f40('0x60')](_0x3ff5bd['body'][_0x4f40('0x5e')],_0x3ff5bd[_0x4f40('0x53')][_0x4f40('0x47')]);return db[_0x4f40('0x58')][_0x4f40('0x52')](_0x3ff5bd[_0x4f40('0x53')],{'include':[{'model':db[_0x4f40('0x61')],'as':_0x4f40('0x5c')},{'model':db['SalesforceField'],'as':_0x4f40('0x5f')}]});}return null;})['then'](respondWithResult(_0x6c87a4,null))['catch'](handleError(_0x6c87a4,null));};exports[_0x4f40('0x62')]=function(_0x2a182e,_0x4a73cc,_0x24d377){var _0x594e9f;var _0x51c1f5='';var _0x4b4694=_0x4f40('0x63');return db[_0x4f40('0x4a')]['findOne']({'where':{'id':_0x2a182e['params']['id']},'attributes':['id',_0x4f40('0x64'),_0x4f40('0x65'),_0x4f40('0x66'),_0x4f40('0x67'),_0x4f40('0x68'),_0x4f40('0x69')]})['then'](handleEntityNotFound(_0x4a73cc,null))[_0x4f40('0x1f')](function(_0x1801d0){if(_0x1801d0){_0x51c1f5=_0x1801d0[_0x4f40('0x64')];var _0x1e2279=_0x51c1f5[_0x4f40('0x6a')](-0x1);if(_0x1e2279==='/'){_0x51c1f5=_0x51c1f5[_0x4f40('0x6b')](0x0,_0x51c1f5['lastIndexOf'](_0x1e2279));}_0x594e9f=new jsforce[(_0x4f40('0x6c'))]({'oauth2':{'loginUrl':_0x51c1f5,'clientId':_0x1801d0[_0x4f40('0x65')],'clientSecret':_0x1801d0[_0x4f40('0x66')]}});return _0x594e9f[_0x4f40('0x6d')](_0x1801d0[_0x4f40('0x67')],_0x1801d0[_0x4f40('0x68')][_0x4f40('0x6e')](_0x1801d0['securityToken']));}})[_0x4f40('0x1f')](function(_0x3239ae){if(_0x3239ae){if(!_[_0x4f40('0x6f')](_0x2a182e['query'][_0x4f40('0x70')])){_0x4b4694=_0x2a182e[_0x4f40('0x3b')]['ticketType'];}return _0x594e9f['sobject'](_0x4b4694)[_0x4f40('0x71')]();}})['then'](function(_0x459564){var _0xf979d1=['CallDisposition','CallDurationInSeconds',_0x4f40('0x72'),'CallType',_0x4f40('0x73'),_0x4f40('0x74'),_0x4f40('0x75'),_0x4f40('0x76')];if(!_[_0x4f40('0x6f')](_0x2a182e[_0x4f40('0x3b')][_0x4f40('0x70')])&&_0x2a182e['query'][_0x4f40('0x70')]===_0x4f40('0x77')){_0xf979d1=[_0x4f40('0x76'),_0x4f40('0x78'),_0x4f40('0x79'),_0x4f40('0x75'),_0x4f40('0x74'),_0x4f40('0x7a'),_0x4f40('0x7b'),_0x4f40('0x7c')];}if(_0x459564){_[_0x4f40('0x7d')](_0x459564[_0x4f40('0x4f')],function(_0x424fb6){return _0x424fb6[_0x4f40('0x7e')]===![]&&!_0xf979d1[_0x4f40('0x7f')](_0x424fb6['name']);});return{'count':_0x459564[_0x4f40('0x4f')]['length'],'rows':_[_0x4f40('0x38')](_0x459564[_0x4f40('0x4f')],function(_0xb77add){return{'id':_0xb77add[_0x4f40('0x35')],'name':_0xb77add[_0x4f40('0x80')],'custom':_0xb77add['custom'],'options':_0xb77add[_0x4f40('0x81')][_0x4f40('0x3f')]>0x0?_['map'](_0xb77add[_0x4f40('0x81')],function(_0x6e8106){return{'name':_0x6e8106[_0x4f40('0x80')],'value':_0x6e8106[_0x4f40('0x82')]};}):_0xb77add[_0x4f40('0x47')]==_0x4f40('0x83')?[{'name':_0x4f40('0x84'),'value':_0x4f40('0x85')},{'name':_0x4f40('0x86'),'value':_0x4f40('0x87')}]:[]};})};}})[_0x4f40('0x1f')](respondWithResult(_0x4a73cc,null))[_0x4f40('0x27')](function(_0x1e96da){var _0x2a2759=_0x2a182e[_0x4f40('0x3b')][_0x4f40('0x1a')]?0x1f4:_0x1e96da['statusCode']||0x1f4;logger[_0x4f40('0x21')](_0x4f40('0x88'),_0x4f40('0x62'),_0x2a2759,JSON[_0x4f40('0x89')](_0x1e96da));delete _0x1e96da[_0x4f40('0x35')];if(_0x2a2759===0x191){_0x2a2759=0x190;}_0x4a73cc['status'](_0x2a2759)[_0x4f40('0x36')](_0x2a182e['query'][_0x4f40('0x1a')]?{'message':_0x4f40('0x8a'),'statusCode':_0x1e96da[_0x4f40('0x8b')]}:_0x1e96da);});}; \ No newline at end of file +var _0xfd25=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','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','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','SalesforceAccount','rawAttributes','type','key','model','map','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','body','params','getConfigurations','findOne','SalesforceConfiguration','length','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientSecret','username','password','slice','substring','lastIndexOf','clientId','login','concat','securityToken','isNil','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','Type','ticketType','Case','Origin','SuppliedName','remove','custom','picklistValues','label','value','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','rimraf'];(function(_0x4f8bd4,_0xec5450){var _0x4c4078=function(_0x5f04be){while(--_0x5f04be){_0x4f8bd4['push'](_0x4f8bd4['shift']());}};_0x4c4078(++_0xec5450);}(_0xfd25,0x88));var _0x5fd2=function(_0x4f1086,_0x32d642){_0x4f1086=_0x4f1086-0x0;var _0x1bbe11=_0xfd25[_0x4f1086];return _0x1bbe11;};'use strict';var pdf=require(_0x5fd2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5fd2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5fd2('0x2'));var rp=require(_0x5fd2('0x3'));var moment=require(_0x5fd2('0x4'));var BPromise=require(_0x5fd2('0x5'));var Mustache=require(_0x5fd2('0x6'));var util=require('util');var path=require(_0x5fd2('0x7'));var sox=require(_0x5fd2('0x8'));var csv=require(_0x5fd2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5fd2('0xa'));var crypto=require(_0x5fd2('0xb'));var jsforce=require(_0x5fd2('0xc'));var deskjs=require(_0x5fd2('0xd'));var toCsv=require(_0x5fd2('0x9'));var querystring=require('querystring');var Papa=require(_0x5fd2('0xe'));var Redis=require(_0x5fd2('0xf'));var authService=require(_0x5fd2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5fd2('0x11'));var hardwareService=require(_0x5fd2('0x12'));var logger=require(_0x5fd2('0x13'))(_0x5fd2('0x14'));var utils=require(_0x5fd2('0x15'));var config=require(_0x5fd2('0x16'));var db=require(_0x5fd2('0x17'))['db'];var integrations=require(_0x5fd2('0x18'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5fd2('0x19')]({'port':0x232a});function checkPasswordPattern(_0x120b35,_0x4aaa37,_0x79b183){if(_0x79b183){var _0x500063=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x500063[_0x5fd2('0x1a')](_0x4aaa37)){return _0x120b35;}else{throw new db['Sequelize'][(_0x5fd2('0x1b'))](_0x5fd2('0x1c'));}}else{return _0x120b35;}}function respondWithRpcPromise(_0xfeddda,_0x21249d,_0x57c8cd,_0x3542d5){return new BPromise(function(_0x248ed5,_0x535881){var _0x55ce67=_0x3542d5||client;return _0x55ce67[_0x5fd2('0x1d')](_0xfeddda,_0x57c8cd)['then'](function(_0x2a9fba){logger['info'](_0x5fd2('0x1e'),_0x21249d,_0x5fd2('0x1f'));logger[_0x5fd2('0x20')](_0x5fd2('0x21'),_0x21249d,'request\x20sent',JSON[_0x5fd2('0x22')](_0x2a9fba));if(_0x2a9fba[_0x5fd2('0x23')]){if(_0x2a9fba['error']['code']===0x1f4){logger[_0x5fd2('0x23')](_0x5fd2('0x1e'),_0x21249d,_0x2a9fba[_0x5fd2('0x23')][_0x5fd2('0x24')]);return _0x535881(_0x2a9fba[_0x5fd2('0x23')]['message']);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x21249d,_0x2a9fba[_0x5fd2('0x23')][_0x5fd2('0x24')]);return _0x248ed5(_0x2a9fba[_0x5fd2('0x23')][_0x5fd2('0x24')]);}else{logger['info'](_0x5fd2('0x1e'),_0x21249d,_0x5fd2('0x1f'));_0x248ed5(_0x2a9fba[_0x5fd2('0x25')][_0x5fd2('0x24')]);}})[_0x5fd2('0x26')](function(_0x494963){logger[_0x5fd2('0x23')](_0x5fd2('0x1e'),_0x21249d,_0x494963);_0x535881(_0x494963);});});}function respondWithStatusCode(_0x424f6d,_0x3c8c7a){_0x3c8c7a=_0x3c8c7a||0xcc;return function(_0x11b78f){if(_0x11b78f){return _0x424f6d['sendStatus'](_0x3c8c7a);}return _0x424f6d['status'](_0x3c8c7a)[_0x5fd2('0x27')]();};}function respondWithResult(_0x2d7388,_0x598715){_0x598715=_0x598715||0xc8;return function(_0x4fb514){if(_0x4fb514){return _0x2d7388[_0x5fd2('0x28')](_0x598715)[_0x5fd2('0x29')](_0x4fb514);}};}function respondWithFilteredResult(_0x350e32,_0x1454f4){return function(_0x4c01c6){if(_0x4c01c6){var _0x1784aa=_0x4c01c6[_0x5fd2('0x2a')],_0x1debf8=_0x1454f4[_0x5fd2('0x2b')],_0x472c97=_0x1454f4[_0x5fd2('0x2b')]+_0x1454f4[_0x5fd2('0x2c')],_0x411431;if(_0x472c97>=_0x1784aa){_0x472c97=_0x1784aa;_0x411431=0xc8;}else{_0x411431=0xce;}_0x350e32[_0x5fd2('0x28')](_0x411431);return _0x350e32['set'](_0x5fd2('0x2d'),_0x1debf8+'-'+_0x472c97+'/'+_0x1784aa)[_0x5fd2('0x29')](_0x4c01c6);}return null;};}function patchUpdates(_0x5c8257){return function(_0x167be4){try{jsonpatch[_0x5fd2('0x2e')](_0x167be4,_0x5c8257,!![]);}catch(_0x11763b){return BPromise[_0x5fd2('0x2f')](_0x11763b);}return _0x167be4[_0x5fd2('0x30')]();};}function saveUpdates(_0x22e636,_0x4c3676){return function(_0x44f13d){if(_0x44f13d){return _0x44f13d[_0x5fd2('0x31')](_0x22e636)[_0x5fd2('0x32')](function(_0x1694aa){return _0x1694aa;});}return null;};}function removeEntity(_0x5f0672,_0x4fa739){return function(_0x3d46f1){if(_0x3d46f1){return _0x3d46f1['destroy']()[_0x5fd2('0x32')](function(){_0x5f0672['status'](0xcc)[_0x5fd2('0x27')]();});}};}function handleEntityNotFound(_0x2b3198,_0x402c16){return function(_0x5024f1){if(!_0x5024f1){_0x2b3198[_0x5fd2('0x33')](0x194);}return _0x5024f1;};}function handleError(_0xf99049,_0x5bfca6){_0x5bfca6=_0x5bfca6||0x1f4;return function(_0x2ae0dd){logger[_0x5fd2('0x23')](_0x2ae0dd[_0x5fd2('0x34')]);if(_0x2ae0dd[_0x5fd2('0x35')]){delete _0x2ae0dd[_0x5fd2('0x35')];}_0xf99049[_0x5fd2('0x28')](_0x5bfca6)[_0x5fd2('0x36')](_0x2ae0dd);};}exports['index']=function(_0x1f9951,_0x5de456){var _0x3b5473={},_0x345a4b={},_0x326983={'count':0x0,'rows':[]};var _0xf07717=_['map'](db[_0x5fd2('0x37')][_0x5fd2('0x38')],function(_0x110b9c){return{'name':_0x110b9c['fieldName'],'type':_0x110b9c[_0x5fd2('0x39')][_0x5fd2('0x3a')]};});_0x345a4b[_0x5fd2('0x3b')]=_[_0x5fd2('0x3c')](_0xf07717,_0x5fd2('0x35'));_0x345a4b['query']=_['keys'](_0x1f9951['query']);_0x345a4b[_0x5fd2('0x3d')]=_[_0x5fd2('0x3e')](_0x345a4b[_0x5fd2('0x3b')],_0x345a4b[_0x5fd2('0x3f')]);_0x3b5473['attributes']=_['intersection'](_0x345a4b[_0x5fd2('0x3b')],qs[_0x5fd2('0x40')](_0x1f9951[_0x5fd2('0x3f')][_0x5fd2('0x40')]));_0x3b5473[_0x5fd2('0x41')]=_0x3b5473[_0x5fd2('0x41')]['length']?_0x3b5473[_0x5fd2('0x41')]:_0x345a4b['model'];if(!_0x1f9951[_0x5fd2('0x3f')][_0x5fd2('0x42')](_0x5fd2('0x43'))){_0x3b5473[_0x5fd2('0x2c')]=qs[_0x5fd2('0x2c')](_0x1f9951[_0x5fd2('0x3f')][_0x5fd2('0x2c')]);_0x3b5473[_0x5fd2('0x2b')]=qs[_0x5fd2('0x2b')](_0x1f9951['query'][_0x5fd2('0x2b')]);}_0x3b5473[_0x5fd2('0x44')]=qs[_0x5fd2('0x45')](_0x1f9951[_0x5fd2('0x3f')][_0x5fd2('0x45')]);_0x3b5473[_0x5fd2('0x46')]=qs[_0x5fd2('0x3d')](_[_0x5fd2('0x47')](_0x1f9951[_0x5fd2('0x3f')],_0x345a4b[_0x5fd2('0x3d')]),_0xf07717);if(_0x1f9951[_0x5fd2('0x3f')][_0x5fd2('0x48')]){_0x3b5473['where']=_[_0x5fd2('0x49')](_0x3b5473[_0x5fd2('0x46')],{'$or':_[_0x5fd2('0x3c')](_0xf07717,function(_0x141e84){if(_0x141e84[_0x5fd2('0x39')]!==_0x5fd2('0x4a')){var _0x1c7673={};_0x1c7673[_0x141e84['name']]={'$like':'%'+_0x1f9951[_0x5fd2('0x3f')][_0x5fd2('0x48')]+'%'};return _0x1c7673;}})});}_0x3b5473=_['merge']({},_0x3b5473,_0x1f9951[_0x5fd2('0x4b')]);var _0x2d663f={'where':_0x3b5473['where']};return db[_0x5fd2('0x37')][_0x5fd2('0x2a')](_0x2d663f)[_0x5fd2('0x32')](function(_0x2cf40c){_0x326983[_0x5fd2('0x2a')]=_0x2cf40c;if(_0x1f9951[_0x5fd2('0x3f')][_0x5fd2('0x4c')]){_0x3b5473[_0x5fd2('0x4d')]=[{'all':!![]}];}return db[_0x5fd2('0x37')][_0x5fd2('0x4e')](_0x3b5473);})[_0x5fd2('0x32')](function(_0x1a6f4f){_0x326983[_0x5fd2('0x4f')]=_0x1a6f4f;return _0x326983;})['then'](respondWithFilteredResult(_0x5de456,_0x3b5473))[_0x5fd2('0x26')](handleError(_0x5de456,null));};exports[_0x5fd2('0x50')]=function(_0x57a535,_0x255118){var _0x1420e1={'raw':![],'where':{'id':_0x57a535['params']['id']}},_0x109301={};_0x109301[_0x5fd2('0x3b')]=_[_0x5fd2('0x51')](db[_0x5fd2('0x37')]['rawAttributes']);_0x109301['query']=_[_0x5fd2('0x51')](_0x57a535[_0x5fd2('0x3f')]);_0x109301[_0x5fd2('0x3d')]=_[_0x5fd2('0x3e')](_0x109301['model'],_0x109301['query']);_0x1420e1['attributes']=_[_0x5fd2('0x3e')](_0x109301[_0x5fd2('0x3b')],qs[_0x5fd2('0x40')](_0x57a535[_0x5fd2('0x3f')][_0x5fd2('0x40')]));_0x1420e1['attributes']=_0x1420e1[_0x5fd2('0x41')]['length']?_0x1420e1[_0x5fd2('0x41')]:_0x109301[_0x5fd2('0x3b')];if(_0x57a535['query'][_0x5fd2('0x4c')]){_0x1420e1['include']=[{'all':!![]}];}_0x1420e1=_[_0x5fd2('0x49')]({},_0x1420e1,_0x57a535[_0x5fd2('0x4b')]);return db['SalesforceAccount'][_0x5fd2('0x52')](_0x1420e1)['then'](handleEntityNotFound(_0x255118,null))[_0x5fd2('0x32')](respondWithResult(_0x255118,null))['catch'](handleError(_0x255118,null));};exports['create']=function(_0x28e6cd,_0x403401){return db[_0x5fd2('0x37')][_0x5fd2('0x53')](_0x28e6cd['body'],{})['then'](respondWithResult(_0x403401,0xc9))[_0x5fd2('0x26')](handleError(_0x403401,null));};exports[_0x5fd2('0x31')]=function(_0x4bdf85,_0x326cab){if(_0x4bdf85[_0x5fd2('0x54')]['id']){delete _0x4bdf85[_0x5fd2('0x54')]['id'];}return db['SalesforceAccount'][_0x5fd2('0x52')]({'where':{'id':_0x4bdf85[_0x5fd2('0x55')]['id']}})[_0x5fd2('0x32')](handleEntityNotFound(_0x326cab,null))[_0x5fd2('0x32')](saveUpdates(_0x4bdf85['body'],null))['then'](respondWithResult(_0x326cab,null))[_0x5fd2('0x26')](handleError(_0x326cab,null));};exports['destroy']=function(_0x26695d,_0x23c406){return db[_0x5fd2('0x37')][_0x5fd2('0x52')]({'where':{'id':_0x26695d['params']['id']}})['then'](handleEntityNotFound(_0x23c406,null))[_0x5fd2('0x32')](removeEntity(_0x23c406,null))['catch'](handleError(_0x23c406,null));};exports[_0x5fd2('0x56')]=function(_0x48209f,_0xb62ae8,_0x1cbfd9){var _0x2bacdc={};var _0x8591a1={};var _0x1c44ab;var _0x504088;return db[_0x5fd2('0x37')][_0x5fd2('0x57')]({'where':{'id':_0x48209f[_0x5fd2('0x55')]['id']}})[_0x5fd2('0x32')](handleEntityNotFound(_0xb62ae8,null))['then'](function(_0x11dbeb){if(_0x11dbeb){_0x1c44ab=_0x11dbeb;_0x8591a1[_0x5fd2('0x3b')]=_[_0x5fd2('0x51')](db[_0x5fd2('0x58')]['rawAttributes']);_0x8591a1['query']=_['keys'](_0x48209f[_0x5fd2('0x3f')]);_0x8591a1[_0x5fd2('0x3d')]=_[_0x5fd2('0x3e')](_0x8591a1[_0x5fd2('0x3b')],_0x8591a1[_0x5fd2('0x3f')]);_0x2bacdc[_0x5fd2('0x41')]=_[_0x5fd2('0x3e')](_0x8591a1[_0x5fd2('0x3b')],qs[_0x5fd2('0x40')](_0x48209f['query']['fields']));_0x2bacdc[_0x5fd2('0x41')]=_0x2bacdc[_0x5fd2('0x41')]['length']?_0x2bacdc['attributes']:_0x8591a1[_0x5fd2('0x3b')];_0x2bacdc[_0x5fd2('0x44')]=qs['sort'](_0x48209f[_0x5fd2('0x3f')][_0x5fd2('0x45')]);_0x2bacdc[_0x5fd2('0x46')]=qs[_0x5fd2('0x3d')](_[_0x5fd2('0x47')](_0x48209f[_0x5fd2('0x3f')],_0x8591a1[_0x5fd2('0x3d')]));if(_0x48209f[_0x5fd2('0x3f')]['filter']){_0x2bacdc['where']=_[_0x5fd2('0x49')](_0x2bacdc[_0x5fd2('0x46')],{'$or':_[_0x5fd2('0x3c')](_0x2bacdc[_0x5fd2('0x41')],function(_0x558edf){var _0xf64916={};_0xf64916[_0x558edf]={'$like':'%'+_0x48209f[_0x5fd2('0x3f')][_0x5fd2('0x48')]+'%'};return _0xf64916;})});}_0x2bacdc=_[_0x5fd2('0x49')]({},_0x2bacdc,_0x48209f['options']);return _0x1c44ab['getConfigurations'](_0x2bacdc);}})[_0x5fd2('0x32')](function(_0x3f4e51){if(_0x3f4e51){_0x504088=_0x3f4e51[_0x5fd2('0x59')];if(!_0x48209f[_0x5fd2('0x3f')][_0x5fd2('0x42')](_0x5fd2('0x43'))){_0x2bacdc[_0x5fd2('0x2c')]=qs[_0x5fd2('0x2c')](_0x48209f[_0x5fd2('0x3f')][_0x5fd2('0x2c')]);_0x2bacdc[_0x5fd2('0x2b')]=qs[_0x5fd2('0x2b')](_0x48209f[_0x5fd2('0x3f')][_0x5fd2('0x2b')]);}return _0x1c44ab['getConfigurations'](_0x2bacdc);}})[_0x5fd2('0x32')](function(_0x2f8179){if(_0x2f8179){return _0x2f8179?{'count':_0x504088,'rows':_0x2f8179}:null;}})[_0x5fd2('0x32')](respondWithResult(_0xb62ae8,null))['catch'](handleError(_0xb62ae8,null));};exports[_0x5fd2('0x5a')]=function(_0x32f017,_0x1a8149,_0x1f7d5b){if(_0x32f017['body']['id']){delete _0x32f017[_0x5fd2('0x54')]['id'];}return db[_0x5fd2('0x37')][_0x5fd2('0x57')]({'where':{'id':_0x32f017['params']['id']}})[_0x5fd2('0x32')](handleEntityNotFound(_0x1a8149,null))[_0x5fd2('0x32')](function(_0x57800a){if(_0x57800a){_0x32f017[_0x5fd2('0x54')][_0x5fd2('0x5b')]=_0x57800a['id'];_0x32f017[_0x5fd2('0x54')][_0x5fd2('0x5c')]=integrations[_0x5fd2('0x5d')](_0x32f017[_0x5fd2('0x54')][_0x5fd2('0x5e')],_0x32f017[_0x5fd2('0x54')]['type']);_0x32f017[_0x5fd2('0x54')][_0x5fd2('0x5f')]=integrations[_0x5fd2('0x60')](_0x32f017[_0x5fd2('0x54')][_0x5fd2('0x5e')],_0x32f017[_0x5fd2('0x54')][_0x5fd2('0x39')]);return db['SalesforceConfiguration'][_0x5fd2('0x53')](_0x32f017[_0x5fd2('0x54')],{'include':[{'model':db[_0x5fd2('0x61')],'as':_0x5fd2('0x5c')},{'model':db[_0x5fd2('0x61')],'as':_0x5fd2('0x5f')}]});}return null;})[_0x5fd2('0x32')](respondWithResult(_0x1a8149,null))[_0x5fd2('0x26')](handleError(_0x1a8149,null));};exports['getFields']=function(_0x6c5b82,_0x934ac3,_0x3f1806){var _0x901eb3;var _0xcd6682='';var _0x178cc5=_0x5fd2('0x62');return db[_0x5fd2('0x37')][_0x5fd2('0x57')]({'where':{'id':_0x6c5b82[_0x5fd2('0x55')]['id']},'attributes':['id',_0x5fd2('0x63'),'clientId',_0x5fd2('0x64'),_0x5fd2('0x65'),_0x5fd2('0x66'),'securityToken']})[_0x5fd2('0x32')](handleEntityNotFound(_0x934ac3,null))[_0x5fd2('0x32')](function(_0x222875){if(_0x222875){_0xcd6682=_0x222875['remoteUri'];var _0x715a9d=_0xcd6682[_0x5fd2('0x67')](-0x1);if(_0x715a9d==='/'){_0xcd6682=_0xcd6682[_0x5fd2('0x68')](0x0,_0xcd6682[_0x5fd2('0x69')](_0x715a9d));}_0x901eb3=new jsforce['Connection']({'oauth2':{'loginUrl':_0xcd6682,'clientId':_0x222875[_0x5fd2('0x6a')],'clientSecret':_0x222875['clientSecret']}});return _0x901eb3[_0x5fd2('0x6b')](_0x222875['username'],_0x222875['password'][_0x5fd2('0x6c')](_0x222875[_0x5fd2('0x6d')]));}})[_0x5fd2('0x32')](function(_0xe57ac7){if(_0xe57ac7){if(!_[_0x5fd2('0x6e')](_0x6c5b82['query']['ticketType'])){_0x178cc5=_0x6c5b82['query']['ticketType'];}return _0x901eb3[_0x5fd2('0x6f')](_0x178cc5)[_0x5fd2('0x70')]();}})[_0x5fd2('0x32')](function(_0x5ab8d8){var _0x478067=[_0x5fd2('0x71'),_0x5fd2('0x72'),_0x5fd2('0x73'),_0x5fd2('0x74'),_0x5fd2('0x75'),_0x5fd2('0x76'),_0x5fd2('0x77'),_0x5fd2('0x78')];if(!_['isNil'](_0x6c5b82[_0x5fd2('0x3f')][_0x5fd2('0x79')])&&_0x6c5b82[_0x5fd2('0x3f')]['ticketType']===_0x5fd2('0x7a')){_0x478067=[_0x5fd2('0x78'),_0x5fd2('0x7b'),'Reason',_0x5fd2('0x77'),'Priority','IsEscalated',_0x5fd2('0x7c'),'SuppliedCompany'];}if(_0x5ab8d8){_[_0x5fd2('0x7d')](_0x5ab8d8[_0x5fd2('0x40')],function(_0x1335af){return _0x1335af[_0x5fd2('0x7e')]===![]&&!_0x478067['includes'](_0x1335af['name']);});return{'count':_0x5ab8d8['fields']['length'],'rows':_[_0x5fd2('0x3c')](_0x5ab8d8[_0x5fd2('0x40')],function(_0x3ec504){return{'id':_0x3ec504[_0x5fd2('0x35')],'name':_0x3ec504['label'],'custom':_0x3ec504[_0x5fd2('0x7e')],'options':_0x3ec504[_0x5fd2('0x7f')][_0x5fd2('0x59')]>0x0?_['map'](_0x3ec504['picklistValues'],function(_0x5e3d28){return{'name':_0x5e3d28[_0x5fd2('0x80')],'value':_0x5e3d28[_0x5fd2('0x81')]};}):_0x3ec504['type']=='boolean'?[{'name':_0x5fd2('0x82'),'value':_0x5fd2('0x83')},{'name':_0x5fd2('0x84'),'value':_0x5fd2('0x85')}]:[]};})};}})[_0x5fd2('0x32')](respondWithResult(_0x934ac3,null))['catch'](function(_0x4cc633){var _0x546e23=_0x6c5b82[_0x5fd2('0x3f')][_0x5fd2('0x1a')]?0x1f4:_0x4cc633[_0x5fd2('0x86')]||0x1f4;logger[_0x5fd2('0x23')](_0x5fd2('0x87'),_0x5fd2('0x88'),_0x546e23,JSON['stringify'](_0x4cc633));delete _0x4cc633['name'];if(_0x546e23===0x191){_0x546e23=0x190;}_0x934ac3[_0x5fd2('0x28')](_0x546e23)['send'](_0x6c5b82[_0x5fd2('0x3f')][_0x5fd2('0x1a')]?{'message':_0x5fd2('0x89'),'statusCode':_0x4cc633[_0x5fd2('0x86')]}:_0x4cc633);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index df23125..8ad0707 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 _0xdff7=['api','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','int_salesforce_accounts','util','../../config/logger'];(function(_0x4dce6a,_0x395a1e){var _0x2018cf=function(_0x4e0364){while(--_0x4e0364){_0x4dce6a['push'](_0x4dce6a['shift']());}};_0x2018cf(++_0x395a1e);}(_0xdff7,0x166));var _0x7dff=function(_0x1d11f3,_0x185790){_0x1d11f3=_0x1d11f3-0x0;var _0x5223ee=_0xdff7[_0x1d11f3];return _0x5223ee;};'use strict';var _=require('lodash');var util=require(_0x7dff('0x0'));var logger=require(_0x7dff('0x1'))(_0x7dff('0x2'));var moment=require('moment');var BPromise=require(_0x7dff('0x3'));var rp=require(_0x7dff('0x4'));var fs=require('fs');var path=require(_0x7dff('0x5'));var rimraf=require('rimraf');var config=require(_0x7dff('0x6'));var attributes=require(_0x7dff('0x7'));var integrations=require(_0x7dff('0x8'));module[_0x7dff('0x9')]=function(_0x541187,_0x591ff7){return _0x541187[_0x7dff('0xa')]('SalesforceAccount',attributes,{'tableName':_0x7dff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9a8=['SalesforceAccount','int_salesforce_accounts','lodash','api','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xc9a8,0x65));var _0x8c9a=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0xc9a8[_0x441563];return _0x2369ec;};'use strict';var _=require(_0x8c9a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8c9a('0x1'));var moment=require('moment');var BPromise=require(_0x8c9a('0x2'));var rp=require(_0x8c9a('0x3'));var fs=require('fs');var path=require(_0x8c9a('0x4'));var rimraf=require('rimraf');var config=require(_0x8c9a('0x5'));var attributes=require(_0x8c9a('0x6'));var integrations=require(_0x8c9a('0x7'));module[_0x8c9a('0x8')]=function(_0xa2ccfc,_0x435346){return _0xa2ccfc['define'](_0x8c9a('0x9'),attributes,{'tableName':_0x8c9a('0xa'),'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 bbfadb7..a11848e 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 _0x6f7a=['then','info','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','SalesforceAccount','options','raw','where','attributes','include','model','map','GetSalesforceAccount','ShowSalesforceAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x56f9f8,_0x28498e){var _0x9728f3=function(_0x4c9295){while(--_0x4c9295){_0x56f9f8['push'](_0x56f9f8['shift']());}};_0x9728f3(++_0x28498e);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x255179,_0x461bd3){_0x255179=_0x255179-0x0;var _0x5999a2=_0x6f7a[_0x255179];return _0x5999a2;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var moment=require(_0xa6f7('0x2'));var BPromise=require(_0xa6f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6f7('0x4'));var db=require(_0xa6f7('0x5'))['db'];var utils=require(_0xa6f7('0x6'));var logger=require(_0xa6f7('0x7'))(_0xa6f7('0x8'));var config=require(_0xa6f7('0x9'));var jayson=require(_0xa6f7('0xa'));var client=jayson[_0xa6f7('0xb')][_0xa6f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x335aaa,_0x1a06d1,_0x481a8c){return new BPromise(function(_0x4b4f9e,_0x30f2a7){return client[_0xa6f7('0xd')](_0x335aaa,_0x481a8c)[_0xa6f7('0xe')](function(_0x362404){logger[_0xa6f7('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x1a06d1,'request\x20sent');logger[_0xa6f7('0x10')](_0xa6f7('0x11'),_0x1a06d1,'request\x20sent',JSON[_0xa6f7('0x12')](_0x362404));if(_0x362404['error']){if(_0x362404[_0xa6f7('0x13')][_0xa6f7('0x14')]===0x1f4){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x30f2a7(_0x362404['error'][_0xa6f7('0x16')]);}logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x4b4f9e(_0x362404['error'][_0xa6f7('0x16')]);}else{logger['info'](_0xa6f7('0x15'),_0x1a06d1,_0xa6f7('0x17'));_0x4b4f9e(_0x362404[_0xa6f7('0x18')]['message']);}})[_0xa6f7('0x19')](function(_0x22635e){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x22635e);_0x30f2a7(_0x22635e);});});}exports['GetSalesforceAccount']=function(_0x4a8827){var _0xba7755=this;return new Promise(function(_0x5298ba,_0x378967){return db[_0xa6f7('0x1a')]['findAll']({'raw':_0x4a8827[_0xa6f7('0x1b')]?_0x4a8827[_0xa6f7('0x1b')][_0xa6f7('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a8827[_0xa6f7('0x1b')]?_0x4a8827[_0xa6f7('0x1b')][_0xa6f7('0x1d')]||null:null,'attributes':_0x4a8827['options']?_0x4a8827[_0xa6f7('0x1b')][_0xa6f7('0x1e')]||null:null,'limit':_0x4a8827['options']?_0x4a8827['options']['limit']||null:null,'include':_0x4a8827[_0xa6f7('0x1b')]?_0x4a8827[_0xa6f7('0x1b')]['include']?_['map'](_0x4a8827['options'][_0xa6f7('0x1f')],function(_0xc77e8e){return{'model':db[_0xc77e8e[_0xa6f7('0x20')]],'as':_0xc77e8e['as'],'attributes':_0xc77e8e['attributes'],'include':_0xc77e8e['include']?_[_0xa6f7('0x21')](_0xc77e8e['include'],function(_0x47ef97){return{'model':db[_0x47ef97[_0xa6f7('0x20')]],'as':_0x47ef97['as'],'attributes':_0x47ef97['attributes'],'include':_0x47ef97[_0xa6f7('0x1f')]?_[_0xa6f7('0x21')](_0x47ef97[_0xa6f7('0x1f')],function(_0x2b4c6c){return{'model':db[_0x2b4c6c[_0xa6f7('0x20')]],'as':_0x2b4c6c['as'],'attributes':_0x2b4c6c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c419b){logger[_0xa6f7('0xf')]('GetSalesforceAccount',_0x4a8827);logger[_0xa6f7('0x10')](_0xa6f7('0x22'),_0x4a8827,JSON[_0xa6f7('0x12')](_0x1c419b));_0x5298ba(_0x1c419b);})[_0xa6f7('0x19')](function(_0x224f5a){logger[_0xa6f7('0x13')](_0xa6f7('0x22'),_0x224f5a[_0xa6f7('0x16')],_0x4a8827);_0x378967(_0xba7755[_0xa6f7('0x13')](0x1f4,_0x224f5a[_0xa6f7('0x16')]));});});};exports[_0xa6f7('0x23')]=function(_0x278bad){var _0x52f9c1=this;return new Promise(function(_0x442ccf,_0x42dc49){return db['SalesforceAccount'][_0xa6f7('0x24')]({'raw':_0x278bad[_0xa6f7('0x1b')]?_0x278bad['options']['raw']===undefined?!![]:![]:!![],'where':_0x278bad[_0xa6f7('0x1b')]?_0x278bad[_0xa6f7('0x1b')][_0xa6f7('0x1d')]||null:null,'attributes':_0x278bad[_0xa6f7('0x1b')]?_0x278bad[_0xa6f7('0x1b')]['attributes']||null:null,'include':_0x278bad['options']?_0x278bad[_0xa6f7('0x1b')]['include']?_[_0xa6f7('0x21')](_0x278bad[_0xa6f7('0x1b')][_0xa6f7('0x1f')],function(_0x237e5d){return{'model':db[_0x237e5d[_0xa6f7('0x20')]],'as':_0x237e5d['as'],'attributes':_0x237e5d[_0xa6f7('0x1e')],'include':_0x237e5d['include']?_[_0xa6f7('0x21')](_0x237e5d[_0xa6f7('0x1f')],function(_0x1a5de5){return{'model':db[_0x1a5de5['model']],'as':_0x1a5de5['as'],'attributes':_0x1a5de5[_0xa6f7('0x1e')],'include':_0x1a5de5['include']?_[_0xa6f7('0x21')](_0x1a5de5[_0xa6f7('0x1f')],function(_0x45837c){return{'model':db[_0x45837c['model']],'as':_0x45837c['as'],'attributes':_0x45837c[_0xa6f7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa6f7('0xe')](function(_0x3b3bc2){logger[_0xa6f7('0xf')](_0xa6f7('0x23'),_0x278bad);logger[_0xa6f7('0x10')]('ShowSalesforceAccount',_0x278bad,JSON[_0xa6f7('0x12')](_0x3b3bc2));_0x442ccf(_0x3b3bc2);})[_0xa6f7('0x19')](function(_0xc25a1b){logger[_0xa6f7('0x13')](_0xa6f7('0x23'),_0xc25a1b[_0xa6f7('0x16')],_0x278bad);_0x42dc49(_0x52f9c1[_0xa6f7('0x13')](0x1f4,_0xc25a1b[_0xa6f7('0x16')]));});});}; \ No newline at end of file +var _0xc6d8=['randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','findAll','options','raw','model','attributes','map','include','then','GetSalesforceAccount','ShowSalesforceAccount','SalesforceAccount','find','lodash','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc6d8,0xd7));var _0x8c6d=function(_0xcc2c66,_0x27cf7b){_0xcc2c66=_0xcc2c66-0x0;var _0x2197b2=_0xc6d8[_0xcc2c66];return _0x2197b2;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var moment=require(_0x8c6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c6d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c6d('0x4'));var config=require(_0x8c6d('0x5'));var jayson=require(_0x8c6d('0x6'));var client=jayson[_0x8c6d('0x7')][_0x8c6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dbb52,_0x98cae4,_0x5529f1){return new BPromise(function(_0x1496ba,_0x75c49f){return client[_0x8c6d('0x9')](_0x2dbb52,_0x5529f1)['then'](function(_0x3cecc1){logger[_0x8c6d('0xa')](_0x8c6d('0xb'),_0x98cae4,_0x8c6d('0xc'));logger[_0x8c6d('0xd')](_0x8c6d('0xe'),_0x98cae4,_0x8c6d('0xc'),JSON[_0x8c6d('0xf')](_0x3cecc1));if(_0x3cecc1['error']){if(_0x3cecc1[_0x8c6d('0x10')]['code']===0x1f4){logger['error'](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x75c49f(_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);}logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x1496ba(_0x3cecc1[_0x8c6d('0x10')]['message']);}else{logger[_0x8c6d('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0x98cae4,_0x8c6d('0xc'));_0x1496ba(_0x3cecc1['result'][_0x8c6d('0x11')]);}})[_0x8c6d('0x12')](function(_0x52ed7b){logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x52ed7b);_0x75c49f(_0x52ed7b);});});}exports['GetSalesforceAccount']=function(_0x3e5495){var _0x5a22de=this;return new Promise(function(_0x4c2f8d,_0x21b8ee){return db['SalesforceAccount'][_0x8c6d('0x13')]({'raw':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495[_0x8c6d('0x14')][_0x8c6d('0x15')]===undefined?!![]:![]:!![],'where':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495['options']['where']||null:null,'attributes':_0x3e5495['options']?_0x3e5495[_0x8c6d('0x14')]['attributes']||null:null,'limit':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495['options']['limit']||null:null,'include':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495[_0x8c6d('0x14')]['include']?_['map'](_0x3e5495['options']['include'],function(_0x2a85b5){return{'model':db[_0x2a85b5[_0x8c6d('0x16')]],'as':_0x2a85b5['as'],'attributes':_0x2a85b5[_0x8c6d('0x17')],'include':_0x2a85b5['include']?_[_0x8c6d('0x18')](_0x2a85b5['include'],function(_0x15a9c4){return{'model':db[_0x15a9c4['model']],'as':_0x15a9c4['as'],'attributes':_0x15a9c4[_0x8c6d('0x17')],'include':_0x15a9c4[_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x15a9c4[_0x8c6d('0x19')],function(_0x1e6755){return{'model':db[_0x1e6755[_0x8c6d('0x16')]],'as':_0x1e6755['as'],'attributes':_0x1e6755[_0x8c6d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8c6d('0x1a')](function(_0x3eab38){logger['info']('GetSalesforceAccount',_0x3e5495);logger[_0x8c6d('0xd')](_0x8c6d('0x1b'),_0x3e5495,JSON[_0x8c6d('0xf')](_0x3eab38));_0x4c2f8d(_0x3eab38);})[_0x8c6d('0x12')](function(_0x370626){logger[_0x8c6d('0x10')](_0x8c6d('0x1b'),_0x370626[_0x8c6d('0x11')],_0x3e5495);_0x21b8ee(_0x5a22de[_0x8c6d('0x10')](0x1f4,_0x370626[_0x8c6d('0x11')]));});});};exports[_0x8c6d('0x1c')]=function(_0x15a508){var _0x4e5203=this;return new Promise(function(_0x3af625,_0x332f6a){return db[_0x8c6d('0x1d')][_0x8c6d('0x1e')]({'raw':_0x15a508[_0x8c6d('0x14')]?_0x15a508[_0x8c6d('0x14')][_0x8c6d('0x15')]===undefined?!![]:![]:!![],'where':_0x15a508[_0x8c6d('0x14')]?_0x15a508[_0x8c6d('0x14')]['where']||null:null,'attributes':_0x15a508[_0x8c6d('0x14')]?_0x15a508['options'][_0x8c6d('0x17')]||null:null,'include':_0x15a508[_0x8c6d('0x14')]?_0x15a508[_0x8c6d('0x14')][_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x15a508[_0x8c6d('0x14')]['include'],function(_0x5ae56b){return{'model':db[_0x5ae56b[_0x8c6d('0x16')]],'as':_0x5ae56b['as'],'attributes':_0x5ae56b[_0x8c6d('0x17')],'include':_0x5ae56b[_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x5ae56b['include'],function(_0x2818fa){return{'model':db[_0x2818fa[_0x8c6d('0x16')]],'as':_0x2818fa['as'],'attributes':_0x2818fa[_0x8c6d('0x17')],'include':_0x2818fa[_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x2818fa[_0x8c6d('0x19')],function(_0x4a0fb3){return{'model':db[_0x4a0fb3[_0x8c6d('0x16')]],'as':_0x4a0fb3['as'],'attributes':_0x4a0fb3[_0x8c6d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8c6d('0x1a')](function(_0x2ef932){logger[_0x8c6d('0xa')](_0x8c6d('0x1c'),_0x15a508);logger[_0x8c6d('0xd')](_0x8c6d('0x1c'),_0x15a508,JSON[_0x8c6d('0xf')](_0x2ef932));_0x3af625(_0x2ef932);})[_0x8c6d('0x12')](function(_0x16b2cd){logger[_0x8c6d('0x10')]('ShowSalesforceAccount',_0x16b2cd[_0x8c6d('0x11')],_0x15a508);_0x332f6a(_0x4e5203[_0x8c6d('0x10')](0x1f4,_0x16b2cd[_0x8c6d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 8ef5aa1..1d33ec6 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 _0x16da=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','isAuthenticated','/:id','show'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x16da,0x13f));var _0xa16d=function(_0x74638e,_0x223f84){_0x74638e=_0x74638e-0x0;var _0x2f3f27=_0x16da[_0x74638e];return _0x2f3f27;};'use strict';var multer=require(_0xa16d('0x0'));var util=require(_0xa16d('0x1'));var path=require(_0xa16d('0x2'));var timeout=require('connect-timeout');var express=require(_0xa16d('0x3'));var router=express[_0xa16d('0x4')]();var auth=require(_0xa16d('0x5'));var interaction=require(_0xa16d('0x6'));var config=require('../../config/environment');var controller=require(_0xa16d('0x7'));router['get']('/',auth[_0xa16d('0x8')](),controller['index']);router['get'](_0xa16d('0x9'),auth[_0xa16d('0x8')](),controller[_0xa16d('0xa')]);router[_0xa16d('0xb')](_0xa16d('0xc'),auth[_0xa16d('0x8')](),controller['getFields']);router[_0xa16d('0xb')](_0xa16d('0xd'),auth[_0xa16d('0x8')](),controller[_0xa16d('0xe')]);router['get'](_0xa16d('0xf'),auth[_0xa16d('0x8')](),controller[_0xa16d('0x10')]);router[_0xa16d('0x11')]('/',auth[_0xa16d('0x8')](),controller[_0xa16d('0x12')]);router[_0xa16d('0x13')](_0xa16d('0x9'),auth[_0xa16d('0x8')](),controller['update']);router[_0xa16d('0x14')](_0xa16d('0x9'),auth[_0xa16d('0x8')](),controller['destroy']);module[_0xa16d('0x15')]=router; \ No newline at end of file +var _0x3ca1=['destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update'];(function(_0x1659b8,_0x2babe1){var _0x2f716a=function(_0x5efb61){while(--_0x5efb61){_0x1659b8['push'](_0x1659b8['shift']());}};_0x2f716a(++_0x2babe1);}(_0x3ca1,0x11a));var _0x13ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ca1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x13ca('0x0'));var util=require(_0x13ca('0x1'));var path=require('path');var timeout=require(_0x13ca('0x2'));var express=require(_0x13ca('0x3'));var router=express['Router']();var auth=require(_0x13ca('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x13ca('0x5'));var controller=require('./intSalesforceConfiguration.controller');router[_0x13ca('0x6')]('/',auth['isAuthenticated'](),controller[_0x13ca('0x7')]);router[_0x13ca('0x6')](_0x13ca('0x8'),auth[_0x13ca('0x9')](),controller['show']);router[_0x13ca('0x6')](_0x13ca('0xa'),auth['isAuthenticated'](),controller[_0x13ca('0xb')]);router[_0x13ca('0x6')](_0x13ca('0xc'),auth[_0x13ca('0x9')](),controller['getSubjects']);router[_0x13ca('0x6')](_0x13ca('0xd'),auth[_0x13ca('0x9')](),controller[_0x13ca('0xe')]);router[_0x13ca('0xf')]('/',auth[_0x13ca('0x9')](),controller[_0x13ca('0x10')]);router['put'](_0x13ca('0x8'),auth[_0x13ca('0x9')](),controller[_0x13ca('0x11')]);router['delete'](_0x13ca('0x8'),auth[_0x13ca('0x9')](),controller[_0x13ca('0x12')]);module[_0x13ca('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 68b7db2..12b15dd 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 _0x819c=['exports','STRING','ENUM','Task','Case','contact','lead','contact_lead','sequelize'];(function(_0x38e4e7,_0x49fe18){var _0x5a0efd=function(_0x28304c){while(--_0x28304c){_0x38e4e7['push'](_0x38e4e7['shift']());}};_0x5a0efd(++_0x49fe18);}(_0x819c,0x182));var _0xc819=function(_0x4523f7,_0x5d13a1){_0x4523f7=_0x4523f7-0x0;var _0x43f8f8=_0x819c[_0x4523f7];return _0x43f8f8;};'use strict';var Sequelize=require(_0xc819('0x0'));module[_0xc819('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc819('0x2')]},'ticketType':{'type':Sequelize[_0xc819('0x3')](_0xc819('0x4'),_0xc819('0x5')),'defaultValue':_0xc819('0x4')},'moduleSearch':{'type':Sequelize[_0xc819('0x3')]('contact_lead',_0xc819('0x6'),_0xc819('0x7')),'defaultValue':_0xc819('0x8')},'moduleCreate':{'type':Sequelize[_0xc819('0x3')]('nothing','contact',_0xc819('0x7')),'defaultValue':_0xc819('0x7')}}; \ No newline at end of file +var _0xdbfa=['sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','nothing'];(function(_0xe8e9bb,_0x12a4eb){var _0xcfc757=function(_0x156f87){while(--_0x156f87){_0xe8e9bb['push'](_0xe8e9bb['shift']());}};_0xcfc757(++_0x12a4eb);}(_0xdbfa,0x1f4));var _0xadbf=function(_0x2c080e,_0x249a91){_0x2c080e=_0x2c080e-0x0;var _0x59e08c=_0xdbfa[_0x2c080e];return _0x59e08c;};'use strict';var Sequelize=require(_0xadbf('0x0'));module[_0xadbf('0x1')]={'name':{'type':Sequelize[_0xadbf('0x2')]},'description':{'type':Sequelize[_0xadbf('0x2')]},'ticketType':{'type':Sequelize[_0xadbf('0x3')](_0xadbf('0x4'),_0xadbf('0x5')),'defaultValue':_0xadbf('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xadbf('0x6'),_0xadbf('0x7'),_0xadbf('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xadbf('0x3')](_0xadbf('0x9'),'contact',_0xadbf('0x8')),'defaultValue':_0xadbf('0x8')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 39811af..e565dfb 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 _0x319c=['stringify','error','code','message','info','result','catch','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','SalesforceConfiguration','find','create','body','getFields','findOne','SalesforceField','hasOwnProperty','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x399e3b,_0x5dd3d2){var _0x28c6a4=function(_0x7d77c1){while(--_0x7d77c1){_0x399e3b['push'](_0x399e3b['shift']());}};_0x28c6a4(++_0x5dd3d2);}(_0x319c,0x1d9));var _0xc319=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x319c[_0x45b034];return _0x509cb0;};'use strict';var pdf=require(_0xc319('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc319('0x1'));var zipdir=require(_0xc319('0x2'));var jsonpatch=require(_0xc319('0x3'));var rp=require('request-promise');var moment=require(_0xc319('0x4'));var BPromise=require(_0xc319('0x5'));var Mustache=require(_0xc319('0x6'));var util=require(_0xc319('0x7'));var path=require(_0xc319('0x8'));var sox=require(_0xc319('0x9'));var csv=require(_0xc319('0xa'));var ejs=require(_0xc319('0xb'));var fs=require('fs');var _=require(_0xc319('0xc'));var squel=require(_0xc319('0xd'));var crypto=require(_0xc319('0xe'));var jsforce=require(_0xc319('0xf'));var deskjs=require(_0xc319('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc319('0x11'));var Papa=require(_0xc319('0x12'));var Redis=require(_0xc319('0x13'));var authService=require(_0xc319('0x14'));var qs=require(_0xc319('0x15'));var as=require(_0xc319('0x16'));var hardwareService=require(_0xc319('0x17'));var logger=require(_0xc319('0x18'))(_0xc319('0x19'));var utils=require(_0xc319('0x1a'));var config=require(_0xc319('0x1b'));var db=require(_0xc319('0x1c'))['db'];var jayson=require(_0xc319('0x1d'));var client=jayson[_0xc319('0x1e')][_0xc319('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x277741,_0x5879dc,_0x1d9439){if(_0x1d9439){var _0x33767b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33767b[_0xc319('0x20')](_0x5879dc)){return _0x277741;}else{throw new db[(_0xc319('0x21'))][(_0xc319('0x22'))](_0xc319('0x23'));}}else{return _0x277741;}}function respondWithRpcPromise(_0x10bae6,_0x5183c7,_0x4ff6cd,_0x431c63){return new BPromise(function(_0x5451dc,_0x5d6a94){var _0x43149a=_0x431c63||client;return _0x43149a[_0xc319('0x24')](_0x10bae6,_0x4ff6cd)[_0xc319('0x25')](function(_0x13242b){logger['info'](_0xc319('0x26'),_0x5183c7,_0xc319('0x27'));logger[_0xc319('0x28')](_0xc319('0x29'),_0x5183c7,_0xc319('0x27'),JSON[_0xc319('0x2a')](_0x13242b));if(_0x13242b['error']){if(_0x13242b[_0xc319('0x2b')][_0xc319('0x2c')]===0x1f4){logger[_0xc319('0x2b')](_0xc319('0x26'),_0x5183c7,_0x13242b[_0xc319('0x2b')][_0xc319('0x2d')]);return _0x5d6a94(_0x13242b[_0xc319('0x2b')][_0xc319('0x2d')]);}logger[_0xc319('0x2b')](_0xc319('0x26'),_0x5183c7,_0x13242b[_0xc319('0x2b')]['message']);return _0x5451dc(_0x13242b['error'][_0xc319('0x2d')]);}else{logger[_0xc319('0x2e')](_0xc319('0x26'),_0x5183c7,_0xc319('0x27'));_0x5451dc(_0x13242b[_0xc319('0x2f')][_0xc319('0x2d')]);}})[_0xc319('0x30')](function(_0x1ed6b7){logger[_0xc319('0x2b')](_0xc319('0x26'),_0x5183c7,_0x1ed6b7);_0x5d6a94(_0x1ed6b7);});});}function respondWithStatusCode(_0x1c9d84,_0x570104){_0x570104=_0x570104||0xcc;return function(_0x1aa2e9){if(_0x1aa2e9){return _0x1c9d84['sendStatus'](_0x570104);}return _0x1c9d84[_0xc319('0x31')](_0x570104)['end']();};}function respondWithResult(_0x303e80,_0x5b122b){_0x5b122b=_0x5b122b||0xc8;return function(_0x20250b){if(_0x20250b){return _0x303e80['status'](_0x5b122b)[_0xc319('0x32')](_0x20250b);}};}function respondWithFilteredResult(_0x220ad5,_0x5b2500){return function(_0x1dd654){if(_0x1dd654){var _0x387caf=_0x1dd654[_0xc319('0x33')],_0x310485=_0x5b2500[_0xc319('0x34')],_0x2f5ea5=_0x5b2500[_0xc319('0x34')]+_0x5b2500['limit'],_0x5b4f71;if(_0x2f5ea5>=_0x387caf){_0x2f5ea5=_0x387caf;_0x5b4f71=0xc8;}else{_0x5b4f71=0xce;}_0x220ad5[_0xc319('0x31')](_0x5b4f71);return _0x220ad5[_0xc319('0x35')](_0xc319('0x36'),_0x310485+'-'+_0x2f5ea5+'/'+_0x387caf)[_0xc319('0x32')](_0x1dd654);}return null;};}function patchUpdates(_0xc1001){return function(_0x2cd374){try{jsonpatch[_0xc319('0x37')](_0x2cd374,_0xc1001,!![]);}catch(_0x24f9e9){return BPromise[_0xc319('0x38')](_0x24f9e9);}return _0x2cd374[_0xc319('0x39')]();};}function saveUpdates(_0x227c34,_0x588af0){return function(_0x3d59b0){if(_0x3d59b0){return _0x3d59b0[_0xc319('0x3a')](_0x227c34)[_0xc319('0x25')](function(_0x29947c){return _0x29947c;});}return null;};}function removeEntity(_0x338a6e,_0x5df32e){return function(_0x3640b6){if(_0x3640b6){return _0x3640b6[_0xc319('0x3b')]()[_0xc319('0x25')](function(){_0x338a6e['status'](0xcc)[_0xc319('0x3c')]();});}};}function handleEntityNotFound(_0x1e1d36,_0x4fdc17){return function(_0x1c8ef5){if(!_0x1c8ef5){_0x1e1d36[_0xc319('0x3d')](0x194);}return _0x1c8ef5;};}function handleError(_0xbc12fe,_0x520282){_0x520282=_0x520282||0x1f4;return function(_0x8cae90){logger[_0xc319('0x2b')](_0x8cae90[_0xc319('0x3e')]);if(_0x8cae90['name']){delete _0x8cae90[_0xc319('0x3f')];}_0xbc12fe[_0xc319('0x31')](_0x520282)[_0xc319('0x40')](_0x8cae90);};}exports[_0xc319('0x41')]=function(_0x43c8a1,_0xaca19a){var _0x5046f1={},_0x9906de={},_0x5e1c8a={'count':0x0,'rows':[]};var _0x22d8e0=_[_0xc319('0x42')](db['SalesforceConfiguration'][_0xc319('0x43')],function(_0xeba7c4){return{'name':_0xeba7c4['fieldName'],'type':_0xeba7c4[_0xc319('0x44')]['key']};});_0x9906de[_0xc319('0x45')]=_[_0xc319('0x42')](_0x22d8e0,'name');_0x9906de[_0xc319('0x46')]=_[_0xc319('0x47')](_0x43c8a1[_0xc319('0x46')]);_0x9906de['filters']=_[_0xc319('0x48')](_0x9906de[_0xc319('0x45')],_0x9906de[_0xc319('0x46')]);_0x5046f1[_0xc319('0x49')]=_[_0xc319('0x48')](_0x9906de['model'],qs[_0xc319('0x4a')](_0x43c8a1[_0xc319('0x46')]['fields']));_0x5046f1[_0xc319('0x49')]=_0x5046f1['attributes'][_0xc319('0x4b')]?_0x5046f1[_0xc319('0x49')]:_0x9906de[_0xc319('0x45')];if(!_0x43c8a1[_0xc319('0x46')]['hasOwnProperty'](_0xc319('0x4c'))){_0x5046f1['limit']=qs['limit'](_0x43c8a1['query'][_0xc319('0x4d')]);_0x5046f1[_0xc319('0x34')]=qs['offset'](_0x43c8a1[_0xc319('0x46')][_0xc319('0x34')]);}_0x5046f1[_0xc319('0x4e')]=qs[_0xc319('0x4f')](_0x43c8a1[_0xc319('0x46')][_0xc319('0x4f')]);_0x5046f1[_0xc319('0x50')]=qs[_0xc319('0x51')](_[_0xc319('0x52')](_0x43c8a1[_0xc319('0x46')],_0x9906de['filters']),_0x22d8e0);if(_0x43c8a1[_0xc319('0x46')][_0xc319('0x53')]){_0x5046f1[_0xc319('0x50')]=_[_0xc319('0x54')](_0x5046f1[_0xc319('0x50')],{'$or':_[_0xc319('0x42')](_0x22d8e0,function(_0x936026){if(_0x936026['type']!==_0xc319('0x55')){var _0xf5cc0a={};_0xf5cc0a[_0x936026['name']]={'$like':'%'+_0x43c8a1['query'][_0xc319('0x53')]+'%'};return _0xf5cc0a;}})});}_0x5046f1=_[_0xc319('0x54')]({},_0x5046f1,_0x43c8a1[_0xc319('0x56')]);var _0x4b7cfc={'where':_0x5046f1[_0xc319('0x50')]};return db['SalesforceConfiguration']['count'](_0x4b7cfc)[_0xc319('0x25')](function(_0x28c957){_0x5e1c8a[_0xc319('0x33')]=_0x28c957;if(_0x43c8a1['query'][_0xc319('0x57')]){_0x5046f1[_0xc319('0x58')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xc319('0x59')](_0x5046f1);})[_0xc319('0x25')](function(_0x569f37){_0x5e1c8a[_0xc319('0x5a')]=_0x569f37;return _0x5e1c8a;})[_0xc319('0x25')](respondWithFilteredResult(_0xaca19a,_0x5046f1))[_0xc319('0x30')](handleError(_0xaca19a,null));};exports[_0xc319('0x5b')]=function(_0x30db89,_0x3a3b70){var _0x606308={'raw':![],'where':{'id':_0x30db89[_0xc319('0x5c')]['id']}},_0x3b5166={};_0x3b5166[_0xc319('0x45')]=_[_0xc319('0x47')](db[_0xc319('0x5d')][_0xc319('0x43')]);_0x3b5166[_0xc319('0x46')]=_[_0xc319('0x47')](_0x30db89['query']);_0x3b5166[_0xc319('0x51')]=_['intersection'](_0x3b5166[_0xc319('0x45')],_0x3b5166[_0xc319('0x46')]);_0x606308[_0xc319('0x49')]=_['intersection'](_0x3b5166['model'],qs[_0xc319('0x4a')](_0x30db89[_0xc319('0x46')]['fields']));_0x606308[_0xc319('0x49')]=_0x606308[_0xc319('0x49')][_0xc319('0x4b')]?_0x606308[_0xc319('0x49')]:_0x3b5166['model'];if(_0x30db89[_0xc319('0x46')][_0xc319('0x57')]){_0x606308[_0xc319('0x58')]=[{'all':!![]}];}_0x606308=_[_0xc319('0x54')]({},_0x606308,_0x30db89['options']);return db[_0xc319('0x5d')][_0xc319('0x5e')](_0x606308)['then'](handleEntityNotFound(_0x3a3b70,null))[_0xc319('0x25')](respondWithResult(_0x3a3b70,null))[_0xc319('0x30')](handleError(_0x3a3b70,null));};exports[_0xc319('0x5f')]=function(_0x142491,_0x477ae0){return db[_0xc319('0x5d')][_0xc319('0x5f')](_0x142491[_0xc319('0x60')],{})['then'](respondWithResult(_0x477ae0,0xc9))[_0xc319('0x30')](handleError(_0x477ae0,null));};exports['update']=function(_0x4e0fbf,_0x7c99a1){if(_0x4e0fbf[_0xc319('0x60')]['id']){delete _0x4e0fbf['body']['id'];}return db[_0xc319('0x5d')]['find']({'where':{'id':_0x4e0fbf[_0xc319('0x5c')]['id']}})[_0xc319('0x25')](handleEntityNotFound(_0x7c99a1,null))[_0xc319('0x25')](saveUpdates(_0x4e0fbf[_0xc319('0x60')],null))[_0xc319('0x25')](respondWithResult(_0x7c99a1,null))[_0xc319('0x30')](handleError(_0x7c99a1,null));};exports['destroy']=function(_0x3dacfc,_0x1f5406){return db[_0xc319('0x5d')][_0xc319('0x5e')]({'where':{'id':_0x3dacfc[_0xc319('0x5c')]['id']}})[_0xc319('0x25')](handleEntityNotFound(_0x1f5406,null))[_0xc319('0x25')](removeEntity(_0x1f5406,null))[_0xc319('0x30')](handleError(_0x1f5406,null));};exports[_0xc319('0x61')]=function(_0x380a37,_0x492dc3,_0x3838c5){var _0x1dc2fa={};var _0x3bf208={};var _0x396765;var _0x11bcb4;return db[_0xc319('0x5d')][_0xc319('0x62')]({'where':{'id':_0x380a37[_0xc319('0x5c')]['id']}})[_0xc319('0x25')](handleEntityNotFound(_0x492dc3,null))[_0xc319('0x25')](function(_0x2d7e10){if(_0x2d7e10){_0x396765=_0x2d7e10;_0x3bf208[_0xc319('0x45')]=_[_0xc319('0x47')](db[_0xc319('0x63')]['rawAttributes']);_0x3bf208['query']=_[_0xc319('0x47')](_0x380a37[_0xc319('0x46')]);_0x3bf208[_0xc319('0x51')]=_[_0xc319('0x48')](_0x3bf208[_0xc319('0x45')],_0x3bf208[_0xc319('0x46')]);_0x1dc2fa[_0xc319('0x49')]=_[_0xc319('0x48')](_0x3bf208[_0xc319('0x45')],qs[_0xc319('0x4a')](_0x380a37[_0xc319('0x46')]['fields']));_0x1dc2fa['attributes']=_0x1dc2fa[_0xc319('0x49')]['length']?_0x1dc2fa['attributes']:_0x3bf208[_0xc319('0x45')];_0x1dc2fa['order']=qs['sort'](_0x380a37[_0xc319('0x46')]['sort']);_0x1dc2fa[_0xc319('0x50')]=qs[_0xc319('0x51')](_['pick'](_0x380a37['query'],_0x3bf208[_0xc319('0x51')]));if(_0x380a37[_0xc319('0x46')][_0xc319('0x53')]){_0x1dc2fa[_0xc319('0x50')]=_[_0xc319('0x54')](_0x1dc2fa['where'],{'$or':_[_0xc319('0x42')](_0x1dc2fa[_0xc319('0x49')],function(_0x1478da){var _0x31e044={};_0x31e044[_0x1478da]={'$like':'%'+_0x380a37[_0xc319('0x46')][_0xc319('0x53')]+'%'};return _0x31e044;})});}_0x1dc2fa=_['merge']({},_0x1dc2fa,_0x380a37[_0xc319('0x56')]);return _0x396765[_0xc319('0x61')](_0x1dc2fa);}})[_0xc319('0x25')](function(_0xa0b485){if(_0xa0b485){_0x11bcb4=_0xa0b485['length'];if(!_0x380a37[_0xc319('0x46')][_0xc319('0x64')]('nolimit')){_0x1dc2fa[_0xc319('0x4d')]=qs[_0xc319('0x4d')](_0x380a37[_0xc319('0x46')][_0xc319('0x4d')]);_0x1dc2fa['offset']=qs[_0xc319('0x34')](_0x380a37['query'][_0xc319('0x34')]);}return _0x396765[_0xc319('0x61')](_0x1dc2fa);}})[_0xc319('0x25')](function(_0x5034b1){if(_0x5034b1){return _0x5034b1?{'count':_0x11bcb4,'rows':_0x5034b1}:null;}})['then'](respondWithResult(_0x492dc3,null))[_0xc319('0x30')](handleError(_0x492dc3,null));};exports[_0xc319('0x65')]=function(_0x3077de,_0xa5af16,_0x352a52){var _0x474f56={};var _0x4010c1={};var _0x124443;var _0x57003a;return db[_0xc319('0x5d')][_0xc319('0x62')]({'where':{'id':_0x3077de['params']['id']}})[_0xc319('0x25')](handleEntityNotFound(_0xa5af16,null))[_0xc319('0x25')](function(_0x12bd33){if(_0x12bd33){_0x124443=_0x12bd33;_0x4010c1[_0xc319('0x45')]=_[_0xc319('0x47')](db[_0xc319('0x63')][_0xc319('0x43')]);_0x4010c1['query']=_[_0xc319('0x47')](_0x3077de[_0xc319('0x46')]);_0x4010c1[_0xc319('0x51')]=_[_0xc319('0x48')](_0x4010c1['model'],_0x4010c1[_0xc319('0x46')]);_0x474f56[_0xc319('0x49')]=_[_0xc319('0x48')](_0x4010c1[_0xc319('0x45')],qs['fields'](_0x3077de[_0xc319('0x46')][_0xc319('0x4a')]));_0x474f56[_0xc319('0x49')]=_0x474f56[_0xc319('0x49')][_0xc319('0x4b')]?_0x474f56[_0xc319('0x49')]:_0x4010c1[_0xc319('0x45')];_0x474f56[_0xc319('0x4e')]=qs[_0xc319('0x4f')](_0x3077de[_0xc319('0x46')]['sort']);_0x474f56[_0xc319('0x50')]=qs[_0xc319('0x51')](_[_0xc319('0x52')](_0x3077de['query'],_0x4010c1['filters']));if(_0x3077de[_0xc319('0x46')][_0xc319('0x53')]){_0x474f56['where']=_['merge'](_0x474f56['where'],{'$or':_[_0xc319('0x42')](_0x474f56['attributes'],function(_0x2a711a){var _0x8db6dc={};_0x8db6dc[_0x2a711a]={'$like':'%'+_0x3077de['query'][_0xc319('0x53')]+'%'};return _0x8db6dc;})});}_0x474f56=_[_0xc319('0x54')]({},_0x474f56,_0x3077de[_0xc319('0x56')]);return _0x124443[_0xc319('0x65')](_0x474f56);}})[_0xc319('0x25')](function(_0x1e3877){if(_0x1e3877){_0x57003a=_0x1e3877[_0xc319('0x4b')];if(!_0x3077de[_0xc319('0x46')][_0xc319('0x64')](_0xc319('0x4c'))){_0x474f56[_0xc319('0x4d')]=qs[_0xc319('0x4d')](_0x3077de[_0xc319('0x46')][_0xc319('0x4d')]);_0x474f56[_0xc319('0x34')]=qs['offset'](_0x3077de[_0xc319('0x46')][_0xc319('0x34')]);}return _0x124443[_0xc319('0x65')](_0x474f56);}})[_0xc319('0x25')](function(_0x25580a){if(_0x25580a){return _0x25580a?{'count':_0x57003a,'rows':_0x25580a}:null;}})[_0xc319('0x25')](respondWithResult(_0xa5af16,null))['catch'](handleError(_0xa5af16,null));};exports[_0xc319('0x66')]=function(_0x1ffe1e,_0x19d6b6,_0x592e1b){var _0x1e1dd9={};var _0x58ef01={};var _0x49cc56;var _0x5d559f;return db['SalesforceConfiguration'][_0xc319('0x62')]({'where':{'id':_0x1ffe1e['params']['id']}})[_0xc319('0x25')](handleEntityNotFound(_0x19d6b6,null))[_0xc319('0x25')](function(_0x2081e3){if(_0x2081e3){_0x49cc56=_0x2081e3;_0x58ef01[_0xc319('0x45')]=_[_0xc319('0x47')](db[_0xc319('0x63')][_0xc319('0x43')]);_0x58ef01[_0xc319('0x46')]=_['keys'](_0x1ffe1e[_0xc319('0x46')]);_0x58ef01[_0xc319('0x51')]=_[_0xc319('0x48')](_0x58ef01['model'],_0x58ef01[_0xc319('0x46')]);_0x1e1dd9['attributes']=_[_0xc319('0x48')](_0x58ef01['model'],qs[_0xc319('0x4a')](_0x1ffe1e[_0xc319('0x46')][_0xc319('0x4a')]));_0x1e1dd9[_0xc319('0x49')]=_0x1e1dd9['attributes']['length']?_0x1e1dd9[_0xc319('0x49')]:_0x58ef01['model'];_0x1e1dd9[_0xc319('0x4e')]=qs['sort'](_0x1ffe1e[_0xc319('0x46')]['sort']);_0x1e1dd9[_0xc319('0x50')]=qs[_0xc319('0x51')](_[_0xc319('0x52')](_0x1ffe1e[_0xc319('0x46')],_0x58ef01[_0xc319('0x51')]));if(_0x1ffe1e[_0xc319('0x46')][_0xc319('0x53')]){_0x1e1dd9[_0xc319('0x50')]=_[_0xc319('0x54')](_0x1e1dd9[_0xc319('0x50')],{'$or':_['map'](_0x1e1dd9[_0xc319('0x49')],function(_0x5ba082){var _0x38d05a={};_0x38d05a[_0x5ba082]={'$like':'%'+_0x1ffe1e[_0xc319('0x46')][_0xc319('0x53')]+'%'};return _0x38d05a;})});}_0x1e1dd9=_[_0xc319('0x54')]({},_0x1e1dd9,_0x1ffe1e['options']);return _0x49cc56[_0xc319('0x66')](_0x1e1dd9);}})[_0xc319('0x25')](function(_0x4d183d){if(_0x4d183d){_0x5d559f=_0x4d183d[_0xc319('0x4b')];if(!_0x1ffe1e[_0xc319('0x46')][_0xc319('0x64')](_0xc319('0x4c'))){_0x1e1dd9[_0xc319('0x4d')]=qs[_0xc319('0x4d')](_0x1ffe1e[_0xc319('0x46')][_0xc319('0x4d')]);_0x1e1dd9['offset']=qs[_0xc319('0x34')](_0x1ffe1e[_0xc319('0x46')][_0xc319('0x34')]);}return _0x49cc56['getDescriptions'](_0x1e1dd9);}})[_0xc319('0x25')](function(_0x31bb4f){if(_0x31bb4f){return _0x31bb4f?{'count':_0x5d559f,'rows':_0x31bb4f}:null;}})[_0xc319('0x25')](respondWithResult(_0x19d6b6,null))['catch'](handleError(_0x19d6b6,null));}; \ No newline at end of file +var _0x810c=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','show','options','SalesforceConfiguration','find','create','body','params','getFields','findOne','getSubjects','getDescriptions','SalesforceField','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','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','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','type'];(function(_0x207955,_0x5927fd){var _0x2f5f8c=function(_0x1f3365){while(--_0x1f3365){_0x207955['push'](_0x207955['shift']());}};_0x2f5f8c(++_0x5927fd);}(_0x810c,0x1a5));var _0xc810=function(_0x3f8fa5,_0xa2656){_0x3f8fa5=_0x3f8fa5-0x0;var _0x42542e=_0x810c[_0x3f8fa5];return _0x42542e;};'use strict';var pdf=require(_0xc810('0x0'));var emlformat=require(_0xc810('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc810('0x2'));var jsonpatch=require(_0xc810('0x3'));var rp=require('request-promise');var moment=require(_0xc810('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc810('0x5'));var util=require(_0xc810('0x6'));var path=require(_0xc810('0x7'));var sox=require(_0xc810('0x8'));var csv=require(_0xc810('0x9'));var ejs=require(_0xc810('0xa'));var fs=require('fs');var _=require(_0xc810('0xb'));var squel=require('squel');var crypto=require(_0xc810('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc810('0xd'));var toCsv=require(_0xc810('0x9'));var querystring=require(_0xc810('0xe'));var Papa=require(_0xc810('0xf'));var Redis=require(_0xc810('0x10'));var authService=require(_0xc810('0x11'));var qs=require(_0xc810('0x12'));var as=require(_0xc810('0x13'));var hardwareService=require(_0xc810('0x14'));var logger=require('../../config/logger')(_0xc810('0x15'));var utils=require(_0xc810('0x16'));var config=require(_0xc810('0x17'));var db=require(_0xc810('0x18'))['db'];var jayson=require(_0xc810('0x19'));var client=jayson[_0xc810('0x1a')][_0xc810('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x26a44f,_0xe54ac9,_0x588872){if(_0x588872){var _0x1df482=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1df482[_0xc810('0x1c')](_0xe54ac9)){return _0x26a44f;}else{throw new db[(_0xc810('0x1d'))][(_0xc810('0x1e'))](_0xc810('0x1f'));}}else{return _0x26a44f;}}function respondWithRpcPromise(_0x371e50,_0x5451c6,_0x18671d,_0x4a5b37){return new BPromise(function(_0x303e7f,_0xd5eac3){var _0x2ae6a=_0x4a5b37||client;return _0x2ae6a[_0xc810('0x20')](_0x371e50,_0x18671d)['then'](function(_0x387b4c){logger[_0xc810('0x21')](_0xc810('0x22'),_0x5451c6,_0xc810('0x23'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5451c6,'request\x20sent',JSON[_0xc810('0x24')](_0x387b4c));if(_0x387b4c[_0xc810('0x25')]){if(_0x387b4c[_0xc810('0x25')][_0xc810('0x26')]===0x1f4){logger[_0xc810('0x25')](_0xc810('0x22'),_0x5451c6,_0x387b4c['error'][_0xc810('0x27')]);return _0xd5eac3(_0x387b4c['error'][_0xc810('0x27')]);}logger[_0xc810('0x25')](_0xc810('0x22'),_0x5451c6,_0x387b4c[_0xc810('0x25')][_0xc810('0x27')]);return _0x303e7f(_0x387b4c[_0xc810('0x25')][_0xc810('0x27')]);}else{logger[_0xc810('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5451c6,_0xc810('0x23'));_0x303e7f(_0x387b4c[_0xc810('0x28')][_0xc810('0x27')]);}})[_0xc810('0x29')](function(_0x225c56){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x5451c6,_0x225c56);_0xd5eac3(_0x225c56);});});}function respondWithStatusCode(_0x21d0c5,_0x1327da){_0x1327da=_0x1327da||0xcc;return function(_0x2fa362){if(_0x2fa362){return _0x21d0c5[_0xc810('0x2a')](_0x1327da);}return _0x21d0c5[_0xc810('0x2b')](_0x1327da)['end']();};}function respondWithResult(_0x4dc329,_0x2000ba){_0x2000ba=_0x2000ba||0xc8;return function(_0x4e3658){if(_0x4e3658){return _0x4dc329[_0xc810('0x2b')](_0x2000ba)['json'](_0x4e3658);}};}function respondWithFilteredResult(_0x26fb11,_0x362f55){return function(_0x31341){if(_0x31341){var _0x1cb53a=_0x31341[_0xc810('0x2c')],_0x273576=_0x362f55[_0xc810('0x2d')],_0x2d3b06=_0x362f55[_0xc810('0x2d')]+_0x362f55[_0xc810('0x2e')],_0x1a427e;if(_0x2d3b06>=_0x1cb53a){_0x2d3b06=_0x1cb53a;_0x1a427e=0xc8;}else{_0x1a427e=0xce;}_0x26fb11[_0xc810('0x2b')](_0x1a427e);return _0x26fb11[_0xc810('0x2f')](_0xc810('0x30'),_0x273576+'-'+_0x2d3b06+'/'+_0x1cb53a)[_0xc810('0x31')](_0x31341);}return null;};}function patchUpdates(_0x2bab05){return function(_0x1d3dd4){try{jsonpatch[_0xc810('0x32')](_0x1d3dd4,_0x2bab05,!![]);}catch(_0x51710b){return BPromise[_0xc810('0x33')](_0x51710b);}return _0x1d3dd4[_0xc810('0x34')]();};}function saveUpdates(_0x27d7a7,_0x59d7d6){return function(_0x4d7025){if(_0x4d7025){return _0x4d7025[_0xc810('0x35')](_0x27d7a7)[_0xc810('0x36')](function(_0x461dc5){return _0x461dc5;});}return null;};}function removeEntity(_0xd71712,_0x257191){return function(_0x3a21fc){if(_0x3a21fc){return _0x3a21fc[_0xc810('0x37')]()['then'](function(){_0xd71712[_0xc810('0x2b')](0xcc)[_0xc810('0x38')]();});}};}function handleEntityNotFound(_0x360e0f,_0x27d030){return function(_0x35965a){if(!_0x35965a){_0x360e0f[_0xc810('0x2a')](0x194);}return _0x35965a;};}function handleError(_0x2a8c6d,_0xa6611d){_0xa6611d=_0xa6611d||0x1f4;return function(_0x31f0b8){logger['error'](_0x31f0b8[_0xc810('0x39')]);if(_0x31f0b8[_0xc810('0x3a')]){delete _0x31f0b8[_0xc810('0x3a')];}_0x2a8c6d[_0xc810('0x2b')](_0xa6611d)[_0xc810('0x3b')](_0x31f0b8);};}exports[_0xc810('0x3c')]=function(_0x1ca324,_0x409ffc){var _0x55cd85={},_0x42c000={},_0x2a79e7={'count':0x0,'rows':[]};var _0x4c340d=_[_0xc810('0x3d')](db['SalesforceConfiguration'][_0xc810('0x3e')],function(_0x1fd7e6){return{'name':_0x1fd7e6['fieldName'],'type':_0x1fd7e6[_0xc810('0x3f')][_0xc810('0x40')]};});_0x42c000[_0xc810('0x41')]=_['map'](_0x4c340d,_0xc810('0x3a'));_0x42c000[_0xc810('0x42')]=_[_0xc810('0x43')](_0x1ca324[_0xc810('0x42')]);_0x42c000[_0xc810('0x44')]=_[_0xc810('0x45')](_0x42c000[_0xc810('0x41')],_0x42c000[_0xc810('0x42')]);_0x55cd85[_0xc810('0x46')]=_[_0xc810('0x45')](_0x42c000[_0xc810('0x41')],qs[_0xc810('0x47')](_0x1ca324[_0xc810('0x42')][_0xc810('0x47')]));_0x55cd85[_0xc810('0x46')]=_0x55cd85[_0xc810('0x46')][_0xc810('0x48')]?_0x55cd85[_0xc810('0x46')]:_0x42c000['model'];if(!_0x1ca324['query'][_0xc810('0x49')](_0xc810('0x4a'))){_0x55cd85['limit']=qs[_0xc810('0x2e')](_0x1ca324[_0xc810('0x42')]['limit']);_0x55cd85[_0xc810('0x2d')]=qs['offset'](_0x1ca324['query'][_0xc810('0x2d')]);}_0x55cd85[_0xc810('0x4b')]=qs[_0xc810('0x4c')](_0x1ca324[_0xc810('0x42')][_0xc810('0x4c')]);_0x55cd85['where']=qs['filters'](_[_0xc810('0x4d')](_0x1ca324[_0xc810('0x42')],_0x42c000[_0xc810('0x44')]),_0x4c340d);if(_0x1ca324[_0xc810('0x42')][_0xc810('0x4e')]){_0x55cd85[_0xc810('0x4f')]=_[_0xc810('0x50')](_0x55cd85[_0xc810('0x4f')],{'$or':_[_0xc810('0x3d')](_0x4c340d,function(_0x121e6f){if(_0x121e6f[_0xc810('0x3f')]!==_0xc810('0x51')){var _0x543075={};_0x543075[_0x121e6f[_0xc810('0x3a')]]={'$like':'%'+_0x1ca324['query']['filter']+'%'};return _0x543075;}})});}_0x55cd85=_[_0xc810('0x50')]({},_0x55cd85,_0x1ca324['options']);var _0x4e22f6={'where':_0x55cd85[_0xc810('0x4f')]};return db['SalesforceConfiguration']['count'](_0x4e22f6)['then'](function(_0x5020c8){_0x2a79e7[_0xc810('0x2c')]=_0x5020c8;if(_0x1ca324[_0xc810('0x42')]['includeAll']){_0x55cd85[_0xc810('0x52')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xc810('0x53')](_0x55cd85);})[_0xc810('0x36')](function(_0x36c92e){_0x2a79e7[_0xc810('0x54')]=_0x36c92e;return _0x2a79e7;})[_0xc810('0x36')](respondWithFilteredResult(_0x409ffc,_0x55cd85))[_0xc810('0x29')](handleError(_0x409ffc,null));};exports[_0xc810('0x55')]=function(_0x54c8f0,_0x158fd8){var _0x4bbc05={'raw':![],'where':{'id':_0x54c8f0['params']['id']}},_0x15f52e={};_0x15f52e[_0xc810('0x41')]=_[_0xc810('0x43')](db['SalesforceConfiguration'][_0xc810('0x3e')]);_0x15f52e[_0xc810('0x42')]=_['keys'](_0x54c8f0[_0xc810('0x42')]);_0x15f52e[_0xc810('0x44')]=_[_0xc810('0x45')](_0x15f52e[_0xc810('0x41')],_0x15f52e[_0xc810('0x42')]);_0x4bbc05[_0xc810('0x46')]=_[_0xc810('0x45')](_0x15f52e['model'],qs[_0xc810('0x47')](_0x54c8f0['query'][_0xc810('0x47')]));_0x4bbc05['attributes']=_0x4bbc05[_0xc810('0x46')][_0xc810('0x48')]?_0x4bbc05[_0xc810('0x46')]:_0x15f52e[_0xc810('0x41')];if(_0x54c8f0['query']['includeAll']){_0x4bbc05['include']=[{'all':!![]}];}_0x4bbc05=_[_0xc810('0x50')]({},_0x4bbc05,_0x54c8f0[_0xc810('0x56')]);return db[_0xc810('0x57')][_0xc810('0x58')](_0x4bbc05)[_0xc810('0x36')](handleEntityNotFound(_0x158fd8,null))[_0xc810('0x36')](respondWithResult(_0x158fd8,null))['catch'](handleError(_0x158fd8,null));};exports[_0xc810('0x59')]=function(_0x3cb4b4,_0x478122){return db[_0xc810('0x57')][_0xc810('0x59')](_0x3cb4b4[_0xc810('0x5a')],{})[_0xc810('0x36')](respondWithResult(_0x478122,0xc9))[_0xc810('0x29')](handleError(_0x478122,null));};exports[_0xc810('0x35')]=function(_0x2dd9d3,_0x5aebc2){if(_0x2dd9d3[_0xc810('0x5a')]['id']){delete _0x2dd9d3[_0xc810('0x5a')]['id'];}return db[_0xc810('0x57')][_0xc810('0x58')]({'where':{'id':_0x2dd9d3[_0xc810('0x5b')]['id']}})[_0xc810('0x36')](handleEntityNotFound(_0x5aebc2,null))[_0xc810('0x36')](saveUpdates(_0x2dd9d3['body'],null))[_0xc810('0x36')](respondWithResult(_0x5aebc2,null))[_0xc810('0x29')](handleError(_0x5aebc2,null));};exports[_0xc810('0x37')]=function(_0x51ecc1,_0x386360){return db[_0xc810('0x57')][_0xc810('0x58')]({'where':{'id':_0x51ecc1[_0xc810('0x5b')]['id']}})[_0xc810('0x36')](handleEntityNotFound(_0x386360,null))[_0xc810('0x36')](removeEntity(_0x386360,null))[_0xc810('0x29')](handleError(_0x386360,null));};exports[_0xc810('0x5c')]=function(_0x47b0d8,_0x557a9d,_0x24b9d4){var _0x5534ca={};var _0x35af40={};var _0x307fba;var _0x913ead;return db[_0xc810('0x57')][_0xc810('0x5d')]({'where':{'id':_0x47b0d8[_0xc810('0x5b')]['id']}})[_0xc810('0x36')](handleEntityNotFound(_0x557a9d,null))['then'](function(_0x57b905){if(_0x57b905){_0x307fba=_0x57b905;_0x35af40[_0xc810('0x41')]=_[_0xc810('0x43')](db['SalesforceField'][_0xc810('0x3e')]);_0x35af40[_0xc810('0x42')]=_['keys'](_0x47b0d8[_0xc810('0x42')]);_0x35af40['filters']=_[_0xc810('0x45')](_0x35af40[_0xc810('0x41')],_0x35af40[_0xc810('0x42')]);_0x5534ca[_0xc810('0x46')]=_[_0xc810('0x45')](_0x35af40[_0xc810('0x41')],qs[_0xc810('0x47')](_0x47b0d8['query'][_0xc810('0x47')]));_0x5534ca[_0xc810('0x46')]=_0x5534ca[_0xc810('0x46')]['length']?_0x5534ca[_0xc810('0x46')]:_0x35af40[_0xc810('0x41')];_0x5534ca[_0xc810('0x4b')]=qs[_0xc810('0x4c')](_0x47b0d8[_0xc810('0x42')]['sort']);_0x5534ca[_0xc810('0x4f')]=qs[_0xc810('0x44')](_[_0xc810('0x4d')](_0x47b0d8[_0xc810('0x42')],_0x35af40[_0xc810('0x44')]));if(_0x47b0d8[_0xc810('0x42')][_0xc810('0x4e')]){_0x5534ca['where']=_['merge'](_0x5534ca[_0xc810('0x4f')],{'$or':_[_0xc810('0x3d')](_0x5534ca[_0xc810('0x46')],function(_0x1c284b){var _0x245028={};_0x245028[_0x1c284b]={'$like':'%'+_0x47b0d8[_0xc810('0x42')][_0xc810('0x4e')]+'%'};return _0x245028;})});}_0x5534ca=_[_0xc810('0x50')]({},_0x5534ca,_0x47b0d8[_0xc810('0x56')]);return _0x307fba[_0xc810('0x5c')](_0x5534ca);}})['then'](function(_0x3ae15e){if(_0x3ae15e){_0x913ead=_0x3ae15e[_0xc810('0x48')];if(!_0x47b0d8['query'][_0xc810('0x49')](_0xc810('0x4a'))){_0x5534ca[_0xc810('0x2e')]=qs[_0xc810('0x2e')](_0x47b0d8[_0xc810('0x42')][_0xc810('0x2e')]);_0x5534ca['offset']=qs['offset'](_0x47b0d8[_0xc810('0x42')][_0xc810('0x2d')]);}return _0x307fba[_0xc810('0x5c')](_0x5534ca);}})[_0xc810('0x36')](function(_0x1fc7b1){if(_0x1fc7b1){return _0x1fc7b1?{'count':_0x913ead,'rows':_0x1fc7b1}:null;}})[_0xc810('0x36')](respondWithResult(_0x557a9d,null))[_0xc810('0x29')](handleError(_0x557a9d,null));};exports[_0xc810('0x5e')]=function(_0x19ef0d,_0x1a6b52,_0x5ba7ad){var _0x127bdd={};var _0x2ecfac={};var _0x2dc138;var _0x27b484;return db['SalesforceConfiguration'][_0xc810('0x5d')]({'where':{'id':_0x19ef0d['params']['id']}})[_0xc810('0x36')](handleEntityNotFound(_0x1a6b52,null))['then'](function(_0x5e8020){if(_0x5e8020){_0x2dc138=_0x5e8020;_0x2ecfac['model']=_[_0xc810('0x43')](db['SalesforceField']['rawAttributes']);_0x2ecfac[_0xc810('0x42')]=_['keys'](_0x19ef0d[_0xc810('0x42')]);_0x2ecfac[_0xc810('0x44')]=_['intersection'](_0x2ecfac[_0xc810('0x41')],_0x2ecfac['query']);_0x127bdd['attributes']=_[_0xc810('0x45')](_0x2ecfac['model'],qs[_0xc810('0x47')](_0x19ef0d[_0xc810('0x42')][_0xc810('0x47')]));_0x127bdd['attributes']=_0x127bdd['attributes'][_0xc810('0x48')]?_0x127bdd['attributes']:_0x2ecfac['model'];_0x127bdd['order']=qs[_0xc810('0x4c')](_0x19ef0d[_0xc810('0x42')][_0xc810('0x4c')]);_0x127bdd[_0xc810('0x4f')]=qs[_0xc810('0x44')](_[_0xc810('0x4d')](_0x19ef0d[_0xc810('0x42')],_0x2ecfac['filters']));if(_0x19ef0d[_0xc810('0x42')][_0xc810('0x4e')]){_0x127bdd[_0xc810('0x4f')]=_['merge'](_0x127bdd['where'],{'$or':_[_0xc810('0x3d')](_0x127bdd[_0xc810('0x46')],function(_0xe4df8e){var _0x5dff2f={};_0x5dff2f[_0xe4df8e]={'$like':'%'+_0x19ef0d[_0xc810('0x42')][_0xc810('0x4e')]+'%'};return _0x5dff2f;})});}_0x127bdd=_[_0xc810('0x50')]({},_0x127bdd,_0x19ef0d[_0xc810('0x56')]);return _0x2dc138[_0xc810('0x5e')](_0x127bdd);}})[_0xc810('0x36')](function(_0x402c1b){if(_0x402c1b){_0x27b484=_0x402c1b[_0xc810('0x48')];if(!_0x19ef0d[_0xc810('0x42')][_0xc810('0x49')](_0xc810('0x4a'))){_0x127bdd['limit']=qs[_0xc810('0x2e')](_0x19ef0d[_0xc810('0x42')][_0xc810('0x2e')]);_0x127bdd[_0xc810('0x2d')]=qs[_0xc810('0x2d')](_0x19ef0d['query']['offset']);}return _0x2dc138[_0xc810('0x5e')](_0x127bdd);}})[_0xc810('0x36')](function(_0x26cac4){if(_0x26cac4){return _0x26cac4?{'count':_0x27b484,'rows':_0x26cac4}:null;}})['then'](respondWithResult(_0x1a6b52,null))[_0xc810('0x29')](handleError(_0x1a6b52,null));};exports[_0xc810('0x5f')]=function(_0x1f45d5,_0x155828,_0x1c5d9d){var _0x3385af={};var _0x15c2f6={};var _0x3176ab;var _0x4ab032;return db[_0xc810('0x57')]['findOne']({'where':{'id':_0x1f45d5[_0xc810('0x5b')]['id']}})[_0xc810('0x36')](handleEntityNotFound(_0x155828,null))[_0xc810('0x36')](function(_0x4f5fed){if(_0x4f5fed){_0x3176ab=_0x4f5fed;_0x15c2f6[_0xc810('0x41')]=_[_0xc810('0x43')](db[_0xc810('0x60')][_0xc810('0x3e')]);_0x15c2f6[_0xc810('0x42')]=_['keys'](_0x1f45d5[_0xc810('0x42')]);_0x15c2f6['filters']=_[_0xc810('0x45')](_0x15c2f6[_0xc810('0x41')],_0x15c2f6['query']);_0x3385af[_0xc810('0x46')]=_[_0xc810('0x45')](_0x15c2f6[_0xc810('0x41')],qs[_0xc810('0x47')](_0x1f45d5['query'][_0xc810('0x47')]));_0x3385af[_0xc810('0x46')]=_0x3385af['attributes'][_0xc810('0x48')]?_0x3385af[_0xc810('0x46')]:_0x15c2f6[_0xc810('0x41')];_0x3385af['order']=qs[_0xc810('0x4c')](_0x1f45d5[_0xc810('0x42')][_0xc810('0x4c')]);_0x3385af['where']=qs[_0xc810('0x44')](_[_0xc810('0x4d')](_0x1f45d5[_0xc810('0x42')],_0x15c2f6[_0xc810('0x44')]));if(_0x1f45d5[_0xc810('0x42')]['filter']){_0x3385af[_0xc810('0x4f')]=_[_0xc810('0x50')](_0x3385af[_0xc810('0x4f')],{'$or':_[_0xc810('0x3d')](_0x3385af[_0xc810('0x46')],function(_0x27918e){var _0x455d7c={};_0x455d7c[_0x27918e]={'$like':'%'+_0x1f45d5[_0xc810('0x42')]['filter']+'%'};return _0x455d7c;})});}_0x3385af=_['merge']({},_0x3385af,_0x1f45d5[_0xc810('0x56')]);return _0x3176ab[_0xc810('0x5f')](_0x3385af);}})[_0xc810('0x36')](function(_0xc0b675){if(_0xc0b675){_0x4ab032=_0xc0b675[_0xc810('0x48')];if(!_0x1f45d5[_0xc810('0x42')][_0xc810('0x49')](_0xc810('0x4a'))){_0x3385af['limit']=qs[_0xc810('0x2e')](_0x1f45d5[_0xc810('0x42')]['limit']);_0x3385af[_0xc810('0x2d')]=qs['offset'](_0x1f45d5[_0xc810('0x42')][_0xc810('0x2d')]);}return _0x3176ab[_0xc810('0x5f')](_0x3385af);}})['then'](function(_0x3cd8ef){if(_0x3cd8ef){return _0x3cd8ef?{'count':_0x4ab032,'rows':_0x3cd8ef}:null;}})[_0xc810('0x36')](respondWithResult(_0x155828,null))['catch'](handleError(_0x155828,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index ca3a632..aee29eb 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 _0xb09b=['api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','int_salesforce_configurations','util','../../config/logger'];(function(_0x497454,_0x1642f9){var _0x4858f0=function(_0x2a5a7c){while(--_0x2a5a7c){_0x497454['push'](_0x497454['shift']());}};_0x4858f0(++_0x1642f9);}(_0xb09b,0x195));var _0xbb09=function(_0x57a6e5,_0x57d7e9){_0x57a6e5=_0x57a6e5-0x0;var _0x540d07=_0xb09b[_0x57a6e5];return _0x540d07;};'use strict';var _=require('lodash');var util=require(_0xbb09('0x0'));var logger=require(_0xbb09('0x1'))(_0xbb09('0x2'));var moment=require(_0xbb09('0x3'));var BPromise=require(_0xbb09('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb09('0x5'));var rimraf=require(_0xbb09('0x6'));var config=require(_0xbb09('0x7'));var attributes=require(_0xbb09('0x8'));module[_0xbb09('0x9')]=function(_0x503fea,_0x167207){return _0x503fea['define']('SalesforceConfiguration',attributes,{'tableName':_0xbb09('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd1e=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0x31fdb2,_0x13fe10){var _0x47d857=function(_0x5542c3){while(--_0x5542c3){_0x31fdb2['push'](_0x31fdb2['shift']());}};_0x47d857(++_0x13fe10);}(_0xcd1e,0x67));var _0xecd1=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xcd1e[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xecd1('0x0'));var util=require(_0xecd1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xecd1('0x2'));var BPromise=require(_0xecd1('0x3'));var rp=require(_0xecd1('0x4'));var fs=require('fs');var path=require(_0xecd1('0x5'));var rimraf=require(_0xecd1('0x6'));var config=require(_0xecd1('0x7'));var attributes=require(_0xecd1('0x8'));module[_0xecd1('0x9')]=function(_0x3fb003,_0x28010a){return _0x3fb003[_0xecd1('0xa')](_0xecd1('0xb'),attributes,{'tableName':_0xecd1('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 c700147..d8b6de7 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 _0x261b=['message','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x14b86f,_0x31b7e2){var _0x1354e3=function(_0x2436bd){while(--_0x2436bd){_0x14b86f['push'](_0x14b86f['shift']());}};_0x1354e3(++_0x31b7e2);}(_0x261b,0x145));var _0xb261=function(_0x1f343a,_0x4b2c8e){_0x1f343a=_0x1f343a-0x0;var _0x5a94fa=_0x261b[_0x1f343a];return _0x5a94fa;};'use strict';var _=require(_0xb261('0x0'));var util=require('util');var moment=require(_0xb261('0x1'));var BPromise=require('bluebird');var rs=require(_0xb261('0x2'));var fs=require('fs');var Redis=require(_0xb261('0x3'));var db=require(_0xb261('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb261('0x5'));var jayson=require(_0xb261('0x6'));var client=jayson[_0xb261('0x7')][_0xb261('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6c650e,_0x5ea869,_0xeac159){return new BPromise(function(_0x2798a8,_0x3ae24e){return client[_0xb261('0x9')](_0x6c650e,_0xeac159)[_0xb261('0xa')](function(_0x43bdec){logger[_0xb261('0xb')](_0xb261('0xc'),_0x5ea869,'request\x20sent');logger['debug'](_0xb261('0xd'),_0x5ea869,_0xb261('0xe'),JSON['stringify'](_0x43bdec));if(_0x43bdec[_0xb261('0xf')]){if(_0x43bdec['error'][_0xb261('0x10')]===0x1f4){logger[_0xb261('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5ea869,_0x43bdec[_0xb261('0xf')]['message']);return _0x3ae24e(_0x43bdec[_0xb261('0xf')][_0xb261('0x11')]);}logger['error'](_0xb261('0xc'),_0x5ea869,_0x43bdec[_0xb261('0xf')][_0xb261('0x11')]);return _0x2798a8(_0x43bdec[_0xb261('0xf')][_0xb261('0x11')]);}else{logger['info'](_0xb261('0xc'),_0x5ea869,'request\x20sent');_0x2798a8(_0x43bdec['result'][_0xb261('0x11')]);}})['catch'](function(_0x2b3d34){logger[_0xb261('0xf')](_0xb261('0xc'),_0x5ea869,_0x2b3d34);_0x3ae24e(_0x2b3d34);});});} \ No newline at end of file +var _0xd703=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','ioredis'];(function(_0x198752,_0x410d18){var _0x3e749b=function(_0x55c334){while(--_0x55c334){_0x198752['push'](_0x198752['shift']());}};_0x3e749b(++_0x410d18);}(_0xd703,0x1d8));var _0x3d70=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xd703[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x3d70('0x0'));var util=require(_0x3d70('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d70('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d70('0x3'));var logger=require(_0x3d70('0x4'))(_0x3d70('0x5'));var config=require(_0x3d70('0x6'));var jayson=require(_0x3d70('0x7'));var client=jayson[_0x3d70('0x8')][_0x3d70('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1addaf,_0xf16b29,_0x314283){return new BPromise(function(_0x4b5fa1,_0x1b0b7a){return client['request'](_0x1addaf,_0x314283)[_0x3d70('0xa')](function(_0x2d34e7){logger[_0x3d70('0xb')](_0x3d70('0xc'),_0xf16b29,_0x3d70('0xd'));logger[_0x3d70('0xe')](_0x3d70('0xf'),_0xf16b29,_0x3d70('0xd'),JSON['stringify'](_0x2d34e7));if(_0x2d34e7[_0x3d70('0x10')]){if(_0x2d34e7[_0x3d70('0x10')]['code']===0x1f4){logger[_0x3d70('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0xf16b29,_0x2d34e7[_0x3d70('0x10')][_0x3d70('0x11')]);return _0x1b0b7a(_0x2d34e7[_0x3d70('0x10')][_0x3d70('0x11')]);}logger[_0x3d70('0x10')](_0x3d70('0xc'),_0xf16b29,_0x2d34e7['error'][_0x3d70('0x11')]);return _0x4b5fa1(_0x2d34e7[_0x3d70('0x10')][_0x3d70('0x11')]);}else{logger[_0x3d70('0xb')](_0x3d70('0xc'),_0xf16b29,_0x3d70('0xd'));_0x4b5fa1(_0x2d34e7['result']['message']);}})[_0x3d70('0x12')](function(_0x248a1e){logger[_0x3d70('0x10')](_0x3d70('0xc'),_0xf16b29,_0x248a1e);_0x1b0b7a(_0x248a1e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index fca2da9..b943c82 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 _0x2ef3=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x48cf3b,_0x1063ab){var _0x428539=function(_0x5329bc){while(--_0x5329bc){_0x48cf3b['push'](_0x48cf3b['shift']());}};_0x428539(++_0x1063ab);}(_0x2ef3,0xba));var _0x32ef=function(_0x1c01b1,_0x1ce1df){_0x1c01b1=_0x1c01b1-0x0;var _0x41ef38=_0x2ef3[_0x1c01b1];return _0x41ef38;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var controller=require('./intSalesforceField.controller');router[_0x32ef('0x8')]('/',auth[_0x32ef('0x9')](),controller['index']);router['get'](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xb')]);router[_0x32ef('0xc')]('/',auth[_0x32ef('0x9')](),controller[_0x32ef('0xd')]);router[_0x32ef('0xe')](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xf')]);router['delete']('/:id',auth[_0x32ef('0x9')](),controller[_0x32ef('0x10')]);module[_0x32ef('0x11')]=router; \ No newline at end of file +var _0x1261=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x4429e0,_0xee6f1f){var _0x51a5b3=function(_0x16eb11){while(--_0x16eb11){_0x4429e0['push'](_0x4429e0['shift']());}};_0x51a5b3(++_0xee6f1f);}(_0x1261,0x144));var _0x1126=function(_0x543c51,_0xff0084){_0x543c51=_0x543c51-0x0;var _0x360555=_0x1261[_0x543c51];return _0x360555;};'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('0xc')]('/',auth[_0x1126('0xd')](),controller[_0x1126('0xe')]);router[_0x1126('0xf')]('/:id',auth[_0x1126('0xd')](),controller[_0x1126('0x10')]);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xd')](),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 50c2d06..2fa1b79 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 _0x8a6c=['variable','customVariable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x3408c0,_0x271ef8){var _0x48335a=function(_0x77a51e){while(--_0x77a51e){_0x3408c0['push'](_0x3408c0['shift']());}};_0x48335a(++_0x271ef8);}(_0x8a6c,0x64));var _0xc8a6=function(_0x300192,_0xd86964){_0x300192=_0x300192-0x0;var _0x2d36b1=_0x8a6c[_0x300192];return _0x2d36b1;};'use strict';var Sequelize=require(_0xc8a6('0x0'));module[_0xc8a6('0x1')]={'type':{'type':Sequelize[_0xc8a6('0x2')](_0xc8a6('0x3'),_0xc8a6('0x4'),_0xc8a6('0x5'),_0xc8a6('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc8a6('0x7')]},'key':{'type':Sequelize[_0xc8a6('0x7')]},'keyType':{'type':Sequelize[_0xc8a6('0x2')](_0xc8a6('0x3'),_0xc8a6('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc8a6('0x7')]},'variableName':{'type':Sequelize[_0xc8a6('0x7')]}}; \ No newline at end of file +var _0x731e=['string','customVariable','keyValue','variable','STRING','sequelize','exports','ENUM'];(function(_0x4054e9,_0x29b091){var _0xb06d6f=function(_0x35db75){while(--_0x35db75){_0x4054e9['push'](_0x4054e9['shift']());}};_0xb06d6f(++_0x29b091);}(_0x731e,0x9d));var _0xe731=function(_0x3c451c,_0x3cc3ff){_0x3c451c=_0x3c451c-0x0;var _0x799bf0=_0x731e[_0x3c451c];return _0x799bf0;};'use strict';var Sequelize=require(_0xe731('0x0'));module[_0xe731('0x1')]={'type':{'type':Sequelize[_0xe731('0x2')](_0xe731('0x3'),'variable',_0xe731('0x4'),_0xe731('0x5')),'defaultValue':_0xe731('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xe731('0x6'),_0xe731('0x4'))},'keyContent':{'type':Sequelize[_0xe731('0x7')]},'idField':{'type':Sequelize[_0xe731('0x7')]},'variableName':{'type':Sequelize[_0xe731('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 0fd2f28..6b50479 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 _0xaa87=['moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','json','count','offset','status','set','apply','reject','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','SalesforceField','includeAll','include','findAll','rows','show','params','length','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x6b9865,_0x13202f){var _0x4c2935=function(_0x540900){while(--_0x540900){_0x6b9865['push'](_0x6b9865['shift']());}};_0x4c2935(++_0x13202f);}(_0xaa87,0x1ce));var _0x7aa8=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xaa87[_0x36ed48];return _0x51c63a;};'use strict';var pdf=require(_0x7aa8('0x0'));var emlformat=require(_0x7aa8('0x1'));var rimraf=require(_0x7aa8('0x2'));var zipdir=require(_0x7aa8('0x3'));var jsonpatch=require(_0x7aa8('0x4'));var rp=require(_0x7aa8('0x5'));var moment=require(_0x7aa8('0x6'));var BPromise=require(_0x7aa8('0x7'));var Mustache=require(_0x7aa8('0x8'));var util=require(_0x7aa8('0x9'));var path=require(_0x7aa8('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7aa8('0xb'));var fs=require('fs');var _=require(_0x7aa8('0xc'));var squel=require(_0x7aa8('0xd'));var crypto=require(_0x7aa8('0xe'));var jsforce=require(_0x7aa8('0xf'));var deskjs=require(_0x7aa8('0x10'));var toCsv=require(_0x7aa8('0x11'));var querystring=require(_0x7aa8('0x12'));var Papa=require(_0x7aa8('0x13'));var Redis=require(_0x7aa8('0x14'));var authService=require(_0x7aa8('0x15'));var qs=require(_0x7aa8('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7aa8('0x17'));var logger=require(_0x7aa8('0x18'))(_0x7aa8('0x19'));var utils=require('../../config/utils');var config=require(_0x7aa8('0x1a'));var db=require(_0x7aa8('0x1b'))['db'];function respondWithStatusCode(_0x74a7bf,_0x59d256){_0x59d256=_0x59d256||0xcc;return function(_0x3b4ea4){if(_0x3b4ea4){return _0x74a7bf[_0x7aa8('0x1c')](_0x59d256);}return _0x74a7bf['status'](_0x59d256)['end']();};}function respondWithResult(_0x509ce2,_0x2b779f){_0x2b779f=_0x2b779f||0xc8;return function(_0x4d36f3){if(_0x4d36f3){return _0x509ce2['status'](_0x2b779f)[_0x7aa8('0x1d')](_0x4d36f3);}};}function respondWithFilteredResult(_0x312d0f,_0x227138){return function(_0x1c951b){if(_0x1c951b){var _0x2a58e6=_0x1c951b[_0x7aa8('0x1e')],_0x3ee319=_0x227138[_0x7aa8('0x1f')],_0x451b07=_0x227138[_0x7aa8('0x1f')]+_0x227138['limit'],_0x3d3f26;if(_0x451b07>=_0x2a58e6){_0x451b07=_0x2a58e6;_0x3d3f26=0xc8;}else{_0x3d3f26=0xce;}_0x312d0f[_0x7aa8('0x20')](_0x3d3f26);return _0x312d0f[_0x7aa8('0x21')]('Content-Range',_0x3ee319+'-'+_0x451b07+'/'+_0x2a58e6)[_0x7aa8('0x1d')](_0x1c951b);}return null;};}function patchUpdates(_0x3e5519){return function(_0x37862e){try{jsonpatch[_0x7aa8('0x22')](_0x37862e,_0x3e5519,!![]);}catch(_0xabe494){return BPromise[_0x7aa8('0x23')](_0xabe494);}return _0x37862e[_0x7aa8('0x24')]();};}function saveUpdates(_0xc84200,_0x5d0043){return function(_0x1f713f){if(_0x1f713f){return _0x1f713f[_0x7aa8('0x25')](_0xc84200)[_0x7aa8('0x26')](function(_0x4e40f6){return _0x4e40f6;});}return null;};}function removeEntity(_0x5258da,_0x4bd8d6){return function(_0x2652a1){if(_0x2652a1){return _0x2652a1[_0x7aa8('0x27')]()[_0x7aa8('0x26')](function(){_0x5258da['status'](0xcc)[_0x7aa8('0x28')]();});}};}function handleEntityNotFound(_0x6182bd,_0x1315be){return function(_0x4b4868){if(!_0x4b4868){_0x6182bd[_0x7aa8('0x1c')](0x194);}return _0x4b4868;};}function handleError(_0x2b7b6e,_0x2c390b){_0x2c390b=_0x2c390b||0x1f4;return function(_0x488492){logger[_0x7aa8('0x29')](_0x488492['stack']);if(_0x488492[_0x7aa8('0x2a')]){delete _0x488492['name'];}_0x2b7b6e[_0x7aa8('0x20')](_0x2c390b)[_0x7aa8('0x2b')](_0x488492);};}exports[_0x7aa8('0x2c')]=function(_0x23e4ae,_0x319d76){var _0x2bf12c={},_0x2d0f2c={},_0x2e6c99={'count':0x0,'rows':[]};var _0xd58624=_[_0x7aa8('0x2d')](db['SalesforceField'][_0x7aa8('0x2e')],function(_0x21e350){return{'name':_0x21e350[_0x7aa8('0x2f')],'type':_0x21e350[_0x7aa8('0x30')]['key']};});_0x2d0f2c[_0x7aa8('0x31')]=_['map'](_0xd58624,_0x7aa8('0x2a'));_0x2d0f2c[_0x7aa8('0x32')]=_[_0x7aa8('0x33')](_0x23e4ae[_0x7aa8('0x32')]);_0x2d0f2c[_0x7aa8('0x34')]=_[_0x7aa8('0x35')](_0x2d0f2c[_0x7aa8('0x31')],_0x2d0f2c['query']);_0x2bf12c['attributes']=_[_0x7aa8('0x35')](_0x2d0f2c[_0x7aa8('0x31')],qs[_0x7aa8('0x36')](_0x23e4ae['query']['fields']));_0x2bf12c[_0x7aa8('0x37')]=_0x2bf12c['attributes']['length']?_0x2bf12c[_0x7aa8('0x37')]:_0x2d0f2c[_0x7aa8('0x31')];if(!_0x23e4ae['query'][_0x7aa8('0x38')](_0x7aa8('0x39'))){_0x2bf12c[_0x7aa8('0x3a')]=qs[_0x7aa8('0x3a')](_0x23e4ae[_0x7aa8('0x32')][_0x7aa8('0x3a')]);_0x2bf12c['offset']=qs['offset'](_0x23e4ae[_0x7aa8('0x32')]['offset']);}_0x2bf12c[_0x7aa8('0x3b')]=qs[_0x7aa8('0x3c')](_0x23e4ae['query']['sort']);_0x2bf12c[_0x7aa8('0x3d')]=qs['filters'](_['pick'](_0x23e4ae[_0x7aa8('0x32')],_0x2d0f2c['filters']),_0xd58624);if(_0x23e4ae[_0x7aa8('0x32')][_0x7aa8('0x3e')]){_0x2bf12c[_0x7aa8('0x3d')]=_['merge'](_0x2bf12c[_0x7aa8('0x3d')],{'$or':_['map'](_0xd58624,function(_0x1b6bc1){if(_0x1b6bc1[_0x7aa8('0x30')]!==_0x7aa8('0x3f')){var _0x18a63a={};_0x18a63a[_0x1b6bc1[_0x7aa8('0x2a')]]={'$like':'%'+_0x23e4ae[_0x7aa8('0x32')][_0x7aa8('0x3e')]+'%'};return _0x18a63a;}})});}_0x2bf12c=_[_0x7aa8('0x40')]({},_0x2bf12c,_0x23e4ae[_0x7aa8('0x41')]);var _0x3a2569={'where':_0x2bf12c['where']};return db[_0x7aa8('0x42')][_0x7aa8('0x1e')](_0x3a2569)[_0x7aa8('0x26')](function(_0x2b8707){_0x2e6c99[_0x7aa8('0x1e')]=_0x2b8707;if(_0x23e4ae[_0x7aa8('0x32')][_0x7aa8('0x43')]){_0x2bf12c[_0x7aa8('0x44')]=[{'all':!![]}];}return db[_0x7aa8('0x42')][_0x7aa8('0x45')](_0x2bf12c);})[_0x7aa8('0x26')](function(_0x52f37d){_0x2e6c99[_0x7aa8('0x46')]=_0x52f37d;return _0x2e6c99;})['then'](respondWithFilteredResult(_0x319d76,_0x2bf12c))['catch'](handleError(_0x319d76,null));};exports[_0x7aa8('0x47')]=function(_0xa8fa1a,_0x32a5aa){var _0x144a81={'raw':!![],'where':{'id':_0xa8fa1a[_0x7aa8('0x48')]['id']}},_0x181808={};_0x181808['model']=_['keys'](db[_0x7aa8('0x42')][_0x7aa8('0x2e')]);_0x181808[_0x7aa8('0x32')]=_[_0x7aa8('0x33')](_0xa8fa1a[_0x7aa8('0x32')]);_0x181808[_0x7aa8('0x34')]=_['intersection'](_0x181808[_0x7aa8('0x31')],_0x181808['query']);_0x144a81[_0x7aa8('0x37')]=_['intersection'](_0x181808[_0x7aa8('0x31')],qs['fields'](_0xa8fa1a['query'][_0x7aa8('0x36')]));_0x144a81[_0x7aa8('0x37')]=_0x144a81['attributes'][_0x7aa8('0x49')]?_0x144a81[_0x7aa8('0x37')]:_0x181808[_0x7aa8('0x31')];if(_0xa8fa1a[_0x7aa8('0x32')][_0x7aa8('0x43')]){_0x144a81[_0x7aa8('0x44')]=[{'all':!![]}];}_0x144a81=_[_0x7aa8('0x40')]({},_0x144a81,_0xa8fa1a[_0x7aa8('0x41')]);return db['SalesforceField']['find'](_0x144a81)[_0x7aa8('0x26')](handleEntityNotFound(_0x32a5aa,null))[_0x7aa8('0x26')](respondWithResult(_0x32a5aa,null))[_0x7aa8('0x4a')](handleError(_0x32a5aa,null));};exports['create']=function(_0x4d1843,_0x43ae68){return db[_0x7aa8('0x42')][_0x7aa8('0x4b')](_0x4d1843[_0x7aa8('0x4c')],{})['then'](respondWithResult(_0x43ae68,0xc9))['catch'](handleError(_0x43ae68,null));};exports[_0x7aa8('0x25')]=function(_0x3c0bb1,_0x6e5c01){if(_0x3c0bb1[_0x7aa8('0x4c')]['id']){delete _0x3c0bb1['body']['id'];}return db[_0x7aa8('0x42')]['find']({'where':{'id':_0x3c0bb1['params']['id']}})[_0x7aa8('0x26')](handleEntityNotFound(_0x6e5c01,null))[_0x7aa8('0x26')](saveUpdates(_0x3c0bb1[_0x7aa8('0x4c')],null))['then'](respondWithResult(_0x6e5c01,null))[_0x7aa8('0x4a')](handleError(_0x6e5c01,null));};exports['destroy']=function(_0x4b44b5,_0x28edb0){return db[_0x7aa8('0x42')][_0x7aa8('0x4d')]({'where':{'id':_0x4b44b5[_0x7aa8('0x48')]['id']}})[_0x7aa8('0x26')](handleEntityNotFound(_0x28edb0,null))[_0x7aa8('0x26')](removeEntity(_0x28edb0,null))[_0x7aa8('0x4a')](handleError(_0x28edb0,null));}; \ No newline at end of file +var _0xcecb=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','limit','set','json','reject','then','error','stack','name','send','index','map','SalesforceField'];(function(_0x108bf5,_0x211fd6){var _0x2d846d=function(_0xec9c28){while(--_0xec9c28){_0x108bf5['push'](_0x108bf5['shift']());}};_0x2d846d(++_0x211fd6);}(_0xcecb,0x66));var _0xbcec=function(_0x486775,_0x2630f9){_0x486775=_0x486775-0x0;var _0x35451e=_0xcecb[_0x486775];return _0x35451e;};'use strict';var pdf=require(_0xbcec('0x0'));var emlformat=require(_0xbcec('0x1'));var rimraf=require(_0xbcec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbcec('0x3'));var rp=require(_0xbcec('0x4'));var moment=require(_0xbcec('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbcec('0x6'));var util=require(_0xbcec('0x7'));var path=require(_0xbcec('0x8'));var sox=require(_0xbcec('0x9'));var csv=require('to-csv');var ejs=require(_0xbcec('0xa'));var fs=require('fs');var _=require(_0xbcec('0xb'));var squel=require(_0xbcec('0xc'));var crypto=require(_0xbcec('0xd'));var jsforce=require(_0xbcec('0xe'));var deskjs=require(_0xbcec('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbcec('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbcec('0x11'));var qs=require(_0xbcec('0x12'));var as=require(_0xbcec('0x13'));var hardwareService=require(_0xbcec('0x14'));var logger=require(_0xbcec('0x15'))(_0xbcec('0x16'));var utils=require(_0xbcec('0x17'));var config=require(_0xbcec('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d97b1,_0x35e239){_0x35e239=_0x35e239||0xcc;return function(_0x1260be){if(_0x1260be){return _0x5d97b1[_0xbcec('0x19')](_0x35e239);}return _0x5d97b1['status'](_0x35e239)[_0xbcec('0x1a')]();};}function respondWithResult(_0x5619d0,_0x4e93d9){_0x4e93d9=_0x4e93d9||0xc8;return function(_0x3af3f6){if(_0x3af3f6){return _0x5619d0[_0xbcec('0x1b')](_0x4e93d9)['json'](_0x3af3f6);}};}function respondWithFilteredResult(_0x9521ff,_0xf7a3){return function(_0x5c4062){if(_0x5c4062){var _0x4650f4=_0x5c4062[_0xbcec('0x1c')],_0x3e6781=_0xf7a3[_0xbcec('0x1d')],_0x1b6c8c=_0xf7a3[_0xbcec('0x1d')]+_0xf7a3[_0xbcec('0x1e')],_0x2a535b;if(_0x1b6c8c>=_0x4650f4){_0x1b6c8c=_0x4650f4;_0x2a535b=0xc8;}else{_0x2a535b=0xce;}_0x9521ff[_0xbcec('0x1b')](_0x2a535b);return _0x9521ff[_0xbcec('0x1f')]('Content-Range',_0x3e6781+'-'+_0x1b6c8c+'/'+_0x4650f4)[_0xbcec('0x20')](_0x5c4062);}return null;};}function patchUpdates(_0x3d2e32){return function(_0xa9ad09){try{jsonpatch['apply'](_0xa9ad09,_0x3d2e32,!![]);}catch(_0x420d6c){return BPromise[_0xbcec('0x21')](_0x420d6c);}return _0xa9ad09['save']();};}function saveUpdates(_0x850987,_0x39d684){return function(_0x4847b9){if(_0x4847b9){return _0x4847b9['update'](_0x850987)[_0xbcec('0x22')](function(_0x37a93c){return _0x37a93c;});}return null;};}function removeEntity(_0x1423f9,_0x59e9ac){return function(_0x2c8cbf){if(_0x2c8cbf){return _0x2c8cbf['destroy']()[_0xbcec('0x22')](function(){_0x1423f9[_0xbcec('0x1b')](0xcc)[_0xbcec('0x1a')]();});}};}function handleEntityNotFound(_0x450c0a,_0x2b46b7){return function(_0x106fcc){if(!_0x106fcc){_0x450c0a['sendStatus'](0x194);}return _0x106fcc;};}function handleError(_0x58fbfb,_0x5d9cb7){_0x5d9cb7=_0x5d9cb7||0x1f4;return function(_0x4888ab){logger[_0xbcec('0x23')](_0x4888ab[_0xbcec('0x24')]);if(_0x4888ab[_0xbcec('0x25')]){delete _0x4888ab[_0xbcec('0x25')];}_0x58fbfb[_0xbcec('0x1b')](_0x5d9cb7)[_0xbcec('0x26')](_0x4888ab);};}exports[_0xbcec('0x27')]=function(_0x2f6be5,_0x100e6c){var _0x1bb9f4={},_0x59b836={},_0x5236bc={'count':0x0,'rows':[]};var _0x3771a1=_[_0xbcec('0x28')](db[_0xbcec('0x29')][_0xbcec('0x2a')],function(_0x51e773){return{'name':_0x51e773[_0xbcec('0x2b')],'type':_0x51e773[_0xbcec('0x2c')][_0xbcec('0x2d')]};});_0x59b836[_0xbcec('0x2e')]=_[_0xbcec('0x28')](_0x3771a1,_0xbcec('0x25'));_0x59b836[_0xbcec('0x2f')]=_[_0xbcec('0x30')](_0x2f6be5[_0xbcec('0x2f')]);_0x59b836[_0xbcec('0x31')]=_[_0xbcec('0x32')](_0x59b836[_0xbcec('0x2e')],_0x59b836[_0xbcec('0x2f')]);_0x1bb9f4[_0xbcec('0x33')]=_[_0xbcec('0x32')](_0x59b836[_0xbcec('0x2e')],qs[_0xbcec('0x34')](_0x2f6be5[_0xbcec('0x2f')][_0xbcec('0x34')]));_0x1bb9f4[_0xbcec('0x33')]=_0x1bb9f4[_0xbcec('0x33')][_0xbcec('0x35')]?_0x1bb9f4[_0xbcec('0x33')]:_0x59b836[_0xbcec('0x2e')];if(!_0x2f6be5[_0xbcec('0x2f')]['hasOwnProperty'](_0xbcec('0x36'))){_0x1bb9f4[_0xbcec('0x1e')]=qs[_0xbcec('0x1e')](_0x2f6be5[_0xbcec('0x2f')][_0xbcec('0x1e')]);_0x1bb9f4[_0xbcec('0x1d')]=qs[_0xbcec('0x1d')](_0x2f6be5[_0xbcec('0x2f')]['offset']);}_0x1bb9f4['order']=qs['sort'](_0x2f6be5[_0xbcec('0x2f')][_0xbcec('0x37')]);_0x1bb9f4['where']=qs['filters'](_[_0xbcec('0x38')](_0x2f6be5[_0xbcec('0x2f')],_0x59b836[_0xbcec('0x31')]),_0x3771a1);if(_0x2f6be5[_0xbcec('0x2f')]['filter']){_0x1bb9f4[_0xbcec('0x39')]=_['merge'](_0x1bb9f4['where'],{'$or':_['map'](_0x3771a1,function(_0x53e659){if(_0x53e659[_0xbcec('0x2c')]!==_0xbcec('0x3a')){var _0x267ecd={};_0x267ecd[_0x53e659[_0xbcec('0x25')]]={'$like':'%'+_0x2f6be5[_0xbcec('0x2f')][_0xbcec('0x3b')]+'%'};return _0x267ecd;}})});}_0x1bb9f4=_[_0xbcec('0x3c')]({},_0x1bb9f4,_0x2f6be5[_0xbcec('0x3d')]);var _0x53cccf={'where':_0x1bb9f4[_0xbcec('0x39')]};return db[_0xbcec('0x29')][_0xbcec('0x1c')](_0x53cccf)['then'](function(_0x560ce5){_0x5236bc[_0xbcec('0x1c')]=_0x560ce5;if(_0x2f6be5[_0xbcec('0x2f')][_0xbcec('0x3e')]){_0x1bb9f4[_0xbcec('0x3f')]=[{'all':!![]}];}return db[_0xbcec('0x29')][_0xbcec('0x40')](_0x1bb9f4);})['then'](function(_0x482841){_0x5236bc['rows']=_0x482841;return _0x5236bc;})['then'](respondWithFilteredResult(_0x100e6c,_0x1bb9f4))[_0xbcec('0x41')](handleError(_0x100e6c,null));};exports[_0xbcec('0x42')]=function(_0x19a4ae,_0x4a2f96){var _0x5a521b={'raw':!![],'where':{'id':_0x19a4ae[_0xbcec('0x43')]['id']}},_0x20e673={};_0x20e673[_0xbcec('0x2e')]=_[_0xbcec('0x30')](db[_0xbcec('0x29')][_0xbcec('0x2a')]);_0x20e673[_0xbcec('0x2f')]=_[_0xbcec('0x30')](_0x19a4ae[_0xbcec('0x2f')]);_0x20e673[_0xbcec('0x31')]=_[_0xbcec('0x32')](_0x20e673[_0xbcec('0x2e')],_0x20e673[_0xbcec('0x2f')]);_0x5a521b[_0xbcec('0x33')]=_[_0xbcec('0x32')](_0x20e673[_0xbcec('0x2e')],qs['fields'](_0x19a4ae[_0xbcec('0x2f')]['fields']));_0x5a521b[_0xbcec('0x33')]=_0x5a521b[_0xbcec('0x33')]['length']?_0x5a521b[_0xbcec('0x33')]:_0x20e673[_0xbcec('0x2e')];if(_0x19a4ae[_0xbcec('0x2f')][_0xbcec('0x3e')]){_0x5a521b['include']=[{'all':!![]}];}_0x5a521b=_[_0xbcec('0x3c')]({},_0x5a521b,_0x19a4ae[_0xbcec('0x3d')]);return db['SalesforceField'][_0xbcec('0x44')](_0x5a521b)[_0xbcec('0x22')](handleEntityNotFound(_0x4a2f96,null))['then'](respondWithResult(_0x4a2f96,null))['catch'](handleError(_0x4a2f96,null));};exports[_0xbcec('0x45')]=function(_0x110181,_0xd218ce){return db[_0xbcec('0x29')][_0xbcec('0x45')](_0x110181[_0xbcec('0x46')],{})[_0xbcec('0x22')](respondWithResult(_0xd218ce,0xc9))[_0xbcec('0x41')](handleError(_0xd218ce,null));};exports[_0xbcec('0x47')]=function(_0x13ea8d,_0x16f5d6){if(_0x13ea8d[_0xbcec('0x46')]['id']){delete _0x13ea8d[_0xbcec('0x46')]['id'];}return db[_0xbcec('0x29')]['find']({'where':{'id':_0x13ea8d[_0xbcec('0x43')]['id']}})[_0xbcec('0x22')](handleEntityNotFound(_0x16f5d6,null))[_0xbcec('0x22')](saveUpdates(_0x13ea8d['body'],null))['then'](respondWithResult(_0x16f5d6,null))[_0xbcec('0x41')](handleError(_0x16f5d6,null));};exports['destroy']=function(_0xf154db,_0x588ed8){return db[_0xbcec('0x29')][_0xbcec('0x44')]({'where':{'id':_0xf154db[_0xbcec('0x43')]['id']}})[_0xbcec('0x22')](handleEntityNotFound(_0x588ed8,null))['then'](removeEntity(_0x588ed8,null))[_0xbcec('0x41')](handleError(_0x588ed8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 853e300..004cdf4 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 _0x581b=['api','request-promise','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x2f358c,_0x3cfe1b){var _0xff636a=function(_0x3b0102){while(--_0x3b0102){_0x2f358c['push'](_0x2f358c['shift']());}};_0xff636a(++_0x3cfe1b);}(_0x581b,0x184));var _0xb581=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x581b[_0x29db36];return _0x234e87;};'use strict';var _=require('lodash');var util=require(_0xb581('0x0'));var logger=require(_0xb581('0x1'))(_0xb581('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb581('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x25ba6e,_0x1860c2){return _0x25ba6e[_0xb581('0x4')](_0xb581('0x5'),attributes,{'tableName':_0xb581('0x6'),'paranoid':![],'indexes':[{'name':_0xb581('0x7'),'fields':[_0xb581('0x8'),_0xb581('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf4af=['idField','FieldId','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf4af,0x1de));var _0xff4a=function(_0x102376,_0x16c6a2){_0x102376=_0x102376-0x0;var _0x29bc9c=_0xf4af[_0x102376];return _0x29bc9c;};'use strict';var _=require('lodash');var util=require(_0xff4a('0x0'));var logger=require(_0xff4a('0x1'))(_0xff4a('0x2'));var moment=require(_0xff4a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xff4a('0x4'));var rimraf=require(_0xff4a('0x5'));var config=require(_0xff4a('0x6'));var attributes=require(_0xff4a('0x7'));module[_0xff4a('0x8')]=function(_0x50666c,_0x2dac12){return _0x50666c[_0xff4a('0x9')](_0xff4a('0xa'),attributes,{'tableName':_0xff4a('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xff4a('0xc'),_0xff4a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 4dbdc3e..b35c541 100644 --- a/server/api/intSalesforceField/intSalesforceField.rpc.js +++ b/server/api/intSalesforceField/intSalesforceField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdace=['request\x20sent','debug','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xdace,0xc5));var _0xedac=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0xdace[_0x37b7b6];return _0x10c4c3;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('SalesforceField,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file +var _0x0713=['SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\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(_0x13b506,_0xd8922e){var _0x402b22=function(_0x3c9c20){while(--_0x3c9c20){_0x13b506['push'](_0x13b506['shift']());}};_0x402b22(++_0xd8922e);}(_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')]('SalesforceField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('SalesforceField,\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')]('SalesforceField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 367a8fe..d5090ed 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 _0x4262=['util','path','express','../../components/auth/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','update','delete','destroy','exports','multer'];(function(_0x986d0c,_0x4d9432){var _0x5c7169=function(_0x2eb7ef){while(--_0x2eb7ef){_0x986d0c['push'](_0x986d0c['shift']());}};_0x5c7169(++_0x4d9432);}(_0x4262,0x15f));var _0x2426=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4262[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x2426('0x0'));var util=require(_0x2426('0x1'));var path=require(_0x2426('0x2'));var timeout=require('connect-timeout');var express=require(_0x2426('0x3'));var router=express['Router']();var auth=require(_0x2426('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2426('0x5'));router[_0x2426('0x6')]('/',auth[_0x2426('0x7')](),controller[_0x2426('0x8')]);router['get'](_0x2426('0x9'),auth[_0x2426('0x7')](),controller[_0x2426('0xa')]);router[_0x2426('0x6')](_0x2426('0xb'),auth['isAuthenticated'](),controller[_0x2426('0xc')]);router[_0x2426('0x6')](_0x2426('0xd'),auth[_0x2426('0x7')](),controller[_0x2426('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2426('0xf')]);router[_0x2426('0x10')](_0x2426('0xb'),auth[_0x2426('0x7')](),controller[_0x2426('0x11')]);router['put'](_0x2426('0x9'),auth[_0x2426('0x7')](),controller[_0x2426('0x12')]);router[_0x2426('0x13')]('/:id',auth[_0x2426('0x7')](),controller[_0x2426('0x14')]);module[_0x2426('0x15')]=router; \ No newline at end of file +var _0xf350=['getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','/:id','isAuthenticated','/:id/fields'];(function(_0x332581,_0x11feb6){var _0x3674ff=function(_0x354b74){while(--_0x354b74){_0x332581['push'](_0x332581['shift']());}};_0x3674ff(++_0x11feb6);}(_0xf350,0x105));var _0x0f35=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf350[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x0f35('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0f35('0x1'));var express=require(_0x0f35('0x2'));var router=express[_0x0f35('0x3')]();var auth=require(_0x0f35('0x4'));var interaction=require(_0x0f35('0x5'));var config=require(_0x0f35('0x6'));var controller=require(_0x0f35('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0f35('0x8')](_0x0f35('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x0f35('0x8')]('/:id/configurations',auth[_0x0f35('0xa')](),controller['getConfigurations']);router[_0x0f35('0x8')](_0x0f35('0xb'),auth[_0x0f35('0xa')](),controller[_0x0f35('0xc')]);router[_0x0f35('0xd')]('/',auth[_0x0f35('0xa')](),controller[_0x0f35('0xe')]);router[_0x0f35('0xd')](_0x0f35('0xf'),auth['isAuthenticated'](),controller[_0x0f35('0x10')]);router[_0x0f35('0x11')]('/:id',auth[_0x0f35('0xa')](),controller['update']);router[_0x0f35('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0f35('0x13')]);module[_0x0f35('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 6e43284..8de9577 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 _0x26a3=['remoteUri','sequelize','exports','STRING'];(function(_0x356866,_0xece868){var _0x1bfad3=function(_0x2bd143){while(--_0x2bd143){_0x356866['push'](_0x356866['shift']());}};_0x1bfad3(++_0xece868);}(_0x26a3,0x155));var _0x326a=function(_0x2f6a61,_0x3953fa){_0x2f6a61=_0x2f6a61-0x0;var _0x414911=_0x26a3[_0x2f6a61];return _0x414911;};'use strict';var Sequelize=require(_0x326a('0x0'));module[_0x326a('0x1')]={'name':{'type':Sequelize[_0x326a('0x2')]},'description':{'type':Sequelize[_0x326a('0x2')]},'username':{'type':Sequelize[_0x326a('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x326a('0x2')]},'email':{'type':Sequelize[_0x326a('0x2')]},'remoteUri':{'type':Sequelize[_0x326a('0x2')],'unique':_0x326a('0x3')},'serverUrl':{'type':Sequelize[_0x326a('0x2')]}}; \ No newline at end of file +var _0x0bc6=['STRING','remoteUri','sequelize','exports'];(function(_0x3a2a78,_0x56c496){var _0x21fb7f=function(_0x1b7cfd){while(--_0x1b7cfd){_0x3a2a78['push'](_0x3a2a78['shift']());}};_0x21fb7f(++_0x56c496);}(_0x0bc6,0x10a));var _0x60bc=function(_0x41c10a,_0x402241){_0x41c10a=_0x41c10a-0x0;var _0x45ce43=_0x0bc6[_0x41c10a];return _0x45ce43;};'use strict';var Sequelize=require(_0x60bc('0x0'));module[_0x60bc('0x1')]={'name':{'type':Sequelize[_0x60bc('0x2')]},'description':{'type':Sequelize[_0x60bc('0x2')]},'username':{'type':Sequelize[_0x60bc('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x60bc('0x2')]},'email':{'type':Sequelize[_0x60bc('0x2')]},'remoteUri':{'type':Sequelize[_0x60bc('0x2')],'unique':_0x60bc('0x3')},'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 ceed828..594b9e5 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 _0x4bce=['ServicenowConfiguration','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','ServicenowField','Subjects','made_sla','subcategory','close_code','notify','incident_state','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','opened_by','sys_created_on','state','sys_created_by','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','work_end','reopened_time','caller_id','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','contact_type','urgency','problem_id','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','location','username','password','email','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','log','TCL:\x20_object','forEach','concat','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','True','false','sys_choice?sysparm_query=name=incident^element=','inactive','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','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','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','merge','where','type','options','count','includeAll','include','rows','params','keys','length','find','create','body','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4bce,0x1e5));var _0xe4bc=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x4bce[_0xa8883];return _0x479426;};'use strict';var pdf=require(_0xe4bc('0x0'));var emlformat=require(_0xe4bc('0x1'));var rimraf=require(_0xe4bc('0x2'));var zipdir=require(_0xe4bc('0x3'));var jsonpatch=require(_0xe4bc('0x4'));var rp=require(_0xe4bc('0x5'));var moment=require(_0xe4bc('0x6'));var BPromise=require(_0xe4bc('0x7'));var Mustache=require(_0xe4bc('0x8'));var util=require(_0xe4bc('0x9'));var path=require('path');var sox=require(_0xe4bc('0xa'));var csv=require(_0xe4bc('0xb'));var ejs=require(_0xe4bc('0xc'));var fs=require('fs');var _=require(_0xe4bc('0xd'));var squel=require(_0xe4bc('0xe'));var crypto=require(_0xe4bc('0xf'));var jsforce=require(_0xe4bc('0x10'));var deskjs=require(_0xe4bc('0x11'));var toCsv=require(_0xe4bc('0xb'));var querystring=require('querystring');var Papa=require(_0xe4bc('0x12'));var Redis=require(_0xe4bc('0x13'));var authService=require(_0xe4bc('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe4bc('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4bc('0x16'))(_0xe4bc('0x17'));var utils=require(_0xe4bc('0x18'));var config=require('../../config/environment');var db=require(_0xe4bc('0x19'))['db'];var integrations=require(_0xe4bc('0x1a'));var jayson=require(_0xe4bc('0x1b'));var client=jayson[_0xe4bc('0x1c')][_0xe4bc('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x5609fa,_0x10f653,_0x30939c){if(_0x30939c){var _0x42a8ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x42a8ce[_0xe4bc('0x1e')](_0x10f653)){return _0x5609fa;}else{throw new db['Sequelize'][(_0xe4bc('0x1f'))](_0xe4bc('0x20'));}}else{return _0x5609fa;}}function respondWithRpcPromise(_0x60145c,_0x138983,_0x3515b1,_0x4c63bc){return new BPromise(function(_0x370827,_0x59d913){var _0x65343e=_0x4c63bc||client;return _0x65343e[_0xe4bc('0x21')](_0x60145c,_0x3515b1)[_0xe4bc('0x22')](function(_0xb76835){logger['info'](_0xe4bc('0x23'),_0x138983,_0xe4bc('0x24'));logger[_0xe4bc('0x25')](_0xe4bc('0x26'),_0x138983,_0xe4bc('0x24'),JSON[_0xe4bc('0x27')](_0xb76835));if(_0xb76835[_0xe4bc('0x28')]){if(_0xb76835[_0xe4bc('0x28')][_0xe4bc('0x29')]===0x1f4){logger[_0xe4bc('0x28')](_0xe4bc('0x23'),_0x138983,_0xb76835[_0xe4bc('0x28')][_0xe4bc('0x2a')]);return _0x59d913(_0xb76835[_0xe4bc('0x28')]['message']);}logger[_0xe4bc('0x28')]('ServicenowAccount,\x20%s,\x20%s',_0x138983,_0xb76835[_0xe4bc('0x28')][_0xe4bc('0x2a')]);return _0x370827(_0xb76835['error'][_0xe4bc('0x2a')]);}else{logger['info'](_0xe4bc('0x23'),_0x138983,'request\x20sent');_0x370827(_0xb76835[_0xe4bc('0x2b')][_0xe4bc('0x2a')]);}})[_0xe4bc('0x2c')](function(_0x44eab2){logger[_0xe4bc('0x28')](_0xe4bc('0x23'),_0x138983,_0x44eab2);_0x59d913(_0x44eab2);});});}function respondWithStatusCode(_0x3d1ed4,_0x48951d){_0x48951d=_0x48951d||0xcc;return function(_0x4658f2){if(_0x4658f2){return _0x3d1ed4[_0xe4bc('0x2d')](_0x48951d);}return _0x3d1ed4[_0xe4bc('0x2e')](_0x48951d)[_0xe4bc('0x2f')]();};}function respondWithResult(_0x4b8350,_0x4de5f3){_0x4de5f3=_0x4de5f3||0xc8;return function(_0x513111){if(_0x513111){return _0x4b8350[_0xe4bc('0x2e')](_0x4de5f3)['json'](_0x513111);}};}function respondWithFilteredResult(_0x49ece7,_0x4f08ce){return function(_0x4cd3db){if(_0x4cd3db){var _0x4e2813=_0x4cd3db['count'],_0x3a1eea=_0x4f08ce['offset'],_0x45de75=_0x4f08ce[_0xe4bc('0x30')]+_0x4f08ce[_0xe4bc('0x31')],_0x2e5eb1;if(_0x45de75>=_0x4e2813){_0x45de75=_0x4e2813;_0x2e5eb1=0xc8;}else{_0x2e5eb1=0xce;}_0x49ece7[_0xe4bc('0x2e')](_0x2e5eb1);return _0x49ece7[_0xe4bc('0x32')](_0xe4bc('0x33'),_0x3a1eea+'-'+_0x45de75+'/'+_0x4e2813)['json'](_0x4cd3db);}return null;};}function patchUpdates(_0x12a47b){return function(_0xc10f03){try{jsonpatch[_0xe4bc('0x34')](_0xc10f03,_0x12a47b,!![]);}catch(_0x817971){return BPromise[_0xe4bc('0x35')](_0x817971);}return _0xc10f03[_0xe4bc('0x36')]();};}function saveUpdates(_0x2eb8e2,_0x42c0c9){return function(_0x2cbaf4){if(_0x2cbaf4){return _0x2cbaf4[_0xe4bc('0x37')](_0x2eb8e2)[_0xe4bc('0x22')](function(_0x5e4263){return _0x5e4263;});}return null;};}function removeEntity(_0xc28d30,_0x8e0fba){return function(_0x1fdd63){if(_0x1fdd63){return _0x1fdd63['destroy']()[_0xe4bc('0x22')](function(){_0xc28d30[_0xe4bc('0x2e')](0xcc)[_0xe4bc('0x2f')]();});}};}function handleEntityNotFound(_0x14974f,_0x3c01ec){return function(_0x18b2f2){if(!_0x18b2f2){_0x14974f['sendStatus'](0x194);}return _0x18b2f2;};}function handleError(_0x19db69,_0x32f523){_0x32f523=_0x32f523||0x1f4;return function(_0x6c176f){logger['error'](_0x6c176f[_0xe4bc('0x38')]);if(_0x6c176f[_0xe4bc('0x39')]){delete _0x6c176f[_0xe4bc('0x39')];}_0x19db69[_0xe4bc('0x2e')](_0x32f523)[_0xe4bc('0x3a')](_0x6c176f);};}exports[_0xe4bc('0x3b')]=function(_0x4e01c0,_0x202d1e){var _0x293fb3={},_0x29919d={},_0x576fa2={'count':0x0,'rows':[]};var _0x34ef86=_[_0xe4bc('0x3c')](db[_0xe4bc('0x3d')][_0xe4bc('0x3e')],function(_0x17d5b9){return{'name':_0x17d5b9[_0xe4bc('0x3f')],'type':_0x17d5b9['type'][_0xe4bc('0x40')]};});_0x29919d[_0xe4bc('0x41')]=_[_0xe4bc('0x3c')](_0x34ef86,_0xe4bc('0x39'));_0x29919d[_0xe4bc('0x42')]=_['keys'](_0x4e01c0[_0xe4bc('0x42')]);_0x29919d[_0xe4bc('0x43')]=_['intersection'](_0x29919d[_0xe4bc('0x41')],_0x29919d['query']);_0x293fb3[_0xe4bc('0x44')]=_[_0xe4bc('0x45')](_0x29919d['model'],qs['fields'](_0x4e01c0[_0xe4bc('0x42')][_0xe4bc('0x46')]));_0x293fb3[_0xe4bc('0x44')]=_0x293fb3[_0xe4bc('0x44')]['length']?_0x293fb3['attributes']:_0x29919d[_0xe4bc('0x41')];if(!_0x4e01c0[_0xe4bc('0x42')]['hasOwnProperty'](_0xe4bc('0x47'))){_0x293fb3[_0xe4bc('0x31')]=qs[_0xe4bc('0x31')](_0x4e01c0[_0xe4bc('0x42')][_0xe4bc('0x31')]);_0x293fb3['offset']=qs[_0xe4bc('0x30')](_0x4e01c0[_0xe4bc('0x42')][_0xe4bc('0x30')]);}_0x293fb3[_0xe4bc('0x48')]=qs['sort'](_0x4e01c0[_0xe4bc('0x42')][_0xe4bc('0x49')]);_0x293fb3['where']=qs[_0xe4bc('0x43')](_[_0xe4bc('0x4a')](_0x4e01c0[_0xe4bc('0x42')],_0x29919d[_0xe4bc('0x43')]),_0x34ef86);if(_0x4e01c0[_0xe4bc('0x42')][_0xe4bc('0x4b')]){_0x293fb3['where']=_[_0xe4bc('0x4c')](_0x293fb3[_0xe4bc('0x4d')],{'$or':_[_0xe4bc('0x3c')](_0x34ef86,function(_0x4a1575){if(_0x4a1575[_0xe4bc('0x4e')]!=='VIRTUAL'){var _0x1ad483={};_0x1ad483[_0x4a1575[_0xe4bc('0x39')]]={'$like':'%'+_0x4e01c0['query'][_0xe4bc('0x4b')]+'%'};return _0x1ad483;}})});}_0x293fb3=_[_0xe4bc('0x4c')]({},_0x293fb3,_0x4e01c0[_0xe4bc('0x4f')]);var _0x3a7c43={'where':_0x293fb3[_0xe4bc('0x4d')]};return db[_0xe4bc('0x3d')][_0xe4bc('0x50')](_0x3a7c43)[_0xe4bc('0x22')](function(_0x19558d){_0x576fa2[_0xe4bc('0x50')]=_0x19558d;if(_0x4e01c0[_0xe4bc('0x42')][_0xe4bc('0x51')]){_0x293fb3[_0xe4bc('0x52')]=[{'all':!![]}];}return db[_0xe4bc('0x3d')]['findAll'](_0x293fb3);})[_0xe4bc('0x22')](function(_0x3c2527){_0x576fa2[_0xe4bc('0x53')]=_0x3c2527;return _0x576fa2;})['then'](respondWithFilteredResult(_0x202d1e,_0x293fb3))[_0xe4bc('0x2c')](handleError(_0x202d1e,null));};exports['show']=function(_0x191058,_0x5defa2){var _0x318a26={'raw':![],'where':{'id':_0x191058[_0xe4bc('0x54')]['id']}},_0x299978={};_0x299978[_0xe4bc('0x41')]=_[_0xe4bc('0x55')](db[_0xe4bc('0x3d')][_0xe4bc('0x3e')]);_0x299978[_0xe4bc('0x42')]=_['keys'](_0x191058['query']);_0x299978['filters']=_[_0xe4bc('0x45')](_0x299978[_0xe4bc('0x41')],_0x299978[_0xe4bc('0x42')]);_0x318a26[_0xe4bc('0x44')]=_[_0xe4bc('0x45')](_0x299978[_0xe4bc('0x41')],qs[_0xe4bc('0x46')](_0x191058['query'][_0xe4bc('0x46')]));_0x318a26[_0xe4bc('0x44')]=_0x318a26[_0xe4bc('0x44')][_0xe4bc('0x56')]?_0x318a26[_0xe4bc('0x44')]:_0x299978['model'];if(_0x191058['query'][_0xe4bc('0x51')]){_0x318a26['include']=[{'all':!![]}];}_0x318a26=_[_0xe4bc('0x4c')]({},_0x318a26,_0x191058['options']);return db[_0xe4bc('0x3d')][_0xe4bc('0x57')](_0x318a26)[_0xe4bc('0x22')](handleEntityNotFound(_0x5defa2,null))['then'](respondWithResult(_0x5defa2,null))[_0xe4bc('0x2c')](handleError(_0x5defa2,null));};exports[_0xe4bc('0x58')]=function(_0x48d59b,_0x517e65){return db[_0xe4bc('0x3d')]['create'](_0x48d59b[_0xe4bc('0x59')],{})[_0xe4bc('0x22')](respondWithResult(_0x517e65,0xc9))[_0xe4bc('0x2c')](handleError(_0x517e65,null));};exports[_0xe4bc('0x37')]=function(_0x46d4a9,_0x18aaa5){if(_0x46d4a9[_0xe4bc('0x59')]['id']){delete _0x46d4a9[_0xe4bc('0x59')]['id'];}return db[_0xe4bc('0x3d')][_0xe4bc('0x57')]({'where':{'id':_0x46d4a9[_0xe4bc('0x54')]['id']}})['then'](handleEntityNotFound(_0x18aaa5,null))[_0xe4bc('0x22')](saveUpdates(_0x46d4a9[_0xe4bc('0x59')],null))[_0xe4bc('0x22')](respondWithResult(_0x18aaa5,null))['catch'](handleError(_0x18aaa5,null));};exports[_0xe4bc('0x5a')]=function(_0x3c361,_0x4d39f){return db['ServicenowAccount'][_0xe4bc('0x57')]({'where':{'id':_0x3c361[_0xe4bc('0x54')]['id']}})['then'](handleEntityNotFound(_0x4d39f,null))[_0xe4bc('0x22')](removeEntity(_0x4d39f,null))[_0xe4bc('0x2c')](handleError(_0x4d39f,null));};exports['getConfigurations']=function(_0x5baf1,_0x2ce120,_0x5cd81d){var _0x41d416={};var _0x2efed4={};var _0x1901a4;var _0x214012;return db[_0xe4bc('0x3d')]['findOne']({'where':{'id':_0x5baf1[_0xe4bc('0x54')]['id']}})[_0xe4bc('0x22')](handleEntityNotFound(_0x2ce120,null))[_0xe4bc('0x22')](function(_0x576e99){if(_0x576e99){_0x1901a4=_0x576e99;_0x2efed4[_0xe4bc('0x41')]=_[_0xe4bc('0x55')](db[_0xe4bc('0x5b')]['rawAttributes']);_0x2efed4[_0xe4bc('0x42')]=_[_0xe4bc('0x55')](_0x5baf1['query']);_0x2efed4['filters']=_[_0xe4bc('0x45')](_0x2efed4[_0xe4bc('0x41')],_0x2efed4[_0xe4bc('0x42')]);_0x41d416[_0xe4bc('0x44')]=_[_0xe4bc('0x45')](_0x2efed4[_0xe4bc('0x41')],qs['fields'](_0x5baf1[_0xe4bc('0x42')][_0xe4bc('0x46')]));_0x41d416[_0xe4bc('0x44')]=_0x41d416[_0xe4bc('0x44')][_0xe4bc('0x56')]?_0x41d416[_0xe4bc('0x44')]:_0x2efed4[_0xe4bc('0x41')];_0x41d416[_0xe4bc('0x48')]=qs[_0xe4bc('0x49')](_0x5baf1[_0xe4bc('0x42')]['sort']);_0x41d416[_0xe4bc('0x4d')]=qs['filters'](_[_0xe4bc('0x4a')](_0x5baf1[_0xe4bc('0x42')],_0x2efed4[_0xe4bc('0x43')]));if(_0x5baf1[_0xe4bc('0x42')][_0xe4bc('0x4b')]){_0x41d416[_0xe4bc('0x4d')]=_[_0xe4bc('0x4c')](_0x41d416[_0xe4bc('0x4d')],{'$or':_['map'](_0x41d416['attributes'],function(_0x5b7506){var _0x5207c9={};_0x5207c9[_0x5b7506]={'$like':'%'+_0x5baf1['query'][_0xe4bc('0x4b')]+'%'};return _0x5207c9;})});}_0x41d416=_['merge']({},_0x41d416,_0x5baf1[_0xe4bc('0x4f')]);return _0x1901a4[_0xe4bc('0x5c')](_0x41d416);}})['then'](function(_0x37e080){if(_0x37e080){_0x214012=_0x37e080[_0xe4bc('0x56')];if(!_0x5baf1['query'][_0xe4bc('0x5d')]('nolimit')){_0x41d416[_0xe4bc('0x31')]=qs['limit'](_0x5baf1[_0xe4bc('0x42')][_0xe4bc('0x31')]);_0x41d416['offset']=qs[_0xe4bc('0x30')](_0x5baf1[_0xe4bc('0x42')][_0xe4bc('0x30')]);}return _0x1901a4[_0xe4bc('0x5c')](_0x41d416);}})[_0xe4bc('0x22')](function(_0x27e542){if(_0x27e542){return _0x27e542?{'count':_0x214012,'rows':_0x27e542}:null;}})[_0xe4bc('0x22')](respondWithResult(_0x2ce120,null))['catch'](handleError(_0x2ce120,null));};exports[_0xe4bc('0x5e')]=function(_0x20da8c,_0x3618cf,_0x1a8bca){if(_0x20da8c['body']['id']){delete _0x20da8c[_0xe4bc('0x59')]['id'];}return db[_0xe4bc('0x3d')][_0xe4bc('0x5f')]({'where':{'id':_0x20da8c[_0xe4bc('0x54')]['id']}})['then'](handleEntityNotFound(_0x3618cf,null))[_0xe4bc('0x22')](function(_0x5ba707){if(_0x5ba707){_0x20da8c['body'][_0xe4bc('0x60')]=_0x5ba707['id'];_0x20da8c[_0xe4bc('0x59')]['Subjects']=integrations[_0xe4bc('0x61')](_0x20da8c[_0xe4bc('0x59')][_0xe4bc('0x62')],_0x20da8c['body'][_0xe4bc('0x4e')]);_0x20da8c[_0xe4bc('0x59')]['Descriptions']=integrations[_0xe4bc('0x63')](_0x20da8c[_0xe4bc('0x59')][_0xe4bc('0x62')],_0x20da8c[_0xe4bc('0x59')][_0xe4bc('0x4e')]);return db[_0xe4bc('0x5b')][_0xe4bc('0x58')](_0x20da8c[_0xe4bc('0x59')],{'include':[{'model':db[_0xe4bc('0x64')],'as':_0xe4bc('0x65')},{'model':db[_0xe4bc('0x64')],'as':'Descriptions'}]});}return null;})[_0xe4bc('0x22')](respondWithResult(_0x3618cf,null))[_0xe4bc('0x2c')](handleError(_0x3618cf,null));};exports['getFields']=function(_0x3c0c40,_0x2f54f9,_0x21d0fd){var _0x159e55=[_0xe4bc('0x66'),'hold_reason','knowledge',_0xe4bc('0x67'),_0xe4bc('0x68'),_0xe4bc('0x69'),_0xe4bc('0x6a'),_0xe4bc('0x6b'),_0xe4bc('0x6c')];var _0x3539db=['parent',_0xe4bc('0x66'),_0xe4bc('0x6d'),_0xe4bc('0x6e'),_0xe4bc('0x6f'),_0xe4bc('0x70'),_0xe4bc('0x71'),'hold_reason','approval_history',_0xe4bc('0x72'),_0xe4bc('0x73'),_0xe4bc('0x74'),_0xe4bc('0x75'),'user_input',_0xe4bc('0x76'),'sys_domain',_0xe4bc('0x77'),_0xe4bc('0x78'),'knowledge',_0xe4bc('0x48'),'calendar_stc',_0xe4bc('0x79'),'cmdb_ci',_0xe4bc('0x7a'),_0xe4bc('0x7b'),_0xe4bc('0x7c'),_0xe4bc('0x7d'),_0xe4bc('0x7e'),_0xe4bc('0x7f'),_0xe4bc('0x80'),_0xe4bc('0x81'),_0xe4bc('0x82'),_0xe4bc('0x83'),_0xe4bc('0x84'),'business_duration','group_list',_0xe4bc('0x85'),_0xe4bc('0x86'),'resolved_at',_0xe4bc('0x87'),'approval_set',_0xe4bc('0x67'),_0xe4bc('0x88'),_0xe4bc('0x89'),'close_code',_0xe4bc('0x8a'),_0xe4bc('0x8b'),_0xe4bc('0x8c'),_0xe4bc('0x8d'),'business_stc',_0xe4bc('0x8e'),_0xe4bc('0x8f'),_0xe4bc('0x90'),_0xe4bc('0x69'),_0xe4bc('0x91'),_0xe4bc('0x92'),_0xe4bc('0x93'),_0xe4bc('0x94'),_0xe4bc('0x95'),'sys_id',_0xe4bc('0x96'),'reopened_by',_0xe4bc('0x6a'),_0xe4bc('0x97'),_0xe4bc('0x98'),'company',_0xe4bc('0x99'),_0xe4bc('0x9a'),'assigned_to','severity',_0xe4bc('0x9b'),_0xe4bc('0x9c'),_0xe4bc('0x9d'),_0xe4bc('0x9e'),_0xe4bc('0x9f'),_0xe4bc('0xa0'),'reopen_count',_0xe4bc('0xa1'),'escalation','upon_approval','correlation_id',_0xe4bc('0xa2'),_0xe4bc('0x6c')];var _0x323ad1='';var _0x503cdf='';var _0x127c82=[];var _0x3f2d64='';var _0x3950d0='';var _0x522395=[];var _0xb77f8a='';var _0x3b7471='';var _0x3a1d7e={};var _0x198269='';return db[_0xe4bc('0x3d')][_0xe4bc('0x5f')]({'where':{'id':_0x3c0c40[_0xe4bc('0x54')]['id']},'attributes':['id',_0xe4bc('0xa3'),_0xe4bc('0xa4'),_0xe4bc('0xa5'),_0xe4bc('0xa6'),_0xe4bc('0xa7')]})[_0xe4bc('0x22')](handleEntityNotFound(_0x2f54f9,null))['then'](function(_0x2ebcce){if(_0x2ebcce){_0x198269=_0x2ebcce['remoteUri'];var _0x460bf8=_0x198269[_0xe4bc('0xa8')](-0x1);if(_0x460bf8==='/'){_0x198269=_0x198269['substring'](0x0,_0x198269[_0xe4bc('0xa9')](_0x460bf8));}_0x3b7471=util[_0xe4bc('0xaa')](_0xe4bc('0xab'),_0x198269);_0xb77f8a=util[_0xe4bc('0xaa')](_0xe4bc('0xac'),_0x198269);_0x3a1d7e={'user':_0x2ebcce[_0xe4bc('0xa3')],'pass':_0x2ebcce[_0xe4bc('0xa4')]};var _0x915488={'method':'GET','uri':_0x3b7471+_0xe4bc('0xad'),'auth':_0x3a1d7e,'json':!![]};return rp(_0x915488);}})[_0xe4bc('0x22')](function(_0x59f0e0){if(_0x59f0e0[_0xe4bc('0x2b')][_0xe4bc('0x56')]>0x0){_0x323ad1=_0x59f0e0['result'];}console['log'](_0xe4bc('0xae'),_0x323ad1);_0x522395=[];_0x503cdf=Object[_0xe4bc('0xaf')]([],_0x323ad1);_[_0xe4bc('0xb0')](_0x503cdf,function(_0x32dd30){return!_0x159e55[_0xe4bc('0xb1')](_0x32dd30['name']);});_0x503cdf['forEach'](function(_0x362aba){var _0x235cb3=createFieldObject(_0xb77f8a,_0x3a1d7e,_0x362aba[_0xe4bc('0xb2')],_0x362aba[_0xe4bc('0x39')],_0x362aba[_0xe4bc('0xb3')],![]);_0x522395[_0xe4bc('0xb4')](_0x235cb3);});return Promise['all'](_0x522395);})[_0xe4bc('0x22')](function(_0x3486fc){_0x127c82=_0x3486fc;_0x3f2d64=Object[_0xe4bc('0xaf')]([],_0x323ad1);console[_0xe4bc('0xb5')](_0xe4bc('0xb6'),_0x323ad1);_[_0xe4bc('0xb0')](_0x3f2d64,function(_0x982953){return _0x3539db[_0xe4bc('0xb1')](_0x982953[_0xe4bc('0x39')]);});console[_0xe4bc('0xb5')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3f2d64);_0x522395=[];_0x3f2d64[_0xe4bc('0xb7')](function(_0x32d9c0){var _0x2c528e=createFieldObject(_0xb77f8a,_0x3a1d7e,_0x32d9c0['internalType'],_0x32d9c0['name'],_0x32d9c0['label'],!![]);_0x522395[_0xe4bc('0xb4')](_0x2c528e);});return Promise['all'](_0x522395);})['then'](function(_0x1c31cc){_0x3950d0=_0x1c31cc;var _0x48862f=_0x127c82[_0xe4bc('0xb8')](_0x3950d0);return{'count':_0x48862f[_0xe4bc('0x56')],'rows':_0x48862f};})[_0xe4bc('0x22')](respondWithResult(_0x2f54f9,null))['catch'](function(_0x2bf498){console['log'](_0xe4bc('0xb9')+_0x2bf498);var _0x1011e0=_0x3c0c40[_0xe4bc('0x42')][_0xe4bc('0x1e')]?0x1f4:_0x2bf498[_0xe4bc('0xba')]||0x1f4;logger[_0xe4bc('0x28')](_0x2bf498[_0xe4bc('0x38')]);delete _0x2bf498[_0xe4bc('0x39')];if(_0x1011e0===0x191){_0x1011e0=0x190;}_0x2f54f9['status'](_0x1011e0)[_0xe4bc('0x3a')](_0x3c0c40[_0xe4bc('0x42')][_0xe4bc('0x1e')]?{'message':_0xe4bc('0xbb'),'statusCode':_0x2bf498[_0xe4bc('0xba')]}:_0x2bf498);});};function createFieldObject(_0x3dafe1,_0x39d546,_0x233ccf,_0x11e278,_0x258749,_0x5e411c){return new Promise(function(_0x1ef993,_0x4993af){var _0x4b6926={'id':_0x11e278,'name':_0x258749,'custom':_0x5e411c};if(_0x233ccf==='boolean'){_0x4b6926[_0xe4bc('0x4f')]=[{'name':_0xe4bc('0xbc'),'value':'true'},{'name':'False','value':_0xe4bc('0xbd')}];_0x1ef993(_0x4b6926);}else{var _0x441314={'method':'GET','uri':_0x3dafe1+_0xe4bc('0xbe')+_0x11e278,'auth':_0x39d546,'json':!![]};return rp(_0x441314)[_0xe4bc('0x22')](function(_0x11e28a){var _0x35a97b=[];if(_0x11e28a[_0xe4bc('0x2b')][_0xe4bc('0x56')]>0x0){_0x11e28a[_0xe4bc('0x2b')][_0xe4bc('0xb7')](function(_0x5af7b3){if(_0x5af7b3[_0xe4bc('0xbf')]===_0xe4bc('0xbd')){var _0x46b6f0={'name':_0x5af7b3[_0xe4bc('0xb3')],'value':_0x5af7b3['value']};_0x35a97b[_0xe4bc('0xb4')](_0x46b6f0);}});}_0x4b6926[_0xe4bc('0x4f')]=_0x35a97b;if(_0x4b6926[_0xe4bc('0x4f')][_0xe4bc('0x56')]>0x0){_0x1ef993(_0x4b6926);}else{if(_0x5e411c==![]){_0x1ef993();}else{_0x1ef993(_0x4b6926);}}});}});} \ No newline at end of file +var _0x0e60=['upon_approval','correlation_id','location','password','email','remoteUri','serverUrl','substring','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','log','remove','forEach','internalType','label','push','all','assign','includes','ServiceNow\x20error:\x20','test','statusCode','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','stack','name','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','filters','attributes','intersection','query','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','getConfigurations','findOne','ServicenowConfiguration','order','addConfiguration','AccountId','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','hold_reason','knowledge','subcategory','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','calendar_stc','cmdb_ci','delivery_plan','impact','work_notes_list','sys_domain_path','time_worked','expected_start','business_duration','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','description','calendar_duration','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation'];(function(_0x56846d,_0x33e88f){var _0x3d680e=function(_0x1f6a92){while(--_0x1f6a92){_0x56846d['push'](_0x56846d['shift']());}};_0x3d680e(++_0x33e88f);}(_0x0e60,0x1ab));var _0x00e6=function(_0x57a848,_0x249d4e){_0x57a848=_0x57a848-0x0;var _0x20a189=_0x0e60[_0x57a848];return _0x20a189;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x00e6('0x0'));var rimraf=require(_0x00e6('0x1'));var zipdir=require(_0x00e6('0x2'));var jsonpatch=require(_0x00e6('0x3'));var rp=require(_0x00e6('0x4'));var moment=require(_0x00e6('0x5'));var BPromise=require(_0x00e6('0x6'));var Mustache=require(_0x00e6('0x7'));var util=require(_0x00e6('0x8'));var path=require(_0x00e6('0x9'));var sox=require(_0x00e6('0xa'));var csv=require(_0x00e6('0xb'));var ejs=require(_0x00e6('0xc'));var fs=require('fs');var _=require(_0x00e6('0xd'));var squel=require(_0x00e6('0xe'));var crypto=require(_0x00e6('0xf'));var jsforce=require(_0x00e6('0x10'));var deskjs=require(_0x00e6('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x00e6('0x12'));var Redis=require(_0x00e6('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x00e6('0x14'));var as=require(_0x00e6('0x15'));var hardwareService=require(_0x00e6('0x16'));var logger=require(_0x00e6('0x17'))(_0x00e6('0x18'));var utils=require('../../config/utils');var config=require(_0x00e6('0x19'));var db=require(_0x00e6('0x1a'))['db'];var integrations=require(_0x00e6('0x1b'));var jayson=require(_0x00e6('0x1c'));var client=jayson[_0x00e6('0x1d')][_0x00e6('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x4ae529,_0x130d76,_0x28a8f4){if(_0x28a8f4){var _0x486737=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x486737['test'](_0x130d76)){return _0x4ae529;}else{throw new db[(_0x00e6('0x1f'))][(_0x00e6('0x20'))](_0x00e6('0x21'));}}else{return _0x4ae529;}}function respondWithRpcPromise(_0x2a167f,_0x313ebb,_0x47888c,_0x40121d){return new BPromise(function(_0xf01d78,_0x4fd713){var _0x2526d7=_0x40121d||client;return _0x2526d7[_0x00e6('0x22')](_0x2a167f,_0x47888c)[_0x00e6('0x23')](function(_0x5488f2){logger[_0x00e6('0x24')](_0x00e6('0x25'),_0x313ebb,_0x00e6('0x26'));logger['debug'](_0x00e6('0x27'),_0x313ebb,_0x00e6('0x26'),JSON[_0x00e6('0x28')](_0x5488f2));if(_0x5488f2[_0x00e6('0x29')]){if(_0x5488f2[_0x00e6('0x29')][_0x00e6('0x2a')]===0x1f4){logger[_0x00e6('0x29')](_0x00e6('0x25'),_0x313ebb,_0x5488f2[_0x00e6('0x29')]['message']);return _0x4fd713(_0x5488f2[_0x00e6('0x29')][_0x00e6('0x2b')]);}logger['error'](_0x00e6('0x25'),_0x313ebb,_0x5488f2[_0x00e6('0x29')][_0x00e6('0x2b')]);return _0xf01d78(_0x5488f2[_0x00e6('0x29')]['message']);}else{logger[_0x00e6('0x24')](_0x00e6('0x25'),_0x313ebb,_0x00e6('0x26'));_0xf01d78(_0x5488f2[_0x00e6('0x2c')]['message']);}})['catch'](function(_0x3a77cf){logger[_0x00e6('0x29')](_0x00e6('0x25'),_0x313ebb,_0x3a77cf);_0x4fd713(_0x3a77cf);});});}function respondWithStatusCode(_0x4fca85,_0x4d7d23){_0x4d7d23=_0x4d7d23||0xcc;return function(_0xa7d48a){if(_0xa7d48a){return _0x4fca85[_0x00e6('0x2d')](_0x4d7d23);}return _0x4fca85[_0x00e6('0x2e')](_0x4d7d23)[_0x00e6('0x2f')]();};}function respondWithResult(_0x44c706,_0x392b01){_0x392b01=_0x392b01||0xc8;return function(_0x1311ed){if(_0x1311ed){return _0x44c706[_0x00e6('0x2e')](_0x392b01)[_0x00e6('0x30')](_0x1311ed);}};}function respondWithFilteredResult(_0x1b9a72,_0x1565e7){return function(_0x56aa02){if(_0x56aa02){var _0x5af742=_0x56aa02['count'],_0x2fd9f3=_0x1565e7[_0x00e6('0x31')],_0x5eaf04=_0x1565e7[_0x00e6('0x31')]+_0x1565e7[_0x00e6('0x32')],_0x57e447;if(_0x5eaf04>=_0x5af742){_0x5eaf04=_0x5af742;_0x57e447=0xc8;}else{_0x57e447=0xce;}_0x1b9a72[_0x00e6('0x2e')](_0x57e447);return _0x1b9a72[_0x00e6('0x33')]('Content-Range',_0x2fd9f3+'-'+_0x5eaf04+'/'+_0x5af742)[_0x00e6('0x30')](_0x56aa02);}return null;};}function patchUpdates(_0x14dff5){return function(_0x2c9eb0){try{jsonpatch[_0x00e6('0x34')](_0x2c9eb0,_0x14dff5,!![]);}catch(_0x311af8){return BPromise[_0x00e6('0x35')](_0x311af8);}return _0x2c9eb0[_0x00e6('0x36')]();};}function saveUpdates(_0x52ef63,_0x150218){return function(_0x23d416){if(_0x23d416){return _0x23d416[_0x00e6('0x37')](_0x52ef63)[_0x00e6('0x23')](function(_0x5a12d4){return _0x5a12d4;});}return null;};}function removeEntity(_0x5ac8e5,_0x21c66e){return function(_0x3fe140){if(_0x3fe140){return _0x3fe140[_0x00e6('0x38')]()[_0x00e6('0x23')](function(){_0x5ac8e5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fdcd3,_0x3cc087){return function(_0x5bac49){if(!_0x5bac49){_0x4fdcd3['sendStatus'](0x194);}return _0x5bac49;};}function handleError(_0x4c1e3b,_0x552630){_0x552630=_0x552630||0x1f4;return function(_0x2f5b76){logger[_0x00e6('0x29')](_0x2f5b76[_0x00e6('0x39')]);if(_0x2f5b76[_0x00e6('0x3a')]){delete _0x2f5b76['name'];}_0x4c1e3b['status'](_0x552630)['send'](_0x2f5b76);};}exports['index']=function(_0x1aebf7,_0x1a5ac0){var _0x2920eb={},_0x1564da={},_0x1dc155={'count':0x0,'rows':[]};var _0x4d0d9a=_['map'](db[_0x00e6('0x3b')][_0x00e6('0x3c')],function(_0x451e8c){return{'name':_0x451e8c[_0x00e6('0x3d')],'type':_0x451e8c[_0x00e6('0x3e')][_0x00e6('0x3f')]};});_0x1564da[_0x00e6('0x40')]=_[_0x00e6('0x41')](_0x4d0d9a,_0x00e6('0x3a'));_0x1564da['query']=_['keys'](_0x1aebf7['query']);_0x1564da[_0x00e6('0x42')]=_['intersection'](_0x1564da[_0x00e6('0x40')],_0x1564da['query']);_0x2920eb[_0x00e6('0x43')]=_[_0x00e6('0x44')](_0x1564da[_0x00e6('0x40')],qs['fields'](_0x1aebf7[_0x00e6('0x45')][_0x00e6('0x46')]));_0x2920eb[_0x00e6('0x43')]=_0x2920eb[_0x00e6('0x43')]['length']?_0x2920eb['attributes']:_0x1564da['model'];if(!_0x1aebf7[_0x00e6('0x45')][_0x00e6('0x47')](_0x00e6('0x48'))){_0x2920eb[_0x00e6('0x32')]=qs[_0x00e6('0x32')](_0x1aebf7['query']['limit']);_0x2920eb[_0x00e6('0x31')]=qs['offset'](_0x1aebf7[_0x00e6('0x45')][_0x00e6('0x31')]);}_0x2920eb['order']=qs[_0x00e6('0x49')](_0x1aebf7[_0x00e6('0x45')][_0x00e6('0x49')]);_0x2920eb['where']=qs[_0x00e6('0x42')](_[_0x00e6('0x4a')](_0x1aebf7[_0x00e6('0x45')],_0x1564da[_0x00e6('0x42')]),_0x4d0d9a);if(_0x1aebf7[_0x00e6('0x45')][_0x00e6('0x4b')]){_0x2920eb[_0x00e6('0x4c')]=_[_0x00e6('0x4d')](_0x2920eb[_0x00e6('0x4c')],{'$or':_['map'](_0x4d0d9a,function(_0x377e0a){if(_0x377e0a[_0x00e6('0x3e')]!==_0x00e6('0x4e')){var _0x1f93dc={};_0x1f93dc[_0x377e0a[_0x00e6('0x3a')]]={'$like':'%'+_0x1aebf7[_0x00e6('0x45')][_0x00e6('0x4b')]+'%'};return _0x1f93dc;}})});}_0x2920eb=_['merge']({},_0x2920eb,_0x1aebf7[_0x00e6('0x4f')]);var _0x3e7b21={'where':_0x2920eb[_0x00e6('0x4c')]};return db[_0x00e6('0x3b')]['count'](_0x3e7b21)['then'](function(_0x1e7896){_0x1dc155['count']=_0x1e7896;if(_0x1aebf7[_0x00e6('0x45')][_0x00e6('0x50')]){_0x2920eb[_0x00e6('0x51')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x00e6('0x52')](_0x2920eb);})[_0x00e6('0x23')](function(_0x883dd3){_0x1dc155[_0x00e6('0x53')]=_0x883dd3;return _0x1dc155;})['then'](respondWithFilteredResult(_0x1a5ac0,_0x2920eb))[_0x00e6('0x54')](handleError(_0x1a5ac0,null));};exports['show']=function(_0x4ba55a,_0xc7e4a8){var _0x2d4a19={'raw':![],'where':{'id':_0x4ba55a[_0x00e6('0x55')]['id']}},_0x465317={};_0x465317[_0x00e6('0x40')]=_[_0x00e6('0x56')](db['ServicenowAccount'][_0x00e6('0x3c')]);_0x465317[_0x00e6('0x45')]=_[_0x00e6('0x56')](_0x4ba55a[_0x00e6('0x45')]);_0x465317[_0x00e6('0x42')]=_[_0x00e6('0x44')](_0x465317['model'],_0x465317[_0x00e6('0x45')]);_0x2d4a19['attributes']=_[_0x00e6('0x44')](_0x465317[_0x00e6('0x40')],qs['fields'](_0x4ba55a[_0x00e6('0x45')][_0x00e6('0x46')]));_0x2d4a19[_0x00e6('0x43')]=_0x2d4a19[_0x00e6('0x43')][_0x00e6('0x57')]?_0x2d4a19[_0x00e6('0x43')]:_0x465317['model'];if(_0x4ba55a[_0x00e6('0x45')][_0x00e6('0x50')]){_0x2d4a19[_0x00e6('0x51')]=[{'all':!![]}];}_0x2d4a19=_[_0x00e6('0x4d')]({},_0x2d4a19,_0x4ba55a['options']);return db[_0x00e6('0x3b')][_0x00e6('0x58')](_0x2d4a19)[_0x00e6('0x23')](handleEntityNotFound(_0xc7e4a8,null))['then'](respondWithResult(_0xc7e4a8,null))[_0x00e6('0x54')](handleError(_0xc7e4a8,null));};exports[_0x00e6('0x59')]=function(_0x5d225a,_0xb0a4a2){return db[_0x00e6('0x3b')][_0x00e6('0x59')](_0x5d225a[_0x00e6('0x5a')],{})[_0x00e6('0x23')](respondWithResult(_0xb0a4a2,0xc9))[_0x00e6('0x54')](handleError(_0xb0a4a2,null));};exports[_0x00e6('0x37')]=function(_0x26967d,_0x547f7b){if(_0x26967d[_0x00e6('0x5a')]['id']){delete _0x26967d[_0x00e6('0x5a')]['id'];}return db[_0x00e6('0x3b')][_0x00e6('0x58')]({'where':{'id':_0x26967d[_0x00e6('0x55')]['id']}})[_0x00e6('0x23')](handleEntityNotFound(_0x547f7b,null))[_0x00e6('0x23')](saveUpdates(_0x26967d[_0x00e6('0x5a')],null))[_0x00e6('0x23')](respondWithResult(_0x547f7b,null))[_0x00e6('0x54')](handleError(_0x547f7b,null));};exports[_0x00e6('0x38')]=function(_0x2cb896,_0x22b368){return db[_0x00e6('0x3b')][_0x00e6('0x58')]({'where':{'id':_0x2cb896['params']['id']}})[_0x00e6('0x23')](handleEntityNotFound(_0x22b368,null))[_0x00e6('0x23')](removeEntity(_0x22b368,null))[_0x00e6('0x54')](handleError(_0x22b368,null));};exports[_0x00e6('0x5b')]=function(_0x18afb9,_0x1a3100,_0xe71364){var _0x3edf3a={};var _0x254851={};var _0x5dfc02;var _0x388858;return db[_0x00e6('0x3b')][_0x00e6('0x5c')]({'where':{'id':_0x18afb9[_0x00e6('0x55')]['id']}})[_0x00e6('0x23')](handleEntityNotFound(_0x1a3100,null))[_0x00e6('0x23')](function(_0xb205bd){if(_0xb205bd){_0x5dfc02=_0xb205bd;_0x254851['model']=_[_0x00e6('0x56')](db[_0x00e6('0x5d')][_0x00e6('0x3c')]);_0x254851['query']=_[_0x00e6('0x56')](_0x18afb9[_0x00e6('0x45')]);_0x254851['filters']=_[_0x00e6('0x44')](_0x254851[_0x00e6('0x40')],_0x254851[_0x00e6('0x45')]);_0x3edf3a[_0x00e6('0x43')]=_[_0x00e6('0x44')](_0x254851[_0x00e6('0x40')],qs[_0x00e6('0x46')](_0x18afb9['query'][_0x00e6('0x46')]));_0x3edf3a[_0x00e6('0x43')]=_0x3edf3a[_0x00e6('0x43')]['length']?_0x3edf3a[_0x00e6('0x43')]:_0x254851[_0x00e6('0x40')];_0x3edf3a[_0x00e6('0x5e')]=qs[_0x00e6('0x49')](_0x18afb9[_0x00e6('0x45')][_0x00e6('0x49')]);_0x3edf3a[_0x00e6('0x4c')]=qs[_0x00e6('0x42')](_[_0x00e6('0x4a')](_0x18afb9[_0x00e6('0x45')],_0x254851[_0x00e6('0x42')]));if(_0x18afb9[_0x00e6('0x45')][_0x00e6('0x4b')]){_0x3edf3a[_0x00e6('0x4c')]=_[_0x00e6('0x4d')](_0x3edf3a[_0x00e6('0x4c')],{'$or':_['map'](_0x3edf3a[_0x00e6('0x43')],function(_0x506bd1){var _0xce4381={};_0xce4381[_0x506bd1]={'$like':'%'+_0x18afb9[_0x00e6('0x45')][_0x00e6('0x4b')]+'%'};return _0xce4381;})});}_0x3edf3a=_[_0x00e6('0x4d')]({},_0x3edf3a,_0x18afb9['options']);return _0x5dfc02['getConfigurations'](_0x3edf3a);}})[_0x00e6('0x23')](function(_0x110bd2){if(_0x110bd2){_0x388858=_0x110bd2[_0x00e6('0x57')];if(!_0x18afb9[_0x00e6('0x45')][_0x00e6('0x47')]('nolimit')){_0x3edf3a[_0x00e6('0x32')]=qs[_0x00e6('0x32')](_0x18afb9[_0x00e6('0x45')][_0x00e6('0x32')]);_0x3edf3a[_0x00e6('0x31')]=qs['offset'](_0x18afb9['query']['offset']);}return _0x5dfc02[_0x00e6('0x5b')](_0x3edf3a);}})[_0x00e6('0x23')](function(_0x352cfa){if(_0x352cfa){return _0x352cfa?{'count':_0x388858,'rows':_0x352cfa}:null;}})[_0x00e6('0x23')](respondWithResult(_0x1a3100,null))[_0x00e6('0x54')](handleError(_0x1a3100,null));};exports[_0x00e6('0x5f')]=function(_0x408fae,_0x3e3d32,_0x5691b3){if(_0x408fae[_0x00e6('0x5a')]['id']){delete _0x408fae[_0x00e6('0x5a')]['id'];}return db[_0x00e6('0x3b')][_0x00e6('0x5c')]({'where':{'id':_0x408fae['params']['id']}})['then'](handleEntityNotFound(_0x3e3d32,null))[_0x00e6('0x23')](function(_0x4664b1){if(_0x4664b1){_0x408fae[_0x00e6('0x5a')][_0x00e6('0x60')]=_0x4664b1['id'];_0x408fae[_0x00e6('0x5a')]['Subjects']=integrations[_0x00e6('0x61')](_0x408fae[_0x00e6('0x5a')][_0x00e6('0x62')],_0x408fae['body'][_0x00e6('0x3e')]);_0x408fae['body']['Descriptions']=integrations[_0x00e6('0x63')](_0x408fae[_0x00e6('0x5a')][_0x00e6('0x62')],_0x408fae[_0x00e6('0x5a')][_0x00e6('0x3e')]);return db[_0x00e6('0x5d')][_0x00e6('0x59')](_0x408fae[_0x00e6('0x5a')],{'include':[{'model':db[_0x00e6('0x64')],'as':'Subjects'},{'model':db[_0x00e6('0x64')],'as':_0x00e6('0x65')}]});}return null;})['then'](respondWithResult(_0x3e3d32,null))[_0x00e6('0x54')](handleError(_0x3e3d32,null));};exports['getFields']=function(_0x1c29cb,_0x27c7ad,_0x5200e2){var _0x115963=['made_sla',_0x00e6('0x66'),_0x00e6('0x67'),_0x00e6('0x68'),'close_code',_0x00e6('0x69'),_0x00e6('0x6a'),'severity',_0x00e6('0x6b')];var _0x203b6f=[_0x00e6('0x6c'),'made_sla',_0x00e6('0x6d'),_0x00e6('0x6e'),_0x00e6('0x6f'),_0x00e6('0x70'),_0x00e6('0x71'),_0x00e6('0x66'),_0x00e6('0x72'),_0x00e6('0x73'),_0x00e6('0x74'),_0x00e6('0x75'),'opened_by',_0x00e6('0x76'),_0x00e6('0x77'),_0x00e6('0x78'),_0x00e6('0x79'),'sys_created_by','knowledge',_0x00e6('0x5e'),_0x00e6('0x7a'),'closed_at',_0x00e6('0x7b'),_0x00e6('0x7c'),_0x00e6('0x7d'),'active',_0x00e6('0x7e'),'business_service','priority',_0x00e6('0x7f'),'rfc',_0x00e6('0x80'),_0x00e6('0x81'),'opened_at',_0x00e6('0x82'),'group_list',_0x00e6('0x83'),_0x00e6('0x84'),'resolved_at',_0x00e6('0x85'),_0x00e6('0x86'),_0x00e6('0x68'),_0x00e6('0x87'),_0x00e6('0x88'),_0x00e6('0x89'),_0x00e6('0x8a'),_0x00e6('0x8b'),_0x00e6('0x8c'),_0x00e6('0x8d'),'business_stc','additional_assignee_list',_0x00e6('0x8e'),_0x00e6('0x8f'),_0x00e6('0x69'),'sys_class_name',_0x00e6('0x90'),'closed_by',_0x00e6('0x91'),_0x00e6('0x92'),_0x00e6('0x93'),_0x00e6('0x94'),_0x00e6('0x95'),_0x00e6('0x6a'),_0x00e6('0x96'),'problem_id',_0x00e6('0x97'),_0x00e6('0x98'),_0x00e6('0x99'),_0x00e6('0x9a'),_0x00e6('0x9b'),_0x00e6('0x9c'),_0x00e6('0x9d'),_0x00e6('0x9e'),_0x00e6('0x9f'),'due_date',_0x00e6('0xa0'),_0x00e6('0xa1'),_0x00e6('0xa2'),_0x00e6('0xa3'),_0x00e6('0xa4'),_0x00e6('0xa5'),_0x00e6('0xa6'),_0x00e6('0x6b')];var _0x10ff42='';var _0xf7f3e7='';var _0x36a3c0=[];var _0x4b7f3e='';var _0x35172c='';var _0x17ab5b=[];var _0x4539ee='';var _0x4da64a='';var _0x3a658e={};var _0x486c7c='';return db[_0x00e6('0x3b')][_0x00e6('0x5c')]({'where':{'id':_0x1c29cb[_0x00e6('0x55')]['id']},'attributes':['id','username',_0x00e6('0xa7'),_0x00e6('0xa8'),_0x00e6('0xa9'),_0x00e6('0xaa')]})[_0x00e6('0x23')](handleEntityNotFound(_0x27c7ad,null))[_0x00e6('0x23')](function(_0x1aae36){if(_0x1aae36){_0x486c7c=_0x1aae36[_0x00e6('0xa9')];var _0x2e6460=_0x486c7c['slice'](-0x1);if(_0x2e6460==='/'){_0x486c7c=_0x486c7c[_0x00e6('0xab')](0x0,_0x486c7c[_0x00e6('0xac')](_0x2e6460));}_0x4da64a=util['format'](_0x00e6('0xad'),_0x486c7c);_0x4539ee=util['format'](_0x00e6('0xae'),_0x486c7c);_0x3a658e={'user':_0x1aae36[_0x00e6('0xaf')],'pass':_0x1aae36[_0x00e6('0xa7')]};var _0xf15e78={'method':_0x00e6('0xb0'),'uri':_0x4da64a+_0x00e6('0xb1'),'auth':_0x3a658e,'json':!![]};return rp(_0xf15e78);}})['then'](function(_0xaf17ad){if(_0xaf17ad[_0x00e6('0x2c')]['length']>0x0){_0x10ff42=_0xaf17ad[_0x00e6('0x2c')];}console[_0x00e6('0xb2')]('incident\x20table\x20objects',_0x10ff42);_0x17ab5b=[];_0xf7f3e7=Object['assign']([],_0x10ff42);_[_0x00e6('0xb3')](_0xf7f3e7,function(_0x27e239){return!_0x115963['includes'](_0x27e239[_0x00e6('0x3a')]);});_0xf7f3e7[_0x00e6('0xb4')](function(_0xaf43dd){var _0x26baef=createFieldObject(_0x4539ee,_0x3a658e,_0xaf43dd[_0x00e6('0xb5')],_0xaf43dd['name'],_0xaf43dd[_0x00e6('0xb6')],![]);_0x17ab5b[_0x00e6('0xb7')](_0x26baef);});return Promise[_0x00e6('0xb8')](_0x17ab5b);})['then'](function(_0xa85192){_0x36a3c0=_0xa85192;_0x4b7f3e=Object[_0x00e6('0xb9')]([],_0x10ff42);console[_0x00e6('0xb2')]('TCL:\x20_object',_0x10ff42);_[_0x00e6('0xb3')](_0x4b7f3e,function(_0x37c995){return _0x203b6f[_0x00e6('0xba')](_0x37c995['name']);});console[_0x00e6('0xb2')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x4b7f3e);_0x17ab5b=[];_0x4b7f3e[_0x00e6('0xb4')](function(_0x3791ae){var _0x463399=createFieldObject(_0x4539ee,_0x3a658e,_0x3791ae[_0x00e6('0xb5')],_0x3791ae['name'],_0x3791ae['label'],!![]);_0x17ab5b[_0x00e6('0xb7')](_0x463399);});return Promise[_0x00e6('0xb8')](_0x17ab5b);})[_0x00e6('0x23')](function(_0x160d40){_0x35172c=_0x160d40;var _0x1a9958=_0x36a3c0['concat'](_0x35172c);return{'count':_0x1a9958[_0x00e6('0x57')],'rows':_0x1a9958};})['then'](respondWithResult(_0x27c7ad,null))[_0x00e6('0x54')](function(_0x2ba848){console[_0x00e6('0xb2')](_0x00e6('0xbb')+_0x2ba848);var _0x317acf=_0x1c29cb[_0x00e6('0x45')][_0x00e6('0xbc')]?0x1f4:_0x2ba848['statusCode']||0x1f4;logger[_0x00e6('0x29')](_0x2ba848[_0x00e6('0x39')]);delete _0x2ba848[_0x00e6('0x3a')];if(_0x317acf===0x191){_0x317acf=0x190;}_0x27c7ad[_0x00e6('0x2e')](_0x317acf)['send'](_0x1c29cb[_0x00e6('0x45')][_0x00e6('0xbc')]?{'message':'Wrong\x20credentials','statusCode':_0x2ba848[_0x00e6('0xbd')]}:_0x2ba848);});};function createFieldObject(_0x8f8dda,_0x42bf4d,_0x3545fe,_0x380f1c,_0x52fca8,_0x49e015){return new Promise(function(_0xe8cf97,_0x1c6c0b){var _0x4fb51e={'id':_0x380f1c,'name':_0x52fca8,'custom':_0x49e015};if(_0x3545fe===_0x00e6('0xbe')){_0x4fb51e[_0x00e6('0x4f')]=[{'name':_0x00e6('0xbf'),'value':'true'},{'name':_0x00e6('0xc0'),'value':_0x00e6('0xc1')}];_0xe8cf97(_0x4fb51e);}else{var _0xd568c0={'method':'GET','uri':_0x8f8dda+_0x00e6('0xc2')+_0x380f1c,'auth':_0x42bf4d,'json':!![]};return rp(_0xd568c0)[_0x00e6('0x23')](function(_0x307292){var _0x5db3ef=[];if(_0x307292['result'][_0x00e6('0x57')]>0x0){_0x307292[_0x00e6('0x2c')]['forEach'](function(_0x54cecb){if(_0x54cecb[_0x00e6('0xc3')]===_0x00e6('0xc1')){var _0x226011={'name':_0x54cecb['label'],'value':_0x54cecb[_0x00e6('0xc4')]};_0x5db3ef['push'](_0x226011);}});}_0x4fb51e[_0x00e6('0x4f')]=_0x5db3ef;if(_0x4fb51e[_0x00e6('0x4f')][_0x00e6('0x57')]>0x0){_0xe8cf97(_0x4fb51e);}else{if(_0x49e015==![]){_0xe8cf97();}else{_0xe8cf97(_0x4fb51e);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 0128eac..50d6bfb 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 _0x4387=['request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','../../config/logger','api','moment','bluebird'];(function(_0x21bf27,_0x4bd500){var _0x36ad9e=function(_0xf609ae){while(--_0xf609ae){_0x21bf27['push'](_0x21bf27['shift']());}};_0x36ad9e(++_0x4bd500);}(_0x4387,0xa4));var _0x7438=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4387[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7438('0x0'))(_0x7438('0x1'));var moment=require(_0x7438('0x2'));var BPromise=require(_0x7438('0x3'));var rp=require(_0x7438('0x4'));var fs=require('fs');var path=require(_0x7438('0x5'));var rimraf=require(_0x7438('0x6'));var config=require(_0x7438('0x7'));var attributes=require(_0x7438('0x8'));var integrations=require(_0x7438('0x9'));module[_0x7438('0xa')]=function(_0x133131,_0x57ed32){return _0x133131[_0x7438('0xb')](_0x7438('0xc'),attributes,{'tableName':_0x7438('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fd0=['exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x9bfe80,_0xb45f70){var _0x872eb0=function(_0x4586fe){while(--_0x4586fe){_0x9bfe80['push'](_0x9bfe80['shift']());}};_0x872eb0(++_0xb45f70);}(_0x0fd0,0x8f));var _0x00fd=function(_0x4ac391,_0xbd274b){_0x4ac391=_0x4ac391-0x0;var _0x281e74=_0x0fd0[_0x4ac391];return _0x281e74;};'use strict';var _=require(_0x00fd('0x0'));var util=require(_0x00fd('0x1'));var logger=require(_0x00fd('0x2'))(_0x00fd('0x3'));var moment=require(_0x00fd('0x4'));var BPromise=require(_0x00fd('0x5'));var rp=require(_0x00fd('0x6'));var fs=require('fs');var path=require(_0x00fd('0x7'));var rimraf=require('rimraf');var config=require(_0x00fd('0x8'));var attributes=require(_0x00fd('0x9'));var integrations=require(_0x00fd('0xa'));module[_0x00fd('0xb')]=function(_0x27f932,_0x30c2b9){return _0x27f932[_0x00fd('0xc')](_0x00fd('0xd'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 11fde7e..f61b982 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 _0x698d=['result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','include','map','attributes','model','debug','stringify','ShowServicenowAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0xcb0eb2,_0x3906bf){var _0xbab9b8=function(_0x24fa8a){while(--_0x24fa8a){_0xcb0eb2['push'](_0xcb0eb2['shift']());}};_0xbab9b8(++_0x3906bf);}(_0x698d,0x16e));var _0xd698=function(_0x44acbd,_0x4bba52){_0x44acbd=_0x44acbd-0x0;var _0x4793bc=_0x698d[_0x44acbd];return _0x4793bc;};'use strict';var _=require('lodash');var util=require(_0xd698('0x0'));var moment=require(_0xd698('0x1'));var BPromise=require(_0xd698('0x2'));var rs=require(_0xd698('0x3'));var fs=require('fs');var Redis=require(_0xd698('0x4'));var db=require(_0xd698('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd698('0x6'))('rpc');var config=require(_0xd698('0x7'));var jayson=require(_0xd698('0x8'));var client=jayson[_0xd698('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ea9ca,_0x5545f6,_0x584378){return new BPromise(function(_0x441919,_0x3fae87){return client[_0xd698('0xa')](_0x4ea9ca,_0x584378)[_0xd698('0xb')](function(_0x365929){logger['info'](_0xd698('0xc'),_0x5545f6,_0xd698('0xd'));logger['debug'](_0xd698('0xe'),_0x5545f6,_0xd698('0xd'),JSON['stringify'](_0x365929));if(_0x365929[_0xd698('0xf')]){if(_0x365929['error'][_0xd698('0x10')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x5545f6,_0x365929[_0xd698('0xf')][_0xd698('0x11')]);return _0x3fae87(_0x365929[_0xd698('0xf')][_0xd698('0x11')]);}logger[_0xd698('0xf')](_0xd698('0xc'),_0x5545f6,_0x365929[_0xd698('0xf')][_0xd698('0x11')]);return _0x441919(_0x365929[_0xd698('0xf')][_0xd698('0x11')]);}else{logger[_0xd698('0x12')](_0xd698('0xc'),_0x5545f6,_0xd698('0xd'));_0x441919(_0x365929[_0xd698('0x13')][_0xd698('0x11')]);}})[_0xd698('0x14')](function(_0x7e60a6){logger[_0xd698('0xf')](_0xd698('0xc'),_0x5545f6,_0x7e60a6);_0x3fae87(_0x7e60a6);});});}exports[_0xd698('0x15')]=function(_0xab6b68){var _0x18b7fe=this;return new Promise(function(_0x39f145,_0x180c09){return db[_0xd698('0x16')][_0xd698('0x17')]({'raw':_0xab6b68[_0xd698('0x18')]?_0xab6b68[_0xd698('0x18')][_0xd698('0x19')]===undefined?!![]:![]:!![],'where':_0xab6b68[_0xd698('0x18')]?_0xab6b68['options'][_0xd698('0x1a')]||null:null,'attributes':_0xab6b68[_0xd698('0x18')]?_0xab6b68['options']['attributes']||null:null,'limit':_0xab6b68[_0xd698('0x18')]?_0xab6b68[_0xd698('0x18')]['limit']||null:null,'include':_0xab6b68[_0xd698('0x18')]?_0xab6b68[_0xd698('0x18')][_0xd698('0x1b')]?_[_0xd698('0x1c')](_0xab6b68[_0xd698('0x18')]['include'],function(_0x32bc91){return{'model':db[_0x32bc91['model']],'as':_0x32bc91['as'],'attributes':_0x32bc91[_0xd698('0x1d')],'include':_0x32bc91[_0xd698('0x1b')]?_[_0xd698('0x1c')](_0x32bc91[_0xd698('0x1b')],function(_0x50402b){return{'model':db[_0x50402b[_0xd698('0x1e')]],'as':_0x50402b['as'],'attributes':_0x50402b[_0xd698('0x1d')],'include':_0x50402b[_0xd698('0x1b')]?_[_0xd698('0x1c')](_0x50402b[_0xd698('0x1b')],function(_0x224476){return{'model':db[_0x224476['model']],'as':_0x224476['as'],'attributes':_0x224476[_0xd698('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd698('0xb')](function(_0x33de06){logger[_0xd698('0x12')]('GetServicenowAccount',_0xab6b68);logger[_0xd698('0x1f')]('GetServicenowAccount',_0xab6b68,JSON[_0xd698('0x20')](_0x33de06));_0x39f145(_0x33de06);})[_0xd698('0x14')](function(_0x9c1147){logger['error'](_0xd698('0x15'),_0x9c1147[_0xd698('0x11')],_0xab6b68);_0x180c09(_0x18b7fe[_0xd698('0xf')](0x1f4,_0x9c1147['message']));});});};exports[_0xd698('0x21')]=function(_0x3a9cac){var _0x5c3ec1=this;return new Promise(function(_0x542a74,_0x5f2659){return db[_0xd698('0x16')][_0xd698('0x22')]({'raw':_0x3a9cac['options']?_0x3a9cac['options'][_0xd698('0x19')]===undefined?!![]:![]:!![],'where':_0x3a9cac['options']?_0x3a9cac['options'][_0xd698('0x1a')]||null:null,'attributes':_0x3a9cac['options']?_0x3a9cac[_0xd698('0x18')][_0xd698('0x1d')]||null:null,'include':_0x3a9cac['options']?_0x3a9cac[_0xd698('0x18')][_0xd698('0x1b')]?_[_0xd698('0x1c')](_0x3a9cac['options'][_0xd698('0x1b')],function(_0x5f4b1b){return{'model':db[_0x5f4b1b[_0xd698('0x1e')]],'as':_0x5f4b1b['as'],'attributes':_0x5f4b1b['attributes'],'include':_0x5f4b1b[_0xd698('0x1b')]?_['map'](_0x5f4b1b[_0xd698('0x1b')],function(_0x3adf0c){return{'model':db[_0x3adf0c[_0xd698('0x1e')]],'as':_0x3adf0c['as'],'attributes':_0x3adf0c[_0xd698('0x1d')],'include':_0x3adf0c[_0xd698('0x1b')]?_[_0xd698('0x1c')](_0x3adf0c[_0xd698('0x1b')],function(_0x2fa3c9){return{'model':db[_0x2fa3c9[_0xd698('0x1e')]],'as':_0x2fa3c9['as'],'attributes':_0x2fa3c9[_0xd698('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd698('0xb')](function(_0x3647cf){logger[_0xd698('0x12')](_0xd698('0x21'),_0x3a9cac);logger[_0xd698('0x1f')](_0xd698('0x21'),_0x3a9cac,JSON[_0xd698('0x20')](_0x3647cf));_0x542a74(_0x3647cf);})[_0xd698('0x14')](function(_0x11f35a){logger[_0xd698('0xf')](_0xd698('0x21'),_0x11f35a[_0xd698('0x11')],_0x3a9cac);_0x5f2659(_0x5c3ec1[_0xd698('0xf')](0x1f4,_0x11f35a[_0xd698('0x11')]));});});}; \ No newline at end of file +var _0x4466=['jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','ServicenowAccount','findAll','raw','options','where','limit','include','map','model','attributes','GetServicenowAccount','stringify','ShowServicenowAccount','find','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x32b30c,_0x4c5567){var _0x59bc79=function(_0x5ef43d){while(--_0x5ef43d){_0x32b30c['push'](_0x32b30c['shift']());}};_0x59bc79(++_0x4c5567);}(_0x4466,0xa3));var _0x6446=function(_0x523d5b,_0x1808f0){_0x523d5b=_0x523d5b-0x0;var _0x4d5b4c=_0x4466[_0x523d5b];return _0x4d5b4c;};'use strict';var _=require(_0x6446('0x0'));var util=require('util');var moment=require(_0x6446('0x1'));var BPromise=require('bluebird');var rs=require(_0x6446('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6446('0x3'))['db'];var utils=require(_0x6446('0x4'));var logger=require(_0x6446('0x5'))(_0x6446('0x6'));var config=require('../../config/environment');var jayson=require(_0x6446('0x7'));var client=jayson[_0x6446('0x8')][_0x6446('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x267d5a,_0x5c9195,_0x25b7ee){return new BPromise(function(_0x4da189,_0x1c1769){return client[_0x6446('0xa')](_0x267d5a,_0x25b7ee)[_0x6446('0xb')](function(_0x5dbf8c){logger[_0x6446('0xc')](_0x6446('0xd'),_0x5c9195,_0x6446('0xe'));logger[_0x6446('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5c9195,_0x6446('0xe'),JSON['stringify'](_0x5dbf8c));if(_0x5dbf8c[_0x6446('0x10')]){if(_0x5dbf8c['error'][_0x6446('0x11')]===0x1f4){logger[_0x6446('0x10')](_0x6446('0xd'),_0x5c9195,_0x5dbf8c[_0x6446('0x10')][_0x6446('0x12')]);return _0x1c1769(_0x5dbf8c['error']['message']);}logger[_0x6446('0x10')](_0x6446('0xd'),_0x5c9195,_0x5dbf8c[_0x6446('0x10')][_0x6446('0x12')]);return _0x4da189(_0x5dbf8c[_0x6446('0x10')][_0x6446('0x12')]);}else{logger['info'](_0x6446('0xd'),_0x5c9195,_0x6446('0xe'));_0x4da189(_0x5dbf8c['result'][_0x6446('0x12')]);}})[_0x6446('0x13')](function(_0x42e5fc){logger[_0x6446('0x10')](_0x6446('0xd'),_0x5c9195,_0x42e5fc);_0x1c1769(_0x42e5fc);});});}exports['GetServicenowAccount']=function(_0xc49166){var _0x30d36d=this;return new Promise(function(_0x103498,_0x3b8ba2){return db[_0x6446('0x14')][_0x6446('0x15')]({'raw':_0xc49166['options']?_0xc49166['options'][_0x6446('0x16')]===undefined?!![]:![]:!![],'where':_0xc49166['options']?_0xc49166[_0x6446('0x17')][_0x6446('0x18')]||null:null,'attributes':_0xc49166[_0x6446('0x17')]?_0xc49166['options']['attributes']||null:null,'limit':_0xc49166[_0x6446('0x17')]?_0xc49166['options'][_0x6446('0x19')]||null:null,'include':_0xc49166['options']?_0xc49166[_0x6446('0x17')][_0x6446('0x1a')]?_[_0x6446('0x1b')](_0xc49166[_0x6446('0x17')][_0x6446('0x1a')],function(_0x432529){return{'model':db[_0x432529[_0x6446('0x1c')]],'as':_0x432529['as'],'attributes':_0x432529[_0x6446('0x1d')],'include':_0x432529[_0x6446('0x1a')]?_[_0x6446('0x1b')](_0x432529[_0x6446('0x1a')],function(_0x548527){return{'model':db[_0x548527['model']],'as':_0x548527['as'],'attributes':_0x548527[_0x6446('0x1d')],'include':_0x548527[_0x6446('0x1a')]?_['map'](_0x548527[_0x6446('0x1a')],function(_0x50e66a){return{'model':db[_0x50e66a['model']],'as':_0x50e66a['as'],'attributes':_0x50e66a[_0x6446('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6446('0xb')](function(_0x3a6e09){logger['info'](_0x6446('0x1e'),_0xc49166);logger[_0x6446('0xf')](_0x6446('0x1e'),_0xc49166,JSON[_0x6446('0x1f')](_0x3a6e09));_0x103498(_0x3a6e09);})['catch'](function(_0x3d5279){logger[_0x6446('0x10')](_0x6446('0x1e'),_0x3d5279[_0x6446('0x12')],_0xc49166);_0x3b8ba2(_0x30d36d[_0x6446('0x10')](0x1f4,_0x3d5279[_0x6446('0x12')]));});});};exports[_0x6446('0x20')]=function(_0x3dc0f5){var _0x5e2c98=this;return new Promise(function(_0x12e642,_0x49f8c8){return db[_0x6446('0x14')][_0x6446('0x21')]({'raw':_0x3dc0f5[_0x6446('0x17')]?_0x3dc0f5[_0x6446('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3dc0f5['options']?_0x3dc0f5[_0x6446('0x17')][_0x6446('0x18')]||null:null,'attributes':_0x3dc0f5[_0x6446('0x17')]?_0x3dc0f5[_0x6446('0x17')][_0x6446('0x1d')]||null:null,'include':_0x3dc0f5[_0x6446('0x17')]?_0x3dc0f5[_0x6446('0x17')][_0x6446('0x1a')]?_[_0x6446('0x1b')](_0x3dc0f5[_0x6446('0x17')]['include'],function(_0x1e4561){return{'model':db[_0x1e4561['model']],'as':_0x1e4561['as'],'attributes':_0x1e4561[_0x6446('0x1d')],'include':_0x1e4561['include']?_['map'](_0x1e4561[_0x6446('0x1a')],function(_0x5cb006){return{'model':db[_0x5cb006['model']],'as':_0x5cb006['as'],'attributes':_0x5cb006[_0x6446('0x1d')],'include':_0x5cb006[_0x6446('0x1a')]?_[_0x6446('0x1b')](_0x5cb006['include'],function(_0x452d6f){return{'model':db[_0x452d6f[_0x6446('0x1c')]],'as':_0x452d6f['as'],'attributes':_0x452d6f[_0x6446('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x564546){logger[_0x6446('0xc')](_0x6446('0x20'),_0x3dc0f5);logger['debug'](_0x6446('0x20'),_0x3dc0f5,JSON[_0x6446('0x1f')](_0x564546));_0x12e642(_0x564546);})[_0x6446('0x13')](function(_0x23298f){logger[_0x6446('0x10')](_0x6446('0x20'),_0x23298f[_0x6446('0x12')],_0x3dc0f5);_0x49f8c8(_0x5e2c98[_0x6446('0x10')](0x1f4,_0x23298f[_0x6446('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index d381e10..c649b04 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 _0xb3f3=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports'];(function(_0x1e9ef5,_0x220b1d){var _0x4edda3=function(_0x2f6655){while(--_0x2f6655){_0x1e9ef5['push'](_0x1e9ef5['shift']());}};_0x4edda3(++_0x220b1d);}(_0xb3f3,0x190));var _0x3b3f=function(_0x58c654,_0x56f774){_0x58c654=_0x58c654-0x0;var _0x1b1164=_0xb3f3[_0x58c654];return _0x1b1164;};'use strict';var multer=require(_0x3b3f('0x0'));var util=require(_0x3b3f('0x1'));var path=require(_0x3b3f('0x2'));var timeout=require(_0x3b3f('0x3'));var express=require(_0x3b3f('0x4'));var router=express[_0x3b3f('0x5')]();var auth=require(_0x3b3f('0x6'));var interaction=require(_0x3b3f('0x7'));var config=require(_0x3b3f('0x8'));var controller=require('./intServicenowConfiguration.controller');router[_0x3b3f('0x9')]('/',auth[_0x3b3f('0xa')](),controller['index']);router[_0x3b3f('0x9')](_0x3b3f('0xb'),auth['isAuthenticated'](),controller[_0x3b3f('0xc')]);router['get'](_0x3b3f('0xd'),auth['isAuthenticated'](),controller[_0x3b3f('0xe')]);router['get'](_0x3b3f('0xf'),auth['isAuthenticated'](),controller[_0x3b3f('0x10')]);router[_0x3b3f('0x9')](_0x3b3f('0x11'),auth['isAuthenticated'](),controller[_0x3b3f('0x12')]);router[_0x3b3f('0x13')]('/',auth[_0x3b3f('0xa')](),controller[_0x3b3f('0x14')]);router[_0x3b3f('0x15')](_0x3b3f('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x3b3f('0x16')]('/:id',auth[_0x3b3f('0xa')](),controller[_0x3b3f('0x17')]);module[_0x3b3f('0x18')]=router; \ No newline at end of file +var _0x88ec=['isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get'];(function(_0xf20b6,_0x49ddbb){var _0x4ff567=function(_0x3ccc7f){while(--_0x3ccc7f){_0xf20b6['push'](_0xf20b6['shift']());}};_0x4ff567(++_0x49ddbb);}(_0x88ec,0x1d2));var _0xc88e=function(_0x1ecc0c,_0xce40a8){_0x1ecc0c=_0x1ecc0c-0x0;var _0x28e3f3=_0x88ec[_0x1ecc0c];return _0x28e3f3;};'use strict';var multer=require(_0xc88e('0x0'));var util=require(_0xc88e('0x1'));var path=require(_0xc88e('0x2'));var timeout=require('connect-timeout');var express=require(_0xc88e('0x3'));var router=express[_0xc88e('0x4')]();var auth=require(_0xc88e('0x5'));var interaction=require(_0xc88e('0x6'));var config=require('../../config/environment');var controller=require(_0xc88e('0x7'));router[_0xc88e('0x8')]('/',auth[_0xc88e('0x9')](),controller[_0xc88e('0xa')]);router[_0xc88e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc88e('0xb')]);router[_0xc88e('0x8')](_0xc88e('0xc'),auth['isAuthenticated'](),controller[_0xc88e('0xd')]);router[_0xc88e('0x8')](_0xc88e('0xe'),auth['isAuthenticated'](),controller[_0xc88e('0xf')]);router[_0xc88e('0x8')](_0xc88e('0x10'),auth['isAuthenticated'](),controller[_0xc88e('0x11')]);router[_0xc88e('0x12')]('/',auth[_0xc88e('0x9')](),controller[_0xc88e('0x13')]);router[_0xc88e('0x14')](_0xc88e('0x15'),auth['isAuthenticated'](),controller[_0xc88e('0x16')]);router[_0xc88e('0x17')](_0xc88e('0x15'),auth[_0xc88e('0x9')](),controller[_0xc88e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 49e1b60..8bddfd9 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 _0xc0ef=['exports','STRING','sequelize'];(function(_0xddfaba,_0x190d4b){var _0x549f70=function(_0x22acc3){while(--_0x22acc3){_0xddfaba['push'](_0xddfaba['shift']());}};_0x549f70(++_0x190d4b);}(_0xc0ef,0xf8));var _0xfc0e=function(_0x4ca0c2,_0x2df1be){_0x4ca0c2=_0x4ca0c2-0x0;var _0x1e2836=_0xc0ef[_0x4ca0c2];return _0x1e2836;};'use strict';var Sequelize=require(_0xfc0e('0x0'));module[_0xfc0e('0x1')]={'name':{'type':Sequelize[_0xfc0e('0x2')]},'description':{'type':Sequelize[_0xfc0e('0x2')]}}; \ No newline at end of file +var _0xd663=['STRING','sequelize','exports'];(function(_0x311179,_0x5d935e){var _0x562c42=function(_0x34fdf1){while(--_0x34fdf1){_0x311179['push'](_0x311179['shift']());}};_0x562c42(++_0x5d935e);}(_0xd663,0x1cc));var _0x3d66=function(_0x154277,_0x70f042){_0x154277=_0x154277-0x0;var _0x14d1f9=_0xd663[_0x154277];return _0x14d1f9;};'use strict';var Sequelize=require(_0x3d66('0x0'));module[_0x3d66('0x1')]={'name':{'type':Sequelize[_0x3d66('0x2')]},'description':{'type':Sequelize[_0x3d66('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index e743a28..973757f 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 _0x80ed=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','json','count','offset','limit','Content-Range','apply','update','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','type','options','ServicenowConfiguration','includeAll','include','rows','show','params','fields','find','create','body','getFields','findOne','ServicenowField','pick','filter','getSubjects','getDescriptions','html-pdf'];(function(_0x10349d,_0x196fa5){var _0x4e4b72=function(_0x402bcc){while(--_0x402bcc){_0x10349d['push'](_0x10349d['shift']());}};_0x4e4b72(++_0x196fa5);}(_0x80ed,0x11c));var _0xd80e=function(_0x183ac6,_0x116612){_0x183ac6=_0x183ac6-0x0;var _0xd88667=_0x80ed[_0x183ac6];return _0xd88667;};'use strict';var pdf=require(_0xd80e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd80e('0x1'));var zipdir=require(_0xd80e('0x2'));var jsonpatch=require(_0xd80e('0x3'));var rp=require('request-promise');var moment=require(_0xd80e('0x4'));var BPromise=require(_0xd80e('0x5'));var Mustache=require(_0xd80e('0x6'));var util=require(_0xd80e('0x7'));var path=require('path');var sox=require(_0xd80e('0x8'));var csv=require(_0xd80e('0x9'));var ejs=require(_0xd80e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x9'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var db=require(_0xd80e('0x19'))['db'];var jayson=require(_0xd80e('0x1a'));var client=jayson[_0xd80e('0x1b')][_0xd80e('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x4fb01c,_0x5691a1,_0x5eb3b2){if(_0x5eb3b2){var _0x57fefb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x57fefb[_0xd80e('0x1d')](_0x5691a1)){return _0x4fb01c;}else{throw new db[(_0xd80e('0x1e'))][(_0xd80e('0x1f'))](_0xd80e('0x20'));}}else{return _0x4fb01c;}}function respondWithRpcPromise(_0x449c60,_0x58a17e,_0x595683,_0x2c8c61){return new BPromise(function(_0x3124e8,_0x3b48ae){var _0x40a4d5=_0x2c8c61||client;return _0x40a4d5[_0xd80e('0x21')](_0x449c60,_0x595683)[_0xd80e('0x22')](function(_0x22ab67){logger['info'](_0xd80e('0x23'),_0x58a17e,_0xd80e('0x24'));logger[_0xd80e('0x25')](_0xd80e('0x26'),_0x58a17e,'request\x20sent',JSON[_0xd80e('0x27')](_0x22ab67));if(_0x22ab67[_0xd80e('0x28')]){if(_0x22ab67[_0xd80e('0x28')]['code']===0x1f4){logger[_0xd80e('0x28')](_0xd80e('0x23'),_0x58a17e,_0x22ab67[_0xd80e('0x28')][_0xd80e('0x29')]);return _0x3b48ae(_0x22ab67[_0xd80e('0x28')]['message']);}logger['error'](_0xd80e('0x23'),_0x58a17e,_0x22ab67[_0xd80e('0x28')][_0xd80e('0x29')]);return _0x3124e8(_0x22ab67[_0xd80e('0x28')][_0xd80e('0x29')]);}else{logger[_0xd80e('0x2a')](_0xd80e('0x23'),_0x58a17e,'request\x20sent');_0x3124e8(_0x22ab67[_0xd80e('0x2b')][_0xd80e('0x29')]);}})[_0xd80e('0x2c')](function(_0x5b0d6d){logger[_0xd80e('0x28')](_0xd80e('0x23'),_0x58a17e,_0x5b0d6d);_0x3b48ae(_0x5b0d6d);});});}function respondWithStatusCode(_0xe9bb59,_0x482779){_0x482779=_0x482779||0xcc;return function(_0x521aa4){if(_0x521aa4){return _0xe9bb59['sendStatus'](_0x482779);}return _0xe9bb59[_0xd80e('0x2d')](_0x482779)['end']();};}function respondWithResult(_0x9f9287,_0x1044cc){_0x1044cc=_0x1044cc||0xc8;return function(_0x4e8ed9){if(_0x4e8ed9){return _0x9f9287[_0xd80e('0x2d')](_0x1044cc)[_0xd80e('0x2e')](_0x4e8ed9);}};}function respondWithFilteredResult(_0x30d6fc,_0x46c05d){return function(_0x5376eb){if(_0x5376eb){var _0x15f317=_0x5376eb[_0xd80e('0x2f')],_0x1ad3bc=_0x46c05d[_0xd80e('0x30')],_0x845451=_0x46c05d[_0xd80e('0x30')]+_0x46c05d[_0xd80e('0x31')],_0x39088b;if(_0x845451>=_0x15f317){_0x845451=_0x15f317;_0x39088b=0xc8;}else{_0x39088b=0xce;}_0x30d6fc['status'](_0x39088b);return _0x30d6fc['set'](_0xd80e('0x32'),_0x1ad3bc+'-'+_0x845451+'/'+_0x15f317)[_0xd80e('0x2e')](_0x5376eb);}return null;};}function patchUpdates(_0x400220){return function(_0x32360c){try{jsonpatch[_0xd80e('0x33')](_0x32360c,_0x400220,!![]);}catch(_0x44b440){return BPromise['reject'](_0x44b440);}return _0x32360c['save']();};}function saveUpdates(_0x39c124,_0x2d6ae5){return function(_0x380f4f){if(_0x380f4f){return _0x380f4f[_0xd80e('0x34')](_0x39c124)[_0xd80e('0x22')](function(_0x36c554){return _0x36c554;});}return null;};}function removeEntity(_0x289164,_0x1a0dfe){return function(_0x4fd1b2){if(_0x4fd1b2){return _0x4fd1b2['destroy']()[_0xd80e('0x22')](function(){_0x289164[_0xd80e('0x2d')](0xcc)[_0xd80e('0x35')]();});}};}function handleEntityNotFound(_0x12d113,_0x447b70){return function(_0x271b23){if(!_0x271b23){_0x12d113[_0xd80e('0x36')](0x194);}return _0x271b23;};}function handleError(_0x3cb956,_0x2ea0dd){_0x2ea0dd=_0x2ea0dd||0x1f4;return function(_0x192c08){logger['error'](_0x192c08[_0xd80e('0x37')]);if(_0x192c08['name']){delete _0x192c08[_0xd80e('0x38')];}_0x3cb956[_0xd80e('0x2d')](_0x2ea0dd)[_0xd80e('0x39')](_0x192c08);};}exports[_0xd80e('0x3a')]=function(_0x5a1fda,_0x3e44d7){var _0x54a969={},_0x3275fa={},_0x4f15a9={'count':0x0,'rows':[]};var _0xfb551a=_[_0xd80e('0x3b')](db['ServicenowConfiguration'][_0xd80e('0x3c')],function(_0x41ac0d){return{'name':_0x41ac0d[_0xd80e('0x3d')],'type':_0x41ac0d['type'][_0xd80e('0x3e')]};});_0x3275fa[_0xd80e('0x3f')]=_[_0xd80e('0x3b')](_0xfb551a,_0xd80e('0x38'));_0x3275fa[_0xd80e('0x40')]=_[_0xd80e('0x41')](_0x5a1fda[_0xd80e('0x40')]);_0x3275fa[_0xd80e('0x42')]=_[_0xd80e('0x43')](_0x3275fa['model'],_0x3275fa['query']);_0x54a969['attributes']=_[_0xd80e('0x43')](_0x3275fa[_0xd80e('0x3f')],qs['fields'](_0x5a1fda[_0xd80e('0x40')]['fields']));_0x54a969[_0xd80e('0x44')]=_0x54a969['attributes'][_0xd80e('0x45')]?_0x54a969[_0xd80e('0x44')]:_0x3275fa['model'];if(!_0x5a1fda['query'][_0xd80e('0x46')](_0xd80e('0x47'))){_0x54a969[_0xd80e('0x31')]=qs[_0xd80e('0x31')](_0x5a1fda[_0xd80e('0x40')][_0xd80e('0x31')]);_0x54a969[_0xd80e('0x30')]=qs[_0xd80e('0x30')](_0x5a1fda[_0xd80e('0x40')][_0xd80e('0x30')]);}_0x54a969[_0xd80e('0x48')]=qs[_0xd80e('0x49')](_0x5a1fda[_0xd80e('0x40')][_0xd80e('0x49')]);_0x54a969[_0xd80e('0x4a')]=qs[_0xd80e('0x42')](_['pick'](_0x5a1fda['query'],_0x3275fa['filters']),_0xfb551a);if(_0x5a1fda[_0xd80e('0x40')]['filter']){_0x54a969[_0xd80e('0x4a')]=_[_0xd80e('0x4b')](_0x54a969[_0xd80e('0x4a')],{'$or':_[_0xd80e('0x3b')](_0xfb551a,function(_0x2612e7){if(_0x2612e7[_0xd80e('0x4c')]!=='VIRTUAL'){var _0x5cf97a={};_0x5cf97a[_0x2612e7['name']]={'$like':'%'+_0x5a1fda[_0xd80e('0x40')]['filter']+'%'};return _0x5cf97a;}})});}_0x54a969=_[_0xd80e('0x4b')]({},_0x54a969,_0x5a1fda[_0xd80e('0x4d')]);var _0x2a3db3={'where':_0x54a969[_0xd80e('0x4a')]};return db[_0xd80e('0x4e')]['count'](_0x2a3db3)[_0xd80e('0x22')](function(_0x4353f2){_0x4f15a9[_0xd80e('0x2f')]=_0x4353f2;if(_0x5a1fda['query'][_0xd80e('0x4f')]){_0x54a969[_0xd80e('0x50')]=[{'all':!![]}];}return db[_0xd80e('0x4e')]['findAll'](_0x54a969);})[_0xd80e('0x22')](function(_0x29aaa0){_0x4f15a9[_0xd80e('0x51')]=_0x29aaa0;return _0x4f15a9;})[_0xd80e('0x22')](respondWithFilteredResult(_0x3e44d7,_0x54a969))[_0xd80e('0x2c')](handleError(_0x3e44d7,null));};exports[_0xd80e('0x52')]=function(_0x56ba81,_0x5aad1b){var _0x275985={'raw':![],'where':{'id':_0x56ba81[_0xd80e('0x53')]['id']}},_0x27134e={};_0x27134e['model']=_['keys'](db[_0xd80e('0x4e')][_0xd80e('0x3c')]);_0x27134e[_0xd80e('0x40')]=_[_0xd80e('0x41')](_0x56ba81[_0xd80e('0x40')]);_0x27134e['filters']=_[_0xd80e('0x43')](_0x27134e['model'],_0x27134e[_0xd80e('0x40')]);_0x275985[_0xd80e('0x44')]=_['intersection'](_0x27134e[_0xd80e('0x3f')],qs[_0xd80e('0x54')](_0x56ba81[_0xd80e('0x40')][_0xd80e('0x54')]));_0x275985[_0xd80e('0x44')]=_0x275985[_0xd80e('0x44')][_0xd80e('0x45')]?_0x275985['attributes']:_0x27134e[_0xd80e('0x3f')];if(_0x56ba81[_0xd80e('0x40')][_0xd80e('0x4f')]){_0x275985['include']=[{'all':!![]}];}_0x275985=_['merge']({},_0x275985,_0x56ba81[_0xd80e('0x4d')]);return db[_0xd80e('0x4e')][_0xd80e('0x55')](_0x275985)[_0xd80e('0x22')](handleEntityNotFound(_0x5aad1b,null))[_0xd80e('0x22')](respondWithResult(_0x5aad1b,null))[_0xd80e('0x2c')](handleError(_0x5aad1b,null));};exports[_0xd80e('0x56')]=function(_0x3984fe,_0x5205c4){return db[_0xd80e('0x4e')]['create'](_0x3984fe[_0xd80e('0x57')],{})[_0xd80e('0x22')](respondWithResult(_0x5205c4,0xc9))[_0xd80e('0x2c')](handleError(_0x5205c4,null));};exports[_0xd80e('0x34')]=function(_0x915fcf,_0x11a21a){if(_0x915fcf['body']['id']){delete _0x915fcf[_0xd80e('0x57')]['id'];}return db['ServicenowConfiguration'][_0xd80e('0x55')]({'where':{'id':_0x915fcf[_0xd80e('0x53')]['id']}})['then'](handleEntityNotFound(_0x11a21a,null))['then'](saveUpdates(_0x915fcf[_0xd80e('0x57')],null))[_0xd80e('0x22')](respondWithResult(_0x11a21a,null))[_0xd80e('0x2c')](handleError(_0x11a21a,null));};exports['destroy']=function(_0x568770,_0x1ba0ed){return db[_0xd80e('0x4e')]['find']({'where':{'id':_0x568770[_0xd80e('0x53')]['id']}})[_0xd80e('0x22')](handleEntityNotFound(_0x1ba0ed,null))[_0xd80e('0x22')](removeEntity(_0x1ba0ed,null))['catch'](handleError(_0x1ba0ed,null));};exports[_0xd80e('0x58')]=function(_0x589c0b,_0x720eab,_0x392704){var _0x3d8e46={};var _0x29ce58={};var _0x5e892a;var _0x2df79e;return db['ServicenowConfiguration'][_0xd80e('0x59')]({'where':{'id':_0x589c0b['params']['id']}})[_0xd80e('0x22')](handleEntityNotFound(_0x720eab,null))[_0xd80e('0x22')](function(_0x4252eb){if(_0x4252eb){_0x5e892a=_0x4252eb;_0x29ce58[_0xd80e('0x3f')]=_['keys'](db[_0xd80e('0x5a')][_0xd80e('0x3c')]);_0x29ce58['query']=_[_0xd80e('0x41')](_0x589c0b[_0xd80e('0x40')]);_0x29ce58[_0xd80e('0x42')]=_[_0xd80e('0x43')](_0x29ce58['model'],_0x29ce58[_0xd80e('0x40')]);_0x3d8e46[_0xd80e('0x44')]=_['intersection'](_0x29ce58[_0xd80e('0x3f')],qs[_0xd80e('0x54')](_0x589c0b[_0xd80e('0x40')]['fields']));_0x3d8e46['attributes']=_0x3d8e46['attributes']['length']?_0x3d8e46[_0xd80e('0x44')]:_0x29ce58['model'];_0x3d8e46[_0xd80e('0x48')]=qs[_0xd80e('0x49')](_0x589c0b[_0xd80e('0x40')]['sort']);_0x3d8e46[_0xd80e('0x4a')]=qs[_0xd80e('0x42')](_[_0xd80e('0x5b')](_0x589c0b[_0xd80e('0x40')],_0x29ce58[_0xd80e('0x42')]));if(_0x589c0b[_0xd80e('0x40')][_0xd80e('0x5c')]){_0x3d8e46[_0xd80e('0x4a')]=_[_0xd80e('0x4b')](_0x3d8e46['where'],{'$or':_['map'](_0x3d8e46[_0xd80e('0x44')],function(_0x410ed6){var _0x10104c={};_0x10104c[_0x410ed6]={'$like':'%'+_0x589c0b[_0xd80e('0x40')]['filter']+'%'};return _0x10104c;})});}_0x3d8e46=_[_0xd80e('0x4b')]({},_0x3d8e46,_0x589c0b[_0xd80e('0x4d')]);return _0x5e892a[_0xd80e('0x58')](_0x3d8e46);}})[_0xd80e('0x22')](function(_0x130148){if(_0x130148){_0x2df79e=_0x130148['length'];if(!_0x589c0b[_0xd80e('0x40')][_0xd80e('0x46')](_0xd80e('0x47'))){_0x3d8e46[_0xd80e('0x31')]=qs['limit'](_0x589c0b[_0xd80e('0x40')][_0xd80e('0x31')]);_0x3d8e46[_0xd80e('0x30')]=qs[_0xd80e('0x30')](_0x589c0b[_0xd80e('0x40')][_0xd80e('0x30')]);}return _0x5e892a['getFields'](_0x3d8e46);}})[_0xd80e('0x22')](function(_0x393fb6){if(_0x393fb6){return _0x393fb6?{'count':_0x2df79e,'rows':_0x393fb6}:null;}})['then'](respondWithResult(_0x720eab,null))[_0xd80e('0x2c')](handleError(_0x720eab,null));};exports[_0xd80e('0x5d')]=function(_0x2f6fc8,_0x1d7a25,_0x5d91ae){var _0x324a79={};var _0x571951={};var _0x314fbb;var _0x879165;return db[_0xd80e('0x4e')][_0xd80e('0x59')]({'where':{'id':_0x2f6fc8[_0xd80e('0x53')]['id']}})['then'](handleEntityNotFound(_0x1d7a25,null))[_0xd80e('0x22')](function(_0x2fe14a){if(_0x2fe14a){_0x314fbb=_0x2fe14a;_0x571951[_0xd80e('0x3f')]=_[_0xd80e('0x41')](db['ServicenowField'][_0xd80e('0x3c')]);_0x571951[_0xd80e('0x40')]=_['keys'](_0x2f6fc8[_0xd80e('0x40')]);_0x571951[_0xd80e('0x42')]=_[_0xd80e('0x43')](_0x571951[_0xd80e('0x3f')],_0x571951[_0xd80e('0x40')]);_0x324a79[_0xd80e('0x44')]=_['intersection'](_0x571951['model'],qs[_0xd80e('0x54')](_0x2f6fc8['query']['fields']));_0x324a79[_0xd80e('0x44')]=_0x324a79[_0xd80e('0x44')][_0xd80e('0x45')]?_0x324a79[_0xd80e('0x44')]:_0x571951[_0xd80e('0x3f')];_0x324a79[_0xd80e('0x48')]=qs[_0xd80e('0x49')](_0x2f6fc8[_0xd80e('0x40')]['sort']);_0x324a79[_0xd80e('0x4a')]=qs[_0xd80e('0x42')](_[_0xd80e('0x5b')](_0x2f6fc8[_0xd80e('0x40')],_0x571951['filters']));if(_0x2f6fc8[_0xd80e('0x40')][_0xd80e('0x5c')]){_0x324a79['where']=_[_0xd80e('0x4b')](_0x324a79[_0xd80e('0x4a')],{'$or':_['map'](_0x324a79[_0xd80e('0x44')],function(_0x160dc4){var _0x472dd3={};_0x472dd3[_0x160dc4]={'$like':'%'+_0x2f6fc8[_0xd80e('0x40')][_0xd80e('0x5c')]+'%'};return _0x472dd3;})});}_0x324a79=_[_0xd80e('0x4b')]({},_0x324a79,_0x2f6fc8[_0xd80e('0x4d')]);return _0x314fbb[_0xd80e('0x5d')](_0x324a79);}})[_0xd80e('0x22')](function(_0x3d1a6c){if(_0x3d1a6c){_0x879165=_0x3d1a6c['length'];if(!_0x2f6fc8[_0xd80e('0x40')][_0xd80e('0x46')]('nolimit')){_0x324a79[_0xd80e('0x31')]=qs[_0xd80e('0x31')](_0x2f6fc8[_0xd80e('0x40')]['limit']);_0x324a79[_0xd80e('0x30')]=qs['offset'](_0x2f6fc8[_0xd80e('0x40')][_0xd80e('0x30')]);}return _0x314fbb[_0xd80e('0x5d')](_0x324a79);}})[_0xd80e('0x22')](function(_0x35cdce){if(_0x35cdce){return _0x35cdce?{'count':_0x879165,'rows':_0x35cdce}:null;}})['then'](respondWithResult(_0x1d7a25,null))[_0xd80e('0x2c')](handleError(_0x1d7a25,null));};exports[_0xd80e('0x5e')]=function(_0x33b72a,_0x2ce54f,_0xb0ec86){var _0x188971={};var _0x28657a={};var _0x12ae3e;var _0x29a279;return db[_0xd80e('0x4e')][_0xd80e('0x59')]({'where':{'id':_0x33b72a[_0xd80e('0x53')]['id']}})[_0xd80e('0x22')](handleEntityNotFound(_0x2ce54f,null))[_0xd80e('0x22')](function(_0x5ddd1f){if(_0x5ddd1f){_0x12ae3e=_0x5ddd1f;_0x28657a[_0xd80e('0x3f')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x28657a[_0xd80e('0x40')]=_[_0xd80e('0x41')](_0x33b72a[_0xd80e('0x40')]);_0x28657a[_0xd80e('0x42')]=_['intersection'](_0x28657a[_0xd80e('0x3f')],_0x28657a[_0xd80e('0x40')]);_0x188971[_0xd80e('0x44')]=_['intersection'](_0x28657a['model'],qs[_0xd80e('0x54')](_0x33b72a['query'][_0xd80e('0x54')]));_0x188971[_0xd80e('0x44')]=_0x188971[_0xd80e('0x44')][_0xd80e('0x45')]?_0x188971[_0xd80e('0x44')]:_0x28657a[_0xd80e('0x3f')];_0x188971[_0xd80e('0x48')]=qs['sort'](_0x33b72a['query']['sort']);_0x188971[_0xd80e('0x4a')]=qs[_0xd80e('0x42')](_[_0xd80e('0x5b')](_0x33b72a[_0xd80e('0x40')],_0x28657a[_0xd80e('0x42')]));if(_0x33b72a[_0xd80e('0x40')][_0xd80e('0x5c')]){_0x188971[_0xd80e('0x4a')]=_[_0xd80e('0x4b')](_0x188971[_0xd80e('0x4a')],{'$or':_[_0xd80e('0x3b')](_0x188971[_0xd80e('0x44')],function(_0xebea83){var _0x4cecdb={};_0x4cecdb[_0xebea83]={'$like':'%'+_0x33b72a[_0xd80e('0x40')][_0xd80e('0x5c')]+'%'};return _0x4cecdb;})});}_0x188971=_[_0xd80e('0x4b')]({},_0x188971,_0x33b72a[_0xd80e('0x4d')]);return _0x12ae3e[_0xd80e('0x5e')](_0x188971);}})[_0xd80e('0x22')](function(_0x34fcb2){if(_0x34fcb2){_0x29a279=_0x34fcb2[_0xd80e('0x45')];if(!_0x33b72a[_0xd80e('0x40')][_0xd80e('0x46')]('nolimit')){_0x188971[_0xd80e('0x31')]=qs[_0xd80e('0x31')](_0x33b72a[_0xd80e('0x40')][_0xd80e('0x31')]);_0x188971['offset']=qs['offset'](_0x33b72a['query'][_0xd80e('0x30')]);}return _0x12ae3e[_0xd80e('0x5e')](_0x188971);}})['then'](function(_0xb5b831){if(_0xb5b831){return _0xb5b831?{'count':_0x29a279,'rows':_0xb5b831}:null;}})[_0xd80e('0x22')](respondWithResult(_0x2ce54f,null))[_0xd80e('0x2c')](handleError(_0x2ce54f,null));}; \ No newline at end of file +var _0xb58b=['filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','intersection','find','create','body','getFields','findOne','ServicenowField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','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~!@#$%^&-_=+[{]}.','info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb58b,0x1f1));var _0xbb58=function(_0x60334f,_0x419bb9){_0x60334f=_0x60334f-0x0;var _0x4252a6=_0xb58b[_0x60334f];return _0x4252a6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbb58('0x0'));var rimraf=require(_0xbb58('0x1'));var zipdir=require(_0xbb58('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb58('0x3'));var moment=require(_0xbb58('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb58('0x5'));var util=require('util');var path=require(_0xbb58('0x6'));var sox=require(_0xbb58('0x7'));var csv=require(_0xbb58('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x8'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var db=require(_0xbb58('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xbb58('0x18')][_0xbb58('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4cda21,_0x132511,_0xdc68b9){if(_0xdc68b9){var _0x14106f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x14106f[_0xbb58('0x1a')](_0x132511)){return _0x4cda21;}else{throw new db[(_0xbb58('0x1b'))]['ValidationError'](_0xbb58('0x1c'));}}else{return _0x4cda21;}}function respondWithRpcPromise(_0x23fd15,_0x5f4751,_0x4ba30e,_0x33c20f){return new BPromise(function(_0x445b1f,_0x38d69a){var _0x47c927=_0x33c20f||client;return _0x47c927['request'](_0x23fd15,_0x4ba30e)['then'](function(_0x55156e){logger[_0xbb58('0x1d')](_0xbb58('0x1e'),_0x5f4751,'request\x20sent');logger[_0xbb58('0x1f')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5f4751,_0xbb58('0x20'),JSON[_0xbb58('0x21')](_0x55156e));if(_0x55156e[_0xbb58('0x22')]){if(_0x55156e[_0xbb58('0x22')][_0xbb58('0x23')]===0x1f4){logger[_0xbb58('0x22')](_0xbb58('0x1e'),_0x5f4751,_0x55156e['error'][_0xbb58('0x24')]);return _0x38d69a(_0x55156e[_0xbb58('0x22')][_0xbb58('0x24')]);}logger[_0xbb58('0x22')](_0xbb58('0x1e'),_0x5f4751,_0x55156e[_0xbb58('0x22')][_0xbb58('0x24')]);return _0x445b1f(_0x55156e[_0xbb58('0x22')][_0xbb58('0x24')]);}else{logger['info'](_0xbb58('0x1e'),_0x5f4751,'request\x20sent');_0x445b1f(_0x55156e[_0xbb58('0x25')][_0xbb58('0x24')]);}})[_0xbb58('0x26')](function(_0x3e215c){logger[_0xbb58('0x22')](_0xbb58('0x1e'),_0x5f4751,_0x3e215c);_0x38d69a(_0x3e215c);});});}function respondWithStatusCode(_0x2d556a,_0x15e4c5){_0x15e4c5=_0x15e4c5||0xcc;return function(_0x4e0303){if(_0x4e0303){return _0x2d556a[_0xbb58('0x27')](_0x15e4c5);}return _0x2d556a[_0xbb58('0x28')](_0x15e4c5)[_0xbb58('0x29')]();};}function respondWithResult(_0x129094,_0x8e9ed9){_0x8e9ed9=_0x8e9ed9||0xc8;return function(_0x521d0c){if(_0x521d0c){return _0x129094[_0xbb58('0x28')](_0x8e9ed9)[_0xbb58('0x2a')](_0x521d0c);}};}function respondWithFilteredResult(_0x16df29,_0x2d5b39){return function(_0xf6687e){if(_0xf6687e){var _0x28b3a3=_0xf6687e['count'],_0x2a0481=_0x2d5b39[_0xbb58('0x2b')],_0x4157c4=_0x2d5b39[_0xbb58('0x2b')]+_0x2d5b39[_0xbb58('0x2c')],_0x3559b6;if(_0x4157c4>=_0x28b3a3){_0x4157c4=_0x28b3a3;_0x3559b6=0xc8;}else{_0x3559b6=0xce;}_0x16df29[_0xbb58('0x28')](_0x3559b6);return _0x16df29[_0xbb58('0x2d')](_0xbb58('0x2e'),_0x2a0481+'-'+_0x4157c4+'/'+_0x28b3a3)[_0xbb58('0x2a')](_0xf6687e);}return null;};}function patchUpdates(_0x643e0e){return function(_0x3f8db3){try{jsonpatch['apply'](_0x3f8db3,_0x643e0e,!![]);}catch(_0xc39e3f){return BPromise[_0xbb58('0x2f')](_0xc39e3f);}return _0x3f8db3[_0xbb58('0x30')]();};}function saveUpdates(_0x3a1e46,_0xdbbe7b){return function(_0x33f931){if(_0x33f931){return _0x33f931[_0xbb58('0x31')](_0x3a1e46)[_0xbb58('0x32')](function(_0x23816c){return _0x23816c;});}return null;};}function removeEntity(_0x1cae1c,_0x389187){return function(_0x34583e){if(_0x34583e){return _0x34583e[_0xbb58('0x33')]()['then'](function(){_0x1cae1c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1def9f,_0x19324e){return function(_0x1c207b){if(!_0x1c207b){_0x1def9f[_0xbb58('0x27')](0x194);}return _0x1c207b;};}function handleError(_0xb28e63,_0x3333e5){_0x3333e5=_0x3333e5||0x1f4;return function(_0x3093bf){logger[_0xbb58('0x22')](_0x3093bf['stack']);if(_0x3093bf[_0xbb58('0x34')]){delete _0x3093bf[_0xbb58('0x34')];}_0xb28e63['status'](_0x3333e5)[_0xbb58('0x35')](_0x3093bf);};}exports['index']=function(_0x2a82e,_0x4de9db){var _0x86372e={},_0x36c7b4={},_0x52f4af={'count':0x0,'rows':[]};var _0x3d3aee=_[_0xbb58('0x36')](db[_0xbb58('0x37')][_0xbb58('0x38')],function(_0x1b86a6){return{'name':_0x1b86a6[_0xbb58('0x39')],'type':_0x1b86a6[_0xbb58('0x3a')][_0xbb58('0x3b')]};});_0x36c7b4['model']=_[_0xbb58('0x36')](_0x3d3aee,_0xbb58('0x34'));_0x36c7b4[_0xbb58('0x3c')]=_['keys'](_0x2a82e['query']);_0x36c7b4[_0xbb58('0x3d')]=_['intersection'](_0x36c7b4[_0xbb58('0x3e')],_0x36c7b4[_0xbb58('0x3c')]);_0x86372e[_0xbb58('0x3f')]=_['intersection'](_0x36c7b4['model'],qs[_0xbb58('0x40')](_0x2a82e[_0xbb58('0x3c')][_0xbb58('0x40')]));_0x86372e[_0xbb58('0x3f')]=_0x86372e[_0xbb58('0x3f')][_0xbb58('0x41')]?_0x86372e['attributes']:_0x36c7b4[_0xbb58('0x3e')];if(!_0x2a82e[_0xbb58('0x3c')][_0xbb58('0x42')](_0xbb58('0x43'))){_0x86372e[_0xbb58('0x2c')]=qs[_0xbb58('0x2c')](_0x2a82e['query'][_0xbb58('0x2c')]);_0x86372e['offset']=qs[_0xbb58('0x2b')](_0x2a82e[_0xbb58('0x3c')][_0xbb58('0x2b')]);}_0x86372e[_0xbb58('0x44')]=qs['sort'](_0x2a82e[_0xbb58('0x3c')][_0xbb58('0x45')]);_0x86372e[_0xbb58('0x46')]=qs[_0xbb58('0x3d')](_['pick'](_0x2a82e[_0xbb58('0x3c')],_0x36c7b4['filters']),_0x3d3aee);if(_0x2a82e[_0xbb58('0x3c')][_0xbb58('0x47')]){_0x86372e[_0xbb58('0x46')]=_[_0xbb58('0x48')](_0x86372e[_0xbb58('0x46')],{'$or':_[_0xbb58('0x36')](_0x3d3aee,function(_0x666a57){if(_0x666a57[_0xbb58('0x3a')]!==_0xbb58('0x49')){var _0x444906={};_0x444906[_0x666a57[_0xbb58('0x34')]]={'$like':'%'+_0x2a82e[_0xbb58('0x3c')][_0xbb58('0x47')]+'%'};return _0x444906;}})});}_0x86372e=_['merge']({},_0x86372e,_0x2a82e[_0xbb58('0x4a')]);var _0x5b5190={'where':_0x86372e['where']};return db[_0xbb58('0x37')][_0xbb58('0x4b')](_0x5b5190)[_0xbb58('0x32')](function(_0x1aaad9){_0x52f4af[_0xbb58('0x4b')]=_0x1aaad9;if(_0x2a82e[_0xbb58('0x3c')][_0xbb58('0x4c')]){_0x86372e[_0xbb58('0x4d')]=[{'all':!![]}];}return db[_0xbb58('0x37')][_0xbb58('0x4e')](_0x86372e);})[_0xbb58('0x32')](function(_0x59a8cf){_0x52f4af[_0xbb58('0x4f')]=_0x59a8cf;return _0x52f4af;})[_0xbb58('0x32')](respondWithFilteredResult(_0x4de9db,_0x86372e))['catch'](handleError(_0x4de9db,null));};exports[_0xbb58('0x50')]=function(_0x230cf4,_0xf94897){var _0xdb0ff7={'raw':![],'where':{'id':_0x230cf4[_0xbb58('0x51')]['id']}},_0x5de68e={};_0x5de68e['model']=_[_0xbb58('0x52')](db[_0xbb58('0x37')][_0xbb58('0x38')]);_0x5de68e['query']=_[_0xbb58('0x52')](_0x230cf4[_0xbb58('0x3c')]);_0x5de68e['filters']=_[_0xbb58('0x53')](_0x5de68e['model'],_0x5de68e[_0xbb58('0x3c')]);_0xdb0ff7[_0xbb58('0x3f')]=_[_0xbb58('0x53')](_0x5de68e[_0xbb58('0x3e')],qs[_0xbb58('0x40')](_0x230cf4[_0xbb58('0x3c')][_0xbb58('0x40')]));_0xdb0ff7['attributes']=_0xdb0ff7[_0xbb58('0x3f')][_0xbb58('0x41')]?_0xdb0ff7['attributes']:_0x5de68e[_0xbb58('0x3e')];if(_0x230cf4[_0xbb58('0x3c')]['includeAll']){_0xdb0ff7[_0xbb58('0x4d')]=[{'all':!![]}];}_0xdb0ff7=_[_0xbb58('0x48')]({},_0xdb0ff7,_0x230cf4[_0xbb58('0x4a')]);return db['ServicenowConfiguration'][_0xbb58('0x54')](_0xdb0ff7)[_0xbb58('0x32')](handleEntityNotFound(_0xf94897,null))[_0xbb58('0x32')](respondWithResult(_0xf94897,null))['catch'](handleError(_0xf94897,null));};exports[_0xbb58('0x55')]=function(_0x5cf2b9,_0x200e82){return db[_0xbb58('0x37')][_0xbb58('0x55')](_0x5cf2b9['body'],{})['then'](respondWithResult(_0x200e82,0xc9))[_0xbb58('0x26')](handleError(_0x200e82,null));};exports[_0xbb58('0x31')]=function(_0x37bb99,_0x23ed08){if(_0x37bb99[_0xbb58('0x56')]['id']){delete _0x37bb99['body']['id'];}return db[_0xbb58('0x37')][_0xbb58('0x54')]({'where':{'id':_0x37bb99[_0xbb58('0x51')]['id']}})['then'](handleEntityNotFound(_0x23ed08,null))[_0xbb58('0x32')](saveUpdates(_0x37bb99[_0xbb58('0x56')],null))[_0xbb58('0x32')](respondWithResult(_0x23ed08,null))[_0xbb58('0x26')](handleError(_0x23ed08,null));};exports[_0xbb58('0x33')]=function(_0x5e7ae0,_0x1174b1){return db[_0xbb58('0x37')][_0xbb58('0x54')]({'where':{'id':_0x5e7ae0[_0xbb58('0x51')]['id']}})[_0xbb58('0x32')](handleEntityNotFound(_0x1174b1,null))[_0xbb58('0x32')](removeEntity(_0x1174b1,null))[_0xbb58('0x26')](handleError(_0x1174b1,null));};exports[_0xbb58('0x57')]=function(_0x55d5be,_0x344b0d,_0x502338){var _0x1033e0={};var _0x29c28b={};var _0x3862c9;var _0x2a6963;return db[_0xbb58('0x37')][_0xbb58('0x58')]({'where':{'id':_0x55d5be[_0xbb58('0x51')]['id']}})[_0xbb58('0x32')](handleEntityNotFound(_0x344b0d,null))[_0xbb58('0x32')](function(_0x11ddd7){if(_0x11ddd7){_0x3862c9=_0x11ddd7;_0x29c28b[_0xbb58('0x3e')]=_['keys'](db[_0xbb58('0x59')][_0xbb58('0x38')]);_0x29c28b[_0xbb58('0x3c')]=_['keys'](_0x55d5be[_0xbb58('0x3c')]);_0x29c28b['filters']=_[_0xbb58('0x53')](_0x29c28b[_0xbb58('0x3e')],_0x29c28b['query']);_0x1033e0[_0xbb58('0x3f')]=_[_0xbb58('0x53')](_0x29c28b[_0xbb58('0x3e')],qs[_0xbb58('0x40')](_0x55d5be[_0xbb58('0x3c')]['fields']));_0x1033e0['attributes']=_0x1033e0[_0xbb58('0x3f')][_0xbb58('0x41')]?_0x1033e0[_0xbb58('0x3f')]:_0x29c28b['model'];_0x1033e0[_0xbb58('0x44')]=qs[_0xbb58('0x45')](_0x55d5be['query'][_0xbb58('0x45')]);_0x1033e0[_0xbb58('0x46')]=qs['filters'](_[_0xbb58('0x5a')](_0x55d5be[_0xbb58('0x3c')],_0x29c28b[_0xbb58('0x3d')]));if(_0x55d5be[_0xbb58('0x3c')][_0xbb58('0x47')]){_0x1033e0['where']=_[_0xbb58('0x48')](_0x1033e0[_0xbb58('0x46')],{'$or':_[_0xbb58('0x36')](_0x1033e0[_0xbb58('0x3f')],function(_0x2c9093){var _0x5e17fc={};_0x5e17fc[_0x2c9093]={'$like':'%'+_0x55d5be['query'][_0xbb58('0x47')]+'%'};return _0x5e17fc;})});}_0x1033e0=_['merge']({},_0x1033e0,_0x55d5be[_0xbb58('0x4a')]);return _0x3862c9[_0xbb58('0x57')](_0x1033e0);}})[_0xbb58('0x32')](function(_0xe5b33a){if(_0xe5b33a){_0x2a6963=_0xe5b33a[_0xbb58('0x41')];if(!_0x55d5be[_0xbb58('0x3c')][_0xbb58('0x42')](_0xbb58('0x43'))){_0x1033e0[_0xbb58('0x2c')]=qs[_0xbb58('0x2c')](_0x55d5be['query'][_0xbb58('0x2c')]);_0x1033e0[_0xbb58('0x2b')]=qs[_0xbb58('0x2b')](_0x55d5be['query'][_0xbb58('0x2b')]);}return _0x3862c9['getFields'](_0x1033e0);}})['then'](function(_0x1e315e){if(_0x1e315e){return _0x1e315e?{'count':_0x2a6963,'rows':_0x1e315e}:null;}})[_0xbb58('0x32')](respondWithResult(_0x344b0d,null))[_0xbb58('0x26')](handleError(_0x344b0d,null));};exports[_0xbb58('0x5b')]=function(_0x4e19b1,_0x51c6f9,_0x3210d7){var _0x1853d1={};var _0x4d2091={};var _0x27c861;var _0x2ba4a9;return db[_0xbb58('0x37')][_0xbb58('0x58')]({'where':{'id':_0x4e19b1[_0xbb58('0x51')]['id']}})['then'](handleEntityNotFound(_0x51c6f9,null))[_0xbb58('0x32')](function(_0x5b27d2){if(_0x5b27d2){_0x27c861=_0x5b27d2;_0x4d2091['model']=_[_0xbb58('0x52')](db[_0xbb58('0x59')][_0xbb58('0x38')]);_0x4d2091['query']=_[_0xbb58('0x52')](_0x4e19b1[_0xbb58('0x3c')]);_0x4d2091[_0xbb58('0x3d')]=_[_0xbb58('0x53')](_0x4d2091['model'],_0x4d2091[_0xbb58('0x3c')]);_0x1853d1['attributes']=_['intersection'](_0x4d2091[_0xbb58('0x3e')],qs[_0xbb58('0x40')](_0x4e19b1[_0xbb58('0x3c')]['fields']));_0x1853d1['attributes']=_0x1853d1[_0xbb58('0x3f')][_0xbb58('0x41')]?_0x1853d1[_0xbb58('0x3f')]:_0x4d2091[_0xbb58('0x3e')];_0x1853d1[_0xbb58('0x44')]=qs[_0xbb58('0x45')](_0x4e19b1[_0xbb58('0x3c')][_0xbb58('0x45')]);_0x1853d1[_0xbb58('0x46')]=qs[_0xbb58('0x3d')](_[_0xbb58('0x5a')](_0x4e19b1['query'],_0x4d2091['filters']));if(_0x4e19b1[_0xbb58('0x3c')][_0xbb58('0x47')]){_0x1853d1[_0xbb58('0x46')]=_['merge'](_0x1853d1[_0xbb58('0x46')],{'$or':_[_0xbb58('0x36')](_0x1853d1[_0xbb58('0x3f')],function(_0x494c33){var _0x2d70d2={};_0x2d70d2[_0x494c33]={'$like':'%'+_0x4e19b1['query'][_0xbb58('0x47')]+'%'};return _0x2d70d2;})});}_0x1853d1=_['merge']({},_0x1853d1,_0x4e19b1[_0xbb58('0x4a')]);return _0x27c861[_0xbb58('0x5b')](_0x1853d1);}})[_0xbb58('0x32')](function(_0x1f1b74){if(_0x1f1b74){_0x2ba4a9=_0x1f1b74[_0xbb58('0x41')];if(!_0x4e19b1[_0xbb58('0x3c')]['hasOwnProperty']('nolimit')){_0x1853d1[_0xbb58('0x2c')]=qs[_0xbb58('0x2c')](_0x4e19b1['query'][_0xbb58('0x2c')]);_0x1853d1[_0xbb58('0x2b')]=qs[_0xbb58('0x2b')](_0x4e19b1['query'][_0xbb58('0x2b')]);}return _0x27c861['getSubjects'](_0x1853d1);}})[_0xbb58('0x32')](function(_0x2616ad){if(_0x2616ad){return _0x2616ad?{'count':_0x2ba4a9,'rows':_0x2616ad}:null;}})[_0xbb58('0x32')](respondWithResult(_0x51c6f9,null))[_0xbb58('0x26')](handleError(_0x51c6f9,null));};exports[_0xbb58('0x5c')]=function(_0xe57872,_0x195a23,_0x5a80ef){var _0x10828e={};var _0x2562cf={};var _0xa6182a;var _0x51c68b;return db[_0xbb58('0x37')][_0xbb58('0x58')]({'where':{'id':_0xe57872['params']['id']}})['then'](handleEntityNotFound(_0x195a23,null))[_0xbb58('0x32')](function(_0x1dc157){if(_0x1dc157){_0xa6182a=_0x1dc157;_0x2562cf[_0xbb58('0x3e')]=_['keys'](db['ServicenowField'][_0xbb58('0x38')]);_0x2562cf[_0xbb58('0x3c')]=_[_0xbb58('0x52')](_0xe57872[_0xbb58('0x3c')]);_0x2562cf[_0xbb58('0x3d')]=_[_0xbb58('0x53')](_0x2562cf[_0xbb58('0x3e')],_0x2562cf[_0xbb58('0x3c')]);_0x10828e[_0xbb58('0x3f')]=_[_0xbb58('0x53')](_0x2562cf[_0xbb58('0x3e')],qs[_0xbb58('0x40')](_0xe57872[_0xbb58('0x3c')][_0xbb58('0x40')]));_0x10828e[_0xbb58('0x3f')]=_0x10828e['attributes'][_0xbb58('0x41')]?_0x10828e['attributes']:_0x2562cf[_0xbb58('0x3e')];_0x10828e[_0xbb58('0x44')]=qs[_0xbb58('0x45')](_0xe57872[_0xbb58('0x3c')][_0xbb58('0x45')]);_0x10828e[_0xbb58('0x46')]=qs[_0xbb58('0x3d')](_[_0xbb58('0x5a')](_0xe57872[_0xbb58('0x3c')],_0x2562cf[_0xbb58('0x3d')]));if(_0xe57872['query'][_0xbb58('0x47')]){_0x10828e[_0xbb58('0x46')]=_[_0xbb58('0x48')](_0x10828e[_0xbb58('0x46')],{'$or':_[_0xbb58('0x36')](_0x10828e['attributes'],function(_0x6ef032){var _0x4c8531={};_0x4c8531[_0x6ef032]={'$like':'%'+_0xe57872['query'][_0xbb58('0x47')]+'%'};return _0x4c8531;})});}_0x10828e=_['merge']({},_0x10828e,_0xe57872[_0xbb58('0x4a')]);return _0xa6182a['getDescriptions'](_0x10828e);}})[_0xbb58('0x32')](function(_0x4a794f){if(_0x4a794f){_0x51c68b=_0x4a794f[_0xbb58('0x41')];if(!_0xe57872[_0xbb58('0x3c')][_0xbb58('0x42')](_0xbb58('0x43'))){_0x10828e[_0xbb58('0x2c')]=qs[_0xbb58('0x2c')](_0xe57872[_0xbb58('0x3c')][_0xbb58('0x2c')]);_0x10828e['offset']=qs['offset'](_0xe57872[_0xbb58('0x3c')][_0xbb58('0x2b')]);}return _0xa6182a['getDescriptions'](_0x10828e);}})['then'](function(_0x56722e){if(_0x56722e){return _0x56722e?{'count':_0x51c68b,'rows':_0x56722e}:null;}})[_0xbb58('0x32')](respondWithResult(_0x195a23,null))[_0xbb58('0x26')](handleError(_0x195a23,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 1db4aaf..43c3808 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 _0x2d18=['../../config/environment','./intServicenowConfiguration.attributes','exports','define','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x2f1eca,_0x171395){var _0x3f3dad=function(_0x18986b){while(--_0x18986b){_0x2f1eca['push'](_0x2f1eca['shift']());}};_0x3f3dad(++_0x171395);}(_0x2d18,0xd5));var _0x82d1=function(_0x31bc2d,_0x1c94fc){_0x31bc2d=_0x31bc2d-0x0;var _0x3c149e=_0x2d18[_0x31bc2d];return _0x3c149e;};'use strict';var _=require(_0x82d1('0x0'));var util=require(_0x82d1('0x1'));var logger=require(_0x82d1('0x2'))(_0x82d1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x82d1('0x4'));var fs=require('fs');var path=require(_0x82d1('0x5'));var rimraf=require(_0x82d1('0x6'));var config=require(_0x82d1('0x7'));var attributes=require(_0x82d1('0x8'));module[_0x82d1('0x9')]=function(_0x32b9c8,_0x3e36a0){return _0x32b9c8[_0x82d1('0xa')]('ServicenowConfiguration',attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bbd=['int_servicenow_configurations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0x9bbd,0x198));var _0xd9bb=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9bbd[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd9bb('0x0'))(_0xd9bb('0x1'));var moment=require(_0xd9bb('0x2'));var BPromise=require(_0xd9bb('0x3'));var rp=require(_0xd9bb('0x4'));var fs=require('fs');var path=require(_0xd9bb('0x5'));var rimraf=require(_0xd9bb('0x6'));var config=require(_0xd9bb('0x7'));var attributes=require(_0xd9bb('0x8'));module[_0xd9bb('0x9')]=function(_0x2a6001,_0x5a7e41){return _0x2a6001['define']('ServicenowConfiguration',attributes,{'tableName':_0xd9bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 247c53b..ea5ad9c 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 _0x134d=['../../config/utils','../../config/logger','rpc','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1ebee8,_0x1251fc){var _0x46529c=function(_0x4c2fec){while(--_0x4c2fec){_0x1ebee8['push'](_0x1ebee8['shift']());}};_0x46529c(++_0x1251fc);}(_0x134d,0x8d));var _0xd134=function(_0x71174c,_0x42a7d6){_0x71174c=_0x71174c-0x0;var _0x4b6b9d=_0x134d[_0x71174c];return _0x4b6b9d;};'use strict';var _=require(_0xd134('0x0'));var util=require(_0xd134('0x1'));var moment=require(_0xd134('0x2'));var BPromise=require(_0xd134('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd134('0x4'));var db=require(_0xd134('0x5'))['db'];var utils=require(_0xd134('0x6'));var logger=require(_0xd134('0x7'))(_0xd134('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd134('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1290f6,_0x1b7cd6,_0x3654c0){return new BPromise(function(_0x22e0fd,_0x5e370c){return client[_0xd134('0xa')](_0x1290f6,_0x3654c0)[_0xd134('0xb')](function(_0x146b8a){logger['info'](_0xd134('0xc'),_0x1b7cd6,_0xd134('0xd'));logger['debug'](_0xd134('0xe'),_0x1b7cd6,'request\x20sent',JSON[_0xd134('0xf')](_0x146b8a));if(_0x146b8a[_0xd134('0x10')]){if(_0x146b8a[_0xd134('0x10')][_0xd134('0x11')]===0x1f4){logger[_0xd134('0x10')](_0xd134('0xc'),_0x1b7cd6,_0x146b8a['error']['message']);return _0x5e370c(_0x146b8a[_0xd134('0x10')][_0xd134('0x12')]);}logger[_0xd134('0x10')](_0xd134('0xc'),_0x1b7cd6,_0x146b8a[_0xd134('0x10')][_0xd134('0x12')]);return _0x22e0fd(_0x146b8a[_0xd134('0x10')][_0xd134('0x12')]);}else{logger['info'](_0xd134('0xc'),_0x1b7cd6,'request\x20sent');_0x22e0fd(_0x146b8a[_0xd134('0x13')][_0xd134('0x12')]);}})[_0xd134('0x14')](function(_0x11bb28){logger[_0xd134('0x10')](_0xd134('0xc'),_0x1b7cd6,_0x11bb28);_0x5e370c(_0x11bb28);});});} \ No newline at end of file +var _0xf9e0=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x383e67,_0x502254){var _0x1c63f4=function(_0x5efa98){while(--_0x5efa98){_0x383e67['push'](_0x383e67['shift']());}};_0x1c63f4(++_0x502254);}(_0xf9e0,0x65));var _0x0f9e=function(_0x48028d,_0x204d4e){_0x48028d=_0x48028d-0x0;var _0x4b177d=_0xf9e0[_0x48028d];return _0x4b177d;};'use strict';var _=require(_0x0f9e('0x0'));var util=require(_0x0f9e('0x1'));var moment=require(_0x0f9e('0x2'));var BPromise=require(_0x0f9e('0x3'));var rs=require(_0x0f9e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f9e('0x5'))['db'];var utils=require(_0x0f9e('0x6'));var logger=require(_0x0f9e('0x7'))(_0x0f9e('0x8'));var config=require(_0x0f9e('0x9'));var jayson=require(_0x0f9e('0xa'));var client=jayson[_0x0f9e('0xb')][_0x0f9e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d79e9,_0xcfbbf4,_0x3bb29d){return new BPromise(function(_0x39ef86,_0xf0544b){return client[_0x0f9e('0xd')](_0x4d79e9,_0x3bb29d)[_0x0f9e('0xe')](function(_0x1cdb5a){logger[_0x0f9e('0xf')](_0x0f9e('0x10'),_0xcfbbf4,'request\x20sent');logger[_0x0f9e('0x11')](_0x0f9e('0x12'),_0xcfbbf4,_0x0f9e('0x13'),JSON[_0x0f9e('0x14')](_0x1cdb5a));if(_0x1cdb5a['error']){if(_0x1cdb5a['error']['code']===0x1f4){logger[_0x0f9e('0x15')]('ServicenowConfiguration,\x20%s,\x20%s',_0xcfbbf4,_0x1cdb5a[_0x0f9e('0x15')][_0x0f9e('0x16')]);return _0xf0544b(_0x1cdb5a['error'][_0x0f9e('0x16')]);}logger[_0x0f9e('0x15')](_0x0f9e('0x10'),_0xcfbbf4,_0x1cdb5a[_0x0f9e('0x15')][_0x0f9e('0x16')]);return _0x39ef86(_0x1cdb5a[_0x0f9e('0x15')]['message']);}else{logger[_0x0f9e('0xf')](_0x0f9e('0x10'),_0xcfbbf4,_0x0f9e('0x13'));_0x39ef86(_0x1cdb5a[_0x0f9e('0x17')]['message']);}})[_0x0f9e('0x18')](function(_0x1b60c2){logger['error'](_0x0f9e('0x10'),_0xcfbbf4,_0x1b60c2);_0xf0544b(_0x1b60c2);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index ec434bd..c24ac77 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 _0x3b2c=['/:id','post','create','put','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get'];(function(_0x53417c,_0x126dee){var _0x49407d=function(_0x1b1737){while(--_0x1b1737){_0x53417c['push'](_0x53417c['shift']());}};_0x49407d(++_0x126dee);}(_0x3b2c,0x75));var _0xc3b2=function(_0x23134c,_0x1e9a42){_0x23134c=_0x23134c-0x0;var _0x13a5ec=_0x3b2c[_0x23134c];return _0x13a5ec;};'use strict';var multer=require(_0xc3b2('0x0'));var util=require(_0xc3b2('0x1'));var path=require('path');var timeout=require(_0xc3b2('0x2'));var express=require(_0xc3b2('0x3'));var router=express[_0xc3b2('0x4')]();var auth=require(_0xc3b2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc3b2('0x6'));var controller=require(_0xc3b2('0x7'));router['get']('/',auth[_0xc3b2('0x8')](),controller[_0xc3b2('0x9')]);router[_0xc3b2('0xa')](_0xc3b2('0xb'),auth[_0xc3b2('0x8')](),controller['show']);router[_0xc3b2('0xc')]('/',auth[_0xc3b2('0x8')](),controller[_0xc3b2('0xd')]);router[_0xc3b2('0xe')](_0xc3b2('0xb'),auth[_0xc3b2('0x8')](),controller['update']);router['delete'](_0xc3b2('0xb'),auth[_0xc3b2('0x8')](),controller['destroy']);module[_0xc3b2('0xf')]=router; \ No newline at end of file +var _0xa90d=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','create','update','delete','/:id','destroy','exports'];(function(_0x294cf1,_0x5d6a40){var _0x334402=function(_0x5b07f0){while(--_0x5b07f0){_0x294cf1['push'](_0x294cf1['shift']());}};_0x334402(++_0x5d6a40);}(_0xa90d,0x77));var _0xda90=function(_0x59696e,_0x317b40){_0x59696e=_0x59696e-0x0;var _0x46dd2f=_0xa90d[_0x59696e];return _0x46dd2f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xda90('0x0'));var timeout=require(_0xda90('0x1'));var express=require(_0xda90('0x2'));var router=express[_0xda90('0x3')]();var auth=require(_0xda90('0x4'));var interaction=require(_0xda90('0x5'));var config=require(_0xda90('0x6'));var controller=require(_0xda90('0x7'));router['get']('/',auth[_0xda90('0x8')](),controller[_0xda90('0x9')]);router[_0xda90('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xda90('0x8')](),controller[_0xda90('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xda90('0xc')]);router[_0xda90('0xd')](_0xda90('0xe'),auth[_0xda90('0x8')](),controller[_0xda90('0xf')]);module[_0xda90('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 5d98b9e..002b267 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 _0x6d7c=['customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x5a7d5f,_0x5695cb){var _0x5dcded=function(_0x13f053){while(--_0x13f053){_0x5a7d5f['push'](_0x5a7d5f['shift']());}};_0x5dcded(++_0x5695cb);}(_0x6d7c,0x1c7));var _0xc6d7=function(_0x342107,_0x3dc07e){_0x342107=_0x342107-0x0;var _0x46328c=_0x6d7c[_0x342107];return _0x46328c;};'use strict';var Sequelize=require(_0xc6d7('0x0'));module[_0xc6d7('0x1')]={'type':{'type':Sequelize[_0xc6d7('0x2')](_0xc6d7('0x3'),'variable',_0xc6d7('0x4'),_0xc6d7('0x5')),'defaultValue':_0xc6d7('0x3')},'content':{'type':Sequelize[_0xc6d7('0x6')]},'key':{'type':Sequelize[_0xc6d7('0x6')]},'keyType':{'type':Sequelize[_0xc6d7('0x2')](_0xc6d7('0x3'),_0xc6d7('0x7'),_0xc6d7('0x4'))},'keyContent':{'type':Sequelize[_0xc6d7('0x6')]},'idField':{'type':Sequelize[_0xc6d7('0x6')]},'nameField':{'type':Sequelize[_0xc6d7('0x6')]},'customField':{'type':Sequelize[_0xc6d7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6082=['customVariable','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x482d01,_0x43f5e8){var _0x4bd836=function(_0x44d9ec){while(--_0x44d9ec){_0x482d01['push'](_0x482d01['shift']());}};_0x4bd836(++_0x43f5e8);}(_0x6082,0x134));var _0x2608=function(_0x195ade,_0x5bac67){_0x195ade=_0x195ade-0x0;var _0x372178=_0x6082[_0x195ade];return _0x372178;};'use strict';var Sequelize=require(_0x2608('0x0'));module[_0x2608('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2608('0x2'),_0x2608('0x3'),_0x2608('0x4'),'keyValue'),'defaultValue':_0x2608('0x2')},'content':{'type':Sequelize[_0x2608('0x5')]},'key':{'type':Sequelize[_0x2608('0x5')]},'keyType':{'type':Sequelize[_0x2608('0x6')](_0x2608('0x2'),_0x2608('0x3'),_0x2608('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2608('0x5')]},'customField':{'type':Sequelize[_0x2608('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2608('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 36953ab..f9ebd64 100644 --- a/server/api/intServicenowField/intServicenowField.controller.js +++ b/server/api/intServicenowField/intServicenowField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x5a2dac,_0x5f1c81){var _0x14deec=function(_0x959d5e){while(--_0x959d5e){_0x5a2dac['push'](_0x5a2dac['shift']());}};_0x14deec(++_0x5f1c81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x584dbc,_0x4b102c){var _0x554b9a=function(_0x17b669){while(--_0x17b669){_0x584dbc['push'](_0x584dbc['shift']());}};_0x554b9a(++_0x4b102c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index ee29679..484e61b 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 _0x2045=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util'];(function(_0x5a5a2d,_0xf7e83f){var _0x36ed27=function(_0x4ce00e){while(--_0x4ce00e){_0x5a5a2d['push'](_0x5a5a2d['shift']());}};_0x36ed27(++_0xf7e83f);}(_0x2045,0x6e));var _0x5204=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0x2045[_0x46ae5a];return _0x434986;};'use strict';var _=require(_0x5204('0x0'));var util=require(_0x5204('0x1'));var logger=require(_0x5204('0x2'))(_0x5204('0x3'));var moment=require('moment');var BPromise=require(_0x5204('0x4'));var rp=require(_0x5204('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5204('0x6'));var config=require(_0x5204('0x7'));var attributes=require(_0x5204('0x8'));module['exports']=function(_0x4b557b,_0x5428c1){return _0x4b557b[_0x5204('0x9')]('ServicenowField',attributes,{'tableName':_0x5204('0xa'),'paranoid':![],'indexes':[{'name':_0x5204('0xb'),'fields':[_0x5204('0xc'),_0x5204('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc685=['exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0x1acc2d,_0x597696){var _0xabfa6d=function(_0x41e83c){while(--_0x41e83c){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0xabfa6d(++_0x597696);}(_0xc685,0x1a9));var _0x5c68=function(_0x1bcdc8,_0x27b1bf){_0x1bcdc8=_0x1bcdc8-0x0;var _0x1cb6ed=_0xc685[_0x1bcdc8];return _0x1cb6ed;};'use strict';var _=require(_0x5c68('0x0'));var util=require(_0x5c68('0x1'));var logger=require(_0x5c68('0x2'))('api');var moment=require(_0x5c68('0x3'));var BPromise=require(_0x5c68('0x4'));var rp=require(_0x5c68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c68('0x6'));var config=require(_0x5c68('0x7'));var attributes=require(_0x5c68('0x8'));module[_0x5c68('0x9')]=function(_0x51d11b,_0x192fdb){return _0x51d11b[_0x5c68('0xa')](_0x5c68('0xb'),attributes,{'tableName':_0x5c68('0xc'),'paranoid':![],'indexes':[{'name':_0x5c68('0xd'),'fields':['idField','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 a72e35f..4dc4b73 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 _0x66ee=['request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x66ee,0x1ab));var _0xe66e=function(_0x53408b,_0x17a924){_0x53408b=_0x53408b-0x0;var _0x1c3fd0=_0x66ee[_0x53408b];return _0x1c3fd0;};'use strict';var _=require(_0xe66e('0x0'));var util=require(_0xe66e('0x1'));var moment=require(_0xe66e('0x2'));var BPromise=require(_0xe66e('0x3'));var rs=require(_0xe66e('0x4'));var fs=require('fs');var Redis=require(_0xe66e('0x5'));var db=require(_0xe66e('0x6'))['db'];var utils=require(_0xe66e('0x7'));var logger=require(_0xe66e('0x8'))(_0xe66e('0x9'));var config=require(_0xe66e('0xa'));var jayson=require(_0xe66e('0xb'));var client=jayson['client'][_0xe66e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47f103,_0x4f0f13,_0x3f86fa){return new BPromise(function(_0x2befb4,_0x1f4d0a){return client[_0xe66e('0xd')](_0x47f103,_0x3f86fa)[_0xe66e('0xe')](function(_0x814ee0){logger[_0xe66e('0xf')](_0xe66e('0x10'),_0x4f0f13,_0xe66e('0x11'));logger['debug'](_0xe66e('0x12'),_0x4f0f13,_0xe66e('0x11'),JSON['stringify'](_0x814ee0));if(_0x814ee0[_0xe66e('0x13')]){if(_0x814ee0[_0xe66e('0x13')]['code']===0x1f4){logger['error'](_0xe66e('0x10'),_0x4f0f13,_0x814ee0[_0xe66e('0x13')][_0xe66e('0x14')]);return _0x1f4d0a(_0x814ee0['error'][_0xe66e('0x14')]);}logger['error'](_0xe66e('0x10'),_0x4f0f13,_0x814ee0[_0xe66e('0x13')][_0xe66e('0x14')]);return _0x2befb4(_0x814ee0['error'][_0xe66e('0x14')]);}else{logger['info'](_0xe66e('0x10'),_0x4f0f13,'request\x20sent');_0x2befb4(_0x814ee0['result'][_0xe66e('0x14')]);}})[_0xe66e('0x15')](function(_0x5f5be3){logger['error']('ServicenowField,\x20%s,\x20%s',_0x4f0f13,_0x5f5be3);_0x1f4d0a(_0x5f5be3);});});} \ No newline at end of file +var _0xf591=['result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf591,0x1e2));var _0x1f59=function(_0x37c279,_0x4f9587){_0x37c279=_0x37c279-0x0;var _0x1024bc=_0xf591[_0x37c279];return _0x1024bc;};'use strict';var _=require('lodash');var util=require(_0x1f59('0x0'));var moment=require('moment');var BPromise=require(_0x1f59('0x1'));var rs=require(_0x1f59('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f59('0x3'))['db'];var utils=require(_0x1f59('0x4'));var logger=require(_0x1f59('0x5'))(_0x1f59('0x6'));var config=require('../../config/environment');var jayson=require(_0x1f59('0x7'));var client=jayson[_0x1f59('0x8')][_0x1f59('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6f9be,_0x1c321f,_0x3b15b5){return new BPromise(function(_0xebfeb4,_0x326cf1){return client['request'](_0x6f9be,_0x3b15b5)['then'](function(_0x3e0c76){logger[_0x1f59('0xa')](_0x1f59('0xb'),_0x1c321f,_0x1f59('0xc'));logger[_0x1f59('0xd')](_0x1f59('0xe'),_0x1c321f,_0x1f59('0xc'),JSON[_0x1f59('0xf')](_0x3e0c76));if(_0x3e0c76[_0x1f59('0x10')]){if(_0x3e0c76[_0x1f59('0x10')]['code']===0x1f4){logger['error'](_0x1f59('0xb'),_0x1c321f,_0x3e0c76['error'][_0x1f59('0x11')]);return _0x326cf1(_0x3e0c76[_0x1f59('0x10')]['message']);}logger[_0x1f59('0x10')]('ServicenowField,\x20%s,\x20%s',_0x1c321f,_0x3e0c76['error'][_0x1f59('0x11')]);return _0xebfeb4(_0x3e0c76['error'][_0x1f59('0x11')]);}else{logger[_0x1f59('0xa')](_0x1f59('0xb'),_0x1c321f,'request\x20sent');_0xebfeb4(_0x3e0c76[_0x1f59('0x12')][_0x1f59('0x11')]);}})[_0x1f59('0x13')](function(_0x4520ff){logger[_0x1f59('0x10')](_0x1f59('0xb'),_0x1c321f,_0x4520ff);_0x326cf1(_0x4520ff);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index b5b524d..e70499a 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 _0xc29a=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util'];(function(_0x50565a,_0x3c276d){var _0x1f17a9=function(_0x315279){while(--_0x315279){_0x50565a['push'](_0x50565a['shift']());}};_0x1f17a9(++_0x3c276d);}(_0xc29a,0xcd));var _0xac29=function(_0x1c1532,_0x58f42e){_0x1c1532=_0x1c1532-0x0;var _0x150b7a=_0xc29a[_0x1c1532];return _0x150b7a;};'use strict';var multer=require(_0xac29('0x0'));var util=require(_0xac29('0x1'));var path=require('path');var timeout=require(_0xac29('0x2'));var express=require(_0xac29('0x3'));var router=express['Router']();var auth=require(_0xac29('0x4'));var interaction=require(_0xac29('0x5'));var config=require(_0xac29('0x6'));var controller=require(_0xac29('0x7'));router[_0xac29('0x8')]('/',auth[_0xac29('0x9')](),controller[_0xac29('0xa')]);router[_0xac29('0x8')](_0xac29('0xb'),auth['isAuthenticated'](),controller[_0xac29('0xc')]);router[_0xac29('0x8')](_0xac29('0xd'),auth[_0xac29('0x9')](),controller['getConfigurations']);router[_0xac29('0x8')](_0xac29('0xe'),auth[_0xac29('0x9')](),controller[_0xac29('0xf')]);router[_0xac29('0x10')]('/',auth[_0xac29('0x9')](),controller[_0xac29('0x11')]);router[_0xac29('0x10')](_0xac29('0xd'),auth[_0xac29('0x9')](),controller[_0xac29('0x12')]);router[_0xac29('0x13')](_0xac29('0xb'),auth[_0xac29('0x9')](),controller[_0xac29('0x14')]);router[_0xac29('0x15')](_0xac29('0xb'),auth[_0xac29('0x9')](),controller['destroy']);module[_0xac29('0x16')]=router; \ No newline at end of file +var _0xba9d=['/:id','/:id/configurations','getConfigurations','post','create','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index'];(function(_0x44de94,_0x58cc91){var _0x5718c6=function(_0x245db1){while(--_0x245db1){_0x44de94['push'](_0x44de94['shift']());}};_0x5718c6(++_0x58cc91);}(_0xba9d,0xa9));var _0xdba9=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xba9d[_0x36c5b0];return _0xf19333;};'use strict';var multer=require(_0xdba9('0x0'));var util=require(_0xdba9('0x1'));var path=require(_0xdba9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdba9('0x3')]();var auth=require(_0xdba9('0x4'));var interaction=require(_0xdba9('0x5'));var config=require(_0xdba9('0x6'));var controller=require(_0xdba9('0x7'));router[_0xdba9('0x8')]('/',auth[_0xdba9('0x9')](),controller[_0xdba9('0xa')]);router[_0xdba9('0x8')](_0xdba9('0xb'),auth[_0xdba9('0x9')](),controller['show']);router[_0xdba9('0x8')](_0xdba9('0xc'),auth['isAuthenticated'](),controller[_0xdba9('0xd')]);router[_0xdba9('0x8')]('/:id/fields',auth[_0xdba9('0x9')](),controller['getFields']);router[_0xdba9('0xe')]('/',auth[_0xdba9('0x9')](),controller[_0xdba9('0xf')]);router[_0xdba9('0xe')](_0xdba9('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xdba9('0x10')](_0xdba9('0xb'),auth['isAuthenticated'](),controller[_0xdba9('0x11')]);router[_0xdba9('0x12')](_0xdba9('0xb'),auth[_0xdba9('0x9')](),controller['destroy']);module[_0xdba9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 834383d..d23be98 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 _0x68ef=['STRING','username','sequelize'];(function(_0x33c2fc,_0x4b2269){var _0xfafed4=function(_0x2230bd){while(--_0x2230bd){_0x33c2fc['push'](_0x33c2fc['shift']());}};_0xfafed4(++_0x4b2269);}(_0x68ef,0x10a));var _0xf68e=function(_0x355a19,_0x570f37){_0x355a19=_0x355a19-0x0;var _0xf6b59a=_0x68ef[_0x355a19];return _0xf6b59a;};'use strict';var Sequelize=require(_0xf68e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf68e('0x1')]},'username':{'type':Sequelize[_0xf68e('0x1')],'unique':_0xf68e('0x2')},'password':{'type':Sequelize[_0xf68e('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xf68e('0x1')]}}; \ No newline at end of file +var _0xa031=['exports','STRING','username','remoteUri','sequelize'];(function(_0x5cf48a,_0x4c16d6){var _0x480965=function(_0xefec16){while(--_0xefec16){_0x5cf48a['push'](_0x5cf48a['shift']());}};_0x480965(++_0x4c16d6);}(_0xa031,0x8b));var _0x1a03=function(_0x5d81ec,_0x34eeb1){_0x5d81ec=_0x5d81ec-0x0;var _0x3107e4=_0xa031[_0x5d81ec];return _0x3107e4;};'use strict';var Sequelize=require(_0x1a03('0x0'));module[_0x1a03('0x1')]={'name':{'type':Sequelize[_0x1a03('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1a03('0x2')],'unique':_0x1a03('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1a03('0x2')],'unique':_0x1a03('0x4')},'serverUrl':{'type':Sequelize[_0x1a03('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 0d2ab51..06eb8e0 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 _0x5dcb=['xCALLY\x20Motion\x20Integration','Password\x20Expired','format','Calls','values','module_fields','remove','includes','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','stack','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','getConfigurations','AccountId','Subjects','channel','getDescriptions','SugarcrmConfiguration','SugarcrmField','Descriptions','getFields','assigned_user_id','description','date_start','parent_id','parent_type','parent_name','username','password','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','JSON','PLAIN'];(function(_0xbccf,_0x5f3f74){var _0x24c504=function(_0x1442a0){while(--_0x1442a0){_0xbccf['push'](_0xbccf['shift']());}};_0x24c504(++_0x5f3f74);}(_0x5dcb,0x186));var _0xb5dc=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x5dcb[_0x4d8666];return _0x37175b;};'use strict';var pdf=require(_0xb5dc('0x0'));var emlformat=require(_0xb5dc('0x1'));var rimraf=require(_0xb5dc('0x2'));var zipdir=require(_0xb5dc('0x3'));var jsonpatch=require(_0xb5dc('0x4'));var rp=require(_0xb5dc('0x5'));var moment=require('moment');var BPromise=require(_0xb5dc('0x6'));var Mustache=require('mustache');var util=require(_0xb5dc('0x7'));var path=require('path');var sox=require(_0xb5dc('0x8'));var csv=require(_0xb5dc('0x9'));var ejs=require(_0xb5dc('0xa'));var fs=require('fs');var _=require(_0xb5dc('0xb'));var squel=require(_0xb5dc('0xc'));var crypto=require(_0xb5dc('0xd'));var jsforce=require(_0xb5dc('0xe'));var deskjs=require(_0xb5dc('0xf'));var toCsv=require(_0xb5dc('0x9'));var querystring=require(_0xb5dc('0x10'));var Papa=require(_0xb5dc('0x11'));var Redis=require(_0xb5dc('0x12'));var authService=require(_0xb5dc('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb5dc('0x14'))(_0xb5dc('0x15'));var utils=require(_0xb5dc('0x16'));var config=require(_0xb5dc('0x17'));var db=require(_0xb5dc('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xb5dc('0x19'));var client=jayson['client'][_0xb5dc('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1843f3,_0x4c9e51,_0x502896){if(_0x502896){var _0x62d91c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x62d91c[_0xb5dc('0x1b')](_0x4c9e51)){return _0x1843f3;}else{throw new db[(_0xb5dc('0x1c'))]['ValidationError'](_0xb5dc('0x1d'));}}else{return _0x1843f3;}}function respondWithRpcPromise(_0x1f9a84,_0x59ee7a,_0x46b354,_0xb75f0c){return new BPromise(function(_0x3217fa,_0x3064c){var _0x4984c7=_0xb75f0c||client;return _0x4984c7[_0xb5dc('0x1e')](_0x1f9a84,_0x46b354)['then'](function(_0xeaa3f7){logger[_0xb5dc('0x1f')](_0xb5dc('0x20'),_0x59ee7a,'request\x20sent');logger['debug'](_0xb5dc('0x21'),_0x59ee7a,_0xb5dc('0x22'),JSON[_0xb5dc('0x23')](_0xeaa3f7));if(_0xeaa3f7[_0xb5dc('0x24')]){if(_0xeaa3f7[_0xb5dc('0x24')][_0xb5dc('0x25')]===0x1f4){logger[_0xb5dc('0x24')](_0xb5dc('0x20'),_0x59ee7a,_0xeaa3f7['error'][_0xb5dc('0x26')]);return _0x3064c(_0xeaa3f7[_0xb5dc('0x24')][_0xb5dc('0x26')]);}logger[_0xb5dc('0x24')](_0xb5dc('0x20'),_0x59ee7a,_0xeaa3f7[_0xb5dc('0x24')][_0xb5dc('0x26')]);return _0x3217fa(_0xeaa3f7[_0xb5dc('0x24')]['message']);}else{logger[_0xb5dc('0x1f')](_0xb5dc('0x20'),_0x59ee7a,_0xb5dc('0x22'));_0x3217fa(_0xeaa3f7['result']['message']);}})[_0xb5dc('0x27')](function(_0x1d038c){logger['error'](_0xb5dc('0x20'),_0x59ee7a,_0x1d038c);_0x3064c(_0x1d038c);});});}function respondWithStatusCode(_0x261918,_0x3e59c7){_0x3e59c7=_0x3e59c7||0xcc;return function(_0x3ca6f7){if(_0x3ca6f7){return _0x261918[_0xb5dc('0x28')](_0x3e59c7);}return _0x261918[_0xb5dc('0x29')](_0x3e59c7)[_0xb5dc('0x2a')]();};}function respondWithResult(_0x47ecb1,_0x42f7f0){_0x42f7f0=_0x42f7f0||0xc8;return function(_0x562dfc){if(_0x562dfc){return _0x47ecb1[_0xb5dc('0x29')](_0x42f7f0)['json'](_0x562dfc);}};}function respondWithFilteredResult(_0x55e204,_0x403f02){return function(_0x399ba5){if(_0x399ba5){var _0x52793e=_0x399ba5[_0xb5dc('0x2b')],_0x5541b3=_0x403f02[_0xb5dc('0x2c')],_0x5d0045=_0x403f02[_0xb5dc('0x2c')]+_0x403f02[_0xb5dc('0x2d')],_0x3bcb74;if(_0x5d0045>=_0x52793e){_0x5d0045=_0x52793e;_0x3bcb74=0xc8;}else{_0x3bcb74=0xce;}_0x55e204[_0xb5dc('0x29')](_0x3bcb74);return _0x55e204[_0xb5dc('0x2e')](_0xb5dc('0x2f'),_0x5541b3+'-'+_0x5d0045+'/'+_0x52793e)[_0xb5dc('0x30')](_0x399ba5);}return null;};}function patchUpdates(_0x3c9c09){return function(_0x4bee4d){try{jsonpatch[_0xb5dc('0x31')](_0x4bee4d,_0x3c9c09,!![]);}catch(_0x47d48c){return BPromise['reject'](_0x47d48c);}return _0x4bee4d[_0xb5dc('0x32')]();};}function saveUpdates(_0x430ff3,_0x72458d){return function(_0x5959bb){if(_0x5959bb){return _0x5959bb[_0xb5dc('0x33')](_0x430ff3)[_0xb5dc('0x34')](function(_0x4cdc93){return _0x4cdc93;});}return null;};}function removeEntity(_0x1341c5,_0x585a2e){return function(_0xc0837b){if(_0xc0837b){return _0xc0837b['destroy']()['then'](function(){_0x1341c5[_0xb5dc('0x29')](0xcc)[_0xb5dc('0x2a')]();});}};}function handleEntityNotFound(_0x4ac7d3,_0x398b64){return function(_0x4dc446){if(!_0x4dc446){_0x4ac7d3[_0xb5dc('0x28')](0x194);}return _0x4dc446;};}function handleError(_0x23c5bd,_0x101a4){_0x101a4=_0x101a4||0x1f4;return function(_0x4f78af){logger[_0xb5dc('0x24')](_0x4f78af[_0xb5dc('0x35')]);if(_0x4f78af[_0xb5dc('0x36')]){delete _0x4f78af[_0xb5dc('0x36')];}_0x23c5bd['status'](_0x101a4)[_0xb5dc('0x37')](_0x4f78af);};}exports[_0xb5dc('0x38')]=function(_0x24b57f,_0x1b9145){var _0x4aeaf3={},_0x361c2a={},_0x530103={'count':0x0,'rows':[]};var _0x33ad30=_[_0xb5dc('0x39')](db[_0xb5dc('0x3a')][_0xb5dc('0x3b')],function(_0x54f263){return{'name':_0x54f263['fieldName'],'type':_0x54f263[_0xb5dc('0x3c')][_0xb5dc('0x3d')]};});_0x361c2a[_0xb5dc('0x3e')]=_[_0xb5dc('0x39')](_0x33ad30,_0xb5dc('0x36'));_0x361c2a[_0xb5dc('0x3f')]=_[_0xb5dc('0x40')](_0x24b57f[_0xb5dc('0x3f')]);_0x361c2a[_0xb5dc('0x41')]=_[_0xb5dc('0x42')](_0x361c2a[_0xb5dc('0x3e')],_0x361c2a[_0xb5dc('0x3f')]);_0x4aeaf3[_0xb5dc('0x43')]=_[_0xb5dc('0x42')](_0x361c2a[_0xb5dc('0x3e')],qs[_0xb5dc('0x44')](_0x24b57f[_0xb5dc('0x3f')][_0xb5dc('0x44')]));_0x4aeaf3[_0xb5dc('0x43')]=_0x4aeaf3[_0xb5dc('0x43')][_0xb5dc('0x45')]?_0x4aeaf3[_0xb5dc('0x43')]:_0x361c2a[_0xb5dc('0x3e')];if(!_0x24b57f['query'][_0xb5dc('0x46')](_0xb5dc('0x47'))){_0x4aeaf3[_0xb5dc('0x2d')]=qs[_0xb5dc('0x2d')](_0x24b57f[_0xb5dc('0x3f')][_0xb5dc('0x2d')]);_0x4aeaf3[_0xb5dc('0x2c')]=qs[_0xb5dc('0x2c')](_0x24b57f[_0xb5dc('0x3f')]['offset']);}_0x4aeaf3[_0xb5dc('0x48')]=qs[_0xb5dc('0x49')](_0x24b57f[_0xb5dc('0x3f')][_0xb5dc('0x49')]);_0x4aeaf3['where']=qs['filters'](_[_0xb5dc('0x4a')](_0x24b57f[_0xb5dc('0x3f')],_0x361c2a[_0xb5dc('0x41')]),_0x33ad30);if(_0x24b57f[_0xb5dc('0x3f')][_0xb5dc('0x4b')]){_0x4aeaf3[_0xb5dc('0x4c')]=_[_0xb5dc('0x4d')](_0x4aeaf3['where'],{'$or':_['map'](_0x33ad30,function(_0x4f5f72){if(_0x4f5f72['type']!==_0xb5dc('0x4e')){var _0xcc82de={};_0xcc82de[_0x4f5f72[_0xb5dc('0x36')]]={'$like':'%'+_0x24b57f['query'][_0xb5dc('0x4b')]+'%'};return _0xcc82de;}})});}_0x4aeaf3=_[_0xb5dc('0x4d')]({},_0x4aeaf3,_0x24b57f[_0xb5dc('0x4f')]);var _0x107cf7={'where':_0x4aeaf3[_0xb5dc('0x4c')]};return db[_0xb5dc('0x3a')]['count'](_0x107cf7)['then'](function(_0x199f82){_0x530103[_0xb5dc('0x2b')]=_0x199f82;if(_0x24b57f[_0xb5dc('0x3f')][_0xb5dc('0x50')]){_0x4aeaf3[_0xb5dc('0x51')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xb5dc('0x52')](_0x4aeaf3);})[_0xb5dc('0x34')](function(_0x494e9b){_0x530103[_0xb5dc('0x53')]=_0x494e9b;return _0x530103;})[_0xb5dc('0x34')](respondWithFilteredResult(_0x1b9145,_0x4aeaf3))['catch'](handleError(_0x1b9145,null));};exports['show']=function(_0x56744b,_0x2597d5){var _0xf119b1={'raw':![],'where':{'id':_0x56744b[_0xb5dc('0x54')]['id']}},_0x3f651f={};_0x3f651f[_0xb5dc('0x3e')]=_['keys'](db[_0xb5dc('0x3a')][_0xb5dc('0x3b')]);_0x3f651f[_0xb5dc('0x3f')]=_['keys'](_0x56744b['query']);_0x3f651f[_0xb5dc('0x41')]=_['intersection'](_0x3f651f[_0xb5dc('0x3e')],_0x3f651f[_0xb5dc('0x3f')]);_0xf119b1['attributes']=_[_0xb5dc('0x42')](_0x3f651f['model'],qs[_0xb5dc('0x44')](_0x56744b[_0xb5dc('0x3f')][_0xb5dc('0x44')]));_0xf119b1[_0xb5dc('0x43')]=_0xf119b1[_0xb5dc('0x43')][_0xb5dc('0x45')]?_0xf119b1[_0xb5dc('0x43')]:_0x3f651f[_0xb5dc('0x3e')];if(_0x56744b['query']['includeAll']){_0xf119b1['include']=[{'all':!![]}];}_0xf119b1=_[_0xb5dc('0x4d')]({},_0xf119b1,_0x56744b[_0xb5dc('0x4f')]);return db[_0xb5dc('0x3a')][_0xb5dc('0x55')](_0xf119b1)[_0xb5dc('0x34')](handleEntityNotFound(_0x2597d5,null))[_0xb5dc('0x34')](respondWithResult(_0x2597d5,null))[_0xb5dc('0x27')](handleError(_0x2597d5,null));};exports[_0xb5dc('0x56')]=function(_0x9ea8c,_0x372ae0){return db['SugarcrmAccount'][_0xb5dc('0x56')](_0x9ea8c['body'],{})[_0xb5dc('0x34')](respondWithResult(_0x372ae0,0xc9))[_0xb5dc('0x27')](handleError(_0x372ae0,null));};exports[_0xb5dc('0x33')]=function(_0x4018c9,_0x42c8d8){if(_0x4018c9[_0xb5dc('0x57')]['id']){delete _0x4018c9[_0xb5dc('0x57')]['id'];}return db['SugarcrmAccount'][_0xb5dc('0x55')]({'where':{'id':_0x4018c9[_0xb5dc('0x54')]['id']}})['then'](handleEntityNotFound(_0x42c8d8,null))[_0xb5dc('0x34')](saveUpdates(_0x4018c9[_0xb5dc('0x57')],null))[_0xb5dc('0x34')](respondWithResult(_0x42c8d8,null))['catch'](handleError(_0x42c8d8,null));};exports['destroy']=function(_0x21afef,_0x1fb1b9){return db['SugarcrmAccount'][_0xb5dc('0x55')]({'where':{'id':_0x21afef[_0xb5dc('0x54')]['id']}})[_0xb5dc('0x34')](handleEntityNotFound(_0x1fb1b9,null))[_0xb5dc('0x34')](removeEntity(_0x1fb1b9,null))[_0xb5dc('0x27')](handleError(_0x1fb1b9,null));};exports['getConfigurations']=function(_0x44ee4a,_0x7d82a4,_0x52dd32){var _0x59587a={};var _0x3816e5={};var _0x43ca44;var _0x1534bf;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x44ee4a[_0xb5dc('0x54')]['id']}})[_0xb5dc('0x34')](handleEntityNotFound(_0x7d82a4,null))['then'](function(_0xa8ca7f){if(_0xa8ca7f){_0x43ca44=_0xa8ca7f;_0x3816e5[_0xb5dc('0x3e')]=_[_0xb5dc('0x40')](db['SugarcrmConfiguration'][_0xb5dc('0x3b')]);_0x3816e5['query']=_['keys'](_0x44ee4a[_0xb5dc('0x3f')]);_0x3816e5[_0xb5dc('0x41')]=_[_0xb5dc('0x42')](_0x3816e5[_0xb5dc('0x3e')],_0x3816e5[_0xb5dc('0x3f')]);_0x59587a[_0xb5dc('0x43')]=_[_0xb5dc('0x42')](_0x3816e5[_0xb5dc('0x3e')],qs[_0xb5dc('0x44')](_0x44ee4a[_0xb5dc('0x3f')]['fields']));_0x59587a['attributes']=_0x59587a['attributes'][_0xb5dc('0x45')]?_0x59587a['attributes']:_0x3816e5[_0xb5dc('0x3e')];_0x59587a['order']=qs[_0xb5dc('0x49')](_0x44ee4a['query'][_0xb5dc('0x49')]);_0x59587a[_0xb5dc('0x4c')]=qs[_0xb5dc('0x41')](_['pick'](_0x44ee4a['query'],_0x3816e5['filters']));if(_0x44ee4a[_0xb5dc('0x3f')][_0xb5dc('0x4b')]){_0x59587a[_0xb5dc('0x4c')]=_[_0xb5dc('0x4d')](_0x59587a[_0xb5dc('0x4c')],{'$or':_[_0xb5dc('0x39')](_0x59587a['attributes'],function(_0x1af691){var _0x5619a8={};_0x5619a8[_0x1af691]={'$like':'%'+_0x44ee4a[_0xb5dc('0x3f')][_0xb5dc('0x4b')]+'%'};return _0x5619a8;})});}_0x59587a=_[_0xb5dc('0x4d')]({},_0x59587a,_0x44ee4a['options']);return _0x43ca44[_0xb5dc('0x58')](_0x59587a);}})['then'](function(_0x1e313b){if(_0x1e313b){_0x1534bf=_0x1e313b[_0xb5dc('0x45')];if(!_0x44ee4a[_0xb5dc('0x3f')][_0xb5dc('0x46')](_0xb5dc('0x47'))){_0x59587a['limit']=qs[_0xb5dc('0x2d')](_0x44ee4a[_0xb5dc('0x3f')][_0xb5dc('0x2d')]);_0x59587a[_0xb5dc('0x2c')]=qs[_0xb5dc('0x2c')](_0x44ee4a['query'][_0xb5dc('0x2c')]);}return _0x43ca44[_0xb5dc('0x58')](_0x59587a);}})[_0xb5dc('0x34')](function(_0x1aa3b8){if(_0x1aa3b8){return _0x1aa3b8?{'count':_0x1534bf,'rows':_0x1aa3b8}:null;}})[_0xb5dc('0x34')](respondWithResult(_0x7d82a4,null))['catch'](handleError(_0x7d82a4,null));};exports['addConfiguration']=function(_0x61f0e9,_0x3962d3,_0x5d51ce){if(_0x61f0e9[_0xb5dc('0x57')]['id']){delete _0x61f0e9[_0xb5dc('0x57')]['id'];}return db[_0xb5dc('0x3a')]['findOne']({'where':{'id':_0x61f0e9[_0xb5dc('0x54')]['id']}})[_0xb5dc('0x34')](handleEntityNotFound(_0x3962d3,null))[_0xb5dc('0x34')](function(_0x2c2411){if(_0x2c2411){_0x61f0e9[_0xb5dc('0x57')][_0xb5dc('0x59')]=_0x2c2411['id'];_0x61f0e9[_0xb5dc('0x57')][_0xb5dc('0x5a')]=integrations['getSubjects'](_0x61f0e9[_0xb5dc('0x57')][_0xb5dc('0x5b')],_0x61f0e9['body'][_0xb5dc('0x3c')]);_0x61f0e9[_0xb5dc('0x57')]['Descriptions']=integrations[_0xb5dc('0x5c')](_0x61f0e9['body']['channel'],_0x61f0e9[_0xb5dc('0x57')][_0xb5dc('0x3c')]);return db[_0xb5dc('0x5d')][_0xb5dc('0x56')](_0x61f0e9['body'],{'include':[{'model':db['SugarcrmField'],'as':_0xb5dc('0x5a')},{'model':db[_0xb5dc('0x5e')],'as':_0xb5dc('0x5f')}]});}return null;})[_0xb5dc('0x34')](respondWithResult(_0x3962d3,null))['catch'](handleError(_0x3962d3,null));};exports[_0xb5dc('0x60')]=function(_0x45ea60,_0x59ec49,_0x93f342){var _0x58cd9b='';var _0xe5f0ac=['id',_0xb5dc('0x36'),_0xb5dc('0x61'),'created_by',_0xb5dc('0x62'),_0xb5dc('0x63'),'duration_hours','duration_minutes',_0xb5dc('0x64'),_0xb5dc('0x65'),_0xb5dc('0x66'),'direction'];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x45ea60['params']['id']},'attributes':['id',_0xb5dc('0x67'),_0xb5dc('0x68'),_0xb5dc('0x69')]})[_0xb5dc('0x34')](handleEntityNotFound(_0x59ec49,null))[_0xb5dc('0x34')](function(_0x7b0baf){if(_0x7b0baf){_0x58cd9b=_0x7b0baf[_0xb5dc('0x69')];var _0x54b2cc=_0x58cd9b[_0xb5dc('0x6a')](-0x1);if(_0x54b2cc==='/'){_0x58cd9b=_0x58cd9b[_0xb5dc('0x6b')](0x0,_0x58cd9b[_0xb5dc('0x6c')](_0x54b2cc));}return rp({'method':_0xb5dc('0x6d'),'uri':util['format'](_0xb5dc('0x6e'),_0x58cd9b,_0xb5dc('0x6f')),'json':!![],'form':{'method':'login','input_type':_0xb5dc('0x70'),'response_type':_0xb5dc('0x70'),'rest_data':JSON[_0xb5dc('0x23')]({'user_auth':{'user_name':_0x7b0baf[_0xb5dc('0x67')],'password':_0x7b0baf[_0xb5dc('0x68')],'encryption':_0xb5dc('0x71')},'application':_0xb5dc('0x72')})}});}})[_0xb5dc('0x34')](function(_0x198b56){if(_0x198b56&&_0x198b56[_0xb5dc('0x36')]!=='Invalid\x20Login'&&_0x198b56[_0xb5dc('0x36')]!==_0xb5dc('0x73')){return rp({'method':_0xb5dc('0x6d'),'uri':util[_0xb5dc('0x74')]('%s%s',_0x58cd9b,_0xb5dc('0x6f')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xb5dc('0x70'),'response_type':'JSON','rest_data':JSON[_0xb5dc('0x23')]({'session':_0x198b56['id'],'module_name':_0xb5dc('0x75')})}})[_0xb5dc('0x34')](function(_0x590299){if(_0x590299){var _0x507a9b=_[_0xb5dc('0x76')](_0x590299[_0xb5dc('0x77')]);_[_0xb5dc('0x78')](_0x507a9b,function(_0x2b28a0){return _0xe5f0ac[_0xb5dc('0x79')](_0x2b28a0[_0xb5dc('0x36')]);});return{'count':_0x507a9b['length'],'rows':_['map'](_0x507a9b,function(_0x1dcabc){return{'id':_0x1dcabc[_0xb5dc('0x36')],'name':_0x1dcabc['label'],'custom':_['endsWith'](_0x1dcabc['name'],'_c')?!![]:![],'options':_0x1dcabc['options']?_[_0xb5dc('0x39')](_['values'](_0x1dcabc[_0xb5dc('0x4f')]),function(_0x263d38){return{'name':_0x263d38[_0xb5dc('0x7a')],'value':_0x263d38[_0xb5dc('0x36')]};}):[]};})};}})[_0xb5dc('0x34')](respondWithResult(_0x59ec49,null))[_0xb5dc('0x27')](function(_0x2b1da0){var _0x519797=_0x45ea60[_0xb5dc('0x3f')][_0xb5dc('0x1b')]?0x1f4:_0x2b1da0[_0xb5dc('0x7b')]||0x1f4;logger[_0xb5dc('0x24')](_0xb5dc('0x7c'),_0xb5dc('0x60'),_0x519797,JSON['stringify'](_0x2b1da0));delete _0x2b1da0['name'];if(_0x519797===0x191){_0x519797=0x190;}_0x59ec49['status'](_0x519797)[_0xb5dc('0x37')](_0x45ea60[_0xb5dc('0x3f')][_0xb5dc('0x1b')]?{'message':_0xb5dc('0x7d'),'statusCode':_0x2b1da0[_0xb5dc('0x7b')]}:_0x2b1da0);});}else{var _0x1920d2=0x1f4;_0x59ec49[_0xb5dc('0x29')](_0x1920d2)[_0xb5dc('0x37')]({'message':_0xb5dc('0x7d'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x9adb=['includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','length','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','sort','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','remove','label','endsWith','value','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','squel','crypto','desk.js','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','client','Sequelize','ValidationError','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','destroy','end','stack','name','send','index','map','SugarcrmAccount','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options'];(function(_0x5e6ef3,_0x5a092f){var _0x1a82b2=function(_0x176265){while(--_0x176265){_0x5e6ef3['push'](_0x5e6ef3['shift']());}};_0x1a82b2(++_0x5a092f);}(_0x9adb,0x1b8));var _0xb9ad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9adb[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xb9ad('0x0'));var emlformat=require(_0xb9ad('0x1'));var rimraf=require(_0xb9ad('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9ad('0x3'));var rp=require(_0xb9ad('0x4'));var moment=require(_0xb9ad('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb9ad('0x6'));var path=require(_0xb9ad('0x7'));var sox=require(_0xb9ad('0x8'));var csv=require(_0xb9ad('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb9ad('0xa'));var crypto=require(_0xb9ad('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb9ad('0xc'));var toCsv=require(_0xb9ad('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb9ad('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9ad('0xe'));var logger=require('../../config/logger')(_0xb9ad('0xf'));var utils=require('../../config/utils');var config=require(_0xb9ad('0x10'));var db=require(_0xb9ad('0x11'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xb9ad('0x12')]['http']({'port':0x232a});function checkPasswordPattern(_0x2a94b1,_0x3eebfa,_0x53fc05){if(_0x53fc05){var _0x738351=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x738351['test'](_0x3eebfa)){return _0x2a94b1;}else{throw new db[(_0xb9ad('0x13'))][(_0xb9ad('0x14'))]('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 _0x2a94b1;}}function respondWithRpcPromise(_0xc036db,_0x390541,_0x3db6ec,_0xdaefb4){return new BPromise(function(_0x3ee7b0,_0x48f9fc){var _0x393a34=_0xdaefb4||client;return _0x393a34[_0xb9ad('0x15')](_0xc036db,_0x3db6ec)[_0xb9ad('0x16')](function(_0x5033d3){logger[_0xb9ad('0x17')](_0xb9ad('0x18'),_0x390541,_0xb9ad('0x19'));logger[_0xb9ad('0x1a')](_0xb9ad('0x1b'),_0x390541,'request\x20sent',JSON[_0xb9ad('0x1c')](_0x5033d3));if(_0x5033d3[_0xb9ad('0x1d')]){if(_0x5033d3[_0xb9ad('0x1d')][_0xb9ad('0x1e')]===0x1f4){logger[_0xb9ad('0x1d')](_0xb9ad('0x18'),_0x390541,_0x5033d3[_0xb9ad('0x1d')][_0xb9ad('0x1f')]);return _0x48f9fc(_0x5033d3['error'][_0xb9ad('0x1f')]);}logger[_0xb9ad('0x1d')]('SugarcrmAccount,\x20%s,\x20%s',_0x390541,_0x5033d3[_0xb9ad('0x1d')]['message']);return _0x3ee7b0(_0x5033d3[_0xb9ad('0x1d')][_0xb9ad('0x1f')]);}else{logger[_0xb9ad('0x17')](_0xb9ad('0x18'),_0x390541,_0xb9ad('0x19'));_0x3ee7b0(_0x5033d3['result']['message']);}})['catch'](function(_0xdacc49){logger['error'](_0xb9ad('0x18'),_0x390541,_0xdacc49);_0x48f9fc(_0xdacc49);});});}function respondWithStatusCode(_0x183a03,_0x93909c){_0x93909c=_0x93909c||0xcc;return function(_0x5b68e0){if(_0x5b68e0){return _0x183a03[_0xb9ad('0x20')](_0x93909c);}return _0x183a03[_0xb9ad('0x21')](_0x93909c)['end']();};}function respondWithResult(_0x3b8653,_0x3f589a){_0x3f589a=_0x3f589a||0xc8;return function(_0x39b055){if(_0x39b055){return _0x3b8653['status'](_0x3f589a)[_0xb9ad('0x22')](_0x39b055);}};}function respondWithFilteredResult(_0x5c336f,_0x2f2de4){return function(_0x197db1){if(_0x197db1){var _0x57aff8=_0x197db1[_0xb9ad('0x23')],_0x55d213=_0x2f2de4[_0xb9ad('0x24')],_0x1e08a2=_0x2f2de4[_0xb9ad('0x24')]+_0x2f2de4[_0xb9ad('0x25')],_0x58ddad;if(_0x1e08a2>=_0x57aff8){_0x1e08a2=_0x57aff8;_0x58ddad=0xc8;}else{_0x58ddad=0xce;}_0x5c336f[_0xb9ad('0x21')](_0x58ddad);return _0x5c336f[_0xb9ad('0x26')](_0xb9ad('0x27'),_0x55d213+'-'+_0x1e08a2+'/'+_0x57aff8)[_0xb9ad('0x22')](_0x197db1);}return null;};}function patchUpdates(_0x1233b2){return function(_0x4e06af){try{jsonpatch['apply'](_0x4e06af,_0x1233b2,!![]);}catch(_0x344dfd){return BPromise[_0xb9ad('0x28')](_0x344dfd);}return _0x4e06af['save']();};}function saveUpdates(_0x21c375,_0x5581fd){return function(_0x23346c){if(_0x23346c){return _0x23346c[_0xb9ad('0x29')](_0x21c375)[_0xb9ad('0x16')](function(_0x19e4df){return _0x19e4df;});}return null;};}function removeEntity(_0x28fcab,_0xef58cf){return function(_0x53034f){if(_0x53034f){return _0x53034f[_0xb9ad('0x2a')]()[_0xb9ad('0x16')](function(){_0x28fcab[_0xb9ad('0x21')](0xcc)[_0xb9ad('0x2b')]();});}};}function handleEntityNotFound(_0x226a3c,_0x4c2dcf){return function(_0x2063fb){if(!_0x2063fb){_0x226a3c[_0xb9ad('0x20')](0x194);}return _0x2063fb;};}function handleError(_0x8fade8,_0x4fdaab){_0x4fdaab=_0x4fdaab||0x1f4;return function(_0x67ea58){logger[_0xb9ad('0x1d')](_0x67ea58[_0xb9ad('0x2c')]);if(_0x67ea58[_0xb9ad('0x2d')]){delete _0x67ea58[_0xb9ad('0x2d')];}_0x8fade8[_0xb9ad('0x21')](_0x4fdaab)[_0xb9ad('0x2e')](_0x67ea58);};}exports[_0xb9ad('0x2f')]=function(_0x5a8afc,_0x576b32){var _0x538777={},_0x154ded={},_0xf17b61={'count':0x0,'rows':[]};var _0x3f626c=_[_0xb9ad('0x30')](db[_0xb9ad('0x31')]['rawAttributes'],function(_0x185cb6){return{'name':_0x185cb6[_0xb9ad('0x32')],'type':_0x185cb6[_0xb9ad('0x33')][_0xb9ad('0x34')]};});_0x154ded[_0xb9ad('0x35')]=_[_0xb9ad('0x30')](_0x3f626c,_0xb9ad('0x2d'));_0x154ded['query']=_['keys'](_0x5a8afc[_0xb9ad('0x36')]);_0x154ded[_0xb9ad('0x37')]=_[_0xb9ad('0x38')](_0x154ded['model'],_0x154ded[_0xb9ad('0x36')]);_0x538777['attributes']=_['intersection'](_0x154ded['model'],qs[_0xb9ad('0x39')](_0x5a8afc[_0xb9ad('0x36')]['fields']));_0x538777[_0xb9ad('0x3a')]=_0x538777[_0xb9ad('0x3a')]['length']?_0x538777[_0xb9ad('0x3a')]:_0x154ded[_0xb9ad('0x35')];if(!_0x5a8afc[_0xb9ad('0x36')][_0xb9ad('0x3b')](_0xb9ad('0x3c'))){_0x538777[_0xb9ad('0x25')]=qs['limit'](_0x5a8afc[_0xb9ad('0x36')][_0xb9ad('0x25')]);_0x538777['offset']=qs[_0xb9ad('0x24')](_0x5a8afc['query'][_0xb9ad('0x24')]);}_0x538777[_0xb9ad('0x3d')]=qs['sort'](_0x5a8afc['query']['sort']);_0x538777[_0xb9ad('0x3e')]=qs[_0xb9ad('0x37')](_[_0xb9ad('0x3f')](_0x5a8afc[_0xb9ad('0x36')],_0x154ded[_0xb9ad('0x37')]),_0x3f626c);if(_0x5a8afc[_0xb9ad('0x36')][_0xb9ad('0x40')]){_0x538777[_0xb9ad('0x3e')]=_[_0xb9ad('0x41')](_0x538777['where'],{'$or':_['map'](_0x3f626c,function(_0xe027a7){if(_0xe027a7[_0xb9ad('0x33')]!==_0xb9ad('0x42')){var _0x469c8e={};_0x469c8e[_0xe027a7[_0xb9ad('0x2d')]]={'$like':'%'+_0x5a8afc['query'][_0xb9ad('0x40')]+'%'};return _0x469c8e;}})});}_0x538777=_[_0xb9ad('0x41')]({},_0x538777,_0x5a8afc[_0xb9ad('0x43')]);var _0x56587a={'where':_0x538777[_0xb9ad('0x3e')]};return db['SugarcrmAccount'][_0xb9ad('0x23')](_0x56587a)['then'](function(_0x15f152){_0xf17b61[_0xb9ad('0x23')]=_0x15f152;if(_0x5a8afc[_0xb9ad('0x36')][_0xb9ad('0x44')]){_0x538777[_0xb9ad('0x45')]=[{'all':!![]}];}return db[_0xb9ad('0x31')][_0xb9ad('0x46')](_0x538777);})[_0xb9ad('0x16')](function(_0x40c097){_0xf17b61[_0xb9ad('0x47')]=_0x40c097;return _0xf17b61;})[_0xb9ad('0x16')](respondWithFilteredResult(_0x576b32,_0x538777))[_0xb9ad('0x48')](handleError(_0x576b32,null));};exports[_0xb9ad('0x49')]=function(_0x21d58d,_0x4349e8){var _0x142e53={'raw':![],'where':{'id':_0x21d58d[_0xb9ad('0x4a')]['id']}},_0x4d2fd4={};_0x4d2fd4['model']=_['keys'](db[_0xb9ad('0x31')][_0xb9ad('0x4b')]);_0x4d2fd4[_0xb9ad('0x36')]=_[_0xb9ad('0x4c')](_0x21d58d[_0xb9ad('0x36')]);_0x4d2fd4[_0xb9ad('0x37')]=_[_0xb9ad('0x38')](_0x4d2fd4['model'],_0x4d2fd4[_0xb9ad('0x36')]);_0x142e53[_0xb9ad('0x3a')]=_[_0xb9ad('0x38')](_0x4d2fd4[_0xb9ad('0x35')],qs[_0xb9ad('0x39')](_0x21d58d[_0xb9ad('0x36')][_0xb9ad('0x39')]));_0x142e53['attributes']=_0x142e53[_0xb9ad('0x3a')][_0xb9ad('0x4d')]?_0x142e53['attributes']:_0x4d2fd4[_0xb9ad('0x35')];if(_0x21d58d[_0xb9ad('0x36')][_0xb9ad('0x44')]){_0x142e53[_0xb9ad('0x45')]=[{'all':!![]}];}_0x142e53=_[_0xb9ad('0x41')]({},_0x142e53,_0x21d58d['options']);return db[_0xb9ad('0x31')][_0xb9ad('0x4e')](_0x142e53)[_0xb9ad('0x16')](handleEntityNotFound(_0x4349e8,null))[_0xb9ad('0x16')](respondWithResult(_0x4349e8,null))[_0xb9ad('0x48')](handleError(_0x4349e8,null));};exports[_0xb9ad('0x4f')]=function(_0x457f18,_0xfea18c){return db[_0xb9ad('0x31')][_0xb9ad('0x4f')](_0x457f18[_0xb9ad('0x50')],{})[_0xb9ad('0x16')](respondWithResult(_0xfea18c,0xc9))[_0xb9ad('0x48')](handleError(_0xfea18c,null));};exports[_0xb9ad('0x29')]=function(_0x40c9a2,_0x19e0ec){if(_0x40c9a2['body']['id']){delete _0x40c9a2[_0xb9ad('0x50')]['id'];}return db[_0xb9ad('0x31')][_0xb9ad('0x4e')]({'where':{'id':_0x40c9a2[_0xb9ad('0x4a')]['id']}})[_0xb9ad('0x16')](handleEntityNotFound(_0x19e0ec,null))[_0xb9ad('0x16')](saveUpdates(_0x40c9a2[_0xb9ad('0x50')],null))[_0xb9ad('0x16')](respondWithResult(_0x19e0ec,null))['catch'](handleError(_0x19e0ec,null));};exports[_0xb9ad('0x2a')]=function(_0x3518b8,_0x360387){return db[_0xb9ad('0x31')]['find']({'where':{'id':_0x3518b8['params']['id']}})[_0xb9ad('0x16')](handleEntityNotFound(_0x360387,null))[_0xb9ad('0x16')](removeEntity(_0x360387,null))[_0xb9ad('0x48')](handleError(_0x360387,null));};exports[_0xb9ad('0x51')]=function(_0xf83216,_0x1b72bd,_0x54a993){var _0x3dac99={};var _0x1e3099={};var _0x3bf62e;var _0x1b4cca;return db[_0xb9ad('0x31')][_0xb9ad('0x52')]({'where':{'id':_0xf83216[_0xb9ad('0x4a')]['id']}})[_0xb9ad('0x16')](handleEntityNotFound(_0x1b72bd,null))[_0xb9ad('0x16')](function(_0x16ee7c){if(_0x16ee7c){_0x3bf62e=_0x16ee7c;_0x1e3099[_0xb9ad('0x35')]=_[_0xb9ad('0x4c')](db[_0xb9ad('0x53')][_0xb9ad('0x4b')]);_0x1e3099[_0xb9ad('0x36')]=_[_0xb9ad('0x4c')](_0xf83216[_0xb9ad('0x36')]);_0x1e3099[_0xb9ad('0x37')]=_[_0xb9ad('0x38')](_0x1e3099[_0xb9ad('0x35')],_0x1e3099[_0xb9ad('0x36')]);_0x3dac99[_0xb9ad('0x3a')]=_[_0xb9ad('0x38')](_0x1e3099[_0xb9ad('0x35')],qs[_0xb9ad('0x39')](_0xf83216[_0xb9ad('0x36')]['fields']));_0x3dac99[_0xb9ad('0x3a')]=_0x3dac99[_0xb9ad('0x3a')]['length']?_0x3dac99['attributes']:_0x1e3099['model'];_0x3dac99['order']=qs[_0xb9ad('0x54')](_0xf83216[_0xb9ad('0x36')][_0xb9ad('0x54')]);_0x3dac99[_0xb9ad('0x3e')]=qs[_0xb9ad('0x37')](_[_0xb9ad('0x3f')](_0xf83216[_0xb9ad('0x36')],_0x1e3099[_0xb9ad('0x37')]));if(_0xf83216[_0xb9ad('0x36')][_0xb9ad('0x40')]){_0x3dac99[_0xb9ad('0x3e')]=_['merge'](_0x3dac99['where'],{'$or':_[_0xb9ad('0x30')](_0x3dac99[_0xb9ad('0x3a')],function(_0x334818){var _0x214ec4={};_0x214ec4[_0x334818]={'$like':'%'+_0xf83216[_0xb9ad('0x36')][_0xb9ad('0x40')]+'%'};return _0x214ec4;})});}_0x3dac99=_[_0xb9ad('0x41')]({},_0x3dac99,_0xf83216[_0xb9ad('0x43')]);return _0x3bf62e[_0xb9ad('0x51')](_0x3dac99);}})[_0xb9ad('0x16')](function(_0x847d88){if(_0x847d88){_0x1b4cca=_0x847d88[_0xb9ad('0x4d')];if(!_0xf83216[_0xb9ad('0x36')][_0xb9ad('0x3b')](_0xb9ad('0x3c'))){_0x3dac99['limit']=qs['limit'](_0xf83216[_0xb9ad('0x36')]['limit']);_0x3dac99[_0xb9ad('0x24')]=qs['offset'](_0xf83216[_0xb9ad('0x36')][_0xb9ad('0x24')]);}return _0x3bf62e[_0xb9ad('0x51')](_0x3dac99);}})[_0xb9ad('0x16')](function(_0x361c32){if(_0x361c32){return _0x361c32?{'count':_0x1b4cca,'rows':_0x361c32}:null;}})[_0xb9ad('0x16')](respondWithResult(_0x1b72bd,null))[_0xb9ad('0x48')](handleError(_0x1b72bd,null));};exports['addConfiguration']=function(_0x4e13a9,_0x5c82ec,_0x137fe7){if(_0x4e13a9[_0xb9ad('0x50')]['id']){delete _0x4e13a9[_0xb9ad('0x50')]['id'];}return db[_0xb9ad('0x31')]['findOne']({'where':{'id':_0x4e13a9[_0xb9ad('0x4a')]['id']}})[_0xb9ad('0x16')](handleEntityNotFound(_0x5c82ec,null))[_0xb9ad('0x16')](function(_0x4cb6e3){if(_0x4cb6e3){_0x4e13a9[_0xb9ad('0x50')]['AccountId']=_0x4cb6e3['id'];_0x4e13a9[_0xb9ad('0x50')]['Subjects']=integrations[_0xb9ad('0x55')](_0x4e13a9['body'][_0xb9ad('0x56')],_0x4e13a9['body']['type']);_0x4e13a9['body'][_0xb9ad('0x57')]=integrations[_0xb9ad('0x58')](_0x4e13a9['body'][_0xb9ad('0x56')],_0x4e13a9[_0xb9ad('0x50')][_0xb9ad('0x33')]);return db[_0xb9ad('0x53')][_0xb9ad('0x4f')](_0x4e13a9[_0xb9ad('0x50')],{'include':[{'model':db[_0xb9ad('0x59')],'as':_0xb9ad('0x5a')},{'model':db[_0xb9ad('0x59')],'as':_0xb9ad('0x57')}]});}return null;})[_0xb9ad('0x16')](respondWithResult(_0x5c82ec,null))[_0xb9ad('0x48')](handleError(_0x5c82ec,null));};exports[_0xb9ad('0x5b')]=function(_0x106915,_0x2f59ee,_0x221430){var _0x179ba6='';var _0x409390=['id',_0xb9ad('0x2d'),_0xb9ad('0x5c'),_0xb9ad('0x5d'),_0xb9ad('0x5e'),_0xb9ad('0x5f'),_0xb9ad('0x60'),_0xb9ad('0x61'),_0xb9ad('0x62'),_0xb9ad('0x63'),_0xb9ad('0x64'),_0xb9ad('0x65')];return db[_0xb9ad('0x31')]['findOne']({'where':{'id':_0x106915[_0xb9ad('0x4a')]['id']},'attributes':['id',_0xb9ad('0x66'),_0xb9ad('0x67'),_0xb9ad('0x68')]})[_0xb9ad('0x16')](handleEntityNotFound(_0x2f59ee,null))['then'](function(_0x4af69d){if(_0x4af69d){_0x179ba6=_0x4af69d[_0xb9ad('0x68')];var _0x2b7981=_0x179ba6[_0xb9ad('0x69')](-0x1);if(_0x2b7981==='/'){_0x179ba6=_0x179ba6[_0xb9ad('0x6a')](0x0,_0x179ba6[_0xb9ad('0x6b')](_0x2b7981));}return rp({'method':_0xb9ad('0x6c'),'uri':util[_0xb9ad('0x6d')](_0xb9ad('0x6e'),_0x179ba6,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xb9ad('0x6f'),'input_type':_0xb9ad('0x70'),'response_type':_0xb9ad('0x70'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4af69d[_0xb9ad('0x66')],'password':_0x4af69d[_0xb9ad('0x67')],'encryption':_0xb9ad('0x71')},'application':_0xb9ad('0x72')})}});}})[_0xb9ad('0x16')](function(_0x4b569c){if(_0x4b569c&&_0x4b569c[_0xb9ad('0x2d')]!==_0xb9ad('0x73')&&_0x4b569c[_0xb9ad('0x2d')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0xb9ad('0x6d')](_0xb9ad('0x6e'),_0x179ba6,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xb9ad('0x74'),'input_type':_0xb9ad('0x70'),'response_type':_0xb9ad('0x70'),'rest_data':JSON['stringify']({'session':_0x4b569c['id'],'module_name':_0xb9ad('0x75')})}})[_0xb9ad('0x16')](function(_0x41760d){if(_0x41760d){var _0x5a0606=_[_0xb9ad('0x76')](_0x41760d[_0xb9ad('0x77')]);_[_0xb9ad('0x78')](_0x5a0606,function(_0x36d548){return _0x409390['includes'](_0x36d548['name']);});return{'count':_0x5a0606[_0xb9ad('0x4d')],'rows':_[_0xb9ad('0x30')](_0x5a0606,function(_0x103dd4){return{'id':_0x103dd4[_0xb9ad('0x2d')],'name':_0x103dd4[_0xb9ad('0x79')],'custom':_[_0xb9ad('0x7a')](_0x103dd4['name'],'_c')?!![]:![],'options':_0x103dd4['options']?_[_0xb9ad('0x30')](_['values'](_0x103dd4[_0xb9ad('0x43')]),function(_0x45ad3d){return{'name':_0x45ad3d[_0xb9ad('0x7b')],'value':_0x45ad3d[_0xb9ad('0x2d')]};}):[]};})};}})['then'](respondWithResult(_0x2f59ee,null))[_0xb9ad('0x48')](function(_0x3653a2){var _0xd0b8a1=_0x106915[_0xb9ad('0x36')][_0xb9ad('0x7c')]?0x1f4:_0x3653a2[_0xb9ad('0x7d')]||0x1f4;logger[_0xb9ad('0x1d')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xd0b8a1,JSON[_0xb9ad('0x1c')](_0x3653a2));delete _0x3653a2[_0xb9ad('0x2d')];if(_0xd0b8a1===0x191){_0xd0b8a1=0x190;}_0x2f59ee[_0xb9ad('0x21')](_0xd0b8a1)['send'](_0x106915[_0xb9ad('0x36')][_0xb9ad('0x7c')]?{'message':_0xb9ad('0x7e'),'statusCode':_0x3653a2['statusCode']}:_0x3653a2);});}else{var _0x25e9ff=0x1f4;_0x2f59ee[_0xb9ad('0x21')](_0x25e9ff)['send']({'message':_0xb9ad('0x7e'),'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 7c5332a..0890535 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 _0xa248=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa248,0x1eb));var _0x8a24=function(_0x12e4a6,_0x11b4e0){_0x12e4a6=_0x12e4a6-0x0;var _0x426c47=_0xa248[_0x12e4a6];return _0x426c47;};'use strict';var _=require(_0x8a24('0x0'));var util=require('util');var logger=require(_0x8a24('0x1'))(_0x8a24('0x2'));var moment=require(_0x8a24('0x3'));var BPromise=require(_0x8a24('0x4'));var rp=require(_0x8a24('0x5'));var fs=require('fs');var path=require(_0x8a24('0x6'));var rimraf=require(_0x8a24('0x7'));var config=require(_0x8a24('0x8'));var attributes=require(_0x8a24('0x9'));var integrations=require(_0x8a24('0xa'));module[_0x8a24('0xb')]=function(_0x180ee4,_0x29d5fd){return _0x180ee4[_0x8a24('0xc')](_0x8a24('0xd'),attributes,{'tableName':_0x8a24('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d4d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','define','SugarcrmAccount'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x3d4d,0x198));var _0xd3d4=function(_0x49e913,_0x14dbe3){_0x49e913=_0x49e913-0x0;var _0x3f9f12=_0x3d4d[_0x49e913];return _0x3f9f12;};'use strict';var _=require('lodash');var util=require(_0xd3d4('0x0'));var logger=require(_0xd3d4('0x1'))(_0xd3d4('0x2'));var moment=require(_0xd3d4('0x3'));var BPromise=require(_0xd3d4('0x4'));var rp=require(_0xd3d4('0x5'));var fs=require('fs');var path=require(_0xd3d4('0x6'));var rimraf=require(_0xd3d4('0x7'));var config=require(_0xd3d4('0x8'));var attributes=require(_0xd3d4('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2b9f98,_0x5765ae){return _0x2b9f98[_0xd3d4('0xa')](_0xd3d4('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index d65b4e3..89d5b4d 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 _0x7517=['options','where','attributes','limit','include','map','model','ShowSugarcrmAccount','find','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SugarcrmAccount,\x20%s,\x20%s','catch','GetSugarcrmAccount','SugarcrmAccount','findAll'];(function(_0x399235,_0x47edfb){var _0x1c35f9=function(_0x45e5f6){while(--_0x45e5f6){_0x399235['push'](_0x399235['shift']());}};_0x1c35f9(++_0x47edfb);}(_0x7517,0x18b));var _0x7751=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7517[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x7751('0x0'));var util=require(_0x7751('0x1'));var moment=require(_0x7751('0x2'));var BPromise=require(_0x7751('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7751('0x4'));var db=require(_0x7751('0x5'))['db'];var utils=require(_0x7751('0x6'));var logger=require(_0x7751('0x7'))(_0x7751('0x8'));var config=require(_0x7751('0x9'));var jayson=require(_0x7751('0xa'));var client=jayson['client'][_0x7751('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17719e,_0x27229d,_0x44e676){return new BPromise(function(_0x5da2ae,_0x4465be){return client[_0x7751('0xc')](_0x17719e,_0x44e676)['then'](function(_0x31edab){logger[_0x7751('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x27229d,_0x7751('0xe'));logger[_0x7751('0xf')](_0x7751('0x10'),_0x27229d,_0x7751('0xe'),JSON[_0x7751('0x11')](_0x31edab));if(_0x31edab[_0x7751('0x12')]){if(_0x31edab[_0x7751('0x12')]['code']===0x1f4){logger[_0x7751('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x27229d,_0x31edab[_0x7751('0x12')][_0x7751('0x13')]);return _0x4465be(_0x31edab[_0x7751('0x12')]['message']);}logger['error'](_0x7751('0x14'),_0x27229d,_0x31edab[_0x7751('0x12')]['message']);return _0x5da2ae(_0x31edab[_0x7751('0x12')][_0x7751('0x13')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x27229d,'request\x20sent');_0x5da2ae(_0x31edab['result']['message']);}})[_0x7751('0x15')](function(_0x59094c){logger[_0x7751('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x27229d,_0x59094c);_0x4465be(_0x59094c);});});}exports[_0x7751('0x16')]=function(_0x39a6b6){var _0x5d6bd9=this;return new Promise(function(_0x386257,_0x3577ed){return db[_0x7751('0x17')][_0x7751('0x18')]({'raw':_0x39a6b6[_0x7751('0x19')]?_0x39a6b6[_0x7751('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x39a6b6['options']?_0x39a6b6['options'][_0x7751('0x1a')]||null:null,'attributes':_0x39a6b6[_0x7751('0x19')]?_0x39a6b6[_0x7751('0x19')][_0x7751('0x1b')]||null:null,'limit':_0x39a6b6[_0x7751('0x19')]?_0x39a6b6[_0x7751('0x19')][_0x7751('0x1c')]||null:null,'include':_0x39a6b6[_0x7751('0x19')]?_0x39a6b6[_0x7751('0x19')][_0x7751('0x1d')]?_[_0x7751('0x1e')](_0x39a6b6[_0x7751('0x19')][_0x7751('0x1d')],function(_0x25228f){return{'model':db[_0x25228f[_0x7751('0x1f')]],'as':_0x25228f['as'],'attributes':_0x25228f[_0x7751('0x1b')],'include':_0x25228f['include']?_[_0x7751('0x1e')](_0x25228f[_0x7751('0x1d')],function(_0x36b9a5){return{'model':db[_0x36b9a5['model']],'as':_0x36b9a5['as'],'attributes':_0x36b9a5[_0x7751('0x1b')],'include':_0x36b9a5[_0x7751('0x1d')]?_['map'](_0x36b9a5[_0x7751('0x1d')],function(_0x37fe0c){return{'model':db[_0x37fe0c[_0x7751('0x1f')]],'as':_0x37fe0c['as'],'attributes':_0x37fe0c[_0x7751('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x481576){logger[_0x7751('0xd')](_0x7751('0x16'),_0x39a6b6);logger[_0x7751('0xf')](_0x7751('0x16'),_0x39a6b6,JSON['stringify'](_0x481576));_0x386257(_0x481576);})[_0x7751('0x15')](function(_0x36e498){logger[_0x7751('0x12')](_0x7751('0x16'),_0x36e498[_0x7751('0x13')],_0x39a6b6);_0x3577ed(_0x5d6bd9[_0x7751('0x12')](0x1f4,_0x36e498[_0x7751('0x13')]));});});};exports[_0x7751('0x20')]=function(_0x4d938e){var _0x36d4e2=this;return new Promise(function(_0x3779dd,_0x4e336c){return db[_0x7751('0x17')][_0x7751('0x21')]({'raw':_0x4d938e['options']?_0x4d938e['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d938e[_0x7751('0x19')]?_0x4d938e[_0x7751('0x19')]['where']||null:null,'attributes':_0x4d938e[_0x7751('0x19')]?_0x4d938e[_0x7751('0x19')][_0x7751('0x1b')]||null:null,'include':_0x4d938e[_0x7751('0x19')]?_0x4d938e[_0x7751('0x19')][_0x7751('0x1d')]?_['map'](_0x4d938e[_0x7751('0x19')]['include'],function(_0x18ffa8){return{'model':db[_0x18ffa8[_0x7751('0x1f')]],'as':_0x18ffa8['as'],'attributes':_0x18ffa8['attributes'],'include':_0x18ffa8[_0x7751('0x1d')]?_[_0x7751('0x1e')](_0x18ffa8['include'],function(_0xd07f3c){return{'model':db[_0xd07f3c[_0x7751('0x1f')]],'as':_0xd07f3c['as'],'attributes':_0xd07f3c[_0x7751('0x1b')],'include':_0xd07f3c['include']?_[_0x7751('0x1e')](_0xd07f3c[_0x7751('0x1d')],function(_0x3e789b){return{'model':db[_0x3e789b['model']],'as':_0x3e789b['as'],'attributes':_0x3e789b[_0x7751('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7751('0x22')](function(_0x2107a7){logger['info']('ShowSugarcrmAccount',_0x4d938e);logger['debug'](_0x7751('0x20'),_0x4d938e,JSON[_0x7751('0x11')](_0x2107a7));_0x3779dd(_0x2107a7);})[_0x7751('0x15')](function(_0x1fe9a4){logger[_0x7751('0x12')](_0x7751('0x20'),_0x1fe9a4[_0x7751('0x13')],_0x4d938e);_0x4e336c(_0x36d4e2[_0x7751('0x12')](0x1f4,_0x1fe9a4['message']));});});}; \ No newline at end of file +var _0x38c8=['message','result','catch','GetSugarcrmAccount','findAll','options','where','attributes','limit','include','map','model','ShowSugarcrmAccount','raw','info','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5a9810,_0x1827f7){var _0x4ee4df=function(_0xbae215){while(--_0xbae215){_0x5a9810['push'](_0x5a9810['shift']());}};_0x4ee4df(++_0x1827f7);}(_0x38c8,0x16f));var _0x838c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x38c8[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x838c('0x0'));var util=require('util');var moment=require(_0x838c('0x1'));var BPromise=require('bluebird');var rs=require(_0x838c('0x2'));var fs=require('fs');var Redis=require(_0x838c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x838c('0x4'));var logger=require(_0x838c('0x5'))('rpc');var config=require(_0x838c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x838c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16dd0a,_0x3f109b,_0x332f1c){return new BPromise(function(_0x58d235,_0x3dd148){return client[_0x838c('0x8')](_0x16dd0a,_0x332f1c)[_0x838c('0x9')](function(_0x35fb15){logger['info'](_0x838c('0xa'),_0x3f109b,_0x838c('0xb'));logger[_0x838c('0xc')](_0x838c('0xd'),_0x3f109b,_0x838c('0xb'),JSON[_0x838c('0xe')](_0x35fb15));if(_0x35fb15['error']){if(_0x35fb15[_0x838c('0xf')][_0x838c('0x10')]===0x1f4){logger[_0x838c('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x3f109b,_0x35fb15[_0x838c('0xf')][_0x838c('0x11')]);return _0x3dd148(_0x35fb15[_0x838c('0xf')][_0x838c('0x11')]);}logger[_0x838c('0xf')](_0x838c('0xa'),_0x3f109b,_0x35fb15[_0x838c('0xf')][_0x838c('0x11')]);return _0x58d235(_0x35fb15[_0x838c('0xf')][_0x838c('0x11')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x3f109b,'request\x20sent');_0x58d235(_0x35fb15[_0x838c('0x12')][_0x838c('0x11')]);}})[_0x838c('0x13')](function(_0x4e275d){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x3f109b,_0x4e275d);_0x3dd148(_0x4e275d);});});}exports[_0x838c('0x14')]=function(_0xe06b12){var _0x1f2a4f=this;return new Promise(function(_0x523843,_0x1015c5){return db['SugarcrmAccount'][_0x838c('0x15')]({'raw':_0xe06b12[_0x838c('0x16')]?_0xe06b12['options']['raw']===undefined?!![]:![]:!![],'where':_0xe06b12[_0x838c('0x16')]?_0xe06b12[_0x838c('0x16')][_0x838c('0x17')]||null:null,'attributes':_0xe06b12['options']?_0xe06b12[_0x838c('0x16')][_0x838c('0x18')]||null:null,'limit':_0xe06b12[_0x838c('0x16')]?_0xe06b12['options'][_0x838c('0x19')]||null:null,'include':_0xe06b12[_0x838c('0x16')]?_0xe06b12['options'][_0x838c('0x1a')]?_[_0x838c('0x1b')](_0xe06b12['options'][_0x838c('0x1a')],function(_0x5d5604){return{'model':db[_0x5d5604['model']],'as':_0x5d5604['as'],'attributes':_0x5d5604['attributes'],'include':_0x5d5604[_0x838c('0x1a')]?_['map'](_0x5d5604['include'],function(_0x45a6fb){return{'model':db[_0x45a6fb[_0x838c('0x1c')]],'as':_0x45a6fb['as'],'attributes':_0x45a6fb[_0x838c('0x18')],'include':_0x45a6fb['include']?_[_0x838c('0x1b')](_0x45a6fb['include'],function(_0x25256e){return{'model':db[_0x25256e[_0x838c('0x1c')]],'as':_0x25256e['as'],'attributes':_0x25256e[_0x838c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x838c('0x9')](function(_0x548e71){logger['info'](_0x838c('0x14'),_0xe06b12);logger[_0x838c('0xc')](_0x838c('0x14'),_0xe06b12,JSON[_0x838c('0xe')](_0x548e71));_0x523843(_0x548e71);})['catch'](function(_0x449241){logger[_0x838c('0xf')](_0x838c('0x14'),_0x449241[_0x838c('0x11')],_0xe06b12);_0x1015c5(_0x1f2a4f[_0x838c('0xf')](0x1f4,_0x449241[_0x838c('0x11')]));});});};exports[_0x838c('0x1d')]=function(_0x326874){var _0x3d9918=this;return new Promise(function(_0x1e4bee,_0x5522e1){return db['SugarcrmAccount']['find']({'raw':_0x326874[_0x838c('0x16')]?_0x326874[_0x838c('0x16')][_0x838c('0x1e')]===undefined?!![]:![]:!![],'where':_0x326874['options']?_0x326874[_0x838c('0x16')]['where']||null:null,'attributes':_0x326874[_0x838c('0x16')]?_0x326874['options']['attributes']||null:null,'include':_0x326874[_0x838c('0x16')]?_0x326874[_0x838c('0x16')][_0x838c('0x1a')]?_['map'](_0x326874['options'][_0x838c('0x1a')],function(_0x2fa8f0){return{'model':db[_0x2fa8f0[_0x838c('0x1c')]],'as':_0x2fa8f0['as'],'attributes':_0x2fa8f0[_0x838c('0x18')],'include':_0x2fa8f0[_0x838c('0x1a')]?_[_0x838c('0x1b')](_0x2fa8f0['include'],function(_0xa9c44f){return{'model':db[_0xa9c44f['model']],'as':_0xa9c44f['as'],'attributes':_0xa9c44f[_0x838c('0x18')],'include':_0xa9c44f[_0x838c('0x1a')]?_[_0x838c('0x1b')](_0xa9c44f['include'],function(_0x166910){return{'model':db[_0x166910['model']],'as':_0x166910['as'],'attributes':_0x166910[_0x838c('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bed4c){logger[_0x838c('0x1f')](_0x838c('0x1d'),_0x326874);logger[_0x838c('0xc')](_0x838c('0x1d'),_0x326874,JSON[_0x838c('0xe')](_0x2bed4c));_0x1e4bee(_0x2bed4c);})['catch'](function(_0x4e1a89){logger[_0x838c('0xf')](_0x838c('0x1d'),_0x4e1a89[_0x838c('0x11')],_0x326874);_0x5522e1(_0x3d9918[_0x838c('0xf')](0x1f4,_0x4e1a89['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 9d29b0f..c299caf 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 _0xc3f2=['Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','isAuthenticated','get','/:id/fields','getFields','getSubjects','getDescriptions','post','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x9e66e5,_0x16c53f){var _0x307b74=function(_0xb8bdbc){while(--_0xb8bdbc){_0x9e66e5['push'](_0x9e66e5['shift']());}};_0x307b74(++_0x16c53f);}(_0xc3f2,0xec));var _0x2c3f=function(_0x1b2155,_0xca6a0e){_0x1b2155=_0x1b2155-0x0;var _0x42352f=_0xc3f2[_0x1b2155];return _0x42352f;};'use strict';var multer=require(_0x2c3f('0x0'));var util=require('util');var path=require(_0x2c3f('0x1'));var timeout=require(_0x2c3f('0x2'));var express=require(_0x2c3f('0x3'));var router=express[_0x2c3f('0x4')]();var auth=require(_0x2c3f('0x5'));var interaction=require(_0x2c3f('0x6'));var config=require('../../config/environment');var controller=require(_0x2c3f('0x7'));router['get']('/',auth[_0x2c3f('0x8')](),controller['index']);router[_0x2c3f('0x9')]('/:id',auth[_0x2c3f('0x8')](),controller['show']);router[_0x2c3f('0x9')](_0x2c3f('0xa'),auth[_0x2c3f('0x8')](),controller[_0x2c3f('0xb')]);router[_0x2c3f('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x2c3f('0xc')]);router[_0x2c3f('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x2c3f('0xd')]);router[_0x2c3f('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2c3f('0xf')](_0x2c3f('0x10'),auth[_0x2c3f('0x8')](),controller['update']);router[_0x2c3f('0x11')](_0x2c3f('0x10'),auth[_0x2c3f('0x8')](),controller[_0x2c3f('0x12')]);module[_0x2c3f('0x13')]=router; \ No newline at end of file +var _0x1763=['/:id/descriptions','getDescriptions','post','update','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/subjects'];(function(_0x2c1b3b,_0xfb61cf){var _0x571c6c=function(_0x95bacb){while(--_0x95bacb){_0x2c1b3b['push'](_0x2c1b3b['shift']());}};_0x571c6c(++_0xfb61cf);}(_0x1763,0x14a));var _0x3176=function(_0x54cefb,_0x192225){_0x54cefb=_0x54cefb-0x0;var _0x5e4fbb=_0x1763[_0x54cefb];return _0x5e4fbb;};'use strict';var multer=require(_0x3176('0x0'));var util=require(_0x3176('0x1'));var path=require(_0x3176('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3176('0x3')]();var auth=require(_0x3176('0x4'));var interaction=require(_0x3176('0x5'));var config=require(_0x3176('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x3176('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3176('0x7')]('/:id',auth[_0x3176('0x8')](),controller['show']);router[_0x3176('0x7')]('/:id/fields',auth[_0x3176('0x8')](),controller['getFields']);router[_0x3176('0x7')](_0x3176('0x9'),auth[_0x3176('0x8')](),controller['getSubjects']);router[_0x3176('0x7')](_0x3176('0xa'),auth[_0x3176('0x8')](),controller[_0x3176('0xb')]);router[_0x3176('0xc')]('/',auth[_0x3176('0x8')](),controller['create']);router['put']('/:id',auth[_0x3176('0x8')](),controller[_0x3176('0xd')]);router[_0x3176('0xe')](_0x3176('0xf'),auth[_0x3176('0x8')](),controller[_0x3176('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 1d8fe80..77938c2 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 _0x1ed7=['STRING','exports'];(function(_0x1eb71c,_0x57780a){var _0x1ab868=function(_0x595976){while(--_0x595976){_0x1eb71c['push'](_0x1eb71c['shift']());}};_0x1ab868(++_0x57780a);}(_0x1ed7,0x193));var _0x71ed=function(_0x3f919b,_0x51d5fa){_0x3f919b=_0x3f919b-0x0;var _0xe0b2e=_0x1ed7[_0x3f919b];return _0xe0b2e;};'use strict';var Sequelize=require('sequelize');module[_0x71ed('0x0')]={'name':{'type':Sequelize[_0x71ed('0x1')]},'description':{'type':Sequelize[_0x71ed('0x1')]}}; \ No newline at end of file +var _0xec36=['exports','STRING'];(function(_0x13da36,_0x452a8c){var _0x4e9813=function(_0x122950){while(--_0x122950){_0x13da36['push'](_0x13da36['shift']());}};_0x4e9813(++_0x452a8c);}(_0xec36,0x100));var _0x6ec3=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xec36[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require('sequelize');module[_0x6ec3('0x0')]={'name':{'type':Sequelize[_0x6ec3('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 97f5ef4..3bbadad 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 _0xa7e6=['length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','rawAttributes','filters','options','create','body','find','getFields','findOne','params','getSubjects','SugarcrmField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','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/utils','../../config/environment','../../mysqldb','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','update','destroy','stack','name','send','map','SugarcrmConfiguration','type','key','model','query','keys','intersection','fields','attributes'];(function(_0x5c3f81,_0x5ac202){var _0x332c44=function(_0x5c2673){while(--_0x5c2673){_0x5c3f81['push'](_0x5c3f81['shift']());}};_0x332c44(++_0x5ac202);}(_0xa7e6,0x1e1));var _0x6a7e=function(_0x494160,_0xadfa3f){_0x494160=_0x494160-0x0;var _0x5934b2=_0xa7e6[_0x494160];return _0x5934b2;};'use strict';var pdf=require(_0x6a7e('0x0'));var emlformat=require(_0x6a7e('0x1'));var rimraf=require(_0x6a7e('0x2'));var zipdir=require(_0x6a7e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a7e('0x4'));var moment=require(_0x6a7e('0x5'));var BPromise=require(_0x6a7e('0x6'));var Mustache=require(_0x6a7e('0x7'));var util=require(_0x6a7e('0x8'));var path=require(_0x6a7e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6a7e('0xa'));var fs=require('fs');var _=require(_0x6a7e('0xb'));var squel=require(_0x6a7e('0xc'));var crypto=require('crypto');var jsforce=require(_0x6a7e('0xd'));var deskjs=require(_0x6a7e('0xe'));var toCsv=require(_0x6a7e('0xf'));var querystring=require(_0x6a7e('0x10'));var Papa=require(_0x6a7e('0x11'));var Redis=require(_0x6a7e('0x12'));var authService=require(_0x6a7e('0x13'));var qs=require(_0x6a7e('0x14'));var as=require(_0x6a7e('0x15'));var hardwareService=require(_0x6a7e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x6a7e('0x17'));var config=require(_0x6a7e('0x18'));var db=require(_0x6a7e('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x6a7e('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4a4cfd,_0x1f4e7c,_0x362c99){if(_0x362c99){var _0x3e78be=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e78be[_0x6a7e('0x1b')](_0x1f4e7c)){return _0x4a4cfd;}else{throw new db[(_0x6a7e('0x1c'))]['ValidationError'](_0x6a7e('0x1d'));}}else{return _0x4a4cfd;}}function respondWithRpcPromise(_0x3ed239,_0x116ea3,_0x5e9f3a,_0x53a7fd){return new BPromise(function(_0x736066,_0x7981d1){var _0x48ddbc=_0x53a7fd||client;return _0x48ddbc[_0x6a7e('0x1e')](_0x3ed239,_0x5e9f3a)[_0x6a7e('0x1f')](function(_0x1e91f5){logger[_0x6a7e('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x116ea3,_0x6a7e('0x21'));logger[_0x6a7e('0x22')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x116ea3,'request\x20sent',JSON[_0x6a7e('0x23')](_0x1e91f5));if(_0x1e91f5[_0x6a7e('0x24')]){if(_0x1e91f5[_0x6a7e('0x24')][_0x6a7e('0x25')]===0x1f4){logger['error'](_0x6a7e('0x26'),_0x116ea3,_0x1e91f5[_0x6a7e('0x24')][_0x6a7e('0x27')]);return _0x7981d1(_0x1e91f5[_0x6a7e('0x24')]['message']);}logger[_0x6a7e('0x24')](_0x6a7e('0x26'),_0x116ea3,_0x1e91f5['error']['message']);return _0x736066(_0x1e91f5['error'][_0x6a7e('0x27')]);}else{logger[_0x6a7e('0x20')](_0x6a7e('0x26'),_0x116ea3,_0x6a7e('0x21'));_0x736066(_0x1e91f5['result'][_0x6a7e('0x27')]);}})[_0x6a7e('0x28')](function(_0x2dc4f7){logger[_0x6a7e('0x24')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x116ea3,_0x2dc4f7);_0x7981d1(_0x2dc4f7);});});}function respondWithStatusCode(_0x2f5e46,_0x6963a8){_0x6963a8=_0x6963a8||0xcc;return function(_0x4ff50e){if(_0x4ff50e){return _0x2f5e46[_0x6a7e('0x29')](_0x6963a8);}return _0x2f5e46[_0x6a7e('0x2a')](_0x6963a8)[_0x6a7e('0x2b')]();};}function respondWithResult(_0x2e61e5,_0x5cd3ff){_0x5cd3ff=_0x5cd3ff||0xc8;return function(_0x3f5f82){if(_0x3f5f82){return _0x2e61e5[_0x6a7e('0x2a')](_0x5cd3ff)[_0x6a7e('0x2c')](_0x3f5f82);}};}function respondWithFilteredResult(_0x53b257,_0x322638){return function(_0x553f82){if(_0x553f82){var _0x57c0fd=_0x553f82[_0x6a7e('0x2d')],_0x459d9f=_0x322638[_0x6a7e('0x2e')],_0x21007f=_0x322638['offset']+_0x322638['limit'],_0x244d69;if(_0x21007f>=_0x57c0fd){_0x21007f=_0x57c0fd;_0x244d69=0xc8;}else{_0x244d69=0xce;}_0x53b257[_0x6a7e('0x2a')](_0x244d69);return _0x53b257[_0x6a7e('0x2f')](_0x6a7e('0x30'),_0x459d9f+'-'+_0x21007f+'/'+_0x57c0fd)[_0x6a7e('0x2c')](_0x553f82);}return null;};}function patchUpdates(_0x3359de){return function(_0x1bfce7){try{jsonpatch['apply'](_0x1bfce7,_0x3359de,!![]);}catch(_0x5a8dd3){return BPromise[_0x6a7e('0x31')](_0x5a8dd3);}return _0x1bfce7['save']();};}function saveUpdates(_0x20daae,_0x454a69){return function(_0x1d9ef0){if(_0x1d9ef0){return _0x1d9ef0[_0x6a7e('0x32')](_0x20daae)['then'](function(_0x32f2f8){return _0x32f2f8;});}return null;};}function removeEntity(_0x31e77b,_0x29613e){return function(_0x3d8dd6){if(_0x3d8dd6){return _0x3d8dd6[_0x6a7e('0x33')]()['then'](function(){_0x31e77b[_0x6a7e('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3796a4,_0x5e34de){return function(_0xdb7028){if(!_0xdb7028){_0x3796a4[_0x6a7e('0x29')](0x194);}return _0xdb7028;};}function handleError(_0x375886,_0x5371be){_0x5371be=_0x5371be||0x1f4;return function(_0xc5dedc){logger[_0x6a7e('0x24')](_0xc5dedc[_0x6a7e('0x34')]);if(_0xc5dedc[_0x6a7e('0x35')]){delete _0xc5dedc[_0x6a7e('0x35')];}_0x375886[_0x6a7e('0x2a')](_0x5371be)[_0x6a7e('0x36')](_0xc5dedc);};}exports['index']=function(_0x4b6c51,_0x58a124){var _0x1dcf76={},_0x5c02de={},_0x483b4b={'count':0x0,'rows':[]};var _0x280fe6=_[_0x6a7e('0x37')](db[_0x6a7e('0x38')]['rawAttributes'],function(_0x3eb4e4){return{'name':_0x3eb4e4['fieldName'],'type':_0x3eb4e4[_0x6a7e('0x39')][_0x6a7e('0x3a')]};});_0x5c02de[_0x6a7e('0x3b')]=_[_0x6a7e('0x37')](_0x280fe6,'name');_0x5c02de[_0x6a7e('0x3c')]=_[_0x6a7e('0x3d')](_0x4b6c51[_0x6a7e('0x3c')]);_0x5c02de['filters']=_[_0x6a7e('0x3e')](_0x5c02de['model'],_0x5c02de[_0x6a7e('0x3c')]);_0x1dcf76['attributes']=_[_0x6a7e('0x3e')](_0x5c02de[_0x6a7e('0x3b')],qs['fields'](_0x4b6c51[_0x6a7e('0x3c')][_0x6a7e('0x3f')]));_0x1dcf76['attributes']=_0x1dcf76[_0x6a7e('0x40')][_0x6a7e('0x41')]?_0x1dcf76['attributes']:_0x5c02de[_0x6a7e('0x3b')];if(!_0x4b6c51[_0x6a7e('0x3c')][_0x6a7e('0x42')](_0x6a7e('0x43'))){_0x1dcf76[_0x6a7e('0x44')]=qs[_0x6a7e('0x44')](_0x4b6c51[_0x6a7e('0x3c')]['limit']);_0x1dcf76[_0x6a7e('0x2e')]=qs[_0x6a7e('0x2e')](_0x4b6c51[_0x6a7e('0x3c')]['offset']);}_0x1dcf76[_0x6a7e('0x45')]=qs[_0x6a7e('0x46')](_0x4b6c51[_0x6a7e('0x3c')][_0x6a7e('0x46')]);_0x1dcf76['where']=qs['filters'](_[_0x6a7e('0x47')](_0x4b6c51[_0x6a7e('0x3c')],_0x5c02de['filters']),_0x280fe6);if(_0x4b6c51[_0x6a7e('0x3c')][_0x6a7e('0x48')]){_0x1dcf76[_0x6a7e('0x49')]=_[_0x6a7e('0x4a')](_0x1dcf76[_0x6a7e('0x49')],{'$or':_[_0x6a7e('0x37')](_0x280fe6,function(_0x2f3ea0){if(_0x2f3ea0['type']!==_0x6a7e('0x4b')){var _0x25cf8c={};_0x25cf8c[_0x2f3ea0['name']]={'$like':'%'+_0x4b6c51[_0x6a7e('0x3c')][_0x6a7e('0x48')]+'%'};return _0x25cf8c;}})});}_0x1dcf76=_[_0x6a7e('0x4a')]({},_0x1dcf76,_0x4b6c51['options']);var _0x5d5872={'where':_0x1dcf76[_0x6a7e('0x49')]};return db['SugarcrmConfiguration'][_0x6a7e('0x2d')](_0x5d5872)['then'](function(_0x31a23f){_0x483b4b[_0x6a7e('0x2d')]=_0x31a23f;if(_0x4b6c51[_0x6a7e('0x3c')][_0x6a7e('0x4c')]){_0x1dcf76[_0x6a7e('0x4d')]=[{'all':!![]}];}return db[_0x6a7e('0x38')]['findAll'](_0x1dcf76);})['then'](function(_0x4da18f){_0x483b4b[_0x6a7e('0x4e')]=_0x4da18f;return _0x483b4b;})[_0x6a7e('0x1f')](respondWithFilteredResult(_0x58a124,_0x1dcf76))['catch'](handleError(_0x58a124,null));};exports['show']=function(_0x3eac32,_0x5f26b4){var _0x22418b={'raw':![],'where':{'id':_0x3eac32['params']['id']}},_0x230937={};_0x230937[_0x6a7e('0x3b')]=_[_0x6a7e('0x3d')](db[_0x6a7e('0x38')][_0x6a7e('0x4f')]);_0x230937[_0x6a7e('0x3c')]=_['keys'](_0x3eac32[_0x6a7e('0x3c')]);_0x230937[_0x6a7e('0x50')]=_['intersection'](_0x230937[_0x6a7e('0x3b')],_0x230937[_0x6a7e('0x3c')]);_0x22418b['attributes']=_[_0x6a7e('0x3e')](_0x230937['model'],qs['fields'](_0x3eac32[_0x6a7e('0x3c')][_0x6a7e('0x3f')]));_0x22418b[_0x6a7e('0x40')]=_0x22418b[_0x6a7e('0x40')]['length']?_0x22418b[_0x6a7e('0x40')]:_0x230937['model'];if(_0x3eac32['query'][_0x6a7e('0x4c')]){_0x22418b[_0x6a7e('0x4d')]=[{'all':!![]}];}_0x22418b=_[_0x6a7e('0x4a')]({},_0x22418b,_0x3eac32[_0x6a7e('0x51')]);return db['SugarcrmConfiguration']['find'](_0x22418b)[_0x6a7e('0x1f')](handleEntityNotFound(_0x5f26b4,null))['then'](respondWithResult(_0x5f26b4,null))[_0x6a7e('0x28')](handleError(_0x5f26b4,null));};exports[_0x6a7e('0x52')]=function(_0x72e5ae,_0x1b0fb9){return db[_0x6a7e('0x38')]['create'](_0x72e5ae['body'],{})[_0x6a7e('0x1f')](respondWithResult(_0x1b0fb9,0xc9))[_0x6a7e('0x28')](handleError(_0x1b0fb9,null));};exports[_0x6a7e('0x32')]=function(_0x13f655,_0x464a2c){if(_0x13f655['body']['id']){delete _0x13f655[_0x6a7e('0x53')]['id'];}return db[_0x6a7e('0x38')]['find']({'where':{'id':_0x13f655['params']['id']}})[_0x6a7e('0x1f')](handleEntityNotFound(_0x464a2c,null))[_0x6a7e('0x1f')](saveUpdates(_0x13f655[_0x6a7e('0x53')],null))['then'](respondWithResult(_0x464a2c,null))[_0x6a7e('0x28')](handleError(_0x464a2c,null));};exports[_0x6a7e('0x33')]=function(_0x1ec33f,_0x56068f){return db[_0x6a7e('0x38')][_0x6a7e('0x54')]({'where':{'id':_0x1ec33f['params']['id']}})['then'](handleEntityNotFound(_0x56068f,null))[_0x6a7e('0x1f')](removeEntity(_0x56068f,null))[_0x6a7e('0x28')](handleError(_0x56068f,null));};exports[_0x6a7e('0x55')]=function(_0x511c68,_0x32eeb7,_0x5d8b4e){var _0x2de8de={};var _0x39f493={};var _0x106dc0;var _0x46d384;return db[_0x6a7e('0x38')][_0x6a7e('0x56')]({'where':{'id':_0x511c68[_0x6a7e('0x57')]['id']}})['then'](handleEntityNotFound(_0x32eeb7,null))[_0x6a7e('0x1f')](function(_0x576316){if(_0x576316){_0x106dc0=_0x576316;_0x39f493['model']=_[_0x6a7e('0x3d')](db['SugarcrmField']['rawAttributes']);_0x39f493[_0x6a7e('0x3c')]=_[_0x6a7e('0x3d')](_0x511c68['query']);_0x39f493[_0x6a7e('0x50')]=_['intersection'](_0x39f493[_0x6a7e('0x3b')],_0x39f493['query']);_0x2de8de[_0x6a7e('0x40')]=_[_0x6a7e('0x3e')](_0x39f493[_0x6a7e('0x3b')],qs[_0x6a7e('0x3f')](_0x511c68[_0x6a7e('0x3c')][_0x6a7e('0x3f')]));_0x2de8de['attributes']=_0x2de8de[_0x6a7e('0x40')][_0x6a7e('0x41')]?_0x2de8de[_0x6a7e('0x40')]:_0x39f493[_0x6a7e('0x3b')];_0x2de8de['order']=qs[_0x6a7e('0x46')](_0x511c68[_0x6a7e('0x3c')][_0x6a7e('0x46')]);_0x2de8de[_0x6a7e('0x49')]=qs[_0x6a7e('0x50')](_[_0x6a7e('0x47')](_0x511c68[_0x6a7e('0x3c')],_0x39f493[_0x6a7e('0x50')]));if(_0x511c68[_0x6a7e('0x3c')][_0x6a7e('0x48')]){_0x2de8de[_0x6a7e('0x49')]=_[_0x6a7e('0x4a')](_0x2de8de['where'],{'$or':_['map'](_0x2de8de[_0x6a7e('0x40')],function(_0x2e10d4){var _0x4cf4f0={};_0x4cf4f0[_0x2e10d4]={'$like':'%'+_0x511c68[_0x6a7e('0x3c')][_0x6a7e('0x48')]+'%'};return _0x4cf4f0;})});}_0x2de8de=_[_0x6a7e('0x4a')]({},_0x2de8de,_0x511c68[_0x6a7e('0x51')]);return _0x106dc0[_0x6a7e('0x55')](_0x2de8de);}})[_0x6a7e('0x1f')](function(_0x146944){if(_0x146944){_0x46d384=_0x146944[_0x6a7e('0x41')];if(!_0x511c68['query']['hasOwnProperty']('nolimit')){_0x2de8de['limit']=qs[_0x6a7e('0x44')](_0x511c68[_0x6a7e('0x3c')][_0x6a7e('0x44')]);_0x2de8de[_0x6a7e('0x2e')]=qs[_0x6a7e('0x2e')](_0x511c68['query'][_0x6a7e('0x2e')]);}return _0x106dc0['getFields'](_0x2de8de);}})[_0x6a7e('0x1f')](function(_0x5f57ba){if(_0x5f57ba){return _0x5f57ba?{'count':_0x46d384,'rows':_0x5f57ba}:null;}})['then'](respondWithResult(_0x32eeb7,null))['catch'](handleError(_0x32eeb7,null));};exports[_0x6a7e('0x58')]=function(_0x3c4aab,_0x57f8a4,_0x3f832c){var _0x880425={};var _0x138f62={};var _0x33b40a;var _0x24c216;return db[_0x6a7e('0x38')][_0x6a7e('0x56')]({'where':{'id':_0x3c4aab[_0x6a7e('0x57')]['id']}})[_0x6a7e('0x1f')](handleEntityNotFound(_0x57f8a4,null))[_0x6a7e('0x1f')](function(_0x327606){if(_0x327606){_0x33b40a=_0x327606;_0x138f62[_0x6a7e('0x3b')]=_[_0x6a7e('0x3d')](db[_0x6a7e('0x59')][_0x6a7e('0x4f')]);_0x138f62['query']=_[_0x6a7e('0x3d')](_0x3c4aab[_0x6a7e('0x3c')]);_0x138f62[_0x6a7e('0x50')]=_[_0x6a7e('0x3e')](_0x138f62[_0x6a7e('0x3b')],_0x138f62[_0x6a7e('0x3c')]);_0x880425['attributes']=_[_0x6a7e('0x3e')](_0x138f62[_0x6a7e('0x3b')],qs['fields'](_0x3c4aab[_0x6a7e('0x3c')][_0x6a7e('0x3f')]));_0x880425[_0x6a7e('0x40')]=_0x880425[_0x6a7e('0x40')][_0x6a7e('0x41')]?_0x880425[_0x6a7e('0x40')]:_0x138f62['model'];_0x880425['order']=qs[_0x6a7e('0x46')](_0x3c4aab[_0x6a7e('0x3c')][_0x6a7e('0x46')]);_0x880425['where']=qs['filters'](_[_0x6a7e('0x47')](_0x3c4aab[_0x6a7e('0x3c')],_0x138f62[_0x6a7e('0x50')]));if(_0x3c4aab[_0x6a7e('0x3c')][_0x6a7e('0x48')]){_0x880425[_0x6a7e('0x49')]=_[_0x6a7e('0x4a')](_0x880425['where'],{'$or':_[_0x6a7e('0x37')](_0x880425['attributes'],function(_0x213699){var _0x494317={};_0x494317[_0x213699]={'$like':'%'+_0x3c4aab[_0x6a7e('0x3c')][_0x6a7e('0x48')]+'%'};return _0x494317;})});}_0x880425=_[_0x6a7e('0x4a')]({},_0x880425,_0x3c4aab[_0x6a7e('0x51')]);return _0x33b40a[_0x6a7e('0x58')](_0x880425);}})[_0x6a7e('0x1f')](function(_0x5206c4){if(_0x5206c4){_0x24c216=_0x5206c4[_0x6a7e('0x41')];if(!_0x3c4aab[_0x6a7e('0x3c')][_0x6a7e('0x42')](_0x6a7e('0x43'))){_0x880425[_0x6a7e('0x44')]=qs[_0x6a7e('0x44')](_0x3c4aab[_0x6a7e('0x3c')][_0x6a7e('0x44')]);_0x880425[_0x6a7e('0x2e')]=qs[_0x6a7e('0x2e')](_0x3c4aab[_0x6a7e('0x3c')][_0x6a7e('0x2e')]);}return _0x33b40a[_0x6a7e('0x58')](_0x880425);}})[_0x6a7e('0x1f')](function(_0x4e68c9){if(_0x4e68c9){return _0x4e68c9?{'count':_0x24c216,'rows':_0x4e68c9}:null;}})[_0x6a7e('0x1f')](respondWithResult(_0x57f8a4,null))[_0x6a7e('0x28')](handleError(_0x57f8a4,null));};exports[_0x6a7e('0x5a')]=function(_0x260460,_0x4a7941,_0x3f11eb){var _0x41a922={};var _0x1d2775={};var _0x26eedf;var _0x2d8e99;return db[_0x6a7e('0x38')][_0x6a7e('0x56')]({'where':{'id':_0x260460[_0x6a7e('0x57')]['id']}})[_0x6a7e('0x1f')](handleEntityNotFound(_0x4a7941,null))[_0x6a7e('0x1f')](function(_0x292a7f){if(_0x292a7f){_0x26eedf=_0x292a7f;_0x1d2775[_0x6a7e('0x3b')]=_['keys'](db[_0x6a7e('0x59')][_0x6a7e('0x4f')]);_0x1d2775['query']=_[_0x6a7e('0x3d')](_0x260460[_0x6a7e('0x3c')]);_0x1d2775[_0x6a7e('0x50')]=_[_0x6a7e('0x3e')](_0x1d2775[_0x6a7e('0x3b')],_0x1d2775[_0x6a7e('0x3c')]);_0x41a922[_0x6a7e('0x40')]=_[_0x6a7e('0x3e')](_0x1d2775[_0x6a7e('0x3b')],qs[_0x6a7e('0x3f')](_0x260460[_0x6a7e('0x3c')]['fields']));_0x41a922['attributes']=_0x41a922[_0x6a7e('0x40')][_0x6a7e('0x41')]?_0x41a922[_0x6a7e('0x40')]:_0x1d2775[_0x6a7e('0x3b')];_0x41a922[_0x6a7e('0x45')]=qs[_0x6a7e('0x46')](_0x260460[_0x6a7e('0x3c')][_0x6a7e('0x46')]);_0x41a922[_0x6a7e('0x49')]=qs[_0x6a7e('0x50')](_[_0x6a7e('0x47')](_0x260460[_0x6a7e('0x3c')],_0x1d2775[_0x6a7e('0x50')]));if(_0x260460[_0x6a7e('0x3c')][_0x6a7e('0x48')]){_0x41a922[_0x6a7e('0x49')]=_[_0x6a7e('0x4a')](_0x41a922[_0x6a7e('0x49')],{'$or':_[_0x6a7e('0x37')](_0x41a922[_0x6a7e('0x40')],function(_0x122a19){var _0x2266cd={};_0x2266cd[_0x122a19]={'$like':'%'+_0x260460[_0x6a7e('0x3c')]['filter']+'%'};return _0x2266cd;})});}_0x41a922=_[_0x6a7e('0x4a')]({},_0x41a922,_0x260460['options']);return _0x26eedf['getDescriptions'](_0x41a922);}})[_0x6a7e('0x1f')](function(_0x246a1a){if(_0x246a1a){_0x2d8e99=_0x246a1a[_0x6a7e('0x41')];if(!_0x260460[_0x6a7e('0x3c')][_0x6a7e('0x42')]('nolimit')){_0x41a922[_0x6a7e('0x44')]=qs[_0x6a7e('0x44')](_0x260460['query'][_0x6a7e('0x44')]);_0x41a922[_0x6a7e('0x2e')]=qs[_0x6a7e('0x2e')](_0x260460[_0x6a7e('0x3c')]['offset']);}return _0x26eedf[_0x6a7e('0x5a')](_0x41a922);}})['then'](function(_0x29d2b6){if(_0x29d2b6){return _0x29d2b6?{'count':_0x2d8e99,'rows':_0x29d2b6}:null;}})['then'](respondWithResult(_0x4a7941,null))[_0x6a7e('0x28')](handleError(_0x4a7941,null));}; \ No newline at end of file +var _0xae25=['path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','Sequelize','ValidationError','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','end','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','limit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','show','options','find','create','body','params','destroy','getFields','SugarcrmField','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x109b07,_0x4df3a1){var _0x2b1add=function(_0x27e842){while(--_0x27e842){_0x109b07['push'](_0x109b07['shift']());}};_0x2b1add(++_0x4df3a1);}(_0xae25,0xbf));var _0x5ae2=function(_0x5258db,_0x1dba14){_0x5258db=_0x5258db-0x0;var _0x1dcba0=_0xae25[_0x5258db];return _0x1dcba0;};'use strict';var pdf=require(_0x5ae2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5ae2('0x1'));var zipdir=require(_0x5ae2('0x2'));var jsonpatch=require(_0x5ae2('0x3'));var rp=require(_0x5ae2('0x4'));var moment=require(_0x5ae2('0x5'));var BPromise=require(_0x5ae2('0x6'));var Mustache=require(_0x5ae2('0x7'));var util=require(_0x5ae2('0x8'));var path=require(_0x5ae2('0x9'));var sox=require(_0x5ae2('0xa'));var csv=require(_0x5ae2('0xb'));var ejs=require(_0x5ae2('0xc'));var fs=require('fs');var _=require(_0x5ae2('0xd'));var squel=require(_0x5ae2('0xe'));var crypto=require(_0x5ae2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5ae2('0x10'));var toCsv=require(_0x5ae2('0xb'));var querystring=require(_0x5ae2('0x11'));var Papa=require(_0x5ae2('0x12'));var Redis=require(_0x5ae2('0x13'));var authService=require(_0x5ae2('0x14'));var qs=require(_0x5ae2('0x15'));var as=require(_0x5ae2('0x16'));var hardwareService=require(_0x5ae2('0x17'));var logger=require(_0x5ae2('0x18'))(_0x5ae2('0x19'));var utils=require('../../config/utils');var config=require(_0x5ae2('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x5ae2('0x1b'));var client=jayson['client'][_0x5ae2('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x29b0df,_0x420215,_0x45f037){if(_0x45f037){var _0x1bdab8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1bdab8['test'](_0x420215)){return _0x29b0df;}else{throw new db[(_0x5ae2('0x1d'))][(_0x5ae2('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 _0x29b0df;}}function respondWithRpcPromise(_0x29b2d3,_0x2148a0,_0x169346,_0x1ee129){return new BPromise(function(_0x506c1a,_0x11df85){var _0x5a616f=_0x1ee129||client;return _0x5a616f[_0x5ae2('0x1f')](_0x29b2d3,_0x169346)[_0x5ae2('0x20')](function(_0x1e4144){logger[_0x5ae2('0x21')](_0x5ae2('0x22'),_0x2148a0,_0x5ae2('0x23'));logger[_0x5ae2('0x24')](_0x5ae2('0x25'),_0x2148a0,'request\x20sent',JSON[_0x5ae2('0x26')](_0x1e4144));if(_0x1e4144[_0x5ae2('0x27')]){if(_0x1e4144[_0x5ae2('0x27')][_0x5ae2('0x28')]===0x1f4){logger[_0x5ae2('0x27')](_0x5ae2('0x22'),_0x2148a0,_0x1e4144[_0x5ae2('0x27')][_0x5ae2('0x29')]);return _0x11df85(_0x1e4144['error']['message']);}logger['error'](_0x5ae2('0x22'),_0x2148a0,_0x1e4144['error']['message']);return _0x506c1a(_0x1e4144[_0x5ae2('0x27')][_0x5ae2('0x29')]);}else{logger[_0x5ae2('0x21')](_0x5ae2('0x22'),_0x2148a0,_0x5ae2('0x23'));_0x506c1a(_0x1e4144[_0x5ae2('0x2a')][_0x5ae2('0x29')]);}})[_0x5ae2('0x2b')](function(_0x1e2a76){logger[_0x5ae2('0x27')](_0x5ae2('0x22'),_0x2148a0,_0x1e2a76);_0x11df85(_0x1e2a76);});});}function respondWithStatusCode(_0x218b27,_0x2af804){_0x2af804=_0x2af804||0xcc;return function(_0x36a2a2){if(_0x36a2a2){return _0x218b27[_0x5ae2('0x2c')](_0x2af804);}return _0x218b27[_0x5ae2('0x2d')](_0x2af804)['end']();};}function respondWithResult(_0x5de3a0,_0x245877){_0x245877=_0x245877||0xc8;return function(_0x3a8097){if(_0x3a8097){return _0x5de3a0[_0x5ae2('0x2d')](_0x245877)[_0x5ae2('0x2e')](_0x3a8097);}};}function respondWithFilteredResult(_0x10ddbd,_0x3d8e17){return function(_0x3aa52f){if(_0x3aa52f){var _0x145470=_0x3aa52f[_0x5ae2('0x2f')],_0xdf398f=_0x3d8e17[_0x5ae2('0x30')],_0x307597=_0x3d8e17[_0x5ae2('0x30')]+_0x3d8e17['limit'],_0x9b1528;if(_0x307597>=_0x145470){_0x307597=_0x145470;_0x9b1528=0xc8;}else{_0x9b1528=0xce;}_0x10ddbd[_0x5ae2('0x2d')](_0x9b1528);return _0x10ddbd[_0x5ae2('0x31')](_0x5ae2('0x32'),_0xdf398f+'-'+_0x307597+'/'+_0x145470)['json'](_0x3aa52f);}return null;};}function patchUpdates(_0x14a352){return function(_0x180076){try{jsonpatch[_0x5ae2('0x33')](_0x180076,_0x14a352,!![]);}catch(_0x385c4d){return BPromise[_0x5ae2('0x34')](_0x385c4d);}return _0x180076[_0x5ae2('0x35')]();};}function saveUpdates(_0x38e24e,_0x18e8f4){return function(_0x190868){if(_0x190868){return _0x190868[_0x5ae2('0x36')](_0x38e24e)[_0x5ae2('0x20')](function(_0x46e8b2){return _0x46e8b2;});}return null;};}function removeEntity(_0x3df542,_0x33f733){return function(_0xb9ca01){if(_0xb9ca01){return _0xb9ca01['destroy']()[_0x5ae2('0x20')](function(){_0x3df542[_0x5ae2('0x2d')](0xcc)[_0x5ae2('0x37')]();});}};}function handleEntityNotFound(_0x287783,_0x553f77){return function(_0x54368e){if(!_0x54368e){_0x287783[_0x5ae2('0x2c')](0x194);}return _0x54368e;};}function handleError(_0x5a52ef,_0x35f814){_0x35f814=_0x35f814||0x1f4;return function(_0x2a8df3){logger['error'](_0x2a8df3[_0x5ae2('0x38')]);if(_0x2a8df3[_0x5ae2('0x39')]){delete _0x2a8df3[_0x5ae2('0x39')];}_0x5a52ef['status'](_0x35f814)[_0x5ae2('0x3a')](_0x2a8df3);};}exports[_0x5ae2('0x3b')]=function(_0x3b8532,_0x1f28b5){var _0x15db1c={},_0x24f3d0={},_0x355726={'count':0x0,'rows':[]};var _0x4fc628=_[_0x5ae2('0x3c')](db[_0x5ae2('0x3d')][_0x5ae2('0x3e')],function(_0x299745){return{'name':_0x299745[_0x5ae2('0x3f')],'type':_0x299745[_0x5ae2('0x40')][_0x5ae2('0x41')]};});_0x24f3d0['model']=_['map'](_0x4fc628,_0x5ae2('0x39'));_0x24f3d0[_0x5ae2('0x42')]=_[_0x5ae2('0x43')](_0x3b8532['query']);_0x24f3d0[_0x5ae2('0x44')]=_['intersection'](_0x24f3d0[_0x5ae2('0x45')],_0x24f3d0[_0x5ae2('0x42')]);_0x15db1c[_0x5ae2('0x46')]=_[_0x5ae2('0x47')](_0x24f3d0['model'],qs[_0x5ae2('0x48')](_0x3b8532[_0x5ae2('0x42')][_0x5ae2('0x48')]));_0x15db1c['attributes']=_0x15db1c[_0x5ae2('0x46')][_0x5ae2('0x49')]?_0x15db1c[_0x5ae2('0x46')]:_0x24f3d0[_0x5ae2('0x45')];if(!_0x3b8532[_0x5ae2('0x42')]['hasOwnProperty']('nolimit')){_0x15db1c[_0x5ae2('0x4a')]=qs[_0x5ae2('0x4a')](_0x3b8532[_0x5ae2('0x42')][_0x5ae2('0x4a')]);_0x15db1c[_0x5ae2('0x30')]=qs[_0x5ae2('0x30')](_0x3b8532['query'][_0x5ae2('0x30')]);}_0x15db1c[_0x5ae2('0x4b')]=qs[_0x5ae2('0x4c')](_0x3b8532[_0x5ae2('0x42')][_0x5ae2('0x4c')]);_0x15db1c['where']=qs[_0x5ae2('0x44')](_[_0x5ae2('0x4d')](_0x3b8532[_0x5ae2('0x42')],_0x24f3d0[_0x5ae2('0x44')]),_0x4fc628);if(_0x3b8532['query'][_0x5ae2('0x4e')]){_0x15db1c[_0x5ae2('0x4f')]=_['merge'](_0x15db1c[_0x5ae2('0x4f')],{'$or':_[_0x5ae2('0x3c')](_0x4fc628,function(_0x1b96b1){if(_0x1b96b1[_0x5ae2('0x40')]!==_0x5ae2('0x50')){var _0xa4737b={};_0xa4737b[_0x1b96b1['name']]={'$like':'%'+_0x3b8532[_0x5ae2('0x42')][_0x5ae2('0x4e')]+'%'};return _0xa4737b;}})});}_0x15db1c=_[_0x5ae2('0x51')]({},_0x15db1c,_0x3b8532['options']);var _0x2de17d={'where':_0x15db1c['where']};return db['SugarcrmConfiguration'][_0x5ae2('0x2f')](_0x2de17d)[_0x5ae2('0x20')](function(_0x2c72e3){_0x355726[_0x5ae2('0x2f')]=_0x2c72e3;if(_0x3b8532[_0x5ae2('0x42')][_0x5ae2('0x52')]){_0x15db1c[_0x5ae2('0x53')]=[{'all':!![]}];}return db[_0x5ae2('0x3d')][_0x5ae2('0x54')](_0x15db1c);})[_0x5ae2('0x20')](function(_0x3f1a31){_0x355726[_0x5ae2('0x55')]=_0x3f1a31;return _0x355726;})[_0x5ae2('0x20')](respondWithFilteredResult(_0x1f28b5,_0x15db1c))[_0x5ae2('0x2b')](handleError(_0x1f28b5,null));};exports[_0x5ae2('0x56')]=function(_0x4c492c,_0x261506){var _0x32fb2e={'raw':![],'where':{'id':_0x4c492c['params']['id']}},_0x36b3b9={};_0x36b3b9[_0x5ae2('0x45')]=_[_0x5ae2('0x43')](db[_0x5ae2('0x3d')][_0x5ae2('0x3e')]);_0x36b3b9['query']=_[_0x5ae2('0x43')](_0x4c492c[_0x5ae2('0x42')]);_0x36b3b9[_0x5ae2('0x44')]=_['intersection'](_0x36b3b9[_0x5ae2('0x45')],_0x36b3b9[_0x5ae2('0x42')]);_0x32fb2e['attributes']=_[_0x5ae2('0x47')](_0x36b3b9[_0x5ae2('0x45')],qs['fields'](_0x4c492c[_0x5ae2('0x42')][_0x5ae2('0x48')]));_0x32fb2e[_0x5ae2('0x46')]=_0x32fb2e[_0x5ae2('0x46')]['length']?_0x32fb2e['attributes']:_0x36b3b9[_0x5ae2('0x45')];if(_0x4c492c[_0x5ae2('0x42')]['includeAll']){_0x32fb2e[_0x5ae2('0x53')]=[{'all':!![]}];}_0x32fb2e=_[_0x5ae2('0x51')]({},_0x32fb2e,_0x4c492c[_0x5ae2('0x57')]);return db[_0x5ae2('0x3d')][_0x5ae2('0x58')](_0x32fb2e)[_0x5ae2('0x20')](handleEntityNotFound(_0x261506,null))['then'](respondWithResult(_0x261506,null))[_0x5ae2('0x2b')](handleError(_0x261506,null));};exports[_0x5ae2('0x59')]=function(_0x14036d,_0x166dc8){return db['SugarcrmConfiguration'][_0x5ae2('0x59')](_0x14036d[_0x5ae2('0x5a')],{})[_0x5ae2('0x20')](respondWithResult(_0x166dc8,0xc9))['catch'](handleError(_0x166dc8,null));};exports['update']=function(_0x469526,_0x260e02){if(_0x469526['body']['id']){delete _0x469526[_0x5ae2('0x5a')]['id'];}return db[_0x5ae2('0x3d')][_0x5ae2('0x58')]({'where':{'id':_0x469526[_0x5ae2('0x5b')]['id']}})[_0x5ae2('0x20')](handleEntityNotFound(_0x260e02,null))['then'](saveUpdates(_0x469526[_0x5ae2('0x5a')],null))[_0x5ae2('0x20')](respondWithResult(_0x260e02,null))[_0x5ae2('0x2b')](handleError(_0x260e02,null));};exports[_0x5ae2('0x5c')]=function(_0x172026,_0x551185){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x172026[_0x5ae2('0x5b')]['id']}})[_0x5ae2('0x20')](handleEntityNotFound(_0x551185,null))[_0x5ae2('0x20')](removeEntity(_0x551185,null))[_0x5ae2('0x2b')](handleError(_0x551185,null));};exports[_0x5ae2('0x5d')]=function(_0x4e9dd,_0x32c7f5,_0x59fb42){var _0x4cf5a4={};var _0x48e3f5={};var _0x57091f;var _0x47b914;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x4e9dd[_0x5ae2('0x5b')]['id']}})[_0x5ae2('0x20')](handleEntityNotFound(_0x32c7f5,null))[_0x5ae2('0x20')](function(_0x5a2ee4){if(_0x5a2ee4){_0x57091f=_0x5a2ee4;_0x48e3f5[_0x5ae2('0x45')]=_['keys'](db[_0x5ae2('0x5e')][_0x5ae2('0x3e')]);_0x48e3f5[_0x5ae2('0x42')]=_[_0x5ae2('0x43')](_0x4e9dd[_0x5ae2('0x42')]);_0x48e3f5[_0x5ae2('0x44')]=_[_0x5ae2('0x47')](_0x48e3f5[_0x5ae2('0x45')],_0x48e3f5[_0x5ae2('0x42')]);_0x4cf5a4['attributes']=_[_0x5ae2('0x47')](_0x48e3f5[_0x5ae2('0x45')],qs['fields'](_0x4e9dd['query']['fields']));_0x4cf5a4[_0x5ae2('0x46')]=_0x4cf5a4[_0x5ae2('0x46')][_0x5ae2('0x49')]?_0x4cf5a4[_0x5ae2('0x46')]:_0x48e3f5[_0x5ae2('0x45')];_0x4cf5a4[_0x5ae2('0x4b')]=qs[_0x5ae2('0x4c')](_0x4e9dd['query']['sort']);_0x4cf5a4[_0x5ae2('0x4f')]=qs['filters'](_[_0x5ae2('0x4d')](_0x4e9dd[_0x5ae2('0x42')],_0x48e3f5[_0x5ae2('0x44')]));if(_0x4e9dd[_0x5ae2('0x42')]['filter']){_0x4cf5a4['where']=_['merge'](_0x4cf5a4[_0x5ae2('0x4f')],{'$or':_[_0x5ae2('0x3c')](_0x4cf5a4['attributes'],function(_0x1044e0){var _0x2811d4={};_0x2811d4[_0x1044e0]={'$like':'%'+_0x4e9dd[_0x5ae2('0x42')]['filter']+'%'};return _0x2811d4;})});}_0x4cf5a4=_['merge']({},_0x4cf5a4,_0x4e9dd['options']);return _0x57091f[_0x5ae2('0x5d')](_0x4cf5a4);}})[_0x5ae2('0x20')](function(_0xaffdb4){if(_0xaffdb4){_0x47b914=_0xaffdb4[_0x5ae2('0x49')];if(!_0x4e9dd[_0x5ae2('0x42')][_0x5ae2('0x5f')](_0x5ae2('0x60'))){_0x4cf5a4[_0x5ae2('0x4a')]=qs[_0x5ae2('0x4a')](_0x4e9dd[_0x5ae2('0x42')][_0x5ae2('0x4a')]);_0x4cf5a4['offset']=qs['offset'](_0x4e9dd[_0x5ae2('0x42')]['offset']);}return _0x57091f[_0x5ae2('0x5d')](_0x4cf5a4);}})['then'](function(_0x5d5271){if(_0x5d5271){return _0x5d5271?{'count':_0x47b914,'rows':_0x5d5271}:null;}})[_0x5ae2('0x20')](respondWithResult(_0x32c7f5,null))[_0x5ae2('0x2b')](handleError(_0x32c7f5,null));};exports[_0x5ae2('0x61')]=function(_0x344f79,_0x448578,_0x2586be){var _0x372764={};var _0xdaa4bf={};var _0x2a72fc;var _0x45718d;return db[_0x5ae2('0x3d')][_0x5ae2('0x62')]({'where':{'id':_0x344f79[_0x5ae2('0x5b')]['id']}})[_0x5ae2('0x20')](handleEntityNotFound(_0x448578,null))[_0x5ae2('0x20')](function(_0x85688d){if(_0x85688d){_0x2a72fc=_0x85688d;_0xdaa4bf[_0x5ae2('0x45')]=_[_0x5ae2('0x43')](db['SugarcrmField']['rawAttributes']);_0xdaa4bf[_0x5ae2('0x42')]=_['keys'](_0x344f79['query']);_0xdaa4bf[_0x5ae2('0x44')]=_[_0x5ae2('0x47')](_0xdaa4bf[_0x5ae2('0x45')],_0xdaa4bf[_0x5ae2('0x42')]);_0x372764[_0x5ae2('0x46')]=_[_0x5ae2('0x47')](_0xdaa4bf[_0x5ae2('0x45')],qs[_0x5ae2('0x48')](_0x344f79['query'][_0x5ae2('0x48')]));_0x372764[_0x5ae2('0x46')]=_0x372764[_0x5ae2('0x46')][_0x5ae2('0x49')]?_0x372764['attributes']:_0xdaa4bf[_0x5ae2('0x45')];_0x372764[_0x5ae2('0x4b')]=qs[_0x5ae2('0x4c')](_0x344f79[_0x5ae2('0x42')][_0x5ae2('0x4c')]);_0x372764['where']=qs[_0x5ae2('0x44')](_['pick'](_0x344f79[_0x5ae2('0x42')],_0xdaa4bf['filters']));if(_0x344f79[_0x5ae2('0x42')][_0x5ae2('0x4e')]){_0x372764[_0x5ae2('0x4f')]=_[_0x5ae2('0x51')](_0x372764['where'],{'$or':_['map'](_0x372764[_0x5ae2('0x46')],function(_0x337639){var _0x3bcecf={};_0x3bcecf[_0x337639]={'$like':'%'+_0x344f79[_0x5ae2('0x42')]['filter']+'%'};return _0x3bcecf;})});}_0x372764=_['merge']({},_0x372764,_0x344f79[_0x5ae2('0x57')]);return _0x2a72fc['getSubjects'](_0x372764);}})[_0x5ae2('0x20')](function(_0xbe3b29){if(_0xbe3b29){_0x45718d=_0xbe3b29[_0x5ae2('0x49')];if(!_0x344f79[_0x5ae2('0x42')][_0x5ae2('0x5f')](_0x5ae2('0x60'))){_0x372764[_0x5ae2('0x4a')]=qs[_0x5ae2('0x4a')](_0x344f79['query'][_0x5ae2('0x4a')]);_0x372764[_0x5ae2('0x30')]=qs[_0x5ae2('0x30')](_0x344f79[_0x5ae2('0x42')]['offset']);}return _0x2a72fc[_0x5ae2('0x61')](_0x372764);}})[_0x5ae2('0x20')](function(_0x1518e8){if(_0x1518e8){return _0x1518e8?{'count':_0x45718d,'rows':_0x1518e8}:null;}})[_0x5ae2('0x20')](respondWithResult(_0x448578,null))['catch'](handleError(_0x448578,null));};exports[_0x5ae2('0x63')]=function(_0xe9a362,_0x279f4a,_0x4c80cd){var _0x5729cf={};var _0x64abb3={};var _0x484a00;var _0x436b37;return db[_0x5ae2('0x3d')][_0x5ae2('0x62')]({'where':{'id':_0xe9a362[_0x5ae2('0x5b')]['id']}})[_0x5ae2('0x20')](handleEntityNotFound(_0x279f4a,null))[_0x5ae2('0x20')](function(_0x41fda7){if(_0x41fda7){_0x484a00=_0x41fda7;_0x64abb3[_0x5ae2('0x45')]=_['keys'](db[_0x5ae2('0x5e')][_0x5ae2('0x3e')]);_0x64abb3['query']=_['keys'](_0xe9a362[_0x5ae2('0x42')]);_0x64abb3[_0x5ae2('0x44')]=_[_0x5ae2('0x47')](_0x64abb3[_0x5ae2('0x45')],_0x64abb3[_0x5ae2('0x42')]);_0x5729cf[_0x5ae2('0x46')]=_[_0x5ae2('0x47')](_0x64abb3[_0x5ae2('0x45')],qs['fields'](_0xe9a362[_0x5ae2('0x42')][_0x5ae2('0x48')]));_0x5729cf[_0x5ae2('0x46')]=_0x5729cf[_0x5ae2('0x46')][_0x5ae2('0x49')]?_0x5729cf[_0x5ae2('0x46')]:_0x64abb3[_0x5ae2('0x45')];_0x5729cf[_0x5ae2('0x4b')]=qs[_0x5ae2('0x4c')](_0xe9a362[_0x5ae2('0x42')][_0x5ae2('0x4c')]);_0x5729cf[_0x5ae2('0x4f')]=qs[_0x5ae2('0x44')](_[_0x5ae2('0x4d')](_0xe9a362[_0x5ae2('0x42')],_0x64abb3[_0x5ae2('0x44')]));if(_0xe9a362[_0x5ae2('0x42')]['filter']){_0x5729cf[_0x5ae2('0x4f')]=_['merge'](_0x5729cf[_0x5ae2('0x4f')],{'$or':_['map'](_0x5729cf['attributes'],function(_0x4d7804){var _0x4c6dcd={};_0x4c6dcd[_0x4d7804]={'$like':'%'+_0xe9a362[_0x5ae2('0x42')][_0x5ae2('0x4e')]+'%'};return _0x4c6dcd;})});}_0x5729cf=_[_0x5ae2('0x51')]({},_0x5729cf,_0xe9a362[_0x5ae2('0x57')]);return _0x484a00[_0x5ae2('0x63')](_0x5729cf);}})[_0x5ae2('0x20')](function(_0x57d0f8){if(_0x57d0f8){_0x436b37=_0x57d0f8[_0x5ae2('0x49')];if(!_0xe9a362[_0x5ae2('0x42')]['hasOwnProperty']('nolimit')){_0x5729cf['limit']=qs['limit'](_0xe9a362[_0x5ae2('0x42')][_0x5ae2('0x4a')]);_0x5729cf[_0x5ae2('0x30')]=qs['offset'](_0xe9a362[_0x5ae2('0x42')]['offset']);}return _0x484a00[_0x5ae2('0x63')](_0x5729cf);}})[_0x5ae2('0x20')](function(_0x3439a8){if(_0x3439a8){return _0x3439a8?{'count':_0x436b37,'rows':_0x3439a8}:null;}})[_0x5ae2('0x20')](respondWithResult(_0x279f4a,null))['catch'](handleError(_0x279f4a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 7b06d28..0653932 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 _0x944f=['exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','./intSugarcrmConfiguration.attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x944f,0xc9));var _0xf944=function(_0x2c5987,_0x101621){_0x2c5987=_0x2c5987-0x0;var _0x55773d=_0x944f[_0x2c5987];return _0x55773d;};'use strict';var _=require(_0xf944('0x0'));var util=require(_0xf944('0x1'));var logger=require(_0xf944('0x2'))(_0xf944('0x3'));var moment=require('moment');var BPromise=require(_0xf944('0x4'));var rp=require(_0xf944('0x5'));var fs=require('fs');var path=require(_0xf944('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf944('0x7'));module[_0xf944('0x8')]=function(_0x5bec62,_0x14d6ca){return _0x5bec62['define'](_0xf944('0x9'),attributes,{'tableName':_0xf944('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fbf=['SugarcrmConfiguration','lodash','moment','bluebird','request-promise','rimraf','./intSugarcrmConfiguration.attributes','exports'];(function(_0x9a4163,_0x187f8e){var _0x45358d=function(_0x8cbd0d){while(--_0x8cbd0d){_0x9a4163['push'](_0x9a4163['shift']());}};_0x45358d(++_0x187f8e);}(_0x9fbf,0xb9));var _0xf9fb=function(_0x235dac,_0x302cf4){_0x235dac=_0x235dac-0x0;var _0x3f2f19=_0x9fbf[_0x235dac];return _0x3f2f19;};'use strict';var _=require(_0xf9fb('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf9fb('0x1'));var BPromise=require(_0xf9fb('0x2'));var rp=require(_0xf9fb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9fb('0x4'));var config=require('../../config/environment');var attributes=require(_0xf9fb('0x5'));module[_0xf9fb('0x6')]=function(_0x2efd9b,_0x89077){return _0x2efd9b['define'](_0xf9fb('0x7'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 09cef63..2cc3cd1 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 _0x7e37=['then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x7e37,0x178));var _0x77e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e37[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x77e3('0x0'));var util=require(_0x77e3('0x1'));var moment=require(_0x77e3('0x2'));var BPromise=require(_0x77e3('0x3'));var rs=require(_0x77e3('0x4'));var fs=require('fs');var Redis=require(_0x77e3('0x5'));var db=require(_0x77e3('0x6'))['db'];var utils=require(_0x77e3('0x7'));var logger=require(_0x77e3('0x8'))(_0x77e3('0x9'));var config=require(_0x77e3('0xa'));var jayson=require(_0x77e3('0xb'));var client=jayson['client'][_0x77e3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fd54d,_0x477c84,_0x1af757){return new BPromise(function(_0x455f59,_0x33f658){return client[_0x77e3('0xd')](_0x4fd54d,_0x1af757)[_0x77e3('0xe')](function(_0x71f85){logger[_0x77e3('0xf')](_0x77e3('0x10'),_0x477c84,_0x77e3('0x11'));logger[_0x77e3('0x12')](_0x77e3('0x13'),_0x477c84,_0x77e3('0x11'),JSON[_0x77e3('0x14')](_0x71f85));if(_0x71f85[_0x77e3('0x15')]){if(_0x71f85[_0x77e3('0x15')][_0x77e3('0x16')]===0x1f4){logger['error'](_0x77e3('0x10'),_0x477c84,_0x71f85[_0x77e3('0x15')][_0x77e3('0x17')]);return _0x33f658(_0x71f85['error']['message']);}logger[_0x77e3('0x15')](_0x77e3('0x10'),_0x477c84,_0x71f85[_0x77e3('0x15')][_0x77e3('0x17')]);return _0x455f59(_0x71f85[_0x77e3('0x15')][_0x77e3('0x17')]);}else{logger[_0x77e3('0xf')](_0x77e3('0x10'),_0x477c84,_0x77e3('0x11'));_0x455f59(_0x71f85[_0x77e3('0x18')]['message']);}})[_0x77e3('0x19')](function(_0x385ed6){logger[_0x77e3('0x15')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x477c84,_0x385ed6);_0x33f658(_0x385ed6);});});} \ No newline at end of file +var _0x07e0=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3c0713,_0x118272){var _0xda81d3=function(_0x30d543){while(--_0x30d543){_0x3c0713['push'](_0x3c0713['shift']());}};_0xda81d3(++_0x118272);}(_0x07e0,0x102));var _0x007e=function(_0x1840ec,_0x3612c6){_0x1840ec=_0x1840ec-0x0;var _0x12d765=_0x07e0[_0x1840ec];return _0x12d765;};'use strict';var _=require(_0x007e('0x0'));var util=require(_0x007e('0x1'));var moment=require(_0x007e('0x2'));var BPromise=require('bluebird');var rs=require(_0x007e('0x3'));var fs=require('fs');var Redis=require(_0x007e('0x4'));var db=require(_0x007e('0x5'))['db'];var utils=require(_0x007e('0x6'));var logger=require(_0x007e('0x7'))('rpc');var config=require(_0x007e('0x8'));var jayson=require(_0x007e('0x9'));var client=jayson[_0x007e('0xa')][_0x007e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x259f9b,_0x2af730,_0x321166){return new BPromise(function(_0x4719ea,_0x2b64ea){return client[_0x007e('0xc')](_0x259f9b,_0x321166)[_0x007e('0xd')](function(_0x3e90e9){logger[_0x007e('0xe')](_0x007e('0xf'),_0x2af730,'request\x20sent');logger[_0x007e('0x10')](_0x007e('0x11'),_0x2af730,_0x007e('0x12'),JSON[_0x007e('0x13')](_0x3e90e9));if(_0x3e90e9[_0x007e('0x14')]){if(_0x3e90e9[_0x007e('0x14')][_0x007e('0x15')]===0x1f4){logger[_0x007e('0x14')](_0x007e('0xf'),_0x2af730,_0x3e90e9[_0x007e('0x14')][_0x007e('0x16')]);return _0x2b64ea(_0x3e90e9[_0x007e('0x14')][_0x007e('0x16')]);}logger[_0x007e('0x14')](_0x007e('0xf'),_0x2af730,_0x3e90e9[_0x007e('0x14')][_0x007e('0x16')]);return _0x4719ea(_0x3e90e9['error'][_0x007e('0x16')]);}else{logger[_0x007e('0xe')](_0x007e('0xf'),_0x2af730,_0x007e('0x12'));_0x4719ea(_0x3e90e9['result']['message']);}})[_0x007e('0x17')](function(_0x1bc343){logger[_0x007e('0x14')](_0x007e('0xf'),_0x2af730,_0x1bc343);_0x2b64ea(_0x1bc343);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 8c0cd58..c742295 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 _0xd93a=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','put','update','delete','/:id','destroy','exports'];(function(_0x113945,_0x102a24){var _0x5836c8=function(_0x5430a8){while(--_0x5430a8){_0x113945['push'](_0x113945['shift']());}};_0x5836c8(++_0x102a24);}(_0xd93a,0x1c2));var _0xad93=function(_0x299fcd,_0x6b0886){_0x299fcd=_0x299fcd-0x0;var _0x4b15b0=_0xd93a[_0x299fcd];return _0x4b15b0;};'use strict';var multer=require(_0xad93('0x0'));var util=require(_0xad93('0x1'));var path=require('path');var timeout=require(_0xad93('0x2'));var express=require(_0xad93('0x3'));var router=express[_0xad93('0x4')]();var auth=require(_0xad93('0x5'));var interaction=require(_0xad93('0x6'));var config=require(_0xad93('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xad93('0x8')]('/',auth[_0xad93('0x9')](),controller[_0xad93('0xa')]);router['get']('/:id',auth[_0xad93('0x9')](),controller['show']);router[_0xad93('0xb')]('/',auth[_0xad93('0x9')](),controller['create']);router[_0xad93('0xc')]('/:id',auth[_0xad93('0x9')](),controller[_0xad93('0xd')]);router[_0xad93('0xe')](_0xad93('0xf'),auth[_0xad93('0x9')](),controller[_0xad93('0x10')]);module[_0xad93('0x11')]=router; \ No newline at end of file +var _0xa650=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete'];(function(_0x147b15,_0x51412e){var _0x584416=function(_0x1b9fdd){while(--_0x1b9fdd){_0x147b15['push'](_0x147b15['shift']());}};_0x584416(++_0x51412e);}(_0xa650,0x145));var _0x0a65=function(_0x462efd,_0x4ddff6){_0x462efd=_0x462efd-0x0;var _0x94cbba=_0xa650[_0x462efd];return _0x94cbba;};'use strict';var multer=require(_0x0a65('0x0'));var util=require(_0x0a65('0x1'));var path=require('path');var timeout=require(_0x0a65('0x2'));var express=require(_0x0a65('0x3'));var router=express[_0x0a65('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a65('0x5'));var config=require(_0x0a65('0x6'));var controller=require(_0x0a65('0x7'));router['get']('/',auth[_0x0a65('0x8')](),controller['index']);router[_0x0a65('0x9')](_0x0a65('0xa'),auth[_0x0a65('0x8')](),controller[_0x0a65('0xb')]);router[_0x0a65('0xc')]('/',auth[_0x0a65('0x8')](),controller[_0x0a65('0xd')]);router[_0x0a65('0xe')](_0x0a65('0xa'),auth[_0x0a65('0x8')](),controller[_0x0a65('0xf')]);router[_0x0a65('0x10')](_0x0a65('0xa'),auth[_0x0a65('0x8')](),controller[_0x0a65('0x11')]);module[_0x0a65('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index cf64558..b001e87 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 _0x3379=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x3379,0x115));var _0x9337=function(_0x59168e,_0x1cf8c8){_0x59168e=_0x59168e-0x0;var _0xb16e0c=_0x3379[_0x59168e];return _0xb16e0c;};'use strict';var Sequelize=require(_0x9337('0x0'));module[_0x9337('0x1')]={'type':{'type':Sequelize[_0x9337('0x2')](_0x9337('0x3'),'variable',_0x9337('0x4'),_0x9337('0x5')),'defaultValue':_0x9337('0x3')},'content':{'type':Sequelize[_0x9337('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9337('0x2')](_0x9337('0x3'),_0x9337('0x7'),_0x9337('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9337('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9337('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9337('0x6')]}}; \ No newline at end of file +var _0x0b31=['customVariable','BOOLEAN','sequelize','exports','ENUM','variable','string','STRING'];(function(_0x379a39,_0x595b23){var _0x5df56e=function(_0x35517f){while(--_0x35517f){_0x379a39['push'](_0x379a39['shift']());}};_0x5df56e(++_0x595b23);}(_0x0b31,0x1a2));var _0x10b3=function(_0x351e01,_0x395ccf){_0x351e01=_0x351e01-0x0;var _0x357dd8=_0x0b31[_0x351e01];return _0x357dd8;};'use strict';var Sequelize=require(_0x10b3('0x0'));module[_0x10b3('0x1')]={'type':{'type':Sequelize[_0x10b3('0x2')]('string',_0x10b3('0x3'),'customVariable','keyValue'),'defaultValue':_0x10b3('0x4')},'content':{'type':Sequelize[_0x10b3('0x5')]},'key':{'type':Sequelize[_0x10b3('0x5')]},'keyType':{'type':Sequelize[_0x10b3('0x2')](_0x10b3('0x4'),_0x10b3('0x3'),_0x10b3('0x6'))},'keyContent':{'type':Sequelize[_0x10b3('0x5')]},'idField':{'type':Sequelize[_0x10b3('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x10b3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x10b3('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 72e9470..365adf0 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 _0x431f=['html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','limit','status','set','apply','save','update','then','destroy','error','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','where','merge','filter','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body'];(function(_0x4bda2f,_0x1a3dd1){var _0x418568=function(_0x2bf08d){while(--_0x2bf08d){_0x4bda2f['push'](_0x4bda2f['shift']());}};_0x418568(++_0x1a3dd1);}(_0x431f,0xe7));var _0xf431=function(_0x58b92f,_0x161ad9){_0x58b92f=_0x58b92f-0x0;var _0x25d645=_0x431f[_0x58b92f];return _0x25d645;};'use strict';var pdf=require(_0xf431('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf431('0x1'));var jsonpatch=require(_0xf431('0x2'));var rp=require(_0xf431('0x3'));var moment=require(_0xf431('0x4'));var BPromise=require(_0xf431('0x5'));var Mustache=require(_0xf431('0x6'));var util=require(_0xf431('0x7'));var path=require(_0xf431('0x8'));var sox=require(_0xf431('0x9'));var csv=require(_0xf431('0xa'));var ejs=require(_0xf431('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf431('0xc'));var crypto=require(_0xf431('0xd'));var jsforce=require(_0xf431('0xe'));var deskjs=require(_0xf431('0xf'));var toCsv=require(_0xf431('0xa'));var querystring=require(_0xf431('0x10'));var Papa=require(_0xf431('0x11'));var Redis=require(_0xf431('0x12'));var authService=require(_0xf431('0x13'));var qs=require(_0xf431('0x14'));var as=require(_0xf431('0x15'));var hardwareService=require(_0xf431('0x16'));var logger=require(_0xf431('0x17'))(_0xf431('0x18'));var utils=require(_0xf431('0x19'));var config=require('../../config/environment');var db=require(_0xf431('0x1a'))['db'];function respondWithStatusCode(_0x4e9327,_0x2c8ae5){_0x2c8ae5=_0x2c8ae5||0xcc;return function(_0x3e94a9){if(_0x3e94a9){return _0x4e9327[_0xf431('0x1b')](_0x2c8ae5);}return _0x4e9327['status'](_0x2c8ae5)[_0xf431('0x1c')]();};}function respondWithResult(_0x2f7e10,_0x28f7c3){_0x28f7c3=_0x28f7c3||0xc8;return function(_0x151bf9){if(_0x151bf9){return _0x2f7e10['status'](_0x28f7c3)[_0xf431('0x1d')](_0x151bf9);}};}function respondWithFilteredResult(_0x136073,_0x1074ec){return function(_0x4bd828){if(_0x4bd828){var _0x289045=_0x4bd828['count'],_0x429de8=_0x1074ec['offset'],_0x311c5c=_0x1074ec['offset']+_0x1074ec[_0xf431('0x1e')],_0x16f011;if(_0x311c5c>=_0x289045){_0x311c5c=_0x289045;_0x16f011=0xc8;}else{_0x16f011=0xce;}_0x136073[_0xf431('0x1f')](_0x16f011);return _0x136073[_0xf431('0x20')]('Content-Range',_0x429de8+'-'+_0x311c5c+'/'+_0x289045)['json'](_0x4bd828);}return null;};}function patchUpdates(_0x2c02ba){return function(_0x4d3e6d){try{jsonpatch[_0xf431('0x21')](_0x4d3e6d,_0x2c02ba,!![]);}catch(_0x179840){return BPromise['reject'](_0x179840);}return _0x4d3e6d[_0xf431('0x22')]();};}function saveUpdates(_0x3e36bd,_0x34b589){return function(_0xe7b680){if(_0xe7b680){return _0xe7b680[_0xf431('0x23')](_0x3e36bd)[_0xf431('0x24')](function(_0x501be5){return _0x501be5;});}return null;};}function removeEntity(_0x43b828,_0xec3975){return function(_0x40aa43){if(_0x40aa43){return _0x40aa43[_0xf431('0x25')]()[_0xf431('0x24')](function(){_0x43b828[_0xf431('0x1f')](0xcc)[_0xf431('0x1c')]();});}};}function handleEntityNotFound(_0x166890,_0x3fa032){return function(_0x17eb02){if(!_0x17eb02){_0x166890[_0xf431('0x1b')](0x194);}return _0x17eb02;};}function handleError(_0x389bdd,_0x563836){_0x563836=_0x563836||0x1f4;return function(_0x9f43c4){logger[_0xf431('0x26')](_0x9f43c4[_0xf431('0x27')]);if(_0x9f43c4['name']){delete _0x9f43c4[_0xf431('0x28')];}_0x389bdd['status'](_0x563836)[_0xf431('0x29')](_0x9f43c4);};}exports['index']=function(_0x5c71d4,_0x5b5b20){var _0x5f09e3={},_0x31b505={},_0x100a11={'count':0x0,'rows':[]};var _0x1f5f20=_[_0xf431('0x2a')](db[_0xf431('0x2b')][_0xf431('0x2c')],function(_0x3e2c1d){return{'name':_0x3e2c1d[_0xf431('0x2d')],'type':_0x3e2c1d[_0xf431('0x2e')][_0xf431('0x2f')]};});_0x31b505[_0xf431('0x30')]=_[_0xf431('0x2a')](_0x1f5f20,'name');_0x31b505[_0xf431('0x31')]=_[_0xf431('0x32')](_0x5c71d4['query']);_0x31b505[_0xf431('0x33')]=_[_0xf431('0x34')](_0x31b505[_0xf431('0x30')],_0x31b505['query']);_0x5f09e3[_0xf431('0x35')]=_['intersection'](_0x31b505[_0xf431('0x30')],qs['fields'](_0x5c71d4['query'][_0xf431('0x36')]));_0x5f09e3[_0xf431('0x35')]=_0x5f09e3['attributes']['length']?_0x5f09e3[_0xf431('0x35')]:_0x31b505[_0xf431('0x30')];if(!_0x5c71d4['query'][_0xf431('0x37')](_0xf431('0x38'))){_0x5f09e3[_0xf431('0x1e')]=qs[_0xf431('0x1e')](_0x5c71d4[_0xf431('0x31')][_0xf431('0x1e')]);_0x5f09e3[_0xf431('0x39')]=qs[_0xf431('0x39')](_0x5c71d4[_0xf431('0x31')][_0xf431('0x39')]);}_0x5f09e3[_0xf431('0x3a')]=qs[_0xf431('0x3b')](_0x5c71d4[_0xf431('0x31')][_0xf431('0x3b')]);_0x5f09e3['where']=qs['filters'](_[_0xf431('0x3c')](_0x5c71d4[_0xf431('0x31')],_0x31b505[_0xf431('0x33')]),_0x1f5f20);if(_0x5c71d4[_0xf431('0x31')]['filter']){_0x5f09e3[_0xf431('0x3d')]=_[_0xf431('0x3e')](_0x5f09e3[_0xf431('0x3d')],{'$or':_[_0xf431('0x2a')](_0x1f5f20,function(_0x35d90a){if(_0x35d90a[_0xf431('0x2e')]!=='VIRTUAL'){var _0x2df5d0={};_0x2df5d0[_0x35d90a[_0xf431('0x28')]]={'$like':'%'+_0x5c71d4[_0xf431('0x31')][_0xf431('0x3f')]+'%'};return _0x2df5d0;}})});}_0x5f09e3=_[_0xf431('0x3e')]({},_0x5f09e3,_0x5c71d4[_0xf431('0x40')]);var _0x13621a={'where':_0x5f09e3[_0xf431('0x3d')]};return db[_0xf431('0x2b')][_0xf431('0x41')](_0x13621a)['then'](function(_0xd742d0){_0x100a11['count']=_0xd742d0;if(_0x5c71d4['query'][_0xf431('0x42')]){_0x5f09e3[_0xf431('0x43')]=[{'all':!![]}];}return db[_0xf431('0x2b')][_0xf431('0x44')](_0x5f09e3);})['then'](function(_0x2fdc5c){_0x100a11[_0xf431('0x45')]=_0x2fdc5c;return _0x100a11;})[_0xf431('0x24')](respondWithFilteredResult(_0x5b5b20,_0x5f09e3))[_0xf431('0x46')](handleError(_0x5b5b20,null));};exports[_0xf431('0x47')]=function(_0x3a6a06,_0xfaae45){var _0x360339={'raw':!![],'where':{'id':_0x3a6a06[_0xf431('0x48')]['id']}},_0x3c3d54={};_0x3c3d54[_0xf431('0x30')]=_[_0xf431('0x32')](db[_0xf431('0x2b')][_0xf431('0x2c')]);_0x3c3d54[_0xf431('0x31')]=_[_0xf431('0x32')](_0x3a6a06[_0xf431('0x31')]);_0x3c3d54[_0xf431('0x33')]=_[_0xf431('0x34')](_0x3c3d54[_0xf431('0x30')],_0x3c3d54[_0xf431('0x31')]);_0x360339['attributes']=_['intersection'](_0x3c3d54[_0xf431('0x30')],qs[_0xf431('0x36')](_0x3a6a06['query'][_0xf431('0x36')]));_0x360339[_0xf431('0x35')]=_0x360339['attributes'][_0xf431('0x49')]?_0x360339['attributes']:_0x3c3d54[_0xf431('0x30')];if(_0x3a6a06[_0xf431('0x31')][_0xf431('0x42')]){_0x360339[_0xf431('0x43')]=[{'all':!![]}];}_0x360339=_[_0xf431('0x3e')]({},_0x360339,_0x3a6a06[_0xf431('0x40')]);return db['SugarcrmField'][_0xf431('0x4a')](_0x360339)['then'](handleEntityNotFound(_0xfaae45,null))[_0xf431('0x24')](respondWithResult(_0xfaae45,null))[_0xf431('0x46')](handleError(_0xfaae45,null));};exports['create']=function(_0x389adb,_0x222f9c){return db[_0xf431('0x2b')][_0xf431('0x4b')](_0x389adb[_0xf431('0x4c')],{})[_0xf431('0x24')](respondWithResult(_0x222f9c,0xc9))[_0xf431('0x46')](handleError(_0x222f9c,null));};exports[_0xf431('0x23')]=function(_0x38de5d,_0x25164d){if(_0x38de5d['body']['id']){delete _0x38de5d[_0xf431('0x4c')]['id'];}return db[_0xf431('0x2b')][_0xf431('0x4a')]({'where':{'id':_0x38de5d['params']['id']}})['then'](handleEntityNotFound(_0x25164d,null))[_0xf431('0x24')](saveUpdates(_0x38de5d[_0xf431('0x4c')],null))[_0xf431('0x24')](respondWithResult(_0x25164d,null))[_0xf431('0x46')](handleError(_0x25164d,null));};exports[_0xf431('0x25')]=function(_0x3365fd,_0x100cb9){return db[_0xf431('0x2b')][_0xf431('0x4a')]({'where':{'id':_0x3365fd[_0xf431('0x48')]['id']}})['then'](handleEntityNotFound(_0x100cb9,null))[_0xf431('0x24')](removeEntity(_0x100cb9,null))[_0xf431('0x46')](handleError(_0x100cb9,null));}; \ No newline at end of file +var _0x3a00=['save','update','destroy','end','error','name','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','length','include','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','apply','reject'];(function(_0x14b762,_0x5b56c3){var _0x1a1f4c=function(_0x5a6672){while(--_0x5a6672){_0x14b762['push'](_0x14b762['shift']());}};_0x1a1f4c(++_0x5b56c3);}(_0x3a00,0x18a));var _0x03a0=function(_0x2b31a8,_0x28b862){_0x2b31a8=_0x2b31a8-0x0;var _0x1175a5=_0x3a00[_0x2b31a8];return _0x1175a5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x03a0('0x0'));var rimraf=require(_0x03a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03a0('0x2'));var rp=require(_0x03a0('0x3'));var moment=require(_0x03a0('0x4'));var BPromise=require(_0x03a0('0x5'));var Mustache=require('mustache');var util=require(_0x03a0('0x6'));var path=require('path');var sox=require(_0x03a0('0x7'));var csv=require(_0x03a0('0x8'));var ejs=require(_0x03a0('0x9'));var fs=require('fs');var _=require(_0x03a0('0xa'));var squel=require(_0x03a0('0xb'));var crypto=require(_0x03a0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x03a0('0xd'));var toCsv=require(_0x03a0('0x8'));var querystring=require(_0x03a0('0xe'));var Papa=require(_0x03a0('0xf'));var Redis=require('ioredis');var authService=require(_0x03a0('0x10'));var qs=require(_0x03a0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x03a0('0x12'));var logger=require(_0x03a0('0x13'))(_0x03a0('0x14'));var utils=require(_0x03a0('0x15'));var config=require(_0x03a0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3624be,_0x54919d){_0x54919d=_0x54919d||0xcc;return function(_0x578da8){if(_0x578da8){return _0x3624be[_0x03a0('0x17')](_0x54919d);}return _0x3624be[_0x03a0('0x18')](_0x54919d)['end']();};}function respondWithResult(_0x18f11e,_0x24919f){_0x24919f=_0x24919f||0xc8;return function(_0x2fc4a1){if(_0x2fc4a1){return _0x18f11e['status'](_0x24919f)[_0x03a0('0x19')](_0x2fc4a1);}};}function respondWithFilteredResult(_0x55cae0,_0x40a8ae){return function(_0x53c3cf){if(_0x53c3cf){var _0x62a1f3=_0x53c3cf[_0x03a0('0x1a')],_0x338a6d=_0x40a8ae['offset'],_0x209da0=_0x40a8ae[_0x03a0('0x1b')]+_0x40a8ae[_0x03a0('0x1c')],_0x5bff89;if(_0x209da0>=_0x62a1f3){_0x209da0=_0x62a1f3;_0x5bff89=0xc8;}else{_0x5bff89=0xce;}_0x55cae0[_0x03a0('0x18')](_0x5bff89);return _0x55cae0[_0x03a0('0x1d')]('Content-Range',_0x338a6d+'-'+_0x209da0+'/'+_0x62a1f3)['json'](_0x53c3cf);}return null;};}function patchUpdates(_0x370098){return function(_0x1a14f5){try{jsonpatch[_0x03a0('0x1e')](_0x1a14f5,_0x370098,!![]);}catch(_0x3af845){return BPromise[_0x03a0('0x1f')](_0x3af845);}return _0x1a14f5[_0x03a0('0x20')]();};}function saveUpdates(_0x22651b,_0x3a201b){return function(_0x1bc460){if(_0x1bc460){return _0x1bc460[_0x03a0('0x21')](_0x22651b)['then'](function(_0x211484){return _0x211484;});}return null;};}function removeEntity(_0x184b3f,_0x49ad00){return function(_0x2c3cf5){if(_0x2c3cf5){return _0x2c3cf5[_0x03a0('0x22')]()['then'](function(){_0x184b3f[_0x03a0('0x18')](0xcc)[_0x03a0('0x23')]();});}};}function handleEntityNotFound(_0x3a3e26,_0x2e2fa0){return function(_0xb65dd9){if(!_0xb65dd9){_0x3a3e26[_0x03a0('0x17')](0x194);}return _0xb65dd9;};}function handleError(_0x4e6526,_0x181cb9){_0x181cb9=_0x181cb9||0x1f4;return function(_0x3a864b){logger[_0x03a0('0x24')](_0x3a864b['stack']);if(_0x3a864b[_0x03a0('0x25')]){delete _0x3a864b[_0x03a0('0x25')];}_0x4e6526[_0x03a0('0x18')](_0x181cb9)['send'](_0x3a864b);};}exports['index']=function(_0x14091a,_0x28afc9){var _0x1ef7ed={},_0x4f5bf3={},_0x287666={'count':0x0,'rows':[]};var _0x552794=_['map'](db[_0x03a0('0x26')][_0x03a0('0x27')],function(_0x2f14ea){return{'name':_0x2f14ea[_0x03a0('0x28')],'type':_0x2f14ea[_0x03a0('0x29')][_0x03a0('0x2a')]};});_0x4f5bf3[_0x03a0('0x2b')]=_[_0x03a0('0x2c')](_0x552794,'name');_0x4f5bf3[_0x03a0('0x2d')]=_[_0x03a0('0x2e')](_0x14091a[_0x03a0('0x2d')]);_0x4f5bf3[_0x03a0('0x2f')]=_[_0x03a0('0x30')](_0x4f5bf3['model'],_0x4f5bf3[_0x03a0('0x2d')]);_0x1ef7ed[_0x03a0('0x31')]=_[_0x03a0('0x30')](_0x4f5bf3[_0x03a0('0x2b')],qs[_0x03a0('0x32')](_0x14091a[_0x03a0('0x2d')][_0x03a0('0x32')]));_0x1ef7ed[_0x03a0('0x31')]=_0x1ef7ed[_0x03a0('0x31')]['length']?_0x1ef7ed['attributes']:_0x4f5bf3['model'];if(!_0x14091a[_0x03a0('0x2d')]['hasOwnProperty']('nolimit')){_0x1ef7ed[_0x03a0('0x1c')]=qs[_0x03a0('0x1c')](_0x14091a['query'][_0x03a0('0x1c')]);_0x1ef7ed[_0x03a0('0x1b')]=qs[_0x03a0('0x1b')](_0x14091a['query'][_0x03a0('0x1b')]);}_0x1ef7ed[_0x03a0('0x33')]=qs[_0x03a0('0x34')](_0x14091a[_0x03a0('0x2d')]['sort']);_0x1ef7ed[_0x03a0('0x35')]=qs[_0x03a0('0x2f')](_[_0x03a0('0x36')](_0x14091a[_0x03a0('0x2d')],_0x4f5bf3[_0x03a0('0x2f')]),_0x552794);if(_0x14091a[_0x03a0('0x2d')][_0x03a0('0x37')]){_0x1ef7ed['where']=_[_0x03a0('0x38')](_0x1ef7ed[_0x03a0('0x35')],{'$or':_[_0x03a0('0x2c')](_0x552794,function(_0x4945cc){if(_0x4945cc['type']!==_0x03a0('0x39')){var _0x265f92={};_0x265f92[_0x4945cc['name']]={'$like':'%'+_0x14091a[_0x03a0('0x2d')][_0x03a0('0x37')]+'%'};return _0x265f92;}})});}_0x1ef7ed=_[_0x03a0('0x38')]({},_0x1ef7ed,_0x14091a[_0x03a0('0x3a')]);var _0x179a52={'where':_0x1ef7ed[_0x03a0('0x35')]};return db['SugarcrmField'][_0x03a0('0x1a')](_0x179a52)[_0x03a0('0x3b')](function(_0x24ae49){_0x287666[_0x03a0('0x1a')]=_0x24ae49;if(_0x14091a['query'][_0x03a0('0x3c')]){_0x1ef7ed['include']=[{'all':!![]}];}return db[_0x03a0('0x26')][_0x03a0('0x3d')](_0x1ef7ed);})[_0x03a0('0x3b')](function(_0x2f4b49){_0x287666[_0x03a0('0x3e')]=_0x2f4b49;return _0x287666;})[_0x03a0('0x3b')](respondWithFilteredResult(_0x28afc9,_0x1ef7ed))[_0x03a0('0x3f')](handleError(_0x28afc9,null));};exports[_0x03a0('0x40')]=function(_0x310bca,_0x40a487){var _0x865b4a={'raw':!![],'where':{'id':_0x310bca['params']['id']}},_0x291d17={};_0x291d17[_0x03a0('0x2b')]=_[_0x03a0('0x2e')](db[_0x03a0('0x26')][_0x03a0('0x27')]);_0x291d17[_0x03a0('0x2d')]=_['keys'](_0x310bca[_0x03a0('0x2d')]);_0x291d17[_0x03a0('0x2f')]=_[_0x03a0('0x30')](_0x291d17[_0x03a0('0x2b')],_0x291d17[_0x03a0('0x2d')]);_0x865b4a[_0x03a0('0x31')]=_[_0x03a0('0x30')](_0x291d17['model'],qs[_0x03a0('0x32')](_0x310bca[_0x03a0('0x2d')][_0x03a0('0x32')]));_0x865b4a[_0x03a0('0x31')]=_0x865b4a['attributes'][_0x03a0('0x41')]?_0x865b4a[_0x03a0('0x31')]:_0x291d17[_0x03a0('0x2b')];if(_0x310bca[_0x03a0('0x2d')][_0x03a0('0x3c')]){_0x865b4a[_0x03a0('0x42')]=[{'all':!![]}];}_0x865b4a=_[_0x03a0('0x38')]({},_0x865b4a,_0x310bca[_0x03a0('0x3a')]);return db[_0x03a0('0x26')]['find'](_0x865b4a)[_0x03a0('0x3b')](handleEntityNotFound(_0x40a487,null))['then'](respondWithResult(_0x40a487,null))['catch'](handleError(_0x40a487,null));};exports[_0x03a0('0x43')]=function(_0x1e5f1b,_0x3a97e4){return db[_0x03a0('0x26')][_0x03a0('0x43')](_0x1e5f1b[_0x03a0('0x44')],{})[_0x03a0('0x3b')](respondWithResult(_0x3a97e4,0xc9))[_0x03a0('0x3f')](handleError(_0x3a97e4,null));};exports[_0x03a0('0x21')]=function(_0x1665ff,_0x8c4e9a){if(_0x1665ff[_0x03a0('0x44')]['id']){delete _0x1665ff['body']['id'];}return db['SugarcrmField'][_0x03a0('0x45')]({'where':{'id':_0x1665ff['params']['id']}})[_0x03a0('0x3b')](handleEntityNotFound(_0x8c4e9a,null))[_0x03a0('0x3b')](saveUpdates(_0x1665ff[_0x03a0('0x44')],null))['then'](respondWithResult(_0x8c4e9a,null))[_0x03a0('0x3f')](handleError(_0x8c4e9a,null));};exports[_0x03a0('0x22')]=function(_0x38b735,_0x5a30e8){return db[_0x03a0('0x26')][_0x03a0('0x45')]({'where':{'id':_0x38b735[_0x03a0('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a30e8,null))[_0x03a0('0x3b')](removeEntity(_0x5a30e8,null))['catch'](handleError(_0x5a30e8,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 4abf538..d1d0ca6 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 _0x0e62=['./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3cf980,_0x4bb561){var _0x412e66=function(_0x4849d4){while(--_0x4849d4){_0x3cf980['push'](_0x3cf980['shift']());}};_0x412e66(++_0x4bb561);}(_0x0e62,0xa7));var _0x20e6=function(_0x55c158,_0x33a7c6){_0x55c158=_0x55c158-0x0;var _0x68f39=_0x0e62[_0x55c158];return _0x68f39;};'use strict';var _=require(_0x20e6('0x0'));var util=require(_0x20e6('0x1'));var logger=require(_0x20e6('0x2'))(_0x20e6('0x3'));var moment=require('moment');var BPromise=require(_0x20e6('0x4'));var rp=require(_0x20e6('0x5'));var fs=require('fs');var path=require(_0x20e6('0x6'));var rimraf=require(_0x20e6('0x7'));var config=require(_0x20e6('0x8'));var attributes=require(_0x20e6('0x9'));module[_0x20e6('0xa')]=function(_0x45c7ca,_0x44484e){return _0x45c7ca[_0x20e6('0xb')](_0x20e6('0xc'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x20e6('0xd'),'fields':[_0x20e6('0xe'),_0x20e6('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6e48=['SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define'];(function(_0x150f8f,_0x2857b1){var _0x17a73c=function(_0xb09669){while(--_0xb09669){_0x150f8f['push'](_0x150f8f['shift']());}};_0x17a73c(++_0x2857b1);}(_0x6e48,0xc8));var _0x86e4=function(_0x377d3d,_0x4e9178){_0x377d3d=_0x377d3d-0x0;var _0x551617=_0x6e48[_0x377d3d];return _0x551617;};'use strict';var _=require(_0x86e4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x86e4('0x1'));var moment=require(_0x86e4('0x2'));var BPromise=require(_0x86e4('0x3'));var rp=require(_0x86e4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86e4('0x5'));var config=require(_0x86e4('0x6'));var attributes=require(_0x86e4('0x7'));module[_0x86e4('0x8')]=function(_0x4ea5ce,_0x5a9c78){return _0x4ea5ce[_0x86e4('0x9')](_0x86e4('0xa'),attributes,{'tableName':_0x86e4('0xb'),'paranoid':![],'indexes':[{'name':_0x86e4('0xc'),'fields':[_0x86e4('0xd'),_0x86e4('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 1caa878..363ed98 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x41656c,_0x45e0c2){var _0x319f9c=function(_0x173edb){while(--_0x173edb){_0x41656c['push'](_0x41656c['shift']());}};_0x319f9c(++_0x45e0c2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x9ffd=['SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SugarcrmField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x595154,_0x89e3ed){var _0x4ad97a=function(_0x1643d3){while(--_0x1643d3){_0x595154['push'](_0x595154['shift']());}};_0x4ad97a(++_0x89e3ed);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x400bed,_0x4ac622){_0x400bed=_0x400bed-0x0;var _0x20ecd9=_0x9ffd[_0x400bed];return _0x20ecd9;};'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']('SugarcrmField,\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')]('SugarcrmField,\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')]('SugarcrmField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 28273b2..dc8ee58 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 _0x94f3=['/:id/fields','getFields','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0x18a246,_0x2c607a){var _0x110651=function(_0x2da7cd){while(--_0x2da7cd){_0x18a246['push'](_0x18a246['shift']());}};_0x110651(++_0x2c607a);}(_0x94f3,0x153));var _0x394f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x94f3[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x394f('0x0'));var path=require('path');var timeout=require(_0x394f('0x1'));var express=require(_0x394f('0x2'));var router=express[_0x394f('0x3')]();var auth=require(_0x394f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x394f('0x5'));var controller=require('./intVtigerAccount.controller');router[_0x394f('0x6')]('/',auth['isAuthenticated'](),controller[_0x394f('0x7')]);router['get'](_0x394f('0x8'),auth[_0x394f('0x9')](),controller[_0x394f('0xa')]);router['get'](_0x394f('0xb'),auth[_0x394f('0x9')](),controller[_0x394f('0xc')]);router[_0x394f('0x6')](_0x394f('0xd'),auth[_0x394f('0x9')](),controller[_0x394f('0xe')]);router[_0x394f('0xf')]('/',auth[_0x394f('0x9')](),controller[_0x394f('0x10')]);router[_0x394f('0xf')](_0x394f('0xb'),auth[_0x394f('0x9')](),controller['addConfiguration']);router[_0x394f('0x11')](_0x394f('0x8'),auth[_0x394f('0x9')](),controller[_0x394f('0x12')]);router[_0x394f('0x13')](_0x394f('0x8'),auth[_0x394f('0x9')](),controller[_0x394f('0x14')]);module[_0x394f('0x15')]=router; \ No newline at end of file +var _0x33a1=['addConfiguration','put','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create'];(function(_0x4aa1b1,_0x56b523){var _0x1961c4=function(_0x3baa15){while(--_0x3baa15){_0x4aa1b1['push'](_0x4aa1b1['shift']());}};_0x1961c4(++_0x56b523);}(_0x33a1,0x147));var _0x133a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x33a1[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x133a('0x0'));var util=require(_0x133a('0x1'));var path=require('path');var timeout=require(_0x133a('0x2'));var express=require('express');var router=express[_0x133a('0x3')]();var auth=require(_0x133a('0x4'));var interaction=require(_0x133a('0x5'));var config=require(_0x133a('0x6'));var controller=require(_0x133a('0x7'));router[_0x133a('0x8')]('/',auth[_0x133a('0x9')](),controller[_0x133a('0xa')]);router[_0x133a('0x8')](_0x133a('0xb'),auth[_0x133a('0x9')](),controller[_0x133a('0xc')]);router[_0x133a('0x8')](_0x133a('0xd'),auth[_0x133a('0x9')](),controller[_0x133a('0xe')]);router[_0x133a('0x8')]('/:id/fields',auth[_0x133a('0x9')](),controller[_0x133a('0xf')]);router[_0x133a('0x10')]('/',auth[_0x133a('0x9')](),controller[_0x133a('0x11')]);router[_0x133a('0x10')]('/:id/configurations',auth[_0x133a('0x9')](),controller[_0x133a('0x12')]);router[_0x133a('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x133a('0x14')](_0x133a('0xb'),auth[_0x133a('0x9')](),controller[_0x133a('0x15')]);module[_0x133a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 3f22993..cbc434a 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 _0x437e=['STRING','sequelize','exports'];(function(_0x282173,_0x2abfce){var _0x8e4efa=function(_0x16dcfc){while(--_0x16dcfc){_0x282173['push'](_0x282173['shift']());}};_0x8e4efa(++_0x2abfce);}(_0x437e,0x1d2));var _0xe437=function(_0x43ad18,_0x21f334){_0x43ad18=_0x43ad18-0x0;var _0x3bdc6a=_0x437e[_0x43ad18];return _0x3bdc6a;};'use strict';var Sequelize=require(_0xe437('0x0'));module[_0xe437('0x1')]={'name':{'type':Sequelize[_0xe437('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe437('0x2')]},'username':{'type':Sequelize[_0xe437('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xe437('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xe437('0x2')]},'accessKey':{'type':Sequelize[_0xe437('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7ea6=['sequelize','exports','STRING','HelpDesk'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0x7ea6,0x1b4));var _0x67ea=function(_0x5adb5f,_0x3a05db){_0x5adb5f=_0x5adb5f-0x0;var _0x292d4f=_0x7ea6[_0x5adb5f];return _0x292d4f;};'use strict';var Sequelize=require(_0x67ea('0x0'));module[_0x67ea('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x67ea('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x67ea('0x3')},'remoteUri':{'type':Sequelize[_0x67ea('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x67ea('0x2')]},'accessKey':{'type':Sequelize[_0x67ea('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 d393032..b42e642 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 _0x4c9e=['editable','false','cf_','picklist','label','log','vTiger\x20error:\x20','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','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','request\x20sent','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','end','status','json','count','limit','set','reject','save','destroy','sendStatus','send','index','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','VtigerAccount','rows','show','params','keys','length','includeAll','include','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5','getFields','description','moduleName','serverUrl','accessKey','substring','lastIndexOf','%s/webservice.php','getchallenge','success','POST','login','token','GET','describe','sessionName','autogenerated','reference','owner','remove','includes'];(function(_0x434351,_0x28e2b1){var _0x5ecfb5=function(_0x2efd0d){while(--_0x2efd0d){_0x434351['push'](_0x434351['shift']());}};_0x5ecfb5(++_0x28e2b1);}(_0x4c9e,0x191));var _0xe4c9=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x4c9e[_0x33032e];return _0x13316b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe4c9('0x0'));var zipdir=require(_0xe4c9('0x1'));var jsonpatch=require(_0xe4c9('0x2'));var rp=require(_0xe4c9('0x3'));var moment=require(_0xe4c9('0x4'));var BPromise=require(_0xe4c9('0x5'));var Mustache=require('mustache');var util=require(_0xe4c9('0x6'));var path=require(_0xe4c9('0x7'));var sox=require(_0xe4c9('0x8'));var csv=require(_0xe4c9('0x9'));var ejs=require(_0xe4c9('0xa'));var fs=require('fs');var _=require(_0xe4c9('0xb'));var squel=require(_0xe4c9('0xc'));var crypto=require(_0xe4c9('0xd'));var jsforce=require(_0xe4c9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe4c9('0x9'));var querystring=require(_0xe4c9('0xf'));var Papa=require(_0xe4c9('0x10'));var Redis=require('ioredis');var authService=require(_0xe4c9('0x11'));var qs=require(_0xe4c9('0x12'));var as=require(_0xe4c9('0x13'));var hardwareService=require(_0xe4c9('0x14'));var logger=require(_0xe4c9('0x15'))(_0xe4c9('0x16'));var utils=require(_0xe4c9('0x17'));var config=require('../../config/environment');var db=require(_0xe4c9('0x18'))['db'];var integrations=require(_0xe4c9('0x19'));var jayson=require('jayson/promise');var client=jayson[_0xe4c9('0x1a')][_0xe4c9('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x2d033f,_0x172819,_0x39fff9){if(_0x39fff9){var _0x4464c6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4464c6[_0xe4c9('0x1c')](_0x172819)){return _0x2d033f;}else{throw new db['Sequelize'][(_0xe4c9('0x1d'))](_0xe4c9('0x1e'));}}else{return _0x2d033f;}}function respondWithRpcPromise(_0x3d06b3,_0x593ae1,_0x2b1751,_0x36f7e0){return new BPromise(function(_0x3cd162,_0x4b288b){var _0x111632=_0x36f7e0||client;return _0x111632[_0xe4c9('0x1f')](_0x3d06b3,_0x2b1751)[_0xe4c9('0x20')](function(_0x4f1775){logger[_0xe4c9('0x21')]('VtigerAccount,\x20%s,\x20%s',_0x593ae1,_0xe4c9('0x22'));logger[_0xe4c9('0x23')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x593ae1,_0xe4c9('0x22'),JSON[_0xe4c9('0x24')](_0x4f1775));if(_0x4f1775[_0xe4c9('0x25')]){if(_0x4f1775[_0xe4c9('0x25')][_0xe4c9('0x26')]===0x1f4){logger[_0xe4c9('0x25')](_0xe4c9('0x27'),_0x593ae1,_0x4f1775[_0xe4c9('0x25')]['message']);return _0x4b288b(_0x4f1775[_0xe4c9('0x25')][_0xe4c9('0x28')]);}logger[_0xe4c9('0x25')](_0xe4c9('0x27'),_0x593ae1,_0x4f1775[_0xe4c9('0x25')][_0xe4c9('0x28')]);return _0x3cd162(_0x4f1775[_0xe4c9('0x25')][_0xe4c9('0x28')]);}else{logger[_0xe4c9('0x21')]('VtigerAccount,\x20%s,\x20%s',_0x593ae1,_0xe4c9('0x22'));_0x3cd162(_0x4f1775[_0xe4c9('0x29')][_0xe4c9('0x28')]);}})[_0xe4c9('0x2a')](function(_0x71a775){logger['error'](_0xe4c9('0x27'),_0x593ae1,_0x71a775);_0x4b288b(_0x71a775);});});}function respondWithStatusCode(_0x4de2d1,_0x12e4cf){_0x12e4cf=_0x12e4cf||0xcc;return function(_0x232afe){if(_0x232afe){return _0x4de2d1['sendStatus'](_0x12e4cf);}return _0x4de2d1['status'](_0x12e4cf)[_0xe4c9('0x2b')]();};}function respondWithResult(_0x536594,_0x4cab48){_0x4cab48=_0x4cab48||0xc8;return function(_0xd1a4c3){if(_0xd1a4c3){return _0x536594[_0xe4c9('0x2c')](_0x4cab48)[_0xe4c9('0x2d')](_0xd1a4c3);}};}function respondWithFilteredResult(_0x24080f,_0x5eef8c){return function(_0x334e7c){if(_0x334e7c){var _0x4c34d2=_0x334e7c[_0xe4c9('0x2e')],_0x237773=_0x5eef8c['offset'],_0x1c1e1f=_0x5eef8c['offset']+_0x5eef8c[_0xe4c9('0x2f')],_0x41b281;if(_0x1c1e1f>=_0x4c34d2){_0x1c1e1f=_0x4c34d2;_0x41b281=0xc8;}else{_0x41b281=0xce;}_0x24080f['status'](_0x41b281);return _0x24080f[_0xe4c9('0x30')]('Content-Range',_0x237773+'-'+_0x1c1e1f+'/'+_0x4c34d2)[_0xe4c9('0x2d')](_0x334e7c);}return null;};}function patchUpdates(_0x2f630c){return function(_0x55c0fe){try{jsonpatch['apply'](_0x55c0fe,_0x2f630c,!![]);}catch(_0x3aa384){return BPromise[_0xe4c9('0x31')](_0x3aa384);}return _0x55c0fe[_0xe4c9('0x32')]();};}function saveUpdates(_0x45d70f,_0x581227){return function(_0x1c486f){if(_0x1c486f){return _0x1c486f['update'](_0x45d70f)[_0xe4c9('0x20')](function(_0x4e00cc){return _0x4e00cc;});}return null;};}function removeEntity(_0x3f3d88,_0x339eeb){return function(_0x383a20){if(_0x383a20){return _0x383a20[_0xe4c9('0x33')]()[_0xe4c9('0x20')](function(){_0x3f3d88[_0xe4c9('0x2c')](0xcc)[_0xe4c9('0x2b')]();});}};}function handleEntityNotFound(_0x283033,_0x4bf626){return function(_0x2a42db){if(!_0x2a42db){_0x283033[_0xe4c9('0x34')](0x194);}return _0x2a42db;};}function handleError(_0x1a8451,_0x202b5a){_0x202b5a=_0x202b5a||0x1f4;return function(_0x1cb23f){logger[_0xe4c9('0x25')](_0x1cb23f['stack']);if(_0x1cb23f['name']){delete _0x1cb23f['name'];}_0x1a8451['status'](_0x202b5a)[_0xe4c9('0x35')](_0x1cb23f);};}exports[_0xe4c9('0x36')]=function(_0x37f1ac,_0x10ddf3){var _0x6763f={},_0xf109e8={},_0x4c4363={'count':0x0,'rows':[]};var _0x542bb=_[_0xe4c9('0x37')](db['VtigerAccount'][_0xe4c9('0x38')],function(_0x52538d){return{'name':_0x52538d[_0xe4c9('0x39')],'type':_0x52538d[_0xe4c9('0x3a')][_0xe4c9('0x3b')]};});_0xf109e8[_0xe4c9('0x3c')]=_[_0xe4c9('0x37')](_0x542bb,_0xe4c9('0x3d'));_0xf109e8[_0xe4c9('0x3e')]=_['keys'](_0x37f1ac[_0xe4c9('0x3e')]);_0xf109e8[_0xe4c9('0x3f')]=_[_0xe4c9('0x40')](_0xf109e8[_0xe4c9('0x3c')],_0xf109e8[_0xe4c9('0x3e')]);_0x6763f['attributes']=_[_0xe4c9('0x40')](_0xf109e8[_0xe4c9('0x3c')],qs[_0xe4c9('0x41')](_0x37f1ac['query'][_0xe4c9('0x41')]));_0x6763f[_0xe4c9('0x42')]=_0x6763f[_0xe4c9('0x42')]['length']?_0x6763f[_0xe4c9('0x42')]:_0xf109e8[_0xe4c9('0x3c')];if(!_0x37f1ac[_0xe4c9('0x3e')][_0xe4c9('0x43')](_0xe4c9('0x44'))){_0x6763f[_0xe4c9('0x2f')]=qs[_0xe4c9('0x2f')](_0x37f1ac[_0xe4c9('0x3e')][_0xe4c9('0x2f')]);_0x6763f[_0xe4c9('0x45')]=qs['offset'](_0x37f1ac[_0xe4c9('0x3e')][_0xe4c9('0x45')]);}_0x6763f['order']=qs[_0xe4c9('0x46')](_0x37f1ac['query']['sort']);_0x6763f[_0xe4c9('0x47')]=qs[_0xe4c9('0x3f')](_[_0xe4c9('0x48')](_0x37f1ac[_0xe4c9('0x3e')],_0xf109e8[_0xe4c9('0x3f')]),_0x542bb);if(_0x37f1ac[_0xe4c9('0x3e')][_0xe4c9('0x49')]){_0x6763f[_0xe4c9('0x47')]=_[_0xe4c9('0x4a')](_0x6763f[_0xe4c9('0x47')],{'$or':_[_0xe4c9('0x37')](_0x542bb,function(_0x2fae9e){if(_0x2fae9e[_0xe4c9('0x3a')]!==_0xe4c9('0x4b')){var _0x11a0dc={};_0x11a0dc[_0x2fae9e[_0xe4c9('0x3d')]]={'$like':'%'+_0x37f1ac[_0xe4c9('0x3e')]['filter']+'%'};return _0x11a0dc;}})});}_0x6763f=_['merge']({},_0x6763f,_0x37f1ac[_0xe4c9('0x4c')]);var _0x5db389={'where':_0x6763f[_0xe4c9('0x47')]};return db['VtigerAccount'][_0xe4c9('0x2e')](_0x5db389)['then'](function(_0x4c5fde){_0x4c4363['count']=_0x4c5fde;if(_0x37f1ac[_0xe4c9('0x3e')]['includeAll']){_0x6763f['include']=[{'all':!![]}];}return db[_0xe4c9('0x4d')]['findAll'](_0x6763f);})[_0xe4c9('0x20')](function(_0x3b157a){_0x4c4363[_0xe4c9('0x4e')]=_0x3b157a;return _0x4c4363;})[_0xe4c9('0x20')](respondWithFilteredResult(_0x10ddf3,_0x6763f))[_0xe4c9('0x2a')](handleError(_0x10ddf3,null));};exports[_0xe4c9('0x4f')]=function(_0x454b2f,_0x354ff3){var _0x175e55={'raw':![],'where':{'id':_0x454b2f[_0xe4c9('0x50')]['id']}},_0x4095f7={};_0x4095f7[_0xe4c9('0x3c')]=_[_0xe4c9('0x51')](db[_0xe4c9('0x4d')][_0xe4c9('0x38')]);_0x4095f7['query']=_[_0xe4c9('0x51')](_0x454b2f[_0xe4c9('0x3e')]);_0x4095f7[_0xe4c9('0x3f')]=_[_0xe4c9('0x40')](_0x4095f7['model'],_0x4095f7[_0xe4c9('0x3e')]);_0x175e55[_0xe4c9('0x42')]=_[_0xe4c9('0x40')](_0x4095f7[_0xe4c9('0x3c')],qs[_0xe4c9('0x41')](_0x454b2f['query']['fields']));_0x175e55[_0xe4c9('0x42')]=_0x175e55[_0xe4c9('0x42')][_0xe4c9('0x52')]?_0x175e55[_0xe4c9('0x42')]:_0x4095f7[_0xe4c9('0x3c')];if(_0x454b2f[_0xe4c9('0x3e')][_0xe4c9('0x53')]){_0x175e55[_0xe4c9('0x54')]=[{'all':!![]}];}_0x175e55=_[_0xe4c9('0x4a')]({},_0x175e55,_0x454b2f[_0xe4c9('0x4c')]);return db[_0xe4c9('0x4d')][_0xe4c9('0x55')](_0x175e55)['then'](handleEntityNotFound(_0x354ff3,null))[_0xe4c9('0x20')](respondWithResult(_0x354ff3,null))[_0xe4c9('0x2a')](handleError(_0x354ff3,null));};exports[_0xe4c9('0x56')]=function(_0x5e00c7,_0x4bc340){return db[_0xe4c9('0x4d')][_0xe4c9('0x56')](_0x5e00c7[_0xe4c9('0x57')],{})[_0xe4c9('0x20')](respondWithResult(_0x4bc340,0xc9))['catch'](handleError(_0x4bc340,null));};exports[_0xe4c9('0x58')]=function(_0x304b94,_0x48ea1c){if(_0x304b94['body']['id']){delete _0x304b94[_0xe4c9('0x57')]['id'];}return db[_0xe4c9('0x4d')]['find']({'where':{'id':_0x304b94[_0xe4c9('0x50')]['id']}})[_0xe4c9('0x20')](handleEntityNotFound(_0x48ea1c,null))['then'](saveUpdates(_0x304b94['body'],null))[_0xe4c9('0x20')](respondWithResult(_0x48ea1c,null))['catch'](handleError(_0x48ea1c,null));};exports[_0xe4c9('0x33')]=function(_0x91e6af,_0x59a17a){return db[_0xe4c9('0x4d')]['find']({'where':{'id':_0x91e6af['params']['id']}})[_0xe4c9('0x20')](handleEntityNotFound(_0x59a17a,null))[_0xe4c9('0x20')](removeEntity(_0x59a17a,null))[_0xe4c9('0x2a')](handleError(_0x59a17a,null));};exports[_0xe4c9('0x59')]=function(_0x5997d3,_0x49f6e9,_0x570f0c){var _0x4f29b8={};var _0x34680f={};var _0x97e2fd;var _0x32c3e6;return db[_0xe4c9('0x4d')][_0xe4c9('0x5a')]({'where':{'id':_0x5997d3['params']['id']}})[_0xe4c9('0x20')](handleEntityNotFound(_0x49f6e9,null))[_0xe4c9('0x20')](function(_0x4342b0){if(_0x4342b0){_0x97e2fd=_0x4342b0;_0x34680f[_0xe4c9('0x3c')]=_[_0xe4c9('0x51')](db[_0xe4c9('0x5b')]['rawAttributes']);_0x34680f[_0xe4c9('0x3e')]=_[_0xe4c9('0x51')](_0x5997d3[_0xe4c9('0x3e')]);_0x34680f[_0xe4c9('0x3f')]=_['intersection'](_0x34680f['model'],_0x34680f['query']);_0x4f29b8[_0xe4c9('0x42')]=_[_0xe4c9('0x40')](_0x34680f[_0xe4c9('0x3c')],qs[_0xe4c9('0x41')](_0x5997d3['query'][_0xe4c9('0x41')]));_0x4f29b8[_0xe4c9('0x42')]=_0x4f29b8['attributes'][_0xe4c9('0x52')]?_0x4f29b8[_0xe4c9('0x42')]:_0x34680f['model'];_0x4f29b8[_0xe4c9('0x5c')]=qs[_0xe4c9('0x46')](_0x5997d3['query']['sort']);_0x4f29b8[_0xe4c9('0x47')]=qs[_0xe4c9('0x3f')](_[_0xe4c9('0x48')](_0x5997d3[_0xe4c9('0x3e')],_0x34680f[_0xe4c9('0x3f')]));if(_0x5997d3[_0xe4c9('0x3e')][_0xe4c9('0x49')]){_0x4f29b8[_0xe4c9('0x47')]=_[_0xe4c9('0x4a')](_0x4f29b8[_0xe4c9('0x47')],{'$or':_[_0xe4c9('0x37')](_0x4f29b8['attributes'],function(_0x170fa0){var _0x18ccb2={};_0x18ccb2[_0x170fa0]={'$like':'%'+_0x5997d3['query']['filter']+'%'};return _0x18ccb2;})});}_0x4f29b8=_[_0xe4c9('0x4a')]({},_0x4f29b8,_0x5997d3[_0xe4c9('0x4c')]);return _0x97e2fd[_0xe4c9('0x59')](_0x4f29b8);}})[_0xe4c9('0x20')](function(_0x5c28f7){if(_0x5c28f7){_0x32c3e6=_0x5c28f7[_0xe4c9('0x52')];if(!_0x5997d3[_0xe4c9('0x3e')]['hasOwnProperty']('nolimit')){_0x4f29b8[_0xe4c9('0x2f')]=qs[_0xe4c9('0x2f')](_0x5997d3[_0xe4c9('0x3e')][_0xe4c9('0x2f')]);_0x4f29b8['offset']=qs['offset'](_0x5997d3[_0xe4c9('0x3e')][_0xe4c9('0x45')]);}return _0x97e2fd[_0xe4c9('0x59')](_0x4f29b8);}})['then'](function(_0x130810){if(_0x130810){return _0x130810?{'count':_0x32c3e6,'rows':_0x130810}:null;}})[_0xe4c9('0x20')](respondWithResult(_0x49f6e9,null))[_0xe4c9('0x2a')](handleError(_0x49f6e9,null));};exports[_0xe4c9('0x5d')]=function(_0x4d063d,_0x276f1d,_0x358ce5){if(_0x4d063d['body']['id']){delete _0x4d063d['body']['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x4d063d[_0xe4c9('0x50')]['id']}})[_0xe4c9('0x20')](handleEntityNotFound(_0x276f1d,null))[_0xe4c9('0x20')](function(_0x2613c5){if(_0x2613c5){_0x4d063d[_0xe4c9('0x57')][_0xe4c9('0x5e')]=_0x2613c5['id'];_0x4d063d[_0xe4c9('0x57')][_0xe4c9('0x5f')]=integrations[_0xe4c9('0x60')](_0x4d063d[_0xe4c9('0x57')][_0xe4c9('0x61')],_0x4d063d['body']['type']);_0x4d063d[_0xe4c9('0x57')]['Descriptions']=integrations[_0xe4c9('0x62')](_0x4d063d['body'][_0xe4c9('0x61')],_0x4d063d[_0xe4c9('0x57')][_0xe4c9('0x3a')]);return db[_0xe4c9('0x5b')]['create'](_0x4d063d[_0xe4c9('0x57')],{'include':[{'model':db[_0xe4c9('0x63')],'as':_0xe4c9('0x5f')},{'model':db[_0xe4c9('0x63')],'as':_0xe4c9('0x64')}]});}return null;})[_0xe4c9('0x20')](respondWithResult(_0x276f1d,null))['catch'](handleError(_0x276f1d,null));};var md5=require(_0xe4c9('0x65'));exports[_0xe4c9('0x66')]=function(_0x2e3c21,_0x3896e6,_0x11efed){var _0x89e00c=null;var _0x4881e5=null;var _0x1fdb9f=null;var _0x49a8ac=null;var _0x45a14f='';return db[_0xe4c9('0x4d')][_0xe4c9('0x5a')]({'where':{'id':_0x2e3c21['params']['id']},'attributes':['id',_0xe4c9('0x3d'),'username',_0xe4c9('0x67'),_0xe4c9('0x68'),'remoteUri',_0xe4c9('0x69'),_0xe4c9('0x6a')]})[_0xe4c9('0x20')](handleEntityNotFound(_0x3896e6,null))[_0xe4c9('0x20')](function(_0x18fa6e){if(_0x18fa6e){_0x89e00c=_0x18fa6e['username'];_0x4881e5=_0x18fa6e['accessKey'];_0x1fdb9f=_0x18fa6e[_0xe4c9('0x68')];_0x45a14f=_0x18fa6e['remoteUri'];var _0x9cb53d=_0x45a14f['slice'](-0x1);if(_0x9cb53d==='/'){_0x45a14f=_0x45a14f[_0xe4c9('0x6b')](0x0,_0x45a14f[_0xe4c9('0x6c')](_0x9cb53d));}_0x49a8ac=util['format'](_0xe4c9('0x6d'),_0x45a14f);var _0x401f23={'method':'GET','uri':_0x49a8ac,'qs':{'operation':_0xe4c9('0x6e'),'username':_0x18fa6e['username']},'json':!![]};return rp(_0x401f23);}})['then'](function(_0x2195f9){if(_0x2195f9[_0xe4c9('0x6f')]){var _0xbdadbd={'method':_0xe4c9('0x70'),'uri':_0x49a8ac,'form':{'operation':_0xe4c9('0x71'),'username':_0x89e00c,'accessKey':md5(_0x2195f9[_0xe4c9('0x29')][_0xe4c9('0x72')]+_0x4881e5)},'json':!![]};return rp(_0xbdadbd);}})['then'](function(_0x1d9191){if(_0x1d9191['success']){var _0x251ef2={'method':_0xe4c9('0x73'),'uri':_0x49a8ac,'qs':{'operation':_0xe4c9('0x74'),'username':_0x89e00c,'sessionName':_0x1d9191[_0xe4c9('0x29')][_0xe4c9('0x75')],'elementType':_0x1fdb9f},'json':!![]};return rp(_0x251ef2);}})[_0xe4c9('0x20')](function(_0x464f67){if(_0x464f67[_0xe4c9('0x6f')]){var _0x33b226=[_0xe4c9('0x76'),_0xe4c9('0x77'),_0xe4c9('0x78')];_[_0xe4c9('0x79')](_0x464f67[_0xe4c9('0x29')]['fields'],function(_0x4f161f){return _0x33b226[_0xe4c9('0x7a')](_0x4f161f[_0xe4c9('0x3a')][_0xe4c9('0x3d')]);});_[_0xe4c9('0x79')](_0x464f67[_0xe4c9('0x29')][_0xe4c9('0x41')],function(_0x31c5dc){return _0x31c5dc[_0xe4c9('0x7b')]===_0xe4c9('0x7c');});return{'count':_0x464f67[_0xe4c9('0x29')][_0xe4c9('0x41')]['length'],'rows':_[_0xe4c9('0x37')](_0x464f67['result'][_0xe4c9('0x41')],function(_0x53a058){return{'id':_0x53a058[_0xe4c9('0x3d')],'name':_0x53a058['label'],'custom':_['startsWith'](_0x53a058['name'],_0xe4c9('0x7d'))?!![]:![],'options':_0x53a058['type'][_0xe4c9('0x3d')]===_0xe4c9('0x7e')&&_0x53a058[_0xe4c9('0x3a')]['picklistValues'][_0xe4c9('0x52')]>0x0?_[_0xe4c9('0x37')](_0x53a058['type']['picklistValues'],function(_0x3e3f9e){return{'name':_0x3e3f9e[_0xe4c9('0x7f')],'value':_0x3e3f9e['value']};}):[]};})};}})['then'](respondWithResult(_0x3896e6,null))[_0xe4c9('0x2a')](function(_0x3076b0){console[_0xe4c9('0x80')](_0xe4c9('0x81')+_0x3076b0);var _0x144e11=_0x2e3c21[_0xe4c9('0x3e')][_0xe4c9('0x1c')]?0x1f4:_0x3076b0[_0xe4c9('0x82')]||0x1f4;logger[_0xe4c9('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xe4c9('0x66'),_0x144e11,JSON[_0xe4c9('0x24')](_0x3076b0));delete _0x3076b0[_0xe4c9('0x3d')];if(_0x144e11===0x191){_0x144e11=0x190;}_0x3896e6['status'](_0x144e11)[_0xe4c9('0x35')](_0x2e3c21[_0xe4c9('0x3e')][_0xe4c9('0x1c')]?{'message':'Wrong\x20credentials','statusCode':_0x3076b0[_0xe4c9('0x82')]}:_0x3076b0);});}; \ No newline at end of file +var _0x627e=['getSubjects','Descriptions','getDescriptions','channel','Subjects','VtigerField','md5','getFields','username','description','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','login','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','label','startsWith','cf_','picklist','picklistValues','value','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','client','test','Sequelize','ValidationError','request','then','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','destroy','stack','send','index','fieldName','type','key','model','map','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','pick','filter','merge','where','options','includeAll','include','VtigerAccount','findAll','rows','show','params','keys','find','create','update','body','findOne','VtigerConfiguration','rawAttributes','order','getConfigurations','addConfiguration','AccountId'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0x627e,0x1b3));var _0xe627=function(_0xa3cff1,_0x1e4c9c){_0xa3cff1=_0xa3cff1-0x0;var _0x33675c=_0x627e[_0xa3cff1];return _0x33675c;};'use strict';var pdf=require(_0xe627('0x0'));var emlformat=require(_0xe627('0x1'));var rimraf=require(_0xe627('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe627('0x3'));var rp=require(_0xe627('0x4'));var moment=require(_0xe627('0x5'));var BPromise=require(_0xe627('0x6'));var Mustache=require(_0xe627('0x7'));var util=require(_0xe627('0x8'));var path=require(_0xe627('0x9'));var sox=require(_0xe627('0xa'));var csv=require('to-csv');var ejs=require(_0xe627('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe627('0xc'));var crypto=require(_0xe627('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe627('0xe'));var toCsv=require(_0xe627('0xf'));var querystring=require('querystring');var Papa=require(_0xe627('0x10'));var Redis=require(_0xe627('0x11'));var authService=require(_0xe627('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe627('0x13'));var logger=require(_0xe627('0x14'))('api');var utils=require(_0xe627('0x15'));var config=require(_0xe627('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe627('0x17'));var jayson=require('jayson/promise');var client=jayson[_0xe627('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x157285,_0x2e1ac9,_0x46d3a2){if(_0x46d3a2){var _0x31da99=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31da99[_0xe627('0x19')](_0x2e1ac9)){return _0x157285;}else{throw new db[(_0xe627('0x1a'))][(_0xe627('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 _0x157285;}}function respondWithRpcPromise(_0x35af9f,_0x48a95d,_0x404c66,_0x2cb028){return new BPromise(function(_0x1608dc,_0x516d66){var _0x5772f8=_0x2cb028||client;return _0x5772f8[_0xe627('0x1c')](_0x35af9f,_0x404c66)[_0xe627('0x1d')](function(_0x5246fc){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x48a95d,'request\x20sent');logger['debug'](_0xe627('0x1e'),_0x48a95d,'request\x20sent',JSON[_0xe627('0x1f')](_0x5246fc));if(_0x5246fc[_0xe627('0x20')]){if(_0x5246fc[_0xe627('0x20')][_0xe627('0x21')]===0x1f4){logger[_0xe627('0x20')](_0xe627('0x22'),_0x48a95d,_0x5246fc['error']['message']);return _0x516d66(_0x5246fc[_0xe627('0x20')][_0xe627('0x23')]);}logger['error'](_0xe627('0x22'),_0x48a95d,_0x5246fc[_0xe627('0x20')][_0xe627('0x23')]);return _0x1608dc(_0x5246fc[_0xe627('0x20')][_0xe627('0x23')]);}else{logger['info'](_0xe627('0x22'),_0x48a95d,_0xe627('0x24'));_0x1608dc(_0x5246fc[_0xe627('0x25')][_0xe627('0x23')]);}})[_0xe627('0x26')](function(_0x17cd9e){logger[_0xe627('0x20')](_0xe627('0x22'),_0x48a95d,_0x17cd9e);_0x516d66(_0x17cd9e);});});}function respondWithStatusCode(_0xad5d54,_0x4df798){_0x4df798=_0x4df798||0xcc;return function(_0x6c6f82){if(_0x6c6f82){return _0xad5d54[_0xe627('0x27')](_0x4df798);}return _0xad5d54[_0xe627('0x28')](_0x4df798)[_0xe627('0x29')]();};}function respondWithResult(_0x5013bc,_0x30c1ef){_0x30c1ef=_0x30c1ef||0xc8;return function(_0x11204b){if(_0x11204b){return _0x5013bc[_0xe627('0x28')](_0x30c1ef)['json'](_0x11204b);}};}function respondWithFilteredResult(_0x4c2d9a,_0x42955c){return function(_0x1cd32c){if(_0x1cd32c){var _0x2a10cf=_0x1cd32c[_0xe627('0x2a')],_0x28f862=_0x42955c['offset'],_0x4fdbde=_0x42955c['offset']+_0x42955c[_0xe627('0x2b')],_0x984c32;if(_0x4fdbde>=_0x2a10cf){_0x4fdbde=_0x2a10cf;_0x984c32=0xc8;}else{_0x984c32=0xce;}_0x4c2d9a['status'](_0x984c32);return _0x4c2d9a[_0xe627('0x2c')](_0xe627('0x2d'),_0x28f862+'-'+_0x4fdbde+'/'+_0x2a10cf)['json'](_0x1cd32c);}return null;};}function patchUpdates(_0x4eae59){return function(_0x3d21c2){try{jsonpatch[_0xe627('0x2e')](_0x3d21c2,_0x4eae59,!![]);}catch(_0x276a5d){return BPromise[_0xe627('0x2f')](_0x276a5d);}return _0x3d21c2[_0xe627('0x30')]();};}function saveUpdates(_0x4bb26e,_0x1fa3af){return function(_0x124002){if(_0x124002){return _0x124002['update'](_0x4bb26e)[_0xe627('0x1d')](function(_0x5f0ef7){return _0x5f0ef7;});}return null;};}function removeEntity(_0x108e9d,_0x1de84c){return function(_0x481223){if(_0x481223){return _0x481223[_0xe627('0x31')]()['then'](function(){_0x108e9d[_0xe627('0x28')](0xcc)[_0xe627('0x29')]();});}};}function handleEntityNotFound(_0x1db414,_0x14eb96){return function(_0x4cfb08){if(!_0x4cfb08){_0x1db414['sendStatus'](0x194);}return _0x4cfb08;};}function handleError(_0x46e1c4,_0x3899ef){_0x3899ef=_0x3899ef||0x1f4;return function(_0x12ba50){logger[_0xe627('0x20')](_0x12ba50[_0xe627('0x32')]);if(_0x12ba50['name']){delete _0x12ba50['name'];}_0x46e1c4['status'](_0x3899ef)[_0xe627('0x33')](_0x12ba50);};}exports[_0xe627('0x34')]=function(_0x19743c,_0x2924eb){var _0x109f89={},_0x4be789={},_0x3d5382={'count':0x0,'rows':[]};var _0x3e889e=_['map'](db['VtigerAccount']['rawAttributes'],function(_0x1fe334){return{'name':_0x1fe334[_0xe627('0x35')],'type':_0x1fe334[_0xe627('0x36')][_0xe627('0x37')]};});_0x4be789[_0xe627('0x38')]=_[_0xe627('0x39')](_0x3e889e,_0xe627('0x3a'));_0x4be789[_0xe627('0x3b')]=_['keys'](_0x19743c[_0xe627('0x3b')]);_0x4be789[_0xe627('0x3c')]=_['intersection'](_0x4be789[_0xe627('0x38')],_0x4be789[_0xe627('0x3b')]);_0x109f89['attributes']=_[_0xe627('0x3d')](_0x4be789[_0xe627('0x38')],qs[_0xe627('0x3e')](_0x19743c[_0xe627('0x3b')]['fields']));_0x109f89[_0xe627('0x3f')]=_0x109f89[_0xe627('0x3f')][_0xe627('0x40')]?_0x109f89[_0xe627('0x3f')]:_0x4be789[_0xe627('0x38')];if(!_0x19743c[_0xe627('0x3b')][_0xe627('0x41')](_0xe627('0x42'))){_0x109f89['limit']=qs['limit'](_0x19743c['query'][_0xe627('0x2b')]);_0x109f89[_0xe627('0x43')]=qs[_0xe627('0x43')](_0x19743c[_0xe627('0x3b')][_0xe627('0x43')]);}_0x109f89['order']=qs[_0xe627('0x44')](_0x19743c[_0xe627('0x3b')][_0xe627('0x44')]);_0x109f89['where']=qs[_0xe627('0x3c')](_[_0xe627('0x45')](_0x19743c[_0xe627('0x3b')],_0x4be789[_0xe627('0x3c')]),_0x3e889e);if(_0x19743c[_0xe627('0x3b')][_0xe627('0x46')]){_0x109f89['where']=_[_0xe627('0x47')](_0x109f89[_0xe627('0x48')],{'$or':_['map'](_0x3e889e,function(_0x166296){if(_0x166296[_0xe627('0x36')]!=='VIRTUAL'){var _0x43d6ac={};_0x43d6ac[_0x166296[_0xe627('0x3a')]]={'$like':'%'+_0x19743c[_0xe627('0x3b')][_0xe627('0x46')]+'%'};return _0x43d6ac;}})});}_0x109f89=_[_0xe627('0x47')]({},_0x109f89,_0x19743c[_0xe627('0x49')]);var _0x4689f3={'where':_0x109f89[_0xe627('0x48')]};return db['VtigerAccount'][_0xe627('0x2a')](_0x4689f3)['then'](function(_0x2aedbf){_0x3d5382[_0xe627('0x2a')]=_0x2aedbf;if(_0x19743c['query'][_0xe627('0x4a')]){_0x109f89[_0xe627('0x4b')]=[{'all':!![]}];}return db[_0xe627('0x4c')][_0xe627('0x4d')](_0x109f89);})[_0xe627('0x1d')](function(_0x18d1a0){_0x3d5382[_0xe627('0x4e')]=_0x18d1a0;return _0x3d5382;})[_0xe627('0x1d')](respondWithFilteredResult(_0x2924eb,_0x109f89))[_0xe627('0x26')](handleError(_0x2924eb,null));};exports[_0xe627('0x4f')]=function(_0x27c16d,_0x298bb1){var _0x24521d={'raw':![],'where':{'id':_0x27c16d[_0xe627('0x50')]['id']}},_0x48cbd9={};_0x48cbd9[_0xe627('0x38')]=_[_0xe627('0x51')](db['VtigerAccount']['rawAttributes']);_0x48cbd9[_0xe627('0x3b')]=_[_0xe627('0x51')](_0x27c16d[_0xe627('0x3b')]);_0x48cbd9[_0xe627('0x3c')]=_[_0xe627('0x3d')](_0x48cbd9['model'],_0x48cbd9[_0xe627('0x3b')]);_0x24521d[_0xe627('0x3f')]=_[_0xe627('0x3d')](_0x48cbd9['model'],qs[_0xe627('0x3e')](_0x27c16d[_0xe627('0x3b')][_0xe627('0x3e')]));_0x24521d[_0xe627('0x3f')]=_0x24521d[_0xe627('0x3f')]['length']?_0x24521d['attributes']:_0x48cbd9[_0xe627('0x38')];if(_0x27c16d['query'][_0xe627('0x4a')]){_0x24521d[_0xe627('0x4b')]=[{'all':!![]}];}_0x24521d=_[_0xe627('0x47')]({},_0x24521d,_0x27c16d['options']);return db['VtigerAccount'][_0xe627('0x52')](_0x24521d)['then'](handleEntityNotFound(_0x298bb1,null))[_0xe627('0x1d')](respondWithResult(_0x298bb1,null))[_0xe627('0x26')](handleError(_0x298bb1,null));};exports[_0xe627('0x53')]=function(_0x2f3eaf,_0x31f0e9){return db[_0xe627('0x4c')]['create'](_0x2f3eaf['body'],{})[_0xe627('0x1d')](respondWithResult(_0x31f0e9,0xc9))[_0xe627('0x26')](handleError(_0x31f0e9,null));};exports[_0xe627('0x54')]=function(_0x21a79d,_0x2e6aae){if(_0x21a79d['body']['id']){delete _0x21a79d['body']['id'];}return db[_0xe627('0x4c')][_0xe627('0x52')]({'where':{'id':_0x21a79d[_0xe627('0x50')]['id']}})['then'](handleEntityNotFound(_0x2e6aae,null))[_0xe627('0x1d')](saveUpdates(_0x21a79d[_0xe627('0x55')],null))['then'](respondWithResult(_0x2e6aae,null))[_0xe627('0x26')](handleError(_0x2e6aae,null));};exports['destroy']=function(_0x4e0d7b,_0x278be0){return db[_0xe627('0x4c')][_0xe627('0x52')]({'where':{'id':_0x4e0d7b['params']['id']}})[_0xe627('0x1d')](handleEntityNotFound(_0x278be0,null))[_0xe627('0x1d')](removeEntity(_0x278be0,null))['catch'](handleError(_0x278be0,null));};exports['getConfigurations']=function(_0xb769ad,_0x362e0a,_0x5510bf){var _0x56def2={};var _0x300a56={};var _0x2a1156;var _0xe95141;return db['VtigerAccount'][_0xe627('0x56')]({'where':{'id':_0xb769ad[_0xe627('0x50')]['id']}})['then'](handleEntityNotFound(_0x362e0a,null))[_0xe627('0x1d')](function(_0x42b5e8){if(_0x42b5e8){_0x2a1156=_0x42b5e8;_0x300a56[_0xe627('0x38')]=_[_0xe627('0x51')](db[_0xe627('0x57')][_0xe627('0x58')]);_0x300a56[_0xe627('0x3b')]=_[_0xe627('0x51')](_0xb769ad[_0xe627('0x3b')]);_0x300a56[_0xe627('0x3c')]=_[_0xe627('0x3d')](_0x300a56[_0xe627('0x38')],_0x300a56['query']);_0x56def2[_0xe627('0x3f')]=_[_0xe627('0x3d')](_0x300a56[_0xe627('0x38')],qs[_0xe627('0x3e')](_0xb769ad[_0xe627('0x3b')][_0xe627('0x3e')]));_0x56def2[_0xe627('0x3f')]=_0x56def2['attributes']['length']?_0x56def2[_0xe627('0x3f')]:_0x300a56['model'];_0x56def2[_0xe627('0x59')]=qs[_0xe627('0x44')](_0xb769ad[_0xe627('0x3b')][_0xe627('0x44')]);_0x56def2['where']=qs[_0xe627('0x3c')](_[_0xe627('0x45')](_0xb769ad['query'],_0x300a56[_0xe627('0x3c')]));if(_0xb769ad[_0xe627('0x3b')][_0xe627('0x46')]){_0x56def2[_0xe627('0x48')]=_['merge'](_0x56def2['where'],{'$or':_[_0xe627('0x39')](_0x56def2[_0xe627('0x3f')],function(_0x2a0398){var _0x59f82f={};_0x59f82f[_0x2a0398]={'$like':'%'+_0xb769ad[_0xe627('0x3b')][_0xe627('0x46')]+'%'};return _0x59f82f;})});}_0x56def2=_[_0xe627('0x47')]({},_0x56def2,_0xb769ad[_0xe627('0x49')]);return _0x2a1156['getConfigurations'](_0x56def2);}})[_0xe627('0x1d')](function(_0x57f99e){if(_0x57f99e){_0xe95141=_0x57f99e[_0xe627('0x40')];if(!_0xb769ad[_0xe627('0x3b')][_0xe627('0x41')](_0xe627('0x42'))){_0x56def2[_0xe627('0x2b')]=qs[_0xe627('0x2b')](_0xb769ad['query'][_0xe627('0x2b')]);_0x56def2[_0xe627('0x43')]=qs[_0xe627('0x43')](_0xb769ad['query'][_0xe627('0x43')]);}return _0x2a1156[_0xe627('0x5a')](_0x56def2);}})[_0xe627('0x1d')](function(_0x1b9bd8){if(_0x1b9bd8){return _0x1b9bd8?{'count':_0xe95141,'rows':_0x1b9bd8}:null;}})['then'](respondWithResult(_0x362e0a,null))[_0xe627('0x26')](handleError(_0x362e0a,null));};exports[_0xe627('0x5b')]=function(_0x1b1d07,_0x2f402f,_0x37094f){if(_0x1b1d07[_0xe627('0x55')]['id']){delete _0x1b1d07['body']['id'];}return db[_0xe627('0x4c')][_0xe627('0x56')]({'where':{'id':_0x1b1d07[_0xe627('0x50')]['id']}})[_0xe627('0x1d')](handleEntityNotFound(_0x2f402f,null))['then'](function(_0x4dc106){if(_0x4dc106){_0x1b1d07[_0xe627('0x55')][_0xe627('0x5c')]=_0x4dc106['id'];_0x1b1d07[_0xe627('0x55')]['Subjects']=integrations[_0xe627('0x5d')](_0x1b1d07[_0xe627('0x55')]['channel'],_0x1b1d07[_0xe627('0x55')][_0xe627('0x36')]);_0x1b1d07['body'][_0xe627('0x5e')]=integrations[_0xe627('0x5f')](_0x1b1d07['body'][_0xe627('0x60')],_0x1b1d07[_0xe627('0x55')]['type']);return db[_0xe627('0x57')][_0xe627('0x53')](_0x1b1d07[_0xe627('0x55')],{'include':[{'model':db['VtigerField'],'as':_0xe627('0x61')},{'model':db[_0xe627('0x62')],'as':'Descriptions'}]});}return null;})[_0xe627('0x1d')](respondWithResult(_0x2f402f,null))['catch'](handleError(_0x2f402f,null));};var md5=require(_0xe627('0x63'));exports[_0xe627('0x64')]=function(_0x42967c,_0x53d91c,_0xdbeed9){var _0x2611cf=null;var _0xd9f245=null;var _0x56cd63=null;var _0x5e927f=null;var _0x91c4c9='';return db[_0xe627('0x4c')][_0xe627('0x56')]({'where':{'id':_0x42967c['params']['id']},'attributes':['id',_0xe627('0x3a'),_0xe627('0x65'),_0xe627('0x66'),_0xe627('0x67'),_0xe627('0x68'),'serverUrl',_0xe627('0x69')]})[_0xe627('0x1d')](handleEntityNotFound(_0x53d91c,null))['then'](function(_0x496a07){if(_0x496a07){_0x2611cf=_0x496a07[_0xe627('0x65')];_0xd9f245=_0x496a07[_0xe627('0x69')];_0x56cd63=_0x496a07[_0xe627('0x67')];_0x91c4c9=_0x496a07[_0xe627('0x68')];var _0x60e34=_0x91c4c9[_0xe627('0x6a')](-0x1);if(_0x60e34==='/'){_0x91c4c9=_0x91c4c9[_0xe627('0x6b')](0x0,_0x91c4c9[_0xe627('0x6c')](_0x60e34));}_0x5e927f=util[_0xe627('0x6d')](_0xe627('0x6e'),_0x91c4c9);var _0x5b9b86={'method':'GET','uri':_0x5e927f,'qs':{'operation':_0xe627('0x6f'),'username':_0x496a07['username']},'json':!![]};return rp(_0x5b9b86);}})[_0xe627('0x1d')](function(_0x5e91ca){if(_0x5e91ca[_0xe627('0x70')]){var _0x444cb4={'method':'POST','uri':_0x5e927f,'form':{'operation':_0xe627('0x71'),'username':_0x2611cf,'accessKey':md5(_0x5e91ca[_0xe627('0x25')][_0xe627('0x72')]+_0xd9f245)},'json':!![]};return rp(_0x444cb4);}})[_0xe627('0x1d')](function(_0x54aab8){if(_0x54aab8['success']){var _0x840692={'method':'GET','uri':_0x5e927f,'qs':{'operation':_0xe627('0x73'),'username':_0x2611cf,'sessionName':_0x54aab8[_0xe627('0x25')][_0xe627('0x74')],'elementType':_0x56cd63},'json':!![]};return rp(_0x840692);}})['then'](function(_0xcc7335){if(_0xcc7335[_0xe627('0x70')]){var _0x1429a2=[_0xe627('0x75'),_0xe627('0x76'),_0xe627('0x77')];_[_0xe627('0x78')](_0xcc7335[_0xe627('0x25')][_0xe627('0x3e')],function(_0x26465d){return _0x1429a2[_0xe627('0x79')](_0x26465d['type'][_0xe627('0x3a')]);});_[_0xe627('0x78')](_0xcc7335['result']['fields'],function(_0x2720ac){return _0x2720ac[_0xe627('0x7a')]==='false';});return{'count':_0xcc7335[_0xe627('0x25')]['fields']['length'],'rows':_[_0xe627('0x39')](_0xcc7335[_0xe627('0x25')][_0xe627('0x3e')],function(_0x170a7b){return{'id':_0x170a7b[_0xe627('0x3a')],'name':_0x170a7b[_0xe627('0x7b')],'custom':_[_0xe627('0x7c')](_0x170a7b['name'],_0xe627('0x7d'))?!![]:![],'options':_0x170a7b['type'][_0xe627('0x3a')]===_0xe627('0x7e')&&_0x170a7b[_0xe627('0x36')][_0xe627('0x7f')]['length']>0x0?_[_0xe627('0x39')](_0x170a7b['type'][_0xe627('0x7f')],function(_0x4790d4){return{'name':_0x4790d4[_0xe627('0x7b')],'value':_0x4790d4[_0xe627('0x80')]};}):[]};})};}})[_0xe627('0x1d')](respondWithResult(_0x53d91c,null))[_0xe627('0x26')](function(_0x1fe293){console[_0xe627('0x81')]('vTiger\x20error:\x20'+_0x1fe293);var _0x26e1e0=_0x42967c[_0xe627('0x3b')][_0xe627('0x19')]?0x1f4:_0x1fe293[_0xe627('0x82')]||0x1f4;logger[_0xe627('0x20')](_0xe627('0x83'),_0xe627('0x64'),_0x26e1e0,JSON[_0xe627('0x1f')](_0x1fe293));delete _0x1fe293[_0xe627('0x3a')];if(_0x26e1e0===0x191){_0x26e1e0=0x190;}_0x53d91c[_0xe627('0x28')](_0x26e1e0)['send'](_0x42967c['query'][_0xe627('0x19')]?{'message':'Wrong\x20credentials','statusCode':_0x1fe293[_0xe627('0x82')]}:_0x1fe293);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f8dd6b6..aa4e5bf 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 _0xf3fa=['request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','define','int_vtiger_accounts','lodash','util','api'];(function(_0x5d67c7,_0x52f115){var _0x54401f=function(_0x237077){while(--_0x237077){_0x5d67c7['push'](_0x5d67c7['shift']());}};_0x54401f(++_0x52f115);}(_0xf3fa,0x8d));var _0xaf3f=function(_0x51c39f,_0x5bfb0b){_0x51c39f=_0x51c39f-0x0;var _0x274221=_0xf3fa[_0x51c39f];return _0x274221;};'use strict';var _=require(_0xaf3f('0x0'));var util=require(_0xaf3f('0x1'));var logger=require('../../config/logger')(_0xaf3f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaf3f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf3f('0x4'));var config=require(_0xaf3f('0x5'));var attributes=require(_0xaf3f('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x274f51,_0xff7d2b){return _0x274f51[_0xaf3f('0x7')]('VtigerAccount',attributes,{'tableName':_0xaf3f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc304=['exports','define','VtigerAccount','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x4b0946,_0x19ea1e){var _0x402989=function(_0x388500){while(--_0x388500){_0x4b0946['push'](_0x4b0946['shift']());}};_0x402989(++_0x19ea1e);}(_0xc304,0xdb));var _0x4c30=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xc304[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x4c30('0x0'));var util=require(_0x4c30('0x1'));var logger=require(_0x4c30('0x2'))(_0x4c30('0x3'));var moment=require(_0x4c30('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c30('0x5'));var rimraf=require(_0x4c30('0x6'));var config=require(_0x4c30('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x4c30('0x8'));module[_0x4c30('0x9')]=function(_0x3149d3,_0xf20128){return _0x3149d3[_0x4c30('0xa')](_0x4c30('0xb'),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 d6f3664..757d691 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 _0x731e=['error','code','message','findAll','options','raw','where','limit','include','map','model','attributes','GetVtigerAccount','debug','ShowVtigerAccount','VtigerAccount','find','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1f8974,_0x1cf003){var _0x28a046=function(_0x1edabd){while(--_0x1edabd){_0x1f8974['push'](_0x1f8974['shift']());}};_0x28a046(++_0x1cf003);}(_0x731e,0x198));var _0xe731=function(_0x3e0c78,_0x347a58){_0x3e0c78=_0x3e0c78-0x0;var _0x201901=_0x731e[_0x3e0c78];return _0x201901;};'use strict';var _=require(_0xe731('0x0'));var util=require(_0xe731('0x1'));var moment=require('moment');var BPromise=require(_0xe731('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe731('0x3'))['db'];var utils=require(_0xe731('0x4'));var logger=require('../../config/logger')(_0xe731('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe731('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1b3d6f,_0x13ea51,_0x15a287){return new BPromise(function(_0x31fe18,_0x36cbdf){return client['request'](_0x1b3d6f,_0x15a287)[_0xe731('0x7')](function(_0x47a98b){logger[_0xe731('0x8')](_0xe731('0x9'),_0x13ea51,_0xe731('0xa'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x13ea51,_0xe731('0xa'),JSON[_0xe731('0xb')](_0x47a98b));if(_0x47a98b[_0xe731('0xc')]){if(_0x47a98b[_0xe731('0xc')][_0xe731('0xd')]===0x1f4){logger[_0xe731('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x13ea51,_0x47a98b[_0xe731('0xc')][_0xe731('0xe')]);return _0x36cbdf(_0x47a98b[_0xe731('0xc')][_0xe731('0xe')]);}logger[_0xe731('0xc')](_0xe731('0x9'),_0x13ea51,_0x47a98b[_0xe731('0xc')][_0xe731('0xe')]);return _0x31fe18(_0x47a98b[_0xe731('0xc')][_0xe731('0xe')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x13ea51,'request\x20sent');_0x31fe18(_0x47a98b['result'][_0xe731('0xe')]);}})['catch'](function(_0x2743e2){logger[_0xe731('0xc')](_0xe731('0x9'),_0x13ea51,_0x2743e2);_0x36cbdf(_0x2743e2);});});}exports['GetVtigerAccount']=function(_0x5e166f){var _0x5f1969=this;return new Promise(function(_0x45b7a4,_0x598a02){return db['VtigerAccount'][_0xe731('0xf')]({'raw':_0x5e166f[_0xe731('0x10')]?_0x5e166f[_0xe731('0x10')][_0xe731('0x11')]===undefined?!![]:![]:!![],'where':_0x5e166f[_0xe731('0x10')]?_0x5e166f['options'][_0xe731('0x12')]||null:null,'attributes':_0x5e166f[_0xe731('0x10')]?_0x5e166f[_0xe731('0x10')]['attributes']||null:null,'limit':_0x5e166f['options']?_0x5e166f['options'][_0xe731('0x13')]||null:null,'include':_0x5e166f['options']?_0x5e166f[_0xe731('0x10')][_0xe731('0x14')]?_[_0xe731('0x15')](_0x5e166f[_0xe731('0x10')][_0xe731('0x14')],function(_0x3e5693){return{'model':db[_0x3e5693[_0xe731('0x16')]],'as':_0x3e5693['as'],'attributes':_0x3e5693['attributes'],'include':_0x3e5693[_0xe731('0x14')]?_[_0xe731('0x15')](_0x3e5693[_0xe731('0x14')],function(_0x35b875){return{'model':db[_0x35b875['model']],'as':_0x35b875['as'],'attributes':_0x35b875['attributes'],'include':_0x35b875[_0xe731('0x14')]?_['map'](_0x35b875[_0xe731('0x14')],function(_0x351c20){return{'model':db[_0x351c20['model']],'as':_0x351c20['as'],'attributes':_0x351c20[_0xe731('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe731('0x7')](function(_0xae06bb){logger[_0xe731('0x8')](_0xe731('0x18'),_0x5e166f);logger[_0xe731('0x19')](_0xe731('0x18'),_0x5e166f,JSON[_0xe731('0xb')](_0xae06bb));_0x45b7a4(_0xae06bb);})['catch'](function(_0x5c23ad){logger[_0xe731('0xc')]('GetVtigerAccount',_0x5c23ad[_0xe731('0xe')],_0x5e166f);_0x598a02(_0x5f1969[_0xe731('0xc')](0x1f4,_0x5c23ad[_0xe731('0xe')]));});});};exports[_0xe731('0x1a')]=function(_0x5607fa){var _0x478c06=this;return new Promise(function(_0x4129dd,_0x1d3ff8){return db[_0xe731('0x1b')][_0xe731('0x1c')]({'raw':_0x5607fa['options']?_0x5607fa[_0xe731('0x10')][_0xe731('0x11')]===undefined?!![]:![]:!![],'where':_0x5607fa['options']?_0x5607fa[_0xe731('0x10')][_0xe731('0x12')]||null:null,'attributes':_0x5607fa['options']?_0x5607fa[_0xe731('0x10')][_0xe731('0x17')]||null:null,'include':_0x5607fa[_0xe731('0x10')]?_0x5607fa[_0xe731('0x10')][_0xe731('0x14')]?_['map'](_0x5607fa['options'][_0xe731('0x14')],function(_0x10ba2d){return{'model':db[_0x10ba2d[_0xe731('0x16')]],'as':_0x10ba2d['as'],'attributes':_0x10ba2d['attributes'],'include':_0x10ba2d['include']?_['map'](_0x10ba2d[_0xe731('0x14')],function(_0x11b482){return{'model':db[_0x11b482['model']],'as':_0x11b482['as'],'attributes':_0x11b482['attributes'],'include':_0x11b482[_0xe731('0x14')]?_[_0xe731('0x15')](_0x11b482[_0xe731('0x14')],function(_0xc7bb69){return{'model':db[_0xc7bb69[_0xe731('0x16')]],'as':_0xc7bb69['as'],'attributes':_0xc7bb69[_0xe731('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe731('0x7')](function(_0x218d46){logger['info']('ShowVtigerAccount',_0x5607fa);logger[_0xe731('0x19')](_0xe731('0x1a'),_0x5607fa,JSON[_0xe731('0xb')](_0x218d46));_0x4129dd(_0x218d46);})[_0xe731('0x1d')](function(_0x54e502){logger[_0xe731('0xc')](_0xe731('0x1a'),_0x54e502[_0xe731('0xe')],_0x5607fa);_0x1d3ff8(_0x478c06[_0xe731('0xc')](0x1f4,_0x54e502[_0xe731('0xe')]));});});}; \ No newline at end of file +var _0xb9b5=['model','then','stringify','find','ShowVtigerAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','attributes','include','map'];(function(_0x28d867,_0x3898db){var _0x2d2a1f=function(_0x59c447){while(--_0x59c447){_0x28d867['push'](_0x28d867['shift']());}};_0x2d2a1f(++_0x3898db);}(_0xb9b5,0xd1));var _0x5b9b=function(_0x4c321c,_0x3e9da0){_0x4c321c=_0x4c321c-0x0;var _0x25accb=_0xb9b5[_0x4c321c];return _0x25accb;};'use strict';var _=require(_0x5b9b('0x0'));var util=require('util');var moment=require(_0x5b9b('0x1'));var BPromise=require(_0x5b9b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b9b('0x3'));var db=require(_0x5b9b('0x4'))['db'];var utils=require(_0x5b9b('0x5'));var logger=require(_0x5b9b('0x6'))(_0x5b9b('0x7'));var config=require(_0x5b9b('0x8'));var jayson=require(_0x5b9b('0x9'));var client=jayson[_0x5b9b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b7f5e,_0x103aa8,_0x113a8e){return new BPromise(function(_0x138993,_0x5e61d2){return client[_0x5b9b('0xb')](_0x1b7f5e,_0x113a8e)['then'](function(_0x56f552){logger[_0x5b9b('0xc')](_0x5b9b('0xd'),_0x103aa8,_0x5b9b('0xe'));logger[_0x5b9b('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x103aa8,_0x5b9b('0xe'),JSON['stringify'](_0x56f552));if(_0x56f552[_0x5b9b('0x10')]){if(_0x56f552[_0x5b9b('0x10')][_0x5b9b('0x11')]===0x1f4){logger[_0x5b9b('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x103aa8,_0x56f552[_0x5b9b('0x10')][_0x5b9b('0x12')]);return _0x5e61d2(_0x56f552[_0x5b9b('0x10')][_0x5b9b('0x12')]);}logger[_0x5b9b('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x103aa8,_0x56f552[_0x5b9b('0x10')][_0x5b9b('0x12')]);return _0x138993(_0x56f552[_0x5b9b('0x10')][_0x5b9b('0x12')]);}else{logger[_0x5b9b('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x103aa8,_0x5b9b('0xe'));_0x138993(_0x56f552[_0x5b9b('0x13')][_0x5b9b('0x12')]);}})[_0x5b9b('0x14')](function(_0xde145f){logger[_0x5b9b('0x10')](_0x5b9b('0xd'),_0x103aa8,_0xde145f);_0x5e61d2(_0xde145f);});});}exports[_0x5b9b('0x15')]=function(_0x4664ec){var _0xc7d8c6=this;return new Promise(function(_0x50d15f,_0x200105){return db[_0x5b9b('0x16')]['findAll']({'raw':_0x4664ec[_0x5b9b('0x17')]?_0x4664ec[_0x5b9b('0x17')][_0x5b9b('0x18')]===undefined?!![]:![]:!![],'where':_0x4664ec['options']?_0x4664ec[_0x5b9b('0x17')][_0x5b9b('0x19')]||null:null,'attributes':_0x4664ec[_0x5b9b('0x17')]?_0x4664ec[_0x5b9b('0x17')][_0x5b9b('0x1a')]||null:null,'limit':_0x4664ec[_0x5b9b('0x17')]?_0x4664ec[_0x5b9b('0x17')]['limit']||null:null,'include':_0x4664ec['options']?_0x4664ec['options'][_0x5b9b('0x1b')]?_[_0x5b9b('0x1c')](_0x4664ec[_0x5b9b('0x17')][_0x5b9b('0x1b')],function(_0x1bdc4e){return{'model':db[_0x1bdc4e[_0x5b9b('0x1d')]],'as':_0x1bdc4e['as'],'attributes':_0x1bdc4e[_0x5b9b('0x1a')],'include':_0x1bdc4e[_0x5b9b('0x1b')]?_['map'](_0x1bdc4e[_0x5b9b('0x1b')],function(_0x3eee5b){return{'model':db[_0x3eee5b[_0x5b9b('0x1d')]],'as':_0x3eee5b['as'],'attributes':_0x3eee5b[_0x5b9b('0x1a')],'include':_0x3eee5b[_0x5b9b('0x1b')]?_[_0x5b9b('0x1c')](_0x3eee5b[_0x5b9b('0x1b')],function(_0x2bbe58){return{'model':db[_0x2bbe58[_0x5b9b('0x1d')]],'as':_0x2bbe58['as'],'attributes':_0x2bbe58[_0x5b9b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5b9b('0x1e')](function(_0x24fa54){logger[_0x5b9b('0xc')](_0x5b9b('0x15'),_0x4664ec);logger[_0x5b9b('0xf')]('GetVtigerAccount',_0x4664ec,JSON[_0x5b9b('0x1f')](_0x24fa54));_0x50d15f(_0x24fa54);})['catch'](function(_0x5126d3){logger['error'](_0x5b9b('0x15'),_0x5126d3[_0x5b9b('0x12')],_0x4664ec);_0x200105(_0xc7d8c6[_0x5b9b('0x10')](0x1f4,_0x5126d3[_0x5b9b('0x12')]));});});};exports['ShowVtigerAccount']=function(_0xe13188){var _0x4b85d3=this;return new Promise(function(_0x2214c4,_0xa215e0){return db[_0x5b9b('0x16')][_0x5b9b('0x20')]({'raw':_0xe13188[_0x5b9b('0x17')]?_0xe13188[_0x5b9b('0x17')][_0x5b9b('0x18')]===undefined?!![]:![]:!![],'where':_0xe13188[_0x5b9b('0x17')]?_0xe13188[_0x5b9b('0x17')][_0x5b9b('0x19')]||null:null,'attributes':_0xe13188[_0x5b9b('0x17')]?_0xe13188[_0x5b9b('0x17')]['attributes']||null:null,'include':_0xe13188[_0x5b9b('0x17')]?_0xe13188[_0x5b9b('0x17')][_0x5b9b('0x1b')]?_['map'](_0xe13188[_0x5b9b('0x17')][_0x5b9b('0x1b')],function(_0x12ec68){return{'model':db[_0x12ec68[_0x5b9b('0x1d')]],'as':_0x12ec68['as'],'attributes':_0x12ec68[_0x5b9b('0x1a')],'include':_0x12ec68[_0x5b9b('0x1b')]?_[_0x5b9b('0x1c')](_0x12ec68['include'],function(_0x250f8a){return{'model':db[_0x250f8a[_0x5b9b('0x1d')]],'as':_0x250f8a['as'],'attributes':_0x250f8a['attributes'],'include':_0x250f8a['include']?_['map'](_0x250f8a[_0x5b9b('0x1b')],function(_0x178713){return{'model':db[_0x178713[_0x5b9b('0x1d')]],'as':_0x178713['as'],'attributes':_0x178713[_0x5b9b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5b9b('0x1e')](function(_0xe4dc2c){logger['info']('ShowVtigerAccount',_0xe13188);logger[_0x5b9b('0xf')](_0x5b9b('0x21'),_0xe13188,JSON['stringify'](_0xe4dc2c));_0x2214c4(_0xe4dc2c);})[_0x5b9b('0x14')](function(_0x4665d5){logger[_0x5b9b('0x10')](_0x5b9b('0x21'),_0x4665d5[_0x5b9b('0x12')],_0xe13188);_0xa215e0(_0x4b85d3[_0x5b9b('0x10')](0x1f4,_0x4665d5['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index ba5bfcb..0b8f771 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getDescriptions','post','create'];(function(_0x1edbab,_0x1c9af3){var _0x57c56b=function(_0x3fc7dd){while(--_0x3fc7dd){_0x1edbab['push'](_0x1edbab['shift']());}};_0x57c56b(++_0x1c9af3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x340a3b,_0x27b82a){_0x340a3b=_0x340a3b-0x0;var _0x5104b6=_0x5f2f[_0x340a3b];return _0x5104b6;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getSubjects']);router[_0xf5f2('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0xf')]('/',auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router[_0xf5f2('0x11')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x479650,_0x2bee99){var _0x26b288=function(_0x1ba49f){while(--_0x1ba49f){_0x479650['push'](_0x479650['shift']());}};_0x26b288(++_0x2bee99);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 2c0cba8..d599b78 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 _0x80cd=['exports','STRING','sequelize'];(function(_0x36efe1,_0x10ca5b){var _0x3127c3=function(_0x52c7b){while(--_0x52c7b){_0x36efe1['push'](_0x36efe1['shift']());}};_0x3127c3(++_0x10ca5b);}(_0x80cd,0xfb));var _0xd80c=function(_0x178668,_0x1ec300){_0x178668=_0x178668-0x0;var _0x26107d=_0x80cd[_0x178668];return _0x26107d;};'use strict';var Sequelize=require(_0xd80c('0x0'));module[_0xd80c('0x1')]={'name':{'type':Sequelize[_0xd80c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x56b5=['STRING'];(function(_0x29367d,_0x9f08da){var _0x2acac8=function(_0x22bfc5){while(--_0x22bfc5){_0x29367d['push'](_0x29367d['shift']());}};_0x2acac8(++_0x9f08da);}(_0x56b5,0x1d4));var _0x556b=function(_0x5a0b58,_0x4f8e6e){_0x5a0b58=_0x5a0b58-0x0;var _0x110d33=_0x56b5[_0x5a0b58];return _0x110d33;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x556b('0x0')]},'description':{'type':Sequelize[_0x556b('0x0')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 3df242b..d34038b 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 _0x5640=['info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','name','query','keys','filters','fields','length','attributes','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','create','body','find','VtigerField','intersection','hasOwnProperty','getFields','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','request','then'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x5640,0x1b0));var _0x0564=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5640[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0564('0x0'));var zipdir=require(_0x0564('0x1'));var jsonpatch=require(_0x0564('0x2'));var rp=require(_0x0564('0x3'));var moment=require(_0x0564('0x4'));var BPromise=require(_0x0564('0x5'));var Mustache=require('mustache');var util=require(_0x0564('0x6'));var path=require(_0x0564('0x7'));var sox=require('sox');var csv=require(_0x0564('0x8'));var ejs=require(_0x0564('0x9'));var fs=require('fs');var _=require(_0x0564('0xa'));var squel=require(_0x0564('0xb'));var crypto=require(_0x0564('0xc'));var jsforce=require(_0x0564('0xd'));var deskjs=require(_0x0564('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0564('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0564('0x10'));var as=require(_0x0564('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0564('0x12'))('api');var utils=require(_0x0564('0x13'));var config=require(_0x0564('0x14'));var db=require(_0x0564('0x15'))['db'];var jayson=require(_0x0564('0x16'));var client=jayson[_0x0564('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x500322,_0x109e2e,_0x5d3012){if(_0x5d3012){var _0x5bfb77=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5bfb77[_0x0564('0x18')](_0x109e2e)){return _0x500322;}else{throw new db[(_0x0564('0x19'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x500322;}}function respondWithRpcPromise(_0x4dbd81,_0x209cd4,_0xee21fc,_0x426a61){return new BPromise(function(_0xec3047,_0x3b911f){var _0x4d4ce6=_0x426a61||client;return _0x4d4ce6[_0x0564('0x1a')](_0x4dbd81,_0xee21fc)[_0x0564('0x1b')](function(_0x1e76d0){logger[_0x0564('0x1c')](_0x0564('0x1d'),_0x209cd4,_0x0564('0x1e'));logger[_0x0564('0x1f')](_0x0564('0x20'),_0x209cd4,_0x0564('0x1e'),JSON[_0x0564('0x21')](_0x1e76d0));if(_0x1e76d0[_0x0564('0x22')]){if(_0x1e76d0[_0x0564('0x22')][_0x0564('0x23')]===0x1f4){logger[_0x0564('0x22')]('VtigerConfiguration,\x20%s,\x20%s',_0x209cd4,_0x1e76d0[_0x0564('0x22')][_0x0564('0x24')]);return _0x3b911f(_0x1e76d0[_0x0564('0x22')]['message']);}logger[_0x0564('0x22')](_0x0564('0x1d'),_0x209cd4,_0x1e76d0[_0x0564('0x22')][_0x0564('0x24')]);return _0xec3047(_0x1e76d0['error'][_0x0564('0x24')]);}else{logger[_0x0564('0x1c')](_0x0564('0x1d'),_0x209cd4,_0x0564('0x1e'));_0xec3047(_0x1e76d0['result'][_0x0564('0x24')]);}})[_0x0564('0x25')](function(_0x2b316d){logger[_0x0564('0x22')](_0x0564('0x1d'),_0x209cd4,_0x2b316d);_0x3b911f(_0x2b316d);});});}function respondWithStatusCode(_0x122ef2,_0x1b01d7){_0x1b01d7=_0x1b01d7||0xcc;return function(_0x1449bb){if(_0x1449bb){return _0x122ef2[_0x0564('0x26')](_0x1b01d7);}return _0x122ef2[_0x0564('0x27')](_0x1b01d7)[_0x0564('0x28')]();};}function respondWithResult(_0x23eb4f,_0x1d723a){_0x1d723a=_0x1d723a||0xc8;return function(_0x96c7b5){if(_0x96c7b5){return _0x23eb4f[_0x0564('0x27')](_0x1d723a)[_0x0564('0x29')](_0x96c7b5);}};}function respondWithFilteredResult(_0x19e909,_0x110a90){return function(_0x9baea1){if(_0x9baea1){var _0x4af737=_0x9baea1['count'],_0x37eec3=_0x110a90[_0x0564('0x2a')],_0x165940=_0x110a90[_0x0564('0x2a')]+_0x110a90[_0x0564('0x2b')],_0x5e829a;if(_0x165940>=_0x4af737){_0x165940=_0x4af737;_0x5e829a=0xc8;}else{_0x5e829a=0xce;}_0x19e909[_0x0564('0x27')](_0x5e829a);return _0x19e909['set'](_0x0564('0x2c'),_0x37eec3+'-'+_0x165940+'/'+_0x4af737)['json'](_0x9baea1);}return null;};}function patchUpdates(_0x15a9b4){return function(_0x40a706){try{jsonpatch[_0x0564('0x2d')](_0x40a706,_0x15a9b4,!![]);}catch(_0x68996){return BPromise[_0x0564('0x2e')](_0x68996);}return _0x40a706[_0x0564('0x2f')]();};}function saveUpdates(_0x152d19,_0x2d273e){return function(_0x3bd300){if(_0x3bd300){return _0x3bd300[_0x0564('0x30')](_0x152d19)[_0x0564('0x1b')](function(_0xfa562a){return _0xfa562a;});}return null;};}function removeEntity(_0x5034d2,_0x555884){return function(_0x1f8ba7){if(_0x1f8ba7){return _0x1f8ba7[_0x0564('0x31')]()['then'](function(){_0x5034d2[_0x0564('0x27')](0xcc)[_0x0564('0x28')]();});}};}function handleEntityNotFound(_0x1a59be,_0x31520e){return function(_0x40c61f){if(!_0x40c61f){_0x1a59be[_0x0564('0x26')](0x194);}return _0x40c61f;};}function handleError(_0x68362f,_0x34d99c){_0x34d99c=_0x34d99c||0x1f4;return function(_0x4da183){logger[_0x0564('0x22')](_0x4da183[_0x0564('0x32')]);if(_0x4da183['name']){delete _0x4da183['name'];}_0x68362f[_0x0564('0x27')](_0x34d99c)[_0x0564('0x33')](_0x4da183);};}exports[_0x0564('0x34')]=function(_0x49733b,_0x5d7113){var _0x1bf561={},_0x54eb8a={},_0x554e47={'count':0x0,'rows':[]};var _0x2725a2=_[_0x0564('0x35')](db[_0x0564('0x36')][_0x0564('0x37')],function(_0x1e7bee){return{'name':_0x1e7bee[_0x0564('0x38')],'type':_0x1e7bee[_0x0564('0x39')][_0x0564('0x3a')]};});_0x54eb8a[_0x0564('0x3b')]=_[_0x0564('0x35')](_0x2725a2,_0x0564('0x3c'));_0x54eb8a[_0x0564('0x3d')]=_[_0x0564('0x3e')](_0x49733b[_0x0564('0x3d')]);_0x54eb8a[_0x0564('0x3f')]=_['intersection'](_0x54eb8a[_0x0564('0x3b')],_0x54eb8a[_0x0564('0x3d')]);_0x1bf561['attributes']=_['intersection'](_0x54eb8a[_0x0564('0x3b')],qs[_0x0564('0x40')](_0x49733b['query'][_0x0564('0x40')]));_0x1bf561['attributes']=_0x1bf561['attributes'][_0x0564('0x41')]?_0x1bf561[_0x0564('0x42')]:_0x54eb8a[_0x0564('0x3b')];if(!_0x49733b[_0x0564('0x3d')]['hasOwnProperty'](_0x0564('0x43'))){_0x1bf561[_0x0564('0x2b')]=qs[_0x0564('0x2b')](_0x49733b[_0x0564('0x3d')][_0x0564('0x2b')]);_0x1bf561[_0x0564('0x2a')]=qs['offset'](_0x49733b[_0x0564('0x3d')][_0x0564('0x2a')]);}_0x1bf561[_0x0564('0x44')]=qs['sort'](_0x49733b['query'][_0x0564('0x45')]);_0x1bf561['where']=qs[_0x0564('0x3f')](_[_0x0564('0x46')](_0x49733b[_0x0564('0x3d')],_0x54eb8a[_0x0564('0x3f')]),_0x2725a2);if(_0x49733b['query']['filter']){_0x1bf561[_0x0564('0x47')]=_[_0x0564('0x48')](_0x1bf561[_0x0564('0x47')],{'$or':_[_0x0564('0x35')](_0x2725a2,function(_0x393b56){if(_0x393b56[_0x0564('0x39')]!==_0x0564('0x49')){var _0x38d6ac={};_0x38d6ac[_0x393b56['name']]={'$like':'%'+_0x49733b[_0x0564('0x3d')][_0x0564('0x4a')]+'%'};return _0x38d6ac;}})});}_0x1bf561=_[_0x0564('0x48')]({},_0x1bf561,_0x49733b[_0x0564('0x4b')]);var _0x2acab5={'where':_0x1bf561['where']};return db['VtigerConfiguration']['count'](_0x2acab5)[_0x0564('0x1b')](function(_0x5d1026){_0x554e47[_0x0564('0x4c')]=_0x5d1026;if(_0x49733b[_0x0564('0x3d')][_0x0564('0x4d')]){_0x1bf561[_0x0564('0x4e')]=[{'all':!![]}];}return db[_0x0564('0x36')][_0x0564('0x4f')](_0x1bf561);})[_0x0564('0x1b')](function(_0xdcfeb4){_0x554e47[_0x0564('0x50')]=_0xdcfeb4;return _0x554e47;})['then'](respondWithFilteredResult(_0x5d7113,_0x1bf561))[_0x0564('0x25')](handleError(_0x5d7113,null));};exports['show']=function(_0xf3e1e3,_0x138f43){var _0x46e493={'raw':![],'where':{'id':_0xf3e1e3[_0x0564('0x51')]['id']}},_0x47d783={};_0x47d783['model']=_[_0x0564('0x3e')](db[_0x0564('0x36')][_0x0564('0x37')]);_0x47d783[_0x0564('0x3d')]=_[_0x0564('0x3e')](_0xf3e1e3[_0x0564('0x3d')]);_0x47d783[_0x0564('0x3f')]=_['intersection'](_0x47d783[_0x0564('0x3b')],_0x47d783['query']);_0x46e493['attributes']=_['intersection'](_0x47d783[_0x0564('0x3b')],qs[_0x0564('0x40')](_0xf3e1e3[_0x0564('0x3d')][_0x0564('0x40')]));_0x46e493[_0x0564('0x42')]=_0x46e493[_0x0564('0x42')][_0x0564('0x41')]?_0x46e493[_0x0564('0x42')]:_0x47d783[_0x0564('0x3b')];if(_0xf3e1e3[_0x0564('0x3d')][_0x0564('0x4d')]){_0x46e493[_0x0564('0x4e')]=[{'all':!![]}];}_0x46e493=_['merge']({},_0x46e493,_0xf3e1e3[_0x0564('0x4b')]);return db[_0x0564('0x36')]['find'](_0x46e493)[_0x0564('0x1b')](handleEntityNotFound(_0x138f43,null))[_0x0564('0x1b')](respondWithResult(_0x138f43,null))['catch'](handleError(_0x138f43,null));};exports[_0x0564('0x52')]=function(_0x1fd419,_0x48b73b){return db[_0x0564('0x36')][_0x0564('0x52')](_0x1fd419[_0x0564('0x53')],{})[_0x0564('0x1b')](respondWithResult(_0x48b73b,0xc9))[_0x0564('0x25')](handleError(_0x48b73b,null));};exports[_0x0564('0x30')]=function(_0x46cf0d,_0x27cf8a){if(_0x46cf0d[_0x0564('0x53')]['id']){delete _0x46cf0d[_0x0564('0x53')]['id'];}return db[_0x0564('0x36')][_0x0564('0x54')]({'where':{'id':_0x46cf0d[_0x0564('0x51')]['id']}})['then'](handleEntityNotFound(_0x27cf8a,null))[_0x0564('0x1b')](saveUpdates(_0x46cf0d[_0x0564('0x53')],null))[_0x0564('0x1b')](respondWithResult(_0x27cf8a,null))[_0x0564('0x25')](handleError(_0x27cf8a,null));};exports[_0x0564('0x31')]=function(_0x34f0f7,_0x556a11){return db[_0x0564('0x36')][_0x0564('0x54')]({'where':{'id':_0x34f0f7[_0x0564('0x51')]['id']}})[_0x0564('0x1b')](handleEntityNotFound(_0x556a11,null))[_0x0564('0x1b')](removeEntity(_0x556a11,null))[_0x0564('0x25')](handleError(_0x556a11,null));};exports['getFields']=function(_0x36ce67,_0x2b976c,_0x525e0e){var _0x40bb56={};var _0x2df1a5={};var _0x5e8aa4;var _0x13f2b9;return db[_0x0564('0x36')]['findOne']({'where':{'id':_0x36ce67[_0x0564('0x51')]['id']}})[_0x0564('0x1b')](handleEntityNotFound(_0x2b976c,null))[_0x0564('0x1b')](function(_0x423292){if(_0x423292){_0x5e8aa4=_0x423292;_0x2df1a5[_0x0564('0x3b')]=_[_0x0564('0x3e')](db[_0x0564('0x55')]['rawAttributes']);_0x2df1a5[_0x0564('0x3d')]=_[_0x0564('0x3e')](_0x36ce67[_0x0564('0x3d')]);_0x2df1a5[_0x0564('0x3f')]=_[_0x0564('0x56')](_0x2df1a5[_0x0564('0x3b')],_0x2df1a5[_0x0564('0x3d')]);_0x40bb56['attributes']=_[_0x0564('0x56')](_0x2df1a5[_0x0564('0x3b')],qs['fields'](_0x36ce67['query'][_0x0564('0x40')]));_0x40bb56['attributes']=_0x40bb56[_0x0564('0x42')]['length']?_0x40bb56['attributes']:_0x2df1a5[_0x0564('0x3b')];_0x40bb56[_0x0564('0x44')]=qs['sort'](_0x36ce67[_0x0564('0x3d')][_0x0564('0x45')]);_0x40bb56['where']=qs[_0x0564('0x3f')](_[_0x0564('0x46')](_0x36ce67[_0x0564('0x3d')],_0x2df1a5[_0x0564('0x3f')]));if(_0x36ce67[_0x0564('0x3d')][_0x0564('0x4a')]){_0x40bb56['where']=_[_0x0564('0x48')](_0x40bb56[_0x0564('0x47')],{'$or':_[_0x0564('0x35')](_0x40bb56['attributes'],function(_0x3b2221){var _0x1f1068={};_0x1f1068[_0x3b2221]={'$like':'%'+_0x36ce67[_0x0564('0x3d')][_0x0564('0x4a')]+'%'};return _0x1f1068;})});}_0x40bb56=_[_0x0564('0x48')]({},_0x40bb56,_0x36ce67[_0x0564('0x4b')]);return _0x5e8aa4['getFields'](_0x40bb56);}})['then'](function(_0x2c8640){if(_0x2c8640){_0x13f2b9=_0x2c8640[_0x0564('0x41')];if(!_0x36ce67[_0x0564('0x3d')][_0x0564('0x57')](_0x0564('0x43'))){_0x40bb56[_0x0564('0x2b')]=qs['limit'](_0x36ce67[_0x0564('0x3d')][_0x0564('0x2b')]);_0x40bb56[_0x0564('0x2a')]=qs['offset'](_0x36ce67['query'][_0x0564('0x2a')]);}return _0x5e8aa4[_0x0564('0x58')](_0x40bb56);}})[_0x0564('0x1b')](function(_0x5bd365){if(_0x5bd365){return _0x5bd365?{'count':_0x13f2b9,'rows':_0x5bd365}:null;}})[_0x0564('0x1b')](respondWithResult(_0x2b976c,null))[_0x0564('0x25')](handleError(_0x2b976c,null));};exports[_0x0564('0x59')]=function(_0x5cf4de,_0x50355d,_0x859c1){var _0x4c4b82={};var _0xc6a431={};var _0x54d07b;var _0x15a690;return db[_0x0564('0x36')][_0x0564('0x5a')]({'where':{'id':_0x5cf4de[_0x0564('0x51')]['id']}})[_0x0564('0x1b')](handleEntityNotFound(_0x50355d,null))[_0x0564('0x1b')](function(_0x53639b){if(_0x53639b){_0x54d07b=_0x53639b;_0xc6a431[_0x0564('0x3b')]=_[_0x0564('0x3e')](db[_0x0564('0x55')][_0x0564('0x37')]);_0xc6a431['query']=_[_0x0564('0x3e')](_0x5cf4de[_0x0564('0x3d')]);_0xc6a431[_0x0564('0x3f')]=_[_0x0564('0x56')](_0xc6a431[_0x0564('0x3b')],_0xc6a431['query']);_0x4c4b82[_0x0564('0x42')]=_[_0x0564('0x56')](_0xc6a431[_0x0564('0x3b')],qs['fields'](_0x5cf4de[_0x0564('0x3d')][_0x0564('0x40')]));_0x4c4b82[_0x0564('0x42')]=_0x4c4b82['attributes'][_0x0564('0x41')]?_0x4c4b82[_0x0564('0x42')]:_0xc6a431[_0x0564('0x3b')];_0x4c4b82[_0x0564('0x44')]=qs['sort'](_0x5cf4de[_0x0564('0x3d')][_0x0564('0x45')]);_0x4c4b82[_0x0564('0x47')]=qs['filters'](_[_0x0564('0x46')](_0x5cf4de[_0x0564('0x3d')],_0xc6a431['filters']));if(_0x5cf4de[_0x0564('0x3d')][_0x0564('0x4a')]){_0x4c4b82['where']=_['merge'](_0x4c4b82[_0x0564('0x47')],{'$or':_['map'](_0x4c4b82['attributes'],function(_0x575817){var _0x5171db={};_0x5171db[_0x575817]={'$like':'%'+_0x5cf4de[_0x0564('0x3d')][_0x0564('0x4a')]+'%'};return _0x5171db;})});}_0x4c4b82=_['merge']({},_0x4c4b82,_0x5cf4de[_0x0564('0x4b')]);return _0x54d07b[_0x0564('0x59')](_0x4c4b82);}})[_0x0564('0x1b')](function(_0x31c051){if(_0x31c051){_0x15a690=_0x31c051[_0x0564('0x41')];if(!_0x5cf4de[_0x0564('0x3d')][_0x0564('0x57')](_0x0564('0x43'))){_0x4c4b82[_0x0564('0x2b')]=qs[_0x0564('0x2b')](_0x5cf4de[_0x0564('0x3d')]['limit']);_0x4c4b82[_0x0564('0x2a')]=qs[_0x0564('0x2a')](_0x5cf4de[_0x0564('0x3d')][_0x0564('0x2a')]);}return _0x54d07b['getSubjects'](_0x4c4b82);}})['then'](function(_0x5c1c22){if(_0x5c1c22){return _0x5c1c22?{'count':_0x15a690,'rows':_0x5c1c22}:null;}})[_0x0564('0x1b')](respondWithResult(_0x50355d,null))[_0x0564('0x25')](handleError(_0x50355d,null));};exports['getDescriptions']=function(_0x2906c8,_0x2302a4,_0x36dfe4){var _0x10a42a={};var _0x465195={};var _0x1efb93;var _0x3ae8dd;return db['VtigerConfiguration'][_0x0564('0x5a')]({'where':{'id':_0x2906c8[_0x0564('0x51')]['id']}})[_0x0564('0x1b')](handleEntityNotFound(_0x2302a4,null))[_0x0564('0x1b')](function(_0x32f5d5){if(_0x32f5d5){_0x1efb93=_0x32f5d5;_0x465195[_0x0564('0x3b')]=_['keys'](db[_0x0564('0x55')][_0x0564('0x37')]);_0x465195[_0x0564('0x3d')]=_['keys'](_0x2906c8[_0x0564('0x3d')]);_0x465195[_0x0564('0x3f')]=_[_0x0564('0x56')](_0x465195['model'],_0x465195[_0x0564('0x3d')]);_0x10a42a[_0x0564('0x42')]=_['intersection'](_0x465195[_0x0564('0x3b')],qs[_0x0564('0x40')](_0x2906c8['query'][_0x0564('0x40')]));_0x10a42a[_0x0564('0x42')]=_0x10a42a[_0x0564('0x42')][_0x0564('0x41')]?_0x10a42a[_0x0564('0x42')]:_0x465195[_0x0564('0x3b')];_0x10a42a[_0x0564('0x44')]=qs[_0x0564('0x45')](_0x2906c8[_0x0564('0x3d')][_0x0564('0x45')]);_0x10a42a[_0x0564('0x47')]=qs[_0x0564('0x3f')](_['pick'](_0x2906c8[_0x0564('0x3d')],_0x465195[_0x0564('0x3f')]));if(_0x2906c8[_0x0564('0x3d')][_0x0564('0x4a')]){_0x10a42a[_0x0564('0x47')]=_[_0x0564('0x48')](_0x10a42a['where'],{'$or':_['map'](_0x10a42a[_0x0564('0x42')],function(_0x26dda0){var _0x565bcf={};_0x565bcf[_0x26dda0]={'$like':'%'+_0x2906c8[_0x0564('0x3d')][_0x0564('0x4a')]+'%'};return _0x565bcf;})});}_0x10a42a=_['merge']({},_0x10a42a,_0x2906c8[_0x0564('0x4b')]);return _0x1efb93[_0x0564('0x5b')](_0x10a42a);}})[_0x0564('0x1b')](function(_0x991377){if(_0x991377){_0x3ae8dd=_0x991377[_0x0564('0x41')];if(!_0x2906c8['query'][_0x0564('0x57')]('nolimit')){_0x10a42a[_0x0564('0x2b')]=qs[_0x0564('0x2b')](_0x2906c8[_0x0564('0x3d')]['limit']);_0x10a42a[_0x0564('0x2a')]=qs[_0x0564('0x2a')](_0x2906c8['query'][_0x0564('0x2a')]);}return _0x1efb93[_0x0564('0x5b')](_0x10a42a);}})['then'](function(_0xccf7bc){if(_0xccf7bc){return _0xccf7bc?{'count':_0x3ae8dd,'rows':_0xccf7bc}:null;}})[_0x0564('0x1b')](respondWithResult(_0x2302a4,null))[_0x0564('0x25')](handleError(_0x2302a4,null));}; \ No newline at end of file +var _0x17b6=['lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','merge','where','VIRTUAL','VtigerConfiguration','include','findAll','rows','show','params','rawAttributes','create','body','findOne','VtigerField','getFields','hasOwnProperty','getSubjects','options','getDescriptions','html-pdf','eml-format','moment','bluebird','mustache','path','sox','ejs'];(function(_0x5b8919,_0x3d2103){var _0x5baa5b=function(_0x406c5e){while(--_0x406c5e){_0x5b8919['push'](_0x5b8919['shift']());}};_0x5baa5b(++_0x3d2103);}(_0x17b6,0xf7));var _0x617b=function(_0x5b2123,_0x3989ed){_0x5b2123=_0x5b2123-0x0;var _0x59bb71=_0x17b6[_0x5b2123];return _0x59bb71;};'use strict';var pdf=require(_0x617b('0x0'));var emlformat=require(_0x617b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x617b('0x2'));var BPromise=require(_0x617b('0x3'));var Mustache=require(_0x617b('0x4'));var util=require('util');var path=require(_0x617b('0x5'));var sox=require(_0x617b('0x6'));var csv=require('to-csv');var ejs=require(_0x617b('0x7'));var fs=require('fs');var _=require(_0x617b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x617b('0x9'));var deskjs=require(_0x617b('0xa'));var toCsv=require('to-csv');var querystring=require(_0x617b('0xb'));var Papa=require(_0x617b('0xc'));var Redis=require(_0x617b('0xd'));var authService=require(_0x617b('0xe'));var qs=require(_0x617b('0xf'));var as=require(_0x617b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x617b('0x11'));var utils=require('../../config/utils');var config=require(_0x617b('0x12'));var db=require(_0x617b('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x617b('0x14')][_0x617b('0x15')]({'port':0x232a});function checkPasswordPattern(_0x196ba6,_0x282ce9,_0x25b756){if(_0x25b756){var _0x35b8a7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x35b8a7['test'](_0x282ce9)){return _0x196ba6;}else{throw new db['Sequelize'][(_0x617b('0x16'))](_0x617b('0x17'));}}else{return _0x196ba6;}}function respondWithRpcPromise(_0xbc1203,_0x3eda14,_0xfc8565,_0x80279d){return new BPromise(function(_0xea2332,_0x47b826){var _0xd785ba=_0x80279d||client;return _0xd785ba['request'](_0xbc1203,_0xfc8565)[_0x617b('0x18')](function(_0x130a90){logger[_0x617b('0x19')](_0x617b('0x1a'),_0x3eda14,_0x617b('0x1b'));logger['debug'](_0x617b('0x1c'),_0x3eda14,_0x617b('0x1b'),JSON['stringify'](_0x130a90));if(_0x130a90[_0x617b('0x1d')]){if(_0x130a90[_0x617b('0x1d')][_0x617b('0x1e')]===0x1f4){logger['error'](_0x617b('0x1a'),_0x3eda14,_0x130a90[_0x617b('0x1d')][_0x617b('0x1f')]);return _0x47b826(_0x130a90[_0x617b('0x1d')][_0x617b('0x1f')]);}logger[_0x617b('0x1d')](_0x617b('0x1a'),_0x3eda14,_0x130a90[_0x617b('0x1d')][_0x617b('0x1f')]);return _0xea2332(_0x130a90['error'][_0x617b('0x1f')]);}else{logger[_0x617b('0x19')](_0x617b('0x1a'),_0x3eda14,_0x617b('0x1b'));_0xea2332(_0x130a90[_0x617b('0x20')][_0x617b('0x1f')]);}})[_0x617b('0x21')](function(_0x57fdca){logger[_0x617b('0x1d')](_0x617b('0x1a'),_0x3eda14,_0x57fdca);_0x47b826(_0x57fdca);});});}function respondWithStatusCode(_0x39698c,_0xdff26c){_0xdff26c=_0xdff26c||0xcc;return function(_0x2674bc){if(_0x2674bc){return _0x39698c['sendStatus'](_0xdff26c);}return _0x39698c['status'](_0xdff26c)['end']();};}function respondWithResult(_0x1bc467,_0x5a50fc){_0x5a50fc=_0x5a50fc||0xc8;return function(_0x50b652){if(_0x50b652){return _0x1bc467[_0x617b('0x22')](_0x5a50fc)[_0x617b('0x23')](_0x50b652);}};}function respondWithFilteredResult(_0x5f0503,_0x23c14b){return function(_0x4a36d1){if(_0x4a36d1){var _0x2f9542=_0x4a36d1[_0x617b('0x24')],_0x21f896=_0x23c14b[_0x617b('0x25')],_0x437ba7=_0x23c14b[_0x617b('0x25')]+_0x23c14b[_0x617b('0x26')],_0x2697f1;if(_0x437ba7>=_0x2f9542){_0x437ba7=_0x2f9542;_0x2697f1=0xc8;}else{_0x2697f1=0xce;}_0x5f0503[_0x617b('0x22')](_0x2697f1);return _0x5f0503[_0x617b('0x27')](_0x617b('0x28'),_0x21f896+'-'+_0x437ba7+'/'+_0x2f9542)[_0x617b('0x23')](_0x4a36d1);}return null;};}function patchUpdates(_0x262253){return function(_0x469d7f){try{jsonpatch[_0x617b('0x29')](_0x469d7f,_0x262253,!![]);}catch(_0x11f40f){return BPromise[_0x617b('0x2a')](_0x11f40f);}return _0x469d7f[_0x617b('0x2b')]();};}function saveUpdates(_0xf8d7ab,_0x503d03){return function(_0x2fc367){if(_0x2fc367){return _0x2fc367[_0x617b('0x2c')](_0xf8d7ab)[_0x617b('0x18')](function(_0x94f206){return _0x94f206;});}return null;};}function removeEntity(_0x2c4941,_0x185b70){return function(_0x46e8ba){if(_0x46e8ba){return _0x46e8ba[_0x617b('0x2d')]()[_0x617b('0x18')](function(){_0x2c4941[_0x617b('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7a0cc,_0xc1d7f0){return function(_0x540f95){if(!_0x540f95){_0x7a0cc[_0x617b('0x2e')](0x194);}return _0x540f95;};}function handleError(_0x2ad51c,_0x1bb840){_0x1bb840=_0x1bb840||0x1f4;return function(_0x3d98b5){logger[_0x617b('0x1d')](_0x3d98b5[_0x617b('0x2f')]);if(_0x3d98b5[_0x617b('0x30')]){delete _0x3d98b5[_0x617b('0x30')];}_0x2ad51c[_0x617b('0x22')](_0x1bb840)[_0x617b('0x31')](_0x3d98b5);};}exports[_0x617b('0x32')]=function(_0x2b35b9,_0x9fd5e){var _0x2af8fa={},_0x11dedd={},_0x20d5fd={'count':0x0,'rows':[]};var _0x19ef5e=_[_0x617b('0x33')](db['VtigerConfiguration']['rawAttributes'],function(_0x25054b){return{'name':_0x25054b['fieldName'],'type':_0x25054b[_0x617b('0x34')][_0x617b('0x35')]};});_0x11dedd[_0x617b('0x36')]=_[_0x617b('0x33')](_0x19ef5e,_0x617b('0x30'));_0x11dedd[_0x617b('0x37')]=_[_0x617b('0x38')](_0x2b35b9[_0x617b('0x37')]);_0x11dedd[_0x617b('0x39')]=_[_0x617b('0x3a')](_0x11dedd[_0x617b('0x36')],_0x11dedd[_0x617b('0x37')]);_0x2af8fa[_0x617b('0x3b')]=_[_0x617b('0x3a')](_0x11dedd[_0x617b('0x36')],qs[_0x617b('0x3c')](_0x2b35b9[_0x617b('0x37')][_0x617b('0x3c')]));_0x2af8fa[_0x617b('0x3b')]=_0x2af8fa['attributes'][_0x617b('0x3d')]?_0x2af8fa['attributes']:_0x11dedd[_0x617b('0x36')];if(!_0x2b35b9[_0x617b('0x37')]['hasOwnProperty'](_0x617b('0x3e'))){_0x2af8fa['limit']=qs[_0x617b('0x26')](_0x2b35b9[_0x617b('0x37')][_0x617b('0x26')]);_0x2af8fa[_0x617b('0x25')]=qs[_0x617b('0x25')](_0x2b35b9[_0x617b('0x37')][_0x617b('0x25')]);}_0x2af8fa[_0x617b('0x3f')]=qs[_0x617b('0x40')](_0x2b35b9[_0x617b('0x37')]['sort']);_0x2af8fa['where']=qs[_0x617b('0x39')](_['pick'](_0x2b35b9[_0x617b('0x37')],_0x11dedd[_0x617b('0x39')]),_0x19ef5e);if(_0x2b35b9[_0x617b('0x37')][_0x617b('0x41')]){_0x2af8fa['where']=_[_0x617b('0x42')](_0x2af8fa[_0x617b('0x43')],{'$or':_['map'](_0x19ef5e,function(_0x4199dd){if(_0x4199dd[_0x617b('0x34')]!==_0x617b('0x44')){var _0xcfa5ef={};_0xcfa5ef[_0x4199dd[_0x617b('0x30')]]={'$like':'%'+_0x2b35b9[_0x617b('0x37')][_0x617b('0x41')]+'%'};return _0xcfa5ef;}})});}_0x2af8fa=_[_0x617b('0x42')]({},_0x2af8fa,_0x2b35b9['options']);var _0x433cdf={'where':_0x2af8fa[_0x617b('0x43')]};return db[_0x617b('0x45')][_0x617b('0x24')](_0x433cdf)[_0x617b('0x18')](function(_0xaef51){_0x20d5fd[_0x617b('0x24')]=_0xaef51;if(_0x2b35b9['query']['includeAll']){_0x2af8fa[_0x617b('0x46')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x617b('0x47')](_0x2af8fa);})['then'](function(_0x7ee064){_0x20d5fd[_0x617b('0x48')]=_0x7ee064;return _0x20d5fd;})[_0x617b('0x18')](respondWithFilteredResult(_0x9fd5e,_0x2af8fa))[_0x617b('0x21')](handleError(_0x9fd5e,null));};exports[_0x617b('0x49')]=function(_0x4d3360,_0x4ee4d7){var _0x151eb8={'raw':![],'where':{'id':_0x4d3360[_0x617b('0x4a')]['id']}},_0x5c7713={};_0x5c7713[_0x617b('0x36')]=_[_0x617b('0x38')](db[_0x617b('0x45')][_0x617b('0x4b')]);_0x5c7713['query']=_[_0x617b('0x38')](_0x4d3360['query']);_0x5c7713[_0x617b('0x39')]=_[_0x617b('0x3a')](_0x5c7713[_0x617b('0x36')],_0x5c7713['query']);_0x151eb8[_0x617b('0x3b')]=_[_0x617b('0x3a')](_0x5c7713[_0x617b('0x36')],qs['fields'](_0x4d3360[_0x617b('0x37')][_0x617b('0x3c')]));_0x151eb8['attributes']=_0x151eb8[_0x617b('0x3b')][_0x617b('0x3d')]?_0x151eb8[_0x617b('0x3b')]:_0x5c7713[_0x617b('0x36')];if(_0x4d3360['query']['includeAll']){_0x151eb8[_0x617b('0x46')]=[{'all':!![]}];}_0x151eb8=_['merge']({},_0x151eb8,_0x4d3360['options']);return db[_0x617b('0x45')]['find'](_0x151eb8)[_0x617b('0x18')](handleEntityNotFound(_0x4ee4d7,null))[_0x617b('0x18')](respondWithResult(_0x4ee4d7,null))[_0x617b('0x21')](handleError(_0x4ee4d7,null));};exports[_0x617b('0x4c')]=function(_0x5e76ee,_0x4116ce){return db[_0x617b('0x45')][_0x617b('0x4c')](_0x5e76ee['body'],{})[_0x617b('0x18')](respondWithResult(_0x4116ce,0xc9))[_0x617b('0x21')](handleError(_0x4116ce,null));};exports[_0x617b('0x2c')]=function(_0x1a71a3,_0x5f49dd){if(_0x1a71a3['body']['id']){delete _0x1a71a3[_0x617b('0x4d')]['id'];}return db[_0x617b('0x45')]['find']({'where':{'id':_0x1a71a3[_0x617b('0x4a')]['id']}})[_0x617b('0x18')](handleEntityNotFound(_0x5f49dd,null))[_0x617b('0x18')](saveUpdates(_0x1a71a3[_0x617b('0x4d')],null))[_0x617b('0x18')](respondWithResult(_0x5f49dd,null))[_0x617b('0x21')](handleError(_0x5f49dd,null));};exports['destroy']=function(_0x40c6c1,_0x4e4934){return db['VtigerConfiguration']['find']({'where':{'id':_0x40c6c1['params']['id']}})['then'](handleEntityNotFound(_0x4e4934,null))[_0x617b('0x18')](removeEntity(_0x4e4934,null))[_0x617b('0x21')](handleError(_0x4e4934,null));};exports['getFields']=function(_0x2b6658,_0x3ed728,_0x43f0bc){var _0x4d0a8a={};var _0x71f7f4={};var _0x43fcaf;var _0x40c82a;return db[_0x617b('0x45')][_0x617b('0x4e')]({'where':{'id':_0x2b6658[_0x617b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3ed728,null))[_0x617b('0x18')](function(_0x480e78){if(_0x480e78){_0x43fcaf=_0x480e78;_0x71f7f4[_0x617b('0x36')]=_['keys'](db[_0x617b('0x4f')][_0x617b('0x4b')]);_0x71f7f4['query']=_[_0x617b('0x38')](_0x2b6658['query']);_0x71f7f4[_0x617b('0x39')]=_['intersection'](_0x71f7f4[_0x617b('0x36')],_0x71f7f4[_0x617b('0x37')]);_0x4d0a8a[_0x617b('0x3b')]=_[_0x617b('0x3a')](_0x71f7f4['model'],qs[_0x617b('0x3c')](_0x2b6658[_0x617b('0x37')][_0x617b('0x3c')]));_0x4d0a8a[_0x617b('0x3b')]=_0x4d0a8a[_0x617b('0x3b')][_0x617b('0x3d')]?_0x4d0a8a['attributes']:_0x71f7f4[_0x617b('0x36')];_0x4d0a8a[_0x617b('0x3f')]=qs[_0x617b('0x40')](_0x2b6658[_0x617b('0x37')][_0x617b('0x40')]);_0x4d0a8a[_0x617b('0x43')]=qs[_0x617b('0x39')](_['pick'](_0x2b6658['query'],_0x71f7f4['filters']));if(_0x2b6658['query'][_0x617b('0x41')]){_0x4d0a8a['where']=_['merge'](_0x4d0a8a[_0x617b('0x43')],{'$or':_[_0x617b('0x33')](_0x4d0a8a[_0x617b('0x3b')],function(_0xe94d68){var _0x18b0cc={};_0x18b0cc[_0xe94d68]={'$like':'%'+_0x2b6658[_0x617b('0x37')]['filter']+'%'};return _0x18b0cc;})});}_0x4d0a8a=_[_0x617b('0x42')]({},_0x4d0a8a,_0x2b6658['options']);return _0x43fcaf[_0x617b('0x50')](_0x4d0a8a);}})[_0x617b('0x18')](function(_0x52b84f){if(_0x52b84f){_0x40c82a=_0x52b84f['length'];if(!_0x2b6658[_0x617b('0x37')][_0x617b('0x51')]('nolimit')){_0x4d0a8a['limit']=qs['limit'](_0x2b6658[_0x617b('0x37')][_0x617b('0x26')]);_0x4d0a8a[_0x617b('0x25')]=qs['offset'](_0x2b6658[_0x617b('0x37')]['offset']);}return _0x43fcaf[_0x617b('0x50')](_0x4d0a8a);}})['then'](function(_0x1461a9){if(_0x1461a9){return _0x1461a9?{'count':_0x40c82a,'rows':_0x1461a9}:null;}})[_0x617b('0x18')](respondWithResult(_0x3ed728,null))[_0x617b('0x21')](handleError(_0x3ed728,null));};exports[_0x617b('0x52')]=function(_0x291279,_0x248b4a,_0x20e3df){var _0x2b411e={};var _0xeb18de={};var _0x2cc756;var _0x1f6b12;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x291279[_0x617b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x248b4a,null))[_0x617b('0x18')](function(_0x23c4e2){if(_0x23c4e2){_0x2cc756=_0x23c4e2;_0xeb18de[_0x617b('0x36')]=_['keys'](db['VtigerField']['rawAttributes']);_0xeb18de['query']=_[_0x617b('0x38')](_0x291279[_0x617b('0x37')]);_0xeb18de['filters']=_[_0x617b('0x3a')](_0xeb18de[_0x617b('0x36')],_0xeb18de[_0x617b('0x37')]);_0x2b411e['attributes']=_[_0x617b('0x3a')](_0xeb18de[_0x617b('0x36')],qs[_0x617b('0x3c')](_0x291279['query'][_0x617b('0x3c')]));_0x2b411e[_0x617b('0x3b')]=_0x2b411e[_0x617b('0x3b')][_0x617b('0x3d')]?_0x2b411e[_0x617b('0x3b')]:_0xeb18de[_0x617b('0x36')];_0x2b411e[_0x617b('0x3f')]=qs['sort'](_0x291279[_0x617b('0x37')]['sort']);_0x2b411e[_0x617b('0x43')]=qs[_0x617b('0x39')](_['pick'](_0x291279[_0x617b('0x37')],_0xeb18de[_0x617b('0x39')]));if(_0x291279[_0x617b('0x37')][_0x617b('0x41')]){_0x2b411e[_0x617b('0x43')]=_[_0x617b('0x42')](_0x2b411e[_0x617b('0x43')],{'$or':_[_0x617b('0x33')](_0x2b411e[_0x617b('0x3b')],function(_0x4dd9df){var _0x50506f={};_0x50506f[_0x4dd9df]={'$like':'%'+_0x291279[_0x617b('0x37')]['filter']+'%'};return _0x50506f;})});}_0x2b411e=_[_0x617b('0x42')]({},_0x2b411e,_0x291279[_0x617b('0x53')]);return _0x2cc756[_0x617b('0x52')](_0x2b411e);}})[_0x617b('0x18')](function(_0x39d867){if(_0x39d867){_0x1f6b12=_0x39d867[_0x617b('0x3d')];if(!_0x291279[_0x617b('0x37')][_0x617b('0x51')](_0x617b('0x3e'))){_0x2b411e[_0x617b('0x26')]=qs[_0x617b('0x26')](_0x291279[_0x617b('0x37')][_0x617b('0x26')]);_0x2b411e[_0x617b('0x25')]=qs[_0x617b('0x25')](_0x291279['query']['offset']);}return _0x2cc756[_0x617b('0x52')](_0x2b411e);}})[_0x617b('0x18')](function(_0x33938d){if(_0x33938d){return _0x33938d?{'count':_0x1f6b12,'rows':_0x33938d}:null;}})[_0x617b('0x18')](respondWithResult(_0x248b4a,null))[_0x617b('0x21')](handleError(_0x248b4a,null));};exports['getDescriptions']=function(_0x3d2099,_0x44b800,_0x3ba9c6){var _0x4a1581={};var _0x4c6da8={};var _0x34a759;var _0xea071;return db[_0x617b('0x45')][_0x617b('0x4e')]({'where':{'id':_0x3d2099['params']['id']}})[_0x617b('0x18')](handleEntityNotFound(_0x44b800,null))[_0x617b('0x18')](function(_0x293ec5){if(_0x293ec5){_0x34a759=_0x293ec5;_0x4c6da8[_0x617b('0x36')]=_['keys'](db[_0x617b('0x4f')][_0x617b('0x4b')]);_0x4c6da8[_0x617b('0x37')]=_[_0x617b('0x38')](_0x3d2099['query']);_0x4c6da8[_0x617b('0x39')]=_[_0x617b('0x3a')](_0x4c6da8[_0x617b('0x36')],_0x4c6da8['query']);_0x4a1581[_0x617b('0x3b')]=_[_0x617b('0x3a')](_0x4c6da8[_0x617b('0x36')],qs[_0x617b('0x3c')](_0x3d2099[_0x617b('0x37')][_0x617b('0x3c')]));_0x4a1581['attributes']=_0x4a1581[_0x617b('0x3b')][_0x617b('0x3d')]?_0x4a1581[_0x617b('0x3b')]:_0x4c6da8['model'];_0x4a1581[_0x617b('0x3f')]=qs[_0x617b('0x40')](_0x3d2099[_0x617b('0x37')][_0x617b('0x40')]);_0x4a1581[_0x617b('0x43')]=qs[_0x617b('0x39')](_['pick'](_0x3d2099[_0x617b('0x37')],_0x4c6da8['filters']));if(_0x3d2099[_0x617b('0x37')]['filter']){_0x4a1581[_0x617b('0x43')]=_[_0x617b('0x42')](_0x4a1581[_0x617b('0x43')],{'$or':_[_0x617b('0x33')](_0x4a1581['attributes'],function(_0x383742){var _0x3f4087={};_0x3f4087[_0x383742]={'$like':'%'+_0x3d2099['query'][_0x617b('0x41')]+'%'};return _0x3f4087;})});}_0x4a1581=_['merge']({},_0x4a1581,_0x3d2099['options']);return _0x34a759[_0x617b('0x54')](_0x4a1581);}})[_0x617b('0x18')](function(_0x2310e7){if(_0x2310e7){_0xea071=_0x2310e7[_0x617b('0x3d')];if(!_0x3d2099[_0x617b('0x37')][_0x617b('0x51')](_0x617b('0x3e'))){_0x4a1581['limit']=qs[_0x617b('0x26')](_0x3d2099[_0x617b('0x37')][_0x617b('0x26')]);_0x4a1581['offset']=qs[_0x617b('0x25')](_0x3d2099[_0x617b('0x37')]['offset']);}return _0x34a759[_0x617b('0x54')](_0x4a1581);}})[_0x617b('0x18')](function(_0x3c7cd3){if(_0x3c7cd3){return _0x3c7cd3?{'count':_0xea071,'rows':_0x3c7cd3}:null;}})[_0x617b('0x18')](respondWithResult(_0x44b800,null))[_0x617b('0x21')](handleError(_0x44b800,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 2974ce1..d4af0db 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 _0x11d0=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x11d0,0x1d2));var _0x011d=function(_0x4378d5,_0x39b734){_0x4378d5=_0x4378d5-0x0;var _0xa27c3b=_0x11d0[_0x4378d5];return _0xa27c3b;};'use strict';var _=require(_0x011d('0x0'));var util=require(_0x011d('0x1'));var logger=require(_0x011d('0x2'))(_0x011d('0x3'));var moment=require('moment');var BPromise=require(_0x011d('0x4'));var rp=require(_0x011d('0x5'));var fs=require('fs');var path=require(_0x011d('0x6'));var rimraf=require(_0x011d('0x7'));var config=require(_0x011d('0x8'));var attributes=require(_0x011d('0x9'));module['exports']=function(_0x104af0,_0x38147b){return _0x104af0[_0x011d('0xa')](_0x011d('0xb'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd267=['bluebird','path','rimraf','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xd267,0x13f));var _0x7d26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd267[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d26('0x0'));var util=require(_0x7d26('0x1'));var logger=require(_0x7d26('0x2'))(_0x7d26('0x3'));var moment=require(_0x7d26('0x4'));var BPromise=require(_0x7d26('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d26('0x6'));var rimraf=require(_0x7d26('0x7'));var config=require('../../config/environment');var attributes=require(_0x7d26('0x8'));module[_0x7d26('0x9')]=function(_0x5ad880,_0x1cb931){return _0x5ad880['define'](_0x7d26('0xa'),attributes,{'tableName':_0x7d26('0xb'),'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 6e9a2b7..708d88d 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 _0xcabe=['VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info'];(function(_0x56099d,_0x1ae5de){var _0x13d2bf=function(_0x226a34){while(--_0x226a34){_0x56099d['push'](_0x56099d['shift']());}};_0x13d2bf(++_0x1ae5de);}(_0xcabe,0x76));var _0xecab=function(_0x15a074,_0x2ebf5b){_0x15a074=_0x15a074-0x0;var _0x1dabc8=_0xcabe[_0x15a074];return _0x1dabc8;};'use strict';var _=require(_0xecab('0x0'));var util=require(_0xecab('0x1'));var moment=require(_0xecab('0x2'));var BPromise=require(_0xecab('0x3'));var rs=require(_0xecab('0x4'));var fs=require('fs');var Redis=require(_0xecab('0x5'));var db=require(_0xecab('0x6'))['db'];var utils=require(_0xecab('0x7'));var logger=require(_0xecab('0x8'))(_0xecab('0x9'));var config=require('../../config/environment');var jayson=require(_0xecab('0xa'));var client=jayson['client'][_0xecab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x364d29,_0x4367a4,_0x1d8d74){return new BPromise(function(_0x58ab19,_0x127c12){return client[_0xecab('0xc')](_0x364d29,_0x1d8d74)['then'](function(_0x2a0a2d){logger[_0xecab('0xd')](_0xecab('0xe'),_0x4367a4,_0xecab('0xf'));logger['debug'](_0xecab('0x10'),_0x4367a4,_0xecab('0xf'),JSON['stringify'](_0x2a0a2d));if(_0x2a0a2d[_0xecab('0x11')]){if(_0x2a0a2d['error'][_0xecab('0x12')]===0x1f4){logger[_0xecab('0x11')](_0xecab('0xe'),_0x4367a4,_0x2a0a2d['error'][_0xecab('0x13')]);return _0x127c12(_0x2a0a2d[_0xecab('0x11')][_0xecab('0x13')]);}logger[_0xecab('0x11')](_0xecab('0xe'),_0x4367a4,_0x2a0a2d['error'][_0xecab('0x13')]);return _0x58ab19(_0x2a0a2d[_0xecab('0x11')][_0xecab('0x13')]);}else{logger[_0xecab('0xd')](_0xecab('0xe'),_0x4367a4,_0xecab('0xf'));_0x58ab19(_0x2a0a2d[_0xecab('0x14')][_0xecab('0x13')]);}})[_0xecab('0x15')](function(_0x382ceb){logger[_0xecab('0x11')](_0xecab('0xe'),_0x4367a4,_0x382ceb);_0x127c12(_0x382ceb);});});} \ No newline at end of file +var _0xded1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','moment','bluebird','randomstring'];(function(_0x3199ea,_0x4d36e5){var _0x41abc4=function(_0x1da2e8){while(--_0x1da2e8){_0x3199ea['push'](_0x3199ea['shift']());}};_0x41abc4(++_0x4d36e5);}(_0xded1,0xd9));var _0x1ded=function(_0x446301,_0x15b238){_0x446301=_0x446301-0x0;var _0x268e22=_0xded1[_0x446301];return _0x268e22;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1ded('0x0'));var BPromise=require(_0x1ded('0x1'));var rs=require(_0x1ded('0x2'));var fs=require('fs');var Redis=require(_0x1ded('0x3'));var db=require(_0x1ded('0x4'))['db'];var utils=require(_0x1ded('0x5'));var logger=require(_0x1ded('0x6'))(_0x1ded('0x7'));var config=require('../../config/environment');var jayson=require(_0x1ded('0x8'));var client=jayson[_0x1ded('0x9')][_0x1ded('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x298384,_0x433971,_0x45009c){return new BPromise(function(_0x47d4cc,_0x18da34){return client[_0x1ded('0xb')](_0x298384,_0x45009c)['then'](function(_0x5e772c){logger[_0x1ded('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x433971,_0x1ded('0xd'));logger[_0x1ded('0xe')](_0x1ded('0xf'),_0x433971,_0x1ded('0xd'),JSON[_0x1ded('0x10')](_0x5e772c));if(_0x5e772c[_0x1ded('0x11')]){if(_0x5e772c[_0x1ded('0x11')][_0x1ded('0x12')]===0x1f4){logger[_0x1ded('0x11')](_0x1ded('0x13'),_0x433971,_0x5e772c[_0x1ded('0x11')][_0x1ded('0x14')]);return _0x18da34(_0x5e772c[_0x1ded('0x11')]['message']);}logger[_0x1ded('0x11')](_0x1ded('0x13'),_0x433971,_0x5e772c[_0x1ded('0x11')][_0x1ded('0x14')]);return _0x47d4cc(_0x5e772c[_0x1ded('0x11')][_0x1ded('0x14')]);}else{logger[_0x1ded('0xc')](_0x1ded('0x13'),_0x433971,'request\x20sent');_0x47d4cc(_0x5e772c[_0x1ded('0x15')][_0x1ded('0x14')]);}})['catch'](function(_0x3e5f60){logger[_0x1ded('0x11')](_0x1ded('0x13'),_0x433971,_0x3e5f60);_0x18da34(_0x3e5f60);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 87e87a5..8aec689 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 _0x7992=['../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7992,0x15f));var _0x2799=function(_0x7dbd65,_0x18da49){_0x7dbd65=_0x7dbd65-0x0;var _0x33d551=_0x7992[_0x7dbd65];return _0x33d551;};'use strict';var multer=require(_0x2799('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2799('0x1'));var express=require(_0x2799('0x2'));var router=express[_0x2799('0x3')]();var auth=require(_0x2799('0x4'));var interaction=require(_0x2799('0x5'));var config=require(_0x2799('0x6'));var controller=require(_0x2799('0x7'));router[_0x2799('0x8')]('/',auth[_0x2799('0x9')](),controller['index']);router[_0x2799('0x8')](_0x2799('0xa'),auth[_0x2799('0x9')](),controller[_0x2799('0xb')]);router['post']('/',auth[_0x2799('0x9')](),controller[_0x2799('0xc')]);router[_0x2799('0xd')](_0x2799('0xa'),auth[_0x2799('0x9')](),controller[_0x2799('0xe')]);router[_0x2799('0xf')]('/:id',auth[_0x2799('0x9')](),controller[_0x2799('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf69a=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','post','create','update','destroy','exports','multer','util'];(function(_0x119b3a,_0x5d581b){var _0x4fb4da=function(_0x1adc7d){while(--_0x1adc7d){_0x119b3a['push'](_0x119b3a['shift']());}};_0x4fb4da(++_0x5d581b);}(_0xf69a,0x174));var _0xaf69=function(_0x484e47,_0x155a54){_0x484e47=_0x484e47-0x0;var _0x5c6ea5=_0xf69a[_0x484e47];return _0x5c6ea5;};'use strict';var multer=require(_0xaf69('0x0'));var util=require(_0xaf69('0x1'));var path=require(_0xaf69('0x2'));var timeout=require(_0xaf69('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xaf69('0x4'));var interaction=require(_0xaf69('0x5'));var config=require(_0xaf69('0x6'));var controller=require(_0xaf69('0x7'));router[_0xaf69('0x8')]('/',auth[_0xaf69('0x9')](),controller[_0xaf69('0xa')]);router[_0xaf69('0x8')](_0xaf69('0xb'),auth[_0xaf69('0x9')](),controller['show']);router[_0xaf69('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf69('0xd')]);router['put'](_0xaf69('0xb'),auth[_0xaf69('0x9')](),controller[_0xaf69('0xe')]);router['delete'](_0xaf69('0xb'),auth[_0xaf69('0x9')](),controller[_0xaf69('0xf')]);module[_0xaf69('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a976aaf..6e5ec65 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 _0x99c9=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x10cdfa,_0x15e2f7){var _0x2ab367=function(_0x277681){while(--_0x277681){_0x10cdfa['push'](_0x10cdfa['shift']());}};_0x2ab367(++_0x15e2f7);}(_0x99c9,0x13c));var _0x999c=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x99c9[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x999c('0x0'));module[_0x999c('0x1')]={'type':{'type':Sequelize[_0x999c('0x2')](_0x999c('0x3'),_0x999c('0x4'),_0x999c('0x5'),_0x999c('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x999c('0x7')]},'key':{'type':Sequelize[_0x999c('0x7')]},'keyType':{'type':Sequelize[_0x999c('0x2')](_0x999c('0x3'),_0x999c('0x4'),_0x999c('0x5'))},'keyContent':{'type':Sequelize[_0x999c('0x7')]},'idField':{'type':Sequelize[_0x999c('0x7')]},'nameField':{'type':Sequelize[_0x999c('0x7')]},'customField':{'type':Sequelize[_0x999c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x999c('0x7')]}}; \ No newline at end of file +var _0xe700=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING'];(function(_0x33db28,_0x3ae8f2){var _0xfe4d18=function(_0x560e23){while(--_0x560e23){_0x33db28['push'](_0x33db28['shift']());}};_0xfe4d18(++_0x3ae8f2);}(_0xe700,0x16a));var _0x0e70=function(_0x17cbab,_0x519f4a){_0x17cbab=_0x17cbab-0x0;var _0x39e746=_0xe700[_0x17cbab];return _0x39e746;};'use strict';var Sequelize=require(_0x0e70('0x0'));module[_0x0e70('0x1')]={'type':{'type':Sequelize[_0x0e70('0x2')](_0x0e70('0x3'),_0x0e70('0x4'),'customVariable',_0x0e70('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0e70('0x6')]},'key':{'type':Sequelize[_0x0e70('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x0e70('0x4'),_0x0e70('0x7'))},'keyContent':{'type':Sequelize[_0x0e70('0x6')]},'idField':{'type':Sequelize[_0x0e70('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0e70('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0e70('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9ea54be..27d48b2 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 _0xef17=['ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','map','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox'];(function(_0xf27f1e,_0x214175){var _0x127706=function(_0x264a25){while(--_0x264a25){_0xf27f1e['push'](_0xf27f1e['shift']());}};_0x127706(++_0x214175);}(_0xef17,0x1be));var _0x7ef1=function(_0x575fc9,_0x29cba0){_0x575fc9=_0x575fc9-0x0;var _0x56e239=_0xef17[_0x575fc9];return _0x56e239;};'use strict';var pdf=require(_0x7ef1('0x0'));var emlformat=require(_0x7ef1('0x1'));var rimraf=require(_0x7ef1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ef1('0x3'));var rp=require(_0x7ef1('0x4'));var moment=require(_0x7ef1('0x5'));var BPromise=require(_0x7ef1('0x6'));var Mustache=require(_0x7ef1('0x7'));var util=require(_0x7ef1('0x8'));var path=require('path');var sox=require(_0x7ef1('0x9'));var csv=require('to-csv');var ejs=require(_0x7ef1('0xa'));var fs=require('fs');var _=require(_0x7ef1('0xb'));var squel=require(_0x7ef1('0xc'));var crypto=require('crypto');var jsforce=require(_0x7ef1('0xd'));var deskjs=require(_0x7ef1('0xe'));var toCsv=require(_0x7ef1('0xf'));var querystring=require('querystring');var Papa=require(_0x7ef1('0x10'));var Redis=require(_0x7ef1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7ef1('0x12'));var as=require(_0x7ef1('0x13'));var hardwareService=require(_0x7ef1('0x14'));var logger=require('../../config/logger')(_0x7ef1('0x15'));var utils=require(_0x7ef1('0x16'));var config=require(_0x7ef1('0x17'));var db=require(_0x7ef1('0x18'))['db'];function respondWithStatusCode(_0x2971da,_0x346c33){_0x346c33=_0x346c33||0xcc;return function(_0x53d048){if(_0x53d048){return _0x2971da[_0x7ef1('0x19')](_0x346c33);}return _0x2971da[_0x7ef1('0x1a')](_0x346c33)[_0x7ef1('0x1b')]();};}function respondWithResult(_0x5eec9e,_0x5083c3){_0x5083c3=_0x5083c3||0xc8;return function(_0x295ae9){if(_0x295ae9){return _0x5eec9e[_0x7ef1('0x1a')](_0x5083c3)['json'](_0x295ae9);}};}function respondWithFilteredResult(_0x1d23e6,_0x5b8cca){return function(_0x59eb42){if(_0x59eb42){var _0x32ea76=_0x59eb42['count'],_0x413bb8=_0x5b8cca[_0x7ef1('0x1c')],_0x521ce7=_0x5b8cca['offset']+_0x5b8cca[_0x7ef1('0x1d')],_0x1bfe91;if(_0x521ce7>=_0x32ea76){_0x521ce7=_0x32ea76;_0x1bfe91=0xc8;}else{_0x1bfe91=0xce;}_0x1d23e6[_0x7ef1('0x1a')](_0x1bfe91);return _0x1d23e6[_0x7ef1('0x1e')](_0x7ef1('0x1f'),_0x413bb8+'-'+_0x521ce7+'/'+_0x32ea76)['json'](_0x59eb42);}return null;};}function patchUpdates(_0x4325d8){return function(_0xd614ec){try{jsonpatch[_0x7ef1('0x20')](_0xd614ec,_0x4325d8,!![]);}catch(_0x4753dc){return BPromise['reject'](_0x4753dc);}return _0xd614ec[_0x7ef1('0x21')]();};}function saveUpdates(_0x1411c5,_0x3a9db5){return function(_0x2e9275){if(_0x2e9275){return _0x2e9275[_0x7ef1('0x22')](_0x1411c5)[_0x7ef1('0x23')](function(_0x4961c7){return _0x4961c7;});}return null;};}function removeEntity(_0x3bee12,_0x2f00cd){return function(_0x2f53c5){if(_0x2f53c5){return _0x2f53c5['destroy']()[_0x7ef1('0x23')](function(){_0x3bee12['status'](0xcc)[_0x7ef1('0x1b')]();});}};}function handleEntityNotFound(_0xb18b7d,_0x9a45c6){return function(_0x29fbca){if(!_0x29fbca){_0xb18b7d[_0x7ef1('0x19')](0x194);}return _0x29fbca;};}function handleError(_0x233d04,_0x5701de){_0x5701de=_0x5701de||0x1f4;return function(_0x1402ce){logger[_0x7ef1('0x24')](_0x1402ce[_0x7ef1('0x25')]);if(_0x1402ce[_0x7ef1('0x26')]){delete _0x1402ce[_0x7ef1('0x26')];}_0x233d04[_0x7ef1('0x1a')](_0x5701de)[_0x7ef1('0x27')](_0x1402ce);};}exports[_0x7ef1('0x28')]=function(_0x2e24d0,_0x7144f5){var _0x36379c={},_0xda9fb2={},_0x51645b={'count':0x0,'rows':[]};var _0x4d5fb0=_['map'](db[_0x7ef1('0x29')][_0x7ef1('0x2a')],function(_0x65924){return{'name':_0x65924[_0x7ef1('0x2b')],'type':_0x65924[_0x7ef1('0x2c')][_0x7ef1('0x2d')]};});_0xda9fb2[_0x7ef1('0x2e')]=_['map'](_0x4d5fb0,_0x7ef1('0x26'));_0xda9fb2[_0x7ef1('0x2f')]=_[_0x7ef1('0x30')](_0x2e24d0['query']);_0xda9fb2[_0x7ef1('0x31')]=_[_0x7ef1('0x32')](_0xda9fb2[_0x7ef1('0x2e')],_0xda9fb2['query']);_0x36379c[_0x7ef1('0x33')]=_[_0x7ef1('0x32')](_0xda9fb2[_0x7ef1('0x2e')],qs[_0x7ef1('0x34')](_0x2e24d0[_0x7ef1('0x2f')]['fields']));_0x36379c[_0x7ef1('0x33')]=_0x36379c[_0x7ef1('0x33')][_0x7ef1('0x35')]?_0x36379c['attributes']:_0xda9fb2['model'];if(!_0x2e24d0['query'][_0x7ef1('0x36')](_0x7ef1('0x37'))){_0x36379c[_0x7ef1('0x1d')]=qs[_0x7ef1('0x1d')](_0x2e24d0['query']['limit']);_0x36379c['offset']=qs['offset'](_0x2e24d0[_0x7ef1('0x2f')][_0x7ef1('0x1c')]);}_0x36379c[_0x7ef1('0x38')]=qs['sort'](_0x2e24d0[_0x7ef1('0x2f')]['sort']);_0x36379c[_0x7ef1('0x39')]=qs[_0x7ef1('0x31')](_[_0x7ef1('0x3a')](_0x2e24d0['query'],_0xda9fb2['filters']),_0x4d5fb0);if(_0x2e24d0[_0x7ef1('0x2f')]['filter']){_0x36379c[_0x7ef1('0x39')]=_['merge'](_0x36379c[_0x7ef1('0x39')],{'$or':_[_0x7ef1('0x3b')](_0x4d5fb0,function(_0x15ccb4){if(_0x15ccb4['type']!==_0x7ef1('0x3c')){var _0x283c09={};_0x283c09[_0x15ccb4[_0x7ef1('0x26')]]={'$like':'%'+_0x2e24d0[_0x7ef1('0x2f')][_0x7ef1('0x3d')]+'%'};return _0x283c09;}})});}_0x36379c=_[_0x7ef1('0x3e')]({},_0x36379c,_0x2e24d0[_0x7ef1('0x3f')]);var _0x876573={'where':_0x36379c[_0x7ef1('0x39')]};return db[_0x7ef1('0x29')][_0x7ef1('0x40')](_0x876573)['then'](function(_0x1d1829){_0x51645b[_0x7ef1('0x40')]=_0x1d1829;if(_0x2e24d0[_0x7ef1('0x2f')][_0x7ef1('0x41')]){_0x36379c[_0x7ef1('0x42')]=[{'all':!![]}];}return db[_0x7ef1('0x29')][_0x7ef1('0x43')](_0x36379c);})['then'](function(_0x3dd74b){_0x51645b[_0x7ef1('0x44')]=_0x3dd74b;return _0x51645b;})[_0x7ef1('0x23')](respondWithFilteredResult(_0x7144f5,_0x36379c))[_0x7ef1('0x45')](handleError(_0x7144f5,null));};exports[_0x7ef1('0x46')]=function(_0x5ead20,_0xf662cf){var _0x1a235a={'raw':!![],'where':{'id':_0x5ead20[_0x7ef1('0x47')]['id']}},_0x414c55={};_0x414c55[_0x7ef1('0x2e')]=_[_0x7ef1('0x30')](db[_0x7ef1('0x29')][_0x7ef1('0x2a')]);_0x414c55[_0x7ef1('0x2f')]=_[_0x7ef1('0x30')](_0x5ead20['query']);_0x414c55['filters']=_[_0x7ef1('0x32')](_0x414c55['model'],_0x414c55[_0x7ef1('0x2f')]);_0x1a235a[_0x7ef1('0x33')]=_[_0x7ef1('0x32')](_0x414c55[_0x7ef1('0x2e')],qs['fields'](_0x5ead20[_0x7ef1('0x2f')][_0x7ef1('0x34')]));_0x1a235a['attributes']=_0x1a235a['attributes'][_0x7ef1('0x35')]?_0x1a235a[_0x7ef1('0x33')]:_0x414c55[_0x7ef1('0x2e')];if(_0x5ead20['query'][_0x7ef1('0x41')]){_0x1a235a[_0x7ef1('0x42')]=[{'all':!![]}];}_0x1a235a=_[_0x7ef1('0x3e')]({},_0x1a235a,_0x5ead20[_0x7ef1('0x3f')]);return db[_0x7ef1('0x29')][_0x7ef1('0x48')](_0x1a235a)[_0x7ef1('0x23')](handleEntityNotFound(_0xf662cf,null))[_0x7ef1('0x23')](respondWithResult(_0xf662cf,null))[_0x7ef1('0x45')](handleError(_0xf662cf,null));};exports['create']=function(_0xc4343a,_0x2cb960){return db[_0x7ef1('0x29')][_0x7ef1('0x49')](_0xc4343a[_0x7ef1('0x4a')],{})['then'](respondWithResult(_0x2cb960,0xc9))[_0x7ef1('0x45')](handleError(_0x2cb960,null));};exports[_0x7ef1('0x22')]=function(_0x4cf13c,_0x20eb72){if(_0x4cf13c[_0x7ef1('0x4a')]['id']){delete _0x4cf13c[_0x7ef1('0x4a')]['id'];}return db[_0x7ef1('0x29')][_0x7ef1('0x48')]({'where':{'id':_0x4cf13c[_0x7ef1('0x47')]['id']}})[_0x7ef1('0x23')](handleEntityNotFound(_0x20eb72,null))['then'](saveUpdates(_0x4cf13c[_0x7ef1('0x4a')],null))['then'](respondWithResult(_0x20eb72,null))[_0x7ef1('0x45')](handleError(_0x20eb72,null));};exports[_0x7ef1('0x4b')]=function(_0x6bde4e,_0x57175b){return db[_0x7ef1('0x29')]['find']({'where':{'id':_0x6bde4e['params']['id']}})[_0x7ef1('0x23')](handleEntityNotFound(_0x57175b,null))['then'](removeEntity(_0x57175b,null))[_0x7ef1('0x45')](handleError(_0x57175b,null));}; \ No newline at end of file +var _0xbe33=['count','includeAll','findAll','rows','catch','show','include','find','create','body','destroy','params','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','reject','save','then','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options'];(function(_0x40e6b7,_0x3cd89e){var _0x3aa580=function(_0x456fc2){while(--_0x456fc2){_0x40e6b7['push'](_0x40e6b7['shift']());}};_0x3aa580(++_0x3cd89e);}(_0xbe33,0x183));var _0x3be3=function(_0x4996dd,_0x1613fc){_0x4996dd=_0x4996dd-0x0;var _0x98b206=_0xbe33[_0x4996dd];return _0x98b206;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3be3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3be3('0x1'));var rp=require('request-promise');var moment=require(_0x3be3('0x2'));var BPromise=require(_0x3be3('0x3'));var Mustache=require(_0x3be3('0x4'));var util=require('util');var path=require(_0x3be3('0x5'));var sox=require(_0x3be3('0x6'));var csv=require(_0x3be3('0x7'));var ejs=require(_0x3be3('0x8'));var fs=require('fs');var _=require(_0x3be3('0x9'));var squel=require(_0x3be3('0xa'));var crypto=require(_0x3be3('0xb'));var jsforce=require(_0x3be3('0xc'));var deskjs=require(_0x3be3('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3be3('0xe'));var Redis=require(_0x3be3('0xf'));var authService=require(_0x3be3('0x10'));var qs=require(_0x3be3('0x11'));var as=require(_0x3be3('0x12'));var hardwareService=require(_0x3be3('0x13'));var logger=require(_0x3be3('0x14'))(_0x3be3('0x15'));var utils=require('../../config/utils');var config=require(_0x3be3('0x16'));var db=require(_0x3be3('0x17'))['db'];function respondWithStatusCode(_0x54e235,_0x140a7e){_0x140a7e=_0x140a7e||0xcc;return function(_0xab8828){if(_0xab8828){return _0x54e235[_0x3be3('0x18')](_0x140a7e);}return _0x54e235[_0x3be3('0x19')](_0x140a7e)[_0x3be3('0x1a')]();};}function respondWithResult(_0x31c05e,_0x51fc75){_0x51fc75=_0x51fc75||0xc8;return function(_0xdb7aec){if(_0xdb7aec){return _0x31c05e[_0x3be3('0x19')](_0x51fc75)[_0x3be3('0x1b')](_0xdb7aec);}};}function respondWithFilteredResult(_0x210af3,_0x5425cb){return function(_0x2c4a6b){if(_0x2c4a6b){var _0x5e8839=_0x2c4a6b['count'],_0x5ae019=_0x5425cb[_0x3be3('0x1c')],_0xdb3074=_0x5425cb[_0x3be3('0x1c')]+_0x5425cb[_0x3be3('0x1d')],_0x25371d;if(_0xdb3074>=_0x5e8839){_0xdb3074=_0x5e8839;_0x25371d=0xc8;}else{_0x25371d=0xce;}_0x210af3[_0x3be3('0x19')](_0x25371d);return _0x210af3[_0x3be3('0x1e')]('Content-Range',_0x5ae019+'-'+_0xdb3074+'/'+_0x5e8839)[_0x3be3('0x1b')](_0x2c4a6b);}return null;};}function patchUpdates(_0x232dc2){return function(_0x1ba286){try{jsonpatch['apply'](_0x1ba286,_0x232dc2,!![]);}catch(_0x29af12){return BPromise[_0x3be3('0x1f')](_0x29af12);}return _0x1ba286[_0x3be3('0x20')]();};}function saveUpdates(_0x21a168,_0x537046){return function(_0x22b53d){if(_0x22b53d){return _0x22b53d['update'](_0x21a168)[_0x3be3('0x21')](function(_0x474f9f){return _0x474f9f;});}return null;};}function removeEntity(_0x1e2bad,_0x4b72cf){return function(_0x322a7f){if(_0x322a7f){return _0x322a7f['destroy']()[_0x3be3('0x21')](function(){_0x1e2bad['status'](0xcc)[_0x3be3('0x1a')]();});}};}function handleEntityNotFound(_0x4af7a2,_0x9dc31f){return function(_0x22fcc4){if(!_0x22fcc4){_0x4af7a2['sendStatus'](0x194);}return _0x22fcc4;};}function handleError(_0x1e12c2,_0x307490){_0x307490=_0x307490||0x1f4;return function(_0xc9535c){logger[_0x3be3('0x22')](_0xc9535c[_0x3be3('0x23')]);if(_0xc9535c['name']){delete _0xc9535c[_0x3be3('0x24')];}_0x1e12c2[_0x3be3('0x19')](_0x307490)[_0x3be3('0x25')](_0xc9535c);};}exports[_0x3be3('0x26')]=function(_0x300072,_0x382656){var _0x951437={},_0x2b0d69={},_0x63883f={'count':0x0,'rows':[]};var _0x1a3315=_[_0x3be3('0x27')](db[_0x3be3('0x28')][_0x3be3('0x29')],function(_0x3749f1){return{'name':_0x3749f1[_0x3be3('0x2a')],'type':_0x3749f1['type'][_0x3be3('0x2b')]};});_0x2b0d69[_0x3be3('0x2c')]=_[_0x3be3('0x27')](_0x1a3315,'name');_0x2b0d69[_0x3be3('0x2d')]=_[_0x3be3('0x2e')](_0x300072['query']);_0x2b0d69['filters']=_['intersection'](_0x2b0d69[_0x3be3('0x2c')],_0x2b0d69['query']);_0x951437[_0x3be3('0x2f')]=_[_0x3be3('0x30')](_0x2b0d69[_0x3be3('0x2c')],qs[_0x3be3('0x31')](_0x300072[_0x3be3('0x2d')][_0x3be3('0x31')]));_0x951437[_0x3be3('0x2f')]=_0x951437[_0x3be3('0x2f')][_0x3be3('0x32')]?_0x951437[_0x3be3('0x2f')]:_0x2b0d69['model'];if(!_0x300072['query'][_0x3be3('0x33')](_0x3be3('0x34'))){_0x951437[_0x3be3('0x1d')]=qs[_0x3be3('0x1d')](_0x300072[_0x3be3('0x2d')][_0x3be3('0x1d')]);_0x951437['offset']=qs[_0x3be3('0x1c')](_0x300072[_0x3be3('0x2d')][_0x3be3('0x1c')]);}_0x951437[_0x3be3('0x35')]=qs['sort'](_0x300072['query'][_0x3be3('0x36')]);_0x951437[_0x3be3('0x37')]=qs['filters'](_[_0x3be3('0x38')](_0x300072[_0x3be3('0x2d')],_0x2b0d69[_0x3be3('0x39')]),_0x1a3315);if(_0x300072['query'][_0x3be3('0x3a')]){_0x951437[_0x3be3('0x37')]=_[_0x3be3('0x3b')](_0x951437['where'],{'$or':_[_0x3be3('0x27')](_0x1a3315,function(_0x4eb2c4){if(_0x4eb2c4[_0x3be3('0x3c')]!==_0x3be3('0x3d')){var _0x333b8a={};_0x333b8a[_0x4eb2c4[_0x3be3('0x24')]]={'$like':'%'+_0x300072[_0x3be3('0x2d')][_0x3be3('0x3a')]+'%'};return _0x333b8a;}})});}_0x951437=_[_0x3be3('0x3b')]({},_0x951437,_0x300072[_0x3be3('0x3e')]);var _0x4d54ff={'where':_0x951437[_0x3be3('0x37')]};return db[_0x3be3('0x28')][_0x3be3('0x3f')](_0x4d54ff)[_0x3be3('0x21')](function(_0x3446f0){_0x63883f['count']=_0x3446f0;if(_0x300072[_0x3be3('0x2d')][_0x3be3('0x40')]){_0x951437['include']=[{'all':!![]}];}return db['VtigerField'][_0x3be3('0x41')](_0x951437);})[_0x3be3('0x21')](function(_0x3619a1){_0x63883f[_0x3be3('0x42')]=_0x3619a1;return _0x63883f;})[_0x3be3('0x21')](respondWithFilteredResult(_0x382656,_0x951437))[_0x3be3('0x43')](handleError(_0x382656,null));};exports[_0x3be3('0x44')]=function(_0xdb7497,_0x285449){var _0x33a506={'raw':!![],'where':{'id':_0xdb7497['params']['id']}},_0x35cdd8={};_0x35cdd8[_0x3be3('0x2c')]=_['keys'](db[_0x3be3('0x28')]['rawAttributes']);_0x35cdd8[_0x3be3('0x2d')]=_[_0x3be3('0x2e')](_0xdb7497[_0x3be3('0x2d')]);_0x35cdd8[_0x3be3('0x39')]=_[_0x3be3('0x30')](_0x35cdd8[_0x3be3('0x2c')],_0x35cdd8[_0x3be3('0x2d')]);_0x33a506[_0x3be3('0x2f')]=_[_0x3be3('0x30')](_0x35cdd8[_0x3be3('0x2c')],qs[_0x3be3('0x31')](_0xdb7497[_0x3be3('0x2d')][_0x3be3('0x31')]));_0x33a506[_0x3be3('0x2f')]=_0x33a506[_0x3be3('0x2f')]['length']?_0x33a506[_0x3be3('0x2f')]:_0x35cdd8[_0x3be3('0x2c')];if(_0xdb7497[_0x3be3('0x2d')][_0x3be3('0x40')]){_0x33a506[_0x3be3('0x45')]=[{'all':!![]}];}_0x33a506=_[_0x3be3('0x3b')]({},_0x33a506,_0xdb7497[_0x3be3('0x3e')]);return db[_0x3be3('0x28')][_0x3be3('0x46')](_0x33a506)['then'](handleEntityNotFound(_0x285449,null))['then'](respondWithResult(_0x285449,null))[_0x3be3('0x43')](handleError(_0x285449,null));};exports[_0x3be3('0x47')]=function(_0x5651f7,_0x58f890){return db['VtigerField']['create'](_0x5651f7['body'],{})[_0x3be3('0x21')](respondWithResult(_0x58f890,0xc9))[_0x3be3('0x43')](handleError(_0x58f890,null));};exports['update']=function(_0x45a478,_0x2dc769){if(_0x45a478[_0x3be3('0x48')]['id']){delete _0x45a478['body']['id'];}return db[_0x3be3('0x28')]['find']({'where':{'id':_0x45a478['params']['id']}})[_0x3be3('0x21')](handleEntityNotFound(_0x2dc769,null))['then'](saveUpdates(_0x45a478[_0x3be3('0x48')],null))['then'](respondWithResult(_0x2dc769,null))['catch'](handleError(_0x2dc769,null));};exports[_0x3be3('0x49')]=function(_0x563964,_0x2f1d85){return db[_0x3be3('0x28')]['find']({'where':{'id':_0x563964[_0x3be3('0x4a')]['id']}})[_0x3be3('0x21')](handleEntityNotFound(_0x2f1d85,null))[_0x3be3('0x21')](removeEntity(_0x2f1d85,null))[_0x3be3('0x43')](handleError(_0x2f1d85,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 8571ff0..a7acbf8 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 _0xa9e0=['define','VtigerField','idField','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports'];(function(_0x601338,_0x3e39ad){var _0x33a783=function(_0x2c4e36){while(--_0x2c4e36){_0x601338['push'](_0x601338['shift']());}};_0x33a783(++_0x3e39ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x0a9e('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','exports','VtigerField','vtiger_unique_index','idField','FieldId'];(function(_0x408103,_0xa00464){var _0x135a73=function(_0x202aef){while(--_0x202aef){_0x408103['push'](_0x408103['shift']());}};_0x135a73(++_0xa00464);}(_0xedd9,0xfc));var _0x9edd=function(_0x59df00,_0xfc0aa){_0x59df00=_0x59df00-0x0;var _0x32bcb6=_0xedd9[_0x59df00];return _0x32bcb6;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x9edd('0xb'),'fields':[_0x9edd('0xc'),_0x9edd('0xd')],'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 f37337b..da10a2e 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 _0xa3db=['client','http','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0xa3db,0x10c));var _0xba3d=function(_0x1b3706,_0x405791){_0x1b3706=_0x1b3706-0x0;var _0x5cd3a5=_0xa3db[_0x1b3706];return _0x5cd3a5;};'use strict';var _=require(_0xba3d('0x0'));var util=require(_0xba3d('0x1'));var moment=require(_0xba3d('0x2'));var BPromise=require(_0xba3d('0x3'));var rs=require(_0xba3d('0x4'));var fs=require('fs');var Redis=require(_0xba3d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba3d('0x6'))('rpc');var config=require(_0xba3d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xba3d('0x8')][_0xba3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x477583,_0x1bacd7,_0x1bd181){return new BPromise(function(_0x426868,_0x3b69e9){return client[_0xba3d('0xa')](_0x477583,_0x1bd181)[_0xba3d('0xb')](function(_0x102fe6){logger[_0xba3d('0xc')]('VtigerField,\x20%s,\x20%s',_0x1bacd7,_0xba3d('0xd'));logger[_0xba3d('0xe')](_0xba3d('0xf'),_0x1bacd7,_0xba3d('0xd'),JSON[_0xba3d('0x10')](_0x102fe6));if(_0x102fe6['error']){if(_0x102fe6[_0xba3d('0x11')][_0xba3d('0x12')]===0x1f4){logger[_0xba3d('0x11')]('VtigerField,\x20%s,\x20%s',_0x1bacd7,_0x102fe6['error'][_0xba3d('0x13')]);return _0x3b69e9(_0x102fe6[_0xba3d('0x11')]['message']);}logger['error'](_0xba3d('0x14'),_0x1bacd7,_0x102fe6['error'][_0xba3d('0x13')]);return _0x426868(_0x102fe6[_0xba3d('0x11')][_0xba3d('0x13')]);}else{logger[_0xba3d('0xc')](_0xba3d('0x14'),_0x1bacd7,_0xba3d('0xd'));_0x426868(_0x102fe6[_0xba3d('0x15')][_0xba3d('0x13')]);}})[_0xba3d('0x16')](function(_0x2ce092){logger['error'](_0xba3d('0x14'),_0x1bacd7,_0x2ce092);_0x3b69e9(_0x2ce092);});});} \ No newline at end of file +var _0x6582=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6582,0x108));var _0x2658=function(_0xc3a71f,_0x54fe71){_0xc3a71f=_0xc3a71f-0x0;var _0x46a474=_0x6582[_0xc3a71f];return _0x46a474;};'use strict';var _=require(_0x2658('0x0'));var util=require(_0x2658('0x1'));var moment=require(_0x2658('0x2'));var BPromise=require(_0x2658('0x3'));var rs=require(_0x2658('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2658('0x5'))['db'];var utils=require(_0x2658('0x6'));var logger=require(_0x2658('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2658('0x8')][_0x2658('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cb94f,_0x3f53e7,_0x443df){return new BPromise(function(_0x412a9f,_0x52ef38){return client[_0x2658('0xa')](_0x2cb94f,_0x443df)[_0x2658('0xb')](function(_0x426744){logger[_0x2658('0xc')](_0x2658('0xd'),_0x3f53e7,_0x2658('0xe'));logger[_0x2658('0xf')](_0x2658('0x10'),_0x3f53e7,_0x2658('0xe'),JSON['stringify'](_0x426744));if(_0x426744[_0x2658('0x11')]){if(_0x426744['error'][_0x2658('0x12')]===0x1f4){logger[_0x2658('0x11')](_0x2658('0xd'),_0x3f53e7,_0x426744[_0x2658('0x11')][_0x2658('0x13')]);return _0x52ef38(_0x426744[_0x2658('0x11')][_0x2658('0x13')]);}logger['error'](_0x2658('0xd'),_0x3f53e7,_0x426744[_0x2658('0x11')][_0x2658('0x13')]);return _0x412a9f(_0x426744[_0x2658('0x11')][_0x2658('0x13')]);}else{logger['info'](_0x2658('0xd'),_0x3f53e7,_0x2658('0xe'));_0x412a9f(_0x426744[_0x2658('0x14')]['message']);}})[_0x2658('0x15')](function(_0x44c6d2){logger[_0x2658('0x11')](_0x2658('0xd'),_0x3f53e7,_0x44c6d2);_0x52ef38(_0x44c6d2);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index f72ec39..257691c 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 _0xc274=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x3f3858,_0x5b79a6){var _0x3fcee5=function(_0x33e072){while(--_0x33e072){_0x3f3858['push'](_0x3f3858['shift']());}};_0x3fcee5(++_0x5b79a6);}(_0xc274,0x6d));var _0x4c27=function(_0x2be959,_0x1add11){_0x2be959=_0x2be959-0x0;var _0x18487e=_0xc274[_0x2be959];return _0x18487e;};'use strict';var multer=require(_0x4c27('0x0'));var util=require(_0x4c27('0x1'));var path=require(_0x4c27('0x2'));var timeout=require(_0x4c27('0x3'));var express=require(_0x4c27('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4c27('0x5'));var config=require(_0x4c27('0x6'));var controller=require('./intZendeskAccount.controller');router[_0x4c27('0x7')]('/',auth[_0x4c27('0x8')](),controller[_0x4c27('0x9')]);router[_0x4c27('0x7')](_0x4c27('0xa'),auth[_0x4c27('0x8')](),controller[_0x4c27('0xb')]);router['get'](_0x4c27('0xc'),auth[_0x4c27('0x8')](),controller[_0x4c27('0xd')]);router[_0x4c27('0x7')](_0x4c27('0xe'),auth[_0x4c27('0x8')](),controller[_0x4c27('0xf')]);router[_0x4c27('0x10')]('/',auth[_0x4c27('0x8')](),controller[_0x4c27('0x11')]);router[_0x4c27('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4c27('0x12')]);router['put'](_0x4c27('0xa'),auth[_0x4c27('0x8')](),controller[_0x4c27('0x13')]);router[_0x4c27('0x14')](_0x4c27('0xa'),auth[_0x4c27('0x8')](),controller[_0x4c27('0x15')]);module[_0x4c27('0x16')]=router; \ No newline at end of file +var _0x24e1=['update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','/:id'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x24e1,0x178));var _0x124e=function(_0x28dfde,_0x867f69){_0x28dfde=_0x28dfde-0x0;var _0xa3414d=_0x24e1[_0x28dfde];return _0xa3414d;};'use strict';var multer=require(_0x124e('0x0'));var util=require(_0x124e('0x1'));var path=require(_0x124e('0x2'));var timeout=require(_0x124e('0x3'));var express=require(_0x124e('0x4'));var router=express[_0x124e('0x5')]();var auth=require(_0x124e('0x6'));var interaction=require(_0x124e('0x7'));var config=require('../../config/environment');var controller=require(_0x124e('0x8'));router[_0x124e('0x9')]('/',auth[_0x124e('0xa')](),controller[_0x124e('0xb')]);router[_0x124e('0x9')]('/:id',auth[_0x124e('0xa')](),controller['show']);router[_0x124e('0x9')]('/:id/configurations',auth[_0x124e('0xa')](),controller[_0x124e('0xc')]);router[_0x124e('0x9')](_0x124e('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x124e('0xe')]('/',auth['isAuthenticated'](),controller[_0x124e('0xf')]);router['post'](_0x124e('0x10'),auth[_0x124e('0xa')](),controller[_0x124e('0x11')]);router[_0x124e('0x12')](_0x124e('0x13'),auth['isAuthenticated'](),controller[_0x124e('0x14')]);router['delete'](_0x124e('0x13'),auth[_0x124e('0xa')](),controller['destroy']);module[_0x124e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 5ab6a39..645b31b 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 _0x02ce=['ENUM','password','token','newTab','integrationTab','sequelize','exports','STRING','remoteUri'];(function(_0x5998d0,_0x24ad81){var _0x47149d=function(_0x5e4d63){while(--_0x5e4d63){_0x5998d0['push'](_0x5998d0['shift']());}};_0x47149d(++_0x24ad81);}(_0x02ce,0x1ac));var _0xe02c=function(_0x5531ef,_0x79ea80){_0x5531ef=_0x5531ef-0x0;var _0x138b92=_0x02ce[_0x5531ef];return _0x138b92;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'name':{'type':Sequelize[_0xe02c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe02c('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xe02c('0x2')]},'token':{'type':Sequelize[_0xe02c('0x2')]},'remoteUri':{'type':Sequelize[_0xe02c('0x2')],'unique':_0xe02c('0x3')},'authType':{'type':Sequelize[_0xe02c('0x4')](_0xe02c('0x5'),_0xe02c('0x6')),'defaultValue':_0xe02c('0x5')},'serverUrl':{'type':Sequelize[_0xe02c('0x2')]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xe02c('0x7')),'defaultValue':_0xe02c('0x8')}}; \ No newline at end of file +var _0xb64f=['STRING','remoteUri','ENUM','password','token','integrationTab','newTab','sequelize','exports'];(function(_0x5c68af,_0x590273){var _0x567544=function(_0x2825e5){while(--_0x2825e5){_0x5c68af['push'](_0x5c68af['shift']());}};_0x567544(++_0x590273);}(_0xb64f,0x18a));var _0xfb64=function(_0x4c2f30,_0xa91340){_0x4c2f30=_0x4c2f30-0x0;var _0xb8854d=_0xb64f[_0x4c2f30];return _0xb8854d;};'use strict';var Sequelize=require(_0xfb64('0x0'));module[_0xfb64('0x1')]={'name':{'type':Sequelize[_0xfb64('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfb64('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xfb64('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xfb64('0x3')},'authType':{'type':Sequelize[_0xfb64('0x4')](_0xfb64('0x5'),_0xfb64('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xfb64('0x7'),_0xfb64('0x8')),'defaultValue':_0xfb64('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 68acaa9..ae91712 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 _0xb7fc=['then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','save','destroy','name','send','index','ZendeskAccount','rawAttributes','fieldName','key','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','findAll','show','params','filters','include','find','create','body','update','getConfigurations','findOne','ZendeskConfiguration','length','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','password','headers','toString','Basic\x20%s','%s/token:%s','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','position','system_field_options','custom_field_options','statusCode','stringify','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7fc,0x1ec));var _0xcb7f=function(_0x48f8c4,_0x4e3dba){_0x48f8c4=_0x48f8c4-0x0;var _0x118849=_0xb7fc[_0x48f8c4];return _0x118849;};'use strict';var pdf=require(_0xcb7f('0x0'));var emlformat=require(_0xcb7f('0x1'));var rimraf=require(_0xcb7f('0x2'));var zipdir=require(_0xcb7f('0x3'));var jsonpatch=require(_0xcb7f('0x4'));var rp=require(_0xcb7f('0x5'));var moment=require(_0xcb7f('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xcb7f('0x7'));var util=require(_0xcb7f('0x8'));var path=require(_0xcb7f('0x9'));var sox=require(_0xcb7f('0xa'));var csv=require(_0xcb7f('0xb'));var ejs=require(_0xcb7f('0xc'));var fs=require('fs');var _=require(_0xcb7f('0xd'));var squel=require(_0xcb7f('0xe'));var crypto=require(_0xcb7f('0xf'));var jsforce=require(_0xcb7f('0x10'));var deskjs=require(_0xcb7f('0x11'));var toCsv=require(_0xcb7f('0xb'));var querystring=require(_0xcb7f('0x12'));var Papa=require(_0xcb7f('0x13'));var Redis=require(_0xcb7f('0x14'));var authService=require(_0xcb7f('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xcb7f('0x16'));var hardwareService=require(_0xcb7f('0x17'));var logger=require(_0xcb7f('0x18'))(_0xcb7f('0x19'));var utils=require(_0xcb7f('0x1a'));var config=require('../../config/environment');var db=require(_0xcb7f('0x1b'))['db'];var integrations=require(_0xcb7f('0x1c'));var jayson=require(_0xcb7f('0x1d'));var client=jayson[_0xcb7f('0x1e')][_0xcb7f('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x966e75,_0x19e9e9,_0x2ac4de){if(_0x2ac4de){var _0x2b56ee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b56ee['test'](_0x19e9e9)){return _0x966e75;}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 _0x966e75;}}function respondWithRpcPromise(_0x20152d,_0x114d3a,_0x52953f,_0xc6d901){return new BPromise(function(_0x5be246,_0x2666f8){var _0x145d63=_0xc6d901||client;return _0x145d63['request'](_0x20152d,_0x52953f)[_0xcb7f('0x20')](function(_0xc9e2d2){logger[_0xcb7f('0x21')](_0xcb7f('0x22'),_0x114d3a,_0xcb7f('0x23'));logger[_0xcb7f('0x24')](_0xcb7f('0x25'),_0x114d3a,'request\x20sent',JSON['stringify'](_0xc9e2d2));if(_0xc9e2d2[_0xcb7f('0x26')]){if(_0xc9e2d2[_0xcb7f('0x26')][_0xcb7f('0x27')]===0x1f4){logger[_0xcb7f('0x26')](_0xcb7f('0x22'),_0x114d3a,_0xc9e2d2[_0xcb7f('0x26')][_0xcb7f('0x28')]);return _0x2666f8(_0xc9e2d2[_0xcb7f('0x26')]['message']);}logger[_0xcb7f('0x26')]('ZendeskAccount,\x20%s,\x20%s',_0x114d3a,_0xc9e2d2[_0xcb7f('0x26')][_0xcb7f('0x28')]);return _0x5be246(_0xc9e2d2[_0xcb7f('0x26')][_0xcb7f('0x28')]);}else{logger['info'](_0xcb7f('0x22'),_0x114d3a,_0xcb7f('0x23'));_0x5be246(_0xc9e2d2[_0xcb7f('0x29')][_0xcb7f('0x28')]);}})[_0xcb7f('0x2a')](function(_0x1ba3e9){logger[_0xcb7f('0x26')](_0xcb7f('0x22'),_0x114d3a,_0x1ba3e9);_0x2666f8(_0x1ba3e9);});});}function respondWithStatusCode(_0x2aba6f,_0x5bc48a){_0x5bc48a=_0x5bc48a||0xcc;return function(_0x1c5115){if(_0x1c5115){return _0x2aba6f[_0xcb7f('0x2b')](_0x5bc48a);}return _0x2aba6f[_0xcb7f('0x2c')](_0x5bc48a)[_0xcb7f('0x2d')]();};}function respondWithResult(_0x11d992,_0x10fc6){_0x10fc6=_0x10fc6||0xc8;return function(_0x5735d9){if(_0x5735d9){return _0x11d992[_0xcb7f('0x2c')](_0x10fc6)[_0xcb7f('0x2e')](_0x5735d9);}};}function respondWithFilteredResult(_0x57bf10,_0x47987d){return function(_0x44c11e){if(_0x44c11e){var _0x10c0c4=_0x44c11e['count'],_0x40eb0b=_0x47987d[_0xcb7f('0x2f')],_0x4fa487=_0x47987d[_0xcb7f('0x2f')]+_0x47987d[_0xcb7f('0x30')],_0x228053;if(_0x4fa487>=_0x10c0c4){_0x4fa487=_0x10c0c4;_0x228053=0xc8;}else{_0x228053=0xce;}_0x57bf10[_0xcb7f('0x2c')](_0x228053);return _0x57bf10[_0xcb7f('0x31')](_0xcb7f('0x32'),_0x40eb0b+'-'+_0x4fa487+'/'+_0x10c0c4)['json'](_0x44c11e);}return null;};}function patchUpdates(_0x18861c){return function(_0x2c1f31){try{jsonpatch['apply'](_0x2c1f31,_0x18861c,!![]);}catch(_0x40377b){return BPromise['reject'](_0x40377b);}return _0x2c1f31[_0xcb7f('0x33')]();};}function saveUpdates(_0x3403f3,_0x4c6c6c){return function(_0x308dc2){if(_0x308dc2){return _0x308dc2['update'](_0x3403f3)[_0xcb7f('0x20')](function(_0x1a41fa){return _0x1a41fa;});}return null;};}function removeEntity(_0x45226d,_0xff290a){return function(_0x59ea15){if(_0x59ea15){return _0x59ea15[_0xcb7f('0x34')]()[_0xcb7f('0x20')](function(){_0x45226d[_0xcb7f('0x2c')](0xcc)[_0xcb7f('0x2d')]();});}};}function handleEntityNotFound(_0x36247c,_0x3e98f6){return function(_0x3011af){if(!_0x3011af){_0x36247c[_0xcb7f('0x2b')](0x194);}return _0x3011af;};}function handleError(_0x52d637,_0x5b4c30){_0x5b4c30=_0x5b4c30||0x1f4;return function(_0x36bfa6){logger['error'](_0x36bfa6['stack']);if(_0x36bfa6[_0xcb7f('0x35')]){delete _0x36bfa6[_0xcb7f('0x35')];}_0x52d637[_0xcb7f('0x2c')](_0x5b4c30)[_0xcb7f('0x36')](_0x36bfa6);};}exports[_0xcb7f('0x37')]=function(_0x972478,_0x181243){var _0x3a1bfd={},_0x776af3={},_0x33d383={'count':0x0,'rows':[]};var _0x1be6ef=_['map'](db[_0xcb7f('0x38')][_0xcb7f('0x39')],function(_0x7462){return{'name':_0x7462[_0xcb7f('0x3a')],'type':_0x7462['type'][_0xcb7f('0x3b')]};});_0x776af3['model']=_[_0xcb7f('0x3c')](_0x1be6ef,'name');_0x776af3[_0xcb7f('0x3d')]=_[_0xcb7f('0x3e')](_0x972478['query']);_0x776af3['filters']=_[_0xcb7f('0x3f')](_0x776af3[_0xcb7f('0x40')],_0x776af3[_0xcb7f('0x3d')]);_0x3a1bfd['attributes']=_[_0xcb7f('0x3f')](_0x776af3[_0xcb7f('0x40')],qs[_0xcb7f('0x41')](_0x972478['query']['fields']));_0x3a1bfd['attributes']=_0x3a1bfd['attributes']['length']?_0x3a1bfd[_0xcb7f('0x42')]:_0x776af3[_0xcb7f('0x40')];if(!_0x972478[_0xcb7f('0x3d')][_0xcb7f('0x43')]('nolimit')){_0x3a1bfd[_0xcb7f('0x30')]=qs[_0xcb7f('0x30')](_0x972478[_0xcb7f('0x3d')][_0xcb7f('0x30')]);_0x3a1bfd['offset']=qs['offset'](_0x972478[_0xcb7f('0x3d')][_0xcb7f('0x2f')]);}_0x3a1bfd[_0xcb7f('0x44')]=qs[_0xcb7f('0x45')](_0x972478['query'][_0xcb7f('0x45')]);_0x3a1bfd[_0xcb7f('0x46')]=qs['filters'](_[_0xcb7f('0x47')](_0x972478['query'],_0x776af3['filters']),_0x1be6ef);if(_0x972478[_0xcb7f('0x3d')][_0xcb7f('0x48')]){_0x3a1bfd['where']=_['merge'](_0x3a1bfd[_0xcb7f('0x46')],{'$or':_['map'](_0x1be6ef,function(_0x24fbf1){if(_0x24fbf1[_0xcb7f('0x49')]!==_0xcb7f('0x4a')){var _0x15ed88={};_0x15ed88[_0x24fbf1[_0xcb7f('0x35')]]={'$like':'%'+_0x972478[_0xcb7f('0x3d')][_0xcb7f('0x48')]+'%'};return _0x15ed88;}})});}_0x3a1bfd=_[_0xcb7f('0x4b')]({},_0x3a1bfd,_0x972478[_0xcb7f('0x4c')]);var _0x4c0363={'where':_0x3a1bfd[_0xcb7f('0x46')]};return db['ZendeskAccount']['count'](_0x4c0363)[_0xcb7f('0x20')](function(_0x5177ab){_0x33d383[_0xcb7f('0x4d')]=_0x5177ab;if(_0x972478[_0xcb7f('0x3d')][_0xcb7f('0x4e')]){_0x3a1bfd['include']=[{'all':!![]}];}return db[_0xcb7f('0x38')][_0xcb7f('0x4f')](_0x3a1bfd);})[_0xcb7f('0x20')](function(_0x558a98){_0x33d383['rows']=_0x558a98;return _0x33d383;})[_0xcb7f('0x20')](respondWithFilteredResult(_0x181243,_0x3a1bfd))[_0xcb7f('0x2a')](handleError(_0x181243,null));};exports[_0xcb7f('0x50')]=function(_0x2a5467,_0x64488){var _0x22f429={'raw':![],'where':{'id':_0x2a5467[_0xcb7f('0x51')]['id']}},_0x22176c={};_0x22176c['model']=_['keys'](db[_0xcb7f('0x38')][_0xcb7f('0x39')]);_0x22176c[_0xcb7f('0x3d')]=_[_0xcb7f('0x3e')](_0x2a5467[_0xcb7f('0x3d')]);_0x22176c[_0xcb7f('0x52')]=_[_0xcb7f('0x3f')](_0x22176c[_0xcb7f('0x40')],_0x22176c[_0xcb7f('0x3d')]);_0x22f429[_0xcb7f('0x42')]=_[_0xcb7f('0x3f')](_0x22176c[_0xcb7f('0x40')],qs['fields'](_0x2a5467[_0xcb7f('0x3d')]['fields']));_0x22f429[_0xcb7f('0x42')]=_0x22f429[_0xcb7f('0x42')]['length']?_0x22f429[_0xcb7f('0x42')]:_0x22176c[_0xcb7f('0x40')];if(_0x2a5467[_0xcb7f('0x3d')][_0xcb7f('0x4e')]){_0x22f429[_0xcb7f('0x53')]=[{'all':!![]}];}_0x22f429=_[_0xcb7f('0x4b')]({},_0x22f429,_0x2a5467[_0xcb7f('0x4c')]);return db[_0xcb7f('0x38')][_0xcb7f('0x54')](_0x22f429)[_0xcb7f('0x20')](handleEntityNotFound(_0x64488,null))[_0xcb7f('0x20')](respondWithResult(_0x64488,null))[_0xcb7f('0x2a')](handleError(_0x64488,null));};exports[_0xcb7f('0x55')]=function(_0x1025c5,_0x23b740){return db[_0xcb7f('0x38')]['create'](_0x1025c5[_0xcb7f('0x56')],{})['then'](respondWithResult(_0x23b740,0xc9))[_0xcb7f('0x2a')](handleError(_0x23b740,null));};exports[_0xcb7f('0x57')]=function(_0x175da0,_0x5add39){if(_0x175da0['body']['id']){delete _0x175da0[_0xcb7f('0x56')]['id'];}return db[_0xcb7f('0x38')][_0xcb7f('0x54')]({'where':{'id':_0x175da0[_0xcb7f('0x51')]['id']}})[_0xcb7f('0x20')](handleEntityNotFound(_0x5add39,null))[_0xcb7f('0x20')](saveUpdates(_0x175da0[_0xcb7f('0x56')],null))[_0xcb7f('0x20')](respondWithResult(_0x5add39,null))[_0xcb7f('0x2a')](handleError(_0x5add39,null));};exports[_0xcb7f('0x34')]=function(_0x2be27c,_0x176e26){return db['ZendeskAccount'][_0xcb7f('0x54')]({'where':{'id':_0x2be27c['params']['id']}})[_0xcb7f('0x20')](handleEntityNotFound(_0x176e26,null))[_0xcb7f('0x20')](removeEntity(_0x176e26,null))[_0xcb7f('0x2a')](handleError(_0x176e26,null));};exports[_0xcb7f('0x58')]=function(_0x4c6934,_0x18c7e2,_0x494fd2){var _0xe63dd0={};var _0x292a03={};var _0x40cc49;var _0x2baf38;return db[_0xcb7f('0x38')][_0xcb7f('0x59')]({'where':{'id':_0x4c6934['params']['id']}})[_0xcb7f('0x20')](handleEntityNotFound(_0x18c7e2,null))[_0xcb7f('0x20')](function(_0x5458d0){if(_0x5458d0){_0x40cc49=_0x5458d0;_0x292a03['model']=_[_0xcb7f('0x3e')](db[_0xcb7f('0x5a')][_0xcb7f('0x39')]);_0x292a03[_0xcb7f('0x3d')]=_[_0xcb7f('0x3e')](_0x4c6934[_0xcb7f('0x3d')]);_0x292a03[_0xcb7f('0x52')]=_['intersection'](_0x292a03[_0xcb7f('0x40')],_0x292a03[_0xcb7f('0x3d')]);_0xe63dd0[_0xcb7f('0x42')]=_['intersection'](_0x292a03[_0xcb7f('0x40')],qs[_0xcb7f('0x41')](_0x4c6934[_0xcb7f('0x3d')][_0xcb7f('0x41')]));_0xe63dd0[_0xcb7f('0x42')]=_0xe63dd0[_0xcb7f('0x42')][_0xcb7f('0x5b')]?_0xe63dd0[_0xcb7f('0x42')]:_0x292a03[_0xcb7f('0x40')];_0xe63dd0[_0xcb7f('0x44')]=qs['sort'](_0x4c6934[_0xcb7f('0x3d')]['sort']);_0xe63dd0['where']=qs[_0xcb7f('0x52')](_['pick'](_0x4c6934[_0xcb7f('0x3d')],_0x292a03[_0xcb7f('0x52')]));if(_0x4c6934['query'][_0xcb7f('0x48')]){_0xe63dd0[_0xcb7f('0x46')]=_[_0xcb7f('0x4b')](_0xe63dd0[_0xcb7f('0x46')],{'$or':_[_0xcb7f('0x3c')](_0xe63dd0['attributes'],function(_0x1a4d70){var _0x1deeb6={};_0x1deeb6[_0x1a4d70]={'$like':'%'+_0x4c6934[_0xcb7f('0x3d')][_0xcb7f('0x48')]+'%'};return _0x1deeb6;})});}_0xe63dd0=_[_0xcb7f('0x4b')]({},_0xe63dd0,_0x4c6934[_0xcb7f('0x4c')]);return _0x40cc49[_0xcb7f('0x58')](_0xe63dd0);}})[_0xcb7f('0x20')](function(_0x57bfcd){if(_0x57bfcd){_0x2baf38=_0x57bfcd[_0xcb7f('0x5b')];if(!_0x4c6934[_0xcb7f('0x3d')][_0xcb7f('0x43')](_0xcb7f('0x5c'))){_0xe63dd0[_0xcb7f('0x30')]=qs[_0xcb7f('0x30')](_0x4c6934['query']['limit']);_0xe63dd0[_0xcb7f('0x2f')]=qs[_0xcb7f('0x2f')](_0x4c6934[_0xcb7f('0x3d')][_0xcb7f('0x2f')]);}return _0x40cc49['getConfigurations'](_0xe63dd0);}})[_0xcb7f('0x20')](function(_0x139c0f){if(_0x139c0f){return _0x139c0f?{'count':_0x2baf38,'rows':_0x139c0f}:null;}})[_0xcb7f('0x20')](respondWithResult(_0x18c7e2,null))[_0xcb7f('0x2a')](handleError(_0x18c7e2,null));};exports['addConfiguration']=function(_0x3f59f4,_0x91ca5f,_0x2ce2d5){if(_0x3f59f4['body']['id']){delete _0x3f59f4['body']['id'];}return db[_0xcb7f('0x38')][_0xcb7f('0x59')]({'where':{'id':_0x3f59f4[_0xcb7f('0x51')]['id']}})[_0xcb7f('0x20')](handleEntityNotFound(_0x91ca5f,null))[_0xcb7f('0x20')](function(_0x115f9f){if(_0x115f9f){_0x3f59f4[_0xcb7f('0x56')][_0xcb7f('0x5d')]=_0x115f9f['id'];_0x3f59f4[_0xcb7f('0x56')][_0xcb7f('0x5e')]=integrations[_0xcb7f('0x5f')](_0x3f59f4[_0xcb7f('0x56')][_0xcb7f('0x60')],_0x3f59f4[_0xcb7f('0x56')][_0xcb7f('0x49')]);_0x3f59f4['body'][_0xcb7f('0x61')]=integrations[_0xcb7f('0x62')](_0x3f59f4['body']['channel'],_0x3f59f4[_0xcb7f('0x56')][_0xcb7f('0x49')]);return db[_0xcb7f('0x5a')][_0xcb7f('0x55')](_0x3f59f4[_0xcb7f('0x56')],{'include':[{'model':db[_0xcb7f('0x63')],'as':_0xcb7f('0x5e')},{'model':db[_0xcb7f('0x63')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x91ca5f,null))[_0xcb7f('0x2a')](handleError(_0x91ca5f,null));};exports[_0xcb7f('0x64')]=function(_0x3e6d46,_0x436d80,_0x23ec3c){var _0x33e0c0='';return db[_0xcb7f('0x38')][_0xcb7f('0x59')]({'where':{'id':_0x3e6d46[_0xcb7f('0x51')]['id']},'attributes':['id',_0xcb7f('0x65'),'password',_0xcb7f('0x66'),_0xcb7f('0x67'),_0xcb7f('0x68')]})[_0xcb7f('0x20')](handleEntityNotFound(_0x436d80,null))[_0xcb7f('0x20')](function(_0x51e87b){if(_0x51e87b){_0x33e0c0=_0x51e87b[_0xcb7f('0x68')];var _0x7eb3ce=_0x33e0c0[_0xcb7f('0x69')](-0x1);if(_0x7eb3ce==='/'){_0x33e0c0=_0x33e0c0[_0xcb7f('0x6a')](0x0,_0x33e0c0[_0xcb7f('0x6b')](_0x7eb3ce));}var _0x51f047={'method':_0xcb7f('0x6c'),'uri':util[_0xcb7f('0x6d')](_0xcb7f('0x6e'),_0x33e0c0,_0xcb7f('0x6f')),'json':!![]};switch(_0x51e87b['authType']){case _0xcb7f('0x70'):_0x51f047[_0xcb7f('0x71')]={'Authorization':util[_0xcb7f('0x6d')]('Basic\x20%s',new Buffer(util[_0xcb7f('0x6d')]('%s:%s',_0x51e87b['username'],_0x51e87b[_0xcb7f('0x70')]))[_0xcb7f('0x72')]('base64'))};break;case'token':_0x51f047[_0xcb7f('0x71')]={'Authorization':util['format'](_0xcb7f('0x73'),new Buffer(util[_0xcb7f('0x6d')](_0xcb7f('0x74'),_0x51e87b[_0xcb7f('0x65')],_0x51e87b['token']))[_0xcb7f('0x72')](_0xcb7f('0x75')))};break;default:throw new db[(_0xcb7f('0x76'))][(_0xcb7f('0x77'))](_0xcb7f('0x78'));}return rp(_0x51f047);}})[_0xcb7f('0x20')](function(_0x1d1249){if(_0x1d1249){var _0x427e11=[_0xcb7f('0x79'),_0xcb7f('0x7a'),'group','assignee'];_[_0xcb7f('0x7b')](_0x1d1249[_0xcb7f('0x6f')],function(_0x548cb0){return _0x427e11['includes'](_0x548cb0[_0xcb7f('0x49')]);});return{'count':_0x1d1249[_0xcb7f('0x6f')][_0xcb7f('0x5b')],'rows':_[_0xcb7f('0x3c')](_0x1d1249[_0xcb7f('0x6f')],function(_0x1cea0b){return{'id':_0x1cea0b['id'],'name':_0x1cea0b[_0xcb7f('0x7c')]>0x7?_0x1cea0b['title']:_0x1cea0b['type'],'custom':_0x1cea0b['position']>0x7?!![]:![],'options':_0x1cea0b[_0xcb7f('0x7d')]?_0x1cea0b[_0xcb7f('0x7d')]:_0x1cea0b[_0xcb7f('0x7e')]?_0x1cea0b['custom_field_options']:[]};})};}})[_0xcb7f('0x20')](respondWithResult(_0x436d80,null))[_0xcb7f('0x2a')](function(_0x25339f){var _0x51f36b=_0x3e6d46[_0xcb7f('0x3d')]['test']?0x1f4:_0x25339f[_0xcb7f('0x7f')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xcb7f('0x64'),_0x51f36b,JSON[_0xcb7f('0x80')](_0x25339f));delete _0x25339f[_0xcb7f('0x35')];if(_0x51f36b===0x191){_0x51f36b=0x190;}_0x436d80[_0xcb7f('0x2c')](_0x51f36b)[_0xcb7f('0x36')](_0x3e6d46[_0xcb7f('0x3d')][_0xcb7f('0x81')]?{'message':_0xcb7f('0x82'),'statusCode':_0x25339f['statusCode']}:_0x25339f);});}; \ No newline at end of file +var _0x3aee=['test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','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','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','model','length','create','body','find','params','getConfigurations','findOne','ZendeskConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','getFields','username','password','authType','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','headers','format','%s:%s','base64','token','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options'];(function(_0x5a1fc0,_0x307f13){var _0x31897a=function(_0x56bb26){while(--_0x56bb26){_0x5a1fc0['push'](_0x5a1fc0['shift']());}};_0x31897a(++_0x307f13);}(_0x3aee,0x104));var _0xe3ae=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0x3aee[_0x4358f5];return _0x4d8104;};'use strict';var pdf=require(_0xe3ae('0x0'));var emlformat=require(_0xe3ae('0x1'));var rimraf=require(_0xe3ae('0x2'));var zipdir=require(_0xe3ae('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe3ae('0x4'));var BPromise=require(_0xe3ae('0x5'));var Mustache=require(_0xe3ae('0x6'));var util=require('util');var path=require(_0xe3ae('0x7'));var sox=require(_0xe3ae('0x8'));var csv=require(_0xe3ae('0x9'));var ejs=require(_0xe3ae('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe3ae('0xb'));var jsforce=require(_0xe3ae('0xc'));var deskjs=require(_0xe3ae('0xd'));var toCsv=require(_0xe3ae('0x9'));var querystring=require('querystring');var Papa=require(_0xe3ae('0xe'));var Redis=require(_0xe3ae('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe3ae('0x10'));var as=require(_0xe3ae('0x11'));var hardwareService=require(_0xe3ae('0x12'));var logger=require('../../config/logger')(_0xe3ae('0x13'));var utils=require(_0xe3ae('0x14'));var config=require(_0xe3ae('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xe3ae('0x16'));var client=jayson['client'][_0xe3ae('0x17')]({'port':0x232a});function checkPasswordPattern(_0x1a9536,_0x5a3734,_0x1098d9){if(_0x1098d9){var _0x4027d5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4027d5['test'](_0x5a3734)){return _0x1a9536;}else{throw new db[(_0xe3ae('0x18'))][(_0xe3ae('0x19'))](_0xe3ae('0x1a'));}}else{return _0x1a9536;}}function respondWithRpcPromise(_0x379795,_0x5df276,_0x59fbf8,_0x1e9dd5){return new BPromise(function(_0x27c5c1,_0x23f473){var _0x5adf3=_0x1e9dd5||client;return _0x5adf3[_0xe3ae('0x1b')](_0x379795,_0x59fbf8)[_0xe3ae('0x1c')](function(_0x545639){logger['info'](_0xe3ae('0x1d'),_0x5df276,_0xe3ae('0x1e'));logger[_0xe3ae('0x1f')](_0xe3ae('0x20'),_0x5df276,'request\x20sent',JSON[_0xe3ae('0x21')](_0x545639));if(_0x545639[_0xe3ae('0x22')]){if(_0x545639[_0xe3ae('0x22')]['code']===0x1f4){logger[_0xe3ae('0x22')](_0xe3ae('0x1d'),_0x5df276,_0x545639[_0xe3ae('0x22')]['message']);return _0x23f473(_0x545639[_0xe3ae('0x22')][_0xe3ae('0x23')]);}logger[_0xe3ae('0x22')](_0xe3ae('0x1d'),_0x5df276,_0x545639[_0xe3ae('0x22')]['message']);return _0x27c5c1(_0x545639['error'][_0xe3ae('0x23')]);}else{logger[_0xe3ae('0x24')](_0xe3ae('0x1d'),_0x5df276,'request\x20sent');_0x27c5c1(_0x545639[_0xe3ae('0x25')]['message']);}})[_0xe3ae('0x26')](function(_0xdf79ca){logger[_0xe3ae('0x22')](_0xe3ae('0x1d'),_0x5df276,_0xdf79ca);_0x23f473(_0xdf79ca);});});}function respondWithStatusCode(_0x216bd2,_0x2ad57f){_0x2ad57f=_0x2ad57f||0xcc;return function(_0x5e2518){if(_0x5e2518){return _0x216bd2[_0xe3ae('0x27')](_0x2ad57f);}return _0x216bd2[_0xe3ae('0x28')](_0x2ad57f)[_0xe3ae('0x29')]();};}function respondWithResult(_0x5eefd6,_0x4230cd){_0x4230cd=_0x4230cd||0xc8;return function(_0x4f5046){if(_0x4f5046){return _0x5eefd6[_0xe3ae('0x28')](_0x4230cd)[_0xe3ae('0x2a')](_0x4f5046);}};}function respondWithFilteredResult(_0x360273,_0x71bc54){return function(_0x42915b){if(_0x42915b){var _0x4df257=_0x42915b[_0xe3ae('0x2b')],_0x4222d9=_0x71bc54[_0xe3ae('0x2c')],_0x66ebd2=_0x71bc54['offset']+_0x71bc54[_0xe3ae('0x2d')],_0x5b6e74;if(_0x66ebd2>=_0x4df257){_0x66ebd2=_0x4df257;_0x5b6e74=0xc8;}else{_0x5b6e74=0xce;}_0x360273[_0xe3ae('0x28')](_0x5b6e74);return _0x360273[_0xe3ae('0x2e')](_0xe3ae('0x2f'),_0x4222d9+'-'+_0x66ebd2+'/'+_0x4df257)[_0xe3ae('0x2a')](_0x42915b);}return null;};}function patchUpdates(_0x44733a){return function(_0x4d941a){try{jsonpatch['apply'](_0x4d941a,_0x44733a,!![]);}catch(_0x5d8011){return BPromise[_0xe3ae('0x30')](_0x5d8011);}return _0x4d941a[_0xe3ae('0x31')]();};}function saveUpdates(_0xeb2845,_0x8c6d4d){return function(_0x45ded6){if(_0x45ded6){return _0x45ded6['update'](_0xeb2845)[_0xe3ae('0x1c')](function(_0x44070a){return _0x44070a;});}return null;};}function removeEntity(_0x1abc6e,_0xce4bdf){return function(_0x232b48){if(_0x232b48){return _0x232b48[_0xe3ae('0x32')]()[_0xe3ae('0x1c')](function(){_0x1abc6e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c123e,_0xed1e6c){return function(_0x4d3646){if(!_0x4d3646){_0x2c123e[_0xe3ae('0x27')](0x194);}return _0x4d3646;};}function handleError(_0x1358b3,_0xab160c){_0xab160c=_0xab160c||0x1f4;return function(_0x2013f1){logger[_0xe3ae('0x22')](_0x2013f1['stack']);if(_0x2013f1[_0xe3ae('0x33')]){delete _0x2013f1[_0xe3ae('0x33')];}_0x1358b3[_0xe3ae('0x28')](_0xab160c)[_0xe3ae('0x34')](_0x2013f1);};}exports[_0xe3ae('0x35')]=function(_0x3b4725,_0x1c8d80){var _0x517d6c={},_0x5e93a6={},_0x36711f={'count':0x0,'rows':[]};var _0x354460=_[_0xe3ae('0x36')](db[_0xe3ae('0x37')][_0xe3ae('0x38')],function(_0x21ba9c){return{'name':_0x21ba9c[_0xe3ae('0x39')],'type':_0x21ba9c[_0xe3ae('0x3a')][_0xe3ae('0x3b')]};});_0x5e93a6['model']=_[_0xe3ae('0x36')](_0x354460,_0xe3ae('0x33'));_0x5e93a6[_0xe3ae('0x3c')]=_[_0xe3ae('0x3d')](_0x3b4725[_0xe3ae('0x3c')]);_0x5e93a6['filters']=_[_0xe3ae('0x3e')](_0x5e93a6['model'],_0x5e93a6[_0xe3ae('0x3c')]);_0x517d6c[_0xe3ae('0x3f')]=_['intersection'](_0x5e93a6['model'],qs[_0xe3ae('0x40')](_0x3b4725[_0xe3ae('0x3c')]['fields']));_0x517d6c['attributes']=_0x517d6c[_0xe3ae('0x3f')]['length']?_0x517d6c['attributes']:_0x5e93a6['model'];if(!_0x3b4725[_0xe3ae('0x3c')][_0xe3ae('0x41')](_0xe3ae('0x42'))){_0x517d6c[_0xe3ae('0x2d')]=qs[_0xe3ae('0x2d')](_0x3b4725[_0xe3ae('0x3c')][_0xe3ae('0x2d')]);_0x517d6c['offset']=qs['offset'](_0x3b4725[_0xe3ae('0x3c')]['offset']);}_0x517d6c[_0xe3ae('0x43')]=qs['sort'](_0x3b4725[_0xe3ae('0x3c')][_0xe3ae('0x44')]);_0x517d6c[_0xe3ae('0x45')]=qs[_0xe3ae('0x46')](_[_0xe3ae('0x47')](_0x3b4725['query'],_0x5e93a6[_0xe3ae('0x46')]),_0x354460);if(_0x3b4725['query'][_0xe3ae('0x48')]){_0x517d6c[_0xe3ae('0x45')]=_[_0xe3ae('0x49')](_0x517d6c[_0xe3ae('0x45')],{'$or':_[_0xe3ae('0x36')](_0x354460,function(_0x44dceb){if(_0x44dceb[_0xe3ae('0x3a')]!==_0xe3ae('0x4a')){var _0x2fe441={};_0x2fe441[_0x44dceb[_0xe3ae('0x33')]]={'$like':'%'+_0x3b4725['query'][_0xe3ae('0x48')]+'%'};return _0x2fe441;}})});}_0x517d6c=_[_0xe3ae('0x49')]({},_0x517d6c,_0x3b4725[_0xe3ae('0x4b')]);var _0x100af1={'where':_0x517d6c[_0xe3ae('0x45')]};return db[_0xe3ae('0x37')][_0xe3ae('0x2b')](_0x100af1)[_0xe3ae('0x1c')](function(_0x5bef35){_0x36711f[_0xe3ae('0x2b')]=_0x5bef35;if(_0x3b4725['query'][_0xe3ae('0x4c')]){_0x517d6c[_0xe3ae('0x4d')]=[{'all':!![]}];}return db[_0xe3ae('0x37')][_0xe3ae('0x4e')](_0x517d6c);})[_0xe3ae('0x1c')](function(_0x42bacd){_0x36711f['rows']=_0x42bacd;return _0x36711f;})[_0xe3ae('0x1c')](respondWithFilteredResult(_0x1c8d80,_0x517d6c))[_0xe3ae('0x26')](handleError(_0x1c8d80,null));};exports[_0xe3ae('0x4f')]=function(_0x402a62,_0x38a15f){var _0xa9bf21={'raw':![],'where':{'id':_0x402a62['params']['id']}},_0x10e8fc={};_0x10e8fc[_0xe3ae('0x50')]=_[_0xe3ae('0x3d')](db[_0xe3ae('0x37')][_0xe3ae('0x38')]);_0x10e8fc[_0xe3ae('0x3c')]=_[_0xe3ae('0x3d')](_0x402a62[_0xe3ae('0x3c')]);_0x10e8fc[_0xe3ae('0x46')]=_[_0xe3ae('0x3e')](_0x10e8fc[_0xe3ae('0x50')],_0x10e8fc[_0xe3ae('0x3c')]);_0xa9bf21[_0xe3ae('0x3f')]=_[_0xe3ae('0x3e')](_0x10e8fc[_0xe3ae('0x50')],qs[_0xe3ae('0x40')](_0x402a62[_0xe3ae('0x3c')][_0xe3ae('0x40')]));_0xa9bf21[_0xe3ae('0x3f')]=_0xa9bf21[_0xe3ae('0x3f')][_0xe3ae('0x51')]?_0xa9bf21[_0xe3ae('0x3f')]:_0x10e8fc[_0xe3ae('0x50')];if(_0x402a62['query'][_0xe3ae('0x4c')]){_0xa9bf21['include']=[{'all':!![]}];}_0xa9bf21=_[_0xe3ae('0x49')]({},_0xa9bf21,_0x402a62[_0xe3ae('0x4b')]);return db[_0xe3ae('0x37')]['find'](_0xa9bf21)[_0xe3ae('0x1c')](handleEntityNotFound(_0x38a15f,null))[_0xe3ae('0x1c')](respondWithResult(_0x38a15f,null))[_0xe3ae('0x26')](handleError(_0x38a15f,null));};exports[_0xe3ae('0x52')]=function(_0x58f33b,_0x5ed360){return db[_0xe3ae('0x37')]['create'](_0x58f33b[_0xe3ae('0x53')],{})[_0xe3ae('0x1c')](respondWithResult(_0x5ed360,0xc9))['catch'](handleError(_0x5ed360,null));};exports['update']=function(_0x48ef85,_0x55ff92){if(_0x48ef85[_0xe3ae('0x53')]['id']){delete _0x48ef85[_0xe3ae('0x53')]['id'];}return db[_0xe3ae('0x37')][_0xe3ae('0x54')]({'where':{'id':_0x48ef85['params']['id']}})[_0xe3ae('0x1c')](handleEntityNotFound(_0x55ff92,null))[_0xe3ae('0x1c')](saveUpdates(_0x48ef85['body'],null))[_0xe3ae('0x1c')](respondWithResult(_0x55ff92,null))[_0xe3ae('0x26')](handleError(_0x55ff92,null));};exports[_0xe3ae('0x32')]=function(_0x9a5d84,_0x2a097d){return db[_0xe3ae('0x37')][_0xe3ae('0x54')]({'where':{'id':_0x9a5d84[_0xe3ae('0x55')]['id']}})[_0xe3ae('0x1c')](handleEntityNotFound(_0x2a097d,null))[_0xe3ae('0x1c')](removeEntity(_0x2a097d,null))[_0xe3ae('0x26')](handleError(_0x2a097d,null));};exports[_0xe3ae('0x56')]=function(_0x19a0a0,_0x1882e5,_0x3094df){var _0x48ae4f={};var _0xb3a63a={};var _0x1ebb2a;var _0x3c81be;return db['ZendeskAccount'][_0xe3ae('0x57')]({'where':{'id':_0x19a0a0['params']['id']}})[_0xe3ae('0x1c')](handleEntityNotFound(_0x1882e5,null))[_0xe3ae('0x1c')](function(_0x1c2163){if(_0x1c2163){_0x1ebb2a=_0x1c2163;_0xb3a63a[_0xe3ae('0x50')]=_[_0xe3ae('0x3d')](db[_0xe3ae('0x58')][_0xe3ae('0x38')]);_0xb3a63a['query']=_[_0xe3ae('0x3d')](_0x19a0a0[_0xe3ae('0x3c')]);_0xb3a63a[_0xe3ae('0x46')]=_[_0xe3ae('0x3e')](_0xb3a63a[_0xe3ae('0x50')],_0xb3a63a[_0xe3ae('0x3c')]);_0x48ae4f[_0xe3ae('0x3f')]=_[_0xe3ae('0x3e')](_0xb3a63a[_0xe3ae('0x50')],qs[_0xe3ae('0x40')](_0x19a0a0[_0xe3ae('0x3c')]['fields']));_0x48ae4f[_0xe3ae('0x3f')]=_0x48ae4f[_0xe3ae('0x3f')]['length']?_0x48ae4f['attributes']:_0xb3a63a[_0xe3ae('0x50')];_0x48ae4f[_0xe3ae('0x43')]=qs[_0xe3ae('0x44')](_0x19a0a0[_0xe3ae('0x3c')][_0xe3ae('0x44')]);_0x48ae4f['where']=qs[_0xe3ae('0x46')](_['pick'](_0x19a0a0[_0xe3ae('0x3c')],_0xb3a63a[_0xe3ae('0x46')]));if(_0x19a0a0[_0xe3ae('0x3c')][_0xe3ae('0x48')]){_0x48ae4f[_0xe3ae('0x45')]=_[_0xe3ae('0x49')](_0x48ae4f['where'],{'$or':_[_0xe3ae('0x36')](_0x48ae4f['attributes'],function(_0x419209){var _0x3aa4bb={};_0x3aa4bb[_0x419209]={'$like':'%'+_0x19a0a0['query'][_0xe3ae('0x48')]+'%'};return _0x3aa4bb;})});}_0x48ae4f=_[_0xe3ae('0x49')]({},_0x48ae4f,_0x19a0a0['options']);return _0x1ebb2a[_0xe3ae('0x56')](_0x48ae4f);}})[_0xe3ae('0x1c')](function(_0x8a6f4f){if(_0x8a6f4f){_0x3c81be=_0x8a6f4f[_0xe3ae('0x51')];if(!_0x19a0a0[_0xe3ae('0x3c')][_0xe3ae('0x41')]('nolimit')){_0x48ae4f[_0xe3ae('0x2d')]=qs[_0xe3ae('0x2d')](_0x19a0a0[_0xe3ae('0x3c')][_0xe3ae('0x2d')]);_0x48ae4f['offset']=qs[_0xe3ae('0x2c')](_0x19a0a0['query'][_0xe3ae('0x2c')]);}return _0x1ebb2a[_0xe3ae('0x56')](_0x48ae4f);}})[_0xe3ae('0x1c')](function(_0x3d58c7){if(_0x3d58c7){return _0x3d58c7?{'count':_0x3c81be,'rows':_0x3d58c7}:null;}})[_0xe3ae('0x1c')](respondWithResult(_0x1882e5,null))[_0xe3ae('0x26')](handleError(_0x1882e5,null));};exports['addConfiguration']=function(_0x3e93ab,_0xc30cb6,_0x35fc4d){if(_0x3e93ab[_0xe3ae('0x53')]['id']){delete _0x3e93ab['body']['id'];}return db[_0xe3ae('0x37')]['findOne']({'where':{'id':_0x3e93ab['params']['id']}})['then'](handleEntityNotFound(_0xc30cb6,null))['then'](function(_0xfc76b3){if(_0xfc76b3){_0x3e93ab[_0xe3ae('0x53')][_0xe3ae('0x59')]=_0xfc76b3['id'];_0x3e93ab[_0xe3ae('0x53')][_0xe3ae('0x5a')]=integrations[_0xe3ae('0x5b')](_0x3e93ab['body']['channel'],_0x3e93ab[_0xe3ae('0x53')][_0xe3ae('0x3a')]);_0x3e93ab['body'][_0xe3ae('0x5c')]=integrations[_0xe3ae('0x5d')](_0x3e93ab[_0xe3ae('0x53')][_0xe3ae('0x5e')],_0x3e93ab[_0xe3ae('0x53')][_0xe3ae('0x3a')]);return db[_0xe3ae('0x58')][_0xe3ae('0x52')](_0x3e93ab[_0xe3ae('0x53')],{'include':[{'model':db[_0xe3ae('0x5f')],'as':_0xe3ae('0x5a')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0xe3ae('0x1c')](respondWithResult(_0xc30cb6,null))[_0xe3ae('0x26')](handleError(_0xc30cb6,null));};exports[_0xe3ae('0x60')]=function(_0x3138d4,_0x26a598,_0x6ea43){var _0x3340cf='';return db['ZendeskAccount'][_0xe3ae('0x57')]({'where':{'id':_0x3138d4[_0xe3ae('0x55')]['id']},'attributes':['id',_0xe3ae('0x61'),_0xe3ae('0x62'),'token',_0xe3ae('0x63'),_0xe3ae('0x64')]})[_0xe3ae('0x1c')](handleEntityNotFound(_0x26a598,null))[_0xe3ae('0x1c')](function(_0x298829){if(_0x298829){_0x3340cf=_0x298829['remoteUri'];var _0x2e24fd=_0x3340cf[_0xe3ae('0x65')](-0x1);if(_0x2e24fd==='/'){_0x3340cf=_0x3340cf[_0xe3ae('0x66')](0x0,_0x3340cf[_0xe3ae('0x67')](_0x2e24fd));}var _0x37fea1={'method':_0xe3ae('0x68'),'uri':util['format'](_0xe3ae('0x69'),_0x3340cf,'ticket_fields'),'json':!![]};switch(_0x298829[_0xe3ae('0x63')]){case _0xe3ae('0x62'):_0x37fea1[_0xe3ae('0x6a')]={'Authorization':util[_0xe3ae('0x6b')]('Basic\x20%s',new Buffer(util[_0xe3ae('0x6b')](_0xe3ae('0x6c'),_0x298829[_0xe3ae('0x61')],_0x298829[_0xe3ae('0x62')]))['toString'](_0xe3ae('0x6d')))};break;case _0xe3ae('0x6e'):_0x37fea1[_0xe3ae('0x6a')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xe3ae('0x6b')](_0xe3ae('0x6f'),_0x298829[_0xe3ae('0x61')],_0x298829[_0xe3ae('0x6e')]))['toString'](_0xe3ae('0x6d')))};break;default:throw new db[(_0xe3ae('0x18'))][(_0xe3ae('0x19'))](_0xe3ae('0x70'));}return rp(_0x37fea1);}})[_0xe3ae('0x1c')](function(_0x2e50d1){if(_0x2e50d1){var _0x4d2189=[_0xe3ae('0x71'),_0xe3ae('0x72'),_0xe3ae('0x73'),_0xe3ae('0x74')];_[_0xe3ae('0x75')](_0x2e50d1[_0xe3ae('0x76')],function(_0x3edce9){return _0x4d2189[_0xe3ae('0x77')](_0x3edce9[_0xe3ae('0x3a')]);});return{'count':_0x2e50d1['ticket_fields'][_0xe3ae('0x51')],'rows':_[_0xe3ae('0x36')](_0x2e50d1[_0xe3ae('0x76')],function(_0xeb484e){return{'id':_0xeb484e['id'],'name':_0xeb484e[_0xe3ae('0x78')]>0x7?_0xeb484e[_0xe3ae('0x79')]:_0xeb484e[_0xe3ae('0x3a')],'custom':_0xeb484e[_0xe3ae('0x78')]>0x7?!![]:![],'options':_0xeb484e[_0xe3ae('0x7a')]?_0xeb484e[_0xe3ae('0x7a')]:_0xeb484e[_0xe3ae('0x7b')]?_0xeb484e['custom_field_options']:[]};})};}})[_0xe3ae('0x1c')](respondWithResult(_0x26a598,null))[_0xe3ae('0x26')](function(_0xd4ec74){var _0x37ed1e=_0x3138d4['query'][_0xe3ae('0x7c')]?0x1f4:_0xd4ec74['statusCode']||0x1f4;logger['error'](_0xe3ae('0x7d'),'getFields',_0x37ed1e,JSON[_0xe3ae('0x21')](_0xd4ec74));delete _0xd4ec74[_0xe3ae('0x33')];if(_0x37ed1e===0x191){_0x37ed1e=0x190;}_0x26a598['status'](_0x37ed1e)[_0xe3ae('0x34')](_0x3138d4[_0xe3ae('0x3c')]['test']?{'message':_0xe3ae('0x7e'),'statusCode':_0xd4ec74[_0xe3ae('0x7f')]}:_0xd4ec74);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 36606a1..8bde922 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 _0x6c5c=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c5c,0x1d8));var _0xc6c5=function(_0x40586c,_0x31b5fd){_0x40586c=_0x40586c-0x0;var _0x10415a=_0x6c5c[_0x40586c];return _0x10415a;};'use strict';var _=require('lodash');var util=require(_0xc6c5('0x0'));var logger=require(_0xc6c5('0x1'))(_0xc6c5('0x2'));var moment=require(_0xc6c5('0x3'));var BPromise=require(_0xc6c5('0x4'));var rp=require(_0xc6c5('0x5'));var fs=require('fs');var path=require(_0xc6c5('0x6'));var rimraf=require(_0xc6c5('0x7'));var config=require(_0xc6c5('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xc6c5('0x9'));module[_0xc6c5('0xa')]=function(_0x2de55c,_0x11f71a){return _0x2de55c[_0xc6c5('0xb')](_0xc6c5('0xc'),attributes,{'tableName':_0xc6c5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d59=['../../config/environment','exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x330141,_0x1dd290){var _0x1b68a2=function(_0x4e7f3c){while(--_0x4e7f3c){_0x330141['push'](_0x330141['shift']());}};_0x1b68a2(++_0x1dd290);}(_0x2d59,0x94));var _0x92d5=function(_0x394437,_0x390b4d){_0x394437=_0x394437-0x0;var _0x595440=_0x2d59[_0x394437];return _0x595440;};'use strict';var _=require('lodash');var util=require(_0x92d5('0x0'));var logger=require(_0x92d5('0x1'))('api');var moment=require('moment');var BPromise=require(_0x92d5('0x2'));var rp=require(_0x92d5('0x3'));var fs=require('fs');var path=require(_0x92d5('0x4'));var rimraf=require(_0x92d5('0x5'));var config=require(_0x92d5('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x92d5('0x7')]=function(_0x235e19,_0x147629){return _0x235e19[_0x92d5('0x8')](_0x92d5('0x9'),attributes,{'tableName':_0x92d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 365a6c5..a879497 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0xdafaa7,_0x408dda){var _0x57ed2f=function(_0x5e0e8e){while(--_0x5e0e8e){_0xdafaa7['push'](_0xdafaa7['shift']());}};_0x57ed2f(++_0x408dda);}(_0x757a,0xde));var _0xa757=function(_0x38de2d,_0x1122da){_0x38de2d=_0x38de2d-0x0;var _0x2e54f8=_0x757a[_0x38de2d];return _0x2e54f8;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x166563,_0x1412a2){var _0x48572f=function(_0x755282){while(--_0x755282){_0x166563['push'](_0x166563['shift']());}};_0x48572f(++_0x1412a2);}(_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')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\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')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index e14632f..644a066 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 _0xf8ff=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','delete','destroy'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf8ff,0x1a1));var _0xff8f=function(_0x5c18ef,_0xa2e81d){_0x5c18ef=_0x5c18ef-0x0;var _0x33789d=_0xf8ff[_0x5c18ef];return _0x33789d;};'use strict';var multer=require(_0xff8f('0x0'));var util=require(_0xff8f('0x1'));var path=require(_0xff8f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff8f('0x3')]();var auth=require(_0xff8f('0x4'));var interaction=require(_0xff8f('0x5'));var config=require(_0xff8f('0x6'));var controller=require(_0xff8f('0x7'));router[_0xff8f('0x8')]('/',auth[_0xff8f('0x9')](),controller[_0xff8f('0xa')]);router[_0xff8f('0x8')](_0xff8f('0xb'),auth['isAuthenticated'](),controller[_0xff8f('0xc')]);router[_0xff8f('0x8')](_0xff8f('0xd'),auth[_0xff8f('0x9')](),controller[_0xff8f('0xe')]);router[_0xff8f('0x8')]('/:id/subjects',auth[_0xff8f('0x9')](),controller[_0xff8f('0xf')]);router['get'](_0xff8f('0x10'),auth[_0xff8f('0x9')](),controller[_0xff8f('0x11')]);router[_0xff8f('0x8')](_0xff8f('0x12'),auth['isAuthenticated'](),controller[_0xff8f('0x13')]);router[_0xff8f('0x14')]('/',auth[_0xff8f('0x9')](),controller['create']);router[_0xff8f('0x14')]('/:id/tags',auth[_0xff8f('0x9')](),controller[_0xff8f('0x15')]);router[_0xff8f('0x16')]('/:id',auth[_0xff8f('0x9')](),controller['update']);router[_0xff8f('0x17')](_0xff8f('0xb'),auth[_0xff8f('0x9')](),controller[_0xff8f('0x18')]);module[_0xff8f('0x19')]=router; \ No newline at end of file +var _0x866b=['isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x13d5a3,_0x4fe4ec){var _0xf5e40d=function(_0x240fe2){while(--_0x240fe2){_0x13d5a3['push'](_0x13d5a3['shift']());}};_0xf5e40d(++_0x4fe4ec);}(_0x866b,0x17f));var _0xb866=function(_0x55d829,_0x43f06c){_0x55d829=_0x55d829-0x0;var _0x52163b=_0x866b[_0x55d829];return _0x52163b;};'use strict';var multer=require(_0xb866('0x0'));var util=require(_0xb866('0x1'));var path=require('path');var timeout=require(_0xb866('0x2'));var express=require('express');var router=express[_0xb866('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb866('0x4'));var config=require(_0xb866('0x5'));var controller=require(_0xb866('0x6'));router[_0xb866('0x7')]('/',auth[_0xb866('0x8')](),controller['index']);router[_0xb866('0x7')](_0xb866('0x9'),auth[_0xb866('0x8')](),controller['show']);router['get'](_0xb866('0xa'),auth[_0xb866('0x8')](),controller[_0xb866('0xb')]);router[_0xb866('0x7')](_0xb866('0xc'),auth[_0xb866('0x8')](),controller['getSubjects']);router[_0xb866('0x7')]('/:id/descriptions',auth[_0xb866('0x8')](),controller[_0xb866('0xd')]);router['get'](_0xb866('0xe'),auth[_0xb866('0x8')](),controller[_0xb866('0xf')]);router[_0xb866('0x10')]('/',auth[_0xb866('0x8')](),controller[_0xb866('0x11')]);router[_0xb866('0x10')]('/:id/tags',auth[_0xb866('0x8')](),controller[_0xb866('0x12')]);router[_0xb866('0x13')](_0xb866('0x9'),auth[_0xb866('0x8')](),controller[_0xb866('0x14')]);router[_0xb866('0x15')](_0xb866('0x9'),auth['isAuthenticated'](),controller[_0xb866('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 5e2bdcb..9684d34 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 _0x053d=['STRING','sequelize'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x053d,0x1d3));var _0xd053=function(_0x365f5c,_0x403d36){_0x365f5c=_0x365f5c-0x0;var _0x255a91=_0x053d[_0x365f5c];return _0x255a91;};'use strict';var Sequelize=require(_0xd053('0x0'));module['exports']={'name':{'type':Sequelize[_0xd053('0x1')]},'description':{'type':Sequelize[_0xd053('0x1')]}}; \ No newline at end of file +var _0x27ae=['STRING'];(function(_0x2c0399,_0x15c979){var _0x8af475=function(_0x49cac8){while(--_0x49cac8){_0x2c0399['push'](_0x2c0399['shift']());}};_0x8af475(++_0x15c979);}(_0x27ae,0x16f));var _0xe27a=function(_0x51fc7c,_0x475586){_0x51fc7c=_0x51fc7c-0x0;var _0x1482a7=_0x27ae[_0x51fc7c];return _0x1482a7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe27a('0x0')]},'description':{'type':Sequelize[_0xe27a('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 904f586..8b7fcaf 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 _0x0109=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','end','status','count','offset','limit','set','json','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','ZendeskConfiguration','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','rawAttributes','keys','length','include','options','find','create','update','body','params','findOne','ZendeskField','getFields','getSubjects','order','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0109,0x1e3));var _0x9010=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0109[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x9010('0x0'));var emlformat=require(_0x9010('0x1'));var rimraf=require(_0x9010('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9010('0x3'));var rp=require(_0x9010('0x4'));var moment=require(_0x9010('0x5'));var BPromise=require(_0x9010('0x6'));var Mustache=require(_0x9010('0x7'));var util=require(_0x9010('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x9010('0x9'));var ejs=require(_0x9010('0xa'));var fs=require('fs');var _=require(_0x9010('0xb'));var squel=require(_0x9010('0xc'));var crypto=require(_0x9010('0xd'));var jsforce=require(_0x9010('0xe'));var deskjs=require(_0x9010('0xf'));var toCsv=require(_0x9010('0x9'));var querystring=require('querystring');var Papa=require(_0x9010('0x10'));var Redis=require(_0x9010('0x11'));var authService=require(_0x9010('0x12'));var qs=require(_0x9010('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9010('0x14'));var config=require(_0x9010('0x15'));var db=require(_0x9010('0x16'))['db'];var jayson=require(_0x9010('0x17'));var client=jayson[_0x9010('0x18')][_0x9010('0x19')]({'port':0x232a});function checkPasswordPattern(_0xdba540,_0x3011ad,_0x4d206c){if(_0x4d206c){var _0x529cdf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x529cdf[_0x9010('0x1a')](_0x3011ad)){return _0xdba540;}else{throw new db[(_0x9010('0x1b'))][(_0x9010('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xdba540;}}function respondWithRpcPromise(_0x1a0ea8,_0x12d3ad,_0x195e5f,_0x493325){return new BPromise(function(_0x3ccce5,_0x55f30f){var _0x44c966=_0x493325||client;return _0x44c966['request'](_0x1a0ea8,_0x195e5f)['then'](function(_0x4af92f){logger[_0x9010('0x1d')](_0x9010('0x1e'),_0x12d3ad,_0x9010('0x1f'));logger[_0x9010('0x20')](_0x9010('0x21'),_0x12d3ad,_0x9010('0x1f'),JSON[_0x9010('0x22')](_0x4af92f));if(_0x4af92f['error']){if(_0x4af92f['error'][_0x9010('0x23')]===0x1f4){logger[_0x9010('0x24')]('ZendeskConfiguration,\x20%s,\x20%s',_0x12d3ad,_0x4af92f[_0x9010('0x24')][_0x9010('0x25')]);return _0x55f30f(_0x4af92f[_0x9010('0x24')][_0x9010('0x25')]);}logger[_0x9010('0x24')](_0x9010('0x1e'),_0x12d3ad,_0x4af92f[_0x9010('0x24')]['message']);return _0x3ccce5(_0x4af92f['error'][_0x9010('0x25')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x12d3ad,_0x9010('0x1f'));_0x3ccce5(_0x4af92f[_0x9010('0x26')][_0x9010('0x25')]);}})[_0x9010('0x27')](function(_0x24fadc){logger[_0x9010('0x24')](_0x9010('0x1e'),_0x12d3ad,_0x24fadc);_0x55f30f(_0x24fadc);});});}function respondWithStatusCode(_0x53ec8e,_0x5e9c79){_0x5e9c79=_0x5e9c79||0xcc;return function(_0x2408ba){if(_0x2408ba){return _0x53ec8e['sendStatus'](_0x5e9c79);}return _0x53ec8e['status'](_0x5e9c79)[_0x9010('0x28')]();};}function respondWithResult(_0x4fcff0,_0x49add2){_0x49add2=_0x49add2||0xc8;return function(_0x2d232f){if(_0x2d232f){return _0x4fcff0[_0x9010('0x29')](_0x49add2)['json'](_0x2d232f);}};}function respondWithFilteredResult(_0x575b56,_0x2b1fc1){return function(_0x32a826){if(_0x32a826){var _0x2f566b=_0x32a826[_0x9010('0x2a')],_0x4becac=_0x2b1fc1['offset'],_0x9b38e0=_0x2b1fc1[_0x9010('0x2b')]+_0x2b1fc1[_0x9010('0x2c')],_0x5b518c;if(_0x9b38e0>=_0x2f566b){_0x9b38e0=_0x2f566b;_0x5b518c=0xc8;}else{_0x5b518c=0xce;}_0x575b56[_0x9010('0x29')](_0x5b518c);return _0x575b56[_0x9010('0x2d')]('Content-Range',_0x4becac+'-'+_0x9b38e0+'/'+_0x2f566b)[_0x9010('0x2e')](_0x32a826);}return null;};}function patchUpdates(_0x348781){return function(_0x578629){try{jsonpatch[_0x9010('0x2f')](_0x578629,_0x348781,!![]);}catch(_0xec7f31){return BPromise[_0x9010('0x30')](_0xec7f31);}return _0x578629[_0x9010('0x31')]();};}function saveUpdates(_0x5a7691,_0x3f9e70){return function(_0xca2fc7){if(_0xca2fc7){return _0xca2fc7['update'](_0x5a7691)[_0x9010('0x32')](function(_0x4f1433){return _0x4f1433;});}return null;};}function removeEntity(_0x5401dd,_0x48c43b){return function(_0x5b49de){if(_0x5b49de){return _0x5b49de[_0x9010('0x33')]()[_0x9010('0x32')](function(){_0x5401dd['status'](0xcc)[_0x9010('0x28')]();});}};}function handleEntityNotFound(_0xc1c97f,_0x12630c){return function(_0x4cea27){if(!_0x4cea27){_0xc1c97f[_0x9010('0x34')](0x194);}return _0x4cea27;};}function handleError(_0x2ed7a6,_0x49174a){_0x49174a=_0x49174a||0x1f4;return function(_0x38193f){logger['error'](_0x38193f[_0x9010('0x35')]);if(_0x38193f[_0x9010('0x36')]){delete _0x38193f[_0x9010('0x36')];}_0x2ed7a6[_0x9010('0x29')](_0x49174a)[_0x9010('0x37')](_0x38193f);};}exports[_0x9010('0x38')]=function(_0x16c248,_0x16a8bb){var _0xc08ac={},_0x15bac6={},_0x1372d8={'count':0x0,'rows':[]};var _0x52a60b=_['map'](db[_0x9010('0x39')]['rawAttributes'],function(_0x3ee6d8){return{'name':_0x3ee6d8[_0x9010('0x3a')],'type':_0x3ee6d8[_0x9010('0x3b')][_0x9010('0x3c')]};});_0x15bac6[_0x9010('0x3d')]=_[_0x9010('0x3e')](_0x52a60b,_0x9010('0x36'));_0x15bac6[_0x9010('0x3f')]=_['keys'](_0x16c248['query']);_0x15bac6[_0x9010('0x40')]=_[_0x9010('0x41')](_0x15bac6[_0x9010('0x3d')],_0x15bac6['query']);_0xc08ac[_0x9010('0x42')]=_[_0x9010('0x41')](_0x15bac6['model'],qs['fields'](_0x16c248[_0x9010('0x3f')][_0x9010('0x43')]));_0xc08ac[_0x9010('0x42')]=_0xc08ac[_0x9010('0x42')]['length']?_0xc08ac['attributes']:_0x15bac6[_0x9010('0x3d')];if(!_0x16c248['query'][_0x9010('0x44')](_0x9010('0x45'))){_0xc08ac[_0x9010('0x2c')]=qs[_0x9010('0x2c')](_0x16c248['query'][_0x9010('0x2c')]);_0xc08ac['offset']=qs[_0x9010('0x2b')](_0x16c248[_0x9010('0x3f')][_0x9010('0x2b')]);}_0xc08ac['order']=qs['sort'](_0x16c248[_0x9010('0x3f')][_0x9010('0x46')]);_0xc08ac[_0x9010('0x47')]=qs[_0x9010('0x40')](_[_0x9010('0x48')](_0x16c248[_0x9010('0x3f')],_0x15bac6[_0x9010('0x40')]),_0x52a60b);if(_0x16c248[_0x9010('0x3f')][_0x9010('0x49')]){_0xc08ac[_0x9010('0x47')]=_[_0x9010('0x4a')](_0xc08ac[_0x9010('0x47')],{'$or':_[_0x9010('0x3e')](_0x52a60b,function(_0x4cf67e){if(_0x4cf67e[_0x9010('0x3b')]!==_0x9010('0x4b')){var _0x18875f={};_0x18875f[_0x4cf67e[_0x9010('0x36')]]={'$like':'%'+_0x16c248[_0x9010('0x3f')][_0x9010('0x49')]+'%'};return _0x18875f;}})});}_0xc08ac=_[_0x9010('0x4a')]({},_0xc08ac,_0x16c248['options']);var _0x2f9b0b={'where':_0xc08ac['where']};return db[_0x9010('0x39')][_0x9010('0x2a')](_0x2f9b0b)[_0x9010('0x32')](function(_0x1634ea){_0x1372d8[_0x9010('0x2a')]=_0x1634ea;if(_0x16c248[_0x9010('0x3f')][_0x9010('0x4c')]){_0xc08ac['include']=[{'all':!![]}];}return db[_0x9010('0x39')][_0x9010('0x4d')](_0xc08ac);})[_0x9010('0x32')](function(_0x27086f){_0x1372d8[_0x9010('0x4e')]=_0x27086f;return _0x1372d8;})['then'](respondWithFilteredResult(_0x16a8bb,_0xc08ac))[_0x9010('0x27')](handleError(_0x16a8bb,null));};exports[_0x9010('0x4f')]=function(_0x2613d4,_0x48ca70){var _0x492977={'raw':![],'where':{'id':_0x2613d4['params']['id']}},_0xedd2c8={};_0xedd2c8[_0x9010('0x3d')]=_['keys'](db['ZendeskConfiguration'][_0x9010('0x50')]);_0xedd2c8['query']=_[_0x9010('0x51')](_0x2613d4['query']);_0xedd2c8['filters']=_[_0x9010('0x41')](_0xedd2c8['model'],_0xedd2c8[_0x9010('0x3f')]);_0x492977[_0x9010('0x42')]=_['intersection'](_0xedd2c8['model'],qs['fields'](_0x2613d4['query'][_0x9010('0x43')]));_0x492977[_0x9010('0x42')]=_0x492977[_0x9010('0x42')][_0x9010('0x52')]?_0x492977[_0x9010('0x42')]:_0xedd2c8[_0x9010('0x3d')];if(_0x2613d4['query'][_0x9010('0x4c')]){_0x492977[_0x9010('0x53')]=[{'all':!![]}];}_0x492977=_[_0x9010('0x4a')]({},_0x492977,_0x2613d4[_0x9010('0x54')]);return db[_0x9010('0x39')][_0x9010('0x55')](_0x492977)[_0x9010('0x32')](handleEntityNotFound(_0x48ca70,null))[_0x9010('0x32')](respondWithResult(_0x48ca70,null))[_0x9010('0x27')](handleError(_0x48ca70,null));};exports[_0x9010('0x56')]=function(_0x2e0c4f,_0x42904c){return db['ZendeskConfiguration'][_0x9010('0x56')](_0x2e0c4f['body'],{})['then'](respondWithResult(_0x42904c,0xc9))[_0x9010('0x27')](handleError(_0x42904c,null));};exports[_0x9010('0x57')]=function(_0xc7adde,_0x12cffd){if(_0xc7adde[_0x9010('0x58')]['id']){delete _0xc7adde[_0x9010('0x58')]['id'];}return db[_0x9010('0x39')][_0x9010('0x55')]({'where':{'id':_0xc7adde[_0x9010('0x59')]['id']}})[_0x9010('0x32')](handleEntityNotFound(_0x12cffd,null))[_0x9010('0x32')](saveUpdates(_0xc7adde[_0x9010('0x58')],null))['then'](respondWithResult(_0x12cffd,null))[_0x9010('0x27')](handleError(_0x12cffd,null));};exports['destroy']=function(_0x455ef0,_0x2dcace){return db[_0x9010('0x39')]['find']({'where':{'id':_0x455ef0['params']['id']}})['then'](handleEntityNotFound(_0x2dcace,null))[_0x9010('0x32')](removeEntity(_0x2dcace,null))['catch'](handleError(_0x2dcace,null));};exports['getFields']=function(_0x37a894,_0x1a0d58,_0x304de7){var _0x1e1575={};var _0x24934b={};var _0x10d977;var _0x58a0f3;return db[_0x9010('0x39')][_0x9010('0x5a')]({'where':{'id':_0x37a894[_0x9010('0x59')]['id']}})[_0x9010('0x32')](handleEntityNotFound(_0x1a0d58,null))[_0x9010('0x32')](function(_0x274740){if(_0x274740){_0x10d977=_0x274740;_0x24934b['model']=_[_0x9010('0x51')](db[_0x9010('0x5b')][_0x9010('0x50')]);_0x24934b['query']=_[_0x9010('0x51')](_0x37a894['query']);_0x24934b[_0x9010('0x40')]=_[_0x9010('0x41')](_0x24934b['model'],_0x24934b[_0x9010('0x3f')]);_0x1e1575['attributes']=_[_0x9010('0x41')](_0x24934b[_0x9010('0x3d')],qs[_0x9010('0x43')](_0x37a894[_0x9010('0x3f')][_0x9010('0x43')]));_0x1e1575[_0x9010('0x42')]=_0x1e1575[_0x9010('0x42')][_0x9010('0x52')]?_0x1e1575['attributes']:_0x24934b[_0x9010('0x3d')];_0x1e1575['order']=qs['sort'](_0x37a894['query'][_0x9010('0x46')]);_0x1e1575[_0x9010('0x47')]=qs[_0x9010('0x40')](_[_0x9010('0x48')](_0x37a894[_0x9010('0x3f')],_0x24934b[_0x9010('0x40')]));if(_0x37a894['query'][_0x9010('0x49')]){_0x1e1575[_0x9010('0x47')]=_[_0x9010('0x4a')](_0x1e1575[_0x9010('0x47')],{'$or':_[_0x9010('0x3e')](_0x1e1575[_0x9010('0x42')],function(_0x4e9ab7){var _0xe42433={};_0xe42433[_0x4e9ab7]={'$like':'%'+_0x37a894[_0x9010('0x3f')][_0x9010('0x49')]+'%'};return _0xe42433;})});}_0x1e1575=_[_0x9010('0x4a')]({},_0x1e1575,_0x37a894[_0x9010('0x54')]);return _0x10d977[_0x9010('0x5c')](_0x1e1575);}})['then'](function(_0x352ead){if(_0x352ead){_0x58a0f3=_0x352ead[_0x9010('0x52')];if(!_0x37a894[_0x9010('0x3f')][_0x9010('0x44')]('nolimit')){_0x1e1575[_0x9010('0x2c')]=qs[_0x9010('0x2c')](_0x37a894[_0x9010('0x3f')][_0x9010('0x2c')]);_0x1e1575[_0x9010('0x2b')]=qs[_0x9010('0x2b')](_0x37a894[_0x9010('0x3f')][_0x9010('0x2b')]);}return _0x10d977[_0x9010('0x5c')](_0x1e1575);}})['then'](function(_0x2c3e4b){if(_0x2c3e4b){return _0x2c3e4b?{'count':_0x58a0f3,'rows':_0x2c3e4b}:null;}})['then'](respondWithResult(_0x1a0d58,null))[_0x9010('0x27')](handleError(_0x1a0d58,null));};exports[_0x9010('0x5d')]=function(_0x1742fb,_0x65fe85,_0x2fc97d){var _0x1c2d56={};var _0x4a1675={};var _0x2a5211;var _0xe137d2;return db['ZendeskConfiguration'][_0x9010('0x5a')]({'where':{'id':_0x1742fb['params']['id']}})['then'](handleEntityNotFound(_0x65fe85,null))['then'](function(_0x44da86){if(_0x44da86){_0x2a5211=_0x44da86;_0x4a1675[_0x9010('0x3d')]=_[_0x9010('0x51')](db['ZendeskField'][_0x9010('0x50')]);_0x4a1675[_0x9010('0x3f')]=_['keys'](_0x1742fb[_0x9010('0x3f')]);_0x4a1675['filters']=_[_0x9010('0x41')](_0x4a1675[_0x9010('0x3d')],_0x4a1675[_0x9010('0x3f')]);_0x1c2d56[_0x9010('0x42')]=_[_0x9010('0x41')](_0x4a1675['model'],qs[_0x9010('0x43')](_0x1742fb[_0x9010('0x3f')][_0x9010('0x43')]));_0x1c2d56[_0x9010('0x42')]=_0x1c2d56[_0x9010('0x42')]['length']?_0x1c2d56['attributes']:_0x4a1675[_0x9010('0x3d')];_0x1c2d56[_0x9010('0x5e')]=qs[_0x9010('0x46')](_0x1742fb[_0x9010('0x3f')]['sort']);_0x1c2d56['where']=qs[_0x9010('0x40')](_[_0x9010('0x48')](_0x1742fb[_0x9010('0x3f')],_0x4a1675[_0x9010('0x40')]));if(_0x1742fb[_0x9010('0x3f')]['filter']){_0x1c2d56['where']=_[_0x9010('0x4a')](_0x1c2d56[_0x9010('0x47')],{'$or':_[_0x9010('0x3e')](_0x1c2d56[_0x9010('0x42')],function(_0x4e4896){var _0x2a9365={};_0x2a9365[_0x4e4896]={'$like':'%'+_0x1742fb[_0x9010('0x3f')][_0x9010('0x49')]+'%'};return _0x2a9365;})});}_0x1c2d56=_[_0x9010('0x4a')]({},_0x1c2d56,_0x1742fb[_0x9010('0x54')]);return _0x2a5211[_0x9010('0x5d')](_0x1c2d56);}})[_0x9010('0x32')](function(_0x25afbf){if(_0x25afbf){_0xe137d2=_0x25afbf[_0x9010('0x52')];if(!_0x1742fb['query'][_0x9010('0x44')]('nolimit')){_0x1c2d56[_0x9010('0x2c')]=qs[_0x9010('0x2c')](_0x1742fb[_0x9010('0x3f')]['limit']);_0x1c2d56[_0x9010('0x2b')]=qs['offset'](_0x1742fb[_0x9010('0x3f')]['offset']);}return _0x2a5211[_0x9010('0x5d')](_0x1c2d56);}})[_0x9010('0x32')](function(_0x149c58){if(_0x149c58){return _0x149c58?{'count':_0xe137d2,'rows':_0x149c58}:null;}})[_0x9010('0x32')](respondWithResult(_0x65fe85,null))[_0x9010('0x27')](handleError(_0x65fe85,null));};exports['getDescriptions']=function(_0x2c7ee1,_0x4502ca,_0x2fe84e){var _0x4c8daf={};var _0x50dc40={};var _0x10c362;var _0x746879;return db[_0x9010('0x39')][_0x9010('0x5a')]({'where':{'id':_0x2c7ee1['params']['id']}})[_0x9010('0x32')](handleEntityNotFound(_0x4502ca,null))[_0x9010('0x32')](function(_0x176887){if(_0x176887){_0x10c362=_0x176887;_0x50dc40[_0x9010('0x3d')]=_[_0x9010('0x51')](db[_0x9010('0x5b')][_0x9010('0x50')]);_0x50dc40[_0x9010('0x3f')]=_[_0x9010('0x51')](_0x2c7ee1[_0x9010('0x3f')]);_0x50dc40['filters']=_[_0x9010('0x41')](_0x50dc40['model'],_0x50dc40[_0x9010('0x3f')]);_0x4c8daf[_0x9010('0x42')]=_['intersection'](_0x50dc40['model'],qs[_0x9010('0x43')](_0x2c7ee1[_0x9010('0x3f')][_0x9010('0x43')]));_0x4c8daf[_0x9010('0x42')]=_0x4c8daf[_0x9010('0x42')][_0x9010('0x52')]?_0x4c8daf['attributes']:_0x50dc40[_0x9010('0x3d')];_0x4c8daf[_0x9010('0x5e')]=qs[_0x9010('0x46')](_0x2c7ee1[_0x9010('0x3f')][_0x9010('0x46')]);_0x4c8daf[_0x9010('0x47')]=qs[_0x9010('0x40')](_[_0x9010('0x48')](_0x2c7ee1[_0x9010('0x3f')],_0x50dc40['filters']));if(_0x2c7ee1['query'][_0x9010('0x49')]){_0x4c8daf[_0x9010('0x47')]=_[_0x9010('0x4a')](_0x4c8daf[_0x9010('0x47')],{'$or':_[_0x9010('0x3e')](_0x4c8daf[_0x9010('0x42')],function(_0x52ce8d){var _0x2778e4={};_0x2778e4[_0x52ce8d]={'$like':'%'+_0x2c7ee1[_0x9010('0x3f')][_0x9010('0x49')]+'%'};return _0x2778e4;})});}_0x4c8daf=_[_0x9010('0x4a')]({},_0x4c8daf,_0x2c7ee1[_0x9010('0x54')]);return _0x10c362[_0x9010('0x5f')](_0x4c8daf);}})[_0x9010('0x32')](function(_0x46ece3){if(_0x46ece3){_0x746879=_0x46ece3[_0x9010('0x52')];if(!_0x2c7ee1[_0x9010('0x3f')][_0x9010('0x44')](_0x9010('0x45'))){_0x4c8daf['limit']=qs[_0x9010('0x2c')](_0x2c7ee1[_0x9010('0x3f')][_0x9010('0x2c')]);_0x4c8daf[_0x9010('0x2b')]=qs[_0x9010('0x2b')](_0x2c7ee1['query'][_0x9010('0x2b')]);}return _0x10c362[_0x9010('0x5f')](_0x4c8daf);}})[_0x9010('0x32')](function(_0x42015f){if(_0x42015f){return _0x42015f?{'count':_0x746879,'rows':_0x42015f}:null;}})[_0x9010('0x32')](respondWithResult(_0x4502ca,null))[_0x9010('0x27')](handleError(_0x4502ca,null));};exports[_0x9010('0x60')]=function(_0x38e765,_0x10b7a5,_0x21fd51){var _0x59bd76={};var _0x400812={};var _0x32f4a9;var _0x3cb4aa;return db[_0x9010('0x39')][_0x9010('0x5a')]({'where':{'id':_0x38e765['params']['id']}})['then'](handleEntityNotFound(_0x10b7a5,null))[_0x9010('0x32')](function(_0x5c1f7f){if(_0x5c1f7f){_0x32f4a9=_0x5c1f7f;_0x400812[_0x9010('0x3d')]=_[_0x9010('0x51')](db[_0x9010('0x61')][_0x9010('0x50')]);_0x400812[_0x9010('0x3f')]=_['keys'](_0x38e765[_0x9010('0x3f')]);_0x400812['filters']=_[_0x9010('0x41')](_0x400812[_0x9010('0x3d')],_0x400812[_0x9010('0x3f')]);_0x59bd76[_0x9010('0x42')]=_['intersection'](_0x400812[_0x9010('0x3d')],qs[_0x9010('0x43')](_0x38e765[_0x9010('0x3f')][_0x9010('0x43')]));_0x59bd76[_0x9010('0x42')]=_0x59bd76[_0x9010('0x42')][_0x9010('0x52')]?_0x59bd76[_0x9010('0x42')]:_0x400812['model'];_0x59bd76[_0x9010('0x5e')]=qs[_0x9010('0x46')](_0x38e765[_0x9010('0x3f')]['sort']);_0x59bd76[_0x9010('0x47')]=qs['filters'](_[_0x9010('0x48')](_0x38e765[_0x9010('0x3f')],_0x400812[_0x9010('0x40')]));if(_0x38e765[_0x9010('0x3f')][_0x9010('0x49')]){_0x59bd76[_0x9010('0x47')]=_[_0x9010('0x4a')](_0x59bd76[_0x9010('0x47')],{'$or':_[_0x9010('0x3e')](_0x59bd76[_0x9010('0x42')],function(_0x5387f6){var _0x7c0e42={};_0x7c0e42[_0x5387f6]={'$like':'%'+_0x38e765[_0x9010('0x3f')][_0x9010('0x49')]+'%'};return _0x7c0e42;})});}_0x59bd76=_[_0x9010('0x4a')]({},_0x59bd76,_0x38e765['options']);return _0x32f4a9[_0x9010('0x60')](_0x59bd76);}})['then'](function(_0x59f677){if(_0x59f677){_0x3cb4aa=_0x59f677[_0x9010('0x52')];if(!_0x38e765[_0x9010('0x3f')]['hasOwnProperty']('nolimit')){_0x59bd76['limit']=qs[_0x9010('0x2c')](_0x38e765[_0x9010('0x3f')][_0x9010('0x2c')]);_0x59bd76['offset']=qs['offset'](_0x38e765[_0x9010('0x3f')]['offset']);}return _0x32f4a9[_0x9010('0x60')](_0x59bd76);}})['then'](function(_0x4548ad){if(_0x4548ad){return _0x4548ad?{'count':_0x3cb4aa,'rows':_0x4548ad}:null;}})[_0x9010('0x32')](respondWithResult(_0x10b7a5,null))[_0x9010('0x27')](handleError(_0x10b7a5,null));};exports[_0x9010('0x62')]=function(_0x13d62b,_0x191d1c,_0x5b312d){if(_0x13d62b[_0x9010('0x58')]['id']){delete _0x13d62b['body']['id'];}return db['ZendeskConfiguration'][_0x9010('0x5a')]({'where':{'id':_0x13d62b[_0x9010('0x59')]['id']}})['then'](handleEntityNotFound(_0x191d1c,null))[_0x9010('0x32')](function(_0x25236c){if(_0x25236c){return _0x25236c[_0x9010('0x62')](_0x13d62b[_0x9010('0x58')][_0x9010('0x63')]||[]);}return null;})[_0x9010('0x32')](respondWithResult(_0x191d1c,null))[_0x9010('0x27')](handleError(_0x191d1c,null));}; \ No newline at end of file +var _0xf0a9=['apply','save','update','stack','index','map','ZendeskConfiguration','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','name','includeAll','include','then','rows','catch','params','intersection','options','find','create','body','destroy','getFields','ZendeskField','getSubjects','findOne','getDescriptions','rawAttributes','getTags','setTags','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../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','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','set','Content-Range'];(function(_0x45f3bd,_0x387fbe){var _0x5590fb=function(_0x5c07d1){while(--_0x5c07d1){_0x45f3bd['push'](_0x45f3bd['shift']());}};_0x5590fb(++_0x387fbe);}(_0xf0a9,0xf8));var _0x9f0a=function(_0x259f25,_0x5bf811){_0x259f25=_0x259f25-0x0;var _0x1a6f86=_0xf0a9[_0x259f25];return _0x1a6f86;};'use strict';var pdf=require(_0x9f0a('0x0'));var emlformat=require(_0x9f0a('0x1'));var rimraf=require(_0x9f0a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f0a('0x3'));var rp=require(_0x9f0a('0x4'));var moment=require(_0x9f0a('0x5'));var BPromise=require(_0x9f0a('0x6'));var Mustache=require(_0x9f0a('0x7'));var util=require(_0x9f0a('0x8'));var path=require(_0x9f0a('0x9'));var sox=require(_0x9f0a('0xa'));var csv=require('to-csv');var ejs=require(_0x9f0a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9f0a('0xc'));var crypto=require('crypto');var jsforce=require(_0x9f0a('0xd'));var deskjs=require(_0x9f0a('0xe'));var toCsv=require(_0x9f0a('0xf'));var querystring=require(_0x9f0a('0x10'));var Papa=require(_0x9f0a('0x11'));var Redis=require(_0x9f0a('0x12'));var authService=require(_0x9f0a('0x13'));var qs=require(_0x9f0a('0x14'));var as=require(_0x9f0a('0x15'));var hardwareService=require(_0x9f0a('0x16'));var logger=require(_0x9f0a('0x17'))('api');var utils=require(_0x9f0a('0x18'));var config=require('../../config/environment');var db=require(_0x9f0a('0x19'))['db'];var jayson=require(_0x9f0a('0x1a'));var client=jayson[_0x9f0a('0x1b')][_0x9f0a('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x20d2e1,_0x2589f5,_0x4ec796){if(_0x4ec796){var _0x59d5d6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x59d5d6[_0x9f0a('0x1d')](_0x2589f5)){return _0x20d2e1;}else{throw new db[(_0x9f0a('0x1e'))][(_0x9f0a('0x1f'))](_0x9f0a('0x20'));}}else{return _0x20d2e1;}}function respondWithRpcPromise(_0x19c072,_0xfe05c8,_0x259a82,_0x4b8b0b){return new BPromise(function(_0x402d3d,_0x54bcee){var _0x557f1d=_0x4b8b0b||client;return _0x557f1d[_0x9f0a('0x21')](_0x19c072,_0x259a82)['then'](function(_0x410f90){logger['info'](_0x9f0a('0x22'),_0xfe05c8,_0x9f0a('0x23'));logger[_0x9f0a('0x24')](_0x9f0a('0x25'),_0xfe05c8,'request\x20sent',JSON[_0x9f0a('0x26')](_0x410f90));if(_0x410f90[_0x9f0a('0x27')]){if(_0x410f90[_0x9f0a('0x27')][_0x9f0a('0x28')]===0x1f4){logger[_0x9f0a('0x27')]('ZendeskConfiguration,\x20%s,\x20%s',_0xfe05c8,_0x410f90[_0x9f0a('0x27')][_0x9f0a('0x29')]);return _0x54bcee(_0x410f90['error'][_0x9f0a('0x29')]);}logger[_0x9f0a('0x27')](_0x9f0a('0x22'),_0xfe05c8,_0x410f90[_0x9f0a('0x27')][_0x9f0a('0x29')]);return _0x402d3d(_0x410f90[_0x9f0a('0x27')]['message']);}else{logger[_0x9f0a('0x2a')]('ZendeskConfiguration,\x20%s,\x20%s',_0xfe05c8,_0x9f0a('0x23'));_0x402d3d(_0x410f90[_0x9f0a('0x2b')]['message']);}})['catch'](function(_0x486b35){logger[_0x9f0a('0x27')](_0x9f0a('0x22'),_0xfe05c8,_0x486b35);_0x54bcee(_0x486b35);});});}function respondWithStatusCode(_0x5d5c51,_0x284508){_0x284508=_0x284508||0xcc;return function(_0x4481c0){if(_0x4481c0){return _0x5d5c51[_0x9f0a('0x2c')](_0x284508);}return _0x5d5c51[_0x9f0a('0x2d')](_0x284508)[_0x9f0a('0x2e')]();};}function respondWithResult(_0x1b2078,_0x3d1525){_0x3d1525=_0x3d1525||0xc8;return function(_0x1ba2fc){if(_0x1ba2fc){return _0x1b2078[_0x9f0a('0x2d')](_0x3d1525)[_0x9f0a('0x2f')](_0x1ba2fc);}};}function respondWithFilteredResult(_0x4fe0bd,_0x14bfe8){return function(_0x2b94d9){if(_0x2b94d9){var _0x5129bf=_0x2b94d9[_0x9f0a('0x30')],_0xdd9a80=_0x14bfe8[_0x9f0a('0x31')],_0x3f36ba=_0x14bfe8[_0x9f0a('0x31')]+_0x14bfe8['limit'],_0x43520b;if(_0x3f36ba>=_0x5129bf){_0x3f36ba=_0x5129bf;_0x43520b=0xc8;}else{_0x43520b=0xce;}_0x4fe0bd[_0x9f0a('0x2d')](_0x43520b);return _0x4fe0bd[_0x9f0a('0x32')](_0x9f0a('0x33'),_0xdd9a80+'-'+_0x3f36ba+'/'+_0x5129bf)[_0x9f0a('0x2f')](_0x2b94d9);}return null;};}function patchUpdates(_0x1d10cd){return function(_0x38f14f){try{jsonpatch[_0x9f0a('0x34')](_0x38f14f,_0x1d10cd,!![]);}catch(_0x3bfd44){return BPromise['reject'](_0x3bfd44);}return _0x38f14f[_0x9f0a('0x35')]();};}function saveUpdates(_0x7053ce,_0x530d25){return function(_0x46ebed){if(_0x46ebed){return _0x46ebed[_0x9f0a('0x36')](_0x7053ce)['then'](function(_0x44cec4){return _0x44cec4;});}return null;};}function removeEntity(_0x776eb4,_0x499b41){return function(_0x5395c5){if(_0x5395c5){return _0x5395c5['destroy']()['then'](function(){_0x776eb4[_0x9f0a('0x2d')](0xcc)[_0x9f0a('0x2e')]();});}};}function handleEntityNotFound(_0x543255,_0xddbe06){return function(_0x276c7b){if(!_0x276c7b){_0x543255['sendStatus'](0x194);}return _0x276c7b;};}function handleError(_0x511b2f,_0x37318f){_0x37318f=_0x37318f||0x1f4;return function(_0x5bae53){logger[_0x9f0a('0x27')](_0x5bae53[_0x9f0a('0x37')]);if(_0x5bae53['name']){delete _0x5bae53['name'];}_0x511b2f['status'](_0x37318f)['send'](_0x5bae53);};}exports[_0x9f0a('0x38')]=function(_0x2456ce,_0x106b67){var _0x277c57={},_0x12109f={},_0x232963={'count':0x0,'rows':[]};var _0x208a4a=_[_0x9f0a('0x39')](db[_0x9f0a('0x3a')]['rawAttributes'],function(_0x4c92f8){return{'name':_0x4c92f8[_0x9f0a('0x3b')],'type':_0x4c92f8[_0x9f0a('0x3c')][_0x9f0a('0x3d')]};});_0x12109f[_0x9f0a('0x3e')]=_[_0x9f0a('0x39')](_0x208a4a,'name');_0x12109f['query']=_[_0x9f0a('0x3f')](_0x2456ce[_0x9f0a('0x40')]);_0x12109f[_0x9f0a('0x41')]=_['intersection'](_0x12109f['model'],_0x12109f[_0x9f0a('0x40')]);_0x277c57[_0x9f0a('0x42')]=_['intersection'](_0x12109f['model'],qs[_0x9f0a('0x43')](_0x2456ce['query'][_0x9f0a('0x43')]));_0x277c57['attributes']=_0x277c57['attributes'][_0x9f0a('0x44')]?_0x277c57['attributes']:_0x12109f['model'];if(!_0x2456ce['query'][_0x9f0a('0x45')](_0x9f0a('0x46'))){_0x277c57['limit']=qs[_0x9f0a('0x47')](_0x2456ce[_0x9f0a('0x40')][_0x9f0a('0x47')]);_0x277c57[_0x9f0a('0x31')]=qs['offset'](_0x2456ce[_0x9f0a('0x40')][_0x9f0a('0x31')]);}_0x277c57[_0x9f0a('0x48')]=qs[_0x9f0a('0x49')](_0x2456ce[_0x9f0a('0x40')][_0x9f0a('0x49')]);_0x277c57[_0x9f0a('0x4a')]=qs[_0x9f0a('0x41')](_[_0x9f0a('0x4b')](_0x2456ce[_0x9f0a('0x40')],_0x12109f['filters']),_0x208a4a);if(_0x2456ce[_0x9f0a('0x40')][_0x9f0a('0x4c')]){_0x277c57[_0x9f0a('0x4a')]=_[_0x9f0a('0x4d')](_0x277c57['where'],{'$or':_[_0x9f0a('0x39')](_0x208a4a,function(_0x5585b2){if(_0x5585b2['type']!==_0x9f0a('0x4e')){var _0x452658={};_0x452658[_0x5585b2[_0x9f0a('0x4f')]]={'$like':'%'+_0x2456ce['query'][_0x9f0a('0x4c')]+'%'};return _0x452658;}})});}_0x277c57=_['merge']({},_0x277c57,_0x2456ce['options']);var _0x3bd2bb={'where':_0x277c57[_0x9f0a('0x4a')]};return db[_0x9f0a('0x3a')][_0x9f0a('0x30')](_0x3bd2bb)['then'](function(_0x387dbc){_0x232963[_0x9f0a('0x30')]=_0x387dbc;if(_0x2456ce['query'][_0x9f0a('0x50')]){_0x277c57[_0x9f0a('0x51')]=[{'all':!![]}];}return db[_0x9f0a('0x3a')]['findAll'](_0x277c57);})[_0x9f0a('0x52')](function(_0x4d0fa8){_0x232963[_0x9f0a('0x53')]=_0x4d0fa8;return _0x232963;})[_0x9f0a('0x52')](respondWithFilteredResult(_0x106b67,_0x277c57))[_0x9f0a('0x54')](handleError(_0x106b67,null));};exports['show']=function(_0x2c411b,_0x2c766b){var _0x4d0c42={'raw':![],'where':{'id':_0x2c411b[_0x9f0a('0x55')]['id']}},_0x227f80={};_0x227f80['model']=_[_0x9f0a('0x3f')](db[_0x9f0a('0x3a')]['rawAttributes']);_0x227f80[_0x9f0a('0x40')]=_[_0x9f0a('0x3f')](_0x2c411b[_0x9f0a('0x40')]);_0x227f80[_0x9f0a('0x41')]=_[_0x9f0a('0x56')](_0x227f80[_0x9f0a('0x3e')],_0x227f80[_0x9f0a('0x40')]);_0x4d0c42['attributes']=_[_0x9f0a('0x56')](_0x227f80[_0x9f0a('0x3e')],qs['fields'](_0x2c411b[_0x9f0a('0x40')][_0x9f0a('0x43')]));_0x4d0c42['attributes']=_0x4d0c42[_0x9f0a('0x42')][_0x9f0a('0x44')]?_0x4d0c42[_0x9f0a('0x42')]:_0x227f80[_0x9f0a('0x3e')];if(_0x2c411b['query']['includeAll']){_0x4d0c42[_0x9f0a('0x51')]=[{'all':!![]}];}_0x4d0c42=_[_0x9f0a('0x4d')]({},_0x4d0c42,_0x2c411b[_0x9f0a('0x57')]);return db[_0x9f0a('0x3a')][_0x9f0a('0x58')](_0x4d0c42)[_0x9f0a('0x52')](handleEntityNotFound(_0x2c766b,null))[_0x9f0a('0x52')](respondWithResult(_0x2c766b,null))[_0x9f0a('0x54')](handleError(_0x2c766b,null));};exports[_0x9f0a('0x59')]=function(_0x4e11d7,_0x1706d9){return db[_0x9f0a('0x3a')][_0x9f0a('0x59')](_0x4e11d7[_0x9f0a('0x5a')],{})['then'](respondWithResult(_0x1706d9,0xc9))[_0x9f0a('0x54')](handleError(_0x1706d9,null));};exports[_0x9f0a('0x36')]=function(_0x562a76,_0x4734bb){if(_0x562a76[_0x9f0a('0x5a')]['id']){delete _0x562a76[_0x9f0a('0x5a')]['id'];}return db['ZendeskConfiguration'][_0x9f0a('0x58')]({'where':{'id':_0x562a76[_0x9f0a('0x55')]['id']}})[_0x9f0a('0x52')](handleEntityNotFound(_0x4734bb,null))[_0x9f0a('0x52')](saveUpdates(_0x562a76[_0x9f0a('0x5a')],null))[_0x9f0a('0x52')](respondWithResult(_0x4734bb,null))[_0x9f0a('0x54')](handleError(_0x4734bb,null));};exports[_0x9f0a('0x5b')]=function(_0x2aeeb1,_0x12f153){return db[_0x9f0a('0x3a')]['find']({'where':{'id':_0x2aeeb1['params']['id']}})['then'](handleEntityNotFound(_0x12f153,null))['then'](removeEntity(_0x12f153,null))['catch'](handleError(_0x12f153,null));};exports[_0x9f0a('0x5c')]=function(_0xe71f87,_0x515732,_0x1f3858){var _0xc0a208={};var _0x430ab4={};var _0x5c54a2;var _0x2a539d;return db[_0x9f0a('0x3a')]['findOne']({'where':{'id':_0xe71f87[_0x9f0a('0x55')]['id']}})[_0x9f0a('0x52')](handleEntityNotFound(_0x515732,null))[_0x9f0a('0x52')](function(_0x45b8fd){if(_0x45b8fd){_0x5c54a2=_0x45b8fd;_0x430ab4[_0x9f0a('0x3e')]=_['keys'](db[_0x9f0a('0x5d')]['rawAttributes']);_0x430ab4[_0x9f0a('0x40')]=_['keys'](_0xe71f87[_0x9f0a('0x40')]);_0x430ab4['filters']=_[_0x9f0a('0x56')](_0x430ab4[_0x9f0a('0x3e')],_0x430ab4[_0x9f0a('0x40')]);_0xc0a208['attributes']=_[_0x9f0a('0x56')](_0x430ab4[_0x9f0a('0x3e')],qs['fields'](_0xe71f87[_0x9f0a('0x40')][_0x9f0a('0x43')]));_0xc0a208['attributes']=_0xc0a208[_0x9f0a('0x42')][_0x9f0a('0x44')]?_0xc0a208[_0x9f0a('0x42')]:_0x430ab4['model'];_0xc0a208[_0x9f0a('0x48')]=qs[_0x9f0a('0x49')](_0xe71f87[_0x9f0a('0x40')]['sort']);_0xc0a208[_0x9f0a('0x4a')]=qs['filters'](_['pick'](_0xe71f87[_0x9f0a('0x40')],_0x430ab4[_0x9f0a('0x41')]));if(_0xe71f87[_0x9f0a('0x40')][_0x9f0a('0x4c')]){_0xc0a208['where']=_[_0x9f0a('0x4d')](_0xc0a208[_0x9f0a('0x4a')],{'$or':_[_0x9f0a('0x39')](_0xc0a208[_0x9f0a('0x42')],function(_0x1aa083){var _0x51f213={};_0x51f213[_0x1aa083]={'$like':'%'+_0xe71f87[_0x9f0a('0x40')][_0x9f0a('0x4c')]+'%'};return _0x51f213;})});}_0xc0a208=_[_0x9f0a('0x4d')]({},_0xc0a208,_0xe71f87[_0x9f0a('0x57')]);return _0x5c54a2[_0x9f0a('0x5c')](_0xc0a208);}})[_0x9f0a('0x52')](function(_0xc40c7a){if(_0xc40c7a){_0x2a539d=_0xc40c7a[_0x9f0a('0x44')];if(!_0xe71f87['query'][_0x9f0a('0x45')]('nolimit')){_0xc0a208['limit']=qs[_0x9f0a('0x47')](_0xe71f87[_0x9f0a('0x40')][_0x9f0a('0x47')]);_0xc0a208[_0x9f0a('0x31')]=qs[_0x9f0a('0x31')](_0xe71f87['query']['offset']);}return _0x5c54a2[_0x9f0a('0x5c')](_0xc0a208);}})[_0x9f0a('0x52')](function(_0x3e2d9b){if(_0x3e2d9b){return _0x3e2d9b?{'count':_0x2a539d,'rows':_0x3e2d9b}:null;}})[_0x9f0a('0x52')](respondWithResult(_0x515732,null))[_0x9f0a('0x54')](handleError(_0x515732,null));};exports[_0x9f0a('0x5e')]=function(_0x38cffc,_0x4e5179,_0x15a190){var _0xf326e8={};var _0x2d51d9={};var _0xaba9d1;var _0xeba8f1;return db['ZendeskConfiguration'][_0x9f0a('0x5f')]({'where':{'id':_0x38cffc['params']['id']}})['then'](handleEntityNotFound(_0x4e5179,null))[_0x9f0a('0x52')](function(_0xd9c9c5){if(_0xd9c9c5){_0xaba9d1=_0xd9c9c5;_0x2d51d9[_0x9f0a('0x3e')]=_[_0x9f0a('0x3f')](db[_0x9f0a('0x5d')]['rawAttributes']);_0x2d51d9[_0x9f0a('0x40')]=_[_0x9f0a('0x3f')](_0x38cffc['query']);_0x2d51d9[_0x9f0a('0x41')]=_['intersection'](_0x2d51d9[_0x9f0a('0x3e')],_0x2d51d9[_0x9f0a('0x40')]);_0xf326e8[_0x9f0a('0x42')]=_[_0x9f0a('0x56')](_0x2d51d9[_0x9f0a('0x3e')],qs[_0x9f0a('0x43')](_0x38cffc[_0x9f0a('0x40')]['fields']));_0xf326e8[_0x9f0a('0x42')]=_0xf326e8[_0x9f0a('0x42')][_0x9f0a('0x44')]?_0xf326e8[_0x9f0a('0x42')]:_0x2d51d9[_0x9f0a('0x3e')];_0xf326e8[_0x9f0a('0x48')]=qs[_0x9f0a('0x49')](_0x38cffc['query'][_0x9f0a('0x49')]);_0xf326e8['where']=qs[_0x9f0a('0x41')](_[_0x9f0a('0x4b')](_0x38cffc[_0x9f0a('0x40')],_0x2d51d9[_0x9f0a('0x41')]));if(_0x38cffc['query']['filter']){_0xf326e8[_0x9f0a('0x4a')]=_['merge'](_0xf326e8[_0x9f0a('0x4a')],{'$or':_[_0x9f0a('0x39')](_0xf326e8['attributes'],function(_0x2ceb0d){var _0x209593={};_0x209593[_0x2ceb0d]={'$like':'%'+_0x38cffc['query'][_0x9f0a('0x4c')]+'%'};return _0x209593;})});}_0xf326e8=_[_0x9f0a('0x4d')]({},_0xf326e8,_0x38cffc[_0x9f0a('0x57')]);return _0xaba9d1[_0x9f0a('0x5e')](_0xf326e8);}})[_0x9f0a('0x52')](function(_0x22fe4a){if(_0x22fe4a){_0xeba8f1=_0x22fe4a[_0x9f0a('0x44')];if(!_0x38cffc[_0x9f0a('0x40')][_0x9f0a('0x45')](_0x9f0a('0x46'))){_0xf326e8[_0x9f0a('0x47')]=qs[_0x9f0a('0x47')](_0x38cffc[_0x9f0a('0x40')]['limit']);_0xf326e8[_0x9f0a('0x31')]=qs[_0x9f0a('0x31')](_0x38cffc[_0x9f0a('0x40')][_0x9f0a('0x31')]);}return _0xaba9d1['getSubjects'](_0xf326e8);}})['then'](function(_0x2e6b31){if(_0x2e6b31){return _0x2e6b31?{'count':_0xeba8f1,'rows':_0x2e6b31}:null;}})[_0x9f0a('0x52')](respondWithResult(_0x4e5179,null))[_0x9f0a('0x54')](handleError(_0x4e5179,null));};exports[_0x9f0a('0x60')]=function(_0x6e5053,_0x5568e3,_0x4afd3b){var _0x108081={};var _0x4485da={};var _0x55b702;var _0x4b7b9f;return db[_0x9f0a('0x3a')][_0x9f0a('0x5f')]({'where':{'id':_0x6e5053[_0x9f0a('0x55')]['id']}})[_0x9f0a('0x52')](handleEntityNotFound(_0x5568e3,null))[_0x9f0a('0x52')](function(_0x4a0bfa){if(_0x4a0bfa){_0x55b702=_0x4a0bfa;_0x4485da[_0x9f0a('0x3e')]=_[_0x9f0a('0x3f')](db[_0x9f0a('0x5d')][_0x9f0a('0x61')]);_0x4485da[_0x9f0a('0x40')]=_[_0x9f0a('0x3f')](_0x6e5053[_0x9f0a('0x40')]);_0x4485da['filters']=_[_0x9f0a('0x56')](_0x4485da[_0x9f0a('0x3e')],_0x4485da[_0x9f0a('0x40')]);_0x108081[_0x9f0a('0x42')]=_[_0x9f0a('0x56')](_0x4485da[_0x9f0a('0x3e')],qs[_0x9f0a('0x43')](_0x6e5053[_0x9f0a('0x40')][_0x9f0a('0x43')]));_0x108081[_0x9f0a('0x42')]=_0x108081[_0x9f0a('0x42')]['length']?_0x108081['attributes']:_0x4485da[_0x9f0a('0x3e')];_0x108081['order']=qs[_0x9f0a('0x49')](_0x6e5053[_0x9f0a('0x40')][_0x9f0a('0x49')]);_0x108081[_0x9f0a('0x4a')]=qs[_0x9f0a('0x41')](_[_0x9f0a('0x4b')](_0x6e5053[_0x9f0a('0x40')],_0x4485da['filters']));if(_0x6e5053[_0x9f0a('0x40')][_0x9f0a('0x4c')]){_0x108081[_0x9f0a('0x4a')]=_[_0x9f0a('0x4d')](_0x108081['where'],{'$or':_[_0x9f0a('0x39')](_0x108081[_0x9f0a('0x42')],function(_0x1db22b){var _0x5811eb={};_0x5811eb[_0x1db22b]={'$like':'%'+_0x6e5053['query'][_0x9f0a('0x4c')]+'%'};return _0x5811eb;})});}_0x108081=_['merge']({},_0x108081,_0x6e5053[_0x9f0a('0x57')]);return _0x55b702[_0x9f0a('0x60')](_0x108081);}})[_0x9f0a('0x52')](function(_0x38f772){if(_0x38f772){_0x4b7b9f=_0x38f772['length'];if(!_0x6e5053['query'][_0x9f0a('0x45')](_0x9f0a('0x46'))){_0x108081[_0x9f0a('0x47')]=qs[_0x9f0a('0x47')](_0x6e5053[_0x9f0a('0x40')][_0x9f0a('0x47')]);_0x108081['offset']=qs[_0x9f0a('0x31')](_0x6e5053['query'][_0x9f0a('0x31')]);}return _0x55b702[_0x9f0a('0x60')](_0x108081);}})[_0x9f0a('0x52')](function(_0x5e5397){if(_0x5e5397){return _0x5e5397?{'count':_0x4b7b9f,'rows':_0x5e5397}:null;}})[_0x9f0a('0x52')](respondWithResult(_0x5568e3,null))['catch'](handleError(_0x5568e3,null));};exports['getTags']=function(_0x13e463,_0x3ce9a2,_0x2ed99c){var _0x2c5e81={};var _0x60980b={};var _0x43604b;var _0x28f7d8;return db[_0x9f0a('0x3a')][_0x9f0a('0x5f')]({'where':{'id':_0x13e463[_0x9f0a('0x55')]['id']}})[_0x9f0a('0x52')](handleEntityNotFound(_0x3ce9a2,null))[_0x9f0a('0x52')](function(_0x27624e){if(_0x27624e){_0x43604b=_0x27624e;_0x60980b[_0x9f0a('0x3e')]=_[_0x9f0a('0x3f')](db['Tag'][_0x9f0a('0x61')]);_0x60980b[_0x9f0a('0x40')]=_[_0x9f0a('0x3f')](_0x13e463[_0x9f0a('0x40')]);_0x60980b[_0x9f0a('0x41')]=_[_0x9f0a('0x56')](_0x60980b[_0x9f0a('0x3e')],_0x60980b[_0x9f0a('0x40')]);_0x2c5e81[_0x9f0a('0x42')]=_[_0x9f0a('0x56')](_0x60980b['model'],qs[_0x9f0a('0x43')](_0x13e463['query'][_0x9f0a('0x43')]));_0x2c5e81[_0x9f0a('0x42')]=_0x2c5e81[_0x9f0a('0x42')][_0x9f0a('0x44')]?_0x2c5e81['attributes']:_0x60980b[_0x9f0a('0x3e')];_0x2c5e81['order']=qs[_0x9f0a('0x49')](_0x13e463[_0x9f0a('0x40')][_0x9f0a('0x49')]);_0x2c5e81[_0x9f0a('0x4a')]=qs[_0x9f0a('0x41')](_[_0x9f0a('0x4b')](_0x13e463[_0x9f0a('0x40')],_0x60980b[_0x9f0a('0x41')]));if(_0x13e463[_0x9f0a('0x40')][_0x9f0a('0x4c')]){_0x2c5e81[_0x9f0a('0x4a')]=_['merge'](_0x2c5e81['where'],{'$or':_['map'](_0x2c5e81[_0x9f0a('0x42')],function(_0xc5f06d){var _0x2cc15e={};_0x2cc15e[_0xc5f06d]={'$like':'%'+_0x13e463[_0x9f0a('0x40')][_0x9f0a('0x4c')]+'%'};return _0x2cc15e;})});}_0x2c5e81=_[_0x9f0a('0x4d')]({},_0x2c5e81,_0x13e463[_0x9f0a('0x57')]);return _0x43604b[_0x9f0a('0x62')](_0x2c5e81);}})[_0x9f0a('0x52')](function(_0x36fe49){if(_0x36fe49){_0x28f7d8=_0x36fe49[_0x9f0a('0x44')];if(!_0x13e463[_0x9f0a('0x40')]['hasOwnProperty'](_0x9f0a('0x46'))){_0x2c5e81[_0x9f0a('0x47')]=qs[_0x9f0a('0x47')](_0x13e463['query']['limit']);_0x2c5e81[_0x9f0a('0x31')]=qs[_0x9f0a('0x31')](_0x13e463[_0x9f0a('0x40')][_0x9f0a('0x31')]);}return _0x43604b[_0x9f0a('0x62')](_0x2c5e81);}})[_0x9f0a('0x52')](function(_0x241c7a){if(_0x241c7a){return _0x241c7a?{'count':_0x28f7d8,'rows':_0x241c7a}:null;}})[_0x9f0a('0x52')](respondWithResult(_0x3ce9a2,null))[_0x9f0a('0x54')](handleError(_0x3ce9a2,null));};exports[_0x9f0a('0x63')]=function(_0x1fcdae,_0x4fab1a,_0x120516){if(_0x1fcdae[_0x9f0a('0x5a')]['id']){delete _0x1fcdae[_0x9f0a('0x5a')]['id'];}return db[_0x9f0a('0x3a')]['findOne']({'where':{'id':_0x1fcdae['params']['id']}})[_0x9f0a('0x52')](handleEntityNotFound(_0x4fab1a,null))[_0x9f0a('0x52')](function(_0xd9004a){if(_0xd9004a){return _0xd9004a[_0x9f0a('0x63')](_0x1fcdae[_0x9f0a('0x5a')]['ids']||[]);}return null;})[_0x9f0a('0x52')](respondWithResult(_0x4fab1a,null))['catch'](handleError(_0x4fab1a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 02afdd6..b94329f 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 _0x9baf=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x580005,_0x55e402){var _0x12defc=function(_0xb57f09){while(--_0xb57f09){_0x580005['push'](_0x580005['shift']());}};_0x12defc(++_0x55e402);}(_0x9baf,0x1f4));var _0xf9ba=function(_0x4c3ad0,_0x11b23b){_0x4c3ad0=_0x4c3ad0-0x0;var _0x2766de=_0x9baf[_0x4c3ad0];return _0x2766de;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf9ba('0x0'))(_0xf9ba('0x1'));var moment=require(_0xf9ba('0x2'));var BPromise=require(_0xf9ba('0x3'));var rp=require(_0xf9ba('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9ba('0x5'));var config=require(_0xf9ba('0x6'));var attributes=require(_0xf9ba('0x7'));module[_0xf9ba('0x8')]=function(_0x28abd7,_0x1bdaba){return _0x28abd7[_0xf9ba('0x9')]('ZendeskConfiguration',attributes,{'tableName':_0xf9ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a96=['api','moment','bluebird','request-promise','path','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','util'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0x7a96,0xb3));var _0x67a9=function(_0x57062a,_0x123026){_0x57062a=_0x57062a-0x0;var _0xa178da=_0x7a96[_0x57062a];return _0xa178da;};'use strict';var _=require('lodash');var util=require(_0x67a9('0x0'));var logger=require('../../config/logger')(_0x67a9('0x1'));var moment=require(_0x67a9('0x2'));var BPromise=require(_0x67a9('0x3'));var rp=require(_0x67a9('0x4'));var fs=require('fs');var path=require(_0x67a9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x67a9('0x6'));module[_0x67a9('0x7')]=function(_0x217ea4,_0x360c65){return _0x217ea4[_0x67a9('0x8')](_0x67a9('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 2ef9403..eb54aa8 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 _0x49e2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x34fc0a,_0x227d88){var _0x27cf4d=function(_0x2cc5e6){while(--_0x2cc5e6){_0x34fc0a['push'](_0x34fc0a['shift']());}};_0x27cf4d(++_0x227d88);}(_0x49e2,0x18b));var _0x249e=function(_0x35cacd,_0xd36737){_0x35cacd=_0x35cacd-0x0;var _0x3505ee=_0x49e2[_0x35cacd];return _0x3505ee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x249e('0x0'));var BPromise=require(_0x249e('0x1'));var rs=require(_0x249e('0x2'));var fs=require('fs');var Redis=require(_0x249e('0x3'));var db=require(_0x249e('0x4'))['db'];var utils=require(_0x249e('0x5'));var logger=require(_0x249e('0x6'))(_0x249e('0x7'));var config=require(_0x249e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x249e('0x9')][_0x249e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a3629,_0x5abe4d,_0x23b7c6){return new BPromise(function(_0xdec6e,_0x305cd8){return client[_0x249e('0xb')](_0x3a3629,_0x23b7c6)[_0x249e('0xc')](function(_0x474e35){logger[_0x249e('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5abe4d,_0x249e('0xe'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5abe4d,_0x249e('0xe'),JSON[_0x249e('0xf')](_0x474e35));if(_0x474e35[_0x249e('0x10')]){if(_0x474e35[_0x249e('0x10')][_0x249e('0x11')]===0x1f4){logger[_0x249e('0x10')](_0x249e('0x12'),_0x5abe4d,_0x474e35['error'][_0x249e('0x13')]);return _0x305cd8(_0x474e35[_0x249e('0x10')][_0x249e('0x13')]);}logger['error'](_0x249e('0x12'),_0x5abe4d,_0x474e35[_0x249e('0x10')]['message']);return _0xdec6e(_0x474e35[_0x249e('0x10')][_0x249e('0x13')]);}else{logger['info'](_0x249e('0x12'),_0x5abe4d,'request\x20sent');_0xdec6e(_0x474e35[_0x249e('0x14')][_0x249e('0x13')]);}})[_0x249e('0x15')](function(_0x48b08e){logger['error'](_0x249e('0x12'),_0x5abe4d,_0x48b08e);_0x305cd8(_0x48b08e);});});} \ No newline at end of file +var _0x356d=['randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x5ba820,_0x344a48){var _0x3d8804=function(_0x1ca44e){while(--_0x1ca44e){_0x5ba820['push'](_0x5ba820['shift']());}};_0x3d8804(++_0x344a48);}(_0x356d,0xba));var _0xd356=function(_0x2862b1,_0x51a367){_0x2862b1=_0x2862b1-0x0;var _0x817ee6=_0x356d[_0x2862b1];return _0x817ee6;};'use strict';var _=require(_0xd356('0x0'));var util=require('util');var moment=require(_0xd356('0x1'));var BPromise=require(_0xd356('0x2'));var rs=require(_0xd356('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd356('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd356('0x5'))('rpc');var config=require(_0xd356('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd356('0x7')][_0xd356('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f31a5,_0x2a4300,_0x2218f0){return new BPromise(function(_0x40de95,_0x359d25){return client[_0xd356('0x9')](_0x1f31a5,_0x2218f0)['then'](function(_0x402b95){logger[_0xd356('0xa')](_0xd356('0xb'),_0x2a4300,_0xd356('0xc'));logger[_0xd356('0xd')](_0xd356('0xe'),_0x2a4300,'request\x20sent',JSON[_0xd356('0xf')](_0x402b95));if(_0x402b95[_0xd356('0x10')]){if(_0x402b95[_0xd356('0x10')][_0xd356('0x11')]===0x1f4){logger[_0xd356('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2a4300,_0x402b95[_0xd356('0x10')]['message']);return _0x359d25(_0x402b95[_0xd356('0x10')][_0xd356('0x12')]);}logger[_0xd356('0x10')](_0xd356('0xb'),_0x2a4300,_0x402b95[_0xd356('0x10')][_0xd356('0x12')]);return _0x40de95(_0x402b95[_0xd356('0x10')][_0xd356('0x12')]);}else{logger[_0xd356('0xa')](_0xd356('0xb'),_0x2a4300,_0xd356('0xc'));_0x40de95(_0x402b95[_0xd356('0x13')][_0xd356('0x12')]);}})[_0xd356('0x14')](function(_0x155f23){logger['error'](_0xd356('0xb'),_0x2a4300,_0x155f23);_0x359d25(_0x155f23);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 1b4a455..d331181 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 _0x5762=['isAuthenticated','index','/:id','show','create','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get'];(function(_0x1b0126,_0x2b37e2){var _0x491308=function(_0x5c347d){while(--_0x5c347d){_0x1b0126['push'](_0x1b0126['shift']());}};_0x491308(++_0x2b37e2);}(_0x5762,0xc2));var _0x2576=function(_0x126420,_0x476f16){_0x126420=_0x126420-0x0;var _0x4e6517=_0x5762[_0x126420];return _0x4e6517;};'use strict';var multer=require(_0x2576('0x0'));var util=require(_0x2576('0x1'));var path=require(_0x2576('0x2'));var timeout=require(_0x2576('0x3'));var express=require(_0x2576('0x4'));var router=express[_0x2576('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2576('0x6'));var config=require(_0x2576('0x7'));var controller=require(_0x2576('0x8'));router[_0x2576('0x9')]('/',auth[_0x2576('0xa')](),controller[_0x2576('0xb')]);router[_0x2576('0x9')](_0x2576('0xc'),auth['isAuthenticated'](),controller[_0x2576('0xd')]);router['post']('/',auth[_0x2576('0xa')](),controller[_0x2576('0xe')]);router['put']('/:id',auth[_0x2576('0xa')](),controller['update']);router[_0x2576('0xf')](_0x2576('0xc'),auth[_0x2576('0xa')](),controller[_0x2576('0x10')]);module['exports']=router; \ No newline at end of file +var _0x951a=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','show','put'];(function(_0x24bee7,_0x4d0347){var _0x447945=function(_0x49b14f){while(--_0x49b14f){_0x24bee7['push'](_0x24bee7['shift']());}};_0x447945(++_0x4d0347);}(_0x951a,0x101));var _0xa951=function(_0x26cf65,_0x5ce84b){_0x26cf65=_0x26cf65-0x0;var _0x3259c5=_0x951a[_0x26cf65];return _0x3259c5;};'use strict';var multer=require(_0xa951('0x0'));var util=require(_0xa951('0x1'));var path=require(_0xa951('0x2'));var timeout=require(_0xa951('0x3'));var express=require(_0xa951('0x4'));var router=express['Router']();var auth=require(_0xa951('0x5'));var interaction=require(_0xa951('0x6'));var config=require(_0xa951('0x7'));var controller=require(_0xa951('0x8'));router[_0xa951('0x9')]('/',auth[_0xa951('0xa')](),controller['index']);router[_0xa951('0x9')]('/:id',auth[_0xa951('0xa')](),controller[_0xa951('0xb')]);router['post']('/',auth[_0xa951('0xa')](),controller['create']);router[_0xa951('0xc')](_0xa951('0xd'),auth[_0xa951('0xa')](),controller[_0xa951('0xe')]);router[_0xa951('0xf')]('/:id',auth[_0xa951('0xa')](),controller[_0xa951('0x10')]);module[_0xa951('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 0d88d16..5071dbd 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 _0xbe52=['variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xbe52,0x164));var _0x2be5=function(_0x3fc1a7,_0x4416b9){_0x3fc1a7=_0x3fc1a7-0x0;var _0x28f0b3=_0xbe52[_0x3fc1a7];return _0x28f0b3;};'use strict';var Sequelize=require(_0x2be5('0x0'));module[_0x2be5('0x1')]={'type':{'type':Sequelize[_0x2be5('0x2')](_0x2be5('0x3'),_0x2be5('0x4'),'customVariable',_0x2be5('0x5')),'defaultValue':_0x2be5('0x3')},'content':{'type':Sequelize[_0x2be5('0x6')]},'key':{'type':Sequelize[_0x2be5('0x6')]},'keyType':{'type':Sequelize[_0x2be5('0x2')](_0x2be5('0x3'),_0x2be5('0x4'),_0x2be5('0x7'))},'keyContent':{'type':Sequelize[_0x2be5('0x6')]},'idField':{'type':Sequelize[_0x2be5('0x6')]},'nameField':{'type':Sequelize[_0x2be5('0x6')]},'customField':{'type':Sequelize[_0x2be5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdcf6=['string','variable','customVariable','keyValue','STRING','BOOLEAN','exports','ENUM'];(function(_0x4cd5d2,_0x53db42){var _0x5eb689=function(_0x431ae8){while(--_0x431ae8){_0x4cd5d2['push'](_0x4cd5d2['shift']());}};_0x5eb689(++_0x53db42);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x260e07,_0x2dd0e4){_0x260e07=_0x260e07-0x0;var _0x28ba4e=_0xdcf6[_0x260e07];return _0x28ba4e;};'use strict';var Sequelize=require('sequelize');module[_0x6dcf('0x0')]={'type':{'type':Sequelize[_0x6dcf('0x1')](_0x6dcf('0x2'),_0x6dcf('0x3'),_0x6dcf('0x4'),_0x6dcf('0x5')),'defaultValue':_0x6dcf('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6dcf('0x6')]},'keyType':{'type':Sequelize[_0x6dcf('0x1')]('string',_0x6dcf('0x3'),_0x6dcf('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6dcf('0x7')],'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 9e9c8ee..abb91ee 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 _0x5605=['api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','then','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','includeAll','find','create','body','catch','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x59935c,_0x9d6668){var _0x48cb71=function(_0x571946){while(--_0x571946){_0x59935c['push'](_0x59935c['shift']());}};_0x48cb71(++_0x9d6668);}(_0x5605,0x15c));var _0x5560=function(_0x4d1744,_0x4171ea){_0x4d1744=_0x4d1744-0x0;var _0x115232=_0x5605[_0x4d1744];return _0x115232;};'use strict';var pdf=require(_0x5560('0x0'));var emlformat=require(_0x5560('0x1'));var rimraf=require(_0x5560('0x2'));var zipdir=require(_0x5560('0x3'));var jsonpatch=require(_0x5560('0x4'));var rp=require(_0x5560('0x5'));var moment=require(_0x5560('0x6'));var BPromise=require(_0x5560('0x7'));var Mustache=require(_0x5560('0x8'));var util=require(_0x5560('0x9'));var path=require('path');var sox=require(_0x5560('0xa'));var csv=require('to-csv');var ejs=require(_0x5560('0xb'));var fs=require('fs');var _=require(_0x5560('0xc'));var squel=require(_0x5560('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5560('0xe'));var querystring=require(_0x5560('0xf'));var Papa=require(_0x5560('0x10'));var Redis=require('ioredis');var authService=require(_0x5560('0x11'));var qs=require(_0x5560('0x12'));var as=require(_0x5560('0x13'));var hardwareService=require(_0x5560('0x14'));var logger=require(_0x5560('0x15'))(_0x5560('0x16'));var utils=require(_0x5560('0x17'));var config=require(_0x5560('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x443234,_0x2f7b5a){_0x2f7b5a=_0x2f7b5a||0xcc;return function(_0x14ebd2){if(_0x14ebd2){return _0x443234[_0x5560('0x19')](_0x2f7b5a);}return _0x443234[_0x5560('0x1a')](_0x2f7b5a)[_0x5560('0x1b')]();};}function respondWithResult(_0x1edeb2,_0x239ec9){_0x239ec9=_0x239ec9||0xc8;return function(_0xc3a27d){if(_0xc3a27d){return _0x1edeb2['status'](_0x239ec9)['json'](_0xc3a27d);}};}function respondWithFilteredResult(_0x47b63,_0x4c9fc2){return function(_0x4e3fc2){if(_0x4e3fc2){var _0x4fc359=_0x4e3fc2[_0x5560('0x1c')],_0x14ca4d=_0x4c9fc2[_0x5560('0x1d')],_0x123d35=_0x4c9fc2[_0x5560('0x1d')]+_0x4c9fc2[_0x5560('0x1e')],_0x30bbdd;if(_0x123d35>=_0x4fc359){_0x123d35=_0x4fc359;_0x30bbdd=0xc8;}else{_0x30bbdd=0xce;}_0x47b63[_0x5560('0x1a')](_0x30bbdd);return _0x47b63[_0x5560('0x1f')](_0x5560('0x20'),_0x14ca4d+'-'+_0x123d35+'/'+_0x4fc359)[_0x5560('0x21')](_0x4e3fc2);}return null;};}function patchUpdates(_0x28f00e){return function(_0x1b153e){try{jsonpatch['apply'](_0x1b153e,_0x28f00e,!![]);}catch(_0x553d39){return BPromise[_0x5560('0x22')](_0x553d39);}return _0x1b153e['save']();};}function saveUpdates(_0x15cd0a,_0x52bcfb){return function(_0x46fcff){if(_0x46fcff){return _0x46fcff['update'](_0x15cd0a)[_0x5560('0x23')](function(_0x4218a6){return _0x4218a6;});}return null;};}function removeEntity(_0x1cb275,_0x271b87){return function(_0x785d21){if(_0x785d21){return _0x785d21['destroy']()['then'](function(){_0x1cb275[_0x5560('0x1a')](0xcc)[_0x5560('0x1b')]();});}};}function handleEntityNotFound(_0x54acef,_0x32f56a){return function(_0x465cff){if(!_0x465cff){_0x54acef[_0x5560('0x19')](0x194);}return _0x465cff;};}function handleError(_0x2bcd93,_0x5ae084){_0x5ae084=_0x5ae084||0x1f4;return function(_0x5219d9){logger[_0x5560('0x24')](_0x5219d9[_0x5560('0x25')]);if(_0x5219d9[_0x5560('0x26')]){delete _0x5219d9[_0x5560('0x26')];}_0x2bcd93[_0x5560('0x1a')](_0x5ae084)[_0x5560('0x27')](_0x5219d9);};}exports['index']=function(_0x5ed416,_0x518000){var _0xedd05d={},_0x3a7ad8={},_0x2f4a60={'count':0x0,'rows':[]};var _0x1175dc=_[_0x5560('0x28')](db[_0x5560('0x29')][_0x5560('0x2a')],function(_0x2d314c){return{'name':_0x2d314c[_0x5560('0x2b')],'type':_0x2d314c[_0x5560('0x2c')][_0x5560('0x2d')]};});_0x3a7ad8['model']=_[_0x5560('0x28')](_0x1175dc,_0x5560('0x26'));_0x3a7ad8['query']=_[_0x5560('0x2e')](_0x5ed416[_0x5560('0x2f')]);_0x3a7ad8[_0x5560('0x30')]=_[_0x5560('0x31')](_0x3a7ad8[_0x5560('0x32')],_0x3a7ad8['query']);_0xedd05d[_0x5560('0x33')]=_[_0x5560('0x31')](_0x3a7ad8['model'],qs[_0x5560('0x34')](_0x5ed416['query'][_0x5560('0x34')]));_0xedd05d['attributes']=_0xedd05d[_0x5560('0x33')][_0x5560('0x35')]?_0xedd05d[_0x5560('0x33')]:_0x3a7ad8['model'];if(!_0x5ed416[_0x5560('0x2f')][_0x5560('0x36')](_0x5560('0x37'))){_0xedd05d['limit']=qs['limit'](_0x5ed416[_0x5560('0x2f')][_0x5560('0x1e')]);_0xedd05d['offset']=qs[_0x5560('0x1d')](_0x5ed416['query'][_0x5560('0x1d')]);}_0xedd05d[_0x5560('0x38')]=qs[_0x5560('0x39')](_0x5ed416['query'][_0x5560('0x39')]);_0xedd05d[_0x5560('0x3a')]=qs[_0x5560('0x30')](_[_0x5560('0x3b')](_0x5ed416[_0x5560('0x2f')],_0x3a7ad8[_0x5560('0x30')]),_0x1175dc);if(_0x5ed416[_0x5560('0x2f')][_0x5560('0x3c')]){_0xedd05d[_0x5560('0x3a')]=_[_0x5560('0x3d')](_0xedd05d[_0x5560('0x3a')],{'$or':_[_0x5560('0x28')](_0x1175dc,function(_0x1a79b7){if(_0x1a79b7[_0x5560('0x2c')]!==_0x5560('0x3e')){var _0x5d7a59={};_0x5d7a59[_0x1a79b7['name']]={'$like':'%'+_0x5ed416[_0x5560('0x2f')][_0x5560('0x3c')]+'%'};return _0x5d7a59;}})});}_0xedd05d=_['merge']({},_0xedd05d,_0x5ed416[_0x5560('0x3f')]);var _0x249f7a={'where':_0xedd05d[_0x5560('0x3a')]};return db[_0x5560('0x29')][_0x5560('0x1c')](_0x249f7a)[_0x5560('0x23')](function(_0x1666b4){_0x2f4a60['count']=_0x1666b4;if(_0x5ed416[_0x5560('0x2f')]['includeAll']){_0xedd05d[_0x5560('0x40')]=[{'all':!![]}];}return db['ZendeskField'][_0x5560('0x41')](_0xedd05d);})[_0x5560('0x23')](function(_0x1d43ba){_0x2f4a60['rows']=_0x1d43ba;return _0x2f4a60;})[_0x5560('0x23')](respondWithFilteredResult(_0x518000,_0xedd05d))['catch'](handleError(_0x518000,null));};exports[_0x5560('0x42')]=function(_0x448df2,_0x19538a){var _0xbcfdc4={'raw':!![],'where':{'id':_0x448df2[_0x5560('0x43')]['id']}},_0x173d4f={};_0x173d4f[_0x5560('0x32')]=_['keys'](db['ZendeskField'][_0x5560('0x2a')]);_0x173d4f[_0x5560('0x2f')]=_[_0x5560('0x2e')](_0x448df2['query']);_0x173d4f[_0x5560('0x30')]=_[_0x5560('0x31')](_0x173d4f[_0x5560('0x32')],_0x173d4f[_0x5560('0x2f')]);_0xbcfdc4[_0x5560('0x33')]=_[_0x5560('0x31')](_0x173d4f['model'],qs[_0x5560('0x34')](_0x448df2[_0x5560('0x2f')][_0x5560('0x34')]));_0xbcfdc4[_0x5560('0x33')]=_0xbcfdc4['attributes'][_0x5560('0x35')]?_0xbcfdc4[_0x5560('0x33')]:_0x173d4f[_0x5560('0x32')];if(_0x448df2[_0x5560('0x2f')][_0x5560('0x44')]){_0xbcfdc4[_0x5560('0x40')]=[{'all':!![]}];}_0xbcfdc4=_[_0x5560('0x3d')]({},_0xbcfdc4,_0x448df2[_0x5560('0x3f')]);return db[_0x5560('0x29')][_0x5560('0x45')](_0xbcfdc4)['then'](handleEntityNotFound(_0x19538a,null))[_0x5560('0x23')](respondWithResult(_0x19538a,null))['catch'](handleError(_0x19538a,null));};exports[_0x5560('0x46')]=function(_0x453f51,_0x183458){return db[_0x5560('0x29')]['create'](_0x453f51[_0x5560('0x47')],{})[_0x5560('0x23')](respondWithResult(_0x183458,0xc9))[_0x5560('0x48')](handleError(_0x183458,null));};exports[_0x5560('0x49')]=function(_0x4becd4,_0x2de99e){if(_0x4becd4[_0x5560('0x47')]['id']){delete _0x4becd4[_0x5560('0x47')]['id'];}return db[_0x5560('0x29')][_0x5560('0x45')]({'where':{'id':_0x4becd4[_0x5560('0x43')]['id']}})[_0x5560('0x23')](handleEntityNotFound(_0x2de99e,null))[_0x5560('0x23')](saveUpdates(_0x4becd4[_0x5560('0x47')],null))[_0x5560('0x23')](respondWithResult(_0x2de99e,null))[_0x5560('0x48')](handleError(_0x2de99e,null));};exports['destroy']=function(_0x3d3ffc,_0x34b800){return db[_0x5560('0x29')]['find']({'where':{'id':_0x3d3ffc[_0x5560('0x43')]['id']}})[_0x5560('0x23')](handleEntityNotFound(_0x34b800,null))[_0x5560('0x23')](removeEntity(_0x34b800,null))[_0x5560('0x48')](handleError(_0x34b800,null));}; \ No newline at end of file +var _0xd535=['request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','then','destroy','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','count','include','findAll','catch','includeAll','find','create','body','params','html-pdf','eml-format'];(function(_0x20fa82,_0x285243){var _0x544947=function(_0x33d0d3){while(--_0x33d0d3){_0x20fa82['push'](_0x20fa82['shift']());}};_0x544947(++_0x285243);}(_0xd535,0x161));var _0x5d53=function(_0x49f424,_0x8ced94){_0x49f424=_0x49f424-0x0;var _0x5305ed=_0xd535[_0x49f424];return _0x5305ed;};'use strict';var pdf=require(_0x5d53('0x0'));var emlformat=require(_0x5d53('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5d53('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5d53('0x3'));var util=require(_0x5d53('0x4'));var path=require(_0x5d53('0x5'));var sox=require(_0x5d53('0x6'));var csv=require(_0x5d53('0x7'));var ejs=require(_0x5d53('0x8'));var fs=require('fs');var _=require(_0x5d53('0x9'));var squel=require(_0x5d53('0xa'));var crypto=require(_0x5d53('0xb'));var jsforce=require(_0x5d53('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5d53('0x7'));var querystring=require('querystring');var Papa=require(_0x5d53('0xd'));var Redis=require(_0x5d53('0xe'));var authService=require(_0x5d53('0xf'));var qs=require(_0x5d53('0x10'));var as=require(_0x5d53('0x11'));var hardwareService=require(_0x5d53('0x12'));var logger=require(_0x5d53('0x13'))(_0x5d53('0x14'));var utils=require(_0x5d53('0x15'));var config=require(_0x5d53('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31c9bc,_0x2dff7c){_0x2dff7c=_0x2dff7c||0xcc;return function(_0x1b9721){if(_0x1b9721){return _0x31c9bc[_0x5d53('0x17')](_0x2dff7c);}return _0x31c9bc[_0x5d53('0x18')](_0x2dff7c)[_0x5d53('0x19')]();};}function respondWithResult(_0x9822ad,_0x24e819){_0x24e819=_0x24e819||0xc8;return function(_0x3d7e34){if(_0x3d7e34){return _0x9822ad[_0x5d53('0x18')](_0x24e819)[_0x5d53('0x1a')](_0x3d7e34);}};}function respondWithFilteredResult(_0x1262d6,_0x3e8d72){return function(_0x336c39){if(_0x336c39){var _0x3c4143=_0x336c39['count'],_0x5f2453=_0x3e8d72[_0x5d53('0x1b')],_0x4e716b=_0x3e8d72[_0x5d53('0x1b')]+_0x3e8d72[_0x5d53('0x1c')],_0x894bcc;if(_0x4e716b>=_0x3c4143){_0x4e716b=_0x3c4143;_0x894bcc=0xc8;}else{_0x894bcc=0xce;}_0x1262d6[_0x5d53('0x18')](_0x894bcc);return _0x1262d6[_0x5d53('0x1d')](_0x5d53('0x1e'),_0x5f2453+'-'+_0x4e716b+'/'+_0x3c4143)[_0x5d53('0x1a')](_0x336c39);}return null;};}function patchUpdates(_0x33cdaa){return function(_0x2684bf){try{jsonpatch['apply'](_0x2684bf,_0x33cdaa,!![]);}catch(_0x264c18){return BPromise[_0x5d53('0x1f')](_0x264c18);}return _0x2684bf['save']();};}function saveUpdates(_0x44b614,_0x3d3e3d){return function(_0x5f4d6e){if(_0x5f4d6e){return _0x5f4d6e[_0x5d53('0x20')](_0x44b614)[_0x5d53('0x21')](function(_0xb06567){return _0xb06567;});}return null;};}function removeEntity(_0x1afcac,_0x1c26cf){return function(_0x438a61){if(_0x438a61){return _0x438a61[_0x5d53('0x22')]()['then'](function(){_0x1afcac[_0x5d53('0x18')](0xcc)[_0x5d53('0x19')]();});}};}function handleEntityNotFound(_0x3a4058,_0x441b66){return function(_0x39d964){if(!_0x39d964){_0x3a4058[_0x5d53('0x17')](0x194);}return _0x39d964;};}function handleError(_0x4c64ac,_0x96ea19){_0x96ea19=_0x96ea19||0x1f4;return function(_0xda339e){logger['error'](_0xda339e[_0x5d53('0x23')]);if(_0xda339e[_0x5d53('0x24')]){delete _0xda339e[_0x5d53('0x24')];}_0x4c64ac['status'](_0x96ea19)[_0x5d53('0x25')](_0xda339e);};}exports[_0x5d53('0x26')]=function(_0x46ad96,_0x19fb92){var _0x1b1abc={},_0x1cc864={},_0x5f336b={'count':0x0,'rows':[]};var _0x54f140=_[_0x5d53('0x27')](db[_0x5d53('0x28')][_0x5d53('0x29')],function(_0x4c2ee8){return{'name':_0x4c2ee8[_0x5d53('0x2a')],'type':_0x4c2ee8['type'][_0x5d53('0x2b')]};});_0x1cc864[_0x5d53('0x2c')]=_[_0x5d53('0x27')](_0x54f140,'name');_0x1cc864[_0x5d53('0x2d')]=_[_0x5d53('0x2e')](_0x46ad96['query']);_0x1cc864['filters']=_[_0x5d53('0x2f')](_0x1cc864['model'],_0x1cc864['query']);_0x1b1abc[_0x5d53('0x30')]=_[_0x5d53('0x2f')](_0x1cc864[_0x5d53('0x2c')],qs['fields'](_0x46ad96[_0x5d53('0x2d')][_0x5d53('0x31')]));_0x1b1abc[_0x5d53('0x30')]=_0x1b1abc[_0x5d53('0x30')][_0x5d53('0x32')]?_0x1b1abc[_0x5d53('0x30')]:_0x1cc864[_0x5d53('0x2c')];if(!_0x46ad96[_0x5d53('0x2d')][_0x5d53('0x33')](_0x5d53('0x34'))){_0x1b1abc['limit']=qs['limit'](_0x46ad96['query'][_0x5d53('0x1c')]);_0x1b1abc[_0x5d53('0x1b')]=qs[_0x5d53('0x1b')](_0x46ad96[_0x5d53('0x2d')]['offset']);}_0x1b1abc[_0x5d53('0x35')]=qs[_0x5d53('0x36')](_0x46ad96[_0x5d53('0x2d')][_0x5d53('0x36')]);_0x1b1abc[_0x5d53('0x37')]=qs[_0x5d53('0x38')](_['pick'](_0x46ad96[_0x5d53('0x2d')],_0x1cc864[_0x5d53('0x38')]),_0x54f140);if(_0x46ad96['query'][_0x5d53('0x39')]){_0x1b1abc[_0x5d53('0x37')]=_[_0x5d53('0x3a')](_0x1b1abc['where'],{'$or':_[_0x5d53('0x27')](_0x54f140,function(_0x22fce9){if(_0x22fce9[_0x5d53('0x3b')]!==_0x5d53('0x3c')){var _0x334ba2={};_0x334ba2[_0x22fce9[_0x5d53('0x24')]]={'$like':'%'+_0x46ad96[_0x5d53('0x2d')][_0x5d53('0x39')]+'%'};return _0x334ba2;}})});}_0x1b1abc=_[_0x5d53('0x3a')]({},_0x1b1abc,_0x46ad96[_0x5d53('0x3d')]);var _0x5a4c06={'where':_0x1b1abc[_0x5d53('0x37')]};return db[_0x5d53('0x28')][_0x5d53('0x3e')](_0x5a4c06)[_0x5d53('0x21')](function(_0x3c766a){_0x5f336b[_0x5d53('0x3e')]=_0x3c766a;if(_0x46ad96['query']['includeAll']){_0x1b1abc[_0x5d53('0x3f')]=[{'all':!![]}];}return db[_0x5d53('0x28')][_0x5d53('0x40')](_0x1b1abc);})[_0x5d53('0x21')](function(_0x42bafe){_0x5f336b['rows']=_0x42bafe;return _0x5f336b;})[_0x5d53('0x21')](respondWithFilteredResult(_0x19fb92,_0x1b1abc))[_0x5d53('0x41')](handleError(_0x19fb92,null));};exports['show']=function(_0x3d5570,_0x3a3b3e){var _0x468a5b={'raw':!![],'where':{'id':_0x3d5570['params']['id']}},_0x557c69={};_0x557c69['model']=_[_0x5d53('0x2e')](db[_0x5d53('0x28')][_0x5d53('0x29')]);_0x557c69['query']=_[_0x5d53('0x2e')](_0x3d5570[_0x5d53('0x2d')]);_0x557c69[_0x5d53('0x38')]=_[_0x5d53('0x2f')](_0x557c69[_0x5d53('0x2c')],_0x557c69[_0x5d53('0x2d')]);_0x468a5b[_0x5d53('0x30')]=_[_0x5d53('0x2f')](_0x557c69[_0x5d53('0x2c')],qs[_0x5d53('0x31')](_0x3d5570[_0x5d53('0x2d')][_0x5d53('0x31')]));_0x468a5b[_0x5d53('0x30')]=_0x468a5b['attributes'][_0x5d53('0x32')]?_0x468a5b[_0x5d53('0x30')]:_0x557c69['model'];if(_0x3d5570[_0x5d53('0x2d')][_0x5d53('0x42')]){_0x468a5b['include']=[{'all':!![]}];}_0x468a5b=_['merge']({},_0x468a5b,_0x3d5570['options']);return db['ZendeskField'][_0x5d53('0x43')](_0x468a5b)[_0x5d53('0x21')](handleEntityNotFound(_0x3a3b3e,null))['then'](respondWithResult(_0x3a3b3e,null))[_0x5d53('0x41')](handleError(_0x3a3b3e,null));};exports[_0x5d53('0x44')]=function(_0x5b3208,_0x4d9e16){return db[_0x5d53('0x28')][_0x5d53('0x44')](_0x5b3208[_0x5d53('0x45')],{})['then'](respondWithResult(_0x4d9e16,0xc9))['catch'](handleError(_0x4d9e16,null));};exports['update']=function(_0x3b9d80,_0x3c979b){if(_0x3b9d80[_0x5d53('0x45')]['id']){delete _0x3b9d80['body']['id'];}return db[_0x5d53('0x28')][_0x5d53('0x43')]({'where':{'id':_0x3b9d80['params']['id']}})[_0x5d53('0x21')](handleEntityNotFound(_0x3c979b,null))[_0x5d53('0x21')](saveUpdates(_0x3b9d80[_0x5d53('0x45')],null))[_0x5d53('0x21')](respondWithResult(_0x3c979b,null))['catch'](handleError(_0x3c979b,null));};exports[_0x5d53('0x22')]=function(_0x5b8947,_0x42a65a){return db[_0x5d53('0x28')][_0x5d53('0x43')]({'where':{'id':_0x5b8947[_0x5d53('0x46')]['id']}})[_0x5d53('0x21')](handleEntityNotFound(_0x42a65a,null))[_0x5d53('0x21')](removeEntity(_0x42a65a,null))[_0x5d53('0x41')](handleError(_0x42a65a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 29abbc4..fce5c02 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 _0xb62e=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0xb62e,0x1de));var _0xeb62=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xb62e[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var logger=require(_0xeb62('0x2'))(_0xeb62('0x3'));var moment=require('moment');var BPromise=require(_0xeb62('0x4'));var rp=require(_0xeb62('0x5'));var fs=require('fs');var path=require(_0xeb62('0x6'));var rimraf=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var attributes=require(_0xeb62('0x9'));module['exports']=function(_0x3ec879,_0x455e1a){return _0x3ec879[_0xeb62('0xa')]('ZendeskField',attributes,{'tableName':_0xeb62('0xb'),'paranoid':![],'indexes':[{'name':_0xeb62('0xc'),'fields':[_0xeb62('0xd'),_0xeb62('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xccde=['lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId'];(function(_0x752005,_0x14dc74){var _0x40629c=function(_0x189e3d){while(--_0x189e3d){_0x752005['push'](_0x752005['shift']());}};_0x40629c(++_0x14dc74);}(_0xccde,0x1e1));var _0xeccd=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0xccde[_0x582274];return _0x8f14d3;};'use strict';var _=require(_0xeccd('0x0'));var util=require('util');var logger=require(_0xeccd('0x1'))('api');var moment=require(_0xeccd('0x2'));var BPromise=require(_0xeccd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xeccd('0x4'));var config=require(_0xeccd('0x5'));var attributes=require(_0xeccd('0x6'));module[_0xeccd('0x7')]=function(_0x323c74,_0x56972a){return _0x323c74[_0xeccd('0x8')](_0xeccd('0x9'),attributes,{'tableName':_0xeccd('0xa'),'paranoid':![],'indexes':[{'name':_0xeccd('0xb'),'fields':['idField',_0xeccd('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 76618ad..ce118db 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 _0x57d7=['request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s'];(function(_0xf51415,_0x183a95){var _0x5bb030=function(_0x60f16){while(--_0x60f16){_0xf51415['push'](_0xf51415['shift']());}};_0x5bb030(++_0x183a95);}(_0x57d7,0x10e));var _0x757d=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x57d7[_0x1460f6];return _0x46ce94;};'use strict';var _=require(_0x757d('0x0'));var util=require('util');var moment=require(_0x757d('0x1'));var BPromise=require(_0x757d('0x2'));var rs=require(_0x757d('0x3'));var fs=require('fs');var Redis=require(_0x757d('0x4'));var db=require(_0x757d('0x5'))['db'];var utils=require(_0x757d('0x6'));var logger=require(_0x757d('0x7'))(_0x757d('0x8'));var config=require('../../config/environment');var jayson=require(_0x757d('0x9'));var client=jayson[_0x757d('0xa')][_0x757d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b0b01,_0x29678c,_0x21cc5e){return new BPromise(function(_0x1eb79e,_0xbf7fa0){return client[_0x757d('0xc')](_0x4b0b01,_0x21cc5e)[_0x757d('0xd')](function(_0x4eaead){logger[_0x757d('0xe')](_0x757d('0xf'),_0x29678c,'request\x20sent');logger[_0x757d('0x10')](_0x757d('0x11'),_0x29678c,_0x757d('0x12'),JSON['stringify'](_0x4eaead));if(_0x4eaead[_0x757d('0x13')]){if(_0x4eaead[_0x757d('0x13')][_0x757d('0x14')]===0x1f4){logger['error'](_0x757d('0xf'),_0x29678c,_0x4eaead[_0x757d('0x13')][_0x757d('0x15')]);return _0xbf7fa0(_0x4eaead[_0x757d('0x13')][_0x757d('0x15')]);}logger[_0x757d('0x13')](_0x757d('0xf'),_0x29678c,_0x4eaead['error']['message']);return _0x1eb79e(_0x4eaead['error'][_0x757d('0x15')]);}else{logger[_0x757d('0xe')]('ZendeskField,\x20%s,\x20%s',_0x29678c,'request\x20sent');_0x1eb79e(_0x4eaead[_0x757d('0x16')][_0x757d('0x15')]);}})[_0x757d('0x17')](function(_0xd999b){logger[_0x757d('0x13')](_0x757d('0xf'),_0x29678c,_0xd999b);_0xbf7fa0(_0xd999b);});});} \ No newline at end of file +var _0xd88d=['info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request'];(function(_0x58368a,_0x5dd9e0){var _0x400f31=function(_0x339469){while(--_0x339469){_0x58368a['push'](_0x58368a['shift']());}};_0x400f31(++_0x5dd9e0);}(_0xd88d,0x113));var _0xdd88=function(_0x10b61a,_0x218f4c){_0x10b61a=_0x10b61a-0x0;var _0x2a95e8=_0xd88d[_0x10b61a];return _0x2a95e8;};'use strict';var _=require('lodash');var util=require(_0xdd88('0x0'));var moment=require('moment');var BPromise=require(_0xdd88('0x1'));var rs=require(_0xdd88('0x2'));var fs=require('fs');var Redis=require(_0xdd88('0x3'));var db=require(_0xdd88('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd88('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdd88('0x6'));var client=jayson[_0xdd88('0x7')][_0xdd88('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xaf3d4a,_0x35101e,_0x2ce3d6){return new BPromise(function(_0x3726ee,_0x56c4d3){return client[_0xdd88('0x9')](_0xaf3d4a,_0x2ce3d6)['then'](function(_0x5f1460){logger[_0xdd88('0xa')](_0xdd88('0xb'),_0x35101e,'request\x20sent');logger[_0xdd88('0xc')](_0xdd88('0xd'),_0x35101e,_0xdd88('0xe'),JSON[_0xdd88('0xf')](_0x5f1460));if(_0x5f1460['error']){if(_0x5f1460[_0xdd88('0x10')]['code']===0x1f4){logger[_0xdd88('0x10')](_0xdd88('0xb'),_0x35101e,_0x5f1460[_0xdd88('0x10')]['message']);return _0x56c4d3(_0x5f1460[_0xdd88('0x10')][_0xdd88('0x11')]);}logger[_0xdd88('0x10')]('ZendeskField,\x20%s,\x20%s',_0x35101e,_0x5f1460[_0xdd88('0x10')][_0xdd88('0x11')]);return _0x3726ee(_0x5f1460['error'][_0xdd88('0x11')]);}else{logger[_0xdd88('0xa')](_0xdd88('0xb'),_0x35101e,'request\x20sent');_0x3726ee(_0x5f1460['result']['message']);}})[_0xdd88('0x12')](function(_0x3c8168){logger[_0xdd88('0x10')](_0xdd88('0xb'),_0x35101e,_0x3c8168);_0x56c4d3(_0x3c8168);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 98facbc..f221c0c 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 _0x20b9=['../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','destroy','exports','multer','path','Router'];(function(_0x57ef3b,_0xda18bc){var _0x164722=function(_0x4b66b7){while(--_0x4b66b7){_0x57ef3b['push'](_0x57ef3b['shift']());}};_0x164722(++_0xda18bc);}(_0x20b9,0x1dd));var _0x920b=function(_0x231b94,_0x15d73e){_0x231b94=_0x231b94-0x0;var _0x26f55d=_0x20b9[_0x231b94];return _0x26f55d;};'use strict';var multer=require(_0x920b('0x0'));var util=require('util');var path=require(_0x920b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x920b('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x920b('0x3'));var config=require(_0x920b('0x4'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0x920b('0x5')](),controller['index']);router[_0x920b('0x6')](_0x920b('0x7'),auth['isAuthenticated'](),controller[_0x920b('0x8')]);router[_0x920b('0x6')](_0x920b('0x9'),auth[_0x920b('0x5')](),controller[_0x920b('0xa')]);router[_0x920b('0x6')](_0x920b('0xb'),auth['isAuthenticated'](),controller[_0x920b('0xc')]);router['post']('/',auth[_0x920b('0x5')](),controller[_0x920b('0xd')]);router[_0x920b('0xe')](_0x920b('0x9'),auth[_0x920b('0x5')](),controller[_0x920b('0xf')]);router[_0x920b('0x10')](_0x920b('0x7'),auth[_0x920b('0x5')](),controller['update']);router[_0x920b('0x11')](_0x920b('0x7'),auth[_0x920b('0x5')](),controller[_0x920b('0x12')]);module[_0x920b('0x13')]=router; \ No newline at end of file +var _0x53f2=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','index','get','/:id','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x365763,_0x556437){var _0x50184f=function(_0x4871cd){while(--_0x4871cd){_0x365763['push'](_0x365763['shift']());}};_0x50184f(++_0x556437);}(_0x53f2,0x1e0));var _0x253f=function(_0x15b84e,_0x43fe33){_0x15b84e=_0x15b84e-0x0;var _0x42c56b=_0x53f2[_0x15b84e];return _0x42c56b;};'use strict';var multer=require(_0x253f('0x0'));var util=require('util');var path=require(_0x253f('0x1'));var timeout=require(_0x253f('0x2'));var express=require('express');var router=express[_0x253f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x253f('0x4'));var config=require(_0x253f('0x5'));var controller=require(_0x253f('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x253f('0x7')]);router[_0x253f('0x8')](_0x253f('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x253f('0x8')](_0x253f('0xa'),auth[_0x253f('0xb')](),controller[_0x253f('0xc')]);router[_0x253f('0x8')](_0x253f('0xd'),auth[_0x253f('0xb')](),controller[_0x253f('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x253f('0xf')]);router[_0x253f('0x10')](_0x253f('0xa'),auth[_0x253f('0xb')](),controller[_0x253f('0x11')]);router[_0x253f('0x12')]('/:id',auth[_0x253f('0xb')](),controller[_0x253f('0x13')]);router['delete'](_0x253f('0x9'),auth[_0x253f('0xb')](),controller[_0x253f('0x14')]);module[_0x253f('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 135b195..fb681a3 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 _0xacf2=['STRING','exports'];(function(_0x34e2c3,_0x25f042){var _0x5edb4f=function(_0x20fa3e){while(--_0x20fa3e){_0x34e2c3['push'](_0x34e2c3['shift']());}};_0x5edb4f(++_0x25f042);}(_0xacf2,0x1bf));var _0x2acf=function(_0x39e9f4,_0x7da7be){_0x39e9f4=_0x39e9f4-0x0;var _0x16b495=_0xacf2[_0x39e9f4];return _0x16b495;};'use strict';var Sequelize=require('sequelize');module[_0x2acf('0x0')]={'name':{'type':Sequelize[_0x2acf('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x2acf('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2acf('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x2acf('0x1')]},'code':{'type':Sequelize[_0x2acf('0x1')]},'refreshToken':{'type':Sequelize[_0x2acf('0x1')]}}; \ No newline at end of file +var _0x234c=['STRING','exports'];(function(_0x14e6b1,_0x2a1806){var _0x3b709b=function(_0x1f9c13){while(--_0x1f9c13){_0x14e6b1['push'](_0x14e6b1['shift']());}};_0x3b709b(++_0x2a1806);}(_0x234c,0xeb));var _0xc234=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x234c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc234('0x0')]={'name':{'type':Sequelize[_0xc234('0x1')]},'description':{'type':Sequelize[_0xc234('0x1')]},'host':{'type':Sequelize[_0xc234('0x1')]},'zone':{'type':Sequelize[_0xc234('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xc234('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xc234('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index dd0a759..d767b60 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 _0x6657=['AccountId','Subjects','getSubjects','getDescriptions','channel','ZohoConfiguration','ZohoField','Descriptions','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','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','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','destroy','end','stack','name','send','index','map','ZohoAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','limit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','find','create','body','getConfigurations','findOne','pick','hasOwnProperty','nolimit','addConfiguration'];(function(_0x12dc7f,_0x4ab039){var _0x23b396=function(_0x3e6e94){while(--_0x3e6e94){_0x12dc7f['push'](_0x12dc7f['shift']());}};_0x23b396(++_0x4ab039);}(_0x6657,0x152));var _0x7665=function(_0x50c9af,_0x414a5b){_0x50c9af=_0x50c9af-0x0;var _0x3c82c2=_0x6657[_0x50c9af];return _0x3c82c2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7665('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7665('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7665('0x2'));var BPromise=require(_0x7665('0x3'));var Mustache=require(_0x7665('0x4'));var util=require(_0x7665('0x5'));var path=require(_0x7665('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7665('0x7'));var fs=require('fs');var _=require(_0x7665('0x8'));var squel=require(_0x7665('0x9'));var crypto=require(_0x7665('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7665('0xb'));var toCsv=require(_0x7665('0xc'));var querystring=require(_0x7665('0xd'));var Papa=require(_0x7665('0xe'));var Redis=require(_0x7665('0xf'));var authService=require(_0x7665('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7665('0x11'));var logger=require(_0x7665('0x12'))('api');var utils=require(_0x7665('0x13'));var config=require(_0x7665('0x14'));var db=require(_0x7665('0x15'))['db'];var integrations=require(_0x7665('0x16'));var jayson=require(_0x7665('0x17'));var client=jayson[_0x7665('0x18')][_0x7665('0x19')]({'port':0x232a});function checkPasswordPattern(_0x362ce9,_0x3d019,_0x5cf406){if(_0x5cf406){var _0x4e31bc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4e31bc[_0x7665('0x1a')](_0x3d019)){return _0x362ce9;}else{throw new db[(_0x7665('0x1b'))]['ValidationError'](_0x7665('0x1c'));}}else{return _0x362ce9;}}function respondWithRpcPromise(_0x3111f0,_0x187520,_0x205170,_0x2bdfbc){return new BPromise(function(_0x48a8e7,_0xc69288){var _0x4943ec=_0x2bdfbc||client;return _0x4943ec[_0x7665('0x1d')](_0x3111f0,_0x205170)[_0x7665('0x1e')](function(_0x5c186a){logger[_0x7665('0x1f')](_0x7665('0x20'),_0x187520,'request\x20sent');logger[_0x7665('0x21')](_0x7665('0x22'),_0x187520,_0x7665('0x23'),JSON[_0x7665('0x24')](_0x5c186a));if(_0x5c186a[_0x7665('0x25')]){if(_0x5c186a[_0x7665('0x25')]['code']===0x1f4){logger[_0x7665('0x25')](_0x7665('0x20'),_0x187520,_0x5c186a[_0x7665('0x25')][_0x7665('0x26')]);return _0xc69288(_0x5c186a[_0x7665('0x25')][_0x7665('0x26')]);}logger[_0x7665('0x25')](_0x7665('0x20'),_0x187520,_0x5c186a['error'][_0x7665('0x26')]);return _0x48a8e7(_0x5c186a['error'][_0x7665('0x26')]);}else{logger[_0x7665('0x1f')](_0x7665('0x20'),_0x187520,_0x7665('0x23'));_0x48a8e7(_0x5c186a[_0x7665('0x27')][_0x7665('0x26')]);}})[_0x7665('0x28')](function(_0x5ac275){logger[_0x7665('0x25')](_0x7665('0x20'),_0x187520,_0x5ac275);_0xc69288(_0x5ac275);});});}function respondWithStatusCode(_0x15d0ba,_0x283de3){_0x283de3=_0x283de3||0xcc;return function(_0x534eb3){if(_0x534eb3){return _0x15d0ba[_0x7665('0x29')](_0x283de3);}return _0x15d0ba[_0x7665('0x2a')](_0x283de3)['end']();};}function respondWithResult(_0x4a4bf3,_0x3db534){_0x3db534=_0x3db534||0xc8;return function(_0x4be3a0){if(_0x4be3a0){return _0x4a4bf3['status'](_0x3db534)[_0x7665('0x2b')](_0x4be3a0);}};}function respondWithFilteredResult(_0x4c2eb6,_0x218cad){return function(_0x525674){if(_0x525674){var _0x28cad9=_0x525674[_0x7665('0x2c')],_0x55b396=_0x218cad['offset'],_0x507a98=_0x218cad[_0x7665('0x2d')]+_0x218cad['limit'],_0x419df7;if(_0x507a98>=_0x28cad9){_0x507a98=_0x28cad9;_0x419df7=0xc8;}else{_0x419df7=0xce;}_0x4c2eb6['status'](_0x419df7);return _0x4c2eb6[_0x7665('0x2e')](_0x7665('0x2f'),_0x55b396+'-'+_0x507a98+'/'+_0x28cad9)[_0x7665('0x2b')](_0x525674);}return null;};}function patchUpdates(_0x4c2680){return function(_0x148d6a){try{jsonpatch['apply'](_0x148d6a,_0x4c2680,!![]);}catch(_0x6fa162){return BPromise[_0x7665('0x30')](_0x6fa162);}return _0x148d6a[_0x7665('0x31')]();};}function saveUpdates(_0x324235,_0x341ea3){return function(_0x144271){if(_0x144271){return _0x144271[_0x7665('0x32')](_0x324235)[_0x7665('0x1e')](function(_0x56c5ba){return _0x56c5ba;});}return null;};}function removeEntity(_0x2fc5ae,_0x322bd6){return function(_0x5066b8){if(_0x5066b8){return _0x5066b8[_0x7665('0x33')]()[_0x7665('0x1e')](function(){_0x2fc5ae['status'](0xcc)[_0x7665('0x34')]();});}};}function handleEntityNotFound(_0x4c5bf1,_0x3e95f5){return function(_0x19c214){if(!_0x19c214){_0x4c5bf1[_0x7665('0x29')](0x194);}return _0x19c214;};}function handleError(_0x58e400,_0x5c2376){_0x5c2376=_0x5c2376||0x1f4;return function(_0xd25836){logger[_0x7665('0x25')](_0xd25836[_0x7665('0x35')]);if(_0xd25836[_0x7665('0x36')]){delete _0xd25836[_0x7665('0x36')];}_0x58e400[_0x7665('0x2a')](_0x5c2376)[_0x7665('0x37')](_0xd25836);};}exports[_0x7665('0x38')]=function(_0x1f9253,_0x4de72b){var _0x2f87ad={},_0x18b937={},_0x2d6f3d={'count':0x0,'rows':[]};var _0x3633e4=_[_0x7665('0x39')](db[_0x7665('0x3a')]['rawAttributes'],function(_0xb7a459){return{'name':_0xb7a459[_0x7665('0x3b')],'type':_0xb7a459[_0x7665('0x3c')][_0x7665('0x3d')]};});_0x18b937[_0x7665('0x3e')]=_['map'](_0x3633e4,_0x7665('0x36'));_0x18b937[_0x7665('0x3f')]=_[_0x7665('0x40')](_0x1f9253[_0x7665('0x3f')]);_0x18b937[_0x7665('0x41')]=_[_0x7665('0x42')](_0x18b937[_0x7665('0x3e')],_0x18b937[_0x7665('0x3f')]);_0x2f87ad[_0x7665('0x43')]=_[_0x7665('0x42')](_0x18b937[_0x7665('0x3e')],qs['fields'](_0x1f9253[_0x7665('0x3f')]['fields']));_0x2f87ad[_0x7665('0x43')]=_0x2f87ad[_0x7665('0x43')][_0x7665('0x44')]?_0x2f87ad[_0x7665('0x43')]:_0x18b937['model'];if(!_0x1f9253[_0x7665('0x3f')]['hasOwnProperty']('nolimit')){_0x2f87ad[_0x7665('0x45')]=qs[_0x7665('0x45')](_0x1f9253['query'][_0x7665('0x45')]);_0x2f87ad[_0x7665('0x2d')]=qs['offset'](_0x1f9253[_0x7665('0x3f')][_0x7665('0x2d')]);}_0x2f87ad[_0x7665('0x46')]=qs[_0x7665('0x47')](_0x1f9253[_0x7665('0x3f')][_0x7665('0x47')]);_0x2f87ad['where']=qs['filters'](_['pick'](_0x1f9253['query'],_0x18b937[_0x7665('0x41')]),_0x3633e4);if(_0x1f9253[_0x7665('0x3f')][_0x7665('0x48')]){_0x2f87ad['where']=_[_0x7665('0x49')](_0x2f87ad[_0x7665('0x4a')],{'$or':_['map'](_0x3633e4,function(_0x32f506){if(_0x32f506[_0x7665('0x3c')]!==_0x7665('0x4b')){var _0x4dd3c9={};_0x4dd3c9[_0x32f506[_0x7665('0x36')]]={'$like':'%'+_0x1f9253[_0x7665('0x3f')]['filter']+'%'};return _0x4dd3c9;}})});}_0x2f87ad=_[_0x7665('0x49')]({},_0x2f87ad,_0x1f9253[_0x7665('0x4c')]);var _0x1eac1e={'where':_0x2f87ad[_0x7665('0x4a')]};return db['ZohoAccount'][_0x7665('0x2c')](_0x1eac1e)[_0x7665('0x1e')](function(_0x320162){_0x2d6f3d[_0x7665('0x2c')]=_0x320162;if(_0x1f9253['query'][_0x7665('0x4d')]){_0x2f87ad[_0x7665('0x4e')]=[{'all':!![]}];}return db[_0x7665('0x3a')][_0x7665('0x4f')](_0x2f87ad);})[_0x7665('0x1e')](function(_0x4040e3){_0x2d6f3d[_0x7665('0x50')]=_0x4040e3;return _0x2d6f3d;})[_0x7665('0x1e')](respondWithFilteredResult(_0x4de72b,_0x2f87ad))[_0x7665('0x28')](handleError(_0x4de72b,null));};exports[_0x7665('0x51')]=function(_0x2322ac,_0x3d632c){var _0x245c26={'raw':![],'where':{'id':_0x2322ac[_0x7665('0x52')]['id']}},_0x290da8={};_0x290da8['model']=_[_0x7665('0x40')](db[_0x7665('0x3a')][_0x7665('0x53')]);_0x290da8[_0x7665('0x3f')]=_['keys'](_0x2322ac[_0x7665('0x3f')]);_0x290da8['filters']=_[_0x7665('0x42')](_0x290da8[_0x7665('0x3e')],_0x290da8[_0x7665('0x3f')]);_0x245c26[_0x7665('0x43')]=_[_0x7665('0x42')](_0x290da8[_0x7665('0x3e')],qs[_0x7665('0x54')](_0x2322ac[_0x7665('0x3f')][_0x7665('0x54')]));_0x245c26['attributes']=_0x245c26[_0x7665('0x43')]['length']?_0x245c26[_0x7665('0x43')]:_0x290da8[_0x7665('0x3e')];if(_0x2322ac[_0x7665('0x3f')]['includeAll']){_0x245c26[_0x7665('0x4e')]=[{'all':!![]}];}_0x245c26=_[_0x7665('0x49')]({},_0x245c26,_0x2322ac['options']);return db[_0x7665('0x3a')][_0x7665('0x55')](_0x245c26)[_0x7665('0x1e')](handleEntityNotFound(_0x3d632c,null))['then'](respondWithResult(_0x3d632c,null))[_0x7665('0x28')](handleError(_0x3d632c,null));};exports['create']=function(_0x505976,_0xbc8626){return db[_0x7665('0x3a')][_0x7665('0x56')](_0x505976[_0x7665('0x57')],{})[_0x7665('0x1e')](respondWithResult(_0xbc8626,0xc9))[_0x7665('0x28')](handleError(_0xbc8626,null));};exports['update']=function(_0x5e7357,_0x2c275e){if(_0x5e7357['body']['id']){delete _0x5e7357[_0x7665('0x57')]['id'];}return db[_0x7665('0x3a')]['find']({'where':{'id':_0x5e7357[_0x7665('0x52')]['id']}})[_0x7665('0x1e')](handleEntityNotFound(_0x2c275e,null))[_0x7665('0x1e')](saveUpdates(_0x5e7357['body'],null))[_0x7665('0x1e')](respondWithResult(_0x2c275e,null))[_0x7665('0x28')](handleError(_0x2c275e,null));};exports[_0x7665('0x33')]=function(_0x6974cb,_0x403445){return db[_0x7665('0x3a')][_0x7665('0x55')]({'where':{'id':_0x6974cb[_0x7665('0x52')]['id']}})['then'](handleEntityNotFound(_0x403445,null))[_0x7665('0x1e')](removeEntity(_0x403445,null))['catch'](handleError(_0x403445,null));};exports[_0x7665('0x58')]=function(_0x200377,_0x4bd77c,_0x4f78f6){var _0x5249ca={};var _0x4b9ada={};var _0x195729;var _0x2cacc8;return db[_0x7665('0x3a')][_0x7665('0x59')]({'where':{'id':_0x200377['params']['id']}})[_0x7665('0x1e')](handleEntityNotFound(_0x4bd77c,null))['then'](function(_0x264d68){if(_0x264d68){_0x195729=_0x264d68;_0x4b9ada[_0x7665('0x3e')]=_['keys'](db['ZohoConfiguration'][_0x7665('0x53')]);_0x4b9ada[_0x7665('0x3f')]=_[_0x7665('0x40')](_0x200377['query']);_0x4b9ada[_0x7665('0x41')]=_[_0x7665('0x42')](_0x4b9ada[_0x7665('0x3e')],_0x4b9ada[_0x7665('0x3f')]);_0x5249ca[_0x7665('0x43')]=_[_0x7665('0x42')](_0x4b9ada[_0x7665('0x3e')],qs[_0x7665('0x54')](_0x200377['query']['fields']));_0x5249ca[_0x7665('0x43')]=_0x5249ca[_0x7665('0x43')][_0x7665('0x44')]?_0x5249ca[_0x7665('0x43')]:_0x4b9ada[_0x7665('0x3e')];_0x5249ca['order']=qs['sort'](_0x200377[_0x7665('0x3f')][_0x7665('0x47')]);_0x5249ca[_0x7665('0x4a')]=qs[_0x7665('0x41')](_[_0x7665('0x5a')](_0x200377['query'],_0x4b9ada[_0x7665('0x41')]));if(_0x200377[_0x7665('0x3f')][_0x7665('0x48')]){_0x5249ca[_0x7665('0x4a')]=_[_0x7665('0x49')](_0x5249ca[_0x7665('0x4a')],{'$or':_['map'](_0x5249ca[_0x7665('0x43')],function(_0x5bcf89){var _0x19a968={};_0x19a968[_0x5bcf89]={'$like':'%'+_0x200377[_0x7665('0x3f')][_0x7665('0x48')]+'%'};return _0x19a968;})});}_0x5249ca=_[_0x7665('0x49')]({},_0x5249ca,_0x200377[_0x7665('0x4c')]);return _0x195729[_0x7665('0x58')](_0x5249ca);}})[_0x7665('0x1e')](function(_0x263c88){if(_0x263c88){_0x2cacc8=_0x263c88[_0x7665('0x44')];if(!_0x200377[_0x7665('0x3f')][_0x7665('0x5b')](_0x7665('0x5c'))){_0x5249ca['limit']=qs[_0x7665('0x45')](_0x200377[_0x7665('0x3f')]['limit']);_0x5249ca[_0x7665('0x2d')]=qs[_0x7665('0x2d')](_0x200377[_0x7665('0x3f')][_0x7665('0x2d')]);}return _0x195729[_0x7665('0x58')](_0x5249ca);}})[_0x7665('0x1e')](function(_0x1cc1e3){if(_0x1cc1e3){return _0x1cc1e3?{'count':_0x2cacc8,'rows':_0x1cc1e3}:null;}})[_0x7665('0x1e')](respondWithResult(_0x4bd77c,null))[_0x7665('0x28')](handleError(_0x4bd77c,null));};exports[_0x7665('0x5d')]=function(_0x488fa0,_0x4e09b4,_0x2c7d28){if(_0x488fa0['body']['id']){delete _0x488fa0[_0x7665('0x57')]['id'];}return db[_0x7665('0x3a')][_0x7665('0x59')]({'where':{'id':_0x488fa0['params']['id']}})[_0x7665('0x1e')](handleEntityNotFound(_0x4e09b4,null))['then'](function(_0x5c58b5){if(_0x5c58b5){_0x488fa0[_0x7665('0x57')][_0x7665('0x5e')]=_0x5c58b5['id'];_0x488fa0[_0x7665('0x57')][_0x7665('0x5f')]=integrations[_0x7665('0x60')](_0x488fa0['body']['channel'],_0x488fa0['body'][_0x7665('0x3c')]);_0x488fa0[_0x7665('0x57')]['Descriptions']=integrations[_0x7665('0x61')](_0x488fa0[_0x7665('0x57')][_0x7665('0x62')],_0x488fa0[_0x7665('0x57')][_0x7665('0x3c')]);return db[_0x7665('0x63')]['create'](_0x488fa0[_0x7665('0x57')],{'include':[{'model':db[_0x7665('0x64')],'as':_0x7665('0x5f')},{'model':db['ZohoField'],'as':_0x7665('0x65')}]});}return null;})[_0x7665('0x1e')](respondWithResult(_0x4e09b4,null))[_0x7665('0x28')](handleError(_0x4e09b4,null));};function getAccessToken(_0x4ac22e){return new Promise(function(_0xe71140,_0x267e80){var _0x31fd93;switch(_0x4ac22e['zone']){case'US':_0x31fd93=_0x7665('0x66');break;case'AU':_0x31fd93=_0x7665('0x67');break;case'EU':_0x31fd93='https://accounts.zoho.eu';break;case'IN':_0x31fd93='https://accounts.zoho.in';break;case'CN':_0x31fd93=_0x7665('0x68');break;default:_0x31fd93=_0x7665('0x69');break;}var _0x4f8eda={'method':_0x7665('0x6a'),'uri':_0x31fd93+_0x7665('0x6b'),'qs':{'refresh_token':_0x4ac22e[_0x7665('0x6c')],'client_id':_0x4ac22e[_0x7665('0x6d')],'client_secret':_0x4ac22e[_0x7665('0x6e')],'grant_type':_0x7665('0x6f')},'json':!![]};return rp(_0x4f8eda)[_0x7665('0x1e')](function(_0x4007e9){if(_0x4007e9[_0x7665('0x70')]){_0xe71140(_0x4007e9[_0x7665('0x70')]);}else{_0x267e80(_0x7665('0x71'));}})[_0x7665('0x28')](function(_0x1a1a7d){_0x267e80(_0x1a1a7d);});});}exports['getFields']=function(_0x409a1c,_0x138cec,_0x53c3cd){var _0x1d47b8,_0x566995,_0x57cecc,_0x53978e,_0x8790f5;return db[_0x7665('0x3a')][_0x7665('0x59')]({'where':{'id':_0x409a1c['params']['id']},'attributes':['id','host','zone','clientId',_0x7665('0x6e'),_0x7665('0x72'),'code',_0x7665('0x6c')]})[_0x7665('0x1e')](handleEntityNotFound(_0x138cec,null))[_0x7665('0x1e')](function(_0x5df167){_0x8790f5=_0x5df167;_0x1d47b8=_0x8790f5['host'];_0x566995=_0x1d47b8===_0x7665('0x73')?'eu':_0x7665('0x74');_0x57cecc=_0x8790f5[_0x7665('0x72')];var _0x21473d=_0x57cecc[_0x7665('0x75')](-0x1);if(_0x21473d==='/'||_0x21473d==='\x5c'||_0x21473d===':'){_0x57cecc=_0x57cecc[_0x7665('0x76')](0x0,_0x57cecc[_0x7665('0x77')](_0x21473d));}if(!_0x8790f5['refreshToken']){throw new Error(_0x7665('0x78'));}return getAccessToken(_0x8790f5);})[_0x7665('0x1e')](function(_0x96acd1){if(_0x96acd1){return rp({'method':_0x7665('0x79'),'uri':util[_0x7665('0x7a')](_0x7665('0x7b'),_0x566995),'qs':{'module':_0x7665('0x7c')},'headers':{'Authorization':_0x7665('0x7d')+_0x96acd1},'json':!![]});}})['then'](function(_0x3cb53d){if(_0x3cb53d){if(_0x3cb53d[_0x7665('0x7e')]&&_0x3cb53d[_0x7665('0x7e')]['error']){throw new Error(_0x3cb53d[_0x7665('0x7e')][_0x7665('0x25')][_0x7665('0x26')]);}var _0x5b807b=[];var _0x20ea5b=[];var _0x426e4e=['Owner',_0x7665('0x7f'),'Description',_0x7665('0x80'),_0x7665('0x81'),_0x7665('0x82'),'Call_Start_Time',_0x7665('0x83')];_0x20ea5b=_[_0x7665('0x84')](_0x3cb53d[_0x7665('0x54')],function(_0x227200){return _0x426e4e[_0x7665('0x85')](_0x227200['api_name']);});for(var _0x14b553=0x0;_0x14b553<_0x20ea5b[_0x7665('0x44')];_0x14b553++){if(_0x20ea5b[_0x14b553][_0x7665('0x86')]===![]){_0x5b807b[_0x7665('0x87')]({'id':_0x20ea5b[_0x14b553]['id'],'name':_0x20ea5b[_0x14b553]['display_label'],'custom':_0x20ea5b[_0x14b553][_0x7665('0x88')],'options':_0x20ea5b[_0x14b553][_0x7665('0x89')]===_0x7665('0x8a')&&_0x20ea5b[_0x14b553][_0x7665('0x8b')][_0x7665('0x44')]>-0x1?_[_0x7665('0x39')](_0x20ea5b[_0x14b553][_0x7665('0x8b')],function(_0x8d5344){return{'name':_0x8d5344,'value':_0x8d5344};}):[]});}}return{'count':_0x5b807b[_0x7665('0x44')],'rows':_0x5b807b};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x138cec,null))[_0x7665('0x28')](function(_0x4f500e){var _0x39aa24=_0x409a1c[_0x7665('0x3f')][_0x7665('0x1a')]?0x1f4:_0x4f500e[_0x7665('0x8c')]||0x1f4;logger['error'](_0x7665('0x8d'),_0x7665('0x8e'),_0x39aa24,JSON[_0x7665('0x24')](_0x4f500e));delete _0x4f500e['name'];if(_0x39aa24===0x191){_0x39aa24=0x190;}_0x138cec[_0x7665('0x2a')](_0x39aa24)[_0x7665('0x37')](_0x409a1c[_0x7665('0x3f')][_0x7665('0x1a')]?{'message':_0x7665('0x8f'),'statusCode':_0x4f500e[_0x7665('0x8c')]}:_0x4f500e);});}; \ No newline at end of file +var _0x38af=['util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','status','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','merge','where','VIRTUAL','include','findAll','show','params','includeAll','options','create','body','find','getConfigurations','ZohoConfiguration','findOne','AccountId','Subjects','getSubjects','getDescriptions','channel','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','com','slice','substring','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','includes','api_name','system_mandatory','push','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x5528c3,_0x35a416){var _0x47ec1b=function(_0x54a18e){while(--_0x54a18e){_0x5528c3['push'](_0x5528c3['shift']());}};_0x47ec1b(++_0x35a416);}(_0x38af,0x111));var _0xf38a=function(_0x38815c,_0x3fdeed){_0x38815c=_0x38815c-0x0;var _0x15cf2e=_0x38af[_0x38815c];return _0x15cf2e;};'use strict';var pdf=require(_0xf38a('0x0'));var emlformat=require(_0xf38a('0x1'));var rimraf=require(_0xf38a('0x2'));var zipdir=require(_0xf38a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf38a('0x4'));var moment=require(_0xf38a('0x5'));var BPromise=require(_0xf38a('0x6'));var Mustache=require('mustache');var util=require(_0xf38a('0x7'));var path=require(_0xf38a('0x8'));var sox=require('sox');var csv=require(_0xf38a('0x9'));var ejs=require(_0xf38a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf38a('0xb'));var crypto=require(_0xf38a('0xc'));var jsforce=require(_0xf38a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf38a('0x9'));var querystring=require(_0xf38a('0xe'));var Papa=require(_0xf38a('0xf'));var Redis=require(_0xf38a('0x10'));var authService=require(_0xf38a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf38a('0x12'));var hardwareService=require(_0xf38a('0x13'));var logger=require('../../config/logger')(_0xf38a('0x14'));var utils=require(_0xf38a('0x15'));var config=require(_0xf38a('0x16'));var db=require(_0xf38a('0x17'))['db'];var integrations=require(_0xf38a('0x18'));var jayson=require(_0xf38a('0x19'));var client=jayson[_0xf38a('0x1a')][_0xf38a('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x4633eb,_0x3680e9,_0x30c886){if(_0x30c886){var _0x4b1a07=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b1a07[_0xf38a('0x1c')](_0x3680e9)){return _0x4633eb;}else{throw new db[(_0xf38a('0x1d'))][(_0xf38a('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 _0x4633eb;}}function respondWithRpcPromise(_0x3bbfa3,_0x4119cd,_0x5b0365,_0x51571b){return new BPromise(function(_0x2e36d5,_0x4dc5f7){var _0x5268e8=_0x51571b||client;return _0x5268e8[_0xf38a('0x1f')](_0x3bbfa3,_0x5b0365)['then'](function(_0x3eab79){logger[_0xf38a('0x20')](_0xf38a('0x21'),_0x4119cd,_0xf38a('0x22'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x4119cd,_0xf38a('0x22'),JSON[_0xf38a('0x23')](_0x3eab79));if(_0x3eab79['error']){if(_0x3eab79[_0xf38a('0x24')][_0xf38a('0x25')]===0x1f4){logger[_0xf38a('0x24')](_0xf38a('0x21'),_0x4119cd,_0x3eab79[_0xf38a('0x24')][_0xf38a('0x26')]);return _0x4dc5f7(_0x3eab79[_0xf38a('0x24')][_0xf38a('0x26')]);}logger[_0xf38a('0x24')](_0xf38a('0x21'),_0x4119cd,_0x3eab79[_0xf38a('0x24')]['message']);return _0x2e36d5(_0x3eab79[_0xf38a('0x24')]['message']);}else{logger[_0xf38a('0x20')](_0xf38a('0x21'),_0x4119cd,_0xf38a('0x22'));_0x2e36d5(_0x3eab79[_0xf38a('0x27')][_0xf38a('0x26')]);}})[_0xf38a('0x28')](function(_0x3da8d2){logger[_0xf38a('0x24')]('ZohoAccount,\x20%s,\x20%s',_0x4119cd,_0x3da8d2);_0x4dc5f7(_0x3da8d2);});});}function respondWithStatusCode(_0xac70f2,_0x3806f9){_0x3806f9=_0x3806f9||0xcc;return function(_0x2ba487){if(_0x2ba487){return _0xac70f2[_0xf38a('0x29')](_0x3806f9);}return _0xac70f2['status'](_0x3806f9)[_0xf38a('0x2a')]();};}function respondWithResult(_0x177634,_0x44b5d4){_0x44b5d4=_0x44b5d4||0xc8;return function(_0x16d14f){if(_0x16d14f){return _0x177634['status'](_0x44b5d4)[_0xf38a('0x2b')](_0x16d14f);}};}function respondWithFilteredResult(_0x180c97,_0x1c2712){return function(_0x54eeb2){if(_0x54eeb2){var _0x326338=_0x54eeb2[_0xf38a('0x2c')],_0x2cfa40=_0x1c2712[_0xf38a('0x2d')],_0x393448=_0x1c2712['offset']+_0x1c2712['limit'],_0x10f634;if(_0x393448>=_0x326338){_0x393448=_0x326338;_0x10f634=0xc8;}else{_0x10f634=0xce;}_0x180c97[_0xf38a('0x2e')](_0x10f634);return _0x180c97[_0xf38a('0x2f')](_0xf38a('0x30'),_0x2cfa40+'-'+_0x393448+'/'+_0x326338)['json'](_0x54eeb2);}return null;};}function patchUpdates(_0x383d13){return function(_0x5aef98){try{jsonpatch[_0xf38a('0x31')](_0x5aef98,_0x383d13,!![]);}catch(_0x2a40b8){return BPromise['reject'](_0x2a40b8);}return _0x5aef98[_0xf38a('0x32')]();};}function saveUpdates(_0x1e6b32,_0x5cee71){return function(_0x27e872){if(_0x27e872){return _0x27e872[_0xf38a('0x33')](_0x1e6b32)[_0xf38a('0x34')](function(_0x3c24cf){return _0x3c24cf;});}return null;};}function removeEntity(_0x1a2563,_0x2473d7){return function(_0xf5ead7){if(_0xf5ead7){return _0xf5ead7[_0xf38a('0x35')]()[_0xf38a('0x34')](function(){_0x1a2563[_0xf38a('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d725,_0x57b42b){return function(_0x37917c){if(!_0x37917c){_0x45d725[_0xf38a('0x29')](0x194);}return _0x37917c;};}function handleError(_0x48bd67,_0x4af47d){_0x4af47d=_0x4af47d||0x1f4;return function(_0x3a59d0){logger['error'](_0x3a59d0[_0xf38a('0x36')]);if(_0x3a59d0[_0xf38a('0x37')]){delete _0x3a59d0[_0xf38a('0x37')];}_0x48bd67[_0xf38a('0x2e')](_0x4af47d)['send'](_0x3a59d0);};}exports[_0xf38a('0x38')]=function(_0x4dad2a,_0x2641c4){var _0xe6cae0={},_0x5da4d3={},_0x1759fe={'count':0x0,'rows':[]};var _0x5c67b7=_[_0xf38a('0x39')](db[_0xf38a('0x3a')][_0xf38a('0x3b')],function(_0x5851dd){return{'name':_0x5851dd[_0xf38a('0x3c')],'type':_0x5851dd[_0xf38a('0x3d')][_0xf38a('0x3e')]};});_0x5da4d3[_0xf38a('0x3f')]=_[_0xf38a('0x39')](_0x5c67b7,'name');_0x5da4d3['query']=_[_0xf38a('0x40')](_0x4dad2a[_0xf38a('0x41')]);_0x5da4d3[_0xf38a('0x42')]=_[_0xf38a('0x43')](_0x5da4d3[_0xf38a('0x3f')],_0x5da4d3[_0xf38a('0x41')]);_0xe6cae0[_0xf38a('0x44')]=_['intersection'](_0x5da4d3['model'],qs[_0xf38a('0x45')](_0x4dad2a['query']['fields']));_0xe6cae0[_0xf38a('0x44')]=_0xe6cae0[_0xf38a('0x44')][_0xf38a('0x46')]?_0xe6cae0['attributes']:_0x5da4d3[_0xf38a('0x3f')];if(!_0x4dad2a[_0xf38a('0x41')][_0xf38a('0x47')]('nolimit')){_0xe6cae0[_0xf38a('0x48')]=qs[_0xf38a('0x48')](_0x4dad2a[_0xf38a('0x41')]['limit']);_0xe6cae0[_0xf38a('0x2d')]=qs[_0xf38a('0x2d')](_0x4dad2a[_0xf38a('0x41')][_0xf38a('0x2d')]);}_0xe6cae0[_0xf38a('0x49')]=qs[_0xf38a('0x4a')](_0x4dad2a[_0xf38a('0x41')][_0xf38a('0x4a')]);_0xe6cae0['where']=qs[_0xf38a('0x42')](_[_0xf38a('0x4b')](_0x4dad2a['query'],_0x5da4d3[_0xf38a('0x42')]),_0x5c67b7);if(_0x4dad2a[_0xf38a('0x41')][_0xf38a('0x4c')]){_0xe6cae0['where']=_[_0xf38a('0x4d')](_0xe6cae0[_0xf38a('0x4e')],{'$or':_[_0xf38a('0x39')](_0x5c67b7,function(_0x5e0916){if(_0x5e0916['type']!==_0xf38a('0x4f')){var _0x2eec47={};_0x2eec47[_0x5e0916[_0xf38a('0x37')]]={'$like':'%'+_0x4dad2a[_0xf38a('0x41')][_0xf38a('0x4c')]+'%'};return _0x2eec47;}})});}_0xe6cae0=_[_0xf38a('0x4d')]({},_0xe6cae0,_0x4dad2a['options']);var _0x2a5743={'where':_0xe6cae0[_0xf38a('0x4e')]};return db[_0xf38a('0x3a')][_0xf38a('0x2c')](_0x2a5743)['then'](function(_0x1c0854){_0x1759fe[_0xf38a('0x2c')]=_0x1c0854;if(_0x4dad2a[_0xf38a('0x41')]['includeAll']){_0xe6cae0[_0xf38a('0x50')]=[{'all':!![]}];}return db[_0xf38a('0x3a')][_0xf38a('0x51')](_0xe6cae0);})[_0xf38a('0x34')](function(_0xa07dce){_0x1759fe['rows']=_0xa07dce;return _0x1759fe;})[_0xf38a('0x34')](respondWithFilteredResult(_0x2641c4,_0xe6cae0))[_0xf38a('0x28')](handleError(_0x2641c4,null));};exports[_0xf38a('0x52')]=function(_0x261b5f,_0x512451){var _0x2da5d8={'raw':![],'where':{'id':_0x261b5f[_0xf38a('0x53')]['id']}},_0x38ae17={};_0x38ae17[_0xf38a('0x3f')]=_['keys'](db[_0xf38a('0x3a')]['rawAttributes']);_0x38ae17[_0xf38a('0x41')]=_[_0xf38a('0x40')](_0x261b5f[_0xf38a('0x41')]);_0x38ae17[_0xf38a('0x42')]=_['intersection'](_0x38ae17['model'],_0x38ae17[_0xf38a('0x41')]);_0x2da5d8[_0xf38a('0x44')]=_[_0xf38a('0x43')](_0x38ae17[_0xf38a('0x3f')],qs['fields'](_0x261b5f['query'][_0xf38a('0x45')]));_0x2da5d8['attributes']=_0x2da5d8[_0xf38a('0x44')][_0xf38a('0x46')]?_0x2da5d8[_0xf38a('0x44')]:_0x38ae17[_0xf38a('0x3f')];if(_0x261b5f[_0xf38a('0x41')][_0xf38a('0x54')]){_0x2da5d8[_0xf38a('0x50')]=[{'all':!![]}];}_0x2da5d8=_[_0xf38a('0x4d')]({},_0x2da5d8,_0x261b5f[_0xf38a('0x55')]);return db[_0xf38a('0x3a')]['find'](_0x2da5d8)[_0xf38a('0x34')](handleEntityNotFound(_0x512451,null))[_0xf38a('0x34')](respondWithResult(_0x512451,null))[_0xf38a('0x28')](handleError(_0x512451,null));};exports[_0xf38a('0x56')]=function(_0x53001d,_0x4d675e){return db[_0xf38a('0x3a')][_0xf38a('0x56')](_0x53001d[_0xf38a('0x57')],{})[_0xf38a('0x34')](respondWithResult(_0x4d675e,0xc9))[_0xf38a('0x28')](handleError(_0x4d675e,null));};exports[_0xf38a('0x33')]=function(_0x13a082,_0x1c4070){if(_0x13a082['body']['id']){delete _0x13a082[_0xf38a('0x57')]['id'];}return db[_0xf38a('0x3a')][_0xf38a('0x58')]({'where':{'id':_0x13a082[_0xf38a('0x53')]['id']}})[_0xf38a('0x34')](handleEntityNotFound(_0x1c4070,null))[_0xf38a('0x34')](saveUpdates(_0x13a082[_0xf38a('0x57')],null))[_0xf38a('0x34')](respondWithResult(_0x1c4070,null))[_0xf38a('0x28')](handleError(_0x1c4070,null));};exports[_0xf38a('0x35')]=function(_0x4370e8,_0x17686b){return db['ZohoAccount'][_0xf38a('0x58')]({'where':{'id':_0x4370e8[_0xf38a('0x53')]['id']}})[_0xf38a('0x34')](handleEntityNotFound(_0x17686b,null))[_0xf38a('0x34')](removeEntity(_0x17686b,null))[_0xf38a('0x28')](handleError(_0x17686b,null));};exports[_0xf38a('0x59')]=function(_0xa6887f,_0x4de723,_0x16d31c){var _0x34d76c={};var _0x1a09d3={};var _0x340481;var _0x41ac9d;return db['ZohoAccount']['findOne']({'where':{'id':_0xa6887f['params']['id']}})[_0xf38a('0x34')](handleEntityNotFound(_0x4de723,null))[_0xf38a('0x34')](function(_0x56663a){if(_0x56663a){_0x340481=_0x56663a;_0x1a09d3['model']=_[_0xf38a('0x40')](db[_0xf38a('0x5a')][_0xf38a('0x3b')]);_0x1a09d3[_0xf38a('0x41')]=_[_0xf38a('0x40')](_0xa6887f[_0xf38a('0x41')]);_0x1a09d3['filters']=_[_0xf38a('0x43')](_0x1a09d3[_0xf38a('0x3f')],_0x1a09d3[_0xf38a('0x41')]);_0x34d76c[_0xf38a('0x44')]=_[_0xf38a('0x43')](_0x1a09d3[_0xf38a('0x3f')],qs[_0xf38a('0x45')](_0xa6887f[_0xf38a('0x41')][_0xf38a('0x45')]));_0x34d76c['attributes']=_0x34d76c[_0xf38a('0x44')]['length']?_0x34d76c[_0xf38a('0x44')]:_0x1a09d3[_0xf38a('0x3f')];_0x34d76c[_0xf38a('0x49')]=qs[_0xf38a('0x4a')](_0xa6887f['query']['sort']);_0x34d76c[_0xf38a('0x4e')]=qs[_0xf38a('0x42')](_['pick'](_0xa6887f['query'],_0x1a09d3['filters']));if(_0xa6887f[_0xf38a('0x41')][_0xf38a('0x4c')]){_0x34d76c[_0xf38a('0x4e')]=_[_0xf38a('0x4d')](_0x34d76c[_0xf38a('0x4e')],{'$or':_[_0xf38a('0x39')](_0x34d76c[_0xf38a('0x44')],function(_0x3827a){var _0x241752={};_0x241752[_0x3827a]={'$like':'%'+_0xa6887f[_0xf38a('0x41')][_0xf38a('0x4c')]+'%'};return _0x241752;})});}_0x34d76c=_[_0xf38a('0x4d')]({},_0x34d76c,_0xa6887f[_0xf38a('0x55')]);return _0x340481['getConfigurations'](_0x34d76c);}})['then'](function(_0x29d19a){if(_0x29d19a){_0x41ac9d=_0x29d19a['length'];if(!_0xa6887f['query']['hasOwnProperty']('nolimit')){_0x34d76c[_0xf38a('0x48')]=qs['limit'](_0xa6887f['query'][_0xf38a('0x48')]);_0x34d76c[_0xf38a('0x2d')]=qs[_0xf38a('0x2d')](_0xa6887f['query'][_0xf38a('0x2d')]);}return _0x340481[_0xf38a('0x59')](_0x34d76c);}})[_0xf38a('0x34')](function(_0x354ec1){if(_0x354ec1){return _0x354ec1?{'count':_0x41ac9d,'rows':_0x354ec1}:null;}})['then'](respondWithResult(_0x4de723,null))['catch'](handleError(_0x4de723,null));};exports['addConfiguration']=function(_0x5251a6,_0xd13a59,_0x36d142){if(_0x5251a6[_0xf38a('0x57')]['id']){delete _0x5251a6[_0xf38a('0x57')]['id'];}return db['ZohoAccount'][_0xf38a('0x5b')]({'where':{'id':_0x5251a6['params']['id']}})[_0xf38a('0x34')](handleEntityNotFound(_0xd13a59,null))[_0xf38a('0x34')](function(_0x2a23c3){if(_0x2a23c3){_0x5251a6[_0xf38a('0x57')][_0xf38a('0x5c')]=_0x2a23c3['id'];_0x5251a6[_0xf38a('0x57')][_0xf38a('0x5d')]=integrations[_0xf38a('0x5e')](_0x5251a6[_0xf38a('0x57')]['channel'],_0x5251a6[_0xf38a('0x57')][_0xf38a('0x3d')]);_0x5251a6[_0xf38a('0x57')]['Descriptions']=integrations[_0xf38a('0x5f')](_0x5251a6['body'][_0xf38a('0x60')],_0x5251a6['body']['type']);return db[_0xf38a('0x5a')][_0xf38a('0x56')](_0x5251a6[_0xf38a('0x57')],{'include':[{'model':db[_0xf38a('0x61')],'as':_0xf38a('0x5d')},{'model':db[_0xf38a('0x61')],'as':_0xf38a('0x62')}]});}return null;})['then'](respondWithResult(_0xd13a59,null))[_0xf38a('0x28')](handleError(_0xd13a59,null));};function getAccessToken(_0x952ec7){return new Promise(function(_0x380c6e,_0x5ed544){var _0x4f12b0;switch(_0x952ec7[_0xf38a('0x63')]){case'US':_0x4f12b0=_0xf38a('0x64');break;case'AU':_0x4f12b0=_0xf38a('0x65');break;case'EU':_0x4f12b0=_0xf38a('0x66');break;case'IN':_0x4f12b0=_0xf38a('0x67');break;case'CN':_0x4f12b0=_0xf38a('0x68');break;default:_0x4f12b0=_0xf38a('0x66');break;}var _0x19efc8={'method':_0xf38a('0x69'),'uri':_0x4f12b0+_0xf38a('0x6a'),'qs':{'refresh_token':_0x952ec7[_0xf38a('0x6b')],'client_id':_0x952ec7[_0xf38a('0x6c')],'client_secret':_0x952ec7[_0xf38a('0x6d')],'grant_type':_0xf38a('0x6e')},'json':!![]};return rp(_0x19efc8)['then'](function(_0x2f233c){if(_0x2f233c[_0xf38a('0x6f')]){_0x380c6e(_0x2f233c[_0xf38a('0x6f')]);}else{_0x5ed544(_0xf38a('0x70'));}})[_0xf38a('0x28')](function(_0x262ee9){_0x5ed544(_0x262ee9);});});}exports[_0xf38a('0x71')]=function(_0x493fba,_0x1513ef,_0x14ffb4){var _0x30acf0,_0x1b455d,_0x7a7cc6,_0x25dd9f,_0x2421f8;return db['ZohoAccount']['findOne']({'where':{'id':_0x493fba['params']['id']},'attributes':['id',_0xf38a('0x72'),_0xf38a('0x63'),'clientId',_0xf38a('0x6d'),_0xf38a('0x73'),_0xf38a('0x25'),_0xf38a('0x6b')]})[_0xf38a('0x34')](handleEntityNotFound(_0x1513ef,null))[_0xf38a('0x34')](function(_0x535ed1){_0x2421f8=_0x535ed1;_0x30acf0=_0x2421f8[_0xf38a('0x72')];_0x1b455d=_0x30acf0===_0xf38a('0x74')?'eu':_0xf38a('0x75');_0x7a7cc6=_0x2421f8[_0xf38a('0x73')];var _0x3467f5=_0x7a7cc6[_0xf38a('0x76')](-0x1);if(_0x3467f5==='/'||_0x3467f5==='\x5c'||_0x3467f5===':'){_0x7a7cc6=_0x7a7cc6[_0xf38a('0x77')](0x0,_0x7a7cc6['lastIndexOf'](_0x3467f5));}if(!_0x2421f8[_0xf38a('0x6b')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2421f8);})[_0xf38a('0x34')](function(_0x4ba5ee){if(_0x4ba5ee){return rp({'method':_0xf38a('0x78'),'uri':util['format'](_0xf38a('0x79'),_0x1b455d),'qs':{'module':'Calls'},'headers':{'Authorization':_0xf38a('0x7a')+_0x4ba5ee},'json':!![]});}})[_0xf38a('0x34')](function(_0x5e00a7){if(_0x5e00a7){if(_0x5e00a7[_0xf38a('0x7b')]&&_0x5e00a7[_0xf38a('0x7b')][_0xf38a('0x24')]){throw new Error(_0x5e00a7[_0xf38a('0x7b')][_0xf38a('0x24')][_0xf38a('0x26')]);}var _0x46eab7=[];var _0x346642=[];var _0x136241=[_0xf38a('0x7c'),_0xf38a('0x7d'),_0xf38a('0x7e'),_0xf38a('0x7f'),_0xf38a('0x80'),_0xf38a('0x81'),'Call_Start_Time',_0xf38a('0x82')];_0x346642=_['remove'](_0x5e00a7[_0xf38a('0x45')],function(_0x560330){return _0x136241[_0xf38a('0x83')](_0x560330[_0xf38a('0x84')]);});for(var _0x3792a3=0x0;_0x3792a3<_0x346642['length'];_0x3792a3++){if(_0x346642[_0x3792a3][_0xf38a('0x85')]===![]){_0x46eab7[_0xf38a('0x86')]({'id':_0x346642[_0x3792a3]['id'],'name':_0x346642[_0x3792a3]['display_label'],'custom':_0x346642[_0x3792a3]['custom_field'],'options':_0x346642[_0x3792a3][_0xf38a('0x87')]==='picklist'&&_0x346642[_0x3792a3][_0xf38a('0x88')][_0xf38a('0x46')]>-0x1?_[_0xf38a('0x39')](_0x346642[_0x3792a3][_0xf38a('0x88')],function(_0x1cb9a9){return{'name':_0x1cb9a9,'value':_0x1cb9a9};}):[]});}}return{'count':_0x46eab7[_0xf38a('0x46')],'rows':_0x46eab7};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x1513ef,null))[_0xf38a('0x28')](function(_0x3783d3){var _0x3fd5bc=_0x493fba[_0xf38a('0x41')][_0xf38a('0x1c')]?0x1f4:_0x3783d3[_0xf38a('0x89')]||0x1f4;logger[_0xf38a('0x24')](_0xf38a('0x8a'),'getFields',_0x3fd5bc,JSON['stringify'](_0x3783d3));delete _0x3783d3[_0xf38a('0x37')];if(_0x3fd5bc===0x191){_0x3fd5bc=0x190;}_0x1513ef[_0xf38a('0x2e')](_0x3fd5bc)['send'](_0x493fba[_0xf38a('0x41')][_0xf38a('0x1c')]?{'message':_0xf38a('0x8b'),'statusCode':_0x3783d3[_0xf38a('0x89')]}:_0x3783d3);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index c63b121..0e9725a 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 _0xd7ff=['../../components/integrations/configuration','define','int_zoho_accounts','changed','serverUrl','clientId','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','error','inspect','clientSecret','code','https://accounts.zoho.com','application/x-www-form-urlencoded','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes'];(function(_0x4f3c2d,_0x4754af){var _0x19d3ee=function(_0x462c74){while(--_0x462c74){_0x4f3c2d['push'](_0x4f3c2d['shift']());}};_0x19d3ee(++_0x4754af);}(_0xd7ff,0xf4));var _0xfd7f=function(_0x2b871b,_0x2ced5d){_0x2b871b=_0x2b871b-0x0;var _0x36918b=_0xd7ff[_0x2b871b];return _0x36918b;};'use strict';var _=require(_0xfd7f('0x0'));var util=require('util');var logger=require(_0xfd7f('0x1'))(_0xfd7f('0x2'));var moment=require(_0xfd7f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd7f('0x4'));var rimraf=require(_0xfd7f('0x5'));var config=require(_0xfd7f('0x6'));var attributes=require(_0xfd7f('0x7'));var integrations=require(_0xfd7f('0x8'));module['exports']=function(_0x39d48b,_0x1f0856){return _0x39d48b[_0xfd7f('0x9')]('ZohoAccount',attributes,{'tableName':_0xfd7f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x48dded,_0x1f4fdf,_0x186537){if(_0x48dded['changed']('zone')||_0x48dded[_0xfd7f('0xb')](_0xfd7f('0xc'))||_0x48dded[_0xfd7f('0xb')](_0xfd7f('0xd'))||_0x48dded['changed']('clientSecret')||_0x48dded[_0xfd7f('0xb')]('code')||_0x48dded[_0xfd7f('0xb')](_0xfd7f('0xe'))){var _0x55fd92,_0x567569;_0x55fd92=_0x48dded[_0xfd7f('0xc')];var _0x1e5e44=_0x55fd92[_0xfd7f('0xf')](-0x1);if(_0x1e5e44==='/'||_0x1e5e44==='\x5c'||_0x1e5e44===':'){_0x55fd92=_0x55fd92[_0xfd7f('0x10')](0x0,_0x55fd92[_0xfd7f('0x11')](_0x1e5e44));}switch(_0x48dded[_0xfd7f('0x12')]){case'US':_0x567569='https://accounts.zoho.com';break;case'AU':_0x567569=_0xfd7f('0x13');break;case'IN':_0x567569=_0xfd7f('0x14');break;case'CN':_0x567569=_0xfd7f('0x15');break;default:_0x567569=_0xfd7f('0x16');break;}var _0xcbd61d={'method':_0xfd7f('0x17'),'uri':_0x567569+_0xfd7f('0x18'),'form':{'grant_type':_0xfd7f('0x19'),'client_id':_0x48dded[_0xfd7f('0xd')],'client_secret':_0x48dded['clientSecret'],'redirect_uri':_0x48dded[_0xfd7f('0xc')],'code':_0x48dded['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0xcbd61d)[_0xfd7f('0x1a')](function(_0x2cbe7b){var _0x24affd=JSON[_0xfd7f('0x1b')](_0x2cbe7b);if(_0x24affd[_0xfd7f('0x1c')]){_0x48dded[_0xfd7f('0x1d')]=_0x24affd[_0xfd7f('0x1c')];logger[_0xfd7f('0x1e')](util[_0xfd7f('0x1f')](_0xfd7f('0x20'),_0x48dded[_0xfd7f('0x21')],_0x48dded['id']));}else{logger['error'](util['format'](_0xfd7f('0x22'),_0x48dded[_0xfd7f('0x21')],_0x48dded['id']),util['inspect'](_0x24affd,{'showHidden':![],'depth':null}));}return _0x186537(null,_0x1f4fdf);})[_0xfd7f('0x23')](function(_0x142644){logger[_0xfd7f('0x24')](util[_0xfd7f('0x1f')](_0xfd7f('0x22'),_0x48dded[_0xfd7f('0x21')],_0x48dded['id']),util[_0xfd7f('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x186537(_0x142644);});}else{return _0x186537(null,_0x1f4fdf);}},'beforeUpdate':function(_0x3c746d,_0x106886,_0x5cd8b4){if(_0x3c746d[_0xfd7f('0xb')](_0xfd7f('0x12'))||_0x3c746d[_0xfd7f('0xb')](_0xfd7f('0xc'))||_0x3c746d['changed'](_0xfd7f('0xd'))||_0x3c746d[_0xfd7f('0xb')](_0xfd7f('0x26'))||_0x3c746d[_0xfd7f('0xb')](_0xfd7f('0x27'))||_0x3c746d[_0xfd7f('0xb')](_0xfd7f('0xe'))){var _0x241e6c,_0xe52a4b;_0x241e6c=_0x3c746d[_0xfd7f('0xc')];var _0x25e949=_0x241e6c[_0xfd7f('0xf')](-0x1);if(_0x25e949==='/'||_0x25e949==='\x5c'||_0x25e949===':'){_0x241e6c=_0x241e6c['substring'](0x0,_0x241e6c['lastIndexOf'](_0x25e949));}switch(_0x3c746d[_0xfd7f('0x12')]){case'US':_0xe52a4b=_0xfd7f('0x28');break;case'AU':_0xe52a4b='https://accounts.zoho.com.au';break;case'IN':_0xe52a4b='https://accounts.zoho.in';break;case'CN':_0xe52a4b=_0xfd7f('0x15');break;default:_0xe52a4b=_0xfd7f('0x16');break;}var _0x31d7fc={'method':'POST','uri':_0xe52a4b+_0xfd7f('0x18'),'form':{'grant_type':_0xfd7f('0x19'),'client_id':_0x3c746d[_0xfd7f('0xd')],'client_secret':_0x3c746d[_0xfd7f('0x26')],'redirect_uri':_0x3c746d[_0xfd7f('0xc')],'code':_0x3c746d[_0xfd7f('0x27')]},'headers':{'Content-Type':_0xfd7f('0x29')}};return rp(_0x31d7fc)[_0xfd7f('0x1a')](function(_0x55a08a){var _0xebfbf8=JSON['parse'](_0x55a08a);if(_0xebfbf8[_0xfd7f('0x1c')]){_0x3c746d['refreshToken']=_0xebfbf8[_0xfd7f('0x1c')];logger[_0xfd7f('0x1e')](util['format'](_0xfd7f('0x20'),_0x3c746d[_0xfd7f('0x21')],_0x3c746d['id']));}else{logger['error'](util[_0xfd7f('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3c746d[_0xfd7f('0x21')],_0x3c746d['id']),util[_0xfd7f('0x25')](_0xebfbf8,{'showHidden':![],'depth':null}));}return _0x5cd8b4(null,_0x106886);})[_0xfd7f('0x23')](function(_0x1c01f9){logger[_0xfd7f('0x24')](util[_0xfd7f('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3c746d[_0xfd7f('0x21')],_0x3c746d['id']),util[_0xfd7f('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x5cd8b4(_0x1c01f9);});}else{return _0x5cd8b4(null,_0x106886);}}}});}; \ No newline at end of file +var _0x7eff=['clientId','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','/oauth/v2/token','authorization_code','clientSecret','then','parse','refresh_token','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com.cn','https://accounts.zoho.eu','application/x-www-form-urlencoded','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','changed','zone','serverUrl'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7eff,0x96));var _0xf7ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7eff[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xf7ef('0x0'));var logger=require(_0xf7ef('0x1'))(_0xf7ef('0x2'));var moment=require(_0xf7ef('0x3'));var BPromise=require(_0xf7ef('0x4'));var rp=require(_0xf7ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7ef('0x6'));var config=require(_0xf7ef('0x7'));var attributes=require(_0xf7ef('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xf7ef('0x9')]=function(_0x50a4d7,_0x5c472f){return _0x50a4d7['define'](_0xf7ef('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x323db4,_0x54a51a,_0x4b031f){if(_0x323db4[_0xf7ef('0xb')](_0xf7ef('0xc'))||_0x323db4[_0xf7ef('0xb')](_0xf7ef('0xd'))||_0x323db4[_0xf7ef('0xb')](_0xf7ef('0xe'))||_0x323db4['changed']('clientSecret')||_0x323db4[_0xf7ef('0xb')](_0xf7ef('0xf'))||_0x323db4[_0xf7ef('0xb')](_0xf7ef('0x10'))){var _0x5829cc,_0x5a1077;_0x5829cc=_0x323db4[_0xf7ef('0xd')];var _0x4a01e7=_0x5829cc[_0xf7ef('0x11')](-0x1);if(_0x4a01e7==='/'||_0x4a01e7==='\x5c'||_0x4a01e7===':'){_0x5829cc=_0x5829cc[_0xf7ef('0x12')](0x0,_0x5829cc[_0xf7ef('0x13')](_0x4a01e7));}switch(_0x323db4[_0xf7ef('0xc')]){case'US':_0x5a1077='https://accounts.zoho.com';break;case'AU':_0x5a1077=_0xf7ef('0x14');break;case'IN':_0x5a1077=_0xf7ef('0x15');break;case'CN':_0x5a1077='https://accounts.zoho.com.cn';break;default:_0x5a1077='https://accounts.zoho.eu';break;}var _0x827262={'method':_0xf7ef('0x16'),'uri':_0x5a1077+_0xf7ef('0x17'),'form':{'grant_type':_0xf7ef('0x18'),'client_id':_0x323db4[_0xf7ef('0xe')],'client_secret':_0x323db4[_0xf7ef('0x19')],'redirect_uri':_0x323db4[_0xf7ef('0xd')],'code':_0x323db4[_0xf7ef('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x827262)[_0xf7ef('0x1a')](function(_0x181f28){var _0x146aef=JSON[_0xf7ef('0x1b')](_0x181f28);if(_0x146aef[_0xf7ef('0x1c')]){_0x323db4['refreshToken']=_0x146aef['refresh_token'];logger[_0xf7ef('0x1d')](util[_0xf7ef('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x323db4[_0xf7ef('0x1f')],_0x323db4['id']));}else{logger[_0xf7ef('0x20')](util[_0xf7ef('0x1e')](_0xf7ef('0x21'),_0x323db4[_0xf7ef('0x1f')],_0x323db4['id']),util[_0xf7ef('0x22')](_0x146aef,{'showHidden':![],'depth':null}));}return _0x4b031f(null,_0x54a51a);})[_0xf7ef('0x23')](function(_0x33aece){logger[_0xf7ef('0x20')](util[_0xf7ef('0x1e')](_0xf7ef('0x21'),_0x323db4[_0xf7ef('0x1f')],_0x323db4['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4b031f(_0x33aece);});}else{return _0x4b031f(null,_0x54a51a);}},'beforeUpdate':function(_0x40f0ac,_0x173e17,_0x61db4a){if(_0x40f0ac[_0xf7ef('0xb')](_0xf7ef('0xc'))||_0x40f0ac['changed'](_0xf7ef('0xd'))||_0x40f0ac['changed'](_0xf7ef('0xe'))||_0x40f0ac[_0xf7ef('0xb')]('clientSecret')||_0x40f0ac[_0xf7ef('0xb')]('code')||_0x40f0ac['changed'](_0xf7ef('0x10'))){var _0x2e71a0,_0x2f4f5c;_0x2e71a0=_0x40f0ac[_0xf7ef('0xd')];var _0x3a7c4a=_0x2e71a0[_0xf7ef('0x11')](-0x1);if(_0x3a7c4a==='/'||_0x3a7c4a==='\x5c'||_0x3a7c4a===':'){_0x2e71a0=_0x2e71a0[_0xf7ef('0x12')](0x0,_0x2e71a0[_0xf7ef('0x13')](_0x3a7c4a));}switch(_0x40f0ac[_0xf7ef('0xc')]){case'US':_0x2f4f5c='https://accounts.zoho.com';break;case'AU':_0x2f4f5c='https://accounts.zoho.com.au';break;case'IN':_0x2f4f5c='https://accounts.zoho.in';break;case'CN':_0x2f4f5c=_0xf7ef('0x24');break;default:_0x2f4f5c=_0xf7ef('0x25');break;}var _0x213abb={'method':'POST','uri':_0x2f4f5c+_0xf7ef('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x40f0ac[_0xf7ef('0xe')],'client_secret':_0x40f0ac[_0xf7ef('0x19')],'redirect_uri':_0x40f0ac[_0xf7ef('0xd')],'code':_0x40f0ac[_0xf7ef('0xf')]},'headers':{'Content-Type':_0xf7ef('0x26')}};return rp(_0x213abb)[_0xf7ef('0x1a')](function(_0x3507da){var _0x29f7e4=JSON['parse'](_0x3507da);if(_0x29f7e4['refresh_token']){_0x40f0ac[_0xf7ef('0x27')]=_0x29f7e4[_0xf7ef('0x1c')];logger[_0xf7ef('0x1d')](util[_0xf7ef('0x1e')](_0xf7ef('0x28'),_0x40f0ac['name'],_0x40f0ac['id']));}else{logger[_0xf7ef('0x20')](util[_0xf7ef('0x1e')](_0xf7ef('0x21'),_0x40f0ac[_0xf7ef('0x1f')],_0x40f0ac['id']),util[_0xf7ef('0x22')](_0x29f7e4,{'showHidden':![],'depth':null}));}return _0x61db4a(null,_0x173e17);})[_0xf7ef('0x23')](function(_0x24673a){logger['error'](util[_0xf7ef('0x1e')](_0xf7ef('0x21'),_0x40f0ac[_0xf7ef('0x1f')],_0x40f0ac['id']),util[_0xf7ef('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x61db4a(_0x24673a);});}else{return _0x61db4a(null,_0x173e17);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index aef2f55..871fc38 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 _0xfa24=['jayson/promise','client','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetZohoAccount','options','where','attributes','limit','include','map','model','then','ShowZohoAccount','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x786598,_0x2dd56b){var _0x1f7435=function(_0x5a0d5c){while(--_0x5a0d5c){_0x786598['push'](_0x786598['shift']());}};_0x1f7435(++_0x2dd56b);}(_0xfa24,0xff));var _0x4fa2=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0xfa24[_0x3207aa];return _0x51758f;};'use strict';var _=require(_0x4fa2('0x0'));var util=require('util');var moment=require(_0x4fa2('0x1'));var BPromise=require(_0x4fa2('0x2'));var rs=require(_0x4fa2('0x3'));var fs=require('fs');var Redis=require(_0x4fa2('0x4'));var db=require(_0x4fa2('0x5'))['db'];var utils=require(_0x4fa2('0x6'));var logger=require(_0x4fa2('0x7'))(_0x4fa2('0x8'));var config=require('../../config/environment');var jayson=require(_0x4fa2('0x9'));var client=jayson[_0x4fa2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd04f82,_0x3cc23f,_0x5cdbb4){return new BPromise(function(_0x80df4b,_0x3c9017){return client['request'](_0xd04f82,_0x5cdbb4)['then'](function(_0x59f341){logger[_0x4fa2('0xb')](_0x4fa2('0xc'),_0x3cc23f,_0x4fa2('0xd'));logger[_0x4fa2('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3cc23f,_0x4fa2('0xd'),JSON[_0x4fa2('0xf')](_0x59f341));if(_0x59f341[_0x4fa2('0x10')]){if(_0x59f341[_0x4fa2('0x10')][_0x4fa2('0x11')]===0x1f4){logger[_0x4fa2('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x3cc23f,_0x59f341[_0x4fa2('0x10')][_0x4fa2('0x12')]);return _0x3c9017(_0x59f341[_0x4fa2('0x10')][_0x4fa2('0x12')]);}logger[_0x4fa2('0x10')](_0x4fa2('0xc'),_0x3cc23f,_0x59f341[_0x4fa2('0x10')][_0x4fa2('0x12')]);return _0x80df4b(_0x59f341['error'][_0x4fa2('0x12')]);}else{logger['info'](_0x4fa2('0xc'),_0x3cc23f,_0x4fa2('0xd'));_0x80df4b(_0x59f341[_0x4fa2('0x13')]['message']);}})[_0x4fa2('0x14')](function(_0x32dfbb){logger[_0x4fa2('0x10')](_0x4fa2('0xc'),_0x3cc23f,_0x32dfbb);_0x3c9017(_0x32dfbb);});});}exports[_0x4fa2('0x15')]=function(_0x5b7c00){var _0x3e8f94=this;return new Promise(function(_0x41ed4e,_0x8f62d2){return db['ZohoAccount']['findAll']({'raw':_0x5b7c00[_0x4fa2('0x16')]?_0x5b7c00[_0x4fa2('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5b7c00[_0x4fa2('0x16')]?_0x5b7c00[_0x4fa2('0x16')][_0x4fa2('0x17')]||null:null,'attributes':_0x5b7c00['options']?_0x5b7c00[_0x4fa2('0x16')][_0x4fa2('0x18')]||null:null,'limit':_0x5b7c00[_0x4fa2('0x16')]?_0x5b7c00[_0x4fa2('0x16')][_0x4fa2('0x19')]||null:null,'include':_0x5b7c00[_0x4fa2('0x16')]?_0x5b7c00['options'][_0x4fa2('0x1a')]?_[_0x4fa2('0x1b')](_0x5b7c00['options']['include'],function(_0x3554af){return{'model':db[_0x3554af['model']],'as':_0x3554af['as'],'attributes':_0x3554af[_0x4fa2('0x18')],'include':_0x3554af[_0x4fa2('0x1a')]?_['map'](_0x3554af['include'],function(_0x1a3282){return{'model':db[_0x1a3282[_0x4fa2('0x1c')]],'as':_0x1a3282['as'],'attributes':_0x1a3282['attributes'],'include':_0x1a3282['include']?_[_0x4fa2('0x1b')](_0x1a3282[_0x4fa2('0x1a')],function(_0x59ec00){return{'model':db[_0x59ec00[_0x4fa2('0x1c')]],'as':_0x59ec00['as'],'attributes':_0x59ec00['attributes']};}):[]};}):[]};}):[]:[]})[_0x4fa2('0x1d')](function(_0x59a0b0){logger['info'](_0x4fa2('0x15'),_0x5b7c00);logger['debug'](_0x4fa2('0x15'),_0x5b7c00,JSON['stringify'](_0x59a0b0));_0x41ed4e(_0x59a0b0);})[_0x4fa2('0x14')](function(_0x31c4df){logger[_0x4fa2('0x10')](_0x4fa2('0x15'),_0x31c4df[_0x4fa2('0x12')],_0x5b7c00);_0x8f62d2(_0x3e8f94[_0x4fa2('0x10')](0x1f4,_0x31c4df[_0x4fa2('0x12')]));});});};exports[_0x4fa2('0x1e')]=function(_0x1e5d95){var _0x1e5148=this;return new Promise(function(_0x4ab80a,_0x2f4120){return db['ZohoAccount'][_0x4fa2('0x1f')]({'raw':_0x1e5d95['options']?_0x1e5d95[_0x4fa2('0x16')][_0x4fa2('0x20')]===undefined?!![]:![]:!![],'where':_0x1e5d95[_0x4fa2('0x16')]?_0x1e5d95[_0x4fa2('0x16')][_0x4fa2('0x17')]||null:null,'attributes':_0x1e5d95['options']?_0x1e5d95[_0x4fa2('0x16')][_0x4fa2('0x18')]||null:null,'include':_0x1e5d95[_0x4fa2('0x16')]?_0x1e5d95[_0x4fa2('0x16')]['include']?_[_0x4fa2('0x1b')](_0x1e5d95[_0x4fa2('0x16')]['include'],function(_0x5e5f1f){return{'model':db[_0x5e5f1f['model']],'as':_0x5e5f1f['as'],'attributes':_0x5e5f1f[_0x4fa2('0x18')],'include':_0x5e5f1f[_0x4fa2('0x1a')]?_['map'](_0x5e5f1f[_0x4fa2('0x1a')],function(_0x26b1af){return{'model':db[_0x26b1af[_0x4fa2('0x1c')]],'as':_0x26b1af['as'],'attributes':_0x26b1af[_0x4fa2('0x18')],'include':_0x26b1af['include']?_[_0x4fa2('0x1b')](_0x26b1af[_0x4fa2('0x1a')],function(_0x5346b8){return{'model':db[_0x5346b8[_0x4fa2('0x1c')]],'as':_0x5346b8['as'],'attributes':_0x5346b8[_0x4fa2('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4fa2('0x1d')](function(_0x406a7e){logger[_0x4fa2('0xb')](_0x4fa2('0x1e'),_0x1e5d95);logger[_0x4fa2('0xe')](_0x4fa2('0x1e'),_0x1e5d95,JSON[_0x4fa2('0xf')](_0x406a7e));_0x4ab80a(_0x406a7e);})[_0x4fa2('0x14')](function(_0x206678){logger[_0x4fa2('0x10')](_0x4fa2('0x1e'),_0x206678[_0x4fa2('0x12')],_0x1e5d95);_0x2f4120(_0x1e5148[_0x4fa2('0x10')](0x1f4,_0x206678[_0x4fa2('0x12')]));});});}; \ No newline at end of file +var _0xd08b=['where','attributes','limit','map','include','model','ShowZohoAccount','find','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','catch','GetZohoAccount','ZohoAccount','findAll','options'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd08b,0x156));var _0xbd08=function(_0x3bca2d,_0x1af8f4){_0x3bca2d=_0x3bca2d-0x0;var _0x144a7c=_0xd08b[_0x3bca2d];return _0x144a7c;};'use strict';var _=require(_0xbd08('0x0'));var util=require(_0xbd08('0x1'));var moment=require(_0xbd08('0x2'));var BPromise=require(_0xbd08('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd08('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd08('0x5'));var logger=require(_0xbd08('0x6'))(_0xbd08('0x7'));var config=require(_0xbd08('0x8'));var jayson=require(_0xbd08('0x9'));var client=jayson[_0xbd08('0xa')][_0xbd08('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7cdb6f,_0x1e0790,_0x503b77){return new BPromise(function(_0x2c4533,_0x1655be){return client[_0xbd08('0xc')](_0x7cdb6f,_0x503b77)[_0xbd08('0xd')](function(_0xfbc661){logger[_0xbd08('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x1e0790,_0xbd08('0xf'));logger[_0xbd08('0x10')](_0xbd08('0x11'),_0x1e0790,_0xbd08('0xf'),JSON[_0xbd08('0x12')](_0xfbc661));if(_0xfbc661[_0xbd08('0x13')]){if(_0xfbc661[_0xbd08('0x13')][_0xbd08('0x14')]===0x1f4){logger[_0xbd08('0x13')](_0xbd08('0x15'),_0x1e0790,_0xfbc661['error']['message']);return _0x1655be(_0xfbc661[_0xbd08('0x13')][_0xbd08('0x16')]);}logger[_0xbd08('0x13')](_0xbd08('0x15'),_0x1e0790,_0xfbc661[_0xbd08('0x13')][_0xbd08('0x16')]);return _0x2c4533(_0xfbc661[_0xbd08('0x13')]['message']);}else{logger[_0xbd08('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x1e0790,'request\x20sent');_0x2c4533(_0xfbc661['result'][_0xbd08('0x16')]);}})[_0xbd08('0x17')](function(_0x5402b0){logger[_0xbd08('0x13')](_0xbd08('0x15'),_0x1e0790,_0x5402b0);_0x1655be(_0x5402b0);});});}exports[_0xbd08('0x18')]=function(_0x1722a3){var _0x486186=this;return new Promise(function(_0x2b3e81,_0x1bebfe){return db[_0xbd08('0x19')][_0xbd08('0x1a')]({'raw':_0x1722a3[_0xbd08('0x1b')]?_0x1722a3['options']['raw']===undefined?!![]:![]:!![],'where':_0x1722a3[_0xbd08('0x1b')]?_0x1722a3[_0xbd08('0x1b')][_0xbd08('0x1c')]||null:null,'attributes':_0x1722a3['options']?_0x1722a3[_0xbd08('0x1b')][_0xbd08('0x1d')]||null:null,'limit':_0x1722a3[_0xbd08('0x1b')]?_0x1722a3[_0xbd08('0x1b')][_0xbd08('0x1e')]||null:null,'include':_0x1722a3[_0xbd08('0x1b')]?_0x1722a3[_0xbd08('0x1b')]['include']?_[_0xbd08('0x1f')](_0x1722a3[_0xbd08('0x1b')]['include'],function(_0x4cecca){return{'model':db[_0x4cecca['model']],'as':_0x4cecca['as'],'attributes':_0x4cecca['attributes'],'include':_0x4cecca[_0xbd08('0x20')]?_[_0xbd08('0x1f')](_0x4cecca[_0xbd08('0x20')],function(_0x42e7e7){return{'model':db[_0x42e7e7[_0xbd08('0x21')]],'as':_0x42e7e7['as'],'attributes':_0x42e7e7['attributes'],'include':_0x42e7e7[_0xbd08('0x20')]?_[_0xbd08('0x1f')](_0x42e7e7[_0xbd08('0x20')],function(_0x1d89a3){return{'model':db[_0x1d89a3[_0xbd08('0x21')]],'as':_0x1d89a3['as'],'attributes':_0x1d89a3[_0xbd08('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbd08('0xd')](function(_0x27554a){logger[_0xbd08('0xe')](_0xbd08('0x18'),_0x1722a3);logger[_0xbd08('0x10')]('GetZohoAccount',_0x1722a3,JSON[_0xbd08('0x12')](_0x27554a));_0x2b3e81(_0x27554a);})[_0xbd08('0x17')](function(_0x4fd6f5){logger[_0xbd08('0x13')](_0xbd08('0x18'),_0x4fd6f5[_0xbd08('0x16')],_0x1722a3);_0x1bebfe(_0x486186[_0xbd08('0x13')](0x1f4,_0x4fd6f5[_0xbd08('0x16')]));});});};exports[_0xbd08('0x22')]=function(_0x293e0f){var _0xa4adcd=this;return new Promise(function(_0x3f4d05,_0x453872){return db[_0xbd08('0x19')][_0xbd08('0x23')]({'raw':_0x293e0f[_0xbd08('0x1b')]?_0x293e0f[_0xbd08('0x1b')][_0xbd08('0x24')]===undefined?!![]:![]:!![],'where':_0x293e0f[_0xbd08('0x1b')]?_0x293e0f[_0xbd08('0x1b')][_0xbd08('0x1c')]||null:null,'attributes':_0x293e0f[_0xbd08('0x1b')]?_0x293e0f[_0xbd08('0x1b')][_0xbd08('0x1d')]||null:null,'include':_0x293e0f[_0xbd08('0x1b')]?_0x293e0f[_0xbd08('0x1b')][_0xbd08('0x20')]?_[_0xbd08('0x1f')](_0x293e0f[_0xbd08('0x1b')][_0xbd08('0x20')],function(_0x2fb225){return{'model':db[_0x2fb225['model']],'as':_0x2fb225['as'],'attributes':_0x2fb225[_0xbd08('0x1d')],'include':_0x2fb225[_0xbd08('0x20')]?_['map'](_0x2fb225[_0xbd08('0x20')],function(_0x23410f){return{'model':db[_0x23410f[_0xbd08('0x21')]],'as':_0x23410f['as'],'attributes':_0x23410f[_0xbd08('0x1d')],'include':_0x23410f[_0xbd08('0x20')]?_[_0xbd08('0x1f')](_0x23410f[_0xbd08('0x20')],function(_0x584539){return{'model':db[_0x584539['model']],'as':_0x584539['as'],'attributes':_0x584539[_0xbd08('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbd08('0xd')](function(_0x930272){logger[_0xbd08('0xe')](_0xbd08('0x22'),_0x293e0f);logger[_0xbd08('0x10')](_0xbd08('0x22'),_0x293e0f,JSON[_0xbd08('0x12')](_0x930272));_0x3f4d05(_0x930272);})[_0xbd08('0x17')](function(_0x5a63fa){logger['error'](_0xbd08('0x22'),_0x5a63fa['message'],_0x293e0f);_0x453872(_0xa4adcd[_0xbd08('0x13')](0x1f4,_0x5a63fa[_0xbd08('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index ba9873b..8663fa5 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 _0x081e=['getSubjects','post','create','put','/:id','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/subjects'];(function(_0x87cd78,_0x1fa259){var _0x12b1f5=function(_0x3d55bf){while(--_0x3d55bf){_0x87cd78['push'](_0x87cd78['shift']());}};_0x12b1f5(++_0x1fa259);}(_0x081e,0xc5));var _0xe081=function(_0x8343ba,_0x217a01){_0x8343ba=_0x8343ba-0x0;var _0x3b10ff=_0x081e[_0x8343ba];return _0x3b10ff;};'use strict';var multer=require(_0xe081('0x0'));var util=require(_0xe081('0x1'));var path=require('path');var timeout=require(_0xe081('0x2'));var express=require('express');var router=express[_0xe081('0x3')]();var auth=require(_0xe081('0x4'));var interaction=require(_0xe081('0x5'));var config=require(_0xe081('0x6'));var controller=require(_0xe081('0x7'));router[_0xe081('0x8')]('/',auth[_0xe081('0x9')](),controller['index']);router[_0xe081('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xe081('0xa'),auth['isAuthenticated'](),controller[_0xe081('0xb')]);router['get'](_0xe081('0xc'),auth[_0xe081('0x9')](),controller[_0xe081('0xd')]);router['get']('/:id/descriptions',auth[_0xe081('0x9')](),controller['getDescriptions']);router[_0xe081('0xe')]('/',auth[_0xe081('0x9')](),controller[_0xe081('0xf')]);router[_0xe081('0x10')](_0xe081('0x11'),auth[_0xe081('0x9')](),controller['update']);router[_0xe081('0x12')](_0xe081('0x11'),auth['isAuthenticated'](),controller[_0xe081('0x13')]);module[_0xe081('0x14')]=router; \ No newline at end of file +var _0x7b37=['getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','index','show','/:id/fields','isAuthenticated','/:id/subjects'];(function(_0x54b3f9,_0x47a40e){var _0x1789a9=function(_0xfaf50a){while(--_0xfaf50a){_0x54b3f9['push'](_0x54b3f9['shift']());}};_0x1789a9(++_0x47a40e);}(_0x7b37,0xd9));var _0x77b3=function(_0x5b9986,_0x5d376a){_0x5b9986=_0x5b9986-0x0;var _0x2c3085=_0x7b37[_0x5b9986];return _0x2c3085;};'use strict';var multer=require(_0x77b3('0x0'));var util=require(_0x77b3('0x1'));var path=require('path');var timeout=require(_0x77b3('0x2'));var express=require(_0x77b3('0x3'));var router=express['Router']();var auth=require(_0x77b3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77b3('0x5'));var controller=require(_0x77b3('0x6'));router[_0x77b3('0x7')]('/',auth['isAuthenticated'](),controller[_0x77b3('0x8')]);router[_0x77b3('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x77b3('0x9')]);router['get'](_0x77b3('0xa'),auth[_0x77b3('0xb')](),controller['getFields']);router[_0x77b3('0x7')](_0x77b3('0xc'),auth[_0x77b3('0xb')](),controller[_0x77b3('0xd')]);router[_0x77b3('0x7')](_0x77b3('0xe'),auth[_0x77b3('0xb')](),controller[_0x77b3('0xf')]);router[_0x77b3('0x10')]('/',auth[_0x77b3('0xb')](),controller['create']);router[_0x77b3('0x11')](_0x77b3('0x12'),auth[_0x77b3('0xb')](),controller[_0x77b3('0x13')]);router[_0x77b3('0x14')](_0x77b3('0x12'),auth[_0x77b3('0xb')](),controller[_0x77b3('0x15')]);module[_0x77b3('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index ee8b494..999711c 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 _0x7ab2=['STRING','exports','lead','ENUM','contact'];(function(_0x5bbbbb,_0x489e84){var _0x5f2146=function(_0x271f9c){while(--_0x271f9c){_0x5bbbbb['push'](_0x5bbbbb['shift']());}};_0x5f2146(++_0x489e84);}(_0x7ab2,0xb5));var _0x27ab=function(_0x9c3f11,_0x349aea){_0x9c3f11=_0x9c3f11-0x0;var _0x2e1c86=_0x7ab2[_0x9c3f11];return _0x2e1c86;};'use strict';var Sequelize=require('sequelize');module[_0x27ab('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0x27ab('0x1'),'contact','nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x27ab('0x2')]('contact_lead',_0x27ab('0x3'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x27ab('0x4')]}}; \ No newline at end of file +var _0x5095=['nothing','ENUM','contact_lead','sequelize','exports','STRING','lead','contact'];(function(_0x501019,_0x37cc47){var _0x594059=function(_0x4320f7){while(--_0x4320f7){_0x501019['push'](_0x501019['shift']());}};_0x594059(++_0x37cc47);}(_0x5095,0xe3));var _0x5509=function(_0x3b66e5,_0x1c23f8){_0x3b66e5=_0x3b66e5-0x0;var _0x1a4c31=_0x5095[_0x3b66e5];return _0x1a4c31;};'use strict';var Sequelize=require(_0x5509('0x0'));module[_0x5509('0x1')]={'name':{'type':Sequelize[_0x5509('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x5509('0x3'),_0x5509('0x4'),_0x5509('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x5509('0x6')]('contact_lead',_0x5509('0x4'),'lead'),'defaultValue':_0x5509('0x7')},'description':{'type':Sequelize[_0x5509('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 2776137..f318ff6 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 _0x7011=['stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','rows','show','params','length','find','create','body','getFields','findOne','ZohoField','order','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','client','http','Sequelize','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x565c94,_0x2acc12){var _0x49c3bc=function(_0x1ce798){while(--_0x1ce798){_0x565c94['push'](_0x565c94['shift']());}};_0x49c3bc(++_0x2acc12);}(_0x7011,0x97));var _0x1701=function(_0x528404,_0x27a5ba){_0x528404=_0x528404-0x0;var _0xe59e6b=_0x7011[_0x528404];return _0xe59e6b;};'use strict';var pdf=require(_0x1701('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1701('0x1'));var zipdir=require(_0x1701('0x2'));var jsonpatch=require(_0x1701('0x3'));var rp=require(_0x1701('0x4'));var moment=require(_0x1701('0x5'));var BPromise=require(_0x1701('0x6'));var Mustache=require('mustache');var util=require(_0x1701('0x7'));var path=require(_0x1701('0x8'));var sox=require(_0x1701('0x9'));var csv=require(_0x1701('0xa'));var ejs=require(_0x1701('0xb'));var fs=require('fs');var _=require(_0x1701('0xc'));var squel=require('squel');var crypto=require(_0x1701('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1701('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1701('0xf'));var Papa=require(_0x1701('0x10'));var Redis=require(_0x1701('0x11'));var authService=require(_0x1701('0x12'));var qs=require(_0x1701('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1701('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1701('0x15'));var config=require(_0x1701('0x16'));var db=require(_0x1701('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1701('0x18')][_0x1701('0x19')]({'port':0x232a});function checkPasswordPattern(_0x414019,_0xf6b3fd,_0xb72480){if(_0xb72480){var _0x246fdc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x246fdc['test'](_0xf6b3fd)){return _0x414019;}else{throw new db[(_0x1701('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 _0x414019;}}function respondWithRpcPromise(_0x5e2591,_0x59cbd8,_0x30c977,_0x119b04){return new BPromise(function(_0x500d5e,_0x4b39a2){var _0x55c070=_0x119b04||client;return _0x55c070[_0x1701('0x1b')](_0x5e2591,_0x30c977)[_0x1701('0x1c')](function(_0x2bc887){logger[_0x1701('0x1d')](_0x1701('0x1e'),_0x59cbd8,_0x1701('0x1f'));logger[_0x1701('0x20')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x59cbd8,'request\x20sent',JSON[_0x1701('0x21')](_0x2bc887));if(_0x2bc887[_0x1701('0x22')]){if(_0x2bc887[_0x1701('0x22')][_0x1701('0x23')]===0x1f4){logger[_0x1701('0x22')](_0x1701('0x1e'),_0x59cbd8,_0x2bc887[_0x1701('0x22')][_0x1701('0x24')]);return _0x4b39a2(_0x2bc887[_0x1701('0x22')]['message']);}logger['error'](_0x1701('0x1e'),_0x59cbd8,_0x2bc887['error']['message']);return _0x500d5e(_0x2bc887[_0x1701('0x22')][_0x1701('0x24')]);}else{logger[_0x1701('0x1d')]('ZohoConfiguration,\x20%s,\x20%s',_0x59cbd8,_0x1701('0x1f'));_0x500d5e(_0x2bc887['result'][_0x1701('0x24')]);}})[_0x1701('0x25')](function(_0x101231){logger[_0x1701('0x22')](_0x1701('0x1e'),_0x59cbd8,_0x101231);_0x4b39a2(_0x101231);});});}function respondWithStatusCode(_0x3041a2,_0x395cc){_0x395cc=_0x395cc||0xcc;return function(_0x3cde4b){if(_0x3cde4b){return _0x3041a2[_0x1701('0x26')](_0x395cc);}return _0x3041a2[_0x1701('0x27')](_0x395cc)[_0x1701('0x28')]();};}function respondWithResult(_0x4754e2,_0x53c1c7){_0x53c1c7=_0x53c1c7||0xc8;return function(_0x158279){if(_0x158279){return _0x4754e2[_0x1701('0x27')](_0x53c1c7)[_0x1701('0x29')](_0x158279);}};}function respondWithFilteredResult(_0x3ee684,_0x585cce){return function(_0x50f00b){if(_0x50f00b){var _0x39cd48=_0x50f00b['count'],_0x1ee11a=_0x585cce[_0x1701('0x2a')],_0x54b821=_0x585cce['offset']+_0x585cce[_0x1701('0x2b')],_0x15bf03;if(_0x54b821>=_0x39cd48){_0x54b821=_0x39cd48;_0x15bf03=0xc8;}else{_0x15bf03=0xce;}_0x3ee684[_0x1701('0x27')](_0x15bf03);return _0x3ee684[_0x1701('0x2c')](_0x1701('0x2d'),_0x1ee11a+'-'+_0x54b821+'/'+_0x39cd48)[_0x1701('0x29')](_0x50f00b);}return null;};}function patchUpdates(_0x4e933c){return function(_0x4b154b){try{jsonpatch[_0x1701('0x2e')](_0x4b154b,_0x4e933c,!![]);}catch(_0x24df30){return BPromise[_0x1701('0x2f')](_0x24df30);}return _0x4b154b[_0x1701('0x30')]();};}function saveUpdates(_0x34f4c7,_0x1786f8){return function(_0x408258){if(_0x408258){return _0x408258[_0x1701('0x31')](_0x34f4c7)[_0x1701('0x1c')](function(_0x9f347){return _0x9f347;});}return null;};}function removeEntity(_0xf7b7f8,_0x4bc81f){return function(_0x33a58a){if(_0x33a58a){return _0x33a58a[_0x1701('0x32')]()[_0x1701('0x1c')](function(){_0xf7b7f8[_0x1701('0x27')](0xcc)[_0x1701('0x28')]();});}};}function handleEntityNotFound(_0x5be20d,_0x441a3c){return function(_0x5f2600){if(!_0x5f2600){_0x5be20d[_0x1701('0x26')](0x194);}return _0x5f2600;};}function handleError(_0xf6a075,_0x5d6835){_0x5d6835=_0x5d6835||0x1f4;return function(_0x505680){logger['error'](_0x505680[_0x1701('0x33')]);if(_0x505680[_0x1701('0x34')]){delete _0x505680['name'];}_0xf6a075['status'](_0x5d6835)[_0x1701('0x35')](_0x505680);};}exports[_0x1701('0x36')]=function(_0x14b6f2,_0xe23676){var _0x4a495c={},_0x32ef4f={},_0x5d5ec6={'count':0x0,'rows':[]};var _0x1eeb97=_[_0x1701('0x37')](db[_0x1701('0x38')][_0x1701('0x39')],function(_0x157962){return{'name':_0x157962[_0x1701('0x3a')],'type':_0x157962[_0x1701('0x3b')][_0x1701('0x3c')]};});_0x32ef4f[_0x1701('0x3d')]=_[_0x1701('0x37')](_0x1eeb97,_0x1701('0x34'));_0x32ef4f[_0x1701('0x3e')]=_[_0x1701('0x3f')](_0x14b6f2['query']);_0x32ef4f[_0x1701('0x40')]=_[_0x1701('0x41')](_0x32ef4f['model'],_0x32ef4f['query']);_0x4a495c[_0x1701('0x42')]=_[_0x1701('0x41')](_0x32ef4f[_0x1701('0x3d')],qs[_0x1701('0x43')](_0x14b6f2[_0x1701('0x3e')]['fields']));_0x4a495c[_0x1701('0x42')]=_0x4a495c['attributes']['length']?_0x4a495c[_0x1701('0x42')]:_0x32ef4f[_0x1701('0x3d')];if(!_0x14b6f2[_0x1701('0x3e')][_0x1701('0x44')]('nolimit')){_0x4a495c[_0x1701('0x2b')]=qs['limit'](_0x14b6f2[_0x1701('0x3e')][_0x1701('0x2b')]);_0x4a495c['offset']=qs[_0x1701('0x2a')](_0x14b6f2[_0x1701('0x3e')]['offset']);}_0x4a495c['order']=qs['sort'](_0x14b6f2[_0x1701('0x3e')][_0x1701('0x45')]);_0x4a495c[_0x1701('0x46')]=qs['filters'](_[_0x1701('0x47')](_0x14b6f2[_0x1701('0x3e')],_0x32ef4f[_0x1701('0x40')]),_0x1eeb97);if(_0x14b6f2[_0x1701('0x3e')]['filter']){_0x4a495c[_0x1701('0x46')]=_[_0x1701('0x48')](_0x4a495c[_0x1701('0x46')],{'$or':_[_0x1701('0x37')](_0x1eeb97,function(_0x44046d){if(_0x44046d[_0x1701('0x3b')]!==_0x1701('0x49')){var _0x5c0323={};_0x5c0323[_0x44046d[_0x1701('0x34')]]={'$like':'%'+_0x14b6f2[_0x1701('0x3e')][_0x1701('0x4a')]+'%'};return _0x5c0323;}})});}_0x4a495c=_[_0x1701('0x48')]({},_0x4a495c,_0x14b6f2[_0x1701('0x4b')]);var _0x4decfe={'where':_0x4a495c[_0x1701('0x46')]};return db[_0x1701('0x38')][_0x1701('0x4c')](_0x4decfe)[_0x1701('0x1c')](function(_0xb08e05){_0x5d5ec6[_0x1701('0x4c')]=_0xb08e05;if(_0x14b6f2[_0x1701('0x3e')][_0x1701('0x4d')]){_0x4a495c[_0x1701('0x4e')]=[{'all':!![]}];}return db[_0x1701('0x38')]['findAll'](_0x4a495c);})[_0x1701('0x1c')](function(_0x17b74d){_0x5d5ec6[_0x1701('0x4f')]=_0x17b74d;return _0x5d5ec6;})[_0x1701('0x1c')](respondWithFilteredResult(_0xe23676,_0x4a495c))[_0x1701('0x25')](handleError(_0xe23676,null));};exports[_0x1701('0x50')]=function(_0x3046d7,_0x4f021a){var _0x55c8bd={'raw':![],'where':{'id':_0x3046d7[_0x1701('0x51')]['id']}},_0x28c78a={};_0x28c78a[_0x1701('0x3d')]=_['keys'](db[_0x1701('0x38')][_0x1701('0x39')]);_0x28c78a[_0x1701('0x3e')]=_['keys'](_0x3046d7[_0x1701('0x3e')]);_0x28c78a['filters']=_[_0x1701('0x41')](_0x28c78a[_0x1701('0x3d')],_0x28c78a[_0x1701('0x3e')]);_0x55c8bd[_0x1701('0x42')]=_[_0x1701('0x41')](_0x28c78a[_0x1701('0x3d')],qs['fields'](_0x3046d7[_0x1701('0x3e')][_0x1701('0x43')]));_0x55c8bd[_0x1701('0x42')]=_0x55c8bd[_0x1701('0x42')][_0x1701('0x52')]?_0x55c8bd[_0x1701('0x42')]:_0x28c78a['model'];if(_0x3046d7[_0x1701('0x3e')][_0x1701('0x4d')]){_0x55c8bd[_0x1701('0x4e')]=[{'all':!![]}];}_0x55c8bd=_['merge']({},_0x55c8bd,_0x3046d7[_0x1701('0x4b')]);return db[_0x1701('0x38')][_0x1701('0x53')](_0x55c8bd)['then'](handleEntityNotFound(_0x4f021a,null))[_0x1701('0x1c')](respondWithResult(_0x4f021a,null))[_0x1701('0x25')](handleError(_0x4f021a,null));};exports[_0x1701('0x54')]=function(_0x1be459,_0x438560){return db['ZohoConfiguration'][_0x1701('0x54')](_0x1be459[_0x1701('0x55')],{})[_0x1701('0x1c')](respondWithResult(_0x438560,0xc9))[_0x1701('0x25')](handleError(_0x438560,null));};exports['update']=function(_0x2471e0,_0x51d7b8){if(_0x2471e0[_0x1701('0x55')]['id']){delete _0x2471e0[_0x1701('0x55')]['id'];}return db[_0x1701('0x38')]['find']({'where':{'id':_0x2471e0[_0x1701('0x51')]['id']}})[_0x1701('0x1c')](handleEntityNotFound(_0x51d7b8,null))[_0x1701('0x1c')](saveUpdates(_0x2471e0['body'],null))[_0x1701('0x1c')](respondWithResult(_0x51d7b8,null))['catch'](handleError(_0x51d7b8,null));};exports[_0x1701('0x32')]=function(_0x320abe,_0x397bf8){return db['ZohoConfiguration'][_0x1701('0x53')]({'where':{'id':_0x320abe['params']['id']}})[_0x1701('0x1c')](handleEntityNotFound(_0x397bf8,null))[_0x1701('0x1c')](removeEntity(_0x397bf8,null))[_0x1701('0x25')](handleError(_0x397bf8,null));};exports[_0x1701('0x56')]=function(_0x203892,_0x13800,_0x59b434){var _0x443f35={};var _0x337903={};var _0x16c546;var _0x2e55d0;return db[_0x1701('0x38')][_0x1701('0x57')]({'where':{'id':_0x203892[_0x1701('0x51')]['id']}})[_0x1701('0x1c')](handleEntityNotFound(_0x13800,null))['then'](function(_0x3df6bf){if(_0x3df6bf){_0x16c546=_0x3df6bf;_0x337903[_0x1701('0x3d')]=_[_0x1701('0x3f')](db[_0x1701('0x58')][_0x1701('0x39')]);_0x337903['query']=_['keys'](_0x203892['query']);_0x337903['filters']=_[_0x1701('0x41')](_0x337903[_0x1701('0x3d')],_0x337903[_0x1701('0x3e')]);_0x443f35[_0x1701('0x42')]=_[_0x1701('0x41')](_0x337903['model'],qs[_0x1701('0x43')](_0x203892[_0x1701('0x3e')]['fields']));_0x443f35[_0x1701('0x42')]=_0x443f35['attributes'][_0x1701('0x52')]?_0x443f35[_0x1701('0x42')]:_0x337903[_0x1701('0x3d')];_0x443f35[_0x1701('0x59')]=qs[_0x1701('0x45')](_0x203892[_0x1701('0x3e')][_0x1701('0x45')]);_0x443f35['where']=qs['filters'](_['pick'](_0x203892[_0x1701('0x3e')],_0x337903[_0x1701('0x40')]));if(_0x203892[_0x1701('0x3e')]['filter']){_0x443f35['where']=_[_0x1701('0x48')](_0x443f35[_0x1701('0x46')],{'$or':_['map'](_0x443f35[_0x1701('0x42')],function(_0x238a61){var _0x480278={};_0x480278[_0x238a61]={'$like':'%'+_0x203892[_0x1701('0x3e')][_0x1701('0x4a')]+'%'};return _0x480278;})});}_0x443f35=_[_0x1701('0x48')]({},_0x443f35,_0x203892[_0x1701('0x4b')]);return _0x16c546[_0x1701('0x56')](_0x443f35);}})['then'](function(_0x3a2abe){if(_0x3a2abe){_0x2e55d0=_0x3a2abe[_0x1701('0x52')];if(!_0x203892[_0x1701('0x3e')][_0x1701('0x44')]('nolimit')){_0x443f35['limit']=qs[_0x1701('0x2b')](_0x203892['query'][_0x1701('0x2b')]);_0x443f35['offset']=qs[_0x1701('0x2a')](_0x203892[_0x1701('0x3e')][_0x1701('0x2a')]);}return _0x16c546['getFields'](_0x443f35);}})[_0x1701('0x1c')](function(_0x43a8cd){if(_0x43a8cd){return _0x43a8cd?{'count':_0x2e55d0,'rows':_0x43a8cd}:null;}})['then'](respondWithResult(_0x13800,null))[_0x1701('0x25')](handleError(_0x13800,null));};exports[_0x1701('0x5a')]=function(_0x1008e4,_0x2415e6,_0x3b802d){var _0x425344={};var _0xa50509={};var _0x2a8b2e;var _0x3083d7;return db[_0x1701('0x38')][_0x1701('0x57')]({'where':{'id':_0x1008e4['params']['id']}})[_0x1701('0x1c')](handleEntityNotFound(_0x2415e6,null))[_0x1701('0x1c')](function(_0x17975f){if(_0x17975f){_0x2a8b2e=_0x17975f;_0xa50509[_0x1701('0x3d')]=_[_0x1701('0x3f')](db[_0x1701('0x58')][_0x1701('0x39')]);_0xa50509[_0x1701('0x3e')]=_[_0x1701('0x3f')](_0x1008e4['query']);_0xa50509['filters']=_[_0x1701('0x41')](_0xa50509[_0x1701('0x3d')],_0xa50509[_0x1701('0x3e')]);_0x425344['attributes']=_['intersection'](_0xa50509['model'],qs[_0x1701('0x43')](_0x1008e4[_0x1701('0x3e')][_0x1701('0x43')]));_0x425344[_0x1701('0x42')]=_0x425344[_0x1701('0x42')][_0x1701('0x52')]?_0x425344['attributes']:_0xa50509['model'];_0x425344[_0x1701('0x59')]=qs[_0x1701('0x45')](_0x1008e4[_0x1701('0x3e')]['sort']);_0x425344['where']=qs[_0x1701('0x40')](_[_0x1701('0x47')](_0x1008e4[_0x1701('0x3e')],_0xa50509[_0x1701('0x40')]));if(_0x1008e4[_0x1701('0x3e')][_0x1701('0x4a')]){_0x425344[_0x1701('0x46')]=_[_0x1701('0x48')](_0x425344[_0x1701('0x46')],{'$or':_[_0x1701('0x37')](_0x425344[_0x1701('0x42')],function(_0x19d057){var _0x123faf={};_0x123faf[_0x19d057]={'$like':'%'+_0x1008e4[_0x1701('0x3e')][_0x1701('0x4a')]+'%'};return _0x123faf;})});}_0x425344=_[_0x1701('0x48')]({},_0x425344,_0x1008e4['options']);return _0x2a8b2e[_0x1701('0x5a')](_0x425344);}})[_0x1701('0x1c')](function(_0xa37bd6){if(_0xa37bd6){_0x3083d7=_0xa37bd6['length'];if(!_0x1008e4[_0x1701('0x3e')][_0x1701('0x44')]('nolimit')){_0x425344[_0x1701('0x2b')]=qs[_0x1701('0x2b')](_0x1008e4[_0x1701('0x3e')]['limit']);_0x425344[_0x1701('0x2a')]=qs[_0x1701('0x2a')](_0x1008e4[_0x1701('0x3e')][_0x1701('0x2a')]);}return _0x2a8b2e[_0x1701('0x5a')](_0x425344);}})[_0x1701('0x1c')](function(_0x1497fd){if(_0x1497fd){return _0x1497fd?{'count':_0x3083d7,'rows':_0x1497fd}:null;}})[_0x1701('0x1c')](respondWithResult(_0x2415e6,null))[_0x1701('0x25')](handleError(_0x2415e6,null));};exports[_0x1701('0x5b')]=function(_0x411824,_0x53cf0f,_0x227d65){var _0x2a9060={};var _0x2bb895={};var _0x47e75d;var _0x40d2c1;return db[_0x1701('0x38')][_0x1701('0x57')]({'where':{'id':_0x411824['params']['id']}})[_0x1701('0x1c')](handleEntityNotFound(_0x53cf0f,null))[_0x1701('0x1c')](function(_0x4af21c){if(_0x4af21c){_0x47e75d=_0x4af21c;_0x2bb895['model']=_['keys'](db['ZohoField'][_0x1701('0x39')]);_0x2bb895[_0x1701('0x3e')]=_[_0x1701('0x3f')](_0x411824['query']);_0x2bb895[_0x1701('0x40')]=_[_0x1701('0x41')](_0x2bb895[_0x1701('0x3d')],_0x2bb895['query']);_0x2a9060['attributes']=_[_0x1701('0x41')](_0x2bb895[_0x1701('0x3d')],qs['fields'](_0x411824[_0x1701('0x3e')]['fields']));_0x2a9060['attributes']=_0x2a9060['attributes'][_0x1701('0x52')]?_0x2a9060[_0x1701('0x42')]:_0x2bb895[_0x1701('0x3d')];_0x2a9060[_0x1701('0x59')]=qs[_0x1701('0x45')](_0x411824[_0x1701('0x3e')]['sort']);_0x2a9060[_0x1701('0x46')]=qs['filters'](_['pick'](_0x411824[_0x1701('0x3e')],_0x2bb895[_0x1701('0x40')]));if(_0x411824[_0x1701('0x3e')][_0x1701('0x4a')]){_0x2a9060[_0x1701('0x46')]=_[_0x1701('0x48')](_0x2a9060[_0x1701('0x46')],{'$or':_[_0x1701('0x37')](_0x2a9060[_0x1701('0x42')],function(_0x5dd0a9){var _0x312f9b={};_0x312f9b[_0x5dd0a9]={'$like':'%'+_0x411824[_0x1701('0x3e')][_0x1701('0x4a')]+'%'};return _0x312f9b;})});}_0x2a9060=_['merge']({},_0x2a9060,_0x411824[_0x1701('0x4b')]);return _0x47e75d[_0x1701('0x5b')](_0x2a9060);}})[_0x1701('0x1c')](function(_0x2f0104){if(_0x2f0104){_0x40d2c1=_0x2f0104[_0x1701('0x52')];if(!_0x411824[_0x1701('0x3e')][_0x1701('0x44')]('nolimit')){_0x2a9060[_0x1701('0x2b')]=qs['limit'](_0x411824[_0x1701('0x3e')]['limit']);_0x2a9060[_0x1701('0x2a')]=qs['offset'](_0x411824[_0x1701('0x3e')][_0x1701('0x2a')]);}return _0x47e75d['getDescriptions'](_0x2a9060);}})['then'](function(_0x49b457){if(_0x49b457){return _0x49b457?{'count':_0x40d2c1,'rows':_0x49b457}:null;}})[_0x1701('0x1c')](respondWithResult(_0x53cf0f,null))[_0x1701('0x25')](handleError(_0x53cf0f,null));}; \ No newline at end of file +var _0x6070=['jsforce','desk.js','to-csv','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','update','destroy','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','show','params','include','find','create','body','getFields','findOne','getSubjects','ZohoField','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','lodash','squel','crypto'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0x6070,0x19a));var _0x0607=function(_0x43819f,_0x1ab95b){_0x43819f=_0x43819f-0x0;var _0x8d9f39=_0x6070[_0x43819f];return _0x8d9f39;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0607('0x0'));var rimraf=require(_0x0607('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0607('0x2'));var rp=require(_0x0607('0x3'));var moment=require('moment');var BPromise=require(_0x0607('0x4'));var Mustache=require(_0x0607('0x5'));var util=require(_0x0607('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0607('0x7'));var squel=require(_0x0607('0x8'));var crypto=require(_0x0607('0x9'));var jsforce=require(_0x0607('0xa'));var deskjs=require(_0x0607('0xb'));var toCsv=require(_0x0607('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0607('0xd'));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(_0x0607('0xe'))(_0x0607('0xf'));var utils=require('../../config/utils');var config=require(_0x0607('0x10'));var db=require(_0x0607('0x11'))['db'];var jayson=require(_0x0607('0x12'));var client=jayson[_0x0607('0x13')][_0x0607('0x14')]({'port':0x232a});function checkPasswordPattern(_0x134c48,_0x1bdab4,_0x4965a1){if(_0x4965a1){var _0x2f2287=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2f2287['test'](_0x1bdab4)){return _0x134c48;}else{throw new db[(_0x0607('0x15'))][(_0x0607('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 _0x134c48;}}function respondWithRpcPromise(_0x41c87a,_0x36090d,_0x5473f5,_0x5b4dde){return new BPromise(function(_0x55041d,_0x3c0421){var _0x52004e=_0x5b4dde||client;return _0x52004e[_0x0607('0x17')](_0x41c87a,_0x5473f5)[_0x0607('0x18')](function(_0x474595){logger[_0x0607('0x19')](_0x0607('0x1a'),_0x36090d,_0x0607('0x1b'));logger['debug'](_0x0607('0x1c'),_0x36090d,'request\x20sent',JSON[_0x0607('0x1d')](_0x474595));if(_0x474595[_0x0607('0x1e')]){if(_0x474595[_0x0607('0x1e')]['code']===0x1f4){logger[_0x0607('0x1e')](_0x0607('0x1a'),_0x36090d,_0x474595[_0x0607('0x1e')][_0x0607('0x1f')]);return _0x3c0421(_0x474595[_0x0607('0x1e')][_0x0607('0x1f')]);}logger[_0x0607('0x1e')](_0x0607('0x1a'),_0x36090d,_0x474595[_0x0607('0x1e')][_0x0607('0x1f')]);return _0x55041d(_0x474595[_0x0607('0x1e')][_0x0607('0x1f')]);}else{logger[_0x0607('0x19')](_0x0607('0x1a'),_0x36090d,_0x0607('0x1b'));_0x55041d(_0x474595['result']['message']);}})[_0x0607('0x20')](function(_0x2aca92){logger[_0x0607('0x1e')](_0x0607('0x1a'),_0x36090d,_0x2aca92);_0x3c0421(_0x2aca92);});});}function respondWithStatusCode(_0x4f382c,_0x4b591c){_0x4b591c=_0x4b591c||0xcc;return function(_0x1092a4){if(_0x1092a4){return _0x4f382c[_0x0607('0x21')](_0x4b591c);}return _0x4f382c[_0x0607('0x22')](_0x4b591c)[_0x0607('0x23')]();};}function respondWithResult(_0x4b61e5,_0x395dcd){_0x395dcd=_0x395dcd||0xc8;return function(_0xee0a22){if(_0xee0a22){return _0x4b61e5[_0x0607('0x22')](_0x395dcd)[_0x0607('0x24')](_0xee0a22);}};}function respondWithFilteredResult(_0x4cb0e0,_0x397161){return function(_0x30d6d1){if(_0x30d6d1){var _0x2634a1=_0x30d6d1['count'],_0x3217f9=_0x397161[_0x0607('0x25')],_0x15e0e1=_0x397161['offset']+_0x397161[_0x0607('0x26')],_0xdd4e4d;if(_0x15e0e1>=_0x2634a1){_0x15e0e1=_0x2634a1;_0xdd4e4d=0xc8;}else{_0xdd4e4d=0xce;}_0x4cb0e0[_0x0607('0x22')](_0xdd4e4d);return _0x4cb0e0['set'](_0x0607('0x27'),_0x3217f9+'-'+_0x15e0e1+'/'+_0x2634a1)[_0x0607('0x24')](_0x30d6d1);}return null;};}function patchUpdates(_0x17ce6c){return function(_0x28442b){try{jsonpatch[_0x0607('0x28')](_0x28442b,_0x17ce6c,!![]);}catch(_0x2fe94e){return BPromise['reject'](_0x2fe94e);}return _0x28442b[_0x0607('0x29')]();};}function saveUpdates(_0x2946f6,_0x2b0d0e){return function(_0x3fe1a4){if(_0x3fe1a4){return _0x3fe1a4[_0x0607('0x2a')](_0x2946f6)[_0x0607('0x18')](function(_0x2438ee){return _0x2438ee;});}return null;};}function removeEntity(_0x4378f0,_0x2440b2){return function(_0x55fe91){if(_0x55fe91){return _0x55fe91[_0x0607('0x2b')]()['then'](function(){_0x4378f0[_0x0607('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x300a0f,_0x3301b5){return function(_0x5b7e4c){if(!_0x5b7e4c){_0x300a0f[_0x0607('0x21')](0x194);}return _0x5b7e4c;};}function handleError(_0x8e5513,_0x507c22){_0x507c22=_0x507c22||0x1f4;return function(_0x207b7e){logger[_0x0607('0x1e')](_0x207b7e[_0x0607('0x2c')]);if(_0x207b7e[_0x0607('0x2d')]){delete _0x207b7e[_0x0607('0x2d')];}_0x8e5513[_0x0607('0x22')](_0x507c22)[_0x0607('0x2e')](_0x207b7e);};}exports['index']=function(_0x2ae4d4,_0x49df57){var _0x47e5ff={},_0xaa829b={},_0xd9c3d0={'count':0x0,'rows':[]};var _0x4dd1f3=_[_0x0607('0x2f')](db[_0x0607('0x30')][_0x0607('0x31')],function(_0xe82283){return{'name':_0xe82283[_0x0607('0x32')],'type':_0xe82283[_0x0607('0x33')]['key']};});_0xaa829b[_0x0607('0x34')]=_[_0x0607('0x2f')](_0x4dd1f3,'name');_0xaa829b['query']=_[_0x0607('0x35')](_0x2ae4d4['query']);_0xaa829b[_0x0607('0x36')]=_[_0x0607('0x37')](_0xaa829b[_0x0607('0x34')],_0xaa829b[_0x0607('0x38')]);_0x47e5ff['attributes']=_[_0x0607('0x37')](_0xaa829b['model'],qs[_0x0607('0x39')](_0x2ae4d4['query'][_0x0607('0x39')]));_0x47e5ff[_0x0607('0x3a')]=_0x47e5ff[_0x0607('0x3a')][_0x0607('0x3b')]?_0x47e5ff[_0x0607('0x3a')]:_0xaa829b[_0x0607('0x34')];if(!_0x2ae4d4[_0x0607('0x38')][_0x0607('0x3c')](_0x0607('0x3d'))){_0x47e5ff[_0x0607('0x26')]=qs[_0x0607('0x26')](_0x2ae4d4[_0x0607('0x38')]['limit']);_0x47e5ff[_0x0607('0x25')]=qs[_0x0607('0x25')](_0x2ae4d4[_0x0607('0x38')][_0x0607('0x25')]);}_0x47e5ff[_0x0607('0x3e')]=qs['sort'](_0x2ae4d4[_0x0607('0x38')][_0x0607('0x3f')]);_0x47e5ff[_0x0607('0x40')]=qs[_0x0607('0x36')](_[_0x0607('0x41')](_0x2ae4d4['query'],_0xaa829b[_0x0607('0x36')]),_0x4dd1f3);if(_0x2ae4d4['query'][_0x0607('0x42')]){_0x47e5ff[_0x0607('0x40')]=_[_0x0607('0x43')](_0x47e5ff['where'],{'$or':_[_0x0607('0x2f')](_0x4dd1f3,function(_0xe2520){if(_0xe2520[_0x0607('0x33')]!==_0x0607('0x44')){var _0x11eff7={};_0x11eff7[_0xe2520[_0x0607('0x2d')]]={'$like':'%'+_0x2ae4d4['query'][_0x0607('0x42')]+'%'};return _0x11eff7;}})});}_0x47e5ff=_[_0x0607('0x43')]({},_0x47e5ff,_0x2ae4d4[_0x0607('0x45')]);var _0x284e2c={'where':_0x47e5ff['where']};return db[_0x0607('0x30')][_0x0607('0x46')](_0x284e2c)[_0x0607('0x18')](function(_0x3e8b61){_0xd9c3d0[_0x0607('0x46')]=_0x3e8b61;if(_0x2ae4d4[_0x0607('0x38')][_0x0607('0x47')]){_0x47e5ff['include']=[{'all':!![]}];}return db[_0x0607('0x30')][_0x0607('0x48')](_0x47e5ff);})[_0x0607('0x18')](function(_0xbd6b07){_0xd9c3d0['rows']=_0xbd6b07;return _0xd9c3d0;})[_0x0607('0x18')](respondWithFilteredResult(_0x49df57,_0x47e5ff))[_0x0607('0x20')](handleError(_0x49df57,null));};exports[_0x0607('0x49')]=function(_0x4be0d0,_0x2f0314){var _0x1011d6={'raw':![],'where':{'id':_0x4be0d0[_0x0607('0x4a')]['id']}},_0x4ba85b={};_0x4ba85b[_0x0607('0x34')]=_[_0x0607('0x35')](db[_0x0607('0x30')][_0x0607('0x31')]);_0x4ba85b[_0x0607('0x38')]=_[_0x0607('0x35')](_0x4be0d0['query']);_0x4ba85b[_0x0607('0x36')]=_[_0x0607('0x37')](_0x4ba85b[_0x0607('0x34')],_0x4ba85b[_0x0607('0x38')]);_0x1011d6[_0x0607('0x3a')]=_[_0x0607('0x37')](_0x4ba85b['model'],qs[_0x0607('0x39')](_0x4be0d0[_0x0607('0x38')][_0x0607('0x39')]));_0x1011d6['attributes']=_0x1011d6[_0x0607('0x3a')]['length']?_0x1011d6[_0x0607('0x3a')]:_0x4ba85b[_0x0607('0x34')];if(_0x4be0d0[_0x0607('0x38')][_0x0607('0x47')]){_0x1011d6[_0x0607('0x4b')]=[{'all':!![]}];}_0x1011d6=_['merge']({},_0x1011d6,_0x4be0d0['options']);return db[_0x0607('0x30')][_0x0607('0x4c')](_0x1011d6)[_0x0607('0x18')](handleEntityNotFound(_0x2f0314,null))['then'](respondWithResult(_0x2f0314,null))[_0x0607('0x20')](handleError(_0x2f0314,null));};exports[_0x0607('0x4d')]=function(_0x355136,_0x323317){return db['ZohoConfiguration'][_0x0607('0x4d')](_0x355136['body'],{})[_0x0607('0x18')](respondWithResult(_0x323317,0xc9))[_0x0607('0x20')](handleError(_0x323317,null));};exports[_0x0607('0x2a')]=function(_0x42f172,_0x349974){if(_0x42f172[_0x0607('0x4e')]['id']){delete _0x42f172[_0x0607('0x4e')]['id'];}return db[_0x0607('0x30')]['find']({'where':{'id':_0x42f172[_0x0607('0x4a')]['id']}})[_0x0607('0x18')](handleEntityNotFound(_0x349974,null))[_0x0607('0x18')](saveUpdates(_0x42f172[_0x0607('0x4e')],null))[_0x0607('0x18')](respondWithResult(_0x349974,null))[_0x0607('0x20')](handleError(_0x349974,null));};exports[_0x0607('0x2b')]=function(_0x555a99,_0xb5e1f){return db[_0x0607('0x30')][_0x0607('0x4c')]({'where':{'id':_0x555a99[_0x0607('0x4a')]['id']}})[_0x0607('0x18')](handleEntityNotFound(_0xb5e1f,null))[_0x0607('0x18')](removeEntity(_0xb5e1f,null))['catch'](handleError(_0xb5e1f,null));};exports[_0x0607('0x4f')]=function(_0x204ed0,_0x135f12,_0x302929){var _0x2c70de={};var _0x513f29={};var _0xaddbfb;var _0x4359d3;return db[_0x0607('0x30')][_0x0607('0x50')]({'where':{'id':_0x204ed0[_0x0607('0x4a')]['id']}})[_0x0607('0x18')](handleEntityNotFound(_0x135f12,null))['then'](function(_0x4d26b9){if(_0x4d26b9){_0xaddbfb=_0x4d26b9;_0x513f29['model']=_[_0x0607('0x35')](db['ZohoField'][_0x0607('0x31')]);_0x513f29['query']=_['keys'](_0x204ed0[_0x0607('0x38')]);_0x513f29[_0x0607('0x36')]=_[_0x0607('0x37')](_0x513f29['model'],_0x513f29['query']);_0x2c70de[_0x0607('0x3a')]=_[_0x0607('0x37')](_0x513f29[_0x0607('0x34')],qs['fields'](_0x204ed0['query']['fields']));_0x2c70de[_0x0607('0x3a')]=_0x2c70de[_0x0607('0x3a')][_0x0607('0x3b')]?_0x2c70de['attributes']:_0x513f29[_0x0607('0x34')];_0x2c70de[_0x0607('0x3e')]=qs[_0x0607('0x3f')](_0x204ed0[_0x0607('0x38')]['sort']);_0x2c70de[_0x0607('0x40')]=qs['filters'](_['pick'](_0x204ed0[_0x0607('0x38')],_0x513f29[_0x0607('0x36')]));if(_0x204ed0[_0x0607('0x38')][_0x0607('0x42')]){_0x2c70de[_0x0607('0x40')]=_[_0x0607('0x43')](_0x2c70de[_0x0607('0x40')],{'$or':_[_0x0607('0x2f')](_0x2c70de[_0x0607('0x3a')],function(_0x21842b){var _0x488a07={};_0x488a07[_0x21842b]={'$like':'%'+_0x204ed0[_0x0607('0x38')][_0x0607('0x42')]+'%'};return _0x488a07;})});}_0x2c70de=_[_0x0607('0x43')]({},_0x2c70de,_0x204ed0['options']);return _0xaddbfb[_0x0607('0x4f')](_0x2c70de);}})[_0x0607('0x18')](function(_0x1b71de){if(_0x1b71de){_0x4359d3=_0x1b71de[_0x0607('0x3b')];if(!_0x204ed0[_0x0607('0x38')][_0x0607('0x3c')](_0x0607('0x3d'))){_0x2c70de['limit']=qs[_0x0607('0x26')](_0x204ed0[_0x0607('0x38')][_0x0607('0x26')]);_0x2c70de['offset']=qs['offset'](_0x204ed0[_0x0607('0x38')]['offset']);}return _0xaddbfb[_0x0607('0x4f')](_0x2c70de);}})[_0x0607('0x18')](function(_0x269434){if(_0x269434){return _0x269434?{'count':_0x4359d3,'rows':_0x269434}:null;}})[_0x0607('0x18')](respondWithResult(_0x135f12,null))[_0x0607('0x20')](handleError(_0x135f12,null));};exports[_0x0607('0x51')]=function(_0x23941a,_0x2aaf8a,_0x4ce959){var _0x5e2c48={};var _0x4c4b5c={};var _0x4d549d;var _0x19e166;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x23941a[_0x0607('0x4a')]['id']}})[_0x0607('0x18')](handleEntityNotFound(_0x2aaf8a,null))[_0x0607('0x18')](function(_0x44b97e){if(_0x44b97e){_0x4d549d=_0x44b97e;_0x4c4b5c['model']=_['keys'](db[_0x0607('0x52')][_0x0607('0x31')]);_0x4c4b5c['query']=_[_0x0607('0x35')](_0x23941a[_0x0607('0x38')]);_0x4c4b5c['filters']=_[_0x0607('0x37')](_0x4c4b5c[_0x0607('0x34')],_0x4c4b5c['query']);_0x5e2c48[_0x0607('0x3a')]=_[_0x0607('0x37')](_0x4c4b5c['model'],qs[_0x0607('0x39')](_0x23941a[_0x0607('0x38')][_0x0607('0x39')]));_0x5e2c48['attributes']=_0x5e2c48[_0x0607('0x3a')][_0x0607('0x3b')]?_0x5e2c48[_0x0607('0x3a')]:_0x4c4b5c[_0x0607('0x34')];_0x5e2c48[_0x0607('0x3e')]=qs[_0x0607('0x3f')](_0x23941a['query'][_0x0607('0x3f')]);_0x5e2c48[_0x0607('0x40')]=qs['filters'](_[_0x0607('0x41')](_0x23941a[_0x0607('0x38')],_0x4c4b5c['filters']));if(_0x23941a[_0x0607('0x38')][_0x0607('0x42')]){_0x5e2c48[_0x0607('0x40')]=_[_0x0607('0x43')](_0x5e2c48[_0x0607('0x40')],{'$or':_[_0x0607('0x2f')](_0x5e2c48[_0x0607('0x3a')],function(_0x55e7d9){var _0x47412e={};_0x47412e[_0x55e7d9]={'$like':'%'+_0x23941a[_0x0607('0x38')][_0x0607('0x42')]+'%'};return _0x47412e;})});}_0x5e2c48=_[_0x0607('0x43')]({},_0x5e2c48,_0x23941a[_0x0607('0x45')]);return _0x4d549d[_0x0607('0x51')](_0x5e2c48);}})[_0x0607('0x18')](function(_0x28480a){if(_0x28480a){_0x19e166=_0x28480a[_0x0607('0x3b')];if(!_0x23941a['query'][_0x0607('0x3c')](_0x0607('0x3d'))){_0x5e2c48['limit']=qs[_0x0607('0x26')](_0x23941a[_0x0607('0x38')][_0x0607('0x26')]);_0x5e2c48[_0x0607('0x25')]=qs[_0x0607('0x25')](_0x23941a[_0x0607('0x38')][_0x0607('0x25')]);}return _0x4d549d[_0x0607('0x51')](_0x5e2c48);}})[_0x0607('0x18')](function(_0xb13e0f){if(_0xb13e0f){return _0xb13e0f?{'count':_0x19e166,'rows':_0xb13e0f}:null;}})[_0x0607('0x18')](respondWithResult(_0x2aaf8a,null))[_0x0607('0x20')](handleError(_0x2aaf8a,null));};exports[_0x0607('0x53')]=function(_0x5c817b,_0x4a74a4,_0x27808d){var _0x378c60={};var _0x715d1c={};var _0x401424;var _0x3541d5;return db[_0x0607('0x30')][_0x0607('0x50')]({'where':{'id':_0x5c817b[_0x0607('0x4a')]['id']}})[_0x0607('0x18')](handleEntityNotFound(_0x4a74a4,null))[_0x0607('0x18')](function(_0x5bbc5f){if(_0x5bbc5f){_0x401424=_0x5bbc5f;_0x715d1c[_0x0607('0x34')]=_[_0x0607('0x35')](db['ZohoField']['rawAttributes']);_0x715d1c['query']=_['keys'](_0x5c817b[_0x0607('0x38')]);_0x715d1c[_0x0607('0x36')]=_[_0x0607('0x37')](_0x715d1c[_0x0607('0x34')],_0x715d1c[_0x0607('0x38')]);_0x378c60[_0x0607('0x3a')]=_[_0x0607('0x37')](_0x715d1c[_0x0607('0x34')],qs['fields'](_0x5c817b['query'][_0x0607('0x39')]));_0x378c60[_0x0607('0x3a')]=_0x378c60[_0x0607('0x3a')][_0x0607('0x3b')]?_0x378c60[_0x0607('0x3a')]:_0x715d1c['model'];_0x378c60[_0x0607('0x3e')]=qs[_0x0607('0x3f')](_0x5c817b['query'][_0x0607('0x3f')]);_0x378c60[_0x0607('0x40')]=qs['filters'](_['pick'](_0x5c817b['query'],_0x715d1c[_0x0607('0x36')]));if(_0x5c817b[_0x0607('0x38')][_0x0607('0x42')]){_0x378c60[_0x0607('0x40')]=_['merge'](_0x378c60['where'],{'$or':_['map'](_0x378c60['attributes'],function(_0x2bf0bd){var _0x3d063d={};_0x3d063d[_0x2bf0bd]={'$like':'%'+_0x5c817b[_0x0607('0x38')]['filter']+'%'};return _0x3d063d;})});}_0x378c60=_[_0x0607('0x43')]({},_0x378c60,_0x5c817b[_0x0607('0x45')]);return _0x401424[_0x0607('0x53')](_0x378c60);}})[_0x0607('0x18')](function(_0x144f94){if(_0x144f94){_0x3541d5=_0x144f94['length'];if(!_0x5c817b[_0x0607('0x38')][_0x0607('0x3c')](_0x0607('0x3d'))){_0x378c60[_0x0607('0x26')]=qs[_0x0607('0x26')](_0x5c817b[_0x0607('0x38')][_0x0607('0x26')]);_0x378c60[_0x0607('0x25')]=qs[_0x0607('0x25')](_0x5c817b[_0x0607('0x38')][_0x0607('0x25')]);}return _0x401424[_0x0607('0x53')](_0x378c60);}})[_0x0607('0x18')](function(_0x2add81){if(_0x2add81){return _0x2add81?{'count':_0x3541d5,'rows':_0x2add81}:null;}})['then'](respondWithResult(_0x4a74a4,null))[_0x0607('0x20')](handleError(_0x4a74a4,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 08f3f19..4cf8962 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 _0x680c=['int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','ZohoConfiguration'];(function(_0x2dfffc,_0x2e3e5f){var _0x531c59=function(_0x52f546){while(--_0x52f546){_0x2dfffc['push'](_0x2dfffc['shift']());}};_0x531c59(++_0x2e3e5f);}(_0x680c,0x169));var _0xc680=function(_0x5cd51d,_0x20d4fa){_0x5cd51d=_0x5cd51d-0x0;var _0x444608=_0x680c[_0x5cd51d];return _0x444608;};'use strict';var _=require(_0xc680('0x0'));var util=require(_0xc680('0x1'));var logger=require(_0xc680('0x2'))(_0xc680('0x3'));var moment=require(_0xc680('0x4'));var BPromise=require(_0xc680('0x5'));var rp=require(_0xc680('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc680('0x7'));var config=require(_0xc680('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0xc680('0x9')]=function(_0x5a46a6,_0x3ae3e2){return _0x5a46a6['define'](_0xc680('0xa'),attributes,{'tableName':_0xc680('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca47=['ZohoConfiguration','int_zoho_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x277425,_0x1d46ef){var _0x33d33c=function(_0x18a19d){while(--_0x18a19d){_0x277425['push'](_0x277425['shift']());}};_0x33d33c(++_0x1d46ef);}(_0xca47,0x1e3));var _0x7ca4=function(_0x47170b,_0x38aa89){_0x47170b=_0x47170b-0x0;var _0x87f57f=_0xca47[_0x47170b];return _0x87f57f;};'use strict';var _=require(_0x7ca4('0x0'));var util=require(_0x7ca4('0x1'));var logger=require('../../config/logger')(_0x7ca4('0x2'));var moment=require(_0x7ca4('0x3'));var BPromise=require(_0x7ca4('0x4'));var rp=require(_0x7ca4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ca4('0x6'));var config=require(_0x7ca4('0x7'));var attributes=require(_0x7ca4('0x8'));module[_0x7ca4('0x9')]=function(_0x47b101,_0x4629a0){return _0x47b101[_0x7ca4('0xa')](_0x7ca4('0xb'),attributes,{'tableName':_0x7ca4('0xc'),'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 bb34732..908664f 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 _0x2e9d=['../../config/environment','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xa987c1,_0x55e7a9){var _0x362b9c=function(_0x5075b5){while(--_0x5075b5){_0xa987c1['push'](_0xa987c1['shift']());}};_0x362b9c(++_0x55e7a9);}(_0x2e9d,0x99));var _0xd2e9=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x2e9d[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0xd2e9('0x0'));var util=require('util');var moment=require(_0xd2e9('0x1'));var BPromise=require(_0xd2e9('0x2'));var rs=require(_0xd2e9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2e9('0x4'))['db'];var utils=require(_0xd2e9('0x5'));var logger=require(_0xd2e9('0x6'))(_0xd2e9('0x7'));var config=require(_0xd2e9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd2e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39348a,_0x322168,_0x5b89ae){return new BPromise(function(_0xff9ffb,_0x232eab){return client[_0xd2e9('0xa')](_0x39348a,_0x5b89ae)[_0xd2e9('0xb')](function(_0x269f5d){logger['info'](_0xd2e9('0xc'),_0x322168,_0xd2e9('0xd'));logger[_0xd2e9('0xe')](_0xd2e9('0xf'),_0x322168,'request\x20sent',JSON[_0xd2e9('0x10')](_0x269f5d));if(_0x269f5d[_0xd2e9('0x11')]){if(_0x269f5d[_0xd2e9('0x11')][_0xd2e9('0x12')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x322168,_0x269f5d[_0xd2e9('0x11')][_0xd2e9('0x13')]);return _0x232eab(_0x269f5d[_0xd2e9('0x11')][_0xd2e9('0x13')]);}logger[_0xd2e9('0x11')](_0xd2e9('0xc'),_0x322168,_0x269f5d[_0xd2e9('0x11')][_0xd2e9('0x13')]);return _0xff9ffb(_0x269f5d[_0xd2e9('0x11')][_0xd2e9('0x13')]);}else{logger[_0xd2e9('0x14')](_0xd2e9('0xc'),_0x322168,'request\x20sent');_0xff9ffb(_0x269f5d[_0xd2e9('0x15')]['message']);}})[_0xd2e9('0x16')](function(_0x1d5dde){logger[_0xd2e9('0x11')](_0xd2e9('0xc'),_0x322168,_0x1d5dde);_0x232eab(_0x1d5dde);});});} \ No newline at end of file +var _0x39e1=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','ioredis'];(function(_0x39b86c,_0x5a8b64){var _0x120b7a=function(_0x3478f7){while(--_0x3478f7){_0x39b86c['push'](_0x39b86c['shift']());}};_0x120b7a(++_0x5a8b64);}(_0x39e1,0xf9));var _0x139e=function(_0x4f0cfd,_0x2e0eb3){_0x4f0cfd=_0x4f0cfd-0x0;var _0x525f02=_0x39e1[_0x4f0cfd];return _0x525f02;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x139e('0x0'));var BPromise=require(_0x139e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x139e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x139e('0x3'));var logger=require(_0x139e('0x4'))('rpc');var config=require(_0x139e('0x5'));var jayson=require(_0x139e('0x6'));var client=jayson[_0x139e('0x7')][_0x139e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43f49c,_0x579e5e,_0xac09b6){return new BPromise(function(_0x56eb15,_0x2b3ae6){return client[_0x139e('0x9')](_0x43f49c,_0xac09b6)[_0x139e('0xa')](function(_0x4eb941){logger[_0x139e('0xb')](_0x139e('0xc'),_0x579e5e,_0x139e('0xd'));logger[_0x139e('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x579e5e,_0x139e('0xd'),JSON[_0x139e('0xf')](_0x4eb941));if(_0x4eb941[_0x139e('0x10')]){if(_0x4eb941[_0x139e('0x10')][_0x139e('0x11')]===0x1f4){logger[_0x139e('0x10')](_0x139e('0xc'),_0x579e5e,_0x4eb941['error'][_0x139e('0x12')]);return _0x2b3ae6(_0x4eb941[_0x139e('0x10')][_0x139e('0x12')]);}logger[_0x139e('0x10')](_0x139e('0xc'),_0x579e5e,_0x4eb941[_0x139e('0x10')][_0x139e('0x12')]);return _0x56eb15(_0x4eb941[_0x139e('0x10')][_0x139e('0x12')]);}else{logger[_0x139e('0xb')](_0x139e('0xc'),_0x579e5e,_0x139e('0xd'));_0x56eb15(_0x4eb941[_0x139e('0x13')][_0x139e('0x12')]);}})[_0x139e('0x14')](function(_0x45486b){logger[_0x139e('0x10')](_0x139e('0xc'),_0x579e5e,_0x45486b);_0x2b3ae6(_0x45486b);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index c797508..f6fe7ad 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 _0x3a6d=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0xa199bb,_0x442bd6){var _0x3b7da6=function(_0x3fa1d9){while(--_0x3fa1d9){_0xa199bb['push'](_0xa199bb['shift']());}};_0x3b7da6(++_0x442bd6);}(_0x3a6d,0x143));var _0xd3a6=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x3a6d[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var path=require('path');var timeout=require(_0xd3a6('0x2'));var express=require(_0xd3a6('0x3'));var router=express[_0xd3a6('0x4')]();var auth=require(_0xd3a6('0x5'));var interaction=require(_0xd3a6('0x6'));var config=require('../../config/environment');var controller=require(_0xd3a6('0x7'));router[_0xd3a6('0x8')]('/',auth[_0xd3a6('0x9')](),controller[_0xd3a6('0xa')]);router[_0xd3a6('0x8')](_0xd3a6('0xb'),auth['isAuthenticated'](),controller[_0xd3a6('0xc')]);router[_0xd3a6('0xd')]('/',auth[_0xd3a6('0x9')](),controller[_0xd3a6('0xe')]);router[_0xd3a6('0xf')](_0xd3a6('0xb'),auth[_0xd3a6('0x9')](),controller[_0xd3a6('0x10')]);router[_0xd3a6('0x11')]('/:id',auth[_0xd3a6('0x9')](),controller[_0xd3a6('0x12')]);module[_0xd3a6('0x13')]=router; \ No newline at end of file +var _0x0adf=['post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','isAuthenticated','show'];(function(_0x4f9acb,_0x2d9b1d){var _0x363dcd=function(_0x4414b4){while(--_0x4414b4){_0x4f9acb['push'](_0x4f9acb['shift']());}};_0x363dcd(++_0x2d9b1d);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x35e9cc,_0x4be673){_0x35e9cc=_0x35e9cc-0x0;var _0x4203f1=_0x0adf[_0x35e9cc];return _0x4203f1;};'use strict';var multer=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var path=require(_0xf0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0ad('0x3'));var router=express[_0xf0ad('0x4')]();var auth=require(_0xf0ad('0x5'));var interaction=require(_0xf0ad('0x6'));var config=require(_0xf0ad('0x7'));var controller=require(_0xf0ad('0x8'));router[_0xf0ad('0x9')]('/',auth['isAuthenticated'](),controller[_0xf0ad('0xa')]);router['get'](_0xf0ad('0xb'),auth[_0xf0ad('0xc')](),controller[_0xf0ad('0xd')]);router[_0xf0ad('0xe')]('/',auth[_0xf0ad('0xc')](),controller[_0xf0ad('0xf')]);router[_0xf0ad('0x10')]('/:id',auth[_0xf0ad('0xc')](),controller['update']);router[_0xf0ad('0x11')](_0xf0ad('0xb'),auth[_0xf0ad('0xc')](),controller[_0xf0ad('0x12')]);module[_0xf0ad('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 1ff9e1d..61ab838 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 _0xf61e=['string','STRING','variable','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0xf61e,0x82));var _0xef61=function(_0x1d4921,_0x5ef98a){_0x1d4921=_0x1d4921-0x0;var _0x45ac85=_0xf61e[_0x1d4921];return _0x45ac85;};'use strict';var Sequelize=require(_0xef61('0x0'));module[_0xef61('0x1')]={'type':{'type':Sequelize[_0xef61('0x2')]('string','variable',_0xef61('0x3'),_0xef61('0x4')),'defaultValue':_0xef61('0x5')},'content':{'type':Sequelize[_0xef61('0x6')]},'key':{'type':Sequelize[_0xef61('0x6')]},'keyType':{'type':Sequelize[_0xef61('0x2')](_0xef61('0x5'),_0xef61('0x7'),_0xef61('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xef61('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xef61('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xef61('0x6')]}}; \ No newline at end of file +var _0x34e2=['sequelize','ENUM','string','STRING','variable','BOOLEAN'];(function(_0x35ff86,_0xc18b87){var _0xeeecdb=function(_0x100670){while(--_0x100670){_0x35ff86['push'](_0x35ff86['shift']());}};_0xeeecdb(++_0xc18b87);}(_0x34e2,0x126));var _0x234e=function(_0x2683e5,_0x3f8e61){_0x2683e5=_0x2683e5-0x0;var _0x259021=_0x34e2[_0x2683e5];return _0x259021;};'use strict';var Sequelize=require(_0x234e('0x0'));module['exports']={'type':{'type':Sequelize[_0x234e('0x1')](_0x234e('0x2'),'variable','customVariable','keyValue'),'defaultValue':_0x234e('0x2')},'content':{'type':Sequelize[_0x234e('0x3')]},'key':{'type':Sequelize[_0x234e('0x3')]},'keyType':{'type':Sequelize['ENUM']('string',_0x234e('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x234e('0x3')]},'idField':{'type':Sequelize[_0x234e('0x3')]},'nameField':{'type':Sequelize[_0x234e('0x3')]},'customField':{'type':Sequelize[_0x234e('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x234e('0x3')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 693083f..5e151e8 100644 --- a/server/api/intZohoField/intZohoField.controller.js +++ b/server/api/intZohoField/intZohoField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x1f1837,_0x4b304e){var _0x25ab57=function(_0x4dec8c){while(--_0x4dec8c){_0x1f1837['push'](_0x1f1837['shift']());}};_0x25ab57(++_0x4b304e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x23929d,_0x2d8984){var _0x52d817=function(_0x45ef82){while(--_0x45ef82){_0x23929d['push'](_0x23929d['shift']());}};_0x52d817(++_0x2d8984);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 7969c8c..0266842 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 _0x3221=['../../config/logger','moment','bluebird','request-promise','path','./intZohoField.attributes','define','ZohoField','FieldId'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x3221,0x87));var _0x1322=function(_0x562f57,_0x476a6d){_0x562f57=_0x562f57-0x0;var _0x5e699f=_0x3221[_0x562f57];return _0x5e699f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1322('0x0'))('api');var moment=require(_0x1322('0x1'));var BPromise=require(_0x1322('0x2'));var rp=require(_0x1322('0x3'));var fs=require('fs');var path=require(_0x1322('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1322('0x5'));module['exports']=function(_0x11d100,_0x4bf493){return _0x11d100[_0x1322('0x6')](_0x1322('0x7'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x1322('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7785=['int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','./intZohoField.attributes','exports','define','ZohoField'];(function(_0x4aa604,_0x19ebc8){var _0x301f30=function(_0x175747){while(--_0x175747){_0x4aa604['push'](_0x4aa604['shift']());}};_0x301f30(++_0x19ebc8);}(_0x7785,0xe4));var _0x5778=function(_0xdb4619,_0x60f394){_0xdb4619=_0xdb4619-0x0;var _0xa3894f=_0x7785[_0xdb4619];return _0xa3894f;};'use strict';var _=require(_0x5778('0x0'));var util=require('util');var logger=require(_0x5778('0x1'))(_0x5778('0x2'));var moment=require('moment');var BPromise=require(_0x5778('0x3'));var rp=require(_0x5778('0x4'));var fs=require('fs');var path=require(_0x5778('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5778('0x6'));module[_0x5778('0x7')]=function(_0x2e03fa,_0x24786a){return _0x2e03fa[_0x5778('0x8')](_0x5778('0x9'),attributes,{'tableName':_0x5778('0xa'),'paranoid':![],'indexes':[{'name':_0x5778('0xb'),'fields':[_0x5778('0xc'),_0x5778('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 95a3bab..0b0a4dc 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 _0xe5b3=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZohoField,\x20%s,\x20%s'];(function(_0x57411a,_0x59328f){var _0xd487ba=function(_0x2fb456){while(--_0x2fb456){_0x57411a['push'](_0x57411a['shift']());}};_0xd487ba(++_0x59328f);}(_0xe5b3,0x133));var _0x3e5b=function(_0x122031,_0x3c231a){_0x122031=_0x122031-0x0;var _0x26b8e9=_0xe5b3[_0x122031];return _0x26b8e9;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('ZohoField,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('ZohoField,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file +var _0xeec6=['then','info','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3c4062,_0x3767fc){var _0x3f5bf3=function(_0x105e55){while(--_0x105e55){_0x3c4062['push'](_0x3c4062['shift']());}};_0x3f5bf3(++_0x3767fc);}(_0xeec6,0x1c2));var _0x6eec=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0xeec6[_0x118653];return _0xc11fa6;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){return client['request'](_0x48064a,_0x1c810e)[_0x6eec('0xc')](function(_0x3aca38){logger[_0x6eec('0xd')]('ZohoField,\x20%s,\x20%s',_0x5a5e47,'request\x20sent');logger['debug'](_0x6eec('0xe'),_0x5a5e47,_0x6eec('0xf'),JSON['stringify'](_0x3aca38));if(_0x3aca38['error']){if(_0x3aca38[_0x6eec('0x10')]['code']===0x1f4){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x834c2(_0x3aca38[_0x6eec('0x10')]['message']);}logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x3443c2(_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);}else{logger[_0x6eec('0xd')](_0x6eec('0x11'),_0x5a5e47,_0x6eec('0xf'));_0x3443c2(_0x3aca38[_0x6eec('0x13')]['message']);}})[_0x6eec('0x14')](function(_0x5f1f33){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x5f1f33);_0x834c2(_0x5f1f33);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 028cbac..301f311 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 _0x82a2=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x50fe9f,_0xaf05b2){var _0x5dcb37=function(_0x3ffb00){while(--_0x3ffb00){_0x50fe9f['push'](_0x50fe9f['shift']());}};_0x5dcb37(++_0xaf05b2);}(_0x82a2,0x1e8));var _0x282a=function(_0x5c689a,_0x511782){_0x5c689a=_0x5c689a-0x0;var _0xb9bd1b=_0x82a2[_0x5c689a];return _0xb9bd1b;};'use strict';var multer=require(_0x282a('0x0'));var util=require(_0x282a('0x1'));var path=require(_0x282a('0x2'));var timeout=require(_0x282a('0x3'));var express=require(_0x282a('0x4'));var router=express[_0x282a('0x5')]();var auth=require(_0x282a('0x6'));var interaction=require(_0x282a('0x7'));var config=require(_0x282a('0x8'));module[_0x282a('0x9')]=router; \ No newline at end of file +var _0x1a04=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','util','connect-timeout'];(function(_0x2ba4e6,_0x101413){var _0x5cc4ac=function(_0x7a8b5b){while(--_0x7a8b5b){_0x2ba4e6['push'](_0x2ba4e6['shift']());}};_0x5cc4ac(++_0x101413);}(_0x1a04,0xc9));var _0x41a0=function(_0x5047c8,_0x3cb660){_0x5047c8=_0x5047c8-0x0;var _0x23afb1=_0x1a04[_0x5047c8];return _0x23afb1;};'use strict';var multer=require('multer');var util=require(_0x41a0('0x0'));var path=require('path');var timeout=require(_0x41a0('0x1'));var express=require(_0x41a0('0x2'));var router=express[_0x41a0('0x3')]();var auth=require(_0x41a0('0x4'));var interaction=require(_0x41a0('0x5'));var config=require(_0x41a0('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 98b7c89..a29b1a6 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 _0xb44a=['exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize'];(function(_0x236485,_0x273657){var _0x1d70e4=function(_0x45556c){while(--_0x45556c){_0x236485['push'](_0x236485['shift']());}};_0x1d70e4(++_0x273657);}(_0xb44a,0xf7));var _0xab44=function(_0x4ef77b,_0x6a3df){_0x4ef77b=_0x4ef77b-0x0;var _0x58d1a6=_0xb44a[_0x4ef77b];return _0x58d1a6;};'use strict';var Sequelize=require(_0xab44('0x0'));module[_0xab44('0x1')]={'name':{'type':Sequelize[_0xab44('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xab44('0x2')],'allowNull':![],'unique':_0xab44('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xab44('0x4')},'filename':{'type':Sequelize[_0xab44('0x2')]},'path':{'type':Sequelize[_0xab44('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xab44('0x5')]},'active':{'type':Sequelize[_0xab44('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xab44('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0xab44('0x7')},'description':{'type':Sequelize[_0xab44('0x2')]},'title':{'type':Sequelize[_0xab44('0x2')]},'remoteUri':{'type':Sequelize[_0xab44('0x2')]},'link':{'type':Sequelize[_0xab44('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x57c4=['STRING','unique_name_and_version','app.js','BOOLEAN','sequelize','exports'];(function(_0x5e1fb6,_0xf3495b){var _0x2cf20e=function(_0x4e51b4){while(--_0x4e51b4){_0x5e1fb6['push'](_0x5e1fb6['shift']());}};_0x2cf20e(++_0xf3495b);}(_0x57c4,0x100));var _0x457c=function(_0x5a30e2,_0x1c8019){_0x5a30e2=_0x5a30e2-0x0;var _0x4bb675=_0x57c4[_0x5a30e2];return _0x4bb675;};'use strict';var Sequelize=require(_0x457c('0x0'));module[_0x457c('0x1')]={'name':{'type':Sequelize[_0x457c('0x2')],'allowNull':![],'unique':_0x457c('0x3')},'version':{'type':Sequelize[_0x457c('0x2')],'allowNull':![],'unique':_0x457c('0x3')},'main':{'type':Sequelize[_0x457c('0x2')],'defaultValue':_0x457c('0x4')},'filename':{'type':Sequelize[_0x457c('0x2')]},'path':{'type':Sequelize[_0x457c('0x2')]},'type':{'type':Sequelize[_0x457c('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x457c('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x457c('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x457c('0x2')]},'title':{'type':Sequelize[_0x457c('0x2')]},'remoteUri':{'type':Sequelize[_0x457c('0x2')]},'link':{'type':Sequelize[_0x457c('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 810e5e1..f01a73a 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 _0xbf97=['end','sendStatus','stack','name','send','map','rawAttributes','type','key','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Integration','includeAll','include','findAll','rows','show','params','keys','intersection','find','catch','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','apply','reject','update','then','destroy'];(function(_0x2742e1,_0x3ebe50){var _0x4723d7=function(_0x410af7){while(--_0x410af7){_0x2742e1['push'](_0x2742e1['shift']());}};_0x4723d7(++_0x3ebe50);}(_0xbf97,0x69));var _0x7bf9=function(_0x1e3fbe,_0x271ec0){_0x1e3fbe=_0x1e3fbe-0x0;var _0x529c0a=_0xbf97[_0x1e3fbe];return _0x529c0a;};'use strict';var pdf=require(_0x7bf9('0x0'));var emlformat=require(_0x7bf9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7bf9('0x2'));var jsonpatch=require(_0x7bf9('0x3'));var rp=require(_0x7bf9('0x4'));var moment=require(_0x7bf9('0x5'));var BPromise=require(_0x7bf9('0x6'));var Mustache=require(_0x7bf9('0x7'));var util=require('util');var path=require(_0x7bf9('0x8'));var sox=require(_0x7bf9('0x9'));var csv=require(_0x7bf9('0xa'));var ejs=require(_0x7bf9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7bf9('0xc'));var crypto=require(_0x7bf9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7bf9('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bf9('0xf'));var Redis=require('ioredis');var authService=require(_0x7bf9('0x10'));var qs=require(_0x7bf9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7bf9('0x12'))(_0x7bf9('0x13'));var utils=require(_0x7bf9('0x14'));var config=require(_0x7bf9('0x15'));var db=require(_0x7bf9('0x16'))['db'];function respondWithStatusCode(_0x195da5,_0x4ab973){_0x4ab973=_0x4ab973||0xcc;return function(_0x3e939e){if(_0x3e939e){return _0x195da5['sendStatus'](_0x4ab973);}return _0x195da5[_0x7bf9('0x17')](_0x4ab973)['end']();};}function respondWithResult(_0x38f547,_0x4ab307){_0x4ab307=_0x4ab307||0xc8;return function(_0x56b547){if(_0x56b547){return _0x38f547[_0x7bf9('0x17')](_0x4ab307)[_0x7bf9('0x18')](_0x56b547);}};}function respondWithFilteredResult(_0x12ca11,_0x2dfeab){return function(_0x3b8e66){if(_0x3b8e66){var _0x1e24c4=_0x3b8e66[_0x7bf9('0x19')],_0x54f4c4=_0x2dfeab[_0x7bf9('0x1a')],_0x298afb=_0x2dfeab[_0x7bf9('0x1a')]+_0x2dfeab[_0x7bf9('0x1b')],_0x2900db;if(_0x298afb>=_0x1e24c4){_0x298afb=_0x1e24c4;_0x2900db=0xc8;}else{_0x2900db=0xce;}_0x12ca11[_0x7bf9('0x17')](_0x2900db);return _0x12ca11['set']('Content-Range',_0x54f4c4+'-'+_0x298afb+'/'+_0x1e24c4)[_0x7bf9('0x18')](_0x3b8e66);}return null;};}function patchUpdates(_0x3763f9){return function(_0x27139f){try{jsonpatch[_0x7bf9('0x1c')](_0x27139f,_0x3763f9,!![]);}catch(_0x3035f5){return BPromise[_0x7bf9('0x1d')](_0x3035f5);}return _0x27139f['save']();};}function saveUpdates(_0x81cdf9,_0x152069){return function(_0x2edeea){if(_0x2edeea){return _0x2edeea[_0x7bf9('0x1e')](_0x81cdf9)[_0x7bf9('0x1f')](function(_0x5beb15){return _0x5beb15;});}return null;};}function removeEntity(_0x4f2c88,_0x1ab834){return function(_0x3c27e2){if(_0x3c27e2){return _0x3c27e2[_0x7bf9('0x20')]()[_0x7bf9('0x1f')](function(){_0x4f2c88[_0x7bf9('0x17')](0xcc)[_0x7bf9('0x21')]();});}};}function handleEntityNotFound(_0x47f5be,_0xb3ab40){return function(_0x137eab){if(!_0x137eab){_0x47f5be[_0x7bf9('0x22')](0x194);}return _0x137eab;};}function handleError(_0x5cfdb1,_0x5d53dc){_0x5d53dc=_0x5d53dc||0x1f4;return function(_0x3aa2c7){logger['error'](_0x3aa2c7[_0x7bf9('0x23')]);if(_0x3aa2c7[_0x7bf9('0x24')]){delete _0x3aa2c7[_0x7bf9('0x24')];}_0x5cfdb1[_0x7bf9('0x17')](_0x5d53dc)[_0x7bf9('0x25')](_0x3aa2c7);};}exports['index']=function(_0x5a7a61,_0x532332){var _0x566d51={},_0x33eb0d={},_0x116546={'count':0x0,'rows':[]};var _0x169f9e=_[_0x7bf9('0x26')](db['Integration'][_0x7bf9('0x27')],function(_0x491c45){return{'name':_0x491c45['fieldName'],'type':_0x491c45[_0x7bf9('0x28')][_0x7bf9('0x29')]};});_0x33eb0d['model']=_[_0x7bf9('0x26')](_0x169f9e,'name');_0x33eb0d[_0x7bf9('0x2a')]=_['keys'](_0x5a7a61[_0x7bf9('0x2a')]);_0x33eb0d[_0x7bf9('0x2b')]=_['intersection'](_0x33eb0d[_0x7bf9('0x2c')],_0x33eb0d['query']);_0x566d51['attributes']=_['intersection'](_0x33eb0d['model'],qs[_0x7bf9('0x2d')](_0x5a7a61[_0x7bf9('0x2a')]['fields']));_0x566d51['attributes']=_0x566d51[_0x7bf9('0x2e')][_0x7bf9('0x2f')]?_0x566d51[_0x7bf9('0x2e')]:_0x33eb0d[_0x7bf9('0x2c')];if(!_0x5a7a61[_0x7bf9('0x2a')][_0x7bf9('0x30')](_0x7bf9('0x31'))){_0x566d51[_0x7bf9('0x1b')]=qs['limit'](_0x5a7a61[_0x7bf9('0x2a')][_0x7bf9('0x1b')]);_0x566d51[_0x7bf9('0x1a')]=qs['offset'](_0x5a7a61[_0x7bf9('0x2a')]['offset']);}_0x566d51['order']=qs[_0x7bf9('0x32')](_0x5a7a61[_0x7bf9('0x2a')][_0x7bf9('0x32')]);_0x566d51[_0x7bf9('0x33')]=qs[_0x7bf9('0x2b')](_[_0x7bf9('0x34')](_0x5a7a61[_0x7bf9('0x2a')],_0x33eb0d[_0x7bf9('0x2b')]),_0x169f9e);if(_0x5a7a61[_0x7bf9('0x2a')][_0x7bf9('0x35')]){_0x566d51[_0x7bf9('0x33')]=_[_0x7bf9('0x36')](_0x566d51[_0x7bf9('0x33')],{'$or':_['map'](_0x169f9e,function(_0xbf2279){if(_0xbf2279[_0x7bf9('0x28')]!=='VIRTUAL'){var _0x2f938d={};_0x2f938d[_0xbf2279[_0x7bf9('0x24')]]={'$like':'%'+_0x5a7a61[_0x7bf9('0x2a')][_0x7bf9('0x35')]+'%'};return _0x2f938d;}})});}_0x566d51=_['merge']({},_0x566d51,_0x5a7a61[_0x7bf9('0x37')]);var _0x3611cd={'where':_0x566d51['where']};return db[_0x7bf9('0x38')][_0x7bf9('0x19')](_0x3611cd)[_0x7bf9('0x1f')](function(_0x3efdec){_0x116546[_0x7bf9('0x19')]=_0x3efdec;if(_0x5a7a61['query'][_0x7bf9('0x39')]){_0x566d51[_0x7bf9('0x3a')]=[{'all':!![]}];}return db[_0x7bf9('0x38')][_0x7bf9('0x3b')](_0x566d51);})[_0x7bf9('0x1f')](function(_0x59e306){_0x116546[_0x7bf9('0x3c')]=_0x59e306;return _0x116546;})[_0x7bf9('0x1f')](respondWithFilteredResult(_0x532332,_0x566d51))['catch'](handleError(_0x532332,null));};exports[_0x7bf9('0x3d')]=function(_0x509a46,_0x307203){var _0x471200={'raw':![],'where':{'id':_0x509a46[_0x7bf9('0x3e')]['id']}},_0x393742={};_0x393742[_0x7bf9('0x2c')]=_[_0x7bf9('0x3f')](db[_0x7bf9('0x38')]['rawAttributes']);_0x393742[_0x7bf9('0x2a')]=_[_0x7bf9('0x3f')](_0x509a46[_0x7bf9('0x2a')]);_0x393742[_0x7bf9('0x2b')]=_['intersection'](_0x393742['model'],_0x393742['query']);_0x471200['attributes']=_[_0x7bf9('0x40')](_0x393742[_0x7bf9('0x2c')],qs[_0x7bf9('0x2d')](_0x509a46[_0x7bf9('0x2a')][_0x7bf9('0x2d')]));_0x471200[_0x7bf9('0x2e')]=_0x471200[_0x7bf9('0x2e')][_0x7bf9('0x2f')]?_0x471200[_0x7bf9('0x2e')]:_0x393742[_0x7bf9('0x2c')];if(_0x509a46[_0x7bf9('0x2a')][_0x7bf9('0x39')]){_0x471200[_0x7bf9('0x3a')]=[{'all':!![]}];}_0x471200=_[_0x7bf9('0x36')]({},_0x471200,_0x509a46[_0x7bf9('0x37')]);return db[_0x7bf9('0x38')][_0x7bf9('0x41')](_0x471200)['then'](handleEntityNotFound(_0x307203,null))[_0x7bf9('0x1f')](respondWithResult(_0x307203,null))[_0x7bf9('0x42')](handleError(_0x307203,null));};exports[_0x7bf9('0x43')]=function(_0x11a90c,_0x39aeb0){return db['Integration']['create'](_0x11a90c[_0x7bf9('0x44')],{})[_0x7bf9('0x1f')](respondWithResult(_0x39aeb0,0xc9))[_0x7bf9('0x42')](handleError(_0x39aeb0,null));};exports['update']=function(_0x5ad1ea,_0x36c7e2){if(_0x5ad1ea[_0x7bf9('0x44')]['id']){delete _0x5ad1ea[_0x7bf9('0x44')]['id'];}return db['Integration'][_0x7bf9('0x41')]({'where':{'id':_0x5ad1ea['params']['id']}})[_0x7bf9('0x1f')](handleEntityNotFound(_0x36c7e2,null))[_0x7bf9('0x1f')](saveUpdates(_0x5ad1ea['body'],null))[_0x7bf9('0x1f')](respondWithResult(_0x36c7e2,null))[_0x7bf9('0x42')](handleError(_0x36c7e2,null));};exports[_0x7bf9('0x20')]=function(_0x3a7ab4,_0x2e38e7){return db[_0x7bf9('0x38')]['find']({'where':{'id':_0x3a7ab4['params']['id']}})[_0x7bf9('0x1f')](handleEntityNotFound(_0x2e38e7,null))[_0x7bf9('0x1f')](removeEntity(_0x2e38e7,null))[_0x7bf9('0x42')](handleError(_0x2e38e7,null));}; \ No newline at end of file +var _0xc6a4=['options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','error','name','map','Integration','fieldName','type','key','model','keys','intersection','attributes','fields','query','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x4aaedd,_0x1d997d){var _0x3b6de5=function(_0x2e4ffa){while(--_0x2e4ffa){_0x4aaedd['push'](_0x4aaedd['shift']());}};_0x3b6de5(++_0x1d997d);}(_0xc6a4,0x1e7));var _0x4c6a=function(_0x114cac,_0xef0d8d){_0x114cac=_0x114cac-0x0;var _0x504594=_0xc6a4[_0x114cac];return _0x504594;};'use strict';var pdf=require(_0x4c6a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4c6a('0x1'));var zipdir=require(_0x4c6a('0x2'));var jsonpatch=require(_0x4c6a('0x3'));var rp=require(_0x4c6a('0x4'));var moment=require(_0x4c6a('0x5'));var BPromise=require(_0x4c6a('0x6'));var Mustache=require(_0x4c6a('0x7'));var util=require(_0x4c6a('0x8'));var path=require(_0x4c6a('0x9'));var sox=require(_0x4c6a('0xa'));var csv=require(_0x4c6a('0xb'));var ejs=require(_0x4c6a('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4c6a('0xd'));var deskjs=require(_0x4c6a('0xe'));var toCsv=require(_0x4c6a('0xb'));var querystring=require('querystring');var Papa=require(_0x4c6a('0xf'));var Redis=require(_0x4c6a('0x10'));var authService=require(_0x4c6a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4c6a('0x12'));var hardwareService=require(_0x4c6a('0x13'));var logger=require(_0x4c6a('0x14'))(_0x4c6a('0x15'));var utils=require('../../config/utils');var config=require(_0x4c6a('0x16'));var db=require(_0x4c6a('0x17'))['db'];function respondWithStatusCode(_0x36a62c,_0x437a83){_0x437a83=_0x437a83||0xcc;return function(_0x49dbae){if(_0x49dbae){return _0x36a62c[_0x4c6a('0x18')](_0x437a83);}return _0x36a62c[_0x4c6a('0x19')](_0x437a83)[_0x4c6a('0x1a')]();};}function respondWithResult(_0x48b87d,_0x13b263){_0x13b263=_0x13b263||0xc8;return function(_0x267b5d){if(_0x267b5d){return _0x48b87d[_0x4c6a('0x19')](_0x13b263)[_0x4c6a('0x1b')](_0x267b5d);}};}function respondWithFilteredResult(_0x50e7fb,_0x53b769){return function(_0xa71659){if(_0xa71659){var _0x2c276c=_0xa71659[_0x4c6a('0x1c')],_0x26ffe9=_0x53b769[_0x4c6a('0x1d')],_0x4de857=_0x53b769['offset']+_0x53b769[_0x4c6a('0x1e')],_0x21673f;if(_0x4de857>=_0x2c276c){_0x4de857=_0x2c276c;_0x21673f=0xc8;}else{_0x21673f=0xce;}_0x50e7fb[_0x4c6a('0x19')](_0x21673f);return _0x50e7fb['set']('Content-Range',_0x26ffe9+'-'+_0x4de857+'/'+_0x2c276c)['json'](_0xa71659);}return null;};}function patchUpdates(_0x422c7d){return function(_0x49174d){try{jsonpatch[_0x4c6a('0x1f')](_0x49174d,_0x422c7d,!![]);}catch(_0x506dcd){return BPromise[_0x4c6a('0x20')](_0x506dcd);}return _0x49174d[_0x4c6a('0x21')]();};}function saveUpdates(_0x51194a,_0x49f762){return function(_0x35958d){if(_0x35958d){return _0x35958d['update'](_0x51194a)[_0x4c6a('0x22')](function(_0x176b38){return _0x176b38;});}return null;};}function removeEntity(_0xede2ac,_0x27be60){return function(_0x4ab4a9){if(_0x4ab4a9){return _0x4ab4a9['destroy']()[_0x4c6a('0x22')](function(){_0xede2ac[_0x4c6a('0x19')](0xcc)[_0x4c6a('0x1a')]();});}};}function handleEntityNotFound(_0x2f7df4,_0x350b30){return function(_0x3583d8){if(!_0x3583d8){_0x2f7df4[_0x4c6a('0x18')](0x194);}return _0x3583d8;};}function handleError(_0x279fb1,_0x475e6d){_0x475e6d=_0x475e6d||0x1f4;return function(_0x119793){logger[_0x4c6a('0x23')](_0x119793['stack']);if(_0x119793[_0x4c6a('0x24')]){delete _0x119793[_0x4c6a('0x24')];}_0x279fb1[_0x4c6a('0x19')](_0x475e6d)['send'](_0x119793);};}exports['index']=function(_0x782f6b,_0x575ca9){var _0x323a09={},_0xe26cb4={},_0x441cd8={'count':0x0,'rows':[]};var _0x1ca422=_[_0x4c6a('0x25')](db[_0x4c6a('0x26')]['rawAttributes'],function(_0x1bb0f3){return{'name':_0x1bb0f3[_0x4c6a('0x27')],'type':_0x1bb0f3[_0x4c6a('0x28')][_0x4c6a('0x29')]};});_0xe26cb4[_0x4c6a('0x2a')]=_['map'](_0x1ca422,_0x4c6a('0x24'));_0xe26cb4['query']=_[_0x4c6a('0x2b')](_0x782f6b['query']);_0xe26cb4['filters']=_[_0x4c6a('0x2c')](_0xe26cb4[_0x4c6a('0x2a')],_0xe26cb4['query']);_0x323a09[_0x4c6a('0x2d')]=_[_0x4c6a('0x2c')](_0xe26cb4['model'],qs[_0x4c6a('0x2e')](_0x782f6b[_0x4c6a('0x2f')][_0x4c6a('0x2e')]));_0x323a09['attributes']=_0x323a09[_0x4c6a('0x2d')]['length']?_0x323a09[_0x4c6a('0x2d')]:_0xe26cb4['model'];if(!_0x782f6b['query']['hasOwnProperty'](_0x4c6a('0x30'))){_0x323a09['limit']=qs[_0x4c6a('0x1e')](_0x782f6b['query']['limit']);_0x323a09[_0x4c6a('0x1d')]=qs['offset'](_0x782f6b[_0x4c6a('0x2f')]['offset']);}_0x323a09[_0x4c6a('0x31')]=qs[_0x4c6a('0x32')](_0x782f6b[_0x4c6a('0x2f')][_0x4c6a('0x32')]);_0x323a09[_0x4c6a('0x33')]=qs[_0x4c6a('0x34')](_[_0x4c6a('0x35')](_0x782f6b['query'],_0xe26cb4[_0x4c6a('0x34')]),_0x1ca422);if(_0x782f6b[_0x4c6a('0x2f')][_0x4c6a('0x36')]){_0x323a09[_0x4c6a('0x33')]=_[_0x4c6a('0x37')](_0x323a09[_0x4c6a('0x33')],{'$or':_[_0x4c6a('0x25')](_0x1ca422,function(_0x28a3bd){if(_0x28a3bd['type']!==_0x4c6a('0x38')){var _0x5ac979={};_0x5ac979[_0x28a3bd[_0x4c6a('0x24')]]={'$like':'%'+_0x782f6b[_0x4c6a('0x2f')]['filter']+'%'};return _0x5ac979;}})});}_0x323a09=_['merge']({},_0x323a09,_0x782f6b[_0x4c6a('0x39')]);var _0x3de91a={'where':_0x323a09[_0x4c6a('0x33')]};return db['Integration']['count'](_0x3de91a)[_0x4c6a('0x22')](function(_0x38a3e8){_0x441cd8[_0x4c6a('0x1c')]=_0x38a3e8;if(_0x782f6b[_0x4c6a('0x2f')][_0x4c6a('0x3a')]){_0x323a09[_0x4c6a('0x3b')]=[{'all':!![]}];}return db[_0x4c6a('0x26')][_0x4c6a('0x3c')](_0x323a09);})[_0x4c6a('0x22')](function(_0x18766b){_0x441cd8[_0x4c6a('0x3d')]=_0x18766b;return _0x441cd8;})[_0x4c6a('0x22')](respondWithFilteredResult(_0x575ca9,_0x323a09))[_0x4c6a('0x3e')](handleError(_0x575ca9,null));};exports[_0x4c6a('0x3f')]=function(_0x4969a6,_0x495607){var _0x436cf={'raw':![],'where':{'id':_0x4969a6[_0x4c6a('0x40')]['id']}},_0x31a09c={};_0x31a09c['model']=_['keys'](db['Integration'][_0x4c6a('0x41')]);_0x31a09c[_0x4c6a('0x2f')]=_[_0x4c6a('0x2b')](_0x4969a6[_0x4c6a('0x2f')]);_0x31a09c[_0x4c6a('0x34')]=_[_0x4c6a('0x2c')](_0x31a09c[_0x4c6a('0x2a')],_0x31a09c[_0x4c6a('0x2f')]);_0x436cf[_0x4c6a('0x2d')]=_[_0x4c6a('0x2c')](_0x31a09c['model'],qs['fields'](_0x4969a6[_0x4c6a('0x2f')][_0x4c6a('0x2e')]));_0x436cf[_0x4c6a('0x2d')]=_0x436cf[_0x4c6a('0x2d')]['length']?_0x436cf[_0x4c6a('0x2d')]:_0x31a09c[_0x4c6a('0x2a')];if(_0x4969a6['query'][_0x4c6a('0x3a')]){_0x436cf[_0x4c6a('0x3b')]=[{'all':!![]}];}_0x436cf=_[_0x4c6a('0x37')]({},_0x436cf,_0x4969a6[_0x4c6a('0x39')]);return db[_0x4c6a('0x26')][_0x4c6a('0x42')](_0x436cf)[_0x4c6a('0x22')](handleEntityNotFound(_0x495607,null))['then'](respondWithResult(_0x495607,null))[_0x4c6a('0x3e')](handleError(_0x495607,null));};exports['create']=function(_0x8cbb54,_0xd9ec96){return db[_0x4c6a('0x26')]['create'](_0x8cbb54[_0x4c6a('0x43')],{})[_0x4c6a('0x22')](respondWithResult(_0xd9ec96,0xc9))['catch'](handleError(_0xd9ec96,null));};exports['update']=function(_0x3cc5bc,_0x2e3a49){if(_0x3cc5bc[_0x4c6a('0x43')]['id']){delete _0x3cc5bc[_0x4c6a('0x43')]['id'];}return db[_0x4c6a('0x26')][_0x4c6a('0x42')]({'where':{'id':_0x3cc5bc[_0x4c6a('0x40')]['id']}})[_0x4c6a('0x22')](handleEntityNotFound(_0x2e3a49,null))[_0x4c6a('0x22')](saveUpdates(_0x3cc5bc[_0x4c6a('0x43')],null))['then'](respondWithResult(_0x2e3a49,null))['catch'](handleError(_0x2e3a49,null));};exports['destroy']=function(_0x221204,_0xd3aed7){return db['Integration'][_0x4c6a('0x42')]({'where':{'id':_0x221204['params']['id']}})[_0x4c6a('0x22')](handleEntityNotFound(_0xd3aed7,null))[_0x4c6a('0x22')](removeEntity(_0xd3aed7,null))['catch'](handleError(_0xd3aed7,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index bc70706..b759fa5 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 _0x4ca7=['integrations','lodash','util','../../config/logger','api','bluebird','request-promise','path','./integration.attributes','exports','define'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x4ca7,0x14b));var _0x74ca=function(_0x51f9e6,_0x2caddb){_0x51f9e6=_0x51f9e6-0x0;var _0x29905d=_0x4ca7[_0x51f9e6];return _0x29905d;};'use strict';var _=require(_0x74ca('0x0'));var util=require(_0x74ca('0x1'));var logger=require(_0x74ca('0x2'))(_0x74ca('0x3'));var moment=require('moment');var BPromise=require(_0x74ca('0x4'));var rp=require(_0x74ca('0x5'));var fs=require('fs');var path=require(_0x74ca('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x74ca('0x7'));module[_0x74ca('0x8')]=function(_0x79d477,_0x506b7e){return _0x79d477[_0x74ca('0x9')]('Integration',attributes,{'tableName':_0x74ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2651=['exports','integrations','lodash','api','moment','bluebird','../../config/environment','./integration.attributes'];(function(_0x1bfe2b,_0x34856e){var _0x1477d4=function(_0x1d558c){while(--_0x1d558c){_0x1bfe2b['push'](_0x1bfe2b['shift']());}};_0x1477d4(++_0x34856e);}(_0x2651,0x1a2));var _0x1265=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x2651[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x1265('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1265('0x1'));var moment=require(_0x1265('0x2'));var BPromise=require(_0x1265('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1265('0x4'));var attributes=require(_0x1265('0x5'));module[_0x1265('0x6')]=function(_0x214061,_0x598389){return _0x214061['define']('Integration',attributes,{'tableName':_0x1265('0x7'),'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 badbbbf..fa074a6 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 _0xd89f=['then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0xd2da85,_0x40056b){var _0x2fe824=function(_0x6cc195){while(--_0x6cc195){_0xd2da85['push'](_0xd2da85['shift']());}};_0x2fe824(++_0x40056b);}(_0xd89f,0x191));var _0xfd89=function(_0x154b29,_0x387940){_0x154b29=_0x154b29-0x0;var _0x507e8d=_0xd89f[_0x154b29];return _0x507e8d;};'use strict';var _=require(_0xfd89('0x0'));var util=require(_0xfd89('0x1'));var moment=require(_0xfd89('0x2'));var BPromise=require('bluebird');var rs=require(_0xfd89('0x3'));var fs=require('fs');var Redis=require(_0xfd89('0x4'));var db=require(_0xfd89('0x5'))['db'];var utils=require(_0xfd89('0x6'));var logger=require(_0xfd89('0x7'))(_0xfd89('0x8'));var config=require('../../config/environment');var jayson=require(_0xfd89('0x9'));var client=jayson[_0xfd89('0xa')][_0xfd89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31322a,_0x3745e2,_0x2c02ed){return new BPromise(function(_0x2cccba,_0x163b36){return client[_0xfd89('0xc')](_0x31322a,_0x2c02ed)[_0xfd89('0xd')](function(_0x3379d3){logger[_0xfd89('0xe')](_0xfd89('0xf'),_0x3745e2,_0xfd89('0x10'));logger[_0xfd89('0x11')]('Integration,\x20%s,\x20%s,\x20%s',_0x3745e2,_0xfd89('0x10'),JSON[_0xfd89('0x12')](_0x3379d3));if(_0x3379d3['error']){if(_0x3379d3['error'][_0xfd89('0x13')]===0x1f4){logger[_0xfd89('0x14')](_0xfd89('0xf'),_0x3745e2,_0x3379d3[_0xfd89('0x14')]['message']);return _0x163b36(_0x3379d3[_0xfd89('0x14')]['message']);}logger[_0xfd89('0x14')](_0xfd89('0xf'),_0x3745e2,_0x3379d3[_0xfd89('0x14')]['message']);return _0x2cccba(_0x3379d3['error']['message']);}else{logger[_0xfd89('0xe')](_0xfd89('0xf'),_0x3745e2,'request\x20sent');_0x2cccba(_0x3379d3['result'][_0xfd89('0x15')]);}})[_0xfd89('0x16')](function(_0x3e0363){logger['error']('Integration,\x20%s,\x20%s',_0x3745e2,_0x3e0363);_0x163b36(_0x3e0363);});});} \ No newline at end of file +var _0xb8ba=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb8ba,0x6d));var _0xab8b=function(_0x118b5e,_0x3567bc){_0x118b5e=_0x118b5e-0x0;var _0x1e6d84=_0xb8ba[_0x118b5e];return _0x1e6d84;};'use strict';var _=require(_0xab8b('0x0'));var util=require(_0xab8b('0x1'));var moment=require(_0xab8b('0x2'));var BPromise=require('bluebird');var rs=require(_0xab8b('0x3'));var fs=require('fs');var Redis=require(_0xab8b('0x4'));var db=require(_0xab8b('0x5'))['db'];var utils=require(_0xab8b('0x6'));var logger=require(_0xab8b('0x7'))(_0xab8b('0x8'));var config=require(_0xab8b('0x9'));var jayson=require(_0xab8b('0xa'));var client=jayson['client'][_0xab8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5300bf,_0x1121e2,_0x57f8ba){return new BPromise(function(_0x233bfd,_0xb1ec1e){return client[_0xab8b('0xc')](_0x5300bf,_0x57f8ba)['then'](function(_0x5215cd){logger[_0xab8b('0xd')](_0xab8b('0xe'),_0x1121e2,_0xab8b('0xf'));logger[_0xab8b('0x10')](_0xab8b('0x11'),_0x1121e2,_0xab8b('0xf'),JSON[_0xab8b('0x12')](_0x5215cd));if(_0x5215cd[_0xab8b('0x13')]){if(_0x5215cd[_0xab8b('0x13')][_0xab8b('0x14')]===0x1f4){logger[_0xab8b('0x13')]('Integration,\x20%s,\x20%s',_0x1121e2,_0x5215cd[_0xab8b('0x13')][_0xab8b('0x15')]);return _0xb1ec1e(_0x5215cd['error'][_0xab8b('0x15')]);}logger[_0xab8b('0x13')](_0xab8b('0xe'),_0x1121e2,_0x5215cd['error']['message']);return _0x233bfd(_0x5215cd[_0xab8b('0x13')][_0xab8b('0x15')]);}else{logger[_0xab8b('0xd')](_0xab8b('0xe'),_0x1121e2,_0xab8b('0xf'));_0x233bfd(_0x5215cd['result'][_0xab8b('0x15')]);}})['catch'](function(_0x5241b2){logger[_0xab8b('0x13')](_0xab8b('0xe'),_0x1121e2,_0x5241b2);_0xb1ec1e(_0x5241b2);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 2503c66..7cd8f7f 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 _0xde13=['delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','create','put','update'];(function(_0x5681b0,_0x2d2e35){var _0x2b9198=function(_0x382370){while(--_0x382370){_0x5681b0['push'](_0x5681b0['shift']());}};_0x2b9198(++_0x2d2e35);}(_0xde13,0x146));var _0x3de1=function(_0x4e3d67,_0x50a8c9){_0x4e3d67=_0x4e3d67-0x0;var _0x16530d=_0xde13[_0x4e3d67];return _0x16530d;};'use strict';var multer=require(_0x3de1('0x0'));var util=require(_0x3de1('0x1'));var path=require(_0x3de1('0x2'));var timeout=require(_0x3de1('0x3'));var express=require(_0x3de1('0x4'));var router=express['Router']();var auth=require(_0x3de1('0x5'));var interaction=require(_0x3de1('0x6'));var config=require(_0x3de1('0x7'));var controller=require('./integrationReport.controller');router[_0x3de1('0x8')]('/',auth['isAuthenticated'](),controller[_0x3de1('0x9')]);router[_0x3de1('0x8')](_0x3de1('0xa'),auth[_0x3de1('0xb')](),controller['describe']);router[_0x3de1('0x8')](_0x3de1('0xc'),auth[_0x3de1('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3de1('0xd')]);router[_0x3de1('0xe')](_0x3de1('0xc'),auth['isAuthenticated'](),controller[_0x3de1('0xf')]);router[_0x3de1('0x10')](_0x3de1('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x3de1('0x11')]=router; \ No newline at end of file +var _0xde44=['../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','get','/describe','/:id','post','create','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x41926b,_0x502a39){var _0x2b40ee=function(_0x51fcc8){while(--_0x51fcc8){_0x41926b['push'](_0x41926b['shift']());}};_0x2b40ee(++_0x502a39);}(_0xde44,0x160));var _0x4de4=function(_0x5d4ac0,_0x1fd7c2){_0x5d4ac0=_0x5d4ac0-0x0;var _0x359260=_0xde44[_0x5d4ac0];return _0x359260;};'use strict';var multer=require(_0x4de4('0x0'));var util=require(_0x4de4('0x1'));var path=require(_0x4de4('0x2'));var timeout=require(_0x4de4('0x3'));var express=require('express');var router=express[_0x4de4('0x4')]();var auth=require(_0x4de4('0x5'));var interaction=require(_0x4de4('0x6'));var config=require(_0x4de4('0x7'));var controller=require(_0x4de4('0x8'));router['get']('/',auth[_0x4de4('0x9')](),controller['index']);router[_0x4de4('0xa')](_0x4de4('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x4de4('0xa')](_0x4de4('0xc'),auth[_0x4de4('0x9')](),controller['show']);router[_0x4de4('0xd')]('/',auth['isAuthenticated'](),controller[_0x4de4('0xe')]);router['put'](_0x4de4('0xc'),auth[_0x4de4('0x9')](),controller['update']);router[_0x4de4('0xf')](_0x4de4('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x4de4('0x10')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 24629d6..89799d3 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 _0x8431=['DATE','BOOLEAN','TEXT','SENT','RECEIVED','sequelize','exports','STRING','INTEGER'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0x8431,0x1c7));var _0x1843=function(_0x270947,_0x560217){_0x270947=_0x270947-0x0;var _0x506a51=_0x8431[_0x270947];return _0x506a51;};'use strict';var Sequelize=require(_0x1843('0x0'));module[_0x1843('0x1')]={'integration':{'type':Sequelize[_0x1843('0x2')]},'eventChannel':{'type':Sequelize[_0x1843('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x1843('0x2')]},'integrationId':{'type':Sequelize[_0x1843('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1843('0x2')]},'calleridnum':{'type':Sequelize[_0x1843('0x2')]},'calleridname':{'type':Sequelize[_0x1843('0x2')]},'queue':{'type':Sequelize[_0x1843('0x2')]},'interface':{'type':Sequelize[_0x1843('0x2')]},'membername':{'type':Sequelize[_0x1843('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x1843('0x4')]},'holdtime':{'type':Sequelize[_0x1843('0x3')]},'agentcomplete':{'type':Sequelize[_0x1843('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x1843('0x3')]},'agentacw':{'type':Sequelize[_0x1843('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x1843('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1843('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1843('0x4')]},'lastevent':{'type':Sequelize[_0x1843('0x2')]},'channel':{'type':Sequelize[_0x1843('0x2')]},'channelstate':{'type':Sequelize[_0x1843('0x3')]},'channelstatedesc':{'type':Sequelize[_0x1843('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1843('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1843('0x2')]},'accountcode':{'type':Sequelize[_0x1843('0x2')]},'context':{'type':Sequelize[_0x1843('0x2')]},'exten':{'type':Sequelize[_0x1843('0x2')]},'priority':{'type':Sequelize[_0x1843('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x1843('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x1843('0x2')]},'destcalleridnum':{'type':Sequelize[_0x1843('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x1843('0x2')]},'destlanguage':{'type':Sequelize[_0x1843('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x1843('0x2')]},'destpriority':{'type':Sequelize[_0x1843('0x2')]},'destuniqueid':{'type':Sequelize[_0x1843('0x2')]},'messageId':{'type':Sequelize[_0x1843('0x2')]},'inReplyTo':{'type':Sequelize[_0x1843('0x2')]},'subject':{'type':Sequelize[_0x1843('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x1843('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x1843('0x7'),'SENDING',_0x1843('0x8'),'FAILED')},'url':{'type':Sequelize[_0x1843('0x2')]},'app':{'type':Sequelize[_0x1843('0x2')]},'appdata':{'type':Sequelize[_0x1843('0x2')]},'projectId':{'type':Sequelize[_0x1843('0x3')]}}; \ No newline at end of file +var _0x23a6=['BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize','STRING','INTEGER','DATE'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x23a6,0x164));var _0x623a=function(_0x2ce584,_0x18fc6c){_0x2ce584=_0x2ce584-0x0;var _0x311200=_0x23a6[_0x2ce584];return _0x311200;};'use strict';var Sequelize=require(_0x623a('0x0'));module['exports']={'integration':{'type':Sequelize[_0x623a('0x1')]},'eventChannel':{'type':Sequelize[_0x623a('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x623a('0x1')]},'integrationId':{'type':Sequelize[_0x623a('0x2')]},'contacts':{'type':Sequelize[_0x623a('0x1')]},'uniqueid':{'type':Sequelize[_0x623a('0x1')]},'calleridnum':{'type':Sequelize[_0x623a('0x1')]},'calleridname':{'type':Sequelize[_0x623a('0x1')]},'queue':{'type':Sequelize[_0x623a('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x623a('0x1')]},'agentcalledAt':{'type':Sequelize[_0x623a('0x3')]},'agentconnectAt':{'type':Sequelize[_0x623a('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x623a('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x623a('0x2')]},'agentacw':{'type':Sequelize[_0x623a('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x623a('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x623a('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x623a('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x623a('0x3')]},'lastevent':{'type':Sequelize[_0x623a('0x1')]},'channel':{'type':Sequelize[_0x623a('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x623a('0x1')]},'connectedlinenum':{'type':Sequelize[_0x623a('0x1')]},'connectedlinename':{'type':Sequelize[_0x623a('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x623a('0x1')]},'context':{'type':Sequelize[_0x623a('0x1')]},'exten':{'type':Sequelize[_0x623a('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x623a('0x1')]},'destchannelstate':{'type':Sequelize[_0x623a('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x623a('0x1')]},'destcalleridnum':{'type':Sequelize[_0x623a('0x1')]},'destcalleridname':{'type':Sequelize[_0x623a('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x623a('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x623a('0x1')]},'destaccountcode':{'type':Sequelize[_0x623a('0x1')]},'destcontext':{'type':Sequelize[_0x623a('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x623a('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x623a('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x623a('0x1')]},'from':{'type':Sequelize[_0x623a('0x1')]},'to':{'type':Sequelize[_0x623a('0x1')]},'cc':{'type':Sequelize[_0x623a('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x623a('0x5')]},'text':{'type':Sequelize[_0x623a('0x5')]},'status':{'type':Sequelize[_0x623a('0x6')](_0x623a('0x7'),_0x623a('0x8'),_0x623a('0x9'),'FAILED')},'url':{'type':Sequelize[_0x623a('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x623a('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 32a215f..40a5b67 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 _0xf575=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','error','name','index','map','IntegrationReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','then','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xf575,0x1b8));var _0x5f57=function(_0x48a32e,_0x42c992){_0x48a32e=_0x48a32e-0x0;var _0x15fbc9=_0xf575[_0x48a32e];return _0x15fbc9;};'use strict';var pdf=require(_0x5f57('0x0'));var emlformat=require(_0x5f57('0x1'));var rimraf=require(_0x5f57('0x2'));var zipdir=require(_0x5f57('0x3'));var jsonpatch=require(_0x5f57('0x4'));var rp=require(_0x5f57('0x5'));var moment=require('moment');var BPromise=require(_0x5f57('0x6'));var Mustache=require(_0x5f57('0x7'));var util=require('util');var path=require(_0x5f57('0x8'));var sox=require(_0x5f57('0x9'));var csv=require(_0x5f57('0xa'));var ejs=require(_0x5f57('0xb'));var fs=require('fs');var _=require(_0x5f57('0xc'));var squel=require(_0x5f57('0xd'));var crypto=require(_0x5f57('0xe'));var jsforce=require(_0x5f57('0xf'));var deskjs=require(_0x5f57('0x10'));var toCsv=require(_0x5f57('0xa'));var querystring=require('querystring');var Papa=require(_0x5f57('0x11'));var Redis=require('ioredis');var authService=require(_0x5f57('0x12'));var qs=require(_0x5f57('0x13'));var as=require(_0x5f57('0x14'));var hardwareService=require(_0x5f57('0x15'));var logger=require(_0x5f57('0x16'))(_0x5f57('0x17'));var utils=require(_0x5f57('0x18'));var config=require('../../config/environment');var db=require(_0x5f57('0x19'))['db'];function respondWithStatusCode(_0x48c13d,_0x3fbc01){_0x3fbc01=_0x3fbc01||0xcc;return function(_0x21af18){if(_0x21af18){return _0x48c13d[_0x5f57('0x1a')](_0x3fbc01);}return _0x48c13d[_0x5f57('0x1b')](_0x3fbc01)[_0x5f57('0x1c')]();};}function respondWithResult(_0x3c5543,_0x1b3a4e){_0x1b3a4e=_0x1b3a4e||0xc8;return function(_0x50ffef){if(_0x50ffef){return _0x3c5543[_0x5f57('0x1b')](_0x1b3a4e)[_0x5f57('0x1d')](_0x50ffef);}};}function respondWithFilteredResult(_0x22b216,_0x1bc86d){return function(_0x55f058){if(_0x55f058){var _0x3fdd2a=_0x55f058[_0x5f57('0x1e')],_0x331556=_0x1bc86d['offset'],_0x57dfe2=_0x1bc86d[_0x5f57('0x1f')]+_0x1bc86d[_0x5f57('0x20')],_0x42e347;if(_0x57dfe2>=_0x3fdd2a){_0x57dfe2=_0x3fdd2a;_0x42e347=0xc8;}else{_0x42e347=0xce;}_0x22b216[_0x5f57('0x1b')](_0x42e347);return _0x22b216['set'](_0x5f57('0x21'),_0x331556+'-'+_0x57dfe2+'/'+_0x3fdd2a)[_0x5f57('0x1d')](_0x55f058);}return null;};}function patchUpdates(_0x280b3f){return function(_0x50835d){try{jsonpatch[_0x5f57('0x22')](_0x50835d,_0x280b3f,!![]);}catch(_0x25c160){return BPromise[_0x5f57('0x23')](_0x25c160);}return _0x50835d[_0x5f57('0x24')]();};}function saveUpdates(_0x4425e9,_0x38b1ca){return function(_0x11e74f){if(_0x11e74f){return _0x11e74f['update'](_0x4425e9)['then'](function(_0x2389d0){return _0x2389d0;});}return null;};}function removeEntity(_0x5318d5,_0x3d5b12){return function(_0x136429){if(_0x136429){return _0x136429['destroy']()['then'](function(){_0x5318d5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f22fe,_0x369267){return function(_0x2e34ca){if(!_0x2e34ca){_0x3f22fe[_0x5f57('0x1a')](0x194);}return _0x2e34ca;};}function handleError(_0x5b4d08,_0x593252){_0x593252=_0x593252||0x1f4;return function(_0x3022da){logger[_0x5f57('0x25')](_0x3022da['stack']);if(_0x3022da[_0x5f57('0x26')]){delete _0x3022da[_0x5f57('0x26')];}_0x5b4d08['status'](_0x593252)['send'](_0x3022da);};}exports[_0x5f57('0x27')]=function(_0x2d02ee,_0x36dfcb){var _0x2e3b06={},_0x2be442={},_0x395ec7={'count':0x0,'rows':[]};var _0x151ed1=_[_0x5f57('0x28')](db[_0x5f57('0x29')]['rawAttributes'],function(_0x15970d){return{'name':_0x15970d[_0x5f57('0x2a')],'type':_0x15970d[_0x5f57('0x2b')]['key']};});_0x2be442[_0x5f57('0x2c')]=_[_0x5f57('0x28')](_0x151ed1,'name');_0x2be442[_0x5f57('0x2d')]=_[_0x5f57('0x2e')](_0x2d02ee['query']);_0x2be442[_0x5f57('0x2f')]=_[_0x5f57('0x30')](_0x2be442[_0x5f57('0x2c')],_0x2be442['query']);_0x2e3b06[_0x5f57('0x31')]=_[_0x5f57('0x30')](_0x2be442[_0x5f57('0x2c')],qs[_0x5f57('0x32')](_0x2d02ee['query']['fields']));_0x2e3b06['attributes']=_0x2e3b06[_0x5f57('0x31')][_0x5f57('0x33')]?_0x2e3b06[_0x5f57('0x31')]:_0x2be442[_0x5f57('0x2c')];if(!_0x2d02ee[_0x5f57('0x2d')][_0x5f57('0x34')](_0x5f57('0x35'))){_0x2e3b06[_0x5f57('0x20')]=qs['limit'](_0x2d02ee[_0x5f57('0x2d')][_0x5f57('0x20')]);_0x2e3b06[_0x5f57('0x1f')]=qs[_0x5f57('0x1f')](_0x2d02ee['query'][_0x5f57('0x1f')]);}_0x2e3b06[_0x5f57('0x36')]=qs[_0x5f57('0x37')](_0x2d02ee[_0x5f57('0x2d')][_0x5f57('0x37')]);_0x2e3b06[_0x5f57('0x38')]=qs[_0x5f57('0x2f')](_[_0x5f57('0x39')](_0x2d02ee[_0x5f57('0x2d')],_0x2be442[_0x5f57('0x2f')]),_0x151ed1);if(_0x2d02ee[_0x5f57('0x2d')]['filter']){_0x2e3b06[_0x5f57('0x38')]=_['merge'](_0x2e3b06['where'],{'$or':_[_0x5f57('0x28')](_0x151ed1,function(_0x1eed19){if(_0x1eed19[_0x5f57('0x2b')]!==_0x5f57('0x3a')){var _0xf492f5={};_0xf492f5[_0x1eed19[_0x5f57('0x26')]]={'$like':'%'+_0x2d02ee['query'][_0x5f57('0x3b')]+'%'};return _0xf492f5;}})});}_0x2e3b06=_[_0x5f57('0x3c')]({},_0x2e3b06,_0x2d02ee['options']);var _0x29072b={'where':_0x2e3b06[_0x5f57('0x38')]};return db[_0x5f57('0x29')][_0x5f57('0x1e')](_0x29072b)[_0x5f57('0x3d')](function(_0x17dc82){_0x395ec7[_0x5f57('0x1e')]=_0x17dc82;if(_0x2d02ee[_0x5f57('0x2d')]['includeAll']){_0x2e3b06[_0x5f57('0x3e')]=[{'all':!![]}];}return db['IntegrationReport'][_0x5f57('0x3f')](_0x2e3b06);})[_0x5f57('0x3d')](function(_0x762349){_0x395ec7[_0x5f57('0x40')]=_0x762349;return _0x395ec7;})['then'](respondWithFilteredResult(_0x36dfcb,_0x2e3b06))[_0x5f57('0x41')](handleError(_0x36dfcb,null));};exports[_0x5f57('0x42')]=function(_0x43b224,_0x39c193){var _0x35493e={'raw':![],'where':{'id':_0x43b224['params']['id']}},_0x52aa03={};_0x52aa03[_0x5f57('0x2c')]=_[_0x5f57('0x2e')](db[_0x5f57('0x29')][_0x5f57('0x43')]);_0x52aa03[_0x5f57('0x2d')]=_[_0x5f57('0x2e')](_0x43b224[_0x5f57('0x2d')]);_0x52aa03['filters']=_['intersection'](_0x52aa03[_0x5f57('0x2c')],_0x52aa03['query']);_0x35493e['attributes']=_['intersection'](_0x52aa03[_0x5f57('0x2c')],qs[_0x5f57('0x32')](_0x43b224['query'][_0x5f57('0x32')]));_0x35493e[_0x5f57('0x31')]=_0x35493e[_0x5f57('0x31')][_0x5f57('0x33')]?_0x35493e[_0x5f57('0x31')]:_0x52aa03[_0x5f57('0x2c')];if(_0x43b224[_0x5f57('0x2d')]['includeAll']){_0x35493e[_0x5f57('0x3e')]=[{'all':!![]}];}_0x35493e=_['merge']({},_0x35493e,_0x43b224[_0x5f57('0x44')]);return db['IntegrationReport'][_0x5f57('0x45')](_0x35493e)[_0x5f57('0x3d')](handleEntityNotFound(_0x39c193,null))[_0x5f57('0x3d')](respondWithResult(_0x39c193,null))[_0x5f57('0x41')](handleError(_0x39c193,null));};exports[_0x5f57('0x46')]=function(_0x3ee174,_0x21f2fa){return db[_0x5f57('0x29')][_0x5f57('0x46')](_0x3ee174[_0x5f57('0x47')],{})[_0x5f57('0x3d')](respondWithResult(_0x21f2fa,0xc9))[_0x5f57('0x41')](handleError(_0x21f2fa,null));};exports['update']=function(_0x733ff5,_0x16be9b){if(_0x733ff5['body']['id']){delete _0x733ff5[_0x5f57('0x47')]['id'];}return db[_0x5f57('0x29')]['find']({'where':{'id':_0x733ff5[_0x5f57('0x48')]['id']}})[_0x5f57('0x3d')](handleEntityNotFound(_0x16be9b,null))['then'](saveUpdates(_0x733ff5[_0x5f57('0x47')],null))['then'](respondWithResult(_0x16be9b,null))[_0x5f57('0x41')](handleError(_0x16be9b,null));};exports[_0x5f57('0x49')]=function(_0x2cd8be,_0x38dce8){return db['IntegrationReport']['find']({'where':{'id':_0x2cd8be['params']['id']}})[_0x5f57('0x3d')](handleEntityNotFound(_0x38dce8,null))[_0x5f57('0x3d')](removeEntity(_0x38dce8,null))[_0x5f57('0x41')](handleError(_0x38dce8,null));};exports[_0x5f57('0x4a')]=function(_0xfa769b,_0x148dd7){return db['IntegrationReport'][_0x5f57('0x4a')]()[_0x5f57('0x3d')](respondWithResult(_0x148dd7,null))[_0x5f57('0x41')](handleError(_0x148dd7,null));}; \ No newline at end of file +var _0x46f0=['include','findAll','catch','show','params','intersection','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','nolimit','sort','where','filter','merge','options','includeAll'];(function(_0x2fbaf9,_0x37fc52){var _0x17bb22=function(_0x1740de){while(--_0x1740de){_0x2fbaf9['push'](_0x2fbaf9['shift']());}};_0x17bb22(++_0x37fc52);}(_0x46f0,0xde));var _0x046f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x46f0[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0x046f('0x0'));var emlformat=require(_0x046f('0x1'));var rimraf=require(_0x046f('0x2'));var zipdir=require(_0x046f('0x3'));var jsonpatch=require(_0x046f('0x4'));var rp=require(_0x046f('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x046f('0x6'));var util=require(_0x046f('0x7'));var path=require(_0x046f('0x8'));var sox=require(_0x046f('0x9'));var csv=require(_0x046f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x046f('0xb'));var squel=require(_0x046f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x046f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x046f('0xe'));var Papa=require(_0x046f('0xf'));var Redis=require('ioredis');var authService=require(_0x046f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x046f('0x11'));var hardwareService=require(_0x046f('0x12'));var logger=require('../../config/logger')(_0x046f('0x13'));var utils=require(_0x046f('0x14'));var config=require(_0x046f('0x15'));var db=require(_0x046f('0x16'))['db'];function respondWithStatusCode(_0x7193b1,_0x549e39){_0x549e39=_0x549e39||0xcc;return function(_0xe71b38){if(_0xe71b38){return _0x7193b1[_0x046f('0x17')](_0x549e39);}return _0x7193b1[_0x046f('0x18')](_0x549e39)[_0x046f('0x19')]();};}function respondWithResult(_0x144308,_0x107dad){_0x107dad=_0x107dad||0xc8;return function(_0x4e3573){if(_0x4e3573){return _0x144308['status'](_0x107dad)[_0x046f('0x1a')](_0x4e3573);}};}function respondWithFilteredResult(_0x54e846,_0x589861){return function(_0x46e28e){if(_0x46e28e){var _0x4b155e=_0x46e28e[_0x046f('0x1b')],_0x15e59e=_0x589861['offset'],_0x18a4d1=_0x589861[_0x046f('0x1c')]+_0x589861[_0x046f('0x1d')],_0x48b122;if(_0x18a4d1>=_0x4b155e){_0x18a4d1=_0x4b155e;_0x48b122=0xc8;}else{_0x48b122=0xce;}_0x54e846[_0x046f('0x18')](_0x48b122);return _0x54e846[_0x046f('0x1e')](_0x046f('0x1f'),_0x15e59e+'-'+_0x18a4d1+'/'+_0x4b155e)[_0x046f('0x1a')](_0x46e28e);}return null;};}function patchUpdates(_0x1c35d5){return function(_0x37ae5d){try{jsonpatch[_0x046f('0x20')](_0x37ae5d,_0x1c35d5,!![]);}catch(_0x3946dc){return BPromise[_0x046f('0x21')](_0x3946dc);}return _0x37ae5d[_0x046f('0x22')]();};}function saveUpdates(_0x3f9a1d,_0x16b4d0){return function(_0x8ca5d){if(_0x8ca5d){return _0x8ca5d[_0x046f('0x23')](_0x3f9a1d)[_0x046f('0x24')](function(_0x5112fb){return _0x5112fb;});}return null;};}function removeEntity(_0xc8cc79,_0x4c7564){return function(_0x4f8cd6){if(_0x4f8cd6){return _0x4f8cd6[_0x046f('0x25')]()[_0x046f('0x24')](function(){_0xc8cc79[_0x046f('0x18')](0xcc)[_0x046f('0x19')]();});}};}function handleEntityNotFound(_0x546c2e,_0x32c6e8){return function(_0x477b6b){if(!_0x477b6b){_0x546c2e['sendStatus'](0x194);}return _0x477b6b;};}function handleError(_0x43447e,_0x270747){_0x270747=_0x270747||0x1f4;return function(_0x517664){logger[_0x046f('0x26')](_0x517664[_0x046f('0x27')]);if(_0x517664[_0x046f('0x28')]){delete _0x517664['name'];}_0x43447e['status'](_0x270747)[_0x046f('0x29')](_0x517664);};}exports['index']=function(_0x19a49f,_0x47fd1c){var _0x3fd067={},_0x142a41={},_0x1e7412={'count':0x0,'rows':[]};var _0x152f44=_[_0x046f('0x2a')](db[_0x046f('0x2b')][_0x046f('0x2c')],function(_0x1b7434){return{'name':_0x1b7434[_0x046f('0x2d')],'type':_0x1b7434[_0x046f('0x2e')][_0x046f('0x2f')]};});_0x142a41[_0x046f('0x30')]=_[_0x046f('0x2a')](_0x152f44,_0x046f('0x28'));_0x142a41['query']=_[_0x046f('0x31')](_0x19a49f[_0x046f('0x32')]);_0x142a41[_0x046f('0x33')]=_['intersection'](_0x142a41['model'],_0x142a41[_0x046f('0x32')]);_0x3fd067[_0x046f('0x34')]=_['intersection'](_0x142a41[_0x046f('0x30')],qs['fields'](_0x19a49f[_0x046f('0x32')][_0x046f('0x35')]));_0x3fd067[_0x046f('0x34')]=_0x3fd067[_0x046f('0x34')][_0x046f('0x36')]?_0x3fd067[_0x046f('0x34')]:_0x142a41['model'];if(!_0x19a49f[_0x046f('0x32')]['hasOwnProperty'](_0x046f('0x37'))){_0x3fd067[_0x046f('0x1d')]=qs['limit'](_0x19a49f[_0x046f('0x32')][_0x046f('0x1d')]);_0x3fd067[_0x046f('0x1c')]=qs[_0x046f('0x1c')](_0x19a49f[_0x046f('0x32')]['offset']);}_0x3fd067['order']=qs['sort'](_0x19a49f[_0x046f('0x32')][_0x046f('0x38')]);_0x3fd067[_0x046f('0x39')]=qs[_0x046f('0x33')](_['pick'](_0x19a49f[_0x046f('0x32')],_0x142a41[_0x046f('0x33')]),_0x152f44);if(_0x19a49f[_0x046f('0x32')][_0x046f('0x3a')]){_0x3fd067['where']=_[_0x046f('0x3b')](_0x3fd067[_0x046f('0x39')],{'$or':_['map'](_0x152f44,function(_0x14e7d9){if(_0x14e7d9[_0x046f('0x2e')]!=='VIRTUAL'){var _0x2cf009={};_0x2cf009[_0x14e7d9['name']]={'$like':'%'+_0x19a49f[_0x046f('0x32')][_0x046f('0x3a')]+'%'};return _0x2cf009;}})});}_0x3fd067=_[_0x046f('0x3b')]({},_0x3fd067,_0x19a49f[_0x046f('0x3c')]);var _0xb8769a={'where':_0x3fd067[_0x046f('0x39')]};return db[_0x046f('0x2b')][_0x046f('0x1b')](_0xb8769a)[_0x046f('0x24')](function(_0x5ed1ba){_0x1e7412[_0x046f('0x1b')]=_0x5ed1ba;if(_0x19a49f['query'][_0x046f('0x3d')]){_0x3fd067[_0x046f('0x3e')]=[{'all':!![]}];}return db['IntegrationReport'][_0x046f('0x3f')](_0x3fd067);})['then'](function(_0x387645){_0x1e7412['rows']=_0x387645;return _0x1e7412;})[_0x046f('0x24')](respondWithFilteredResult(_0x47fd1c,_0x3fd067))[_0x046f('0x40')](handleError(_0x47fd1c,null));};exports[_0x046f('0x41')]=function(_0x4e3476,_0x3861cc){var _0x5054d8={'raw':![],'where':{'id':_0x4e3476[_0x046f('0x42')]['id']}},_0xde2682={};_0xde2682[_0x046f('0x30')]=_['keys'](db[_0x046f('0x2b')]['rawAttributes']);_0xde2682[_0x046f('0x32')]=_[_0x046f('0x31')](_0x4e3476[_0x046f('0x32')]);_0xde2682[_0x046f('0x33')]=_[_0x046f('0x43')](_0xde2682[_0x046f('0x30')],_0xde2682[_0x046f('0x32')]);_0x5054d8[_0x046f('0x34')]=_[_0x046f('0x43')](_0xde2682[_0x046f('0x30')],qs[_0x046f('0x35')](_0x4e3476[_0x046f('0x32')][_0x046f('0x35')]));_0x5054d8[_0x046f('0x34')]=_0x5054d8[_0x046f('0x34')][_0x046f('0x36')]?_0x5054d8[_0x046f('0x34')]:_0xde2682[_0x046f('0x30')];if(_0x4e3476[_0x046f('0x32')][_0x046f('0x3d')]){_0x5054d8[_0x046f('0x3e')]=[{'all':!![]}];}_0x5054d8=_[_0x046f('0x3b')]({},_0x5054d8,_0x4e3476[_0x046f('0x3c')]);return db[_0x046f('0x2b')][_0x046f('0x44')](_0x5054d8)[_0x046f('0x24')](handleEntityNotFound(_0x3861cc,null))[_0x046f('0x24')](respondWithResult(_0x3861cc,null))[_0x046f('0x40')](handleError(_0x3861cc,null));};exports[_0x046f('0x45')]=function(_0x4e310c,_0x4fe65a){return db[_0x046f('0x2b')][_0x046f('0x45')](_0x4e310c[_0x046f('0x46')],{})[_0x046f('0x24')](respondWithResult(_0x4fe65a,0xc9))['catch'](handleError(_0x4fe65a,null));};exports[_0x046f('0x23')]=function(_0x454efe,_0x4850bd){if(_0x454efe[_0x046f('0x46')]['id']){delete _0x454efe[_0x046f('0x46')]['id'];}return db[_0x046f('0x2b')][_0x046f('0x44')]({'where':{'id':_0x454efe[_0x046f('0x42')]['id']}})[_0x046f('0x24')](handleEntityNotFound(_0x4850bd,null))[_0x046f('0x24')](saveUpdates(_0x454efe[_0x046f('0x46')],null))[_0x046f('0x24')](respondWithResult(_0x4850bd,null))[_0x046f('0x40')](handleError(_0x4850bd,null));};exports['destroy']=function(_0x8f8714,_0x50b165){return db[_0x046f('0x2b')][_0x046f('0x44')]({'where':{'id':_0x8f8714[_0x046f('0x42')]['id']}})[_0x046f('0x24')](handleEntityNotFound(_0x50b165,null))[_0x046f('0x24')](removeEntity(_0x50b165,null))['catch'](handleError(_0x50b165,null));};exports['describe']=function(_0x4fbe7e,_0x138286){return db['IntegrationReport']['describe']()[_0x046f('0x24')](respondWithResult(_0x138286,null))[_0x046f('0x40')](handleError(_0x138286,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 753e03a..db1aec6 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 _0xc409=['bluebird','rimraf','exports','define','util','api','moment'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xc409,0x123));var _0x9c40=function(_0x14b10f,_0x1db0f0){_0x14b10f=_0x14b10f-0x0;var _0x2f92bd=_0xc409[_0x14b10f];return _0x2f92bd;};'use strict';var _=require('lodash');var util=require(_0x9c40('0x0'));var logger=require('../../config/logger')(_0x9c40('0x1'));var moment=require(_0x9c40('0x2'));var BPromise=require(_0x9c40('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9c40('0x4'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x9c40('0x5')]=function(_0x26e178,_0x46f05d){return _0x26e178[_0x9c40('0x6')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa30=['util','moment','bluebird','path','rimraf','../../config/environment','exports','define','IntegrationReport','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa30,0x171));var _0x0aa3=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xaa30[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0aa3('0x0'));var util=require(_0x0aa3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0aa3('0x2'));var BPromise=require(_0x0aa3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0aa3('0x4'));var rimraf=require(_0x0aa3('0x5'));var config=require(_0x0aa3('0x6'));var attributes=require('./integrationReport.attributes');module[_0x0aa3('0x7')]=function(_0x2fc88a,_0x26d9d1){return _0x2fc88a[_0x0aa3('0x8')](_0x0aa3('0x9'),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 fbbd5bd..c4b1ce1 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 _0x9ffd=['IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x59e85e,_0x4e399b){var _0x34e955=function(_0xebbfce){while(--_0xebbfce){_0x59e85e['push'](_0x59e85e['shift']());}};_0x34e955(++_0x4e399b);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5b1e25,_0x52b896){_0x5b1e25=_0x5b1e25-0x0;var _0x5e117c=_0x9ffd[_0x5b1e25];return _0x5e117c;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('IntegrationReport,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('IntegrationReport,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0x0b0e=['IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0x0b0e,0x187));var _0xe0b0=function(_0x549b29,_0x2e2b00){_0x549b29=_0x549b29-0x0;var _0x2b813f=_0x0b0e[_0x549b29];return _0x2b813f;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index be088f6..f0db11d 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 _0x008c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout'];(function(_0x482651,_0x2ec77f){var _0x3ac8cd=function(_0x8d4669){while(--_0x8d4669){_0x482651['push'](_0x482651['shift']());}};_0x3ac8cd(++_0x2ec77f);}(_0x008c,0x188));var _0xc008=function(_0x3537e1,_0xbc7714){_0x3537e1=_0x3537e1-0x0;var _0x164a50=_0x008c[_0x3537e1];return _0x164a50;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xc008('0xf')]('/',auth[_0xc008('0xa')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0x11'),auth[_0xc008('0xa')](),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xc'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('0x15')]=router; \ No newline at end of file +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(_0x2e8b4f,_0x5295ae){var _0x3e7b41=function(_0x14ffd8){while(--_0x14ffd8){_0x2e8b4f['push'](_0x2e8b4f['shift']());}};_0x3e7b41(++_0x5295ae);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'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 3109e62..29bd073 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 _0xbd1e=['exports','STRING','sequelize'];(function(_0x1e74bd,_0x202042){var _0x53fc7e=function(_0x22db3b){while(--_0x22db3b){_0x1e74bd['push'](_0x1e74bd['shift']());}};_0x53fc7e(++_0x202042);}(_0xbd1e,0x14c));var _0xebd1=function(_0x46a3ff,_0x470b9a){_0x46a3ff=_0x46a3ff-0x0;var _0x404bc2=_0xbd1e[_0x46a3ff];return _0x404bc2;};'use strict';var Sequelize=require(_0xebd1('0x0'));module[_0xebd1('0x1')]={'name':{'type':Sequelize[_0xebd1('0x2')]},'description':{'type':Sequelize[_0xebd1('0x2')]},'interval':{'type':Sequelize[_0xebd1('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x1ef0=['exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1ef0,0xda));var _0x01ef=function(_0x617084,_0x27a65f){_0x617084=_0x617084-0x0;var _0x384ac0=_0x1ef0[_0x617084];return _0x384ac0;};'use strict';var Sequelize=require('sequelize');module[_0x01ef('0x0')]={'name':{'type':Sequelize[_0x01ef('0x1')]},'description':{'type':Sequelize[_0x01ef('0x1')]},'interval':{'type':Sequelize[_0x01ef('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 07a7177..c90854c 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 _0x6214=['status','end','count','offset','limit','set','Content-Range','json','apply','save','then','Intervals','UserProfileResource','stack','name','send','index','map','Interval','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','destroy','addInterval','getIntervals','nolimit','findOne','sequelize','transaction','IntervalId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','../../components/extensions/rewrite','sendStatus'];(function(_0x21d1b2,_0x593e69){var _0x417151=function(_0x12ae05){while(--_0x12ae05){_0x21d1b2['push'](_0x21d1b2['shift']());}};_0x417151(++_0x593e69);}(_0x6214,0xf7));var _0x4621=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0x6214[_0x43f881];return _0x365c14;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4621('0x0'));var rimraf=require(_0x4621('0x1'));var zipdir=require(_0x4621('0x2'));var jsonpatch=require(_0x4621('0x3'));var rp=require(_0x4621('0x4'));var moment=require('moment');var BPromise=require(_0x4621('0x5'));var Mustache=require(_0x4621('0x6'));var util=require(_0x4621('0x7'));var path=require(_0x4621('0x8'));var sox=require(_0x4621('0x9'));var csv=require(_0x4621('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4621('0xb'));var squel=require(_0x4621('0xc'));var crypto=require(_0x4621('0xd'));var jsforce=require(_0x4621('0xe'));var deskjs=require(_0x4621('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4621('0x10'));var Papa=require(_0x4621('0x11'));var Redis=require(_0x4621('0x12'));var authService=require(_0x4621('0x13'));var qs=require(_0x4621('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4621('0x15'));var logger=require(_0x4621('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4621('0x17'))['db'];var extensions=require(_0x4621('0x18'));function respondWithStatusCode(_0x1feb2d,_0x4d91cf){_0x4d91cf=_0x4d91cf||0xcc;return function(_0x4ef6c9){if(_0x4ef6c9){return _0x1feb2d[_0x4621('0x19')](_0x4d91cf);}return _0x1feb2d[_0x4621('0x1a')](_0x4d91cf)[_0x4621('0x1b')]();};}function respondWithResult(_0xff87d,_0x13628a){_0x13628a=_0x13628a||0xc8;return function(_0x4abb83){if(_0x4abb83){return _0xff87d['status'](_0x13628a)['json'](_0x4abb83);}};}function respondWithFilteredResult(_0x3ae287,_0x6889ce){return function(_0x10e8a7){if(_0x10e8a7){var _0x5c709c=_0x10e8a7[_0x4621('0x1c')],_0x483d4d=_0x6889ce[_0x4621('0x1d')],_0x46edb7=_0x6889ce['offset']+_0x6889ce[_0x4621('0x1e')],_0x20bf69;if(_0x46edb7>=_0x5c709c){_0x46edb7=_0x5c709c;_0x20bf69=0xc8;}else{_0x20bf69=0xce;}_0x3ae287[_0x4621('0x1a')](_0x20bf69);return _0x3ae287[_0x4621('0x1f')](_0x4621('0x20'),_0x483d4d+'-'+_0x46edb7+'/'+_0x5c709c)[_0x4621('0x21')](_0x10e8a7);}return null;};}function patchUpdates(_0x19dbad){return function(_0x337773){try{jsonpatch[_0x4621('0x22')](_0x337773,_0x19dbad,!![]);}catch(_0x433982){return BPromise['reject'](_0x433982);}return _0x337773[_0x4621('0x23')]();};}function saveUpdates(_0x103016,_0x2fdca8){return function(_0x1e320f){if(_0x1e320f){return _0x1e320f['update'](_0x103016)[_0x4621('0x24')](function(_0x2cd290){return _0x2cd290;});}return null;};}function removeEntity(_0x1202e3,_0x5df397){return function(_0x4cd37b){if(_0x4cd37b){return _0x4cd37b['destroy']()['then'](function(){var _0x36a69a=_0x4cd37b['get']({'plain':!![]});var _0x34ed5e=_0x4621('0x25');return db[_0x4621('0x26')]['destroy']({'where':{'type':_0x34ed5e,'resourceId':_0x36a69a['id']}})[_0x4621('0x24')](function(){return _0x4cd37b;});})[_0x4621('0x24')](function(){_0x1202e3[_0x4621('0x1a')](0xcc)[_0x4621('0x1b')]();});}};}function handleEntityNotFound(_0x1caff5,_0x29dc65){return function(_0x3cc0c9){if(!_0x3cc0c9){_0x1caff5[_0x4621('0x19')](0x194);}return _0x3cc0c9;};}function handleError(_0x3b8b65,_0x300c1b){_0x300c1b=_0x300c1b||0x1f4;return function(_0x4b9a3a){logger['error'](_0x4b9a3a[_0x4621('0x27')]);if(_0x4b9a3a[_0x4621('0x28')]){delete _0x4b9a3a['name'];}_0x3b8b65[_0x4621('0x1a')](_0x300c1b)[_0x4621('0x29')](_0x4b9a3a);};}exports[_0x4621('0x2a')]=function(_0x481ffe,_0x393929){var _0x4cef89={},_0x2861ad={},_0x19e4ac={'count':0x0,'rows':[]};var _0x5c9564=_[_0x4621('0x2b')](db[_0x4621('0x2c')]['rawAttributes'],function(_0x4fed48){return{'name':_0x4fed48[_0x4621('0x2d')],'type':_0x4fed48[_0x4621('0x2e')]['key']};});_0x2861ad[_0x4621('0x2f')]=_['map'](_0x5c9564,_0x4621('0x28'));_0x2861ad['query']=_[_0x4621('0x30')](_0x481ffe['query']);_0x2861ad[_0x4621('0x31')]=_[_0x4621('0x32')](_0x2861ad[_0x4621('0x2f')],_0x2861ad[_0x4621('0x33')]);_0x4cef89[_0x4621('0x34')]=_[_0x4621('0x32')](_0x2861ad[_0x4621('0x2f')],qs['fields'](_0x481ffe[_0x4621('0x33')][_0x4621('0x35')]));_0x4cef89[_0x4621('0x34')]=_0x4cef89[_0x4621('0x34')][_0x4621('0x36')]?_0x4cef89['attributes']:_0x2861ad[_0x4621('0x2f')];if(!_0x481ffe[_0x4621('0x33')][_0x4621('0x37')]('nolimit')){_0x4cef89[_0x4621('0x1e')]=qs[_0x4621('0x1e')](_0x481ffe[_0x4621('0x33')]['limit']);_0x4cef89['offset']=qs[_0x4621('0x1d')](_0x481ffe[_0x4621('0x33')][_0x4621('0x1d')]);}_0x4cef89[_0x4621('0x38')]=qs[_0x4621('0x39')](_0x481ffe['query']['sort']);_0x4cef89['where']=qs[_0x4621('0x31')](_[_0x4621('0x3a')](_0x481ffe['query'],_0x2861ad[_0x4621('0x31')]),_0x5c9564);if(_0x481ffe[_0x4621('0x33')][_0x4621('0x3b')]){_0x4cef89[_0x4621('0x3c')]=_[_0x4621('0x3d')](_0x4cef89[_0x4621('0x3c')],{'$or':_[_0x4621('0x2b')](_0x5c9564,function(_0x2dd22b){if(_0x2dd22b[_0x4621('0x2e')]!==_0x4621('0x3e')){var _0x19ad2f={};_0x19ad2f[_0x2dd22b['name']]={'$like':'%'+_0x481ffe[_0x4621('0x33')][_0x4621('0x3b')]+'%'};return _0x19ad2f;}})});}_0x4cef89=_[_0x4621('0x3d')]({},_0x4cef89,_0x481ffe[_0x4621('0x3f')]);var _0x2e40d4={'where':_0x4cef89[_0x4621('0x3c')]};return db[_0x4621('0x2c')][_0x4621('0x1c')](_0x2e40d4)[_0x4621('0x24')](function(_0x5cdd75){_0x19e4ac['count']=_0x5cdd75;if(_0x481ffe[_0x4621('0x33')][_0x4621('0x40')]){_0x4cef89[_0x4621('0x41')]=[{'all':!![]}];}return db[_0x4621('0x2c')][_0x4621('0x42')](_0x4cef89);})[_0x4621('0x24')](function(_0x3dd773){_0x19e4ac['rows']=_0x3dd773;return _0x19e4ac;})[_0x4621('0x24')](respondWithFilteredResult(_0x393929,_0x4cef89))[_0x4621('0x43')](handleError(_0x393929,null));};exports[_0x4621('0x44')]=function(_0x522649,_0x5cbd87){var _0x3f0fee={'raw':!![],'where':{'id':_0x522649['params']['id']}},_0x43a14d={};_0x43a14d[_0x4621('0x2f')]=_[_0x4621('0x30')](db[_0x4621('0x2c')][_0x4621('0x45')]);_0x43a14d['query']=_['keys'](_0x522649[_0x4621('0x33')]);_0x43a14d['filters']=_[_0x4621('0x32')](_0x43a14d[_0x4621('0x2f')],_0x43a14d[_0x4621('0x33')]);_0x3f0fee[_0x4621('0x34')]=_[_0x4621('0x32')](_0x43a14d['model'],qs[_0x4621('0x35')](_0x522649[_0x4621('0x33')][_0x4621('0x35')]));_0x3f0fee[_0x4621('0x34')]=_0x3f0fee[_0x4621('0x34')][_0x4621('0x36')]?_0x3f0fee[_0x4621('0x34')]:_0x43a14d[_0x4621('0x2f')];if(_0x522649['query'][_0x4621('0x40')]){_0x3f0fee[_0x4621('0x41')]=[{'all':!![]}];}_0x3f0fee=_[_0x4621('0x3d')]({},_0x3f0fee,_0x522649[_0x4621('0x3f')]);return db[_0x4621('0x2c')]['find'](_0x3f0fee)['then'](handleEntityNotFound(_0x5cbd87,null))[_0x4621('0x24')](respondWithResult(_0x5cbd87,null))['catch'](handleError(_0x5cbd87,null));};exports[_0x4621('0x46')]=function(_0x3f8896,_0x3a1f62){return db[_0x4621('0x2c')][_0x4621('0x46')](_0x3f8896['body'],{})[_0x4621('0x24')](function(_0x2aef8d){var _0x13f14c=_0x3f8896[_0x4621('0x47')]['get']({'plain':!![]});if(!_0x13f14c)throw new Error(_0x4621('0x48'));if(_0x13f14c['role']===_0x4621('0x47')){var _0x1ad5c0=_0x2aef8d[_0x4621('0x49')]({'plain':!![]});var _0x35ffb7=_0x4621('0x25');return db[_0x4621('0x4a')][_0x4621('0x4b')]({'where':{'name':_0x35ffb7,'userProfileId':_0x13f14c[_0x4621('0x4c')]},'raw':!![]})[_0x4621('0x24')](function(_0x5b7be0){if(_0x5b7be0&&_0x5b7be0[_0x4621('0x4d')]===0x0){return db[_0x4621('0x26')][_0x4621('0x46')]({'name':_0x1ad5c0['name'],'resourceId':_0x1ad5c0['id'],'type':_0x5b7be0[_0x4621('0x28')],'sectionId':_0x5b7be0['id']},{})[_0x4621('0x24')](function(){return _0x2aef8d;});}else{return _0x2aef8d;}})[_0x4621('0x43')](function(_0x5ed828){logger[_0x4621('0x4e')](_0x4621('0x4f'),_0x5ed828);throw _0x5ed828;});}return _0x2aef8d;})[_0x4621('0x24')](respondWithResult(_0x3a1f62,0xc9))[_0x4621('0x43')](handleError(_0x3a1f62,null));};exports[_0x4621('0x50')]=function(_0x3334bf,_0x13a4ad){if(_0x3334bf[_0x4621('0x51')]['id']){delete _0x3334bf['body']['id'];}return db[_0x4621('0x2c')][_0x4621('0x4b')]({'where':{'id':_0x3334bf[_0x4621('0x52')]['id']}})[_0x4621('0x24')](handleEntityNotFound(_0x13a4ad,null))[_0x4621('0x24')](saveUpdates(_0x3334bf[_0x4621('0x51')],null))[_0x4621('0x24')](respondWithResult(_0x13a4ad,null))[_0x4621('0x43')](handleError(_0x13a4ad,null));};exports[_0x4621('0x53')]=function(_0x2c616a,_0xafcae7){return db[_0x4621('0x2c')][_0x4621('0x4b')]({'where':{'id':_0x2c616a[_0x4621('0x52')]['id']}})[_0x4621('0x24')](handleEntityNotFound(_0xafcae7,null))['then'](removeEntity(_0xafcae7,null))[_0x4621('0x43')](handleError(_0xafcae7,null));};exports[_0x4621('0x54')]=function(_0x364498,_0x2fdc56,_0x1e1822){if(_0x364498[_0x4621('0x51')]['id']){delete _0x364498[_0x4621('0x51')]['id'];}return db[_0x4621('0x2c')][_0x4621('0x4b')]({'where':{'id':_0x364498[_0x4621('0x52')]['id']}})['then'](handleEntityNotFound(_0x2fdc56,null))[_0x4621('0x24')](function(_0x3becdc){if(_0x3becdc){_0x364498['body']['IntervalId']=_0x3becdc['id'];return db['Interval']['create'](_0x364498[_0x4621('0x51')]);}})['then'](respondWithResult(_0x2fdc56,null))[_0x4621('0x43')](handleError(_0x2fdc56,null));};exports[_0x4621('0x55')]=function(_0x405976,_0x1326c6,_0x4c5c40){var _0x4648d7={};var _0x2af681={};var _0x39f7e9;var _0x45ba84;return db['Interval']['findOne']({'where':{'id':_0x405976[_0x4621('0x52')]['id']}})['then'](handleEntityNotFound(_0x1326c6,null))[_0x4621('0x24')](function(_0x4827d0){if(_0x4827d0){_0x39f7e9=_0x4827d0;_0x2af681[_0x4621('0x2f')]=_[_0x4621('0x30')](db[_0x4621('0x2c')]['rawAttributes']);_0x2af681[_0x4621('0x33')]=_[_0x4621('0x30')](_0x405976['query']);_0x2af681[_0x4621('0x31')]=_[_0x4621('0x32')](_0x2af681['model'],_0x2af681['query']);_0x4648d7[_0x4621('0x34')]=_[_0x4621('0x32')](_0x2af681['model'],qs[_0x4621('0x35')](_0x405976[_0x4621('0x33')][_0x4621('0x35')]));_0x4648d7['attributes']=_0x4648d7[_0x4621('0x34')][_0x4621('0x36')]?_0x4648d7[_0x4621('0x34')]:_0x2af681[_0x4621('0x2f')];_0x4648d7['order']=qs['sort'](_0x405976[_0x4621('0x33')]['sort']);_0x4648d7[_0x4621('0x3c')]=qs[_0x4621('0x31')](_['pick'](_0x405976['query'],_0x2af681[_0x4621('0x31')]));if(_0x405976[_0x4621('0x33')]['filter']){_0x4648d7[_0x4621('0x3c')]=_[_0x4621('0x3d')](_0x4648d7[_0x4621('0x3c')],{'$or':_[_0x4621('0x2b')](_0x4648d7[_0x4621('0x34')],function(_0x56cbc1){var _0x8b6bed={};_0x8b6bed[_0x56cbc1]={'$like':'%'+_0x405976[_0x4621('0x33')][_0x4621('0x3b')]+'%'};return _0x8b6bed;})});}_0x4648d7=_[_0x4621('0x3d')]({},_0x4648d7,_0x405976[_0x4621('0x3f')]);return _0x39f7e9['getIntervals'](_0x4648d7);}})[_0x4621('0x24')](function(_0x2e4f1f){if(_0x2e4f1f){_0x45ba84=_0x2e4f1f[_0x4621('0x36')];if(!_0x405976[_0x4621('0x33')]['hasOwnProperty'](_0x4621('0x56'))){_0x4648d7[_0x4621('0x1e')]=qs[_0x4621('0x1e')](_0x405976['query'][_0x4621('0x1e')]);_0x4648d7['offset']=qs[_0x4621('0x1d')](_0x405976[_0x4621('0x33')][_0x4621('0x1d')]);}return _0x39f7e9[_0x4621('0x55')](_0x4648d7);}})[_0x4621('0x24')](function(_0x3607aa){if(_0x3607aa){return _0x3607aa?{'count':_0x45ba84,'rows':_0x3607aa}:null;}})[_0x4621('0x24')](respondWithResult(_0x1326c6,null))[_0x4621('0x43')](handleError(_0x1326c6,null));};exports['addIntervals']=function(_0x3d3e55,_0x22b1bf,_0x3791ea){return db[_0x4621('0x2c')][_0x4621('0x57')]({'where':{'id':_0x3d3e55[_0x4621('0x52')]['id']}})['then'](handleEntityNotFound(_0x22b1bf,null))[_0x4621('0x24')](function(_0x5600e8){if(_0x5600e8){return db[_0x4621('0x58')][_0x4621('0x59')](function(_0x4c9c7f){return db[_0x4621('0x2c')][_0x4621('0x53')]({'where':{'IntervalId':_0x3d3e55[_0x4621('0x52')]['id']},'transaction':_0x4c9c7f})[_0x4621('0x24')](function(_0x20a47f){var _0x91f8e4=_[_0x4621('0x2b')](_0x3d3e55[_0x4621('0x51')],function(_0x58e740){delete _0x58e740['id'];_0x58e740[_0x4621('0x5a')]=_0x3d3e55['params']['id'];return _0x58e740;});return db['Interval']['bulkCreate'](_0x91f8e4,{'transaction':_0x4c9c7f});});})[_0x4621('0x24')](function(){return db[_0x4621('0x2c')][_0x4621('0x42')]({'where':{'IntervalId':_0x3d3e55['params']['id']}});});}})[_0x4621('0x24')](respondWithResult(_0x22b1bf,null))[_0x4621('0x43')](handleError(_0x22b1bf,null));}; \ No newline at end of file +var _0xe1a2=['set','Content-Range','reject','save','update','then','Intervals','UserProfileResource','destroy','error','stack','name','send','map','Interval','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','addInterval','getIntervals','findOne','pick','sequelize','transaction','IntervalId','bulkCreate','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','offset'];(function(_0x5e765f,_0x2f0668){var _0x12cda6=function(_0x53cf9c){while(--_0x53cf9c){_0x5e765f['push'](_0x5e765f['shift']());}};_0x12cda6(++_0x2f0668);}(_0xe1a2,0x147));var _0x2e1a=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0xe1a2[_0x2ca616];return _0x53155f;};'use strict';var pdf=require(_0x2e1a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2e1a('0x1'));var zipdir=require(_0x2e1a('0x2'));var jsonpatch=require(_0x2e1a('0x3'));var rp=require(_0x2e1a('0x4'));var moment=require(_0x2e1a('0x5'));var BPromise=require(_0x2e1a('0x6'));var Mustache=require(_0x2e1a('0x7'));var util=require(_0x2e1a('0x8'));var path=require(_0x2e1a('0x9'));var sox=require(_0x2e1a('0xa'));var csv=require(_0x2e1a('0xb'));var ejs=require(_0x2e1a('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2e1a('0xd'));var jsforce=require(_0x2e1a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2e1a('0xb'));var querystring=require(_0x2e1a('0xf'));var Papa=require('papaparse');var Redis=require(_0x2e1a('0x10'));var authService=require(_0x2e1a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e1a('0x12'));var logger=require(_0x2e1a('0x13'))(_0x2e1a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2e1a('0x15'))['db'];var extensions=require(_0x2e1a('0x16'));function respondWithStatusCode(_0x1d296c,_0x3d1bf5){_0x3d1bf5=_0x3d1bf5||0xcc;return function(_0x564aeb){if(_0x564aeb){return _0x1d296c[_0x2e1a('0x17')](_0x3d1bf5);}return _0x1d296c[_0x2e1a('0x18')](_0x3d1bf5)[_0x2e1a('0x19')]();};}function respondWithResult(_0x1c4e2a,_0x428ac4){_0x428ac4=_0x428ac4||0xc8;return function(_0x5c1988){if(_0x5c1988){return _0x1c4e2a[_0x2e1a('0x18')](_0x428ac4)[_0x2e1a('0x1a')](_0x5c1988);}};}function respondWithFilteredResult(_0x52b3c4,_0x4d3c9b){return function(_0x15e138){if(_0x15e138){var _0x34431=_0x15e138[_0x2e1a('0x1b')],_0x5a9f54=_0x4d3c9b[_0x2e1a('0x1c')],_0x23dc58=_0x4d3c9b[_0x2e1a('0x1c')]+_0x4d3c9b['limit'],_0x1a6549;if(_0x23dc58>=_0x34431){_0x23dc58=_0x34431;_0x1a6549=0xc8;}else{_0x1a6549=0xce;}_0x52b3c4[_0x2e1a('0x18')](_0x1a6549);return _0x52b3c4[_0x2e1a('0x1d')](_0x2e1a('0x1e'),_0x5a9f54+'-'+_0x23dc58+'/'+_0x34431)[_0x2e1a('0x1a')](_0x15e138);}return null;};}function patchUpdates(_0x50a7f8){return function(_0x3c08ec){try{jsonpatch['apply'](_0x3c08ec,_0x50a7f8,!![]);}catch(_0x5c0e12){return BPromise[_0x2e1a('0x1f')](_0x5c0e12);}return _0x3c08ec[_0x2e1a('0x20')]();};}function saveUpdates(_0x50489f,_0x2cb952){return function(_0x1e56ca){if(_0x1e56ca){return _0x1e56ca[_0x2e1a('0x21')](_0x50489f)[_0x2e1a('0x22')](function(_0x292e75){return _0x292e75;});}return null;};}function removeEntity(_0x263f2a,_0x16e981){return function(_0x11d9c8){if(_0x11d9c8){return _0x11d9c8['destroy']()[_0x2e1a('0x22')](function(){var _0x169505=_0x11d9c8['get']({'plain':!![]});var _0x25dde1=_0x2e1a('0x23');return db[_0x2e1a('0x24')][_0x2e1a('0x25')]({'where':{'type':_0x25dde1,'resourceId':_0x169505['id']}})[_0x2e1a('0x22')](function(){return _0x11d9c8;});})[_0x2e1a('0x22')](function(){_0x263f2a['status'](0xcc)[_0x2e1a('0x19')]();});}};}function handleEntityNotFound(_0x534cf7,_0x51b328){return function(_0x594713){if(!_0x594713){_0x534cf7['sendStatus'](0x194);}return _0x594713;};}function handleError(_0xec66a8,_0x53abee){_0x53abee=_0x53abee||0x1f4;return function(_0x4cb60f){logger[_0x2e1a('0x26')](_0x4cb60f[_0x2e1a('0x27')]);if(_0x4cb60f[_0x2e1a('0x28')]){delete _0x4cb60f['name'];}_0xec66a8[_0x2e1a('0x18')](_0x53abee)[_0x2e1a('0x29')](_0x4cb60f);};}exports['index']=function(_0x74d74f,_0x45ce29){var _0x42a6a7={},_0x205832={},_0x4ee151={'count':0x0,'rows':[]};var _0xc838ef=_[_0x2e1a('0x2a')](db[_0x2e1a('0x2b')][_0x2e1a('0x2c')],function(_0x3e1437){return{'name':_0x3e1437[_0x2e1a('0x2d')],'type':_0x3e1437[_0x2e1a('0x2e')]['key']};});_0x205832['model']=_[_0x2e1a('0x2a')](_0xc838ef,_0x2e1a('0x28'));_0x205832[_0x2e1a('0x2f')]=_[_0x2e1a('0x30')](_0x74d74f['query']);_0x205832['filters']=_[_0x2e1a('0x31')](_0x205832[_0x2e1a('0x32')],_0x205832[_0x2e1a('0x2f')]);_0x42a6a7[_0x2e1a('0x33')]=_[_0x2e1a('0x31')](_0x205832[_0x2e1a('0x32')],qs[_0x2e1a('0x34')](_0x74d74f['query']['fields']));_0x42a6a7[_0x2e1a('0x33')]=_0x42a6a7[_0x2e1a('0x33')][_0x2e1a('0x35')]?_0x42a6a7[_0x2e1a('0x33')]:_0x205832[_0x2e1a('0x32')];if(!_0x74d74f[_0x2e1a('0x2f')][_0x2e1a('0x36')](_0x2e1a('0x37'))){_0x42a6a7[_0x2e1a('0x38')]=qs[_0x2e1a('0x38')](_0x74d74f[_0x2e1a('0x2f')][_0x2e1a('0x38')]);_0x42a6a7['offset']=qs[_0x2e1a('0x1c')](_0x74d74f['query'][_0x2e1a('0x1c')]);}_0x42a6a7[_0x2e1a('0x39')]=qs[_0x2e1a('0x3a')](_0x74d74f[_0x2e1a('0x2f')][_0x2e1a('0x3a')]);_0x42a6a7[_0x2e1a('0x3b')]=qs[_0x2e1a('0x3c')](_['pick'](_0x74d74f[_0x2e1a('0x2f')],_0x205832['filters']),_0xc838ef);if(_0x74d74f[_0x2e1a('0x2f')][_0x2e1a('0x3d')]){_0x42a6a7[_0x2e1a('0x3b')]=_[_0x2e1a('0x3e')](_0x42a6a7[_0x2e1a('0x3b')],{'$or':_[_0x2e1a('0x2a')](_0xc838ef,function(_0x55e1fe){if(_0x55e1fe[_0x2e1a('0x2e')]!==_0x2e1a('0x3f')){var _0xa1427f={};_0xa1427f[_0x55e1fe[_0x2e1a('0x28')]]={'$like':'%'+_0x74d74f['query'][_0x2e1a('0x3d')]+'%'};return _0xa1427f;}})});}_0x42a6a7=_[_0x2e1a('0x3e')]({},_0x42a6a7,_0x74d74f[_0x2e1a('0x40')]);var _0x15dc7d={'where':_0x42a6a7[_0x2e1a('0x3b')]};return db[_0x2e1a('0x2b')][_0x2e1a('0x1b')](_0x15dc7d)[_0x2e1a('0x22')](function(_0x54e9eb){_0x4ee151[_0x2e1a('0x1b')]=_0x54e9eb;if(_0x74d74f[_0x2e1a('0x2f')][_0x2e1a('0x41')]){_0x42a6a7[_0x2e1a('0x42')]=[{'all':!![]}];}return db[_0x2e1a('0x2b')][_0x2e1a('0x43')](_0x42a6a7);})[_0x2e1a('0x22')](function(_0x5c6fc7){_0x4ee151[_0x2e1a('0x44')]=_0x5c6fc7;return _0x4ee151;})[_0x2e1a('0x22')](respondWithFilteredResult(_0x45ce29,_0x42a6a7))[_0x2e1a('0x45')](handleError(_0x45ce29,null));};exports[_0x2e1a('0x46')]=function(_0x4e2e1b,_0x70b240){var _0x5e4615={'raw':!![],'where':{'id':_0x4e2e1b[_0x2e1a('0x47')]['id']}},_0x4f5084={};_0x4f5084[_0x2e1a('0x32')]=_['keys'](db['Interval']['rawAttributes']);_0x4f5084[_0x2e1a('0x2f')]=_['keys'](_0x4e2e1b[_0x2e1a('0x2f')]);_0x4f5084[_0x2e1a('0x3c')]=_[_0x2e1a('0x31')](_0x4f5084[_0x2e1a('0x32')],_0x4f5084['query']);_0x5e4615[_0x2e1a('0x33')]=_['intersection'](_0x4f5084['model'],qs['fields'](_0x4e2e1b[_0x2e1a('0x2f')][_0x2e1a('0x34')]));_0x5e4615[_0x2e1a('0x33')]=_0x5e4615[_0x2e1a('0x33')][_0x2e1a('0x35')]?_0x5e4615[_0x2e1a('0x33')]:_0x4f5084[_0x2e1a('0x32')];if(_0x4e2e1b[_0x2e1a('0x2f')][_0x2e1a('0x41')]){_0x5e4615[_0x2e1a('0x42')]=[{'all':!![]}];}_0x5e4615=_['merge']({},_0x5e4615,_0x4e2e1b[_0x2e1a('0x40')]);return db[_0x2e1a('0x2b')][_0x2e1a('0x48')](_0x5e4615)[_0x2e1a('0x22')](handleEntityNotFound(_0x70b240,null))[_0x2e1a('0x22')](respondWithResult(_0x70b240,null))[_0x2e1a('0x45')](handleError(_0x70b240,null));};exports[_0x2e1a('0x49')]=function(_0x361772,_0x29ec77){return db['Interval'][_0x2e1a('0x49')](_0x361772[_0x2e1a('0x4a')],{})['then'](function(_0xaf9f6c){var _0x31eb94=_0x361772[_0x2e1a('0x4b')]['get']({'plain':!![]});if(!_0x31eb94)throw new Error(_0x2e1a('0x4c'));if(_0x31eb94[_0x2e1a('0x4d')]===_0x2e1a('0x4b')){var _0x4785fc=_0xaf9f6c[_0x2e1a('0x4e')]({'plain':!![]});var _0x5b8c45='Intervals';return db['UserProfileSection']['find']({'where':{'name':_0x5b8c45,'userProfileId':_0x31eb94[_0x2e1a('0x4f')]},'raw':!![]})[_0x2e1a('0x22')](function(_0x3292af){if(_0x3292af&&_0x3292af[_0x2e1a('0x50')]===0x0){return db[_0x2e1a('0x24')][_0x2e1a('0x49')]({'name':_0x4785fc[_0x2e1a('0x28')],'resourceId':_0x4785fc['id'],'type':_0x3292af[_0x2e1a('0x28')],'sectionId':_0x3292af['id']},{})[_0x2e1a('0x22')](function(){return _0xaf9f6c;});}else{return _0xaf9f6c;}})[_0x2e1a('0x45')](function(_0x135701){logger[_0x2e1a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x135701);throw _0x135701;});}return _0xaf9f6c;})[_0x2e1a('0x22')](respondWithResult(_0x29ec77,0xc9))[_0x2e1a('0x45')](handleError(_0x29ec77,null));};exports[_0x2e1a('0x21')]=function(_0x48a2c6,_0x39b2cc){if(_0x48a2c6[_0x2e1a('0x4a')]['id']){delete _0x48a2c6['body']['id'];}return db[_0x2e1a('0x2b')][_0x2e1a('0x48')]({'where':{'id':_0x48a2c6[_0x2e1a('0x47')]['id']}})['then'](handleEntityNotFound(_0x39b2cc,null))['then'](saveUpdates(_0x48a2c6[_0x2e1a('0x4a')],null))[_0x2e1a('0x22')](respondWithResult(_0x39b2cc,null))['catch'](handleError(_0x39b2cc,null));};exports[_0x2e1a('0x25')]=function(_0x2cc750,_0x501af1){return db[_0x2e1a('0x2b')][_0x2e1a('0x48')]({'where':{'id':_0x2cc750['params']['id']}})[_0x2e1a('0x22')](handleEntityNotFound(_0x501af1,null))['then'](removeEntity(_0x501af1,null))[_0x2e1a('0x45')](handleError(_0x501af1,null));};exports[_0x2e1a('0x51')]=function(_0xfc9e33,_0x24624d,_0x1e37b9){if(_0xfc9e33[_0x2e1a('0x4a')]['id']){delete _0xfc9e33['body']['id'];}return db['Interval'][_0x2e1a('0x48')]({'where':{'id':_0xfc9e33['params']['id']}})['then'](handleEntityNotFound(_0x24624d,null))[_0x2e1a('0x22')](function(_0x896403){if(_0x896403){_0xfc9e33[_0x2e1a('0x4a')]['IntervalId']=_0x896403['id'];return db['Interval'][_0x2e1a('0x49')](_0xfc9e33['body']);}})['then'](respondWithResult(_0x24624d,null))[_0x2e1a('0x45')](handleError(_0x24624d,null));};exports[_0x2e1a('0x52')]=function(_0x535db7,_0x14a40f,_0x23fc00){var _0x1121f8={};var _0x1b3af1={};var _0x108b30;var _0x4cad0d;return db[_0x2e1a('0x2b')][_0x2e1a('0x53')]({'where':{'id':_0x535db7[_0x2e1a('0x47')]['id']}})[_0x2e1a('0x22')](handleEntityNotFound(_0x14a40f,null))[_0x2e1a('0x22')](function(_0x115c29){if(_0x115c29){_0x108b30=_0x115c29;_0x1b3af1[_0x2e1a('0x32')]=_[_0x2e1a('0x30')](db[_0x2e1a('0x2b')][_0x2e1a('0x2c')]);_0x1b3af1['query']=_[_0x2e1a('0x30')](_0x535db7[_0x2e1a('0x2f')]);_0x1b3af1[_0x2e1a('0x3c')]=_['intersection'](_0x1b3af1[_0x2e1a('0x32')],_0x1b3af1[_0x2e1a('0x2f')]);_0x1121f8[_0x2e1a('0x33')]=_[_0x2e1a('0x31')](_0x1b3af1[_0x2e1a('0x32')],qs['fields'](_0x535db7[_0x2e1a('0x2f')]['fields']));_0x1121f8[_0x2e1a('0x33')]=_0x1121f8[_0x2e1a('0x33')][_0x2e1a('0x35')]?_0x1121f8[_0x2e1a('0x33')]:_0x1b3af1[_0x2e1a('0x32')];_0x1121f8[_0x2e1a('0x39')]=qs[_0x2e1a('0x3a')](_0x535db7[_0x2e1a('0x2f')][_0x2e1a('0x3a')]);_0x1121f8[_0x2e1a('0x3b')]=qs[_0x2e1a('0x3c')](_[_0x2e1a('0x54')](_0x535db7[_0x2e1a('0x2f')],_0x1b3af1['filters']));if(_0x535db7[_0x2e1a('0x2f')][_0x2e1a('0x3d')]){_0x1121f8[_0x2e1a('0x3b')]=_[_0x2e1a('0x3e')](_0x1121f8[_0x2e1a('0x3b')],{'$or':_[_0x2e1a('0x2a')](_0x1121f8['attributes'],function(_0x35a59c){var _0x2c80c5={};_0x2c80c5[_0x35a59c]={'$like':'%'+_0x535db7['query']['filter']+'%'};return _0x2c80c5;})});}_0x1121f8=_[_0x2e1a('0x3e')]({},_0x1121f8,_0x535db7[_0x2e1a('0x40')]);return _0x108b30[_0x2e1a('0x52')](_0x1121f8);}})[_0x2e1a('0x22')](function(_0x331bdc){if(_0x331bdc){_0x4cad0d=_0x331bdc[_0x2e1a('0x35')];if(!_0x535db7[_0x2e1a('0x2f')][_0x2e1a('0x36')](_0x2e1a('0x37'))){_0x1121f8[_0x2e1a('0x38')]=qs['limit'](_0x535db7[_0x2e1a('0x2f')][_0x2e1a('0x38')]);_0x1121f8['offset']=qs[_0x2e1a('0x1c')](_0x535db7[_0x2e1a('0x2f')][_0x2e1a('0x1c')]);}return _0x108b30[_0x2e1a('0x52')](_0x1121f8);}})[_0x2e1a('0x22')](function(_0x531cb1){if(_0x531cb1){return _0x531cb1?{'count':_0x4cad0d,'rows':_0x531cb1}:null;}})[_0x2e1a('0x22')](respondWithResult(_0x14a40f,null))[_0x2e1a('0x45')](handleError(_0x14a40f,null));};exports['addIntervals']=function(_0x269b7d,_0x13ec06,_0x583de3){return db['Interval'][_0x2e1a('0x53')]({'where':{'id':_0x269b7d['params']['id']}})[_0x2e1a('0x22')](handleEntityNotFound(_0x13ec06,null))['then'](function(_0x2936fd){if(_0x2936fd){return db[_0x2e1a('0x55')][_0x2e1a('0x56')](function(_0x3bca39){return db[_0x2e1a('0x2b')][_0x2e1a('0x25')]({'where':{'IntervalId':_0x269b7d[_0x2e1a('0x47')]['id']},'transaction':_0x3bca39})['then'](function(_0x40b8ce){var _0x474c51=_['map'](_0x269b7d[_0x2e1a('0x4a')],function(_0x5d1f73){delete _0x5d1f73['id'];_0x5d1f73[_0x2e1a('0x57')]=_0x269b7d[_0x2e1a('0x47')]['id'];return _0x5d1f73;});return db[_0x2e1a('0x2b')][_0x2e1a('0x58')](_0x474c51,{'transaction':_0x3bca39});});})[_0x2e1a('0x22')](function(){return db['Interval'][_0x2e1a('0x43')]({'where':{'IntervalId':_0x269b7d[_0x2e1a('0x47')]['id']}});});}})['then'](respondWithResult(_0x13ec06,null))[_0x2e1a('0x45')](handleError(_0x13ec06,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 513650d..7a4615a 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 _0x0cee=['bluebird','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment'];(function(_0x480843,_0x8121e6){var _0x1d5cd9=function(_0x54ca2a){while(--_0x54ca2a){_0x480843['push'](_0x480843['shift']());}};_0x1d5cd9(++_0x8121e6);}(_0x0cee,0x12f));var _0xe0ce=function(_0x3d775a,_0x1658bb){_0x3d775a=_0x3d775a-0x0;var _0xa350a0=_0x0cee[_0x3d775a];return _0xa350a0;};'use strict';var _=require(_0xe0ce('0x0'));var util=require(_0xe0ce('0x1'));var logger=require(_0xe0ce('0x2'))(_0xe0ce('0x3'));var moment=require(_0xe0ce('0x4'));var BPromise=require(_0xe0ce('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe0ce('0x6'));var config=require(_0xe0ce('0x7'));var attributes=require(_0xe0ce('0x8'));var extensions=require(_0xe0ce('0x9'));module[_0xe0ce('0xa')]=function(_0x1ce646,_0x64f82c){return _0x1ce646[_0xe0ce('0xb')]('Interval',attributes,{'tableName':_0xe0ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2fa936,_0x52f779){extensions[_0xe0ce('0xd')](_0x1ce646,_0x2fa936);},'afterBulkCreate':function(_0x94afeb,_0x4532e3,_0x429a83){_0x429a83();extensions['rewrite'](_0x1ce646,_0x94afeb[0x0]);},'afterUpdate':function(_0x48a0a4,_0x5cf1d8){extensions[_0xe0ce('0xd')](_0x1ce646,_0x48a0a4);},'afterDestroy':function(_0x441e01,_0x31f014){extensions[_0xe0ce('0xd')](_0x1ce646,_0x441e01);}}});}; \ No newline at end of file +var _0xe3ed=['rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./interval.attributes','exports','define','tools_intervals'];(function(_0x48b541,_0x2774ea){var _0x480397=function(_0x30a8f1){while(--_0x30a8f1){_0x48b541['push'](_0x48b541['shift']());}};_0x480397(++_0x2774ea);}(_0xe3ed,0x8d));var _0xde3e=function(_0x58a56a,_0x1387b2){_0x58a56a=_0x58a56a-0x0;var _0x144322=_0xe3ed[_0x58a56a];return _0x144322;};'use strict';var _=require(_0xde3e('0x0'));var util=require(_0xde3e('0x1'));var logger=require(_0xde3e('0x2'))(_0xde3e('0x3'));var moment=require(_0xde3e('0x4'));var BPromise=require(_0xde3e('0x5'));var rp=require(_0xde3e('0x6'));var fs=require('fs');var path=require(_0xde3e('0x7'));var rimraf=require('rimraf');var config=require(_0xde3e('0x8'));var attributes=require(_0xde3e('0x9'));var extensions=require('../../components/extensions/rewrite');module[_0xde3e('0xa')]=function(_0x5e9013,_0x184b02){return _0x5e9013[_0xde3e('0xb')]('Interval',attributes,{'tableName':_0xde3e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b1597,_0xceed52){extensions[_0xde3e('0xd')](_0x5e9013,_0x3b1597);},'afterBulkCreate':function(_0x76daf5,_0x4aec4d,_0x1ca45c){_0x1ca45c();extensions[_0xde3e('0xd')](_0x5e9013,_0x76daf5[0x0]);},'afterUpdate':function(_0x3e251b,_0x137bf2){extensions['rewrite'](_0x5e9013,_0x3e251b);},'afterDestroy':function(_0xf8e2c3,_0x3b50df){extensions['rewrite'](_0x5e9013,_0xf8e2c3);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 1b9f4d6..6ff5c6a 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 _0xe764=['error','message','info','result','catch','GetInterval','Interval','options','raw','where','attributes','limit','include','map','model','then','debug','ShowInterval','find','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x51ea0c,_0x117636){var _0x164262=function(_0x223772){while(--_0x223772){_0x51ea0c['push'](_0x51ea0c['shift']());}};_0x164262(++_0x117636);}(_0xe764,0x14f));var _0x4e76=function(_0x295b1a,_0x1e31a){_0x295b1a=_0x295b1a-0x0;var _0x2bb42b=_0xe764[_0x295b1a];return _0x2bb42b;};'use strict';var _=require(_0x4e76('0x0'));var util=require('util');var moment=require(_0x4e76('0x1'));var BPromise=require('bluebird');var rs=require(_0x4e76('0x2'));var fs=require('fs');var Redis=require(_0x4e76('0x3'));var db=require(_0x4e76('0x4'))['db'];var utils=require(_0x4e76('0x5'));var logger=require(_0x4e76('0x6'))(_0x4e76('0x7'));var config=require(_0x4e76('0x8'));var jayson=require(_0x4e76('0x9'));var client=jayson[_0x4e76('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x192fb8,_0x22824d,_0x3f2813){return new BPromise(function(_0x2f240c,_0x285736){return client[_0x4e76('0xb')](_0x192fb8,_0x3f2813)['then'](function(_0x5f0122){logger['info'](_0x4e76('0xc'),_0x22824d,_0x4e76('0xd'));logger['debug'](_0x4e76('0xe'),_0x22824d,_0x4e76('0xd'),JSON['stringify'](_0x5f0122));if(_0x5f0122[_0x4e76('0xf')]){if(_0x5f0122[_0x4e76('0xf')]['code']===0x1f4){logger[_0x4e76('0xf')](_0x4e76('0xc'),_0x22824d,_0x5f0122[_0x4e76('0xf')][_0x4e76('0x10')]);return _0x285736(_0x5f0122[_0x4e76('0xf')]['message']);}logger[_0x4e76('0xf')]('Interval,\x20%s,\x20%s',_0x22824d,_0x5f0122['error'][_0x4e76('0x10')]);return _0x2f240c(_0x5f0122['error'][_0x4e76('0x10')]);}else{logger[_0x4e76('0x11')](_0x4e76('0xc'),_0x22824d,_0x4e76('0xd'));_0x2f240c(_0x5f0122[_0x4e76('0x12')][_0x4e76('0x10')]);}})[_0x4e76('0x13')](function(_0x442dcd){logger[_0x4e76('0xf')](_0x4e76('0xc'),_0x22824d,_0x442dcd);_0x285736(_0x442dcd);});});}exports[_0x4e76('0x14')]=function(_0x42540b){var _0x3ecb16=this;return new Promise(function(_0x2c6ff0,_0x1e80f7){return db[_0x4e76('0x15')]['findAll']({'raw':_0x42540b['options']?_0x42540b[_0x4e76('0x16')][_0x4e76('0x17')]===undefined?!![]:![]:!![],'where':_0x42540b[_0x4e76('0x16')]?_0x42540b[_0x4e76('0x16')][_0x4e76('0x18')]||null:null,'attributes':_0x42540b[_0x4e76('0x16')]?_0x42540b[_0x4e76('0x16')][_0x4e76('0x19')]||null:null,'limit':_0x42540b[_0x4e76('0x16')]?_0x42540b[_0x4e76('0x16')][_0x4e76('0x1a')]||null:null,'include':_0x42540b[_0x4e76('0x16')]?_0x42540b[_0x4e76('0x16')][_0x4e76('0x1b')]?_[_0x4e76('0x1c')](_0x42540b[_0x4e76('0x16')][_0x4e76('0x1b')],function(_0xf9d053){return{'model':db[_0xf9d053['model']],'as':_0xf9d053['as'],'attributes':_0xf9d053[_0x4e76('0x19')],'include':_0xf9d053[_0x4e76('0x1b')]?_[_0x4e76('0x1c')](_0xf9d053[_0x4e76('0x1b')],function(_0x5bbf65){return{'model':db[_0x5bbf65[_0x4e76('0x1d')]],'as':_0x5bbf65['as'],'attributes':_0x5bbf65['attributes'],'include':_0x5bbf65[_0x4e76('0x1b')]?_[_0x4e76('0x1c')](_0x5bbf65[_0x4e76('0x1b')],function(_0x3a426c){return{'model':db[_0x3a426c['model']],'as':_0x3a426c['as'],'attributes':_0x3a426c[_0x4e76('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4e76('0x1e')](function(_0x9e9e22){logger[_0x4e76('0x11')](_0x4e76('0x14'),_0x42540b);logger[_0x4e76('0x1f')](_0x4e76('0x14'),_0x42540b,JSON['stringify'](_0x9e9e22));_0x2c6ff0(_0x9e9e22);})[_0x4e76('0x13')](function(_0x34a5d0){logger[_0x4e76('0xf')]('GetInterval',_0x34a5d0[_0x4e76('0x10')],_0x42540b);_0x1e80f7(_0x3ecb16['error'](0x1f4,_0x34a5d0['message']));});});};exports[_0x4e76('0x20')]=function(_0xcf722c){var _0x56bbbf=this;return new Promise(function(_0x151420,_0x21703c){return db[_0x4e76('0x15')][_0x4e76('0x21')]({'raw':_0xcf722c[_0x4e76('0x16')]?_0xcf722c[_0x4e76('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xcf722c[_0x4e76('0x16')]?_0xcf722c['options']['where']||null:null,'attributes':_0xcf722c['options']?_0xcf722c[_0x4e76('0x16')][_0x4e76('0x19')]||null:null,'include':_0xcf722c[_0x4e76('0x16')]?_0xcf722c[_0x4e76('0x16')][_0x4e76('0x1b')]?_[_0x4e76('0x1c')](_0xcf722c[_0x4e76('0x16')][_0x4e76('0x1b')],function(_0x2e9cea){return{'model':db[_0x2e9cea['model']],'as':_0x2e9cea['as'],'attributes':_0x2e9cea[_0x4e76('0x19')],'include':_0x2e9cea['include']?_[_0x4e76('0x1c')](_0x2e9cea['include'],function(_0x561fe6){return{'model':db[_0x561fe6[_0x4e76('0x1d')]],'as':_0x561fe6['as'],'attributes':_0x561fe6[_0x4e76('0x19')],'include':_0x561fe6[_0x4e76('0x1b')]?_[_0x4e76('0x1c')](_0x561fe6[_0x4e76('0x1b')],function(_0x3d1a5a){return{'model':db[_0x3d1a5a[_0x4e76('0x1d')]],'as':_0x3d1a5a['as'],'attributes':_0x3d1a5a[_0x4e76('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4e76('0x1e')](function(_0x326d4d){logger[_0x4e76('0x11')](_0x4e76('0x20'),_0xcf722c);logger[_0x4e76('0x1f')](_0x4e76('0x20'),_0xcf722c,JSON[_0x4e76('0x22')](_0x326d4d));_0x151420(_0x326d4d);})['catch'](function(_0x3f4e0b){logger[_0x4e76('0xf')]('ShowInterval',_0x3f4e0b[_0x4e76('0x10')],_0xcf722c);_0x21703c(_0x56bbbf[_0x4e76('0xf')](0x1f4,_0x3f4e0b[_0x4e76('0x10')]));});});}; \ No newline at end of file +var _0x312e=['attributes','limit','include','model','map','catch','ShowInterval','Interval','find','where','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','then','info','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','Interval,\x20%s,\x20%s','message','result','GetInterval','findAll','options','raw'];(function(_0x48bef2,_0x15347a){var _0x5e88b0=function(_0x375d15){while(--_0x375d15){_0x48bef2['push'](_0x48bef2['shift']());}};_0x5e88b0(++_0x15347a);}(_0x312e,0xd0));var _0xe312=function(_0x53c309,_0x3e3c71){_0x53c309=_0x53c309-0x0;var _0xe1c297=_0x312e[_0x53c309];return _0xe1c297;};'use strict';var _=require(_0xe312('0x0'));var util=require('util');var moment=require(_0xe312('0x1'));var BPromise=require(_0xe312('0x2'));var rs=require(_0xe312('0x3'));var fs=require('fs');var Redis=require(_0xe312('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe312('0x5'));var logger=require(_0xe312('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe312('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f5dfa,_0x17ee7c,_0x173ca5){return new BPromise(function(_0x3cdc7d,_0x1615b9){return client['request'](_0x2f5dfa,_0x173ca5)[_0xe312('0x8')](function(_0x346552){logger[_0xe312('0x9')]('Interval,\x20%s,\x20%s',_0x17ee7c,_0xe312('0xa'));logger[_0xe312('0xb')](_0xe312('0xc'),_0x17ee7c,_0xe312('0xa'),JSON[_0xe312('0xd')](_0x346552));if(_0x346552[_0xe312('0xe')]){if(_0x346552['error'][_0xe312('0xf')]===0x1f4){logger[_0xe312('0xe')](_0xe312('0x10'),_0x17ee7c,_0x346552[_0xe312('0xe')][_0xe312('0x11')]);return _0x1615b9(_0x346552[_0xe312('0xe')][_0xe312('0x11')]);}logger[_0xe312('0xe')](_0xe312('0x10'),_0x17ee7c,_0x346552[_0xe312('0xe')][_0xe312('0x11')]);return _0x3cdc7d(_0x346552[_0xe312('0xe')]['message']);}else{logger['info'](_0xe312('0x10'),_0x17ee7c,'request\x20sent');_0x3cdc7d(_0x346552[_0xe312('0x12')][_0xe312('0x11')]);}})['catch'](function(_0x5f45cd){logger[_0xe312('0xe')]('Interval,\x20%s,\x20%s',_0x17ee7c,_0x5f45cd);_0x1615b9(_0x5f45cd);});});}exports[_0xe312('0x13')]=function(_0x174fd3){var _0xa0d230=this;return new Promise(function(_0x502b42,_0x2ca879){return db['Interval'][_0xe312('0x14')]({'raw':_0x174fd3[_0xe312('0x15')]?_0x174fd3[_0xe312('0x15')][_0xe312('0x16')]===undefined?!![]:![]:!![],'where':_0x174fd3[_0xe312('0x15')]?_0x174fd3[_0xe312('0x15')]['where']||null:null,'attributes':_0x174fd3[_0xe312('0x15')]?_0x174fd3['options'][_0xe312('0x17')]||null:null,'limit':_0x174fd3['options']?_0x174fd3[_0xe312('0x15')][_0xe312('0x18')]||null:null,'include':_0x174fd3['options']?_0x174fd3[_0xe312('0x15')][_0xe312('0x19')]?_['map'](_0x174fd3['options'][_0xe312('0x19')],function(_0x574e6b){return{'model':db[_0x574e6b[_0xe312('0x1a')]],'as':_0x574e6b['as'],'attributes':_0x574e6b[_0xe312('0x17')],'include':_0x574e6b['include']?_[_0xe312('0x1b')](_0x574e6b[_0xe312('0x19')],function(_0x33e3d1){return{'model':db[_0x33e3d1['model']],'as':_0x33e3d1['as'],'attributes':_0x33e3d1[_0xe312('0x17')],'include':_0x33e3d1[_0xe312('0x19')]?_[_0xe312('0x1b')](_0x33e3d1[_0xe312('0x19')],function(_0xa68b54){return{'model':db[_0xa68b54['model']],'as':_0xa68b54['as'],'attributes':_0xa68b54[_0xe312('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe312('0x8')](function(_0x42a54d){logger[_0xe312('0x9')](_0xe312('0x13'),_0x174fd3);logger[_0xe312('0xb')](_0xe312('0x13'),_0x174fd3,JSON[_0xe312('0xd')](_0x42a54d));_0x502b42(_0x42a54d);})[_0xe312('0x1c')](function(_0x20d76f){logger[_0xe312('0xe')](_0xe312('0x13'),_0x20d76f['message'],_0x174fd3);_0x2ca879(_0xa0d230[_0xe312('0xe')](0x1f4,_0x20d76f[_0xe312('0x11')]));});});};exports[_0xe312('0x1d')]=function(_0xea34f3){var _0x4eaa8e=this;return new Promise(function(_0x2834bc,_0x230de3){return db[_0xe312('0x1e')][_0xe312('0x1f')]({'raw':_0xea34f3[_0xe312('0x15')]?_0xea34f3[_0xe312('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xea34f3[_0xe312('0x15')]?_0xea34f3[_0xe312('0x15')][_0xe312('0x20')]||null:null,'attributes':_0xea34f3[_0xe312('0x15')]?_0xea34f3[_0xe312('0x15')][_0xe312('0x17')]||null:null,'include':_0xea34f3[_0xe312('0x15')]?_0xea34f3[_0xe312('0x15')]['include']?_[_0xe312('0x1b')](_0xea34f3[_0xe312('0x15')]['include'],function(_0x2a9555){return{'model':db[_0x2a9555['model']],'as':_0x2a9555['as'],'attributes':_0x2a9555['attributes'],'include':_0x2a9555[_0xe312('0x19')]?_[_0xe312('0x1b')](_0x2a9555['include'],function(_0x37df66){return{'model':db[_0x37df66[_0xe312('0x1a')]],'as':_0x37df66['as'],'attributes':_0x37df66[_0xe312('0x17')],'include':_0x37df66[_0xe312('0x19')]?_[_0xe312('0x1b')](_0x37df66[_0xe312('0x19')],function(_0x13e4bc){return{'model':db[_0x13e4bc[_0xe312('0x1a')]],'as':_0x13e4bc['as'],'attributes':_0x13e4bc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cdf5b){logger[_0xe312('0x9')](_0xe312('0x1d'),_0xea34f3);logger[_0xe312('0xb')](_0xe312('0x1d'),_0xea34f3,JSON[_0xe312('0xd')](_0x4cdf5b));_0x2834bc(_0x4cdf5b);})[_0xe312('0x1c')](function(_0x23286a){logger['error'](_0xe312('0x1d'),_0x23286a[_0xe312('0x11')],_0xea34f3);_0x230de3(_0x4eaa8e[_0xe312('0xe')](0x1f4,_0x23286a[_0xe312('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 5898127..7213bb6 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 _0x3102=['../../components/auth/service','./jira.controller','post','send','exports','Router'];(function(_0x56c2bd,_0x307141){var _0x1edc9c=function(_0x12d5e2){while(--_0x12d5e2){_0x56c2bd['push'](_0x56c2bd['shift']());}};_0x1edc9c(++_0x307141);}(_0x3102,0x119));var _0x2310=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x3102[_0x1d50f2];return _0x3769b8;};'use strict';var express=require('express');var router=express[_0x2310('0x0')]();var auth=require(_0x2310('0x1'));var controller=require(_0x2310('0x2'));router[_0x2310('0x3')]('/',auth['isAuthenticated'](),controller[_0x2310('0x4')]);module[_0x2310('0x5')]=router; \ No newline at end of file +var _0x0609=['Router','../../components/auth/service','./jira.controller','post','isAuthenticated','send','express'];(function(_0x44e279,_0xbb5db0){var _0x35c0ab=function(_0x3c5218){while(--_0x3c5218){_0x44e279['push'](_0x44e279['shift']());}};_0x35c0ab(++_0xbb5db0);}(_0x0609,0x187));var _0x9060=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x0609[_0x53ccf2];return _0x5a2964;};'use strict';var express=require(_0x9060('0x0'));var router=express[_0x9060('0x1')]();var auth=require(_0x9060('0x2'));var controller=require(_0x9060('0x3'));router[_0x9060('0x4')]('/',auth[_0x9060('0x5')](),controller[_0x9060('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 6d608b5..71ed2b7 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 _0xb4c0=['stringify','request','setEncoding','utf8','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','../../config/logger','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','POST','application/json','Basic\x20','toString','base64'];(function(_0x56a4da,_0x4ac978){var _0xf62943=function(_0x270fd8){while(--_0x270fd8){_0x56a4da['push'](_0x56a4da['shift']());}};_0xf62943(++_0x4ac978);}(_0xb4c0,0xef));var _0x0b4c=function(_0x59777c,_0x2dcd9d){_0x59777c=_0x59777c-0x0;var _0x264753=_0xb4c0[_0x59777c];return _0x264753;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0x0b4c('0x0'))('api');var USERNAME=_0x0b4c('0x1');var PASSWORD=_0x0b4c('0x2');function openIssue(_0xb3f406,_0x5a5d73){var _0x28f9ec={'fields':{'project':{'key':_0xb3f406['key']||_0x0b4c('0x3')},'summary':(_0xb3f406[_0x0b4c('0x4')]||_0x0b4c('0x5'))+_0x0b4c('0x6')+_0xb3f406['ip'],'description':_0xb3f406[_0x0b4c('0x7')]||JSON['stringify'](_0xb3f406),'issuetype':{'name':_0xb3f406[_0x0b4c('0x8')]||_0x0b4c('0x9')}}};_0x28f9ec[_0x0b4c('0xa')][_0x0b4c('0xb')]=_0xb3f406[_0x0b4c('0xc')];_0x28f9ec['fields']['customfield_11501']=_0xb3f406[_0x0b4c('0xd')];_0x28f9ec[_0x0b4c('0xa')][_0x0b4c('0xe')]=_0xb3f406[_0x0b4c('0xf')];_0x28f9ec[_0x0b4c('0xa')]['customfield_11503']=_0xb3f406[_0x0b4c('0x10')];_0x28f9ec[_0x0b4c('0xa')][_0x0b4c('0x11')]=_0xb3f406[_0x0b4c('0x12')];_0x28f9ec['fields'][_0x0b4c('0x13')]=_0xb3f406['ip'];var _0x59cd80={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0x0b4c('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x0b4c('0x15'),'Authorization':_0x0b4c('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x0b4c('0x17')](_0x0b4c('0x18'))}};var _0x2f75de=JSON[_0x0b4c('0x19')](_0x28f9ec);var _0x3f0788=https[_0x0b4c('0x1a')](_0x59cd80,function(_0x457077){_0x457077[_0x0b4c('0x1b')](_0x0b4c('0x1c'));var _0x5dc9b4='';_0x457077['on']('data',function(_0x1c438f){_0x5dc9b4+=_0x1c438f;});_0x457077['on'](_0x0b4c('0x1d'),function(){if(_0x5a5d73){return _0x5a5d73[_0x0b4c('0x1e')](_0x457077[_0x0b4c('0x1f')])[_0x0b4c('0x20')](JSON[_0x0b4c('0x21')](_0x5dc9b4));}});});_0x3f0788['on']('error',function(_0x228991){if(_0x5a5d73){return _0x5a5d73[_0x0b4c('0x1e')](0x1f4)[_0x0b4c('0x20')]({'errors':[{'message':_0x0b4c('0x22'),'type':_0x0b4c('0x23')}]});}});_0x3f0788[_0x0b4c('0x24')](_0x2f75de);_0x3f0788['end']();}exports[_0x0b4c('0x25')]=openIssue;exports[_0x0b4c('0x26')]=function(_0x4c359d,_0x30cecc){_0x4c359d[_0x0b4c('0x27')]['ip']=_0x4c359d[_0x0b4c('0x28')][_0x0b4c('0x29')]||_0x4c359d['connection'][_0x0b4c('0x2a')]||_0x4c359d[_0x0b4c('0x2b')][_0x0b4c('0x2a')]||_0x4c359d['connection'][_0x0b4c('0x2b')][_0x0b4c('0x2a')];return openIssue(_0x4c359d[_0x0b4c('0x27')],_0x30cecc);}; \ No newline at end of file +var _0xc701=['api.jira','write','body','headers','x-forwarded-for','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','\x20from\x20','description','stringify','Bug','customfield_11500','email','fields','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','setEncoding','end','status','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request'];(function(_0x200ebe,_0x43e591){var _0x3249b6=function(_0x286e4b){while(--_0x286e4b){_0x200ebe['push'](_0x200ebe['shift']());}};_0x3249b6(++_0x43e591);}(_0xc701,0x82));var _0x1c70=function(_0x485865,_0x11d29a){_0x485865=_0x485865-0x0;var _0x11ef06=_0xc701[_0x485865];return _0x11ef06;};'use strict';var BPromise=require(_0x1c70('0x0'));var https=require(_0x1c70('0x1'));var logger=require(_0x1c70('0x2'))(_0x1c70('0x3'));var USERNAME=_0x1c70('0x4');var PASSWORD=_0x1c70('0x5');function openIssue(_0x30a02f,_0x3af13f){var _0xab0089={'fields':{'project':{'key':_0x30a02f[_0x1c70('0x6')]||'MOTGUI'},'summary':(_0x30a02f[_0x1c70('0x7')]||'Report')+_0x1c70('0x8')+_0x30a02f['ip'],'description':_0x30a02f[_0x1c70('0x9')]||JSON[_0x1c70('0xa')](_0x30a02f),'issuetype':{'name':_0x30a02f['issuetype']||_0x1c70('0xb')}}};_0xab0089['fields'][_0x1c70('0xc')]=_0x30a02f[_0x1c70('0xd')];_0xab0089[_0x1c70('0xe')][_0x1c70('0xf')]=_0x30a02f[_0x1c70('0x10')];_0xab0089['fields']['customfield_11502']=_0x30a02f[_0x1c70('0x11')];_0xab0089[_0x1c70('0xe')][_0x1c70('0x12')]=_0x30a02f[_0x1c70('0x13')];_0xab0089['fields']['customfield_11504']=_0x30a02f['reason'];_0xab0089[_0x1c70('0xe')][_0x1c70('0x14')]=_0x30a02f['ip'];var _0x2eef35={'host':_0x1c70('0x15'),'port':0x1bb,'path':_0x1c70('0x16'),'method':_0x1c70('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x1c70('0x18'),'Authorization':_0x1c70('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x1c70('0x1a')](_0x1c70('0x1b'))}};var _0xee91d=JSON['stringify'](_0xab0089);var _0x1c9278=https['request'](_0x2eef35,function(_0x52ee54){_0x52ee54[_0x1c70('0x1c')]('utf8');var _0x300e30='';_0x52ee54['on']('data',function(_0x1424ee){_0x300e30+=_0x1424ee;});_0x52ee54['on'](_0x1c70('0x1d'),function(){if(_0x3af13f){return _0x3af13f[_0x1c70('0x1e')](_0x52ee54['statusCode'])[_0x1c70('0x1f')](JSON['parse'](_0x300e30));}});});_0x1c9278['on'](_0x1c70('0x20'),function(_0x60e98c){if(_0x3af13f){return _0x3af13f[_0x1c70('0x1e')](0x1f4)[_0x1c70('0x1f')]({'errors':[{'message':_0x1c70('0x21'),'type':_0x1c70('0x22')}]});}});_0x1c9278[_0x1c70('0x23')](_0xee91d);_0x1c9278[_0x1c70('0x1d')]();}exports['openIssue']=openIssue;exports['send']=function(_0x5217f3,_0x15b290){_0x5217f3[_0x1c70('0x24')]['ip']=_0x5217f3[_0x1c70('0x25')][_0x1c70('0x26')]||_0x5217f3['connection'][_0x1c70('0x27')]||_0x5217f3['socket'][_0x1c70('0x27')]||_0x5217f3['connection'][_0x1c70('0x28')]['remoteAddress'];return openIssue(_0x5217f3[_0x1c70('0x24')],_0x15b290);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 15d80dd..92fdf54 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 _0x14ef=['delete','destroy','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x2b0a08,_0x351fca){var _0x51aac5=function(_0x2ccd0b){while(--_0x2ccd0b){_0x2b0a08['push'](_0x2b0a08['shift']());}};_0x51aac5(++_0x351fca);}(_0x14ef,0x178));var _0xf14e=function(_0xbd77c1,_0x50b969){_0xbd77c1=_0xbd77c1-0x0;var _0x47fa83=_0x14ef[_0xbd77c1];return _0x47fa83;};'use strict';var multer=require('multer');var util=require(_0xf14e('0x0'));var path=require('path');var timeout=require(_0xf14e('0x1'));var express=require(_0xf14e('0x2'));var router=express['Router']();var auth=require(_0xf14e('0x3'));var interaction=require(_0xf14e('0x4'));var config=require(_0xf14e('0x5'));var controller=require('./jscriptyAnswerReport.controller');router[_0xf14e('0x6')]('/',auth[_0xf14e('0x7')](),controller[_0xf14e('0x8')]);router[_0xf14e('0x6')]('/describe',auth[_0xf14e('0x7')](),controller['describe']);router['get'](_0xf14e('0x9'),auth['isAuthenticated'](),controller[_0xf14e('0xa')]);router[_0xf14e('0xb')]('/',auth[_0xf14e('0x7')](),controller[_0xf14e('0xc')]);router[_0xf14e('0xd')](_0xf14e('0x9'),auth[_0xf14e('0x7')](),controller[_0xf14e('0xe')]);router[_0xf14e('0xf')]('/:id',auth[_0xf14e('0x7')](),controller[_0xf14e('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5279=['delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','show','post','create','put','update'];(function(_0xdf636a,_0x29562a){var _0x3f9204=function(_0x331616){while(--_0x331616){_0xdf636a['push'](_0xdf636a['shift']());}};_0x3f9204(++_0x29562a);}(_0x5279,0xb6));var _0x9527=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x5279[_0x1030ce];return _0x3367fd;};'use strict';var multer=require('multer');var util=require(_0x9527('0x0'));var path=require(_0x9527('0x1'));var timeout=require(_0x9527('0x2'));var express=require(_0x9527('0x3'));var router=express['Router']();var auth=require(_0x9527('0x4'));var interaction=require(_0x9527('0x5'));var config=require(_0x9527('0x6'));var controller=require(_0x9527('0x7'));router[_0x9527('0x8')]('/',auth[_0x9527('0x9')](),controller[_0x9527('0xa')]);router[_0x9527('0x8')]('/describe',auth[_0x9527('0x9')](),controller['describe']);router[_0x9527('0x8')]('/:id',auth[_0x9527('0x9')](),controller[_0x9527('0xb')]);router[_0x9527('0xc')]('/',auth[_0x9527('0x9')](),controller[_0x9527('0xd')]);router[_0x9527('0xe')]('/:id',auth[_0x9527('0x9')](),controller[_0x9527('0xf')]);router[_0x9527('0x10')]('/:id',auth[_0x9527('0x9')](),controller['destroy']);module[_0x9527('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 5d16c00..8f0e50e 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 _0xb0a7=['TEXT','sequelize','STRING'];(function(_0x19bef1,_0x53c40d){var _0x32de66=function(_0xa75bb9){while(--_0xa75bb9){_0x19bef1['push'](_0x19bef1['shift']());}};_0x32de66(++_0x53c40d);}(_0xb0a7,0x142));var _0x7b0a=function(_0x274584,_0x501942){_0x274584=_0x274584-0x0;var _0x3a068=_0xb0a7[_0x274584];return _0x3a068;};'use strict';var Sequelize=require(_0x7b0a('0x0'));module['exports']={'question':{'type':Sequelize[_0x7b0a('0x1')]},'answer':{'type':Sequelize[_0x7b0a('0x2')]('long')},'membername':{'type':Sequelize[_0x7b0a('0x1')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7b0a('0x1')]},'calleridname':{'type':Sequelize[_0x7b0a('0x1')]},'calleridnum':{'type':Sequelize[_0x7b0a('0x1')]},'questionId':{'type':Sequelize[_0x7b0a('0x1')]}}; \ No newline at end of file +var _0xf68d=['STRING','TEXT','long','sequelize','exports'];(function(_0x2943da,_0x312c9e){var _0x177bb4=function(_0x1be998){while(--_0x1be998){_0x2943da['push'](_0x2943da['shift']());}};_0x177bb4(++_0x312c9e);}(_0xf68d,0x1e8));var _0xdf68=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xf68d[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0xdf68('0x0'));module[_0xdf68('0x1')]={'question':{'type':Sequelize[_0xdf68('0x2')]},'answer':{'type':Sequelize[_0xdf68('0x3')](_0xdf68('0x4'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xdf68('0x2')]},'uniqueid':{'type':Sequelize[_0xdf68('0x2')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xdf68('0x2')]},'questionId':{'type':Sequelize[_0xdf68('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 2c817ec..8fcc321 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 _0x74a8=['length','model','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','apply','reject','save','update','destroy','then','error','stack','name','send','index','JscriptyAnswerReport','type','key','map','query','keys','filters','intersection','attributes','fields'];(function(_0x48aa5b,_0x10f9d3){var _0x44e84f=function(_0x3db468){while(--_0x3db468){_0x48aa5b['push'](_0x48aa5b['shift']());}};_0x44e84f(++_0x10f9d3);}(_0x74a8,0x18e));var _0x874a=function(_0x5ebf86,_0x1a3f74){_0x5ebf86=_0x5ebf86-0x0;var _0x87226c=_0x74a8[_0x5ebf86];return _0x87226c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x874a('0x0'));var rimraf=require(_0x874a('0x1'));var zipdir=require(_0x874a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x874a('0x3'));var moment=require('moment');var BPromise=require(_0x874a('0x4'));var Mustache=require(_0x874a('0x5'));var util=require(_0x874a('0x6'));var path=require(_0x874a('0x7'));var sox=require(_0x874a('0x8'));var csv=require(_0x874a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x874a('0xa'));var squel=require(_0x874a('0xb'));var crypto=require(_0x874a('0xc'));var jsforce=require(_0x874a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x874a('0x9'));var querystring=require(_0x874a('0xe'));var Papa=require(_0x874a('0xf'));var Redis=require(_0x874a('0x10'));var authService=require(_0x874a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x874a('0x12'));var hardwareService=require(_0x874a('0x13'));var logger=require(_0x874a('0x14'))(_0x874a('0x15'));var utils=require(_0x874a('0x16'));var config=require(_0x874a('0x17'));var db=require(_0x874a('0x18'))['db'];function respondWithStatusCode(_0x4d83d7,_0x1ff431){_0x1ff431=_0x1ff431||0xcc;return function(_0x304711){if(_0x304711){return _0x4d83d7[_0x874a('0x19')](_0x1ff431);}return _0x4d83d7['status'](_0x1ff431)[_0x874a('0x1a')]();};}function respondWithResult(_0x5c4726,_0x3907ce){_0x3907ce=_0x3907ce||0xc8;return function(_0x4c9313){if(_0x4c9313){return _0x5c4726[_0x874a('0x1b')](_0x3907ce)[_0x874a('0x1c')](_0x4c9313);}};}function respondWithFilteredResult(_0x27085a,_0x34f909){return function(_0x223392){if(_0x223392){var _0x5523c1=_0x223392[_0x874a('0x1d')],_0x54f9a2=_0x34f909['offset'],_0x4fa9b9=_0x34f909[_0x874a('0x1e')]+_0x34f909['limit'],_0x20e0e2;if(_0x4fa9b9>=_0x5523c1){_0x4fa9b9=_0x5523c1;_0x20e0e2=0xc8;}else{_0x20e0e2=0xce;}_0x27085a['status'](_0x20e0e2);return _0x27085a['set']('Content-Range',_0x54f9a2+'-'+_0x4fa9b9+'/'+_0x5523c1)[_0x874a('0x1c')](_0x223392);}return null;};}function patchUpdates(_0x3777d8){return function(_0x3903d9){try{jsonpatch[_0x874a('0x1f')](_0x3903d9,_0x3777d8,!![]);}catch(_0xb278a8){return BPromise[_0x874a('0x20')](_0xb278a8);}return _0x3903d9[_0x874a('0x21')]();};}function saveUpdates(_0x1e841a,_0x5f3beb){return function(_0x2efbaa){if(_0x2efbaa){return _0x2efbaa[_0x874a('0x22')](_0x1e841a)['then'](function(_0x1c5efc){return _0x1c5efc;});}return null;};}function removeEntity(_0x18e0c7,_0x2af359){return function(_0x454024){if(_0x454024){return _0x454024[_0x874a('0x23')]()[_0x874a('0x24')](function(){_0x18e0c7[_0x874a('0x1b')](0xcc)[_0x874a('0x1a')]();});}};}function handleEntityNotFound(_0x4fdaae,_0x10f87b){return function(_0x47bae7){if(!_0x47bae7){_0x4fdaae[_0x874a('0x19')](0x194);}return _0x47bae7;};}function handleError(_0x3b1a10,_0x3337c7){_0x3337c7=_0x3337c7||0x1f4;return function(_0x2c2b9a){logger[_0x874a('0x25')](_0x2c2b9a[_0x874a('0x26')]);if(_0x2c2b9a[_0x874a('0x27')]){delete _0x2c2b9a['name'];}_0x3b1a10[_0x874a('0x1b')](_0x3337c7)[_0x874a('0x28')](_0x2c2b9a);};}exports[_0x874a('0x29')]=function(_0x57e1d5,_0x595ede){var _0x377334={},_0x302232={},_0x4c7863={'count':0x0,'rows':[]};var _0x424ddc=_['map'](db[_0x874a('0x2a')]['rawAttributes'],function(_0x4b7bc7){return{'name':_0x4b7bc7['fieldName'],'type':_0x4b7bc7[_0x874a('0x2b')][_0x874a('0x2c')]};});_0x302232['model']=_[_0x874a('0x2d')](_0x424ddc,_0x874a('0x27'));_0x302232[_0x874a('0x2e')]=_[_0x874a('0x2f')](_0x57e1d5[_0x874a('0x2e')]);_0x302232[_0x874a('0x30')]=_[_0x874a('0x31')](_0x302232['model'],_0x302232['query']);_0x377334[_0x874a('0x32')]=_[_0x874a('0x31')](_0x302232['model'],qs[_0x874a('0x33')](_0x57e1d5[_0x874a('0x2e')][_0x874a('0x33')]));_0x377334[_0x874a('0x32')]=_0x377334[_0x874a('0x32')][_0x874a('0x34')]?_0x377334[_0x874a('0x32')]:_0x302232[_0x874a('0x35')];if(!_0x57e1d5['query'][_0x874a('0x36')](_0x874a('0x37'))){_0x377334['limit']=qs['limit'](_0x57e1d5[_0x874a('0x2e')][_0x874a('0x38')]);_0x377334[_0x874a('0x1e')]=qs[_0x874a('0x1e')](_0x57e1d5[_0x874a('0x2e')]['offset']);}_0x377334['order']=qs[_0x874a('0x39')](_0x57e1d5[_0x874a('0x2e')][_0x874a('0x39')]);_0x377334[_0x874a('0x3a')]=qs['filters'](_[_0x874a('0x3b')](_0x57e1d5[_0x874a('0x2e')],_0x302232[_0x874a('0x30')]),_0x424ddc);if(_0x57e1d5[_0x874a('0x2e')][_0x874a('0x3c')]){_0x377334[_0x874a('0x3a')]=_['merge'](_0x377334[_0x874a('0x3a')],{'$or':_[_0x874a('0x2d')](_0x424ddc,function(_0x7f8c71){if(_0x7f8c71[_0x874a('0x2b')]!=='VIRTUAL'){var _0x19b31b={};_0x19b31b[_0x7f8c71[_0x874a('0x27')]]={'$like':'%'+_0x57e1d5[_0x874a('0x2e')]['filter']+'%'};return _0x19b31b;}})});}_0x377334=_[_0x874a('0x3d')]({},_0x377334,_0x57e1d5['options']);var _0x431856={'where':_0x377334[_0x874a('0x3a')]};return db[_0x874a('0x2a')][_0x874a('0x1d')](_0x431856)[_0x874a('0x24')](function(_0x53a74a){_0x4c7863[_0x874a('0x1d')]=_0x53a74a;if(_0x57e1d5['query'][_0x874a('0x3e')]){_0x377334['include']=[{'all':!![]}];}return db[_0x874a('0x2a')][_0x874a('0x3f')](_0x377334);})[_0x874a('0x24')](function(_0x5bb122){_0x4c7863[_0x874a('0x40')]=_0x5bb122;return _0x4c7863;})[_0x874a('0x24')](respondWithFilteredResult(_0x595ede,_0x377334))[_0x874a('0x41')](handleError(_0x595ede,null));};exports[_0x874a('0x42')]=function(_0x2c3b20,_0x55da45){var _0x59d574={'raw':!![],'where':{'id':_0x2c3b20[_0x874a('0x43')]['id']}},_0x2838b6={};_0x2838b6[_0x874a('0x35')]=_[_0x874a('0x2f')](db['JscriptyAnswerReport'][_0x874a('0x44')]);_0x2838b6[_0x874a('0x2e')]=_[_0x874a('0x2f')](_0x2c3b20['query']);_0x2838b6[_0x874a('0x30')]=_['intersection'](_0x2838b6['model'],_0x2838b6['query']);_0x59d574['attributes']=_[_0x874a('0x31')](_0x2838b6['model'],qs[_0x874a('0x33')](_0x2c3b20[_0x874a('0x2e')][_0x874a('0x33')]));_0x59d574[_0x874a('0x32')]=_0x59d574[_0x874a('0x32')][_0x874a('0x34')]?_0x59d574[_0x874a('0x32')]:_0x2838b6[_0x874a('0x35')];if(_0x2c3b20['query'][_0x874a('0x3e')]){_0x59d574[_0x874a('0x45')]=[{'all':!![]}];}_0x59d574=_[_0x874a('0x3d')]({},_0x59d574,_0x2c3b20[_0x874a('0x46')]);return db[_0x874a('0x2a')][_0x874a('0x47')](_0x59d574)[_0x874a('0x24')](handleEntityNotFound(_0x55da45,null))[_0x874a('0x24')](respondWithResult(_0x55da45,null))[_0x874a('0x41')](handleError(_0x55da45,null));};exports[_0x874a('0x48')]=function(_0x3ce349,_0x211990){return db[_0x874a('0x2a')][_0x874a('0x48')](_0x3ce349[_0x874a('0x49')],{})[_0x874a('0x24')](respondWithResult(_0x211990,0xc9))[_0x874a('0x41')](handleError(_0x211990,null));};exports[_0x874a('0x22')]=function(_0x3ae101,_0x1508b0){if(_0x3ae101[_0x874a('0x49')]['id']){delete _0x3ae101[_0x874a('0x49')]['id'];}return db[_0x874a('0x2a')][_0x874a('0x47')]({'where':{'id':_0x3ae101['params']['id']}})['then'](handleEntityNotFound(_0x1508b0,null))['then'](saveUpdates(_0x3ae101[_0x874a('0x49')],null))[_0x874a('0x24')](respondWithResult(_0x1508b0,null))[_0x874a('0x41')](handleError(_0x1508b0,null));};exports[_0x874a('0x23')]=function(_0xa556cf,_0x52c604){return db[_0x874a('0x2a')]['find']({'where':{'id':_0xa556cf[_0x874a('0x43')]['id']}})[_0x874a('0x24')](handleEntityNotFound(_0x52c604,null))[_0x874a('0x24')](removeEntity(_0x52c604,null))['catch'](handleError(_0x52c604,null));};exports[_0x874a('0x4a')]=function(_0x3b8274,_0x5bf58a){return db['JscriptyAnswerReport'][_0x874a('0x4a')]()[_0x874a('0x24')](respondWithResult(_0x5bf58a,null))[_0x874a('0x41')](handleError(_0x5bf58a,null));}; \ No newline at end of file +var _0x6d9b=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','error','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','limit','sort','where','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','show','params','keys','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','path','to-csv','ejs','lodash'];(function(_0x55cddd,_0x106d53){var _0xc8a549=function(_0x6a33af){while(--_0x6a33af){_0x55cddd['push'](_0x55cddd['shift']());}};_0xc8a549(++_0x106d53);}(_0x6d9b,0x1d2));var _0xb6d9=function(_0x57d87e,_0x42a175){_0x57d87e=_0x57d87e-0x0;var _0x49bd31=_0x6d9b[_0x57d87e];return _0x49bd31;};'use strict';var pdf=require(_0xb6d9('0x0'));var emlformat=require(_0xb6d9('0x1'));var rimraf=require(_0xb6d9('0x2'));var zipdir=require(_0xb6d9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6d9('0x4'));var moment=require(_0xb6d9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb6d9('0x6'));var sox=require('sox');var csv=require(_0xb6d9('0x7'));var ejs=require(_0xb6d9('0x8'));var fs=require('fs');var _=require(_0xb6d9('0x9'));var squel=require('squel');var crypto=require(_0xb6d9('0xa'));var jsforce=require(_0xb6d9('0xb'));var deskjs=require(_0xb6d9('0xc'));var toCsv=require(_0xb6d9('0x7'));var querystring=require(_0xb6d9('0xd'));var Papa=require(_0xb6d9('0xe'));var Redis=require('ioredis');var authService=require(_0xb6d9('0xf'));var qs=require(_0xb6d9('0x10'));var as=require(_0xb6d9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6d9('0x12'))('api');var utils=require(_0xb6d9('0x13'));var config=require(_0xb6d9('0x14'));var db=require(_0xb6d9('0x15'))['db'];function respondWithStatusCode(_0x443108,_0x238ced){_0x238ced=_0x238ced||0xcc;return function(_0x18135e){if(_0x18135e){return _0x443108[_0xb6d9('0x16')](_0x238ced);}return _0x443108[_0xb6d9('0x17')](_0x238ced)[_0xb6d9('0x18')]();};}function respondWithResult(_0x543143,_0x5ceeb1){_0x5ceeb1=_0x5ceeb1||0xc8;return function(_0x2625f0){if(_0x2625f0){return _0x543143[_0xb6d9('0x17')](_0x5ceeb1)[_0xb6d9('0x19')](_0x2625f0);}};}function respondWithFilteredResult(_0x5c4873,_0x3ed4ec){return function(_0x25247d){if(_0x25247d){var _0x54b580=_0x25247d[_0xb6d9('0x1a')],_0x2a5152=_0x3ed4ec[_0xb6d9('0x1b')],_0x38c060=_0x3ed4ec[_0xb6d9('0x1b')]+_0x3ed4ec['limit'],_0x58b878;if(_0x38c060>=_0x54b580){_0x38c060=_0x54b580;_0x58b878=0xc8;}else{_0x58b878=0xce;}_0x5c4873[_0xb6d9('0x17')](_0x58b878);return _0x5c4873[_0xb6d9('0x1c')](_0xb6d9('0x1d'),_0x2a5152+'-'+_0x38c060+'/'+_0x54b580)[_0xb6d9('0x19')](_0x25247d);}return null;};}function patchUpdates(_0x1e6a10){return function(_0x178d78){try{jsonpatch[_0xb6d9('0x1e')](_0x178d78,_0x1e6a10,!![]);}catch(_0x51f6e5){return BPromise[_0xb6d9('0x1f')](_0x51f6e5);}return _0x178d78[_0xb6d9('0x20')]();};}function saveUpdates(_0x4ccc0f,_0x115be7){return function(_0x14ce49){if(_0x14ce49){return _0x14ce49['update'](_0x4ccc0f)['then'](function(_0x441cae){return _0x441cae;});}return null;};}function removeEntity(_0x2d7e6e,_0x473280){return function(_0x2cc44b){if(_0x2cc44b){return _0x2cc44b['destroy']()['then'](function(){_0x2d7e6e[_0xb6d9('0x17')](0xcc)[_0xb6d9('0x18')]();});}};}function handleEntityNotFound(_0x3d3476,_0x37ae9d){return function(_0x2b6360){if(!_0x2b6360){_0x3d3476[_0xb6d9('0x16')](0x194);}return _0x2b6360;};}function handleError(_0x5aaa9e,_0x4c99af){_0x4c99af=_0x4c99af||0x1f4;return function(_0x4cee76){logger[_0xb6d9('0x21')](_0x4cee76['stack']);if(_0x4cee76[_0xb6d9('0x22')]){delete _0x4cee76['name'];}_0x5aaa9e['status'](_0x4c99af)[_0xb6d9('0x23')](_0x4cee76);};}exports['index']=function(_0x3fa2a0,_0x3b954f){var _0x4b7d39={},_0x26a4a3={},_0x240980={'count':0x0,'rows':[]};var _0x177bc4=_[_0xb6d9('0x24')](db[_0xb6d9('0x25')][_0xb6d9('0x26')],function(_0x1462f4){return{'name':_0x1462f4[_0xb6d9('0x27')],'type':_0x1462f4['type'][_0xb6d9('0x28')]};});_0x26a4a3['model']=_[_0xb6d9('0x24')](_0x177bc4,'name');_0x26a4a3[_0xb6d9('0x29')]=_['keys'](_0x3fa2a0[_0xb6d9('0x29')]);_0x26a4a3[_0xb6d9('0x2a')]=_[_0xb6d9('0x2b')](_0x26a4a3[_0xb6d9('0x2c')],_0x26a4a3['query']);_0x4b7d39[_0xb6d9('0x2d')]=_[_0xb6d9('0x2b')](_0x26a4a3[_0xb6d9('0x2c')],qs[_0xb6d9('0x2e')](_0x3fa2a0[_0xb6d9('0x29')][_0xb6d9('0x2e')]));_0x4b7d39[_0xb6d9('0x2d')]=_0x4b7d39[_0xb6d9('0x2d')][_0xb6d9('0x2f')]?_0x4b7d39[_0xb6d9('0x2d')]:_0x26a4a3['model'];if(!_0x3fa2a0['query']['hasOwnProperty']('nolimit')){_0x4b7d39['limit']=qs[_0xb6d9('0x30')](_0x3fa2a0[_0xb6d9('0x29')]['limit']);_0x4b7d39[_0xb6d9('0x1b')]=qs[_0xb6d9('0x1b')](_0x3fa2a0[_0xb6d9('0x29')][_0xb6d9('0x1b')]);}_0x4b7d39['order']=qs[_0xb6d9('0x31')](_0x3fa2a0[_0xb6d9('0x29')][_0xb6d9('0x31')]);_0x4b7d39[_0xb6d9('0x32')]=qs[_0xb6d9('0x2a')](_['pick'](_0x3fa2a0['query'],_0x26a4a3['filters']),_0x177bc4);if(_0x3fa2a0[_0xb6d9('0x29')][_0xb6d9('0x33')]){_0x4b7d39[_0xb6d9('0x32')]=_['merge'](_0x4b7d39['where'],{'$or':_['map'](_0x177bc4,function(_0x4d42b6){if(_0x4d42b6['type']!==_0xb6d9('0x34')){var _0x4f884a={};_0x4f884a[_0x4d42b6['name']]={'$like':'%'+_0x3fa2a0[_0xb6d9('0x29')][_0xb6d9('0x33')]+'%'};return _0x4f884a;}})});}_0x4b7d39=_[_0xb6d9('0x35')]({},_0x4b7d39,_0x3fa2a0[_0xb6d9('0x36')]);var _0x2ca419={'where':_0x4b7d39[_0xb6d9('0x32')]};return db[_0xb6d9('0x25')]['count'](_0x2ca419)[_0xb6d9('0x37')](function(_0x3b042c){_0x240980['count']=_0x3b042c;if(_0x3fa2a0[_0xb6d9('0x29')][_0xb6d9('0x38')]){_0x4b7d39[_0xb6d9('0x39')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xb6d9('0x3a')](_0x4b7d39);})['then'](function(_0x53c3a6){_0x240980[_0xb6d9('0x3b')]=_0x53c3a6;return _0x240980;})[_0xb6d9('0x37')](respondWithFilteredResult(_0x3b954f,_0x4b7d39))[_0xb6d9('0x3c')](handleError(_0x3b954f,null));};exports[_0xb6d9('0x3d')]=function(_0x579bc1,_0x48e053){var _0x14537d={'raw':!![],'where':{'id':_0x579bc1[_0xb6d9('0x3e')]['id']}},_0x2e1538={};_0x2e1538['model']=_['keys'](db[_0xb6d9('0x25')]['rawAttributes']);_0x2e1538[_0xb6d9('0x29')]=_[_0xb6d9('0x3f')](_0x579bc1[_0xb6d9('0x29')]);_0x2e1538['filters']=_[_0xb6d9('0x2b')](_0x2e1538[_0xb6d9('0x2c')],_0x2e1538[_0xb6d9('0x29')]);_0x14537d[_0xb6d9('0x2d')]=_[_0xb6d9('0x2b')](_0x2e1538[_0xb6d9('0x2c')],qs[_0xb6d9('0x2e')](_0x579bc1[_0xb6d9('0x29')][_0xb6d9('0x2e')]));_0x14537d[_0xb6d9('0x2d')]=_0x14537d[_0xb6d9('0x2d')][_0xb6d9('0x2f')]?_0x14537d['attributes']:_0x2e1538[_0xb6d9('0x2c')];if(_0x579bc1[_0xb6d9('0x29')][_0xb6d9('0x38')]){_0x14537d[_0xb6d9('0x39')]=[{'all':!![]}];}_0x14537d=_[_0xb6d9('0x35')]({},_0x14537d,_0x579bc1[_0xb6d9('0x36')]);return db[_0xb6d9('0x25')]['find'](_0x14537d)[_0xb6d9('0x37')](handleEntityNotFound(_0x48e053,null))[_0xb6d9('0x37')](respondWithResult(_0x48e053,null))[_0xb6d9('0x3c')](handleError(_0x48e053,null));};exports['create']=function(_0x2a11e0,_0x4cfbb7){return db['JscriptyAnswerReport']['create'](_0x2a11e0[_0xb6d9('0x40')],{})[_0xb6d9('0x37')](respondWithResult(_0x4cfbb7,0xc9))[_0xb6d9('0x3c')](handleError(_0x4cfbb7,null));};exports['update']=function(_0x3d9141,_0x4b20b7){if(_0x3d9141['body']['id']){delete _0x3d9141['body']['id'];}return db['JscriptyAnswerReport'][_0xb6d9('0x41')]({'where':{'id':_0x3d9141[_0xb6d9('0x3e')]['id']}})[_0xb6d9('0x37')](handleEntityNotFound(_0x4b20b7,null))[_0xb6d9('0x37')](saveUpdates(_0x3d9141[_0xb6d9('0x40')],null))[_0xb6d9('0x37')](respondWithResult(_0x4b20b7,null))[_0xb6d9('0x3c')](handleError(_0x4b20b7,null));};exports[_0xb6d9('0x42')]=function(_0x5917a8,_0x389f97){return db[_0xb6d9('0x25')]['find']({'where':{'id':_0x5917a8['params']['id']}})[_0xb6d9('0x37')](handleEntityNotFound(_0x389f97,null))[_0xb6d9('0x37')](removeEntity(_0x389f97,null))[_0xb6d9('0x3c')](handleError(_0x389f97,null));};exports['describe']=function(_0x38c5f7,_0x3f072f){return db[_0xb6d9('0x25')][_0xb6d9('0x43')]()[_0xb6d9('0x37')](respondWithResult(_0x3f072f,null))[_0xb6d9('0x3c')](handleError(_0x3f072f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index ae37b14..b110816 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 _0x4374=['moment','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','report_jscripty_answers','util','../../config/logger','api'];(function(_0x1bdc52,_0x4876a9){var _0xdf3fa3=function(_0x2a3ba4){while(--_0x2a3ba4){_0x1bdc52['push'](_0x1bdc52['shift']());}};_0xdf3fa3(++_0x4876a9);}(_0x4374,0x1aa));var _0x4437=function(_0xa77016,_0x1de579){_0xa77016=_0xa77016-0x0;var _0x30ed8c=_0x4374[_0xa77016];return _0x30ed8c;};'use strict';var _=require('lodash');var util=require(_0x4437('0x0'));var logger=require(_0x4437('0x1'))(_0x4437('0x2'));var moment=require(_0x4437('0x3'));var BPromise=require('bluebird');var rp=require(_0x4437('0x4'));var fs=require('fs');var path=require(_0x4437('0x5'));var rimraf=require(_0x4437('0x6'));var config=require(_0x4437('0x7'));var attributes=require(_0x4437('0x8'));module['exports']=function(_0x328bab,_0x19906d){return _0x328bab[_0x4437('0x9')]('JscriptyAnswerReport',attributes,{'tableName':_0x4437('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08d1=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0xd95979,_0x3b95a2){var _0x574da5=function(_0x3e6b41){while(--_0x3e6b41){_0xd95979['push'](_0xd95979['shift']());}};_0x574da5(++_0x3b95a2);}(_0x08d1,0x112));var _0x108d=function(_0x4a962c,_0x6e176f){_0x4a962c=_0x4a962c-0x0;var _0x1ba3f2=_0x08d1[_0x4a962c];return _0x1ba3f2;};'use strict';var _=require(_0x108d('0x0'));var util=require('util');var logger=require(_0x108d('0x1'))(_0x108d('0x2'));var moment=require(_0x108d('0x3'));var BPromise=require(_0x108d('0x4'));var rp=require(_0x108d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x108d('0x6'));var config=require('../../config/environment');var attributes=require(_0x108d('0x7'));module[_0x108d('0x8')]=function(_0x3089e5,_0x19174f){return _0x3089e5['define'](_0x108d('0x9'),attributes,{'tableName':_0x108d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 7520139..ddc834c 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 _0x59ff=['../../config/environment','jayson/promise','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc'];(function(_0x56f6c0,_0x37c097){var _0x249342=function(_0x4ab8d9){while(--_0x4ab8d9){_0x56f6c0['push'](_0x56f6c0['shift']());}};_0x249342(++_0x37c097);}(_0x59ff,0x8c));var _0xf59f=function(_0x4e8a9c,_0x56f599){_0x4e8a9c=_0x4e8a9c-0x0;var _0x34de7b=_0x59ff[_0x4e8a9c];return _0x34de7b;};'use strict';var _=require(_0xf59f('0x0'));var util=require(_0xf59f('0x1'));var moment=require(_0xf59f('0x2'));var BPromise=require(_0xf59f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf59f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf59f('0x5'));var logger=require('../../config/logger')(_0xf59f('0x6'));var config=require(_0xf59f('0x7'));var jayson=require(_0xf59f('0x8'));var client=jayson['client'][_0xf59f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57a3f3,_0x28ff83,_0x14d9ae){return new BPromise(function(_0xfa71fb,_0x1e81d5){return client[_0xf59f('0xa')](_0x57a3f3,_0x14d9ae)[_0xf59f('0xb')](function(_0x8927ba){logger[_0xf59f('0xc')](_0xf59f('0xd'),_0x28ff83,_0xf59f('0xe'));logger['debug'](_0xf59f('0xf'),_0x28ff83,_0xf59f('0xe'),JSON[_0xf59f('0x10')](_0x8927ba));if(_0x8927ba['error']){if(_0x8927ba[_0xf59f('0x11')]['code']===0x1f4){logger[_0xf59f('0x11')](_0xf59f('0xd'),_0x28ff83,_0x8927ba[_0xf59f('0x11')][_0xf59f('0x12')]);return _0x1e81d5(_0x8927ba[_0xf59f('0x11')][_0xf59f('0x12')]);}logger[_0xf59f('0x11')](_0xf59f('0xd'),_0x28ff83,_0x8927ba['error'][_0xf59f('0x12')]);return _0xfa71fb(_0x8927ba['error'][_0xf59f('0x12')]);}else{logger[_0xf59f('0xc')](_0xf59f('0xd'),_0x28ff83,_0xf59f('0xe'));_0xfa71fb(_0x8927ba[_0xf59f('0x13')][_0xf59f('0x12')]);}})[_0xf59f('0x14')](function(_0x439825){logger[_0xf59f('0x11')](_0xf59f('0xd'),_0x28ff83,_0x439825);_0x1e81d5(_0x439825);});});} \ No newline at end of file +var _0x2e0b=['info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x2e0b,0x171));var _0xb2e0=function(_0x57784b,_0x49a858){_0x57784b=_0x57784b-0x0;var _0x4505fa=_0x2e0b[_0x57784b];return _0x4505fa;};'use strict';var _=require(_0xb2e0('0x0'));var util=require(_0xb2e0('0x1'));var moment=require(_0xb2e0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2e0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2e0('0x4'))(_0xb2e0('0x5'));var config=require(_0xb2e0('0x6'));var jayson=require(_0xb2e0('0x7'));var client=jayson[_0xb2e0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47951b,_0x4628dc,_0x51d8b6){return new BPromise(function(_0x3088bf,_0x47cf80){return client[_0xb2e0('0x9')](_0x47951b,_0x51d8b6)[_0xb2e0('0xa')](function(_0x1043a6){logger[_0xb2e0('0xb')](_0xb2e0('0xc'),_0x4628dc,_0xb2e0('0xd'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x4628dc,_0xb2e0('0xd'),JSON[_0xb2e0('0xe')](_0x1043a6));if(_0x1043a6[_0xb2e0('0xf')]){if(_0x1043a6[_0xb2e0('0xf')]['code']===0x1f4){logger[_0xb2e0('0xf')](_0xb2e0('0xc'),_0x4628dc,_0x1043a6['error'][_0xb2e0('0x10')]);return _0x47cf80(_0x1043a6[_0xb2e0('0xf')][_0xb2e0('0x10')]);}logger[_0xb2e0('0xf')](_0xb2e0('0xc'),_0x4628dc,_0x1043a6['error'][_0xb2e0('0x10')]);return _0x3088bf(_0x1043a6[_0xb2e0('0xf')]['message']);}else{logger[_0xb2e0('0xb')](_0xb2e0('0xc'),_0x4628dc,_0xb2e0('0xd'));_0x3088bf(_0x1043a6[_0xb2e0('0x11')]['message']);}})[_0xb2e0('0x12')](function(_0x3965d7){logger[_0xb2e0('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4628dc,_0x3965d7);_0x47cf80(_0x3965d7);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 720d83b..acfe8f7 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 _0x3c85=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getSessions','30s','getSummary','post','create','/:id/clone','clone','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5d61fa,_0x5428fe){var _0x271751=function(_0xa87023){while(--_0xa87023){_0x5d61fa['push'](_0x5d61fa['shift']());}};_0x271751(++_0x5428fe);}(_0x3c85,0x1a0));var _0x53c8=function(_0xa61ced,_0x140853){_0xa61ced=_0xa61ced-0x0;var _0x1fd226=_0x3c85[_0xa61ced];return _0x1fd226;};'use strict';var multer=require(_0x53c8('0x0'));var util=require(_0x53c8('0x1'));var path=require(_0x53c8('0x2'));var timeout=require(_0x53c8('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x53c8('0x4'));var interaction=require(_0x53c8('0x5'));var config=require(_0x53c8('0x6'));var controller=require('./jscriptyProject.controller');router[_0x53c8('0x7')]('/',auth[_0x53c8('0x8')](),controller[_0x53c8('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x53c8('0x7')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x53c8('0xa')]);router[_0x53c8('0x7')]('/:id/answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0x53c8('0x7')]('/:id/summary',auth['isAuthenticated'](),timeout(_0x53c8('0xb')),controller[_0x53c8('0xc')]);router[_0x53c8('0xd')]('/',auth[_0x53c8('0x8')](),controller[_0x53c8('0xe')]);router['post'](_0x53c8('0xf'),auth[_0x53c8('0x8')](),controller[_0x53c8('0x10')]);router['put'](_0x53c8('0x11'),auth[_0x53c8('0x8')](),controller['update']);router[_0x53c8('0x12')](_0x53c8('0x11'),auth[_0x53c8('0x8')](),controller[_0x53c8('0x13')]);module[_0x53c8('0x14')]=router; \ No newline at end of file +var _0x0a1c=['show','/:id/sessions','getSessions','/:id/answers','/:id/summary','getSummary','post','/:id/clone','clone','put','update','destroy','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x0a1c[_0x139a3c];return _0x2b375b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc0a1('0x0'));var timeout=require(_0xc0a1('0x1'));var express=require(_0xc0a1('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc0a1('0x3'));var config=require(_0xc0a1('0x4'));var controller=require(_0xc0a1('0x5'));router[_0xc0a1('0x6')]('/',auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x8')]);router[_0xc0a1('0x6')](_0xc0a1('0x9'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0xa')]);router[_0xc0a1('0x6')](_0xc0a1('0xb'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0xc')]);router[_0xc0a1('0x6')](_0xc0a1('0xd'),auth[_0xc0a1('0x7')](),controller['getAnswers']);router[_0xc0a1('0x6')](_0xc0a1('0xe'),auth[_0xc0a1('0x7')](),timeout('30s'),controller[_0xc0a1('0xf')]);router[_0xc0a1('0x10')]('/',auth[_0xc0a1('0x7')](),controller['create']);router[_0xc0a1('0x10')](_0xc0a1('0x11'),auth['isAuthenticated'](),controller[_0xc0a1('0x12')]);router[_0xc0a1('0x13')](_0xc0a1('0x9'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x14')]);router['delete']('/:id',auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index e866d96..8a2b964 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 _0xcb9a=['isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','long','setDataValue','formData'];(function(_0x523a03,_0x586509){var _0x12cac0=function(_0x40384e){while(--_0x40384e){_0x523a03['push'](_0x523a03['shift']());}};_0x12cac0(++_0x586509);}(_0xcb9a,0x1e5));var _0xacb9=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0xcb9a[_0x52b7b9];return _0x5b5d30;};'use strict';var Sequelize=require(_0xacb9('0x0'));var _=require(_0xacb9('0x1'));var util=require('util');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xacb9('0x2')),'set':function(_0x1cd038){if(_['isObjectLike'](_0x1cd038)){this[_0xacb9('0x3')](_0xacb9('0x4'),JSON['stringify'](_0x1cd038));}else if(_[_0xacb9('0x5')](_0x1cd038)){this[_0xacb9('0x3')]('formData',_0x1cd038);}else{this[_0xacb9('0x3')](_0xacb9('0x4'),util['format'](_0xacb9('0x6'),this[_0xacb9('0x7')]('name')||'',this[_0xacb9('0x7')](_0xacb9('0x8'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xacb9('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xb8aa=['formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','name','getDataValue','BOOLEAN','sequelize','lodash','util','STRING','TEXT','long','isObjectLike','setDataValue'];(function(_0x260cf5,_0x405fcf){var _0x48c107=function(_0x270767){while(--_0x270767){_0x260cf5['push'](_0x260cf5['shift']());}};_0x48c107(++_0x405fcf);}(_0xb8aa,0x98));var _0xab8a=function(_0x4c2b49,_0x20a689){_0x4c2b49=_0x4c2b49-0x0;var _0x6df97a=_0xb8aa[_0x4c2b49];return _0x6df97a;};'use strict';var Sequelize=require(_0xab8a('0x0'));var _=require(_0xab8a('0x1'));var util=require(_0xab8a('0x2'));module['exports']={'name':{'type':Sequelize[_0xab8a('0x3')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xab8a('0x4')](_0xab8a('0x5')),'set':function(_0x374a02){if(_[_0xab8a('0x6')](_0x374a02)){this[_0xab8a('0x7')](_0xab8a('0x8'),JSON[_0xab8a('0x9')](_0x374a02));}else if(_[_0xab8a('0xa')](_0x374a02)){this[_0xab8a('0x7')](_0xab8a('0x8'),_0x374a02);}else{this[_0xab8a('0x7')](_0xab8a('0x8'),util[_0xab8a('0xb')](_0xab8a('0xc'),this['getDataValue'](_0xab8a('0xd'))||'',this[_0xab8a('0xe')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xab8a('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xab8a('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index dea7dc8..1863bc1 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 _0xc80d=['-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','/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','path','sox','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','index','map','JscriptyProject','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','findAll','catch','show','params','rawAttributes','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','role','getSessions','findOne','rows','pick','ProjectId','JscriptyAnswerReport','apply','toString','indexOf','replace','getSummary','starttime','startTime','JscriptySessionReport','JscriptyQuestionReport'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xc80d,0x174));var _0xdc80=function(_0x344b32,_0x231ace){_0x344b32=_0x344b32-0x0;var _0x515d5f=_0xc80d[_0x344b32];return _0x515d5f;};'use strict';var pdf=require(_0xdc80('0x0'));var emlformat=require(_0xdc80('0x1'));var rimraf=require(_0xdc80('0x2'));var zipdir=require(_0xdc80('0x3'));var jsonpatch=require(_0xdc80('0x4'));var rp=require(_0xdc80('0x5'));var moment=require(_0xdc80('0x6'));var BPromise=require(_0xdc80('0x7'));var Mustache=require('mustache');var util=require(_0xdc80('0x8'));var path=require(_0xdc80('0x9'));var sox=require(_0xdc80('0xa'));var csv=require('to-csv');var ejs=require(_0xdc80('0xb'));var fs=require('fs');var _=require(_0xdc80('0xc'));var squel=require(_0xdc80('0xd'));var crypto=require(_0xdc80('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdc80('0xf'));var querystring=require('querystring');var Papa=require(_0xdc80('0x10'));var Redis=require(_0xdc80('0x11'));var authService=require(_0xdc80('0x12'));var qs=require(_0xdc80('0x13'));var as=require(_0xdc80('0x14'));var hardwareService=require(_0xdc80('0x15'));var logger=require(_0xdc80('0x16'))(_0xdc80('0x17'));var utils=require(_0xdc80('0x18'));var config=require('../../config/environment');var db=require(_0xdc80('0x19'))['db'];function respondWithStatusCode(_0x1e6aae,_0x713db5){_0x713db5=_0x713db5||0xcc;return function(_0x1898a7){if(_0x1898a7){return _0x1e6aae[_0xdc80('0x1a')](_0x713db5);}return _0x1e6aae[_0xdc80('0x1b')](_0x713db5)[_0xdc80('0x1c')]();};}function respondWithResult(_0x8447b,_0x12b2ce){_0x12b2ce=_0x12b2ce||0xc8;return function(_0xee850e){if(_0xee850e){return _0x8447b[_0xdc80('0x1b')](_0x12b2ce)['json'](_0xee850e);}};}function respondWithFilteredResult(_0x3953e3,_0x303893){return function(_0x257a39){if(_0x257a39){var _0x4eb79c=_0x257a39[_0xdc80('0x1d')],_0x58f2a1=_0x303893['offset'],_0x3e9d28=_0x303893[_0xdc80('0x1e')]+_0x303893[_0xdc80('0x1f')],_0x65c560;if(_0x3e9d28>=_0x4eb79c){_0x3e9d28=_0x4eb79c;_0x65c560=0xc8;}else{_0x65c560=0xce;}_0x3953e3[_0xdc80('0x1b')](_0x65c560);return _0x3953e3[_0xdc80('0x20')]('Content-Range',_0x58f2a1+'-'+_0x3e9d28+'/'+_0x4eb79c)['json'](_0x257a39);}return null;};}function patchUpdates(_0x16d693){return function(_0xdd8610){try{jsonpatch['apply'](_0xdd8610,_0x16d693,!![]);}catch(_0x5ae764){return BPromise[_0xdc80('0x21')](_0x5ae764);}return _0xdd8610[_0xdc80('0x22')]();};}function saveUpdates(_0x318720,_0x27482f){return function(_0x42f1d2){if(_0x42f1d2){return _0x42f1d2[_0xdc80('0x23')](_0x318720)[_0xdc80('0x24')](function(_0x2ba900){return _0x2ba900;});}return null;};}function removeEntity(_0x44ed81,_0x1bb6cd){return function(_0x5e84fc){if(_0x5e84fc){return _0x5e84fc[_0xdc80('0x25')]()[_0xdc80('0x24')](function(){var _0x12e897=_0x5e84fc[_0xdc80('0x26')]({'plain':!![]});var _0x3bb6b3=_0xdc80('0x27');return db[_0xdc80('0x28')][_0xdc80('0x25')]({'where':{'type':_0x3bb6b3,'resourceId':_0x12e897['id']}})['then'](function(){return _0x5e84fc;});})[_0xdc80('0x24')](function(){_0x44ed81['status'](0xcc)[_0xdc80('0x1c')]();});}};}function handleEntityNotFound(_0x14acb2,_0x201c79){return function(_0x2f3d9d){if(!_0x2f3d9d){_0x14acb2['sendStatus'](0x194);}return _0x2f3d9d;};}function handleError(_0x9a7459,_0x14af7a){_0x14af7a=_0x14af7a||0x1f4;return function(_0x3b687b){logger[_0xdc80('0x29')](_0x3b687b[_0xdc80('0x2a')]);if(_0x3b687b['name']){delete _0x3b687b[_0xdc80('0x2b')];}_0x9a7459[_0xdc80('0x1b')](_0x14af7a)['send'](_0x3b687b);};}exports[_0xdc80('0x2c')]=function(_0x149da1,_0x27614f){var _0x36c8a8={},_0x246839={},_0x2f5e5c={'count':0x0,'rows':[]};var _0x2503bb=_[_0xdc80('0x2d')](db[_0xdc80('0x2e')]['rawAttributes'],function(_0x473c43){return{'name':_0x473c43['fieldName'],'type':_0x473c43[_0xdc80('0x2f')][_0xdc80('0x30')]};});_0x246839[_0xdc80('0x31')]=_[_0xdc80('0x2d')](_0x2503bb,_0xdc80('0x2b'));_0x246839[_0xdc80('0x32')]=_[_0xdc80('0x33')](_0x149da1[_0xdc80('0x32')]);_0x246839['filters']=_[_0xdc80('0x34')](_0x246839['model'],_0x246839[_0xdc80('0x32')]);_0x36c8a8[_0xdc80('0x35')]=_[_0xdc80('0x34')](_0x246839[_0xdc80('0x31')],qs['fields'](_0x149da1[_0xdc80('0x32')][_0xdc80('0x36')]));_0x36c8a8['attributes']=_0x36c8a8['attributes'][_0xdc80('0x37')]?_0x36c8a8[_0xdc80('0x35')]:_0x246839[_0xdc80('0x31')];if(!_0x149da1[_0xdc80('0x32')][_0xdc80('0x38')](_0xdc80('0x39'))){_0x36c8a8[_0xdc80('0x1f')]=qs[_0xdc80('0x1f')](_0x149da1[_0xdc80('0x32')][_0xdc80('0x1f')]);_0x36c8a8[_0xdc80('0x1e')]=qs[_0xdc80('0x1e')](_0x149da1[_0xdc80('0x32')]['offset']);}_0x36c8a8[_0xdc80('0x3a')]=qs['sort'](_0x149da1[_0xdc80('0x32')][_0xdc80('0x3b')]);_0x36c8a8[_0xdc80('0x3c')]=qs[_0xdc80('0x3d')](_['pick'](_0x149da1[_0xdc80('0x32')],_0x246839[_0xdc80('0x3d')]),_0x2503bb);if(_0x149da1[_0xdc80('0x32')][_0xdc80('0x3e')]){_0x36c8a8[_0xdc80('0x3c')]=_[_0xdc80('0x3f')](_0x36c8a8[_0xdc80('0x3c')],{'$or':_[_0xdc80('0x2d')](_0x2503bb,function(_0x4c011c){if(_0x4c011c[_0xdc80('0x2f')]!=='VIRTUAL'){var _0x5a2741={};_0x5a2741[_0x4c011c[_0xdc80('0x2b')]]={'$like':'%'+_0x149da1[_0xdc80('0x32')][_0xdc80('0x3e')]+'%'};return _0x5a2741;}})});}_0x36c8a8=_[_0xdc80('0x3f')]({},_0x36c8a8,_0x149da1['options']);var _0x117616={'where':_0x36c8a8[_0xdc80('0x3c')]};return db[_0xdc80('0x2e')]['count'](_0x117616)[_0xdc80('0x24')](function(_0xfcdf85){_0x2f5e5c[_0xdc80('0x1d')]=_0xfcdf85;if(_0x149da1[_0xdc80('0x32')][_0xdc80('0x40')]){_0x36c8a8['include']=[{'all':!![]}];}return db[_0xdc80('0x2e')][_0xdc80('0x41')](_0x36c8a8);})[_0xdc80('0x24')](function(_0x45e8d7){_0x2f5e5c['rows']=_0x45e8d7;return _0x2f5e5c;})[_0xdc80('0x24')](respondWithFilteredResult(_0x27614f,_0x36c8a8))[_0xdc80('0x42')](handleError(_0x27614f,null));};exports[_0xdc80('0x43')]=function(_0x561d83,_0x27d790){var _0x45d3ca={'raw':![],'where':{'id':_0x561d83[_0xdc80('0x44')]['id']}},_0x388e58={};_0x388e58[_0xdc80('0x31')]=_[_0xdc80('0x33')](db['JscriptyProject'][_0xdc80('0x45')]);_0x388e58[_0xdc80('0x32')]=_[_0xdc80('0x33')](_0x561d83[_0xdc80('0x32')]);_0x388e58[_0xdc80('0x3d')]=_['intersection'](_0x388e58[_0xdc80('0x31')],_0x388e58[_0xdc80('0x32')]);_0x45d3ca[_0xdc80('0x35')]=_['intersection'](_0x388e58['model'],qs[_0xdc80('0x36')](_0x561d83[_0xdc80('0x32')][_0xdc80('0x36')]));_0x45d3ca[_0xdc80('0x35')]=_0x45d3ca[_0xdc80('0x35')][_0xdc80('0x37')]?_0x45d3ca['attributes']:_0x388e58['model'];if(_0x561d83['query'][_0xdc80('0x40')]){_0x45d3ca[_0xdc80('0x46')]=[{'all':!![]}];}_0x45d3ca=_['merge']({},_0x45d3ca,_0x561d83[_0xdc80('0x47')]);return db[_0xdc80('0x2e')][_0xdc80('0x48')](_0x45d3ca)['then'](handleEntityNotFound(_0x27d790,null))[_0xdc80('0x24')](respondWithResult(_0x27d790,null))['catch'](handleError(_0x27d790,null));};exports[_0xdc80('0x49')]=function(_0x5c8f83,_0x45bc3e){return db[_0xdc80('0x2e')][_0xdc80('0x49')](_0x5c8f83[_0xdc80('0x4a')],{})[_0xdc80('0x24')](function(_0xf43510){var _0x4f71be=_0x5c8f83[_0xdc80('0x4b')][_0xdc80('0x26')]({'plain':!![]});if(!_0x4f71be)throw new Error(_0xdc80('0x4c'));if(_0x4f71be['role']===_0xdc80('0x4b')){var _0x1b0b51=_0xf43510[_0xdc80('0x26')]({'plain':!![]});var _0x495148='Projects';return db[_0xdc80('0x4d')][_0xdc80('0x48')]({'where':{'name':_0x495148,'userProfileId':_0x4f71be[_0xdc80('0x4e')]},'raw':!![]})[_0xdc80('0x24')](function(_0x8b761f){if(_0x8b761f&&_0x8b761f[_0xdc80('0x4f')]===0x0){return db[_0xdc80('0x28')][_0xdc80('0x49')]({'name':_0x1b0b51['name'],'resourceId':_0x1b0b51['id'],'type':_0x8b761f['name'],'sectionId':_0x8b761f['id']},{})['then'](function(){return _0xf43510;});}else{return _0xf43510;}})[_0xdc80('0x42')](function(_0x268c5f){logger[_0xdc80('0x29')](_0xdc80('0x50'),_0x268c5f);throw _0x268c5f;});}return _0xf43510;})['then'](respondWithResult(_0x45bc3e,0xc9))['catch'](handleError(_0x45bc3e,null));};exports['clone']=function(_0x116b41,_0x4ed8e3){var _0x335b8e={'where':{'id':_0x116b41[_0xdc80('0x44')]['id']}},_0x3eac1a={};_0x3eac1a[_0xdc80('0x31')]=_['keys'](db[_0xdc80('0x2e')][_0xdc80('0x45')]);_0x335b8e[_0xdc80('0x35')]=_[_0xdc80('0x34')](_0x3eac1a[_0xdc80('0x31')],qs['fields'](_0x116b41[_0xdc80('0x32')][_0xdc80('0x36')]));_0x335b8e[_0xdc80('0x35')]=_0x335b8e['attributes'][_0xdc80('0x37')]?_0x335b8e[_0xdc80('0x35')]:_0x3eac1a[_0xdc80('0x31')];if(_0x116b41[_0xdc80('0x32')][_0xdc80('0x40')]){_0x335b8e[_0xdc80('0x46')]=[{'all':!![]}];}_0x335b8e=_[_0xdc80('0x3f')]({},_0x335b8e,_0x116b41[_0xdc80('0x47')]);return db[_0xdc80('0x2e')][_0xdc80('0x48')](_0x335b8e)[_0xdc80('0x24')](handleEntityNotFound(_0x4ed8e3,null))['then'](function(_0x525b98){if(_0x525b98){var _0xd05453=_0x525b98[_0xdc80('0x26')]({'plain':!![]});_0xd05453=qs[_0xdc80('0x51')](_0xd05453,['id',_0xdc80('0x52'),_0xdc80('0x53')]);_0x116b41['body']=_[_0xdc80('0x51')](_0x116b41[_0xdc80('0x4a')],['id',_0xdc80('0x52'),_0xdc80('0x53')]);return db['JscriptyProject'][_0xdc80('0x49')](_['merge'](_0xd05453,_0x116b41[_0xdc80('0x4a')]),{'include':_0x116b41[_0xdc80('0x32')][_0xdc80('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x593709){var _0x2e99c3=_0x116b41[_0xdc80('0x4b')][_0xdc80('0x26')]({'plain':!![]});if(!_0x2e99c3)throw new Error(_0xdc80('0x4c'));if(_0x2e99c3[_0xdc80('0x54')]===_0xdc80('0x4b')){var _0x295e9d=_0x593709[_0xdc80('0x26')]({'plain':!![]});var _0x5ea49f=_0xdc80('0x27');return db[_0xdc80('0x4d')]['find']({'where':{'name':_0x5ea49f,'userProfileId':_0x2e99c3[_0xdc80('0x4e')]},'raw':!![]})['then'](function(_0x1bf966){if(_0x1bf966&&_0x1bf966[_0xdc80('0x4f')]===0x0){return db[_0xdc80('0x28')][_0xdc80('0x49')]({'name':_0x295e9d[_0xdc80('0x2b')],'resourceId':_0x295e9d['id'],'type':_0x1bf966['name'],'sectionId':_0x1bf966['id']},{})[_0xdc80('0x24')](function(){return _0x593709;});}else{return _0x593709;}})['catch'](function(_0x5d5d01){logger[_0xdc80('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d5d01);throw _0x5d5d01;});}return _0x593709;});}})[_0xdc80('0x24')](respondWithResult(_0x4ed8e3,0xc9))['catch'](handleError(_0x4ed8e3,null));};exports[_0xdc80('0x23')]=function(_0x3a82a1,_0x3db105){if(_0x3a82a1['body']['id']){delete _0x3a82a1[_0xdc80('0x4a')]['id'];}return db[_0xdc80('0x2e')][_0xdc80('0x48')]({'where':{'id':_0x3a82a1['params']['id']}})[_0xdc80('0x24')](handleEntityNotFound(_0x3db105,null))[_0xdc80('0x24')](saveUpdates(_0x3a82a1[_0xdc80('0x4a')],null))['then'](respondWithResult(_0x3db105,null))[_0xdc80('0x42')](handleError(_0x3db105,null));};exports[_0xdc80('0x25')]=function(_0x11315e,_0x595d4e){return db['JscriptyProject'][_0xdc80('0x48')]({'where':{'id':_0x11315e[_0xdc80('0x44')]['id']}})[_0xdc80('0x24')](handleEntityNotFound(_0x595d4e,null))['then'](removeEntity(_0x595d4e,null))[_0xdc80('0x42')](handleError(_0x595d4e,null));};exports[_0xdc80('0x55')]=function(_0x2566c2,_0x4d4236,_0x5ab4ca){var _0x22c976={'raw':!![],'where':{}};var _0x3d1707={};var _0x5ef32a={'count':0x0,'rows':[]};return db[_0xdc80('0x2e')][_0xdc80('0x56')]({'where':{'id':_0x2566c2[_0xdc80('0x44')]['id']}})[_0xdc80('0x24')](handleEntityNotFound(_0x4d4236,null))[_0xdc80('0x24')](function(_0x3766a3){if(_0x3766a3){_0x3d1707[_0xdc80('0x31')]=_['keys'](db['JscriptySessionReport'][_0xdc80('0x45')]);_0x3d1707[_0xdc80('0x32')]=_[_0xdc80('0x33')](_0x2566c2[_0xdc80('0x32')]);_0x3d1707['filters']=_[_0xdc80('0x34')](_0x3d1707['model'],_0x3d1707[_0xdc80('0x32')]);_0x22c976['attributes']=_[_0xdc80('0x34')](_0x3d1707[_0xdc80('0x31')],qs['fields'](_0x2566c2[_0xdc80('0x32')][_0xdc80('0x36')]));_0x22c976[_0xdc80('0x35')]=_0x22c976[_0xdc80('0x35')]['length']?_0x22c976['attributes']:_0x3d1707[_0xdc80('0x31')];if(!_0x2566c2['query'][_0xdc80('0x38')](_0xdc80('0x39'))){_0x22c976[_0xdc80('0x1f')]=qs['limit'](_0x2566c2[_0xdc80('0x32')][_0xdc80('0x1f')]);_0x22c976['offset']=qs['offset'](_0x2566c2['query'][_0xdc80('0x1e')]);}_0x22c976[_0xdc80('0x3a')]=qs[_0xdc80('0x3b')](_0x2566c2['query'][_0xdc80('0x3b')]);_0x22c976['where']=qs[_0xdc80('0x3d')](_['pick'](_0x2566c2[_0xdc80('0x32')],_0x3d1707[_0xdc80('0x3d')]));_0x22c976[_0xdc80('0x3c')]['ProjectId']=_0x3766a3['id'];if(_0x2566c2['query'][_0xdc80('0x3e')]){_0x22c976[_0xdc80('0x3c')]=_[_0xdc80('0x3f')](_0x22c976['where'],{'$or':_[_0xdc80('0x2d')](_0x22c976[_0xdc80('0x35')],function(_0x1f9f02){var _0x289116={};_0x289116[_0x1f9f02]={'$like':'%'+_0x2566c2[_0xdc80('0x32')]['filter']+'%'};return _0x289116;})});}_0x22c976=_[_0xdc80('0x3f')]({},_0x22c976,_0x2566c2['options']);return db['JscriptySessionReport']['count']({'where':_0x22c976[_0xdc80('0x3c')]})['then'](function(_0x451db5){_0x5ef32a[_0xdc80('0x1d')]=_0x451db5;if(_0x2566c2[_0xdc80('0x32')]['includeAll']){_0x22c976['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0xdc80('0x41')](_0x22c976);})[_0xdc80('0x24')](function(_0x56f2e1){_0x5ef32a[_0xdc80('0x57')]=_0x56f2e1;return _0x5ef32a;});}})[_0xdc80('0x24')](respondWithFilteredResult(_0x4d4236,_0x22c976))[_0xdc80('0x42')](handleError(_0x4d4236,null));};exports['getAnswers']=function(_0x34e0e4,_0x377bde,_0x457e43){var _0x255d3e={'raw':!![],'where':{}};var _0x1edf8c={};var _0x2a1db9={'count':0x0,'rows':[]};return db[_0xdc80('0x2e')][_0xdc80('0x56')]({'where':{'id':_0x34e0e4[_0xdc80('0x44')]['id']}})[_0xdc80('0x24')](handleEntityNotFound(_0x377bde,null))[_0xdc80('0x24')](function(_0x37d7f7){if(_0x37d7f7){_0x1edf8c[_0xdc80('0x31')]=_[_0xdc80('0x33')](db['JscriptyAnswerReport']['rawAttributes']);_0x1edf8c['query']=_['keys'](_0x34e0e4[_0xdc80('0x32')]);_0x1edf8c['filters']=_[_0xdc80('0x34')](_0x1edf8c[_0xdc80('0x31')],_0x1edf8c[_0xdc80('0x32')]);_0x255d3e[_0xdc80('0x35')]=_[_0xdc80('0x34')](_0x1edf8c[_0xdc80('0x31')],qs[_0xdc80('0x36')](_0x34e0e4[_0xdc80('0x32')][_0xdc80('0x36')]));_0x255d3e[_0xdc80('0x35')]=_0x255d3e[_0xdc80('0x35')][_0xdc80('0x37')]?_0x255d3e[_0xdc80('0x35')]:_0x1edf8c[_0xdc80('0x31')];if(!_0x34e0e4[_0xdc80('0x32')][_0xdc80('0x38')](_0xdc80('0x39'))){_0x255d3e[_0xdc80('0x1f')]=qs[_0xdc80('0x1f')](_0x34e0e4[_0xdc80('0x32')][_0xdc80('0x1f')]);_0x255d3e[_0xdc80('0x1e')]=qs['offset'](_0x34e0e4[_0xdc80('0x32')][_0xdc80('0x1e')]);}_0x255d3e[_0xdc80('0x3a')]=qs[_0xdc80('0x3b')](_0x34e0e4['query'][_0xdc80('0x3b')]);_0x255d3e[_0xdc80('0x3c')]=qs[_0xdc80('0x3d')](_[_0xdc80('0x58')](_0x34e0e4[_0xdc80('0x32')],_0x1edf8c[_0xdc80('0x3d')]));_0x255d3e['where'][_0xdc80('0x59')]=_0x37d7f7['id'];if(_0x34e0e4[_0xdc80('0x32')][_0xdc80('0x3e')]){_0x255d3e['where']=_[_0xdc80('0x3f')](_0x255d3e[_0xdc80('0x3c')],{'$or':_[_0xdc80('0x2d')](_0x255d3e[_0xdc80('0x35')],function(_0x5ba9e2){var _0x5d596e={};_0x5d596e[_0x5ba9e2]={'$like':'%'+_0x34e0e4[_0xdc80('0x32')]['filter']+'%'};return _0x5d596e;})});}_0x255d3e=_[_0xdc80('0x3f')]({},_0x255d3e,_0x34e0e4['options']);return db[_0xdc80('0x5a')][_0xdc80('0x1d')]({'where':_0x255d3e[_0xdc80('0x3c')]})[_0xdc80('0x24')](function(_0x53e995){_0x2a1db9[_0xdc80('0x1d')]=_0x53e995;if(_0x34e0e4[_0xdc80('0x32')][_0xdc80('0x40')]){_0x255d3e[_0xdc80('0x46')]=[{'all':!![]}];}return db[_0xdc80('0x5a')][_0xdc80('0x41')](_0x255d3e);})[_0xdc80('0x24')](function(_0x2a5151){_0x2a1db9[_0xdc80('0x57')]=_0x2a5151;return _0x2a1db9;});}})['then'](respondWithFilteredResult(_0x377bde,_0x255d3e))[_0xdc80('0x42')](handleError(_0x377bde,null));};function char(_0xb135f1){return'number'===typeof _0xb135f1?String['fromCharCode'][_0xdc80('0x5b')](null,arguments):_0xb135f1;}function needsEncapsulation(_0xdcf26c){return!!_0xdcf26c&&(_0xdcf26c[_0xdc80('0x5c')]()[_0xdc80('0x5d')](char(0xd))>=0x0||_0xdcf26c[_0xdc80('0x5c')]()[_0xdc80('0x5d')](char(0xa))>=0x0||_0xdcf26c[_0xdc80('0x5c')]()[_0xdc80('0x5d')](char(0x2c))>=0x0||_0xdcf26c[_0xdc80('0x5c')]()[_0xdc80('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x52b878){var _0x3f10ab=char(0x22),_0x406f72='\x5c'+char(0x22),_0x5572fe=_0x52b878['toString']()[_0xdc80('0x5e')](new RegExp(_0x3f10ab,'g'),_0x406f72);return _0x3f10ab+_0x5572fe+_0x3f10ab;}exports[_0xdc80('0x5f')]=function(_0x112e98,_0x1d59da,_0x1c2d57){var _0x4fb4f9,_0x363cb4;var _0x7abc25={'where':{'ProjectId':_0x112e98[_0xdc80('0x44')]['id']}};if(_0x112e98['query']['startTime']){_0x7abc25['where'][_0xdc80('0x60')]=JSON['parse'](_0x112e98[_0xdc80('0x32')][_0xdc80('0x61')]);}return db[_0xdc80('0x62')]['findAll'](_0x7abc25)[_0xdc80('0x24')](handleEntityNotFound(_0x1d59da,null))['then'](function(_0x26a5ae){if(_0x26a5ae){_0x4fb4f9=_0x26a5ae;return db[_0xdc80('0x63')][_0xdc80('0x41')]({'where':{'SessionId':{'$in':_[_0xdc80('0x2d')](_0x4fb4f9,'id')},'ProjectId':_0x112e98[_0xdc80('0x44')]['id']},'order':_0xdc80('0x64')});}})[_0xdc80('0x24')](handleEntityNotFound(_0x1d59da,null))[_0xdc80('0x24')](function(_0x282b4e){if(_0x282b4e){_0x363cb4=_0x282b4e;var _0x25cf42={};for(var _0x25c6e0=0x0,_0x521044=_0x363cb4[_0xdc80('0x37')];_0x25c6e0<_0x521044;_0x25c6e0++){if(!_0x25cf42[_0xdc80('0x38')](_0x363cb4[_0x25c6e0][_0xdc80('0x65')])){_0x25cf42[_0x363cb4[_0x25c6e0]['questionId']]=needsEncapsulation(_0x363cb4[_0x25c6e0][_0xdc80('0x66')])?encapsulate(_0x363cb4[_0x25c6e0][_0xdc80('0x66')]):_0x363cb4[_0x25c6e0][_0xdc80('0x66')];}}var _0x3b476b=[],_0x47a533={};for(var _0x4cb20f=0x0,_0x3c22bd=_0x4fb4f9['length'];_0x4cb20f<_0x3c22bd;_0x4cb20f++){_0x47a533={'ProjectId':_0x112e98[_0xdc80('0x44')]['id'],'SessionId':_0x4fb4f9[_0x4cb20f]['id'],'StartTime':moment(_0x4fb4f9[_0x4cb20f][_0xdc80('0x60')])[_0xdc80('0x67')](_0xdc80('0x68'))};for(var _0x29a9f2=0x0,_0x15503d=_0x363cb4[_0xdc80('0x37')];_0x29a9f2<_0x15503d;_0x29a9f2++){if(_0x363cb4[_0x29a9f2][_0xdc80('0x69')]==_0x4fb4f9[_0x4cb20f]['id']&&_0x25cf42['hasOwnProperty'](_0x363cb4[_0x29a9f2][_0xdc80('0x65')])){_0x47a533[_0x25cf42[_0x363cb4[_0x29a9f2][_0xdc80('0x65')]]]=_0x363cb4[_0x29a9f2][_0xdc80('0x6a')];}}for(var _0x5bf95c in _0x25cf42){if(!_0x47a533[_0xdc80('0x38')](_0x25cf42[_0x5bf95c])){_0x47a533[_0x25cf42[_0x5bf95c]]=null;}}_0x3b476b[_0xdc80('0x6b')](_0x47a533);}return _0x3b476b;}})['then'](function(_0x350fb1){if(!_[_0xdc80('0x6c')](_0x350fb1)){var _0x175c26=toCsv(_0x350fb1);var _0x91871d=Date[_0xdc80('0x6d')]();fs['writeFileSync'](util['format'](_0xdc80('0x6e'),_0x112e98[_0xdc80('0x44')]['id'],_0x91871d),_0x175c26);_0x1d59da[_0xdc80('0x6f')](_0xdc80('0x70'),_0xdc80('0x71')+util[_0xdc80('0x67')](_0xdc80('0x72'),_0x112e98[_0xdc80('0x44')]['id'],_0x91871d));_0x1d59da['setHeader'](_0xdc80('0x73'),_0xdc80('0x74'));return _0x1d59da[_0xdc80('0x75')](util[_0xdc80('0x67')](_0xdc80('0x6e'),_0x112e98['params']['id'],_0x91871d));}else{return _0x1d59da['sendStatus'](0xcc);}})[_0xdc80('0x42')](handleError(_0x1d59da,null));}; \ No newline at end of file +var _0xc161=['find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','createdAt','updatedAt','body','role','UserProfileSection','autoAssociation','findOne','JscriptySessionReport','sort','rows','getAnswers','nolimit','ProjectId','JscriptyAnswerReport','number','indexOf','toString','replace','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','answer','push','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','download','sendStatus','html-pdf','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','pick','where','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','show','params'];(function(_0xbed8a2,_0x578ae3){var _0x11d4f2=function(_0x49e846){while(--_0x49e846){_0xbed8a2['push'](_0xbed8a2['shift']());}};_0x11d4f2(++_0x578ae3);}(_0xc161,0x183));var _0x1c16=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0xc161[_0x50f392];return _0x5926f2;};'use strict';var pdf=require(_0x1c16('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1c16('0x1'));var zipdir=require(_0x1c16('0x2'));var jsonpatch=require(_0x1c16('0x3'));var rp=require('request-promise');var moment=require(_0x1c16('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1c16('0x5'));var path=require(_0x1c16('0x6'));var sox=require(_0x1c16('0x7'));var csv=require(_0x1c16('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c16('0x9'));var squel=require(_0x1c16('0xa'));var crypto=require(_0x1c16('0xb'));var jsforce=require(_0x1c16('0xc'));var deskjs=require(_0x1c16('0xd'));var toCsv=require(_0x1c16('0x8'));var querystring=require(_0x1c16('0xe'));var Papa=require(_0x1c16('0xf'));var Redis=require(_0x1c16('0x10'));var authService=require(_0x1c16('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c16('0x12'));var logger=require(_0x1c16('0x13'))(_0x1c16('0x14'));var utils=require('../../config/utils');var config=require(_0x1c16('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x281802,_0x1cf2d3){_0x1cf2d3=_0x1cf2d3||0xcc;return function(_0x56c89f){if(_0x56c89f){return _0x281802['sendStatus'](_0x1cf2d3);}return _0x281802[_0x1c16('0x16')](_0x1cf2d3)[_0x1c16('0x17')]();};}function respondWithResult(_0x567a79,_0x317cd0){_0x317cd0=_0x317cd0||0xc8;return function(_0x83e958){if(_0x83e958){return _0x567a79[_0x1c16('0x16')](_0x317cd0)[_0x1c16('0x18')](_0x83e958);}};}function respondWithFilteredResult(_0x18ab2b,_0x31e4a4){return function(_0x274c30){if(_0x274c30){var _0x18ee3c=_0x274c30['count'],_0x57643c=_0x31e4a4[_0x1c16('0x19')],_0x3f976b=_0x31e4a4[_0x1c16('0x19')]+_0x31e4a4[_0x1c16('0x1a')],_0x592dd8;if(_0x3f976b>=_0x18ee3c){_0x3f976b=_0x18ee3c;_0x592dd8=0xc8;}else{_0x592dd8=0xce;}_0x18ab2b[_0x1c16('0x16')](_0x592dd8);return _0x18ab2b[_0x1c16('0x1b')](_0x1c16('0x1c'),_0x57643c+'-'+_0x3f976b+'/'+_0x18ee3c)[_0x1c16('0x18')](_0x274c30);}return null;};}function patchUpdates(_0x4a51db){return function(_0x3b5fdb){try{jsonpatch[_0x1c16('0x1d')](_0x3b5fdb,_0x4a51db,!![]);}catch(_0x56dffa){return BPromise[_0x1c16('0x1e')](_0x56dffa);}return _0x3b5fdb[_0x1c16('0x1f')]();};}function saveUpdates(_0x29321b,_0x1e7fd7){return function(_0x1a8c16){if(_0x1a8c16){return _0x1a8c16[_0x1c16('0x20')](_0x29321b)[_0x1c16('0x21')](function(_0x76b294){return _0x76b294;});}return null;};}function removeEntity(_0x187d79,_0x2e21ee){return function(_0x2cfff5){if(_0x2cfff5){return _0x2cfff5[_0x1c16('0x22')]()['then'](function(){var _0x471068=_0x2cfff5['get']({'plain':!![]});var _0x2aca85=_0x1c16('0x23');return db[_0x1c16('0x24')][_0x1c16('0x22')]({'where':{'type':_0x2aca85,'resourceId':_0x471068['id']}})['then'](function(){return _0x2cfff5;});})['then'](function(){_0x187d79[_0x1c16('0x16')](0xcc)[_0x1c16('0x17')]();});}};}function handleEntityNotFound(_0x53cd9f,_0x292ecb){return function(_0x233fff){if(!_0x233fff){_0x53cd9f['sendStatus'](0x194);}return _0x233fff;};}function handleError(_0x23a14a,_0x135e66){_0x135e66=_0x135e66||0x1f4;return function(_0x2f0631){logger[_0x1c16('0x25')](_0x2f0631[_0x1c16('0x26')]);if(_0x2f0631['name']){delete _0x2f0631[_0x1c16('0x27')];}_0x23a14a['status'](_0x135e66)[_0x1c16('0x28')](_0x2f0631);};}exports[_0x1c16('0x29')]=function(_0x4e6cae,_0x2e0d39){var _0x247084={},_0x386a5f={},_0xc2b38e={'count':0x0,'rows':[]};var _0xa2dd31=_[_0x1c16('0x2a')](db[_0x1c16('0x2b')][_0x1c16('0x2c')],function(_0x3ba3e1){return{'name':_0x3ba3e1[_0x1c16('0x2d')],'type':_0x3ba3e1[_0x1c16('0x2e')][_0x1c16('0x2f')]};});_0x386a5f[_0x1c16('0x30')]=_[_0x1c16('0x2a')](_0xa2dd31,_0x1c16('0x27'));_0x386a5f['query']=_[_0x1c16('0x31')](_0x4e6cae[_0x1c16('0x32')]);_0x386a5f[_0x1c16('0x33')]=_[_0x1c16('0x34')](_0x386a5f[_0x1c16('0x30')],_0x386a5f[_0x1c16('0x32')]);_0x247084['attributes']=_[_0x1c16('0x34')](_0x386a5f['model'],qs[_0x1c16('0x35')](_0x4e6cae[_0x1c16('0x32')][_0x1c16('0x35')]));_0x247084[_0x1c16('0x36')]=_0x247084[_0x1c16('0x36')]['length']?_0x247084[_0x1c16('0x36')]:_0x386a5f[_0x1c16('0x30')];if(!_0x4e6cae[_0x1c16('0x32')][_0x1c16('0x37')]('nolimit')){_0x247084[_0x1c16('0x1a')]=qs[_0x1c16('0x1a')](_0x4e6cae[_0x1c16('0x32')]['limit']);_0x247084['offset']=qs['offset'](_0x4e6cae[_0x1c16('0x32')][_0x1c16('0x19')]);}_0x247084[_0x1c16('0x38')]=qs['sort'](_0x4e6cae['query']['sort']);_0x247084['where']=qs['filters'](_[_0x1c16('0x39')](_0x4e6cae[_0x1c16('0x32')],_0x386a5f['filters']),_0xa2dd31);if(_0x4e6cae[_0x1c16('0x32')]['filter']){_0x247084['where']=_['merge'](_0x247084[_0x1c16('0x3a')],{'$or':_[_0x1c16('0x2a')](_0xa2dd31,function(_0x20fcb7){if(_0x20fcb7[_0x1c16('0x2e')]!==_0x1c16('0x3b')){var _0x17f174={};_0x17f174[_0x20fcb7[_0x1c16('0x27')]]={'$like':'%'+_0x4e6cae[_0x1c16('0x32')][_0x1c16('0x3c')]+'%'};return _0x17f174;}})});}_0x247084=_[_0x1c16('0x3d')]({},_0x247084,_0x4e6cae[_0x1c16('0x3e')]);var _0x21f0ca={'where':_0x247084[_0x1c16('0x3a')]};return db[_0x1c16('0x2b')][_0x1c16('0x3f')](_0x21f0ca)[_0x1c16('0x21')](function(_0x13020){_0xc2b38e[_0x1c16('0x3f')]=_0x13020;if(_0x4e6cae['query'][_0x1c16('0x40')]){_0x247084[_0x1c16('0x41')]=[{'all':!![]}];}return db[_0x1c16('0x2b')][_0x1c16('0x42')](_0x247084);})[_0x1c16('0x21')](function(_0x5915f8){_0xc2b38e['rows']=_0x5915f8;return _0xc2b38e;})[_0x1c16('0x21')](respondWithFilteredResult(_0x2e0d39,_0x247084))['catch'](handleError(_0x2e0d39,null));};exports[_0x1c16('0x43')]=function(_0x42414d,_0x2592f4){var _0xc469a5={'raw':![],'where':{'id':_0x42414d[_0x1c16('0x44')]['id']}},_0x57e6bf={};_0x57e6bf[_0x1c16('0x30')]=_[_0x1c16('0x31')](db[_0x1c16('0x2b')][_0x1c16('0x2c')]);_0x57e6bf[_0x1c16('0x32')]=_[_0x1c16('0x31')](_0x42414d[_0x1c16('0x32')]);_0x57e6bf['filters']=_[_0x1c16('0x34')](_0x57e6bf[_0x1c16('0x30')],_0x57e6bf[_0x1c16('0x32')]);_0xc469a5['attributes']=_[_0x1c16('0x34')](_0x57e6bf['model'],qs[_0x1c16('0x35')](_0x42414d[_0x1c16('0x32')][_0x1c16('0x35')]));_0xc469a5[_0x1c16('0x36')]=_0xc469a5['attributes']['length']?_0xc469a5[_0x1c16('0x36')]:_0x57e6bf[_0x1c16('0x30')];if(_0x42414d[_0x1c16('0x32')][_0x1c16('0x40')]){_0xc469a5[_0x1c16('0x41')]=[{'all':!![]}];}_0xc469a5=_[_0x1c16('0x3d')]({},_0xc469a5,_0x42414d[_0x1c16('0x3e')]);return db[_0x1c16('0x2b')][_0x1c16('0x45')](_0xc469a5)[_0x1c16('0x21')](handleEntityNotFound(_0x2592f4,null))['then'](respondWithResult(_0x2592f4,null))[_0x1c16('0x46')](handleError(_0x2592f4,null));};exports[_0x1c16('0x47')]=function(_0x3b5705,_0x3c8ee0){return db['JscriptyProject'][_0x1c16('0x47')](_0x3b5705['body'],{})[_0x1c16('0x21')](function(_0xc244a1){var _0xbd8bbd=_0x3b5705['user'][_0x1c16('0x48')]({'plain':!![]});if(!_0xbd8bbd)throw new Error(_0x1c16('0x49'));if(_0xbd8bbd['role']===_0x1c16('0x4a')){var _0x4c963e=_0xc244a1[_0x1c16('0x48')]({'plain':!![]});var _0x1ddf11=_0x1c16('0x23');return db['UserProfileSection'][_0x1c16('0x45')]({'where':{'name':_0x1ddf11,'userProfileId':_0xbd8bbd[_0x1c16('0x4b')]},'raw':!![]})[_0x1c16('0x21')](function(_0x2e3673){if(_0x2e3673&&_0x2e3673['autoAssociation']===0x0){return db['UserProfileResource'][_0x1c16('0x47')]({'name':_0x4c963e[_0x1c16('0x27')],'resourceId':_0x4c963e['id'],'type':_0x2e3673[_0x1c16('0x27')],'sectionId':_0x2e3673['id']},{})[_0x1c16('0x21')](function(){return _0xc244a1;});}else{return _0xc244a1;}})[_0x1c16('0x46')](function(_0x135fc2){logger[_0x1c16('0x25')](_0x1c16('0x4c'),_0x135fc2);throw _0x135fc2;});}return _0xc244a1;})['then'](respondWithResult(_0x3c8ee0,0xc9))[_0x1c16('0x46')](handleError(_0x3c8ee0,null));};exports[_0x1c16('0x4d')]=function(_0x212659,_0x5360e4){var _0x790f06={'where':{'id':_0x212659[_0x1c16('0x44')]['id']}},_0x1472ac={};_0x1472ac[_0x1c16('0x30')]=_[_0x1c16('0x31')](db['JscriptyProject'][_0x1c16('0x2c')]);_0x790f06[_0x1c16('0x36')]=_[_0x1c16('0x34')](_0x1472ac[_0x1c16('0x30')],qs[_0x1c16('0x35')](_0x212659['query'][_0x1c16('0x35')]));_0x790f06[_0x1c16('0x36')]=_0x790f06[_0x1c16('0x36')][_0x1c16('0x4e')]?_0x790f06['attributes']:_0x1472ac[_0x1c16('0x30')];if(_0x212659['query'][_0x1c16('0x40')]){_0x790f06[_0x1c16('0x41')]=[{'all':!![]}];}_0x790f06=_['merge']({},_0x790f06,_0x212659['options']);return db[_0x1c16('0x2b')][_0x1c16('0x45')](_0x790f06)[_0x1c16('0x21')](handleEntityNotFound(_0x5360e4,null))[_0x1c16('0x21')](function(_0x1c9001){if(_0x1c9001){var _0x57358f=_0x1c9001[_0x1c16('0x48')]({'plain':!![]});_0x57358f=qs['omit'](_0x57358f,['id',_0x1c16('0x4f'),_0x1c16('0x50')]);_0x212659['body']=_['omit'](_0x212659['body'],['id',_0x1c16('0x4f'),_0x1c16('0x50')]);return db['JscriptyProject'][_0x1c16('0x47')](_[_0x1c16('0x3d')](_0x57358f,_0x212659[_0x1c16('0x51')]),{'include':_0x212659[_0x1c16('0x32')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x20e111){var _0x16dc79=_0x212659[_0x1c16('0x4a')]['get']({'plain':!![]});if(!_0x16dc79)throw new Error(_0x1c16('0x49'));if(_0x16dc79[_0x1c16('0x52')]==='user'){var _0x2a01e0=_0x20e111[_0x1c16('0x48')]({'plain':!![]});var _0x42363c=_0x1c16('0x23');return db[_0x1c16('0x53')][_0x1c16('0x45')]({'where':{'name':_0x42363c,'userProfileId':_0x16dc79[_0x1c16('0x4b')]},'raw':!![]})[_0x1c16('0x21')](function(_0x433bfc){if(_0x433bfc&&_0x433bfc[_0x1c16('0x54')]===0x0){return db[_0x1c16('0x24')][_0x1c16('0x47')]({'name':_0x2a01e0[_0x1c16('0x27')],'resourceId':_0x2a01e0['id'],'type':_0x433bfc['name'],'sectionId':_0x433bfc['id']},{})[_0x1c16('0x21')](function(){return _0x20e111;});}else{return _0x20e111;}})[_0x1c16('0x46')](function(_0x18a849){logger[_0x1c16('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18a849);throw _0x18a849;});}return _0x20e111;});}})[_0x1c16('0x21')](respondWithResult(_0x5360e4,0xc9))[_0x1c16('0x46')](handleError(_0x5360e4,null));};exports[_0x1c16('0x20')]=function(_0x4219f2,_0x429d55){if(_0x4219f2[_0x1c16('0x51')]['id']){delete _0x4219f2[_0x1c16('0x51')]['id'];}return db[_0x1c16('0x2b')][_0x1c16('0x45')]({'where':{'id':_0x4219f2['params']['id']}})[_0x1c16('0x21')](handleEntityNotFound(_0x429d55,null))[_0x1c16('0x21')](saveUpdates(_0x4219f2[_0x1c16('0x51')],null))[_0x1c16('0x21')](respondWithResult(_0x429d55,null))[_0x1c16('0x46')](handleError(_0x429d55,null));};exports[_0x1c16('0x22')]=function(_0x43542b,_0x581d95){return db['JscriptyProject'][_0x1c16('0x45')]({'where':{'id':_0x43542b[_0x1c16('0x44')]['id']}})['then'](handleEntityNotFound(_0x581d95,null))['then'](removeEntity(_0x581d95,null))['catch'](handleError(_0x581d95,null));};exports['getSessions']=function(_0xb35c23,_0x21214c,_0x2761b4){var _0x58844b={'raw':!![],'where':{}};var _0x2a82fb={};var _0x15a0c4={'count':0x0,'rows':[]};return db[_0x1c16('0x2b')][_0x1c16('0x55')]({'where':{'id':_0xb35c23[_0x1c16('0x44')]['id']}})[_0x1c16('0x21')](handleEntityNotFound(_0x21214c,null))[_0x1c16('0x21')](function(_0x243d29){if(_0x243d29){_0x2a82fb[_0x1c16('0x30')]=_[_0x1c16('0x31')](db[_0x1c16('0x56')][_0x1c16('0x2c')]);_0x2a82fb[_0x1c16('0x32')]=_['keys'](_0xb35c23['query']);_0x2a82fb['filters']=_[_0x1c16('0x34')](_0x2a82fb[_0x1c16('0x30')],_0x2a82fb[_0x1c16('0x32')]);_0x58844b['attributes']=_[_0x1c16('0x34')](_0x2a82fb['model'],qs[_0x1c16('0x35')](_0xb35c23[_0x1c16('0x32')][_0x1c16('0x35')]));_0x58844b[_0x1c16('0x36')]=_0x58844b[_0x1c16('0x36')][_0x1c16('0x4e')]?_0x58844b[_0x1c16('0x36')]:_0x2a82fb[_0x1c16('0x30')];if(!_0xb35c23[_0x1c16('0x32')][_0x1c16('0x37')]('nolimit')){_0x58844b[_0x1c16('0x1a')]=qs[_0x1c16('0x1a')](_0xb35c23[_0x1c16('0x32')]['limit']);_0x58844b[_0x1c16('0x19')]=qs[_0x1c16('0x19')](_0xb35c23[_0x1c16('0x32')][_0x1c16('0x19')]);}_0x58844b['order']=qs['sort'](_0xb35c23[_0x1c16('0x32')][_0x1c16('0x57')]);_0x58844b['where']=qs[_0x1c16('0x33')](_['pick'](_0xb35c23[_0x1c16('0x32')],_0x2a82fb[_0x1c16('0x33')]));_0x58844b[_0x1c16('0x3a')]['ProjectId']=_0x243d29['id'];if(_0xb35c23[_0x1c16('0x32')][_0x1c16('0x3c')]){_0x58844b[_0x1c16('0x3a')]=_[_0x1c16('0x3d')](_0x58844b[_0x1c16('0x3a')],{'$or':_[_0x1c16('0x2a')](_0x58844b[_0x1c16('0x36')],function(_0x15482d){var _0x1ae952={};_0x1ae952[_0x15482d]={'$like':'%'+_0xb35c23['query'][_0x1c16('0x3c')]+'%'};return _0x1ae952;})});}_0x58844b=_['merge']({},_0x58844b,_0xb35c23[_0x1c16('0x3e')]);return db[_0x1c16('0x56')][_0x1c16('0x3f')]({'where':_0x58844b['where']})[_0x1c16('0x21')](function(_0xc03ebc){_0x15a0c4[_0x1c16('0x3f')]=_0xc03ebc;if(_0xb35c23[_0x1c16('0x32')][_0x1c16('0x40')]){_0x58844b['include']=[{'all':!![]}];}return db[_0x1c16('0x56')][_0x1c16('0x42')](_0x58844b);})[_0x1c16('0x21')](function(_0x32d2ee){_0x15a0c4[_0x1c16('0x58')]=_0x32d2ee;return _0x15a0c4;});}})[_0x1c16('0x21')](respondWithFilteredResult(_0x21214c,_0x58844b))[_0x1c16('0x46')](handleError(_0x21214c,null));};exports[_0x1c16('0x59')]=function(_0x5ce9b8,_0x44ba5d,_0x16d358){var _0x37a229={'raw':!![],'where':{}};var _0x5e7b95={};var _0x143cb5={'count':0x0,'rows':[]};return db[_0x1c16('0x2b')][_0x1c16('0x55')]({'where':{'id':_0x5ce9b8['params']['id']}})['then'](handleEntityNotFound(_0x44ba5d,null))[_0x1c16('0x21')](function(_0x334d2a){if(_0x334d2a){_0x5e7b95[_0x1c16('0x30')]=_[_0x1c16('0x31')](db['JscriptyAnswerReport'][_0x1c16('0x2c')]);_0x5e7b95[_0x1c16('0x32')]=_[_0x1c16('0x31')](_0x5ce9b8[_0x1c16('0x32')]);_0x5e7b95[_0x1c16('0x33')]=_[_0x1c16('0x34')](_0x5e7b95[_0x1c16('0x30')],_0x5e7b95[_0x1c16('0x32')]);_0x37a229[_0x1c16('0x36')]=_[_0x1c16('0x34')](_0x5e7b95['model'],qs['fields'](_0x5ce9b8[_0x1c16('0x32')][_0x1c16('0x35')]));_0x37a229[_0x1c16('0x36')]=_0x37a229['attributes'][_0x1c16('0x4e')]?_0x37a229[_0x1c16('0x36')]:_0x5e7b95[_0x1c16('0x30')];if(!_0x5ce9b8[_0x1c16('0x32')]['hasOwnProperty'](_0x1c16('0x5a'))){_0x37a229[_0x1c16('0x1a')]=qs[_0x1c16('0x1a')](_0x5ce9b8[_0x1c16('0x32')][_0x1c16('0x1a')]);_0x37a229[_0x1c16('0x19')]=qs['offset'](_0x5ce9b8['query'][_0x1c16('0x19')]);}_0x37a229[_0x1c16('0x38')]=qs['sort'](_0x5ce9b8[_0x1c16('0x32')][_0x1c16('0x57')]);_0x37a229['where']=qs[_0x1c16('0x33')](_[_0x1c16('0x39')](_0x5ce9b8[_0x1c16('0x32')],_0x5e7b95[_0x1c16('0x33')]));_0x37a229[_0x1c16('0x3a')][_0x1c16('0x5b')]=_0x334d2a['id'];if(_0x5ce9b8[_0x1c16('0x32')][_0x1c16('0x3c')]){_0x37a229[_0x1c16('0x3a')]=_[_0x1c16('0x3d')](_0x37a229['where'],{'$or':_['map'](_0x37a229[_0x1c16('0x36')],function(_0x419b91){var _0x721262={};_0x721262[_0x419b91]={'$like':'%'+_0x5ce9b8[_0x1c16('0x32')]['filter']+'%'};return _0x721262;})});}_0x37a229=_['merge']({},_0x37a229,_0x5ce9b8['options']);return db['JscriptyAnswerReport'][_0x1c16('0x3f')]({'where':_0x37a229['where']})[_0x1c16('0x21')](function(_0x58925d){_0x143cb5[_0x1c16('0x3f')]=_0x58925d;if(_0x5ce9b8[_0x1c16('0x32')][_0x1c16('0x40')]){_0x37a229[_0x1c16('0x41')]=[{'all':!![]}];}return db[_0x1c16('0x5c')][_0x1c16('0x42')](_0x37a229);})[_0x1c16('0x21')](function(_0x19c98d){_0x143cb5[_0x1c16('0x58')]=_0x19c98d;return _0x143cb5;});}})[_0x1c16('0x21')](respondWithFilteredResult(_0x44ba5d,_0x37a229))[_0x1c16('0x46')](handleError(_0x44ba5d,null));};function char(_0x1c5d6a){return _0x1c16('0x5d')===typeof _0x1c5d6a?String['fromCharCode'][_0x1c16('0x1d')](null,arguments):_0x1c5d6a;}function needsEncapsulation(_0x20da49){return!!_0x20da49&&(_0x20da49['toString']()[_0x1c16('0x5e')](char(0xd))>=0x0||_0x20da49[_0x1c16('0x5f')]()[_0x1c16('0x5e')](char(0xa))>=0x0||_0x20da49[_0x1c16('0x5f')]()['indexOf'](char(0x2c))>=0x0||_0x20da49[_0x1c16('0x5f')]()[_0x1c16('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x4909da){var _0x4a42e1=char(0x22),_0x140fd3='\x5c'+char(0x22),_0x6a0a09=_0x4909da['toString']()[_0x1c16('0x60')](new RegExp(_0x4a42e1,'g'),_0x140fd3);return _0x4a42e1+_0x6a0a09+_0x4a42e1;}exports[_0x1c16('0x61')]=function(_0x5af8fe,_0x1564c8,_0x54b6ab){var _0x26a7ac,_0x1fc88c;var _0x4ef3c6={'where':{'ProjectId':_0x5af8fe[_0x1c16('0x44')]['id']}};if(_0x5af8fe[_0x1c16('0x32')][_0x1c16('0x62')]){_0x4ef3c6[_0x1c16('0x3a')][_0x1c16('0x63')]=JSON['parse'](_0x5af8fe[_0x1c16('0x32')]['startTime']);}return db['JscriptySessionReport'][_0x1c16('0x42')](_0x4ef3c6)[_0x1c16('0x21')](handleEntityNotFound(_0x1564c8,null))[_0x1c16('0x21')](function(_0x5b6a85){if(_0x5b6a85){_0x26a7ac=_0x5b6a85;return db[_0x1c16('0x64')][_0x1c16('0x42')]({'where':{'SessionId':{'$in':_[_0x1c16('0x2a')](_0x26a7ac,'id')},'ProjectId':_0x5af8fe[_0x1c16('0x44')]['id']},'order':_0x1c16('0x65')});}})[_0x1c16('0x21')](handleEntityNotFound(_0x1564c8,null))[_0x1c16('0x21')](function(_0xa7e0f0){if(_0xa7e0f0){_0x1fc88c=_0xa7e0f0;var _0x8b7330={};for(var _0x259acf=0x0,_0x51cfb1=_0x1fc88c['length'];_0x259acf<_0x51cfb1;_0x259acf++){if(!_0x8b7330[_0x1c16('0x37')](_0x1fc88c[_0x259acf][_0x1c16('0x66')])){_0x8b7330[_0x1fc88c[_0x259acf][_0x1c16('0x66')]]=needsEncapsulation(_0x1fc88c[_0x259acf][_0x1c16('0x67')])?encapsulate(_0x1fc88c[_0x259acf][_0x1c16('0x67')]):_0x1fc88c[_0x259acf][_0x1c16('0x67')];}}var _0x12162d=[],_0x9d107d={};for(var _0x40d956=0x0,_0x5c6a88=_0x26a7ac[_0x1c16('0x4e')];_0x40d956<_0x5c6a88;_0x40d956++){_0x9d107d={'ProjectId':_0x5af8fe[_0x1c16('0x44')]['id'],'SessionId':_0x26a7ac[_0x40d956]['id'],'StartTime':moment(_0x26a7ac[_0x40d956]['starttime'])[_0x1c16('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x5c1ec8=0x0,_0x5592ea=_0x1fc88c[_0x1c16('0x4e')];_0x5c1ec8<_0x5592ea;_0x5c1ec8++){if(_0x1fc88c[_0x5c1ec8]['SessionId']==_0x26a7ac[_0x40d956]['id']&&_0x8b7330[_0x1c16('0x37')](_0x1fc88c[_0x5c1ec8][_0x1c16('0x66')])){_0x9d107d[_0x8b7330[_0x1fc88c[_0x5c1ec8]['questionId']]]=_0x1fc88c[_0x5c1ec8][_0x1c16('0x69')];}}for(var _0x184e4c in _0x8b7330){if(!_0x9d107d[_0x1c16('0x37')](_0x8b7330[_0x184e4c])){_0x9d107d[_0x8b7330[_0x184e4c]]=null;}}_0x12162d[_0x1c16('0x6a')](_0x9d107d);}return _0x12162d;}})[_0x1c16('0x21')](function(_0x453418){if(!_['isEmpty'](_0x453418)){var _0x31a718=toCsv(_0x453418);var _0x5efb5c=Date['now']();fs[_0x1c16('0x6b')](util['format'](_0x1c16('0x6c'),_0x5af8fe[_0x1c16('0x44')]['id'],_0x5efb5c),_0x31a718);_0x1564c8[_0x1c16('0x6d')](_0x1c16('0x6e'),_0x1c16('0x6f')+util[_0x1c16('0x68')]('Jscripty_Project_%d_Summary_%s.csv',_0x5af8fe[_0x1c16('0x44')]['id'],_0x5efb5c));_0x1564c8['setHeader']('Content-type','text/csv');return _0x1564c8[_0x1c16('0x70')](util['format'](_0x1c16('0x6c'),_0x5af8fe[_0x1c16('0x44')]['id'],_0x5efb5c));}else{return _0x1564c8[_0x1c16('0x71')](0xcc);}})[_0x1c16('0x46')](handleError(_0x1564c8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index fb0ad1e..e39c7d6 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 _0x2313=['moment','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x2cf3fc,_0x250143){var _0x17c4d9=function(_0x5da460){while(--_0x5da460){_0x2cf3fc['push'](_0x2cf3fc['shift']());}};_0x17c4d9(++_0x250143);}(_0x2313,0x146));var _0x3231=function(_0x21f5c6,_0x22b397){_0x21f5c6=_0x21f5c6-0x0;var _0x35a4b2=_0x2313[_0x21f5c6];return _0x35a4b2;};'use strict';var _=require(_0x3231('0x0'));var util=require(_0x3231('0x1'));var logger=require(_0x3231('0x2'))(_0x3231('0x3'));var moment=require(_0x3231('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3231('0x5'));var config=require(_0x3231('0x6'));var attributes=require(_0x3231('0x7'));module[_0x3231('0x8')]=function(_0x82891d,_0x44a97e){return _0x82891d[_0x3231('0x9')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5be=['request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','util','../../config/logger','moment','bluebird'];(function(_0x534346,_0x5c791e){var _0x16eb9f=function(_0xf109f){while(--_0xf109f){_0x534346['push'](_0x534346['shift']());}};_0x16eb9f(++_0x5c791e);}(_0xf5be,0x1e7));var _0xef5b=function(_0x858388,_0x269676){_0x858388=_0x858388-0x0;var _0x3acdba=_0xf5be[_0x858388];return _0x3acdba;};'use strict';var _=require(_0xef5b('0x0'));var util=require(_0xef5b('0x1'));var logger=require(_0xef5b('0x2'))('api');var moment=require(_0xef5b('0x3'));var BPromise=require(_0xef5b('0x4'));var rp=require(_0xef5b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef5b('0x6'));var config=require(_0xef5b('0x7'));var attributes=require(_0xef5b('0x8'));module[_0xef5b('0x9')]=function(_0x399aff,_0x591971){return _0x399aff[_0xef5b('0xa')](_0xef5b('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 9f85eb5..5f3ccf8 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 _0x87c9=['http','info','JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3f44b3,_0x6317e6){var _0x3a7ed1=function(_0x32ae91){while(--_0x32ae91){_0x3f44b3['push'](_0x3f44b3['shift']());}};_0x3a7ed1(++_0x6317e6);}(_0x87c9,0x12a));var _0x987c=function(_0x5c0479,_0x5d3a5f){_0x5c0479=_0x5c0479-0x0;var _0x1f5a16=_0x87c9[_0x5c0479];return _0x1f5a16;};'use strict';var _=require(_0x987c('0x0'));var util=require(_0x987c('0x1'));var moment=require('moment');var BPromise=require(_0x987c('0x2'));var rs=require(_0x987c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x987c('0x4'))['db'];var utils=require(_0x987c('0x5'));var logger=require('../../config/logger')(_0x987c('0x6'));var config=require(_0x987c('0x7'));var jayson=require(_0x987c('0x8'));var client=jayson[_0x987c('0x9')][_0x987c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x829e8c,_0x4b99bb,_0x366b28){return new BPromise(function(_0x4af343,_0x58bf90){return client['request'](_0x829e8c,_0x366b28)['then'](function(_0x3cb301){logger[_0x987c('0xb')](_0x987c('0xc'),_0x4b99bb,'request\x20sent');logger[_0x987c('0xd')](_0x987c('0xe'),_0x4b99bb,'request\x20sent',JSON[_0x987c('0xf')](_0x3cb301));if(_0x3cb301[_0x987c('0x10')]){if(_0x3cb301['error'][_0x987c('0x11')]===0x1f4){logger[_0x987c('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4b99bb,_0x3cb301['error']['message']);return _0x58bf90(_0x3cb301[_0x987c('0x10')][_0x987c('0x12')]);}logger[_0x987c('0x10')](_0x987c('0xc'),_0x4b99bb,_0x3cb301[_0x987c('0x10')][_0x987c('0x12')]);return _0x4af343(_0x3cb301[_0x987c('0x10')]['message']);}else{logger[_0x987c('0xb')](_0x987c('0xc'),_0x4b99bb,_0x987c('0x13'));_0x4af343(_0x3cb301[_0x987c('0x14')][_0x987c('0x12')]);}})[_0x987c('0x15')](function(_0x55a6b9){logger['error'](_0x987c('0xc'),_0x4b99bb,_0x55a6b9);_0x58bf90(_0x55a6b9);});});} \ No newline at end of file +var _0x8b3e=['util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x200c7f,_0x1e43de){var _0x5950c1=function(_0x253d8c){while(--_0x253d8c){_0x200c7f['push'](_0x200c7f['shift']());}};_0x5950c1(++_0x1e43de);}(_0x8b3e,0x68));var _0xe8b3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b3e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe8b3('0x0'));var util=require(_0xe8b3('0x1'));var moment=require('moment');var BPromise=require(_0xe8b3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe8b3('0x3'));var db=require(_0xe8b3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe8b3('0x5'))('rpc');var config=require(_0xe8b3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe8b3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21a558,_0x44f807,_0xe72224){return new BPromise(function(_0x260a41,_0x3ec18c){return client[_0xe8b3('0x8')](_0x21a558,_0xe72224)[_0xe8b3('0x9')](function(_0x244390){logger[_0xe8b3('0xa')](_0xe8b3('0xb'),_0x44f807,_0xe8b3('0xc'));logger[_0xe8b3('0xd')](_0xe8b3('0xe'),_0x44f807,_0xe8b3('0xc'),JSON[_0xe8b3('0xf')](_0x244390));if(_0x244390[_0xe8b3('0x10')]){if(_0x244390['error'][_0xe8b3('0x11')]===0x1f4){logger[_0xe8b3('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x44f807,_0x244390[_0xe8b3('0x10')][_0xe8b3('0x12')]);return _0x3ec18c(_0x244390[_0xe8b3('0x10')]['message']);}logger[_0xe8b3('0x10')](_0xe8b3('0xb'),_0x44f807,_0x244390['error']['message']);return _0x260a41(_0x244390[_0xe8b3('0x10')][_0xe8b3('0x12')]);}else{logger[_0xe8b3('0xa')]('JscriptyProject,\x20%s,\x20%s',_0x44f807,'request\x20sent');_0x260a41(_0x244390[_0xe8b3('0x13')][_0xe8b3('0x12')]);}})[_0xe8b3('0x14')](function(_0x21a53e){logger[_0xe8b3('0x10')](_0xe8b3('0xb'),_0x44f807,_0x21a53e);_0x3ec18c(_0x21a53e);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index d0d86fd..8c4e940 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 _0x970e=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x41ef64,_0x579e6f){var _0x561e16=function(_0x366a33){while(--_0x366a33){_0x41ef64['push'](_0x41ef64['shift']());}};_0x561e16(++_0x579e6f);}(_0x970e,0x1d0));var _0xe970=function(_0xf5b290,_0x15902a){_0xf5b290=_0xf5b290-0x0;var _0xbd7686=_0x970e[_0xf5b290];return _0xbd7686;};'use strict';var multer=require(_0xe970('0x0'));var util=require(_0xe970('0x1'));var path=require(_0xe970('0x2'));var timeout=require(_0xe970('0x3'));var express=require(_0xe970('0x4'));var router=express[_0xe970('0x5')]();var auth=require(_0xe970('0x6'));var interaction=require(_0xe970('0x7'));var config=require(_0xe970('0x8'));var controller=require(_0xe970('0x9'));router[_0xe970('0xa')]('/',auth[_0xe970('0xb')](),controller[_0xe970('0xc')]);router[_0xe970('0xa')]('/describe',auth[_0xe970('0xb')](),controller[_0xe970('0xd')]);router['get'](_0xe970('0xe'),auth[_0xe970('0xb')](),controller[_0xe970('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe970('0x10')]('/:id',auth[_0xe970('0xb')](),controller[_0xe970('0x11')]);router[_0xe970('0x12')](_0xe970('0xe'),auth[_0xe970('0xb')](),controller['destroy']);module[_0xe970('0x13')]=router; \ No newline at end of file +var _0x781e=['/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index'];(function(_0x9f7af3,_0x4f4872){var _0x2a1d6d=function(_0x3d9484){while(--_0x3d9484){_0x9f7af3['push'](_0x9f7af3['shift']());}};_0x2a1d6d(++_0x4f4872);}(_0x781e,0x15e));var _0xe781=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x781e[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xe781('0x0'));var util=require(_0xe781('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe781('0x2'));var router=express[_0xe781('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe781('0x4'));var config=require(_0xe781('0x5'));var controller=require(_0xe781('0x6'));router[_0xe781('0x7')]('/',auth[_0xe781('0x8')](),controller[_0xe781('0x9')]);router[_0xe781('0x7')](_0xe781('0xa'),auth[_0xe781('0x8')](),controller[_0xe781('0xb')]);router[_0xe781('0x7')](_0xe781('0xc'),auth[_0xe781('0x8')](),controller[_0xe781('0xd')]);router[_0xe781('0xe')]('/',auth[_0xe781('0x8')](),controller[_0xe781('0xf')]);router[_0xe781('0x10')](_0xe781('0xc'),auth[_0xe781('0x8')](),controller[_0xe781('0x11')]);router['delete'](_0xe781('0xc'),auth['isAuthenticated'](),controller[_0xe781('0x12')]);module[_0xe781('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 47c0d3b..53a197b 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 _0xf8b5=['long','STRING'];(function(_0x521378,_0x2f8004){var _0x4b2fc4=function(_0x25511e){while(--_0x25511e){_0x521378['push'](_0x521378['shift']());}};_0x4b2fc4(++_0x2f8004);}(_0xf8b5,0x85));var _0x5f8b=function(_0x1242f2,_0x2b9a43){_0x1242f2=_0x1242f2-0x0;var _0x3e1e84=_0xf8b5[_0x1242f2];return _0x3e1e84;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0x5f8b('0x0')]},'answer':{'type':Sequelize['TEXT'](_0x5f8b('0x1'))},'membername':{'type':Sequelize[_0x5f8b('0x0')]},'projectname':{'type':Sequelize[_0x5f8b('0x0')]},'queue':{'type':Sequelize[_0x5f8b('0x0')]},'uniqueid':{'type':Sequelize[_0x5f8b('0x0')]},'calleridname':{'type':Sequelize[_0x5f8b('0x0')]},'calleridnum':{'type':Sequelize[_0x5f8b('0x0')]},'questionId':{'type':Sequelize[_0x5f8b('0x0')]}}; \ No newline at end of file +var _0x456c=['STRING','TEXT','long'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x456c,0x190));var _0xc456=function(_0x3ebbcd,_0x1afc61){_0x3ebbcd=_0x3ebbcd-0x0;var _0x210c43=_0x456c[_0x3ebbcd];return _0x210c43;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0xc456('0x0')](_0xc456('0x1'))},'membername':{'type':Sequelize[_0xc456('0x2')]},'projectname':{'type':Sequelize[_0xc456('0x2')]},'queue':{'type':Sequelize[_0xc456('0x2')]},'uniqueid':{'type':Sequelize[_0xc456('0x2')]},'calleridname':{'type':Sequelize[_0xc456('0x2')]},'calleridnum':{'type':Sequelize[_0xc456('0x2')]},'questionId':{'type':Sequelize[_0xc456('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 291f80f..e32e935 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 _0xb805=['bluebird','mustache','util','path','to-csv','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','destroy','then','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','update','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment'];(function(_0x4eb7aa,_0x1e8a69){var _0x1924f1=function(_0xefec2e){while(--_0xefec2e){_0x4eb7aa['push'](_0x4eb7aa['shift']());}};_0x1924f1(++_0x1e8a69);}(_0xb805,0x8f));var _0x5b80=function(_0x346f4b,_0x2cb020){_0x346f4b=_0x346f4b-0x0;var _0x2d1231=_0xb805[_0x346f4b];return _0x2d1231;};'use strict';var pdf=require(_0x5b80('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5b80('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b80('0x2'));var rp=require(_0x5b80('0x3'));var moment=require(_0x5b80('0x4'));var BPromise=require(_0x5b80('0x5'));var Mustache=require(_0x5b80('0x6'));var util=require(_0x5b80('0x7'));var path=require(_0x5b80('0x8'));var sox=require('sox');var csv=require(_0x5b80('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5b80('0xa'));var crypto=require('crypto');var jsforce=require(_0x5b80('0xb'));var deskjs=require(_0x5b80('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5b80('0xd'));var Redis=require('ioredis');var authService=require(_0x5b80('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5b80('0xf'));var hardwareService=require(_0x5b80('0x10'));var logger=require(_0x5b80('0x11'))(_0x5b80('0x12'));var utils=require(_0x5b80('0x13'));var config=require(_0x5b80('0x14'));var db=require(_0x5b80('0x15'))['db'];function respondWithStatusCode(_0x3ffdf8,_0x4ce8b2){_0x4ce8b2=_0x4ce8b2||0xcc;return function(_0x36d09d){if(_0x36d09d){return _0x3ffdf8[_0x5b80('0x16')](_0x4ce8b2);}return _0x3ffdf8[_0x5b80('0x17')](_0x4ce8b2)[_0x5b80('0x18')]();};}function respondWithResult(_0x4a50d6,_0x4401f7){_0x4401f7=_0x4401f7||0xc8;return function(_0x20428f){if(_0x20428f){return _0x4a50d6[_0x5b80('0x17')](_0x4401f7)[_0x5b80('0x19')](_0x20428f);}};}function respondWithFilteredResult(_0x5d1cba,_0x37199b){return function(_0x42f4d2){if(_0x42f4d2){var _0xa6835e=_0x42f4d2[_0x5b80('0x1a')],_0x59fe8e=_0x37199b[_0x5b80('0x1b')],_0x370c8d=_0x37199b['offset']+_0x37199b['limit'],_0x510a7e;if(_0x370c8d>=_0xa6835e){_0x370c8d=_0xa6835e;_0x510a7e=0xc8;}else{_0x510a7e=0xce;}_0x5d1cba[_0x5b80('0x17')](_0x510a7e);return _0x5d1cba[_0x5b80('0x1c')](_0x5b80('0x1d'),_0x59fe8e+'-'+_0x370c8d+'/'+_0xa6835e)[_0x5b80('0x19')](_0x42f4d2);}return null;};}function patchUpdates(_0x1fe8da){return function(_0x23d3b9){try{jsonpatch['apply'](_0x23d3b9,_0x1fe8da,!![]);}catch(_0xfb63e0){return BPromise[_0x5b80('0x1e')](_0xfb63e0);}return _0x23d3b9[_0x5b80('0x1f')]();};}function saveUpdates(_0x313cd3,_0x511427){return function(_0x4d7d3e){if(_0x4d7d3e){return _0x4d7d3e['update'](_0x313cd3)['then'](function(_0x3ed22a){return _0x3ed22a;});}return null;};}function removeEntity(_0x2037be,_0x48ab73){return function(_0x267846){if(_0x267846){return _0x267846[_0x5b80('0x20')]()[_0x5b80('0x21')](function(){_0x2037be[_0x5b80('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf806d0,_0x4be51b){return function(_0x14e577){if(!_0x14e577){_0xf806d0[_0x5b80('0x16')](0x194);}return _0x14e577;};}function handleError(_0x30bb9f,_0xb6fa89){_0xb6fa89=_0xb6fa89||0x1f4;return function(_0x4f1463){logger[_0x5b80('0x22')](_0x4f1463[_0x5b80('0x23')]);if(_0x4f1463[_0x5b80('0x24')]){delete _0x4f1463[_0x5b80('0x24')];}_0x30bb9f['status'](_0xb6fa89)[_0x5b80('0x25')](_0x4f1463);};}exports[_0x5b80('0x26')]=function(_0x1fd430,_0x396a17){var _0x4d3214={},_0x17cf0d={},_0x57a0bd={'count':0x0,'rows':[]};var _0x2c279d=_['map'](db[_0x5b80('0x27')][_0x5b80('0x28')],function(_0x1f6753){return{'name':_0x1f6753[_0x5b80('0x29')],'type':_0x1f6753['type']['key']};});_0x17cf0d[_0x5b80('0x2a')]=_['map'](_0x2c279d,'name');_0x17cf0d[_0x5b80('0x2b')]=_[_0x5b80('0x2c')](_0x1fd430[_0x5b80('0x2b')]);_0x17cf0d['filters']=_[_0x5b80('0x2d')](_0x17cf0d[_0x5b80('0x2a')],_0x17cf0d[_0x5b80('0x2b')]);_0x4d3214['attributes']=_[_0x5b80('0x2d')](_0x17cf0d['model'],qs['fields'](_0x1fd430[_0x5b80('0x2b')][_0x5b80('0x2e')]));_0x4d3214[_0x5b80('0x2f')]=_0x4d3214[_0x5b80('0x2f')][_0x5b80('0x30')]?_0x4d3214[_0x5b80('0x2f')]:_0x17cf0d[_0x5b80('0x2a')];if(!_0x1fd430[_0x5b80('0x2b')][_0x5b80('0x31')]('nolimit')){_0x4d3214[_0x5b80('0x32')]=qs[_0x5b80('0x32')](_0x1fd430[_0x5b80('0x2b')][_0x5b80('0x32')]);_0x4d3214[_0x5b80('0x1b')]=qs['offset'](_0x1fd430['query']['offset']);}_0x4d3214[_0x5b80('0x33')]=qs['sort'](_0x1fd430['query'][_0x5b80('0x34')]);_0x4d3214[_0x5b80('0x35')]=qs[_0x5b80('0x36')](_[_0x5b80('0x37')](_0x1fd430[_0x5b80('0x2b')],_0x17cf0d[_0x5b80('0x36')]),_0x2c279d);if(_0x1fd430[_0x5b80('0x2b')][_0x5b80('0x38')]){_0x4d3214['where']=_[_0x5b80('0x39')](_0x4d3214[_0x5b80('0x35')],{'$or':_[_0x5b80('0x3a')](_0x2c279d,function(_0x3b44ab){if(_0x3b44ab[_0x5b80('0x3b')]!==_0x5b80('0x3c')){var _0x70fea={};_0x70fea[_0x3b44ab['name']]={'$like':'%'+_0x1fd430['query'][_0x5b80('0x38')]+'%'};return _0x70fea;}})});}_0x4d3214=_['merge']({},_0x4d3214,_0x1fd430[_0x5b80('0x3d')]);var _0x42a8ea={'where':_0x4d3214['where']};return db['JscriptyQuestionReport'][_0x5b80('0x1a')](_0x42a8ea)[_0x5b80('0x21')](function(_0x112239){_0x57a0bd[_0x5b80('0x1a')]=_0x112239;if(_0x1fd430[_0x5b80('0x2b')]['includeAll']){_0x4d3214[_0x5b80('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x5b80('0x3f')](_0x4d3214);})['then'](function(_0x4743d6){_0x57a0bd[_0x5b80('0x40')]=_0x4743d6;return _0x57a0bd;})[_0x5b80('0x21')](respondWithFilteredResult(_0x396a17,_0x4d3214))['catch'](handleError(_0x396a17,null));};exports[_0x5b80('0x41')]=function(_0x82140d,_0x2abadf){var _0x1800ca={'raw':!![],'where':{'id':_0x82140d[_0x5b80('0x42')]['id']}},_0x1cc229={};_0x1cc229[_0x5b80('0x2a')]=_[_0x5b80('0x2c')](db[_0x5b80('0x27')][_0x5b80('0x28')]);_0x1cc229[_0x5b80('0x2b')]=_['keys'](_0x82140d['query']);_0x1cc229['filters']=_['intersection'](_0x1cc229[_0x5b80('0x2a')],_0x1cc229[_0x5b80('0x2b')]);_0x1800ca[_0x5b80('0x2f')]=_[_0x5b80('0x2d')](_0x1cc229['model'],qs['fields'](_0x82140d['query']['fields']));_0x1800ca[_0x5b80('0x2f')]=_0x1800ca[_0x5b80('0x2f')]['length']?_0x1800ca['attributes']:_0x1cc229['model'];if(_0x82140d[_0x5b80('0x2b')][_0x5b80('0x43')]){_0x1800ca['include']=[{'all':!![]}];}_0x1800ca=_['merge']({},_0x1800ca,_0x82140d[_0x5b80('0x3d')]);return db[_0x5b80('0x27')][_0x5b80('0x44')](_0x1800ca)[_0x5b80('0x21')](handleEntityNotFound(_0x2abadf,null))[_0x5b80('0x21')](respondWithResult(_0x2abadf,null))[_0x5b80('0x45')](handleError(_0x2abadf,null));};exports['create']=function(_0x17eb20,_0xe406b8){return db[_0x5b80('0x27')][_0x5b80('0x46')](_0x17eb20[_0x5b80('0x47')],{})[_0x5b80('0x21')](respondWithResult(_0xe406b8,0xc9))[_0x5b80('0x45')](handleError(_0xe406b8,null));};exports[_0x5b80('0x48')]=function(_0x419394,_0x43e410){if(_0x419394[_0x5b80('0x47')]['id']){delete _0x419394[_0x5b80('0x47')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x419394[_0x5b80('0x42')]['id']}})[_0x5b80('0x21')](handleEntityNotFound(_0x43e410,null))[_0x5b80('0x21')](saveUpdates(_0x419394['body'],null))[_0x5b80('0x21')](respondWithResult(_0x43e410,null))['catch'](handleError(_0x43e410,null));};exports[_0x5b80('0x20')]=function(_0x49402f,_0x2a7008){return db[_0x5b80('0x27')][_0x5b80('0x44')]({'where':{'id':_0x49402f['params']['id']}})[_0x5b80('0x21')](handleEntityNotFound(_0x2a7008,null))[_0x5b80('0x21')](removeEntity(_0x2a7008,null))['catch'](handleError(_0x2a7008,null));};exports[_0x5b80('0x49')]=function(_0x5e8ec3,_0x1317a0){return db[_0x5b80('0x27')]['describe']()[_0x5b80('0x21')](respondWithResult(_0x1317a0,null))['catch'](handleError(_0x1317a0,null));}; \ No newline at end of file +var _0xd33d=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','Content-Range','apply','reject','save','then','sendStatus','error','name','map','JscriptyQuestionReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xc21ae,_0x173f65){var _0x358c22=function(_0x2445d3){while(--_0x2445d3){_0xc21ae['push'](_0xc21ae['shift']());}};_0x358c22(++_0x173f65);}(_0xd33d,0x7a));var _0xdd33=function(_0x95fc3d,_0x10dc31){_0x95fc3d=_0x95fc3d-0x0;var _0x159c86=_0xd33d[_0x95fc3d];return _0x159c86;};'use strict';var pdf=require(_0xdd33('0x0'));var emlformat=require(_0xdd33('0x1'));var rimraf=require(_0xdd33('0x2'));var zipdir=require(_0xdd33('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd33('0x4'));var moment=require(_0xdd33('0x5'));var BPromise=require(_0xdd33('0x6'));var Mustache=require('mustache');var util=require(_0xdd33('0x7'));var path=require(_0xdd33('0x8'));var sox=require(_0xdd33('0x9'));var csv=require(_0xdd33('0xa'));var ejs=require(_0xdd33('0xb'));var fs=require('fs');var _=require(_0xdd33('0xc'));var squel=require(_0xdd33('0xd'));var crypto=require('crypto');var jsforce=require(_0xdd33('0xe'));var deskjs=require(_0xdd33('0xf'));var toCsv=require(_0xdd33('0xa'));var querystring=require(_0xdd33('0x10'));var Papa=require(_0xdd33('0x11'));var Redis=require(_0xdd33('0x12'));var authService=require(_0xdd33('0x13'));var qs=require(_0xdd33('0x14'));var as=require(_0xdd33('0x15'));var hardwareService=require(_0xdd33('0x16'));var logger=require(_0xdd33('0x17'))('api');var utils=require(_0xdd33('0x18'));var config=require(_0xdd33('0x19'));var db=require(_0xdd33('0x1a'))['db'];function respondWithStatusCode(_0x58db09,_0x216376){_0x216376=_0x216376||0xcc;return function(_0x534413){if(_0x534413){return _0x58db09['sendStatus'](_0x216376);}return _0x58db09[_0xdd33('0x1b')](_0x216376)[_0xdd33('0x1c')]();};}function respondWithResult(_0x1af194,_0x4be3fc){_0x4be3fc=_0x4be3fc||0xc8;return function(_0x1911ce){if(_0x1911ce){return _0x1af194[_0xdd33('0x1b')](_0x4be3fc)['json'](_0x1911ce);}};}function respondWithFilteredResult(_0x47ec89,_0x27a637){return function(_0x1c3b57){if(_0x1c3b57){var _0x24a96d=_0x1c3b57[_0xdd33('0x1d')],_0x2507f9=_0x27a637[_0xdd33('0x1e')],_0x178699=_0x27a637[_0xdd33('0x1e')]+_0x27a637['limit'],_0x2721bd;if(_0x178699>=_0x24a96d){_0x178699=_0x24a96d;_0x2721bd=0xc8;}else{_0x2721bd=0xce;}_0x47ec89[_0xdd33('0x1b')](_0x2721bd);return _0x47ec89['set'](_0xdd33('0x1f'),_0x2507f9+'-'+_0x178699+'/'+_0x24a96d)['json'](_0x1c3b57);}return null;};}function patchUpdates(_0x1ac4ab){return function(_0x225d3f){try{jsonpatch[_0xdd33('0x20')](_0x225d3f,_0x1ac4ab,!![]);}catch(_0x12db2a){return BPromise[_0xdd33('0x21')](_0x12db2a);}return _0x225d3f[_0xdd33('0x22')]();};}function saveUpdates(_0x4a5066,_0xcf63b3){return function(_0x196625){if(_0x196625){return _0x196625['update'](_0x4a5066)[_0xdd33('0x23')](function(_0x467113){return _0x467113;});}return null;};}function removeEntity(_0x35bc39,_0x27ca72){return function(_0x1aa268){if(_0x1aa268){return _0x1aa268['destroy']()[_0xdd33('0x23')](function(){_0x35bc39[_0xdd33('0x1b')](0xcc)[_0xdd33('0x1c')]();});}};}function handleEntityNotFound(_0x164212,_0xa56fac){return function(_0x72b0a3){if(!_0x72b0a3){_0x164212[_0xdd33('0x24')](0x194);}return _0x72b0a3;};}function handleError(_0x49507d,_0x785a0a){_0x785a0a=_0x785a0a||0x1f4;return function(_0x1bf8b4){logger[_0xdd33('0x25')](_0x1bf8b4['stack']);if(_0x1bf8b4[_0xdd33('0x26')]){delete _0x1bf8b4[_0xdd33('0x26')];}_0x49507d[_0xdd33('0x1b')](_0x785a0a)['send'](_0x1bf8b4);};}exports['index']=function(_0x1b41a0,_0x33ec25){var _0x5ab037={},_0x3cd3e9={},_0x30e010={'count':0x0,'rows':[]};var _0xb2b083=_[_0xdd33('0x27')](db[_0xdd33('0x28')]['rawAttributes'],function(_0x557f72){return{'name':_0x557f72[_0xdd33('0x29')],'type':_0x557f72[_0xdd33('0x2a')][_0xdd33('0x2b')]};});_0x3cd3e9[_0xdd33('0x2c')]=_[_0xdd33('0x27')](_0xb2b083,_0xdd33('0x26'));_0x3cd3e9[_0xdd33('0x2d')]=_[_0xdd33('0x2e')](_0x1b41a0[_0xdd33('0x2d')]);_0x3cd3e9['filters']=_[_0xdd33('0x2f')](_0x3cd3e9['model'],_0x3cd3e9[_0xdd33('0x2d')]);_0x5ab037['attributes']=_[_0xdd33('0x2f')](_0x3cd3e9[_0xdd33('0x2c')],qs[_0xdd33('0x30')](_0x1b41a0['query'][_0xdd33('0x30')]));_0x5ab037['attributes']=_0x5ab037[_0xdd33('0x31')][_0xdd33('0x32')]?_0x5ab037[_0xdd33('0x31')]:_0x3cd3e9['model'];if(!_0x1b41a0[_0xdd33('0x2d')][_0xdd33('0x33')]('nolimit')){_0x5ab037[_0xdd33('0x34')]=qs[_0xdd33('0x34')](_0x1b41a0[_0xdd33('0x2d')][_0xdd33('0x34')]);_0x5ab037['offset']=qs[_0xdd33('0x1e')](_0x1b41a0[_0xdd33('0x2d')][_0xdd33('0x1e')]);}_0x5ab037[_0xdd33('0x35')]=qs['sort'](_0x1b41a0['query']['sort']);_0x5ab037[_0xdd33('0x36')]=qs[_0xdd33('0x37')](_['pick'](_0x1b41a0[_0xdd33('0x2d')],_0x3cd3e9['filters']),_0xb2b083);if(_0x1b41a0[_0xdd33('0x2d')][_0xdd33('0x38')]){_0x5ab037['where']=_[_0xdd33('0x39')](_0x5ab037[_0xdd33('0x36')],{'$or':_['map'](_0xb2b083,function(_0x530208){if(_0x530208[_0xdd33('0x2a')]!==_0xdd33('0x3a')){var _0x46f598={};_0x46f598[_0x530208[_0xdd33('0x26')]]={'$like':'%'+_0x1b41a0[_0xdd33('0x2d')][_0xdd33('0x38')]+'%'};return _0x46f598;}})});}_0x5ab037=_['merge']({},_0x5ab037,_0x1b41a0['options']);var _0x458e72={'where':_0x5ab037['where']};return db[_0xdd33('0x28')][_0xdd33('0x1d')](_0x458e72)[_0xdd33('0x23')](function(_0x333c04){_0x30e010[_0xdd33('0x1d')]=_0x333c04;if(_0x1b41a0[_0xdd33('0x2d')][_0xdd33('0x3b')]){_0x5ab037['include']=[{'all':!![]}];}return db[_0xdd33('0x28')][_0xdd33('0x3c')](_0x5ab037);})[_0xdd33('0x23')](function(_0x4b746b){_0x30e010[_0xdd33('0x3d')]=_0x4b746b;return _0x30e010;})['then'](respondWithFilteredResult(_0x33ec25,_0x5ab037))[_0xdd33('0x3e')](handleError(_0x33ec25,null));};exports[_0xdd33('0x3f')]=function(_0x36e479,_0x1c42c0){var _0xe32045={'raw':!![],'where':{'id':_0x36e479[_0xdd33('0x40')]['id']}},_0x1a9749={};_0x1a9749[_0xdd33('0x2c')]=_[_0xdd33('0x2e')](db[_0xdd33('0x28')][_0xdd33('0x41')]);_0x1a9749[_0xdd33('0x2d')]=_[_0xdd33('0x2e')](_0x36e479[_0xdd33('0x2d')]);_0x1a9749[_0xdd33('0x37')]=_[_0xdd33('0x2f')](_0x1a9749['model'],_0x1a9749[_0xdd33('0x2d')]);_0xe32045[_0xdd33('0x31')]=_[_0xdd33('0x2f')](_0x1a9749[_0xdd33('0x2c')],qs[_0xdd33('0x30')](_0x36e479[_0xdd33('0x2d')][_0xdd33('0x30')]));_0xe32045[_0xdd33('0x31')]=_0xe32045[_0xdd33('0x31')]['length']?_0xe32045[_0xdd33('0x31')]:_0x1a9749['model'];if(_0x36e479[_0xdd33('0x2d')]['includeAll']){_0xe32045['include']=[{'all':!![]}];}_0xe32045=_['merge']({},_0xe32045,_0x36e479[_0xdd33('0x42')]);return db['JscriptyQuestionReport'][_0xdd33('0x43')](_0xe32045)[_0xdd33('0x23')](handleEntityNotFound(_0x1c42c0,null))[_0xdd33('0x23')](respondWithResult(_0x1c42c0,null))['catch'](handleError(_0x1c42c0,null));};exports[_0xdd33('0x44')]=function(_0x35e4c2,_0x65abed){return db['JscriptyQuestionReport'][_0xdd33('0x44')](_0x35e4c2[_0xdd33('0x45')],{})[_0xdd33('0x23')](respondWithResult(_0x65abed,0xc9))[_0xdd33('0x3e')](handleError(_0x65abed,null));};exports[_0xdd33('0x46')]=function(_0x24a84b,_0x31b815){if(_0x24a84b[_0xdd33('0x45')]['id']){delete _0x24a84b[_0xdd33('0x45')]['id'];}return db['JscriptyQuestionReport'][_0xdd33('0x43')]({'where':{'id':_0x24a84b['params']['id']}})[_0xdd33('0x23')](handleEntityNotFound(_0x31b815,null))['then'](saveUpdates(_0x24a84b[_0xdd33('0x45')],null))['then'](respondWithResult(_0x31b815,null))[_0xdd33('0x3e')](handleError(_0x31b815,null));};exports['destroy']=function(_0x475754,_0x16cc8b){return db[_0xdd33('0x28')][_0xdd33('0x43')]({'where':{'id':_0x475754[_0xdd33('0x40')]['id']}})['then'](handleEntityNotFound(_0x16cc8b,null))[_0xdd33('0x23')](removeEntity(_0x16cc8b,null))['catch'](handleError(_0x16cc8b,null));};exports[_0xdd33('0x47')]=function(_0x34c7fa,_0x2bbd82){return db['JscriptyQuestionReport'][_0xdd33('0x47')]()[_0xdd33('0x23')](respondWithResult(_0x2bbd82,null))[_0xdd33('0x3e')](handleError(_0x2bbd82,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 0e99923..25afc5a 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 _0xc550=['util','api','bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash'];(function(_0x858c6d,_0x355ff9){var _0x5bf3b0=function(_0x2e3e4b){while(--_0x2e3e4b){_0x858c6d['push'](_0x858c6d['shift']());}};_0x5bf3b0(++_0x355ff9);}(_0xc550,0x78));var _0x0c55=function(_0x22bae4,_0x22474b){_0x22bae4=_0x22bae4-0x0;var _0x2047b6=_0xc550[_0x22bae4];return _0x2047b6;};'use strict';var _=require(_0x0c55('0x0'));var util=require(_0x0c55('0x1'));var logger=require('../../config/logger')(_0x0c55('0x2'));var moment=require('moment');var BPromise=require(_0x0c55('0x3'));var rp=require(_0x0c55('0x4'));var fs=require('fs');var path=require(_0x0c55('0x5'));var rimraf=require(_0x0c55('0x6'));var config=require('../../config/environment');var attributes=require(_0x0c55('0x7'));module[_0x0c55('0x8')]=function(_0x54d286,_0x2e8f61){return _0x54d286[_0x0c55('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x0c55('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06fe=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyQuestionReport','lodash','util','../../config/logger'];(function(_0x1bc4d1,_0x1530d0){var _0x34abaf=function(_0x2508b9){while(--_0x2508b9){_0x1bc4d1['push'](_0x1bc4d1['shift']());}};_0x34abaf(++_0x1530d0);}(_0x06fe,0x1e1));var _0xe06f=function(_0x52c538,_0x48f45a){_0x52c538=_0x52c538-0x0;var _0x33cb72=_0x06fe[_0x52c538];return _0x33cb72;};'use strict';var _=require(_0xe06f('0x0'));var util=require(_0xe06f('0x1'));var logger=require(_0xe06f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe06f('0x3'));var rp=require(_0xe06f('0x4'));var fs=require('fs');var path=require(_0xe06f('0x5'));var rimraf=require(_0xe06f('0x6'));var config=require(_0xe06f('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xe06f('0x8')]=function(_0x2474d3,_0x22a778){return _0x2474d3[_0xe06f('0x9')](_0xe06f('0xa'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 3f264a5..d38da57 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 _0x0628=['rpc','../../config/environment','client','http','request','info','request\x20sent','debug','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4d4017,_0x51ad84){var _0x14ecb2=function(_0xdfce47){while(--_0xdfce47){_0x4d4017['push'](_0x4d4017['shift']());}};_0x14ecb2(++_0x51ad84);}(_0x0628,0x11f));var _0x8062=function(_0x3e830c,_0x4cd9b0){_0x3e830c=_0x3e830c-0x0;var _0x448c62=_0x0628[_0x3e830c];return _0x448c62;};'use strict';var _=require(_0x8062('0x0'));var util=require(_0x8062('0x1'));var moment=require(_0x8062('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8062('0x3'));var db=require(_0x8062('0x4'))['db'];var utils=require(_0x8062('0x5'));var logger=require(_0x8062('0x6'))(_0x8062('0x7'));var config=require(_0x8062('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8062('0x9')][_0x8062('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45861b,_0x16bc6c,_0x1e90c3){return new BPromise(function(_0x581f19,_0xff6907){return client[_0x8062('0xb')](_0x45861b,_0x1e90c3)['then'](function(_0x303c8b){logger[_0x8062('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x16bc6c,_0x8062('0xd'));logger[_0x8062('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x16bc6c,_0x8062('0xd'),JSON['stringify'](_0x303c8b));if(_0x303c8b[_0x8062('0xf')]){if(_0x303c8b[_0x8062('0xf')][_0x8062('0x10')]===0x1f4){logger[_0x8062('0xf')](_0x8062('0x11'),_0x16bc6c,_0x303c8b['error']['message']);return _0xff6907(_0x303c8b[_0x8062('0xf')][_0x8062('0x12')]);}logger[_0x8062('0xf')](_0x8062('0x11'),_0x16bc6c,_0x303c8b[_0x8062('0xf')]['message']);return _0x581f19(_0x303c8b[_0x8062('0xf')][_0x8062('0x12')]);}else{logger[_0x8062('0xc')](_0x8062('0x11'),_0x16bc6c,_0x8062('0xd'));_0x581f19(_0x303c8b[_0x8062('0x13')][_0x8062('0x12')]);}})[_0x8062('0x14')](function(_0x20bbbd){logger[_0x8062('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x16bc6c,_0x20bbbd);_0xff6907(_0x20bbbd);});});} \ No newline at end of file +var _0x6443=['info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message'];(function(_0x55f10e,_0x3e3923){var _0x367a61=function(_0x4ce63f){while(--_0x4ce63f){_0x55f10e['push'](_0x55f10e['shift']());}};_0x367a61(++_0x3e3923);}(_0x6443,0x17d));var _0x3644=function(_0x4e4519,_0x392ae){_0x4e4519=_0x4e4519-0x0;var _0x340044=_0x6443[_0x4e4519];return _0x340044;};'use strict';var _=require('lodash');var util=require(_0x3644('0x0'));var moment=require(_0x3644('0x1'));var BPromise=require(_0x3644('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3644('0x3'));var db=require(_0x3644('0x4'))['db'];var utils=require(_0x3644('0x5'));var logger=require('../../config/logger')(_0x3644('0x6'));var config=require(_0x3644('0x7'));var jayson=require(_0x3644('0x8'));var client=jayson[_0x3644('0x9')][_0x3644('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c39ec,_0xccae8d,_0x451e7c){return new BPromise(function(_0xffcd36,_0x6b9969){return client[_0x3644('0xb')](_0x4c39ec,_0x451e7c)['then'](function(_0x372ac6){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0xccae8d,_0x3644('0xc'));logger[_0x3644('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0xccae8d,'request\x20sent',JSON[_0x3644('0xe')](_0x372ac6));if(_0x372ac6[_0x3644('0xf')]){if(_0x372ac6[_0x3644('0xf')]['code']===0x1f4){logger['error'](_0x3644('0x10'),_0xccae8d,_0x372ac6[_0x3644('0xf')]['message']);return _0x6b9969(_0x372ac6[_0x3644('0xf')][_0x3644('0x11')]);}logger[_0x3644('0xf')](_0x3644('0x10'),_0xccae8d,_0x372ac6['error'][_0x3644('0x11')]);return _0xffcd36(_0x372ac6['error'][_0x3644('0x11')]);}else{logger[_0x3644('0x12')](_0x3644('0x10'),_0xccae8d,_0x3644('0xc'));_0xffcd36(_0x372ac6[_0x3644('0x13')]['message']);}})[_0x3644('0x14')](function(_0x2324e9){logger[_0x3644('0xf')](_0x3644('0x10'),_0xccae8d,_0x2324e9);_0x6b9969(_0x2324e9);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 7382754..1b76e42 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 _0xe0c3=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/questions','create','put'];(function(_0x44c80c,_0x309b9d){var _0x175689=function(_0x2e0755){while(--_0x2e0755){_0x44c80c['push'](_0x44c80c['shift']());}};_0x175689(++_0x309b9d);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x3e0c('0x0'));var util=require('util');var path=require(_0x3e0c('0x1'));var timeout=require(_0x3e0c('0x2'));var express=require(_0x3e0c('0x3'));var router=express[_0x3e0c('0x4')]();var auth=require(_0x3e0c('0x5'));var interaction=require(_0x3e0c('0x6'));var config=require(_0x3e0c('0x7'));var controller=require(_0x3e0c('0x8'));router[_0x3e0c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3e0c('0x9')](_0x3e0c('0xa'),auth[_0x3e0c('0xb')](),controller[_0x3e0c('0xc')]);router[_0x3e0c('0x9')](_0x3e0c('0xd'),auth[_0x3e0c('0xb')](),controller[_0x3e0c('0xe')]);router[_0x3e0c('0x9')](_0x3e0c('0xf'),auth[_0x3e0c('0xb')](),controller['getQuestions']);router['post']('/',auth[_0x3e0c('0xb')](),controller[_0x3e0c('0x10')]);router[_0x3e0c('0x11')](_0x3e0c('0xd'),auth[_0x3e0c('0xb')](),controller[_0x3e0c('0x12')]);router[_0x3e0c('0x13')]('/:id',auth[_0x3e0c('0xb')](),controller['destroy']);module[_0x3e0c('0x14')]=router; \ No newline at end of file +var _0xb18e=['create','put','update','/:id','exports','path','express','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','show','/:id/questions','getQuestions','post'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0xb18e,0x181));var _0xeb18=function(_0x3c6b7d,_0x5f0d90){_0x3c6b7d=_0x3c6b7d-0x0;var _0x1d3ed2=_0xb18e[_0x3c6b7d];return _0x1d3ed2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeb18('0x0'));var timeout=require('connect-timeout');var express=require(_0xeb18('0x1'));var router=express['Router']();var auth=require(_0xeb18('0x2'));var interaction=require(_0xeb18('0x3'));var config=require('../../config/environment');var controller=require(_0xeb18('0x4'));router[_0xeb18('0x5')]('/',auth[_0xeb18('0x6')](),controller[_0xeb18('0x7')]);router[_0xeb18('0x5')](_0xeb18('0x8'),auth['isAuthenticated'](),controller[_0xeb18('0x9')]);router[_0xeb18('0x5')]('/:id',auth[_0xeb18('0x6')](),controller[_0xeb18('0xa')]);router[_0xeb18('0x5')](_0xeb18('0xb'),auth[_0xeb18('0x6')](),controller[_0xeb18('0xc')]);router[_0xeb18('0xd')]('/',auth[_0xeb18('0x6')](),controller[_0xeb18('0xe')]);router[_0xeb18('0xf')]('/:id',auth[_0xeb18('0x6')](),controller[_0xeb18('0x10')]);router['delete'](_0xeb18('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xeb18('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 719b6ff..250a7cc 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 _0x963b=['endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime'];(function(_0x503343,_0x38d48e){var _0x3a4a78=function(_0x50e4e9){while(--_0x50e4e9){_0x503343['push'](_0x503343['shift']());}};_0x3a4a78(++_0x38d48e);}(_0x963b,0x187));var _0xb963=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0x963b[_0xfedc72];return _0x2c7c78;};'use strict';var moment=require(_0xb963('0x0'));var Sequelize=require(_0xb963('0x1'));module[_0xb963('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x39d434){this[_0xb963('0x3')](_0xb963('0x4'),_0x39d434);this[_0xb963('0x3')](_0xb963('0x5'),moment()['format'](_0xb963('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xb963('0x7')]},'projectname':{'type':Sequelize[_0xb963('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb963('0x7')]},'calleridname':{'type':Sequelize[_0xb963('0x7')]},'calleridnum':{'type':Sequelize[_0xb963('0x7')]},'completed':{'type':Sequelize[_0xb963('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xcf71=['STRING','moment','sequelize','exports','starttime','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x494fc8,_0x20acdd){var _0x1c4333=function(_0x98728c){while(--_0x98728c){_0x494fc8['push'](_0x494fc8['shift']());}};_0x1c4333(++_0x20acdd);}(_0xcf71,0xbf));var _0x1cf7=function(_0x21f588,_0x3f63ae){_0x21f588=_0x21f588-0x0;var _0x3b28cb=_0xcf71[_0x21f588];return _0x3b28cb;};'use strict';var moment=require(_0x1cf7('0x0'));var Sequelize=require(_0x1cf7('0x1'));module[_0x1cf7('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x4cbaea){this['setDataValue'](_0x1cf7('0x3'),_0x4cbaea);this[_0x1cf7('0x4')](_0x1cf7('0x5'),moment()[_0x1cf7('0x6')](_0x1cf7('0x7')));}},'endtime':{'type':Sequelize[_0x1cf7('0x8')]},'membername':{'type':Sequelize[_0x1cf7('0x9')]},'projectname':{'type':Sequelize[_0x1cf7('0x9')]},'queue':{'type':Sequelize[_0x1cf7('0x9')]},'uniqueid':{'type':Sequelize[_0x1cf7('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1cf7('0x9')]},'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 3a6487b..8fd631b 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 _0x3958=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','count','offset','limit','set','json','reject','save','update','then','end','error','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','SessionId','map','findAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x218bed,_0x5dd957){var _0x182370=function(_0x3a6707){while(--_0x3a6707){_0x218bed['push'](_0x218bed['shift']());}};_0x182370(++_0x5dd957);}(_0x3958,0xda));var _0x8395=function(_0x46a8f0,_0x27b70f){_0x46a8f0=_0x46a8f0-0x0;var _0x158d07=_0x3958[_0x46a8f0];return _0x158d07;};'use strict';var pdf=require(_0x8395('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8395('0x1'));var zipdir=require(_0x8395('0x2'));var jsonpatch=require(_0x8395('0x3'));var rp=require(_0x8395('0x4'));var moment=require(_0x8395('0x5'));var BPromise=require(_0x8395('0x6'));var Mustache=require(_0x8395('0x7'));var util=require(_0x8395('0x8'));var path=require('path');var sox=require(_0x8395('0x9'));var csv=require(_0x8395('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8395('0xb'));var squel=require('squel');var crypto=require(_0x8395('0xc'));var jsforce=require(_0x8395('0xd'));var deskjs=require(_0x8395('0xe'));var toCsv=require(_0x8395('0xa'));var querystring=require(_0x8395('0xf'));var Papa=require('papaparse');var Redis=require(_0x8395('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8395('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8395('0x12'));var logger=require(_0x8395('0x13'))(_0x8395('0x14'));var utils=require('../../config/utils');var config=require(_0x8395('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x554645,_0x1c971e){_0x1c971e=_0x1c971e||0xcc;return function(_0x185aa5){if(_0x185aa5){return _0x554645[_0x8395('0x16')](_0x1c971e);}return _0x554645[_0x8395('0x17')](_0x1c971e)['end']();};}function respondWithResult(_0x314b36,_0x3d2b73){_0x3d2b73=_0x3d2b73||0xc8;return function(_0x135fd6){if(_0x135fd6){return _0x314b36['status'](_0x3d2b73)['json'](_0x135fd6);}};}function respondWithFilteredResult(_0x70e2f,_0x2e0e58){return function(_0x4f7216){if(_0x4f7216){var _0x3c6693=_0x4f7216[_0x8395('0x18')],_0x123890=_0x2e0e58['offset'],_0xe8f630=_0x2e0e58[_0x8395('0x19')]+_0x2e0e58[_0x8395('0x1a')],_0x13a481;if(_0xe8f630>=_0x3c6693){_0xe8f630=_0x3c6693;_0x13a481=0xc8;}else{_0x13a481=0xce;}_0x70e2f[_0x8395('0x17')](_0x13a481);return _0x70e2f[_0x8395('0x1b')]('Content-Range',_0x123890+'-'+_0xe8f630+'/'+_0x3c6693)[_0x8395('0x1c')](_0x4f7216);}return null;};}function patchUpdates(_0x56e6d1){return function(_0x4606aa){try{jsonpatch['apply'](_0x4606aa,_0x56e6d1,!![]);}catch(_0x25ebe1){return BPromise[_0x8395('0x1d')](_0x25ebe1);}return _0x4606aa[_0x8395('0x1e')]();};}function saveUpdates(_0xab4afa,_0x1ad104){return function(_0x3e0960){if(_0x3e0960){return _0x3e0960[_0x8395('0x1f')](_0xab4afa)[_0x8395('0x20')](function(_0x1b5f80){return _0x1b5f80;});}return null;};}function removeEntity(_0x55fd5d,_0x5e28fe){return function(_0x5213d8){if(_0x5213d8){return _0x5213d8['destroy']()[_0x8395('0x20')](function(){_0x55fd5d[_0x8395('0x17')](0xcc)[_0x8395('0x21')]();});}};}function handleEntityNotFound(_0x5bdf84,_0x13d4b6){return function(_0x3cdf93){if(!_0x3cdf93){_0x5bdf84[_0x8395('0x16')](0x194);}return _0x3cdf93;};}function handleError(_0x832e37,_0x1fd1ed){_0x1fd1ed=_0x1fd1ed||0x1f4;return function(_0x1babee){logger[_0x8395('0x22')](_0x1babee['stack']);if(_0x1babee[_0x8395('0x23')]){delete _0x1babee[_0x8395('0x23')];}_0x832e37[_0x8395('0x17')](_0x1fd1ed)[_0x8395('0x24')](_0x1babee);};}exports[_0x8395('0x25')]=function(_0x28a5a1,_0x45cbe4){var _0x235d8b={},_0x28939a={},_0x12abcb={'count':0x0,'rows':[]};var _0x47852c=_['map'](db[_0x8395('0x26')][_0x8395('0x27')],function(_0x5bb8aa){return{'name':_0x5bb8aa[_0x8395('0x28')],'type':_0x5bb8aa[_0x8395('0x29')][_0x8395('0x2a')]};});_0x28939a['model']=_['map'](_0x47852c,_0x8395('0x23'));_0x28939a[_0x8395('0x2b')]=_[_0x8395('0x2c')](_0x28a5a1[_0x8395('0x2b')]);_0x28939a[_0x8395('0x2d')]=_[_0x8395('0x2e')](_0x28939a['model'],_0x28939a[_0x8395('0x2b')]);_0x235d8b['attributes']=_['intersection'](_0x28939a[_0x8395('0x2f')],qs[_0x8395('0x30')](_0x28a5a1['query']['fields']));_0x235d8b[_0x8395('0x31')]=_0x235d8b[_0x8395('0x31')][_0x8395('0x32')]?_0x235d8b['attributes']:_0x28939a[_0x8395('0x2f')];if(!_0x28a5a1[_0x8395('0x2b')][_0x8395('0x33')]('nolimit')){_0x235d8b[_0x8395('0x1a')]=qs[_0x8395('0x1a')](_0x28a5a1[_0x8395('0x2b')][_0x8395('0x1a')]);_0x235d8b[_0x8395('0x19')]=qs['offset'](_0x28a5a1['query'][_0x8395('0x19')]);}_0x235d8b[_0x8395('0x34')]=qs[_0x8395('0x35')](_0x28a5a1[_0x8395('0x2b')][_0x8395('0x35')]);_0x235d8b[_0x8395('0x36')]=qs[_0x8395('0x2d')](_[_0x8395('0x37')](_0x28a5a1[_0x8395('0x2b')],_0x28939a[_0x8395('0x2d')]),_0x47852c);if(_0x28a5a1['query'][_0x8395('0x38')]){_0x235d8b['where']=_[_0x8395('0x39')](_0x235d8b[_0x8395('0x36')],{'$or':_['map'](_0x47852c,function(_0x1451de){if(_0x1451de['type']!==_0x8395('0x3a')){var _0xff53f3={};_0xff53f3[_0x1451de[_0x8395('0x23')]]={'$like':'%'+_0x28a5a1['query'][_0x8395('0x38')]+'%'};return _0xff53f3;}})});}_0x235d8b=_[_0x8395('0x39')]({},_0x235d8b,_0x28a5a1[_0x8395('0x3b')]);var _0x4cf867={'where':_0x235d8b[_0x8395('0x36')]};return db[_0x8395('0x26')]['count'](_0x4cf867)[_0x8395('0x20')](function(_0x387646){_0x12abcb[_0x8395('0x18')]=_0x387646;if(_0x28a5a1[_0x8395('0x2b')][_0x8395('0x3c')]){_0x235d8b[_0x8395('0x3d')]=[{'all':!![]}];}return db[_0x8395('0x26')]['findAll'](_0x235d8b);})[_0x8395('0x20')](function(_0x52764e){_0x12abcb[_0x8395('0x3e')]=_0x52764e;return _0x12abcb;})[_0x8395('0x20')](respondWithFilteredResult(_0x45cbe4,_0x235d8b))[_0x8395('0x3f')](handleError(_0x45cbe4,null));};exports[_0x8395('0x40')]=function(_0x292ba7,_0x502416){var _0x2d015d={'raw':!![],'where':{'id':_0x292ba7[_0x8395('0x41')]['id']}},_0x42485f={};_0x42485f[_0x8395('0x2f')]=_[_0x8395('0x2c')](db[_0x8395('0x26')][_0x8395('0x27')]);_0x42485f[_0x8395('0x2b')]=_[_0x8395('0x2c')](_0x292ba7[_0x8395('0x2b')]);_0x42485f[_0x8395('0x2d')]=_['intersection'](_0x42485f['model'],_0x42485f[_0x8395('0x2b')]);_0x2d015d[_0x8395('0x31')]=_[_0x8395('0x2e')](_0x42485f[_0x8395('0x2f')],qs[_0x8395('0x30')](_0x292ba7[_0x8395('0x2b')][_0x8395('0x30')]));_0x2d015d[_0x8395('0x31')]=_0x2d015d[_0x8395('0x31')][_0x8395('0x32')]?_0x2d015d['attributes']:_0x42485f[_0x8395('0x2f')];if(_0x292ba7['query'][_0x8395('0x3c')]){_0x2d015d['include']=[{'all':!![]}];}_0x2d015d=_['merge']({},_0x2d015d,_0x292ba7['options']);return db[_0x8395('0x26')][_0x8395('0x42')](_0x2d015d)[_0x8395('0x20')](handleEntityNotFound(_0x502416,null))[_0x8395('0x20')](respondWithResult(_0x502416,null))[_0x8395('0x3f')](handleError(_0x502416,null));};exports[_0x8395('0x43')]=function(_0x7b71c7,_0x112db9){return db[_0x8395('0x26')][_0x8395('0x43')](_0x7b71c7['body'],{})[_0x8395('0x20')](respondWithResult(_0x112db9,0xc9))[_0x8395('0x3f')](handleError(_0x112db9,null));};exports[_0x8395('0x1f')]=function(_0x5a1afa,_0x3dc24c){if(_0x5a1afa['body']['id']){delete _0x5a1afa[_0x8395('0x44')]['id'];}return db[_0x8395('0x26')][_0x8395('0x42')]({'where':{'id':_0x5a1afa[_0x8395('0x41')]['id']}})[_0x8395('0x20')](handleEntityNotFound(_0x3dc24c,null))['then'](saveUpdates(_0x5a1afa[_0x8395('0x44')],null))[_0x8395('0x20')](respondWithResult(_0x3dc24c,null))[_0x8395('0x3f')](handleError(_0x3dc24c,null));};exports[_0x8395('0x45')]=function(_0x2d2c20,_0xa132cc){return db['JscriptySessionReport'][_0x8395('0x42')]({'where':{'id':_0x2d2c20[_0x8395('0x41')]['id']}})['then'](handleEntityNotFound(_0xa132cc,null))[_0x8395('0x20')](removeEntity(_0xa132cc,null))[_0x8395('0x3f')](handleError(_0xa132cc,null));};exports[_0x8395('0x46')]=function(_0x1fe437,_0x3b0f32){return db[_0x8395('0x26')][_0x8395('0x46')]()[_0x8395('0x20')](respondWithResult(_0x3b0f32,null))[_0x8395('0x3f')](handleError(_0x3b0f32,null));};exports[_0x8395('0x47')]=function(_0x3697e4,_0x2f5f22,_0x50fcbe){var _0x409a3e={'raw':!![],'where':{}};var _0x722750={};var _0x4166b7={'count':0x0,'rows':[]};return db[_0x8395('0x26')][_0x8395('0x48')]({'where':{'id':_0x3697e4['params']['id']}})[_0x8395('0x20')](handleEntityNotFound(_0x2f5f22,null))['then'](function(_0x57a64d){if(_0x57a64d){_0x722750['model']=_[_0x8395('0x2c')](db[_0x8395('0x49')][_0x8395('0x27')]);_0x722750[_0x8395('0x2b')]=_[_0x8395('0x2c')](_0x3697e4[_0x8395('0x2b')]);_0x722750['filters']=_[_0x8395('0x2e')](_0x722750[_0x8395('0x2f')],_0x722750[_0x8395('0x2b')]);_0x409a3e[_0x8395('0x31')]=_['intersection'](_0x722750['model'],qs[_0x8395('0x30')](_0x3697e4['query'][_0x8395('0x30')]));_0x409a3e['attributes']=_0x409a3e[_0x8395('0x31')][_0x8395('0x32')]?_0x409a3e[_0x8395('0x31')]:_0x722750[_0x8395('0x2f')];if(!_0x3697e4['query'][_0x8395('0x33')](_0x8395('0x4a'))){_0x409a3e[_0x8395('0x1a')]=qs[_0x8395('0x1a')](_0x3697e4[_0x8395('0x2b')][_0x8395('0x1a')]);_0x409a3e[_0x8395('0x19')]=qs[_0x8395('0x19')](_0x3697e4['query'][_0x8395('0x19')]);}_0x409a3e['order']=qs[_0x8395('0x35')](_0x3697e4[_0x8395('0x2b')]['sort']);_0x409a3e[_0x8395('0x36')]=qs[_0x8395('0x2d')](_[_0x8395('0x37')](_0x3697e4['query'],_0x722750[_0x8395('0x2d')]));_0x409a3e['where'][_0x8395('0x4b')]=_0x57a64d['id'];if(_0x3697e4[_0x8395('0x2b')][_0x8395('0x38')]){_0x409a3e['where']=_[_0x8395('0x39')](_0x409a3e['where'],{'$or':_[_0x8395('0x4c')](_0x409a3e[_0x8395('0x31')],function(_0x5e0570){var _0x1d75f3={};_0x1d75f3[_0x5e0570]={'$like':'%'+_0x3697e4[_0x8395('0x2b')][_0x8395('0x38')]+'%'};return _0x1d75f3;})});}_0x409a3e=_[_0x8395('0x39')]({},_0x409a3e,_0x3697e4[_0x8395('0x3b')]);return db[_0x8395('0x49')]['count']({'where':_0x409a3e[_0x8395('0x36')]})[_0x8395('0x20')](function(_0x4bf973){_0x4166b7[_0x8395('0x18')]=_0x4bf973;if(_0x3697e4[_0x8395('0x2b')][_0x8395('0x3c')]){_0x409a3e[_0x8395('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x8395('0x4d')](_0x409a3e);})[_0x8395('0x20')](function(_0x45894e){_0x4166b7[_0x8395('0x3e')]=_0x45894e;return _0x4166b7;});}})[_0x8395('0x20')](respondWithFilteredResult(_0x2f5f22,_0x409a3e))[_0x8395('0x3f')](handleError(_0x2f5f22,null));}; \ No newline at end of file +var _0x7b40=['zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','status','error','stack','name','JscriptySessionReport','rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','catch','keys','intersection','includeAll','create','body','update','find','params','describe','findOne','hasOwnProperty','nolimit','order','JscriptyQuestionReport','rows','html-pdf','eml-format'];(function(_0x4f0346,_0x1470b0){var _0x435859=function(_0x4b7984){while(--_0x4b7984){_0x4f0346['push'](_0x4f0346['shift']());}};_0x435859(++_0x1470b0);}(_0x7b40,0x122));var _0x07b4=function(_0x4b5c69,_0x4f1fc2){_0x4b5c69=_0x4b5c69-0x0;var _0x2ec847=_0x7b40[_0x4b5c69];return _0x2ec847;};'use strict';var pdf=require(_0x07b4('0x0'));var emlformat=require(_0x07b4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x07b4('0x2'));var jsonpatch=require(_0x07b4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x07b4('0x4'));var Mustache=require(_0x07b4('0x5'));var util=require(_0x07b4('0x6'));var path=require(_0x07b4('0x7'));var sox=require(_0x07b4('0x8'));var csv=require(_0x07b4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x07b4('0xa'));var squel=require('squel');var crypto=require(_0x07b4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x07b4('0xc'));var toCsv=require(_0x07b4('0x9'));var querystring=require('querystring');var Papa=require(_0x07b4('0xd'));var Redis=require(_0x07b4('0xe'));var authService=require(_0x07b4('0xf'));var qs=require(_0x07b4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x07b4('0x11'));var logger=require('../../config/logger')(_0x07b4('0x12'));var utils=require('../../config/utils');var config=require(_0x07b4('0x13'));var db=require(_0x07b4('0x14'))['db'];function respondWithStatusCode(_0x194d4b,_0x574fc2){_0x574fc2=_0x574fc2||0xcc;return function(_0x16f651){if(_0x16f651){return _0x194d4b[_0x07b4('0x15')](_0x574fc2);}return _0x194d4b['status'](_0x574fc2)[_0x07b4('0x16')]();};}function respondWithResult(_0x25ecb8,_0x25a54b){_0x25a54b=_0x25a54b||0xc8;return function(_0x35a4b6){if(_0x35a4b6){return _0x25ecb8['status'](_0x25a54b)['json'](_0x35a4b6);}};}function respondWithFilteredResult(_0x5105e5,_0x5aeeb8){return function(_0x18ba9b){if(_0x18ba9b){var _0xc7a24=_0x18ba9b[_0x07b4('0x17')],_0x47eeba=_0x5aeeb8[_0x07b4('0x18')],_0x3b9dc8=_0x5aeeb8[_0x07b4('0x18')]+_0x5aeeb8[_0x07b4('0x19')],_0x3ac106;if(_0x3b9dc8>=_0xc7a24){_0x3b9dc8=_0xc7a24;_0x3ac106=0xc8;}else{_0x3ac106=0xce;}_0x5105e5['status'](_0x3ac106);return _0x5105e5[_0x07b4('0x1a')](_0x07b4('0x1b'),_0x47eeba+'-'+_0x3b9dc8+'/'+_0xc7a24)['json'](_0x18ba9b);}return null;};}function patchUpdates(_0x468499){return function(_0x5b3843){try{jsonpatch[_0x07b4('0x1c')](_0x5b3843,_0x468499,!![]);}catch(_0x207b32){return BPromise[_0x07b4('0x1d')](_0x207b32);}return _0x5b3843[_0x07b4('0x1e')]();};}function saveUpdates(_0x23166a,_0x497180){return function(_0x5e4662){if(_0x5e4662){return _0x5e4662['update'](_0x23166a)[_0x07b4('0x1f')](function(_0x29569f){return _0x29569f;});}return null;};}function removeEntity(_0xdc538b,_0x22c25b){return function(_0x43863){if(_0x43863){return _0x43863[_0x07b4('0x20')]()[_0x07b4('0x1f')](function(){_0xdc538b[_0x07b4('0x21')](0xcc)[_0x07b4('0x16')]();});}};}function handleEntityNotFound(_0x40690b,_0x1cf22f){return function(_0x3bad6b){if(!_0x3bad6b){_0x40690b[_0x07b4('0x15')](0x194);}return _0x3bad6b;};}function handleError(_0x46d0dd,_0x208fed){_0x208fed=_0x208fed||0x1f4;return function(_0x2cbe9e){logger[_0x07b4('0x22')](_0x2cbe9e[_0x07b4('0x23')]);if(_0x2cbe9e[_0x07b4('0x24')]){delete _0x2cbe9e[_0x07b4('0x24')];}_0x46d0dd['status'](_0x208fed)['send'](_0x2cbe9e);};}exports['index']=function(_0x7a4dc,_0x32d1a3){var _0x5a60f8={},_0x142c32={},_0x3dc80d={'count':0x0,'rows':[]};var _0x3bf60a=_['map'](db[_0x07b4('0x25')][_0x07b4('0x26')],function(_0x234a1b){return{'name':_0x234a1b[_0x07b4('0x27')],'type':_0x234a1b[_0x07b4('0x28')]['key']};});_0x142c32[_0x07b4('0x29')]=_['map'](_0x3bf60a,_0x07b4('0x24'));_0x142c32[_0x07b4('0x2a')]=_['keys'](_0x7a4dc[_0x07b4('0x2a')]);_0x142c32[_0x07b4('0x2b')]=_['intersection'](_0x142c32['model'],_0x142c32[_0x07b4('0x2a')]);_0x5a60f8[_0x07b4('0x2c')]=_['intersection'](_0x142c32[_0x07b4('0x29')],qs[_0x07b4('0x2d')](_0x7a4dc[_0x07b4('0x2a')][_0x07b4('0x2d')]));_0x5a60f8[_0x07b4('0x2c')]=_0x5a60f8[_0x07b4('0x2c')][_0x07b4('0x2e')]?_0x5a60f8[_0x07b4('0x2c')]:_0x142c32[_0x07b4('0x29')];if(!_0x7a4dc[_0x07b4('0x2a')]['hasOwnProperty']('nolimit')){_0x5a60f8[_0x07b4('0x19')]=qs[_0x07b4('0x19')](_0x7a4dc[_0x07b4('0x2a')]['limit']);_0x5a60f8['offset']=qs[_0x07b4('0x18')](_0x7a4dc['query'][_0x07b4('0x18')]);}_0x5a60f8['order']=qs[_0x07b4('0x2f')](_0x7a4dc[_0x07b4('0x2a')][_0x07b4('0x2f')]);_0x5a60f8[_0x07b4('0x30')]=qs[_0x07b4('0x2b')](_[_0x07b4('0x31')](_0x7a4dc[_0x07b4('0x2a')],_0x142c32[_0x07b4('0x2b')]),_0x3bf60a);if(_0x7a4dc[_0x07b4('0x2a')][_0x07b4('0x32')]){_0x5a60f8[_0x07b4('0x30')]=_[_0x07b4('0x33')](_0x5a60f8[_0x07b4('0x30')],{'$or':_[_0x07b4('0x34')](_0x3bf60a,function(_0x17f787){if(_0x17f787[_0x07b4('0x28')]!==_0x07b4('0x35')){var _0x366b05={};_0x366b05[_0x17f787[_0x07b4('0x24')]]={'$like':'%'+_0x7a4dc[_0x07b4('0x2a')][_0x07b4('0x32')]+'%'};return _0x366b05;}})});}_0x5a60f8=_[_0x07b4('0x33')]({},_0x5a60f8,_0x7a4dc[_0x07b4('0x36')]);var _0x34ba80={'where':_0x5a60f8[_0x07b4('0x30')]};return db[_0x07b4('0x25')][_0x07b4('0x17')](_0x34ba80)[_0x07b4('0x1f')](function(_0x434211){_0x3dc80d[_0x07b4('0x17')]=_0x434211;if(_0x7a4dc['query']['includeAll']){_0x5a60f8[_0x07b4('0x37')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x07b4('0x38')](_0x5a60f8);})[_0x07b4('0x1f')](function(_0x41326c){_0x3dc80d['rows']=_0x41326c;return _0x3dc80d;})[_0x07b4('0x1f')](respondWithFilteredResult(_0x32d1a3,_0x5a60f8))[_0x07b4('0x39')](handleError(_0x32d1a3,null));};exports['show']=function(_0x45c41b,_0x449820){var _0x552e5d={'raw':!![],'where':{'id':_0x45c41b['params']['id']}},_0xff4f59={};_0xff4f59[_0x07b4('0x29')]=_[_0x07b4('0x3a')](db[_0x07b4('0x25')][_0x07b4('0x26')]);_0xff4f59[_0x07b4('0x2a')]=_[_0x07b4('0x3a')](_0x45c41b[_0x07b4('0x2a')]);_0xff4f59[_0x07b4('0x2b')]=_['intersection'](_0xff4f59['model'],_0xff4f59[_0x07b4('0x2a')]);_0x552e5d[_0x07b4('0x2c')]=_[_0x07b4('0x3b')](_0xff4f59[_0x07b4('0x29')],qs[_0x07b4('0x2d')](_0x45c41b[_0x07b4('0x2a')][_0x07b4('0x2d')]));_0x552e5d[_0x07b4('0x2c')]=_0x552e5d['attributes'][_0x07b4('0x2e')]?_0x552e5d[_0x07b4('0x2c')]:_0xff4f59[_0x07b4('0x29')];if(_0x45c41b[_0x07b4('0x2a')][_0x07b4('0x3c')]){_0x552e5d[_0x07b4('0x37')]=[{'all':!![]}];}_0x552e5d=_[_0x07b4('0x33')]({},_0x552e5d,_0x45c41b[_0x07b4('0x36')]);return db[_0x07b4('0x25')]['find'](_0x552e5d)[_0x07b4('0x1f')](handleEntityNotFound(_0x449820,null))[_0x07b4('0x1f')](respondWithResult(_0x449820,null))['catch'](handleError(_0x449820,null));};exports[_0x07b4('0x3d')]=function(_0x2ef925,_0x22be43){return db[_0x07b4('0x25')]['create'](_0x2ef925[_0x07b4('0x3e')],{})[_0x07b4('0x1f')](respondWithResult(_0x22be43,0xc9))['catch'](handleError(_0x22be43,null));};exports[_0x07b4('0x3f')]=function(_0x4cda49,_0x5aace1){if(_0x4cda49['body']['id']){delete _0x4cda49[_0x07b4('0x3e')]['id'];}return db[_0x07b4('0x25')][_0x07b4('0x40')]({'where':{'id':_0x4cda49[_0x07b4('0x41')]['id']}})[_0x07b4('0x1f')](handleEntityNotFound(_0x5aace1,null))['then'](saveUpdates(_0x4cda49[_0x07b4('0x3e')],null))[_0x07b4('0x1f')](respondWithResult(_0x5aace1,null))['catch'](handleError(_0x5aace1,null));};exports['destroy']=function(_0x200418,_0x696151){return db[_0x07b4('0x25')]['find']({'where':{'id':_0x200418[_0x07b4('0x41')]['id']}})[_0x07b4('0x1f')](handleEntityNotFound(_0x696151,null))[_0x07b4('0x1f')](removeEntity(_0x696151,null))['catch'](handleError(_0x696151,null));};exports[_0x07b4('0x42')]=function(_0x257cbf,_0x28f4d8){return db[_0x07b4('0x25')][_0x07b4('0x42')]()['then'](respondWithResult(_0x28f4d8,null))[_0x07b4('0x39')](handleError(_0x28f4d8,null));};exports['getQuestions']=function(_0x560859,_0xb792a7,_0x933e10){var _0x267a8e={'raw':!![],'where':{}};var _0x4c3859={};var _0x2dd385={'count':0x0,'rows':[]};return db[_0x07b4('0x25')][_0x07b4('0x43')]({'where':{'id':_0x560859[_0x07b4('0x41')]['id']}})[_0x07b4('0x1f')](handleEntityNotFound(_0xb792a7,null))[_0x07b4('0x1f')](function(_0x5d26e5){if(_0x5d26e5){_0x4c3859['model']=_[_0x07b4('0x3a')](db['JscriptyQuestionReport']['rawAttributes']);_0x4c3859[_0x07b4('0x2a')]=_[_0x07b4('0x3a')](_0x560859[_0x07b4('0x2a')]);_0x4c3859[_0x07b4('0x2b')]=_[_0x07b4('0x3b')](_0x4c3859[_0x07b4('0x29')],_0x4c3859['query']);_0x267a8e[_0x07b4('0x2c')]=_[_0x07b4('0x3b')](_0x4c3859['model'],qs['fields'](_0x560859[_0x07b4('0x2a')][_0x07b4('0x2d')]));_0x267a8e[_0x07b4('0x2c')]=_0x267a8e['attributes'][_0x07b4('0x2e')]?_0x267a8e[_0x07b4('0x2c')]:_0x4c3859[_0x07b4('0x29')];if(!_0x560859[_0x07b4('0x2a')][_0x07b4('0x44')](_0x07b4('0x45'))){_0x267a8e['limit']=qs[_0x07b4('0x19')](_0x560859[_0x07b4('0x2a')]['limit']);_0x267a8e[_0x07b4('0x18')]=qs[_0x07b4('0x18')](_0x560859[_0x07b4('0x2a')][_0x07b4('0x18')]);}_0x267a8e[_0x07b4('0x46')]=qs['sort'](_0x560859[_0x07b4('0x2a')][_0x07b4('0x2f')]);_0x267a8e[_0x07b4('0x30')]=qs[_0x07b4('0x2b')](_[_0x07b4('0x31')](_0x560859[_0x07b4('0x2a')],_0x4c3859['filters']));_0x267a8e[_0x07b4('0x30')]['SessionId']=_0x5d26e5['id'];if(_0x560859[_0x07b4('0x2a')]['filter']){_0x267a8e[_0x07b4('0x30')]=_[_0x07b4('0x33')](_0x267a8e[_0x07b4('0x30')],{'$or':_[_0x07b4('0x34')](_0x267a8e['attributes'],function(_0x3d0408){var _0x4e22e6={};_0x4e22e6[_0x3d0408]={'$like':'%'+_0x560859[_0x07b4('0x2a')][_0x07b4('0x32')]+'%'};return _0x4e22e6;})});}_0x267a8e=_[_0x07b4('0x33')]({},_0x267a8e,_0x560859['options']);return db[_0x07b4('0x47')][_0x07b4('0x17')]({'where':_0x267a8e[_0x07b4('0x30')]})['then'](function(_0x5209e1){_0x2dd385[_0x07b4('0x17')]=_0x5209e1;if(_0x560859[_0x07b4('0x2a')][_0x07b4('0x3c')]){_0x267a8e[_0x07b4('0x37')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x267a8e);})[_0x07b4('0x1f')](function(_0x3ddd2d){_0x2dd385[_0x07b4('0x48')]=_0x3ddd2d;return _0x2dd385;});}})[_0x07b4('0x1f')](respondWithFilteredResult(_0xb792a7,_0x267a8e))[_0x07b4('0x39')](handleError(_0xb792a7,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 059f45e..8172551 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 _0xf562=['moment','bluebird','request-promise','path','rimraf','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api'];(function(_0x1ebe3d,_0xe23282){var _0xf228cb=function(_0x377b6b){while(--_0x377b6b){_0x1ebe3d['push'](_0x1ebe3d['shift']());}};_0xf228cb(++_0xe23282);}(_0xf562,0x100));var _0x2f56=function(_0x3e5bfb,_0x331b00){_0x3e5bfb=_0x3e5bfb-0x0;var _0x483390=_0xf562[_0x3e5bfb];return _0x483390;};'use strict';var _=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var logger=require(_0x2f56('0x2'))(_0x2f56('0x3'));var moment=require(_0x2f56('0x4'));var BPromise=require(_0x2f56('0x5'));var rp=require(_0x2f56('0x6'));var fs=require('fs');var path=require(_0x2f56('0x7'));var rimraf=require(_0x2f56('0x8'));var config=require('../../config/environment');var attributes=require(_0x2f56('0x9'));module['exports']=function(_0x14436b,_0x5b3784){return _0x14436b[_0x2f56('0xa')](_0x2f56('0xb'),attributes,{'tableName':_0x2f56('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb091=['moment','request-promise','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','util','../../config/logger','api'];(function(_0x539cb2,_0x39ac60){var _0x376515=function(_0x5976e9){while(--_0x5976e9){_0x539cb2['push'](_0x539cb2['shift']());}};_0x376515(++_0x39ac60);}(_0xb091,0x16e));var _0x1b09=function(_0xd162f0,_0x665021){_0xd162f0=_0xd162f0-0x0;var _0x420775=_0xb091[_0xd162f0];return _0x420775;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var logger=require(_0x1b09('0x1'))(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b09('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b09('0x5'));var attributes=require(_0x1b09('0x6'));module['exports']=function(_0xda8caa,_0x5fa348){return _0xda8caa[_0x1b09('0x7')]('JscriptySessionReport',attributes,{'tableName':_0x1b09('0x8'),'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 9aafe62..146db77 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 _0x552d=['../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x552d,0xbe));var _0xd552=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x552d[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xd552('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd552('0x1'));var rs=require(_0xd552('0x2'));var fs=require('fs');var Redis=require(_0xd552('0x3'));var db=require(_0xd552('0x4'))['db'];var utils=require(_0xd552('0x5'));var logger=require(_0xd552('0x6'))(_0xd552('0x7'));var config=require(_0xd552('0x8'));var jayson=require(_0xd552('0x9'));var client=jayson['client'][_0xd552('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x553006,_0x474c4f,_0x44be5d){return new BPromise(function(_0x28f31f,_0x80186d){return client['request'](_0x553006,_0x44be5d)[_0xd552('0xb')](function(_0x19b1ad){logger[_0xd552('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x474c4f,_0xd552('0xd'));logger[_0xd552('0xe')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x474c4f,_0xd552('0xd'),JSON[_0xd552('0xf')](_0x19b1ad));if(_0x19b1ad[_0xd552('0x10')]){if(_0x19b1ad['error'][_0xd552('0x11')]===0x1f4){logger[_0xd552('0x10')](_0xd552('0x12'),_0x474c4f,_0x19b1ad['error'][_0xd552('0x13')]);return _0x80186d(_0x19b1ad[_0xd552('0x10')]['message']);}logger['error'](_0xd552('0x12'),_0x474c4f,_0x19b1ad[_0xd552('0x10')][_0xd552('0x13')]);return _0x28f31f(_0x19b1ad['error'][_0xd552('0x13')]);}else{logger[_0xd552('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x474c4f,_0xd552('0xd'));_0x28f31f(_0x19b1ad[_0xd552('0x14')]['message']);}})[_0xd552('0x15')](function(_0x37b509){logger[_0xd552('0x10')](_0xd552('0x12'),_0x474c4f,_0x37b509);_0x80186d(_0x37b509);});});} \ No newline at end of file +var _0x4e16=['http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x4e1c7d,_0x1366bc){var _0x191a91=function(_0x393bd2){while(--_0x393bd2){_0x4e1c7d['push'](_0x4e1c7d['shift']());}};_0x191a91(++_0x1366bc);}(_0x4e16,0x1ee));var _0x64e1=function(_0x20315a,_0x4604ee){_0x20315a=_0x20315a-0x0;var _0x1d0300=_0x4e16[_0x20315a];return _0x1d0300;};'use strict';var _=require(_0x64e1('0x0'));var util=require(_0x64e1('0x1'));var moment=require(_0x64e1('0x2'));var BPromise=require(_0x64e1('0x3'));var rs=require(_0x64e1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64e1('0x5'))['db'];var utils=require(_0x64e1('0x6'));var logger=require(_0x64e1('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x64e1('0x8'));var client=jayson[_0x64e1('0x9')][_0x64e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x116fdb,_0xc2529e,_0x4c2004){return new BPromise(function(_0x192173,_0x54aeff){return client[_0x64e1('0xb')](_0x116fdb,_0x4c2004)[_0x64e1('0xc')](function(_0x33e0fb){logger[_0x64e1('0xd')](_0x64e1('0xe'),_0xc2529e,_0x64e1('0xf'));logger[_0x64e1('0x10')](_0x64e1('0x11'),_0xc2529e,_0x64e1('0xf'),JSON[_0x64e1('0x12')](_0x33e0fb));if(_0x33e0fb[_0x64e1('0x13')]){if(_0x33e0fb[_0x64e1('0x13')][_0x64e1('0x14')]===0x1f4){logger['error'](_0x64e1('0xe'),_0xc2529e,_0x33e0fb['error'][_0x64e1('0x15')]);return _0x54aeff(_0x33e0fb[_0x64e1('0x13')][_0x64e1('0x15')]);}logger[_0x64e1('0x13')](_0x64e1('0xe'),_0xc2529e,_0x33e0fb[_0x64e1('0x13')][_0x64e1('0x15')]);return _0x192173(_0x33e0fb['error'][_0x64e1('0x15')]);}else{logger[_0x64e1('0xd')](_0x64e1('0xe'),_0xc2529e,_0x64e1('0xf'));_0x192173(_0x33e0fb[_0x64e1('0x16')][_0x64e1('0x15')]);}})[_0x64e1('0x17')](function(_0x3160ba){logger[_0x64e1('0x13')](_0x64e1('0xe'),_0xc2529e,_0x3160ba);_0x54aeff(_0x3160ba);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 5e837f0..7f7f22f 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 _0xff09=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','index','put','/:id','isAuthenticated','update','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xff09,0x1b6));var _0x9ff0=function(_0xe998dd,_0x5ec17b){_0xe998dd=_0xe998dd-0x0;var _0x57bd82=_0xff09[_0xe998dd];return _0x57bd82;};'use strict';var multer=require('multer');var util=require(_0x9ff0('0x0'));var path=require(_0x9ff0('0x1'));var timeout=require(_0x9ff0('0x2'));var express=require(_0x9ff0('0x3'));var router=express['Router']();var auth=require(_0x9ff0('0x4'));var interaction=require(_0x9ff0('0x5'));var config=require('../../config/environment');var controller=require('./license.controller');router['get']('/',controller[_0x9ff0('0x6')]);router[_0x9ff0('0x7')](_0x9ff0('0x8'),auth[_0x9ff0('0x9')](),controller[_0x9ff0('0xa')]);module['exports']=router; \ No newline at end of file +var _0xc57a=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','exports','multer'];(function(_0x39f089,_0x1dff44){var _0x3c1fca=function(_0xee19d3){while(--_0xee19d3){_0x39f089['push'](_0x39f089['shift']());}};_0x3c1fca(++_0x1dff44);}(_0xc57a,0x78));var _0xac57=function(_0xaf8f29,_0x5754cf){_0xaf8f29=_0xaf8f29-0x0;var _0x391fed=_0xc57a[_0xaf8f29];return _0x391fed;};'use strict';var multer=require(_0xac57('0x0'));var util=require(_0xac57('0x1'));var path=require(_0xac57('0x2'));var timeout=require('connect-timeout');var express=require(_0xac57('0x3'));var router=express[_0xac57('0x4')]();var auth=require(_0xac57('0x5'));var interaction=require(_0xac57('0x6'));var config=require(_0xac57('0x7'));var controller=require('./license.controller');router['get']('/',controller['index']);router['put'](_0xac57('0x8'),auth[_0xac57('0x9')](),controller['update']);module[_0xac57('0xa')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 2493f3b..73d66ab 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 _0xba34=['STRING','sequelize','exports','TEXT'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xba34,0x119));var _0x4ba3=function(_0x4e806b,_0x4b4484){_0x4e806b=_0x4e806b-0x0;var _0x4ccabe=_0xba34[_0x4e806b];return _0x4ccabe;};'use strict';var Sequelize=require(_0x4ba3('0x0'));module[_0x4ba3('0x1')]={'license':{'type':Sequelize[_0x4ba3('0x2')]},'data1':{'type':Sequelize[_0x4ba3('0x3')]},'data2':{'type':Sequelize[_0x4ba3('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1261=['exports','TEXT','STRING','INTEGER'];(function(_0xbf9f76,_0x4dc83f){var _0x1e3564=function(_0x5dd6fa){while(--_0x5dd6fa){_0xbf9f76['push'](_0xbf9f76['shift']());}};_0x1e3564(++_0x4dc83f);}(_0x1261,0x144));var _0x1126=function(_0x397004,_0x7949f){_0x397004=_0x397004-0x0;var _0xa7a10=_0x1261[_0x397004];return _0xa7a10;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'license':{'type':Sequelize[_0x1126('0x1')]},'data1':{'type':Sequelize[_0x1126('0x2')]},'data2':{'type':Sequelize[_0x1126('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x1126('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 490c93b..139f577 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 _0x5b69=['catch','body','find','params','get','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','apply','save','then','destroy','sendStatus','stack','name','send','../../config/license/util','index','model','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense'];(function(_0x146837,_0x2aa6a2){var _0x3d7e60=function(_0x1301ac){while(--_0x1301ac){_0x146837['push'](_0x146837['shift']());}};_0x3d7e60(++_0x2aa6a2);}(_0x5b69,0x7b));var _0x95b6=function(_0x3a47b1,_0x318a5e){_0x3a47b1=_0x3a47b1-0x0;var _0x464796=_0x5b69[_0x3a47b1];return _0x464796;};'use strict';var pdf=require(_0x95b6('0x0'));var emlformat=require(_0x95b6('0x1'));var rimraf=require(_0x95b6('0x2'));var zipdir=require(_0x95b6('0x3'));var jsonpatch=require(_0x95b6('0x4'));var rp=require(_0x95b6('0x5'));var moment=require(_0x95b6('0x6'));var BPromise=require(_0x95b6('0x7'));var Mustache=require('mustache');var util=require(_0x95b6('0x8'));var path=require(_0x95b6('0x9'));var sox=require('sox');var csv=require(_0x95b6('0xa'));var ejs=require(_0x95b6('0xb'));var fs=require('fs');var _=require(_0x95b6('0xc'));var squel=require(_0x95b6('0xd'));var crypto=require(_0x95b6('0xe'));var jsforce=require(_0x95b6('0xf'));var deskjs=require(_0x95b6('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x95b6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x95b6('0x12'));var as=require(_0x95b6('0x13'));var hardwareService=require(_0x95b6('0x14'));var logger=require(_0x95b6('0x15'))(_0x95b6('0x16'));var utils=require(_0x95b6('0x17'));var config=require('../../config/environment');var db=require(_0x95b6('0x18'))['db'];function respondWithStatusCode(_0xfcb6bb,_0x49edab){_0x49edab=_0x49edab||0xcc;return function(_0x575522){if(_0x575522){return _0xfcb6bb['sendStatus'](_0x49edab);}return _0xfcb6bb[_0x95b6('0x19')](_0x49edab)[_0x95b6('0x1a')]();};}function respondWithResult(_0x321812,_0x55b639){_0x55b639=_0x55b639||0xc8;return function(_0x164a0a){if(_0x164a0a){return _0x321812[_0x95b6('0x19')](_0x55b639)[_0x95b6('0x1b')](_0x164a0a);}};}function respondWithFilteredResult(_0x42ffa6,_0x4cdd7c){return function(_0x38106a){if(_0x38106a){var _0x173b70=_0x38106a[_0x95b6('0x1c')],_0x44f403=_0x4cdd7c[_0x95b6('0x1d')],_0xe05176=_0x4cdd7c[_0x95b6('0x1d')]+_0x4cdd7c[_0x95b6('0x1e')],_0x5f07f1;if(_0xe05176>=_0x173b70){_0xe05176=_0x173b70;_0x5f07f1=0xc8;}else{_0x5f07f1=0xce;}_0x42ffa6[_0x95b6('0x19')](_0x5f07f1);return _0x42ffa6[_0x95b6('0x1f')]('Content-Range',_0x44f403+'-'+_0xe05176+'/'+_0x173b70)[_0x95b6('0x1b')](_0x38106a);}return null;};}function patchUpdates(_0x13b143){return function(_0x33e1f4){try{jsonpatch[_0x95b6('0x20')](_0x33e1f4,_0x13b143,!![]);}catch(_0x594dcf){return BPromise['reject'](_0x594dcf);}return _0x33e1f4[_0x95b6('0x21')]();};}function saveUpdates(_0x217066,_0x4785c8){return function(_0x3d8425){if(_0x3d8425){return _0x3d8425['update'](_0x217066)[_0x95b6('0x22')](function(_0x14f4f4){return _0x14f4f4;});}return null;};}function removeEntity(_0x24dc45,_0x5025af){return function(_0x5f35b3){if(_0x5f35b3){return _0x5f35b3[_0x95b6('0x23')]()[_0x95b6('0x22')](function(){_0x24dc45[_0x95b6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b1a9b,_0x3d4306){return function(_0x20403c){if(!_0x20403c){_0x5b1a9b[_0x95b6('0x24')](0x194);}return _0x20403c;};}function handleError(_0x566b94,_0x108af2){_0x108af2=_0x108af2||0x1f4;return function(_0x2b4408){logger['error'](_0x2b4408[_0x95b6('0x25')]);if(_0x2b4408[_0x95b6('0x26')]){delete _0x2b4408[_0x95b6('0x26')];}_0x566b94['status'](_0x108af2)[_0x95b6('0x27')](_0x2b4408);};}var utilLicense=require(_0x95b6('0x28'));exports[_0x95b6('0x29')]=function(_0x23086a,_0x1c3ff6){var _0xbc0e73={'raw':!![],'where':{'id':0x1}},_0x268825={};_0x268825[_0x95b6('0x2a')]=_['keys'](db[_0x95b6('0x2b')][_0x95b6('0x2c')]);_0x268825[_0x95b6('0x2d')]=_['keys'](_0x23086a['query']);_0x268825[_0x95b6('0x2e')]=_[_0x95b6('0x2f')](_0x268825[_0x95b6('0x2a')],_0x268825[_0x95b6('0x2d')]);_0xbc0e73[_0x95b6('0x30')]=_['intersection'](_0x268825[_0x95b6('0x2a')],qs['fields'](_0x23086a['query'][_0x95b6('0x31')]));_0xbc0e73[_0x95b6('0x30')]=_0xbc0e73['attributes'][_0x95b6('0x32')]?_0xbc0e73[_0x95b6('0x30')]:_0x268825[_0x95b6('0x2a')];_0xbc0e73=_[_0x95b6('0x33')]({},_0xbc0e73,_0x23086a[_0x95b6('0x34')]);return utilLicense[_0x95b6('0x35')](_0xbc0e73)[_0x95b6('0x22')](respondWithResult(_0x1c3ff6,null))[_0x95b6('0x36')](handleError(_0x1c3ff6,null));};exports['update']=function(_0x2ce2cf,_0x176189){if(_0x2ce2cf[_0x95b6('0x37')]['id']){delete _0x2ce2cf[_0x95b6('0x37')]['id'];}return db[_0x95b6('0x2b')][_0x95b6('0x38')]({'where':{'id':_0x2ce2cf[_0x95b6('0x39')]['id']}})[_0x95b6('0x22')](handleEntityNotFound(_0x176189,null))['then'](function(_0x3b3b0a){var _0x366090=_0x3b3b0a[_0x95b6('0x3a')]({'plain':!![]});return utilLicense['checkLicense'](_0x366090,_0x2ce2cf['body']['key']);})['then'](function(_0x54a693){if(!_0x54a693['demo']){return saveUpdates(_0x2ce2cf[_0x95b6('0x37')],null);}return _0x54a693;})[_0x95b6('0x22')](respondWithResult(_0x176189,null))[_0x95b6('0x36')](handleError(_0x176189,null));}; \ No newline at end of file +var _0x176b=['rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','limit','Content-Range','reject','save','then','destroy','sendStatus','stack','name','../../config/license/util','index','model','License','query','keys','filters','fields','attributes','length','merge','options','getLicense','catch','update','body','find','get','checkLicense','key','html-pdf'];(function(_0x34fde4,_0x592f60){var _0x31c391=function(_0x3f341f){while(--_0x3f341f){_0x34fde4['push'](_0x34fde4['shift']());}};_0x31c391(++_0x592f60);}(_0x176b,0x14f));var _0xb176=function(_0x393436,_0x2100f4){_0x393436=_0x393436-0x0;var _0x1a54a4=_0x176b[_0x393436];return _0x1a54a4;};'use strict';var pdf=require(_0xb176('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb176('0x1'));var zipdir=require(_0xb176('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb176('0x3'));var BPromise=require(_0xb176('0x4'));var Mustache=require(_0xb176('0x5'));var util=require(_0xb176('0x6'));var path=require(_0xb176('0x7'));var sox=require(_0xb176('0x8'));var csv=require(_0xb176('0x9'));var ejs=require(_0xb176('0xa'));var fs=require('fs');var _=require(_0xb176('0xb'));var squel=require('squel');var crypto=require(_0xb176('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb176('0xd'));var toCsv=require(_0xb176('0x9'));var querystring=require(_0xb176('0xe'));var Papa=require(_0xb176('0xf'));var Redis=require(_0xb176('0x10'));var authService=require(_0xb176('0x11'));var qs=require(_0xb176('0x12'));var as=require(_0xb176('0x13'));var hardwareService=require(_0xb176('0x14'));var logger=require(_0xb176('0x15'))(_0xb176('0x16'));var utils=require(_0xb176('0x17'));var config=require('../../config/environment');var db=require(_0xb176('0x18'))['db'];function respondWithStatusCode(_0x387e8c,_0x4fbf9d){_0x4fbf9d=_0x4fbf9d||0xcc;return function(_0x3829fa){if(_0x3829fa){return _0x387e8c['sendStatus'](_0x4fbf9d);}return _0x387e8c[_0xb176('0x19')](_0x4fbf9d)['end']();};}function respondWithResult(_0x5155bb,_0x145ffc){_0x145ffc=_0x145ffc||0xc8;return function(_0x24ff32){if(_0x24ff32){return _0x5155bb['status'](_0x145ffc)[_0xb176('0x1a')](_0x24ff32);}};}function respondWithFilteredResult(_0x5340fd,_0x28ee3e){return function(_0x24fc19){if(_0x24fc19){var _0x4f80df=_0x24fc19['count'],_0xd5d237=_0x28ee3e['offset'],_0x57b4d2=_0x28ee3e['offset']+_0x28ee3e[_0xb176('0x1b')],_0x55320d;if(_0x57b4d2>=_0x4f80df){_0x57b4d2=_0x4f80df;_0x55320d=0xc8;}else{_0x55320d=0xce;}_0x5340fd['status'](_0x55320d);return _0x5340fd['set'](_0xb176('0x1c'),_0xd5d237+'-'+_0x57b4d2+'/'+_0x4f80df)[_0xb176('0x1a')](_0x24fc19);}return null;};}function patchUpdates(_0x2e049b){return function(_0x434889){try{jsonpatch['apply'](_0x434889,_0x2e049b,!![]);}catch(_0x46ebf4){return BPromise[_0xb176('0x1d')](_0x46ebf4);}return _0x434889[_0xb176('0x1e')]();};}function saveUpdates(_0x15a224,_0x108999){return function(_0x391003){if(_0x391003){return _0x391003['update'](_0x15a224)[_0xb176('0x1f')](function(_0x266571){return _0x266571;});}return null;};}function removeEntity(_0x49a798,_0x845987){return function(_0x4ec8b9){if(_0x4ec8b9){return _0x4ec8b9[_0xb176('0x20')]()[_0xb176('0x1f')](function(){_0x49a798[_0xb176('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23661f,_0x37dbd6){return function(_0x3ed907){if(!_0x3ed907){_0x23661f[_0xb176('0x21')](0x194);}return _0x3ed907;};}function handleError(_0x1d6da3,_0x4e4a0f){_0x4e4a0f=_0x4e4a0f||0x1f4;return function(_0x3720a6){logger['error'](_0x3720a6[_0xb176('0x22')]);if(_0x3720a6[_0xb176('0x23')]){delete _0x3720a6[_0xb176('0x23')];}_0x1d6da3[_0xb176('0x19')](_0x4e4a0f)['send'](_0x3720a6);};}var utilLicense=require(_0xb176('0x24'));exports[_0xb176('0x25')]=function(_0x263b2d,_0x2ebb2e){var _0x2eabb7={'raw':!![],'where':{'id':0x1}},_0x4c8ec5={};_0x4c8ec5[_0xb176('0x26')]=_['keys'](db[_0xb176('0x27')]['rawAttributes']);_0x4c8ec5[_0xb176('0x28')]=_[_0xb176('0x29')](_0x263b2d[_0xb176('0x28')]);_0x4c8ec5[_0xb176('0x2a')]=_['intersection'](_0x4c8ec5['model'],_0x4c8ec5['query']);_0x2eabb7['attributes']=_['intersection'](_0x4c8ec5['model'],qs[_0xb176('0x2b')](_0x263b2d[_0xb176('0x28')][_0xb176('0x2b')]));_0x2eabb7[_0xb176('0x2c')]=_0x2eabb7[_0xb176('0x2c')][_0xb176('0x2d')]?_0x2eabb7[_0xb176('0x2c')]:_0x4c8ec5[_0xb176('0x26')];_0x2eabb7=_[_0xb176('0x2e')]({},_0x2eabb7,_0x263b2d[_0xb176('0x2f')]);return utilLicense[_0xb176('0x30')](_0x2eabb7)[_0xb176('0x1f')](respondWithResult(_0x2ebb2e,null))[_0xb176('0x31')](handleError(_0x2ebb2e,null));};exports[_0xb176('0x32')]=function(_0x479370,_0x226f31){if(_0x479370[_0xb176('0x33')]['id']){delete _0x479370['body']['id'];}return db[_0xb176('0x27')][_0xb176('0x34')]({'where':{'id':_0x479370['params']['id']}})[_0xb176('0x1f')](handleEntityNotFound(_0x226f31,null))[_0xb176('0x1f')](function(_0x211bfa){var _0x56aac1=_0x211bfa[_0xb176('0x35')]({'plain':!![]});return utilLicense[_0xb176('0x36')](_0x56aac1,_0x479370[_0xb176('0x33')][_0xb176('0x37')]);})['then'](function(_0x1235c2){if(!_0x1235c2['demo']){return saveUpdates(_0x479370[_0xb176('0x33')],null);}return _0x1235c2;})[_0xb176('0x1f')](respondWithResult(_0x226f31,null))[_0xb176('0x31')](handleError(_0x226f31,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index c556c32..b39c129 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 _0xd8b0=['define','license','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5929d2,_0x5ae467){var _0x3a30cb=function(_0x5b6107){while(--_0x5b6107){_0x5929d2['push'](_0x5929d2['shift']());}};_0x3a30cb(++_0x5ae467);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./license.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('License',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','license','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4125f9,_0xf7454e){var _0x4f054c=function(_0x1bfe91){while(--_0x1bfe91){_0x4125f9['push'](_0x4125f9['shift']());}};_0x4f054c(++_0xf7454e);}(_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 logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./license.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('License',attributes,{'tableName':_0x0d8b('0x8'),'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 b38aafa..0dbd5d3 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 _0xf089=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','License,\x20%s,\x20%s','message','util','moment','randomstring','ioredis'];(function(_0x5933fb,_0x9115ad){var _0x44d988=function(_0x295228){while(--_0x295228){_0x5933fb['push'](_0x5933fb['shift']());}};_0x44d988(++_0x9115ad);}(_0xf089,0xba));var _0x9f08=function(_0x571020,_0x49edce){_0x571020=_0x571020-0x0;var _0x1a9ef0=_0xf089[_0x571020];return _0x1a9ef0;};'use strict';var _=require('lodash');var util=require(_0x9f08('0x0'));var moment=require(_0x9f08('0x1'));var BPromise=require('bluebird');var rs=require(_0x9f08('0x2'));var fs=require('fs');var Redis=require(_0x9f08('0x3'));var db=require(_0x9f08('0x4'))['db'];var utils=require(_0x9f08('0x5'));var logger=require('../../config/logger')(_0x9f08('0x6'));var config=require(_0x9f08('0x7'));var jayson=require(_0x9f08('0x8'));var client=jayson[_0x9f08('0x9')][_0x9f08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39abe2,_0x5341c9,_0x9cfade){return new BPromise(function(_0x4b37fc,_0x39e238){return client['request'](_0x39abe2,_0x9cfade)[_0x9f08('0xb')](function(_0x286809){logger[_0x9f08('0xc')]('License,\x20%s,\x20%s',_0x5341c9,_0x9f08('0xd'));logger[_0x9f08('0xe')](_0x9f08('0xf'),_0x5341c9,'request\x20sent',JSON['stringify'](_0x286809));if(_0x286809[_0x9f08('0x10')]){if(_0x286809[_0x9f08('0x10')]['code']===0x1f4){logger[_0x9f08('0x10')](_0x9f08('0x11'),_0x5341c9,_0x286809[_0x9f08('0x10')]['message']);return _0x39e238(_0x286809['error'][_0x9f08('0x12')]);}logger[_0x9f08('0x10')](_0x9f08('0x11'),_0x5341c9,_0x286809[_0x9f08('0x10')]['message']);return _0x4b37fc(_0x286809[_0x9f08('0x10')][_0x9f08('0x12')]);}else{logger[_0x9f08('0xc')](_0x9f08('0x11'),_0x5341c9,_0x9f08('0xd'));_0x4b37fc(_0x286809['result'][_0x9f08('0x12')]);}})['catch'](function(_0x5a562c){logger[_0x9f08('0x10')](_0x9f08('0x11'),_0x5341c9,_0x5a562c);_0x39e238(_0x5a562c);});});} \ No newline at end of file +var _0x7d13=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','util','bluebird'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7d13,0x6c));var _0x37d1=function(_0x4505cb,_0x135d7d){_0x4505cb=_0x4505cb-0x0;var _0x188f78=_0x7d13[_0x4505cb];return _0x188f78;};'use strict';var _=require('lodash');var util=require(_0x37d1('0x0'));var moment=require('moment');var BPromise=require(_0x37d1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37d1('0x2'));var db=require(_0x37d1('0x3'))['db'];var utils=require(_0x37d1('0x4'));var logger=require(_0x37d1('0x5'))(_0x37d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x37d1('0x7'));var client=jayson[_0x37d1('0x8')][_0x37d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27ac1d,_0x5146e3,_0x9302bd){return new BPromise(function(_0x41dfaa,_0x115eca){return client[_0x37d1('0xa')](_0x27ac1d,_0x9302bd)[_0x37d1('0xb')](function(_0x636359){logger[_0x37d1('0xc')]('License,\x20%s,\x20%s',_0x5146e3,'request\x20sent');logger[_0x37d1('0xd')](_0x37d1('0xe'),_0x5146e3,'request\x20sent',JSON[_0x37d1('0xf')](_0x636359));if(_0x636359[_0x37d1('0x10')]){if(_0x636359[_0x37d1('0x10')][_0x37d1('0x11')]===0x1f4){logger[_0x37d1('0x10')](_0x37d1('0x12'),_0x5146e3,_0x636359[_0x37d1('0x10')][_0x37d1('0x13')]);return _0x115eca(_0x636359['error'][_0x37d1('0x13')]);}logger[_0x37d1('0x10')]('License,\x20%s,\x20%s',_0x5146e3,_0x636359[_0x37d1('0x10')][_0x37d1('0x13')]);return _0x41dfaa(_0x636359['error'][_0x37d1('0x13')]);}else{logger[_0x37d1('0xc')]('License,\x20%s,\x20%s',_0x5146e3,'request\x20sent');_0x41dfaa(_0x636359[_0x37d1('0x14')][_0x37d1('0x13')]);}})[_0x37d1('0x15')](function(_0x5ded71){logger[_0x37d1('0x10')](_0x37d1('0x12'),_0x5146e3,_0x5ded71);_0x115eca(_0x5ded71);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index f777377..6915e43 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 _0x3062=['addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeImap','removeSmtp','destroy','removeAgents','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','post','addDisposition','create','addImap','/:id/out_servers'];(function(_0x34d5b0,_0x14c0e5){var _0x3a2e01=function(_0x44e6f4){while(--_0x44e6f4){_0x34d5b0['push'](_0x34d5b0['shift']());}};_0x3a2e01(++_0x14c0e5);}(_0x3062,0x133));var _0x2306=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0x3062[_0x427d3a];return _0xe5c521;};'use strict';var multer=require('multer');var util=require(_0x2306('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2306('0x1'));var router=express[_0x2306('0x2')]();var auth=require(_0x2306('0x3'));var interaction=require(_0x2306('0x4'));var config=require(_0x2306('0x5'));var controller=require(_0x2306('0x6'));router[_0x2306('0x7')]('/',auth[_0x2306('0x8')](),controller[_0x2306('0x9')]);router[_0x2306('0x7')](_0x2306('0xa'),auth[_0x2306('0x8')](),controller[_0x2306('0xb')]);router[_0x2306('0x7')](_0x2306('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2306('0x7')](_0x2306('0xd'),auth[_0x2306('0x8')](),controller[_0x2306('0xe')]);router[_0x2306('0x7')](_0x2306('0xf'),auth[_0x2306('0x8')](),controller['getAnswers']);router[_0x2306('0x7')](_0x2306('0x10'),auth[_0x2306('0x8')](),controller[_0x2306('0x11')]);router[_0x2306('0x7')]('/:id/out_servers',auth[_0x2306('0x8')](),controller['getSmtp']);router[_0x2306('0x7')]('/:id/interactions',auth[_0x2306('0x8')](),controller['getInteractions']);router[_0x2306('0x7')](_0x2306('0x12'),auth[_0x2306('0x8')](),controller[_0x2306('0x13')]);router[_0x2306('0x7')](_0x2306('0x14'),auth[_0x2306('0x8')](),controller[_0x2306('0x15')]);router[_0x2306('0x7')]('/:id/verify',auth[_0x2306('0x8')](),controller[_0x2306('0x16')]);router[_0x2306('0x7')](_0x2306('0x17'),auth[_0x2306('0x8')](),controller['getAgents']);router[_0x2306('0x18')](_0x2306('0xd'),auth['isAuthenticated'](),controller[_0x2306('0x19')]);router[_0x2306('0x18')](_0x2306('0xf'),auth[_0x2306('0x8')](),controller['addAnswer']);router['post']('/',auth[_0x2306('0x8')](),controller[_0x2306('0x1a')]);router[_0x2306('0x18')](_0x2306('0x10'),auth[_0x2306('0x8')](),controller[_0x2306('0x1b')]);router[_0x2306('0x18')](_0x2306('0x1c'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x2306('0x18')]('/:id/interactions',auth[_0x2306('0x8')](),controller['addInteraction']);router[_0x2306('0x18')](_0x2306('0x12'),auth[_0x2306('0x8')](),controller[_0x2306('0x1d')]);router[_0x2306('0x18')](_0x2306('0x1e'),auth[_0x2306('0x8')](),controller[_0x2306('0x1f')]);router[_0x2306('0x18')](_0x2306('0x17'),auth[_0x2306('0x8')](),controller[_0x2306('0x20')]);router[_0x2306('0x21')](_0x2306('0xc'),auth['isAuthenticated'](),controller[_0x2306('0x22')]);router[_0x2306('0x23')](_0x2306('0xd'),auth[_0x2306('0x8')](),controller[_0x2306('0x24')]);router[_0x2306('0x23')](_0x2306('0xf'),auth[_0x2306('0x8')](),controller['removeAnswers']);router[_0x2306('0x23')](_0x2306('0x10'),auth[_0x2306('0x8')](),controller[_0x2306('0x25')]);router[_0x2306('0x23')](_0x2306('0x1c'),auth[_0x2306('0x8')](),controller[_0x2306('0x26')]);router[_0x2306('0x23')](_0x2306('0xc'),auth[_0x2306('0x8')](),controller[_0x2306('0x27')]);router['delete'](_0x2306('0x17'),auth[_0x2306('0x8')](),controller[_0x2306('0x28')]);module[_0x2306('0x29')]=router; \ No newline at end of file +var _0x0190=['addAnswer','create','addImap','addSmtp','addInteraction','addApplications','send','addAgents','put','delete','removeAnswers','removeImap','removeSmtp','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./mailAccount.controller','index','get','/describe','isAuthenticated','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x0190,0x117));var _0x0019=function(_0x2aff36,_0x5df719){_0x2aff36=_0x2aff36-0x0;var _0x3b336d=_0x0190[_0x2aff36];return _0x3b336d;};'use strict';var multer=require('multer');var util=require(_0x0019('0x0'));var path=require(_0x0019('0x1'));var timeout=require(_0x0019('0x2'));var express=require(_0x0019('0x3'));var router=express[_0x0019('0x4')]();var auth=require(_0x0019('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0019('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0019('0x7')]);router[_0x0019('0x8')](_0x0019('0x9'),auth[_0x0019('0xa')](),controller['describe']);router[_0x0019('0x8')](_0x0019('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x0019('0x8')](_0x0019('0xc'),auth['isAuthenticated'](),controller[_0x0019('0xd')]);router['get'](_0x0019('0xe'),auth['isAuthenticated'](),controller[_0x0019('0xf')]);router[_0x0019('0x8')](_0x0019('0x10'),auth[_0x0019('0xa')](),controller['getImap']);router[_0x0019('0x8')](_0x0019('0x11'),auth[_0x0019('0xa')](),controller[_0x0019('0x12')]);router[_0x0019('0x8')](_0x0019('0x13'),auth[_0x0019('0xa')](),controller['getInteractions']);router[_0x0019('0x8')](_0x0019('0x14'),auth['isAuthenticated'](),controller[_0x0019('0x15')]);router['get'](_0x0019('0x16'),auth[_0x0019('0xa')](),controller['getMessages']);router[_0x0019('0x8')](_0x0019('0x17'),auth['isAuthenticated'](),controller[_0x0019('0x18')]);router[_0x0019('0x8')](_0x0019('0x19'),auth[_0x0019('0xa')](),controller[_0x0019('0x1a')]);router[_0x0019('0x1b')](_0x0019('0xc'),auth['isAuthenticated'](),controller[_0x0019('0x1c')]);router[_0x0019('0x1b')](_0x0019('0xe'),auth[_0x0019('0xa')](),controller[_0x0019('0x1d')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0019('0x1e')]);router['post'](_0x0019('0x10'),auth[_0x0019('0xa')](),controller[_0x0019('0x1f')]);router[_0x0019('0x1b')](_0x0019('0x11'),auth[_0x0019('0xa')](),controller[_0x0019('0x20')]);router[_0x0019('0x1b')](_0x0019('0x13'),auth[_0x0019('0xa')](),controller[_0x0019('0x21')]);router[_0x0019('0x1b')](_0x0019('0x14'),auth[_0x0019('0xa')](),controller[_0x0019('0x22')]);router[_0x0019('0x1b')]('/:id/send',auth[_0x0019('0xa')](),controller[_0x0019('0x23')]);router[_0x0019('0x1b')](_0x0019('0x19'),auth['isAuthenticated'](),controller[_0x0019('0x24')]);router[_0x0019('0x25')]('/:id',auth[_0x0019('0xa')](),controller['update']);router['delete'](_0x0019('0xc'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x0019('0x26')](_0x0019('0xe'),auth['isAuthenticated'](),controller[_0x0019('0x27')]);router[_0x0019('0x26')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x0019('0x28')]);router[_0x0019('0x26')](_0x0019('0x11'),auth[_0x0019('0xa')](),controller[_0x0019('0x29')]);router[_0x0019('0x26')]('/:id',auth[_0x0019('0xa')](),controller[_0x0019('0x2a')]);router[_0x0019('0x26')](_0x0019('0x19'),auth[_0x0019('0xa')](),controller['removeAgents']);module[_0x0019('0x2b')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index cafdd93..b4c6bb1 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 _0xf9e6=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf9e6,0x7b));var _0x6f9e=function(_0x32f539,_0x51efdb){_0x32f539=_0x32f539-0x0;var _0x1867ab=_0xf9e6[_0x32f539];return _0x1867ab;};'use strict';var Sequelize=require(_0x6f9e('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x6f9e('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x6f9e('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x6f9e('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x6f9e('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x6f9e('0x3')]},'markAsUnread':{'type':Sequelize[_0x6f9e('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6f9e('0x1')],'allowNull':![],'defaultValue':_0x6f9e('0x4')},'fontSize':{'type':Sequelize[_0x6f9e('0x5')](0x2)[_0x6f9e('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x6f9e('0x3')],'defaultValue':function(){return _0x6f9e('0x7');}},'notificationSound':{'type':Sequelize[_0x6f9e('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6f9e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6f9e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6f9e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6f9e('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x6f9e('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6f9e('0x2')],'defaultValue':![],'comment':_0x6f9e('0x9'),'set':function(_0x590075){if(!_0x590075)this[_0x6f9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x6f9e('0xa')]('mandatoryDisposition',_0x590075);}}}; \ No newline at end of file +var _0xb23d=['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}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x4b14bb,_0xe7b4d3){var _0x285200=function(_0x48c1d7){while(--_0x48c1d7){_0x4b14bb['push'](_0x4b14bb['shift']());}};_0x285200(++_0xe7b4d3);}(_0xb23d,0x10b));var _0xdb23=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xb23d[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require(_0xdb23('0x0'));module['exports']={'description':{'type':Sequelize[_0xdb23('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xdb23('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xdb23('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xdb23('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xdb23('0x1')],'allowNull':![],'defaultValue':_0xdb23('0x3')},'fontSize':{'type':Sequelize[_0xdb23('0x4')](0x2)[_0xdb23('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdb23('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdb23('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdb23('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdb23('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdb23('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdb23('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xdb23('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xdb23('0x2')],'defaultValue':![],'comment':_0xdb23('0x8'),'set':function(_0x5d4f96){if(!_0x5d4f96)this[_0xdb23('0x9')]('mandatoryDispositionPauseId',null);this[_0xdb23('0x9')](_0xdb23('0xa'),_0x5d4f96);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index f79e949..ceddf5a 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 _0xfb51=['getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','addApplications','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','CmContact','Contacts','updatedAt','DESC','from','%s\x20<%s>','email','attachments','join','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','MailAccounts','destroy','name','send','index','MailServerIn','Pause','map','MailAccount','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','includeAll','include','rows','show','MailServerOut','Smtp','mandatoryDispositionPause','find','body','params','Imap','describe','addDisposition','MailAccountId','Disposition','getDispositions','rawAttributes','length','filter','ids','CannedAnswer','create','getAnswers','findOne','findAll','removeAnswers','isNil','active','description','cservice','cauthentication','user','password','pass','authentication','host','port','service','cuser','cpassword','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','removeSmtp','addInteraction','MailInteraction','omit'];(function(_0x270457,_0x5f0a64){var _0xea82bc=function(_0xfb7dfc){while(--_0xfb7dfc){_0x270457['push'](_0x270457['shift']());}};_0xea82bc(++_0x5f0a64);}(_0xfb51,0xf5));var _0x1fb5=function(_0xd73239,_0x488346){_0xd73239=_0xd73239-0x0;var _0x41cee6=_0xfb51[_0xd73239];return _0x41cee6;};'use strict';var pdf=require(_0x1fb5('0x0'));var emlformat=require(_0x1fb5('0x1'));var rimraf=require(_0x1fb5('0x2'));var zipdir=require(_0x1fb5('0x3'));var jsonpatch=require(_0x1fb5('0x4'));var rp=require(_0x1fb5('0x5'));var moment=require(_0x1fb5('0x6'));var BPromise=require(_0x1fb5('0x7'));var Mustache=require(_0x1fb5('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1fb5('0x9'));var ejs=require(_0x1fb5('0xa'));var fs=require('fs');var _=require(_0x1fb5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1fb5('0xc'));var deskjs=require(_0x1fb5('0xd'));var toCsv=require(_0x1fb5('0x9'));var querystring=require(_0x1fb5('0xe'));var Papa=require(_0x1fb5('0xf'));var Redis=require('ioredis');var authService=require(_0x1fb5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1fb5('0x11'));var hardwareService=require(_0x1fb5('0x12'));var logger=require(_0x1fb5('0x13'))(_0x1fb5('0x14'));var utils=require(_0x1fb5('0x15'));var config=require(_0x1fb5('0x16'));var db=require(_0x1fb5('0x17'))['db'];config[_0x1fb5('0x18')]=_[_0x1fb5('0x19')](config['redis'],{'host':_0x1fb5('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1fb5('0x18')]));require('./mailAccount.socket')[_0x1fb5('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1fb5('0x1c')][_0x1fb5('0x1d')]({'port':0x232b});function checkPasswordPattern(_0x1c9cc8,_0x32f236,_0x46357b){if(_0x46357b){var _0x588f8e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x588f8e[_0x1fb5('0x1e')](_0x32f236)){return _0x1c9cc8;}else{throw new db[(_0x1fb5('0x1f'))]['ValidationError'](_0x1fb5('0x20'));}}else{return _0x1c9cc8;}}function respondWithRpcPromise(_0x261418,_0x5df8e4,_0x349fe1,_0x3d520b){return new BPromise(function(_0x1fea62,_0x4465b7){var _0xf673d1=_0x3d520b||client;return _0xf673d1[_0x1fb5('0x21')](_0x261418,_0x349fe1)[_0x1fb5('0x22')](function(_0x110f49){logger[_0x1fb5('0x23')](_0x1fb5('0x24'),_0x5df8e4,'request\x20sent');logger[_0x1fb5('0x25')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5df8e4,_0x1fb5('0x26'),JSON[_0x1fb5('0x27')](_0x110f49));if(_0x110f49[_0x1fb5('0x28')]){if(_0x110f49[_0x1fb5('0x28')][_0x1fb5('0x29')]===0x1f4){logger[_0x1fb5('0x28')](_0x1fb5('0x24'),_0x5df8e4,_0x110f49[_0x1fb5('0x28')]['message']);return _0x4465b7(_0x110f49[_0x1fb5('0x28')][_0x1fb5('0x2a')]);}logger[_0x1fb5('0x28')]('MailAccount,\x20%s,\x20%s',_0x5df8e4,_0x110f49['error'][_0x1fb5('0x2a')]);return _0x1fea62(_0x110f49[_0x1fb5('0x28')][_0x1fb5('0x2a')]);}else{logger[_0x1fb5('0x23')](_0x1fb5('0x24'),_0x5df8e4,_0x1fb5('0x26'));_0x1fea62(_0x110f49[_0x1fb5('0x2b')]['message']);}})[_0x1fb5('0x2c')](function(_0x1b8d02){logger[_0x1fb5('0x28')](_0x1fb5('0x24'),_0x5df8e4,_0x1b8d02);_0x4465b7(_0x1b8d02);});});}function respondWithStatusCode(_0x542c06,_0x2fa29e){_0x2fa29e=_0x2fa29e||0xcc;return function(_0x5b1f53){if(_0x5b1f53){return _0x542c06[_0x1fb5('0x2d')](_0x2fa29e);}return _0x542c06[_0x1fb5('0x2e')](_0x2fa29e)[_0x1fb5('0x2f')]();};}function respondWithResult(_0x50f4fe,_0x36ceda){_0x36ceda=_0x36ceda||0xc8;return function(_0x36be0e){if(_0x36be0e){return _0x50f4fe[_0x1fb5('0x2e')](_0x36ceda)[_0x1fb5('0x30')](_0x36be0e);}};}function respondWithFilteredResult(_0x17c7ad,_0x2ba787){return function(_0x1d74d4){if(_0x1d74d4){var _0x362395=_0x1d74d4[_0x1fb5('0x31')],_0x6c9346=_0x2ba787[_0x1fb5('0x32')],_0xfc928f=_0x2ba787[_0x1fb5('0x32')]+_0x2ba787['limit'],_0xdca460;if(_0xfc928f>=_0x362395){_0xfc928f=_0x362395;_0xdca460=0xc8;}else{_0xdca460=0xce;}_0x17c7ad['status'](_0xdca460);return _0x17c7ad[_0x1fb5('0x33')](_0x1fb5('0x34'),_0x6c9346+'-'+_0xfc928f+'/'+_0x362395)[_0x1fb5('0x30')](_0x1d74d4);}return null;};}function patchUpdates(_0x4ca038){return function(_0x381f7b){try{jsonpatch['apply'](_0x381f7b,_0x4ca038,!![]);}catch(_0x2800b7){return BPromise['reject'](_0x2800b7);}return _0x381f7b[_0x1fb5('0x35')]();};}function saveUpdates(_0x307771,_0x4df561){return function(_0x2d09f0){if(_0x2d09f0){return _0x2d09f0[_0x1fb5('0x36')](_0x307771)[_0x1fb5('0x22')](function(_0x53efe7){return _0x53efe7;});}return null;};}function removeEntity(_0x1e067e,_0x34e63d){return function(_0x46636c){if(_0x46636c){return _0x46636c['destroy']()['then'](function(){var _0x16c01e=_0x46636c['get']({'plain':!![]});var _0x37488b=_0x1fb5('0x37');return db['UserProfileResource'][_0x1fb5('0x38')]({'where':{'type':_0x37488b,'resourceId':_0x16c01e['id']}})[_0x1fb5('0x22')](function(){return _0x46636c;});})[_0x1fb5('0x22')](function(){_0x1e067e[_0x1fb5('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b777b,_0x1d0ab5){return function(_0xf39653){if(!_0xf39653){_0x4b777b[_0x1fb5('0x2d')](0x194);}return _0xf39653;};}function handleError(_0x2d4e97,_0x37e255){_0x37e255=_0x37e255||0x1f4;return function(_0x26b57e){logger[_0x1fb5('0x28')](_0x26b57e['stack']);if(_0x26b57e['name']){delete _0x26b57e[_0x1fb5('0x39')];}_0x2d4e97[_0x1fb5('0x2e')](_0x37e255)[_0x1fb5('0x3a')](_0x26b57e);};}exports[_0x1fb5('0x3b')]=function(_0x30f71f,_0x54c65e){var _0x42716c={'include':[{'model':db[_0x1fb5('0x3c')],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x1fb5('0x3d')],'as':'mandatoryDispositionPause'}]},_0x22b44f={},_0x206f94={'count':0x0,'rows':[]};var _0x2a258a=_[_0x1fb5('0x3e')](db[_0x1fb5('0x3f')]['rawAttributes'],function(_0x1fc332){return{'name':_0x1fc332['fieldName'],'type':_0x1fc332[_0x1fb5('0x40')][_0x1fb5('0x41')]};});_0x22b44f[_0x1fb5('0x42')]=_[_0x1fb5('0x3e')](_0x2a258a,_0x1fb5('0x39'));_0x22b44f[_0x1fb5('0x43')]=_[_0x1fb5('0x44')](_0x30f71f[_0x1fb5('0x43')]);_0x22b44f[_0x1fb5('0x45')]=_[_0x1fb5('0x46')](_0x22b44f[_0x1fb5('0x42')],_0x22b44f['query']);_0x42716c[_0x1fb5('0x47')]=_[_0x1fb5('0x46')](_0x22b44f[_0x1fb5('0x42')],qs[_0x1fb5('0x48')](_0x30f71f[_0x1fb5('0x43')]['fields']));_0x42716c[_0x1fb5('0x47')]=_0x42716c[_0x1fb5('0x47')]['length']?_0x42716c[_0x1fb5('0x47')]:_0x22b44f[_0x1fb5('0x42')];if(!_0x30f71f[_0x1fb5('0x43')][_0x1fb5('0x49')](_0x1fb5('0x4a'))){_0x42716c[_0x1fb5('0x4b')]=qs['limit'](_0x30f71f[_0x1fb5('0x43')][_0x1fb5('0x4b')]);_0x42716c[_0x1fb5('0x32')]=qs[_0x1fb5('0x32')](_0x30f71f[_0x1fb5('0x43')][_0x1fb5('0x32')]);}_0x42716c[_0x1fb5('0x4c')]=qs[_0x1fb5('0x4d')](_0x30f71f[_0x1fb5('0x43')][_0x1fb5('0x4d')]);_0x42716c[_0x1fb5('0x4e')]=qs[_0x1fb5('0x45')](_[_0x1fb5('0x4f')](_0x30f71f[_0x1fb5('0x43')],_0x22b44f[_0x1fb5('0x45')]),_0x2a258a);if(_0x30f71f[_0x1fb5('0x43')]['filter']){_0x42716c['where']=_['merge'](_0x42716c[_0x1fb5('0x4e')],{'$or':_[_0x1fb5('0x3e')](_0x2a258a,function(_0x2c95d1){if(_0x2c95d1[_0x1fb5('0x40')]!=='VIRTUAL'){var _0x524bd0={};_0x524bd0[_0x2c95d1[_0x1fb5('0x39')]]={'$like':'%'+_0x30f71f[_0x1fb5('0x43')]['filter']+'%'};return _0x524bd0;}})});}_0x42716c=_[_0x1fb5('0x50')]({},_0x42716c,_0x30f71f[_0x1fb5('0x51')]);var _0x23dff6={'where':_0x42716c[_0x1fb5('0x4e')]};return db['MailAccount'][_0x1fb5('0x31')](_0x23dff6)[_0x1fb5('0x22')](function(_0x46b5c7){_0x206f94[_0x1fb5('0x31')]=_0x46b5c7;if(_0x30f71f[_0x1fb5('0x43')][_0x1fb5('0x52')]){_0x42716c[_0x1fb5('0x53')]=[{'all':!![]}];}return db[_0x1fb5('0x3f')]['findAll'](_0x42716c);})[_0x1fb5('0x22')](function(_0x2a937f){_0x206f94[_0x1fb5('0x54')]=_0x2a937f;return _0x206f94;})[_0x1fb5('0x22')](respondWithFilteredResult(_0x54c65e,_0x42716c))[_0x1fb5('0x2c')](handleError(_0x54c65e,null));};exports[_0x1fb5('0x55')]=function(_0x45f496,_0x4003d9){var _0x74a7f7={'raw':![],'where':{'id':_0x45f496['params']['id']},'include':[{'model':db[_0x1fb5('0x3c')],'as':'Imap'},{'model':db[_0x1fb5('0x56')],'as':_0x1fb5('0x57')},{'model':db[_0x1fb5('0x3d')],'as':_0x1fb5('0x58')}]},_0x2095d8={};_0x2095d8[_0x1fb5('0x42')]=_[_0x1fb5('0x44')](db[_0x1fb5('0x3f')]['rawAttributes']);_0x2095d8[_0x1fb5('0x43')]=_[_0x1fb5('0x44')](_0x45f496[_0x1fb5('0x43')]);_0x2095d8['filters']=_[_0x1fb5('0x46')](_0x2095d8[_0x1fb5('0x42')],_0x2095d8['query']);_0x74a7f7[_0x1fb5('0x47')]=_[_0x1fb5('0x46')](_0x2095d8[_0x1fb5('0x42')],qs[_0x1fb5('0x48')](_0x45f496[_0x1fb5('0x43')]['fields']));_0x74a7f7['attributes']=_0x74a7f7[_0x1fb5('0x47')]['length']?_0x74a7f7['attributes']:_0x2095d8[_0x1fb5('0x42')];if(_0x45f496['query'][_0x1fb5('0x52')]){_0x74a7f7['include']=[{'all':!![]}];}_0x74a7f7=_[_0x1fb5('0x50')]({},_0x74a7f7,_0x45f496[_0x1fb5('0x51')]);return db[_0x1fb5('0x3f')][_0x1fb5('0x59')](_0x74a7f7)[_0x1fb5('0x22')](handleEntityNotFound(_0x4003d9,null))[_0x1fb5('0x22')](respondWithResult(_0x4003d9,null))[_0x1fb5('0x2c')](handleError(_0x4003d9,null));};exports['update']=function(_0x472ff1,_0x32d794){if(_0x472ff1[_0x1fb5('0x5a')]['id']){delete _0x472ff1[_0x1fb5('0x5a')]['id'];}return db[_0x1fb5('0x3f')]['find']({'where':{'id':_0x472ff1[_0x1fb5('0x5b')]['id']},'include':[{'model':db[_0x1fb5('0x3c')],'as':_0x1fb5('0x5c')},{'model':db[_0x1fb5('0x56')],'as':_0x1fb5('0x57')},{'model':db['Pause'],'as':_0x1fb5('0x58')}]})[_0x1fb5('0x22')](handleEntityNotFound(_0x32d794,null))[_0x1fb5('0x22')](saveUpdates(_0x472ff1[_0x1fb5('0x5a')],null))[_0x1fb5('0x22')](function(_0x481629){if(_0x481629&&_0x472ff1[_0x1fb5('0x5a')][_0x1fb5('0x5c')]){return db[_0x1fb5('0x3c')]['update'](_0x472ff1[_0x1fb5('0x5a')][_0x1fb5('0x5c')],{'where':{'MailAccountId':_0x481629['id']}})['then'](function(){return _0x481629;});}return _0x481629;})[_0x1fb5('0x22')](function(_0xd15f5f){if(_0xd15f5f&&_0x472ff1[_0x1fb5('0x5a')][_0x1fb5('0x57')]){return db['MailServerOut'][_0x1fb5('0x36')](_0x472ff1[_0x1fb5('0x5a')][_0x1fb5('0x57')],{'where':{'MailAccountId':_0xd15f5f['id']}})[_0x1fb5('0x22')](function(){return _0xd15f5f;});}return _0xd15f5f;})[_0x1fb5('0x22')](respondWithResult(_0x32d794,null))['catch'](handleError(_0x32d794,null));};exports[_0x1fb5('0x5d')]=function(_0x1f1c9d,_0x2ed426){return db['MailAccount'][_0x1fb5('0x5d')]()['then'](respondWithResult(_0x2ed426,null))[_0x1fb5('0x2c')](handleError(_0x2ed426,null));};exports[_0x1fb5('0x5e')]=function(_0x156ed3,_0x232769,_0x959140){if(_0x156ed3[_0x1fb5('0x5a')]['id']){delete _0x156ed3[_0x1fb5('0x5a')]['id'];}return db['MailAccount'][_0x1fb5('0x59')]({'where':{'id':_0x156ed3['params']['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0x232769,null))[_0x1fb5('0x22')](function(_0x48ae1f){if(_0x48ae1f){_0x156ed3[_0x1fb5('0x5a')][_0x1fb5('0x5f')]=_0x48ae1f['id'];return db[_0x1fb5('0x60')]['create'](_0x156ed3[_0x1fb5('0x5a')]);}})['then'](respondWithResult(_0x232769,null))[_0x1fb5('0x2c')](handleError(_0x232769,null));};exports[_0x1fb5('0x61')]=function(_0xe791fb,_0x498d37,_0x3dbf07){var _0x19e86d={'raw':![],'where':{}};var _0x567d49={};var _0x2ba4e7={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0xe791fb[_0x1fb5('0x5b')]['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0x498d37,null))[_0x1fb5('0x22')](function(_0x14d367){if(_0x14d367){_0x567d49[_0x1fb5('0x42')]=_['keys'](db[_0x1fb5('0x60')][_0x1fb5('0x62')]);_0x567d49[_0x1fb5('0x43')]=_['keys'](_0xe791fb['query']);_0x567d49[_0x1fb5('0x45')]=_[_0x1fb5('0x46')](_0x567d49[_0x1fb5('0x42')],_0x567d49[_0x1fb5('0x43')]);_0x19e86d[_0x1fb5('0x47')]=_['intersection'](_0x567d49[_0x1fb5('0x42')],qs[_0x1fb5('0x48')](_0xe791fb[_0x1fb5('0x43')][_0x1fb5('0x48')]));_0x19e86d[_0x1fb5('0x47')]=_0x19e86d[_0x1fb5('0x47')][_0x1fb5('0x63')]?_0x19e86d[_0x1fb5('0x47')]:_0x567d49[_0x1fb5('0x42')];if(!_0xe791fb[_0x1fb5('0x43')][_0x1fb5('0x49')](_0x1fb5('0x4a'))){_0x19e86d[_0x1fb5('0x4b')]=qs[_0x1fb5('0x4b')](_0xe791fb[_0x1fb5('0x43')][_0x1fb5('0x4b')]);_0x19e86d[_0x1fb5('0x32')]=qs[_0x1fb5('0x32')](_0xe791fb[_0x1fb5('0x43')][_0x1fb5('0x32')]);}_0x19e86d[_0x1fb5('0x4c')]=qs[_0x1fb5('0x4d')](_0xe791fb[_0x1fb5('0x43')][_0x1fb5('0x4d')]);_0x19e86d[_0x1fb5('0x4e')]=qs['filters'](_['pick'](_0xe791fb[_0x1fb5('0x43')],_0x567d49[_0x1fb5('0x45')]));_0x19e86d['where'][_0x1fb5('0x5f')]=_0x14d367['id'];if(_0xe791fb[_0x1fb5('0x43')][_0x1fb5('0x64')]){_0x19e86d[_0x1fb5('0x4e')]=_[_0x1fb5('0x50')](_0x19e86d[_0x1fb5('0x4e')],{'$or':_[_0x1fb5('0x3e')](_0x19e86d[_0x1fb5('0x47')],function(_0x143591){var _0x1c58c6={};_0x1c58c6[_0x143591]={'$like':'%'+_0xe791fb['query'][_0x1fb5('0x64')]+'%'};return _0x1c58c6;})});}_0x19e86d=_[_0x1fb5('0x50')]({},_0x19e86d,_0xe791fb[_0x1fb5('0x51')]);return db[_0x1fb5('0x60')][_0x1fb5('0x31')]({'where':_0x19e86d[_0x1fb5('0x4e')]})[_0x1fb5('0x22')](function(_0x11b059){_0x2ba4e7[_0x1fb5('0x31')]=_0x11b059;if(_0xe791fb[_0x1fb5('0x43')][_0x1fb5('0x52')]){_0x19e86d[_0x1fb5('0x53')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x19e86d);})[_0x1fb5('0x22')](function(_0x4ddc7f){_0x2ba4e7[_0x1fb5('0x54')]=_0x4ddc7f;return _0x2ba4e7;});}})[_0x1fb5('0x22')](respondWithFilteredResult(_0x498d37,_0x19e86d))[_0x1fb5('0x2c')](handleError(_0x498d37,null));};exports['removeDispositions']=function(_0x226d9d,_0x3fac28,_0x5b1e8b){return db[_0x1fb5('0x3f')]['find']({'where':{'id':_0x226d9d[_0x1fb5('0x5b')]['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0x3fac28,null))[_0x1fb5('0x22')](function(_0x9f7292){if(_0x9f7292){return _0x9f7292['removeDispositions'](_0x226d9d['query'][_0x1fb5('0x65')]);}})[_0x1fb5('0x22')](respondWithStatusCode(_0x3fac28,null))[_0x1fb5('0x2c')](handleError(_0x3fac28,null));};exports['addAnswer']=function(_0xb1cfe5,_0x22adb7,_0x4df97d){if(_0xb1cfe5['body']['id']){delete _0xb1cfe5[_0x1fb5('0x5a')]['id'];}return db[_0x1fb5('0x3f')][_0x1fb5('0x59')]({'where':{'id':_0xb1cfe5[_0x1fb5('0x5b')]['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0x22adb7,null))[_0x1fb5('0x22')](function(_0xf92fcd){if(_0xf92fcd){_0xb1cfe5['body']['MailAccountId']=_0xf92fcd['id'];return db[_0x1fb5('0x66')][_0x1fb5('0x67')](_0xb1cfe5[_0x1fb5('0x5a')]);}})['then'](respondWithResult(_0x22adb7,null))[_0x1fb5('0x2c')](handleError(_0x22adb7,null));};exports[_0x1fb5('0x68')]=function(_0x4b011c,_0xc4cbd5,_0x248066){var _0x5c320f={'raw':![],'where':{}};var _0x40a416={};var _0x2be7a9={'count':0x0,'rows':[]};return db['MailAccount'][_0x1fb5('0x69')]({'where':{'id':_0x4b011c[_0x1fb5('0x5b')]['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0xc4cbd5,null))['then'](function(_0x5a2b08){if(_0x5a2b08){_0x40a416[_0x1fb5('0x42')]=_['keys'](db[_0x1fb5('0x66')][_0x1fb5('0x62')]);_0x40a416[_0x1fb5('0x43')]=_[_0x1fb5('0x44')](_0x4b011c[_0x1fb5('0x43')]);_0x40a416['filters']=_[_0x1fb5('0x46')](_0x40a416[_0x1fb5('0x42')],_0x40a416[_0x1fb5('0x43')]);_0x5c320f['attributes']=_[_0x1fb5('0x46')](_0x40a416['model'],qs[_0x1fb5('0x48')](_0x4b011c['query'][_0x1fb5('0x48')]));_0x5c320f[_0x1fb5('0x47')]=_0x5c320f['attributes']['length']?_0x5c320f[_0x1fb5('0x47')]:_0x40a416[_0x1fb5('0x42')];if(!_0x4b011c[_0x1fb5('0x43')]['hasOwnProperty'](_0x1fb5('0x4a'))){_0x5c320f[_0x1fb5('0x4b')]=qs['limit'](_0x4b011c[_0x1fb5('0x43')][_0x1fb5('0x4b')]);_0x5c320f[_0x1fb5('0x32')]=qs[_0x1fb5('0x32')](_0x4b011c['query'][_0x1fb5('0x32')]);}_0x5c320f['order']=qs[_0x1fb5('0x4d')](_0x4b011c[_0x1fb5('0x43')][_0x1fb5('0x4d')]);_0x5c320f[_0x1fb5('0x4e')]=qs['filters'](_[_0x1fb5('0x4f')](_0x4b011c[_0x1fb5('0x43')],_0x40a416[_0x1fb5('0x45')]));_0x5c320f['where']['MailAccountId']=_0x5a2b08['id'];if(_0x4b011c[_0x1fb5('0x43')][_0x1fb5('0x64')]){_0x5c320f['where']=_[_0x1fb5('0x50')](_0x5c320f['where'],{'$or':_[_0x1fb5('0x3e')](_0x5c320f[_0x1fb5('0x47')],function(_0x3e1b3b){var _0x57ffaf={};_0x57ffaf[_0x3e1b3b]={'$like':'%'+_0x4b011c[_0x1fb5('0x43')]['filter']+'%'};return _0x57ffaf;})});}_0x5c320f=_[_0x1fb5('0x50')]({},_0x5c320f,_0x4b011c[_0x1fb5('0x51')]);return db[_0x1fb5('0x66')][_0x1fb5('0x31')]({'where':_0x5c320f[_0x1fb5('0x4e')]})['then'](function(_0xdc4d7){_0x2be7a9[_0x1fb5('0x31')]=_0xdc4d7;if(_0x4b011c[_0x1fb5('0x43')][_0x1fb5('0x52')]){_0x5c320f[_0x1fb5('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0x1fb5('0x6a')](_0x5c320f);})['then'](function(_0x13cccc){_0x2be7a9[_0x1fb5('0x54')]=_0x13cccc;return _0x2be7a9;});}})[_0x1fb5('0x22')](respondWithFilteredResult(_0xc4cbd5,_0x5c320f))[_0x1fb5('0x2c')](handleError(_0xc4cbd5,null));};exports[_0x1fb5('0x6b')]=function(_0x25afb3,_0xd93885,_0x25200f){return db[_0x1fb5('0x3f')][_0x1fb5('0x59')]({'where':{'id':_0x25afb3[_0x1fb5('0x5b')]['id']}})['then'](handleEntityNotFound(_0xd93885,null))['then'](function(_0x7a3bb0){if(_0x7a3bb0){return _0x7a3bb0[_0x1fb5('0x6b')](_0x25afb3['query'][_0x1fb5('0x65')]);}})[_0x1fb5('0x22')](respondWithStatusCode(_0xd93885,null))[_0x1fb5('0x2c')](handleError(_0xd93885,null));};exports[_0x1fb5('0x67')]=function(_0x4c3b3a,_0x1f0de3){var _0xeb718c={'name':_0x4c3b3a[_0x1fb5('0x5a')][_0x1fb5('0x39')],'key':_0x4c3b3a[_0x1fb5('0x5a')]['key'],'email':_0x4c3b3a['body']['email'],'ListId':_0x4c3b3a[_0x1fb5('0x5a')]['ListId'],'active':!_[_0x1fb5('0x6c')](_0x4c3b3a[_0x1fb5('0x5a')]['active'])?_0x4c3b3a[_0x1fb5('0x5a')][_0x1fb5('0x6d')]:!![],'description':_0x4c3b3a[_0x1fb5('0x5a')][_0x1fb5('0x6e')]||null,'Imap':{},'Smtp':{}};if(_[_0x1fb5('0x6c')](_0x4c3b3a['body'][_0x1fb5('0x6f')])){if(_0x4c3b3a[_0x1fb5('0x5a')][_0x1fb5('0x70')]){_0xeb718c[_0x1fb5('0x5c')]['user']=_0xeb718c[_0x1fb5('0x57')][_0x1fb5('0x71')]=_0x4c3b3a[_0x1fb5('0x5a')]['cuser'];_0xeb718c[_0x1fb5('0x5c')][_0x1fb5('0x72')]=_0xeb718c[_0x1fb5('0x57')][_0x1fb5('0x73')]=_0x4c3b3a[_0x1fb5('0x5a')]['cpassword'];}else{_0xeb718c[_0x1fb5('0x5c')][_0x1fb5('0x74')]=_0xeb718c[_0x1fb5('0x57')][_0x1fb5('0x74')]=![];}_0xeb718c['Imap'][_0x1fb5('0x75')]=_0x4c3b3a[_0x1fb5('0x5a')]['Imap'][_0x1fb5('0x75')];_0xeb718c[_0x1fb5('0x5c')][_0x1fb5('0x76')]=_0x4c3b3a[_0x1fb5('0x5a')][_0x1fb5('0x5c')][_0x1fb5('0x76')];_0xeb718c[_0x1fb5('0x57')]['host']=_0x4c3b3a[_0x1fb5('0x5a')][_0x1fb5('0x57')]['host'];_0xeb718c[_0x1fb5('0x57')][_0x1fb5('0x76')]=_0x4c3b3a[_0x1fb5('0x5a')][_0x1fb5('0x57')][_0x1fb5('0x76')];}else{_0xeb718c[_0x1fb5('0x5c')][_0x1fb5('0x77')]=_0xeb718c[_0x1fb5('0x57')][_0x1fb5('0x77')]=_0x4c3b3a[_0x1fb5('0x5a')]['cservice'];_0xeb718c[_0x1fb5('0x5c')][_0x1fb5('0x71')]=_0xeb718c[_0x1fb5('0x57')][_0x1fb5('0x71')]=_0x4c3b3a['body'][_0x1fb5('0x78')];_0xeb718c[_0x1fb5('0x5c')]['password']=_0xeb718c[_0x1fb5('0x57')]['pass']=_0x4c3b3a[_0x1fb5('0x5a')][_0x1fb5('0x79')];}return db[_0x1fb5('0x3f')][_0x1fb5('0x67')](_0xeb718c,{'include':[{'model':db[_0x1fb5('0x56')],'as':_0x1fb5('0x57')},{'model':db['MailServerIn'],'as':_0x1fb5('0x5c')}]})['then'](function(_0x457d57){var _0x10d6a5=_0x4c3b3a['user'][_0x1fb5('0x7a')]({'plain':!![]});if(!_0x10d6a5)throw new Error(_0x1fb5('0x7b'));if(_0x10d6a5[_0x1fb5('0x7c')]===_0x1fb5('0x71')){var _0x2d3c9b=_0x457d57[_0x1fb5('0x7a')]({'plain':!![]});return db[_0x1fb5('0x7d')]['find']({'where':{'name':_0x1fb5('0x37'),'userProfileId':_0x10d6a5[_0x1fb5('0x7e')]},'raw':!![]})['then'](function(_0xdffcb7){if(_0xdffcb7&&_0xdffcb7[_0x1fb5('0x7f')]===0x0){return db['UserProfileResource'][_0x1fb5('0x67')]({'name':_0x2d3c9b[_0x1fb5('0x39')],'resourceId':_0x2d3c9b['id'],'type':_0xdffcb7[_0x1fb5('0x39')],'sectionId':_0xdffcb7['id']},{})[_0x1fb5('0x22')](function(){return _0x457d57;});}else{return _0x457d57;}})[_0x1fb5('0x2c')](function(_0x1cce86){logger[_0x1fb5('0x28')](_0x1fb5('0x80'),_0x1cce86);throw _0x1cce86;});}return _0x457d57;})[_0x1fb5('0x22')](respondWithResult(_0x1f0de3,0xc9))[_0x1fb5('0x2c')](handleError(_0x1f0de3,null));};exports[_0x1fb5('0x81')]=function(_0x311cad,_0x16b436,_0x6039ad){return db['MailAccount'][_0x1fb5('0x69')]({'where':{'id':_0x311cad[_0x1fb5('0x5b')]['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0x16b436,null))[_0x1fb5('0x22')](function(_0x3529ed){if(_0x3529ed){return _0x3529ed[_0x1fb5('0x81')]();}return null;})[_0x1fb5('0x22')](respondWithResult(_0x16b436,null))['catch'](handleError(_0x16b436,null));};exports[_0x1fb5('0x82')]=function(_0x5c5b18,_0x1f21ba,_0x1e659e){if(_0x5c5b18[_0x1fb5('0x5a')]['id']){delete _0x5c5b18['body']['id'];}return db[_0x1fb5('0x3f')][_0x1fb5('0x59')]({'where':{'id':_0x5c5b18[_0x1fb5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1f21ba,null))[_0x1fb5('0x22')](function(_0xb1b8b9){if(_0xb1b8b9){_0x5c5b18['body'][_0x1fb5('0x5f')]=_0xb1b8b9['id'];return db['MailServerIn'][_0x1fb5('0x67')](_0x5c5b18[_0x1fb5('0x5a')]);}})[_0x1fb5('0x22')](respondWithResult(_0x1f21ba,null))['catch'](handleError(_0x1f21ba,null));};exports['removeImap']=function(_0x309c63,_0x2abc04,_0xc8057f){return db[_0x1fb5('0x3f')]['findOne']({'where':{'id':_0x309c63['params']['id']}})['then'](handleEntityNotFound(_0x2abc04,null))['then'](function(_0x5d7434){if(_0x5d7434){return _0x5d7434[_0x1fb5('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x2abc04,null))[_0x1fb5('0x2c')](handleError(_0x2abc04,null));};exports[_0x1fb5('0x84')]=function(_0x496d67,_0xd3deae,_0xf0e47d){return db[_0x1fb5('0x3f')][_0x1fb5('0x69')]({'where':{'id':_0x496d67[_0x1fb5('0x5b')]['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0xd3deae,null))[_0x1fb5('0x22')](function(_0x5839d4){if(_0x5839d4){return _0x5839d4[_0x1fb5('0x84')]();}return null;})[_0x1fb5('0x22')](respondWithResult(_0xd3deae,null))[_0x1fb5('0x2c')](handleError(_0xd3deae,null));};exports['addSmtp']=function(_0x42f19a,_0x3e8ad5,_0x3e5870){if(_0x42f19a[_0x1fb5('0x5a')]['id']){delete _0x42f19a['body']['id'];}return db[_0x1fb5('0x3f')]['find']({'where':{'id':_0x42f19a[_0x1fb5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3e8ad5,null))[_0x1fb5('0x22')](function(_0x20b0cf){if(_0x20b0cf){_0x42f19a[_0x1fb5('0x5a')][_0x1fb5('0x5f')]=_0x20b0cf['id'];return db['MailServerOut'][_0x1fb5('0x67')](_0x42f19a[_0x1fb5('0x5a')]);}})[_0x1fb5('0x22')](respondWithResult(_0x3e8ad5,null))[_0x1fb5('0x2c')](handleError(_0x3e8ad5,null));};exports[_0x1fb5('0x85')]=function(_0x3fdc1d,_0x22132f,_0x417994){return db[_0x1fb5('0x3f')][_0x1fb5('0x69')]({'where':{'id':_0x3fdc1d[_0x1fb5('0x5b')]['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0x22132f,null))[_0x1fb5('0x22')](function(_0x558f0f){if(_0x558f0f){return _0x558f0f['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x22132f,null))['catch'](handleError(_0x22132f,null));};exports[_0x1fb5('0x86')]=function(_0x13b012,_0x12d838,_0x5a86a7){return db[_0x1fb5('0x87')][_0x1fb5('0x59')]({'where':{'id':_0x13b012[_0x1fb5('0x5b')]['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0x12d838,null))[_0x1fb5('0x22')](function(_0x263c15){if(_0x263c15){return _0x263c15['addInteraction'](_0x13b012[_0x1fb5('0x5a')][_0x1fb5('0x65')],_[_0x1fb5('0x88')](_0x13b012[_0x1fb5('0x5a')],[_0x1fb5('0x65'),'id'])||{});}})[_0x1fb5('0x22')](respondWithResult(_0x12d838,null))['catch'](handleError(_0x12d838,null));};exports[_0x1fb5('0x89')]=function(_0x1da5cd,_0x39d746,_0x27018d){var _0x83957d={'raw':![],'where':{}};var _0x2c373a={};var _0x14b06c={'count':0x0,'rows':[]};return db[_0x1fb5('0x3f')][_0x1fb5('0x69')]({'where':{'id':_0x1da5cd[_0x1fb5('0x5b')]['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0x39d746,null))[_0x1fb5('0x22')](function(_0x1b467b){if(_0x1b467b){_0x2c373a[_0x1fb5('0x42')]=_[_0x1fb5('0x44')](db[_0x1fb5('0x87')][_0x1fb5('0x62')]);_0x2c373a[_0x1fb5('0x43')]=_[_0x1fb5('0x44')](_0x1da5cd['query']);_0x2c373a[_0x1fb5('0x45')]=_[_0x1fb5('0x46')](_0x2c373a[_0x1fb5('0x42')],_0x2c373a[_0x1fb5('0x43')]);_0x83957d['attributes']=_['intersection'](_0x2c373a[_0x1fb5('0x42')],qs[_0x1fb5('0x48')](_0x1da5cd[_0x1fb5('0x43')][_0x1fb5('0x48')]));_0x83957d[_0x1fb5('0x47')]=_0x83957d[_0x1fb5('0x47')][_0x1fb5('0x63')]?_0x83957d[_0x1fb5('0x47')]:_0x2c373a['model'];if(!_0x1da5cd[_0x1fb5('0x43')][_0x1fb5('0x49')](_0x1fb5('0x4a'))){_0x83957d['limit']=qs[_0x1fb5('0x4b')](_0x1da5cd[_0x1fb5('0x43')][_0x1fb5('0x4b')]);_0x83957d['offset']=qs[_0x1fb5('0x32')](_0x1da5cd[_0x1fb5('0x43')][_0x1fb5('0x32')]);}_0x83957d['order']=qs[_0x1fb5('0x4d')](_0x1da5cd[_0x1fb5('0x43')]['sort']);_0x83957d[_0x1fb5('0x4e')]=qs[_0x1fb5('0x45')](_[_0x1fb5('0x4f')](_0x1da5cd[_0x1fb5('0x43')],_0x2c373a[_0x1fb5('0x45')]));_0x83957d['where'][_0x1fb5('0x5f')]=_0x1b467b['id'];if(_0x1da5cd[_0x1fb5('0x43')][_0x1fb5('0x64')]){_0x83957d[_0x1fb5('0x4e')]=_['merge'](_0x83957d[_0x1fb5('0x4e')],{'$or':_['map'](_0x83957d[_0x1fb5('0x47')],function(_0x1eec84){var _0x3a96f5={};_0x3a96f5[_0x1eec84]={'$like':'%'+_0x1da5cd[_0x1fb5('0x43')][_0x1fb5('0x64')]+'%'};return _0x3a96f5;})});}_0x83957d=_['merge']({},_0x83957d,_0x1da5cd['options']);return db[_0x1fb5('0x87')][_0x1fb5('0x31')]({'where':_0x83957d[_0x1fb5('0x4e')]})[_0x1fb5('0x22')](function(_0x5d2b09){_0x14b06c['count']=_0x5d2b09;if(_0x1da5cd[_0x1fb5('0x43')]['includeAll']){_0x83957d[_0x1fb5('0x53')]=[{'model':db['CmContact'],'as':_0x1fb5('0x8a'),'required':![]},{'model':db['User'],'as':_0x1fb5('0x8b'),'attributes':[_0x1fb5('0x39'),_0x1fb5('0x8c'),_0x1fb5('0x8d')],'required':![]},{'model':db[_0x1fb5('0x8e')],'as':_0x1fb5('0x8f'),'attributes':['id','name','color'],'where':_0x1da5cd['query'][_0x1fb5('0x90')]?{'id':_0x1da5cd[_0x1fb5('0x43')]['tag']}:undefined,'required':_0x1da5cd[_0x1fb5('0x43')][_0x1fb5('0x90')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x83957d);})[_0x1fb5('0x22')](function(_0x3e5d96){_0x14b06c[_0x1fb5('0x54')]=_0x3e5d96;return _0x14b06c;});}})[_0x1fb5('0x22')](respondWithFilteredResult(_0x39d746,_0x83957d))[_0x1fb5('0x2c')](handleError(_0x39d746,null));};exports[_0x1fb5('0x91')]=function(_0x38c71c,_0x33ac56,_0x5841b9){return db[_0x1fb5('0x3f')][_0x1fb5('0x69')]({'where':{'id':_0x38c71c['params']['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0x33ac56,null))['then'](function(_0x1ac204){if(_0x1ac204){return db['sequelize']['transaction'](function(_0x5d587e){return db[_0x1fb5('0x92')][_0x1fb5('0x38')]({'where':{'MailAccountId':_0x38c71c[_0x1fb5('0x5b')]['id']},'transaction':_0x5d587e})[_0x1fb5('0x22')](function(_0x3cdeb9){var _0x587e1d=_[_0x1fb5('0x3e')](_0x38c71c[_0x1fb5('0x5a')],function(_0x5ed225){_0x5ed225[_0x1fb5('0x5f')]=_0x38c71c[_0x1fb5('0x5b')]['id'];return _0x5ed225;});return db[_0x1fb5('0x92')]['bulkCreate'](_0x587e1d,{'transaction':_0x5d587e});});})[_0x1fb5('0x22')](function(){return db[_0x1fb5('0x92')][_0x1fb5('0x93')]({'where':{'MailAccountId':_0x38c71c[_0x1fb5('0x5b')]['id']},'order':_0x1fb5('0x94')});});}})[_0x1fb5('0x22')](respondWithResult(_0x33ac56,null))[_0x1fb5('0x2c')](handleError(_0x33ac56,null));};exports['getApplications']=function(_0xb62210,_0x42cb93,_0x2f4253){var _0x1799c0={};var _0x406c81={};var _0x2aa281;var _0x2ec111;return db[_0x1fb5('0x3f')]['findOne']({'where':{'id':_0xb62210['params']['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0x42cb93,null))[_0x1fb5('0x22')](function(_0x271bbb){if(_0x271bbb){_0x2aa281=_0x271bbb;_0x406c81[_0x1fb5('0x42')]=_['keys'](db[_0x1fb5('0x92')]['rawAttributes']);_0x406c81['query']=_[_0x1fb5('0x44')](_0xb62210['query']);_0x406c81['filters']=_[_0x1fb5('0x46')](_0x406c81['model'],_0x406c81[_0x1fb5('0x43')]);_0x1799c0['attributes']=_[_0x1fb5('0x46')](_0x406c81['model'],qs['fields'](_0xb62210[_0x1fb5('0x43')][_0x1fb5('0x48')]));_0x1799c0['attributes']=_0x1799c0[_0x1fb5('0x47')][_0x1fb5('0x63')]?_0x1799c0[_0x1fb5('0x47')]:_0x406c81[_0x1fb5('0x42')];_0x1799c0[_0x1fb5('0x4c')]=qs[_0x1fb5('0x4d')](_0xb62210[_0x1fb5('0x43')][_0x1fb5('0x4d')]);_0x1799c0[_0x1fb5('0x4e')]=qs[_0x1fb5('0x45')](_[_0x1fb5('0x4f')](_0xb62210[_0x1fb5('0x43')],_0x406c81[_0x1fb5('0x45')]));if(_0xb62210[_0x1fb5('0x43')][_0x1fb5('0x64')]){_0x1799c0['where']=_[_0x1fb5('0x50')](_0x1799c0[_0x1fb5('0x4e')],{'$or':_[_0x1fb5('0x3e')](_0x1799c0[_0x1fb5('0x47')],function(_0x289b55){var _0xea213d={};_0xea213d[_0x289b55]={'$like':'%'+_0xb62210[_0x1fb5('0x43')]['filter']+'%'};return _0xea213d;})});}_0x1799c0=_['merge']({},_0x1799c0,_0xb62210[_0x1fb5('0x51')]);return _0x2aa281[_0x1fb5('0x95')](_0x1799c0);}})['then'](function(_0x43e569){if(_0x43e569){_0x2ec111=_0x43e569['length'];if(!_0xb62210['query']['hasOwnProperty'](_0x1fb5('0x4a'))){_0x1799c0['limit']=qs['limit'](_0xb62210[_0x1fb5('0x43')][_0x1fb5('0x4b')]);_0x1799c0[_0x1fb5('0x32')]=qs[_0x1fb5('0x32')](_0xb62210['query'][_0x1fb5('0x32')]);}return _0x2aa281[_0x1fb5('0x95')](_0x1799c0);}})[_0x1fb5('0x22')](function(_0x4eec21){if(_0x4eec21){return _0x4eec21?{'count':_0x2ec111,'rows':_0x4eec21}:null;}})['then'](respondWithResult(_0x42cb93,null))[_0x1fb5('0x2c')](handleError(_0x42cb93,null));};exports[_0x1fb5('0x96')]=function(_0x269d03,_0x2e27a1,_0x1b90d5){var _0x62c368={'raw':!![],'where':{}};var _0x59e883={};var _0x296eef={'count':0x0,'rows':[]};return db[_0x1fb5('0x3f')][_0x1fb5('0x69')]({'where':{'id':_0x269d03[_0x1fb5('0x5b')]['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0x2e27a1,null))[_0x1fb5('0x22')](function(_0x3d87db){if(_0x3d87db){_0x59e883[_0x1fb5('0x42')]=_[_0x1fb5('0x44')](db[_0x1fb5('0x97')][_0x1fb5('0x62')]);_0x59e883[_0x1fb5('0x43')]=_[_0x1fb5('0x44')](_0x269d03[_0x1fb5('0x43')]);_0x59e883[_0x1fb5('0x45')]=_[_0x1fb5('0x46')](_0x59e883[_0x1fb5('0x42')],_0x59e883[_0x1fb5('0x43')]);_0x62c368[_0x1fb5('0x47')]=_[_0x1fb5('0x46')](_0x59e883[_0x1fb5('0x42')],qs[_0x1fb5('0x48')](_0x269d03['query'][_0x1fb5('0x48')]));_0x62c368[_0x1fb5('0x47')]=_0x62c368[_0x1fb5('0x47')][_0x1fb5('0x63')]?_0x62c368['attributes']:_0x59e883[_0x1fb5('0x42')];if(!_0x269d03[_0x1fb5('0x43')][_0x1fb5('0x49')](_0x1fb5('0x4a'))){_0x62c368['limit']=qs[_0x1fb5('0x4b')](_0x269d03[_0x1fb5('0x43')][_0x1fb5('0x4b')]);_0x62c368['offset']=qs[_0x1fb5('0x32')](_0x269d03[_0x1fb5('0x43')][_0x1fb5('0x32')]);}_0x62c368['order']=qs[_0x1fb5('0x4d')](_0x269d03[_0x1fb5('0x43')][_0x1fb5('0x4d')]);_0x62c368['where']=qs['filters'](_['pick'](_0x269d03['query'],_0x59e883[_0x1fb5('0x45')]));_0x62c368[_0x1fb5('0x4e')][_0x1fb5('0x5f')]=_0x3d87db['id'];if(_0x269d03[_0x1fb5('0x43')]['filter']){_0x62c368[_0x1fb5('0x4e')]=_['merge'](_0x62c368['where'],{'$or':_['map'](_0x62c368[_0x1fb5('0x47')],function(_0x35d124){var _0x1d6545={};_0x1d6545[_0x35d124]={'$like':'%'+_0x269d03[_0x1fb5('0x43')][_0x1fb5('0x64')]+'%'};return _0x1d6545;})});}if(_0x269d03['query']['$gte']){var _0x7511fe=_0x269d03[_0x1fb5('0x43')][_0x1fb5('0x98')][_0x1fb5('0x99')](',');var _0x1d9fa6={};_0x1d9fa6[_0x7511fe[0x0]]={'$gte':moment(_0x7511fe[0x1])[_0x1fb5('0x9a')](_0x1fb5('0x9b'))};_0x62c368[_0x1fb5('0x4e')]=_[_0x1fb5('0x50')](_0x62c368[_0x1fb5('0x4e')],_0x1d9fa6);}_0x62c368=_[_0x1fb5('0x50')]({},_0x62c368,_0x269d03[_0x1fb5('0x51')]);return db['MailMessage'][_0x1fb5('0x31')]({'where':_0x62c368[_0x1fb5('0x4e')]})[_0x1fb5('0x22')](function(_0x3cb6fa){_0x296eef[_0x1fb5('0x31')]=_0x3cb6fa;if(_0x269d03[_0x1fb5('0x43')][_0x1fb5('0x52')]){_0x62c368['include']=[{'all':!![]}];}return db[_0x1fb5('0x97')][_0x1fb5('0x6a')](_0x62c368);})[_0x1fb5('0x22')](function(_0x24c2b7){_0x296eef[_0x1fb5('0x54')]=_0x24c2b7;return _0x296eef;});}})[_0x1fb5('0x22')](respondWithFilteredResult(_0x2e27a1,_0x62c368))[_0x1fb5('0x2c')](handleError(_0x2e27a1,null));};exports[_0x1fb5('0x3a')]=function(_0x47eb36,_0x1f9ffb,_0x13e3d8){var _0x405a96,_0x3267d8={},_0x358521;if(_0x47eb36[_0x1fb5('0x5a')]['to']){_0x358521=_0x47eb36[_0x1fb5('0x5a')]['to'][_0x1fb5('0x99')](',')[0x0];}return db['MailAccount'][_0x1fb5('0x59')]({'where':{'id':_0x47eb36[_0x1fb5('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0x1fb5('0x9c'),'include':[{'model':db[_0x1fb5('0x9d')],'as':_0x1fb5('0x9e'),'where':{'email':_0x358521},'limit':0x1,'order':[[_0x1fb5('0x9f'),_0x1fb5('0xa0')]]}]},{'model':db[_0x1fb5('0x56')],'as':_0x1fb5('0x57'),'raw':!![]}]})[_0x1fb5('0x22')](handleEntityNotFound(_0x1f9ffb,null))['then'](function(_0x447233){if(_0x447233){_0x405a96=_0x447233;if(_0x447233['Smtp']){if(_[_0x1fb5('0x6c')](_0x47eb36[_0x1fb5('0x5a')][_0x1fb5('0xa1')])){_0x47eb36[_0x1fb5('0x5a')][_0x1fb5('0xa1')]=util[_0x1fb5('0x9a')](_0x1fb5('0xa2'),_0x447233[_0x1fb5('0x39')],_0x447233[_0x1fb5('0xa3')]||_0x447233[_0x1fb5('0x57')][_0x1fb5('0x71')]);}if(_0x47eb36[_0x1fb5('0x5a')][_0x1fb5('0xa4')]&&_0x47eb36['body'][_0x1fb5('0xa4')][_0x1fb5('0x63')]){for(var _0x466cc1=0x0;_0x466cc1<_0x47eb36['body'][_0x1fb5('0xa4')][_0x1fb5('0x63')];_0x466cc1+=0x1){_0x47eb36[_0x1fb5('0x5a')][_0x1fb5('0xa4')][_0x466cc1]={'filename':_0x47eb36[_0x1fb5('0x5a')]['attachments'][_0x466cc1]['name'],'path':path[_0x1fb5('0xa5')](config['root'],_0x1fb5('0xa6'),_0x47eb36[_0x1fb5('0x5a')][_0x1fb5('0xa4')][_0x466cc1][_0x1fb5('0xa7')])};}}var _0x5be22f={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x447233[_0x1fb5('0x57')][_0x1fb5('0x77')])){if(_0x447233[_0x1fb5('0x57')]['authentication']){_0x5be22f[_0x1fb5('0xa8')]={'user':_0x447233[_0x1fb5('0x57')][_0x1fb5('0x71')],'pass':_0x447233[_0x1fb5('0x57')][_0x1fb5('0x73')]};}_0x5be22f['host']=_0x447233[_0x1fb5('0x57')][_0x1fb5('0x75')];_0x5be22f[_0x1fb5('0x76')]=_0x447233[_0x1fb5('0x57')]['port'];_0x5be22f[_0x1fb5('0xa9')]=_0x447233[_0x1fb5('0x57')][_0x1fb5('0xa9')];}else{_0x5be22f[_0x1fb5('0x77')]=_0x447233[_0x1fb5('0x57')][_0x1fb5('0x77')];_0x5be22f[_0x1fb5('0xa8')]={'user':_0x447233[_0x1fb5('0x57')][_0x1fb5('0x71')],'pass':_0x447233[_0x1fb5('0x57')]['pass']};}return respondWithRpcPromise(_0x1fb5('0xaa'),_0x1fb5('0xab'),{'account':_0x5be22f,'message':_0x47eb36[_0x1fb5('0x5a')]});}else{throw new Error(_0x1fb5('0xac'));}}})[_0x1fb5('0x22')](function(_0x4ff3e0){if(_0x4ff3e0){_0x3267d8=_0x4ff3e0;if(_0x405a96['List']){if(_0x405a96['List'][_0x1fb5('0x9e')][_0x1fb5('0x63')]){return _0x405a96[_0x1fb5('0x9c')][_0x1fb5('0x9e')][0x0];}else{return db[_0x1fb5('0x9d')][_0x1fb5('0x67')](_[_0x1fb5('0x19')](_0x47eb36['body'],{'firstName':_0x47eb36[_0x1fb5('0x5a')]['to'],'email':_0x47eb36['body']['to'],'phone':_0x47eb36[_0x1fb5('0x5a')]['to'],'ListId':_0x405a96['ListId']}));}}else{throw new Error(_0x1fb5('0xac'));}}})[_0x1fb5('0x22')](function(_0x3ae5a1){if(_0x3ae5a1){var _0x2df35c={'UserId':_0x47eb36['user']['id'],'ContactId':_0x3ae5a1['id'],'MailAccountId':_0x405a96['id'],'inReplyTo':_0x3267d8[_0x1fb5('0xad')],'to':_0x47eb36[_0x1fb5('0x5a')][_0x1fb5('0xa1')],'cc':_0x47eb36[_0x1fb5('0x5a')]['cc'],'subject':_0x47eb36[_0x1fb5('0x5a')]['subject'],'attach':_0x47eb36[_0x1fb5('0x5a')][_0x1fb5('0xae')],'firstMsgDirection':_0x1fb5('0xaf'),'lastMsgAt':moment()[_0x1fb5('0x9a')](_0x1fb5('0x9b')),'lastMsgDirection':_0x1fb5('0xaf'),'lastMsgBody':_0x47eb36[_0x1fb5('0x5a')][_0x1fb5('0x5a')],'Messages':[_[_0x1fb5('0x50')](_0x47eb36[_0x1fb5('0x5a')],{'messageId':_0x3267d8[_0x1fb5('0xad')],'sentAt':moment()[_0x1fb5('0x9a')](_0x1fb5('0x9b')),'read':!![],'MailAccountId':_0x405a96['id'],'UserId':_0x47eb36[_0x1fb5('0x71')]['id'],'ContactId':_0x3ae5a1['id']})]};if(_0x47eb36[_0x1fb5('0x5a')][_0x1fb5('0xb0')]){_0x2df35c=_['merge'](_0x2df35c,_0x47eb36[_0x1fb5('0x5a')]['Interaction']);}return db[_0x1fb5('0x87')][_0x1fb5('0x67')](_0x2df35c,{'include':[{'model':db[_0x1fb5('0x97')],'as':_0x1fb5('0xb1')}]});}})[_0x1fb5('0x22')](respondWithResult(_0x1f9ffb,null))[_0x1fb5('0x2c')](handleError(_0x1f9ffb,null));};exports[_0x1fb5('0xb2')]=function(_0x329a6a,_0x4a0154,_0x1ef18f){return db[_0x1fb5('0x3f')]['find']({'where':{'id':_0x329a6a[_0x1fb5('0x5b')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x1fb5('0x22')](handleEntityNotFound(_0x4a0154,null))['then'](function(_0x1547d3){if(_0x1547d3&&_0x1547d3[_0x1fb5('0x57')]){var _0x3e1c6b={'id':_0x1547d3['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1547d3[_0x1fb5('0x57')][_0x1fb5('0x77')]){_0x3e1c6b[_0x1fb5('0x77')]=_0x1547d3[_0x1fb5('0x57')][_0x1fb5('0x77')];}else{_0x3e1c6b[_0x1fb5('0x75')]=_0x1547d3[_0x1fb5('0x57')][_0x1fb5('0x75')];_0x3e1c6b[_0x1fb5('0x76')]=_0x1547d3[_0x1fb5('0x57')][_0x1fb5('0x76')];_0x3e1c6b[_0x1fb5('0xa9')]=_0x1547d3[_0x1fb5('0x57')][_0x1fb5('0xa9')];}if(_0x1547d3[_0x1fb5('0x57')][_0x1fb5('0x74')]){_0x3e1c6b[_0x1fb5('0xa8')]={'user':_0x1547d3[_0x1fb5('0x57')]['user'],'pass':_0x1547d3['Smtp'][_0x1fb5('0x73')]};}return respondWithRpcPromise(_0x1fb5('0xb3'),_0x1fb5('0xb2'),{'account':_0x3e1c6b});}})[_0x1fb5('0x22')](respondWithResult(_0x4a0154,null))['catch'](handleError(_0x4a0154,null));};exports[_0x1fb5('0x38')]=function(_0x55e6d8,_0x4957d1){return db[_0x1fb5('0x3f')][_0x1fb5('0x59')]({'where':{'id':_0x55e6d8[_0x1fb5('0x5b')]['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0x4957d1,null))[_0x1fb5('0x22')](function(_0x33670f){if(_0x33670f&&_0x33670f['service']){throw new db[(_0x1fb5('0x1f'))][(_0x1fb5('0xb4'))](_0x1fb5('0xb5'));}return _0x33670f;})['then'](removeEntity(_0x4957d1,null))[_0x1fb5('0x2c')](handleError(_0x4957d1,null));};exports['addAgents']=function(_0x314c4c,_0x2007ba,_0x515aba){return db[_0x1fb5('0x3f')][_0x1fb5('0x59')]({'where':{'id':_0x314c4c[_0x1fb5('0x5b')]['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0x2007ba,null))[_0x1fb5('0x22')](function(_0x13ebb5){if(_0x13ebb5){return _0x13ebb5[_0x1fb5('0xb6')](_0x314c4c['body'][_0x1fb5('0x65')],_[_0x1fb5('0x88')](_0x314c4c[_0x1fb5('0x5a')],[_0x1fb5('0x65'),'id'])||{})[_0x1fb5('0xb7')](function(_0x5d8693){for(var _0x2f35a9=0x0;_0x2f35a9<_0x314c4c[_0x1fb5('0x5a')][_0x1fb5('0x65')][_0x1fb5('0x63')];_0x2f35a9+=0x1){socket[_0x1fb5('0xb8')](_0x1fb5('0xb9'),{'UserId':_0x314c4c[_0x1fb5('0x5a')][_0x1fb5('0x65')][_0x2f35a9],'MailAccountId':_0x314c4c[_0x1fb5('0x5b')]['id']});}return _0x5d8693;});}})[_0x1fb5('0x22')](respondWithResult(_0x2007ba,null))[_0x1fb5('0x2c')](handleError(_0x2007ba,null));};exports[_0x1fb5('0xba')]=function(_0x30731d,_0x50c4dd,_0x5d6fd3){return db['MailAccount'][_0x1fb5('0x59')]({'where':{'id':_0x30731d[_0x1fb5('0x5b')]['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0x50c4dd,null))['then'](function(_0x4e6a6a){if(_0x4e6a6a){return _0x4e6a6a[_0x1fb5('0xba')](_0x30731d['query'][_0x1fb5('0x65')])['then'](function(){if(_[_0x1fb5('0xbb')](_0x30731d[_0x1fb5('0x43')][_0x1fb5('0x65')])){for(var _0x53264c=0x0;_0x53264c<_0x30731d[_0x1fb5('0x43')][_0x1fb5('0x65')]['length'];_0x53264c+=0x1){socket[_0x1fb5('0xb8')](_0x1fb5('0xbc'),{'UserId':Number(_0x30731d[_0x1fb5('0x43')][_0x1fb5('0x65')][_0x53264c]),'MailAccountId':Number(_0x30731d['params']['id'])});}}else{socket[_0x1fb5('0xb8')](_0x1fb5('0xbc'),{'UserId':Number(_0x30731d['query'][_0x1fb5('0x65')]),'MailAccountId':Number(_0x30731d[_0x1fb5('0x5b')]['id'])});}});}})[_0x1fb5('0x22')](respondWithStatusCode(_0x50c4dd,null))['catch'](handleError(_0x50c4dd,null));};exports[_0x1fb5('0xbd')]=function(_0x1564f3,_0x125264,_0x1186e1){var _0xc87c0c={};var _0x1e7dcb={};var _0x5d24ef;var _0x24921c;return db[_0x1fb5('0x3f')][_0x1fb5('0x69')]({'where':{'id':_0x1564f3[_0x1fb5('0x5b')]['id']}})[_0x1fb5('0x22')](handleEntityNotFound(_0x125264,null))['then'](function(_0x202eea){if(_0x202eea){_0x5d24ef=_0x202eea;_0x1e7dcb[_0x1fb5('0x42')]=_[_0x1fb5('0x44')](db[_0x1fb5('0xbe')][_0x1fb5('0x62')]);_0x1e7dcb[_0x1fb5('0x43')]=_[_0x1fb5('0x44')](_0x1564f3['query']);_0x1e7dcb['filters']=_[_0x1fb5('0x46')](_0x1e7dcb['model'],_0x1e7dcb['query']);_0xc87c0c[_0x1fb5('0x47')]=_[_0x1fb5('0x46')](_0x1e7dcb['model'],qs[_0x1fb5('0x48')](_0x1564f3[_0x1fb5('0x43')][_0x1fb5('0x48')]));_0xc87c0c['attributes']=_0xc87c0c[_0x1fb5('0x47')]['length']?_0xc87c0c['attributes']:_0x1e7dcb[_0x1fb5('0x42')];_0xc87c0c[_0x1fb5('0x4c')]=qs[_0x1fb5('0x4d')](_0x1564f3['query'][_0x1fb5('0x4d')]);_0xc87c0c[_0x1fb5('0x4e')]=qs['filters'](_[_0x1fb5('0x4f')](_0x1564f3[_0x1fb5('0x43')],_0x1e7dcb[_0x1fb5('0x45')]));if(_0x1564f3[_0x1fb5('0x43')]['filter']){_0xc87c0c[_0x1fb5('0x4e')]=_['merge'](_0xc87c0c[_0x1fb5('0x4e')],{'$or':_[_0x1fb5('0x3e')](_0xc87c0c[_0x1fb5('0x47')],function(_0x512c69){var _0x1bafb7={};_0x1bafb7[_0x512c69]={'$like':'%'+_0x1564f3[_0x1fb5('0x43')][_0x1fb5('0x64')]+'%'};return _0x1bafb7;})});}_0xc87c0c=_[_0x1fb5('0x50')]({},_0xc87c0c,_0x1564f3['options']);return _0x5d24ef[_0x1fb5('0xbd')](_0xc87c0c);}})[_0x1fb5('0x22')](function(_0x5736fa){if(_0x5736fa){_0x24921c=_0x5736fa['length'];if(!_0x1564f3['query']['hasOwnProperty'](_0x1fb5('0x4a'))){_0xc87c0c[_0x1fb5('0x4b')]=qs[_0x1fb5('0x4b')](_0x1564f3['query'][_0x1fb5('0x4b')]);_0xc87c0c[_0x1fb5('0x32')]=qs['offset'](_0x1564f3[_0x1fb5('0x43')]['offset']);}return _0x5d24ef['getAgents'](_0xc87c0c);}})['then'](function(_0xaa6a24){if(_0xaa6a24){return _0xaa6a24?{'count':_0x24921c,'rows':_0xaa6a24}:null;}})[_0x1fb5('0x22')](respondWithResult(_0x125264,null))[_0x1fb5('0x2c')](handleError(_0x125264,null));}; \ No newline at end of file +var _0xc03d=['Pause','MailAccount','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','keys','find','body','describe','addDisposition','MailAccountId','create','Disposition','order','removeDispositions','ids','addAnswer','findOne','CannedAnswer','hasOwnProperty','removeAnswers','email','active','description','isNil','cservice','cauthentication','user','cuser','password','pass','authentication','host','port','service','cpassword','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','Contact','User','Owner','fullname','Tags','color','tag','addApplications','MailApplication','priority','getApplications','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','CmContact','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','server/files/attachments','basename','auth','secure','List\x20not\x20found','List','defaults','subject','attach','out','Interaction','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','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','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','end','status','json','count','offset','set','apply','save','update','destroy','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xc03d,0x12f));var _0xdc03=function(_0x176711,_0x411ba3){_0x176711=_0x176711-0x0;var _0x197052=_0xc03d[_0x176711];return _0x197052;};'use strict';var pdf=require(_0xdc03('0x0'));var emlformat=require(_0xdc03('0x1'));var rimraf=require(_0xdc03('0x2'));var zipdir=require(_0xdc03('0x3'));var jsonpatch=require(_0xdc03('0x4'));var rp=require(_0xdc03('0x5'));var moment=require('moment');var BPromise=require(_0xdc03('0x6'));var Mustache=require(_0xdc03('0x7'));var util=require(_0xdc03('0x8'));var path=require(_0xdc03('0x9'));var sox=require(_0xdc03('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdc03('0xb'));var squel=require(_0xdc03('0xc'));var crypto=require(_0xdc03('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdc03('0xe'));var querystring=require('querystring');var Papa=require(_0xdc03('0xf'));var Redis=require(_0xdc03('0x10'));var authService=require(_0xdc03('0x11'));var qs=require(_0xdc03('0x12'));var as=require(_0xdc03('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdc03('0x14'));var config=require('../../config/environment');var db=require(_0xdc03('0x15'))['db'];config['redis']=_['defaults'](config[_0xdc03('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xdc03('0x17'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xdc03('0x18')](socket);var jayson=require(_0xdc03('0x19'));var client=jayson['client']['http']({'port':0x232b});function checkPasswordPattern(_0x2a8395,_0x1648cb,_0x16a848){if(_0x16a848){var _0x38daad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38daad[_0xdc03('0x1a')](_0x1648cb)){return _0x2a8395;}else{throw new db[(_0xdc03('0x1b'))]['ValidationError'](_0xdc03('0x1c'));}}else{return _0x2a8395;}}function respondWithRpcPromise(_0x10116b,_0x512c96,_0x15e9be,_0x2c00ad){return new BPromise(function(_0x35e7f8,_0x31e672){var _0xd8f4a7=_0x2c00ad||client;return _0xd8f4a7[_0xdc03('0x1d')](_0x10116b,_0x15e9be)[_0xdc03('0x1e')](function(_0xb24c36){logger['info'](_0xdc03('0x1f'),_0x512c96,_0xdc03('0x20'));logger['debug'](_0xdc03('0x21'),_0x512c96,_0xdc03('0x20'),JSON[_0xdc03('0x22')](_0xb24c36));if(_0xb24c36[_0xdc03('0x23')]){if(_0xb24c36['error']['code']===0x1f4){logger[_0xdc03('0x23')](_0xdc03('0x1f'),_0x512c96,_0xb24c36['error'][_0xdc03('0x24')]);return _0x31e672(_0xb24c36[_0xdc03('0x23')]['message']);}logger['error'](_0xdc03('0x1f'),_0x512c96,_0xb24c36[_0xdc03('0x23')]['message']);return _0x35e7f8(_0xb24c36[_0xdc03('0x23')][_0xdc03('0x24')]);}else{logger[_0xdc03('0x25')](_0xdc03('0x1f'),_0x512c96,'request\x20sent');_0x35e7f8(_0xb24c36[_0xdc03('0x26')][_0xdc03('0x24')]);}})['catch'](function(_0x26fdb3){logger[_0xdc03('0x23')](_0xdc03('0x1f'),_0x512c96,_0x26fdb3);_0x31e672(_0x26fdb3);});});}function respondWithStatusCode(_0x35f9fe,_0x5684de){_0x5684de=_0x5684de||0xcc;return function(_0x4c99c1){if(_0x4c99c1){return _0x35f9fe[_0xdc03('0x27')](_0x5684de);}return _0x35f9fe['status'](_0x5684de)[_0xdc03('0x28')]();};}function respondWithResult(_0x1fa1d2,_0x5cf3dc){_0x5cf3dc=_0x5cf3dc||0xc8;return function(_0x8eb971){if(_0x8eb971){return _0x1fa1d2[_0xdc03('0x29')](_0x5cf3dc)[_0xdc03('0x2a')](_0x8eb971);}};}function respondWithFilteredResult(_0x24416a,_0x5aac66){return function(_0x2952cb){if(_0x2952cb){var _0x1eeff3=_0x2952cb[_0xdc03('0x2b')],_0x13bac2=_0x5aac66['offset'],_0x7b0cec=_0x5aac66[_0xdc03('0x2c')]+_0x5aac66['limit'],_0x4e0366;if(_0x7b0cec>=_0x1eeff3){_0x7b0cec=_0x1eeff3;_0x4e0366=0xc8;}else{_0x4e0366=0xce;}_0x24416a[_0xdc03('0x29')](_0x4e0366);return _0x24416a[_0xdc03('0x2d')]('Content-Range',_0x13bac2+'-'+_0x7b0cec+'/'+_0x1eeff3)['json'](_0x2952cb);}return null;};}function patchUpdates(_0x5264a2){return function(_0x2f1806){try{jsonpatch[_0xdc03('0x2e')](_0x2f1806,_0x5264a2,!![]);}catch(_0x2f0506){return BPromise['reject'](_0x2f0506);}return _0x2f1806[_0xdc03('0x2f')]();};}function saveUpdates(_0x264e77,_0x1962d4){return function(_0x1a3f6d){if(_0x1a3f6d){return _0x1a3f6d[_0xdc03('0x30')](_0x264e77)[_0xdc03('0x1e')](function(_0x5a9baf){return _0x5a9baf;});}return null;};}function removeEntity(_0x55f9cb,_0x3341ab){return function(_0x3b44ef){if(_0x3b44ef){return _0x3b44ef[_0xdc03('0x31')]()['then'](function(){var _0x15b612=_0x3b44ef['get']({'plain':!![]});var _0x51fcc3='MailAccounts';return db[_0xdc03('0x32')][_0xdc03('0x31')]({'where':{'type':_0x51fcc3,'resourceId':_0x15b612['id']}})[_0xdc03('0x1e')](function(){return _0x3b44ef;});})[_0xdc03('0x1e')](function(){_0x55f9cb[_0xdc03('0x29')](0xcc)[_0xdc03('0x28')]();});}};}function handleEntityNotFound(_0x247a9a,_0x1ff441){return function(_0x5492f3){if(!_0x5492f3){_0x247a9a[_0xdc03('0x27')](0x194);}return _0x5492f3;};}function handleError(_0x2a5df9,_0x4be55a){_0x4be55a=_0x4be55a||0x1f4;return function(_0x190d58){logger[_0xdc03('0x23')](_0x190d58[_0xdc03('0x33')]);if(_0x190d58[_0xdc03('0x34')]){delete _0x190d58[_0xdc03('0x34')];}_0x2a5df9[_0xdc03('0x29')](_0x4be55a)[_0xdc03('0x35')](_0x190d58);};}exports[_0xdc03('0x36')]=function(_0x455b41,_0x373b94){var _0x29aeb9={'include':[{'model':db[_0xdc03('0x37')],'as':_0xdc03('0x38')},{'model':db[_0xdc03('0x39')],'as':_0xdc03('0x3a')},{'model':db[_0xdc03('0x3b')],'as':'mandatoryDispositionPause'}]},_0x549719={},_0x243ce1={'count':0x0,'rows':[]};var _0x32bae8=_['map'](db[_0xdc03('0x3c')]['rawAttributes'],function(_0x32f2fa){return{'name':_0x32f2fa[_0xdc03('0x3d')],'type':_0x32f2fa['type'][_0xdc03('0x3e')]};});_0x549719[_0xdc03('0x3f')]=_[_0xdc03('0x40')](_0x32bae8,_0xdc03('0x34'));_0x549719[_0xdc03('0x41')]=_['keys'](_0x455b41[_0xdc03('0x41')]);_0x549719[_0xdc03('0x42')]=_[_0xdc03('0x43')](_0x549719['model'],_0x549719[_0xdc03('0x41')]);_0x29aeb9[_0xdc03('0x44')]=_[_0xdc03('0x43')](_0x549719['model'],qs[_0xdc03('0x45')](_0x455b41[_0xdc03('0x41')][_0xdc03('0x45')]));_0x29aeb9[_0xdc03('0x44')]=_0x29aeb9['attributes'][_0xdc03('0x46')]?_0x29aeb9['attributes']:_0x549719[_0xdc03('0x3f')];if(!_0x455b41[_0xdc03('0x41')]['hasOwnProperty'](_0xdc03('0x47'))){_0x29aeb9[_0xdc03('0x48')]=qs[_0xdc03('0x48')](_0x455b41[_0xdc03('0x41')][_0xdc03('0x48')]);_0x29aeb9['offset']=qs[_0xdc03('0x2c')](_0x455b41[_0xdc03('0x41')][_0xdc03('0x2c')]);}_0x29aeb9['order']=qs[_0xdc03('0x49')](_0x455b41[_0xdc03('0x41')][_0xdc03('0x49')]);_0x29aeb9[_0xdc03('0x4a')]=qs[_0xdc03('0x42')](_[_0xdc03('0x4b')](_0x455b41[_0xdc03('0x41')],_0x549719['filters']),_0x32bae8);if(_0x455b41[_0xdc03('0x41')][_0xdc03('0x4c')]){_0x29aeb9[_0xdc03('0x4a')]=_[_0xdc03('0x4d')](_0x29aeb9[_0xdc03('0x4a')],{'$or':_[_0xdc03('0x40')](_0x32bae8,function(_0x166bba){if(_0x166bba['type']!==_0xdc03('0x4e')){var _0x469410={};_0x469410[_0x166bba['name']]={'$like':'%'+_0x455b41[_0xdc03('0x41')][_0xdc03('0x4c')]+'%'};return _0x469410;}})});}_0x29aeb9=_[_0xdc03('0x4d')]({},_0x29aeb9,_0x455b41[_0xdc03('0x4f')]);var _0x49c798={'where':_0x29aeb9[_0xdc03('0x4a')]};return db[_0xdc03('0x3c')]['count'](_0x49c798)['then'](function(_0xdc066a){_0x243ce1[_0xdc03('0x2b')]=_0xdc066a;if(_0x455b41['query'][_0xdc03('0x50')]){_0x29aeb9[_0xdc03('0x51')]=[{'all':!![]}];}return db[_0xdc03('0x3c')][_0xdc03('0x52')](_0x29aeb9);})['then'](function(_0x6e7e7b){_0x243ce1[_0xdc03('0x53')]=_0x6e7e7b;return _0x243ce1;})[_0xdc03('0x1e')](respondWithFilteredResult(_0x373b94,_0x29aeb9))[_0xdc03('0x54')](handleError(_0x373b94,null));};exports[_0xdc03('0x55')]=function(_0x2d727e,_0x221743){var _0x57e358={'raw':![],'where':{'id':_0x2d727e[_0xdc03('0x56')]['id']},'include':[{'model':db[_0xdc03('0x37')],'as':_0xdc03('0x38')},{'model':db[_0xdc03('0x39')],'as':'Smtp'},{'model':db['Pause'],'as':_0xdc03('0x57')}]},_0x63cba3={};_0x63cba3[_0xdc03('0x3f')]=_['keys'](db[_0xdc03('0x3c')][_0xdc03('0x58')]);_0x63cba3['query']=_[_0xdc03('0x59')](_0x2d727e[_0xdc03('0x41')]);_0x63cba3[_0xdc03('0x42')]=_[_0xdc03('0x43')](_0x63cba3[_0xdc03('0x3f')],_0x63cba3[_0xdc03('0x41')]);_0x57e358[_0xdc03('0x44')]=_[_0xdc03('0x43')](_0x63cba3[_0xdc03('0x3f')],qs[_0xdc03('0x45')](_0x2d727e[_0xdc03('0x41')]['fields']));_0x57e358[_0xdc03('0x44')]=_0x57e358['attributes'][_0xdc03('0x46')]?_0x57e358[_0xdc03('0x44')]:_0x63cba3[_0xdc03('0x3f')];if(_0x2d727e[_0xdc03('0x41')][_0xdc03('0x50')]){_0x57e358[_0xdc03('0x51')]=[{'all':!![]}];}_0x57e358=_[_0xdc03('0x4d')]({},_0x57e358,_0x2d727e['options']);return db['MailAccount'][_0xdc03('0x5a')](_0x57e358)['then'](handleEntityNotFound(_0x221743,null))[_0xdc03('0x1e')](respondWithResult(_0x221743,null))[_0xdc03('0x54')](handleError(_0x221743,null));};exports[_0xdc03('0x30')]=function(_0x509ae0,_0x4b9ec2){if(_0x509ae0[_0xdc03('0x5b')]['id']){delete _0x509ae0['body']['id'];}return db[_0xdc03('0x3c')][_0xdc03('0x5a')]({'where':{'id':_0x509ae0[_0xdc03('0x56')]['id']},'include':[{'model':db[_0xdc03('0x37')],'as':_0xdc03('0x38')},{'model':db[_0xdc03('0x39')],'as':_0xdc03('0x3a')},{'model':db[_0xdc03('0x3b')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4b9ec2,null))[_0xdc03('0x1e')](saveUpdates(_0x509ae0[_0xdc03('0x5b')],null))[_0xdc03('0x1e')](function(_0x534d27){if(_0x534d27&&_0x509ae0['body'][_0xdc03('0x38')]){return db[_0xdc03('0x37')][_0xdc03('0x30')](_0x509ae0[_0xdc03('0x5b')][_0xdc03('0x38')],{'where':{'MailAccountId':_0x534d27['id']}})[_0xdc03('0x1e')](function(){return _0x534d27;});}return _0x534d27;})['then'](function(_0x2004f0){if(_0x2004f0&&_0x509ae0[_0xdc03('0x5b')]['Smtp']){return db[_0xdc03('0x39')][_0xdc03('0x30')](_0x509ae0[_0xdc03('0x5b')][_0xdc03('0x3a')],{'where':{'MailAccountId':_0x2004f0['id']}})[_0xdc03('0x1e')](function(){return _0x2004f0;});}return _0x2004f0;})[_0xdc03('0x1e')](respondWithResult(_0x4b9ec2,null))[_0xdc03('0x54')](handleError(_0x4b9ec2,null));};exports[_0xdc03('0x5c')]=function(_0x2296ef,_0x5ab8fd){return db[_0xdc03('0x3c')][_0xdc03('0x5c')]()[_0xdc03('0x1e')](respondWithResult(_0x5ab8fd,null))[_0xdc03('0x54')](handleError(_0x5ab8fd,null));};exports[_0xdc03('0x5d')]=function(_0x35a4de,_0x2e9370,_0x13f5ad){if(_0x35a4de['body']['id']){delete _0x35a4de[_0xdc03('0x5b')]['id'];}return db[_0xdc03('0x3c')][_0xdc03('0x5a')]({'where':{'id':_0x35a4de['params']['id']}})['then'](handleEntityNotFound(_0x2e9370,null))[_0xdc03('0x1e')](function(_0x40d191){if(_0x40d191){_0x35a4de[_0xdc03('0x5b')][_0xdc03('0x5e')]=_0x40d191['id'];return db['Disposition'][_0xdc03('0x5f')](_0x35a4de[_0xdc03('0x5b')]);}})[_0xdc03('0x1e')](respondWithResult(_0x2e9370,null))[_0xdc03('0x54')](handleError(_0x2e9370,null));};exports['getDispositions']=function(_0x2a9677,_0x160cfe,_0x2d617c){var _0x451677={'raw':![],'where':{}};var _0x1eedd0={};var _0x1cb1b0={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x2a9677[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x160cfe,null))[_0xdc03('0x1e')](function(_0x4bde3f){if(_0x4bde3f){_0x1eedd0[_0xdc03('0x3f')]=_[_0xdc03('0x59')](db[_0xdc03('0x60')]['rawAttributes']);_0x1eedd0[_0xdc03('0x41')]=_[_0xdc03('0x59')](_0x2a9677[_0xdc03('0x41')]);_0x1eedd0['filters']=_[_0xdc03('0x43')](_0x1eedd0[_0xdc03('0x3f')],_0x1eedd0['query']);_0x451677['attributes']=_['intersection'](_0x1eedd0[_0xdc03('0x3f')],qs[_0xdc03('0x45')](_0x2a9677[_0xdc03('0x41')]['fields']));_0x451677[_0xdc03('0x44')]=_0x451677[_0xdc03('0x44')][_0xdc03('0x46')]?_0x451677['attributes']:_0x1eedd0[_0xdc03('0x3f')];if(!_0x2a9677[_0xdc03('0x41')]['hasOwnProperty']('nolimit')){_0x451677[_0xdc03('0x48')]=qs[_0xdc03('0x48')](_0x2a9677[_0xdc03('0x41')][_0xdc03('0x48')]);_0x451677[_0xdc03('0x2c')]=qs[_0xdc03('0x2c')](_0x2a9677[_0xdc03('0x41')][_0xdc03('0x2c')]);}_0x451677[_0xdc03('0x61')]=qs['sort'](_0x2a9677[_0xdc03('0x41')]['sort']);_0x451677[_0xdc03('0x4a')]=qs['filters'](_[_0xdc03('0x4b')](_0x2a9677[_0xdc03('0x41')],_0x1eedd0['filters']));_0x451677['where'][_0xdc03('0x5e')]=_0x4bde3f['id'];if(_0x2a9677['query'][_0xdc03('0x4c')]){_0x451677[_0xdc03('0x4a')]=_['merge'](_0x451677[_0xdc03('0x4a')],{'$or':_[_0xdc03('0x40')](_0x451677[_0xdc03('0x44')],function(_0x48297e){var _0xa9ec99={};_0xa9ec99[_0x48297e]={'$like':'%'+_0x2a9677['query'][_0xdc03('0x4c')]+'%'};return _0xa9ec99;})});}_0x451677=_[_0xdc03('0x4d')]({},_0x451677,_0x2a9677[_0xdc03('0x4f')]);return db[_0xdc03('0x60')][_0xdc03('0x2b')]({'where':_0x451677[_0xdc03('0x4a')]})[_0xdc03('0x1e')](function(_0x3edff7){_0x1cb1b0[_0xdc03('0x2b')]=_0x3edff7;if(_0x2a9677['query'][_0xdc03('0x50')]){_0x451677['include']=[{'all':!![]}];}return db['Disposition'][_0xdc03('0x52')](_0x451677);})[_0xdc03('0x1e')](function(_0x50b374){_0x1cb1b0[_0xdc03('0x53')]=_0x50b374;return _0x1cb1b0;});}})[_0xdc03('0x1e')](respondWithFilteredResult(_0x160cfe,_0x451677))['catch'](handleError(_0x160cfe,null));};exports[_0xdc03('0x62')]=function(_0x3d7507,_0x6d346b,_0x33cf3e){return db[_0xdc03('0x3c')]['find']({'where':{'id':_0x3d7507[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x6d346b,null))[_0xdc03('0x1e')](function(_0x5163ed){if(_0x5163ed){return _0x5163ed['removeDispositions'](_0x3d7507[_0xdc03('0x41')][_0xdc03('0x63')]);}})['then'](respondWithStatusCode(_0x6d346b,null))[_0xdc03('0x54')](handleError(_0x6d346b,null));};exports[_0xdc03('0x64')]=function(_0x1f552f,_0x5e203f,_0x2e325f){if(_0x1f552f[_0xdc03('0x5b')]['id']){delete _0x1f552f[_0xdc03('0x5b')]['id'];}return db[_0xdc03('0x3c')][_0xdc03('0x5a')]({'where':{'id':_0x1f552f[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x5e203f,null))[_0xdc03('0x1e')](function(_0x351067){if(_0x351067){_0x1f552f[_0xdc03('0x5b')][_0xdc03('0x5e')]=_0x351067['id'];return db['CannedAnswer'][_0xdc03('0x5f')](_0x1f552f[_0xdc03('0x5b')]);}})['then'](respondWithResult(_0x5e203f,null))[_0xdc03('0x54')](handleError(_0x5e203f,null));};exports['getAnswers']=function(_0x3fa927,_0xa63ab3,_0x4da1a6){var _0x52f57c={'raw':![],'where':{}};var _0x4e255f={};var _0x46094b={'count':0x0,'rows':[]};return db[_0xdc03('0x3c')][_0xdc03('0x65')]({'where':{'id':_0x3fa927[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0xa63ab3,null))[_0xdc03('0x1e')](function(_0x3a2a0e){if(_0x3a2a0e){_0x4e255f[_0xdc03('0x3f')]=_['keys'](db[_0xdc03('0x66')][_0xdc03('0x58')]);_0x4e255f['query']=_[_0xdc03('0x59')](_0x3fa927['query']);_0x4e255f['filters']=_[_0xdc03('0x43')](_0x4e255f[_0xdc03('0x3f')],_0x4e255f[_0xdc03('0x41')]);_0x52f57c[_0xdc03('0x44')]=_[_0xdc03('0x43')](_0x4e255f[_0xdc03('0x3f')],qs[_0xdc03('0x45')](_0x3fa927[_0xdc03('0x41')][_0xdc03('0x45')]));_0x52f57c[_0xdc03('0x44')]=_0x52f57c[_0xdc03('0x44')][_0xdc03('0x46')]?_0x52f57c[_0xdc03('0x44')]:_0x4e255f[_0xdc03('0x3f')];if(!_0x3fa927[_0xdc03('0x41')][_0xdc03('0x67')](_0xdc03('0x47'))){_0x52f57c[_0xdc03('0x48')]=qs[_0xdc03('0x48')](_0x3fa927[_0xdc03('0x41')][_0xdc03('0x48')]);_0x52f57c['offset']=qs[_0xdc03('0x2c')](_0x3fa927['query']['offset']);}_0x52f57c[_0xdc03('0x61')]=qs['sort'](_0x3fa927[_0xdc03('0x41')]['sort']);_0x52f57c[_0xdc03('0x4a')]=qs[_0xdc03('0x42')](_[_0xdc03('0x4b')](_0x3fa927['query'],_0x4e255f[_0xdc03('0x42')]));_0x52f57c['where'][_0xdc03('0x5e')]=_0x3a2a0e['id'];if(_0x3fa927[_0xdc03('0x41')][_0xdc03('0x4c')]){_0x52f57c[_0xdc03('0x4a')]=_[_0xdc03('0x4d')](_0x52f57c[_0xdc03('0x4a')],{'$or':_[_0xdc03('0x40')](_0x52f57c[_0xdc03('0x44')],function(_0x57fd5c){var _0x498766={};_0x498766[_0x57fd5c]={'$like':'%'+_0x3fa927[_0xdc03('0x41')][_0xdc03('0x4c')]+'%'};return _0x498766;})});}_0x52f57c=_[_0xdc03('0x4d')]({},_0x52f57c,_0x3fa927[_0xdc03('0x4f')]);return db[_0xdc03('0x66')][_0xdc03('0x2b')]({'where':_0x52f57c[_0xdc03('0x4a')]})['then'](function(_0x32a31e){_0x46094b[_0xdc03('0x2b')]=_0x32a31e;if(_0x3fa927[_0xdc03('0x41')]['includeAll']){_0x52f57c[_0xdc03('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0xdc03('0x52')](_0x52f57c);})[_0xdc03('0x1e')](function(_0x3e3c72){_0x46094b[_0xdc03('0x53')]=_0x3e3c72;return _0x46094b;});}})[_0xdc03('0x1e')](respondWithFilteredResult(_0xa63ab3,_0x52f57c))[_0xdc03('0x54')](handleError(_0xa63ab3,null));};exports['removeAnswers']=function(_0x50502a,_0x38b7cd,_0x4791d0){return db['MailAccount'][_0xdc03('0x5a')]({'where':{'id':_0x50502a[_0xdc03('0x56')]['id']}})['then'](handleEntityNotFound(_0x38b7cd,null))['then'](function(_0x50f5f5){if(_0x50f5f5){return _0x50f5f5[_0xdc03('0x68')](_0x50502a[_0xdc03('0x41')]['ids']);}})[_0xdc03('0x1e')](respondWithStatusCode(_0x38b7cd,null))[_0xdc03('0x54')](handleError(_0x38b7cd,null));};exports[_0xdc03('0x5f')]=function(_0x252b1e,_0x389f3e){var _0x4d0af4={'name':_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x34')],'key':_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x3e')],'email':_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x69')],'ListId':_0x252b1e[_0xdc03('0x5b')]['ListId'],'active':!_['isNil'](_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x6a')])?_0x252b1e['body'][_0xdc03('0x6a')]:!![],'description':_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x6b')]||null,'Imap':{},'Smtp':{}};if(_[_0xdc03('0x6c')](_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x6d')])){if(_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x6e')]){_0x4d0af4[_0xdc03('0x38')][_0xdc03('0x6f')]=_0x4d0af4[_0xdc03('0x3a')]['user']=_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x70')];_0x4d0af4[_0xdc03('0x38')][_0xdc03('0x71')]=_0x4d0af4['Smtp'][_0xdc03('0x72')]=_0x252b1e[_0xdc03('0x5b')]['cpassword'];}else{_0x4d0af4[_0xdc03('0x38')]['authentication']=_0x4d0af4[_0xdc03('0x3a')][_0xdc03('0x73')]=![];}_0x4d0af4['Imap'][_0xdc03('0x74')]=_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x38')][_0xdc03('0x74')];_0x4d0af4['Imap'][_0xdc03('0x75')]=_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x38')]['port'];_0x4d0af4[_0xdc03('0x3a')][_0xdc03('0x74')]=_0x252b1e['body'][_0xdc03('0x3a')][_0xdc03('0x74')];_0x4d0af4[_0xdc03('0x3a')]['port']=_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x3a')][_0xdc03('0x75')];}else{_0x4d0af4[_0xdc03('0x38')][_0xdc03('0x76')]=_0x4d0af4[_0xdc03('0x3a')][_0xdc03('0x76')]=_0x252b1e['body'][_0xdc03('0x6d')];_0x4d0af4['Imap'][_0xdc03('0x6f')]=_0x4d0af4[_0xdc03('0x3a')][_0xdc03('0x6f')]=_0x252b1e['body'][_0xdc03('0x70')];_0x4d0af4[_0xdc03('0x38')][_0xdc03('0x71')]=_0x4d0af4[_0xdc03('0x3a')]['pass']=_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x77')];}return db[_0xdc03('0x3c')]['create'](_0x4d0af4,{'include':[{'model':db[_0xdc03('0x39')],'as':_0xdc03('0x3a')},{'model':db[_0xdc03('0x37')],'as':_0xdc03('0x38')}]})['then'](function(_0x17a46a){var _0x3799e5=_0x252b1e[_0xdc03('0x6f')][_0xdc03('0x78')]({'plain':!![]});if(!_0x3799e5)throw new Error(_0xdc03('0x79'));if(_0x3799e5['role']===_0xdc03('0x6f')){var _0x56a98c=_0x17a46a['get']({'plain':!![]});return db[_0xdc03('0x7a')][_0xdc03('0x5a')]({'where':{'name':'MailAccounts','userProfileId':_0x3799e5[_0xdc03('0x7b')]},'raw':!![]})[_0xdc03('0x1e')](function(_0x3d8503){if(_0x3d8503&&_0x3d8503[_0xdc03('0x7c')]===0x0){return db['UserProfileResource'][_0xdc03('0x5f')]({'name':_0x56a98c[_0xdc03('0x34')],'resourceId':_0x56a98c['id'],'type':_0x3d8503[_0xdc03('0x34')],'sectionId':_0x3d8503['id']},{})['then'](function(){return _0x17a46a;});}else{return _0x17a46a;}})[_0xdc03('0x54')](function(_0x24b221){logger[_0xdc03('0x23')](_0xdc03('0x7d'),_0x24b221);throw _0x24b221;});}return _0x17a46a;})[_0xdc03('0x1e')](respondWithResult(_0x389f3e,0xc9))['catch'](handleError(_0x389f3e,null));};exports[_0xdc03('0x7e')]=function(_0x241f70,_0x33a01b,_0x4ccc43){return db[_0xdc03('0x3c')][_0xdc03('0x65')]({'where':{'id':_0x241f70[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x33a01b,null))[_0xdc03('0x1e')](function(_0x473626){if(_0x473626){return _0x473626[_0xdc03('0x7e')]();}return null;})[_0xdc03('0x1e')](respondWithResult(_0x33a01b,null))[_0xdc03('0x54')](handleError(_0x33a01b,null));};exports['addImap']=function(_0x56b70d,_0x37400e,_0x2d8865){if(_0x56b70d[_0xdc03('0x5b')]['id']){delete _0x56b70d[_0xdc03('0x5b')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x56b70d['params']['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x37400e,null))['then'](function(_0x40363e){if(_0x40363e){_0x56b70d['body'][_0xdc03('0x5e')]=_0x40363e['id'];return db['MailServerIn'][_0xdc03('0x5f')](_0x56b70d[_0xdc03('0x5b')]);}})[_0xdc03('0x1e')](respondWithResult(_0x37400e,null))[_0xdc03('0x54')](handleError(_0x37400e,null));};exports[_0xdc03('0x7f')]=function(_0x2fa197,_0x14630f,_0x54dccb){return db[_0xdc03('0x3c')][_0xdc03('0x65')]({'where':{'id':_0x2fa197[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x14630f,null))[_0xdc03('0x1e')](function(_0x191f35){if(_0x191f35){return _0x191f35[_0xdc03('0x80')](null);}return null;})[_0xdc03('0x1e')](respondWithStatusCode(_0x14630f,null))[_0xdc03('0x54')](handleError(_0x14630f,null));};exports[_0xdc03('0x81')]=function(_0x56216d,_0x43a00a,_0x4557cc){return db['MailAccount']['findOne']({'where':{'id':_0x56216d['params']['id']}})['then'](handleEntityNotFound(_0x43a00a,null))[_0xdc03('0x1e')](function(_0x352c49){if(_0x352c49){return _0x352c49['getSmtp']();}return null;})['then'](respondWithResult(_0x43a00a,null))[_0xdc03('0x54')](handleError(_0x43a00a,null));};exports[_0xdc03('0x82')]=function(_0x45838d,_0x4643a9,_0x322cef){if(_0x45838d[_0xdc03('0x5b')]['id']){delete _0x45838d[_0xdc03('0x5b')]['id'];}return db[_0xdc03('0x3c')][_0xdc03('0x5a')]({'where':{'id':_0x45838d[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x4643a9,null))[_0xdc03('0x1e')](function(_0x1c5229){if(_0x1c5229){_0x45838d[_0xdc03('0x5b')][_0xdc03('0x5e')]=_0x1c5229['id'];return db[_0xdc03('0x39')][_0xdc03('0x5f')](_0x45838d[_0xdc03('0x5b')]);}})[_0xdc03('0x1e')](respondWithResult(_0x4643a9,null))['catch'](handleError(_0x4643a9,null));};exports[_0xdc03('0x83')]=function(_0x359d0b,_0x46aacc,_0x13e696){return db[_0xdc03('0x3c')][_0xdc03('0x65')]({'where':{'id':_0x359d0b[_0xdc03('0x56')]['id']}})['then'](handleEntityNotFound(_0x46aacc,null))[_0xdc03('0x1e')](function(_0x2659cb){if(_0x2659cb){return _0x2659cb[_0xdc03('0x84')](null);}return null;})['then'](respondWithStatusCode(_0x46aacc,null))[_0xdc03('0x54')](handleError(_0x46aacc,null));};exports[_0xdc03('0x85')]=function(_0x340506,_0x56ad86,_0x24fe57){return db[_0xdc03('0x86')][_0xdc03('0x5a')]({'where':{'id':_0x340506[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x56ad86,null))[_0xdc03('0x1e')](function(_0x10644a){if(_0x10644a){return _0x10644a['addInteraction'](_0x340506['body'][_0xdc03('0x63')],_[_0xdc03('0x87')](_0x340506[_0xdc03('0x5b')],['ids','id'])||{});}})['then'](respondWithResult(_0x56ad86,null))[_0xdc03('0x54')](handleError(_0x56ad86,null));};exports['getInteractions']=function(_0x3767e1,_0x295ca4,_0x2fd7f3){var _0x3736a0={'raw':![],'where':{}};var _0x3da0ca={};var _0x238ff3={'count':0x0,'rows':[]};return db[_0xdc03('0x3c')]['findOne']({'where':{'id':_0x3767e1['params']['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x295ca4,null))['then'](function(_0x59c2d0){if(_0x59c2d0){_0x3da0ca[_0xdc03('0x3f')]=_[_0xdc03('0x59')](db['MailInteraction']['rawAttributes']);_0x3da0ca['query']=_[_0xdc03('0x59')](_0x3767e1[_0xdc03('0x41')]);_0x3da0ca[_0xdc03('0x42')]=_[_0xdc03('0x43')](_0x3da0ca[_0xdc03('0x3f')],_0x3da0ca[_0xdc03('0x41')]);_0x3736a0[_0xdc03('0x44')]=_[_0xdc03('0x43')](_0x3da0ca[_0xdc03('0x3f')],qs[_0xdc03('0x45')](_0x3767e1[_0xdc03('0x41')][_0xdc03('0x45')]));_0x3736a0[_0xdc03('0x44')]=_0x3736a0[_0xdc03('0x44')][_0xdc03('0x46')]?_0x3736a0[_0xdc03('0x44')]:_0x3da0ca[_0xdc03('0x3f')];if(!_0x3767e1[_0xdc03('0x41')][_0xdc03('0x67')](_0xdc03('0x47'))){_0x3736a0[_0xdc03('0x48')]=qs['limit'](_0x3767e1['query'][_0xdc03('0x48')]);_0x3736a0[_0xdc03('0x2c')]=qs[_0xdc03('0x2c')](_0x3767e1[_0xdc03('0x41')][_0xdc03('0x2c')]);}_0x3736a0['order']=qs[_0xdc03('0x49')](_0x3767e1[_0xdc03('0x41')][_0xdc03('0x49')]);_0x3736a0[_0xdc03('0x4a')]=qs[_0xdc03('0x42')](_[_0xdc03('0x4b')](_0x3767e1['query'],_0x3da0ca['filters']));_0x3736a0['where'][_0xdc03('0x5e')]=_0x59c2d0['id'];if(_0x3767e1[_0xdc03('0x41')]['filter']){_0x3736a0[_0xdc03('0x4a')]=_[_0xdc03('0x4d')](_0x3736a0[_0xdc03('0x4a')],{'$or':_[_0xdc03('0x40')](_0x3736a0[_0xdc03('0x44')],function(_0x1f8581){var _0x52e1eb={};_0x52e1eb[_0x1f8581]={'$like':'%'+_0x3767e1[_0xdc03('0x41')][_0xdc03('0x4c')]+'%'};return _0x52e1eb;})});}_0x3736a0=_[_0xdc03('0x4d')]({},_0x3736a0,_0x3767e1[_0xdc03('0x4f')]);return db[_0xdc03('0x86')][_0xdc03('0x2b')]({'where':_0x3736a0[_0xdc03('0x4a')]})[_0xdc03('0x1e')](function(_0x44e3f9){_0x238ff3[_0xdc03('0x2b')]=_0x44e3f9;if(_0x3767e1['query'][_0xdc03('0x50')]){_0x3736a0[_0xdc03('0x51')]=[{'model':db['CmContact'],'as':_0xdc03('0x88'),'required':![]},{'model':db[_0xdc03('0x89')],'as':_0xdc03('0x8a'),'attributes':['name',_0xdc03('0x8b'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xdc03('0x8c'),'attributes':['id',_0xdc03('0x34'),_0xdc03('0x8d')],'where':_0x3767e1[_0xdc03('0x41')][_0xdc03('0x8e')]?{'id':_0x3767e1[_0xdc03('0x41')][_0xdc03('0x8e')]}:undefined,'required':_0x3767e1[_0xdc03('0x41')]['tag']?!![]:![]}];}return db[_0xdc03('0x86')][_0xdc03('0x52')](_0x3736a0);})['then'](function(_0x136ed6){_0x238ff3[_0xdc03('0x53')]=_0x136ed6;return _0x238ff3;});}})[_0xdc03('0x1e')](respondWithFilteredResult(_0x295ca4,_0x3736a0))[_0xdc03('0x54')](handleError(_0x295ca4,null));};exports[_0xdc03('0x8f')]=function(_0x5964fb,_0x4722c2,_0x2e7707){return db[_0xdc03('0x3c')]['findOne']({'where':{'id':_0x5964fb[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x4722c2,null))[_0xdc03('0x1e')](function(_0x545d4b){if(_0x545d4b){return db['sequelize']['transaction'](function(_0x43c045){return db[_0xdc03('0x90')][_0xdc03('0x31')]({'where':{'MailAccountId':_0x5964fb['params']['id']},'transaction':_0x43c045})[_0xdc03('0x1e')](function(_0x2e1eb7){var _0x44ffdb=_[_0xdc03('0x40')](_0x5964fb[_0xdc03('0x5b')],function(_0x51ef27){_0x51ef27[_0xdc03('0x5e')]=_0x5964fb[_0xdc03('0x56')]['id'];return _0x51ef27;});return db[_0xdc03('0x90')]['bulkCreate'](_0x44ffdb,{'transaction':_0x43c045});});})[_0xdc03('0x1e')](function(){return db[_0xdc03('0x90')]['findAndCountAll']({'where':{'MailAccountId':_0x5964fb[_0xdc03('0x56')]['id']},'order':_0xdc03('0x91')});});}})[_0xdc03('0x1e')](respondWithResult(_0x4722c2,null))[_0xdc03('0x54')](handleError(_0x4722c2,null));};exports[_0xdc03('0x92')]=function(_0x18424b,_0x539e49,_0x49fdb0){var _0x6cc669={};var _0xc5a33d={};var _0x46d09d;var _0x34779b;return db[_0xdc03('0x3c')][_0xdc03('0x65')]({'where':{'id':_0x18424b['params']['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x539e49,null))['then'](function(_0x34ad49){if(_0x34ad49){_0x46d09d=_0x34ad49;_0xc5a33d[_0xdc03('0x3f')]=_[_0xdc03('0x59')](db[_0xdc03('0x90')][_0xdc03('0x58')]);_0xc5a33d['query']=_[_0xdc03('0x59')](_0x18424b[_0xdc03('0x41')]);_0xc5a33d[_0xdc03('0x42')]=_[_0xdc03('0x43')](_0xc5a33d[_0xdc03('0x3f')],_0xc5a33d[_0xdc03('0x41')]);_0x6cc669['attributes']=_[_0xdc03('0x43')](_0xc5a33d[_0xdc03('0x3f')],qs['fields'](_0x18424b[_0xdc03('0x41')]['fields']));_0x6cc669['attributes']=_0x6cc669[_0xdc03('0x44')][_0xdc03('0x46')]?_0x6cc669['attributes']:_0xc5a33d[_0xdc03('0x3f')];_0x6cc669[_0xdc03('0x61')]=qs[_0xdc03('0x49')](_0x18424b[_0xdc03('0x41')][_0xdc03('0x49')]);_0x6cc669['where']=qs[_0xdc03('0x42')](_['pick'](_0x18424b[_0xdc03('0x41')],_0xc5a33d[_0xdc03('0x42')]));if(_0x18424b[_0xdc03('0x41')][_0xdc03('0x4c')]){_0x6cc669[_0xdc03('0x4a')]=_[_0xdc03('0x4d')](_0x6cc669['where'],{'$or':_[_0xdc03('0x40')](_0x6cc669[_0xdc03('0x44')],function(_0x11e400){var _0x259364={};_0x259364[_0x11e400]={'$like':'%'+_0x18424b['query']['filter']+'%'};return _0x259364;})});}_0x6cc669=_[_0xdc03('0x4d')]({},_0x6cc669,_0x18424b[_0xdc03('0x4f')]);return _0x46d09d[_0xdc03('0x92')](_0x6cc669);}})[_0xdc03('0x1e')](function(_0xab0d6d){if(_0xab0d6d){_0x34779b=_0xab0d6d['length'];if(!_0x18424b['query']['hasOwnProperty']('nolimit')){_0x6cc669[_0xdc03('0x48')]=qs[_0xdc03('0x48')](_0x18424b['query'][_0xdc03('0x48')]);_0x6cc669['offset']=qs[_0xdc03('0x2c')](_0x18424b['query'][_0xdc03('0x2c')]);}return _0x46d09d[_0xdc03('0x92')](_0x6cc669);}})['then'](function(_0x478c6e){if(_0x478c6e){return _0x478c6e?{'count':_0x34779b,'rows':_0x478c6e}:null;}})['then'](respondWithResult(_0x539e49,null))['catch'](handleError(_0x539e49,null));};exports[_0xdc03('0x93')]=function(_0x5bf7d5,_0x458da3,_0x1574e8){var _0x473c28={'raw':!![],'where':{}};var _0x1ffe7b={};var _0x56f0b8={'count':0x0,'rows':[]};return db['MailAccount'][_0xdc03('0x65')]({'where':{'id':_0x5bf7d5[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x458da3,null))['then'](function(_0x2d9c79){if(_0x2d9c79){_0x1ffe7b['model']=_[_0xdc03('0x59')](db['MailMessage'][_0xdc03('0x58')]);_0x1ffe7b[_0xdc03('0x41')]=_[_0xdc03('0x59')](_0x5bf7d5[_0xdc03('0x41')]);_0x1ffe7b[_0xdc03('0x42')]=_[_0xdc03('0x43')](_0x1ffe7b[_0xdc03('0x3f')],_0x1ffe7b[_0xdc03('0x41')]);_0x473c28[_0xdc03('0x44')]=_[_0xdc03('0x43')](_0x1ffe7b[_0xdc03('0x3f')],qs['fields'](_0x5bf7d5[_0xdc03('0x41')]['fields']));_0x473c28['attributes']=_0x473c28[_0xdc03('0x44')][_0xdc03('0x46')]?_0x473c28[_0xdc03('0x44')]:_0x1ffe7b['model'];if(!_0x5bf7d5['query'][_0xdc03('0x67')](_0xdc03('0x47'))){_0x473c28[_0xdc03('0x48')]=qs[_0xdc03('0x48')](_0x5bf7d5[_0xdc03('0x41')]['limit']);_0x473c28[_0xdc03('0x2c')]=qs[_0xdc03('0x2c')](_0x5bf7d5[_0xdc03('0x41')][_0xdc03('0x2c')]);}_0x473c28[_0xdc03('0x61')]=qs[_0xdc03('0x49')](_0x5bf7d5['query'][_0xdc03('0x49')]);_0x473c28[_0xdc03('0x4a')]=qs['filters'](_[_0xdc03('0x4b')](_0x5bf7d5[_0xdc03('0x41')],_0x1ffe7b[_0xdc03('0x42')]));_0x473c28[_0xdc03('0x4a')][_0xdc03('0x5e')]=_0x2d9c79['id'];if(_0x5bf7d5[_0xdc03('0x41')]['filter']){_0x473c28[_0xdc03('0x4a')]=_['merge'](_0x473c28[_0xdc03('0x4a')],{'$or':_[_0xdc03('0x40')](_0x473c28['attributes'],function(_0x32e259){var _0x12e3d6={};_0x12e3d6[_0x32e259]={'$like':'%'+_0x5bf7d5[_0xdc03('0x41')][_0xdc03('0x4c')]+'%'};return _0x12e3d6;})});}if(_0x5bf7d5[_0xdc03('0x41')][_0xdc03('0x94')]){var _0x99781d=_0x5bf7d5[_0xdc03('0x41')][_0xdc03('0x94')][_0xdc03('0x95')](',');var _0x3b0a3b={};_0x3b0a3b[_0x99781d[0x0]]={'$gte':moment(_0x99781d[0x1])['format'](_0xdc03('0x96'))};_0x473c28[_0xdc03('0x4a')]=_[_0xdc03('0x4d')](_0x473c28[_0xdc03('0x4a')],_0x3b0a3b);}_0x473c28=_[_0xdc03('0x4d')]({},_0x473c28,_0x5bf7d5['options']);return db[_0xdc03('0x97')]['count']({'where':_0x473c28['where']})[_0xdc03('0x1e')](function(_0x5374b4){_0x56f0b8[_0xdc03('0x2b')]=_0x5374b4;if(_0x5bf7d5[_0xdc03('0x41')]['includeAll']){_0x473c28[_0xdc03('0x51')]=[{'all':!![]}];}return db[_0xdc03('0x97')][_0xdc03('0x52')](_0x473c28);})[_0xdc03('0x1e')](function(_0x529757){_0x56f0b8[_0xdc03('0x53')]=_0x529757;return _0x56f0b8;});}})[_0xdc03('0x1e')](respondWithFilteredResult(_0x458da3,_0x473c28))[_0xdc03('0x54')](handleError(_0x458da3,null));};exports[_0xdc03('0x35')]=function(_0xe3cb4e,_0x396340,_0x3d77f1){var _0x5a8f86,_0xc4f6b3={},_0x1a2164;if(_0xe3cb4e[_0xdc03('0x5b')]['to']){_0x1a2164=_0xe3cb4e[_0xdc03('0x5b')]['to']['split'](',')[0x0];}return db[_0xdc03('0x3c')][_0xdc03('0x5a')]({'where':{'id':_0xe3cb4e[_0xdc03('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xdc03('0x98')],'as':_0xdc03('0x99'),'where':{'email':_0x1a2164},'limit':0x1,'order':[[_0xdc03('0x9a'),_0xdc03('0x9b')]]}]},{'model':db[_0xdc03('0x39')],'as':_0xdc03('0x3a'),'raw':!![]}]})[_0xdc03('0x1e')](handleEntityNotFound(_0x396340,null))['then'](function(_0x2d1fc7){if(_0x2d1fc7){_0x5a8f86=_0x2d1fc7;if(_0x2d1fc7[_0xdc03('0x3a')]){if(_[_0xdc03('0x6c')](_0xe3cb4e['body']['from'])){_0xe3cb4e['body'][_0xdc03('0x9c')]=util['format'](_0xdc03('0x9d'),_0x2d1fc7[_0xdc03('0x34')],_0x2d1fc7[_0xdc03('0x69')]||_0x2d1fc7['Smtp'][_0xdc03('0x6f')]);}if(_0xe3cb4e[_0xdc03('0x5b')][_0xdc03('0x9e')]&&_0xe3cb4e[_0xdc03('0x5b')][_0xdc03('0x9e')]['length']){for(var _0x462a76=0x0;_0x462a76<_0xe3cb4e[_0xdc03('0x5b')]['attachments']['length'];_0x462a76+=0x1){_0xe3cb4e['body'][_0xdc03('0x9e')][_0x462a76]={'filename':_0xe3cb4e[_0xdc03('0x5b')][_0xdc03('0x9e')][_0x462a76]['name'],'path':path['join'](config['root'],_0xdc03('0x9f'),_0xe3cb4e[_0xdc03('0x5b')][_0xdc03('0x9e')][_0x462a76][_0xdc03('0xa0')])};}}var _0x36759d={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x2d1fc7[_0xdc03('0x3a')]['service'])){if(_0x2d1fc7[_0xdc03('0x3a')]['authentication']){_0x36759d[_0xdc03('0xa1')]={'user':_0x2d1fc7[_0xdc03('0x3a')]['user'],'pass':_0x2d1fc7['Smtp'][_0xdc03('0x72')]};}_0x36759d[_0xdc03('0x74')]=_0x2d1fc7[_0xdc03('0x3a')][_0xdc03('0x74')];_0x36759d[_0xdc03('0x75')]=_0x2d1fc7[_0xdc03('0x3a')]['port'];_0x36759d[_0xdc03('0xa2')]=_0x2d1fc7[_0xdc03('0x3a')][_0xdc03('0xa2')];}else{_0x36759d[_0xdc03('0x76')]=_0x2d1fc7[_0xdc03('0x3a')][_0xdc03('0x76')];_0x36759d['auth']={'user':_0x2d1fc7[_0xdc03('0x3a')][_0xdc03('0x6f')],'pass':_0x2d1fc7[_0xdc03('0x3a')][_0xdc03('0x72')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x36759d,'message':_0xe3cb4e['body']});}else{throw new Error(_0xdc03('0xa3'));}}})[_0xdc03('0x1e')](function(_0x55a316){if(_0x55a316){_0xc4f6b3=_0x55a316;if(_0x5a8f86[_0xdc03('0xa4')]){if(_0x5a8f86[_0xdc03('0xa4')]['Contacts'][_0xdc03('0x46')]){return _0x5a8f86['List'][_0xdc03('0x99')][0x0];}else{return db[_0xdc03('0x98')][_0xdc03('0x5f')](_[_0xdc03('0xa5')](_0xe3cb4e[_0xdc03('0x5b')],{'firstName':_0xe3cb4e[_0xdc03('0x5b')]['to'],'email':_0xe3cb4e['body']['to'],'phone':_0xe3cb4e[_0xdc03('0x5b')]['to'],'ListId':_0x5a8f86['ListId']}));}}else{throw new Error(_0xdc03('0xa3'));}}})[_0xdc03('0x1e')](function(_0x430443){if(_0x430443){var _0x3fe728={'UserId':_0xe3cb4e[_0xdc03('0x6f')]['id'],'ContactId':_0x430443['id'],'MailAccountId':_0x5a8f86['id'],'inReplyTo':_0xc4f6b3['messageId'],'to':_0xe3cb4e[_0xdc03('0x5b')][_0xdc03('0x9c')],'cc':_0xe3cb4e[_0xdc03('0x5b')]['cc'],'subject':_0xe3cb4e[_0xdc03('0x5b')][_0xdc03('0xa6')],'attach':_0xe3cb4e[_0xdc03('0x5b')][_0xdc03('0xa7')],'firstMsgDirection':_0xdc03('0xa8'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xdc03('0xa8'),'lastMsgBody':_0xe3cb4e[_0xdc03('0x5b')][_0xdc03('0x5b')],'Messages':[_[_0xdc03('0x4d')](_0xe3cb4e[_0xdc03('0x5b')],{'messageId':_0xc4f6b3['messageId'],'sentAt':moment()['format'](_0xdc03('0x96')),'read':!![],'MailAccountId':_0x5a8f86['id'],'UserId':_0xe3cb4e[_0xdc03('0x6f')]['id'],'ContactId':_0x430443['id']})]};if(_0xe3cb4e['body']['Interaction']){_0x3fe728=_['merge'](_0x3fe728,_0xe3cb4e['body'][_0xdc03('0xa9')]);}return db[_0xdc03('0x86')][_0xdc03('0x5f')](_0x3fe728,{'include':[{'model':db[_0xdc03('0x97')],'as':'Messages'}]});}})['then'](respondWithResult(_0x396340,null))[_0xdc03('0x54')](handleError(_0x396340,null));};exports[_0xdc03('0xaa')]=function(_0x148b83,_0x317c7d,_0x3adca7){return db[_0xdc03('0x3c')][_0xdc03('0x5a')]({'where':{'id':_0x148b83['params']['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0xdc03('0x1e')](handleEntityNotFound(_0x317c7d,null))[_0xdc03('0x1e')](function(_0x48e890){if(_0x48e890&&_0x48e890[_0xdc03('0x3a')]){var _0x3c72ee={'id':_0x48e890['id'],'tls':{'rejectUnauthorized':![]}};if(_0x48e890[_0xdc03('0x3a')][_0xdc03('0x76')]){_0x3c72ee[_0xdc03('0x76')]=_0x48e890[_0xdc03('0x3a')][_0xdc03('0x76')];}else{_0x3c72ee[_0xdc03('0x74')]=_0x48e890[_0xdc03('0x3a')][_0xdc03('0x74')];_0x3c72ee[_0xdc03('0x75')]=_0x48e890[_0xdc03('0x3a')][_0xdc03('0x75')];_0x3c72ee[_0xdc03('0xa2')]=_0x48e890['Smtp']['secure'];}if(_0x48e890[_0xdc03('0x3a')][_0xdc03('0x73')]){_0x3c72ee[_0xdc03('0xa1')]={'user':_0x48e890[_0xdc03('0x3a')]['user'],'pass':_0x48e890[_0xdc03('0x3a')][_0xdc03('0x72')]};}return respondWithRpcPromise(_0xdc03('0xab'),_0xdc03('0xaa'),{'account':_0x3c72ee});}})[_0xdc03('0x1e')](respondWithResult(_0x317c7d,null))[_0xdc03('0x54')](handleError(_0x317c7d,null));};exports[_0xdc03('0x31')]=function(_0x18b586,_0x1d3aec){return db['MailAccount']['find']({'where':{'id':_0x18b586[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x1d3aec,null))['then'](function(_0xf8e931){if(_0xf8e931&&_0xf8e931[_0xdc03('0x76')]){throw new db[(_0xdc03('0x1b'))][(_0xdc03('0xac'))](_0xdc03('0xad'));}return _0xf8e931;})[_0xdc03('0x1e')](removeEntity(_0x1d3aec,null))[_0xdc03('0x54')](handleError(_0x1d3aec,null));};exports[_0xdc03('0xae')]=function(_0x481c7a,_0x57c2ea,_0x4ae3db){return db[_0xdc03('0x3c')]['find']({'where':{'id':_0x481c7a[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x57c2ea,null))['then'](function(_0x12c94c){if(_0x12c94c){return _0x12c94c[_0xdc03('0xae')](_0x481c7a[_0xdc03('0x5b')][_0xdc03('0x63')],_['omit'](_0x481c7a['body'],[_0xdc03('0x63'),'id'])||{})[_0xdc03('0xaf')](function(_0x1f7df9){for(var _0x10f41d=0x0;_0x10f41d<_0x481c7a[_0xdc03('0x5b')][_0xdc03('0x63')][_0xdc03('0x46')];_0x10f41d+=0x1){socket[_0xdc03('0xb0')]('userMailAccount:save',{'UserId':_0x481c7a['body'][_0xdc03('0x63')][_0x10f41d],'MailAccountId':_0x481c7a[_0xdc03('0x56')]['id']});}return _0x1f7df9;});}})[_0xdc03('0x1e')](respondWithResult(_0x57c2ea,null))[_0xdc03('0x54')](handleError(_0x57c2ea,null));};exports['removeAgents']=function(_0x4de61e,_0x343a00,_0x33bafb){return db[_0xdc03('0x3c')]['find']({'where':{'id':_0x4de61e[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x343a00,null))[_0xdc03('0x1e')](function(_0x394ccd){if(_0x394ccd){return _0x394ccd[_0xdc03('0xb1')](_0x4de61e[_0xdc03('0x41')][_0xdc03('0x63')])['then'](function(){if(_[_0xdc03('0xb2')](_0x4de61e['query'][_0xdc03('0x63')])){for(var _0x4f636e=0x0;_0x4f636e<_0x4de61e[_0xdc03('0x41')]['ids'][_0xdc03('0x46')];_0x4f636e+=0x1){socket[_0xdc03('0xb0')](_0xdc03('0xb3'),{'UserId':Number(_0x4de61e[_0xdc03('0x41')][_0xdc03('0x63')][_0x4f636e]),'MailAccountId':Number(_0x4de61e[_0xdc03('0x56')]['id'])});}}else{socket[_0xdc03('0xb0')]('userMailAccount:remove',{'UserId':Number(_0x4de61e[_0xdc03('0x41')][_0xdc03('0x63')]),'MailAccountId':Number(_0x4de61e['params']['id'])});}});}})[_0xdc03('0x1e')](respondWithStatusCode(_0x343a00,null))[_0xdc03('0x54')](handleError(_0x343a00,null));};exports['getAgents']=function(_0x3610ab,_0xe21373,_0x5cd161){var _0x3a2cca={};var _0x515112={};var _0x5aa30c;var _0x392df2;return db['MailAccount'][_0xdc03('0x65')]({'where':{'id':_0x3610ab['params']['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0xe21373,null))[_0xdc03('0x1e')](function(_0x582582){if(_0x582582){_0x5aa30c=_0x582582;_0x515112[_0xdc03('0x3f')]=_['keys'](db[_0xdc03('0x89')][_0xdc03('0x58')]);_0x515112['query']=_[_0xdc03('0x59')](_0x3610ab[_0xdc03('0x41')]);_0x515112[_0xdc03('0x42')]=_[_0xdc03('0x43')](_0x515112[_0xdc03('0x3f')],_0x515112[_0xdc03('0x41')]);_0x3a2cca[_0xdc03('0x44')]=_[_0xdc03('0x43')](_0x515112[_0xdc03('0x3f')],qs[_0xdc03('0x45')](_0x3610ab['query'][_0xdc03('0x45')]));_0x3a2cca[_0xdc03('0x44')]=_0x3a2cca[_0xdc03('0x44')]['length']?_0x3a2cca[_0xdc03('0x44')]:_0x515112[_0xdc03('0x3f')];_0x3a2cca[_0xdc03('0x61')]=qs[_0xdc03('0x49')](_0x3610ab[_0xdc03('0x41')][_0xdc03('0x49')]);_0x3a2cca[_0xdc03('0x4a')]=qs[_0xdc03('0x42')](_[_0xdc03('0x4b')](_0x3610ab[_0xdc03('0x41')],_0x515112[_0xdc03('0x42')]));if(_0x3610ab[_0xdc03('0x41')][_0xdc03('0x4c')]){_0x3a2cca[_0xdc03('0x4a')]=_['merge'](_0x3a2cca['where'],{'$or':_['map'](_0x3a2cca[_0xdc03('0x44')],function(_0xbc3b00){var _0x1eb6d5={};_0x1eb6d5[_0xbc3b00]={'$like':'%'+_0x3610ab[_0xdc03('0x41')][_0xdc03('0x4c')]+'%'};return _0x1eb6d5;})});}_0x3a2cca=_[_0xdc03('0x4d')]({},_0x3a2cca,_0x3610ab[_0xdc03('0x4f')]);return _0x5aa30c[_0xdc03('0xb4')](_0x3a2cca);}})[_0xdc03('0x1e')](function(_0x435b4f){if(_0x435b4f){_0x392df2=_0x435b4f['length'];if(!_0x3610ab[_0xdc03('0x41')][_0xdc03('0x67')](_0xdc03('0x47'))){_0x3a2cca['limit']=qs[_0xdc03('0x48')](_0x3610ab[_0xdc03('0x41')]['limit']);_0x3a2cca['offset']=qs[_0xdc03('0x2c')](_0x3610ab[_0xdc03('0x41')][_0xdc03('0x2c')]);}return _0x5aa30c[_0xdc03('0xb4')](_0x3a2cca);}})['then'](function(_0x3fdd41){if(_0x3fdd41){return _0x3fdd41?{'count':_0x392df2,'rows':_0x3fdd41}:null;}})[_0xdc03('0x1e')](respondWithResult(_0xe21373,null))['catch'](handleError(_0xe21373,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 647e3a0..a552e9e 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 _0x86c9=['hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x4fb540,_0x4a1559){var _0x4a21e7=function(_0x3bafd8){while(--_0x3bafd8){_0x4fb540['push'](_0x4fb540['shift']());}};_0x4a21e7(++_0x4a1559);}(_0x86c9,0x16a));var _0x986c=function(_0xca5760,_0x15430d){_0xca5760=_0xca5760-0x0;var _0x3b22cd=_0x86c9[_0xca5760];return _0x3b22cd;};'use strict';var EventEmitter=require(_0x986c('0x0'));var MailAccount=require(_0x986c('0x1'))['db'][_0x986c('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x986c('0x3')](0x0);var events={'afterCreate':_0x986c('0x4'),'afterUpdate':_0x986c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3ab744){return function(_0x21d555,_0x1935d0,_0x50012d){MailAccountEvents[_0x986c('0x6')](_0x3ab744+':'+_0x21d555['id'],_0x21d555);MailAccountEvents[_0x986c('0x6')](_0x3ab744,_0x21d555);_0x50012d(null);};}for(var e in events){if(events[_0x986c('0x7')](e)){var event=events[e];MailAccount[_0x986c('0x8')](e,emitEvent(event));}}module[_0x986c('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x0199=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x2048d4,_0x5a18f0){var _0x310cca=function(_0x4e7c7c){while(--_0x4e7c7c){_0x2048d4['push'](_0x2048d4['shift']());}};_0x310cca(++_0x5a18f0);}(_0x0199,0x1d6));var _0x9019=function(_0x45957b,_0x33b380){_0x45957b=_0x45957b-0x0;var _0x3ac698=_0x0199[_0x45957b];return _0x3ac698;};'use strict';var EventEmitter=require(_0x9019('0x0'));var MailAccount=require(_0x9019('0x1'))['db'][_0x9019('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9019('0x3')](0x0);var events={'afterCreate':_0x9019('0x4'),'afterUpdate':_0x9019('0x5'),'afterDestroy':_0x9019('0x6')};function emitEvent(_0x4181f2){return function(_0x5873b2,_0x2f9d95,_0x207f92){MailAccountEvents[_0x9019('0x7')](_0x4181f2+':'+_0x5873b2['id'],_0x5873b2);MailAccountEvents['emit'](_0x4181f2,_0x5873b2);_0x207f92(null);};}for(var e in events){if(events[_0x9019('0x8')](e)){var event=events[e];MailAccount[_0x9019('0x9')](e,emitEvent(event));}}module[_0x9019('0xa')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 1f24c0a..320611a 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 _0xb622=['moment','bluebird','rimraf','./mailAccount.attributes','define','lodash','../../config/logger'];(function(_0x3ca045,_0x52f0a5){var _0x28afe7=function(_0x2b17f6){while(--_0x2b17f6){_0x3ca045['push'](_0x3ca045['shift']());}};_0x28afe7(++_0x52f0a5);}(_0xb622,0x116));var _0x2b62=function(_0xef89cd,_0x41e2d5){_0xef89cd=_0xef89cd-0x0;var _0x51dfc5=_0xb622[_0xef89cd];return _0x51dfc5;};'use strict';var _=require(_0x2b62('0x0'));var util=require('util');var logger=require(_0x2b62('0x1'))('api');var moment=require(_0x2b62('0x2'));var BPromise=require(_0x2b62('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2b62('0x4'));var config=require('../../config/environment');var attributes=require(_0x2b62('0x5'));module['exports']=function(_0x1c4b1c,_0x16e779){return _0x1c4b1c[_0x2b62('0x6')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc76=['bluebird','path','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','util','../../config/logger','moment'];(function(_0x16c909,_0x1cb60a){var _0x5b2160=function(_0x89b4a3){while(--_0x89b4a3){_0x16c909['push'](_0x16c909['shift']());}};_0x5b2160(++_0x1cb60a);}(_0xfc76,0x110));var _0x6fc7=function(_0x31ca28,_0x526bcb){_0x31ca28=_0x31ca28-0x0;var _0x2fb825=_0xfc76[_0x31ca28];return _0x2fb825;};'use strict';var _=require(_0x6fc7('0x0'));var util=require(_0x6fc7('0x1'));var logger=require(_0x6fc7('0x2'))('api');var moment=require(_0x6fc7('0x3'));var BPromise=require(_0x6fc7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6fc7('0x5'));var rimraf=require('rimraf');var config=require(_0x6fc7('0x6'));var attributes=require(_0x6fc7('0x7'));module[_0x6fc7('0x8')]=function(_0x204930,_0x1a950a){return _0x204930[_0x6fc7('0x9')](_0x6fc7('0xa'),attributes,{'tableName':_0x6fc7('0xb'),'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 143befc..7e8c3f9 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 _0x1ca7=['body','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','List','get','account','omit','list','orderBy','priority','autoclose','push','applications','length','close','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','spread','update','format','interaction','attachments','bcc','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','MailAccount','findAll','options','raw','where','limit','include','map','model','attributes','GetMailAccount','ShowMailAccount','find'];(function(_0x179314,_0x32d3a2){var _0x3556f7=function(_0x16244e){while(--_0x16244e){_0x179314['push'](_0x179314['shift']());}};_0x3556f7(++_0x32d3a2);}(_0x1ca7,0x157));var _0x71ca=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x1ca7[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x71ca('0x0'));var util=require(_0x71ca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71ca('0x2'));var db=require(_0x71ca('0x3'))['db'];var utils=require(_0x71ca('0x4'));var logger=require('../../config/logger')(_0x71ca('0x5'));var config=require(_0x71ca('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x71ca('0x7')]({'port':0x232c});config[_0x71ca('0x8')]=_[_0x71ca('0x9')](config[_0x71ca('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x71ca('0xa'))(new Redis(config[_0x71ca('0x8')]));require('./mailAccount.socket')[_0x71ca('0xb')](socket);function respondWithRpcPromise(_0x2aff62,_0x1fcf82,_0x5def7b){return new BPromise(function(_0x25a84b,_0x342d5c){return client[_0x71ca('0xc')](_0x2aff62,_0x5def7b)[_0x71ca('0xd')](function(_0x1a9590){logger[_0x71ca('0xe')]('MailAccount,\x20%s,\x20%s',_0x1fcf82,_0x71ca('0xf'));logger[_0x71ca('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x1fcf82,_0x71ca('0xf'),JSON[_0x71ca('0x11')](_0x1a9590));if(_0x1a9590[_0x71ca('0x12')]){if(_0x1a9590[_0x71ca('0x12')][_0x71ca('0x13')]===0x1f4){logger[_0x71ca('0x12')](_0x71ca('0x14'),_0x1fcf82,_0x1a9590[_0x71ca('0x12')][_0x71ca('0x15')]);return _0x342d5c(_0x1a9590[_0x71ca('0x12')]['message']);}logger['error'](_0x71ca('0x14'),_0x1fcf82,_0x1a9590['error'][_0x71ca('0x15')]);return _0x25a84b(_0x1a9590[_0x71ca('0x12')]['message']);}else{logger['info'](_0x71ca('0x14'),_0x1fcf82,'request\x20sent');_0x25a84b(_0x1a9590[_0x71ca('0x16')][_0x71ca('0x15')]);}})[_0x71ca('0x17')](function(_0x3750fa){logger['error']('MailAccount,\x20%s,\x20%s',_0x1fcf82,_0x3750fa);_0x342d5c(_0x3750fa);});});}exports['GetMailAccount']=function(_0x13733f){var _0x3bbb35=this;return new Promise(function(_0x46ffec,_0x257ab1){return db[_0x71ca('0x18')][_0x71ca('0x19')]({'raw':_0x13733f[_0x71ca('0x1a')]?_0x13733f[_0x71ca('0x1a')][_0x71ca('0x1b')]===undefined?!![]:![]:!![],'where':_0x13733f[_0x71ca('0x1a')]?_0x13733f['options'][_0x71ca('0x1c')]||null:null,'attributes':_0x13733f['options']?_0x13733f[_0x71ca('0x1a')]['attributes']||null:null,'limit':_0x13733f['options']?_0x13733f[_0x71ca('0x1a')][_0x71ca('0x1d')]||null:null,'include':_0x13733f[_0x71ca('0x1a')]?_0x13733f[_0x71ca('0x1a')][_0x71ca('0x1e')]?_[_0x71ca('0x1f')](_0x13733f[_0x71ca('0x1a')][_0x71ca('0x1e')],function(_0x35f577){return{'model':db[_0x35f577[_0x71ca('0x20')]],'as':_0x35f577['as'],'attributes':_0x35f577[_0x71ca('0x21')],'include':_0x35f577[_0x71ca('0x1e')]?_[_0x71ca('0x1f')](_0x35f577[_0x71ca('0x1e')],function(_0x5e90b0){return{'model':db[_0x5e90b0[_0x71ca('0x20')]],'as':_0x5e90b0['as'],'attributes':_0x5e90b0[_0x71ca('0x21')],'include':_0x5e90b0[_0x71ca('0x1e')]?_[_0x71ca('0x1f')](_0x5e90b0[_0x71ca('0x1e')],function(_0x30deeb){return{'model':db[_0x30deeb[_0x71ca('0x20')]],'as':_0x30deeb['as'],'attributes':_0x30deeb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xabe6e7){logger[_0x71ca('0xe')](_0x71ca('0x22'),_0x13733f);logger['debug']('GetMailAccount',_0x13733f,JSON['stringify'](_0xabe6e7));_0x46ffec(_0xabe6e7);})[_0x71ca('0x17')](function(_0x501357){logger['error'](_0x71ca('0x22'),_0x501357['message'],_0x13733f);_0x257ab1(_0x3bbb35[_0x71ca('0x12')](0x1f4,_0x501357[_0x71ca('0x15')]));});});};exports[_0x71ca('0x23')]=function(_0x5e6c23){var _0x15e975=this;return new Promise(function(_0x290eba,_0xc390ff){return db[_0x71ca('0x18')][_0x71ca('0x24')]({'raw':_0x5e6c23['options']?_0x5e6c23[_0x71ca('0x1a')][_0x71ca('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e6c23[_0x71ca('0x1a')]?_0x5e6c23[_0x71ca('0x1a')][_0x71ca('0x1c')]||null:null,'attributes':_0x5e6c23[_0x71ca('0x1a')]?_0x5e6c23[_0x71ca('0x1a')][_0x71ca('0x21')]||null:null,'include':_0x5e6c23['options']?_0x5e6c23['options'][_0x71ca('0x1e')]?_[_0x71ca('0x1f')](_0x5e6c23[_0x71ca('0x1a')][_0x71ca('0x1e')],function(_0x5bdeda){return{'model':db[_0x5bdeda[_0x71ca('0x20')]],'as':_0x5bdeda['as'],'attributes':_0x5bdeda[_0x71ca('0x21')],'include':_0x5bdeda[_0x71ca('0x1e')]?_['map'](_0x5bdeda[_0x71ca('0x1e')],function(_0x53e22a){return{'model':db[_0x53e22a[_0x71ca('0x20')]],'as':_0x53e22a['as'],'attributes':_0x53e22a[_0x71ca('0x21')],'include':_0x53e22a[_0x71ca('0x1e')]?_[_0x71ca('0x1f')](_0x53e22a[_0x71ca('0x1e')],function(_0x16de9e){return{'model':db[_0x16de9e[_0x71ca('0x20')]],'as':_0x16de9e['as'],'attributes':_0x16de9e[_0x71ca('0x21')]};}):[]};}):[]};}):[]:[]})[_0x71ca('0xd')](function(_0x3bc9fd){logger[_0x71ca('0xe')]('ShowMailAccount',_0x5e6c23);logger[_0x71ca('0x10')](_0x71ca('0x23'),_0x5e6c23,JSON[_0x71ca('0x11')](_0x3bc9fd));_0x290eba(_0x3bc9fd);})['catch'](function(_0x45c8f4){logger[_0x71ca('0x12')](_0x71ca('0x23'),_0x45c8f4[_0x71ca('0x15')],_0x5e6c23);_0xc390ff(_0x15e975[_0x71ca('0x12')](0x1f4,_0x45c8f4['message']));});});};exports['NotifyMailAccount']=function(_0x2e2546){var _0x9a7046=this;return new Promise(function(_0x1ed83a,_0x973028){var _0x316212={'body':_0x2e2546[_0x71ca('0x25')],'channel':'mail'};var _0x4b01b4=_[_0x71ca('0x26')](_[_0x71ca('0x27')](db[_0x71ca('0x28')]['rawAttributes']),[_0x71ca('0x29'),_0x71ca('0x2a'),_0x71ca('0x2b'),_0x71ca('0x2c')]);var _0x437e46=![];if(_0x2e2546[_0x71ca('0x25')]['id']){delete _0x2e2546[_0x71ca('0x25')]['id'];}if(_[_0x71ca('0x2d')](_0x2e2546[_0x71ca('0x25')][_0x71ca('0x2e')])){return _0x973028(_0x9a7046['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x71ca('0x2d')](_0x2e2546['body']['body'])||_0x2e2546['body']['body']===''){return _0x973028(_0x9a7046['error'](0x1f4,_0x71ca('0x2f')));}if(_[_0x71ca('0x2d')](_0x2e2546[_0x71ca('0x25')][_0x71ca('0x30')])){return _0x973028(_0x9a7046[_0x71ca('0x12')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4b01b4));}if(!_['includes'](_0x4b01b4,_0x2e2546[_0x71ca('0x25')][_0x71ca('0x30')])){return _0x973028(_0x9a7046[_0x71ca('0x12')](0x1f4,_0x71ca('0x31')+_0x4b01b4));}var _0x43197a={};_0x43197a[_0x2e2546[_0x71ca('0x25')]['mapKey']]=_0x2e2546[_0x71ca('0x25')][_0x71ca('0x2e')];return db[_0x71ca('0x18')][_0x71ca('0x24')]({'where':{'id':_0x2e2546['account']['id']},'include':[{'model':db[_0x71ca('0x32')],'as':'List','include':[{'model':db[_0x71ca('0x28')],'as':_0x71ca('0x33'),'where':_0x43197a,'limit':0x1,'order':[[_0x71ca('0x2a'),_0x71ca('0x34')]]}]},{'model':db[_0x71ca('0x35')],'as':_0x71ca('0x36')},{'model':db[_0x71ca('0x37')],'as':_0x71ca('0x38')}]})[_0x71ca('0xd')](function(_0x29d170){if(_0x29d170&&_0x29d170[_0x71ca('0x39')]){var _0x264613=_0x29d170[_0x71ca('0x3a')]({'plain':!![]});_0x316212[_0x71ca('0x3b')]=_[_0x71ca('0x3c')](_0x264613,[_0x71ca('0x36'),_0x71ca('0x39')]);_0x316212['applications']=_0x264613[_0x71ca('0x36')];_0x316212[_0x71ca('0x3d')]=_0x264613[_0x71ca('0x39')];_0x316212['applications']=_[_0x71ca('0x3e')](_0x316212['applications'],[_0x71ca('0x3f')],['asc']);if(_0x316212[_0x71ca('0x3b')]&&_0x316212[_0x71ca('0x3b')][_0x71ca('0x40')]){_0x316212['applications'][_0x71ca('0x41')]({'id':0x0,'priority':_0x316212[_0x71ca('0x42')][_0x71ca('0x43')]+0x1,'app':_0x71ca('0x44'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x316212[_0x71ca('0x3b')][_0x71ca('0x36')]){delete _0x316212['account'][_0x71ca('0x36')];}if(_0x316212[_0x71ca('0x3b')]['List']){delete _0x316212[_0x71ca('0x3b')]['List'];}if(_0x264613[_0x71ca('0x39')][_0x71ca('0x33')][_0x71ca('0x43')]){return _0x264613[_0x71ca('0x39')][_0x71ca('0x33')][0x0];}var _0x5d0e64=_['defaults'](_0x2e2546[_0x71ca('0x25')],{'firstName':_0x2e2546[_0x71ca('0x25')][_0x71ca('0x2e')],'ListId':_0x264613['ListId']});_0x5d0e64[_0x2e2546[_0x71ca('0x25')][_0x71ca('0x30')]]=_0x2e2546[_0x71ca('0x25')][_0x71ca('0x2e')];return db[_0x71ca('0x28')][_0x71ca('0x45')](_0x5d0e64);}else{throw new Error(_0x71ca('0x46'));}})[_0x71ca('0xd')](function(_0x46a279){_0x316212[_0x71ca('0x47')]=_0x46a279;if(_0x46a279){if(!_0x2e2546['body']['message'][_0x71ca('0x48')]){_0x2e2546[_0x71ca('0x25')]['message'][_0x71ca('0x48')]=rs[_0x71ca('0x49')]()+'\x20'+_0x2e2546['body'][_0x71ca('0x15')]['from'];}var _0x442eed={'ContactId':_0x46a279['id'],'MailAccountId':_0x2e2546[_0x71ca('0x3b')]['id'],'inReplyTo':_0x2e2546[_0x71ca('0x25')][_0x71ca('0x15')][_0x71ca('0x48')],'to':_0x2e2546['body'][_0x71ca('0x15')]['from'],'cc':_0x2e2546['body'][_0x71ca('0x15')]['cc'],'subject':_0x2e2546['body'][_0x71ca('0x15')][_0x71ca('0x4a')],'attach':_0x2e2546[_0x71ca('0x25')][_0x71ca('0x15')][_0x71ca('0x4b')],'lastMsgAt':moment()['format'](_0x71ca('0x4c')),'lastMsgDirection':'in','lastMsgBody':_0x2e2546['body']['body']};return db[_0x71ca('0x4d')][_0x71ca('0x24')]({'where':{'closed':![],'MailAccountId':_0x2e2546['account']['id']},'include':[{'model':db[_0x71ca('0x4e')],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x2e2546[_0x71ca('0x25')][_0x71ca('0x15')]['inReplyTo']}}]})[_0x71ca('0xd')](function(_0x7a93bb){if(_0x7a93bb){return[_0x7a93bb,![]];}return db[_0x71ca('0x4d')][_0x71ca('0x45')](_0x442eed)['then'](function(_0x1bb39d){return[_0x1bb39d,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x71ca('0x4f')](function(_0x191cdc,_0x4bb759){if(_0x191cdc){_0x437e46=_0x4bb759;if(!_0x4bb759){return _0x191cdc[_0x71ca('0x50')]({'inReplyTo':_0x2e2546['body']['message'][_0x71ca('0x48')],'to':_0x2e2546[_0x71ca('0x25')]['message'][_0x71ca('0x2e')],'cc':_0x2e2546['body'][_0x71ca('0x15')]['cc'],'subject':_0x2e2546[_0x71ca('0x25')][_0x71ca('0x15')][_0x71ca('0x4a')],'attach':_0x191cdc[_0x71ca('0x4b')]?_0x191cdc['attach']:_0x2e2546[_0x71ca('0x25')][_0x71ca('0x15')]['attach'],'substatus':null,'substatusAt':moment()[_0x71ca('0x51')](_0x71ca('0x4c')),'lastMsgAt':moment()[_0x71ca('0x51')](_0x71ca('0x4c')),'lastMsgDirection':'in','lastMsgBody':_0x2e2546['body']['body']});}else{return _0x191cdc;}}})[_0x71ca('0xd')](function(_0x5e5912){_0x316212[_0x71ca('0x52')]=_0x5e5912[_0x71ca('0x3a')]({'plain':!![]});_0x316212['interaction']['created']=_0x437e46;return db['MailMessage']['create']({'body':_0x2e2546['body']['body'],'MailAccountId':_0x2e2546[_0x71ca('0x3b')]['id'],'MailInteractionId':_0x5e5912['id'],'direction':'in','ContactId':_0x316212[_0x71ca('0x47')]['id'],'messageId':_0x2e2546[_0x71ca('0x25')][_0x71ca('0x15')][_0x71ca('0x48')],'from':_0x2e2546[_0x71ca('0x25')][_0x71ca('0x15')][_0x71ca('0x2e')],'to':_0x2e2546[_0x71ca('0x25')][_0x71ca('0x15')]['to'],'cc':_0x2e2546[_0x71ca('0x25')][_0x71ca('0x15')]['cc'],'subject':_0x2e2546['body'][_0x71ca('0x15')][_0x71ca('0x4a')],'attach':_0x2e2546[_0x71ca('0x25')][_0x71ca('0x15')][_0x71ca('0x4b')],'Attachments':_0x2e2546[_0x71ca('0x25')]['message'][_0x71ca('0x53')],'originTo':_0x2e2546['body'][_0x71ca('0x15')]['originTo'],'originCc':_0x2e2546[_0x71ca('0x25')][_0x71ca('0x15')]['originCc'],'bcc':_0x2e2546[_0x71ca('0x25')][_0x71ca('0x15')][_0x71ca('0x54')]},{'include':[{'model':db[_0x71ca('0x55')],'as':_0x71ca('0x56')}]});})[_0x71ca('0xd')](function(_0x6e5094){_0x316212['message']=_0x6e5094;if(_0x316212[_0x71ca('0x52')][_0x71ca('0x57')]){return db[_0x71ca('0x58')][_0x71ca('0x24')]({'attributes':['id',_0x71ca('0x59')],'where':{'id':_0x316212[_0x71ca('0x52')][_0x71ca('0x57')]}})[_0x71ca('0xd')](function(_0x4aaa73){if(_0x4aaa73){_0x316212[_0x71ca('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':_0x71ca('0x5a'),'appdata':_0x4aaa73[_0x71ca('0x59')]+','+(_0x316212[_0x71ca('0x3b')][_0x71ca('0x5b')]||0xa),'interval':_0x71ca('0x5c')});}return respondWithRpcPromise(_0x71ca('0x5d'),'startRouting',_0x316212);});}return respondWithRpcPromise(_0x71ca('0x5d'),_0x71ca('0x5e'),_0x316212);})[_0x71ca('0xd')](function(_0x8b1c4f){_0x1ed83a(_0x8b1c4f);})[_0x71ca('0x17')](function(_0x2595c5){_0x973028(_0x9a7046[_0x71ca('0x12')](0x1f4,_0x2595c5['message']));});});}; \ No newline at end of file +var _0x05b0=['name','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','limit','map','model','attributes','include','ShowMailAccount','find','NotifyMailAccount','mail','difference','keys','CmContact','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','Applications','get','list','applications','orderBy','priority','asc','autoclose','length','close','*,*,*,*','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','create','originTo','originCc','bcc','UserId','unshift','agent'];(function(_0x3464c1,_0x3b1d2b){var _0x485f45=function(_0x2799a5){while(--_0x2799a5){_0x3464c1['push'](_0x3464c1['shift']());}};_0x485f45(++_0x3b1d2b);}(_0x05b0,0x188));var _0x005b=function(_0x166058,_0x321d2a){_0x166058=_0x166058-0x0;var _0x3686a7=_0x05b0[_0x166058];return _0x3686a7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x005b('0x0'));var BPromise=require(_0x005b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x005b('0x2'));var db=require(_0x005b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x005b('0x4'))(_0x005b('0x5'));var config=require('../../config/environment');var jayson=require(_0x005b('0x6'));var client=jayson[_0x005b('0x7')][_0x005b('0x8')]({'port':0x232c});config[_0x005b('0x9')]=_[_0x005b('0xa')](config[_0x005b('0x9')],{'host':_0x005b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x005b('0x9')]));require(_0x005b('0xc'))['register'](socket);function respondWithRpcPromise(_0x53fff4,_0x451641,_0x4d41b8){return new BPromise(function(_0x56040d,_0x56a44c){return client[_0x005b('0xd')](_0x53fff4,_0x4d41b8)[_0x005b('0xe')](function(_0x5b37a9){logger[_0x005b('0xf')](_0x005b('0x10'),_0x451641,_0x005b('0x11'));logger[_0x005b('0x12')](_0x005b('0x13'),_0x451641,_0x005b('0x11'),JSON[_0x005b('0x14')](_0x5b37a9));if(_0x5b37a9['error']){if(_0x5b37a9['error']['code']===0x1f4){logger[_0x005b('0x15')]('MailAccount,\x20%s,\x20%s',_0x451641,_0x5b37a9[_0x005b('0x15')]['message']);return _0x56a44c(_0x5b37a9[_0x005b('0x15')][_0x005b('0x16')]);}logger[_0x005b('0x15')](_0x005b('0x10'),_0x451641,_0x5b37a9[_0x005b('0x15')]['message']);return _0x56040d(_0x5b37a9[_0x005b('0x15')][_0x005b('0x16')]);}else{logger[_0x005b('0xf')]('MailAccount,\x20%s,\x20%s',_0x451641,_0x005b('0x11'));_0x56040d(_0x5b37a9[_0x005b('0x17')]['message']);}})[_0x005b('0x18')](function(_0x242f96){logger[_0x005b('0x15')](_0x005b('0x10'),_0x451641,_0x242f96);_0x56a44c(_0x242f96);});});}exports[_0x005b('0x19')]=function(_0x50e966){var _0x299838=this;return new Promise(function(_0x38cc3b,_0x4ae164){return db[_0x005b('0x1a')][_0x005b('0x1b')]({'raw':_0x50e966[_0x005b('0x1c')]?_0x50e966['options'][_0x005b('0x1d')]===undefined?!![]:![]:!![],'where':_0x50e966[_0x005b('0x1c')]?_0x50e966[_0x005b('0x1c')][_0x005b('0x1e')]||null:null,'attributes':_0x50e966[_0x005b('0x1c')]?_0x50e966[_0x005b('0x1c')]['attributes']||null:null,'limit':_0x50e966[_0x005b('0x1c')]?_0x50e966[_0x005b('0x1c')][_0x005b('0x1f')]||null:null,'include':_0x50e966['options']?_0x50e966[_0x005b('0x1c')]['include']?_[_0x005b('0x20')](_0x50e966['options']['include'],function(_0x2dc341){return{'model':db[_0x2dc341[_0x005b('0x21')]],'as':_0x2dc341['as'],'attributes':_0x2dc341[_0x005b('0x22')],'include':_0x2dc341[_0x005b('0x23')]?_[_0x005b('0x20')](_0x2dc341[_0x005b('0x23')],function(_0x3d4a1c){return{'model':db[_0x3d4a1c[_0x005b('0x21')]],'as':_0x3d4a1c['as'],'attributes':_0x3d4a1c['attributes'],'include':_0x3d4a1c[_0x005b('0x23')]?_[_0x005b('0x20')](_0x3d4a1c[_0x005b('0x23')],function(_0x13e834){return{'model':db[_0x13e834[_0x005b('0x21')]],'as':_0x13e834['as'],'attributes':_0x13e834[_0x005b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x005b('0xe')](function(_0x49561a){logger[_0x005b('0xf')](_0x005b('0x19'),_0x50e966);logger[_0x005b('0x12')](_0x005b('0x19'),_0x50e966,JSON['stringify'](_0x49561a));_0x38cc3b(_0x49561a);})['catch'](function(_0x3699b6){logger[_0x005b('0x15')]('GetMailAccount',_0x3699b6['message'],_0x50e966);_0x4ae164(_0x299838[_0x005b('0x15')](0x1f4,_0x3699b6['message']));});});};exports[_0x005b('0x24')]=function(_0x1466ea){var _0x32a067=this;return new Promise(function(_0x552574,_0x5aa45d){return db[_0x005b('0x1a')][_0x005b('0x25')]({'raw':_0x1466ea[_0x005b('0x1c')]?_0x1466ea['options']['raw']===undefined?!![]:![]:!![],'where':_0x1466ea[_0x005b('0x1c')]?_0x1466ea[_0x005b('0x1c')]['where']||null:null,'attributes':_0x1466ea[_0x005b('0x1c')]?_0x1466ea['options'][_0x005b('0x22')]||null:null,'include':_0x1466ea['options']?_0x1466ea['options'][_0x005b('0x23')]?_[_0x005b('0x20')](_0x1466ea[_0x005b('0x1c')][_0x005b('0x23')],function(_0x430d10){return{'model':db[_0x430d10['model']],'as':_0x430d10['as'],'attributes':_0x430d10['attributes'],'include':_0x430d10[_0x005b('0x23')]?_[_0x005b('0x20')](_0x430d10[_0x005b('0x23')],function(_0x250262){return{'model':db[_0x250262[_0x005b('0x21')]],'as':_0x250262['as'],'attributes':_0x250262[_0x005b('0x22')],'include':_0x250262['include']?_[_0x005b('0x20')](_0x250262[_0x005b('0x23')],function(_0x2c2ced){return{'model':db[_0x2c2ced['model']],'as':_0x2c2ced['as'],'attributes':_0x2c2ced[_0x005b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x005b('0xe')](function(_0x331e5f){logger[_0x005b('0xf')](_0x005b('0x24'),_0x1466ea);logger[_0x005b('0x12')](_0x005b('0x24'),_0x1466ea,JSON[_0x005b('0x14')](_0x331e5f));_0x552574(_0x331e5f);})[_0x005b('0x18')](function(_0xe8f18){logger['error'](_0x005b('0x24'),_0xe8f18[_0x005b('0x16')],_0x1466ea);_0x5aa45d(_0x32a067['error'](0x1f4,_0xe8f18[_0x005b('0x16')]));});});};exports[_0x005b('0x26')]=function(_0x1f29de){var _0x2a8a88=this;return new Promise(function(_0x4ec11c,_0x1814ac){var _0xb9388={'body':_0x1f29de['body'],'channel':_0x005b('0x27')};var _0x1da310=_[_0x005b('0x28')](_[_0x005b('0x29')](db[_0x005b('0x2a')]['rawAttributes']),['createdAt',_0x005b('0x2b'),_0x005b('0x2c'),_0x005b('0x2d')]);var _0x42c772=![];if(_0x1f29de[_0x005b('0x2e')]['id']){delete _0x1f29de['body']['id'];}if(_[_0x005b('0x2f')](_0x1f29de[_0x005b('0x2e')][_0x005b('0x30')])){return _0x1814ac(_0x2a8a88[_0x005b('0x15')](0x1f4,_0x005b('0x31')));}if(_[_0x005b('0x2f')](_0x1f29de['body'][_0x005b('0x2e')])||_0x1f29de['body'][_0x005b('0x2e')]===''){return _0x1814ac(_0x2a8a88[_0x005b('0x15')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x005b('0x2f')](_0x1f29de[_0x005b('0x2e')][_0x005b('0x32')])){return _0x1814ac(_0x2a8a88[_0x005b('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1da310));}if(!_[_0x005b('0x33')](_0x1da310,_0x1f29de[_0x005b('0x2e')][_0x005b('0x32')])){return _0x1814ac(_0x2a8a88[_0x005b('0x15')](0x1f4,_0x005b('0x34')+_0x1da310));}var _0x185764={};_0x185764[_0x1f29de[_0x005b('0x2e')][_0x005b('0x32')]]=_0x1f29de[_0x005b('0x2e')]['from'];return db[_0x005b('0x1a')][_0x005b('0x25')]({'where':{'id':_0x1f29de[_0x005b('0x35')]['id']},'include':[{'model':db[_0x005b('0x36')],'as':_0x005b('0x37'),'include':[{'model':db['CmContact'],'as':_0x005b('0x38'),'where':_0x185764,'limit':0x1,'order':[[_0x005b('0x2b'),_0x005b('0x39')]]}]},{'model':db['MailApplication'],'as':_0x005b('0x3a')},{'model':db['MailServerOut'],'as':'Smtp'}]})['then'](function(_0x5d21e2){if(_0x5d21e2&&_0x5d21e2[_0x005b('0x37')]){var _0x434eb8=_0x5d21e2[_0x005b('0x3b')]({'plain':!![]});_0xb9388[_0x005b('0x35')]=_['omit'](_0x434eb8,[_0x005b('0x3a'),_0x005b('0x37')]);_0xb9388['applications']=_0x434eb8[_0x005b('0x3a')];_0xb9388[_0x005b('0x3c')]=_0x434eb8[_0x005b('0x37')];_0xb9388[_0x005b('0x3d')]=_[_0x005b('0x3e')](_0xb9388['applications'],[_0x005b('0x3f')],[_0x005b('0x40')]);if(_0xb9388[_0x005b('0x35')]&&_0xb9388[_0x005b('0x35')][_0x005b('0x41')]){_0xb9388[_0x005b('0x3d')]['push']({'id':0x0,'priority':_0xb9388[_0x005b('0x3d')][_0x005b('0x42')]+0x1,'app':_0x005b('0x43'),'appdata':_0x005b('0x41'),'interval':_0x005b('0x44')});}if(_0xb9388[_0x005b('0x35')]['Applications']){delete _0xb9388[_0x005b('0x35')][_0x005b('0x3a')];}if(_0xb9388['account']['List']){delete _0xb9388[_0x005b('0x35')][_0x005b('0x37')];}if(_0x434eb8[_0x005b('0x37')][_0x005b('0x38')][_0x005b('0x42')]){return _0x434eb8[_0x005b('0x37')][_0x005b('0x38')][0x0];}var _0x4ffd69=_[_0x005b('0xa')](_0x1f29de['body'],{'firstName':_0x1f29de['body'][_0x005b('0x30')],'ListId':_0x434eb8[_0x005b('0x2d')]});_0x4ffd69[_0x1f29de[_0x005b('0x2e')]['mapKey']]=_0x1f29de[_0x005b('0x2e')][_0x005b('0x30')];return db[_0x005b('0x2a')]['create'](_0x4ffd69);}else{throw new Error(_0x005b('0x45'));}})['then'](function(_0x41f077){_0xb9388[_0x005b('0x46')]=_0x41f077;if(_0x41f077){if(!_0x1f29de['body'][_0x005b('0x16')][_0x005b('0x47')]){_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x47')]=rs[_0x005b('0x48')]()+'\x20'+_0x1f29de['body'][_0x005b('0x16')][_0x005b('0x30')];}var _0x41b9f0={'ContactId':_0x41f077['id'],'MailAccountId':_0x1f29de[_0x005b('0x35')]['id'],'inReplyTo':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')]['messageId'],'to':_0x1f29de[_0x005b('0x2e')]['message'][_0x005b('0x30')],'cc':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')]['cc'],'subject':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x49')],'attach':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x4a')],'lastMsgAt':moment()[_0x005b('0x4b')](_0x005b('0x4c')),'lastMsgDirection':'in','lastMsgBody':_0x1f29de[_0x005b('0x2e')][_0x005b('0x2e')]};return db[_0x005b('0x4d')][_0x005b('0x25')]({'where':{'closed':![],'MailAccountId':_0x1f29de['account']['id']},'include':[{'model':db[_0x005b('0x4e')],'as':_0x005b('0x4f'),'attributes':[_0x005b('0x47')],'where':{'messageId':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x50')]}}]})[_0x005b('0xe')](function(_0x4b0abf){if(_0x4b0abf){return[_0x4b0abf,![]];}return db[_0x005b('0x4d')]['create'](_0x41b9f0)[_0x005b('0xe')](function(_0x4bd368){return[_0x4bd368,!![]];});});}else{throw new Error(_0x005b('0x51'));}})[_0x005b('0x52')](function(_0x55054f,_0x30a886){if(_0x55054f){_0x42c772=_0x30a886;if(!_0x30a886){return _0x55054f[_0x005b('0x53')]({'inReplyTo':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x47')],'to':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x30')],'cc':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')]['cc'],'subject':_0x1f29de['body']['message'][_0x005b('0x49')],'attach':_0x55054f[_0x005b('0x4a')]?_0x55054f[_0x005b('0x4a')]:_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x4a')],'substatus':null,'substatusAt':moment()[_0x005b('0x4b')](_0x005b('0x4c')),'lastMsgAt':moment()[_0x005b('0x4b')](_0x005b('0x4c')),'lastMsgDirection':'in','lastMsgBody':_0x1f29de[_0x005b('0x2e')][_0x005b('0x2e')]});}else{return _0x55054f;}}})[_0x005b('0xe')](function(_0x4affb2){_0xb9388[_0x005b('0x54')]=_0x4affb2[_0x005b('0x3b')]({'plain':!![]});_0xb9388['interaction'][_0x005b('0x55')]=_0x42c772;return db[_0x005b('0x4e')][_0x005b('0x56')]({'body':_0x1f29de[_0x005b('0x2e')][_0x005b('0x2e')],'MailAccountId':_0x1f29de[_0x005b('0x35')]['id'],'MailInteractionId':_0x4affb2['id'],'direction':'in','ContactId':_0xb9388[_0x005b('0x46')]['id'],'messageId':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')]['messageId'],'from':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x30')],'to':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')]['to'],'cc':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')]['cc'],'subject':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x49')],'attach':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x4a')],'Attachments':_0x1f29de['body'][_0x005b('0x16')]['attachments'],'originTo':_0x1f29de[_0x005b('0x2e')]['message'][_0x005b('0x57')],'originCc':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x58')],'bcc':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x59')]},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0x005b('0xe')](function(_0x3d47e6){_0xb9388['message']=_0x3d47e6;if(_0xb9388[_0x005b('0x54')][_0x005b('0x5a')]){return db['User'][_0x005b('0x25')]({'attributes':['id','name'],'where':{'id':_0xb9388[_0x005b('0x54')]['UserId']}})[_0x005b('0xe')](function(_0x1c38a4){if(_0x1c38a4){_0xb9388['applications'][_0x005b('0x5b')]({'id':0x0,'priority':0x0,'app':_0x005b('0x5c'),'appdata':_0x1c38a4[_0x005b('0x5d')]+','+(_0xb9388[_0x005b('0x35')][_0x005b('0x5e')]||0xa),'interval':_0x005b('0x44')});}return respondWithRpcPromise(_0x005b('0x5f'),'startRouting',_0xb9388);});}return respondWithRpcPromise(_0x005b('0x5f'),_0x005b('0x60'),_0xb9388);})[_0x005b('0xe')](function(_0xd9eb57){_0x4ec11c(_0xd9eb57);})[_0x005b('0x18')](function(_0x314ac6){_0x1814ac(_0x2a8a88[_0x005b('0x15')](0x1f4,_0x314ac6[_0x005b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index a7891f9..d12e1af 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 _0x6eed=['emit','removeListener','register','./mailAccount.events','save','remove','update'];(function(_0x107a84,_0x206679){var _0x3c494a=function(_0x14399d){while(--_0x14399d){_0x107a84['push'](_0x107a84['shift']());}};_0x3c494a(++_0x206679);}(_0x6eed,0xff));var _0xd6ee=function(_0x542850,_0x272d61){_0x542850=_0x542850-0x0;var _0x3a56c5=_0x6eed[_0x542850];return _0x3a56c5;};'use strict';var MailAccountEvents=require(_0xd6ee('0x0'));var events=[_0xd6ee('0x1'),_0xd6ee('0x2'),_0xd6ee('0x3')];function createListener(_0x1a734a,_0x4e325a){return function(_0x25a92a){_0x4e325a[_0xd6ee('0x4')](_0x1a734a,_0x25a92a);};}function removeListener(_0x588715,_0x53cce9){return function(){MailAccountEvents[_0xd6ee('0x5')](_0x588715,_0x53cce9);};}exports[_0xd6ee('0x6')]=function(_0x1c4f36){for(var _0x37abca=0x0,_0x10c1d7=events['length'];_0x37abca<_0x10c1d7;_0x37abca++){var _0x514dc3=events[_0x37abca];var _0x2e6369=createListener('mailAccount:'+_0x514dc3,_0x1c4f36);MailAccountEvents['on'](_0x514dc3,_0x2e6369);}}; \ No newline at end of file +var _0xe548=['removeListener','length','mailAccount:','./mailAccount.events','save','remove','update'];(function(_0x1455a7,_0x11c7d9){var _0x1c7fb3=function(_0x2333c6){while(--_0x2333c6){_0x1455a7['push'](_0x1455a7['shift']());}};_0x1c7fb3(++_0x11c7d9);}(_0xe548,0x184));var _0x8e54=function(_0x10b2d5,_0x5a7743){_0x10b2d5=_0x10b2d5-0x0;var _0x14b8d1=_0xe548[_0x10b2d5];return _0x14b8d1;};'use strict';var MailAccountEvents=require(_0x8e54('0x0'));var events=[_0x8e54('0x1'),_0x8e54('0x2'),_0x8e54('0x3')];function createListener(_0x8824f6,_0x48a491){return function(_0x5d61b0){_0x48a491['emit'](_0x8824f6,_0x5d61b0);};}function removeListener(_0x4aa36a,_0x4b69ef){return function(){MailAccountEvents[_0x8e54('0x4')](_0x4aa36a,_0x4b69ef);};}exports['register']=function(_0x288be8){for(var _0x47a58d=0x0,_0xc6281c=events[_0x8e54('0x5')];_0x47a58d<_0xc6281c;_0x47a58d++){var _0x148c1f=events[_0x47a58d];var _0x3d6444=createListener(_0x8e54('0x6')+_0x148c1f,_0x288be8);MailAccountEvents['on'](_0x148c1f,_0x3d6444);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index fd2d9f4..ed1e7de 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 _0x4fc2=['update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','isAuthenticated','show','/:id'];(function(_0x26393b,_0x449a84){var _0x57230a=function(_0x583888){while(--_0x583888){_0x26393b['push'](_0x26393b['shift']());}};_0x57230a(++_0x449a84);}(_0x4fc2,0x111));var _0x24fc=function(_0xe7aa32,_0x3a7bba){_0xe7aa32=_0xe7aa32-0x0;var _0x3e10d9=_0x4fc2[_0xe7aa32];return _0x3e10d9;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var auth=require(_0x24fc('0x5'));var interaction=require(_0x24fc('0x6'));var config=require('../../config/environment');var controller=require(_0x24fc('0x7'));router[_0x24fc('0x8')]('/:id',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller['destroy']);module[_0x24fc('0xe')]=router; \ No newline at end of file +var _0xc788=['update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','put'];(function(_0x2096b2,_0x53c8bd){var _0x540b16=function(_0x4f7d38){while(--_0x4f7d38){_0x2096b2['push'](_0x2096b2['shift']());}};_0x540b16(++_0x53c8bd);}(_0xc788,0xc4));var _0x8c78=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0xc788[_0x4fa0ea];return _0x51d027;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var auth=require(_0x8c78('0x4'));var interaction=require(_0x8c78('0x5'));var config=require(_0x8c78('0x6'));var controller=require(_0x8c78('0x7'));router['get'](_0x8c78('0x8'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xa')]);router[_0x8c78('0xb')](_0x8c78('0x8'),auth['isAuthenticated'](),controller[_0x8c78('0xc')]);router[_0x8c78('0xd')](_0x8c78('0x8'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xe')]);module[_0x8c78('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 5ee8e82..65cb845 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 _0x27c8=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x27c8,0xb8));var _0x827c=function(_0x2f46dd,_0x4c3724){_0x2f46dd=_0x2f46dd-0x0;var _0x2b401e=_0x27c8[_0x2f46dd];return _0x2b401e;};'use strict';var Sequelize=require(_0x827c('0x0'));module[_0x827c('0x1')]={'priority':{'type':Sequelize[_0x827c('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x827c('0x3')},'appdata':{'type':Sequelize[_0x827c('0x4')]()},'description':{'type':Sequelize[_0x827c('0x5')]},'interval':{'type':Sequelize[_0x827c('0x5')],'defaultValue':_0x827c('0x6')}}; \ No newline at end of file +var _0xad82=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x2c1d8c,_0x28a489){var _0x3a8da2=function(_0x332a68){while(--_0x332a68){_0x2c1d8c['push'](_0x2c1d8c['shift']());}};_0x3a8da2(++_0x28a489);}(_0xad82,0x115));var _0x2ad8=function(_0x5ae8f1,_0x58098e){_0x5ae8f1=_0x5ae8f1-0x0;var _0x4ac982=_0xad82[_0x5ae8f1];return _0x4ac982;};'use strict';var Sequelize=require(_0x2ad8('0x0'));module[_0x2ad8('0x1')]={'priority':{'type':Sequelize[_0x2ad8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2ad8('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2ad8('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2ad8('0x3')],'defaultValue':_0x2ad8('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 76ec8eb..6f2f999 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 _0x2df9=['show','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','includeAll','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','apply','reject','update','then','destroy','end','error','name','send'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0x2df9,0x14d));var _0x92df=function(_0x3ac064,_0x278b44){_0x3ac064=_0x3ac064-0x0;var _0x57a926=_0x2df9[_0x3ac064];return _0x57a926;};'use strict';var pdf=require(_0x92df('0x0'));var emlformat=require(_0x92df('0x1'));var rimraf=require(_0x92df('0x2'));var zipdir=require(_0x92df('0x3'));var jsonpatch=require(_0x92df('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x92df('0x5'));var Mustache=require('mustache');var util=require(_0x92df('0x6'));var path=require(_0x92df('0x7'));var sox=require('sox');var csv=require(_0x92df('0x8'));var ejs=require(_0x92df('0x9'));var fs=require('fs');var _=require(_0x92df('0xa'));var squel=require(_0x92df('0xb'));var crypto=require(_0x92df('0xc'));var jsforce=require(_0x92df('0xd'));var deskjs=require(_0x92df('0xe'));var toCsv=require(_0x92df('0x8'));var querystring=require(_0x92df('0xf'));var Papa=require(_0x92df('0x10'));var Redis=require('ioredis');var authService=require(_0x92df('0x11'));var qs=require(_0x92df('0x12'));var as=require(_0x92df('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92df('0x14'))(_0x92df('0x15'));var utils=require(_0x92df('0x16'));var config=require(_0x92df('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38116e,_0x3103bc){_0x3103bc=_0x3103bc||0xcc;return function(_0x38ae82){if(_0x38ae82){return _0x38116e[_0x92df('0x18')](_0x3103bc);}return _0x38116e[_0x92df('0x19')](_0x3103bc)['end']();};}function respondWithResult(_0x5f14ec,_0xc7aa2d){_0xc7aa2d=_0xc7aa2d||0xc8;return function(_0x5eeaa1){if(_0x5eeaa1){return _0x5f14ec[_0x92df('0x19')](_0xc7aa2d)[_0x92df('0x1a')](_0x5eeaa1);}};}function respondWithFilteredResult(_0x3a267f,_0x3ca3df){return function(_0xc71f53){if(_0xc71f53){var _0x4020ff=_0xc71f53['count'],_0x36f251=_0x3ca3df[_0x92df('0x1b')],_0x55dab6=_0x3ca3df[_0x92df('0x1b')]+_0x3ca3df[_0x92df('0x1c')],_0x190cdd;if(_0x55dab6>=_0x4020ff){_0x55dab6=_0x4020ff;_0x190cdd=0xc8;}else{_0x190cdd=0xce;}_0x3a267f[_0x92df('0x19')](_0x190cdd);return _0x3a267f['set']('Content-Range',_0x36f251+'-'+_0x55dab6+'/'+_0x4020ff)['json'](_0xc71f53);}return null;};}function patchUpdates(_0x3f86e6){return function(_0x26c6f6){try{jsonpatch[_0x92df('0x1d')](_0x26c6f6,_0x3f86e6,!![]);}catch(_0x21a3a5){return BPromise[_0x92df('0x1e')](_0x21a3a5);}return _0x26c6f6['save']();};}function saveUpdates(_0x591cc2,_0x4ca459){return function(_0x456574){if(_0x456574){return _0x456574[_0x92df('0x1f')](_0x591cc2)[_0x92df('0x20')](function(_0x4dba2f){return _0x4dba2f;});}return null;};}function removeEntity(_0x25f7be,_0x5cca59){return function(_0x473127){if(_0x473127){return _0x473127[_0x92df('0x21')]()[_0x92df('0x20')](function(){_0x25f7be[_0x92df('0x19')](0xcc)[_0x92df('0x22')]();});}};}function handleEntityNotFound(_0x4f77c3,_0x56f04f){return function(_0x508293){if(!_0x508293){_0x4f77c3[_0x92df('0x18')](0x194);}return _0x508293;};}function handleError(_0x272c69,_0x4b87db){_0x4b87db=_0x4b87db||0x1f4;return function(_0x20debb){logger[_0x92df('0x23')](_0x20debb['stack']);if(_0x20debb[_0x92df('0x24')]){delete _0x20debb['name'];}_0x272c69['status'](_0x4b87db)[_0x92df('0x25')](_0x20debb);};}exports[_0x92df('0x26')]=function(_0x42df1a,_0x405472){var _0x58f212={'raw':!![],'where':{'id':_0x42df1a[_0x92df('0x27')]['id']}},_0x34935c={};_0x34935c[_0x92df('0x28')]=_[_0x92df('0x29')](db[_0x92df('0x2a')]['rawAttributes']);_0x34935c[_0x92df('0x2b')]=_[_0x92df('0x29')](_0x42df1a[_0x92df('0x2b')]);_0x34935c[_0x92df('0x2c')]=_[_0x92df('0x2d')](_0x34935c[_0x92df('0x28')],_0x34935c[_0x92df('0x2b')]);_0x58f212[_0x92df('0x2e')]=_[_0x92df('0x2d')](_0x34935c[_0x92df('0x28')],qs['fields'](_0x42df1a[_0x92df('0x2b')][_0x92df('0x2f')]));_0x58f212['attributes']=_0x58f212[_0x92df('0x2e')][_0x92df('0x30')]?_0x58f212[_0x92df('0x2e')]:_0x34935c[_0x92df('0x28')];if(_0x42df1a[_0x92df('0x2b')][_0x92df('0x31')]){_0x58f212['include']=[{'all':!![]}];}_0x58f212=_['merge']({},_0x58f212,_0x42df1a['options']);return db[_0x92df('0x2a')][_0x92df('0x32')](_0x58f212)['then'](handleEntityNotFound(_0x405472,null))[_0x92df('0x20')](respondWithResult(_0x405472,null))[_0x92df('0x33')](handleError(_0x405472,null));};exports[_0x92df('0x1f')]=function(_0x37a6db,_0x3407fb){if(_0x37a6db[_0x92df('0x34')]['id']){delete _0x37a6db['body']['id'];}return db[_0x92df('0x2a')]['find']({'where':{'id':_0x37a6db[_0x92df('0x27')]['id']}})[_0x92df('0x20')](handleEntityNotFound(_0x3407fb,null))[_0x92df('0x20')](saveUpdates(_0x37a6db['body'],null))['then'](respondWithResult(_0x3407fb,null))['catch'](handleError(_0x3407fb,null));};exports[_0x92df('0x21')]=function(_0xd474c2,_0x3170fb){return db[_0x92df('0x2a')][_0x92df('0x32')]({'where':{'id':_0xd474c2[_0x92df('0x27')]['id']}})[_0x92df('0x20')](handleEntityNotFound(_0x3170fb,null))[_0x92df('0x20')](removeEntity(_0x3170fb,null))['catch'](handleError(_0x3170fb,null));}; \ No newline at end of file +var _0xb9ba=['params','destroy','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','error','name','send','show','keys','MailApplication','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb9ba,0x158));var _0xab9b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb9ba[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xab9b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab9b('0x1'));var jsonpatch=require(_0xab9b('0x2'));var rp=require(_0xab9b('0x3'));var moment=require('moment');var BPromise=require(_0xab9b('0x4'));var Mustache=require('mustache');var util=require(_0xab9b('0x5'));var path=require(_0xab9b('0x6'));var sox=require(_0xab9b('0x7'));var csv=require(_0xab9b('0x8'));var ejs=require(_0xab9b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xab9b('0xa'));var crypto=require(_0xab9b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xab9b('0xc'));var toCsv=require(_0xab9b('0x8'));var querystring=require(_0xab9b('0xd'));var Papa=require(_0xab9b('0xe'));var Redis=require(_0xab9b('0xf'));var authService=require(_0xab9b('0x10'));var qs=require(_0xab9b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab9b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xab9b('0x13'));var config=require(_0xab9b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x305bee,_0x27e8b5){_0x27e8b5=_0x27e8b5||0xcc;return function(_0x39cf1){if(_0x39cf1){return _0x305bee[_0xab9b('0x15')](_0x27e8b5);}return _0x305bee[_0xab9b('0x16')](_0x27e8b5)[_0xab9b('0x17')]();};}function respondWithResult(_0x2e75ca,_0x6ef3ad){_0x6ef3ad=_0x6ef3ad||0xc8;return function(_0x40672a){if(_0x40672a){return _0x2e75ca[_0xab9b('0x16')](_0x6ef3ad)['json'](_0x40672a);}};}function respondWithFilteredResult(_0x55c676,_0x1f7a4c){return function(_0x92c722){if(_0x92c722){var _0x51e146=_0x92c722[_0xab9b('0x18')],_0x7c1599=_0x1f7a4c[_0xab9b('0x19')],_0x2b7bf2=_0x1f7a4c[_0xab9b('0x19')]+_0x1f7a4c[_0xab9b('0x1a')],_0xe38787;if(_0x2b7bf2>=_0x51e146){_0x2b7bf2=_0x51e146;_0xe38787=0xc8;}else{_0xe38787=0xce;}_0x55c676[_0xab9b('0x16')](_0xe38787);return _0x55c676[_0xab9b('0x1b')](_0xab9b('0x1c'),_0x7c1599+'-'+_0x2b7bf2+'/'+_0x51e146)[_0xab9b('0x1d')](_0x92c722);}return null;};}function patchUpdates(_0xae4ef2){return function(_0x36d786){try{jsonpatch[_0xab9b('0x1e')](_0x36d786,_0xae4ef2,!![]);}catch(_0x5b08a9){return BPromise[_0xab9b('0x1f')](_0x5b08a9);}return _0x36d786['save']();};}function saveUpdates(_0x765600,_0x4ea586){return function(_0x115e47){if(_0x115e47){return _0x115e47['update'](_0x765600)[_0xab9b('0x20')](function(_0x31a381){return _0x31a381;});}return null;};}function removeEntity(_0x13d694,_0x214799){return function(_0x26a684){if(_0x26a684){return _0x26a684['destroy']()[_0xab9b('0x20')](function(){_0x13d694[_0xab9b('0x16')](0xcc)[_0xab9b('0x17')]();});}};}function handleEntityNotFound(_0x2b6716,_0x75c9e9){return function(_0x589dbf){if(!_0x589dbf){_0x2b6716[_0xab9b('0x15')](0x194);}return _0x589dbf;};}function handleError(_0x3f0b41,_0x2ec402){_0x2ec402=_0x2ec402||0x1f4;return function(_0x24e6af){logger[_0xab9b('0x21')](_0x24e6af['stack']);if(_0x24e6af[_0xab9b('0x22')]){delete _0x24e6af[_0xab9b('0x22')];}_0x3f0b41['status'](_0x2ec402)[_0xab9b('0x23')](_0x24e6af);};}exports[_0xab9b('0x24')]=function(_0x49e6ca,_0x3dccd5){var _0x493768={'raw':!![],'where':{'id':_0x49e6ca['params']['id']}},_0x2a6589={};_0x2a6589['model']=_[_0xab9b('0x25')](db[_0xab9b('0x26')][_0xab9b('0x27')]);_0x2a6589[_0xab9b('0x28')]=_['keys'](_0x49e6ca['query']);_0x2a6589[_0xab9b('0x29')]=_[_0xab9b('0x2a')](_0x2a6589[_0xab9b('0x2b')],_0x2a6589[_0xab9b('0x28')]);_0x493768[_0xab9b('0x2c')]=_['intersection'](_0x2a6589[_0xab9b('0x2b')],qs[_0xab9b('0x2d')](_0x49e6ca[_0xab9b('0x28')][_0xab9b('0x2d')]));_0x493768[_0xab9b('0x2c')]=_0x493768[_0xab9b('0x2c')][_0xab9b('0x2e')]?_0x493768[_0xab9b('0x2c')]:_0x2a6589[_0xab9b('0x2b')];if(_0x49e6ca[_0xab9b('0x28')][_0xab9b('0x2f')]){_0x493768[_0xab9b('0x30')]=[{'all':!![]}];}_0x493768=_[_0xab9b('0x31')]({},_0x493768,_0x49e6ca[_0xab9b('0x32')]);return db[_0xab9b('0x26')][_0xab9b('0x33')](_0x493768)[_0xab9b('0x20')](handleEntityNotFound(_0x3dccd5,null))['then'](respondWithResult(_0x3dccd5,null))[_0xab9b('0x34')](handleError(_0x3dccd5,null));};exports[_0xab9b('0x35')]=function(_0x1996d2,_0x442ff0){if(_0x1996d2['body']['id']){delete _0x1996d2[_0xab9b('0x36')]['id'];}return db[_0xab9b('0x26')][_0xab9b('0x33')]({'where':{'id':_0x1996d2[_0xab9b('0x37')]['id']}})[_0xab9b('0x20')](handleEntityNotFound(_0x442ff0,null))[_0xab9b('0x20')](saveUpdates(_0x1996d2['body'],null))[_0xab9b('0x20')](respondWithResult(_0x442ff0,null))['catch'](handleError(_0x442ff0,null));};exports[_0xab9b('0x38')]=function(_0x128624,_0x55a112){return db[_0xab9b('0x26')][_0xab9b('0x33')]({'where':{'id':_0x128624['params']['id']}})[_0xab9b('0x20')](handleEntityNotFound(_0x55a112,null))[_0xab9b('0x20')](removeEntity(_0x55a112,null))[_0xab9b('0x34')](handleError(_0x55a112,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 0c40f48..1241ebc 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 _0x2a9d=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4_unicode_ci'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0x2a9d,0x108));var _0xd2a9=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x2a9d[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd2a9('0x0'));var moment=require(_0xd2a9('0x1'));var BPromise=require(_0xd2a9('0x2'));var rp=require(_0xd2a9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd2a9('0x4'));var config=require(_0xd2a9('0x5'));var attributes=require(_0xd2a9('0x6'));module[_0xd2a9('0x7')]=function(_0xdf8f57,_0x17b3b8){return _0xdf8f57[_0xd2a9('0x8')](_0xd2a9('0x9'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd2a9('0xa')});}; \ No newline at end of file +var _0x3b7c=['utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','MailApplication','utf8mb4'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x3b7c,0x10f));var _0xc3b7=function(_0x432987,_0x5b96a2){_0x432987=_0x432987-0x0;var _0x47ce4a=_0x3b7c[_0x432987];return _0x47ce4a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc3b7('0x0'))(_0xc3b7('0x1'));var moment=require(_0xc3b7('0x2'));var BPromise=require(_0xc3b7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3b7('0x4'));var rimraf=require(_0xc3b7('0x5'));var config=require(_0xc3b7('0x6'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x50ba41,_0x103a6d){return _0x50ba41['define'](_0xc3b7('0x7'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc3b7('0x8'),'collate':_0xc3b7('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 9e2fe6e..8639e0b 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 _0x318d=['code','message','info','result','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','then','stringify','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0x318d,0x1c1));var _0xd318=function(_0x194fc4,_0x973613){_0x194fc4=_0x194fc4-0x0;var _0x2773ee=_0x318d[_0x194fc4];return _0x2773ee;};'use strict';var _=require('lodash');var util=require(_0xd318('0x0'));var moment=require('moment');var BPromise=require(_0xd318('0x1'));var rs=require(_0xd318('0x2'));var fs=require('fs');var Redis=require(_0xd318('0x3'));var db=require(_0xd318('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd318('0x5'));var config=require(_0xd318('0x6'));var jayson=require(_0xd318('0x7'));var client=jayson[_0xd318('0x8')][_0xd318('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf2e0a,_0x2fbd02,_0x15af3d){return new BPromise(function(_0x39658b,_0x42c6b6){return client[_0xd318('0xa')](_0xf2e0a,_0x15af3d)['then'](function(_0x6e5860){logger['info'](_0xd318('0xb'),_0x2fbd02,_0xd318('0xc'));logger[_0xd318('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x2fbd02,_0xd318('0xc'),JSON['stringify'](_0x6e5860));if(_0x6e5860[_0xd318('0xe')]){if(_0x6e5860[_0xd318('0xe')][_0xd318('0xf')]===0x1f4){logger[_0xd318('0xe')](_0xd318('0xb'),_0x2fbd02,_0x6e5860[_0xd318('0xe')][_0xd318('0x10')]);return _0x42c6b6(_0x6e5860[_0xd318('0xe')][_0xd318('0x10')]);}logger['error'](_0xd318('0xb'),_0x2fbd02,_0x6e5860[_0xd318('0xe')][_0xd318('0x10')]);return _0x39658b(_0x6e5860[_0xd318('0xe')][_0xd318('0x10')]);}else{logger[_0xd318('0x11')](_0xd318('0xb'),_0x2fbd02,'request\x20sent');_0x39658b(_0x6e5860[_0xd318('0x12')][_0xd318('0x10')]);}})['catch'](function(_0x583f6a){logger[_0xd318('0xe')](_0xd318('0xb'),_0x2fbd02,_0x583f6a);_0x42c6b6(_0x583f6a);});});}exports[_0xd318('0x13')]=function(_0x188457){var _0x445bf2=this;return new Promise(function(_0x15d47b,_0x36c88b){return db[_0xd318('0x14')]['update'](_0x188457[_0xd318('0x15')],{'raw':_0x188457[_0xd318('0x16')]?_0x188457[_0xd318('0x16')][_0xd318('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x188457[_0xd318('0x16')]?_0x188457[_0xd318('0x16')][_0xd318('0x18')]||null:null,'attributes':_0x188457[_0xd318('0x16')]?_0x188457[_0xd318('0x16')][_0xd318('0x19')]||null:null,'limit':_0x188457[_0xd318('0x16')]?_0x188457[_0xd318('0x16')]['limit']||null:null})[_0xd318('0x1a')](function(_0x28470f){logger[_0xd318('0x11')](_0xd318('0x13'),_0x188457);logger[_0xd318('0xd')]('UpdateMailApplication',_0x188457,JSON[_0xd318('0x1b')](_0x28470f));_0x15d47b(_0x28470f);})[_0xd318('0x1c')](function(_0x59c064){logger['error'](_0xd318('0x13'),_0x59c064['message'],_0x188457);_0x36c88b(_0x445bf2[_0xd318('0xe')](0x1f4,_0x59c064[_0xd318('0x10')]));});});}; \ No newline at end of file +var _0x0f24=['catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','UpdateMailApplication','update','options','raw','where','attributes','limit','then'];(function(_0x3ad73a,_0x5669a8){var _0x109bdc=function(_0x104b37){while(--_0x104b37){_0x3ad73a['push'](_0x3ad73a['shift']());}};_0x109bdc(++_0x5669a8);}(_0x0f24,0x187));var _0x40f2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0f24[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x40f2('0x0'));var util=require(_0x40f2('0x1'));var moment=require(_0x40f2('0x2'));var BPromise=require(_0x40f2('0x3'));var rs=require(_0x40f2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x40f2('0x5'));var logger=require(_0x40f2('0x6'))(_0x40f2('0x7'));var config=require(_0x40f2('0x8'));var jayson=require(_0x40f2('0x9'));var client=jayson[_0x40f2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e02af,_0x490a00,_0x39ab79){return new BPromise(function(_0xb9c546,_0x201b1b){return client[_0x40f2('0xb')](_0x4e02af,_0x39ab79)['then'](function(_0x2b1691){logger['info'](_0x40f2('0xc'),_0x490a00,_0x40f2('0xd'));logger[_0x40f2('0xe')](_0x40f2('0xf'),_0x490a00,_0x40f2('0xd'),JSON[_0x40f2('0x10')](_0x2b1691));if(_0x2b1691[_0x40f2('0x11')]){if(_0x2b1691[_0x40f2('0x11')]['code']===0x1f4){logger[_0x40f2('0x11')](_0x40f2('0xc'),_0x490a00,_0x2b1691[_0x40f2('0x11')][_0x40f2('0x12')]);return _0x201b1b(_0x2b1691[_0x40f2('0x11')][_0x40f2('0x12')]);}logger['error'](_0x40f2('0xc'),_0x490a00,_0x2b1691[_0x40f2('0x11')][_0x40f2('0x12')]);return _0xb9c546(_0x2b1691[_0x40f2('0x11')][_0x40f2('0x12')]);}else{logger[_0x40f2('0x13')](_0x40f2('0xc'),_0x490a00,_0x40f2('0xd'));_0xb9c546(_0x2b1691[_0x40f2('0x14')][_0x40f2('0x12')]);}})['catch'](function(_0x32a20){logger[_0x40f2('0x11')](_0x40f2('0xc'),_0x490a00,_0x32a20);_0x201b1b(_0x32a20);});});}exports[_0x40f2('0x15')]=function(_0x5044da){var _0x25dcf3=this;return new Promise(function(_0x22aa18,_0x3221f0){return db['MailApplication'][_0x40f2('0x16')](_0x5044da['body'],{'raw':_0x5044da['options']?_0x5044da[_0x40f2('0x17')][_0x40f2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5044da['options']?_0x5044da['options'][_0x40f2('0x19')]||null:null,'attributes':_0x5044da[_0x40f2('0x17')]?_0x5044da['options'][_0x40f2('0x1a')]||null:null,'limit':_0x5044da[_0x40f2('0x17')]?_0x5044da[_0x40f2('0x17')][_0x40f2('0x1b')]||null:null})[_0x40f2('0x1c')](function(_0x5af04e){logger['info'](_0x40f2('0x15'),_0x5044da);logger[_0x40f2('0xe')](_0x40f2('0x15'),_0x5044da,JSON[_0x40f2('0x10')](_0x5af04e));_0x22aa18(_0x5af04e);})[_0x40f2('0x1d')](function(_0x4e0555){logger['error']('UpdateMailApplication',_0x4e0555[_0x40f2('0x12')],_0x5044da);_0x3221f0(_0x25dcf3[_0x40f2('0x11')](0x1f4,_0x4e0555[_0x40f2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index d7a1869..3751c1a 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 _0xe604=['get','describe','/:id','/:id/messages','/:id/download','download','post','mailinteraction:addtags','addTags','mail','mailinteraction:update','tracked','mailinteraction:destroy','delete','/:id/tags','removeTags','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x59ec6f,_0x36cd83){var _0x18fb74=function(_0x9729fc){while(--_0x9729fc){_0x59ec6f['push'](_0x59ec6f['shift']());}};_0x18fb74(++_0x36cd83);}(_0xe604,0x101));var _0x4e60=function(_0x2e206d,_0x4e9fbb){_0x2e206d=_0x2e206d-0x0;var _0x454239=_0xe604[_0x2e206d];return _0x454239;};'use strict';var multer=require(_0x4e60('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4e60('0x1')]();var auth=require(_0x4e60('0x2'));var interaction=require(_0x4e60('0x3'));var config=require(_0x4e60('0x4'));var controller=require('./mailInteraction.controller');router['get']('/',auth[_0x4e60('0x5')](),controller[_0x4e60('0x6')]);router[_0x4e60('0x7')]('/describe',auth[_0x4e60('0x5')](),controller[_0x4e60('0x8')]);router[_0x4e60('0x7')](_0x4e60('0x9'),auth[_0x4e60('0x5')](),controller['show']);router[_0x4e60('0x7')](_0x4e60('0xa'),auth['isAuthenticated'](),controller['getMessages']);router[_0x4e60('0x7')](_0x4e60('0xb'),auth[_0x4e60('0x5')](),controller[_0x4e60('0xc')]);router['post']('/',auth[_0x4e60('0x5')](),controller['create']);router[_0x4e60('0xd')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x4e60('0xd')]('/:id/tags',auth[_0x4e60('0x5')](),interaction['tracked']('mail',_0x4e60('0xe')),controller[_0x4e60('0xf')]);router['put'](_0x4e60('0x9'),auth[_0x4e60('0x5')](),interaction['tracked'](_0x4e60('0x10'),_0x4e60('0x11')),controller['update']);router['delete'](_0x4e60('0x9'),auth[_0x4e60('0x5')](),interaction[_0x4e60('0x12')]('mail',_0x4e60('0x13')),controller['destroy']);router[_0x4e60('0x14')](_0x4e60('0x15'),auth[_0x4e60('0x5')](),controller[_0x4e60('0x16')]);module[_0x4e60('0x17')]=router; \ No newline at end of file +var _0x8184=['isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','delete','mailinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x98ce5f,_0x3a7853){var _0x592435=function(_0xe6b7d4){while(--_0xe6b7d4){_0x98ce5f['push'](_0x98ce5f['shift']());}};_0x592435(++_0x3a7853);}(_0x8184,0x76));var _0x4818=function(_0xfa8c4,_0x129d61){_0xfa8c4=_0xfa8c4-0x0;var _0xbff44b=_0x8184[_0xfa8c4];return _0xbff44b;};'use strict';var multer=require(_0x4818('0x0'));var util=require(_0x4818('0x1'));var path=require(_0x4818('0x2'));var timeout=require(_0x4818('0x3'));var express=require(_0x4818('0x4'));var router=express[_0x4818('0x5')]();var auth=require(_0x4818('0x6'));var interaction=require(_0x4818('0x7'));var config=require(_0x4818('0x8'));var controller=require('./mailInteraction.controller');router[_0x4818('0x9')]('/',auth[_0x4818('0xa')](),controller['index']);router[_0x4818('0x9')](_0x4818('0xb'),auth[_0x4818('0xa')](),controller[_0x4818('0xc')]);router[_0x4818('0x9')](_0x4818('0xd'),auth[_0x4818('0xa')](),controller[_0x4818('0xe')]);router[_0x4818('0x9')](_0x4818('0xf'),auth[_0x4818('0xa')](),controller[_0x4818('0x10')]);router[_0x4818('0x9')](_0x4818('0x11'),auth[_0x4818('0xa')](),controller[_0x4818('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4818('0x13')]('/:id/messages',auth[_0x4818('0xa')](),controller[_0x4818('0x14')]);router[_0x4818('0x13')](_0x4818('0x15'),auth[_0x4818('0xa')](),interaction[_0x4818('0x16')](_0x4818('0x17'),_0x4818('0x18')),controller[_0x4818('0x19')]);router[_0x4818('0x1a')](_0x4818('0xd'),auth[_0x4818('0xa')](),interaction[_0x4818('0x16')]('mail','mailinteraction:update'),controller[_0x4818('0x1b')]);router[_0x4818('0x1c')](_0x4818('0xd'),auth[_0x4818('0xa')](),interaction[_0x4818('0x16')](_0x4818('0x17'),_0x4818('0x1d')),controller['destroy']);router[_0x4818('0x1c')](_0x4818('0x15'),auth[_0x4818('0xa')](),controller[_0x4818('0x1e')]);module[_0x4818('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 8785cf0..cd79b2a 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 _0xf5b4=['STRING','TEXT','long','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf5b4,0x109));var _0x4f5b=function(_0x425755,_0x16e311){_0x425755=_0x425755-0x0;var _0x38c60b=_0xf5b4[_0x425755];return _0x38c60b;};'use strict';var Sequelize=require(_0x4f5b('0x0'));var iconv=require(_0x4f5b('0x1'));module[_0x4f5b('0x2')]={'closed':{'type':Sequelize[_0x4f5b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4f5b('0x4')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x4f5b('0x5')]},'cc':{'type':Sequelize[_0x4f5b('0x6')](_0x4f5b('0x7'))},'subject':{'type':Sequelize[_0x4f5b('0x6')]()},'attach':{'type':Sequelize[_0x4f5b('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x4f5b('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x4f5b('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x4f5b('0x8')]('in',_0x4f5b('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4f5b('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x4f5b('0x8')]('in',_0x4f5b('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT']('long')},'lastMsgText':{'type':Sequelize[_0x4f5b('0x6')](_0x4f5b('0x7'))}}; \ No newline at end of file +var _0xa063=['out','iconv','DATE','STRING','TEXT','long','BOOLEAN','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa063,0x199));var _0x3a06=function(_0x220a20,_0x4e9f33){_0x220a20=_0x220a20-0x0;var _0x4a0a48=_0xa063[_0x220a20];return _0x4a0a48;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x3a06('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3a06('0x1')]},'disposition':{'type':Sequelize[_0x3a06('0x2')]},'note':{'type':Sequelize[_0x3a06('0x2')]},'inReplyTo':{'type':Sequelize[_0x3a06('0x2')](0x1fe)},'to':{'type':Sequelize[_0x3a06('0x2')]},'cc':{'type':Sequelize[_0x3a06('0x3')](_0x3a06('0x4'))},'subject':{'type':Sequelize[_0x3a06('0x3')]()},'attach':{'type':Sequelize[_0x3a06('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x3a06('0x1')]},'substatus':{'type':Sequelize[_0x3a06('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x3a06('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3a06('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x3a06('0x6')]('in',_0x3a06('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x3a06('0x3')]('long')},'lastMsgText':{'type':Sequelize[_0x3a06('0x3')](_0x3a06('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 35113bf..529feea 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x2427ff,_0x1320f2){var _0x39a2c1=function(_0x420abc){while(--_0x420abc){_0x2427ff['push'](_0x2427ff['shift']());}};_0x39a2c1(++_0x1320f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file +var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x3d1ac8,_0x10dcac){var _0x297ce2=function(_0x551520){while(--_0x551520){_0x3d1ac8['push'](_0x3d1ac8['shift']());}};_0x297ce2(++_0x10dcac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index d94d5b6..5bcc682 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 _0x5096=['then','setDataValue','Users','map','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save','update','getUsers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5096,0x1e6));var _0x6509=function(_0x4bf814,_0x431c38){_0x4bf814=_0x4bf814-0x0;var _0xd4452c=_0x5096[_0x4bf814];return _0xd4452c;};'use strict';var EventEmitter=require(_0x6509('0x0'));var MailInteraction=require(_0x6509('0x1'))['db'][_0x6509('0x2')];var MailMessage=require(_0x6509('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6509('0x3')](0x0);var events={'afterCreate':_0x6509('0x4'),'afterUpdate':_0x6509('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2d8e94){return function(_0x8fbcf1,_0x47dc2d,_0x54e0d0){_0x8fbcf1[_0x6509('0x6')]({'attributes':['id'],'raw':!![]})[_0x6509('0x7')](function(_0x9347e6){_0x8fbcf1[_0x6509('0x8')](_0x6509('0x9'),_0x9347e6[_0x6509('0xa')](function(_0x3173c6){return{'id':_0x3173c6['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x8fbcf1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6509('0x7')](function(_0x5c6f49){_0x8fbcf1[_0x6509('0x8')](_0x6509('0xb'),_0x5c6f49[_0x6509('0xc')]);MailInteractionEvents[_0x6509('0xd')](_0x2d8e94+':'+_0x8fbcf1['id'],_0x8fbcf1);MailInteractionEvents[_0x6509('0xd')](_0x2d8e94,_0x8fbcf1);_0x54e0d0(null);})[_0x6509('0xe')](_0x54e0d0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x6509('0xf')](e,emitEvent(event));}}module[_0x6509('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0xe4ae=['setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0xe4ae,0xdf));var _0xee4a=function(_0x279ebb,_0x2833a0){_0x279ebb=_0x279ebb-0x0;var _0x47fe5b=_0xe4ae[_0x279ebb];return _0x47fe5b;};'use strict';var EventEmitter=require(_0xee4a('0x0'));var MailInteraction=require(_0xee4a('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xee4a('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xee4a('0x2')](0x0);var events={'afterCreate':_0xee4a('0x3'),'afterUpdate':_0xee4a('0x4'),'afterDestroy':_0xee4a('0x5')};function emitEvent(_0x3d2ea1){return function(_0x21397e,_0x12c6bf,_0x3db01d){_0x21397e['getUsers']({'attributes':['id'],'raw':!![]})[_0xee4a('0x6')](function(_0x3a2216){_0x21397e[_0xee4a('0x7')](_0xee4a('0x8'),_0x3a2216[_0xee4a('0x9')](function(_0x44a3cf){return{'id':_0x44a3cf['id']};}));return MailMessage[_0xee4a('0xa')]({'where':{'MailInteractionId':_0x21397e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xee4a('0x6')](function(_0x370dbb){_0x21397e['setDataValue'](_0xee4a('0xb'),_0x370dbb['length']);MailInteractionEvents[_0xee4a('0xc')](_0x3d2ea1+':'+_0x21397e['id'],_0x21397e);MailInteractionEvents[_0xee4a('0xc')](_0x3d2ea1,_0x21397e);_0x3db01d(null);})[_0xee4a('0xd')](_0x3db01d(null));};}for(var e in events){if(events[_0xee4a('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 8564fc8..03faa3b 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 _0x55ca=['changed','models','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt'];(function(_0x14b1a3,_0x4adda8){var _0x1e03fe=function(_0x25ca85){while(--_0x25ca85){_0x14b1a3['push'](_0x14b1a3['shift']());}};_0x1e03fe(++_0x4adda8);}(_0x55ca,0x126));var _0xa55c=function(_0xa599e2,_0x3046be){_0xa599e2=_0xa599e2-0x0;var _0x122f49=_0x55ca[_0xa599e2];return _0x122f49;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('MailInteraction',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[{'name':_0xa55c('0xa'),'fields':['subject','to'],'type':_0xa55c('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x290d28,_0x52a3bc,_0x5849ad){if(_0x290d28[_0xa55c('0xc')]){_0x290d28[_0xa55c('0xd')]=moment()[_0xa55c('0xe')](_0xa55c('0xf'));}if(_0x290d28[_0xa55c('0x10')]){_0x290d28[_0xa55c('0x11')]=moment()[_0xa55c('0xe')](_0xa55c('0xf'));}_0x5849ad(null,_0x52a3bc);},'beforeUpdate':function(_0x3998f7,_0x15eec8,_0x5d47ff){if(_0x3998f7['changed'](_0xa55c('0xc'))){_0x3998f7['substatusAt']=_0x3998f7['substatus']?moment()['format'](_0xa55c('0xf')):null;}if(_0x3998f7[_0xa55c('0x12')](_0xa55c('0x10'))){_0x3998f7[_0xa55c('0x11')]=moment()[_0xa55c('0xe')](_0xa55c('0xf'));_0x3998f7['substatus']=null;_0x3998f7[_0xa55c('0xd')]=null;}_0x5d47ff(null,_0x3998f7);},'afterUpdate':function(_0x3dcf4f,_0x25934f,_0x31e10d){var _0x1c4cfd=_0x3c97c8[_0xa55c('0x13')];var _0x51590e=_0x3dcf4f[_0xa55c('0x14')]({'plain':!![]});if(_0x51590e[_0xa55c('0x10')]){return _0x1c4cfd['MailMessage'][_0xa55c('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x51590e['id']}})[_0xa55c('0x16')](function(){_0x31e10d();})[_0xa55c('0x17')](function(_0x358b61){_0x31e10d(_0x358b61);});}else{_0x31e10d();}}},'charset':_0xa55c('0x18'),'collate':_0xa55c('0x19')});}; \ No newline at end of file +var _0x34e8=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci'];(function(_0x200d31,_0xf84c23){var _0x418c3c=function(_0x14d384){while(--_0x14d384){_0x200d31['push'](_0x200d31['shift']());}};_0x418c3c(++_0xf84c23);}(_0x34e8,0x12c));var _0x834e=function(_0xd4f856,_0x32dc1e){_0xd4f856=_0xd4f856-0x0;var _0x5ab0ad=_0x34e8[_0xd4f856];return _0x5ab0ad;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[{'name':_0x834e('0xd'),'fields':[_0x834e('0xe'),'to'],'type':_0x834e('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x23501c,_0x363786,_0x1af45a){if(_0x23501c[_0x834e('0x10')]){_0x23501c[_0x834e('0x11')]=moment()[_0x834e('0x12')](_0x834e('0x13'));}if(_0x23501c[_0x834e('0x14')]){_0x23501c[_0x834e('0x15')]=moment()[_0x834e('0x12')](_0x834e('0x13'));}_0x1af45a(null,_0x363786);},'beforeUpdate':function(_0x2fd95c,_0x538bb3,_0x5e5b6d){if(_0x2fd95c[_0x834e('0x16')]('substatus')){_0x2fd95c[_0x834e('0x11')]=_0x2fd95c[_0x834e('0x10')]?moment()[_0x834e('0x12')](_0x834e('0x13')):null;}if(_0x2fd95c['changed'](_0x834e('0x14'))){_0x2fd95c[_0x834e('0x15')]=moment()['format'](_0x834e('0x13'));_0x2fd95c['substatus']=null;_0x2fd95c[_0x834e('0x11')]=null;}_0x5e5b6d(null,_0x2fd95c);},'afterUpdate':function(_0x36d443,_0x478afe,_0x43ac41){var _0x22106e=_0x4a2018[_0x834e('0x17')];var _0x50b3f6=_0x36d443[_0x834e('0x18')]({'plain':!![]});if(_0x50b3f6[_0x834e('0x14')]){return _0x22106e[_0x834e('0x19')][_0x834e('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x50b3f6['id']}})[_0x834e('0x1b')](function(){_0x43ac41();})[_0x834e('0x1c')](function(_0x1dd214){_0x43ac41(_0x1dd214);});}else{_0x43ac41();}}},'charset':'utf8mb4','collate':_0x834e('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index b31ce22..ba17f7c 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 _0xd2ce=['addTags','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./mailInteraction.socket','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','limit','debug','AddTagsToMailInteraction','find','where'];(function(_0x3bfdde,_0x306be4){var _0x3f752a=function(_0x3b6751){while(--_0x3b6751){_0x3bfdde['push'](_0x3bfdde['shift']());}};_0x3f752a(++_0x306be4);}(_0xd2ce,0x13c));var _0xed2c=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xd2ce[_0x34021d];return _0x16597b;};'use strict';var _=require('lodash');var util=require(_0xed2c('0x0'));var moment=require('moment');var BPromise=require(_0xed2c('0x1'));var rs=require(_0xed2c('0x2'));var fs=require('fs');var Redis=require(_0xed2c('0x3'));var db=require(_0xed2c('0x4'))['db'];var utils=require(_0xed2c('0x5'));var logger=require(_0xed2c('0x6'))(_0xed2c('0x7'));var config=require('../../config/environment');var jayson=require(_0xed2c('0x8'));var client=jayson['client'][_0xed2c('0x9')]({'port':0x232a});config[_0xed2c('0xa')]=_[_0xed2c('0xb')](config['redis'],{'host':_0xed2c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xed2c('0xa')]));require(_0xed2c('0xd'))['register'](socket);function respondWithRpcPromise(_0x59dbad,_0x2b027a,_0x1b38df){return new BPromise(function(_0x613d5b,_0x26a384){return client['request'](_0x59dbad,_0x1b38df)[_0xed2c('0xe')](function(_0xd9a8fd){logger[_0xed2c('0xf')](_0xed2c('0x10'),_0x2b027a,_0xed2c('0x11'));logger['debug'](_0xed2c('0x12'),_0x2b027a,_0xed2c('0x11'),JSON[_0xed2c('0x13')](_0xd9a8fd));if(_0xd9a8fd[_0xed2c('0x14')]){if(_0xd9a8fd[_0xed2c('0x14')][_0xed2c('0x15')]===0x1f4){logger['error'](_0xed2c('0x10'),_0x2b027a,_0xd9a8fd['error'][_0xed2c('0x16')]);return _0x26a384(_0xd9a8fd[_0xed2c('0x14')][_0xed2c('0x16')]);}logger[_0xed2c('0x14')](_0xed2c('0x10'),_0x2b027a,_0xd9a8fd[_0xed2c('0x14')][_0xed2c('0x16')]);return _0x613d5b(_0xd9a8fd[_0xed2c('0x14')][_0xed2c('0x16')]);}else{logger[_0xed2c('0xf')](_0xed2c('0x10'),_0x2b027a,_0xed2c('0x11'));_0x613d5b(_0xd9a8fd[_0xed2c('0x17')][_0xed2c('0x16')]);}})[_0xed2c('0x18')](function(_0x358b06){logger[_0xed2c('0x14')]('MailInteraction,\x20%s,\x20%s',_0x2b027a,_0x358b06);_0x26a384(_0x358b06);});});}exports[_0xed2c('0x19')]=function(_0x5e3d03){var _0x38c699=this;return new Promise(function(_0x55dba9,_0x43107c){return db[_0xed2c('0x1a')]['update'](_0x5e3d03[_0xed2c('0x1b')],{'raw':_0x5e3d03[_0xed2c('0x1c')]?_0x5e3d03[_0xed2c('0x1c')][_0xed2c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e3d03[_0xed2c('0x1c')]?_0x5e3d03[_0xed2c('0x1c')]['where']||null:null,'attributes':_0x5e3d03[_0xed2c('0x1c')]?_0x5e3d03[_0xed2c('0x1c')]['attributes']||null:null,'limit':_0x5e3d03[_0xed2c('0x1c')]?_0x5e3d03['options'][_0xed2c('0x1e')]||null:null})[_0xed2c('0xe')](function(_0x5db628){logger[_0xed2c('0xf')]('UpdateMailInteraction',_0x5e3d03);logger[_0xed2c('0x1f')](_0xed2c('0x19'),_0x5e3d03,JSON[_0xed2c('0x13')](_0x5db628));_0x55dba9(_0x5db628);})[_0xed2c('0x18')](function(_0x22dc5d){logger[_0xed2c('0x14')](_0xed2c('0x19'),_0x22dc5d['message'],_0x5e3d03);_0x43107c(_0x38c699['error'](0x1f4,_0x22dc5d['message']));});});};exports[_0xed2c('0x20')]=function(_0x263108){return new Promise(function(_0x3ab376,_0x1fdc02){return db[_0xed2c('0x1a')][_0xed2c('0x21')]({'where':_0x263108[_0xed2c('0x1c')]?_0x263108[_0xed2c('0x1c')][_0xed2c('0x22')]||null:null})[_0xed2c('0xe')](function(_0x4748c4){if(_0x4748c4){return _0x4748c4[_0xed2c('0x23')](_0x263108[_0xed2c('0x1b')][_0xed2c('0x24')],_['omit'](_0x263108[_0xed2c('0x1b')],[_0xed2c('0x24'),'id'])||{});}})[_0xed2c('0x25')](function(_0x133479){logger[_0xed2c('0xf')]('AddTags',_0x263108);logger[_0xed2c('0x1f')](_0xed2c('0x26'),_0x263108,JSON['stringify'](_0x133479));_0x3ab376(_0x133479);})['catch'](function(_0x1f0b66){logger[_0xed2c('0x14')](_0xed2c('0x26'),_0x1f0b66[_0xed2c('0x16')],_0x263108);_0x1fdc02(_this[_0xed2c('0x14')](0x1f4,_0x1f0b66[_0xed2c('0x16')]));});});}; \ No newline at end of file +var _0x2fe3=['catch','MailInteraction','update','options','raw','where','attributes','UpdateMailInteraction','AddTagsToMailInteraction','find','body','omit','ids','spread','AddTags','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2fe3,0x87));var _0x32fe=function(_0x3d2ef5,_0x7cf5ae){_0x3d2ef5=_0x3d2ef5-0x0;var _0x346c27=_0x2fe3[_0x3d2ef5];return _0x346c27;};'use strict';var _=require(_0x32fe('0x0'));var util=require(_0x32fe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x32fe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32fe('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x32fe('0x4'));var config=require(_0x32fe('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x32fe('0x6')][_0x32fe('0x7')]({'port':0x232a});config[_0x32fe('0x8')]=_[_0x32fe('0x9')](config[_0x32fe('0x8')],{'host':_0x32fe('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x32fe('0x8')]));require(_0x32fe('0xb'))[_0x32fe('0xc')](socket);function respondWithRpcPromise(_0x2b9bb7,_0x47abd9,_0x5448d8){return new BPromise(function(_0x3b2d24,_0x37b3ae){return client[_0x32fe('0xd')](_0x2b9bb7,_0x5448d8)[_0x32fe('0xe')](function(_0x501ddd){logger[_0x32fe('0xf')]('MailInteraction,\x20%s,\x20%s',_0x47abd9,'request\x20sent');logger[_0x32fe('0x10')](_0x32fe('0x11'),_0x47abd9,_0x32fe('0x12'),JSON[_0x32fe('0x13')](_0x501ddd));if(_0x501ddd[_0x32fe('0x14')]){if(_0x501ddd[_0x32fe('0x14')][_0x32fe('0x15')]===0x1f4){logger[_0x32fe('0x14')](_0x32fe('0x16'),_0x47abd9,_0x501ddd[_0x32fe('0x14')][_0x32fe('0x17')]);return _0x37b3ae(_0x501ddd[_0x32fe('0x14')][_0x32fe('0x17')]);}logger[_0x32fe('0x14')](_0x32fe('0x16'),_0x47abd9,_0x501ddd['error']['message']);return _0x3b2d24(_0x501ddd[_0x32fe('0x14')][_0x32fe('0x17')]);}else{logger['info'](_0x32fe('0x16'),_0x47abd9,_0x32fe('0x12'));_0x3b2d24(_0x501ddd[_0x32fe('0x18')]['message']);}})[_0x32fe('0x19')](function(_0xb7ac89){logger[_0x32fe('0x14')](_0x32fe('0x16'),_0x47abd9,_0xb7ac89);_0x37b3ae(_0xb7ac89);});});}exports['UpdateMailInteraction']=function(_0x26a555){var _0x4881cf=this;return new Promise(function(_0xd5a771,_0x2702ad){return db[_0x32fe('0x1a')][_0x32fe('0x1b')](_0x26a555['body'],{'raw':_0x26a555['options']?_0x26a555[_0x32fe('0x1c')][_0x32fe('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26a555[_0x32fe('0x1c')]?_0x26a555[_0x32fe('0x1c')][_0x32fe('0x1e')]||null:null,'attributes':_0x26a555[_0x32fe('0x1c')]?_0x26a555[_0x32fe('0x1c')][_0x32fe('0x1f')]||null:null,'limit':_0x26a555['options']?_0x26a555[_0x32fe('0x1c')]['limit']||null:null})[_0x32fe('0xe')](function(_0x362181){logger['info'](_0x32fe('0x20'),_0x26a555);logger[_0x32fe('0x10')](_0x32fe('0x20'),_0x26a555,JSON[_0x32fe('0x13')](_0x362181));_0xd5a771(_0x362181);})['catch'](function(_0x50e340){logger[_0x32fe('0x14')]('UpdateMailInteraction',_0x50e340['message'],_0x26a555);_0x2702ad(_0x4881cf[_0x32fe('0x14')](0x1f4,_0x50e340['message']));});});};exports[_0x32fe('0x21')]=function(_0x9c9933){return new Promise(function(_0x1f67c9,_0x382242){return db['MailInteraction'][_0x32fe('0x22')]({'where':_0x9c9933['options']?_0x9c9933[_0x32fe('0x1c')]['where']||null:null})['then'](function(_0xbee08){if(_0xbee08){return _0xbee08['addTags'](_0x9c9933[_0x32fe('0x23')]['ids'],_[_0x32fe('0x24')](_0x9c9933[_0x32fe('0x23')],[_0x32fe('0x25'),'id'])||{});}})[_0x32fe('0x26')](function(_0x41b94f){logger[_0x32fe('0xf')](_0x32fe('0x27'),_0x9c9933);logger[_0x32fe('0x10')](_0x32fe('0x27'),_0x9c9933,JSON['stringify'](_0x41b94f));_0x1f67c9(_0x41b94f);})[_0x32fe('0x19')](function(_0x287423){logger[_0x32fe('0x14')]('AddTags',_0x287423[_0x32fe('0x17')],_0x9c9933);_0x382242(_this[_0x32fe('0x14')](0x1f4,_0x287423[_0x32fe('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 3c150fb..1cffbbd 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 _0x22a3=['mailInteraction:','./mailInteraction.events','remove','update','emit','register','length'];(function(_0x56dbf3,_0x4199c2){var _0x5cbe7c=function(_0x5774e0){while(--_0x5774e0){_0x56dbf3['push'](_0x56dbf3['shift']());}};_0x5cbe7c(++_0x4199c2);}(_0x22a3,0x1c8));var _0x322a=function(_0x1a0620,_0x4f40c3){_0x1a0620=_0x1a0620-0x0;var _0x475abc=_0x22a3[_0x1a0620];return _0x475abc;};'use strict';var MailInteractionEvents=require(_0x322a('0x0'));var events=['save',_0x322a('0x1'),_0x322a('0x2')];function createListener(_0x53192c,_0x14b9eb){return function(_0x4fb7a0){_0x14b9eb[_0x322a('0x3')](_0x53192c,_0x4fb7a0);};}function removeListener(_0x25fafe,_0x23aa37){return function(){MailInteractionEvents['removeListener'](_0x25fafe,_0x23aa37);};}exports[_0x322a('0x4')]=function(_0x2fde6d){for(var _0x4c57a9=0x0,_0x2c45c7=events[_0x322a('0x5')];_0x4c57a9<_0x2c45c7;_0x4c57a9++){var _0x37e421=events[_0x4c57a9];var _0x39b467=createListener(_0x322a('0x6')+_0x37e421,_0x2fde6d);MailInteractionEvents['on'](_0x37e421,_0x39b467);}}; \ No newline at end of file +var _0xab46=['removeListener','register','length','save','update','emit'];(function(_0x32fe12,_0x32f64d){var _0x5346d4=function(_0x28ad08){while(--_0x28ad08){_0x32fe12['push'](_0x32fe12['shift']());}};_0x5346d4(++_0x32f64d);}(_0xab46,0xff));var _0x6ab4=function(_0xf46bd9,_0x322826){_0xf46bd9=_0xf46bd9-0x0;var _0x2763c3=_0xab46[_0xf46bd9];return _0x2763c3;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x6ab4('0x0'),'remove',_0x6ab4('0x1')];function createListener(_0x25907d,_0xce32be){return function(_0x45c9c2){_0xce32be[_0x6ab4('0x2')](_0x25907d,_0x45c9c2);};}function removeListener(_0x5678f2,_0x133bf0){return function(){MailInteractionEvents[_0x6ab4('0x3')](_0x5678f2,_0x133bf0);};}exports[_0x6ab4('0x4')]=function(_0x410a91){for(var _0x68f189=0x0,_0x4faa7f=events[_0x6ab4('0x5')];_0x68f189<_0x4faa7f;_0x68f189++){var _0x5e28e4=events[_0x68f189];var _0x57e1eb=createListener('mailInteraction:'+_0x5e28e4,_0x410a91);MailInteractionEvents['on'](_0x5e28e4,_0x57e1eb);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index a1345e5..f3fd993 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 _0xd6d6=['mailmessage:create','update','put','/:id/accept','accept','reject','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','mail'];(function(_0x63294b,_0x67af04){var _0x5cc535=function(_0x1ee594){while(--_0x1ee594){_0x63294b['push'](_0x63294b['shift']());}};_0x5cc535(++_0x67af04);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x23d1ca,_0x1a5f84){_0x23d1ca=_0x23d1ca-0x0;var _0x2ce344=_0xd6d6[_0x23d1ca];return _0x2ce344;};'use strict';var multer=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var path=require(_0x6d6d('0x2'));var timeout=require(_0x6d6d('0x3'));var express=require('express');var router=express[_0x6d6d('0x4')]();var auth=require(_0x6d6d('0x5'));var interaction=require(_0x6d6d('0x6'));var config=require(_0x6d6d('0x7'));var controller=require(_0x6d6d('0x8'));router[_0x6d6d('0x9')]('/',auth[_0x6d6d('0xa')](),controller['index']);router[_0x6d6d('0x9')](_0x6d6d('0xb'),auth[_0x6d6d('0xa')](),controller[_0x6d6d('0xc')]);router[_0x6d6d('0x9')](_0x6d6d('0xd'),auth[_0x6d6d('0xa')](),controller['show']);router['get'](_0x6d6d('0xe'),auth[_0x6d6d('0xa')](),controller[_0x6d6d('0xf')]);router[_0x6d6d('0x10')]('/',auth[_0x6d6d('0xa')](),interaction['tracked'](_0x6d6d('0x11'),_0x6d6d('0x12')),controller['create']);router['put'](_0x6d6d('0xd'),auth[_0x6d6d('0xa')](),controller[_0x6d6d('0x13')]);router[_0x6d6d('0x14')](_0x6d6d('0x15'),auth[_0x6d6d('0xa')](),controller[_0x6d6d('0x16')]);router[_0x6d6d('0x14')]('/:id/reject',auth[_0x6d6d('0xa')](),controller[_0x6d6d('0x17')]);router[_0x6d6d('0x18')](_0x6d6d('0xd'),auth[_0x6d6d('0xa')](),controller['destroy']);module[_0x6d6d('0x19')]=router; \ No newline at end of file +var _0x7da7=['./mailMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/download','download','tracked','mail','mailmessage:create','put','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0x7da7,0x10d));var _0x77da=function(_0x29771f,_0x1189ae){_0x29771f=_0x29771f-0x0;var _0x279baf=_0x7da7[_0x29771f];return _0x279baf;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var auth=require(_0x77da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77da('0x5'));var controller=require(_0x77da('0x6'));router['get']('/',auth[_0x77da('0x7')](),controller[_0x77da('0x8')]);router['get'](_0x77da('0x9'),auth['isAuthenticated'](),controller[_0x77da('0xa')]);router[_0x77da('0xb')](_0x77da('0xc'),auth[_0x77da('0x7')](),controller[_0x77da('0xd')]);router['get'](_0x77da('0xe'),auth[_0x77da('0x7')](),controller[_0x77da('0xf')]);router['post']('/',auth[_0x77da('0x7')](),interaction[_0x77da('0x10')](_0x77da('0x11'),_0x77da('0x12')),controller['create']);router[_0x77da('0x13')](_0x77da('0xc'),auth[_0x77da('0x7')](),controller['update']);router['put'](_0x77da('0x14'),auth[_0x77da('0x7')](),controller['accept']);router[_0x77da('0x13')](_0x77da('0x15'),auth[_0x77da('0x7')](),controller[_0x77da('0x16')]);router['delete'](_0x77da('0xc'),auth['isAuthenticated'](),controller[_0x77da('0x17')]);module[_0x77da('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index b797231..05f22a4 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 _0x5360=['long','DATE','BOOLEAN','sequelize','lodash','exports','TEXT','medium','ENUM','out'];(function(_0x430b31,_0x25d328){var _0x35f74a=function(_0x28bc66){while(--_0x28bc66){_0x430b31['push'](_0x430b31['shift']());}};_0x35f74a(++_0x25d328);}(_0x5360,0x157));var _0x0536=function(_0x14e266,_0x1510ee){_0x14e266=_0x14e266-0x0;var _0x14ee57=_0x5360[_0x14e266];return _0x14ee57;};'use strict';var Sequelize=require(_0x0536('0x0'));var _=require(_0x0536('0x1'));module[_0x0536('0x2')]={'body':{'type':Sequelize[_0x0536('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x0536('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0536('0x5')]('in',_0x0536('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x0536('0x3')](_0x0536('0x7'))},'cc':{'type':Sequelize[_0x0536('0x3')](_0x0536('0x7'))},'bcc':{'type':Sequelize['TEXT'](_0x0536('0x7'))},'subject':{'type':Sequelize[_0x0536('0x3')]},'sentAt':{'type':Sequelize[_0x0536('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x0536('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize['TEXT'](_0x0536('0x7'))}}; \ No newline at end of file +var _0xf03a=['medium','BOOLEAN','out','STRING','DATE','INTEGER','lodash','exports','TEXT','long'];(function(_0x366c8d,_0x2e1eb9){var _0x146a96=function(_0x259ddd){while(--_0x259ddd){_0x366c8d['push'](_0x366c8d['shift']());}};_0x146a96(++_0x2e1eb9);}(_0xf03a,0x1a0));var _0xaf03=function(_0x5bd99,_0x2f3e48){_0x5bd99=_0x5bd99-0x0;var _0x313375=_0xf03a[_0x5bd99];return _0x313375;};'use strict';var Sequelize=require('sequelize');var _=require(_0xaf03('0x0'));module[_0xaf03('0x1')]={'body':{'type':Sequelize[_0xaf03('0x2')](_0xaf03('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xaf03('0x4'))},'read':{'type':Sequelize[_0xaf03('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xaf03('0x6')),'defaultValue':_0xaf03('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaf03('0x7')](0x1fe)},'from':{'type':Sequelize[_0xaf03('0x7')]},'to':{'type':Sequelize['TEXT'](_0xaf03('0x3'))},'cc':{'type':Sequelize['TEXT'](_0xaf03('0x3'))},'bcc':{'type':Sequelize[_0xaf03('0x2')](_0xaf03('0x3'))},'subject':{'type':Sequelize[_0xaf03('0x2')]},'sentAt':{'type':Sequelize[_0xaf03('0x8')]},'attach':{'type':Sequelize[_0xaf03('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xaf03('0x8')]},'originTo':{'type':Sequelize[_0xaf03('0x2')](_0xaf03('0x3'))},'originCc':{'type':Sequelize[_0xaf03('0x2')](_0xaf03('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index f3a4f85..1bd4249 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 _0x63be=['MailInteraction','MailInteractionId','read1stAt','interaction','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','interface','reject','download','unix','toString','join','server','tmp','files','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','headers','Bcc','existsSync','readFileSync','build','writeFileSync','log','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','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','info','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','body','describe','create','out','secret','split','MailAccount','findOne','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','root','server/files/attachments','basename','List','List\x20not\x20found','SendMail','sendMail','messageId','format','mail-interactions','accept','mail','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get'];(function(_0x493cea,_0x144c6a){var _0x1c32ba=function(_0x47c0f9){while(--_0x47c0f9){_0x493cea['push'](_0x493cea['shift']());}};_0x1c32ba(++_0x144c6a);}(_0x63be,0xd7));var _0xe63b=function(_0x1117aa,_0x5e6cd6){_0x1117aa=_0x1117aa-0x0;var _0x23756d=_0x63be[_0x1117aa];return _0x23756d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe63b('0x0'));var zipdir=require(_0xe63b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe63b('0x2'));var moment=require(_0xe63b('0x3'));var BPromise=require(_0xe63b('0x4'));var Mustache=require('mustache');var util=require(_0xe63b('0x5'));var path=require('path');var sox=require(_0xe63b('0x6'));var csv=require(_0xe63b('0x7'));var ejs=require(_0xe63b('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe63b('0x9'));var crypto=require(_0xe63b('0xa'));var jsforce=require(_0xe63b('0xb'));var deskjs=require(_0xe63b('0xc'));var toCsv=require(_0xe63b('0x7'));var querystring=require(_0xe63b('0xd'));var Papa=require(_0xe63b('0xe'));var Redis=require('ioredis');var authService=require(_0xe63b('0xf'));var qs=require(_0xe63b('0x10'));var as=require(_0xe63b('0x11'));var hardwareService=require(_0xe63b('0x12'));var logger=require(_0xe63b('0x13'))(_0xe63b('0x14'));var utils=require('../../config/utils');var config=require(_0xe63b('0x15'));var db=require(_0xe63b('0x16'))['db'];config[_0xe63b('0x17')]=_[_0xe63b('0x18')](config[_0xe63b('0x17')],{'host':_0xe63b('0x19'),'port':0x18eb});var socket=require(_0xe63b('0x1a'))(new Redis(config[_0xe63b('0x17')]));require(_0xe63b('0x1b'))[_0xe63b('0x1c')](socket);var jayson=require(_0xe63b('0x1d'));var client=jayson[_0xe63b('0x1e')][_0xe63b('0x1f')]({'port':0x232c});var client9003=jayson['client'][_0xe63b('0x1f')]({'port':0x232b});var client9002=jayson[_0xe63b('0x1e')][_0xe63b('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x5a2877,_0xe01c07,_0xae0878){if(_0xae0878){var _0x2aa838=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2aa838[_0xe63b('0x20')](_0xe01c07)){return _0x5a2877;}else{throw new db[(_0xe63b('0x21'))][(_0xe63b('0x22'))](_0xe63b('0x23'));}}else{return _0x5a2877;}}function respondWithRpcPromise(_0x351346,_0x32040e,_0x128d5e,_0x4975e8){return new BPromise(function(_0x14199a,_0x28cb57){var _0x3c2d5e=_0x4975e8||client;return _0x3c2d5e[_0xe63b('0x24')](_0x351346,_0x128d5e)['then'](function(_0x7a5d18){logger[_0xe63b('0x25')]('MailMessage,\x20%s,\x20%s',_0x32040e,_0xe63b('0x26'));logger[_0xe63b('0x27')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x32040e,'request\x20sent',JSON[_0xe63b('0x28')](_0x7a5d18));if(_0x7a5d18['error']){if(_0x7a5d18[_0xe63b('0x29')][_0xe63b('0x2a')]===0x1f4){logger['error'](_0xe63b('0x2b'),_0x32040e,_0x7a5d18['error']['message']);return _0x28cb57(_0x7a5d18[_0xe63b('0x29')][_0xe63b('0x2c')]);}logger[_0xe63b('0x29')]('MailMessage,\x20%s,\x20%s',_0x32040e,_0x7a5d18[_0xe63b('0x29')][_0xe63b('0x2c')]);return _0x14199a(_0x7a5d18[_0xe63b('0x29')][_0xe63b('0x2c')]);}else{logger['info'](_0xe63b('0x2b'),_0x32040e,_0xe63b('0x26'));_0x14199a(_0x7a5d18['result'][_0xe63b('0x2c')]);}})['catch'](function(_0x4cf98e){logger[_0xe63b('0x29')](_0xe63b('0x2b'),_0x32040e,_0x4cf98e);_0x28cb57(_0x4cf98e);});});}function respondWithStatusCode(_0x3c0bff,_0x57ee22){_0x57ee22=_0x57ee22||0xcc;return function(_0xc9580c){if(_0xc9580c){return _0x3c0bff[_0xe63b('0x2d')](_0x57ee22);}return _0x3c0bff['status'](_0x57ee22)[_0xe63b('0x2e')]();};}function respondWithResult(_0xe98256,_0x5872d2){_0x5872d2=_0x5872d2||0xc8;return function(_0x4e665b){if(_0x4e665b){return _0xe98256[_0xe63b('0x2f')](_0x5872d2)['json'](_0x4e665b);}};}function respondWithFilteredResult(_0x7d4e1,_0x19b7f4){return function(_0x14f349){if(_0x14f349){var _0xf63894=_0x14f349[_0xe63b('0x30')],_0xcc9138=_0x19b7f4[_0xe63b('0x31')],_0x2a6fe3=_0x19b7f4['offset']+_0x19b7f4[_0xe63b('0x32')],_0x5220d6;if(_0x2a6fe3>=_0xf63894){_0x2a6fe3=_0xf63894;_0x5220d6=0xc8;}else{_0x5220d6=0xce;}_0x7d4e1['status'](_0x5220d6);return _0x7d4e1[_0xe63b('0x33')](_0xe63b('0x34'),_0xcc9138+'-'+_0x2a6fe3+'/'+_0xf63894)[_0xe63b('0x35')](_0x14f349);}return null;};}function patchUpdates(_0x463618){return function(_0x4369b5){try{jsonpatch[_0xe63b('0x36')](_0x4369b5,_0x463618,!![]);}catch(_0x33d320){return BPromise['reject'](_0x33d320);}return _0x4369b5[_0xe63b('0x37')]();};}function saveUpdates(_0x4cedd2,_0x2c6763){return function(_0x31a32b){if(_0x31a32b){return _0x31a32b[_0xe63b('0x38')](_0x4cedd2)['then'](function(_0x246aaa){return _0x246aaa;});}return null;};}function removeEntity(_0x3dcc88,_0x4a6ad5){return function(_0x4e2173){if(_0x4e2173){return _0x4e2173[_0xe63b('0x39')]()[_0xe63b('0x3a')](function(){_0x3dcc88[_0xe63b('0x2f')](0xcc)[_0xe63b('0x2e')]();});}};}function handleEntityNotFound(_0x16fac3,_0x27b9c1){return function(_0x2fa56f){if(!_0x2fa56f){_0x16fac3[_0xe63b('0x2d')](0x194);}return _0x2fa56f;};}function handleError(_0x11bd06,_0x36f24e){_0x36f24e=_0x36f24e||0x1f4;return function(_0x116c9c){logger[_0xe63b('0x29')](_0x116c9c[_0xe63b('0x3b')]);if(_0x116c9c[_0xe63b('0x3c')]){delete _0x116c9c[_0xe63b('0x3c')];}_0x11bd06[_0xe63b('0x2f')](_0x36f24e)[_0xe63b('0x3d')](_0x116c9c);};}exports[_0xe63b('0x3e')]=function(_0x44d46d,_0x4db96b){var _0x53961d={},_0x2887a4={},_0x3ebdda={'count':0x0,'rows':[]};var _0x1a49f9=_[_0xe63b('0x3f')](db[_0xe63b('0x40')][_0xe63b('0x41')],function(_0x153f65){return{'name':_0x153f65[_0xe63b('0x42')],'type':_0x153f65[_0xe63b('0x43')][_0xe63b('0x44')]};});_0x2887a4[_0xe63b('0x45')]=_[_0xe63b('0x3f')](_0x1a49f9,_0xe63b('0x3c'));_0x2887a4[_0xe63b('0x46')]=_['keys'](_0x44d46d[_0xe63b('0x46')]);_0x2887a4[_0xe63b('0x47')]=_[_0xe63b('0x48')](_0x2887a4[_0xe63b('0x45')],_0x2887a4['query']);_0x53961d[_0xe63b('0x49')]=_['intersection'](_0x2887a4['model'],qs['fields'](_0x44d46d[_0xe63b('0x46')][_0xe63b('0x4a')]));_0x53961d[_0xe63b('0x49')]=_0x53961d[_0xe63b('0x49')][_0xe63b('0x4b')]?_0x53961d[_0xe63b('0x49')]:_0x2887a4['model'];if(!_0x44d46d[_0xe63b('0x46')]['hasOwnProperty'](_0xe63b('0x4c'))){_0x53961d[_0xe63b('0x32')]=qs[_0xe63b('0x32')](_0x44d46d['query'][_0xe63b('0x32')]);_0x53961d[_0xe63b('0x31')]=qs[_0xe63b('0x31')](_0x44d46d[_0xe63b('0x46')]['offset']);}_0x53961d['order']=qs[_0xe63b('0x4d')](_0x44d46d[_0xe63b('0x46')]['sort']);_0x53961d[_0xe63b('0x4e')]=qs[_0xe63b('0x47')](_[_0xe63b('0x4f')](_0x44d46d[_0xe63b('0x46')],_0x2887a4[_0xe63b('0x47')]),_0x1a49f9);if(_0x44d46d['query'][_0xe63b('0x50')]){_0x53961d[_0xe63b('0x4e')]=_[_0xe63b('0x51')](_0x53961d[_0xe63b('0x4e')],{'$or':_['map'](_0x1a49f9,function(_0x122eb1){if(_0x122eb1[_0xe63b('0x43')]!==_0xe63b('0x52')){var _0x209edd={};_0x209edd[_0x122eb1[_0xe63b('0x3c')]]={'$like':'%'+_0x44d46d[_0xe63b('0x46')][_0xe63b('0x50')]+'%'};return _0x209edd;}})});}_0x53961d=_[_0xe63b('0x51')]({},_0x53961d,_0x44d46d[_0xe63b('0x53')]);var _0x4c3493={'where':_0x53961d[_0xe63b('0x4e')]};return db[_0xe63b('0x40')][_0xe63b('0x30')](_0x4c3493)['then'](function(_0x16c9ba){_0x3ebdda[_0xe63b('0x30')]=_0x16c9ba;if(_0x44d46d['query']['includeAll']){_0x53961d[_0xe63b('0x54')]=[{'all':!![]}];}return db[_0xe63b('0x40')][_0xe63b('0x55')](_0x53961d);})[_0xe63b('0x3a')](function(_0xe1fc9f){_0x3ebdda[_0xe63b('0x56')]=_0xe1fc9f;return _0x3ebdda;})[_0xe63b('0x3a')](respondWithFilteredResult(_0x4db96b,_0x53961d))[_0xe63b('0x57')](handleError(_0x4db96b,null));};exports[_0xe63b('0x58')]=function(_0x1c82b3,_0x18a70c){var _0xcb042f={'raw':!![],'where':{'id':_0x1c82b3[_0xe63b('0x59')]['id']}},_0x15382a={};_0x15382a[_0xe63b('0x45')]=_['keys'](db[_0xe63b('0x40')][_0xe63b('0x41')]);_0x15382a[_0xe63b('0x46')]=_['keys'](_0x1c82b3[_0xe63b('0x46')]);_0x15382a[_0xe63b('0x47')]=_['intersection'](_0x15382a[_0xe63b('0x45')],_0x15382a[_0xe63b('0x46')]);_0xcb042f[_0xe63b('0x49')]=_[_0xe63b('0x48')](_0x15382a['model'],qs[_0xe63b('0x4a')](_0x1c82b3[_0xe63b('0x46')][_0xe63b('0x4a')]));_0xcb042f['attributes']=_0xcb042f['attributes'][_0xe63b('0x4b')]?_0xcb042f[_0xe63b('0x49')]:_0x15382a[_0xe63b('0x45')];if(_0x1c82b3['query'][_0xe63b('0x5a')]){_0xcb042f['include']=[{'all':!![]}];}_0xcb042f=_['merge']({},_0xcb042f,_0x1c82b3['options']);return db[_0xe63b('0x40')]['find'](_0xcb042f)[_0xe63b('0x3a')](handleEntityNotFound(_0x18a70c,null))[_0xe63b('0x3a')](respondWithResult(_0x18a70c,null))[_0xe63b('0x57')](handleError(_0x18a70c,null));};exports[_0xe63b('0x38')]=function(_0x1abc9f,_0x15a510){if(_0x1abc9f['body']['id']){delete _0x1abc9f['body']['id'];}return db[_0xe63b('0x40')][_0xe63b('0x5b')]({'where':{'id':_0x1abc9f[_0xe63b('0x59')]['id']}})[_0xe63b('0x3a')](handleEntityNotFound(_0x15a510,null))[_0xe63b('0x3a')](saveUpdates(_0x1abc9f[_0xe63b('0x5c')],null))['then'](respondWithResult(_0x15a510,null))[_0xe63b('0x57')](handleError(_0x15a510,null));};exports['destroy']=function(_0x56baf3,_0x2e7cb4){return db[_0xe63b('0x40')][_0xe63b('0x5b')]({'where':{'id':_0x56baf3[_0xe63b('0x59')]['id']}})[_0xe63b('0x3a')](handleEntityNotFound(_0x2e7cb4,null))[_0xe63b('0x3a')](removeEntity(_0x2e7cb4,null))[_0xe63b('0x57')](handleError(_0x2e7cb4,null));};exports[_0xe63b('0x5d')]=function(_0x2f031e,_0xa8b64a){return db[_0xe63b('0x40')][_0xe63b('0x5d')]()[_0xe63b('0x3a')](respondWithResult(_0xa8b64a,null))[_0xe63b('0x57')](handleError(_0xa8b64a,null));};exports['create']=function(_0x27e240,_0x2be82f){return db[_0xe63b('0x40')][_0xe63b('0x5e')](_0x27e240[_0xe63b('0x5c')])['then'](function(_0x2c8440){if(_0x2c8440){if(_0x2c8440['direction']===_0xe63b('0x5f')&&!_0x2c8440[_0xe63b('0x60')]){var _0x23e188,_0x44b4bf,_0x31215f;if(_0x27e240['body']['to']){_0x44b4bf=_0x27e240[_0xe63b('0x5c')]['to'][_0xe63b('0x61')](',')[0x0];}return db[_0xe63b('0x62')][_0xe63b('0x63')]({'where':{'id':_0x2c8440['MailAccountId']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xe63b('0x64')],'as':_0xe63b('0x65'),'where':{'email':_0x44b4bf},'limit':0x1,'order':[[_0xe63b('0x66'),_0xe63b('0x67')]]}]},{'model':db[_0xe63b('0x68')],'as':_0xe63b('0x69'),'raw':!![]}]})['then'](function(_0x8231c6){_0x23e188=_0x8231c6;if(_0x23e188&&_0x23e188[_0xe63b('0x69')]){var _0x18d5f5={'tls':{'rejectUnauthorized':![]}};if(_[_0xe63b('0x6a')](_0x23e188[_0xe63b('0x69')][_0xe63b('0x6b')])){_0x18d5f5[_0xe63b('0x6c')]=_0x23e188[_0xe63b('0x69')]['host'];_0x18d5f5[_0xe63b('0x6d')]=_0x23e188[_0xe63b('0x69')]['port'];_0x18d5f5[_0xe63b('0x6e')]=_0x23e188['Smtp'][_0xe63b('0x6e')];if(_0x23e188[_0xe63b('0x69')][_0xe63b('0x6f')]){_0x18d5f5[_0xe63b('0x70')]={'user':_0x23e188[_0xe63b('0x69')][_0xe63b('0x71')],'pass':_0x23e188[_0xe63b('0x69')][_0xe63b('0x72')]};}}else{_0x18d5f5[_0xe63b('0x6b')]=_0x23e188['Smtp'][_0xe63b('0x6b')];_0x18d5f5['auth']={'user':_0x23e188[_0xe63b('0x69')][_0xe63b('0x71')],'pass':_0x23e188[_0xe63b('0x69')][_0xe63b('0x72')]};_0x18d5f5[_0xe63b('0x6e')]=_0x23e188[_0xe63b('0x69')][_0xe63b('0x6e')];}if(_0x27e240['body'][_0xe63b('0x73')]&&_0x27e240[_0xe63b('0x5c')][_0xe63b('0x73')][_0xe63b('0x4b')]){for(var _0x31c0da=0x0;_0x31c0da<_0x27e240[_0xe63b('0x5c')][_0xe63b('0x73')][_0xe63b('0x4b')];_0x31c0da+=0x1){_0x27e240[_0xe63b('0x5c')][_0xe63b('0x73')][_0x31c0da]={'filename':_0x27e240[_0xe63b('0x5c')][_0xe63b('0x73')][_0x31c0da][_0xe63b('0x3c')],'path':path['join'](config[_0xe63b('0x74')],_0xe63b('0x75'),_0x27e240[_0xe63b('0x5c')][_0xe63b('0x73')][_0x31c0da][_0xe63b('0x76')])};}}_0x31215f={'account':_0x18d5f5,'message':_0x27e240['body']};return;}})[_0xe63b('0x3a')](function(){if(_0x23e188['List']){if(_0x23e188[_0xe63b('0x77')][_0xe63b('0x65')][_0xe63b('0x4b')]){return _0x23e188['List'][_0xe63b('0x65')][0x0];}else{return db['CmContact'][_0xe63b('0x5e')](_[_0xe63b('0x18')](_0x27e240[_0xe63b('0x5c')],{'firstName':_0x27e240[_0xe63b('0x5c')]['to'],'email':_0x27e240[_0xe63b('0x5c')]['to'],'phone':_0x27e240[_0xe63b('0x5c')]['to'],'ListId':_0x23e188['ListId']}));}}else{throw new Error(_0xe63b('0x78'));}})[_0xe63b('0x3a')](function(){if(_0x31215f){return respondWithRpcPromise(_0xe63b('0x79'),_0xe63b('0x7a'),_0x31215f,client9003)[_0xe63b('0x3a')](function(_0x5a5c9f){return _0x2c8440[_0xe63b('0x38')]({'read':!![],'messageId':_0x5a5c9f[_0xe63b('0x7b')],'sentAt':moment()[_0xe63b('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x3be465){logger[_0xe63b('0x29')]('%s',JSON[_0xe63b('0x28')](_0x3be465));return _0x2c8440;});}return _0x2c8440;});}return _0x2c8440;}})[_0xe63b('0x3a')](respondWithResult(_0x2be82f,0xc9))['catch'](handleError(_0x2be82f,null));};var interaction_log=require(_0xe63b('0x13'))(_0xe63b('0x7d'));exports[_0xe63b('0x7e')]=function(_0xba25ec,_0x15bb43,_0x3e97c8){var _0x4a1d40={'channel':_0xe63b('0x7f')};if(_0xba25ec[_0xe63b('0x5c')]['id']){delete _0xba25ec[_0xe63b('0x5c')]['id'];}_0xba25ec['body']['read']=!![];_0xba25ec[_0xe63b('0x5c')][_0xe63b('0x80')]=moment()['format'](_0xe63b('0x81'));_0xba25ec[_0xe63b('0x5c')][_0xe63b('0x82')]=_0xba25ec[_0xe63b('0x5c')]['UserId']||_0xba25ec[_0xe63b('0x71')]['id'];return db[_0xe63b('0x40')][_0xe63b('0x5b')]({'where':{'id':_0xba25ec[_0xe63b('0x59')]['id'],'UserId':null},'include':[{'model':db[_0xe63b('0x64')],'as':_0xe63b('0x83')}]})[_0xe63b('0x3a')](handleEntityNotFound(_0x15bb43,null))['then'](saveUpdates(_0xba25ec['body'],null))[_0xe63b('0x3a')](function(_0x37d1de){if(_0x37d1de){_0x4a1d40['message']=_0x37d1de[_0xe63b('0x84')]({'plain':!![]});return db[_0xe63b('0x85')][_0xe63b('0x5b')]({'where':{'id':_0x37d1de[_0xe63b('0x86')]}});}return null;})['then'](handleEntityNotFound(_0x15bb43,null))[_0xe63b('0x3a')](function(_0x546945){if(_0x546945){return _0x546945['update']({'UserId':_0xba25ec['body'][_0xe63b('0x82')],'read1stAt':_[_0xe63b('0x6a')](_0x546945[_0xe63b('0x87')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe63b('0x3a')](function(_0x4cded5){if(_0x4cded5){_0x4a1d40[_0xe63b('0x88')]=_0x4cded5[_0xe63b('0x84')]({'plain':!![]});interaction_log[_0xe63b('0x25')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xba25ec[_0xe63b('0x71')]['id'],_0xba25ec['user'][_0xe63b('0x3c')],_0xba25ec[_0xe63b('0x71')]['role'],_0x4a1d40[_0xe63b('0x88')]['id'],_0xba25ec[_0xe63b('0x5c')]?JSON[_0xe63b('0x28')](_0xba25ec[_0xe63b('0x5c')]):_0xe63b('0x89'));return respondWithRpcPromise(_0xe63b('0x8a'),_0xe63b('0x8b'),_0x4a1d40);}return null;})[_0xe63b('0x3a')](function(_0x3d8c88){if(_0x3d8c88){if(_0xba25ec[_0xe63b('0x5c')][_0xe63b('0x8c')]){_0x4a1d40[_0xe63b('0x2c')]['interface']=util['format'](_0xe63b('0x8d'),_0xba25ec[_0xe63b('0x71')][_0xe63b('0x3c')]);_0x4a1d40['message'][_0xe63b('0x8e')]=_0x4a1d40[_0xe63b('0x8e')];_0x4a1d40[_0xe63b('0x2c')][_0xe63b('0x8f')]=_0xe63b('0x7e');return respondWithRpcPromise(_0xe63b('0x90'),_0xe63b('0x90'),{'event':_0xe63b('0x91'),'message':_0x4a1d40[_0xe63b('0x2c')]},client9002)[_0xe63b('0x3a')](function(){return _0x4a1d40;});}return _0x4a1d40;}return null;})['then'](respondWithResult(_0x15bb43,null))[_0xe63b('0x57')](handleError(_0x15bb43,null));};var interaction_log=require('../../config/logger')(_0xe63b('0x7d'));exports['reject']=function(_0x4ee231,_0x59acb8,_0x83e79a){var _0x4f9734={'agent':{},'channel':_0xe63b('0x7f')};if(_0x4ee231[_0xe63b('0x5c')]['id']){delete _0x4ee231['body']['id'];}_0x4ee231[_0xe63b('0x5c')][_0xe63b('0x82')]=_0x4ee231['body']['UserId']||_0x4ee231[_0xe63b('0x71')]['id'];_0x4f9734[_0xe63b('0x92')]['id']=_0x4ee231['body'][_0xe63b('0x82')];return db['MailMessage'][_0xe63b('0x5b')]({'where':{'id':_0x4ee231[_0xe63b('0x59')]['id'],'UserId':null}})[_0xe63b('0x3a')](handleEntityNotFound(_0x59acb8,null))[_0xe63b('0x3a')](function(_0x33b737){if(_0x33b737){_0x4f9734[_0xe63b('0x2c')]=_0x33b737[_0xe63b('0x84')]({'plain':!![]});return db[_0xe63b('0x85')][_0xe63b('0x5b')]({'where':{'id':_0x33b737[_0xe63b('0x86')]}});}return null;})[_0xe63b('0x3a')](handleEntityNotFound(_0x59acb8,null))[_0xe63b('0x3a')](function(_0x1e7d07){if(_0x1e7d07){_0x4f9734[_0xe63b('0x88')]=_0x1e7d07[_0xe63b('0x84')]({'plain':!![]});interaction_log[_0xe63b('0x25')](_0xe63b('0x93'),_0x4ee231[_0xe63b('0x71')]['id'],_0x4ee231[_0xe63b('0x71')][_0xe63b('0x3c')],_0x4ee231['user'][_0xe63b('0x94')],_0x4f9734['interaction']['id'],_0x4ee231[_0xe63b('0x5c')]?JSON[_0xe63b('0x28')](_0x4ee231[_0xe63b('0x5c')]):_0xe63b('0x89'));return respondWithRpcPromise(_0xe63b('0x95'),'rejectMessage',_0x4f9734);}return null;})[_0xe63b('0x3a')](function(_0x3c19b8){if(_0x3c19b8){_0x3c19b8[_0xe63b('0x2c')][_0xe63b('0x96')]=util['format'](_0xe63b('0x8d'),_0x4ee231[_0xe63b('0x71')][_0xe63b('0x3c')]);_0x3c19b8[_0xe63b('0x2c')]['channel']=_0x4f9734['channel'];_0x3c19b8['message'][_0xe63b('0x8f')]=_0xe63b('0x97');respondWithRpcPromise('EventManager',_0xe63b('0x90'),{'event':'rejectmessage','message':_0x3c19b8[_0xe63b('0x2c')]},client9002);return _0x4f9734;}return null;})[_0xe63b('0x3a')](respondWithResult(_0x59acb8,null))[_0xe63b('0x57')](handleError(_0x59acb8,null));};exports[_0xe63b('0x98')]=function(_0x256327,_0x3f5f35){var _0x1b3347=moment()[_0xe63b('0x99')]()[_0xe63b('0x9a')]();var _0x5b2cfe=path[_0xe63b('0x9b')](config[_0xe63b('0x74')],_0xe63b('0x9c'),'files',_0xe63b('0x9d'));var _0x28b91c=path[_0xe63b('0x9b')](config[_0xe63b('0x74')],_0xe63b('0x9c'),_0xe63b('0x9e'),_0xe63b('0x73'));var _0x24bfb7=util[_0xe63b('0x7c')](_0xe63b('0x9f'),_0x1b3347);return db[_0xe63b('0x40')][_0xe63b('0x5b')]({'where':{'id':_0x256327[_0xe63b('0x59')]['id']},'attributes':['id',_0xe63b('0x5c'),_0xe63b('0xa0'),'to','cc',_0xe63b('0xa1'),'subject',_0xe63b('0xa2')],'include':_0x256327['query']['attachments']?[{'model':db[_0xe63b('0xa3')],'as':_0xe63b('0xa4')}]:undefined})[_0xe63b('0x3a')](handleEntityNotFound(_0x3f5f35,null))[_0xe63b('0x3a')](function(_0x17089f){if(_0x17089f){var _0x490f7d=_0x17089f;var _0x1b83e4={'from':_0x490f7d['from'],'to':_0x490f7d['to'],'subject':_0x490f7d[_0xe63b('0xa5')],'html':_0x490f7d[_0xe63b('0x5c')],'headers':{'Date':moment(_0x490f7d[_0xe63b('0xa2')])[_0xe63b('0x7c')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x17089f['cc']){_0x1b83e4['headers']['Cc']=_0x17089f['cc'];}if(_0x17089f[_0xe63b('0xa1')]){_0x1b83e4[_0xe63b('0xa6')][_0xe63b('0xa7')]=_0x17089f[_0xe63b('0xa1')];}return new BPromise(function(_0x1958f7,_0x5bd9dd){if(_0x17089f[_0xe63b('0xa4')]){for(var _0x43badd=0x0;_0x43badd<_0x17089f[_0xe63b('0xa4')][_0xe63b('0x4b')];_0x43badd++){var _0x57c24a=_0x17089f['Attachments'][_0x43badd];var _0x1008af=path[_0xe63b('0x9b')](_0x28b91c,_0x57c24a[_0xe63b('0x76')]);if(fs[_0xe63b('0xa8')](_0x1008af)){_0x1b83e4[_0xe63b('0x73')]['push']({'name':_0x57c24a[_0xe63b('0x3c')],'contentType':_0x57c24a[_0xe63b('0x43')],'data':fs[_0xe63b('0xa9')](_0x1008af)});}}}emlformat[_0xe63b('0xaa')](_0x1b83e4,function(_0x349662,_0x283e77){if(_0x349662)return _0x5bd9dd(_0x349662);fs[_0xe63b('0xab')](path[_0xe63b('0x9b')](_0x5b2cfe,_0x24bfb7),_0x283e77);return _0x1958f7(_0x283e77);});});}})['then'](function(_0x56bfa8){if(_0x56bfa8){return _0x3f5f35[_0xe63b('0x98')](path['join'](_0x5b2cfe,_0x24bfb7),_0x24bfb7,function(_0x574f4a){if(_0x574f4a){console[_0xe63b('0xac')]('err',_0x574f4a);}else{fs[_0xe63b('0xad')](path[_0xe63b('0x9b')](_0x5b2cfe,_0x24bfb7));}});}})[_0xe63b('0x57')](handleError(_0x3f5f35,null));}; \ No newline at end of file +var _0x3de2=['sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','destroy','stack','name','send','index','map','MailMessage','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','type','options','count','includeAll','rows','show','params','rawAttributes','include','find','body','describe','create','direction','out','secret','split','findOne','MailAccountId','List','CmContact','MailServerOut','Smtp','isNil','port','secure','authentication','pass','service','user','attachments','join','root','Contacts','ListId','List\x20not\x20found','SendMail','messageId','format','../../config/logger','mail-interactions','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','MailInteraction','MailInteractionId','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','rejectmessage','download','unix','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','readFileSync','writeFileSync','log','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','catch'];(function(_0x2bda4d,_0x139e16){var _0x8fec4c=function(_0x23f91a){while(--_0x23f91a){_0x2bda4d['push'](_0x2bda4d['shift']());}};_0x8fec4c(++_0x139e16);}(_0x3de2,0x79));var _0x23de=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x3de2[_0x4f9b18];return _0x29f20c;};'use strict';var pdf=require(_0x23de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x23de('0x1'));var zipdir=require(_0x23de('0x2'));var jsonpatch=require(_0x23de('0x3'));var rp=require(_0x23de('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x23de('0x5'));var util=require(_0x23de('0x6'));var path=require(_0x23de('0x7'));var sox=require(_0x23de('0x8'));var csv=require('to-csv');var ejs=require(_0x23de('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x23de('0xa'));var crypto=require(_0x23de('0xb'));var jsforce=require(_0x23de('0xc'));var deskjs=require(_0x23de('0xd'));var toCsv=require(_0x23de('0xe'));var querystring=require(_0x23de('0xf'));var Papa=require(_0x23de('0x10'));var Redis=require('ioredis');var authService=require(_0x23de('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x23de('0x12'));var hardwareService=require(_0x23de('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x23de('0x14'));var config=require('../../config/environment');var db=require(_0x23de('0x15'))['db'];config['redis']=_[_0x23de('0x16')](config[_0x23de('0x17')],{'host':_0x23de('0x18'),'port':0x18eb});var socket=require(_0x23de('0x19'))(new Redis(config[_0x23de('0x17')]));require(_0x23de('0x1a'))[_0x23de('0x1b')](socket);var jayson=require(_0x23de('0x1c'));var client=jayson[_0x23de('0x1d')][_0x23de('0x1e')]({'port':0x232c});var client9003=jayson[_0x23de('0x1d')][_0x23de('0x1e')]({'port':0x232b});var client9002=jayson['client'][_0x23de('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x19f1e9,_0x3c4e05,_0x2bcae4){if(_0x2bcae4){var _0x5edfab=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5edfab['test'](_0x3c4e05)){return _0x19f1e9;}else{throw new db[(_0x23de('0x1f'))][(_0x23de('0x20'))](_0x23de('0x21'));}}else{return _0x19f1e9;}}function respondWithRpcPromise(_0x26cf3b,_0x20de0d,_0x25e0a7,_0x2c60f1){return new BPromise(function(_0x41739f,_0x48acea){var _0x145ae6=_0x2c60f1||client;return _0x145ae6['request'](_0x26cf3b,_0x25e0a7)[_0x23de('0x22')](function(_0x4b325a){logger['info']('MailMessage,\x20%s,\x20%s',_0x20de0d,_0x23de('0x23'));logger[_0x23de('0x24')](_0x23de('0x25'),_0x20de0d,_0x23de('0x23'),JSON[_0x23de('0x26')](_0x4b325a));if(_0x4b325a[_0x23de('0x27')]){if(_0x4b325a[_0x23de('0x27')][_0x23de('0x28')]===0x1f4){logger[_0x23de('0x27')](_0x23de('0x29'),_0x20de0d,_0x4b325a[_0x23de('0x27')]['message']);return _0x48acea(_0x4b325a['error'][_0x23de('0x2a')]);}logger[_0x23de('0x27')](_0x23de('0x29'),_0x20de0d,_0x4b325a[_0x23de('0x27')][_0x23de('0x2a')]);return _0x41739f(_0x4b325a[_0x23de('0x27')]['message']);}else{logger[_0x23de('0x2b')]('MailMessage,\x20%s,\x20%s',_0x20de0d,'request\x20sent');_0x41739f(_0x4b325a[_0x23de('0x2c')][_0x23de('0x2a')]);}})[_0x23de('0x2d')](function(_0x40e65e){logger[_0x23de('0x27')](_0x23de('0x29'),_0x20de0d,_0x40e65e);_0x48acea(_0x40e65e);});});}function respondWithStatusCode(_0x28f8bf,_0x93c31b){_0x93c31b=_0x93c31b||0xcc;return function(_0x347bd2){if(_0x347bd2){return _0x28f8bf[_0x23de('0x2e')](_0x93c31b);}return _0x28f8bf[_0x23de('0x2f')](_0x93c31b)[_0x23de('0x30')]();};}function respondWithResult(_0x48557b,_0x530733){_0x530733=_0x530733||0xc8;return function(_0x5cd8fd){if(_0x5cd8fd){return _0x48557b['status'](_0x530733)['json'](_0x5cd8fd);}};}function respondWithFilteredResult(_0x1d7d9f,_0x2d270a){return function(_0x40d7a7){if(_0x40d7a7){var _0xa3650d=_0x40d7a7['count'],_0x3041d8=_0x2d270a[_0x23de('0x31')],_0x5565f5=_0x2d270a[_0x23de('0x31')]+_0x2d270a[_0x23de('0x32')],_0xbd230a;if(_0x5565f5>=_0xa3650d){_0x5565f5=_0xa3650d;_0xbd230a=0xc8;}else{_0xbd230a=0xce;}_0x1d7d9f[_0x23de('0x2f')](_0xbd230a);return _0x1d7d9f['set'](_0x23de('0x33'),_0x3041d8+'-'+_0x5565f5+'/'+_0xa3650d)[_0x23de('0x34')](_0x40d7a7);}return null;};}function patchUpdates(_0x1316a6){return function(_0x6b2383){try{jsonpatch[_0x23de('0x35')](_0x6b2383,_0x1316a6,!![]);}catch(_0x48c004){return BPromise[_0x23de('0x36')](_0x48c004);}return _0x6b2383[_0x23de('0x37')]();};}function saveUpdates(_0x1cae51,_0x30a217){return function(_0x520705){if(_0x520705){return _0x520705['update'](_0x1cae51)[_0x23de('0x22')](function(_0x3966b4){return _0x3966b4;});}return null;};}function removeEntity(_0x58f09d,_0x4e79b7){return function(_0x463ee5){if(_0x463ee5){return _0x463ee5[_0x23de('0x38')]()[_0x23de('0x22')](function(){_0x58f09d[_0x23de('0x2f')](0xcc)[_0x23de('0x30')]();});}};}function handleEntityNotFound(_0x32e680,_0x3d87b8){return function(_0x1cb238){if(!_0x1cb238){_0x32e680[_0x23de('0x2e')](0x194);}return _0x1cb238;};}function handleError(_0x1dd131,_0x1607dc){_0x1607dc=_0x1607dc||0x1f4;return function(_0x3926e3){logger['error'](_0x3926e3[_0x23de('0x39')]);if(_0x3926e3[_0x23de('0x3a')]){delete _0x3926e3[_0x23de('0x3a')];}_0x1dd131[_0x23de('0x2f')](_0x1607dc)[_0x23de('0x3b')](_0x3926e3);};}exports[_0x23de('0x3c')]=function(_0x2dedf4,_0x1e347f){var _0x25a002={},_0x1a6149={},_0x2cc6da={'count':0x0,'rows':[]};var _0x517c69=_[_0x23de('0x3d')](db[_0x23de('0x3e')]['rawAttributes'],function(_0x576e02){return{'name':_0x576e02['fieldName'],'type':_0x576e02['type']['key']};});_0x1a6149[_0x23de('0x3f')]=_[_0x23de('0x3d')](_0x517c69,_0x23de('0x3a'));_0x1a6149['query']=_[_0x23de('0x40')](_0x2dedf4[_0x23de('0x41')]);_0x1a6149['filters']=_[_0x23de('0x42')](_0x1a6149[_0x23de('0x3f')],_0x1a6149[_0x23de('0x41')]);_0x25a002[_0x23de('0x43')]=_[_0x23de('0x42')](_0x1a6149[_0x23de('0x3f')],qs[_0x23de('0x44')](_0x2dedf4[_0x23de('0x41')][_0x23de('0x44')]));_0x25a002[_0x23de('0x43')]=_0x25a002[_0x23de('0x43')][_0x23de('0x45')]?_0x25a002[_0x23de('0x43')]:_0x1a6149['model'];if(!_0x2dedf4[_0x23de('0x41')]['hasOwnProperty'](_0x23de('0x46'))){_0x25a002['limit']=qs[_0x23de('0x32')](_0x2dedf4[_0x23de('0x41')]['limit']);_0x25a002['offset']=qs[_0x23de('0x31')](_0x2dedf4['query'][_0x23de('0x31')]);}_0x25a002[_0x23de('0x47')]=qs[_0x23de('0x48')](_0x2dedf4['query'][_0x23de('0x48')]);_0x25a002['where']=qs[_0x23de('0x49')](_[_0x23de('0x4a')](_0x2dedf4[_0x23de('0x41')],_0x1a6149[_0x23de('0x49')]),_0x517c69);if(_0x2dedf4[_0x23de('0x41')][_0x23de('0x4b')]){_0x25a002[_0x23de('0x4c')]=_[_0x23de('0x4d')](_0x25a002['where'],{'$or':_[_0x23de('0x3d')](_0x517c69,function(_0x35371a){if(_0x35371a[_0x23de('0x4e')]!=='VIRTUAL'){var _0x5fe57={};_0x5fe57[_0x35371a[_0x23de('0x3a')]]={'$like':'%'+_0x2dedf4['query'][_0x23de('0x4b')]+'%'};return _0x5fe57;}})});}_0x25a002=_[_0x23de('0x4d')]({},_0x25a002,_0x2dedf4[_0x23de('0x4f')]);var _0x11d027={'where':_0x25a002[_0x23de('0x4c')]};return db[_0x23de('0x3e')][_0x23de('0x50')](_0x11d027)[_0x23de('0x22')](function(_0x9ee170){_0x2cc6da['count']=_0x9ee170;if(_0x2dedf4['query'][_0x23de('0x51')]){_0x25a002['include']=[{'all':!![]}];}return db[_0x23de('0x3e')]['findAll'](_0x25a002);})['then'](function(_0x5842ae){_0x2cc6da[_0x23de('0x52')]=_0x5842ae;return _0x2cc6da;})['then'](respondWithFilteredResult(_0x1e347f,_0x25a002))[_0x23de('0x2d')](handleError(_0x1e347f,null));};exports[_0x23de('0x53')]=function(_0x3d9bde,_0x23c0bc){var _0x237637={'raw':!![],'where':{'id':_0x3d9bde[_0x23de('0x54')]['id']}},_0x1ed821={};_0x1ed821[_0x23de('0x3f')]=_[_0x23de('0x40')](db[_0x23de('0x3e')][_0x23de('0x55')]);_0x1ed821[_0x23de('0x41')]=_[_0x23de('0x40')](_0x3d9bde[_0x23de('0x41')]);_0x1ed821[_0x23de('0x49')]=_[_0x23de('0x42')](_0x1ed821[_0x23de('0x3f')],_0x1ed821[_0x23de('0x41')]);_0x237637[_0x23de('0x43')]=_[_0x23de('0x42')](_0x1ed821[_0x23de('0x3f')],qs[_0x23de('0x44')](_0x3d9bde['query'][_0x23de('0x44')]));_0x237637[_0x23de('0x43')]=_0x237637[_0x23de('0x43')]['length']?_0x237637[_0x23de('0x43')]:_0x1ed821[_0x23de('0x3f')];if(_0x3d9bde[_0x23de('0x41')][_0x23de('0x51')]){_0x237637[_0x23de('0x56')]=[{'all':!![]}];}_0x237637=_['merge']({},_0x237637,_0x3d9bde[_0x23de('0x4f')]);return db[_0x23de('0x3e')][_0x23de('0x57')](_0x237637)[_0x23de('0x22')](handleEntityNotFound(_0x23c0bc,null))['then'](respondWithResult(_0x23c0bc,null))[_0x23de('0x2d')](handleError(_0x23c0bc,null));};exports['update']=function(_0xe22f10,_0x5d4aed){if(_0xe22f10[_0x23de('0x58')]['id']){delete _0xe22f10[_0x23de('0x58')]['id'];}return db[_0x23de('0x3e')][_0x23de('0x57')]({'where':{'id':_0xe22f10['params']['id']}})[_0x23de('0x22')](handleEntityNotFound(_0x5d4aed,null))[_0x23de('0x22')](saveUpdates(_0xe22f10[_0x23de('0x58')],null))[_0x23de('0x22')](respondWithResult(_0x5d4aed,null))[_0x23de('0x2d')](handleError(_0x5d4aed,null));};exports[_0x23de('0x38')]=function(_0x33d8de,_0x27cc61){return db[_0x23de('0x3e')][_0x23de('0x57')]({'where':{'id':_0x33d8de[_0x23de('0x54')]['id']}})[_0x23de('0x22')](handleEntityNotFound(_0x27cc61,null))[_0x23de('0x22')](removeEntity(_0x27cc61,null))[_0x23de('0x2d')](handleError(_0x27cc61,null));};exports['describe']=function(_0xd98eb8,_0x43cb19){return db['MailMessage'][_0x23de('0x59')]()[_0x23de('0x22')](respondWithResult(_0x43cb19,null))[_0x23de('0x2d')](handleError(_0x43cb19,null));};exports[_0x23de('0x5a')]=function(_0x35e5e0,_0x4a8e0c){return db[_0x23de('0x3e')][_0x23de('0x5a')](_0x35e5e0[_0x23de('0x58')])[_0x23de('0x22')](function(_0x15e7c2){if(_0x15e7c2){if(_0x15e7c2[_0x23de('0x5b')]===_0x23de('0x5c')&&!_0x15e7c2[_0x23de('0x5d')]){var _0x57460d,_0x47f721,_0xa64e69;if(_0x35e5e0[_0x23de('0x58')]['to']){_0x47f721=_0x35e5e0[_0x23de('0x58')]['to'][_0x23de('0x5e')](',')[0x0];}return db['MailAccount'][_0x23de('0x5f')]({'where':{'id':_0x15e7c2[_0x23de('0x60')]},'include':[{'model':db['CmList'],'as':_0x23de('0x61'),'include':[{'model':db[_0x23de('0x62')],'as':'Contacts','where':{'email':_0x47f721},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x23de('0x63')],'as':_0x23de('0x64'),'raw':!![]}]})[_0x23de('0x22')](function(_0x478516){_0x57460d=_0x478516;if(_0x57460d&&_0x57460d[_0x23de('0x64')]){var _0x240f93={'tls':{'rejectUnauthorized':![]}};if(_[_0x23de('0x65')](_0x57460d[_0x23de('0x64')]['service'])){_0x240f93['host']=_0x57460d[_0x23de('0x64')]['host'];_0x240f93[_0x23de('0x66')]=_0x57460d[_0x23de('0x64')][_0x23de('0x66')];_0x240f93[_0x23de('0x67')]=_0x57460d[_0x23de('0x64')][_0x23de('0x67')];if(_0x57460d[_0x23de('0x64')][_0x23de('0x68')]){_0x240f93['auth']={'user':_0x57460d[_0x23de('0x64')]['user'],'pass':_0x57460d['Smtp'][_0x23de('0x69')]};}}else{_0x240f93[_0x23de('0x6a')]=_0x57460d[_0x23de('0x64')]['service'];_0x240f93['auth']={'user':_0x57460d[_0x23de('0x64')][_0x23de('0x6b')],'pass':_0x57460d['Smtp'][_0x23de('0x69')]};_0x240f93[_0x23de('0x67')]=_0x57460d['Smtp'][_0x23de('0x67')];}if(_0x35e5e0[_0x23de('0x58')]['attachments']&&_0x35e5e0[_0x23de('0x58')][_0x23de('0x6c')][_0x23de('0x45')]){for(var _0x5ecb50=0x0;_0x5ecb50<_0x35e5e0[_0x23de('0x58')][_0x23de('0x6c')][_0x23de('0x45')];_0x5ecb50+=0x1){_0x35e5e0['body'][_0x23de('0x6c')][_0x5ecb50]={'filename':_0x35e5e0[_0x23de('0x58')][_0x23de('0x6c')][_0x5ecb50][_0x23de('0x3a')],'path':path[_0x23de('0x6d')](config[_0x23de('0x6e')],'server/files/attachments',_0x35e5e0[_0x23de('0x58')][_0x23de('0x6c')][_0x5ecb50]['basename'])};}}_0xa64e69={'account':_0x240f93,'message':_0x35e5e0[_0x23de('0x58')]};return;}})[_0x23de('0x22')](function(){if(_0x57460d[_0x23de('0x61')]){if(_0x57460d['List'][_0x23de('0x6f')]['length']){return _0x57460d[_0x23de('0x61')][_0x23de('0x6f')][0x0];}else{return db['CmContact'][_0x23de('0x5a')](_[_0x23de('0x16')](_0x35e5e0[_0x23de('0x58')],{'firstName':_0x35e5e0['body']['to'],'email':_0x35e5e0[_0x23de('0x58')]['to'],'phone':_0x35e5e0['body']['to'],'ListId':_0x57460d[_0x23de('0x70')]}));}}else{throw new Error(_0x23de('0x71'));}})['then'](function(){if(_0xa64e69){return respondWithRpcPromise(_0x23de('0x72'),'sendMail',_0xa64e69,client9003)[_0x23de('0x22')](function(_0x44f14f){return _0x15e7c2['update']({'read':!![],'messageId':_0x44f14f[_0x23de('0x73')],'sentAt':moment()[_0x23de('0x74')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x23de('0x2d')](function(_0x448623){logger[_0x23de('0x27')]('%s',JSON['stringify'](_0x448623));return _0x15e7c2;});}return _0x15e7c2;});}return _0x15e7c2;}})['then'](respondWithResult(_0x4a8e0c,0xc9))[_0x23de('0x2d')](handleError(_0x4a8e0c,null));};var interaction_log=require(_0x23de('0x75'))(_0x23de('0x76'));exports['accept']=function(_0x215799,_0xa9de86,_0x1fa704){var _0x49433f={'channel':_0x23de('0x77')};if(_0x215799[_0x23de('0x58')]['id']){delete _0x215799['body']['id'];}_0x215799[_0x23de('0x58')][_0x23de('0x78')]=!![];_0x215799[_0x23de('0x58')][_0x23de('0x79')]=moment()[_0x23de('0x74')](_0x23de('0x7a'));_0x215799[_0x23de('0x58')][_0x23de('0x7b')]=_0x215799[_0x23de('0x58')]['UserId']||_0x215799[_0x23de('0x6b')]['id'];return db[_0x23de('0x3e')]['find']({'where':{'id':_0x215799['params']['id'],'UserId':null},'include':[{'model':db[_0x23de('0x62')],'as':'Contact'}]})[_0x23de('0x22')](handleEntityNotFound(_0xa9de86,null))[_0x23de('0x22')](saveUpdates(_0x215799[_0x23de('0x58')],null))[_0x23de('0x22')](function(_0x1a3b11){if(_0x1a3b11){_0x49433f['message']=_0x1a3b11[_0x23de('0x7c')]({'plain':!![]});return db[_0x23de('0x7d')][_0x23de('0x57')]({'where':{'id':_0x1a3b11[_0x23de('0x7e')]}});}return null;})[_0x23de('0x22')](handleEntityNotFound(_0xa9de86,null))[_0x23de('0x22')](function(_0x47f5b5){if(_0x47f5b5){return _0x47f5b5['update']({'UserId':_0x215799['body'][_0x23de('0x7b')],'read1stAt':_[_0x23de('0x65')](_0x47f5b5[_0x23de('0x7f')])?moment()[_0x23de('0x74')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x23de('0x22')](function(_0x15f157){if(_0x15f157){_0x49433f[_0x23de('0x80')]=_0x15f157[_0x23de('0x7c')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x215799[_0x23de('0x6b')]['id'],_0x215799[_0x23de('0x6b')][_0x23de('0x3a')],_0x215799[_0x23de('0x6b')][_0x23de('0x81')],_0x49433f['interaction']['id'],_0x215799[_0x23de('0x58')]?JSON['stringify'](_0x215799[_0x23de('0x58')]):_0x23de('0x82'));return respondWithRpcPromise(_0x23de('0x83'),_0x23de('0x84'),_0x49433f);}return null;})[_0x23de('0x22')](function(_0x1a971f){if(_0x1a971f){if(_0x215799['body'][_0x23de('0x85')]){_0x49433f[_0x23de('0x2a')][_0x23de('0x86')]=util[_0x23de('0x74')]('SIP/%s',_0x215799[_0x23de('0x6b')]['name']);_0x49433f[_0x23de('0x2a')][_0x23de('0x87')]=_0x49433f[_0x23de('0x87')];_0x49433f[_0x23de('0x2a')][_0x23de('0x88')]='accept';return respondWithRpcPromise(_0x23de('0x89'),_0x23de('0x89'),{'event':_0x23de('0x8a'),'message':_0x49433f[_0x23de('0x2a')]},client9002)[_0x23de('0x22')](function(){return _0x49433f;});}return _0x49433f;}return null;})['then'](respondWithResult(_0xa9de86,null))[_0x23de('0x2d')](handleError(_0xa9de86,null));};var interaction_log=require(_0x23de('0x75'))('mail-interactions');exports[_0x23de('0x36')]=function(_0x3a4a3e,_0x3ef2f5,_0x406a32){var _0x1dcda9={'agent':{},'channel':'mail'};if(_0x3a4a3e[_0x23de('0x58')]['id']){delete _0x3a4a3e[_0x23de('0x58')]['id'];}_0x3a4a3e[_0x23de('0x58')]['UserId']=_0x3a4a3e[_0x23de('0x58')][_0x23de('0x7b')]||_0x3a4a3e['user']['id'];_0x1dcda9[_0x23de('0x8b')]['id']=_0x3a4a3e['body']['UserId'];return db[_0x23de('0x3e')][_0x23de('0x57')]({'where':{'id':_0x3a4a3e['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ef2f5,null))[_0x23de('0x22')](function(_0x303b41){if(_0x303b41){_0x1dcda9[_0x23de('0x2a')]=_0x303b41[_0x23de('0x7c')]({'plain':!![]});return db[_0x23de('0x7d')]['find']({'where':{'id':_0x303b41[_0x23de('0x7e')]}});}return null;})[_0x23de('0x22')](handleEntityNotFound(_0x3ef2f5,null))['then'](function(_0x58fc82){if(_0x58fc82){_0x1dcda9[_0x23de('0x80')]=_0x58fc82[_0x23de('0x7c')]({'plain':!![]});interaction_log[_0x23de('0x2b')](_0x23de('0x8c'),_0x3a4a3e[_0x23de('0x6b')]['id'],_0x3a4a3e['user'][_0x23de('0x3a')],_0x3a4a3e[_0x23de('0x6b')][_0x23de('0x81')],_0x1dcda9[_0x23de('0x80')]['id'],_0x3a4a3e[_0x23de('0x58')]?JSON[_0x23de('0x26')](_0x3a4a3e['body']):_0x23de('0x82'));return respondWithRpcPromise(_0x23de('0x8d'),_0x23de('0x8e'),_0x1dcda9);}return null;})[_0x23de('0x22')](function(_0x2122bd){if(_0x2122bd){_0x2122bd[_0x23de('0x2a')][_0x23de('0x86')]=util[_0x23de('0x74')](_0x23de('0x8f'),_0x3a4a3e[_0x23de('0x6b')][_0x23de('0x3a')]);_0x2122bd[_0x23de('0x2a')][_0x23de('0x87')]=_0x1dcda9[_0x23de('0x87')];_0x2122bd['message']['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x23de('0x90'),'message':_0x2122bd[_0x23de('0x2a')]},client9002);return _0x1dcda9;}return null;})[_0x23de('0x22')](respondWithResult(_0x3ef2f5,null))['catch'](handleError(_0x3ef2f5,null));};exports[_0x23de('0x91')]=function(_0x1ac3fa,_0x4712ec){var _0x4ea787=moment()[_0x23de('0x92')]()['toString']();var _0x563835=path[_0x23de('0x6d')](config[_0x23de('0x6e')],_0x23de('0x93'),_0x23de('0x94'),_0x23de('0x95'));var _0x7c159e=path['join'](config[_0x23de('0x6e')],_0x23de('0x93'),_0x23de('0x94'),_0x23de('0x6c'));var _0x2e02b5=util[_0x23de('0x74')](_0x23de('0x96'),_0x4ea787);return db[_0x23de('0x3e')]['find']({'where':{'id':_0x1ac3fa[_0x23de('0x54')]['id']},'attributes':['id',_0x23de('0x58'),_0x23de('0x97'),'to','cc',_0x23de('0x98'),_0x23de('0x99'),_0x23de('0x9a')],'include':_0x1ac3fa[_0x23de('0x41')][_0x23de('0x6c')]?[{'model':db[_0x23de('0x9b')],'as':_0x23de('0x9c')}]:undefined})[_0x23de('0x22')](handleEntityNotFound(_0x4712ec,null))[_0x23de('0x22')](function(_0x5cc511){if(_0x5cc511){var _0x343bb5=_0x5cc511;var _0x1c2f59={'from':_0x343bb5['from'],'to':_0x343bb5['to'],'subject':_0x343bb5['subject'],'html':_0x343bb5['body'],'headers':{'Date':moment(_0x343bb5['createdAt'])['format'](_0x23de('0x9d'))},'attachments':[]};if(_0x5cc511['cc']){_0x1c2f59[_0x23de('0x9e')]['Cc']=_0x5cc511['cc'];}if(_0x5cc511[_0x23de('0x98')]){_0x1c2f59[_0x23de('0x9e')][_0x23de('0x9f')]=_0x5cc511[_0x23de('0x98')];}return new BPromise(function(_0x5820b8,_0x4350cd){if(_0x5cc511['Attachments']){for(var _0x5e0c0e=0x0;_0x5e0c0e<_0x5cc511[_0x23de('0x9c')][_0x23de('0x45')];_0x5e0c0e++){var _0x593fb6=_0x5cc511[_0x23de('0x9c')][_0x5e0c0e];var _0x46a3e0=path[_0x23de('0x6d')](_0x7c159e,_0x593fb6[_0x23de('0xa0')]);if(fs[_0x23de('0xa1')](_0x46a3e0)){_0x1c2f59[_0x23de('0x6c')][_0x23de('0xa2')]({'name':_0x593fb6['name'],'contentType':_0x593fb6[_0x23de('0x4e')],'data':fs[_0x23de('0xa3')](_0x46a3e0)});}}}emlformat['build'](_0x1c2f59,function(_0x213d7b,_0x47f204){if(_0x213d7b)return _0x4350cd(_0x213d7b);fs[_0x23de('0xa4')](path['join'](_0x563835,_0x2e02b5),_0x47f204);return _0x5820b8(_0x47f204);});});}})[_0x23de('0x22')](function(_0x46c59d){if(_0x46c59d){return _0x4712ec[_0x23de('0x91')](path[_0x23de('0x6d')](_0x563835,_0x2e02b5),_0x2e02b5,function(_0x3528f4){if(_0x3528f4){console[_0x23de('0xa5')]('err',_0x3528f4);}else{fs[_0x23de('0xa6')](path['join'](_0x563835,_0x2e02b5));}});}})[_0x23de('0x2d')](handleError(_0x4712ec,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 967d5fd..8d7ee05 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 _0x8f91=['../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x2c5f49,_0x225b12){var _0x3b68ea=function(_0x15bb7f){while(--_0x15bb7f){_0x2c5f49['push'](_0x2c5f49['shift']());}};_0x3b68ea(++_0x225b12);}(_0x8f91,0x1c1));var _0x18f9=function(_0x17f944,_0x1a9f95){_0x17f944=_0x17f944-0x0;var _0x197393=_0x8f91[_0x17f944];return _0x197393;};'use strict';var EventEmitter=require(_0x18f9('0x0'));var MailMessage=require(_0x18f9('0x1'))['db'][_0x18f9('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x18f9('0x3')](0x0);var events={'afterCreate':_0x18f9('0x4'),'afterUpdate':_0x18f9('0x5'),'afterDestroy':_0x18f9('0x6')};function emitEvent(_0x1ccf7a){return function(_0x8f2f7e,_0x571946,_0x2260a3){MailMessageEvents[_0x18f9('0x7')](_0x1ccf7a+':'+_0x8f2f7e['id'],_0x8f2f7e);MailMessageEvents[_0x18f9('0x7')](_0x1ccf7a,_0x8f2f7e);_0x2260a3(null);};}for(var e in events){if(events[_0x18f9('0x8')](e)){var event=events[e];MailMessage[_0x18f9('0x9')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xf18f=['update','remove','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x2bad51,_0x32a3cb){var _0x17a566=function(_0x884170){while(--_0x884170){_0x2bad51['push'](_0x2bad51['shift']());}};_0x17a566(++_0x32a3cb);}(_0xf18f,0xa5));var _0xff18=function(_0x3be4d7,_0x31fed5){_0x3be4d7=_0x3be4d7-0x0;var _0x4c1dc1=_0xf18f[_0x3be4d7];return _0x4c1dc1;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xff18('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xff18('0x1')](0x0);var events={'afterCreate':_0xff18('0x2'),'afterUpdate':_0xff18('0x3'),'afterDestroy':_0xff18('0x4')};function emitEvent(_0x5e1008){return function(_0xd4807e,_0x53b0be,_0x56f75f){MailMessageEvents['emit'](_0x5e1008+':'+_0xd4807e['id'],_0xd4807e);MailMessageEvents['emit'](_0x5e1008,_0xd4807e);_0x56f75f(null);};}for(var e in events){if(events[_0xff18('0x5')](e)){var event=events[e];MailMessage[_0xff18('0x6')](e,emitEvent(event));}}module[_0xff18('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 7010ea3..d1cfe7f 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 _0xd5b7=['../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','get','direction','out','isNil','MailInteractionId','then','update','createdAt','toLowerCase','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','html-to-text','rimraf'];(function(_0x2969c9,_0x4f7e22){var _0x2a3272=function(_0x3e292e){while(--_0x3e292e){_0x2969c9['push'](_0x2969c9['shift']());}};_0x2a3272(++_0x4f7e22);}(_0xd5b7,0x18c));var _0x7d5b=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0xd5b7[_0x5beda8];return _0x2aa042;};'use strict';var _=require('lodash');var util=require(_0x7d5b('0x0'));var logger=require(_0x7d5b('0x1'))(_0x7d5b('0x2'));var moment=require('moment');var BPromise=require(_0x7d5b('0x3'));var rp=require(_0x7d5b('0x4'));var htmlToText=require(_0x7d5b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d5b('0x6'));var config=require(_0x7d5b('0x7'));var attributes=require(_0x7d5b('0x8'));module[_0x7d5b('0x9')]=function(_0x293046,_0xf63ae8){return _0x293046[_0x7d5b('0xa')](_0x7d5b('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x7d5b('0xc')]},{'name':_0x7d5b('0xd'),'fields':[_0x7d5b('0xe'),_0x7d5b('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2bb8e1,_0x4364bf,_0x33ecc6){if(_0x2bb8e1[_0x7d5b('0x10')]){_0x2bb8e1['plainBody']=htmlToText[_0x7d5b('0x11')](_0x2bb8e1['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x33ecc6(null,_0x4364bf);},'afterCreate':function(_0x3b61dc,_0x8e3906,_0x1b9cd6){var _0x1b9e57=_0x293046[_0x7d5b('0x12')];var _0xed5cbe=_0x3b61dc[_0x7d5b('0x13')]({'plain':!![]});if(_0xed5cbe[_0x7d5b('0x14')]['toLowerCase']()==='in'||_0xed5cbe[_0x7d5b('0x14')]['toLowerCase']()===_0x7d5b('0x15')&&!_0xed5cbe['secret']&&!_[_0x7d5b('0x16')](_0xed5cbe['UserId'])){_0x1b9e57['MailInteraction']['findOne']({'where':{'id':_0xed5cbe[_0x7d5b('0x17')]}})[_0x7d5b('0x18')](function(_0x28c63d){if(_0x28c63d){_0x28c63d[_0x7d5b('0x19')]({'lastMsgAt':_0xed5cbe[_0x7d5b('0x1a')],'lastMsgDirection':_0xed5cbe[_0x7d5b('0x14')][_0x7d5b('0x1b')](),'lastMsgBody':_0xed5cbe[_0x7d5b('0x10')]});}})[_0x7d5b('0x1c')](function(_0x3140da){console[_0x7d5b('0x1d')](_0x3140da);});}_0x1b9cd6();}},'charset':'utf8mb4','collate':_0x7d5b('0x1e')});}; \ No newline at end of file +var _0x3044=['request-promise','html-to-text','path','rimraf','./mailMessage.attributes','exports','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','get','direction','toLowerCase','out','isNil','UserId','MailInteraction','MailInteractionId','then','catch','error','utf8mb4','util','../../config/logger','api'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x3044,0x1ea));var _0x4304=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0x3044[_0x58547b];return _0x1d3fd2;};'use strict';var _=require('lodash');var util=require(_0x4304('0x0'));var logger=require(_0x4304('0x1'))(_0x4304('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4304('0x3'));var htmlToText=require(_0x4304('0x4'));var fs=require('fs');var path=require(_0x4304('0x5'));var rimraf=require(_0x4304('0x6'));var config=require('../../config/environment');var attributes=require(_0x4304('0x7'));module[_0x4304('0x8')]=function(_0x9f4da2,_0x3599a0){return _0x9f4da2['define']('MailMessage',attributes,{'tableName':_0x4304('0x9'),'paranoid':![],'indexes':[{'name':_0x4304('0xa'),'fields':[_0x4304('0xa')]},{'name':_0x4304('0xb'),'fields':[_0x4304('0xc'),_0x4304('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3dff12,_0x19eb71,_0x35e441){if(_0x3dff12[_0x4304('0xe')]){_0x3dff12[_0x4304('0xc')]=htmlToText[_0x4304('0xf')](_0x3dff12[_0x4304('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x35e441(null,_0x19eb71);},'afterCreate':function(_0x3c434f,_0x181c80,_0x4f22da){var _0x3d29f5=_0x9f4da2[_0x4304('0x10')];var _0x2e5b91=_0x3c434f[_0x4304('0x11')]({'plain':!![]});if(_0x2e5b91[_0x4304('0x12')][_0x4304('0x13')]()==='in'||_0x2e5b91[_0x4304('0x12')][_0x4304('0x13')]()===_0x4304('0x14')&&!_0x2e5b91['secret']&&!_[_0x4304('0x15')](_0x2e5b91[_0x4304('0x16')])){_0x3d29f5[_0x4304('0x17')]['findOne']({'where':{'id':_0x2e5b91[_0x4304('0x18')]}})[_0x4304('0x19')](function(_0xea13ba){if(_0xea13ba){_0xea13ba['update']({'lastMsgAt':_0x2e5b91['createdAt'],'lastMsgDirection':_0x2e5b91[_0x4304('0x12')][_0x4304('0x13')](),'lastMsgBody':_0x2e5b91[_0x4304('0xe')]});}})[_0x4304('0x1a')](function(_0x1e7cc9){console[_0x4304('0x1b')](_0x1e7cc9);});}_0x4f22da();}},'charset':_0x4304('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index d6d8a4a..001252a 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 _0xd0c9=['client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','debug','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x24408b,_0x41d8ff){var _0x5344b7=function(_0x57c9fa){while(--_0x57c9fa){_0x24408b['push'](_0x24408b['shift']());}};_0x5344b7(++_0x41d8ff);}(_0xd0c9,0xe2));var _0x9d0c=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xd0c9[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0x9d0c('0x0'));var util=require(_0x9d0c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d0c('0x2'));var db=require(_0x9d0c('0x3'))['db'];var utils=require(_0x9d0c('0x4'));var logger=require('../../config/logger')(_0x9d0c('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9d0c('0x6')]['http']({'port':0x232a});config[_0x9d0c('0x7')]=_[_0x9d0c('0x8')](config[_0x9d0c('0x7')],{'host':_0x9d0c('0x9'),'port':0x18eb});var socket=require(_0x9d0c('0xa'))(new Redis(config[_0x9d0c('0x7')]));require('./mailMessage.socket')[_0x9d0c('0xb')](socket);function respondWithRpcPromise(_0x5dbbfa,_0x29d57b,_0x12ab3a){return new BPromise(function(_0x3e3a5e,_0x53f49a){return client[_0x9d0c('0xc')](_0x5dbbfa,_0x12ab3a)[_0x9d0c('0xd')](function(_0x3c5ea3){logger[_0x9d0c('0xe')]('MailMessage,\x20%s,\x20%s',_0x29d57b,_0x9d0c('0xf'));logger['debug'](_0x9d0c('0x10'),_0x29d57b,_0x9d0c('0xf'),JSON[_0x9d0c('0x11')](_0x3c5ea3));if(_0x3c5ea3[_0x9d0c('0x12')]){if(_0x3c5ea3['error']['code']===0x1f4){logger['error'](_0x9d0c('0x13'),_0x29d57b,_0x3c5ea3['error'][_0x9d0c('0x14')]);return _0x53f49a(_0x3c5ea3[_0x9d0c('0x12')][_0x9d0c('0x14')]);}logger[_0x9d0c('0x12')](_0x9d0c('0x13'),_0x29d57b,_0x3c5ea3[_0x9d0c('0x12')][_0x9d0c('0x14')]);return _0x3e3a5e(_0x3c5ea3[_0x9d0c('0x12')]['message']);}else{logger[_0x9d0c('0xe')](_0x9d0c('0x13'),_0x29d57b,'request\x20sent');_0x3e3a5e(_0x3c5ea3[_0x9d0c('0x15')][_0x9d0c('0x14')]);}})[_0x9d0c('0x16')](function(_0x4ccf40){logger['error'](_0x9d0c('0x13'),_0x29d57b,_0x4ccf40);_0x53f49a(_0x4ccf40);});});}exports[_0x9d0c('0x17')]=function(_0x5141ff){var _0x99a070=this;return new Promise(function(_0xc3aedb,_0xf60863){return db[_0x9d0c('0x18')][_0x9d0c('0x19')](_0x5141ff['body'],{'raw':_0x5141ff[_0x9d0c('0x1a')]?_0x5141ff['options'][_0x9d0c('0x1b')]===undefined?!![]:![]:!![]})[_0x9d0c('0xd')](function(_0x52049b){logger[_0x9d0c('0xe')](_0x9d0c('0x17'),_0x5141ff);logger[_0x9d0c('0x1c')]('CreateMailMessage',_0x5141ff,JSON[_0x9d0c('0x11')](_0x52049b));_0xc3aedb(_0x52049b);})[_0x9d0c('0x16')](function(_0x48a5d6){logger[_0x9d0c('0x12')](_0x9d0c('0x17'),_0x48a5d6[_0x9d0c('0x14')],_0x5141ff);_0xf60863(_0x99a070[_0x9d0c('0x12')](0x1f4,_0x48a5d6[_0x9d0c('0x14')]));});});}; \ No newline at end of file +var _0xed54=['socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x5b75c0,_0x55a3ac){var _0x518b8f=function(_0x169316){while(--_0x169316){_0x5b75c0['push'](_0x5b75c0['shift']());}};_0x518b8f(++_0x55a3ac);}(_0xed54,0xfc));var _0x4ed5=function(_0x58744f,_0x3cf890){_0x58744f=_0x58744f-0x0;var _0x3417f0=_0xed54[_0x58744f];return _0x3417f0;};'use strict';var _=require('lodash');var util=require(_0x4ed5('0x0'));var moment=require(_0x4ed5('0x1'));var BPromise=require(_0x4ed5('0x2'));var rs=require(_0x4ed5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ed5('0x4'))['db'];var utils=require(_0x4ed5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4ed5('0x6'));var jayson=require(_0x4ed5('0x7'));var client=jayson[_0x4ed5('0x8')][_0x4ed5('0x9')]({'port':0x232a});config[_0x4ed5('0xa')]=_[_0x4ed5('0xb')](config[_0x4ed5('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ed5('0xc'))(new Redis(config[_0x4ed5('0xa')]));require(_0x4ed5('0xd'))[_0x4ed5('0xe')](socket);function respondWithRpcPromise(_0x52d8e3,_0x58cbe4,_0x23f1db){return new BPromise(function(_0x3c027e,_0x191814){return client[_0x4ed5('0xf')](_0x52d8e3,_0x23f1db)[_0x4ed5('0x10')](function(_0x51c141){logger[_0x4ed5('0x11')](_0x4ed5('0x12'),_0x58cbe4,_0x4ed5('0x13'));logger[_0x4ed5('0x14')](_0x4ed5('0x15'),_0x58cbe4,_0x4ed5('0x13'),JSON[_0x4ed5('0x16')](_0x51c141));if(_0x51c141[_0x4ed5('0x17')]){if(_0x51c141['error']['code']===0x1f4){logger[_0x4ed5('0x17')](_0x4ed5('0x12'),_0x58cbe4,_0x51c141[_0x4ed5('0x17')][_0x4ed5('0x18')]);return _0x191814(_0x51c141[_0x4ed5('0x17')][_0x4ed5('0x18')]);}logger[_0x4ed5('0x17')](_0x4ed5('0x12'),_0x58cbe4,_0x51c141[_0x4ed5('0x17')][_0x4ed5('0x18')]);return _0x3c027e(_0x51c141[_0x4ed5('0x17')][_0x4ed5('0x18')]);}else{logger[_0x4ed5('0x11')](_0x4ed5('0x12'),_0x58cbe4,_0x4ed5('0x13'));_0x3c027e(_0x51c141[_0x4ed5('0x19')]['message']);}})[_0x4ed5('0x1a')](function(_0x374c13){logger[_0x4ed5('0x17')]('MailMessage,\x20%s,\x20%s',_0x58cbe4,_0x374c13);_0x191814(_0x374c13);});});}exports[_0x4ed5('0x1b')]=function(_0x3fd3ba){var _0xa2d24b=this;return new Promise(function(_0x1ffced,_0x1b4707){return db[_0x4ed5('0x1c')][_0x4ed5('0x1d')](_0x3fd3ba[_0x4ed5('0x1e')],{'raw':_0x3fd3ba['options']?_0x3fd3ba[_0x4ed5('0x1f')][_0x4ed5('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x32d181){logger['info']('CreateMailMessage',_0x3fd3ba);logger['debug'](_0x4ed5('0x1b'),_0x3fd3ba,JSON['stringify'](_0x32d181));_0x1ffced(_0x32d181);})[_0x4ed5('0x1a')](function(_0x366083){logger[_0x4ed5('0x17')](_0x4ed5('0x1b'),_0x366083[_0x4ed5('0x18')],_0x3fd3ba);_0x1b4707(_0xa2d24b[_0x4ed5('0x17')](0x1f4,_0x366083[_0x4ed5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 1f10ae3..a16dc8d 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 _0x5e39=['remove','removeListener','register','length','mailMessage:','./mailMessage.events','save'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x5e39,0xbb));var _0x95e3=function(_0x3a7f38,_0x111741){_0x3a7f38=_0x3a7f38-0x0;var _0x8fdedf=_0x5e39[_0x3a7f38];return _0x8fdedf;};'use strict';var MailMessageEvents=require(_0x95e3('0x0'));var events=[_0x95e3('0x1'),_0x95e3('0x2'),'update'];function createListener(_0x10937c,_0x19bfb4){return function(_0xedce62){_0x19bfb4['emit'](_0x10937c,_0xedce62);};}function removeListener(_0x3e0153,_0x258f49){return function(){MailMessageEvents[_0x95e3('0x3')](_0x3e0153,_0x258f49);};}exports[_0x95e3('0x4')]=function(_0x4610ec){for(var _0x1c1231=0x0,_0x17eabd=events[_0x95e3('0x5')];_0x1c1231<_0x17eabd;_0x1c1231++){var _0x188355=events[_0x1c1231];var _0x48a7af=createListener(_0x95e3('0x6')+_0x188355,_0x4610ec);MailMessageEvents['on'](_0x188355,_0x48a7af);}}; \ No newline at end of file +var _0x5bf2=['./mailMessage.events','remove','emit','removeListener','register','length','mailMessage:'];(function(_0x1ae665,_0x5f09ef){var _0x47d970=function(_0xc44812){while(--_0xc44812){_0x1ae665['push'](_0x1ae665['shift']());}};_0x47d970(++_0x5f09ef);}(_0x5bf2,0x157));var _0x25bf=function(_0x26cc9a,_0xcc20e8){_0x26cc9a=_0x26cc9a-0x0;var _0x2e2778=_0x5bf2[_0x26cc9a];return _0x2e2778;};'use strict';var MailMessageEvents=require(_0x25bf('0x0'));var events=['save',_0x25bf('0x1'),'update'];function createListener(_0xc0f22d,_0x2168ee){return function(_0x2ea1a6){_0x2168ee[_0x25bf('0x2')](_0xc0f22d,_0x2ea1a6);};}function removeListener(_0x15a9cd,_0x510efd){return function(){MailMessageEvents[_0x25bf('0x3')](_0x15a9cd,_0x510efd);};}exports[_0x25bf('0x4')]=function(_0x5e2916){for(var _0x1bf99e=0x0,_0x28fed5=events[_0x25bf('0x5')];_0x1bf99e<_0x28fed5;_0x1bf99e++){var _0x4baa47=events[_0x1bf99e];var _0x297877=createListener(_0x25bf('0x6')+_0x4baa47,_0x5e2916);MailMessageEvents['on'](_0x4baa47,_0x297877);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index d83a0a4..c5b7b37 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 _0xa199=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util'];(function(_0x58607a,_0x8f9287){var _0x49b8d8=function(_0x570cbc){while(--_0x570cbc){_0x58607a['push'](_0x58607a['shift']());}};_0x49b8d8(++_0x8f9287);}(_0xa199,0x148));var _0x9a19=function(_0x16d54e,_0x377143){_0x16d54e=_0x16d54e-0x0;var _0x3a4606=_0xa199[_0x16d54e];return _0x3a4606;};'use strict';var multer=require(_0x9a19('0x0'));var util=require(_0x9a19('0x1'));var path=require(_0x9a19('0x2'));var timeout=require(_0x9a19('0x3'));var express=require(_0x9a19('0x4'));var router=express[_0x9a19('0x5')]();var auth=require(_0x9a19('0x6'));var interaction=require(_0x9a19('0x7'));var config=require(_0x9a19('0x8'));var controller=require('./mailQueue.controller');router[_0x9a19('0x9')]('/',auth[_0x9a19('0xa')](),controller[_0x9a19('0xb')]);router['get'](_0x9a19('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x9a19('0x9')](_0x9a19('0xd'),auth[_0x9a19('0xa')](),controller['show']);router['get'](_0x9a19('0xe'),auth['isAuthenticated'](),controller[_0x9a19('0xf')]);router['get']('/:id/teams',auth[_0x9a19('0xa')](),controller[_0x9a19('0x10')]);router[_0x9a19('0x9')](_0x9a19('0x11'),auth['isAuthenticated'](),controller[_0x9a19('0x12')]);router[_0x9a19('0x13')]('/',auth['isAuthenticated'](),controller[_0x9a19('0x14')]);router[_0x9a19('0x13')](_0x9a19('0x15'),auth[_0x9a19('0xa')](),controller[_0x9a19('0x16')]);router[_0x9a19('0x13')]('/:id/users',auth[_0x9a19('0xa')](),controller[_0x9a19('0x17')]);router['put'](_0x9a19('0xd'),auth['isAuthenticated'](),controller[_0x9a19('0x18')]);router[_0x9a19('0x19')]('/:id',auth[_0x9a19('0xa')](),controller[_0x9a19('0x1a')]);router[_0x9a19('0x19')](_0x9a19('0x15'),auth['isAuthenticated'](),controller[_0x9a19('0x1b')]);router[_0x9a19('0x19')](_0x9a19('0x11'),auth[_0x9a19('0xa')](),controller[_0x9a19('0x1c')]);module[_0x9a19('0x1d')]=router; \ No newline at end of file +var _0x28c7=['delete','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','/:id','update','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x28c7,0x16b));var _0x728c=function(_0x15183c,_0xdf77be){_0x15183c=_0x15183c-0x0;var _0x13b5d4=_0x28c7[_0x15183c];return _0x13b5d4;};'use strict';var multer=require(_0x728c('0x0'));var util=require(_0x728c('0x1'));var path=require(_0x728c('0x2'));var timeout=require(_0x728c('0x3'));var express=require('express');var router=express[_0x728c('0x4')]();var auth=require(_0x728c('0x5'));var interaction=require(_0x728c('0x6'));var config=require(_0x728c('0x7'));var controller=require(_0x728c('0x8'));router[_0x728c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x728c('0xa')](),controller[_0x728c('0xb')]);router['get']('/:id',auth[_0x728c('0xa')](),controller[_0x728c('0xc')]);router[_0x728c('0x9')](_0x728c('0xd'),auth['isAuthenticated'](),controller[_0x728c('0xe')]);router[_0x728c('0x9')](_0x728c('0xf'),auth[_0x728c('0xa')](),controller[_0x728c('0x10')]);router['get']('/:id/users',auth[_0x728c('0xa')](),controller[_0x728c('0x11')]);router[_0x728c('0x12')]('/',auth['isAuthenticated'](),controller[_0x728c('0x13')]);router[_0x728c('0x12')]('/:id/teams',auth[_0x728c('0xa')](),controller[_0x728c('0x14')]);router[_0x728c('0x12')](_0x728c('0x15'),auth[_0x728c('0xa')](),controller[_0x728c('0x16')]);router[_0x728c('0x17')](_0x728c('0x18'),auth[_0x728c('0xa')](),controller[_0x728c('0x19')]);router['delete']('/:id',auth[_0x728c('0xa')](),controller[_0x728c('0x1a')]);router[_0x728c('0x1b')]('/:id/teams',auth[_0x728c('0xa')](),controller[_0x728c('0x1c')]);router[_0x728c('0x1b')](_0x728c('0x15'),auth['isAuthenticated'](),controller[_0x728c('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index c1467fc..4b6768c 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 _0x8084=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x4bdda3,_0x25f960){var _0x3f8722=function(_0x341120){while(--_0x341120){_0x4bdda3['push'](_0x4bdda3['shift']());}};_0x3f8722(++_0x25f960);}(_0x8084,0x13b));var _0x4808=function(_0x47c54b,_0x30148f){_0x47c54b=_0x47c54b-0x0;var _0xe79a89=_0x8084[_0x47c54b];return _0xe79a89;};'use strict';var Sequelize=require(_0x4808('0x0'));module[_0x4808('0x1')]={'name':{'type':Sequelize[_0x4808('0x2')],'unique':_0x4808('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4808('0x2')]},'timeout':{'type':Sequelize[_0x4808('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4808('0x5')](_0x4808('0x6'),_0x4808('0x7'),_0x4808('0x8'))}}; \ No newline at end of file +var _0x38b8=['roundrobin','sequelize','STRING','name','INTEGER','beepall'];(function(_0x2355c1,_0x5c9150){var _0x3d5eb2=function(_0x67e014){while(--_0x67e014){_0x2355c1['push'](_0x2355c1['shift']());}};_0x3d5eb2(++_0x5c9150);}(_0x38b8,0x7f));var _0x838b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x38b8[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x838b('0x0'));module['exports']={'name':{'type':Sequelize[_0x838b('0x1')],'unique':_0x838b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x838b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x838b('0x4'),_0x838b('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a0a1b46..7d76768 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 _0x5abb=['findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','MailQueueId','UserMailQueue','findAndCountAll','UserId','agent','updatedAt','createdAt','count','format','%s/%s','SIP','mailPause','getTeams','Team','addTeams','User','Agents','online','interface','flatMap','sequelize','transaction','forEach','emit','userMailQueue:save','removeTeams','ids','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','isArray','getAgents','findOne','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','MailQueues','UserProfileResource','destroy','stack','name','send','index','map','MailQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include'];(function(_0x414655,_0x79d916){var _0x237884=function(_0x2737d9){while(--_0x2737d9){_0x414655['push'](_0x414655['shift']());}};_0x237884(++_0x79d916);}(_0x5abb,0x1e9));var _0xb5ab=function(_0x5e0bc1,_0x2b41d2){_0x5e0bc1=_0x5e0bc1-0x0;var _0x5c6a9d=_0x5abb[_0x5e0bc1];return _0x5c6a9d;};'use strict';var pdf=require(_0xb5ab('0x0'));var emlformat=require(_0xb5ab('0x1'));var rimraf=require(_0xb5ab('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb5ab('0x3'));var moment=require(_0xb5ab('0x4'));var BPromise=require(_0xb5ab('0x5'));var Mustache=require('mustache');var util=require(_0xb5ab('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb5ab('0x7'));var fs=require('fs');var _=require(_0xb5ab('0x8'));var squel=require(_0xb5ab('0x9'));var crypto=require(_0xb5ab('0xa'));var jsforce=require(_0xb5ab('0xb'));var deskjs=require(_0xb5ab('0xc'));var toCsv=require(_0xb5ab('0xd'));var querystring=require(_0xb5ab('0xe'));var Papa=require(_0xb5ab('0xf'));var Redis=require(_0xb5ab('0x10'));var authService=require(_0xb5ab('0x11'));var qs=require(_0xb5ab('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb5ab('0x13'));var config=require(_0xb5ab('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb5ab('0x15')](config[_0xb5ab('0x16')],{'host':_0xb5ab('0x17'),'port':0x18eb});var socket=require(_0xb5ab('0x18'))(new Redis(config[_0xb5ab('0x16')]));require(_0xb5ab('0x19'))[_0xb5ab('0x1a')](socket);function respondWithStatusCode(_0xe621cc,_0x1aedc9){_0x1aedc9=_0x1aedc9||0xcc;return function(_0x1ac769){if(_0x1ac769){return _0xe621cc[_0xb5ab('0x1b')](_0x1aedc9);}return _0xe621cc[_0xb5ab('0x1c')](_0x1aedc9)[_0xb5ab('0x1d')]();};}function respondWithResult(_0x2f509d,_0x23e82a){_0x23e82a=_0x23e82a||0xc8;return function(_0x17f7dd){if(_0x17f7dd){return _0x2f509d[_0xb5ab('0x1c')](_0x23e82a)['json'](_0x17f7dd);}};}function respondWithFilteredResult(_0x15de13,_0x190d58){return function(_0x5a9329){if(_0x5a9329){var _0x4b3e2e=_0x5a9329['count'],_0x49f593=_0x190d58[_0xb5ab('0x1e')],_0x30e4a5=_0x190d58[_0xb5ab('0x1e')]+_0x190d58[_0xb5ab('0x1f')],_0xae646d;if(_0x30e4a5>=_0x4b3e2e){_0x30e4a5=_0x4b3e2e;_0xae646d=0xc8;}else{_0xae646d=0xce;}_0x15de13[_0xb5ab('0x1c')](_0xae646d);return _0x15de13[_0xb5ab('0x20')](_0xb5ab('0x21'),_0x49f593+'-'+_0x30e4a5+'/'+_0x4b3e2e)[_0xb5ab('0x22')](_0x5a9329);}return null;};}function patchUpdates(_0x4d2f97){return function(_0x1c683f){try{jsonpatch[_0xb5ab('0x23')](_0x1c683f,_0x4d2f97,!![]);}catch(_0x4ab0c1){return BPromise[_0xb5ab('0x24')](_0x4ab0c1);}return _0x1c683f[_0xb5ab('0x25')]();};}function saveUpdates(_0x1f29c7,_0x3f2d6b){return function(_0x550e98){if(_0x550e98){return _0x550e98[_0xb5ab('0x26')](_0x1f29c7)[_0xb5ab('0x27')](function(_0x279a38){return _0x279a38;});}return null;};}function removeEntity(_0x295dba,_0x362075){return function(_0x303f66){if(_0x303f66){return _0x303f66['destroy']()['then'](function(){var _0x41d499=_0x303f66[_0xb5ab('0x28')]({'plain':!![]});var _0x11ff6e=_0xb5ab('0x29');return db[_0xb5ab('0x2a')][_0xb5ab('0x2b')]({'where':{'type':_0x11ff6e,'resourceId':_0x41d499['id']}})[_0xb5ab('0x27')](function(){return _0x303f66;});})[_0xb5ab('0x27')](function(){_0x295dba[_0xb5ab('0x1c')](0xcc)[_0xb5ab('0x1d')]();});}};}function handleEntityNotFound(_0x5b64af,_0x264c0b){return function(_0x14df46){if(!_0x14df46){_0x5b64af[_0xb5ab('0x1b')](0x194);}return _0x14df46;};}function handleError(_0x408ba7,_0x564392){_0x564392=_0x564392||0x1f4;return function(_0xcba085){logger['error'](_0xcba085[_0xb5ab('0x2c')]);if(_0xcba085[_0xb5ab('0x2d')]){delete _0xcba085[_0xb5ab('0x2d')];}_0x408ba7[_0xb5ab('0x1c')](_0x564392)[_0xb5ab('0x2e')](_0xcba085);};}exports[_0xb5ab('0x2f')]=function(_0x5ba69e,_0x364341){var _0x37c92a={},_0x3e7a8a={},_0x53a78c={'count':0x0,'rows':[]};var _0x49dd25=_[_0xb5ab('0x30')](db[_0xb5ab('0x31')][_0xb5ab('0x32')],function(_0x5de39c){return{'name':_0x5de39c['fieldName'],'type':_0x5de39c[_0xb5ab('0x33')][_0xb5ab('0x34')]};});_0x3e7a8a[_0xb5ab('0x35')]=_['map'](_0x49dd25,'name');_0x3e7a8a[_0xb5ab('0x36')]=_[_0xb5ab('0x37')](_0x5ba69e[_0xb5ab('0x36')]);_0x3e7a8a[_0xb5ab('0x38')]=_[_0xb5ab('0x39')](_0x3e7a8a[_0xb5ab('0x35')],_0x3e7a8a['query']);_0x37c92a[_0xb5ab('0x3a')]=_['intersection'](_0x3e7a8a[_0xb5ab('0x35')],qs[_0xb5ab('0x3b')](_0x5ba69e[_0xb5ab('0x36')]['fields']));_0x37c92a[_0xb5ab('0x3a')]=_0x37c92a['attributes'][_0xb5ab('0x3c')]?_0x37c92a[_0xb5ab('0x3a')]:_0x3e7a8a[_0xb5ab('0x35')];if(!_0x5ba69e[_0xb5ab('0x36')][_0xb5ab('0x3d')](_0xb5ab('0x3e'))){_0x37c92a['limit']=qs['limit'](_0x5ba69e[_0xb5ab('0x36')][_0xb5ab('0x1f')]);_0x37c92a[_0xb5ab('0x1e')]=qs[_0xb5ab('0x1e')](_0x5ba69e['query'][_0xb5ab('0x1e')]);}_0x37c92a[_0xb5ab('0x3f')]=qs[_0xb5ab('0x40')](_0x5ba69e[_0xb5ab('0x36')][_0xb5ab('0x40')]);_0x37c92a['where']=qs[_0xb5ab('0x38')](_[_0xb5ab('0x41')](_0x5ba69e['query'],_0x3e7a8a[_0xb5ab('0x38')]),_0x49dd25);if(_0x5ba69e['query'][_0xb5ab('0x42')]){_0x37c92a[_0xb5ab('0x43')]=_[_0xb5ab('0x44')](_0x37c92a[_0xb5ab('0x43')],{'$or':_[_0xb5ab('0x30')](_0x49dd25,function(_0x170993){if(_0x170993[_0xb5ab('0x33')]!==_0xb5ab('0x45')){var _0x244c0e={};_0x244c0e[_0x170993['name']]={'$like':'%'+_0x5ba69e[_0xb5ab('0x36')][_0xb5ab('0x42')]+'%'};return _0x244c0e;}})});}_0x37c92a=_['merge']({},_0x37c92a,_0x5ba69e['options']);var _0x4d298c={'where':_0x37c92a[_0xb5ab('0x43')]};return db['MailQueue']['count'](_0x4d298c)['then'](function(_0x6845d4){_0x53a78c['count']=_0x6845d4;if(_0x5ba69e[_0xb5ab('0x36')]['includeAll']){_0x37c92a[_0xb5ab('0x46')]=[{'all':!![]}];}return db['MailQueue'][_0xb5ab('0x47')](_0x37c92a);})['then'](function(_0x5ba351){_0x53a78c[_0xb5ab('0x48')]=_0x5ba351;return _0x53a78c;})[_0xb5ab('0x27')](respondWithFilteredResult(_0x364341,_0x37c92a))[_0xb5ab('0x49')](handleError(_0x364341,null));};exports[_0xb5ab('0x4a')]=function(_0x5702ab,_0x5b67dc){var _0x2a2875={'raw':!![],'where':{'id':_0x5702ab[_0xb5ab('0x4b')]['id']}},_0x2e1760={};_0x2e1760[_0xb5ab('0x35')]=_[_0xb5ab('0x37')](db[_0xb5ab('0x31')][_0xb5ab('0x32')]);_0x2e1760['query']=_[_0xb5ab('0x37')](_0x5702ab[_0xb5ab('0x36')]);_0x2e1760['filters']=_['intersection'](_0x2e1760[_0xb5ab('0x35')],_0x2e1760[_0xb5ab('0x36')]);_0x2a2875[_0xb5ab('0x3a')]=_[_0xb5ab('0x39')](_0x2e1760[_0xb5ab('0x35')],qs[_0xb5ab('0x3b')](_0x5702ab[_0xb5ab('0x36')][_0xb5ab('0x3b')]));_0x2a2875[_0xb5ab('0x3a')]=_0x2a2875[_0xb5ab('0x3a')][_0xb5ab('0x3c')]?_0x2a2875['attributes']:_0x2e1760[_0xb5ab('0x35')];if(_0x5702ab[_0xb5ab('0x36')]['includeAll']){_0x2a2875[_0xb5ab('0x46')]=[{'all':!![]}];}_0x2a2875=_[_0xb5ab('0x44')]({},_0x2a2875,_0x5702ab[_0xb5ab('0x4c')]);return db[_0xb5ab('0x31')][_0xb5ab('0x4d')](_0x2a2875)[_0xb5ab('0x27')](handleEntityNotFound(_0x5b67dc,null))[_0xb5ab('0x27')](respondWithResult(_0x5b67dc,null))['catch'](handleError(_0x5b67dc,null));};exports['create']=function(_0x314cc8,_0x4ff733){return db[_0xb5ab('0x31')][_0xb5ab('0x4e')](_0x314cc8[_0xb5ab('0x4f')],{})[_0xb5ab('0x27')](function(_0x3c74a6){var _0x1d1095=_0x314cc8[_0xb5ab('0x50')]['get']({'plain':!![]});if(!_0x1d1095)throw new Error(_0xb5ab('0x51'));if(_0x1d1095[_0xb5ab('0x52')]===_0xb5ab('0x50')){var _0x3ae359=_0x3c74a6[_0xb5ab('0x28')]({'plain':!![]});var _0x37ef97=_0xb5ab('0x29');return db[_0xb5ab('0x53')][_0xb5ab('0x4d')]({'where':{'name':_0x37ef97,'userProfileId':_0x1d1095['userProfileId']},'raw':!![]})[_0xb5ab('0x27')](function(_0x1d668f){if(_0x1d668f&&_0x1d668f[_0xb5ab('0x54')]===0x0){return db[_0xb5ab('0x2a')]['create']({'name':_0x3ae359[_0xb5ab('0x2d')],'resourceId':_0x3ae359['id'],'type':_0x1d668f[_0xb5ab('0x2d')],'sectionId':_0x1d668f['id']},{})['then'](function(){return _0x3c74a6;});}else{return _0x3c74a6;}})[_0xb5ab('0x49')](function(_0x1f3d2d){logger[_0xb5ab('0x55')](_0xb5ab('0x56'),_0x1f3d2d);throw _0x1f3d2d;});}return _0x3c74a6;})['then'](respondWithResult(_0x4ff733,0xc9))[_0xb5ab('0x49')](handleError(_0x4ff733,null));};exports[_0xb5ab('0x26')]=function(_0x4d43f9,_0x2bc27b){if(_0x4d43f9[_0xb5ab('0x4f')]['id']){delete _0x4d43f9[_0xb5ab('0x4f')]['id'];}return db[_0xb5ab('0x31')]['find']({'where':{'id':_0x4d43f9['params']['id']}})[_0xb5ab('0x27')](handleEntityNotFound(_0x2bc27b,null))[_0xb5ab('0x27')](saveUpdates(_0x4d43f9[_0xb5ab('0x4f')],null))['then'](respondWithResult(_0x2bc27b,null))[_0xb5ab('0x49')](handleError(_0x2bc27b,null));};exports['destroy']=function(_0x92e00a,_0x4d2343){return db[_0xb5ab('0x31')][_0xb5ab('0x4d')]({'where':{'id':_0x92e00a[_0xb5ab('0x4b')]['id']}})[_0xb5ab('0x27')](handleEntityNotFound(_0x4d2343,null))[_0xb5ab('0x27')](removeEntity(_0x4d2343,null))[_0xb5ab('0x49')](handleError(_0x4d2343,null));};exports[_0xb5ab('0x57')]=function(_0x18fd9b,_0x45b63c){return db[_0xb5ab('0x31')]['describe']()[_0xb5ab('0x27')](respondWithResult(_0x45b63c,null))[_0xb5ab('0x49')](handleError(_0x45b63c,null));};exports[_0xb5ab('0x58')]=function(_0x2f60d5,_0x1cdec7,_0xa0397b){var _0x3c5271={'raw':!![],'where':{}},_0x5e8367={},_0x4b6684;return db[_0xb5ab('0x31')]['findOne']({'where':{'id':_0x2f60d5['params']['id']}})[_0xb5ab('0x27')](handleEntityNotFound(_0x1cdec7,null))[_0xb5ab('0x27')](function(_0x476386){if(_0x476386){_0x4b6684=_0x476386[_0xb5ab('0x28')]({'plain':!![]});_0x5e8367['model']=_[_0xb5ab('0x37')](db['UserMailQueue'][_0xb5ab('0x32')]);_0x5e8367[_0xb5ab('0x36')]=_[_0xb5ab('0x37')](_0x2f60d5[_0xb5ab('0x36')]);_0x5e8367['filters']=_['intersection'](_0x5e8367[_0xb5ab('0x35')],_0x5e8367[_0xb5ab('0x36')]);_0x3c5271[_0xb5ab('0x3a')]=_[_0xb5ab('0x39')](_0x5e8367[_0xb5ab('0x35')],qs[_0xb5ab('0x3b')](_0x2f60d5[_0xb5ab('0x36')]['fields']));_0x3c5271[_0xb5ab('0x3a')]=_0x3c5271[_0xb5ab('0x3a')]['length']?_0x3c5271[_0xb5ab('0x3a')]:_0x5e8367['model'];if(!_0x2f60d5[_0xb5ab('0x36')][_0xb5ab('0x3d')](_0xb5ab('0x3e'))){_0x3c5271[_0xb5ab('0x1f')]=qs[_0xb5ab('0x1f')](_0x2f60d5[_0xb5ab('0x36')][_0xb5ab('0x1f')]);_0x3c5271['offset']=qs[_0xb5ab('0x1e')](_0x2f60d5[_0xb5ab('0x36')][_0xb5ab('0x1e')]);}_0x3c5271[_0xb5ab('0x3f')]=qs[_0xb5ab('0x40')](_0x2f60d5[_0xb5ab('0x36')]['sort']);_0x3c5271[_0xb5ab('0x43')]=qs[_0xb5ab('0x38')](_[_0xb5ab('0x41')](_0x2f60d5['query'],_0x5e8367[_0xb5ab('0x38')]));_0x3c5271[_0xb5ab('0x43')][_0xb5ab('0x59')]=_0x476386['id'];if(_0x2f60d5[_0xb5ab('0x36')][_0xb5ab('0x42')]){_0x3c5271[_0xb5ab('0x43')]=_['merge'](_0x3c5271[_0xb5ab('0x43')],{'$or':_[_0xb5ab('0x30')](_0x3c5271[_0xb5ab('0x3a')],function(_0x2b2001){var _0x5e85cc={};_0x5e85cc[_0x2b2001]={'$like':'%'+_0x2f60d5[_0xb5ab('0x36')][_0xb5ab('0x42')]+'%'};return _0x5e85cc;})});}_0x3c5271=_[_0xb5ab('0x44')]({},_0x3c5271,_0x2f60d5[_0xb5ab('0x4c')]);return db[_0xb5ab('0x5a')][_0xb5ab('0x47')](_0x3c5271);}})[_0xb5ab('0x27')](function(_0x4a6621){if(_0x4a6621){return db['User'][_0xb5ab('0x5b')]({'where':{'id':_['map'](_0x4a6621,_0xb5ab('0x5c')),'role':_0xb5ab('0x5d')},'attributes':['id',_0xb5ab('0x2d'),'mailPause',_0xb5ab('0x5e'),_0xb5ab('0x5f')]});}})['then'](function(_0x3ecbc5){if(_0x3ecbc5){return{'count':_0x3ecbc5[_0xb5ab('0x60')],'rows':_['map'](_0x3ecbc5['rows'],function(_0x5094e5){return{'membername':_0x5094e5[_0xb5ab('0x2d')],'UserId':_0x5094e5['id'],'queue_name':_0x4b6684[_0xb5ab('0x2d')],'MailQueueId':_0x4b6684['id'],'interface':util[_0xb5ab('0x61')](_0xb5ab('0x62'),_0xb5ab('0x63'),_0x5094e5[_0xb5ab('0x2d')]),'penalty':0x0,'paused':_0x5094e5[_0xb5ab('0x64')],'createdAt':_0x5094e5[_0xb5ab('0x5f')],'updatedAt':_0x5094e5[_0xb5ab('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1cdec7,_0x3c5271))['catch'](handleError(_0x1cdec7,null));};exports[_0xb5ab('0x65')]=function(_0x59d128,_0x46ce73,_0xa1ce29){var _0x129134={};var _0x4b7c7f={};var _0x5f1f99;var _0xdf34d2;return db[_0xb5ab('0x31')]['findOne']({'where':{'id':_0x59d128[_0xb5ab('0x4b')]['id']}})['then'](handleEntityNotFound(_0x46ce73,null))[_0xb5ab('0x27')](function(_0x12351e){if(_0x12351e){_0x5f1f99=_0x12351e;_0x4b7c7f['model']=_[_0xb5ab('0x37')](db[_0xb5ab('0x66')][_0xb5ab('0x32')]);_0x4b7c7f[_0xb5ab('0x36')]=_[_0xb5ab('0x37')](_0x59d128[_0xb5ab('0x36')]);_0x4b7c7f[_0xb5ab('0x38')]=_[_0xb5ab('0x39')](_0x4b7c7f[_0xb5ab('0x35')],_0x4b7c7f['query']);_0x129134[_0xb5ab('0x3a')]=_[_0xb5ab('0x39')](_0x4b7c7f[_0xb5ab('0x35')],qs[_0xb5ab('0x3b')](_0x59d128['query']['fields']));_0x129134[_0xb5ab('0x3a')]=_0x129134[_0xb5ab('0x3a')]['length']?_0x129134[_0xb5ab('0x3a')]:_0x4b7c7f['model'];_0x129134['order']=qs['sort'](_0x59d128['query']['sort']);_0x129134[_0xb5ab('0x43')]=qs[_0xb5ab('0x38')](_[_0xb5ab('0x41')](_0x59d128[_0xb5ab('0x36')],_0x4b7c7f[_0xb5ab('0x38')]));if(_0x59d128[_0xb5ab('0x36')]['filter']){_0x129134[_0xb5ab('0x43')]=_[_0xb5ab('0x44')](_0x129134[_0xb5ab('0x43')],{'$or':_[_0xb5ab('0x30')](_0x129134[_0xb5ab('0x3a')],function(_0xda0c4a){var _0x2dbda6={};_0x2dbda6[_0xda0c4a]={'$like':'%'+_0x59d128['query'][_0xb5ab('0x42')]+'%'};return _0x2dbda6;})});}_0x129134=_[_0xb5ab('0x44')]({},_0x129134,_0x59d128[_0xb5ab('0x4c')]);return _0x5f1f99['getTeams'](_0x129134);}})[_0xb5ab('0x27')](function(_0x2aed50){if(_0x2aed50){_0xdf34d2=_0x2aed50[_0xb5ab('0x3c')];if(!_0x59d128[_0xb5ab('0x36')][_0xb5ab('0x3d')](_0xb5ab('0x3e'))){_0x129134[_0xb5ab('0x1f')]=qs[_0xb5ab('0x1f')](_0x59d128[_0xb5ab('0x36')]['limit']);_0x129134[_0xb5ab('0x1e')]=qs[_0xb5ab('0x1e')](_0x59d128[_0xb5ab('0x36')][_0xb5ab('0x1e')]);}return _0x5f1f99[_0xb5ab('0x65')](_0x129134);}})['then'](function(_0x26c0fd){if(_0x26c0fd){return _0x26c0fd?{'count':_0xdf34d2,'rows':_0x26c0fd}:null;}})['then'](respondWithResult(_0x46ce73,null))[_0xb5ab('0x49')](handleError(_0x46ce73,null));};exports[_0xb5ab('0x67')]=function(_0x2b06e8,_0x29c8f0,_0x4146e4){var _0x33564f=_0x2b06e8['body']['ids'];return db[_0xb5ab('0x66')][_0xb5ab('0x47')]({'where':{'id':_0x33564f},'attributes':['id'],'include':[{'model':db[_0xb5ab('0x68')],'as':_0xb5ab('0x69'),'attributes':['id',_0xb5ab('0x2d'),_0xb5ab('0x6a'),'voicePause',_0xb5ab('0x6b')],'raw':!![]}]})['then'](function(_0x28aec0){if(_0x28aec0){var _0x411ff7=_[_0xb5ab('0x6c')](_0x28aec0,function(_0x66dc1e){var _0x1c9e28=_0x66dc1e[_0xb5ab('0x28')]({'plain':!![]});return _0x1c9e28[_0xb5ab('0x69')];});return db[_0xb5ab('0x31')]['find']({'where':{'id':_0x2b06e8['params']['id']}})['then'](function(_0x258d27){return db[_0xb5ab('0x6d')][_0xb5ab('0x6e')](function(_0x21d34f){return _0x258d27['addTeams'](_0x33564f,{'transaction':_0x21d34f})[_0xb5ab('0x27')](function(){return BPromise['each'](_0x411ff7,function(_0x5bfcb7){return db[_0xb5ab('0x5a')]['findOrCreate']({'where':{'UserId':_0x5bfcb7['id'],'MailQueueId':_0x2b06e8[_0xb5ab('0x4b')]['id']},'transaction':_0x21d34f});});})[_0xb5ab('0x27')](function(){_0x411ff7[_0xb5ab('0x6f')](function(_0x3de1e8){socket[_0xb5ab('0x70')](_0xb5ab('0x71'),{'UserId':_0x3de1e8['id'],'MailQueueId':_0x258d27['id']});});});});});}})['then'](respondWithStatusCode(_0x29c8f0,null))[_0xb5ab('0x49')](handleError(_0x29c8f0,null));};exports[_0xb5ab('0x72')]=function(_0x2774c6,_0x53f900,_0x5d1f54){return db['Team'][_0xb5ab('0x47')]({'where':{'id':_0x2774c6[_0xb5ab('0x36')][_0xb5ab('0x73')]},'attributes':['id'],'include':[{'model':db[_0xb5ab('0x68')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb5ab('0x27')](handleEntityNotFound(_0x53f900,null))['then'](function(_0x318890){var _0x1ed38b=_[_0xb5ab('0x30')](_0x318890,'id');var _0x1f3f8f=[];var _0x5775f3=[];var _0x36714d=squel['select']();_0x36714d[_0xb5ab('0x74')]('tq.TeamId')[_0xb5ab('0x75')]('team_has_mail_queues','tq')[_0xb5ab('0x76')](_0xb5ab('0x77'),'ut',_0xb5ab('0x78'))['where'](_0xb5ab('0x79'),_0x2774c6['params']['id']);for(var _0x1a2890=0x0;_0x1a2890<_0x318890[_0xb5ab('0x3c')];_0x1a2890+=0x1){let _0x325bf2=_0x318890[_0x1a2890];for(var _0x3009d8=0x0;_0x3009d8<_0x325bf2[_0xb5ab('0x69')][_0xb5ab('0x3c')];_0x3009d8+=0x1){let _0x29cb8f=_0x325bf2[_0xb5ab('0x69')][_0x3009d8];var _0x5bec17=_0x36714d[_0xb5ab('0x7a')]();_0x5bec17[_0xb5ab('0x43')](_0xb5ab('0x7b'),_0x29cb8f['id']);_0x5775f3[_0xb5ab('0x7c')](db[_0xb5ab('0x6d')][_0xb5ab('0x36')](_0x5bec17['toString'](),{'type':db[_0xb5ab('0x6d')][_0xb5ab('0x7d')][_0xb5ab('0x7e')]})['then'](function(_0x2f954c){if(_0x2f954c[_0xb5ab('0x3c')]===0x1){return _0x29cb8f['id'];}else{var _0x5c734d=_[_0xb5ab('0x7f')](_['map'](_0x2f954c,_0xb5ab('0x80')),function(_0x2d5ad3){return _[_0xb5ab('0x81')](_0x1ed38b,_0x2d5ad3);});if(_0x5c734d){return _0x29cb8f['id'];}}}));}}return BPromise[_0xb5ab('0x82')](_0x5775f3)[_0xb5ab('0x27')](function(_0x598d93){_0x1f3f8f=_(_0x1f3f8f)[_0xb5ab('0x83')](_0x598d93)['compact']()['value']();return db[_0xb5ab('0x31')][_0xb5ab('0x4d')]({'where':{'id':_0x2774c6[_0xb5ab('0x4b')]['id']}})['then'](function(_0xffb9db){return db[_0xb5ab('0x6d')][_0xb5ab('0x6e')](function(_0x2f995a){return _0xffb9db[_0xb5ab('0x72')](_0x2774c6[_0xb5ab('0x36')][_0xb5ab('0x73')],{'transaction':_0x2f995a})['then'](function(){if(!_[_0xb5ab('0x84')](_0x1f3f8f)){return _0xffb9db[_0xb5ab('0x85')](_0x1f3f8f,{'transaction':_0x2f995a});}})[_0xb5ab('0x27')](function(){_0x1f3f8f[_0xb5ab('0x6f')](function(_0x2337f6){socket[_0xb5ab('0x70')](_0xb5ab('0x86'),{'UserId':_0x2337f6,'MailQueueId':_0xffb9db['id']});});});});});});})[_0xb5ab('0x27')](respondWithStatusCode(_0x53f900,null))['catch'](handleError(_0x53f900,null));};exports[_0xb5ab('0x87')]=function(_0x26cf2a,_0x2da65c,_0x4a4a93){return db[_0xb5ab('0x31')][_0xb5ab('0x4d')]({'where':{'id':_0x26cf2a[_0xb5ab('0x4b')]['id']}})[_0xb5ab('0x27')](handleEntityNotFound(_0x2da65c,null))[_0xb5ab('0x27')](function(_0x314cbc){if(_0x314cbc){return _0x314cbc[_0xb5ab('0x87')](_0x26cf2a[_0xb5ab('0x4f')][_0xb5ab('0x73')],_['omit'](_0x26cf2a[_0xb5ab('0x4f')],[_0xb5ab('0x73'),'id'])||{})[_0xb5ab('0x88')](function(_0x45780f){for(var _0x398c56=0x0;_0x398c56<_0x26cf2a[_0xb5ab('0x4f')][_0xb5ab('0x73')][_0xb5ab('0x3c')];_0x398c56+=0x1){socket['emit'](_0xb5ab('0x71'),{'UserId':_0x26cf2a[_0xb5ab('0x4f')][_0xb5ab('0x73')][_0x398c56],'MailQueueId':_0x26cf2a[_0xb5ab('0x4b')]['id']});}return _0x45780f;});}})['then'](respondWithResult(_0x2da65c,null))[_0xb5ab('0x49')](handleError(_0x2da65c,null));};exports[_0xb5ab('0x85')]=function(_0x375ac9,_0xa2c8dd,_0x401fb7){return db[_0xb5ab('0x31')][_0xb5ab('0x4d')]({'where':{'id':_0x375ac9[_0xb5ab('0x4b')]['id']}})['then'](handleEntityNotFound(_0xa2c8dd,null))['then'](function(_0xc043aa){if(_0xc043aa){return _0xc043aa[_0xb5ab('0x85')](_0x375ac9[_0xb5ab('0x36')]['ids'])['then'](function(){if(_[_0xb5ab('0x89')](_0x375ac9[_0xb5ab('0x36')][_0xb5ab('0x73')])){for(var _0x1d74ab=0x0;_0x1d74ab<_0x375ac9[_0xb5ab('0x36')]['ids'][_0xb5ab('0x3c')];_0x1d74ab+=0x1){socket[_0xb5ab('0x70')]('userMailQueue:remove',{'UserId':Number(_0x375ac9[_0xb5ab('0x36')][_0xb5ab('0x73')][_0x1d74ab]),'MailQueueId':Number(_0x375ac9[_0xb5ab('0x4b')]['id'])});}}else{socket[_0xb5ab('0x70')](_0xb5ab('0x86'),{'UserId':Number(_0x375ac9[_0xb5ab('0x36')][_0xb5ab('0x73')]),'MailQueueId':Number(_0x375ac9[_0xb5ab('0x4b')]['id'])});}});}})[_0xb5ab('0x27')](respondWithStatusCode(_0xa2c8dd,null))['catch'](handleError(_0xa2c8dd,null));};exports[_0xb5ab('0x8a')]=function(_0x201732,_0x4b97a5,_0xe5ea46){var _0x225928={};var _0x43467e={};var _0x4fceda;var _0x2072a0;return db[_0xb5ab('0x31')][_0xb5ab('0x8b')]({'where':{'id':_0x201732[_0xb5ab('0x4b')]['id']}})[_0xb5ab('0x27')](handleEntityNotFound(_0x4b97a5,null))[_0xb5ab('0x27')](function(_0x4fff63){if(_0x4fff63){_0x4fceda=_0x4fff63;_0x43467e[_0xb5ab('0x35')]=_['keys'](db[_0xb5ab('0x68')]['rawAttributes']);_0x43467e[_0xb5ab('0x36')]=_[_0xb5ab('0x37')](_0x201732['query']);_0x43467e[_0xb5ab('0x38')]=_[_0xb5ab('0x39')](_0x43467e[_0xb5ab('0x35')],_0x43467e[_0xb5ab('0x36')]);_0x225928['attributes']=_[_0xb5ab('0x39')](_0x43467e[_0xb5ab('0x35')],qs['fields'](_0x201732['query'][_0xb5ab('0x3b')]));_0x225928[_0xb5ab('0x3a')]=_0x225928['attributes'][_0xb5ab('0x3c')]?_0x225928[_0xb5ab('0x3a')]:_0x43467e['model'];_0x225928[_0xb5ab('0x3f')]=qs[_0xb5ab('0x40')](_0x201732[_0xb5ab('0x36')]['sort']);_0x225928[_0xb5ab('0x43')]=qs['filters'](_[_0xb5ab('0x41')](_0x201732['query'],_0x43467e[_0xb5ab('0x38')]));if(_0x201732[_0xb5ab('0x36')][_0xb5ab('0x42')]){_0x225928[_0xb5ab('0x43')]=_[_0xb5ab('0x44')](_0x225928[_0xb5ab('0x43')],{'$or':_[_0xb5ab('0x30')](_0x225928[_0xb5ab('0x3a')],function(_0xebd3a8){var _0x3d2c9e={};_0x3d2c9e[_0xebd3a8]={'$like':'%'+_0x201732['query'][_0xb5ab('0x42')]+'%'};return _0x3d2c9e;})});}_0x225928=_['merge']({},_0x225928,_0x201732[_0xb5ab('0x4c')]);return _0x4fceda[_0xb5ab('0x8a')](_0x225928);}})[_0xb5ab('0x27')](function(_0x29f9e3){if(_0x29f9e3){_0x2072a0=_0x29f9e3[_0xb5ab('0x3c')];if(!_0x201732[_0xb5ab('0x36')][_0xb5ab('0x3d')](_0xb5ab('0x3e'))){_0x225928[_0xb5ab('0x1f')]=qs[_0xb5ab('0x1f')](_0x201732[_0xb5ab('0x36')][_0xb5ab('0x1f')]);_0x225928[_0xb5ab('0x1e')]=qs[_0xb5ab('0x1e')](_0x201732[_0xb5ab('0x36')]['offset']);}return _0x4fceda['getAgents'](_0x225928);}})[_0xb5ab('0x27')](function(_0x49ec9f){if(_0x49ec9f){return _0x49ec9f?{'count':_0x2072a0,'rows':_0x49ec9f}:null;}})['then'](respondWithResult(_0x4b97a5,null))[_0xb5ab('0x49')](handleError(_0x4b97a5,null));}; \ No newline at end of file +var _0xb277=['updatedAt','createdAt','%s/%s','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','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','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./mailQueue.socket','sendStatus','json','count','offset','limit','status','Content-Range','save','update','destroy','then','MailQueues','end','stack','name','send','index','MailQueue','fieldName','type','map','keys','query','filters','model','attributes','intersection','fields','length','order','sort','pick','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','MailQueueId','User','findAndCountAll','UserId','agent','mailPause'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb277,0xbe));var _0x7b27=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb277[_0x38a7ac];return _0x53061a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7b27('0x0'));var rimraf=require(_0x7b27('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b27('0x2'));var rp=require(_0x7b27('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7b27('0x4'));var util=require(_0x7b27('0x5'));var path=require(_0x7b27('0x6'));var sox=require(_0x7b27('0x7'));var csv=require(_0x7b27('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7b27('0x9'));var crypto=require(_0x7b27('0xa'));var jsforce=require(_0x7b27('0xb'));var deskjs=require(_0x7b27('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7b27('0xd'));var Papa=require(_0x7b27('0xe'));var Redis=require(_0x7b27('0xf'));var authService=require(_0x7b27('0x10'));var qs=require(_0x7b27('0x11'));var as=require(_0x7b27('0x12'));var hardwareService=require(_0x7b27('0x13'));var logger=require(_0x7b27('0x14'))(_0x7b27('0x15'));var utils=require(_0x7b27('0x16'));var config=require(_0x7b27('0x17'));var db=require(_0x7b27('0x18'))['db'];config[_0x7b27('0x19')]=_[_0x7b27('0x1a')](config[_0x7b27('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b27('0x19')]));require(_0x7b27('0x1b'))['register'](socket);function respondWithStatusCode(_0x34ecfa,_0x654ae5){_0x654ae5=_0x654ae5||0xcc;return function(_0x3686bc){if(_0x3686bc){return _0x34ecfa[_0x7b27('0x1c')](_0x654ae5);}return _0x34ecfa['status'](_0x654ae5)['end']();};}function respondWithResult(_0x55b4d2,_0x3004d1){_0x3004d1=_0x3004d1||0xc8;return function(_0xca7669){if(_0xca7669){return _0x55b4d2['status'](_0x3004d1)[_0x7b27('0x1d')](_0xca7669);}};}function respondWithFilteredResult(_0x4e59a0,_0x21827e){return function(_0x154335){if(_0x154335){var _0x17fc61=_0x154335[_0x7b27('0x1e')],_0x3f5172=_0x21827e[_0x7b27('0x1f')],_0x8a41b2=_0x21827e[_0x7b27('0x1f')]+_0x21827e[_0x7b27('0x20')],_0x2a1b03;if(_0x8a41b2>=_0x17fc61){_0x8a41b2=_0x17fc61;_0x2a1b03=0xc8;}else{_0x2a1b03=0xce;}_0x4e59a0[_0x7b27('0x21')](_0x2a1b03);return _0x4e59a0['set'](_0x7b27('0x22'),_0x3f5172+'-'+_0x8a41b2+'/'+_0x17fc61)[_0x7b27('0x1d')](_0x154335);}return null;};}function patchUpdates(_0x410511){return function(_0x2542f4){try{jsonpatch['apply'](_0x2542f4,_0x410511,!![]);}catch(_0x2b8293){return BPromise['reject'](_0x2b8293);}return _0x2542f4[_0x7b27('0x23')]();};}function saveUpdates(_0x1bb322,_0x45f656){return function(_0x55911c){if(_0x55911c){return _0x55911c[_0x7b27('0x24')](_0x1bb322)['then'](function(_0x1bce76){return _0x1bce76;});}return null;};}function removeEntity(_0x4f292b,_0x3b53ab){return function(_0x5ad8be){if(_0x5ad8be){return _0x5ad8be[_0x7b27('0x25')]()[_0x7b27('0x26')](function(){var _0x5e7975=_0x5ad8be['get']({'plain':!![]});var _0x328ca6=_0x7b27('0x27');return db['UserProfileResource'][_0x7b27('0x25')]({'where':{'type':_0x328ca6,'resourceId':_0x5e7975['id']}})[_0x7b27('0x26')](function(){return _0x5ad8be;});})[_0x7b27('0x26')](function(){_0x4f292b[_0x7b27('0x21')](0xcc)[_0x7b27('0x28')]();});}};}function handleEntityNotFound(_0x1551e8,_0x2f004b){return function(_0x2b377e){if(!_0x2b377e){_0x1551e8['sendStatus'](0x194);}return _0x2b377e;};}function handleError(_0x392806,_0x175525){_0x175525=_0x175525||0x1f4;return function(_0x2a7f1e){logger['error'](_0x2a7f1e[_0x7b27('0x29')]);if(_0x2a7f1e['name']){delete _0x2a7f1e[_0x7b27('0x2a')];}_0x392806[_0x7b27('0x21')](_0x175525)[_0x7b27('0x2b')](_0x2a7f1e);};}exports[_0x7b27('0x2c')]=function(_0x212903,_0x2246d8){var _0xd1d103={},_0x511718={},_0x1f3c3b={'count':0x0,'rows':[]};var _0x191df0=_['map'](db[_0x7b27('0x2d')]['rawAttributes'],function(_0x28837c){return{'name':_0x28837c[_0x7b27('0x2e')],'type':_0x28837c[_0x7b27('0x2f')]['key']};});_0x511718['model']=_[_0x7b27('0x30')](_0x191df0,_0x7b27('0x2a'));_0x511718['query']=_[_0x7b27('0x31')](_0x212903[_0x7b27('0x32')]);_0x511718[_0x7b27('0x33')]=_['intersection'](_0x511718[_0x7b27('0x34')],_0x511718[_0x7b27('0x32')]);_0xd1d103[_0x7b27('0x35')]=_[_0x7b27('0x36')](_0x511718[_0x7b27('0x34')],qs[_0x7b27('0x37')](_0x212903['query']['fields']));_0xd1d103[_0x7b27('0x35')]=_0xd1d103[_0x7b27('0x35')][_0x7b27('0x38')]?_0xd1d103['attributes']:_0x511718[_0x7b27('0x34')];if(!_0x212903[_0x7b27('0x32')]['hasOwnProperty']('nolimit')){_0xd1d103[_0x7b27('0x20')]=qs[_0x7b27('0x20')](_0x212903[_0x7b27('0x32')][_0x7b27('0x20')]);_0xd1d103['offset']=qs[_0x7b27('0x1f')](_0x212903[_0x7b27('0x32')][_0x7b27('0x1f')]);}_0xd1d103[_0x7b27('0x39')]=qs['sort'](_0x212903[_0x7b27('0x32')][_0x7b27('0x3a')]);_0xd1d103['where']=qs[_0x7b27('0x33')](_[_0x7b27('0x3b')](_0x212903['query'],_0x511718['filters']),_0x191df0);if(_0x212903[_0x7b27('0x32')]['filter']){_0xd1d103[_0x7b27('0x3c')]=_['merge'](_0xd1d103[_0x7b27('0x3c')],{'$or':_[_0x7b27('0x30')](_0x191df0,function(_0x3cdc37){if(_0x3cdc37['type']!==_0x7b27('0x3d')){var _0x425597={};_0x425597[_0x3cdc37[_0x7b27('0x2a')]]={'$like':'%'+_0x212903[_0x7b27('0x32')][_0x7b27('0x3e')]+'%'};return _0x425597;}})});}_0xd1d103=_['merge']({},_0xd1d103,_0x212903[_0x7b27('0x3f')]);var _0x1f2bde={'where':_0xd1d103[_0x7b27('0x3c')]};return db[_0x7b27('0x2d')][_0x7b27('0x1e')](_0x1f2bde)[_0x7b27('0x26')](function(_0x43e54c){_0x1f3c3b[_0x7b27('0x1e')]=_0x43e54c;if(_0x212903[_0x7b27('0x32')][_0x7b27('0x40')]){_0xd1d103[_0x7b27('0x41')]=[{'all':!![]}];}return db[_0x7b27('0x2d')][_0x7b27('0x42')](_0xd1d103);})['then'](function(_0x5e5488){_0x1f3c3b[_0x7b27('0x43')]=_0x5e5488;return _0x1f3c3b;})[_0x7b27('0x26')](respondWithFilteredResult(_0x2246d8,_0xd1d103))[_0x7b27('0x44')](handleError(_0x2246d8,null));};exports[_0x7b27('0x45')]=function(_0x24e475,_0x59d45b){var _0x56dca8={'raw':!![],'where':{'id':_0x24e475['params']['id']}},_0x10110b={};_0x10110b[_0x7b27('0x34')]=_['keys'](db[_0x7b27('0x2d')][_0x7b27('0x46')]);_0x10110b['query']=_[_0x7b27('0x31')](_0x24e475[_0x7b27('0x32')]);_0x10110b[_0x7b27('0x33')]=_[_0x7b27('0x36')](_0x10110b[_0x7b27('0x34')],_0x10110b[_0x7b27('0x32')]);_0x56dca8['attributes']=_[_0x7b27('0x36')](_0x10110b[_0x7b27('0x34')],qs[_0x7b27('0x37')](_0x24e475[_0x7b27('0x32')][_0x7b27('0x37')]));_0x56dca8[_0x7b27('0x35')]=_0x56dca8[_0x7b27('0x35')][_0x7b27('0x38')]?_0x56dca8[_0x7b27('0x35')]:_0x10110b[_0x7b27('0x34')];if(_0x24e475[_0x7b27('0x32')][_0x7b27('0x40')]){_0x56dca8[_0x7b27('0x41')]=[{'all':!![]}];}_0x56dca8=_[_0x7b27('0x47')]({},_0x56dca8,_0x24e475[_0x7b27('0x3f')]);return db['MailQueue'][_0x7b27('0x48')](_0x56dca8)[_0x7b27('0x26')](handleEntityNotFound(_0x59d45b,null))['then'](respondWithResult(_0x59d45b,null))['catch'](handleError(_0x59d45b,null));};exports['create']=function(_0x4918d4,_0x273b5e){return db['MailQueue'][_0x7b27('0x49')](_0x4918d4[_0x7b27('0x4a')],{})['then'](function(_0x3769f7){var _0x1a6856=_0x4918d4[_0x7b27('0x4b')][_0x7b27('0x4c')]({'plain':!![]});if(!_0x1a6856)throw new Error(_0x7b27('0x4d'));if(_0x1a6856['role']==='user'){var _0x21ad2e=_0x3769f7[_0x7b27('0x4c')]({'plain':!![]});var _0xd084d0=_0x7b27('0x27');return db[_0x7b27('0x4e')][_0x7b27('0x48')]({'where':{'name':_0xd084d0,'userProfileId':_0x1a6856['userProfileId']},'raw':!![]})[_0x7b27('0x26')](function(_0x4778ef){if(_0x4778ef&&_0x4778ef[_0x7b27('0x4f')]===0x0){return db[_0x7b27('0x50')]['create']({'name':_0x21ad2e[_0x7b27('0x2a')],'resourceId':_0x21ad2e['id'],'type':_0x4778ef[_0x7b27('0x2a')],'sectionId':_0x4778ef['id']},{})[_0x7b27('0x26')](function(){return _0x3769f7;});}else{return _0x3769f7;}})[_0x7b27('0x44')](function(_0x3598c5){logger[_0x7b27('0x51')](_0x7b27('0x52'),_0x3598c5);throw _0x3598c5;});}return _0x3769f7;})[_0x7b27('0x26')](respondWithResult(_0x273b5e,0xc9))[_0x7b27('0x44')](handleError(_0x273b5e,null));};exports[_0x7b27('0x24')]=function(_0x1f1c01,_0x1ae672){if(_0x1f1c01[_0x7b27('0x4a')]['id']){delete _0x1f1c01[_0x7b27('0x4a')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x1f1c01['params']['id']}})['then'](handleEntityNotFound(_0x1ae672,null))[_0x7b27('0x26')](saveUpdates(_0x1f1c01[_0x7b27('0x4a')],null))[_0x7b27('0x26')](respondWithResult(_0x1ae672,null))[_0x7b27('0x44')](handleError(_0x1ae672,null));};exports['destroy']=function(_0x4454ad,_0x5cf4c8){return db[_0x7b27('0x2d')]['find']({'where':{'id':_0x4454ad[_0x7b27('0x53')]['id']}})[_0x7b27('0x26')](handleEntityNotFound(_0x5cf4c8,null))[_0x7b27('0x26')](removeEntity(_0x5cf4c8,null))[_0x7b27('0x44')](handleError(_0x5cf4c8,null));};exports['describe']=function(_0x3e7881,_0x532020){return db[_0x7b27('0x2d')][_0x7b27('0x54')]()[_0x7b27('0x26')](respondWithResult(_0x532020,null))[_0x7b27('0x44')](handleError(_0x532020,null));};exports[_0x7b27('0x55')]=function(_0x4c13ff,_0x486e7f,_0x158e90){var _0x302cdc={'raw':!![],'where':{}},_0x302ef1={},_0x3e978f;return db['MailQueue'][_0x7b27('0x56')]({'where':{'id':_0x4c13ff[_0x7b27('0x53')]['id']}})[_0x7b27('0x26')](handleEntityNotFound(_0x486e7f,null))[_0x7b27('0x26')](function(_0x54dd21){if(_0x54dd21){_0x3e978f=_0x54dd21[_0x7b27('0x4c')]({'plain':!![]});_0x302ef1[_0x7b27('0x34')]=_[_0x7b27('0x31')](db[_0x7b27('0x57')][_0x7b27('0x46')]);_0x302ef1[_0x7b27('0x32')]=_[_0x7b27('0x31')](_0x4c13ff[_0x7b27('0x32')]);_0x302ef1[_0x7b27('0x33')]=_[_0x7b27('0x36')](_0x302ef1[_0x7b27('0x34')],_0x302ef1[_0x7b27('0x32')]);_0x302cdc[_0x7b27('0x35')]=_['intersection'](_0x302ef1[_0x7b27('0x34')],qs[_0x7b27('0x37')](_0x4c13ff[_0x7b27('0x32')][_0x7b27('0x37')]));_0x302cdc[_0x7b27('0x35')]=_0x302cdc[_0x7b27('0x35')][_0x7b27('0x38')]?_0x302cdc[_0x7b27('0x35')]:_0x302ef1[_0x7b27('0x34')];if(!_0x4c13ff[_0x7b27('0x32')][_0x7b27('0x58')](_0x7b27('0x59'))){_0x302cdc['limit']=qs[_0x7b27('0x20')](_0x4c13ff[_0x7b27('0x32')]['limit']);_0x302cdc[_0x7b27('0x1f')]=qs[_0x7b27('0x1f')](_0x4c13ff['query'][_0x7b27('0x1f')]);}_0x302cdc['order']=qs[_0x7b27('0x3a')](_0x4c13ff[_0x7b27('0x32')]['sort']);_0x302cdc[_0x7b27('0x3c')]=qs[_0x7b27('0x33')](_[_0x7b27('0x3b')](_0x4c13ff[_0x7b27('0x32')],_0x302ef1[_0x7b27('0x33')]));_0x302cdc['where'][_0x7b27('0x5a')]=_0x54dd21['id'];if(_0x4c13ff[_0x7b27('0x32')]['filter']){_0x302cdc['where']=_[_0x7b27('0x47')](_0x302cdc['where'],{'$or':_[_0x7b27('0x30')](_0x302cdc['attributes'],function(_0x30c48e){var _0x1a303e={};_0x1a303e[_0x30c48e]={'$like':'%'+_0x4c13ff[_0x7b27('0x32')][_0x7b27('0x3e')]+'%'};return _0x1a303e;})});}_0x302cdc=_[_0x7b27('0x47')]({},_0x302cdc,_0x4c13ff['options']);return db[_0x7b27('0x57')][_0x7b27('0x42')](_0x302cdc);}})[_0x7b27('0x26')](function(_0x30c18b){if(_0x30c18b){return db[_0x7b27('0x5b')][_0x7b27('0x5c')]({'where':{'id':_[_0x7b27('0x30')](_0x30c18b,_0x7b27('0x5d')),'role':_0x7b27('0x5e')},'attributes':['id',_0x7b27('0x2a'),_0x7b27('0x5f'),_0x7b27('0x60'),_0x7b27('0x61')]});}})['then'](function(_0x3f56be){if(_0x3f56be){return{'count':_0x3f56be[_0x7b27('0x1e')],'rows':_[_0x7b27('0x30')](_0x3f56be[_0x7b27('0x43')],function(_0x3843bf){return{'membername':_0x3843bf[_0x7b27('0x2a')],'UserId':_0x3843bf['id'],'queue_name':_0x3e978f['name'],'MailQueueId':_0x3e978f['id'],'interface':util['format'](_0x7b27('0x62'),'SIP',_0x3843bf['name']),'penalty':0x0,'paused':_0x3843bf['mailPause'],'createdAt':_0x3843bf[_0x7b27('0x61')],'updatedAt':_0x3843bf[_0x7b27('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7b27('0x26')](respondWithFilteredResult(_0x486e7f,_0x302cdc))['catch'](handleError(_0x486e7f,null));};exports[_0x7b27('0x63')]=function(_0x59242c,_0x26e029,_0x2a904e){var _0x45f8cb={};var _0x31991f={};var _0x4f184f;var _0xdfcab8;return db[_0x7b27('0x2d')][_0x7b27('0x56')]({'where':{'id':_0x59242c[_0x7b27('0x53')]['id']}})[_0x7b27('0x26')](handleEntityNotFound(_0x26e029,null))[_0x7b27('0x26')](function(_0x1caa47){if(_0x1caa47){_0x4f184f=_0x1caa47;_0x31991f[_0x7b27('0x34')]=_[_0x7b27('0x31')](db[_0x7b27('0x64')][_0x7b27('0x46')]);_0x31991f[_0x7b27('0x32')]=_['keys'](_0x59242c[_0x7b27('0x32')]);_0x31991f[_0x7b27('0x33')]=_[_0x7b27('0x36')](_0x31991f[_0x7b27('0x34')],_0x31991f[_0x7b27('0x32')]);_0x45f8cb['attributes']=_['intersection'](_0x31991f['model'],qs[_0x7b27('0x37')](_0x59242c['query'][_0x7b27('0x37')]));_0x45f8cb['attributes']=_0x45f8cb[_0x7b27('0x35')][_0x7b27('0x38')]?_0x45f8cb[_0x7b27('0x35')]:_0x31991f[_0x7b27('0x34')];_0x45f8cb[_0x7b27('0x39')]=qs[_0x7b27('0x3a')](_0x59242c['query']['sort']);_0x45f8cb[_0x7b27('0x3c')]=qs['filters'](_[_0x7b27('0x3b')](_0x59242c['query'],_0x31991f[_0x7b27('0x33')]));if(_0x59242c[_0x7b27('0x32')][_0x7b27('0x3e')]){_0x45f8cb[_0x7b27('0x3c')]=_[_0x7b27('0x47')](_0x45f8cb[_0x7b27('0x3c')],{'$or':_[_0x7b27('0x30')](_0x45f8cb[_0x7b27('0x35')],function(_0x6dde3f){var _0x2b3ded={};_0x2b3ded[_0x6dde3f]={'$like':'%'+_0x59242c[_0x7b27('0x32')][_0x7b27('0x3e')]+'%'};return _0x2b3ded;})});}_0x45f8cb=_['merge']({},_0x45f8cb,_0x59242c[_0x7b27('0x3f')]);return _0x4f184f[_0x7b27('0x63')](_0x45f8cb);}})[_0x7b27('0x26')](function(_0x2ef54f){if(_0x2ef54f){_0xdfcab8=_0x2ef54f[_0x7b27('0x38')];if(!_0x59242c[_0x7b27('0x32')][_0x7b27('0x58')](_0x7b27('0x59'))){_0x45f8cb[_0x7b27('0x20')]=qs[_0x7b27('0x20')](_0x59242c[_0x7b27('0x32')][_0x7b27('0x20')]);_0x45f8cb[_0x7b27('0x1f')]=qs['offset'](_0x59242c[_0x7b27('0x32')][_0x7b27('0x1f')]);}return _0x4f184f[_0x7b27('0x63')](_0x45f8cb);}})[_0x7b27('0x26')](function(_0x2c307f){if(_0x2c307f){return _0x2c307f?{'count':_0xdfcab8,'rows':_0x2c307f}:null;}})[_0x7b27('0x26')](respondWithResult(_0x26e029,null))[_0x7b27('0x44')](handleError(_0x26e029,null));};exports[_0x7b27('0x65')]=function(_0x4c850c,_0x194f25,_0x295906){var _0x24faaa=_0x4c850c['body'][_0x7b27('0x66')];return db['Team'][_0x7b27('0x42')]({'where':{'id':_0x24faaa},'attributes':['id'],'include':[{'model':db[_0x7b27('0x5b')],'as':_0x7b27('0x67'),'attributes':['id',_0x7b27('0x2a'),_0x7b27('0x68'),_0x7b27('0x69'),_0x7b27('0x6a')],'raw':!![]}]})['then'](function(_0x43be8a){if(_0x43be8a){var _0x4658d1=_[_0x7b27('0x6b')](_0x43be8a,function(_0x4b59a8){var _0x497ecb=_0x4b59a8[_0x7b27('0x4c')]({'plain':!![]});return _0x497ecb['Agents'];});return db['MailQueue'][_0x7b27('0x48')]({'where':{'id':_0x4c850c['params']['id']}})[_0x7b27('0x26')](function(_0x5e818f){return db[_0x7b27('0x6c')][_0x7b27('0x6d')](function(_0x2a0dd0){return _0x5e818f[_0x7b27('0x65')](_0x24faaa,{'transaction':_0x2a0dd0})[_0x7b27('0x26')](function(){return BPromise[_0x7b27('0x6e')](_0x4658d1,function(_0x4dd9bf){return db[_0x7b27('0x57')][_0x7b27('0x6f')]({'where':{'UserId':_0x4dd9bf['id'],'MailQueueId':_0x4c850c[_0x7b27('0x53')]['id']},'transaction':_0x2a0dd0});});})[_0x7b27('0x26')](function(){_0x4658d1[_0x7b27('0x70')](function(_0x4e5567){socket[_0x7b27('0x71')](_0x7b27('0x72'),{'UserId':_0x4e5567['id'],'MailQueueId':_0x5e818f['id']});});});});});}})[_0x7b27('0x26')](respondWithStatusCode(_0x194f25,null))[_0x7b27('0x44')](handleError(_0x194f25,null));};exports[_0x7b27('0x73')]=function(_0x4b4d2d,_0x1f092b,_0x2ff576){return db['Team'][_0x7b27('0x42')]({'where':{'id':_0x4b4d2d['query'][_0x7b27('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7b27('0x67'),'attributes':['id'],'raw':!![]}]})[_0x7b27('0x26')](handleEntityNotFound(_0x1f092b,null))[_0x7b27('0x26')](function(_0x54cb74){var _0x2b7046=_[_0x7b27('0x30')](_0x54cb74,'id');var _0x27ed7f=[];var _0x32784c=[];var _0xdaa88c=squel['select']();_0xdaa88c['field'](_0x7b27('0x74'))[_0x7b27('0x75')](_0x7b27('0x76'),'tq')[_0x7b27('0x77')](_0x7b27('0x78'),'ut',_0x7b27('0x79'))[_0x7b27('0x3c')](_0x7b27('0x7a'),_0x4b4d2d[_0x7b27('0x53')]['id']);for(var _0x56a9fa=0x0;_0x56a9fa<_0x54cb74[_0x7b27('0x38')];_0x56a9fa+=0x1){let _0x1be6b8=_0x54cb74[_0x56a9fa];for(var _0x5defc8=0x0;_0x5defc8<_0x1be6b8[_0x7b27('0x67')][_0x7b27('0x38')];_0x5defc8+=0x1){let _0x44f148=_0x1be6b8[_0x7b27('0x67')][_0x5defc8];var _0x156b47=_0xdaa88c[_0x7b27('0x7b')]();_0x156b47[_0x7b27('0x3c')](_0x7b27('0x7c'),_0x44f148['id']);_0x32784c[_0x7b27('0x7d')](db['sequelize'][_0x7b27('0x32')](_0x156b47[_0x7b27('0x7e')](),{'type':db[_0x7b27('0x6c')][_0x7b27('0x7f')][_0x7b27('0x80')]})[_0x7b27('0x26')](function(_0x29c911){if(_0x29c911[_0x7b27('0x38')]===0x1){return _0x44f148['id'];}else{var _0x5fa213=_['every'](_[_0x7b27('0x30')](_0x29c911,_0x7b27('0x81')),function(_0x41dcdc){return _[_0x7b27('0x82')](_0x2b7046,_0x41dcdc);});if(_0x5fa213){return _0x44f148['id'];}}}));}}return BPromise[_0x7b27('0x83')](_0x32784c)[_0x7b27('0x26')](function(_0x234153){_0x27ed7f=_(_0x27ed7f)[_0x7b27('0x84')](_0x234153)[_0x7b27('0x85')]()[_0x7b27('0x86')]();return db[_0x7b27('0x2d')][_0x7b27('0x48')]({'where':{'id':_0x4b4d2d[_0x7b27('0x53')]['id']}})[_0x7b27('0x26')](function(_0x5ac794){return db[_0x7b27('0x6c')][_0x7b27('0x6d')](function(_0x5c2112){return _0x5ac794[_0x7b27('0x73')](_0x4b4d2d['query'][_0x7b27('0x66')],{'transaction':_0x5c2112})[_0x7b27('0x26')](function(){if(!_[_0x7b27('0x87')](_0x27ed7f)){return _0x5ac794['removeAgents'](_0x27ed7f,{'transaction':_0x5c2112});}})[_0x7b27('0x26')](function(){_0x27ed7f['forEach'](function(_0x15b79c){socket[_0x7b27('0x71')](_0x7b27('0x88'),{'UserId':_0x15b79c,'MailQueueId':_0x5ac794['id']});});});});});});})[_0x7b27('0x26')](respondWithStatusCode(_0x1f092b,null))['catch'](handleError(_0x1f092b,null));};exports['addAgents']=function(_0x24bae1,_0x465739,_0x33dff6){return db[_0x7b27('0x2d')][_0x7b27('0x48')]({'where':{'id':_0x24bae1[_0x7b27('0x53')]['id']}})[_0x7b27('0x26')](handleEntityNotFound(_0x465739,null))[_0x7b27('0x26')](function(_0x1363a7){if(_0x1363a7){return _0x1363a7[_0x7b27('0x89')](_0x24bae1[_0x7b27('0x4a')]['ids'],_[_0x7b27('0x8a')](_0x24bae1[_0x7b27('0x4a')],[_0x7b27('0x66'),'id'])||{})[_0x7b27('0x8b')](function(_0xd94141){for(var _0x196e73=0x0;_0x196e73<_0x24bae1[_0x7b27('0x4a')][_0x7b27('0x66')][_0x7b27('0x38')];_0x196e73+=0x1){socket[_0x7b27('0x71')](_0x7b27('0x72'),{'UserId':_0x24bae1['body'][_0x7b27('0x66')][_0x196e73],'MailQueueId':_0x24bae1[_0x7b27('0x53')]['id']});}return _0xd94141;});}})[_0x7b27('0x26')](respondWithResult(_0x465739,null))['catch'](handleError(_0x465739,null));};exports[_0x7b27('0x8c')]=function(_0x5c1806,_0x3f5e5e,_0x3d2dc0){return db[_0x7b27('0x2d')][_0x7b27('0x48')]({'where':{'id':_0x5c1806[_0x7b27('0x53')]['id']}})['then'](handleEntityNotFound(_0x3f5e5e,null))[_0x7b27('0x26')](function(_0x5df205){if(_0x5df205){return _0x5df205[_0x7b27('0x8c')](_0x5c1806['query']['ids'])[_0x7b27('0x26')](function(){if(_[_0x7b27('0x8d')](_0x5c1806[_0x7b27('0x32')]['ids'])){for(var _0xf59e83=0x0;_0xf59e83<_0x5c1806[_0x7b27('0x32')][_0x7b27('0x66')][_0x7b27('0x38')];_0xf59e83+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x5c1806[_0x7b27('0x32')][_0x7b27('0x66')][_0xf59e83]),'MailQueueId':Number(_0x5c1806['params']['id'])});}}else{socket[_0x7b27('0x71')](_0x7b27('0x88'),{'UserId':Number(_0x5c1806[_0x7b27('0x32')][_0x7b27('0x66')]),'MailQueueId':Number(_0x5c1806[_0x7b27('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x3f5e5e,null))[_0x7b27('0x44')](handleError(_0x3f5e5e,null));};exports['getAgents']=function(_0x74ec6,_0x30aa37,_0x108fba){var _0x349bf8={};var _0x180694={};var _0x1dbea5;var _0x3e97f1;return db[_0x7b27('0x2d')][_0x7b27('0x56')]({'where':{'id':_0x74ec6[_0x7b27('0x53')]['id']}})[_0x7b27('0x26')](handleEntityNotFound(_0x30aa37,null))[_0x7b27('0x26')](function(_0x3298c5){if(_0x3298c5){_0x1dbea5=_0x3298c5;_0x180694[_0x7b27('0x34')]=_[_0x7b27('0x31')](db['User'][_0x7b27('0x46')]);_0x180694[_0x7b27('0x32')]=_['keys'](_0x74ec6[_0x7b27('0x32')]);_0x180694[_0x7b27('0x33')]=_[_0x7b27('0x36')](_0x180694[_0x7b27('0x34')],_0x180694[_0x7b27('0x32')]);_0x349bf8[_0x7b27('0x35')]=_['intersection'](_0x180694[_0x7b27('0x34')],qs[_0x7b27('0x37')](_0x74ec6[_0x7b27('0x32')][_0x7b27('0x37')]));_0x349bf8['attributes']=_0x349bf8[_0x7b27('0x35')][_0x7b27('0x38')]?_0x349bf8[_0x7b27('0x35')]:_0x180694[_0x7b27('0x34')];_0x349bf8['order']=qs[_0x7b27('0x3a')](_0x74ec6[_0x7b27('0x32')][_0x7b27('0x3a')]);_0x349bf8[_0x7b27('0x3c')]=qs[_0x7b27('0x33')](_[_0x7b27('0x3b')](_0x74ec6[_0x7b27('0x32')],_0x180694[_0x7b27('0x33')]));if(_0x74ec6[_0x7b27('0x32')][_0x7b27('0x3e')]){_0x349bf8[_0x7b27('0x3c')]=_[_0x7b27('0x47')](_0x349bf8[_0x7b27('0x3c')],{'$or':_[_0x7b27('0x30')](_0x349bf8['attributes'],function(_0x1f67ce){var _0xd46db={};_0xd46db[_0x1f67ce]={'$like':'%'+_0x74ec6[_0x7b27('0x32')][_0x7b27('0x3e')]+'%'};return _0xd46db;})});}_0x349bf8=_['merge']({},_0x349bf8,_0x74ec6[_0x7b27('0x3f')]);return _0x1dbea5[_0x7b27('0x8e')](_0x349bf8);}})[_0x7b27('0x26')](function(_0x466865){if(_0x466865){_0x3e97f1=_0x466865[_0x7b27('0x38')];if(!_0x74ec6[_0x7b27('0x32')][_0x7b27('0x58')](_0x7b27('0x59'))){_0x349bf8[_0x7b27('0x20')]=qs[_0x7b27('0x20')](_0x74ec6['query'][_0x7b27('0x20')]);_0x349bf8[_0x7b27('0x1f')]=qs[_0x7b27('0x1f')](_0x74ec6[_0x7b27('0x32')][_0x7b27('0x1f')]);}return _0x1dbea5['getAgents'](_0x349bf8);}})[_0x7b27('0x26')](function(_0x316e5c){if(_0x316e5c){return _0x316e5c?{'count':_0x3e97f1,'rows':_0x316e5c}:null;}})[_0x7b27('0x26')](respondWithResult(_0x30aa37,null))[_0x7b27('0x44')](handleError(_0x30aa37,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index f73c986..e51d326 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 _0x50f8=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x50f8,0x148));var _0x850f=function(_0x2ef0d4,_0x541da8){_0x2ef0d4=_0x2ef0d4-0x0;var _0x1ddf99=_0x50f8[_0x2ef0d4];return _0x1ddf99;};'use strict';var EventEmitter=require(_0x850f('0x0'));var MailQueue=require(_0x850f('0x1'))['db'][_0x850f('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x850f('0x3')](0x0);var events={'afterCreate':_0x850f('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x31b3a9){return function(_0x5e7ed8,_0x14c76e,_0x34c565){MailQueueEvents['emit'](_0x31b3a9+':'+_0x5e7ed8['id'],_0x5e7ed8);MailQueueEvents[_0x850f('0x5')](_0x31b3a9,_0x5e7ed8);_0x34c565(null);};}for(var e in events){if(events[_0x850f('0x6')](e)){var event=events[e];MailQueue[_0x850f('0x7')](e,emitEvent(event));}}module[_0x850f('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x237a=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x2041a,_0x1dd54b){var _0x1d09b9=function(_0x5278cc){while(--_0x5278cc){_0x2041a['push'](_0x2041a['shift']());}};_0x1d09b9(++_0x1dd54b);}(_0x237a,0x177));var _0xa237=function(_0x1a8615,_0x16dabe){_0x1a8615=_0x1a8615-0x0;var _0x1e613c=_0x237a[_0x1a8615];return _0x1e613c;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xa237('0x0'))['db'][_0xa237('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa237('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa237('0x3'),'afterDestroy':_0xa237('0x4')};function emitEvent(_0x3685f1){return function(_0x25f5f4,_0xbf16d1,_0x17aad4){MailQueueEvents[_0xa237('0x5')](_0x3685f1+':'+_0x25f5f4['id'],_0x25f5f4);MailQueueEvents[_0xa237('0x5')](_0x3685f1,_0x25f5f4);_0x17aad4(null);};}for(var e in events){if(events[_0xa237('0x6')](e)){var event=events[e];MailQueue[_0xa237('0x7')](e,emitEvent(event));}}module[_0xa237('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 12e4d5b..76d601e 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 _0x40dd=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x40dd,0x125));var _0xd40d=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x40dd[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0xd40d('0x0'));var util=require(_0xd40d('0x1'));var logger=require(_0xd40d('0x2'))(_0xd40d('0x3'));var moment=require(_0xd40d('0x4'));var BPromise=require(_0xd40d('0x5'));var rp=require(_0xd40d('0x6'));var fs=require('fs');var path=require(_0xd40d('0x7'));var rimraf=require('rimraf');var config=require(_0xd40d('0x8'));var attributes=require(_0xd40d('0x9'));module[_0xd40d('0xa')]=function(_0x41e853,_0x30c2cf){return _0x41e853[_0xd40d('0xb')](_0xd40d('0xc'),attributes,{'tableName':_0xd40d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bd4=['define','MailQueue','mail_queues','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports'];(function(_0x259853,_0x32ca57){var _0xbfc349=function(_0x303436){while(--_0x303436){_0x259853['push'](_0x259853['shift']());}};_0xbfc349(++_0x32ca57);}(_0x8bd4,0x142));var _0x48bd=function(_0xf91212,_0x1ed44d){_0xf91212=_0xf91212-0x0;var _0x1afba7=_0x8bd4[_0xf91212];return _0x1afba7;};'use strict';var _=require(_0x48bd('0x0'));var util=require(_0x48bd('0x1'));var logger=require(_0x48bd('0x2'))('api');var moment=require(_0x48bd('0x3'));var BPromise=require('bluebird');var rp=require(_0x48bd('0x4'));var fs=require('fs');var path=require(_0x48bd('0x5'));var rimraf=require('rimraf');var config=require(_0x48bd('0x6'));var attributes=require('./mailQueue.attributes');module[_0x48bd('0x7')]=function(_0xe49873,_0x591ea2){return _0xe49873[_0x48bd('0x8')](_0x48bd('0x9'),attributes,{'tableName':_0x48bd('0xa'),'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 7378b21..be3c9e1 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 _0xe514=['raw','where','limit','include','map','attributes','model','debug','stringify','GetMailQueue','ShowMailQueue','find','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','register','then','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','MailQueue','findAll','options'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xe514,0x1bb));var _0x4e51=function(_0x264988,_0xf8c322){_0x264988=_0x264988-0x0;var _0x235bb8=_0xe514[_0x264988];return _0x235bb8;};'use strict';var _=require(_0x4e51('0x0'));var util=require(_0x4e51('0x1'));var moment=require(_0x4e51('0x2'));var BPromise=require(_0x4e51('0x3'));var rs=require(_0x4e51('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e51('0x5'))['db'];var utils=require(_0x4e51('0x6'));var logger=require(_0x4e51('0x7'))(_0x4e51('0x8'));var config=require(_0x4e51('0x9'));var jayson=require(_0x4e51('0xa'));var client=jayson[_0x4e51('0xb')][_0x4e51('0xc')]({'port':0x232a});config[_0x4e51('0xd')]=_[_0x4e51('0xe')](config[_0x4e51('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4e51('0xf'))(new Redis(config[_0x4e51('0xd')]));require(_0x4e51('0x10'))[_0x4e51('0x11')](socket);function respondWithRpcPromise(_0x38b869,_0x4903c8,_0x294670){return new BPromise(function(_0x3ca812,_0x49c52e){return client['request'](_0x38b869,_0x294670)[_0x4e51('0x12')](function(_0x1deb32){logger['info']('MailQueue,\x20%s,\x20%s',_0x4903c8,_0x4e51('0x13'));logger['debug'](_0x4e51('0x14'),_0x4903c8,_0x4e51('0x13'),JSON['stringify'](_0x1deb32));if(_0x1deb32[_0x4e51('0x15')]){if(_0x1deb32[_0x4e51('0x15')][_0x4e51('0x16')]===0x1f4){logger[_0x4e51('0x15')](_0x4e51('0x17'),_0x4903c8,_0x1deb32['error']['message']);return _0x49c52e(_0x1deb32[_0x4e51('0x15')][_0x4e51('0x18')]);}logger[_0x4e51('0x15')](_0x4e51('0x17'),_0x4903c8,_0x1deb32[_0x4e51('0x15')][_0x4e51('0x18')]);return _0x3ca812(_0x1deb32[_0x4e51('0x15')][_0x4e51('0x18')]);}else{logger['info'](_0x4e51('0x17'),_0x4903c8,_0x4e51('0x13'));_0x3ca812(_0x1deb32[_0x4e51('0x19')][_0x4e51('0x18')]);}})[_0x4e51('0x1a')](function(_0x38c3f7){logger[_0x4e51('0x15')](_0x4e51('0x17'),_0x4903c8,_0x38c3f7);_0x49c52e(_0x38c3f7);});});}exports['GetMailQueue']=function(_0x2ea23c){var _0x1398fc=this;return new Promise(function(_0x2dcd26,_0x56899a){return db[_0x4e51('0x1b')][_0x4e51('0x1c')]({'raw':_0x2ea23c['options']?_0x2ea23c[_0x4e51('0x1d')][_0x4e51('0x1e')]===undefined?!![]:![]:!![],'where':_0x2ea23c['options']?_0x2ea23c[_0x4e51('0x1d')][_0x4e51('0x1f')]||null:null,'attributes':_0x2ea23c[_0x4e51('0x1d')]?_0x2ea23c['options']['attributes']||null:null,'limit':_0x2ea23c['options']?_0x2ea23c[_0x4e51('0x1d')][_0x4e51('0x20')]||null:null,'include':_0x2ea23c[_0x4e51('0x1d')]?_0x2ea23c[_0x4e51('0x1d')][_0x4e51('0x21')]?_[_0x4e51('0x22')](_0x2ea23c[_0x4e51('0x1d')]['include'],function(_0x275afa){return{'model':db[_0x275afa['model']],'as':_0x275afa['as'],'attributes':_0x275afa[_0x4e51('0x23')],'include':_0x275afa[_0x4e51('0x21')]?_[_0x4e51('0x22')](_0x275afa['include'],function(_0x3ae6d8){return{'model':db[_0x3ae6d8[_0x4e51('0x24')]],'as':_0x3ae6d8['as'],'attributes':_0x3ae6d8[_0x4e51('0x23')],'include':_0x3ae6d8[_0x4e51('0x21')]?_[_0x4e51('0x22')](_0x3ae6d8[_0x4e51('0x21')],function(_0x592459){return{'model':db[_0x592459[_0x4e51('0x24')]],'as':_0x592459['as'],'attributes':_0x592459[_0x4e51('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x397ab9){logger['info']('GetMailQueue',_0x2ea23c);logger[_0x4e51('0x25')]('GetMailQueue',_0x2ea23c,JSON[_0x4e51('0x26')](_0x397ab9));_0x2dcd26(_0x397ab9);})['catch'](function(_0xe575){logger[_0x4e51('0x15')](_0x4e51('0x27'),_0xe575[_0x4e51('0x18')],_0x2ea23c);_0x56899a(_0x1398fc[_0x4e51('0x15')](0x1f4,_0xe575[_0x4e51('0x18')]));});});};exports[_0x4e51('0x28')]=function(_0x4b0d30){var _0x47eae4=this;return new Promise(function(_0x270905,_0x34455f){return db['MailQueue'][_0x4e51('0x29')]({'raw':_0x4b0d30[_0x4e51('0x1d')]?_0x4b0d30[_0x4e51('0x1d')][_0x4e51('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b0d30[_0x4e51('0x1d')]?_0x4b0d30[_0x4e51('0x1d')]['where']||null:null,'attributes':_0x4b0d30['options']?_0x4b0d30[_0x4e51('0x1d')]['attributes']||null:null,'include':_0x4b0d30[_0x4e51('0x1d')]?_0x4b0d30[_0x4e51('0x1d')][_0x4e51('0x21')]?_[_0x4e51('0x22')](_0x4b0d30['options'][_0x4e51('0x21')],function(_0x5a26dc){return{'model':db[_0x5a26dc[_0x4e51('0x24')]],'as':_0x5a26dc['as'],'attributes':_0x5a26dc['attributes'],'include':_0x5a26dc[_0x4e51('0x21')]?_[_0x4e51('0x22')](_0x5a26dc[_0x4e51('0x21')],function(_0x2f8813){return{'model':db[_0x2f8813[_0x4e51('0x24')]],'as':_0x2f8813['as'],'attributes':_0x2f8813['attributes'],'include':_0x2f8813[_0x4e51('0x21')]?_[_0x4e51('0x22')](_0x2f8813[_0x4e51('0x21')],function(_0x16af45){return{'model':db[_0x16af45[_0x4e51('0x24')]],'as':_0x16af45['as'],'attributes':_0x16af45[_0x4e51('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4e51('0x12')](function(_0x2c41ae){logger[_0x4e51('0x2a')](_0x4e51('0x28'),_0x4b0d30);logger[_0x4e51('0x25')](_0x4e51('0x28'),_0x4b0d30,JSON['stringify'](_0x2c41ae));_0x270905(_0x2c41ae);})[_0x4e51('0x1a')](function(_0x12a332){logger[_0x4e51('0x15')](_0x4e51('0x28'),_0x12a332[_0x4e51('0x18')],_0x4b0d30);_0x34455f(_0x47eae4[_0x4e51('0x15')](0x1f4,_0x12a332['message']));});});}; \ No newline at end of file +var _0xd506=['result','catch','options','raw','attributes','limit','include','map','model','GetMailQueue','debug','ShowMailQueue','MailQueue','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x31ba0d,_0x2ce714){var _0x25f065=function(_0x23dece){while(--_0x23dece){_0x31ba0d['push'](_0x31ba0d['shift']());}};_0x25f065(++_0x2ce714);}(_0xd506,0xae));var _0x6d50=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xd506[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x6d50('0x0'));var util=require(_0x6d50('0x1'));var moment=require(_0x6d50('0x2'));var BPromise=require(_0x6d50('0x3'));var rs=require(_0x6d50('0x4'));var fs=require('fs');var Redis=require(_0x6d50('0x5'));var db=require(_0x6d50('0x6'))['db'];var utils=require(_0x6d50('0x7'));var logger=require('../../config/logger')(_0x6d50('0x8'));var config=require(_0x6d50('0x9'));var jayson=require(_0x6d50('0xa'));var client=jayson[_0x6d50('0xb')][_0x6d50('0xc')]({'port':0x232a});config[_0x6d50('0xd')]=_['defaults'](config[_0x6d50('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6d50('0xd')]));require(_0x6d50('0xe'))[_0x6d50('0xf')](socket);function respondWithRpcPromise(_0x2f813e,_0x478619,_0x54c071){return new BPromise(function(_0x5a6590,_0x52941c){return client[_0x6d50('0x10')](_0x2f813e,_0x54c071)[_0x6d50('0x11')](function(_0x24b50f){logger[_0x6d50('0x12')](_0x6d50('0x13'),_0x478619,_0x6d50('0x14'));logger['debug'](_0x6d50('0x15'),_0x478619,_0x6d50('0x14'),JSON[_0x6d50('0x16')](_0x24b50f));if(_0x24b50f[_0x6d50('0x17')]){if(_0x24b50f[_0x6d50('0x17')][_0x6d50('0x18')]===0x1f4){logger[_0x6d50('0x17')](_0x6d50('0x13'),_0x478619,_0x24b50f[_0x6d50('0x17')][_0x6d50('0x19')]);return _0x52941c(_0x24b50f[_0x6d50('0x17')][_0x6d50('0x19')]);}logger[_0x6d50('0x17')]('MailQueue,\x20%s,\x20%s',_0x478619,_0x24b50f[_0x6d50('0x17')]['message']);return _0x5a6590(_0x24b50f[_0x6d50('0x17')][_0x6d50('0x19')]);}else{logger[_0x6d50('0x12')](_0x6d50('0x13'),_0x478619,_0x6d50('0x14'));_0x5a6590(_0x24b50f[_0x6d50('0x1a')][_0x6d50('0x19')]);}})[_0x6d50('0x1b')](function(_0x18b601){logger[_0x6d50('0x17')](_0x6d50('0x13'),_0x478619,_0x18b601);_0x52941c(_0x18b601);});});}exports['GetMailQueue']=function(_0x5c351f){var _0x88a175=this;return new Promise(function(_0x329c88,_0x52dfdb){return db['MailQueue']['findAll']({'raw':_0x5c351f[_0x6d50('0x1c')]?_0x5c351f[_0x6d50('0x1c')][_0x6d50('0x1d')]===undefined?!![]:![]:!![],'where':_0x5c351f[_0x6d50('0x1c')]?_0x5c351f['options']['where']||null:null,'attributes':_0x5c351f[_0x6d50('0x1c')]?_0x5c351f[_0x6d50('0x1c')][_0x6d50('0x1e')]||null:null,'limit':_0x5c351f['options']?_0x5c351f[_0x6d50('0x1c')][_0x6d50('0x1f')]||null:null,'include':_0x5c351f[_0x6d50('0x1c')]?_0x5c351f[_0x6d50('0x1c')][_0x6d50('0x20')]?_[_0x6d50('0x21')](_0x5c351f[_0x6d50('0x1c')][_0x6d50('0x20')],function(_0x2fa839){return{'model':db[_0x2fa839[_0x6d50('0x22')]],'as':_0x2fa839['as'],'attributes':_0x2fa839['attributes'],'include':_0x2fa839['include']?_[_0x6d50('0x21')](_0x2fa839['include'],function(_0x59ffc8){return{'model':db[_0x59ffc8['model']],'as':_0x59ffc8['as'],'attributes':_0x59ffc8[_0x6d50('0x1e')],'include':_0x59ffc8[_0x6d50('0x20')]?_[_0x6d50('0x21')](_0x59ffc8[_0x6d50('0x20')],function(_0x3f0435){return{'model':db[_0x3f0435['model']],'as':_0x3f0435['as'],'attributes':_0x3f0435[_0x6d50('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6d50('0x11')](function(_0x689902){logger[_0x6d50('0x12')](_0x6d50('0x23'),_0x5c351f);logger[_0x6d50('0x24')](_0x6d50('0x23'),_0x5c351f,JSON[_0x6d50('0x16')](_0x689902));_0x329c88(_0x689902);})['catch'](function(_0x3f641a){logger['error']('GetMailQueue',_0x3f641a[_0x6d50('0x19')],_0x5c351f);_0x52dfdb(_0x88a175['error'](0x1f4,_0x3f641a['message']));});});};exports[_0x6d50('0x25')]=function(_0x1203f5){var _0x507bcb=this;return new Promise(function(_0x532f84,_0x2be344){return db[_0x6d50('0x26')]['find']({'raw':_0x1203f5[_0x6d50('0x1c')]?_0x1203f5['options'][_0x6d50('0x1d')]===undefined?!![]:![]:!![],'where':_0x1203f5[_0x6d50('0x1c')]?_0x1203f5['options'][_0x6d50('0x27')]||null:null,'attributes':_0x1203f5[_0x6d50('0x1c')]?_0x1203f5[_0x6d50('0x1c')][_0x6d50('0x1e')]||null:null,'include':_0x1203f5[_0x6d50('0x1c')]?_0x1203f5['options']['include']?_['map'](_0x1203f5['options'][_0x6d50('0x20')],function(_0x185e93){return{'model':db[_0x185e93[_0x6d50('0x22')]],'as':_0x185e93['as'],'attributes':_0x185e93['attributes'],'include':_0x185e93[_0x6d50('0x20')]?_[_0x6d50('0x21')](_0x185e93[_0x6d50('0x20')],function(_0x5113f0){return{'model':db[_0x5113f0[_0x6d50('0x22')]],'as':_0x5113f0['as'],'attributes':_0x5113f0[_0x6d50('0x1e')],'include':_0x5113f0['include']?_[_0x6d50('0x21')](_0x5113f0[_0x6d50('0x20')],function(_0x366c1e){return{'model':db[_0x366c1e['model']],'as':_0x366c1e['as'],'attributes':_0x366c1e[_0x6d50('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6d50('0x11')](function(_0x372737){logger[_0x6d50('0x12')](_0x6d50('0x25'),_0x1203f5);logger[_0x6d50('0x24')]('ShowMailQueue',_0x1203f5,JSON[_0x6d50('0x16')](_0x372737));_0x532f84(_0x372737);})[_0x6d50('0x1b')](function(_0x5bc37c){logger['error'](_0x6d50('0x25'),_0x5bc37c[_0x6d50('0x19')],_0x1203f5);_0x2be344(_0x507bcb[_0x6d50('0x17')](0x1f4,_0x5bc37c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index aa399b3..98c5713 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 _0x7f03=['save','remove','removeListener','length','./mailQueue.events'];(function(_0x6bff44,_0x3ec9a3){var _0x30cdfb=function(_0x3dc708){while(--_0x3dc708){_0x6bff44['push'](_0x6bff44['shift']());}};_0x30cdfb(++_0x3ec9a3);}(_0x7f03,0x162));var _0x37f0=function(_0x3abe51,_0xacf6f1){_0x3abe51=_0x3abe51-0x0;var _0x1d231b=_0x7f03[_0x3abe51];return _0x1d231b;};'use strict';var MailQueueEvents=require(_0x37f0('0x0'));var events=[_0x37f0('0x1'),_0x37f0('0x2'),'update'];function createListener(_0x400586,_0x490c58){return function(_0x44e0b9){_0x490c58['emit'](_0x400586,_0x44e0b9);};}function removeListener(_0x2a383a,_0x2a850e){return function(){MailQueueEvents[_0x37f0('0x3')](_0x2a383a,_0x2a850e);};}exports['register']=function(_0x4851ed){for(var _0x40fd48=0x0,_0xef3ca3=events[_0x37f0('0x4')];_0x40fd48<_0xef3ca3;_0x40fd48++){var _0x325112=events[_0x40fd48];var _0x700a71=createListener('mailQueue:'+_0x325112,_0x4851ed);MailQueueEvents['on'](_0x325112,_0x700a71);}}; \ No newline at end of file +var _0x5317=['register','mailQueue:','./mailQueue.events','update','emit'];(function(_0x272acd,_0x285e44){var _0x1d710f=function(_0x1e2cbc){while(--_0x1e2cbc){_0x272acd['push'](_0x272acd['shift']());}};_0x1d710f(++_0x285e44);}(_0x5317,0x1b5));var _0x7531=function(_0x3de5c1,_0x2e4b0c){_0x3de5c1=_0x3de5c1-0x0;var _0x53c2dc=_0x5317[_0x3de5c1];return _0x53c2dc;};'use strict';var MailQueueEvents=require(_0x7531('0x0'));var events=['save','remove',_0x7531('0x1')];function createListener(_0xcc7c55,_0x10bf36){return function(_0x21decf){_0x10bf36[_0x7531('0x2')](_0xcc7c55,_0x21decf);};}function removeListener(_0x3addd4,_0x4e5d8c){return function(){MailQueueEvents['removeListener'](_0x3addd4,_0x4e5d8c);};}exports[_0x7531('0x3')]=function(_0x34c297){for(var _0x2738b4=0x0,_0x52d973=events['length'];_0x2738b4<_0x52d973;_0x2738b4++){var _0xd209cd=events[_0x2738b4];var _0x55a217=createListener(_0x7531('0x4')+_0xd209cd,_0x34c297);MailQueueEvents['on'](_0xd209cd,_0x55a217);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index a9cbbff..2469572 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 _0xb756=['../../components/auth/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x510f3b,_0x2cd215){var _0x3d7ab2=function(_0x2ed6b1){while(--_0x2ed6b1){_0x510f3b['push'](_0x510f3b['shift']());}};_0x3d7ab2(++_0x2cd215);}(_0xb756,0x1ec));var _0x6b75=function(_0x260dc5,_0x1b9973){_0x260dc5=_0x260dc5-0x0;var _0x4f7186=_0xb756[_0x260dc5];return _0x4f7186;};'use strict';var multer=require(_0x6b75('0x0'));var util=require(_0x6b75('0x1'));var path=require('path');var timeout=require(_0x6b75('0x2'));var express=require('express');var router=express[_0x6b75('0x3')]();var auth=require(_0x6b75('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6b75('0x5'));var controller=require(_0x6b75('0x6'));router['get']('/',auth[_0x6b75('0x7')](),controller[_0x6b75('0x8')]);router[_0x6b75('0x9')](_0x6b75('0xa'),auth[_0x6b75('0x7')](),controller[_0x6b75('0xb')]);router[_0x6b75('0x9')](_0x6b75('0xc'),auth[_0x6b75('0x7')](),controller[_0x6b75('0xd')]);router['post']('/',auth[_0x6b75('0x7')](),controller['create']);router['put'](_0x6b75('0xc'),auth[_0x6b75('0x7')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6b75('0xe')]);module[_0x6b75('0xf')]=router; \ No newline at end of file +var _0xc7a8=['delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xc7a8,0x152));var _0x8c7a=function(_0x49d200,_0x1dd8aa){_0x49d200=_0x49d200-0x0;var _0x546f41=_0xc7a8[_0x49d200];return _0x546f41;};'use strict';var multer=require('multer');var util=require(_0x8c7a('0x0'));var path=require(_0x8c7a('0x1'));var timeout=require('connect-timeout');var express=require(_0x8c7a('0x2'));var router=express[_0x8c7a('0x3')]();var auth=require(_0x8c7a('0x4'));var interaction=require(_0x8c7a('0x5'));var config=require(_0x8c7a('0x6'));var controller=require(_0x8c7a('0x7'));router[_0x8c7a('0x8')]('/',auth['isAuthenticated'](),controller[_0x8c7a('0x9')]);router[_0x8c7a('0x8')](_0x8c7a('0xa'),auth[_0x8c7a('0xb')](),controller[_0x8c7a('0xc')]);router[_0x8c7a('0x8')](_0x8c7a('0xd'),auth['isAuthenticated'](),controller[_0x8c7a('0xe')]);router[_0x8c7a('0xf')]('/',auth[_0x8c7a('0xb')](),controller[_0x8c7a('0x10')]);router[_0x8c7a('0x11')](_0x8c7a('0xd'),auth[_0x8c7a('0xb')](),controller[_0x8c7a('0x12')]);router[_0x8c7a('0x13')](_0x8c7a('0xd'),auth[_0x8c7a('0xb')](),controller['destroy']);module[_0x8c7a('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 5a9235b..88f30f3 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 _0x9ef9=['sequelize','STRING','DATE'];(function(_0x54eb53,_0xad1649){var _0x5793b3=function(_0x5a0ead){while(--_0x5a0ead){_0x54eb53['push'](_0x54eb53['shift']());}};_0x5793b3(++_0xad1649);}(_0x9ef9,0x1da));var _0x99ef=function(_0xd8fb7d,_0x25c1b0){_0xd8fb7d=_0xd8fb7d-0x0;var _0x1f4557=_0x9ef9[_0xd8fb7d];return _0x1f4557;};'use strict';var moment=require('moment');var Sequelize=require(_0x99ef('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x99ef('0x1')]},'joinAt':{'type':Sequelize[_0x99ef('0x2')]},'leaveAt':{'type':Sequelize[_0x99ef('0x2')]},'acceptAt':{'type':Sequelize[_0x99ef('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x99ef('0x1')]}}; \ No newline at end of file +var _0x244a=['DATE','moment','sequelize','exports','STRING'];(function(_0x2b73c0,_0x27a837){var _0x31c930=function(_0x2c10ed){while(--_0x2c10ed){_0x2b73c0['push'](_0x2b73c0['shift']());}};_0x31c930(++_0x27a837);}(_0x244a,0x1a5));var _0xa244=function(_0x372339,_0x2bc55d){_0x372339=_0x372339-0x0;var _0x30c0f5=_0x244a[_0x372339];return _0x30c0f5;};'use strict';var moment=require(_0xa244('0x0'));var Sequelize=require(_0xa244('0x1'));module[_0xa244('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa244('0x3')]},'joinAt':{'type':Sequelize[_0xa244('0x4')]},'leaveAt':{'type':Sequelize[_0xa244('0x4')]},'acceptAt':{'type':Sequelize[_0xa244('0x4')]},'exitAt':{'type':Sequelize[_0xa244('0x4')]},'reason':{'type':Sequelize[_0xa244('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 7adb1c5..89a9f1f 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 _0xe526=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','map','MailQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','pick','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service'];(function(_0x487a0b,_0x33c302){var _0x4cb1ba=function(_0x2a3615){while(--_0x2a3615){_0x487a0b['push'](_0x487a0b['shift']());}};_0x4cb1ba(++_0x33c302);}(_0xe526,0x103));var _0x6e52=function(_0x499a83,_0x14823f){_0x499a83=_0x499a83-0x0;var _0xcd5797=_0xe526[_0x499a83];return _0xcd5797;};'use strict';var pdf=require(_0x6e52('0x0'));var emlformat=require(_0x6e52('0x1'));var rimraf=require(_0x6e52('0x2'));var zipdir=require(_0x6e52('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6e52('0x4'));var BPromise=require(_0x6e52('0x5'));var Mustache=require(_0x6e52('0x6'));var util=require(_0x6e52('0x7'));var path=require(_0x6e52('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6e52('0x9'));var fs=require('fs');var _=require(_0x6e52('0xa'));var squel=require(_0x6e52('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6e52('0xc'));var toCsv=require(_0x6e52('0xd'));var querystring=require(_0x6e52('0xe'));var Papa=require(_0x6e52('0xf'));var Redis=require('ioredis');var authService=require(_0x6e52('0x10'));var qs=require(_0x6e52('0x11'));var as=require(_0x6e52('0x12'));var hardwareService=require(_0x6e52('0x13'));var logger=require('../../config/logger')(_0x6e52('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56405a,_0x50bf85){_0x50bf85=_0x50bf85||0xcc;return function(_0x25d9a5){if(_0x25d9a5){return _0x56405a[_0x6e52('0x15')](_0x50bf85);}return _0x56405a[_0x6e52('0x16')](_0x50bf85)['end']();};}function respondWithResult(_0x1037c8,_0x466cda){_0x466cda=_0x466cda||0xc8;return function(_0x226331){if(_0x226331){return _0x1037c8[_0x6e52('0x16')](_0x466cda)[_0x6e52('0x17')](_0x226331);}};}function respondWithFilteredResult(_0x3deec3,_0x4cc4ed){return function(_0x3b26d3){if(_0x3b26d3){var _0xe31a00=_0x3b26d3[_0x6e52('0x18')],_0x325daa=_0x4cc4ed['offset'],_0x3cd299=_0x4cc4ed[_0x6e52('0x19')]+_0x4cc4ed[_0x6e52('0x1a')],_0x103dc4;if(_0x3cd299>=_0xe31a00){_0x3cd299=_0xe31a00;_0x103dc4=0xc8;}else{_0x103dc4=0xce;}_0x3deec3['status'](_0x103dc4);return _0x3deec3[_0x6e52('0x1b')](_0x6e52('0x1c'),_0x325daa+'-'+_0x3cd299+'/'+_0xe31a00)['json'](_0x3b26d3);}return null;};}function patchUpdates(_0x14f98f){return function(_0x38f7aa){try{jsonpatch[_0x6e52('0x1d')](_0x38f7aa,_0x14f98f,!![]);}catch(_0x30b819){return BPromise['reject'](_0x30b819);}return _0x38f7aa[_0x6e52('0x1e')]();};}function saveUpdates(_0x563864,_0x35efd6){return function(_0x3297fa){if(_0x3297fa){return _0x3297fa[_0x6e52('0x1f')](_0x563864)[_0x6e52('0x20')](function(_0x3ac54d){return _0x3ac54d;});}return null;};}function removeEntity(_0x4fd886,_0x3231f7){return function(_0xda17cc){if(_0xda17cc){return _0xda17cc[_0x6e52('0x21')]()[_0x6e52('0x20')](function(){_0x4fd886[_0x6e52('0x16')](0xcc)[_0x6e52('0x22')]();});}};}function handleEntityNotFound(_0x2e6236,_0x267363){return function(_0x37a5bd){if(!_0x37a5bd){_0x2e6236[_0x6e52('0x15')](0x194);}return _0x37a5bd;};}function handleError(_0x5d67e5,_0x11ab23){_0x11ab23=_0x11ab23||0x1f4;return function(_0x9ed94c){logger[_0x6e52('0x23')](_0x9ed94c[_0x6e52('0x24')]);if(_0x9ed94c[_0x6e52('0x25')]){delete _0x9ed94c[_0x6e52('0x25')];}_0x5d67e5[_0x6e52('0x16')](_0x11ab23)['send'](_0x9ed94c);};}exports[_0x6e52('0x26')]=function(_0x2ae4ee,_0x2f3ca4){var _0x16ccbc={},_0x215834={},_0x5ccc47={'count':0x0,'rows':[]};var _0x4f69fb=_[_0x6e52('0x27')](db[_0x6e52('0x28')]['rawAttributes'],function(_0x37d610){return{'name':_0x37d610[_0x6e52('0x29')],'type':_0x37d610[_0x6e52('0x2a')][_0x6e52('0x2b')]};});_0x215834[_0x6e52('0x2c')]=_[_0x6e52('0x27')](_0x4f69fb,_0x6e52('0x25'));_0x215834[_0x6e52('0x2d')]=_[_0x6e52('0x2e')](_0x2ae4ee['query']);_0x215834[_0x6e52('0x2f')]=_['intersection'](_0x215834[_0x6e52('0x2c')],_0x215834['query']);_0x16ccbc[_0x6e52('0x30')]=_[_0x6e52('0x31')](_0x215834['model'],qs[_0x6e52('0x32')](_0x2ae4ee[_0x6e52('0x2d')][_0x6e52('0x32')]));_0x16ccbc[_0x6e52('0x30')]=_0x16ccbc[_0x6e52('0x30')][_0x6e52('0x33')]?_0x16ccbc[_0x6e52('0x30')]:_0x215834['model'];if(!_0x2ae4ee[_0x6e52('0x2d')]['hasOwnProperty'](_0x6e52('0x34'))){_0x16ccbc[_0x6e52('0x1a')]=qs['limit'](_0x2ae4ee['query']['limit']);_0x16ccbc[_0x6e52('0x19')]=qs[_0x6e52('0x19')](_0x2ae4ee[_0x6e52('0x2d')][_0x6e52('0x19')]);}_0x16ccbc['order']=qs[_0x6e52('0x35')](_0x2ae4ee[_0x6e52('0x2d')][_0x6e52('0x35')]);_0x16ccbc['where']=qs[_0x6e52('0x2f')](_[_0x6e52('0x36')](_0x2ae4ee[_0x6e52('0x2d')],_0x215834['filters']),_0x4f69fb);if(_0x2ae4ee[_0x6e52('0x2d')]['filter']){_0x16ccbc[_0x6e52('0x37')]=_['merge'](_0x16ccbc[_0x6e52('0x37')],{'$or':_[_0x6e52('0x27')](_0x4f69fb,function(_0x17365c){if(_0x17365c[_0x6e52('0x2a')]!=='VIRTUAL'){var _0x5e2702={};_0x5e2702[_0x17365c[_0x6e52('0x25')]]={'$like':'%'+_0x2ae4ee['query'][_0x6e52('0x38')]+'%'};return _0x5e2702;}})});}_0x16ccbc=_[_0x6e52('0x39')]({},_0x16ccbc,_0x2ae4ee[_0x6e52('0x3a')]);var _0x38d740={'where':_0x16ccbc[_0x6e52('0x37')]};return db[_0x6e52('0x28')]['count'](_0x38d740)[_0x6e52('0x20')](function(_0x359a78){_0x5ccc47[_0x6e52('0x18')]=_0x359a78;if(_0x2ae4ee['query'][_0x6e52('0x3b')]){_0x16ccbc['include']=[{'all':!![]}];}return db[_0x6e52('0x28')][_0x6e52('0x3c')](_0x16ccbc);})[_0x6e52('0x20')](function(_0x35db07){_0x5ccc47[_0x6e52('0x3d')]=_0x35db07;return _0x5ccc47;})[_0x6e52('0x20')](respondWithFilteredResult(_0x2f3ca4,_0x16ccbc))[_0x6e52('0x3e')](handleError(_0x2f3ca4,null));};exports[_0x6e52('0x3f')]=function(_0x251a98,_0xa40ca9){var _0x3cc574={'raw':!![],'where':{'id':_0x251a98[_0x6e52('0x40')]['id']}},_0x43a7ef={};_0x43a7ef[_0x6e52('0x2c')]=_[_0x6e52('0x2e')](db['MailQueueReport'][_0x6e52('0x41')]);_0x43a7ef[_0x6e52('0x2d')]=_[_0x6e52('0x2e')](_0x251a98[_0x6e52('0x2d')]);_0x43a7ef['filters']=_['intersection'](_0x43a7ef['model'],_0x43a7ef[_0x6e52('0x2d')]);_0x3cc574['attributes']=_[_0x6e52('0x31')](_0x43a7ef['model'],qs[_0x6e52('0x32')](_0x251a98[_0x6e52('0x2d')]['fields']));_0x3cc574[_0x6e52('0x30')]=_0x3cc574[_0x6e52('0x30')][_0x6e52('0x33')]?_0x3cc574['attributes']:_0x43a7ef[_0x6e52('0x2c')];if(_0x251a98[_0x6e52('0x2d')][_0x6e52('0x3b')]){_0x3cc574['include']=[{'all':!![]}];}_0x3cc574=_['merge']({},_0x3cc574,_0x251a98[_0x6e52('0x3a')]);return db[_0x6e52('0x28')][_0x6e52('0x42')](_0x3cc574)['then'](handleEntityNotFound(_0xa40ca9,null))[_0x6e52('0x20')](respondWithResult(_0xa40ca9,null))[_0x6e52('0x3e')](handleError(_0xa40ca9,null));};exports[_0x6e52('0x43')]=function(_0x5adc16,_0x2fe67c){return db[_0x6e52('0x28')][_0x6e52('0x43')](_0x5adc16[_0x6e52('0x44')],{})[_0x6e52('0x20')](respondWithResult(_0x2fe67c,0xc9))['catch'](handleError(_0x2fe67c,null));};exports[_0x6e52('0x1f')]=function(_0x3f050c,_0x5e23d6){if(_0x3f050c[_0x6e52('0x44')]['id']){delete _0x3f050c['body']['id'];}return db[_0x6e52('0x28')][_0x6e52('0x42')]({'where':{'id':_0x3f050c[_0x6e52('0x40')]['id']}})[_0x6e52('0x20')](handleEntityNotFound(_0x5e23d6,null))[_0x6e52('0x20')](saveUpdates(_0x3f050c[_0x6e52('0x44')],null))[_0x6e52('0x20')](respondWithResult(_0x5e23d6,null))[_0x6e52('0x3e')](handleError(_0x5e23d6,null));};exports[_0x6e52('0x21')]=function(_0x2f9520,_0x27412a){return db[_0x6e52('0x28')][_0x6e52('0x42')]({'where':{'id':_0x2f9520[_0x6e52('0x40')]['id']}})[_0x6e52('0x20')](handleEntityNotFound(_0x27412a,null))[_0x6e52('0x20')](removeEntity(_0x27412a,null))[_0x6e52('0x3e')](handleError(_0x27412a,null));};exports['describe']=function(_0xf62b8d,_0x21fd9f){return db[_0x6e52('0x28')]['describe']()[_0x6e52('0x20')](respondWithResult(_0x21fd9f,null))[_0x6e52('0x3e')](handleError(_0x21fd9f,null));}; \ No newline at end of file +var _0x9dd4=['destroy','error','stack','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','MailQueueReport','includeAll','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then'];(function(_0x2cdf07,_0x1518d2){var _0x35bed5=function(_0x52a395){while(--_0x52a395){_0x2cdf07['push'](_0x2cdf07['shift']());}};_0x35bed5(++_0x1518d2);}(_0x9dd4,0x157));var _0x49dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dd4[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x49dd('0x0'));var emlformat=require(_0x49dd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x49dd('0x2'));var jsonpatch=require(_0x49dd('0x3'));var rp=require(_0x49dd('0x4'));var moment=require(_0x49dd('0x5'));var BPromise=require(_0x49dd('0x6'));var Mustache=require(_0x49dd('0x7'));var util=require(_0x49dd('0x8'));var path=require('path');var sox=require(_0x49dd('0x9'));var csv=require(_0x49dd('0xa'));var ejs=require(_0x49dd('0xb'));var fs=require('fs');var _=require(_0x49dd('0xc'));var squel=require('squel');var crypto=require(_0x49dd('0xd'));var jsforce=require(_0x49dd('0xe'));var deskjs=require(_0x49dd('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x49dd('0x10'));var Redis=require(_0x49dd('0x11'));var authService=require(_0x49dd('0x12'));var qs=require(_0x49dd('0x13'));var as=require(_0x49dd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49dd('0x15'))(_0x49dd('0x16'));var utils=require(_0x49dd('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2926f8,_0x2def91){_0x2def91=_0x2def91||0xcc;return function(_0x162327){if(_0x162327){return _0x2926f8[_0x49dd('0x18')](_0x2def91);}return _0x2926f8[_0x49dd('0x19')](_0x2def91)[_0x49dd('0x1a')]();};}function respondWithResult(_0x57950c,_0x51bef5){_0x51bef5=_0x51bef5||0xc8;return function(_0x48c975){if(_0x48c975){return _0x57950c[_0x49dd('0x19')](_0x51bef5)[_0x49dd('0x1b')](_0x48c975);}};}function respondWithFilteredResult(_0x103294,_0x1d18a2){return function(_0x5bd771){if(_0x5bd771){var _0x52fe3c=_0x5bd771[_0x49dd('0x1c')],_0x39d5eb=_0x1d18a2[_0x49dd('0x1d')],_0x5672c0=_0x1d18a2[_0x49dd('0x1d')]+_0x1d18a2['limit'],_0x1b5e37;if(_0x5672c0>=_0x52fe3c){_0x5672c0=_0x52fe3c;_0x1b5e37=0xc8;}else{_0x1b5e37=0xce;}_0x103294['status'](_0x1b5e37);return _0x103294[_0x49dd('0x1e')](_0x49dd('0x1f'),_0x39d5eb+'-'+_0x5672c0+'/'+_0x52fe3c)[_0x49dd('0x1b')](_0x5bd771);}return null;};}function patchUpdates(_0x2329a2){return function(_0x2c9b4d){try{jsonpatch[_0x49dd('0x20')](_0x2c9b4d,_0x2329a2,!![]);}catch(_0xcc063e){return BPromise[_0x49dd('0x21')](_0xcc063e);}return _0x2c9b4d[_0x49dd('0x22')]();};}function saveUpdates(_0x954ef4,_0x5bfa8a){return function(_0x3f8706){if(_0x3f8706){return _0x3f8706[_0x49dd('0x23')](_0x954ef4)[_0x49dd('0x24')](function(_0x481018){return _0x481018;});}return null;};}function removeEntity(_0x4ec591,_0x41ae97){return function(_0x3c9dd8){if(_0x3c9dd8){return _0x3c9dd8[_0x49dd('0x25')]()['then'](function(){_0x4ec591[_0x49dd('0x19')](0xcc)[_0x49dd('0x1a')]();});}};}function handleEntityNotFound(_0x377bbb,_0xf7a8f7){return function(_0x3cae90){if(!_0x3cae90){_0x377bbb[_0x49dd('0x18')](0x194);}return _0x3cae90;};}function handleError(_0x101465,_0x3b414a){_0x3b414a=_0x3b414a||0x1f4;return function(_0x55101e){logger[_0x49dd('0x26')](_0x55101e[_0x49dd('0x27')]);if(_0x55101e[_0x49dd('0x28')]){delete _0x55101e['name'];}_0x101465['status'](_0x3b414a)['send'](_0x55101e);};}exports[_0x49dd('0x29')]=function(_0x3f11b7,_0x1691fc){var _0x1722fe={},_0x4606c8={},_0x461880={'count':0x0,'rows':[]};var _0x532e96=_[_0x49dd('0x2a')](db['MailQueueReport'][_0x49dd('0x2b')],function(_0x27c686){return{'name':_0x27c686[_0x49dd('0x2c')],'type':_0x27c686['type']['key']};});_0x4606c8[_0x49dd('0x2d')]=_[_0x49dd('0x2a')](_0x532e96,'name');_0x4606c8[_0x49dd('0x2e')]=_[_0x49dd('0x2f')](_0x3f11b7[_0x49dd('0x2e')]);_0x4606c8[_0x49dd('0x30')]=_[_0x49dd('0x31')](_0x4606c8[_0x49dd('0x2d')],_0x4606c8[_0x49dd('0x2e')]);_0x1722fe['attributes']=_[_0x49dd('0x31')](_0x4606c8['model'],qs['fields'](_0x3f11b7[_0x49dd('0x2e')][_0x49dd('0x32')]));_0x1722fe[_0x49dd('0x33')]=_0x1722fe[_0x49dd('0x33')][_0x49dd('0x34')]?_0x1722fe[_0x49dd('0x33')]:_0x4606c8[_0x49dd('0x2d')];if(!_0x3f11b7['query'][_0x49dd('0x35')](_0x49dd('0x36'))){_0x1722fe['limit']=qs[_0x49dd('0x37')](_0x3f11b7[_0x49dd('0x2e')]['limit']);_0x1722fe[_0x49dd('0x1d')]=qs[_0x49dd('0x1d')](_0x3f11b7[_0x49dd('0x2e')]['offset']);}_0x1722fe[_0x49dd('0x38')]=qs[_0x49dd('0x39')](_0x3f11b7[_0x49dd('0x2e')]['sort']);_0x1722fe[_0x49dd('0x3a')]=qs['filters'](_[_0x49dd('0x3b')](_0x3f11b7[_0x49dd('0x2e')],_0x4606c8[_0x49dd('0x30')]),_0x532e96);if(_0x3f11b7[_0x49dd('0x2e')][_0x49dd('0x3c')]){_0x1722fe[_0x49dd('0x3a')]=_[_0x49dd('0x3d')](_0x1722fe[_0x49dd('0x3a')],{'$or':_[_0x49dd('0x2a')](_0x532e96,function(_0x492f14){if(_0x492f14[_0x49dd('0x3e')]!==_0x49dd('0x3f')){var _0xe83595={};_0xe83595[_0x492f14[_0x49dd('0x28')]]={'$like':'%'+_0x3f11b7[_0x49dd('0x2e')][_0x49dd('0x3c')]+'%'};return _0xe83595;}})});}_0x1722fe=_[_0x49dd('0x3d')]({},_0x1722fe,_0x3f11b7[_0x49dd('0x40')]);var _0x58b765={'where':_0x1722fe[_0x49dd('0x3a')]};return db[_0x49dd('0x41')][_0x49dd('0x1c')](_0x58b765)[_0x49dd('0x24')](function(_0x2fba48){_0x461880['count']=_0x2fba48;if(_0x3f11b7[_0x49dd('0x2e')][_0x49dd('0x42')]){_0x1722fe['include']=[{'all':!![]}];}return db[_0x49dd('0x41')][_0x49dd('0x43')](_0x1722fe);})['then'](function(_0x54804e){_0x461880[_0x49dd('0x44')]=_0x54804e;return _0x461880;})[_0x49dd('0x24')](respondWithFilteredResult(_0x1691fc,_0x1722fe))[_0x49dd('0x45')](handleError(_0x1691fc,null));};exports[_0x49dd('0x46')]=function(_0x2bcce5,_0x302790){var _0x4c7444={'raw':!![],'where':{'id':_0x2bcce5['params']['id']}},_0x3be165={};_0x3be165['model']=_[_0x49dd('0x2f')](db[_0x49dd('0x41')][_0x49dd('0x2b')]);_0x3be165[_0x49dd('0x2e')]=_[_0x49dd('0x2f')](_0x2bcce5[_0x49dd('0x2e')]);_0x3be165[_0x49dd('0x30')]=_[_0x49dd('0x31')](_0x3be165[_0x49dd('0x2d')],_0x3be165['query']);_0x4c7444[_0x49dd('0x33')]=_[_0x49dd('0x31')](_0x3be165['model'],qs[_0x49dd('0x32')](_0x2bcce5[_0x49dd('0x2e')][_0x49dd('0x32')]));_0x4c7444[_0x49dd('0x33')]=_0x4c7444[_0x49dd('0x33')]['length']?_0x4c7444[_0x49dd('0x33')]:_0x3be165[_0x49dd('0x2d')];if(_0x2bcce5[_0x49dd('0x2e')][_0x49dd('0x42')]){_0x4c7444['include']=[{'all':!![]}];}_0x4c7444=_[_0x49dd('0x3d')]({},_0x4c7444,_0x2bcce5[_0x49dd('0x40')]);return db['MailQueueReport'][_0x49dd('0x47')](_0x4c7444)[_0x49dd('0x24')](handleEntityNotFound(_0x302790,null))[_0x49dd('0x24')](respondWithResult(_0x302790,null))[_0x49dd('0x45')](handleError(_0x302790,null));};exports[_0x49dd('0x48')]=function(_0x232179,_0x43a66e){return db[_0x49dd('0x41')][_0x49dd('0x48')](_0x232179[_0x49dd('0x49')],{})['then'](respondWithResult(_0x43a66e,0xc9))['catch'](handleError(_0x43a66e,null));};exports[_0x49dd('0x23')]=function(_0x73b904,_0x5f126b){if(_0x73b904[_0x49dd('0x49')]['id']){delete _0x73b904[_0x49dd('0x49')]['id'];}return db[_0x49dd('0x41')][_0x49dd('0x47')]({'where':{'id':_0x73b904[_0x49dd('0x4a')]['id']}})[_0x49dd('0x24')](handleEntityNotFound(_0x5f126b,null))[_0x49dd('0x24')](saveUpdates(_0x73b904[_0x49dd('0x49')],null))[_0x49dd('0x24')](respondWithResult(_0x5f126b,null))[_0x49dd('0x45')](handleError(_0x5f126b,null));};exports[_0x49dd('0x25')]=function(_0x3cfe29,_0x4ce50a){return db[_0x49dd('0x41')][_0x49dd('0x47')]({'where':{'id':_0x3cfe29[_0x49dd('0x4a')]['id']}})[_0x49dd('0x24')](handleEntityNotFound(_0x4ce50a,null))['then'](removeEntity(_0x4ce50a,null))[_0x49dd('0x45')](handleError(_0x4ce50a,null));};exports['describe']=function(_0x5b3847,_0x5c18bc){return db['MailQueueReport'][_0x49dd('0x4b')]()[_0x49dd('0x24')](respondWithResult(_0x5c18bc,null))[_0x49dd('0x45')](handleError(_0x5c18bc,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index c71ae9f..fb5296b 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 _0x1aab=['define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x3429f7,_0x4d0c14){var _0x1e3861=function(_0x2c0da7){while(--_0x2c0da7){_0x3429f7['push'](_0x3429f7['shift']());}};_0x1e3861(++_0x4d0c14);}(_0x1aab,0x122));var _0xb1aa=function(_0x27b758,_0x521c93){_0x27b758=_0x27b758-0x0;var _0x5ed825=_0x1aab[_0x27b758];return _0x5ed825;};'use strict';var _=require(_0xb1aa('0x0'));var util=require(_0xb1aa('0x1'));var logger=require(_0xb1aa('0x2'))('api');var moment=require(_0xb1aa('0x3'));var BPromise=require('bluebird');var rp=require(_0xb1aa('0x4'));var fs=require('fs');var path=require(_0xb1aa('0x5'));var rimraf=require(_0xb1aa('0x6'));var config=require(_0xb1aa('0x7'));var attributes=require(_0xb1aa('0x8'));module['exports']=function(_0x5eb27f,_0x34e0f4){return _0x5eb27f[_0xb1aa('0x9')](_0xb1aa('0xa'),attributes,{'tableName':_0xb1aa('0xb'),'paranoid':![],'indexes':[{'name':_0xb1aa('0xc'),'fields':[_0xb1aa('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xae24=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4dd0a7,_0xb4399f){var _0x487e9b=function(_0x355738){while(--_0x355738){_0x4dd0a7['push'](_0x4dd0a7['shift']());}};_0x487e9b(++_0xb4399f);}(_0xae24,0x180));var _0x4ae2=function(_0x2d4126,_0x31905d){_0x2d4126=_0x2d4126-0x0;var _0x3a21b7=_0xae24[_0x2d4126];return _0x3a21b7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ae2('0x0'))(_0x4ae2('0x1'));var moment=require(_0x4ae2('0x2'));var BPromise=require(_0x4ae2('0x3'));var rp=require(_0x4ae2('0x4'));var fs=require('fs');var path=require(_0x4ae2('0x5'));var rimraf=require(_0x4ae2('0x6'));var config=require(_0x4ae2('0x7'));var attributes=require(_0x4ae2('0x8'));module[_0x4ae2('0x9')]=function(_0x526b01,_0x497634){return _0x526b01[_0x4ae2('0xa')](_0x4ae2('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4ae2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index b5870f9..295b064 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 _0x1967=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','update','where','attributes','debug','UpdateMailQueueReport','util','moment','bluebird'];(function(_0x4eafc3,_0x19f230){var _0xe9b902=function(_0xd6e811){while(--_0xd6e811){_0x4eafc3['push'](_0x4eafc3['shift']());}};_0xe9b902(++_0x19f230);}(_0x1967,0x173));var _0x7196=function(_0x54e04a,_0x165009){_0x54e04a=_0x54e04a-0x0;var _0xfe6d65=_0x1967[_0x54e04a];return _0xfe6d65;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});}exports[_0x7196('0x18')]=function(_0x32fe2b){var _0x385f2d=this;return new Promise(function(_0x5b716a,_0x4c4f91){return db[_0x7196('0x19')][_0x7196('0x1a')](_0x32fe2b[_0x7196('0x1b')],{'raw':_0x32fe2b['options']?_0x32fe2b[_0x7196('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x296e07){logger[_0x7196('0xe')](_0x7196('0x18'),_0x32fe2b);logger['debug']('CreateMailQueueReport',_0x32fe2b,JSON[_0x7196('0x12')](_0x296e07));_0x5b716a(_0x296e07);})[_0x7196('0x17')](function(_0x598a26){logger[_0x7196('0x13')](_0x7196('0x18'),_0x598a26[_0x7196('0x15')],_0x32fe2b);_0x4c4f91(_0x385f2d[_0x7196('0x13')](0x1f4,_0x598a26[_0x7196('0x15')]));});});};exports['UpdateMailQueueReport']=function(_0x3f8178){var _0x520d01=this;return new Promise(function(_0x3ce9a0,_0x1b1f4b){return db[_0x7196('0x19')][_0x7196('0x1d')](_0x3f8178[_0x7196('0x1b')],{'raw':_0x3f8178[_0x7196('0x1c')]?_0x3f8178['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f8178[_0x7196('0x1c')]?_0x3f8178[_0x7196('0x1c')][_0x7196('0x1e')]||null:null,'attributes':_0x3f8178['options']?_0x3f8178['options'][_0x7196('0x1f')]||null:null,'limit':_0x3f8178[_0x7196('0x1c')]?_0x3f8178[_0x7196('0x1c')]['limit']||null:null})[_0x7196('0xd')](function(_0x4ecea1){logger[_0x7196('0xe')]('UpdateMailQueueReport',_0x3f8178);logger[_0x7196('0x20')](_0x7196('0x21'),_0x3f8178,JSON[_0x7196('0x12')](_0x4ecea1));_0x3ce9a0(_0x4ecea1);})['catch'](function(_0x35116f){logger[_0x7196('0x13')](_0x7196('0x21'),_0x35116f[_0x7196('0x15')],_0x3f8178);_0x1b1f4b(_0x520d01['error'](0x1f4,_0x35116f[_0x7196('0x15')]));});});}; \ No newline at end of file +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(_0x3871d7,_0x3cfcc5){var _0x28ec09=function(_0x2bb918){while(--_0x2bb918){_0x3871d7['push'](_0x3871d7['shift']());}};_0x28ec09(++_0x3cfcc5);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x64d333,_0xa8f765){_0x64d333=_0x64d333-0x0;var _0x2a8723=_0xc1c6[_0x64d333];return _0x2a8723;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index c601d63..9e166a7 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 _0x652e=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x5a0d84,_0x47eb35){var _0xbf54e=function(_0x5dcd70){while(--_0x5dcd70){_0x5a0d84['push'](_0x5a0d84['shift']());}};_0xbf54e(++_0x47eb35);}(_0x652e,0x1af));var _0xe652=function(_0x265e3b,_0x37cb8d){_0x265e3b=_0x265e3b-0x0;var _0x3a3b32=_0x652e[_0x265e3b];return _0x3a3b32;};'use strict';var multer=require(_0xe652('0x0'));var util=require('util');var path=require(_0xe652('0x1'));var timeout=require(_0xe652('0x2'));var express=require(_0xe652('0x3'));var router=express[_0xe652('0x4')]();var auth=require(_0xe652('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe652('0x6'));module[_0xe652('0x7')]=router; \ No newline at end of file +var _0x032f=['../../components/interaction/service','exports','util','path','connect-timeout','../../components/auth/service'];(function(_0x375b0d,_0x271196){var _0x3cc238=function(_0x5780fa){while(--_0x5780fa){_0x375b0d['push'](_0x375b0d['shift']());}};_0x3cc238(++_0x271196);}(_0x032f,0xce));var _0xf032=function(_0x5762d1,_0x4b6f51){_0x5762d1=_0x5762d1-0x0;var _0x2576c7=_0x032f[_0x5762d1];return _0x2576c7;};'use strict';var multer=require('multer');var util=require(_0xf032('0x0'));var path=require(_0xf032('0x1'));var timeout=require(_0xf032('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf032('0x3'));var interaction=require(_0xf032('0x4'));var config=require('../../config/environment');module[_0xf032('0x5')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 7e1825f..896f151 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 _0xd146=['INBOX','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x4b3bd5,_0x47d005){var _0x5f186a=function(_0x5610f2){while(--_0x5610f2){_0x4b3bd5['push'](_0x4b3bd5['shift']());}};_0x5f186a(++_0x47d005);}(_0xd146,0x7f));var _0x6d14=function(_0x171b45,_0x5ec662){_0x171b45=_0x171b45-0x0;var _0x470742=_0xd146[_0x171b45];return _0x470742;};'use strict';var Sequelize=require(_0x6d14('0x0'));module[_0x6d14('0x1')]={'description':{'type':Sequelize[_0x6d14('0x2')]},'host':{'type':Sequelize[_0x6d14('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x6d14('0x2')]},'port':{'type':Sequelize[_0x6d14('0x3')]},'tls':{'type':Sequelize[_0x6d14('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x6d14('0x2')],'defaultValue':_0x6d14('0x5')},'connTimeout':{'type':Sequelize[_0x6d14('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x6d14('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x6d14('0x2')]}}; \ No newline at end of file +var _0x1f30=['sequelize','exports','STRING','BOOLEAN','username','INTEGER','INBOX'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1f30,0x1b2));var _0x01f3=function(_0xb92869,_0x4fcf90){_0xb92869=_0xb92869-0x0;var _0x2e955d=_0x1f30[_0xb92869];return _0x2e955d;};'use strict';var Sequelize=require(_0x01f3('0x0'));module[_0x01f3('0x1')]={'description':{'type':Sequelize[_0x01f3('0x2')]},'host':{'type':Sequelize[_0x01f3('0x2')]},'authentication':{'type':Sequelize[_0x01f3('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x01f3('0x2')],'unique':_0x01f3('0x4')},'password':{'type':Sequelize[_0x01f3('0x2')]},'port':{'type':Sequelize[_0x01f3('0x5')]},'tls':{'type':Sequelize[_0x01f3('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x01f3('0x2')],'defaultValue':_0x01f3('0x6')},'connTimeout':{'type':Sequelize[_0x01f3('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x01f3('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 4c234ca..5e9e853 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 _0x872a=['exports','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x872a,0x100));var _0xa872=function(_0x4880ac,_0x5ee397){_0x4880ac=_0x4880ac-0x0;var _0x4872b6=_0x872a[_0x4880ac];return _0x4872b6;};'use strict';var _=require(_0xa872('0x0'));var util=require(_0xa872('0x1'));var logger=require(_0xa872('0x2'))(_0xa872('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa872('0x4'));var rimraf=require(_0xa872('0x5'));var config=require(_0xa872('0x6'));var attributes=require(_0xa872('0x7'));module[_0xa872('0x8')]=function(_0x1c8d2f,_0x3e3cd4){return _0x1c8d2f['define'](_0xa872('0x9'),attributes,{'tableName':_0xa872('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc319=['MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','define'];(function(_0x1ff8d6,_0x2a39cf){var _0x221346=function(_0x5c46e8){while(--_0x5c46e8){_0x1ff8d6['push'](_0x1ff8d6['shift']());}};_0x221346(++_0x2a39cf);}(_0xc319,0x12e));var _0x9c31=function(_0x57f5e6,_0x5e84bc){_0x57f5e6=_0x57f5e6-0x0;var _0x326ca9=_0xc319[_0x57f5e6];return _0x326ca9;};'use strict';var _=require(_0x9c31('0x0'));var util=require(_0x9c31('0x1'));var logger=require(_0x9c31('0x2'))('api');var moment=require(_0x9c31('0x3'));var BPromise=require(_0x9c31('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c31('0x5'));var rimraf=require(_0x9c31('0x6'));var config=require(_0x9c31('0x7'));var attributes=require(_0x9c31('0x8'));module['exports']=function(_0x401c82,_0x109244){return _0x401c82[_0x9c31('0x9')](_0x9c31('0xa'),attributes,{'tableName':_0x9c31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index d8c3daf..80a709a 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 _0xa09a=['options','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa09a,0x1e6));var _0xaa09=function(_0x55a7dd,_0x45f2bc){_0x55a7dd=_0x55a7dd-0x0;var _0x3f7df7=_0xa09a[_0x55a7dd];return _0x3f7df7;};'use strict';var _=require(_0xaa09('0x0'));var util=require('util');var moment=require(_0xaa09('0x1'));var BPromise=require(_0xaa09('0x2'));var rs=require(_0xaa09('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaa09('0x4'));var logger=require(_0xaa09('0x5'))(_0xaa09('0x6'));var config=require(_0xaa09('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xaa09('0x8')][_0xaa09('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35116f,_0x1b5c9b,_0x201fa9){return new BPromise(function(_0x3453fb,_0x50fd8b){return client[_0xaa09('0xa')](_0x35116f,_0x201fa9)[_0xaa09('0xb')](function(_0xa3f748){logger[_0xaa09('0xc')](_0xaa09('0xd'),_0x1b5c9b,_0xaa09('0xe'));logger[_0xaa09('0xf')](_0xaa09('0x10'),_0x1b5c9b,_0xaa09('0xe'),JSON[_0xaa09('0x11')](_0xa3f748));if(_0xa3f748[_0xaa09('0x12')]){if(_0xa3f748[_0xaa09('0x12')][_0xaa09('0x13')]===0x1f4){logger[_0xaa09('0x12')](_0xaa09('0xd'),_0x1b5c9b,_0xa3f748[_0xaa09('0x12')][_0xaa09('0x14')]);return _0x50fd8b(_0xa3f748[_0xaa09('0x12')][_0xaa09('0x14')]);}logger[_0xaa09('0x12')](_0xaa09('0xd'),_0x1b5c9b,_0xa3f748[_0xaa09('0x12')][_0xaa09('0x14')]);return _0x3453fb(_0xa3f748[_0xaa09('0x12')][_0xaa09('0x14')]);}else{logger[_0xaa09('0xc')](_0xaa09('0xd'),_0x1b5c9b,_0xaa09('0xe'));_0x3453fb(_0xa3f748[_0xaa09('0x15')][_0xaa09('0x14')]);}})[_0xaa09('0x16')](function(_0x451c83){logger['error'](_0xaa09('0xd'),_0x1b5c9b,_0x451c83);_0x50fd8b(_0x451c83);});});}exports[_0xaa09('0x17')]=function(_0x52a3a9){var _0x2cb2b9=this;return new Promise(function(_0x190142,_0x4a0d16){return db[_0xaa09('0x18')][_0xaa09('0x19')]({'raw':_0x52a3a9[_0xaa09('0x1a')]?_0x52a3a9[_0xaa09('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x52a3a9[_0xaa09('0x1a')]?_0x52a3a9['options'][_0xaa09('0x1b')]||null:null,'attributes':_0x52a3a9[_0xaa09('0x1a')]?_0x52a3a9['options'][_0xaa09('0x1c')]||null:null,'limit':_0x52a3a9['options']?_0x52a3a9['options']['limit']||null:null,'include':_0x52a3a9[_0xaa09('0x1a')]?_0x52a3a9[_0xaa09('0x1a')][_0xaa09('0x1d')]?_[_0xaa09('0x1e')](_0x52a3a9['options']['include'],function(_0x272ace){return{'model':db[_0x272ace[_0xaa09('0x1f')]],'as':_0x272ace['as'],'attributes':_0x272ace[_0xaa09('0x1c')],'include':_0x272ace[_0xaa09('0x1d')]?_[_0xaa09('0x1e')](_0x272ace[_0xaa09('0x1d')],function(_0x26d910){return{'model':db[_0x26d910[_0xaa09('0x1f')]],'as':_0x26d910['as'],'attributes':_0x26d910[_0xaa09('0x1c')],'include':_0x26d910[_0xaa09('0x1d')]?_['map'](_0x26d910[_0xaa09('0x1d')],function(_0x24bf88){return{'model':db[_0x24bf88[_0xaa09('0x1f')]],'as':_0x24bf88['as'],'attributes':_0x24bf88[_0xaa09('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaa09('0xb')](function(_0x5bc2d4){logger[_0xaa09('0xc')](_0xaa09('0x17'),_0x52a3a9);logger[_0xaa09('0xf')](_0xaa09('0x17'),_0x52a3a9,JSON[_0xaa09('0x11')](_0x5bc2d4));_0x190142(_0x5bc2d4);})[_0xaa09('0x16')](function(_0x15fd7d){logger['error'](_0xaa09('0x17'),_0x15fd7d[_0xaa09('0x14')],_0x52a3a9);_0x4a0d16(_0x2cb2b9[_0xaa09('0x12')](0x1f4,_0x15fd7d[_0xaa09('0x14')]));});});}; \ No newline at end of file +var _0x8667=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','include','map','model','randomstring','ioredis','../../mysqldb'];(function(_0x42057a,_0x4c59bb){var _0x334b7e=function(_0x4b046c){while(--_0x4b046c){_0x42057a['push'](_0x42057a['shift']());}};_0x334b7e(++_0x4c59bb);}(_0x8667,0x1cd));var _0x7866=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7866('0x0'));var fs=require('fs');var Redis=require(_0x7866('0x1'));var db=require(_0x7866('0x2'))['db'];var utils=require(_0x7866('0x3'));var logger=require(_0x7866('0x4'))('rpc');var config=require(_0x7866('0x5'));var jayson=require(_0x7866('0x6'));var client=jayson['client'][_0x7866('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x703faa,_0x52960d,_0x3d5985){return new BPromise(function(_0x1fb084,_0x3f6cb1){return client['request'](_0x703faa,_0x3d5985)['then'](function(_0xf1dff7){logger[_0x7866('0x8')]('MailServerIn,\x20%s,\x20%s',_0x52960d,_0x7866('0x9'));logger[_0x7866('0xa')](_0x7866('0xb'),_0x52960d,_0x7866('0x9'),JSON[_0x7866('0xc')](_0xf1dff7));if(_0xf1dff7[_0x7866('0xd')]){if(_0xf1dff7[_0x7866('0xd')][_0x7866('0xe')]===0x1f4){logger[_0x7866('0xd')](_0x7866('0xf'),_0x52960d,_0xf1dff7[_0x7866('0xd')]['message']);return _0x3f6cb1(_0xf1dff7[_0x7866('0xd')][_0x7866('0x10')]);}logger[_0x7866('0xd')]('MailServerIn,\x20%s,\x20%s',_0x52960d,_0xf1dff7[_0x7866('0xd')][_0x7866('0x10')]);return _0x1fb084(_0xf1dff7[_0x7866('0xd')][_0x7866('0x10')]);}else{logger[_0x7866('0x8')](_0x7866('0xf'),_0x52960d,_0x7866('0x9'));_0x1fb084(_0xf1dff7[_0x7866('0x11')]['message']);}})[_0x7866('0x12')](function(_0x1677c5){logger['error'](_0x7866('0xf'),_0x52960d,_0x1677c5);_0x3f6cb1(_0x1677c5);});});}exports[_0x7866('0x13')]=function(_0x598710){var _0x892e11=this;return new Promise(function(_0x159fc3,_0x183f60){return db[_0x7866('0x14')]['findAll']({'raw':_0x598710[_0x7866('0x15')]?_0x598710[_0x7866('0x15')][_0x7866('0x16')]===undefined?!![]:![]:!![],'where':_0x598710['options']?_0x598710['options'][_0x7866('0x17')]||null:null,'attributes':_0x598710[_0x7866('0x15')]?_0x598710[_0x7866('0x15')][_0x7866('0x18')]||null:null,'limit':_0x598710[_0x7866('0x15')]?_0x598710[_0x7866('0x15')][_0x7866('0x19')]||null:null,'include':_0x598710[_0x7866('0x15')]?_0x598710[_0x7866('0x15')][_0x7866('0x1a')]?_[_0x7866('0x1b')](_0x598710['options'][_0x7866('0x1a')],function(_0x522477){return{'model':db[_0x522477['model']],'as':_0x522477['as'],'attributes':_0x522477[_0x7866('0x18')],'include':_0x522477[_0x7866('0x1a')]?_['map'](_0x522477[_0x7866('0x1a')],function(_0x523ff0){return{'model':db[_0x523ff0[_0x7866('0x1c')]],'as':_0x523ff0['as'],'attributes':_0x523ff0[_0x7866('0x18')],'include':_0x523ff0[_0x7866('0x1a')]?_[_0x7866('0x1b')](_0x523ff0[_0x7866('0x1a')],function(_0x423a94){return{'model':db[_0x423a94[_0x7866('0x1c')]],'as':_0x423a94['as'],'attributes':_0x423a94[_0x7866('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21482d){logger[_0x7866('0x8')](_0x7866('0x13'),_0x598710);logger[_0x7866('0xa')](_0x7866('0x13'),_0x598710,JSON[_0x7866('0xc')](_0x21482d));_0x159fc3(_0x21482d);})[_0x7866('0x12')](function(_0x461e94){logger['error'](_0x7866('0x13'),_0x461e94[_0x7866('0x10')],_0x598710);_0x183f60(_0x892e11[_0x7866('0xd')](0x1f4,_0x461e94[_0x7866('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 15b9116..e1a2b89 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 _0xd647=['isAuthenticated','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id'];(function(_0x2f7250,_0x388f17){var _0x57af61=function(_0x528f1a){while(--_0x528f1a){_0x2f7250['push'](_0x2f7250['shift']());}};_0x57af61(++_0x388f17);}(_0xd647,0x8c));var _0x7d64=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0xd647[_0x5311e8];return _0x582ad8;};'use strict';var multer=require(_0x7d64('0x0'));var util=require(_0x7d64('0x1'));var path=require(_0x7d64('0x2'));var timeout=require(_0x7d64('0x3'));var express=require(_0x7d64('0x4'));var router=express[_0x7d64('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7d64('0x6'));var config=require(_0x7d64('0x7'));var controller=require(_0x7d64('0x8'));router[_0x7d64('0x9')]('/',auth['isAuthenticated'](),controller[_0x7d64('0xa')]);router[_0x7d64('0x9')](_0x7d64('0xb'),auth[_0x7d64('0xc')](),controller[_0x7d64('0xd')]);router[_0x7d64('0xe')]('/',auth[_0x7d64('0xc')](),controller[_0x7d64('0xf')]);router[_0x7d64('0x10')]('/:id',auth[_0x7d64('0xc')](),controller[_0x7d64('0x11')]);router['delete'](_0x7d64('0xb'),auth[_0x7d64('0xc')](),controller[_0x7d64('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf426=['multer','util','path','connect-timeout','express','Router','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf426,0x1a4));var _0x6f42=function(_0x315aea,_0x318a80){_0x315aea=_0x315aea-0x0;var _0x4a4bdb=_0xf426[_0x315aea];return _0x4a4bdb;};'use strict';var multer=require(_0x6f42('0x0'));var util=require(_0x6f42('0x1'));var path=require(_0x6f42('0x2'));var timeout=require(_0x6f42('0x3'));var express=require(_0x6f42('0x4'));var router=express[_0x6f42('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6f42('0x6'));var controller=require(_0x6f42('0x7'));router[_0x6f42('0x8')]('/',auth[_0x6f42('0x9')](),controller[_0x6f42('0xa')]);router['get'](_0x6f42('0xb'),auth[_0x6f42('0x9')](),controller[_0x6f42('0xc')]);router[_0x6f42('0xd')]('/',auth[_0x6f42('0x9')](),controller[_0x6f42('0xe')]);router[_0x6f42('0xf')](_0x6f42('0xb'),auth[_0x6f42('0x9')](),controller[_0x6f42('0x10')]);router[_0x6f42('0x11')](_0x6f42('0xb'),auth[_0x6f42('0x9')](),controller[_0x6f42('0x12')]);module[_0x6f42('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 795a5bd..4b05585 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 _0xacf4=['STRING','INTEGER','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xacf4,0xe7));var _0x4acf=function(_0x1555f5,_0xb904c0){_0x1555f5=_0x1555f5-0x0;var _0x307306=_0xacf4[_0x1555f5];return _0x307306;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x4acf('0x0')]},'host':{'type':Sequelize[_0x4acf('0x0')]},'user':{'type':Sequelize[_0x4acf('0x0')]},'pass':{'type':Sequelize[_0x4acf('0x0')]},'port':{'type':Sequelize[_0x4acf('0x1')]},'secure':{'type':Sequelize[_0x4acf('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x4acf('0x0')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xb4d9=['STRING','BOOLEAN','sequelize','exports'];(function(_0x5827a5,_0x4eb8c7){var _0x5c31dd=function(_0xbe6312){while(--_0xbe6312){_0x5827a5['push'](_0x5827a5['shift']());}};_0x5c31dd(++_0x4eb8c7);}(_0xb4d9,0xce));var _0x9b4d=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xb4d9[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require(_0x9b4d('0x0'));module[_0x9b4d('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x9b4d('0x2')]},'user':{'type':Sequelize[_0x9b4d('0x2')]},'pass':{'type':Sequelize[_0x9b4d('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x9b4d('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x9b4d('0x2')]},'authentication':{'type':Sequelize[_0x9b4d('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 d90dd97..2336eff 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 _0x6dd9=['jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','limit','set','apply','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','MailServerOut','count','includeAll','include','findAll','rows','show','options','create','body','catch','update','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash'];(function(_0x25d4ee,_0xc95872){var _0x214a35=function(_0x4285a0){while(--_0x4285a0){_0x25d4ee['push'](_0x25d4ee['shift']());}};_0x214a35(++_0xc95872);}(_0x6dd9,0xc5));var _0x96dd=function(_0xc09594,_0x400f5e){_0xc09594=_0xc09594-0x0;var _0x572d70=_0x6dd9[_0xc09594];return _0x572d70;};'use strict';var pdf=require(_0x96dd('0x0'));var emlformat=require(_0x96dd('0x1'));var rimraf=require(_0x96dd('0x2'));var zipdir=require(_0x96dd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x96dd('0x4'));var moment=require(_0x96dd('0x5'));var BPromise=require(_0x96dd('0x6'));var Mustache=require(_0x96dd('0x7'));var util=require(_0x96dd('0x8'));var path=require(_0x96dd('0x9'));var sox=require(_0x96dd('0xa'));var csv=require(_0x96dd('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x96dd('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x96dd('0xd'));var deskjs=require(_0x96dd('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x96dd('0xf'));var authService=require(_0x96dd('0x10'));var qs=require(_0x96dd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96dd('0x12'));var logger=require(_0x96dd('0x13'))(_0x96dd('0x14'));var utils=require(_0x96dd('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44df95,_0x14d1c2){_0x14d1c2=_0x14d1c2||0xcc;return function(_0x27f4ce){if(_0x27f4ce){return _0x44df95[_0x96dd('0x16')](_0x14d1c2);}return _0x44df95['status'](_0x14d1c2)[_0x96dd('0x17')]();};}function respondWithResult(_0x554cb5,_0xb83929){_0xb83929=_0xb83929||0xc8;return function(_0x752273){if(_0x752273){return _0x554cb5[_0x96dd('0x18')](_0xb83929)[_0x96dd('0x19')](_0x752273);}};}function respondWithFilteredResult(_0x3a5761,_0x430b3f){return function(_0xfdc177){if(_0xfdc177){var _0x3a7bb6=_0xfdc177['count'],_0x3024a7=_0x430b3f[_0x96dd('0x1a')],_0x587104=_0x430b3f[_0x96dd('0x1a')]+_0x430b3f[_0x96dd('0x1b')],_0x3dce2d;if(_0x587104>=_0x3a7bb6){_0x587104=_0x3a7bb6;_0x3dce2d=0xc8;}else{_0x3dce2d=0xce;}_0x3a5761[_0x96dd('0x18')](_0x3dce2d);return _0x3a5761[_0x96dd('0x1c')]('Content-Range',_0x3024a7+'-'+_0x587104+'/'+_0x3a7bb6)['json'](_0xfdc177);}return null;};}function patchUpdates(_0x3a15bc){return function(_0x28e61a){try{jsonpatch[_0x96dd('0x1d')](_0x28e61a,_0x3a15bc,!![]);}catch(_0xf99e60){return BPromise['reject'](_0xf99e60);}return _0x28e61a['save']();};}function saveUpdates(_0x2fa15d,_0x118e65){return function(_0x1ddf7c){if(_0x1ddf7c){return _0x1ddf7c['update'](_0x2fa15d)[_0x96dd('0x1e')](function(_0x1379d6){return _0x1379d6;});}return null;};}function removeEntity(_0x36966c,_0x45ad1f){return function(_0x20a5fe){if(_0x20a5fe){return _0x20a5fe[_0x96dd('0x1f')]()['then'](function(){_0x36966c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x184efc,_0x4b0964){return function(_0x3ab324){if(!_0x3ab324){_0x184efc[_0x96dd('0x16')](0x194);}return _0x3ab324;};}function handleError(_0x278237,_0x70fc8d){_0x70fc8d=_0x70fc8d||0x1f4;return function(_0x344a9a){logger[_0x96dd('0x20')](_0x344a9a['stack']);if(_0x344a9a[_0x96dd('0x21')]){delete _0x344a9a[_0x96dd('0x21')];}_0x278237[_0x96dd('0x18')](_0x70fc8d)[_0x96dd('0x22')](_0x344a9a);};}exports[_0x96dd('0x23')]=function(_0x19cc4a,_0x51ba34){var _0x3b9fab={},_0x913ee8={},_0x1545c3={'count':0x0,'rows':[]};var _0xd05113=_['map'](db['MailServerOut'][_0x96dd('0x24')],function(_0x2252d4){return{'name':_0x2252d4[_0x96dd('0x25')],'type':_0x2252d4[_0x96dd('0x26')][_0x96dd('0x27')]};});_0x913ee8[_0x96dd('0x28')]=_[_0x96dd('0x29')](_0xd05113,_0x96dd('0x21'));_0x913ee8[_0x96dd('0x2a')]=_[_0x96dd('0x2b')](_0x19cc4a[_0x96dd('0x2a')]);_0x913ee8[_0x96dd('0x2c')]=_[_0x96dd('0x2d')](_0x913ee8['model'],_0x913ee8['query']);_0x3b9fab['attributes']=_[_0x96dd('0x2d')](_0x913ee8['model'],qs[_0x96dd('0x2e')](_0x19cc4a[_0x96dd('0x2a')]['fields']));_0x3b9fab[_0x96dd('0x2f')]=_0x3b9fab[_0x96dd('0x2f')][_0x96dd('0x30')]?_0x3b9fab[_0x96dd('0x2f')]:_0x913ee8[_0x96dd('0x28')];if(!_0x19cc4a['query'][_0x96dd('0x31')](_0x96dd('0x32'))){_0x3b9fab[_0x96dd('0x1b')]=qs[_0x96dd('0x1b')](_0x19cc4a[_0x96dd('0x2a')][_0x96dd('0x1b')]);_0x3b9fab['offset']=qs[_0x96dd('0x1a')](_0x19cc4a[_0x96dd('0x2a')]['offset']);}_0x3b9fab['order']=qs[_0x96dd('0x33')](_0x19cc4a['query'][_0x96dd('0x33')]);_0x3b9fab['where']=qs['filters'](_[_0x96dd('0x34')](_0x19cc4a[_0x96dd('0x2a')],_0x913ee8[_0x96dd('0x2c')]),_0xd05113);if(_0x19cc4a[_0x96dd('0x2a')][_0x96dd('0x35')]){_0x3b9fab[_0x96dd('0x36')]=_[_0x96dd('0x37')](_0x3b9fab[_0x96dd('0x36')],{'$or':_[_0x96dd('0x29')](_0xd05113,function(_0x3ae854){if(_0x3ae854[_0x96dd('0x26')]!==_0x96dd('0x38')){var _0x43e33c={};_0x43e33c[_0x3ae854[_0x96dd('0x21')]]={'$like':'%'+_0x19cc4a[_0x96dd('0x2a')][_0x96dd('0x35')]+'%'};return _0x43e33c;}})});}_0x3b9fab=_['merge']({},_0x3b9fab,_0x19cc4a['options']);var _0x46b3f8={'where':_0x3b9fab['where']};return db[_0x96dd('0x39')][_0x96dd('0x3a')](_0x46b3f8)[_0x96dd('0x1e')](function(_0x26e0c3){_0x1545c3[_0x96dd('0x3a')]=_0x26e0c3;if(_0x19cc4a[_0x96dd('0x2a')][_0x96dd('0x3b')]){_0x3b9fab[_0x96dd('0x3c')]=[{'all':!![]}];}return db['MailServerOut'][_0x96dd('0x3d')](_0x3b9fab);})['then'](function(_0x11a3ef){_0x1545c3[_0x96dd('0x3e')]=_0x11a3ef;return _0x1545c3;})[_0x96dd('0x1e')](respondWithFilteredResult(_0x51ba34,_0x3b9fab))['catch'](handleError(_0x51ba34,null));};exports[_0x96dd('0x3f')]=function(_0x2f60c5,_0x24e1d2){var _0x53f1bc={'raw':!![],'where':{'id':_0x2f60c5['params']['id']}},_0x174bb0={};_0x174bb0[_0x96dd('0x28')]=_[_0x96dd('0x2b')](db[_0x96dd('0x39')][_0x96dd('0x24')]);_0x174bb0[_0x96dd('0x2a')]=_[_0x96dd('0x2b')](_0x2f60c5[_0x96dd('0x2a')]);_0x174bb0[_0x96dd('0x2c')]=_['intersection'](_0x174bb0[_0x96dd('0x28')],_0x174bb0[_0x96dd('0x2a')]);_0x53f1bc['attributes']=_[_0x96dd('0x2d')](_0x174bb0[_0x96dd('0x28')],qs[_0x96dd('0x2e')](_0x2f60c5['query'][_0x96dd('0x2e')]));_0x53f1bc[_0x96dd('0x2f')]=_0x53f1bc[_0x96dd('0x2f')][_0x96dd('0x30')]?_0x53f1bc[_0x96dd('0x2f')]:_0x174bb0[_0x96dd('0x28')];if(_0x2f60c5[_0x96dd('0x2a')][_0x96dd('0x3b')]){_0x53f1bc[_0x96dd('0x3c')]=[{'all':!![]}];}_0x53f1bc=_[_0x96dd('0x37')]({},_0x53f1bc,_0x2f60c5[_0x96dd('0x40')]);return db[_0x96dd('0x39')]['find'](_0x53f1bc)[_0x96dd('0x1e')](handleEntityNotFound(_0x24e1d2,null))[_0x96dd('0x1e')](respondWithResult(_0x24e1d2,null))['catch'](handleError(_0x24e1d2,null));};exports[_0x96dd('0x41')]=function(_0x1eff12,_0x8fa8fb){return db[_0x96dd('0x39')]['create'](_0x1eff12[_0x96dd('0x42')],{})[_0x96dd('0x1e')](respondWithResult(_0x8fa8fb,0xc9))[_0x96dd('0x43')](handleError(_0x8fa8fb,null));};exports[_0x96dd('0x44')]=function(_0xada603,_0xaa21c5){if(_0xada603[_0x96dd('0x42')]['id']){delete _0xada603[_0x96dd('0x42')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0xada603[_0x96dd('0x45')]['id']}})['then'](handleEntityNotFound(_0xaa21c5,null))['then'](saveUpdates(_0xada603['body'],null))[_0x96dd('0x1e')](respondWithResult(_0xaa21c5,null))[_0x96dd('0x43')](handleError(_0xaa21c5,null));};exports[_0x96dd('0x1f')]=function(_0x212787,_0x16000d){return db[_0x96dd('0x39')]['find']({'where':{'id':_0x212787[_0x96dd('0x45')]['id']}})[_0x96dd('0x1e')](handleEntityNotFound(_0x16000d,null))[_0x96dd('0x1e')](removeEntity(_0x16000d,null))['catch'](handleError(_0x16000d,null));}; \ No newline at end of file +var _0x21cd=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x5d9ac3,_0x4820fa){var _0x2e0117=function(_0x5d09e9){while(--_0x5d09e9){_0x5d9ac3['push'](_0x5d9ac3['shift']());}};_0x2e0117(++_0x4820fa);}(_0x21cd,0x15d));var _0xd21c=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x21cd[_0x39e283];return _0x7de89f;};'use strict';var pdf=require(_0xd21c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd21c('0x1'));var zipdir=require(_0xd21c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd21c('0x3'));var moment=require(_0xd21c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd21c('0x5'));var util=require(_0xd21c('0x6'));var path=require(_0xd21c('0x7'));var sox=require(_0xd21c('0x8'));var csv=require(_0xd21c('0x9'));var ejs=require(_0xd21c('0xa'));var fs=require('fs');var _=require(_0xd21c('0xb'));var squel=require('squel');var crypto=require(_0xd21c('0xc'));var jsforce=require(_0xd21c('0xd'));var deskjs=require(_0xd21c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd21c('0xf'));var Papa=require(_0xd21c('0x10'));var Redis=require(_0xd21c('0x11'));var authService=require(_0xd21c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd21c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd21c('0x14'))(_0xd21c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd21c('0x16'))['db'];function respondWithStatusCode(_0x49ece8,_0x22d81a){_0x22d81a=_0x22d81a||0xcc;return function(_0x55b736){if(_0x55b736){return _0x49ece8[_0xd21c('0x17')](_0x22d81a);}return _0x49ece8[_0xd21c('0x18')](_0x22d81a)[_0xd21c('0x19')]();};}function respondWithResult(_0x2db4fa,_0x4436fb){_0x4436fb=_0x4436fb||0xc8;return function(_0x76cc74){if(_0x76cc74){return _0x2db4fa[_0xd21c('0x18')](_0x4436fb)[_0xd21c('0x1a')](_0x76cc74);}};}function respondWithFilteredResult(_0x49f5f9,_0x5caa05){return function(_0x287568){if(_0x287568){var _0x48cf70=_0x287568[_0xd21c('0x1b')],_0x590821=_0x5caa05[_0xd21c('0x1c')],_0x509b01=_0x5caa05[_0xd21c('0x1c')]+_0x5caa05[_0xd21c('0x1d')],_0x327462;if(_0x509b01>=_0x48cf70){_0x509b01=_0x48cf70;_0x327462=0xc8;}else{_0x327462=0xce;}_0x49f5f9['status'](_0x327462);return _0x49f5f9[_0xd21c('0x1e')](_0xd21c('0x1f'),_0x590821+'-'+_0x509b01+'/'+_0x48cf70)['json'](_0x287568);}return null;};}function patchUpdates(_0x2dbc7b){return function(_0x19b7a7){try{jsonpatch[_0xd21c('0x20')](_0x19b7a7,_0x2dbc7b,!![]);}catch(_0x56ff14){return BPromise['reject'](_0x56ff14);}return _0x19b7a7['save']();};}function saveUpdates(_0x3364a7,_0x162f3a){return function(_0x41689f){if(_0x41689f){return _0x41689f[_0xd21c('0x21')](_0x3364a7)['then'](function(_0x5aad34){return _0x5aad34;});}return null;};}function removeEntity(_0x3e6dff,_0x1350a6){return function(_0x2f4a7f){if(_0x2f4a7f){return _0x2f4a7f[_0xd21c('0x22')]()[_0xd21c('0x23')](function(){_0x3e6dff[_0xd21c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32a1b7,_0x27c7c0){return function(_0x167d51){if(!_0x167d51){_0x32a1b7[_0xd21c('0x17')](0x194);}return _0x167d51;};}function handleError(_0x43fd85,_0x5a397a){_0x5a397a=_0x5a397a||0x1f4;return function(_0x5b97ef){logger[_0xd21c('0x24')](_0x5b97ef[_0xd21c('0x25')]);if(_0x5b97ef[_0xd21c('0x26')]){delete _0x5b97ef[_0xd21c('0x26')];}_0x43fd85[_0xd21c('0x18')](_0x5a397a)[_0xd21c('0x27')](_0x5b97ef);};}exports[_0xd21c('0x28')]=function(_0x4316c4,_0x800541){var _0x4c553f={},_0x4cb723={},_0x36afca={'count':0x0,'rows':[]};var _0xd2c93a=_[_0xd21c('0x29')](db[_0xd21c('0x2a')]['rawAttributes'],function(_0x3bc099){return{'name':_0x3bc099[_0xd21c('0x2b')],'type':_0x3bc099[_0xd21c('0x2c')][_0xd21c('0x2d')]};});_0x4cb723[_0xd21c('0x2e')]=_['map'](_0xd2c93a,'name');_0x4cb723[_0xd21c('0x2f')]=_[_0xd21c('0x30')](_0x4316c4['query']);_0x4cb723[_0xd21c('0x31')]=_[_0xd21c('0x32')](_0x4cb723[_0xd21c('0x2e')],_0x4cb723[_0xd21c('0x2f')]);_0x4c553f[_0xd21c('0x33')]=_['intersection'](_0x4cb723[_0xd21c('0x2e')],qs[_0xd21c('0x34')](_0x4316c4[_0xd21c('0x2f')][_0xd21c('0x34')]));_0x4c553f[_0xd21c('0x33')]=_0x4c553f[_0xd21c('0x33')][_0xd21c('0x35')]?_0x4c553f[_0xd21c('0x33')]:_0x4cb723[_0xd21c('0x2e')];if(!_0x4316c4[_0xd21c('0x2f')][_0xd21c('0x36')](_0xd21c('0x37'))){_0x4c553f[_0xd21c('0x1d')]=qs['limit'](_0x4316c4[_0xd21c('0x2f')]['limit']);_0x4c553f['offset']=qs['offset'](_0x4316c4[_0xd21c('0x2f')][_0xd21c('0x1c')]);}_0x4c553f[_0xd21c('0x38')]=qs[_0xd21c('0x39')](_0x4316c4[_0xd21c('0x2f')]['sort']);_0x4c553f['where']=qs[_0xd21c('0x31')](_[_0xd21c('0x3a')](_0x4316c4[_0xd21c('0x2f')],_0x4cb723['filters']),_0xd2c93a);if(_0x4316c4[_0xd21c('0x2f')]['filter']){_0x4c553f[_0xd21c('0x3b')]=_[_0xd21c('0x3c')](_0x4c553f[_0xd21c('0x3b')],{'$or':_['map'](_0xd2c93a,function(_0x58291a){if(_0x58291a[_0xd21c('0x2c')]!==_0xd21c('0x3d')){var _0x16393e={};_0x16393e[_0x58291a[_0xd21c('0x26')]]={'$like':'%'+_0x4316c4[_0xd21c('0x2f')][_0xd21c('0x3e')]+'%'};return _0x16393e;}})});}_0x4c553f=_[_0xd21c('0x3c')]({},_0x4c553f,_0x4316c4[_0xd21c('0x3f')]);var _0x51f34a={'where':_0x4c553f[_0xd21c('0x3b')]};return db[_0xd21c('0x2a')]['count'](_0x51f34a)[_0xd21c('0x23')](function(_0x3ba29d){_0x36afca['count']=_0x3ba29d;if(_0x4316c4[_0xd21c('0x2f')][_0xd21c('0x40')]){_0x4c553f[_0xd21c('0x41')]=[{'all':!![]}];}return db['MailServerOut'][_0xd21c('0x42')](_0x4c553f);})[_0xd21c('0x23')](function(_0x46e2bc){_0x36afca['rows']=_0x46e2bc;return _0x36afca;})[_0xd21c('0x23')](respondWithFilteredResult(_0x800541,_0x4c553f))[_0xd21c('0x43')](handleError(_0x800541,null));};exports[_0xd21c('0x44')]=function(_0x3e57a8,_0x3e0b79){var _0xca6f25={'raw':!![],'where':{'id':_0x3e57a8[_0xd21c('0x45')]['id']}},_0x3eabed={};_0x3eabed[_0xd21c('0x2e')]=_[_0xd21c('0x30')](db[_0xd21c('0x2a')]['rawAttributes']);_0x3eabed[_0xd21c('0x2f')]=_[_0xd21c('0x30')](_0x3e57a8['query']);_0x3eabed[_0xd21c('0x31')]=_[_0xd21c('0x32')](_0x3eabed[_0xd21c('0x2e')],_0x3eabed[_0xd21c('0x2f')]);_0xca6f25[_0xd21c('0x33')]=_[_0xd21c('0x32')](_0x3eabed[_0xd21c('0x2e')],qs[_0xd21c('0x34')](_0x3e57a8[_0xd21c('0x2f')][_0xd21c('0x34')]));_0xca6f25[_0xd21c('0x33')]=_0xca6f25['attributes'][_0xd21c('0x35')]?_0xca6f25['attributes']:_0x3eabed['model'];if(_0x3e57a8[_0xd21c('0x2f')][_0xd21c('0x40')]){_0xca6f25[_0xd21c('0x41')]=[{'all':!![]}];}_0xca6f25=_[_0xd21c('0x3c')]({},_0xca6f25,_0x3e57a8[_0xd21c('0x3f')]);return db['MailServerOut'][_0xd21c('0x46')](_0xca6f25)[_0xd21c('0x23')](handleEntityNotFound(_0x3e0b79,null))[_0xd21c('0x23')](respondWithResult(_0x3e0b79,null))[_0xd21c('0x43')](handleError(_0x3e0b79,null));};exports['create']=function(_0x16f5dc,_0x4f9c6e){return db['MailServerOut'][_0xd21c('0x47')](_0x16f5dc[_0xd21c('0x48')],{})[_0xd21c('0x23')](respondWithResult(_0x4f9c6e,0xc9))['catch'](handleError(_0x4f9c6e,null));};exports['update']=function(_0x528c1a,_0x145356){if(_0x528c1a[_0xd21c('0x48')]['id']){delete _0x528c1a[_0xd21c('0x48')]['id'];}return db[_0xd21c('0x2a')][_0xd21c('0x46')]({'where':{'id':_0x528c1a['params']['id']}})[_0xd21c('0x23')](handleEntityNotFound(_0x145356,null))[_0xd21c('0x23')](saveUpdates(_0x528c1a[_0xd21c('0x48')],null))[_0xd21c('0x23')](respondWithResult(_0x145356,null))[_0xd21c('0x43')](handleError(_0x145356,null));};exports[_0xd21c('0x22')]=function(_0x295fc3,_0x19c451){return db['MailServerOut'][_0xd21c('0x46')]({'where':{'id':_0x295fc3[_0xd21c('0x45')]['id']}})[_0xd21c('0x23')](handleEntityNotFound(_0x19c451,null))['then'](removeEntity(_0x19c451,null))[_0xd21c('0x43')](handleError(_0x19c451,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 997a69b..8473fa5 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 _0xea57=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','mail_servers_out'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xea57,0x84));var _0x7ea5=function(_0x56bb79,_0x358515){_0x56bb79=_0x56bb79-0x0;var _0x3049e4=_0xea57[_0x56bb79];return _0x3049e4;};'use strict';var _=require(_0x7ea5('0x0'));var util=require(_0x7ea5('0x1'));var logger=require(_0x7ea5('0x2'))(_0x7ea5('0x3'));var moment=require(_0x7ea5('0x4'));var BPromise=require(_0x7ea5('0x5'));var rp=require(_0x7ea5('0x6'));var fs=require('fs');var path=require(_0x7ea5('0x7'));var rimraf=require(_0x7ea5('0x8'));var config=require(_0x7ea5('0x9'));var attributes=require(_0x7ea5('0xa'));module['exports']=function(_0x533f7d,_0x1bc0d8){return _0x533f7d['define']('MailServerOut',attributes,{'tableName':_0x7ea5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59f7=['../../config/environment','./mailServerOut.attributes','exports','MailServerOut','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1ae5b0,_0x21b9b6){var _0x2e4495=function(_0x3d20f1){while(--_0x3d20f1){_0x1ae5b0['push'](_0x1ae5b0['shift']());}};_0x2e4495(++_0x21b9b6);}(_0x59f7,0xb4));var _0x759f=function(_0x53734d,_0x25be46){_0x53734d=_0x53734d-0x0;var _0x159a9f=_0x59f7[_0x53734d];return _0x159a9f;};'use strict';var _=require('lodash');var util=require(_0x759f('0x0'));var logger=require('../../config/logger')(_0x759f('0x1'));var moment=require(_0x759f('0x2'));var BPromise=require(_0x759f('0x3'));var rp=require(_0x759f('0x4'));var fs=require('fs');var path=require(_0x759f('0x5'));var rimraf=require(_0x759f('0x6'));var config=require(_0x759f('0x7'));var attributes=require(_0x759f('0x8'));module[_0x759f('0x9')]=function(_0x21bc13,_0x101a14){return _0x21bc13['define'](_0x759f('0xa'),attributes,{'tableName':'mail_servers_out','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 6704df5..462f6f5 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 _0x0237=['info','result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3e8c23,_0x3e1887){var _0x3fa914=function(_0x5e0814){while(--_0x5e0814){_0x3e8c23['push'](_0x3e8c23['shift']());}};_0x3fa914(++_0x3e1887);}(_0x0237,0x152));var _0x7023=function(_0x38173a,_0x2808d9){_0x38173a=_0x38173a-0x0;var _0x46be92=_0x0237[_0x38173a];return _0x46be92;};'use strict';var _=require(_0x7023('0x0'));var util=require(_0x7023('0x1'));var moment=require(_0x7023('0x2'));var BPromise=require(_0x7023('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7023('0x4'));var logger=require(_0x7023('0x5'))(_0x7023('0x6'));var config=require(_0x7023('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7023('0x8')][_0x7023('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e5fd3,_0x48e149,_0x308a19){return new BPromise(function(_0xb43d81,_0x5e0a88){return client[_0x7023('0xa')](_0x1e5fd3,_0x308a19)['then'](function(_0x247d0c){logger['info'](_0x7023('0xb'),_0x48e149,_0x7023('0xc'));logger[_0x7023('0xd')](_0x7023('0xe'),_0x48e149,_0x7023('0xc'),JSON[_0x7023('0xf')](_0x247d0c));if(_0x247d0c[_0x7023('0x10')]){if(_0x247d0c[_0x7023('0x10')][_0x7023('0x11')]===0x1f4){logger[_0x7023('0x10')](_0x7023('0xb'),_0x48e149,_0x247d0c['error'][_0x7023('0x12')]);return _0x5e0a88(_0x247d0c['error'][_0x7023('0x12')]);}logger['error'](_0x7023('0xb'),_0x48e149,_0x247d0c[_0x7023('0x10')]['message']);return _0xb43d81(_0x247d0c[_0x7023('0x10')]['message']);}else{logger[_0x7023('0x13')](_0x7023('0xb'),_0x48e149,_0x7023('0xc'));_0xb43d81(_0x247d0c[_0x7023('0x14')][_0x7023('0x12')]);}})['catch'](function(_0x171191){logger[_0x7023('0x10')](_0x7023('0xb'),_0x48e149,_0x171191);_0x5e0a88(_0x171191);});});} \ No newline at end of file +var _0x6477=['rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','randomstring','ioredis','../../config/logger'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x6477,0x80));var _0x7647=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0x6477[_0x2459fd];return _0x364cd2;};'use strict';var _=require('lodash');var util=require(_0x7647('0x0'));var moment=require(_0x7647('0x1'));var BPromise=require('bluebird');var rs=require(_0x7647('0x2'));var fs=require('fs');var Redis=require(_0x7647('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7647('0x4'))(_0x7647('0x5'));var config=require('../../config/environment');var jayson=require(_0x7647('0x6'));var client=jayson[_0x7647('0x7')][_0x7647('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x509704,_0x46fcc6,_0x3f3fed){return new BPromise(function(_0x40ab29,_0x2ca783){return client[_0x7647('0x9')](_0x509704,_0x3f3fed)[_0x7647('0xa')](function(_0x53ae0f){logger[_0x7647('0xb')](_0x7647('0xc'),_0x46fcc6,_0x7647('0xd'));logger['debug'](_0x7647('0xe'),_0x46fcc6,_0x7647('0xd'),JSON[_0x7647('0xf')](_0x53ae0f));if(_0x53ae0f[_0x7647('0x10')]){if(_0x53ae0f['error']['code']===0x1f4){logger[_0x7647('0x10')](_0x7647('0xc'),_0x46fcc6,_0x53ae0f[_0x7647('0x10')][_0x7647('0x11')]);return _0x2ca783(_0x53ae0f['error']['message']);}logger[_0x7647('0x10')](_0x7647('0xc'),_0x46fcc6,_0x53ae0f[_0x7647('0x10')][_0x7647('0x11')]);return _0x40ab29(_0x53ae0f['error'][_0x7647('0x11')]);}else{logger[_0x7647('0xb')](_0x7647('0xc'),_0x46fcc6,_0x7647('0xd'));_0x40ab29(_0x53ae0f['result'][_0x7647('0x11')]);}})[_0x7647('0x12')](function(_0x367995){logger['error'](_0x7647('0xc'),_0x46fcc6,_0x367995);_0x2ca783(_0x367995);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index c7fe587..b6ff032 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 _0x9999=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x1c3370,_0xf617e8){var _0xa9b358=function(_0x39cb44){while(--_0x39cb44){_0x1c3370['push'](_0x1c3370['shift']());}};_0xa9b358(++_0xf617e8);}(_0x9999,0x1c1));var _0x9999=function(_0x11308d,_0x1805d7){_0x11308d=_0x11308d-0x0;var _0x13c11d=_0x9999[_0x11308d];return _0x13c11d;};'use strict';var multer=require(_0x9999('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9999('0x1')]();var auth=require(_0x9999('0x2'));var interaction=require(_0x9999('0x3'));var config=require(_0x9999('0x4'));var controller=require(_0x9999('0x5'));router[_0x9999('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9999('0x7'),auth[_0x9999('0x8')](),controller[_0x9999('0x9')]);router[_0x9999('0x6')](_0x9999('0xa'),auth[_0x9999('0x8')](),controller['show']);router[_0x9999('0xb')]('/',auth[_0x9999('0x8')](),controller[_0x9999('0xc')]);router[_0x9999('0xd')](_0x9999('0xa'),auth['isAuthenticated'](),controller[_0x9999('0xe')]);router[_0x9999('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x9999('0x10')]);module[_0x9999('0x11')]=router; \ No newline at end of file +var _0x68a9=['isAuthenticated','index','/describe','describe','show','post','put','/:id','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x68a9,0x1e5));var _0x968a=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x68a9[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require('multer');var util=require(_0x968a('0x0'));var path=require(_0x968a('0x1'));var timeout=require(_0x968a('0x2'));var express=require(_0x968a('0x3'));var router=express[_0x968a('0x4')]();var auth=require(_0x968a('0x5'));var interaction=require(_0x968a('0x6'));var config=require(_0x968a('0x7'));var controller=require(_0x968a('0x8'));router['get']('/',auth[_0x968a('0x9')](),controller[_0x968a('0xa')]);router['get'](_0x968a('0xb'),auth['isAuthenticated'](),controller[_0x968a('0xc')]);router['get']('/:id',auth[_0x968a('0x9')](),controller[_0x968a('0xd')]);router[_0x968a('0xe')]('/',auth[_0x968a('0x9')](),controller['create']);router[_0x968a('0xf')](_0x968a('0x10'),auth[_0x968a('0x9')](),controller[_0x968a('0x11')]);router['delete'](_0x968a('0x10'),auth[_0x968a('0x9')](),controller[_0x968a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 775bc3c..8c200bd 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 _0x8c8b=['STRING','sequelize','name'];(function(_0xb1c60b,_0x385134){var _0x4c391d=function(_0x34a8f3){while(--_0x34a8f3){_0xb1c60b['push'](_0xb1c60b['shift']());}};_0x4c391d(++_0x385134);}(_0x8c8b,0x106));var _0xb8c8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8c8b[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xb8c8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb8c8('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb8c8('0x2')]}}; \ No newline at end of file +var _0x4ccb=['STRING','sequelize','exports'];(function(_0x58c576,_0x3df9c6){var _0x2677c3=function(_0x9a8fca){while(--_0x9a8fca){_0x58c576['push'](_0x58c576['shift']());}};_0x2677c3(++_0x3df9c6);}(_0x4ccb,0x196));var _0xb4cc=function(_0x2152ff,_0x4f6eb8){_0x2152ff=_0x2152ff-0x0;var _0x5cb275=_0x4ccb[_0x2152ff];return _0x5cb275;};'use strict';var Sequelize=require(_0xb4cc('0x0'));module[_0xb4cc('0x1')]={'name':{'type':Sequelize[_0xb4cc('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb4cc('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 8a230d8..62839ef 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 _0x9e37=['../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','rows','show','params','find','create','body','catch','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9e37,0x152));var _0x79e3=function(_0x3bf9b7,_0x2d9b97){_0x3bf9b7=_0x3bf9b7-0x0;var _0x566013=_0x9e37[_0x3bf9b7];return _0x566013;};'use strict';var pdf=require(_0x79e3('0x0'));var emlformat=require(_0x79e3('0x1'));var rimraf=require(_0x79e3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x79e3('0x3'));var rp=require('request-promise');var moment=require(_0x79e3('0x4'));var BPromise=require(_0x79e3('0x5'));var Mustache=require(_0x79e3('0x6'));var util=require('util');var path=require(_0x79e3('0x7'));var sox=require('sox');var csv=require(_0x79e3('0x8'));var ejs=require(_0x79e3('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x79e3('0xa'));var crypto=require(_0x79e3('0xb'));var jsforce=require(_0x79e3('0xc'));var deskjs=require(_0x79e3('0xd'));var toCsv=require(_0x79e3('0x8'));var querystring=require(_0x79e3('0xe'));var Papa=require(_0x79e3('0xf'));var Redis=require('ioredis');var authService=require(_0x79e3('0x10'));var qs=require(_0x79e3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x79e3('0x12'))(_0x79e3('0x13'));var utils=require('../../config/utils');var config=require(_0x79e3('0x14'));var db=require(_0x79e3('0x15'))['db'];function respondWithStatusCode(_0x2084f7,_0x48ba37){_0x48ba37=_0x48ba37||0xcc;return function(_0x5d39d9){if(_0x5d39d9){return _0x2084f7[_0x79e3('0x16')](_0x48ba37);}return _0x2084f7[_0x79e3('0x17')](_0x48ba37)[_0x79e3('0x18')]();};}function respondWithResult(_0x5644a3,_0xfe5b73){_0xfe5b73=_0xfe5b73||0xc8;return function(_0x2acf2a){if(_0x2acf2a){return _0x5644a3[_0x79e3('0x17')](_0xfe5b73)[_0x79e3('0x19')](_0x2acf2a);}};}function respondWithFilteredResult(_0x188f7d,_0x1683d5){return function(_0x43dfba){if(_0x43dfba){var _0x4f552b=_0x43dfba['count'],_0x19a8c5=_0x1683d5[_0x79e3('0x1a')],_0x4c757c=_0x1683d5[_0x79e3('0x1a')]+_0x1683d5[_0x79e3('0x1b')],_0x94212e;if(_0x4c757c>=_0x4f552b){_0x4c757c=_0x4f552b;_0x94212e=0xc8;}else{_0x94212e=0xce;}_0x188f7d[_0x79e3('0x17')](_0x94212e);return _0x188f7d['set'](_0x79e3('0x1c'),_0x19a8c5+'-'+_0x4c757c+'/'+_0x4f552b)[_0x79e3('0x19')](_0x43dfba);}return null;};}function patchUpdates(_0x505754){return function(_0x43f571){try{jsonpatch[_0x79e3('0x1d')](_0x43f571,_0x505754,!![]);}catch(_0xe9e2f7){return BPromise[_0x79e3('0x1e')](_0xe9e2f7);}return _0x43f571[_0x79e3('0x1f')]();};}function saveUpdates(_0x4821cb,_0x45d993){return function(_0x3f6d18){if(_0x3f6d18){return _0x3f6d18[_0x79e3('0x20')](_0x4821cb)[_0x79e3('0x21')](function(_0x380846){return _0x380846;});}return null;};}function removeEntity(_0x279357,_0x5e3153){return function(_0x24f54a){if(_0x24f54a){return _0x24f54a[_0x79e3('0x22')]()[_0x79e3('0x21')](function(){_0x279357[_0x79e3('0x17')](0xcc)[_0x79e3('0x18')]();});}};}function handleEntityNotFound(_0x43f4db,_0x2523ae){return function(_0x42c78c){if(!_0x42c78c){_0x43f4db[_0x79e3('0x16')](0x194);}return _0x42c78c;};}function handleError(_0x196387,_0x1eccf5){_0x1eccf5=_0x1eccf5||0x1f4;return function(_0x4e1965){logger[_0x79e3('0x23')](_0x4e1965[_0x79e3('0x24')]);if(_0x4e1965[_0x79e3('0x25')]){delete _0x4e1965[_0x79e3('0x25')];}_0x196387[_0x79e3('0x17')](_0x1eccf5)[_0x79e3('0x26')](_0x4e1965);};}exports[_0x79e3('0x27')]=function(_0x489b06,_0x45d50d){var _0x197aec={},_0x348ba7={},_0x46538d={'count':0x0,'rows':[]};var _0x4aa548=_[_0x79e3('0x28')](db[_0x79e3('0x29')][_0x79e3('0x2a')],function(_0x491e40){return{'name':_0x491e40[_0x79e3('0x2b')],'type':_0x491e40['type']['key']};});_0x348ba7[_0x79e3('0x2c')]=_[_0x79e3('0x28')](_0x4aa548,_0x79e3('0x25'));_0x348ba7[_0x79e3('0x2d')]=_[_0x79e3('0x2e')](_0x489b06[_0x79e3('0x2d')]);_0x348ba7[_0x79e3('0x2f')]=_[_0x79e3('0x30')](_0x348ba7[_0x79e3('0x2c')],_0x348ba7['query']);_0x197aec[_0x79e3('0x31')]=_['intersection'](_0x348ba7[_0x79e3('0x2c')],qs[_0x79e3('0x32')](_0x489b06[_0x79e3('0x2d')]['fields']));_0x197aec['attributes']=_0x197aec[_0x79e3('0x31')][_0x79e3('0x33')]?_0x197aec[_0x79e3('0x31')]:_0x348ba7[_0x79e3('0x2c')];if(!_0x489b06[_0x79e3('0x2d')][_0x79e3('0x34')]('nolimit')){_0x197aec['limit']=qs['limit'](_0x489b06[_0x79e3('0x2d')][_0x79e3('0x1b')]);_0x197aec['offset']=qs['offset'](_0x489b06['query'][_0x79e3('0x1a')]);}_0x197aec[_0x79e3('0x35')]=qs[_0x79e3('0x36')](_0x489b06[_0x79e3('0x2d')][_0x79e3('0x36')]);_0x197aec[_0x79e3('0x37')]=qs[_0x79e3('0x2f')](_[_0x79e3('0x38')](_0x489b06['query'],_0x348ba7[_0x79e3('0x2f')]),_0x4aa548);if(_0x489b06[_0x79e3('0x2d')][_0x79e3('0x39')]){_0x197aec[_0x79e3('0x37')]=_['merge'](_0x197aec[_0x79e3('0x37')],{'$or':_[_0x79e3('0x28')](_0x4aa548,function(_0x5f53f1){if(_0x5f53f1['type']!==_0x79e3('0x3a')){var _0x253c99={};_0x253c99[_0x5f53f1[_0x79e3('0x25')]]={'$like':'%'+_0x489b06[_0x79e3('0x2d')]['filter']+'%'};return _0x253c99;}})});}_0x197aec=_['merge']({},_0x197aec,_0x489b06[_0x79e3('0x3b')]);var _0x28a970={'where':_0x197aec['where']};return db[_0x79e3('0x29')][_0x79e3('0x3c')](_0x28a970)[_0x79e3('0x21')](function(_0x42cb98){_0x46538d[_0x79e3('0x3c')]=_0x42cb98;if(_0x489b06[_0x79e3('0x2d')][_0x79e3('0x3d')]){_0x197aec[_0x79e3('0x3e')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x197aec);})[_0x79e3('0x21')](function(_0x230c4b){_0x46538d[_0x79e3('0x3f')]=_0x230c4b;return _0x46538d;})[_0x79e3('0x21')](respondWithFilteredResult(_0x45d50d,_0x197aec))['catch'](handleError(_0x45d50d,null));};exports[_0x79e3('0x40')]=function(_0x5cec37,_0x458da6){var _0x400927={'raw':!![],'where':{'id':_0x5cec37[_0x79e3('0x41')]['id']}},_0x4e2011={};_0x4e2011[_0x79e3('0x2c')]=_[_0x79e3('0x2e')](db[_0x79e3('0x29')][_0x79e3('0x2a')]);_0x4e2011[_0x79e3('0x2d')]=_['keys'](_0x5cec37[_0x79e3('0x2d')]);_0x4e2011[_0x79e3('0x2f')]=_[_0x79e3('0x30')](_0x4e2011[_0x79e3('0x2c')],_0x4e2011[_0x79e3('0x2d')]);_0x400927[_0x79e3('0x31')]=_['intersection'](_0x4e2011[_0x79e3('0x2c')],qs[_0x79e3('0x32')](_0x5cec37[_0x79e3('0x2d')][_0x79e3('0x32')]));_0x400927['attributes']=_0x400927[_0x79e3('0x31')][_0x79e3('0x33')]?_0x400927[_0x79e3('0x31')]:_0x4e2011['model'];if(_0x5cec37[_0x79e3('0x2d')][_0x79e3('0x3d')]){_0x400927[_0x79e3('0x3e')]=[{'all':!![]}];}_0x400927=_['merge']({},_0x400927,_0x5cec37[_0x79e3('0x3b')]);return db[_0x79e3('0x29')][_0x79e3('0x42')](_0x400927)[_0x79e3('0x21')](handleEntityNotFound(_0x458da6,null))['then'](respondWithResult(_0x458da6,null))['catch'](handleError(_0x458da6,null));};exports['create']=function(_0x49d546,_0x285a57){return db['MailSubstatus'][_0x79e3('0x43')](_0x49d546[_0x79e3('0x44')],{})[_0x79e3('0x21')](respondWithResult(_0x285a57,0xc9))[_0x79e3('0x45')](handleError(_0x285a57,null));};exports[_0x79e3('0x20')]=function(_0x3fe51d,_0x50610f){if(_0x3fe51d[_0x79e3('0x44')]['id']){delete _0x3fe51d[_0x79e3('0x44')]['id'];}return db[_0x79e3('0x29')]['find']({'where':{'id':_0x3fe51d[_0x79e3('0x41')]['id']}})['then'](handleEntityNotFound(_0x50610f,null))['then'](saveUpdates(_0x3fe51d[_0x79e3('0x44')],null))[_0x79e3('0x21')](respondWithResult(_0x50610f,null))[_0x79e3('0x45')](handleError(_0x50610f,null));};exports[_0x79e3('0x22')]=function(_0x2659a7,_0x118624){return db['MailSubstatus'][_0x79e3('0x42')]({'where':{'id':_0x2659a7[_0x79e3('0x41')]['id']}})[_0x79e3('0x21')](handleEntityNotFound(_0x118624,null))[_0x79e3('0x21')](removeEntity(_0x118624,null))[_0x79e3('0x45')](handleError(_0x118624,null));};exports[_0x79e3('0x46')]=function(_0x38b84c,_0x32dcf1){return db['MailSubstatus'][_0x79e3('0x46')]()[_0x79e3('0x21')](respondWithResult(_0x32dcf1,null))['catch'](handleError(_0x32dcf1,null));}; \ No newline at end of file +var _0x2b8b=['moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','keys','query','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','params','intersection','fields','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x332264,_0x15ad59){var _0x214cd2=function(_0xfd3d65){while(--_0xfd3d65){_0x332264['push'](_0x332264['shift']());}};_0x214cd2(++_0x15ad59);}(_0x2b8b,0xce));var _0xb2b8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2b8b[_0x2641f9];return _0x585741;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb2b8('0x0'));var zipdir=require(_0xb2b8('0x1'));var jsonpatch=require(_0xb2b8('0x2'));var rp=require(_0xb2b8('0x3'));var moment=require(_0xb2b8('0x4'));var BPromise=require(_0xb2b8('0x5'));var Mustache=require(_0xb2b8('0x6'));var util=require(_0xb2b8('0x7'));var path=require('path');var sox=require(_0xb2b8('0x8'));var csv=require(_0xb2b8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb2b8('0xa'));var squel=require('squel');var crypto=require(_0xb2b8('0xb'));var jsforce=require(_0xb2b8('0xc'));var deskjs=require(_0xb2b8('0xd'));var toCsv=require(_0xb2b8('0x9'));var querystring=require('querystring');var Papa=require(_0xb2b8('0xe'));var Redis=require('ioredis');var authService=require(_0xb2b8('0xf'));var qs=require(_0xb2b8('0x10'));var as=require(_0xb2b8('0x11'));var hardwareService=require(_0xb2b8('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xb2b8('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d226c,_0x3b08e7){_0x3b08e7=_0x3b08e7||0xcc;return function(_0x255e73){if(_0x255e73){return _0x1d226c[_0xb2b8('0x14')](_0x3b08e7);}return _0x1d226c[_0xb2b8('0x15')](_0x3b08e7)[_0xb2b8('0x16')]();};}function respondWithResult(_0x2bbfb,_0x44639f){_0x44639f=_0x44639f||0xc8;return function(_0x6e914c){if(_0x6e914c){return _0x2bbfb[_0xb2b8('0x15')](_0x44639f)[_0xb2b8('0x17')](_0x6e914c);}};}function respondWithFilteredResult(_0x3a675c,_0x34ca0a){return function(_0x467b89){if(_0x467b89){var _0x33ed53=_0x467b89['count'],_0x3fea04=_0x34ca0a[_0xb2b8('0x18')],_0x163b83=_0x34ca0a[_0xb2b8('0x18')]+_0x34ca0a[_0xb2b8('0x19')],_0x5c55af;if(_0x163b83>=_0x33ed53){_0x163b83=_0x33ed53;_0x5c55af=0xc8;}else{_0x5c55af=0xce;}_0x3a675c[_0xb2b8('0x15')](_0x5c55af);return _0x3a675c[_0xb2b8('0x1a')](_0xb2b8('0x1b'),_0x3fea04+'-'+_0x163b83+'/'+_0x33ed53)[_0xb2b8('0x17')](_0x467b89);}return null;};}function patchUpdates(_0x4e8943){return function(_0x46273c){try{jsonpatch[_0xb2b8('0x1c')](_0x46273c,_0x4e8943,!![]);}catch(_0x4ebb81){return BPromise[_0xb2b8('0x1d')](_0x4ebb81);}return _0x46273c[_0xb2b8('0x1e')]();};}function saveUpdates(_0x393725,_0x568201){return function(_0x552ff2){if(_0x552ff2){return _0x552ff2[_0xb2b8('0x1f')](_0x393725)[_0xb2b8('0x20')](function(_0x1af211){return _0x1af211;});}return null;};}function removeEntity(_0x101d50,_0x4761aa){return function(_0x37227c){if(_0x37227c){return _0x37227c['destroy']()[_0xb2b8('0x20')](function(){_0x101d50[_0xb2b8('0x15')](0xcc)[_0xb2b8('0x16')]();});}};}function handleEntityNotFound(_0x3d6771,_0x4235ed){return function(_0x3f4188){if(!_0x3f4188){_0x3d6771[_0xb2b8('0x14')](0x194);}return _0x3f4188;};}function handleError(_0x439f67,_0x441cb4){_0x441cb4=_0x441cb4||0x1f4;return function(_0x5365c5){logger['error'](_0x5365c5[_0xb2b8('0x21')]);if(_0x5365c5[_0xb2b8('0x22')]){delete _0x5365c5[_0xb2b8('0x22')];}_0x439f67[_0xb2b8('0x15')](_0x441cb4)['send'](_0x5365c5);};}exports[_0xb2b8('0x23')]=function(_0x539968,_0x265e54){var _0x1dc786={},_0x2dffe2={},_0x18c2bc={'count':0x0,'rows':[]};var _0xd6e93e=_[_0xb2b8('0x24')](db[_0xb2b8('0x25')][_0xb2b8('0x26')],function(_0x52de08){return{'name':_0x52de08[_0xb2b8('0x27')],'type':_0x52de08[_0xb2b8('0x28')][_0xb2b8('0x29')]};});_0x2dffe2[_0xb2b8('0x2a')]=_[_0xb2b8('0x24')](_0xd6e93e,_0xb2b8('0x22'));_0x2dffe2['query']=_[_0xb2b8('0x2b')](_0x539968['query']);_0x2dffe2['filters']=_['intersection'](_0x2dffe2[_0xb2b8('0x2a')],_0x2dffe2[_0xb2b8('0x2c')]);_0x1dc786[_0xb2b8('0x2d')]=_['intersection'](_0x2dffe2[_0xb2b8('0x2a')],qs['fields'](_0x539968[_0xb2b8('0x2c')]['fields']));_0x1dc786[_0xb2b8('0x2d')]=_0x1dc786[_0xb2b8('0x2d')][_0xb2b8('0x2e')]?_0x1dc786[_0xb2b8('0x2d')]:_0x2dffe2['model'];if(!_0x539968[_0xb2b8('0x2c')]['hasOwnProperty'](_0xb2b8('0x2f'))){_0x1dc786['limit']=qs[_0xb2b8('0x19')](_0x539968['query'][_0xb2b8('0x19')]);_0x1dc786[_0xb2b8('0x18')]=qs[_0xb2b8('0x18')](_0x539968[_0xb2b8('0x2c')]['offset']);}_0x1dc786[_0xb2b8('0x30')]=qs[_0xb2b8('0x31')](_0x539968[_0xb2b8('0x2c')]['sort']);_0x1dc786['where']=qs[_0xb2b8('0x32')](_[_0xb2b8('0x33')](_0x539968['query'],_0x2dffe2[_0xb2b8('0x32')]),_0xd6e93e);if(_0x539968[_0xb2b8('0x2c')][_0xb2b8('0x34')]){_0x1dc786[_0xb2b8('0x35')]=_[_0xb2b8('0x36')](_0x1dc786[_0xb2b8('0x35')],{'$or':_[_0xb2b8('0x24')](_0xd6e93e,function(_0x3c0fcb){if(_0x3c0fcb[_0xb2b8('0x28')]!==_0xb2b8('0x37')){var _0x4a65ba={};_0x4a65ba[_0x3c0fcb[_0xb2b8('0x22')]]={'$like':'%'+_0x539968[_0xb2b8('0x2c')][_0xb2b8('0x34')]+'%'};return _0x4a65ba;}})});}_0x1dc786=_[_0xb2b8('0x36')]({},_0x1dc786,_0x539968['options']);var _0x500e50={'where':_0x1dc786['where']};return db[_0xb2b8('0x25')][_0xb2b8('0x38')](_0x500e50)[_0xb2b8('0x20')](function(_0x174e7f){_0x18c2bc[_0xb2b8('0x38')]=_0x174e7f;if(_0x539968[_0xb2b8('0x2c')][_0xb2b8('0x39')]){_0x1dc786[_0xb2b8('0x3a')]=[{'all':!![]}];}return db[_0xb2b8('0x25')][_0xb2b8('0x3b')](_0x1dc786);})[_0xb2b8('0x20')](function(_0x45686e){_0x18c2bc['rows']=_0x45686e;return _0x18c2bc;})[_0xb2b8('0x20')](respondWithFilteredResult(_0x265e54,_0x1dc786))[_0xb2b8('0x3c')](handleError(_0x265e54,null));};exports[_0xb2b8('0x3d')]=function(_0x5368fa,_0x55936d){var _0x56e5be={'raw':!![],'where':{'id':_0x5368fa[_0xb2b8('0x3e')]['id']}},_0x521bdc={};_0x521bdc['model']=_[_0xb2b8('0x2b')](db[_0xb2b8('0x25')][_0xb2b8('0x26')]);_0x521bdc['query']=_[_0xb2b8('0x2b')](_0x5368fa[_0xb2b8('0x2c')]);_0x521bdc['filters']=_['intersection'](_0x521bdc['model'],_0x521bdc['query']);_0x56e5be[_0xb2b8('0x2d')]=_[_0xb2b8('0x3f')](_0x521bdc[_0xb2b8('0x2a')],qs[_0xb2b8('0x40')](_0x5368fa[_0xb2b8('0x2c')][_0xb2b8('0x40')]));_0x56e5be[_0xb2b8('0x2d')]=_0x56e5be['attributes'][_0xb2b8('0x2e')]?_0x56e5be[_0xb2b8('0x2d')]:_0x521bdc[_0xb2b8('0x2a')];if(_0x5368fa[_0xb2b8('0x2c')][_0xb2b8('0x39')]){_0x56e5be[_0xb2b8('0x3a')]=[{'all':!![]}];}_0x56e5be=_[_0xb2b8('0x36')]({},_0x56e5be,_0x5368fa['options']);return db[_0xb2b8('0x25')][_0xb2b8('0x41')](_0x56e5be)[_0xb2b8('0x20')](handleEntityNotFound(_0x55936d,null))[_0xb2b8('0x20')](respondWithResult(_0x55936d,null))['catch'](handleError(_0x55936d,null));};exports[_0xb2b8('0x42')]=function(_0x4cc2a6,_0x18dd23){return db['MailSubstatus']['create'](_0x4cc2a6[_0xb2b8('0x43')],{})[_0xb2b8('0x20')](respondWithResult(_0x18dd23,0xc9))[_0xb2b8('0x3c')](handleError(_0x18dd23,null));};exports[_0xb2b8('0x1f')]=function(_0x2121c1,_0x5ef464){if(_0x2121c1[_0xb2b8('0x43')]['id']){delete _0x2121c1[_0xb2b8('0x43')]['id'];}return db['MailSubstatus'][_0xb2b8('0x41')]({'where':{'id':_0x2121c1[_0xb2b8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5ef464,null))[_0xb2b8('0x20')](saveUpdates(_0x2121c1['body'],null))[_0xb2b8('0x20')](respondWithResult(_0x5ef464,null))[_0xb2b8('0x3c')](handleError(_0x5ef464,null));};exports[_0xb2b8('0x44')]=function(_0x979a46,_0xcd3b77){return db[_0xb2b8('0x25')]['find']({'where':{'id':_0x979a46[_0xb2b8('0x3e')]['id']}})[_0xb2b8('0x20')](handleEntityNotFound(_0xcd3b77,null))[_0xb2b8('0x20')](removeEntity(_0xcd3b77,null))[_0xb2b8('0x3c')](handleError(_0xcd3b77,null));};exports['describe']=function(_0x253357,_0x1ea0f7){return db['MailSubstatus'][_0xb2b8('0x45')]()[_0xb2b8('0x20')](respondWithResult(_0x1ea0f7,null))[_0xb2b8('0x3c')](handleError(_0x1ea0f7,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 006421d..48c8a37 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 _0xe17b=['moment','bluebird','path','rimraf','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','lodash','util','../../config/logger','api'];(function(_0xc0a86e,_0x4081b0){var _0x46b304=function(_0x3fa3cb){while(--_0x3fa3cb){_0xc0a86e['push'](_0xc0a86e['shift']());}};_0x46b304(++_0x4081b0);}(_0xe17b,0x1c4));var _0xbe17=function(_0x3f6b1b,_0x58d3d6){_0x3f6b1b=_0x3f6b1b-0x0;var _0x4a3d2b=_0xe17b[_0x3f6b1b];return _0x4a3d2b;};'use strict';var _=require(_0xbe17('0x0'));var util=require(_0xbe17('0x1'));var logger=require(_0xbe17('0x2'))(_0xbe17('0x3'));var moment=require(_0xbe17('0x4'));var BPromise=require(_0xbe17('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe17('0x6'));var rimraf=require(_0xbe17('0x7'));var config=require(_0xbe17('0x8'));var attributes=require(_0xbe17('0x9'));module['exports']=function(_0x260d2d,_0x5beb9c){return _0x260d2d[_0xbe17('0xa')](_0xbe17('0xb'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ca4=['exports','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','rimraf','./mailSubstatus.attributes'];(function(_0x5eaf1f,_0xac547c){var _0x24e765=function(_0x412b0f){while(--_0x412b0f){_0x5eaf1f['push'](_0x5eaf1f['shift']());}};_0x24e765(++_0xac547c);}(_0x0ca4,0x93));var _0x40ca=function(_0x207bd6,_0x348742){_0x207bd6=_0x207bd6-0x0;var _0x413416=_0x0ca4[_0x207bd6];return _0x413416;};'use strict';var _=require(_0x40ca('0x0'));var util=require(_0x40ca('0x1'));var logger=require(_0x40ca('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x40ca('0x3'));var config=require('../../config/environment');var attributes=require(_0x40ca('0x4'));module[_0x40ca('0x5')]=function(_0xaa1132,_0x38add5){return _0xaa1132['define'](_0x40ca('0x6'),attributes,{'tableName':_0x40ca('0x7'),'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 345f1fb..eb7decf 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 _0xa75b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1bf4f9,_0x5f33bf){var _0x25592c=function(_0x529d29){while(--_0x529d29){_0x1bf4f9['push'](_0x1bf4f9['shift']());}};_0x25592c(++_0x5f33bf);}(_0xa75b,0x170));var _0xba75=function(_0x4bef9e,_0x309963){_0x4bef9e=_0x4bef9e-0x0;var _0x3d0b1f=_0xa75b[_0x4bef9e];return _0x3d0b1f;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba75('0x1'));var rs=require(_0xba75('0x2'));var fs=require('fs');var Redis=require(_0xba75('0x3'));var db=require(_0xba75('0x4'))['db'];var utils=require(_0xba75('0x5'));var logger=require(_0xba75('0x6'))(_0xba75('0x7'));var config=require(_0xba75('0x8'));var jayson=require(_0xba75('0x9'));var client=jayson[_0xba75('0xa')][_0xba75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238a33,_0x3ccab5,_0x5c79e3){return new BPromise(function(_0x4b842d,_0x731cae){return client['request'](_0x238a33,_0x5c79e3)['then'](function(_0x218dbd){logger['info'](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));logger[_0xba75('0xe')](_0xba75('0xf'),_0x3ccab5,_0xba75('0xd'),JSON[_0xba75('0x10')](_0x218dbd));if(_0x218dbd[_0xba75('0x11')]){if(_0x218dbd[_0xba75('0x11')][_0xba75('0x12')]===0x1f4){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')]['message']);return _0x731cae(_0x218dbd['error'][_0xba75('0x13')]);}logger['error'](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')][_0xba75('0x13')]);return _0x4b842d(_0x218dbd[_0xba75('0x11')]['message']);}else{logger[_0xba75('0x14')](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));_0x4b842d(_0x218dbd[_0xba75('0x15')][_0xba75('0x13')]);}})['catch'](function(_0x350a9d){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x350a9d);_0x731cae(_0x350a9d);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x546ca4,_0x2f0016){_0x546ca4=_0x546ca4-0x0;var _0x47e1bd=_0xbdb7[_0x546ca4];return _0x47e1bd;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 8e28bfb..49a7b7d 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 _0x2122=['show','post','create','put','/:id','update','delete','destroy','exports','path','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x370021,_0x3453c9){var _0x299767=function(_0x3a1a52){while(--_0x3a1a52){_0x370021['push'](_0x370021['shift']());}};_0x299767(++_0x3453c9);}(_0x2122,0xf3));var _0x2212=function(_0x5a4b5a,_0x16af6e){_0x5a4b5a=_0x5a4b5a-0x0;var _0x2f57bf=_0x2122[_0x5a4b5a];return _0x2f57bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2212('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2212('0x1')]();var auth=require(_0x2212('0x2'));var interaction=require(_0x2212('0x3'));var config=require('../../config/environment');var controller=require(_0x2212('0x4'));router[_0x2212('0x5')]('/',auth[_0x2212('0x6')](),controller[_0x2212('0x7')]);router[_0x2212('0x5')](_0x2212('0x8'),auth[_0x2212('0x6')](),controller['describe']);router[_0x2212('0x5')]('/:id',auth[_0x2212('0x6')](),controller[_0x2212('0x9')]);router[_0x2212('0xa')]('/',auth['isAuthenticated'](),controller[_0x2212('0xb')]);router[_0x2212('0xc')](_0x2212('0xd'),auth[_0x2212('0x6')](),controller[_0x2212('0xe')]);router[_0x2212('0xf')](_0x2212('0xd'),auth[_0x2212('0x6')](),controller[_0x2212('0x10')]);module[_0x2212('0x11')]=router; \ No newline at end of file +var _0x0953=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../config/environment','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x28dda8,_0x39ba67){var _0x57738e=function(_0x30cdd1){while(--_0x30cdd1){_0x28dda8['push'](_0x28dda8['shift']());}};_0x57738e(++_0x39ba67);}(_0x0953,0x137));var _0x3095=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0x0953[_0x111e94];return _0x3de107;};'use strict';var multer=require('multer');var util=require(_0x3095('0x0'));var path=require(_0x3095('0x1'));var timeout=require(_0x3095('0x2'));var express=require(_0x3095('0x3'));var router=express[_0x3095('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3095('0x5'));var controller=require(_0x3095('0x6'));router[_0x3095('0x7')]('/',auth[_0x3095('0x8')](),controller[_0x3095('0x9')]);router[_0x3095('0x7')](_0x3095('0xa'),auth['isAuthenticated'](),controller[_0x3095('0xb')]);router[_0x3095('0x7')](_0x3095('0xc'),auth[_0x3095('0x8')](),controller[_0x3095('0xd')]);router[_0x3095('0xe')]('/',auth['isAuthenticated'](),controller[_0x3095('0xf')]);router[_0x3095('0x10')]('/:id',auth[_0x3095('0x8')](),controller[_0x3095('0x11')]);router[_0x3095('0x12')](_0x3095('0xc'),auth[_0x3095('0x8')](),controller[_0x3095('0x13')]);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 daa50e4..019bcf4 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 _0x6870=['queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x37e974,_0x439356){var _0x1f38c2=function(_0x5caedc){while(--_0x5caedc){_0x37e974['push'](_0x37e974['shift']());}};_0x1f38c2(++_0x439356);}(_0x6870,0x1d0));var _0x0687=function(_0x5d72c8,_0x85e2e1){_0x5d72c8=_0x5d72c8-0x0;var _0x3abc9e=_0x6870[_0x5d72c8];return _0x3abc9e;};'use strict';var moment=require('moment');var Sequelize=require(_0x0687('0x0'));module[_0x0687('0x1')]={'uniqueid':{'type':Sequelize[_0x0687('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0687('0x3')](_0x0687('0x4'),'agent',_0x0687('0x5')),'allowNull':![],'defaultValue':_0x0687('0x5')},'transferredAt':{'type':Sequelize[_0x0687('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xf407=['queue','DATE','moment','sequelize','exports','ENUM'];(function(_0x6029ff,_0x189ce9){var _0x36c1d2=function(_0x23eab5){while(--_0x23eab5){_0x6029ff['push'](_0x6029ff['shift']());}};_0x36c1d2(++_0x189ce9);}(_0xf407,0xd4));var _0x7f40=function(_0x30c330,_0x5da11e){_0x30c330=_0x30c330-0x0;var _0x3101ed=_0xf407[_0x30c330];return _0x3101ed;};'use strict';var moment=require(_0x7f40('0x0'));var Sequelize=require(_0x7f40('0x1'));module[_0x7f40('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7f40('0x3')]('account','agent',_0x7f40('0x4')),'allowNull':![],'defaultValue':_0x7f40('0x4')},'transferredAt':{'type':Sequelize[_0x7f40('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 6857451..5687763 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 _0x67c9=['include','findAll','show','params','keys','length','find','create','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options'];(function(_0x2d088c,_0x539a1b){var _0x4b9713=function(_0x32b1f6){while(--_0x32b1f6){_0x2d088c['push'](_0x2d088c['shift']());}};_0x4b9713(++_0x539a1b);}(_0x67c9,0xe6));var _0x967c=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0x67c9[_0x5e6ea3];return _0x4048b5;};'use strict';var pdf=require(_0x967c('0x0'));var emlformat=require(_0x967c('0x1'));var rimraf=require(_0x967c('0x2'));var zipdir=require(_0x967c('0x3'));var jsonpatch=require(_0x967c('0x4'));var rp=require(_0x967c('0x5'));var moment=require(_0x967c('0x6'));var BPromise=require(_0x967c('0x7'));var Mustache=require(_0x967c('0x8'));var util=require(_0x967c('0x9'));var path=require('path');var sox=require(_0x967c('0xa'));var csv=require('to-csv');var ejs=require(_0x967c('0xb'));var fs=require('fs');var _=require(_0x967c('0xc'));var squel=require(_0x967c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x967c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x967c('0xf'));var Papa=require(_0x967c('0x10'));var Redis=require(_0x967c('0x11'));var authService=require(_0x967c('0x12'));var qs=require(_0x967c('0x13'));var as=require(_0x967c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x967c('0x15'));var utils=require(_0x967c('0x16'));var config=require(_0x967c('0x17'));var db=require(_0x967c('0x18'))['db'];function respondWithStatusCode(_0x31ed6a,_0x17c5f6){_0x17c5f6=_0x17c5f6||0xcc;return function(_0xcf025b){if(_0xcf025b){return _0x31ed6a[_0x967c('0x19')](_0x17c5f6);}return _0x31ed6a['status'](_0x17c5f6)[_0x967c('0x1a')]();};}function respondWithResult(_0x5ebd06,_0x406402){_0x406402=_0x406402||0xc8;return function(_0x520b5e){if(_0x520b5e){return _0x5ebd06[_0x967c('0x1b')](_0x406402)[_0x967c('0x1c')](_0x520b5e);}};}function respondWithFilteredResult(_0x397691,_0x5aadcb){return function(_0x4a627a){if(_0x4a627a){var _0x3cb069=_0x4a627a[_0x967c('0x1d')],_0xfc0107=_0x5aadcb[_0x967c('0x1e')],_0x1e8122=_0x5aadcb[_0x967c('0x1e')]+_0x5aadcb[_0x967c('0x1f')],_0x210449;if(_0x1e8122>=_0x3cb069){_0x1e8122=_0x3cb069;_0x210449=0xc8;}else{_0x210449=0xce;}_0x397691[_0x967c('0x1b')](_0x210449);return _0x397691[_0x967c('0x20')](_0x967c('0x21'),_0xfc0107+'-'+_0x1e8122+'/'+_0x3cb069)[_0x967c('0x1c')](_0x4a627a);}return null;};}function patchUpdates(_0x537a42){return function(_0x34873f){try{jsonpatch['apply'](_0x34873f,_0x537a42,!![]);}catch(_0xb553cb){return BPromise[_0x967c('0x22')](_0xb553cb);}return _0x34873f[_0x967c('0x23')]();};}function saveUpdates(_0x371bef,_0x41042e){return function(_0x477d89){if(_0x477d89){return _0x477d89[_0x967c('0x24')](_0x371bef)[_0x967c('0x25')](function(_0x425228){return _0x425228;});}return null;};}function removeEntity(_0x64a791,_0x3b584d){return function(_0x169399){if(_0x169399){return _0x169399[_0x967c('0x26')]()[_0x967c('0x25')](function(){_0x64a791[_0x967c('0x1b')](0xcc)[_0x967c('0x1a')]();});}};}function handleEntityNotFound(_0x1e93e0,_0x5c71ca){return function(_0x44fceb){if(!_0x44fceb){_0x1e93e0[_0x967c('0x19')](0x194);}return _0x44fceb;};}function handleError(_0xd7aa15,_0x4293e8){_0x4293e8=_0x4293e8||0x1f4;return function(_0x12747d){logger[_0x967c('0x27')](_0x12747d['stack']);if(_0x12747d[_0x967c('0x28')]){delete _0x12747d[_0x967c('0x28')];}_0xd7aa15[_0x967c('0x1b')](_0x4293e8)[_0x967c('0x29')](_0x12747d);};}exports[_0x967c('0x2a')]=function(_0x5ab535,_0x4c3486){var _0xc6fa57={},_0xbd5388={},_0x230227={'count':0x0,'rows':[]};var _0x14b046=_[_0x967c('0x2b')](db[_0x967c('0x2c')][_0x967c('0x2d')],function(_0x11f0b9){return{'name':_0x11f0b9[_0x967c('0x2e')],'type':_0x11f0b9[_0x967c('0x2f')]['key']};});_0xbd5388[_0x967c('0x30')]=_['map'](_0x14b046,_0x967c('0x28'));_0xbd5388[_0x967c('0x31')]=_['keys'](_0x5ab535['query']);_0xbd5388[_0x967c('0x32')]=_['intersection'](_0xbd5388[_0x967c('0x30')],_0xbd5388[_0x967c('0x31')]);_0xc6fa57[_0x967c('0x33')]=_[_0x967c('0x34')](_0xbd5388[_0x967c('0x30')],qs[_0x967c('0x35')](_0x5ab535[_0x967c('0x31')]['fields']));_0xc6fa57[_0x967c('0x33')]=_0xc6fa57[_0x967c('0x33')]['length']?_0xc6fa57[_0x967c('0x33')]:_0xbd5388[_0x967c('0x30')];if(!_0x5ab535['query'][_0x967c('0x36')]('nolimit')){_0xc6fa57['limit']=qs[_0x967c('0x1f')](_0x5ab535['query'][_0x967c('0x1f')]);_0xc6fa57[_0x967c('0x1e')]=qs[_0x967c('0x1e')](_0x5ab535['query'][_0x967c('0x1e')]);}_0xc6fa57[_0x967c('0x37')]=qs[_0x967c('0x38')](_0x5ab535[_0x967c('0x31')]['sort']);_0xc6fa57['where']=qs['filters'](_['pick'](_0x5ab535['query'],_0xbd5388[_0x967c('0x32')]),_0x14b046);if(_0x5ab535[_0x967c('0x31')][_0x967c('0x39')]){_0xc6fa57[_0x967c('0x3a')]=_[_0x967c('0x3b')](_0xc6fa57['where'],{'$or':_[_0x967c('0x2b')](_0x14b046,function(_0x329951){if(_0x329951[_0x967c('0x2f')]!==_0x967c('0x3c')){var _0x19bc3b={};_0x19bc3b[_0x329951[_0x967c('0x28')]]={'$like':'%'+_0x5ab535[_0x967c('0x31')][_0x967c('0x39')]+'%'};return _0x19bc3b;}})});}_0xc6fa57=_['merge']({},_0xc6fa57,_0x5ab535[_0x967c('0x3d')]);var _0x3a09ea={'where':_0xc6fa57[_0x967c('0x3a')]};return db[_0x967c('0x2c')][_0x967c('0x1d')](_0x3a09ea)['then'](function(_0x55098e){_0x230227['count']=_0x55098e;if(_0x5ab535[_0x967c('0x31')]['includeAll']){_0xc6fa57[_0x967c('0x3e')]=[{'all':!![]}];}return db[_0x967c('0x2c')][_0x967c('0x3f')](_0xc6fa57);})[_0x967c('0x25')](function(_0x5dd0ad){_0x230227['rows']=_0x5dd0ad;return _0x230227;})[_0x967c('0x25')](respondWithFilteredResult(_0x4c3486,_0xc6fa57))['catch'](handleError(_0x4c3486,null));};exports[_0x967c('0x40')]=function(_0x19de08,_0x1dde22){var _0x2e3904={'raw':!![],'where':{'id':_0x19de08[_0x967c('0x41')]['id']}},_0x420889={};_0x420889[_0x967c('0x30')]=_[_0x967c('0x42')](db[_0x967c('0x2c')]['rawAttributes']);_0x420889[_0x967c('0x31')]=_[_0x967c('0x42')](_0x19de08[_0x967c('0x31')]);_0x420889[_0x967c('0x32')]=_[_0x967c('0x34')](_0x420889[_0x967c('0x30')],_0x420889[_0x967c('0x31')]);_0x2e3904[_0x967c('0x33')]=_[_0x967c('0x34')](_0x420889[_0x967c('0x30')],qs[_0x967c('0x35')](_0x19de08[_0x967c('0x31')][_0x967c('0x35')]));_0x2e3904[_0x967c('0x33')]=_0x2e3904[_0x967c('0x33')][_0x967c('0x43')]?_0x2e3904['attributes']:_0x420889[_0x967c('0x30')];if(_0x19de08[_0x967c('0x31')]['includeAll']){_0x2e3904['include']=[{'all':!![]}];}_0x2e3904=_[_0x967c('0x3b')]({},_0x2e3904,_0x19de08[_0x967c('0x3d')]);return db[_0x967c('0x2c')][_0x967c('0x44')](_0x2e3904)[_0x967c('0x25')](handleEntityNotFound(_0x1dde22,null))[_0x967c('0x25')](respondWithResult(_0x1dde22,null))['catch'](handleError(_0x1dde22,null));};exports[_0x967c('0x45')]=function(_0x19e2df,_0x142d3b){return db['MailTransferReport']['create'](_0x19e2df['body'],{})['then'](respondWithResult(_0x142d3b,0xc9))['catch'](handleError(_0x142d3b,null));};exports[_0x967c('0x24')]=function(_0x3baed0,_0x32ed1c){if(_0x3baed0[_0x967c('0x46')]['id']){delete _0x3baed0['body']['id'];}return db[_0x967c('0x2c')][_0x967c('0x44')]({'where':{'id':_0x3baed0[_0x967c('0x41')]['id']}})[_0x967c('0x25')](handleEntityNotFound(_0x32ed1c,null))[_0x967c('0x25')](saveUpdates(_0x3baed0[_0x967c('0x46')],null))[_0x967c('0x25')](respondWithResult(_0x32ed1c,null))[_0x967c('0x47')](handleError(_0x32ed1c,null));};exports[_0x967c('0x26')]=function(_0x4892c3,_0x38aad5){return db[_0x967c('0x2c')][_0x967c('0x44')]({'where':{'id':_0x4892c3['params']['id']}})['then'](handleEntityNotFound(_0x38aad5,null))[_0x967c('0x25')](removeEntity(_0x38aad5,null))['catch'](handleError(_0x38aad5,null));};exports[_0x967c('0x48')]=function(_0x590b64,_0x4fba70){return db[_0x967c('0x2c')][_0x967c('0x48')]()[_0x967c('0x25')](respondWithResult(_0x4fba70,null))[_0x967c('0x47')](handleError(_0x4fba70,null));}; \ No newline at end of file +var _0x3803=['to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','MailTransferReport','count','includeAll','include','rows','show','params','find','catch','create','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x115894,_0x4b1f30){var _0x45b51c=function(_0x18b628){while(--_0x18b628){_0x115894['push'](_0x115894['shift']());}};_0x45b51c(++_0x4b1f30);}(_0x3803,0x8a));var _0x3380=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x3803[_0x1cc8fe];return _0x230054;};'use strict';var pdf=require(_0x3380('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3380('0x1'));var jsonpatch=require(_0x3380('0x2'));var rp=require(_0x3380('0x3'));var moment=require(_0x3380('0x4'));var BPromise=require(_0x3380('0x5'));var Mustache=require(_0x3380('0x6'));var util=require(_0x3380('0x7'));var path=require(_0x3380('0x8'));var sox=require(_0x3380('0x9'));var csv=require(_0x3380('0xa'));var ejs=require(_0x3380('0xb'));var fs=require('fs');var _=require(_0x3380('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3380('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3380('0xa'));var querystring=require(_0x3380('0xe'));var Papa=require(_0x3380('0xf'));var Redis=require(_0x3380('0x10'));var authService=require(_0x3380('0x11'));var qs=require(_0x3380('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3380('0x13'));var logger=require(_0x3380('0x14'))('api');var utils=require(_0x3380('0x15'));var config=require(_0x3380('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf08ec5,_0x57d0d7){_0x57d0d7=_0x57d0d7||0xcc;return function(_0x5672ec){if(_0x5672ec){return _0xf08ec5['sendStatus'](_0x57d0d7);}return _0xf08ec5[_0x3380('0x17')](_0x57d0d7)[_0x3380('0x18')]();};}function respondWithResult(_0x99c0d2,_0x5e248e){_0x5e248e=_0x5e248e||0xc8;return function(_0x20b7ee){if(_0x20b7ee){return _0x99c0d2['status'](_0x5e248e)['json'](_0x20b7ee);}};}function respondWithFilteredResult(_0x2d0ed4,_0x38ea00){return function(_0xc82218){if(_0xc82218){var _0x3ca5ac=_0xc82218['count'],_0x30ac07=_0x38ea00['offset'],_0x5d348d=_0x38ea00[_0x3380('0x19')]+_0x38ea00[_0x3380('0x1a')],_0x4104fd;if(_0x5d348d>=_0x3ca5ac){_0x5d348d=_0x3ca5ac;_0x4104fd=0xc8;}else{_0x4104fd=0xce;}_0x2d0ed4[_0x3380('0x17')](_0x4104fd);return _0x2d0ed4[_0x3380('0x1b')](_0x3380('0x1c'),_0x30ac07+'-'+_0x5d348d+'/'+_0x3ca5ac)[_0x3380('0x1d')](_0xc82218);}return null;};}function patchUpdates(_0x32940b){return function(_0x2b9f8a){try{jsonpatch[_0x3380('0x1e')](_0x2b9f8a,_0x32940b,!![]);}catch(_0x4159c3){return BPromise[_0x3380('0x1f')](_0x4159c3);}return _0x2b9f8a[_0x3380('0x20')]();};}function saveUpdates(_0x1030c7,_0x4d9d6e){return function(_0x5d6ec2){if(_0x5d6ec2){return _0x5d6ec2[_0x3380('0x21')](_0x1030c7)[_0x3380('0x22')](function(_0x4d9ccd){return _0x4d9ccd;});}return null;};}function removeEntity(_0x3f42a6,_0x1887ab){return function(_0x45a2a8){if(_0x45a2a8){return _0x45a2a8[_0x3380('0x23')]()[_0x3380('0x22')](function(){_0x3f42a6[_0x3380('0x17')](0xcc)[_0x3380('0x18')]();});}};}function handleEntityNotFound(_0x22a176,_0xd7dc1d){return function(_0x20a704){if(!_0x20a704){_0x22a176[_0x3380('0x24')](0x194);}return _0x20a704;};}function handleError(_0x4fd949,_0x2ddb06){_0x2ddb06=_0x2ddb06||0x1f4;return function(_0x3645aa){logger['error'](_0x3645aa['stack']);if(_0x3645aa[_0x3380('0x25')]){delete _0x3645aa[_0x3380('0x25')];}_0x4fd949[_0x3380('0x17')](_0x2ddb06)[_0x3380('0x26')](_0x3645aa);};}exports[_0x3380('0x27')]=function(_0x591fcf,_0x420feb){var _0x16e12d={},_0x558bdd={},_0x44993a={'count':0x0,'rows':[]};var _0x2111c0=_['map'](db['MailTransferReport'][_0x3380('0x28')],function(_0x255a0c){return{'name':_0x255a0c[_0x3380('0x29')],'type':_0x255a0c[_0x3380('0x2a')][_0x3380('0x2b')]};});_0x558bdd['model']=_[_0x3380('0x2c')](_0x2111c0,_0x3380('0x25'));_0x558bdd[_0x3380('0x2d')]=_[_0x3380('0x2e')](_0x591fcf[_0x3380('0x2d')]);_0x558bdd[_0x3380('0x2f')]=_[_0x3380('0x30')](_0x558bdd[_0x3380('0x31')],_0x558bdd['query']);_0x16e12d[_0x3380('0x32')]=_[_0x3380('0x30')](_0x558bdd['model'],qs[_0x3380('0x33')](_0x591fcf['query'][_0x3380('0x33')]));_0x16e12d[_0x3380('0x32')]=_0x16e12d['attributes'][_0x3380('0x34')]?_0x16e12d[_0x3380('0x32')]:_0x558bdd['model'];if(!_0x591fcf['query'][_0x3380('0x35')](_0x3380('0x36'))){_0x16e12d['limit']=qs[_0x3380('0x1a')](_0x591fcf[_0x3380('0x2d')][_0x3380('0x1a')]);_0x16e12d[_0x3380('0x19')]=qs[_0x3380('0x19')](_0x591fcf['query'][_0x3380('0x19')]);}_0x16e12d['order']=qs['sort'](_0x591fcf[_0x3380('0x2d')][_0x3380('0x37')]);_0x16e12d['where']=qs[_0x3380('0x2f')](_[_0x3380('0x38')](_0x591fcf[_0x3380('0x2d')],_0x558bdd[_0x3380('0x2f')]),_0x2111c0);if(_0x591fcf['query'][_0x3380('0x39')]){_0x16e12d[_0x3380('0x3a')]=_[_0x3380('0x3b')](_0x16e12d[_0x3380('0x3a')],{'$or':_[_0x3380('0x2c')](_0x2111c0,function(_0x536fad){if(_0x536fad[_0x3380('0x2a')]!==_0x3380('0x3c')){var _0x14b7c7={};_0x14b7c7[_0x536fad[_0x3380('0x25')]]={'$like':'%'+_0x591fcf[_0x3380('0x2d')][_0x3380('0x39')]+'%'};return _0x14b7c7;}})});}_0x16e12d=_[_0x3380('0x3b')]({},_0x16e12d,_0x591fcf[_0x3380('0x3d')]);var _0x187d0a={'where':_0x16e12d['where']};return db[_0x3380('0x3e')][_0x3380('0x3f')](_0x187d0a)[_0x3380('0x22')](function(_0x167a6a){_0x44993a[_0x3380('0x3f')]=_0x167a6a;if(_0x591fcf[_0x3380('0x2d')][_0x3380('0x40')]){_0x16e12d[_0x3380('0x41')]=[{'all':!![]}];}return db[_0x3380('0x3e')]['findAll'](_0x16e12d);})['then'](function(_0x4808c7){_0x44993a[_0x3380('0x42')]=_0x4808c7;return _0x44993a;})[_0x3380('0x22')](respondWithFilteredResult(_0x420feb,_0x16e12d))['catch'](handleError(_0x420feb,null));};exports[_0x3380('0x43')]=function(_0x5c9ecd,_0x560228){var _0x28c940={'raw':!![],'where':{'id':_0x5c9ecd[_0x3380('0x44')]['id']}},_0x3c75e3={};_0x3c75e3[_0x3380('0x31')]=_[_0x3380('0x2e')](db['MailTransferReport'][_0x3380('0x28')]);_0x3c75e3['query']=_[_0x3380('0x2e')](_0x5c9ecd[_0x3380('0x2d')]);_0x3c75e3[_0x3380('0x2f')]=_[_0x3380('0x30')](_0x3c75e3[_0x3380('0x31')],_0x3c75e3[_0x3380('0x2d')]);_0x28c940[_0x3380('0x32')]=_[_0x3380('0x30')](_0x3c75e3[_0x3380('0x31')],qs[_0x3380('0x33')](_0x5c9ecd['query'][_0x3380('0x33')]));_0x28c940['attributes']=_0x28c940[_0x3380('0x32')][_0x3380('0x34')]?_0x28c940[_0x3380('0x32')]:_0x3c75e3[_0x3380('0x31')];if(_0x5c9ecd['query']['includeAll']){_0x28c940[_0x3380('0x41')]=[{'all':!![]}];}_0x28c940=_[_0x3380('0x3b')]({},_0x28c940,_0x5c9ecd[_0x3380('0x3d')]);return db[_0x3380('0x3e')][_0x3380('0x45')](_0x28c940)[_0x3380('0x22')](handleEntityNotFound(_0x560228,null))[_0x3380('0x22')](respondWithResult(_0x560228,null))[_0x3380('0x46')](handleError(_0x560228,null));};exports['create']=function(_0x166ee4,_0x2095fe){return db['MailTransferReport'][_0x3380('0x47')](_0x166ee4[_0x3380('0x48')],{})[_0x3380('0x22')](respondWithResult(_0x2095fe,0xc9))[_0x3380('0x46')](handleError(_0x2095fe,null));};exports[_0x3380('0x21')]=function(_0x86c39a,_0x5c6f3d){if(_0x86c39a[_0x3380('0x48')]['id']){delete _0x86c39a[_0x3380('0x48')]['id'];}return db[_0x3380('0x3e')]['find']({'where':{'id':_0x86c39a['params']['id']}})[_0x3380('0x22')](handleEntityNotFound(_0x5c6f3d,null))[_0x3380('0x22')](saveUpdates(_0x86c39a['body'],null))[_0x3380('0x22')](respondWithResult(_0x5c6f3d,null))['catch'](handleError(_0x5c6f3d,null));};exports[_0x3380('0x23')]=function(_0x5c5629,_0x559c81){return db['MailTransferReport'][_0x3380('0x45')]({'where':{'id':_0x5c5629[_0x3380('0x44')]['id']}})['then'](handleEntityNotFound(_0x559c81,null))['then'](removeEntity(_0x559c81,null))[_0x3380('0x46')](handleError(_0x559c81,null));};exports['describe']=function(_0x5529c3,_0x305edb){return db[_0x3380('0x3e')][_0x3380('0x49')]()[_0x3380('0x22')](respondWithResult(_0x305edb,null))[_0x3380('0x46')](handleError(_0x305edb,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 1af6728..712fc89 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 _0x56b5=['exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0xf0792b,_0x4c240e){var _0x484d4b=function(_0x369017){while(--_0x369017){_0xf0792b['push'](_0xf0792b['shift']());}};_0x484d4b(++_0x4c240e);}(_0x56b5,0x16c));var _0x556b=function(_0x23760f,_0x4ac726){_0x23760f=_0x23760f-0x0;var _0x3871ba=_0x56b5[_0x23760f];return _0x3871ba;};'use strict';var _=require(_0x556b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x556b('0x1'));var moment=require('moment');var BPromise=require(_0x556b('0x2'));var rp=require(_0x556b('0x3'));var fs=require('fs');var path=require(_0x556b('0x4'));var rimraf=require(_0x556b('0x5'));var config=require(_0x556b('0x6'));var attributes=require(_0x556b('0x7'));module[_0x556b('0x8')]=function(_0xf49710,_0x5be528){return _0xf49710['define'](_0x556b('0x9'),attributes,{'tableName':_0x556b('0xa'),'paranoid':![],'indexes':[{'name':_0x556b('0xb'),'fields':[_0x556b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d29=['../../config/environment','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x4b9a46,_0x4812bb){var _0x3a7334=function(_0x3a3336){while(--_0x3a3336){_0x4b9a46['push'](_0x4b9a46['shift']());}};_0x3a7334(++_0x4812bb);}(_0x1d29,0x1c1));var _0x91d2=function(_0x3c5f40,_0xb82ced){_0x3c5f40=_0x3c5f40-0x0;var _0x5b610e=_0x1d29[_0x3c5f40];return _0x5b610e;};'use strict';var _=require(_0x91d2('0x0'));var util=require(_0x91d2('0x1'));var logger=require(_0x91d2('0x2'))(_0x91d2('0x3'));var moment=require(_0x91d2('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x91d2('0x5'));var rimraf=require(_0x91d2('0x6'));var config=require(_0x91d2('0x7'));var attributes=require(_0x91d2('0x8'));module['exports']=function(_0x2a01ef,_0x25b374){return _0x2a01ef['define'](_0x91d2('0x9'),attributes,{'tableName':_0x91d2('0xa'),'paranoid':![],'indexes':[{'name':_0x91d2('0xb'),'fields':[_0x91d2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 0228fed..bfcc337 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 _0xf687=['MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x263b0e,_0xc6479f){var _0x113fee=function(_0x803881){while(--_0x803881){_0x263b0e['push'](_0x263b0e['shift']());}};_0x113fee(++_0xc6479f);}(_0xf687,0xd7));var _0x7f68=function(_0xaeb344,_0x290b61){_0xaeb344=_0xaeb344-0x0;var _0x5c0a0a=_0xf687[_0xaeb344];return _0x5c0a0a;};'use strict';var _=require(_0x7f68('0x0'));var util=require(_0x7f68('0x1'));var moment=require('moment');var BPromise=require(_0x7f68('0x2'));var rs=require(_0x7f68('0x3'));var fs=require('fs');var Redis=require(_0x7f68('0x4'));var db=require(_0x7f68('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7f68('0x6'));var client=jayson[_0x7f68('0x7')][_0x7f68('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xba7d12,_0x5ab1d3,_0x4e6790){return new BPromise(function(_0x188bb5,_0x904c30){return client[_0x7f68('0x9')](_0xba7d12,_0x4e6790)['then'](function(_0x4fb6fd){logger[_0x7f68('0xa')](_0x7f68('0xb'),_0x5ab1d3,_0x7f68('0xc'));logger['debug'](_0x7f68('0xd'),_0x5ab1d3,'request\x20sent',JSON[_0x7f68('0xe')](_0x4fb6fd));if(_0x4fb6fd[_0x7f68('0xf')]){if(_0x4fb6fd[_0x7f68('0xf')]['code']===0x1f4){logger['error'](_0x7f68('0xb'),_0x5ab1d3,_0x4fb6fd[_0x7f68('0xf')][_0x7f68('0x10')]);return _0x904c30(_0x4fb6fd['error'][_0x7f68('0x10')]);}logger[_0x7f68('0xf')](_0x7f68('0xb'),_0x5ab1d3,_0x4fb6fd['error'][_0x7f68('0x10')]);return _0x188bb5(_0x4fb6fd[_0x7f68('0xf')][_0x7f68('0x10')]);}else{logger[_0x7f68('0xa')]('MailTransferReport,\x20%s,\x20%s',_0x5ab1d3,_0x7f68('0xc'));_0x188bb5(_0x4fb6fd[_0x7f68('0x11')]['message']);}})[_0x7f68('0x12')](function(_0xeadc4f){logger[_0x7f68('0xf')](_0x7f68('0xb'),_0x5ab1d3,_0xeadc4f);_0x904c30(_0xeadc4f);});});} \ No newline at end of file +var _0x7544=['rpc','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7544,0x19c));var _0x4754=function(_0x325e4c,_0x470fda){_0x325e4c=_0x325e4c-0x0;var _0x3a8d08=_0x7544[_0x325e4c];return _0x3a8d08;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4754('0x0'));var rs=require(_0x4754('0x1'));var fs=require('fs');var Redis=require(_0x4754('0x2'));var db=require(_0x4754('0x3'))['db'];var utils=require(_0x4754('0x4'));var logger=require(_0x4754('0x5'))(_0x4754('0x6'));var config=require('../../config/environment');var jayson=require(_0x4754('0x7'));var client=jayson[_0x4754('0x8')][_0x4754('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ed0be,_0x390c03,_0x267abd){return new BPromise(function(_0x88cf4d,_0x2a03ce){return client[_0x4754('0xa')](_0x2ed0be,_0x267abd)['then'](function(_0x38a9e6){logger[_0x4754('0xb')](_0x4754('0xc'),_0x390c03,'request\x20sent');logger[_0x4754('0xd')](_0x4754('0xe'),_0x390c03,_0x4754('0xf'),JSON['stringify'](_0x38a9e6));if(_0x38a9e6[_0x4754('0x10')]){if(_0x38a9e6[_0x4754('0x10')][_0x4754('0x11')]===0x1f4){logger[_0x4754('0x10')](_0x4754('0xc'),_0x390c03,_0x38a9e6[_0x4754('0x10')][_0x4754('0x12')]);return _0x2a03ce(_0x38a9e6[_0x4754('0x10')]['message']);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x390c03,_0x38a9e6[_0x4754('0x10')][_0x4754('0x12')]);return _0x88cf4d(_0x38a9e6[_0x4754('0x10')][_0x4754('0x12')]);}else{logger[_0x4754('0xb')](_0x4754('0xc'),_0x390c03,'request\x20sent');_0x88cf4d(_0x38a9e6['result'][_0x4754('0x12')]);}})['catch'](function(_0x2e74af){logger[_0x4754('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x390c03,_0x2e74af);_0x2a03ce(_0x2e74af);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 14195f9..7ae9f80 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 _0x4349=['Router','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5dca0c,_0x316205){var _0xe7f040=function(_0x53770c){while(--_0x53770c){_0x5dca0c['push'](_0x5dca0c['shift']());}};_0xe7f040(++_0x316205);}(_0x4349,0x1df));var _0x9434=function(_0x438aa3,_0x477f23){_0x438aa3=_0x438aa3-0x0;var _0x54aef2=_0x4349[_0x438aa3];return _0x54aef2;};'use strict';var multer=require(_0x9434('0x0'));var util=require(_0x9434('0x1'));var path=require(_0x9434('0x2'));var timeout=require(_0x9434('0x3'));var express=require('express');var router=express[_0x9434('0x4')]();var auth=require(_0x9434('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9434('0x6'));var controller=require(_0x9434('0x7'));router[_0x9434('0x8')]('/',auth[_0x9434('0x9')](),controller[_0x9434('0xa')]);router[_0x9434('0x8')](_0x9434('0xb'),auth[_0x9434('0x9')](),controller[_0x9434('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9434('0xd')]);router[_0x9434('0xe')]('/',auth['isAuthenticated'](),controller[_0x9434('0xf')]);router['put'](_0x9434('0x10'),auth[_0x9434('0x9')](),controller[_0x9434('0x11')]);router[_0x9434('0x12')](_0x9434('0x10'),auth[_0x9434('0x9')](),controller[_0x9434('0x13')]);module[_0x9434('0x14')]=router; \ No newline at end of file +var _0x55f0=['isAuthenticated','/:id','show','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./memberReport.controller','get'];(function(_0x198b03,_0x3aa053){var _0x2f3f66=function(_0x333578){while(--_0x333578){_0x198b03['push'](_0x198b03['shift']());}};_0x2f3f66(++_0x3aa053);}(_0x55f0,0x1f3));var _0x055f=function(_0x4f219b,_0x841f7e){_0x4f219b=_0x4f219b-0x0;var _0x8a7718=_0x55f0[_0x4f219b];return _0x8a7718;};'use strict';var multer=require(_0x055f('0x0'));var util=require(_0x055f('0x1'));var path=require(_0x055f('0x2'));var timeout=require(_0x055f('0x3'));var express=require(_0x055f('0x4'));var router=express['Router']();var auth=require(_0x055f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x055f('0x6'));router[_0x055f('0x7')]('/',auth[_0x055f('0x8')](),controller['index']);router[_0x055f('0x7')]('/describe',auth[_0x055f('0x8')](),controller['describe']);router[_0x055f('0x7')](_0x055f('0x9'),auth['isAuthenticated'](),controller[_0x055f('0xa')]);router['post']('/',auth[_0x055f('0x8')](),controller['create']);router['put'](_0x055f('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x055f('0xb')](_0x055f('0x9'),auth[_0x055f('0x8')](),controller['destroy']);module[_0x055f('0xc')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index d3e9842..6612269 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 _0x10f8=['seconds','setDataValue','exitAt','duration','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff'];(function(_0xb77d35,_0x291854){var _0x5389a8=function(_0x52b4d2){while(--_0x52b4d2){_0xb77d35['push'](_0xb77d35['shift']());}};_0x5389a8(++_0x291854);}(_0x10f8,0x19f));var _0x810f=function(_0x3ed430,_0x5fafab){_0x3ed430=_0x3ed430-0x0;var _0xae4a10=_0x10f8[_0x3ed430];return _0xae4a10;};'use strict';var Sequelize=require(_0x810f('0x0'));var moment=require(_0x810f('0x1'));module['exports']={'channel':{'type':Sequelize[_0x810f('0x2')]},'membername':{'type':Sequelize[_0x810f('0x2')]},'interface':{'type':Sequelize[_0x810f('0x2')]},'type':{'type':Sequelize[_0x810f('0x2')],'defaultValue':_0x810f('0x3'),'comment':_0x810f('0x4')},'duration':{'type':Sequelize[_0x810f('0x5')]},'enterAt':{'type':Sequelize[_0x810f('0x6')]},'exitAt':{'type':Sequelize[_0x810f('0x6')],'set':function(_0x44b9fa){var _0x54bd5f=moment(_0x44b9fa);var _0x54f231=moment(this[_0x810f('0x7')](_0x810f('0x8')));var _0x1cedfd=_0x54bd5f[_0x810f('0x9')](_0x54f231,_0x810f('0xa'));this[_0x810f('0xb')](_0x810f('0xc'),_0x44b9fa);this['setDataValue'](_0x810f('0xd'),_0x1cedfd||null);}},'data1':{'type':Sequelize[_0x810f('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x810f('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x810f('0x2')],'comment':_0x810f('0xe')},'data4':{'type':Sequelize[_0x810f('0x2')],'comment':_0x810f('0xf')},'data5':{'type':Sequelize[_0x810f('0x2')],'comment':_0x810f('0x10')},'role':{'type':Sequelize[_0x810f('0x2')]},'internal':{'type':Sequelize[_0x810f('0x5')]},'uniqueid':{'type':Sequelize[_0x810f('0x2')]}}; \ No newline at end of file +var _0xd4e3=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','INTEGER','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd4e3,0x147));var _0x3d4e=function(_0x4488d7,_0x18322f){_0x4488d7=_0x4488d7-0x0;var _0x399924=_0xd4e3[_0x4488d7];return _0x399924;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3d4e('0x0'));module[_0x3d4e('0x1')]={'channel':{'type':Sequelize[_0x3d4e('0x2')]},'membername':{'type':Sequelize[_0x3d4e('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0x3d4e('0x3'),'comment':_0x3d4e('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3d4e('0x5')],'set':function(_0x4d9cf7){var _0x2ebac4=moment(_0x4d9cf7);var _0x51d619=moment(this[_0x3d4e('0x6')](_0x3d4e('0x7')));var _0x552358=_0x2ebac4[_0x3d4e('0x8')](_0x51d619,_0x3d4e('0x9'));this[_0x3d4e('0xa')](_0x3d4e('0xb'),_0x4d9cf7);this[_0x3d4e('0xa')](_0x3d4e('0xc'),_0x552358||null);}},'data1':{'type':Sequelize[_0x3d4e('0x2')],'comment':_0x3d4e('0xd')},'data2':{'type':Sequelize[_0x3d4e('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0x3d4e('0xe')},'data4':{'type':Sequelize[_0x3d4e('0x2')],'comment':_0x3d4e('0xf')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x3d4e('0x2')]},'internal':{'type':Sequelize[_0x3d4e('0x10')]},'uniqueid':{'type':Sequelize[_0x3d4e('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index e579397..57d5495 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 _0xb411=['error','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','show','includeAll','options','find','catch','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then'];(function(_0x66454d,_0x4ddf22){var _0x4eb726=function(_0x24d1f8){while(--_0x24d1f8){_0x66454d['push'](_0x66454d['shift']());}};_0x4eb726(++_0x4ddf22);}(_0xb411,0x19d));var _0x1b41=function(_0x2ff78b,_0x140ea3){_0x2ff78b=_0x2ff78b-0x0;var _0x5bec5b=_0xb411[_0x2ff78b];return _0x5bec5b;};'use strict';var pdf=require(_0x1b41('0x0'));var emlformat=require(_0x1b41('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1b41('0x2'));var jsonpatch=require(_0x1b41('0x3'));var rp=require(_0x1b41('0x4'));var moment=require(_0x1b41('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1b41('0x6'));var util=require('util');var path=require(_0x1b41('0x7'));var sox=require(_0x1b41('0x8'));var csv=require(_0x1b41('0x9'));var ejs=require(_0x1b41('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1b41('0xb'));var crypto=require(_0x1b41('0xc'));var jsforce=require(_0x1b41('0xd'));var deskjs=require(_0x1b41('0xe'));var toCsv=require(_0x1b41('0x9'));var querystring=require(_0x1b41('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1b41('0x10'));var qs=require(_0x1b41('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b41('0x12'))(_0x1b41('0x13'));var utils=require(_0x1b41('0x14'));var config=require(_0x1b41('0x15'));var db=require(_0x1b41('0x16'))['db'];function respondWithStatusCode(_0x5cdd09,_0xab6289){_0xab6289=_0xab6289||0xcc;return function(_0x31f48d){if(_0x31f48d){return _0x5cdd09[_0x1b41('0x17')](_0xab6289);}return _0x5cdd09[_0x1b41('0x18')](_0xab6289)[_0x1b41('0x19')]();};}function respondWithResult(_0x3fc222,_0x22b6c8){_0x22b6c8=_0x22b6c8||0xc8;return function(_0xbbc29d){if(_0xbbc29d){return _0x3fc222[_0x1b41('0x18')](_0x22b6c8)[_0x1b41('0x1a')](_0xbbc29d);}};}function respondWithFilteredResult(_0x350284,_0x34fa6d){return function(_0xf417d2){if(_0xf417d2){var _0x55685=_0xf417d2[_0x1b41('0x1b')],_0x5dc790=_0x34fa6d['offset'],_0x45ebcd=_0x34fa6d[_0x1b41('0x1c')]+_0x34fa6d[_0x1b41('0x1d')],_0x21cc67;if(_0x45ebcd>=_0x55685){_0x45ebcd=_0x55685;_0x21cc67=0xc8;}else{_0x21cc67=0xce;}_0x350284[_0x1b41('0x18')](_0x21cc67);return _0x350284[_0x1b41('0x1e')](_0x1b41('0x1f'),_0x5dc790+'-'+_0x45ebcd+'/'+_0x55685)[_0x1b41('0x1a')](_0xf417d2);}return null;};}function patchUpdates(_0x23007a){return function(_0x503ec2){try{jsonpatch[_0x1b41('0x20')](_0x503ec2,_0x23007a,!![]);}catch(_0x448fdc){return BPromise[_0x1b41('0x21')](_0x448fdc);}return _0x503ec2['save']();};}function saveUpdates(_0x39157d,_0xbb695c){return function(_0x595118){if(_0x595118){return _0x595118[_0x1b41('0x22')](_0x39157d)['then'](function(_0x152a57){return _0x152a57;});}return null;};}function removeEntity(_0x1b2801,_0x1c3b1a){return function(_0x45230e){if(_0x45230e){return _0x45230e[_0x1b41('0x23')]()[_0x1b41('0x24')](function(){_0x1b2801[_0x1b41('0x18')](0xcc)[_0x1b41('0x19')]();});}};}function handleEntityNotFound(_0x1907b6,_0x1f2fcc){return function(_0x24bf3b){if(!_0x24bf3b){_0x1907b6[_0x1b41('0x17')](0x194);}return _0x24bf3b;};}function handleError(_0x49f502,_0x2e9ba0){_0x2e9ba0=_0x2e9ba0||0x1f4;return function(_0x1c2338){logger[_0x1b41('0x25')](_0x1c2338[_0x1b41('0x26')]);if(_0x1c2338[_0x1b41('0x27')]){delete _0x1c2338[_0x1b41('0x27')];}_0x49f502['status'](_0x2e9ba0)[_0x1b41('0x28')](_0x1c2338);};}exports[_0x1b41('0x29')]=function(_0x16b802,_0x355e12){var _0x287cd2={},_0x4f6754={},_0x25b5f9={'count':0x0,'rows':[]};var _0x512a21=_[_0x1b41('0x2a')](db[_0x1b41('0x2b')][_0x1b41('0x2c')],function(_0x242a30){return{'name':_0x242a30[_0x1b41('0x2d')],'type':_0x242a30[_0x1b41('0x2e')]['key']};});_0x4f6754[_0x1b41('0x2f')]=_[_0x1b41('0x2a')](_0x512a21,_0x1b41('0x27'));_0x4f6754[_0x1b41('0x30')]=_[_0x1b41('0x31')](_0x16b802[_0x1b41('0x30')]);_0x4f6754[_0x1b41('0x32')]=_[_0x1b41('0x33')](_0x4f6754[_0x1b41('0x2f')],_0x4f6754[_0x1b41('0x30')]);_0x287cd2[_0x1b41('0x34')]=_[_0x1b41('0x33')](_0x4f6754[_0x1b41('0x2f')],qs[_0x1b41('0x35')](_0x16b802[_0x1b41('0x30')][_0x1b41('0x35')]));_0x287cd2[_0x1b41('0x34')]=_0x287cd2[_0x1b41('0x34')][_0x1b41('0x36')]?_0x287cd2[_0x1b41('0x34')]:_0x4f6754[_0x1b41('0x2f')];if(!_0x16b802['query'][_0x1b41('0x37')](_0x1b41('0x38'))){_0x287cd2[_0x1b41('0x1d')]=qs[_0x1b41('0x1d')](_0x16b802[_0x1b41('0x30')][_0x1b41('0x1d')]);_0x287cd2[_0x1b41('0x1c')]=qs[_0x1b41('0x1c')](_0x16b802['query'][_0x1b41('0x1c')]);}_0x287cd2[_0x1b41('0x39')]=qs[_0x1b41('0x3a')](_0x16b802[_0x1b41('0x30')][_0x1b41('0x3a')]);_0x287cd2[_0x1b41('0x3b')]=qs[_0x1b41('0x32')](_[_0x1b41('0x3c')](_0x16b802[_0x1b41('0x30')],_0x4f6754[_0x1b41('0x32')]),_0x512a21);if(_0x16b802[_0x1b41('0x30')][_0x1b41('0x3d')]){_0x287cd2[_0x1b41('0x3b')]=_[_0x1b41('0x3e')](_0x287cd2[_0x1b41('0x3b')],{'$or':_[_0x1b41('0x2a')](_0x512a21,function(_0x583b20){if(_0x583b20[_0x1b41('0x2e')]!=='VIRTUAL'){var _0x3436eb={};_0x3436eb[_0x583b20[_0x1b41('0x27')]]={'$like':'%'+_0x16b802[_0x1b41('0x30')][_0x1b41('0x3d')]+'%'};return _0x3436eb;}})});}_0x287cd2=_[_0x1b41('0x3e')]({},_0x287cd2,_0x16b802['options']);var _0x2a7ca0={'where':_0x287cd2[_0x1b41('0x3b')]};return db[_0x1b41('0x2b')][_0x1b41('0x1b')](_0x2a7ca0)['then'](function(_0xefc15d){_0x25b5f9[_0x1b41('0x1b')]=_0xefc15d;if(_0x16b802[_0x1b41('0x30')]['includeAll']){_0x287cd2[_0x1b41('0x3f')]=[{'all':!![]}];}return db['MemberReport'][_0x1b41('0x40')](_0x287cd2);})[_0x1b41('0x24')](function(_0x3870ec){_0x25b5f9[_0x1b41('0x41')]=_0x3870ec;return _0x25b5f9;})[_0x1b41('0x24')](respondWithFilteredResult(_0x355e12,_0x287cd2))['catch'](handleError(_0x355e12,null));};exports[_0x1b41('0x42')]=function(_0x3cfb9d,_0xcdcd6d){var _0x1d52e4={'raw':!![],'where':{'id':_0x3cfb9d['params']['id']}},_0x5e2894={};_0x5e2894[_0x1b41('0x2f')]=_[_0x1b41('0x31')](db[_0x1b41('0x2b')]['rawAttributes']);_0x5e2894[_0x1b41('0x30')]=_['keys'](_0x3cfb9d[_0x1b41('0x30')]);_0x5e2894[_0x1b41('0x32')]=_[_0x1b41('0x33')](_0x5e2894[_0x1b41('0x2f')],_0x5e2894['query']);_0x1d52e4[_0x1b41('0x34')]=_[_0x1b41('0x33')](_0x5e2894['model'],qs[_0x1b41('0x35')](_0x3cfb9d[_0x1b41('0x30')]['fields']));_0x1d52e4['attributes']=_0x1d52e4[_0x1b41('0x34')]['length']?_0x1d52e4[_0x1b41('0x34')]:_0x5e2894[_0x1b41('0x2f')];if(_0x3cfb9d[_0x1b41('0x30')][_0x1b41('0x43')]){_0x1d52e4[_0x1b41('0x3f')]=[{'all':!![]}];}_0x1d52e4=_['merge']({},_0x1d52e4,_0x3cfb9d[_0x1b41('0x44')]);return db['MemberReport'][_0x1b41('0x45')](_0x1d52e4)[_0x1b41('0x24')](handleEntityNotFound(_0xcdcd6d,null))[_0x1b41('0x24')](respondWithResult(_0xcdcd6d,null))[_0x1b41('0x46')](handleError(_0xcdcd6d,null));};exports[_0x1b41('0x47')]=function(_0x2f7f96,_0x32d926){return db[_0x1b41('0x2b')]['create'](_0x2f7f96[_0x1b41('0x48')],{})[_0x1b41('0x24')](respondWithResult(_0x32d926,0xc9))['catch'](handleError(_0x32d926,null));};exports['update']=function(_0x1d4e8c,_0x4aed0e){if(_0x1d4e8c['body']['id']){delete _0x1d4e8c[_0x1b41('0x48')]['id'];}return db[_0x1b41('0x2b')][_0x1b41('0x45')]({'where':{'id':_0x1d4e8c[_0x1b41('0x49')]['id']}})[_0x1b41('0x24')](handleEntityNotFound(_0x4aed0e,null))[_0x1b41('0x24')](saveUpdates(_0x1d4e8c[_0x1b41('0x48')],null))[_0x1b41('0x24')](respondWithResult(_0x4aed0e,null))[_0x1b41('0x46')](handleError(_0x4aed0e,null));};exports[_0x1b41('0x23')]=function(_0x47e21f,_0x6e5b92){return db['MemberReport'][_0x1b41('0x45')]({'where':{'id':_0x47e21f[_0x1b41('0x49')]['id']}})[_0x1b41('0x24')](handleEntityNotFound(_0x6e5b92,null))[_0x1b41('0x24')](removeEntity(_0x6e5b92,null))[_0x1b41('0x46')](handleError(_0x6e5b92,null));};exports[_0x1b41('0x4a')]=function(_0x52de1d,_0x46e2){return db['MemberReport'][_0x1b41('0x4a')]()[_0x1b41('0x24')](respondWithResult(_0x46e2,null))[_0x1b41('0x46')](handleError(_0x46e2,null));}; \ No newline at end of file +var _0xbc1d=['save','update','then','destroy','error','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','length','find','catch','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','count','offset','limit','status','set','Content-Range','apply','reject'];(function(_0x1722f4,_0x3ce750){var _0x3a64c2=function(_0x429533){while(--_0x429533){_0x1722f4['push'](_0x1722f4['shift']());}};_0x3a64c2(++_0x3ce750);}(_0xbc1d,0xb8));var _0xdbc1=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0xbc1d[_0x1de43c];return _0x296d3e;};'use strict';var pdf=require(_0xdbc1('0x0'));var emlformat=require(_0xdbc1('0x1'));var rimraf=require(_0xdbc1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbc1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdbc1('0x4'));var Mustache=require(_0xdbc1('0x5'));var util=require(_0xdbc1('0x6'));var path=require(_0xdbc1('0x7'));var sox=require(_0xdbc1('0x8'));var csv=require(_0xdbc1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdbc1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdbc1('0xb'));var deskjs=require(_0xdbc1('0xc'));var toCsv=require(_0xdbc1('0x9'));var querystring=require('querystring');var Papa=require(_0xdbc1('0xd'));var Redis=require(_0xdbc1('0xe'));var authService=require(_0xdbc1('0xf'));var qs=require(_0xdbc1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbc1('0x11'));var logger=require(_0xdbc1('0x12'))(_0xdbc1('0x13'));var utils=require(_0xdbc1('0x14'));var config=require(_0xdbc1('0x15'));var db=require(_0xdbc1('0x16'))['db'];function respondWithStatusCode(_0x8e88c2,_0x4dfe21){_0x4dfe21=_0x4dfe21||0xcc;return function(_0x440297){if(_0x440297){return _0x8e88c2[_0xdbc1('0x17')](_0x4dfe21);}return _0x8e88c2['status'](_0x4dfe21)['end']();};}function respondWithResult(_0x534a75,_0x202976){_0x202976=_0x202976||0xc8;return function(_0x14885f){if(_0x14885f){return _0x534a75['status'](_0x202976)['json'](_0x14885f);}};}function respondWithFilteredResult(_0x47abd9,_0x3d416c){return function(_0x281c70){if(_0x281c70){var _0x4f42c5=_0x281c70[_0xdbc1('0x18')],_0x22ed37=_0x3d416c[_0xdbc1('0x19')],_0x162a33=_0x3d416c['offset']+_0x3d416c[_0xdbc1('0x1a')],_0x262f98;if(_0x162a33>=_0x4f42c5){_0x162a33=_0x4f42c5;_0x262f98=0xc8;}else{_0x262f98=0xce;}_0x47abd9[_0xdbc1('0x1b')](_0x262f98);return _0x47abd9[_0xdbc1('0x1c')](_0xdbc1('0x1d'),_0x22ed37+'-'+_0x162a33+'/'+_0x4f42c5)['json'](_0x281c70);}return null;};}function patchUpdates(_0x20c3e3){return function(_0x156feb){try{jsonpatch[_0xdbc1('0x1e')](_0x156feb,_0x20c3e3,!![]);}catch(_0x154e07){return BPromise[_0xdbc1('0x1f')](_0x154e07);}return _0x156feb[_0xdbc1('0x20')]();};}function saveUpdates(_0x51a50b,_0x4e2dcb){return function(_0x1ca1b1){if(_0x1ca1b1){return _0x1ca1b1[_0xdbc1('0x21')](_0x51a50b)[_0xdbc1('0x22')](function(_0x58e4ff){return _0x58e4ff;});}return null;};}function removeEntity(_0xfa02c,_0x54e362){return function(_0x421433){if(_0x421433){return _0x421433[_0xdbc1('0x23')]()[_0xdbc1('0x22')](function(){_0xfa02c[_0xdbc1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bc69f,_0x163c7f){return function(_0x13bae7){if(!_0x13bae7){_0x5bc69f[_0xdbc1('0x17')](0x194);}return _0x13bae7;};}function handleError(_0x3f973d,_0x21d5f7){_0x21d5f7=_0x21d5f7||0x1f4;return function(_0x503940){logger[_0xdbc1('0x24')](_0x503940[_0xdbc1('0x25')]);if(_0x503940[_0xdbc1('0x26')]){delete _0x503940[_0xdbc1('0x26')];}_0x3f973d['status'](_0x21d5f7)[_0xdbc1('0x27')](_0x503940);};}exports[_0xdbc1('0x28')]=function(_0x3b96c0,_0x1f0937){var _0x23cfbc={},_0x353e3a={},_0x56b7ec={'count':0x0,'rows':[]};var _0x2297db=_[_0xdbc1('0x29')](db[_0xdbc1('0x2a')][_0xdbc1('0x2b')],function(_0x398d0e){return{'name':_0x398d0e[_0xdbc1('0x2c')],'type':_0x398d0e[_0xdbc1('0x2d')]['key']};});_0x353e3a[_0xdbc1('0x2e')]=_[_0xdbc1('0x29')](_0x2297db,'name');_0x353e3a[_0xdbc1('0x2f')]=_[_0xdbc1('0x30')](_0x3b96c0[_0xdbc1('0x2f')]);_0x353e3a[_0xdbc1('0x31')]=_[_0xdbc1('0x32')](_0x353e3a[_0xdbc1('0x2e')],_0x353e3a[_0xdbc1('0x2f')]);_0x23cfbc[_0xdbc1('0x33')]=_[_0xdbc1('0x32')](_0x353e3a[_0xdbc1('0x2e')],qs['fields'](_0x3b96c0[_0xdbc1('0x2f')][_0xdbc1('0x34')]));_0x23cfbc[_0xdbc1('0x33')]=_0x23cfbc[_0xdbc1('0x33')]['length']?_0x23cfbc['attributes']:_0x353e3a[_0xdbc1('0x2e')];if(!_0x3b96c0[_0xdbc1('0x2f')][_0xdbc1('0x35')](_0xdbc1('0x36'))){_0x23cfbc[_0xdbc1('0x1a')]=qs['limit'](_0x3b96c0[_0xdbc1('0x2f')][_0xdbc1('0x1a')]);_0x23cfbc[_0xdbc1('0x19')]=qs['offset'](_0x3b96c0[_0xdbc1('0x2f')]['offset']);}_0x23cfbc['order']=qs[_0xdbc1('0x37')](_0x3b96c0[_0xdbc1('0x2f')][_0xdbc1('0x37')]);_0x23cfbc[_0xdbc1('0x38')]=qs['filters'](_[_0xdbc1('0x39')](_0x3b96c0['query'],_0x353e3a[_0xdbc1('0x31')]),_0x2297db);if(_0x3b96c0[_0xdbc1('0x2f')][_0xdbc1('0x3a')]){_0x23cfbc[_0xdbc1('0x38')]=_[_0xdbc1('0x3b')](_0x23cfbc[_0xdbc1('0x38')],{'$or':_[_0xdbc1('0x29')](_0x2297db,function(_0x20e33a){if(_0x20e33a[_0xdbc1('0x2d')]!=='VIRTUAL'){var _0x16f488={};_0x16f488[_0x20e33a['name']]={'$like':'%'+_0x3b96c0[_0xdbc1('0x2f')][_0xdbc1('0x3a')]+'%'};return _0x16f488;}})});}_0x23cfbc=_[_0xdbc1('0x3b')]({},_0x23cfbc,_0x3b96c0[_0xdbc1('0x3c')]);var _0x196da0={'where':_0x23cfbc['where']};return db[_0xdbc1('0x2a')]['count'](_0x196da0)[_0xdbc1('0x22')](function(_0x4b923d){_0x56b7ec['count']=_0x4b923d;if(_0x3b96c0[_0xdbc1('0x2f')][_0xdbc1('0x3d')]){_0x23cfbc['include']=[{'all':!![]}];}return db[_0xdbc1('0x2a')][_0xdbc1('0x3e')](_0x23cfbc);})[_0xdbc1('0x22')](function(_0x1ac91a){_0x56b7ec[_0xdbc1('0x3f')]=_0x1ac91a;return _0x56b7ec;})[_0xdbc1('0x22')](respondWithFilteredResult(_0x1f0937,_0x23cfbc))['catch'](handleError(_0x1f0937,null));};exports[_0xdbc1('0x40')]=function(_0x4440c7,_0x2748a9){var _0x369282={'raw':!![],'where':{'id':_0x4440c7[_0xdbc1('0x41')]['id']}},_0x35f932={};_0x35f932['model']=_[_0xdbc1('0x30')](db[_0xdbc1('0x2a')]['rawAttributes']);_0x35f932[_0xdbc1('0x2f')]=_[_0xdbc1('0x30')](_0x4440c7[_0xdbc1('0x2f')]);_0x35f932['filters']=_[_0xdbc1('0x32')](_0x35f932[_0xdbc1('0x2e')],_0x35f932[_0xdbc1('0x2f')]);_0x369282[_0xdbc1('0x33')]=_['intersection'](_0x35f932[_0xdbc1('0x2e')],qs[_0xdbc1('0x34')](_0x4440c7[_0xdbc1('0x2f')]['fields']));_0x369282['attributes']=_0x369282[_0xdbc1('0x33')][_0xdbc1('0x42')]?_0x369282[_0xdbc1('0x33')]:_0x35f932[_0xdbc1('0x2e')];if(_0x4440c7[_0xdbc1('0x2f')][_0xdbc1('0x3d')]){_0x369282['include']=[{'all':!![]}];}_0x369282=_[_0xdbc1('0x3b')]({},_0x369282,_0x4440c7[_0xdbc1('0x3c')]);return db[_0xdbc1('0x2a')][_0xdbc1('0x43')](_0x369282)[_0xdbc1('0x22')](handleEntityNotFound(_0x2748a9,null))['then'](respondWithResult(_0x2748a9,null))[_0xdbc1('0x44')](handleError(_0x2748a9,null));};exports['create']=function(_0x1637ad,_0x3eccdd){return db[_0xdbc1('0x2a')][_0xdbc1('0x45')](_0x1637ad[_0xdbc1('0x46')],{})[_0xdbc1('0x22')](respondWithResult(_0x3eccdd,0xc9))[_0xdbc1('0x44')](handleError(_0x3eccdd,null));};exports['update']=function(_0x30e348,_0x94adfa){if(_0x30e348[_0xdbc1('0x46')]['id']){delete _0x30e348[_0xdbc1('0x46')]['id'];}return db['MemberReport'][_0xdbc1('0x43')]({'where':{'id':_0x30e348[_0xdbc1('0x41')]['id']}})[_0xdbc1('0x22')](handleEntityNotFound(_0x94adfa,null))['then'](saveUpdates(_0x30e348[_0xdbc1('0x46')],null))[_0xdbc1('0x22')](respondWithResult(_0x94adfa,null))[_0xdbc1('0x44')](handleError(_0x94adfa,null));};exports[_0xdbc1('0x23')]=function(_0x470b60,_0x39e94d){return db[_0xdbc1('0x2a')][_0xdbc1('0x43')]({'where':{'id':_0x470b60[_0xdbc1('0x41')]['id']}})[_0xdbc1('0x22')](handleEntityNotFound(_0x39e94d,null))[_0xdbc1('0x22')](removeEntity(_0x39e94d,null))[_0xdbc1('0x44')](handleError(_0x39e94d,null));};exports[_0xdbc1('0x47')]=function(_0x524d41,_0x541e05){return db[_0xdbc1('0x2a')]['describe']()[_0xdbc1('0x22')](respondWithResult(_0x541e05,null))[_0xdbc1('0x44')](handleError(_0x541e05,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index a0a2a38..c84ee56 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 _0xca9e=['bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','interface','lodash','util','../../config/logger','api','moment'];(function(_0x19c4f5,_0x4f33fa){var _0x339f8c=function(_0x4a936f){while(--_0x4a936f){_0x19c4f5['push'](_0x19c4f5['shift']());}};_0x339f8c(++_0x4f33fa);}(_0xca9e,0x136));var _0xeca9=function(_0x138dd3,_0x7356d7){_0x138dd3=_0x138dd3-0x0;var _0x3bfd53=_0xca9e[_0x138dd3];return _0x3bfd53;};'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':[{'name':'membername_interface','fields':['membername',_0xeca9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed1f=['MemberReport','report_member','membername_interface','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define'];(function(_0x4e2801,_0x4ba3e2){var _0x513ab5=function(_0x28105d){while(--_0x28105d){_0x4e2801['push'](_0x4e2801['shift']());}};_0x513ab5(++_0x4ba3e2);}(_0xed1f,0x6a));var _0xfed1=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xed1f[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var logger=require(_0xfed1('0x2'))(_0xfed1('0x3'));var moment=require(_0xfed1('0x4'));var BPromise=require(_0xfed1('0x5'));var rp=require(_0xfed1('0x6'));var fs=require('fs');var path=require(_0xfed1('0x7'));var rimraf=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var attributes=require(_0xfed1('0xa'));module[_0xfed1('0xb')]=function(_0x3d6706,_0x42751d){return _0x3d6706[_0xfed1('0xc')](_0xfed1('0xd'),attributes,{'tableName':_0xfed1('0xe'),'paranoid':![],'indexes':[{'name':_0xfed1('0xf'),'fields':['membername',_0xfed1('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index bdbd248..1f6e21e 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 _0x2a4a=['create','body','CreateMemberReport','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMemberReport','MemberReport','findAll','raw','options','where','attributes','limit','include','map','model','debug'];(function(_0x140fca,_0x3d4fde){var _0xde632=function(_0x5822c1){while(--_0x5822c1){_0x140fca['push'](_0x140fca['shift']());}};_0xde632(++_0x3d4fde);}(_0x2a4a,0x151));var _0xa2a4=function(_0x1b5e58,_0x541532){_0x1b5e58=_0x1b5e58-0x0;var _0x474c03=_0x2a4a[_0x1b5e58];return _0x474c03;};'use strict';var _=require(_0xa2a4('0x0'));var util=require(_0xa2a4('0x1'));var moment=require(_0xa2a4('0x2'));var BPromise=require(_0xa2a4('0x3'));var rs=require(_0xa2a4('0x4'));var fs=require('fs');var Redis=require(_0xa2a4('0x5'));var db=require(_0xa2a4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa2a4('0x7'))(_0xa2a4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa2a4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e88ff,_0x230c5d,_0xf7f5b9){return new BPromise(function(_0x1fde31,_0x37810a){return client[_0xa2a4('0xa')](_0x3e88ff,_0xf7f5b9)[_0xa2a4('0xb')](function(_0x3deda1){logger['info'](_0xa2a4('0xc'),_0x230c5d,_0xa2a4('0xd'));logger['debug'](_0xa2a4('0xe'),_0x230c5d,_0xa2a4('0xd'),JSON[_0xa2a4('0xf')](_0x3deda1));if(_0x3deda1[_0xa2a4('0x10')]){if(_0x3deda1['error'][_0xa2a4('0x11')]===0x1f4){logger[_0xa2a4('0x10')](_0xa2a4('0xc'),_0x230c5d,_0x3deda1[_0xa2a4('0x10')][_0xa2a4('0x12')]);return _0x37810a(_0x3deda1[_0xa2a4('0x10')]['message']);}logger[_0xa2a4('0x10')](_0xa2a4('0xc'),_0x230c5d,_0x3deda1['error']['message']);return _0x1fde31(_0x3deda1[_0xa2a4('0x10')][_0xa2a4('0x12')]);}else{logger[_0xa2a4('0x13')](_0xa2a4('0xc'),_0x230c5d,'request\x20sent');_0x1fde31(_0x3deda1['result'][_0xa2a4('0x12')]);}})[_0xa2a4('0x14')](function(_0x45f066){logger[_0xa2a4('0x10')]('MemberReport,\x20%s,\x20%s',_0x230c5d,_0x45f066);_0x37810a(_0x45f066);});});}exports[_0xa2a4('0x15')]=function(_0x2c5039){var _0x26dde=this;return new Promise(function(_0x4882fe,_0x1b397d){return db[_0xa2a4('0x16')][_0xa2a4('0x17')]({'raw':_0x2c5039['options']?_0x2c5039['options'][_0xa2a4('0x18')]===undefined?!![]:![]:!![],'where':_0x2c5039[_0xa2a4('0x19')]?_0x2c5039[_0xa2a4('0x19')][_0xa2a4('0x1a')]||null:null,'attributes':_0x2c5039['options']?_0x2c5039[_0xa2a4('0x19')][_0xa2a4('0x1b')]||null:null,'limit':_0x2c5039['options']?_0x2c5039[_0xa2a4('0x19')][_0xa2a4('0x1c')]||null:null,'include':_0x2c5039[_0xa2a4('0x19')]?_0x2c5039[_0xa2a4('0x19')][_0xa2a4('0x1d')]?_[_0xa2a4('0x1e')](_0x2c5039['options'][_0xa2a4('0x1d')],function(_0x4e4860){return{'model':db[_0x4e4860['model']],'as':_0x4e4860['as'],'attributes':_0x4e4860['attributes'],'include':_0x4e4860[_0xa2a4('0x1d')]?_[_0xa2a4('0x1e')](_0x4e4860[_0xa2a4('0x1d')],function(_0x496a4b){return{'model':db[_0x496a4b[_0xa2a4('0x1f')]],'as':_0x496a4b['as'],'attributes':_0x496a4b['attributes'],'include':_0x496a4b[_0xa2a4('0x1d')]?_[_0xa2a4('0x1e')](_0x496a4b[_0xa2a4('0x1d')],function(_0x41e522){return{'model':db[_0x41e522[_0xa2a4('0x1f')]],'as':_0x41e522['as'],'attributes':_0x41e522[_0xa2a4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa2a4('0xb')](function(_0x329875){logger[_0xa2a4('0x13')]('GetMemberReport',_0x2c5039);logger[_0xa2a4('0x20')](_0xa2a4('0x15'),_0x2c5039,JSON['stringify'](_0x329875));_0x4882fe(_0x329875);})[_0xa2a4('0x14')](function(_0x46e30e){logger[_0xa2a4('0x10')](_0xa2a4('0x15'),_0x46e30e[_0xa2a4('0x12')],_0x2c5039);_0x1b397d(_0x26dde[_0xa2a4('0x10')](0x1f4,_0x46e30e['message']));});});};exports['CreateMemberReport']=function(_0x56b631){var _0x148405=this;return new Promise(function(_0x157f12,_0xbff2bd){return db['MemberReport'][_0xa2a4('0x21')](_0x56b631[_0xa2a4('0x22')],{'raw':_0x56b631[_0xa2a4('0x19')]?_0x56b631['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x203dc2){logger[_0xa2a4('0x13')](_0xa2a4('0x23'),_0x56b631);logger[_0xa2a4('0x20')](_0xa2a4('0x23'),_0x56b631,JSON['stringify'](_0x203dc2));_0x157f12(_0x203dc2);})[_0xa2a4('0x14')](function(_0x4edc2c){logger[_0xa2a4('0x10')](_0xa2a4('0x23'),_0x4edc2c[_0xa2a4('0x12')],_0x56b631);_0xbff2bd(_0x148405[_0xa2a4('0x10')](0x1f4,_0x4edc2c['message']));});});};exports[_0xa2a4('0x24')]=function(_0x2c8692){var _0x3f756d=this;return new Promise(function(_0x1b155f,_0x1d7d91){return db[_0xa2a4('0x16')]['update'](_0x2c8692[_0xa2a4('0x22')],{'raw':_0x2c8692[_0xa2a4('0x19')]?_0x2c8692[_0xa2a4('0x19')][_0xa2a4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c8692['options']?_0x2c8692[_0xa2a4('0x19')]['where']||null:null,'attributes':_0x2c8692['options']?_0x2c8692[_0xa2a4('0x19')][_0xa2a4('0x1b')]||null:null,'limit':_0x2c8692['options']?_0x2c8692[_0xa2a4('0x19')][_0xa2a4('0x1c')]||null:null})['then'](function(_0x4ddefb){logger[_0xa2a4('0x13')]('UpdateMemberReport',_0x2c8692);logger[_0xa2a4('0x20')]('UpdateMemberReport',_0x2c8692,JSON['stringify'](_0x4ddefb));_0x1b155f(_0x4ddefb);})['catch'](function(_0x41cb13){logger[_0xa2a4('0x10')](_0xa2a4('0x24'),_0x41cb13[_0xa2a4('0x12')],_0x2c8692);_0x1d7d91(_0x3f756d[_0xa2a4('0x10')](0x1f4,_0x41cb13[_0xa2a4('0x12')]));});});}; \ No newline at end of file +var _0x8092=['jayson/promise','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','options','where','attributes','limit','map','include','model','then','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x8092,0x1a9));var _0x2809=function(_0x368aed,_0x302755){_0x368aed=_0x368aed-0x0;var _0x269976=_0x8092[_0x368aed];return _0x269976;};'use strict';var _=require(_0x2809('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2809('0x1'));var rs=require(_0x2809('0x2'));var fs=require('fs');var Redis=require(_0x2809('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2809('0x4'));var logger=require(_0x2809('0x5'))('rpc');var config=require(_0x2809('0x6'));var jayson=require(_0x2809('0x7'));var client=jayson['client'][_0x2809('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c1541,_0x34f503,_0x23efdb){return new BPromise(function(_0x1fef0f,_0x529754){return client[_0x2809('0x9')](_0x4c1541,_0x23efdb)['then'](function(_0x1c7bff){logger[_0x2809('0xa')](_0x2809('0xb'),_0x34f503,_0x2809('0xc'));logger[_0x2809('0xd')](_0x2809('0xe'),_0x34f503,_0x2809('0xc'),JSON[_0x2809('0xf')](_0x1c7bff));if(_0x1c7bff['error']){if(_0x1c7bff[_0x2809('0x10')][_0x2809('0x11')]===0x1f4){logger['error'](_0x2809('0xb'),_0x34f503,_0x1c7bff[_0x2809('0x10')]['message']);return _0x529754(_0x1c7bff['error'][_0x2809('0x12')]);}logger[_0x2809('0x10')](_0x2809('0xb'),_0x34f503,_0x1c7bff[_0x2809('0x10')][_0x2809('0x12')]);return _0x1fef0f(_0x1c7bff[_0x2809('0x10')]['message']);}else{logger[_0x2809('0xa')](_0x2809('0xb'),_0x34f503,_0x2809('0xc'));_0x1fef0f(_0x1c7bff[_0x2809('0x13')]['message']);}})[_0x2809('0x14')](function(_0x16dcdc){logger[_0x2809('0x10')](_0x2809('0xb'),_0x34f503,_0x16dcdc);_0x529754(_0x16dcdc);});});}exports[_0x2809('0x15')]=function(_0x216d98){var _0x315d34=this;return new Promise(function(_0x5eed20,_0x4d0d46){return db[_0x2809('0x16')]['findAll']({'raw':_0x216d98[_0x2809('0x17')]?_0x216d98[_0x2809('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x216d98['options']?_0x216d98[_0x2809('0x17')][_0x2809('0x18')]||null:null,'attributes':_0x216d98['options']?_0x216d98[_0x2809('0x17')][_0x2809('0x19')]||null:null,'limit':_0x216d98['options']?_0x216d98[_0x2809('0x17')][_0x2809('0x1a')]||null:null,'include':_0x216d98[_0x2809('0x17')]?_0x216d98[_0x2809('0x17')]['include']?_[_0x2809('0x1b')](_0x216d98[_0x2809('0x17')][_0x2809('0x1c')],function(_0x25f452){return{'model':db[_0x25f452[_0x2809('0x1d')]],'as':_0x25f452['as'],'attributes':_0x25f452[_0x2809('0x19')],'include':_0x25f452['include']?_['map'](_0x25f452[_0x2809('0x1c')],function(_0x5254b0){return{'model':db[_0x5254b0[_0x2809('0x1d')]],'as':_0x5254b0['as'],'attributes':_0x5254b0[_0x2809('0x19')],'include':_0x5254b0['include']?_[_0x2809('0x1b')](_0x5254b0['include'],function(_0x488da0){return{'model':db[_0x488da0['model']],'as':_0x488da0['as'],'attributes':_0x488da0['attributes']};}):[]};}):[]};}):[]:[]})[_0x2809('0x1e')](function(_0x1a895b){logger['info'](_0x2809('0x15'),_0x216d98);logger[_0x2809('0xd')](_0x2809('0x15'),_0x216d98,JSON['stringify'](_0x1a895b));_0x5eed20(_0x1a895b);})[_0x2809('0x14')](function(_0x55b6c6){logger[_0x2809('0x10')]('GetMemberReport',_0x55b6c6[_0x2809('0x12')],_0x216d98);_0x4d0d46(_0x315d34[_0x2809('0x10')](0x1f4,_0x55b6c6[_0x2809('0x12')]));});});};exports[_0x2809('0x1f')]=function(_0x5c0f57){var _0x691a5c=this;return new Promise(function(_0x2ffe49,_0x4567d5){return db['MemberReport'][_0x2809('0x20')](_0x5c0f57[_0x2809('0x21')],{'raw':_0x5c0f57[_0x2809('0x17')]?_0x5c0f57[_0x2809('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x2809('0x1e')](function(_0xdf2637){logger[_0x2809('0xa')](_0x2809('0x1f'),_0x5c0f57);logger[_0x2809('0xd')](_0x2809('0x1f'),_0x5c0f57,JSON[_0x2809('0xf')](_0xdf2637));_0x2ffe49(_0xdf2637);})[_0x2809('0x14')](function(_0x4948e9){logger['error']('CreateMemberReport',_0x4948e9[_0x2809('0x12')],_0x5c0f57);_0x4567d5(_0x691a5c['error'](0x1f4,_0x4948e9[_0x2809('0x12')]));});});};exports[_0x2809('0x22')]=function(_0xed3c4e){var _0x2ce6b7=this;return new Promise(function(_0x21d95d,_0x138a0e){return db[_0x2809('0x16')][_0x2809('0x23')](_0xed3c4e[_0x2809('0x21')],{'raw':_0xed3c4e[_0x2809('0x17')]?_0xed3c4e[_0x2809('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xed3c4e['options']?_0xed3c4e[_0x2809('0x17')]['where']||null:null,'attributes':_0xed3c4e[_0x2809('0x17')]?_0xed3c4e[_0x2809('0x17')][_0x2809('0x19')]||null:null,'limit':_0xed3c4e[_0x2809('0x17')]?_0xed3c4e[_0x2809('0x17')][_0x2809('0x1a')]||null:null})[_0x2809('0x1e')](function(_0x352363){logger[_0x2809('0xa')](_0x2809('0x22'),_0xed3c4e);logger['debug'](_0x2809('0x22'),_0xed3c4e,JSON['stringify'](_0x352363));_0x21d95d(_0x352363);})[_0x2809('0x14')](function(_0x3123af){logger['error']('UpdateMemberReport',_0x3123af[_0x2809('0x12')],_0xed3c4e);_0x138a0e(_0x2ce6b7[_0x2809('0x10')](0x1f4,_0x3123af[_0x2809('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 773cfdc..755954e 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 _0x0713=['index','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./migration.controller','get'];(function(_0x29f80e,_0x9027ff){var _0x5c7eaa=function(_0x48ec7c){while(--_0x48ec7c){_0x29f80e['push'](_0x29f80e['shift']());}};_0x5c7eaa(++_0x9027ff);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',controller[_0x3071('0x8')]);module[_0x3071('0x9')]=router; \ No newline at end of file +var _0xc788=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports','multer','util','path','Router'];(function(_0x536b33,_0xab0be1){var _0x53018c=function(_0x3bcc81){while(--_0x3bcc81){_0x536b33['push'](_0x536b33['shift']());}};_0x53018c(++_0xab0be1);}(_0xc788,0xc4));var _0x8c78=function(_0x188be2,_0x353598){_0x188be2=_0x188be2-0x0;var _0x1d1fca=_0xc788[_0x188be2];return _0x1d1fca;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var auth=require(_0x8c78('0x4'));var interaction=require(_0x8c78('0x5'));var config=require(_0x8c78('0x6'));var controller=require(_0x8c78('0x7'));router['get']('/',controller[_0x8c78('0x8')]);module[_0x8c78('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 9c9c1eb..bd4b53e 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 _0x1fc9=['STRING','sequelize','exports'];(function(_0x1f6657,_0x1c65be){var _0x4a388d=function(_0x35824c){while(--_0x35824c){_0x1f6657['push'](_0x1f6657['shift']());}};_0x4a388d(++_0x1c65be);}(_0x1fc9,0x1e4));var _0x91fc=function(_0x24a382,_0x3d3a90){_0x24a382=_0x24a382-0x0;var _0x208440=_0x1fc9[_0x24a382];return _0x208440;};'use strict';var Sequelize=require(_0x91fc('0x0'));module[_0x91fc('0x1')]={'version':{'type':Sequelize[_0x91fc('0x2')],'unique':'version'}}; \ No newline at end of file +var _0x6c5f=['sequelize','STRING','version'];(function(_0x196a0a,_0x2e62fa){var _0x1df5b3=function(_0x475ec5){while(--_0x475ec5){_0x196a0a['push'](_0x196a0a['shift']());}};_0x1df5b3(++_0x2e62fa);}(_0x6c5f,0x165));var _0xf6c5=function(_0x3bdef4,_0x40b534){_0x3bdef4=_0x3bdef4-0x0;var _0x46adca=_0x6c5f[_0x3bdef4];return _0x46adca;};'use strict';var Sequelize=require(_0xf6c5('0x0'));module['exports']={'version':{'type':Sequelize[_0xf6c5('0x1')],'unique':_0xf6c5('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index beda971..2765f6a 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 _0x9bde=['index','map','Migration','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','includeAll','include','findAll','rows','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','sendStatus','error','stack','name'];(function(_0x304f0e,_0x2604c6){var _0x26858c=function(_0x277b8d){while(--_0x277b8d){_0x304f0e['push'](_0x304f0e['shift']());}};_0x26858c(++_0x2604c6);}(_0x9bde,0xe1));var _0xe9bd=function(_0x21175d,_0x402553){_0x21175d=_0x21175d-0x0;var _0x5a1e91=_0x9bde[_0x21175d];return _0x5a1e91;};'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(){_0x133318[_0xe9bd('0x19')](0xcc)[_0xe9bd('0x1a')]();});}};}function handleEntityNotFound(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(!_0x5bc4bf){_0x36f8c0[_0xe9bd('0x27')](0x194);}return _0x5bc4bf;};}function handleError(_0x1e3cbb,_0x2c9a57){_0x2c9a57=_0x2c9a57||0x1f4;return function(_0x39b206){logger[_0xe9bd('0x28')](_0x39b206[_0xe9bd('0x29')]);if(_0x39b206[_0xe9bd('0x2a')]){delete _0x39b206[_0xe9bd('0x2a')];}_0x1e3cbb[_0xe9bd('0x19')](_0x2c9a57)['send'](_0x39b206);};}exports[_0xe9bd('0x2b')]=function(_0x38fdfa,_0x5ba1d6){var _0x3b13b7={},_0xc25248={},_0x119672={'count':0x0,'rows':[]};var _0x429055=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')]['rawAttributes'],function(_0x5b7f1d){return{'name':_0x5b7f1d[_0xe9bd('0x2e')],'type':_0x5b7f1d['type'][_0xe9bd('0x2f')]};});_0xc25248[_0xe9bd('0x30')]=_[_0xe9bd('0x2c')](_0x429055,_0xe9bd('0x2a'));_0xc25248[_0xe9bd('0x31')]=_['keys'](_0x38fdfa['query']);_0xc25248[_0xe9bd('0x32')]=_[_0xe9bd('0x33')](_0xc25248[_0xe9bd('0x30')],_0xc25248[_0xe9bd('0x31')]);_0x3b13b7[_0xe9bd('0x34')]=_[_0xe9bd('0x33')](_0xc25248[_0xe9bd('0x30')],qs[_0xe9bd('0x35')](_0x38fdfa[_0xe9bd('0x31')]['fields']));_0x3b13b7[_0xe9bd('0x34')]=_0x3b13b7[_0xe9bd('0x34')][_0xe9bd('0x36')]?_0x3b13b7['attributes']:_0xc25248['model'];if(!_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x37')](_0xe9bd('0x38'))){_0x3b13b7[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x1e')]);_0x3b13b7[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x1d')]);}_0x3b13b7[_0xe9bd('0x39')]=qs[_0xe9bd('0x3a')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x3a')]);_0x3b13b7[_0xe9bd('0x3b')]=qs[_0xe9bd('0x32')](_[_0xe9bd('0x3c')](_0x38fdfa['query'],_0xc25248[_0xe9bd('0x32')]),_0x429055);if(_0x38fdfa[_0xe9bd('0x31')]['filter']){_0x3b13b7[_0xe9bd('0x3b')]=_[_0xe9bd('0x3d')](_0x3b13b7['where'],{'$or':_['map'](_0x429055,function(_0x2785e6){if(_0x2785e6[_0xe9bd('0x3e')]!=='VIRTUAL'){var _0x2d1289={};_0x2d1289[_0x2785e6[_0xe9bd('0x2a')]]={'$like':'%'+_0x38fdfa[_0xe9bd('0x31')]['filter']+'%'};return _0x2d1289;}})});}_0x3b13b7=_[_0xe9bd('0x3d')]({},_0x3b13b7,_0x38fdfa['options']);var _0x3c8f7e={'where':_0x3b13b7[_0xe9bd('0x3b')]};return db[_0xe9bd('0x2d')][_0xe9bd('0x1c')](_0x3c8f7e)['then'](function(_0x41f2d4){_0x119672[_0xe9bd('0x1c')]=_0x41f2d4;if(_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x3f')]){_0x3b13b7[_0xe9bd('0x40')]=[{'all':!![]}];}return db[_0xe9bd('0x2d')][_0xe9bd('0x41')](_0x3b13b7);})[_0xe9bd('0x25')](function(_0x2b5a71){_0x119672[_0xe9bd('0x42')]=_0x2b5a71;return _0x119672;})['then'](respondWithFilteredResult(_0x5ba1d6,_0x3b13b7))['catch'](handleError(_0x5ba1d6,null));}; \ No newline at end of file +var _0x4b84=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','count','offset','limit','set','Content-Range','reject','save','update','then','status','error','stack','name','index','map','Migration','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','ejs','squel','jsforce','querystring','papaparse','ioredis'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x4b84[_0x2f71f6];return _0x2b23ea;};'use strict';var pdf=require(_0x44b8('0x0'));var emlformat=require(_0x44b8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x44b8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x44b8('0x3'));var Mustache=require(_0x44b8('0x4'));var util=require(_0x44b8('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x44b8('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x147529,_0x4301a6){_0x4301a6=_0x4301a6||0xcc;return function(_0x4bcc43){if(_0x4bcc43){return _0x147529[_0x44b8('0x13')](_0x4301a6);}return _0x147529['status'](_0x4301a6)[_0x44b8('0x14')]();};}function respondWithResult(_0x18d642,_0x4df670){_0x4df670=_0x4df670||0xc8;return function(_0x63e8f6){if(_0x63e8f6){return _0x18d642['status'](_0x4df670)['json'](_0x63e8f6);}};}function respondWithFilteredResult(_0x2a3e4c,_0x2af0ad){return function(_0x1722da){if(_0x1722da){var _0x41ab46=_0x1722da[_0x44b8('0x15')],_0x5e52f2=_0x2af0ad['offset'],_0x495c74=_0x2af0ad[_0x44b8('0x16')]+_0x2af0ad[_0x44b8('0x17')],_0x5d6349;if(_0x495c74>=_0x41ab46){_0x495c74=_0x41ab46;_0x5d6349=0xc8;}else{_0x5d6349=0xce;}_0x2a3e4c['status'](_0x5d6349);return _0x2a3e4c[_0x44b8('0x18')](_0x44b8('0x19'),_0x5e52f2+'-'+_0x495c74+'/'+_0x41ab46)['json'](_0x1722da);}return null;};}function patchUpdates(_0x89bc30){return function(_0x3f4688){try{jsonpatch['apply'](_0x3f4688,_0x89bc30,!![]);}catch(_0xcce202){return BPromise[_0x44b8('0x1a')](_0xcce202);}return _0x3f4688[_0x44b8('0x1b')]();};}function saveUpdates(_0x235bdc,_0x102ef9){return function(_0x369c09){if(_0x369c09){return _0x369c09[_0x44b8('0x1c')](_0x235bdc)[_0x44b8('0x1d')](function(_0x429461){return _0x429461;});}return null;};}function removeEntity(_0x1e0f2d,_0x1d642b){return function(_0x14996c){if(_0x14996c){return _0x14996c['destroy']()[_0x44b8('0x1d')](function(){_0x1e0f2d[_0x44b8('0x1e')](0xcc)[_0x44b8('0x14')]();});}};}function handleEntityNotFound(_0x1418db,_0x305a5c){return function(_0x51a34a){if(!_0x51a34a){_0x1418db[_0x44b8('0x13')](0x194);}return _0x51a34a;};}function handleError(_0x54677c,_0x41a922){_0x41a922=_0x41a922||0x1f4;return function(_0x228c81){logger[_0x44b8('0x1f')](_0x228c81[_0x44b8('0x20')]);if(_0x228c81[_0x44b8('0x21')]){delete _0x228c81['name'];}_0x54677c[_0x44b8('0x1e')](_0x41a922)['send'](_0x228c81);};}exports[_0x44b8('0x22')]=function(_0x350482,_0x549a26){var _0x17ac44={},_0x470f49={},_0x2656d7={'count':0x0,'rows':[]};var _0x59c1bf=_[_0x44b8('0x23')](db[_0x44b8('0x24')]['rawAttributes'],function(_0x2e0174){return{'name':_0x2e0174['fieldName'],'type':_0x2e0174[_0x44b8('0x25')]['key']};});_0x470f49['model']=_['map'](_0x59c1bf,_0x44b8('0x21'));_0x470f49[_0x44b8('0x26')]=_[_0x44b8('0x27')](_0x350482[_0x44b8('0x26')]);_0x470f49[_0x44b8('0x28')]=_[_0x44b8('0x29')](_0x470f49[_0x44b8('0x2a')],_0x470f49[_0x44b8('0x26')]);_0x17ac44[_0x44b8('0x2b')]=_[_0x44b8('0x29')](_0x470f49[_0x44b8('0x2a')],qs[_0x44b8('0x2c')](_0x350482[_0x44b8('0x26')]['fields']));_0x17ac44[_0x44b8('0x2b')]=_0x17ac44['attributes'][_0x44b8('0x2d')]?_0x17ac44[_0x44b8('0x2b')]:_0x470f49[_0x44b8('0x2a')];if(!_0x350482[_0x44b8('0x26')][_0x44b8('0x2e')]('nolimit')){_0x17ac44[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x350482[_0x44b8('0x26')][_0x44b8('0x17')]);_0x17ac44[_0x44b8('0x16')]=qs['offset'](_0x350482[_0x44b8('0x26')][_0x44b8('0x16')]);}_0x17ac44[_0x44b8('0x2f')]=qs[_0x44b8('0x30')](_0x350482[_0x44b8('0x26')][_0x44b8('0x30')]);_0x17ac44[_0x44b8('0x31')]=qs[_0x44b8('0x28')](_[_0x44b8('0x32')](_0x350482[_0x44b8('0x26')],_0x470f49[_0x44b8('0x28')]),_0x59c1bf);if(_0x350482[_0x44b8('0x26')][_0x44b8('0x33')]){_0x17ac44[_0x44b8('0x31')]=_[_0x44b8('0x34')](_0x17ac44[_0x44b8('0x31')],{'$or':_[_0x44b8('0x23')](_0x59c1bf,function(_0xeff999){if(_0xeff999[_0x44b8('0x25')]!==_0x44b8('0x35')){var _0x2c02d6={};_0x2c02d6[_0xeff999[_0x44b8('0x21')]]={'$like':'%'+_0x350482['query'][_0x44b8('0x33')]+'%'};return _0x2c02d6;}})});}_0x17ac44=_[_0x44b8('0x34')]({},_0x17ac44,_0x350482['options']);var _0x25688b={'where':_0x17ac44[_0x44b8('0x31')]};return db[_0x44b8('0x24')][_0x44b8('0x15')](_0x25688b)['then'](function(_0x221543){_0x2656d7[_0x44b8('0x15')]=_0x221543;if(_0x350482[_0x44b8('0x26')][_0x44b8('0x36')]){_0x17ac44[_0x44b8('0x37')]=[{'all':!![]}];}return db[_0x44b8('0x24')][_0x44b8('0x38')](_0x17ac44);})[_0x44b8('0x1d')](function(_0x209039){_0x2656d7[_0x44b8('0x39')]=_0x209039;return _0x2656d7;})[_0x44b8('0x1d')](respondWithFilteredResult(_0x549a26,_0x17ac44))[_0x44b8('0x3a')](handleError(_0x549a26,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 787a929..674f063 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 _0x9d02=['lodash','../../config/logger','moment','request-promise','path','../../config/environment','./migration.attributes','exports','Migration','migrations'];(function(_0x3f3194,_0x307fcd){var _0x588d9c=function(_0x5ef84b){while(--_0x5ef84b){_0x3f3194['push'](_0x3f3194['shift']());}};_0x588d9c(++_0x307fcd);}(_0x9d02,0x118));var _0x29d0=function(_0x4958dc,_0x178210){_0x4958dc=_0x4958dc-0x0;var _0xfc384f=_0x9d02[_0x4958dc];return _0xfc384f;};'use strict';var _=require(_0x29d0('0x0'));var util=require('util');var logger=require(_0x29d0('0x1'))('api');var moment=require(_0x29d0('0x2'));var BPromise=require('bluebird');var rp=require(_0x29d0('0x3'));var fs=require('fs');var path=require(_0x29d0('0x4'));var rimraf=require('rimraf');var config=require(_0x29d0('0x5'));var attributes=require(_0x29d0('0x6'));module[_0x29d0('0x7')]=function(_0x5a9824,_0x5ef279){return _0x5a9824['define'](_0x29d0('0x8'),attributes,{'tableName':_0x29d0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8ea=['path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x10d830,_0x479c65){var _0x17c75e=function(_0xaa57b1){while(--_0xaa57b1){_0x10d830['push'](_0x10d830['shift']());}};_0x17c75e(++_0x479c65);}(_0xd8ea,0x1bd));var _0xad8e=function(_0x4fb170,_0x495b66){_0x4fb170=_0x4fb170-0x0;var _0x5074d4=_0xd8ea[_0x4fb170];return _0x5074d4;};'use strict';var _=require(_0xad8e('0x0'));var util=require(_0xad8e('0x1'));var logger=require(_0xad8e('0x2'))(_0xad8e('0x3'));var moment=require(_0xad8e('0x4'));var BPromise=require(_0xad8e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad8e('0x6'));var rimraf=require(_0xad8e('0x7'));var config=require(_0xad8e('0x8'));var attributes=require('./migration.attributes');module[_0xad8e('0x9')]=function(_0x298e30,_0x458172){return _0x298e30[_0xad8e('0xa')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 5135d55..0d9568a 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 _0x3174=['info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x2f32c4,_0x35729f){var _0x324f99=function(_0x53afb2){while(--_0x53afb2){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x324f99(++_0x35729f);}(_0x3174,0x154));var _0x4317=function(_0x229e3f,_0x28cb23){_0x229e3f=_0x229e3f-0x0;var _0x26baec=_0x3174[_0x229e3f];return _0x26baec;};'use strict';var _=require(_0x4317('0x0'));var util=require('util');var moment=require(_0x4317('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4317('0x2'));var db=require(_0x4317('0x3'))['db'];var utils=require(_0x4317('0x4'));var logger=require(_0x4317('0x5'))(_0x4317('0x6'));var config=require('../../config/environment');var jayson=require(_0x4317('0x7'));var client=jayson[_0x4317('0x8')][_0x4317('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x278cbb,_0x90b2b9,_0x390b2b){return new BPromise(function(_0x5440fb,_0x22cd7b){return client[_0x4317('0xa')](_0x278cbb,_0x390b2b)[_0x4317('0xb')](function(_0x5d921f){logger[_0x4317('0xc')](_0x4317('0xd'),_0x90b2b9,_0x4317('0xe'));logger[_0x4317('0xf')](_0x4317('0x10'),_0x90b2b9,_0x4317('0xe'),JSON['stringify'](_0x5d921f));if(_0x5d921f['error']){if(_0x5d921f[_0x4317('0x11')][_0x4317('0x12')]===0x1f4){logger[_0x4317('0x11')](_0x4317('0xd'),_0x90b2b9,_0x5d921f[_0x4317('0x11')][_0x4317('0x13')]);return _0x22cd7b(_0x5d921f[_0x4317('0x11')][_0x4317('0x13')]);}logger[_0x4317('0x11')](_0x4317('0xd'),_0x90b2b9,_0x5d921f[_0x4317('0x11')]['message']);return _0x5440fb(_0x5d921f['error'][_0x4317('0x13')]);}else{logger[_0x4317('0xc')](_0x4317('0xd'),_0x90b2b9,_0x4317('0xe'));_0x5440fb(_0x5d921f[_0x4317('0x14')][_0x4317('0x13')]);}})[_0x4317('0x15')](function(_0x22480e){logger[_0x4317('0x11')](_0x4317('0xd'),_0x90b2b9,_0x22480e);_0x22cd7b(_0x22480e);});});} \ No newline at end of file +var _0x6db8=['then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','Migration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x552c25,_0x1ca12a){var _0x247c77=function(_0x2a8cef){while(--_0x2a8cef){_0x552c25['push'](_0x552c25['shift']());}};_0x247c77(++_0x1ca12a);}(_0x6db8,0x1d3));var _0x86db=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x6db8[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x86db('0x0'));var util=require(_0x86db('0x1'));var moment=require(_0x86db('0x2'));var BPromise=require(_0x86db('0x3'));var rs=require(_0x86db('0x4'));var fs=require('fs');var Redis=require(_0x86db('0x5'));var db=require(_0x86db('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x86db('0x7'))('rpc');var config=require(_0x86db('0x8'));var jayson=require(_0x86db('0x9'));var client=jayson[_0x86db('0xa')][_0x86db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x549139,_0x5c50c4,_0x2f231c){return new BPromise(function(_0x1f8695,_0x44f946){return client[_0x86db('0xc')](_0x549139,_0x2f231c)[_0x86db('0xd')](function(_0x25bfa){logger[_0x86db('0xe')]('Migration,\x20%s,\x20%s',_0x5c50c4,_0x86db('0xf'));logger[_0x86db('0x10')](_0x86db('0x11'),_0x5c50c4,_0x86db('0xf'),JSON['stringify'](_0x25bfa));if(_0x25bfa[_0x86db('0x12')]){if(_0x25bfa[_0x86db('0x12')][_0x86db('0x13')]===0x1f4){logger[_0x86db('0x12')]('Migration,\x20%s,\x20%s',_0x5c50c4,_0x25bfa[_0x86db('0x12')][_0x86db('0x14')]);return _0x44f946(_0x25bfa['error'][_0x86db('0x14')]);}logger['error'](_0x86db('0x15'),_0x5c50c4,_0x25bfa[_0x86db('0x12')][_0x86db('0x14')]);return _0x1f8695(_0x25bfa[_0x86db('0x12')][_0x86db('0x14')]);}else{logger['info'](_0x86db('0x15'),_0x5c50c4,_0x86db('0xf'));_0x1f8695(_0x25bfa[_0x86db('0x16')][_0x86db('0x14')]);}})[_0x86db('0x17')](function(_0x252c1c){logger[_0x86db('0x12')](_0x86db('0x15'),_0x5c50c4,_0x252c1c);_0x44f946(_0x252c1c);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index ec27933..d121d8f 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 _0xd298=['isAuthenticated','get','/:id','post','create','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xd298,0xf8));var _0x8d29=function(_0x1cfb37,_0x5c8f3e){_0x1cfb37=_0x1cfb37-0x0;var _0x510f9e=_0xd298[_0x1cfb37];return _0x510f9e;};'use strict';var multer=require(_0x8d29('0x0'));var util=require('util');var path=require(_0x8d29('0x1'));var timeout=require(_0x8d29('0x2'));var express=require(_0x8d29('0x3'));var router=express[_0x8d29('0x4')]();var auth=require(_0x8d29('0x5'));var interaction=require(_0x8d29('0x6'));var config=require('../../config/environment');var controller=require('./network.controller');router['get']('/',auth[_0x8d29('0x7')](),controller['index']);router[_0x8d29('0x8')](_0x8d29('0x9'),auth[_0x8d29('0x7')](),controller['show']);router[_0x8d29('0xa')]('/',auth[_0x8d29('0x7')](),controller[_0x8d29('0xb')]);router['put'](_0x8d29('0x9'),auth[_0x8d29('0x7')](),controller[_0x8d29('0xc')]);router['delete'](_0x8d29('0x9'),auth['isAuthenticated'](),controller[_0x8d29('0xd')]);module[_0x8d29('0xe')]=router; \ No newline at end of file +var _0x4629=['post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id'];(function(_0x146be0,_0x39a85e){var _0x1bcc25=function(_0x4f871f){while(--_0x4f871f){_0x146be0['push'](_0x146be0['shift']());}};_0x1bcc25(++_0x39a85e);}(_0x4629,0x136));var _0x9462=function(_0x1d1fa6,_0x331dc0){_0x1d1fa6=_0x1d1fa6-0x0;var _0x5e1a83=_0x4629[_0x1d1fa6];return _0x5e1a83;};'use strict';var multer=require('multer');var util=require(_0x9462('0x0'));var path=require(_0x9462('0x1'));var timeout=require(_0x9462('0x2'));var express=require(_0x9462('0x3'));var router=express[_0x9462('0x4')]();var auth=require(_0x9462('0x5'));var interaction=require(_0x9462('0x6'));var config=require(_0x9462('0x7'));var controller=require(_0x9462('0x8'));router[_0x9462('0x9')]('/',auth[_0x9462('0xa')](),controller[_0x9462('0xb')]);router[_0x9462('0x9')](_0x9462('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x9462('0xd')]('/',auth['isAuthenticated'](),controller[_0x9462('0xe')]);router[_0x9462('0xf')](_0x9462('0xc'),auth[_0x9462('0xa')](),controller['update']);router[_0x9462('0x10')](_0x9462('0xc'),auth['isAuthenticated'](),controller[_0x9462('0x11')]);module[_0x9462('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index cfdf8a4..7958d31 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(_0x22daba,_0x4ee541){var _0x5a6588=function(_0x53ab35){while(--_0x53ab35){_0x22daba['push'](_0x22daba['shift']());}};_0x5a6588(++_0x4ee541);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x37a668,_0x13aea9){var _0x2ce3c1=function(_0x5c7c8f){while(--_0x5c7c8f){_0x37a668['push'](_0x37a668['shift']());}};_0x2ce3c1(++_0x13aea9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 1c8a217..f8ec712 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 _0x06c0=['lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','sendStatus','stack','name','send','index','map','fieldName','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','Network','includeAll','include','show','params','rawAttributes','find','create','transaction','findAll','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format','toLowerCase','sequelize','res_stun_monitor.so','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x06c0,0x1ad));var _0x006c=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x06c0[_0x102e37];return _0x35a07c;};'use strict';var pdf=require(_0x006c('0x0'));var emlformat=require(_0x006c('0x1'));var rimraf=require(_0x006c('0x2'));var zipdir=require(_0x006c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x006c('0x4'));var moment=require('moment');var BPromise=require(_0x006c('0x5'));var Mustache=require(_0x006c('0x6'));var util=require(_0x006c('0x7'));var path=require(_0x006c('0x8'));var sox=require(_0x006c('0x9'));var csv=require('to-csv');var ejs=require(_0x006c('0xa'));var fs=require('fs');var _=require(_0x006c('0xb'));var squel=require(_0x006c('0xc'));var crypto=require(_0x006c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x006c('0xe'));var toCsv=require(_0x006c('0xf'));var querystring=require('querystring');var Papa=require(_0x006c('0x10'));var Redis=require(_0x006c('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x006c('0x12'));var hardwareService=require(_0x006c('0x13'));var logger=require('../../config/logger')(_0x006c('0x14'));var utils=require(_0x006c('0x15'));var config=require(_0x006c('0x16'));var db=require(_0x006c('0x17'))['db'];var jayson=require(_0x006c('0x18'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x339887,_0x393ec0,_0x259fc5){if(_0x259fc5){var _0x3ce472=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ce472[_0x006c('0x19')](_0x393ec0)){return _0x339887;}else{throw new db[(_0x006c('0x1a'))]['ValidationError'](_0x006c('0x1b'));}}else{return _0x339887;}}function respondWithRpcPromise(_0x58876b,_0x17a628,_0x4ebb1d,_0x190715){return new BPromise(function(_0x90b45a,_0x305d87){var _0x452123=_0x190715||client;return _0x452123[_0x006c('0x1c')](_0x58876b,_0x4ebb1d)[_0x006c('0x1d')](function(_0x474352){logger[_0x006c('0x1e')]('Network,\x20%s,\x20%s',_0x17a628,_0x006c('0x1f'));logger[_0x006c('0x20')]('Network,\x20%s,\x20%s,\x20%s',_0x17a628,_0x006c('0x1f'),JSON[_0x006c('0x21')](_0x474352));if(_0x474352[_0x006c('0x22')]){if(_0x474352['error'][_0x006c('0x23')]===0x1f4){logger[_0x006c('0x22')](_0x006c('0x24'),_0x17a628,_0x474352[_0x006c('0x22')][_0x006c('0x25')]);return _0x305d87(_0x474352[_0x006c('0x22')][_0x006c('0x25')]);}logger[_0x006c('0x22')](_0x006c('0x24'),_0x17a628,_0x474352[_0x006c('0x22')]['message']);return _0x90b45a(_0x474352[_0x006c('0x22')]['message']);}else{logger['info'](_0x006c('0x24'),_0x17a628,_0x006c('0x1f'));_0x90b45a(_0x474352[_0x006c('0x26')]['message']);}})[_0x006c('0x27')](function(_0x24340b){logger[_0x006c('0x22')](_0x006c('0x24'),_0x17a628,_0x24340b);_0x305d87(_0x24340b);});});}function respondWithStatusCode(_0x3d33b7,_0x32bd56){_0x32bd56=_0x32bd56||0xcc;return function(_0x3759c2){if(_0x3759c2){return _0x3d33b7['sendStatus'](_0x32bd56);}return _0x3d33b7[_0x006c('0x28')](_0x32bd56)[_0x006c('0x29')]();};}function respondWithResult(_0x48ba47,_0x333c53){_0x333c53=_0x333c53||0xc8;return function(_0x2fd1d9){if(_0x2fd1d9){return _0x48ba47['status'](_0x333c53)[_0x006c('0x2a')](_0x2fd1d9);}};}function respondWithFilteredResult(_0x1aa433,_0x570dfc){return function(_0xbf397c){if(_0xbf397c){var _0x5caf93=_0xbf397c[_0x006c('0x2b')],_0x5e1567=_0x570dfc[_0x006c('0x2c')],_0x26f6e6=_0x570dfc[_0x006c('0x2c')]+_0x570dfc[_0x006c('0x2d')],_0x22d2e9;if(_0x26f6e6>=_0x5caf93){_0x26f6e6=_0x5caf93;_0x22d2e9=0xc8;}else{_0x22d2e9=0xce;}_0x1aa433['status'](_0x22d2e9);return _0x1aa433['set'](_0x006c('0x2e'),_0x5e1567+'-'+_0x26f6e6+'/'+_0x5caf93)['json'](_0xbf397c);}return null;};}function patchUpdates(_0x33f8a2){return function(_0x31c5b5){try{jsonpatch[_0x006c('0x2f')](_0x31c5b5,_0x33f8a2,!![]);}catch(_0x1471ac){return BPromise['reject'](_0x1471ac);}return _0x31c5b5[_0x006c('0x30')]();};}function saveUpdates(_0x2ee02e,_0x3f969b){return function(_0x10597d){if(_0x10597d){return _0x10597d[_0x006c('0x31')](_0x2ee02e)[_0x006c('0x1d')](function(_0x3191a0){return _0x3191a0;});}return null;};}function removeEntity(_0x12d4a9,_0x3f6241){return function(_0x117213){if(_0x117213){return _0x117213[_0x006c('0x32')]()[_0x006c('0x1d')](function(){_0x12d4a9[_0x006c('0x28')](0xcc)[_0x006c('0x29')]();});}};}function handleEntityNotFound(_0xa03c8,_0x33440f){return function(_0x655697){if(!_0x655697){_0xa03c8[_0x006c('0x33')](0x194);}return _0x655697;};}function handleError(_0x3c5d68,_0x695520){_0x695520=_0x695520||0x1f4;return function(_0x472d6f){logger[_0x006c('0x22')](_0x472d6f[_0x006c('0x34')]);if(_0x472d6f['name']){delete _0x472d6f[_0x006c('0x35')];}_0x3c5d68['status'](_0x695520)[_0x006c('0x36')](_0x472d6f);};}exports[_0x006c('0x37')]=function(_0x55102c,_0x577413){var _0x20c716={},_0x1554ee={},_0x1ce03d={'count':0x0,'rows':[]};var _0x525f50=_[_0x006c('0x38')](db['Network']['rawAttributes'],function(_0x28542f){return{'name':_0x28542f[_0x006c('0x39')],'type':_0x28542f['type'][_0x006c('0x3a')]};});_0x1554ee['model']=_[_0x006c('0x38')](_0x525f50,_0x006c('0x35'));_0x1554ee[_0x006c('0x3b')]=_[_0x006c('0x3c')](_0x55102c[_0x006c('0x3b')]);_0x1554ee['filters']=_[_0x006c('0x3d')](_0x1554ee['model'],_0x1554ee[_0x006c('0x3b')]);_0x20c716[_0x006c('0x3e')]=_['intersection'](_0x1554ee[_0x006c('0x3f')],qs[_0x006c('0x40')](_0x55102c[_0x006c('0x3b')][_0x006c('0x40')]));_0x20c716['attributes']=_0x20c716[_0x006c('0x3e')][_0x006c('0x41')]?_0x20c716[_0x006c('0x3e')]:_0x1554ee[_0x006c('0x3f')];if(!_0x55102c[_0x006c('0x3b')][_0x006c('0x42')](_0x006c('0x43'))){_0x20c716[_0x006c('0x2d')]=qs[_0x006c('0x2d')](_0x55102c[_0x006c('0x3b')][_0x006c('0x2d')]);_0x20c716[_0x006c('0x2c')]=qs[_0x006c('0x2c')](_0x55102c[_0x006c('0x3b')][_0x006c('0x2c')]);}_0x20c716[_0x006c('0x44')]=qs[_0x006c('0x45')](_0x55102c[_0x006c('0x3b')][_0x006c('0x45')]);_0x20c716[_0x006c('0x46')]=qs[_0x006c('0x47')](_[_0x006c('0x48')](_0x55102c['query'],_0x1554ee[_0x006c('0x47')]),_0x525f50);if(_0x55102c['query'][_0x006c('0x49')]){_0x20c716[_0x006c('0x46')]=_[_0x006c('0x4a')](_0x20c716['where'],{'$or':_[_0x006c('0x38')](_0x525f50,function(_0x35ff04){if(_0x35ff04[_0x006c('0x4b')]!==_0x006c('0x4c')){var _0x56ad73={};_0x56ad73[_0x35ff04[_0x006c('0x35')]]={'$like':'%'+_0x55102c[_0x006c('0x3b')]['filter']+'%'};return _0x56ad73;}})});}_0x20c716=_['merge']({},_0x20c716,_0x55102c[_0x006c('0x4d')]);var _0x2b3607={'where':_0x20c716[_0x006c('0x46')]};return db[_0x006c('0x4e')][_0x006c('0x2b')](_0x2b3607)[_0x006c('0x1d')](function(_0x457cbc){_0x1ce03d[_0x006c('0x2b')]=_0x457cbc;if(_0x55102c['query'][_0x006c('0x4f')]){_0x20c716[_0x006c('0x50')]=[{'all':!![]}];}return db[_0x006c('0x4e')]['findAll'](_0x20c716);})[_0x006c('0x1d')](function(_0x236771){_0x1ce03d['rows']=_0x236771;return _0x1ce03d;})[_0x006c('0x1d')](respondWithFilteredResult(_0x577413,_0x20c716))[_0x006c('0x27')](handleError(_0x577413,null));};exports[_0x006c('0x51')]=function(_0xa48484,_0x1c430b){var _0x2a4399={'raw':!![],'where':{'id':_0xa48484[_0x006c('0x52')]['id']}},_0x1378e4={};_0x1378e4[_0x006c('0x3f')]=_['keys'](db['Network'][_0x006c('0x53')]);_0x1378e4[_0x006c('0x3b')]=_[_0x006c('0x3c')](_0xa48484[_0x006c('0x3b')]);_0x1378e4[_0x006c('0x47')]=_[_0x006c('0x3d')](_0x1378e4[_0x006c('0x3f')],_0x1378e4[_0x006c('0x3b')]);_0x2a4399[_0x006c('0x3e')]=_['intersection'](_0x1378e4['model'],qs['fields'](_0xa48484[_0x006c('0x3b')][_0x006c('0x40')]));_0x2a4399[_0x006c('0x3e')]=_0x2a4399[_0x006c('0x3e')][_0x006c('0x41')]?_0x2a4399[_0x006c('0x3e')]:_0x1378e4[_0x006c('0x3f')];if(_0xa48484[_0x006c('0x3b')]['includeAll']){_0x2a4399[_0x006c('0x50')]=[{'all':!![]}];}_0x2a4399=_['merge']({},_0x2a4399,_0xa48484['options']);return db[_0x006c('0x4e')][_0x006c('0x54')](_0x2a4399)[_0x006c('0x1d')](handleEntityNotFound(_0x1c430b,null))['then'](respondWithResult(_0x1c430b,null))['catch'](handleError(_0x1c430b,null));};exports[_0x006c('0x55')]=function(_0x410471,_0x2a9d92,_0xd6adea){var _0x2ea1fa;return db['sequelize'][_0x006c('0x56')](function(_0x500450){return db['Network']['create'](_0x410471['body'],{'raw':!![]})[_0x006c('0x1d')](function(_0x1bf13f){_0x2ea1fa=_0x1bf13f;return db[_0x006c('0x4e')][_0x006c('0x57')]({'where':{'type':_0x410471[_0x006c('0x58')][_0x006c('0x4b')]},'raw':!![]});})[_0x006c('0x1d')](function(_0x5cb41b){if(_0x2ea1fa['type']['toUpperCase']()==_0x006c('0x59')){var _0x5c4d41=fs[_0x006c('0x5a')](path[_0x006c('0x5b')](config[_0x006c('0x5c')],_0x006c('0x5d')),_0x006c('0x5e'));var _0x5a3a36=ejs[_0x006c('0x5f')](_0x5c4d41,{'networks':_0x5cb41b||[]});fs[_0x006c('0x60')](_0x006c('0x61'),_0x5a3a36);return respondWithRpcPromise(_0x006c('0x62'),_0x006c('0x55'),{'module':'res_stun_monitor.so'});}else if(_0x2ea1fa[_0x006c('0x4b')][_0x006c('0x63')]()==_0x006c('0x64')){var _0x3f22c8=fs[_0x006c('0x5a')](path[_0x006c('0x5b')](config[_0x006c('0x5c')],_0x006c('0x65')),_0x006c('0x5e'));var _0x1990fa=ejs['render'](_0x3f22c8,{'networks':_0x5cb41b||[]});fs[_0x006c('0x60')]('/etc/asterisk/turn_xcally.conf',_0x1990fa);return respondWithRpcPromise(_0x006c('0x62'),_0x006c('0x55'),{'module':'res_stun_monitor.so'});}else{var _0x30cf5a=fs[_0x006c('0x5a')](path[_0x006c('0x5b')](config[_0x006c('0x5c')],_0x006c('0x66')),_0x006c('0x5e'));var _0x1c927e=ejs['render'](_0x30cf5a,{'networks':_0x5cb41b||[]});fs[_0x006c('0x60')](util[_0x006c('0x67')]('/etc/asterisk/sip_xcally_%s.conf',_0x410471[_0x006c('0x58')][_0x006c('0x4b')][_0x006c('0x68')]()),_0x1c927e);return respondWithRpcPromise('Reload',_0x006c('0x55'),{'module':'chan_sip.so'});}return null;})[_0x006c('0x1d')](function(){return _0x2ea1fa;});})[_0x006c('0x1d')](respondWithResult(_0x2a9d92,0xc9))[_0x006c('0x27')](handleError(_0x2a9d92,null));};exports[_0x006c('0x31')]=function(_0xe2c478,_0x41fba2,_0x4db626){var _0x2eca2a;return db[_0x006c('0x69')]['transaction'](function(_0xc6314){return db[_0x006c('0x4e')]['find']({'where':{'id':_0xe2c478[_0x006c('0x52')]['id']}})['then'](handleEntityNotFound(_0x41fba2,null))[_0x006c('0x1d')](saveUpdates(_0xe2c478[_0x006c('0x58')],null))['then'](function(_0x5d32e3){if(_0x5d32e3){_0x2eca2a=_0x5d32e3;return db['Network'][_0x006c('0x57')]({'where':{'type':_0x2eca2a[_0x006c('0x4b')]},'raw':!![]});}return null;})[_0x006c('0x1d')](function(_0x32420e){if(_0x2eca2a[_0x006c('0x4b')][_0x006c('0x63')]()==_0x006c('0x59')){var _0x267d2d=fs[_0x006c('0x5a')](path[_0x006c('0x5b')](config[_0x006c('0x5c')],_0x006c('0x5d')),_0x006c('0x5e'));var _0x5e4e56=ejs[_0x006c('0x5f')](_0x267d2d,{'networks':_0x32420e||[]});fs['writeFileSync'](_0x006c('0x61'),_0x5e4e56);return respondWithRpcPromise('Reload','update',{'module':_0x006c('0x6a')});}else if(_0x2eca2a['type'][_0x006c('0x63')]()==_0x006c('0x64')){var _0x45292e=fs[_0x006c('0x5a')](path[_0x006c('0x5b')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x006c('0x5e'));var _0x378cf4=ejs[_0x006c('0x5f')](_0x45292e,{'networks':_0x32420e||[]});fs[_0x006c('0x60')](_0x006c('0x6b'),_0x378cf4);return respondWithRpcPromise('Reload',_0x006c('0x31'),{'module':'res_stun_monitor.so'});}else{var _0x47fb2f=fs[_0x006c('0x5a')](path[_0x006c('0x5b')](config[_0x006c('0x5c')],_0x006c('0x66')),_0x006c('0x5e'));var _0xc3d617=ejs[_0x006c('0x5f')](_0x47fb2f,{'networks':_0x32420e||[]});fs[_0x006c('0x60')](util[_0x006c('0x67')](_0x006c('0x6c'),_0xe2c478[_0x006c('0x58')][_0x006c('0x4b')][_0x006c('0x68')]()),_0xc3d617);return respondWithRpcPromise(_0x006c('0x62'),_0x006c('0x31'),{'module':_0x006c('0x6d')});}return null;})[_0x006c('0x1d')](function(_0x483f95){if(_0x483f95){return _0x2eca2a;}return null;});})[_0x006c('0x1d')](respondWithResult(_0x41fba2,null))[_0x006c('0x27')](handleError(_0x41fba2,null));};exports['destroy']=function(_0x452d27,_0x5e2bf3,_0x114815){var _0x54ec77;return db['Network'][_0x006c('0x54')]({'where':{'id':_0x452d27['params']['id']}})['then'](function(_0x2e5d36){_0x54ec77=_0x2e5d36;return _0x2e5d36;})[_0x006c('0x1d')](handleEntityNotFound(_0x5e2bf3,null))[_0x006c('0x1d')](removeEntity(_0x5e2bf3,null))[_0x006c('0x1d')](function(){if(_0x54ec77){return db[_0x006c('0x4e')][_0x006c('0x57')]({'where':{'type':_0x54ec77[_0x006c('0x4b')]},'raw':!![]});}})[_0x006c('0x1d')](function(_0x50afc0){if(_0x54ec77[_0x006c('0x4b')]['toUpperCase']()==_0x006c('0x59')){var _0x24cb4b=fs[_0x006c('0x5a')](path['join'](config[_0x006c('0x5c')],_0x006c('0x5d')),_0x006c('0x5e'));var _0x531288=ejs[_0x006c('0x5f')](_0x24cb4b,{'networks':_0x50afc0||[]});fs['writeFileSync'](_0x006c('0x61'),_0x531288);return respondWithRpcPromise(_0x006c('0x62'),_0x006c('0x32'),{'module':_0x006c('0x6a')});}else if(_0x54ec77['type'][_0x006c('0x63')]()==_0x006c('0x64')){var _0x68689e=fs['readFileSync'](path[_0x006c('0x5b')](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x2ef803=ejs[_0x006c('0x5f')](_0x68689e,{'networks':_0x50afc0||[]});fs[_0x006c('0x60')](_0x006c('0x6b'),_0x2ef803);return respondWithRpcPromise(_0x006c('0x62'),_0x006c('0x32'),{'module':_0x006c('0x6a')});}else{var _0x2b6c18=fs[_0x006c('0x5a')](path[_0x006c('0x5b')](config[_0x006c('0x5c')],_0x006c('0x66')),'utf8');var _0x4ec5fa=ejs[_0x006c('0x5f')](_0x2b6c18,{'networks':_0x50afc0||[]});fs['writeFileSync'](util[_0x006c('0x67')]('/etc/asterisk/sip_xcally_%s.conf',_0x452d27[_0x006c('0x58')]['type'][_0x006c('0x68')]()),_0x4ec5fa);return respondWithRpcPromise(_0x006c('0x62'),_0x006c('0x32'),{'module':'chan_sip.so'});}return null;})['catch'](handleError(_0x5e2bf3,null));}; \ No newline at end of file +var _0x0957=['Network','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','show','params','rawAttributes','includeAll','include','find','create','sequelize','transaction','body','toUpperCase','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','readFileSync','format','STUN','res_stun_monitor.so','TURN','server/files/templates/network.ejs','toLowerCase','chan_sip.so','/etc/asterisk/sip_xcally_%s.conf','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','end','status','json','limit','set','apply','save','update','destroy','stack','name','send','index'];(function(_0x5d0fae,_0x46069a){var _0x24765f=function(_0x4e6851){while(--_0x4e6851){_0x5d0fae['push'](_0x5d0fae['shift']());}};_0x24765f(++_0x46069a);}(_0x0957,0xa3));var _0x7095=function(_0x179e32,_0x2e7590){_0x179e32=_0x179e32-0x0;var _0x3d1d49=_0x0957[_0x179e32];return _0x3d1d49;};'use strict';var pdf=require(_0x7095('0x0'));var emlformat=require(_0x7095('0x1'));var rimraf=require(_0x7095('0x2'));var zipdir=require(_0x7095('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7095('0x4'));var moment=require(_0x7095('0x5'));var BPromise=require(_0x7095('0x6'));var Mustache=require(_0x7095('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7095('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7095('0x9'));var squel=require(_0x7095('0xa'));var crypto=require(_0x7095('0xb'));var jsforce=require(_0x7095('0xc'));var deskjs=require(_0x7095('0xd'));var toCsv=require(_0x7095('0xe'));var querystring=require(_0x7095('0xf'));var Papa=require('papaparse');var Redis=require(_0x7095('0x10'));var authService=require(_0x7095('0x11'));var qs=require(_0x7095('0x12'));var as=require(_0x7095('0x13'));var hardwareService=require(_0x7095('0x14'));var logger=require(_0x7095('0x15'))('api');var utils=require(_0x7095('0x16'));var config=require('../../config/environment');var db=require(_0x7095('0x17'))['db'];var jayson=require(_0x7095('0x18'));var client=jayson[_0x7095('0x19')][_0x7095('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3692b0,_0x3140c1,_0x3196d3){if(_0x3196d3){var _0x561733=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x561733['test'](_0x3140c1)){return _0x3692b0;}else{throw new db['Sequelize'][(_0x7095('0x1b'))](_0x7095('0x1c'));}}else{return _0x3692b0;}}function respondWithRpcPromise(_0x3a23b1,_0xca9d1f,_0x411e54,_0x681b5c){return new BPromise(function(_0x42bbb3,_0x5437d6){var _0x1ebc12=_0x681b5c||client;return _0x1ebc12[_0x7095('0x1d')](_0x3a23b1,_0x411e54)[_0x7095('0x1e')](function(_0x431060){logger[_0x7095('0x1f')](_0x7095('0x20'),_0xca9d1f,_0x7095('0x21'));logger['debug'](_0x7095('0x22'),_0xca9d1f,'request\x20sent',JSON['stringify'](_0x431060));if(_0x431060[_0x7095('0x23')]){if(_0x431060[_0x7095('0x23')]['code']===0x1f4){logger[_0x7095('0x23')](_0x7095('0x20'),_0xca9d1f,_0x431060[_0x7095('0x23')][_0x7095('0x24')]);return _0x5437d6(_0x431060[_0x7095('0x23')][_0x7095('0x24')]);}logger[_0x7095('0x23')]('Network,\x20%s,\x20%s',_0xca9d1f,_0x431060[_0x7095('0x23')]['message']);return _0x42bbb3(_0x431060[_0x7095('0x23')][_0x7095('0x24')]);}else{logger[_0x7095('0x1f')]('Network,\x20%s,\x20%s',_0xca9d1f,'request\x20sent');_0x42bbb3(_0x431060[_0x7095('0x25')][_0x7095('0x24')]);}})[_0x7095('0x26')](function(_0x5bce6a){logger[_0x7095('0x23')](_0x7095('0x20'),_0xca9d1f,_0x5bce6a);_0x5437d6(_0x5bce6a);});});}function respondWithStatusCode(_0x24c756,_0x68f16d){_0x68f16d=_0x68f16d||0xcc;return function(_0xc6e8da){if(_0xc6e8da){return _0x24c756[_0x7095('0x27')](_0x68f16d);}return _0x24c756['status'](_0x68f16d)[_0x7095('0x28')]();};}function respondWithResult(_0x482c19,_0x28839a){_0x28839a=_0x28839a||0xc8;return function(_0x18696e){if(_0x18696e){return _0x482c19[_0x7095('0x29')](_0x28839a)[_0x7095('0x2a')](_0x18696e);}};}function respondWithFilteredResult(_0xd80227,_0x335359){return function(_0x1855a2){if(_0x1855a2){var _0x3a8a41=_0x1855a2['count'],_0x432466=_0x335359['offset'],_0x351f78=_0x335359['offset']+_0x335359[_0x7095('0x2b')],_0x1d062b;if(_0x351f78>=_0x3a8a41){_0x351f78=_0x3a8a41;_0x1d062b=0xc8;}else{_0x1d062b=0xce;}_0xd80227[_0x7095('0x29')](_0x1d062b);return _0xd80227[_0x7095('0x2c')]('Content-Range',_0x432466+'-'+_0x351f78+'/'+_0x3a8a41)[_0x7095('0x2a')](_0x1855a2);}return null;};}function patchUpdates(_0x2a1caf){return function(_0xeae2f7){try{jsonpatch[_0x7095('0x2d')](_0xeae2f7,_0x2a1caf,!![]);}catch(_0x12b70d){return BPromise['reject'](_0x12b70d);}return _0xeae2f7[_0x7095('0x2e')]();};}function saveUpdates(_0x37842d,_0x14c639){return function(_0x1f949f){if(_0x1f949f){return _0x1f949f[_0x7095('0x2f')](_0x37842d)['then'](function(_0x305c2d){return _0x305c2d;});}return null;};}function removeEntity(_0x46c1d4,_0x3ff232){return function(_0x59daf9){if(_0x59daf9){return _0x59daf9[_0x7095('0x30')]()[_0x7095('0x1e')](function(){_0x46c1d4[_0x7095('0x29')](0xcc)[_0x7095('0x28')]();});}};}function handleEntityNotFound(_0x8f61f,_0x2657df){return function(_0x439640){if(!_0x439640){_0x8f61f[_0x7095('0x27')](0x194);}return _0x439640;};}function handleError(_0x224ebd,_0x42a8aa){_0x42a8aa=_0x42a8aa||0x1f4;return function(_0x291af5){logger[_0x7095('0x23')](_0x291af5[_0x7095('0x31')]);if(_0x291af5[_0x7095('0x32')]){delete _0x291af5[_0x7095('0x32')];}_0x224ebd[_0x7095('0x29')](_0x42a8aa)[_0x7095('0x33')](_0x291af5);};}exports[_0x7095('0x34')]=function(_0x133b90,_0x2999a4){var _0x6d7ac5={},_0x1f7f36={},_0x3f45fe={'count':0x0,'rows':[]};var _0x1554f8=_['map'](db[_0x7095('0x35')]['rawAttributes'],function(_0x215c9c){return{'name':_0x215c9c[_0x7095('0x36')],'type':_0x215c9c[_0x7095('0x37')][_0x7095('0x38')]};});_0x1f7f36[_0x7095('0x39')]=_[_0x7095('0x3a')](_0x1554f8,'name');_0x1f7f36[_0x7095('0x3b')]=_['keys'](_0x133b90[_0x7095('0x3b')]);_0x1f7f36[_0x7095('0x3c')]=_[_0x7095('0x3d')](_0x1f7f36[_0x7095('0x39')],_0x1f7f36[_0x7095('0x3b')]);_0x6d7ac5[_0x7095('0x3e')]=_[_0x7095('0x3d')](_0x1f7f36[_0x7095('0x39')],qs[_0x7095('0x3f')](_0x133b90['query'][_0x7095('0x3f')]));_0x6d7ac5[_0x7095('0x3e')]=_0x6d7ac5[_0x7095('0x3e')][_0x7095('0x40')]?_0x6d7ac5[_0x7095('0x3e')]:_0x1f7f36['model'];if(!_0x133b90[_0x7095('0x3b')][_0x7095('0x41')](_0x7095('0x42'))){_0x6d7ac5[_0x7095('0x2b')]=qs[_0x7095('0x2b')](_0x133b90[_0x7095('0x3b')][_0x7095('0x2b')]);_0x6d7ac5[_0x7095('0x43')]=qs[_0x7095('0x43')](_0x133b90[_0x7095('0x3b')][_0x7095('0x43')]);}_0x6d7ac5['order']=qs[_0x7095('0x44')](_0x133b90[_0x7095('0x3b')]['sort']);_0x6d7ac5[_0x7095('0x45')]=qs[_0x7095('0x3c')](_[_0x7095('0x46')](_0x133b90[_0x7095('0x3b')],_0x1f7f36['filters']),_0x1554f8);if(_0x133b90['query'][_0x7095('0x47')]){_0x6d7ac5[_0x7095('0x45')]=_[_0x7095('0x48')](_0x6d7ac5[_0x7095('0x45')],{'$or':_[_0x7095('0x3a')](_0x1554f8,function(_0x10ffcd){if(_0x10ffcd['type']!==_0x7095('0x49')){var _0x1b1efe={};_0x1b1efe[_0x10ffcd[_0x7095('0x32')]]={'$like':'%'+_0x133b90[_0x7095('0x3b')][_0x7095('0x47')]+'%'};return _0x1b1efe;}})});}_0x6d7ac5=_[_0x7095('0x48')]({},_0x6d7ac5,_0x133b90[_0x7095('0x4a')]);var _0x3fba09={'where':_0x6d7ac5['where']};return db[_0x7095('0x35')][_0x7095('0x4b')](_0x3fba09)[_0x7095('0x1e')](function(_0x3877af){_0x3f45fe[_0x7095('0x4b')]=_0x3877af;if(_0x133b90[_0x7095('0x3b')]['includeAll']){_0x6d7ac5['include']=[{'all':!![]}];}return db[_0x7095('0x35')][_0x7095('0x4c')](_0x6d7ac5);})['then'](function(_0x5ab840){_0x3f45fe[_0x7095('0x4d')]=_0x5ab840;return _0x3f45fe;})[_0x7095('0x1e')](respondWithFilteredResult(_0x2999a4,_0x6d7ac5))[_0x7095('0x26')](handleError(_0x2999a4,null));};exports[_0x7095('0x4e')]=function(_0x4a8ec1,_0x2a0569){var _0x41799c={'raw':!![],'where':{'id':_0x4a8ec1[_0x7095('0x4f')]['id']}},_0x8e9926={};_0x8e9926[_0x7095('0x39')]=_['keys'](db['Network'][_0x7095('0x50')]);_0x8e9926[_0x7095('0x3b')]=_['keys'](_0x4a8ec1[_0x7095('0x3b')]);_0x8e9926[_0x7095('0x3c')]=_[_0x7095('0x3d')](_0x8e9926[_0x7095('0x39')],_0x8e9926['query']);_0x41799c[_0x7095('0x3e')]=_['intersection'](_0x8e9926[_0x7095('0x39')],qs['fields'](_0x4a8ec1[_0x7095('0x3b')][_0x7095('0x3f')]));_0x41799c[_0x7095('0x3e')]=_0x41799c['attributes'][_0x7095('0x40')]?_0x41799c['attributes']:_0x8e9926[_0x7095('0x39')];if(_0x4a8ec1[_0x7095('0x3b')][_0x7095('0x51')]){_0x41799c[_0x7095('0x52')]=[{'all':!![]}];}_0x41799c=_[_0x7095('0x48')]({},_0x41799c,_0x4a8ec1[_0x7095('0x4a')]);return db['Network'][_0x7095('0x53')](_0x41799c)['then'](handleEntityNotFound(_0x2a0569,null))['then'](respondWithResult(_0x2a0569,null))[_0x7095('0x26')](handleError(_0x2a0569,null));};exports[_0x7095('0x54')]=function(_0x2e21e5,_0x4c9e5a,_0x5bca6b){var _0x231666;return db[_0x7095('0x55')][_0x7095('0x56')](function(_0x188415){return db['Network'][_0x7095('0x54')](_0x2e21e5[_0x7095('0x57')],{'raw':!![]})[_0x7095('0x1e')](function(_0x3c5beb){_0x231666=_0x3c5beb;return db[_0x7095('0x35')]['findAll']({'where':{'type':_0x2e21e5[_0x7095('0x57')]['type']},'raw':!![]});})[_0x7095('0x1e')](function(_0x24bc85){if(_0x231666[_0x7095('0x37')][_0x7095('0x58')]()=='STUN'){var _0xa6f394=fs['readFileSync'](path[_0x7095('0x59')](config[_0x7095('0x5a')],_0x7095('0x5b')),_0x7095('0x5c'));var _0x7fedb3=ejs[_0x7095('0x5d')](_0xa6f394,{'networks':_0x24bc85||[]});fs[_0x7095('0x5e')](_0x7095('0x5f'),_0x7fedb3);return respondWithRpcPromise(_0x7095('0x60'),'create',{'module':'res_stun_monitor.so'});}else if(_0x231666[_0x7095('0x37')][_0x7095('0x58')]()=='TURN'){var _0x550c59=fs['readFileSync'](path['join'](config[_0x7095('0x5a')],_0x7095('0x61')),'utf8');var _0x2cb262=ejs[_0x7095('0x5d')](_0x550c59,{'networks':_0x24bc85||[]});fs[_0x7095('0x5e')](_0x7095('0x62'),_0x2cb262);return respondWithRpcPromise(_0x7095('0x60'),_0x7095('0x54'),{'module':'res_stun_monitor.so'});}else{var _0x30acc3=fs[_0x7095('0x63')](path[_0x7095('0x59')](config['root'],'server/files/templates/network.ejs'),_0x7095('0x5c'));var _0x25caa7=ejs[_0x7095('0x5d')](_0x30acc3,{'networks':_0x24bc85||[]});fs[_0x7095('0x5e')](util[_0x7095('0x64')]('/etc/asterisk/sip_xcally_%s.conf',_0x2e21e5[_0x7095('0x57')]['type']['toLowerCase']()),_0x25caa7);return respondWithRpcPromise(_0x7095('0x60'),'create',{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x231666;});})[_0x7095('0x1e')](respondWithResult(_0x4c9e5a,0xc9))[_0x7095('0x26')](handleError(_0x4c9e5a,null));};exports[_0x7095('0x2f')]=function(_0xecf7ff,_0x47208c,_0x341f62){var _0x2f3351;return db[_0x7095('0x55')][_0x7095('0x56')](function(_0x4640d6){return db['Network'][_0x7095('0x53')]({'where':{'id':_0xecf7ff[_0x7095('0x4f')]['id']}})[_0x7095('0x1e')](handleEntityNotFound(_0x47208c,null))['then'](saveUpdates(_0xecf7ff[_0x7095('0x57')],null))[_0x7095('0x1e')](function(_0x246e04){if(_0x246e04){_0x2f3351=_0x246e04;return db[_0x7095('0x35')][_0x7095('0x4c')]({'where':{'type':_0x2f3351[_0x7095('0x37')]},'raw':!![]});}return null;})[_0x7095('0x1e')](function(_0x590bbb){if(_0x2f3351['type']['toUpperCase']()==_0x7095('0x65')){var _0x584c68=fs['readFileSync'](path[_0x7095('0x59')](config['root'],_0x7095('0x5b')),_0x7095('0x5c'));var _0x4cb99f=ejs[_0x7095('0x5d')](_0x584c68,{'networks':_0x590bbb||[]});fs[_0x7095('0x5e')]('/etc/asterisk/stun_xcally.conf',_0x4cb99f);return respondWithRpcPromise(_0x7095('0x60'),_0x7095('0x2f'),{'module':_0x7095('0x66')});}else if(_0x2f3351[_0x7095('0x37')][_0x7095('0x58')]()==_0x7095('0x67')){var _0x48973d=fs[_0x7095('0x63')](path[_0x7095('0x59')](config[_0x7095('0x5a')],'server/files/templates/turn_multiple.ejs'),_0x7095('0x5c'));var _0x3a3172=ejs[_0x7095('0x5d')](_0x48973d,{'networks':_0x590bbb||[]});fs[_0x7095('0x5e')](_0x7095('0x62'),_0x3a3172);return respondWithRpcPromise(_0x7095('0x60'),_0x7095('0x2f'),{'module':_0x7095('0x66')});}else{var _0x89674c=fs[_0x7095('0x63')](path[_0x7095('0x59')](config[_0x7095('0x5a')],_0x7095('0x68')),'utf8');var _0xcecb14=ejs['render'](_0x89674c,{'networks':_0x590bbb||[]});fs[_0x7095('0x5e')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0xecf7ff[_0x7095('0x57')][_0x7095('0x37')][_0x7095('0x69')]()),_0xcecb14);return respondWithRpcPromise(_0x7095('0x60'),_0x7095('0x2f'),{'module':_0x7095('0x6a')});}return null;})['then'](function(_0x1799f6){if(_0x1799f6){return _0x2f3351;}return null;});})[_0x7095('0x1e')](respondWithResult(_0x47208c,null))['catch'](handleError(_0x47208c,null));};exports[_0x7095('0x30')]=function(_0x184977,_0x4c50be,_0x34dbb6){var _0x3090c7;return db[_0x7095('0x35')]['find']({'where':{'id':_0x184977[_0x7095('0x4f')]['id']}})[_0x7095('0x1e')](function(_0x62f2f5){_0x3090c7=_0x62f2f5;return _0x62f2f5;})[_0x7095('0x1e')](handleEntityNotFound(_0x4c50be,null))['then'](removeEntity(_0x4c50be,null))['then'](function(){if(_0x3090c7){return db[_0x7095('0x35')][_0x7095('0x4c')]({'where':{'type':_0x3090c7[_0x7095('0x37')]},'raw':!![]});}})[_0x7095('0x1e')](function(_0x41b2fc){if(_0x3090c7['type']['toUpperCase']()==_0x7095('0x65')){var _0xfda66f=fs['readFileSync'](path['join'](config[_0x7095('0x5a')],'server/files/templates/stun_multiple.ejs'),_0x7095('0x5c'));var _0x2e19b8=ejs[_0x7095('0x5d')](_0xfda66f,{'networks':_0x41b2fc||[]});fs[_0x7095('0x5e')](_0x7095('0x5f'),_0x2e19b8);return respondWithRpcPromise(_0x7095('0x60'),_0x7095('0x30'),{'module':_0x7095('0x66')});}else if(_0x3090c7[_0x7095('0x37')][_0x7095('0x58')]()==_0x7095('0x67')){var _0x3f9bac=fs[_0x7095('0x63')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x3765b3=ejs[_0x7095('0x5d')](_0x3f9bac,{'networks':_0x41b2fc||[]});fs['writeFileSync'](_0x7095('0x62'),_0x3765b3);return respondWithRpcPromise('Reload',_0x7095('0x30'),{'module':_0x7095('0x66')});}else{var _0x1d120e=fs[_0x7095('0x63')](path[_0x7095('0x59')](config[_0x7095('0x5a')],_0x7095('0x68')),'utf8');var _0x1908da=ejs[_0x7095('0x5d')](_0x1d120e,{'networks':_0x41b2fc||[]});fs[_0x7095('0x5e')](util[_0x7095('0x64')](_0x7095('0x6b'),_0x184977[_0x7095('0x57')]['type']['toLowerCase']()),_0x1908da);return respondWithRpcPromise('Reload',_0x7095('0x30'),{'module':_0x7095('0x6a')});}return null;})[_0x7095('0x26')](handleError(_0x4c50be,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index fbf5ac7..fc59296 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 _0x6737=['../../config/environment','./network.attributes','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4c2391,_0x3b5e9a){var _0x8dd5f8=function(_0x2fd398){while(--_0x2fd398){_0x4c2391['push'](_0x4c2391['shift']());}};_0x8dd5f8(++_0x3b5e9a);}(_0x6737,0xe2));var _0x7673=function(_0x10cb66,_0x382106){_0x10cb66=_0x10cb66-0x0;var _0x918b4c=_0x6737[_0x10cb66];return _0x918b4c;};'use strict';var _=require('lodash');var util=require(_0x7673('0x0'));var logger=require(_0x7673('0x1'))('api');var moment=require(_0x7673('0x2'));var BPromise=require(_0x7673('0x3'));var rp=require(_0x7673('0x4'));var fs=require('fs');var path=require(_0x7673('0x5'));var rimraf=require('rimraf');var config=require(_0x7673('0x6'));var attributes=require(_0x7673('0x7'));module['exports']=function(_0x2f5edc,_0x15230f){return _0x2f5edc['define']('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb8=['Network','network','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','define'];(function(_0x432432,_0x394b12){var _0x46cec6=function(_0x40d4e4){while(--_0x40d4e4){_0x432432['push'](_0x432432['shift']());}};_0x46cec6(++_0x394b12);}(_0xadb8,0x1d0));var _0x8adb=function(_0x27ccb6,_0x103913){_0x27ccb6=_0x27ccb6-0x0;var _0x412043=_0xadb8[_0x27ccb6];return _0x412043;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8adb('0x0'))('api');var moment=require(_0x8adb('0x1'));var BPromise=require(_0x8adb('0x2'));var rp=require(_0x8adb('0x3'));var fs=require('fs');var path=require(_0x8adb('0x4'));var rimraf=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var attributes=require(_0x8adb('0x7'));module['exports']=function(_0x15bc63,_0x1a5f36){return _0x15bc63[_0x8adb('0x8')](_0x8adb('0x9'),attributes,{'tableName':_0x8adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index a71fdf5..94b827b 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 _0xfdcb=['http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1089a8,_0x3925c2){var _0x280a4e=function(_0x4446a6){while(--_0x4446a6){_0x1089a8['push'](_0x1089a8['shift']());}};_0x280a4e(++_0x3925c2);}(_0xfdcb,0x101));var _0xbfdc=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0xfdcb[_0x40be86];return _0xda3c3b;};'use strict';var _=require('lodash');var util=require(_0xbfdc('0x0'));var moment=require(_0xbfdc('0x1'));var BPromise=require(_0xbfdc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfdc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfdc('0x4'))(_0xbfdc('0x5'));var config=require(_0xbfdc('0x6'));var jayson=require(_0xbfdc('0x7'));var client=jayson[_0xbfdc('0x8')][_0xbfdc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3dec95,_0x58c576,_0x4d0acc){return new BPromise(function(_0x201731,_0x340018){return client[_0xbfdc('0xa')](_0x3dec95,_0x4d0acc)['then'](function(_0xc40554){logger[_0xbfdc('0xb')](_0xbfdc('0xc'),_0x58c576,_0xbfdc('0xd'));logger[_0xbfdc('0xe')](_0xbfdc('0xf'),_0x58c576,_0xbfdc('0xd'),JSON['stringify'](_0xc40554));if(_0xc40554[_0xbfdc('0x10')]){if(_0xc40554['error'][_0xbfdc('0x11')]===0x1f4){logger[_0xbfdc('0x10')](_0xbfdc('0xc'),_0x58c576,_0xc40554['error'][_0xbfdc('0x12')]);return _0x340018(_0xc40554[_0xbfdc('0x10')][_0xbfdc('0x12')]);}logger[_0xbfdc('0x10')]('Network,\x20%s,\x20%s',_0x58c576,_0xc40554['error'][_0xbfdc('0x12')]);return _0x201731(_0xc40554['error'][_0xbfdc('0x12')]);}else{logger[_0xbfdc('0xb')](_0xbfdc('0xc'),_0x58c576,_0xbfdc('0xd'));_0x201731(_0xc40554['result']['message']);}})['catch'](function(_0x368782){logger[_0xbfdc('0x10')]('Network,\x20%s,\x20%s',_0x58c576,_0x368782);_0x340018(_0x368782);});});} \ No newline at end of file +var _0x6f1a=['lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0xb34fc1,_0x2a76f9){var _0x1e2ac6=function(_0x3fad88){while(--_0x3fad88){_0xb34fc1['push'](_0xb34fc1['shift']());}};_0x1e2ac6(++_0x2a76f9);}(_0x6f1a,0xc6));var _0xa6f1=function(_0x2766cc,_0x246297){_0x2766cc=_0x2766cc-0x0;var _0x3dd08f=_0x6f1a[_0x2766cc];return _0x3dd08f;};'use strict';var _=require(_0xa6f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa6f1('0x1'));var rs=require(_0xa6f1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6f1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa6f1('0x4'))(_0xa6f1('0x5'));var config=require(_0xa6f1('0x6'));var jayson=require(_0xa6f1('0x7'));var client=jayson[_0xa6f1('0x8')][_0xa6f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e41aa,_0x4c8d03,_0x3324e){return new BPromise(function(_0x18335d,_0x3c991b){return client['request'](_0x4e41aa,_0x3324e)[_0xa6f1('0xa')](function(_0x1e3c71){logger['info'](_0xa6f1('0xb'),_0x4c8d03,_0xa6f1('0xc'));logger[_0xa6f1('0xd')](_0xa6f1('0xe'),_0x4c8d03,'request\x20sent',JSON[_0xa6f1('0xf')](_0x1e3c71));if(_0x1e3c71[_0xa6f1('0x10')]){if(_0x1e3c71['error'][_0xa6f1('0x11')]===0x1f4){logger[_0xa6f1('0x10')](_0xa6f1('0xb'),_0x4c8d03,_0x1e3c71['error'][_0xa6f1('0x12')]);return _0x3c991b(_0x1e3c71[_0xa6f1('0x10')]['message']);}logger[_0xa6f1('0x10')](_0xa6f1('0xb'),_0x4c8d03,_0x1e3c71['error'][_0xa6f1('0x12')]);return _0x18335d(_0x1e3c71[_0xa6f1('0x10')][_0xa6f1('0x12')]);}else{logger[_0xa6f1('0x13')](_0xa6f1('0xb'),_0x4c8d03,_0xa6f1('0xc'));_0x18335d(_0x1e3c71[_0xa6f1('0x14')][_0xa6f1('0x12')]);}})[_0xa6f1('0x15')](function(_0x3ce417){logger[_0xa6f1('0x10')](_0xa6f1('0xb'),_0x4c8d03,_0x3ce417);_0x3c991b(_0x3ce417);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index a9957b8..cc3a4d7 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 _0x5992=['../../components/interaction/service','../../config/environment','./notification.controller','isAuthenticated','sendNotification','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x40415e,_0x5b8da2){var _0x30784f=function(_0x2d753f){while(--_0x2d753f){_0x40415e['push'](_0x40415e['shift']());}};_0x30784f(++_0x5b8da2);}(_0x5992,0x126));var _0x2599=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x5992[_0x13b02f];return _0x12e9a6;};'use strict';var multer=require(_0x2599('0x0'));var util=require(_0x2599('0x1'));var path=require('path');var timeout=require(_0x2599('0x2'));var express=require(_0x2599('0x3'));var router=express[_0x2599('0x4')]();var auth=require(_0x2599('0x5'));var interaction=require(_0x2599('0x6'));var config=require(_0x2599('0x7'));var controller=require(_0x2599('0x8'));router['post']('/',auth[_0x2599('0x9')](),controller[_0x2599('0xa')]);module[_0x2599('0xb')]=router; \ No newline at end of file +var _0x90db=['sendNotification','exports','path','connect-timeout','express','Router','./notification.controller','isAuthenticated'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x90db,0x132));var _0xb90d=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x90db[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb90d('0x0'));var timeout=require(_0xb90d('0x1'));var express=require(_0xb90d('0x2'));var router=express[_0xb90d('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb90d('0x4'));router['post']('/',auth[_0xb90d('0x5')](),controller[_0xb90d('0x6')]);module[_0xb90d('0x7')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index a44f27d..157c309 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 _0x2c9e=['sequelize','exports','TEXT','STRING'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0x2c9e,0xf0));var _0xe2c9=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2c9e[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xe2c9('0x0'));module[_0xe2c9('0x1')]={'body':{'type':Sequelize[_0xe2c9('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xe2c9('0x2')]},'recipientsDescription':{'type':Sequelize[_0xe2c9('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x90d9=['BOOLEAN','sequelize','exports','STRING','TEXT'];(function(_0x4ac373,_0xe08d9d){var _0x5e5152=function(_0x505d55){while(--_0x505d55){_0x4ac373['push'](_0x4ac373['shift']());}};_0x5e5152(++_0xe08d9d);}(_0x90d9,0x74));var _0x990d=function(_0x4dd412,_0x28bc36){_0x4dd412=_0x4dd412-0x0;var _0x451f36=_0x90d9[_0x4dd412];return _0x451f36;};'use strict';var Sequelize=require(_0x990d('0x0'));module[_0x990d('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x990d('0x2')]},'recipientsId':{'type':Sequelize[_0x990d('0x3')]},'recipientsDescription':{'type':Sequelize[_0x990d('0x2')]},'beep':{'type':Sequelize[_0x990d('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 7674766..9bb7920 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 _0x263f=['whatsappqueue','team','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','transaction','Notification','create','forEach','emit','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','ids','includes','queue','Queue','push','all','union','flatten','getAgents','map','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./notification.socket','register','sendStatus','status','json','offset','limit','set','then','destroy','end','name','send','sendNotification','body','hasOwnProperty','text','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x263f,0x1a0));var _0xf263=function(_0x2d4e5d,_0x1e790c){_0x2d4e5d=_0x2d4e5d-0x0;var _0x4f5eec=_0x263f[_0x2d4e5d];return _0x4f5eec;};'use strict';var pdf=require(_0xf263('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf263('0x1'));var zipdir=require(_0xf263('0x2'));var jsonpatch=require(_0xf263('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf263('0x4'));var Mustache=require(_0xf263('0x5'));var util=require(_0xf263('0x6'));var path=require(_0xf263('0x7'));var sox=require(_0xf263('0x8'));var csv=require(_0xf263('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf263('0xa'));var crypto=require('crypto');var jsforce=require(_0xf263('0xb'));var deskjs=require(_0xf263('0xc'));var toCsv=require(_0xf263('0x9'));var querystring=require(_0xf263('0xd'));var Papa=require(_0xf263('0xe'));var Redis=require(_0xf263('0xf'));var authService=require(_0xf263('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf263('0x11'));var hardwareService=require(_0xf263('0x12'));var logger=require(_0xf263('0x13'))(_0xf263('0x14'));var utils=require(_0xf263('0x15'));var config=require(_0xf263('0x16'));var db=require(_0xf263('0x17'))['db'];config['redis']=_[_0xf263('0x18')](config[_0xf263('0x19')],{'host':_0xf263('0x1a'),'port':0x18eb});var socket=require(_0xf263('0x1b'))(new Redis(config[_0xf263('0x19')]));require(_0xf263('0x1c'))[_0xf263('0x1d')](socket);function respondWithStatusCode(_0x50697c,_0x3a8ca5){_0x3a8ca5=_0x3a8ca5||0xcc;return function(_0x4f17ea){if(_0x4f17ea){return _0x50697c[_0xf263('0x1e')](_0x3a8ca5);}return _0x50697c[_0xf263('0x1f')](_0x3a8ca5)['end']();};}function respondWithResult(_0x3a6d64,_0x452040){_0x452040=_0x452040||0xc8;return function(_0x58586f){if(_0x58586f){return _0x3a6d64[_0xf263('0x1f')](_0x452040)[_0xf263('0x20')](_0x58586f);}};}function respondWithFilteredResult(_0x2d76f8,_0x39ec20){return function(_0x43896a){if(_0x43896a){var _0x23b313=_0x43896a['count'],_0x4e006b=_0x39ec20[_0xf263('0x21')],_0x241dca=_0x39ec20[_0xf263('0x21')]+_0x39ec20[_0xf263('0x22')],_0x3c3def;if(_0x241dca>=_0x23b313){_0x241dca=_0x23b313;_0x3c3def=0xc8;}else{_0x3c3def=0xce;}_0x2d76f8[_0xf263('0x1f')](_0x3c3def);return _0x2d76f8[_0xf263('0x23')]('Content-Range',_0x4e006b+'-'+_0x241dca+'/'+_0x23b313)[_0xf263('0x20')](_0x43896a);}return null;};}function patchUpdates(_0x11f1c){return function(_0x51a1ba){try{jsonpatch['apply'](_0x51a1ba,_0x11f1c,!![]);}catch(_0x16486e){return BPromise['reject'](_0x16486e);}return _0x51a1ba['save']();};}function saveUpdates(_0x4af574,_0x25efbc){return function(_0x55e3f8){if(_0x55e3f8){return _0x55e3f8['update'](_0x4af574)[_0xf263('0x24')](function(_0x4179aa){return _0x4179aa;});}return null;};}function removeEntity(_0x28d61c,_0x5cae2c){return function(_0x4f36ae){if(_0x4f36ae){return _0x4f36ae[_0xf263('0x25')]()[_0xf263('0x24')](function(){_0x28d61c[_0xf263('0x1f')](0xcc)[_0xf263('0x26')]();});}};}function handleEntityNotFound(_0x58e0ae,_0x40588f){return function(_0x1203f1){if(!_0x1203f1){_0x58e0ae[_0xf263('0x1e')](0x194);}return _0x1203f1;};}function handleError(_0x13cdc1,_0x3ceb31){_0x3ceb31=_0x3ceb31||0x1f4;return function(_0x3c880a){logger['error'](_0x3c880a['stack']);if(_0x3c880a[_0xf263('0x27')]){delete _0x3c880a[_0xf263('0x27')];}_0x13cdc1[_0xf263('0x1f')](_0x3ceb31)[_0xf263('0x28')](_0x3c880a);};}exports[_0xf263('0x29')]=function(_0x111238,_0x4738bd,_0x3f37d9){if(!_0x111238[_0xf263('0x2a')][_0xf263('0x2b')](_0xf263('0x2c'))&&!_0x111238['body']['hasOwnProperty']('TemplateId')){throw new db['Sequelize'][(_0xf263('0x2d'))](_0xf263('0x2e'));}else{if(_0x111238[_0xf263('0x2a')][_0xf263('0x2b')](_0xf263('0x2f'))&&!_0x111238['body']['hasOwnProperty'](_0xf263('0x30'))){throw new db[(_0xf263('0x31'))][(_0xf263('0x2d'))](_0xf263('0x32'));}if(!_0x111238[_0xf263('0x2a')][_0xf263('0x2b')](_0xf263('0x33'))){throw new db[(_0xf263('0x31'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x51c5db=JSON[_0xf263('0x34')](_0x111238[_0xf263('0x2a')][_0xf263('0x33')]);}catch(_0x2724e3){logger['error'](_0x2724e3);throw new db[(_0xf263('0x31'))][(_0xf263('0x2d'))](_0xf263('0x35'));}var _0x133e6d=[_0xf263('0x36'),_0xf263('0x37'),'mailqueue',_0xf263('0x38'),_0xf263('0x39'),_0xf263('0x3a'),_0xf263('0x3b'),_0xf263('0x3c'),'user'];if(_[_0xf263('0x3d')](_0x51c5db,function(_0x1498e5){return!_['includes'](_0x133e6d,_0x1498e5[_0xf263('0x3e')][_0xf263('0x3f')]());})){throw new db[(_0xf263('0x31'))][(_0xf263('0x2d'))](_0xf263('0x40'));}}}var _0x3aa43e={};_0x3aa43e['senderName']=_0x111238[_0xf263('0x2a')]['hasOwnProperty'](_0xf263('0x41'))?_0x111238['body'][_0xf263('0x41')]:_0x111238[_0xf263('0x42')][_0xf263('0x43')];_0x3aa43e[_0xf263('0x44')]=_[_0xf263('0x45')](_0x111238[_0xf263('0x2a')][_0xf263('0x44')])?null:_0x111238['body']['recipientsDescription'];_0x3aa43e[_0xf263('0x46')]=_0x111238[_0xf263('0x2a')][_0xf263('0x46')]||![];_0x3aa43e[_0xf263('0x47')]=_0x111238[_0xf263('0x42')]['id'];return getContent(_0x111238['body'])['then'](function(_0x534a38){_0x3aa43e[_0xf263('0x2a')]=_0x534a38;return getRecipients(_0x51c5db);})[_0xf263('0x24')](function(_0x4394bc){_0x3aa43e[_0xf263('0x48')]=_[_0xf263('0x49')](_0x4394bc)['join'](',');return db['sequelize'][_0xf263('0x4a')](function(_0x3229c1){return db[_0xf263('0x4b')][_0xf263('0x4c')](_0x3aa43e,{'raw':!![],'transaction':_0x3229c1})[_0xf263('0x24')](function(_0x22857e){var _0x536e9e={'sender':_0x3aa43e[_0xf263('0x41')],'description':_0x3aa43e[_0xf263('0x44')],'content':_0x3aa43e['body'],'beep':_0x3aa43e[_0xf263('0x46')]};_0x4394bc[_0xf263('0x4d')](function(_0x1313d5){_0x536e9e['recipient']=_0x1313d5;socket[_0xf263('0x4e')]('notification:send',_0x536e9e);});return _0x22857e;});});})[_0xf263('0x24')](respondWithResult(_0x4738bd,0xc9))['catch'](handleError(_0x4738bd,null));};function getContent(_0x5bda31){return new BPromise(function(_0x51ff12,_0x533d1c){if(_0x5bda31[_0xf263('0x2c')]){_0x51ff12(_0x5bda31[_0xf263('0x2c')]);return;}return db['Template'][_0xf263('0x4f')]({'attributes':[_0xf263('0x50')],'where':{'id':_0x5bda31['TemplateId']},'raw':!![]})[_0xf263('0x24')](function(_0x228b0c){if(!_0x228b0c)throw new db[(_0xf263('0x31'))][(_0xf263('0x2d'))](_0xf263('0x51'));var _0x4eaf84=Mustache[_0xf263('0x52')](_0x228b0c[_0xf263('0x50')],_0x5bda31[_0xf263('0x30')]);_0x51ff12(_0x4eaf84);})[_0xf263('0x53')](function(_0x5b94d1){_0x533d1c(_0x5b94d1);});});}function getRecipients(_0xcdb5d){return new BPromise(function(_0x463ead,_0x172c17){var _0x2c78e8=[];var _0x55822d=[];_0xcdb5d[_0xf263('0x4d')](function(_0x1ab70c){var _0x53aab7=_[_0xf263('0x54')](_0x1ab70c[_0xf263('0x3e')][_0xf263('0x3f')]());if(_0x53aab7==='User'){_0x2c78e8=_['union'](_0x2c78e8,_0x1ab70c[_0xf263('0x55')]);}else{if(_[_0xf263('0x56')](_0x53aab7,_0xf263('0x57')))_0x53aab7=_0x53aab7['replace'](_0xf263('0x57'),_0xf263('0x58'));_0x1ab70c[_0xf263('0x55')][_0xf263('0x4d')](function(_0x56adbc){_0x55822d[_0xf263('0x59')](getAgents(_0x53aab7,_0x56adbc));});}});return BPromise[_0xf263('0x5a')](_0x55822d)['then'](function(_0x30c8d2){_0x2c78e8=_[_0xf263('0x5b')](_0x2c78e8,_[_0xf263('0x5c')](_0x30c8d2));_0x463ead(_0x2c78e8);})[_0xf263('0x53')](function(_0x2a5ab8){_0x172c17(_0x2a5ab8);});});}function getAgents(_0x5ae5d3,_0x1dd5b1){return new BPromise(function(_0x1c6433,_0xc75de8){return db[_0x5ae5d3]['findOne']({'where':{'id':_0x1dd5b1}})[_0xf263('0x24')](function(_0x532a74){return _0x532a74[_0xf263('0x5d')]({'attributes':['id'],'raw':!![]})[_0xf263('0x24')](function(_0x2e1087){var _0x2db73f=_[_0xf263('0x5e')](_0x2e1087,'id');_0x1c6433(_0x2db73f);});})[_0xf263('0x53')](function(_0xf445a3){_0xc75de8(_0xf445a3);});});} \ No newline at end of file +var _0xde6a=['queue','replace','Queue','push','all','flatten','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','./notification.socket','register','sendStatus','status','end','json','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','send','sendNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','create','forEach','recipient','emit','notification:send','catch','Template','findOne','html','render','startCase','User','union','ids'];(function(_0xbd980f,_0x305292){var _0x17e7c9=function(_0x38e7d1){while(--_0x38e7d1){_0xbd980f['push'](_0xbd980f['shift']());}};_0x17e7c9(++_0x305292);}(_0xde6a,0x127));var _0xade6=function(_0x48770d,_0x2234a3){_0x48770d=_0x48770d-0x0;var _0xc6b269=_0xde6a[_0x48770d];return _0xc6b269;};'use strict';var pdf=require(_0xade6('0x0'));var emlformat=require(_0xade6('0x1'));var rimraf=require(_0xade6('0x2'));var zipdir=require(_0xade6('0x3'));var jsonpatch=require(_0xade6('0x4'));var rp=require(_0xade6('0x5'));var moment=require(_0xade6('0x6'));var BPromise=require(_0xade6('0x7'));var Mustache=require(_0xade6('0x8'));var util=require('util');var path=require(_0xade6('0x9'));var sox=require(_0xade6('0xa'));var csv=require(_0xade6('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xade6('0xc'));var squel=require('squel');var crypto=require(_0xade6('0xd'));var jsforce=require(_0xade6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xade6('0xb'));var querystring=require(_0xade6('0xf'));var Papa=require(_0xade6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xade6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xade6('0x12'));var logger=require(_0xade6('0x13'))(_0xade6('0x14'));var utils=require(_0xade6('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xade6('0x16')]=_[_0xade6('0x17')](config[_0xade6('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xade6('0x18'))(new Redis(config['redis']));require(_0xade6('0x19'))[_0xade6('0x1a')](socket);function respondWithStatusCode(_0x1308e3,_0x435678){_0x435678=_0x435678||0xcc;return function(_0x37128b){if(_0x37128b){return _0x1308e3[_0xade6('0x1b')](_0x435678);}return _0x1308e3[_0xade6('0x1c')](_0x435678)[_0xade6('0x1d')]();};}function respondWithResult(_0x32e1a7,_0x6af212){_0x6af212=_0x6af212||0xc8;return function(_0x5dc6e8){if(_0x5dc6e8){return _0x32e1a7[_0xade6('0x1c')](_0x6af212)[_0xade6('0x1e')](_0x5dc6e8);}};}function respondWithFilteredResult(_0x308e7d,_0x56de95){return function(_0x36b570){if(_0x36b570){var _0x51a4f9=_0x36b570['count'],_0x265c6c=_0x56de95[_0xade6('0x1f')],_0x36e9b5=_0x56de95[_0xade6('0x1f')]+_0x56de95['limit'],_0x679e30;if(_0x36e9b5>=_0x51a4f9){_0x36e9b5=_0x51a4f9;_0x679e30=0xc8;}else{_0x679e30=0xce;}_0x308e7d[_0xade6('0x1c')](_0x679e30);return _0x308e7d[_0xade6('0x20')](_0xade6('0x21'),_0x265c6c+'-'+_0x36e9b5+'/'+_0x51a4f9)[_0xade6('0x1e')](_0x36b570);}return null;};}function patchUpdates(_0x38ede0){return function(_0x417e23){try{jsonpatch[_0xade6('0x22')](_0x417e23,_0x38ede0,!![]);}catch(_0x1d62ad){return BPromise['reject'](_0x1d62ad);}return _0x417e23[_0xade6('0x23')]();};}function saveUpdates(_0x1991e8,_0x480cf2){return function(_0x691f41){if(_0x691f41){return _0x691f41['update'](_0x1991e8)[_0xade6('0x24')](function(_0x35f7bd){return _0x35f7bd;});}return null;};}function removeEntity(_0x1e8885,_0x46b8aa){return function(_0x97fd78){if(_0x97fd78){return _0x97fd78[_0xade6('0x25')]()[_0xade6('0x24')](function(){_0x1e8885['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x365ae7,_0x2f2562){return function(_0x3a8ca5){if(!_0x3a8ca5){_0x365ae7[_0xade6('0x1b')](0x194);}return _0x3a8ca5;};}function handleError(_0x542060,_0x448783){_0x448783=_0x448783||0x1f4;return function(_0x4fd5a9){logger[_0xade6('0x26')](_0x4fd5a9[_0xade6('0x27')]);if(_0x4fd5a9[_0xade6('0x28')]){delete _0x4fd5a9['name'];}_0x542060[_0xade6('0x1c')](_0x448783)[_0xade6('0x29')](_0x4fd5a9);};}exports[_0xade6('0x2a')]=function(_0x20523c,_0x4bcd08,_0x5d0553){if(!_0x20523c['body'][_0xade6('0x2b')](_0xade6('0x2c'))&&!_0x20523c[_0xade6('0x2d')][_0xade6('0x2b')](_0xade6('0x2e'))){throw new db[(_0xade6('0x2f'))][(_0xade6('0x30'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x20523c['body'][_0xade6('0x2b')](_0xade6('0x2e'))&&!_0x20523c[_0xade6('0x2d')][_0xade6('0x2b')](_0xade6('0x31'))){throw new db[(_0xade6('0x2f'))]['ValidationError'](_0xade6('0x32'));}if(!_0x20523c[_0xade6('0x2d')][_0xade6('0x2b')]('recipients')){throw new db[(_0xade6('0x2f'))][(_0xade6('0x30'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x17f7aa=JSON[_0xade6('0x33')](_0x20523c['body'][_0xade6('0x34')]);}catch(_0x2000f8){logger['error'](_0x2000f8);throw new db[(_0xade6('0x2f'))][(_0xade6('0x30'))](_0xade6('0x35'));}var _0x4bd336=[_0xade6('0x36'),_0xade6('0x37'),_0xade6('0x38'),_0xade6('0x39'),_0xade6('0x3a'),_0xade6('0x3b'),_0xade6('0x3c'),'team',_0xade6('0x3d')];if(_['some'](_0x17f7aa,function(_0x5f4532){return!_[_0xade6('0x3e')](_0x4bd336,_0x5f4532[_0xade6('0x3f')][_0xade6('0x40')]());})){throw new db[(_0xade6('0x2f'))][(_0xade6('0x30'))](_0xade6('0x41'));}}}var _0x5b5a21={};_0x5b5a21[_0xade6('0x42')]=_0x20523c['body'][_0xade6('0x2b')](_0xade6('0x42'))?_0x20523c[_0xade6('0x2d')]['senderName']:_0x20523c[_0xade6('0x3d')][_0xade6('0x43')];_0x5b5a21[_0xade6('0x44')]=_['isEmpty'](_0x20523c[_0xade6('0x2d')]['recipientsDescription'])?null:_0x20523c[_0xade6('0x2d')]['recipientsDescription'];_0x5b5a21[_0xade6('0x45')]=_0x20523c[_0xade6('0x2d')][_0xade6('0x45')]||![];_0x5b5a21[_0xade6('0x46')]=_0x20523c['user']['id'];return getContent(_0x20523c[_0xade6('0x2d')])['then'](function(_0x52a56b){_0x5b5a21[_0xade6('0x2d')]=_0x52a56b;return getRecipients(_0x17f7aa);})['then'](function(_0x4a84fe){_0x5b5a21[_0xade6('0x47')]=_[_0xade6('0x48')](_0x4a84fe)[_0xade6('0x49')](',');return db[_0xade6('0x4a')]['transaction'](function(_0x41e2bb){return db['Notification'][_0xade6('0x4b')](_0x5b5a21,{'raw':!![],'transaction':_0x41e2bb})[_0xade6('0x24')](function(_0x1998f0){var _0xbeb846={'sender':_0x5b5a21[_0xade6('0x42')],'description':_0x5b5a21[_0xade6('0x44')],'content':_0x5b5a21[_0xade6('0x2d')],'beep':_0x5b5a21['beep']};_0x4a84fe[_0xade6('0x4c')](function(_0xe26ecc){_0xbeb846[_0xade6('0x4d')]=_0xe26ecc;socket[_0xade6('0x4e')](_0xade6('0x4f'),_0xbeb846);});return _0x1998f0;});});})[_0xade6('0x24')](respondWithResult(_0x4bcd08,0xc9))[_0xade6('0x50')](handleError(_0x4bcd08,null));};function getContent(_0x1e6463){return new BPromise(function(_0x4aa959,_0x414482){if(_0x1e6463[_0xade6('0x2c')]){_0x4aa959(_0x1e6463[_0xade6('0x2c')]);return;}return db[_0xade6('0x51')][_0xade6('0x52')]({'attributes':[_0xade6('0x53')],'where':{'id':_0x1e6463[_0xade6('0x2e')]},'raw':!![]})[_0xade6('0x24')](function(_0x2f2c29){if(!_0x2f2c29)throw new db[(_0xade6('0x2f'))][(_0xade6('0x30'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x350b27=Mustache[_0xade6('0x54')](_0x2f2c29['html'],_0x1e6463['view']);_0x4aa959(_0x350b27);})['catch'](function(_0x369389){_0x414482(_0x369389);});});}function getRecipients(_0x5f21a0){return new BPromise(function(_0x332253,_0x5ce1da){var _0x1c2669=[];var _0x397db2=[];_0x5f21a0['forEach'](function(_0x3100ac){var _0x25f66c=_[_0xade6('0x55')](_0x3100ac[_0xade6('0x3f')][_0xade6('0x40')]());if(_0x25f66c===_0xade6('0x56')){_0x1c2669=_[_0xade6('0x57')](_0x1c2669,_0x3100ac[_0xade6('0x58')]);}else{if(_['includes'](_0x25f66c,_0xade6('0x59')))_0x25f66c=_0x25f66c[_0xade6('0x5a')](_0xade6('0x59'),_0xade6('0x5b'));_0x3100ac['ids']['forEach'](function(_0x756eab){_0x397db2[_0xade6('0x5c')](getAgents(_0x25f66c,_0x756eab));});}});return BPromise[_0xade6('0x5d')](_0x397db2)['then'](function(_0x40a2c){_0x1c2669=_['union'](_0x1c2669,_[_0xade6('0x5e')](_0x40a2c));_0x332253(_0x1c2669);})[_0xade6('0x50')](function(_0x111003){_0x5ce1da(_0x111003);});});}function getAgents(_0x5e6cd8,_0x2b975a){return new BPromise(function(_0x4dc76f,_0x88e5ae){return db[_0x5e6cd8]['findOne']({'where':{'id':_0x2b975a}})[_0xade6('0x24')](function(_0x29fd11){return _0x29fd11[_0xade6('0x5f')]({'attributes':['id'],'raw':!![]})[_0xade6('0x24')](function(_0x750855){var _0x44b1e0=_['map'](_0x750855,'id');_0x4dc76f(_0x44b1e0);});})[_0xade6('0x50')](function(_0x5c38c4){_0x88e5ae(_0x5c38c4);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 136d84e..11c02c7 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 _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x20c0a7,_0x5162d8){var _0x12e762=function(_0x4e32c5){while(--_0x4e32c5){_0x20c0a7['push'](_0x20c0a7['shift']());}};_0x12e762(++_0x5162d8);}(_0x757a,0xde));var _0xa757=function(_0x425433,_0x19d24c){_0x425433=_0x425433-0x0;var _0x4c0980=_0x757a[_0x425433];return _0x4c0980;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Notification','setMaxListeners','save','update'];(function(_0x22fd93,_0x584fe2){var _0x4c311b=function(_0x5b27bd){while(--_0x5b27bd){_0x22fd93['push'](_0x22fd93['shift']());}};_0x4c311b(++_0x584fe2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2978e9,_0x2401ea){_0x2978e9=_0x2978e9-0x0;var _0xfe679f=_0x5f2f[_0x2978e9];return _0xfe679f;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var Notification=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){NotificationEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);NotificationEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];Notification[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 4fadb98..890b36e 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 _0xf7b4=['lodash','api','moment','path','rimraf','../../config/environment','./notification.attributes','exports','define','Notification','notifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5293a1,_0x351c64){var _0x5085aa=function(_0x3c3bd8){while(--_0x3c3bd8){_0x5293a1['push'](_0x5293a1['shift']());}};_0x5085aa(++_0x351c64);}(_0xf7b4,0x152));var _0x4f7b=function(_0x59ece4,_0xce6de0){_0x59ece4=_0x59ece4-0x0;var _0x56a0ba=_0xf7b4[_0x59ece4];return _0x56a0ba;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4f7b('0x1'));var moment=require(_0x4f7b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f7b('0x3'));var rimraf=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var attributes=require(_0x4f7b('0x6'));module[_0x4f7b('0x7')]=function(_0x2637f0,_0x427f8b){return _0x2637f0[_0x4f7b('0x8')](_0x4f7b('0x9'),attributes,{'tableName':_0x4f7b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4f7b('0xb'),'collate':_0x4f7b('0xc')});}; \ No newline at end of file +var _0xd8b0=['define','notifications','utf8mb4','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x25d394,_0x3a7f03){var _0x1b9579=function(_0x8eea66){while(--_0x8eea66){_0x25d394['push'](_0x25d394['shift']());}};_0x1b9579(++_0x3a7f03);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./notification.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('Notification',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d8b('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 67fbdbf..0c99739 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 _0x8461=['stringify','error','code','Notification,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./notification.socket','then','info','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s'];(function(_0x56f3a3,_0x18477f){var _0x3f9853=function(_0xabb4c3){while(--_0xabb4c3){_0x56f3a3['push'](_0x56f3a3['shift']());}};_0x3f9853(++_0x18477f);}(_0x8461,0x19c));var _0x1846=function(_0xa211d,_0x253018){_0xa211d=_0xa211d-0x0;var _0x441a84=_0x8461[_0xa211d];return _0x441a84;};'use strict';var _=require(_0x1846('0x0'));var util=require('util');var moment=require(_0x1846('0x1'));var BPromise=require(_0x1846('0x2'));var rs=require(_0x1846('0x3'));var fs=require('fs');var Redis=require(_0x1846('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1846('0x5'));var logger=require(_0x1846('0x6'))(_0x1846('0x7'));var config=require(_0x1846('0x8'));var jayson=require(_0x1846('0x9'));var client=jayson[_0x1846('0xa')][_0x1846('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x1846('0xc'),'port':0x18eb});var socket=require(_0x1846('0xd'))(new Redis(config['redis']));require(_0x1846('0xe'))['register'](socket);function respondWithRpcPromise(_0x4fc80d,_0x5f4fa0,_0x1d1130){return new BPromise(function(_0x1ec00e,_0x4dc2c0){return client['request'](_0x4fc80d,_0x1d1130)[_0x1846('0xf')](function(_0xd9651){logger[_0x1846('0x10')]('Notification,\x20%s,\x20%s',_0x5f4fa0,_0x1846('0x11'));logger[_0x1846('0x12')](_0x1846('0x13'),_0x5f4fa0,_0x1846('0x11'),JSON[_0x1846('0x14')](_0xd9651));if(_0xd9651[_0x1846('0x15')]){if(_0xd9651['error'][_0x1846('0x16')]===0x1f4){logger[_0x1846('0x15')](_0x1846('0x17'),_0x5f4fa0,_0xd9651[_0x1846('0x15')][_0x1846('0x18')]);return _0x4dc2c0(_0xd9651[_0x1846('0x15')][_0x1846('0x18')]);}logger['error'](_0x1846('0x17'),_0x5f4fa0,_0xd9651[_0x1846('0x15')][_0x1846('0x18')]);return _0x1ec00e(_0xd9651[_0x1846('0x15')][_0x1846('0x18')]);}else{logger['info'](_0x1846('0x17'),_0x5f4fa0,_0x1846('0x11'));_0x1ec00e(_0xd9651[_0x1846('0x19')]['message']);}})[_0x1846('0x1a')](function(_0x1139cc){logger['error'](_0x1846('0x17'),_0x5f4fa0,_0x1139cc);_0x4dc2c0(_0x1139cc);});});} \ No newline at end of file +var _0x90c2=['code','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./notification.socket','then','info','Notification,\x20%s,\x20%s','request\x20sent','Notification,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xcb42ca,_0x124bc3){var _0x4b6086=function(_0x40d3fe){while(--_0x40d3fe){_0xcb42ca['push'](_0xcb42ca['shift']());}};_0x4b6086(++_0x124bc3);}(_0x90c2,0x8d));var _0x290c=function(_0x155071,_0x36fd05){_0x155071=_0x155071-0x0;var _0x56832c=_0x90c2[_0x155071];return _0x56832c;};'use strict';var _=require(_0x290c('0x0'));var util=require(_0x290c('0x1'));var moment=require('moment');var BPromise=require(_0x290c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x290c('0x3'))['db'];var utils=require(_0x290c('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x290c('0x5'));var jayson=require(_0x290c('0x6'));var client=jayson[_0x290c('0x7')][_0x290c('0x8')]({'port':0x232a});config['redis']=_[_0x290c('0x9')](config[_0x290c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x290c('0xb'))(new Redis(config[_0x290c('0xa')]));require(_0x290c('0xc'))['register'](socket);function respondWithRpcPromise(_0x1a148c,_0x3a9aa4,_0x51284d){return new BPromise(function(_0x2cc193,_0x24acc6){return client['request'](_0x1a148c,_0x51284d)[_0x290c('0xd')](function(_0x15f5d3){logger[_0x290c('0xe')](_0x290c('0xf'),_0x3a9aa4,_0x290c('0x10'));logger['debug'](_0x290c('0x11'),_0x3a9aa4,_0x290c('0x10'),JSON[_0x290c('0x12')](_0x15f5d3));if(_0x15f5d3[_0x290c('0x13')]){if(_0x15f5d3[_0x290c('0x13')][_0x290c('0x14')]===0x1f4){logger[_0x290c('0x13')]('Notification,\x20%s,\x20%s',_0x3a9aa4,_0x15f5d3[_0x290c('0x13')][_0x290c('0x15')]);return _0x24acc6(_0x15f5d3[_0x290c('0x13')][_0x290c('0x15')]);}logger[_0x290c('0x13')](_0x290c('0xf'),_0x3a9aa4,_0x15f5d3[_0x290c('0x13')]['message']);return _0x2cc193(_0x15f5d3['error'][_0x290c('0x15')]);}else{logger[_0x290c('0xe')](_0x290c('0xf'),_0x3a9aa4,_0x290c('0x10'));_0x2cc193(_0x15f5d3[_0x290c('0x16')][_0x290c('0x15')]);}})['catch'](function(_0x96425d){logger[_0x290c('0x13')](_0x290c('0xf'),_0x3a9aa4,_0x96425d);_0x24acc6(_0x96425d);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 5ad3232..6bc242a 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 _0x8065=['notification:','./notification.events','save','update','emit','length'];(function(_0x2e913b,_0x4b7071){var _0x173899=function(_0x2a7d22){while(--_0x2a7d22){_0x2e913b['push'](_0x2e913b['shift']());}};_0x173899(++_0x4b7071);}(_0x8065,0x163));var _0x5806=function(_0x1beaad,_0x483187){_0x1beaad=_0x1beaad-0x0;var _0x4e8398=_0x8065[_0x1beaad];return _0x4e8398;};'use strict';var NotificationEvents=require(_0x5806('0x0'));var events=[_0x5806('0x1'),'remove',_0x5806('0x2')];function createListener(_0xcd6026,_0x548910){return function(_0x4dd9f4){_0x548910[_0x5806('0x3')](_0xcd6026,_0x4dd9f4);};}function removeListener(_0x5d3732,_0x434b01){return function(){NotificationEvents['removeListener'](_0x5d3732,_0x434b01);};}exports['register']=function(_0x59bd6f){for(var _0x309f34=0x0,_0xc69e3c=events[_0x5806('0x4')];_0x309f34<_0xc69e3c;_0x309f34++){var _0x4ffdf2=events[_0x309f34];var _0x369f36=createListener(_0x5806('0x5')+_0x4ffdf2,_0x59bd6f);NotificationEvents['on'](_0x4ffdf2,_0x369f36);}}; \ No newline at end of file +var _0x241a=['notification:','save','remove','update','emit','register'];(function(_0x56f52e,_0xdd6786){var _0x2b67ac=function(_0x44c7f4){while(--_0x44c7f4){_0x56f52e['push'](_0x56f52e['shift']());}};_0x2b67ac(++_0xdd6786);}(_0x241a,0x133));var _0xa241=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x241a[_0x1c8c28];return _0x1f59b4;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0xa241('0x0'),_0xa241('0x1'),_0xa241('0x2')];function createListener(_0x54f459,_0x2242c1){return function(_0x484f9a){_0x2242c1[_0xa241('0x3')](_0x54f459,_0x484f9a);};}function removeListener(_0xeeefb,_0x117c55){return function(){NotificationEvents['removeListener'](_0xeeefb,_0x117c55);};}exports[_0xa241('0x4')]=function(_0xdfd916){for(var _0x43f182=0x0,_0x24d40a=events['length'];_0x43f182<_0x24d40a;_0x43f182++){var _0x2caea2=events[_0x43f182];var _0x202978=createListener(_0xa241('0x5')+_0x2caea2,_0xdfd916);NotificationEvents['on'](_0x2caea2,_0x202978);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 200c56c..db09f4f 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 _0xef81=['post','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','addApplications','addAgents','/:id/send','send','put','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef81,0x10c));var _0x1ef8=function(_0x36acca,_0x2dbd0c){_0x36acca=_0x36acca-0x0;var _0x26d704=_0xef81[_0x36acca];return _0x26d704;};'use strict';var multer=require(_0x1ef8('0x0'));var util=require('util');var path=require(_0x1ef8('0x1'));var timeout=require(_0x1ef8('0x2'));var express=require(_0x1ef8('0x3'));var router=express[_0x1ef8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1ef8('0x5'));var config=require(_0x1ef8('0x6'));var controller=require('./openchannelAccount.controller');router[_0x1ef8('0x7')]('/',auth[_0x1ef8('0x8')](),controller[_0x1ef8('0x9')]);router[_0x1ef8('0x7')]('/describe',auth[_0x1ef8('0x8')](),controller['describe']);router[_0x1ef8('0x7')](_0x1ef8('0xa'),auth[_0x1ef8('0x8')](),controller[_0x1ef8('0xb')]);router[_0x1ef8('0x7')](_0x1ef8('0xc'),auth[_0x1ef8('0x8')](),controller[_0x1ef8('0xd')]);router[_0x1ef8('0x7')]('/:id/canned_answers',auth[_0x1ef8('0x8')](),controller[_0x1ef8('0xe')]);router[_0x1ef8('0x7')](_0x1ef8('0xf'),auth['isAuthenticated'](),controller['getApplications']);router[_0x1ef8('0x7')](_0x1ef8('0x10'),auth[_0x1ef8('0x8')](),controller[_0x1ef8('0x11')]);router['get'](_0x1ef8('0x12'),auth[_0x1ef8('0x8')](),controller[_0x1ef8('0x13')]);router[_0x1ef8('0x14')]('/',auth[_0x1ef8('0x8')](),controller['create']);router['post'](_0x1ef8('0xc'),auth[_0x1ef8('0x8')](),controller[_0x1ef8('0x15')]);router[_0x1ef8('0x14')](_0x1ef8('0x16'),auth[_0x1ef8('0x8')](),controller[_0x1ef8('0x17')]);router[_0x1ef8('0x14')](_0x1ef8('0x18'),controller['notify']);router['post'](_0x1ef8('0xf'),auth['isAuthenticated'](),controller[_0x1ef8('0x19')]);router['post'](_0x1ef8('0x12'),auth[_0x1ef8('0x8')](),controller[_0x1ef8('0x1a')]);router[_0x1ef8('0x14')](_0x1ef8('0x1b'),auth[_0x1ef8('0x8')](),controller[_0x1ef8('0x1c')]);router[_0x1ef8('0x1d')]('/:id',auth[_0x1ef8('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1ef8('0x1e')]);router[_0x1ef8('0x1f')](_0x1ef8('0xc'),auth[_0x1ef8('0x8')](),controller[_0x1ef8('0x20')]);router[_0x1ef8('0x1f')](_0x1ef8('0x16'),auth[_0x1ef8('0x8')](),controller[_0x1ef8('0x21')]);router['delete'](_0x1ef8('0x12'),auth[_0x1ef8('0x8')](),controller[_0x1ef8('0x22')]);module[_0x1ef8('0x23')]=router; \ No newline at end of file +var _0x45f4=['exports','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/interactions','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','/:id/users','addAgents','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents'];(function(_0x285db,_0x4f4926){var _0x2ebec6=function(_0x3a08c3){while(--_0x3a08c3){_0x285db['push'](_0x285db['shift']());}};_0x2ebec6(++_0x4f4926);}(_0x45f4,0x109));var _0x445f=function(_0x5cde61,_0x5aab83){_0x5cde61=_0x5cde61-0x0;var _0x626d0=_0x45f4[_0x5cde61];return _0x626d0;};'use strict';var multer=require('multer');var util=require(_0x445f('0x0'));var path=require(_0x445f('0x1'));var timeout=require(_0x445f('0x2'));var express=require(_0x445f('0x3'));var router=express[_0x445f('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x445f('0x5'));var controller=require('./openchannelAccount.controller');router[_0x445f('0x6')]('/',auth[_0x445f('0x7')](),controller[_0x445f('0x8')]);router[_0x445f('0x6')](_0x445f('0x9'),auth[_0x445f('0x7')](),controller[_0x445f('0xa')]);router[_0x445f('0x6')](_0x445f('0xb'),auth[_0x445f('0x7')](),controller[_0x445f('0xc')]);router['get'](_0x445f('0xd'),auth[_0x445f('0x7')](),controller[_0x445f('0xe')]);router[_0x445f('0x6')]('/:id/canned_answers',auth[_0x445f('0x7')](),controller['getAnswers']);router['get']('/:id/applications',auth[_0x445f('0x7')](),controller['getApplications']);router[_0x445f('0x6')](_0x445f('0xf'),auth[_0x445f('0x7')](),controller['getInteractions']);router[_0x445f('0x6')]('/:id/users',auth[_0x445f('0x7')](),controller[_0x445f('0x10')]);router[_0x445f('0x11')]('/',auth[_0x445f('0x7')](),controller[_0x445f('0x12')]);router[_0x445f('0x11')]('/:id/dispositions',auth[_0x445f('0x7')](),controller[_0x445f('0x13')]);router['post'](_0x445f('0x14'),auth[_0x445f('0x7')](),controller[_0x445f('0x15')]);router['post'](_0x445f('0x16'),controller['notify']);router[_0x445f('0x11')]('/:id/applications',auth[_0x445f('0x7')](),controller['addApplications']);router['post'](_0x445f('0x17'),auth['isAuthenticated'](),controller[_0x445f('0x18')]);router[_0x445f('0x11')]('/:id/send',auth[_0x445f('0x7')](),controller[_0x445f('0x19')]);router[_0x445f('0x1a')]('/:id',auth[_0x445f('0x7')](),controller['update']);router[_0x445f('0x1b')](_0x445f('0xb'),auth[_0x445f('0x7')](),controller[_0x445f('0x1c')]);router['delete'](_0x445f('0xd'),auth[_0x445f('0x7')](),controller[_0x445f('0x1d')]);router[_0x445f('0x1b')](_0x445f('0x14'),auth[_0x445f('0x7')](),controller[_0x445f('0x1e')]);router['delete']('/:id/users',auth[_0x445f('0x7')](),controller[_0x445f('0x1f')]);module[_0x445f('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 9f410d9..0465aff 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 _0x46a9=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING'];(function(_0x35e31e,_0x2a70a7){var _0x281b37=function(_0x194b8f){while(--_0x194b8f){_0x35e31e['push'](_0x35e31e['shift']());}};_0x281b37(++_0x2a70a7);}(_0x46a9,0x1e9));var _0x946a=function(_0xce923e,_0x4221f2){_0xce923e=_0xce923e-0x0;var _0x4d2d8a=_0x46a9[_0xce923e];return _0x4d2d8a;};'use strict';var Sequelize=require(_0x946a('0x0'));var rs=require(_0x946a('0x1'));module['exports']={'name':{'type':Sequelize[_0x946a('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x946a('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x946a('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x946a('0x3')],'defaultValue':function(){return _0x946a('0x4');}},'notificationSound':{'type':Sequelize[_0x946a('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x946a('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x946a('0x2')]},'queueTransfer':{'type':Sequelize[_0x946a('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x946a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x946a('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x946a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x946a('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x946a('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x946a('0x8'),'set':function(_0xa4c70f){if(!_0xa4c70f)this[_0x946a('0x9')](_0x946a('0xa'),null);this[_0x946a('0x9')](_0x946a('0xb'),_0xa4c70f);}}}; \ No newline at end of file +var _0x6481=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate'];(function(_0x5e2e5f,_0x28890b){var _0x5a7c4b=function(_0x21dad5){while(--_0x21dad5){_0x5e2e5f['push'](_0x5e2e5f['shift']());}};_0x5a7c4b(++_0x28890b);}(_0x6481,0xd3));var _0x1648=function(_0x92cc4d,_0x45cbb4){_0x92cc4d=_0x92cc4d-0x0;var _0x7557b0=_0x6481[_0x92cc4d];return _0x7557b0;};'use strict';var Sequelize=require(_0x1648('0x0'));var rs=require(_0x1648('0x1'));module[_0x1648('0x2')]={'name':{'type':Sequelize[_0x1648('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x1648('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x1648('0x4')]();}},'replyUri':{'type':Sequelize[_0x1648('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x1648('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1648('0x5')],'defaultValue':function(){return _0x1648('0x6');}},'notificationSound':{'type':Sequelize[_0x1648('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1648('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1648('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x1648('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1648('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1648('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1648('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1648('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x43a6e8){if(!_0x43a6e8)this[_0x1648('0x9')](_0x1648('0xa'),null);this[_0x1648('0x9')](_0x1648('0xb'),_0x43a6e8);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f5b0fb3..70a4fdf 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 _0x1b4f=['List','Contacts','DESC','account','applications','list','orderBy','priority','asc','Applications','defaults','ListId','CmContact','threadId','OpenchannelInteraction','spread','contact','firstName','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','notify','addApplications','sequelize','transaction','OpenchannelApplication','bulkCreate','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','addAgents','omit','removeAgents','isArray','getAgents','send','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','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','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','json','offset','set','apply','reject','save','destroy','get','end','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','length','find','create','body','user','role','OpenchannelAccounts','UserProfileSection','userProfileId','update','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','openchannel','ValidationError','difference','createdAt','CompanyId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList'];(function(_0x4ef8f1,_0x30f6e3){var _0x330e8e=function(_0x3fd871){while(--_0x3fd871){_0x4ef8f1['push'](_0x4ef8f1['shift']());}};_0x330e8e(++_0x30f6e3);}(_0x1b4f,0xf5));var _0xf1b4=function(_0x318258,_0x2fdeba){_0x318258=_0x318258-0x0;var _0x191848=_0x1b4f[_0x318258];return _0x191848;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf1b4('0x0'));var rimraf=require(_0xf1b4('0x1'));var zipdir=require(_0xf1b4('0x2'));var jsonpatch=require(_0xf1b4('0x3'));var rp=require(_0xf1b4('0x4'));var moment=require(_0xf1b4('0x5'));var BPromise=require(_0xf1b4('0x6'));var Mustache=require(_0xf1b4('0x7'));var util=require(_0xf1b4('0x8'));var path=require(_0xf1b4('0x9'));var sox=require(_0xf1b4('0xa'));var csv=require(_0xf1b4('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf1b4('0xc'));var squel=require('squel');var crypto=require(_0xf1b4('0xd'));var jsforce=require(_0xf1b4('0xe'));var deskjs=require(_0xf1b4('0xf'));var toCsv=require(_0xf1b4('0xb'));var querystring=require(_0xf1b4('0x10'));var Papa=require('papaparse');var Redis=require(_0xf1b4('0x11'));var authService=require(_0xf1b4('0x12'));var qs=require(_0xf1b4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf1b4('0x14'))('api');var utils=require(_0xf1b4('0x15'));var config=require(_0xf1b4('0x16'));var db=require(_0xf1b4('0x17'))['db'];config[_0xf1b4('0x18')]=_['defaults'](config['redis'],{'host':_0xf1b4('0x19'),'port':0x18eb});var socket=require(_0xf1b4('0x1a'))(new Redis(config[_0xf1b4('0x18')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xf1b4('0x1b')][_0xf1b4('0x1c')]({'port':0x232c});var client9002=jayson[_0xf1b4('0x1b')][_0xf1b4('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x335cab,_0x3b1c48,_0x1c5090){if(_0x1c5090){var _0x690242=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x690242['test'](_0x3b1c48)){return _0x335cab;}else{throw new db[(_0xf1b4('0x1d'))]['ValidationError'](_0xf1b4('0x1e'));}}else{return _0x335cab;}}function respondWithRpcPromise(_0x595d27,_0x2a7ded,_0x6e8167,_0x276701){return new BPromise(function(_0x445413,_0x82df69){var _0x9469e3=_0x276701||client;return _0x9469e3[_0xf1b4('0x1f')](_0x595d27,_0x6e8167)[_0xf1b4('0x20')](function(_0x4c2048){logger[_0xf1b4('0x21')](_0xf1b4('0x22'),_0x2a7ded,'request\x20sent');logger[_0xf1b4('0x23')](_0xf1b4('0x24'),_0x2a7ded,_0xf1b4('0x25'),JSON[_0xf1b4('0x26')](_0x4c2048));if(_0x4c2048[_0xf1b4('0x27')]){if(_0x4c2048[_0xf1b4('0x27')][_0xf1b4('0x28')]===0x1f4){logger[_0xf1b4('0x27')](_0xf1b4('0x22'),_0x2a7ded,_0x4c2048[_0xf1b4('0x27')][_0xf1b4('0x29')]);return _0x82df69(_0x4c2048[_0xf1b4('0x27')]['message']);}logger[_0xf1b4('0x27')](_0xf1b4('0x22'),_0x2a7ded,_0x4c2048[_0xf1b4('0x27')][_0xf1b4('0x29')]);return _0x445413(_0x4c2048[_0xf1b4('0x27')][_0xf1b4('0x29')]);}else{logger[_0xf1b4('0x21')](_0xf1b4('0x22'),_0x2a7ded,_0xf1b4('0x25'));_0x445413(_0x4c2048['result'][_0xf1b4('0x29')]);}})[_0xf1b4('0x2a')](function(_0x352fb5){logger[_0xf1b4('0x27')](_0xf1b4('0x22'),_0x2a7ded,_0x352fb5);_0x82df69(_0x352fb5);});});}function respondWithStatusCode(_0x48cf6b,_0x4beab5){_0x4beab5=_0x4beab5||0xcc;return function(_0x22dfa3){if(_0x22dfa3){return _0x48cf6b['sendStatus'](_0x4beab5);}return _0x48cf6b['status'](_0x4beab5)['end']();};}function respondWithResult(_0x5db410,_0x175b12){_0x175b12=_0x175b12||0xc8;return function(_0x50711b){if(_0x50711b){return _0x5db410[_0xf1b4('0x2b')](_0x175b12)[_0xf1b4('0x2c')](_0x50711b);}};}function respondWithFilteredResult(_0x45c1b2,_0xc26a93){return function(_0x593ce7){if(_0x593ce7){var _0x4133af=_0x593ce7['count'],_0x535c54=_0xc26a93[_0xf1b4('0x2d')],_0x2688ac=_0xc26a93[_0xf1b4('0x2d')]+_0xc26a93['limit'],_0x59a5cb;if(_0x2688ac>=_0x4133af){_0x2688ac=_0x4133af;_0x59a5cb=0xc8;}else{_0x59a5cb=0xce;}_0x45c1b2[_0xf1b4('0x2b')](_0x59a5cb);return _0x45c1b2[_0xf1b4('0x2e')]('Content-Range',_0x535c54+'-'+_0x2688ac+'/'+_0x4133af)['json'](_0x593ce7);}return null;};}function patchUpdates(_0x42d1aa){return function(_0x2357fe){try{jsonpatch[_0xf1b4('0x2f')](_0x2357fe,_0x42d1aa,!![]);}catch(_0xdb7329){return BPromise[_0xf1b4('0x30')](_0xdb7329);}return _0x2357fe[_0xf1b4('0x31')]();};}function saveUpdates(_0x831c2c,_0x4582b0){return function(_0x514065){if(_0x514065){return _0x514065['update'](_0x831c2c)[_0xf1b4('0x20')](function(_0x588af0){return _0x588af0;});}return null;};}function removeEntity(_0x194df0,_0x2d9d9c){return function(_0x30041a){if(_0x30041a){return _0x30041a[_0xf1b4('0x32')]()[_0xf1b4('0x20')](function(){var _0x181653=_0x30041a[_0xf1b4('0x33')]({'plain':!![]});var _0xebf9d8='OpenchannelAccounts';return db['UserProfileResource'][_0xf1b4('0x32')]({'where':{'type':_0xebf9d8,'resourceId':_0x181653['id']}})[_0xf1b4('0x20')](function(){return _0x30041a;});})['then'](function(){_0x194df0[_0xf1b4('0x2b')](0xcc)[_0xf1b4('0x34')]();});}};}function handleEntityNotFound(_0x18311d,_0x18effb){return function(_0x3ebd4d){if(!_0x3ebd4d){_0x18311d[_0xf1b4('0x35')](0x194);}return _0x3ebd4d;};}function handleError(_0x2a27db,_0x26ed6c){_0x26ed6c=_0x26ed6c||0x1f4;return function(_0x208062){logger[_0xf1b4('0x27')](_0x208062[_0xf1b4('0x36')]);if(_0x208062[_0xf1b4('0x37')]){delete _0x208062['name'];}_0x2a27db[_0xf1b4('0x2b')](_0x26ed6c)['send'](_0x208062);};}exports[_0xf1b4('0x38')]=function(_0x8dcfb2,_0x3a5e1a){var _0xce4b46={'include':[{'model':db[_0xf1b4('0x39')],'as':_0xf1b4('0x3a')}]},_0x190d9b={},_0x3ca97d={'count':0x0,'rows':[]};var _0x36a0f8=_['map'](db[_0xf1b4('0x3b')][_0xf1b4('0x3c')],function(_0x119a25){return{'name':_0x119a25[_0xf1b4('0x3d')],'type':_0x119a25['type'][_0xf1b4('0x3e')]};});_0x190d9b['model']=_[_0xf1b4('0x3f')](_0x36a0f8,_0xf1b4('0x37'));_0x190d9b[_0xf1b4('0x40')]=_[_0xf1b4('0x41')](_0x8dcfb2[_0xf1b4('0x40')]);_0x190d9b[_0xf1b4('0x42')]=_[_0xf1b4('0x43')](_0x190d9b['model'],_0x190d9b[_0xf1b4('0x40')]);_0xce4b46[_0xf1b4('0x44')]=_['intersection'](_0x190d9b[_0xf1b4('0x45')],qs[_0xf1b4('0x46')](_0x8dcfb2['query']['fields']));_0xce4b46[_0xf1b4('0x44')]=_0xce4b46[_0xf1b4('0x44')]['length']?_0xce4b46['attributes']:_0x190d9b['model'];if(!_0x8dcfb2['query'][_0xf1b4('0x47')](_0xf1b4('0x48'))){_0xce4b46[_0xf1b4('0x49')]=qs[_0xf1b4('0x49')](_0x8dcfb2['query'][_0xf1b4('0x49')]);_0xce4b46[_0xf1b4('0x2d')]=qs[_0xf1b4('0x2d')](_0x8dcfb2['query'][_0xf1b4('0x2d')]);}_0xce4b46[_0xf1b4('0x4a')]=qs[_0xf1b4('0x4b')](_0x8dcfb2['query'][_0xf1b4('0x4b')]);_0xce4b46[_0xf1b4('0x4c')]=qs[_0xf1b4('0x42')](_[_0xf1b4('0x4d')](_0x8dcfb2[_0xf1b4('0x40')],_0x190d9b[_0xf1b4('0x42')]),_0x36a0f8);if(_0x8dcfb2[_0xf1b4('0x40')][_0xf1b4('0x4e')]){_0xce4b46[_0xf1b4('0x4c')]=_[_0xf1b4('0x4f')](_0xce4b46[_0xf1b4('0x4c')],{'$or':_[_0xf1b4('0x3f')](_0x36a0f8,function(_0x310745){if(_0x310745[_0xf1b4('0x50')]!==_0xf1b4('0x51')){var _0x11dd93={};_0x11dd93[_0x310745['name']]={'$like':'%'+_0x8dcfb2['query']['filter']+'%'};return _0x11dd93;}})});}_0xce4b46=_['merge']({},_0xce4b46,_0x8dcfb2[_0xf1b4('0x52')]);var _0x5715e9={'where':_0xce4b46[_0xf1b4('0x4c')]};return db['OpenchannelAccount'][_0xf1b4('0x53')](_0x5715e9)[_0xf1b4('0x20')](function(_0x64ecf0){_0x3ca97d['count']=_0x64ecf0;if(_0x8dcfb2[_0xf1b4('0x40')][_0xf1b4('0x54')]){_0xce4b46[_0xf1b4('0x55')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xf1b4('0x56')](_0xce4b46);})[_0xf1b4('0x20')](function(_0x137929){_0x3ca97d[_0xf1b4('0x57')]=_0x137929;return _0x3ca97d;})[_0xf1b4('0x20')](respondWithFilteredResult(_0x3a5e1a,_0xce4b46))[_0xf1b4('0x2a')](handleError(_0x3a5e1a,null));};exports[_0xf1b4('0x58')]=function(_0x4f6912,_0x4b4e6c){var _0x34351a={'raw':![],'where':{'id':_0x4f6912[_0xf1b4('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xf1b4('0x3a')}]},_0x588022={};_0x588022[_0xf1b4('0x45')]=_['keys'](db[_0xf1b4('0x3b')]['rawAttributes']);_0x588022['query']=_[_0xf1b4('0x41')](_0x4f6912['query']);_0x588022[_0xf1b4('0x42')]=_[_0xf1b4('0x43')](_0x588022[_0xf1b4('0x45')],_0x588022[_0xf1b4('0x40')]);_0x34351a[_0xf1b4('0x44')]=_['intersection'](_0x588022['model'],qs[_0xf1b4('0x46')](_0x4f6912[_0xf1b4('0x40')][_0xf1b4('0x46')]));_0x34351a[_0xf1b4('0x44')]=_0x34351a['attributes'][_0xf1b4('0x5a')]?_0x34351a[_0xf1b4('0x44')]:_0x588022[_0xf1b4('0x45')];if(_0x4f6912[_0xf1b4('0x40')][_0xf1b4('0x54')]){_0x34351a['include']=[{'all':!![]}];}_0x34351a=_[_0xf1b4('0x4f')]({},_0x34351a,_0x4f6912[_0xf1b4('0x52')]);return db['OpenchannelAccount'][_0xf1b4('0x5b')](_0x34351a)[_0xf1b4('0x20')](handleEntityNotFound(_0x4b4e6c,null))[_0xf1b4('0x20')](respondWithResult(_0x4b4e6c,null))[_0xf1b4('0x2a')](handleError(_0x4b4e6c,null));};exports['create']=function(_0x24e75d,_0x356cc6){return db[_0xf1b4('0x3b')][_0xf1b4('0x5c')](_0x24e75d[_0xf1b4('0x5d')],{})[_0xf1b4('0x20')](function(_0x54721e){var _0x5ac989=_0x24e75d[_0xf1b4('0x5e')][_0xf1b4('0x33')]({'plain':!![]});if(!_0x5ac989)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ac989[_0xf1b4('0x5f')]==='user'){var _0x47b720=_0x54721e[_0xf1b4('0x33')]({'plain':!![]});var _0x134aca=_0xf1b4('0x60');return db[_0xf1b4('0x61')][_0xf1b4('0x5b')]({'where':{'name':_0x134aca,'userProfileId':_0x5ac989[_0xf1b4('0x62')]},'raw':!![]})['then'](function(_0x217122){if(_0x217122&&_0x217122['autoAssociation']===0x0){return db['UserProfileResource'][_0xf1b4('0x5c')]({'name':_0x47b720[_0xf1b4('0x37')],'resourceId':_0x47b720['id'],'type':_0x217122[_0xf1b4('0x37')],'sectionId':_0x217122['id']},{})['then'](function(){return _0x54721e;});}else{return _0x54721e;}})['catch'](function(_0x560981){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x560981);throw _0x560981;});}return _0x54721e;})[_0xf1b4('0x20')](respondWithResult(_0x356cc6,0xc9))[_0xf1b4('0x2a')](handleError(_0x356cc6,null));};exports[_0xf1b4('0x63')]=function(_0x424aeb,_0x23614a){if(_0x424aeb['body']['id']){delete _0x424aeb[_0xf1b4('0x5d')]['id'];}return db[_0xf1b4('0x3b')][_0xf1b4('0x5b')]({'where':{'id':_0x424aeb['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x23614a,null))[_0xf1b4('0x20')](saveUpdates(_0x424aeb[_0xf1b4('0x5d')],null))[_0xf1b4('0x20')](respondWithResult(_0x23614a,null))[_0xf1b4('0x2a')](handleError(_0x23614a,null));};exports['destroy']=function(_0x1bb4e5,_0x1c68a4){return db[_0xf1b4('0x3b')]['find']({'where':{'id':_0x1bb4e5[_0xf1b4('0x59')]['id']}})[_0xf1b4('0x20')](handleEntityNotFound(_0x1c68a4,null))['then'](removeEntity(_0x1c68a4,null))[_0xf1b4('0x2a')](handleError(_0x1c68a4,null));};exports[_0xf1b4('0x64')]=function(_0x391984,_0x18f917){return db[_0xf1b4('0x3b')][_0xf1b4('0x64')]()[_0xf1b4('0x20')](respondWithResult(_0x18f917,null))[_0xf1b4('0x2a')](handleError(_0x18f917,null));};exports[_0xf1b4('0x65')]=function(_0x246856,_0x18ae5b,_0x4ddbc5){if(_0x246856[_0xf1b4('0x5d')]['id']){delete _0x246856['body']['id'];}return db[_0xf1b4('0x3b')]['find']({'where':{'id':_0x246856['params']['id']}})[_0xf1b4('0x20')](handleEntityNotFound(_0x18ae5b,null))[_0xf1b4('0x20')](function(_0x58b9aa){if(_0x58b9aa){_0x246856[_0xf1b4('0x5d')][_0xf1b4('0x66')]=_0x58b9aa['id'];return db[_0xf1b4('0x67')]['create'](_0x246856[_0xf1b4('0x5d')]);}})[_0xf1b4('0x20')](respondWithResult(_0x18ae5b,null))['catch'](handleError(_0x18ae5b,null));};exports[_0xf1b4('0x68')]=function(_0x334d98,_0xfe615a,_0x58d46e){var _0x5764fb={'raw':![],'where':{}};var _0x220e62={};var _0x13c107={'count':0x0,'rows':[]};return db[_0xf1b4('0x3b')]['findOne']({'where':{'id':_0x334d98['params']['id']}})[_0xf1b4('0x20')](handleEntityNotFound(_0xfe615a,null))['then'](function(_0x361456){if(_0x361456){_0x220e62[_0xf1b4('0x45')]=_[_0xf1b4('0x41')](db['Disposition'][_0xf1b4('0x3c')]);_0x220e62[_0xf1b4('0x40')]=_[_0xf1b4('0x41')](_0x334d98[_0xf1b4('0x40')]);_0x220e62[_0xf1b4('0x42')]=_[_0xf1b4('0x43')](_0x220e62['model'],_0x220e62['query']);_0x5764fb[_0xf1b4('0x44')]=_[_0xf1b4('0x43')](_0x220e62[_0xf1b4('0x45')],qs[_0xf1b4('0x46')](_0x334d98[_0xf1b4('0x40')]['fields']));_0x5764fb[_0xf1b4('0x44')]=_0x5764fb[_0xf1b4('0x44')][_0xf1b4('0x5a')]?_0x5764fb[_0xf1b4('0x44')]:_0x220e62[_0xf1b4('0x45')];if(!_0x334d98[_0xf1b4('0x40')]['hasOwnProperty'](_0xf1b4('0x48'))){_0x5764fb[_0xf1b4('0x49')]=qs['limit'](_0x334d98[_0xf1b4('0x40')][_0xf1b4('0x49')]);_0x5764fb[_0xf1b4('0x2d')]=qs[_0xf1b4('0x2d')](_0x334d98[_0xf1b4('0x40')][_0xf1b4('0x2d')]);}_0x5764fb[_0xf1b4('0x4a')]=qs[_0xf1b4('0x4b')](_0x334d98[_0xf1b4('0x40')]['sort']);_0x5764fb[_0xf1b4('0x4c')]=qs[_0xf1b4('0x42')](_[_0xf1b4('0x4d')](_0x334d98[_0xf1b4('0x40')],_0x220e62[_0xf1b4('0x42')]));_0x5764fb[_0xf1b4('0x4c')][_0xf1b4('0x69')]=_0x361456['id'];if(_0x334d98[_0xf1b4('0x40')][_0xf1b4('0x4e')]){_0x5764fb[_0xf1b4('0x4c')]=_[_0xf1b4('0x4f')](_0x5764fb[_0xf1b4('0x4c')],{'$or':_[_0xf1b4('0x3f')](_0x5764fb['attributes'],function(_0x501bca){var _0x3f812f={};_0x3f812f[_0x501bca]={'$like':'%'+_0x334d98['query'][_0xf1b4('0x4e')]+'%'};return _0x3f812f;})});}_0x5764fb=_[_0xf1b4('0x4f')]({},_0x5764fb,_0x334d98[_0xf1b4('0x52')]);return db[_0xf1b4('0x67')][_0xf1b4('0x53')]({'where':_0x5764fb[_0xf1b4('0x4c')]})[_0xf1b4('0x20')](function(_0x24d533){_0x13c107[_0xf1b4('0x53')]=_0x24d533;if(_0x334d98[_0xf1b4('0x40')]['includeAll']){_0x5764fb[_0xf1b4('0x55')]=[{'all':!![]}];}return db[_0xf1b4('0x67')][_0xf1b4('0x56')](_0x5764fb);})[_0xf1b4('0x20')](function(_0x307037){_0x13c107[_0xf1b4('0x57')]=_0x307037;return _0x13c107;});}})['then'](respondWithFilteredResult(_0xfe615a,_0x5764fb))[_0xf1b4('0x2a')](handleError(_0xfe615a,null));};exports[_0xf1b4('0x6a')]=function(_0x2f02d8,_0x17fc3e,_0x5d9f37){return db[_0xf1b4('0x3b')][_0xf1b4('0x5b')]({'where':{'id':_0x2f02d8[_0xf1b4('0x59')]['id']}})[_0xf1b4('0x20')](handleEntityNotFound(_0x17fc3e,null))[_0xf1b4('0x20')](function(_0x2fe21d){if(_0x2fe21d){return _0x2fe21d[_0xf1b4('0x6a')](_0x2f02d8[_0xf1b4('0x40')][_0xf1b4('0x6b')]);}})['then'](respondWithStatusCode(_0x17fc3e,null))[_0xf1b4('0x2a')](handleError(_0x17fc3e,null));};exports[_0xf1b4('0x6c')]=function(_0x276ca1,_0x41ed99,_0x3dc34b){if(_0x276ca1[_0xf1b4('0x5d')]['id']){delete _0x276ca1['body']['id'];}return db[_0xf1b4('0x3b')][_0xf1b4('0x5b')]({'where':{'id':_0x276ca1[_0xf1b4('0x59')]['id']}})[_0xf1b4('0x20')](handleEntityNotFound(_0x41ed99,null))['then'](function(_0x1227ae){if(_0x1227ae){_0x276ca1[_0xf1b4('0x5d')][_0xf1b4('0x69')]=_0x1227ae['id'];return db[_0xf1b4('0x6d')][_0xf1b4('0x5c')](_0x276ca1['body']);}})[_0xf1b4('0x20')](respondWithResult(_0x41ed99,null))['catch'](handleError(_0x41ed99,null));};exports['getAnswers']=function(_0x33051e,_0x5a5869,_0xf01a4d){var _0x28413a={'raw':![],'where':{}};var _0x21ac52={};var _0x428d65={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf1b4('0x6e')]({'where':{'id':_0x33051e[_0xf1b4('0x59')]['id']}})[_0xf1b4('0x20')](handleEntityNotFound(_0x5a5869,null))[_0xf1b4('0x20')](function(_0x526350){if(_0x526350){_0x21ac52[_0xf1b4('0x45')]=_[_0xf1b4('0x41')](db[_0xf1b4('0x6d')][_0xf1b4('0x3c')]);_0x21ac52[_0xf1b4('0x40')]=_['keys'](_0x33051e[_0xf1b4('0x40')]);_0x21ac52[_0xf1b4('0x42')]=_[_0xf1b4('0x43')](_0x21ac52['model'],_0x21ac52[_0xf1b4('0x40')]);_0x28413a[_0xf1b4('0x44')]=_[_0xf1b4('0x43')](_0x21ac52['model'],qs[_0xf1b4('0x46')](_0x33051e[_0xf1b4('0x40')]['fields']));_0x28413a[_0xf1b4('0x44')]=_0x28413a[_0xf1b4('0x44')][_0xf1b4('0x5a')]?_0x28413a[_0xf1b4('0x44')]:_0x21ac52[_0xf1b4('0x45')];if(!_0x33051e[_0xf1b4('0x40')]['hasOwnProperty'](_0xf1b4('0x48'))){_0x28413a[_0xf1b4('0x49')]=qs['limit'](_0x33051e[_0xf1b4('0x40')][_0xf1b4('0x49')]);_0x28413a['offset']=qs[_0xf1b4('0x2d')](_0x33051e['query'][_0xf1b4('0x2d')]);}_0x28413a[_0xf1b4('0x4a')]=qs['sort'](_0x33051e['query'][_0xf1b4('0x4b')]);_0x28413a['where']=qs['filters'](_['pick'](_0x33051e[_0xf1b4('0x40')],_0x21ac52[_0xf1b4('0x42')]));_0x28413a['where'][_0xf1b4('0x69')]=_0x526350['id'];if(_0x33051e[_0xf1b4('0x40')]['filter']){_0x28413a['where']=_[_0xf1b4('0x4f')](_0x28413a['where'],{'$or':_[_0xf1b4('0x3f')](_0x28413a[_0xf1b4('0x44')],function(_0x194929){var _0x2b333c={};_0x2b333c[_0x194929]={'$like':'%'+_0x33051e[_0xf1b4('0x40')][_0xf1b4('0x4e')]+'%'};return _0x2b333c;})});}_0x28413a=_['merge']({},_0x28413a,_0x33051e[_0xf1b4('0x52')]);return db['CannedAnswer']['count']({'where':_0x28413a[_0xf1b4('0x4c')]})[_0xf1b4('0x20')](function(_0x213650){_0x428d65[_0xf1b4('0x53')]=_0x213650;if(_0x33051e['query'][_0xf1b4('0x54')]){_0x28413a[_0xf1b4('0x55')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x28413a);})[_0xf1b4('0x20')](function(_0x58f059){_0x428d65[_0xf1b4('0x57')]=_0x58f059;return _0x428d65;});}})[_0xf1b4('0x20')](respondWithFilteredResult(_0x5a5869,_0x28413a))[_0xf1b4('0x2a')](handleError(_0x5a5869,null));};exports[_0xf1b4('0x6f')]=function(_0x535c3d,_0x448e74,_0x54322f){return db[_0xf1b4('0x3b')]['find']({'where':{'id':_0x535c3d[_0xf1b4('0x59')]['id']}})[_0xf1b4('0x20')](handleEntityNotFound(_0x448e74,null))[_0xf1b4('0x20')](function(_0x455482){if(_0x455482){return _0x455482[_0xf1b4('0x6f')](_0x535c3d[_0xf1b4('0x40')][_0xf1b4('0x6b')]);}})[_0xf1b4('0x20')](respondWithStatusCode(_0x448e74,null))[_0xf1b4('0x2a')](handleError(_0x448e74,null));};exports['notify']=function(_0x12d0f8,_0x28bef2,_0x3c844b){var _0x46a6f2={'body':_0x12d0f8[_0xf1b4('0x5d')],'channel':_0xf1b4('0x70')};var _0x215738=[];var _0x1cbf86=[];var _0x3a3453={};var _0x205ff0=![];return db['CmContact']['describe']()[_0xf1b4('0x20')](function(_0x3cf785){if(!_0x3cf785){throw new db[(_0xf1b4('0x1d'))][(_0xf1b4('0x71'))]('no\x20available\x20attributes');}_0x215738=_[_0xf1b4('0x72')](_['keys'](_0x3cf785),[_0xf1b4('0x73'),'updatedAt']);_0x1cbf86=_[_0xf1b4('0x72')](_[_0xf1b4('0x41')](_0x3cf785),[_0xf1b4('0x73'),'updatedAt',_0xf1b4('0x74'),'ListId']);if(_0x12d0f8['body']['id']){delete _0x12d0f8[_0xf1b4('0x5d')]['id'];}if(_['isNil'](_0x12d0f8[_0xf1b4('0x5d')][_0xf1b4('0x75')])){throw new db[(_0xf1b4('0x1d'))][(_0xf1b4('0x71'))](_0xf1b4('0x76'));}if(_[_0xf1b4('0x77')](_0x12d0f8[_0xf1b4('0x5d')][_0xf1b4('0x5d')])||_0x12d0f8[_0xf1b4('0x5d')][_0xf1b4('0x5d')]===''){throw new db[(_0xf1b4('0x1d'))][(_0xf1b4('0x71'))](_0xf1b4('0x78'));}if(_[_0xf1b4('0x77')](_0x12d0f8[_0xf1b4('0x5d')][_0xf1b4('0x79')])){throw new db[(_0xf1b4('0x1d'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1cbf86);}if(!_[_0xf1b4('0x7a')](_0x1cbf86,_0x12d0f8[_0xf1b4('0x5d')][_0xf1b4('0x79')])){throw new db[(_0xf1b4('0x1d'))][(_0xf1b4('0x71'))](_0xf1b4('0x7b')+_0x1cbf86);}_0x3a3453[_0x12d0f8[_0xf1b4('0x5d')][_0xf1b4('0x79')]]=_0x12d0f8[_0xf1b4('0x5d')][_0xf1b4('0x75')];})['then'](function(){return db['OpenchannelAccount'][_0xf1b4('0x5b')]({'where':{'id':_0x12d0f8[_0xf1b4('0x59')]['id']},'include':[{'model':db[_0xf1b4('0x7c')],'as':_0xf1b4('0x7d'),'include':[{'model':db['CmContact'],'as':_0xf1b4('0x7e'),'where':_0x3a3453,'limit':0x1,'order':[['updatedAt',_0xf1b4('0x7f')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0xf1b4('0x20')](handleEntityNotFound(_0x28bef2,null))[_0xf1b4('0x20')](function(_0x5570e1){if(_0x5570e1&&_0x5570e1[_0xf1b4('0x7d')]){_0x46a6f2[_0xf1b4('0x80')]=_0x5570e1;_0x46a6f2[_0xf1b4('0x81')]=_0x5570e1['Applications'];_0x46a6f2[_0xf1b4('0x82')]=_0x5570e1['List'];_0x46a6f2[_0xf1b4('0x81')]=_[_0xf1b4('0x83')](_0x46a6f2[_0xf1b4('0x81')],[_0xf1b4('0x84')],[_0xf1b4('0x85')]);if(_0x46a6f2[_0xf1b4('0x80')][_0xf1b4('0x86')]){delete _0x46a6f2['account'][_0xf1b4('0x86')];}if(_0x46a6f2[_0xf1b4('0x80')][_0xf1b4('0x7d')]&&_0x46a6f2[_0xf1b4('0x80')]['List'][_0xf1b4('0x7e')][_0xf1b4('0x5a')]){return _0x46a6f2[_0xf1b4('0x80')][_0xf1b4('0x7d')]['Contacts'][0x0];}var _0x5f27d0=_[_0xf1b4('0x87')](_0x12d0f8[_0xf1b4('0x5d')],{'firstName':_0x12d0f8[_0xf1b4('0x5d')][_0xf1b4('0x75')],'ListId':_0x5570e1[_0xf1b4('0x88')]});_0x5f27d0[_0x12d0f8[_0xf1b4('0x5d')][_0xf1b4('0x79')]]=_0x12d0f8[_0xf1b4('0x5d')][_0xf1b4('0x75')];return db[_0xf1b4('0x89')][_0xf1b4('0x5c')](_0x5f27d0,{'fields':_0x215738,'raw':!![]});}})['then'](handleEntityNotFound(_0x28bef2,null))[_0xf1b4('0x20')](function(_0x31aeb6){_0x46a6f2['contact']=_0x31aeb6;if(_0x31aeb6){var _0x288cf5={'ContactId':_0x31aeb6['id'],'OpenchannelAccountId':_0x12d0f8[_0xf1b4('0x59')]['id'],'from':(_0x31aeb6['firstName']||'')+'\x20'+(_0x31aeb6['lastName']||'')};var _0x380bde={'OpenchannelAccountId':_0x12d0f8[_0xf1b4('0x59')]['id'],'closed':![]};if(_0x12d0f8['body'][_0xf1b4('0x8a')]){_0x380bde['threadId']=_0x12d0f8['body'][_0xf1b4('0x8a')];return db[_0xf1b4('0x8b')][_0xf1b4('0x5b')]({'where':_0x380bde})[_0xf1b4('0x20')](function(_0x15f56a){if(_0x15f56a){return[_0x15f56a,![]];}_0x288cf5['threadId']=_0x12d0f8['body'][_0xf1b4('0x8a')];_0x288cf5['externalUrl']=_0x12d0f8['body']['externalUrl'];return db['OpenchannelInteraction'][_0xf1b4('0x5c')](_0x288cf5)['then'](function(_0x452ad8){return[_0x452ad8,!![]];});});}else{_0x380bde['threadId']=null;}_0x380bde['ContactId']=_0x31aeb6['id'];return db[_0xf1b4('0x8b')]['find']({'where':_0x380bde})['then'](function(_0x589bb9){if(_0x589bb9){return[_0x589bb9,![]];}return db[_0xf1b4('0x8b')]['create'](_0x288cf5)[_0xf1b4('0x20')](function(_0x53d57b){return[_0x53d57b,!![]];});});}})[_0xf1b4('0x8c')](function(_0x204969,_0x19a1d7){if(_0x204969){_0x205ff0=_0x19a1d7;if(!_0x19a1d7){var _0x5f03c6={'from':(_0x46a6f2[_0xf1b4('0x8d')][_0xf1b4('0x8e')]||'')+'\x20'+(_0x46a6f2[_0xf1b4('0x8d')][_0xf1b4('0x8f')]||'')};if(_0x12d0f8[_0xf1b4('0x5d')][_0xf1b4('0x8a')]&&_0x12d0f8[_0xf1b4('0x5d')][_0xf1b4('0x90')]&&_0x12d0f8['body'][_0xf1b4('0x8a')]!=_0x12d0f8[_0xf1b4('0x5d')][_0xf1b4('0x90')]){_0x5f03c6[_0xf1b4('0x8a')]=_0x12d0f8[_0xf1b4('0x5d')]['messageId'];}return _0x204969[_0xf1b4('0x63')](_0x5f03c6);}else{return _0x204969;}}})[_0xf1b4('0x20')](function(_0xe5d140){_0x46a6f2[_0xf1b4('0x91')]=_0xe5d140[_0xf1b4('0x33')]({'plain':!![]});_0x46a6f2[_0xf1b4('0x91')][_0xf1b4('0x92')]=_0x205ff0;if(_0x46a6f2[_0xf1b4('0x91')]['created']){if(_0x46a6f2['account'][_0xf1b4('0x93')]){_0x46a6f2[_0xf1b4('0x81')][_0xf1b4('0x94')]({'id':0x0,'priority':_0x46a6f2['applications'][_0xf1b4('0x5a')]+0x1,'app':_0xf1b4('0x95'),'appdata':_0xf1b4('0x96'),'interval':_0xf1b4('0x97')});}}return db[_0xf1b4('0x98')][_0xf1b4('0x5c')]({'body':_0x12d0f8[_0xf1b4('0x5d')]['body'],'OpenchannelAccountId':_0x12d0f8[_0xf1b4('0x59')]['id'],'OpenchannelInteractionId':_0xe5d140['id'],'direction':'in','ContactId':_0x46a6f2[_0xf1b4('0x8d')]['id'],'AttachmentId':_0x12d0f8[_0xf1b4('0x5d')]['AttachmentId']});})[_0xf1b4('0x20')](function(_0xdeb709){_0x46a6f2[_0xf1b4('0x29')]=_0xdeb709;if(_0x46a6f2[_0xf1b4('0x91')]['UserId']){return db[_0xf1b4('0x99')][_0xf1b4('0x5b')]({'attributes':['id','name'],'where':{'id':_0x46a6f2[_0xf1b4('0x91')][_0xf1b4('0x9a')]}})['then'](function(_0x49dfcb){if(_0x49dfcb){_0x46a6f2[_0xf1b4('0x81')][_0xf1b4('0x9b')]({'id':0x0,'priority':0x0,'app':_0xf1b4('0x9c'),'appdata':_0x49dfcb[_0xf1b4('0x37')]+','+(_0x46a6f2[_0xf1b4('0x80')][_0xf1b4('0x9d')]||0xa),'interval':_0xf1b4('0x97')});_0x46a6f2[_0xf1b4('0x9e')]=![];}return respondWithRpcPromise('Start','startRouting',_0x46a6f2);});}return respondWithRpcPromise(_0xf1b4('0x9f'),_0xf1b4('0xa0'),_0x46a6f2);})[_0xf1b4('0x20')](function(_0x5cde49){respondWithRpcPromise('EventManager','EventManager',{'event':_0xf1b4('0xa1'),'message':_0x5cde49},client9002);return _0x5cde49;})['then'](respondWithResult(_0x28bef2,null))[_0xf1b4('0x2a')](handleError(_0x28bef2,null));};exports[_0xf1b4('0xa2')]=function(_0x132cdc,_0x4f7585,_0x33888c){return db[_0xf1b4('0x3b')][_0xf1b4('0x6e')]({'where':{'id':_0x132cdc[_0xf1b4('0x59')]['id']}})[_0xf1b4('0x20')](handleEntityNotFound(_0x4f7585,null))[_0xf1b4('0x20')](function(_0x3ca1a8){if(_0x3ca1a8){return db[_0xf1b4('0xa3')][_0xf1b4('0xa4')](function(_0x36cdc1){return db[_0xf1b4('0xa5')][_0xf1b4('0x32')]({'where':{'OpenchannelAccountId':_0x132cdc[_0xf1b4('0x59')]['id']},'transaction':_0x36cdc1})[_0xf1b4('0x20')](function(_0x1c3df4){var _0x356b43=_[_0xf1b4('0x3f')](_0x132cdc['body'],function(_0x259bef){_0x259bef[_0xf1b4('0x69')]=_0x132cdc[_0xf1b4('0x59')]['id'];return _0x259bef;});return db[_0xf1b4('0xa5')][_0xf1b4('0xa6')](_0x356b43,{'transaction':_0x36cdc1});});})[_0xf1b4('0x20')](function(){return db[_0xf1b4('0xa5')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x132cdc['params']['id']},'order':'priority'});});}})[_0xf1b4('0x20')](respondWithResult(_0x4f7585,null))[_0xf1b4('0x2a')](handleError(_0x4f7585,null));};exports['getApplications']=function(_0x21179b,_0x338ac1,_0x139198){var _0xb6fa3a={};var _0x5363da={};var _0x757a27;var _0xe383cd;return db[_0xf1b4('0x3b')]['findOne']({'where':{'id':_0x21179b[_0xf1b4('0x59')]['id']}})[_0xf1b4('0x20')](handleEntityNotFound(_0x338ac1,null))['then'](function(_0x29e019){if(_0x29e019){_0x757a27=_0x29e019;_0x5363da[_0xf1b4('0x45')]=_[_0xf1b4('0x41')](db[_0xf1b4('0xa5')][_0xf1b4('0x3c')]);_0x5363da[_0xf1b4('0x40')]=_[_0xf1b4('0x41')](_0x21179b[_0xf1b4('0x40')]);_0x5363da[_0xf1b4('0x42')]=_['intersection'](_0x5363da[_0xf1b4('0x45')],_0x5363da[_0xf1b4('0x40')]);_0xb6fa3a[_0xf1b4('0x44')]=_[_0xf1b4('0x43')](_0x5363da[_0xf1b4('0x45')],qs['fields'](_0x21179b[_0xf1b4('0x40')]['fields']));_0xb6fa3a['attributes']=_0xb6fa3a[_0xf1b4('0x44')]['length']?_0xb6fa3a[_0xf1b4('0x44')]:_0x5363da[_0xf1b4('0x45')];_0xb6fa3a[_0xf1b4('0x4a')]=qs[_0xf1b4('0x4b')](_0x21179b[_0xf1b4('0x40')][_0xf1b4('0x4b')]);_0xb6fa3a[_0xf1b4('0x4c')]=qs[_0xf1b4('0x42')](_[_0xf1b4('0x4d')](_0x21179b[_0xf1b4('0x40')],_0x5363da['filters']));if(_0x21179b[_0xf1b4('0x40')][_0xf1b4('0x4e')]){_0xb6fa3a[_0xf1b4('0x4c')]=_[_0xf1b4('0x4f')](_0xb6fa3a[_0xf1b4('0x4c')],{'$or':_[_0xf1b4('0x3f')](_0xb6fa3a['attributes'],function(_0x1a72b4){var _0x5131f1={};_0x5131f1[_0x1a72b4]={'$like':'%'+_0x21179b[_0xf1b4('0x40')][_0xf1b4('0x4e')]+'%'};return _0x5131f1;})});}_0xb6fa3a=_[_0xf1b4('0x4f')]({},_0xb6fa3a,_0x21179b[_0xf1b4('0x52')]);return _0x757a27[_0xf1b4('0xa7')](_0xb6fa3a);}})[_0xf1b4('0x20')](function(_0x12950a){if(_0x12950a){_0xe383cd=_0x12950a[_0xf1b4('0x5a')];if(!_0x21179b[_0xf1b4('0x40')][_0xf1b4('0x47')](_0xf1b4('0x48'))){_0xb6fa3a[_0xf1b4('0x49')]=qs[_0xf1b4('0x49')](_0x21179b[_0xf1b4('0x40')][_0xf1b4('0x49')]);_0xb6fa3a[_0xf1b4('0x2d')]=qs[_0xf1b4('0x2d')](_0x21179b[_0xf1b4('0x40')][_0xf1b4('0x2d')]);}return _0x757a27[_0xf1b4('0xa7')](_0xb6fa3a);}})[_0xf1b4('0x20')](function(_0x440e1b){if(_0x440e1b){return _0x440e1b?{'count':_0xe383cd,'rows':_0x440e1b}:null;}})[_0xf1b4('0x20')](respondWithResult(_0x338ac1,null))[_0xf1b4('0x2a')](handleError(_0x338ac1,null));};exports[_0xf1b4('0xa8')]=function(_0x1bd6d3,_0x3b08ee,_0x65417e){var _0x3267fc={'raw':![],'where':{}};var _0xde697e={};var _0x2691e3={'count':0x0,'rows':[]};return db[_0xf1b4('0x3b')][_0xf1b4('0x6e')]({'where':{'id':_0x1bd6d3[_0xf1b4('0x59')]['id']}})['then'](handleEntityNotFound(_0x3b08ee,null))[_0xf1b4('0x20')](function(_0x1e2fd6){if(_0x1e2fd6){_0xde697e[_0xf1b4('0x45')]=_[_0xf1b4('0x41')](db[_0xf1b4('0x8b')][_0xf1b4('0x3c')]);_0xde697e[_0xf1b4('0x40')]=_[_0xf1b4('0x41')](_0x1bd6d3['query']);_0xde697e[_0xf1b4('0x42')]=_[_0xf1b4('0x43')](_0xde697e[_0xf1b4('0x45')],_0xde697e[_0xf1b4('0x40')]);_0x3267fc[_0xf1b4('0x44')]=_['intersection'](_0xde697e['model'],qs[_0xf1b4('0x46')](_0x1bd6d3[_0xf1b4('0x40')][_0xf1b4('0x46')]));_0x3267fc[_0xf1b4('0x44')]=_0x3267fc[_0xf1b4('0x44')][_0xf1b4('0x5a')]?_0x3267fc[_0xf1b4('0x44')]:_0xde697e[_0xf1b4('0x45')];if(!_0x1bd6d3['query'][_0xf1b4('0x47')](_0xf1b4('0x48'))){_0x3267fc[_0xf1b4('0x49')]=qs[_0xf1b4('0x49')](_0x1bd6d3[_0xf1b4('0x40')]['limit']);_0x3267fc[_0xf1b4('0x2d')]=qs[_0xf1b4('0x2d')](_0x1bd6d3[_0xf1b4('0x40')][_0xf1b4('0x2d')]);}_0x3267fc['order']=qs[_0xf1b4('0x4b')](_0x1bd6d3[_0xf1b4('0x40')][_0xf1b4('0x4b')]);_0x3267fc[_0xf1b4('0x4c')]=qs['filters'](_[_0xf1b4('0x4d')](_0x1bd6d3[_0xf1b4('0x40')],_0xde697e['filters']));_0x3267fc[_0xf1b4('0x4c')][_0xf1b4('0x69')]=_0x1e2fd6['id'];if(_0x1bd6d3[_0xf1b4('0x40')]['filter']){_0x3267fc['where']=_['merge'](_0x3267fc['where'],{'$or':_[_0xf1b4('0x3f')](_0x3267fc['attributes'],function(_0x3827f4){var _0x4313b7={};_0x4313b7[_0x3827f4]={'$like':'%'+_0x1bd6d3[_0xf1b4('0x40')][_0xf1b4('0x4e')]+'%'};return _0x4313b7;})});}_0x3267fc=_[_0xf1b4('0x4f')]({},_0x3267fc,_0x1bd6d3['options']);return db[_0xf1b4('0x8b')][_0xf1b4('0x53')]({'where':_0x3267fc[_0xf1b4('0x4c')]})['then'](function(_0x1af78a){_0x2691e3[_0xf1b4('0x53')]=_0x1af78a;if(_0x1bd6d3[_0xf1b4('0x40')][_0xf1b4('0x54')]){_0x3267fc[_0xf1b4('0x55')]=[{'model':db['CmContact'],'as':_0xf1b4('0xa9'),'required':![]},{'model':db[_0xf1b4('0x99')],'as':_0xf1b4('0xaa'),'attributes':[_0xf1b4('0x37'),'fullname',_0xf1b4('0xab')],'required':![]},{'model':db[_0xf1b4('0xac')],'as':_0xf1b4('0xad'),'attributes':['id',_0xf1b4('0x37'),_0xf1b4('0xae')],'where':_0x1bd6d3[_0xf1b4('0x40')][_0xf1b4('0xaf')]?{'id':_0x1bd6d3[_0xf1b4('0x40')][_0xf1b4('0xaf')]}:undefined,'required':_0x1bd6d3['query'][_0xf1b4('0xaf')]?!![]:![]}];}return db[_0xf1b4('0x8b')][_0xf1b4('0x56')](_0x3267fc);})[_0xf1b4('0x20')](function(_0x53a5fa){_0x2691e3[_0xf1b4('0x57')]=_0x53a5fa;return _0x2691e3;});}})['then'](respondWithFilteredResult(_0x3b08ee,_0x3267fc))[_0xf1b4('0x2a')](handleError(_0x3b08ee,null));};exports[_0xf1b4('0xb0')]=function(_0x5c9901,_0x536989,_0x4651c1){return db[_0xf1b4('0x3b')]['find']({'where':{'id':_0x5c9901[_0xf1b4('0x59')]['id']}})['then'](handleEntityNotFound(_0x536989,null))[_0xf1b4('0x20')](function(_0x57a592){if(_0x57a592){return _0x57a592[_0xf1b4('0xb0')](_0x5c9901['body'][_0xf1b4('0x6b')],_[_0xf1b4('0xb1')](_0x5c9901[_0xf1b4('0x5d')],[_0xf1b4('0x6b'),'id'])||{})[_0xf1b4('0x8c')](function(_0x21fe27){for(var _0x2db8fa=0x0;_0x2db8fa<_0x5c9901[_0xf1b4('0x5d')]['ids'][_0xf1b4('0x5a')];_0x2db8fa+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':_0x5c9901['body'][_0xf1b4('0x6b')][_0x2db8fa],'OpenchannelAccountId':_0x5c9901[_0xf1b4('0x59')]['id']});}return _0x21fe27;});}})[_0xf1b4('0x20')](respondWithResult(_0x536989,null))[_0xf1b4('0x2a')](handleError(_0x536989,null));};exports[_0xf1b4('0xb2')]=function(_0x24e6d6,_0x13c9d9,_0x47f117){return db['OpenchannelAccount']['find']({'where':{'id':_0x24e6d6[_0xf1b4('0x59')]['id']}})[_0xf1b4('0x20')](handleEntityNotFound(_0x13c9d9,null))[_0xf1b4('0x20')](function(_0x2d5835){if(_0x2d5835){return _0x2d5835[_0xf1b4('0xb2')](_0x24e6d6[_0xf1b4('0x40')][_0xf1b4('0x6b')])[_0xf1b4('0x20')](function(){if(_[_0xf1b4('0xb3')](_0x24e6d6['query']['ids'])){for(var _0x372c2c=0x0;_0x372c2c<_0x24e6d6['query'][_0xf1b4('0x6b')][_0xf1b4('0x5a')];_0x372c2c+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x24e6d6[_0xf1b4('0x40')][_0xf1b4('0x6b')][_0x372c2c]),'OpenchannelAccountId':Number(_0x24e6d6['params']['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x24e6d6[_0xf1b4('0x40')]['ids']),'OpenchannelAccountId':Number(_0x24e6d6[_0xf1b4('0x59')]['id'])});}});}})[_0xf1b4('0x20')](respondWithStatusCode(_0x13c9d9,null))[_0xf1b4('0x2a')](handleError(_0x13c9d9,null));};exports[_0xf1b4('0xb4')]=function(_0x5affe7,_0x3d3343,_0x453781){var _0x27a3be={};var _0x5a82ba={};var _0x1f9df3;var _0xcac601;return db['OpenchannelAccount'][_0xf1b4('0x6e')]({'where':{'id':_0x5affe7[_0xf1b4('0x59')]['id']}})[_0xf1b4('0x20')](handleEntityNotFound(_0x3d3343,null))[_0xf1b4('0x20')](function(_0x59b955){if(_0x59b955){_0x1f9df3=_0x59b955;_0x5a82ba['model']=_[_0xf1b4('0x41')](db[_0xf1b4('0x99')]['rawAttributes']);_0x5a82ba[_0xf1b4('0x40')]=_[_0xf1b4('0x41')](_0x5affe7[_0xf1b4('0x40')]);_0x5a82ba[_0xf1b4('0x42')]=_['intersection'](_0x5a82ba['model'],_0x5a82ba['query']);_0x27a3be[_0xf1b4('0x44')]=_[_0xf1b4('0x43')](_0x5a82ba[_0xf1b4('0x45')],qs[_0xf1b4('0x46')](_0x5affe7[_0xf1b4('0x40')]['fields']));_0x27a3be[_0xf1b4('0x44')]=_0x27a3be[_0xf1b4('0x44')][_0xf1b4('0x5a')]?_0x27a3be[_0xf1b4('0x44')]:_0x5a82ba[_0xf1b4('0x45')];_0x27a3be[_0xf1b4('0x4a')]=qs['sort'](_0x5affe7[_0xf1b4('0x40')][_0xf1b4('0x4b')]);_0x27a3be[_0xf1b4('0x4c')]=qs[_0xf1b4('0x42')](_[_0xf1b4('0x4d')](_0x5affe7['query'],_0x5a82ba[_0xf1b4('0x42')]));if(_0x5affe7[_0xf1b4('0x40')]['filter']){_0x27a3be[_0xf1b4('0x4c')]=_['merge'](_0x27a3be[_0xf1b4('0x4c')],{'$or':_[_0xf1b4('0x3f')](_0x27a3be[_0xf1b4('0x44')],function(_0x554236){var _0x15fdfc={};_0x15fdfc[_0x554236]={'$like':'%'+_0x5affe7['query'][_0xf1b4('0x4e')]+'%'};return _0x15fdfc;})});}_0x27a3be=_['merge']({},_0x27a3be,_0x5affe7[_0xf1b4('0x52')]);return _0x1f9df3['getAgents'](_0x27a3be);}})[_0xf1b4('0x20')](function(_0x5e66f9){if(_0x5e66f9){_0xcac601=_0x5e66f9[_0xf1b4('0x5a')];if(!_0x5affe7[_0xf1b4('0x40')][_0xf1b4('0x47')](_0xf1b4('0x48'))){_0x27a3be[_0xf1b4('0x49')]=qs[_0xf1b4('0x49')](_0x5affe7[_0xf1b4('0x40')]['limit']);_0x27a3be[_0xf1b4('0x2d')]=qs['offset'](_0x5affe7[_0xf1b4('0x40')][_0xf1b4('0x2d')]);}return _0x1f9df3[_0xf1b4('0xb4')](_0x27a3be);}})[_0xf1b4('0x20')](function(_0x1045e8){if(_0x1045e8){return _0x1045e8?{'count':_0xcac601,'rows':_0x1045e8}:null;}})[_0xf1b4('0x20')](respondWithResult(_0x3d3343,null))[_0xf1b4('0x2a')](handleError(_0x3d3343,null));};exports[_0xf1b4('0xb5')]=function(_0x9f43c3,_0x256f91,_0x4ae317){var _0x473719,_0x178334,_0x265011;if(_[_0xf1b4('0x77')](_0x9f43c3[_0xf1b4('0x5d')][_0xf1b4('0x5d')])||_0x9f43c3[_0xf1b4('0x5d')][_0xf1b4('0x5d')]===''){throw new db[(_0xf1b4('0x1d'))][(_0xf1b4('0x71'))](_0xf1b4('0x78'));}if(_[_0xf1b4('0x77')](_0x9f43c3[_0xf1b4('0x5d')]['to'])){}_0x473719=_0x9f43c3[_0xf1b4('0x5d')]['to'];return db[_0xf1b4('0x3b')][_0xf1b4('0x6e')]({'where':{'id':_0x9f43c3[_0xf1b4('0x59')]['id']}})[_0xf1b4('0x20')](handleEntityNotFound(_0x256f91,null))[_0xf1b4('0x20')](function(_0x500401){if(_0x500401){return db[_0xf1b4('0x3b')]['find']({'where':{'id':_0x500401['id']},'include':[{'model':db[_0xf1b4('0x7c')],'as':_0xf1b4('0x7d'),'include':[{'model':db[_0xf1b4('0x89')],'as':_0xf1b4('0x7e'),'where':{[_0x500401[_0xf1b4('0x79')]]:_0x473719},'limit':0x1,'order':[['updatedAt',_0xf1b4('0x7f')]]}]}]})[_0xf1b4('0x20')](handleEntityNotFound(_0x256f91,null))['then'](function(_0x96dd6a){if(_0x96dd6a&&_0x96dd6a[_0xf1b4('0x7d')]){_0x178334=_0x96dd6a['get']({'plain':!![]});if(_0x178334[_0xf1b4('0x7d')]&&_0x178334[_0xf1b4('0x7d')][_0xf1b4('0x7e')][_0xf1b4('0x5a')]){return _0x178334[_0xf1b4('0x7d')][_0xf1b4('0x7e')][0x0];}return db[_0xf1b4('0x89')][_0xf1b4('0x5c')](_[_0xf1b4('0x87')](_0x9f43c3[_0xf1b4('0x5d')],{'firstName':_0x473719,[_0x96dd6a[_0xf1b4('0x79')]]:_0x473719,'phone':_0x473719,'ListId':_0x178334['ListId']}));}})[_0xf1b4('0x20')](handleEntityNotFound(_0x256f91,null))[_0xf1b4('0x20')](function(_0x510d43){if(_0x510d43){_0x265011=_0x510d43;return db[_0xf1b4('0x8b')][_0xf1b4('0x5b')]({'where':{'ContactId':_0x265011['id'],'closed':![],'OpenchannelAccountId':_0x178334['id']}})[_0xf1b4('0x20')](function(_0x5150e4){if(_0x5150e4){return[_0x5150e4,![]];}return db['OpenchannelInteraction'][_0xf1b4('0x5c')]({'UserId':_0x9f43c3[_0xf1b4('0x5e')]['id'],'ContactId':_0x265011['id'],'OpenchannelAccountId':_0x178334['id'],'lastMsgDirection':_0xf1b4('0xb6'),'Messages':[_['merge'](_0x9f43c3[_0xf1b4('0x5d')],{'read':![],'body':_0x9f43c3[_0xf1b4('0x5d')][_0xf1b4('0x5d')],'OpenchannelAccountId':_0x178334['id'],'UserId':_0x9f43c3[_0xf1b4('0x5e')]['id'],'ContactId':_0x265011['id']})]},{'include':[{'model':db[_0xf1b4('0x98')],'as':_0xf1b4('0xb7')}]})[_0xf1b4('0x20')](function(_0x142166){return[_0x142166,!![]];});});}})['spread'](function(_0x4df0d3,_0x374493){if(_0x374493){return _0x4df0d3;}return db['OpenchannelMessage'][_0xf1b4('0x5c')](_['merge'](_0x9f43c3['body'],{'read':![],'body':_0x9f43c3[_0xf1b4('0x5d')]['body'],'OpenchannelAccountId':_0x178334['id'],'OpenchannelInteractionId':_0x4df0d3['id'],'UserId':_0x9f43c3[_0xf1b4('0x5e')]['id'],'ContactId':_0x265011['id']}))[_0xf1b4('0x20')](function(_0x52556b){_0x4df0d3[_0xf1b4('0xb8')][_0xf1b4('0xb7')]=[];_0x4df0d3[_0xf1b4('0xb8')][_0xf1b4('0xb7')]['push'](_0x52556b[_0xf1b4('0xb8')]);return _0x4df0d3;});});}})[_0xf1b4('0x20')](respondWithResult(_0x256f91,null))['catch'](handleError(_0x256f91,null));}; \ No newline at end of file +var _0x5d03=['omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','OpenchannelMessage','Messages','dataValues','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','ValidationError','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','json','count','offset','limit','set','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','end','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','OpnechannelAccountId','Disposition','findOne','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','CmContact','Contacts','OpenchannelApplication','applications','Applications','list','asc','account','contact','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','push','unmanaged','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','EventManager','addApplications','sequelize','transaction','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','addAgents'];(function(_0x5a836f,_0x148be9){var _0x15effb=function(_0x265385){while(--_0x265385){_0x5a836f['push'](_0x5a836f['shift']());}};_0x15effb(++_0x148be9);}(_0x5d03,0x186));var _0x35d0=function(_0x348747,_0x399582){_0x348747=_0x348747-0x0;var _0xd5dd81=_0x5d03[_0x348747];return _0xd5dd81;};'use strict';var pdf=require(_0x35d0('0x0'));var emlformat=require(_0x35d0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35d0('0x3'));var moment=require(_0x35d0('0x4'));var BPromise=require(_0x35d0('0x5'));var Mustache=require(_0x35d0('0x6'));var util=require(_0x35d0('0x7'));var path=require(_0x35d0('0x8'));var sox=require(_0x35d0('0x9'));var csv=require(_0x35d0('0xa'));var ejs=require(_0x35d0('0xb'));var fs=require('fs');var _=require(_0x35d0('0xc'));var squel=require(_0x35d0('0xd'));var crypto=require(_0x35d0('0xe'));var jsforce=require(_0x35d0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x35d0('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x35d0('0x10'));var qs=require(_0x35d0('0x11'));var as=require(_0x35d0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35d0('0x13'))(_0x35d0('0x14'));var utils=require(_0x35d0('0x15'));var config=require('../../config/environment');var db=require(_0x35d0('0x16'))['db'];config[_0x35d0('0x17')]=_[_0x35d0('0x18')](config[_0x35d0('0x17')],{'host':_0x35d0('0x19'),'port':0x18eb});var socket=require(_0x35d0('0x1a'))(new Redis(config[_0x35d0('0x17')]));require(_0x35d0('0x1b'))[_0x35d0('0x1c')](socket);var jayson=require(_0x35d0('0x1d'));var client=jayson['client'][_0x35d0('0x1e')]({'port':0x232c});var client9002=jayson[_0x35d0('0x1f')][_0x35d0('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x40006a,_0x38a896,_0x1aa04a){if(_0x1aa04a){var _0x39d5e1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x39d5e1['test'](_0x38a896)){return _0x40006a;}else{throw new db['Sequelize'][(_0x35d0('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x40006a;}}function respondWithRpcPromise(_0x179f3f,_0x395c68,_0x5d0335,_0x56a339){return new BPromise(function(_0x5db3eb,_0x77ce3){var _0xde345=_0x56a339||client;return _0xde345[_0x35d0('0x21')](_0x179f3f,_0x5d0335)[_0x35d0('0x22')](function(_0x4180d0){logger['info'](_0x35d0('0x23'),_0x395c68,_0x35d0('0x24'));logger['debug'](_0x35d0('0x25'),_0x395c68,_0x35d0('0x24'),JSON[_0x35d0('0x26')](_0x4180d0));if(_0x4180d0[_0x35d0('0x27')]){if(_0x4180d0[_0x35d0('0x27')][_0x35d0('0x28')]===0x1f4){logger[_0x35d0('0x27')](_0x35d0('0x23'),_0x395c68,_0x4180d0['error']['message']);return _0x77ce3(_0x4180d0[_0x35d0('0x27')]['message']);}logger[_0x35d0('0x27')](_0x35d0('0x23'),_0x395c68,_0x4180d0['error'][_0x35d0('0x29')]);return _0x5db3eb(_0x4180d0[_0x35d0('0x27')][_0x35d0('0x29')]);}else{logger[_0x35d0('0x2a')](_0x35d0('0x23'),_0x395c68,_0x35d0('0x24'));_0x5db3eb(_0x4180d0[_0x35d0('0x2b')][_0x35d0('0x29')]);}})[_0x35d0('0x2c')](function(_0x91210b){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x395c68,_0x91210b);_0x77ce3(_0x91210b);});});}function respondWithStatusCode(_0x1e3fef,_0xdc6713){_0xdc6713=_0xdc6713||0xcc;return function(_0x4867c4){if(_0x4867c4){return _0x1e3fef['sendStatus'](_0xdc6713);}return _0x1e3fef[_0x35d0('0x2d')](_0xdc6713)['end']();};}function respondWithResult(_0x31ea7a,_0x32d5cb){_0x32d5cb=_0x32d5cb||0xc8;return function(_0x3afa14){if(_0x3afa14){return _0x31ea7a['status'](_0x32d5cb)[_0x35d0('0x2e')](_0x3afa14);}};}function respondWithFilteredResult(_0x4bf80a,_0x16620e){return function(_0x24c1d8){if(_0x24c1d8){var _0x5c8376=_0x24c1d8[_0x35d0('0x2f')],_0x1e534a=_0x16620e[_0x35d0('0x30')],_0x1322fb=_0x16620e[_0x35d0('0x30')]+_0x16620e[_0x35d0('0x31')],_0x44263b;if(_0x1322fb>=_0x5c8376){_0x1322fb=_0x5c8376;_0x44263b=0xc8;}else{_0x44263b=0xce;}_0x4bf80a[_0x35d0('0x2d')](_0x44263b);return _0x4bf80a[_0x35d0('0x32')]('Content-Range',_0x1e534a+'-'+_0x1322fb+'/'+_0x5c8376)[_0x35d0('0x2e')](_0x24c1d8);}return null;};}function patchUpdates(_0x472435){return function(_0xa488d4){try{jsonpatch[_0x35d0('0x33')](_0xa488d4,_0x472435,!![]);}catch(_0x522f24){return BPromise[_0x35d0('0x34')](_0x522f24);}return _0xa488d4[_0x35d0('0x35')]();};}function saveUpdates(_0x4d051b,_0x29741b){return function(_0x3ce5bf){if(_0x3ce5bf){return _0x3ce5bf[_0x35d0('0x36')](_0x4d051b)['then'](function(_0x1da007){return _0x1da007;});}return null;};}function removeEntity(_0x558824,_0x56c05c){return function(_0x441d78){if(_0x441d78){return _0x441d78[_0x35d0('0x37')]()[_0x35d0('0x22')](function(){var _0x4b8661=_0x441d78[_0x35d0('0x38')]({'plain':!![]});var _0x581f34=_0x35d0('0x39');return db[_0x35d0('0x3a')]['destroy']({'where':{'type':_0x581f34,'resourceId':_0x4b8661['id']}})[_0x35d0('0x22')](function(){return _0x441d78;});})[_0x35d0('0x22')](function(){_0x558824[_0x35d0('0x2d')](0xcc)[_0x35d0('0x3b')]();});}};}function handleEntityNotFound(_0x8b2ff1,_0x355a2a){return function(_0x49ba37){if(!_0x49ba37){_0x8b2ff1[_0x35d0('0x3c')](0x194);}return _0x49ba37;};}function handleError(_0x22bf59,_0x512c9b){_0x512c9b=_0x512c9b||0x1f4;return function(_0x2be70f){logger['error'](_0x2be70f[_0x35d0('0x3d')]);if(_0x2be70f[_0x35d0('0x3e')]){delete _0x2be70f[_0x35d0('0x3e')];}_0x22bf59[_0x35d0('0x2d')](_0x512c9b)['send'](_0x2be70f);};}exports[_0x35d0('0x3f')]=function(_0x336639,_0x2a261c){var _0x28397e={'include':[{'model':db[_0x35d0('0x40')],'as':_0x35d0('0x41')}]},_0x51e5c2={},_0x5f13e9={'count':0x0,'rows':[]};var _0x530930=_[_0x35d0('0x42')](db[_0x35d0('0x43')][_0x35d0('0x44')],function(_0x38bb7b){return{'name':_0x38bb7b['fieldName'],'type':_0x38bb7b[_0x35d0('0x45')][_0x35d0('0x46')]};});_0x51e5c2[_0x35d0('0x47')]=_[_0x35d0('0x42')](_0x530930,_0x35d0('0x3e'));_0x51e5c2['query']=_[_0x35d0('0x48')](_0x336639[_0x35d0('0x49')]);_0x51e5c2[_0x35d0('0x4a')]=_[_0x35d0('0x4b')](_0x51e5c2[_0x35d0('0x47')],_0x51e5c2[_0x35d0('0x49')]);_0x28397e[_0x35d0('0x4c')]=_[_0x35d0('0x4b')](_0x51e5c2[_0x35d0('0x47')],qs['fields'](_0x336639[_0x35d0('0x49')]['fields']));_0x28397e['attributes']=_0x28397e['attributes'][_0x35d0('0x4d')]?_0x28397e[_0x35d0('0x4c')]:_0x51e5c2[_0x35d0('0x47')];if(!_0x336639[_0x35d0('0x49')][_0x35d0('0x4e')](_0x35d0('0x4f'))){_0x28397e[_0x35d0('0x31')]=qs['limit'](_0x336639['query'][_0x35d0('0x31')]);_0x28397e[_0x35d0('0x30')]=qs[_0x35d0('0x30')](_0x336639[_0x35d0('0x49')][_0x35d0('0x30')]);}_0x28397e[_0x35d0('0x50')]=qs[_0x35d0('0x51')](_0x336639[_0x35d0('0x49')][_0x35d0('0x51')]);_0x28397e[_0x35d0('0x52')]=qs[_0x35d0('0x4a')](_[_0x35d0('0x53')](_0x336639['query'],_0x51e5c2[_0x35d0('0x4a')]),_0x530930);if(_0x336639[_0x35d0('0x49')][_0x35d0('0x54')]){_0x28397e['where']=_['merge'](_0x28397e['where'],{'$or':_[_0x35d0('0x42')](_0x530930,function(_0x279652){if(_0x279652[_0x35d0('0x45')]!==_0x35d0('0x55')){var _0x1ff12d={};_0x1ff12d[_0x279652[_0x35d0('0x3e')]]={'$like':'%'+_0x336639[_0x35d0('0x49')]['filter']+'%'};return _0x1ff12d;}})});}_0x28397e=_[_0x35d0('0x56')]({},_0x28397e,_0x336639[_0x35d0('0x57')]);var _0x3db62e={'where':_0x28397e['where']};return db[_0x35d0('0x43')][_0x35d0('0x2f')](_0x3db62e)[_0x35d0('0x22')](function(_0x4beb58){_0x5f13e9[_0x35d0('0x2f')]=_0x4beb58;if(_0x336639[_0x35d0('0x49')][_0x35d0('0x58')]){_0x28397e[_0x35d0('0x59')]=[{'all':!![]}];}return db[_0x35d0('0x43')][_0x35d0('0x5a')](_0x28397e);})[_0x35d0('0x22')](function(_0x5ac4a4){_0x5f13e9[_0x35d0('0x5b')]=_0x5ac4a4;return _0x5f13e9;})[_0x35d0('0x22')](respondWithFilteredResult(_0x2a261c,_0x28397e))['catch'](handleError(_0x2a261c,null));};exports['show']=function(_0x5a95bd,_0x46afb8){var _0x43e4d2={'raw':![],'where':{'id':_0x5a95bd[_0x35d0('0x5c')]['id']},'include':[{'model':db[_0x35d0('0x40')],'as':_0x35d0('0x41')}]},_0x3d11bd={};_0x3d11bd[_0x35d0('0x47')]=_['keys'](db[_0x35d0('0x43')][_0x35d0('0x44')]);_0x3d11bd[_0x35d0('0x49')]=_[_0x35d0('0x48')](_0x5a95bd[_0x35d0('0x49')]);_0x3d11bd['filters']=_[_0x35d0('0x4b')](_0x3d11bd[_0x35d0('0x47')],_0x3d11bd[_0x35d0('0x49')]);_0x43e4d2[_0x35d0('0x4c')]=_[_0x35d0('0x4b')](_0x3d11bd[_0x35d0('0x47')],qs['fields'](_0x5a95bd[_0x35d0('0x49')][_0x35d0('0x5d')]));_0x43e4d2['attributes']=_0x43e4d2[_0x35d0('0x4c')]['length']?_0x43e4d2[_0x35d0('0x4c')]:_0x3d11bd[_0x35d0('0x47')];if(_0x5a95bd['query'][_0x35d0('0x58')]){_0x43e4d2[_0x35d0('0x59')]=[{'all':!![]}];}_0x43e4d2=_['merge']({},_0x43e4d2,_0x5a95bd['options']);return db[_0x35d0('0x43')]['find'](_0x43e4d2)[_0x35d0('0x22')](handleEntityNotFound(_0x46afb8,null))[_0x35d0('0x22')](respondWithResult(_0x46afb8,null))['catch'](handleError(_0x46afb8,null));};exports[_0x35d0('0x5e')]=function(_0x483850,_0x540be6){return db[_0x35d0('0x43')][_0x35d0('0x5e')](_0x483850[_0x35d0('0x5f')],{})['then'](function(_0x21d9d0){var _0x369ae6=_0x483850[_0x35d0('0x60')]['get']({'plain':!![]});if(!_0x369ae6)throw new Error(_0x35d0('0x61'));if(_0x369ae6[_0x35d0('0x62')]===_0x35d0('0x60')){var _0x4026d2=_0x21d9d0[_0x35d0('0x38')]({'plain':!![]});var _0x487eb9='OpenchannelAccounts';return db[_0x35d0('0x63')]['find']({'where':{'name':_0x487eb9,'userProfileId':_0x369ae6['userProfileId']},'raw':!![]})[_0x35d0('0x22')](function(_0x7c51f7){if(_0x7c51f7&&_0x7c51f7[_0x35d0('0x64')]===0x0){return db['UserProfileResource'][_0x35d0('0x5e')]({'name':_0x4026d2[_0x35d0('0x3e')],'resourceId':_0x4026d2['id'],'type':_0x7c51f7['name'],'sectionId':_0x7c51f7['id']},{})[_0x35d0('0x22')](function(){return _0x21d9d0;});}else{return _0x21d9d0;}})[_0x35d0('0x2c')](function(_0x27e34f){logger[_0x35d0('0x27')](_0x35d0('0x65'),_0x27e34f);throw _0x27e34f;});}return _0x21d9d0;})[_0x35d0('0x22')](respondWithResult(_0x540be6,0xc9))[_0x35d0('0x2c')](handleError(_0x540be6,null));};exports[_0x35d0('0x36')]=function(_0x268e17,_0x27b9be){if(_0x268e17['body']['id']){delete _0x268e17[_0x35d0('0x5f')]['id'];}return db[_0x35d0('0x43')]['find']({'where':{'id':_0x268e17['params']['id']},'include':[{'model':db[_0x35d0('0x40')],'as':_0x35d0('0x41')}]})['then'](handleEntityNotFound(_0x27b9be,null))[_0x35d0('0x22')](saveUpdates(_0x268e17[_0x35d0('0x5f')],null))[_0x35d0('0x22')](respondWithResult(_0x27b9be,null))[_0x35d0('0x2c')](handleError(_0x27b9be,null));};exports[_0x35d0('0x37')]=function(_0x362f93,_0x2a89d0){return db[_0x35d0('0x43')][_0x35d0('0x66')]({'where':{'id':_0x362f93[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x2a89d0,null))[_0x35d0('0x22')](removeEntity(_0x2a89d0,null))[_0x35d0('0x2c')](handleError(_0x2a89d0,null));};exports['describe']=function(_0x5736f7,_0x40a045){return db[_0x35d0('0x43')][_0x35d0('0x67')]()[_0x35d0('0x22')](respondWithResult(_0x40a045,null))['catch'](handleError(_0x40a045,null));};exports[_0x35d0('0x68')]=function(_0x38a82e,_0xa1cd5a,_0x386731){if(_0x38a82e['body']['id']){delete _0x38a82e[_0x35d0('0x5f')]['id'];}return db[_0x35d0('0x43')][_0x35d0('0x66')]({'where':{'id':_0x38a82e[_0x35d0('0x5c')]['id']}})['then'](handleEntityNotFound(_0xa1cd5a,null))[_0x35d0('0x22')](function(_0x41b611){if(_0x41b611){_0x38a82e['body'][_0x35d0('0x69')]=_0x41b611['id'];return db[_0x35d0('0x6a')][_0x35d0('0x5e')](_0x38a82e['body']);}})[_0x35d0('0x22')](respondWithResult(_0xa1cd5a,null))[_0x35d0('0x2c')](handleError(_0xa1cd5a,null));};exports['getDispositions']=function(_0x14f329,_0x38e2de,_0x4f101c){var _0x75647a={'raw':![],'where':{}};var _0x417794={};var _0x3bf0c3={'count':0x0,'rows':[]};return db[_0x35d0('0x43')][_0x35d0('0x6b')]({'where':{'id':_0x14f329['params']['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x38e2de,null))[_0x35d0('0x22')](function(_0x432586){if(_0x432586){_0x417794[_0x35d0('0x47')]=_[_0x35d0('0x48')](db[_0x35d0('0x6a')][_0x35d0('0x44')]);_0x417794[_0x35d0('0x49')]=_['keys'](_0x14f329['query']);_0x417794[_0x35d0('0x4a')]=_[_0x35d0('0x4b')](_0x417794[_0x35d0('0x47')],_0x417794['query']);_0x75647a[_0x35d0('0x4c')]=_[_0x35d0('0x4b')](_0x417794[_0x35d0('0x47')],qs[_0x35d0('0x5d')](_0x14f329[_0x35d0('0x49')][_0x35d0('0x5d')]));_0x75647a[_0x35d0('0x4c')]=_0x75647a[_0x35d0('0x4c')][_0x35d0('0x4d')]?_0x75647a[_0x35d0('0x4c')]:_0x417794[_0x35d0('0x47')];if(!_0x14f329[_0x35d0('0x49')]['hasOwnProperty'](_0x35d0('0x4f'))){_0x75647a[_0x35d0('0x31')]=qs[_0x35d0('0x31')](_0x14f329[_0x35d0('0x49')]['limit']);_0x75647a[_0x35d0('0x30')]=qs['offset'](_0x14f329[_0x35d0('0x49')][_0x35d0('0x30')]);}_0x75647a['order']=qs['sort'](_0x14f329['query'][_0x35d0('0x51')]);_0x75647a['where']=qs['filters'](_[_0x35d0('0x53')](_0x14f329[_0x35d0('0x49')],_0x417794[_0x35d0('0x4a')]));_0x75647a[_0x35d0('0x52')][_0x35d0('0x6c')]=_0x432586['id'];if(_0x14f329[_0x35d0('0x49')][_0x35d0('0x54')]){_0x75647a[_0x35d0('0x52')]=_[_0x35d0('0x56')](_0x75647a[_0x35d0('0x52')],{'$or':_[_0x35d0('0x42')](_0x75647a[_0x35d0('0x4c')],function(_0x49c68e){var _0x34c128={};_0x34c128[_0x49c68e]={'$like':'%'+_0x14f329[_0x35d0('0x49')]['filter']+'%'};return _0x34c128;})});}_0x75647a=_['merge']({},_0x75647a,_0x14f329['options']);return db[_0x35d0('0x6a')][_0x35d0('0x2f')]({'where':_0x75647a[_0x35d0('0x52')]})[_0x35d0('0x22')](function(_0xe4ad6a){_0x3bf0c3[_0x35d0('0x2f')]=_0xe4ad6a;if(_0x14f329[_0x35d0('0x49')][_0x35d0('0x58')]){_0x75647a[_0x35d0('0x59')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x75647a);})[_0x35d0('0x22')](function(_0x344bcc){_0x3bf0c3[_0x35d0('0x5b')]=_0x344bcc;return _0x3bf0c3;});}})[_0x35d0('0x22')](respondWithFilteredResult(_0x38e2de,_0x75647a))['catch'](handleError(_0x38e2de,null));};exports[_0x35d0('0x6d')]=function(_0x36f103,_0x3bc9ee,_0x1ce800){return db[_0x35d0('0x43')][_0x35d0('0x66')]({'where':{'id':_0x36f103[_0x35d0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3bc9ee,null))[_0x35d0('0x22')](function(_0x3e6c74){if(_0x3e6c74){return _0x3e6c74['removeDispositions'](_0x36f103[_0x35d0('0x49')][_0x35d0('0x6e')]);}})['then'](respondWithStatusCode(_0x3bc9ee,null))[_0x35d0('0x2c')](handleError(_0x3bc9ee,null));};exports[_0x35d0('0x6f')]=function(_0x2213f4,_0x39bf3a,_0x64e903){if(_0x2213f4[_0x35d0('0x5f')]['id']){delete _0x2213f4[_0x35d0('0x5f')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x2213f4[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x39bf3a,null))[_0x35d0('0x22')](function(_0x12950){if(_0x12950){_0x2213f4[_0x35d0('0x5f')]['OpenchannelAccountId']=_0x12950['id'];return db[_0x35d0('0x70')][_0x35d0('0x5e')](_0x2213f4[_0x35d0('0x5f')]);}})['then'](respondWithResult(_0x39bf3a,null))[_0x35d0('0x2c')](handleError(_0x39bf3a,null));};exports[_0x35d0('0x71')]=function(_0x90067f,_0x7a17dd,_0x206b53){var _0x1f306b={'raw':![],'where':{}};var _0x2f5066={};var _0x2ccc25={'count':0x0,'rows':[]};return db[_0x35d0('0x43')][_0x35d0('0x6b')]({'where':{'id':_0x90067f['params']['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x7a17dd,null))[_0x35d0('0x22')](function(_0x3056e2){if(_0x3056e2){_0x2f5066['model']=_['keys'](db[_0x35d0('0x70')]['rawAttributes']);_0x2f5066['query']=_[_0x35d0('0x48')](_0x90067f['query']);_0x2f5066[_0x35d0('0x4a')]=_[_0x35d0('0x4b')](_0x2f5066[_0x35d0('0x47')],_0x2f5066[_0x35d0('0x49')]);_0x1f306b[_0x35d0('0x4c')]=_[_0x35d0('0x4b')](_0x2f5066[_0x35d0('0x47')],qs['fields'](_0x90067f[_0x35d0('0x49')][_0x35d0('0x5d')]));_0x1f306b[_0x35d0('0x4c')]=_0x1f306b[_0x35d0('0x4c')]['length']?_0x1f306b[_0x35d0('0x4c')]:_0x2f5066[_0x35d0('0x47')];if(!_0x90067f[_0x35d0('0x49')][_0x35d0('0x4e')](_0x35d0('0x4f'))){_0x1f306b['limit']=qs[_0x35d0('0x31')](_0x90067f[_0x35d0('0x49')][_0x35d0('0x31')]);_0x1f306b[_0x35d0('0x30')]=qs[_0x35d0('0x30')](_0x90067f[_0x35d0('0x49')]['offset']);}_0x1f306b[_0x35d0('0x50')]=qs[_0x35d0('0x51')](_0x90067f[_0x35d0('0x49')][_0x35d0('0x51')]);_0x1f306b['where']=qs[_0x35d0('0x4a')](_[_0x35d0('0x53')](_0x90067f[_0x35d0('0x49')],_0x2f5066[_0x35d0('0x4a')]));_0x1f306b[_0x35d0('0x52')][_0x35d0('0x6c')]=_0x3056e2['id'];if(_0x90067f[_0x35d0('0x49')][_0x35d0('0x54')]){_0x1f306b[_0x35d0('0x52')]=_[_0x35d0('0x56')](_0x1f306b[_0x35d0('0x52')],{'$or':_[_0x35d0('0x42')](_0x1f306b[_0x35d0('0x4c')],function(_0x521ff5){var _0x401775={};_0x401775[_0x521ff5]={'$like':'%'+_0x90067f[_0x35d0('0x49')]['filter']+'%'};return _0x401775;})});}_0x1f306b=_[_0x35d0('0x56')]({},_0x1f306b,_0x90067f['options']);return db['CannedAnswer']['count']({'where':_0x1f306b['where']})[_0x35d0('0x22')](function(_0x5225d6){_0x2ccc25[_0x35d0('0x2f')]=_0x5225d6;if(_0x90067f[_0x35d0('0x49')][_0x35d0('0x58')]){_0x1f306b[_0x35d0('0x59')]=[{'all':!![]}];}return db[_0x35d0('0x70')][_0x35d0('0x5a')](_0x1f306b);})[_0x35d0('0x22')](function(_0x2b737a){_0x2ccc25['rows']=_0x2b737a;return _0x2ccc25;});}})['then'](respondWithFilteredResult(_0x7a17dd,_0x1f306b))[_0x35d0('0x2c')](handleError(_0x7a17dd,null));};exports['removeAnswers']=function(_0x4a9d30,_0x2e0d32,_0x485a2e){return db['OpenchannelAccount'][_0x35d0('0x66')]({'where':{'id':_0x4a9d30[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x2e0d32,null))[_0x35d0('0x22')](function(_0x595d71){if(_0x595d71){return _0x595d71[_0x35d0('0x72')](_0x4a9d30[_0x35d0('0x49')][_0x35d0('0x6e')]);}})[_0x35d0('0x22')](respondWithStatusCode(_0x2e0d32,null))[_0x35d0('0x2c')](handleError(_0x2e0d32,null));};exports[_0x35d0('0x73')]=function(_0x8965f9,_0x347274,_0x5b6d86){var _0xe3ce6b={'body':_0x8965f9[_0x35d0('0x5f')],'channel':_0x35d0('0x74')};var _0x1db246=[];var _0x32ff1f=[];var _0x38e6a7={};var _0x1bdab5=![];return db['CmContact']['describe']()[_0x35d0('0x22')](function(_0x16914d){if(!_0x16914d){throw new db[(_0x35d0('0x75'))][(_0x35d0('0x20'))](_0x35d0('0x76'));}_0x1db246=_[_0x35d0('0x77')](_[_0x35d0('0x48')](_0x16914d),[_0x35d0('0x78'),_0x35d0('0x79')]);_0x32ff1f=_['difference'](_[_0x35d0('0x48')](_0x16914d),['createdAt',_0x35d0('0x79'),_0x35d0('0x7a'),_0x35d0('0x7b')]);if(_0x8965f9[_0x35d0('0x5f')]['id']){delete _0x8965f9[_0x35d0('0x5f')]['id'];}if(_[_0x35d0('0x7c')](_0x8965f9['body']['from'])){throw new db[(_0x35d0('0x75'))][(_0x35d0('0x20'))](_0x35d0('0x7d'));}if(_['isNil'](_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x5f')])||_0x8965f9[_0x35d0('0x5f')]['body']===''){throw new db[(_0x35d0('0x75'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x35d0('0x7c')](_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x7e')])){throw new db[(_0x35d0('0x75'))]['ValidationError'](_0x35d0('0x7f')+_0x32ff1f);}if(!_['includes'](_0x32ff1f,_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x7e')])){throw new db[(_0x35d0('0x75'))][(_0x35d0('0x20'))](_0x35d0('0x80')+_0x32ff1f);}_0x38e6a7[_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x7e')]]=_0x8965f9['body'][_0x35d0('0x81')];})['then'](function(){return db[_0x35d0('0x43')][_0x35d0('0x66')]({'where':{'id':_0x8965f9[_0x35d0('0x5c')]['id']},'include':[{'model':db[_0x35d0('0x82')],'as':_0x35d0('0x83'),'include':[{'model':db[_0x35d0('0x84')],'as':_0x35d0('0x85'),'where':_0x38e6a7,'limit':0x1,'order':[[_0x35d0('0x79'),'DESC']]}]},{'model':db[_0x35d0('0x86')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x347274,null))['then'](function(_0x41c235){if(_0x41c235&&_0x41c235[_0x35d0('0x83')]){_0xe3ce6b['account']=_0x41c235;_0xe3ce6b[_0x35d0('0x87')]=_0x41c235[_0x35d0('0x88')];_0xe3ce6b[_0x35d0('0x89')]=_0x41c235[_0x35d0('0x83')];_0xe3ce6b[_0x35d0('0x87')]=_['orderBy'](_0xe3ce6b[_0x35d0('0x87')],['priority'],[_0x35d0('0x8a')]);if(_0xe3ce6b[_0x35d0('0x8b')][_0x35d0('0x88')]){delete _0xe3ce6b['account']['Applications'];}if(_0xe3ce6b[_0x35d0('0x8b')]['List']&&_0xe3ce6b['account'][_0x35d0('0x83')][_0x35d0('0x85')][_0x35d0('0x4d')]){return _0xe3ce6b[_0x35d0('0x8b')][_0x35d0('0x83')][_0x35d0('0x85')][0x0];}var _0x2699b0=_[_0x35d0('0x18')](_0x8965f9[_0x35d0('0x5f')],{'firstName':_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x81')],'ListId':_0x41c235['ListId']});_0x2699b0[_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x7e')]]=_0x8965f9[_0x35d0('0x5f')]['from'];return db['CmContact'][_0x35d0('0x5e')](_0x2699b0,{'fields':_0x1db246,'raw':!![]});}})[_0x35d0('0x22')](handleEntityNotFound(_0x347274,null))['then'](function(_0x48f67b){_0xe3ce6b[_0x35d0('0x8c')]=_0x48f67b;if(_0x48f67b){var _0x158ed={'ContactId':_0x48f67b['id'],'OpenchannelAccountId':_0x8965f9[_0x35d0('0x5c')]['id'],'from':(_0x48f67b[_0x35d0('0x8d')]||'')+'\x20'+(_0x48f67b[_0x35d0('0x8e')]||'')};var _0x17114a={'OpenchannelAccountId':_0x8965f9['params']['id'],'closed':![]};if(_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x8f')]){_0x17114a['threadId']=_0x8965f9[_0x35d0('0x5f')]['threadId'];return db['OpenchannelInteraction'][_0x35d0('0x66')]({'where':_0x17114a})[_0x35d0('0x22')](function(_0x4506b5){if(_0x4506b5){return[_0x4506b5,![]];}_0x158ed[_0x35d0('0x8f')]=_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x8f')];_0x158ed[_0x35d0('0x90')]=_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x90')];return db['OpenchannelInteraction']['create'](_0x158ed)[_0x35d0('0x22')](function(_0x5833fc){return[_0x5833fc,!![]];});});}else{_0x17114a[_0x35d0('0x8f')]=null;}_0x17114a[_0x35d0('0x91')]=_0x48f67b['id'];return db['OpenchannelInteraction'][_0x35d0('0x66')]({'where':_0x17114a})['then'](function(_0x4022c2){if(_0x4022c2){return[_0x4022c2,![]];}return db[_0x35d0('0x92')][_0x35d0('0x5e')](_0x158ed)['then'](function(_0xf0ca0e){return[_0xf0ca0e,!![]];});});}})[_0x35d0('0x93')](function(_0x226ff9,_0x20f5c1){if(_0x226ff9){_0x1bdab5=_0x20f5c1;if(!_0x20f5c1){var _0x3d520b={'from':(_0xe3ce6b[_0x35d0('0x8c')][_0x35d0('0x8d')]||'')+'\x20'+(_0xe3ce6b[_0x35d0('0x8c')][_0x35d0('0x8e')]||'')};if(_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x8f')]&&_0x8965f9['body'][_0x35d0('0x94')]&&_0x8965f9[_0x35d0('0x5f')]['threadId']!=_0x8965f9[_0x35d0('0x5f')]['messageId']){_0x3d520b[_0x35d0('0x8f')]=_0x8965f9['body']['messageId'];}return _0x226ff9[_0x35d0('0x36')](_0x3d520b);}else{return _0x226ff9;}}})['then'](function(_0x4eaf8d){_0xe3ce6b[_0x35d0('0x95')]=_0x4eaf8d[_0x35d0('0x38')]({'plain':!![]});_0xe3ce6b[_0x35d0('0x95')][_0x35d0('0x96')]=_0x1bdab5;if(_0xe3ce6b[_0x35d0('0x95')][_0x35d0('0x96')]){if(_0xe3ce6b[_0x35d0('0x8b')][_0x35d0('0x97')]){_0xe3ce6b[_0x35d0('0x87')][_0x35d0('0x98')]({'id':0x0,'priority':_0xe3ce6b[_0x35d0('0x87')][_0x35d0('0x4d')]+0x1,'app':'close','appdata':_0x35d0('0x99'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage']['create']({'body':_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x5f')],'OpenchannelAccountId':_0x8965f9[_0x35d0('0x5c')]['id'],'OpenchannelInteractionId':_0x4eaf8d['id'],'direction':'in','ContactId':_0xe3ce6b[_0x35d0('0x8c')]['id'],'AttachmentId':_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x9a')]});})[_0x35d0('0x22')](function(_0x342819){_0xe3ce6b[_0x35d0('0x29')]=_0x342819;if(_0xe3ce6b[_0x35d0('0x95')]['UserId']){return db[_0x35d0('0x9b')][_0x35d0('0x66')]({'attributes':['id',_0x35d0('0x3e')],'where':{'id':_0xe3ce6b[_0x35d0('0x95')][_0x35d0('0x9c')]}})[_0x35d0('0x22')](function(_0x1f625e){if(_0x1f625e){_0xe3ce6b[_0x35d0('0x87')][_0x35d0('0x9d')]({'id':0x0,'priority':0x0,'app':_0x35d0('0x9e'),'appdata':_0x1f625e[_0x35d0('0x3e')]+','+(_0xe3ce6b[_0x35d0('0x8b')][_0x35d0('0x9f')]||0xa),'interval':_0x35d0('0xa0')});_0xe3ce6b[_0x35d0('0xa1')]=![];}return respondWithRpcPromise('Start','startRouting',_0xe3ce6b);});}return respondWithRpcPromise(_0x35d0('0xa2'),'startRouting',_0xe3ce6b);})[_0x35d0('0x22')](function(_0x1f8084){respondWithRpcPromise(_0x35d0('0xa3'),_0x35d0('0xa3'),{'event':_0x35d0('0x73'),'message':_0x1f8084},client9002);return _0x1f8084;})[_0x35d0('0x22')](respondWithResult(_0x347274,null))[_0x35d0('0x2c')](handleError(_0x347274,null));};exports[_0x35d0('0xa4')]=function(_0x363f40,_0x383cf7,_0x41999e){return db[_0x35d0('0x43')]['findOne']({'where':{'id':_0x363f40[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x383cf7,null))[_0x35d0('0x22')](function(_0x4c402d){if(_0x4c402d){return db[_0x35d0('0xa5')][_0x35d0('0xa6')](function(_0xe76188){return db[_0x35d0('0x86')]['destroy']({'where':{'OpenchannelAccountId':_0x363f40[_0x35d0('0x5c')]['id']},'transaction':_0xe76188})['then'](function(_0x2dd7bd){var _0x7bc622=_['map'](_0x363f40[_0x35d0('0x5f')],function(_0x3cf54e){_0x3cf54e[_0x35d0('0x6c')]=_0x363f40[_0x35d0('0x5c')]['id'];return _0x3cf54e;});return db[_0x35d0('0x86')]['bulkCreate'](_0x7bc622,{'transaction':_0xe76188});});})['then'](function(){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x363f40['params']['id']},'order':'priority'});});}})[_0x35d0('0x22')](respondWithResult(_0x383cf7,null))[_0x35d0('0x2c')](handleError(_0x383cf7,null));};exports['getApplications']=function(_0x6dbbe,_0x313c09,_0x58bafb){var _0x38aab9={};var _0x547723={};var _0x25a6fe;var _0x2ef8ec;return db[_0x35d0('0x43')][_0x35d0('0x6b')]({'where':{'id':_0x6dbbe[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x313c09,null))[_0x35d0('0x22')](function(_0x5f18cb){if(_0x5f18cb){_0x25a6fe=_0x5f18cb;_0x547723['model']=_[_0x35d0('0x48')](db[_0x35d0('0x86')][_0x35d0('0x44')]);_0x547723[_0x35d0('0x49')]=_[_0x35d0('0x48')](_0x6dbbe[_0x35d0('0x49')]);_0x547723[_0x35d0('0x4a')]=_['intersection'](_0x547723[_0x35d0('0x47')],_0x547723[_0x35d0('0x49')]);_0x38aab9[_0x35d0('0x4c')]=_[_0x35d0('0x4b')](_0x547723['model'],qs[_0x35d0('0x5d')](_0x6dbbe[_0x35d0('0x49')]['fields']));_0x38aab9[_0x35d0('0x4c')]=_0x38aab9[_0x35d0('0x4c')]['length']?_0x38aab9['attributes']:_0x547723[_0x35d0('0x47')];_0x38aab9['order']=qs['sort'](_0x6dbbe[_0x35d0('0x49')][_0x35d0('0x51')]);_0x38aab9[_0x35d0('0x52')]=qs[_0x35d0('0x4a')](_['pick'](_0x6dbbe[_0x35d0('0x49')],_0x547723[_0x35d0('0x4a')]));if(_0x6dbbe[_0x35d0('0x49')][_0x35d0('0x54')]){_0x38aab9[_0x35d0('0x52')]=_[_0x35d0('0x56')](_0x38aab9[_0x35d0('0x52')],{'$or':_['map'](_0x38aab9[_0x35d0('0x4c')],function(_0x31187e){var _0x33beb7={};_0x33beb7[_0x31187e]={'$like':'%'+_0x6dbbe[_0x35d0('0x49')]['filter']+'%'};return _0x33beb7;})});}_0x38aab9=_[_0x35d0('0x56')]({},_0x38aab9,_0x6dbbe[_0x35d0('0x57')]);return _0x25a6fe[_0x35d0('0xa7')](_0x38aab9);}})['then'](function(_0x657d1f){if(_0x657d1f){_0x2ef8ec=_0x657d1f[_0x35d0('0x4d')];if(!_0x6dbbe['query'][_0x35d0('0x4e')]('nolimit')){_0x38aab9[_0x35d0('0x31')]=qs[_0x35d0('0x31')](_0x6dbbe[_0x35d0('0x49')][_0x35d0('0x31')]);_0x38aab9[_0x35d0('0x30')]=qs[_0x35d0('0x30')](_0x6dbbe[_0x35d0('0x49')][_0x35d0('0x30')]);}return _0x25a6fe[_0x35d0('0xa7')](_0x38aab9);}})[_0x35d0('0x22')](function(_0xb67127){if(_0xb67127){return _0xb67127?{'count':_0x2ef8ec,'rows':_0xb67127}:null;}})['then'](respondWithResult(_0x313c09,null))[_0x35d0('0x2c')](handleError(_0x313c09,null));};exports[_0x35d0('0xa8')]=function(_0x515e0e,_0x35d3da,_0x32337d){var _0x39b498={'raw':![],'where':{}};var _0x236f28={};var _0x48c331={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x515e0e[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x35d3da,null))[_0x35d0('0x22')](function(_0x496a24){if(_0x496a24){_0x236f28[_0x35d0('0x47')]=_[_0x35d0('0x48')](db[_0x35d0('0x92')][_0x35d0('0x44')]);_0x236f28[_0x35d0('0x49')]=_['keys'](_0x515e0e[_0x35d0('0x49')]);_0x236f28[_0x35d0('0x4a')]=_['intersection'](_0x236f28[_0x35d0('0x47')],_0x236f28['query']);_0x39b498[_0x35d0('0x4c')]=_[_0x35d0('0x4b')](_0x236f28[_0x35d0('0x47')],qs[_0x35d0('0x5d')](_0x515e0e[_0x35d0('0x49')][_0x35d0('0x5d')]));_0x39b498['attributes']=_0x39b498[_0x35d0('0x4c')][_0x35d0('0x4d')]?_0x39b498['attributes']:_0x236f28[_0x35d0('0x47')];if(!_0x515e0e[_0x35d0('0x49')][_0x35d0('0x4e')](_0x35d0('0x4f'))){_0x39b498[_0x35d0('0x31')]=qs[_0x35d0('0x31')](_0x515e0e['query'][_0x35d0('0x31')]);_0x39b498[_0x35d0('0x30')]=qs[_0x35d0('0x30')](_0x515e0e[_0x35d0('0x49')]['offset']);}_0x39b498[_0x35d0('0x50')]=qs[_0x35d0('0x51')](_0x515e0e[_0x35d0('0x49')][_0x35d0('0x51')]);_0x39b498[_0x35d0('0x52')]=qs[_0x35d0('0x4a')](_['pick'](_0x515e0e['query'],_0x236f28[_0x35d0('0x4a')]));_0x39b498['where'][_0x35d0('0x6c')]=_0x496a24['id'];if(_0x515e0e[_0x35d0('0x49')][_0x35d0('0x54')]){_0x39b498[_0x35d0('0x52')]=_['merge'](_0x39b498[_0x35d0('0x52')],{'$or':_[_0x35d0('0x42')](_0x39b498['attributes'],function(_0x29d12f){var _0x22d774={};_0x22d774[_0x29d12f]={'$like':'%'+_0x515e0e[_0x35d0('0x49')]['filter']+'%'};return _0x22d774;})});}_0x39b498=_[_0x35d0('0x56')]({},_0x39b498,_0x515e0e[_0x35d0('0x57')]);return db['OpenchannelInteraction'][_0x35d0('0x2f')]({'where':_0x39b498['where']})['then'](function(_0x2cefca){_0x48c331['count']=_0x2cefca;if(_0x515e0e['query']['includeAll']){_0x39b498[_0x35d0('0x59')]=[{'model':db[_0x35d0('0x84')],'as':_0x35d0('0xa9'),'required':![]},{'model':db[_0x35d0('0x9b')],'as':_0x35d0('0xaa'),'attributes':['name',_0x35d0('0xab'),_0x35d0('0xac')],'required':![]},{'model':db[_0x35d0('0xad')],'as':_0x35d0('0xae'),'attributes':['id',_0x35d0('0x3e'),'color'],'where':_0x515e0e[_0x35d0('0x49')]['tag']?{'id':_0x515e0e['query'][_0x35d0('0xaf')]}:undefined,'required':_0x515e0e[_0x35d0('0x49')][_0x35d0('0xaf')]?!![]:![]}];}return db[_0x35d0('0x92')][_0x35d0('0x5a')](_0x39b498);})[_0x35d0('0x22')](function(_0x14bd23){_0x48c331[_0x35d0('0x5b')]=_0x14bd23;return _0x48c331;});}})[_0x35d0('0x22')](respondWithFilteredResult(_0x35d3da,_0x39b498))[_0x35d0('0x2c')](handleError(_0x35d3da,null));};exports[_0x35d0('0xb0')]=function(_0x3ea158,_0x3c40f1,_0x2f44f1){return db[_0x35d0('0x43')][_0x35d0('0x66')]({'where':{'id':_0x3ea158[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x3c40f1,null))['then'](function(_0x2e3f78){if(_0x2e3f78){return _0x2e3f78[_0x35d0('0xb0')](_0x3ea158[_0x35d0('0x5f')]['ids'],_[_0x35d0('0xb1')](_0x3ea158['body'],[_0x35d0('0x6e'),'id'])||{})[_0x35d0('0x93')](function(_0x323df8){for(var _0x1bb98d=0x0;_0x1bb98d<_0x3ea158[_0x35d0('0x5f')][_0x35d0('0x6e')][_0x35d0('0x4d')];_0x1bb98d+=0x1){socket[_0x35d0('0xb2')](_0x35d0('0xb3'),{'UserId':_0x3ea158[_0x35d0('0x5f')][_0x35d0('0x6e')][_0x1bb98d],'OpenchannelAccountId':_0x3ea158[_0x35d0('0x5c')]['id']});}return _0x323df8;});}})[_0x35d0('0x22')](respondWithResult(_0x3c40f1,null))[_0x35d0('0x2c')](handleError(_0x3c40f1,null));};exports[_0x35d0('0xb4')]=function(_0x20ddf9,_0x242631,_0x32a86e){return db['OpenchannelAccount']['find']({'where':{'id':_0x20ddf9[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x242631,null))[_0x35d0('0x22')](function(_0x5908c2){if(_0x5908c2){return _0x5908c2[_0x35d0('0xb4')](_0x20ddf9[_0x35d0('0x49')]['ids'])['then'](function(){if(_[_0x35d0('0xb5')](_0x20ddf9[_0x35d0('0x49')][_0x35d0('0x6e')])){for(var _0x1397d9=0x0;_0x1397d9<_0x20ddf9[_0x35d0('0x49')][_0x35d0('0x6e')][_0x35d0('0x4d')];_0x1397d9+=0x1){socket['emit'](_0x35d0('0xb6'),{'UserId':Number(_0x20ddf9[_0x35d0('0x49')][_0x35d0('0x6e')][_0x1397d9]),'OpenchannelAccountId':Number(_0x20ddf9[_0x35d0('0x5c')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x20ddf9[_0x35d0('0x49')][_0x35d0('0x6e')]),'OpenchannelAccountId':Number(_0x20ddf9[_0x35d0('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x242631,null))[_0x35d0('0x2c')](handleError(_0x242631,null));};exports['getAgents']=function(_0x3694cd,_0x22784d,_0x3be4ba){var _0x410472={};var _0x244ab3={};var _0x422ddb;var _0x2be6c7;return db[_0x35d0('0x43')][_0x35d0('0x6b')]({'where':{'id':_0x3694cd[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x22784d,null))[_0x35d0('0x22')](function(_0x307c64){if(_0x307c64){_0x422ddb=_0x307c64;_0x244ab3[_0x35d0('0x47')]=_['keys'](db[_0x35d0('0x9b')][_0x35d0('0x44')]);_0x244ab3[_0x35d0('0x49')]=_[_0x35d0('0x48')](_0x3694cd[_0x35d0('0x49')]);_0x244ab3[_0x35d0('0x4a')]=_[_0x35d0('0x4b')](_0x244ab3[_0x35d0('0x47')],_0x244ab3[_0x35d0('0x49')]);_0x410472[_0x35d0('0x4c')]=_[_0x35d0('0x4b')](_0x244ab3[_0x35d0('0x47')],qs[_0x35d0('0x5d')](_0x3694cd[_0x35d0('0x49')][_0x35d0('0x5d')]));_0x410472[_0x35d0('0x4c')]=_0x410472[_0x35d0('0x4c')][_0x35d0('0x4d')]?_0x410472[_0x35d0('0x4c')]:_0x244ab3[_0x35d0('0x47')];_0x410472[_0x35d0('0x50')]=qs[_0x35d0('0x51')](_0x3694cd['query']['sort']);_0x410472[_0x35d0('0x52')]=qs[_0x35d0('0x4a')](_[_0x35d0('0x53')](_0x3694cd[_0x35d0('0x49')],_0x244ab3[_0x35d0('0x4a')]));if(_0x3694cd[_0x35d0('0x49')][_0x35d0('0x54')]){_0x410472[_0x35d0('0x52')]=_[_0x35d0('0x56')](_0x410472[_0x35d0('0x52')],{'$or':_['map'](_0x410472[_0x35d0('0x4c')],function(_0x5ba286){var _0x327078={};_0x327078[_0x5ba286]={'$like':'%'+_0x3694cd[_0x35d0('0x49')][_0x35d0('0x54')]+'%'};return _0x327078;})});}_0x410472=_[_0x35d0('0x56')]({},_0x410472,_0x3694cd[_0x35d0('0x57')]);return _0x422ddb[_0x35d0('0xb7')](_0x410472);}})['then'](function(_0x430cd5){if(_0x430cd5){_0x2be6c7=_0x430cd5['length'];if(!_0x3694cd[_0x35d0('0x49')][_0x35d0('0x4e')](_0x35d0('0x4f'))){_0x410472[_0x35d0('0x31')]=qs[_0x35d0('0x31')](_0x3694cd[_0x35d0('0x49')]['limit']);_0x410472[_0x35d0('0x30')]=qs[_0x35d0('0x30')](_0x3694cd['query'][_0x35d0('0x30')]);}return _0x422ddb[_0x35d0('0xb7')](_0x410472);}})[_0x35d0('0x22')](function(_0x3ee0c1){if(_0x3ee0c1){return _0x3ee0c1?{'count':_0x2be6c7,'rows':_0x3ee0c1}:null;}})[_0x35d0('0x22')](respondWithResult(_0x22784d,null))[_0x35d0('0x2c')](handleError(_0x22784d,null));};exports['send']=function(_0x47a440,_0xd875f8,_0x565f17){var _0x2fc6e7,_0x2fd5e0,_0x644e24;if(_[_0x35d0('0x7c')](_0x47a440[_0x35d0('0x5f')]['body'])||_0x47a440[_0x35d0('0x5f')][_0x35d0('0x5f')]===''){throw new db['Sequelize'][(_0x35d0('0x20'))](_0x35d0('0xb8'));}if(_[_0x35d0('0x7c')](_0x47a440['body']['to'])){}_0x2fc6e7=_0x47a440[_0x35d0('0x5f')]['to'];return db['OpenchannelAccount'][_0x35d0('0x6b')]({'where':{'id':_0x47a440['params']['id']}})['then'](handleEntityNotFound(_0xd875f8,null))['then'](function(_0x49aa0f){if(_0x49aa0f){return db['OpenchannelAccount'][_0x35d0('0x66')]({'where':{'id':_0x49aa0f['id']},'include':[{'model':db[_0x35d0('0x82')],'as':_0x35d0('0x83'),'include':[{'model':db[_0x35d0('0x84')],'as':_0x35d0('0x85'),'where':{[_0x49aa0f['mapKey']]:_0x2fc6e7},'limit':0x1,'order':[[_0x35d0('0x79'),'DESC']]}]}]})['then'](handleEntityNotFound(_0xd875f8,null))[_0x35d0('0x22')](function(_0x47501b){if(_0x47501b&&_0x47501b['List']){_0x2fd5e0=_0x47501b['get']({'plain':!![]});if(_0x2fd5e0['List']&&_0x2fd5e0[_0x35d0('0x83')]['Contacts'][_0x35d0('0x4d')]){return _0x2fd5e0[_0x35d0('0x83')]['Contacts'][0x0];}return db[_0x35d0('0x84')][_0x35d0('0x5e')](_[_0x35d0('0x18')](_0x47a440[_0x35d0('0x5f')],{'firstName':_0x2fc6e7,[_0x47501b[_0x35d0('0x7e')]]:_0x2fc6e7,'phone':_0x2fc6e7,'ListId':_0x2fd5e0['ListId']}));}})[_0x35d0('0x22')](handleEntityNotFound(_0xd875f8,null))[_0x35d0('0x22')](function(_0x5da0d7){if(_0x5da0d7){_0x644e24=_0x5da0d7;return db[_0x35d0('0x92')][_0x35d0('0x66')]({'where':{'ContactId':_0x644e24['id'],'closed':![],'OpenchannelAccountId':_0x2fd5e0['id']}})[_0x35d0('0x22')](function(_0x3f5f34){if(_0x3f5f34){return[_0x3f5f34,![]];}return db[_0x35d0('0x92')][_0x35d0('0x5e')]({'UserId':_0x47a440[_0x35d0('0x60')]['id'],'ContactId':_0x644e24['id'],'OpenchannelAccountId':_0x2fd5e0['id'],'lastMsgDirection':_0x35d0('0xb9'),'Messages':[_[_0x35d0('0x56')](_0x47a440[_0x35d0('0x5f')],{'read':![],'body':_0x47a440[_0x35d0('0x5f')][_0x35d0('0x5f')],'OpenchannelAccountId':_0x2fd5e0['id'],'UserId':_0x47a440[_0x35d0('0x60')]['id'],'ContactId':_0x644e24['id']})]},{'include':[{'model':db[_0x35d0('0xba')],'as':_0x35d0('0xbb')}]})[_0x35d0('0x22')](function(_0x5ba468){return[_0x5ba468,!![]];});});}})[_0x35d0('0x93')](function(_0x30b216,_0x56f965){if(_0x56f965){return _0x30b216;}return db['OpenchannelMessage']['create'](_[_0x35d0('0x56')](_0x47a440[_0x35d0('0x5f')],{'read':![],'body':_0x47a440['body'][_0x35d0('0x5f')],'OpenchannelAccountId':_0x2fd5e0['id'],'OpenchannelInteractionId':_0x30b216['id'],'UserId':_0x47a440[_0x35d0('0x60')]['id'],'ContactId':_0x644e24['id']}))[_0x35d0('0x22')](function(_0x18215f){_0x30b216[_0x35d0('0xbc')][_0x35d0('0xbb')]=[];_0x30b216['dataValues'][_0x35d0('0xbb')][_0x35d0('0x98')](_0x18215f[_0x35d0('0xbc')]);return _0x30b216;});});}})['then'](respondWithResult(_0xd875f8,null))[_0x35d0('0x2c')](handleError(_0xd875f8,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 6beedb8..0a632ea 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 _0x222d=['update','emit','hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x222d,0x194));var _0xd222=function(_0x221886,_0x770a04){_0x221886=_0x221886-0x0;var _0x4b3608=_0x222d[_0x221886];return _0x4b3608;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xd222('0x0'))['db'][_0xd222('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xd222('0x2')](0x0);var events={'afterCreate':_0xd222('0x3'),'afterUpdate':_0xd222('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4eb246){return function(_0x350709,_0x4f93af,_0x141884){OpenchannelAccountEvents[_0xd222('0x5')](_0x4eb246+':'+_0x350709['id'],_0x350709);OpenchannelAccountEvents['emit'](_0x4eb246,_0x350709);_0x141884(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xd222('0x6')](e,emitEvent(event));}}module[_0xd222('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x73e5=['save','remove','emit','events','OpenchannelAccount','setMaxListeners'];(function(_0x2b0ccf,_0x4fabf4){var _0x298350=function(_0xee99dd){while(--_0xee99dd){_0x2b0ccf['push'](_0x2b0ccf['shift']());}};_0x298350(++_0x4fabf4);}(_0x73e5,0xff));var _0x573e=function(_0x218e99,_0x4a364f){_0x218e99=_0x218e99-0x0;var _0x47da41=_0x73e5[_0x218e99];return _0x47da41;};'use strict';var EventEmitter=require(_0x573e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x573e('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x573e('0x2')](0x0);var events={'afterCreate':_0x573e('0x3'),'afterUpdate':'update','afterDestroy':_0x573e('0x4')};function emitEvent(_0x195d96){return function(_0x44df59,_0x378e06,_0x2ec914){OpenchannelAccountEvents[_0x573e('0x5')](_0x195d96+':'+_0x44df59['id'],_0x44df59);OpenchannelAccountEvents['emit'](_0x195d96,_0x44df59);_0x2ec914(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index d47bf1f..3f53b83 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 _0xb341=['OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','request-promise','path','rimraf','./openchannelAccount.attributes','exports','define'];(function(_0x533f7b,_0x4f832c){var _0x1fecc1=function(_0x2f2845){while(--_0x2f2845){_0x533f7b['push'](_0x533f7b['shift']());}};_0x1fecc1(++_0x4f832c);}(_0xb341,0xbd));var _0x1b34=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb341[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1b34('0x0'));var util=require(_0x1b34('0x1'));var logger=require(_0x1b34('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1b34('0x3'));var fs=require('fs');var path=require(_0x1b34('0x4'));var rimraf=require(_0x1b34('0x5'));var config=require('../../config/environment');var attributes=require(_0x1b34('0x6'));module[_0x1b34('0x7')]=function(_0x43eab3,_0x50df0c){return _0x43eab3[_0x1b34('0x8')](_0x1b34('0x9'),attributes,{'tableName':_0x1b34('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x888a=['request-promise','path','../../config/environment','exports','define','OpenchannelAccount','lodash','util','../../config/logger','api','bluebird'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x888a,0xcc));var _0xa888=function(_0x2cd3d3,_0x33e9ad){_0x2cd3d3=_0x2cd3d3-0x0;var _0x14a15a=_0x888a[_0x2cd3d3];return _0x14a15a;};'use strict';var _=require(_0xa888('0x0'));var util=require(_0xa888('0x1'));var logger=require(_0xa888('0x2'))(_0xa888('0x3'));var moment=require('moment');var BPromise=require(_0xa888('0x4'));var rp=require(_0xa888('0x5'));var fs=require('fs');var path=require(_0xa888('0x6'));var rimraf=require('rimraf');var config=require(_0xa888('0x7'));var attributes=require('./openchannelAccount.attributes');module[_0xa888('0x8')]=function(_0x4c5b23,_0x30b683){return _0x4c5b23[_0xa888('0x9')](_0xa888('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 1135400..12b42c2 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 _0xdbed=['http','redis','localhost','register','then','info','request\x20sent','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0xdca9f6,_0x31447d){var _0x38750c=function(_0x4cddd7){while(--_0x4cddd7){_0xdca9f6['push'](_0xdca9f6['shift']());}};_0x38750c(++_0x31447d);}(_0xdbed,0xbc));var _0xddbe=function(_0x4ecf64,_0x225f73){_0x4ecf64=_0x4ecf64-0x0;var _0x3e8256=_0xdbed[_0x4ecf64];return _0x3e8256;};'use strict';var _=require(_0xddbe('0x0'));var util=require(_0xddbe('0x1'));var moment=require(_0xddbe('0x2'));var BPromise=require(_0xddbe('0x3'));var rs=require(_0xddbe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xddbe('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xddbe('0x6'));var config=require(_0xddbe('0x7'));var jayson=require(_0xddbe('0x8'));var client=jayson[_0xddbe('0x9')][_0xddbe('0xa')]({'port':0x232a});config[_0xddbe('0xb')]=_['defaults'](config['redis'],{'host':_0xddbe('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xddbe('0xd')](socket);function respondWithRpcPromise(_0xd39689,_0x93ccb5,_0xeee3e5){return new BPromise(function(_0x1063df,_0x3b245f){return client['request'](_0xd39689,_0xeee3e5)[_0xddbe('0xe')](function(_0x5eec60){logger[_0xddbe('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x93ccb5,_0xddbe('0x10'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x93ccb5,_0xddbe('0x10'),JSON[_0xddbe('0x11')](_0x5eec60));if(_0x5eec60[_0xddbe('0x12')]){if(_0x5eec60[_0xddbe('0x12')][_0xddbe('0x13')]===0x1f4){logger[_0xddbe('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x93ccb5,_0x5eec60[_0xddbe('0x12')][_0xddbe('0x14')]);return _0x3b245f(_0x5eec60[_0xddbe('0x12')]['message']);}logger['error'](_0xddbe('0x15'),_0x93ccb5,_0x5eec60[_0xddbe('0x12')][_0xddbe('0x14')]);return _0x1063df(_0x5eec60[_0xddbe('0x12')][_0xddbe('0x14')]);}else{logger[_0xddbe('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x93ccb5,'request\x20sent');_0x1063df(_0x5eec60['result']['message']);}})['catch'](function(_0x3d7ddb){logger[_0xddbe('0x12')](_0xddbe('0x15'),_0x93ccb5,_0x3d7ddb);_0x3b245f(_0x3d7ddb);});});} \ No newline at end of file +var _0xccc5=['info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x174601,_0x23909d){var _0x3dfff5=function(_0x5a24bf){while(--_0x5a24bf){_0x174601['push'](_0x174601['shift']());}};_0x3dfff5(++_0x23909d);}(_0xccc5,0x116));var _0x5ccc=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xccc5[_0x2642cb];return _0xe6e41;};'use strict';var _=require('lodash');var util=require(_0x5ccc('0x0'));var moment=require(_0x5ccc('0x1'));var BPromise=require(_0x5ccc('0x2'));var rs=require(_0x5ccc('0x3'));var fs=require('fs');var Redis=require(_0x5ccc('0x4'));var db=require(_0x5ccc('0x5'))['db'];var utils=require(_0x5ccc('0x6'));var logger=require(_0x5ccc('0x7'))(_0x5ccc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5ccc('0x9')]({'port':0x232a});config[_0x5ccc('0xa')]=_[_0x5ccc('0xb')](config[_0x5ccc('0xa')],{'host':_0x5ccc('0xc'),'port':0x18eb});var socket=require(_0x5ccc('0xd'))(new Redis(config['redis']));require(_0x5ccc('0xe'))['register'](socket);function respondWithRpcPromise(_0x328f74,_0x45b852,_0x554d3d){return new BPromise(function(_0x19fecc,_0xceef2d){return client[_0x5ccc('0xf')](_0x328f74,_0x554d3d)['then'](function(_0x4baa06){logger['info'](_0x5ccc('0x10'),_0x45b852,_0x5ccc('0x11'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x45b852,'request\x20sent',JSON[_0x5ccc('0x12')](_0x4baa06));if(_0x4baa06[_0x5ccc('0x13')]){if(_0x4baa06[_0x5ccc('0x13')]['code']===0x1f4){logger[_0x5ccc('0x13')](_0x5ccc('0x10'),_0x45b852,_0x4baa06[_0x5ccc('0x13')][_0x5ccc('0x14')]);return _0xceef2d(_0x4baa06[_0x5ccc('0x13')][_0x5ccc('0x14')]);}logger[_0x5ccc('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x45b852,_0x4baa06[_0x5ccc('0x13')][_0x5ccc('0x14')]);return _0x19fecc(_0x4baa06[_0x5ccc('0x13')][_0x5ccc('0x14')]);}else{logger[_0x5ccc('0x15')](_0x5ccc('0x10'),_0x45b852,_0x5ccc('0x11'));_0x19fecc(_0x4baa06['result'][_0x5ccc('0x14')]);}})[_0x5ccc('0x16')](function(_0x483e50){logger[_0x5ccc('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x45b852,_0x483e50);_0xceef2d(_0x483e50);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 261c4d7..646f20e 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 _0x46d5=['./openchannelAccount.events','save','remove','emit','removeListener','length','openchannelAccount:'];(function(_0x13f6fc,_0x40f9f3){var _0xe8d550=function(_0x4e07ce){while(--_0x4e07ce){_0x13f6fc['push'](_0x13f6fc['shift']());}};_0xe8d550(++_0x40f9f3);}(_0x46d5,0x1c0));var _0x546d=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x46d5[_0x53ccf2];return _0x5a2964;};'use strict';var OpenchannelAccountEvents=require(_0x546d('0x0'));var events=[_0x546d('0x1'),_0x546d('0x2'),'update'];function createListener(_0x266153,_0x7d9ae8){return function(_0x8d736c){_0x7d9ae8[_0x546d('0x3')](_0x266153,_0x8d736c);};}function removeListener(_0x35df41,_0x1cb08d){return function(){OpenchannelAccountEvents[_0x546d('0x4')](_0x35df41,_0x1cb08d);};}exports['register']=function(_0x15dfe7){for(var _0x1ff4ca=0x0,_0x513ca6=events[_0x546d('0x5')];_0x1ff4ca<_0x513ca6;_0x1ff4ca++){var _0x5495e9=events[_0x1ff4ca];var _0x53cbe7=createListener(_0x546d('0x6')+_0x5495e9,_0x15dfe7);OpenchannelAccountEvents['on'](_0x5495e9,_0x53cbe7);}}; \ No newline at end of file +var _0xe3c3=['length','openchannelAccount:','./openchannelAccount.events','save','remove','update'];(function(_0x515f1c,_0x4eb731){var _0x324982=function(_0x3c9911){while(--_0x3c9911){_0x515f1c['push'](_0x515f1c['shift']());}};_0x324982(++_0x4eb731);}(_0xe3c3,0x10a));var _0x3e3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe3c3[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelAccountEvents=require(_0x3e3c('0x0'));var events=[_0x3e3c('0x1'),_0x3e3c('0x2'),_0x3e3c('0x3')];function createListener(_0x22fa24,_0x43bfb0){return function(_0x449aab){_0x43bfb0['emit'](_0x22fa24,_0x449aab);};}function removeListener(_0x44b759,_0x1dda7a){return function(){OpenchannelAccountEvents['removeListener'](_0x44b759,_0x1dda7a);};}exports['register']=function(_0x2fae35){for(var _0x34ddd6=0x0,_0x58de82=events[_0x3e3c('0x4')];_0x34ddd6<_0x58de82;_0x34ddd6++){var _0x11d16e=events[_0x34ddd6];var _0x2cf958=createListener(_0x3e3c('0x5')+_0x11d16e,_0x2fae35);OpenchannelAccountEvents['on'](_0x11d16e,_0x2cf958);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 8c910de..3be041f 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 _0xe2e1=['connect-timeout','express','Router','./openchannelApplication.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','exports','multer','util','path'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xe2e1,0xd5));var _0x1e2e=function(_0x2dd969,_0x42c215){_0x2dd969=_0x2dd969-0x0;var _0x5902cb=_0xe2e1[_0x2dd969];return _0x5902cb;};'use strict';var multer=require(_0x1e2e('0x0'));var util=require(_0x1e2e('0x1'));var path=require(_0x1e2e('0x2'));var timeout=require(_0x1e2e('0x3'));var express=require(_0x1e2e('0x4'));var router=express[_0x1e2e('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1e2e('0x6'));router[_0x1e2e('0x7')]('/',auth['isAuthenticated'](),controller[_0x1e2e('0x8')]);router[_0x1e2e('0x7')]('/:id',auth[_0x1e2e('0x9')](),controller[_0x1e2e('0xa')]);router[_0x1e2e('0xb')]('/',auth[_0x1e2e('0x9')](),controller[_0x1e2e('0xc')]);router[_0x1e2e('0xd')](_0x1e2e('0xe'),auth['isAuthenticated'](),controller[_0x1e2e('0xf')]);router[_0x1e2e('0x10')](_0x1e2e('0xe'),auth[_0x1e2e('0x9')](),controller['destroy']);module[_0x1e2e('0x11')]=router; \ No newline at end of file +var _0x2534=['../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x2534,0x11f));var _0x4253=function(_0xec109b,_0x30f69d){_0xec109b=_0xec109b-0x0;var _0x56bf40=_0x2534[_0xec109b];return _0x56bf40;};'use strict';var multer=require(_0x4253('0x0'));var util=require(_0x4253('0x1'));var path=require(_0x4253('0x2'));var timeout=require(_0x4253('0x3'));var express=require(_0x4253('0x4'));var router=express[_0x4253('0x5')]();var auth=require(_0x4253('0x6'));var interaction=require(_0x4253('0x7'));var config=require(_0x4253('0x8'));var controller=require(_0x4253('0x9'));router[_0x4253('0xa')]('/',auth[_0x4253('0xb')](),controller[_0x4253('0xc')]);router[_0x4253('0xa')](_0x4253('0xd'),auth[_0x4253('0xb')](),controller[_0x4253('0xe')]);router[_0x4253('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4253('0x10')]('/:id',auth[_0x4253('0xb')](),controller[_0x4253('0x11')]);router[_0x4253('0x12')]('/:id',auth[_0x4253('0xb')](),controller[_0x4253('0x13')]);module[_0x4253('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 66041b0..01fec57 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 _0x6313=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x1753ae,_0x4bc78f){var _0x10f2e3=function(_0x641eb1){while(--_0x641eb1){_0x1753ae['push'](_0x1753ae['shift']());}};_0x10f2e3(++_0x4bc78f);}(_0x6313,0x167));var _0x3631=function(_0x5cdf85,_0x4f5610){_0x5cdf85=_0x5cdf85-0x0;var _0x109a19=_0x6313[_0x5cdf85];return _0x109a19;};'use strict';var Sequelize=require('sequelize');module[_0x3631('0x0')]={'priority':{'type':Sequelize[_0x3631('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3631('0x2')],'allowNull':![],'defaultValue':_0x3631('0x3')},'appdata':{'type':Sequelize[_0x3631('0x4')]()},'description':{'type':Sequelize[_0x3631('0x2')]},'interval':{'type':Sequelize[_0x3631('0x2')],'defaultValue':_0x3631('0x5')}}; \ No newline at end of file +var _0x39d2=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0xa201ee,_0x37da32){var _0x3e104d=function(_0x4cd637){while(--_0x4cd637){_0xa201ee['push'](_0xa201ee['shift']());}};_0x3e104d(++_0x37da32);}(_0x39d2,0x194));var _0x239d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x39d2[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x239d('0x0'));module[_0x239d('0x1')]={'priority':{'type':Sequelize[_0x239d('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x239d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x239d('0x4')],'defaultValue':_0x239d('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index fb31bcd..a01e271 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 _0x24c7=['merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','update','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x24c7,0x1d5));var _0x724c=function(_0x1b728c,_0x1e77fd){_0x1b728c=_0x1b728c-0x0;var _0x152774=_0x24c7[_0x1b728c];return _0x152774;};'use strict';var pdf=require(_0x724c('0x0'));var emlformat=require(_0x724c('0x1'));var rimraf=require(_0x724c('0x2'));var zipdir=require(_0x724c('0x3'));var jsonpatch=require(_0x724c('0x4'));var rp=require(_0x724c('0x5'));var moment=require('moment');var BPromise=require(_0x724c('0x6'));var Mustache=require(_0x724c('0x7'));var util=require(_0x724c('0x8'));var path=require(_0x724c('0x9'));var sox=require('sox');var csv=require(_0x724c('0xa'));var ejs=require(_0x724c('0xb'));var fs=require('fs');var _=require(_0x724c('0xc'));var squel=require('squel');var crypto=require(_0x724c('0xd'));var jsforce=require(_0x724c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x724c('0xf'));var Papa=require('papaparse');var Redis=require(_0x724c('0x10'));var authService=require(_0x724c('0x11'));var qs=require(_0x724c('0x12'));var as=require(_0x724c('0x13'));var hardwareService=require(_0x724c('0x14'));var logger=require(_0x724c('0x15'))(_0x724c('0x16'));var utils=require(_0x724c('0x17'));var config=require(_0x724c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bcdfb,_0x118193){_0x118193=_0x118193||0xcc;return function(_0x366aa3){if(_0x366aa3){return _0x4bcdfb[_0x724c('0x19')](_0x118193);}return _0x4bcdfb[_0x724c('0x1a')](_0x118193)[_0x724c('0x1b')]();};}function respondWithResult(_0x3e922e,_0x2cf2e7){_0x2cf2e7=_0x2cf2e7||0xc8;return function(_0x3f4375){if(_0x3f4375){return _0x3e922e[_0x724c('0x1a')](_0x2cf2e7)[_0x724c('0x1c')](_0x3f4375);}};}function respondWithFilteredResult(_0x2c5ab8,_0x13442f){return function(_0x133db1){if(_0x133db1){var _0x316b37=_0x133db1[_0x724c('0x1d')],_0x378842=_0x13442f[_0x724c('0x1e')],_0x493746=_0x13442f['offset']+_0x13442f[_0x724c('0x1f')],_0x35d6ae;if(_0x493746>=_0x316b37){_0x493746=_0x316b37;_0x35d6ae=0xc8;}else{_0x35d6ae=0xce;}_0x2c5ab8[_0x724c('0x1a')](_0x35d6ae);return _0x2c5ab8[_0x724c('0x20')](_0x724c('0x21'),_0x378842+'-'+_0x493746+'/'+_0x316b37)[_0x724c('0x1c')](_0x133db1);}return null;};}function patchUpdates(_0x16ae9a){return function(_0x169e1a){try{jsonpatch[_0x724c('0x22')](_0x169e1a,_0x16ae9a,!![]);}catch(_0xc71753){return BPromise[_0x724c('0x23')](_0xc71753);}return _0x169e1a[_0x724c('0x24')]();};}function saveUpdates(_0x2b7592,_0x1b3b9d){return function(_0x50de78){if(_0x50de78){return _0x50de78['update'](_0x2b7592)[_0x724c('0x25')](function(_0x4e185f){return _0x4e185f;});}return null;};}function removeEntity(_0x564e68,_0x2f064e){return function(_0x5e06ca){if(_0x5e06ca){return _0x5e06ca[_0x724c('0x26')]()[_0x724c('0x25')](function(){_0x564e68['status'](0xcc)[_0x724c('0x1b')]();});}};}function handleEntityNotFound(_0x494590,_0x5baedc){return function(_0xf778c6){if(!_0xf778c6){_0x494590[_0x724c('0x19')](0x194);}return _0xf778c6;};}function handleError(_0x22328a,_0x5b75c9){_0x5b75c9=_0x5b75c9||0x1f4;return function(_0x6d85c6){logger[_0x724c('0x27')](_0x6d85c6[_0x724c('0x28')]);if(_0x6d85c6[_0x724c('0x29')]){delete _0x6d85c6[_0x724c('0x29')];}_0x22328a[_0x724c('0x1a')](_0x5b75c9)[_0x724c('0x2a')](_0x6d85c6);};}exports[_0x724c('0x2b')]=function(_0xc3005c,_0x5031a8){var _0x4ef263={},_0x5044e9={},_0x1f9fa6={'count':0x0,'rows':[]};var _0xcb447a=_[_0x724c('0x2c')](db[_0x724c('0x2d')][_0x724c('0x2e')],function(_0x210356){return{'name':_0x210356[_0x724c('0x2f')],'type':_0x210356[_0x724c('0x30')][_0x724c('0x31')]};});_0x5044e9[_0x724c('0x32')]=_[_0x724c('0x2c')](_0xcb447a,'name');_0x5044e9[_0x724c('0x33')]=_[_0x724c('0x34')](_0xc3005c[_0x724c('0x33')]);_0x5044e9[_0x724c('0x35')]=_[_0x724c('0x36')](_0x5044e9[_0x724c('0x32')],_0x5044e9[_0x724c('0x33')]);_0x4ef263[_0x724c('0x37')]=_['intersection'](_0x5044e9[_0x724c('0x32')],qs[_0x724c('0x38')](_0xc3005c[_0x724c('0x33')][_0x724c('0x38')]));_0x4ef263[_0x724c('0x37')]=_0x4ef263[_0x724c('0x37')][_0x724c('0x39')]?_0x4ef263[_0x724c('0x37')]:_0x5044e9[_0x724c('0x32')];if(!_0xc3005c['query'][_0x724c('0x3a')]('nolimit')){_0x4ef263[_0x724c('0x1f')]=qs[_0x724c('0x1f')](_0xc3005c[_0x724c('0x33')]['limit']);_0x4ef263[_0x724c('0x1e')]=qs[_0x724c('0x1e')](_0xc3005c['query'][_0x724c('0x1e')]);}_0x4ef263[_0x724c('0x3b')]=qs[_0x724c('0x3c')](_0xc3005c[_0x724c('0x33')][_0x724c('0x3c')]);_0x4ef263[_0x724c('0x3d')]=qs[_0x724c('0x35')](_['pick'](_0xc3005c[_0x724c('0x33')],_0x5044e9[_0x724c('0x35')]),_0xcb447a);if(_0xc3005c[_0x724c('0x33')][_0x724c('0x3e')]){_0x4ef263[_0x724c('0x3d')]=_[_0x724c('0x3f')](_0x4ef263[_0x724c('0x3d')],{'$or':_[_0x724c('0x2c')](_0xcb447a,function(_0x17db52){if(_0x17db52['type']!==_0x724c('0x40')){var _0xe2696c={};_0xe2696c[_0x17db52['name']]={'$like':'%'+_0xc3005c[_0x724c('0x33')][_0x724c('0x3e')]+'%'};return _0xe2696c;}})});}_0x4ef263=_[_0x724c('0x3f')]({},_0x4ef263,_0xc3005c[_0x724c('0x41')]);var _0x236557={'where':_0x4ef263[_0x724c('0x3d')]};return db['OpenchannelApplication'][_0x724c('0x1d')](_0x236557)['then'](function(_0x568576){_0x1f9fa6['count']=_0x568576;if(_0xc3005c[_0x724c('0x33')][_0x724c('0x42')]){_0x4ef263[_0x724c('0x43')]=[{'all':!![]}];}return db[_0x724c('0x2d')][_0x724c('0x44')](_0x4ef263);})[_0x724c('0x25')](function(_0x387ea4){_0x1f9fa6['rows']=_0x387ea4;return _0x1f9fa6;})[_0x724c('0x25')](respondWithFilteredResult(_0x5031a8,_0x4ef263))[_0x724c('0x45')](handleError(_0x5031a8,null));};exports[_0x724c('0x46')]=function(_0x5b9a07,_0x5a2b1f){var _0x125a30={'raw':!![],'where':{'id':_0x5b9a07['params']['id']}},_0x40587d={};_0x40587d[_0x724c('0x32')]=_[_0x724c('0x34')](db['OpenchannelApplication'][_0x724c('0x2e')]);_0x40587d[_0x724c('0x33')]=_['keys'](_0x5b9a07[_0x724c('0x33')]);_0x40587d['filters']=_[_0x724c('0x36')](_0x40587d['model'],_0x40587d['query']);_0x125a30[_0x724c('0x37')]=_[_0x724c('0x36')](_0x40587d[_0x724c('0x32')],qs['fields'](_0x5b9a07['query'][_0x724c('0x38')]));_0x125a30[_0x724c('0x37')]=_0x125a30[_0x724c('0x37')]['length']?_0x125a30[_0x724c('0x37')]:_0x40587d[_0x724c('0x32')];if(_0x5b9a07[_0x724c('0x33')][_0x724c('0x42')]){_0x125a30['include']=[{'all':!![]}];}_0x125a30=_['merge']({},_0x125a30,_0x5b9a07['options']);return db[_0x724c('0x2d')][_0x724c('0x47')](_0x125a30)[_0x724c('0x25')](handleEntityNotFound(_0x5a2b1f,null))[_0x724c('0x25')](respondWithResult(_0x5a2b1f,null))['catch'](handleError(_0x5a2b1f,null));};exports[_0x724c('0x48')]=function(_0x3ee122,_0x5e4a8b){return db[_0x724c('0x2d')]['create'](_0x3ee122['body'],{})[_0x724c('0x25')](respondWithResult(_0x5e4a8b,0xc9))[_0x724c('0x45')](handleError(_0x5e4a8b,null));};exports[_0x724c('0x49')]=function(_0x4a16b8,_0x40b1b6){if(_0x4a16b8[_0x724c('0x4a')]['id']){delete _0x4a16b8[_0x724c('0x4a')]['id'];}return db[_0x724c('0x2d')][_0x724c('0x47')]({'where':{'id':_0x4a16b8[_0x724c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x40b1b6,null))[_0x724c('0x25')](saveUpdates(_0x4a16b8[_0x724c('0x4a')],null))[_0x724c('0x25')](respondWithResult(_0x40b1b6,null))['catch'](handleError(_0x40b1b6,null));};exports[_0x724c('0x26')]=function(_0xde1ca0,_0x414487){return db[_0x724c('0x2d')]['find']({'where':{'id':_0xde1ca0[_0x724c('0x4b')]['id']}})[_0x724c('0x25')](handleEntityNotFound(_0x414487,null))[_0x724c('0x25')](removeEntity(_0x414487,null))['catch'](handleError(_0x414487,null));}; \ No newline at end of file +var _0x2b16=['sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','keys','create','body','find','destroy','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x2a3367,_0x25913a){var _0x230264=function(_0xffa54a){while(--_0xffa54a){_0x2a3367['push'](_0x2a3367['shift']());}};_0x230264(++_0x25913a);}(_0x2b16,0x127));var _0x62b1=function(_0xc9bab3,_0x4f2359){_0xc9bab3=_0xc9bab3-0x0;var _0x27ff0a=_0x2b16[_0xc9bab3];return _0x27ff0a;};'use strict';var pdf=require(_0x62b1('0x0'));var emlformat=require(_0x62b1('0x1'));var rimraf=require(_0x62b1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x62b1('0x3'));var rp=require('request-promise');var moment=require(_0x62b1('0x4'));var BPromise=require(_0x62b1('0x5'));var Mustache=require(_0x62b1('0x6'));var util=require(_0x62b1('0x7'));var path=require(_0x62b1('0x8'));var sox=require(_0x62b1('0x9'));var csv=require(_0x62b1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x62b1('0xb'));var squel=require(_0x62b1('0xc'));var crypto=require('crypto');var jsforce=require(_0x62b1('0xd'));var deskjs=require(_0x62b1('0xe'));var toCsv=require(_0x62b1('0xa'));var querystring=require(_0x62b1('0xf'));var Papa=require(_0x62b1('0x10'));var Redis=require(_0x62b1('0x11'));var authService=require(_0x62b1('0x12'));var qs=require(_0x62b1('0x13'));var as=require(_0x62b1('0x14'));var hardwareService=require(_0x62b1('0x15'));var logger=require('../../config/logger')(_0x62b1('0x16'));var utils=require(_0x62b1('0x17'));var config=require(_0x62b1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10829e,_0x401a85){_0x401a85=_0x401a85||0xcc;return function(_0xe43bf9){if(_0xe43bf9){return _0x10829e[_0x62b1('0x19')](_0x401a85);}return _0x10829e[_0x62b1('0x1a')](_0x401a85)['end']();};}function respondWithResult(_0x278571,_0x11a280){_0x11a280=_0x11a280||0xc8;return function(_0x5a0f34){if(_0x5a0f34){return _0x278571[_0x62b1('0x1a')](_0x11a280)[_0x62b1('0x1b')](_0x5a0f34);}};}function respondWithFilteredResult(_0xeadf3b,_0x52fe8c){return function(_0xda139a){if(_0xda139a){var _0x583844=_0xda139a['count'],_0x36f076=_0x52fe8c[_0x62b1('0x1c')],_0x5d2438=_0x52fe8c[_0x62b1('0x1c')]+_0x52fe8c[_0x62b1('0x1d')],_0x3e2e95;if(_0x5d2438>=_0x583844){_0x5d2438=_0x583844;_0x3e2e95=0xc8;}else{_0x3e2e95=0xce;}_0xeadf3b[_0x62b1('0x1a')](_0x3e2e95);return _0xeadf3b[_0x62b1('0x1e')](_0x62b1('0x1f'),_0x36f076+'-'+_0x5d2438+'/'+_0x583844)['json'](_0xda139a);}return null;};}function patchUpdates(_0x23d763){return function(_0x1802b8){try{jsonpatch[_0x62b1('0x20')](_0x1802b8,_0x23d763,!![]);}catch(_0x488deb){return BPromise['reject'](_0x488deb);}return _0x1802b8[_0x62b1('0x21')]();};}function saveUpdates(_0x434546,_0x11739a){return function(_0x1e1595){if(_0x1e1595){return _0x1e1595[_0x62b1('0x22')](_0x434546)[_0x62b1('0x23')](function(_0x149e53){return _0x149e53;});}return null;};}function removeEntity(_0x429234,_0x84f8af){return function(_0x355752){if(_0x355752){return _0x355752['destroy']()[_0x62b1('0x23')](function(){_0x429234[_0x62b1('0x1a')](0xcc)[_0x62b1('0x24')]();});}};}function handleEntityNotFound(_0x3d46fa,_0x1cc987){return function(_0x2ec0d1){if(!_0x2ec0d1){_0x3d46fa[_0x62b1('0x19')](0x194);}return _0x2ec0d1;};}function handleError(_0x37f56c,_0x3d1f6c){_0x3d1f6c=_0x3d1f6c||0x1f4;return function(_0xad4a26){logger[_0x62b1('0x25')](_0xad4a26[_0x62b1('0x26')]);if(_0xad4a26[_0x62b1('0x27')]){delete _0xad4a26['name'];}_0x37f56c[_0x62b1('0x1a')](_0x3d1f6c)[_0x62b1('0x28')](_0xad4a26);};}exports[_0x62b1('0x29')]=function(_0x1eb5b5,_0x58ea7a){var _0x44bd2a={},_0x3c849a={},_0x52bb1c={'count':0x0,'rows':[]};var _0x5e70b5=_[_0x62b1('0x2a')](db[_0x62b1('0x2b')][_0x62b1('0x2c')],function(_0x21e7d3){return{'name':_0x21e7d3[_0x62b1('0x2d')],'type':_0x21e7d3[_0x62b1('0x2e')][_0x62b1('0x2f')]};});_0x3c849a[_0x62b1('0x30')]=_[_0x62b1('0x2a')](_0x5e70b5,_0x62b1('0x27'));_0x3c849a[_0x62b1('0x31')]=_['keys'](_0x1eb5b5[_0x62b1('0x31')]);_0x3c849a[_0x62b1('0x32')]=_[_0x62b1('0x33')](_0x3c849a[_0x62b1('0x30')],_0x3c849a['query']);_0x44bd2a[_0x62b1('0x34')]=_[_0x62b1('0x33')](_0x3c849a['model'],qs[_0x62b1('0x35')](_0x1eb5b5[_0x62b1('0x31')][_0x62b1('0x35')]));_0x44bd2a[_0x62b1('0x34')]=_0x44bd2a[_0x62b1('0x34')][_0x62b1('0x36')]?_0x44bd2a[_0x62b1('0x34')]:_0x3c849a[_0x62b1('0x30')];if(!_0x1eb5b5[_0x62b1('0x31')][_0x62b1('0x37')]('nolimit')){_0x44bd2a[_0x62b1('0x1d')]=qs['limit'](_0x1eb5b5[_0x62b1('0x31')]['limit']);_0x44bd2a[_0x62b1('0x1c')]=qs[_0x62b1('0x1c')](_0x1eb5b5[_0x62b1('0x31')][_0x62b1('0x1c')]);}_0x44bd2a[_0x62b1('0x38')]=qs[_0x62b1('0x39')](_0x1eb5b5[_0x62b1('0x31')]['sort']);_0x44bd2a[_0x62b1('0x3a')]=qs[_0x62b1('0x32')](_[_0x62b1('0x3b')](_0x1eb5b5[_0x62b1('0x31')],_0x3c849a[_0x62b1('0x32')]),_0x5e70b5);if(_0x1eb5b5[_0x62b1('0x31')][_0x62b1('0x3c')]){_0x44bd2a['where']=_[_0x62b1('0x3d')](_0x44bd2a['where'],{'$or':_[_0x62b1('0x2a')](_0x5e70b5,function(_0x587e84){if(_0x587e84[_0x62b1('0x2e')]!==_0x62b1('0x3e')){var _0x469fa5={};_0x469fa5[_0x587e84[_0x62b1('0x27')]]={'$like':'%'+_0x1eb5b5['query']['filter']+'%'};return _0x469fa5;}})});}_0x44bd2a=_['merge']({},_0x44bd2a,_0x1eb5b5[_0x62b1('0x3f')]);var _0x3c3d4a={'where':_0x44bd2a[_0x62b1('0x3a')]};return db[_0x62b1('0x2b')]['count'](_0x3c3d4a)[_0x62b1('0x23')](function(_0x4e5cf4){_0x52bb1c[_0x62b1('0x40')]=_0x4e5cf4;if(_0x1eb5b5[_0x62b1('0x31')][_0x62b1('0x41')]){_0x44bd2a[_0x62b1('0x42')]=[{'all':!![]}];}return db[_0x62b1('0x2b')]['findAll'](_0x44bd2a);})[_0x62b1('0x23')](function(_0x10a475){_0x52bb1c[_0x62b1('0x43')]=_0x10a475;return _0x52bb1c;})[_0x62b1('0x23')](respondWithFilteredResult(_0x58ea7a,_0x44bd2a))[_0x62b1('0x44')](handleError(_0x58ea7a,null));};exports[_0x62b1('0x45')]=function(_0xe2d384,_0x3ac7d7){var _0x2932d7={'raw':!![],'where':{'id':_0xe2d384[_0x62b1('0x46')]['id']}},_0x50e72f={};_0x50e72f['model']=_[_0x62b1('0x47')](db[_0x62b1('0x2b')]['rawAttributes']);_0x50e72f[_0x62b1('0x31')]=_['keys'](_0xe2d384[_0x62b1('0x31')]);_0x50e72f[_0x62b1('0x32')]=_[_0x62b1('0x33')](_0x50e72f[_0x62b1('0x30')],_0x50e72f[_0x62b1('0x31')]);_0x2932d7[_0x62b1('0x34')]=_['intersection'](_0x50e72f[_0x62b1('0x30')],qs['fields'](_0xe2d384[_0x62b1('0x31')]['fields']));_0x2932d7['attributes']=_0x2932d7[_0x62b1('0x34')][_0x62b1('0x36')]?_0x2932d7['attributes']:_0x50e72f[_0x62b1('0x30')];if(_0xe2d384['query'][_0x62b1('0x41')]){_0x2932d7[_0x62b1('0x42')]=[{'all':!![]}];}_0x2932d7=_[_0x62b1('0x3d')]({},_0x2932d7,_0xe2d384[_0x62b1('0x3f')]);return db[_0x62b1('0x2b')]['find'](_0x2932d7)['then'](handleEntityNotFound(_0x3ac7d7,null))[_0x62b1('0x23')](respondWithResult(_0x3ac7d7,null))[_0x62b1('0x44')](handleError(_0x3ac7d7,null));};exports[_0x62b1('0x48')]=function(_0x43d2fd,_0x423dfc){return db[_0x62b1('0x2b')][_0x62b1('0x48')](_0x43d2fd['body'],{})['then'](respondWithResult(_0x423dfc,0xc9))[_0x62b1('0x44')](handleError(_0x423dfc,null));};exports[_0x62b1('0x22')]=function(_0x9a4b3c,_0x32bcea){if(_0x9a4b3c[_0x62b1('0x49')]['id']){delete _0x9a4b3c['body']['id'];}return db[_0x62b1('0x2b')][_0x62b1('0x4a')]({'where':{'id':_0x9a4b3c[_0x62b1('0x46')]['id']}})[_0x62b1('0x23')](handleEntityNotFound(_0x32bcea,null))['then'](saveUpdates(_0x9a4b3c['body'],null))[_0x62b1('0x23')](respondWithResult(_0x32bcea,null))['catch'](handleError(_0x32bcea,null));};exports[_0x62b1('0x4b')]=function(_0x13f181,_0x405e59){return db[_0x62b1('0x2b')]['find']({'where':{'id':_0x13f181[_0x62b1('0x46')]['id']}})[_0x62b1('0x23')](handleEntityNotFound(_0x405e59,null))[_0x62b1('0x23')](removeEntity(_0x405e59,null))[_0x62b1('0x44')](handleError(_0x405e59,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 13435b8..eb791d8 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 _0x9a70=['exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./openchannelApplication.attributes'];(function(_0x521cd8,_0x501348){var _0x12425d=function(_0x67d3a){while(--_0x67d3a){_0x521cd8['push'](_0x521cd8['shift']());}};_0x12425d(++_0x501348);}(_0x9a70,0x18d));var _0x09a7=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x9a70[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x09a7('0x0'));var util=require(_0x09a7('0x1'));var logger=require(_0x09a7('0x2'))(_0x09a7('0x3'));var moment=require(_0x09a7('0x4'));var BPromise=require(_0x09a7('0x5'));var rp=require(_0x09a7('0x6'));var fs=require('fs');var path=require(_0x09a7('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x09a7('0x8'));module[_0x09a7('0x9')]=function(_0xdeab95,_0x377a75){return _0xdeab95[_0x09a7('0xa')](_0x09a7('0xb'),attributes,{'tableName':_0x09a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x09a7('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc55c=['moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0xf32a17,_0x230e17){var _0x3131a6=function(_0x3eb6b6){while(--_0x3eb6b6){_0xf32a17['push'](_0xf32a17['shift']());}};_0x3131a6(++_0x230e17);}(_0xc55c,0x1d1));var _0xcc55=function(_0x372d1d,_0x4a1989){_0x372d1d=_0x372d1d-0x0;var _0x39d9bb=_0xc55c[_0x372d1d];return _0x39d9bb;};'use strict';var _=require(_0xcc55('0x0'));var util=require(_0xcc55('0x1'));var logger=require(_0xcc55('0x2'))('api');var moment=require(_0xcc55('0x3'));var BPromise=require(_0xcc55('0x4'));var rp=require(_0xcc55('0x5'));var fs=require('fs');var path=require(_0xcc55('0x6'));var rimraf=require(_0xcc55('0x7'));var config=require('../../config/environment');var attributes=require(_0xcc55('0x8'));module[_0xcc55('0x9')]=function(_0x33f398,_0x10e6e0){return _0x33f398[_0xcc55('0xa')]('OpenchannelApplication',attributes,{'tableName':_0xcc55('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcc55('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 8ea5ba2..c671111 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0xcde186,_0x1d0e5b){var _0x1d6208=function(_0x2cd3a2){while(--_0x2cd3a2){_0xcde186['push'](_0xcde186['shift']());}};_0x1d6208(++_0x1d0e5b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x11bc0f,_0x373666){_0x11bc0f=_0x11bc0f-0x0;var _0x3ab0d1=_0x5f2f[_0x11bc0f];return _0x3ab0d1;};'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')]('OpenchannelApplication,\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);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ 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(_0x5c7d4b,_0x305110){var _0x422e90=function(_0x23153f){while(--_0x23153f){_0x5c7d4b['push'](_0x5c7d4b['shift']());}};_0x422e90(++_0x305110);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0xb10b[_0x4b6778];return _0x22dbb9;};'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 c93918a..ec6bf2b 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 _0x8905=['put','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','util','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','describe','get','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked'];(function(_0x5cf40a,_0x21e31f){var _0x26216d=function(_0x82a779){while(--_0x82a779){_0x5cf40a['push'](_0x5cf40a['shift']());}};_0x26216d(++_0x21e31f);}(_0x8905,0x8f));var _0x5890=function(_0x55a374,_0x35aa72){_0x55a374=_0x55a374-0x0;var _0xa4c10=_0x8905[_0x55a374];return _0xa4c10;};'use strict';var multer=require('multer');var util=require(_0x5890('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5890('0x1'));var router=express[_0x5890('0x2')]();var auth=require(_0x5890('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x5890('0x4'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0x5890('0x5')](),controller[_0x5890('0x6')]);router['get']('/describe',auth[_0x5890('0x5')](),controller[_0x5890('0x7')]);router[_0x5890('0x8')](_0x5890('0x9'),auth['isAuthenticated'](),controller[_0x5890('0xa')]);router['get'](_0x5890('0xb'),auth[_0x5890('0x5')](),controller[_0x5890('0xc')]);router[_0x5890('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x5890('0xd')]);router[_0x5890('0xe')]('/',auth[_0x5890('0x5')](),controller[_0x5890('0xf')]);router[_0x5890('0xe')](_0x5890('0xb'),auth[_0x5890('0x5')](),controller[_0x5890('0x10')]);router['post'](_0x5890('0x11'),auth[_0x5890('0x5')](),interaction[_0x5890('0x12')]('openchannel','openchannelinteraction:addtags'),controller['addTags']);router[_0x5890('0x13')](_0x5890('0x9'),auth[_0x5890('0x5')](),interaction['tracked'](_0x5890('0x14'),_0x5890('0x15')),controller[_0x5890('0x16')]);router[_0x5890('0x17')]('/:id',auth[_0x5890('0x5')](),interaction[_0x5890('0x12')](_0x5890('0x14'),_0x5890('0x18')),controller[_0x5890('0x19')]);router[_0x5890('0x17')](_0x5890('0x11'),auth[_0x5890('0x5')](),controller[_0x5890('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xd1e9=['show','/:id/messages','/:id/download','download','post','create','/:id/tags','openchannel','openchannelinteraction:addtags','tracked','openchannelinteraction:update','update','/:id','openchannelinteraction:destroy','destroy','delete','removeTags','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x317018,_0x149405){var _0x415d3e=function(_0xfa52f5){while(--_0xfa52f5){_0x317018['push'](_0x317018['shift']());}};_0x415d3e(++_0x149405);}(_0xd1e9,0xf1));var _0x9d1e=function(_0x478754,_0x1ceb87){_0x478754=_0x478754-0x0;var _0x30b765=_0xd1e9[_0x478754];return _0x30b765;};'use strict';var multer=require(_0x9d1e('0x0'));var util=require('util');var path=require(_0x9d1e('0x1'));var timeout=require(_0x9d1e('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9d1e('0x3'));var config=require(_0x9d1e('0x4'));var controller=require(_0x9d1e('0x5'));router[_0x9d1e('0x6')]('/',auth['isAuthenticated'](),controller[_0x9d1e('0x7')]);router[_0x9d1e('0x6')](_0x9d1e('0x8'),auth[_0x9d1e('0x9')](),controller[_0x9d1e('0xa')]);router[_0x9d1e('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x9d1e('0xb')]);router[_0x9d1e('0x6')](_0x9d1e('0xc'),auth[_0x9d1e('0x9')](),controller['getMessages']);router['get'](_0x9d1e('0xd'),auth[_0x9d1e('0x9')](),controller[_0x9d1e('0xe')]);router[_0x9d1e('0xf')]('/',auth['isAuthenticated'](),controller[_0x9d1e('0x10')]);router[_0x9d1e('0xf')](_0x9d1e('0xc'),auth[_0x9d1e('0x9')](),controller['addMessage']);router['post'](_0x9d1e('0x11'),auth['isAuthenticated'](),interaction['tracked'](_0x9d1e('0x12'),_0x9d1e('0x13')),controller['addTags']);router['put']('/:id',auth[_0x9d1e('0x9')](),interaction[_0x9d1e('0x14')](_0x9d1e('0x12'),_0x9d1e('0x15')),controller[_0x9d1e('0x16')]);router['delete'](_0x9d1e('0x17'),auth[_0x9d1e('0x9')](),interaction[_0x9d1e('0x14')](_0x9d1e('0x12'),_0x9d1e('0x18')),controller[_0x9d1e('0x19')]);router[_0x9d1e('0x1a')]('/:id/tags',auth[_0x9d1e('0x9')](),controller[_0x9d1e('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 5a43589..9134190 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 _0xd202=['STRING','DATE','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x361026,_0x2375e2){var _0x37028e=function(_0x4f89e0){while(--_0x4f89e0){_0x361026['push'](_0x361026['shift']());}};_0x37028e(++_0x2375e2);}(_0xd202,0x19a));var _0x2d20=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xd202[_0x24f31b];return _0x488401;};'use strict';var Sequelize=require(_0x2d20('0x0'));module[_0x2d20('0x1')]={'closed':{'type':Sequelize[_0x2d20('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2d20('0x3')]},'note':{'type':Sequelize[_0x2d20('0x3')]},'read1stAt':{'type':Sequelize[_0x2d20('0x4')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x2d20('0x3')]},'lastMsgAt':{'type':Sequelize[_0x2d20('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x2d20('0x5')]('in',_0x2d20('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x2d20('0x3')]}}; \ No newline at end of file +var _0xfc53=['STRING','ENUM','out','exports','BOOLEAN','DATE'];(function(_0x69145b,_0x315f1f){var _0x4e4fe8=function(_0x2cc1c5){while(--_0x2cc1c5){_0x69145b['push'](_0x69145b['shift']());}};_0x4e4fe8(++_0x315f1f);}(_0xfc53,0x177));var _0x3fc5=function(_0x3af74d,_0x277d86){_0x3af74d=_0x3af74d-0x0;var _0x3d6853=_0xfc53[_0x3af74d];return _0x3d6853;};'use strict';var Sequelize=require('sequelize');module[_0x3fc5('0x0')]={'closed':{'type':Sequelize[_0x3fc5('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3fc5('0x2')]},'disposition':{'type':Sequelize[_0x3fc5('0x3')]},'note':{'type':Sequelize[_0x3fc5('0x3')]},'read1stAt':{'type':Sequelize[_0x3fc5('0x2')]},'threadId':{'type':Sequelize[_0x3fc5('0x3')]},'externalUrl':{'type':Sequelize[_0x3fc5('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3fc5('0x4')]('in',_0x3fc5('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x3fc5('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 0518ed9..86d07a8 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 _0x9efb=['i.*','c.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','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','params','includeAll','include','options','destroy','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','$gte','format','findAll','rows','setTags','emit','openchannelInteractionTags:save','removeTags','unix','join','root','server','tmp','files','transcript-%d-%s.zip','fullname','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','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','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','basename','existsSync','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.html','toFile','transcript-','download','log','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','status','end','count','offset','limit','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','Users','map','TagIds','split','Tags','catch','index','OpenchannelInteraction','rawAttributes','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','select','field','from','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','OpenchannelAccountId','concat','createdAt','parse','where','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition'];(function(_0x1ee0ef,_0x313286){var _0x160235=function(_0x3b2aba){while(--_0x3b2aba){_0x1ee0ef['push'](_0x1ee0ef['shift']());}};_0x160235(++_0x313286);}(_0x9efb,0x143));var _0xb9ef=function(_0x332e4c,_0x5589cc){_0x332e4c=_0x332e4c-0x0;var _0x1ecc62=_0x9efb[_0x332e4c];return _0x1ecc62;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb9ef('0x0'));var rimraf=require(_0xb9ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9ef('0x2'));var rp=require(_0xb9ef('0x3'));var moment=require('moment');var BPromise=require(_0xb9ef('0x4'));var Mustache=require(_0xb9ef('0x5'));var util=require(_0xb9ef('0x6'));var path=require(_0xb9ef('0x7'));var sox=require(_0xb9ef('0x8'));var csv=require(_0xb9ef('0x9'));var ejs=require(_0xb9ef('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb9ef('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb9ef('0x9'));var querystring=require(_0xb9ef('0xc'));var Papa=require(_0xb9ef('0xd'));var Redis=require(_0xb9ef('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb9ef('0xf'));var as=require(_0xb9ef('0x10'));var hardwareService=require(_0xb9ef('0x11'));var logger=require(_0xb9ef('0x12'))('api');var utils=require(_0xb9ef('0x13'));var config=require(_0xb9ef('0x14'));var db=require(_0xb9ef('0x15'))['db'];config[_0xb9ef('0x16')]=_[_0xb9ef('0x17')](config[_0xb9ef('0x16')],{'host':_0xb9ef('0x18'),'port':0x18eb});var socket=require(_0xb9ef('0x19'))(new Redis(config[_0xb9ef('0x16')]));require(_0xb9ef('0x1a'))['register'](socket);function respondWithStatusCode(_0x1580b1,_0x3a01fe){_0x3a01fe=_0x3a01fe||0xcc;return function(_0x512fe8){if(_0x512fe8){return _0x1580b1['sendStatus'](_0x3a01fe);}return _0x1580b1[_0xb9ef('0x1b')](_0x3a01fe)[_0xb9ef('0x1c')]();};}function respondWithResult(_0x185902,_0x11fb09){_0x11fb09=_0x11fb09||0xc8;return function(_0x51c9fa){if(_0x51c9fa){return _0x185902['status'](_0x11fb09)['json'](_0x51c9fa);}};}function respondWithFilteredResult(_0xf155f0,_0x18a58d){return function(_0x51a3e8){if(_0x51a3e8){var _0x386ef3=_0x51a3e8[_0xb9ef('0x1d')],_0x296df6=_0x18a58d[_0xb9ef('0x1e')],_0x4cc517=_0x18a58d[_0xb9ef('0x1e')]+_0x18a58d[_0xb9ef('0x1f')],_0x2387e2;if(_0x4cc517>=_0x386ef3){_0x4cc517=_0x386ef3;_0x2387e2=0xc8;}else{_0x2387e2=0xce;}_0xf155f0[_0xb9ef('0x1b')](_0x2387e2);return _0xf155f0[_0xb9ef('0x20')](_0xb9ef('0x21'),_0x296df6+'-'+_0x4cc517+'/'+_0x386ef3)['json'](_0x51a3e8);}return null;};}function patchUpdates(_0x43b069){return function(_0x45371d){try{jsonpatch['apply'](_0x45371d,_0x43b069,!![]);}catch(_0x42b88f){return BPromise[_0xb9ef('0x22')](_0x42b88f);}return _0x45371d[_0xb9ef('0x23')]();};}function saveUpdates(_0x2f75c1,_0x56162c){return function(_0x9a6690){if(_0x9a6690){return _0x9a6690[_0xb9ef('0x24')](_0x2f75c1)[_0xb9ef('0x25')](function(_0x55143c){return _0x55143c;});}return null;};}function removeEntity(_0x2ad52b,_0x576ac0){return function(_0x5c5622){if(_0x5c5622){return _0x5c5622['destroy']()[_0xb9ef('0x25')](function(){_0x2ad52b[_0xb9ef('0x1b')](0xcc)[_0xb9ef('0x1c')]();});}};}function handleEntityNotFound(_0x267a9a,_0x4d00dc){return function(_0x10991b){if(!_0x10991b){_0x267a9a[_0xb9ef('0x26')](0x194);}return _0x10991b;};}function handleError(_0x596641,_0x43b6d7){_0x43b6d7=_0x43b6d7||0x1f4;return function(_0x11d58f){logger[_0xb9ef('0x27')](_0x11d58f[_0xb9ef('0x28')]);if(_0x11d58f[_0xb9ef('0x29')]){delete _0x11d58f['name'];}_0x596641['status'](_0x43b6d7)[_0xb9ef('0x2a')](_0x11d58f);};}function getInteractionUsers(_0x1fc456,_0x3f36e9){return new BPromise(function(_0x440e78,_0x25a30f){try{if(_0x3f36e9[_0x1fc456['id']]){_0x1fc456[_0xb9ef('0x2b')]=_[_0xb9ef('0x2c')](_0x3f36e9[_0x1fc456['id']],function(_0x124f4f){return{'id':_0x124f4f['id'],'fullname':_0x124f4f['fullname']};});}}catch(_0x2853ae){_0x25a30f(_0x2853ae);}_0x440e78(_0x1fc456);});}function getInteractionTags(_0x43e4eb,_0xd96258){return new BPromise(function(_0x557b0c,_0x580f50){try{if(_0x43e4eb[_0xb9ef('0x2d')]){_0x43e4eb['Tags']=[];_0x43e4eb[_0xb9ef('0x2d')][_0xb9ef('0x2e')](',')['forEach'](function(_0x1f78a1){_0x43e4eb[_0xb9ef('0x2f')]['push'](_0xd96258[_0x1f78a1]);});}delete _0x43e4eb[_0xb9ef('0x2d')];}catch(_0x446853){_0x580f50(_0x446853);}_0x557b0c(_0x43e4eb);});}function updateOpenchannelInteraction(_0xf5648,_0x146fcf,_0x1fbbba){return new BPromise(function(_0x41fce2,_0x1fede3){return getInteractionUsers(_0xf5648,_0x1fbbba)[_0xb9ef('0x25')](function(_0x15f360){return getInteractionTags(_0x15f360,_0x146fcf);})[_0xb9ef('0x25')](function(_0x449929){_0x41fce2(_0x449929);})[_0xb9ef('0x30')](function(_0x5b5584){_0x1fede3(_0x5b5584);});});}exports[_0xb9ef('0x31')]=function(_0x24bf9c,_0x4fd975){var _0xde6866={},_0xb0db0c={},_0x1cc73e={'count':0x0,'rows':[]};var _0x967de5=_[_0xb9ef('0x2c')](db[_0xb9ef('0x32')][_0xb9ef('0x33')],function(_0x588221){return{'name':_0x588221['fieldName'],'type':_0x588221[_0xb9ef('0x34')]['key']};});_0xb0db0c[_0xb9ef('0x35')]=_[_0xb9ef('0x2c')](_0x967de5,_0xb9ef('0x29'));_0xb0db0c[_0xb9ef('0x36')]=_[_0xb9ef('0x37')](_0x24bf9c[_0xb9ef('0x36')]);_0xb0db0c['filters']=_['intersection'](_0xb0db0c[_0xb9ef('0x35')],_0xb0db0c['query']);_0xde6866[_0xb9ef('0x38')]=_[_0xb9ef('0x39')](_0xb0db0c[_0xb9ef('0x35')],qs[_0xb9ef('0x3a')](_0x24bf9c[_0xb9ef('0x36')][_0xb9ef('0x3a')]));_0xde6866[_0xb9ef('0x38')]=_0xde6866[_0xb9ef('0x38')]['length']?_0xde6866[_0xb9ef('0x38')]:_0xb0db0c[_0xb9ef('0x35')];if(!_0x24bf9c[_0xb9ef('0x36')][_0xb9ef('0x3b')](_0xb9ef('0x3c'))){_0xde6866[_0xb9ef('0x1f')]=qs[_0xb9ef('0x1f')](_0x24bf9c[_0xb9ef('0x36')][_0xb9ef('0x1f')]);_0xde6866[_0xb9ef('0x1e')]=qs[_0xb9ef('0x1e')](_0x24bf9c['query']['offset']);}_0xde6866[_0xb9ef('0x3d')]=qs[_0xb9ef('0x3e')](_0x24bf9c[_0xb9ef('0x36')][_0xb9ef('0x3e')]);_0xde6866['where']=qs[_0xb9ef('0x3f')](_[_0xb9ef('0x40')](_0x24bf9c['query'],_0xb0db0c[_0xb9ef('0x3f')]),_0x967de5);var _0x25bdb2=[];var _0x17f898=squel[_0xb9ef('0x41')]()['field']('id')[_0xb9ef('0x42')](_0xb9ef('0x29'))['field']('color')[_0xb9ef('0x43')]('tools_tags');var _0x112c40=squel['select']()[_0xb9ef('0x42')](_0xb9ef('0x44'))[_0xb9ef('0x42')](_0xb9ef('0x45'))[_0xb9ef('0x42')](_0xb9ef('0x46'))['from'](_0xb9ef('0x47'),'ui')[_0xb9ef('0x48')]('users','u',_0xb9ef('0x49'));var _0x2b863f=squel[_0xb9ef('0x41')]()[_0xb9ef('0x43')](_0xb9ef('0x4a'),'i')[_0xb9ef('0x48')]('cm_contacts','c',_0xb9ef('0x4b'))['left_join']('users','o',_0xb9ef('0x4c'))[_0xb9ef('0x48')]('openchannel_accounts','a',_0xb9ef('0x4d'))[_0xb9ef('0x48')](_0xb9ef('0x4e'),'me',_0xb9ef('0x4f'))[_0xb9ef('0x48')]('openchannel_interaction_has_tags','it',_0xb9ef('0x50'))['left_join'](_0xb9ef('0x51'),'t',_0xb9ef('0x52'));var _0x290994=squel[_0xb9ef('0x53')]();var _0x1a71bc=[];var _0x1cbd3f=squel[_0xb9ef('0x53')]();var _0x20f6d5;if(_0x24bf9c['query'][_0xb9ef('0x54')]){_0x20f6d5=as[_0xb9ef('0x55')](_0x24bf9c[_0xb9ef('0x36')][_0xb9ef('0x54')]);var _0x382720=_0x20f6d5['sqlOperator'];for(var _0x218816=0x0;_0x218816<_0x20f6d5[_0xb9ef('0x56')][_0xb9ef('0x57')];_0x218816++){var _0x1f0e25=_0x20f6d5['conditions'][_0x218816];var _0x3da75f='i';var _0x52dab9=_[_0xb9ef('0x58')](_0x967de5,[_0xb9ef('0x29'),_0x1f0e25[_0xb9ef('0x42')]]);if(!_0x52dab9){switch(_0x1f0e25[_0xb9ef('0x42')]){case _0xb9ef('0x59'):if(_0x1f0e25[_0xb9ef('0x5a')]==0x1){_0x2b863f['having']('`'+_0x1f0e25[_0xb9ef('0x42')]+_0xb9ef('0x5b'));}else{_0x2b863f['having']('`'+_0x1f0e25[_0xb9ef('0x42')]+_0xb9ef('0x5c'));}break;case'Contact':if(_0x1f0e25[_0xb9ef('0x5d')]===_0xb9ef('0x5e')){if(_0x1f0e25['value'][_0xb9ef('0x2e')]('\x20')['length']>0x1){_0x290994[_0x382720]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb9ef('0x5f')](_0x1f0e25['value']),null);}else{var _0x1e66c9='%'+_0x1f0e25['value']+'%';_0x290994[_0x382720](_0xb9ef('0x60'),_0x1e66c9,_0x1e66c9,_0x1e66c9);}}else{_0x52dab9=_[_0xb9ef('0x58')](_0x967de5,[_0xb9ef('0x29'),_0xb9ef('0x61')]);_0x1f0e25[_0xb9ef('0x42')]=_0xb9ef('0x61');_0x35f135=as[_0xb9ef('0x62')](_0x3da75f,_0x52dab9['type'],_0x1f0e25);_0x290994[_0x382720](_0x35f135[_0xb9ef('0x63')],_0x35f135[_0xb9ef('0x5a')][_0xb9ef('0x64')],_0x35f135[_0xb9ef('0x5a')]['end']);}break;case _0xb9ef('0x65'):var _0x249a04=_0x1f0e25[_0xb9ef('0x5a')]['split'](',')[_0xb9ef('0x2c')](function(_0x1310d4){return Number(_0x1310d4);});_0x249a04[_0xb9ef('0x66')](function(_0xc2e837){_0x1cbd3f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xc2e837+',%');});_0x1a71bc=_[_0xb9ef('0x67')](_0x1a71bc,_0x249a04);break;case _0xb9ef('0x68'):if(_0x1f0e25[_0xb9ef('0x5d')]===_0xb9ef('0x5e')){_0x290994[_0x382720](_0xb9ef('0x69'),'%'+_0x1f0e25[_0xb9ef('0x5a')]+'%',null);}else{_0x52dab9=_[_0xb9ef('0x58')](_0x967de5,[_0xb9ef('0x29'),'UserId']);_0x1f0e25['field']=_0xb9ef('0x6a');_0x35f135=as[_0xb9ef('0x62')](_0x3da75f,_0x52dab9['type'],_0x1f0e25);_0x290994[_0x382720](_0x35f135[_0xb9ef('0x63')],_0x35f135['value']['start'],_0x35f135[_0xb9ef('0x5a')][_0xb9ef('0x1c')]);}break;case _0xb9ef('0x6b'):_0x35f135=as[_0xb9ef('0x62')]('me',null,_0x1f0e25);_0x290994[_0x382720](_0x35f135['text'],_0x35f135['value'][_0xb9ef('0x64')],_0x35f135[_0xb9ef('0x5a')][_0xb9ef('0x1c')]);break;}}else{var _0x35f135=as['buildExpression'](_0x3da75f,_0x52dab9['type'],_0x1f0e25);_0x290994[_0x382720](_0x35f135['text'],_0x35f135[_0xb9ef('0x5a')]['start'],_0x35f135['value'][_0xb9ef('0x1c')]);}}}else{var _0x5df8bf=_(_0x24bf9c[_0xb9ef('0x36')])[_0xb9ef('0x37')]()[_0xb9ef('0x2c')](function(_0x4e1aca){return _[_0xb9ef('0x6c')](_0x967de5,[_0xb9ef('0x29'),_0x4e1aca])?_0x4e1aca:undefined;})[_0xb9ef('0x6d')]()['value']();if(!_['isEmpty'](_0x5df8bf)){_0x5df8bf[_0xb9ef('0x66')](function(_0x32a622){if(_0x32a622===_0xb9ef('0x6e')){_0x2b863f['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0xb9ef('0x6f')](_0x24bf9c[_0xb9ef('0x36')][_0x32a622]));}else if(_0x32a622===_0xb9ef('0x70')){var _0x36fad6=JSON[_0xb9ef('0x71')](_0x24bf9c[_0xb9ef('0x36')][_0x32a622])['$gte'];var _0x50fc37=JSON[_0xb9ef('0x71')](_0x24bf9c[_0xb9ef('0x36')][_0x32a622])['$lte'];_0x2b863f[_0xb9ef('0x72')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x36fad6,_0x50fc37);}else{if(_0x24bf9c['query'][_0x32a622]==='null'){_0x2b863f[_0xb9ef('0x72')]('i.'+_0x32a622+_0xb9ef('0x73'));}else{_0x2b863f[_0xb9ef('0x72')]('i.'+_0x32a622+_0xb9ef('0x74'),_0x24bf9c[_0xb9ef('0x36')][_0x32a622]);}}});}if(_0x24bf9c[_0xb9ef('0x36')][_0xb9ef('0x75')]){if(_0x24bf9c['query'][_0xb9ef('0x75')]==0x1){_0x2b863f[_0xb9ef('0x76')](_0xb9ef('0x77'));}else{_0x2b863f[_0xb9ef('0x76')]('`unreadMessages`\x20>\x200');}}if(_0x24bf9c['query'][_0xb9ef('0x78')]){_0x1a71bc=_['isArray'](_0x24bf9c[_0xb9ef('0x36')][_0xb9ef('0x78')])?_0x24bf9c[_0xb9ef('0x36')][_0xb9ef('0x78')]:new Array(_0x24bf9c[_0xb9ef('0x36')][_0xb9ef('0x78')]);_0x1a71bc[_0xb9ef('0x66')](function(_0x2b6aef){_0x1cbd3f['or'](_0xb9ef('0x79'),'%,'+_0x2b6aef+',%');});}if(_0x24bf9c[_0xb9ef('0x36')][_0xb9ef('0x7a')]){var _0x96672b=_0x24bf9c[_0xb9ef('0x36')][_0xb9ef('0x7a')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xb9ef('0x7b'));if(qs[_0xb9ef('0x7c')](_0x96672b)){_0x290994['or'](_0xb9ef('0x7d'),_0x96672b+'%');}else{_0x290994['or'](_0xb9ef('0x7e'),qs['getFullTextValue'](_0x96672b))['or'](_0xb9ef('0x7f'),_0x96672b+'%')['or'](_0xb9ef('0x80'),_0x96672b+'%');}}}_0x2b863f[_0xb9ef('0x72')](_0x290994);_0x2b863f['group'](_0xb9ef('0x81'));var _0xc118f8={'type':db['Sequelize'][_0xb9ef('0x82')]['SELECT'],'raw':!![]};var _0x157b9=_0x2b863f[_0xb9ef('0x83')]();_0x157b9[_0xb9ef('0x42')](_0xb9ef('0x81'));_0x157b9[_0xb9ef('0x42')](_0xb9ef('0x84'),_0xb9ef('0x59'));if(_0xde6866[_0xb9ef('0x3d')]){_0xde6866[_0xb9ef('0x3d')][_0xb9ef('0x66')](function(_0x33c5ee){_0x2b863f[_0xb9ef('0x3d')]('i.'+_0x33c5ee[0x0],_0x33c5ee[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb9ef('0x85')](_0x1a71bc)){_0x2b863f[_0xb9ef('0x76')](_0x1cbd3f);_0x157b9[_0xb9ef('0x72')](_0xb9ef('0x86'),_0x1a71bc);}BPromise[_0xb9ef('0x87')]()[_0xb9ef('0x25')](function(){if(!_0x20f6d5){if(_0x24bf9c[_0xb9ef('0x36')][_0xb9ef('0x6e')]||_0x24bf9c[_0xb9ef('0x36')][_0xb9ef('0x88')])return;_0x157b9['where'](_0xb9ef('0x89'));_0x2b863f[_0xb9ef('0x72')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}return _0x24bf9c[_0xb9ef('0x8a')][_0xb9ef('0x8b')]({'attributes':['id'],'raw':!![]})[_0xb9ef('0x25')](function(_0x4a83d5){if(_[_0xb9ef('0x85')](_0x4a83d5)){_0x157b9[_0xb9ef('0x72')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x2b863f[_0xb9ef('0x72')](_0xb9ef('0x8c'));}else{_0x157b9[_0xb9ef('0x72')](_0xb9ef('0x8d'),_[_0xb9ef('0x2c')](_0x4a83d5,'id'));_0x2b863f[_0xb9ef('0x72')](_0xb9ef('0x8d'),_[_0xb9ef('0x2c')](_0x4a83d5,'id'));}});})['then'](function(){db[_0xb9ef('0x8e')][_0xb9ef('0x36')](_0x157b9[_0xb9ef('0x8f')](),_0xc118f8)['then'](function(_0x49dc01){_0x1cc73e[_0xb9ef('0x1d')]=_0x49dc01['length'];if(_0x1cc73e[_0xb9ef('0x1d')]===0x0)return[];return db[_0xb9ef('0x8e')]['query'](_0x17f898['toString'](),_0xc118f8)[_0xb9ef('0x25')](function(_0x3ff877){_0x25bdb2=_[_0xb9ef('0x90')](_0x3ff877,'id');_0xc118f8=_[_0xb9ef('0x91')](_0xc118f8,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x24bf9c[_0xb9ef('0x36')][_0xb9ef('0x3a')]){_0xde6866[_0xb9ef('0x38')][_0xb9ef('0x66')](function(_0x2f7d94){_0x2b863f[_0xb9ef('0x42')]('i.'+_0x2f7d94);});}else{_0x2b863f[_0xb9ef('0x42')](_0xb9ef('0x84'),_0xb9ef('0x59'));_0x2b863f['field'](_0xb9ef('0x92'),_0xb9ef('0x93'));_0x2b863f[_0xb9ef('0x42')]('a.mandatoryDisposition',_0xb9ef('0x94'));_0x2b863f['field'](_0xb9ef('0x95'));_0x2b863f[_0xb9ef('0x42')](_0xb9ef('0x96'),'Contact.firstName');_0x2b863f[_0xb9ef('0x42')](_0xb9ef('0x97'),_0xb9ef('0x98'));_0x2b863f[_0xb9ef('0x42')](_0xb9ef('0x99'),_0xb9ef('0x9a'));_0x2b863f[_0xb9ef('0x42')](_0xb9ef('0x9b'),_0xb9ef('0x9c'));_0x2b863f['field'](_0xb9ef('0x9d'),'Contact.mobile');_0x2b863f[_0xb9ef('0x42')](_0xb9ef('0x9e'),_0xb9ef('0x9f'));_0x2b863f[_0xb9ef('0x42')](_0xb9ef('0xa0'),_0xb9ef('0xa1'));_0x2b863f[_0xb9ef('0x42')](_0xb9ef('0xa2'),_0xb9ef('0xa3'));_0x2b863f[_0xb9ef('0x42')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0xde6866[_0xb9ef('0x1f')])_0x2b863f['limit'](_0xde6866[_0xb9ef('0x1f')]);if(_0xde6866[_0xb9ef('0x1e')])_0x2b863f[_0xb9ef('0x1e')](_0xde6866[_0xb9ef('0x1e')]);return db[_0xb9ef('0x8e')][_0xb9ef('0x36')](_0x2b863f[_0xb9ef('0x8f')](),_0xc118f8);})[_0xb9ef('0x25')](function(_0x5e1c1f){_0x112c40[_0xb9ef('0x72')](_0xb9ef('0xa4'),_['map'](_0x5e1c1f,'id'));return db[_0xb9ef('0x8e')][_0xb9ef('0x36')](_0x112c40[_0xb9ef('0x8f')](),_0xc118f8)[_0xb9ef('0x25')](function(_0x3ef20b){var _0x4440a0=_[_0xb9ef('0xa5')](_0x3ef20b,_0xb9ef('0xa6'));var _0x311501=[];_0x5e1c1f[_0xb9ef('0x66')](function(_0x5de35d){_0x311501[_0xb9ef('0xa7')](updateOpenchannelInteraction(_0x5de35d,_0x25bdb2,_0x4440a0));});return BPromise[_0xb9ef('0xa8')](_0x311501);});});})[_0xb9ef('0x25')](function(_0x2cb917){_0x1cc73e['rows']=_0x2cb917;return _0x1cc73e;})[_0xb9ef('0x25')](respondWithFilteredResult(_0x4fd975,_0xde6866));})[_0xb9ef('0x30')](handleError(_0x4fd975,null));};exports['show']=function(_0x37e0d8,_0x2b1851){var _0x46bbd9={'raw':![],'where':{'id':_0x37e0d8[_0xb9ef('0xa9')]['id']}},_0x52c59e={};_0x52c59e[_0xb9ef('0x35')]=_['keys'](db[_0xb9ef('0x32')]['rawAttributes']);_0x52c59e[_0xb9ef('0x36')]=_['keys'](_0x37e0d8[_0xb9ef('0x36')]);_0x52c59e[_0xb9ef('0x3f')]=_[_0xb9ef('0x39')](_0x52c59e['model'],_0x52c59e[_0xb9ef('0x36')]);_0x46bbd9[_0xb9ef('0x38')]=_['intersection'](_0x52c59e[_0xb9ef('0x35')],qs['fields'](_0x37e0d8['query'][_0xb9ef('0x3a')]));_0x46bbd9[_0xb9ef('0x38')]=_0x46bbd9[_0xb9ef('0x38')][_0xb9ef('0x57')]?_0x46bbd9[_0xb9ef('0x38')]:_0x52c59e['model'];if(_0x37e0d8[_0xb9ef('0x36')][_0xb9ef('0xaa')]){_0x46bbd9[_0xb9ef('0xab')]=[{'all':!![]}];}_0x46bbd9=_['merge']({},_0x46bbd9,_0x37e0d8[_0xb9ef('0xac')]);return db[_0xb9ef('0x32')][_0xb9ef('0x58')](_0x46bbd9)['then'](handleEntityNotFound(_0x2b1851,null))[_0xb9ef('0x25')](respondWithResult(_0x2b1851,null))['catch'](handleError(_0x2b1851,null));};exports['create']=function(_0x55c429,_0x2f878b){return db[_0xb9ef('0x32')]['create'](_0x55c429[_0xb9ef('0x6b')],{})[_0xb9ef('0x25')](respondWithResult(_0x2f878b,0xc9))[_0xb9ef('0x30')](handleError(_0x2f878b,null));};exports[_0xb9ef('0x24')]=function(_0x2d09a1,_0x3b6e9b){if(_0x2d09a1['body']['id']){delete _0x2d09a1[_0xb9ef('0x6b')]['id'];}return db[_0xb9ef('0x32')][_0xb9ef('0x58')]({'where':{'id':_0x2d09a1[_0xb9ef('0xa9')]['id']}})[_0xb9ef('0x25')](handleEntityNotFound(_0x3b6e9b,null))['then'](saveUpdates(_0x2d09a1[_0xb9ef('0x6b')],null))[_0xb9ef('0x25')](respondWithResult(_0x3b6e9b,null))[_0xb9ef('0x30')](handleError(_0x3b6e9b,null));};exports[_0xb9ef('0xad')]=function(_0x441058,_0x3fd783){return db[_0xb9ef('0x32')][_0xb9ef('0x58')]({'where':{'id':_0x441058['params']['id']}})[_0xb9ef('0x25')](handleEntityNotFound(_0x3fd783,null))[_0xb9ef('0x25')](removeEntity(_0x3fd783,null))['catch'](handleError(_0x3fd783,null));};exports[_0xb9ef('0xae')]=function(_0x4ea8f7,_0x502241){return db[_0xb9ef('0x32')][_0xb9ef('0xae')]()[_0xb9ef('0x25')](respondWithResult(_0x502241,null))[_0xb9ef('0x30')](handleError(_0x502241,null));};exports['addMessage']=function(_0x2224ff,_0x23a54f,_0x502446){return db[_0xb9ef('0xaf')][_0xb9ef('0x58')]({'where':{'id':_0x2224ff[_0xb9ef('0xa9')]['id']}})[_0xb9ef('0x25')](handleEntityNotFound(_0x23a54f,null))[_0xb9ef('0x25')](function(_0x2869b3){if(_0x2869b3){return _0x2869b3[_0xb9ef('0xb0')](_0x2224ff[_0xb9ef('0x6b')][_0xb9ef('0xb1')],_[_0xb9ef('0xb2')](_0x2224ff[_0xb9ef('0x6b')],[_0xb9ef('0xb1'),'id'])||{});}})[_0xb9ef('0x25')](respondWithResult(_0x23a54f,null))[_0xb9ef('0x30')](handleError(_0x23a54f,null));};exports[_0xb9ef('0xb3')]=function(_0x51aafc,_0x4d2610,_0x571736){var _0x3545ba={'raw':![],'where':{}};var _0x4b7998={};var _0x526c3c={'count':0x0,'rows':[]};return db[_0xb9ef('0x32')][_0xb9ef('0xb4')]({'where':{'id':_0x51aafc['params']['id']}})['then'](handleEntityNotFound(_0x4d2610,null))[_0xb9ef('0x25')](function(_0x133e2d){if(_0x133e2d){_0x4b7998[_0xb9ef('0x35')]=_[_0xb9ef('0x37')](db[_0xb9ef('0xaf')][_0xb9ef('0x33')]);_0x4b7998[_0xb9ef('0x36')]=_[_0xb9ef('0x37')](_0x51aafc[_0xb9ef('0x36')]);_0x4b7998['filters']=_['intersection'](_0x4b7998[_0xb9ef('0x35')],_0x4b7998['query']);_0x3545ba[_0xb9ef('0x38')]=_[_0xb9ef('0x39')](_0x4b7998['model'],qs[_0xb9ef('0x3a')](_0x51aafc[_0xb9ef('0x36')]['fields']));_0x3545ba[_0xb9ef('0x38')]=_0x3545ba[_0xb9ef('0x38')][_0xb9ef('0x57')]?_0x3545ba['attributes']:_0x4b7998[_0xb9ef('0x35')];if(!_0x51aafc[_0xb9ef('0x36')][_0xb9ef('0x3b')]('nolimit')){_0x3545ba['limit']=qs[_0xb9ef('0x1f')](_0x51aafc['query']['limit']);_0x3545ba[_0xb9ef('0x1e')]=qs[_0xb9ef('0x1e')](_0x51aafc[_0xb9ef('0x36')][_0xb9ef('0x1e')]);}_0x3545ba[_0xb9ef('0x3d')]=qs['sort'](_0x51aafc[_0xb9ef('0x36')][_0xb9ef('0x3e')]);_0x3545ba['where']=qs[_0xb9ef('0x3f')](_['pick'](_0x51aafc[_0xb9ef('0x36')],_0x4b7998[_0xb9ef('0x3f')]));_0x3545ba[_0xb9ef('0x72')][_0xb9ef('0xa6')]=_0x133e2d['id'];if(_0x51aafc[_0xb9ef('0x36')][_0xb9ef('0x7a')]){_0x3545ba[_0xb9ef('0x72')]=_['merge'](_0x3545ba[_0xb9ef('0x72')],{'$or':_['map'](_0x3545ba[_0xb9ef('0x38')],function(_0x2a2f01){var _0x26b8c3={};_0x26b8c3[_0x2a2f01]={'$like':'%'+_0x51aafc[_0xb9ef('0x36')]['filter']+'%'};return _0x26b8c3;})});}if(_0x51aafc[_0xb9ef('0x36')]['$gte']){var _0x2f3e05=_0x51aafc[_0xb9ef('0x36')][_0xb9ef('0xb5')]['split'](',');var _0x1096e6={};_0x1096e6[_0x2f3e05[0x0]]={'$gte':moment(_0x2f3e05[0x1])[_0xb9ef('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3545ba[_0xb9ef('0x72')]=_[_0xb9ef('0x91')](_0x3545ba[_0xb9ef('0x72')],_0x1096e6);}_0x3545ba=_[_0xb9ef('0x91')]({},_0x3545ba,_0x51aafc[_0xb9ef('0xac')]);return db['OpenchannelMessage'][_0xb9ef('0x1d')]({'where':_0x3545ba['where']})[_0xb9ef('0x25')](function(_0x5c6434){_0x526c3c[_0xb9ef('0x1d')]=_0x5c6434;if(_0x51aafc[_0xb9ef('0x36')][_0xb9ef('0xaa')]){_0x3545ba['include']=[{'all':!![]}];}return db[_0xb9ef('0xaf')][_0xb9ef('0xb7')](_0x3545ba);})[_0xb9ef('0x25')](function(_0x5054b0){_0x526c3c[_0xb9ef('0xb8')]=_0x5054b0;return _0x526c3c;});}})[_0xb9ef('0x25')](respondWithFilteredResult(_0x4d2610,_0x3545ba))[_0xb9ef('0x30')](handleError(_0x4d2610,null));};exports['addTags']=function(_0x438c40,_0x567efc,_0x1e5a8d){return db[_0xb9ef('0x32')][_0xb9ef('0x58')]({'where':{'id':_0x438c40[_0xb9ef('0xa9')]['id']}})[_0xb9ef('0x25')](handleEntityNotFound(_0x567efc,null))[_0xb9ef('0x25')](function(_0x5526f6){if(_0x5526f6){return _0x5526f6[_0xb9ef('0xb9')](_0x438c40[_0xb9ef('0x6b')][_0xb9ef('0xb1')],_[_0xb9ef('0xb2')](_0x438c40['body'],[_0xb9ef('0xb1'),'id'])||{})['spread'](function(){return db[_0xb9ef('0x65')][_0xb9ef('0xb7')]({'attributes':['id',_0xb9ef('0x29'),'color'],'where':{'id':_0x438c40[_0xb9ef('0x6b')][_0xb9ef('0xb1')]}});})['then'](function(_0x410d51){socket[_0xb9ef('0xba')](_0xb9ef('0xbb'),{'id':Number(_0x438c40[_0xb9ef('0xa9')]['id']),'tags':_0x410d51||[]});return{'id':Number(_0x438c40[_0xb9ef('0xa9')]['id']),'tags':_0x410d51||[]};});}})['then'](respondWithResult(_0x567efc,null))[_0xb9ef('0x30')](handleError(_0x567efc,null));};exports[_0xb9ef('0xbc')]=function(_0x5f59b4,_0x376823,_0x45b2ed){return db['OpenchannelInteraction'][_0xb9ef('0x58')]({'where':{'id':_0x5f59b4[_0xb9ef('0xa9')]['id']}})['then'](handleEntityNotFound(_0x376823,null))['then'](function(_0x394ebe){if(_0x394ebe){return _0x394ebe[_0xb9ef('0xbc')](_0x5f59b4[_0xb9ef('0x36')]['ids']);}})['then'](respondWithStatusCode(_0x376823,null))[_0xb9ef('0x30')](handleError(_0x376823,null));};exports['download']=function(_0x9f4c07,_0x4b6cc6){var _0x2e1900=moment()[_0xb9ef('0xbd')]()[_0xb9ef('0x8f')]();var _0x40a7fe=path[_0xb9ef('0xbe')](config[_0xb9ef('0xbf')],_0xb9ef('0xc0'),'files',_0xb9ef('0xc1'));var _0x38b0ba=path['join'](config['root'],_0xb9ef('0xc0'),_0xb9ef('0xc2'),'attachments');var _0x2a4b88=path[_0xb9ef('0xbe')](_0x40a7fe,_0x2e1900);var _0x49a55f=util[_0xb9ef('0xb6')](_0xb9ef('0xc3'),_0x9f4c07[_0xb9ef('0xa9')]['id'],_0x2e1900);var _0x10a4e4=path[_0xb9ef('0xbe')](_0x40a7fe,_0x49a55f);var _0x58835c=[];_0x58835c[_0xb9ef('0xa7')]({'model':db['User'],'as':'User','attributes':['id',_0xb9ef('0xc4')],'raw':!![]});_0x58835c[_0xb9ef('0xa7')]({'model':db[_0xb9ef('0xc5')],'as':_0xb9ef('0xc6'),'attributes':['id',_0xb9ef('0xc7'),_0xb9ef('0xc8')],'raw':!![]});if(_0x9f4c07['query'][_0xb9ef('0xc9')]){_0x58835c[_0xb9ef('0xa7')]({'model':db[_0xb9ef('0xca')],'as':_0xb9ef('0xca'),'raw':!![]});}var _0x3da1c4=[{'model':db['OpenchannelMessage'],'as':_0xb9ef('0xcb'),'attributes':['id',_0xb9ef('0x6b'),_0xb9ef('0x70'),_0xb9ef('0xcc'),_0xb9ef('0xcd'),_0xb9ef('0x75')],'include':_0x58835c}];_0x3da1c4[_0xb9ef('0xa7')]({'model':db[_0xb9ef('0xce')],'as':'Account','attributes':['id',_0xb9ef('0x29')]});_0x3da1c4['push']({'model':db['User'],'as':_0xb9ef('0xcf'),'attributes':['id',_0xb9ef('0xc4')]});return db[_0xb9ef('0x32')][_0xb9ef('0x58')]({'where':{'id':_0x9f4c07[_0xb9ef('0xa9')]['id']},'include':_0x3da1c4})[_0xb9ef('0x25')](handleEntityNotFound(_0x4b6cc6,null))[_0xb9ef('0x25')](function(_0x43eedd){if(_0x43eedd){var _0x7afd2c=_0x43eedd[_0xb9ef('0xd0')]({'plain':!![]});fs[_0xb9ef('0xd1')](_0x2a4b88);var _0x4990d6={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0xb9ef('0xd2'),'contents':{'default':util['format'](_0xb9ef('0xd3'),util[_0xb9ef('0xb6')](_0xb9ef('0xd4'),'Openchannel',_0x7afd2c['id']),moment()['format']('YYYY-MM-DD')[_0xb9ef('0x8f')]())}}};var _0x400d6e={'channel':_0xb9ef('0xd5'),'account':_0x7afd2c[_0xb9ef('0xd6')][_0xb9ef('0x29')],'agent':_0x7afd2c[_0xb9ef('0xcf')]?_0x7afd2c[_0xb9ef('0xcf')][_0xb9ef('0xc4')]:_0xb9ef('0xd7'),'createdAt':moment(_0x7afd2c[_0xb9ef('0x70')])[_0xb9ef('0xb6')](_0xb9ef('0xd8'))[_0xb9ef('0x8f')](),'closedAt':_0x7afd2c[_0xb9ef('0xd9')]?moment(_0x7afd2c[_0xb9ef('0xda')])[_0xb9ef('0xb6')](_0xb9ef('0xd8'))[_0xb9ef('0x8f')]():'','disposition':_0x7afd2c[_0xb9ef('0xdb')],'visibility':_0x7afd2c[_0xb9ef('0xdc')]?_0xb9ef('0xdd'):'Private','messages':_(_0x7afd2c[_0xb9ef('0xcb')])[_0xb9ef('0x7a')]({'secret':![]})[_0xb9ef('0x2c')](function(_0x20ca47){if(_0x20ca47['Attachment']){var _0x2b87bb=path['join'](_0x38b0ba,_0x20ca47['Attachment'][_0xb9ef('0xde')]);if(fs[_0xb9ef('0xdf')](_0x2b87bb)){fs['createReadStream'](_0x2b87bb)[_0xb9ef('0xe0')](fs[_0xb9ef('0xe1')](path['join'](_0x2a4b88,_0x20ca47[_0xb9ef('0xca')][_0xb9ef('0xde')])));}}return{'date':moment(_0x20ca47[_0xb9ef('0x70')])[_0xb9ef('0xb6')](_0xb9ef('0xd8'))['toString'](),'sender':_0x20ca47[_0xb9ef('0xcc')]===_0xb9ef('0xe2')?_0x20ca47[_0xb9ef('0x68')]?_0x20ca47[_0xb9ef('0x68')][_0xb9ef('0xc4')]:_0xb9ef('0xe3'):_0x20ca47[_0xb9ef('0xc6')][_0xb9ef('0xc7')]+(_0x20ca47[_0xb9ef('0xc6')][_0xb9ef('0xc8')]?'\x20'+_0x20ca47['Contact'][_0xb9ef('0xc8')]:''),'body':_0x20ca47[_0xb9ef('0xca')]?_0x20ca47[_0xb9ef('0xca')][_0xb9ef('0xde')]:_0x20ca47[_0xb9ef('0x6b')],'direction':_0x20ca47[_0xb9ef('0xcc')]===_0xb9ef('0xe2')?'A':'C','secret':_0x20ca47[_0xb9ef('0xcd')],'read':_0x20ca47[_0xb9ef('0x75')],'attachment':_0x20ca47['Attachment']};})[_0xb9ef('0x5a')]()};return ejs[_0xb9ef('0xe4')](path[_0xb9ef('0xbe')](config['root'],_0xb9ef('0xc0'),_0xb9ef('0xe5'),_0xb9ef('0xe6')),{'interaction':_0x400d6e})[_0xb9ef('0x25')](function(_0xa506d){return new BPromise(function(_0x109dbb,_0x45ea95){pdf['create'](_0xa506d,_0x4990d6)[_0xb9ef('0xe7')](path[_0xb9ef('0xbe')](_0x2a4b88,_0xb9ef('0xe8')+_0x7afd2c['id']+'-'+_0x2e1900+'.pdf'),function(_0x154617,_0x146aa2){if(_0x154617)return _0x45ea95(_0x154617);_0x109dbb(_0x146aa2);});});})[_0xb9ef('0x25')](function(){return new BPromise(function(_0x25210a,_0x14ad99){zipdir(_0x2a4b88,{'saveTo':_0x10a4e4},function(_0x38b911,_0x497443){if(_0x38b911)return _0x14ad99(_0x38b911);return _0x25210a(_0x497443);});})['then'](function(){return new BPromise(function(_0x22186f,_0x52a46a){rimraf(_0x2a4b88,function(_0x52adcb){if(_0x52adcb)_0x52a46a(_0x52adcb);return _0x22186f();});});})['then'](function(){return _0x4b6cc6[_0xb9ef('0xe9')](_0x10a4e4,_0x49a55f,function(_0x5dae23){if(_0x5dae23){console[_0xb9ef('0xea')]('err',_0x5dae23);}else{fs[_0xb9ef('0xeb')](_0x10a4e4);}});});});}else{return _0x4b6cc6[_0xb9ef('0x26')](0xc8);}})['catch'](handleError(_0x4b6cc6,null));}; \ No newline at end of file +var _0xb2b4=['Content-Range','apply','reject','update','then','destroy','end','error','stack','name','Users','map','fullname','TagIds','Tags','forEach','catch','index','OpenchannelInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.fullname','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','show','params','includeAll','include','merge','create','describe','addMessage','OpenchannelMessage','ids','omit','findOne','OpenchannelInteractionId','filter','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','addTags','setTags','spread','emit','removeTags','unix','root','server','tmp','join','attachments','transcript-%d-%s.zip','User','push','CmContact','firstName','lastName','Attachment','Messages','direction','OpenchannelAccount','Account','Owner','get','mkdirSync','\x0a\x20\x20\x20\x20\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','Openchannel','N.A.','closed','closedAt','disposition','threadId','Private','existsSync','pipe','createWriteStream','basename','out','System','secret','renderFile','views','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','count','offset','limit','set'];(function(_0xf0e370,_0x1e6c42){var _0x174ca5=function(_0x47745c){while(--_0x47745c){_0xf0e370['push'](_0xf0e370['shift']());}};_0x174ca5(++_0x1e6c42);}(_0xb2b4,0x1b4));var _0x4b2b=function(_0x4be3ec,_0x218441){_0x4be3ec=_0x4be3ec-0x0;var _0x44b79f=_0xb2b4[_0x4be3ec];return _0x44b79f;};'use strict';var pdf=require(_0x4b2b('0x0'));var emlformat=require(_0x4b2b('0x1'));var rimraf=require(_0x4b2b('0x2'));var zipdir=require(_0x4b2b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b2b('0x4'));var moment=require(_0x4b2b('0x5'));var BPromise=require(_0x4b2b('0x6'));var Mustache=require(_0x4b2b('0x7'));var util=require('util');var path=require(_0x4b2b('0x8'));var sox=require(_0x4b2b('0x9'));var csv=require(_0x4b2b('0xa'));var ejs=require(_0x4b2b('0xb'));var fs=require('fs');var _=require(_0x4b2b('0xc'));var squel=require(_0x4b2b('0xd'));var crypto=require(_0x4b2b('0xe'));var jsforce=require(_0x4b2b('0xf'));var deskjs=require(_0x4b2b('0x10'));var toCsv=require(_0x4b2b('0xa'));var querystring=require(_0x4b2b('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4b2b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4b2b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b2b('0x14'))(_0x4b2b('0x15'));var utils=require(_0x4b2b('0x16'));var config=require('../../config/environment');var db=require(_0x4b2b('0x17'))['db'];config[_0x4b2b('0x18')]=_[_0x4b2b('0x19')](config[_0x4b2b('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b2b('0x1a'))(new Redis(config[_0x4b2b('0x18')]));require(_0x4b2b('0x1b'))[_0x4b2b('0x1c')](socket);function respondWithStatusCode(_0x5c840a,_0x1b9bfa){_0x1b9bfa=_0x1b9bfa||0xcc;return function(_0x19c134){if(_0x19c134){return _0x5c840a[_0x4b2b('0x1d')](_0x1b9bfa);}return _0x5c840a[_0x4b2b('0x1e')](_0x1b9bfa)['end']();};}function respondWithResult(_0xa6af9c,_0x16dfde){_0x16dfde=_0x16dfde||0xc8;return function(_0x4369a3){if(_0x4369a3){return _0xa6af9c[_0x4b2b('0x1e')](_0x16dfde)[_0x4b2b('0x1f')](_0x4369a3);}};}function respondWithFilteredResult(_0x3b13db,_0x5bd56b){return function(_0x3813f2){if(_0x3813f2){var _0x37aa6b=_0x3813f2[_0x4b2b('0x20')],_0x22d5f5=_0x5bd56b[_0x4b2b('0x21')],_0x43befb=_0x5bd56b[_0x4b2b('0x21')]+_0x5bd56b[_0x4b2b('0x22')],_0x23c3ea;if(_0x43befb>=_0x37aa6b){_0x43befb=_0x37aa6b;_0x23c3ea=0xc8;}else{_0x23c3ea=0xce;}_0x3b13db['status'](_0x23c3ea);return _0x3b13db[_0x4b2b('0x23')](_0x4b2b('0x24'),_0x22d5f5+'-'+_0x43befb+'/'+_0x37aa6b)[_0x4b2b('0x1f')](_0x3813f2);}return null;};}function patchUpdates(_0x1bfb64){return function(_0xb22af){try{jsonpatch[_0x4b2b('0x25')](_0xb22af,_0x1bfb64,!![]);}catch(_0x12097d){return BPromise[_0x4b2b('0x26')](_0x12097d);}return _0xb22af['save']();};}function saveUpdates(_0x31e753,_0x142dfa){return function(_0x5c247a){if(_0x5c247a){return _0x5c247a[_0x4b2b('0x27')](_0x31e753)[_0x4b2b('0x28')](function(_0xa3f05f){return _0xa3f05f;});}return null;};}function removeEntity(_0x52479e,_0x805be9){return function(_0x439e50){if(_0x439e50){return _0x439e50[_0x4b2b('0x29')]()[_0x4b2b('0x28')](function(){_0x52479e[_0x4b2b('0x1e')](0xcc)[_0x4b2b('0x2a')]();});}};}function handleEntityNotFound(_0x534b14,_0x48c93b){return function(_0x14ac5c){if(!_0x14ac5c){_0x534b14['sendStatus'](0x194);}return _0x14ac5c;};}function handleError(_0x12fc89,_0x2481d7){_0x2481d7=_0x2481d7||0x1f4;return function(_0x27c677){logger[_0x4b2b('0x2b')](_0x27c677[_0x4b2b('0x2c')]);if(_0x27c677[_0x4b2b('0x2d')]){delete _0x27c677['name'];}_0x12fc89[_0x4b2b('0x1e')](_0x2481d7)['send'](_0x27c677);};}function getInteractionUsers(_0x2d8fca,_0x5573ba){return new BPromise(function(_0x134d6a,_0x87517e){try{if(_0x5573ba[_0x2d8fca['id']]){_0x2d8fca[_0x4b2b('0x2e')]=_[_0x4b2b('0x2f')](_0x5573ba[_0x2d8fca['id']],function(_0x317ae0){return{'id':_0x317ae0['id'],'fullname':_0x317ae0[_0x4b2b('0x30')]};});}}catch(_0x20fe18){_0x87517e(_0x20fe18);}_0x134d6a(_0x2d8fca);});}function getInteractionTags(_0x410884,_0xf88ac3){return new BPromise(function(_0x8b973e,_0x16fdad){try{if(_0x410884[_0x4b2b('0x31')]){_0x410884[_0x4b2b('0x32')]=[];_0x410884[_0x4b2b('0x31')]['split'](',')[_0x4b2b('0x33')](function(_0x58a8e1){_0x410884['Tags']['push'](_0xf88ac3[_0x58a8e1]);});}delete _0x410884[_0x4b2b('0x31')];}catch(_0x55604c){_0x16fdad(_0x55604c);}_0x8b973e(_0x410884);});}function updateOpenchannelInteraction(_0x3b91f8,_0x4ec51c,_0x3381f4){return new BPromise(function(_0x5a44fb,_0x284745){return getInteractionUsers(_0x3b91f8,_0x3381f4)['then'](function(_0x461c63){return getInteractionTags(_0x461c63,_0x4ec51c);})[_0x4b2b('0x28')](function(_0x4ca888){_0x5a44fb(_0x4ca888);})[_0x4b2b('0x34')](function(_0x90ed63){_0x284745(_0x90ed63);});});}exports[_0x4b2b('0x35')]=function(_0x214bdd,_0x420e5b){var _0x719bde={},_0x419f8f={},_0xba03d2={'count':0x0,'rows':[]};var _0x25e5d0=_['map'](db[_0x4b2b('0x36')][_0x4b2b('0x37')],function(_0x261760){return{'name':_0x261760[_0x4b2b('0x38')],'type':_0x261760['type'][_0x4b2b('0x39')]};});_0x419f8f[_0x4b2b('0x3a')]=_[_0x4b2b('0x2f')](_0x25e5d0,_0x4b2b('0x2d'));_0x419f8f[_0x4b2b('0x3b')]=_[_0x4b2b('0x3c')](_0x214bdd['query']);_0x419f8f[_0x4b2b('0x3d')]=_[_0x4b2b('0x3e')](_0x419f8f['model'],_0x419f8f['query']);_0x719bde[_0x4b2b('0x3f')]=_[_0x4b2b('0x3e')](_0x419f8f[_0x4b2b('0x3a')],qs['fields'](_0x214bdd[_0x4b2b('0x3b')][_0x4b2b('0x40')]));_0x719bde['attributes']=_0x719bde['attributes'][_0x4b2b('0x41')]?_0x719bde[_0x4b2b('0x3f')]:_0x419f8f[_0x4b2b('0x3a')];if(!_0x214bdd[_0x4b2b('0x3b')][_0x4b2b('0x42')](_0x4b2b('0x43'))){_0x719bde[_0x4b2b('0x22')]=qs[_0x4b2b('0x22')](_0x214bdd[_0x4b2b('0x3b')][_0x4b2b('0x22')]);_0x719bde[_0x4b2b('0x21')]=qs[_0x4b2b('0x21')](_0x214bdd['query'][_0x4b2b('0x21')]);}_0x719bde[_0x4b2b('0x44')]=qs[_0x4b2b('0x45')](_0x214bdd[_0x4b2b('0x3b')]['sort']);_0x719bde[_0x4b2b('0x46')]=qs[_0x4b2b('0x3d')](_[_0x4b2b('0x47')](_0x214bdd[_0x4b2b('0x3b')],_0x419f8f[_0x4b2b('0x3d')]),_0x25e5d0);var _0x2e16ae=[];var _0x3523b9=squel[_0x4b2b('0x48')]()[_0x4b2b('0x49')]('id')[_0x4b2b('0x49')](_0x4b2b('0x2d'))[_0x4b2b('0x49')](_0x4b2b('0x4a'))[_0x4b2b('0x4b')]('tools_tags');var _0x2c28a1=squel[_0x4b2b('0x48')]()[_0x4b2b('0x49')]('u.id')[_0x4b2b('0x49')](_0x4b2b('0x4c'))[_0x4b2b('0x49')](_0x4b2b('0x4d'))[_0x4b2b('0x4b')]('user_has_openchannel_interactions','ui')[_0x4b2b('0x4e')](_0x4b2b('0x4f'),'u',_0x4b2b('0x50'));var _0x50a4e9=squel['select']()[_0x4b2b('0x4b')](_0x4b2b('0x51'),'i')[_0x4b2b('0x4e')](_0x4b2b('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x4b2b('0x4f'),'o','o.id\x20=\x20i.UserId')['left_join']('openchannel_accounts','a',_0x4b2b('0x53'))['left_join']('openchannel_messages','me',_0x4b2b('0x54'))[_0x4b2b('0x4e')]('openchannel_interaction_has_tags','it',_0x4b2b('0x55'))[_0x4b2b('0x4e')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x70c87f=squel['expr']();var _0x308ef6=[];var _0x582856=squel[_0x4b2b('0x56')]();var _0x146970;if(_0x214bdd['query'][_0x4b2b('0x57')]){_0x146970=as[_0x4b2b('0x58')](_0x214bdd['query'][_0x4b2b('0x57')]);var _0x26751a=_0x146970[_0x4b2b('0x59')];for(var _0x250525=0x0;_0x250525<_0x146970[_0x4b2b('0x5a')][_0x4b2b('0x41')];_0x250525++){var _0xbaca6e=_0x146970['conditions'][_0x250525];var _0x11dd58='i';var _0x4f53a9=_[_0x4b2b('0x5b')](_0x25e5d0,[_0x4b2b('0x2d'),_0xbaca6e[_0x4b2b('0x49')]]);if(!_0x4f53a9){switch(_0xbaca6e[_0x4b2b('0x49')]){case _0x4b2b('0x5c'):if(_0xbaca6e[_0x4b2b('0x5d')]==0x1){_0x50a4e9['having']('`'+_0xbaca6e[_0x4b2b('0x49')]+'`\x20=\x200');}else{_0x50a4e9['having']('`'+_0xbaca6e[_0x4b2b('0x49')]+'`\x20>\x200');}break;case _0x4b2b('0x5e'):if(_0xbaca6e[_0x4b2b('0x5f')]===_0x4b2b('0x60')){if(_0xbaca6e[_0x4b2b('0x5d')]['split']('\x20')[_0x4b2b('0x41')]>0x1){_0x70c87f[_0x26751a](_0x4b2b('0x61'),qs['getFullTextValue'](_0xbaca6e[_0x4b2b('0x5d')]),null);}else{var _0x16d9da='%'+_0xbaca6e[_0x4b2b('0x5d')]+'%';_0x70c87f[_0x26751a](_0x4b2b('0x62'),_0x16d9da,_0x16d9da,_0x16d9da);}}else{_0x4f53a9=_['find'](_0x25e5d0,[_0x4b2b('0x2d'),_0x4b2b('0x63')]);_0xbaca6e[_0x4b2b('0x49')]=_0x4b2b('0x63');_0x23a8c1=as[_0x4b2b('0x64')](_0x11dd58,_0x4f53a9[_0x4b2b('0x65')],_0xbaca6e);_0x70c87f[_0x26751a](_0x23a8c1[_0x4b2b('0x66')],_0x23a8c1[_0x4b2b('0x5d')][_0x4b2b('0x67')],_0x23a8c1[_0x4b2b('0x5d')][_0x4b2b('0x2a')]);}break;case _0x4b2b('0x68'):var _0x528dc4=_0xbaca6e['value'][_0x4b2b('0x69')](',')[_0x4b2b('0x2f')](function(_0x2cc912){return Number(_0x2cc912);});_0x528dc4['forEach'](function(_0x29bcc7){_0x582856['or'](_0x4b2b('0x6a'),'%,'+_0x29bcc7+',%');});_0x308ef6=_[_0x4b2b('0x6b')](_0x308ef6,_0x528dc4);break;case'User':if(_0xbaca6e['operator']===_0x4b2b('0x60')){_0x70c87f[_0x26751a](_0x4b2b('0x6c'),'%'+_0xbaca6e['value']+'%',null);}else{_0x4f53a9=_[_0x4b2b('0x5b')](_0x25e5d0,['name',_0x4b2b('0x6d')]);_0xbaca6e[_0x4b2b('0x49')]='UserId';_0x23a8c1=as['buildExpression'](_0x11dd58,_0x4f53a9[_0x4b2b('0x65')],_0xbaca6e);_0x70c87f[_0x26751a](_0x23a8c1[_0x4b2b('0x66')],_0x23a8c1[_0x4b2b('0x5d')][_0x4b2b('0x67')],_0x23a8c1[_0x4b2b('0x5d')]['end']);}break;case _0x4b2b('0x6e'):_0x23a8c1=as['buildExpression']('me',null,_0xbaca6e);_0x70c87f[_0x26751a](_0x23a8c1[_0x4b2b('0x66')],_0x23a8c1['value'][_0x4b2b('0x67')],_0x23a8c1[_0x4b2b('0x5d')][_0x4b2b('0x2a')]);break;}}else{var _0x23a8c1=as[_0x4b2b('0x64')](_0x11dd58,_0x4f53a9['type'],_0xbaca6e);_0x70c87f[_0x26751a](_0x23a8c1['text'],_0x23a8c1['value'][_0x4b2b('0x67')],_0x23a8c1[_0x4b2b('0x5d')][_0x4b2b('0x2a')]);}}}else{var _0x4602ec=_(_0x214bdd[_0x4b2b('0x3b')])['keys']()[_0x4b2b('0x2f')](function(_0xfc9915){return _[_0x4b2b('0x6f')](_0x25e5d0,[_0x4b2b('0x2d'),_0xfc9915])?_0xfc9915:undefined;})[_0x4b2b('0x70')]()['value']();if(!_[_0x4b2b('0x71')](_0x4602ec)){_0x4602ec[_0x4b2b('0x33')](function(_0x3bf2ca){if(_0x3bf2ca==='OpenchannelAccountId'){_0x50a4e9[_0x4b2b('0x46')](_0x4b2b('0x72'),[][_0x4b2b('0x73')](_0x214bdd['query'][_0x3bf2ca]));}else if(_0x3bf2ca===_0x4b2b('0x74')){var _0x2e5460=JSON[_0x4b2b('0x75')](_0x214bdd['query'][_0x3bf2ca])[_0x4b2b('0x76')];var _0x366078=JSON[_0x4b2b('0x75')](_0x214bdd[_0x4b2b('0x3b')][_0x3bf2ca])[_0x4b2b('0x77')];_0x50a4e9[_0x4b2b('0x46')](_0x4b2b('0x78'),_0x2e5460,_0x366078);}else{if(_0x214bdd[_0x4b2b('0x3b')][_0x3bf2ca]==='null'){_0x50a4e9[_0x4b2b('0x46')]('i.'+_0x3bf2ca+_0x4b2b('0x79'));}else{_0x50a4e9[_0x4b2b('0x46')]('i.'+_0x3bf2ca+_0x4b2b('0x7a'),_0x214bdd[_0x4b2b('0x3b')][_0x3bf2ca]);}}});}if(_0x214bdd['query']['read']){if(_0x214bdd[_0x4b2b('0x3b')][_0x4b2b('0x7b')]==0x1){_0x50a4e9[_0x4b2b('0x7c')](_0x4b2b('0x7d'));}else{_0x50a4e9[_0x4b2b('0x7c')](_0x4b2b('0x7e'));}}if(_0x214bdd[_0x4b2b('0x3b')][_0x4b2b('0x7f')]){_0x308ef6=_[_0x4b2b('0x80')](_0x214bdd[_0x4b2b('0x3b')]['tag'])?_0x214bdd['query'][_0x4b2b('0x7f')]:new Array(_0x214bdd[_0x4b2b('0x3b')]['tag']);_0x308ef6[_0x4b2b('0x33')](function(_0x48e224){_0x582856['or'](_0x4b2b('0x6a'),'%,'+_0x48e224+',%');});}if(_0x214bdd[_0x4b2b('0x3b')]['filter']){var _0x3591a3=_0x214bdd['query']['filter'][_0x4b2b('0x81')]('\x5c','\x5c\x5c')[_0x4b2b('0x81')]('\x27\x27',_0x4b2b('0x82'));if(qs[_0x4b2b('0x83')](_0x3591a3)){_0x70c87f['or'](_0x4b2b('0x84'),_0x3591a3+'%');}else{_0x70c87f['or'](_0x4b2b('0x85'),qs['getFullTextValue'](_0x3591a3))['or'](_0x4b2b('0x86'),_0x3591a3+'%')['or'](_0x4b2b('0x87'),_0x3591a3+'%');}}}_0x50a4e9['where'](_0x70c87f);_0x50a4e9[_0x4b2b('0x88')](_0x4b2b('0x89'));var _0x149b15={'type':db[_0x4b2b('0x8a')]['QueryTypes']['SELECT'],'raw':!![]};var _0x1e6c33=_0x50a4e9[_0x4b2b('0x8b')]();_0x1e6c33['field'](_0x4b2b('0x89'));_0x1e6c33[_0x4b2b('0x49')](_0x4b2b('0x8c'),_0x4b2b('0x5c'));if(_0x719bde[_0x4b2b('0x44')]){_0x719bde[_0x4b2b('0x44')][_0x4b2b('0x33')](function(_0x751c91){_0x50a4e9['order']('i.'+_0x751c91[0x0],_0x751c91[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4b2b('0x71')](_0x308ef6)){_0x50a4e9['having'](_0x582856);_0x1e6c33[_0x4b2b('0x46')]('t.id\x20IN\x20?',_0x308ef6);}BPromise[_0x4b2b('0x8d')]()[_0x4b2b('0x28')](function(){if(!_0x146970){if(_0x214bdd['query']['OpenchannelAccountId']||_0x214bdd['query'][_0x4b2b('0x8e')])return;_0x1e6c33[_0x4b2b('0x46')](_0x4b2b('0x8f'));_0x50a4e9[_0x4b2b('0x46')](_0x4b2b('0x8f'));return;}return _0x214bdd[_0x4b2b('0x90')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x4b2b('0x28')](function(_0x1efa87){if(_[_0x4b2b('0x71')](_0x1efa87)){_0x1e6c33[_0x4b2b('0x46')](_0x4b2b('0x91'));_0x50a4e9['where'](_0x4b2b('0x91'));}else{_0x1e6c33['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x4b2b('0x2f')](_0x1efa87,'id'));_0x50a4e9['where'](_0x4b2b('0x72'),_['map'](_0x1efa87,'id'));}});})[_0x4b2b('0x28')](function(){db[_0x4b2b('0x92')][_0x4b2b('0x3b')](_0x1e6c33[_0x4b2b('0x93')](),_0x149b15)[_0x4b2b('0x28')](function(_0xb47c07){_0xba03d2['count']=_0xb47c07['length'];if(_0xba03d2[_0x4b2b('0x20')]===0x0)return[];return db[_0x4b2b('0x92')][_0x4b2b('0x3b')](_0x3523b9[_0x4b2b('0x93')](),_0x149b15)[_0x4b2b('0x28')](function(_0x454678){_0x2e16ae=_['keyBy'](_0x454678,'id');_0x149b15=_['merge'](_0x149b15,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x214bdd['query']['fields']){_0x719bde[_0x4b2b('0x3f')][_0x4b2b('0x33')](function(_0x3781cb){_0x50a4e9['field']('i.'+_0x3781cb);});}else{_0x50a4e9[_0x4b2b('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4b2b('0x5c'));_0x50a4e9['field']('a.key',_0x4b2b('0x94'));_0x50a4e9[_0x4b2b('0x49')]('a.mandatoryDisposition',_0x4b2b('0x95'));_0x50a4e9[_0x4b2b('0x49')](_0x4b2b('0x96'));_0x50a4e9[_0x4b2b('0x49')]('c.firstName',_0x4b2b('0x97'));_0x50a4e9[_0x4b2b('0x49')](_0x4b2b('0x98'),_0x4b2b('0x99'));_0x50a4e9['field'](_0x4b2b('0x9a'),_0x4b2b('0x9b'));_0x50a4e9[_0x4b2b('0x49')](_0x4b2b('0x9c'),_0x4b2b('0x9d'));_0x50a4e9['field'](_0x4b2b('0x9e'),'Contact.mobile');_0x50a4e9[_0x4b2b('0x49')]('c.fax',_0x4b2b('0x9f'));_0x50a4e9[_0x4b2b('0x49')]('o.fullname',_0x4b2b('0xa0'));_0x50a4e9[_0x4b2b('0x49')](_0x4b2b('0xa1'),_0x4b2b('0xa2'));_0x50a4e9['field'](_0x4b2b('0xa3'),_0x4b2b('0x31'));}if(_0x719bde[_0x4b2b('0x22')])_0x50a4e9['limit'](_0x719bde[_0x4b2b('0x22')]);if(_0x719bde[_0x4b2b('0x21')])_0x50a4e9[_0x4b2b('0x21')](_0x719bde[_0x4b2b('0x21')]);return db[_0x4b2b('0x92')][_0x4b2b('0x3b')](_0x50a4e9[_0x4b2b('0x93')](),_0x149b15);})['then'](function(_0x5809b7){_0x2c28a1[_0x4b2b('0x46')](_0x4b2b('0xa4'),_[_0x4b2b('0x2f')](_0x5809b7,'id'));return db[_0x4b2b('0x92')][_0x4b2b('0x3b')](_0x2c28a1[_0x4b2b('0x93')](),_0x149b15)[_0x4b2b('0x28')](function(_0x971e64){var _0x2b85ac=_[_0x4b2b('0xa5')](_0x971e64,'OpenchannelInteractionId');var _0x9cbb00=[];_0x5809b7['forEach'](function(_0x22feed){_0x9cbb00['push'](updateOpenchannelInteraction(_0x22feed,_0x2e16ae,_0x2b85ac));});return BPromise[_0x4b2b('0xa6')](_0x9cbb00);});});})['then'](function(_0xaf63bf){_0xba03d2['rows']=_0xaf63bf;return _0xba03d2;})[_0x4b2b('0x28')](respondWithFilteredResult(_0x420e5b,_0x719bde));})[_0x4b2b('0x34')](handleError(_0x420e5b,null));};exports[_0x4b2b('0xa7')]=function(_0x41ddfd,_0x1ef2ea){var _0x5603a2={'raw':![],'where':{'id':_0x41ddfd[_0x4b2b('0xa8')]['id']}},_0x496384={};_0x496384['model']=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x496384['query']=_[_0x4b2b('0x3c')](_0x41ddfd[_0x4b2b('0x3b')]);_0x496384[_0x4b2b('0x3d')]=_[_0x4b2b('0x3e')](_0x496384[_0x4b2b('0x3a')],_0x496384[_0x4b2b('0x3b')]);_0x5603a2[_0x4b2b('0x3f')]=_[_0x4b2b('0x3e')](_0x496384[_0x4b2b('0x3a')],qs[_0x4b2b('0x40')](_0x41ddfd[_0x4b2b('0x3b')][_0x4b2b('0x40')]));_0x5603a2[_0x4b2b('0x3f')]=_0x5603a2[_0x4b2b('0x3f')][_0x4b2b('0x41')]?_0x5603a2[_0x4b2b('0x3f')]:_0x496384[_0x4b2b('0x3a')];if(_0x41ddfd[_0x4b2b('0x3b')][_0x4b2b('0xa9')]){_0x5603a2[_0x4b2b('0xaa')]=[{'all':!![]}];}_0x5603a2=_[_0x4b2b('0xab')]({},_0x5603a2,_0x41ddfd['options']);return db['OpenchannelInteraction'][_0x4b2b('0x5b')](_0x5603a2)[_0x4b2b('0x28')](handleEntityNotFound(_0x1ef2ea,null))[_0x4b2b('0x28')](respondWithResult(_0x1ef2ea,null))[_0x4b2b('0x34')](handleError(_0x1ef2ea,null));};exports[_0x4b2b('0xac')]=function(_0x33019f,_0xfa2145){return db[_0x4b2b('0x36')]['create'](_0x33019f[_0x4b2b('0x6e')],{})[_0x4b2b('0x28')](respondWithResult(_0xfa2145,0xc9))[_0x4b2b('0x34')](handleError(_0xfa2145,null));};exports[_0x4b2b('0x27')]=function(_0x497483,_0x38995d){if(_0x497483[_0x4b2b('0x6e')]['id']){delete _0x497483[_0x4b2b('0x6e')]['id'];}return db[_0x4b2b('0x36')][_0x4b2b('0x5b')]({'where':{'id':_0x497483[_0x4b2b('0xa8')]['id']}})[_0x4b2b('0x28')](handleEntityNotFound(_0x38995d,null))[_0x4b2b('0x28')](saveUpdates(_0x497483[_0x4b2b('0x6e')],null))[_0x4b2b('0x28')](respondWithResult(_0x38995d,null))['catch'](handleError(_0x38995d,null));};exports[_0x4b2b('0x29')]=function(_0x50cd8d,_0x26fd23){return db[_0x4b2b('0x36')][_0x4b2b('0x5b')]({'where':{'id':_0x50cd8d['params']['id']}})[_0x4b2b('0x28')](handleEntityNotFound(_0x26fd23,null))[_0x4b2b('0x28')](removeEntity(_0x26fd23,null))['catch'](handleError(_0x26fd23,null));};exports['describe']=function(_0x4d37c9,_0x3b7891){return db[_0x4b2b('0x36')][_0x4b2b('0xad')]()[_0x4b2b('0x28')](respondWithResult(_0x3b7891,null))[_0x4b2b('0x34')](handleError(_0x3b7891,null));};exports[_0x4b2b('0xae')]=function(_0x45944f,_0x2a842f,_0x5998ce){return db[_0x4b2b('0xaf')]['find']({'where':{'id':_0x45944f[_0x4b2b('0xa8')]['id']}})[_0x4b2b('0x28')](handleEntityNotFound(_0x2a842f,null))[_0x4b2b('0x28')](function(_0x2d1d76){if(_0x2d1d76){return _0x2d1d76[_0x4b2b('0xae')](_0x45944f['body'][_0x4b2b('0xb0')],_[_0x4b2b('0xb1')](_0x45944f[_0x4b2b('0x6e')],[_0x4b2b('0xb0'),'id'])||{});}})[_0x4b2b('0x28')](respondWithResult(_0x2a842f,null))['catch'](handleError(_0x2a842f,null));};exports['getMessages']=function(_0x6eda16,_0x3adb1e,_0x5a8c71){var _0x771927={'raw':![],'where':{}};var _0x4712c0={};var _0x487f02={'count':0x0,'rows':[]};return db[_0x4b2b('0x36')][_0x4b2b('0xb2')]({'where':{'id':_0x6eda16[_0x4b2b('0xa8')]['id']}})[_0x4b2b('0x28')](handleEntityNotFound(_0x3adb1e,null))[_0x4b2b('0x28')](function(_0x4d1909){if(_0x4d1909){_0x4712c0['model']=_['keys'](db[_0x4b2b('0xaf')][_0x4b2b('0x37')]);_0x4712c0[_0x4b2b('0x3b')]=_[_0x4b2b('0x3c')](_0x6eda16[_0x4b2b('0x3b')]);_0x4712c0['filters']=_[_0x4b2b('0x3e')](_0x4712c0[_0x4b2b('0x3a')],_0x4712c0[_0x4b2b('0x3b')]);_0x771927[_0x4b2b('0x3f')]=_[_0x4b2b('0x3e')](_0x4712c0['model'],qs[_0x4b2b('0x40')](_0x6eda16[_0x4b2b('0x3b')][_0x4b2b('0x40')]));_0x771927[_0x4b2b('0x3f')]=_0x771927[_0x4b2b('0x3f')][_0x4b2b('0x41')]?_0x771927[_0x4b2b('0x3f')]:_0x4712c0[_0x4b2b('0x3a')];if(!_0x6eda16[_0x4b2b('0x3b')][_0x4b2b('0x42')](_0x4b2b('0x43'))){_0x771927[_0x4b2b('0x22')]=qs[_0x4b2b('0x22')](_0x6eda16['query']['limit']);_0x771927['offset']=qs[_0x4b2b('0x21')](_0x6eda16['query']['offset']);}_0x771927[_0x4b2b('0x44')]=qs['sort'](_0x6eda16['query'][_0x4b2b('0x45')]);_0x771927[_0x4b2b('0x46')]=qs[_0x4b2b('0x3d')](_[_0x4b2b('0x47')](_0x6eda16['query'],_0x4712c0[_0x4b2b('0x3d')]));_0x771927[_0x4b2b('0x46')][_0x4b2b('0xb3')]=_0x4d1909['id'];if(_0x6eda16[_0x4b2b('0x3b')][_0x4b2b('0xb4')]){_0x771927[_0x4b2b('0x46')]=_[_0x4b2b('0xab')](_0x771927['where'],{'$or':_[_0x4b2b('0x2f')](_0x771927[_0x4b2b('0x3f')],function(_0x394ac0){var _0xe83cf0={};_0xe83cf0[_0x394ac0]={'$like':'%'+_0x6eda16['query']['filter']+'%'};return _0xe83cf0;})});}if(_0x6eda16[_0x4b2b('0x3b')][_0x4b2b('0x76')]){var _0x6c5912=_0x6eda16[_0x4b2b('0x3b')][_0x4b2b('0x76')][_0x4b2b('0x69')](',');var _0x49574c={};_0x49574c[_0x6c5912[0x0]]={'$gte':moment(_0x6c5912[0x1])[_0x4b2b('0xb5')](_0x4b2b('0xb6'))};_0x771927[_0x4b2b('0x46')]=_['merge'](_0x771927['where'],_0x49574c);}_0x771927=_['merge']({},_0x771927,_0x6eda16[_0x4b2b('0xb7')]);return db[_0x4b2b('0xaf')][_0x4b2b('0x20')]({'where':_0x771927[_0x4b2b('0x46')]})['then'](function(_0x3cb315){_0x487f02[_0x4b2b('0x20')]=_0x3cb315;if(_0x6eda16[_0x4b2b('0x3b')][_0x4b2b('0xa9')]){_0x771927[_0x4b2b('0xaa')]=[{'all':!![]}];}return db[_0x4b2b('0xaf')][_0x4b2b('0xb8')](_0x771927);})[_0x4b2b('0x28')](function(_0x45e73e){_0x487f02[_0x4b2b('0xb9')]=_0x45e73e;return _0x487f02;});}})[_0x4b2b('0x28')](respondWithFilteredResult(_0x3adb1e,_0x771927))[_0x4b2b('0x34')](handleError(_0x3adb1e,null));};exports[_0x4b2b('0xba')]=function(_0xe52e4b,_0x5893ba,_0x52ee7b){return db[_0x4b2b('0x36')][_0x4b2b('0x5b')]({'where':{'id':_0xe52e4b[_0x4b2b('0xa8')]['id']}})[_0x4b2b('0x28')](handleEntityNotFound(_0x5893ba,null))[_0x4b2b('0x28')](function(_0x473352){if(_0x473352){return _0x473352[_0x4b2b('0xbb')](_0xe52e4b[_0x4b2b('0x6e')][_0x4b2b('0xb0')],_[_0x4b2b('0xb1')](_0xe52e4b[_0x4b2b('0x6e')],[_0x4b2b('0xb0'),'id'])||{})[_0x4b2b('0xbc')](function(){return db[_0x4b2b('0x68')]['findAll']({'attributes':['id',_0x4b2b('0x2d'),_0x4b2b('0x4a')],'where':{'id':_0xe52e4b[_0x4b2b('0x6e')][_0x4b2b('0xb0')]}});})['then'](function(_0x14a5ff){socket[_0x4b2b('0xbd')]('openchannelInteractionTags:save',{'id':Number(_0xe52e4b[_0x4b2b('0xa8')]['id']),'tags':_0x14a5ff||[]});return{'id':Number(_0xe52e4b[_0x4b2b('0xa8')]['id']),'tags':_0x14a5ff||[]};});}})[_0x4b2b('0x28')](respondWithResult(_0x5893ba,null))[_0x4b2b('0x34')](handleError(_0x5893ba,null));};exports[_0x4b2b('0xbe')]=function(_0x27e170,_0x11fdbd,_0x5f0b2c){return db['OpenchannelInteraction'][_0x4b2b('0x5b')]({'where':{'id':_0x27e170[_0x4b2b('0xa8')]['id']}})[_0x4b2b('0x28')](handleEntityNotFound(_0x11fdbd,null))['then'](function(_0x305b1a){if(_0x305b1a){return _0x305b1a[_0x4b2b('0xbe')](_0x27e170['query'][_0x4b2b('0xb0')]);}})[_0x4b2b('0x28')](respondWithStatusCode(_0x11fdbd,null))['catch'](handleError(_0x11fdbd,null));};exports['download']=function(_0x1bcf96,_0x5d64d6){var _0x3166d1=moment()[_0x4b2b('0xbf')]()[_0x4b2b('0x93')]();var _0x214e34=path['join'](config[_0x4b2b('0xc0')],_0x4b2b('0xc1'),'files',_0x4b2b('0xc2'));var _0x1bcaa8=path[_0x4b2b('0xc3')](config[_0x4b2b('0xc0')],'server','files',_0x4b2b('0xc4'));var _0x24aa75=path[_0x4b2b('0xc3')](_0x214e34,_0x3166d1);var _0x36fa38=util[_0x4b2b('0xb5')](_0x4b2b('0xc5'),_0x1bcf96[_0x4b2b('0xa8')]['id'],_0x3166d1);var _0x2847d8=path[_0x4b2b('0xc3')](_0x214e34,_0x36fa38);var _0x2ae596=[];_0x2ae596['push']({'model':db[_0x4b2b('0xc6')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x2ae596[_0x4b2b('0xc7')]({'model':db[_0x4b2b('0xc8')],'as':_0x4b2b('0x5e'),'attributes':['id',_0x4b2b('0xc9'),_0x4b2b('0xca')],'raw':!![]});if(_0x1bcf96[_0x4b2b('0x3b')][_0x4b2b('0xc4')]){_0x2ae596['push']({'model':db['Attachment'],'as':_0x4b2b('0xcb'),'raw':!![]});}var _0x2f027c=[{'model':db['OpenchannelMessage'],'as':_0x4b2b('0xcc'),'attributes':['id',_0x4b2b('0x6e'),_0x4b2b('0x74'),_0x4b2b('0xcd'),'secret','read'],'include':_0x2ae596}];_0x2f027c[_0x4b2b('0xc7')]({'model':db[_0x4b2b('0xce')],'as':_0x4b2b('0xcf'),'attributes':['id',_0x4b2b('0x2d')]});_0x2f027c['push']({'model':db['User'],'as':_0x4b2b('0xd0'),'attributes':['id',_0x4b2b('0x30')]});return db[_0x4b2b('0x36')]['find']({'where':{'id':_0x1bcf96[_0x4b2b('0xa8')]['id']},'include':_0x2f027c})['then'](handleEntityNotFound(_0x5d64d6,null))[_0x4b2b('0x28')](function(_0x4c8f77){if(_0x4c8f77){var _0x27d326=_0x4c8f77[_0x4b2b('0xd1')]({'plain':!![]});fs[_0x4b2b('0xd2')](_0x24aa75);var _0x316904={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x4b2b('0xd3')}},'footer':{'height':'30px','contents':{'default':util[_0x4b2b('0xb5')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x4b2b('0xb5')](_0x4b2b('0xd4'),_0x4b2b('0xd5'),_0x27d326['id']),moment()['format']('YYYY-MM-DD')[_0x4b2b('0x93')]())}}};var _0x47151b={'channel':_0x4b2b('0xd5'),'account':_0x27d326[_0x4b2b('0xcf')][_0x4b2b('0x2d')],'agent':_0x27d326[_0x4b2b('0xd0')]?_0x27d326[_0x4b2b('0xd0')][_0x4b2b('0x30')]:_0x4b2b('0xd6'),'createdAt':moment(_0x27d326[_0x4b2b('0x74')])[_0x4b2b('0xb5')](_0x4b2b('0xb6'))['toString'](),'closedAt':_0x27d326[_0x4b2b('0xd7')]?moment(_0x27d326[_0x4b2b('0xd8')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4b2b('0x93')]():'','disposition':_0x27d326[_0x4b2b('0xd9')],'visibility':_0x27d326[_0x4b2b('0xda')]?'Public':_0x4b2b('0xdb'),'messages':_(_0x27d326['Messages'])[_0x4b2b('0xb4')]({'secret':![]})['map'](function(_0xea8885){if(_0xea8885['Attachment']){var _0x37ef10=path[_0x4b2b('0xc3')](_0x1bcaa8,_0xea8885['Attachment']['basename']);if(fs[_0x4b2b('0xdc')](_0x37ef10)){fs['createReadStream'](_0x37ef10)[_0x4b2b('0xdd')](fs[_0x4b2b('0xde')](path[_0x4b2b('0xc3')](_0x24aa75,_0xea8885['Attachment'][_0x4b2b('0xdf')])));}}return{'date':moment(_0xea8885[_0x4b2b('0x74')])['format'](_0x4b2b('0xb6'))[_0x4b2b('0x93')](),'sender':_0xea8885[_0x4b2b('0xcd')]===_0x4b2b('0xe0')?_0xea8885[_0x4b2b('0xc6')]?_0xea8885['User'][_0x4b2b('0x30')]:_0x4b2b('0xe1'):_0xea8885[_0x4b2b('0x5e')][_0x4b2b('0xc9')]+(_0xea8885[_0x4b2b('0x5e')][_0x4b2b('0xca')]?'\x20'+_0xea8885[_0x4b2b('0x5e')][_0x4b2b('0xca')]:''),'body':_0xea8885['Attachment']?_0xea8885['Attachment'][_0x4b2b('0xdf')]:_0xea8885[_0x4b2b('0x6e')],'direction':_0xea8885[_0x4b2b('0xcd')]===_0x4b2b('0xe0')?'A':'C','secret':_0xea8885[_0x4b2b('0xe2')],'read':_0xea8885[_0x4b2b('0x7b')],'attachment':_0xea8885[_0x4b2b('0xcb')]};})[_0x4b2b('0x5d')]()};return ejs[_0x4b2b('0xe3')](path['join'](config['root'],_0x4b2b('0xc1'),_0x4b2b('0xe4'),'downloadInteraction.html'),{'interaction':_0x47151b})[_0x4b2b('0x28')](function(_0x52a720){return new BPromise(function(_0x2ca5c0,_0x1e68e7){pdf[_0x4b2b('0xac')](_0x52a720,_0x316904)[_0x4b2b('0xe5')](path[_0x4b2b('0xc3')](_0x24aa75,_0x4b2b('0xe6')+_0x27d326['id']+'-'+_0x3166d1+_0x4b2b('0xe7')),function(_0x55cb25,_0x463eae){if(_0x55cb25)return _0x1e68e7(_0x55cb25);_0x2ca5c0(_0x463eae);});});})[_0x4b2b('0x28')](function(){return new BPromise(function(_0x593292,_0x3d45b0){zipdir(_0x24aa75,{'saveTo':_0x2847d8},function(_0x533a98,_0x38a225){if(_0x533a98)return _0x3d45b0(_0x533a98);return _0x593292(_0x38a225);});})[_0x4b2b('0x28')](function(){return new BPromise(function(_0x3bb095,_0x568586){rimraf(_0x24aa75,function(_0x4ecc79){if(_0x4ecc79)_0x568586(_0x4ecc79);return _0x3bb095();});});})['then'](function(){return _0x5d64d6[_0x4b2b('0xe8')](_0x2847d8,_0x36fa38,function(_0x4bc0b3){if(_0x4bc0b3){console[_0x4b2b('0xe9')](_0x4b2b('0xea'),_0x4bc0b3);}else{fs[_0x4b2b('0xeb')](_0x2847d8);}});});});}else{return _0x5d64d6[_0x4b2b('0x1d')](0xc8);}})[_0x4b2b('0x34')](handleError(_0x5d64d6,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 915d408..9d54438 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 _0xd19c=['save','remove','getUsers','then','Users','findAll','setDataValue','emit','catch','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xd19c,0x113));var _0xcd19=function(_0x38e1c3,_0x421148){_0x38e1c3=_0x38e1c3-0x0;var _0x451552=_0xd19c[_0x38e1c3];return _0x451552;};'use strict';var EventEmitter=require(_0xcd19('0x0'));var OpenchannelInteraction=require(_0xcd19('0x1'))['db'][_0xcd19('0x2')];var OpenchannelMessage=require(_0xcd19('0x1'))['db'][_0xcd19('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xcd19('0x4')](0x0);var events={'afterCreate':_0xcd19('0x5'),'afterUpdate':'update','afterDestroy':_0xcd19('0x6')};function emitEvent(_0x46fc77){return function(_0x4bccb2,_0x3131ae,_0x151b6b){_0x4bccb2[_0xcd19('0x7')]({'attributes':['id'],'raw':!![]})[_0xcd19('0x8')](function(_0x450acc){_0x4bccb2['setDataValue'](_0xcd19('0x9'),_0x450acc['map'](function(_0x1ab503){return{'id':_0x1ab503['id']};}));return OpenchannelMessage[_0xcd19('0xa')]({'where':{'OpenchannelInteractionId':_0x4bccb2['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcd19('0x8')](function(_0x256c48){_0x4bccb2[_0xcd19('0xb')]('unreadMessages',_0x256c48['length']);OpenchannelInteractionEvents[_0xcd19('0xc')](_0x46fc77+':'+_0x4bccb2['id'],_0x4bccb2);OpenchannelInteractionEvents[_0xcd19('0xc')](_0x46fc77,_0x4bccb2);_0x151b6b(null);})[_0xcd19('0xd')](_0x151b6b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xe19a=['emit','catch','hook','exports','events','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x328621,_0xef7008){var _0x141b03=function(_0x4209c1){while(--_0x4209c1){_0x328621['push'](_0x328621['shift']());}};_0x141b03(++_0xef7008);}(_0xe19a,0xd4));var _0xae19=function(_0x1dc73e,_0x792805){_0x1dc73e=_0x1dc73e-0x0;var _0x35274b=_0xe19a[_0x1dc73e];return _0x35274b;};'use strict';var EventEmitter=require(_0xae19('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xae19('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xae19('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xae19('0x3')](0x0);var events={'afterCreate':_0xae19('0x4'),'afterUpdate':'update','afterDestroy':_0xae19('0x5')};function emitEvent(_0x497c77){return function(_0x3861c6,_0x3d361d,_0x2f6bda){_0x3861c6[_0xae19('0x6')]({'attributes':['id'],'raw':!![]})[_0xae19('0x7')](function(_0x967d55){_0x3861c6[_0xae19('0x8')](_0xae19('0x9'),_0x967d55[_0xae19('0xa')](function(_0x5a9758){return{'id':_0x5a9758['id']};}));return OpenchannelMessage[_0xae19('0xb')]({'where':{'OpenchannelInteractionId':_0x3861c6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xae19('0x7')](function(_0x2d69e0){_0x3861c6[_0xae19('0x8')]('unreadMessages',_0x2d69e0['length']);OpenchannelInteractionEvents[_0xae19('0xc')](_0x497c77+':'+_0x3861c6['id'],_0x3861c6);OpenchannelInteractionEvents[_0xae19('0xc')](_0x497c77,_0x3861c6);_0x2f6bda(null);})[_0xae19('0xd')](_0x2f6bda(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xae19('0xe')](e,emitEvent(event));}}module[_0xae19('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index b184113..6d43128 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 _0xc2f0=['./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','changed','closedAt','lodash','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2247ab,_0x3f4162){var _0x430062=function(_0x591dd7){while(--_0x591dd7){_0x2247ab['push'](_0x2247ab['shift']());}};_0x430062(++_0x3f4162);}(_0xc2f0,0xfd));var _0x0c2f=function(_0x40fe6a,_0x1a4901){_0x40fe6a=_0x40fe6a-0x0;var _0x34dcc3=_0xc2f0[_0x40fe6a];return _0x34dcc3;};'use strict';var _=require(_0x0c2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0c2f('0x1'));var moment=require(_0x0c2f('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c2f('0x3'));var fs=require('fs');var path=require(_0x0c2f('0x4'));var rimraf=require(_0x0c2f('0x5'));var config=require(_0x0c2f('0x6'));var attributes=require(_0x0c2f('0x7'));module[_0x0c2f('0x8')]=function(_0x639e6d,_0x2a331d){return _0x639e6d[_0x0c2f('0x9')](_0x0c2f('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5d9b1e,_0x10536b,_0x4a9669){if(_0x5d9b1e[_0x0c2f('0xb')]('closed')){_0x5d9b1e[_0x0c2f('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4a9669(null,_0x5d9b1e);}}});}; \ No newline at end of file +var _0x7d19=['path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise'];(function(_0x1046cb,_0x137f83){var _0x59c46a=function(_0x3b2e08){while(--_0x3b2e08){_0x1046cb['push'](_0x1046cb['shift']());}};_0x59c46a(++_0x137f83);}(_0x7d19,0x175));var _0x97d1=function(_0x33f7e1,_0x48d209){_0x33f7e1=_0x33f7e1-0x0;var _0x23bab4=_0x7d19[_0x33f7e1];return _0x23bab4;};'use strict';var _=require(_0x97d1('0x0'));var util=require(_0x97d1('0x1'));var logger=require('../../config/logger')(_0x97d1('0x2'));var moment=require('moment');var BPromise=require(_0x97d1('0x3'));var rp=require(_0x97d1('0x4'));var fs=require('fs');var path=require(_0x97d1('0x5'));var rimraf=require(_0x97d1('0x6'));var config=require(_0x97d1('0x7'));var attributes=require(_0x97d1('0x8'));module[_0x97d1('0x9')]=function(_0xf4aeae,_0x144888){return _0xf4aeae[_0x97d1('0xa')](_0x97d1('0xb'),attributes,{'tableName':_0x97d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x511c91,_0x4b1823,_0x4f73f6){if(_0x511c91[_0x97d1('0xd')](_0x97d1('0xe'))){_0x511c91[_0x97d1('0xf')]=moment()[_0x97d1('0x10')](_0x97d1('0x11'));}_0x4f73f6(null,_0x511c91);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index a34cfc2..7f40091 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 _0x03ff=['request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','limit','AddTagsToOpenchannelInteraction','addTags','ids','omit','spread','AddTags','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register'];(function(_0x4f0937,_0x4a50b5){var _0x46b486=function(_0xa4ee29){while(--_0xa4ee29){_0x4f0937['push'](_0x4f0937['shift']());}};_0x46b486(++_0x4a50b5);}(_0x03ff,0xb2));var _0xf03f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x03ff[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf03f('0x0'));var BPromise=require(_0xf03f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf03f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf03f('0x3'));var logger=require('../../config/logger')(_0xf03f('0x4'));var config=require(_0xf03f('0x5'));var jayson=require(_0xf03f('0x6'));var client=jayson[_0xf03f('0x7')][_0xf03f('0x8')]({'port':0x232a});config[_0xf03f('0x9')]=_[_0xf03f('0xa')](config[_0xf03f('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf03f('0x9')]));require('./openchannelInteraction.socket')[_0xf03f('0xb')](socket);function respondWithRpcPromise(_0x4e2052,_0x235892,_0x56bd93){return new BPromise(function(_0x5acd66,_0x27b939){return client[_0xf03f('0xc')](_0x4e2052,_0x56bd93)[_0xf03f('0xd')](function(_0x3b318d){logger[_0xf03f('0xe')](_0xf03f('0xf'),_0x235892,_0xf03f('0x10'));logger[_0xf03f('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x235892,_0xf03f('0x10'),JSON[_0xf03f('0x12')](_0x3b318d));if(_0x3b318d[_0xf03f('0x13')]){if(_0x3b318d[_0xf03f('0x13')][_0xf03f('0x14')]===0x1f4){logger[_0xf03f('0x13')](_0xf03f('0xf'),_0x235892,_0x3b318d[_0xf03f('0x13')][_0xf03f('0x15')]);return _0x27b939(_0x3b318d[_0xf03f('0x13')][_0xf03f('0x15')]);}logger[_0xf03f('0x13')](_0xf03f('0xf'),_0x235892,_0x3b318d[_0xf03f('0x13')][_0xf03f('0x15')]);return _0x5acd66(_0x3b318d[_0xf03f('0x13')]['message']);}else{logger[_0xf03f('0xe')](_0xf03f('0xf'),_0x235892,'request\x20sent');_0x5acd66(_0x3b318d[_0xf03f('0x16')][_0xf03f('0x15')]);}})[_0xf03f('0x17')](function(_0x2b5837){logger[_0xf03f('0x13')](_0xf03f('0xf'),_0x235892,_0x2b5837);_0x27b939(_0x2b5837);});});}exports[_0xf03f('0x18')]=function(_0x51e4f5){var _0x2def72=this;return new Promise(function(_0x29efb3,_0x5cfaea){return db[_0xf03f('0x19')][_0xf03f('0x1a')](_0x51e4f5[_0xf03f('0x1b')],{'raw':_0x51e4f5[_0xf03f('0x1c')]?_0x51e4f5[_0xf03f('0x1c')][_0xf03f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51e4f5[_0xf03f('0x1c')]?_0x51e4f5[_0xf03f('0x1c')][_0xf03f('0x1e')]||null:null,'attributes':_0x51e4f5['options']?_0x51e4f5['options']['attributes']||null:null,'limit':_0x51e4f5[_0xf03f('0x1c')]?_0x51e4f5[_0xf03f('0x1c')][_0xf03f('0x1f')]||null:null})['then'](function(_0x4d81ba){logger[_0xf03f('0xe')]('UpdateOpenchannelInteraction',_0x51e4f5);logger[_0xf03f('0x11')](_0xf03f('0x18'),_0x51e4f5,JSON[_0xf03f('0x12')](_0x4d81ba));_0x29efb3(_0x4d81ba);})[_0xf03f('0x17')](function(_0x3b507b){logger[_0xf03f('0x13')](_0xf03f('0x18'),_0x3b507b[_0xf03f('0x15')],_0x51e4f5);_0x5cfaea(_0x2def72[_0xf03f('0x13')](0x1f4,_0x3b507b['message']));});});};exports[_0xf03f('0x20')]=function(_0x3c79ba){return new Promise(function(_0x27d9be,_0x2311f2){return db[_0xf03f('0x19')]['find']({'where':_0x3c79ba[_0xf03f('0x1c')]?_0x3c79ba['options'][_0xf03f('0x1e')]||null:null})['then'](function(_0x5f2093){if(_0x5f2093){return _0x5f2093[_0xf03f('0x21')](_0x3c79ba[_0xf03f('0x1b')][_0xf03f('0x22')],_[_0xf03f('0x23')](_0x3c79ba[_0xf03f('0x1b')],[_0xf03f('0x22'),'id'])||{});}})[_0xf03f('0x24')](function(_0x2d7127){logger[_0xf03f('0xe')]('AddTags',_0x3c79ba);logger['debug'](_0xf03f('0x25'),_0x3c79ba,JSON[_0xf03f('0x12')](_0x2d7127));_0x27d9be(_0x2d7127);})['catch'](function(_0x58d994){logger[_0xf03f('0x13')](_0xf03f('0x25'),_0x58d994[_0xf03f('0x15')],_0x3c79ba);_0x2311f2(_this[_0xf03f('0x13')](0x1f4,_0x58d994[_0xf03f('0x15')]));});});}; \ No newline at end of file +var _0xd140=['addTags','ids','omit','spread','AddTags','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','then','AddTagsToOpenchannelInteraction','where'];(function(_0x2376c7,_0x18e876){var _0x31ecbc=function(_0x1c289a){while(--_0x1c289a){_0x2376c7['push'](_0x2376c7['shift']());}};_0x31ecbc(++_0x18e876);}(_0xd140,0x1d4));var _0x0d14=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd140[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d14('0x0'));var util=require('util');var moment=require(_0x0d14('0x1'));var BPromise=require(_0x0d14('0x2'));var rs=require(_0x0d14('0x3'));var fs=require('fs');var Redis=require(_0x0d14('0x4'));var db=require(_0x0d14('0x5'))['db'];var utils=require(_0x0d14('0x6'));var logger=require('../../config/logger')(_0x0d14('0x7'));var config=require(_0x0d14('0x8'));var jayson=require(_0x0d14('0x9'));var client=jayson['client'][_0x0d14('0xa')]({'port':0x232a});config[_0x0d14('0xb')]=_[_0x0d14('0xc')](config[_0x0d14('0xb')],{'host':_0x0d14('0xd'),'port':0x18eb});var socket=require(_0x0d14('0xe'))(new Redis(config[_0x0d14('0xb')]));require(_0x0d14('0xf'))['register'](socket);function respondWithRpcPromise(_0x1b6874,_0x158eff,_0x597e0f){return new BPromise(function(_0x3ad203,_0x18ba15){return client[_0x0d14('0x10')](_0x1b6874,_0x597e0f)['then'](function(_0x33e545){logger[_0x0d14('0x11')](_0x0d14('0x12'),_0x158eff,_0x0d14('0x13'));logger['debug'](_0x0d14('0x14'),_0x158eff,'request\x20sent',JSON[_0x0d14('0x15')](_0x33e545));if(_0x33e545[_0x0d14('0x16')]){if(_0x33e545['error']['code']===0x1f4){logger[_0x0d14('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x158eff,_0x33e545['error'][_0x0d14('0x17')]);return _0x18ba15(_0x33e545[_0x0d14('0x16')][_0x0d14('0x17')]);}logger[_0x0d14('0x16')](_0x0d14('0x12'),_0x158eff,_0x33e545[_0x0d14('0x16')][_0x0d14('0x17')]);return _0x3ad203(_0x33e545[_0x0d14('0x16')]['message']);}else{logger[_0x0d14('0x11')](_0x0d14('0x12'),_0x158eff,_0x0d14('0x13'));_0x3ad203(_0x33e545[_0x0d14('0x18')]['message']);}})[_0x0d14('0x19')](function(_0x2d9da9){logger[_0x0d14('0x16')](_0x0d14('0x12'),_0x158eff,_0x2d9da9);_0x18ba15(_0x2d9da9);});});}exports[_0x0d14('0x1a')]=function(_0x48c1cb){var _0x306e44=this;return new Promise(function(_0x34f275,_0x2a3e45){return db[_0x0d14('0x1b')][_0x0d14('0x1c')](_0x48c1cb[_0x0d14('0x1d')],{'raw':_0x48c1cb['options']?_0x48c1cb[_0x0d14('0x1e')][_0x0d14('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48c1cb['options']?_0x48c1cb['options']['where']||null:null,'attributes':_0x48c1cb[_0x0d14('0x1e')]?_0x48c1cb[_0x0d14('0x1e')][_0x0d14('0x20')]||null:null,'limit':_0x48c1cb[_0x0d14('0x1e')]?_0x48c1cb['options']['limit']||null:null})[_0x0d14('0x21')](function(_0x14c7a8){logger[_0x0d14('0x11')](_0x0d14('0x1a'),_0x48c1cb);logger['debug'](_0x0d14('0x1a'),_0x48c1cb,JSON[_0x0d14('0x15')](_0x14c7a8));_0x34f275(_0x14c7a8);})[_0x0d14('0x19')](function(_0x53e788){logger[_0x0d14('0x16')](_0x0d14('0x1a'),_0x53e788['message'],_0x48c1cb);_0x2a3e45(_0x306e44[_0x0d14('0x16')](0x1f4,_0x53e788[_0x0d14('0x17')]));});});};exports[_0x0d14('0x22')]=function(_0x1be49d){return new Promise(function(_0x4d557e,_0x2d5059){return db[_0x0d14('0x1b')]['find']({'where':_0x1be49d['options']?_0x1be49d[_0x0d14('0x1e')][_0x0d14('0x23')]||null:null})[_0x0d14('0x21')](function(_0x50c333){if(_0x50c333){return _0x50c333[_0x0d14('0x24')](_0x1be49d[_0x0d14('0x1d')][_0x0d14('0x25')],_[_0x0d14('0x26')](_0x1be49d[_0x0d14('0x1d')],[_0x0d14('0x25'),'id'])||{});}})[_0x0d14('0x27')](function(_0x415033){logger['info'](_0x0d14('0x28'),_0x1be49d);logger[_0x0d14('0x29')]('AddTags',_0x1be49d,JSON['stringify'](_0x415033));_0x4d557e(_0x415033);})[_0x0d14('0x19')](function(_0x3de4e5){logger['error'](_0x0d14('0x28'),_0x3de4e5['message'],_0x1be49d);_0x2d5059(_this[_0x0d14('0x16')](0x1f4,_0x3de4e5[_0x0d14('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 2ebabd2..8c4deb3 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 _0x915d=['openchannelInteraction:','./openchannelInteraction.events','remove','emit','removeListener','register','length'];(function(_0x173d8f,_0x45db64){var _0x374b6e=function(_0x2af710){while(--_0x2af710){_0x173d8f['push'](_0x173d8f['shift']());}};_0x374b6e(++_0x45db64);}(_0x915d,0x197));var _0xd915=function(_0x17515a,_0x51935e){_0x17515a=_0x17515a-0x0;var _0x18f3b2=_0x915d[_0x17515a];return _0x18f3b2;};'use strict';var OpenchannelInteractionEvents=require(_0xd915('0x0'));var events=['save',_0xd915('0x1'),'update'];function createListener(_0x14a87a,_0x1c532d){return function(_0xd2098c){_0x1c532d[_0xd915('0x2')](_0x14a87a,_0xd2098c);};}function removeListener(_0x415bbf,_0x271f7a){return function(){OpenchannelInteractionEvents[_0xd915('0x3')](_0x415bbf,_0x271f7a);};}exports[_0xd915('0x4')]=function(_0x772aa2){for(var _0xa71413=0x0,_0x59b9f8=events[_0xd915('0x5')];_0xa71413<_0x59b9f8;_0xa71413++){var _0x3ac162=events[_0xa71413];var _0x367f77=createListener(_0xd915('0x6')+_0x3ac162,_0x772aa2);OpenchannelInteractionEvents['on'](_0x3ac162,_0x367f77);}}; \ No newline at end of file +var _0xf86b=['save','remove','update','emit','removeListener','register','length','openchannelInteraction:'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xf86b,0xb8));var _0xbf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86b[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xbf86('0x0'),_0xbf86('0x1'),_0xbf86('0x2')];function createListener(_0x23daa3,_0x240a30){return function(_0x2eb317){_0x240a30[_0xbf86('0x3')](_0x23daa3,_0x2eb317);};}function removeListener(_0x15d5f6,_0x18b82a){return function(){OpenchannelInteractionEvents[_0xbf86('0x4')](_0x15d5f6,_0x18b82a);};}exports[_0xbf86('0x5')]=function(_0x212f54){for(var _0x5d92d7=0x0,_0x5d93f7=events[_0xbf86('0x6')];_0x5d92d7<_0x5d93f7;_0x5d92d7++){var _0xf9c5a1=events[_0x5d92d7];var _0x1b996f=createListener(_0xbf86('0x7')+_0xf9c5a1,_0x212f54);OpenchannelInteractionEvents['on'](_0xf9c5a1,_0x1b996f);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index a456bb4..19291f9 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 _0x2b42=['isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x31ef12,_0x5622fb){var _0x5e7125=function(_0xcd0a36){while(--_0xcd0a36){_0x31ef12['push'](_0x31ef12['shift']());}};_0x5e7125(++_0x5622fb);}(_0x2b42,0xc0));var _0x22b4=function(_0x461c2c,_0x13f720){_0x461c2c=_0x461c2c-0x0;var _0x34ce82=_0x2b42[_0x461c2c];return _0x34ce82;};'use strict';var multer=require('multer');var util=require(_0x22b4('0x0'));var path=require(_0x22b4('0x1'));var timeout=require('connect-timeout');var express=require(_0x22b4('0x2'));var router=express['Router']();var auth=require(_0x22b4('0x3'));var interaction=require(_0x22b4('0x4'));var config=require(_0x22b4('0x5'));var controller=require(_0x22b4('0x6'));router[_0x22b4('0x7')]('/',auth[_0x22b4('0x8')](),controller[_0x22b4('0x9')]);router[_0x22b4('0x7')](_0x22b4('0xa'),auth[_0x22b4('0x8')](),controller[_0x22b4('0xb')]);router[_0x22b4('0x7')](_0x22b4('0xc'),auth[_0x22b4('0x8')](),controller[_0x22b4('0xd')]);router[_0x22b4('0xe')]('/',auth['isAuthenticated'](),interaction[_0x22b4('0xf')](_0x22b4('0x10'),'openchannelmessage:create'),controller[_0x22b4('0x11')]);router[_0x22b4('0x12')](_0x22b4('0xc'),auth[_0x22b4('0x8')](),controller[_0x22b4('0x13')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x22b4('0x14')]);router['put'](_0x22b4('0x15'),auth[_0x22b4('0x8')](),controller[_0x22b4('0x16')]);router[_0x22b4('0x17')](_0x22b4('0xc'),auth[_0x22b4('0x8')](),controller[_0x22b4('0x18')]);module['exports']=router; \ No newline at end of file +var _0x3615=['create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','isAuthenticated','index','get','/describe','describe','show','post','openchannel','openchannelmessage:create'];(function(_0xc4f7c0,_0x3d731b){var _0x479501=function(_0x36a2cd){while(--_0x36a2cd){_0xc4f7c0['push'](_0xc4f7c0['shift']());}};_0x479501(++_0x3d731b);}(_0x3615,0x14d));var _0x5361=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x3615[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x5361('0x0'));var util=require(_0x5361('0x1'));var path=require('path');var timeout=require(_0x5361('0x2'));var express=require(_0x5361('0x3'));var router=express[_0x5361('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5361('0x5'));var config=require(_0x5361('0x6'));var controller=require(_0x5361('0x7'));router['get']('/',auth[_0x5361('0x8')](),controller[_0x5361('0x9')]);router[_0x5361('0xa')](_0x5361('0xb'),auth[_0x5361('0x8')](),controller[_0x5361('0xc')]);router['get']('/:id',auth[_0x5361('0x8')](),controller[_0x5361('0xd')]);router[_0x5361('0xe')]('/',auth[_0x5361('0x8')](),interaction['tracked'](_0x5361('0xf'),_0x5361('0x10')),controller[_0x5361('0x11')]);router[_0x5361('0x12')](_0x5361('0x13'),auth['isAuthenticated'](),controller[_0x5361('0x14')]);router[_0x5361('0x12')](_0x5361('0x15'),auth[_0x5361('0x8')](),controller[_0x5361('0x16')]);router[_0x5361('0x12')](_0x5361('0x17'),auth[_0x5361('0x8')](),controller['reject']);router[_0x5361('0x18')](_0x5361('0x13'),auth[_0x5361('0x8')](),controller['destroy']);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 76be9b8..3cb0e59 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 _0x4a5e=['medium','BOOLEAN','out','DATE','sequelize','TEXT'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4a5e,0xac));var _0xe4a5=function(_0x2c63a4,_0x18a34f){_0x2c63a4=_0x2c63a4-0x0;var _0x210eb8=_0x4a5e[_0x2c63a4];return _0x210eb8;};'use strict';var Sequelize=require(_0xe4a5('0x0'));module['exports']={'body':{'type':Sequelize[_0xe4a5('0x1')](_0xe4a5('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe4a5('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe4a5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xe4a5('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe4a5('0x5')]}}; \ No newline at end of file +var _0x2f3b=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x3926fe,_0x41e4fb){var _0x14de82=function(_0x55836e){while(--_0x55836e){_0x3926fe['push'](_0x3926fe['shift']());}};_0x14de82(++_0x41e4fb);}(_0x2f3b,0x125));var _0xb2f3=function(_0x38db55,_0x50fbaa){_0x38db55=_0x38db55-0x0;var _0x3f5f45=_0x2f3b[_0x38db55];return _0x3f5f45;};'use strict';var Sequelize=require(_0xb2f3('0x0'));module[_0xb2f3('0x1')]={'body':{'type':Sequelize[_0xb2f3('0x2')](_0xb2f3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb2f3('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb2f3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb2f3('0x5')]('in',_0xb2f3('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xb2f3('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 5f81380..eb2d72d 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 _0x3c20=['include','findAll','rows','show','params','merge','find','create','body','../../config/logger','openchannel-interactions','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','role','interaction','null','AcceptMessage','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','localhost','./openchannelMessage.socket','register','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll'];(function(_0x2a4c3a,_0x338cb0){var _0x2f41cb=function(_0x55c499){while(--_0x55c499){_0x2a4c3a['push'](_0x2a4c3a['shift']());}};_0x2f41cb(++_0x338cb0);}(_0x3c20,0x118));var _0x03c2=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3c20[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x03c2('0x0'));var emlformat=require(_0x03c2('0x1'));var rimraf=require(_0x03c2('0x2'));var zipdir=require(_0x03c2('0x3'));var jsonpatch=require(_0x03c2('0x4'));var rp=require(_0x03c2('0x5'));var moment=require(_0x03c2('0x6'));var BPromise=require(_0x03c2('0x7'));var Mustache=require(_0x03c2('0x8'));var util=require(_0x03c2('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x03c2('0xa'));var ejs=require(_0x03c2('0xb'));var fs=require('fs');var _=require(_0x03c2('0xc'));var squel=require(_0x03c2('0xd'));var crypto=require(_0x03c2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x03c2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x03c2('0x10'));var Papa=require(_0x03c2('0x11'));var Redis=require(_0x03c2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x03c2('0x13'));var as=require(_0x03c2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x03c2('0x15'));var utils=require(_0x03c2('0x16'));var config=require(_0x03c2('0x17'));var db=require('../../mysqldb')['db'];config[_0x03c2('0x18')]=_[_0x03c2('0x19')](config['redis'],{'host':_0x03c2('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x03c2('0x1b'))[_0x03c2('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x03c2('0x1d')][_0x03c2('0x1e')]({'port':0x232c});var client9002=jayson[_0x03c2('0x1d')][_0x03c2('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x5d07ef,_0x308ca6,_0x5000b8){if(_0x5000b8){var _0x33f0f5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33f0f5[_0x03c2('0x1f')](_0x308ca6)){return _0x5d07ef;}else{throw new db['Sequelize']['ValidationError'](_0x03c2('0x20'));}}else{return _0x5d07ef;}}function respondWithRpcPromise(_0x1cd0d7,_0xe5a1d4,_0x201b51,_0x3b50d3){return new BPromise(function(_0x3fc6c4,_0x28efa3){var _0x24d1fc=_0x3b50d3||client;return _0x24d1fc['request'](_0x1cd0d7,_0x201b51)[_0x03c2('0x21')](function(_0x59de7e){logger[_0x03c2('0x22')](_0x03c2('0x23'),_0xe5a1d4,'request\x20sent');logger[_0x03c2('0x24')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xe5a1d4,_0x03c2('0x25'),JSON[_0x03c2('0x26')](_0x59de7e));if(_0x59de7e[_0x03c2('0x27')]){if(_0x59de7e[_0x03c2('0x27')]['code']===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xe5a1d4,_0x59de7e['error'][_0x03c2('0x28')]);return _0x28efa3(_0x59de7e[_0x03c2('0x27')]['message']);}logger[_0x03c2('0x27')](_0x03c2('0x23'),_0xe5a1d4,_0x59de7e[_0x03c2('0x27')][_0x03c2('0x28')]);return _0x3fc6c4(_0x59de7e[_0x03c2('0x27')][_0x03c2('0x28')]);}else{logger[_0x03c2('0x22')](_0x03c2('0x23'),_0xe5a1d4,_0x03c2('0x25'));_0x3fc6c4(_0x59de7e[_0x03c2('0x29')][_0x03c2('0x28')]);}})[_0x03c2('0x2a')](function(_0x37ed22){logger['error'](_0x03c2('0x23'),_0xe5a1d4,_0x37ed22);_0x28efa3(_0x37ed22);});});}function respondWithStatusCode(_0x3da49c,_0x11f23c){_0x11f23c=_0x11f23c||0xcc;return function(_0x40681a){if(_0x40681a){return _0x3da49c[_0x03c2('0x2b')](_0x11f23c);}return _0x3da49c[_0x03c2('0x2c')](_0x11f23c)[_0x03c2('0x2d')]();};}function respondWithResult(_0x1e7c42,_0x22aad0){_0x22aad0=_0x22aad0||0xc8;return function(_0x2ac331){if(_0x2ac331){return _0x1e7c42[_0x03c2('0x2c')](_0x22aad0)[_0x03c2('0x2e')](_0x2ac331);}};}function respondWithFilteredResult(_0x45f0c8,_0x1927fb){return function(_0x3a112){if(_0x3a112){var _0x5ee38b=_0x3a112[_0x03c2('0x2f')],_0x37611b=_0x1927fb['offset'],_0x58a551=_0x1927fb[_0x03c2('0x30')]+_0x1927fb[_0x03c2('0x31')],_0x1623e9;if(_0x58a551>=_0x5ee38b){_0x58a551=_0x5ee38b;_0x1623e9=0xc8;}else{_0x1623e9=0xce;}_0x45f0c8[_0x03c2('0x2c')](_0x1623e9);return _0x45f0c8['set'](_0x03c2('0x32'),_0x37611b+'-'+_0x58a551+'/'+_0x5ee38b)[_0x03c2('0x2e')](_0x3a112);}return null;};}function patchUpdates(_0x52a245){return function(_0x276c05){try{jsonpatch[_0x03c2('0x33')](_0x276c05,_0x52a245,!![]);}catch(_0x26840c){return BPromise[_0x03c2('0x34')](_0x26840c);}return _0x276c05[_0x03c2('0x35')]();};}function saveUpdates(_0x4308f2,_0x14c318){return function(_0x15948d){if(_0x15948d){return _0x15948d[_0x03c2('0x36')](_0x4308f2)[_0x03c2('0x21')](function(_0x49d3bf){return _0x49d3bf;});}return null;};}function removeEntity(_0x564d10,_0x1c7a78){return function(_0xe6ccc8){if(_0xe6ccc8){return _0xe6ccc8[_0x03c2('0x37')]()['then'](function(){_0x564d10[_0x03c2('0x2c')](0xcc)[_0x03c2('0x2d')]();});}};}function handleEntityNotFound(_0x3f5ad4,_0xc1d5d1){return function(_0x44b33d){if(!_0x44b33d){_0x3f5ad4[_0x03c2('0x2b')](0x194);}return _0x44b33d;};}function handleError(_0x54b150,_0x328cf9){_0x328cf9=_0x328cf9||0x1f4;return function(_0x443633){logger[_0x03c2('0x27')](_0x443633[_0x03c2('0x38')]);if(_0x443633['name']){delete _0x443633[_0x03c2('0x39')];}_0x54b150['status'](_0x328cf9)[_0x03c2('0x3a')](_0x443633);};}exports[_0x03c2('0x3b')]=function(_0x468d59,_0xc44a05){var _0x378abe={},_0x2d568c={},_0x29a296={'count':0x0,'rows':[]};var _0x289511=_[_0x03c2('0x3c')](db[_0x03c2('0x3d')][_0x03c2('0x3e')],function(_0x1f8e98){return{'name':_0x1f8e98[_0x03c2('0x3f')],'type':_0x1f8e98[_0x03c2('0x40')]['key']};});_0x2d568c[_0x03c2('0x41')]=_[_0x03c2('0x3c')](_0x289511,'name');_0x2d568c[_0x03c2('0x42')]=_[_0x03c2('0x43')](_0x468d59[_0x03c2('0x42')]);_0x2d568c[_0x03c2('0x44')]=_['intersection'](_0x2d568c[_0x03c2('0x41')],_0x2d568c[_0x03c2('0x42')]);_0x378abe['attributes']=_[_0x03c2('0x45')](_0x2d568c[_0x03c2('0x41')],qs[_0x03c2('0x46')](_0x468d59['query']['fields']));_0x378abe[_0x03c2('0x47')]=_0x378abe['attributes'][_0x03c2('0x48')]?_0x378abe[_0x03c2('0x47')]:_0x2d568c[_0x03c2('0x41')];if(!_0x468d59['query'][_0x03c2('0x49')](_0x03c2('0x4a'))){_0x378abe[_0x03c2('0x31')]=qs['limit'](_0x468d59[_0x03c2('0x42')][_0x03c2('0x31')]);_0x378abe[_0x03c2('0x30')]=qs[_0x03c2('0x30')](_0x468d59['query'][_0x03c2('0x30')]);}_0x378abe[_0x03c2('0x4b')]=qs[_0x03c2('0x4c')](_0x468d59[_0x03c2('0x42')]['sort']);_0x378abe[_0x03c2('0x4d')]=qs[_0x03c2('0x44')](_[_0x03c2('0x4e')](_0x468d59['query'],_0x2d568c[_0x03c2('0x44')]),_0x289511);if(_0x468d59[_0x03c2('0x42')]['filter']){_0x378abe[_0x03c2('0x4d')]=_['merge'](_0x378abe[_0x03c2('0x4d')],{'$or':_[_0x03c2('0x3c')](_0x289511,function(_0x5a0ca3){if(_0x5a0ca3[_0x03c2('0x40')]!==_0x03c2('0x4f')){var _0x11ad66={};_0x11ad66[_0x5a0ca3[_0x03c2('0x39')]]={'$like':'%'+_0x468d59[_0x03c2('0x42')][_0x03c2('0x50')]+'%'};return _0x11ad66;}})});}_0x378abe=_['merge']({},_0x378abe,_0x468d59[_0x03c2('0x51')]);var _0x3467cb={'where':_0x378abe[_0x03c2('0x4d')]};return db[_0x03c2('0x3d')]['count'](_0x3467cb)[_0x03c2('0x21')](function(_0x376ace){_0x29a296[_0x03c2('0x2f')]=_0x376ace;if(_0x468d59[_0x03c2('0x42')][_0x03c2('0x52')]){_0x378abe[_0x03c2('0x53')]=[{'all':!![]}];}return db[_0x03c2('0x3d')][_0x03c2('0x54')](_0x378abe);})['then'](function(_0x162e46){_0x29a296[_0x03c2('0x55')]=_0x162e46;return _0x29a296;})['then'](respondWithFilteredResult(_0xc44a05,_0x378abe))[_0x03c2('0x2a')](handleError(_0xc44a05,null));};exports[_0x03c2('0x56')]=function(_0x497875,_0x240376){var _0x2fd00f={'raw':!![],'where':{'id':_0x497875[_0x03c2('0x57')]['id']}},_0x47ca88={};_0x47ca88[_0x03c2('0x41')]=_[_0x03c2('0x43')](db['OpenchannelMessage'][_0x03c2('0x3e')]);_0x47ca88[_0x03c2('0x42')]=_[_0x03c2('0x43')](_0x497875[_0x03c2('0x42')]);_0x47ca88['filters']=_['intersection'](_0x47ca88[_0x03c2('0x41')],_0x47ca88[_0x03c2('0x42')]);_0x2fd00f['attributes']=_[_0x03c2('0x45')](_0x47ca88[_0x03c2('0x41')],qs['fields'](_0x497875[_0x03c2('0x42')]['fields']));_0x2fd00f[_0x03c2('0x47')]=_0x2fd00f[_0x03c2('0x47')][_0x03c2('0x48')]?_0x2fd00f[_0x03c2('0x47')]:_0x47ca88[_0x03c2('0x41')];if(_0x497875[_0x03c2('0x42')][_0x03c2('0x52')]){_0x2fd00f[_0x03c2('0x53')]=[{'all':!![]}];}_0x2fd00f=_[_0x03c2('0x58')]({},_0x2fd00f,_0x497875[_0x03c2('0x51')]);return db[_0x03c2('0x3d')][_0x03c2('0x59')](_0x2fd00f)[_0x03c2('0x21')](handleEntityNotFound(_0x240376,null))[_0x03c2('0x21')](respondWithResult(_0x240376,null))['catch'](handleError(_0x240376,null));};exports[_0x03c2('0x5a')]=function(_0x8192e1,_0x2ed7fb){return db['OpenchannelMessage']['create'](_0x8192e1[_0x03c2('0x5b')],{})['then'](respondWithResult(_0x2ed7fb,0xc9))[_0x03c2('0x2a')](handleError(_0x2ed7fb,null));};exports['update']=function(_0x4814d9,_0x36b9e7){if(_0x4814d9[_0x03c2('0x5b')]['id']){delete _0x4814d9[_0x03c2('0x5b')]['id'];}return db[_0x03c2('0x3d')]['find']({'where':{'id':_0x4814d9['params']['id']}})[_0x03c2('0x21')](handleEntityNotFound(_0x36b9e7,null))[_0x03c2('0x21')](saveUpdates(_0x4814d9[_0x03c2('0x5b')],null))['then'](respondWithResult(_0x36b9e7,null))['catch'](handleError(_0x36b9e7,null));};exports['destroy']=function(_0x5489f8,_0x13e4ef){return db['OpenchannelMessage']['find']({'where':{'id':_0x5489f8[_0x03c2('0x57')]['id']}})[_0x03c2('0x21')](handleEntityNotFound(_0x13e4ef,null))[_0x03c2('0x21')](removeEntity(_0x13e4ef,null))[_0x03c2('0x2a')](handleError(_0x13e4ef,null));};exports['describe']=function(_0x25715f,_0x3e3429){return db[_0x03c2('0x3d')]['describe']()[_0x03c2('0x21')](respondWithResult(_0x3e3429,null))[_0x03c2('0x2a')](handleError(_0x3e3429,null));};var interaction_log=require(_0x03c2('0x5c'))(_0x03c2('0x5d'));exports['accept']=function(_0x43f1c8,_0x32ec93,_0x5f30d3){var _0x18b5c5={'channel':_0x03c2('0x5e')};if(_0x43f1c8[_0x03c2('0x5b')]['id']){delete _0x43f1c8[_0x03c2('0x5b')]['id'];}_0x43f1c8[_0x03c2('0x5b')][_0x03c2('0x5f')]=!![];_0x43f1c8['body']['readAt']=moment()[_0x03c2('0x60')](_0x03c2('0x61'));_0x43f1c8[_0x03c2('0x5b')][_0x03c2('0x62')]=_0x43f1c8['body'][_0x03c2('0x62')]||_0x43f1c8[_0x03c2('0x63')]['id'];return db[_0x03c2('0x3d')][_0x03c2('0x59')]({'where':{'id':_0x43f1c8['params']['id'],'UserId':null},'include':[{'model':db[_0x03c2('0x64')],'as':_0x03c2('0x65')}]})[_0x03c2('0x21')](handleEntityNotFound(_0x32ec93,null))['then'](saveUpdates(_0x43f1c8[_0x03c2('0x5b')],null))[_0x03c2('0x21')](function(_0x4a93d8){if(_0x4a93d8){_0x18b5c5[_0x03c2('0x28')]=_0x4a93d8[_0x03c2('0x66')]({'plain':!![]});return db[_0x03c2('0x67')][_0x03c2('0x59')]({'where':{'id':_0x4a93d8[_0x03c2('0x68')]}});}return null;})[_0x03c2('0x21')](handleEntityNotFound(_0x32ec93,null))['then'](function(_0x56f53b){if(_0x56f53b){return _0x56f53b[_0x03c2('0x36')]({'UserId':_0x43f1c8['body']['UserId'],'read1stAt':_['isNil'](_0x56f53b[_0x03c2('0x69')])?moment()[_0x03c2('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x03c2('0x21')](function(_0x5325c1){if(_0x5325c1){_0x18b5c5['interaction']=_0x5325c1[_0x03c2('0x66')]({'plain':!![]});interaction_log[_0x03c2('0x22')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x43f1c8[_0x03c2('0x63')]['id'],_0x43f1c8[_0x03c2('0x63')][_0x03c2('0x39')],_0x43f1c8[_0x03c2('0x63')][_0x03c2('0x6a')],_0x18b5c5[_0x03c2('0x6b')]['id'],_0x43f1c8[_0x03c2('0x5b')]?JSON['stringify'](_0x43f1c8[_0x03c2('0x5b')]):_0x03c2('0x6c'));return respondWithRpcPromise(_0x03c2('0x6d'),'acceptMessage',_0x18b5c5);}return null;})[_0x03c2('0x21')](function(_0x563a48){if(_0x563a48){if(_0x43f1c8[_0x03c2('0x5b')][_0x03c2('0x6e')]){_0x18b5c5['message'][_0x03c2('0x6f')]=util[_0x03c2('0x60')](_0x03c2('0x70'),_0x43f1c8[_0x03c2('0x63')]['name']);_0x18b5c5[_0x03c2('0x28')][_0x03c2('0x71')]=_0x18b5c5[_0x03c2('0x71')];_0x18b5c5[_0x03c2('0x28')]['event']=_0x03c2('0x72');return respondWithRpcPromise(_0x03c2('0x73'),_0x03c2('0x73'),{'event':_0x03c2('0x74'),'message':_0x18b5c5[_0x03c2('0x28')]},client9002)[_0x03c2('0x21')](function(){return _0x18b5c5;});}return _0x18b5c5;}return null;})[_0x03c2('0x21')](respondWithResult(_0x32ec93,null))[_0x03c2('0x2a')](handleError(_0x32ec93,null));};var interaction_log=require('../../config/logger')(_0x03c2('0x5d'));exports[_0x03c2('0x34')]=function(_0x1c9bc8,_0xc8cdac,_0x51f57a){var _0x2c68f8={'agent':{},'channel':_0x03c2('0x5e')};if(_0x1c9bc8[_0x03c2('0x5b')]['id']){delete _0x1c9bc8['body']['id'];}_0x1c9bc8[_0x03c2('0x5b')][_0x03c2('0x62')]=_0x1c9bc8[_0x03c2('0x5b')][_0x03c2('0x62')]||_0x1c9bc8['user']['id'];_0x2c68f8['agent']['id']=_0x1c9bc8[_0x03c2('0x5b')][_0x03c2('0x62')];return db[_0x03c2('0x3d')][_0x03c2('0x59')]({'where':{'id':_0x1c9bc8[_0x03c2('0x57')]['id'],'UserId':null}})[_0x03c2('0x21')](handleEntityNotFound(_0xc8cdac,null))[_0x03c2('0x21')](function(_0x461f65){if(_0x461f65){_0x2c68f8[_0x03c2('0x28')]=_0x461f65[_0x03c2('0x66')]({'plain':!![]});return db['OpenchannelInteraction'][_0x03c2('0x59')]({'where':{'id':_0x461f65[_0x03c2('0x68')]}});}return null;})['then'](handleEntityNotFound(_0xc8cdac,null))[_0x03c2('0x21')](function(_0x45b9a9){if(_0x45b9a9){_0x2c68f8[_0x03c2('0x6b')]=_0x45b9a9[_0x03c2('0x66')]({'plain':!![]});interaction_log[_0x03c2('0x22')](_0x03c2('0x75'),_0x1c9bc8[_0x03c2('0x63')]['id'],_0x1c9bc8[_0x03c2('0x63')][_0x03c2('0x39')],_0x1c9bc8['user'][_0x03c2('0x6a')],_0x2c68f8[_0x03c2('0x6b')]['id'],_0x1c9bc8[_0x03c2('0x5b')]?JSON[_0x03c2('0x26')](_0x1c9bc8[_0x03c2('0x5b')]):_0x03c2('0x6c'));return respondWithRpcPromise(_0x03c2('0x76'),_0x03c2('0x77'),_0x2c68f8);}return null;})[_0x03c2('0x21')](function(_0xb130b0){if(_0xb130b0){_0xb130b0[_0x03c2('0x28')][_0x03c2('0x6f')]=util[_0x03c2('0x60')]('SIP/%s',_0x1c9bc8['user']['name']);_0xb130b0[_0x03c2('0x28')]['channel']=_0x2c68f8['channel'];_0xb130b0[_0x03c2('0x28')][_0x03c2('0x78')]='reject';respondWithRpcPromise(_0x03c2('0x73'),'EventManager',{'event':'rejectmessage','message':_0xb130b0[_0x03c2('0x28')]},client9002);return _0x2c68f8;}return null;})[_0x03c2('0x21')](respondWithResult(_0xc8cdac,null))[_0x03c2('0x2a')](handleError(_0xc8cdac,null));}; \ No newline at end of file +var _0x5441=['user','get','OpenchannelInteractionId','isNil','format','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','event','EventManager','reject','openchannel','agent','OpenchannelInteraction','role','RejectMessage','rejectMessage','channel','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','test','request','then','info','request\x20sent','error','code','OpenchannelMessage,\x20%s,\x20%s','message','sendStatus','status','json','count','offset','set','apply','save','update','destroy','end','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','openchannel-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId'];(function(_0x4ce407,_0x31eb58){var _0x178bb5=function(_0x114586){while(--_0x114586){_0x4ce407['push'](_0x4ce407['shift']());}};_0x178bb5(++_0x31eb58);}(_0x5441,0x109));var _0x1544=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x5441[_0x342700];return _0x53406f;};'use strict';var pdf=require(_0x1544('0x0'));var emlformat=require(_0x1544('0x1'));var rimraf=require(_0x1544('0x2'));var zipdir=require(_0x1544('0x3'));var jsonpatch=require(_0x1544('0x4'));var rp=require(_0x1544('0x5'));var moment=require(_0x1544('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1544('0x7'));var path=require(_0x1544('0x8'));var sox=require(_0x1544('0x9'));var csv=require(_0x1544('0xa'));var ejs=require(_0x1544('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1544('0xc'));var crypto=require(_0x1544('0xd'));var jsforce=require(_0x1544('0xe'));var deskjs=require(_0x1544('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1544('0x10'));var Papa=require(_0x1544('0x11'));var Redis=require(_0x1544('0x12'));var authService=require(_0x1544('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1544('0x14'));var logger=require(_0x1544('0x15'))(_0x1544('0x16'));var utils=require(_0x1544('0x17'));var config=require('../../config/environment');var db=require(_0x1544('0x18'))['db'];config[_0x1544('0x19')]=_['defaults'](config[_0x1544('0x19')],{'host':_0x1544('0x1a'),'port':0x18eb});var socket=require(_0x1544('0x1b'))(new Redis(config[_0x1544('0x19')]));require(_0x1544('0x1c'))[_0x1544('0x1d')](socket);var jayson=require(_0x1544('0x1e'));var client=jayson[_0x1544('0x1f')][_0x1544('0x20')]({'port':0x232c});var client9002=jayson[_0x1544('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x22242d,_0x4d1019,_0x1de3cd){if(_0x1de3cd){var _0x4ef51f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ef51f[_0x1544('0x21')](_0x4d1019)){return _0x22242d;}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 _0x22242d;}}function respondWithRpcPromise(_0x5dd234,_0x198f08,_0x12562a,_0x579e96){return new BPromise(function(_0x365f8f,_0x2d4334){var _0x3298f9=_0x579e96||client;return _0x3298f9[_0x1544('0x22')](_0x5dd234,_0x12562a)[_0x1544('0x23')](function(_0x2f0215){logger[_0x1544('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x198f08,_0x1544('0x25'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x198f08,_0x1544('0x25'),JSON['stringify'](_0x2f0215));if(_0x2f0215[_0x1544('0x26')]){if(_0x2f0215[_0x1544('0x26')][_0x1544('0x27')]===0x1f4){logger['error'](_0x1544('0x28'),_0x198f08,_0x2f0215[_0x1544('0x26')][_0x1544('0x29')]);return _0x2d4334(_0x2f0215[_0x1544('0x26')][_0x1544('0x29')]);}logger[_0x1544('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x198f08,_0x2f0215[_0x1544('0x26')][_0x1544('0x29')]);return _0x365f8f(_0x2f0215[_0x1544('0x26')][_0x1544('0x29')]);}else{logger[_0x1544('0x24')](_0x1544('0x28'),_0x198f08,_0x1544('0x25'));_0x365f8f(_0x2f0215['result'][_0x1544('0x29')]);}})['catch'](function(_0x22bb88){logger[_0x1544('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x198f08,_0x22bb88);_0x2d4334(_0x22bb88);});});}function respondWithStatusCode(_0x5809dd,_0x3baff7){_0x3baff7=_0x3baff7||0xcc;return function(_0x5b6a2e){if(_0x5b6a2e){return _0x5809dd[_0x1544('0x2a')](_0x3baff7);}return _0x5809dd['status'](_0x3baff7)['end']();};}function respondWithResult(_0x178a97,_0xcdf16f){_0xcdf16f=_0xcdf16f||0xc8;return function(_0x271990){if(_0x271990){return _0x178a97[_0x1544('0x2b')](_0xcdf16f)[_0x1544('0x2c')](_0x271990);}};}function respondWithFilteredResult(_0x8d6b53,_0x37ee63){return function(_0x129ffe){if(_0x129ffe){var _0x43a2a0=_0x129ffe[_0x1544('0x2d')],_0x202a1b=_0x37ee63[_0x1544('0x2e')],_0x587746=_0x37ee63[_0x1544('0x2e')]+_0x37ee63['limit'],_0x22ff77;if(_0x587746>=_0x43a2a0){_0x587746=_0x43a2a0;_0x22ff77=0xc8;}else{_0x22ff77=0xce;}_0x8d6b53[_0x1544('0x2b')](_0x22ff77);return _0x8d6b53[_0x1544('0x2f')]('Content-Range',_0x202a1b+'-'+_0x587746+'/'+_0x43a2a0)['json'](_0x129ffe);}return null;};}function patchUpdates(_0x2ab42c){return function(_0x25eefa){try{jsonpatch[_0x1544('0x30')](_0x25eefa,_0x2ab42c,!![]);}catch(_0x3bd76c){return BPromise['reject'](_0x3bd76c);}return _0x25eefa[_0x1544('0x31')]();};}function saveUpdates(_0xa449b3,_0x298ff5){return function(_0xe95d5b){if(_0xe95d5b){return _0xe95d5b[_0x1544('0x32')](_0xa449b3)[_0x1544('0x23')](function(_0x139c48){return _0x139c48;});}return null;};}function removeEntity(_0x5675a6,_0x11cacb){return function(_0xb38eec){if(_0xb38eec){return _0xb38eec[_0x1544('0x33')]()[_0x1544('0x23')](function(){_0x5675a6['status'](0xcc)[_0x1544('0x34')]();});}};}function handleEntityNotFound(_0x17d2ed,_0x5f108f){return function(_0x24a164){if(!_0x24a164){_0x17d2ed[_0x1544('0x2a')](0x194);}return _0x24a164;};}function handleError(_0x29106c,_0xb5a30e){_0xb5a30e=_0xb5a30e||0x1f4;return function(_0x4bd476){logger[_0x1544('0x26')](_0x4bd476[_0x1544('0x35')]);if(_0x4bd476[_0x1544('0x36')]){delete _0x4bd476[_0x1544('0x36')];}_0x29106c['status'](_0xb5a30e)[_0x1544('0x37')](_0x4bd476);};}exports['index']=function(_0x4b5b96,_0x4c337d){var _0x3abe75={},_0x2ff767={},_0x2be6c3={'count':0x0,'rows':[]};var _0x1956f9=_[_0x1544('0x38')](db[_0x1544('0x39')][_0x1544('0x3a')],function(_0x1bf9e7){return{'name':_0x1bf9e7[_0x1544('0x3b')],'type':_0x1bf9e7[_0x1544('0x3c')][_0x1544('0x3d')]};});_0x2ff767['model']=_[_0x1544('0x38')](_0x1956f9,_0x1544('0x36'));_0x2ff767['query']=_[_0x1544('0x3e')](_0x4b5b96[_0x1544('0x3f')]);_0x2ff767[_0x1544('0x40')]=_[_0x1544('0x41')](_0x2ff767['model'],_0x2ff767[_0x1544('0x3f')]);_0x3abe75[_0x1544('0x42')]=_[_0x1544('0x41')](_0x2ff767[_0x1544('0x43')],qs[_0x1544('0x44')](_0x4b5b96[_0x1544('0x3f')][_0x1544('0x44')]));_0x3abe75[_0x1544('0x42')]=_0x3abe75[_0x1544('0x42')][_0x1544('0x45')]?_0x3abe75['attributes']:_0x2ff767[_0x1544('0x43')];if(!_0x4b5b96[_0x1544('0x3f')][_0x1544('0x46')](_0x1544('0x47'))){_0x3abe75['limit']=qs['limit'](_0x4b5b96['query']['limit']);_0x3abe75[_0x1544('0x2e')]=qs[_0x1544('0x2e')](_0x4b5b96[_0x1544('0x3f')][_0x1544('0x2e')]);}_0x3abe75[_0x1544('0x48')]=qs[_0x1544('0x49')](_0x4b5b96[_0x1544('0x3f')][_0x1544('0x49')]);_0x3abe75[_0x1544('0x4a')]=qs['filters'](_[_0x1544('0x4b')](_0x4b5b96['query'],_0x2ff767[_0x1544('0x40')]),_0x1956f9);if(_0x4b5b96['query'][_0x1544('0x4c')]){_0x3abe75[_0x1544('0x4a')]=_[_0x1544('0x4d')](_0x3abe75['where'],{'$or':_['map'](_0x1956f9,function(_0x42e40d){if(_0x42e40d[_0x1544('0x3c')]!=='VIRTUAL'){var _0x1e38da={};_0x1e38da[_0x42e40d[_0x1544('0x36')]]={'$like':'%'+_0x4b5b96[_0x1544('0x3f')][_0x1544('0x4c')]+'%'};return _0x1e38da;}})});}_0x3abe75=_[_0x1544('0x4d')]({},_0x3abe75,_0x4b5b96[_0x1544('0x4e')]);var _0x5a4d92={'where':_0x3abe75[_0x1544('0x4a')]};return db[_0x1544('0x39')][_0x1544('0x2d')](_0x5a4d92)[_0x1544('0x23')](function(_0x404ac2){_0x2be6c3['count']=_0x404ac2;if(_0x4b5b96['query'][_0x1544('0x4f')]){_0x3abe75[_0x1544('0x50')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x1544('0x51')](_0x3abe75);})[_0x1544('0x23')](function(_0x394734){_0x2be6c3['rows']=_0x394734;return _0x2be6c3;})[_0x1544('0x23')](respondWithFilteredResult(_0x4c337d,_0x3abe75))[_0x1544('0x52')](handleError(_0x4c337d,null));};exports[_0x1544('0x53')]=function(_0x1f7c68,_0x5804ba){var _0x55e299={'raw':!![],'where':{'id':_0x1f7c68[_0x1544('0x54')]['id']}},_0x556694={};_0x556694['model']=_[_0x1544('0x3e')](db['OpenchannelMessage']['rawAttributes']);_0x556694[_0x1544('0x3f')]=_['keys'](_0x1f7c68[_0x1544('0x3f')]);_0x556694['filters']=_['intersection'](_0x556694[_0x1544('0x43')],_0x556694[_0x1544('0x3f')]);_0x55e299[_0x1544('0x42')]=_[_0x1544('0x41')](_0x556694[_0x1544('0x43')],qs[_0x1544('0x44')](_0x1f7c68[_0x1544('0x3f')][_0x1544('0x44')]));_0x55e299[_0x1544('0x42')]=_0x55e299[_0x1544('0x42')][_0x1544('0x45')]?_0x55e299[_0x1544('0x42')]:_0x556694[_0x1544('0x43')];if(_0x1f7c68[_0x1544('0x3f')]['includeAll']){_0x55e299['include']=[{'all':!![]}];}_0x55e299=_[_0x1544('0x4d')]({},_0x55e299,_0x1f7c68['options']);return db[_0x1544('0x39')][_0x1544('0x55')](_0x55e299)[_0x1544('0x23')](handleEntityNotFound(_0x5804ba,null))[_0x1544('0x23')](respondWithResult(_0x5804ba,null))[_0x1544('0x52')](handleError(_0x5804ba,null));};exports[_0x1544('0x56')]=function(_0x367304,_0xda5719){return db[_0x1544('0x39')]['create'](_0x367304[_0x1544('0x57')],{})[_0x1544('0x23')](respondWithResult(_0xda5719,0xc9))[_0x1544('0x52')](handleError(_0xda5719,null));};exports[_0x1544('0x32')]=function(_0x30e3c2,_0x5d5a4b){if(_0x30e3c2['body']['id']){delete _0x30e3c2['body']['id'];}return db[_0x1544('0x39')][_0x1544('0x55')]({'where':{'id':_0x30e3c2[_0x1544('0x54')]['id']}})[_0x1544('0x23')](handleEntityNotFound(_0x5d5a4b,null))['then'](saveUpdates(_0x30e3c2[_0x1544('0x57')],null))[_0x1544('0x23')](respondWithResult(_0x5d5a4b,null))['catch'](handleError(_0x5d5a4b,null));};exports[_0x1544('0x33')]=function(_0xe2e26b,_0x40417e){return db['OpenchannelMessage']['find']({'where':{'id':_0xe2e26b['params']['id']}})[_0x1544('0x23')](handleEntityNotFound(_0x40417e,null))['then'](removeEntity(_0x40417e,null))[_0x1544('0x52')](handleError(_0x40417e,null));};exports[_0x1544('0x58')]=function(_0x2eda4a,_0x1f651c){return db[_0x1544('0x39')][_0x1544('0x58')]()['then'](respondWithResult(_0x1f651c,null))[_0x1544('0x52')](handleError(_0x1f651c,null));};var interaction_log=require(_0x1544('0x15'))(_0x1544('0x59'));exports[_0x1544('0x5a')]=function(_0x4190ff,_0x4b42ad,_0x2f79ec){var _0x229fcb={'channel':'openchannel'};if(_0x4190ff[_0x1544('0x57')]['id']){delete _0x4190ff[_0x1544('0x57')]['id'];}_0x4190ff[_0x1544('0x57')][_0x1544('0x5b')]=!![];_0x4190ff[_0x1544('0x57')][_0x1544('0x5c')]=moment()['format'](_0x1544('0x5d'));_0x4190ff[_0x1544('0x57')]['UserId']=_0x4190ff[_0x1544('0x57')][_0x1544('0x5e')]||_0x4190ff[_0x1544('0x5f')]['id'];return db[_0x1544('0x39')][_0x1544('0x55')]({'where':{'id':_0x4190ff[_0x1544('0x54')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x1544('0x23')](handleEntityNotFound(_0x4b42ad,null))['then'](saveUpdates(_0x4190ff[_0x1544('0x57')],null))[_0x1544('0x23')](function(_0x229f3d){if(_0x229f3d){_0x229fcb[_0x1544('0x29')]=_0x229f3d[_0x1544('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0x1544('0x55')]({'where':{'id':_0x229f3d[_0x1544('0x61')]}});}return null;})[_0x1544('0x23')](handleEntityNotFound(_0x4b42ad,null))[_0x1544('0x23')](function(_0x44c303){if(_0x44c303){return _0x44c303[_0x1544('0x32')]({'UserId':_0x4190ff[_0x1544('0x57')][_0x1544('0x5e')],'read1stAt':_[_0x1544('0x62')](_0x44c303['read1stAt'])?moment()[_0x1544('0x63')](_0x1544('0x5d')):undefined});}return null;})[_0x1544('0x23')](function(_0x19c77a){if(_0x19c77a){_0x229fcb['interaction']=_0x19c77a['get']({'plain':!![]});interaction_log[_0x1544('0x24')](_0x1544('0x64'),_0x4190ff['user']['id'],_0x4190ff[_0x1544('0x5f')]['name'],_0x4190ff[_0x1544('0x5f')]['role'],_0x229fcb[_0x1544('0x65')]['id'],_0x4190ff['body']?JSON[_0x1544('0x66')](_0x4190ff['body']):_0x1544('0x67'));return respondWithRpcPromise(_0x1544('0x68'),_0x1544('0x69'),_0x229fcb);}return null;})[_0x1544('0x23')](function(_0x373cfd){if(_0x373cfd){if(_0x4190ff['body'][_0x1544('0x6a')]){_0x229fcb[_0x1544('0x29')][_0x1544('0x6b')]=util[_0x1544('0x63')](_0x1544('0x6c'),_0x4190ff[_0x1544('0x5f')][_0x1544('0x36')]);_0x229fcb[_0x1544('0x29')]['channel']=_0x229fcb['channel'];_0x229fcb[_0x1544('0x29')][_0x1544('0x6d')]=_0x1544('0x5a');return respondWithRpcPromise(_0x1544('0x6e'),_0x1544('0x6e'),{'event':'acceptmessage','message':_0x229fcb[_0x1544('0x29')]},client9002)[_0x1544('0x23')](function(){return _0x229fcb;});}return _0x229fcb;}return null;})[_0x1544('0x23')](respondWithResult(_0x4b42ad,null))[_0x1544('0x52')](handleError(_0x4b42ad,null));};var interaction_log=require('../../config/logger')(_0x1544('0x59'));exports[_0x1544('0x6f')]=function(_0xee3d3f,_0x5e4d10,_0x2d82d4){var _0xf4bb2={'agent':{},'channel':_0x1544('0x70')};if(_0xee3d3f['body']['id']){delete _0xee3d3f[_0x1544('0x57')]['id'];}_0xee3d3f[_0x1544('0x57')]['UserId']=_0xee3d3f[_0x1544('0x57')][_0x1544('0x5e')]||_0xee3d3f[_0x1544('0x5f')]['id'];_0xf4bb2[_0x1544('0x71')]['id']=_0xee3d3f[_0x1544('0x57')][_0x1544('0x5e')];return db[_0x1544('0x39')][_0x1544('0x55')]({'where':{'id':_0xee3d3f[_0x1544('0x54')]['id'],'UserId':null}})[_0x1544('0x23')](handleEntityNotFound(_0x5e4d10,null))[_0x1544('0x23')](function(_0x424d29){if(_0x424d29){_0xf4bb2[_0x1544('0x29')]=_0x424d29[_0x1544('0x60')]({'plain':!![]});return db[_0x1544('0x72')][_0x1544('0x55')]({'where':{'id':_0x424d29[_0x1544('0x61')]}});}return null;})[_0x1544('0x23')](handleEntityNotFound(_0x5e4d10,null))[_0x1544('0x23')](function(_0x45071b){if(_0x45071b){_0xf4bb2[_0x1544('0x65')]=_0x45071b[_0x1544('0x60')]({'plain':!![]});interaction_log[_0x1544('0x24')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xee3d3f[_0x1544('0x5f')]['id'],_0xee3d3f[_0x1544('0x5f')]['name'],_0xee3d3f[_0x1544('0x5f')][_0x1544('0x73')],_0xf4bb2[_0x1544('0x65')]['id'],_0xee3d3f[_0x1544('0x57')]?JSON[_0x1544('0x66')](_0xee3d3f['body']):_0x1544('0x67'));return respondWithRpcPromise(_0x1544('0x74'),_0x1544('0x75'),_0xf4bb2);}return null;})['then'](function(_0x4ec7d8){if(_0x4ec7d8){_0x4ec7d8[_0x1544('0x29')][_0x1544('0x6b')]=util[_0x1544('0x63')]('SIP/%s',_0xee3d3f['user'][_0x1544('0x36')]);_0x4ec7d8['message'][_0x1544('0x76')]=_0xf4bb2[_0x1544('0x76')];_0x4ec7d8['message'][_0x1544('0x6d')]=_0x1544('0x6f');respondWithRpcPromise(_0x1544('0x6e'),_0x1544('0x6e'),{'event':_0x1544('0x77'),'message':_0x4ec7d8[_0x1544('0x29')]},client9002);return _0xf4bb2;}return null;})['then'](respondWithResult(_0x5e4d10,null))[_0x1544('0x52')](handleError(_0x5e4d10,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index f4fa48a..de371be 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 _0xd710=['setMaxListeners','update','remove','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage'];(function(_0x325f01,_0x9e0a37){var _0x19996a=function(_0x3e31b4){while(--_0x3e31b4){_0x325f01['push'](_0x325f01['shift']());}};_0x19996a(++_0x9e0a37);}(_0xd710,0x11d));var _0x0d71=function(_0x354d36,_0x2927f0){_0x354d36=_0x354d36-0x0;var _0x3d8140=_0xd710[_0x354d36];return _0x3d8140;};'use strict';var EventEmitter=require(_0x0d71('0x0'));var OpenchannelMessage=require(_0x0d71('0x1'))['db'][_0x0d71('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0d71('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d71('0x4'),'afterDestroy':_0x0d71('0x5')};function emitEvent(_0x2f8a41){return function(_0x139790,_0x14989a,_0x4257d5){OpenchannelMessageEvents['emit'](_0x2f8a41+':'+_0x139790['id'],_0x139790);OpenchannelMessageEvents['emit'](_0x2f8a41,_0x139790);_0x4257d5(null);};}for(var e in events){if(events[_0x0d71('0x6')](e)){var event=events[e];OpenchannelMessage[_0x0d71('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xe91c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','save','remove'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xe91c,0x67));var _0xce91=function(_0x45df47,_0x51fa9c){_0x45df47=_0x45df47-0x0;var _0x436238=_0xe91c[_0x45df47];return _0x436238;};'use strict';var EventEmitter=require(_0xce91('0x0'));var OpenchannelMessage=require(_0xce91('0x1'))['db'][_0xce91('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xce91('0x3'),'afterUpdate':'update','afterDestroy':_0xce91('0x4')};function emitEvent(_0x1b8a57){return function(_0x4d90b2,_0x2bf4bf,_0x4d3b6c){OpenchannelMessageEvents['emit'](_0x1b8a57+':'+_0x4d90b2['id'],_0x4d90b2);OpenchannelMessageEvents[_0xce91('0x5')](_0x1b8a57,_0x4d90b2);_0x4d3b6c(null);};}for(var e in events){if(events[_0xce91('0x6')](e)){var event=events[e];OpenchannelMessage[_0xce91('0x7')](e,emitEvent(event));}}module[_0xce91('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 70a4d83..35581a1 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 _0xc9f5=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','catch','error','OpenchannelAccount','Interactions','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4'];(function(_0x4f72c4,_0x414764){var _0x41e0a3=function(_0x12a802){while(--_0x12a802){_0x4f72c4['push'](_0x4f72c4['shift']());}};_0x41e0a3(++_0x414764);}(_0xc9f5,0xc4));var _0x5c9f=function(_0x5b8310,_0x77ea6f){_0x5b8310=_0x5b8310-0x0;var _0xd3ebc1=_0xc9f5[_0x5b8310];return _0xd3ebc1;};'use strict';var _=require('lodash');var util=require(_0x5c9f('0x0'));var logger=require(_0x5c9f('0x1'))('api');var moment=require(_0x5c9f('0x2'));var BPromise=require(_0x5c9f('0x3'));var rp=require(_0x5c9f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5c9f('0x5'));var attributes=require('./openchannelMessage.attributes');module[_0x5c9f('0x6')]=function(_0x563d0c,_0x3100cf){return _0x563d0c[_0x5c9f('0x7')](_0x5c9f('0x8'),attributes,{'tableName':_0x5c9f('0x9'),'paranoid':![],'indexes':[{'name':_0x5c9f('0xa'),'fields':[_0x5c9f('0xb')],'type':_0x5c9f('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x258fe5,_0x279b07,_0x3d782a){var _0x397c29=_0x563d0c[_0x5c9f('0xd')];var _0xd735fd=_0x258fe5[_0x5c9f('0xe')]({'plain':!![]});if(_0xd735fd[_0x5c9f('0xf')][_0x5c9f('0x10')]()==='in'||_0xd735fd[_0x5c9f('0xf')]['toLowerCase']()===_0x5c9f('0x11')&&!_0xd735fd[_0x5c9f('0x12')]&&!_[_0x5c9f('0x13')](_0xd735fd[_0x5c9f('0x14')])){_0x397c29[_0x5c9f('0x15')][_0x5c9f('0x16')]({'where':{'id':_0xd735fd['OpenchannelInteractionId']}})[_0x5c9f('0x17')](function(_0xa185ab){if(_0xa185ab){_0xa185ab[_0x5c9f('0x18')]({'lastMsgAt':_0xd735fd[_0x5c9f('0x19')],'lastMsgDirection':_0xd735fd[_0x5c9f('0xf')][_0x5c9f('0x10')]()});}})[_0x5c9f('0x1a')](function(_0x281b49){console[_0x5c9f('0x1b')](_0x281b49);});}if(_0xd735fd['direction']==='out'&&!_0xd735fd['secret']){var _0x48feaf;_0x397c29['CmContact']['describe']()['then'](function(_0x918ad3){return _0x397c29[_0x5c9f('0x1c')]['find']({'where':{'id':_0xd735fd['OpenchannelAccountId']},'include':[{'model':_0x397c29[_0x5c9f('0x15')],'as':_0x5c9f('0x1d'),'where':{'id':_0xd735fd[_0x5c9f('0x1e')]},'limit':0x1,'include':[{'model':_0x397c29[_0x5c9f('0x1f')],'as':_0x5c9f('0x20'),'attributes':_[_0x5c9f('0x21')](_0x918ad3)}]}]});})[_0x5c9f('0x17')](function(_0x2e7ba4){_0x48feaf=_0x2e7ba4[_0x5c9f('0xe')]({'plain':!![]});if(_0x48feaf&&_0x48feaf[_0x5c9f('0x22')]){logger['info'](_0x5c9f('0x23'),_0x5c9f('0x24'),util[_0x5c9f('0x25')](_0x5c9f('0x26'),_0xd735fd['id'],_0x48feaf[_0x5c9f('0x22')]));if(_0x48feaf['Interactions']&&_0x48feaf[_0x5c9f('0x1d')]['length']){_0xd735fd['Interaction']=_['omit'](_0x48feaf['Interactions'][0x0],_0x5c9f('0x20'));_0xd735fd[_0x5c9f('0x20')]=_0x48feaf['Interactions'][0x0][_0x5c9f('0x20')];}var _0x279b07={'method':_0x5c9f('0x27'),'uri':encodeURI(_0x48feaf['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x279b07[_0x5c9f('0x28')]){case _0x5c9f('0x29'):_0x279b07['qs']=_0xd735fd;break;case'POST':_0x279b07[_0x5c9f('0xb')]=_0xd735fd;break;}return rp(_0x279b07)['then'](function(_0x16a695){logger[_0x5c9f('0x2a')](_0x5c9f('0x23'),'afterCreate',util[_0x5c9f('0x25')](_0x5c9f('0x2b'),_0xd735fd['id'],_0x48feaf[_0x5c9f('0x22')]));if(_0x16a695[_0x5c9f('0xb')]['threadId']&&_0x16a695[_0x5c9f('0xb')][_0x5c9f('0x2c')]!=_0xd735fd[_0x5c9f('0x2d')][_0x5c9f('0x2c')]){return _0x397c29[_0x5c9f('0x15')]['update']({'threadId':_0x16a695[_0x5c9f('0xb')]['threadId']},{'logging':!![],'where':{'id':_0xd735fd[_0x5c9f('0x2d')]['id']}});}else{return;}})[_0x5c9f('0x17')](function(){return _0x258fe5['update']({'read':!![]});})[_0x5c9f('0x1a')](function(_0x55cec9){logger[_0x5c9f('0x1b')]('OpenchannelMessage,\x20%s,\x20%s',_0x5c9f('0x24'),util[_0x5c9f('0x2e')](_0x55cec9,{'showHidden':![],'depth':null}));_0x3d782a();});}else{_0x3d782a();}})[_0x5c9f('0x2f')](function(){_0x3d782a();});}else{_0x3d782a();}}},'charset':_0x5c9f('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd2bb=['exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','Forwarding\x20message\x20%d\x20to\x20%s','omit','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','inspect','finally','utf8mb4','util','api','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes'];(function(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x35923e,_0x3cea24){_0x35923e=_0x35923e-0x0;var _0x48cf10=_0xd2bb[_0x35923e];return _0x48cf10;};'use strict';var _=require('lodash');var util=require(_0xbd2b('0x0'));var logger=require('../../config/logger')(_0xbd2b('0x1'));var moment=require(_0xbd2b('0x2'));var BPromise=require(_0xbd2b('0x3'));var rp=require(_0xbd2b('0x4'));var fs=require('fs');var path=require(_0xbd2b('0x5'));var rimraf=require(_0xbd2b('0x6'));var config=require('../../config/environment');var attributes=require(_0xbd2b('0x7'));module[_0xbd2b('0x8')]=function(_0xdcd8bd,_0x2f64a8){return _0xdcd8bd[_0xbd2b('0x9')](_0xbd2b('0xa'),attributes,{'tableName':_0xbd2b('0xb'),'paranoid':![],'indexes':[{'name':_0xbd2b('0xc'),'fields':[_0xbd2b('0xd')],'type':_0xbd2b('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4fd4f2,_0x172aef,_0x517862){var _0x335b9b=_0xdcd8bd[_0xbd2b('0xf')];var _0x4e9572=_0x4fd4f2[_0xbd2b('0x10')]({'plain':!![]});if(_0x4e9572[_0xbd2b('0x11')][_0xbd2b('0x12')]()==='in'||_0x4e9572[_0xbd2b('0x11')][_0xbd2b('0x12')]()===_0xbd2b('0x13')&&!_0x4e9572[_0xbd2b('0x14')]&&!_[_0xbd2b('0x15')](_0x4e9572['UserId'])){_0x335b9b[_0xbd2b('0x16')][_0xbd2b('0x17')]({'where':{'id':_0x4e9572[_0xbd2b('0x18')]}})[_0xbd2b('0x19')](function(_0x29f3d1){if(_0x29f3d1){_0x29f3d1['update']({'lastMsgAt':_0x4e9572[_0xbd2b('0x1a')],'lastMsgDirection':_0x4e9572[_0xbd2b('0x11')][_0xbd2b('0x12')]()});}})[_0xbd2b('0x1b')](function(_0x1815b3){console[_0xbd2b('0x1c')](_0x1815b3);});}if(_0x4e9572[_0xbd2b('0x11')]===_0xbd2b('0x13')&&!_0x4e9572[_0xbd2b('0x14')]){var _0x571596;_0x335b9b[_0xbd2b('0x1d')][_0xbd2b('0x1e')]()[_0xbd2b('0x19')](function(_0x19ee5c){return _0x335b9b[_0xbd2b('0x1f')][_0xbd2b('0x20')]({'where':{'id':_0x4e9572[_0xbd2b('0x21')]},'include':[{'model':_0x335b9b[_0xbd2b('0x16')],'as':_0xbd2b('0x22'),'where':{'id':_0x4e9572[_0xbd2b('0x18')]},'limit':0x1,'include':[{'model':_0x335b9b['CmContact'],'as':_0xbd2b('0x23'),'attributes':_[_0xbd2b('0x24')](_0x19ee5c)}]}]});})[_0xbd2b('0x19')](function(_0x12d252){_0x571596=_0x12d252[_0xbd2b('0x10')]({'plain':!![]});if(_0x571596&&_0x571596[_0xbd2b('0x25')]){logger[_0xbd2b('0x26')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0xbd2b('0x27'),_0x4e9572['id'],_0x571596['replyUri']));if(_0x571596[_0xbd2b('0x22')]&&_0x571596[_0xbd2b('0x22')]['length']){_0x4e9572['Interaction']=_[_0xbd2b('0x28')](_0x571596[_0xbd2b('0x22')][0x0],'Contact');_0x4e9572['Contact']=_0x571596['Interactions'][0x0][_0xbd2b('0x23')];}var _0x172aef={'method':_0xbd2b('0x29'),'uri':encodeURI(_0x571596[_0xbd2b('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x172aef[_0xbd2b('0x2a')]){case _0xbd2b('0x2b'):_0x172aef['qs']=_0x4e9572;break;case'POST':_0x172aef['body']=_0x4e9572;break;}return rp(_0x172aef)[_0xbd2b('0x19')](function(_0x3925ab){logger['info'](_0xbd2b('0x2c'),_0xbd2b('0x2d'),util[_0xbd2b('0x2e')](_0xbd2b('0x2f'),_0x4e9572['id'],_0x571596['replyUri']));if(_0x3925ab[_0xbd2b('0xd')]['threadId']&&_0x3925ab[_0xbd2b('0xd')][_0xbd2b('0x30')]!=_0x4e9572[_0xbd2b('0x31')][_0xbd2b('0x30')]){return _0x335b9b[_0xbd2b('0x16')][_0xbd2b('0x32')]({'threadId':_0x3925ab[_0xbd2b('0xd')]['threadId']},{'logging':!![],'where':{'id':_0x4e9572[_0xbd2b('0x31')]['id']}});}else{return;}})['then'](function(){return _0x4fd4f2[_0xbd2b('0x32')]({'read':!![]});})[_0xbd2b('0x1b')](function(_0x510ef9){logger['error'](_0xbd2b('0x2c'),_0xbd2b('0x2d'),util[_0xbd2b('0x33')](_0x510ef9,{'showHidden':![],'depth':null}));_0x517862();});}else{_0x517862();}})[_0xbd2b('0x34')](function(){_0x517862();});}else{_0x517862();}}},'charset':_0xbd2b('0x35'),'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 e1847c8..f29f981 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 _0xbd9e=['info','request\x20sent','debug','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','then','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./openchannelMessage.socket','register','request'];(function(_0x3bd557,_0x3fe1e2){var _0x4e6cd6=function(_0xd76385){while(--_0xd76385){_0x3bd557['push'](_0x3bd557['shift']());}};_0x4e6cd6(++_0x3fe1e2);}(_0xbd9e,0x108));var _0xebd9=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xbd9e[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebd9('0x0'));var BPromise=require('bluebird');var rs=require(_0xebd9('0x1'));var fs=require('fs');var Redis=require(_0xebd9('0x2'));var db=require(_0xebd9('0x3'))['db'];var utils=require(_0xebd9('0x4'));var logger=require(_0xebd9('0x5'))('rpc');var config=require(_0xebd9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xebd9('0x7')][_0xebd9('0x8')]({'port':0x232a});config[_0xebd9('0x9')]=_[_0xebd9('0xa')](config[_0xebd9('0x9')],{'host':_0xebd9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xebd9('0x9')]));require(_0xebd9('0xc'))[_0xebd9('0xd')](socket);function respondWithRpcPromise(_0x406705,_0x16537e,_0x4b1985){return new BPromise(function(_0x35fcfd,_0x5eda85){return client[_0xebd9('0xe')](_0x406705,_0x4b1985)['then'](function(_0x40c787){logger[_0xebd9('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x16537e,_0xebd9('0x10'));logger[_0xebd9('0x11')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x16537e,_0xebd9('0x10'),JSON[_0xebd9('0x12')](_0x40c787));if(_0x40c787[_0xebd9('0x13')]){if(_0x40c787[_0xebd9('0x13')]['code']===0x1f4){logger[_0xebd9('0x13')](_0xebd9('0x14'),_0x16537e,_0x40c787[_0xebd9('0x13')][_0xebd9('0x15')]);return _0x5eda85(_0x40c787[_0xebd9('0x13')][_0xebd9('0x15')]);}logger[_0xebd9('0x13')](_0xebd9('0x14'),_0x16537e,_0x40c787[_0xebd9('0x13')][_0xebd9('0x15')]);return _0x35fcfd(_0x40c787[_0xebd9('0x13')][_0xebd9('0x15')]);}else{logger[_0xebd9('0xf')](_0xebd9('0x14'),_0x16537e,'request\x20sent');_0x35fcfd(_0x40c787[_0xebd9('0x16')][_0xebd9('0x15')]);}})[_0xebd9('0x17')](function(_0x4d793e){logger[_0xebd9('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x16537e,_0x4d793e);_0x5eda85(_0x4d793e);});});}exports[_0xebd9('0x18')]=function(_0x474ed8){var _0x5c62d8=this;return new Promise(function(_0x509e81,_0x5701cd){return db[_0xebd9('0x19')][_0xebd9('0x1a')](_0x474ed8[_0xebd9('0x1b')],{'raw':_0x474ed8['options']?_0x474ed8[_0xebd9('0x1c')][_0xebd9('0x1d')]===undefined?!![]:![]:!![]})[_0xebd9('0x1e')](function(_0x2c17c8){logger[_0xebd9('0xf')](_0xebd9('0x18'),_0x474ed8);logger['debug'](_0xebd9('0x18'),_0x474ed8,JSON[_0xebd9('0x12')](_0x2c17c8));_0x509e81(_0x2c17c8);})['catch'](function(_0x556f05){logger[_0xebd9('0x13')](_0xebd9('0x18'),_0x556f05[_0xebd9('0x15')],_0x474ed8);_0x5701cd(_0x5c62d8[_0xebd9('0x13')](0x1f4,_0x556f05['message']));});});}; \ No newline at end of file +var _0x6b1b=['jayson/promise','client','http','redis','defaults','localhost','./openchannelMessage.socket','request','then','info','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','catch','CreateOpenchannelMessage','OpenchannelMessage','options','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3c573d,_0x1f57e7){var _0x2aacb5=function(_0x4d4f85){while(--_0x4d4f85){_0x3c573d['push'](_0x3c573d['shift']());}};_0x2aacb5(++_0x1f57e7);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x6b1b[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var util=require(_0xb6b1('0x0'));var moment=require(_0xb6b1('0x1'));var BPromise=require(_0xb6b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6b1('0x3'));var db=require(_0xb6b1('0x4'))['db'];var utils=require(_0xb6b1('0x5'));var logger=require(_0xb6b1('0x6'))(_0xb6b1('0x7'));var config=require(_0xb6b1('0x8'));var jayson=require(_0xb6b1('0x9'));var client=jayson[_0xb6b1('0xa')][_0xb6b1('0xb')]({'port':0x232a});config[_0xb6b1('0xc')]=_[_0xb6b1('0xd')](config['redis'],{'host':_0xb6b1('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb6b1('0xf'))['register'](socket);function respondWithRpcPromise(_0xcb40e1,_0x540238,_0x4aa838){return new BPromise(function(_0x49e83a,_0x593218){return client[_0xb6b1('0x10')](_0xcb40e1,_0x4aa838)[_0xb6b1('0x11')](function(_0x5d806b){logger[_0xb6b1('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0x540238,'request\x20sent');logger[_0xb6b1('0x13')](_0xb6b1('0x14'),_0x540238,_0xb6b1('0x15'),JSON[_0xb6b1('0x16')](_0x5d806b));if(_0x5d806b[_0xb6b1('0x17')]){if(_0x5d806b[_0xb6b1('0x17')][_0xb6b1('0x18')]===0x1f4){logger[_0xb6b1('0x17')](_0xb6b1('0x19'),_0x540238,_0x5d806b[_0xb6b1('0x17')][_0xb6b1('0x1a')]);return _0x593218(_0x5d806b[_0xb6b1('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x540238,_0x5d806b['error'][_0xb6b1('0x1a')]);return _0x49e83a(_0x5d806b[_0xb6b1('0x17')][_0xb6b1('0x1a')]);}else{logger[_0xb6b1('0x12')](_0xb6b1('0x19'),_0x540238,_0xb6b1('0x15'));_0x49e83a(_0x5d806b['result']['message']);}})[_0xb6b1('0x1b')](function(_0x15456d){logger[_0xb6b1('0x17')](_0xb6b1('0x19'),_0x540238,_0x15456d);_0x593218(_0x15456d);});});}exports[_0xb6b1('0x1c')]=function(_0x3fc9b1){var _0x5ba14d=this;return new Promise(function(_0x4e132a,_0x43312e){return db[_0xb6b1('0x1d')]['create'](_0x3fc9b1['body'],{'raw':_0x3fc9b1[_0xb6b1('0x1e')]?_0x3fc9b1['options']['raw']===undefined?!![]:![]:!![]})[_0xb6b1('0x11')](function(_0x2086ea){logger[_0xb6b1('0x12')](_0xb6b1('0x1c'),_0x3fc9b1);logger[_0xb6b1('0x13')](_0xb6b1('0x1c'),_0x3fc9b1,JSON[_0xb6b1('0x16')](_0x2086ea));_0x4e132a(_0x2086ea);})[_0xb6b1('0x1b')](function(_0x472585){logger[_0xb6b1('0x17')]('CreateOpenchannelMessage',_0x472585[_0xb6b1('0x1a')],_0x3fc9b1);_0x43312e(_0x5ba14d['error'](0x1f4,_0x472585[_0xb6b1('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index e7d59c8..49d7bc1 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['removeListener','register','./openchannelMessage.events'];(function(_0x3dfe00,_0x1e1cf5){var _0x2dd4f6=function(_0x362ab8){while(--_0x362ab8){_0x3dfe00['push'](_0x3dfe00['shift']());}};_0x2dd4f6(++_0x1e1cf5);}(_0xf4eb,0xec));var _0xbf4e=function(_0x25e67d,_0x50acdb){_0x25e67d=_0x25e67d-0x0;var _0x14e814=_0xf4eb[_0x25e67d];return _0x14e814;};'use strict';var OpenchannelMessageEvents=require(_0xbf4e('0x0'));var events=['save','remove','update'];function createListener(_0x5ed5b9,_0xbbbf01){return function(_0x49d80e){_0xbbbf01['emit'](_0x5ed5b9,_0x49d80e);};}function removeListener(_0x2e3070,_0x1c7606){return function(){OpenchannelMessageEvents[_0xbf4e('0x1')](_0x2e3070,_0x1c7606);};}exports[_0xbf4e('0x2')]=function(_0xa4dcf5){for(var _0x2fcfed=0x0,_0x15b99f=events['length'];_0x2fcfed<_0x15b99f;_0x2fcfed++){var _0x449d55=events[_0x2fcfed];var _0x5013c2=createListener('openchannelMessage:'+_0x449d55,_0xa4dcf5);OpenchannelMessageEvents['on'](_0x449d55,_0x5013c2);}}; \ No newline at end of file +var _0x9c44=['emit','removeListener','length','openchannelMessage:','remove','update'];(function(_0x515c74,_0x1144d4){var _0x8c5187=function(_0x46897a){while(--_0x46897a){_0x515c74['push'](_0x515c74['shift']());}};_0x8c5187(++_0x1144d4);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x49c4('0x0'),_0x49c4('0x1')];function createListener(_0x26844b,_0x1ba0bb){return function(_0x455700){_0x1ba0bb[_0x49c4('0x2')](_0x26844b,_0x455700);};}function removeListener(_0x4e0313,_0x4941f1){return function(){OpenchannelMessageEvents[_0x49c4('0x3')](_0x4e0313,_0x4941f1);};}exports['register']=function(_0xc1278f){for(var _0x6030ae=0x0,_0x69bc41=events[_0x49c4('0x4')];_0x6030ae<_0x69bc41;_0x6030ae++){var _0x436234=events[_0x6030ae];var _0x511d53=createListener(_0x49c4('0x5')+_0x436234,_0xc1278f);OpenchannelMessageEvents['on'](_0x436234,_0x511d53);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index e02e0f7..f210882 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 _0x1501=['create','addTeams','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','post'];(function(_0x24c135,_0xdb4450){var _0x290c66=function(_0x537cf8){while(--_0x537cf8){_0x24c135['push'](_0x24c135['shift']());}};_0x290c66(++_0xdb4450);}(_0x1501,0x126));var _0x1150=function(_0x1e1020,_0xd64a27){_0x1e1020=_0x1e1020-0x0;var _0x464719=_0x1501[_0x1e1020];return _0x464719;};'use strict';var multer=require('multer');var util=require(_0x1150('0x0'));var path=require(_0x1150('0x1'));var timeout=require(_0x1150('0x2'));var express=require('express');var router=express[_0x1150('0x3')]();var auth=require(_0x1150('0x4'));var interaction=require(_0x1150('0x5'));var config=require(_0x1150('0x6'));var controller=require('./openchannelQueue.controller');router[_0x1150('0x7')]('/',auth['isAuthenticated'](),controller[_0x1150('0x8')]);router[_0x1150('0x7')](_0x1150('0x9'),auth[_0x1150('0xa')](),controller[_0x1150('0xb')]);router[_0x1150('0x7')](_0x1150('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1150('0x7')](_0x1150('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0x1150('0x7')](_0x1150('0xe'),auth[_0x1150('0xa')](),controller[_0x1150('0xf')]);router['get'](_0x1150('0x10'),auth[_0x1150('0xa')](),controller['getAgents']);router[_0x1150('0x11')]('/',auth['isAuthenticated'](),controller[_0x1150('0x12')]);router[_0x1150('0x11')](_0x1150('0xe'),auth[_0x1150('0xa')](),controller[_0x1150('0x13')]);router[_0x1150('0x11')](_0x1150('0x10'),auth[_0x1150('0xa')](),controller['addAgents']);router['put'](_0x1150('0xc'),auth[_0x1150('0xa')](),controller[_0x1150('0x14')]);router[_0x1150('0x15')](_0x1150('0xc'),auth[_0x1150('0xa')](),controller[_0x1150('0x16')]);router[_0x1150('0x15')](_0x1150('0xe'),auth[_0x1150('0xa')](),controller['removeTeams']);router['delete'](_0x1150('0x10'),auth[_0x1150('0xa')](),controller['removeAgents']);module[_0x1150('0x17')]=router; \ No newline at end of file +var _0xc4f5=['post','create','addTeams','addAgents','/:id','destroy','delete','removeTeams','removeAgents','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','/:id/members','getMembers','/:id/teams','/:id/users','getAgents'];(function(_0x162812,_0x1f1c3e){var _0x438899=function(_0x2f9970){while(--_0x2f9970){_0x162812['push'](_0x162812['shift']());}};_0x438899(++_0x1f1c3e);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x146484,_0x27a7f0){_0x146484=_0x146484-0x0;var _0x4c7aa3=_0xc4f5[_0x146484];return _0x4c7aa3;};'use strict';var multer=require('multer');var util=require(_0x5c4f('0x0'));var path=require(_0x5c4f('0x1'));var timeout=require(_0x5c4f('0x2'));var express=require('express');var router=express[_0x5c4f('0x3')]();var auth=require(_0x5c4f('0x4'));var interaction=require(_0x5c4f('0x5'));var config=require(_0x5c4f('0x6'));var controller=require(_0x5c4f('0x7'));router['get']('/',auth[_0x5c4f('0x8')](),controller[_0x5c4f('0x9')]);router[_0x5c4f('0xa')](_0x5c4f('0xb'),auth[_0x5c4f('0x8')](),controller['describe']);router[_0x5c4f('0xa')]('/:id',auth[_0x5c4f('0x8')](),controller['show']);router[_0x5c4f('0xa')](_0x5c4f('0xc'),auth[_0x5c4f('0x8')](),controller[_0x5c4f('0xd')]);router[_0x5c4f('0xa')](_0x5c4f('0xe'),auth[_0x5c4f('0x8')](),controller['getTeams']);router[_0x5c4f('0xa')](_0x5c4f('0xf'),auth['isAuthenticated'](),controller[_0x5c4f('0x10')]);router[_0x5c4f('0x11')]('/',auth[_0x5c4f('0x8')](),controller[_0x5c4f('0x12')]);router[_0x5c4f('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5c4f('0x13')]);router[_0x5c4f('0x11')](_0x5c4f('0xf'),auth[_0x5c4f('0x8')](),controller[_0x5c4f('0x14')]);router['put']('/:id',auth[_0x5c4f('0x8')](),controller['update']);router['delete'](_0x5c4f('0x15'),auth['isAuthenticated'](),controller[_0x5c4f('0x16')]);router[_0x5c4f('0x17')](_0x5c4f('0xe'),auth[_0x5c4f('0x8')](),controller[_0x5c4f('0x18')]);router[_0x5c4f('0x17')](_0x5c4f('0xf'),auth[_0x5c4f('0x8')](),controller[_0x5c4f('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ea27040..8fc99f7 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 _0x1fa9=['INTEGER','ENUM','beepall','roundrobin','sequelize','STRING'];(function(_0x317280,_0x4bbf1b){var _0x3999fd=function(_0x1a6214){while(--_0x1a6214){_0x317280['push'](_0x317280['shift']());}};_0x3999fd(++_0x4bbf1b);}(_0x1fa9,0x136));var _0x91fa=function(_0x482dd4,_0x59c6fe){_0x482dd4=_0x482dd4-0x0;var _0x1e806e=_0x1fa9[_0x482dd4];return _0x1e806e;};'use strict';var Sequelize=require(_0x91fa('0x0'));module['exports']={'name':{'type':Sequelize[_0x91fa('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x91fa('0x1')]},'timeout':{'type':Sequelize[_0x91fa('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x91fa('0x3')]('rrmemory',_0x91fa('0x4'),_0x91fa('0x5'))}}; \ No newline at end of file +var _0x11d3=['roundrobin','sequelize','exports','STRING','name','rrmemory','beepall'];(function(_0x3575e3,_0x54da51){var _0x5b8a38=function(_0x4591ec){while(--_0x4591ec){_0x3575e3['push'](_0x3575e3['shift']());}};_0x5b8a38(++_0x54da51);}(_0x11d3,0x1ac));var _0x311d=function(_0x2aa4c8,_0x1f65b4){_0x2aa4c8=_0x2aa4c8-0x0;var _0x29edb8=_0x11d3[_0x2aa4c8];return _0x29edb8;};'use strict';var Sequelize=require(_0x311d('0x0'));module[_0x311d('0x1')]={'name':{'type':Sequelize[_0x311d('0x2')],'unique':_0x311d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x311d('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x311d('0x4'),_0x311d('0x5'),_0x311d('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index e5dc903..9c40d14 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 _0x3696=['removeTeams','Team','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','addAgents','omit','spread','removeAgents','isArray','userOpenchannelQueue:remove','findOne','nolimit','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','limit','apply','update','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','name','send','map','OpenchannelQueue','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','type','VIRTUAL','filter','merge','includeAll','include','rows','catch','options','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','describe','getMembers','UserOpenchannelQueue','order','OpenchannelQueueId','User','findAndCountAll','UserId','createdAt','%s/%s','SIP','openchannelPause','updatedAt','getTeams','addTeams','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save'];(function(_0x3a5e83,_0x598916){var _0x3a3297=function(_0x558bb1){while(--_0x558bb1){_0x3a5e83['push'](_0x3a5e83['shift']());}};_0x3a3297(++_0x598916);}(_0x3696,0x131));var _0x6369=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x3696[_0xaa0309];return _0x5de7ce;};'use strict';var pdf=require(_0x6369('0x0'));var emlformat=require(_0x6369('0x1'));var rimraf=require(_0x6369('0x2'));var zipdir=require(_0x6369('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6369('0x4'));var moment=require(_0x6369('0x5'));var BPromise=require(_0x6369('0x6'));var Mustache=require(_0x6369('0x7'));var util=require(_0x6369('0x8'));var path=require(_0x6369('0x9'));var sox=require(_0x6369('0xa'));var csv=require('to-csv');var ejs=require(_0x6369('0xb'));var fs=require('fs');var _=require(_0x6369('0xc'));var squel=require(_0x6369('0xd'));var crypto=require('crypto');var jsforce=require(_0x6369('0xe'));var deskjs=require(_0x6369('0xf'));var toCsv=require(_0x6369('0x10'));var querystring=require('querystring');var Papa=require(_0x6369('0x11'));var Redis=require('ioredis');var authService=require(_0x6369('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6369('0x13'));var logger=require(_0x6369('0x14'))(_0x6369('0x15'));var utils=require(_0x6369('0x16'));var config=require(_0x6369('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6369('0x18')](config[_0x6369('0x19')],{'host':_0x6369('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6369('0x19')]));require(_0x6369('0x1b'))[_0x6369('0x1c')](socket);function respondWithStatusCode(_0x231277,_0x32a9ee){_0x32a9ee=_0x32a9ee||0xcc;return function(_0x7b1585){if(_0x7b1585){return _0x231277[_0x6369('0x1d')](_0x32a9ee);}return _0x231277[_0x6369('0x1e')](_0x32a9ee)[_0x6369('0x1f')]();};}function respondWithResult(_0x2ec3a8,_0xbe0cb3){_0xbe0cb3=_0xbe0cb3||0xc8;return function(_0x484d36){if(_0x484d36){return _0x2ec3a8['status'](_0xbe0cb3)[_0x6369('0x20')](_0x484d36);}};}function respondWithFilteredResult(_0xd3b724,_0x5dd49f){return function(_0x2ff5c6){if(_0x2ff5c6){var _0x1ed58f=_0x2ff5c6[_0x6369('0x21')],_0x32c84b=_0x5dd49f[_0x6369('0x22')],_0x8aa4c6=_0x5dd49f[_0x6369('0x22')]+_0x5dd49f[_0x6369('0x23')],_0x287612;if(_0x8aa4c6>=_0x1ed58f){_0x8aa4c6=_0x1ed58f;_0x287612=0xc8;}else{_0x287612=0xce;}_0xd3b724['status'](_0x287612);return _0xd3b724['set']('Content-Range',_0x32c84b+'-'+_0x8aa4c6+'/'+_0x1ed58f)[_0x6369('0x20')](_0x2ff5c6);}return null;};}function patchUpdates(_0xa5108){return function(_0x14e86a){try{jsonpatch[_0x6369('0x24')](_0x14e86a,_0xa5108,!![]);}catch(_0x3d536d){return BPromise['reject'](_0x3d536d);}return _0x14e86a['save']();};}function saveUpdates(_0x4b8240,_0x24c541){return function(_0xb1047f){if(_0xb1047f){return _0xb1047f[_0x6369('0x25')](_0x4b8240)[_0x6369('0x26')](function(_0x5cc1d1){return _0x5cc1d1;});}return null;};}function removeEntity(_0x11103b,_0x5f0c37){return function(_0x104c03){if(_0x104c03){return _0x104c03[_0x6369('0x27')]()['then'](function(){var _0xb85cf0=_0x104c03[_0x6369('0x28')]({'plain':!![]});var _0x540145=_0x6369('0x29');return db[_0x6369('0x2a')][_0x6369('0x27')]({'where':{'type':_0x540145,'resourceId':_0xb85cf0['id']}})[_0x6369('0x26')](function(){return _0x104c03;});})[_0x6369('0x26')](function(){_0x11103b[_0x6369('0x1e')](0xcc)[_0x6369('0x1f')]();});}};}function handleEntityNotFound(_0x7f7522,_0x38f187){return function(_0x444f74){if(!_0x444f74){_0x7f7522['sendStatus'](0x194);}return _0x444f74;};}function handleError(_0x1a75e2,_0x5e303f){_0x5e303f=_0x5e303f||0x1f4;return function(_0x22475a){logger['error'](_0x22475a[_0x6369('0x2b')]);if(_0x22475a['name']){delete _0x22475a[_0x6369('0x2c')];}_0x1a75e2[_0x6369('0x1e')](_0x5e303f)[_0x6369('0x2d')](_0x22475a);};}exports['index']=function(_0x377842,_0x1121b9){var _0x4bed37={},_0x5e0ca9={},_0x3cba7d={'count':0x0,'rows':[]};var _0x278af3=_[_0x6369('0x2e')](db[_0x6369('0x2f')][_0x6369('0x30')],function(_0xfb515e){return{'name':_0xfb515e[_0x6369('0x31')],'type':_0xfb515e['type'][_0x6369('0x32')]};});_0x5e0ca9[_0x6369('0x33')]=_[_0x6369('0x2e')](_0x278af3,'name');_0x5e0ca9['query']=_[_0x6369('0x34')](_0x377842['query']);_0x5e0ca9['filters']=_[_0x6369('0x35')](_0x5e0ca9['model'],_0x5e0ca9[_0x6369('0x36')]);_0x4bed37[_0x6369('0x37')]=_[_0x6369('0x35')](_0x5e0ca9['model'],qs['fields'](_0x377842[_0x6369('0x36')][_0x6369('0x38')]));_0x4bed37[_0x6369('0x37')]=_0x4bed37[_0x6369('0x37')][_0x6369('0x39')]?_0x4bed37['attributes']:_0x5e0ca9['model'];if(!_0x377842[_0x6369('0x36')][_0x6369('0x3a')]('nolimit')){_0x4bed37[_0x6369('0x23')]=qs[_0x6369('0x23')](_0x377842[_0x6369('0x36')][_0x6369('0x23')]);_0x4bed37[_0x6369('0x22')]=qs['offset'](_0x377842[_0x6369('0x36')]['offset']);}_0x4bed37['order']=qs['sort'](_0x377842[_0x6369('0x36')][_0x6369('0x3b')]);_0x4bed37[_0x6369('0x3c')]=qs[_0x6369('0x3d')](_[_0x6369('0x3e')](_0x377842[_0x6369('0x36')],_0x5e0ca9[_0x6369('0x3d')]),_0x278af3);if(_0x377842[_0x6369('0x36')]['filter']){_0x4bed37[_0x6369('0x3c')]=_['merge'](_0x4bed37[_0x6369('0x3c')],{'$or':_['map'](_0x278af3,function(_0xedd551){if(_0xedd551[_0x6369('0x3f')]!==_0x6369('0x40')){var _0x5c6421={};_0x5c6421[_0xedd551['name']]={'$like':'%'+_0x377842[_0x6369('0x36')][_0x6369('0x41')]+'%'};return _0x5c6421;}})});}_0x4bed37=_[_0x6369('0x42')]({},_0x4bed37,_0x377842['options']);var _0x98f777={'where':_0x4bed37[_0x6369('0x3c')]};return db[_0x6369('0x2f')][_0x6369('0x21')](_0x98f777)[_0x6369('0x26')](function(_0x52fd15){_0x3cba7d[_0x6369('0x21')]=_0x52fd15;if(_0x377842[_0x6369('0x36')][_0x6369('0x43')]){_0x4bed37[_0x6369('0x44')]=[{'all':!![]}];}return db[_0x6369('0x2f')]['findAll'](_0x4bed37);})[_0x6369('0x26')](function(_0x1a9b88){_0x3cba7d[_0x6369('0x45')]=_0x1a9b88;return _0x3cba7d;})['then'](respondWithFilteredResult(_0x1121b9,_0x4bed37))[_0x6369('0x46')](handleError(_0x1121b9,null));};exports['show']=function(_0x5339e5,_0x41ba8d){var _0x4fed6c={'raw':!![],'where':{'id':_0x5339e5['params']['id']}},_0x222d35={};_0x222d35[_0x6369('0x33')]=_[_0x6369('0x34')](db[_0x6369('0x2f')][_0x6369('0x30')]);_0x222d35[_0x6369('0x36')]=_['keys'](_0x5339e5['query']);_0x222d35[_0x6369('0x3d')]=_['intersection'](_0x222d35[_0x6369('0x33')],_0x222d35[_0x6369('0x36')]);_0x4fed6c[_0x6369('0x37')]=_[_0x6369('0x35')](_0x222d35[_0x6369('0x33')],qs[_0x6369('0x38')](_0x5339e5[_0x6369('0x36')]['fields']));_0x4fed6c[_0x6369('0x37')]=_0x4fed6c['attributes'][_0x6369('0x39')]?_0x4fed6c[_0x6369('0x37')]:_0x222d35[_0x6369('0x33')];if(_0x5339e5[_0x6369('0x36')][_0x6369('0x43')]){_0x4fed6c[_0x6369('0x44')]=[{'all':!![]}];}_0x4fed6c=_[_0x6369('0x42')]({},_0x4fed6c,_0x5339e5[_0x6369('0x47')]);return db[_0x6369('0x2f')][_0x6369('0x48')](_0x4fed6c)[_0x6369('0x26')](handleEntityNotFound(_0x41ba8d,null))[_0x6369('0x26')](respondWithResult(_0x41ba8d,null))['catch'](handleError(_0x41ba8d,null));};exports[_0x6369('0x49')]=function(_0x24cb45,_0x4e94fd){return db[_0x6369('0x2f')][_0x6369('0x49')](_0x24cb45[_0x6369('0x4a')],{})[_0x6369('0x26')](function(_0x175548){var _0x1539a8=_0x24cb45[_0x6369('0x4b')][_0x6369('0x28')]({'plain':!![]});if(!_0x1539a8)throw new Error(_0x6369('0x4c'));if(_0x1539a8[_0x6369('0x4d')]===_0x6369('0x4b')){var _0x122299=_0x175548[_0x6369('0x28')]({'plain':!![]});var _0x216040='OpenchannelQueues';return db[_0x6369('0x4e')][_0x6369('0x48')]({'where':{'name':_0x216040,'userProfileId':_0x1539a8[_0x6369('0x4f')]},'raw':!![]})[_0x6369('0x26')](function(_0x391169){if(_0x391169&&_0x391169[_0x6369('0x50')]===0x0){return db['UserProfileResource'][_0x6369('0x49')]({'name':_0x122299[_0x6369('0x2c')],'resourceId':_0x122299['id'],'type':_0x391169[_0x6369('0x2c')],'sectionId':_0x391169['id']},{})['then'](function(){return _0x175548;});}else{return _0x175548;}})[_0x6369('0x46')](function(_0x43531d){logger[_0x6369('0x51')](_0x6369('0x52'),_0x43531d);throw _0x43531d;});}return _0x175548;})[_0x6369('0x26')](respondWithResult(_0x4e94fd,0xc9))[_0x6369('0x46')](handleError(_0x4e94fd,null));};exports[_0x6369('0x25')]=function(_0x1145a6,_0x17eb74){if(_0x1145a6[_0x6369('0x4a')]['id']){delete _0x1145a6['body']['id'];}return db[_0x6369('0x2f')][_0x6369('0x48')]({'where':{'id':_0x1145a6[_0x6369('0x53')]['id']}})[_0x6369('0x26')](handleEntityNotFound(_0x17eb74,null))[_0x6369('0x26')](saveUpdates(_0x1145a6[_0x6369('0x4a')],null))['then'](respondWithResult(_0x17eb74,null))[_0x6369('0x46')](handleError(_0x17eb74,null));};exports[_0x6369('0x27')]=function(_0x4c9daa,_0x10bf43){return db[_0x6369('0x2f')][_0x6369('0x48')]({'where':{'id':_0x4c9daa[_0x6369('0x53')]['id']}})['then'](handleEntityNotFound(_0x10bf43,null))[_0x6369('0x26')](removeEntity(_0x10bf43,null))['catch'](handleError(_0x10bf43,null));};exports['describe']=function(_0x14037b,_0x3f32ab){return db['OpenchannelQueue'][_0x6369('0x54')]()['then'](respondWithResult(_0x3f32ab,null))[_0x6369('0x46')](handleError(_0x3f32ab,null));};exports[_0x6369('0x55')]=function(_0x5edc14,_0x36dfd0,_0x183673){var _0x3c9394={'raw':!![],'where':{}},_0xfb07bc={},_0xee4bcc;return db[_0x6369('0x2f')]['findOne']({'where':{'id':_0x5edc14['params']['id']}})[_0x6369('0x26')](handleEntityNotFound(_0x36dfd0,null))[_0x6369('0x26')](function(_0x5c0736){if(_0x5c0736){_0xee4bcc=_0x5c0736['get']({'plain':!![]});_0xfb07bc[_0x6369('0x33')]=_[_0x6369('0x34')](db[_0x6369('0x56')][_0x6369('0x30')]);_0xfb07bc[_0x6369('0x36')]=_[_0x6369('0x34')](_0x5edc14[_0x6369('0x36')]);_0xfb07bc['filters']=_['intersection'](_0xfb07bc[_0x6369('0x33')],_0xfb07bc[_0x6369('0x36')]);_0x3c9394['attributes']=_[_0x6369('0x35')](_0xfb07bc[_0x6369('0x33')],qs['fields'](_0x5edc14[_0x6369('0x36')][_0x6369('0x38')]));_0x3c9394[_0x6369('0x37')]=_0x3c9394[_0x6369('0x37')][_0x6369('0x39')]?_0x3c9394[_0x6369('0x37')]:_0xfb07bc['model'];if(!_0x5edc14['query'][_0x6369('0x3a')]('nolimit')){_0x3c9394[_0x6369('0x23')]=qs[_0x6369('0x23')](_0x5edc14['query'][_0x6369('0x23')]);_0x3c9394[_0x6369('0x22')]=qs[_0x6369('0x22')](_0x5edc14['query'][_0x6369('0x22')]);}_0x3c9394[_0x6369('0x57')]=qs[_0x6369('0x3b')](_0x5edc14[_0x6369('0x36')][_0x6369('0x3b')]);_0x3c9394[_0x6369('0x3c')]=qs['filters'](_['pick'](_0x5edc14['query'],_0xfb07bc[_0x6369('0x3d')]));_0x3c9394[_0x6369('0x3c')][_0x6369('0x58')]=_0x5c0736['id'];if(_0x5edc14[_0x6369('0x36')][_0x6369('0x41')]){_0x3c9394[_0x6369('0x3c')]=_[_0x6369('0x42')](_0x3c9394['where'],{'$or':_[_0x6369('0x2e')](_0x3c9394[_0x6369('0x37')],function(_0x1ecb4f){var _0x2ff3f9={};_0x2ff3f9[_0x1ecb4f]={'$like':'%'+_0x5edc14[_0x6369('0x36')][_0x6369('0x41')]+'%'};return _0x2ff3f9;})});}_0x3c9394=_[_0x6369('0x42')]({},_0x3c9394,_0x5edc14[_0x6369('0x47')]);return db[_0x6369('0x56')]['findAll'](_0x3c9394);}})[_0x6369('0x26')](function(_0x5e6377){if(_0x5e6377){return db[_0x6369('0x59')][_0x6369('0x5a')]({'where':{'id':_[_0x6369('0x2e')](_0x5e6377,_0x6369('0x5b')),'role':'agent'},'attributes':['id','name','openchannelPause','updatedAt',_0x6369('0x5c')]});}})['then'](function(_0x1fc9b7){if(_0x1fc9b7){return{'count':_0x1fc9b7['count'],'rows':_[_0x6369('0x2e')](_0x1fc9b7[_0x6369('0x45')],function(_0x120906){return{'membername':_0x120906[_0x6369('0x2c')],'UserId':_0x120906['id'],'queue_name':_0xee4bcc[_0x6369('0x2c')],'OpenchannelQueueId':_0xee4bcc['id'],'interface':util['format'](_0x6369('0x5d'),_0x6369('0x5e'),_0x120906[_0x6369('0x2c')]),'penalty':0x0,'paused':_0x120906[_0x6369('0x5f')],'createdAt':_0x120906['createdAt'],'updatedAt':_0x120906[_0x6369('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6369('0x26')](respondWithFilteredResult(_0x36dfd0,_0x3c9394))[_0x6369('0x46')](handleError(_0x36dfd0,null));};exports[_0x6369('0x61')]=function(_0xfb80d8,_0x34a12e,_0x4a0f1e){var _0x26991b={};var _0x3d165e={};var _0x5687e3;var _0x401d43;return db[_0x6369('0x2f')]['findOne']({'where':{'id':_0xfb80d8[_0x6369('0x53')]['id']}})[_0x6369('0x26')](handleEntityNotFound(_0x34a12e,null))[_0x6369('0x26')](function(_0x1920a2){if(_0x1920a2){_0x5687e3=_0x1920a2;_0x3d165e[_0x6369('0x33')]=_['keys'](db['Team'][_0x6369('0x30')]);_0x3d165e['query']=_[_0x6369('0x34')](_0xfb80d8[_0x6369('0x36')]);_0x3d165e[_0x6369('0x3d')]=_[_0x6369('0x35')](_0x3d165e[_0x6369('0x33')],_0x3d165e['query']);_0x26991b[_0x6369('0x37')]=_['intersection'](_0x3d165e[_0x6369('0x33')],qs[_0x6369('0x38')](_0xfb80d8[_0x6369('0x36')][_0x6369('0x38')]));_0x26991b[_0x6369('0x37')]=_0x26991b['attributes'][_0x6369('0x39')]?_0x26991b[_0x6369('0x37')]:_0x3d165e[_0x6369('0x33')];_0x26991b[_0x6369('0x57')]=qs[_0x6369('0x3b')](_0xfb80d8[_0x6369('0x36')]['sort']);_0x26991b[_0x6369('0x3c')]=qs[_0x6369('0x3d')](_[_0x6369('0x3e')](_0xfb80d8['query'],_0x3d165e[_0x6369('0x3d')]));if(_0xfb80d8[_0x6369('0x36')]['filter']){_0x26991b['where']=_[_0x6369('0x42')](_0x26991b[_0x6369('0x3c')],{'$or':_[_0x6369('0x2e')](_0x26991b[_0x6369('0x37')],function(_0x2d2a42){var _0x24a10c={};_0x24a10c[_0x2d2a42]={'$like':'%'+_0xfb80d8['query'][_0x6369('0x41')]+'%'};return _0x24a10c;})});}_0x26991b=_['merge']({},_0x26991b,_0xfb80d8[_0x6369('0x47')]);return _0x5687e3[_0x6369('0x61')](_0x26991b);}})[_0x6369('0x26')](function(_0x380235){if(_0x380235){_0x401d43=_0x380235[_0x6369('0x39')];if(!_0xfb80d8[_0x6369('0x36')][_0x6369('0x3a')]('nolimit')){_0x26991b[_0x6369('0x23')]=qs['limit'](_0xfb80d8['query'][_0x6369('0x23')]);_0x26991b[_0x6369('0x22')]=qs[_0x6369('0x22')](_0xfb80d8[_0x6369('0x36')][_0x6369('0x22')]);}return _0x5687e3[_0x6369('0x61')](_0x26991b);}})[_0x6369('0x26')](function(_0x12f06e){if(_0x12f06e){return _0x12f06e?{'count':_0x401d43,'rows':_0x12f06e}:null;}})['then'](respondWithResult(_0x34a12e,null))[_0x6369('0x46')](handleError(_0x34a12e,null));};exports[_0x6369('0x62')]=function(_0x38b2d1,_0x72c996,_0x54a49b){var _0x29d66d=_0x38b2d1['body'][_0x6369('0x63')];return db['Team'][_0x6369('0x64')]({'where':{'id':_0x29d66d},'attributes':['id'],'include':[{'model':db[_0x6369('0x59')],'as':_0x6369('0x65'),'attributes':['id',_0x6369('0x2c'),_0x6369('0x66'),_0x6369('0x67'),_0x6369('0x68')],'raw':!![]}]})[_0x6369('0x26')](function(_0x14d3be){if(_0x14d3be){var _0x548987=_[_0x6369('0x69')](_0x14d3be,function(_0x320b63){var _0x2e1978=_0x320b63[_0x6369('0x28')]({'plain':!![]});return _0x2e1978[_0x6369('0x65')];});return db[_0x6369('0x2f')]['find']({'where':{'id':_0x38b2d1[_0x6369('0x53')]['id']}})[_0x6369('0x26')](function(_0x3b9984){return db[_0x6369('0x6a')][_0x6369('0x6b')](function(_0x53993a){return _0x3b9984[_0x6369('0x62')](_0x29d66d,{'transaction':_0x53993a})['then'](function(){return BPromise['each'](_0x548987,function(_0xdaceac){return db[_0x6369('0x56')][_0x6369('0x6c')]({'where':{'UserId':_0xdaceac['id'],'OpenchannelQueueId':_0x38b2d1[_0x6369('0x53')]['id']},'transaction':_0x53993a});});})[_0x6369('0x26')](function(){_0x548987[_0x6369('0x6d')](function(_0x37fd1c){socket[_0x6369('0x6e')](_0x6369('0x6f'),{'UserId':_0x37fd1c['id'],'OpenchannelQueueId':_0x3b9984['id']});});});});});}})['then'](respondWithStatusCode(_0x72c996,null))['catch'](handleError(_0x72c996,null));};exports[_0x6369('0x70')]=function(_0x503444,_0x34570e,_0x3fe17c){return db[_0x6369('0x71')][_0x6369('0x64')]({'where':{'id':_0x503444['query'][_0x6369('0x63')]},'attributes':['id'],'include':[{'model':db[_0x6369('0x59')],'as':_0x6369('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x34570e,null))[_0x6369('0x26')](function(_0x196181){var _0xe434ab=_[_0x6369('0x2e')](_0x196181,'id');var _0x37ce0c=[];var _0x4bd7b2=[];var _0x52fd4d=squel['select']();_0x52fd4d['field']('tq.TeamId')[_0x6369('0x72')](_0x6369('0x73'),'tq')[_0x6369('0x74')](_0x6369('0x75'),'ut',_0x6369('0x76'))[_0x6369('0x3c')](_0x6369('0x77'),_0x503444[_0x6369('0x53')]['id']);for(var _0x2bcbc8=0x0;_0x2bcbc8<_0x196181[_0x6369('0x39')];_0x2bcbc8+=0x1){let _0xf2b167=_0x196181[_0x2bcbc8];for(var _0x527c7a=0x0;_0x527c7a<_0xf2b167[_0x6369('0x65')][_0x6369('0x39')];_0x527c7a+=0x1){let _0x47daca=_0xf2b167[_0x6369('0x65')][_0x527c7a];var _0x44b417=_0x52fd4d[_0x6369('0x78')]();_0x44b417[_0x6369('0x3c')]('ut.UserId\x20=\x20?',_0x47daca['id']);_0x4bd7b2['push'](db[_0x6369('0x6a')][_0x6369('0x36')](_0x44b417[_0x6369('0x79')](),{'type':db[_0x6369('0x6a')][_0x6369('0x7a')][_0x6369('0x7b')]})['then'](function(_0x2aaf7a){if(_0x2aaf7a[_0x6369('0x39')]===0x1){return _0x47daca['id'];}else{var _0x36769c=_[_0x6369('0x7c')](_[_0x6369('0x2e')](_0x2aaf7a,'TeamId'),function(_0x268aa4){return _[_0x6369('0x7d')](_0xe434ab,_0x268aa4);});if(_0x36769c){return _0x47daca['id'];}}}));}}return BPromise[_0x6369('0x7e')](_0x4bd7b2)[_0x6369('0x26')](function(_0x3cc6d0){_0x37ce0c=_(_0x37ce0c)[_0x6369('0x7f')](_0x3cc6d0)[_0x6369('0x80')]()[_0x6369('0x81')]();return db[_0x6369('0x2f')][_0x6369('0x48')]({'where':{'id':_0x503444[_0x6369('0x53')]['id']}})[_0x6369('0x26')](function(_0x38fa4a){return db[_0x6369('0x6a')][_0x6369('0x6b')](function(_0x3d6fb2){return _0x38fa4a[_0x6369('0x70')](_0x503444['query']['ids'],{'transaction':_0x3d6fb2})['then'](function(){if(!_[_0x6369('0x82')](_0x37ce0c)){return _0x38fa4a['removeAgents'](_0x37ce0c,{'transaction':_0x3d6fb2});}})['then'](function(){_0x37ce0c[_0x6369('0x6d')](function(_0x5e815a){socket[_0x6369('0x6e')]('userOpenchannelQueue:remove',{'UserId':_0x5e815a,'OpenchannelQueueId':_0x38fa4a['id']});});});});});});})[_0x6369('0x26')](respondWithStatusCode(_0x34570e,null))[_0x6369('0x46')](handleError(_0x34570e,null));};exports[_0x6369('0x83')]=function(_0x1cb65b,_0xebf31e,_0x58858e){return db[_0x6369('0x2f')]['find']({'where':{'id':_0x1cb65b['params']['id']}})['then'](handleEntityNotFound(_0xebf31e,null))[_0x6369('0x26')](function(_0x331fad){if(_0x331fad){return _0x331fad[_0x6369('0x83')](_0x1cb65b['body'][_0x6369('0x63')],_[_0x6369('0x84')](_0x1cb65b[_0x6369('0x4a')],[_0x6369('0x63'),'id'])||{})[_0x6369('0x85')](function(_0x6623b3){for(var _0x48ce97=0x0;_0x48ce97<_0x1cb65b['body'][_0x6369('0x63')][_0x6369('0x39')];_0x48ce97+=0x1){socket[_0x6369('0x6e')]('userOpenchannelQueue:save',{'UserId':_0x1cb65b[_0x6369('0x4a')][_0x6369('0x63')][_0x48ce97],'OpenchannelQueueId':_0x1cb65b[_0x6369('0x53')]['id']});}return _0x6623b3;});}})[_0x6369('0x26')](respondWithResult(_0xebf31e,null))[_0x6369('0x46')](handleError(_0xebf31e,null));};exports[_0x6369('0x86')]=function(_0x21c76a,_0x3152fc,_0x48e9fc){return db[_0x6369('0x2f')][_0x6369('0x48')]({'where':{'id':_0x21c76a['params']['id']}})['then'](handleEntityNotFound(_0x3152fc,null))[_0x6369('0x26')](function(_0x3795fa){if(_0x3795fa){return _0x3795fa[_0x6369('0x86')](_0x21c76a['query'][_0x6369('0x63')])[_0x6369('0x26')](function(){if(_[_0x6369('0x87')](_0x21c76a['query']['ids'])){for(var _0x31a59c=0x0;_0x31a59c<_0x21c76a[_0x6369('0x36')][_0x6369('0x63')]['length'];_0x31a59c+=0x1){socket[_0x6369('0x6e')](_0x6369('0x88'),{'UserId':Number(_0x21c76a[_0x6369('0x36')]['ids'][_0x31a59c]),'OpenchannelQueueId':Number(_0x21c76a[_0x6369('0x53')]['id'])});}}else{socket[_0x6369('0x6e')](_0x6369('0x88'),{'UserId':Number(_0x21c76a[_0x6369('0x36')][_0x6369('0x63')]),'OpenchannelQueueId':Number(_0x21c76a[_0x6369('0x53')]['id'])});}});}})[_0x6369('0x26')](respondWithStatusCode(_0x3152fc,null))[_0x6369('0x46')](handleError(_0x3152fc,null));};exports['getAgents']=function(_0x3b582e,_0x7da51e,_0x387383){var _0x5f4912={};var _0x599cce={};var _0x4008bb;var _0x5a334e;return db[_0x6369('0x2f')][_0x6369('0x89')]({'where':{'id':_0x3b582e[_0x6369('0x53')]['id']}})[_0x6369('0x26')](handleEntityNotFound(_0x7da51e,null))[_0x6369('0x26')](function(_0x9ab53e){if(_0x9ab53e){_0x4008bb=_0x9ab53e;_0x599cce['model']=_[_0x6369('0x34')](db[_0x6369('0x59')][_0x6369('0x30')]);_0x599cce[_0x6369('0x36')]=_[_0x6369('0x34')](_0x3b582e[_0x6369('0x36')]);_0x599cce[_0x6369('0x3d')]=_[_0x6369('0x35')](_0x599cce['model'],_0x599cce[_0x6369('0x36')]);_0x5f4912[_0x6369('0x37')]=_['intersection'](_0x599cce[_0x6369('0x33')],qs[_0x6369('0x38')](_0x3b582e[_0x6369('0x36')][_0x6369('0x38')]));_0x5f4912['attributes']=_0x5f4912['attributes'][_0x6369('0x39')]?_0x5f4912[_0x6369('0x37')]:_0x599cce[_0x6369('0x33')];_0x5f4912[_0x6369('0x57')]=qs[_0x6369('0x3b')](_0x3b582e[_0x6369('0x36')][_0x6369('0x3b')]);_0x5f4912['where']=qs[_0x6369('0x3d')](_[_0x6369('0x3e')](_0x3b582e[_0x6369('0x36')],_0x599cce[_0x6369('0x3d')]));if(_0x3b582e[_0x6369('0x36')][_0x6369('0x41')]){_0x5f4912[_0x6369('0x3c')]=_[_0x6369('0x42')](_0x5f4912['where'],{'$or':_['map'](_0x5f4912['attributes'],function(_0x4cc0ab){var _0x50f8f9={};_0x50f8f9[_0x4cc0ab]={'$like':'%'+_0x3b582e[_0x6369('0x36')][_0x6369('0x41')]+'%'};return _0x50f8f9;})});}_0x5f4912=_[_0x6369('0x42')]({},_0x5f4912,_0x3b582e[_0x6369('0x47')]);return _0x4008bb['getAgents'](_0x5f4912);}})[_0x6369('0x26')](function(_0x32a05f){if(_0x32a05f){_0x5a334e=_0x32a05f[_0x6369('0x39')];if(!_0x3b582e[_0x6369('0x36')][_0x6369('0x3a')](_0x6369('0x8a'))){_0x5f4912[_0x6369('0x23')]=qs[_0x6369('0x23')](_0x3b582e[_0x6369('0x36')][_0x6369('0x23')]);_0x5f4912['offset']=qs[_0x6369('0x22')](_0x3b582e[_0x6369('0x36')][_0x6369('0x22')]);}return _0x4008bb['getAgents'](_0x5f4912);}})['then'](function(_0x2d25c1){if(_0x2d25c1){return _0x2d25c1?{'count':_0x5a334e,'rows':_0x2d25c1}:null;}})[_0x6369('0x26')](respondWithResult(_0x7da51e,null))[_0x6369('0x46')](handleError(_0x7da51e,null));}; \ No newline at end of file +var _0x2b19=['removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','pick','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','count','offset','Content-Range','json','apply','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','send','map','OpenchannelQueue','rawAttributes','type','model','name','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','find','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','length','getTeams','addTeams','ids','Team','online','voicePause','Agents','sequelize','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','OpenchannelQueueId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','transaction','isEmpty'];(function(_0x4c80d7,_0x2bef29){var _0x3c5095=function(_0x1b0e67){while(--_0x1b0e67){_0x4c80d7['push'](_0x4c80d7['shift']());}};_0x3c5095(++_0x2bef29);}(_0x2b19,0x110));var _0x92b1=function(_0x227c59,_0x3b4943){_0x227c59=_0x227c59-0x0;var _0xb66348=_0x2b19[_0x227c59];return _0xb66348;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x92b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x92b1('0x1'));var jsonpatch=require(_0x92b1('0x2'));var rp=require(_0x92b1('0x3'));var moment=require(_0x92b1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x92b1('0x5'));var util=require(_0x92b1('0x6'));var path=require('path');var sox=require(_0x92b1('0x7'));var csv=require(_0x92b1('0x8'));var ejs=require(_0x92b1('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x92b1('0xa'));var crypto=require(_0x92b1('0xb'));var jsforce=require(_0x92b1('0xc'));var deskjs=require(_0x92b1('0xd'));var toCsv=require(_0x92b1('0x8'));var querystring=require(_0x92b1('0xe'));var Papa=require(_0x92b1('0xf'));var Redis=require(_0x92b1('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x92b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92b1('0x12'))(_0x92b1('0x13'));var utils=require(_0x92b1('0x14'));var config=require(_0x92b1('0x15'));var db=require('../../mysqldb')['db'];config[_0x92b1('0x16')]=_['defaults'](config[_0x92b1('0x16')],{'host':_0x92b1('0x17'),'port':0x18eb});var socket=require(_0x92b1('0x18'))(new Redis(config[_0x92b1('0x16')]));require(_0x92b1('0x19'))[_0x92b1('0x1a')](socket);function respondWithStatusCode(_0x107ccc,_0x2f5b38){_0x2f5b38=_0x2f5b38||0xcc;return function(_0xf968a6){if(_0xf968a6){return _0x107ccc['sendStatus'](_0x2f5b38);}return _0x107ccc[_0x92b1('0x1b')](_0x2f5b38)[_0x92b1('0x1c')]();};}function respondWithResult(_0x592731,_0x305831){_0x305831=_0x305831||0xc8;return function(_0x439ad8){if(_0x439ad8){return _0x592731[_0x92b1('0x1b')](_0x305831)['json'](_0x439ad8);}};}function respondWithFilteredResult(_0x29ae9e,_0x553de7){return function(_0xee2717){if(_0xee2717){var _0x10da50=_0xee2717[_0x92b1('0x1d')],_0x1a3392=_0x553de7[_0x92b1('0x1e')],_0x1b75b6=_0x553de7[_0x92b1('0x1e')]+_0x553de7['limit'],_0x36d2ea;if(_0x1b75b6>=_0x10da50){_0x1b75b6=_0x10da50;_0x36d2ea=0xc8;}else{_0x36d2ea=0xce;}_0x29ae9e[_0x92b1('0x1b')](_0x36d2ea);return _0x29ae9e['set'](_0x92b1('0x1f'),_0x1a3392+'-'+_0x1b75b6+'/'+_0x10da50)[_0x92b1('0x20')](_0xee2717);}return null;};}function patchUpdates(_0x18b119){return function(_0x4031c2){try{jsonpatch[_0x92b1('0x21')](_0x4031c2,_0x18b119,!![]);}catch(_0x1c72ce){return BPromise['reject'](_0x1c72ce);}return _0x4031c2[_0x92b1('0x22')]();};}function saveUpdates(_0x1e4c52,_0x1d2bc7){return function(_0x18792f){if(_0x18792f){return _0x18792f[_0x92b1('0x23')](_0x1e4c52)[_0x92b1('0x24')](function(_0x2b3ca1){return _0x2b3ca1;});}return null;};}function removeEntity(_0x403cf0,_0x53f1be){return function(_0x5ebf8a){if(_0x5ebf8a){return _0x5ebf8a[_0x92b1('0x25')]()[_0x92b1('0x24')](function(){var _0x26f4f9=_0x5ebf8a[_0x92b1('0x26')]({'plain':!![]});var _0x2c0269=_0x92b1('0x27');return db[_0x92b1('0x28')]['destroy']({'where':{'type':_0x2c0269,'resourceId':_0x26f4f9['id']}})[_0x92b1('0x24')](function(){return _0x5ebf8a;});})[_0x92b1('0x24')](function(){_0x403cf0[_0x92b1('0x1b')](0xcc)[_0x92b1('0x1c')]();});}};}function handleEntityNotFound(_0x531e24,_0x166c94){return function(_0x5eb3d4){if(!_0x5eb3d4){_0x531e24[_0x92b1('0x29')](0x194);}return _0x5eb3d4;};}function handleError(_0x2c3415,_0x557c43){_0x557c43=_0x557c43||0x1f4;return function(_0x53e666){logger[_0x92b1('0x2a')](_0x53e666[_0x92b1('0x2b')]);if(_0x53e666['name']){delete _0x53e666['name'];}_0x2c3415[_0x92b1('0x1b')](_0x557c43)[_0x92b1('0x2c')](_0x53e666);};}exports['index']=function(_0x27df79,_0x441e02){var _0x4f9e90={},_0x2165fb={},_0x344b9b={'count':0x0,'rows':[]};var _0x2391f0=_[_0x92b1('0x2d')](db[_0x92b1('0x2e')][_0x92b1('0x2f')],function(_0x58a27f){return{'name':_0x58a27f['fieldName'],'type':_0x58a27f[_0x92b1('0x30')]['key']};});_0x2165fb[_0x92b1('0x31')]=_['map'](_0x2391f0,_0x92b1('0x32'));_0x2165fb['query']=_['keys'](_0x27df79['query']);_0x2165fb[_0x92b1('0x33')]=_[_0x92b1('0x34')](_0x2165fb[_0x92b1('0x31')],_0x2165fb[_0x92b1('0x35')]);_0x4f9e90['attributes']=_[_0x92b1('0x34')](_0x2165fb[_0x92b1('0x31')],qs['fields'](_0x27df79[_0x92b1('0x35')][_0x92b1('0x36')]));_0x4f9e90[_0x92b1('0x37')]=_0x4f9e90[_0x92b1('0x37')]['length']?_0x4f9e90[_0x92b1('0x37')]:_0x2165fb[_0x92b1('0x31')];if(!_0x27df79['query'][_0x92b1('0x38')](_0x92b1('0x39'))){_0x4f9e90['limit']=qs[_0x92b1('0x3a')](_0x27df79[_0x92b1('0x35')][_0x92b1('0x3a')]);_0x4f9e90[_0x92b1('0x1e')]=qs[_0x92b1('0x1e')](_0x27df79[_0x92b1('0x35')][_0x92b1('0x1e')]);}_0x4f9e90[_0x92b1('0x3b')]=qs[_0x92b1('0x3c')](_0x27df79[_0x92b1('0x35')][_0x92b1('0x3c')]);_0x4f9e90[_0x92b1('0x3d')]=qs['filters'](_['pick'](_0x27df79[_0x92b1('0x35')],_0x2165fb['filters']),_0x2391f0);if(_0x27df79['query'][_0x92b1('0x3e')]){_0x4f9e90['where']=_['merge'](_0x4f9e90[_0x92b1('0x3d')],{'$or':_[_0x92b1('0x2d')](_0x2391f0,function(_0x427be2){if(_0x427be2[_0x92b1('0x30')]!==_0x92b1('0x3f')){var _0x58a45e={};_0x58a45e[_0x427be2[_0x92b1('0x32')]]={'$like':'%'+_0x27df79[_0x92b1('0x35')]['filter']+'%'};return _0x58a45e;}})});}_0x4f9e90=_[_0x92b1('0x40')]({},_0x4f9e90,_0x27df79[_0x92b1('0x41')]);var _0x1b4537={'where':_0x4f9e90[_0x92b1('0x3d')]};return db['OpenchannelQueue'][_0x92b1('0x1d')](_0x1b4537)[_0x92b1('0x24')](function(_0x4eff0b){_0x344b9b[_0x92b1('0x1d')]=_0x4eff0b;if(_0x27df79[_0x92b1('0x35')]['includeAll']){_0x4f9e90[_0x92b1('0x42')]=[{'all':!![]}];}return db[_0x92b1('0x2e')][_0x92b1('0x43')](_0x4f9e90);})[_0x92b1('0x24')](function(_0xf8f115){_0x344b9b[_0x92b1('0x44')]=_0xf8f115;return _0x344b9b;})[_0x92b1('0x24')](respondWithFilteredResult(_0x441e02,_0x4f9e90))[_0x92b1('0x45')](handleError(_0x441e02,null));};exports[_0x92b1('0x46')]=function(_0x32e35b,_0x3cc049){var _0x58553f={'raw':!![],'where':{'id':_0x32e35b[_0x92b1('0x47')]['id']}},_0x4b90d5={};_0x4b90d5[_0x92b1('0x31')]=_['keys'](db[_0x92b1('0x2e')][_0x92b1('0x2f')]);_0x4b90d5['query']=_[_0x92b1('0x48')](_0x32e35b['query']);_0x4b90d5[_0x92b1('0x33')]=_[_0x92b1('0x34')](_0x4b90d5[_0x92b1('0x31')],_0x4b90d5['query']);_0x58553f[_0x92b1('0x37')]=_[_0x92b1('0x34')](_0x4b90d5[_0x92b1('0x31')],qs['fields'](_0x32e35b['query'][_0x92b1('0x36')]));_0x58553f[_0x92b1('0x37')]=_0x58553f[_0x92b1('0x37')]['length']?_0x58553f[_0x92b1('0x37')]:_0x4b90d5['model'];if(_0x32e35b[_0x92b1('0x35')]['includeAll']){_0x58553f[_0x92b1('0x42')]=[{'all':!![]}];}_0x58553f=_[_0x92b1('0x40')]({},_0x58553f,_0x32e35b[_0x92b1('0x41')]);return db[_0x92b1('0x2e')][_0x92b1('0x49')](_0x58553f)[_0x92b1('0x24')](handleEntityNotFound(_0x3cc049,null))[_0x92b1('0x24')](respondWithResult(_0x3cc049,null))[_0x92b1('0x45')](handleError(_0x3cc049,null));};exports[_0x92b1('0x4a')]=function(_0x14bfe6,_0x344ce9){return db['OpenchannelQueue'][_0x92b1('0x4a')](_0x14bfe6['body'],{})[_0x92b1('0x24')](function(_0x1da940){var _0x46714d=_0x14bfe6[_0x92b1('0x4b')][_0x92b1('0x26')]({'plain':!![]});if(!_0x46714d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46714d['role']===_0x92b1('0x4b')){var _0x36afc9=_0x1da940[_0x92b1('0x26')]({'plain':!![]});var _0x5d1688=_0x92b1('0x27');return db[_0x92b1('0x4c')][_0x92b1('0x49')]({'where':{'name':_0x5d1688,'userProfileId':_0x46714d[_0x92b1('0x4d')]},'raw':!![]})[_0x92b1('0x24')](function(_0x16a4b7){if(_0x16a4b7&&_0x16a4b7[_0x92b1('0x4e')]===0x0){return db['UserProfileResource'][_0x92b1('0x4a')]({'name':_0x36afc9['name'],'resourceId':_0x36afc9['id'],'type':_0x16a4b7[_0x92b1('0x32')],'sectionId':_0x16a4b7['id']},{})[_0x92b1('0x24')](function(){return _0x1da940;});}else{return _0x1da940;}})[_0x92b1('0x45')](function(_0x40c3ff){logger['error'](_0x92b1('0x4f'),_0x40c3ff);throw _0x40c3ff;});}return _0x1da940;})[_0x92b1('0x24')](respondWithResult(_0x344ce9,0xc9))['catch'](handleError(_0x344ce9,null));};exports[_0x92b1('0x23')]=function(_0x3cc0f6,_0x57fc9b){if(_0x3cc0f6[_0x92b1('0x50')]['id']){delete _0x3cc0f6[_0x92b1('0x50')]['id'];}return db[_0x92b1('0x2e')][_0x92b1('0x49')]({'where':{'id':_0x3cc0f6[_0x92b1('0x47')]['id']}})['then'](handleEntityNotFound(_0x57fc9b,null))[_0x92b1('0x24')](saveUpdates(_0x3cc0f6[_0x92b1('0x50')],null))['then'](respondWithResult(_0x57fc9b,null))['catch'](handleError(_0x57fc9b,null));};exports['destroy']=function(_0x1a3ba3,_0x25a2a4){return db['OpenchannelQueue']['find']({'where':{'id':_0x1a3ba3[_0x92b1('0x47')]['id']}})[_0x92b1('0x24')](handleEntityNotFound(_0x25a2a4,null))[_0x92b1('0x24')](removeEntity(_0x25a2a4,null))['catch'](handleError(_0x25a2a4,null));};exports['describe']=function(_0x309a4a,_0x284039){return db[_0x92b1('0x2e')]['describe']()['then'](respondWithResult(_0x284039,null))['catch'](handleError(_0x284039,null));};exports[_0x92b1('0x51')]=function(_0xf8b364,_0x5075d5,_0xd43a41){var _0x1881b5={'raw':!![],'where':{}},_0x16a584={},_0x1873c7;return db[_0x92b1('0x2e')][_0x92b1('0x52')]({'where':{'id':_0xf8b364[_0x92b1('0x47')]['id']}})['then'](handleEntityNotFound(_0x5075d5,null))[_0x92b1('0x24')](function(_0x423551){if(_0x423551){_0x1873c7=_0x423551[_0x92b1('0x26')]({'plain':!![]});_0x16a584[_0x92b1('0x31')]=_[_0x92b1('0x48')](db[_0x92b1('0x53')][_0x92b1('0x2f')]);_0x16a584['query']=_[_0x92b1('0x48')](_0xf8b364[_0x92b1('0x35')]);_0x16a584[_0x92b1('0x33')]=_['intersection'](_0x16a584[_0x92b1('0x31')],_0x16a584[_0x92b1('0x35')]);_0x1881b5[_0x92b1('0x37')]=_[_0x92b1('0x34')](_0x16a584['model'],qs[_0x92b1('0x36')](_0xf8b364[_0x92b1('0x35')][_0x92b1('0x36')]));_0x1881b5['attributes']=_0x1881b5[_0x92b1('0x37')]['length']?_0x1881b5[_0x92b1('0x37')]:_0x16a584[_0x92b1('0x31')];if(!_0xf8b364[_0x92b1('0x35')][_0x92b1('0x38')]('nolimit')){_0x1881b5[_0x92b1('0x3a')]=qs[_0x92b1('0x3a')](_0xf8b364[_0x92b1('0x35')][_0x92b1('0x3a')]);_0x1881b5[_0x92b1('0x1e')]=qs[_0x92b1('0x1e')](_0xf8b364[_0x92b1('0x35')][_0x92b1('0x1e')]);}_0x1881b5['order']=qs[_0x92b1('0x3c')](_0xf8b364[_0x92b1('0x35')][_0x92b1('0x3c')]);_0x1881b5[_0x92b1('0x3d')]=qs[_0x92b1('0x33')](_['pick'](_0xf8b364[_0x92b1('0x35')],_0x16a584[_0x92b1('0x33')]));_0x1881b5['where'][_0x92b1('0x54')]=_0x423551['id'];if(_0xf8b364[_0x92b1('0x35')][_0x92b1('0x3e')]){_0x1881b5[_0x92b1('0x3d')]=_[_0x92b1('0x40')](_0x1881b5[_0x92b1('0x3d')],{'$or':_[_0x92b1('0x2d')](_0x1881b5[_0x92b1('0x37')],function(_0x44eebd){var _0x485b69={};_0x485b69[_0x44eebd]={'$like':'%'+_0xf8b364[_0x92b1('0x35')][_0x92b1('0x3e')]+'%'};return _0x485b69;})});}_0x1881b5=_[_0x92b1('0x40')]({},_0x1881b5,_0xf8b364[_0x92b1('0x41')]);return db['UserOpenchannelQueue'][_0x92b1('0x43')](_0x1881b5);}})[_0x92b1('0x24')](function(_0x4f646d){if(_0x4f646d){return db[_0x92b1('0x55')]['findAndCountAll']({'where':{'id':_['map'](_0x4f646d,_0x92b1('0x56')),'role':_0x92b1('0x57')},'attributes':['id',_0x92b1('0x32'),_0x92b1('0x58'),_0x92b1('0x59'),_0x92b1('0x5a')]});}})[_0x92b1('0x24')](function(_0x2ad68a){if(_0x2ad68a){return{'count':_0x2ad68a[_0x92b1('0x1d')],'rows':_[_0x92b1('0x2d')](_0x2ad68a['rows'],function(_0x4d889c){return{'membername':_0x4d889c[_0x92b1('0x32')],'UserId':_0x4d889c['id'],'queue_name':_0x1873c7[_0x92b1('0x32')],'OpenchannelQueueId':_0x1873c7['id'],'interface':util[_0x92b1('0x5b')]('%s/%s',_0x92b1('0x5c'),_0x4d889c['name']),'penalty':0x0,'paused':_0x4d889c[_0x92b1('0x58')],'createdAt':_0x4d889c[_0x92b1('0x5a')],'updatedAt':_0x4d889c[_0x92b1('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x92b1('0x24')](respondWithFilteredResult(_0x5075d5,_0x1881b5))[_0x92b1('0x45')](handleError(_0x5075d5,null));};exports['getTeams']=function(_0x2438d6,_0x42fbcd,_0x56916e){var _0x2988af={};var _0x2e58e3={};var _0x407d4d;var _0x120b19;return db[_0x92b1('0x2e')]['findOne']({'where':{'id':_0x2438d6['params']['id']}})['then'](handleEntityNotFound(_0x42fbcd,null))['then'](function(_0x349ecf){if(_0x349ecf){_0x407d4d=_0x349ecf;_0x2e58e3['model']=_[_0x92b1('0x48')](db['Team'][_0x92b1('0x2f')]);_0x2e58e3[_0x92b1('0x35')]=_[_0x92b1('0x48')](_0x2438d6['query']);_0x2e58e3[_0x92b1('0x33')]=_[_0x92b1('0x34')](_0x2e58e3[_0x92b1('0x31')],_0x2e58e3['query']);_0x2988af[_0x92b1('0x37')]=_['intersection'](_0x2e58e3['model'],qs[_0x92b1('0x36')](_0x2438d6[_0x92b1('0x35')][_0x92b1('0x36')]));_0x2988af[_0x92b1('0x37')]=_0x2988af[_0x92b1('0x37')][_0x92b1('0x5d')]?_0x2988af[_0x92b1('0x37')]:_0x2e58e3['model'];_0x2988af['order']=qs[_0x92b1('0x3c')](_0x2438d6[_0x92b1('0x35')][_0x92b1('0x3c')]);_0x2988af[_0x92b1('0x3d')]=qs['filters'](_['pick'](_0x2438d6['query'],_0x2e58e3[_0x92b1('0x33')]));if(_0x2438d6['query'][_0x92b1('0x3e')]){_0x2988af[_0x92b1('0x3d')]=_['merge'](_0x2988af[_0x92b1('0x3d')],{'$or':_[_0x92b1('0x2d')](_0x2988af[_0x92b1('0x37')],function(_0x5923dd){var _0xbeb016={};_0xbeb016[_0x5923dd]={'$like':'%'+_0x2438d6[_0x92b1('0x35')][_0x92b1('0x3e')]+'%'};return _0xbeb016;})});}_0x2988af=_[_0x92b1('0x40')]({},_0x2988af,_0x2438d6['options']);return _0x407d4d[_0x92b1('0x5e')](_0x2988af);}})['then'](function(_0x4cd0cc){if(_0x4cd0cc){_0x120b19=_0x4cd0cc['length'];if(!_0x2438d6['query'][_0x92b1('0x38')](_0x92b1('0x39'))){_0x2988af[_0x92b1('0x3a')]=qs[_0x92b1('0x3a')](_0x2438d6['query'][_0x92b1('0x3a')]);_0x2988af['offset']=qs[_0x92b1('0x1e')](_0x2438d6[_0x92b1('0x35')]['offset']);}return _0x407d4d['getTeams'](_0x2988af);}})[_0x92b1('0x24')](function(_0x33856b){if(_0x33856b){return _0x33856b?{'count':_0x120b19,'rows':_0x33856b}:null;}})[_0x92b1('0x24')](respondWithResult(_0x42fbcd,null))['catch'](handleError(_0x42fbcd,null));};exports[_0x92b1('0x5f')]=function(_0x54f372,_0xb1cbb4,_0x5812ee){var _0x46f78f=_0x54f372[_0x92b1('0x50')][_0x92b1('0x60')];return db[_0x92b1('0x61')]['findAll']({'where':{'id':_0x46f78f},'attributes':['id'],'include':[{'model':db[_0x92b1('0x55')],'as':'Agents','attributes':['id',_0x92b1('0x32'),_0x92b1('0x62'),_0x92b1('0x63'),'interface'],'raw':!![]}]})[_0x92b1('0x24')](function(_0x5dd9f9){if(_0x5dd9f9){var _0x543c67=_['flatMap'](_0x5dd9f9,function(_0x2a5cbb){var _0x21f56e=_0x2a5cbb[_0x92b1('0x26')]({'plain':!![]});return _0x21f56e[_0x92b1('0x64')];});return db['OpenchannelQueue'][_0x92b1('0x49')]({'where':{'id':_0x54f372['params']['id']}})[_0x92b1('0x24')](function(_0x5ae7c5){return db[_0x92b1('0x65')]['transaction'](function(_0x2e297f){return _0x5ae7c5[_0x92b1('0x5f')](_0x46f78f,{'transaction':_0x2e297f})['then'](function(){return BPromise[_0x92b1('0x66')](_0x543c67,function(_0x28ba8b){return db[_0x92b1('0x53')][_0x92b1('0x67')]({'where':{'UserId':_0x28ba8b['id'],'OpenchannelQueueId':_0x54f372['params']['id']},'transaction':_0x2e297f});});})[_0x92b1('0x24')](function(){_0x543c67['forEach'](function(_0x489bf9){socket[_0x92b1('0x68')](_0x92b1('0x69'),{'UserId':_0x489bf9['id'],'OpenchannelQueueId':_0x5ae7c5['id']});});});});});}})[_0x92b1('0x24')](respondWithStatusCode(_0xb1cbb4,null))[_0x92b1('0x45')](handleError(_0xb1cbb4,null));};exports[_0x92b1('0x6a')]=function(_0x587f95,_0x51d86c,_0x3fa77c){return db[_0x92b1('0x61')][_0x92b1('0x43')]({'where':{'id':_0x587f95[_0x92b1('0x35')][_0x92b1('0x60')]},'attributes':['id'],'include':[{'model':db[_0x92b1('0x55')],'as':_0x92b1('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x51d86c,null))['then'](function(_0x39aad6){var _0xec4e66=_['map'](_0x39aad6,'id');var _0x2fbf8e=[];var _0x1f0555=[];var _0x4cc367=squel[_0x92b1('0x6b')]();_0x4cc367[_0x92b1('0x6c')](_0x92b1('0x6d'))[_0x92b1('0x6e')](_0x92b1('0x6f'),'tq')[_0x92b1('0x70')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x92b1('0x3d')](_0x92b1('0x71'),_0x587f95['params']['id']);for(var _0x1a9d0e=0x0;_0x1a9d0e<_0x39aad6[_0x92b1('0x5d')];_0x1a9d0e+=0x1){let _0x349865=_0x39aad6[_0x1a9d0e];for(var _0x3f6a2c=0x0;_0x3f6a2c<_0x349865[_0x92b1('0x64')]['length'];_0x3f6a2c+=0x1){let _0x2ff217=_0x349865[_0x92b1('0x64')][_0x3f6a2c];var _0x5647e7=_0x4cc367['clone']();_0x5647e7[_0x92b1('0x3d')]('ut.UserId\x20=\x20?',_0x2ff217['id']);_0x1f0555[_0x92b1('0x72')](db[_0x92b1('0x65')]['query'](_0x5647e7[_0x92b1('0x73')](),{'type':db[_0x92b1('0x65')]['QueryTypes'][_0x92b1('0x74')]})[_0x92b1('0x24')](function(_0x1e881d){if(_0x1e881d[_0x92b1('0x5d')]===0x1){return _0x2ff217['id'];}else{var _0x13f685=_[_0x92b1('0x75')](_[_0x92b1('0x2d')](_0x1e881d,_0x92b1('0x76')),function(_0x2dbc10){return _[_0x92b1('0x77')](_0xec4e66,_0x2dbc10);});if(_0x13f685){return _0x2ff217['id'];}}}));}}return BPromise[_0x92b1('0x78')](_0x1f0555)[_0x92b1('0x24')](function(_0x405757){_0x2fbf8e=_(_0x2fbf8e)[_0x92b1('0x79')](_0x405757)['compact']()['value']();return db[_0x92b1('0x2e')][_0x92b1('0x49')]({'where':{'id':_0x587f95[_0x92b1('0x47')]['id']}})[_0x92b1('0x24')](function(_0x10e6dc){return db[_0x92b1('0x65')][_0x92b1('0x7a')](function(_0x33d124){return _0x10e6dc[_0x92b1('0x6a')](_0x587f95[_0x92b1('0x35')]['ids'],{'transaction':_0x33d124})[_0x92b1('0x24')](function(){if(!_[_0x92b1('0x7b')](_0x2fbf8e)){return _0x10e6dc[_0x92b1('0x7c')](_0x2fbf8e,{'transaction':_0x33d124});}})['then'](function(){_0x2fbf8e[_0x92b1('0x7d')](function(_0x10c59a){socket[_0x92b1('0x68')](_0x92b1('0x7e'),{'UserId':_0x10c59a,'OpenchannelQueueId':_0x10e6dc['id']});});});});});});})[_0x92b1('0x24')](respondWithStatusCode(_0x51d86c,null))[_0x92b1('0x45')](handleError(_0x51d86c,null));};exports[_0x92b1('0x7f')]=function(_0x1f1c04,_0x30ec6d,_0xf80cef){return db[_0x92b1('0x2e')][_0x92b1('0x49')]({'where':{'id':_0x1f1c04[_0x92b1('0x47')]['id']}})['then'](handleEntityNotFound(_0x30ec6d,null))[_0x92b1('0x24')](function(_0x25f438){if(_0x25f438){return _0x25f438[_0x92b1('0x7f')](_0x1f1c04[_0x92b1('0x50')][_0x92b1('0x60')],_[_0x92b1('0x80')](_0x1f1c04[_0x92b1('0x50')],[_0x92b1('0x60'),'id'])||{})['spread'](function(_0x48005d){for(var _0xd67564=0x0;_0xd67564<_0x1f1c04['body'][_0x92b1('0x60')]['length'];_0xd67564+=0x1){socket[_0x92b1('0x68')]('userOpenchannelQueue:save',{'UserId':_0x1f1c04['body'][_0x92b1('0x60')][_0xd67564],'OpenchannelQueueId':_0x1f1c04[_0x92b1('0x47')]['id']});}return _0x48005d;});}})[_0x92b1('0x24')](respondWithResult(_0x30ec6d,null))['catch'](handleError(_0x30ec6d,null));};exports['removeAgents']=function(_0x5778d3,_0x23fbe2,_0x466fc2){return db['OpenchannelQueue'][_0x92b1('0x49')]({'where':{'id':_0x5778d3[_0x92b1('0x47')]['id']}})[_0x92b1('0x24')](handleEntityNotFound(_0x23fbe2,null))[_0x92b1('0x24')](function(_0x2e3c8b){if(_0x2e3c8b){return _0x2e3c8b[_0x92b1('0x7c')](_0x5778d3['query'][_0x92b1('0x60')])['then'](function(){if(_[_0x92b1('0x81')](_0x5778d3[_0x92b1('0x35')][_0x92b1('0x60')])){for(var _0x361c96=0x0;_0x361c96<_0x5778d3['query'][_0x92b1('0x60')][_0x92b1('0x5d')];_0x361c96+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x5778d3[_0x92b1('0x35')][_0x92b1('0x60')][_0x361c96]),'OpenchannelQueueId':Number(_0x5778d3[_0x92b1('0x47')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x5778d3['query']['ids']),'OpenchannelQueueId':Number(_0x5778d3['params']['id'])});}});}})[_0x92b1('0x24')](respondWithStatusCode(_0x23fbe2,null))[_0x92b1('0x45')](handleError(_0x23fbe2,null));};exports[_0x92b1('0x82')]=function(_0xac9897,_0x51f10f,_0x9f2b3e){var _0x3009b3={};var _0x2ce02a={};var _0x19e5d8;var _0x3f69df;return db[_0x92b1('0x2e')][_0x92b1('0x52')]({'where':{'id':_0xac9897[_0x92b1('0x47')]['id']}})[_0x92b1('0x24')](handleEntityNotFound(_0x51f10f,null))[_0x92b1('0x24')](function(_0x5eb549){if(_0x5eb549){_0x19e5d8=_0x5eb549;_0x2ce02a['model']=_[_0x92b1('0x48')](db[_0x92b1('0x55')][_0x92b1('0x2f')]);_0x2ce02a[_0x92b1('0x35')]=_[_0x92b1('0x48')](_0xac9897[_0x92b1('0x35')]);_0x2ce02a[_0x92b1('0x33')]=_[_0x92b1('0x34')](_0x2ce02a[_0x92b1('0x31')],_0x2ce02a[_0x92b1('0x35')]);_0x3009b3[_0x92b1('0x37')]=_[_0x92b1('0x34')](_0x2ce02a['model'],qs['fields'](_0xac9897[_0x92b1('0x35')][_0x92b1('0x36')]));_0x3009b3['attributes']=_0x3009b3[_0x92b1('0x37')][_0x92b1('0x5d')]?_0x3009b3[_0x92b1('0x37')]:_0x2ce02a[_0x92b1('0x31')];_0x3009b3['order']=qs[_0x92b1('0x3c')](_0xac9897[_0x92b1('0x35')][_0x92b1('0x3c')]);_0x3009b3[_0x92b1('0x3d')]=qs[_0x92b1('0x33')](_[_0x92b1('0x83')](_0xac9897['query'],_0x2ce02a[_0x92b1('0x33')]));if(_0xac9897[_0x92b1('0x35')][_0x92b1('0x3e')]){_0x3009b3['where']=_[_0x92b1('0x40')](_0x3009b3['where'],{'$or':_[_0x92b1('0x2d')](_0x3009b3[_0x92b1('0x37')],function(_0x53367b){var _0x1fd889={};_0x1fd889[_0x53367b]={'$like':'%'+_0xac9897['query'][_0x92b1('0x3e')]+'%'};return _0x1fd889;})});}_0x3009b3=_[_0x92b1('0x40')]({},_0x3009b3,_0xac9897[_0x92b1('0x41')]);return _0x19e5d8['getAgents'](_0x3009b3);}})[_0x92b1('0x24')](function(_0x5312a5){if(_0x5312a5){_0x3f69df=_0x5312a5[_0x92b1('0x5d')];if(!_0xac9897[_0x92b1('0x35')][_0x92b1('0x38')](_0x92b1('0x39'))){_0x3009b3[_0x92b1('0x3a')]=qs[_0x92b1('0x3a')](_0xac9897[_0x92b1('0x35')][_0x92b1('0x3a')]);_0x3009b3[_0x92b1('0x1e')]=qs[_0x92b1('0x1e')](_0xac9897[_0x92b1('0x35')]['offset']);}return _0x19e5d8[_0x92b1('0x82')](_0x3009b3);}})[_0x92b1('0x24')](function(_0x1545e2){if(_0x1545e2){return _0x1545e2?{'count':_0x3f69df,'rows':_0x1545e2}:null;}})[_0x92b1('0x24')](respondWithResult(_0x51f10f,null))[_0x92b1('0x45')](handleError(_0x51f10f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index d97dbee..b6b4e53 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 _0x2e04=['remove','emit','hasOwnProperty','events','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x228a4a,_0x23d65e){var _0x3d3937=function(_0x3e9511){while(--_0x3e9511){_0x228a4a['push'](_0x228a4a['shift']());}};_0x3d3937(++_0x23d65e);}(_0x2e04,0x153));var _0x42e0=function(_0x586c71,_0x1755f3){_0x586c71=_0x586c71-0x0;var _0x1eb813=_0x2e04[_0x586c71];return _0x1eb813;};'use strict';var EventEmitter=require(_0x42e0('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x42e0('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x42e0('0x2')](0x0);var events={'afterCreate':_0x42e0('0x3'),'afterUpdate':_0x42e0('0x4'),'afterDestroy':_0x42e0('0x5')};function emitEvent(_0x12f5fc){return function(_0x76f438,_0x1e2a74,_0xb54b9b){OpenchannelQueueEvents['emit'](_0x12f5fc+':'+_0x76f438['id'],_0x76f438);OpenchannelQueueEvents[_0x42e0('0x6')](_0x12f5fc,_0x76f438);_0xb54b9b(null);};}for(var e in events){if(events[_0x42e0('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x3001=['remove','emit','hook','exports','events','../../mysqldb','OpenchannelQueue','save','update'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0x3001,0x109));var _0x1300=function(_0x30e6fe,_0x262639){_0x30e6fe=_0x30e6fe-0x0;var _0x4c5073=_0x3001[_0x30e6fe];return _0x4c5073;};'use strict';var EventEmitter=require(_0x1300('0x0'));var OpenchannelQueue=require(_0x1300('0x1'))['db'][_0x1300('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1300('0x3'),'afterUpdate':_0x1300('0x4'),'afterDestroy':_0x1300('0x5')};function emitEvent(_0x54a424){return function(_0x3e6e0f,_0x531c48,_0x1ba590){OpenchannelQueueEvents[_0x1300('0x6')](_0x54a424+':'+_0x3e6e0f['id'],_0x3e6e0f);OpenchannelQueueEvents[_0x1300('0x6')](_0x54a424,_0x3e6e0f);_0x1ba590(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x1300('0x7')](e,emitEvent(event));}}module[_0x1300('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 325d2f6..fe4b79c 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 _0x071c=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util'];(function(_0x2e6f27,_0x561af6){var _0x14e04f=function(_0x38f360){while(--_0x38f360){_0x2e6f27['push'](_0x2e6f27['shift']());}};_0x14e04f(++_0x561af6);}(_0x071c,0x6e));var _0xc071=function(_0x28a4bd,_0x5daa31){_0x28a4bd=_0x28a4bd-0x0;var _0x23ee9e=_0x071c[_0x28a4bd];return _0x23ee9e;};'use strict';var _=require(_0xc071('0x0'));var util=require(_0xc071('0x1'));var logger=require(_0xc071('0x2'))(_0xc071('0x3'));var moment=require(_0xc071('0x4'));var BPromise=require('bluebird');var rp=require(_0xc071('0x5'));var fs=require('fs');var path=require(_0xc071('0x6'));var rimraf=require(_0xc071('0x7'));var config=require(_0xc071('0x8'));var attributes=require(_0xc071('0x9'));module[_0xc071('0xa')]=function(_0x523f0f,_0x38b1b6){return _0x523f0f[_0xc071('0xb')](_0xc071('0xc'),attributes,{'tableName':_0xc071('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29e0=['rimraf','../../config/environment','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2d8eb1,_0x2250c6){var _0xb42a8e=function(_0x2dd0ec){while(--_0x2dd0ec){_0x2d8eb1['push'](_0x2d8eb1['shift']());}};_0xb42a8e(++_0x2250c6);}(_0x29e0,0x1bd));var _0x029e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x029e('0x0'));var logger=require(_0x029e('0x1'))(_0x029e('0x2'));var moment=require(_0x029e('0x3'));var BPromise=require(_0x029e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x029e('0x5'));var rimraf=require(_0x029e('0x6'));var config=require(_0x029e('0x7'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x3865ee,_0x387757){return _0x3865ee[_0x029e('0x8')](_0x029e('0x9'),attributes,{'tableName':_0x029e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index d8b2324..d58dfdf 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 _0x70fc=['defaults','localhost','./openchannelQueue.socket','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','limit','map','include','model','attributes','debug','ShowOpenchannelQueue','find','raw','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis'];(function(_0x5ba74f,_0x200bf4){var _0x534d79=function(_0x50521a){while(--_0x50521a){_0x5ba74f['push'](_0x5ba74f['shift']());}};_0x534d79(++_0x200bf4);}(_0x70fc,0xb8));var _0xc70f=function(_0x2ccb54,_0x53a320){_0x2ccb54=_0x2ccb54-0x0;var _0x5df7fb=_0x70fc[_0x2ccb54];return _0x5df7fb;};'use strict';var _=require(_0xc70f('0x0'));var util=require(_0xc70f('0x1'));var moment=require('moment');var BPromise=require(_0xc70f('0x2'));var rs=require(_0xc70f('0x3'));var fs=require('fs');var Redis=require(_0xc70f('0x4'));var db=require(_0xc70f('0x5'))['db'];var utils=require(_0xc70f('0x6'));var logger=require(_0xc70f('0x7'))('rpc');var config=require(_0xc70f('0x8'));var jayson=require(_0xc70f('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xc70f('0xa')]=_[_0xc70f('0xb')](config[_0xc70f('0xa')],{'host':_0xc70f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc70f('0xd'))['register'](socket);function respondWithRpcPromise(_0x5d95dc,_0x53d74a,_0xda80ea){return new BPromise(function(_0x55f8e2,_0x454961){return client[_0xc70f('0xe')](_0x5d95dc,_0xda80ea)[_0xc70f('0xf')](function(_0x367c64){logger['info'](_0xc70f('0x10'),_0x53d74a,_0xc70f('0x11'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x53d74a,'request\x20sent',JSON[_0xc70f('0x12')](_0x367c64));if(_0x367c64[_0xc70f('0x13')]){if(_0x367c64[_0xc70f('0x13')][_0xc70f('0x14')]===0x1f4){logger[_0xc70f('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x53d74a,_0x367c64[_0xc70f('0x13')][_0xc70f('0x15')]);return _0x454961(_0x367c64[_0xc70f('0x13')][_0xc70f('0x15')]);}logger[_0xc70f('0x13')](_0xc70f('0x10'),_0x53d74a,_0x367c64[_0xc70f('0x13')][_0xc70f('0x15')]);return _0x55f8e2(_0x367c64[_0xc70f('0x13')]['message']);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x53d74a,_0xc70f('0x11'));_0x55f8e2(_0x367c64[_0xc70f('0x16')][_0xc70f('0x15')]);}})[_0xc70f('0x17')](function(_0x500b2d){logger[_0xc70f('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x53d74a,_0x500b2d);_0x454961(_0x500b2d);});});}exports[_0xc70f('0x18')]=function(_0x1ae225){var _0x48a8ce=this;return new Promise(function(_0x14d5d7,_0x58339a){return db[_0xc70f('0x19')][_0xc70f('0x1a')]({'raw':_0x1ae225['options']?_0x1ae225[_0xc70f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1ae225[_0xc70f('0x1b')]?_0x1ae225['options'][_0xc70f('0x1c')]||null:null,'attributes':_0x1ae225['options']?_0x1ae225[_0xc70f('0x1b')]['attributes']||null:null,'limit':_0x1ae225['options']?_0x1ae225[_0xc70f('0x1b')][_0xc70f('0x1d')]||null:null,'include':_0x1ae225[_0xc70f('0x1b')]?_0x1ae225[_0xc70f('0x1b')]['include']?_[_0xc70f('0x1e')](_0x1ae225[_0xc70f('0x1b')][_0xc70f('0x1f')],function(_0x4ef638){return{'model':db[_0x4ef638[_0xc70f('0x20')]],'as':_0x4ef638['as'],'attributes':_0x4ef638[_0xc70f('0x21')],'include':_0x4ef638['include']?_[_0xc70f('0x1e')](_0x4ef638[_0xc70f('0x1f')],function(_0x8f0c36){return{'model':db[_0x8f0c36[_0xc70f('0x20')]],'as':_0x8f0c36['as'],'attributes':_0x8f0c36[_0xc70f('0x21')],'include':_0x8f0c36['include']?_[_0xc70f('0x1e')](_0x8f0c36[_0xc70f('0x1f')],function(_0x167d58){return{'model':db[_0x167d58[_0xc70f('0x20')]],'as':_0x167d58['as'],'attributes':_0x167d58[_0xc70f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc70f('0xf')](function(_0x139f3a){logger['info'](_0xc70f('0x18'),_0x1ae225);logger[_0xc70f('0x22')](_0xc70f('0x18'),_0x1ae225,JSON[_0xc70f('0x12')](_0x139f3a));_0x14d5d7(_0x139f3a);})[_0xc70f('0x17')](function(_0x161fa3){logger['error'](_0xc70f('0x18'),_0x161fa3[_0xc70f('0x15')],_0x1ae225);_0x58339a(_0x48a8ce[_0xc70f('0x13')](0x1f4,_0x161fa3[_0xc70f('0x15')]));});});};exports[_0xc70f('0x23')]=function(_0x4de977){var _0x578ef1=this;return new Promise(function(_0x2e6e50,_0x335472){return db['OpenchannelQueue'][_0xc70f('0x24')]({'raw':_0x4de977['options']?_0x4de977[_0xc70f('0x1b')][_0xc70f('0x25')]===undefined?!![]:![]:!![],'where':_0x4de977[_0xc70f('0x1b')]?_0x4de977['options'][_0xc70f('0x1c')]||null:null,'attributes':_0x4de977[_0xc70f('0x1b')]?_0x4de977['options']['attributes']||null:null,'include':_0x4de977[_0xc70f('0x1b')]?_0x4de977[_0xc70f('0x1b')][_0xc70f('0x1f')]?_[_0xc70f('0x1e')](_0x4de977[_0xc70f('0x1b')]['include'],function(_0x202618){return{'model':db[_0x202618[_0xc70f('0x20')]],'as':_0x202618['as'],'attributes':_0x202618[_0xc70f('0x21')],'include':_0x202618[_0xc70f('0x1f')]?_[_0xc70f('0x1e')](_0x202618[_0xc70f('0x1f')],function(_0x1e4e32){return{'model':db[_0x1e4e32[_0xc70f('0x20')]],'as':_0x1e4e32['as'],'attributes':_0x1e4e32['attributes'],'include':_0x1e4e32['include']?_[_0xc70f('0x1e')](_0x1e4e32[_0xc70f('0x1f')],function(_0x5dc5e6){return{'model':db[_0x5dc5e6[_0xc70f('0x20')]],'as':_0x5dc5e6['as'],'attributes':_0x5dc5e6[_0xc70f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc70f('0xf')](function(_0x3b271c){logger[_0xc70f('0x26')](_0xc70f('0x23'),_0x4de977);logger[_0xc70f('0x22')]('ShowOpenchannelQueue',_0x4de977,JSON[_0xc70f('0x12')](_0x3b271c));_0x2e6e50(_0x3b271c);})[_0xc70f('0x17')](function(_0x2731b1){logger['error'](_0xc70f('0x23'),_0x2731b1[_0xc70f('0x15')],_0x4de977);_0x335472(_0x578ef1[_0xc70f('0x13')](0x1f4,_0x2731b1[_0xc70f('0x15')]));});});}; \ No newline at end of file +var _0xab13=['rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowOpenchannelQueue','find','lodash','util','moment','../../mysqldb','../../config/utils'];(function(_0x1919de,_0x4ed1ba){var _0x16ecd9=function(_0x48a062){while(--_0x48a062){_0x1919de['push'](_0x1919de['shift']());}};_0x16ecd9(++_0x4ed1ba);}(_0xab13,0x1e9));var _0x3ab1=function(_0x202962,_0x4baf03){_0x202962=_0x202962-0x0;var _0x4896a0=_0xab13[_0x202962];return _0x4896a0;};'use strict';var _=require(_0x3ab1('0x0'));var util=require(_0x3ab1('0x1'));var moment=require(_0x3ab1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ab1('0x3'))['db'];var utils=require(_0x3ab1('0x4'));var logger=require('../../config/logger')(_0x3ab1('0x5'));var config=require(_0x3ab1('0x6'));var jayson=require(_0x3ab1('0x7'));var client=jayson['client'][_0x3ab1('0x8')]({'port':0x232a});config[_0x3ab1('0x9')]=_[_0x3ab1('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3ab1('0xb'))(new Redis(config[_0x3ab1('0x9')]));require('./openchannelQueue.socket')[_0x3ab1('0xc')](socket);function respondWithRpcPromise(_0x2e1612,_0x1bd029,_0x2bf4cd){return new BPromise(function(_0x19c9ec,_0x1b488b){return client['request'](_0x2e1612,_0x2bf4cd)[_0x3ab1('0xd')](function(_0x4205c2){logger['info'](_0x3ab1('0xe'),_0x1bd029,_0x3ab1('0xf'));logger[_0x3ab1('0x10')](_0x3ab1('0x11'),_0x1bd029,_0x3ab1('0xf'),JSON[_0x3ab1('0x12')](_0x4205c2));if(_0x4205c2[_0x3ab1('0x13')]){if(_0x4205c2[_0x3ab1('0x13')][_0x3ab1('0x14')]===0x1f4){logger[_0x3ab1('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x1bd029,_0x4205c2['error']['message']);return _0x1b488b(_0x4205c2['error'][_0x3ab1('0x15')]);}logger[_0x3ab1('0x13')](_0x3ab1('0xe'),_0x1bd029,_0x4205c2[_0x3ab1('0x13')][_0x3ab1('0x15')]);return _0x19c9ec(_0x4205c2['error'][_0x3ab1('0x15')]);}else{logger[_0x3ab1('0x16')](_0x3ab1('0xe'),_0x1bd029,'request\x20sent');_0x19c9ec(_0x4205c2[_0x3ab1('0x17')][_0x3ab1('0x15')]);}})[_0x3ab1('0x18')](function(_0x34321d){logger[_0x3ab1('0x13')](_0x3ab1('0xe'),_0x1bd029,_0x34321d);_0x1b488b(_0x34321d);});});}exports[_0x3ab1('0x19')]=function(_0x276d9e){var _0x1c3be8=this;return new Promise(function(_0xabdfcc,_0x529ba1){return db[_0x3ab1('0x1a')][_0x3ab1('0x1b')]({'raw':_0x276d9e[_0x3ab1('0x1c')]?_0x276d9e[_0x3ab1('0x1c')][_0x3ab1('0x1d')]===undefined?!![]:![]:!![],'where':_0x276d9e[_0x3ab1('0x1c')]?_0x276d9e[_0x3ab1('0x1c')][_0x3ab1('0x1e')]||null:null,'attributes':_0x276d9e[_0x3ab1('0x1c')]?_0x276d9e[_0x3ab1('0x1c')][_0x3ab1('0x1f')]||null:null,'limit':_0x276d9e[_0x3ab1('0x1c')]?_0x276d9e['options'][_0x3ab1('0x20')]||null:null,'include':_0x276d9e[_0x3ab1('0x1c')]?_0x276d9e[_0x3ab1('0x1c')][_0x3ab1('0x21')]?_['map'](_0x276d9e[_0x3ab1('0x1c')][_0x3ab1('0x21')],function(_0x22ee22){return{'model':db[_0x22ee22[_0x3ab1('0x22')]],'as':_0x22ee22['as'],'attributes':_0x22ee22[_0x3ab1('0x1f')],'include':_0x22ee22[_0x3ab1('0x21')]?_[_0x3ab1('0x23')](_0x22ee22[_0x3ab1('0x21')],function(_0x486545){return{'model':db[_0x486545['model']],'as':_0x486545['as'],'attributes':_0x486545[_0x3ab1('0x1f')],'include':_0x486545[_0x3ab1('0x21')]?_['map'](_0x486545[_0x3ab1('0x21')],function(_0x1646b0){return{'model':db[_0x1646b0[_0x3ab1('0x22')]],'as':_0x1646b0['as'],'attributes':_0x1646b0[_0x3ab1('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x112db5){logger['info'](_0x3ab1('0x19'),_0x276d9e);logger[_0x3ab1('0x10')](_0x3ab1('0x19'),_0x276d9e,JSON[_0x3ab1('0x12')](_0x112db5));_0xabdfcc(_0x112db5);})[_0x3ab1('0x18')](function(_0xd41321){logger[_0x3ab1('0x13')](_0x3ab1('0x19'),_0xd41321['message'],_0x276d9e);_0x529ba1(_0x1c3be8['error'](0x1f4,_0xd41321[_0x3ab1('0x15')]));});});};exports[_0x3ab1('0x24')]=function(_0x245bb3){var _0x38235b=this;return new Promise(function(_0xf78b9c,_0x543736){return db['OpenchannelQueue'][_0x3ab1('0x25')]({'raw':_0x245bb3[_0x3ab1('0x1c')]?_0x245bb3[_0x3ab1('0x1c')][_0x3ab1('0x1d')]===undefined?!![]:![]:!![],'where':_0x245bb3[_0x3ab1('0x1c')]?_0x245bb3[_0x3ab1('0x1c')]['where']||null:null,'attributes':_0x245bb3[_0x3ab1('0x1c')]?_0x245bb3['options'][_0x3ab1('0x1f')]||null:null,'include':_0x245bb3[_0x3ab1('0x1c')]?_0x245bb3[_0x3ab1('0x1c')][_0x3ab1('0x21')]?_[_0x3ab1('0x23')](_0x245bb3[_0x3ab1('0x1c')][_0x3ab1('0x21')],function(_0x208cf2){return{'model':db[_0x208cf2[_0x3ab1('0x22')]],'as':_0x208cf2['as'],'attributes':_0x208cf2[_0x3ab1('0x1f')],'include':_0x208cf2[_0x3ab1('0x21')]?_[_0x3ab1('0x23')](_0x208cf2[_0x3ab1('0x21')],function(_0x50d300){return{'model':db[_0x50d300['model']],'as':_0x50d300['as'],'attributes':_0x50d300[_0x3ab1('0x1f')],'include':_0x50d300[_0x3ab1('0x21')]?_[_0x3ab1('0x23')](_0x50d300['include'],function(_0x14ca4f){return{'model':db[_0x14ca4f[_0x3ab1('0x22')]],'as':_0x14ca4f['as'],'attributes':_0x14ca4f[_0x3ab1('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x483938){logger['info'](_0x3ab1('0x24'),_0x245bb3);logger[_0x3ab1('0x10')](_0x3ab1('0x24'),_0x245bb3,JSON[_0x3ab1('0x12')](_0x483938));_0xf78b9c(_0x483938);})[_0x3ab1('0x18')](function(_0x276b77){logger[_0x3ab1('0x13')](_0x3ab1('0x24'),_0x276b77['message'],_0x245bb3);_0x543736(_0x38235b['error'](0x1f4,_0x276b77[_0x3ab1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index eb89a31..0cb4b6d 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 _0xe41f=['emit','removeListener','register','length','./openchannelQueue.events','save','remove','update'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0xe41f,0xc4));var _0xfe41=function(_0x48fdc3,_0x5cbccf){_0x48fdc3=_0x48fdc3-0x0;var _0x1c4b24=_0xe41f[_0x48fdc3];return _0x1c4b24;};'use strict';var OpenchannelQueueEvents=require(_0xfe41('0x0'));var events=[_0xfe41('0x1'),_0xfe41('0x2'),_0xfe41('0x3')];function createListener(_0x983909,_0x4adc95){return function(_0x29a79b){_0x4adc95[_0xfe41('0x4')](_0x983909,_0x29a79b);};}function removeListener(_0x220db1,_0x3d211d){return function(){OpenchannelQueueEvents[_0xfe41('0x5')](_0x220db1,_0x3d211d);};}exports[_0xfe41('0x6')]=function(_0x3b21df){for(var _0x5500b5=0x0,_0x10612c=events[_0xfe41('0x7')];_0x5500b5<_0x10612c;_0x5500b5++){var _0x4f12a5=events[_0x5500b5];var _0x3b5cd3=createListener('openchannelQueue:'+_0x4f12a5,_0x3b21df);OpenchannelQueueEvents['on'](_0x4f12a5,_0x3b5cd3);}}; \ No newline at end of file +var _0x00b2=['remove','update','emit','removeListener','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x210a37,_0x28235c){var _0x3d29e1=function(_0x8e0ab){while(--_0x8e0ab){_0x210a37['push'](_0x210a37['shift']());}};_0x3d29e1(++_0x28235c);}(_0x00b2,0x102));var _0x200b=function(_0x193280,_0x54ec6d){_0x193280=_0x193280-0x0;var _0xc5ed9c=_0x00b2[_0x193280];return _0xc5ed9c;};'use strict';var OpenchannelQueueEvents=require(_0x200b('0x0'));var events=['save',_0x200b('0x1'),_0x200b('0x2')];function createListener(_0x4858e0,_0x2c7632){return function(_0x41892b){_0x2c7632[_0x200b('0x3')](_0x4858e0,_0x41892b);};}function removeListener(_0x166c61,_0xe7056e){return function(){OpenchannelQueueEvents[_0x200b('0x4')](_0x166c61,_0xe7056e);};}exports['register']=function(_0x39a34b){for(var _0x5121f2=0x0,_0x414bba=events[_0x200b('0x5')];_0x5121f2<_0x414bba;_0x5121f2++){var _0x3301c9=events[_0x5121f2];var _0x48f5dc=createListener(_0x200b('0x6')+_0x3301c9,_0x39a34b);OpenchannelQueueEvents['on'](_0x3301c9,_0x48f5dc);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b6b60c9..f4e40cb 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 _0xb874=['show','post','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','get','/describe','describe','/:id'];(function(_0x55e3b3,_0xaf7df0){var _0x2c358d=function(_0x4e3d7){while(--_0x4e3d7){_0x55e3b3['push'](_0x55e3b3['shift']());}};_0x2c358d(++_0xaf7df0);}(_0xb874,0x15d));var _0x4b87=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb874[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x4b87('0x0'));var util=require(_0x4b87('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4b87('0x2'));var router=express[_0x4b87('0x3')]();var auth=require(_0x4b87('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4b87('0x5'));var controller=require(_0x4b87('0x6'));router['get']('/',auth[_0x4b87('0x7')](),controller['index']);router[_0x4b87('0x8')](_0x4b87('0x9'),auth['isAuthenticated'](),controller[_0x4b87('0xa')]);router[_0x4b87('0x8')](_0x4b87('0xb'),auth[_0x4b87('0x7')](),controller[_0x4b87('0xc')]);router[_0x4b87('0xd')]('/',auth[_0x4b87('0x7')](),controller['create']);router[_0x4b87('0xe')](_0x4b87('0xb'),auth[_0x4b87('0x7')](),controller[_0x4b87('0xf')]);router[_0x4b87('0x10')](_0x4b87('0xb'),auth[_0x4b87('0x7')](),controller[_0x4b87('0x11')]);module[_0x4b87('0x12')]=router; \ No newline at end of file +var _0x3dc8=['update','delete','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','post','create','put','/:id'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0x3dc8,0x17a));var _0x83dc=function(_0x22f2de,_0x2d7b40){_0x22f2de=_0x22f2de-0x0;var _0x163ecd=_0x3dc8[_0x22f2de];return _0x163ecd;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x83dc('0x0'));var express=require('express');var router=express[_0x83dc('0x1')]();var auth=require(_0x83dc('0x2'));var interaction=require(_0x83dc('0x3'));var config=require(_0x83dc('0x4'));var controller=require('./openchannelQueueReport.controller');router[_0x83dc('0x5')]('/',auth[_0x83dc('0x6')](),controller['index']);router[_0x83dc('0x5')]('/describe',auth[_0x83dc('0x6')](),controller[_0x83dc('0x7')]);router[_0x83dc('0x5')]('/:id',auth[_0x83dc('0x6')](),controller[_0x83dc('0x8')]);router[_0x83dc('0x9')]('/',auth[_0x83dc('0x6')](),controller[_0x83dc('0xa')]);router[_0x83dc('0xb')](_0x83dc('0xc'),auth['isAuthenticated'](),controller[_0x83dc('0xd')]);router[_0x83dc('0xe')](_0x83dc('0xc'),auth[_0x83dc('0x6')](),controller[_0x83dc('0xf')]);module[_0x83dc('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 388e9a0..5502762 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 _0xb290=['DATE','moment','exports','STRING'];(function(_0x6708d1,_0x62d6de){var _0xc18ddd=function(_0x143b74){while(--_0x143b74){_0x6708d1['push'](_0x6708d1['shift']());}};_0xc18ddd(++_0x62d6de);}(_0xb290,0x1c1));var _0x0b29=function(_0x13e47d,_0x1e38bd){_0x13e47d=_0x13e47d-0x0;var _0x1042e4=_0xb290[_0x13e47d];return _0x1042e4;};'use strict';var moment=require(_0x0b29('0x0'));var Sequelize=require('sequelize');module[_0x0b29('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0b29('0x2')]},'joinAt':{'type':Sequelize[_0x0b29('0x3')]},'leaveAt':{'type':Sequelize[_0x0b29('0x3')]},'acceptAt':{'type':Sequelize[_0x0b29('0x3')]},'exitAt':{'type':Sequelize[_0x0b29('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x023f=['sequelize','exports','STRING','DATE'];(function(_0x504527,_0x1b9d01){var _0x4a1670=function(_0x1ce434){while(--_0x1ce434){_0x504527['push'](_0x504527['shift']());}};_0x4a1670(++_0x1b9d01);}(_0x023f,0x1a8));var _0xf023=function(_0x3ecf80,_0x453257){_0x3ecf80=_0x3ecf80-0x0;var _0x2794b2=_0x023f[_0x3ecf80];return _0x2794b2;};'use strict';var moment=require('moment');var Sequelize=require(_0xf023('0x0'));module[_0xf023('0x1')]={'uniqueid':{'type':Sequelize[_0xf023('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf023('0x2')]},'joinAt':{'type':Sequelize[_0xf023('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf023('0x3')]},'exitAt':{'type':Sequelize[_0xf023('0x3')]},'reason':{'type':Sequelize[_0xf023('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 40eda6a..577a6d2 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 _0x0298=['options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','OpenchannelQueueReport','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params'];(function(_0x478e09,_0xdbb31d){var _0x12aacc=function(_0x402b83){while(--_0x402b83){_0x478e09['push'](_0x478e09['shift']());}};_0x12aacc(++_0xdbb31d);}(_0x0298,0x1bb));var _0x8029=function(_0x3d92cb,_0x11aa36){_0x3d92cb=_0x3d92cb-0x0;var _0x50026d=_0x0298[_0x3d92cb];return _0x50026d;};'use strict';var pdf=require(_0x8029('0x0'));var emlformat=require(_0x8029('0x1'));var rimraf=require(_0x8029('0x2'));var zipdir=require(_0x8029('0x3'));var jsonpatch=require(_0x8029('0x4'));var rp=require(_0x8029('0x5'));var moment=require(_0x8029('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8029('0x7'));var util=require(_0x8029('0x8'));var path=require(_0x8029('0x9'));var sox=require(_0x8029('0xa'));var csv=require(_0x8029('0xb'));var ejs=require(_0x8029('0xc'));var fs=require('fs');var _=require(_0x8029('0xd'));var squel=require(_0x8029('0xe'));var crypto=require('crypto');var jsforce=require(_0x8029('0xf'));var deskjs=require(_0x8029('0x10'));var toCsv=require(_0x8029('0xb'));var querystring=require(_0x8029('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8029('0x12'));var qs=require(_0x8029('0x13'));var as=require(_0x8029('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8029('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8029('0x16'));var db=require(_0x8029('0x17'))['db'];function respondWithStatusCode(_0x933712,_0x2e39c4){_0x2e39c4=_0x2e39c4||0xcc;return function(_0x3aeef0){if(_0x3aeef0){return _0x933712['sendStatus'](_0x2e39c4);}return _0x933712[_0x8029('0x18')](_0x2e39c4)[_0x8029('0x19')]();};}function respondWithResult(_0x336bba,_0x14a88c){_0x14a88c=_0x14a88c||0xc8;return function(_0x55b775){if(_0x55b775){return _0x336bba[_0x8029('0x18')](_0x14a88c)[_0x8029('0x1a')](_0x55b775);}};}function respondWithFilteredResult(_0x35ec16,_0x32e632){return function(_0xc23e2f){if(_0xc23e2f){var _0x187c97=_0xc23e2f[_0x8029('0x1b')],_0xf9d011=_0x32e632[_0x8029('0x1c')],_0x4e1c8b=_0x32e632[_0x8029('0x1c')]+_0x32e632['limit'],_0x2fbd70;if(_0x4e1c8b>=_0x187c97){_0x4e1c8b=_0x187c97;_0x2fbd70=0xc8;}else{_0x2fbd70=0xce;}_0x35ec16['status'](_0x2fbd70);return _0x35ec16[_0x8029('0x1d')](_0x8029('0x1e'),_0xf9d011+'-'+_0x4e1c8b+'/'+_0x187c97)[_0x8029('0x1a')](_0xc23e2f);}return null;};}function patchUpdates(_0x5b6983){return function(_0x1fc970){try{jsonpatch[_0x8029('0x1f')](_0x1fc970,_0x5b6983,!![]);}catch(_0x4d3c40){return BPromise[_0x8029('0x20')](_0x4d3c40);}return _0x1fc970[_0x8029('0x21')]();};}function saveUpdates(_0x49cd02,_0x315b8e){return function(_0x4d61c2){if(_0x4d61c2){return _0x4d61c2[_0x8029('0x22')](_0x49cd02)[_0x8029('0x23')](function(_0xe7cd7c){return _0xe7cd7c;});}return null;};}function removeEntity(_0x21eed7,_0x4ea692){return function(_0x45d6ed){if(_0x45d6ed){return _0x45d6ed[_0x8029('0x24')]()[_0x8029('0x23')](function(){_0x21eed7['status'](0xcc)[_0x8029('0x19')]();});}};}function handleEntityNotFound(_0x2ab2ea,_0x2e4637){return function(_0x187ff7){if(!_0x187ff7){_0x2ab2ea['sendStatus'](0x194);}return _0x187ff7;};}function handleError(_0x4481a6,_0x3e21b5){_0x3e21b5=_0x3e21b5||0x1f4;return function(_0x392725){logger[_0x8029('0x25')](_0x392725['stack']);if(_0x392725[_0x8029('0x26')]){delete _0x392725[_0x8029('0x26')];}_0x4481a6[_0x8029('0x18')](_0x3e21b5)['send'](_0x392725);};}exports[_0x8029('0x27')]=function(_0x28d3a3,_0x5acb0b){var _0x3607e0={},_0xc3a6c2={},_0x5e548f={'count':0x0,'rows':[]};var _0x56739c=_[_0x8029('0x28')](db[_0x8029('0x29')]['rawAttributes'],function(_0x49fa2b){return{'name':_0x49fa2b[_0x8029('0x2a')],'type':_0x49fa2b[_0x8029('0x2b')]['key']};});_0xc3a6c2[_0x8029('0x2c')]=_[_0x8029('0x28')](_0x56739c,_0x8029('0x26'));_0xc3a6c2[_0x8029('0x2d')]=_[_0x8029('0x2e')](_0x28d3a3[_0x8029('0x2d')]);_0xc3a6c2['filters']=_['intersection'](_0xc3a6c2['model'],_0xc3a6c2[_0x8029('0x2d')]);_0x3607e0[_0x8029('0x2f')]=_[_0x8029('0x30')](_0xc3a6c2[_0x8029('0x2c')],qs['fields'](_0x28d3a3[_0x8029('0x2d')][_0x8029('0x31')]));_0x3607e0[_0x8029('0x2f')]=_0x3607e0[_0x8029('0x2f')][_0x8029('0x32')]?_0x3607e0['attributes']:_0xc3a6c2[_0x8029('0x2c')];if(!_0x28d3a3[_0x8029('0x2d')][_0x8029('0x33')](_0x8029('0x34'))){_0x3607e0[_0x8029('0x35')]=qs[_0x8029('0x35')](_0x28d3a3[_0x8029('0x2d')][_0x8029('0x35')]);_0x3607e0[_0x8029('0x1c')]=qs['offset'](_0x28d3a3[_0x8029('0x2d')]['offset']);}_0x3607e0[_0x8029('0x36')]=qs[_0x8029('0x37')](_0x28d3a3[_0x8029('0x2d')][_0x8029('0x37')]);_0x3607e0[_0x8029('0x38')]=qs[_0x8029('0x39')](_[_0x8029('0x3a')](_0x28d3a3[_0x8029('0x2d')],_0xc3a6c2[_0x8029('0x39')]),_0x56739c);if(_0x28d3a3[_0x8029('0x2d')][_0x8029('0x3b')]){_0x3607e0[_0x8029('0x38')]=_[_0x8029('0x3c')](_0x3607e0[_0x8029('0x38')],{'$or':_[_0x8029('0x28')](_0x56739c,function(_0x5b7d27){if(_0x5b7d27[_0x8029('0x2b')]!==_0x8029('0x3d')){var _0x24e95b={};_0x24e95b[_0x5b7d27[_0x8029('0x26')]]={'$like':'%'+_0x28d3a3[_0x8029('0x2d')][_0x8029('0x3b')]+'%'};return _0x24e95b;}})});}_0x3607e0=_['merge']({},_0x3607e0,_0x28d3a3['options']);var _0xf1559e={'where':_0x3607e0['where']};return db[_0x8029('0x29')][_0x8029('0x1b')](_0xf1559e)[_0x8029('0x23')](function(_0x4fdd6d){_0x5e548f[_0x8029('0x1b')]=_0x4fdd6d;if(_0x28d3a3['query'][_0x8029('0x3e')]){_0x3607e0[_0x8029('0x3f')]=[{'all':!![]}];}return db[_0x8029('0x29')][_0x8029('0x40')](_0x3607e0);})[_0x8029('0x23')](function(_0x495f9e){_0x5e548f[_0x8029('0x41')]=_0x495f9e;return _0x5e548f;})[_0x8029('0x23')](respondWithFilteredResult(_0x5acb0b,_0x3607e0))[_0x8029('0x42')](handleError(_0x5acb0b,null));};exports['show']=function(_0xbaa2b8,_0x17502d){var _0x1b39aa={'raw':!![],'where':{'id':_0xbaa2b8[_0x8029('0x43')]['id']}},_0x166065={};_0x166065[_0x8029('0x2c')]=_[_0x8029('0x2e')](db[_0x8029('0x29')]['rawAttributes']);_0x166065[_0x8029('0x2d')]=_['keys'](_0xbaa2b8[_0x8029('0x2d')]);_0x166065[_0x8029('0x39')]=_[_0x8029('0x30')](_0x166065[_0x8029('0x2c')],_0x166065[_0x8029('0x2d')]);_0x1b39aa[_0x8029('0x2f')]=_[_0x8029('0x30')](_0x166065[_0x8029('0x2c')],qs[_0x8029('0x31')](_0xbaa2b8[_0x8029('0x2d')]['fields']));_0x1b39aa['attributes']=_0x1b39aa[_0x8029('0x2f')][_0x8029('0x32')]?_0x1b39aa['attributes']:_0x166065[_0x8029('0x2c')];if(_0xbaa2b8['query'][_0x8029('0x3e')]){_0x1b39aa[_0x8029('0x3f')]=[{'all':!![]}];}_0x1b39aa=_['merge']({},_0x1b39aa,_0xbaa2b8[_0x8029('0x44')]);return db['OpenchannelQueueReport'][_0x8029('0x45')](_0x1b39aa)[_0x8029('0x23')](handleEntityNotFound(_0x17502d,null))[_0x8029('0x23')](respondWithResult(_0x17502d,null))[_0x8029('0x42')](handleError(_0x17502d,null));};exports['create']=function(_0x234b78,_0x198627){return db[_0x8029('0x29')][_0x8029('0x46')](_0x234b78[_0x8029('0x47')],{})[_0x8029('0x23')](respondWithResult(_0x198627,0xc9))['catch'](handleError(_0x198627,null));};exports['update']=function(_0xe53800,_0x5dacc6){if(_0xe53800[_0x8029('0x47')]['id']){delete _0xe53800['body']['id'];}return db[_0x8029('0x29')][_0x8029('0x45')]({'where':{'id':_0xe53800['params']['id']}})['then'](handleEntityNotFound(_0x5dacc6,null))[_0x8029('0x23')](saveUpdates(_0xe53800[_0x8029('0x47')],null))[_0x8029('0x23')](respondWithResult(_0x5dacc6,null))['catch'](handleError(_0x5dacc6,null));};exports[_0x8029('0x24')]=function(_0xaef6fb,_0x3e498d){return db[_0x8029('0x29')]['find']({'where':{'id':_0xaef6fb['params']['id']}})['then'](handleEntityNotFound(_0x3e498d,null))[_0x8029('0x23')](removeEntity(_0x3e498d,null))[_0x8029('0x42')](handleError(_0x3e498d,null));};exports[_0x8029('0x48')]=function(_0xda7b2f,_0x511f6b){return db['OpenchannelQueueReport'][_0x8029('0x48')]()['then'](respondWithResult(_0x511f6b,null))[_0x8029('0x42')](handleError(_0x511f6b,null));}; \ No newline at end of file +var _0x3e65=['nolimit','offset','order','sort','where','pick','merge','VIRTUAL','name','filter','count','include','findAll','catch','show','options','find','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','limit','set','apply','update','then','destroy','sendStatus','error','stack','send','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty'];(function(_0x2b0d88,_0x5b5ef2){var _0x1c9256=function(_0x1ea041){while(--_0x1ea041){_0x2b0d88['push'](_0x2b0d88['shift']());}};_0x1c9256(++_0x5b5ef2);}(_0x3e65,0xde));var _0x53e6=function(_0x38ce0f,_0x4ea115){_0x38ce0f=_0x38ce0f-0x0;var _0x33859b=_0x3e65[_0x38ce0f];return _0x33859b;};'use strict';var pdf=require(_0x53e6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x53e6('0x1'));var zipdir=require(_0x53e6('0x2'));var jsonpatch=require(_0x53e6('0x3'));var rp=require('request-promise');var moment=require(_0x53e6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x53e6('0x5'));var util=require('util');var path=require(_0x53e6('0x6'));var sox=require(_0x53e6('0x7'));var csv=require(_0x53e6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x53e6('0x9'));var crypto=require(_0x53e6('0xa'));var jsforce=require(_0x53e6('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x53e6('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x53e6('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x53e6('0xe'))(_0x53e6('0xf'));var utils=require(_0x53e6('0x10'));var config=require(_0x53e6('0x11'));var db=require(_0x53e6('0x12'))['db'];function respondWithStatusCode(_0x8b76ef,_0x274a66){_0x274a66=_0x274a66||0xcc;return function(_0x44487a){if(_0x44487a){return _0x8b76ef['sendStatus'](_0x274a66);}return _0x8b76ef[_0x53e6('0x13')](_0x274a66)['end']();};}function respondWithResult(_0x29e996,_0xf248aa){_0xf248aa=_0xf248aa||0xc8;return function(_0x2a3dcd){if(_0x2a3dcd){return _0x29e996[_0x53e6('0x13')](_0xf248aa)[_0x53e6('0x14')](_0x2a3dcd);}};}function respondWithFilteredResult(_0x2542e4,_0x357858){return function(_0x1a8622){if(_0x1a8622){var _0x2597a3=_0x1a8622['count'],_0xc94505=_0x357858['offset'],_0x2bc97c=_0x357858['offset']+_0x357858[_0x53e6('0x15')],_0x1c6c05;if(_0x2bc97c>=_0x2597a3){_0x2bc97c=_0x2597a3;_0x1c6c05=0xc8;}else{_0x1c6c05=0xce;}_0x2542e4['status'](_0x1c6c05);return _0x2542e4[_0x53e6('0x16')]('Content-Range',_0xc94505+'-'+_0x2bc97c+'/'+_0x2597a3)[_0x53e6('0x14')](_0x1a8622);}return null;};}function patchUpdates(_0x573ba7){return function(_0xcc92aa){try{jsonpatch[_0x53e6('0x17')](_0xcc92aa,_0x573ba7,!![]);}catch(_0x468d9a){return BPromise['reject'](_0x468d9a);}return _0xcc92aa['save']();};}function saveUpdates(_0x265d7f,_0x231544){return function(_0xf41c8e){if(_0xf41c8e){return _0xf41c8e[_0x53e6('0x18')](_0x265d7f)[_0x53e6('0x19')](function(_0x4df04c){return _0x4df04c;});}return null;};}function removeEntity(_0x3d7158,_0x6d2c71){return function(_0x348b87){if(_0x348b87){return _0x348b87[_0x53e6('0x1a')]()[_0x53e6('0x19')](function(){_0x3d7158[_0x53e6('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57611e,_0x3bb713){return function(_0x2bcd7f){if(!_0x2bcd7f){_0x57611e[_0x53e6('0x1b')](0x194);}return _0x2bcd7f;};}function handleError(_0x4fdf7c,_0x102232){_0x102232=_0x102232||0x1f4;return function(_0x4b777a){logger[_0x53e6('0x1c')](_0x4b777a[_0x53e6('0x1d')]);if(_0x4b777a['name']){delete _0x4b777a['name'];}_0x4fdf7c['status'](_0x102232)[_0x53e6('0x1e')](_0x4b777a);};}exports[_0x53e6('0x1f')]=function(_0x428e27,_0x2817df){var _0x12339d={},_0x3a8f17={},_0x68e42c={'count':0x0,'rows':[]};var _0x5b77b7=_[_0x53e6('0x20')](db[_0x53e6('0x21')][_0x53e6('0x22')],function(_0x4cc941){return{'name':_0x4cc941['fieldName'],'type':_0x4cc941[_0x53e6('0x23')][_0x53e6('0x24')]};});_0x3a8f17[_0x53e6('0x25')]=_['map'](_0x5b77b7,'name');_0x3a8f17['query']=_[_0x53e6('0x26')](_0x428e27['query']);_0x3a8f17[_0x53e6('0x27')]=_[_0x53e6('0x28')](_0x3a8f17[_0x53e6('0x25')],_0x3a8f17[_0x53e6('0x29')]);_0x12339d[_0x53e6('0x2a')]=_['intersection'](_0x3a8f17[_0x53e6('0x25')],qs[_0x53e6('0x2b')](_0x428e27['query'][_0x53e6('0x2b')]));_0x12339d['attributes']=_0x12339d[_0x53e6('0x2a')][_0x53e6('0x2c')]?_0x12339d['attributes']:_0x3a8f17[_0x53e6('0x25')];if(!_0x428e27[_0x53e6('0x29')][_0x53e6('0x2d')](_0x53e6('0x2e'))){_0x12339d[_0x53e6('0x15')]=qs[_0x53e6('0x15')](_0x428e27[_0x53e6('0x29')][_0x53e6('0x15')]);_0x12339d[_0x53e6('0x2f')]=qs[_0x53e6('0x2f')](_0x428e27['query']['offset']);}_0x12339d[_0x53e6('0x30')]=qs[_0x53e6('0x31')](_0x428e27[_0x53e6('0x29')]['sort']);_0x12339d[_0x53e6('0x32')]=qs[_0x53e6('0x27')](_[_0x53e6('0x33')](_0x428e27['query'],_0x3a8f17[_0x53e6('0x27')]),_0x5b77b7);if(_0x428e27[_0x53e6('0x29')]['filter']){_0x12339d['where']=_[_0x53e6('0x34')](_0x12339d[_0x53e6('0x32')],{'$or':_[_0x53e6('0x20')](_0x5b77b7,function(_0x15bb63){if(_0x15bb63[_0x53e6('0x23')]!==_0x53e6('0x35')){var _0x1f62c2={};_0x1f62c2[_0x15bb63[_0x53e6('0x36')]]={'$like':'%'+_0x428e27[_0x53e6('0x29')][_0x53e6('0x37')]+'%'};return _0x1f62c2;}})});}_0x12339d=_[_0x53e6('0x34')]({},_0x12339d,_0x428e27['options']);var _0x5b0d3b={'where':_0x12339d[_0x53e6('0x32')]};return db[_0x53e6('0x21')][_0x53e6('0x38')](_0x5b0d3b)['then'](function(_0x7b093c){_0x68e42c[_0x53e6('0x38')]=_0x7b093c;if(_0x428e27[_0x53e6('0x29')]['includeAll']){_0x12339d[_0x53e6('0x39')]=[{'all':!![]}];}return db[_0x53e6('0x21')][_0x53e6('0x3a')](_0x12339d);})[_0x53e6('0x19')](function(_0x2d6e56){_0x68e42c['rows']=_0x2d6e56;return _0x68e42c;})[_0x53e6('0x19')](respondWithFilteredResult(_0x2817df,_0x12339d))[_0x53e6('0x3b')](handleError(_0x2817df,null));};exports[_0x53e6('0x3c')]=function(_0x20a128,_0x21cc04){var _0x275450={'raw':!![],'where':{'id':_0x20a128['params']['id']}},_0xe1192b={};_0xe1192b[_0x53e6('0x25')]=_[_0x53e6('0x26')](db[_0x53e6('0x21')]['rawAttributes']);_0xe1192b[_0x53e6('0x29')]=_[_0x53e6('0x26')](_0x20a128[_0x53e6('0x29')]);_0xe1192b[_0x53e6('0x27')]=_[_0x53e6('0x28')](_0xe1192b[_0x53e6('0x25')],_0xe1192b[_0x53e6('0x29')]);_0x275450[_0x53e6('0x2a')]=_[_0x53e6('0x28')](_0xe1192b['model'],qs[_0x53e6('0x2b')](_0x20a128[_0x53e6('0x29')]['fields']));_0x275450[_0x53e6('0x2a')]=_0x275450[_0x53e6('0x2a')]['length']?_0x275450[_0x53e6('0x2a')]:_0xe1192b[_0x53e6('0x25')];if(_0x20a128['query']['includeAll']){_0x275450[_0x53e6('0x39')]=[{'all':!![]}];}_0x275450=_[_0x53e6('0x34')]({},_0x275450,_0x20a128[_0x53e6('0x3d')]);return db[_0x53e6('0x21')][_0x53e6('0x3e')](_0x275450)[_0x53e6('0x19')](handleEntityNotFound(_0x21cc04,null))[_0x53e6('0x19')](respondWithResult(_0x21cc04,null))[_0x53e6('0x3b')](handleError(_0x21cc04,null));};exports[_0x53e6('0x3f')]=function(_0x50d54e,_0x21f83d){return db['OpenchannelQueueReport']['create'](_0x50d54e[_0x53e6('0x40')],{})[_0x53e6('0x19')](respondWithResult(_0x21f83d,0xc9))[_0x53e6('0x3b')](handleError(_0x21f83d,null));};exports[_0x53e6('0x18')]=function(_0x27d76c,_0x247cb5){if(_0x27d76c[_0x53e6('0x40')]['id']){delete _0x27d76c[_0x53e6('0x40')]['id'];}return db[_0x53e6('0x21')][_0x53e6('0x3e')]({'where':{'id':_0x27d76c[_0x53e6('0x41')]['id']}})[_0x53e6('0x19')](handleEntityNotFound(_0x247cb5,null))[_0x53e6('0x19')](saveUpdates(_0x27d76c[_0x53e6('0x40')],null))[_0x53e6('0x19')](respondWithResult(_0x247cb5,null))[_0x53e6('0x3b')](handleError(_0x247cb5,null));};exports[_0x53e6('0x1a')]=function(_0x313ddc,_0x3f9864){return db[_0x53e6('0x21')]['find']({'where':{'id':_0x313ddc[_0x53e6('0x41')]['id']}})[_0x53e6('0x19')](handleEntityNotFound(_0x3f9864,null))['then'](removeEntity(_0x3f9864,null))[_0x53e6('0x3b')](handleError(_0x3f9864,null));};exports[_0x53e6('0x42')]=function(_0x49e279,_0x431df5){return db[_0x53e6('0x21')][_0x53e6('0x42')]()[_0x53e6('0x19')](respondWithResult(_0x431df5,null))[_0x53e6('0x3b')](handleError(_0x431df5,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index aa07cf1..0f00ad5 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 _0x29d5=['../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x215e84,_0x5df0b7){var _0x7f5b9=function(_0x2557c1){while(--_0x2557c1){_0x215e84['push'](_0x215e84['shift']());}};_0x7f5b9(++_0x5df0b7);}(_0x29d5,0x1e7));var _0x529d=function(_0x52ad43,_0x233c74){_0x52ad43=_0x52ad43-0x0;var _0x46d619=_0x29d5[_0x52ad43];return _0x46d619;};'use strict';var _=require(_0x529d('0x0'));var util=require(_0x529d('0x1'));var logger=require(_0x529d('0x2'))('api');var moment=require(_0x529d('0x3'));var BPromise=require(_0x529d('0x4'));var rp=require(_0x529d('0x5'));var fs=require('fs');var path=require(_0x529d('0x6'));var rimraf=require(_0x529d('0x7'));var config=require(_0x529d('0x8'));var attributes=require(_0x529d('0x9'));module[_0x529d('0xa')]=function(_0x8719db,_0xee15eb){return _0x8719db[_0x529d('0xb')](_0x529d('0xc'),attributes,{'tableName':_0x529d('0xd'),'paranoid':![],'indexes':[{'name':_0x529d('0xe'),'fields':[_0x529d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x753b=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./openchannelQueueReport.attributes'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x753b,0x190));var _0xb753=function(_0x362046,_0x5cf93f){_0x362046=_0x362046-0x0;var _0x419ffe=_0x753b[_0x362046];return _0x419ffe;};'use strict';var _=require(_0xb753('0x0'));var util=require(_0xb753('0x1'));var logger=require(_0xb753('0x2'))('api');var moment=require(_0xb753('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb753('0x4'));var rimraf=require(_0xb753('0x5'));var config=require(_0xb753('0x6'));var attributes=require(_0xb753('0x7'));module['exports']=function(_0x216fe9,_0x4ef1c1){return _0x216fe9[_0xb753('0x8')](_0xb753('0x9'),attributes,{'tableName':_0xb753('0xa'),'paranoid':![],'indexes':[{'name':_0xb753('0xb'),'fields':[_0xb753('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index b0c5653..6e8e62f 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 _0x7382=['error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x217440,_0x24230b){var _0x3d0486=function(_0x588d9e){while(--_0x588d9e){_0x217440['push'](_0x217440['shift']());}};_0x3d0486(++_0x24230b);}(_0x7382,0x111));var _0x2738=function(_0x45d876,_0x13843f){_0x45d876=_0x45d876-0x0;var _0x3cb9be=_0x7382[_0x45d876];return _0x3cb9be;};'use strict';var _=require('lodash');var util=require(_0x2738('0x0'));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(_0x2738('0x1'));var logger=require(_0x2738('0x2'))(_0x2738('0x3'));var config=require(_0x2738('0x4'));var jayson=require(_0x2738('0x5'));var client=jayson['client'][_0x2738('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2bc38a,_0xd74b07,_0x523aef){return new BPromise(function(_0x4235e7,_0x487d14){return client[_0x2738('0x7')](_0x2bc38a,_0x523aef)['then'](function(_0x476864){logger[_0x2738('0x8')](_0x2738('0x9'),_0xd74b07,'request\x20sent');logger[_0x2738('0xa')](_0x2738('0xb'),_0xd74b07,_0x2738('0xc'),JSON['stringify'](_0x476864));if(_0x476864['error']){if(_0x476864[_0x2738('0xd')][_0x2738('0xe')]===0x1f4){logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x476864[_0x2738('0xd')][_0x2738('0xf')]);return _0x487d14(_0x476864[_0x2738('0xd')][_0x2738('0xf')]);}logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x476864[_0x2738('0xd')]['message']);return _0x4235e7(_0x476864[_0x2738('0xd')][_0x2738('0xf')]);}else{logger['info'](_0x2738('0x9'),_0xd74b07,'request\x20sent');_0x4235e7(_0x476864[_0x2738('0x10')]['message']);}})[_0x2738('0x11')](function(_0x568065){logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x568065);_0x487d14(_0x568065);});});}exports[_0x2738('0x12')]=function(_0x3c6810){var _0x1d0aca=this;return new Promise(function(_0x1e0f57,_0x42685a){return db[_0x2738('0x13')]['create'](_0x3c6810[_0x2738('0x14')],{'raw':_0x3c6810['options']?_0x3c6810[_0x2738('0x15')][_0x2738('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x5a1d61){logger[_0x2738('0x8')](_0x2738('0x12'),_0x3c6810);logger[_0x2738('0xa')](_0x2738('0x12'),_0x3c6810,JSON[_0x2738('0x17')](_0x5a1d61));_0x1e0f57(_0x5a1d61);})[_0x2738('0x11')](function(_0x18e1d8){logger[_0x2738('0xd')](_0x2738('0x12'),_0x18e1d8[_0x2738('0xf')],_0x3c6810);_0x42685a(_0x1d0aca[_0x2738('0xd')](0x1f4,_0x18e1d8['message']));});});};exports[_0x2738('0x18')]=function(_0x537c5f){var _0x51ee19=this;return new Promise(function(_0x3e3b2d,_0x2d8c5b){return db[_0x2738('0x13')][_0x2738('0x19')](_0x537c5f[_0x2738('0x14')],{'raw':_0x537c5f[_0x2738('0x15')]?_0x537c5f[_0x2738('0x15')][_0x2738('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x537c5f['options']?_0x537c5f[_0x2738('0x15')]['where']||null:null,'attributes':_0x537c5f[_0x2738('0x15')]?_0x537c5f[_0x2738('0x15')]['attributes']||null:null,'limit':_0x537c5f[_0x2738('0x15')]?_0x537c5f[_0x2738('0x15')]['limit']||null:null})['then'](function(_0x4fad4c){logger['info'](_0x2738('0x18'),_0x537c5f);logger[_0x2738('0xa')](_0x2738('0x18'),_0x537c5f,JSON[_0x2738('0x17')](_0x4fad4c));_0x3e3b2d(_0x4fad4c);})[_0x2738('0x11')](function(_0x2b317c){logger['error'](_0x2738('0x18'),_0x2b317c[_0x2738('0xf')],_0x537c5f);_0x2d8c5b(_0x51ee19[_0x2738('0xd')](0x1f4,_0x2b317c[_0x2738('0xf')]));});});}; \ No newline at end of file +var _0xe3da=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelQueueReport','create','body','options','then','CreateOpenchannelQueueReport','catch','UpdateOpenchannelQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});}exports['CreateOpenchannelQueueReport']=function(_0x3f8cf9){var _0x4cbe4e=this;return new Promise(function(_0x558e42,_0x4d931d){return db[_0xae3d('0x18')][_0xae3d('0x19')](_0x3f8cf9[_0xae3d('0x1a')],{'raw':_0x3f8cf9[_0xae3d('0x1b')]?_0x3f8cf9[_0xae3d('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xae3d('0x1c')](function(_0x48f00e){logger[_0xae3d('0xe')](_0xae3d('0x1d'),_0x3f8cf9);logger[_0xae3d('0x11')](_0xae3d('0x1d'),_0x3f8cf9,JSON[_0xae3d('0x13')](_0x48f00e));_0x558e42(_0x48f00e);})[_0xae3d('0x1e')](function(_0x26c419){logger[_0xae3d('0x14')](_0xae3d('0x1d'),_0x26c419[_0xae3d('0x16')],_0x3f8cf9);_0x4d931d(_0x4cbe4e[_0xae3d('0x14')](0x1f4,_0x26c419[_0xae3d('0x16')]));});});};exports[_0xae3d('0x1f')]=function(_0x1b2acb){var _0x44a4e0=this;return new Promise(function(_0x1fe90f,_0xfb54f6){return db[_0xae3d('0x18')][_0xae3d('0x20')](_0x1b2acb[_0xae3d('0x1a')],{'raw':_0x1b2acb['options']?_0x1b2acb[_0xae3d('0x1b')][_0xae3d('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b2acb[_0xae3d('0x1b')]?_0x1b2acb[_0xae3d('0x1b')][_0xae3d('0x22')]||null:null,'attributes':_0x1b2acb[_0xae3d('0x1b')]?_0x1b2acb[_0xae3d('0x1b')]['attributes']||null:null,'limit':_0x1b2acb['options']?_0x1b2acb[_0xae3d('0x1b')][_0xae3d('0x23')]||null:null})[_0xae3d('0x1c')](function(_0x3114f9){logger[_0xae3d('0xe')]('UpdateOpenchannelQueueReport',_0x1b2acb);logger[_0xae3d('0x11')](_0xae3d('0x1f'),_0x1b2acb,JSON['stringify'](_0x3114f9));_0x1fe90f(_0x3114f9);})[_0xae3d('0x1e')](function(_0x323715){logger[_0xae3d('0x14')](_0xae3d('0x1f'),_0x323715[_0xae3d('0x16')],_0x1b2acb);_0xfb54f6(_0x44a4e0[_0xae3d('0x14')](0x1f4,_0x323715['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 53255b6..ecd97e0 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(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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(_0x41582d,_0x291b1c){var _0x59c504=function(_0x4d967e){while(--_0x4d967e){_0x41582d['push'](_0x41582d['shift']());}};_0x59c504(++_0x291b1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 944cff9..5054f2f 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 _0x964e=['STRING','ENUM','account','agent','queue','DATE','sequelize'];(function(_0x516ce7,_0x1eeeaf){var _0x1a1baa=function(_0x3c0c41){while(--_0x3c0c41){_0x516ce7['push'](_0x516ce7['shift']());}};_0x1a1baa(++_0x1eeeaf);}(_0x964e,0x12c));var _0xe964=function(_0x20f6fc,_0x2dd314){_0x20f6fc=_0x20f6fc-0x0;var _0x11eaf6=_0x964e[_0x20f6fc];return _0x11eaf6;};'use strict';var moment=require('moment');var Sequelize=require(_0xe964('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe964('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe964('0x2')](_0xe964('0x3'),_0xe964('0x4'),_0xe964('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xe964('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x1389=['account','queue','DATE','NOW','moment','sequelize','exports','ENUM'];(function(_0x5087e5,_0x32fdb4){var _0x3b11f0=function(_0x352cbb){while(--_0x352cbb){_0x5087e5['push'](_0x5087e5['shift']());}};_0x3b11f0(++_0x32fdb4);}(_0x1389,0x7c));var _0x9138=function(_0x51411d,_0x465f95){_0x51411d=_0x51411d-0x0;var _0x68f222=_0x1389[_0x51411d];return _0x68f222;};'use strict';var moment=require(_0x9138('0x0'));var Sequelize=require(_0x9138('0x1'));module[_0x9138('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9138('0x3')](_0x9138('0x4'),'agent','queue'),'allowNull':![],'defaultValue':_0x9138('0x5')},'transferredAt':{'type':Sequelize[_0x9138('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x9138('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index e5196a5..632057b 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 _0x555b=['Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','OpenchannelTransferReport','key','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','limit','set'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x555b,0x1a1));var _0xb555=function(_0x245a3a,_0x412346){_0x245a3a=_0x245a3a-0x0;var _0x3ed5d7=_0x555b[_0x245a3a];return _0x3ed5d7;};'use strict';var pdf=require(_0xb555('0x0'));var emlformat=require(_0xb555('0x1'));var rimraf=require(_0xb555('0x2'));var zipdir=require(_0xb555('0x3'));var jsonpatch=require(_0xb555('0x4'));var rp=require(_0xb555('0x5'));var moment=require(_0xb555('0x6'));var BPromise=require(_0xb555('0x7'));var Mustache=require(_0xb555('0x8'));var util=require(_0xb555('0x9'));var path=require(_0xb555('0xa'));var sox=require(_0xb555('0xb'));var csv=require(_0xb555('0xc'));var ejs=require(_0xb555('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb555('0xe'));var crypto=require(_0xb555('0xf'));var jsforce=require(_0xb555('0x10'));var deskjs=require(_0xb555('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb555('0x12'));var Redis=require(_0xb555('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb555('0x14'));var as=require(_0xb555('0x15'));var hardwareService=require(_0xb555('0x16'));var logger=require(_0xb555('0x17'))(_0xb555('0x18'));var utils=require(_0xb555('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x362dc5,_0x28eda8){_0x28eda8=_0x28eda8||0xcc;return function(_0x31af21){if(_0x31af21){return _0x362dc5[_0xb555('0x1a')](_0x28eda8);}return _0x362dc5['status'](_0x28eda8)[_0xb555('0x1b')]();};}function respondWithResult(_0x152c58,_0x5d6ca2){_0x5d6ca2=_0x5d6ca2||0xc8;return function(_0x41423f){if(_0x41423f){return _0x152c58[_0xb555('0x1c')](_0x5d6ca2)[_0xb555('0x1d')](_0x41423f);}};}function respondWithFilteredResult(_0x159aab,_0x10a49a){return function(_0x797c4){if(_0x797c4){var _0x101c89=_0x797c4['count'],_0x1166bf=_0x10a49a['offset'],_0x26b56b=_0x10a49a[_0xb555('0x1e')]+_0x10a49a[_0xb555('0x1f')],_0x5e47d7;if(_0x26b56b>=_0x101c89){_0x26b56b=_0x101c89;_0x5e47d7=0xc8;}else{_0x5e47d7=0xce;}_0x159aab[_0xb555('0x1c')](_0x5e47d7);return _0x159aab[_0xb555('0x20')](_0xb555('0x21'),_0x1166bf+'-'+_0x26b56b+'/'+_0x101c89)['json'](_0x797c4);}return null;};}function patchUpdates(_0x48866c){return function(_0x2ab470){try{jsonpatch[_0xb555('0x22')](_0x2ab470,_0x48866c,!![]);}catch(_0xb4fc71){return BPromise[_0xb555('0x23')](_0xb4fc71);}return _0x2ab470[_0xb555('0x24')]();};}function saveUpdates(_0x93d77f,_0x30ab70){return function(_0x153394){if(_0x153394){return _0x153394[_0xb555('0x25')](_0x93d77f)[_0xb555('0x26')](function(_0x3fd6f0){return _0x3fd6f0;});}return null;};}function removeEntity(_0x4d5535,_0x218629){return function(_0x7e23e4){if(_0x7e23e4){return _0x7e23e4[_0xb555('0x27')]()['then'](function(){_0x4d5535['status'](0xcc)[_0xb555('0x1b')]();});}};}function handleEntityNotFound(_0x10244e,_0x5d83d3){return function(_0x4c4822){if(!_0x4c4822){_0x10244e[_0xb555('0x1a')](0x194);}return _0x4c4822;};}function handleError(_0x2d71af,_0x357f8a){_0x357f8a=_0x357f8a||0x1f4;return function(_0x590538){logger['error'](_0x590538['stack']);if(_0x590538[_0xb555('0x28')]){delete _0x590538[_0xb555('0x28')];}_0x2d71af[_0xb555('0x1c')](_0x357f8a)[_0xb555('0x29')](_0x590538);};}exports[_0xb555('0x2a')]=function(_0x3b8e2b,_0x51154c){var _0x5c0606={},_0x1db2c5={},_0x19011b={'count':0x0,'rows':[]};var _0x467486=_[_0xb555('0x2b')](db[_0xb555('0x2c')]['rawAttributes'],function(_0x1bf335){return{'name':_0x1bf335['fieldName'],'type':_0x1bf335['type'][_0xb555('0x2d')]};});_0x1db2c5['model']=_[_0xb555('0x2b')](_0x467486,'name');_0x1db2c5[_0xb555('0x2e')]=_[_0xb555('0x2f')](_0x3b8e2b[_0xb555('0x2e')]);_0x1db2c5[_0xb555('0x30')]=_[_0xb555('0x31')](_0x1db2c5[_0xb555('0x32')],_0x1db2c5[_0xb555('0x2e')]);_0x5c0606['attributes']=_[_0xb555('0x31')](_0x1db2c5[_0xb555('0x32')],qs[_0xb555('0x33')](_0x3b8e2b[_0xb555('0x2e')]['fields']));_0x5c0606[_0xb555('0x34')]=_0x5c0606['attributes']['length']?_0x5c0606[_0xb555('0x34')]:_0x1db2c5['model'];if(!_0x3b8e2b[_0xb555('0x2e')]['hasOwnProperty'](_0xb555('0x35'))){_0x5c0606[_0xb555('0x1f')]=qs[_0xb555('0x1f')](_0x3b8e2b[_0xb555('0x2e')]['limit']);_0x5c0606[_0xb555('0x1e')]=qs[_0xb555('0x1e')](_0x3b8e2b[_0xb555('0x2e')][_0xb555('0x1e')]);}_0x5c0606[_0xb555('0x36')]=qs[_0xb555('0x37')](_0x3b8e2b[_0xb555('0x2e')][_0xb555('0x37')]);_0x5c0606[_0xb555('0x38')]=qs[_0xb555('0x30')](_[_0xb555('0x39')](_0x3b8e2b[_0xb555('0x2e')],_0x1db2c5[_0xb555('0x30')]),_0x467486);if(_0x3b8e2b[_0xb555('0x2e')][_0xb555('0x3a')]){_0x5c0606[_0xb555('0x38')]=_[_0xb555('0x3b')](_0x5c0606[_0xb555('0x38')],{'$or':_[_0xb555('0x2b')](_0x467486,function(_0x383fcc){if(_0x383fcc['type']!==_0xb555('0x3c')){var _0x1aba31={};_0x1aba31[_0x383fcc[_0xb555('0x28')]]={'$like':'%'+_0x3b8e2b['query'][_0xb555('0x3a')]+'%'};return _0x1aba31;}})});}_0x5c0606=_[_0xb555('0x3b')]({},_0x5c0606,_0x3b8e2b[_0xb555('0x3d')]);var _0x189e35={'where':_0x5c0606[_0xb555('0x38')]};return db[_0xb555('0x2c')][_0xb555('0x3e')](_0x189e35)['then'](function(_0x3fe493){_0x19011b[_0xb555('0x3e')]=_0x3fe493;if(_0x3b8e2b[_0xb555('0x2e')][_0xb555('0x3f')]){_0x5c0606[_0xb555('0x40')]=[{'all':!![]}];}return db[_0xb555('0x2c')][_0xb555('0x41')](_0x5c0606);})[_0xb555('0x26')](function(_0x347d57){_0x19011b['rows']=_0x347d57;return _0x19011b;})[_0xb555('0x26')](respondWithFilteredResult(_0x51154c,_0x5c0606))[_0xb555('0x42')](handleError(_0x51154c,null));};exports[_0xb555('0x43')]=function(_0x18400e,_0x169a2b){var _0x3f1781={'raw':!![],'where':{'id':_0x18400e[_0xb555('0x44')]['id']}},_0x3098ae={};_0x3098ae[_0xb555('0x32')]=_[_0xb555('0x2f')](db['OpenchannelTransferReport'][_0xb555('0x45')]);_0x3098ae['query']=_[_0xb555('0x2f')](_0x18400e[_0xb555('0x2e')]);_0x3098ae[_0xb555('0x30')]=_['intersection'](_0x3098ae['model'],_0x3098ae[_0xb555('0x2e')]);_0x3f1781[_0xb555('0x34')]=_['intersection'](_0x3098ae[_0xb555('0x32')],qs[_0xb555('0x33')](_0x18400e['query'][_0xb555('0x33')]));_0x3f1781[_0xb555('0x34')]=_0x3f1781[_0xb555('0x34')][_0xb555('0x46')]?_0x3f1781['attributes']:_0x3098ae['model'];if(_0x18400e[_0xb555('0x2e')][_0xb555('0x3f')]){_0x3f1781[_0xb555('0x40')]=[{'all':!![]}];}_0x3f1781=_[_0xb555('0x3b')]({},_0x3f1781,_0x18400e[_0xb555('0x3d')]);return db[_0xb555('0x2c')][_0xb555('0x47')](_0x3f1781)[_0xb555('0x26')](handleEntityNotFound(_0x169a2b,null))['then'](respondWithResult(_0x169a2b,null))['catch'](handleError(_0x169a2b,null));};exports[_0xb555('0x48')]=function(_0x4af0b2,_0x300856){return db[_0xb555('0x2c')][_0xb555('0x48')](_0x4af0b2['body'],{})[_0xb555('0x26')](respondWithResult(_0x300856,0xc9))['catch'](handleError(_0x300856,null));};exports[_0xb555('0x25')]=function(_0x3679ee,_0x2b5681){if(_0x3679ee[_0xb555('0x49')]['id']){delete _0x3679ee[_0xb555('0x49')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x3679ee[_0xb555('0x44')]['id']}})[_0xb555('0x26')](handleEntityNotFound(_0x2b5681,null))['then'](saveUpdates(_0x3679ee[_0xb555('0x49')],null))[_0xb555('0x26')](respondWithResult(_0x2b5681,null))[_0xb555('0x42')](handleError(_0x2b5681,null));};exports[_0xb555('0x27')]=function(_0x56dbf5,_0x5bef72){return db[_0xb555('0x2c')][_0xb555('0x47')]({'where':{'id':_0x56dbf5[_0xb555('0x44')]['id']}})['then'](handleEntityNotFound(_0x5bef72,null))[_0xb555('0x26')](removeEntity(_0x5bef72,null))['catch'](handleError(_0x5bef72,null));};exports['describe']=function(_0x289940,_0x450d9e){return db[_0xb555('0x2c')][_0xb555('0x4a')]()[_0xb555('0x26')](respondWithResult(_0x450d9e,null))[_0xb555('0x42')](handleError(_0x450d9e,null));}; \ No newline at end of file +var _0x61db=['status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','then','stack','name','send','index','OpenchannelTransferReport','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','sendStatus'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0x61db,0xcb));var _0xb61d=function(_0x200ca2,_0x117050){_0x200ca2=_0x200ca2-0x0;var _0x43910b=_0x61db[_0x200ca2];return _0x43910b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb61d('0x0'));var rimraf=require(_0xb61d('0x1'));var zipdir=require(_0xb61d('0x2'));var jsonpatch=require(_0xb61d('0x3'));var rp=require(_0xb61d('0x4'));var moment=require(_0xb61d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb61d('0x6'));var util=require(_0xb61d('0x7'));var path=require(_0xb61d('0x8'));var sox=require(_0xb61d('0x9'));var csv=require(_0xb61d('0xa'));var ejs=require(_0xb61d('0xb'));var fs=require('fs');var _=require(_0xb61d('0xc'));var squel=require(_0xb61d('0xd'));var crypto=require(_0xb61d('0xe'));var jsforce=require(_0xb61d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb61d('0xa'));var querystring=require(_0xb61d('0x10'));var Papa=require(_0xb61d('0x11'));var Redis=require(_0xb61d('0x12'));var authService=require(_0xb61d('0x13'));var qs=require(_0xb61d('0x14'));var as=require(_0xb61d('0x15'));var hardwareService=require(_0xb61d('0x16'));var logger=require(_0xb61d('0x17'))(_0xb61d('0x18'));var utils=require(_0xb61d('0x19'));var config=require(_0xb61d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x294bad,_0x5d5d37){_0x5d5d37=_0x5d5d37||0xcc;return function(_0x57b71a){if(_0x57b71a){return _0x294bad[_0xb61d('0x1b')](_0x5d5d37);}return _0x294bad[_0xb61d('0x1c')](_0x5d5d37)[_0xb61d('0x1d')]();};}function respondWithResult(_0x25afbb,_0x48bfec){_0x48bfec=_0x48bfec||0xc8;return function(_0x43bca7){if(_0x43bca7){return _0x25afbb[_0xb61d('0x1c')](_0x48bfec)[_0xb61d('0x1e')](_0x43bca7);}};}function respondWithFilteredResult(_0x17ab1a,_0x3d171a){return function(_0x274b41){if(_0x274b41){var _0x3d669a=_0x274b41[_0xb61d('0x1f')],_0xf0cedf=_0x3d171a[_0xb61d('0x20')],_0x37cd1f=_0x3d171a['offset']+_0x3d171a[_0xb61d('0x21')],_0x41837e;if(_0x37cd1f>=_0x3d669a){_0x37cd1f=_0x3d669a;_0x41837e=0xc8;}else{_0x41837e=0xce;}_0x17ab1a[_0xb61d('0x1c')](_0x41837e);return _0x17ab1a[_0xb61d('0x22')](_0xb61d('0x23'),_0xf0cedf+'-'+_0x37cd1f+'/'+_0x3d669a)[_0xb61d('0x1e')](_0x274b41);}return null;};}function patchUpdates(_0x484bd4){return function(_0x1ca044){try{jsonpatch['apply'](_0x1ca044,_0x484bd4,!![]);}catch(_0x4f73f9){return BPromise['reject'](_0x4f73f9);}return _0x1ca044[_0xb61d('0x24')]();};}function saveUpdates(_0x537f0e,_0x3c2ea0){return function(_0x5f196b){if(_0x5f196b){return _0x5f196b[_0xb61d('0x25')](_0x537f0e)['then'](function(_0x589d72){return _0x589d72;});}return null;};}function removeEntity(_0x3fcedb,_0x396a5c){return function(_0x2939a2){if(_0x2939a2){return _0x2939a2[_0xb61d('0x26')]()[_0xb61d('0x27')](function(){_0x3fcedb[_0xb61d('0x1c')](0xcc)[_0xb61d('0x1d')]();});}};}function handleEntityNotFound(_0x1d2577,_0x8cb930){return function(_0x3cb1d2){if(!_0x3cb1d2){_0x1d2577[_0xb61d('0x1b')](0x194);}return _0x3cb1d2;};}function handleError(_0xb335a6,_0x1fb41c){_0x1fb41c=_0x1fb41c||0x1f4;return function(_0xede039){logger['error'](_0xede039[_0xb61d('0x28')]);if(_0xede039['name']){delete _0xede039[_0xb61d('0x29')];}_0xb335a6[_0xb61d('0x1c')](_0x1fb41c)[_0xb61d('0x2a')](_0xede039);};}exports[_0xb61d('0x2b')]=function(_0x5953de,_0x16f913){var _0x1d389a={},_0x204c7e={},_0x233c2b={'count':0x0,'rows':[]};var _0x2df2ea=_['map'](db[_0xb61d('0x2c')]['rawAttributes'],function(_0x2eccd6){return{'name':_0x2eccd6[_0xb61d('0x2d')],'type':_0x2eccd6[_0xb61d('0x2e')][_0xb61d('0x2f')]};});_0x204c7e[_0xb61d('0x30')]=_['map'](_0x2df2ea,'name');_0x204c7e['query']=_[_0xb61d('0x31')](_0x5953de['query']);_0x204c7e[_0xb61d('0x32')]=_[_0xb61d('0x33')](_0x204c7e[_0xb61d('0x30')],_0x204c7e['query']);_0x1d389a[_0xb61d('0x34')]=_[_0xb61d('0x33')](_0x204c7e[_0xb61d('0x30')],qs[_0xb61d('0x35')](_0x5953de[_0xb61d('0x36')][_0xb61d('0x35')]));_0x1d389a['attributes']=_0x1d389a['attributes'][_0xb61d('0x37')]?_0x1d389a[_0xb61d('0x34')]:_0x204c7e['model'];if(!_0x5953de[_0xb61d('0x36')][_0xb61d('0x38')](_0xb61d('0x39'))){_0x1d389a[_0xb61d('0x21')]=qs[_0xb61d('0x21')](_0x5953de[_0xb61d('0x36')][_0xb61d('0x21')]);_0x1d389a[_0xb61d('0x20')]=qs[_0xb61d('0x20')](_0x5953de[_0xb61d('0x36')][_0xb61d('0x20')]);}_0x1d389a[_0xb61d('0x3a')]=qs[_0xb61d('0x3b')](_0x5953de[_0xb61d('0x36')][_0xb61d('0x3b')]);_0x1d389a[_0xb61d('0x3c')]=qs['filters'](_[_0xb61d('0x3d')](_0x5953de[_0xb61d('0x36')],_0x204c7e['filters']),_0x2df2ea);if(_0x5953de['query']['filter']){_0x1d389a[_0xb61d('0x3c')]=_[_0xb61d('0x3e')](_0x1d389a[_0xb61d('0x3c')],{'$or':_[_0xb61d('0x3f')](_0x2df2ea,function(_0x591806){if(_0x591806[_0xb61d('0x2e')]!=='VIRTUAL'){var _0x3b9a35={};_0x3b9a35[_0x591806[_0xb61d('0x29')]]={'$like':'%'+_0x5953de[_0xb61d('0x36')]['filter']+'%'};return _0x3b9a35;}})});}_0x1d389a=_[_0xb61d('0x3e')]({},_0x1d389a,_0x5953de['options']);var _0x1a1b98={'where':_0x1d389a[_0xb61d('0x3c')]};return db[_0xb61d('0x2c')][_0xb61d('0x1f')](_0x1a1b98)[_0xb61d('0x27')](function(_0x32cf65){_0x233c2b[_0xb61d('0x1f')]=_0x32cf65;if(_0x5953de[_0xb61d('0x36')][_0xb61d('0x40')]){_0x1d389a['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xb61d('0x41')](_0x1d389a);})[_0xb61d('0x27')](function(_0x267d5d){_0x233c2b[_0xb61d('0x42')]=_0x267d5d;return _0x233c2b;})[_0xb61d('0x27')](respondWithFilteredResult(_0x16f913,_0x1d389a))[_0xb61d('0x43')](handleError(_0x16f913,null));};exports[_0xb61d('0x44')]=function(_0x520478,_0x3aa9bb){var _0x204129={'raw':!![],'where':{'id':_0x520478[_0xb61d('0x45')]['id']}},_0x45313c={};_0x45313c[_0xb61d('0x30')]=_['keys'](db[_0xb61d('0x2c')][_0xb61d('0x46')]);_0x45313c[_0xb61d('0x36')]=_[_0xb61d('0x31')](_0x520478['query']);_0x45313c[_0xb61d('0x32')]=_['intersection'](_0x45313c['model'],_0x45313c[_0xb61d('0x36')]);_0x204129[_0xb61d('0x34')]=_['intersection'](_0x45313c['model'],qs[_0xb61d('0x35')](_0x520478[_0xb61d('0x36')][_0xb61d('0x35')]));_0x204129[_0xb61d('0x34')]=_0x204129['attributes'][_0xb61d('0x37')]?_0x204129['attributes']:_0x45313c[_0xb61d('0x30')];if(_0x520478[_0xb61d('0x36')]['includeAll']){_0x204129[_0xb61d('0x47')]=[{'all':!![]}];}_0x204129=_[_0xb61d('0x3e')]({},_0x204129,_0x520478[_0xb61d('0x48')]);return db[_0xb61d('0x2c')][_0xb61d('0x49')](_0x204129)[_0xb61d('0x27')](handleEntityNotFound(_0x3aa9bb,null))['then'](respondWithResult(_0x3aa9bb,null))[_0xb61d('0x43')](handleError(_0x3aa9bb,null));};exports[_0xb61d('0x4a')]=function(_0x47d65d,_0x301366){return db[_0xb61d('0x2c')][_0xb61d('0x4a')](_0x47d65d[_0xb61d('0x4b')],{})[_0xb61d('0x27')](respondWithResult(_0x301366,0xc9))[_0xb61d('0x43')](handleError(_0x301366,null));};exports['update']=function(_0xa4f5cf,_0x141f5e){if(_0xa4f5cf[_0xb61d('0x4b')]['id']){delete _0xa4f5cf[_0xb61d('0x4b')]['id'];}return db[_0xb61d('0x2c')][_0xb61d('0x49')]({'where':{'id':_0xa4f5cf[_0xb61d('0x45')]['id']}})[_0xb61d('0x27')](handleEntityNotFound(_0x141f5e,null))[_0xb61d('0x27')](saveUpdates(_0xa4f5cf[_0xb61d('0x4b')],null))[_0xb61d('0x27')](respondWithResult(_0x141f5e,null))['catch'](handleError(_0x141f5e,null));};exports['destroy']=function(_0x2b45af,_0x32ed58){return db[_0xb61d('0x2c')][_0xb61d('0x49')]({'where':{'id':_0x2b45af['params']['id']}})['then'](handleEntityNotFound(_0x32ed58,null))[_0xb61d('0x27')](removeEntity(_0x32ed58,null))[_0xb61d('0x43')](handleError(_0x32ed58,null));};exports[_0xb61d('0x4c')]=function(_0x388a57,_0x376239){return db[_0xb61d('0x2c')]['describe']()[_0xb61d('0x27')](respondWithResult(_0x376239,null))[_0xb61d('0x43')](handleError(_0x376239,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index f2b5b3d..d00fd2e 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 _0x62f1=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2b5b34,_0x4f09b0){var _0x219ad5=function(_0x3c99f6){while(--_0x3c99f6){_0x2b5b34['push'](_0x2b5b34['shift']());}};_0x219ad5(++_0x4f09b0);}(_0x62f1,0x112));var _0x162f=function(_0x14f9b9,_0x102f56){_0x14f9b9=_0x14f9b9-0x0;var _0xab268f=_0x62f1[_0x14f9b9];return _0xab268f;};'use strict';var _=require(_0x162f('0x0'));var util=require('util');var logger=require(_0x162f('0x1'))(_0x162f('0x2'));var moment=require(_0x162f('0x3'));var BPromise=require(_0x162f('0x4'));var rp=require(_0x162f('0x5'));var fs=require('fs');var path=require(_0x162f('0x6'));var rimraf=require(_0x162f('0x7'));var config=require(_0x162f('0x8'));var attributes=require(_0x162f('0x9'));module[_0x162f('0xa')]=function(_0x4c8c54,_0x3caa89){return _0x4c8c54[_0x162f('0xb')]('OpenchannelTransferReport',attributes,{'tableName':_0x162f('0xc'),'paranoid':![],'indexes':[{'name':_0x162f('0xd'),'fields':[_0x162f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1bce=['request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x23845c,_0x1457b4){var _0x40bcb9=function(_0x332570){while(--_0x332570){_0x23845c['push'](_0x23845c['shift']());}};_0x40bcb9(++_0x1457b4);}(_0x1bce,0x73));var _0xe1bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bce[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe1bc('0x0'));var util=require(_0xe1bc('0x1'));var logger=require('../../config/logger')(_0xe1bc('0x2'));var moment=require(_0xe1bc('0x3'));var BPromise=require(_0xe1bc('0x4'));var rp=require(_0xe1bc('0x5'));var fs=require('fs');var path=require(_0xe1bc('0x6'));var rimraf=require(_0xe1bc('0x7'));var config=require(_0xe1bc('0x8'));var attributes=require(_0xe1bc('0x9'));module[_0xe1bc('0xa')]=function(_0x57ebd4,_0x51566c){return _0x57ebd4[_0xe1bc('0xb')](_0xe1bc('0xc'),attributes,{'tableName':_0xe1bc('0xd'),'paranoid':![],'indexes':[{'name':_0xe1bc('0xe'),'fields':[_0xe1bc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 0c9b32e..0af10db 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 _0x219a=['../../config/logger','../../config/environment','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','util','moment','bluebird','ioredis'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0x219a,0x1c7));var _0xa219=function(_0x4e6ae0,_0x365c85){_0x4e6ae0=_0x4e6ae0-0x0;var _0x339556=_0x219a[_0x4e6ae0];return _0x339556;};'use strict';var _=require('lodash');var util=require(_0xa219('0x0'));var moment=require(_0xa219('0x1'));var BPromise=require(_0xa219('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa219('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa219('0x4'))('rpc');var config=require(_0xa219('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa219('0x6')][_0xa219('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23f687,_0x43f21d,_0x217c19){return new BPromise(function(_0x4ea436,_0x23c89d){return client[_0xa219('0x8')](_0x23f687,_0x217c19)[_0xa219('0x9')](function(_0x395128){logger['info'](_0xa219('0xa'),_0x43f21d,_0xa219('0xb'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x43f21d,_0xa219('0xb'),JSON['stringify'](_0x395128));if(_0x395128[_0xa219('0xc')]){if(_0x395128['error']['code']===0x1f4){logger[_0xa219('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x43f21d,_0x395128[_0xa219('0xc')][_0xa219('0xd')]);return _0x23c89d(_0x395128['error'][_0xa219('0xd')]);}logger[_0xa219('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x43f21d,_0x395128[_0xa219('0xc')][_0xa219('0xd')]);return _0x4ea436(_0x395128[_0xa219('0xc')][_0xa219('0xd')]);}else{logger[_0xa219('0xe')](_0xa219('0xa'),_0x43f21d,_0xa219('0xb'));_0x4ea436(_0x395128[_0xa219('0xf')]['message']);}})[_0xa219('0x10')](function(_0x3d539a){logger[_0xa219('0xc')](_0xa219('0xa'),_0x43f21d,_0x3d539a);_0x23c89d(_0x3d539a);});});} \ No newline at end of file +var _0x37cc=['http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3d074c,_0x42725f){var _0x250a80=function(_0x4bc742){while(--_0x4bc742){_0x3d074c['push'](_0x3d074c['shift']());}};_0x250a80(++_0x42725f);}(_0x37cc,0x185));var _0xc37c=function(_0x133e3b,_0x443cd6){_0x133e3b=_0x133e3b-0x0;var _0x199e72=_0x37cc[_0x133e3b];return _0x199e72;};'use strict';var _=require(_0xc37c('0x0'));var util=require(_0xc37c('0x1'));var moment=require(_0xc37c('0x2'));var BPromise=require(_0xc37c('0x3'));var rs=require(_0xc37c('0x4'));var fs=require('fs');var Redis=require(_0xc37c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc37c('0x6'))(_0xc37c('0x7'));var config=require(_0xc37c('0x8'));var jayson=require(_0xc37c('0x9'));var client=jayson[_0xc37c('0xa')][_0xc37c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd8f098,_0x1eaa97,_0x3c5c63){return new BPromise(function(_0x483c8d,_0x15a756){return client[_0xc37c('0xc')](_0xd8f098,_0x3c5c63)[_0xc37c('0xd')](function(_0x3526b5){logger[_0xc37c('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1eaa97,_0xc37c('0xf'));logger[_0xc37c('0x10')](_0xc37c('0x11'),_0x1eaa97,_0xc37c('0xf'),JSON[_0xc37c('0x12')](_0x3526b5));if(_0x3526b5[_0xc37c('0x13')]){if(_0x3526b5[_0xc37c('0x13')][_0xc37c('0x14')]===0x1f4){logger[_0xc37c('0x13')](_0xc37c('0x15'),_0x1eaa97,_0x3526b5[_0xc37c('0x13')]['message']);return _0x15a756(_0x3526b5['error'][_0xc37c('0x16')]);}logger[_0xc37c('0x13')](_0xc37c('0x15'),_0x1eaa97,_0x3526b5[_0xc37c('0x13')][_0xc37c('0x16')]);return _0x483c8d(_0x3526b5[_0xc37c('0x13')]['message']);}else{logger[_0xc37c('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1eaa97,_0xc37c('0xf'));_0x483c8d(_0x3526b5[_0xc37c('0x17')][_0xc37c('0x16')]);}})[_0xc37c('0x18')](function(_0x674ccf){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x1eaa97,_0x674ccf);_0x15a756(_0x674ccf);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 964aba7..9466ffc 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 _0x10db=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0x10db,0x104));var _0xb10d=function(_0x41c535,_0x51a9b5){_0x41c535=_0x41c535-0x0;var _0x3fdd01=_0x10db[_0x41c535];return _0x3fdd01;};'use strict';var multer=require(_0xb10d('0x0'));var util=require(_0xb10d('0x1'));var path=require(_0xb10d('0x2'));var timeout=require('connect-timeout');var express=require(_0xb10d('0x3'));var router=express[_0xb10d('0x4')]();var auth=require(_0xb10d('0x5'));var interaction=require(_0xb10d('0x6'));var config=require(_0xb10d('0x7'));var controller=require(_0xb10d('0x8'));router[_0xb10d('0x9')]('/',auth[_0xb10d('0xa')](),controller[_0xb10d('0xb')]);router['get'](_0xb10d('0xc'),auth[_0xb10d('0xa')](),controller[_0xb10d('0xd')]);router[_0xb10d('0xe')]('/',auth[_0xb10d('0xa')](),controller[_0xb10d('0xf')]);router[_0xb10d('0x10')]('/:id',auth[_0xb10d('0xa')](),controller['update']);router[_0xb10d('0x11')]('/:id',auth[_0xb10d('0xa')](),controller[_0xb10d('0x12')]);module[_0xb10d('0x13')]=router; \ No newline at end of file +var _0x610f=['get','index','/:id','post','create','put','isAuthenticated','update','delete','destroy','util','path','connect-timeout','Router','../../config/environment','./pause.controller'];(function(_0x407370,_0x173263){var _0x3aa8f3=function(_0x1cae61){while(--_0x1cae61){_0x407370['push'](_0x407370['shift']());}};_0x3aa8f3(++_0x173263);}(_0x610f,0x19a));var _0xf610=function(_0x58053e,_0x5c5ba3){_0x58053e=_0x58053e-0x0;var _0x50f82c=_0x610f[_0x58053e];return _0x50f82c;};'use strict';var multer=require('multer');var util=require(_0xf610('0x0'));var path=require(_0xf610('0x1'));var timeout=require(_0xf610('0x2'));var express=require('express');var router=express[_0xf610('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf610('0x4'));var controller=require(_0xf610('0x5'));router[_0xf610('0x6')]('/',auth['isAuthenticated'](),controller[_0xf610('0x7')]);router[_0xf610('0x6')](_0xf610('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xf610('0x9')]('/',auth['isAuthenticated'](),controller[_0xf610('0xa')]);router[_0xf610('0xb')]('/:id',auth[_0xf610('0xc')](),controller[_0xf610('0xd')]);router[_0xf610('0xe')]('/:id',auth[_0xf610('0xc')](),controller[_0xf610('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 89a3147..c99aa2f 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 _0x7cb8=['exports','STRING','name','sequelize'];(function(_0x1286f2,_0x3a8daa){var _0x551ce5=function(_0x18752d){while(--_0x18752d){_0x1286f2['push'](_0x1286f2['shift']());}};_0x551ce5(++_0x3a8daa);}(_0x7cb8,0x1ab));var _0x87cb=function(_0x53e630,_0x83bee4){_0x53e630=_0x53e630-0x0;var _0x5dd530=_0x7cb8[_0x53e630];return _0x5dd530;};'use strict';var Sequelize=require(_0x87cb('0x0'));module[_0x87cb('0x1')]={'name':{'type':Sequelize[_0x87cb('0x2')],'unique':_0x87cb('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x87cb('0x2')]}}; \ No newline at end of file +var _0xc2e8=['sequelize','exports','STRING','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc2e8,0xb4));var _0x8c2e=function(_0x620d02,_0x3767ec){_0x620d02=_0x620d02-0x0;var _0x5c5206=_0xc2e8[_0x620d02];return _0x5c5206;};'use strict';var Sequelize=require(_0x8c2e('0x0'));module[_0x8c2e('0x1')]={'name':{'type':Sequelize[_0x8c2e('0x2')],'unique':_0x8c2e('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x8c2e('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 8dc284c..91825f0 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 _0x89b4=['query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model'];(function(_0x5028e2,_0x19cd98){var _0x9dba59=function(_0xc7b3cb){while(--_0xc7b3cb){_0x5028e2['push'](_0x5028e2['shift']());}};_0x9dba59(++_0x19cd98);}(_0x89b4,0x70));var _0x489b=function(_0x434f5a,_0x52111e){_0x434f5a=_0x434f5a-0x0;var _0x1da4cb=_0x89b4[_0x434f5a];return _0x1da4cb;};'use strict';var pdf=require(_0x489b('0x0'));var emlformat=require(_0x489b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x489b('0x2'));var rp=require(_0x489b('0x3'));var moment=require(_0x489b('0x4'));var BPromise=require(_0x489b('0x5'));var Mustache=require(_0x489b('0x6'));var util=require(_0x489b('0x7'));var path=require(_0x489b('0x8'));var sox=require('sox');var csv=require(_0x489b('0x9'));var ejs=require(_0x489b('0xa'));var fs=require('fs');var _=require(_0x489b('0xb'));var squel=require('squel');var crypto=require(_0x489b('0xc'));var jsforce=require(_0x489b('0xd'));var deskjs=require(_0x489b('0xe'));var toCsv=require(_0x489b('0x9'));var querystring=require('querystring');var Papa=require(_0x489b('0xf'));var Redis=require(_0x489b('0x10'));var authService=require(_0x489b('0x11'));var qs=require(_0x489b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x489b('0x13'));var logger=require(_0x489b('0x14'))(_0x489b('0x15'));var utils=require(_0x489b('0x16'));var config=require(_0x489b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f0e5a,_0x1a6024){_0x1a6024=_0x1a6024||0xcc;return function(_0x20b8d9){if(_0x20b8d9){return _0x5f0e5a['sendStatus'](_0x1a6024);}return _0x5f0e5a[_0x489b('0x18')](_0x1a6024)['end']();};}function respondWithResult(_0x3a9866,_0x39979f){_0x39979f=_0x39979f||0xc8;return function(_0x8b9960){if(_0x8b9960){return _0x3a9866[_0x489b('0x18')](_0x39979f)[_0x489b('0x19')](_0x8b9960);}};}function respondWithFilteredResult(_0x484d0d,_0x4c16cc){return function(_0x564ca1){if(_0x564ca1){var _0x5f2ea6=_0x564ca1[_0x489b('0x1a')],_0x179298=_0x4c16cc[_0x489b('0x1b')],_0x3669b4=_0x4c16cc['offset']+_0x4c16cc[_0x489b('0x1c')],_0x768f7b;if(_0x3669b4>=_0x5f2ea6){_0x3669b4=_0x5f2ea6;_0x768f7b=0xc8;}else{_0x768f7b=0xce;}_0x484d0d[_0x489b('0x18')](_0x768f7b);return _0x484d0d[_0x489b('0x1d')](_0x489b('0x1e'),_0x179298+'-'+_0x3669b4+'/'+_0x5f2ea6)['json'](_0x564ca1);}return null;};}function patchUpdates(_0x39c6b8){return function(_0x123cc6){try{jsonpatch[_0x489b('0x1f')](_0x123cc6,_0x39c6b8,!![]);}catch(_0x11af5c){return BPromise[_0x489b('0x20')](_0x11af5c);}return _0x123cc6[_0x489b('0x21')]();};}function saveUpdates(_0x45c1d2,_0x866a70){return function(_0x59877c){if(_0x59877c){return _0x59877c[_0x489b('0x22')](_0x45c1d2)[_0x489b('0x23')](function(_0x309108){return _0x309108;});}return null;};}function removeEntity(_0x52fd2d,_0x28bca9){return function(_0x24c669){if(_0x24c669){return _0x24c669[_0x489b('0x24')]()[_0x489b('0x23')](function(){var _0x530165=_0x24c669[_0x489b('0x25')]({'plain':!![]});var _0x4dea74=_0x489b('0x26');return db[_0x489b('0x27')]['destroy']({'where':{'type':_0x4dea74,'resourceId':_0x530165['id']}})[_0x489b('0x23')](function(){return _0x24c669;});})['then'](function(){_0x52fd2d['status'](0xcc)[_0x489b('0x28')]();});}};}function handleEntityNotFound(_0x5e9865,_0x1939c6){return function(_0x206f60){if(!_0x206f60){_0x5e9865[_0x489b('0x29')](0x194);}return _0x206f60;};}function handleError(_0x1d9901,_0x4d6551){_0x4d6551=_0x4d6551||0x1f4;return function(_0x294a5e){logger[_0x489b('0x2a')](_0x294a5e[_0x489b('0x2b')]);if(_0x294a5e[_0x489b('0x2c')]){delete _0x294a5e['name'];}_0x1d9901['status'](_0x4d6551)[_0x489b('0x2d')](_0x294a5e);};}exports[_0x489b('0x2e')]=function(_0x5c3a99,_0x2e05a9){var _0x4b9d68={},_0x540f63={},_0x46f98c={'count':0x0,'rows':[]};var _0x217a7b=_[_0x489b('0x2f')](db[_0x489b('0x30')][_0x489b('0x31')],function(_0x511554){return{'name':_0x511554[_0x489b('0x32')],'type':_0x511554[_0x489b('0x33')][_0x489b('0x34')]};});_0x540f63[_0x489b('0x35')]=_[_0x489b('0x2f')](_0x217a7b,_0x489b('0x2c'));_0x540f63[_0x489b('0x36')]=_['keys'](_0x5c3a99[_0x489b('0x36')]);_0x540f63[_0x489b('0x37')]=_['intersection'](_0x540f63[_0x489b('0x35')],_0x540f63[_0x489b('0x36')]);_0x4b9d68['attributes']=_[_0x489b('0x38')](_0x540f63[_0x489b('0x35')],qs['fields'](_0x5c3a99[_0x489b('0x36')][_0x489b('0x39')]));_0x4b9d68[_0x489b('0x3a')]=_0x4b9d68['attributes']['length']?_0x4b9d68[_0x489b('0x3a')]:_0x540f63[_0x489b('0x35')];if(!_0x5c3a99[_0x489b('0x36')][_0x489b('0x3b')](_0x489b('0x3c'))){_0x4b9d68[_0x489b('0x1c')]=qs['limit'](_0x5c3a99[_0x489b('0x36')][_0x489b('0x1c')]);_0x4b9d68[_0x489b('0x1b')]=qs['offset'](_0x5c3a99[_0x489b('0x36')]['offset']);}_0x4b9d68[_0x489b('0x3d')]=qs[_0x489b('0x3e')](_0x5c3a99[_0x489b('0x36')]['sort']);_0x4b9d68[_0x489b('0x3f')]=qs['filters'](_[_0x489b('0x40')](_0x5c3a99[_0x489b('0x36')],_0x540f63[_0x489b('0x37')]),_0x217a7b);if(_0x5c3a99[_0x489b('0x36')][_0x489b('0x41')]){_0x4b9d68[_0x489b('0x3f')]=_['merge'](_0x4b9d68['where'],{'$or':_[_0x489b('0x2f')](_0x217a7b,function(_0x3ede42){if(_0x3ede42[_0x489b('0x33')]!=='VIRTUAL'){var _0x290f73={};_0x290f73[_0x3ede42[_0x489b('0x2c')]]={'$like':'%'+_0x5c3a99[_0x489b('0x36')][_0x489b('0x41')]+'%'};return _0x290f73;}})});}_0x4b9d68=_[_0x489b('0x42')]({},_0x4b9d68,_0x5c3a99[_0x489b('0x43')]);var _0x1811bc={'where':_0x4b9d68[_0x489b('0x3f')]};return db[_0x489b('0x30')][_0x489b('0x1a')](_0x1811bc)['then'](function(_0x5cc165){_0x46f98c[_0x489b('0x1a')]=_0x5cc165;if(_0x5c3a99[_0x489b('0x36')][_0x489b('0x44')]){_0x4b9d68[_0x489b('0x45')]=[{'all':!![]}];}return db[_0x489b('0x30')]['findAll'](_0x4b9d68);})[_0x489b('0x23')](function(_0x1c6bde){_0x46f98c['rows']=_0x1c6bde;return _0x46f98c;})[_0x489b('0x23')](respondWithFilteredResult(_0x2e05a9,_0x4b9d68))[_0x489b('0x46')](handleError(_0x2e05a9,null));};exports[_0x489b('0x47')]=function(_0x3b34f1,_0x37980e){var _0x51b9e0={'raw':!![],'where':{'id':_0x3b34f1[_0x489b('0x48')]['id']}},_0x76d0a8={};_0x76d0a8[_0x489b('0x35')]=_[_0x489b('0x49')](db['Pause'][_0x489b('0x31')]);_0x76d0a8[_0x489b('0x36')]=_['keys'](_0x3b34f1[_0x489b('0x36')]);_0x76d0a8[_0x489b('0x37')]=_[_0x489b('0x38')](_0x76d0a8[_0x489b('0x35')],_0x76d0a8[_0x489b('0x36')]);_0x51b9e0[_0x489b('0x3a')]=_[_0x489b('0x38')](_0x76d0a8['model'],qs['fields'](_0x3b34f1['query'][_0x489b('0x39')]));_0x51b9e0[_0x489b('0x3a')]=_0x51b9e0['attributes'][_0x489b('0x4a')]?_0x51b9e0['attributes']:_0x76d0a8[_0x489b('0x35')];if(_0x3b34f1['query'][_0x489b('0x44')]){_0x51b9e0[_0x489b('0x45')]=[{'all':!![]}];}_0x51b9e0=_[_0x489b('0x42')]({},_0x51b9e0,_0x3b34f1[_0x489b('0x43')]);return db['Pause'][_0x489b('0x4b')](_0x51b9e0)[_0x489b('0x23')](handleEntityNotFound(_0x37980e,null))[_0x489b('0x23')](respondWithResult(_0x37980e,null))['catch'](handleError(_0x37980e,null));};exports[_0x489b('0x4c')]=function(_0x4d63d8,_0x2a2b02){return db[_0x489b('0x30')]['create'](_0x4d63d8[_0x489b('0x4d')],{})[_0x489b('0x23')](function(_0x43a74e){var _0x42aaee=_0x4d63d8['user'][_0x489b('0x25')]({'plain':!![]});if(!_0x42aaee)throw new Error(_0x489b('0x4e'));if(_0x42aaee[_0x489b('0x4f')]===_0x489b('0x50')){var _0x5bbd87=_0x43a74e[_0x489b('0x25')]({'plain':!![]});var _0x5d0c4c=_0x489b('0x26');return db['UserProfileSection'][_0x489b('0x4b')]({'where':{'name':_0x5d0c4c,'userProfileId':_0x42aaee['userProfileId']},'raw':!![]})[_0x489b('0x23')](function(_0x4db775){if(_0x4db775&&_0x4db775[_0x489b('0x51')]===0x0){return db[_0x489b('0x27')][_0x489b('0x4c')]({'name':_0x5bbd87[_0x489b('0x2c')],'resourceId':_0x5bbd87['id'],'type':_0x4db775[_0x489b('0x2c')],'sectionId':_0x4db775['id']},{})[_0x489b('0x23')](function(){return _0x43a74e;});}else{return _0x43a74e;}})[_0x489b('0x46')](function(_0x3f5b2b){logger[_0x489b('0x2a')](_0x489b('0x52'),_0x3f5b2b);throw _0x3f5b2b;});}return _0x43a74e;})[_0x489b('0x23')](respondWithResult(_0x2a2b02,0xc9))[_0x489b('0x46')](handleError(_0x2a2b02,null));};exports[_0x489b('0x22')]=function(_0x278b03,_0x44e8de){if(_0x278b03['body']['id']){delete _0x278b03[_0x489b('0x4d')]['id'];}return db[_0x489b('0x30')]['find']({'where':{'id':_0x278b03[_0x489b('0x48')]['id']}})[_0x489b('0x23')](handleEntityNotFound(_0x44e8de,null))[_0x489b('0x23')](saveUpdates(_0x278b03['body'],null))['then'](respondWithResult(_0x44e8de,null))[_0x489b('0x46')](handleError(_0x44e8de,null));};exports[_0x489b('0x24')]=function(_0x2cc6c2,_0x5e66e9){return db[_0x489b('0x30')][_0x489b('0x4b')]({'where':{'id':_0x2cc6c2[_0x489b('0x48')]['id']}})[_0x489b('0x23')](handleEntityNotFound(_0x5e66e9,null))[_0x489b('0x23')](removeEntity(_0x5e66e9,null))[_0x489b('0x46')](handleError(_0x5e66e9,null));}; \ No newline at end of file +var _0x5f1a=['UserProfileResource','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','offset','order','sort','where','merge','filter','options','Pause','includeAll','findAll','catch','show','keys','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','html-pdf','rimraf','zip-dir','bluebird','sox','to-csv','ejs','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','count','limit','set','apply','save','then','destroy','Pauses'];(function(_0x526a46,_0x119cc9){var _0x299cab=function(_0x49722b){while(--_0x49722b){_0x526a46['push'](_0x526a46['shift']());}};_0x299cab(++_0x119cc9);}(_0x5f1a,0xbf));var _0xa5f1=function(_0xfac096,_0x4e6ad7){_0xfac096=_0xfac096-0x0;var _0x72e68e=_0x5f1a[_0xfac096];return _0x72e68e;};'use strict';var pdf=require(_0xa5f1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa5f1('0x1'));var zipdir=require(_0xa5f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa5f1('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa5f1('0x4'));var csv=require(_0xa5f1('0x5'));var ejs=require(_0xa5f1('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa5f1('0x7'));var deskjs=require(_0xa5f1('0x8'));var toCsv=require(_0xa5f1('0x5'));var querystring=require(_0xa5f1('0x9'));var Papa=require(_0xa5f1('0xa'));var Redis=require(_0xa5f1('0xb'));var authService=require(_0xa5f1('0xc'));var qs=require(_0xa5f1('0xd'));var as=require(_0xa5f1('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5f1('0xf'))('api');var utils=require(_0xa5f1('0x10'));var config=require(_0xa5f1('0x11'));var db=require(_0xa5f1('0x12'))['db'];function respondWithStatusCode(_0x35f6db,_0x6c0c25){_0x6c0c25=_0x6c0c25||0xcc;return function(_0x1e6862){if(_0x1e6862){return _0x35f6db[_0xa5f1('0x13')](_0x6c0c25);}return _0x35f6db[_0xa5f1('0x14')](_0x6c0c25)[_0xa5f1('0x15')]();};}function respondWithResult(_0x2e8c66,_0x3d7a9c){_0x3d7a9c=_0x3d7a9c||0xc8;return function(_0x3fb7a4){if(_0x3fb7a4){return _0x2e8c66[_0xa5f1('0x14')](_0x3d7a9c)[_0xa5f1('0x16')](_0x3fb7a4);}};}function respondWithFilteredResult(_0x160adf,_0x22b4a9){return function(_0xc735fa){if(_0xc735fa){var _0x6162a=_0xc735fa[_0xa5f1('0x17')],_0x129fbc=_0x22b4a9['offset'],_0x59e3c4=_0x22b4a9['offset']+_0x22b4a9[_0xa5f1('0x18')],_0x428843;if(_0x59e3c4>=_0x6162a){_0x59e3c4=_0x6162a;_0x428843=0xc8;}else{_0x428843=0xce;}_0x160adf['status'](_0x428843);return _0x160adf[_0xa5f1('0x19')]('Content-Range',_0x129fbc+'-'+_0x59e3c4+'/'+_0x6162a)[_0xa5f1('0x16')](_0xc735fa);}return null;};}function patchUpdates(_0x3f09c9){return function(_0x65c0b4){try{jsonpatch[_0xa5f1('0x1a')](_0x65c0b4,_0x3f09c9,!![]);}catch(_0x3da5af){return BPromise['reject'](_0x3da5af);}return _0x65c0b4[_0xa5f1('0x1b')]();};}function saveUpdates(_0x596e45,_0x3759d9){return function(_0x3f9102){if(_0x3f9102){return _0x3f9102['update'](_0x596e45)[_0xa5f1('0x1c')](function(_0x4671a8){return _0x4671a8;});}return null;};}function removeEntity(_0x20bc9d,_0x8a6aa9){return function(_0xe0fe5c){if(_0xe0fe5c){return _0xe0fe5c[_0xa5f1('0x1d')]()[_0xa5f1('0x1c')](function(){var _0x3f5cb9=_0xe0fe5c['get']({'plain':!![]});var _0x1359bb=_0xa5f1('0x1e');return db[_0xa5f1('0x1f')][_0xa5f1('0x1d')]({'where':{'type':_0x1359bb,'resourceId':_0x3f5cb9['id']}})[_0xa5f1('0x1c')](function(){return _0xe0fe5c;});})['then'](function(){_0x20bc9d['status'](0xcc)[_0xa5f1('0x15')]();});}};}function handleEntityNotFound(_0x4e71ce,_0x5608f9){return function(_0x3e5c0e){if(!_0x3e5c0e){_0x4e71ce['sendStatus'](0x194);}return _0x3e5c0e;};}function handleError(_0x4b564a,_0x289273){_0x289273=_0x289273||0x1f4;return function(_0x453c66){logger['error'](_0x453c66['stack']);if(_0x453c66['name']){delete _0x453c66[_0xa5f1('0x20')];}_0x4b564a[_0xa5f1('0x14')](_0x289273)[_0xa5f1('0x21')](_0x453c66);};}exports[_0xa5f1('0x22')]=function(_0x506a64,_0x400588){var _0xaff4c6={},_0x184051={},_0x4b1a26={'count':0x0,'rows':[]};var _0x2da981=_[_0xa5f1('0x23')](db['Pause'][_0xa5f1('0x24')],function(_0xd88ffe){return{'name':_0xd88ffe['fieldName'],'type':_0xd88ffe[_0xa5f1('0x25')][_0xa5f1('0x26')]};});_0x184051['model']=_[_0xa5f1('0x23')](_0x2da981,_0xa5f1('0x20'));_0x184051[_0xa5f1('0x27')]=_['keys'](_0x506a64['query']);_0x184051[_0xa5f1('0x28')]=_[_0xa5f1('0x29')](_0x184051[_0xa5f1('0x2a')],_0x184051['query']);_0xaff4c6[_0xa5f1('0x2b')]=_[_0xa5f1('0x29')](_0x184051[_0xa5f1('0x2a')],qs[_0xa5f1('0x2c')](_0x506a64['query'][_0xa5f1('0x2c')]));_0xaff4c6[_0xa5f1('0x2b')]=_0xaff4c6[_0xa5f1('0x2b')][_0xa5f1('0x2d')]?_0xaff4c6['attributes']:_0x184051[_0xa5f1('0x2a')];if(!_0x506a64[_0xa5f1('0x27')]['hasOwnProperty'](_0xa5f1('0x2e'))){_0xaff4c6[_0xa5f1('0x18')]=qs[_0xa5f1('0x18')](_0x506a64['query'][_0xa5f1('0x18')]);_0xaff4c6[_0xa5f1('0x2f')]=qs['offset'](_0x506a64['query'][_0xa5f1('0x2f')]);}_0xaff4c6[_0xa5f1('0x30')]=qs[_0xa5f1('0x31')](_0x506a64[_0xa5f1('0x27')][_0xa5f1('0x31')]);_0xaff4c6['where']=qs[_0xa5f1('0x28')](_['pick'](_0x506a64[_0xa5f1('0x27')],_0x184051[_0xa5f1('0x28')]),_0x2da981);if(_0x506a64['query']['filter']){_0xaff4c6[_0xa5f1('0x32')]=_[_0xa5f1('0x33')](_0xaff4c6[_0xa5f1('0x32')],{'$or':_[_0xa5f1('0x23')](_0x2da981,function(_0x851c9e){if(_0x851c9e[_0xa5f1('0x25')]!=='VIRTUAL'){var _0x243557={};_0x243557[_0x851c9e['name']]={'$like':'%'+_0x506a64['query'][_0xa5f1('0x34')]+'%'};return _0x243557;}})});}_0xaff4c6=_[_0xa5f1('0x33')]({},_0xaff4c6,_0x506a64[_0xa5f1('0x35')]);var _0x34a2ad={'where':_0xaff4c6[_0xa5f1('0x32')]};return db[_0xa5f1('0x36')][_0xa5f1('0x17')](_0x34a2ad)[_0xa5f1('0x1c')](function(_0xa15f08){_0x4b1a26[_0xa5f1('0x17')]=_0xa15f08;if(_0x506a64[_0xa5f1('0x27')][_0xa5f1('0x37')]){_0xaff4c6['include']=[{'all':!![]}];}return db['Pause'][_0xa5f1('0x38')](_0xaff4c6);})['then'](function(_0x398c17){_0x4b1a26['rows']=_0x398c17;return _0x4b1a26;})['then'](respondWithFilteredResult(_0x400588,_0xaff4c6))[_0xa5f1('0x39')](handleError(_0x400588,null));};exports[_0xa5f1('0x3a')]=function(_0x590f2b,_0x501944){var _0x4432be={'raw':!![],'where':{'id':_0x590f2b['params']['id']}},_0x5ba153={};_0x5ba153['model']=_[_0xa5f1('0x3b')](db[_0xa5f1('0x36')][_0xa5f1('0x24')]);_0x5ba153['query']=_[_0xa5f1('0x3b')](_0x590f2b[_0xa5f1('0x27')]);_0x5ba153['filters']=_[_0xa5f1('0x29')](_0x5ba153[_0xa5f1('0x2a')],_0x5ba153['query']);_0x4432be['attributes']=_[_0xa5f1('0x29')](_0x5ba153[_0xa5f1('0x2a')],qs[_0xa5f1('0x2c')](_0x590f2b['query'][_0xa5f1('0x2c')]));_0x4432be[_0xa5f1('0x2b')]=_0x4432be[_0xa5f1('0x2b')][_0xa5f1('0x2d')]?_0x4432be['attributes']:_0x5ba153[_0xa5f1('0x2a')];if(_0x590f2b[_0xa5f1('0x27')][_0xa5f1('0x37')]){_0x4432be[_0xa5f1('0x3c')]=[{'all':!![]}];}_0x4432be=_[_0xa5f1('0x33')]({},_0x4432be,_0x590f2b[_0xa5f1('0x35')]);return db[_0xa5f1('0x36')][_0xa5f1('0x3d')](_0x4432be)['then'](handleEntityNotFound(_0x501944,null))[_0xa5f1('0x1c')](respondWithResult(_0x501944,null))[_0xa5f1('0x39')](handleError(_0x501944,null));};exports[_0xa5f1('0x3e')]=function(_0x227a7c,_0x5caceb){return db[_0xa5f1('0x36')][_0xa5f1('0x3e')](_0x227a7c['body'],{})[_0xa5f1('0x1c')](function(_0x41d35e){var _0x2ffe2d=_0x227a7c[_0xa5f1('0x3f')][_0xa5f1('0x40')]({'plain':!![]});if(!_0x2ffe2d)throw new Error(_0xa5f1('0x41'));if(_0x2ffe2d[_0xa5f1('0x42')]===_0xa5f1('0x3f')){var _0x4e636d=_0x41d35e[_0xa5f1('0x40')]({'plain':!![]});var _0xdfb4da=_0xa5f1('0x1e');return db['UserProfileSection'][_0xa5f1('0x3d')]({'where':{'name':_0xdfb4da,'userProfileId':_0x2ffe2d[_0xa5f1('0x43')]},'raw':!![]})[_0xa5f1('0x1c')](function(_0x4281a2){if(_0x4281a2&&_0x4281a2[_0xa5f1('0x44')]===0x0){return db[_0xa5f1('0x1f')][_0xa5f1('0x3e')]({'name':_0x4e636d[_0xa5f1('0x20')],'resourceId':_0x4e636d['id'],'type':_0x4281a2['name'],'sectionId':_0x4281a2['id']},{})[_0xa5f1('0x1c')](function(){return _0x41d35e;});}else{return _0x41d35e;}})[_0xa5f1('0x39')](function(_0x219b23){logger[_0xa5f1('0x45')](_0xa5f1('0x46'),_0x219b23);throw _0x219b23;});}return _0x41d35e;})[_0xa5f1('0x1c')](respondWithResult(_0x5caceb,0xc9))['catch'](handleError(_0x5caceb,null));};exports[_0xa5f1('0x47')]=function(_0x3b7e3f,_0x384489){if(_0x3b7e3f['body']['id']){delete _0x3b7e3f[_0xa5f1('0x48')]['id'];}return db['Pause']['find']({'where':{'id':_0x3b7e3f[_0xa5f1('0x49')]['id']}})[_0xa5f1('0x1c')](handleEntityNotFound(_0x384489,null))[_0xa5f1('0x1c')](saveUpdates(_0x3b7e3f[_0xa5f1('0x48')],null))[_0xa5f1('0x1c')](respondWithResult(_0x384489,null))[_0xa5f1('0x39')](handleError(_0x384489,null));};exports[_0xa5f1('0x1d')]=function(_0x3b0746,_0x261139){return db[_0xa5f1('0x36')]['find']({'where':{'id':_0x3b0746['params']['id']}})[_0xa5f1('0x1c')](handleEntityNotFound(_0x261139,null))[_0xa5f1('0x1c')](removeEntity(_0x261139,null))[_0xa5f1('0x39')](handleError(_0x261139,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 3695661..5891eca 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 _0x984b=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes','exports','Pause','tools_pauses','lodash'];(function(_0x26bdc6,_0x5d5f6d){var _0x597736=function(_0x100727){while(--_0x100727){_0x26bdc6['push'](_0x26bdc6['shift']());}};_0x597736(++_0x5d5f6d);}(_0x984b,0x137));var _0xb984=function(_0x31b96c,_0x436a1b){_0x31b96c=_0x31b96c-0x0;var _0x5576ae=_0x984b[_0x31b96c];return _0x5576ae;};'use strict';var _=require(_0xb984('0x0'));var util=require(_0xb984('0x1'));var logger=require(_0xb984('0x2'))(_0xb984('0x3'));var moment=require(_0xb984('0x4'));var BPromise=require(_0xb984('0x5'));var rp=require(_0xb984('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb984('0x7'));var config=require(_0xb984('0x8'));var attributes=require(_0xb984('0x9'));module[_0xb984('0xa')]=function(_0x3fae6a,_0x250515){return _0x3fae6a['define'](_0xb984('0xb'),attributes,{'tableName':_0xb984('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x253c=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util'];(function(_0x40a823,_0x3d3b66){var _0x2a12a2=function(_0x599254){while(--_0x599254){_0x40a823['push'](_0x40a823['shift']());}};_0x2a12a2(++_0x3d3b66);}(_0x253c,0x129));var _0xc253=function(_0x40a0a4,_0x5d30d0){_0x40a0a4=_0x40a0a4-0x0;var _0x50cc17=_0x253c[_0x40a0a4];return _0x50cc17;};'use strict';var _=require(_0xc253('0x0'));var util=require(_0xc253('0x1'));var logger=require('../../config/logger')(_0xc253('0x2'));var moment=require(_0xc253('0x3'));var BPromise=require(_0xc253('0x4'));var rp=require(_0xc253('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc253('0x6'));var config=require(_0xc253('0x7'));var attributes=require(_0xc253('0x8'));module[_0xc253('0x9')]=function(_0x6bd56e,_0x12cd0d){return _0x6bd56e[_0xc253('0xa')](_0xc253('0xb'),attributes,{'tableName':_0xc253('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 fc6ac15..107f056 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 _0x63ea=['Pause,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','ShowPause','Pause','options','raw','where','attributes','include','map','model','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x1b50fc,_0x42fb96){var _0x5934be=function(_0x5168b4){while(--_0x5168b4){_0x1b50fc['push'](_0x1b50fc['shift']());}};_0x5934be(++_0x42fb96);}(_0x63ea,0x15b));var _0xa63e=function(_0x251c02,_0x2eb35d){_0x251c02=_0x251c02-0x0;var _0xc2e862=_0x63ea[_0x251c02];return _0xc2e862;};'use strict';var _=require(_0xa63e('0x0'));var util=require(_0xa63e('0x1'));var moment=require(_0xa63e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa63e('0x3'))['db'];var utils=require(_0xa63e('0x4'));var logger=require(_0xa63e('0x5'))(_0xa63e('0x6'));var config=require(_0xa63e('0x7'));var jayson=require(_0xa63e('0x8'));var client=jayson[_0xa63e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f0294,_0x49df26,_0x1c509f){return new BPromise(function(_0x3d91ca,_0x536930){return client[_0xa63e('0xa')](_0x1f0294,_0x1c509f)[_0xa63e('0xb')](function(_0x51f4db){logger[_0xa63e('0xc')](_0xa63e('0xd'),_0x49df26,_0xa63e('0xe'));logger[_0xa63e('0xf')]('Pause,\x20%s,\x20%s,\x20%s',_0x49df26,_0xa63e('0xe'),JSON[_0xa63e('0x10')](_0x51f4db));if(_0x51f4db[_0xa63e('0x11')]){if(_0x51f4db[_0xa63e('0x11')]['code']===0x1f4){logger[_0xa63e('0x11')](_0xa63e('0xd'),_0x49df26,_0x51f4db[_0xa63e('0x11')][_0xa63e('0x12')]);return _0x536930(_0x51f4db[_0xa63e('0x11')][_0xa63e('0x12')]);}logger[_0xa63e('0x11')](_0xa63e('0xd'),_0x49df26,_0x51f4db[_0xa63e('0x11')][_0xa63e('0x12')]);return _0x3d91ca(_0x51f4db[_0xa63e('0x11')][_0xa63e('0x12')]);}else{logger[_0xa63e('0xc')](_0xa63e('0xd'),_0x49df26,_0xa63e('0xe'));_0x3d91ca(_0x51f4db[_0xa63e('0x13')][_0xa63e('0x12')]);}})[_0xa63e('0x14')](function(_0x1aad10){logger['error'](_0xa63e('0xd'),_0x49df26,_0x1aad10);_0x536930(_0x1aad10);});});}exports[_0xa63e('0x15')]=function(_0x2d7e16){var _0x54b93c=this;return new Promise(function(_0x5402d3,_0x3f86ce){return db[_0xa63e('0x16')]['find']({'raw':_0x2d7e16['options']?_0x2d7e16[_0xa63e('0x17')][_0xa63e('0x18')]===undefined?!![]:![]:!![],'where':_0x2d7e16[_0xa63e('0x17')]?_0x2d7e16[_0xa63e('0x17')][_0xa63e('0x19')]||null:null,'attributes':_0x2d7e16[_0xa63e('0x17')]?_0x2d7e16[_0xa63e('0x17')][_0xa63e('0x1a')]||null:null,'include':_0x2d7e16[_0xa63e('0x17')]?_0x2d7e16['options'][_0xa63e('0x1b')]?_[_0xa63e('0x1c')](_0x2d7e16[_0xa63e('0x17')]['include'],function(_0x476cf9){return{'model':db[_0x476cf9[_0xa63e('0x1d')]],'as':_0x476cf9['as'],'attributes':_0x476cf9[_0xa63e('0x1a')],'include':_0x476cf9[_0xa63e('0x1b')]?_[_0xa63e('0x1c')](_0x476cf9[_0xa63e('0x1b')],function(_0x1ef862){return{'model':db[_0x1ef862[_0xa63e('0x1d')]],'as':_0x1ef862['as'],'attributes':_0x1ef862[_0xa63e('0x1a')],'include':_0x1ef862[_0xa63e('0x1b')]?_[_0xa63e('0x1c')](_0x1ef862[_0xa63e('0x1b')],function(_0x169b36){return{'model':db[_0x169b36[_0xa63e('0x1d')]],'as':_0x169b36['as'],'attributes':_0x169b36['attributes']};}):[]};}):[]};}):[]:[]})[_0xa63e('0xb')](function(_0x3dd082){logger[_0xa63e('0xc')](_0xa63e('0x15'),_0x2d7e16);logger[_0xa63e('0xf')](_0xa63e('0x15'),_0x2d7e16,JSON[_0xa63e('0x10')](_0x3dd082));_0x5402d3(_0x3dd082);})['catch'](function(_0x4cdc56){logger[_0xa63e('0x11')]('ShowPause',_0x4cdc56['message'],_0x2d7e16);_0x3f86ce(_0x54b93c[_0xa63e('0x11')](0x1f4,_0x4cdc56[_0xa63e('0x12')]));});});}; \ No newline at end of file +var _0x36f4=['../../config/environment','jayson/promise','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowPause','Pause','options','raw','where','attributes','include','map','model','stringify','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x198643,_0x499312){var _0x1a6aa6=function(_0x486858){while(--_0x486858){_0x198643['push'](_0x198643['shift']());}};_0x1a6aa6(++_0x499312);}(_0x36f4,0xb3));var _0x436f=function(_0x41b8b2,_0x3c819e){_0x41b8b2=_0x41b8b2-0x0;var _0x16a168=_0x36f4[_0x41b8b2];return _0x16a168;};'use strict';var _=require('lodash');var util=require(_0x436f('0x0'));var moment=require(_0x436f('0x1'));var BPromise=require(_0x436f('0x2'));var rs=require(_0x436f('0x3'));var fs=require('fs');var Redis=require(_0x436f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x436f('0x5'))(_0x436f('0x6'));var config=require(_0x436f('0x7'));var jayson=require(_0x436f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d27a2,_0x58fae8,_0x374425){return new BPromise(function(_0x5cd749,_0xd56d48){return client[_0x436f('0x9')](_0x1d27a2,_0x374425)[_0x436f('0xa')](function(_0x3dab1c){logger[_0x436f('0xb')](_0x436f('0xc'),_0x58fae8,_0x436f('0xd'));logger[_0x436f('0xe')](_0x436f('0xf'),_0x58fae8,_0x436f('0xd'),JSON['stringify'](_0x3dab1c));if(_0x3dab1c[_0x436f('0x10')]){if(_0x3dab1c[_0x436f('0x10')][_0x436f('0x11')]===0x1f4){logger[_0x436f('0x10')](_0x436f('0xc'),_0x58fae8,_0x3dab1c[_0x436f('0x10')][_0x436f('0x12')]);return _0xd56d48(_0x3dab1c[_0x436f('0x10')][_0x436f('0x12')]);}logger[_0x436f('0x10')]('Pause,\x20%s,\x20%s',_0x58fae8,_0x3dab1c['error'][_0x436f('0x12')]);return _0x5cd749(_0x3dab1c[_0x436f('0x10')][_0x436f('0x12')]);}else{logger[_0x436f('0xb')]('Pause,\x20%s,\x20%s',_0x58fae8,'request\x20sent');_0x5cd749(_0x3dab1c[_0x436f('0x13')]['message']);}})[_0x436f('0x14')](function(_0x5b55b5){logger[_0x436f('0x10')](_0x436f('0xc'),_0x58fae8,_0x5b55b5);_0xd56d48(_0x5b55b5);});});}exports[_0x436f('0x15')]=function(_0x3185a7){var _0xe426bd=this;return new Promise(function(_0x29399c,_0x1f7460){return db[_0x436f('0x16')]['find']({'raw':_0x3185a7[_0x436f('0x17')]?_0x3185a7[_0x436f('0x17')][_0x436f('0x18')]===undefined?!![]:![]:!![],'where':_0x3185a7[_0x436f('0x17')]?_0x3185a7[_0x436f('0x17')][_0x436f('0x19')]||null:null,'attributes':_0x3185a7[_0x436f('0x17')]?_0x3185a7['options'][_0x436f('0x1a')]||null:null,'include':_0x3185a7[_0x436f('0x17')]?_0x3185a7[_0x436f('0x17')][_0x436f('0x1b')]?_[_0x436f('0x1c')](_0x3185a7[_0x436f('0x17')][_0x436f('0x1b')],function(_0x14fa91){return{'model':db[_0x14fa91['model']],'as':_0x14fa91['as'],'attributes':_0x14fa91[_0x436f('0x1a')],'include':_0x14fa91['include']?_[_0x436f('0x1c')](_0x14fa91[_0x436f('0x1b')],function(_0x1ccaba){return{'model':db[_0x1ccaba[_0x436f('0x1d')]],'as':_0x1ccaba['as'],'attributes':_0x1ccaba[_0x436f('0x1a')],'include':_0x1ccaba[_0x436f('0x1b')]?_[_0x436f('0x1c')](_0x1ccaba[_0x436f('0x1b')],function(_0x118d3a){return{'model':db[_0x118d3a[_0x436f('0x1d')]],'as':_0x118d3a['as'],'attributes':_0x118d3a[_0x436f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14710a){logger['info'](_0x436f('0x15'),_0x3185a7);logger[_0x436f('0xe')](_0x436f('0x15'),_0x3185a7,JSON[_0x436f('0x1e')](_0x14710a));_0x29399c(_0x14710a);})[_0x436f('0x14')](function(_0x11cc89){logger[_0x436f('0x10')]('ShowPause',_0x11cc89['message'],_0x3185a7);_0x1f7460(_0xe426bd[_0x436f('0x10')](0x1f4,_0x11cc89[_0x436f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 8e7b456..df1452d 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 _0x9278=['join','root','server/files/plugins','originalname','replace','format','basename','now','extname','post','single','file','upload','webhookPost','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','show','/:id/download','isAuthenticated','download','diskStorage'];(function(_0xbf727d,_0x49ecf9){var _0x37f1bb=function(_0x3f07a2){while(--_0x3f07a2){_0xbf727d['push'](_0xbf727d['shift']());}};_0x37f1bb(++_0x49ecf9);}(_0x9278,0x155));var _0x8927=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9278[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0x8927('0x0'));var path=require(_0x8927('0x1'));var timeout=require(_0x8927('0x2'));var express=require(_0x8927('0x3'));var router=express[_0x8927('0x4')]();var auth=require(_0x8927('0x5'));var interaction=require(_0x8927('0x6'));var config=require(_0x8927('0x7'));var controller=require(_0x8927('0x8'));router[_0x8927('0x9')]('/',auth['isAuthenticated'](),controller[_0x8927('0xa')]);router['get'](_0x8927('0xb'),controller[_0x8927('0xc')]);router['get'](_0x8927('0xd'),auth['isAuthenticated'](),controller[_0x8927('0xe')]);router[_0x8927('0x9')](_0x8927('0xf'),auth[_0x8927('0x10')](),controller[_0x8927('0x11')]);var upload=multer({'storage':multer[_0x8927('0x12')]({'destination':function(_0x535a8a,_0x5c0524,_0x30ac59){_0x30ac59(null,path[_0x8927('0x13')](config[_0x8927('0x14')],_0x8927('0x15')));},'filename':function(_0x1bdbc0,_0x53aad4,_0x414e93){_0x53aad4[_0x8927('0x16')]=_0x53aad4[_0x8927('0x16')][_0x8927('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x414e93(null,util[_0x8927('0x18')]('%s-%s%s',path[_0x8927('0x19')](_0x53aad4[_0x8927('0x16')],path['extname'](_0x53aad4[_0x8927('0x16')])),Date[_0x8927('0x1a')](),path[_0x8927('0x1b')](_0x53aad4[_0x8927('0x16')])));}})});router[_0x8927('0x1c')]('/',upload[_0x8927('0x1d')](_0x8927('0x1e')),controller[_0x8927('0x1f')]);router['post']('/webhook',controller[_0x8927('0x20')]);router['put'](_0x8927('0xd'),auth['isAuthenticated'](),controller[_0x8927('0x21')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8927('0x22')]);module[_0x8927('0x23')]=router; \ No newline at end of file +var _0xc82c=['/:id','show','/:id/download','download','diskStorage','join','originalname','replace','%s-%s%s','extname','post','single','file','upload','put','delete','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/webhook','webhookGet'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0xc82c,0x11e));var _0xcc82=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc82c[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xcc82('0x0'));var path=require(_0xcc82('0x1'));var timeout=require(_0xcc82('0x2'));var express=require(_0xcc82('0x3'));var router=express['Router']();var auth=require(_0xcc82('0x4'));var interaction=require(_0xcc82('0x5'));var config=require(_0xcc82('0x6'));var controller=require('./plugin.controller');router['get']('/',auth[_0xcc82('0x7')](),controller['index']);router[_0xcc82('0x8')](_0xcc82('0x9'),controller[_0xcc82('0xa')]);router['get'](_0xcc82('0xb'),auth[_0xcc82('0x7')](),controller[_0xcc82('0xc')]);router[_0xcc82('0x8')](_0xcc82('0xd'),auth[_0xcc82('0x7')](),controller[_0xcc82('0xe')]);var upload=multer({'storage':multer[_0xcc82('0xf')]({'destination':function(_0x3d30b8,_0x1ba5f6,_0x26be6c){_0x26be6c(null,path[_0xcc82('0x10')](config['root'],'server/files/plugins'));},'filename':function(_0x44c349,_0x161938,_0x4d892d){_0x161938['originalname']=_0x161938[_0xcc82('0x11')][_0xcc82('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4d892d(null,util['format'](_0xcc82('0x13'),path['basename'](_0x161938['originalname'],path[_0xcc82('0x14')](_0x161938[_0xcc82('0x11')])),Date['now'](),path['extname'](_0x161938['originalname'])));}})});router[_0xcc82('0x15')]('/',upload[_0xcc82('0x16')](_0xcc82('0x17')),controller[_0xcc82('0x18')]);router['post']('/webhook',controller['webhookPost']);router[_0xcc82('0x19')]('/:id',auth[_0xcc82('0x7')](),controller['update']);router[_0xcc82('0x1a')]('/:id',auth[_0xcc82('0x7')](),controller[_0xcc82('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 842bce0..e7c43ba 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 _0xcfe5=['BOOLEAN','ENUM','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x57a8e7,_0x1e576d){var _0x4ee93a=function(_0x2d5f8b){while(--_0x2d5f8b){_0x57a8e7['push'](_0x57a8e7['shift']());}};_0x4ee93a(++_0x1e576d);}(_0xcfe5,0x1c9));var _0x5cfe=function(_0x54613d,_0x4b8872){_0x54613d=_0x54613d-0x0;var _0x11c35b=_0xcfe5[_0x54613d];return _0x11c35b;};'use strict';var Sequelize=require(_0x5cfe('0x0'));module[_0x5cfe('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('html','script')},'description':{'type':Sequelize[_0x5cfe('0x2')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x5cfe('0x3')],'comment':_0x5cfe('0x4')},'active':{'type':Sequelize[_0x5cfe('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x5cfe('0x6')]('adminOnly',_0x5cfe('0x7'),'always',_0x5cfe('0x8')),'defaultValue':_0x5cfe('0x9'),'comment':_0x5cfe('0xa')},'icon':{'type':Sequelize[_0x5cfe('0x3')]},'adminUrl':{'type':Sequelize[_0x5cfe('0x3')]},'agentUrl':{'type':Sequelize[_0x5cfe('0x3')]},'scriptName':{'type':Sequelize[_0x5cfe('0x3')]},'scriptPath':{'type':Sequelize[_0x5cfe('0x3')]}}; \ No newline at end of file +var _0x0a6d=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','script','TEXT','STRING'];(function(_0x28cac9,_0x221757){var _0x26035a=function(_0x5d111e){while(--_0x5d111e){_0x28cac9['push'](_0x28cac9['shift']());}};_0x26035a(++_0x221757);}(_0x0a6d,0xd1));var _0xd0a6=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x0a6d[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require(_0xd0a6('0x0'));module[_0xd0a6('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd0a6('0x2')](_0xd0a6('0x3'),_0xd0a6('0x4'))},'description':{'type':Sequelize[_0xd0a6('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xd0a6('0x6')],'comment':_0xd0a6('0x7')},'active':{'type':Sequelize[_0xd0a6('0x8')],'defaultValue':0x0,'comment':_0xd0a6('0x9')},'sidebar':{'type':Sequelize[_0xd0a6('0x2')]('adminOnly','agentOnly','always',_0xd0a6('0xa')),'defaultValue':'always','comment':_0xd0a6('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xd0a6('0x6')]},'agentUrl':{'type':Sequelize[_0xd0a6('0x6')]},'scriptName':{'type':Sequelize[_0xd0a6('0x6')]},'scriptPath':{'type':Sequelize[_0xd0a6('0x6')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 98d4a2f..3ba9744 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 _0x90c0=['path','join','root','server/files/plugins','format','%s.zip','basename','zip','warning','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','params','delete','dirname','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','./plugin.socket','register','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','end','stack','name','send','index','map','Plugin','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','catch','show','find','download'];(function(_0x165e91,_0x2cce67){var _0x1dc256=function(_0x1a45cb){while(--_0x1a45cb){_0x165e91['push'](_0x165e91['shift']());}};_0x1dc256(++_0x2cce67);}(_0x90c0,0x1b2));var _0x090c=function(_0x48cb1f,_0x5ca68d){_0x48cb1f=_0x48cb1f-0x0;var _0x172c4d=_0x90c0[_0x48cb1f];return _0x172c4d;};'use strict';var pdf=require(_0x090c('0x0'));var emlformat=require(_0x090c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x090c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x090c('0x3'));var moment=require(_0x090c('0x4'));var BPromise=require(_0x090c('0x5'));var Mustache=require(_0x090c('0x6'));var util=require(_0x090c('0x7'));var path=require('path');var sox=require(_0x090c('0x8'));var csv=require(_0x090c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x090c('0xa'));var squel=require('squel');var crypto=require(_0x090c('0xb'));var jsforce=require(_0x090c('0xc'));var deskjs=require(_0x090c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x090c('0xe'));var Papa=require('papaparse');var extract=require(_0x090c('0xf'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x090c('0x10'));var authService=require(_0x090c('0x11'));var qs=require(_0x090c('0x12'));var as=require(_0x090c('0x13'));var hardwareService=require(_0x090c('0x14'));var logger=require(_0x090c('0x15'))(_0x090c('0x16'));var utils=require(_0x090c('0x17'));var config=require('../../config/environment');var db=require(_0x090c('0x18'))['db'];config['redis']=_[_0x090c('0x19')](config[_0x090c('0x1a')],{'host':_0x090c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x090c('0x1a')]));require(_0x090c('0x1c'))[_0x090c('0x1d')](socket);function respondWithStatusCode(_0xb647a0,_0x3f0245){_0x3f0245=_0x3f0245||0xcc;return function(_0x216da1){if(_0x216da1){return _0xb647a0[_0x090c('0x1e')](_0x3f0245);}return _0xb647a0[_0x090c('0x1f')](_0x3f0245)['end']();};}function respondWithResult(_0x2978a2,_0x826c63){_0x826c63=_0x826c63||0xc8;return function(_0x162027){if(_0x162027){return _0x2978a2[_0x090c('0x1f')](_0x826c63)[_0x090c('0x20')](_0x162027);}};}function respondWithFilteredResult(_0xd59343,_0x2d0750){return function(_0x43ec3f){if(_0x43ec3f){var _0x1bb6df=_0x43ec3f[_0x090c('0x21')],_0x6ee851=_0x2d0750[_0x090c('0x22')],_0x4c103e=_0x2d0750['offset']+_0x2d0750['limit'],_0x35b850;if(_0x4c103e>=_0x1bb6df){_0x4c103e=_0x1bb6df;_0x35b850=0xc8;}else{_0x35b850=0xce;}_0xd59343[_0x090c('0x1f')](_0x35b850);return _0xd59343['set'](_0x090c('0x23'),_0x6ee851+'-'+_0x4c103e+'/'+_0x1bb6df)[_0x090c('0x20')](_0x43ec3f);}return null;};}function patchUpdates(_0x15d322){return function(_0x36b92b){try{jsonpatch[_0x090c('0x24')](_0x36b92b,_0x15d322,!![]);}catch(_0x4b06ca){return BPromise[_0x090c('0x25')](_0x4b06ca);}return _0x36b92b[_0x090c('0x26')]();};}function saveUpdates(_0x52bfe1,_0x59d743){return function(_0x254fba){if(_0x254fba){return _0x254fba[_0x090c('0x27')](_0x52bfe1)[_0x090c('0x28')](function(_0x1a90a6){return _0x1a90a6;});}return null;};}function removeEntity(_0xe56251,_0x3f42b0){return function(_0x244555){if(_0x244555){return _0x244555[_0x090c('0x29')]()[_0x090c('0x28')](function(){var _0x51c6a7=_0x244555[_0x090c('0x2a')]({'plain':!![]});var _0x3a78cb=_0x090c('0x2b');return db[_0x090c('0x2c')][_0x090c('0x29')]({'where':{'type':_0x3a78cb,'resourceId':_0x51c6a7['id']}})[_0x090c('0x28')](function(){return _0x244555;});})['then'](function(){_0xe56251['status'](0xcc)[_0x090c('0x2d')]();});}};}function handleEntityNotFound(_0x58824e,_0x2fbc10){return function(_0x313d86){if(!_0x313d86){_0x58824e[_0x090c('0x1e')](0x194);}return _0x313d86;};}function handleError(_0x4ba3f4,_0x120015){_0x120015=_0x120015||0x1f4;return function(_0x2a87f5){logger['error'](_0x2a87f5[_0x090c('0x2e')]);if(_0x2a87f5[_0x090c('0x2f')]){delete _0x2a87f5[_0x090c('0x2f')];}_0x4ba3f4[_0x090c('0x1f')](_0x120015)[_0x090c('0x30')](_0x2a87f5);};}exports[_0x090c('0x31')]=function(_0x5e9054,_0x26ac42){var _0x26b8ba={},_0x2c2ad2={},_0x2a5157={'count':0x0,'rows':[]};var _0x3f94f9=_[_0x090c('0x32')](db[_0x090c('0x33')][_0x090c('0x34')],function(_0x506ab3){return{'name':_0x506ab3[_0x090c('0x35')],'type':_0x506ab3['type'][_0x090c('0x36')]};});_0x2c2ad2[_0x090c('0x37')]=_[_0x090c('0x32')](_0x3f94f9,_0x090c('0x2f'));_0x2c2ad2['query']=_[_0x090c('0x38')](_0x5e9054[_0x090c('0x39')]);_0x2c2ad2[_0x090c('0x3a')]=_[_0x090c('0x3b')](_0x2c2ad2['model'],_0x2c2ad2[_0x090c('0x39')]);_0x26b8ba['attributes']=_[_0x090c('0x3b')](_0x2c2ad2[_0x090c('0x37')],qs[_0x090c('0x3c')](_0x5e9054[_0x090c('0x39')][_0x090c('0x3c')]));_0x26b8ba['attributes']=_0x26b8ba[_0x090c('0x3d')][_0x090c('0x3e')]?_0x26b8ba[_0x090c('0x3d')]:_0x2c2ad2[_0x090c('0x37')];if(!_0x5e9054[_0x090c('0x39')]['hasOwnProperty'](_0x090c('0x3f'))){_0x26b8ba['limit']=qs['limit'](_0x5e9054[_0x090c('0x39')]['limit']);_0x26b8ba['offset']=qs[_0x090c('0x22')](_0x5e9054[_0x090c('0x39')][_0x090c('0x22')]);}_0x26b8ba[_0x090c('0x40')]=qs['sort'](_0x5e9054['query']['sort']);_0x26b8ba['where']=qs['filters'](_[_0x090c('0x41')](_0x5e9054['query'],_0x2c2ad2['filters']),_0x3f94f9);if(_0x5e9054[_0x090c('0x39')][_0x090c('0x42')]){_0x26b8ba['where']=_[_0x090c('0x43')](_0x26b8ba[_0x090c('0x44')],{'$or':_[_0x090c('0x32')](_0x3f94f9,function(_0x3bc749){if(_0x3bc749[_0x090c('0x45')]!==_0x090c('0x46')){var _0x13527c={};_0x13527c[_0x3bc749[_0x090c('0x2f')]]={'$like':'%'+_0x5e9054[_0x090c('0x39')]['filter']+'%'};return _0x13527c;}})});}_0x26b8ba=_[_0x090c('0x43')]({},_0x26b8ba,_0x5e9054[_0x090c('0x47')]);var _0x59ad99={'where':_0x26b8ba[_0x090c('0x44')]};return db[_0x090c('0x33')][_0x090c('0x21')](_0x59ad99)[_0x090c('0x28')](function(_0x3f9f78){_0x2a5157[_0x090c('0x21')]=_0x3f9f78;if(_0x5e9054['query'][_0x090c('0x48')]){_0x26b8ba[_0x090c('0x49')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x26b8ba);})[_0x090c('0x28')](function(_0x5313f6){_0x2a5157[_0x090c('0x4a')]=_0x5313f6;return _0x2a5157;})['then'](respondWithFilteredResult(_0x26ac42,_0x26b8ba))[_0x090c('0x4b')](handleError(_0x26ac42,null));};exports[_0x090c('0x4c')]=function(_0x326124,_0xc79519){var _0x54ce70={'raw':!![],'where':{'id':_0x326124['params']['id']}},_0x1ca838={};_0x1ca838[_0x090c('0x37')]=_[_0x090c('0x38')](db[_0x090c('0x33')][_0x090c('0x34')]);_0x1ca838[_0x090c('0x39')]=_[_0x090c('0x38')](_0x326124[_0x090c('0x39')]);_0x1ca838[_0x090c('0x3a')]=_[_0x090c('0x3b')](_0x1ca838['model'],_0x1ca838[_0x090c('0x39')]);_0x54ce70['attributes']=_[_0x090c('0x3b')](_0x1ca838['model'],qs['fields'](_0x326124[_0x090c('0x39')][_0x090c('0x3c')]));_0x54ce70[_0x090c('0x3d')]=_0x54ce70['attributes']['length']?_0x54ce70['attributes']:_0x1ca838[_0x090c('0x37')];if(_0x326124[_0x090c('0x39')][_0x090c('0x48')]){_0x54ce70['include']=[{'all':!![]}];}_0x54ce70=_['merge']({},_0x54ce70,_0x326124[_0x090c('0x47')]);return db[_0x090c('0x33')][_0x090c('0x4d')](_0x54ce70)['then'](handleEntityNotFound(_0xc79519,null))[_0x090c('0x28')](respondWithResult(_0xc79519,null))[_0x090c('0x4b')](handleError(_0xc79519,null));};exports[_0x090c('0x4e')]=function(_0x55a26d,_0x2a3740,_0x572abb){return db[_0x090c('0x33')][_0x090c('0x4d')]({'where':{'id':_0x55a26d['params']['id']},'attributes':['name',_0x090c('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x2a3740,null))['then'](function(_0x3621b3){if(_0x3621b3){var _0x3181e5=path[_0x090c('0x50')](config[_0x090c('0x51')],_0x090c('0x52'),util[_0x090c('0x53')](_0x090c('0x54'),path[_0x090c('0x55')](_0x3621b3['path'])));var _0x3d5ffb=fs['createWriteStream'](_0x3181e5);var _0x274d54=archiver(_0x090c('0x56'),{'zlib':{'level':0x9}});_0x274d54['on'](_0x090c('0x57'),function(_0x3264a9){if(_0x3264a9['code']==='ENOENT'){logger[_0x090c('0x58')](_0x3264a9);}else{throw new db[(_0x090c('0x59'))][(_0x090c('0x5a'))](_0x090c('0x5b'));}});_0x274d54['on'](_0x090c('0x58'),function(_0x187e0f){throw new db[(_0x090c('0x59'))][(_0x090c('0x5a'))](_0x090c('0x5b'));});_0x274d54[_0x090c('0x5c')](_0x3d5ffb);_0x274d54['glob'](_0x090c('0x5d'),{'cwd':path[_0x090c('0x50')](config[_0x090c('0x51')],'server/files/plugins',path['dirname'](_0x3621b3[_0x090c('0x4f')])),'ignore':[path[_0x090c('0x50')](path['basename'](_0x3621b3[_0x090c('0x4f')]),_0x090c('0x5e')),path[_0x090c('0x50')](path['basename'](_0x3621b3[_0x090c('0x4f')]),_0x090c('0x5f'))],'nodir':!![]})[_0x090c('0x60')]();_0x3d5ffb['on'](_0x090c('0x61'),function(){if(!fs[_0x090c('0x62')](_0x3181e5)){throw new db['Sequelize']['Error'](_0x090c('0x63'));}return _0x2a3740['download'](_0x3181e5,util[_0x090c('0x53')](_0x090c('0x54'),path[_0x090c('0x55')](_0x3621b3[_0x090c('0x4f')])),function(_0x33d2ac){if(_0x33d2ac){throw new db[(_0x090c('0x59'))][(_0x090c('0x5a'))](_0x090c('0x64'));}fs[_0x090c('0x65')](_0x3181e5);logger[_0x090c('0x66')](_0x090c('0x67'));logger['info'](_0x090c('0x68'));});});}return null;})['catch'](handleError(_0x2a3740,null));};exports[_0x090c('0x69')]=function(_0x1b058c,_0x5353f1,_0x1d145d){var _0x28bf43=path[_0x090c('0x55')](_0x1b058c[_0x090c('0x6a')]['filename'],path[_0x090c('0x6b')](_0x1b058c[_0x090c('0x6a')][_0x090c('0x6c')]));var _0x3cc710=path['join'](config[_0x090c('0x51')],_0x090c('0x52'),_0x1b058c[_0x090c('0x6a')]['filename']);var _0x5475a8=path[_0x090c('0x50')](config[_0x090c('0x51')],_0x090c('0x52'),_0x28bf43);logger[_0x090c('0x66')]('Plugin\x20upload\x20filepath:\x20%s',_0x3cc710);logger[_0x090c('0x66')]('Plugin\x20upload\x20destination:\x20%s',_0x5475a8);try{fs[_0x090c('0x6d')](_0x3cc710,parseInt('0777',0x8));extract(_0x3cc710,{'dir':_0x5475a8},function(_0x59d999){if(_0x59d999){logger[_0x090c('0x58')](_0x59d999);handleError(_0x59d999,!![]);};var _0x5375be=fs[_0x090c('0x6e')](_0x5475a8);if(_0x5375be[_0x090c('0x3e')]>0x1){removeReferences(_0x3cc710,_0x5475a8);logger[_0x090c('0x58')](_0x090c('0x6f'));return _0x1d145d(new Error(_0x090c('0x6f')));}var _0x4a294c=fs[_0x090c('0x70')](path[_0x090c('0x50')](_0x5475a8,_0x5375be[0x0]));if(_0x4a294c[_0x090c('0x71')]()){removeReferences(_0x3cc710,_0x5475a8);logger['error'](_0x090c('0x6f'));return _0x1d145d(new Error(_0x090c('0x6f')));}if(_0x4a294c[_0x090c('0x72')]()){var _0x1df686=fs['readdirSync'](path[_0x090c('0x50')](_0x5475a8,_0x5375be[0x0]));if(_0x1df686['length']===0x0){removeReferences(_0x3cc710,_0x5475a8);logger[_0x090c('0x58')](_0x090c('0x6f'));return _0x1d145d(new Error('Invalid\x20plugin\x20structure'));}var _0x427de9=_0x1df686['some'](function(_0xf0d78e){return _0xf0d78e===_0x090c('0x73');});if(!_0x427de9){return _0x1d145d(new Error('Plugin\x20manifest\x20missing'));}var _0x12caba=fs['readFileSync'](path[_0x090c('0x50')](_0x5475a8,_0x5375be[0x0],_0x090c('0x73')));var _0x5594e5=JSON[_0x090c('0x74')](_0x12caba);if(_0x090c('0x75')==typeof _0x5594e5[_0x090c('0x2f')]){return _0x1d145d(new Error(_0x090c('0x76')));}if('undefined'==typeof _0x5594e5[_0x090c('0x45')]){return _0x1d145d(new Error(_0x090c('0x77')));}if(_0x090c('0x75')==typeof _0x5594e5['version']){return _0x1d145d(new Error(_0x090c('0x78')));}if(_0x090c('0x75')==typeof _0x5594e5[_0x090c('0x79')]){return _0x1d145d(new Error(_0x090c('0x7a')));}if(_0x5594e5[_0x090c('0x45')]===_0x090c('0x7b')){if(_0x090c('0x75')==typeof _0x5594e5[_0x090c('0x79')][_0x090c('0x7c')]){return _0x1d145d(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x090c('0x75')==typeof _0x5594e5[_0x090c('0x79')][_0x090c('0x7c')]['admin']&&'undefined'==typeof _0x5594e5[_0x090c('0x79')]['views'][_0x090c('0x7d')]){return _0x1d145d(new Error(_0x090c('0x7e')));}}else if(_0x5594e5[_0x090c('0x45')]==='script'){if(_0x090c('0x75')==typeof _0x5594e5['parameters']['scriptName']){return _0x1d145d(new Error(_0x090c('0x7f')));}if(_0x090c('0x75')==typeof _0x5594e5['parameters'][_0x090c('0x80')]){return _0x1d145d(new Error(_0x090c('0x81')));}}else{return _0x1d145d(new Error(_0x090c('0x82')));}var _0x238c0c=_0x5594e5[_0x090c('0x2f')];var _0x230d74=_0x5594e5[_0x090c('0x83')];var _0x464cd5=_0x5594e5[_0x090c('0x45')];var _0x27b9d4=_0x5594e5[_0x090c('0x84')]?_0x5594e5[_0x090c('0x84')]:_0x090c('0x85');var _0x4cd62a=_0x5594e5['icon']?_0x5594e5[_0x090c('0x86')]:_0x090c('0x87');var _0x5c80fd='';var _0x2f9b20='';var _0x127b1d='';var _0x251acc='';var _0x1e5295=_0x5594e5[_0x090c('0x88')];if(_0x464cd5===_0x090c('0x7b')){if('undefined'!=typeof _0x5594e5[_0x090c('0x79')][_0x090c('0x7c')][_0x090c('0x89')]){var _0x4a7c84=_0x5594e5[_0x090c('0x79')][_0x090c('0x7c')][_0x090c('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x090c('0x8a')](_0x4a7c84)){_0x5c80fd=path['join'](_0x090c('0x8b'),_0x28bf43,_0x5375be[0x0],_0x4a7c84);}else{_0x5c80fd=_0x4a7c84;}}else{logger['info'](_0x090c('0x8c'));}if('undefined'!=typeof _0x5594e5[_0x090c('0x79')]['views'][_0x090c('0x7d')]){var _0x213cba=_0x5594e5[_0x090c('0x79')][_0x090c('0x7c')][_0x090c('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x090c('0x8a')](_0x213cba)){_0x2f9b20=path[_0x090c('0x50')](_0x090c('0x8b'),_0x28bf43,_0x5375be[0x0],_0x213cba);}else{_0x2f9b20=_0x213cba;}}else{logger['info'](_0x090c('0x8d'));}}else if(_0x464cd5===_0x090c('0x8e')){_0x127b1d=_0x5594e5[_0x090c('0x79')][_0x090c('0x8f')];_0x251acc=_0x5594e5[_0x090c('0x79')][_0x090c('0x80')];if(_0x090c('0x75')!=typeof _0x5594e5[_0x090c('0x79')][_0x090c('0x7c')]){if(_0x090c('0x75')!=typeof _0x5594e5[_0x090c('0x79')][_0x090c('0x7c')][_0x090c('0x89')]){var _0x4a7c84=_0x5594e5[_0x090c('0x79')][_0x090c('0x7c')][_0x090c('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x090c('0x8a')](_0x4a7c84)){_0x5c80fd=path[_0x090c('0x50')](_0x090c('0x8b'),_0x28bf43,_0x5375be[0x0],_0x4a7c84);}else{_0x5c80fd=_0x4a7c84;}}if('undefined'!=typeof _0x5594e5[_0x090c('0x79')][_0x090c('0x7c')]['agent']){var _0x213cba=_0x5594e5[_0x090c('0x79')][_0x090c('0x7c')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x090c('0x8a')](_0x213cba)){_0x2f9b20=path['join'](_0x090c('0x8b'),_0x28bf43,_0x5375be[0x0],_0x213cba);}else{_0x2f9b20=_0x213cba;}}}}var _0x261c90={'name':_0x238c0c,'description':_0x230d74,'path':path[_0x090c('0x50')](_0x28bf43,_0x5375be[0x0]),'type':_0x464cd5,'sidebar':_0x27b9d4,'icon':_0x4cd62a,'adminUrl':_0x5c80fd,'agentUrl':_0x2f9b20,'scriptName':_0x127b1d,'scriptPath':_0x251acc,'version':_0x1e5295};removeReferences(_0x3cc710,null);return db[_0x090c('0x33')]['create'](_0x261c90)[_0x090c('0x28')](function(_0x302d71){var _0x3334e8={'role':_0x1b058c[_0x090c('0x90')]['role'],'userProfileId':_0x1b058c[_0x090c('0x90')][_0x090c('0x91')]};if(!_0x3334e8)throw new Error(_0x090c('0x92'));if(_0x3334e8[_0x090c('0x93')]===_0x090c('0x94')){var _0x5a610d=_0x302d71[_0x090c('0x2a')]({'plain':!![]});return db[_0x090c('0x95')][_0x090c('0x4d')]({'where':{'name':'Plugins','userProfileId':_0x3334e8[_0x090c('0x91')]},'raw':!![]})['then'](function(_0x4e76e9){if(_0x4e76e9&&_0x4e76e9['autoAssociation']===0x0){return db[_0x090c('0x2c')][_0x090c('0x96')]({'name':_0x5a610d[_0x090c('0x2f')],'resourceId':_0x5a610d['id'],'type':_0x4e76e9[_0x090c('0x2f')],'sectionId':_0x4e76e9['id']},{})[_0x090c('0x28')](function(){return _0x302d71;});}else{return _0x302d71;}})[_0x090c('0x4b')](function(_0x3adbf6){logger[_0x090c('0x58')](_0x090c('0x97'),_0x3adbf6);throw _0x3adbf6;});}return _0x302d71;})[_0x090c('0x28')](respondWithResult(_0x5353f1,null))[_0x090c('0x4b')](handleError(_0x5353f1,null));}});}catch(_0xeef062){_0x5353f1[_0x090c('0x1f')](0x1f4)[_0x090c('0x30')](_0xeef062);}};function removeReferences(_0xd5eb25,_0x4f7a72){try{if(_0xd5eb25){fs[_0x090c('0x65')](_0xd5eb25);logger[_0x090c('0x66')]('Zip\x20archive\x20removed');}if(_0x4f7a72){rimraf(_0x4f7a72,function(){});logger[_0x090c('0x66')](_0x090c('0x98'));}}catch(_0x5a4c61){logger[_0x090c('0x58')](_0x5a4c61);}}exports['update']=function(_0x5d06b1,_0x1c7368,_0xa8b62c){return db[_0x090c('0x33')]['find']({'where':{'id':_0x5d06b1[_0x090c('0x99')]['id']}})[_0x090c('0x28')](handleEntityNotFound(_0x1c7368,null))[_0x090c('0x28')](saveUpdates(_0x5d06b1[_0x090c('0x90')],null))[_0x090c('0x28')](respondWithResult(_0x1c7368,null))['catch'](handleError(_0x1c7368,null));};exports[_0x090c('0x9a')]=function(_0x5ef527,_0x3a4bb6,_0xead955){return db[_0x090c('0x33')][_0x090c('0x4d')]({'where':{'id':_0x5ef527[_0x090c('0x99')]['id']}})[_0x090c('0x28')](function(_0x537d40){if(_0x537d40){return _0x537d40[_0x090c('0x29')]();}})[_0x090c('0x28')](function(_0x5e8f8f){rimraf(path[_0x090c('0x50')](config[_0x090c('0x51')],_0x090c('0x52'),path[_0x090c('0x9b')](_0x5e8f8f[_0x090c('0x4f')])),function(){});return _0x5e8f8f;})['then'](handleEntityNotFound(_0x3a4bb6,null))[_0x090c('0x28')](respondWithStatusCode(_0x3a4bb6,null))[_0x090c('0x4b')](handleError(_0x3a4bb6,null));};exports['webhookGet']=function(_0x1e96ce,_0x2d1cd5,_0x433698){return BPromise[_0x090c('0x9c')]()[_0x090c('0x28')](function(){if(!_0x1e96ce[_0x090c('0x39')][_0x090c('0x4f')]){throw new Error(_0x090c('0x9d'));}if(!_0x1e96ce[_0x090c('0x39')][_0x090c('0x9e')]){throw new Error(_0x090c('0x9f'));}var _0x6a4d3e=_0x1e96ce[_0x090c('0x39')]['hostname']?_0x1e96ce['query'][_0x090c('0xa0')]+':'+_0x1e96ce[_0x090c('0x39')][_0x090c('0x9e')]:_0x090c('0xa1')+_0x1e96ce[_0x090c('0x39')][_0x090c('0x9e')];var _0x1200d0=_0x1e96ce['query'][_0x090c('0x20')]?_0x1e96ce[_0x090c('0x39')][_0x090c('0x20')]:!![];var _0xfff95b=_0x1e96ce['query'][_0x090c('0xa2')]?_0x1e96ce[_0x090c('0x39')][_0x090c('0xa2')]:null;var _0x2eed73={'method':_0x1e96ce['method'],'uri':util[_0x090c('0x53')](_0x090c('0xa3'),_0x6a4d3e,_0x1e96ce[_0x090c('0x39')][_0x090c('0x4f')]),'json':_0x1200d0,'resolveWithFullResponse':!![],'encoding':_0xfff95b,'qs':_0x1e96ce[_0x090c('0x39')]};if(_0x1e96ce[_0x090c('0xa4')]){_0x2eed73['headers']=_0x1e96ce['headers'];if(_0x2eed73[_0x090c('0xa4')][_0x090c('0xa5')]){delete _0x2eed73[_0x090c('0xa4')][_0x090c('0xa5')];}}if(_0x2eed73[_0x090c('0xa4')][_0x090c('0xa6')]){delete _0x2eed73[_0x090c('0xa4')]['content-type'];}return rp(_0x2eed73);})[_0x090c('0x28')](function(_0x1fbc99){if(_0x1fbc99){_0x2d1cd5[_0x090c('0xa7')](_0x1fbc99[_0x090c('0xa4')]);logger[_0x090c('0x66')](_0x1fbc99[_0x090c('0x90')]);if(_[_0x090c('0xa8')](_0x1e96ce[_0x090c('0x39')][_0x090c('0x4f')],_0x090c('0x4e'))&&_0x1fbc99[_0x090c('0xa9')]==0x1f4){return _0x2d1cd5['sendStatus'](_0x1fbc99[_0x090c('0xa9')]);}else{return _0x2d1cd5[_0x090c('0x1f')](_0x1fbc99['statusCode'])[_0x090c('0x30')](_0x1fbc99['body']);}}else{return _0x2d1cd5['sendStatus'](0xc8);}})['catch'](handleError(_0x2d1cd5,null));};exports[_0x090c('0xaa')]=function(_0x288460,_0x2e0049,_0x520e9e){return BPromise['resolve']()[_0x090c('0x28')](function(){if(!_0x288460[_0x090c('0x39')][_0x090c('0x4f')]){throw new Error(_0x090c('0x9d'));}if(!_0x288460['query']['port']){throw new Error(_0x090c('0x9f'));}var _0x591f26=_0x288460['query'][_0x090c('0xa0')]?_0x288460[_0x090c('0x39')]['hostname']+':'+_0x288460[_0x090c('0x39')]['port']:'http://localhost:'+_0x288460[_0x090c('0x39')][_0x090c('0x9e')];var _0x28b3ac=_0x288460[_0x090c('0x39')][_0x090c('0x20')]?_0x288460['query'][_0x090c('0x20')]:!![];var _0x2c886c=_0x288460['query'][_0x090c('0xa2')]?_0x288460[_0x090c('0x39')][_0x090c('0xa2')]:null;var _0x3564f8={'method':_0x288460['method'],'uri':util[_0x090c('0x53')](_0x090c('0xa3'),_0x591f26,_0x288460[_0x090c('0x39')]['path']),'json':_0x28b3ac,'resolveWithFullResponse':!![],'encoding':_0x2c886c,'body':_0x288460[_0x090c('0x90')]};if(_0x288460[_0x090c('0xa4')]){_0x3564f8[_0x090c('0xa4')]=_0x288460[_0x090c('0xa4')];if(_0x3564f8[_0x090c('0xa4')][_0x090c('0xa5')]){delete _0x3564f8[_0x090c('0xa4')]['content-length'];}}if(_0x3564f8[_0x090c('0xa4')][_0x090c('0xa6')]){delete _0x3564f8[_0x090c('0xa4')]['content-type'];}return rp(_0x3564f8);})['then'](function(_0x3b8f35){if(_0x3b8f35){_0x2e0049[_0x090c('0xa7')](_0x3b8f35['headers']);logger[_0x090c('0x66')](_0x3b8f35['body']);return _0x2e0049['status'](_0x3b8f35['statusCode'])[_0x090c('0x30')](_0x3b8f35[_0x090c('0x90')]);}else{return _0x2e0049['sendStatus'](0xc8);}})[_0x090c('0x4b')](handleError(_0x2e0049,null));}; \ No newline at end of file +var _0x6849=['query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','catch','show','params','rawAttributes','include','options','download','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','admin','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','test','body','role','UserProfileSection','Plugins','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','update','dirname','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','%s%s','html-pdf','eml-format','zip-dir','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./plugin.socket','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','map','Plugin','type','key','model','keys','filters','intersection'];(function(_0x196574,_0x3d72d5){var _0x5698e2=function(_0x205eb8){while(--_0x205eb8){_0x196574['push'](_0x196574['shift']());}};_0x5698e2(++_0x3d72d5);}(_0x6849,0x72));var _0x9684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6849[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x9684('0x0'));var emlformat=require(_0x9684('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9684('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9684('0x3'));var util=require(_0x9684('0x4'));var path=require(_0x9684('0x5'));var sox=require(_0x9684('0x6'));var csv=require(_0x9684('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9684('0x8'));var squel=require(_0x9684('0x9'));var crypto=require('crypto');var jsforce=require(_0x9684('0xa'));var deskjs=require(_0x9684('0xb'));var toCsv=require(_0x9684('0x7'));var querystring=require('querystring');var Papa=require(_0x9684('0xc'));var extract=require(_0x9684('0xd'));var rimraf=require(_0x9684('0xe'));var archiver=require(_0x9684('0xf'));var Redis=require(_0x9684('0x10'));var authService=require(_0x9684('0x11'));var qs=require(_0x9684('0x12'));var as=require(_0x9684('0x13'));var hardwareService=require(_0x9684('0x14'));var logger=require(_0x9684('0x15'))(_0x9684('0x16'));var utils=require(_0x9684('0x17'));var config=require(_0x9684('0x18'));var db=require(_0x9684('0x19'))['db'];config['redis']=_['defaults'](config[_0x9684('0x1a')],{'host':_0x9684('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9684('0x1a')]));require(_0x9684('0x1c'))['register'](socket);function respondWithStatusCode(_0x1535ad,_0x4eff00){_0x4eff00=_0x4eff00||0xcc;return function(_0x237a54){if(_0x237a54){return _0x1535ad[_0x9684('0x1d')](_0x4eff00);}return _0x1535ad['status'](_0x4eff00)[_0x9684('0x1e')]();};}function respondWithResult(_0x1bc60b,_0x5cbf4d){_0x5cbf4d=_0x5cbf4d||0xc8;return function(_0x15d1ad){if(_0x15d1ad){return _0x1bc60b[_0x9684('0x1f')](_0x5cbf4d)[_0x9684('0x20')](_0x15d1ad);}};}function respondWithFilteredResult(_0x851974,_0x321a3e){return function(_0x225b0b){if(_0x225b0b){var _0x412049=_0x225b0b[_0x9684('0x21')],_0x5a1df0=_0x321a3e[_0x9684('0x22')],_0x40b1e9=_0x321a3e[_0x9684('0x22')]+_0x321a3e[_0x9684('0x23')],_0x41fd7d;if(_0x40b1e9>=_0x412049){_0x40b1e9=_0x412049;_0x41fd7d=0xc8;}else{_0x41fd7d=0xce;}_0x851974['status'](_0x41fd7d);return _0x851974[_0x9684('0x24')](_0x9684('0x25'),_0x5a1df0+'-'+_0x40b1e9+'/'+_0x412049)[_0x9684('0x20')](_0x225b0b);}return null;};}function patchUpdates(_0x3e8814){return function(_0xf80410){try{jsonpatch['apply'](_0xf80410,_0x3e8814,!![]);}catch(_0x2638da){return BPromise[_0x9684('0x26')](_0x2638da);}return _0xf80410[_0x9684('0x27')]();};}function saveUpdates(_0x37926f,_0x3a938e){return function(_0x2ee3ab){if(_0x2ee3ab){return _0x2ee3ab['update'](_0x37926f)[_0x9684('0x28')](function(_0x19cdfa){return _0x19cdfa;});}return null;};}function removeEntity(_0x1b8d8e,_0x432882){return function(_0x4eaad2){if(_0x4eaad2){return _0x4eaad2['destroy']()[_0x9684('0x28')](function(){var _0x1275fb=_0x4eaad2[_0x9684('0x29')]({'plain':!![]});var _0x35acd5='Plugins';return db[_0x9684('0x2a')][_0x9684('0x2b')]({'where':{'type':_0x35acd5,'resourceId':_0x1275fb['id']}})[_0x9684('0x28')](function(){return _0x4eaad2;});})[_0x9684('0x28')](function(){_0x1b8d8e[_0x9684('0x1f')](0xcc)[_0x9684('0x1e')]();});}};}function handleEntityNotFound(_0x2930c2,_0x3c0b99){return function(_0x350f5b){if(!_0x350f5b){_0x2930c2[_0x9684('0x1d')](0x194);}return _0x350f5b;};}function handleError(_0x2431e0,_0x3c605b){_0x3c605b=_0x3c605b||0x1f4;return function(_0x4ffe87){logger[_0x9684('0x2c')](_0x4ffe87[_0x9684('0x2d')]);if(_0x4ffe87['name']){delete _0x4ffe87[_0x9684('0x2e')];}_0x2431e0[_0x9684('0x1f')](_0x3c605b)[_0x9684('0x2f')](_0x4ffe87);};}exports['index']=function(_0x368eeb,_0x21a884){var _0x3714ce={},_0x4bb5a0={},_0x4cb8bf={'count':0x0,'rows':[]};var _0x23d205=_[_0x9684('0x30')](db[_0x9684('0x31')]['rawAttributes'],function(_0x2ff90b){return{'name':_0x2ff90b['fieldName'],'type':_0x2ff90b[_0x9684('0x32')][_0x9684('0x33')]};});_0x4bb5a0[_0x9684('0x34')]=_[_0x9684('0x30')](_0x23d205,_0x9684('0x2e'));_0x4bb5a0['query']=_[_0x9684('0x35')](_0x368eeb['query']);_0x4bb5a0[_0x9684('0x36')]=_[_0x9684('0x37')](_0x4bb5a0[_0x9684('0x34')],_0x4bb5a0[_0x9684('0x38')]);_0x3714ce[_0x9684('0x39')]=_[_0x9684('0x37')](_0x4bb5a0[_0x9684('0x34')],qs[_0x9684('0x3a')](_0x368eeb[_0x9684('0x38')][_0x9684('0x3a')]));_0x3714ce[_0x9684('0x39')]=_0x3714ce['attributes'][_0x9684('0x3b')]?_0x3714ce['attributes']:_0x4bb5a0['model'];if(!_0x368eeb[_0x9684('0x38')][_0x9684('0x3c')](_0x9684('0x3d'))){_0x3714ce[_0x9684('0x23')]=qs[_0x9684('0x23')](_0x368eeb[_0x9684('0x38')][_0x9684('0x23')]);_0x3714ce[_0x9684('0x22')]=qs[_0x9684('0x22')](_0x368eeb[_0x9684('0x38')]['offset']);}_0x3714ce['order']=qs['sort'](_0x368eeb[_0x9684('0x38')][_0x9684('0x3e')]);_0x3714ce['where']=qs[_0x9684('0x36')](_[_0x9684('0x3f')](_0x368eeb['query'],_0x4bb5a0[_0x9684('0x36')]),_0x23d205);if(_0x368eeb[_0x9684('0x38')]['filter']){_0x3714ce[_0x9684('0x40')]=_[_0x9684('0x41')](_0x3714ce[_0x9684('0x40')],{'$or':_[_0x9684('0x30')](_0x23d205,function(_0x5a80f4){if(_0x5a80f4[_0x9684('0x32')]!==_0x9684('0x42')){var _0x4a8b45={};_0x4a8b45[_0x5a80f4[_0x9684('0x2e')]]={'$like':'%'+_0x368eeb[_0x9684('0x38')][_0x9684('0x43')]+'%'};return _0x4a8b45;}})});}_0x3714ce=_[_0x9684('0x41')]({},_0x3714ce,_0x368eeb['options']);var _0x26a4b2={'where':_0x3714ce[_0x9684('0x40')]};return db[_0x9684('0x31')]['count'](_0x26a4b2)[_0x9684('0x28')](function(_0x4b8852){_0x4cb8bf[_0x9684('0x21')]=_0x4b8852;if(_0x368eeb['query'][_0x9684('0x44')]){_0x3714ce['include']=[{'all':!![]}];}return db[_0x9684('0x31')][_0x9684('0x45')](_0x3714ce);})[_0x9684('0x28')](function(_0x324a27){_0x4cb8bf['rows']=_0x324a27;return _0x4cb8bf;})[_0x9684('0x28')](respondWithFilteredResult(_0x21a884,_0x3714ce))[_0x9684('0x46')](handleError(_0x21a884,null));};exports[_0x9684('0x47')]=function(_0x30f1be,_0x163709){var _0x1f3ec1={'raw':!![],'where':{'id':_0x30f1be[_0x9684('0x48')]['id']}},_0x43c9d2={};_0x43c9d2[_0x9684('0x34')]=_['keys'](db[_0x9684('0x31')][_0x9684('0x49')]);_0x43c9d2[_0x9684('0x38')]=_[_0x9684('0x35')](_0x30f1be[_0x9684('0x38')]);_0x43c9d2['filters']=_[_0x9684('0x37')](_0x43c9d2[_0x9684('0x34')],_0x43c9d2['query']);_0x1f3ec1[_0x9684('0x39')]=_[_0x9684('0x37')](_0x43c9d2[_0x9684('0x34')],qs['fields'](_0x30f1be['query'][_0x9684('0x3a')]));_0x1f3ec1['attributes']=_0x1f3ec1[_0x9684('0x39')][_0x9684('0x3b')]?_0x1f3ec1[_0x9684('0x39')]:_0x43c9d2[_0x9684('0x34')];if(_0x30f1be[_0x9684('0x38')]['includeAll']){_0x1f3ec1[_0x9684('0x4a')]=[{'all':!![]}];}_0x1f3ec1=_[_0x9684('0x41')]({},_0x1f3ec1,_0x30f1be[_0x9684('0x4b')]);return db[_0x9684('0x31')]['find'](_0x1f3ec1)['then'](handleEntityNotFound(_0x163709,null))[_0x9684('0x28')](respondWithResult(_0x163709,null))[_0x9684('0x46')](handleError(_0x163709,null));};exports[_0x9684('0x4c')]=function(_0x1751df,_0x5d4de2,_0x1eb56d){return db[_0x9684('0x31')][_0x9684('0x4d')]({'where':{'id':_0x1751df[_0x9684('0x48')]['id']},'attributes':[_0x9684('0x2e'),'path'],'raw':!![]})[_0x9684('0x28')](handleEntityNotFound(_0x5d4de2,null))[_0x9684('0x28')](function(_0x26c500){if(_0x26c500){var _0x3f0b85=path[_0x9684('0x4e')](config[_0x9684('0x4f')],_0x9684('0x50'),util[_0x9684('0x51')](_0x9684('0x52'),path[_0x9684('0x53')](_0x26c500['path'])));var _0x1edc5a=fs[_0x9684('0x54')](_0x3f0b85);var _0x20ac41=archiver(_0x9684('0x55'),{'zlib':{'level':0x9}});_0x20ac41['on'](_0x9684('0x56'),function(_0xe7b846){if(_0xe7b846[_0x9684('0x57')]===_0x9684('0x58')){logger[_0x9684('0x2c')](_0xe7b846);}else{throw new db[(_0x9684('0x59'))]['Error'](_0x9684('0x5a'));}});_0x20ac41['on'](_0x9684('0x2c'),function(_0xd9d6c1){throw new db['Sequelize'][(_0x9684('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x20ac41[_0x9684('0x5c')](_0x1edc5a);_0x20ac41[_0x9684('0x5d')](_0x9684('0x5e'),{'cwd':path['join'](config[_0x9684('0x4f')],_0x9684('0x50'),path['dirname'](_0x26c500['path'])),'ignore':[path[_0x9684('0x4e')](path[_0x9684('0x53')](_0x26c500[_0x9684('0x5')]),_0x9684('0x5f')),path[_0x9684('0x4e')](path[_0x9684('0x53')](_0x26c500['path']),_0x9684('0x60'))],'nodir':!![]})[_0x9684('0x61')]();_0x1edc5a['on']('close',function(){if(!fs[_0x9684('0x62')](_0x3f0b85)){throw new db[(_0x9684('0x59'))][(_0x9684('0x5b'))](_0x9684('0x63'));}return _0x5d4de2[_0x9684('0x4c')](_0x3f0b85,util['format'](_0x9684('0x52'),path[_0x9684('0x53')](_0x26c500[_0x9684('0x5')])),function(_0x142d6a){if(_0x142d6a){throw new db['Sequelize'][(_0x9684('0x5b'))](_0x9684('0x64'));}fs['unlinkSync'](_0x3f0b85);logger[_0x9684('0x65')](_0x9684('0x66'));logger[_0x9684('0x65')](_0x9684('0x67'));});});}return null;})['catch'](handleError(_0x5d4de2,null));};exports[_0x9684('0x68')]=function(_0x14c634,_0x51c10c,_0x5f2d67){var _0x45ccea=path[_0x9684('0x53')](_0x14c634[_0x9684('0x69')]['filename'],path[_0x9684('0x6a')](_0x14c634[_0x9684('0x69')][_0x9684('0x6b')]));var _0x4e80db=path['join'](config[_0x9684('0x4f')],'server/files/plugins',_0x14c634['file'][_0x9684('0x6b')]);var _0x3b4e77=path['join'](config[_0x9684('0x4f')],_0x9684('0x50'),_0x45ccea);logger[_0x9684('0x65')](_0x9684('0x6c'),_0x4e80db);logger[_0x9684('0x65')]('Plugin\x20upload\x20destination:\x20%s',_0x3b4e77);try{fs[_0x9684('0x6d')](_0x4e80db,parseInt(_0x9684('0x6e'),0x8));extract(_0x4e80db,{'dir':_0x3b4e77},function(_0x4515e2){if(_0x4515e2){logger[_0x9684('0x2c')](_0x4515e2);handleError(_0x4515e2,!![]);};var _0x2551f4=fs[_0x9684('0x6f')](_0x3b4e77);if(_0x2551f4[_0x9684('0x3b')]>0x1){removeReferences(_0x4e80db,_0x3b4e77);logger[_0x9684('0x2c')]('Invalid\x20plugin\x20structure');return _0x5f2d67(new Error(_0x9684('0x70')));}var _0x14148d=fs[_0x9684('0x71')](path['join'](_0x3b4e77,_0x2551f4[0x0]));if(_0x14148d[_0x9684('0x72')]()){removeReferences(_0x4e80db,_0x3b4e77);logger[_0x9684('0x2c')](_0x9684('0x70'));return _0x5f2d67(new Error('Invalid\x20plugin\x20structure'));}if(_0x14148d[_0x9684('0x73')]()){var _0x41bf6d=fs[_0x9684('0x6f')](path['join'](_0x3b4e77,_0x2551f4[0x0]));if(_0x41bf6d['length']===0x0){removeReferences(_0x4e80db,_0x3b4e77);logger['error']('Invalid\x20plugin\x20structure');return _0x5f2d67(new Error(_0x9684('0x70')));}var _0x5b9ad5=_0x41bf6d['some'](function(_0x46bd70){return _0x46bd70===_0x9684('0x74');});if(!_0x5b9ad5){return _0x5f2d67(new Error(_0x9684('0x75')));}var _0x3f9c1d=fs[_0x9684('0x76')](path[_0x9684('0x4e')](_0x3b4e77,_0x2551f4[0x0],_0x9684('0x74')));var _0x5c046d=JSON[_0x9684('0x77')](_0x3f9c1d);if(_0x9684('0x78')==typeof _0x5c046d[_0x9684('0x2e')]){return _0x5f2d67(new Error(_0x9684('0x79')));}if(_0x9684('0x78')==typeof _0x5c046d[_0x9684('0x32')]){return _0x5f2d67(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x5c046d[_0x9684('0x7a')]){return _0x5f2d67(new Error(_0x9684('0x7b')));}if(_0x9684('0x78')==typeof _0x5c046d[_0x9684('0x7c')]){return _0x5f2d67(new Error(_0x9684('0x7d')));}if(_0x5c046d[_0x9684('0x32')]===_0x9684('0x7e')){if('undefined'==typeof _0x5c046d['parameters']['views']){return _0x5f2d67(new Error(_0x9684('0x7f')));}if('undefined'==typeof _0x5c046d[_0x9684('0x7c')][_0x9684('0x80')]['admin']&&_0x9684('0x78')==typeof _0x5c046d[_0x9684('0x7c')]['views'][_0x9684('0x81')]){return _0x5f2d67(new Error(_0x9684('0x82')));}}else if(_0x5c046d['type']==='script'){if(_0x9684('0x78')==typeof _0x5c046d['parameters'][_0x9684('0x83')]){return _0x5f2d67(new Error(_0x9684('0x84')));}if(_0x9684('0x78')==typeof _0x5c046d['parameters'][_0x9684('0x85')]){return _0x5f2d67(new Error(_0x9684('0x86')));}}else{return _0x5f2d67(new Error(_0x9684('0x87')));}var _0x13f2e4=_0x5c046d[_0x9684('0x2e')];var _0x241ba2=_0x5c046d['description'];var _0x4136aa=_0x5c046d[_0x9684('0x32')];var _0x1a65ce=_0x5c046d[_0x9684('0x88')]?_0x5c046d['sidebar']:_0x9684('0x89');var _0x4aef2c=_0x5c046d[_0x9684('0x8a')]?_0x5c046d[_0x9684('0x8a')]:_0x9684('0x8b');var _0xde4ae0='';var _0x26d1a6='';var _0x490375='';var _0x2e711c='';var _0x4dad75=_0x5c046d['version'];if(_0x4136aa===_0x9684('0x7e')){if(_0x9684('0x78')!=typeof _0x5c046d[_0x9684('0x7c')][_0x9684('0x80')][_0x9684('0x8c')]){var _0x598a45=_0x5c046d[_0x9684('0x7c')][_0x9684('0x80')][_0x9684('0x8c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x598a45)){_0xde4ae0=path['join'](_0x9684('0x8d'),_0x45ccea,_0x2551f4[0x0],_0x598a45);}else{_0xde4ae0=_0x598a45;}}else{logger[_0x9684('0x65')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x9684('0x78')!=typeof _0x5c046d[_0x9684('0x7c')][_0x9684('0x80')][_0x9684('0x81')]){var _0x3d0e39=_0x5c046d['parameters']['views'][_0x9684('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3d0e39)){_0x26d1a6=path['join']('plugins',_0x45ccea,_0x2551f4[0x0],_0x3d0e39);}else{_0x26d1a6=_0x3d0e39;}}else{logger['info'](_0x9684('0x8e'));}}else if(_0x4136aa===_0x9684('0x8f')){_0x490375=_0x5c046d['parameters']['scriptName'];_0x2e711c=_0x5c046d[_0x9684('0x7c')][_0x9684('0x85')];if('undefined'!=typeof _0x5c046d[_0x9684('0x7c')]['views']){if(_0x9684('0x78')!=typeof _0x5c046d['parameters'][_0x9684('0x80')]['admin']){var _0x598a45=_0x5c046d[_0x9684('0x7c')][_0x9684('0x80')][_0x9684('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x9684('0x90')](_0x598a45)){_0xde4ae0=path['join']('plugins',_0x45ccea,_0x2551f4[0x0],_0x598a45);}else{_0xde4ae0=_0x598a45;}}if(_0x9684('0x78')!=typeof _0x5c046d[_0x9684('0x7c')][_0x9684('0x80')]['agent']){var _0x3d0e39=_0x5c046d[_0x9684('0x7c')][_0x9684('0x80')][_0x9684('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x9684('0x90')](_0x3d0e39)){_0x26d1a6=path[_0x9684('0x4e')](_0x9684('0x8d'),_0x45ccea,_0x2551f4[0x0],_0x3d0e39);}else{_0x26d1a6=_0x3d0e39;}}}}var _0x1c11d8={'name':_0x13f2e4,'description':_0x241ba2,'path':path[_0x9684('0x4e')](_0x45ccea,_0x2551f4[0x0]),'type':_0x4136aa,'sidebar':_0x1a65ce,'icon':_0x4aef2c,'adminUrl':_0xde4ae0,'agentUrl':_0x26d1a6,'scriptName':_0x490375,'scriptPath':_0x2e711c,'version':_0x4dad75};removeReferences(_0x4e80db,null);return db[_0x9684('0x31')]['create'](_0x1c11d8)[_0x9684('0x28')](function(_0x984249){var _0x4e4c1e={'role':_0x14c634[_0x9684('0x91')][_0x9684('0x92')],'userProfileId':_0x14c634[_0x9684('0x91')]['userProfileId']};if(!_0x4e4c1e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e4c1e[_0x9684('0x92')]==='user'){var _0xf74495=_0x984249[_0x9684('0x29')]({'plain':!![]});return db[_0x9684('0x93')][_0x9684('0x4d')]({'where':{'name':_0x9684('0x94'),'userProfileId':_0x4e4c1e[_0x9684('0x95')]},'raw':!![]})[_0x9684('0x28')](function(_0x3fecf7){if(_0x3fecf7&&_0x3fecf7[_0x9684('0x96')]===0x0){return db[_0x9684('0x2a')][_0x9684('0x97')]({'name':_0xf74495[_0x9684('0x2e')],'resourceId':_0xf74495['id'],'type':_0x3fecf7[_0x9684('0x2e')],'sectionId':_0x3fecf7['id']},{})[_0x9684('0x28')](function(){return _0x984249;});}else{return _0x984249;}})[_0x9684('0x46')](function(_0x41f58f){logger[_0x9684('0x2c')](_0x9684('0x98'),_0x41f58f);throw _0x41f58f;});}return _0x984249;})['then'](respondWithResult(_0x51c10c,null))[_0x9684('0x46')](handleError(_0x51c10c,null));}});}catch(_0x20e20b){_0x51c10c[_0x9684('0x1f')](0x1f4)[_0x9684('0x2f')](_0x20e20b);}};function removeReferences(_0x570a7b,_0x46f9ea){try{if(_0x570a7b){fs['unlinkSync'](_0x570a7b);logger[_0x9684('0x65')]('Zip\x20archive\x20removed');}if(_0x46f9ea){rimraf(_0x46f9ea,function(){});logger[_0x9684('0x65')](_0x9684('0x99'));}}catch(_0x166c4b){logger[_0x9684('0x2c')](_0x166c4b);}}exports[_0x9684('0x9a')]=function(_0x1f4766,_0x440080,_0xdb0934){return db['Plugin']['find']({'where':{'id':_0x1f4766[_0x9684('0x48')]['id']}})[_0x9684('0x28')](handleEntityNotFound(_0x440080,null))['then'](saveUpdates(_0x1f4766[_0x9684('0x91')],null))[_0x9684('0x28')](respondWithResult(_0x440080,null))['catch'](handleError(_0x440080,null));};exports['delete']=function(_0x1d6671,_0x1eef26,_0xe11ded){return db[_0x9684('0x31')][_0x9684('0x4d')]({'where':{'id':_0x1d6671[_0x9684('0x48')]['id']}})[_0x9684('0x28')](function(_0xfddabb){if(_0xfddabb){return _0xfddabb[_0x9684('0x2b')]();}})[_0x9684('0x28')](function(_0xd9ac1d){rimraf(path[_0x9684('0x4e')](config['root'],_0x9684('0x50'),path[_0x9684('0x9b')](_0xd9ac1d[_0x9684('0x5')])),function(){});return _0xd9ac1d;})['then'](handleEntityNotFound(_0x1eef26,null))[_0x9684('0x28')](respondWithStatusCode(_0x1eef26,null))['catch'](handleError(_0x1eef26,null));};exports[_0x9684('0x9c')]=function(_0x2e2b5a,_0x28cd4e,_0x468c71){return BPromise['resolve']()['then'](function(){if(!_0x2e2b5a[_0x9684('0x38')][_0x9684('0x5')]){throw new Error(_0x9684('0x9d'));}if(!_0x2e2b5a[_0x9684('0x38')]['port']){throw new Error(_0x9684('0x9e'));}var _0xc0c15e=_0x2e2b5a[_0x9684('0x38')]['hostname']?_0x2e2b5a[_0x9684('0x38')][_0x9684('0x9f')]+':'+_0x2e2b5a[_0x9684('0x38')][_0x9684('0xa0')]:'http://localhost:'+_0x2e2b5a[_0x9684('0x38')][_0x9684('0xa0')];var _0x2e4a46=_0x2e2b5a[_0x9684('0x38')]['json']?_0x2e2b5a[_0x9684('0x38')]['json']:!![];var _0x1015f3=_0x2e2b5a[_0x9684('0x38')][_0x9684('0xa1')]?_0x2e2b5a[_0x9684('0x38')]['encoding']:null;var _0x1acf86={'method':_0x2e2b5a[_0x9684('0xa2')],'uri':util[_0x9684('0x51')]('%s%s',_0xc0c15e,_0x2e2b5a[_0x9684('0x38')][_0x9684('0x5')]),'json':_0x2e4a46,'resolveWithFullResponse':!![],'encoding':_0x1015f3,'qs':_0x2e2b5a[_0x9684('0x38')]};if(_0x2e2b5a['headers']){_0x1acf86['headers']=_0x2e2b5a[_0x9684('0xa3')];if(_0x1acf86[_0x9684('0xa3')][_0x9684('0xa4')]){delete _0x1acf86[_0x9684('0xa3')][_0x9684('0xa4')];}}if(_0x1acf86[_0x9684('0xa3')]['content-type']){delete _0x1acf86[_0x9684('0xa3')][_0x9684('0xa5')];}return rp(_0x1acf86);})['then'](function(_0x743aca){if(_0x743aca){_0x28cd4e['set'](_0x743aca[_0x9684('0xa3')]);logger[_0x9684('0x65')](_0x743aca[_0x9684('0x91')]);if(_[_0x9684('0xa6')](_0x2e2b5a[_0x9684('0x38')][_0x9684('0x5')],_0x9684('0x4c'))&&_0x743aca[_0x9684('0xa7')]==0x1f4){return _0x28cd4e[_0x9684('0x1d')](_0x743aca[_0x9684('0xa7')]);}else{return _0x28cd4e[_0x9684('0x1f')](_0x743aca[_0x9684('0xa7')])[_0x9684('0x2f')](_0x743aca[_0x9684('0x91')]);}}else{return _0x28cd4e['sendStatus'](0xc8);}})[_0x9684('0x46')](handleError(_0x28cd4e,null));};exports[_0x9684('0xa8')]=function(_0x2d6384,_0x29c34a,_0x500ac8){return BPromise['resolve']()[_0x9684('0x28')](function(){if(!_0x2d6384['query'][_0x9684('0x5')]){throw new Error(_0x9684('0x9d'));}if(!_0x2d6384[_0x9684('0x38')][_0x9684('0xa0')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x47c37=_0x2d6384['query'][_0x9684('0x9f')]?_0x2d6384[_0x9684('0x38')][_0x9684('0x9f')]+':'+_0x2d6384[_0x9684('0x38')][_0x9684('0xa0')]:'http://localhost:'+_0x2d6384[_0x9684('0x38')]['port'];var _0x5df0f6=_0x2d6384[_0x9684('0x38')][_0x9684('0x20')]?_0x2d6384[_0x9684('0x38')][_0x9684('0x20')]:!![];var _0x1fec79=_0x2d6384[_0x9684('0x38')][_0x9684('0xa1')]?_0x2d6384[_0x9684('0x38')]['encoding']:null;var _0x1796fe={'method':_0x2d6384[_0x9684('0xa2')],'uri':util[_0x9684('0x51')](_0x9684('0xa9'),_0x47c37,_0x2d6384[_0x9684('0x38')][_0x9684('0x5')]),'json':_0x5df0f6,'resolveWithFullResponse':!![],'encoding':_0x1fec79,'body':_0x2d6384[_0x9684('0x91')]};if(_0x2d6384[_0x9684('0xa3')]){_0x1796fe[_0x9684('0xa3')]=_0x2d6384['headers'];if(_0x1796fe[_0x9684('0xa3')][_0x9684('0xa4')]){delete _0x1796fe['headers'][_0x9684('0xa4')];}}if(_0x1796fe[_0x9684('0xa3')][_0x9684('0xa5')]){delete _0x1796fe[_0x9684('0xa3')][_0x9684('0xa5')];}return rp(_0x1796fe);})[_0x9684('0x28')](function(_0x5ba116){if(_0x5ba116){_0x29c34a['set'](_0x5ba116['headers']);logger[_0x9684('0x65')](_0x5ba116[_0x9684('0x91')]);return _0x29c34a['status'](_0x5ba116['statusCode'])[_0x9684('0x2f')](_0x5ba116[_0x9684('0x91')]);}else{return _0x29c34a[_0x9684('0x1d')](0xc8);}})[_0x9684('0x46')](handleError(_0x29c34a,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index c7d485f..ff6a800 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 _0x32f4=['update','remove','emit','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x3e4a9d,_0x4f36a1){var _0x507d53=function(_0x38dc7b){while(--_0x38dc7b){_0x3e4a9d['push'](_0x3e4a9d['shift']());}};_0x507d53(++_0x4f36a1);}(_0x32f4,0x154));var _0x432f=function(_0x1942b1,_0x3861ad){_0x1942b1=_0x1942b1-0x0;var _0x3421b5=_0x32f4[_0x1942b1];return _0x3421b5;};'use strict';var EventEmitter=require(_0x432f('0x0'));var Plugin=require(_0x432f('0x1'))['db'][_0x432f('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x432f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x432f('0x4'),'afterDestroy':_0x432f('0x5')};function emitEvent(_0x51a71a){return function(_0x354293,_0x1eabac,_0x344a29){PluginEvents[_0x432f('0x6')](_0x51a71a+':'+_0x354293['id'],_0x354293);PluginEvents[_0x432f('0x6')](_0x51a71a,_0x354293);_0x344a29(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x432f('0x7')]=PluginEvents; \ No newline at end of file +var _0xaebd=['emit','hook','exports','events','Plugin','setMaxListeners','save','update','remove'];(function(_0x97369a,_0x2b3021){var _0x434c9f=function(_0xbc5a97){while(--_0xbc5a97){_0x97369a['push'](_0x97369a['shift']());}};_0x434c9f(++_0x2b3021);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x5118ed,_0x5815e6){_0x5118ed=_0x5118ed-0x0;var _0x4855da=_0xaebd[_0x5118ed];return _0x4855da;};'use strict';var EventEmitter=require(_0xdaeb('0x0'));var Plugin=require('../../mysqldb')['db'][_0xdaeb('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xdaeb('0x2')](0x0);var events={'afterCreate':_0xdaeb('0x3'),'afterUpdate':_0xdaeb('0x4'),'afterDestroy':_0xdaeb('0x5')};function emitEvent(_0x4acd42){return function(_0x44e982,_0x1c617a,_0x1a99be){PluginEvents[_0xdaeb('0x6')](_0x4acd42+':'+_0x44e982['id'],_0x44e982);PluginEvents[_0xdaeb('0x6')](_0x4acd42,_0x44e982);_0x1a99be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xdaeb('0x7')](e,emitEvent(event));}}module[_0xdaeb('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 5eba3fa..b2c62f1 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 _0xa589=['rimraf','./plugin.attributes','exports','define','plugins','util','api','request-promise'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xa589,0x19d));var _0x9a58=function(_0x4430a9,_0x5f0b8d){_0x4430a9=_0x4430a9-0x0;var _0x2432da=_0xa589[_0x4430a9];return _0x2432da;};'use strict';var _=require('lodash');var util=require(_0x9a58('0x0'));var logger=require('../../config/logger')(_0x9a58('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9a58('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a58('0x3'));var config=require('../../config/environment');var attributes=require(_0x9a58('0x4'));module[_0x9a58('0x5')]=function(_0x485e28,_0x18b0f1){return _0x485e28[_0x9a58('0x6')]('Plugin',attributes,{'tableName':_0x9a58('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5690=['request-promise','path','rimraf','../../config/environment','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x16b4ac,_0x32d517){var _0xb34cc4=function(_0x5982bb){while(--_0x5982bb){_0x16b4ac['push'](_0x16b4ac['shift']());}};_0xb34cc4(++_0x32d517);}(_0x5690,0x104));var _0x0569=function(_0x26bfb0,_0x5b0ffc){_0x26bfb0=_0x26bfb0-0x0;var _0x4454b3=_0x5690[_0x26bfb0];return _0x4454b3;};'use strict';var _=require(_0x0569('0x0'));var util=require(_0x0569('0x1'));var logger=require(_0x0569('0x2'))(_0x0569('0x3'));var moment=require(_0x0569('0x4'));var BPromise=require(_0x0569('0x5'));var rp=require(_0x0569('0x6'));var fs=require('fs');var path=require(_0x0569('0x7'));var rimraf=require(_0x0569('0x8'));var config=require(_0x0569('0x9'));var attributes=require('./plugin.attributes');module[_0x0569('0xa')]=function(_0x20de66,_0x43ec1b){return _0x20de66[_0x0569('0xb')](_0x0569('0xc'),attributes,{'tableName':_0x0569('0xd'),'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 4ef5349..05ef4a5 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 _0x167b=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','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'];(function(_0x55474e,_0x3dadc5){var _0x4b27b3=function(_0x27f270){while(--_0x27f270){_0x55474e['push'](_0x55474e['shift']());}};_0x4b27b3(++_0x3dadc5);}(_0x167b,0x6c));var _0xb167=function(_0x2b6710,_0x24aa05){_0x2b6710=_0x2b6710-0x0;var _0x5a6fca=_0x167b[_0x2b6710];return _0x5a6fca;};'use strict';var _=require('lodash');var util=require(_0xb167('0x0'));var moment=require(_0xb167('0x1'));var BPromise=require(_0xb167('0x2'));var rs=require(_0xb167('0x3'));var fs=require('fs');var Redis=require(_0xb167('0x4'));var db=require(_0xb167('0x5'))['db'];var utils=require(_0xb167('0x6'));var logger=require(_0xb167('0x7'))(_0xb167('0x8'));var config=require('../../config/environment');var jayson=require(_0xb167('0x9'));var client=jayson[_0xb167('0xa')][_0xb167('0xb')]({'port':0x232a});config[_0xb167('0xc')]=_[_0xb167('0xd')](config[_0xb167('0xc')],{'host':_0xb167('0xe'),'port':0x18eb});var socket=require(_0xb167('0xf'))(new Redis(config[_0xb167('0xc')]));require(_0xb167('0x10'))[_0xb167('0x11')](socket);function respondWithRpcPromise(_0x2ceead,_0x33ee5b,_0xa2c1c8){return new BPromise(function(_0x2432de,_0x9ca04b){return client['request'](_0x2ceead,_0xa2c1c8)[_0xb167('0x12')](function(_0x367883){logger[_0xb167('0x13')](_0xb167('0x14'),_0x33ee5b,_0xb167('0x15'));logger[_0xb167('0x16')](_0xb167('0x17'),_0x33ee5b,'request\x20sent',JSON[_0xb167('0x18')](_0x367883));if(_0x367883[_0xb167('0x19')]){if(_0x367883[_0xb167('0x19')][_0xb167('0x1a')]===0x1f4){logger[_0xb167('0x19')](_0xb167('0x14'),_0x33ee5b,_0x367883[_0xb167('0x19')][_0xb167('0x1b')]);return _0x9ca04b(_0x367883[_0xb167('0x19')][_0xb167('0x1b')]);}logger[_0xb167('0x19')](_0xb167('0x14'),_0x33ee5b,_0x367883[_0xb167('0x19')]['message']);return _0x2432de(_0x367883[_0xb167('0x19')][_0xb167('0x1b')]);}else{logger[_0xb167('0x13')](_0xb167('0x14'),_0x33ee5b,_0xb167('0x15'));_0x2432de(_0x367883[_0xb167('0x1c')][_0xb167('0x1b')]);}})[_0xb167('0x1d')](function(_0x5eaa84){logger[_0xb167('0x19')](_0xb167('0x14'),_0x33ee5b,_0x5eaa84);_0x9ca04b(_0x5eaa84);});});}exports[_0xb167('0x1e')]=function(_0x1d55c5){var _0x527ff0=this;return new Promise(function(_0x571fa4,_0x34d10d){return db[_0xb167('0x1f')][_0xb167('0x20')](_0x1d55c5[_0xb167('0x21')],{'raw':_0x1d55c5[_0xb167('0x22')]?_0x1d55c5[_0xb167('0x22')][_0xb167('0x23')]===undefined?!![]:![]:!![]})[_0xb167('0x12')](function(_0x5cdcf7){logger[_0xb167('0x13')](_0xb167('0x1e'),_0x1d55c5);logger[_0xb167('0x16')]('CreatePlugin',_0x1d55c5,JSON['stringify'](_0x5cdcf7));_0x571fa4(_0x5cdcf7);})['catch'](function(_0x8f1e3d){logger[_0xb167('0x19')]('CreatePlugin',_0x8f1e3d[_0xb167('0x1b')],_0x1d55c5);_0x34d10d(_0x527ff0[_0xb167('0x19')](0x1f4,_0x8f1e3d[_0xb167('0x1b')]));});});}; \ No newline at end of file +var _0xddb9=['socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','CreatePlugin','Plugin','create','options','raw','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis'];(function(_0x2f899b,_0x39018c){var _0x18adca=function(_0x3c208e){while(--_0x3c208e){_0x2f899b['push'](_0x2f899b['shift']());}};_0x18adca(++_0x39018c);}(_0xddb9,0x169));var _0x9ddb=function(_0x4e2ca6,_0x4a29ca){_0x4e2ca6=_0x4e2ca6-0x0;var _0xd809ee=_0xddb9[_0x4e2ca6];return _0xd809ee;};'use strict';var _=require(_0x9ddb('0x0'));var util=require(_0x9ddb('0x1'));var moment=require('moment');var BPromise=require(_0x9ddb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ddb('0x3'));var db=require(_0x9ddb('0x4'))['db'];var utils=require(_0x9ddb('0x5'));var logger=require('../../config/logger')(_0x9ddb('0x6'));var config=require('../../config/environment');var jayson=require(_0x9ddb('0x7'));var client=jayson[_0x9ddb('0x8')][_0x9ddb('0x9')]({'port':0x232a});config[_0x9ddb('0xa')]=_['defaults'](config[_0x9ddb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9ddb('0xb'))(new Redis(config[_0x9ddb('0xa')]));require(_0x9ddb('0xc'))[_0x9ddb('0xd')](socket);function respondWithRpcPromise(_0x3293b3,_0x15e353,_0x565f3f){return new BPromise(function(_0x2888fb,_0x2f773e){return client[_0x9ddb('0xe')](_0x3293b3,_0x565f3f)[_0x9ddb('0xf')](function(_0x40e355){logger['info'](_0x9ddb('0x10'),_0x15e353,_0x9ddb('0x11'));logger[_0x9ddb('0x12')]('Plugin,\x20%s,\x20%s,\x20%s',_0x15e353,_0x9ddb('0x11'),JSON[_0x9ddb('0x13')](_0x40e355));if(_0x40e355['error']){if(_0x40e355['error'][_0x9ddb('0x14')]===0x1f4){logger[_0x9ddb('0x15')](_0x9ddb('0x10'),_0x15e353,_0x40e355[_0x9ddb('0x15')][_0x9ddb('0x16')]);return _0x2f773e(_0x40e355[_0x9ddb('0x15')][_0x9ddb('0x16')]);}logger['error'](_0x9ddb('0x10'),_0x15e353,_0x40e355['error'][_0x9ddb('0x16')]);return _0x2888fb(_0x40e355[_0x9ddb('0x15')][_0x9ddb('0x16')]);}else{logger[_0x9ddb('0x17')](_0x9ddb('0x10'),_0x15e353,'request\x20sent');_0x2888fb(_0x40e355[_0x9ddb('0x18')][_0x9ddb('0x16')]);}})['catch'](function(_0x592a88){logger[_0x9ddb('0x15')](_0x9ddb('0x10'),_0x15e353,_0x592a88);_0x2f773e(_0x592a88);});});}exports[_0x9ddb('0x19')]=function(_0xdade2b){var _0x4ca70f=this;return new Promise(function(_0x203e18,_0x47a556){return db[_0x9ddb('0x1a')][_0x9ddb('0x1b')](_0xdade2b['body'],{'raw':_0xdade2b[_0x9ddb('0x1c')]?_0xdade2b[_0x9ddb('0x1c')][_0x9ddb('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2087c1){logger['info'](_0x9ddb('0x19'),_0xdade2b);logger[_0x9ddb('0x12')](_0x9ddb('0x19'),_0xdade2b,JSON['stringify'](_0x2087c1));_0x203e18(_0x2087c1);})[_0x9ddb('0x1e')](function(_0x3c9db0){logger[_0x9ddb('0x15')](_0x9ddb('0x19'),_0x3c9db0[_0x9ddb('0x16')],_0xdade2b);_0x47a556(_0x4ca70f[_0x9ddb('0x15')](0x1f4,_0x3c9db0['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 8726c4c..50e4821 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 _0x745c=['register','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x745c,0xa2));var _0xc745=function(_0x367afb,_0x5c4271){_0x367afb=_0x367afb-0x0;var _0x135d81=_0x745c[_0x367afb];return _0x135d81;};'use strict';var PluginEvents=require(_0xc745('0x0'));var events=[_0xc745('0x1'),_0xc745('0x2'),_0xc745('0x3')];function createListener(_0x5a4f59,_0x24b5d0){return function(_0x324fef){_0x24b5d0[_0xc745('0x4')](_0x5a4f59,_0x324fef);};}function removeListener(_0x3d1d2f,_0x2cfe0e){return function(){PluginEvents[_0xc745('0x5')](_0x3d1d2f,_0x2cfe0e);};}exports[_0xc745('0x6')]=function(_0x4785ec){for(var _0x15b8f7=0x0,_0x29759f=events['length'];_0x15b8f7<_0x29759f;_0x15b8f7++){var _0x5d85d4=events[_0x15b8f7];var _0x1de1b3=createListener('plugin:'+_0x5d85d4,_0x4785ec);PluginEvents['on'](_0x5d85d4,_0x1de1b3);}}; \ No newline at end of file +var _0xcbe8=['update','removeListener','register','plugin:','save','remove'];(function(_0x327199,_0x1283db){var _0x5a7cf0=function(_0x350f66){while(--_0x350f66){_0x327199['push'](_0x327199['shift']());}};_0x5a7cf0(++_0x1283db);}(_0xcbe8,0x1e4));var _0x8cbe=function(_0x5105b7,_0x454e66){_0x5105b7=_0x5105b7-0x0;var _0xb5088f=_0xcbe8[_0x5105b7];return _0xb5088f;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x8cbe('0x0'),_0x8cbe('0x1'),_0x8cbe('0x2')];function createListener(_0x1a6492,_0x2397f8){return function(_0x48285f){_0x2397f8['emit'](_0x1a6492,_0x48285f);};}function removeListener(_0x17dfff,_0x3629b3){return function(){PluginEvents[_0x8cbe('0x3')](_0x17dfff,_0x3629b3);};}exports[_0x8cbe('0x4')]=function(_0x1e173d){for(var _0xa663f=0x0,_0x290850=events['length'];_0xa663f<_0x290850;_0xa663f++){var _0x1d7784=events[_0xa663f];var _0x1735f0=createListener(_0x8cbe('0x5')+_0x1d7784,_0x1e173d);PluginEvents['on'](_0x1d7784,_0x1735f0);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 29987d0..155934b 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 _0x5449=['destroy','exports','Router','index','isAuthenticated','post','create','put','/:id','update'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5449,0xd4));var _0x9544=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0x5449[_0x2e2681];return _0x368a64;};'use strict';var express=require('express');var router=express[_0x9544('0x0')]();var auth=require('../../components/auth/service');var controller=require('./pm2.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9544('0x1')]);router['get']('/:id',auth[_0x9544('0x2')](),controller['show']);router[_0x9544('0x3')]('/',auth['isAuthenticated'](),controller[_0x9544('0x4')]);router[_0x9544('0x5')](_0x9544('0x6'),auth[_0x9544('0x2')](),controller[_0x9544('0x7')]);router['delete'](_0x9544('0x6'),auth[_0x9544('0x2')](),controller[_0x9544('0x8')]);module[_0x9544('0x9')]=router; \ No newline at end of file +var _0xf955=['./pm2.controller','get','isAuthenticated','show','post','create','/:id','update','delete','exports','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf955,0xfa));var _0x5f95=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xf955[_0x34bf97];return _0x292719;};'use strict';var express=require(_0x5f95('0x0'));var router=express[_0x5f95('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5f95('0x2'));router[_0x5f95('0x3')]('/',auth[_0x5f95('0x4')](),controller['index']);router[_0x5f95('0x3')]('/:id',auth['isAuthenticated'](),controller[_0x5f95('0x5')]);router[_0x5f95('0x6')]('/',auth[_0x5f95('0x4')](),controller[_0x5f95('0x7')]);router['put'](_0x5f95('0x8'),auth['isAuthenticated'](),controller[_0x5f95('0x9')]);router[_0x5f95('0xa')](_0x5f95('0x8'),auth[_0x5f95('0x4')](),controller['destroy']);module[_0x5f95('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 b3345e9..8a4f097 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 _0x9098=['list','then','reject','express','motion2','length','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x9098,0x129));var _0x8909=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9098[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var pm2=require(_0x8909('0x0'));var logger=require(_0x8909('0x1'))(_0x8909('0x2'));var path=require(_0x8909('0x3'));var exec=require(_0x8909('0x4'))['exec'];var BPromise=require(_0x8909('0x5'));function handleEntityNotFound(_0x52cc67,_0x201438){return function(_0x2d1873){if(!_0x2d1873){_0x52cc67[_0x8909('0x6')](0x194);;}return _0x2d1873;};}function respondWithResult(_0x375aab,_0x10098f){_0x10098f=_0x10098f||0xc8;return function(_0x1d98a4){if(_0x1d98a4){return _0x375aab[_0x8909('0x7')](_0x10098f)[_0x8909('0x8')](_0x1d98a4);}return null;};}function handleError(_0x40c1f9,_0x5becb5){_0x5becb5=_0x5becb5||0x1f4;return function(_0x9f6bd5){logger[_0x8909('0x9')](_0x9f6bd5[_0x8909('0xa')]);if(_0x9f6bd5['name']){delete _0x9f6bd5[_0x8909('0xb')];}_0x40c1f9[_0x8909('0x7')](_0x5becb5)[_0x8909('0xc')](_0x9f6bd5);};}function execChildProcess(){return new BPromise(function(_0x5401f4,_0x2d4e9a){exec(_0x8909('0xd'),function(_0x57a539,_0x114eec,_0x365459){logger[_0x8909('0xe')](_0x114eec);logger[_0x8909('0xe')](_0x365459);if(_0x57a539){logger[_0x8909('0x9')](_0x57a539);return _0x2d4e9a(_0x57a539);}return _0x5401f4(_0x114eec);});});}exports['index']=function(_0x4bef8a,_0x16db42){return pm2[_0x8909('0xf')]()[_0x8909('0x10')](function(_0x24d3d5){if(_0x24d3d5){var _0x45ff41=_[_0x8909('0x11')](_0x24d3d5,function(_0x3a3b50){return _0x3a3b50[_0x8909('0xb')]===_0x8909('0x12')||_0x3a3b50[_0x8909('0xb')]===_0x8909('0x13');});return{'rows':_0x45ff41,'count':_0x45ff41[_0x8909('0x14')]};}return null;})[_0x8909('0x10')](respondWithResult(_0x16db42,null))[_0x8909('0x15')](handleError(_0x16db42,null));};exports[_0x8909('0x16')]=function(_0x325b33,_0x5d22d0){return pm2[_0x8909('0x17')](_0x325b33[_0x8909('0x18')]['id'])[_0x8909('0x10')](respondWithResult(_0x5d22d0,null))[_0x8909('0x10')](handleEntityNotFound(_0x5d22d0,null))[_0x8909('0x15')](handleError(_0x5d22d0,null));};exports[_0x8909('0x19')]=function(_0x187f1f,_0x1b6b3e){if(_0x187f1f[_0x8909('0x1a')]['name']&&_0x187f1f[_0x8909('0x1a')][_0x8909('0x1b')]){var _0x23b490=path[_0x8909('0x1c')](__dirname,_0x8909('0x1d'),_0x187f1f[_0x8909('0x1a')]['script']);var _0x57a955=process[_0x8909('0x1e')]();process[_0x8909('0x1f')](path['dirname'](_0x23b490));return execChildProcess()[_0x8909('0x10')](function(_0x4c242d){process['chdir'](_0x57a955);return pm2['start']({'name':_0x187f1f[_0x8909('0x1a')][_0x8909('0xb')],'script':_0x23b490});})[_0x8909('0x10')](function(_0x5c0c25){pm2[_0x8909('0x20')]();return _0x5c0c25[0x0];})[_0x8909('0x10')](respondWithResult(_0x1b6b3e,0xc9))[_0x8909('0x15')](handleError(_0x1b6b3e,null));}else{return _0x1b6b3e[_0x8909('0x7')](0x1f4)[_0x8909('0xc')]({'message':_0x8909('0x21')});}};exports[_0x8909('0x22')]=function(_0x5d171f,_0x52f043){if(_0x5d171f[_0x8909('0x1a')]['id']){delete _0x5d171f[_0x8909('0x1a')]['id'];}var _0x5ed36d={'online':'restart','stopped':_0x8909('0x23')};if(_0x5ed36d[_0x8909('0x24')](_0x5d171f[_0x8909('0x1a')][_0x8909('0x7')])){return pm2[_0x5ed36d[_0x5d171f[_0x8909('0x1a')][_0x8909('0x7')]]](_0x5d171f[_0x8909('0x18')]['id'])[_0x8909('0x10')](respondWithResult(_0x52f043,0xc8))[_0x8909('0x15')](handleError(_0x52f043,null));}else{return _0x52f043[_0x8909('0x7')](0x1f4)[_0x8909('0xc')]({'message':_0x8909('0x25')});}};exports['destroy']=function(_0x625b0b,_0x1afa40){if(_0x625b0b[_0x8909('0x1a')]['id']){delete _0x625b0b['body']['id'];}if(_0x625b0b['params']['id']){return pm2['delete'](_0x625b0b[_0x8909('0x18')]['id'])[_0x8909('0x10')](function(_0x32eb9e){pm2[_0x8909('0x20')]();return _0x32eb9e[0x0];})[_0x8909('0x10')](respondWithResult(_0x1afa40,null))[_0x8909('0x15')](handleError(_0x1afa40,null));}else{return _0x1afa40[_0x8909('0x7')](0x1f4)[_0x8909('0xc')]({'message':_0x8909('0x26')});}}; \ No newline at end of file +var _0xe10f=['../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty','Unknown\x20status','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','bluebird','sendStatus','status','error','stack','name','send','npm\x20install','info','index','reject','express','motion2','catch','show','describe','params','then','body','script'];(function(_0x6be6cf,_0x1f1ed1){var _0x28600f=function(_0x362f20){while(--_0x362f20){_0x6be6cf['push'](_0x6be6cf['shift']());}};_0x28600f(++_0x1f1ed1);}(_0xe10f,0xff));var _0xfe10=function(_0x18e34c,_0x1f87c5){_0x18e34c=_0x18e34c-0x0;var _0x5ad33e=_0xe10f[_0x18e34c];return _0x5ad33e;};'use strict';var _=require(_0xfe10('0x0'));var pm2=require(_0xfe10('0x1'));var logger=require(_0xfe10('0x2'))(_0xfe10('0x3'));var path=require('path');var exec=require(_0xfe10('0x4'))['exec'];var BPromise=require(_0xfe10('0x5'));function handleEntityNotFound(_0x147d53,_0xc02f7c){return function(_0x15b79a){if(!_0x15b79a){_0x147d53[_0xfe10('0x6')](0x194);;}return _0x15b79a;};}function respondWithResult(_0x2614d8,_0x44b41f){_0x44b41f=_0x44b41f||0xc8;return function(_0x2c789d){if(_0x2c789d){return _0x2614d8[_0xfe10('0x7')](_0x44b41f)['json'](_0x2c789d);}return null;};}function handleError(_0x62bb74,_0x330c23){_0x330c23=_0x330c23||0x1f4;return function(_0x469e73){logger[_0xfe10('0x8')](_0x469e73[_0xfe10('0x9')]);if(_0x469e73[_0xfe10('0xa')]){delete _0x469e73['name'];}_0x62bb74[_0xfe10('0x7')](_0x330c23)[_0xfe10('0xb')](_0x469e73);};}function execChildProcess(){return new BPromise(function(_0x17240a,_0x358845){exec(_0xfe10('0xc'),function(_0x45c448,_0x580cd0,_0xa08fe0){logger['info'](_0x580cd0);logger[_0xfe10('0xd')](_0xa08fe0);if(_0x45c448){logger[_0xfe10('0x8')](_0x45c448);return _0x358845(_0x45c448);}return _0x17240a(_0x580cd0);});});}exports[_0xfe10('0xe')]=function(_0x36828c,_0x4c841c){return pm2['list']()['then'](function(_0x16fde0){if(_0x16fde0){var _0x3e6c9f=_[_0xfe10('0xf')](_0x16fde0,function(_0x30b01b){return _0x30b01b[_0xfe10('0xa')]===_0xfe10('0x10')||_0x30b01b[_0xfe10('0xa')]===_0xfe10('0x11');});return{'rows':_0x3e6c9f,'count':_0x3e6c9f['length']};}return null;})['then'](respondWithResult(_0x4c841c,null))[_0xfe10('0x12')](handleError(_0x4c841c,null));};exports[_0xfe10('0x13')]=function(_0x43fd8b,_0x15c52f){return pm2[_0xfe10('0x14')](_0x43fd8b[_0xfe10('0x15')]['id'])['then'](respondWithResult(_0x15c52f,null))[_0xfe10('0x16')](handleEntityNotFound(_0x15c52f,null))[_0xfe10('0x12')](handleError(_0x15c52f,null));};exports['create']=function(_0x413d57,_0x44c09e){if(_0x413d57[_0xfe10('0x17')]['name']&&_0x413d57[_0xfe10('0x17')][_0xfe10('0x18')]){var _0x408754=path['join'](__dirname,_0xfe10('0x19'),_0x413d57['body'][_0xfe10('0x18')]);var _0x409e9b=process[_0xfe10('0x1a')]();process[_0xfe10('0x1b')](path[_0xfe10('0x1c')](_0x408754));return execChildProcess()[_0xfe10('0x16')](function(_0x49c1d6){process[_0xfe10('0x1b')](_0x409e9b);return pm2['start']({'name':_0x413d57[_0xfe10('0x17')][_0xfe10('0xa')],'script':_0x408754});})[_0xfe10('0x16')](function(_0x116b5d){pm2[_0xfe10('0x1d')]();return _0x116b5d[0x0];})[_0xfe10('0x16')](respondWithResult(_0x44c09e,0xc9))[_0xfe10('0x12')](handleError(_0x44c09e,null));}else{return _0x44c09e[_0xfe10('0x7')](0x1f4)[_0xfe10('0xb')]({'message':_0xfe10('0x1e')});}};exports['update']=function(_0x34aa36,_0x1e6d9f){if(_0x34aa36[_0xfe10('0x17')]['id']){delete _0x34aa36[_0xfe10('0x17')]['id'];}var _0x380b05={'online':_0xfe10('0x1f'),'stopped':'stop'};if(_0x380b05[_0xfe10('0x20')](_0x34aa36[_0xfe10('0x17')]['status'])){return pm2[_0x380b05[_0x34aa36[_0xfe10('0x17')][_0xfe10('0x7')]]](_0x34aa36['params']['id'])['then'](respondWithResult(_0x1e6d9f,0xc8))[_0xfe10('0x12')](handleError(_0x1e6d9f,null));}else{return _0x1e6d9f['status'](0x1f4)[_0xfe10('0xb')]({'message':_0xfe10('0x21')});}};exports['destroy']=function(_0x2a4bd8,_0x1fac33){if(_0x2a4bd8[_0xfe10('0x17')]['id']){delete _0x2a4bd8[_0xfe10('0x17')]['id'];}if(_0x2a4bd8['params']['id']){return pm2['delete'](_0x2a4bd8[_0xfe10('0x15')]['id'])['then'](function(_0x3da9ac){pm2[_0xfe10('0x1d')]();return _0x3da9ac[0x0];})['then'](respondWithResult(_0x1fac33,null))[_0xfe10('0x12')](handleError(_0x1fac33,null));}else{return _0x1fac33['status'](0x1f4)[_0xfe10('0xb')]({'message':_0xfe10('0x22')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 4ee7f3f..f0184c8 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 _0x0d9b=['../../components/auth/service','../../config/environment','exports','connect-timeout','express','Router'];(function(_0x2f09f7,_0x461707){var _0x1b266c=function(_0xbff8dc){while(--_0xbff8dc){_0x2f09f7['push'](_0x2f09f7['shift']());}};_0x1b266c(++_0x461707);}(_0x0d9b,0x7b));var _0xb0d9=function(_0x463a85,_0x2f7849){_0x463a85=_0x463a85-0x0;var _0x1aefda=_0x0d9b[_0x463a85];return _0x1aefda;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb0d9('0x0'));var express=require(_0xb0d9('0x1'));var router=express[_0xb0d9('0x2')]();var auth=require(_0xb0d9('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb0d9('0x4'));module[_0xb0d9('0x5')]=router; \ No newline at end of file +var _0xf94c=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x544099,_0x372b30){var _0x20ab09=function(_0x149613){while(--_0x149613){_0x544099['push'](_0x544099['shift']());}};_0x20ab09(++_0x372b30);}(_0xf94c,0x1a4));var _0xcf94=function(_0x20e106,_0x244c4c){_0x20e106=_0x20e106-0x0;var _0x58757b=_0xf94c[_0x20e106];return _0x58757b;};'use strict';var multer=require('multer');var util=require(_0xcf94('0x0'));var path=require('path');var timeout=require(_0xcf94('0x1'));var express=require(_0xcf94('0x2'));var router=express[_0xcf94('0x3')]();var auth=require(_0xcf94('0x4'));var interaction=require(_0xcf94('0x5'));var config=require('../../config/environment');module[_0xcf94('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index ccb7f80..bd1c666 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 _0xb884=['exports','STRING','DATE','INTEGER','sequelize'];(function(_0x183a5b,_0x1fe225){var _0x2e057a=function(_0x1e65d1){while(--_0x1e65d1){_0x183a5b['push'](_0x183a5b['shift']());}};_0x2e057a(++_0x1fe225);}(_0xb884,0x130));var _0x4b88=function(_0x406115,_0x19f7a1){_0x406115=_0x406115-0x0;var _0xbbabdb=_0xb884[_0x406115];return _0xbbabdb;};'use strict';var Sequelize=require(_0x4b88('0x0'));module[_0x4b88('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x4b88('0x2')]},'scheduledat':{'type':Sequelize[_0x4b88('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x4b88('0x3')]},'responsetime':{'type':Sequelize[_0x4b88('0x3')]},'ringtime':{'type':Sequelize[_0x4b88('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4b88('0x2')]},'campaigntype':{'type':Sequelize[_0x4b88('0x2')]},'membername':{'type':Sequelize[_0x4b88('0x2')]}}; \ No newline at end of file +var _0xe1c9=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe1c9,0xc9));var _0x9e1c=function(_0x2493f7,_0x49c670){_0x2493f7=_0x2493f7-0x0;var _0x594ab2=_0xe1c9[_0x2493f7];return _0x594ab2;};'use strict';var Sequelize=require(_0x9e1c('0x0'));module[_0x9e1c('0x1')]={'state':{'type':Sequelize[_0x9e1c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9e1c('0x3')]},'scheduledat':{'type':Sequelize[_0x9e1c('0x4')]},'uniqueid':{'type':Sequelize[_0x9e1c('0x3')]},'starttime':{'type':Sequelize[_0x9e1c('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x9e1c('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9e1c('0x3')]},'campaigntype':{'type':Sequelize[_0x9e1c('0x3')]},'membername':{'type':Sequelize[_0x9e1c('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index e429e2d..f4b29c5 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 _0x250e=['util','../../config/logger','api','moment','bluebird','request-promise','path','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview'];(function(_0x88fa0c,_0x4b6bae){var _0x94ad1c=function(_0x88cc54){while(--_0x88cc54){_0x88fa0c['push'](_0x88fa0c['shift']());}};_0x94ad1c(++_0x4b6bae);}(_0x250e,0x1b8));var _0xe250=function(_0x550419,_0x621497){_0x550419=_0x550419-0x0;var _0x15c0fd=_0x250e[_0x550419];return _0x15c0fd;};'use strict';var _=require('lodash');var util=require(_0xe250('0x0'));var logger=require(_0xe250('0x1'))(_0xe250('0x2'));var moment=require(_0xe250('0x3'));var BPromise=require(_0xe250('0x4'));var rp=require(_0xe250('0x5'));var fs=require('fs');var path=require(_0xe250('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe250('0x7'));module['exports']=function(_0x2eec2a,_0x3ef767){return _0x2eec2a[_0xe250('0x8')](_0xe250('0x9'),attributes,{'tableName':_0xe250('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafef=['util','api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash'];(function(_0x1256f1,_0x116f74){var _0x175590=function(_0x76765c){while(--_0x76765c){_0x1256f1['push'](_0x1256f1['shift']());}};_0x175590(++_0x116f74);}(_0xafef,0x113));var _0xfafe=function(_0x448899,_0x201063){_0x448899=_0x448899-0x0;var _0x4a518e=_0xafef[_0x448899];return _0x4a518e;};'use strict';var _=require(_0xfafe('0x0'));var util=require(_0xfafe('0x1'));var logger=require('../../config/logger')(_0xfafe('0x2'));var moment=require(_0xfafe('0x3'));var BPromise=require(_0xfafe('0x4'));var rp=require(_0xfafe('0x5'));var fs=require('fs');var path=require(_0xfafe('0x6'));var rimraf=require('rimraf');var config=require(_0xfafe('0x7'));var attributes=require(_0xfafe('0x8'));module[_0xfafe('0x9')]=function(_0x18bed7,_0x36d561){return _0x18bed7['define'](_0xfafe('0xa'),attributes,{'tableName':_0xfafe('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 2f62830..7ca4682 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 _0xe2e3=['CreateReportAgentPreview','ReportAgentPreview','create','body','raw','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x1b964a,_0x40fdc2){var _0x2559fa=function(_0x1afe3e){while(--_0x1afe3e){_0x1b964a['push'](_0x1b964a['shift']());}};_0x2559fa(++_0x40fdc2);}(_0xe2e3,0x1b6));var _0x3e2e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe2e3[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x3e2e('0x0'));var util=require('util');var moment=require(_0x3e2e('0x1'));var BPromise=require(_0x3e2e('0x2'));var rs=require(_0x3e2e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3e2e('0x4'));var logger=require(_0x3e2e('0x5'))('rpc');var config=require(_0x3e2e('0x6'));var jayson=require(_0x3e2e('0x7'));var client=jayson[_0x3e2e('0x8')][_0x3e2e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xede072,_0x50b6c2,_0x38d73c){return new BPromise(function(_0x18efb9,_0x4320b4){return client[_0x3e2e('0xa')](_0xede072,_0x38d73c)[_0x3e2e('0xb')](function(_0x26a6b0){logger[_0x3e2e('0xc')](_0x3e2e('0xd'),_0x50b6c2,'request\x20sent');logger[_0x3e2e('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x50b6c2,_0x3e2e('0xf'),JSON[_0x3e2e('0x10')](_0x26a6b0));if(_0x26a6b0[_0x3e2e('0x11')]){if(_0x26a6b0[_0x3e2e('0x11')][_0x3e2e('0x12')]===0x1f4){logger[_0x3e2e('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x50b6c2,_0x26a6b0[_0x3e2e('0x11')][_0x3e2e('0x13')]);return _0x4320b4(_0x26a6b0['error'][_0x3e2e('0x13')]);}logger[_0x3e2e('0x11')](_0x3e2e('0xd'),_0x50b6c2,_0x26a6b0['error'][_0x3e2e('0x13')]);return _0x18efb9(_0x26a6b0[_0x3e2e('0x11')][_0x3e2e('0x13')]);}else{logger[_0x3e2e('0xc')](_0x3e2e('0xd'),_0x50b6c2,_0x3e2e('0xf'));_0x18efb9(_0x26a6b0[_0x3e2e('0x14')][_0x3e2e('0x13')]);}})['catch'](function(_0x2f0293){logger[_0x3e2e('0x11')](_0x3e2e('0xd'),_0x50b6c2,_0x2f0293);_0x4320b4(_0x2f0293);});});}exports[_0x3e2e('0x15')]=function(_0x53a141){var _0x12cb3f=this;return new Promise(function(_0x6fe2a5,_0x57f7b2){return db[_0x3e2e('0x16')][_0x3e2e('0x17')](_0x53a141[_0x3e2e('0x18')],{'raw':_0x53a141['options']?_0x53a141['options'][_0x3e2e('0x19')]===undefined?!![]:![]:!![]})[_0x3e2e('0xb')](function(_0x42b7b2){logger[_0x3e2e('0xc')](_0x3e2e('0x15'),_0x53a141);logger['debug']('CreateReportAgentPreview',_0x53a141,JSON[_0x3e2e('0x10')](_0x42b7b2));_0x6fe2a5(_0x42b7b2);})[_0x3e2e('0x1a')](function(_0x2a75fa){logger[_0x3e2e('0x11')](_0x3e2e('0x15'),_0x2a75fa[_0x3e2e('0x13')],_0x53a141);_0x57f7b2(_0x12cb3f[_0x3e2e('0x11')](0x1f4,_0x2a75fa[_0x3e2e('0x13')]));});});}; \ No newline at end of file +var _0xe833=['stringify','error','code','message','info','result','catch','ReportAgentPreview','create','body','options','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x413bed,_0x163653){var _0x4ae578=function(_0xeb836d){while(--_0xeb836d){_0x413bed['push'](_0x413bed['shift']());}};_0x4ae578(++_0x163653);}(_0xe833,0x1c6));var _0x3e83=function(_0x10ec04,_0x2f60e1){_0x10ec04=_0x10ec04-0x0;var _0x3c0678=_0xe833[_0x10ec04];return _0x3c0678;};'use strict';var _=require(_0x3e83('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3e83('0x1'));var rs=require(_0x3e83('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e83('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e83('0x4'))(_0x3e83('0x5'));var config=require(_0x3e83('0x6'));var jayson=require(_0x3e83('0x7'));var client=jayson['client'][_0x3e83('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xce29b6,_0x41e4d6,_0x2fe4dc){return new BPromise(function(_0x4f8089,_0x35fd1e){return client[_0x3e83('0x9')](_0xce29b6,_0x2fe4dc)[_0x3e83('0xa')](function(_0x10ec41){logger['info'](_0x3e83('0xb'),_0x41e4d6,_0x3e83('0xc'));logger['debug'](_0x3e83('0xd'),_0x41e4d6,_0x3e83('0xc'),JSON[_0x3e83('0xe')](_0x10ec41));if(_0x10ec41[_0x3e83('0xf')]){if(_0x10ec41[_0x3e83('0xf')][_0x3e83('0x10')]===0x1f4){logger[_0x3e83('0xf')](_0x3e83('0xb'),_0x41e4d6,_0x10ec41[_0x3e83('0xf')]['message']);return _0x35fd1e(_0x10ec41['error'][_0x3e83('0x11')]);}logger[_0x3e83('0xf')](_0x3e83('0xb'),_0x41e4d6,_0x10ec41[_0x3e83('0xf')]['message']);return _0x4f8089(_0x10ec41[_0x3e83('0xf')][_0x3e83('0x11')]);}else{logger[_0x3e83('0x12')](_0x3e83('0xb'),_0x41e4d6,_0x3e83('0xc'));_0x4f8089(_0x10ec41[_0x3e83('0x13')][_0x3e83('0x11')]);}})[_0x3e83('0x14')](function(_0x1a9135){logger[_0x3e83('0xf')](_0x3e83('0xb'),_0x41e4d6,_0x1a9135);_0x35fd1e(_0x1a9135);});});}exports['CreateReportAgentPreview']=function(_0x5c9fda){var _0x17217f=this;return new Promise(function(_0x5c5426,_0x17954a){return db[_0x3e83('0x15')][_0x3e83('0x16')](_0x5c9fda[_0x3e83('0x17')],{'raw':_0x5c9fda[_0x3e83('0x18')]?_0x5c9fda['options'][_0x3e83('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4d4102){logger[_0x3e83('0x12')]('CreateReportAgentPreview',_0x5c9fda);logger['debug']('CreateReportAgentPreview',_0x5c9fda,JSON[_0x3e83('0xe')](_0x4d4102));_0x5c5426(_0x4d4102);})[_0x3e83('0x14')](function(_0x4fd0ff){logger[_0x3e83('0xf')]('CreateReportAgentPreview',_0x4fd0ff[_0x3e83('0x11')],_0x5c9fda);_0x17954a(_0x17217f['error'](0x1f4,_0x4fd0ff[_0x3e83('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 122e4a6..f80839c 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 _0x605a=['agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/outbound','put','/agents/:id/capacity'];(function(_0x127c11,_0x410c76){var _0x36f240=function(_0x53cc50){while(--_0x53cc50){_0x127c11['push'](_0x127c11['shift']());}};_0x36f240(++_0x410c76);}(_0x605a,0x126));var _0xa605=function(_0x7f008a,_0x14afbc){_0x7f008a=_0x7f008a-0x0;var _0xb0eb1=_0x605a[_0x7f008a];return _0xb0eb1;};'use strict';var multer=require(_0xa605('0x0'));var util=require(_0xa605('0x1'));var path=require(_0xa605('0x2'));var express=require(_0xa605('0x3'));var router=express[_0xa605('0x4')]();var auth=require(_0xa605('0x5'));var controller=require(_0xa605('0x6'));router['get'](_0xa605('0x7'),auth[_0xa605('0x8')](),controller[_0xa605('0x9')]);router[_0xa605('0xa')](_0xa605('0xb'),auth[_0xa605('0x8')](),controller[_0xa605('0xc')]);router[_0xa605('0xa')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xa605('0x8')](),controller[_0xa605('0xd')]);router[_0xa605('0xa')](_0xa605('0xe'),auth[_0xa605('0x8')](),controller['voiceQueues']);router['get'](_0xa605('0xf'),auth[_0xa605('0x8')](),controller[_0xa605('0x10')]);router[_0xa605('0xa')](_0xa605('0x11'),auth[_0xa605('0x8')](),controller[_0xa605('0x12')]);router[_0xa605('0xa')](_0xa605('0x13'),auth[_0xa605('0x8')](),controller['mailAccounts']);router['get'](_0xa605('0x14'),auth[_0xa605('0x8')](),controller[_0xa605('0x15')]);router[_0xa605('0xa')](_0xa605('0x16'),auth[_0xa605('0x8')](),controller[_0xa605('0x17')]);router[_0xa605('0xa')]('/whatsapp/queues',auth['isAuthenticated'](),controller[_0xa605('0x18')]);router[_0xa605('0xa')](_0xa605('0x19'),auth[_0xa605('0x8')](),controller[_0xa605('0x1a')]);router[_0xa605('0xa')](_0xa605('0x1b'),auth[_0xa605('0x8')](),controller[_0xa605('0x1c')]);router['get'](_0xa605('0x1d'),auth[_0xa605('0x8')](),controller['voiceQueuesChannels']);router[_0xa605('0xa')](_0xa605('0x1e'),auth['isAuthenticated'](),controller[_0xa605('0x1f')]);router['get'](_0xa605('0x20'),auth[_0xa605('0x8')](),controller['voiceQueuesChannelHangup']);router['get'](_0xa605('0x21'),auth[_0xa605('0x8')](),controller[_0xa605('0x22')]);router['get']('/voice/queues/:id',auth[_0xa605('0x8')](),controller['showVoiceQueues']);router[_0xa605('0xa')](_0xa605('0x23'),auth[_0xa605('0x8')](),controller['outbound']);router['get']('/outbound/channels',auth[_0xa605('0x8')](),controller['outboundChannels']);router[_0xa605('0xa')]('/agents',auth[_0xa605('0x8')](),controller['agents']);router[_0xa605('0x24')](_0xa605('0x25'),auth[_0xa605('0x8')](),controller[_0xa605('0x26')]);router[_0xa605('0xa')](_0xa605('0x27'),auth[_0xa605('0x8')](),controller['telephones']);router[_0xa605('0xa')](_0xa605('0x28'),auth[_0xa605('0x8')](),controller[_0xa605('0x29')]);router[_0xa605('0xa')](_0xa605('0x2a'),auth[_0xa605('0x8')](),controller[_0xa605('0x2b')]);router['get']('/fax/accounts',auth[_0xa605('0x8')](),controller[_0xa605('0x2c')]);router[_0xa605('0xa')](_0xa605('0x2d'),auth[_0xa605('0x8')](),controller[_0xa605('0x2e')]);router[_0xa605('0xa')](_0xa605('0x2f'),auth[_0xa605('0x8')](),controller[_0xa605('0x30')]);router[_0xa605('0xa')](_0xa605('0x31'),auth[_0xa605('0x8')](),controller[_0xa605('0x32')]);router[_0xa605('0xa')](_0xa605('0x33'),auth[_0xa605('0x8')](),controller[_0xa605('0x34')]);router[_0xa605('0xa')](_0xa605('0x35'),auth[_0xa605('0x8')](),controller[_0xa605('0x36')]);router[_0xa605('0xa')](_0xa605('0x37'),auth[_0xa605('0x8')](),controller[_0xa605('0x38')]);router[_0xa605('0x39')](_0xa605('0x3a'),auth[_0xa605('0x8')](),controller['queueNotify'](_0xa605('0x3b')));router[_0xa605('0xa')](_0xa605('0x3c'),auth['isAuthenticated'](),controller['showMailQueues']);router[_0xa605('0x39')](_0xa605('0x3d'),auth[_0xa605('0x8')](),controller[_0xa605('0x3e')](_0xa605('0x3f')));router[_0xa605('0xa')](_0xa605('0x40'),auth[_0xa605('0x8')](),controller[_0xa605('0x41')]);router['post'](_0xa605('0x42'),auth[_0xa605('0x8')](),controller[_0xa605('0x3e')](_0xa605('0x43')));router[_0xa605('0xa')](_0xa605('0x44'),auth[_0xa605('0x8')](),controller[_0xa605('0x45')]);router[_0xa605('0x39')](_0xa605('0x46'),auth['isAuthenticated'](),controller['queueNotify'](_0xa605('0x47')));router['get'](_0xa605('0x48'),auth[_0xa605('0x8')](),controller['showOpenchannelQueues']);router['post'](_0xa605('0x49'),auth[_0xa605('0x8')](),controller[_0xa605('0x3e')](_0xa605('0x4a')));router['post'](_0xa605('0x4b'),auth[_0xa605('0x8')](),controller[_0xa605('0x3e')](_0xa605('0x4c')));router[_0xa605('0xa')](_0xa605('0x4d'),auth[_0xa605('0x8')](),controller[_0xa605('0x4e')]);router['get'](_0xa605('0x4f'),auth[_0xa605('0x8')](),controller[_0xa605('0x50')]);router[_0xa605('0x39')](_0xa605('0x51'),auth['isAuthenticated'](),controller[_0xa605('0x52')]);module['exports']=router; \ No newline at end of file +var _0x884e=['/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','./rpc.controller','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','get','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x884e,0x91));var _0xe884=function(_0x4a537b,_0x10055f){_0x4a537b=_0x4a537b-0x0;var _0x249efb=_0x884e[_0x4a537b];return _0x249efb;};'use strict';var multer=require(_0xe884('0x0'));var util=require(_0xe884('0x1'));var path=require('path');var express=require(_0xe884('0x2'));var router=express[_0xe884('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0xe884('0x4'));router['get'](_0xe884('0x5'),auth['isAuthenticated'](),controller[_0xe884('0x6')]);router['get'](_0xe884('0x7'),auth[_0xe884('0x8')](),controller[_0xe884('0x9')]);router[_0xe884('0xa')](_0xe884('0xb'),auth[_0xe884('0x8')](),controller[_0xe884('0xc')]);router[_0xe884('0xa')](_0xe884('0xd'),auth[_0xe884('0x8')](),controller[_0xe884('0xe')]);router[_0xe884('0xa')](_0xe884('0xf'),auth['isAuthenticated'](),controller[_0xe884('0x10')]);router[_0xe884('0xa')](_0xe884('0x11'),auth[_0xe884('0x8')](),controller[_0xe884('0x12')]);router['get']('/mail/accounts',auth[_0xe884('0x8')](),controller[_0xe884('0x13')]);router[_0xe884('0xa')](_0xe884('0x14'),auth[_0xe884('0x8')](),controller['openchannelQueues']);router['get'](_0xe884('0x15'),auth[_0xe884('0x8')](),controller[_0xe884('0x16')]);router[_0xe884('0xa')](_0xe884('0x17'),auth['isAuthenticated'](),controller[_0xe884('0x18')]);router['get'](_0xe884('0x19'),auth['isAuthenticated'](),controller[_0xe884('0x1a')]);router[_0xe884('0xa')](_0xe884('0x1b'),auth[_0xe884('0x8')](),controller[_0xe884('0x1c')]);router[_0xe884('0xa')](_0xe884('0x1d'),auth['isAuthenticated'](),controller[_0xe884('0x1e')]);router[_0xe884('0xa')](_0xe884('0x1f'),auth[_0xe884('0x8')](),controller[_0xe884('0x20')]);router[_0xe884('0xa')](_0xe884('0x21'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0xe884('0xa')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0xe884('0x22')]);router[_0xe884('0xa')](_0xe884('0x23'),auth['isAuthenticated'](),controller[_0xe884('0x24')]);router[_0xe884('0xa')](_0xe884('0x25'),auth[_0xe884('0x8')](),controller[_0xe884('0x26')]);router[_0xe884('0xa')](_0xe884('0x27'),auth[_0xe884('0x8')](),controller['outboundChannels']);router[_0xe884('0xa')](_0xe884('0x28'),auth[_0xe884('0x8')](),controller[_0xe884('0x29')]);router[_0xe884('0x2a')](_0xe884('0x2b'),auth[_0xe884('0x8')](),controller[_0xe884('0x2c')]);router['get'](_0xe884('0x2d'),auth['isAuthenticated'](),controller[_0xe884('0x2e')]);router[_0xe884('0xa')](_0xe884('0x2f'),auth[_0xe884('0x8')](),controller[_0xe884('0x30')]);router[_0xe884('0xa')](_0xe884('0x31'),auth['isAuthenticated'](),controller['campaigns']);router[_0xe884('0xa')](_0xe884('0x32'),auth[_0xe884('0x8')](),controller[_0xe884('0x33')]);router['get'](_0xe884('0x34'),auth[_0xe884('0x8')](),controller[_0xe884('0x35')]);router['get'](_0xe884('0x36'),auth[_0xe884('0x8')](),controller[_0xe884('0x37')]);router[_0xe884('0xa')](_0xe884('0x38'),auth[_0xe884('0x8')](),controller['openchannelQueuesWaitingInteractions']);router['get']('/sms/queues/waitinginteractions',auth[_0xe884('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0xe884('0xa')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xe884('0x39')]);router[_0xe884('0xa')](_0xe884('0x3a'),auth[_0xe884('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0xe884('0x3b')](_0xe884('0x3c'),auth['isAuthenticated'](),controller[_0xe884('0x3d')]('mail'));router['get']('/mail/queues/:id',auth[_0xe884('0x8')](),controller['showMailQueues']);router[_0xe884('0x3b')](_0xe884('0x3e'),auth[_0xe884('0x8')](),controller[_0xe884('0x3d')](_0xe884('0x3f')));router[_0xe884('0xa')](_0xe884('0x40'),auth[_0xe884('0x8')](),controller[_0xe884('0x41')]);router[_0xe884('0x3b')]('/fax/queues/:id/notify',auth[_0xe884('0x8')](),controller['queueNotify']('fax'));router[_0xe884('0xa')](_0xe884('0x42'),auth[_0xe884('0x8')](),controller[_0xe884('0x43')]);router[_0xe884('0x3b')](_0xe884('0x44'),auth[_0xe884('0x8')](),controller['queueNotify'](_0xe884('0x45')));router[_0xe884('0xa')](_0xe884('0x46'),auth[_0xe884('0x8')](),controller[_0xe884('0x47')]);router[_0xe884('0x3b')](_0xe884('0x48'),auth[_0xe884('0x8')](),controller['queueNotify']('sms'));router[_0xe884('0x3b')](_0xe884('0x49'),auth[_0xe884('0x8')](),controller[_0xe884('0x3d')](_0xe884('0x4a')));router[_0xe884('0xa')](_0xe884('0x4b'),auth[_0xe884('0x8')](),controller[_0xe884('0x4c')]);router['get']('/whatsapp/queues/:id',auth[_0xe884('0x8')](),controller['showWhatsappQueues']);router[_0xe884('0x3b')](_0xe884('0x4d'),auth[_0xe884('0x8')](),controller[_0xe884('0x4e')]);module[_0xe884('0x4f')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 85f59cd..b09b928 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 _0xba6c=['client','http','then','error','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','voiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','query','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','format','SIP/%s','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','\x20Message\x20not\x20found','update','Interaction','queue','MessageId','InteractionId','TransferReport','create','Start','channel','User','Agent\x20not\x20found','From','agentTransferTimeout','*,*,*,*','bluebird','moment','lodash','util','../../config/logger','api','jayson/promise'];(function(_0x4f8d9c,_0x48cd7b){var _0x2400f5=function(_0x44ad8d){while(--_0x44ad8d){_0x4f8d9c['push'](_0x4f8d9c['shift']());}};_0x2400f5(++_0x48cd7b);}(_0xba6c,0x6e));var _0xcba6=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0xba6c[_0x41382c];return _0x4da35b;};'use strict';var BPromise=require(_0xcba6('0x0'));var moment=require(_0xcba6('0x1'));var _=require(_0xcba6('0x2'));var util=require(_0xcba6('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xcba6('0x4'))(_0xcba6('0x5'));var jayson=require(_0xcba6('0x6'));var amiClient=jayson[_0xcba6('0x7')][_0xcba6('0x8')]({'port':0x232a});var mailClient=jayson[_0xcba6('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0xcba6('0x7')][_0xcba6('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x30886e,_0x52f935,_0x53f7d7){return new BPromise(function(_0xaafb23,_0x18c6dc){var _0x292dd6=_0x53f7d7?_0x53f7d7:amiClient;return _0x292dd6['request'](_0x30886e,_0x52f935)[_0xcba6('0x9')](function(_0x205847){if(_0x205847[_0xcba6('0xa')]){if(_0x205847[_0xcba6('0xa')]['code']===0x1f4){return _0x18c6dc(_0x205847[_0xcba6('0xa')][_0xcba6('0xb')]);}return _0xaafb23(_0x205847[_0xcba6('0xa')][_0xcba6('0xb')]);}else{_0xaafb23(_0x205847[_0xcba6('0xc')]);}})[_0xcba6('0xd')](function(_0x11e695){_0x18c6dc(_0x11e695);});});}function respondWithResult(_0x47d8b7,_0x2ee69e){_0x2ee69e=_0x2ee69e||0xc8;return function(_0x98a922){if(_0x98a922){return _0x47d8b7[_0xcba6('0xe')](_0x2ee69e)['json'](_0x98a922);}return _0x47d8b7[_0xcba6('0xf')](0x194);};}function handleError(_0x3c56d5,_0x1a031b){_0x1a031b=_0x1a031b||0x1f4;return function(_0x367f44){logger['error'](_0x367f44[_0xcba6('0x10')]);if(_0x367f44[_0xcba6('0x11')]){delete _0x367f44['name'];}_0x3c56d5[_0xcba6('0xe')](_0x1a031b)[_0xcba6('0x12')](_0x367f44);};}function findById(_0x31328b){return function(_0x58abef){if(!_['isNil'](_0x31328b)&&!_[_0xcba6('0x13')](_0x58abef)&&!_['isNil'](_0x58abef[_0xcba6('0x14')])){return _[_0xcba6('0x15')](_0x58abef[_0xcba6('0x14')],function(_0x1236db){return _0x1236db['id']==_0x31328b;});}return null;};}exports[_0xcba6('0x16')]=function(_0x4074a7,_0x1a805f){return respondWithRpcPromise(_0xcba6('0x17'),_0x4074a7['query'])['then'](respondWithResult(_0x1a805f,null))['catch'](handleError(_0x1a805f,null));};exports[_0xcba6('0x18')]=function(_0x17414f,_0xf4bf40){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xcba6('0x19')](_0x17414f['query'],_0x17414f[_0xcba6('0x1a')]))[_0xcba6('0x9')](respondWithResult(_0xf4bf40,null))[_0xcba6('0xd')](handleError(_0xf4bf40,null));};exports['voiceChannelStopMixMonitor']=function(_0x332a6f,_0x2bfa98){return respondWithRpcPromise(_0xcba6('0x1b'),_[_0xcba6('0x19')](_0x332a6f[_0xcba6('0x1c')],_0x332a6f[_0xcba6('0x1a')]))[_0xcba6('0x9')](respondWithResult(_0x2bfa98,null))[_0xcba6('0xd')](handleError(_0x2bfa98,null));};exports[_0xcba6('0x1d')]=function(_0x10224e,_0xc56f09){return respondWithRpcPromise(_0xcba6('0x1e'),_0x10224e[_0xcba6('0x1c')])[_0xcba6('0x9')](respondWithResult(_0xc56f09,null))[_0xcba6('0xd')](handleError(_0xc56f09,null));};exports[_0xcba6('0x1f')]=function(_0x2e94e3,_0x3304d9){return respondWithRpcPromise('VoiceQueues',_0x2e94e3[_0xcba6('0x1c')])[_0xcba6('0x9')](findById(_0x2e94e3[_0xcba6('0x1a')]['id']))[_0xcba6('0x9')](respondWithResult(_0x3304d9,null))[_0xcba6('0xd')](handleError(_0x3304d9,null));};exports[_0xcba6('0x20')]=function(_0x27b7c5,_0x3d832e){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xcba6('0x19')](_0x27b7c5[_0xcba6('0x1c')],_0x27b7c5[_0xcba6('0x1a')]))['then'](respondWithResult(_0x3d832e,null))['catch'](handleError(_0x3d832e,null));};exports[_0xcba6('0x21')]=function(_0x8f33a2,_0xb38f72){return respondWithRpcPromise(_0xcba6('0x22'),_0x8f33a2[_0xcba6('0x1c')])[_0xcba6('0x9')](respondWithResult(_0xb38f72,null))[_0xcba6('0xd')](handleError(_0xb38f72,null));};exports['voiceQueuesChannel']=function(_0xaa7a64,_0x51dd2d){return respondWithRpcPromise(_0xcba6('0x23'),_[_0xcba6('0x19')](_0xaa7a64[_0xcba6('0x1c')],_0xaa7a64['params']))[_0xcba6('0x9')](respondWithResult(_0x51dd2d,null))[_0xcba6('0xd')](handleError(_0x51dd2d,null));};exports[_0xcba6('0x24')]=function(_0x89c9b7,_0x46c141){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xcba6('0x19')](_0x89c9b7['query'],_0x89c9b7['params']))[_0xcba6('0x9')](respondWithResult(_0x46c141,null))[_0xcba6('0xd')](handleError(_0x46c141,null));};exports['voiceQueuesChannelRedirect']=function(_0x3bd490,_0x458728){return respondWithRpcPromise(_0xcba6('0x25'),_[_0xcba6('0x19')](_0x3bd490['query'],_0x3bd490['params']))[_0xcba6('0x9')](respondWithResult(_0x458728,null))['catch'](handleError(_0x458728,null));};exports[_0xcba6('0x26')]=function(_0x2e47cf,_0x128989){return respondWithRpcPromise(_0xcba6('0x27'),_0x2e47cf[_0xcba6('0x1c')])[_0xcba6('0x9')](respondWithResult(_0x128989,null))[_0xcba6('0xd')](handleError(_0x128989,null));};exports[_0xcba6('0x28')]=function(_0x3205c5,_0xf72608){return respondWithRpcPromise(_0xcba6('0x29'),_0x3205c5[_0xcba6('0x1c')])[_0xcba6('0x9')](respondWithResult(_0xf72608,null))[_0xcba6('0xd')](handleError(_0xf72608,null));};exports[_0xcba6('0x2a')]=function(_0x16326a,_0x1643c5){var _0x2b1cf9;return respondWithRpcPromise(_0xcba6('0x2b'),_0x16326a[_0xcba6('0x1c')])[_0xcba6('0x9')](function(_0x353f2d){_0x2b1cf9=_0x353f2d;return respondWithRpcPromise(_0xcba6('0x2b'),_0x16326a[_0xcba6('0x1c')],routingClient);})[_0xcba6('0x9')](function(_0xb688a){return _['merge']({},_0xb688a,_0x2b1cf9);})['then'](respondWithResult(_0x1643c5,null))[_0xcba6('0xd')](handleError(_0x1643c5,null));};exports[_0xcba6('0x2c')]=function(_0x428f19,_0x4ac9b8){if(_0x428f19[_0xcba6('0x2d')]&&_0x428f19[_0xcba6('0x2d')][_0xcba6('0x2e')]&&_0x428f19[_0xcba6('0x2f')]&&_0x428f19[_0xcba6('0x2f')][_0xcba6('0x11')]){for(var _0x417414 in _0x428f19[_0xcba6('0x2d')][_0xcba6('0x2e')]){if(_0x428f19[_0xcba6('0x2d')][_0xcba6('0x2e')][_0xcba6('0x30')](_0x417414)){db['MemberReport']['findAll']({'where':{'channel':_0x417414,'membername':_0x428f19[_0xcba6('0x2f')]['name'],'type':_0xcba6('0x31'),'exitAt':null,'uniqueid':_0x428f19['body'][_0xcba6('0x2e')][_0x417414]&&_0x428f19['body'][_0xcba6('0x2e')][_0x417414][_0xcba6('0x32')]?{'$notIn':_0x428f19['body'][_0xcba6('0x2e')][_0x417414]}:{'$ne':null}}})[_0xcba6('0x9')](function(_0x3e1e7f){var _0x1aa8aa=moment()['format'](_0xcba6('0x33'));for(var _0x487294=0x0,_0x17951c=_0x3e1e7f[_0xcba6('0x32')];_0x487294<_0x17951c;_0x487294+=0x1){_0x3e1e7f[_0x487294][_0xcba6('0x34')]({'exitAt':_0x1aa8aa});}});for(var _0x446141=0x0;_0x446141<_0x428f19[_0xcba6('0x2d')]['interaction'][_0x417414][_0xcba6('0x32')];_0x446141+=0x1){db[_0xcba6('0x35')]['findOrCreate']({'where':{'channel':_0x417414,'membername':_0x428f19[_0xcba6('0x2f')]['name'],'type':_0xcba6('0x31'),'uniqueid':_0x428f19[_0xcba6('0x2d')]['interaction'][_0x417414][_0x446141],'exitAt':null},'defaults':{'channel':_0x417414,'membername':_0x428f19['user'][_0xcba6('0x11')],'interface':_[_0xcba6('0x13')](_0x428f19[_0xcba6('0x2f')]['interface'])?util[_0xcba6('0x36')](_0xcba6('0x37'),_0x428f19[_0xcba6('0x2f')][_0xcba6('0x11')]):_0x428f19[_0xcba6('0x2f')][_0xcba6('0x38')],'type':'INTERACTION','enterAt':moment()[_0xcba6('0x36')](_0xcba6('0x33')),'role':_0xcba6('0x39'),'internal':_0x428f19['user'][_0xcba6('0x3a')],'uniqueid':_0x428f19[_0xcba6('0x2d')]['interaction'][_0x417414][_0x446141]}});}}}}return respondWithRpcPromise(_0xcba6('0x3b'),{'id':_0x428f19['params']['id'],'capacity':_0x428f19['body'][_0xcba6('0x3c')]},routingClient)[_0xcba6('0x9')](respondWithResult(_0x4ac9b8,null))[_0xcba6('0xd')](handleError(_0x4ac9b8,null));};exports[_0xcba6('0x3d')]=function(_0x282f54,_0x259ff2){return respondWithRpcPromise(_0xcba6('0x3e'),_0x282f54[_0xcba6('0x1c')])[_0xcba6('0x9')](respondWithResult(_0x259ff2,null))[_0xcba6('0xd')](handleError(_0x259ff2,null));};exports[_0xcba6('0x3f')]=function(_0x65ab05,_0x4667f1){return respondWithRpcPromise('Trunks',_0x65ab05[_0xcba6('0x1c')])[_0xcba6('0x9')](respondWithResult(_0x4667f1,null))[_0xcba6('0xd')](handleError(_0x4667f1,null));};exports[_0xcba6('0x40')]=function(_0x5dd2ac,_0x4bb3ac){return respondWithRpcPromise(_0xcba6('0x41'),_0x5dd2ac[_0xcba6('0x1c')])[_0xcba6('0x9')](respondWithResult(_0x4bb3ac,null))[_0xcba6('0xd')](handleError(_0x4bb3ac,null));};exports['chatQueues']=function(_0x45d7e3,_0x41aba5){return respondWithRpcPromise(_0xcba6('0x42'),_0x45d7e3[_0xcba6('0x1c')],routingClient)[_0xcba6('0x9')](respondWithResult(_0x41aba5,null))[_0xcba6('0xd')](handleError(_0x41aba5,null));};exports['showChatQueues']=function(_0x44f9ca,_0x230783){return respondWithRpcPromise(_0xcba6('0x42'),_0x44f9ca['query'],routingClient)['then'](findById(_0x44f9ca[_0xcba6('0x1a')]['id']))['then'](respondWithResult(_0x230783,null))[_0xcba6('0xd')](handleError(_0x230783,null));};exports[_0xcba6('0x43')]=function(_0x1d27b2,_0x533ada){return respondWithRpcPromise(_0xcba6('0x44'),_0x1d27b2[_0xcba6('0x1c')],routingClient)[_0xcba6('0x9')](respondWithResult(_0x533ada,null))[_0xcba6('0xd')](handleError(_0x533ada,null));};exports[_0xcba6('0x45')]=function(_0x3ccb6c,_0x14bf7c){return respondWithRpcPromise(_0xcba6('0x44'),_0x3ccb6c[_0xcba6('0x1c')],routingClient)[_0xcba6('0x9')](findById(_0x3ccb6c[_0xcba6('0x1a')]['id']))[_0xcba6('0x9')](respondWithResult(_0x14bf7c,null))[_0xcba6('0xd')](handleError(_0x14bf7c,null));};exports[_0xcba6('0x46')]=function(_0x2fff35,_0x143526){return respondWithRpcPromise('MailAccounts',_0x2fff35[_0xcba6('0x1c')],mailClient)['then'](respondWithResult(_0x143526,null))['catch'](handleError(_0x143526,null));};exports[_0xcba6('0x47')]=function(_0x2bb19a,_0x32ee60){return respondWithRpcPromise('OpenchannelQueues',_0x2bb19a[_0xcba6('0x1c')],routingClient)[_0xcba6('0x9')](respondWithResult(_0x32ee60,null))['catch'](handleError(_0x32ee60,null));};exports[_0xcba6('0x48')]=function(_0x42cc6c,_0x1fbb88){return respondWithRpcPromise(_0xcba6('0x49'),_0x42cc6c[_0xcba6('0x1c')],routingClient)[_0xcba6('0x9')](findById(_0x42cc6c[_0xcba6('0x1a')]['id']))[_0xcba6('0x9')](respondWithResult(_0x1fbb88,null))[_0xcba6('0xd')](handleError(_0x1fbb88,null));};exports[_0xcba6('0x4a')]=function(_0x14434f,_0x1bd23d){return respondWithRpcPromise('SmsQueues',_0x14434f['query'],routingClient)['then'](respondWithResult(_0x1bd23d,null))[_0xcba6('0xd')](handleError(_0x1bd23d,null));};exports[_0xcba6('0x4b')]=function(_0x129fc4,_0x65675d){return respondWithRpcPromise('SmsQueues',_0x129fc4[_0xcba6('0x1c')],routingClient)['then'](findById(_0x129fc4[_0xcba6('0x1a')]['id']))[_0xcba6('0x9')](respondWithResult(_0x65675d,null))['catch'](handleError(_0x65675d,null));};exports[_0xcba6('0x4c')]=function(_0x21605b,_0x13093a){return respondWithRpcPromise(_0xcba6('0x4d'),_0x21605b['query'],routingClient)[_0xcba6('0x9')](respondWithResult(_0x13093a,null))[_0xcba6('0xd')](handleError(_0x13093a,null));};exports[_0xcba6('0x4e')]=function(_0x4d5763,_0x448de9){return respondWithRpcPromise('WhatsappQueues',_0x4d5763[_0xcba6('0x1c')],routingClient)[_0xcba6('0x9')](findById(_0x4d5763[_0xcba6('0x1a')]['id']))[_0xcba6('0x9')](respondWithResult(_0x448de9,null))[_0xcba6('0xd')](handleError(_0x448de9,null));};exports['faxQueues']=function(_0x6886fa,_0x350fdf){return respondWithRpcPromise('FaxQueues',_0x6886fa[_0xcba6('0x1c')],routingClient)[_0xcba6('0x9')](respondWithResult(_0x350fdf,null))[_0xcba6('0xd')](handleError(_0x350fdf,null));};exports[_0xcba6('0x4f')]=function(_0x15a8e2,_0x1b8533){return respondWithRpcPromise(_0xcba6('0x50'),_0x15a8e2[_0xcba6('0x1c')],routingClient)['then'](findById(_0x15a8e2[_0xcba6('0x1a')]['id']))['then'](respondWithResult(_0x1b8533,null))[_0xcba6('0xd')](handleError(_0x1b8533,null));};exports[_0xcba6('0x51')]=function(_0x498472,_0x2cd414){return respondWithRpcPromise(_0xcba6('0x52'),_0x498472[_0xcba6('0x1c')])['then'](respondWithResult(_0x2cd414,null))['catch'](handleError(_0x2cd414,null));};exports[_0xcba6('0x53')]=function(_0x50bd9d,_0x3744f9){return respondWithRpcPromise(_0xcba6('0x54'),_0x50bd9d[_0xcba6('0x1c')],routingClient)['then'](respondWithResult(_0x3744f9,null))[_0xcba6('0xd')](handleError(_0x3744f9,null));};exports[_0xcba6('0x55')]=function(_0x11ddca,_0x59bbc4){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x11ddca[_0xcba6('0x1c')],routingClient)[_0xcba6('0x9')](respondWithResult(_0x59bbc4,null))['catch'](handleError(_0x59bbc4,null));};exports[_0xcba6('0x56')]=function(_0x3ac073,_0x2bb80f){return respondWithRpcPromise(_0xcba6('0x57'),_0x3ac073[_0xcba6('0x1c')],routingClient)[_0xcba6('0x9')](respondWithResult(_0x2bb80f,null))['catch'](handleError(_0x2bb80f,null));};exports['smsQueuesWaitingInteractions']=function(_0x2e4e30,_0x1b9c00){return respondWithRpcPromise(_0xcba6('0x58'),_0x2e4e30[_0xcba6('0x1c')],routingClient)[_0xcba6('0x9')](respondWithResult(_0x1b9c00,null))['catch'](handleError(_0x1b9c00,null));};exports[_0xcba6('0x59')]=function(_0x27e849,_0xff209d){return respondWithRpcPromise(_0xcba6('0x5a'),_0x27e849[_0xcba6('0x1c')],routingClient)[_0xcba6('0x9')](respondWithResult(_0xff209d,null))[_0xcba6('0xd')](handleError(_0xff209d,null));};exports['faxQueuesWaitingInteractions']=function(_0x36cbd4,_0x4c5e04){return respondWithRpcPromise(_0xcba6('0x5b'),_0x36cbd4[_0xcba6('0x1c')],routingClient)['then'](respondWithResult(_0x4c5e04,null))[_0xcba6('0xd')](handleError(_0x4c5e04,null));};exports[_0xcba6('0x5c')]=function(_0x3020ea){return function(_0x450fec,_0x1f107b){var _0x3e08fe,_0x5e0e8a;var _0x13cb07=_[_0xcba6('0x5d')](_0x3020ea);var _0x472dea=_0x3020ea===_0xcba6('0x5e')?_0xcba6('0x5f'):_0xcba6('0x60');return db[_0x13cb07+_0xcba6('0x61')][_0xcba6('0x62')]({'raw':!![],'where':{'id':_0x450fec['params']['id']}})[_0xcba6('0x9')](function(_0x8871c7){if(_[_0xcba6('0x13')](_0x8871c7)){throw new Error(_0x13cb07+_0xcba6('0x63'));}_0x3e08fe=_0x8871c7;return db[_0x13cb07+_0xcba6('0x64')][_0xcba6('0x62')]({'where':{'id':_0x450fec[_0xcba6('0x2d')][_0xcba6('0x65')]},'include':[{'model':db[_0x13cb07+'Interaction'],'as':'Interaction'},{'model':db[_0x13cb07+_0x472dea],'as':_0xcba6('0x60')}]});})['then'](function(_0x4331b3){if(_[_0xcba6('0x13')](_0x4331b3)){throw new Error(_0x13cb07+_0xcba6('0x66'));}_0x5e0e8a=_0x4331b3;return _0x4331b3[_0xcba6('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0xcba6('0x9')](function(){var _0x57cfbb={'uniqueid':_0x3020ea+'.'+_0x5e0e8a['id']+'.'+_0x5e0e8a[_0xcba6('0x68')]['id'],'FromUserId':_0x450fec[_0xcba6('0x2f')]['id'],'type':_0xcba6('0x69')};_0x57cfbb[_0x13cb07+_0xcba6('0x6a')]=_0x5e0e8a['id'];_0x57cfbb[_0x13cb07+_0xcba6('0x6b')]=_0x5e0e8a[_0xcba6('0x68')]['id'];_0x57cfbb['From'+_0x13cb07+_0x472dea+'Id']=_0x5e0e8a[_0xcba6('0x60')]['id'];_0x57cfbb['To'+_0x13cb07+'QueueId']=_0x3e08fe['id'];return db[_0x13cb07+_0xcba6('0x6c')][_0xcba6('0x6d')](_0x57cfbb);})['then'](function(){return respondWithRpcPromise(_0xcba6('0x6e'),{'channel':_0x3020ea,'interaction':_0x5e0e8a['Interaction'],'message':_0x5e0e8a,'account':_0x5e0e8a[_0xcba6('0x60')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3e08fe[_0xcba6('0x11')]+','+(_0x5e0e8a[_0xcba6('0x60')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xcba6('0x9')](respondWithResult(_0x1f107b,null))[_0xcba6('0xd')](handleError(_0x1f107b,null));};};exports['agentNotify']=function(_0x461832,_0x106dad){var _0x5a90a4,_0x3e8ea4;if(_[_0xcba6('0x13')](_0x461832[_0xcba6('0x2d')][_0xcba6('0x6f')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x25f047=_0x461832[_0xcba6('0x2d')][_0xcba6('0x6f')];var _0x2bda9e=_[_0xcba6('0x5d')](_0x25f047);var _0x488862=_0x25f047==='chat'?_0xcba6('0x5f'):'Account';return db[_0xcba6('0x70')]['findOne']({'raw':!![],'where':{'id':_0x461832[_0xcba6('0x1a')]['id'],'role':'agent'}})['then'](function(_0x39ac0a){if(_[_0xcba6('0x13')](_0x39ac0a)){throw new Error(_0xcba6('0x71'));}_0x5a90a4=_0x39ac0a;return db[_0x2bda9e+'Message'][_0xcba6('0x62')]({'where':{'id':_0x461832[_0xcba6('0x2d')][_0xcba6('0x65')]},'include':[{'model':db[_0x2bda9e+_0xcba6('0x68')],'as':_0xcba6('0x68')},{'model':db[_0x2bda9e+_0x488862],'as':_0xcba6('0x60')}]});})['then'](function(_0x32dc66){if(_['isNil'](_0x32dc66)){throw new Error(_0x2bda9e+_0xcba6('0x66'));}_0x3e8ea4=_0x32dc66;return _0x32dc66['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xcba6('0x9')](function(){var _0x2e5203={'uniqueid':_0x25f047+'.'+_0x3e8ea4['id']+'.'+_0x3e8ea4[_0xcba6('0x68')]['id'],'FromUserId':_0x461832['user']['id'],'type':_0xcba6('0x69'),'ToUserId':_0x5a90a4['id']};_0x2e5203[_0x2bda9e+_0xcba6('0x6a')]=_0x3e8ea4['id'];_0x2e5203[_0x2bda9e+'InteractionId']=_0x3e8ea4['Interaction']['id'];_0x2e5203[_0xcba6('0x72')+_0x2bda9e+_0x488862+'Id']=_0x3e8ea4[_0xcba6('0x60')]['id'];return db[_0x2bda9e+_0xcba6('0x6c')][_0xcba6('0x6d')](_0x2e5203);})['then'](function(){return respondWithRpcPromise(_0xcba6('0x6e'),{'channel':_0x25f047,'interaction':_0x3e8ea4[_0xcba6('0x68')],'message':_0x3e8ea4,'account':_0x3e8ea4[_0xcba6('0x60')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x5a90a4[_0xcba6('0x11')]+','+(_0x3e8ea4[_0xcba6('0x60')][_0xcba6('0x73')]||0x12c),'interval':_0xcba6('0x74')}]},routingClient);})[_0xcba6('0x9')](respondWithResult(_0x106dad,null))[_0xcba6('0xd')](handleError(_0x106dad,null));}; \ No newline at end of file +var _0xdcbe=['sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','params','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','Account','QueueId','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','Message','TransferReport','agentTransferTimeout','moment','lodash','util','../../config/logger','http','client','request','then','error','code','message','status','json'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xdcbe,0x164));var _0xedcb=function(_0x285387,_0x4a226d){_0x285387=_0x285387-0x0;var _0x3a18b6=_0xdcbe[_0x285387];return _0x3a18b6;};'use strict';var BPromise=require('bluebird');var moment=require(_0xedcb('0x0'));var _=require(_0xedcb('0x1'));var util=require(_0xedcb('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xedcb('0x3'))('api');var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xedcb('0x4')]({'port':0x232a});var mailClient=jayson[_0xedcb('0x5')][_0xedcb('0x4')]({'port':0x232b});var routingClient=jayson['client'][_0xedcb('0x4')]({'port':0x232c});function respondWithRpcPromise(_0x154aa6,_0x914aa5,_0x233eff){return new BPromise(function(_0x423136,_0x90cf51){var _0x40cc37=_0x233eff?_0x233eff:amiClient;return _0x40cc37[_0xedcb('0x6')](_0x154aa6,_0x914aa5)[_0xedcb('0x7')](function(_0x21fa5c){if(_0x21fa5c[_0xedcb('0x8')]){if(_0x21fa5c[_0xedcb('0x8')][_0xedcb('0x9')]===0x1f4){return _0x90cf51(_0x21fa5c[_0xedcb('0x8')][_0xedcb('0xa')]);}return _0x423136(_0x21fa5c[_0xedcb('0x8')][_0xedcb('0xa')]);}else{_0x423136(_0x21fa5c['result']);}})['catch'](function(_0x5ef797){_0x90cf51(_0x5ef797);});});}function respondWithResult(_0x5e8553,_0x1eb0b2){_0x1eb0b2=_0x1eb0b2||0xc8;return function(_0x3e72af){if(_0x3e72af){return _0x5e8553[_0xedcb('0xb')](_0x1eb0b2)[_0xedcb('0xc')](_0x3e72af);}return _0x5e8553[_0xedcb('0xd')](0x194);};}function handleError(_0x48f941,_0x252a24){_0x252a24=_0x252a24||0x1f4;return function(_0x5895c0){logger['error'](_0x5895c0['stack']);if(_0x5895c0['name']){delete _0x5895c0[_0xedcb('0xe')];}_0x48f941[_0xedcb('0xb')](_0x252a24)[_0xedcb('0xf')](_0x5895c0);};}function findById(_0x1ecde0){return function(_0x5c4f50){if(!_['isNil'](_0x1ecde0)&&!_[_0xedcb('0x10')](_0x5c4f50)&&!_['isNil'](_0x5c4f50[_0xedcb('0x11')])){return _[_0xedcb('0x12')](_0x5c4f50[_0xedcb('0x11')],function(_0x5419a9){return _0x5419a9['id']==_0x1ecde0;});}return null;};}exports[_0xedcb('0x13')]=function(_0x59f3bf,_0x6b9bb9){return respondWithRpcPromise(_0xedcb('0x14'),_0x59f3bf[_0xedcb('0x15')])[_0xedcb('0x7')](respondWithResult(_0x6b9bb9,null))[_0xedcb('0x16')](handleError(_0x6b9bb9,null));};exports[_0xedcb('0x17')]=function(_0x3c2513,_0x4581db){return respondWithRpcPromise(_0xedcb('0x18'),_[_0xedcb('0x19')](_0x3c2513[_0xedcb('0x15')],_0x3c2513['params']))['then'](respondWithResult(_0x4581db,null))[_0xedcb('0x16')](handleError(_0x4581db,null));};exports[_0xedcb('0x1a')]=function(_0x41616f,_0x10ef44){return respondWithRpcPromise(_0xedcb('0x1b'),_[_0xedcb('0x19')](_0x41616f['query'],_0x41616f['params']))[_0xedcb('0x7')](respondWithResult(_0x10ef44,null))[_0xedcb('0x16')](handleError(_0x10ef44,null));};exports['voiceQueues']=function(_0x352f75,_0x4bd339){return respondWithRpcPromise('VoiceQueues',_0x352f75['query'])['then'](respondWithResult(_0x4bd339,null))[_0xedcb('0x16')](handleError(_0x4bd339,null));};exports['showVoiceQueues']=function(_0xc80eff,_0x1671b5){return respondWithRpcPromise(_0xedcb('0x1c'),_0xc80eff[_0xedcb('0x15')])['then'](findById(_0xc80eff[_0xedcb('0x1d')]['id']))[_0xedcb('0x7')](respondWithResult(_0x1671b5,null))[_0xedcb('0x16')](handleError(_0x1671b5,null));};exports['voiceQueuesPreview']=function(_0x258133,_0x154f0a){return respondWithRpcPromise(_0xedcb('0x1e'),_[_0xedcb('0x19')](_0x258133['query'],_0x258133[_0xedcb('0x1d')]))['then'](respondWithResult(_0x154f0a,null))[_0xedcb('0x16')](handleError(_0x154f0a,null));};exports[_0xedcb('0x1f')]=function(_0x3cf3a8,_0x238560){return respondWithRpcPromise(_0xedcb('0x20'),_0x3cf3a8[_0xedcb('0x15')])[_0xedcb('0x7')](respondWithResult(_0x238560,null))[_0xedcb('0x16')](handleError(_0x238560,null));};exports[_0xedcb('0x21')]=function(_0x227d8c,_0x38ab87){return respondWithRpcPromise(_0xedcb('0x22'),_[_0xedcb('0x19')](_0x227d8c[_0xedcb('0x15')],_0x227d8c[_0xedcb('0x1d')]))[_0xedcb('0x7')](respondWithResult(_0x38ab87,null))['catch'](handleError(_0x38ab87,null));};exports[_0xedcb('0x23')]=function(_0x2dd67d,_0x59837a){return respondWithRpcPromise(_0xedcb('0x24'),_[_0xedcb('0x19')](_0x2dd67d[_0xedcb('0x15')],_0x2dd67d[_0xedcb('0x1d')]))[_0xedcb('0x7')](respondWithResult(_0x59837a,null))[_0xedcb('0x16')](handleError(_0x59837a,null));};exports['voiceQueuesChannelRedirect']=function(_0x4f1b98,_0x286e56){return respondWithRpcPromise(_0xedcb('0x25'),_[_0xedcb('0x19')](_0x4f1b98[_0xedcb('0x15')],_0x4f1b98[_0xedcb('0x1d')]))[_0xedcb('0x7')](respondWithResult(_0x286e56,null))['catch'](handleError(_0x286e56,null));};exports[_0xedcb('0x26')]=function(_0x32eb9e,_0x466bbe){return respondWithRpcPromise('Outbound',_0x32eb9e[_0xedcb('0x15')])['then'](respondWithResult(_0x466bbe,null))[_0xedcb('0x16')](handleError(_0x466bbe,null));};exports[_0xedcb('0x27')]=function(_0x215c8c,_0x418d81){return respondWithRpcPromise(_0xedcb('0x28'),_0x215c8c[_0xedcb('0x15')])[_0xedcb('0x7')](respondWithResult(_0x418d81,null))[_0xedcb('0x16')](handleError(_0x418d81,null));};exports[_0xedcb('0x29')]=function(_0x4b42a0,_0x6f88aa){var _0x1f3951;return respondWithRpcPromise(_0xedcb('0x2a'),_0x4b42a0[_0xedcb('0x15')])['then'](function(_0x528808){_0x1f3951=_0x528808;return respondWithRpcPromise(_0xedcb('0x2a'),_0x4b42a0[_0xedcb('0x15')],routingClient);})[_0xedcb('0x7')](function(_0x519b01){return _[_0xedcb('0x19')]({},_0x519b01,_0x1f3951);})[_0xedcb('0x7')](respondWithResult(_0x6f88aa,null))[_0xedcb('0x16')](handleError(_0x6f88aa,null));};exports[_0xedcb('0x2b')]=function(_0x202fe2,_0x2cc4ea){if(_0x202fe2[_0xedcb('0x2c')]&&_0x202fe2[_0xedcb('0x2c')][_0xedcb('0x2d')]&&_0x202fe2[_0xedcb('0x2e')]&&_0x202fe2[_0xedcb('0x2e')][_0xedcb('0xe')]){for(var _0x21f139 in _0x202fe2[_0xedcb('0x2c')][_0xedcb('0x2d')]){if(_0x202fe2[_0xedcb('0x2c')][_0xedcb('0x2d')][_0xedcb('0x2f')](_0x21f139)){db[_0xedcb('0x30')][_0xedcb('0x31')]({'where':{'channel':_0x21f139,'membername':_0x202fe2['user']['name'],'type':_0xedcb('0x32'),'exitAt':null,'uniqueid':_0x202fe2[_0xedcb('0x2c')][_0xedcb('0x2d')][_0x21f139]&&_0x202fe2[_0xedcb('0x2c')][_0xedcb('0x2d')][_0x21f139]['length']?{'$notIn':_0x202fe2['body'][_0xedcb('0x2d')][_0x21f139]}:{'$ne':null}}})[_0xedcb('0x7')](function(_0x2ee8c2){var _0x2c0f2b=moment()[_0xedcb('0x33')](_0xedcb('0x34'));for(var _0xd8dd25=0x0,_0x1216c7=_0x2ee8c2[_0xedcb('0x35')];_0xd8dd25<_0x1216c7;_0xd8dd25+=0x1){_0x2ee8c2[_0xd8dd25][_0xedcb('0x36')]({'exitAt':_0x2c0f2b});}});for(var _0x5c8785=0x0;_0x5c8785<_0x202fe2[_0xedcb('0x2c')][_0xedcb('0x2d')][_0x21f139][_0xedcb('0x35')];_0x5c8785+=0x1){db[_0xedcb('0x30')][_0xedcb('0x37')]({'where':{'channel':_0x21f139,'membername':_0x202fe2[_0xedcb('0x2e')]['name'],'type':_0xedcb('0x32'),'uniqueid':_0x202fe2[_0xedcb('0x2c')][_0xedcb('0x2d')][_0x21f139][_0x5c8785],'exitAt':null},'defaults':{'channel':_0x21f139,'membername':_0x202fe2[_0xedcb('0x2e')]['name'],'interface':_[_0xedcb('0x10')](_0x202fe2['user'][_0xedcb('0x38')])?util[_0xedcb('0x33')](_0xedcb('0x39'),_0x202fe2[_0xedcb('0x2e')][_0xedcb('0xe')]):_0x202fe2[_0xedcb('0x2e')][_0xedcb('0x38')],'type':_0xedcb('0x32'),'enterAt':moment()[_0xedcb('0x33')](_0xedcb('0x34')),'role':_0xedcb('0x3a'),'internal':_0x202fe2[_0xedcb('0x2e')][_0xedcb('0x3b')],'uniqueid':_0x202fe2[_0xedcb('0x2c')][_0xedcb('0x2d')][_0x21f139][_0x5c8785]}});}}}}return respondWithRpcPromise(_0xedcb('0x3c'),{'id':_0x202fe2[_0xedcb('0x1d')]['id'],'capacity':_0x202fe2['body'][_0xedcb('0x3d')]},routingClient)[_0xedcb('0x7')](respondWithResult(_0x2cc4ea,null))[_0xedcb('0x16')](handleError(_0x2cc4ea,null));};exports[_0xedcb('0x3e')]=function(_0x420c7b,_0x40a42a){return respondWithRpcPromise(_0xedcb('0x3f'),_0x420c7b[_0xedcb('0x15')])[_0xedcb('0x7')](respondWithResult(_0x40a42a,null))['catch'](handleError(_0x40a42a,null));};exports[_0xedcb('0x40')]=function(_0x5107da,_0x1d2908){return respondWithRpcPromise('Trunks',_0x5107da[_0xedcb('0x15')])[_0xedcb('0x7')](respondWithResult(_0x1d2908,null))['catch'](handleError(_0x1d2908,null));};exports[_0xedcb('0x41')]=function(_0x32a1c9,_0x33338b){return respondWithRpcPromise(_0xedcb('0x42'),_0x32a1c9[_0xedcb('0x15')])['then'](respondWithResult(_0x33338b,null))[_0xedcb('0x16')](handleError(_0x33338b,null));};exports[_0xedcb('0x43')]=function(_0x1d3516,_0x3b18e4){return respondWithRpcPromise(_0xedcb('0x44'),_0x1d3516[_0xedcb('0x15')],routingClient)[_0xedcb('0x7')](respondWithResult(_0x3b18e4,null))['catch'](handleError(_0x3b18e4,null));};exports[_0xedcb('0x45')]=function(_0x81f22,_0x2c8b0c){return respondWithRpcPromise(_0xedcb('0x44'),_0x81f22['query'],routingClient)[_0xedcb('0x7')](findById(_0x81f22[_0xedcb('0x1d')]['id']))[_0xedcb('0x7')](respondWithResult(_0x2c8b0c,null))[_0xedcb('0x16')](handleError(_0x2c8b0c,null));};exports[_0xedcb('0x46')]=function(_0x1dcb0a,_0x1da4ae){return respondWithRpcPromise('MailQueues',_0x1dcb0a[_0xedcb('0x15')],routingClient)[_0xedcb('0x7')](respondWithResult(_0x1da4ae,null))['catch'](handleError(_0x1da4ae,null));};exports[_0xedcb('0x47')]=function(_0x9d3d18,_0xf9b9ab){return respondWithRpcPromise(_0xedcb('0x48'),_0x9d3d18[_0xedcb('0x15')],routingClient)[_0xedcb('0x7')](findById(_0x9d3d18['params']['id']))[_0xedcb('0x7')](respondWithResult(_0xf9b9ab,null))[_0xedcb('0x16')](handleError(_0xf9b9ab,null));};exports[_0xedcb('0x49')]=function(_0x2b4850,_0x2b15b0){return respondWithRpcPromise(_0xedcb('0x4a'),_0x2b4850['query'],mailClient)[_0xedcb('0x7')](respondWithResult(_0x2b15b0,null))[_0xedcb('0x16')](handleError(_0x2b15b0,null));};exports[_0xedcb('0x4b')]=function(_0x11fe50,_0x54a527){return respondWithRpcPromise('OpenchannelQueues',_0x11fe50['query'],routingClient)['then'](respondWithResult(_0x54a527,null))[_0xedcb('0x16')](handleError(_0x54a527,null));};exports[_0xedcb('0x4c')]=function(_0xd5e8d0,_0x317b1d){return respondWithRpcPromise(_0xedcb('0x4d'),_0xd5e8d0['query'],routingClient)[_0xedcb('0x7')](findById(_0xd5e8d0['params']['id']))[_0xedcb('0x7')](respondWithResult(_0x317b1d,null))['catch'](handleError(_0x317b1d,null));};exports[_0xedcb('0x4e')]=function(_0x42ea66,_0x2c5798){return respondWithRpcPromise(_0xedcb('0x4f'),_0x42ea66[_0xedcb('0x15')],routingClient)[_0xedcb('0x7')](respondWithResult(_0x2c5798,null))[_0xedcb('0x16')](handleError(_0x2c5798,null));};exports[_0xedcb('0x50')]=function(_0x22da49,_0x2ca4f9){return respondWithRpcPromise('SmsQueues',_0x22da49['query'],routingClient)['then'](findById(_0x22da49[_0xedcb('0x1d')]['id']))[_0xedcb('0x7')](respondWithResult(_0x2ca4f9,null))[_0xedcb('0x16')](handleError(_0x2ca4f9,null));};exports['whatsappQueues']=function(_0xebfec8,_0x436ba6){return respondWithRpcPromise(_0xedcb('0x51'),_0xebfec8[_0xedcb('0x15')],routingClient)['then'](respondWithResult(_0x436ba6,null))[_0xedcb('0x16')](handleError(_0x436ba6,null));};exports[_0xedcb('0x52')]=function(_0x25744f,_0x3849fb){return respondWithRpcPromise(_0xedcb('0x51'),_0x25744f['query'],routingClient)[_0xedcb('0x7')](findById(_0x25744f[_0xedcb('0x1d')]['id']))[_0xedcb('0x7')](respondWithResult(_0x3849fb,null))['catch'](handleError(_0x3849fb,null));};exports[_0xedcb('0x53')]=function(_0x3e1827,_0x5eaff2){return respondWithRpcPromise(_0xedcb('0x54'),_0x3e1827[_0xedcb('0x15')],routingClient)[_0xedcb('0x7')](respondWithResult(_0x5eaff2,null))[_0xedcb('0x16')](handleError(_0x5eaff2,null));};exports[_0xedcb('0x55')]=function(_0x27cbf0,_0x5c012d){return respondWithRpcPromise(_0xedcb('0x54'),_0x27cbf0['query'],routingClient)[_0xedcb('0x7')](findById(_0x27cbf0[_0xedcb('0x1d')]['id']))['then'](respondWithResult(_0x5c012d,null))[_0xedcb('0x16')](handleError(_0x5c012d,null));};exports['faxAccounts']=function(_0x55c40f,_0x269fa0){return respondWithRpcPromise(_0xedcb('0x56'),_0x55c40f[_0xedcb('0x15')])[_0xedcb('0x7')](respondWithResult(_0x269fa0,null))[_0xedcb('0x16')](handleError(_0x269fa0,null));};exports[_0xedcb('0x57')]=function(_0x2dd481,_0xc03269){return respondWithRpcPromise(_0xedcb('0x58'),_0x2dd481[_0xedcb('0x15')],routingClient)['then'](respondWithResult(_0xc03269,null))[_0xedcb('0x16')](handleError(_0xc03269,null));};exports[_0xedcb('0x59')]=function(_0x5366d0,_0x5678d5){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x5366d0[_0xedcb('0x15')],routingClient)['then'](respondWithResult(_0x5678d5,null))[_0xedcb('0x16')](handleError(_0x5678d5,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x4453ca,_0x112acb){return respondWithRpcPromise(_0xedcb('0x5a'),_0x4453ca[_0xedcb('0x15')],routingClient)[_0xedcb('0x7')](respondWithResult(_0x112acb,null))['catch'](handleError(_0x112acb,null));};exports[_0xedcb('0x5b')]=function(_0x4c102d,_0x2915ea){return respondWithRpcPromise(_0xedcb('0x5c'),_0x4c102d['query'],routingClient)[_0xedcb('0x7')](respondWithResult(_0x2915ea,null))['catch'](handleError(_0x2915ea,null));};exports[_0xedcb('0x5d')]=function(_0x2d13c7,_0x1b40e7){return respondWithRpcPromise(_0xedcb('0x5e'),_0x2d13c7['query'],routingClient)[_0xedcb('0x7')](respondWithResult(_0x1b40e7,null))[_0xedcb('0x16')](handleError(_0x1b40e7,null));};exports[_0xedcb('0x5f')]=function(_0x3a4215,_0x2d98ab){return respondWithRpcPromise(_0xedcb('0x60'),_0x3a4215[_0xedcb('0x15')],routingClient)[_0xedcb('0x7')](respondWithResult(_0x2d98ab,null))[_0xedcb('0x16')](handleError(_0x2d98ab,null));};exports[_0xedcb('0x61')]=function(_0x31d6a5){return function(_0x1da9f2,_0x1cc8a4){var _0x4262f3,_0x57454f;var _0x2e23a7=_[_0xedcb('0x62')](_0x31d6a5);var _0x1b7e91=_0x31d6a5==='chat'?_0xedcb('0x63'):'Account';return db[_0x2e23a7+'Queue'][_0xedcb('0x64')]({'raw':!![],'where':{'id':_0x1da9f2[_0xedcb('0x1d')]['id']}})[_0xedcb('0x7')](function(_0xd22d0a){if(_['isNil'](_0xd22d0a)){throw new Error(_0x2e23a7+_0xedcb('0x65'));}_0x4262f3=_0xd22d0a;return db[_0x2e23a7+'Message'][_0xedcb('0x64')]({'where':{'id':_0x1da9f2[_0xedcb('0x2c')][_0xedcb('0x66')]},'include':[{'model':db[_0x2e23a7+_0xedcb('0x67')],'as':_0xedcb('0x67')},{'model':db[_0x2e23a7+_0x1b7e91],'as':'Account'}]});})[_0xedcb('0x7')](function(_0x4db277){if(_['isNil'](_0x4db277)){throw new Error(_0x2e23a7+_0xedcb('0x68'));}_0x57454f=_0x4db277;return _0x4db277[_0xedcb('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0xedcb('0x7')](function(){var _0xa8a184={'uniqueid':_0x31d6a5+'.'+_0x57454f['id']+'.'+_0x57454f[_0xedcb('0x67')]['id'],'FromUserId':_0x1da9f2['user']['id'],'type':_0xedcb('0x6a')};_0xa8a184[_0x2e23a7+'MessageId']=_0x57454f['id'];_0xa8a184[_0x2e23a7+_0xedcb('0x6b')]=_0x57454f[_0xedcb('0x67')]['id'];_0xa8a184[_0xedcb('0x6c')+_0x2e23a7+_0x1b7e91+'Id']=_0x57454f[_0xedcb('0x6d')]['id'];_0xa8a184['To'+_0x2e23a7+_0xedcb('0x6e')]=_0x4262f3['id'];return db[_0x2e23a7+'TransferReport'][_0xedcb('0x6f')](_0xa8a184);})[_0xedcb('0x7')](function(){return respondWithRpcPromise('Start',{'channel':_0x31d6a5,'interaction':_0x57454f[_0xedcb('0x67')],'message':_0x57454f,'account':_0x57454f[_0xedcb('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xedcb('0x6a'),'appdata':_0x4262f3['name']+','+(_0x57454f[_0xedcb('0x6d')][_0xedcb('0x70')]||0x12c),'interval':_0xedcb('0x71')}]},routingClient);})['then'](respondWithResult(_0x1cc8a4,null))[_0xedcb('0x16')](handleError(_0x1cc8a4,null));};};exports[_0xedcb('0x72')]=function(_0x5607c2,_0x1b25df){var _0x567105,_0x4843d4;if(_[_0xedcb('0x10')](_0x5607c2[_0xedcb('0x2c')][_0xedcb('0x73')])){throw new Error(_0xedcb('0x74'));}var _0x57c616=_0x5607c2[_0xedcb('0x2c')][_0xedcb('0x73')];var _0x175366=_[_0xedcb('0x62')](_0x57c616);var _0x1f6ffd=_0x57c616===_0xedcb('0x75')?_0xedcb('0x63'):_0xedcb('0x6d');return db[_0xedcb('0x76')][_0xedcb('0x64')]({'raw':!![],'where':{'id':_0x5607c2[_0xedcb('0x1d')]['id'],'role':_0xedcb('0x3a')}})[_0xedcb('0x7')](function(_0xeaec58){if(_[_0xedcb('0x10')](_0xeaec58)){throw new Error(_0xedcb('0x77'));}_0x567105=_0xeaec58;return db[_0x175366+_0xedcb('0x78')]['findOne']({'where':{'id':_0x5607c2[_0xedcb('0x2c')]['messageId']},'include':[{'model':db[_0x175366+_0xedcb('0x67')],'as':'Interaction'},{'model':db[_0x175366+_0x1f6ffd],'as':'Account'}]});})[_0xedcb('0x7')](function(_0x57bdde){if(_['isNil'](_0x57bdde)){throw new Error(_0x175366+_0xedcb('0x68'));}_0x4843d4=_0x57bdde;return _0x57bdde[_0xedcb('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x246115={'uniqueid':_0x57c616+'.'+_0x4843d4['id']+'.'+_0x4843d4[_0xedcb('0x67')]['id'],'FromUserId':_0x5607c2[_0xedcb('0x2e')]['id'],'type':_0xedcb('0x6a'),'ToUserId':_0x567105['id']};_0x246115[_0x175366+'MessageId']=_0x4843d4['id'];_0x246115[_0x175366+_0xedcb('0x6b')]=_0x4843d4[_0xedcb('0x67')]['id'];_0x246115['From'+_0x175366+_0x1f6ffd+'Id']=_0x4843d4['Account']['id'];return db[_0x175366+_0xedcb('0x79')][_0xedcb('0x6f')](_0x246115);})[_0xedcb('0x7')](function(){return respondWithRpcPromise('Start',{'channel':_0x57c616,'interaction':_0x4843d4['Interaction'],'message':_0x4843d4,'account':_0x4843d4[_0xedcb('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xedcb('0x3a'),'appdata':_0x567105[_0xedcb('0xe')]+','+(_0x4843d4[_0xedcb('0x6d')][_0xedcb('0x7a')]||0x12c),'interval':_0xedcb('0x71')}]},routingClient);})['then'](respondWithResult(_0x1b25df,null))['catch'](handleError(_0x1b25df,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index d2f9776..326d7cf 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 _0x6bf8=['express','Router','../../components/auth/service','isAuthenticated','index','/:id','show','run','post','destroy','multer','util','path','connect-timeout'];(function(_0x180613,_0x1f884e){var _0xde30a=function(_0xfc3c96){while(--_0xfc3c96){_0x180613['push'](_0x180613['shift']());}};_0xde30a(++_0x1f884e);}(_0x6bf8,0x176));var _0x86bf=function(_0x1c31fa,_0x2925cb){_0x1c31fa=_0x1c31fa-0x0;var _0xdf751=_0x6bf8[_0x1c31fa];return _0xdf751;};'use strict';var multer=require(_0x86bf('0x0'));var util=require(_0x86bf('0x1'));var path=require(_0x86bf('0x2'));var timeout=require(_0x86bf('0x3'));var express=require(_0x86bf('0x4'));var router=express[_0x86bf('0x5')]();var auth=require(_0x86bf('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./schedule.controller');router['get']('/',auth[_0x86bf('0x7')](),controller[_0x86bf('0x8')]);router['get'](_0x86bf('0x9'),auth[_0x86bf('0x7')](),controller[_0x86bf('0xa')]);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0x86bf('0xb')]);router[_0x86bf('0xc')]('/',auth[_0x86bf('0x7')](),controller['create']);router['put'](_0x86bf('0x9'),auth[_0x86bf('0x7')](),controller['update']);router['delete']('/:id',auth[_0x86bf('0x7')](),controller[_0x86bf('0xd')]);module['exports']=router; \ No newline at end of file +var _0x7278=['put','destroy','util','connect-timeout','Router','../../components/interaction/service','./schedule.controller','index','get','/:id','isAuthenticated','show','run','post','create'];(function(_0x1e3c58,_0x4baead){var _0x2cd780=function(_0x2e4fe1){while(--_0x2e4fe1){_0x1e3c58['push'](_0x1e3c58['shift']());}};_0x2cd780(++_0x4baead);}(_0x7278,0x15b));var _0x8727=function(_0xcc25cb,_0x286ad5){_0xcc25cb=_0xcc25cb-0x0;var _0x16fc94=_0x7278[_0xcc25cb];return _0x16fc94;};'use strict';var multer=require('multer');var util=require(_0x8727('0x0'));var path=require('path');var timeout=require(_0x8727('0x1'));var express=require('express');var router=express[_0x8727('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x8727('0x3'));var config=require('../../config/environment');var controller=require(_0x8727('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x8727('0x5')]);router[_0x8727('0x6')](_0x8727('0x7'),auth[_0x8727('0x8')](),controller[_0x8727('0x9')]);router[_0x8727('0x6')]('/:id/run',auth[_0x8727('0x8')](),controller[_0x8727('0xa')]);router[_0x8727('0xb')]('/',auth['isAuthenticated'](),controller[_0x8727('0xc')]);router[_0x8727('0xd')](_0x8727('0x7'),auth[_0x8727('0x8')](),controller['update']);router['delete'](_0x8727('0x7'),auth[_0x8727('0x8')](),controller[_0x8727('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 6990a8f..879754a 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 _0xdc97=['years','quarters','weeks','minutes','days','csv','pdf','custom','default','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x3a9d77,_0xdc466){var _0x130f80=function(_0x740c4a){while(--_0x740c4a){_0x3a9d77['push'](_0x3a9d77['shift']());}};_0x130f80(++_0xdc466);}(_0xdc97,0x13b));var _0x7dc9=function(_0x23ed26,_0x24fb6e){_0x23ed26=_0x23ed26-0x0;var _0x3a6a41=_0xdc97[_0x23ed26];return _0x3a6a41;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x7dc9('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7dc9('0x4')},'startAt':{'type':Sequelize[_0x7dc9('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7dc9('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7dc9('0x7')](_0x7dc9('0x8'),_0x7dc9('0x9'),'months',_0x7dc9('0xa'),'days','hours',_0x7dc9('0xb')),'allowNull':![],'defaultValue':_0x7dc9('0xc')},'output':{'type':Sequelize[_0x7dc9('0x7')](_0x7dc9('0xd'),_0x7dc9('0xe'),'xlsx'),'allowNull':![],'defaultValue':_0x7dc9('0xd')},'type':{'type':Sequelize[_0x7dc9('0x7')](_0x7dc9('0xf'),_0x7dc9('0x10')),'allowNull':![],'defaultValue':_0x7dc9('0xf')},'sendMail':{'type':Sequelize[_0x7dc9('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x7dc9('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xb0df=['csv','xlsx','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','days','hours','ENUM'];(function(_0x426445,_0x3d6c0f){var _0x2d56ce=function(_0x176d2e){while(--_0x176d2e){_0x426445['push'](_0x426445['shift']());}};_0x2d56ce(++_0x3d6c0f);}(_0xb0df,0x85));var _0xfb0d=function(_0x2bcd1f,_0x4f1972){_0x2bcd1f=_0x2bcd1f-0x0;var _0x2381ca=_0xb0df[_0x2bcd1f];return _0x2381ca;};'use strict';var Sequelize=require('sequelize');module[_0xfb0d('0x0')]={'name':{'type':Sequelize[_0xfb0d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xfb0d('0x1')]},'active':{'type':Sequelize[_0xfb0d('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xfb0d('0x1')],'allowNull':![],'defaultValue':_0xfb0d('0x3')},'startAt':{'type':Sequelize[_0xfb0d('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xfb0d('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xfb0d('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xfb0d('0x6'),_0xfb0d('0x7'),'months','weeks',_0xfb0d('0x8'),_0xfb0d('0x9'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xfb0d('0xa')](_0xfb0d('0xb'),'pdf',_0xfb0d('0xc')),'allowNull':![],'defaultValue':_0xfb0d('0xb')},'type':{'type':Sequelize[_0xfb0d('0xa')](_0xfb0d('0xd'),_0xfb0d('0xe')),'allowNull':![],'defaultValue':_0xfb0d('0xd')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xfb0d('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xfb0d('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xfb0d('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index b4af91b..0847bdf 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 _0x615e=['end','json','count','offset','limit','set','reject','save','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','update','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status'];(function(_0x21b542,_0x5ba26e){var _0x4b28eb=function(_0x242d03){while(--_0x242d03){_0x21b542['push'](_0x21b542['shift']());}};_0x4b28eb(++_0x5ba26e);}(_0x615e,0x17c));var _0xe615=function(_0x404010,_0x1254b9){_0x404010=_0x404010-0x0;var _0xde2e59=_0x615e[_0x404010];return _0xde2e59;};'use strict';var pdf=require(_0xe615('0x0'));var emlformat=require(_0xe615('0x1'));var rimraf=require(_0xe615('0x2'));var zipdir=require(_0xe615('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe615('0x4'));var moment=require('moment');var BPromise=require(_0xe615('0x5'));var Mustache=require(_0xe615('0x6'));var util=require('util');var path=require(_0xe615('0x7'));var sox=require('sox');var csv=require(_0xe615('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe615('0x9'));var squel=require(_0xe615('0xa'));var crypto=require(_0xe615('0xb'));var jsforce=require(_0xe615('0xc'));var deskjs=require(_0xe615('0xd'));var toCsv=require(_0xe615('0x8'));var querystring=require('querystring');var Papa=require(_0xe615('0xe'));var Redis=require('ioredis');var authService=require(_0xe615('0xf'));var qs=require(_0xe615('0x10'));var as=require(_0xe615('0x11'));var hardwareService=require(_0xe615('0x12'));var logger=require(_0xe615('0x13'))(_0xe615('0x14'));var utils=require(_0xe615('0x15'));var config=require(_0xe615('0x16'));var db=require(_0xe615('0x17'))['db'];function respondWithStatusCode(_0x52566d,_0x5c7dc1){_0x5c7dc1=_0x5c7dc1||0xcc;return function(_0xc1b617){if(_0xc1b617){return _0x52566d['sendStatus'](_0x5c7dc1);}return _0x52566d[_0xe615('0x18')](_0x5c7dc1)[_0xe615('0x19')]();};}function respondWithResult(_0x75f622,_0x28b0b0){_0x28b0b0=_0x28b0b0||0xc8;return function(_0x31e91b){if(_0x31e91b){return _0x75f622[_0xe615('0x18')](_0x28b0b0)[_0xe615('0x1a')](_0x31e91b);}};}function respondWithFilteredResult(_0x1eab41,_0x4b6767){return function(_0x3b32bd){if(_0x3b32bd){var _0x39f7ee=_0x3b32bd[_0xe615('0x1b')],_0x35523a=_0x4b6767[_0xe615('0x1c')],_0x2e287a=_0x4b6767['offset']+_0x4b6767[_0xe615('0x1d')],_0x50fc10;if(_0x2e287a>=_0x39f7ee){_0x2e287a=_0x39f7ee;_0x50fc10=0xc8;}else{_0x50fc10=0xce;}_0x1eab41[_0xe615('0x18')](_0x50fc10);return _0x1eab41[_0xe615('0x1e')]('Content-Range',_0x35523a+'-'+_0x2e287a+'/'+_0x39f7ee)[_0xe615('0x1a')](_0x3b32bd);}return null;};}function patchUpdates(_0x3a631f){return function(_0x335af7){try{jsonpatch['apply'](_0x335af7,_0x3a631f,!![]);}catch(_0x3d815c){return BPromise[_0xe615('0x1f')](_0x3d815c);}return _0x335af7[_0xe615('0x20')]();};}function saveUpdates(_0x4704d0,_0x11d67c){return function(_0xa084ce){if(_0xa084ce){return _0xa084ce['update'](_0x4704d0)[_0xe615('0x21')](function(_0x58be51){return _0x58be51;});}return null;};}function removeEntity(_0x96b880,_0xf683ed){return function(_0x5b985c){if(_0x5b985c){return _0x5b985c[_0xe615('0x22')]()['then'](function(){var _0x53b465=_0x5b985c[_0xe615('0x23')]({'plain':!![]});var _0x4896c3=_0xe615('0x24');return db[_0xe615('0x25')]['destroy']({'where':{'type':_0x4896c3,'resourceId':_0x53b465['id']}})[_0xe615('0x21')](function(){return _0x5b985c;});})[_0xe615('0x21')](function(){_0x96b880[_0xe615('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39e95a,_0x3ea132){return function(_0x33d894){if(!_0x33d894){_0x39e95a['sendStatus'](0x194);}return _0x33d894;};}function handleError(_0x137d87,_0x1e4388){_0x1e4388=_0x1e4388||0x1f4;return function(_0x1eb25b){logger[_0xe615('0x26')](_0x1eb25b[_0xe615('0x27')]);if(_0x1eb25b['name']){delete _0x1eb25b[_0xe615('0x28')];}_0x137d87[_0xe615('0x18')](_0x1e4388)[_0xe615('0x29')](_0x1eb25b);};}exports[_0xe615('0x2a')]=function(_0x66a1c1,_0x1d10e1){var _0x51fc54={},_0x3a256f={},_0x6ee3d1={'count':0x0,'rows':[]};var _0x14c2ad=_[_0xe615('0x2b')](db[_0xe615('0x2c')][_0xe615('0x2d')],function(_0x472a81){return{'name':_0x472a81[_0xe615('0x2e')],'type':_0x472a81['type'][_0xe615('0x2f')]};});_0x3a256f[_0xe615('0x30')]=_[_0xe615('0x2b')](_0x14c2ad,_0xe615('0x28'));_0x3a256f[_0xe615('0x31')]=_[_0xe615('0x32')](_0x66a1c1[_0xe615('0x31')]);_0x3a256f[_0xe615('0x33')]=_['intersection'](_0x3a256f['model'],_0x3a256f[_0xe615('0x31')]);_0x51fc54[_0xe615('0x34')]=_[_0xe615('0x35')](_0x3a256f[_0xe615('0x30')],qs[_0xe615('0x36')](_0x66a1c1[_0xe615('0x31')][_0xe615('0x36')]));_0x51fc54[_0xe615('0x34')]=_0x51fc54['attributes'][_0xe615('0x37')]?_0x51fc54[_0xe615('0x34')]:_0x3a256f[_0xe615('0x30')];if(!_0x66a1c1[_0xe615('0x31')][_0xe615('0x38')]('nolimit')){_0x51fc54[_0xe615('0x1d')]=qs['limit'](_0x66a1c1['query'][_0xe615('0x1d')]);_0x51fc54[_0xe615('0x1c')]=qs[_0xe615('0x1c')](_0x66a1c1[_0xe615('0x31')][_0xe615('0x1c')]);}_0x51fc54[_0xe615('0x39')]=qs[_0xe615('0x3a')](_0x66a1c1[_0xe615('0x31')][_0xe615('0x3a')]);_0x51fc54[_0xe615('0x3b')]=qs[_0xe615('0x33')](_['pick'](_0x66a1c1[_0xe615('0x31')],_0x3a256f['filters']),_0x14c2ad);if(_0x66a1c1[_0xe615('0x31')]['filter']){_0x51fc54[_0xe615('0x3b')]=_['merge'](_0x51fc54[_0xe615('0x3b')],{'$or':_[_0xe615('0x2b')](_0x14c2ad,function(_0x3a74fe){if(_0x3a74fe[_0xe615('0x3c')]!==_0xe615('0x3d')){var _0x5a0c8a={};_0x5a0c8a[_0x3a74fe[_0xe615('0x28')]]={'$like':'%'+_0x66a1c1[_0xe615('0x31')]['filter']+'%'};return _0x5a0c8a;}})});}_0x51fc54=_[_0xe615('0x3e')]({},_0x51fc54,_0x66a1c1[_0xe615('0x3f')]);var _0x4f66f5={'where':_0x51fc54[_0xe615('0x3b')]};return db[_0xe615('0x2c')]['count'](_0x4f66f5)[_0xe615('0x21')](function(_0x21c137){_0x6ee3d1[_0xe615('0x1b')]=_0x21c137;if(_0x66a1c1[_0xe615('0x31')][_0xe615('0x40')]){_0x51fc54[_0xe615('0x41')]=[{'all':!![]}];}return db[_0xe615('0x2c')][_0xe615('0x42')](_0x51fc54);})['then'](function(_0x3e2788){_0x6ee3d1['rows']=_0x3e2788;return _0x6ee3d1;})[_0xe615('0x21')](respondWithFilteredResult(_0x1d10e1,_0x51fc54))['catch'](handleError(_0x1d10e1,null));};exports[_0xe615('0x43')]=function(_0x47772f,_0x57af39){var _0x1a06a2={'raw':![],'where':{'id':_0x47772f[_0xe615('0x44')]['id']}},_0x246e41={};_0x246e41[_0xe615('0x30')]=_[_0xe615('0x32')](db[_0xe615('0x2c')][_0xe615('0x2d')]);_0x246e41['query']=_[_0xe615('0x32')](_0x47772f['query']);_0x246e41['filters']=_[_0xe615('0x35')](_0x246e41[_0xe615('0x30')],_0x246e41[_0xe615('0x31')]);_0x1a06a2[_0xe615('0x34')]=_[_0xe615('0x35')](_0x246e41['model'],qs[_0xe615('0x36')](_0x47772f['query'][_0xe615('0x36')]));_0x1a06a2[_0xe615('0x34')]=_0x1a06a2[_0xe615('0x34')][_0xe615('0x37')]?_0x1a06a2['attributes']:_0x246e41[_0xe615('0x30')];if(_0x47772f[_0xe615('0x31')][_0xe615('0x40')]){_0x1a06a2[_0xe615('0x41')]=[{'all':!![]}];}_0x1a06a2=_['merge']({},_0x1a06a2,_0x47772f['options']);return db[_0xe615('0x2c')][_0xe615('0x45')](_0x1a06a2)[_0xe615('0x21')](handleEntityNotFound(_0x57af39,null))['then'](respondWithResult(_0x57af39,null))['catch'](handleError(_0x57af39,null));};exports[_0xe615('0x46')]=function(_0x70ce23,_0x2676dd){return db[_0xe615('0x2c')][_0xe615('0x46')](_0x70ce23[_0xe615('0x47')],{})[_0xe615('0x21')](function(_0x57de2e){var _0x340b35=_0x70ce23[_0xe615('0x48')]['get']({'plain':!![]});if(!_0x340b35)throw new Error(_0xe615('0x49'));if(_0x340b35[_0xe615('0x4a')]===_0xe615('0x48')){var _0x39b51f=_0x57de2e[_0xe615('0x23')]({'plain':!![]});var _0x2f7c14=_0xe615('0x24');return db['UserProfileSection'][_0xe615('0x45')]({'where':{'name':_0x2f7c14,'userProfileId':_0x340b35[_0xe615('0x4b')]},'raw':!![]})['then'](function(_0xd22c14){if(_0xd22c14&&_0xd22c14[_0xe615('0x4c')]===0x0){return db[_0xe615('0x25')][_0xe615('0x46')]({'name':_0x39b51f['name'],'resourceId':_0x39b51f['id'],'type':_0xd22c14['name'],'sectionId':_0xd22c14['id']},{})[_0xe615('0x21')](function(){return _0x57de2e;});}else{return _0x57de2e;}})[_0xe615('0x4d')](function(_0x208f95){logger[_0xe615('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x208f95);throw _0x208f95;});}return _0x57de2e;})[_0xe615('0x21')](respondWithResult(_0x2676dd,0xc9))[_0xe615('0x4d')](handleError(_0x2676dd,null));};exports[_0xe615('0x4e')]=function(_0x2dcf21,_0x33446a){if(_0x2dcf21[_0xe615('0x47')]['id']){delete _0x2dcf21[_0xe615('0x47')]['id'];}return db[_0xe615('0x2c')][_0xe615('0x45')]({'where':{'id':_0x2dcf21[_0xe615('0x44')]['id']}})[_0xe615('0x21')](handleEntityNotFound(_0x33446a,null))[_0xe615('0x21')](saveUpdates(_0x2dcf21['body'],null))[_0xe615('0x21')](respondWithResult(_0x33446a,null))[_0xe615('0x4d')](handleError(_0x33446a,null));};exports[_0xe615('0x22')]=function(_0x3c7fd2,_0xa7d37f){return db[_0xe615('0x2c')][_0xe615('0x45')]({'where':{'id':_0x3c7fd2[_0xe615('0x44')]['id']}})[_0xe615('0x21')](handleEntityNotFound(_0xa7d37f,null))[_0xe615('0x21')](removeEntity(_0xa7d37f,null))[_0xe615('0x4d')](handleError(_0xa7d37f,null));};exports[_0xe615('0x4f')]=function(_0x243ddc,_0x22666c,_0x82af1e){var _0x5dfeed=require(_0xe615('0x50'));return db['Schedule'][_0xe615('0x45')]({'where':{'id':_0x243ddc['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x22666c,null))[_0xe615('0x21')](function(){_0x5dfeed['run'](_0x243ddc[_0xe615('0x44')]['id']);})['then'](respondWithStatusCode(_0x22666c,null))['catch'](handleError(_0x22666c,null));}; \ No newline at end of file +var _0xdc3a=['Scheduler','stack','name','send','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy'];(function(_0x1defca,_0x371404){var _0x553cff=function(_0x336898){while(--_0x336898){_0x1defca['push'](_0x1defca['shift']());}};_0x553cff(++_0x371404);}(_0xdc3a,0x135));var _0xadc3=function(_0x2b5893,_0x5d3a09){_0x2b5893=_0x2b5893-0x0;var _0x2d235d=_0xdc3a[_0x2b5893];return _0x2d235d;};'use strict';var pdf=require(_0xadc3('0x0'));var emlformat=require(_0xadc3('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xadc3('0x2'));var moment=require(_0xadc3('0x3'));var BPromise=require(_0xadc3('0x4'));var Mustache=require(_0xadc3('0x5'));var util=require(_0xadc3('0x6'));var path=require(_0xadc3('0x7'));var sox=require(_0xadc3('0x8'));var csv=require(_0xadc3('0x9'));var ejs=require(_0xadc3('0xa'));var fs=require('fs');var _=require(_0xadc3('0xb'));var squel=require(_0xadc3('0xc'));var crypto=require(_0xadc3('0xd'));var jsforce=require(_0xadc3('0xe'));var deskjs=require(_0xadc3('0xf'));var toCsv=require(_0xadc3('0x9'));var querystring=require(_0xadc3('0x10'));var Papa=require(_0xadc3('0x11'));var Redis=require(_0xadc3('0x12'));var authService=require(_0xadc3('0x13'));var qs=require(_0xadc3('0x14'));var as=require(_0xadc3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xadc3('0x16'))(_0xadc3('0x17'));var utils=require(_0xadc3('0x18'));var config=require(_0xadc3('0x19'));var db=require(_0xadc3('0x1a'))['db'];function respondWithStatusCode(_0x5d279b,_0x58a5ec){_0x58a5ec=_0x58a5ec||0xcc;return function(_0x5b5cd4){if(_0x5b5cd4){return _0x5d279b['sendStatus'](_0x58a5ec);}return _0x5d279b['status'](_0x58a5ec)[_0xadc3('0x1b')]();};}function respondWithResult(_0x33b9b6,_0xf8a88a){_0xf8a88a=_0xf8a88a||0xc8;return function(_0x1a273d){if(_0x1a273d){return _0x33b9b6[_0xadc3('0x1c')](_0xf8a88a)[_0xadc3('0x1d')](_0x1a273d);}};}function respondWithFilteredResult(_0x32680e,_0x29f399){return function(_0xa8d026){if(_0xa8d026){var _0x437e50=_0xa8d026[_0xadc3('0x1e')],_0x2a1a00=_0x29f399[_0xadc3('0x1f')],_0x5153b2=_0x29f399[_0xadc3('0x1f')]+_0x29f399[_0xadc3('0x20')],_0x5a6152;if(_0x5153b2>=_0x437e50){_0x5153b2=_0x437e50;_0x5a6152=0xc8;}else{_0x5a6152=0xce;}_0x32680e['status'](_0x5a6152);return _0x32680e['set'](_0xadc3('0x21'),_0x2a1a00+'-'+_0x5153b2+'/'+_0x437e50)[_0xadc3('0x1d')](_0xa8d026);}return null;};}function patchUpdates(_0x123d80){return function(_0x1ea392){try{jsonpatch[_0xadc3('0x22')](_0x1ea392,_0x123d80,!![]);}catch(_0xfa154a){return BPromise[_0xadc3('0x23')](_0xfa154a);}return _0x1ea392['save']();};}function saveUpdates(_0x5df1be,_0x276f2b){return function(_0x2719a3){if(_0x2719a3){return _0x2719a3[_0xadc3('0x24')](_0x5df1be)[_0xadc3('0x25')](function(_0x7de1dd){return _0x7de1dd;});}return null;};}function removeEntity(_0x52c5c9,_0xb63960){return function(_0x56f504){if(_0x56f504){return _0x56f504[_0xadc3('0x26')]()[_0xadc3('0x25')](function(){var _0x370bc7=_0x56f504['get']({'plain':!![]});var _0x45dab4=_0xadc3('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x45dab4,'resourceId':_0x370bc7['id']}})[_0xadc3('0x25')](function(){return _0x56f504;});})[_0xadc3('0x25')](function(){_0x52c5c9[_0xadc3('0x1c')](0xcc)[_0xadc3('0x1b')]();});}};}function handleEntityNotFound(_0x12f715,_0x4d275b){return function(_0x1469c2){if(!_0x1469c2){_0x12f715['sendStatus'](0x194);}return _0x1469c2;};}function handleError(_0x464006,_0x3d3fce){_0x3d3fce=_0x3d3fce||0x1f4;return function(_0x32fc3b){logger['error'](_0x32fc3b[_0xadc3('0x28')]);if(_0x32fc3b[_0xadc3('0x29')]){delete _0x32fc3b['name'];}_0x464006[_0xadc3('0x1c')](_0x3d3fce)[_0xadc3('0x2a')](_0x32fc3b);};}exports['index']=function(_0x5c2f48,_0x435195){var _0x1d4994={},_0x205520={},_0x1a7499={'count':0x0,'rows':[]};var _0x162ceb=_[_0xadc3('0x2b')](db[_0xadc3('0x2c')][_0xadc3('0x2d')],function(_0x16b78e){return{'name':_0x16b78e[_0xadc3('0x2e')],'type':_0x16b78e[_0xadc3('0x2f')][_0xadc3('0x30')]};});_0x205520[_0xadc3('0x31')]=_[_0xadc3('0x2b')](_0x162ceb,_0xadc3('0x29'));_0x205520[_0xadc3('0x32')]=_[_0xadc3('0x33')](_0x5c2f48[_0xadc3('0x32')]);_0x205520[_0xadc3('0x34')]=_[_0xadc3('0x35')](_0x205520[_0xadc3('0x31')],_0x205520['query']);_0x1d4994[_0xadc3('0x36')]=_['intersection'](_0x205520['model'],qs[_0xadc3('0x37')](_0x5c2f48[_0xadc3('0x32')][_0xadc3('0x37')]));_0x1d4994[_0xadc3('0x36')]=_0x1d4994[_0xadc3('0x36')]['length']?_0x1d4994[_0xadc3('0x36')]:_0x205520[_0xadc3('0x31')];if(!_0x5c2f48[_0xadc3('0x32')][_0xadc3('0x38')](_0xadc3('0x39'))){_0x1d4994['limit']=qs[_0xadc3('0x20')](_0x5c2f48[_0xadc3('0x32')][_0xadc3('0x20')]);_0x1d4994[_0xadc3('0x1f')]=qs[_0xadc3('0x1f')](_0x5c2f48['query']['offset']);}_0x1d4994[_0xadc3('0x3a')]=qs[_0xadc3('0x3b')](_0x5c2f48[_0xadc3('0x32')][_0xadc3('0x3b')]);_0x1d4994['where']=qs['filters'](_[_0xadc3('0x3c')](_0x5c2f48['query'],_0x205520[_0xadc3('0x34')]),_0x162ceb);if(_0x5c2f48[_0xadc3('0x32')][_0xadc3('0x3d')]){_0x1d4994[_0xadc3('0x3e')]=_[_0xadc3('0x3f')](_0x1d4994[_0xadc3('0x3e')],{'$or':_[_0xadc3('0x2b')](_0x162ceb,function(_0xbf58f5){if(_0xbf58f5[_0xadc3('0x2f')]!==_0xadc3('0x40')){var _0x255dc4={};_0x255dc4[_0xbf58f5['name']]={'$like':'%'+_0x5c2f48[_0xadc3('0x32')][_0xadc3('0x3d')]+'%'};return _0x255dc4;}})});}_0x1d4994=_[_0xadc3('0x3f')]({},_0x1d4994,_0x5c2f48[_0xadc3('0x41')]);var _0x26d46e={'where':_0x1d4994[_0xadc3('0x3e')]};return db[_0xadc3('0x2c')][_0xadc3('0x1e')](_0x26d46e)[_0xadc3('0x25')](function(_0x169596){_0x1a7499['count']=_0x169596;if(_0x5c2f48['query'][_0xadc3('0x42')]){_0x1d4994[_0xadc3('0x43')]=[{'all':!![]}];}return db[_0xadc3('0x2c')][_0xadc3('0x44')](_0x1d4994);})['then'](function(_0x403adf){_0x1a7499[_0xadc3('0x45')]=_0x403adf;return _0x1a7499;})[_0xadc3('0x25')](respondWithFilteredResult(_0x435195,_0x1d4994))[_0xadc3('0x46')](handleError(_0x435195,null));};exports[_0xadc3('0x47')]=function(_0x522887,_0x160712){var _0x149b23={'raw':![],'where':{'id':_0x522887[_0xadc3('0x48')]['id']}},_0x212375={};_0x212375[_0xadc3('0x31')]=_[_0xadc3('0x33')](db[_0xadc3('0x2c')]['rawAttributes']);_0x212375['query']=_['keys'](_0x522887['query']);_0x212375[_0xadc3('0x34')]=_[_0xadc3('0x35')](_0x212375[_0xadc3('0x31')],_0x212375[_0xadc3('0x32')]);_0x149b23['attributes']=_[_0xadc3('0x35')](_0x212375[_0xadc3('0x31')],qs['fields'](_0x522887[_0xadc3('0x32')][_0xadc3('0x37')]));_0x149b23[_0xadc3('0x36')]=_0x149b23[_0xadc3('0x36')][_0xadc3('0x49')]?_0x149b23[_0xadc3('0x36')]:_0x212375['model'];if(_0x522887['query']['includeAll']){_0x149b23['include']=[{'all':!![]}];}_0x149b23=_['merge']({},_0x149b23,_0x522887[_0xadc3('0x41')]);return db[_0xadc3('0x2c')][_0xadc3('0x4a')](_0x149b23)[_0xadc3('0x25')](handleEntityNotFound(_0x160712,null))['then'](respondWithResult(_0x160712,null))[_0xadc3('0x46')](handleError(_0x160712,null));};exports[_0xadc3('0x4b')]=function(_0x1da0d3,_0x3867a7){return db[_0xadc3('0x2c')][_0xadc3('0x4b')](_0x1da0d3[_0xadc3('0x4c')],{})[_0xadc3('0x25')](function(_0x4ab135){var _0x128f80=_0x1da0d3[_0xadc3('0x4d')][_0xadc3('0x4e')]({'plain':!![]});if(!_0x128f80)throw new Error(_0xadc3('0x4f'));if(_0x128f80[_0xadc3('0x50')]===_0xadc3('0x4d')){var _0x5570cc=_0x4ab135['get']({'plain':!![]});var _0x16fe28=_0xadc3('0x27');return db[_0xadc3('0x51')]['find']({'where':{'name':_0x16fe28,'userProfileId':_0x128f80['userProfileId']},'raw':!![]})[_0xadc3('0x25')](function(_0x558f67){if(_0x558f67&&_0x558f67['autoAssociation']===0x0){return db[_0xadc3('0x52')]['create']({'name':_0x5570cc['name'],'resourceId':_0x5570cc['id'],'type':_0x558f67[_0xadc3('0x29')],'sectionId':_0x558f67['id']},{})['then'](function(){return _0x4ab135;});}else{return _0x4ab135;}})[_0xadc3('0x46')](function(_0x31f3fa){logger[_0xadc3('0x53')](_0xadc3('0x54'),_0x31f3fa);throw _0x31f3fa;});}return _0x4ab135;})['then'](respondWithResult(_0x3867a7,0xc9))[_0xadc3('0x46')](handleError(_0x3867a7,null));};exports[_0xadc3('0x24')]=function(_0x5bee86,_0x5464d0){if(_0x5bee86['body']['id']){delete _0x5bee86['body']['id'];}return db[_0xadc3('0x2c')][_0xadc3('0x4a')]({'where':{'id':_0x5bee86[_0xadc3('0x48')]['id']}})[_0xadc3('0x25')](handleEntityNotFound(_0x5464d0,null))[_0xadc3('0x25')](saveUpdates(_0x5bee86['body'],null))[_0xadc3('0x25')](respondWithResult(_0x5464d0,null))['catch'](handleError(_0x5464d0,null));};exports['destroy']=function(_0x80d500,_0x8098dc){return db['Schedule'][_0xadc3('0x4a')]({'where':{'id':_0x80d500[_0xadc3('0x48')]['id']}})[_0xadc3('0x25')](handleEntityNotFound(_0x8098dc,null))[_0xadc3('0x25')](removeEntity(_0x8098dc,null))[_0xadc3('0x46')](handleError(_0x8098dc,null));};exports['run']=function(_0x402663,_0x183b5f,_0x3b24f7){var _0x5461ab=require(_0xadc3('0x55'));return db[_0xadc3('0x2c')][_0xadc3('0x4a')]({'where':{'id':_0x402663[_0xadc3('0x48')]['id']},'raw':!![]})[_0xadc3('0x25')](handleEntityNotFound(_0x183b5f,null))[_0xadc3('0x25')](function(){_0x5461ab[_0xadc3('0x56')](_0x402663['params']['id']);})[_0xadc3('0x25')](respondWithStatusCode(_0x183b5f,null))[_0xadc3('0x46')](handleError(_0x183b5f,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 2b69ddf..3ffeae6 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 _0xa57f=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','Schedule','util'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa57f,0x77));var _0xfa57=function(_0x406b1,_0xe08dc5){_0x406b1=_0x406b1-0x0;var _0x474b1e=_0xa57f[_0x406b1];return _0x474b1e;};'use strict';var _=require('lodash');var util=require(_0xfa57('0x0'));var logger=require(_0xfa57('0x1'))(_0xfa57('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfa57('0x3'));var fs=require('fs');var path=require(_0xfa57('0x4'));var rimraf=require(_0xfa57('0x5'));var config=require(_0xfa57('0x6'));var attributes=require('./schedule.attributes');module[_0xfa57('0x7')]=function(_0x54699d,_0x2ea796){return _0x54699d[_0xfa57('0x8')](_0xfa57('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa222=['./schedule.attributes','define','Schedule','tools_schedules','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x16716e,_0x3b8362){var _0x4d5a77=function(_0x18d99e){while(--_0x18d99e){_0x16716e['push'](_0x16716e['shift']());}};_0x4d5a77(++_0x3b8362);}(_0xa222,0x17a));var _0x2a22=function(_0x44606e,_0x2bf244){_0x44606e=_0x44606e-0x0;var _0xe68388=_0xa222[_0x44606e];return _0xe68388;};'use strict';var _=require('lodash');var util=require(_0x2a22('0x0'));var logger=require(_0x2a22('0x1'))('api');var moment=require(_0x2a22('0x2'));var BPromise=require('bluebird');var rp=require(_0x2a22('0x3'));var fs=require('fs');var path=require(_0x2a22('0x4'));var rimraf=require(_0x2a22('0x5'));var config=require(_0x2a22('0x6'));var attributes=require(_0x2a22('0x7'));module['exports']=function(_0x25429a,_0x4a8001){return _0x25429a[_0x2a22('0x8')](_0x2a22('0x9'),attributes,{'tableName':_0x2a22('0xa'),'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 ee10884..f83d6b6 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 _0xe517=['rpc','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4fd6fb,_0x5854c7){var _0x21c0c6=function(_0x318d0b){while(--_0x318d0b){_0x4fd6fb['push'](_0x4fd6fb['shift']());}};_0x21c0c6(++_0x5854c7);}(_0xe517,0x7d));var _0x7e51=function(_0x1b69b6,_0x9eb4ee){_0x1b69b6=_0x1b69b6-0x0;var _0x4aaf36=_0xe517[_0x1b69b6];return _0x4aaf36;};'use strict';var _=require(_0x7e51('0x0'));var util=require(_0x7e51('0x1'));var moment=require(_0x7e51('0x2'));var BPromise=require(_0x7e51('0x3'));var rs=require(_0x7e51('0x4'));var fs=require('fs');var Redis=require(_0x7e51('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e51('0x6'));var logger=require('../../config/logger')(_0x7e51('0x7'));var config=require('../../config/environment');var jayson=require(_0x7e51('0x8'));var client=jayson[_0x7e51('0x9')][_0x7e51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5732a2,_0x40a8d8,_0x154581){return new BPromise(function(_0x324126,_0x575d02){return client[_0x7e51('0xb')](_0x5732a2,_0x154581)[_0x7e51('0xc')](function(_0x3fafff){logger[_0x7e51('0xd')](_0x7e51('0xe'),_0x40a8d8,_0x7e51('0xf'));logger[_0x7e51('0x10')](_0x7e51('0x11'),_0x40a8d8,'request\x20sent',JSON[_0x7e51('0x12')](_0x3fafff));if(_0x3fafff[_0x7e51('0x13')]){if(_0x3fafff[_0x7e51('0x13')][_0x7e51('0x14')]===0x1f4){logger['error'](_0x7e51('0xe'),_0x40a8d8,_0x3fafff[_0x7e51('0x13')][_0x7e51('0x15')]);return _0x575d02(_0x3fafff[_0x7e51('0x13')][_0x7e51('0x15')]);}logger['error'](_0x7e51('0xe'),_0x40a8d8,_0x3fafff[_0x7e51('0x13')][_0x7e51('0x15')]);return _0x324126(_0x3fafff[_0x7e51('0x13')][_0x7e51('0x15')]);}else{logger['info'](_0x7e51('0xe'),_0x40a8d8,_0x7e51('0xf'));_0x324126(_0x3fafff['result'][_0x7e51('0x15')]);}})['catch'](function(_0x23f0ea){logger[_0x7e51('0x13')](_0x7e51('0xe'),_0x40a8d8,_0x23f0ea);_0x575d02(_0x23f0ea);});});} \ No newline at end of file +var _0x0589=['request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http'];(function(_0x5db99b,_0xdee23a){var _0x4b2d0e=function(_0x4deee1){while(--_0x4deee1){_0x5db99b['push'](_0x5db99b['shift']());}};_0x4b2d0e(++_0xdee23a);}(_0x0589,0x11d));var _0x9058=function(_0x34136e,_0x1d2fdb){_0x34136e=_0x34136e-0x0;var _0x597419=_0x0589[_0x34136e];return _0x597419;};'use strict';var _=require('lodash');var util=require(_0x9058('0x0'));var moment=require(_0x9058('0x1'));var BPromise=require('bluebird');var rs=require(_0x9058('0x2'));var fs=require('fs');var Redis=require(_0x9058('0x3'));var db=require(_0x9058('0x4'))['db'];var utils=require(_0x9058('0x5'));var logger=require(_0x9058('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9058('0x7'));var client=jayson['client'][_0x9058('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e4c24,_0x52ee53,_0x31f34e){return new BPromise(function(_0x3d133b,_0x45d907){return client[_0x9058('0x9')](_0x1e4c24,_0x31f34e)[_0x9058('0xa')](function(_0x155a66){logger['info'](_0x9058('0xb'),_0x52ee53,_0x9058('0xc'));logger[_0x9058('0xd')](_0x9058('0xe'),_0x52ee53,_0x9058('0xc'),JSON['stringify'](_0x155a66));if(_0x155a66[_0x9058('0xf')]){if(_0x155a66[_0x9058('0xf')][_0x9058('0x10')]===0x1f4){logger[_0x9058('0xf')](_0x9058('0xb'),_0x52ee53,_0x155a66[_0x9058('0xf')][_0x9058('0x11')]);return _0x45d907(_0x155a66[_0x9058('0xf')][_0x9058('0x11')]);}logger[_0x9058('0xf')]('Schedule,\x20%s,\x20%s',_0x52ee53,_0x155a66[_0x9058('0xf')][_0x9058('0x11')]);return _0x3d133b(_0x155a66[_0x9058('0xf')][_0x9058('0x11')]);}else{logger[_0x9058('0x12')](_0x9058('0xb'),_0x52ee53,_0x9058('0xc'));_0x3d133b(_0x155a66[_0x9058('0x13')]['message']);}})[_0x9058('0x14')](function(_0x1b3dd3){logger['error'](_0x9058('0xb'),_0x52ee53,_0x1b3dd3);_0x45d907(_0x1b3dd3);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 5e1cad1..af9d075 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 _0x76dd=['/describe','describe','show','/:id/download','download','post','create','put','update','delete','/:id','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x134eb1,_0x30f846){var _0xb46c09=function(_0x225ce1){while(--_0x225ce1){_0x134eb1['push'](_0x134eb1['shift']());}};_0xb46c09(++_0x30f846);}(_0x76dd,0x1d8));var _0xd76d=function(_0xf7cc65,_0x2389c8){_0xf7cc65=_0xf7cc65-0x0;var _0x5d4720=_0x76dd[_0xf7cc65];return _0x5d4720;};'use strict';var multer=require(_0xd76d('0x0'));var util=require(_0xd76d('0x1'));var path=require('path');var timeout=require(_0xd76d('0x2'));var express=require(_0xd76d('0x3'));var router=express[_0xd76d('0x4')]();var auth=require(_0xd76d('0x5'));var interaction=require(_0xd76d('0x6'));var config=require(_0xd76d('0x7'));var controller=require('./screenRecording.controller');router[_0xd76d('0x8')]('/',auth[_0xd76d('0x9')](),controller[_0xd76d('0xa')]);router[_0xd76d('0x8')](_0xd76d('0xb'),auth[_0xd76d('0x9')](),controller[_0xd76d('0xc')]);router[_0xd76d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd76d('0xd')]);router['get'](_0xd76d('0xe'),auth[_0xd76d('0x9')](),controller[_0xd76d('0xf')]);router[_0xd76d('0x10')]('/',auth[_0xd76d('0x9')](),controller[_0xd76d('0x11')]);router[_0xd76d('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xd76d('0x13')]);router[_0xd76d('0x14')](_0xd76d('0x15'),auth[_0xd76d('0x9')](),controller[_0xd76d('0x16')]);module['exports']=router; \ No newline at end of file +var _0x9f69=['./screenRecording.controller','isAuthenticated','index','get','describe','/:id','/:id/download','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x9f69,0x1d9));var _0x99f6=function(_0x36a236,_0x3cc5fc){_0x36a236=_0x36a236-0x0;var _0xa4ab27=_0x9f69[_0x36a236];return _0xa4ab27;};'use strict';var multer=require('multer');var util=require(_0x99f6('0x0'));var path=require(_0x99f6('0x1'));var timeout=require(_0x99f6('0x2'));var express=require(_0x99f6('0x3'));var router=express[_0x99f6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x99f6('0x5'));var config=require(_0x99f6('0x6'));var controller=require(_0x99f6('0x7'));router['get']('/',auth[_0x99f6('0x8')](),controller[_0x99f6('0x9')]);router[_0x99f6('0xa')]('/describe',auth[_0x99f6('0x8')](),controller[_0x99f6('0xb')]);router[_0x99f6('0xa')](_0x99f6('0xc'),auth[_0x99f6('0x8')](),controller['show']);router[_0x99f6('0xa')](_0x99f6('0xd'),auth[_0x99f6('0x8')](),controller['download']);router[_0x99f6('0xe')]('/',auth[_0x99f6('0x8')](),controller['create']);router[_0x99f6('0xf')](_0x99f6('0xc'),auth['isAuthenticated'](),controller[_0x99f6('0x10')]);router[_0x99f6('0x11')](_0x99f6('0xc'),auth[_0x99f6('0x8')](),controller[_0x99f6('0x12')]);module[_0x99f6('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index afed406..0d4c2f4 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 _0x4c4e=['../../config/environment','exports','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','toString','createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','path'];(function(_0x3593b7,_0x120d93){var _0x372547=function(_0x5ef0a1){while(--_0x5ef0a1){_0x3593b7['push'](_0x3593b7['shift']());}};_0x372547(++_0x120d93);}(_0x4c4e,0x152));var _0xe4c4=function(_0x4a6784,_0x45fcfc){_0x4a6784=_0x4a6784-0x0;var _0xd3c225=_0x4c4e[_0x4a6784];return _0xd3c225;};'use strict';var Sequelize=require(_0xe4c4('0x0'));var moment=require('moment');var path=require(_0xe4c4('0x1'));var config=require(_0xe4c4('0x2'));module[_0xe4c4('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xe4c4('0x4')](_0xe4c4('0x5'))?path[_0xe4c4('0x6')](this['getDataValue'](_0xe4c4('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe4c4('0x7')]},'value':{'type':Sequelize[_0xe4c4('0x7')],'set':function(_0x262b64){var _0xad105=_0x262b64[_0xe4c4('0x8')](/\\/g,'/');this[_0xe4c4('0x9')](_0xe4c4('0x5'),_0xad105);}},'rating':{'type':Sequelize[_0xe4c4('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x589b2e){this[_0xe4c4('0x9')](_0xe4c4('0xb'),moment()[_0xe4c4('0xc')](_0x589b2e,'ms'));this[_0xe4c4('0x9')](_0xe4c4('0xd'),moment());this[_0xe4c4('0x9')]('duration',_0x589b2e);}},'startedAt':{'type':Sequelize[_0xe4c4('0xe')],'get':function(){return moment(this[_0xe4c4('0x4')](_0xe4c4('0xb')))[_0xe4c4('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xe4c4('0x10')]();}},'closedAt':{'type':Sequelize[_0xe4c4('0xe')],'get':function(){return moment(this['getDataValue'](_0xe4c4('0xd')))[_0xe4c4('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xe4c4('0x10')]();}},'createdAt':{'type':Sequelize[_0xe4c4('0xe')],'get':function(){return moment(this['getDataValue'](_0xe4c4('0x11')))[_0xe4c4('0xf')](_0xe4c4('0x12'))[_0xe4c4('0x10')]();}},'updatedAt':{'type':Sequelize[_0xe4c4('0xe')],'get':function(){return moment(this[_0xe4c4('0x4')](_0xe4c4('0x13')))[_0xe4c4('0xf')](_0xe4c4('0x12'))[_0xe4c4('0x10')]();}}}; \ No newline at end of file +var _0x33c5=['path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','toString','closedAt','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','moment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x33c5,0xe6));var _0x533c=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0x33c5[_0x5c1345];return _0x1c070d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var config=require('../../config/environment');module[_0x533c('0x2')]={'format':{'type':Sequelize[_0x533c('0x3')],'get':function(){return this[_0x533c('0x4')](_0x533c('0x5'))?path[_0x533c('0x6')](this['getDataValue'](_0x533c('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x533c('0x7')]},'channel':{'type':Sequelize[_0x533c('0x7')]},'value':{'type':Sequelize[_0x533c('0x7')],'set':function(_0x34ca89){var _0x1699d5=_0x34ca89[_0x533c('0x8')](/\\/g,'/');this[_0x533c('0x9')](_0x533c('0x5'),_0x1699d5);}},'rating':{'type':Sequelize[_0x533c('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x533c('0xa')],'set':function(_0x46536d){this[_0x533c('0x9')](_0x533c('0xb'),moment()[_0x533c('0xc')](_0x46536d,'ms'));this[_0x533c('0x9')]('closedAt',moment());this[_0x533c('0x9')](_0x533c('0xd'),_0x46536d);}},'startedAt':{'type':Sequelize[_0x533c('0xe')],'get':function(){return moment(this[_0x533c('0x4')](_0x533c('0xb')))[_0x533c('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x533c('0x10')]();}},'closedAt':{'type':Sequelize[_0x533c('0xe')],'get':function(){return moment(this[_0x533c('0x4')](_0x533c('0x11')))[_0x533c('0xf')](_0x533c('0x12'))[_0x533c('0x10')]();}},'createdAt':{'type':Sequelize[_0x533c('0xe')],'get':function(){return moment(this['getDataValue'](_0x533c('0x13')))[_0x533c('0xf')](_0x533c('0x12'))[_0x533c('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x533c('0x4')](_0x533c('0x14')))[_0x533c('0xf')](_0x533c('0x12'))[_0x533c('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 1827bb6..c6b6e4e 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 _0xe946=['request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','intersection','catch','create','body','duration','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','find','join','server/files/screen_recordings','format','existsSync','decryptFile','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','File:\x20\x22','eml-format','rimraf','fast-json-patch'];(function(_0x6287b6,_0x5682e7){var _0x5d6be4=function(_0x3e3975){while(--_0x3e3975){_0x6287b6['push'](_0x6287b6['shift']());}};_0x5d6be4(++_0x5682e7);}(_0xe946,0x18d));var _0x6e94=function(_0x92b9e,_0x242815){_0x92b9e=_0x92b9e-0x0;var _0x542410=_0xe946[_0x92b9e];return _0x542410;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6e94('0x0'));var rimraf=require(_0x6e94('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e94('0x2'));var rp=require(_0x6e94('0x3'));var moment=require(_0x6e94('0x4'));var BPromise=require(_0x6e94('0x5'));var Mustache=require('mustache');var util=require(_0x6e94('0x6'));var path=require('path');var sox=require(_0x6e94('0x7'));var csv=require(_0x6e94('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6e94('0x9'));var squel=require(_0x6e94('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6e94('0xb'));var Papa=require(_0x6e94('0xc'));var Redis=require(_0x6e94('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6e94('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e94('0xf'))('api');var utils=require(_0x6e94('0x10'));var config=require(_0x6e94('0x11'));var db=require(_0x6e94('0x12'))['db'];function respondWithStatusCode(_0xd75907,_0x16d4c5){_0x16d4c5=_0x16d4c5||0xcc;return function(_0x1286a6){if(_0x1286a6){return _0xd75907[_0x6e94('0x13')](_0x16d4c5);}return _0xd75907[_0x6e94('0x14')](_0x16d4c5)[_0x6e94('0x15')]();};}function respondWithResult(_0x4450fc,_0x3a8bc5){_0x3a8bc5=_0x3a8bc5||0xc8;return function(_0x2155cc){if(_0x2155cc){return _0x4450fc[_0x6e94('0x14')](_0x3a8bc5)[_0x6e94('0x16')](_0x2155cc);}};}function respondWithFilteredResult(_0xcb855d,_0x4e993c){return function(_0x1862f2){if(_0x1862f2){var _0x2b7973=_0x1862f2['count'],_0x3ee6e0=_0x4e993c['offset'],_0x546a1d=_0x4e993c[_0x6e94('0x17')]+_0x4e993c['limit'],_0x4a703a;if(_0x546a1d>=_0x2b7973){_0x546a1d=_0x2b7973;_0x4a703a=0xc8;}else{_0x4a703a=0xce;}_0xcb855d[_0x6e94('0x14')](_0x4a703a);return _0xcb855d[_0x6e94('0x18')](_0x6e94('0x19'),_0x3ee6e0+'-'+_0x546a1d+'/'+_0x2b7973)[_0x6e94('0x16')](_0x1862f2);}return null;};}function patchUpdates(_0x244d7f){return function(_0x1cabd3){try{jsonpatch[_0x6e94('0x1a')](_0x1cabd3,_0x244d7f,!![]);}catch(_0x44faff){return BPromise[_0x6e94('0x1b')](_0x44faff);}return _0x1cabd3[_0x6e94('0x1c')]();};}function saveUpdates(_0x3c2724,_0x2e3f94){return function(_0x3ab1b5){if(_0x3ab1b5){return _0x3ab1b5[_0x6e94('0x1d')](_0x3c2724)[_0x6e94('0x1e')](function(_0x5283ed){return _0x5283ed;});}return null;};}function removeEntity(_0x5f5348,_0x3530e9){return function(_0x5be11a){if(_0x5be11a){return _0x5be11a[_0x6e94('0x1f')]()[_0x6e94('0x1e')](function(){_0x5f5348[_0x6e94('0x14')](0xcc)[_0x6e94('0x15')]();});}};}function handleEntityNotFound(_0x2a399b,_0x406786){return function(_0x218a5d){if(!_0x218a5d){_0x2a399b[_0x6e94('0x13')](0x194);}return _0x218a5d;};}function handleError(_0x1a011e,_0x6ba013){_0x6ba013=_0x6ba013||0x1f4;return function(_0x183f15){logger[_0x6e94('0x20')](_0x183f15['stack']);if(_0x183f15[_0x6e94('0x21')]){delete _0x183f15[_0x6e94('0x21')];}_0x1a011e[_0x6e94('0x14')](_0x6ba013)[_0x6e94('0x22')](_0x183f15);};}exports[_0x6e94('0x23')]=function(_0x4fdc90,_0x69c8a4){var _0x17bf12={},_0x199b35={},_0x17f398={'count':0x0,'rows':[]};var _0x58ece6=_[_0x6e94('0x24')](db[_0x6e94('0x25')][_0x6e94('0x26')],function(_0x1cbde5){return{'name':_0x1cbde5[_0x6e94('0x27')],'type':_0x1cbde5[_0x6e94('0x28')][_0x6e94('0x29')]};});_0x199b35[_0x6e94('0x2a')]=_[_0x6e94('0x2b')](_[_0x6e94('0x24')](_0x58ece6,_0x6e94('0x21')),['format']);_0x199b35[_0x6e94('0x2c')]=_[_0x6e94('0x2d')](_0x4fdc90['query']);_0x199b35[_0x6e94('0x2e')]=_['intersection'](_0x199b35[_0x6e94('0x2a')],_0x199b35[_0x6e94('0x2c')]);_0x17bf12[_0x6e94('0x2f')]=_['intersection'](_0x199b35[_0x6e94('0x2a')],qs[_0x6e94('0x30')](_0x4fdc90['query']['fields']));_0x17bf12[_0x6e94('0x2f')]=_0x17bf12[_0x6e94('0x2f')][_0x6e94('0x31')]?_0x17bf12[_0x6e94('0x2f')]:_0x199b35[_0x6e94('0x2a')];if(!_0x4fdc90[_0x6e94('0x2c')][_0x6e94('0x32')]('nolimit')){_0x17bf12[_0x6e94('0x33')]=qs[_0x6e94('0x33')](_0x4fdc90['query']['limit']);_0x17bf12[_0x6e94('0x17')]=qs[_0x6e94('0x17')](_0x4fdc90[_0x6e94('0x2c')][_0x6e94('0x17')]);}_0x17bf12[_0x6e94('0x34')]=qs[_0x6e94('0x35')](_0x4fdc90[_0x6e94('0x2c')][_0x6e94('0x35')]);_0x17bf12[_0x6e94('0x36')]=qs[_0x6e94('0x2e')](_[_0x6e94('0x37')](_0x4fdc90[_0x6e94('0x2c')],_0x199b35[_0x6e94('0x2e')]),_0x58ece6);if(_0x4fdc90['query'][_0x6e94('0x38')]){_0x17bf12[_0x6e94('0x36')]=_[_0x6e94('0x39')](_0x17bf12[_0x6e94('0x36')],{'$or':_['map'](_0x58ece6,function(_0x5acf05){if(_0x5acf05['type']!==_0x6e94('0x3a')){var _0x140edb={};_0x140edb[_0x5acf05[_0x6e94('0x21')]]={'$like':'%'+_0x4fdc90['query'][_0x6e94('0x38')]+'%'};return _0x140edb;}})});}_0x17bf12=_[_0x6e94('0x39')]({},_0x17bf12,_0x4fdc90[_0x6e94('0x3b')]);var _0x319578={'where':_0x17bf12['where']};return db[_0x6e94('0x25')]['count'](_0x319578)['then'](function(_0x3d4167){_0x17f398[_0x6e94('0x3c')]=_0x3d4167;if(_0x4fdc90[_0x6e94('0x2c')][_0x6e94('0x3d')]){_0x17bf12[_0x6e94('0x3e')]=[{'all':!![]}];}return db[_0x6e94('0x25')][_0x6e94('0x3f')](_0x17bf12);})[_0x6e94('0x1e')](function(_0x429687){_0x17f398[_0x6e94('0x40')]=_0x429687;return _0x17f398;})[_0x6e94('0x1e')](respondWithFilteredResult(_0x69c8a4,_0x17bf12))['catch'](handleError(_0x69c8a4,null));};exports['show']=function(_0x1c1160,_0x132863){var _0x186ee7={'raw':![],'where':{'id':_0x1c1160['params']['id']}},_0x303442={};_0x303442['model']=_[_0x6e94('0x2d')](db['ScreenRecording'][_0x6e94('0x26')]);_0x303442[_0x6e94('0x2c')]=_[_0x6e94('0x2d')](_0x1c1160[_0x6e94('0x2c')]);_0x303442[_0x6e94('0x2e')]=_[_0x6e94('0x41')](_0x303442['model'],_0x303442[_0x6e94('0x2c')]);_0x186ee7[_0x6e94('0x2f')]=_['intersection'](_0x303442['model'],qs['fields'](_0x1c1160['query'][_0x6e94('0x30')]));_0x186ee7[_0x6e94('0x2f')]=_0x186ee7[_0x6e94('0x2f')][_0x6e94('0x31')]?_0x186ee7[_0x6e94('0x2f')]:_0x303442['model'];if(_0x1c1160['query']['includeAll']){_0x186ee7[_0x6e94('0x3e')]=[{'all':!![]}];}_0x186ee7=_['merge']({},_0x186ee7,_0x1c1160[_0x6e94('0x3b')]);return db[_0x6e94('0x25')]['find'](_0x186ee7)['then'](handleEntityNotFound(_0x132863,null))[_0x6e94('0x1e')](respondWithResult(_0x132863,null))[_0x6e94('0x42')](handleError(_0x132863,null));};exports[_0x6e94('0x43')]=function(_0x347deb,_0x5c8a3b){return db['ScreenRecording'][_0x6e94('0x43')](_0x347deb[_0x6e94('0x44')],{})[_0x6e94('0x1e')](respondWithResult(_0x5c8a3b,0xc9))[_0x6e94('0x42')](handleError(_0x5c8a3b,null));};exports[_0x6e94('0x1d')]=function(_0x3a20d0,_0x1a9a30){if(_0x3a20d0[_0x6e94('0x44')]['id']){delete _0x3a20d0['body']['id'];}delete _0x3a20d0[_0x6e94('0x44')][_0x6e94('0x45')];delete _0x3a20d0[_0x6e94('0x44')][_0x6e94('0x46')];delete _0x3a20d0['body'][_0x6e94('0x47')];delete _0x3a20d0[_0x6e94('0x44')][_0x6e94('0x48')];return db[_0x6e94('0x25')]['find']({'where':{'id':_0x3a20d0[_0x6e94('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a9a30,null))[_0x6e94('0x1e')](saveUpdates(_0x3a20d0[_0x6e94('0x44')],null))[_0x6e94('0x1e')](respondWithResult(_0x1a9a30,null))['catch'](handleError(_0x1a9a30,null));};exports[_0x6e94('0x4a')]=function(_0x417fb0,_0x2e44b1){return db[_0x6e94('0x25')][_0x6e94('0x4a')]()[_0x6e94('0x1e')](respondWithResult(_0x2e44b1,null))[_0x6e94('0x42')](handleError(_0x2e44b1,null));};exports[_0x6e94('0x4b')]=function(_0x2717e2,_0xdb0689,_0x22326e){var _0x5497d6=require(_0x6e94('0x4c'));var _0x30de8e=![];var _0x38a7eb={};if(_0x2717e2[_0x6e94('0x2c')][_0x6e94('0x28')]&&_0x2717e2[_0x6e94('0x2c')][_0x6e94('0x28')]==='uniqueid'){_0x38a7eb[_0x6e94('0x4d')]=_0x2717e2[_0x6e94('0x49')]['id'];}else{_0x38a7eb['id']=_0x2717e2[_0x6e94('0x49')]['id'];}return db[_0x6e94('0x25')][_0x6e94('0x4e')]({'where':_0x38a7eb,'attributes':['id',_0x6e94('0x48')],'raw':!![]})[_0x6e94('0x1e')](handleEntityNotFound(_0xdb0689,null))[_0x6e94('0x1e')](function(_0x1b47d5){if(_0x1b47d5){var _0x49df49=path[_0x6e94('0x4f')](config['root'],_0x6e94('0x50'),_0x1b47d5[_0x6e94('0x48')]);var _0x1349a3=util[_0x6e94('0x51')]('%s.cypher',_0x49df49);if(fs[_0x6e94('0x52')](_0x1349a3)){_0x30de8e=!![];return _0x5497d6[_0x6e94('0x53')](_0x1349a3,_0x49df49,config['secrets'][_0x6e94('0x54')])[_0x6e94('0x1e')](function(){return _0x1b47d5;});}return _0x1b47d5;}})[_0x6e94('0x1e')](function(_0x54a5e0){if(_0x54a5e0){var _0x21d1c6=path['join'](config[_0x6e94('0x55')],_0x6e94('0x50'),_0x54a5e0[_0x6e94('0x48')]);if(!fs[_0x6e94('0x52')](_0x21d1c6)){throw new db[(_0x6e94('0x56'))][(_0x6e94('0x57'))](_0x6e94('0x58'));}if(_0x54a5e0[_0x6e94('0x59')]){return _0xdb0689[_0x6e94('0x4b')](_0x21d1c6,_0x54a5e0[_0x6e94('0x59')]+path[_0x6e94('0x5a')](_0x21d1c6),function(){if(_0x30de8e){fs[_0x6e94('0x5b')](_0x21d1c6);}});}else{return _0xdb0689[_0x6e94('0x4b')](_0x21d1c6,function(_0x165ca9){if(_0x30de8e){fs[_0x6e94('0x5b')](_0x21d1c6);}});}}})['catch'](function(_0x220e20){if(_0x220e20[_0x6e94('0x5c')]===_0x6e94('0x58')){_0xdb0689[_0x6e94('0x14')](0x194)[_0x6e94('0x22')](_0x6e94('0x5d'));}else{return handleError(_0xdb0689,null);}});};exports[_0x6e94('0x1f')]=function(_0x31415d,_0x116357){return db[_0x6e94('0x25')][_0x6e94('0x4e')]({'where':{'id':_0x31415d['params']['id']}})[_0x6e94('0x1e')](function(_0x664217){if(!_0x664217)throw new ReferenceError('Entity\x20not\x20found');return _0x664217;})[_0x6e94('0x1e')](function(_0x155619){var _0x35c332=path['join'](config[_0x6e94('0x55')],_0x6e94('0x50'),_0x155619[_0x6e94('0x48')]);logger[_0x6e94('0x5e')](_0x6e94('0x5f'),_0x35c332);if(!_['isNil'](_0x155619['value'])&&fs[_0x6e94('0x52')](_0x35c332)){logger['info']('File:\x20\x22'+_0x35c332+_0x6e94('0x60'));fs[_0x6e94('0x61')](_0x35c332);}_0x35c332=_0x35c332+'.cypher';if(!_[_0x6e94('0x62')](_0x155619[_0x6e94('0x48')])&&fs[_0x6e94('0x52')](_0x35c332)){logger['info'](_0x6e94('0x63')+_0x35c332+_0x6e94('0x60'));fs[_0x6e94('0x61')](_0x35c332);}return _0x155619;})[_0x6e94('0x1e')](function(_0x5ae91a){if(!_0x5ae91a)throw new InternalError();return _0x5ae91a['destroy']();})[_0x6e94('0x1e')](function(){_0x116357[_0x6e94('0x14')](0xcc)[_0x6e94('0x15')]();})[_0x6e94('0x42')](handleError(_0x116357,null));}; \ No newline at end of file +var _0xabf1=['type','key','model','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','createdAt','closedAt','params','describe','download','uniqueid','value','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','then','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName'];(function(_0x52e18f,_0x294cc9){var _0x1c381b=function(_0x4bc1ef){while(--_0x4bc1ef){_0x52e18f['push'](_0x52e18f['shift']());}};_0x1c381b(++_0x294cc9);}(_0xabf1,0xa0));var _0x1abf=function(_0x58f992,_0x142571){_0x58f992=_0x58f992-0x0;var _0x17518b=_0xabf1[_0x58f992];return _0x17518b;};'use strict';var pdf=require(_0x1abf('0x0'));var emlformat=require(_0x1abf('0x1'));var rimraf=require(_0x1abf('0x2'));var zipdir=require(_0x1abf('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1abf('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1abf('0x5'));var util=require(_0x1abf('0x6'));var path=require(_0x1abf('0x7'));var sox=require(_0x1abf('0x8'));var csv=require('to-csv');var ejs=require(_0x1abf('0x9'));var fs=require('fs');var _=require(_0x1abf('0xa'));var squel=require(_0x1abf('0xb'));var crypto=require('crypto');var jsforce=require(_0x1abf('0xc'));var deskjs=require(_0x1abf('0xd'));var toCsv=require(_0x1abf('0xe'));var querystring=require(_0x1abf('0xf'));var Papa=require(_0x1abf('0x10'));var Redis=require('ioredis');var authService=require(_0x1abf('0x11'));var qs=require(_0x1abf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1abf('0x13'));var logger=require(_0x1abf('0x14'))(_0x1abf('0x15'));var utils=require(_0x1abf('0x16'));var config=require(_0x1abf('0x17'));var db=require(_0x1abf('0x18'))['db'];function respondWithStatusCode(_0x393f05,_0xbe7492){_0xbe7492=_0xbe7492||0xcc;return function(_0x10392f){if(_0x10392f){return _0x393f05[_0x1abf('0x19')](_0xbe7492);}return _0x393f05[_0x1abf('0x1a')](_0xbe7492)[_0x1abf('0x1b')]();};}function respondWithResult(_0x7978a9,_0x153938){_0x153938=_0x153938||0xc8;return function(_0x526e2e){if(_0x526e2e){return _0x7978a9[_0x1abf('0x1a')](_0x153938)['json'](_0x526e2e);}};}function respondWithFilteredResult(_0x1efef5,_0x24ceb5){return function(_0x11fb2d){if(_0x11fb2d){var _0x401eb7=_0x11fb2d[_0x1abf('0x1c')],_0xb1c766=_0x24ceb5[_0x1abf('0x1d')],_0x3b09b4=_0x24ceb5[_0x1abf('0x1d')]+_0x24ceb5[_0x1abf('0x1e')],_0x13ed29;if(_0x3b09b4>=_0x401eb7){_0x3b09b4=_0x401eb7;_0x13ed29=0xc8;}else{_0x13ed29=0xce;}_0x1efef5[_0x1abf('0x1a')](_0x13ed29);return _0x1efef5[_0x1abf('0x1f')](_0x1abf('0x20'),_0xb1c766+'-'+_0x3b09b4+'/'+_0x401eb7)['json'](_0x11fb2d);}return null;};}function patchUpdates(_0x2dc048){return function(_0x1eba68){try{jsonpatch[_0x1abf('0x21')](_0x1eba68,_0x2dc048,!![]);}catch(_0x4b1eb1){return BPromise['reject'](_0x4b1eb1);}return _0x1eba68['save']();};}function saveUpdates(_0x125509,_0x65a719){return function(_0x16a677){if(_0x16a677){return _0x16a677['update'](_0x125509)['then'](function(_0x2bb995){return _0x2bb995;});}return null;};}function removeEntity(_0x3dc17a,_0x8b621f){return function(_0x3344c9){if(_0x3344c9){return _0x3344c9['destroy']()[_0x1abf('0x22')](function(){_0x3dc17a[_0x1abf('0x1a')](0xcc)[_0x1abf('0x1b')]();});}};}function handleEntityNotFound(_0x15e43b,_0x529083){return function(_0x397346){if(!_0x397346){_0x15e43b[_0x1abf('0x19')](0x194);}return _0x397346;};}function handleError(_0x31a752,_0x1cacc6){_0x1cacc6=_0x1cacc6||0x1f4;return function(_0x15202a){logger[_0x1abf('0x23')](_0x15202a[_0x1abf('0x24')]);if(_0x15202a[_0x1abf('0x25')]){delete _0x15202a[_0x1abf('0x25')];}_0x31a752[_0x1abf('0x1a')](_0x1cacc6)[_0x1abf('0x26')](_0x15202a);};}exports[_0x1abf('0x27')]=function(_0x2db535,_0xfa91c8){var _0x25a19e={},_0x265ba5={},_0x4d2a6f={'count':0x0,'rows':[]};var _0x3aa7af=_[_0x1abf('0x28')](db[_0x1abf('0x29')][_0x1abf('0x2a')],function(_0x26f7b3){return{'name':_0x26f7b3[_0x1abf('0x2b')],'type':_0x26f7b3[_0x1abf('0x2c')][_0x1abf('0x2d')]};});_0x265ba5[_0x1abf('0x2e')]=_['differenceBy'](_[_0x1abf('0x28')](_0x3aa7af,_0x1abf('0x25')),[_0x1abf('0x2f')]);_0x265ba5[_0x1abf('0x30')]=_[_0x1abf('0x31')](_0x2db535[_0x1abf('0x30')]);_0x265ba5[_0x1abf('0x32')]=_[_0x1abf('0x33')](_0x265ba5[_0x1abf('0x2e')],_0x265ba5[_0x1abf('0x30')]);_0x25a19e[_0x1abf('0x34')]=_[_0x1abf('0x33')](_0x265ba5[_0x1abf('0x2e')],qs[_0x1abf('0x35')](_0x2db535[_0x1abf('0x30')]['fields']));_0x25a19e[_0x1abf('0x34')]=_0x25a19e[_0x1abf('0x34')][_0x1abf('0x36')]?_0x25a19e[_0x1abf('0x34')]:_0x265ba5[_0x1abf('0x2e')];if(!_0x2db535[_0x1abf('0x30')]['hasOwnProperty'](_0x1abf('0x37'))){_0x25a19e[_0x1abf('0x1e')]=qs[_0x1abf('0x1e')](_0x2db535['query'][_0x1abf('0x1e')]);_0x25a19e[_0x1abf('0x1d')]=qs['offset'](_0x2db535['query'][_0x1abf('0x1d')]);}_0x25a19e[_0x1abf('0x38')]=qs[_0x1abf('0x39')](_0x2db535[_0x1abf('0x30')][_0x1abf('0x39')]);_0x25a19e['where']=qs[_0x1abf('0x32')](_[_0x1abf('0x3a')](_0x2db535[_0x1abf('0x30')],_0x265ba5['filters']),_0x3aa7af);if(_0x2db535[_0x1abf('0x30')][_0x1abf('0x3b')]){_0x25a19e[_0x1abf('0x3c')]=_[_0x1abf('0x3d')](_0x25a19e[_0x1abf('0x3c')],{'$or':_[_0x1abf('0x28')](_0x3aa7af,function(_0x4a8626){if(_0x4a8626[_0x1abf('0x2c')]!=='VIRTUAL'){var _0x57a66b={};_0x57a66b[_0x4a8626[_0x1abf('0x25')]]={'$like':'%'+_0x2db535[_0x1abf('0x30')]['filter']+'%'};return _0x57a66b;}})});}_0x25a19e=_[_0x1abf('0x3d')]({},_0x25a19e,_0x2db535[_0x1abf('0x3e')]);var _0x20f41f={'where':_0x25a19e['where']};return db['ScreenRecording'][_0x1abf('0x1c')](_0x20f41f)[_0x1abf('0x22')](function(_0x119955){_0x4d2a6f[_0x1abf('0x1c')]=_0x119955;if(_0x2db535['query'][_0x1abf('0x3f')]){_0x25a19e[_0x1abf('0x40')]=[{'all':!![]}];}return db[_0x1abf('0x29')][_0x1abf('0x41')](_0x25a19e);})[_0x1abf('0x22')](function(_0x3d4e89){_0x4d2a6f[_0x1abf('0x42')]=_0x3d4e89;return _0x4d2a6f;})[_0x1abf('0x22')](respondWithFilteredResult(_0xfa91c8,_0x25a19e))[_0x1abf('0x43')](handleError(_0xfa91c8,null));};exports[_0x1abf('0x44')]=function(_0xaaae1e,_0x35d86f){var _0x4f623b={'raw':![],'where':{'id':_0xaaae1e['params']['id']}},_0x28d7d6={};_0x28d7d6[_0x1abf('0x2e')]=_[_0x1abf('0x31')](db[_0x1abf('0x29')][_0x1abf('0x2a')]);_0x28d7d6['query']=_[_0x1abf('0x31')](_0xaaae1e[_0x1abf('0x30')]);_0x28d7d6[_0x1abf('0x32')]=_[_0x1abf('0x33')](_0x28d7d6[_0x1abf('0x2e')],_0x28d7d6[_0x1abf('0x30')]);_0x4f623b[_0x1abf('0x34')]=_[_0x1abf('0x33')](_0x28d7d6['model'],qs[_0x1abf('0x35')](_0xaaae1e[_0x1abf('0x30')][_0x1abf('0x35')]));_0x4f623b[_0x1abf('0x34')]=_0x4f623b[_0x1abf('0x34')]['length']?_0x4f623b[_0x1abf('0x34')]:_0x28d7d6[_0x1abf('0x2e')];if(_0xaaae1e[_0x1abf('0x30')][_0x1abf('0x3f')]){_0x4f623b[_0x1abf('0x40')]=[{'all':!![]}];}_0x4f623b=_[_0x1abf('0x3d')]({},_0x4f623b,_0xaaae1e[_0x1abf('0x3e')]);return db[_0x1abf('0x29')][_0x1abf('0x45')](_0x4f623b)[_0x1abf('0x22')](handleEntityNotFound(_0x35d86f,null))[_0x1abf('0x22')](respondWithResult(_0x35d86f,null))[_0x1abf('0x43')](handleError(_0x35d86f,null));};exports[_0x1abf('0x46')]=function(_0xed6821,_0x14856a){return db['ScreenRecording']['create'](_0xed6821[_0x1abf('0x47')],{})[_0x1abf('0x22')](respondWithResult(_0x14856a,0xc9))[_0x1abf('0x43')](handleError(_0x14856a,null));};exports[_0x1abf('0x48')]=function(_0x1f4646,_0x539f9b){if(_0x1f4646[_0x1abf('0x47')]['id']){delete _0x1f4646[_0x1abf('0x47')]['id'];}delete _0x1f4646[_0x1abf('0x47')]['duration'];delete _0x1f4646['body'][_0x1abf('0x49')];delete _0x1f4646['body'][_0x1abf('0x4a')];delete _0x1f4646[_0x1abf('0x47')]['value'];return db['ScreenRecording'][_0x1abf('0x45')]({'where':{'id':_0x1f4646[_0x1abf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x539f9b,null))[_0x1abf('0x22')](saveUpdates(_0x1f4646[_0x1abf('0x47')],null))['then'](respondWithResult(_0x539f9b,null))[_0x1abf('0x43')](handleError(_0x539f9b,null));};exports[_0x1abf('0x4c')]=function(_0x3e3523,_0x4c76fe){return db[_0x1abf('0x29')]['describe']()['then'](respondWithResult(_0x4c76fe,null))['catch'](handleError(_0x4c76fe,null));};exports[_0x1abf('0x4d')]=function(_0x353733,_0x5730e5,_0x453182){var _0x5b66e5=require('../../components/encryptor');var _0x554e19=![];var _0x2a258c={};if(_0x353733[_0x1abf('0x30')]['type']&&_0x353733[_0x1abf('0x30')]['type']===_0x1abf('0x4e')){_0x2a258c[_0x1abf('0x4e')]=_0x353733[_0x1abf('0x4b')]['id'];}else{_0x2a258c['id']=_0x353733[_0x1abf('0x4b')]['id'];}return db[_0x1abf('0x29')][_0x1abf('0x45')]({'where':_0x2a258c,'attributes':['id',_0x1abf('0x4f')],'raw':!![]})[_0x1abf('0x22')](handleEntityNotFound(_0x5730e5,null))[_0x1abf('0x22')](function(_0xd8f826){if(_0xd8f826){var _0x309aa9=path[_0x1abf('0x50')](config[_0x1abf('0x51')],_0x1abf('0x52'),_0xd8f826[_0x1abf('0x4f')]);var _0x3ffd6d=util[_0x1abf('0x2f')]('%s.cypher',_0x309aa9);if(fs['existsSync'](_0x3ffd6d)){_0x554e19=!![];return _0x5b66e5[_0x1abf('0x53')](_0x3ffd6d,_0x309aa9,config[_0x1abf('0x54')][_0x1abf('0x55')])[_0x1abf('0x22')](function(){return _0xd8f826;});}return _0xd8f826;}})[_0x1abf('0x22')](function(_0x2eea51){if(_0x2eea51){var _0x523966=path[_0x1abf('0x50')](config[_0x1abf('0x51')],_0x1abf('0x52'),_0x2eea51[_0x1abf('0x4f')]);if(!fs[_0x1abf('0x56')](_0x523966)){throw new db[(_0x1abf('0x57'))][(_0x1abf('0x58'))](_0x1abf('0x59'));}if(_0x2eea51[_0x1abf('0x5a')]){return _0x5730e5[_0x1abf('0x4d')](_0x523966,_0x2eea51['filename']+path[_0x1abf('0x5b')](_0x523966),function(){if(_0x554e19){fs[_0x1abf('0x5c')](_0x523966);}});}else{return _0x5730e5[_0x1abf('0x4d')](_0x523966,function(_0x273aca){if(_0x554e19){fs[_0x1abf('0x5c')](_0x523966);}});}}})[_0x1abf('0x43')](function(_0x5b57b2){if(_0x5b57b2[_0x1abf('0x5d')]===_0x1abf('0x59')){_0x5730e5[_0x1abf('0x1a')](0x194)[_0x1abf('0x26')]('Not\x20found');}else{return handleError(_0x5730e5,null);}});};exports['destroy']=function(_0x3e5366,_0x4f054d){return db[_0x1abf('0x29')][_0x1abf('0x45')]({'where':{'id':_0x3e5366[_0x1abf('0x4b')]['id']}})[_0x1abf('0x22')](function(_0x36eacb){if(!_0x36eacb)throw new ReferenceError(_0x1abf('0x5e'));return _0x36eacb;})['then'](function(_0x337be8){var _0xca1d23=path[_0x1abf('0x50')](config[_0x1abf('0x51')],_0x1abf('0x52'),_0x337be8[_0x1abf('0x4f')]);logger[_0x1abf('0x5f')](_0x1abf('0x60'),_0xca1d23);if(!_[_0x1abf('0x61')](_0x337be8[_0x1abf('0x4f')])&&fs['existsSync'](_0xca1d23)){logger[_0x1abf('0x5f')]('File:\x20\x22'+_0xca1d23+_0x1abf('0x62'));fs[_0x1abf('0x63')](_0xca1d23);}_0xca1d23=_0xca1d23+'.cypher';if(!_[_0x1abf('0x61')](_0x337be8[_0x1abf('0x4f')])&&fs[_0x1abf('0x56')](_0xca1d23)){logger[_0x1abf('0x5f')](_0x1abf('0x64')+_0xca1d23+_0x1abf('0x62'));fs[_0x1abf('0x63')](_0xca1d23);}return _0x337be8;})[_0x1abf('0x22')](function(_0xb3b579){if(!_0xb3b579)throw new InternalError();return _0xb3b579[_0x1abf('0x65')]();})[_0x1abf('0x22')](function(){_0x4f054d[_0x1abf('0x1a')](0xcc)[_0x1abf('0x1b')]();})['catch'](handleError(_0x4f054d,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 2f40ea8..b3a13c7 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 _0xfed7=['request-promise','path','rimraf','../../config/environment','exports','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x38c0e7,_0x229f2d){var _0x1bcbee=function(_0x3ff5d2){while(--_0x3ff5d2){_0x38c0e7['push'](_0x38c0e7['shift']());}};_0x1bcbee(++_0x229f2d);}(_0xfed7,0x190));var _0x7fed=function(_0xd31621,_0x17b567){_0xd31621=_0xd31621-0x0;var _0x2e7ac0=_0xfed7[_0xd31621];return _0x2e7ac0;};'use strict';var _=require(_0x7fed('0x0'));var util=require(_0x7fed('0x1'));var logger=require(_0x7fed('0x2'))(_0x7fed('0x3'));var moment=require(_0x7fed('0x4'));var BPromise=require(_0x7fed('0x5'));var rp=require(_0x7fed('0x6'));var fs=require('fs');var path=require(_0x7fed('0x7'));var rimraf=require(_0x7fed('0x8'));var config=require(_0x7fed('0x9'));var attributes=require('./screenRecording.attributes');module[_0x7fed('0xa')]=function(_0x3be30c,_0x517ec1){return _0x3be30c['define'](_0x7fed('0xb'),attributes,{'tableName':_0x7fed('0xc'),'paranoid':![],'indexes':[{'name':_0x7fed('0xd'),'fields':[_0x7fed('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc288=['screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x4fde86,_0x5f4fd3){var _0x47e1aa=function(_0x3125d7){while(--_0x3125d7){_0x4fde86['push'](_0x4fde86['shift']());}};_0x47e1aa(++_0x5f4fd3);}(_0xc288,0x197));var _0x8c28=function(_0x5c1243,_0x17bd31){_0x5c1243=_0x5c1243-0x0;var _0x438ef8=_0xc288[_0x5c1243];return _0x438ef8;};'use strict';var _=require(_0x8c28('0x0'));var util=require(_0x8c28('0x1'));var logger=require(_0x8c28('0x2'))(_0x8c28('0x3'));var moment=require(_0x8c28('0x4'));var BPromise=require(_0x8c28('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c28('0x6'));var rimraf=require(_0x8c28('0x7'));var config=require(_0x8c28('0x8'));var attributes=require(_0x8c28('0x9'));module[_0x8c28('0xa')]=function(_0x55bdaa,_0x4ac558){return _0x55bdaa[_0x8c28('0xb')](_0x8c28('0xc'),attributes,{'tableName':_0x8c28('0xd'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x8c28('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 2b79608..93b657b 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(_0x4ea9fd,_0x2e79ee){var _0x9b4d1c=function(_0x3318da){while(--_0x3318da){_0x4ea9fd['push'](_0x4ea9fd['shift']());}};_0x9b4d1c(++_0x2e79ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x448b24,_0x10a85e){var _0x4ff572=function(_0x36ac98){while(--_0x36ac98){_0x448b24['push'](_0x448b24['shift']());}};_0x4ff572(++_0x10a85e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index db11ab3..6165b48 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 _0x532b=['post','single','file','join','server/files/images/logos/','logologin','addLogoLogin','root','preferred','/:id/preferred','addPreferred','favicon','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','getPreferred','/:id/favicon','diskStorage','format','%s%s','logo','extname','originalname'];(function(_0x1f9429,_0x4181aa){var _0x589756=function(_0xb8b170){while(--_0xb8b170){_0x1f9429['push'](_0x1f9429['shift']());}};_0x589756(++_0x4181aa);}(_0x532b,0x65));var _0xb532=function(_0x142d3e,_0x353e86){_0x142d3e=_0x142d3e-0x0;var _0x493084=_0x532b[_0x142d3e];return _0x493084;};'use strict';var multer=require(_0xb532('0x0'));var util=require(_0xb532('0x1'));var path=require(_0xb532('0x2'));var timeout=require(_0xb532('0x3'));var express=require(_0xb532('0x4'));var router=express[_0xb532('0x5')]();var auth=require(_0xb532('0x6'));var interaction=require(_0xb532('0x7'));var config=require(_0xb532('0x8'));var controller=require(_0xb532('0x9'));router[_0xb532('0xa')]('/',auth[_0xb532('0xb')](),controller[_0xb532('0xc')]);router['get'](_0xb532('0xd'),controller[_0xb532('0xe')]);router[_0xb532('0xa')](_0xb532('0xf'),controller[_0xb532('0x10')]);router[_0xb532('0xa')](_0xb532('0x11'),controller[_0xb532('0x12')]);router['get'](_0xb532('0x13'),controller['gdpr']);router[_0xb532('0xa')]('/:id/preferred',controller[_0xb532('0x14')]);router['get'](_0xb532('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0xb532('0x16')]({'destination':function(_0x34761d,_0x3b412a,_0xb1355a){_0xb1355a(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x2e1a1a,_0x11cdfa,_0x2ab768){_0x2ab768(null,util[_0xb532('0x17')](_0xb532('0x18'),_0xb532('0x19'),path[_0xb532('0x1a')](_0x11cdfa[_0xb532('0x1b')])));}})});router[_0xb532('0x1c')](_0xb532('0xf'),upload[_0xb532('0x1d')](_0xb532('0x1e')),controller['addLogo']);var upload=multer({'storage':multer[_0xb532('0x16')]({'destination':function(_0x2ca120,_0x2ab885,_0x55ffa2){_0x55ffa2(null,path[_0xb532('0x1f')](config['root'],_0xb532('0x20')));},'filename':function(_0x39e2c,_0x5c5329,_0x1c8673){_0x1c8673(null,util[_0xb532('0x17')](_0xb532('0x18'),_0xb532('0x21'),path['extname'](_0x5c5329[_0xb532('0x1b')])));}})});router[_0xb532('0x1c')]('/:id/logo_login',upload[_0xb532('0x1d')](_0xb532('0x1e')),controller[_0xb532('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x26dfd2,_0x175c5e,_0x569d3e){_0x569d3e(null,path[_0xb532('0x1f')](config[_0xb532('0x23')],'server/files/images/logos/'));},'filename':function(_0x39d557,_0x56080c,_0x5c99cd){_0x5c99cd(null,util[_0xb532('0x17')](_0xb532('0x18'),_0xb532('0x24'),path['extname'](_0x56080c['originalname'])));}})});router['post'](_0xb532('0x25'),upload['single'](_0xb532('0x1e')),controller[_0xb532('0x26')]);var upload=multer({'storage':multer[_0xb532('0x16')]({'destination':function(_0xf35f56,_0x340e4a,_0x52edee){_0x52edee(null,path[_0xb532('0x1f')](config[_0xb532('0x23')],_0xb532('0x20')));},'filename':function(_0x3f0468,_0x11aa3f,_0x1eaffa){_0x1eaffa(null,util[_0xb532('0x17')](_0xb532('0x18'),_0xb532('0x27'),path[_0xb532('0x1a')](_0x11aa3f[_0xb532('0x1b')])));}})});router['post'](_0xb532('0x15'),upload[_0xb532('0x1d')](_0xb532('0x1e')),controller['addFavicon']);router[_0xb532('0x28')](_0xb532('0xd'),auth[_0xb532('0xb')](),controller[_0xb532('0x29')]);module[_0xb532('0x2a')]=router; \ No newline at end of file +var _0xcc73=['addLogoLogin','join','preferred','addPreferred','post','addFavicon','/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id/logo','getLogo','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','root','%s%s','logo','extname','originalname','single','file','addLogo','diskStorage','server/files/images/logos/','format','logologin','/:id/logo_login'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0xcc73,0x12f));var _0x3cc7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xcc73[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x3cc7('0x0'));var util=require(_0x3cc7('0x1'));var path=require(_0x3cc7('0x2'));var timeout=require(_0x3cc7('0x3'));var express=require(_0x3cc7('0x4'));var router=express[_0x3cc7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3cc7('0x6'));var config=require(_0x3cc7('0x7'));var controller=require(_0x3cc7('0x8'));router[_0x3cc7('0x9')]('/',auth[_0x3cc7('0xa')](),controller[_0x3cc7('0xb')]);router[_0x3cc7('0x9')]('/:id',controller['show']);router[_0x3cc7('0x9')](_0x3cc7('0xc'),controller[_0x3cc7('0xd')]);router[_0x3cc7('0x9')]('/:id/logo_login',controller['getLogoLogin']);router[_0x3cc7('0x9')](_0x3cc7('0xe'),controller[_0x3cc7('0xf')]);router[_0x3cc7('0x9')](_0x3cc7('0x10'),controller[_0x3cc7('0x11')]);router[_0x3cc7('0x9')](_0x3cc7('0x12'),controller[_0x3cc7('0x13')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x15a7de,_0x17f0ba,_0x273196){_0x273196(null,path['join'](config[_0x3cc7('0x14')],'server/files/images/logos/'));},'filename':function(_0x55ce4c,_0x444b7d,_0x23c272){_0x23c272(null,util['format'](_0x3cc7('0x15'),_0x3cc7('0x16'),path[_0x3cc7('0x17')](_0x444b7d[_0x3cc7('0x18')])));}})});router['post'](_0x3cc7('0xc'),upload[_0x3cc7('0x19')](_0x3cc7('0x1a')),controller[_0x3cc7('0x1b')]);var upload=multer({'storage':multer[_0x3cc7('0x1c')]({'destination':function(_0x5f51cb,_0x50566c,_0xee939e){_0xee939e(null,path['join'](config['root'],_0x3cc7('0x1d')));},'filename':function(_0x55523c,_0x5a8ae4,_0x19e80e){_0x19e80e(null,util[_0x3cc7('0x1e')](_0x3cc7('0x15'),_0x3cc7('0x1f'),path[_0x3cc7('0x17')](_0x5a8ae4[_0x3cc7('0x18')])));}})});router['post'](_0x3cc7('0x20'),upload[_0x3cc7('0x19')](_0x3cc7('0x1a')),controller[_0x3cc7('0x21')]);var upload=multer({'storage':multer[_0x3cc7('0x1c')]({'destination':function(_0x547783,_0x405f60,_0x55b8a1){_0x55b8a1(null,path[_0x3cc7('0x22')](config[_0x3cc7('0x14')],'server/files/images/logos/'));},'filename':function(_0x4ef203,_0x580a55,_0x4cae24){_0x4cae24(null,util[_0x3cc7('0x1e')](_0x3cc7('0x15'),_0x3cc7('0x23'),path['extname'](_0x580a55['originalname'])));}})});router['post'](_0x3cc7('0x10'),upload['single'](_0x3cc7('0x1a')),controller[_0x3cc7('0x24')]);var upload=multer({'storage':multer[_0x3cc7('0x1c')]({'destination':function(_0x2b8a92,_0x3c905c,_0x5ac05a){_0x5ac05a(null,path[_0x3cc7('0x22')](config[_0x3cc7('0x14')],'server/files/images/logos/'));},'filename':function(_0x34c988,_0x252272,_0x5e4aae){_0x5e4aae(null,util[_0x3cc7('0x1e')](_0x3cc7('0x15'),'favicon',path['extname'](_0x252272[_0x3cc7('0x18')])));}})});router[_0x3cc7('0x25')](_0x3cc7('0x12'),upload[_0x3cc7('0x19')](_0x3cc7('0x1a')),controller[_0x3cc7('0x26')]);router['put'](_0x3cc7('0x27'),auth[_0x3cc7('0xa')](),controller[_0x3cc7('0x28')]);module[_0x3cc7('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index daa8d5e..c2bede6 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 _0x9c5c=['INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports'];(function(_0x425fd7,_0x57a29b){var _0x2edf8a=function(_0x4bb5ea){while(--_0x4bb5ea){_0x425fd7['push'](_0x425fd7['shift']());}};_0x2edf8a(++_0x57a29b);}(_0x9c5c,0x8e));var _0xc9c5=function(_0xefe5f,_0x4c9050){_0xefe5f=_0xefe5f-0x0;var _0x5b2f07=_0x9c5c[_0xefe5f];return _0x5b2f07;};'use strict';var Sequelize=require(_0xc9c5('0x0'));module[_0xc9c5('0x1')]={'min_internal':{'type':Sequelize[_0xc9c5('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xc9c5('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xc9c5('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xc9c5('0x3')],'defaultValue':_0xc9c5('0x4')},'logo':{'type':Sequelize[_0xc9c5('0x3')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xc9c5('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0xc9c5('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xc9c5('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xc9c5('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xc9c5('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xc9c5('0x3')]},'turnaddr':{'type':Sequelize[_0xc9c5('0x3')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xc9c5('0x3')]},'pageTitle':{'type':Sequelize[_0xc9c5('0x3')]},'defaultPageTitle':{'type':Sequelize[_0xc9c5('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xc9c5('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xc9c5('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xc9c5('0x3')],'defaultValue':_0xc9c5('0x6')},'enableEmailPreview':{'type':Sequelize[_0xc9c5('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xc9c5('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xc9c5('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xc9c5('0x3')],'defaultValue':_0xc9c5('0x7')},'chatTimeout':{'type':Sequelize[_0xc9c5('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xc9c5('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xc9c5('0x3')]},'defaultPreferred':{'type':Sequelize[_0xc9c5('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xc9c5('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xc9c5('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0xc9c5('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xc9c5('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xc9c5('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xc9c5('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xc9c5('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xc9c5('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xc9c5('0x2')]},'transcribeRegion':{'type':Sequelize[_0xc9c5('0x3')]},'sentiment':{'type':Sequelize[_0xc9c5('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xc9c5('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xc9c5('0x3')]},'language':{'type':Sequelize[_0xc9c5('0x3')]},'bucket':{'type':Sequelize[_0xc9c5('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0xc9c5('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x61b5=['STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','sequelize','exports','INTEGER','min_mailbox'];(function(_0x205fb2,_0x49ea96){var _0x1350f4=function(_0x47f15c){while(--_0x47f15c){_0x205fb2['push'](_0x205fb2['shift']());}};_0x1350f4(++_0x49ea96);}(_0x61b5,0x1bc));var _0x561b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x61b5[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x561b('0x0'));module[_0x561b('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x561b('0x2')](0xb),'unique':_0x561b('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x561b('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x561b('0x4')],'defaultValue':_0x561b('0x5')},'logo':{'type':Sequelize[_0x561b('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x561b('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x561b('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x561b('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x561b('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x561b('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x561b('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x561b('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x561b('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x561b('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x561b('0x4')],'defaultValue':_0x561b('0x7')},'enableEmailPreview':{'type':Sequelize[_0x561b('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x561b('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x561b('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x561b('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x561b('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x561b('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x561b('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x561b('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x561b('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x561b('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x561b('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x561b('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x561b('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x561b('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x561b('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x561b('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x561b('0x4')]},'language':{'type':Sequelize[_0x561b('0x4')]},'bucket':{'type':Sequelize[_0x561b('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x561b('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 35db0f5..0f7478e 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 _0x6a33=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','destroy','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options','Setting','count','includeAll','findAll','params','length','include','find','update','body','file','filename','logo','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','\x20not\x20found','getLogoLogin','default_loginLogo.svg','custom','download','gdpr','securePassword','preferred','getPreferred','defaultFavicon','default_preferred.png','getFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','querystring'];(function(_0x333598,_0x560c90){var _0x2f4acb=function(_0x275a3b){while(--_0x275a3b){_0x333598['push'](_0x333598['shift']());}};_0x2f4acb(++_0x560c90);}(_0x6a33,0x1b6));var _0x36a3=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x6a33[_0x1203f];return _0x365f0a;};'use strict';var pdf=require(_0x36a3('0x0'));var emlformat=require(_0x36a3('0x1'));var rimraf=require(_0x36a3('0x2'));var zipdir=require(_0x36a3('0x3'));var jsonpatch=require(_0x36a3('0x4'));var rp=require(_0x36a3('0x5'));var moment=require('moment');var BPromise=require(_0x36a3('0x6'));var Mustache=require(_0x36a3('0x7'));var util=require('util');var path=require(_0x36a3('0x8'));var sox=require(_0x36a3('0x9'));var csv=require(_0x36a3('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x36a3('0xb'));var crypto=require('crypto');var jsforce=require(_0x36a3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x36a3('0xa'));var querystring=require(_0x36a3('0xd'));var Papa=require(_0x36a3('0xe'));var Redis=require('ioredis');var authService=require(_0x36a3('0xf'));var qs=require(_0x36a3('0x10'));var as=require(_0x36a3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x36a3('0x12'))('api');var utils=require(_0x36a3('0x13'));var config=require(_0x36a3('0x14'));var db=require(_0x36a3('0x15'))['db'];var jayson=require(_0x36a3('0x16'));var client=jayson[_0x36a3('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x4f6798,_0x268319,_0x546682){if(_0x546682){var _0x23e360=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x23e360[_0x36a3('0x18')](_0x268319)){return _0x4f6798;}else{throw new db[(_0x36a3('0x19'))][(_0x36a3('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 _0x4f6798;}}function respondWithRpcPromise(_0x291205,_0x1d5191,_0x312cfb,_0x51eb29){return new BPromise(function(_0x4ba18b,_0x852359){var _0xbb8079=_0x51eb29||client;return _0xbb8079[_0x36a3('0x1b')](_0x291205,_0x312cfb)[_0x36a3('0x1c')](function(_0x5ce4b9){logger[_0x36a3('0x1d')](_0x36a3('0x1e'),_0x1d5191,_0x36a3('0x1f'));logger[_0x36a3('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x1d5191,_0x36a3('0x1f'),JSON[_0x36a3('0x21')](_0x5ce4b9));if(_0x5ce4b9[_0x36a3('0x22')]){if(_0x5ce4b9[_0x36a3('0x22')]['code']===0x1f4){logger[_0x36a3('0x22')]('Setting,\x20%s,\x20%s',_0x1d5191,_0x5ce4b9[_0x36a3('0x22')][_0x36a3('0x23')]);return _0x852359(_0x5ce4b9[_0x36a3('0x22')][_0x36a3('0x23')]);}logger[_0x36a3('0x22')](_0x36a3('0x1e'),_0x1d5191,_0x5ce4b9[_0x36a3('0x22')][_0x36a3('0x23')]);return _0x4ba18b(_0x5ce4b9[_0x36a3('0x22')]['message']);}else{logger[_0x36a3('0x1d')](_0x36a3('0x1e'),_0x1d5191,_0x36a3('0x1f'));_0x4ba18b(_0x5ce4b9[_0x36a3('0x24')][_0x36a3('0x23')]);}})[_0x36a3('0x25')](function(_0x1e4404){logger[_0x36a3('0x22')](_0x36a3('0x1e'),_0x1d5191,_0x1e4404);_0x852359(_0x1e4404);});});}function respondWithStatusCode(_0x30741c,_0x326fc4){_0x326fc4=_0x326fc4||0xcc;return function(_0x574d24){if(_0x574d24){return _0x30741c[_0x36a3('0x26')](_0x326fc4);}return _0x30741c[_0x36a3('0x27')](_0x326fc4)[_0x36a3('0x28')]();};}function respondWithResult(_0x3f2a82,_0x2137c6){_0x2137c6=_0x2137c6||0xc8;return function(_0x52d0cc){if(_0x52d0cc){return _0x3f2a82[_0x36a3('0x27')](_0x2137c6)[_0x36a3('0x29')](_0x52d0cc);}};}function respondWithFilteredResult(_0x435a48,_0x12b4fe){return function(_0x588b4e){if(_0x588b4e){var _0x1261d6=_0x588b4e['count'],_0x76eb3b=_0x12b4fe[_0x36a3('0x2a')],_0x33e7d6=_0x12b4fe[_0x36a3('0x2a')]+_0x12b4fe[_0x36a3('0x2b')],_0x10738b;if(_0x33e7d6>=_0x1261d6){_0x33e7d6=_0x1261d6;_0x10738b=0xc8;}else{_0x10738b=0xce;}_0x435a48[_0x36a3('0x27')](_0x10738b);return _0x435a48[_0x36a3('0x2c')](_0x36a3('0x2d'),_0x76eb3b+'-'+_0x33e7d6+'/'+_0x1261d6)[_0x36a3('0x29')](_0x588b4e);}return null;};}function patchUpdates(_0x44ead0){return function(_0x13f331){try{jsonpatch[_0x36a3('0x2e')](_0x13f331,_0x44ead0,!![]);}catch(_0x59b6ed){return BPromise[_0x36a3('0x2f')](_0x59b6ed);}return _0x13f331['save']();};}function saveUpdates(_0x5ee657,_0x2badc8){return function(_0x480106){if(_0x480106){return _0x480106['update'](_0x5ee657)[_0x36a3('0x1c')](function(_0x4bcf83){return _0x4bcf83;});}return null;};}function removeEntity(_0x3e829a,_0x52c0e5){return function(_0x152b5c){if(_0x152b5c){return _0x152b5c[_0x36a3('0x30')]()['then'](function(){_0x3e829a[_0x36a3('0x27')](0xcc)[_0x36a3('0x28')]();});}};}function handleEntityNotFound(_0x50d245,_0x1ca27d){return function(_0x118df6){if(!_0x118df6){_0x50d245[_0x36a3('0x26')](0x194);}return _0x118df6;};}function handleError(_0x21f6f4,_0x467576){_0x467576=_0x467576||0x1f4;return function(_0x449ef2){logger['error'](_0x449ef2['stack']);if(_0x449ef2[_0x36a3('0x31')]){delete _0x449ef2[_0x36a3('0x31')];}_0x21f6f4[_0x36a3('0x27')](_0x467576)[_0x36a3('0x32')](_0x449ef2);};}exports[_0x36a3('0x33')]=function(_0x5a14ae,_0x7a58e2){var _0x527e90={},_0x90ddb7={},_0x381f5c={'count':0x0,'rows':[]};var _0x8ad100=_[_0x36a3('0x34')](db['Setting'][_0x36a3('0x35')],function(_0x44f3b9){return{'name':_0x44f3b9[_0x36a3('0x36')],'type':_0x44f3b9[_0x36a3('0x37')]['key']};});_0x90ddb7[_0x36a3('0x38')]=_[_0x36a3('0x34')](_0x8ad100,_0x36a3('0x31'));_0x90ddb7[_0x36a3('0x39')]=_[_0x36a3('0x3a')](_0x5a14ae[_0x36a3('0x39')]);_0x90ddb7['filters']=_['intersection'](_0x90ddb7[_0x36a3('0x38')],_0x90ddb7[_0x36a3('0x39')]);_0x527e90[_0x36a3('0x3b')]=_[_0x36a3('0x3c')](_0x90ddb7[_0x36a3('0x38')],qs['fields'](_0x5a14ae[_0x36a3('0x39')][_0x36a3('0x3d')]));_0x527e90[_0x36a3('0x3b')]=_0x527e90[_0x36a3('0x3b')]['length']?_0x527e90[_0x36a3('0x3b')]:_0x90ddb7['model'];if(!_0x5a14ae['query'][_0x36a3('0x3e')]('nolimit')){_0x527e90['limit']=qs[_0x36a3('0x2b')](_0x5a14ae[_0x36a3('0x39')][_0x36a3('0x2b')]);_0x527e90[_0x36a3('0x2a')]=qs['offset'](_0x5a14ae[_0x36a3('0x39')][_0x36a3('0x2a')]);}_0x527e90[_0x36a3('0x3f')]=qs[_0x36a3('0x40')](_0x5a14ae[_0x36a3('0x39')][_0x36a3('0x40')]);_0x527e90[_0x36a3('0x41')]=qs['filters'](_['pick'](_0x5a14ae[_0x36a3('0x39')],_0x90ddb7[_0x36a3('0x42')]),_0x8ad100);if(_0x5a14ae[_0x36a3('0x39')][_0x36a3('0x43')]){_0x527e90[_0x36a3('0x41')]=_['merge'](_0x527e90[_0x36a3('0x41')],{'$or':_[_0x36a3('0x34')](_0x8ad100,function(_0x3e9316){if(_0x3e9316[_0x36a3('0x37')]!==_0x36a3('0x44')){var _0x182c1a={};_0x182c1a[_0x3e9316[_0x36a3('0x31')]]={'$like':'%'+_0x5a14ae[_0x36a3('0x39')]['filter']+'%'};return _0x182c1a;}})});}_0x527e90=_[_0x36a3('0x45')]({},_0x527e90,_0x5a14ae[_0x36a3('0x46')]);var _0x5104e7={'where':_0x527e90[_0x36a3('0x41')]};return db[_0x36a3('0x47')][_0x36a3('0x48')](_0x5104e7)[_0x36a3('0x1c')](function(_0x4bef5f){_0x381f5c['count']=_0x4bef5f;if(_0x5a14ae[_0x36a3('0x39')][_0x36a3('0x49')]){_0x527e90['include']=[{'all':!![]}];}return db[_0x36a3('0x47')][_0x36a3('0x4a')](_0x527e90);})[_0x36a3('0x1c')](function(_0x5c1dea){_0x381f5c['rows']=_0x5c1dea;return _0x381f5c;})[_0x36a3('0x1c')](respondWithFilteredResult(_0x7a58e2,_0x527e90))[_0x36a3('0x25')](handleError(_0x7a58e2,null));};exports['show']=function(_0x1cdaa0,_0x490af5){var _0x41fdd0={'raw':![],'where':{'id':_0x1cdaa0[_0x36a3('0x4b')]['id']}},_0x1561a3={};_0x1561a3['model']=_['keys'](db['Setting'][_0x36a3('0x35')]);_0x1561a3[_0x36a3('0x39')]=_[_0x36a3('0x3a')](_0x1cdaa0[_0x36a3('0x39')]);_0x1561a3[_0x36a3('0x42')]=_[_0x36a3('0x3c')](_0x1561a3[_0x36a3('0x38')],_0x1561a3[_0x36a3('0x39')]);_0x41fdd0['attributes']=_[_0x36a3('0x3c')](_0x1561a3[_0x36a3('0x38')],qs[_0x36a3('0x3d')](_0x1cdaa0[_0x36a3('0x39')][_0x36a3('0x3d')]));_0x41fdd0['attributes']=_0x41fdd0[_0x36a3('0x3b')][_0x36a3('0x4c')]?_0x41fdd0[_0x36a3('0x3b')]:_0x1561a3['model'];if(_0x1cdaa0[_0x36a3('0x39')]['includeAll']){_0x41fdd0[_0x36a3('0x4d')]=[{'all':!![]}];}_0x41fdd0=_[_0x36a3('0x45')]({},_0x41fdd0,_0x1cdaa0[_0x36a3('0x46')]);return db[_0x36a3('0x47')][_0x36a3('0x4e')](_0x41fdd0)['then'](handleEntityNotFound(_0x490af5,null))[_0x36a3('0x1c')](respondWithResult(_0x490af5,null))[_0x36a3('0x25')](handleError(_0x490af5,null));};exports[_0x36a3('0x4f')]=function(_0x3ac8a9,_0x357c52){if(_0x3ac8a9['body']['id']){delete _0x3ac8a9[_0x36a3('0x50')]['id'];}return db[_0x36a3('0x47')][_0x36a3('0x4e')]({'where':{'id':_0x3ac8a9[_0x36a3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x357c52,null))[_0x36a3('0x1c')](saveUpdates(_0x3ac8a9['body'],null))['then'](respondWithResult(_0x357c52,null))['catch'](handleError(_0x357c52,null));};exports['addLogo']=function(_0x418215,_0x25cd83,_0xbbc46c){if(_0x418215[_0x36a3('0x51')]&&_0x418215[_0x36a3('0x51')][_0x36a3('0x52')]){_0x418215['body'][_0x36a3('0x53')]=_0x418215[_0x36a3('0x51')][_0x36a3('0x52')];}return db[_0x36a3('0x47')]['find']({'where':{'id':_0x418215['params']['id']}})['then'](handleEntityNotFound(_0x25cd83,null))[_0x36a3('0x1c')](saveUpdates(_0x418215[_0x36a3('0x50')],null))['then'](respondWithResult(_0x25cd83,null))[_0x36a3('0x25')](handleError(_0x25cd83,null));};exports['addLogoLogin']=function(_0xf5a752,_0x27463b,_0x59db1b){if(_0xf5a752[_0x36a3('0x51')]&&_0xf5a752[_0x36a3('0x51')][_0x36a3('0x52')]){_0xf5a752[_0x36a3('0x50')][_0x36a3('0x54')]=_0xf5a752['file'][_0x36a3('0x52')];}return db['Setting'][_0x36a3('0x4e')]({'where':{'id':_0xf5a752[_0x36a3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x27463b,null))['then'](saveUpdates(_0xf5a752[_0x36a3('0x50')],null))[_0x36a3('0x1c')](respondWithResult(_0x27463b,null))['catch'](handleError(_0x27463b,null));};var utilLicense=require(_0x36a3('0x55'));exports[_0x36a3('0x56')]=function(_0x32075a,_0x38253d,_0x57a01d){var _0x6e2d5c=_0x36a3('0x57');var _0x551814={'custom':![]};return utilLicense[_0x36a3('0x58')]()[_0x36a3('0x1c')](function(_0x89288){if(_0x89288){_0x551814=_0x89288;}return db['Setting'][_0x36a3('0x4e')]({'where':{'id':_0x32075a[_0x36a3('0x4b')]['id']},'attributes':['logo',_0x36a3('0x54'),'preferred',_0x36a3('0x59'),_0x36a3('0x5a'),_0x36a3('0x5b'),_0x36a3('0x5c'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x38253d,null))[_0x36a3('0x1c')](function(_0x109f51){if(_0x109f51){var _0x41b8ce=_0x109f51[_0x36a3('0x53')]&&fs[_0x36a3('0x5d')](path[_0x36a3('0x5e')](config[_0x36a3('0x5f')],_0x6e2d5c,_[_0x36a3('0x60')](_0x109f51['logo'])))?path[_0x36a3('0x5e')](config[_0x36a3('0x5f')],_0x6e2d5c,_[_0x36a3('0x60')](_0x109f51[_0x36a3('0x53')])):path[_0x36a3('0x5e')](config[_0x36a3('0x5f')],_0x6e2d5c,_['toLower'](_0x36a3('0x61')));var _0x134fb2=_0x36a3('0x62')+_[_0x36a3('0x63')]('logo');if(_0x109f51[_0x134fb2]||!_0x551814['custom']){_0x41b8ce=path[_0x36a3('0x5e')](config[_0x36a3('0x5f')],_0x6e2d5c,_[_0x36a3('0x60')]('default_logo.svg'));}if(!fs[_0x36a3('0x5d')](_0x41b8ce)){throw new db[(_0x36a3('0x19'))][(_0x36a3('0x1a'))](_[_0x36a3('0x63')](_0x36a3('0x53'))+_0x36a3('0x64'));}return _0x38253d['download'](_0x41b8ce);}})['catch'](handleError(_0x38253d,null));};var utilLicense=require('../../config/license/util');exports[_0x36a3('0x65')]=function(_0x596575,_0x595798,_0x45c4a3){var _0x163964=_0x36a3('0x57');var _0x5a1faa={'custom':![]};return utilLicense[_0x36a3('0x58')]()[_0x36a3('0x1c')](function(_0x1c7b6b){if(_0x1c7b6b){_0x5a1faa=_0x1c7b6b;}return db[_0x36a3('0x47')][_0x36a3('0x4e')]({'where':{'id':_0x596575['params']['id']},'attributes':[_0x36a3('0x53'),_0x36a3('0x54'),'preferred',_0x36a3('0x59'),_0x36a3('0x5a'),'defaultLoginLogo',_0x36a3('0x5c'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x595798,null))[_0x36a3('0x1c')](function(_0x277d7c){if(_0x277d7c){var _0x5c125a=_0x277d7c[_0x36a3('0x54')]&&fs['existsSync'](path[_0x36a3('0x5e')](config[_0x36a3('0x5f')],_0x163964,_[_0x36a3('0x60')](_0x277d7c[_0x36a3('0x54')])))?path[_0x36a3('0x5e')](config[_0x36a3('0x5f')],_0x163964,_[_0x36a3('0x60')](_0x277d7c['loginLogo'])):path[_0x36a3('0x5e')](config[_0x36a3('0x5f')],_0x163964,_[_0x36a3('0x60')](_0x36a3('0x66')));var _0x1a5215=_0x36a3('0x62')+_[_0x36a3('0x63')](_0x36a3('0x54'));if(_0x277d7c[_0x1a5215]||!_0x5a1faa[_0x36a3('0x67')]){_0x5c125a=path['join'](config['root'],_0x163964,_[_0x36a3('0x60')](_0x36a3('0x66')));}if(!fs[_0x36a3('0x5d')](_0x5c125a)){throw new db[(_0x36a3('0x19'))]['ValidationError'](_[_0x36a3('0x63')](_0x36a3('0x54'))+'\x20not\x20found');}return _0x595798[_0x36a3('0x68')](_0x5c125a);}})[_0x36a3('0x25')](handleError(_0x595798,null));};exports[_0x36a3('0x69')]=function(_0x410011,_0x481013){return db[_0x36a3('0x47')][_0x36a3('0x4e')]({'where':{'id':_0x410011[_0x36a3('0x4b')]['id']},'attributes':[_0x36a3('0x6a')]})[_0x36a3('0x1c')](respondWithResult(_0x481013,null))[_0x36a3('0x25')](handleError(_0x481013,null));};exports['addPreferred']=function(_0x5da72b,_0x2f6349,_0x4a08ce){if(_0x5da72b['file']&&_0x5da72b[_0x36a3('0x51')][_0x36a3('0x52')]){_0x5da72b[_0x36a3('0x50')][_0x36a3('0x6b')]=_0x5da72b['file'][_0x36a3('0x52')];}return db[_0x36a3('0x47')][_0x36a3('0x4e')]({'where':{'id':_0x5da72b[_0x36a3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2f6349,null))['then'](saveUpdates(_0x5da72b['body'],null))[_0x36a3('0x1c')](respondWithResult(_0x2f6349,null))[_0x36a3('0x25')](handleError(_0x2f6349,null));};var utilLicense=require(_0x36a3('0x55'));exports[_0x36a3('0x6c')]=function(_0x3020fa,_0x1fe74b,_0xa1b62b){var _0x56f7e4='server/files/images/logos';var _0x48f4fe={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x47616c){if(_0x47616c){_0x48f4fe=_0x47616c;}return db['Setting']['find']({'where':{'id':_0x3020fa[_0x36a3('0x4b')]['id']},'attributes':[_0x36a3('0x53'),_0x36a3('0x54'),_0x36a3('0x6b'),_0x36a3('0x59'),_0x36a3('0x5a'),'defaultLoginLogo',_0x36a3('0x5c'),_0x36a3('0x6d')],'raw':!![]});})[_0x36a3('0x1c')](handleEntityNotFound(_0x1fe74b,null))[_0x36a3('0x1c')](function(_0x18bfe2){if(_0x18bfe2){var _0x4fd802=_0x18bfe2[_0x36a3('0x6b')]&&fs[_0x36a3('0x5d')](path[_0x36a3('0x5e')](config[_0x36a3('0x5f')],_0x56f7e4,_[_0x36a3('0x60')](_0x18bfe2[_0x36a3('0x6b')])))?path['join'](config['root'],_0x56f7e4,_[_0x36a3('0x60')](_0x18bfe2[_0x36a3('0x6b')])):path[_0x36a3('0x5e')](config[_0x36a3('0x5f')],_0x56f7e4,_[_0x36a3('0x60')]('default_preferred.png'));var _0x194041=_0x36a3('0x62')+_[_0x36a3('0x63')](_0x36a3('0x6b'));if(_0x18bfe2[_0x194041]||!_0x48f4fe[_0x36a3('0x67')]||!_0x48f4fe[_0x36a3('0x6b')]){_0x4fd802=path[_0x36a3('0x5e')](config[_0x36a3('0x5f')],_0x56f7e4,_['toLower'](_0x36a3('0x6e')));}if(!fs[_0x36a3('0x5d')](_0x4fd802)){throw new db['Sequelize'][(_0x36a3('0x1a'))](_[_0x36a3('0x63')](_0x36a3('0x6b'))+_0x36a3('0x64'));}return _0x1fe74b[_0x36a3('0x68')](_0x4fd802);}})[_0x36a3('0x25')](handleError(_0x1fe74b,null));};exports['addFavicon']=function(_0x24e213,_0x180897,_0x36db36){if(_0x24e213['file']&&_0x24e213[_0x36a3('0x51')][_0x36a3('0x52')]){_0x24e213[_0x36a3('0x50')][_0x36a3('0x59')]=_0x24e213['file'][_0x36a3('0x52')];}return db[_0x36a3('0x47')][_0x36a3('0x4e')]({'where':{'id':_0x24e213[_0x36a3('0x4b')]['id']}})[_0x36a3('0x1c')](handleEntityNotFound(_0x180897,null))['then'](saveUpdates(_0x24e213['body'],null))['then'](respondWithResult(_0x180897,null))[_0x36a3('0x25')](handleError(_0x180897,null));};var utilLicense=require('../../config/license/util');exports[_0x36a3('0x6f')]=function(_0x2dd13c,_0x442f5a,_0x2ad260){var _0x4ccf77=_0x36a3('0x57');var _0x315236={'custom':![]};return utilLicense[_0x36a3('0x58')]()[_0x36a3('0x1c')](function(_0x5f1b54){if(_0x5f1b54){_0x315236=_0x5f1b54;}return db[_0x36a3('0x47')][_0x36a3('0x4e')]({'where':{'id':_0x2dd13c[_0x36a3('0x4b')]['id']},'attributes':[_0x36a3('0x53'),_0x36a3('0x54'),_0x36a3('0x6b'),_0x36a3('0x59'),_0x36a3('0x5a'),'defaultLoginLogo','defaultPreferred',_0x36a3('0x6d')],'raw':!![]});})[_0x36a3('0x1c')](handleEntityNotFound(_0x442f5a,null))['then'](function(_0x516b0e){if(_0x516b0e){var _0x5b0428=_0x516b0e[_0x36a3('0x59')]&&fs['existsSync'](path['join'](config[_0x36a3('0x5f')],_0x4ccf77,_[_0x36a3('0x60')](_0x516b0e[_0x36a3('0x59')])))?path[_0x36a3('0x5e')](config[_0x36a3('0x5f')],_0x4ccf77,_['toLower'](_0x516b0e[_0x36a3('0x59')])):path[_0x36a3('0x5e')](config['root'],_0x4ccf77,_[_0x36a3('0x60')](_0x36a3('0x70')));var _0x3af6ff=_0x36a3('0x62')+_[_0x36a3('0x63')](_0x36a3('0x59'));if(_0x516b0e[_0x3af6ff]||!_0x315236[_0x36a3('0x67')]){_0x5b0428=path[_0x36a3('0x5e')](config[_0x36a3('0x5f')],_0x4ccf77,_['toLower'](_0x36a3('0x70')));}if(!fs[_0x36a3('0x5d')](_0x5b0428)){throw new db[(_0x36a3('0x19'))][(_0x36a3('0x1a'))](_['upperFirst'](_0x36a3('0x59'))+'\x20not\x20found');}return _0x442f5a[_0x36a3('0x68')](_0x5b0428);}})[_0x36a3('0x25')](handleError(_0x442f5a,null));}; \ No newline at end of file +var _0x7b01=['default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','request','then','Setting,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','end','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','params','includeAll','body','addLogo','file','filename','logo','addLogoLogin','../../config/license/util','server/files/images/logos','getLicense','find','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','root','join','toLower','default','upperFirst','custom','default_logo.svg','download','getLogoLogin','defaultFavicon','default_loginLogo.svg','gdpr','addPreferred','getPreferred'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_0x7b01,0x7f));var _0x17b0=function(_0x34cda0,_0x1af6e1){_0x34cda0=_0x34cda0-0x0;var _0x2df6ba=_0x7b01[_0x34cda0];return _0x2df6ba;};'use strict';var pdf=require(_0x17b0('0x0'));var emlformat=require(_0x17b0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x17b0('0x2'));var rp=require(_0x17b0('0x3'));var moment=require('moment');var BPromise=require(_0x17b0('0x4'));var Mustache=require(_0x17b0('0x5'));var util=require(_0x17b0('0x6'));var path=require(_0x17b0('0x7'));var sox=require(_0x17b0('0x8'));var csv=require('to-csv');var ejs=require(_0x17b0('0x9'));var fs=require('fs');var _=require(_0x17b0('0xa'));var squel=require(_0x17b0('0xb'));var crypto=require('crypto');var jsforce=require(_0x17b0('0xc'));var deskjs=require(_0x17b0('0xd'));var toCsv=require(_0x17b0('0xe'));var querystring=require(_0x17b0('0xf'));var Papa=require(_0x17b0('0x10'));var Redis=require(_0x17b0('0x11'));var authService=require(_0x17b0('0x12'));var qs=require(_0x17b0('0x13'));var as=require(_0x17b0('0x14'));var hardwareService=require(_0x17b0('0x15'));var logger=require(_0x17b0('0x16'))(_0x17b0('0x17'));var utils=require(_0x17b0('0x18'));var config=require(_0x17b0('0x19'));var db=require(_0x17b0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x17b0('0x1b')][_0x17b0('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x190ad2,_0x1dc704,_0x5c8b3c){if(_0x5c8b3c){var _0x14ab51=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x14ab51[_0x17b0('0x1d')](_0x1dc704)){return _0x190ad2;}else{throw new db[(_0x17b0('0x1e'))][(_0x17b0('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 _0x190ad2;}}function respondWithRpcPromise(_0x2afae5,_0x1bd9b9,_0x97dff1,_0x30b48){return new BPromise(function(_0x215318,_0x48965b){var _0x3ccca9=_0x30b48||client;return _0x3ccca9[_0x17b0('0x20')](_0x2afae5,_0x97dff1)[_0x17b0('0x21')](function(_0xbf0be5){logger['info'](_0x17b0('0x22'),_0x1bd9b9,'request\x20sent');logger[_0x17b0('0x23')]('Setting,\x20%s,\x20%s,\x20%s',_0x1bd9b9,'request\x20sent',JSON['stringify'](_0xbf0be5));if(_0xbf0be5['error']){if(_0xbf0be5[_0x17b0('0x24')][_0x17b0('0x25')]===0x1f4){logger[_0x17b0('0x24')](_0x17b0('0x22'),_0x1bd9b9,_0xbf0be5['error']['message']);return _0x48965b(_0xbf0be5[_0x17b0('0x24')][_0x17b0('0x26')]);}logger[_0x17b0('0x24')](_0x17b0('0x22'),_0x1bd9b9,_0xbf0be5[_0x17b0('0x24')]['message']);return _0x215318(_0xbf0be5[_0x17b0('0x24')][_0x17b0('0x26')]);}else{logger[_0x17b0('0x27')](_0x17b0('0x22'),_0x1bd9b9,_0x17b0('0x28'));_0x215318(_0xbf0be5[_0x17b0('0x29')][_0x17b0('0x26')]);}})[_0x17b0('0x2a')](function(_0x2ce6dd){logger[_0x17b0('0x24')]('Setting,\x20%s,\x20%s',_0x1bd9b9,_0x2ce6dd);_0x48965b(_0x2ce6dd);});});}function respondWithStatusCode(_0x57dfe8,_0xb945f){_0xb945f=_0xb945f||0xcc;return function(_0x92adc){if(_0x92adc){return _0x57dfe8[_0x17b0('0x2b')](_0xb945f);}return _0x57dfe8[_0x17b0('0x2c')](_0xb945f)['end']();};}function respondWithResult(_0x1ee367,_0x200696){_0x200696=_0x200696||0xc8;return function(_0x26d6a0){if(_0x26d6a0){return _0x1ee367['status'](_0x200696)[_0x17b0('0x2d')](_0x26d6a0);}};}function respondWithFilteredResult(_0x238f41,_0x43db2c){return function(_0x8c9d5){if(_0x8c9d5){var _0x3e87c8=_0x8c9d5[_0x17b0('0x2e')],_0x46eea0=_0x43db2c[_0x17b0('0x2f')],_0x187e7b=_0x43db2c['offset']+_0x43db2c[_0x17b0('0x30')],_0x4068d3;if(_0x187e7b>=_0x3e87c8){_0x187e7b=_0x3e87c8;_0x4068d3=0xc8;}else{_0x4068d3=0xce;}_0x238f41[_0x17b0('0x2c')](_0x4068d3);return _0x238f41[_0x17b0('0x31')](_0x17b0('0x32'),_0x46eea0+'-'+_0x187e7b+'/'+_0x3e87c8)[_0x17b0('0x2d')](_0x8c9d5);}return null;};}function patchUpdates(_0x1b2003){return function(_0x1bc4c2){try{jsonpatch[_0x17b0('0x33')](_0x1bc4c2,_0x1b2003,!![]);}catch(_0x48007c){return BPromise[_0x17b0('0x34')](_0x48007c);}return _0x1bc4c2[_0x17b0('0x35')]();};}function saveUpdates(_0x4457a,_0x45266c){return function(_0x30b6f6){if(_0x30b6f6){return _0x30b6f6[_0x17b0('0x36')](_0x4457a)[_0x17b0('0x21')](function(_0x5cd35f){return _0x5cd35f;});}return null;};}function removeEntity(_0x554ac7,_0x3e0a2c){return function(_0x31c800){if(_0x31c800){return _0x31c800['destroy']()[_0x17b0('0x21')](function(){_0x554ac7[_0x17b0('0x2c')](0xcc)[_0x17b0('0x37')]();});}};}function handleEntityNotFound(_0x26bbd0,_0x4e661d){return function(_0x18ed2e){if(!_0x18ed2e){_0x26bbd0[_0x17b0('0x2b')](0x194);}return _0x18ed2e;};}function handleError(_0x23f759,_0x43c7ff){_0x43c7ff=_0x43c7ff||0x1f4;return function(_0x59729c){logger[_0x17b0('0x24')](_0x59729c[_0x17b0('0x38')]);if(_0x59729c[_0x17b0('0x39')]){delete _0x59729c['name'];}_0x23f759[_0x17b0('0x2c')](_0x43c7ff)[_0x17b0('0x3a')](_0x59729c);};}exports[_0x17b0('0x3b')]=function(_0x497b83,_0x13c5bc){var _0x53e098={},_0x653352={},_0x43e11d={'count':0x0,'rows':[]};var _0x2e5ec5=_[_0x17b0('0x3c')](db[_0x17b0('0x3d')][_0x17b0('0x3e')],function(_0x5eaf28){return{'name':_0x5eaf28[_0x17b0('0x3f')],'type':_0x5eaf28[_0x17b0('0x40')][_0x17b0('0x41')]};});_0x653352[_0x17b0('0x42')]=_['map'](_0x2e5ec5,_0x17b0('0x39'));_0x653352['query']=_[_0x17b0('0x43')](_0x497b83[_0x17b0('0x44')]);_0x653352[_0x17b0('0x45')]=_[_0x17b0('0x46')](_0x653352[_0x17b0('0x42')],_0x653352[_0x17b0('0x44')]);_0x53e098['attributes']=_[_0x17b0('0x46')](_0x653352['model'],qs[_0x17b0('0x47')](_0x497b83[_0x17b0('0x44')][_0x17b0('0x47')]));_0x53e098[_0x17b0('0x48')]=_0x53e098['attributes'][_0x17b0('0x49')]?_0x53e098[_0x17b0('0x48')]:_0x653352[_0x17b0('0x42')];if(!_0x497b83[_0x17b0('0x44')]['hasOwnProperty']('nolimit')){_0x53e098[_0x17b0('0x30')]=qs[_0x17b0('0x30')](_0x497b83[_0x17b0('0x44')][_0x17b0('0x30')]);_0x53e098[_0x17b0('0x2f')]=qs[_0x17b0('0x2f')](_0x497b83[_0x17b0('0x44')][_0x17b0('0x2f')]);}_0x53e098[_0x17b0('0x4a')]=qs[_0x17b0('0x4b')](_0x497b83[_0x17b0('0x44')][_0x17b0('0x4b')]);_0x53e098['where']=qs[_0x17b0('0x45')](_[_0x17b0('0x4c')](_0x497b83[_0x17b0('0x44')],_0x653352[_0x17b0('0x45')]),_0x2e5ec5);if(_0x497b83[_0x17b0('0x44')][_0x17b0('0x4d')]){_0x53e098['where']=_['merge'](_0x53e098[_0x17b0('0x4e')],{'$or':_['map'](_0x2e5ec5,function(_0x2eae91){if(_0x2eae91['type']!==_0x17b0('0x4f')){var _0x35ed68={};_0x35ed68[_0x2eae91['name']]={'$like':'%'+_0x497b83[_0x17b0('0x44')][_0x17b0('0x4d')]+'%'};return _0x35ed68;}})});}_0x53e098=_[_0x17b0('0x50')]({},_0x53e098,_0x497b83['options']);var _0x1d8ddb={'where':_0x53e098[_0x17b0('0x4e')]};return db['Setting'][_0x17b0('0x2e')](_0x1d8ddb)[_0x17b0('0x21')](function(_0x5d7408){_0x43e11d[_0x17b0('0x2e')]=_0x5d7408;if(_0x497b83['query']['includeAll']){_0x53e098[_0x17b0('0x51')]=[{'all':!![]}];}return db[_0x17b0('0x3d')][_0x17b0('0x52')](_0x53e098);})[_0x17b0('0x21')](function(_0x51b796){_0x43e11d[_0x17b0('0x53')]=_0x51b796;return _0x43e11d;})['then'](respondWithFilteredResult(_0x13c5bc,_0x53e098))['catch'](handleError(_0x13c5bc,null));};exports['show']=function(_0x2d6c5c,_0x493458){var _0x4d569f={'raw':![],'where':{'id':_0x2d6c5c[_0x17b0('0x54')]['id']}},_0x4714cc={};_0x4714cc[_0x17b0('0x42')]=_[_0x17b0('0x43')](db[_0x17b0('0x3d')]['rawAttributes']);_0x4714cc[_0x17b0('0x44')]=_['keys'](_0x2d6c5c[_0x17b0('0x44')]);_0x4714cc[_0x17b0('0x45')]=_['intersection'](_0x4714cc[_0x17b0('0x42')],_0x4714cc[_0x17b0('0x44')]);_0x4d569f[_0x17b0('0x48')]=_['intersection'](_0x4714cc[_0x17b0('0x42')],qs['fields'](_0x2d6c5c[_0x17b0('0x44')][_0x17b0('0x47')]));_0x4d569f[_0x17b0('0x48')]=_0x4d569f[_0x17b0('0x48')][_0x17b0('0x49')]?_0x4d569f[_0x17b0('0x48')]:_0x4714cc[_0x17b0('0x42')];if(_0x2d6c5c['query'][_0x17b0('0x55')]){_0x4d569f[_0x17b0('0x51')]=[{'all':!![]}];}_0x4d569f=_[_0x17b0('0x50')]({},_0x4d569f,_0x2d6c5c['options']);return db['Setting']['find'](_0x4d569f)[_0x17b0('0x21')](handleEntityNotFound(_0x493458,null))[_0x17b0('0x21')](respondWithResult(_0x493458,null))[_0x17b0('0x2a')](handleError(_0x493458,null));};exports[_0x17b0('0x36')]=function(_0x198187,_0x3e9303){if(_0x198187[_0x17b0('0x56')]['id']){delete _0x198187[_0x17b0('0x56')]['id'];}return db[_0x17b0('0x3d')]['find']({'where':{'id':_0x198187['params']['id']}})[_0x17b0('0x21')](handleEntityNotFound(_0x3e9303,null))[_0x17b0('0x21')](saveUpdates(_0x198187['body'],null))[_0x17b0('0x21')](respondWithResult(_0x3e9303,null))[_0x17b0('0x2a')](handleError(_0x3e9303,null));};exports[_0x17b0('0x57')]=function(_0x5ab42b,_0x30bfa8,_0x106ca5){if(_0x5ab42b[_0x17b0('0x58')]&&_0x5ab42b[_0x17b0('0x58')][_0x17b0('0x59')]){_0x5ab42b[_0x17b0('0x56')][_0x17b0('0x5a')]=_0x5ab42b[_0x17b0('0x58')][_0x17b0('0x59')];}return db[_0x17b0('0x3d')]['find']({'where':{'id':_0x5ab42b[_0x17b0('0x54')]['id']}})['then'](handleEntityNotFound(_0x30bfa8,null))[_0x17b0('0x21')](saveUpdates(_0x5ab42b[_0x17b0('0x56')],null))[_0x17b0('0x21')](respondWithResult(_0x30bfa8,null))[_0x17b0('0x2a')](handleError(_0x30bfa8,null));};exports[_0x17b0('0x5b')]=function(_0x526dff,_0x5f4d74,_0x122110){if(_0x526dff[_0x17b0('0x58')]&&_0x526dff[_0x17b0('0x58')][_0x17b0('0x59')]){_0x526dff[_0x17b0('0x56')]['loginLogo']=_0x526dff[_0x17b0('0x58')][_0x17b0('0x59')];}return db[_0x17b0('0x3d')]['find']({'where':{'id':_0x526dff[_0x17b0('0x54')]['id']}})['then'](handleEntityNotFound(_0x5f4d74,null))['then'](saveUpdates(_0x526dff[_0x17b0('0x56')],null))[_0x17b0('0x21')](respondWithResult(_0x5f4d74,null))[_0x17b0('0x2a')](handleError(_0x5f4d74,null));};var utilLicense=require(_0x17b0('0x5c'));exports['getLogo']=function(_0x8ef2a9,_0x2c2120,_0x1d1fb4){var _0x45b25c=_0x17b0('0x5d');var _0x4f8691={'custom':![]};return utilLicense[_0x17b0('0x5e')]()[_0x17b0('0x21')](function(_0x49ed6b){if(_0x49ed6b){_0x4f8691=_0x49ed6b;}return db[_0x17b0('0x3d')][_0x17b0('0x5f')]({'where':{'id':_0x8ef2a9['params']['id']},'attributes':[_0x17b0('0x5a'),_0x17b0('0x60'),_0x17b0('0x61'),_0x17b0('0x62'),_0x17b0('0x63'),_0x17b0('0x64'),_0x17b0('0x65'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x2c2120,null))['then'](function(_0x175ca2){if(_0x175ca2){var _0xad52a0=_0x175ca2[_0x17b0('0x5a')]&&fs[_0x17b0('0x66')](path['join'](config[_0x17b0('0x67')],_0x45b25c,_['toLower'](_0x175ca2[_0x17b0('0x5a')])))?path[_0x17b0('0x68')](config[_0x17b0('0x67')],_0x45b25c,_[_0x17b0('0x69')](_0x175ca2[_0x17b0('0x5a')])):path[_0x17b0('0x68')](config[_0x17b0('0x67')],_0x45b25c,_[_0x17b0('0x69')]('default_logo.svg'));var _0xd046a1=_0x17b0('0x6a')+_[_0x17b0('0x6b')](_0x17b0('0x5a'));if(_0x175ca2[_0xd046a1]||!_0x4f8691[_0x17b0('0x6c')]){_0xad52a0=path[_0x17b0('0x68')](config[_0x17b0('0x67')],_0x45b25c,_[_0x17b0('0x69')](_0x17b0('0x6d')));}if(!fs[_0x17b0('0x66')](_0xad52a0)){throw new db['Sequelize'][(_0x17b0('0x1f'))](_['upperFirst'](_0x17b0('0x5a'))+'\x20not\x20found');}return _0x2c2120[_0x17b0('0x6e')](_0xad52a0);}})[_0x17b0('0x2a')](handleError(_0x2c2120,null));};var utilLicense=require(_0x17b0('0x5c'));exports[_0x17b0('0x6f')]=function(_0x14ea2a,_0x5c930e,_0x59bdb4){var _0x20dc99=_0x17b0('0x5d');var _0x13ae34={'custom':![]};return utilLicense[_0x17b0('0x5e')]()['then'](function(_0x2edac8){if(_0x2edac8){_0x13ae34=_0x2edac8;}return db['Setting']['find']({'where':{'id':_0x14ea2a[_0x17b0('0x54')]['id']},'attributes':[_0x17b0('0x5a'),'loginLogo',_0x17b0('0x61'),'favicon',_0x17b0('0x63'),_0x17b0('0x64'),_0x17b0('0x65'),_0x17b0('0x70')],'raw':!![]});})[_0x17b0('0x21')](handleEntityNotFound(_0x5c930e,null))[_0x17b0('0x21')](function(_0x10d2cd){if(_0x10d2cd){var _0xe3a853=_0x10d2cd['loginLogo']&&fs[_0x17b0('0x66')](path[_0x17b0('0x68')](config[_0x17b0('0x67')],_0x20dc99,_['toLower'](_0x10d2cd[_0x17b0('0x60')])))?path[_0x17b0('0x68')](config[_0x17b0('0x67')],_0x20dc99,_['toLower'](_0x10d2cd[_0x17b0('0x60')])):path[_0x17b0('0x68')](config['root'],_0x20dc99,_['toLower'](_0x17b0('0x71')));var _0x25b0a6='default'+_[_0x17b0('0x6b')]('loginLogo');if(_0x10d2cd[_0x25b0a6]||!_0x13ae34[_0x17b0('0x6c')]){_0xe3a853=path['join'](config[_0x17b0('0x67')],_0x20dc99,_[_0x17b0('0x69')](_0x17b0('0x71')));}if(!fs[_0x17b0('0x66')](_0xe3a853)){throw new db[(_0x17b0('0x1e'))][(_0x17b0('0x1f'))](_['upperFirst'](_0x17b0('0x60'))+'\x20not\x20found');}return _0x5c930e[_0x17b0('0x6e')](_0xe3a853);}})[_0x17b0('0x2a')](handleError(_0x5c930e,null));};exports[_0x17b0('0x72')]=function(_0x148539,_0x54ea78){return db[_0x17b0('0x3d')][_0x17b0('0x5f')]({'where':{'id':_0x148539[_0x17b0('0x54')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x54ea78,null))[_0x17b0('0x2a')](handleError(_0x54ea78,null));};exports[_0x17b0('0x73')]=function(_0x291474,_0x5c1729,_0x1fece5){if(_0x291474[_0x17b0('0x58')]&&_0x291474[_0x17b0('0x58')][_0x17b0('0x59')]){_0x291474[_0x17b0('0x56')][_0x17b0('0x61')]=_0x291474[_0x17b0('0x58')][_0x17b0('0x59')];}return db['Setting']['find']({'where':{'id':_0x291474[_0x17b0('0x54')]['id']}})['then'](handleEntityNotFound(_0x5c1729,null))[_0x17b0('0x21')](saveUpdates(_0x291474[_0x17b0('0x56')],null))[_0x17b0('0x21')](respondWithResult(_0x5c1729,null))[_0x17b0('0x2a')](handleError(_0x5c1729,null));};var utilLicense=require(_0x17b0('0x5c'));exports[_0x17b0('0x74')]=function(_0x126ffa,_0x2e1b3d,_0x5bcda0){var _0x19f77b=_0x17b0('0x5d');var _0x364f9f={'custom':![]};return utilLicense[_0x17b0('0x5e')]()[_0x17b0('0x21')](function(_0x152f2f){if(_0x152f2f){_0x364f9f=_0x152f2f;}return db[_0x17b0('0x3d')][_0x17b0('0x5f')]({'where':{'id':_0x126ffa['params']['id']},'attributes':[_0x17b0('0x5a'),_0x17b0('0x60'),_0x17b0('0x61'),_0x17b0('0x62'),_0x17b0('0x63'),'defaultLoginLogo',_0x17b0('0x65'),_0x17b0('0x70')],'raw':!![]});})['then'](handleEntityNotFound(_0x2e1b3d,null))[_0x17b0('0x21')](function(_0x1b1a26){if(_0x1b1a26){var _0x4a1a08=_0x1b1a26[_0x17b0('0x61')]&&fs[_0x17b0('0x66')](path[_0x17b0('0x68')](config[_0x17b0('0x67')],_0x19f77b,_[_0x17b0('0x69')](_0x1b1a26[_0x17b0('0x61')])))?path['join'](config[_0x17b0('0x67')],_0x19f77b,_[_0x17b0('0x69')](_0x1b1a26[_0x17b0('0x61')])):path[_0x17b0('0x68')](config['root'],_0x19f77b,_['toLower'](_0x17b0('0x75')));var _0xd5baf1='default'+_[_0x17b0('0x6b')]('preferred');if(_0x1b1a26[_0xd5baf1]||!_0x364f9f['custom']||!_0x364f9f[_0x17b0('0x61')]){_0x4a1a08=path['join'](config[_0x17b0('0x67')],_0x19f77b,_['toLower'](_0x17b0('0x75')));}if(!fs[_0x17b0('0x66')](_0x4a1a08)){throw new db[(_0x17b0('0x1e'))][(_0x17b0('0x1f'))](_['upperFirst']('preferred')+_0x17b0('0x76'));}return _0x2e1b3d['download'](_0x4a1a08);}})[_0x17b0('0x2a')](handleError(_0x2e1b3d,null));};exports[_0x17b0('0x77')]=function(_0xeb7a46,_0x1ba4f5,_0x7a732e){if(_0xeb7a46[_0x17b0('0x58')]&&_0xeb7a46[_0x17b0('0x58')][_0x17b0('0x59')]){_0xeb7a46[_0x17b0('0x56')][_0x17b0('0x62')]=_0xeb7a46['file'][_0x17b0('0x59')];}return db[_0x17b0('0x3d')][_0x17b0('0x5f')]({'where':{'id':_0xeb7a46['params']['id']}})[_0x17b0('0x21')](handleEntityNotFound(_0x1ba4f5,null))['then'](saveUpdates(_0xeb7a46[_0x17b0('0x56')],null))[_0x17b0('0x21')](respondWithResult(_0x1ba4f5,null))[_0x17b0('0x2a')](handleError(_0x1ba4f5,null));};var utilLicense=require(_0x17b0('0x5c'));exports[_0x17b0('0x78')]=function(_0x40e48a,_0x3b4f47,_0x5d4e09){var _0x1675be=_0x17b0('0x5d');var _0x149c40={'custom':![]};return utilLicense[_0x17b0('0x5e')]()[_0x17b0('0x21')](function(_0x32c3c7){if(_0x32c3c7){_0x149c40=_0x32c3c7;}return db['Setting']['find']({'where':{'id':_0x40e48a[_0x17b0('0x54')]['id']},'attributes':[_0x17b0('0x5a'),_0x17b0('0x60'),_0x17b0('0x61'),_0x17b0('0x62'),_0x17b0('0x63'),'defaultLoginLogo',_0x17b0('0x65'),_0x17b0('0x70')],'raw':!![]});})[_0x17b0('0x21')](handleEntityNotFound(_0x3b4f47,null))[_0x17b0('0x21')](function(_0x231361){if(_0x231361){var _0x3f2c66=_0x231361['favicon']&&fs[_0x17b0('0x66')](path['join'](config['root'],_0x1675be,_[_0x17b0('0x69')](_0x231361[_0x17b0('0x62')])))?path['join'](config['root'],_0x1675be,_[_0x17b0('0x69')](_0x231361[_0x17b0('0x62')])):path[_0x17b0('0x68')](config[_0x17b0('0x67')],_0x1675be,_[_0x17b0('0x69')](_0x17b0('0x79')));var _0x442006=_0x17b0('0x6a')+_[_0x17b0('0x6b')](_0x17b0('0x62'));if(_0x231361[_0x442006]||!_0x149c40[_0x17b0('0x6c')]){_0x3f2c66=path['join'](config['root'],_0x1675be,_[_0x17b0('0x69')]('default_favicon.ico'));}if(!fs[_0x17b0('0x66')](_0x3f2c66)){throw new db[(_0x17b0('0x1e'))][(_0x17b0('0x1f'))](_[_0x17b0('0x6b')](_0x17b0('0x62'))+_0x17b0('0x76'));}return _0x3b4f47[_0x17b0('0x6e')](_0x3f2c66);}})[_0x17b0('0x2a')](handleError(_0x3b4f47,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index cf6300d..9ad3c95 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 _0x79e2=['moment','bluebird','request-promise','rimraf','../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','util'];(function(_0x45c764,_0x5f13ef){var _0x82d5b2=function(_0x4a8cae){while(--_0x4a8cae){_0x45c764['push'](_0x45c764['shift']());}};_0x82d5b2(++_0x5f13ef);}(_0x79e2,0xbe));var _0x279e=function(_0x297aa6,_0x2f8f03){_0x297aa6=_0x297aa6-0x0;var _0x45f0ba=_0x79e2[_0x297aa6];return _0x45f0ba;};'use strict';var _=require(_0x279e('0x0'));var util=require(_0x279e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x279e('0x2'));var BPromise=require(_0x279e('0x3'));var rp=require(_0x279e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x279e('0x5'));var config=require(_0x279e('0x6'));var attributes=require(_0x279e('0x7'));module[_0x279e('0x8')]=function(_0x549a19,_0x31d315){return _0x549a19[_0x279e('0x9')](_0x279e('0xa'),attributes,{'tableName':_0x279e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x883f=['exports','settings','lodash','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x883f,0x112));var _0xf883=function(_0x5d84cb,_0x1bd87b){_0x5d84cb=_0x5d84cb-0x0;var _0x4542cb=_0x883f[_0x5d84cb];return _0x4542cb;};'use strict';var _=require(_0xf883('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf883('0x1'));var moment=require('moment');var BPromise=require(_0xf883('0x2'));var rp=require(_0xf883('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf883('0x4'));var config=require(_0xf883('0x5'));var attributes=require('./setting.attributes');module[_0xf883('0x6')]=function(_0x29ad82,_0x15abf8){return _0x29ad82['define']('Setting',attributes,{'tableName':_0xf883('0x7'),'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 e0c033f..b93a9f4 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 _0xb540=['http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x239920,_0x2ad95b){var _0x1b9f06=function(_0x3cdbf1){while(--_0x3cdbf1){_0x239920['push'](_0x239920['shift']());}};_0x1b9f06(++_0x2ad95b);}(_0xb540,0x12b));var _0x0b54=function(_0x26fcb0,_0x4dffec){_0x26fcb0=_0x26fcb0-0x0;var _0x31c797=_0xb540[_0x26fcb0];return _0x31c797;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0b54('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b54('0x1'))['db'];var utils=require(_0x0b54('0x2'));var logger=require(_0x0b54('0x3'))(_0x0b54('0x4'));var config=require(_0x0b54('0x5'));var jayson=require(_0x0b54('0x6'));var client=jayson['client'][_0x0b54('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2a154e,_0x439166,_0x1faee5){return new BPromise(function(_0x4d3436,_0xa0157f){return client['request'](_0x2a154e,_0x1faee5)[_0x0b54('0x8')](function(_0x2b4e05){logger[_0x0b54('0x9')](_0x0b54('0xa'),_0x439166,_0x0b54('0xb'));logger[_0x0b54('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0x439166,_0x0b54('0xb'),JSON[_0x0b54('0xd')](_0x2b4e05));if(_0x2b4e05[_0x0b54('0xe')]){if(_0x2b4e05[_0x0b54('0xe')][_0x0b54('0xf')]===0x1f4){logger[_0x0b54('0xe')](_0x0b54('0xa'),_0x439166,_0x2b4e05[_0x0b54('0xe')][_0x0b54('0x10')]);return _0xa0157f(_0x2b4e05[_0x0b54('0xe')][_0x0b54('0x10')]);}logger[_0x0b54('0xe')](_0x0b54('0xa'),_0x439166,_0x2b4e05[_0x0b54('0xe')]['message']);return _0x4d3436(_0x2b4e05[_0x0b54('0xe')][_0x0b54('0x10')]);}else{logger[_0x0b54('0x9')](_0x0b54('0xa'),_0x439166,_0x0b54('0xb'));_0x4d3436(_0x2b4e05['result']['message']);}})[_0x0b54('0x11')](function(_0x588c7d){logger[_0x0b54('0xe')]('Setting,\x20%s,\x20%s',_0x439166,_0x588c7d);_0xa0157f(_0x588c7d);});});} \ No newline at end of file +var _0x2d62=['debug','stringify','error','Setting,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','request','info','request\x20sent'];(function(_0xd82389,_0x8d144d){var _0x428df3=function(_0x39eec4){while(--_0x39eec4){_0xd82389['push'](_0xd82389['shift']());}};_0x428df3(++_0x8d144d);}(_0x2d62,0x1da));var _0x22d6=function(_0x3f32ff,_0x5a3baa){_0x3f32ff=_0x3f32ff-0x0;var _0x2f438c=_0x2d62[_0x3f32ff];return _0x2f438c;};'use strict';var _=require(_0x22d6('0x0'));var util=require(_0x22d6('0x1'));var moment=require(_0x22d6('0x2'));var BPromise=require(_0x22d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22d6('0x4'));var db=require(_0x22d6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x22d6('0x6'));var config=require('../../config/environment');var jayson=require(_0x22d6('0x7'));var client=jayson[_0x22d6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51e3f6,_0x1791ba,_0x2fdfff){return new BPromise(function(_0x3038ff,_0xdcc8d7){return client[_0x22d6('0x9')](_0x51e3f6,_0x2fdfff)['then'](function(_0x5ee529){logger[_0x22d6('0xa')]('Setting,\x20%s,\x20%s',_0x1791ba,_0x22d6('0xb'));logger[_0x22d6('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0x1791ba,'request\x20sent',JSON[_0x22d6('0xd')](_0x5ee529));if(_0x5ee529[_0x22d6('0xe')]){if(_0x5ee529[_0x22d6('0xe')]['code']===0x1f4){logger[_0x22d6('0xe')](_0x22d6('0xf'),_0x1791ba,_0x5ee529[_0x22d6('0xe')][_0x22d6('0x10')]);return _0xdcc8d7(_0x5ee529[_0x22d6('0xe')]['message']);}logger[_0x22d6('0xe')](_0x22d6('0xf'),_0x1791ba,_0x5ee529['error'][_0x22d6('0x10')]);return _0x3038ff(_0x5ee529['error'][_0x22d6('0x10')]);}else{logger[_0x22d6('0xa')](_0x22d6('0xf'),_0x1791ba,_0x22d6('0xb'));_0x3038ff(_0x5ee529['result'][_0x22d6('0x10')]);}})[_0x22d6('0x11')](function(_0x3813e1){logger['error']('Setting,\x20%s,\x20%s',_0x1791ba,_0x3813e1);_0xdcc8d7(_0x3813e1);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c0d1231..00d3b9a 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 _0x200e=['getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','getAgents','post','create','addDisposition','/:id/notify','notify','addApplications','send','status','/:id/users','addAgents','update','destroy','/:id/dispositions','removeAnswers','delete','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','isAuthenticated','get','describe','/:id','show'];(function(_0x5c65f8,_0x54bfa0){var _0x76607f=function(_0x57c994){while(--_0x57c994){_0x5c65f8['push'](_0x5c65f8['shift']());}};_0x76607f(++_0x54bfa0);}(_0x200e,0x195));var _0xe200=function(_0x1b5281,_0x2b2506){_0x1b5281=_0x1b5281-0x0;var _0x58b206=_0x200e[_0x1b5281];return _0x58b206;};'use strict';var multer=require(_0xe200('0x0'));var util=require(_0xe200('0x1'));var path=require(_0xe200('0x2'));var timeout=require('connect-timeout');var express=require(_0xe200('0x3'));var router=express[_0xe200('0x4')]();var auth=require(_0xe200('0x5'));var interaction=require(_0xe200('0x6'));var config=require('../../config/environment');var controller=require(_0xe200('0x7'));router['get']('/',auth[_0xe200('0x8')](),controller['index']);router[_0xe200('0x9')]('/describe',auth[_0xe200('0x8')](),controller[_0xe200('0xa')]);router[_0xe200('0x9')](_0xe200('0xb'),auth[_0xe200('0x8')](),controller[_0xe200('0xc')]);router[_0xe200('0x9')]('/:id/dispositions',auth[_0xe200('0x8')](),controller[_0xe200('0xd')]);router['get'](_0xe200('0xe'),auth[_0xe200('0x8')](),controller[_0xe200('0xf')]);router[_0xe200('0x9')](_0xe200('0x10'),auth[_0xe200('0x8')](),controller['getApplications']);router[_0xe200('0x9')](_0xe200('0x11'),auth[_0xe200('0x8')](),controller[_0xe200('0x12')]);router['get'](_0xe200('0x13'),controller['statusGet']);router[_0xe200('0x9')]('/:id/users',auth[_0xe200('0x8')](),controller[_0xe200('0x14')]);router[_0xe200('0x15')]('/',auth[_0xe200('0x8')](),controller[_0xe200('0x16')]);router['post']('/:id/dispositions',auth[_0xe200('0x8')](),controller[_0xe200('0x17')]);router[_0xe200('0x15')](_0xe200('0xe'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xe200('0x15')](_0xe200('0x18'),controller[_0xe200('0x19')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xe200('0x1a')]);router[_0xe200('0x15')]('/:id/send',auth[_0xe200('0x8')](),controller[_0xe200('0x1b')]);router['post'](_0xe200('0x13'),controller[_0xe200('0x1c')]);router[_0xe200('0x15')](_0xe200('0x1d'),auth[_0xe200('0x8')](),controller[_0xe200('0x1e')]);router['put'](_0xe200('0xb'),auth[_0xe200('0x8')](),controller[_0xe200('0x1f')]);router['delete'](_0xe200('0xb'),auth[_0xe200('0x8')](),controller[_0xe200('0x20')]);router['delete'](_0xe200('0x21'),auth[_0xe200('0x8')](),controller['removeDispositions']);router['delete'](_0xe200('0xe'),auth[_0xe200('0x8')](),controller[_0xe200('0x22')]);router[_0xe200('0x23')](_0xe200('0x1d'),auth[_0xe200('0x8')](),controller[_0xe200('0x24')]);module[_0xe200('0x25')]=router; \ No newline at end of file +var _0x13f1=['describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','statusGet','/:id/users','getAgents','addAnswer','/:id/notify','notify','post','/:id/send','send','/:id/status','status','addAgents','put','/:id','update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index'];(function(_0x21ee11,_0x172225){var _0xb4c64e=function(_0x157c8f){while(--_0x157c8f){_0x21ee11['push'](_0x21ee11['shift']());}};_0xb4c64e(++_0x172225);}(_0x13f1,0x126));var _0x113f=function(_0x159ca0,_0x214d56){_0x159ca0=_0x159ca0-0x0;var _0x525d28=_0x13f1[_0x159ca0];return _0x525d28;};'use strict';var multer=require(_0x113f('0x0'));var util=require(_0x113f('0x1'));var path=require(_0x113f('0x2'));var timeout=require(_0x113f('0x3'));var express=require(_0x113f('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x113f('0x5'));var config=require('../../config/environment');var controller=require(_0x113f('0x6'));router[_0x113f('0x7')]('/',auth[_0x113f('0x8')](),controller[_0x113f('0x9')]);router['get']('/describe',auth[_0x113f('0x8')](),controller[_0x113f('0xa')]);router[_0x113f('0x7')]('/:id',auth[_0x113f('0x8')](),controller[_0x113f('0xb')]);router['get'](_0x113f('0xc'),auth['isAuthenticated'](),controller[_0x113f('0xd')]);router[_0x113f('0x7')](_0x113f('0xe'),auth[_0x113f('0x8')](),controller[_0x113f('0xf')]);router[_0x113f('0x7')](_0x113f('0x10'),auth[_0x113f('0x8')](),controller[_0x113f('0x11')]);router['get'](_0x113f('0x12'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x113f('0x7')]('/:id/status',controller[_0x113f('0x13')]);router[_0x113f('0x7')](_0x113f('0x14'),auth[_0x113f('0x8')](),controller[_0x113f('0x15')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x113f('0xc'),auth[_0x113f('0x8')](),controller['addDisposition']);router['post'](_0x113f('0xe'),auth[_0x113f('0x8')](),controller[_0x113f('0x16')]);router['post'](_0x113f('0x17'),controller[_0x113f('0x18')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0x113f('0x19')](_0x113f('0x1a'),auth[_0x113f('0x8')](),controller[_0x113f('0x1b')]);router[_0x113f('0x19')](_0x113f('0x1c'),controller[_0x113f('0x1d')]);router['post']('/:id/users',auth[_0x113f('0x8')](),controller[_0x113f('0x1e')]);router[_0x113f('0x1f')](_0x113f('0x20'),auth[_0x113f('0x8')](),controller[_0x113f('0x21')]);router[_0x113f('0x22')](_0x113f('0x20'),auth[_0x113f('0x8')](),controller[_0x113f('0x23')]);router[_0x113f('0x22')](_0x113f('0xc'),auth[_0x113f('0x8')](),controller[_0x113f('0x24')]);router[_0x113f('0x22')](_0x113f('0xe'),auth[_0x113f('0x8')](),controller['removeAnswers']);router[_0x113f('0x22')]('/:id/users',auth[_0x113f('0x8')](),controller['removeAgents']);module[_0x113f('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index f9c4c9a..b052019 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 _0xa34f=['clicksend','plivo','clickatell','csc','infobip','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','twilio','skebby','connectel'];(function(_0x330f26,_0x292db5){var _0x1fd06d=function(_0x506376){while(--_0x506376){_0x330f26['push'](_0x330f26['shift']());}};_0x1fd06d(++_0x292db5);}(_0xa34f,0x1c5));var _0xfa34=function(_0x5bd953,_0x307788){_0x5bd953=_0x5bd953-0x0;var _0x4ac021=_0xa34f[_0x5bd953];return _0x4ac021;};'use strict';var Sequelize=require(_0xfa34('0x0'));var rs=require(_0xfa34('0x1'));module[_0xfa34('0x2')]={'name':{'type':Sequelize[_0xfa34('0x3')],'unique':_0xfa34('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xfa34('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xfa34('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xfa34('0x3')]},'type':{'type':Sequelize[_0xfa34('0x5')](_0xfa34('0x6'),_0xfa34('0x7'),_0xfa34('0x8'),_0xfa34('0x9'),_0xfa34('0xa'),_0xfa34('0xb'),_0xfa34('0xc'),_0xfa34('0xd'),'intelepeer')},'accountSid':{'type':Sequelize[_0xfa34('0x3')]},'authId':{'type':Sequelize[_0xfa34('0x3')]},'authToken':{'type':Sequelize[_0xfa34('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xfa34('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xfa34('0x3')]},'senderString':{'type':Sequelize[_0xfa34('0x3')]},'deliveryReport':{'type':Sequelize[_0xfa34('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xfa34('0x3')]},'notificationTemplate':{'type':Sequelize[_0xfa34('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xfa34('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfa34('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfa34('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfa34('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfa34('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfa34('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xfa34('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfa34('0x10')],'comment':_0xfa34('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xfa34('0xe')],'defaultValue':![],'comment':_0xfa34('0x12'),'set':function(_0x889f80){if(!_0x889f80)this[_0xfa34('0x13')](_0xfa34('0x14'),null);this[_0xfa34('0x13')](_0xfa34('0x15'),_0x889f80);}}}; \ No newline at end of file +var _0xc1bd=['infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING','ENUM','twilio','skebby','connectel','clicksend','plivo','csc'];(function(_0x1e9a0e,_0x4a00a1){var _0x8a3063=function(_0x509209){while(--_0x509209){_0x1e9a0e['push'](_0x1e9a0e['shift']());}};_0x8a3063(++_0x4a00a1);}(_0xc1bd,0xbb));var _0xdc1b=function(_0x17d095,_0x281068){_0x17d095=_0x17d095-0x0;var _0x3a51e2=_0xc1bd[_0x17d095];return _0x3a51e2;};'use strict';var Sequelize=require(_0xdc1b('0x0'));var rs=require(_0xdc1b('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xdc1b('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xdc1b('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xdc1b('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xdc1b('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xdc1b('0x3')]},'type':{'type':Sequelize[_0xdc1b('0x4')](_0xdc1b('0x5'),_0xdc1b('0x6'),_0xdc1b('0x7'),_0xdc1b('0x8'),_0xdc1b('0x9'),'clickatell',_0xdc1b('0xa'),_0xdc1b('0xb'),_0xdc1b('0xc'))},'accountSid':{'type':Sequelize[_0xdc1b('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xdc1b('0x3')]},'smsMethod':{'type':Sequelize[_0xdc1b('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xdc1b('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xdc1b('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xdc1b('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xdc1b('0x3')]},'notificationTemplate':{'type':Sequelize[_0xdc1b('0xe')],'defaultValue':function(){return _0xdc1b('0xf');}},'notificationSound':{'type':Sequelize[_0xdc1b('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdc1b('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdc1b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdc1b('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdc1b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xdc1b('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdc1b('0x10')],'comment':_0xdc1b('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xdc1b('0x12'),'set':function(_0x397623){if(!_0x397623)this[_0xdc1b('0x13')](_0xdc1b('0x14'),null);this[_0xdc1b('0x13')](_0xdc1b('0x15'),_0x397623);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 2ea0d21..39af70a 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','spread','dataValues','push','log','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','limit','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','user','role','SmsAccounts','UserProfileSection','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','From','Body','messageId','skebby','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','SmsInteraction','interaction','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','addApplications','sequelize','bulkCreate'];(function(_0x359aa7,_0x4978cc){var _0x28ac7f=function(_0x7daaf1){while(--_0x7daaf1){_0x359aa7['push'](_0x359aa7['shift']());}};_0x28ac7f(++_0x4978cc);}(_0x7a54,0x106));var _0x47a5=function(_0x2057ee,_0x583044){_0x2057ee=_0x2057ee-0x0;var _0x26baa0=_0x7a54[_0x2057ee];return _0x26baa0;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);var jayson=require(_0x47a5('0x1a'));var client=jayson[_0x47a5('0x1b')][_0x47a5('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x190faa,_0x4e99a8,_0x362359){if(_0x362359){var _0x11faf5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11faf5[_0x47a5('0x1d')](_0x4e99a8)){return _0x190faa;}else{throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x190faa;}}function respondWithRpcPromise(_0x549de3,_0x138bc0,_0x4b966e,_0x5247fd){return new BPromise(function(_0x423a81,_0xaf70a6){var _0x2ce454=_0x5247fd||client;return _0x2ce454[_0x47a5('0x20')](_0x549de3,_0x4b966e)[_0x47a5('0x21')](function(_0x12b98e){logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,_0x47a5('0x24'));logger['debug'](_0x47a5('0x25'),_0x138bc0,_0x47a5('0x24'),JSON['stringify'](_0x12b98e));if(_0x12b98e[_0x47a5('0x26')]){if(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x27')]===0x1f4){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);return _0xaf70a6(_0x12b98e[_0x47a5('0x26')]['message']);}logger[_0x47a5('0x26')](_0x47a5('0x23'),_0x138bc0,_0x12b98e['error'][_0x47a5('0x28')]);return _0x423a81(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);}else{logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,'request\x20sent');_0x423a81(_0x12b98e['result'][_0x47a5('0x28')]);}})['catch'](function(_0x1ea9c8){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x1ea9c8);_0xaf70a6(_0x1ea9c8);});});}function respondWithStatusCode(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0xcc;return function(_0x1dac65){if(_0x1dac65){return _0x378208[_0x47a5('0x29')](_0x36ad34);}return _0x378208[_0x47a5('0x2a')](_0x36ad34)[_0x47a5('0x2b')]();};}function respondWithResult(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0xc8;return function(_0x361bfa){if(_0x361bfa){return _0x136b14[_0x47a5('0x2a')](_0x16631f)[_0x47a5('0x2c')](_0x361bfa);}};}function respondWithFilteredResult(_0x3ad507,_0x528582){return function(_0x243210){if(_0x243210){var _0x51833b=_0x243210['count'],_0x2ef875=_0x528582[_0x47a5('0x2d')],_0x9ac908=_0x528582[_0x47a5('0x2d')]+_0x528582[_0x47a5('0x2e')],_0x16901f;if(_0x9ac908>=_0x51833b){_0x9ac908=_0x51833b;_0x16901f=0xc8;}else{_0x16901f=0xce;}_0x3ad507[_0x47a5('0x2a')](_0x16901f);return _0x3ad507['set']('Content-Range',_0x2ef875+'-'+_0x9ac908+'/'+_0x51833b)[_0x47a5('0x2c')](_0x243210);}return null;};}function patchUpdates(_0xfb5ddb){return function(_0x5bd7eb){try{jsonpatch['apply'](_0x5bd7eb,_0xfb5ddb,!![]);}catch(_0x836303){return BPromise[_0x47a5('0x2f')](_0x836303);}return _0x5bd7eb['save']();};}function saveUpdates(_0x42f70c,_0x53119b){return function(_0x122ed6){if(_0x122ed6){return _0x122ed6[_0x47a5('0x30')](_0x42f70c)['then'](function(_0x4843c0){return _0x4843c0;});}return null;};}function removeEntity(_0x274e34,_0x5910bb){return function(_0x403028){if(_0x403028){return _0x403028[_0x47a5('0x31')]()[_0x47a5('0x21')](function(){var _0x52749b=_0x403028[_0x47a5('0x32')]({'plain':!![]});var _0x50c086='SmsAccounts';return db[_0x47a5('0x33')]['destroy']({'where':{'type':_0x50c086,'resourceId':_0x52749b['id']}})[_0x47a5('0x21')](function(){return _0x403028;});})['then'](function(){_0x274e34[_0x47a5('0x2a')](0xcc)[_0x47a5('0x2b')]();});}};}function handleEntityNotFound(_0x38c8d4,_0x199698){return function(_0x36add5){if(!_0x36add5){_0x38c8d4[_0x47a5('0x29')](0x194);}return _0x36add5;};}function handleError(_0xee582c,_0x452be5){_0x452be5=_0x452be5||0x1f4;return function(_0x1a0d23){logger['error'](_0x1a0d23[_0x47a5('0x34')]);if(_0x1a0d23[_0x47a5('0x35')]){delete _0x1a0d23['name'];}_0xee582c[_0x47a5('0x2a')](_0x452be5)[_0x47a5('0x36')](_0x1a0d23);};}exports[_0x47a5('0x37')]=function(_0x49c4b5,_0x101f70){var _0x10f660={'include':[{'model':db[_0x47a5('0x38')],'as':'mandatoryDispositionPause'}]},_0x596097={},_0x2ebba0={'count':0x0,'rows':[]};var _0x55c5eb=_['map'](db[_0x47a5('0x39')]['rawAttributes'],function(_0x9b5eaf){return{'name':_0x9b5eaf[_0x47a5('0x3a')],'type':_0x9b5eaf[_0x47a5('0x3b')][_0x47a5('0x3c')]};});_0x596097[_0x47a5('0x3d')]=_[_0x47a5('0x3e')](_0x55c5eb,_0x47a5('0x35'));_0x596097[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x49c4b5[_0x47a5('0x3f')]);_0x596097[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],_0x596097['query']);_0x10f660[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x49c4b5['query'][_0x47a5('0x44')]));_0x10f660['attributes']=_0x10f660['attributes']['length']?_0x10f660['attributes']:_0x596097[_0x47a5('0x3d')];if(!_0x49c4b5['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x10f660[_0x47a5('0x2e')]=qs['limit'](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x10f660['offset']=qs['offset'](_0x49c4b5[_0x47a5('0x3f')]['offset']);}_0x10f660[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x10f660[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x49c4b5[_0x47a5('0x3f')],_0x596097[_0x47a5('0x41')]),_0x55c5eb);if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x4b')]){_0x10f660[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x10f660[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x55c5eb,function(_0x3a2b38){if(_0x3a2b38['type']!==_0x47a5('0x4d')){var _0x23bb04={};_0x23bb04[_0x3a2b38['name']]={'$like':'%'+_0x49c4b5['query'][_0x47a5('0x4b')]+'%'};return _0x23bb04;}})});}_0x10f660=_['merge']({},_0x10f660,_0x49c4b5[_0x47a5('0x4e')]);var _0xd93e37={'where':_0x10f660['where']};return db['SmsAccount'][_0x47a5('0x4f')](_0xd93e37)['then'](function(_0x2d147c){_0x2ebba0[_0x47a5('0x4f')]=_0x2d147c;if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x10f660[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x39')][_0x47a5('0x52')](_0x10f660);})['then'](function(_0x48a0ef){_0x2ebba0[_0x47a5('0x53')]=_0x48a0ef;return _0x2ebba0;})[_0x47a5('0x21')](respondWithFilteredResult(_0x101f70,_0x10f660))[_0x47a5('0x54')](handleError(_0x101f70,null));};exports[_0x47a5('0x55')]=function(_0x2c7020,_0x2c0c86){var _0x249de5={'raw':![],'where':{'id':_0x2c7020[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]},_0x492cf7={};_0x492cf7['model']=_[_0x47a5('0x40')](db['SmsAccount'][_0x47a5('0x58')]);_0x492cf7[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x2c7020[_0x47a5('0x3f')]);_0x492cf7['filters']=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],_0x492cf7[_0x47a5('0x3f')]);_0x249de5[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x2c7020['query'][_0x47a5('0x44')]));_0x249de5[_0x47a5('0x43')]=_0x249de5[_0x47a5('0x43')][_0x47a5('0x59')]?_0x249de5[_0x47a5('0x43')]:_0x492cf7[_0x47a5('0x3d')];if(_0x2c7020['query'][_0x47a5('0x50')]){_0x249de5[_0x47a5('0x51')]=[{'all':!![]}];}_0x249de5=_[_0x47a5('0x4c')]({},_0x249de5,_0x2c7020['options']);return db[_0x47a5('0x39')][_0x47a5('0x5a')](_0x249de5)[_0x47a5('0x21')](handleEntityNotFound(_0x2c0c86,null))['then'](respondWithResult(_0x2c0c86,null))['catch'](handleError(_0x2c0c86,null));};exports[_0x47a5('0x5b')]=function(_0x376e1d,_0x4fa1da){return db['SmsAccount'][_0x47a5('0x5b')](_0x376e1d['body'],{})[_0x47a5('0x21')](function(_0x5d383d){var _0x482de6=_0x376e1d[_0x47a5('0x5c')][_0x47a5('0x32')]({'plain':!![]});if(!_0x482de6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482de6[_0x47a5('0x5d')]===_0x47a5('0x5c')){var _0x4b706a=_0x5d383d['get']({'plain':!![]});var _0x16b4fd=_0x47a5('0x5e');return db[_0x47a5('0x5f')][_0x47a5('0x5a')]({'where':{'name':_0x16b4fd,'userProfileId':_0x482de6['userProfileId']},'raw':!![]})[_0x47a5('0x21')](function(_0x2b4255){if(_0x2b4255&&_0x2b4255[_0x47a5('0x60')]===0x0){return db['UserProfileResource'][_0x47a5('0x5b')]({'name':_0x4b706a['name'],'resourceId':_0x4b706a['id'],'type':_0x2b4255[_0x47a5('0x35')],'sectionId':_0x2b4255['id']},{})[_0x47a5('0x21')](function(){return _0x5d383d;});}else{return _0x5d383d;}})[_0x47a5('0x54')](function(_0x1c485b){logger[_0x47a5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c485b);throw _0x1c485b;});}return _0x5d383d;})[_0x47a5('0x21')](respondWithResult(_0x4fa1da,0xc9))['catch'](handleError(_0x4fa1da,null));};exports['update']=function(_0x5eb150,_0x4f8564){if(_0x5eb150[_0x47a5('0x61')]['id']){delete _0x5eb150[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')]['find']({'where':{'id':_0x5eb150['params']['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x4f8564,null))[_0x47a5('0x21')](saveUpdates(_0x5eb150[_0x47a5('0x61')],null))['then'](respondWithResult(_0x4f8564,null))[_0x47a5('0x54')](handleError(_0x4f8564,null));};exports['destroy']=function(_0x22c886,_0x274d31){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x22c886[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x274d31,null))[_0x47a5('0x21')](removeEntity(_0x274d31,null))[_0x47a5('0x54')](handleError(_0x274d31,null));};exports[_0x47a5('0x62')]=function(_0x35cca8,_0x3ac38c){return db['SmsAccount'][_0x47a5('0x62')]()[_0x47a5('0x21')](respondWithResult(_0x3ac38c,null))[_0x47a5('0x54')](handleError(_0x3ac38c,null));};exports[_0x47a5('0x63')]=function(_0x396cb0,_0x4bbe14,_0xbec033){if(_0x396cb0[_0x47a5('0x61')]['id']){delete _0x396cb0[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x396cb0[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4bbe14,null))[_0x47a5('0x21')](function(_0x350af8){if(_0x350af8){_0x396cb0[_0x47a5('0x61')][_0x47a5('0x64')]=_0x350af8['id'];return db[_0x47a5('0x65')][_0x47a5('0x5b')](_0x396cb0[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x4bbe14,null))['catch'](handleError(_0x4bbe14,null));};exports[_0x47a5('0x66')]=function(_0x284fb8,_0x30504e,_0x4b42f3){var _0x37ac59={'raw':![],'where':{}};var _0x2e46af={};var _0x36c67={'count':0x0,'rows':[]};return db[_0x47a5('0x39')]['findOne']({'where':{'id':_0x284fb8[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x30504e,null))[_0x47a5('0x21')](function(_0x487e21){if(_0x487e21){_0x2e46af[_0x47a5('0x3d')]=_['keys'](db[_0x47a5('0x65')][_0x47a5('0x58')]);_0x2e46af[_0x47a5('0x3f')]=_['keys'](_0x284fb8['query']);_0x2e46af['filters']=_[_0x47a5('0x42')](_0x2e46af[_0x47a5('0x3d')],_0x2e46af[_0x47a5('0x3f')]);_0x37ac59[_0x47a5('0x43')]=_['intersection'](_0x2e46af[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x37ac59[_0x47a5('0x43')]=_0x37ac59[_0x47a5('0x43')][_0x47a5('0x59')]?_0x37ac59[_0x47a5('0x43')]:_0x2e46af[_0x47a5('0x3d')];if(!_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x45')](_0x47a5('0x46'))){_0x37ac59['limit']=qs[_0x47a5('0x2e')](_0x284fb8['query'][_0x47a5('0x2e')]);_0x37ac59[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x37ac59[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x37ac59[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x284fb8[_0x47a5('0x3f')],_0x2e46af[_0x47a5('0x41')]));_0x37ac59[_0x47a5('0x49')]['SmsAccountId']=_0x487e21['id'];if(_0x284fb8['query']['filter']){_0x37ac59['where']=_[_0x47a5('0x4c')](_0x37ac59[_0x47a5('0x49')],{'$or':_['map'](_0x37ac59[_0x47a5('0x43')],function(_0x44dda2){var _0x1baa5a={};_0x1baa5a[_0x44dda2]={'$like':'%'+_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1baa5a;})});}_0x37ac59=_[_0x47a5('0x4c')]({},_0x37ac59,_0x284fb8[_0x47a5('0x4e')]);return db[_0x47a5('0x65')][_0x47a5('0x4f')]({'where':_0x37ac59[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x5e5f16){_0x36c67[_0x47a5('0x4f')]=_0x5e5f16;if(_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x37ac59['include']=[{'all':!![]}];}return db[_0x47a5('0x65')][_0x47a5('0x52')](_0x37ac59);})[_0x47a5('0x21')](function(_0x5d41d8){_0x36c67[_0x47a5('0x53')]=_0x5d41d8;return _0x36c67;});}})['then'](respondWithFilteredResult(_0x30504e,_0x37ac59))['catch'](handleError(_0x30504e,null));};exports[_0x47a5('0x67')]=function(_0x292d9c,_0x277486,_0x27333e){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x292d9c['params']['id']}})['then'](handleEntityNotFound(_0x277486,null))[_0x47a5('0x21')](function(_0x4f2361){if(_0x4f2361){return _0x4f2361[_0x47a5('0x67')](_0x292d9c[_0x47a5('0x3f')][_0x47a5('0x68')]);}})[_0x47a5('0x21')](respondWithStatusCode(_0x277486,null))['catch'](handleError(_0x277486,null));};exports[_0x47a5('0x69')]=function(_0x550bde,_0x5f3a04,_0x139c79){if(_0x550bde[_0x47a5('0x61')]['id']){delete _0x550bde['body']['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x550bde[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3a04,null))[_0x47a5('0x21')](function(_0x578e27){if(_0x578e27){_0x550bde[_0x47a5('0x61')][_0x47a5('0x64')]=_0x578e27['id'];return db[_0x47a5('0x6a')]['create'](_0x550bde[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x5f3a04,null))[_0x47a5('0x54')](handleError(_0x5f3a04,null));};exports['getAnswers']=function(_0x3525e7,_0x4f2fbb,_0x3c012b){var _0x491bb4={'raw':![],'where':{}};var _0x135d2e={};var _0x20d8bd={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x3525e7['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4f2fbb,null))[_0x47a5('0x21')](function(_0x23c393){if(_0x23c393){_0x135d2e[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db['CannedAnswer']['rawAttributes']);_0x135d2e[_0x47a5('0x3f')]=_['keys'](_0x3525e7[_0x47a5('0x3f')]);_0x135d2e[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x135d2e['model'],_0x135d2e[_0x47a5('0x3f')]);_0x491bb4[_0x47a5('0x43')]=_['intersection'](_0x135d2e[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x491bb4['attributes']=_0x491bb4['attributes'][_0x47a5('0x59')]?_0x491bb4[_0x47a5('0x43')]:_0x135d2e['model'];if(!_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x45')]('nolimit')){_0x491bb4[_0x47a5('0x2e')]=qs[_0x47a5('0x2e')](_0x3525e7[_0x47a5('0x3f')]['limit']);_0x491bb4[_0x47a5('0x2d')]=qs['offset'](_0x3525e7[_0x47a5('0x3f')]['offset']);}_0x491bb4[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x3525e7['query'][_0x47a5('0x48')]);_0x491bb4['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x3525e7[_0x47a5('0x3f')],_0x135d2e[_0x47a5('0x41')]));_0x491bb4['where'][_0x47a5('0x64')]=_0x23c393['id'];if(_0x3525e7['query']['filter']){_0x491bb4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x491bb4[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x491bb4[_0x47a5('0x43')],function(_0x5b1f5e){var _0x1522a6={};_0x1522a6[_0x5b1f5e]={'$like':'%'+_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1522a6;})});}_0x491bb4=_[_0x47a5('0x4c')]({},_0x491bb4,_0x3525e7['options']);return db[_0x47a5('0x6a')]['count']({'where':_0x491bb4[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x3f93f0){_0x20d8bd[_0x47a5('0x4f')]=_0x3f93f0;if(_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x491bb4[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x6a')][_0x47a5('0x52')](_0x491bb4);})['then'](function(_0x36796e){_0x20d8bd[_0x47a5('0x53')]=_0x36796e;return _0x20d8bd;});}})['then'](respondWithFilteredResult(_0x4f2fbb,_0x491bb4))[_0x47a5('0x54')](handleError(_0x4f2fbb,null));};exports[_0x47a5('0x6c')]=function(_0x6d6a5,_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x6d6a5['params']['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x21')](function(_0x17f82d){if(_0x17f82d){return _0x17f82d['removeAnswers'](_0x6d6a5[_0x47a5('0x3f')][_0x47a5('0x68')]);}})['then'](respondWithStatusCode(_0x5b85cd,null))[_0x47a5('0x54')](handleError(_0x5b85cd,null));};exports[_0x47a5('0x6d')]=function(_0x109805,_0x70c8a6,_0x364bb0){var _0x1371e4={'channel':'sms'};var _0x4c9894=[];var _0x5bd86e=[];var _0x133b7a={};return db[_0x47a5('0x39')]['find']({'where':{'id':_0x109805[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6f')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x5084d6){_0x1371e4[_0x47a5('0x70')]=_0x5084d6;_0x1371e4['applications']=_['orderBy'](_0x5084d6['Applications'],[_0x47a5('0x71')],['asc']);if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x6f')]){delete _0x1371e4[_0x47a5('0x70')]['Applications'];}return db[_0x47a5('0x72')][_0x47a5('0x62')]();})[_0x47a5('0x21')](function(_0x121750){if(!_0x121750){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x73'));}_0x4c9894=_[_0x47a5('0x74')](_['keys'](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76')]);_0x5bd86e=_[_0x47a5('0x74')](_[_0x47a5('0x40')](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76'),'CompanyId',_0x47a5('0x77')]);_0x1371e4[_0x47a5('0x61')]={'mapKey':'mobile'};if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){switch(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){case'twilio':_0x1371e4['body']['from']=_0x109805['body'][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x79')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['MessageSid'];break;case _0x47a5('0x7b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['sender'];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body']['text'];break;case _0x47a5('0x7d'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805[_0x47a5('0x61')][_0x47a5('0x28')];break;case'clicksend':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x61')];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7e')];break;case _0x47a5('0x7f'):_0x1371e4['body'][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x80')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x81')];break;case _0x47a5('0x82'):_0x1371e4['body'][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['results'][0x0][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0]['text'];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0][_0x47a5('0x7a')];break;case _0x47a5('0x84'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805['body'][_0x47a5('0x85')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x86')][_0x47a5('0x28')];break;case _0x47a5('0x87'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x88')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805['body'][_0x47a5('0x89')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x8a')];break;case _0x47a5('0x8b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805['body'][_0x47a5('0x7c')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')]['message'];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['refid'];break;}}if(_0x1371e4[_0x47a5('0x61')]['id']){delete _0x1371e4[_0x47a5('0x61')]['id'];}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')]['from'])){throw new db[(_0x47a5('0x1e'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x1371e4[_0x47a5('0x61')]['body'])||_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8d'));}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8f')+_0x5bd86e);}if(!_[_0x47a5('0x90')](_0x5bd86e,_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x91')+_0x5bd86e);}_0x133b7a[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db[_0x47a5('0x92')]['find']({'where':{'id':_0x1371e4[_0x47a5('0x70')]['ListId']},'include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':_0x133b7a,'limit':0x1,'order':[[_0x47a5('0x76'),'DESC']]}]});})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x14771b){if(_0x14771b){_0x1371e4['list']=_['omit'](_0x14771b,[_0x47a5('0x93')]);if(_0x14771b[_0x47a5('0x93')][_0x47a5('0x59')]){return _0x14771b[_0x47a5('0x93')][0x0];}var _0x204bd6=_['defaults'](_0x1371e4[_0x47a5('0x61')],{'firstName':_0x1371e4['body'][_0x47a5('0x7c')],'ListId':_0x14771b['id']});_0x204bd6[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db['CmContact'][_0x47a5('0x5b')](_0x204bd6,{'fields':_0x4c9894,'raw':!![]});}})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x4339d4){if(_0x4339d4){_0x1371e4[_0x47a5('0x94')]=_0x4339d4;var _0x36a44c={'ContactId':_0x4339d4['id'],'phone':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')],'SmsAccountId':_0x109805[_0x47a5('0x56')]['id']};var _0x481bc3={'ContactId':_0x4339d4['id'],'SmsAccountId':_0x109805['params']['id'],'closed':![]};return db[_0x47a5('0x95')]['find']({'where':_0x481bc3})[_0x47a5('0x21')](function(_0x2d0b67){if(_0x2d0b67){return[_0x2d0b67,![]];}return db[_0x47a5('0x95')]['create'](_0x36a44c)[_0x47a5('0x21')](function(_0x26d629){return[_0x26d629,!![]];});});}})['spread'](function(_0xcb6714,_0x51f6cf){_0x1371e4[_0x47a5('0x96')]=_0xcb6714[_0x47a5('0x32')]({'plain':!![]});_0x1371e4[_0x47a5('0x96')]['created']=![];if(_0x51f6cf){if(_0x1371e4['account']['autoclose']){_0x1371e4['applications']['push']({'id':0x0,'priority':_0x1371e4[_0x47a5('0x97')]['length']+0x1,'app':_0x47a5('0x98'),'appdata':_0x47a5('0x99'),'interval':'*,*,*,*'});}_0x1371e4['interaction']['created']=!![];}return db[_0x47a5('0x9a')]['create']({'phone':_0x1371e4['body']['from'],'messageId':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')],'body':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')],'SmsAccountId':_0x109805['params']['id'],'SmsInteractionId':_0xcb6714['id'],'direction':'in','ContactId':_0xcb6714[_0x47a5('0x9b')],'AttachmentId':_0x1371e4['body'][_0x47a5('0x9c')]});})['then'](function(_0x2de924){_0x1371e4[_0x47a5('0x28')]=_0x2de924;if(_0x1371e4[_0x47a5('0x96')]['UserId']){return db[_0x47a5('0x9d')][_0x47a5('0x5a')]({'attributes':['id',_0x47a5('0x35')],'where':{'id':_0x1371e4[_0x47a5('0x96')]['UserId']}})[_0x47a5('0x21')](function(_0x9a7edc){if(_0x9a7edc){_0x1371e4[_0x47a5('0x97')][_0x47a5('0x9e')]({'id':0x0,'priority':0x0,'app':_0x47a5('0x9f'),'appdata':_0x9a7edc[_0x47a5('0x35')]+','+(_0x1371e4['account'][_0x47a5('0xa0')]||0xa),'interval':_0x47a5('0xa1')});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);})[_0x47a5('0x21')](function(_0x2697df){if(_0x2697df){var _0x408887=0xc8;var _0x34fde3=_0x47a5('0xa4');logger[_0x47a5('0x22')](_0x47a5('0x25'),_0x34fde3,_0x408887,_0x47a5('0xa5'));logger[_0x47a5('0xa6')](_0x47a5('0xa7'),_0x34fde3,_0x408887,_0x47a5('0xa5'),JSON['stringify'](_0x2697df));if(_0x1371e4[_0x47a5('0x70')]['type']==='twilio'){return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0xa8')](_0x47a5('0xa9'),'text/xml')[_0x47a5('0x36')](_0x47a5('0xaa'));}else{return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0x2c')](_0x2697df);}}})[_0x47a5('0x54')](handleError(_0x70c8a6,null));};exports[_0x47a5('0xab')]=function(_0x1b1f86,_0x46cb3a,_0x176e71){return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1b1f86[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x46cb3a,null))['then'](function(_0x4aad5f){if(_0x4aad5f){return db[_0x47a5('0xac')]['transaction'](function(_0x249339){return db[_0x47a5('0x6e')][_0x47a5('0x31')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'transaction':_0x249339})[_0x47a5('0x21')](function(_0x3708ea){var _0x583b37=_[_0x47a5('0x3e')](_0x1b1f86[_0x47a5('0x61')],function(_0x380eca){_0x380eca['SmsAccountId']=_0x1b1f86[_0x47a5('0x56')]['id'];return _0x380eca;});return db[_0x47a5('0x6e')][_0x47a5('0xad')](_0x583b37,{'transaction':_0x249339});});})[_0x47a5('0x21')](function(){return db[_0x47a5('0x6e')][_0x47a5('0xae')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'order':_0x47a5('0x71')});});}})[_0x47a5('0x21')](respondWithResult(_0x46cb3a,null))[_0x47a5('0x54')](handleError(_0x46cb3a,null));};exports[_0x47a5('0xaf')]=function(_0x40b7a5,_0x28e998,_0x2ac386){var _0x578983={};var _0x3f7fdc={};var _0x272cd0;var _0x150cff;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x40b7a5[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x28e998,null))['then'](function(_0x185104){if(_0x185104){_0x272cd0=_0x185104;_0x3f7fdc['model']=_[_0x47a5('0x40')](db[_0x47a5('0x6e')][_0x47a5('0x58')]);_0x3f7fdc[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x40b7a5[_0x47a5('0x3f')]);_0x3f7fdc[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],_0x3f7fdc[_0x47a5('0x3f')]);_0x578983[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],qs[_0x47a5('0x44')](_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x578983[_0x47a5('0x43')]=_0x578983['attributes'][_0x47a5('0x59')]?_0x578983[_0x47a5('0x43')]:_0x3f7fdc[_0x47a5('0x3d')];_0x578983[_0x47a5('0x47')]=qs['sort'](_0x40b7a5[_0x47a5('0x3f')]['sort']);_0x578983['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x40b7a5[_0x47a5('0x3f')],_0x3f7fdc[_0x47a5('0x41')]));if(_0x40b7a5['query'][_0x47a5('0x4b')]){_0x578983[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x578983[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x578983[_0x47a5('0x43')],function(_0x5eae8d){var _0x1da268={};_0x1da268[_0x5eae8d]={'$like':'%'+_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1da268;})});}_0x578983=_[_0x47a5('0x4c')]({},_0x578983,_0x40b7a5[_0x47a5('0x4e')]);return _0x272cd0['getApplications'](_0x578983);}})[_0x47a5('0x21')](function(_0x4c7627){if(_0x4c7627){_0x150cff=_0x4c7627[_0x47a5('0x59')];if(!_0x40b7a5['query'][_0x47a5('0x45')]('nolimit')){_0x578983['limit']=qs[_0x47a5('0x2e')](_0x40b7a5[_0x47a5('0x3f')]['limit']);_0x578983[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x40b7a5['query'][_0x47a5('0x2d')]);}return _0x272cd0[_0x47a5('0xaf')](_0x578983);}})[_0x47a5('0x21')](function(_0x508622){if(_0x508622){return _0x508622?{'count':_0x150cff,'rows':_0x508622}:null;}})[_0x47a5('0x21')](respondWithResult(_0x28e998,null))[_0x47a5('0x54')](handleError(_0x28e998,null));};exports[_0x47a5('0xb0')]=function(_0x30b0f9,_0x37721c,_0x53cc9e){var _0x5973d4={'raw':![],'where':{}};var _0x2678cb={};var _0x56808d={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x30b0f9['params']['id']}})['then'](handleEntityNotFound(_0x37721c,null))[_0x47a5('0x21')](function(_0x4997bc){if(_0x4997bc){_0x2678cb[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x95')][_0x47a5('0x58')]);_0x2678cb[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x30b0f9[_0x47a5('0x3f')]);_0x2678cb['filters']=_[_0x47a5('0x42')](_0x2678cb['model'],_0x2678cb[_0x47a5('0x3f')]);_0x5973d4[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x2678cb[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x5973d4[_0x47a5('0x43')]=_0x5973d4[_0x47a5('0x43')][_0x47a5('0x59')]?_0x5973d4[_0x47a5('0x43')]:_0x2678cb[_0x47a5('0x3d')];if(!_0x30b0f9['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x5973d4[_0x47a5('0x2e')]=qs['limit'](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x5973d4[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x5973d4['order']=qs[_0x47a5('0x48')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x5973d4[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x30b0f9[_0x47a5('0x3f')],_0x2678cb[_0x47a5('0x41')]));_0x5973d4[_0x47a5('0x49')][_0x47a5('0x64')]=_0x4997bc['id'];if(_0x30b0f9['query']['filter']){_0x5973d4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x5973d4[_0x47a5('0x49')],{'$or':_['map'](_0x5973d4[_0x47a5('0x43')],function(_0x50b7fc){var _0x522345={};_0x522345[_0x50b7fc]={'$like':'%'+_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x522345;})});}_0x5973d4=_[_0x47a5('0x4c')]({},_0x5973d4,_0x30b0f9[_0x47a5('0x4e')]);return db['SmsInteraction'][_0x47a5('0x4f')]({'where':_0x5973d4[_0x47a5('0x49')]})['then'](function(_0x59ba59){_0x56808d['count']=_0x59ba59;if(_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x5973d4[_0x47a5('0x51')]=[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0xb1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x47a5('0x35'),_0x47a5('0xb2'),_0x47a5('0xb3')],'required':![]},{'model':db[_0x47a5('0xb4')],'as':'Tags','attributes':['id',_0x47a5('0x35'),_0x47a5('0xb5')],'where':_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0xb6')]?{'id':_0x30b0f9['query']['tag']}:undefined,'required':_0x30b0f9['query'][_0x47a5('0xb6')]?!![]:![]}];}return db[_0x47a5('0x95')][_0x47a5('0x52')](_0x5973d4);})[_0x47a5('0x21')](function(_0x242006){_0x56808d[_0x47a5('0x53')]=_0x242006;return _0x56808d;});}})[_0x47a5('0x21')](respondWithFilteredResult(_0x37721c,_0x5973d4))[_0x47a5('0x54')](handleError(_0x37721c,null));};exports[_0x47a5('0x36')]=function(_0x5b48d0,_0x40fe75,_0x7b5348){var _0x50b482,_0x34ff37,_0x2bbf95;if(_[_0x47a5('0x8c')](_0x5b48d0[_0x47a5('0x61')]['body'])||_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47a5('0x8c')](_0x5b48d0['body']['to'])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0xb7'));}_0x50b482=_0x5b48d0[_0x47a5('0x61')]['to'];return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x5b48d0[_0x47a5('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':{'mobile':_0x50b482},'limit':0x1,'order':[[_0x47a5('0x76'),_0x47a5('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x40fe75,null))['then'](function(_0x3222e4){if(_0x3222e4&&_0x3222e4['List']){_0x34ff37=_0x3222e4[_0x47a5('0x32')]({'plain':!![]});if(_0x34ff37['List']&&_0x34ff37[_0x47a5('0xb9')]['Contacts'][_0x47a5('0x59')]){return _0x34ff37[_0x47a5('0xb9')][_0x47a5('0x93')][0x0];}return db[_0x47a5('0x72')][_0x47a5('0x5b')](_[_0x47a5('0x16')](_0x5b48d0[_0x47a5('0x61')],{'firstName':_0x50b482,'mobile':_0x50b482,'phone':_0x50b482,'ListId':_0x34ff37[_0x47a5('0x77')]}));}})['then'](handleEntityNotFound(_0x40fe75,null))[_0x47a5('0x21')](function(_0x4394f0){if(_0x4394f0){_0x2bbf95=_0x4394f0;return db['SmsInteraction'][_0x47a5('0x5a')]({'where':{'ContactId':_0x2bbf95['id'],'closed':![],'SmsAccountId':_0x34ff37['id']}})[_0x47a5('0x21')](function(_0x54f283){if(_0x54f283){return[_0x54f283,![]];}return db['SmsInteraction'][_0x47a5('0x5b')]({'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id'],'SmsAccountId':_0x34ff37['id'],'phone':_0x50b482,'firstMsgDirection':_0x47a5('0xba'),'Messages':[_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0['body'][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'UserId':_0x5b48d0[_0x47a5('0x5c')]['id'],'ContactId':_0x2bbf95['id']})]},{'include':[{'model':db[_0x47a5('0x9a')],'as':_0x47a5('0xbb')}]})[_0x47a5('0x21')](function(_0x454609){return[_0x454609,!![]];});});}})[_0x47a5('0xbc')](function(_0x5c4301,_0x2bc0d8){if(_0x2bc0d8){return _0x5c4301;}return db[_0x47a5('0x9a')][_0x47a5('0x5b')](_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'SmsInteractionId':_0x5c4301['id'],'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id']}))['then'](function(_0x11d87b){_0x5c4301[_0x47a5('0xbd')][_0x47a5('0xbb')]=[];_0x5c4301['dataValues']['Messages'][_0x47a5('0xbe')](_0x11d87b[_0x47a5('0xbd')]);return _0x5c4301;});})[_0x47a5('0x21')](respondWithResult(_0x40fe75,null))[_0x47a5('0x54')](handleError(_0x40fe75,null));};exports[_0x47a5('0x2a')]=function(_0x4121c1,_0x2e0add,_0x58e85b){if(_0x4121c1[_0x47a5('0x61')]['id']){delete _0x4121c1[_0x47a5('0x61')]['id'];}console[_0x47a5('0xbf')]('endpoint\x20/status\x20POST\x20/',_0x4121c1[_0x47a5('0x61')]);var _0x611b40,_0x144bc9,_0x278b42;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x4121c1[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x9ced85){if(_0x9ced85){_0x278b42=_0x9ced85;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),'received\x20delivery\x20report\x20from',_0x9ced85[_0x47a5('0x3b')],util['inspect'](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));switch(_0x9ced85['type']){case _0x47a5('0x7b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc0')]&&_0x4121c1['body'][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1['body'][_0x47a5('0x2a')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['skebby_dispatch_id']}});}break;case _0x47a5('0x7d'):if(_0x4121c1['body']['requestid']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc2')]}});}break;case _0x47a5('0xc3'):if(_0x4121c1['body']['message_id']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')];return db[_0x47a5('0x9a')]['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0x7e')]}});}break;case _0x47a5('0x82'):var _0x50ff41=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x50ff41[_0x47a5('0x7a')]&&_0x50ff41['status'][_0x47a5('0xc5')]===_0x47a5('0xc6')){_0x144bc9=_0x50ff41[_0x47a5('0x2a')]['groupName'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x50ff41[_0x47a5('0x7a')]}});}break;case _0x47a5('0x87'):if(_0x4121c1[_0x47a5('0x61')]['messageId']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['messageId']}});}break;case _0x47a5('0x8b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc7')]&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')]['status'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x4ebe30){if(_0x4ebe30){_0x611b40=_0x4ebe30;switch(_0x278b42[_0x47a5('0x3b')]){case _0x47a5('0x7b'):if(_0x144bc9===_0x47a5('0xc6')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x7d'):if(_0x144bc9==='1'){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc9')]&&_0x144bc9>=0xc8&&_0x144bc9<=0xce){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xc3'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x82'):var _0x2cc493=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x2cc493[_0x47a5('0x2a')][_0x47a5('0xc5')]===_0x47a5('0xc6')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),'infobip',util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x144bc9==_0x47a5('0xca')||_0x144bc9==_0x47a5('0xcb')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),'status',_0x47a5('0x87'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x8b'):if(_0x144bc9===_0x47a5('0xcc')||_0x144bc9===_0x47a5('0xcd')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x8b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x611b40;}})[_0x47a5('0x21')](respondWithResult(_0x2e0add,null))[_0x47a5('0x54')](handleError(_0x2e0add,null));};exports[_0x47a5('0xce')]=function(_0x138b92,_0x232c36,_0x25954e){var _0x277061,_0x3917e0,_0x1c7695;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x138b92[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x46b82a){if(_0x46b82a){_0x1c7695=_0x46b82a;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xcf'),_0x46b82a[_0x47a5('0x3b')],util[_0x47a5('0xc8')](_0x138b92['query'],{'showHidden':![],'depth':null}));switch(_0x46b82a[_0x47a5('0x3b')]){case'csc':if(_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]&&_0x138b92['query'][_0x47a5('0xd1')]){_0x3917e0=_0x138b92['query'][_0x47a5('0xd1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x9a2f87){if(_0x9a2f87){_0x277061=_0x9a2f87;switch(_0x1c7695[_0x47a5('0x3b')]){case'csc':if(_0x3917e0==='2'||_0x3917e0==='6'){return _0x277061['update']({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),'csc',util[_0x47a5('0xc8')](_0x138b92[_0x47a5('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x277061;}})[_0x47a5('0x21')](respondWithResult(_0x232c36,null))['catch'](handleError(_0x232c36,null));};exports[_0x47a5('0xd2')]=function(_0x3136f9,_0x3ecc43,_0xf4b1df){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x3136f9['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x3ecc43,null))[_0x47a5('0x21')](function(_0xdc5eac){if(_0xdc5eac){return _0xdc5eac[_0x47a5('0xd2')](_0x3136f9['body'][_0x47a5('0x68')],_[_0x47a5('0xd3')](_0x3136f9[_0x47a5('0x61')],[_0x47a5('0x68'),'id'])||{})[_0x47a5('0xbc')](function(_0x4c2b0c){for(var _0xbe3a38=0x0;_0xbe3a38<_0x3136f9[_0x47a5('0x61')][_0x47a5('0x68')][_0x47a5('0x59')];_0xbe3a38+=0x1){socket[_0x47a5('0xd4')](_0x47a5('0xd5'),{'UserId':_0x3136f9['body'][_0x47a5('0x68')][_0xbe3a38],'SmsAccountId':_0x3136f9[_0x47a5('0x56')]['id']});}return _0x4c2b0c;});}})['then'](respondWithResult(_0x3ecc43,null))['catch'](handleError(_0x3ecc43,null));};exports[_0x47a5('0xd6')]=function(_0x32d299,_0x20d99b,_0x3964f8){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x32d299['params']['id']}})['then'](handleEntityNotFound(_0x20d99b,null))[_0x47a5('0x21')](function(_0xa3a516){if(_0xa3a516){return _0xa3a516['removeAgents'](_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')])['then'](function(){if(_[_0x47a5('0xd7')](_0x32d299['query']['ids'])){for(var _0x4aeaff=0x0;_0x4aeaff<_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')][_0x47a5('0x59')];_0x4aeaff+=0x1){socket['emit'](_0x47a5('0xd8'),{'UserId':Number(_0x32d299['query'][_0x47a5('0x68')][_0x4aeaff]),'SmsAccountId':Number(_0x32d299['params']['id'])});}}else{socket[_0x47a5('0xd4')](_0x47a5('0xd8'),{'UserId':Number(_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')]),'SmsAccountId':Number(_0x32d299[_0x47a5('0x56')]['id'])});}});}})[_0x47a5('0x21')](respondWithStatusCode(_0x20d99b,null))[_0x47a5('0x54')](handleError(_0x20d99b,null));};exports[_0x47a5('0xd9')]=function(_0x1396c2,_0x5c9091,_0x4f1e24){var _0x24c88e={};var _0xa859a={};var _0x5270cc;var _0x2a0f45;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1396c2[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x5c9091,null))[_0x47a5('0x21')](function(_0x969d4b){if(_0x969d4b){_0x5270cc=_0x969d4b;_0xa859a[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x9d')]['rawAttributes']);_0xa859a['query']=_['keys'](_0x1396c2['query']);_0xa859a[_0x47a5('0x41')]=_['intersection'](_0xa859a[_0x47a5('0x3d')],_0xa859a[_0x47a5('0x3f')]);_0x24c88e['attributes']=_[_0x47a5('0x42')](_0xa859a[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x24c88e[_0x47a5('0x43')]=_0x24c88e['attributes'][_0x47a5('0x59')]?_0x24c88e[_0x47a5('0x43')]:_0xa859a['model'];_0x24c88e[_0x47a5('0x47')]=qs['sort'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x24c88e[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x1396c2[_0x47a5('0x3f')],_0xa859a[_0x47a5('0x41')]));if(_0x1396c2['query'][_0x47a5('0x4b')]){_0x24c88e[_0x47a5('0x49')]=_['merge'](_0x24c88e[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x24c88e['attributes'],function(_0x14c968){var _0x5a7920={};_0x5a7920[_0x14c968]={'$like':'%'+_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x5a7920;})});}_0x24c88e=_[_0x47a5('0x4c')]({},_0x24c88e,_0x1396c2[_0x47a5('0x4e')]);return _0x5270cc[_0x47a5('0xd9')](_0x24c88e);}})['then'](function(_0x4b8b65){if(_0x4b8b65){_0x2a0f45=_0x4b8b65[_0x47a5('0x59')];if(!_0x1396c2['query']['hasOwnProperty']('nolimit')){_0x24c88e[_0x47a5('0x2e')]=qs['limit'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x24c88e[_0x47a5('0x2d')]=qs['offset'](_0x1396c2['query'][_0x47a5('0x2d')]);}return _0x5270cc['getAgents'](_0x24c88e);}})['then'](function(_0xe87e6e){if(_0xe87e6e){return _0xe87e6e?{'count':_0x2a0f45,'rows':_0xe87e6e}:null;}})['then'](respondWithResult(_0x5c9091,null))['catch'](handleError(_0x5c9091,null));}; \ No newline at end of file +var _0x7a54=['findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','spread','dataValues','push','log','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','limit','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','user','role','SmsAccounts','UserProfileSection','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','From','Body','messageId','skebby','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','SmsInteraction','interaction','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','addApplications','sequelize','bulkCreate'];(function(_0x336d7b,_0x14d327){var _0x686e7=function(_0x3f8b2d){while(--_0x3f8b2d){_0x336d7b['push'](_0x336d7b['shift']());}};_0x686e7(++_0x14d327);}(_0x7a54,0x106));var _0x47a5=function(_0x1912da,_0x251b37){_0x1912da=_0x1912da-0x0;var _0x11a519=_0x7a54[_0x1912da];return _0x11a519;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);var jayson=require(_0x47a5('0x1a'));var client=jayson[_0x47a5('0x1b')][_0x47a5('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x190faa,_0x4e99a8,_0x362359){if(_0x362359){var _0x11faf5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11faf5[_0x47a5('0x1d')](_0x4e99a8)){return _0x190faa;}else{throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x190faa;}}function respondWithRpcPromise(_0x549de3,_0x138bc0,_0x4b966e,_0x5247fd){return new BPromise(function(_0x423a81,_0xaf70a6){var _0x2ce454=_0x5247fd||client;return _0x2ce454[_0x47a5('0x20')](_0x549de3,_0x4b966e)[_0x47a5('0x21')](function(_0x12b98e){logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,_0x47a5('0x24'));logger['debug'](_0x47a5('0x25'),_0x138bc0,_0x47a5('0x24'),JSON['stringify'](_0x12b98e));if(_0x12b98e[_0x47a5('0x26')]){if(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x27')]===0x1f4){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);return _0xaf70a6(_0x12b98e[_0x47a5('0x26')]['message']);}logger[_0x47a5('0x26')](_0x47a5('0x23'),_0x138bc0,_0x12b98e['error'][_0x47a5('0x28')]);return _0x423a81(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);}else{logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,'request\x20sent');_0x423a81(_0x12b98e['result'][_0x47a5('0x28')]);}})['catch'](function(_0x1ea9c8){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x1ea9c8);_0xaf70a6(_0x1ea9c8);});});}function respondWithStatusCode(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0xcc;return function(_0x1dac65){if(_0x1dac65){return _0x378208[_0x47a5('0x29')](_0x36ad34);}return _0x378208[_0x47a5('0x2a')](_0x36ad34)[_0x47a5('0x2b')]();};}function respondWithResult(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0xc8;return function(_0x361bfa){if(_0x361bfa){return _0x136b14[_0x47a5('0x2a')](_0x16631f)[_0x47a5('0x2c')](_0x361bfa);}};}function respondWithFilteredResult(_0x3ad507,_0x528582){return function(_0x243210){if(_0x243210){var _0x51833b=_0x243210['count'],_0x2ef875=_0x528582[_0x47a5('0x2d')],_0x9ac908=_0x528582[_0x47a5('0x2d')]+_0x528582[_0x47a5('0x2e')],_0x16901f;if(_0x9ac908>=_0x51833b){_0x9ac908=_0x51833b;_0x16901f=0xc8;}else{_0x16901f=0xce;}_0x3ad507[_0x47a5('0x2a')](_0x16901f);return _0x3ad507['set']('Content-Range',_0x2ef875+'-'+_0x9ac908+'/'+_0x51833b)[_0x47a5('0x2c')](_0x243210);}return null;};}function patchUpdates(_0xfb5ddb){return function(_0x5bd7eb){try{jsonpatch['apply'](_0x5bd7eb,_0xfb5ddb,!![]);}catch(_0x836303){return BPromise[_0x47a5('0x2f')](_0x836303);}return _0x5bd7eb['save']();};}function saveUpdates(_0x42f70c,_0x53119b){return function(_0x122ed6){if(_0x122ed6){return _0x122ed6[_0x47a5('0x30')](_0x42f70c)['then'](function(_0x4843c0){return _0x4843c0;});}return null;};}function removeEntity(_0x274e34,_0x5910bb){return function(_0x403028){if(_0x403028){return _0x403028[_0x47a5('0x31')]()[_0x47a5('0x21')](function(){var _0x52749b=_0x403028[_0x47a5('0x32')]({'plain':!![]});var _0x50c086='SmsAccounts';return db[_0x47a5('0x33')]['destroy']({'where':{'type':_0x50c086,'resourceId':_0x52749b['id']}})[_0x47a5('0x21')](function(){return _0x403028;});})['then'](function(){_0x274e34[_0x47a5('0x2a')](0xcc)[_0x47a5('0x2b')]();});}};}function handleEntityNotFound(_0x38c8d4,_0x199698){return function(_0x36add5){if(!_0x36add5){_0x38c8d4[_0x47a5('0x29')](0x194);}return _0x36add5;};}function handleError(_0xee582c,_0x452be5){_0x452be5=_0x452be5||0x1f4;return function(_0x1a0d23){logger['error'](_0x1a0d23[_0x47a5('0x34')]);if(_0x1a0d23[_0x47a5('0x35')]){delete _0x1a0d23['name'];}_0xee582c[_0x47a5('0x2a')](_0x452be5)[_0x47a5('0x36')](_0x1a0d23);};}exports[_0x47a5('0x37')]=function(_0x49c4b5,_0x101f70){var _0x10f660={'include':[{'model':db[_0x47a5('0x38')],'as':'mandatoryDispositionPause'}]},_0x596097={},_0x2ebba0={'count':0x0,'rows':[]};var _0x55c5eb=_['map'](db[_0x47a5('0x39')]['rawAttributes'],function(_0x9b5eaf){return{'name':_0x9b5eaf[_0x47a5('0x3a')],'type':_0x9b5eaf[_0x47a5('0x3b')][_0x47a5('0x3c')]};});_0x596097[_0x47a5('0x3d')]=_[_0x47a5('0x3e')](_0x55c5eb,_0x47a5('0x35'));_0x596097[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x49c4b5[_0x47a5('0x3f')]);_0x596097[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],_0x596097['query']);_0x10f660[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x49c4b5['query'][_0x47a5('0x44')]));_0x10f660['attributes']=_0x10f660['attributes']['length']?_0x10f660['attributes']:_0x596097[_0x47a5('0x3d')];if(!_0x49c4b5['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x10f660[_0x47a5('0x2e')]=qs['limit'](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x10f660['offset']=qs['offset'](_0x49c4b5[_0x47a5('0x3f')]['offset']);}_0x10f660[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x10f660[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x49c4b5[_0x47a5('0x3f')],_0x596097[_0x47a5('0x41')]),_0x55c5eb);if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x4b')]){_0x10f660[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x10f660[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x55c5eb,function(_0x3a2b38){if(_0x3a2b38['type']!==_0x47a5('0x4d')){var _0x23bb04={};_0x23bb04[_0x3a2b38['name']]={'$like':'%'+_0x49c4b5['query'][_0x47a5('0x4b')]+'%'};return _0x23bb04;}})});}_0x10f660=_['merge']({},_0x10f660,_0x49c4b5[_0x47a5('0x4e')]);var _0xd93e37={'where':_0x10f660['where']};return db['SmsAccount'][_0x47a5('0x4f')](_0xd93e37)['then'](function(_0x2d147c){_0x2ebba0[_0x47a5('0x4f')]=_0x2d147c;if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x10f660[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x39')][_0x47a5('0x52')](_0x10f660);})['then'](function(_0x48a0ef){_0x2ebba0[_0x47a5('0x53')]=_0x48a0ef;return _0x2ebba0;})[_0x47a5('0x21')](respondWithFilteredResult(_0x101f70,_0x10f660))[_0x47a5('0x54')](handleError(_0x101f70,null));};exports[_0x47a5('0x55')]=function(_0x2c7020,_0x2c0c86){var _0x249de5={'raw':![],'where':{'id':_0x2c7020[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]},_0x492cf7={};_0x492cf7['model']=_[_0x47a5('0x40')](db['SmsAccount'][_0x47a5('0x58')]);_0x492cf7[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x2c7020[_0x47a5('0x3f')]);_0x492cf7['filters']=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],_0x492cf7[_0x47a5('0x3f')]);_0x249de5[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x2c7020['query'][_0x47a5('0x44')]));_0x249de5[_0x47a5('0x43')]=_0x249de5[_0x47a5('0x43')][_0x47a5('0x59')]?_0x249de5[_0x47a5('0x43')]:_0x492cf7[_0x47a5('0x3d')];if(_0x2c7020['query'][_0x47a5('0x50')]){_0x249de5[_0x47a5('0x51')]=[{'all':!![]}];}_0x249de5=_[_0x47a5('0x4c')]({},_0x249de5,_0x2c7020['options']);return db[_0x47a5('0x39')][_0x47a5('0x5a')](_0x249de5)[_0x47a5('0x21')](handleEntityNotFound(_0x2c0c86,null))['then'](respondWithResult(_0x2c0c86,null))['catch'](handleError(_0x2c0c86,null));};exports[_0x47a5('0x5b')]=function(_0x376e1d,_0x4fa1da){return db['SmsAccount'][_0x47a5('0x5b')](_0x376e1d['body'],{})[_0x47a5('0x21')](function(_0x5d383d){var _0x482de6=_0x376e1d[_0x47a5('0x5c')][_0x47a5('0x32')]({'plain':!![]});if(!_0x482de6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482de6[_0x47a5('0x5d')]===_0x47a5('0x5c')){var _0x4b706a=_0x5d383d['get']({'plain':!![]});var _0x16b4fd=_0x47a5('0x5e');return db[_0x47a5('0x5f')][_0x47a5('0x5a')]({'where':{'name':_0x16b4fd,'userProfileId':_0x482de6['userProfileId']},'raw':!![]})[_0x47a5('0x21')](function(_0x2b4255){if(_0x2b4255&&_0x2b4255[_0x47a5('0x60')]===0x0){return db['UserProfileResource'][_0x47a5('0x5b')]({'name':_0x4b706a['name'],'resourceId':_0x4b706a['id'],'type':_0x2b4255[_0x47a5('0x35')],'sectionId':_0x2b4255['id']},{})[_0x47a5('0x21')](function(){return _0x5d383d;});}else{return _0x5d383d;}})[_0x47a5('0x54')](function(_0x1c485b){logger[_0x47a5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c485b);throw _0x1c485b;});}return _0x5d383d;})[_0x47a5('0x21')](respondWithResult(_0x4fa1da,0xc9))['catch'](handleError(_0x4fa1da,null));};exports['update']=function(_0x5eb150,_0x4f8564){if(_0x5eb150[_0x47a5('0x61')]['id']){delete _0x5eb150[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')]['find']({'where':{'id':_0x5eb150['params']['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x4f8564,null))[_0x47a5('0x21')](saveUpdates(_0x5eb150[_0x47a5('0x61')],null))['then'](respondWithResult(_0x4f8564,null))[_0x47a5('0x54')](handleError(_0x4f8564,null));};exports['destroy']=function(_0x22c886,_0x274d31){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x22c886[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x274d31,null))[_0x47a5('0x21')](removeEntity(_0x274d31,null))[_0x47a5('0x54')](handleError(_0x274d31,null));};exports[_0x47a5('0x62')]=function(_0x35cca8,_0x3ac38c){return db['SmsAccount'][_0x47a5('0x62')]()[_0x47a5('0x21')](respondWithResult(_0x3ac38c,null))[_0x47a5('0x54')](handleError(_0x3ac38c,null));};exports[_0x47a5('0x63')]=function(_0x396cb0,_0x4bbe14,_0xbec033){if(_0x396cb0[_0x47a5('0x61')]['id']){delete _0x396cb0[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x396cb0[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4bbe14,null))[_0x47a5('0x21')](function(_0x350af8){if(_0x350af8){_0x396cb0[_0x47a5('0x61')][_0x47a5('0x64')]=_0x350af8['id'];return db[_0x47a5('0x65')][_0x47a5('0x5b')](_0x396cb0[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x4bbe14,null))['catch'](handleError(_0x4bbe14,null));};exports[_0x47a5('0x66')]=function(_0x284fb8,_0x30504e,_0x4b42f3){var _0x37ac59={'raw':![],'where':{}};var _0x2e46af={};var _0x36c67={'count':0x0,'rows':[]};return db[_0x47a5('0x39')]['findOne']({'where':{'id':_0x284fb8[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x30504e,null))[_0x47a5('0x21')](function(_0x487e21){if(_0x487e21){_0x2e46af[_0x47a5('0x3d')]=_['keys'](db[_0x47a5('0x65')][_0x47a5('0x58')]);_0x2e46af[_0x47a5('0x3f')]=_['keys'](_0x284fb8['query']);_0x2e46af['filters']=_[_0x47a5('0x42')](_0x2e46af[_0x47a5('0x3d')],_0x2e46af[_0x47a5('0x3f')]);_0x37ac59[_0x47a5('0x43')]=_['intersection'](_0x2e46af[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x37ac59[_0x47a5('0x43')]=_0x37ac59[_0x47a5('0x43')][_0x47a5('0x59')]?_0x37ac59[_0x47a5('0x43')]:_0x2e46af[_0x47a5('0x3d')];if(!_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x45')](_0x47a5('0x46'))){_0x37ac59['limit']=qs[_0x47a5('0x2e')](_0x284fb8['query'][_0x47a5('0x2e')]);_0x37ac59[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x37ac59[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x37ac59[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x284fb8[_0x47a5('0x3f')],_0x2e46af[_0x47a5('0x41')]));_0x37ac59[_0x47a5('0x49')]['SmsAccountId']=_0x487e21['id'];if(_0x284fb8['query']['filter']){_0x37ac59['where']=_[_0x47a5('0x4c')](_0x37ac59[_0x47a5('0x49')],{'$or':_['map'](_0x37ac59[_0x47a5('0x43')],function(_0x44dda2){var _0x1baa5a={};_0x1baa5a[_0x44dda2]={'$like':'%'+_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1baa5a;})});}_0x37ac59=_[_0x47a5('0x4c')]({},_0x37ac59,_0x284fb8[_0x47a5('0x4e')]);return db[_0x47a5('0x65')][_0x47a5('0x4f')]({'where':_0x37ac59[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x5e5f16){_0x36c67[_0x47a5('0x4f')]=_0x5e5f16;if(_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x37ac59['include']=[{'all':!![]}];}return db[_0x47a5('0x65')][_0x47a5('0x52')](_0x37ac59);})[_0x47a5('0x21')](function(_0x5d41d8){_0x36c67[_0x47a5('0x53')]=_0x5d41d8;return _0x36c67;});}})['then'](respondWithFilteredResult(_0x30504e,_0x37ac59))['catch'](handleError(_0x30504e,null));};exports[_0x47a5('0x67')]=function(_0x292d9c,_0x277486,_0x27333e){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x292d9c['params']['id']}})['then'](handleEntityNotFound(_0x277486,null))[_0x47a5('0x21')](function(_0x4f2361){if(_0x4f2361){return _0x4f2361[_0x47a5('0x67')](_0x292d9c[_0x47a5('0x3f')][_0x47a5('0x68')]);}})[_0x47a5('0x21')](respondWithStatusCode(_0x277486,null))['catch'](handleError(_0x277486,null));};exports[_0x47a5('0x69')]=function(_0x550bde,_0x5f3a04,_0x139c79){if(_0x550bde[_0x47a5('0x61')]['id']){delete _0x550bde['body']['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x550bde[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3a04,null))[_0x47a5('0x21')](function(_0x578e27){if(_0x578e27){_0x550bde[_0x47a5('0x61')][_0x47a5('0x64')]=_0x578e27['id'];return db[_0x47a5('0x6a')]['create'](_0x550bde[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x5f3a04,null))[_0x47a5('0x54')](handleError(_0x5f3a04,null));};exports['getAnswers']=function(_0x3525e7,_0x4f2fbb,_0x3c012b){var _0x491bb4={'raw':![],'where':{}};var _0x135d2e={};var _0x20d8bd={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x3525e7['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4f2fbb,null))[_0x47a5('0x21')](function(_0x23c393){if(_0x23c393){_0x135d2e[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db['CannedAnswer']['rawAttributes']);_0x135d2e[_0x47a5('0x3f')]=_['keys'](_0x3525e7[_0x47a5('0x3f')]);_0x135d2e[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x135d2e['model'],_0x135d2e[_0x47a5('0x3f')]);_0x491bb4[_0x47a5('0x43')]=_['intersection'](_0x135d2e[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x491bb4['attributes']=_0x491bb4['attributes'][_0x47a5('0x59')]?_0x491bb4[_0x47a5('0x43')]:_0x135d2e['model'];if(!_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x45')]('nolimit')){_0x491bb4[_0x47a5('0x2e')]=qs[_0x47a5('0x2e')](_0x3525e7[_0x47a5('0x3f')]['limit']);_0x491bb4[_0x47a5('0x2d')]=qs['offset'](_0x3525e7[_0x47a5('0x3f')]['offset']);}_0x491bb4[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x3525e7['query'][_0x47a5('0x48')]);_0x491bb4['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x3525e7[_0x47a5('0x3f')],_0x135d2e[_0x47a5('0x41')]));_0x491bb4['where'][_0x47a5('0x64')]=_0x23c393['id'];if(_0x3525e7['query']['filter']){_0x491bb4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x491bb4[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x491bb4[_0x47a5('0x43')],function(_0x5b1f5e){var _0x1522a6={};_0x1522a6[_0x5b1f5e]={'$like':'%'+_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1522a6;})});}_0x491bb4=_[_0x47a5('0x4c')]({},_0x491bb4,_0x3525e7['options']);return db[_0x47a5('0x6a')]['count']({'where':_0x491bb4[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x3f93f0){_0x20d8bd[_0x47a5('0x4f')]=_0x3f93f0;if(_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x491bb4[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x6a')][_0x47a5('0x52')](_0x491bb4);})['then'](function(_0x36796e){_0x20d8bd[_0x47a5('0x53')]=_0x36796e;return _0x20d8bd;});}})['then'](respondWithFilteredResult(_0x4f2fbb,_0x491bb4))[_0x47a5('0x54')](handleError(_0x4f2fbb,null));};exports[_0x47a5('0x6c')]=function(_0x6d6a5,_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x6d6a5['params']['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x21')](function(_0x17f82d){if(_0x17f82d){return _0x17f82d['removeAnswers'](_0x6d6a5[_0x47a5('0x3f')][_0x47a5('0x68')]);}})['then'](respondWithStatusCode(_0x5b85cd,null))[_0x47a5('0x54')](handleError(_0x5b85cd,null));};exports[_0x47a5('0x6d')]=function(_0x109805,_0x70c8a6,_0x364bb0){var _0x1371e4={'channel':'sms'};var _0x4c9894=[];var _0x5bd86e=[];var _0x133b7a={};return db[_0x47a5('0x39')]['find']({'where':{'id':_0x109805[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6f')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x5084d6){_0x1371e4[_0x47a5('0x70')]=_0x5084d6;_0x1371e4['applications']=_['orderBy'](_0x5084d6['Applications'],[_0x47a5('0x71')],['asc']);if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x6f')]){delete _0x1371e4[_0x47a5('0x70')]['Applications'];}return db[_0x47a5('0x72')][_0x47a5('0x62')]();})[_0x47a5('0x21')](function(_0x121750){if(!_0x121750){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x73'));}_0x4c9894=_[_0x47a5('0x74')](_['keys'](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76')]);_0x5bd86e=_[_0x47a5('0x74')](_[_0x47a5('0x40')](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76'),'CompanyId',_0x47a5('0x77')]);_0x1371e4[_0x47a5('0x61')]={'mapKey':'mobile'};if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){switch(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){case'twilio':_0x1371e4['body']['from']=_0x109805['body'][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x79')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['MessageSid'];break;case _0x47a5('0x7b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['sender'];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body']['text'];break;case _0x47a5('0x7d'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805[_0x47a5('0x61')][_0x47a5('0x28')];break;case'clicksend':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x61')];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7e')];break;case _0x47a5('0x7f'):_0x1371e4['body'][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x80')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x81')];break;case _0x47a5('0x82'):_0x1371e4['body'][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['results'][0x0][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0]['text'];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0][_0x47a5('0x7a')];break;case _0x47a5('0x84'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805['body'][_0x47a5('0x85')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x86')][_0x47a5('0x28')];break;case _0x47a5('0x87'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x88')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805['body'][_0x47a5('0x89')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x8a')];break;case _0x47a5('0x8b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805['body'][_0x47a5('0x7c')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')]['message'];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['refid'];break;}}if(_0x1371e4[_0x47a5('0x61')]['id']){delete _0x1371e4[_0x47a5('0x61')]['id'];}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')]['from'])){throw new db[(_0x47a5('0x1e'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x1371e4[_0x47a5('0x61')]['body'])||_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8d'));}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8f')+_0x5bd86e);}if(!_[_0x47a5('0x90')](_0x5bd86e,_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x91')+_0x5bd86e);}_0x133b7a[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db[_0x47a5('0x92')]['find']({'where':{'id':_0x1371e4[_0x47a5('0x70')]['ListId']},'include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':_0x133b7a,'limit':0x1,'order':[[_0x47a5('0x76'),'DESC']]}]});})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x14771b){if(_0x14771b){_0x1371e4['list']=_['omit'](_0x14771b,[_0x47a5('0x93')]);if(_0x14771b[_0x47a5('0x93')][_0x47a5('0x59')]){return _0x14771b[_0x47a5('0x93')][0x0];}var _0x204bd6=_['defaults'](_0x1371e4[_0x47a5('0x61')],{'firstName':_0x1371e4['body'][_0x47a5('0x7c')],'ListId':_0x14771b['id']});_0x204bd6[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db['CmContact'][_0x47a5('0x5b')](_0x204bd6,{'fields':_0x4c9894,'raw':!![]});}})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x4339d4){if(_0x4339d4){_0x1371e4[_0x47a5('0x94')]=_0x4339d4;var _0x36a44c={'ContactId':_0x4339d4['id'],'phone':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')],'SmsAccountId':_0x109805[_0x47a5('0x56')]['id']};var _0x481bc3={'ContactId':_0x4339d4['id'],'SmsAccountId':_0x109805['params']['id'],'closed':![]};return db[_0x47a5('0x95')]['find']({'where':_0x481bc3})[_0x47a5('0x21')](function(_0x2d0b67){if(_0x2d0b67){return[_0x2d0b67,![]];}return db[_0x47a5('0x95')]['create'](_0x36a44c)[_0x47a5('0x21')](function(_0x26d629){return[_0x26d629,!![]];});});}})['spread'](function(_0xcb6714,_0x51f6cf){_0x1371e4[_0x47a5('0x96')]=_0xcb6714[_0x47a5('0x32')]({'plain':!![]});_0x1371e4[_0x47a5('0x96')]['created']=![];if(_0x51f6cf){if(_0x1371e4['account']['autoclose']){_0x1371e4['applications']['push']({'id':0x0,'priority':_0x1371e4[_0x47a5('0x97')]['length']+0x1,'app':_0x47a5('0x98'),'appdata':_0x47a5('0x99'),'interval':'*,*,*,*'});}_0x1371e4['interaction']['created']=!![];}return db[_0x47a5('0x9a')]['create']({'phone':_0x1371e4['body']['from'],'messageId':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')],'body':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')],'SmsAccountId':_0x109805['params']['id'],'SmsInteractionId':_0xcb6714['id'],'direction':'in','ContactId':_0xcb6714[_0x47a5('0x9b')],'AttachmentId':_0x1371e4['body'][_0x47a5('0x9c')]});})['then'](function(_0x2de924){_0x1371e4[_0x47a5('0x28')]=_0x2de924;if(_0x1371e4[_0x47a5('0x96')]['UserId']){return db[_0x47a5('0x9d')][_0x47a5('0x5a')]({'attributes':['id',_0x47a5('0x35')],'where':{'id':_0x1371e4[_0x47a5('0x96')]['UserId']}})[_0x47a5('0x21')](function(_0x9a7edc){if(_0x9a7edc){_0x1371e4[_0x47a5('0x97')][_0x47a5('0x9e')]({'id':0x0,'priority':0x0,'app':_0x47a5('0x9f'),'appdata':_0x9a7edc[_0x47a5('0x35')]+','+(_0x1371e4['account'][_0x47a5('0xa0')]||0xa),'interval':_0x47a5('0xa1')});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);})[_0x47a5('0x21')](function(_0x2697df){if(_0x2697df){var _0x408887=0xc8;var _0x34fde3=_0x47a5('0xa4');logger[_0x47a5('0x22')](_0x47a5('0x25'),_0x34fde3,_0x408887,_0x47a5('0xa5'));logger[_0x47a5('0xa6')](_0x47a5('0xa7'),_0x34fde3,_0x408887,_0x47a5('0xa5'),JSON['stringify'](_0x2697df));if(_0x1371e4[_0x47a5('0x70')]['type']==='twilio'){return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0xa8')](_0x47a5('0xa9'),'text/xml')[_0x47a5('0x36')](_0x47a5('0xaa'));}else{return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0x2c')](_0x2697df);}}})[_0x47a5('0x54')](handleError(_0x70c8a6,null));};exports[_0x47a5('0xab')]=function(_0x1b1f86,_0x46cb3a,_0x176e71){return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1b1f86[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x46cb3a,null))['then'](function(_0x4aad5f){if(_0x4aad5f){return db[_0x47a5('0xac')]['transaction'](function(_0x249339){return db[_0x47a5('0x6e')][_0x47a5('0x31')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'transaction':_0x249339})[_0x47a5('0x21')](function(_0x3708ea){var _0x583b37=_[_0x47a5('0x3e')](_0x1b1f86[_0x47a5('0x61')],function(_0x380eca){_0x380eca['SmsAccountId']=_0x1b1f86[_0x47a5('0x56')]['id'];return _0x380eca;});return db[_0x47a5('0x6e')][_0x47a5('0xad')](_0x583b37,{'transaction':_0x249339});});})[_0x47a5('0x21')](function(){return db[_0x47a5('0x6e')][_0x47a5('0xae')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'order':_0x47a5('0x71')});});}})[_0x47a5('0x21')](respondWithResult(_0x46cb3a,null))[_0x47a5('0x54')](handleError(_0x46cb3a,null));};exports[_0x47a5('0xaf')]=function(_0x40b7a5,_0x28e998,_0x2ac386){var _0x578983={};var _0x3f7fdc={};var _0x272cd0;var _0x150cff;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x40b7a5[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x28e998,null))['then'](function(_0x185104){if(_0x185104){_0x272cd0=_0x185104;_0x3f7fdc['model']=_[_0x47a5('0x40')](db[_0x47a5('0x6e')][_0x47a5('0x58')]);_0x3f7fdc[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x40b7a5[_0x47a5('0x3f')]);_0x3f7fdc[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],_0x3f7fdc[_0x47a5('0x3f')]);_0x578983[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],qs[_0x47a5('0x44')](_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x578983[_0x47a5('0x43')]=_0x578983['attributes'][_0x47a5('0x59')]?_0x578983[_0x47a5('0x43')]:_0x3f7fdc[_0x47a5('0x3d')];_0x578983[_0x47a5('0x47')]=qs['sort'](_0x40b7a5[_0x47a5('0x3f')]['sort']);_0x578983['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x40b7a5[_0x47a5('0x3f')],_0x3f7fdc[_0x47a5('0x41')]));if(_0x40b7a5['query'][_0x47a5('0x4b')]){_0x578983[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x578983[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x578983[_0x47a5('0x43')],function(_0x5eae8d){var _0x1da268={};_0x1da268[_0x5eae8d]={'$like':'%'+_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1da268;})});}_0x578983=_[_0x47a5('0x4c')]({},_0x578983,_0x40b7a5[_0x47a5('0x4e')]);return _0x272cd0['getApplications'](_0x578983);}})[_0x47a5('0x21')](function(_0x4c7627){if(_0x4c7627){_0x150cff=_0x4c7627[_0x47a5('0x59')];if(!_0x40b7a5['query'][_0x47a5('0x45')]('nolimit')){_0x578983['limit']=qs[_0x47a5('0x2e')](_0x40b7a5[_0x47a5('0x3f')]['limit']);_0x578983[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x40b7a5['query'][_0x47a5('0x2d')]);}return _0x272cd0[_0x47a5('0xaf')](_0x578983);}})[_0x47a5('0x21')](function(_0x508622){if(_0x508622){return _0x508622?{'count':_0x150cff,'rows':_0x508622}:null;}})[_0x47a5('0x21')](respondWithResult(_0x28e998,null))[_0x47a5('0x54')](handleError(_0x28e998,null));};exports[_0x47a5('0xb0')]=function(_0x30b0f9,_0x37721c,_0x53cc9e){var _0x5973d4={'raw':![],'where':{}};var _0x2678cb={};var _0x56808d={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x30b0f9['params']['id']}})['then'](handleEntityNotFound(_0x37721c,null))[_0x47a5('0x21')](function(_0x4997bc){if(_0x4997bc){_0x2678cb[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x95')][_0x47a5('0x58')]);_0x2678cb[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x30b0f9[_0x47a5('0x3f')]);_0x2678cb['filters']=_[_0x47a5('0x42')](_0x2678cb['model'],_0x2678cb[_0x47a5('0x3f')]);_0x5973d4[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x2678cb[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x5973d4[_0x47a5('0x43')]=_0x5973d4[_0x47a5('0x43')][_0x47a5('0x59')]?_0x5973d4[_0x47a5('0x43')]:_0x2678cb[_0x47a5('0x3d')];if(!_0x30b0f9['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x5973d4[_0x47a5('0x2e')]=qs['limit'](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x5973d4[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x5973d4['order']=qs[_0x47a5('0x48')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x5973d4[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x30b0f9[_0x47a5('0x3f')],_0x2678cb[_0x47a5('0x41')]));_0x5973d4[_0x47a5('0x49')][_0x47a5('0x64')]=_0x4997bc['id'];if(_0x30b0f9['query']['filter']){_0x5973d4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x5973d4[_0x47a5('0x49')],{'$or':_['map'](_0x5973d4[_0x47a5('0x43')],function(_0x50b7fc){var _0x522345={};_0x522345[_0x50b7fc]={'$like':'%'+_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x522345;})});}_0x5973d4=_[_0x47a5('0x4c')]({},_0x5973d4,_0x30b0f9[_0x47a5('0x4e')]);return db['SmsInteraction'][_0x47a5('0x4f')]({'where':_0x5973d4[_0x47a5('0x49')]})['then'](function(_0x59ba59){_0x56808d['count']=_0x59ba59;if(_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x5973d4[_0x47a5('0x51')]=[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0xb1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x47a5('0x35'),_0x47a5('0xb2'),_0x47a5('0xb3')],'required':![]},{'model':db[_0x47a5('0xb4')],'as':'Tags','attributes':['id',_0x47a5('0x35'),_0x47a5('0xb5')],'where':_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0xb6')]?{'id':_0x30b0f9['query']['tag']}:undefined,'required':_0x30b0f9['query'][_0x47a5('0xb6')]?!![]:![]}];}return db[_0x47a5('0x95')][_0x47a5('0x52')](_0x5973d4);})[_0x47a5('0x21')](function(_0x242006){_0x56808d[_0x47a5('0x53')]=_0x242006;return _0x56808d;});}})[_0x47a5('0x21')](respondWithFilteredResult(_0x37721c,_0x5973d4))[_0x47a5('0x54')](handleError(_0x37721c,null));};exports[_0x47a5('0x36')]=function(_0x5b48d0,_0x40fe75,_0x7b5348){var _0x50b482,_0x34ff37,_0x2bbf95;if(_[_0x47a5('0x8c')](_0x5b48d0[_0x47a5('0x61')]['body'])||_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47a5('0x8c')](_0x5b48d0['body']['to'])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0xb7'));}_0x50b482=_0x5b48d0[_0x47a5('0x61')]['to'];return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x5b48d0[_0x47a5('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':{'mobile':_0x50b482},'limit':0x1,'order':[[_0x47a5('0x76'),_0x47a5('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x40fe75,null))['then'](function(_0x3222e4){if(_0x3222e4&&_0x3222e4['List']){_0x34ff37=_0x3222e4[_0x47a5('0x32')]({'plain':!![]});if(_0x34ff37['List']&&_0x34ff37[_0x47a5('0xb9')]['Contacts'][_0x47a5('0x59')]){return _0x34ff37[_0x47a5('0xb9')][_0x47a5('0x93')][0x0];}return db[_0x47a5('0x72')][_0x47a5('0x5b')](_[_0x47a5('0x16')](_0x5b48d0[_0x47a5('0x61')],{'firstName':_0x50b482,'mobile':_0x50b482,'phone':_0x50b482,'ListId':_0x34ff37[_0x47a5('0x77')]}));}})['then'](handleEntityNotFound(_0x40fe75,null))[_0x47a5('0x21')](function(_0x4394f0){if(_0x4394f0){_0x2bbf95=_0x4394f0;return db['SmsInteraction'][_0x47a5('0x5a')]({'where':{'ContactId':_0x2bbf95['id'],'closed':![],'SmsAccountId':_0x34ff37['id']}})[_0x47a5('0x21')](function(_0x54f283){if(_0x54f283){return[_0x54f283,![]];}return db['SmsInteraction'][_0x47a5('0x5b')]({'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id'],'SmsAccountId':_0x34ff37['id'],'phone':_0x50b482,'firstMsgDirection':_0x47a5('0xba'),'Messages':[_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0['body'][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'UserId':_0x5b48d0[_0x47a5('0x5c')]['id'],'ContactId':_0x2bbf95['id']})]},{'include':[{'model':db[_0x47a5('0x9a')],'as':_0x47a5('0xbb')}]})[_0x47a5('0x21')](function(_0x454609){return[_0x454609,!![]];});});}})[_0x47a5('0xbc')](function(_0x5c4301,_0x2bc0d8){if(_0x2bc0d8){return _0x5c4301;}return db[_0x47a5('0x9a')][_0x47a5('0x5b')](_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'SmsInteractionId':_0x5c4301['id'],'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id']}))['then'](function(_0x11d87b){_0x5c4301[_0x47a5('0xbd')][_0x47a5('0xbb')]=[];_0x5c4301['dataValues']['Messages'][_0x47a5('0xbe')](_0x11d87b[_0x47a5('0xbd')]);return _0x5c4301;});})[_0x47a5('0x21')](respondWithResult(_0x40fe75,null))[_0x47a5('0x54')](handleError(_0x40fe75,null));};exports[_0x47a5('0x2a')]=function(_0x4121c1,_0x2e0add,_0x58e85b){if(_0x4121c1[_0x47a5('0x61')]['id']){delete _0x4121c1[_0x47a5('0x61')]['id'];}console[_0x47a5('0xbf')]('endpoint\x20/status\x20POST\x20/',_0x4121c1[_0x47a5('0x61')]);var _0x611b40,_0x144bc9,_0x278b42;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x4121c1[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x9ced85){if(_0x9ced85){_0x278b42=_0x9ced85;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),'received\x20delivery\x20report\x20from',_0x9ced85[_0x47a5('0x3b')],util['inspect'](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));switch(_0x9ced85['type']){case _0x47a5('0x7b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc0')]&&_0x4121c1['body'][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1['body'][_0x47a5('0x2a')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['skebby_dispatch_id']}});}break;case _0x47a5('0x7d'):if(_0x4121c1['body']['requestid']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc2')]}});}break;case _0x47a5('0xc3'):if(_0x4121c1['body']['message_id']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')];return db[_0x47a5('0x9a')]['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0x7e')]}});}break;case _0x47a5('0x82'):var _0x50ff41=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x50ff41[_0x47a5('0x7a')]&&_0x50ff41['status'][_0x47a5('0xc5')]===_0x47a5('0xc6')){_0x144bc9=_0x50ff41[_0x47a5('0x2a')]['groupName'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x50ff41[_0x47a5('0x7a')]}});}break;case _0x47a5('0x87'):if(_0x4121c1[_0x47a5('0x61')]['messageId']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['messageId']}});}break;case _0x47a5('0x8b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc7')]&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')]['status'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x4ebe30){if(_0x4ebe30){_0x611b40=_0x4ebe30;switch(_0x278b42[_0x47a5('0x3b')]){case _0x47a5('0x7b'):if(_0x144bc9===_0x47a5('0xc6')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x7d'):if(_0x144bc9==='1'){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc9')]&&_0x144bc9>=0xc8&&_0x144bc9<=0xce){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xc3'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x82'):var _0x2cc493=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x2cc493[_0x47a5('0x2a')][_0x47a5('0xc5')]===_0x47a5('0xc6')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),'infobip',util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x144bc9==_0x47a5('0xca')||_0x144bc9==_0x47a5('0xcb')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),'status',_0x47a5('0x87'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x8b'):if(_0x144bc9===_0x47a5('0xcc')||_0x144bc9===_0x47a5('0xcd')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x8b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x611b40;}})[_0x47a5('0x21')](respondWithResult(_0x2e0add,null))[_0x47a5('0x54')](handleError(_0x2e0add,null));};exports[_0x47a5('0xce')]=function(_0x138b92,_0x232c36,_0x25954e){var _0x277061,_0x3917e0,_0x1c7695;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x138b92[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x46b82a){if(_0x46b82a){_0x1c7695=_0x46b82a;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xcf'),_0x46b82a[_0x47a5('0x3b')],util[_0x47a5('0xc8')](_0x138b92['query'],{'showHidden':![],'depth':null}));switch(_0x46b82a[_0x47a5('0x3b')]){case'csc':if(_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]&&_0x138b92['query'][_0x47a5('0xd1')]){_0x3917e0=_0x138b92['query'][_0x47a5('0xd1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x9a2f87){if(_0x9a2f87){_0x277061=_0x9a2f87;switch(_0x1c7695[_0x47a5('0x3b')]){case'csc':if(_0x3917e0==='2'||_0x3917e0==='6'){return _0x277061['update']({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),'csc',util[_0x47a5('0xc8')](_0x138b92[_0x47a5('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x277061;}})[_0x47a5('0x21')](respondWithResult(_0x232c36,null))['catch'](handleError(_0x232c36,null));};exports[_0x47a5('0xd2')]=function(_0x3136f9,_0x3ecc43,_0xf4b1df){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x3136f9['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x3ecc43,null))[_0x47a5('0x21')](function(_0xdc5eac){if(_0xdc5eac){return _0xdc5eac[_0x47a5('0xd2')](_0x3136f9['body'][_0x47a5('0x68')],_[_0x47a5('0xd3')](_0x3136f9[_0x47a5('0x61')],[_0x47a5('0x68'),'id'])||{})[_0x47a5('0xbc')](function(_0x4c2b0c){for(var _0xbe3a38=0x0;_0xbe3a38<_0x3136f9[_0x47a5('0x61')][_0x47a5('0x68')][_0x47a5('0x59')];_0xbe3a38+=0x1){socket[_0x47a5('0xd4')](_0x47a5('0xd5'),{'UserId':_0x3136f9['body'][_0x47a5('0x68')][_0xbe3a38],'SmsAccountId':_0x3136f9[_0x47a5('0x56')]['id']});}return _0x4c2b0c;});}})['then'](respondWithResult(_0x3ecc43,null))['catch'](handleError(_0x3ecc43,null));};exports[_0x47a5('0xd6')]=function(_0x32d299,_0x20d99b,_0x3964f8){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x32d299['params']['id']}})['then'](handleEntityNotFound(_0x20d99b,null))[_0x47a5('0x21')](function(_0xa3a516){if(_0xa3a516){return _0xa3a516['removeAgents'](_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')])['then'](function(){if(_[_0x47a5('0xd7')](_0x32d299['query']['ids'])){for(var _0x4aeaff=0x0;_0x4aeaff<_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')][_0x47a5('0x59')];_0x4aeaff+=0x1){socket['emit'](_0x47a5('0xd8'),{'UserId':Number(_0x32d299['query'][_0x47a5('0x68')][_0x4aeaff]),'SmsAccountId':Number(_0x32d299['params']['id'])});}}else{socket[_0x47a5('0xd4')](_0x47a5('0xd8'),{'UserId':Number(_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')]),'SmsAccountId':Number(_0x32d299[_0x47a5('0x56')]['id'])});}});}})[_0x47a5('0x21')](respondWithStatusCode(_0x20d99b,null))[_0x47a5('0x54')](handleError(_0x20d99b,null));};exports[_0x47a5('0xd9')]=function(_0x1396c2,_0x5c9091,_0x4f1e24){var _0x24c88e={};var _0xa859a={};var _0x5270cc;var _0x2a0f45;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1396c2[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x5c9091,null))[_0x47a5('0x21')](function(_0x969d4b){if(_0x969d4b){_0x5270cc=_0x969d4b;_0xa859a[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x9d')]['rawAttributes']);_0xa859a['query']=_['keys'](_0x1396c2['query']);_0xa859a[_0x47a5('0x41')]=_['intersection'](_0xa859a[_0x47a5('0x3d')],_0xa859a[_0x47a5('0x3f')]);_0x24c88e['attributes']=_[_0x47a5('0x42')](_0xa859a[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x24c88e[_0x47a5('0x43')]=_0x24c88e['attributes'][_0x47a5('0x59')]?_0x24c88e[_0x47a5('0x43')]:_0xa859a['model'];_0x24c88e[_0x47a5('0x47')]=qs['sort'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x24c88e[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x1396c2[_0x47a5('0x3f')],_0xa859a[_0x47a5('0x41')]));if(_0x1396c2['query'][_0x47a5('0x4b')]){_0x24c88e[_0x47a5('0x49')]=_['merge'](_0x24c88e[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x24c88e['attributes'],function(_0x14c968){var _0x5a7920={};_0x5a7920[_0x14c968]={'$like':'%'+_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x5a7920;})});}_0x24c88e=_[_0x47a5('0x4c')]({},_0x24c88e,_0x1396c2[_0x47a5('0x4e')]);return _0x5270cc[_0x47a5('0xd9')](_0x24c88e);}})['then'](function(_0x4b8b65){if(_0x4b8b65){_0x2a0f45=_0x4b8b65[_0x47a5('0x59')];if(!_0x1396c2['query']['hasOwnProperty']('nolimit')){_0x24c88e[_0x47a5('0x2e')]=qs['limit'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x24c88e[_0x47a5('0x2d')]=qs['offset'](_0x1396c2['query'][_0x47a5('0x2d')]);}return _0x5270cc['getAgents'](_0x24c88e);}})['then'](function(_0xe87e6e){if(_0xe87e6e){return _0xe87e6e?{'count':_0x2a0f45,'rows':_0xe87e6e}:null;}})['then'](respondWithResult(_0x5c9091,null))['catch'](handleError(_0x5c9091,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 59db04b..ebb0153 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 _0x1912=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x1f3826,_0x57bc83){var _0x46634a=function(_0xbccda1){while(--_0xbccda1){_0x1f3826['push'](_0x1f3826['shift']());}};_0x46634a(++_0x57bc83);}(_0x1912,0x95));var _0x2191=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1912[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x2191('0x0'));var SmsAccount=require(_0x2191('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x2191('0x2')](0x0);var events={'afterCreate':_0x2191('0x3'),'afterUpdate':_0x2191('0x4'),'afterDestroy':_0x2191('0x5')};function emitEvent(_0x240aac){return function(_0x5de091,_0x1e0b9d,_0x133e95){SmsAccountEvents[_0x2191('0x6')](_0x240aac+':'+_0x5de091['id'],_0x5de091);SmsAccountEvents[_0x2191('0x6')](_0x240aac,_0x5de091);_0x133e95(null);};}for(var e in events){if(events[_0x2191('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x2191('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xc277=['update','remove','hasOwnProperty','hook','exports','events','save'];(function(_0x4b8567,_0x5c32f3){var _0x4e168e=function(_0x46a709){while(--_0x46a709){_0x4b8567['push'](_0x4b8567['shift']());}};_0x4e168e(++_0x5c32f3);}(_0xc277,0xd7));var _0x7c27=function(_0x95eeaa,_0x315257){_0x95eeaa=_0x95eeaa-0x0;var _0x529108=_0xc277[_0x95eeaa];return _0x529108;};'use strict';var EventEmitter=require(_0x7c27('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7c27('0x1'),'afterUpdate':_0x7c27('0x2'),'afterDestroy':_0x7c27('0x3')};function emitEvent(_0x4f76a9){return function(_0x12a149,_0x4bd32d,_0x370d83){SmsAccountEvents['emit'](_0x4f76a9+':'+_0x12a149['id'],_0x12a149);SmsAccountEvents['emit'](_0x4f76a9,_0x12a149);_0x370d83(null);};}for(var e in events){if(events[_0x7c27('0x4')](e)){var event=events[e];SmsAccount[_0x7c27('0x5')](e,emitEvent(event));}}module[_0x7c27('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 4e882f9..7a3cde8 100644 --- a/server/api/smsAccount/smsAccount.model.js +++ b/server/api/smsAccount/smsAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x6c67e,_0x195d4a){var _0x101076=function(_0x2e9c47){while(--_0x2e9c47){_0x6c67e['push'](_0x6c67e['shift']());}};_0x101076(++_0x195d4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x38493e,_0x3f4a61){var _0x4fcdbb=function(_0x2a9808){while(--_0x2a9808){_0x38493e['push'](_0x38493e['shift']());}};_0x4fcdbb(++_0x3f4a61);}(_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 logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 1e06827..1c204d7 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 _0xc576=['request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','find','options','raw','where','attributes','include','map','model','ShowSmsAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','then','info'];(function(_0x367a3d,_0x452717){var _0x460539=function(_0x1e8beb){while(--_0x1e8beb){_0x367a3d['push'](_0x367a3d['shift']());}};_0x460539(++_0x452717);}(_0xc576,0x1e7));var _0x6c57=function(_0x1e7ead,_0x7f6227){_0x1e7ead=_0x1e7ead-0x0;var _0x3912b2=_0xc576[_0x1e7ead];return _0x3912b2;};'use strict';var _=require(_0x6c57('0x0'));var util=require(_0x6c57('0x1'));var moment=require('moment');var BPromise=require(_0x6c57('0x2'));var rs=require(_0x6c57('0x3'));var fs=require('fs');var Redis=require(_0x6c57('0x4'));var db=require(_0x6c57('0x5'))['db'];var utils=require(_0x6c57('0x6'));var logger=require(_0x6c57('0x7'))(_0x6c57('0x8'));var config=require(_0x6c57('0x9'));var jayson=require(_0x6c57('0xa'));var client=jayson[_0x6c57('0xb')][_0x6c57('0xc')]({'port':0x232a});config[_0x6c57('0xd')]=_[_0x6c57('0xe')](config[_0x6c57('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x6c57('0xf'))(new Redis(config[_0x6c57('0xd')]));require(_0x6c57('0x10'))[_0x6c57('0x11')](socket);function respondWithRpcPromise(_0x1a82a2,_0x275e41,_0x28cd17){return new BPromise(function(_0x22f79b,_0x2dc64f){return client['request'](_0x1a82a2,_0x28cd17)[_0x6c57('0x12')](function(_0x27078c){logger[_0x6c57('0x13')]('SmsAccount,\x20%s,\x20%s',_0x275e41,_0x6c57('0x14'));logger[_0x6c57('0x15')](_0x6c57('0x16'),_0x275e41,'request\x20sent',JSON[_0x6c57('0x17')](_0x27078c));if(_0x27078c[_0x6c57('0x18')]){if(_0x27078c['error'][_0x6c57('0x19')]===0x1f4){logger[_0x6c57('0x18')](_0x6c57('0x1a'),_0x275e41,_0x27078c[_0x6c57('0x18')][_0x6c57('0x1b')]);return _0x2dc64f(_0x27078c['error'][_0x6c57('0x1b')]);}logger['error'](_0x6c57('0x1a'),_0x275e41,_0x27078c[_0x6c57('0x18')][_0x6c57('0x1b')]);return _0x22f79b(_0x27078c[_0x6c57('0x18')]['message']);}else{logger[_0x6c57('0x13')]('SmsAccount,\x20%s,\x20%s',_0x275e41,'request\x20sent');_0x22f79b(_0x27078c[_0x6c57('0x1c')]['message']);}})[_0x6c57('0x1d')](function(_0x492a1f){logger[_0x6c57('0x18')](_0x6c57('0x1a'),_0x275e41,_0x492a1f);_0x2dc64f(_0x492a1f);});});}exports['ShowSmsAccount']=function(_0x5d8440){var _0x8c3748=this;return new Promise(function(_0x33ae3b,_0xe92d5){return db['SmsAccount'][_0x6c57('0x1e')]({'raw':_0x5d8440[_0x6c57('0x1f')]?_0x5d8440[_0x6c57('0x1f')][_0x6c57('0x20')]===undefined?!![]:![]:!![],'where':_0x5d8440[_0x6c57('0x1f')]?_0x5d8440[_0x6c57('0x1f')][_0x6c57('0x21')]||null:null,'attributes':_0x5d8440[_0x6c57('0x1f')]?_0x5d8440[_0x6c57('0x1f')][_0x6c57('0x22')]||null:null,'include':_0x5d8440['options']?_0x5d8440[_0x6c57('0x1f')][_0x6c57('0x23')]?_[_0x6c57('0x24')](_0x5d8440[_0x6c57('0x1f')][_0x6c57('0x23')],function(_0x23e336){return{'model':db[_0x23e336[_0x6c57('0x25')]],'as':_0x23e336['as'],'attributes':_0x23e336[_0x6c57('0x22')],'include':_0x23e336[_0x6c57('0x23')]?_[_0x6c57('0x24')](_0x23e336[_0x6c57('0x23')],function(_0x4373ed){return{'model':db[_0x4373ed['model']],'as':_0x4373ed['as'],'attributes':_0x4373ed[_0x6c57('0x22')],'include':_0x4373ed['include']?_['map'](_0x4373ed[_0x6c57('0x23')],function(_0x32499b){return{'model':db[_0x32499b[_0x6c57('0x25')]],'as':_0x32499b['as'],'attributes':_0x32499b[_0x6c57('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36085c){logger[_0x6c57('0x13')]('ShowSmsAccount',_0x5d8440);logger['debug']('ShowSmsAccount',_0x5d8440,JSON[_0x6c57('0x17')](_0x36085c));_0x33ae3b(_0x36085c);})['catch'](function(_0x28d291){logger['error'](_0x6c57('0x26'),_0x28d291[_0x6c57('0x1b')],_0x5d8440);_0xe92d5(_0x8c3748[_0x6c57('0x18')](0x1f4,_0x28d291[_0x6c57('0x1b')]));});});}; \ No newline at end of file +var _0xa249=['http','redis','./smsAccount.socket','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','find','options','raw','where','attributes','include','map','model','then','ShowSmsAccount','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0xa249,0x130));var _0x9a24=function(_0xabc97,_0x47be61){_0xabc97=_0xabc97-0x0;var _0x3c0b97=_0xa249[_0xabc97];return _0x3c0b97;};'use strict';var _=require(_0x9a24('0x0'));var util=require(_0x9a24('0x1'));var moment=require(_0x9a24('0x2'));var BPromise=require(_0x9a24('0x3'));var rs=require(_0x9a24('0x4'));var fs=require('fs');var Redis=require(_0x9a24('0x5'));var db=require(_0x9a24('0x6'))['db'];var utils=require(_0x9a24('0x7'));var logger=require(_0x9a24('0x8'))(_0x9a24('0x9'));var config=require(_0x9a24('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9a24('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9a24('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9a24('0xd'))['register'](socket);function respondWithRpcPromise(_0xa76744,_0x11fa0b,_0x2da87f){return new BPromise(function(_0xdfbb33,_0x2656c7){return client[_0x9a24('0xe')](_0xa76744,_0x2da87f)['then'](function(_0x41ec72){logger['info'](_0x9a24('0xf'),_0x11fa0b,_0x9a24('0x10'));logger[_0x9a24('0x11')](_0x9a24('0x12'),_0x11fa0b,_0x9a24('0x10'),JSON['stringify'](_0x41ec72));if(_0x41ec72[_0x9a24('0x13')]){if(_0x41ec72['error'][_0x9a24('0x14')]===0x1f4){logger[_0x9a24('0x13')](_0x9a24('0xf'),_0x11fa0b,_0x41ec72['error']['message']);return _0x2656c7(_0x41ec72[_0x9a24('0x13')][_0x9a24('0x15')]);}logger[_0x9a24('0x13')](_0x9a24('0xf'),_0x11fa0b,_0x41ec72[_0x9a24('0x13')][_0x9a24('0x15')]);return _0xdfbb33(_0x41ec72[_0x9a24('0x13')][_0x9a24('0x15')]);}else{logger[_0x9a24('0x16')](_0x9a24('0xf'),_0x11fa0b,_0x9a24('0x10'));_0xdfbb33(_0x41ec72['result'][_0x9a24('0x15')]);}})[_0x9a24('0x17')](function(_0x33ef3a){logger[_0x9a24('0x13')](_0x9a24('0xf'),_0x11fa0b,_0x33ef3a);_0x2656c7(_0x33ef3a);});});}exports['ShowSmsAccount']=function(_0x333c75){var _0x5e6f03=this;return new Promise(function(_0x890979,_0x30e490){return db['SmsAccount'][_0x9a24('0x18')]({'raw':_0x333c75[_0x9a24('0x19')]?_0x333c75[_0x9a24('0x19')][_0x9a24('0x1a')]===undefined?!![]:![]:!![],'where':_0x333c75[_0x9a24('0x19')]?_0x333c75[_0x9a24('0x19')][_0x9a24('0x1b')]||null:null,'attributes':_0x333c75[_0x9a24('0x19')]?_0x333c75[_0x9a24('0x19')][_0x9a24('0x1c')]||null:null,'include':_0x333c75['options']?_0x333c75[_0x9a24('0x19')][_0x9a24('0x1d')]?_[_0x9a24('0x1e')](_0x333c75['options'][_0x9a24('0x1d')],function(_0x3d4ed1){return{'model':db[_0x3d4ed1[_0x9a24('0x1f')]],'as':_0x3d4ed1['as'],'attributes':_0x3d4ed1[_0x9a24('0x1c')],'include':_0x3d4ed1[_0x9a24('0x1d')]?_[_0x9a24('0x1e')](_0x3d4ed1[_0x9a24('0x1d')],function(_0x356b4b){return{'model':db[_0x356b4b[_0x9a24('0x1f')]],'as':_0x356b4b['as'],'attributes':_0x356b4b[_0x9a24('0x1c')],'include':_0x356b4b[_0x9a24('0x1d')]?_[_0x9a24('0x1e')](_0x356b4b['include'],function(_0x1d0013){return{'model':db[_0x1d0013[_0x9a24('0x1f')]],'as':_0x1d0013['as'],'attributes':_0x1d0013[_0x9a24('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9a24('0x20')](function(_0x325c15){logger[_0x9a24('0x16')]('ShowSmsAccount',_0x333c75);logger[_0x9a24('0x11')](_0x9a24('0x21'),_0x333c75,JSON[_0x9a24('0x22')](_0x325c15));_0x890979(_0x325c15);})[_0x9a24('0x17')](function(_0x545844){logger['error'](_0x9a24('0x21'),_0x545844[_0x9a24('0x15')],_0x333c75);_0x30e490(_0x5e6f03[_0x9a24('0x13')](0x1f4,_0x545844[_0x9a24('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 151102f..c401e56 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 _0xd126=['length','smsAccount:','update','emit','register'];(function(_0x2a0398,_0x440f64){var _0x4ab51a=function(_0x5824a5){while(--_0x5824a5){_0x2a0398['push'](_0x2a0398['shift']());}};_0x4ab51a(++_0x440f64);}(_0xd126,0x6b));var _0x6d12=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xd126[_0x7e2eb0];return _0xd92de4;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=['save','remove',_0x6d12('0x0')];function createListener(_0x3d72f3,_0x19f90c){return function(_0x2f67dd){_0x19f90c[_0x6d12('0x1')](_0x3d72f3,_0x2f67dd);};}function removeListener(_0x2d4710,_0x141057){return function(){SmsAccountEvents['removeListener'](_0x2d4710,_0x141057);};}exports[_0x6d12('0x2')]=function(_0x1d571b){for(var _0x407313=0x0,_0x345ede=events[_0x6d12('0x3')];_0x407313<_0x345ede;_0x407313++){var _0x4af87d=events[_0x407313];var _0x5ecda9=createListener(_0x6d12('0x4')+_0x4af87d,_0x1d571b);SmsAccountEvents['on'](_0x4af87d,_0x5ecda9);}}; \ No newline at end of file +var _0x5f00=['./smsAccount.events','remove','emit','register'];(function(_0x500f80,_0x422d7e){var _0x731b33=function(_0x4b821a){while(--_0x4b821a){_0x500f80['push'](_0x500f80['shift']());}};_0x731b33(++_0x422d7e);}(_0x5f00,0x170));var _0x05f0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f00[_0x3dd15e];return _0x231fd0;};'use strict';var SmsAccountEvents=require(_0x05f0('0x0'));var events=['save',_0x05f0('0x1'),'update'];function createListener(_0x294efa,_0x5872eb){return function(_0x43ab86){_0x5872eb[_0x05f0('0x2')](_0x294efa,_0x43ab86);};}function removeListener(_0x3afbeb,_0x26965b){return function(){SmsAccountEvents['removeListener'](_0x3afbeb,_0x26965b);};}exports[_0x05f0('0x3')]=function(_0x4b1e9e){for(var _0x4330b9=0x0,_0xaf4fb4=events['length'];_0x4330b9<_0xaf4fb4;_0x4330b9++){var _0x599056=events[_0x4330b9];var _0x237db9=createListener('smsAccount:'+_0x599056,_0x4b1e9e);SmsAccountEvents['on'](_0x599056,_0x237db9);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index f36273c..48d439a 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 _0xd62b=['create','put','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','/:id','post'];(function(_0x1eafba,_0xf156ae){var _0x10264e=function(_0x1e55b2){while(--_0x1e55b2){_0x1eafba['push'](_0x1eafba['shift']());}};_0x10264e(++_0xf156ae);}(_0xd62b,0xc7));var _0xbd62=function(_0x90f34f,_0x404021){_0x90f34f=_0x90f34f-0x0;var _0x4b18cf=_0xd62b[_0x90f34f];return _0x4b18cf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbd62('0x0'));var timeout=require(_0xbd62('0x1'));var express=require(_0xbd62('0x2'));var router=express[_0xbd62('0x3')]();var auth=require(_0xbd62('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbd62('0x5'));var controller=require(_0xbd62('0x6'));router[_0xbd62('0x7')]('/',auth[_0xbd62('0x8')](),controller['index']);router['get'](_0xbd62('0x9'),auth[_0xbd62('0x8')](),controller['show']);router[_0xbd62('0xa')]('/',auth[_0xbd62('0x8')](),controller[_0xbd62('0xb')]);router[_0xbd62('0xc')]('/:id',auth[_0xbd62('0x8')](),controller['update']);router[_0xbd62('0xd')]('/:id',auth[_0xbd62('0x8')](),controller[_0xbd62('0xe')]);module['exports']=router; \ No newline at end of file +var _0x0e1a=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','create','put','/:id','update','delete','exports'];(function(_0x5adee8,_0x2dea9d){var _0x4a90f1=function(_0x567afd){while(--_0x567afd){_0x5adee8['push'](_0x5adee8['shift']());}};_0x4a90f1(++_0x2dea9d);}(_0x0e1a,0x121));var _0xa0e1=function(_0x3eabb9,_0x59f0fd){_0x3eabb9=_0x3eabb9-0x0;var _0x1cce0b=_0x0e1a[_0x3eabb9];return _0x1cce0b;};'use strict';var multer=require(_0xa0e1('0x0'));var util=require('util');var path=require(_0xa0e1('0x1'));var timeout=require(_0xa0e1('0x2'));var express=require(_0xa0e1('0x3'));var router=express[_0xa0e1('0x4')]();var auth=require(_0xa0e1('0x5'));var interaction=require(_0xa0e1('0x6'));var config=require(_0xa0e1('0x7'));var controller=require('./smsApplication.controller');router[_0xa0e1('0x8')]('/',auth[_0xa0e1('0x9')](),controller['index']);router[_0xa0e1('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa0e1('0xa')]('/',auth[_0xa0e1('0x9')](),controller[_0xa0e1('0xb')]);router[_0xa0e1('0xc')](_0xa0e1('0xd'),auth[_0xa0e1('0x9')](),controller[_0xa0e1('0xe')]);router[_0xa0e1('0xf')]('/:id',auth[_0xa0e1('0x9')](),controller['destroy']);module[_0xa0e1('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 10a0228..1fc2f87 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 _0xd762=['*,*,*,*','sequelize','INTEGER','TEXT','STRING'];(function(_0xa6df52,_0x1b8584){var _0x5edd57=function(_0x543f11){while(--_0x543f11){_0xa6df52['push'](_0xa6df52['shift']());}};_0x5edd57(++_0x1b8584);}(_0xd762,0xb0));var _0x2d76=function(_0x21dc33,_0x2472be){_0x21dc33=_0x21dc33-0x0;var _0x5c765e=_0xd762[_0x21dc33];return _0x5c765e;};'use strict';var Sequelize=require(_0x2d76('0x0'));module['exports']={'priority':{'type':Sequelize[_0x2d76('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2d76('0x2')]()},'description':{'type':Sequelize[_0x2d76('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2d76('0x4')}}; \ No newline at end of file +var _0x268c=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x25f33c,_0x657c75){var _0x5cc13f=function(_0x2b4a1a){while(--_0x2b4a1a){_0x25f33c['push'](_0x25f33c['shift']());}};_0x5cc13f(++_0x657c75);}(_0x268c,0x103));var _0xc268=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0x268c[_0x2077c2];return _0x312f9f;};'use strict';var Sequelize=require(_0xc268('0x0'));module[_0xc268('0x1')]={'priority':{'type':Sequelize[_0xc268('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc268('0x3')],'allowNull':![],'defaultValue':_0xc268('0x4')},'appdata':{'type':Sequelize[_0xc268('0x5')]()},'description':{'type':Sequelize[_0xc268('0x3')]},'interval':{'type':Sequelize[_0xc268('0x3')],'defaultValue':_0xc268('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 6fdda2d..74391e4 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 _0xb03e=['status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','index','SmsApplication','rawAttributes','type','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','map','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','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/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x585a0f,_0x172cb8){var _0x2d8065=function(_0x3d330f){while(--_0x3d330f){_0x585a0f['push'](_0x585a0f['shift']());}};_0x2d8065(++_0x172cb8);}(_0xb03e,0x1eb));var _0xeb03=function(_0x4ceb82,_0x23969c){_0x4ceb82=_0x4ceb82-0x0;var _0x3e99cd=_0xb03e[_0x4ceb82];return _0x3e99cd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeb03('0x0'));var rimraf=require(_0xeb03('0x1'));var zipdir=require(_0xeb03('0x2'));var jsonpatch=require(_0xeb03('0x3'));var rp=require(_0xeb03('0x4'));var moment=require(_0xeb03('0x5'));var BPromise=require(_0xeb03('0x6'));var Mustache=require(_0xeb03('0x7'));var util=require(_0xeb03('0x8'));var path=require(_0xeb03('0x9'));var sox=require(_0xeb03('0xa'));var csv=require(_0xeb03('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeb03('0xc'));var squel=require(_0xeb03('0xd'));var crypto=require(_0xeb03('0xe'));var jsforce=require(_0xeb03('0xf'));var deskjs=require(_0xeb03('0x10'));var toCsv=require(_0xeb03('0xb'));var querystring=require('querystring');var Papa=require(_0xeb03('0x11'));var Redis=require(_0xeb03('0x12'));var authService=require(_0xeb03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb03('0x15'))(_0xeb03('0x16'));var utils=require(_0xeb03('0x17'));var config=require(_0xeb03('0x18'));var db=require(_0xeb03('0x19'))['db'];function respondWithStatusCode(_0x45481b,_0x367d36){_0x367d36=_0x367d36||0xcc;return function(_0x384cbe){if(_0x384cbe){return _0x45481b[_0xeb03('0x1a')](_0x367d36);}return _0x45481b[_0xeb03('0x1b')](_0x367d36)[_0xeb03('0x1c')]();};}function respondWithResult(_0x3bebc6,_0x4d9c8e){_0x4d9c8e=_0x4d9c8e||0xc8;return function(_0x212082){if(_0x212082){return _0x3bebc6[_0xeb03('0x1b')](_0x4d9c8e)[_0xeb03('0x1d')](_0x212082);}};}function respondWithFilteredResult(_0x33f9ba,_0x52be5b){return function(_0x15f4fe){if(_0x15f4fe){var _0x36f5d8=_0x15f4fe[_0xeb03('0x1e')],_0x3f26ef=_0x52be5b[_0xeb03('0x1f')],_0x478989=_0x52be5b[_0xeb03('0x1f')]+_0x52be5b[_0xeb03('0x20')],_0x7ce874;if(_0x478989>=_0x36f5d8){_0x478989=_0x36f5d8;_0x7ce874=0xc8;}else{_0x7ce874=0xce;}_0x33f9ba[_0xeb03('0x1b')](_0x7ce874);return _0x33f9ba[_0xeb03('0x21')](_0xeb03('0x22'),_0x3f26ef+'-'+_0x478989+'/'+_0x36f5d8)[_0xeb03('0x1d')](_0x15f4fe);}return null;};}function patchUpdates(_0x469d25){return function(_0x456fb3){try{jsonpatch[_0xeb03('0x23')](_0x456fb3,_0x469d25,!![]);}catch(_0x2443d9){return BPromise[_0xeb03('0x24')](_0x2443d9);}return _0x456fb3['save']();};}function saveUpdates(_0x1bea3f,_0x3855dd){return function(_0x413d3e){if(_0x413d3e){return _0x413d3e[_0xeb03('0x25')](_0x1bea3f)[_0xeb03('0x26')](function(_0x31e406){return _0x31e406;});}return null;};}function removeEntity(_0xb98dc1,_0x2c795b){return function(_0x3c3d09){if(_0x3c3d09){return _0x3c3d09['destroy']()[_0xeb03('0x26')](function(){_0xb98dc1[_0xeb03('0x1b')](0xcc)[_0xeb03('0x1c')]();});}};}function handleEntityNotFound(_0x300dc0,_0x2f99e6){return function(_0x5dcda3){if(!_0x5dcda3){_0x300dc0[_0xeb03('0x1a')](0x194);}return _0x5dcda3;};}function handleError(_0x406864,_0x16cd4){_0x16cd4=_0x16cd4||0x1f4;return function(_0x20efa8){logger[_0xeb03('0x27')](_0x20efa8[_0xeb03('0x28')]);if(_0x20efa8[_0xeb03('0x29')]){delete _0x20efa8[_0xeb03('0x29')];}_0x406864[_0xeb03('0x1b')](_0x16cd4)['send'](_0x20efa8);};}exports[_0xeb03('0x2a')]=function(_0x1b2c7b,_0x2683f9){var _0x1ada2e={},_0x4cdea6={},_0x581685={'count':0x0,'rows':[]};var _0x1064a5=_['map'](db[_0xeb03('0x2b')][_0xeb03('0x2c')],function(_0x160a37){return{'name':_0x160a37['fieldName'],'type':_0x160a37[_0xeb03('0x2d')]['key']};});_0x4cdea6['model']=_['map'](_0x1064a5,'name');_0x4cdea6[_0xeb03('0x2e')]=_[_0xeb03('0x2f')](_0x1b2c7b['query']);_0x4cdea6['filters']=_['intersection'](_0x4cdea6['model'],_0x4cdea6[_0xeb03('0x2e')]);_0x1ada2e[_0xeb03('0x30')]=_[_0xeb03('0x31')](_0x4cdea6[_0xeb03('0x32')],qs[_0xeb03('0x33')](_0x1b2c7b['query'][_0xeb03('0x33')]));_0x1ada2e['attributes']=_0x1ada2e[_0xeb03('0x30')][_0xeb03('0x34')]?_0x1ada2e[_0xeb03('0x30')]:_0x4cdea6[_0xeb03('0x32')];if(!_0x1b2c7b[_0xeb03('0x2e')][_0xeb03('0x35')](_0xeb03('0x36'))){_0x1ada2e[_0xeb03('0x20')]=qs['limit'](_0x1b2c7b[_0xeb03('0x2e')]['limit']);_0x1ada2e[_0xeb03('0x1f')]=qs[_0xeb03('0x1f')](_0x1b2c7b[_0xeb03('0x2e')][_0xeb03('0x1f')]);}_0x1ada2e[_0xeb03('0x37')]=qs[_0xeb03('0x38')](_0x1b2c7b['query'][_0xeb03('0x38')]);_0x1ada2e['where']=qs['filters'](_['pick'](_0x1b2c7b[_0xeb03('0x2e')],_0x4cdea6[_0xeb03('0x39')]),_0x1064a5);if(_0x1b2c7b[_0xeb03('0x2e')][_0xeb03('0x3a')]){_0x1ada2e[_0xeb03('0x3b')]=_['merge'](_0x1ada2e[_0xeb03('0x3b')],{'$or':_[_0xeb03('0x3c')](_0x1064a5,function(_0x1d3ca1){if(_0x1d3ca1['type']!=='VIRTUAL'){var _0xac05c4={};_0xac05c4[_0x1d3ca1[_0xeb03('0x29')]]={'$like':'%'+_0x1b2c7b[_0xeb03('0x2e')]['filter']+'%'};return _0xac05c4;}})});}_0x1ada2e=_[_0xeb03('0x3d')]({},_0x1ada2e,_0x1b2c7b[_0xeb03('0x3e')]);var _0x57b2ab={'where':_0x1ada2e['where']};return db[_0xeb03('0x2b')][_0xeb03('0x1e')](_0x57b2ab)['then'](function(_0x39ebe8){_0x581685[_0xeb03('0x1e')]=_0x39ebe8;if(_0x1b2c7b[_0xeb03('0x2e')][_0xeb03('0x3f')]){_0x1ada2e[_0xeb03('0x40')]=[{'all':!![]}];}return db[_0xeb03('0x2b')][_0xeb03('0x41')](_0x1ada2e);})[_0xeb03('0x26')](function(_0x20ebe8){_0x581685[_0xeb03('0x42')]=_0x20ebe8;return _0x581685;})[_0xeb03('0x26')](respondWithFilteredResult(_0x2683f9,_0x1ada2e))[_0xeb03('0x43')](handleError(_0x2683f9,null));};exports[_0xeb03('0x44')]=function(_0x33414d,_0x28b831){var _0x6b95dd={'raw':!![],'where':{'id':_0x33414d[_0xeb03('0x45')]['id']}},_0x407f0b={};_0x407f0b[_0xeb03('0x32')]=_[_0xeb03('0x2f')](db[_0xeb03('0x2b')][_0xeb03('0x2c')]);_0x407f0b[_0xeb03('0x2e')]=_['keys'](_0x33414d['query']);_0x407f0b[_0xeb03('0x39')]=_[_0xeb03('0x31')](_0x407f0b[_0xeb03('0x32')],_0x407f0b[_0xeb03('0x2e')]);_0x6b95dd[_0xeb03('0x30')]=_[_0xeb03('0x31')](_0x407f0b[_0xeb03('0x32')],qs[_0xeb03('0x33')](_0x33414d['query'][_0xeb03('0x33')]));_0x6b95dd[_0xeb03('0x30')]=_0x6b95dd[_0xeb03('0x30')][_0xeb03('0x34')]?_0x6b95dd[_0xeb03('0x30')]:_0x407f0b['model'];if(_0x33414d['query'][_0xeb03('0x3f')]){_0x6b95dd['include']=[{'all':!![]}];}_0x6b95dd=_['merge']({},_0x6b95dd,_0x33414d['options']);return db[_0xeb03('0x2b')][_0xeb03('0x46')](_0x6b95dd)[_0xeb03('0x26')](handleEntityNotFound(_0x28b831,null))[_0xeb03('0x26')](respondWithResult(_0x28b831,null))[_0xeb03('0x43')](handleError(_0x28b831,null));};exports[_0xeb03('0x47')]=function(_0x481271,_0x35279d){return db['SmsApplication']['create'](_0x481271[_0xeb03('0x48')],{})[_0xeb03('0x26')](respondWithResult(_0x35279d,0xc9))[_0xeb03('0x43')](handleError(_0x35279d,null));};exports['update']=function(_0x404191,_0x9c8073){if(_0x404191[_0xeb03('0x48')]['id']){delete _0x404191[_0xeb03('0x48')]['id'];}return db[_0xeb03('0x2b')]['find']({'where':{'id':_0x404191[_0xeb03('0x45')]['id']}})['then'](handleEntityNotFound(_0x9c8073,null))[_0xeb03('0x26')](saveUpdates(_0x404191[_0xeb03('0x48')],null))[_0xeb03('0x26')](respondWithResult(_0x9c8073,null))[_0xeb03('0x43')](handleError(_0x9c8073,null));};exports[_0xeb03('0x49')]=function(_0x46f4a7,_0x42e73f){return db[_0xeb03('0x2b')][_0xeb03('0x46')]({'where':{'id':_0x46f4a7[_0xeb03('0x45')]['id']}})[_0xeb03('0x26')](handleEntityNotFound(_0x42e73f,null))[_0xeb03('0x26')](removeEntity(_0x42e73f,null))[_0xeb03('0x43')](handleError(_0x42e73f,null));}; \ No newline at end of file +var _0x80ed=['moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','set','Content-Range','apply','save','update','destroy','then','end','sendStatus','error','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','rows','params','find','catch','body','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x166ee4,_0x20efa7){var _0x334b5c=function(_0x269d99){while(--_0x269d99){_0x166ee4['push'](_0x166ee4['shift']());}};_0x334b5c(++_0x20efa7);}(_0x80ed,0x11c));var _0xd80e=function(_0x239720,_0x41a165){_0x239720=_0x239720-0x0;var _0xa1a3be=_0x80ed[_0x239720];return _0xa1a3be;};'use strict';var pdf=require(_0xd80e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd80e('0x1'));var zipdir=require(_0xd80e('0x2'));var jsonpatch=require(_0xd80e('0x3'));var rp=require('request-promise');var moment=require(_0xd80e('0x4'));var BPromise=require(_0xd80e('0x5'));var Mustache=require(_0xd80e('0x6'));var util=require(_0xd80e('0x7'));var path=require('path');var sox=require(_0xd80e('0x8'));var csv=require(_0xd80e('0x9'));var ejs=require(_0xd80e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x9'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var db=require(_0xd80e('0x19'))['db'];function respondWithStatusCode(_0x1a9024,_0x118f53){_0x118f53=_0x118f53||0xcc;return function(_0x1d3fcf){if(_0x1d3fcf){return _0x1a9024['sendStatus'](_0x118f53);}return _0x1a9024['status'](_0x118f53)['end']();};}function respondWithResult(_0x57fefb,_0x145766){_0x145766=_0x145766||0xc8;return function(_0x3d233b){if(_0x3d233b){return _0x57fefb[_0xd80e('0x1a')](_0x145766)[_0xd80e('0x1b')](_0x3d233b);}};}function respondWithFilteredResult(_0x449c60,_0x58a17e){return function(_0x595683){if(_0x595683){var _0x2c8c61=_0x595683[_0xd80e('0x1c')],_0x3124e8=_0x58a17e[_0xd80e('0x1d')],_0x3b48ae=_0x58a17e[_0xd80e('0x1d')]+_0x58a17e['limit'],_0x40a4d5;if(_0x3b48ae>=_0x2c8c61){_0x3b48ae=_0x2c8c61;_0x40a4d5=0xc8;}else{_0x40a4d5=0xce;}_0x449c60[_0xd80e('0x1a')](_0x40a4d5);return _0x449c60[_0xd80e('0x1e')](_0xd80e('0x1f'),_0x3124e8+'-'+_0x3b48ae+'/'+_0x2c8c61)[_0xd80e('0x1b')](_0x595683);}return null;};}function patchUpdates(_0x593af6){return function(_0x39397a){try{jsonpatch[_0xd80e('0x20')](_0x39397a,_0x593af6,!![]);}catch(_0xecfe74){return BPromise['reject'](_0xecfe74);}return _0x39397a[_0xd80e('0x21')]();};}function saveUpdates(_0x2ef8a1,_0x2765ea){return function(_0x147134){if(_0x147134){return _0x147134[_0xd80e('0x22')](_0x2ef8a1)['then'](function(_0x4b6b8a){return _0x4b6b8a;});}return null;};}function removeEntity(_0x35a1bc,_0x3fa159){return function(_0x3b39bf){if(_0x3b39bf){return _0x3b39bf[_0xd80e('0x23')]()[_0xd80e('0x24')](function(){_0x35a1bc[_0xd80e('0x1a')](0xcc)[_0xd80e('0x25')]();});}};}function handleEntityNotFound(_0x5430b6,_0x1fbf8a){return function(_0x57d70){if(!_0x57d70){_0x5430b6[_0xd80e('0x26')](0x194);}return _0x57d70;};}function handleError(_0x5b0d6d,_0x635ce0){_0x635ce0=_0x635ce0||0x1f4;return function(_0x19c89c){logger[_0xd80e('0x27')](_0x19c89c['stack']);if(_0x19c89c['name']){delete _0x19c89c['name'];}_0x5b0d6d[_0xd80e('0x1a')](_0x635ce0)['send'](_0x19c89c);};}exports[_0xd80e('0x28')]=function(_0x1044cc,_0x4e8ed9){var _0x24bafb={},_0xe1c04a={},_0x30d6fc={'count':0x0,'rows':[]};var _0x46c05d=_['map'](db[_0xd80e('0x29')][_0xd80e('0x2a')],function(_0x845451){return{'name':_0x845451[_0xd80e('0x2b')],'type':_0x845451[_0xd80e('0x2c')][_0xd80e('0x2d')]};});_0xe1c04a[_0xd80e('0x2e')]=_[_0xd80e('0x2f')](_0x46c05d,'name');_0xe1c04a['query']=_[_0xd80e('0x30')](_0x1044cc[_0xd80e('0x31')]);_0xe1c04a[_0xd80e('0x32')]=_[_0xd80e('0x33')](_0xe1c04a[_0xd80e('0x2e')],_0xe1c04a[_0xd80e('0x31')]);_0x24bafb['attributes']=_['intersection'](_0xe1c04a[_0xd80e('0x2e')],qs[_0xd80e('0x34')](_0x1044cc[_0xd80e('0x31')][_0xd80e('0x34')]));_0x24bafb[_0xd80e('0x35')]=_0x24bafb[_0xd80e('0x35')][_0xd80e('0x36')]?_0x24bafb[_0xd80e('0x35')]:_0xe1c04a['model'];if(!_0x1044cc['query'][_0xd80e('0x37')](_0xd80e('0x38'))){_0x24bafb[_0xd80e('0x39')]=qs[_0xd80e('0x39')](_0x1044cc[_0xd80e('0x31')][_0xd80e('0x39')]);_0x24bafb[_0xd80e('0x1d')]=qs[_0xd80e('0x1d')](_0x1044cc[_0xd80e('0x31')][_0xd80e('0x1d')]);}_0x24bafb['order']=qs[_0xd80e('0x3a')](_0x1044cc['query'][_0xd80e('0x3a')]);_0x24bafb[_0xd80e('0x3b')]=qs[_0xd80e('0x32')](_[_0xd80e('0x3c')](_0x1044cc['query'],_0xe1c04a[_0xd80e('0x32')]),_0x46c05d);if(_0x1044cc['query'][_0xd80e('0x3d')]){_0x24bafb['where']=_[_0xd80e('0x3e')](_0x24bafb[_0xd80e('0x3b')],{'$or':_['map'](_0x46c05d,function(_0x2d78b2){if(_0x2d78b2[_0xd80e('0x2c')]!==_0xd80e('0x3f')){var _0x490768={};_0x490768[_0x2d78b2[_0xd80e('0x40')]]={'$like':'%'+_0x1044cc[_0xd80e('0x31')][_0xd80e('0x3d')]+'%'};return _0x490768;}})});}_0x24bafb=_[_0xd80e('0x3e')]({},_0x24bafb,_0x1044cc[_0xd80e('0x41')]);var _0x34b8e9={'where':_0x24bafb[_0xd80e('0x3b')]};return db[_0xd80e('0x29')][_0xd80e('0x1c')](_0x34b8e9)['then'](function(_0x51932d){_0x30d6fc['count']=_0x51932d;if(_0x1044cc[_0xd80e('0x31')][_0xd80e('0x42')]){_0x24bafb['include']=[{'all':!![]}];}return db[_0xd80e('0x29')]['findAll'](_0x24bafb);})[_0xd80e('0x24')](function(_0x5ade19){_0x30d6fc[_0xd80e('0x43')]=_0x5ade19;return _0x30d6fc;})[_0xd80e('0x24')](respondWithFilteredResult(_0x4e8ed9,_0x24bafb))['catch'](handleError(_0x4e8ed9,null));};exports['show']=function(_0x44a736,_0x5b8ec8){var _0x439673={'raw':!![],'where':{'id':_0x44a736[_0xd80e('0x44')]['id']}},_0x3e65a7={};_0x3e65a7[_0xd80e('0x2e')]=_[_0xd80e('0x30')](db[_0xd80e('0x29')][_0xd80e('0x2a')]);_0x3e65a7[_0xd80e('0x31')]=_[_0xd80e('0x30')](_0x44a736[_0xd80e('0x31')]);_0x3e65a7[_0xd80e('0x32')]=_[_0xd80e('0x33')](_0x3e65a7[_0xd80e('0x2e')],_0x3e65a7[_0xd80e('0x31')]);_0x439673['attributes']=_['intersection'](_0x3e65a7['model'],qs[_0xd80e('0x34')](_0x44a736['query'][_0xd80e('0x34')]));_0x439673[_0xd80e('0x35')]=_0x439673[_0xd80e('0x35')][_0xd80e('0x36')]?_0x439673[_0xd80e('0x35')]:_0x3e65a7[_0xd80e('0x2e')];if(_0x44a736['query']['includeAll']){_0x439673['include']=[{'all':!![]}];}_0x439673=_[_0xd80e('0x3e')]({},_0x439673,_0x44a736['options']);return db[_0xd80e('0x29')][_0xd80e('0x45')](_0x439673)[_0xd80e('0x24')](handleEntityNotFound(_0x5b8ec8,null))[_0xd80e('0x24')](respondWithResult(_0x5b8ec8,null))[_0xd80e('0x46')](handleError(_0x5b8ec8,null));};exports['create']=function(_0x98628c,_0x4353f2){return db[_0xd80e('0x29')]['create'](_0x98628c[_0xd80e('0x47')],{})[_0xd80e('0x24')](respondWithResult(_0x4353f2,0xc9))[_0xd80e('0x46')](handleError(_0x4353f2,null));};exports['update']=function(_0x8d5cb8,_0x29aaa0){if(_0x8d5cb8[_0xd80e('0x47')]['id']){delete _0x8d5cb8[_0xd80e('0x47')]['id'];}return db[_0xd80e('0x29')][_0xd80e('0x45')]({'where':{'id':_0x8d5cb8['params']['id']}})['then'](handleEntityNotFound(_0x29aaa0,null))[_0xd80e('0x24')](saveUpdates(_0x8d5cb8[_0xd80e('0x47')],null))[_0xd80e('0x24')](respondWithResult(_0x29aaa0,null))['catch'](handleError(_0x29aaa0,null));};exports['destroy']=function(_0x1762a8,_0xff0980){return db[_0xd80e('0x29')][_0xd80e('0x45')]({'where':{'id':_0x1762a8[_0xd80e('0x44')]['id']}})['then'](handleEntityNotFound(_0xff0980,null))[_0xd80e('0x24')](removeEntity(_0xff0980,null))['catch'](handleError(_0xff0980,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 5271710..91d5850 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 _0xb284=['api','moment','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb284,0x1d1));var _0x4b28=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb284[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4b28('0x0'));var util=require(_0x4b28('0x1'));var logger=require(_0x4b28('0x2'))(_0x4b28('0x3'));var moment=require(_0x4b28('0x4'));var BPromise=require('bluebird');var rp=require(_0x4b28('0x5'));var fs=require('fs');var path=require(_0x4b28('0x6'));var rimraf=require(_0x4b28('0x7'));var config=require(_0x4b28('0x8'));var attributes=require(_0x4b28('0x9'));module[_0x4b28('0xa')]=function(_0x4af04c,_0x1baa4f){return _0x4af04c['define']('SmsApplication',attributes,{'tableName':_0x4b28('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4b28('0xc')});}; \ No newline at end of file +var _0xfe1f=['sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','exports'];(function(_0x41bee3,_0x2315fb){var _0x2596ac=function(_0x82ba4c){while(--_0x82ba4c){_0x41bee3['push'](_0x41bee3['shift']());}};_0x2596ac(++_0x2315fb);}(_0xfe1f,0xc8));var _0xffe1=function(_0x10acb2,_0x3ca870){_0x10acb2=_0x10acb2-0x0;var _0x186379=_0xfe1f[_0x10acb2];return _0x186379;};'use strict';var _=require(_0xffe1('0x0'));var util=require(_0xffe1('0x1'));var logger=require(_0xffe1('0x2'))('api');var moment=require('moment');var BPromise=require(_0xffe1('0x3'));var rp=require(_0xffe1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xffe1('0x5'));var attributes=require('./smsApplication.attributes');module[_0xffe1('0x6')]=function(_0x996adf,_0x5058a9){return _0x996adf['define']('SmsApplication',attributes,{'tableName':_0xffe1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xffe1('0x8')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 54adc09..29427d4 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 _0xea44=['info','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x289801,_0x3773a8){var _0x6f2b04=function(_0x1e0d2a){while(--_0x1e0d2a){_0x289801['push'](_0x289801['shift']());}};_0x6f2b04(++_0x3773a8);}(_0xea44,0x1a5));var _0x4ea4=function(_0x55a113,_0x17e08d){_0x55a113=_0x55a113-0x0;var _0x4f7655=_0xea44[_0x55a113];return _0x4f7655;};'use strict';var _=require(_0x4ea4('0x0'));var util=require(_0x4ea4('0x1'));var moment=require(_0x4ea4('0x2'));var BPromise=require(_0x4ea4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ea4('0x4'));var db=require(_0x4ea4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ea4('0x6'))(_0x4ea4('0x7'));var config=require(_0x4ea4('0x8'));var jayson=require(_0x4ea4('0x9'));var client=jayson['client'][_0x4ea4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a1b5,_0xa0a6ce,_0x3ba1b6){return new BPromise(function(_0x13ecb6,_0xb91515){return client[_0x4ea4('0xb')](_0x35a1b5,_0x3ba1b6)[_0x4ea4('0xc')](function(_0x14d421){logger['info'](_0x4ea4('0xd'),_0xa0a6ce,'request\x20sent');logger['debug'](_0x4ea4('0xe'),_0xa0a6ce,'request\x20sent',JSON[_0x4ea4('0xf')](_0x14d421));if(_0x14d421[_0x4ea4('0x10')]){if(_0x14d421[_0x4ea4('0x10')][_0x4ea4('0x11')]===0x1f4){logger[_0x4ea4('0x10')](_0x4ea4('0xd'),_0xa0a6ce,_0x14d421[_0x4ea4('0x10')][_0x4ea4('0x12')]);return _0xb91515(_0x14d421[_0x4ea4('0x10')][_0x4ea4('0x12')]);}logger[_0x4ea4('0x10')](_0x4ea4('0xd'),_0xa0a6ce,_0x14d421[_0x4ea4('0x10')][_0x4ea4('0x12')]);return _0x13ecb6(_0x14d421['error'][_0x4ea4('0x12')]);}else{logger[_0x4ea4('0x13')](_0x4ea4('0xd'),_0xa0a6ce,_0x4ea4('0x14'));_0x13ecb6(_0x14d421[_0x4ea4('0x15')][_0x4ea4('0x12')]);}})['catch'](function(_0x65199c){logger['error']('SmsApplication,\x20%s,\x20%s',_0xa0a6ce,_0x65199c);_0xb91515(_0x65199c);});});} \ No newline at end of file +var _0x1c9a=['code','SmsApplication,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error'];(function(_0xc80b23,_0x125dce){var _0x437d2d=function(_0x4a7c56){while(--_0x4a7c56){_0xc80b23['push'](_0xc80b23['shift']());}};_0x437d2d(++_0x125dce);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x548b50,_0x9d1112){_0x548b50=_0x548b50-0x0;var _0x47ffd0=_0x1c9a[_0x548b50];return _0x47ffd0;};'use strict';var _=require(_0xa1c9('0x0'));var util=require(_0xa1c9('0x1'));var moment=require('moment');var BPromise=require(_0xa1c9('0x2'));var rs=require(_0xa1c9('0x3'));var fs=require('fs');var Redis=require(_0xa1c9('0x4'));var db=require(_0xa1c9('0x5'))['db'];var utils=require(_0xa1c9('0x6'));var logger=require('../../config/logger')(_0xa1c9('0x7'));var config=require('../../config/environment');var jayson=require(_0xa1c9('0x8'));var client=jayson[_0xa1c9('0x9')][_0xa1c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b0c89,_0x1a0364,_0x46b19a){return new BPromise(function(_0x3b1a2c,_0xc8bc5a){return client[_0xa1c9('0xb')](_0x2b0c89,_0x46b19a)[_0xa1c9('0xc')](function(_0x2fcbcd){logger[_0xa1c9('0xd')]('SmsApplication,\x20%s,\x20%s',_0x1a0364,'request\x20sent');logger[_0xa1c9('0xe')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x1a0364,_0xa1c9('0xf'),JSON[_0xa1c9('0x10')](_0x2fcbcd));if(_0x2fcbcd[_0xa1c9('0x11')]){if(_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x12')]===0x1f4){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x1a0364,_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);return _0xc8bc5a(_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);}logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x1a0364,_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);return _0x3b1a2c(_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);}else{logger[_0xa1c9('0xd')](_0xa1c9('0x13'),_0x1a0364,_0xa1c9('0xf'));_0x3b1a2c(_0x2fcbcd['result'][_0xa1c9('0x14')]);}})['catch'](function(_0x12d989){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x1a0364,_0x12d989);_0xc8bc5a(_0x12d989);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index cf05515..40d9736 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 _0xa456=['destroy','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','smsinteraction:addtags','addTags','tracked','sms','smsinteraction:destroy'];(function(_0x36c8e9,_0x2e45f4){var _0x5e600c=function(_0x5cfdcd){while(--_0x5cfdcd){_0x36c8e9['push'](_0x36c8e9['shift']());}};_0x5e600c(++_0x2e45f4);}(_0xa456,0x142));var _0x6a45=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0xa456[_0x39c734];return _0xb2a2f9;};'use strict';var multer=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var path=require(_0x6a45('0x2'));var timeout=require(_0x6a45('0x3'));var express=require('express');var router=express[_0x6a45('0x4')]();var auth=require(_0x6a45('0x5'));var interaction=require(_0x6a45('0x6'));var config=require('../../config/environment');var controller=require(_0x6a45('0x7'));router[_0x6a45('0x8')]('/',auth[_0x6a45('0x9')](),controller[_0x6a45('0xa')]);router['get'](_0x6a45('0xb'),auth[_0x6a45('0x9')](),controller[_0x6a45('0xc')]);router[_0x6a45('0x8')](_0x6a45('0xd'),auth['isAuthenticated'](),controller[_0x6a45('0xe')]);router['get'](_0x6a45('0xf'),auth[_0x6a45('0x9')](),controller[_0x6a45('0x10')]);router[_0x6a45('0x8')](_0x6a45('0x11'),auth['isAuthenticated'](),controller['download']);router[_0x6a45('0x12')]('/',auth[_0x6a45('0x9')](),controller['create']);router['post']('/:id/messages',auth[_0x6a45('0x9')](),controller[_0x6a45('0x13')]);router[_0x6a45('0x12')](_0x6a45('0x14'),auth[_0x6a45('0x9')](),interaction['tracked']('sms',_0x6a45('0x15')),controller[_0x6a45('0x16')]);router['put'](_0x6a45('0xd'),auth[_0x6a45('0x9')](),interaction[_0x6a45('0x17')](_0x6a45('0x18'),'smsinteraction:update'),controller['update']);router['delete'](_0x6a45('0xd'),auth[_0x6a45('0x9')](),interaction[_0x6a45('0x17')]('sms',_0x6a45('0x19')),controller[_0x6a45('0x1a')]);router[_0x6a45('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0x6a45('0x1c')]=router; \ No newline at end of file +var _0x6197=['isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','sms','smsinteraction:addtags','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','removeTags','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','get'];(function(_0x347844,_0x4377d4){var _0x201da2=function(_0x52da25){while(--_0x52da25){_0x347844['push'](_0x347844['shift']());}};_0x201da2(++_0x4377d4);}(_0x6197,0x142));var _0x7619=function(_0x3a60e9,_0x138ad2){_0x3a60e9=_0x3a60e9-0x0;var _0x1bde14=_0x6197[_0x3a60e9];return _0x1bde14;};'use strict';var multer=require(_0x7619('0x0'));var util=require('util');var path=require(_0x7619('0x1'));var timeout=require('connect-timeout');var express=require(_0x7619('0x2'));var router=express[_0x7619('0x3')]();var auth=require(_0x7619('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7619('0x5'));var controller=require(_0x7619('0x6'));router[_0x7619('0x7')]('/',auth[_0x7619('0x8')](),controller[_0x7619('0x9')]);router[_0x7619('0x7')](_0x7619('0xa'),auth[_0x7619('0x8')](),controller[_0x7619('0xb')]);router[_0x7619('0x7')](_0x7619('0xc'),auth[_0x7619('0x8')](),controller[_0x7619('0xd')]);router[_0x7619('0x7')](_0x7619('0xe'),auth['isAuthenticated'](),controller[_0x7619('0xf')]);router[_0x7619('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x7619('0x10')]);router[_0x7619('0x11')]('/',auth['isAuthenticated'](),controller[_0x7619('0x12')]);router[_0x7619('0x11')](_0x7619('0xe'),auth[_0x7619('0x8')](),controller[_0x7619('0x13')]);router['post'](_0x7619('0x14'),auth[_0x7619('0x8')](),interaction['tracked'](_0x7619('0x15'),_0x7619('0x16')),controller['addTags']);router['put'](_0x7619('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0x7619('0x15'),_0x7619('0x17')),controller[_0x7619('0x18')]);router[_0x7619('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0x7619('0x1a')](_0x7619('0x15'),_0x7619('0x1b')),controller['destroy']);router['delete'](_0x7619('0x14'),auth[_0x7619('0x8')](),controller[_0x7619('0x1c')]);module[_0x7619('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index bdcca11..cfc30b1 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 _0xcb91=['exports','BOOLEAN','DATE','STRING','out'];(function(_0x52b217,_0x477648){var _0xabe04f=function(_0x2c176d){while(--_0x2c176d){_0x52b217['push'](_0x52b217['shift']());}};_0xabe04f(++_0x477648);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x303064,_0x12f0c2){_0x303064=_0x303064-0x0;var _0x5a1d3d=_0xcb91[_0x303064];return _0x5a1d3d;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1cb9('0x0')]={'closed':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1cb9('0x2')]},'disposition':{'type':Sequelize[_0x1cb9('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'read1stAt':{'type':Sequelize[_0x1cb9('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x1cb9('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1cb9('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1cb9('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xd8b0=['moment','STRING','DATE','ENUM','out','sequelize'];(function(_0x29f9af,_0x4f3d10){var _0x56e4a8=function(_0x2e2554){while(--_0x2e2554){_0x29f9af['push'](_0x29f9af['shift']());}};_0x56e4a8(++_0x4f3d10);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'note':{'type':Sequelize[_0x0d8b('0x2')]},'phone':{'type':Sequelize[_0x0d8b('0x2')]},'read1stAt':{'type':Sequelize[_0x0d8b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in',_0x0d8b('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 4c3a017..1b7be7e 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 _0xa75b=['select','field','u.id','u.fullname','ui.SmsInteractionId','left_join','u.id\x20=\x20ui.UserId','from','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','find','unreadMessages','having','`\x20>\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','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','start','text','some','isEmpty','forEach','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','push','rows','catch','show','params','includeAll','options','create','body','destroy','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','secret','SmsAccount','get','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','Owner','N.A.','closedAt','disposition','out','System','renderFile','views','toFile','transcript-','log','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','register','status','end','json','count','offset','limit','save','update','then','sendStatus','name','send','map','fullname','TagIds','Tags','split','index','SmsInteraction','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3af21a,_0x41400d){var _0x31334b=function(_0x53b37a){while(--_0x53b37a){_0x3af21a['push'](_0x3af21a['shift']());}};_0x31334b(++_0x41400d);}(_0xa75b,0x170));var _0xba75=function(_0x454ba1,_0x5aa3e5){_0x454ba1=_0x454ba1-0x0;var _0x5487ac=_0xa75b[_0x454ba1];return _0x5487ac;};'use strict';var pdf=require(_0xba75('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xba75('0x1'));var jsonpatch=require(_0xba75('0x2'));var rp=require(_0xba75('0x3'));var moment=require(_0xba75('0x4'));var BPromise=require(_0xba75('0x5'));var Mustache=require(_0xba75('0x6'));var util=require(_0xba75('0x7'));var path=require(_0xba75('0x8'));var sox=require(_0xba75('0x9'));var csv=require(_0xba75('0xa'));var ejs=require(_0xba75('0xb'));var fs=require('fs');var _=require(_0xba75('0xc'));var squel=require(_0xba75('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba75('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba75('0xf'));var Redis=require('ioredis');var authService=require(_0xba75('0x10'));var qs=require(_0xba75('0x11'));var as=require(_0xba75('0x12'));var hardwareService=require(_0xba75('0x13'));var logger=require(_0xba75('0x14'))(_0xba75('0x15'));var utils=require(_0xba75('0x16'));var config=require(_0xba75('0x17'));var db=require(_0xba75('0x18'))['db'];config[_0xba75('0x19')]=_[_0xba75('0x1a')](config[_0xba75('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba75('0x19')]));require('./smsInteraction.socket')[_0xba75('0x1b')](socket);function respondWithStatusCode(_0x2df615,_0xa27f76){_0xa27f76=_0xa27f76||0xcc;return function(_0x383b1e){if(_0x383b1e){return _0x2df615['sendStatus'](_0xa27f76);}return _0x2df615[_0xba75('0x1c')](_0xa27f76)[_0xba75('0x1d')]();};}function respondWithResult(_0x256678,_0x4028f9){_0x4028f9=_0x4028f9||0xc8;return function(_0x41c9e5){if(_0x41c9e5){return _0x256678['status'](_0x4028f9)[_0xba75('0x1e')](_0x41c9e5);}};}function respondWithFilteredResult(_0x2bf023,_0x14bd83){return function(_0x47be93){if(_0x47be93){var _0x2822af=_0x47be93[_0xba75('0x1f')],_0xd8850f=_0x14bd83[_0xba75('0x20')],_0xc4bf17=_0x14bd83['offset']+_0x14bd83[_0xba75('0x21')],_0x132750;if(_0xc4bf17>=_0x2822af){_0xc4bf17=_0x2822af;_0x132750=0xc8;}else{_0x132750=0xce;}_0x2bf023[_0xba75('0x1c')](_0x132750);return _0x2bf023['set']('Content-Range',_0xd8850f+'-'+_0xc4bf17+'/'+_0x2822af)[_0xba75('0x1e')](_0x47be93);}return null;};}function patchUpdates(_0x31bc33){return function(_0x496cfc){try{jsonpatch['apply'](_0x496cfc,_0x31bc33,!![]);}catch(_0x30f482){return BPromise['reject'](_0x30f482);}return _0x496cfc[_0xba75('0x22')]();};}function saveUpdates(_0x2ece41,_0x19b2d7){return function(_0x4efad7){if(_0x4efad7){return _0x4efad7[_0xba75('0x23')](_0x2ece41)[_0xba75('0x24')](function(_0x139fa4){return _0x139fa4;});}return null;};}function removeEntity(_0x3e9bd9,_0x14c54b){return function(_0x29b14c){if(_0x29b14c){return _0x29b14c['destroy']()[_0xba75('0x24')](function(){_0x3e9bd9[_0xba75('0x1c')](0xcc)[_0xba75('0x1d')]();});}};}function handleEntityNotFound(_0x5ec733,_0x1caa6){return function(_0x44b1d4){if(!_0x44b1d4){_0x5ec733[_0xba75('0x25')](0x194);}return _0x44b1d4;};}function handleError(_0x37f7c8,_0x35c571){_0x35c571=_0x35c571||0x1f4;return function(_0x155c74){logger['error'](_0x155c74['stack']);if(_0x155c74['name']){delete _0x155c74[_0xba75('0x26')];}_0x37f7c8['status'](_0x35c571)[_0xba75('0x27')](_0x155c74);};}function getInteractionUsers(_0x58ea2d,_0x15b5bc){return new BPromise(function(_0x1afc1f,_0x20ac78){try{if(_0x15b5bc[_0x58ea2d['id']]){_0x58ea2d['Users']=_[_0xba75('0x28')](_0x15b5bc[_0x58ea2d['id']],function(_0x62cf49){return{'id':_0x62cf49['id'],'fullname':_0x62cf49[_0xba75('0x29')]};});}}catch(_0x2808f0){_0x20ac78(_0x2808f0);}_0x1afc1f(_0x58ea2d);});}function getInteractionTags(_0x5d9f78,_0x4791a5){return new BPromise(function(_0x200715,_0x481a04){try{if(_0x5d9f78[_0xba75('0x2a')]){_0x5d9f78[_0xba75('0x2b')]=[];_0x5d9f78[_0xba75('0x2a')][_0xba75('0x2c')](',')['forEach'](function(_0x238271){_0x5d9f78[_0xba75('0x2b')]['push'](_0x4791a5[_0x238271]);});}delete _0x5d9f78[_0xba75('0x2a')];}catch(_0x37d6bb){_0x481a04(_0x37d6bb);}_0x200715(_0x5d9f78);});}function updateSmsInteraction(_0x3930,_0x2e6680,_0x4ee68d){return new BPromise(function(_0x75f87a,_0x3a1610){return getInteractionUsers(_0x3930,_0x4ee68d)['then'](function(_0x36d826){return getInteractionTags(_0x36d826,_0x2e6680);})[_0xba75('0x24')](function(_0x5a88a3){_0x75f87a(_0x5a88a3);})['catch'](function(_0x29334a){_0x3a1610(_0x29334a);});});}exports[_0xba75('0x2d')]=function(_0x1114e0,_0x381cb){var _0x5e3c8c={},_0xe5f817={},_0x3d8453={'count':0x0,'rows':[]};var _0x4c9fb2=_['map'](db[_0xba75('0x2e')][_0xba75('0x2f')],function(_0x169e2a){return{'name':_0x169e2a['fieldName'],'type':_0x169e2a[_0xba75('0x30')][_0xba75('0x31')]};});_0xe5f817['model']=_['map'](_0x4c9fb2,_0xba75('0x26'));_0xe5f817[_0xba75('0x32')]=_[_0xba75('0x33')](_0x1114e0[_0xba75('0x32')]);_0xe5f817[_0xba75('0x34')]=_['intersection'](_0xe5f817['model'],_0xe5f817[_0xba75('0x32')]);_0x5e3c8c[_0xba75('0x35')]=_[_0xba75('0x36')](_0xe5f817[_0xba75('0x37')],qs[_0xba75('0x38')](_0x1114e0[_0xba75('0x32')][_0xba75('0x38')]));_0x5e3c8c['attributes']=_0x5e3c8c[_0xba75('0x35')][_0xba75('0x39')]?_0x5e3c8c['attributes']:_0xe5f817[_0xba75('0x37')];if(!_0x1114e0[_0xba75('0x32')][_0xba75('0x3a')](_0xba75('0x3b'))){_0x5e3c8c[_0xba75('0x21')]=qs[_0xba75('0x21')](_0x1114e0[_0xba75('0x32')]['limit']);_0x5e3c8c[_0xba75('0x20')]=qs['offset'](_0x1114e0[_0xba75('0x32')]['offset']);}_0x5e3c8c[_0xba75('0x3c')]=qs[_0xba75('0x3d')](_0x1114e0[_0xba75('0x32')][_0xba75('0x3d')]);_0x5e3c8c[_0xba75('0x3e')]=qs[_0xba75('0x34')](_[_0xba75('0x3f')](_0x1114e0[_0xba75('0x32')],_0xe5f817[_0xba75('0x34')]),_0x4c9fb2);var _0x5c7c7f=[];var _0x30b5f0=squel[_0xba75('0x40')]()['field']('id')[_0xba75('0x41')](_0xba75('0x26'))[_0xba75('0x41')]('color')['from']('tools_tags');var _0x5f008b=squel[_0xba75('0x40')]()['field'](_0xba75('0x42'))[_0xba75('0x41')](_0xba75('0x43'))[_0xba75('0x41')](_0xba75('0x44'))['from']('user_has_sms_interactions','ui')[_0xba75('0x45')]('users','u',_0xba75('0x46'));var _0x4e7c18=squel[_0xba75('0x40')]()[_0xba75('0x47')](_0xba75('0x48'),'i')[_0xba75('0x45')]('cm_contacts','c',_0xba75('0x49'))[_0xba75('0x45')](_0xba75('0x4a'),'o',_0xba75('0x4b'))[_0xba75('0x45')](_0xba75('0x4c'),'a',_0xba75('0x4d'))[_0xba75('0x45')]('sms_messages','me',_0xba75('0x4e'))[_0xba75('0x45')](_0xba75('0x4f'),'it',_0xba75('0x50'))[_0xba75('0x45')]('tools_tags','t',_0xba75('0x51'));var _0x25ae33=squel[_0xba75('0x52')]();var _0x3f844c=[];var _0x174abe=squel[_0xba75('0x52')]();var _0x2c9085;if(_0x1114e0['query'][_0xba75('0x53')]){_0x2c9085=as[_0xba75('0x54')](_0x1114e0[_0xba75('0x32')]['search']);var _0x2c0a59=_0x2c9085[_0xba75('0x55')];for(var _0x559f6f=0x0;_0x559f6f<_0x2c9085['conditions'][_0xba75('0x39')];_0x559f6f++){var _0x5e3785=_0x2c9085['conditions'][_0x559f6f];var _0x40435e='i';var _0x531cd7=_[_0xba75('0x56')](_0x4c9fb2,[_0xba75('0x26'),_0x5e3785[_0xba75('0x41')]]);if(!_0x531cd7){switch(_0x5e3785[_0xba75('0x41')]){case _0xba75('0x57'):if(_0x5e3785['value']==0x1){_0x4e7c18[_0xba75('0x58')]('`'+_0x5e3785[_0xba75('0x41')]+'`\x20=\x200');}else{_0x4e7c18[_0xba75('0x58')]('`'+_0x5e3785[_0xba75('0x41')]+_0xba75('0x59'));}break;case _0xba75('0x5a'):if(_0x5e3785[_0xba75('0x5b')]==='$substring'){if(_0x5e3785[_0xba75('0x5c')][_0xba75('0x2c')]('\x20')['length']>0x1){_0x25ae33[_0x2c0a59](_0xba75('0x5d'),qs[_0xba75('0x5e')](_0x5e3785[_0xba75('0x5c')]),null);}else{var _0x162621='%'+_0x5e3785[_0xba75('0x5c')]+'%';_0x25ae33[_0x2c0a59](_0xba75('0x5f'),_0x162621,_0x162621,_0x162621);}}else{_0x531cd7=_['find'](_0x4c9fb2,[_0xba75('0x26'),_0xba75('0x60')]);_0x5e3785[_0xba75('0x41')]=_0xba75('0x60');_0xf02890=as[_0xba75('0x61')](_0x40435e,_0x531cd7[_0xba75('0x30')],_0x5e3785);_0x25ae33[_0x2c0a59](_0xf02890['text'],_0xf02890['value']['start'],_0xf02890['value'][_0xba75('0x1d')]);}break;case _0xba75('0x62'):var _0x2991e5=_0x5e3785[_0xba75('0x5c')][_0xba75('0x2c')](',')[_0xba75('0x28')](function(_0x3935bd){return Number(_0x3935bd);});_0x2991e5['forEach'](function(_0x1c4707){_0x174abe['or'](_0xba75('0x63'),'%,'+_0x1c4707+',%');});_0x3f844c=_[_0xba75('0x64')](_0x3f844c,_0x2991e5);break;case _0xba75('0x65'):if(_0x5e3785['operator']===_0xba75('0x66')){_0x25ae33[_0x2c0a59](_0xba75('0x67'),'%'+_0x5e3785['value']+'%',null);}else{_0x531cd7=_[_0xba75('0x56')](_0x4c9fb2,['name',_0xba75('0x68')]);_0x5e3785[_0xba75('0x41')]='UserId';_0xf02890=as[_0xba75('0x61')](_0x40435e,_0x531cd7[_0xba75('0x30')],_0x5e3785);_0x25ae33[_0x2c0a59](_0xf02890['text'],_0xf02890['value'][_0xba75('0x69')],_0xf02890['value'][_0xba75('0x1d')]);}break;case'body':_0xf02890=as[_0xba75('0x61')]('me',null,_0x5e3785);_0x25ae33[_0x2c0a59](_0xf02890[_0xba75('0x6a')],_0xf02890[_0xba75('0x5c')][_0xba75('0x69')],_0xf02890[_0xba75('0x5c')]['end']);break;}}else{var _0xf02890=as[_0xba75('0x61')](_0x40435e,_0x531cd7['type'],_0x5e3785);_0x25ae33[_0x2c0a59](_0xf02890[_0xba75('0x6a')],_0xf02890[_0xba75('0x5c')][_0xba75('0x69')],_0xf02890[_0xba75('0x5c')][_0xba75('0x1d')]);}}}else{var _0x1d3331=_(_0x1114e0[_0xba75('0x32')])[_0xba75('0x33')]()[_0xba75('0x28')](function(_0x36bd35){return _[_0xba75('0x6b')](_0x4c9fb2,[_0xba75('0x26'),_0x36bd35])?_0x36bd35:undefined;})['compact']()['value']();if(!_[_0xba75('0x6c')](_0x1d3331)){_0x1d3331[_0xba75('0x6d')](function(_0x46f3ed){if(_0x46f3ed===_0xba75('0x6e')){_0x4e7c18[_0xba75('0x3e')](_0xba75('0x6f'),[][_0xba75('0x70')](_0x1114e0[_0xba75('0x32')][_0x46f3ed]));}else if(_0x46f3ed===_0xba75('0x71')){var _0x259f40=JSON[_0xba75('0x72')](_0x1114e0['query'][_0x46f3ed])[_0xba75('0x73')];var _0x5c1e1d=JSON[_0xba75('0x72')](_0x1114e0[_0xba75('0x32')][_0x46f3ed])[_0xba75('0x74')];_0x4e7c18[_0xba75('0x3e')](_0xba75('0x75'),_0x259f40,_0x5c1e1d);}else{if(_0x1114e0[_0xba75('0x32')][_0x46f3ed]==='null'){_0x4e7c18[_0xba75('0x3e')]('i.'+_0x46f3ed+'\x20IS\x20NULL');}else{_0x4e7c18[_0xba75('0x3e')]('i.'+_0x46f3ed+_0xba75('0x76'),_0x1114e0['query'][_0x46f3ed]);}}});}if(_0x1114e0['query'][_0xba75('0x77')]){if(_0x1114e0[_0xba75('0x32')][_0xba75('0x77')]==0x1){_0x4e7c18[_0xba75('0x58')](_0xba75('0x78'));}else{_0x4e7c18[_0xba75('0x58')]('`unreadMessages`\x20>\x200');}}if(_0x1114e0[_0xba75('0x32')][_0xba75('0x79')]){_0x3f844c=_['isArray'](_0x1114e0[_0xba75('0x32')][_0xba75('0x79')])?_0x1114e0[_0xba75('0x32')][_0xba75('0x79')]:new Array(_0x1114e0[_0xba75('0x32')]['tag']);_0x3f844c[_0xba75('0x6d')](function(_0x541fc0){_0x174abe['or'](_0xba75('0x63'),'%,'+_0x541fc0+',%');});}if(_0x1114e0[_0xba75('0x32')][_0xba75('0x7a')]){var _0x42dcc7=_0x1114e0[_0xba75('0x32')][_0xba75('0x7a')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xba75('0x7b'));if(qs['isNumeric'](_0x42dcc7)){_0x25ae33['or'](_0xba75('0x7c'),_0x42dcc7+'%')['or'](_0xba75('0x7d'),_0x42dcc7+'%');}else{_0x25ae33['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xba75('0x5e')](_0x42dcc7))['or'](_0xba75('0x7e'),_0x42dcc7+'%');}}}_0x4e7c18[_0xba75('0x3e')](_0x25ae33);_0x4e7c18['group']('i.id');var _0x5b6a71={'type':db['Sequelize']['QueryTypes'][_0xba75('0x7f')],'raw':!![]};var _0x549f1d=_0x4e7c18[_0xba75('0x80')]();_0x549f1d[_0xba75('0x41')](_0xba75('0x81'));_0x549f1d[_0xba75('0x41')](_0xba75('0x82'),_0xba75('0x57'));if(_0x5e3c8c[_0xba75('0x3c')]){_0x5e3c8c['order']['forEach'](function(_0x2c9dec){_0x4e7c18[_0xba75('0x3c')]('i.'+_0x2c9dec[0x0],_0x2c9dec[0x1]==='DESC'?![]:!![]);});}if(!_[_0xba75('0x6c')](_0x3f844c)){_0x4e7c18['having'](_0x174abe);_0x549f1d[_0xba75('0x3e')](_0xba75('0x83'),_0x3f844c);}BPromise['resolve']()[_0xba75('0x24')](function(){if(!_0x2c9085){if(_0x1114e0['query'][_0xba75('0x6e')]||_0x1114e0[_0xba75('0x32')]['journey'])return;_0x549f1d[_0xba75('0x3e')](_0xba75('0x84'));_0x4e7c18[_0xba75('0x3e')](_0xba75('0x84'));return;}return _0x1114e0[_0xba75('0x85')][_0xba75('0x86')]({'attributes':['id'],'raw':!![]})[_0xba75('0x24')](function(_0xaa4b51){if(_['isEmpty'](_0xaa4b51)){_0x549f1d[_0xba75('0x3e')](_0xba75('0x87'));_0x4e7c18['where']('i.SmsAccountId\x20IS\x20NULL');}else{_0x549f1d['where'](_0xba75('0x6f'),_['map'](_0xaa4b51,'id'));_0x4e7c18[_0xba75('0x3e')]('i.SmsAccountId\x20IN\x20?',_[_0xba75('0x28')](_0xaa4b51,'id'));}});})['then'](function(){db['sequelize'][_0xba75('0x32')](_0x549f1d['toString'](),_0x5b6a71)[_0xba75('0x24')](function(_0x51f79f){_0x3d8453['count']=_0x51f79f[_0xba75('0x39')];if(_0x3d8453['count']===0x0)return[];return db[_0xba75('0x88')]['query'](_0x30b5f0[_0xba75('0x89')](),_0x5b6a71)[_0xba75('0x24')](function(_0x21fa25){_0x5c7c7f=_['keyBy'](_0x21fa25,'id');_0x5b6a71=_[_0xba75('0x8a')](_0x5b6a71,{'model':db[_0xba75('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1114e0['query'][_0xba75('0x38')]){_0x5e3c8c['attributes']['forEach'](function(_0x3791c4){_0x4e7c18['field']('i.'+_0x3791c4);});}else{_0x4e7c18[_0xba75('0x41')](_0xba75('0x82'),_0xba75('0x57'));_0x4e7c18[_0xba75('0x41')](_0xba75('0x8b'),_0xba75('0x8c'));_0x4e7c18[_0xba75('0x41')](_0xba75('0x8d'),_0xba75('0x8e'));_0x4e7c18[_0xba75('0x41')](_0xba75('0x8f'));_0x4e7c18['field']('c.firstName',_0xba75('0x90'));_0x4e7c18['field'](_0xba75('0x91'),_0xba75('0x92'));_0x4e7c18[_0xba75('0x41')](_0xba75('0x93'),_0xba75('0x94'));_0x4e7c18[_0xba75('0x41')]('c.phone','Contact.phone');_0x4e7c18[_0xba75('0x41')]('c.mobile',_0xba75('0x95'));_0x4e7c18[_0xba75('0x41')](_0xba75('0x96'),_0xba75('0x97'));_0x4e7c18[_0xba75('0x41')]('o.fullname',_0xba75('0x98'));_0x4e7c18[_0xba75('0x41')](_0xba75('0x99'),_0xba75('0x9a'));_0x4e7c18[_0xba75('0x41')](_0xba75('0x9b'),_0xba75('0x2a'));}if(_0x5e3c8c[_0xba75('0x21')])_0x4e7c18[_0xba75('0x21')](_0x5e3c8c['limit']);if(_0x5e3c8c[_0xba75('0x20')])_0x4e7c18[_0xba75('0x20')](_0x5e3c8c[_0xba75('0x20')]);return db[_0xba75('0x88')][_0xba75('0x32')](_0x4e7c18[_0xba75('0x89')](),_0x5b6a71);})[_0xba75('0x24')](function(_0x423d44){_0x5f008b['where'](_0xba75('0x9c'),_[_0xba75('0x28')](_0x423d44,'id'));return db[_0xba75('0x88')][_0xba75('0x32')](_0x5f008b[_0xba75('0x89')](),_0x5b6a71)[_0xba75('0x24')](function(_0x4f9f48){var _0xe8ead=_['groupBy'](_0x4f9f48,_0xba75('0x9d'));var _0x5cc43a=[];_0x423d44[_0xba75('0x6d')](function(_0x25eb36){_0x5cc43a[_0xba75('0x9e')](updateSmsInteraction(_0x25eb36,_0x5c7c7f,_0xe8ead));});return BPromise['all'](_0x5cc43a);});});})['then'](function(_0x56a988){_0x3d8453[_0xba75('0x9f')]=_0x56a988;return _0x3d8453;})[_0xba75('0x24')](respondWithFilteredResult(_0x381cb,_0x5e3c8c));})[_0xba75('0xa0')](handleError(_0x381cb,null));};exports[_0xba75('0xa1')]=function(_0x50fd44,_0x43821d){var _0x2c545c={'raw':![],'where':{'id':_0x50fd44[_0xba75('0xa2')]['id']}},_0x377aa8={};_0x377aa8[_0xba75('0x37')]=_[_0xba75('0x33')](db[_0xba75('0x2e')][_0xba75('0x2f')]);_0x377aa8[_0xba75('0x32')]=_[_0xba75('0x33')](_0x50fd44['query']);_0x377aa8[_0xba75('0x34')]=_[_0xba75('0x36')](_0x377aa8[_0xba75('0x37')],_0x377aa8['query']);_0x2c545c[_0xba75('0x35')]=_[_0xba75('0x36')](_0x377aa8[_0xba75('0x37')],qs[_0xba75('0x38')](_0x50fd44['query'][_0xba75('0x38')]));_0x2c545c[_0xba75('0x35')]=_0x2c545c['attributes'][_0xba75('0x39')]?_0x2c545c[_0xba75('0x35')]:_0x377aa8[_0xba75('0x37')];if(_0x50fd44[_0xba75('0x32')][_0xba75('0xa3')]){_0x2c545c['include']=[{'all':!![]}];}_0x2c545c=_['merge']({},_0x2c545c,_0x50fd44[_0xba75('0xa4')]);return db['SmsInteraction'][_0xba75('0x56')](_0x2c545c)[_0xba75('0x24')](handleEntityNotFound(_0x43821d,null))[_0xba75('0x24')](respondWithResult(_0x43821d,null))['catch'](handleError(_0x43821d,null));};exports[_0xba75('0xa5')]=function(_0x1cb703,_0x2c87c7){return db[_0xba75('0x2e')][_0xba75('0xa5')](_0x1cb703['body'],{})['then'](respondWithResult(_0x2c87c7,0xc9))['catch'](handleError(_0x2c87c7,null));};exports[_0xba75('0x23')]=function(_0x596eba,_0x1f39c8){if(_0x596eba['body']['id']){delete _0x596eba[_0xba75('0xa6')]['id'];}return db['SmsInteraction'][_0xba75('0x56')]({'where':{'id':_0x596eba[_0xba75('0xa2')]['id']}})[_0xba75('0x24')](handleEntityNotFound(_0x1f39c8,null))[_0xba75('0x24')](saveUpdates(_0x596eba[_0xba75('0xa6')],null))[_0xba75('0x24')](respondWithResult(_0x1f39c8,null))[_0xba75('0xa0')](handleError(_0x1f39c8,null));};exports[_0xba75('0xa7')]=function(_0x49bcd2,_0x25d9fa){return db[_0xba75('0x2e')][_0xba75('0x56')]({'where':{'id':_0x49bcd2[_0xba75('0xa2')]['id']}})[_0xba75('0x24')](handleEntityNotFound(_0x25d9fa,null))['then'](removeEntity(_0x25d9fa,null))[_0xba75('0xa0')](handleError(_0x25d9fa,null));};exports[_0xba75('0xa8')]=function(_0x321bff,_0x4f5e29){return db[_0xba75('0x2e')]['describe']()['then'](respondWithResult(_0x4f5e29,null))[_0xba75('0xa0')](handleError(_0x4f5e29,null));};exports[_0xba75('0xa9')]=function(_0x197b3d,_0x3ff88c,_0xa8cbb5){return db[_0xba75('0xaa')][_0xba75('0x56')]({'where':{'id':_0x197b3d['params']['id']}})[_0xba75('0x24')](handleEntityNotFound(_0x3ff88c,null))['then'](function(_0x2c6871){if(_0x2c6871){return _0x2c6871[_0xba75('0xa9')](_0x197b3d[_0xba75('0xa6')][_0xba75('0xab')],_[_0xba75('0xac')](_0x197b3d[_0xba75('0xa6')],['ids','id'])||{});}})[_0xba75('0x24')](respondWithResult(_0x3ff88c,null))[_0xba75('0xa0')](handleError(_0x3ff88c,null));};exports[_0xba75('0xad')]=function(_0x5a8271,_0x340bd7,_0x772fce){var _0x43e69b={'raw':![],'where':{}};var _0x2f570d={};var _0x219b24={'count':0x0,'rows':[]};return db[_0xba75('0x2e')][_0xba75('0xae')]({'where':{'id':_0x5a8271[_0xba75('0xa2')]['id']}})[_0xba75('0x24')](handleEntityNotFound(_0x340bd7,null))[_0xba75('0x24')](function(_0x33f6b9){if(_0x33f6b9){_0x2f570d[_0xba75('0x37')]=_[_0xba75('0x33')](db['SmsMessage'][_0xba75('0x2f')]);_0x2f570d[_0xba75('0x32')]=_['keys'](_0x5a8271[_0xba75('0x32')]);_0x2f570d['filters']=_[_0xba75('0x36')](_0x2f570d[_0xba75('0x37')],_0x2f570d['query']);_0x43e69b[_0xba75('0x35')]=_[_0xba75('0x36')](_0x2f570d[_0xba75('0x37')],qs[_0xba75('0x38')](_0x5a8271['query'][_0xba75('0x38')]));_0x43e69b[_0xba75('0x35')]=_0x43e69b['attributes']['length']?_0x43e69b['attributes']:_0x2f570d[_0xba75('0x37')];if(!_0x5a8271[_0xba75('0x32')]['hasOwnProperty'](_0xba75('0x3b'))){_0x43e69b[_0xba75('0x21')]=qs[_0xba75('0x21')](_0x5a8271[_0xba75('0x32')]['limit']);_0x43e69b['offset']=qs[_0xba75('0x20')](_0x5a8271['query'][_0xba75('0x20')]);}_0x43e69b[_0xba75('0x3c')]=qs[_0xba75('0x3d')](_0x5a8271['query'][_0xba75('0x3d')]);_0x43e69b['where']=qs[_0xba75('0x34')](_[_0xba75('0x3f')](_0x5a8271[_0xba75('0x32')],_0x2f570d[_0xba75('0x34')]));_0x43e69b[_0xba75('0x3e')][_0xba75('0x9d')]=_0x33f6b9['id'];if(_0x5a8271[_0xba75('0x32')][_0xba75('0x7a')]){_0x43e69b[_0xba75('0x3e')]=_[_0xba75('0x8a')](_0x43e69b[_0xba75('0x3e')],{'$or':_[_0xba75('0x28')](_0x43e69b[_0xba75('0x35')],function(_0x75707d){var _0x14996e={};_0x14996e[_0x75707d]={'$like':'%'+_0x5a8271[_0xba75('0x32')][_0xba75('0x7a')]+'%'};return _0x14996e;})});}if(_0x5a8271[_0xba75('0x32')][_0xba75('0x73')]){var _0x2b1be2=_0x5a8271['query'][_0xba75('0x73')][_0xba75('0x2c')](',');var _0x8f36af={};_0x8f36af[_0x2b1be2[0x0]]={'$gte':moment(_0x2b1be2[0x1])[_0xba75('0xaf')](_0xba75('0xb0'))};_0x43e69b[_0xba75('0x3e')]=_['merge'](_0x43e69b[_0xba75('0x3e')],_0x8f36af);}_0x43e69b=_[_0xba75('0x8a')]({},_0x43e69b,_0x5a8271[_0xba75('0xa4')]);return db[_0xba75('0xaa')][_0xba75('0x1f')]({'where':_0x43e69b['where']})['then'](function(_0xdc5e5a){_0x219b24[_0xba75('0x1f')]=_0xdc5e5a;if(_0x5a8271[_0xba75('0x32')][_0xba75('0xa3')]){_0x43e69b[_0xba75('0xb1')]=[{'all':!![]}];}return db[_0xba75('0xaa')][_0xba75('0xb2')](_0x43e69b);})[_0xba75('0x24')](function(_0x4496aa){_0x219b24[_0xba75('0x9f')]=_0x4496aa;return _0x219b24;});}})[_0xba75('0x24')](respondWithFilteredResult(_0x340bd7,_0x43e69b))[_0xba75('0xa0')](handleError(_0x340bd7,null));};exports['addTags']=function(_0x33e804,_0x1c1341,_0x52b2af){return db[_0xba75('0x2e')]['find']({'where':{'id':_0x33e804[_0xba75('0xa2')]['id']}})[_0xba75('0x24')](handleEntityNotFound(_0x1c1341,null))[_0xba75('0x24')](function(_0x2e2ff5){if(_0x2e2ff5){return _0x2e2ff5['setTags'](_0x33e804[_0xba75('0xa6')]['ids'],_[_0xba75('0xac')](_0x33e804[_0xba75('0xa6')],['ids','id'])||{})[_0xba75('0xb3')](function(){return db['Tag'][_0xba75('0xb2')]({'attributes':['id',_0xba75('0x26'),'color'],'where':{'id':_0x33e804['body'][_0xba75('0xab')]}});})[_0xba75('0x24')](function(_0x3164f9){socket[_0xba75('0xb4')](_0xba75('0xb5'),{'id':Number(_0x33e804['params']['id']),'tags':_0x3164f9||[]});return{'id':Number(_0x33e804[_0xba75('0xa2')]['id']),'tags':_0x3164f9||[]};});}})[_0xba75('0x24')](respondWithResult(_0x1c1341,null))[_0xba75('0xa0')](handleError(_0x1c1341,null));};exports[_0xba75('0xb6')]=function(_0x215c8f,_0x501bcb,_0x32c248){return db['SmsInteraction'][_0xba75('0x56')]({'where':{'id':_0x215c8f[_0xba75('0xa2')]['id']}})[_0xba75('0x24')](handleEntityNotFound(_0x501bcb,null))[_0xba75('0x24')](function(_0x5c90eb){if(_0x5c90eb){return _0x5c90eb['removeTags'](_0x215c8f['query'][_0xba75('0xab')]);}})['then'](respondWithStatusCode(_0x501bcb,null))[_0xba75('0xa0')](handleError(_0x501bcb,null));};exports[_0xba75('0xb7')]=function(_0x2d5b01,_0xfb8162){var _0x579b90=moment()[_0xba75('0xb8')]()[_0xba75('0x89')]();var _0x48c1b3=path[_0xba75('0xb9')](config[_0xba75('0xba')],_0xba75('0xbb'),_0xba75('0xbc'),'tmp');var _0x24a3ce=path['join'](config[_0xba75('0xba')],_0xba75('0xbb'),'files','attachments');var _0x598854=path['join'](_0x48c1b3,_0x579b90);var _0x3eab52=util['format'](_0xba75('0xbd'),_0x2d5b01[_0xba75('0xa2')]['id'],_0x579b90);var _0x27b101=path[_0xba75('0xb9')](_0x48c1b3,_0x3eab52);var _0x4e7d82=[];_0x4e7d82['push']({'model':db[_0xba75('0x65')],'as':'User','attributes':['id',_0xba75('0x29')],'raw':!![]});_0x4e7d82['push']({'model':db[_0xba75('0xbe')],'as':_0xba75('0x5a'),'attributes':['id',_0xba75('0xbf'),_0xba75('0xc0')],'raw':!![]});var _0x27ac75=[{'model':db[_0xba75('0xaa')],'as':_0xba75('0xc1'),'attributes':['id',_0xba75('0xa6'),_0xba75('0x71'),'direction',_0xba75('0xc2'),_0xba75('0x77')],'include':_0x4e7d82}];_0x27ac75[_0xba75('0x9e')]({'model':db[_0xba75('0xc3')],'as':'Account','attributes':['id',_0xba75('0x26')]});_0x27ac75[_0xba75('0x9e')]({'model':db[_0xba75('0x65')],'as':'Owner','attributes':['id',_0xba75('0x29')]});return db[_0xba75('0x2e')]['find']({'where':{'id':_0x2d5b01[_0xba75('0xa2')]['id']},'include':_0x27ac75})[_0xba75('0x24')](handleEntityNotFound(_0xfb8162,null))['then'](function(_0x4f4510){if(_0x4f4510){var _0x20a51a=_0x4f4510[_0xba75('0xc4')]({'plain':!![]});fs['mkdirSync'](_0x598854);var _0x21f0bb={'format':'A4','border':_0xba75('0xc5'),'header':{'height':'40px','contents':{'first':_0xba75('0xc6')}},'footer':{'height':_0xba75('0xc7'),'contents':{'default':util[_0xba75('0xaf')](_0xba75('0xc8'),util[_0xba75('0xaf')](_0xba75('0xc9'),_0xba75('0xca'),_0x20a51a['id']),moment()[_0xba75('0xaf')]('YYYY-MM-DD')[_0xba75('0x89')]())}}};var _0x200ed8={'channel':'Sms','account':_0x20a51a['Account'][_0xba75('0x26')],'agent':_0x20a51a['Owner']?_0x20a51a[_0xba75('0xcb')]['fullname']:_0xba75('0xcc'),'createdAt':moment(_0x20a51a[_0xba75('0x71')])[_0xba75('0xaf')](_0xba75('0xb0'))[_0xba75('0x89')](),'closedAt':_0x20a51a['closed']?moment(_0x20a51a[_0xba75('0xcd')])[_0xba75('0xaf')](_0xba75('0xb0'))[_0xba75('0x89')]():'','disposition':_0x20a51a[_0xba75('0xce')],'messages':_(_0x20a51a['Messages'])[_0xba75('0x7a')]({'secret':![]})[_0xba75('0x28')](function(_0x6a527b){return{'date':moment(_0x6a527b[_0xba75('0x71')])['format'](_0xba75('0xb0'))['toString'](),'sender':_0x6a527b['direction']===_0xba75('0xcf')?_0x6a527b['User']?_0x6a527b['User'][_0xba75('0x29')]:_0xba75('0xd0'):_0x6a527b[_0xba75('0x5a')]['firstName']+(_0x6a527b[_0xba75('0x5a')]['lastName']?'\x20'+_0x6a527b[_0xba75('0x5a')][_0xba75('0xc0')]:''),'body':_0x6a527b['body'],'direction':_0x6a527b['direction']===_0xba75('0xcf')?'A':'C','secret':_0x6a527b['secret'],'read':_0x6a527b[_0xba75('0x77')]};})[_0xba75('0x5c')]()};return ejs[_0xba75('0xd1')](path['join'](config[_0xba75('0xba')],'server',_0xba75('0xd2'),'downloadInteraction.html'),{'interaction':_0x200ed8})[_0xba75('0x24')](function(_0x4b00a5){return new BPromise(function(_0x4759a3,_0x120b9e){pdf[_0xba75('0xa5')](_0x4b00a5,_0x21f0bb)[_0xba75('0xd3')](path[_0xba75('0xb9')](_0x598854,_0xba75('0xd4')+_0x20a51a['id']+'-'+_0x579b90+'.pdf'),function(_0x5242b0,_0xe47577){if(_0x5242b0)return _0x120b9e(_0x5242b0);_0x4759a3(_0xe47577);});});})[_0xba75('0x24')](function(){return new BPromise(function(_0x1d3e09,_0xd6db0e){zipdir(_0x598854,{'saveTo':_0x27b101},function(_0x20afe4,_0x487ccc){if(_0x20afe4)return _0xd6db0e(_0x20afe4);return _0x1d3e09(_0x487ccc);});})[_0xba75('0x24')](function(){return new BPromise(function(_0x1fdd46,_0x373cca){rimraf(_0x598854,function(_0x2778c0){if(_0x2778c0)_0x373cca(_0x2778c0);return _0x1fdd46();});});})['then'](function(){return _0xfb8162['download'](_0x27b101,_0x3eab52,function(_0x3da04a){if(_0x3da04a){console[_0xba75('0xd5')](_0xba75('0xd6'),_0x3da04a);}else{fs[_0xba75('0xd7')](_0x27b101);}});});});}else{return _0xfb8162[_0xba75('0x25')](0xc8);}})[_0xba75('0xa0')](handleError(_0xfb8162,null));}; \ No newline at end of file +var _0xb903=['expr','search','parseSearch','sqlOperator','conditions','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','text','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','body','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','count','sequelize','toString','keyBy','merge','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','catch','params','rawAttributes','include','options','create','destroy','describe','SmsMessage','addMessage','ids','omit','findOne','$gte','format','includeAll','findAll','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','CmContact','firstName','Messages','secret','SmsAccount','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','direction','out','System','lastName','renderFile','views','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','status','end','offset','limit','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','index','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId'];(function(_0x22f6a7,_0xbadff8){var _0x4b5c2b=function(_0x90611e){while(--_0x90611e){_0x22f6a7['push'](_0x22f6a7['shift']());}};_0x4b5c2b(++_0xbadff8);}(_0xb903,0x185));var _0x3b90=function(_0x428d12,_0x130872){_0x428d12=_0x428d12-0x0;var _0x42f516=_0xb903[_0x428d12];return _0x42f516;};'use strict';var pdf=require(_0x3b90('0x0'));var emlformat=require(_0x3b90('0x1'));var rimraf=require(_0x3b90('0x2'));var zipdir=require(_0x3b90('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b90('0x4'));var moment=require(_0x3b90('0x5'));var BPromise=require(_0x3b90('0x6'));var Mustache=require(_0x3b90('0x7'));var util=require(_0x3b90('0x8'));var path=require(_0x3b90('0x9'));var sox=require(_0x3b90('0xa'));var csv=require('to-csv');var ejs=require(_0x3b90('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3b90('0xc'));var jsforce=require(_0x3b90('0xd'));var deskjs=require(_0x3b90('0xe'));var toCsv=require(_0x3b90('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b90('0x10'));var logger=require(_0x3b90('0x11'))('api');var utils=require(_0x3b90('0x12'));var config=require(_0x3b90('0x13'));var db=require('../../mysqldb')['db'];config[_0x3b90('0x14')]=_[_0x3b90('0x15')](config[_0x3b90('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b90('0x14')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3a0a55,_0x2c72fb){_0x2c72fb=_0x2c72fb||0xcc;return function(_0x4824f9){if(_0x4824f9){return _0x3a0a55['sendStatus'](_0x2c72fb);}return _0x3a0a55[_0x3b90('0x16')](_0x2c72fb)[_0x3b90('0x17')]();};}function respondWithResult(_0x381a9e,_0x1af265){_0x1af265=_0x1af265||0xc8;return function(_0x1efe01){if(_0x1efe01){return _0x381a9e['status'](_0x1af265)['json'](_0x1efe01);}};}function respondWithFilteredResult(_0xd83280,_0x5420dc){return function(_0x4e9120){if(_0x4e9120){var _0x269488=_0x4e9120['count'],_0x3cf281=_0x5420dc[_0x3b90('0x18')],_0x11ad7d=_0x5420dc['offset']+_0x5420dc[_0x3b90('0x19')],_0x131f3f;if(_0x11ad7d>=_0x269488){_0x11ad7d=_0x269488;_0x131f3f=0xc8;}else{_0x131f3f=0xce;}_0xd83280[_0x3b90('0x16')](_0x131f3f);return _0xd83280['set'](_0x3b90('0x1a'),_0x3cf281+'-'+_0x11ad7d+'/'+_0x269488)[_0x3b90('0x1b')](_0x4e9120);}return null;};}function patchUpdates(_0x3642c0){return function(_0x3ce411){try{jsonpatch[_0x3b90('0x1c')](_0x3ce411,_0x3642c0,!![]);}catch(_0x43deca){return BPromise[_0x3b90('0x1d')](_0x43deca);}return _0x3ce411[_0x3b90('0x1e')]();};}function saveUpdates(_0xa98414,_0x3e5bb8){return function(_0x4e2175){if(_0x4e2175){return _0x4e2175[_0x3b90('0x1f')](_0xa98414)[_0x3b90('0x20')](function(_0x175b42){return _0x175b42;});}return null;};}function removeEntity(_0x7faee,_0x1227ed){return function(_0x93b8e7){if(_0x93b8e7){return _0x93b8e7['destroy']()['then'](function(){_0x7faee[_0x3b90('0x16')](0xcc)[_0x3b90('0x17')]();});}};}function handleEntityNotFound(_0x103324,_0x2ffa1a){return function(_0x583523){if(!_0x583523){_0x103324[_0x3b90('0x21')](0x194);}return _0x583523;};}function handleError(_0x2936d7,_0x1787d1){_0x1787d1=_0x1787d1||0x1f4;return function(_0x4caead){logger[_0x3b90('0x22')](_0x4caead[_0x3b90('0x23')]);if(_0x4caead[_0x3b90('0x24')]){delete _0x4caead[_0x3b90('0x24')];}_0x2936d7[_0x3b90('0x16')](_0x1787d1)[_0x3b90('0x25')](_0x4caead);};}function getInteractionUsers(_0x4b4d33,_0x1a839d){return new BPromise(function(_0x595ac1,_0xaf453c){try{if(_0x1a839d[_0x4b4d33['id']]){_0x4b4d33[_0x3b90('0x26')]=_[_0x3b90('0x27')](_0x1a839d[_0x4b4d33['id']],function(_0x38eed0){return{'id':_0x38eed0['id'],'fullname':_0x38eed0[_0x3b90('0x28')]};});}}catch(_0x6704f){_0xaf453c(_0x6704f);}_0x595ac1(_0x4b4d33);});}function getInteractionTags(_0x290283,_0x2430ec){return new BPromise(function(_0x500ceb,_0x4d1f31){try{if(_0x290283[_0x3b90('0x29')]){_0x290283[_0x3b90('0x2a')]=[];_0x290283[_0x3b90('0x29')][_0x3b90('0x2b')](',')['forEach'](function(_0x543458){_0x290283[_0x3b90('0x2a')][_0x3b90('0x2c')](_0x2430ec[_0x543458]);});}delete _0x290283[_0x3b90('0x29')];}catch(_0x4f3ab5){_0x4d1f31(_0x4f3ab5);}_0x500ceb(_0x290283);});}function updateSmsInteraction(_0x41bd39,_0x4ca40e,_0x49b4d2){return new BPromise(function(_0x208f3e,_0x3fbc03){return getInteractionUsers(_0x41bd39,_0x49b4d2)['then'](function(_0x3e7c71){return getInteractionTags(_0x3e7c71,_0x4ca40e);})[_0x3b90('0x20')](function(_0x3e30b8){_0x208f3e(_0x3e30b8);})['catch'](function(_0x47cd8f){_0x3fbc03(_0x47cd8f);});});}exports[_0x3b90('0x2d')]=function(_0x143698,_0x64a5e){var _0x401dc5={},_0x5dacea={},_0x5a97fe={'count':0x0,'rows':[]};var _0x25ff34=_[_0x3b90('0x27')](db['SmsInteraction']['rawAttributes'],function(_0x201712){return{'name':_0x201712[_0x3b90('0x2e')],'type':_0x201712[_0x3b90('0x2f')][_0x3b90('0x30')]};});_0x5dacea['model']=_[_0x3b90('0x27')](_0x25ff34,'name');_0x5dacea[_0x3b90('0x31')]=_[_0x3b90('0x32')](_0x143698[_0x3b90('0x31')]);_0x5dacea[_0x3b90('0x33')]=_[_0x3b90('0x34')](_0x5dacea[_0x3b90('0x35')],_0x5dacea[_0x3b90('0x31')]);_0x401dc5['attributes']=_[_0x3b90('0x34')](_0x5dacea[_0x3b90('0x35')],qs[_0x3b90('0x36')](_0x143698[_0x3b90('0x31')][_0x3b90('0x36')]));_0x401dc5[_0x3b90('0x37')]=_0x401dc5[_0x3b90('0x37')][_0x3b90('0x38')]?_0x401dc5[_0x3b90('0x37')]:_0x5dacea['model'];if(!_0x143698[_0x3b90('0x31')][_0x3b90('0x39')](_0x3b90('0x3a'))){_0x401dc5[_0x3b90('0x19')]=qs[_0x3b90('0x19')](_0x143698[_0x3b90('0x31')][_0x3b90('0x19')]);_0x401dc5[_0x3b90('0x18')]=qs[_0x3b90('0x18')](_0x143698[_0x3b90('0x31')][_0x3b90('0x18')]);}_0x401dc5[_0x3b90('0x3b')]=qs[_0x3b90('0x3c')](_0x143698[_0x3b90('0x31')][_0x3b90('0x3c')]);_0x401dc5[_0x3b90('0x3d')]=qs[_0x3b90('0x33')](_[_0x3b90('0x3e')](_0x143698[_0x3b90('0x31')],_0x5dacea[_0x3b90('0x33')]),_0x25ff34);var _0x11698a=[];var _0x4d1157=squel[_0x3b90('0x3f')]()[_0x3b90('0x40')]('id')[_0x3b90('0x40')](_0x3b90('0x24'))['field'](_0x3b90('0x41'))['from']('tools_tags');var _0x283419=squel[_0x3b90('0x3f')]()['field'](_0x3b90('0x42'))[_0x3b90('0x40')](_0x3b90('0x43'))[_0x3b90('0x40')](_0x3b90('0x44'))[_0x3b90('0x45')](_0x3b90('0x46'),'ui')[_0x3b90('0x47')](_0x3b90('0x48'),'u','u.id\x20=\x20ui.UserId');var _0x3f71b0=squel[_0x3b90('0x3f')]()['from'](_0x3b90('0x49'),'i')[_0x3b90('0x47')](_0x3b90('0x4a'),'c',_0x3b90('0x4b'))[_0x3b90('0x47')]('users','o','o.id\x20=\x20i.UserId')[_0x3b90('0x47')]('sms_accounts','a',_0x3b90('0x4c'))[_0x3b90('0x47')](_0x3b90('0x4d'),'me',_0x3b90('0x4e'))[_0x3b90('0x47')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')[_0x3b90('0x47')](_0x3b90('0x4f'),'t',_0x3b90('0x50'));var _0x5d7333=squel[_0x3b90('0x51')]();var _0x291279=[];var _0x18d59b=squel[_0x3b90('0x51')]();var _0x41e951;if(_0x143698[_0x3b90('0x31')][_0x3b90('0x52')]){_0x41e951=as[_0x3b90('0x53')](_0x143698[_0x3b90('0x31')]['search']);var _0xcc2f56=_0x41e951[_0x3b90('0x54')];for(var _0x2b5b6f=0x0;_0x2b5b6f<_0x41e951['conditions'][_0x3b90('0x38')];_0x2b5b6f++){var _0x4e9e75=_0x41e951[_0x3b90('0x55')][_0x2b5b6f];var _0x3fc270='i';var _0x98aeaf=_['find'](_0x25ff34,[_0x3b90('0x24'),_0x4e9e75[_0x3b90('0x40')]]);if(!_0x98aeaf){switch(_0x4e9e75['field']){case'unreadMessages':if(_0x4e9e75[_0x3b90('0x56')]==0x1){_0x3f71b0[_0x3b90('0x57')]('`'+_0x4e9e75[_0x3b90('0x40')]+_0x3b90('0x58'));}else{_0x3f71b0['having']('`'+_0x4e9e75['field']+_0x3b90('0x59'));}break;case _0x3b90('0x5a'):if(_0x4e9e75[_0x3b90('0x5b')]===_0x3b90('0x5c')){if(_0x4e9e75[_0x3b90('0x56')][_0x3b90('0x2b')]('\x20')[_0x3b90('0x38')]>0x1){_0x5d7333[_0xcc2f56](_0x3b90('0x5d'),qs[_0x3b90('0x5e')](_0x4e9e75['value']),null);}else{var _0x415a5d='%'+_0x4e9e75[_0x3b90('0x56')]+'%';_0x5d7333[_0xcc2f56]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x415a5d,_0x415a5d,_0x415a5d);}}else{_0x98aeaf=_[_0x3b90('0x5f')](_0x25ff34,[_0x3b90('0x24'),'ContactId']);_0x4e9e75[_0x3b90('0x40')]=_0x3b90('0x60');_0x536da7=as[_0x3b90('0x61')](_0x3fc270,_0x98aeaf[_0x3b90('0x2f')],_0x4e9e75);_0x5d7333[_0xcc2f56](_0x536da7[_0x3b90('0x62')],_0x536da7[_0x3b90('0x56')][_0x3b90('0x63')],_0x536da7['value'][_0x3b90('0x17')]);}break;case _0x3b90('0x64'):var _0x32a179=_0x4e9e75[_0x3b90('0x56')][_0x3b90('0x2b')](',')[_0x3b90('0x27')](function(_0x3ada12){return Number(_0x3ada12);});_0x32a179[_0x3b90('0x65')](function(_0x28ec05){_0x18d59b['or'](_0x3b90('0x66'),'%,'+_0x28ec05+',%');});_0x291279=_[_0x3b90('0x67')](_0x291279,_0x32a179);break;case _0x3b90('0x68'):if(_0x4e9e75[_0x3b90('0x5b')]===_0x3b90('0x5c')){_0x5d7333[_0xcc2f56](_0x3b90('0x69'),'%'+_0x4e9e75['value']+'%',null);}else{_0x98aeaf=_[_0x3b90('0x5f')](_0x25ff34,['name',_0x3b90('0x6a')]);_0x4e9e75[_0x3b90('0x40')]=_0x3b90('0x6a');_0x536da7=as[_0x3b90('0x61')](_0x3fc270,_0x98aeaf[_0x3b90('0x2f')],_0x4e9e75);_0x5d7333[_0xcc2f56](_0x536da7[_0x3b90('0x62')],_0x536da7['value'][_0x3b90('0x63')],_0x536da7[_0x3b90('0x56')][_0x3b90('0x17')]);}break;case _0x3b90('0x6b'):_0x536da7=as[_0x3b90('0x61')]('me',null,_0x4e9e75);_0x5d7333[_0xcc2f56](_0x536da7[_0x3b90('0x62')],_0x536da7['value'][_0x3b90('0x63')],_0x536da7[_0x3b90('0x56')][_0x3b90('0x17')]);break;}}else{var _0x536da7=as[_0x3b90('0x61')](_0x3fc270,_0x98aeaf[_0x3b90('0x2f')],_0x4e9e75);_0x5d7333[_0xcc2f56](_0x536da7[_0x3b90('0x62')],_0x536da7[_0x3b90('0x56')][_0x3b90('0x63')],_0x536da7[_0x3b90('0x56')][_0x3b90('0x17')]);}}}else{var _0x3e5bf7=_(_0x143698[_0x3b90('0x31')])['keys']()[_0x3b90('0x27')](function(_0x4a60f3){return _['some'](_0x25ff34,[_0x3b90('0x24'),_0x4a60f3])?_0x4a60f3:undefined;})[_0x3b90('0x6c')]()['value']();if(!_[_0x3b90('0x6d')](_0x3e5bf7)){_0x3e5bf7[_0x3b90('0x65')](function(_0x287be4){if(_0x287be4===_0x3b90('0x6e')){_0x3f71b0[_0x3b90('0x3d')](_0x3b90('0x6f'),[][_0x3b90('0x70')](_0x143698['query'][_0x287be4]));}else if(_0x287be4==='createdAt'){var _0x3e5532=JSON['parse'](_0x143698[_0x3b90('0x31')][_0x287be4])['$gte'];var _0x1a6d33=JSON['parse'](_0x143698['query'][_0x287be4])['$lte'];_0x3f71b0[_0x3b90('0x3d')](_0x3b90('0x71'),_0x3e5532,_0x1a6d33);}else{if(_0x143698[_0x3b90('0x31')][_0x287be4]===_0x3b90('0x72')){_0x3f71b0[_0x3b90('0x3d')]('i.'+_0x287be4+_0x3b90('0x73'));}else{_0x3f71b0[_0x3b90('0x3d')]('i.'+_0x287be4+'\x20=\x20?',_0x143698['query'][_0x287be4]);}}});}if(_0x143698['query'][_0x3b90('0x74')]){if(_0x143698[_0x3b90('0x31')]['read']==0x1){_0x3f71b0[_0x3b90('0x57')](_0x3b90('0x75'));}else{_0x3f71b0[_0x3b90('0x57')](_0x3b90('0x76'));}}if(_0x143698[_0x3b90('0x31')][_0x3b90('0x77')]){_0x291279=_[_0x3b90('0x78')](_0x143698[_0x3b90('0x31')][_0x3b90('0x77')])?_0x143698['query'][_0x3b90('0x77')]:new Array(_0x143698['query'][_0x3b90('0x77')]);_0x291279[_0x3b90('0x65')](function(_0x4b2c0f){_0x18d59b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4b2c0f+',%');});}if(_0x143698[_0x3b90('0x31')][_0x3b90('0x79')]){var _0x3f0f85=_0x143698[_0x3b90('0x31')][_0x3b90('0x79')][_0x3b90('0x7a')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x3b90('0x7b'));if(qs[_0x3b90('0x7c')](_0x3f0f85)){_0x5d7333['or'](_0x3b90('0x7d'),_0x3f0f85+'%')['or']('i.phone\x20LIKE\x20?',_0x3f0f85+'%');}else{_0x5d7333['or'](_0x3b90('0x7e'),qs['getFullTextValue'](_0x3f0f85))['or'](_0x3b90('0x7f'),_0x3f0f85+'%');}}}_0x3f71b0[_0x3b90('0x3d')](_0x5d7333);_0x3f71b0[_0x3b90('0x80')](_0x3b90('0x81'));var _0x15fc75={'type':db[_0x3b90('0x82')]['QueryTypes'][_0x3b90('0x83')],'raw':!![]};var _0x230567=_0x3f71b0[_0x3b90('0x84')]();_0x230567[_0x3b90('0x40')](_0x3b90('0x81'));_0x230567[_0x3b90('0x40')](_0x3b90('0x85'),_0x3b90('0x86'));if(_0x401dc5['order']){_0x401dc5[_0x3b90('0x3b')][_0x3b90('0x65')](function(_0xb0160f){_0x3f71b0[_0x3b90('0x3b')]('i.'+_0xb0160f[0x0],_0xb0160f[0x1]===_0x3b90('0x87')?![]:!![]);});}if(!_[_0x3b90('0x6d')](_0x291279)){_0x3f71b0[_0x3b90('0x57')](_0x18d59b);_0x230567[_0x3b90('0x3d')]('t.id\x20IN\x20?',_0x291279);}BPromise['resolve']()[_0x3b90('0x20')](function(){if(!_0x41e951){if(_0x143698[_0x3b90('0x31')][_0x3b90('0x6e')]||_0x143698['query'][_0x3b90('0x88')])return;_0x230567['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x3f71b0[_0x3b90('0x3d')](_0x3b90('0x89'));return;}return _0x143698[_0x3b90('0x8a')][_0x3b90('0x8b')]({'attributes':['id'],'raw':!![]})[_0x3b90('0x20')](function(_0x133c91){if(_[_0x3b90('0x6d')](_0x133c91)){_0x230567[_0x3b90('0x3d')](_0x3b90('0x8c'));_0x3f71b0[_0x3b90('0x3d')](_0x3b90('0x8c'));}else{_0x230567[_0x3b90('0x3d')](_0x3b90('0x6f'),_[_0x3b90('0x27')](_0x133c91,'id'));_0x3f71b0[_0x3b90('0x3d')]('i.SmsAccountId\x20IN\x20?',_[_0x3b90('0x27')](_0x133c91,'id'));}});})[_0x3b90('0x20')](function(){db['sequelize'][_0x3b90('0x31')](_0x230567['toString'](),_0x15fc75)[_0x3b90('0x20')](function(_0x38fab0){_0x5a97fe[_0x3b90('0x8d')]=_0x38fab0['length'];if(_0x5a97fe[_0x3b90('0x8d')]===0x0)return[];return db[_0x3b90('0x8e')][_0x3b90('0x31')](_0x4d1157[_0x3b90('0x8f')](),_0x15fc75)[_0x3b90('0x20')](function(_0x15befb){_0x11698a=_[_0x3b90('0x90')](_0x15befb,'id');_0x15fc75=_[_0x3b90('0x91')](_0x15fc75,{'model':db[_0x3b90('0x92')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x143698[_0x3b90('0x31')][_0x3b90('0x36')]){_0x401dc5[_0x3b90('0x37')]['forEach'](function(_0x5546af){_0x3f71b0['field']('i.'+_0x5546af);});}else{_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x85'),_0x3b90('0x86'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x93'),_0x3b90('0x94'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x95'),_0x3b90('0x96'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x97'));_0x3f71b0['field']('c.firstName',_0x3b90('0x98'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x99'),_0x3b90('0x9a'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x9b'),_0x3b90('0x9c'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x9d'),_0x3b90('0x9e'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x9f'),_0x3b90('0xa0'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0xa1'),_0x3b90('0xa2'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0xa3'),'Owner.fullname');_0x3f71b0[_0x3b90('0x40')](_0x3b90('0xa4'),_0x3b90('0xa5'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0xa6'),'TagIds');}if(_0x401dc5[_0x3b90('0x19')])_0x3f71b0[_0x3b90('0x19')](_0x401dc5[_0x3b90('0x19')]);if(_0x401dc5[_0x3b90('0x18')])_0x3f71b0[_0x3b90('0x18')](_0x401dc5[_0x3b90('0x18')]);return db['sequelize'][_0x3b90('0x31')](_0x3f71b0['toString'](),_0x15fc75);})['then'](function(_0x25b369){_0x283419[_0x3b90('0x3d')](_0x3b90('0xa7'),_[_0x3b90('0x27')](_0x25b369,'id'));return db[_0x3b90('0x8e')]['query'](_0x283419[_0x3b90('0x8f')](),_0x15fc75)[_0x3b90('0x20')](function(_0x429cd0){var _0x14d21d=_[_0x3b90('0xa8')](_0x429cd0,_0x3b90('0xa9'));var _0x19b070=[];_0x25b369[_0x3b90('0x65')](function(_0x2c2e24){_0x19b070[_0x3b90('0x2c')](updateSmsInteraction(_0x2c2e24,_0x11698a,_0x14d21d));});return BPromise[_0x3b90('0xaa')](_0x19b070);});});})[_0x3b90('0x20')](function(_0x468342){_0x5a97fe[_0x3b90('0xab')]=_0x468342;return _0x5a97fe;})[_0x3b90('0x20')](respondWithFilteredResult(_0x64a5e,_0x401dc5));})[_0x3b90('0xac')](handleError(_0x64a5e,null));};exports['show']=function(_0x13e661,_0x9fcc2){var _0x27100a={'raw':![],'where':{'id':_0x13e661[_0x3b90('0xad')]['id']}},_0x3c1958={};_0x3c1958[_0x3b90('0x35')]=_['keys'](db[_0x3b90('0x92')][_0x3b90('0xae')]);_0x3c1958[_0x3b90('0x31')]=_[_0x3b90('0x32')](_0x13e661[_0x3b90('0x31')]);_0x3c1958['filters']=_[_0x3b90('0x34')](_0x3c1958[_0x3b90('0x35')],_0x3c1958[_0x3b90('0x31')]);_0x27100a[_0x3b90('0x37')]=_['intersection'](_0x3c1958['model'],qs[_0x3b90('0x36')](_0x13e661['query'][_0x3b90('0x36')]));_0x27100a[_0x3b90('0x37')]=_0x27100a[_0x3b90('0x37')][_0x3b90('0x38')]?_0x27100a[_0x3b90('0x37')]:_0x3c1958['model'];if(_0x13e661[_0x3b90('0x31')]['includeAll']){_0x27100a[_0x3b90('0xaf')]=[{'all':!![]}];}_0x27100a=_[_0x3b90('0x91')]({},_0x27100a,_0x13e661[_0x3b90('0xb0')]);return db['SmsInteraction'][_0x3b90('0x5f')](_0x27100a)[_0x3b90('0x20')](handleEntityNotFound(_0x9fcc2,null))[_0x3b90('0x20')](respondWithResult(_0x9fcc2,null))['catch'](handleError(_0x9fcc2,null));};exports[_0x3b90('0xb1')]=function(_0x1dbc3d,_0x290a14){return db['SmsInteraction'][_0x3b90('0xb1')](_0x1dbc3d[_0x3b90('0x6b')],{})[_0x3b90('0x20')](respondWithResult(_0x290a14,0xc9))[_0x3b90('0xac')](handleError(_0x290a14,null));};exports[_0x3b90('0x1f')]=function(_0x456452,_0x50396d){if(_0x456452['body']['id']){delete _0x456452['body']['id'];}return db[_0x3b90('0x92')]['find']({'where':{'id':_0x456452[_0x3b90('0xad')]['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x50396d,null))[_0x3b90('0x20')](saveUpdates(_0x456452[_0x3b90('0x6b')],null))[_0x3b90('0x20')](respondWithResult(_0x50396d,null))['catch'](handleError(_0x50396d,null));};exports[_0x3b90('0xb2')]=function(_0x4b23be,_0x74241a){return db[_0x3b90('0x92')][_0x3b90('0x5f')]({'where':{'id':_0x4b23be['params']['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x74241a,null))[_0x3b90('0x20')](removeEntity(_0x74241a,null))[_0x3b90('0xac')](handleError(_0x74241a,null));};exports[_0x3b90('0xb3')]=function(_0x1be56f,_0x39eb5e){return db[_0x3b90('0x92')][_0x3b90('0xb3')]()['then'](respondWithResult(_0x39eb5e,null))[_0x3b90('0xac')](handleError(_0x39eb5e,null));};exports['addMessage']=function(_0x152170,_0x171ac6,_0x337da6){return db[_0x3b90('0xb4')][_0x3b90('0x5f')]({'where':{'id':_0x152170[_0x3b90('0xad')]['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x171ac6,null))['then'](function(_0x50ab1f){if(_0x50ab1f){return _0x50ab1f[_0x3b90('0xb5')](_0x152170[_0x3b90('0x6b')][_0x3b90('0xb6')],_[_0x3b90('0xb7')](_0x152170['body'],['ids','id'])||{});}})[_0x3b90('0x20')](respondWithResult(_0x171ac6,null))[_0x3b90('0xac')](handleError(_0x171ac6,null));};exports['getMessages']=function(_0x2c22e9,_0x3346d9,_0xabc9f9){var _0x1d3d2e={'raw':![],'where':{}};var _0x2cef2f={};var _0x4490da={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x3b90('0xb8')]({'where':{'id':_0x2c22e9[_0x3b90('0xad')]['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x3346d9,null))[_0x3b90('0x20')](function(_0x13f288){if(_0x13f288){_0x2cef2f[_0x3b90('0x35')]=_[_0x3b90('0x32')](db[_0x3b90('0xb4')][_0x3b90('0xae')]);_0x2cef2f[_0x3b90('0x31')]=_[_0x3b90('0x32')](_0x2c22e9['query']);_0x2cef2f['filters']=_['intersection'](_0x2cef2f['model'],_0x2cef2f[_0x3b90('0x31')]);_0x1d3d2e[_0x3b90('0x37')]=_[_0x3b90('0x34')](_0x2cef2f[_0x3b90('0x35')],qs[_0x3b90('0x36')](_0x2c22e9[_0x3b90('0x31')][_0x3b90('0x36')]));_0x1d3d2e[_0x3b90('0x37')]=_0x1d3d2e[_0x3b90('0x37')]['length']?_0x1d3d2e[_0x3b90('0x37')]:_0x2cef2f['model'];if(!_0x2c22e9['query'][_0x3b90('0x39')](_0x3b90('0x3a'))){_0x1d3d2e[_0x3b90('0x19')]=qs[_0x3b90('0x19')](_0x2c22e9[_0x3b90('0x31')]['limit']);_0x1d3d2e[_0x3b90('0x18')]=qs['offset'](_0x2c22e9[_0x3b90('0x31')][_0x3b90('0x18')]);}_0x1d3d2e[_0x3b90('0x3b')]=qs[_0x3b90('0x3c')](_0x2c22e9[_0x3b90('0x31')][_0x3b90('0x3c')]);_0x1d3d2e[_0x3b90('0x3d')]=qs[_0x3b90('0x33')](_[_0x3b90('0x3e')](_0x2c22e9[_0x3b90('0x31')],_0x2cef2f['filters']));_0x1d3d2e[_0x3b90('0x3d')][_0x3b90('0xa9')]=_0x13f288['id'];if(_0x2c22e9[_0x3b90('0x31')][_0x3b90('0x79')]){_0x1d3d2e[_0x3b90('0x3d')]=_[_0x3b90('0x91')](_0x1d3d2e[_0x3b90('0x3d')],{'$or':_[_0x3b90('0x27')](_0x1d3d2e[_0x3b90('0x37')],function(_0x383979){var _0xc4bb54={};_0xc4bb54[_0x383979]={'$like':'%'+_0x2c22e9['query'][_0x3b90('0x79')]+'%'};return _0xc4bb54;})});}if(_0x2c22e9[_0x3b90('0x31')]['$gte']){var _0x3c042e=_0x2c22e9[_0x3b90('0x31')][_0x3b90('0xb9')][_0x3b90('0x2b')](',');var _0x57b104={};_0x57b104[_0x3c042e[0x0]]={'$gte':moment(_0x3c042e[0x1])[_0x3b90('0xba')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1d3d2e['where']=_['merge'](_0x1d3d2e['where'],_0x57b104);}_0x1d3d2e=_[_0x3b90('0x91')]({},_0x1d3d2e,_0x2c22e9[_0x3b90('0xb0')]);return db[_0x3b90('0xb4')][_0x3b90('0x8d')]({'where':_0x1d3d2e[_0x3b90('0x3d')]})[_0x3b90('0x20')](function(_0x22ead2){_0x4490da[_0x3b90('0x8d')]=_0x22ead2;if(_0x2c22e9['query'][_0x3b90('0xbb')]){_0x1d3d2e[_0x3b90('0xaf')]=[{'all':!![]}];}return db['SmsMessage'][_0x3b90('0xbc')](_0x1d3d2e);})[_0x3b90('0x20')](function(_0x54bbba){_0x4490da[_0x3b90('0xab')]=_0x54bbba;return _0x4490da;});}})['then'](respondWithFilteredResult(_0x3346d9,_0x1d3d2e))[_0x3b90('0xac')](handleError(_0x3346d9,null));};exports['addTags']=function(_0x293642,_0x293197,_0x5b9fd1){return db['SmsInteraction'][_0x3b90('0x5f')]({'where':{'id':_0x293642[_0x3b90('0xad')]['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x293197,null))['then'](function(_0x27f114){if(_0x27f114){return _0x27f114['setTags'](_0x293642[_0x3b90('0x6b')]['ids'],_[_0x3b90('0xb7')](_0x293642[_0x3b90('0x6b')],[_0x3b90('0xb6'),'id'])||{})[_0x3b90('0xbd')](function(){return db[_0x3b90('0x64')][_0x3b90('0xbc')]({'attributes':['id','name',_0x3b90('0x41')],'where':{'id':_0x293642[_0x3b90('0x6b')]['ids']}});})[_0x3b90('0x20')](function(_0x379031){socket[_0x3b90('0xbe')](_0x3b90('0xbf'),{'id':Number(_0x293642['params']['id']),'tags':_0x379031||[]});return{'id':Number(_0x293642['params']['id']),'tags':_0x379031||[]};});}})[_0x3b90('0x20')](respondWithResult(_0x293197,null))[_0x3b90('0xac')](handleError(_0x293197,null));};exports['removeTags']=function(_0x4fe659,_0x352adc,_0x105b8e){return db[_0x3b90('0x92')]['find']({'where':{'id':_0x4fe659[_0x3b90('0xad')]['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x352adc,null))[_0x3b90('0x20')](function(_0x1b6c29){if(_0x1b6c29){return _0x1b6c29[_0x3b90('0xc0')](_0x4fe659[_0x3b90('0x31')][_0x3b90('0xb6')]);}})['then'](respondWithStatusCode(_0x352adc,null))[_0x3b90('0xac')](handleError(_0x352adc,null));};exports[_0x3b90('0xc1')]=function(_0xd84ba2,_0x364f0e){var _0x450a46=moment()[_0x3b90('0xc2')]()['toString']();var _0x4f154f=path[_0x3b90('0xc3')](config[_0x3b90('0xc4')],_0x3b90('0xc5'),_0x3b90('0xc6'),_0x3b90('0xc7'));var _0x5ce783=path[_0x3b90('0xc3')](config[_0x3b90('0xc4')],'server',_0x3b90('0xc6'),_0x3b90('0xc8'));var _0x4e1dac=path[_0x3b90('0xc3')](_0x4f154f,_0x450a46);var _0xbc60a4=util['format']('transcript-%d-%s.zip',_0xd84ba2['params']['id'],_0x450a46);var _0x5a4736=path[_0x3b90('0xc3')](_0x4f154f,_0xbc60a4);var _0x368a65=[];_0x368a65[_0x3b90('0x2c')]({'model':db['User'],'as':_0x3b90('0x68'),'attributes':['id',_0x3b90('0x28')],'raw':!![]});_0x368a65[_0x3b90('0x2c')]({'model':db[_0x3b90('0xc9')],'as':_0x3b90('0x5a'),'attributes':['id',_0x3b90('0xca'),'lastName'],'raw':!![]});var _0x428fc7=[{'model':db['SmsMessage'],'as':_0x3b90('0xcb'),'attributes':['id',_0x3b90('0x6b'),'createdAt','direction',_0x3b90('0xcc'),_0x3b90('0x74')],'include':_0x368a65}];_0x428fc7[_0x3b90('0x2c')]({'model':db[_0x3b90('0xcd')],'as':_0x3b90('0xce'),'attributes':['id',_0x3b90('0x24')]});_0x428fc7[_0x3b90('0x2c')]({'model':db[_0x3b90('0x68')],'as':_0x3b90('0xcf'),'attributes':['id',_0x3b90('0x28')]});return db[_0x3b90('0x92')][_0x3b90('0x5f')]({'where':{'id':_0xd84ba2['params']['id']},'include':_0x428fc7})[_0x3b90('0x20')](handleEntityNotFound(_0x364f0e,null))[_0x3b90('0x20')](function(_0x318679){if(_0x318679){var _0x462a16=_0x318679[_0x3b90('0xd0')]({'plain':!![]});fs[_0x3b90('0xd1')](_0x4e1dac);var _0x53df48={'format':'A4','border':_0x3b90('0xd2'),'header':{'height':_0x3b90('0xd3'),'contents':{'first':_0x3b90('0xd4')}},'footer':{'height':'30px','contents':{'default':util[_0x3b90('0xba')](_0x3b90('0xd5'),util['format'](_0x3b90('0xd6'),_0x3b90('0xd7'),_0x462a16['id']),moment()[_0x3b90('0xba')](_0x3b90('0xd8'))['toString']())}}};var _0x222229={'channel':_0x3b90('0xd7'),'account':_0x462a16[_0x3b90('0xce')][_0x3b90('0x24')],'agent':_0x462a16['Owner']?_0x462a16[_0x3b90('0xcf')][_0x3b90('0x28')]:_0x3b90('0xd9'),'createdAt':moment(_0x462a16[_0x3b90('0xda')])[_0x3b90('0xba')](_0x3b90('0xdb'))[_0x3b90('0x8f')](),'closedAt':_0x462a16[_0x3b90('0xdc')]?moment(_0x462a16[_0x3b90('0xdd')])[_0x3b90('0xba')](_0x3b90('0xdb'))[_0x3b90('0x8f')]():'','disposition':_0x462a16[_0x3b90('0xde')],'messages':_(_0x462a16[_0x3b90('0xcb')])[_0x3b90('0x79')]({'secret':![]})[_0x3b90('0x27')](function(_0x427ce8){return{'date':moment(_0x427ce8['createdAt'])[_0x3b90('0xba')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3b90('0x8f')](),'sender':_0x427ce8[_0x3b90('0xdf')]===_0x3b90('0xe0')?_0x427ce8[_0x3b90('0x68')]?_0x427ce8[_0x3b90('0x68')][_0x3b90('0x28')]:_0x3b90('0xe1'):_0x427ce8[_0x3b90('0x5a')][_0x3b90('0xca')]+(_0x427ce8[_0x3b90('0x5a')][_0x3b90('0xe2')]?'\x20'+_0x427ce8[_0x3b90('0x5a')]['lastName']:''),'body':_0x427ce8['body'],'direction':_0x427ce8[_0x3b90('0xdf')]==='out'?'A':'C','secret':_0x427ce8[_0x3b90('0xcc')],'read':_0x427ce8[_0x3b90('0x74')]};})[_0x3b90('0x56')]()};return ejs[_0x3b90('0xe3')](path[_0x3b90('0xc3')](config[_0x3b90('0xc4')],'server',_0x3b90('0xe4'),_0x3b90('0xe5')),{'interaction':_0x222229})[_0x3b90('0x20')](function(_0x25a7b7){return new BPromise(function(_0x217be5,_0x46da40){pdf[_0x3b90('0xb1')](_0x25a7b7,_0x53df48)['toFile'](path['join'](_0x4e1dac,_0x3b90('0xe6')+_0x462a16['id']+'-'+_0x450a46+_0x3b90('0xe7')),function(_0x476605,_0x580cc3){if(_0x476605)return _0x46da40(_0x476605);_0x217be5(_0x580cc3);});});})[_0x3b90('0x20')](function(){return new BPromise(function(_0x1d5fe8,_0x115518){zipdir(_0x4e1dac,{'saveTo':_0x5a4736},function(_0x466166,_0x2e1a1e){if(_0x466166)return _0x115518(_0x466166);return _0x1d5fe8(_0x2e1a1e);});})[_0x3b90('0x20')](function(){return new BPromise(function(_0x1afa92,_0x49e993){rimraf(_0x4e1dac,function(_0x49c2cf){if(_0x49c2cf)_0x49e993(_0x49c2cf);return _0x1afa92();});});})[_0x3b90('0x20')](function(){return _0x364f0e[_0x3b90('0xc1')](_0x5a4736,_0xbc60a4,function(_0x175fe0){if(_0x175fe0){console[_0x3b90('0xe8')](_0x3b90('0xe9'),_0x175fe0);}else{fs[_0x3b90('0xea')](_0x5a4736);}});});});}else{return _0x364f0e[_0x3b90('0x21')](0xc8);}})['catch'](handleError(_0x364f0e,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 4ea7e88..7ddbdc9 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 _0x3c17=['Users','findAll','then','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','SmsInteraction','SmsMessage','setMaxListeners','save','remove','getUsers','setDataValue'];(function(_0x474e07,_0x223d57){var _0x53f32b=function(_0xbcf040){while(--_0xbcf040){_0x474e07['push'](_0x474e07['shift']());}};_0x53f32b(++_0x223d57);}(_0x3c17,0x1a1));var _0x73c1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3c17[_0x3bf83f];return _0x22c4a9;};'use strict';var EventEmitter=require(_0x73c1('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x73c1('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x73c1('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x73c1('0x3')](0x0);var events={'afterCreate':_0x73c1('0x4'),'afterUpdate':'update','afterDestroy':_0x73c1('0x5')};function emitEvent(_0xcbe17a){return function(_0x6b289e,_0x64f862,_0x48c943){_0x6b289e[_0x73c1('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4433e0){_0x6b289e[_0x73c1('0x7')](_0x73c1('0x8'),_0x4433e0['map'](function(_0x4921f0){return{'id':_0x4921f0['id']};}));return SmsMessage[_0x73c1('0x9')]({'where':{'SmsInteractionId':_0x6b289e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x73c1('0xa')](function(_0x400875){_0x6b289e[_0x73c1('0x7')](_0x73c1('0xb'),_0x400875[_0x73c1('0xc')]);SmsInteractionEvents[_0x73c1('0xd')](_0xcbe17a+':'+_0x6b289e['id'],_0x6b289e);SmsInteractionEvents['emit'](_0xcbe17a,_0x6b289e);_0x48c943(null);})['catch'](_0x48c943(null));};}for(var e in events){if(events[_0x73c1('0xe')](e)){var event=events[e];SmsInteraction[_0x73c1('0xf')](e,emitEvent(event));}}module[_0x73c1('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0xb647=['save','update','getUsers','then','setDataValue','Users','map','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners'];(function(_0x28e7a1,_0x56612e){var _0x50b1eb=function(_0x3a8ded){while(--_0x3a8ded){_0x28e7a1['push'](_0x28e7a1['shift']());}};_0x50b1eb(++_0x56612e);}(_0xb647,0xdb));var _0x7b64=function(_0x1a7543,_0x3936f8){_0x1a7543=_0x1a7543-0x0;var _0x232352=_0xb647[_0x1a7543];return _0x232352;};'use strict';var EventEmitter=require(_0x7b64('0x0'));var SmsInteraction=require(_0x7b64('0x1'))['db'][_0x7b64('0x2')];var SmsMessage=require(_0x7b64('0x1'))['db'][_0x7b64('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x7b64('0x4')](0x0);var events={'afterCreate':_0x7b64('0x5'),'afterUpdate':_0x7b64('0x6'),'afterDestroy':'remove'};function emitEvent(_0x36ff12){return function(_0x4aaa21,_0x1daa28,_0x38ebf7){_0x4aaa21[_0x7b64('0x7')]({'attributes':['id'],'raw':!![]})[_0x7b64('0x8')](function(_0xcdec41){_0x4aaa21[_0x7b64('0x9')](_0x7b64('0xa'),_0xcdec41[_0x7b64('0xb')](function(_0x432ced){return{'id':_0x432ced['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x4aaa21['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7b64('0x8')](function(_0x49718f){_0x4aaa21[_0x7b64('0x9')]('unreadMessages',_0x49718f['length']);SmsInteractionEvents[_0x7b64('0xc')](_0x36ff12+':'+_0x4aaa21['id'],_0x4aaa21);SmsInteractionEvents[_0x7b64('0xc')](_0x36ff12,_0x4aaa21);_0x38ebf7(null);})['catch'](_0x38ebf7(null));};}for(var e in events){if(events[_0x7b64('0xd')](e)){var event=events[e];SmsInteraction[_0x7b64('0xe')](e,emitEvent(event));}}module[_0x7b64('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index bb73a01..08cd5d7 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 _0x98dc=['SmsInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','request-promise','path','../../config/environment','./smsInteraction.attributes'];(function(_0x5b21c9,_0x4352ef){var _0x241785=function(_0x407bc2){while(--_0x407bc2){_0x5b21c9['push'](_0x5b21c9['shift']());}};_0x241785(++_0x4352ef);}(_0x98dc,0x19d));var _0xc98d=function(_0x68c802,_0x347f07){_0x68c802=_0x68c802-0x0;var _0x18422a=_0x98dc[_0x68c802];return _0x18422a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc98d('0x0'))(_0xc98d('0x1'));var moment=require(_0xc98d('0x2'));var BPromise=require('bluebird');var rp=require(_0xc98d('0x3'));var fs=require('fs');var path=require(_0xc98d('0x4'));var rimraf=require('rimraf');var config=require(_0xc98d('0x5'));var attributes=require(_0xc98d('0x6'));module['exports']=function(_0x2f2bc5,_0x540fac){return _0x2f2bc5['define'](_0xc98d('0x7'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1902f2,_0x3275de,_0x43a222){if(_0x1902f2[_0xc98d('0x8')]('closed')){_0x1902f2[_0xc98d('0x9')]=moment()[_0xc98d('0xa')](_0xc98d('0xb'));}_0x43a222(null,_0x1902f2);}}});}; \ No newline at end of file +var _0x8b00=['exports','define','SmsInteraction','sms_interactions','closed','closedAt','format','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes'];(function(_0x35e452,_0x3ea3f3){var _0x45de6e=function(_0x3ae2e1){while(--_0x3ae2e1){_0x35e452['push'](_0x35e452['shift']());}};_0x45de6e(++_0x3ea3f3);}(_0x8b00,0x1d2));var _0x08b0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8b00[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x08b0('0x0'));var util=require(_0x08b0('0x1'));var logger=require('../../config/logger')(_0x08b0('0x2'));var moment=require(_0x08b0('0x3'));var BPromise=require(_0x08b0('0x4'));var rp=require(_0x08b0('0x5'));var fs=require('fs');var path=require(_0x08b0('0x6'));var rimraf=require(_0x08b0('0x7'));var config=require(_0x08b0('0x8'));var attributes=require(_0x08b0('0x9'));module[_0x08b0('0xa')]=function(_0x2254fd,_0x545205){return _0x2254fd[_0x08b0('0xb')](_0x08b0('0xc'),attributes,{'tableName':_0x08b0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x56b123,_0x305297,_0x31eed1){if(_0x56b123['changed'](_0x08b0('0xe'))){_0x56b123[_0x08b0('0xf')]=moment()[_0x08b0('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x31eed1(null,_0x56b123);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 082c918..b50e269 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 _0x0581=['redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','then','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','SmsInteraction,\x20%s,\x20%s','message','error','info','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToSmsInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xb42cde,_0x2888c7){var _0xf0ca4f=function(_0x211d7){while(--_0x211d7){_0xb42cde['push'](_0xb42cde['shift']());}};_0xf0ca4f(++_0x2888c7);}(_0x0581,0x1a2));var _0x1058=function(_0x294726,_0x5db9e9){_0x294726=_0x294726-0x0;var _0x39e2e3=_0x0581[_0x294726];return _0x39e2e3;};'use strict';var _=require(_0x1058('0x0'));var util=require(_0x1058('0x1'));var moment=require(_0x1058('0x2'));var BPromise=require(_0x1058('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1058('0x4'))['db'];var utils=require(_0x1058('0x5'));var logger=require(_0x1058('0x6'))(_0x1058('0x7'));var config=require(_0x1058('0x8'));var jayson=require(_0x1058('0x9'));var client=jayson[_0x1058('0xa')][_0x1058('0xb')]({'port':0x232a});config[_0x1058('0xc')]=_[_0x1058('0xd')](config[_0x1058('0xc')],{'host':_0x1058('0xe'),'port':0x18eb});var socket=require(_0x1058('0xf'))(new Redis(config[_0x1058('0xc')]));require(_0x1058('0x10'))[_0x1058('0x11')](socket);function respondWithRpcPromise(_0x5e7ce2,_0x3dd57c,_0x22aeb6){return new BPromise(function(_0x41a607,_0x15b9d2){return client['request'](_0x5e7ce2,_0x22aeb6)[_0x1058('0x12')](function(_0x7535d5){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x3dd57c,_0x1058('0x13'));logger['debug'](_0x1058('0x14'),_0x3dd57c,_0x1058('0x13'),JSON[_0x1058('0x15')](_0x7535d5));if(_0x7535d5['error']){if(_0x7535d5['error']['code']===0x1f4){logger['error'](_0x1058('0x16'),_0x3dd57c,_0x7535d5['error'][_0x1058('0x17')]);return _0x15b9d2(_0x7535d5[_0x1058('0x18')][_0x1058('0x17')]);}logger[_0x1058('0x18')](_0x1058('0x16'),_0x3dd57c,_0x7535d5[_0x1058('0x18')][_0x1058('0x17')]);return _0x41a607(_0x7535d5[_0x1058('0x18')][_0x1058('0x17')]);}else{logger[_0x1058('0x19')](_0x1058('0x16'),_0x3dd57c,_0x1058('0x13'));_0x41a607(_0x7535d5['result'][_0x1058('0x17')]);}})[_0x1058('0x1a')](function(_0x59e204){logger['error'](_0x1058('0x16'),_0x3dd57c,_0x59e204);_0x15b9d2(_0x59e204);});});}exports[_0x1058('0x1b')]=function(_0x458801){var _0x2a480d=this;return new Promise(function(_0x5eb104,_0x1c9bb3){return db[_0x1058('0x1c')][_0x1058('0x1d')](_0x458801[_0x1058('0x1e')],{'raw':_0x458801[_0x1058('0x1f')]?_0x458801[_0x1058('0x1f')][_0x1058('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x458801[_0x1058('0x1f')]?_0x458801['options'][_0x1058('0x21')]||null:null,'attributes':_0x458801[_0x1058('0x1f')]?_0x458801['options'][_0x1058('0x22')]||null:null,'limit':_0x458801[_0x1058('0x1f')]?_0x458801[_0x1058('0x1f')][_0x1058('0x23')]||null:null})[_0x1058('0x12')](function(_0x3109cb){logger[_0x1058('0x19')](_0x1058('0x1b'),_0x458801);logger[_0x1058('0x24')](_0x1058('0x1b'),_0x458801,JSON[_0x1058('0x15')](_0x3109cb));_0x5eb104(_0x3109cb);})[_0x1058('0x1a')](function(_0x59c33c){logger[_0x1058('0x18')](_0x1058('0x1b'),_0x59c33c[_0x1058('0x17')],_0x458801);_0x1c9bb3(_0x2a480d[_0x1058('0x18')](0x1f4,_0x59c33c[_0x1058('0x17')]));});});};exports[_0x1058('0x25')]=function(_0x22b4bf){return new Promise(function(_0x796b4c,_0x35b950){return db[_0x1058('0x1c')][_0x1058('0x26')]({'where':_0x22b4bf[_0x1058('0x1f')]?_0x22b4bf[_0x1058('0x1f')]['where']||null:null})[_0x1058('0x12')](function(_0x40fd63){if(_0x40fd63){return _0x40fd63['addTags'](_0x22b4bf['body'][_0x1058('0x27')],_[_0x1058('0x28')](_0x22b4bf[_0x1058('0x1e')],['ids','id'])||{});}})[_0x1058('0x29')](function(_0x5a0760){logger[_0x1058('0x19')](_0x1058('0x2a'),_0x22b4bf);logger[_0x1058('0x24')](_0x1058('0x2a'),_0x22b4bf,JSON[_0x1058('0x15')](_0x5a0760));_0x796b4c(_0x5a0760);})[_0x1058('0x1a')](function(_0x227c59){logger[_0x1058('0x18')]('AddTags',_0x227c59['message'],_0x22b4bf);_0x35b950(_this['error'](0x1f4,_0x227c59[_0x1058('0x17')]));});});}; \ No newline at end of file +var _0x39fb=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsInteraction,\x20%s,\x20%s','catch','UpdateSmsInteraction','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','SmsInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x39fb,0x1f2));var _0xb39f=function(_0x1444dd,_0x4494de){_0x1444dd=_0x1444dd-0x0;var _0x37035d=_0x39fb[_0x1444dd];return _0x37035d;};'use strict';var _=require(_0xb39f('0x0'));var util=require(_0xb39f('0x1'));var moment=require(_0xb39f('0x2'));var BPromise=require(_0xb39f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb39f('0x4'));var db=require(_0xb39f('0x5'))['db'];var utils=require(_0xb39f('0x6'));var logger=require(_0xb39f('0x7'))('rpc');var config=require(_0xb39f('0x8'));var jayson=require(_0xb39f('0x9'));var client=jayson[_0xb39f('0xa')]['http']({'port':0x232a});config[_0xb39f('0xb')]=_[_0xb39f('0xc')](config[_0xb39f('0xb')],{'host':_0xb39f('0xd'),'port':0x18eb});var socket=require(_0xb39f('0xe'))(new Redis(config[_0xb39f('0xb')]));require('./smsInteraction.socket')[_0xb39f('0xf')](socket);function respondWithRpcPromise(_0x507f35,_0x333e46,_0x2d88ff){return new BPromise(function(_0x3d8631,_0x3fdbc5){return client[_0xb39f('0x10')](_0x507f35,_0x2d88ff)[_0xb39f('0x11')](function(_0x3df41d){logger[_0xb39f('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x333e46,_0xb39f('0x13'));logger[_0xb39f('0x14')](_0xb39f('0x15'),_0x333e46,_0xb39f('0x13'),JSON[_0xb39f('0x16')](_0x3df41d));if(_0x3df41d[_0xb39f('0x17')]){if(_0x3df41d[_0xb39f('0x17')][_0xb39f('0x18')]===0x1f4){logger[_0xb39f('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x333e46,_0x3df41d['error'][_0xb39f('0x19')]);return _0x3fdbc5(_0x3df41d['error'][_0xb39f('0x19')]);}logger[_0xb39f('0x17')](_0xb39f('0x1a'),_0x333e46,_0x3df41d[_0xb39f('0x17')][_0xb39f('0x19')]);return _0x3d8631(_0x3df41d[_0xb39f('0x17')]['message']);}else{logger[_0xb39f('0x12')](_0xb39f('0x1a'),_0x333e46,'request\x20sent');_0x3d8631(_0x3df41d['result'][_0xb39f('0x19')]);}})[_0xb39f('0x1b')](function(_0xb1d06e){logger[_0xb39f('0x17')](_0xb39f('0x1a'),_0x333e46,_0xb1d06e);_0x3fdbc5(_0xb1d06e);});});}exports[_0xb39f('0x1c')]=function(_0x58cd74){var _0x166f18=this;return new Promise(function(_0x2b3d15,_0xe92742){return db['SmsInteraction']['update'](_0x58cd74[_0xb39f('0x1d')],{'raw':_0x58cd74[_0xb39f('0x1e')]?_0x58cd74[_0xb39f('0x1e')][_0xb39f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58cd74[_0xb39f('0x1e')]?_0x58cd74[_0xb39f('0x1e')][_0xb39f('0x20')]||null:null,'attributes':_0x58cd74[_0xb39f('0x1e')]?_0x58cd74[_0xb39f('0x1e')][_0xb39f('0x21')]||null:null,'limit':_0x58cd74[_0xb39f('0x1e')]?_0x58cd74[_0xb39f('0x1e')][_0xb39f('0x22')]||null:null})[_0xb39f('0x11')](function(_0x59df2f){logger[_0xb39f('0x12')](_0xb39f('0x1c'),_0x58cd74);logger[_0xb39f('0x14')]('UpdateSmsInteraction',_0x58cd74,JSON[_0xb39f('0x16')](_0x59df2f));_0x2b3d15(_0x59df2f);})[_0xb39f('0x1b')](function(_0x15975f){logger[_0xb39f('0x17')](_0xb39f('0x1c'),_0x15975f[_0xb39f('0x19')],_0x58cd74);_0xe92742(_0x166f18[_0xb39f('0x17')](0x1f4,_0x15975f['message']));});});};exports[_0xb39f('0x23')]=function(_0xb6fe7f){return new Promise(function(_0x20367c,_0x1fbc31){return db[_0xb39f('0x24')][_0xb39f('0x25')]({'where':_0xb6fe7f[_0xb39f('0x1e')]?_0xb6fe7f[_0xb39f('0x1e')][_0xb39f('0x20')]||null:null})[_0xb39f('0x11')](function(_0x591e7c){if(_0x591e7c){return _0x591e7c['addTags'](_0xb6fe7f[_0xb39f('0x1d')][_0xb39f('0x26')],_[_0xb39f('0x27')](_0xb6fe7f[_0xb39f('0x1d')],[_0xb39f('0x26'),'id'])||{});}})[_0xb39f('0x28')](function(_0x483883){logger[_0xb39f('0x12')]('AddTags',_0xb6fe7f);logger[_0xb39f('0x14')](_0xb39f('0x29'),_0xb6fe7f,JSON[_0xb39f('0x16')](_0x483883));_0x20367c(_0x483883);})[_0xb39f('0x1b')](function(_0x353b9e){logger[_0xb39f('0x17')](_0xb39f('0x29'),_0x353b9e[_0xb39f('0x19')],_0xb6fe7f);_0x1fbc31(_this['error'](0x1f4,_0x353b9e[_0xb39f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 6249a41..52d854e 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 _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x3a6ad5,_0x3b84d8){var _0xc08e2a=function(_0x425836){while(--_0x425836){_0x3a6ad5['push'](_0x3a6ad5['shift']());}};_0xc08e2a(++_0x3b84d8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x258d6e,_0x54387b){var _0x1654f2=function(_0x1d58a7){while(--_0x1d58a7){_0x258d6e['push'](_0x258d6e['shift']());}};_0x1654f2(++_0x54387b);}(_0xb10b,0x12a));var _0xbb10=function(_0xa3d957,_0x5cefc3){_0xa3d957=_0xa3d957-0x0;var _0x1f2f67=_0xb10b[_0xa3d957];return _0x1f2f67;};'use strict';var SmsInteractionEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){SmsInteractionEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);SmsInteractionEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 26e577e..4346276 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 _0x8e0f=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','smsmessage:create','create','post','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','util','connect-timeout','express','Router'];(function(_0xd803c0,_0x1b569d){var _0x519057=function(_0x67093e){while(--_0x67093e){_0xd803c0['push'](_0xd803c0['shift']());}};_0x519057(++_0x1b569d);}(_0x8e0f,0x98));var _0xf8e0=function(_0x191cdc,_0x6973f6){_0x191cdc=_0x191cdc-0x0;var _0x4422fa=_0x8e0f[_0x191cdc];return _0x4422fa;};'use strict';var multer=require('multer');var util=require(_0xf8e0('0x0'));var path=require('path');var timeout=require(_0xf8e0('0x1'));var express=require(_0xf8e0('0x2'));var router=express[_0xf8e0('0x3')]();var auth=require(_0xf8e0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf8e0('0x5'));var controller=require('./smsMessage.controller');router[_0xf8e0('0x6')]('/',auth[_0xf8e0('0x7')](),controller[_0xf8e0('0x8')]);router[_0xf8e0('0x6')](_0xf8e0('0x9'),auth[_0xf8e0('0x7')](),controller[_0xf8e0('0xa')]);router[_0xf8e0('0x6')](_0xf8e0('0xb'),auth[_0xf8e0('0x7')](),controller[_0xf8e0('0xc')]);router['post']('/',auth[_0xf8e0('0x7')](),interaction['tracked']('sms',_0xf8e0('0xd')),controller[_0xf8e0('0xe')]);router[_0xf8e0('0xf')](_0xf8e0('0x10'),controller[_0xf8e0('0x11')]);router[_0xf8e0('0x12')](_0xf8e0('0xb'),auth[_0xf8e0('0x7')](),controller[_0xf8e0('0x13')]);router[_0xf8e0('0x12')](_0xf8e0('0x14'),auth[_0xf8e0('0x7')](),controller[_0xf8e0('0x15')]);router[_0xf8e0('0x12')](_0xf8e0('0x16'),auth['isAuthenticated'](),controller[_0xf8e0('0x17')]);router[_0xf8e0('0x18')](_0xf8e0('0xb'),auth[_0xf8e0('0x7')](),controller['destroy']);module[_0xf8e0('0x19')]=router; \ No newline at end of file +var _0x9a50=['create','post','status','put','update','reject','delete','destroy','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','smsmessage:create'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9a50,0x1eb));var _0x09a5=function(_0xa711b,_0x81a280){_0xa711b=_0xa711b-0x0;var _0x1f061d=_0x9a50[_0xa711b];return _0x1f061d;};'use strict';var multer=require('multer');var util=require(_0x09a5('0x0'));var path=require(_0x09a5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x09a5('0x2')]();var auth=require(_0x09a5('0x3'));var interaction=require(_0x09a5('0x4'));var config=require(_0x09a5('0x5'));var controller=require(_0x09a5('0x6'));router[_0x09a5('0x7')]('/',auth[_0x09a5('0x8')](),controller[_0x09a5('0x9')]);router[_0x09a5('0x7')](_0x09a5('0xa'),auth[_0x09a5('0x8')](),controller[_0x09a5('0xb')]);router[_0x09a5('0x7')](_0x09a5('0xc'),auth[_0x09a5('0x8')](),controller[_0x09a5('0xd')]);router['post']('/',auth[_0x09a5('0x8')](),interaction['tracked']('sms',_0x09a5('0xe')),controller[_0x09a5('0xf')]);router[_0x09a5('0x10')]('/:id/status',controller[_0x09a5('0x11')]);router[_0x09a5('0x12')](_0x09a5('0xc'),auth[_0x09a5('0x8')](),controller[_0x09a5('0x13')]);router[_0x09a5('0x12')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x09a5('0x12')]('/:id/reject',auth[_0x09a5('0x8')](),controller[_0x09a5('0x14')]);router[_0x09a5('0x15')](_0x09a5('0xc'),auth[_0x09a5('0x8')](),controller[_0x09a5('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index d5b3bbb..4573728 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 _0x2b2d=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x56c936,_0x4042a9){var _0x45c055=function(_0x958cc5){while(--_0x958cc5){_0x56c936['push'](_0x56c936['shift']());}};_0x45c055(++_0x4042a9);}(_0x2b2d,0x1ad));var _0xd2b2=function(_0x58f555,_0x552ef2){_0x58f555=_0x58f555-0x0;var _0x4eb99b=_0x2b2d[_0x58f555];return _0x4eb99b;};'use strict';var Sequelize=require(_0xd2b2('0x0'));module[_0xd2b2('0x1')]={'body':{'type':Sequelize[_0xd2b2('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd2b2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd2b2('0x4')]('in',_0xd2b2('0x5')),'defaultValue':_0xd2b2('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd2b2('0x6')](0xbe)},'phone':{'type':Sequelize[_0xd2b2('0x6')]},'readAt':{'type':Sequelize[_0xd2b2('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc4f5=['out','STRING','DATE','TEXT','BOOLEAN','ENUM'];(function(_0x1f6ba3,_0x5b7a1d){var _0x218b24=function(_0x1fc7d7){while(--_0x1fc7d7){_0x1f6ba3['push'](_0x1f6ba3['shift']());}};_0x218b24(++_0x5b7a1d);}(_0xc4f5,0x75));var _0x5c4f=function(_0x273bb2,_0x319264){_0x273bb2=_0x273bb2-0x0;var _0x22f932=_0xc4f5[_0x273bb2];return _0x22f932;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x5c4f('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5c4f('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5c4f('0x2')]('in',_0x5c4f('0x3')),'defaultValue':_0x5c4f('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5c4f('0x4')](0xbe)},'phone':{'type':Sequelize[_0x5c4f('0x4')]},'readAt':{'type':Sequelize[_0x5c4f('0x5')]},'secret':{'type':Sequelize[_0x5c4f('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 96468c1..3bbb75b 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 _0x93ed=['redis','defaults','localhost','socket.io-emitter','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','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','offset','limit','status','set','Content-Range','json','save','update','destroy','stack','name','send','index','map','SmsMessage','fieldName','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','then','count','include','findAll','rows','show','keys','rawAttributes','fields','length','find','create','body','params','describe','sms-interactions','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','SmsInteraction','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3e0dc4,_0x13971b){var _0x586111=function(_0x123c53){while(--_0x123c53){_0x3e0dc4['push'](_0x3e0dc4['shift']());}};_0x586111(++_0x13971b);}(_0x93ed,0xfe));var _0xd93e=function(_0x1d0b74,_0x2b9295){_0x1d0b74=_0x1d0b74-0x0;var _0x1c18e7=_0x93ed[_0x1d0b74];return _0x1c18e7;};'use strict';var pdf=require(_0xd93e('0x0'));var emlformat=require(_0xd93e('0x1'));var rimraf=require(_0xd93e('0x2'));var zipdir=require(_0xd93e('0x3'));var jsonpatch=require(_0xd93e('0x4'));var rp=require('request-promise');var moment=require(_0xd93e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd93e('0x6'));var util=require(_0xd93e('0x7'));var path=require('path');var sox=require(_0xd93e('0x8'));var csv=require(_0xd93e('0x9'));var ejs=require(_0xd93e('0xa'));var fs=require('fs');var _=require(_0xd93e('0xb'));var squel=require(_0xd93e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd93e('0xd'));var toCsv=require(_0xd93e('0x9'));var querystring=require(_0xd93e('0xe'));var Papa=require(_0xd93e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd93e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd93e('0x11'));var logger=require(_0xd93e('0x12'))(_0xd93e('0x13'));var utils=require(_0xd93e('0x14'));var config=require(_0xd93e('0x15'));var db=require('../../mysqldb')['db'];config[_0xd93e('0x16')]=_[_0xd93e('0x17')](config[_0xd93e('0x16')],{'host':_0xd93e('0x18'),'port':0x18eb});var socket=require(_0xd93e('0x19'))(new Redis(config['redis']));require('./smsMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xd93e('0x1a')][_0xd93e('0x1b')]({'port':0x232c});var client9002=jayson[_0xd93e('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0xc53b90,_0x490bc0,_0x1826b8){if(_0x1826b8){var _0x164238=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x164238[_0xd93e('0x1c')](_0x490bc0)){return _0xc53b90;}else{throw new db[(_0xd93e('0x1d'))][(_0xd93e('0x1e'))](_0xd93e('0x1f'));}}else{return _0xc53b90;}}function respondWithRpcPromise(_0x433ced,_0x54b6a1,_0x50c196,_0x54d919){return new BPromise(function(_0x2e9fff,_0x9896c8){var _0x412cf4=_0x54d919||client;return _0x412cf4['request'](_0x433ced,_0x50c196)['then'](function(_0x332d46){logger[_0xd93e('0x20')](_0xd93e('0x21'),_0x54b6a1,_0xd93e('0x22'));logger['debug'](_0xd93e('0x23'),_0x54b6a1,_0xd93e('0x22'),JSON[_0xd93e('0x24')](_0x332d46));if(_0x332d46[_0xd93e('0x25')]){if(_0x332d46[_0xd93e('0x25')]['code']===0x1f4){logger['error'](_0xd93e('0x21'),_0x54b6a1,_0x332d46[_0xd93e('0x25')][_0xd93e('0x26')]);return _0x9896c8(_0x332d46[_0xd93e('0x25')][_0xd93e('0x26')]);}logger[_0xd93e('0x25')](_0xd93e('0x21'),_0x54b6a1,_0x332d46[_0xd93e('0x25')][_0xd93e('0x26')]);return _0x2e9fff(_0x332d46[_0xd93e('0x25')][_0xd93e('0x26')]);}else{logger['info'](_0xd93e('0x21'),_0x54b6a1,'request\x20sent');_0x2e9fff(_0x332d46['result'][_0xd93e('0x26')]);}})[_0xd93e('0x27')](function(_0x5aaa9a){logger[_0xd93e('0x25')](_0xd93e('0x21'),_0x54b6a1,_0x5aaa9a);_0x9896c8(_0x5aaa9a);});});}function respondWithStatusCode(_0xa21e2d,_0x49ae2c){_0x49ae2c=_0x49ae2c||0xcc;return function(_0x46bbf0){if(_0x46bbf0){return _0xa21e2d[_0xd93e('0x28')](_0x49ae2c);}return _0xa21e2d['status'](_0x49ae2c)[_0xd93e('0x29')]();};}function respondWithResult(_0x131a9c,_0x49dae){_0x49dae=_0x49dae||0xc8;return function(_0x41c479){if(_0x41c479){return _0x131a9c['status'](_0x49dae)['json'](_0x41c479);}};}function respondWithFilteredResult(_0x567f94,_0x149209){return function(_0x3baf51){if(_0x3baf51){var _0x23c1b4=_0x3baf51['count'],_0x23de8e=_0x149209[_0xd93e('0x2a')],_0x374b4b=_0x149209['offset']+_0x149209[_0xd93e('0x2b')],_0x3f2150;if(_0x374b4b>=_0x23c1b4){_0x374b4b=_0x23c1b4;_0x3f2150=0xc8;}else{_0x3f2150=0xce;}_0x567f94[_0xd93e('0x2c')](_0x3f2150);return _0x567f94[_0xd93e('0x2d')](_0xd93e('0x2e'),_0x23de8e+'-'+_0x374b4b+'/'+_0x23c1b4)[_0xd93e('0x2f')](_0x3baf51);}return null;};}function patchUpdates(_0x5976d7){return function(_0x5d0fa1){try{jsonpatch['apply'](_0x5d0fa1,_0x5976d7,!![]);}catch(_0x4dd4c4){return BPromise['reject'](_0x4dd4c4);}return _0x5d0fa1[_0xd93e('0x30')]();};}function saveUpdates(_0x242224,_0x225029){return function(_0x589412){if(_0x589412){return _0x589412[_0xd93e('0x31')](_0x242224)['then'](function(_0x599f40){return _0x599f40;});}return null;};}function removeEntity(_0x136176,_0x45a3b6){return function(_0x1fd176){if(_0x1fd176){return _0x1fd176[_0xd93e('0x32')]()['then'](function(){_0x136176['status'](0xcc)[_0xd93e('0x29')]();});}};}function handleEntityNotFound(_0x18e59e,_0x23a4c7){return function(_0x578c0d){if(!_0x578c0d){_0x18e59e[_0xd93e('0x28')](0x194);}return _0x578c0d;};}function handleError(_0xd74f43,_0x4f79d4){_0x4f79d4=_0x4f79d4||0x1f4;return function(_0x5082cc){logger['error'](_0x5082cc[_0xd93e('0x33')]);if(_0x5082cc[_0xd93e('0x34')]){delete _0x5082cc[_0xd93e('0x34')];}_0xd74f43[_0xd93e('0x2c')](_0x4f79d4)[_0xd93e('0x35')](_0x5082cc);};}exports[_0xd93e('0x36')]=function(_0x9da605,_0x58979c){var _0xe7bf82={},_0x5db929={},_0x3de507={'count':0x0,'rows':[]};var _0x593a35=_[_0xd93e('0x37')](db[_0xd93e('0x38')]['rawAttributes'],function(_0x341010){return{'name':_0x341010[_0xd93e('0x39')],'type':_0x341010['type'][_0xd93e('0x3a')]};});_0x5db929[_0xd93e('0x3b')]=_[_0xd93e('0x37')](_0x593a35,'name');_0x5db929['query']=_['keys'](_0x9da605[_0xd93e('0x3c')]);_0x5db929[_0xd93e('0x3d')]=_[_0xd93e('0x3e')](_0x5db929[_0xd93e('0x3b')],_0x5db929[_0xd93e('0x3c')]);_0xe7bf82[_0xd93e('0x3f')]=_[_0xd93e('0x3e')](_0x5db929[_0xd93e('0x3b')],qs['fields'](_0x9da605[_0xd93e('0x3c')]['fields']));_0xe7bf82[_0xd93e('0x3f')]=_0xe7bf82[_0xd93e('0x3f')]['length']?_0xe7bf82[_0xd93e('0x3f')]:_0x5db929[_0xd93e('0x3b')];if(!_0x9da605[_0xd93e('0x3c')][_0xd93e('0x40')](_0xd93e('0x41'))){_0xe7bf82['limit']=qs[_0xd93e('0x2b')](_0x9da605[_0xd93e('0x3c')][_0xd93e('0x2b')]);_0xe7bf82['offset']=qs[_0xd93e('0x2a')](_0x9da605['query']['offset']);}_0xe7bf82[_0xd93e('0x42')]=qs[_0xd93e('0x43')](_0x9da605[_0xd93e('0x3c')]['sort']);_0xe7bf82['where']=qs[_0xd93e('0x3d')](_[_0xd93e('0x44')](_0x9da605[_0xd93e('0x3c')],_0x5db929[_0xd93e('0x3d')]),_0x593a35);if(_0x9da605['query']['filter']){_0xe7bf82[_0xd93e('0x45')]=_[_0xd93e('0x46')](_0xe7bf82[_0xd93e('0x45')],{'$or':_[_0xd93e('0x37')](_0x593a35,function(_0x319723){if(_0x319723[_0xd93e('0x47')]!==_0xd93e('0x48')){var _0x53d058={};_0x53d058[_0x319723[_0xd93e('0x34')]]={'$like':'%'+_0x9da605[_0xd93e('0x3c')][_0xd93e('0x49')]+'%'};return _0x53d058;}})});}_0xe7bf82=_[_0xd93e('0x46')]({},_0xe7bf82,_0x9da605[_0xd93e('0x4a')]);var _0x47d7d3={'where':_0xe7bf82[_0xd93e('0x45')]};return db[_0xd93e('0x38')]['count'](_0x47d7d3)[_0xd93e('0x4b')](function(_0x437851){_0x3de507[_0xd93e('0x4c')]=_0x437851;if(_0x9da605[_0xd93e('0x3c')]['includeAll']){_0xe7bf82[_0xd93e('0x4d')]=[{'all':!![]}];}return db['SmsMessage'][_0xd93e('0x4e')](_0xe7bf82);})[_0xd93e('0x4b')](function(_0x340f7c){_0x3de507[_0xd93e('0x4f')]=_0x340f7c;return _0x3de507;})[_0xd93e('0x4b')](respondWithFilteredResult(_0x58979c,_0xe7bf82))['catch'](handleError(_0x58979c,null));};exports[_0xd93e('0x50')]=function(_0x419004,_0x3a2fe6){var _0x1cc0cd={'raw':!![],'where':{'id':_0x419004['params']['id']}},_0xddb2ad={};_0xddb2ad[_0xd93e('0x3b')]=_[_0xd93e('0x51')](db[_0xd93e('0x38')][_0xd93e('0x52')]);_0xddb2ad['query']=_['keys'](_0x419004[_0xd93e('0x3c')]);_0xddb2ad[_0xd93e('0x3d')]=_[_0xd93e('0x3e')](_0xddb2ad[_0xd93e('0x3b')],_0xddb2ad[_0xd93e('0x3c')]);_0x1cc0cd[_0xd93e('0x3f')]=_[_0xd93e('0x3e')](_0xddb2ad[_0xd93e('0x3b')],qs['fields'](_0x419004['query'][_0xd93e('0x53')]));_0x1cc0cd['attributes']=_0x1cc0cd[_0xd93e('0x3f')][_0xd93e('0x54')]?_0x1cc0cd[_0xd93e('0x3f')]:_0xddb2ad[_0xd93e('0x3b')];if(_0x419004[_0xd93e('0x3c')]['includeAll']){_0x1cc0cd[_0xd93e('0x4d')]=[{'all':!![]}];}_0x1cc0cd=_['merge']({},_0x1cc0cd,_0x419004[_0xd93e('0x4a')]);return db[_0xd93e('0x38')][_0xd93e('0x55')](_0x1cc0cd)['then'](handleEntityNotFound(_0x3a2fe6,null))[_0xd93e('0x4b')](respondWithResult(_0x3a2fe6,null))['catch'](handleError(_0x3a2fe6,null));};exports['create']=function(_0x180303,_0x4080c9){return db[_0xd93e('0x38')][_0xd93e('0x56')](_0x180303[_0xd93e('0x57')],{})['then'](respondWithResult(_0x4080c9,0xc9))['catch'](handleError(_0x4080c9,null));};exports['update']=function(_0x592fbc,_0x3ff42b){if(_0x592fbc[_0xd93e('0x57')]['id']){delete _0x592fbc['body']['id'];}return db[_0xd93e('0x38')]['find']({'where':{'id':_0x592fbc[_0xd93e('0x58')]['id']}})[_0xd93e('0x4b')](handleEntityNotFound(_0x3ff42b,null))[_0xd93e('0x4b')](saveUpdates(_0x592fbc[_0xd93e('0x57')],null))[_0xd93e('0x4b')](respondWithResult(_0x3ff42b,null))[_0xd93e('0x27')](handleError(_0x3ff42b,null));};exports[_0xd93e('0x32')]=function(_0x2778e0,_0x5404c2){return db[_0xd93e('0x38')][_0xd93e('0x55')]({'where':{'id':_0x2778e0[_0xd93e('0x58')]['id']}})[_0xd93e('0x4b')](handleEntityNotFound(_0x5404c2,null))[_0xd93e('0x4b')](removeEntity(_0x5404c2,null))['catch'](handleError(_0x5404c2,null));};exports[_0xd93e('0x59')]=function(_0x1615eb,_0x38bf73){return db[_0xd93e('0x38')]['describe']()['then'](respondWithResult(_0x38bf73,null))[_0xd93e('0x27')](handleError(_0x38bf73,null));};var interaction_log=require(_0xd93e('0x12'))(_0xd93e('0x5a'));exports[_0xd93e('0x5b')]=function(_0x81d798,_0x45f429,_0x1823f8){var _0x56b2c7={'channel':_0xd93e('0x5c')};if(_0x81d798[_0xd93e('0x57')]['id']){delete _0x81d798['body']['id'];}_0x81d798[_0xd93e('0x57')]['read']=!![];_0x81d798[_0xd93e('0x57')][_0xd93e('0x5d')]=moment()[_0xd93e('0x5e')](_0xd93e('0x5f'));_0x81d798['body'][_0xd93e('0x60')]=_0x81d798[_0xd93e('0x57')]['UserId']||_0x81d798[_0xd93e('0x61')]['id'];return db['SmsMessage'][_0xd93e('0x55')]({'where':{'id':_0x81d798[_0xd93e('0x58')]['id'],'UserId':null},'include':[{'model':db[_0xd93e('0x62')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x45f429,null))[_0xd93e('0x4b')](saveUpdates(_0x81d798['body'],null))[_0xd93e('0x4b')](function(_0x3f415c){if(_0x3f415c){_0x56b2c7['message']=_0x3f415c[_0xd93e('0x63')]({'plain':!![]});return db[_0xd93e('0x64')][_0xd93e('0x55')]({'where':{'id':_0x3f415c[_0xd93e('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x45f429,null))[_0xd93e('0x4b')](function(_0x2c67cb){if(_0x2c67cb){return _0x2c67cb[_0xd93e('0x31')]({'UserId':_0x81d798['body'][_0xd93e('0x60')],'read1stAt':_['isNil'](_0x2c67cb[_0xd93e('0x66')])?moment()[_0xd93e('0x5e')](_0xd93e('0x5f')):undefined});}return null;})['then'](function(_0x216240){if(_0x216240){_0x56b2c7[_0xd93e('0x67')]=_0x216240[_0xd93e('0x63')]({'plain':!![]});interaction_log[_0xd93e('0x20')](_0xd93e('0x68'),_0x81d798[_0xd93e('0x61')]['id'],_0x81d798[_0xd93e('0x61')][_0xd93e('0x34')],_0x81d798[_0xd93e('0x61')][_0xd93e('0x69')],_0x56b2c7[_0xd93e('0x67')]['id'],_0x81d798['body']?JSON[_0xd93e('0x24')](_0x81d798[_0xd93e('0x57')]):_0xd93e('0x6a'));return respondWithRpcPromise(_0xd93e('0x6b'),_0xd93e('0x6c'),_0x56b2c7);}return null;})['then'](function(_0x21d1cb){if(_0x21d1cb){if(_0x81d798[_0xd93e('0x57')][_0xd93e('0x6d')]){_0x56b2c7[_0xd93e('0x26')]['interface']=util[_0xd93e('0x5e')](_0xd93e('0x6e'),_0x81d798[_0xd93e('0x61')]['name']);_0x56b2c7[_0xd93e('0x26')][_0xd93e('0x6f')]=_0x56b2c7[_0xd93e('0x6f')];_0x56b2c7[_0xd93e('0x26')][_0xd93e('0x70')]=_0xd93e('0x5b');return respondWithRpcPromise(_0xd93e('0x71'),_0xd93e('0x71'),{'event':_0xd93e('0x72'),'message':_0x56b2c7['message']},client9002)[_0xd93e('0x4b')](function(){return _0x56b2c7;});}return _0x56b2c7;}return null;})[_0xd93e('0x4b')](respondWithResult(_0x45f429,null))[_0xd93e('0x27')](handleError(_0x45f429,null));};var interaction_log=require(_0xd93e('0x12'))(_0xd93e('0x5a'));exports[_0xd93e('0x73')]=function(_0x93f92c,_0xea582e,_0x2fd011){var _0x1eedd3={'agent':{},'channel':_0xd93e('0x5c')};if(_0x93f92c[_0xd93e('0x57')]['id']){delete _0x93f92c['body']['id'];}_0x93f92c[_0xd93e('0x57')][_0xd93e('0x60')]=_0x93f92c[_0xd93e('0x57')]['UserId']||_0x93f92c[_0xd93e('0x61')]['id'];_0x1eedd3[_0xd93e('0x74')]['id']=_0x93f92c[_0xd93e('0x57')][_0xd93e('0x60')];return db[_0xd93e('0x38')][_0xd93e('0x55')]({'where':{'id':_0x93f92c[_0xd93e('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xea582e,null))[_0xd93e('0x4b')](function(_0x3a8874){if(_0x3a8874){_0x1eedd3[_0xd93e('0x26')]=_0x3a8874[_0xd93e('0x63')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x3a8874[_0xd93e('0x65')]}});}return null;})[_0xd93e('0x4b')](handleEntityNotFound(_0xea582e,null))[_0xd93e('0x4b')](function(_0x46d597){if(_0x46d597){_0x1eedd3['interaction']=_0x46d597[_0xd93e('0x63')]({'plain':!![]});interaction_log['info'](_0xd93e('0x75'),_0x93f92c[_0xd93e('0x61')]['id'],_0x93f92c[_0xd93e('0x61')]['name'],_0x93f92c[_0xd93e('0x61')][_0xd93e('0x69')],_0x1eedd3['interaction']['id'],_0x93f92c[_0xd93e('0x57')]?JSON[_0xd93e('0x24')](_0x93f92c[_0xd93e('0x57')]):_0xd93e('0x6a'));return respondWithRpcPromise(_0xd93e('0x76'),_0xd93e('0x77'),_0x1eedd3);}return null;})[_0xd93e('0x4b')](function(_0x35276c){if(_0x35276c){_0x35276c[_0xd93e('0x26')][_0xd93e('0x78')]=util[_0xd93e('0x5e')](_0xd93e('0x6e'),_0x93f92c[_0xd93e('0x61')][_0xd93e('0x34')]);_0x35276c[_0xd93e('0x26')][_0xd93e('0x6f')]=_0x1eedd3[_0xd93e('0x6f')];_0x35276c[_0xd93e('0x26')][_0xd93e('0x70')]=_0xd93e('0x73');respondWithRpcPromise('EventManager','EventManager',{'event':_0xd93e('0x79'),'message':_0x35276c[_0xd93e('0x26')]},client9002);return _0x1eedd3;}return null;})[_0xd93e('0x4b')](respondWithResult(_0xea582e,null))[_0xd93e('0x27')](handleError(_0xea582e,null));};exports[_0xd93e('0x2c')]=function(_0x2fc36c,_0x4a892c,_0x58c56e){if(_0x2fc36c[_0xd93e('0x57')]['id']){delete _0x2fc36c[_0xd93e('0x57')]['id'];}var _0x5d050c;return db['SmsMessage'][_0xd93e('0x55')]({'where':{'id':_0x2fc36c['params']['id']}})[_0xd93e('0x4b')](handleEntityNotFound(_0x4a892c,null))[_0xd93e('0x4b')](function(_0x267099){if(_0x267099){_0x5d050c=_0x267099;return db['SmsAccount']['find']({'where':{'id':_0x267099[_0xd93e('0x7a')]}});}})[_0xd93e('0x4b')](handleEntityNotFound(_0x4a892c,null))['then'](function(_0x31579a){if(_0x31579a){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd93e('0x2c'),_0xd93e('0x7b'),_0x31579a['type'],util[_0xd93e('0x7c')](_0x2fc36c[_0xd93e('0x57')],{'showHidden':![],'depth':null}));switch(_0x31579a['type']){case'twilio':if(_0x2fc36c[_0xd93e('0x57')][_0xd93e('0x7d')]&&_0x2fc36c[_0xd93e('0x57')]['MessageSid']===_0x5d050c[_0xd93e('0x7e')]){return _0x5d050c[_0xd93e('0x31')]({'read':!![]});}else{logger['error'](_0xd93e('0x7f'),_0xd93e('0x2c'),'twilio',util['inspect'](_0x2fc36c[_0xd93e('0x57')],{'showHidden':![],'depth':null}));}break;case _0xd93e('0x80'):if(_0x2fc36c['body']['MessageUUID']&&_0x2fc36c[_0xd93e('0x57')][_0xd93e('0x81')]===_0x5d050c[_0xd93e('0x7e')]&&_['indexOf']([_0xd93e('0x82'),_0xd93e('0x83')],_0x2fc36c['body'][_0xd93e('0x84')])>=0x0){return _0x5d050c['update']({'read':!![]});}else{logger[_0xd93e('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd93e('0x2c'),_0xd93e('0x85'),util[_0xd93e('0x7c')](_0x2fc36c[_0xd93e('0x57')],{'showHidden':![],'depth':null}));}break;case _0xd93e('0x86'):var _0x58ed04=_0x2fc36c[_0xd93e('0x57')][_0xd93e('0x87')][0x0];if(_0x58ed04[_0xd93e('0x2c')][_0xd93e('0x88')]===_0xd93e('0x89')){return _0x5d050c[_0xd93e('0x31')]({'read':!![]});}else{logger['error'](_0xd93e('0x7f'),_0xd93e('0x2c'),_0xd93e('0x86'),util[_0xd93e('0x7c')](_0x2fc36c[_0xd93e('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x5d050c;}})[_0xd93e('0x4b')](respondWithResult(_0x4a892c,null))[_0xd93e('0x27')](handleError(_0x4a892c,null));}; \ No newline at end of file +var _0xae60=['rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','name','index','map','SmsMessage','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','keys','rawAttributes','find','create','body','params','destroy','sms-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','sms','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage'];(function(_0x332a78,_0x4d38b3){var _0x537ac5=function(_0x1a7526){while(--_0x1a7526){_0x332a78['push'](_0x332a78['shift']());}};_0x537ac5(++_0x4d38b3);}(_0xae60,0x1c7));var _0x0ae6=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xae60[_0x4a3898];return _0x25ceb0;};'use strict';var pdf=require(_0x0ae6('0x0'));var emlformat=require(_0x0ae6('0x1'));var rimraf=require(_0x0ae6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ae6('0x3'));var rp=require(_0x0ae6('0x4'));var moment=require(_0x0ae6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0ae6('0x6'));var util=require(_0x0ae6('0x7'));var path=require('path');var sox=require(_0x0ae6('0x8'));var csv=require(_0x0ae6('0x9'));var ejs=require(_0x0ae6('0xa'));var fs=require('fs');var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var db=require(_0x0ae6('0x1a'))['db'];config[_0x0ae6('0x1b')]=_[_0x0ae6('0x1c')](config[_0x0ae6('0x1b')],{'host':_0x0ae6('0x1d'),'port':0x18eb});var socket=require(_0x0ae6('0x1e'))(new Redis(config[_0x0ae6('0x1b')]));require(_0x0ae6('0x1f'))['register'](socket);var jayson=require(_0x0ae6('0x20'));var client=jayson[_0x0ae6('0x21')][_0x0ae6('0x22')]({'port':0x232c});var client9002=jayson[_0x0ae6('0x21')][_0x0ae6('0x22')]({'port':0x232a});function checkPasswordPattern(_0x3a1e26,_0x151144,_0x3b64ac){if(_0x3b64ac){var _0xa797bb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa797bb[_0x0ae6('0x23')](_0x151144)){return _0x3a1e26;}else{throw new db[(_0x0ae6('0x24'))][(_0x0ae6('0x25'))](_0x0ae6('0x26'));}}else{return _0x3a1e26;}}function respondWithRpcPromise(_0xd0362c,_0xda4f01,_0x3f5c41,_0x2fdf25){return new BPromise(function(_0x1735ba,_0x2ca2a3){var _0x9e2c46=_0x2fdf25||client;return _0x9e2c46[_0x0ae6('0x27')](_0xd0362c,_0x3f5c41)[_0x0ae6('0x28')](function(_0x491a74){logger[_0x0ae6('0x29')](_0x0ae6('0x2a'),_0xda4f01,_0x0ae6('0x2b'));logger[_0x0ae6('0x2c')](_0x0ae6('0x2d'),_0xda4f01,_0x0ae6('0x2b'),JSON[_0x0ae6('0x2e')](_0x491a74));if(_0x491a74[_0x0ae6('0x2f')]){if(_0x491a74['error'][_0x0ae6('0x30')]===0x1f4){logger[_0x0ae6('0x2f')](_0x0ae6('0x2a'),_0xda4f01,_0x491a74[_0x0ae6('0x2f')][_0x0ae6('0x31')]);return _0x2ca2a3(_0x491a74['error'][_0x0ae6('0x31')]);}logger[_0x0ae6('0x2f')](_0x0ae6('0x2a'),_0xda4f01,_0x491a74[_0x0ae6('0x2f')][_0x0ae6('0x31')]);return _0x1735ba(_0x491a74[_0x0ae6('0x2f')]['message']);}else{logger[_0x0ae6('0x29')](_0x0ae6('0x2a'),_0xda4f01,'request\x20sent');_0x1735ba(_0x491a74['result'][_0x0ae6('0x31')]);}})[_0x0ae6('0x32')](function(_0x17360e){logger['error'](_0x0ae6('0x2a'),_0xda4f01,_0x17360e);_0x2ca2a3(_0x17360e);});});}function respondWithStatusCode(_0xb68cbe,_0x2533c2){_0x2533c2=_0x2533c2||0xcc;return function(_0x4df796){if(_0x4df796){return _0xb68cbe[_0x0ae6('0x33')](_0x2533c2);}return _0xb68cbe[_0x0ae6('0x34')](_0x2533c2)[_0x0ae6('0x35')]();};}function respondWithResult(_0x232fbd,_0x14eed5){_0x14eed5=_0x14eed5||0xc8;return function(_0x257af5){if(_0x257af5){return _0x232fbd['status'](_0x14eed5)['json'](_0x257af5);}};}function respondWithFilteredResult(_0x2d9f4e,_0x419384){return function(_0x4e6df8){if(_0x4e6df8){var _0x4a06f1=_0x4e6df8[_0x0ae6('0x36')],_0x1ca059=_0x419384['offset'],_0x278577=_0x419384[_0x0ae6('0x37')]+_0x419384[_0x0ae6('0x38')],_0x714c6d;if(_0x278577>=_0x4a06f1){_0x278577=_0x4a06f1;_0x714c6d=0xc8;}else{_0x714c6d=0xce;}_0x2d9f4e[_0x0ae6('0x34')](_0x714c6d);return _0x2d9f4e['set'](_0x0ae6('0x39'),_0x1ca059+'-'+_0x278577+'/'+_0x4a06f1)[_0x0ae6('0x3a')](_0x4e6df8);}return null;};}function patchUpdates(_0x2af8c0){return function(_0xe2fbf5){try{jsonpatch[_0x0ae6('0x3b')](_0xe2fbf5,_0x2af8c0,!![]);}catch(_0x2ba41f){return BPromise[_0x0ae6('0x3c')](_0x2ba41f);}return _0xe2fbf5[_0x0ae6('0x3d')]();};}function saveUpdates(_0x106bc3,_0x3a8b9c){return function(_0x4cb7d4){if(_0x4cb7d4){return _0x4cb7d4[_0x0ae6('0x3e')](_0x106bc3)[_0x0ae6('0x28')](function(_0x4a2cd1){return _0x4a2cd1;});}return null;};}function removeEntity(_0x3264d5,_0x3667d2){return function(_0x231fc4){if(_0x231fc4){return _0x231fc4['destroy']()[_0x0ae6('0x28')](function(){_0x3264d5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46d1af,_0x404f2e){return function(_0x18fc19){if(!_0x18fc19){_0x46d1af[_0x0ae6('0x33')](0x194);}return _0x18fc19;};}function handleError(_0xed1128,_0x5bf771){_0x5bf771=_0x5bf771||0x1f4;return function(_0x584dc8){logger[_0x0ae6('0x2f')](_0x584dc8['stack']);if(_0x584dc8[_0x0ae6('0x3f')]){delete _0x584dc8['name'];}_0xed1128[_0x0ae6('0x34')](_0x5bf771)['send'](_0x584dc8);};}exports[_0x0ae6('0x40')]=function(_0x1640e4,_0x6b8cf5){var _0x2204e5={},_0x5be17f={},_0x4a9c75={'count':0x0,'rows':[]};var _0x43414c=_[_0x0ae6('0x41')](db[_0x0ae6('0x42')]['rawAttributes'],function(_0xaeb354){return{'name':_0xaeb354['fieldName'],'type':_0xaeb354[_0x0ae6('0x43')][_0x0ae6('0x44')]};});_0x5be17f[_0x0ae6('0x45')]=_[_0x0ae6('0x41')](_0x43414c,_0x0ae6('0x3f'));_0x5be17f[_0x0ae6('0x46')]=_['keys'](_0x1640e4[_0x0ae6('0x46')]);_0x5be17f[_0x0ae6('0x47')]=_[_0x0ae6('0x48')](_0x5be17f[_0x0ae6('0x45')],_0x5be17f[_0x0ae6('0x46')]);_0x2204e5[_0x0ae6('0x49')]=_[_0x0ae6('0x48')](_0x5be17f[_0x0ae6('0x45')],qs['fields'](_0x1640e4[_0x0ae6('0x46')][_0x0ae6('0x4a')]));_0x2204e5[_0x0ae6('0x49')]=_0x2204e5[_0x0ae6('0x49')][_0x0ae6('0x4b')]?_0x2204e5[_0x0ae6('0x49')]:_0x5be17f[_0x0ae6('0x45')];if(!_0x1640e4[_0x0ae6('0x46')][_0x0ae6('0x4c')](_0x0ae6('0x4d'))){_0x2204e5[_0x0ae6('0x38')]=qs[_0x0ae6('0x38')](_0x1640e4[_0x0ae6('0x46')][_0x0ae6('0x38')]);_0x2204e5[_0x0ae6('0x37')]=qs[_0x0ae6('0x37')](_0x1640e4[_0x0ae6('0x46')][_0x0ae6('0x37')]);}_0x2204e5['order']=qs[_0x0ae6('0x4e')](_0x1640e4[_0x0ae6('0x46')][_0x0ae6('0x4e')]);_0x2204e5[_0x0ae6('0x4f')]=qs[_0x0ae6('0x47')](_[_0x0ae6('0x50')](_0x1640e4['query'],_0x5be17f[_0x0ae6('0x47')]),_0x43414c);if(_0x1640e4[_0x0ae6('0x46')][_0x0ae6('0x51')]){_0x2204e5[_0x0ae6('0x4f')]=_['merge'](_0x2204e5['where'],{'$or':_['map'](_0x43414c,function(_0x295d06){if(_0x295d06[_0x0ae6('0x43')]!==_0x0ae6('0x52')){var _0x4ff1de={};_0x4ff1de[_0x295d06[_0x0ae6('0x3f')]]={'$like':'%'+_0x1640e4[_0x0ae6('0x46')]['filter']+'%'};return _0x4ff1de;}})});}_0x2204e5=_[_0x0ae6('0x53')]({},_0x2204e5,_0x1640e4[_0x0ae6('0x54')]);var _0x4f26e0={'where':_0x2204e5[_0x0ae6('0x4f')]};return db[_0x0ae6('0x42')]['count'](_0x4f26e0)[_0x0ae6('0x28')](function(_0x1ad272){_0x4a9c75[_0x0ae6('0x36')]=_0x1ad272;if(_0x1640e4['query'][_0x0ae6('0x55')]){_0x2204e5[_0x0ae6('0x56')]=[{'all':!![]}];}return db[_0x0ae6('0x42')][_0x0ae6('0x57')](_0x2204e5);})[_0x0ae6('0x28')](function(_0x7feb56){_0x4a9c75[_0x0ae6('0x58')]=_0x7feb56;return _0x4a9c75;})['then'](respondWithFilteredResult(_0x6b8cf5,_0x2204e5))['catch'](handleError(_0x6b8cf5,null));};exports[_0x0ae6('0x59')]=function(_0x18762a,_0x1f164f){var _0x54504b={'raw':!![],'where':{'id':_0x18762a['params']['id']}},_0x3b1ce5={};_0x3b1ce5['model']=_[_0x0ae6('0x5a')](db[_0x0ae6('0x42')][_0x0ae6('0x5b')]);_0x3b1ce5['query']=_[_0x0ae6('0x5a')](_0x18762a[_0x0ae6('0x46')]);_0x3b1ce5[_0x0ae6('0x47')]=_[_0x0ae6('0x48')](_0x3b1ce5[_0x0ae6('0x45')],_0x3b1ce5[_0x0ae6('0x46')]);_0x54504b[_0x0ae6('0x49')]=_[_0x0ae6('0x48')](_0x3b1ce5[_0x0ae6('0x45')],qs[_0x0ae6('0x4a')](_0x18762a[_0x0ae6('0x46')][_0x0ae6('0x4a')]));_0x54504b[_0x0ae6('0x49')]=_0x54504b[_0x0ae6('0x49')][_0x0ae6('0x4b')]?_0x54504b['attributes']:_0x3b1ce5['model'];if(_0x18762a[_0x0ae6('0x46')][_0x0ae6('0x55')]){_0x54504b[_0x0ae6('0x56')]=[{'all':!![]}];}_0x54504b=_[_0x0ae6('0x53')]({},_0x54504b,_0x18762a[_0x0ae6('0x54')]);return db[_0x0ae6('0x42')][_0x0ae6('0x5c')](_0x54504b)[_0x0ae6('0x28')](handleEntityNotFound(_0x1f164f,null))[_0x0ae6('0x28')](respondWithResult(_0x1f164f,null))[_0x0ae6('0x32')](handleError(_0x1f164f,null));};exports[_0x0ae6('0x5d')]=function(_0x463547,_0x16a311){return db[_0x0ae6('0x42')][_0x0ae6('0x5d')](_0x463547[_0x0ae6('0x5e')],{})[_0x0ae6('0x28')](respondWithResult(_0x16a311,0xc9))[_0x0ae6('0x32')](handleError(_0x16a311,null));};exports['update']=function(_0x26d313,_0x1d04ac){if(_0x26d313[_0x0ae6('0x5e')]['id']){delete _0x26d313[_0x0ae6('0x5e')]['id'];}return db[_0x0ae6('0x42')][_0x0ae6('0x5c')]({'where':{'id':_0x26d313[_0x0ae6('0x5f')]['id']}})[_0x0ae6('0x28')](handleEntityNotFound(_0x1d04ac,null))[_0x0ae6('0x28')](saveUpdates(_0x26d313[_0x0ae6('0x5e')],null))['then'](respondWithResult(_0x1d04ac,null))[_0x0ae6('0x32')](handleError(_0x1d04ac,null));};exports[_0x0ae6('0x60')]=function(_0x1c53bf,_0xd2cec5){return db[_0x0ae6('0x42')][_0x0ae6('0x5c')]({'where':{'id':_0x1c53bf[_0x0ae6('0x5f')]['id']}})[_0x0ae6('0x28')](handleEntityNotFound(_0xd2cec5,null))[_0x0ae6('0x28')](removeEntity(_0xd2cec5,null))['catch'](handleError(_0xd2cec5,null));};exports['describe']=function(_0xe05970,_0x33e87d){return db['SmsMessage']['describe']()[_0x0ae6('0x28')](respondWithResult(_0x33e87d,null))[_0x0ae6('0x32')](handleError(_0x33e87d,null));};var interaction_log=require(_0x0ae6('0x16'))(_0x0ae6('0x61'));exports[_0x0ae6('0x62')]=function(_0x198c87,_0x84e9fa,_0x4bcf41){var _0x227814={'channel':'sms'};if(_0x198c87[_0x0ae6('0x5e')]['id']){delete _0x198c87[_0x0ae6('0x5e')]['id'];}_0x198c87['body'][_0x0ae6('0x63')]=!![];_0x198c87[_0x0ae6('0x5e')][_0x0ae6('0x64')]=moment()['format'](_0x0ae6('0x65'));_0x198c87['body'][_0x0ae6('0x66')]=_0x198c87[_0x0ae6('0x5e')][_0x0ae6('0x66')]||_0x198c87[_0x0ae6('0x67')]['id'];return db['SmsMessage']['find']({'where':{'id':_0x198c87[_0x0ae6('0x5f')]['id'],'UserId':null},'include':[{'model':db[_0x0ae6('0x68')],'as':_0x0ae6('0x69')}]})[_0x0ae6('0x28')](handleEntityNotFound(_0x84e9fa,null))[_0x0ae6('0x28')](saveUpdates(_0x198c87[_0x0ae6('0x5e')],null))['then'](function(_0x5e941e){if(_0x5e941e){_0x227814[_0x0ae6('0x31')]=_0x5e941e[_0x0ae6('0x6a')]({'plain':!![]});return db[_0x0ae6('0x6b')][_0x0ae6('0x5c')]({'where':{'id':_0x5e941e[_0x0ae6('0x6c')]}});}return null;})[_0x0ae6('0x28')](handleEntityNotFound(_0x84e9fa,null))[_0x0ae6('0x28')](function(_0x2e6311){if(_0x2e6311){return _0x2e6311['update']({'UserId':_0x198c87[_0x0ae6('0x5e')][_0x0ae6('0x66')],'read1stAt':_[_0x0ae6('0x6d')](_0x2e6311[_0x0ae6('0x6e')])?moment()[_0x0ae6('0x6f')](_0x0ae6('0x65')):undefined});}return null;})['then'](function(_0x50510d){if(_0x50510d){_0x227814[_0x0ae6('0x70')]=_0x50510d[_0x0ae6('0x6a')]({'plain':!![]});interaction_log['info'](_0x0ae6('0x71'),_0x198c87[_0x0ae6('0x67')]['id'],_0x198c87[_0x0ae6('0x67')][_0x0ae6('0x3f')],_0x198c87['user'][_0x0ae6('0x72')],_0x227814[_0x0ae6('0x70')]['id'],_0x198c87[_0x0ae6('0x5e')]?JSON[_0x0ae6('0x2e')](_0x198c87[_0x0ae6('0x5e')]):_0x0ae6('0x73'));return respondWithRpcPromise(_0x0ae6('0x74'),_0x0ae6('0x75'),_0x227814);}return null;})['then'](function(_0x3f4c5e){if(_0x3f4c5e){if(_0x198c87[_0x0ae6('0x5e')][_0x0ae6('0x76')]){_0x227814[_0x0ae6('0x31')][_0x0ae6('0x77')]=util[_0x0ae6('0x6f')](_0x0ae6('0x78'),_0x198c87[_0x0ae6('0x67')][_0x0ae6('0x3f')]);_0x227814[_0x0ae6('0x31')][_0x0ae6('0x79')]=_0x227814[_0x0ae6('0x79')];_0x227814[_0x0ae6('0x31')][_0x0ae6('0x7a')]=_0x0ae6('0x62');return respondWithRpcPromise(_0x0ae6('0x7b'),_0x0ae6('0x7b'),{'event':_0x0ae6('0x7c'),'message':_0x227814[_0x0ae6('0x31')]},client9002)[_0x0ae6('0x28')](function(){return _0x227814;});}return _0x227814;}return null;})[_0x0ae6('0x28')](respondWithResult(_0x84e9fa,null))['catch'](handleError(_0x84e9fa,null));};var interaction_log=require(_0x0ae6('0x16'))(_0x0ae6('0x61'));exports[_0x0ae6('0x3c')]=function(_0x41e64a,_0x4da9ac,_0xe8fabd){var _0x319682={'agent':{},'channel':_0x0ae6('0x7d')};if(_0x41e64a[_0x0ae6('0x5e')]['id']){delete _0x41e64a[_0x0ae6('0x5e')]['id'];}_0x41e64a[_0x0ae6('0x5e')]['UserId']=_0x41e64a[_0x0ae6('0x5e')]['UserId']||_0x41e64a[_0x0ae6('0x67')]['id'];_0x319682[_0x0ae6('0x7e')]['id']=_0x41e64a[_0x0ae6('0x5e')][_0x0ae6('0x66')];return db[_0x0ae6('0x42')][_0x0ae6('0x5c')]({'where':{'id':_0x41e64a[_0x0ae6('0x5f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4da9ac,null))['then'](function(_0x1f1149){if(_0x1f1149){_0x319682[_0x0ae6('0x31')]=_0x1f1149[_0x0ae6('0x6a')]({'plain':!![]});return db[_0x0ae6('0x6b')]['find']({'where':{'id':_0x1f1149[_0x0ae6('0x6c')]}});}return null;})[_0x0ae6('0x28')](handleEntityNotFound(_0x4da9ac,null))['then'](function(_0x2dfd4a){if(_0x2dfd4a){_0x319682[_0x0ae6('0x70')]=_0x2dfd4a[_0x0ae6('0x6a')]({'plain':!![]});interaction_log[_0x0ae6('0x29')](_0x0ae6('0x7f'),_0x41e64a[_0x0ae6('0x67')]['id'],_0x41e64a['user']['name'],_0x41e64a['user'][_0x0ae6('0x72')],_0x319682['interaction']['id'],_0x41e64a['body']?JSON['stringify'](_0x41e64a['body']):_0x0ae6('0x73'));return respondWithRpcPromise('RejectMessage',_0x0ae6('0x80'),_0x319682);}return null;})['then'](function(_0x1bf94d){if(_0x1bf94d){_0x1bf94d[_0x0ae6('0x31')][_0x0ae6('0x77')]=util[_0x0ae6('0x6f')](_0x0ae6('0x78'),_0x41e64a['user'][_0x0ae6('0x3f')]);_0x1bf94d[_0x0ae6('0x31')][_0x0ae6('0x79')]=_0x319682[_0x0ae6('0x79')];_0x1bf94d[_0x0ae6('0x31')][_0x0ae6('0x7a')]=_0x0ae6('0x3c');respondWithRpcPromise('EventManager',_0x0ae6('0x7b'),{'event':_0x0ae6('0x81'),'message':_0x1bf94d[_0x0ae6('0x31')]},client9002);return _0x319682;}return null;})[_0x0ae6('0x28')](respondWithResult(_0x4da9ac,null))[_0x0ae6('0x32')](handleError(_0x4da9ac,null));};exports[_0x0ae6('0x34')]=function(_0x4c056d,_0x5b8435,_0x4831b4){if(_0x4c056d[_0x0ae6('0x5e')]['id']){delete _0x4c056d[_0x0ae6('0x5e')]['id'];}var _0x4f8409;return db[_0x0ae6('0x42')][_0x0ae6('0x5c')]({'where':{'id':_0x4c056d[_0x0ae6('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5b8435,null))['then'](function(_0x2c9aab){if(_0x2c9aab){_0x4f8409=_0x2c9aab;return db[_0x0ae6('0x82')]['find']({'where':{'id':_0x2c9aab['SmsAccountId']}});}})[_0x0ae6('0x28')](handleEntityNotFound(_0x5b8435,null))['then'](function(_0x519179){if(_0x519179){logger[_0x0ae6('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0x0ae6('0x83'),_0x519179[_0x0ae6('0x43')],util['inspect'](_0x4c056d[_0x0ae6('0x5e')],{'showHidden':![],'depth':null}));switch(_0x519179[_0x0ae6('0x43')]){case'twilio':if(_0x4c056d[_0x0ae6('0x5e')][_0x0ae6('0x84')]&&_0x4c056d['body'][_0x0ae6('0x84')]===_0x4f8409['messageId']){return _0x4f8409[_0x0ae6('0x3e')]({'read':!![]});}else{logger['error'](_0x0ae6('0x85'),_0x0ae6('0x34'),'twilio',util[_0x0ae6('0x86')](_0x4c056d[_0x0ae6('0x5e')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x4c056d[_0x0ae6('0x5e')][_0x0ae6('0x87')]&&_0x4c056d[_0x0ae6('0x5e')][_0x0ae6('0x87')]===_0x4f8409[_0x0ae6('0x88')]&&_[_0x0ae6('0x89')]([_0x0ae6('0x8a'),_0x0ae6('0x8b')],_0x4c056d[_0x0ae6('0x5e')][_0x0ae6('0x8c')])>=0x0){return _0x4f8409[_0x0ae6('0x3e')]({'read':!![]});}else{logger[_0x0ae6('0x2f')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x0ae6('0x8d'),util[_0x0ae6('0x86')](_0x4c056d[_0x0ae6('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x0ae6('0x8e'):var _0x49aed6=_0x4c056d[_0x0ae6('0x5e')][_0x0ae6('0x8f')][0x0];if(_0x49aed6['status'][_0x0ae6('0x90')]===_0x0ae6('0x91')){return _0x4f8409[_0x0ae6('0x3e')]({'read':!![]});}else{logger[_0x0ae6('0x2f')](_0x0ae6('0x85'),_0x0ae6('0x34'),_0x0ae6('0x8e'),util['inspect'](_0x4c056d['body'],{'showHidden':![],'depth':null}));}break;}return _0x4f8409;}})[_0x0ae6('0x28')](respondWithResult(_0x5b8435,null))[_0x0ae6('0x32')](handleError(_0x5b8435,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 0d6b51a..9759945 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 _0x7b44=['hook','exports','events','../../mysqldb','SmsMessage','save','remove','emit','hasOwnProperty'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x7b44,0x1a0));var _0x47b4=function(_0x31bd09,_0x2df7a3){_0x31bd09=_0x31bd09-0x0;var _0x3a7059=_0x7b44[_0x31bd09];return _0x3a7059;};'use strict';var EventEmitter=require(_0x47b4('0x0'));var SmsMessage=require(_0x47b4('0x1'))['db'][_0x47b4('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47b4('0x3'),'afterUpdate':'update','afterDestroy':_0x47b4('0x4')};function emitEvent(_0x495fcf){return function(_0x3c64ea,_0x4cb93c,_0x1a3ed9){SmsMessageEvents[_0x47b4('0x5')](_0x495fcf+':'+_0x3c64ea['id'],_0x3c64ea);SmsMessageEvents[_0x47b4('0x5')](_0x495fcf,_0x3c64ea);_0x1a3ed9(null);};}for(var e in events){if(events[_0x47b4('0x6')](e)){var event=events[e];SmsMessage[_0x47b4('0x7')](e,emitEvent(event));}}module[_0x47b4('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x6c55=['exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5958fe,_0x38c4ef){var _0x20a218=function(_0x9f0d7d){while(--_0x9f0d7d){_0x5958fe['push'](_0x5958fe['shift']());}};_0x20a218(++_0x38c4ef);}(_0x6c55,0x191));var _0x56c5=function(_0x150bff,_0x1fb61a){_0x150bff=_0x150bff-0x0;var _0x296f9a=_0x6c55[_0x150bff];return _0x296f9a;};'use strict';var EventEmitter=require(_0x56c5('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x56c5('0x1')](0x0);var events={'afterCreate':_0x56c5('0x2'),'afterUpdate':_0x56c5('0x3'),'afterDestroy':_0x56c5('0x4')};function emitEvent(_0x4fe3d0){return function(_0x9e6cc1,_0xb1a539,_0x3f6fc3){SmsMessageEvents[_0x56c5('0x5')](_0x4fe3d0+':'+_0x9e6cc1['id'],_0x9e6cc1);SmsMessageEvents['emit'](_0x4fe3d0,_0x9e6cc1);_0x3f6fc3(null);};}for(var e in events){if(events[_0x56c5('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x56c5('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 7d40960..81a9c67 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 _0x0aae=['find','type','twilio','authToken','accountSid','messages','phone','remote','/api/sms/messages/','/status?token=','token','sid','error','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','username','GET','session_key','total_sent','internal_order_id','deliveryReport','afterCreate','connectel','senderString','POST','https://smsapi.connectel.se/api/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','keys','length','createHash','md5','digest','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','Missing\x20parameters:\x20apiKey','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','out','SmsAccount'];(function(_0x3c4e4c,_0x36ff70){var _0x144a87=function(_0x5efb4b){while(--_0x5efb4b){_0x3c4e4c['push'](_0x3c4e4c['shift']());}};_0x144a87(++_0x36ff70);}(_0x0aae,0xcd));var _0xe0aa=function(_0x5817cf,_0x52e781){_0x5817cf=_0x5817cf-0x0;var _0x21357f=_0x0aae[_0x5817cf];return _0x21357f;};'use strict';var _=require(_0xe0aa('0x0'));var util=require(_0xe0aa('0x1'));var logger=require(_0xe0aa('0x2'))(_0xe0aa('0x3'));var moment=require(_0xe0aa('0x4'));var BPromise=require('bluebird');var rp=require(_0xe0aa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0aa('0x6'));var config=require(_0xe0aa('0x7'));var attributes=require(_0xe0aa('0x8'));module[_0xe0aa('0x9')]=function(_0x2d4cc0,_0x2c2448){return _0x2d4cc0['define'](_0xe0aa('0xa'),attributes,{'tableName':_0xe0aa('0xb'),'paranoid':![],'indexes':[{'name':_0xe0aa('0xc'),'fields':[_0xe0aa('0xc')]},{'name':_0xe0aa('0xd'),'fields':[_0xe0aa('0xe')],'type':_0xe0aa('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5bab98,_0x366896,_0x2e414e){var _0x33f34f=_0x2d4cc0['models'];var _0x5d97e0=_0x5bab98[_0xe0aa('0x10')]({'plain':!![]});if(_0x5d97e0[_0xe0aa('0x11')]['toLowerCase']()==='in'||_0x5d97e0[_0xe0aa('0x11')][_0xe0aa('0x12')]()==='out'&&!_0x5d97e0[_0xe0aa('0x13')]&&!_[_0xe0aa('0x14')](_0x5d97e0[_0xe0aa('0x15')])){_0x33f34f[_0xe0aa('0x16')][_0xe0aa('0x17')]({'where':{'id':_0x5d97e0[_0xe0aa('0x18')]}})[_0xe0aa('0x19')](function(_0x4b5338){if(_0x4b5338){_0x4b5338[_0xe0aa('0x1a')]({'lastMsgAt':_0x5d97e0[_0xe0aa('0x1b')],'lastMsgDirection':_0x5d97e0[_0xe0aa('0x11')][_0xe0aa('0x12')]()});}})[_0xe0aa('0x1c')](function(_0x18d92d){console['error'](_0x18d92d);});}if(_0x5d97e0[_0xe0aa('0x11')]===_0xe0aa('0x1d')&&!_0x5d97e0['secret']){var _0x2afc2c;_0x33f34f[_0xe0aa('0x1e')][_0xe0aa('0x1f')]({'where':{'id':_0x5d97e0['SmsAccountId']},'raw':!![]})[_0xe0aa('0x19')](function(_0x42e868){_0x2afc2c=_0x42e868;if(_0x2afc2c&&_0x2afc2c[_0xe0aa('0x20')]){switch(_0x2afc2c['type']){case _0xe0aa('0x21'):var _0x4b72ce=require(_0xe0aa('0x21'));if(_0x2afc2c['accountSid']&&_0x2afc2c[_0xe0aa('0x22')]&&_0x2afc2c['phone']){var _0x122d5d=new _0x4b72ce(_0x2afc2c[_0xe0aa('0x23')],_0x2afc2c['authToken']);_0x122d5d[_0xe0aa('0x24')]['create']({'body':_0x5d97e0[_0xe0aa('0xe')],'to':_0x5d97e0[_0xe0aa('0x25')],'from':_0x2afc2c[_0xe0aa('0x25')],'statusCallback':_0x2afc2c[_0xe0aa('0x26')]+_0xe0aa('0x27')+_0x5d97e0['id']+_0xe0aa('0x28')+_0x2afc2c[_0xe0aa('0x29')]})['then'](function(_0x3f3476){if(_0x3f3476[_0xe0aa('0x2a')]){return _0x5bab98[_0xe0aa('0x1a')]({'messageId':_0x3f3476[_0xe0aa('0x2a')]});}})[_0xe0aa('0x1c')](function(_0x51d356){logger[_0xe0aa('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe0aa('0x21'),util[_0xe0aa('0x2c')](_0x51d356,{'showHidden':![],'depth':null}));});}else{logger[_0xe0aa('0x2b')](_0xe0aa('0x2d'),'afterCreate',_0xe0aa('0x21'),_0xe0aa('0x2e'));}break;case _0xe0aa('0x2f'):var _0x37a780=_0xe0aa('0x30');if(_0x2afc2c['username']&&_0x2afc2c[_0xe0aa('0x31')]){var _0x3e6bfa={'recipient':[_0x5d97e0['phone']],'message':_0x5d97e0[_0xe0aa('0xe')],'message_type':_0x2afc2c[_0xe0aa('0x32')]};if(_0x2afc2c[_0xe0aa('0x32')]&&_0x2afc2c[_0xe0aa('0x32')]!=='SI'){_0x3e6bfa[_0xe0aa('0x33')]=_0x2afc2c[_0xe0aa('0x25')];}var _0x7680d1={'url':_0x37a780+'login?username='+_0x2afc2c[_0xe0aa('0x34')]+'&password='+_0x2afc2c['password'],'method':_0xe0aa('0x35')};rp(_0x7680d1)[_0xe0aa('0x19')](function(_0x727037){var _0xfb6b7b=_0x727037['split'](';');var _0x23d635={'user_key':_0xfb6b7b[0x0],'session_key':_0xfb6b7b[0x1]};_0x7680d1={'url':_0x37a780+'sms','method':'POST','headers':{'user_key':_0x23d635['user_key'],'Session_key':_0x23d635[_0xe0aa('0x36')]},'json':!![],'body':_0x3e6bfa};return rp(_0x7680d1);})[_0xe0aa('0x19')](function(_0x24385d){if(_0x24385d[_0xe0aa('0x37')]>=0x1){var _0x46b71e={'messageId':_0x24385d[_0xe0aa('0x38')]};if(_0x2afc2c[_0xe0aa('0x32')]!=='GP'||!_0x2afc2c[_0xe0aa('0x39')]){_0x46b71e['read']=!![];}return _0x5bab98[_0xe0aa('0x1a')](_0x46b71e);}else{return logger['error'](_0xe0aa('0x2d'),'afterCreate',_0xe0aa('0x2f'),util[_0xe0aa('0x2c')](_0x24385d,{'showHidden':![],'depth':null}));}})[_0xe0aa('0x1c')](function(_0x325189){return logger[_0xe0aa('0x2b')](_0xe0aa('0x2d'),'afterCreate',_0xe0aa('0x2f'),util['inspect'](_0x325189,{'showHidden':![],'depth':null}));});}else{logger[_0xe0aa('0x2b')](_0xe0aa('0x2d'),_0xe0aa('0x3a'),_0xe0aa('0x2f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xe0aa('0x3b'):if(_0x2afc2c[_0xe0aa('0x22')]){var _0x12c158={'recipient':_0x5d97e0[_0xe0aa('0x25')],'message':_0x5d97e0[_0xe0aa('0xe')],'sender':_0x2afc2c[_0xe0aa('0x3c')]||_0x2afc2c[_0xe0aa('0x25')],'authorization':_0x2afc2c['authToken']};var _0x366896={'method':_0xe0aa('0x3d'),'uri':_0xe0aa('0x3e'),'body':_0x12c158,'json':!![]};rp(_0x366896)[_0xe0aa('0x19')](function(_0x16107a){var _0x26e133={'messageId':_0x16107a[_0xe0aa('0x3f')]};if(!_0x2afc2c[_0xe0aa('0x39')]){_0x26e133[_0xe0aa('0x40')]=!![];}return _0x5bab98[_0xe0aa('0x1a')](_0x26e133);})['catch'](function(_0x4b66d5){logger[_0xe0aa('0x2b')](_0xe0aa('0x2d'),_0xe0aa('0x3a'),_0xe0aa('0x3b'),util[_0xe0aa('0x2c')](_0x4b66d5,{'showHidden':![],'depth':null}));});}else{logger[_0xe0aa('0x2b')](_0xe0aa('0x2d'),'afterCreate',_0xe0aa('0x3b'),_0xe0aa('0x41'));}break;case _0xe0aa('0x42'):if(_0x2afc2c['username']&&_0x2afc2c[_0xe0aa('0x31')]){var _0x12c158={'messages':[{'source':_0xe0aa('0x43'),'to':_0x5d97e0[_0xe0aa('0x25')],'body':_0x5d97e0['body'],'from':_0x2afc2c[_0xe0aa('0x3c')]||_0x2afc2c[_0xe0aa('0x25')]}]};var _0x1f9b8b=util[_0xe0aa('0x44')](_0xe0aa('0x45'),_0x2afc2c['username'],_0x2afc2c[_0xe0aa('0x31')]);var _0x366896={'method':_0xe0aa('0x3d'),'uri':_0xe0aa('0x46'),'body':_0x12c158,'headers':{'Authorization':util[_0xe0aa('0x44')](_0xe0aa('0x47'),new Buffer(_0x1f9b8b)[_0xe0aa('0x48')](_0xe0aa('0x49')))},'json':!![]};rp(_0x366896)[_0xe0aa('0x19')](function(_0x30e0a5){if(_0x30e0a5[_0xe0aa('0x4a')]>=0xc8&&_0x30e0a5[_0xe0aa('0x4a')]<=0xce){if(_0x30e0a5[_0xe0aa('0x4b')]&&_0x30e0a5[_0xe0aa('0x4b')]['queued_count']>0x0){var _0x1ae6f3=_[_0xe0aa('0x4c')](_0x30e0a5[_0xe0aa('0x4b')][_0xe0aa('0x24')]);var _0x5c82f5={'messageId':_0x1ae6f3[_0xe0aa('0x4d')]};if(!_0x2afc2c['deliveryReport']){_0x5c82f5[_0xe0aa('0x40')]=!![];}return _0x5bab98[_0xe0aa('0x1a')](_0x5c82f5);}else{logger[_0xe0aa('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe0aa('0x3a'),_0xe0aa('0x4e'),util[_0xe0aa('0x2c')](_0x30e0a5,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xe0aa('0x2d'),_0xe0aa('0x3a'),_0xe0aa('0x4e'),util[_0xe0aa('0x2c')](_0x30e0a5,{'showHidden':![],'depth':null}));}})[_0xe0aa('0x1c')](function(_0x5d512a){logger[_0xe0aa('0x2b')](_0xe0aa('0x2d'),'afterCreate',_0xe0aa('0x4e'),util['inspect'](_0x5d512a,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe0aa('0x4e'),_0xe0aa('0x4f'));}break;case'plivo':if(_0x2afc2c[_0xe0aa('0x50')]&&_0x2afc2c[_0xe0aa('0x22')]){var _0x12c158={'dst':_0x5d97e0[_0xe0aa('0x25')],'text':_0x5d97e0[_0xe0aa('0xe')],'src':_0x2afc2c['senderString']||_0x2afc2c[_0xe0aa('0x25')],'url':_0x2afc2c[_0xe0aa('0x26')]+'/api/sms/messages/'+_0x5d97e0['id']+_0xe0aa('0x28')+_0x2afc2c['token']};var _0x1f9b8b=util[_0xe0aa('0x44')]('%s:%s',_0x2afc2c[_0xe0aa('0x50')],_0x2afc2c[_0xe0aa('0x22')]);var _0x366896={'method':_0xe0aa('0x3d'),'uri':util['format'](_0xe0aa('0x51'),_0x2afc2c[_0xe0aa('0x50')]),'body':_0x12c158,'headers':{'Authorization':util[_0xe0aa('0x44')](_0xe0aa('0x47'),new Buffer(_0x1f9b8b)[_0xe0aa('0x48')]('base64'))},'json':!![]};rp(_0x366896)[_0xe0aa('0x19')](function(_0x3447c8){var _0x2a6b82={'messageId':_0x3447c8[_0xe0aa('0x52')][0x0]};return _0x5bab98['update'](_0x2a6b82);})[_0xe0aa('0x1c')](function(_0x481cc5){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe0aa('0x3a'),_0xe0aa('0x53'),util[_0xe0aa('0x2c')](_0x481cc5,{'showHidden':![],'depth':null}));});}else{logger[_0xe0aa('0x2b')](_0xe0aa('0x2d'),'afterCreate',_0xe0aa('0x53'),_0xe0aa('0x54'));}break;case'infobip':if(_0x2afc2c[_0xe0aa('0x34')]&&_0x2afc2c[_0xe0aa('0x31')]){if(_0x2afc2c[_0xe0aa('0x55')]){var _0x142cd3={'method':_0xe0aa('0x3d'),'uri':_0x2afc2c[_0xe0aa('0x55')]+'/auth/1/session','body':{'username':_0x2afc2c[_0xe0aa('0x34')],'password':_0x2afc2c[_0xe0aa('0x31')]},'json':!![]};return rp(_0x142cd3)[_0xe0aa('0x19')](function(_0x2ece10){var _0x455c5f={'method':'POST','uri':_0x2afc2c[_0xe0aa('0x55')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x2afc2c[_0xe0aa('0x25')],'destinations':[{'to':_0x5d97e0[_0xe0aa('0x25')]}],'text':_0x5d97e0[_0xe0aa('0xe')],'notifyUrl':_0x2afc2c['remote']+_0xe0aa('0x27')+_0x5d97e0['id']+'/status?token='+_0x2afc2c['token'],'notifyContentType':'application/json','callbackData':_0x2afc2c[_0xe0aa('0x25')]+';'+_0x5d97e0[_0xe0aa('0xe')]}]},'headers':{'Authorization':_0xe0aa('0x56')+_0x2ece10[_0xe0aa('0x29')]},'json':!![]};return rp(_0x455c5f)[_0xe0aa('0x19')](function(_0x16572a){if(_0x16572a[_0xe0aa('0x24')]){var _0x32bef2={'messageId':_0x16572a['messages'][0x0][_0xe0aa('0xc')]};if(!_0x2afc2c[_0xe0aa('0x39')]){_0x32bef2[_0xe0aa('0x40')]=!![];}return _0x5bab98[_0xe0aa('0x1a')](_0x32bef2);}else{return logger[_0xe0aa('0x2b')](_0xe0aa('0x2d'),_0xe0aa('0x3a'),'infobip',util[_0xe0aa('0x2c')](_0x16572a,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x71ca9e){return logger[_0xe0aa('0x2b')](_0xe0aa('0x2d'),_0xe0aa('0x3a'),_0xe0aa('0x57'),util[_0xe0aa('0x2c')](_0x71ca9e,{'showHidden':![],'depth':null}));});}else{logger[_0xe0aa('0x2b')](_0xe0aa('0x2d'),_0xe0aa('0x3a'),_0xe0aa('0x57'),_0xe0aa('0x58'));}}else{logger[_0xe0aa('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe0aa('0x3a'),_0xe0aa('0x57'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xe0aa('0x59'):var _0x1dd529=require(_0xe0aa('0x5a'));if(_0x2afc2c[_0xe0aa('0x5b')]){var _0x11105b={};_0x11105b[_0xe0aa('0x5c')]=_0x2afc2c['username'];_0x11105b[_0xe0aa('0x25')]=_0x5d97e0[_0xe0aa('0x25')];_0x11105b[_0xe0aa('0x33')]=_0x2afc2c['phone'];_0x11105b['text']=_0x5d97e0['body'];_0x11105b[_0xe0aa('0x5d')]=+new Date();var _0x3bc302='';var _0x5b93e9='';var _0x132421=Object[_0xe0aa('0x5e')](_0x11105b);_0x132421['sort']();for(var _0x1ad156=0x0;_0x1ad156<_0x132421[_0xe0aa('0x5f')];_0x1ad156++){if(_0x3bc302!=''){_0x3bc302+='&';}_0x3bc302+=_0x132421[_0x1ad156]+'='+encodeURIComponent(_0x11105b[_0x132421[_0x1ad156]]);_0x5b93e9+=_0x11105b[_0x132421[_0x1ad156]];}_0x5b93e9+=_0x2afc2c['apiKey'];_0x5b93e9=_0x1dd529[_0xe0aa('0x60')](_0xe0aa('0x61'))[_0xe0aa('0x1a')](_0x5b93e9)[_0xe0aa('0x62')]('hex');if(_0x3bc302!==''){_0x3bc302+='&';}_0x3bc302+=_0xe0aa('0x63')+_0x5b93e9;var _0x7680d1={'method':_0xe0aa('0x35'),'uri':_0x2afc2c[_0xe0aa('0x55')]+_0xe0aa('0x64')+_0x3bc302,'json':!![]};return rp(_0x7680d1)[_0xe0aa('0x19')](function(_0x3b983e){var _0x2aef17=Object[_0xe0aa('0x5e')](_0x3b983e);if(_0x3b983e[_0x2aef17[0x0]][_0xe0aa('0x2b')]&&parseInt(_0x3b983e[_0x2aef17[0x0]][_0xe0aa('0x2b')])===0x0){var _0x3537bd={'messageId':_0x3b983e[_0x2aef17[0x0]][_0xe0aa('0x65')]};if(!_0x2afc2c[_0xe0aa('0x39')]){_0x3537bd[_0xe0aa('0x40')]=!![];}return _0x5bab98[_0xe0aa('0x1a')](_0x3537bd);}else{return logger[_0xe0aa('0x2b')](_0xe0aa('0x2d'),_0xe0aa('0x3a'),_0xe0aa('0x59'),util['inspect'](_0x3b983e['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4e4d3a){return logger[_0xe0aa('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe0aa('0x3a'),_0xe0aa('0x59'),util[_0xe0aa('0x2c')](_0x4e4d3a,{'showHidden':![],'depth':null}));});}else{logger[_0xe0aa('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe0aa('0x3a'),_0xe0aa('0x59'),'Missing\x20parameters:\x20apiKey');}break;case _0xe0aa('0x66'):if(_0x2afc2c[_0xe0aa('0x5b')]){var _0x485f2b={'method':'POST','uri':_0xe0aa('0x67'),'headers':{'Authorization':_0x2afc2c[_0xe0aa('0x5b')]},'body':{'content':_0x5d97e0[_0xe0aa('0xe')],'to':[_0x5d97e0[_0xe0aa('0x25')]],'from':_0x2afc2c['phone'],'binary':![],'clientMessageId':_0xe0aa('0x68'),'charset':'UTF-8'},'json':!![]};rp(_0x485f2b)['then'](function(_0x47ded9){if(!_0x47ded9['error']){var _0x33209c={'messageId':_0x47ded9['messages'][0x0][_0xe0aa('0x69')]};if(!_0x2afc2c[_0xe0aa('0x39')]){_0x33209c[_0xe0aa('0x40')]=!![];}return _0x5bab98[_0xe0aa('0x1a')](_0x33209c);}else{return logger[_0xe0aa('0x2b')](_0xe0aa('0x2d'),_0xe0aa('0x3a'),'clickatell',util[_0xe0aa('0x2c')](_0x47ded9[_0xe0aa('0x2b')],{'showHidden':![],'depth':null}));}})[_0xe0aa('0x1c')](function(_0x20b058){return logger[_0xe0aa('0x2b')](_0xe0aa('0x2d'),_0xe0aa('0x3a'),_0xe0aa('0x66'),util[_0xe0aa('0x2c')](_0x20b058,{'showHidden':![],'depth':null}));});}else{logger[_0xe0aa('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe0aa('0x3a'),'clickatell',_0xe0aa('0x6a'));}break;case _0xe0aa('0x6b'):if(_0x2afc2c[_0xe0aa('0x5b')]){var _0x21e4b4={};var _0x7680d1={'method':'POST','uri':_0xe0aa('0x6c'),'headers':{'Authorization':_0xe0aa('0x6d')+_0x2afc2c['apiKey'],'Content-Type':_0xe0aa('0x6e')},'body':{'from':_0x2afc2c[_0xe0aa('0x25')],'to':_0x5d97e0['phone'],'text':_0x5d97e0[_0xe0aa('0xe')]},'json':!![]};return rp(_0x7680d1)[_0xe0aa('0x19')](function(_0x30f7e8){if(_0x30f7e8['code']==0xca){_0x21e4b4[_0xe0aa('0x6f')]=_0x30f7e8;var _0x2e5b77={'method':_0xe0aa('0x3d'),'uri':_0xe0aa('0x70'),'headers':{'Authorization':'Bearer\x20'+_0x2afc2c[_0xe0aa('0x5b')],'Content-Type':_0xe0aa('0x6e')},'body':{'refid':_0x21e4b4['message'][_0xe0aa('0x71')]},'json':!![]};return rp(_0x2e5b77)['then'](function(_0x38ac2c){_0x21e4b4[_0xe0aa('0x72')]=_0x38ac2c;var _0xe9e1ac={'messageId':_0x21e4b4[_0xe0aa('0x6f')][_0xe0aa('0x71')],'read':!![]};return _0x5bab98[_0xe0aa('0x1a')](_0xe9e1ac);});}else{return logger['error'](_0xe0aa('0x2d'),_0xe0aa('0x3a'),_0xe0aa('0x6b'),util[_0xe0aa('0x2c')](_0x30f7e8,{'showHidden':![],'depth':null}));}})[_0xe0aa('0x1c')](function(_0x5f1d61){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe0aa('0x3a'),_0xe0aa('0x6b'),util[_0xe0aa('0x2c')](_0x5f1d61,{'showHidden':![],'depth':null}));});}else{return logger[_0xe0aa('0x2b')](_0xe0aa('0x2d'),_0xe0aa('0x3a'),_0xe0aa('0x6b'),'Token\x20not\x20received');}break;}}})[_0xe0aa('0x73')](function(){_0x2e414e();});}else{_0x2e414e();}}},'charset':_0xe0aa('0x74'),'collate':_0xe0aa('0x75')});}; \ No newline at end of file +var _0x1733=['user_key','session_key','total_sent','internal_order_id','deliveryReport','read','update','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','IBSSO\x20','csc','login','apiKey','createHash','md5','digest','hex','signature=','GET','keys','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','moment','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','createdAt','out','SmsAccount','find','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/api/sms/messages/','/status?token=','token','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','split','sms'];(function(_0x480c91,_0x2730b7){var _0x4afa8e=function(_0x54fbc9){while(--_0x54fbc9){_0x480c91['push'](_0x480c91['shift']());}};_0x4afa8e(++_0x2730b7);}(_0x1733,0x1a3));var _0x3173=function(_0x3e04c7,_0x28dea4){_0x3e04c7=_0x3e04c7-0x0;var _0xa49b59=_0x1733[_0x3e04c7];return _0xa49b59;};'use strict';var _=require(_0x3173('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3173('0x1'));var BPromise=require('bluebird');var rp=require(_0x3173('0x2'));var fs=require('fs');var path=require(_0x3173('0x3'));var rimraf=require('rimraf');var config=require(_0x3173('0x4'));var attributes=require(_0x3173('0x5'));module[_0x3173('0x6')]=function(_0x123008,_0x4bf6e){return _0x123008[_0x3173('0x7')](_0x3173('0x8'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x3173('0x9'),'fields':['messageId']},{'name':'fti_sms_messages','fields':['body'],'type':_0x3173('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x531c05,_0x45089e,_0xdd32ba){var _0x2e347c=_0x123008[_0x3173('0xb')];var _0x4e89ef=_0x531c05[_0x3173('0xc')]({'plain':!![]});if(_0x4e89ef[_0x3173('0xd')][_0x3173('0xe')]()==='in'||_0x4e89ef[_0x3173('0xd')]['toLowerCase']()==='out'&&!_0x4e89ef[_0x3173('0xf')]&&!_[_0x3173('0x10')](_0x4e89ef['UserId'])){_0x2e347c[_0x3173('0x11')][_0x3173('0x12')]({'where':{'id':_0x4e89ef[_0x3173('0x13')]}})[_0x3173('0x14')](function(_0x35b65e){if(_0x35b65e){_0x35b65e['update']({'lastMsgAt':_0x4e89ef[_0x3173('0x15')],'lastMsgDirection':_0x4e89ef[_0x3173('0xd')][_0x3173('0xe')]()});}})['catch'](function(_0x298f60){console['error'](_0x298f60);});}if(_0x4e89ef[_0x3173('0xd')]===_0x3173('0x16')&&!_0x4e89ef[_0x3173('0xf')]){var _0x26fdd3;_0x2e347c[_0x3173('0x17')][_0x3173('0x18')]({'where':{'id':_0x4e89ef['SmsAccountId']},'raw':!![]})[_0x3173('0x14')](function(_0x11723b){_0x26fdd3=_0x11723b;if(_0x26fdd3&&_0x26fdd3[_0x3173('0x19')]){switch(_0x26fdd3[_0x3173('0x19')]){case _0x3173('0x1a'):var _0x5bd8d1=require(_0x3173('0x1a'));if(_0x26fdd3[_0x3173('0x1b')]&&_0x26fdd3[_0x3173('0x1c')]&&_0x26fdd3[_0x3173('0x1d')]){var _0x585e02=new _0x5bd8d1(_0x26fdd3[_0x3173('0x1b')],_0x26fdd3['authToken']);_0x585e02[_0x3173('0x1e')][_0x3173('0x1f')]({'body':_0x4e89ef[_0x3173('0x20')],'to':_0x4e89ef[_0x3173('0x1d')],'from':_0x26fdd3[_0x3173('0x1d')],'statusCallback':_0x26fdd3[_0x3173('0x21')]+_0x3173('0x22')+_0x4e89ef['id']+_0x3173('0x23')+_0x26fdd3[_0x3173('0x24')]})[_0x3173('0x14')](function(_0x220e6b){if(_0x220e6b['sid']){return _0x531c05['update']({'messageId':_0x220e6b[_0x3173('0x25')]});}})[_0x3173('0x26')](function(_0x457cb6){logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x1a'),util[_0x3173('0x2a')](_0x457cb6,{'showHidden':![],'depth':null}));});}else{logger[_0x3173('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3173('0x29'),_0x3173('0x1a'),_0x3173('0x2b'));}break;case _0x3173('0x2c'):var _0x3a296d=_0x3173('0x2d');if(_0x26fdd3[_0x3173('0x2e')]&&_0x26fdd3[_0x3173('0x2f')]){var _0x1700f0={'recipient':[_0x4e89ef[_0x3173('0x1d')]],'message':_0x4e89ef[_0x3173('0x20')],'message_type':_0x26fdd3[_0x3173('0x30')]};if(_0x26fdd3['smsMethod']&&_0x26fdd3[_0x3173('0x30')]!=='SI'){_0x1700f0[_0x3173('0x31')]=_0x26fdd3[_0x3173('0x1d')];}var _0xfb44cb={'url':_0x3a296d+_0x3173('0x32')+_0x26fdd3[_0x3173('0x2e')]+'&password='+_0x26fdd3[_0x3173('0x2f')],'method':'GET'};rp(_0xfb44cb)['then'](function(_0x470e5f){var _0x53f86b=_0x470e5f[_0x3173('0x33')](';');var _0x2b1e1d={'user_key':_0x53f86b[0x0],'session_key':_0x53f86b[0x1]};_0xfb44cb={'url':_0x3a296d+_0x3173('0x34'),'method':'POST','headers':{'user_key':_0x2b1e1d[_0x3173('0x35')],'Session_key':_0x2b1e1d[_0x3173('0x36')]},'json':!![],'body':_0x1700f0};return rp(_0xfb44cb);})[_0x3173('0x14')](function(_0x5526d8){if(_0x5526d8[_0x3173('0x37')]>=0x1){var _0x505f1a={'messageId':_0x5526d8[_0x3173('0x38')]};if(_0x26fdd3[_0x3173('0x30')]!=='GP'||!_0x26fdd3[_0x3173('0x39')]){_0x505f1a[_0x3173('0x3a')]=!![];}return _0x531c05[_0x3173('0x3b')](_0x505f1a);}else{return logger[_0x3173('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0x3173('0x2a')](_0x5526d8,{'showHidden':![],'depth':null}));}})[_0x3173('0x26')](function(_0x551842){return logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x2c'),util[_0x3173('0x2a')](_0x551842,{'showHidden':![],'depth':null}));});}else{logger[_0x3173('0x27')](_0x3173('0x28'),'afterCreate',_0x3173('0x2c'),_0x3173('0x3c'));}break;case _0x3173('0x3d'):if(_0x26fdd3['authToken']){var _0x1da7fe={'recipient':_0x4e89ef[_0x3173('0x1d')],'message':_0x4e89ef['body'],'sender':_0x26fdd3[_0x3173('0x3e')]||_0x26fdd3[_0x3173('0x1d')],'authorization':_0x26fdd3[_0x3173('0x1c')]};var _0x45089e={'method':_0x3173('0x3f'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x1da7fe,'json':!![]};rp(_0x45089e)[_0x3173('0x14')](function(_0x3d0b07){var _0x3421d4={'messageId':_0x3d0b07[_0x3173('0x40')]};if(!_0x26fdd3[_0x3173('0x39')]){_0x3421d4[_0x3173('0x3a')]=!![];}return _0x531c05[_0x3173('0x3b')](_0x3421d4);})[_0x3173('0x26')](function(_0x9639f8){logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x3d'),util['inspect'](_0x9639f8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x3d'),_0x3173('0x41'));}break;case _0x3173('0x42'):if(_0x26fdd3[_0x3173('0x2e')]&&_0x26fdd3['password']){var _0x1da7fe={'messages':[{'source':_0x3173('0x43'),'to':_0x4e89ef['phone'],'body':_0x4e89ef[_0x3173('0x20')],'from':_0x26fdd3[_0x3173('0x3e')]||_0x26fdd3[_0x3173('0x1d')]}]};var _0x106b6b=util[_0x3173('0x44')](_0x3173('0x45'),_0x26fdd3[_0x3173('0x2e')],_0x26fdd3['password']);var _0x45089e={'method':_0x3173('0x3f'),'uri':_0x3173('0x46'),'body':_0x1da7fe,'headers':{'Authorization':util['format'](_0x3173('0x47'),new Buffer(_0x106b6b)[_0x3173('0x48')](_0x3173('0x49')))},'json':!![]};rp(_0x45089e)[_0x3173('0x14')](function(_0x586195){if(_0x586195['http_code']>=0xc8&&_0x586195[_0x3173('0x4a')]<=0xce){if(_0x586195[_0x3173('0x4b')]&&_0x586195[_0x3173('0x4b')][_0x3173('0x4c')]>0x0){var _0x4dc828=_[_0x3173('0x4d')](_0x586195[_0x3173('0x4b')]['messages']);var _0x5675a4={'messageId':_0x4dc828[_0x3173('0x4e')]};if(!_0x26fdd3[_0x3173('0x39')]){_0x5675a4[_0x3173('0x3a')]=!![];}return _0x531c05[_0x3173('0x3b')](_0x5675a4);}else{logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x4f'),util['inspect'](_0x586195,{'showHidden':![],'depth':null}));}}else{logger[_0x3173('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3173('0x29'),_0x3173('0x4f'),util[_0x3173('0x2a')](_0x586195,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3e3d3b){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3173('0x4f'),util[_0x3173('0x2a')](_0x3e3d3b,{'showHidden':![],'depth':null}));});}else{logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x26fdd3[_0x3173('0x50')]&&_0x26fdd3[_0x3173('0x1c')]){var _0x1da7fe={'dst':_0x4e89ef[_0x3173('0x1d')],'text':_0x4e89ef[_0x3173('0x20')],'src':_0x26fdd3['senderString']||_0x26fdd3[_0x3173('0x1d')],'url':_0x26fdd3[_0x3173('0x21')]+_0x3173('0x22')+_0x4e89ef['id']+_0x3173('0x23')+_0x26fdd3['token']};var _0x106b6b=util[_0x3173('0x44')](_0x3173('0x45'),_0x26fdd3['authId'],_0x26fdd3[_0x3173('0x1c')]);var _0x45089e={'method':_0x3173('0x3f'),'uri':util[_0x3173('0x44')](_0x3173('0x51'),_0x26fdd3[_0x3173('0x50')]),'body':_0x1da7fe,'headers':{'Authorization':util[_0x3173('0x44')]('Basic\x20%s',new Buffer(_0x106b6b)[_0x3173('0x48')]('base64'))},'json':!![]};rp(_0x45089e)[_0x3173('0x14')](function(_0x52817d){var _0x63f1c4={'messageId':_0x52817d[_0x3173('0x52')][0x0]};return _0x531c05[_0x3173('0x3b')](_0x63f1c4);})[_0x3173('0x26')](function(_0x78a35d){logger[_0x3173('0x27')](_0x3173('0x28'),'afterCreate','plivo',util[_0x3173('0x2a')](_0x78a35d,{'showHidden':![],'depth':null}));});}else{logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x53'),_0x3173('0x54'));}break;case _0x3173('0x55'):if(_0x26fdd3[_0x3173('0x2e')]&&_0x26fdd3[_0x3173('0x2f')]){if(_0x26fdd3[_0x3173('0x56')]){var _0x116b26={'method':_0x3173('0x3f'),'uri':_0x26fdd3[_0x3173('0x56')]+'/auth/1/session','body':{'username':_0x26fdd3[_0x3173('0x2e')],'password':_0x26fdd3[_0x3173('0x2f')]},'json':!![]};return rp(_0x116b26)[_0x3173('0x14')](function(_0x17cf8f){var _0x2e6c60={'method':'POST','uri':_0x26fdd3[_0x3173('0x56')]+_0x3173('0x57'),'body':{'messages':[{'from':_0x26fdd3[_0x3173('0x1d')],'destinations':[{'to':_0x4e89ef[_0x3173('0x1d')]}],'text':_0x4e89ef[_0x3173('0x20')],'notifyUrl':_0x26fdd3['remote']+'/api/sms/messages/'+_0x4e89ef['id']+_0x3173('0x23')+_0x26fdd3[_0x3173('0x24')],'notifyContentType':'application/json','callbackData':_0x26fdd3[_0x3173('0x1d')]+';'+_0x4e89ef[_0x3173('0x20')]}]},'headers':{'Authorization':_0x3173('0x58')+_0x17cf8f[_0x3173('0x24')]},'json':!![]};return rp(_0x2e6c60)[_0x3173('0x14')](function(_0x38976c){if(_0x38976c[_0x3173('0x1e')]){var _0x532265={'messageId':_0x38976c['messages'][0x0][_0x3173('0x9')]};if(!_0x26fdd3[_0x3173('0x39')]){_0x532265[_0x3173('0x3a')]=!![];}return _0x531c05[_0x3173('0x3b')](_0x532265);}else{return logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x55'),util[_0x3173('0x2a')](_0x38976c,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x4bd7ed){return logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x55'),util['inspect'](_0x4bd7ed,{'showHidden':![],'depth':null}));});}else{logger[_0x3173('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3173('0x29'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),'infobip',_0x3173('0x3c'));}break;case _0x3173('0x59'):var _0x1fa20b=require('crypto');if(_0x26fdd3['apiKey']){var _0x4b4e22={};_0x4b4e22[_0x3173('0x5a')]=_0x26fdd3[_0x3173('0x2e')];_0x4b4e22[_0x3173('0x1d')]=_0x4e89ef[_0x3173('0x1d')];_0x4b4e22['sender']=_0x26fdd3[_0x3173('0x1d')];_0x4b4e22['text']=_0x4e89ef['body'];_0x4b4e22['timestamp']=+new Date();var _0x407db3='';var _0x2bb0ac='';var _0x2a02c1=Object['keys'](_0x4b4e22);_0x2a02c1['sort']();for(var _0x9844eb=0x0;_0x9844eb<_0x2a02c1['length'];_0x9844eb++){if(_0x407db3!=''){_0x407db3+='&';}_0x407db3+=_0x2a02c1[_0x9844eb]+'='+encodeURIComponent(_0x4b4e22[_0x2a02c1[_0x9844eb]]);_0x2bb0ac+=_0x4b4e22[_0x2a02c1[_0x9844eb]];}_0x2bb0ac+=_0x26fdd3[_0x3173('0x5b')];_0x2bb0ac=_0x1fa20b[_0x3173('0x5c')](_0x3173('0x5d'))['update'](_0x2bb0ac)[_0x3173('0x5e')](_0x3173('0x5f'));if(_0x407db3!==''){_0x407db3+='&';}_0x407db3+=_0x3173('0x60')+_0x2bb0ac;var _0xfb44cb={'method':_0x3173('0x61'),'uri':_0x26fdd3[_0x3173('0x56')]+'/external/get/send.php?'+_0x407db3,'json':!![]};return rp(_0xfb44cb)[_0x3173('0x14')](function(_0xfd4899){var _0xe298ca=Object[_0x3173('0x62')](_0xfd4899);if(_0xfd4899[_0xe298ca[0x0]][_0x3173('0x27')]&&parseInt(_0xfd4899[_0xe298ca[0x0]][_0x3173('0x27')])===0x0){var _0x38bbea={'messageId':_0xfd4899[_0xe298ca[0x0]]['id_sms']};if(!_0x26fdd3['deliveryReport']){_0x38bbea[_0x3173('0x3a')]=!![];}return _0x531c05[_0x3173('0x3b')](_0x38bbea);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3173('0x29'),_0x3173('0x59'),util[_0x3173('0x2a')](_0xfd4899['error'],{'showHidden':![],'depth':null}));}})[_0x3173('0x26')](function(_0x57a543){return logger['error'](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x59'),util[_0x3173('0x2a')](_0x57a543,{'showHidden':![],'depth':null}));});}else{logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x59'),'Missing\x20parameters:\x20apiKey');}break;case _0x3173('0x63'):if(_0x26fdd3[_0x3173('0x5b')]){var _0x483791={'method':_0x3173('0x3f'),'uri':_0x3173('0x64'),'headers':{'Authorization':_0x26fdd3[_0x3173('0x5b')]},'body':{'content':_0x4e89ef[_0x3173('0x20')],'to':[_0x4e89ef['phone']],'from':_0x26fdd3['phone'],'binary':![],'clientMessageId':_0x3173('0x65'),'charset':_0x3173('0x66')},'json':!![]};rp(_0x483791)[_0x3173('0x14')](function(_0x5f0975){if(!_0x5f0975[_0x3173('0x27')]){var _0x7a2526={'messageId':_0x5f0975[_0x3173('0x1e')][0x0][_0x3173('0x67')]};if(!_0x26fdd3['deliveryReport']){_0x7a2526['read']=!![];}return _0x531c05[_0x3173('0x3b')](_0x7a2526);}else{return logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x63'),util[_0x3173('0x2a')](_0x5f0975[_0x3173('0x27')],{'showHidden':![],'depth':null}));}})[_0x3173('0x26')](function(_0x5a5f43){return logger[_0x3173('0x27')](_0x3173('0x28'),'afterCreate','clickatell',util[_0x3173('0x2a')](_0x5a5f43,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x63'),_0x3173('0x68'));}break;case'intelepeer':if(_0x26fdd3[_0x3173('0x5b')]){var _0x1ba8f3={};var _0xfb44cb={'method':_0x3173('0x3f'),'uri':_0x3173('0x69'),'headers':{'Authorization':'Bearer\x20'+_0x26fdd3['apiKey'],'Content-Type':_0x3173('0x6a')},'body':{'from':_0x26fdd3['phone'],'to':_0x4e89ef[_0x3173('0x1d')],'text':_0x4e89ef[_0x3173('0x20')]},'json':!![]};return rp(_0xfb44cb)['then'](function(_0x3d6774){if(_0x3d6774[_0x3173('0x6b')]==0xca){_0x1ba8f3[_0x3173('0x6c')]=_0x3d6774;var _0x500807={'method':'POST','uri':_0x3173('0x6d'),'headers':{'Authorization':_0x3173('0x6e')+_0x26fdd3[_0x3173('0x5b')],'Content-Type':'application/json'},'body':{'refid':_0x1ba8f3['message'][_0x3173('0x6f')]},'json':!![]};return rp(_0x500807)[_0x3173('0x14')](function(_0x4675b3){_0x1ba8f3[_0x3173('0x70')]=_0x4675b3;var _0x318734={'messageId':_0x1ba8f3[_0x3173('0x6c')][_0x3173('0x6f')],'read':!![]};return _0x531c05['update'](_0x318734);});}else{return logger[_0x3173('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3173('0x29'),'intelepeer',util[_0x3173('0x2a')](_0x3d6774,{'showHidden':![],'depth':null}));}})[_0x3173('0x26')](function(_0x16ba5c){return logger[_0x3173('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3173('0x29'),_0x3173('0x71'),util['inspect'](_0x16ba5c,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x71'),_0x3173('0x72'));}break;}}})[_0x3173('0x73')](function(){_0xdd32ba();});}else{_0xdd32ba();}}},'charset':_0x3173('0x74'),'collate':_0x3173('0x75')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 43a518a..383e5f7 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 _0x5f2f=['SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SmsMessage','create','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x433c9c,_0x32024f){var _0x47ff2d=function(_0x5c5b6f){while(--_0x5c5b6f){_0x433c9c['push'](_0x433c9c['shift']());}};_0x47ff2d(++_0x32024f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2afe95,_0x3d01e1){_0x2afe95=_0x2afe95-0x0;var _0x11cd87=_0x5f2f[_0x2afe95];return _0x11cd87;};'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});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./smsMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateSmsMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','body'];(function(_0xb9c0ae,_0x43d1ad){var _0x579954=function(_0x1ca994){while(--_0x1ca994){_0xb9c0ae['push'](_0xb9c0ae['shift']());}};_0x579954(++_0x43d1ad);}(_0xb10b,0x12a));var _0xbb10=function(_0x272587,_0x4e5fb1){_0x272587=_0x272587-0x0;var _0x3c2ff6=_0xb10b[_0x272587];return _0x3c2ff6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('SmsMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('SmsMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 4919a3e..2a48b4d 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 _0x51ef=['remove','emit','removeListener','smsMessage:','save'];(function(_0x5cce47,_0x4aa021){var _0x45b943=function(_0x3858aa){while(--_0x3858aa){_0x5cce47['push'](_0x5cce47['shift']());}};_0x45b943(++_0x4aa021);}(_0x51ef,0x1d0));var _0xf51e=function(_0xaa2422,_0x1bf447){_0xaa2422=_0xaa2422-0x0;var _0x28bab9=_0x51ef[_0xaa2422];return _0x28bab9;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xf51e('0x0'),_0xf51e('0x1'),'update'];function createListener(_0x2511d1,_0x424652){return function(_0x16acb2){_0x424652[_0xf51e('0x2')](_0x2511d1,_0x16acb2);};}function removeListener(_0x9ad1cb,_0x5c215d){return function(){SmsMessageEvents[_0xf51e('0x3')](_0x9ad1cb,_0x5c215d);};}exports['register']=function(_0x19233e){for(var _0x53d8cc=0x0,_0x56f271=events['length'];_0x53d8cc<_0x56f271;_0x53d8cc++){var _0x4f1057=events[_0x53d8cc];var _0x14fc6b=createListener(_0xf51e('0x4')+_0x4f1057,_0x19233e);SmsMessageEvents['on'](_0x4f1057,_0x14fc6b);}}; \ No newline at end of file +var _0xce72=['smsMessage:','./smsMessage.events','update','emit','removeListener','register','length'];(function(_0x4347ec,_0x41c4b8){var _0x4c8314=function(_0x583acd){while(--_0x583acd){_0x4347ec['push'](_0x4347ec['shift']());}};_0x4c8314(++_0x41c4b8);}(_0xce72,0x13c));var _0x2ce7=function(_0x311121,_0x5ea9ce){_0x311121=_0x311121-0x0;var _0x1f3d47=_0xce72[_0x311121];return _0x1f3d47;};'use strict';var SmsMessageEvents=require(_0x2ce7('0x0'));var events=['save','remove',_0x2ce7('0x1')];function createListener(_0x3453d5,_0x277ceb){return function(_0x31c55e){_0x277ceb[_0x2ce7('0x2')](_0x3453d5,_0x31c55e);};}function removeListener(_0x5a777c,_0x59b86c){return function(){SmsMessageEvents[_0x2ce7('0x3')](_0x5a777c,_0x59b86c);};}exports[_0x2ce7('0x4')]=function(_0x475f7f){for(var _0x259618=0x0,_0xf9c423=events[_0x2ce7('0x5')];_0x259618<_0xf9c423;_0x259618++){var _0x40bd3d=events[_0x259618];var _0x26023b=createListener(_0x2ce7('0x6')+_0x40bd3d,_0x475f7f);SmsMessageEvents['on'](_0x40bd3d,_0x26023b);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 5de18ca..e322a02 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 _0x56b9=['/:id/members','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x56b9,0x196));var _0x956b=function(_0x5d16ed,_0x211a45){_0x5d16ed=_0x5d16ed-0x0;var _0x107f5d=_0x56b9[_0x5d16ed];return _0x107f5d;};'use strict';var multer=require(_0x956b('0x0'));var util=require(_0x956b('0x1'));var path=require(_0x956b('0x2'));var timeout=require(_0x956b('0x3'));var express=require(_0x956b('0x4'));var router=express[_0x956b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x956b('0x6'));var config=require('../../config/environment');var controller=require(_0x956b('0x7'));router[_0x956b('0x8')]('/',auth[_0x956b('0x9')](),controller['index']);router[_0x956b('0x8')](_0x956b('0xa'),auth[_0x956b('0x9')](),controller[_0x956b('0xb')]);router[_0x956b('0x8')](_0x956b('0xc'),auth[_0x956b('0x9')](),controller[_0x956b('0xd')]);router['get'](_0x956b('0xe'),auth[_0x956b('0x9')](),controller['getMembers']);router[_0x956b('0x8')](_0x956b('0xf'),auth[_0x956b('0x9')](),controller[_0x956b('0x10')]);router[_0x956b('0x8')]('/:id/users',auth[_0x956b('0x9')](),controller[_0x956b('0x11')]);router[_0x956b('0x12')]('/',auth[_0x956b('0x9')](),controller[_0x956b('0x13')]);router[_0x956b('0x12')](_0x956b('0xf'),auth[_0x956b('0x9')](),controller[_0x956b('0x14')]);router[_0x956b('0x12')](_0x956b('0x15'),auth['isAuthenticated'](),controller[_0x956b('0x16')]);router[_0x956b('0x17')](_0x956b('0xc'),auth['isAuthenticated'](),controller[_0x956b('0x18')]);router[_0x956b('0x19')](_0x956b('0xc'),auth[_0x956b('0x9')](),controller[_0x956b('0x1a')]);router[_0x956b('0x19')](_0x956b('0xf'),auth['isAuthenticated'](),controller[_0x956b('0x1b')]);router[_0x956b('0x19')](_0x956b('0x15'),auth['isAuthenticated'](),controller[_0x956b('0x1c')]);module[_0x956b('0x1d')]=router; \ No newline at end of file +var _0xe635=['path','connect-timeout','express','Router','../../components/auth/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','post','create','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util'];(function(_0x308f01,_0x559dd9){var _0x3496a2=function(_0xce556){while(--_0xce556){_0x308f01['push'](_0x308f01['shift']());}};_0x3496a2(++_0x559dd9);}(_0xe635,0x1be));var _0x5e63=function(_0x70fa60,_0x1460c0){_0x70fa60=_0x70fa60-0x0;var _0xa48a63=_0xe635[_0x70fa60];return _0xa48a63;};'use strict';var multer=require(_0x5e63('0x0'));var util=require(_0x5e63('0x1'));var path=require(_0x5e63('0x2'));var timeout=require(_0x5e63('0x3'));var express=require(_0x5e63('0x4'));var router=express[_0x5e63('0x5')]();var auth=require(_0x5e63('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5e63('0x7'));router[_0x5e63('0x8')]('/',auth[_0x5e63('0x9')](),controller[_0x5e63('0xa')]);router[_0x5e63('0x8')](_0x5e63('0xb'),auth[_0x5e63('0x9')](),controller[_0x5e63('0xc')]);router[_0x5e63('0x8')](_0x5e63('0xd'),auth['isAuthenticated'](),controller[_0x5e63('0xe')]);router[_0x5e63('0x8')](_0x5e63('0xf'),auth[_0x5e63('0x9')](),controller['getMembers']);router[_0x5e63('0x8')](_0x5e63('0x10'),auth['isAuthenticated'](),controller[_0x5e63('0x11')]);router[_0x5e63('0x8')]('/:id/users',auth[_0x5e63('0x9')](),controller['getAgents']);router[_0x5e63('0x12')]('/',auth[_0x5e63('0x9')](),controller[_0x5e63('0x13')]);router[_0x5e63('0x12')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x5e63('0x12')](_0x5e63('0x14'),auth['isAuthenticated'](),controller[_0x5e63('0x15')]);router[_0x5e63('0x16')](_0x5e63('0xd'),auth['isAuthenticated'](),controller[_0x5e63('0x17')]);router[_0x5e63('0x18')](_0x5e63('0xd'),auth[_0x5e63('0x9')](),controller[_0x5e63('0x19')]);router['delete'](_0x5e63('0x10'),auth[_0x5e63('0x9')](),controller[_0x5e63('0x1a')]);router[_0x5e63('0x18')](_0x5e63('0x14'),auth['isAuthenticated'](),controller[_0x5e63('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 38c91d7..7d8284e 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 _0x8dd5=['exports','name','STRING','INTEGER','ENUM','beepall'];(function(_0x326047,_0x528a22){var _0x6aee02=function(_0x4d9052){while(--_0x4d9052){_0x326047['push'](_0x326047['shift']());}};_0x6aee02(++_0x528a22);}(_0x8dd5,0x90));var _0x58dd=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0x8dd5[_0x270a54];return _0x4d07d0;};'use strict';var Sequelize=require('sequelize');module[_0x58dd('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x58dd('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x58dd('0x2')]},'timeout':{'type':Sequelize[_0x58dd('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x58dd('0x4')]('rrmemory',_0x58dd('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x94f7=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x44fa97,_0x1575c7){var _0x15a029=function(_0xc5dc83){while(--_0xc5dc83){_0x44fa97['push'](_0x44fa97['shift']());}};_0x15a029(++_0x1575c7);}(_0x94f7,0x13c));var _0x794f=function(_0x4515a9,_0x523d5c){_0x4515a9=_0x4515a9-0x0;var _0xeb88f5=_0x94f7[_0x4515a9];return _0xeb88f5;};'use strict';var Sequelize=require(_0x794f('0x0'));module[_0x794f('0x1')]={'name':{'type':Sequelize[_0x794f('0x2')],'unique':_0x794f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x794f('0x2')]},'timeout':{'type':Sequelize[_0x794f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x794f('0x5')](_0x794f('0x6'),_0x794f('0x7'),_0x794f('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c08cae7..35aab20 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 _0x361f=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','SmsQueues','UserProfileResource','destroy','end','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','SmsQueue','includeAll','include','findAll','rows','catch','show','model','length','find','create','body','role','user','get','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserSmsQueue','order','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','every','TeamId','includes','all','compact','isEmpty','removeAgents','addAgents','omit','spread','emit','userSmsQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','lodash','squel','crypto'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x361f,0x7c));var _0xf361=function(_0x956b80,_0x58c015){_0x956b80=_0x956b80-0x0;var _0x5c1892=_0x361f[_0x956b80];return _0x5c1892;};'use strict';var pdf=require(_0xf361('0x0'));var emlformat=require(_0xf361('0x1'));var rimraf=require(_0xf361('0x2'));var zipdir=require(_0xf361('0x3'));var jsonpatch=require(_0xf361('0x4'));var rp=require(_0xf361('0x5'));var moment=require('moment');var BPromise=require(_0xf361('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf361('0x7'));var sox=require('sox');var csv=require(_0xf361('0x8'));var ejs=require(_0xf361('0x9'));var fs=require('fs');var _=require(_0xf361('0xa'));var squel=require(_0xf361('0xb'));var crypto=require(_0xf361('0xc'));var jsforce=require(_0xf361('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf361('0xe'));var Papa=require(_0xf361('0xf'));var Redis=require(_0xf361('0x10'));var authService=require(_0xf361('0x11'));var qs=require(_0xf361('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf361('0x13'));var logger=require(_0xf361('0x14'))(_0xf361('0x15'));var utils=require(_0xf361('0x16'));var config=require(_0xf361('0x17'));var db=require(_0xf361('0x18'))['db'];config[_0xf361('0x19')]=_[_0xf361('0x1a')](config[_0xf361('0x19')],{'host':_0xf361('0x1b'),'port':0x18eb});var socket=require(_0xf361('0x1c'))(new Redis(config[_0xf361('0x19')]));require(_0xf361('0x1d'))['register'](socket);function respondWithStatusCode(_0x3b1583,_0x3f03d8){_0x3f03d8=_0x3f03d8||0xcc;return function(_0xe2cc76){if(_0xe2cc76){return _0x3b1583['sendStatus'](_0x3f03d8);}return _0x3b1583[_0xf361('0x1e')](_0x3f03d8)['end']();};}function respondWithResult(_0x107a29,_0x5e564c){_0x5e564c=_0x5e564c||0xc8;return function(_0x113384){if(_0x113384){return _0x107a29[_0xf361('0x1e')](_0x5e564c)['json'](_0x113384);}};}function respondWithFilteredResult(_0xe8fc5d,_0x370f33){return function(_0x411eca){if(_0x411eca){var _0x4f4530=_0x411eca[_0xf361('0x1f')],_0x1b0109=_0x370f33[_0xf361('0x20')],_0x1bb1d7=_0x370f33[_0xf361('0x20')]+_0x370f33[_0xf361('0x21')],_0x569f29;if(_0x1bb1d7>=_0x4f4530){_0x1bb1d7=_0x4f4530;_0x569f29=0xc8;}else{_0x569f29=0xce;}_0xe8fc5d['status'](_0x569f29);return _0xe8fc5d['set'](_0xf361('0x22'),_0x1b0109+'-'+_0x1bb1d7+'/'+_0x4f4530)[_0xf361('0x23')](_0x411eca);}return null;};}function patchUpdates(_0x494a22){return function(_0x5a350b){try{jsonpatch[_0xf361('0x24')](_0x5a350b,_0x494a22,!![]);}catch(_0x4dab39){return BPromise[_0xf361('0x25')](_0x4dab39);}return _0x5a350b[_0xf361('0x26')]();};}function saveUpdates(_0x24ef77,_0x51df81){return function(_0x53d8db){if(_0x53d8db){return _0x53d8db[_0xf361('0x27')](_0x24ef77)[_0xf361('0x28')](function(_0x207d6a){return _0x207d6a;});}return null;};}function removeEntity(_0x8ab291,_0x527fa2){return function(_0x1780b7){if(_0x1780b7){return _0x1780b7['destroy']()[_0xf361('0x28')](function(){var _0x433fcf=_0x1780b7['get']({'plain':!![]});var _0x2ff6ec=_0xf361('0x29');return db[_0xf361('0x2a')][_0xf361('0x2b')]({'where':{'type':_0x2ff6ec,'resourceId':_0x433fcf['id']}})['then'](function(){return _0x1780b7;});})[_0xf361('0x28')](function(){_0x8ab291[_0xf361('0x1e')](0xcc)[_0xf361('0x2c')]();});}};}function handleEntityNotFound(_0x37a078,_0x4ac99a){return function(_0x5894a7){if(!_0x5894a7){_0x37a078['sendStatus'](0x194);}return _0x5894a7;};}function handleError(_0x355fee,_0xe09f77){_0xe09f77=_0xe09f77||0x1f4;return function(_0xa65d48){logger[_0xf361('0x2d')](_0xa65d48[_0xf361('0x2e')]);if(_0xa65d48[_0xf361('0x2f')]){delete _0xa65d48[_0xf361('0x2f')];}_0x355fee[_0xf361('0x1e')](_0xe09f77)[_0xf361('0x30')](_0xa65d48);};}exports['index']=function(_0x48f0c6,_0x148d44){var _0x51999b={},_0x55e26c={},_0x1c647a={'count':0x0,'rows':[]};var _0x448f87=_['map'](db['SmsQueue'][_0xf361('0x31')],function(_0x5b9bc0){return{'name':_0x5b9bc0[_0xf361('0x32')],'type':_0x5b9bc0[_0xf361('0x33')][_0xf361('0x34')]};});_0x55e26c['model']=_[_0xf361('0x35')](_0x448f87,_0xf361('0x2f'));_0x55e26c[_0xf361('0x36')]=_[_0xf361('0x37')](_0x48f0c6[_0xf361('0x36')]);_0x55e26c[_0xf361('0x38')]=_['intersection'](_0x55e26c['model'],_0x55e26c[_0xf361('0x36')]);_0x51999b[_0xf361('0x39')]=_[_0xf361('0x3a')](_0x55e26c['model'],qs[_0xf361('0x3b')](_0x48f0c6[_0xf361('0x36')][_0xf361('0x3b')]));_0x51999b[_0xf361('0x39')]=_0x51999b[_0xf361('0x39')]['length']?_0x51999b[_0xf361('0x39')]:_0x55e26c['model'];if(!_0x48f0c6[_0xf361('0x36')][_0xf361('0x3c')](_0xf361('0x3d'))){_0x51999b[_0xf361('0x21')]=qs[_0xf361('0x21')](_0x48f0c6[_0xf361('0x36')][_0xf361('0x21')]);_0x51999b['offset']=qs['offset'](_0x48f0c6['query'][_0xf361('0x20')]);}_0x51999b['order']=qs['sort'](_0x48f0c6[_0xf361('0x36')][_0xf361('0x3e')]);_0x51999b[_0xf361('0x3f')]=qs['filters'](_[_0xf361('0x40')](_0x48f0c6['query'],_0x55e26c[_0xf361('0x38')]),_0x448f87);if(_0x48f0c6[_0xf361('0x36')][_0xf361('0x41')]){_0x51999b['where']=_['merge'](_0x51999b[_0xf361('0x3f')],{'$or':_[_0xf361('0x35')](_0x448f87,function(_0x2a5c59){if(_0x2a5c59[_0xf361('0x33')]!==_0xf361('0x42')){var _0x484367={};_0x484367[_0x2a5c59[_0xf361('0x2f')]]={'$like':'%'+_0x48f0c6[_0xf361('0x36')]['filter']+'%'};return _0x484367;}})});}_0x51999b=_[_0xf361('0x43')]({},_0x51999b,_0x48f0c6[_0xf361('0x44')]);var _0x39f439={'where':_0x51999b[_0xf361('0x3f')]};return db[_0xf361('0x45')][_0xf361('0x1f')](_0x39f439)[_0xf361('0x28')](function(_0x39f344){_0x1c647a[_0xf361('0x1f')]=_0x39f344;if(_0x48f0c6['query'][_0xf361('0x46')]){_0x51999b[_0xf361('0x47')]=[{'all':!![]}];}return db[_0xf361('0x45')][_0xf361('0x48')](_0x51999b);})[_0xf361('0x28')](function(_0x399994){_0x1c647a[_0xf361('0x49')]=_0x399994;return _0x1c647a;})['then'](respondWithFilteredResult(_0x148d44,_0x51999b))[_0xf361('0x4a')](handleError(_0x148d44,null));};exports[_0xf361('0x4b')]=function(_0x24498,_0x21c3a3){var _0x3617ed={'raw':!![],'where':{'id':_0x24498['params']['id']}},_0x5630e1={};_0x5630e1[_0xf361('0x4c')]=_[_0xf361('0x37')](db[_0xf361('0x45')][_0xf361('0x31')]);_0x5630e1[_0xf361('0x36')]=_['keys'](_0x24498[_0xf361('0x36')]);_0x5630e1[_0xf361('0x38')]=_[_0xf361('0x3a')](_0x5630e1['model'],_0x5630e1[_0xf361('0x36')]);_0x3617ed[_0xf361('0x39')]=_[_0xf361('0x3a')](_0x5630e1[_0xf361('0x4c')],qs[_0xf361('0x3b')](_0x24498[_0xf361('0x36')]['fields']));_0x3617ed['attributes']=_0x3617ed[_0xf361('0x39')][_0xf361('0x4d')]?_0x3617ed[_0xf361('0x39')]:_0x5630e1[_0xf361('0x4c')];if(_0x24498['query']['includeAll']){_0x3617ed[_0xf361('0x47')]=[{'all':!![]}];}_0x3617ed=_[_0xf361('0x43')]({},_0x3617ed,_0x24498['options']);return db[_0xf361('0x45')][_0xf361('0x4e')](_0x3617ed)['then'](handleEntityNotFound(_0x21c3a3,null))[_0xf361('0x28')](respondWithResult(_0x21c3a3,null))[_0xf361('0x4a')](handleError(_0x21c3a3,null));};exports['create']=function(_0x56b365,_0x5132a7){return db['SmsQueue'][_0xf361('0x4f')](_0x56b365[_0xf361('0x50')],{})['then'](function(_0x150714){var _0x372314=_0x56b365['user']['get']({'plain':!![]});if(!_0x372314)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x372314[_0xf361('0x51')]===_0xf361('0x52')){var _0xcd3313=_0x150714[_0xf361('0x53')]({'plain':!![]});var _0x51bdec=_0xf361('0x29');return db['UserProfileSection'][_0xf361('0x4e')]({'where':{'name':_0x51bdec,'userProfileId':_0x372314[_0xf361('0x54')]},'raw':!![]})[_0xf361('0x28')](function(_0x21453c){if(_0x21453c&&_0x21453c['autoAssociation']===0x0){return db[_0xf361('0x2a')][_0xf361('0x4f')]({'name':_0xcd3313['name'],'resourceId':_0xcd3313['id'],'type':_0x21453c[_0xf361('0x2f')],'sectionId':_0x21453c['id']},{})[_0xf361('0x28')](function(){return _0x150714;});}else{return _0x150714;}})['catch'](function(_0x2a7fa0){logger[_0xf361('0x2d')](_0xf361('0x55'),_0x2a7fa0);throw _0x2a7fa0;});}return _0x150714;})[_0xf361('0x28')](respondWithResult(_0x5132a7,0xc9))[_0xf361('0x4a')](handleError(_0x5132a7,null));};exports[_0xf361('0x27')]=function(_0x39608f,_0x36ce10){if(_0x39608f[_0xf361('0x50')]['id']){delete _0x39608f['body']['id'];}return db[_0xf361('0x45')][_0xf361('0x4e')]({'where':{'id':_0x39608f[_0xf361('0x56')]['id']}})[_0xf361('0x28')](handleEntityNotFound(_0x36ce10,null))[_0xf361('0x28')](saveUpdates(_0x39608f[_0xf361('0x50')],null))[_0xf361('0x28')](respondWithResult(_0x36ce10,null))[_0xf361('0x4a')](handleError(_0x36ce10,null));};exports['destroy']=function(_0x550f88,_0x2704d3){return db[_0xf361('0x45')][_0xf361('0x4e')]({'where':{'id':_0x550f88[_0xf361('0x56')]['id']}})[_0xf361('0x28')](handleEntityNotFound(_0x2704d3,null))['then'](removeEntity(_0x2704d3,null))[_0xf361('0x4a')](handleError(_0x2704d3,null));};exports[_0xf361('0x57')]=function(_0x1ff6d6,_0x632ec8){return db['SmsQueue'][_0xf361('0x57')]()[_0xf361('0x28')](respondWithResult(_0x632ec8,null))[_0xf361('0x4a')](handleError(_0x632ec8,null));};exports['getMembers']=function(_0x55a012,_0x3efc35,_0x3ea05c){var _0x53af16={'raw':!![],'where':{}},_0x14a1a1={},_0x2377c0;return db['SmsQueue'][_0xf361('0x58')]({'where':{'id':_0x55a012[_0xf361('0x56')]['id']}})[_0xf361('0x28')](handleEntityNotFound(_0x3efc35,null))[_0xf361('0x28')](function(_0x1a7beb){if(_0x1a7beb){_0x2377c0=_0x1a7beb['get']({'plain':!![]});_0x14a1a1['model']=_[_0xf361('0x37')](db[_0xf361('0x59')][_0xf361('0x31')]);_0x14a1a1['query']=_['keys'](_0x55a012[_0xf361('0x36')]);_0x14a1a1[_0xf361('0x38')]=_[_0xf361('0x3a')](_0x14a1a1[_0xf361('0x4c')],_0x14a1a1[_0xf361('0x36')]);_0x53af16[_0xf361('0x39')]=_[_0xf361('0x3a')](_0x14a1a1[_0xf361('0x4c')],qs[_0xf361('0x3b')](_0x55a012[_0xf361('0x36')]['fields']));_0x53af16[_0xf361('0x39')]=_0x53af16[_0xf361('0x39')][_0xf361('0x4d')]?_0x53af16[_0xf361('0x39')]:_0x14a1a1['model'];if(!_0x55a012['query'][_0xf361('0x3c')]('nolimit')){_0x53af16[_0xf361('0x21')]=qs['limit'](_0x55a012['query']['limit']);_0x53af16[_0xf361('0x20')]=qs[_0xf361('0x20')](_0x55a012['query'][_0xf361('0x20')]);}_0x53af16[_0xf361('0x5a')]=qs[_0xf361('0x3e')](_0x55a012[_0xf361('0x36')][_0xf361('0x3e')]);_0x53af16['where']=qs['filters'](_[_0xf361('0x40')](_0x55a012[_0xf361('0x36')],_0x14a1a1[_0xf361('0x38')]));_0x53af16[_0xf361('0x3f')][_0xf361('0x5b')]=_0x1a7beb['id'];if(_0x55a012[_0xf361('0x36')][_0xf361('0x41')]){_0x53af16[_0xf361('0x3f')]=_['merge'](_0x53af16[_0xf361('0x3f')],{'$or':_[_0xf361('0x35')](_0x53af16[_0xf361('0x39')],function(_0x1a6d5c){var _0x443199={};_0x443199[_0x1a6d5c]={'$like':'%'+_0x55a012[_0xf361('0x36')][_0xf361('0x41')]+'%'};return _0x443199;})});}_0x53af16=_[_0xf361('0x43')]({},_0x53af16,_0x55a012[_0xf361('0x44')]);return db[_0xf361('0x59')][_0xf361('0x48')](_0x53af16);}})[_0xf361('0x28')](function(_0x339013){if(_0x339013){return db[_0xf361('0x5c')][_0xf361('0x5d')]({'where':{'id':_[_0xf361('0x35')](_0x339013,_0xf361('0x5e')),'role':_0xf361('0x5f')},'attributes':['id','name',_0xf361('0x60'),_0xf361('0x61'),'createdAt']});}})[_0xf361('0x28')](function(_0x436fdb){if(_0x436fdb){return{'count':_0x436fdb['count'],'rows':_[_0xf361('0x35')](_0x436fdb[_0xf361('0x49')],function(_0x42a6ea){return{'membername':_0x42a6ea[_0xf361('0x2f')],'UserId':_0x42a6ea['id'],'queue_name':_0x2377c0[_0xf361('0x2f')],'SmsQueueId':_0x2377c0['id'],'interface':util['format'](_0xf361('0x62'),_0xf361('0x63'),_0x42a6ea[_0xf361('0x2f')]),'penalty':0x0,'paused':_0x42a6ea[_0xf361('0x60')],'createdAt':_0x42a6ea['createdAt'],'updatedAt':_0x42a6ea[_0xf361('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf361('0x28')](respondWithFilteredResult(_0x3efc35,_0x53af16))[_0xf361('0x4a')](handleError(_0x3efc35,null));};exports[_0xf361('0x64')]=function(_0x3b9d52,_0x59daee,_0x4f2c17){var _0x269f84={};var _0x3d29d1={};var _0x2073e4;var _0x39df15;return db[_0xf361('0x45')][_0xf361('0x58')]({'where':{'id':_0x3b9d52['params']['id']}})['then'](handleEntityNotFound(_0x59daee,null))[_0xf361('0x28')](function(_0x336b77){if(_0x336b77){_0x2073e4=_0x336b77;_0x3d29d1[_0xf361('0x4c')]=_['keys'](db['Team'][_0xf361('0x31')]);_0x3d29d1['query']=_[_0xf361('0x37')](_0x3b9d52[_0xf361('0x36')]);_0x3d29d1[_0xf361('0x38')]=_[_0xf361('0x3a')](_0x3d29d1[_0xf361('0x4c')],_0x3d29d1[_0xf361('0x36')]);_0x269f84[_0xf361('0x39')]=_['intersection'](_0x3d29d1[_0xf361('0x4c')],qs['fields'](_0x3b9d52[_0xf361('0x36')]['fields']));_0x269f84['attributes']=_0x269f84[_0xf361('0x39')][_0xf361('0x4d')]?_0x269f84[_0xf361('0x39')]:_0x3d29d1[_0xf361('0x4c')];_0x269f84['order']=qs['sort'](_0x3b9d52[_0xf361('0x36')][_0xf361('0x3e')]);_0x269f84['where']=qs[_0xf361('0x38')](_[_0xf361('0x40')](_0x3b9d52[_0xf361('0x36')],_0x3d29d1[_0xf361('0x38')]));if(_0x3b9d52[_0xf361('0x36')][_0xf361('0x41')]){_0x269f84['where']=_[_0xf361('0x43')](_0x269f84[_0xf361('0x3f')],{'$or':_[_0xf361('0x35')](_0x269f84['attributes'],function(_0x11a636){var _0xf3aa2d={};_0xf3aa2d[_0x11a636]={'$like':'%'+_0x3b9d52[_0xf361('0x36')][_0xf361('0x41')]+'%'};return _0xf3aa2d;})});}_0x269f84=_[_0xf361('0x43')]({},_0x269f84,_0x3b9d52['options']);return _0x2073e4['getTeams'](_0x269f84);}})[_0xf361('0x28')](function(_0x5d04e0){if(_0x5d04e0){_0x39df15=_0x5d04e0[_0xf361('0x4d')];if(!_0x3b9d52['query'][_0xf361('0x3c')](_0xf361('0x3d'))){_0x269f84[_0xf361('0x21')]=qs[_0xf361('0x21')](_0x3b9d52[_0xf361('0x36')][_0xf361('0x21')]);_0x269f84[_0xf361('0x20')]=qs[_0xf361('0x20')](_0x3b9d52['query'][_0xf361('0x20')]);}return _0x2073e4[_0xf361('0x64')](_0x269f84);}})[_0xf361('0x28')](function(_0x4af025){if(_0x4af025){return _0x4af025?{'count':_0x39df15,'rows':_0x4af025}:null;}})[_0xf361('0x28')](respondWithResult(_0x59daee,null))['catch'](handleError(_0x59daee,null));};exports[_0xf361('0x65')]=function(_0x575c59,_0x15cbf6,_0x1cc235){var _0x4600a4=_0x575c59[_0xf361('0x50')][_0xf361('0x66')];return db[_0xf361('0x67')][_0xf361('0x48')]({'where':{'id':_0x4600a4},'attributes':['id'],'include':[{'model':db[_0xf361('0x5c')],'as':_0xf361('0x68'),'attributes':['id','name','online',_0xf361('0x69'),_0xf361('0x6a')],'raw':!![]}]})['then'](function(_0x4d05f1){if(_0x4d05f1){var _0x23b6d2=_[_0xf361('0x6b')](_0x4d05f1,function(_0x3b6e21){var _0x4ab134=_0x3b6e21[_0xf361('0x53')]({'plain':!![]});return _0x4ab134[_0xf361('0x68')];});return db[_0xf361('0x45')][_0xf361('0x4e')]({'where':{'id':_0x575c59[_0xf361('0x56')]['id']}})['then'](function(_0x1ab7c8){return db[_0xf361('0x6c')][_0xf361('0x6d')](function(_0x34e98a){return _0x1ab7c8[_0xf361('0x65')](_0x4600a4,{'transaction':_0x34e98a})[_0xf361('0x28')](function(){return BPromise[_0xf361('0x6e')](_0x23b6d2,function(_0x4d4e1a){return db[_0xf361('0x59')]['findOrCreate']({'where':{'UserId':_0x4d4e1a['id'],'SmsQueueId':_0x575c59[_0xf361('0x56')]['id']},'transaction':_0x34e98a});});})['then'](function(){_0x23b6d2[_0xf361('0x6f')](function(_0x58fe6e){socket['emit'](_0xf361('0x70'),{'UserId':_0x58fe6e['id'],'SmsQueueId':_0x1ab7c8['id']});});});});});}})[_0xf361('0x28')](respondWithStatusCode(_0x15cbf6,null))[_0xf361('0x4a')](handleError(_0x15cbf6,null));};exports[_0xf361('0x71')]=function(_0x25d8f0,_0x25cc89,_0x2c7fec){return db[_0xf361('0x67')][_0xf361('0x48')]({'where':{'id':_0x25d8f0[_0xf361('0x36')][_0xf361('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf361('0x68'),'attributes':['id'],'raw':!![]}]})[_0xf361('0x28')](handleEntityNotFound(_0x25cc89,null))[_0xf361('0x28')](function(_0x2c24de){var _0x4e659d=_['map'](_0x2c24de,'id');var _0x34a4cf=[];var _0x4101ed=[];var _0xb96c9a=squel[_0xf361('0x72')]();_0xb96c9a[_0xf361('0x73')](_0xf361('0x74'))[_0xf361('0x75')](_0xf361('0x76'),'tq')[_0xf361('0x77')](_0xf361('0x78'),'ut',_0xf361('0x79'))[_0xf361('0x3f')]('SmsQueueId\x20=\x20?',_0x25d8f0['params']['id']);for(var _0x886c44=0x0;_0x886c44<_0x2c24de[_0xf361('0x4d')];_0x886c44+=0x1){let _0x56b9c5=_0x2c24de[_0x886c44];for(var _0x2544fe=0x0;_0x2544fe<_0x56b9c5['Agents'][_0xf361('0x4d')];_0x2544fe+=0x1){let _0x594d12=_0x56b9c5['Agents'][_0x2544fe];var _0x360a86=_0xb96c9a[_0xf361('0x7a')]();_0x360a86[_0xf361('0x3f')](_0xf361('0x7b'),_0x594d12['id']);_0x4101ed['push'](db[_0xf361('0x6c')][_0xf361('0x36')](_0x360a86['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xf361('0x28')](function(_0x28f997){if(_0x28f997[_0xf361('0x4d')]===0x1){return _0x594d12['id'];}else{var _0x4ff634=_[_0xf361('0x7c')](_[_0xf361('0x35')](_0x28f997,_0xf361('0x7d')),function(_0x3e8cd2){return _[_0xf361('0x7e')](_0x4e659d,_0x3e8cd2);});if(_0x4ff634){return _0x594d12['id'];}}}));}}return BPromise[_0xf361('0x7f')](_0x4101ed)[_0xf361('0x28')](function(_0x25a9cc){_0x34a4cf=_(_0x34a4cf)['union'](_0x25a9cc)[_0xf361('0x80')]()['value']();return db[_0xf361('0x45')][_0xf361('0x4e')]({'where':{'id':_0x25d8f0[_0xf361('0x56')]['id']}})[_0xf361('0x28')](function(_0x2193ed){return db[_0xf361('0x6c')][_0xf361('0x6d')](function(_0x4a7179){return _0x2193ed['removeTeams'](_0x25d8f0['query'][_0xf361('0x66')],{'transaction':_0x4a7179})[_0xf361('0x28')](function(){if(!_[_0xf361('0x81')](_0x34a4cf)){return _0x2193ed[_0xf361('0x82')](_0x34a4cf,{'transaction':_0x4a7179});}})[_0xf361('0x28')](function(){_0x34a4cf['forEach'](function(_0x2104e8){socket['emit']('userSmsQueue:remove',{'UserId':_0x2104e8,'SmsQueueId':_0x2193ed['id']});});});});});});})[_0xf361('0x28')](respondWithStatusCode(_0x25cc89,null))[_0xf361('0x4a')](handleError(_0x25cc89,null));};exports[_0xf361('0x83')]=function(_0x119ee8,_0x1718c8,_0x328dd5){return db[_0xf361('0x45')][_0xf361('0x4e')]({'where':{'id':_0x119ee8[_0xf361('0x56')]['id']}})['then'](handleEntityNotFound(_0x1718c8,null))['then'](function(_0x5c9c9f){if(_0x5c9c9f){return _0x5c9c9f[_0xf361('0x83')](_0x119ee8['body'][_0xf361('0x66')],_[_0xf361('0x84')](_0x119ee8[_0xf361('0x50')],[_0xf361('0x66'),'id'])||{})[_0xf361('0x85')](function(_0x32435c){for(var _0x3d509b=0x0;_0x3d509b<_0x119ee8['body']['ids'][_0xf361('0x4d')];_0x3d509b+=0x1){socket[_0xf361('0x86')](_0xf361('0x70'),{'UserId':_0x119ee8[_0xf361('0x50')][_0xf361('0x66')][_0x3d509b],'SmsQueueId':_0x119ee8[_0xf361('0x56')]['id']});}return _0x32435c;});}})[_0xf361('0x28')](respondWithResult(_0x1718c8,null))[_0xf361('0x4a')](handleError(_0x1718c8,null));};exports['removeAgents']=function(_0x1a7444,_0x2ef3ec,_0x227588){return db['SmsQueue'][_0xf361('0x4e')]({'where':{'id':_0x1a7444['params']['id']}})[_0xf361('0x28')](handleEntityNotFound(_0x2ef3ec,null))[_0xf361('0x28')](function(_0xe104e4){if(_0xe104e4){return _0xe104e4[_0xf361('0x82')](_0x1a7444['query'][_0xf361('0x66')])['then'](function(){if(_['isArray'](_0x1a7444[_0xf361('0x36')][_0xf361('0x66')])){for(var _0x16bc79=0x0;_0x16bc79<_0x1a7444[_0xf361('0x36')][_0xf361('0x66')]['length'];_0x16bc79+=0x1){socket['emit'](_0xf361('0x87'),{'UserId':Number(_0x1a7444[_0xf361('0x36')][_0xf361('0x66')][_0x16bc79]),'SmsQueueId':Number(_0x1a7444[_0xf361('0x56')]['id'])});}}else{socket[_0xf361('0x86')](_0xf361('0x87'),{'UserId':Number(_0x1a7444['query'][_0xf361('0x66')]),'SmsQueueId':Number(_0x1a7444[_0xf361('0x56')]['id'])});}});}})[_0xf361('0x28')](respondWithStatusCode(_0x2ef3ec,null))['catch'](handleError(_0x2ef3ec,null));};exports['getAgents']=function(_0x17d476,_0x59fff0,_0x1cc81f){var _0x56dde9={};var _0x366297={};var _0x4a94ae;var _0x5f5033;return db['SmsQueue'][_0xf361('0x58')]({'where':{'id':_0x17d476['params']['id']}})[_0xf361('0x28')](handleEntityNotFound(_0x59fff0,null))['then'](function(_0x203477){if(_0x203477){_0x4a94ae=_0x203477;_0x366297[_0xf361('0x4c')]=_[_0xf361('0x37')](db[_0xf361('0x5c')][_0xf361('0x31')]);_0x366297['query']=_[_0xf361('0x37')](_0x17d476[_0xf361('0x36')]);_0x366297[_0xf361('0x38')]=_['intersection'](_0x366297[_0xf361('0x4c')],_0x366297[_0xf361('0x36')]);_0x56dde9[_0xf361('0x39')]=_[_0xf361('0x3a')](_0x366297['model'],qs['fields'](_0x17d476['query'][_0xf361('0x3b')]));_0x56dde9[_0xf361('0x39')]=_0x56dde9[_0xf361('0x39')][_0xf361('0x4d')]?_0x56dde9[_0xf361('0x39')]:_0x366297['model'];_0x56dde9[_0xf361('0x5a')]=qs[_0xf361('0x3e')](_0x17d476['query'][_0xf361('0x3e')]);_0x56dde9['where']=qs[_0xf361('0x38')](_[_0xf361('0x40')](_0x17d476[_0xf361('0x36')],_0x366297[_0xf361('0x38')]));if(_0x17d476['query']['filter']){_0x56dde9[_0xf361('0x3f')]=_[_0xf361('0x43')](_0x56dde9[_0xf361('0x3f')],{'$or':_['map'](_0x56dde9[_0xf361('0x39')],function(_0x20f08c){var _0x418de6={};_0x418de6[_0x20f08c]={'$like':'%'+_0x17d476[_0xf361('0x36')][_0xf361('0x41')]+'%'};return _0x418de6;})});}_0x56dde9=_['merge']({},_0x56dde9,_0x17d476[_0xf361('0x44')]);return _0x4a94ae[_0xf361('0x88')](_0x56dde9);}})[_0xf361('0x28')](function(_0x4ebcba){if(_0x4ebcba){_0x5f5033=_0x4ebcba[_0xf361('0x4d')];if(!_0x17d476['query']['hasOwnProperty']('nolimit')){_0x56dde9[_0xf361('0x21')]=qs[_0xf361('0x21')](_0x17d476[_0xf361('0x36')][_0xf361('0x21')]);_0x56dde9['offset']=qs[_0xf361('0x20')](_0x17d476[_0xf361('0x36')][_0xf361('0x20')]);}return _0x4a94ae['getAgents'](_0x56dde9);}})[_0xf361('0x28')](function(_0xf4d7d9){if(_0xf4d7d9){return _0xf4d7d9?{'count':_0x5f5033,'rows':_0xf4d7d9}:null;}})[_0xf361('0x28')](respondWithResult(_0x59fff0,null))[_0xf361('0x4a')](handleError(_0x59fff0,null));}; \ No newline at end of file +var _0x06e3=['all','union','value','isEmpty','userSmsQueue:remove','addAgents','omit','isArray','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','SmsQueues','end','error','stack','name','index','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','map','VIRTUAL','filter','merge','include','SmsQueue','findAll','show','params','keys','length','options','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','sort','SmsQueueId','User','UserId','agent','createdAt','rows','format','SIP','smsPause','updatedAt','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','emit','userSmsQueue:save','ids','select','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','push','every','TeamId','includes'];(function(_0x200f67,_0x31e104){var _0x481652=function(_0x243673){while(--_0x243673){_0x200f67['push'](_0x200f67['shift']());}};_0x481652(++_0x31e104);}(_0x06e3,0x8a));var _0x306e=function(_0x2a3091,_0x1157bd){_0x2a3091=_0x2a3091-0x0;var _0x4be3e5=_0x06e3[_0x2a3091];return _0x4be3e5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x306e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x306e('0x1'));var rp=require(_0x306e('0x2'));var moment=require(_0x306e('0x3'));var BPromise=require(_0x306e('0x4'));var Mustache=require(_0x306e('0x5'));var util=require(_0x306e('0x6'));var path=require(_0x306e('0x7'));var sox=require(_0x306e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x306e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x306e('0xa'));var deskjs=require(_0x306e('0xb'));var toCsv=require(_0x306e('0xc'));var querystring=require(_0x306e('0xd'));var Papa=require(_0x306e('0xe'));var Redis=require(_0x306e('0xf'));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(_0x306e('0x10'))(_0x306e('0x11'));var utils=require(_0x306e('0x12'));var config=require(_0x306e('0x13'));var db=require(_0x306e('0x14'))['db'];config[_0x306e('0x15')]=_[_0x306e('0x16')](config[_0x306e('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x306e('0x17'))(new Redis(config['redis']));require(_0x306e('0x18'))['register'](socket);function respondWithStatusCode(_0x55c0f3,_0x30558e){_0x30558e=_0x30558e||0xcc;return function(_0x2cf66f){if(_0x2cf66f){return _0x55c0f3[_0x306e('0x19')](_0x30558e);}return _0x55c0f3[_0x306e('0x1a')](_0x30558e)['end']();};}function respondWithResult(_0x3af1a6,_0x48ec20){_0x48ec20=_0x48ec20||0xc8;return function(_0x7a1dc4){if(_0x7a1dc4){return _0x3af1a6[_0x306e('0x1a')](_0x48ec20)[_0x306e('0x1b')](_0x7a1dc4);}};}function respondWithFilteredResult(_0x33d147,_0x54b1e5){return function(_0x22e7b9){if(_0x22e7b9){var _0x51e8bf=_0x22e7b9[_0x306e('0x1c')],_0x1a52d8=_0x54b1e5[_0x306e('0x1d')],_0x1e03cb=_0x54b1e5[_0x306e('0x1d')]+_0x54b1e5[_0x306e('0x1e')],_0x256993;if(_0x1e03cb>=_0x51e8bf){_0x1e03cb=_0x51e8bf;_0x256993=0xc8;}else{_0x256993=0xce;}_0x33d147['status'](_0x256993);return _0x33d147[_0x306e('0x1f')]('Content-Range',_0x1a52d8+'-'+_0x1e03cb+'/'+_0x51e8bf)[_0x306e('0x1b')](_0x22e7b9);}return null;};}function patchUpdates(_0x509074){return function(_0x23a120){try{jsonpatch[_0x306e('0x20')](_0x23a120,_0x509074,!![]);}catch(_0x2b2048){return BPromise[_0x306e('0x21')](_0x2b2048);}return _0x23a120[_0x306e('0x22')]();};}function saveUpdates(_0x1f5ba7,_0xabaea0){return function(_0x9cb39c){if(_0x9cb39c){return _0x9cb39c[_0x306e('0x23')](_0x1f5ba7)[_0x306e('0x24')](function(_0x543eab){return _0x543eab;});}return null;};}function removeEntity(_0x54045e,_0x32d842){return function(_0x3d6eae){if(_0x3d6eae){return _0x3d6eae[_0x306e('0x25')]()[_0x306e('0x24')](function(){var _0x455072=_0x3d6eae['get']({'plain':!![]});var _0x6ea923=_0x306e('0x26');return db['UserProfileResource'][_0x306e('0x25')]({'where':{'type':_0x6ea923,'resourceId':_0x455072['id']}})[_0x306e('0x24')](function(){return _0x3d6eae;});})[_0x306e('0x24')](function(){_0x54045e[_0x306e('0x1a')](0xcc)[_0x306e('0x27')]();});}};}function handleEntityNotFound(_0x2e1e4e,_0x4f12c7){return function(_0x2d1a21){if(!_0x2d1a21){_0x2e1e4e[_0x306e('0x19')](0x194);}return _0x2d1a21;};}function handleError(_0x1f2ccb,_0x186341){_0x186341=_0x186341||0x1f4;return function(_0x57cc60){logger[_0x306e('0x28')](_0x57cc60[_0x306e('0x29')]);if(_0x57cc60[_0x306e('0x2a')]){delete _0x57cc60[_0x306e('0x2a')];}_0x1f2ccb[_0x306e('0x1a')](_0x186341)['send'](_0x57cc60);};}exports[_0x306e('0x2b')]=function(_0x4daa39,_0x5eab55){var _0x23ffdf={},_0x1bd969={},_0x5c0bae={'count':0x0,'rows':[]};var _0x2fdcfb=_['map'](db['SmsQueue'][_0x306e('0x2c')],function(_0x1e333b){return{'name':_0x1e333b[_0x306e('0x2d')],'type':_0x1e333b[_0x306e('0x2e')][_0x306e('0x2f')]};});_0x1bd969['model']=_['map'](_0x2fdcfb,_0x306e('0x2a'));_0x1bd969[_0x306e('0x30')]=_['keys'](_0x4daa39['query']);_0x1bd969[_0x306e('0x31')]=_['intersection'](_0x1bd969[_0x306e('0x32')],_0x1bd969['query']);_0x23ffdf['attributes']=_[_0x306e('0x33')](_0x1bd969[_0x306e('0x32')],qs[_0x306e('0x34')](_0x4daa39[_0x306e('0x30')][_0x306e('0x34')]));_0x23ffdf[_0x306e('0x35')]=_0x23ffdf[_0x306e('0x35')]['length']?_0x23ffdf[_0x306e('0x35')]:_0x1bd969[_0x306e('0x32')];if(!_0x4daa39[_0x306e('0x30')][_0x306e('0x36')](_0x306e('0x37'))){_0x23ffdf[_0x306e('0x1e')]=qs[_0x306e('0x1e')](_0x4daa39[_0x306e('0x30')][_0x306e('0x1e')]);_0x23ffdf[_0x306e('0x1d')]=qs[_0x306e('0x1d')](_0x4daa39[_0x306e('0x30')]['offset']);}_0x23ffdf[_0x306e('0x38')]=qs['sort'](_0x4daa39['query']['sort']);_0x23ffdf[_0x306e('0x39')]=qs[_0x306e('0x31')](_[_0x306e('0x3a')](_0x4daa39[_0x306e('0x30')],_0x1bd969[_0x306e('0x31')]),_0x2fdcfb);if(_0x4daa39[_0x306e('0x30')]['filter']){_0x23ffdf[_0x306e('0x39')]=_['merge'](_0x23ffdf[_0x306e('0x39')],{'$or':_[_0x306e('0x3b')](_0x2fdcfb,function(_0x2fa023){if(_0x2fa023[_0x306e('0x2e')]!==_0x306e('0x3c')){var _0x4abb5f={};_0x4abb5f[_0x2fa023[_0x306e('0x2a')]]={'$like':'%'+_0x4daa39[_0x306e('0x30')][_0x306e('0x3d')]+'%'};return _0x4abb5f;}})});}_0x23ffdf=_[_0x306e('0x3e')]({},_0x23ffdf,_0x4daa39['options']);var _0x541691={'where':_0x23ffdf['where']};return db['SmsQueue']['count'](_0x541691)['then'](function(_0x5db27f){_0x5c0bae[_0x306e('0x1c')]=_0x5db27f;if(_0x4daa39['query']['includeAll']){_0x23ffdf[_0x306e('0x3f')]=[{'all':!![]}];}return db[_0x306e('0x40')][_0x306e('0x41')](_0x23ffdf);})[_0x306e('0x24')](function(_0x3c0d16){_0x5c0bae['rows']=_0x3c0d16;return _0x5c0bae;})[_0x306e('0x24')](respondWithFilteredResult(_0x5eab55,_0x23ffdf))['catch'](handleError(_0x5eab55,null));};exports[_0x306e('0x42')]=function(_0x1b30f0,_0xd4d650){var _0x4dc6be={'raw':!![],'where':{'id':_0x1b30f0[_0x306e('0x43')]['id']}},_0x51de18={};_0x51de18[_0x306e('0x32')]=_[_0x306e('0x44')](db['SmsQueue'][_0x306e('0x2c')]);_0x51de18[_0x306e('0x30')]=_[_0x306e('0x44')](_0x1b30f0['query']);_0x51de18['filters']=_[_0x306e('0x33')](_0x51de18[_0x306e('0x32')],_0x51de18['query']);_0x4dc6be[_0x306e('0x35')]=_[_0x306e('0x33')](_0x51de18[_0x306e('0x32')],qs[_0x306e('0x34')](_0x1b30f0['query'][_0x306e('0x34')]));_0x4dc6be[_0x306e('0x35')]=_0x4dc6be[_0x306e('0x35')][_0x306e('0x45')]?_0x4dc6be[_0x306e('0x35')]:_0x51de18[_0x306e('0x32')];if(_0x1b30f0[_0x306e('0x30')]['includeAll']){_0x4dc6be['include']=[{'all':!![]}];}_0x4dc6be=_[_0x306e('0x3e')]({},_0x4dc6be,_0x1b30f0[_0x306e('0x46')]);return db[_0x306e('0x40')][_0x306e('0x47')](_0x4dc6be)[_0x306e('0x24')](handleEntityNotFound(_0xd4d650,null))['then'](respondWithResult(_0xd4d650,null))[_0x306e('0x48')](handleError(_0xd4d650,null));};exports[_0x306e('0x49')]=function(_0x5d25c0,_0x4a2d97){return db[_0x306e('0x40')]['create'](_0x5d25c0[_0x306e('0x4a')],{})[_0x306e('0x24')](function(_0x5c2f65){var _0x150842=_0x5d25c0['user'][_0x306e('0x4b')]({'plain':!![]});if(!_0x150842)throw new Error(_0x306e('0x4c'));if(_0x150842[_0x306e('0x4d')]===_0x306e('0x4e')){var _0x14ca23=_0x5c2f65[_0x306e('0x4b')]({'plain':!![]});var _0xcc2654=_0x306e('0x26');return db[_0x306e('0x4f')]['find']({'where':{'name':_0xcc2654,'userProfileId':_0x150842[_0x306e('0x50')]},'raw':!![]})[_0x306e('0x24')](function(_0x50262f){if(_0x50262f&&_0x50262f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x14ca23['name'],'resourceId':_0x14ca23['id'],'type':_0x50262f[_0x306e('0x2a')],'sectionId':_0x50262f['id']},{})[_0x306e('0x24')](function(){return _0x5c2f65;});}else{return _0x5c2f65;}})[_0x306e('0x48')](function(_0x4411a0){logger[_0x306e('0x28')](_0x306e('0x51'),_0x4411a0);throw _0x4411a0;});}return _0x5c2f65;})[_0x306e('0x24')](respondWithResult(_0x4a2d97,0xc9))['catch'](handleError(_0x4a2d97,null));};exports[_0x306e('0x23')]=function(_0x262894,_0x18e381){if(_0x262894[_0x306e('0x4a')]['id']){delete _0x262894[_0x306e('0x4a')]['id'];}return db[_0x306e('0x40')][_0x306e('0x47')]({'where':{'id':_0x262894[_0x306e('0x43')]['id']}})[_0x306e('0x24')](handleEntityNotFound(_0x18e381,null))[_0x306e('0x24')](saveUpdates(_0x262894['body'],null))[_0x306e('0x24')](respondWithResult(_0x18e381,null))[_0x306e('0x48')](handleError(_0x18e381,null));};exports[_0x306e('0x25')]=function(_0x43c077,_0x500e88){return db['SmsQueue'][_0x306e('0x47')]({'where':{'id':_0x43c077[_0x306e('0x43')]['id']}})[_0x306e('0x24')](handleEntityNotFound(_0x500e88,null))['then'](removeEntity(_0x500e88,null))[_0x306e('0x48')](handleError(_0x500e88,null));};exports['describe']=function(_0x50e121,_0x5b2a6e){return db[_0x306e('0x40')][_0x306e('0x52')]()['then'](respondWithResult(_0x5b2a6e,null))[_0x306e('0x48')](handleError(_0x5b2a6e,null));};exports['getMembers']=function(_0x57895b,_0x1b0355,_0x4d02d2){var _0x220be0={'raw':!![],'where':{}},_0x14ba1f={},_0x224e85;return db[_0x306e('0x40')][_0x306e('0x53')]({'where':{'id':_0x57895b[_0x306e('0x43')]['id']}})[_0x306e('0x24')](handleEntityNotFound(_0x1b0355,null))['then'](function(_0x443d76){if(_0x443d76){_0x224e85=_0x443d76[_0x306e('0x4b')]({'plain':!![]});_0x14ba1f[_0x306e('0x32')]=_['keys'](db[_0x306e('0x54')]['rawAttributes']);_0x14ba1f['query']=_[_0x306e('0x44')](_0x57895b[_0x306e('0x30')]);_0x14ba1f[_0x306e('0x31')]=_['intersection'](_0x14ba1f['model'],_0x14ba1f[_0x306e('0x30')]);_0x220be0[_0x306e('0x35')]=_[_0x306e('0x33')](_0x14ba1f['model'],qs[_0x306e('0x34')](_0x57895b[_0x306e('0x30')][_0x306e('0x34')]));_0x220be0[_0x306e('0x35')]=_0x220be0[_0x306e('0x35')][_0x306e('0x45')]?_0x220be0[_0x306e('0x35')]:_0x14ba1f[_0x306e('0x32')];if(!_0x57895b[_0x306e('0x30')][_0x306e('0x36')](_0x306e('0x37'))){_0x220be0[_0x306e('0x1e')]=qs[_0x306e('0x1e')](_0x57895b['query'][_0x306e('0x1e')]);_0x220be0[_0x306e('0x1d')]=qs[_0x306e('0x1d')](_0x57895b['query'][_0x306e('0x1d')]);}_0x220be0[_0x306e('0x38')]=qs['sort'](_0x57895b[_0x306e('0x30')][_0x306e('0x55')]);_0x220be0['where']=qs[_0x306e('0x31')](_[_0x306e('0x3a')](_0x57895b[_0x306e('0x30')],_0x14ba1f[_0x306e('0x31')]));_0x220be0[_0x306e('0x39')][_0x306e('0x56')]=_0x443d76['id'];if(_0x57895b[_0x306e('0x30')][_0x306e('0x3d')]){_0x220be0[_0x306e('0x39')]=_[_0x306e('0x3e')](_0x220be0[_0x306e('0x39')],{'$or':_['map'](_0x220be0[_0x306e('0x35')],function(_0x391155){var _0x4885b4={};_0x4885b4[_0x391155]={'$like':'%'+_0x57895b[_0x306e('0x30')][_0x306e('0x3d')]+'%'};return _0x4885b4;})});}_0x220be0=_[_0x306e('0x3e')]({},_0x220be0,_0x57895b[_0x306e('0x46')]);return db['UserSmsQueue'][_0x306e('0x41')](_0x220be0);}})[_0x306e('0x24')](function(_0x3624d7){if(_0x3624d7){return db[_0x306e('0x57')]['findAndCountAll']({'where':{'id':_['map'](_0x3624d7,_0x306e('0x58')),'role':_0x306e('0x59')},'attributes':['id','name','smsPause','updatedAt',_0x306e('0x5a')]});}})['then'](function(_0xb12b67){if(_0xb12b67){return{'count':_0xb12b67[_0x306e('0x1c')],'rows':_[_0x306e('0x3b')](_0xb12b67[_0x306e('0x5b')],function(_0x16e2f7){return{'membername':_0x16e2f7[_0x306e('0x2a')],'UserId':_0x16e2f7['id'],'queue_name':_0x224e85[_0x306e('0x2a')],'SmsQueueId':_0x224e85['id'],'interface':util[_0x306e('0x5c')]('%s/%s',_0x306e('0x5d'),_0x16e2f7['name']),'penalty':0x0,'paused':_0x16e2f7[_0x306e('0x5e')],'createdAt':_0x16e2f7[_0x306e('0x5a')],'updatedAt':_0x16e2f7[_0x306e('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x306e('0x24')](respondWithFilteredResult(_0x1b0355,_0x220be0))[_0x306e('0x48')](handleError(_0x1b0355,null));};exports['getTeams']=function(_0x10dc77,_0xce75d6,_0x432c67){var _0x9162c7={};var _0x26fd25={};var _0x5beac8;var _0x452142;return db[_0x306e('0x40')][_0x306e('0x53')]({'where':{'id':_0x10dc77[_0x306e('0x43')]['id']}})[_0x306e('0x24')](handleEntityNotFound(_0xce75d6,null))[_0x306e('0x24')](function(_0x3eda68){if(_0x3eda68){_0x5beac8=_0x3eda68;_0x26fd25['model']=_[_0x306e('0x44')](db['Team'][_0x306e('0x2c')]);_0x26fd25[_0x306e('0x30')]=_[_0x306e('0x44')](_0x10dc77[_0x306e('0x30')]);_0x26fd25[_0x306e('0x31')]=_[_0x306e('0x33')](_0x26fd25[_0x306e('0x32')],_0x26fd25['query']);_0x9162c7[_0x306e('0x35')]=_['intersection'](_0x26fd25['model'],qs[_0x306e('0x34')](_0x10dc77[_0x306e('0x30')][_0x306e('0x34')]));_0x9162c7['attributes']=_0x9162c7[_0x306e('0x35')][_0x306e('0x45')]?_0x9162c7[_0x306e('0x35')]:_0x26fd25[_0x306e('0x32')];_0x9162c7[_0x306e('0x38')]=qs[_0x306e('0x55')](_0x10dc77[_0x306e('0x30')][_0x306e('0x55')]);_0x9162c7[_0x306e('0x39')]=qs['filters'](_[_0x306e('0x3a')](_0x10dc77[_0x306e('0x30')],_0x26fd25[_0x306e('0x31')]));if(_0x10dc77[_0x306e('0x30')][_0x306e('0x3d')]){_0x9162c7[_0x306e('0x39')]=_[_0x306e('0x3e')](_0x9162c7[_0x306e('0x39')],{'$or':_[_0x306e('0x3b')](_0x9162c7['attributes'],function(_0x1812e6){var _0x364aee={};_0x364aee[_0x1812e6]={'$like':'%'+_0x10dc77[_0x306e('0x30')][_0x306e('0x3d')]+'%'};return _0x364aee;})});}_0x9162c7=_[_0x306e('0x3e')]({},_0x9162c7,_0x10dc77[_0x306e('0x46')]);return _0x5beac8[_0x306e('0x60')](_0x9162c7);}})[_0x306e('0x24')](function(_0x22ad0e){if(_0x22ad0e){_0x452142=_0x22ad0e[_0x306e('0x45')];if(!_0x10dc77[_0x306e('0x30')][_0x306e('0x36')](_0x306e('0x37'))){_0x9162c7[_0x306e('0x1e')]=qs[_0x306e('0x1e')](_0x10dc77[_0x306e('0x30')][_0x306e('0x1e')]);_0x9162c7['offset']=qs[_0x306e('0x1d')](_0x10dc77[_0x306e('0x30')][_0x306e('0x1d')]);}return _0x5beac8[_0x306e('0x60')](_0x9162c7);}})[_0x306e('0x24')](function(_0x303479){if(_0x303479){return _0x303479?{'count':_0x452142,'rows':_0x303479}:null;}})[_0x306e('0x24')](respondWithResult(_0xce75d6,null))[_0x306e('0x48')](handleError(_0xce75d6,null));};exports['addTeams']=function(_0x2452d0,_0x207271,_0x4e9995){var _0x14f21f=_0x2452d0['body']['ids'];return db[_0x306e('0x61')]['findAll']({'where':{'id':_0x14f21f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x306e('0x62'),'attributes':['id',_0x306e('0x2a'),_0x306e('0x63'),_0x306e('0x64'),_0x306e('0x65')],'raw':!![]}]})[_0x306e('0x24')](function(_0x4b3519){if(_0x4b3519){var _0x41e040=_[_0x306e('0x66')](_0x4b3519,function(_0x4366d7){var _0xcd80ee=_0x4366d7[_0x306e('0x4b')]({'plain':!![]});return _0xcd80ee[_0x306e('0x62')];});return db[_0x306e('0x40')][_0x306e('0x47')]({'where':{'id':_0x2452d0['params']['id']}})[_0x306e('0x24')](function(_0x1ae347){return db[_0x306e('0x67')][_0x306e('0x68')](function(_0xa04b45){return _0x1ae347['addTeams'](_0x14f21f,{'transaction':_0xa04b45})['then'](function(){return BPromise['each'](_0x41e040,function(_0x5b2e8e){return db[_0x306e('0x54')][_0x306e('0x69')]({'where':{'UserId':_0x5b2e8e['id'],'SmsQueueId':_0x2452d0[_0x306e('0x43')]['id']},'transaction':_0xa04b45});});})['then'](function(){_0x41e040['forEach'](function(_0x14a8bf){socket[_0x306e('0x6a')](_0x306e('0x6b'),{'UserId':_0x14a8bf['id'],'SmsQueueId':_0x1ae347['id']});});});});});}})[_0x306e('0x24')](respondWithStatusCode(_0x207271,null))[_0x306e('0x48')](handleError(_0x207271,null));};exports['removeTeams']=function(_0x162eca,_0x379fd3,_0x7da7e0){return db[_0x306e('0x61')][_0x306e('0x41')]({'where':{'id':_0x162eca[_0x306e('0x30')][_0x306e('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x306e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x306e('0x24')](handleEntityNotFound(_0x379fd3,null))[_0x306e('0x24')](function(_0x22671a){var _0xc3fa3e=_[_0x306e('0x3b')](_0x22671a,'id');var _0x222763=[];var _0x297c7b=[];var _0x33ad17=squel[_0x306e('0x6d')]();_0x33ad17['field'](_0x306e('0x6e'))[_0x306e('0x6f')](_0x306e('0x70'),'tq')[_0x306e('0x71')]('user_has_teams','ut',_0x306e('0x72'))[_0x306e('0x39')](_0x306e('0x73'),_0x162eca[_0x306e('0x43')]['id']);for(var _0x4bb074=0x0;_0x4bb074<_0x22671a['length'];_0x4bb074+=0x1){let _0x4e6fd3=_0x22671a[_0x4bb074];for(var _0x80a172=0x0;_0x80a172<_0x4e6fd3[_0x306e('0x62')][_0x306e('0x45')];_0x80a172+=0x1){let _0x1d5ade=_0x4e6fd3[_0x306e('0x62')][_0x80a172];var _0x4e0e98=_0x33ad17['clone']();_0x4e0e98['where']('ut.UserId\x20=\x20?',_0x1d5ade['id']);_0x297c7b[_0x306e('0x74')](db[_0x306e('0x67')][_0x306e('0x30')](_0x4e0e98['toString'](),{'type':db[_0x306e('0x67')]['QueryTypes']['SELECT']})[_0x306e('0x24')](function(_0x2ffedb){if(_0x2ffedb['length']===0x1){return _0x1d5ade['id'];}else{var _0x53eff1=_[_0x306e('0x75')](_['map'](_0x2ffedb,_0x306e('0x76')),function(_0x16f58a){return _[_0x306e('0x77')](_0xc3fa3e,_0x16f58a);});if(_0x53eff1){return _0x1d5ade['id'];}}}));}}return BPromise[_0x306e('0x78')](_0x297c7b)['then'](function(_0x3834ec){_0x222763=_(_0x222763)[_0x306e('0x79')](_0x3834ec)['compact']()[_0x306e('0x7a')]();return db[_0x306e('0x40')][_0x306e('0x47')]({'where':{'id':_0x162eca[_0x306e('0x43')]['id']}})[_0x306e('0x24')](function(_0x350e70){return db['sequelize'][_0x306e('0x68')](function(_0x4befc0){return _0x350e70['removeTeams'](_0x162eca[_0x306e('0x30')][_0x306e('0x6c')],{'transaction':_0x4befc0})[_0x306e('0x24')](function(){if(!_[_0x306e('0x7b')](_0x222763)){return _0x350e70['removeAgents'](_0x222763,{'transaction':_0x4befc0});}})[_0x306e('0x24')](function(){_0x222763['forEach'](function(_0x1821b1){socket[_0x306e('0x6a')](_0x306e('0x7c'),{'UserId':_0x1821b1,'SmsQueueId':_0x350e70['id']});});});});});});})[_0x306e('0x24')](respondWithStatusCode(_0x379fd3,null))[_0x306e('0x48')](handleError(_0x379fd3,null));};exports[_0x306e('0x7d')]=function(_0x7b7fd5,_0xe9bc7b,_0x41597c){return db[_0x306e('0x40')][_0x306e('0x47')]({'where':{'id':_0x7b7fd5[_0x306e('0x43')]['id']}})[_0x306e('0x24')](handleEntityNotFound(_0xe9bc7b,null))[_0x306e('0x24')](function(_0x887f26){if(_0x887f26){return _0x887f26[_0x306e('0x7d')](_0x7b7fd5[_0x306e('0x4a')][_0x306e('0x6c')],_[_0x306e('0x7e')](_0x7b7fd5['body'],[_0x306e('0x6c'),'id'])||{})['spread'](function(_0x5c9971){for(var _0x474312=0x0;_0x474312<_0x7b7fd5[_0x306e('0x4a')][_0x306e('0x6c')][_0x306e('0x45')];_0x474312+=0x1){socket[_0x306e('0x6a')](_0x306e('0x6b'),{'UserId':_0x7b7fd5[_0x306e('0x4a')][_0x306e('0x6c')][_0x474312],'SmsQueueId':_0x7b7fd5['params']['id']});}return _0x5c9971;});}})[_0x306e('0x24')](respondWithResult(_0xe9bc7b,null))[_0x306e('0x48')](handleError(_0xe9bc7b,null));};exports['removeAgents']=function(_0x22af44,_0x15f5dd,_0x40fd18){return db[_0x306e('0x40')][_0x306e('0x47')]({'where':{'id':_0x22af44[_0x306e('0x43')]['id']}})['then'](handleEntityNotFound(_0x15f5dd,null))[_0x306e('0x24')](function(_0x31e318){if(_0x31e318){return _0x31e318['removeAgents'](_0x22af44['query'][_0x306e('0x6c')])['then'](function(){if(_[_0x306e('0x7f')](_0x22af44[_0x306e('0x30')][_0x306e('0x6c')])){for(var _0x298c1e=0x0;_0x298c1e<_0x22af44[_0x306e('0x30')][_0x306e('0x6c')][_0x306e('0x45')];_0x298c1e+=0x1){socket[_0x306e('0x6a')](_0x306e('0x7c'),{'UserId':Number(_0x22af44[_0x306e('0x30')]['ids'][_0x298c1e]),'SmsQueueId':Number(_0x22af44[_0x306e('0x43')]['id'])});}}else{socket[_0x306e('0x6a')]('userSmsQueue:remove',{'UserId':Number(_0x22af44[_0x306e('0x30')][_0x306e('0x6c')]),'SmsQueueId':Number(_0x22af44['params']['id'])});}});}})['then'](respondWithStatusCode(_0x15f5dd,null))[_0x306e('0x48')](handleError(_0x15f5dd,null));};exports[_0x306e('0x80')]=function(_0x14d8cf,_0x166b9e,_0x51fc6b){var _0x7b788a={};var _0x283d39={};var _0x5954bc;var _0xc81276;return db[_0x306e('0x40')][_0x306e('0x53')]({'where':{'id':_0x14d8cf[_0x306e('0x43')]['id']}})[_0x306e('0x24')](handleEntityNotFound(_0x166b9e,null))[_0x306e('0x24')](function(_0x28e42f){if(_0x28e42f){_0x5954bc=_0x28e42f;_0x283d39['model']=_[_0x306e('0x44')](db['User'][_0x306e('0x2c')]);_0x283d39['query']=_[_0x306e('0x44')](_0x14d8cf[_0x306e('0x30')]);_0x283d39[_0x306e('0x31')]=_['intersection'](_0x283d39[_0x306e('0x32')],_0x283d39[_0x306e('0x30')]);_0x7b788a[_0x306e('0x35')]=_['intersection'](_0x283d39['model'],qs[_0x306e('0x34')](_0x14d8cf[_0x306e('0x30')]['fields']));_0x7b788a['attributes']=_0x7b788a[_0x306e('0x35')][_0x306e('0x45')]?_0x7b788a[_0x306e('0x35')]:_0x283d39[_0x306e('0x32')];_0x7b788a[_0x306e('0x38')]=qs[_0x306e('0x55')](_0x14d8cf[_0x306e('0x30')][_0x306e('0x55')]);_0x7b788a['where']=qs['filters'](_[_0x306e('0x3a')](_0x14d8cf[_0x306e('0x30')],_0x283d39[_0x306e('0x31')]));if(_0x14d8cf[_0x306e('0x30')][_0x306e('0x3d')]){_0x7b788a[_0x306e('0x39')]=_['merge'](_0x7b788a[_0x306e('0x39')],{'$or':_[_0x306e('0x3b')](_0x7b788a[_0x306e('0x35')],function(_0x7f1f29){var _0x348642={};_0x348642[_0x7f1f29]={'$like':'%'+_0x14d8cf[_0x306e('0x30')][_0x306e('0x3d')]+'%'};return _0x348642;})});}_0x7b788a=_[_0x306e('0x3e')]({},_0x7b788a,_0x14d8cf[_0x306e('0x46')]);return _0x5954bc[_0x306e('0x80')](_0x7b788a);}})[_0x306e('0x24')](function(_0x1d9c21){if(_0x1d9c21){_0xc81276=_0x1d9c21[_0x306e('0x45')];if(!_0x14d8cf[_0x306e('0x30')]['hasOwnProperty'](_0x306e('0x37'))){_0x7b788a[_0x306e('0x1e')]=qs[_0x306e('0x1e')](_0x14d8cf[_0x306e('0x30')][_0x306e('0x1e')]);_0x7b788a[_0x306e('0x1d')]=qs[_0x306e('0x1d')](_0x14d8cf['query'][_0x306e('0x1d')]);}return _0x5954bc[_0x306e('0x80')](_0x7b788a);}})[_0x306e('0x24')](function(_0x1f455c){if(_0x1f455c){return _0x1f455c?{'count':_0xc81276,'rows':_0x1f455c}:null;}})[_0x306e('0x24')](respondWithResult(_0x166b9e,null))['catch'](handleError(_0x166b9e,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 309c061..02419df 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 _0xefd2=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xefd2,0xca));var _0x2efd=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xefd2[_0x35da42];return _0x370035;};'use strict';var EventEmitter=require(_0x2efd('0x0'));var SmsQueue=require(_0x2efd('0x1'))['db'][_0x2efd('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2efd('0x3')](0x0);var events={'afterCreate':_0x2efd('0x4'),'afterUpdate':_0x2efd('0x5'),'afterDestroy':_0x2efd('0x6')};function emitEvent(_0x773622){return function(_0x173080,_0x4830db,_0x196912){SmsQueueEvents[_0x2efd('0x7')](_0x773622+':'+_0x173080['id'],_0x173080);SmsQueueEvents['emit'](_0x773622,_0x173080);_0x196912(null);};}for(var e in events){if(events[_0x2efd('0x8')](e)){var event=events[e];SmsQueue[_0x2efd('0x9')](e,emitEvent(event));}}module[_0x2efd('0xa')]=SmsQueueEvents; \ No newline at end of file +var _0xe152=['emit','hasOwnProperty','hook','exports','events','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x56e3f5,_0x36e807){var _0x1007ee=function(_0x4859d7){while(--_0x4859d7){_0x56e3f5['push'](_0x56e3f5['shift']());}};_0x1007ee(++_0x36e807);}(_0xe152,0x158));var _0x2e15=function(_0x39aa77,_0xa138e7){_0x39aa77=_0x39aa77-0x0;var _0x220bf4=_0xe152[_0x39aa77];return _0x220bf4;};'use strict';var EventEmitter=require(_0x2e15('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x2e15('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2e15('0x2')](0x0);var events={'afterCreate':_0x2e15('0x3'),'afterUpdate':_0x2e15('0x4'),'afterDestroy':_0x2e15('0x5')};function emitEvent(_0x31b601){return function(_0x1901cc,_0xeefdd3,_0x29b3ce){SmsQueueEvents[_0x2e15('0x6')](_0x31b601+':'+_0x1901cc['id'],_0x1901cc);SmsQueueEvents[_0x2e15('0x6')](_0x31b601,_0x1901cc);_0x29b3ce(null);};}for(var e in events){if(events[_0x2e15('0x7')](e)){var event=events[e];SmsQueue[_0x2e15('0x8')](e,emitEvent(event));}}module[_0x2e15('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 8071613..71f9069 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 _0x9b83=['rimraf','../../config/environment','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x56aabf,_0x461d46){var _0x8b2a1e=function(_0x46d8d7){while(--_0x46d8d7){_0x56aabf['push'](_0x56aabf['shift']());}};_0x8b2a1e(++_0x461d46);}(_0x9b83,0x84));var _0x39b8=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x9b83[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0x39b8('0x0'));var util=require(_0x39b8('0x1'));var logger=require(_0x39b8('0x2'))(_0x39b8('0x3'));var moment=require(_0x39b8('0x4'));var BPromise=require(_0x39b8('0x5'));var rp=require(_0x39b8('0x6'));var fs=require('fs');var path=require(_0x39b8('0x7'));var rimraf=require(_0x39b8('0x8'));var config=require(_0x39b8('0x9'));var attributes=require('./smsQueue.attributes');module[_0x39b8('0xa')]=function(_0x4a8ff8,_0x563fe1){return _0x4a8ff8[_0x39b8('0xb')](_0x39b8('0xc'),attributes,{'tableName':_0x39b8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41f2=['rimraf','../../config/environment','exports','define','SmsQueue','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5bf5b5,_0x47b760){var _0x496789=function(_0x208f7f){while(--_0x208f7f){_0x5bf5b5['push'](_0x5bf5b5['shift']());}};_0x496789(++_0x47b760);}(_0x41f2,0x14f));var _0x241f=function(_0x1f6872,_0x176335){_0x1f6872=_0x1f6872-0x0;var _0x2a9f2b=_0x41f2[_0x1f6872];return _0x2a9f2b;};'use strict';var _=require(_0x241f('0x0'));var util=require(_0x241f('0x1'));var logger=require('../../config/logger')(_0x241f('0x2'));var moment=require(_0x241f('0x3'));var BPromise=require(_0x241f('0x4'));var rp=require(_0x241f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x241f('0x6'));var config=require(_0x241f('0x7'));var attributes=require('./smsQueue.attributes');module[_0x241f('0x8')]=function(_0x2e8e9f,_0x253edb){return _0x2e8e9f[_0x241f('0x9')](_0x241f('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 8560d31..b24ed34 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 _0xa80f=['info','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','SmsQueue,\x20%s,\x20%s','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','map','model','debug','stringify','catch','ShowSmsQueue','find','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./smsQueue.socket','register','then'];(function(_0x427352,_0x1bce61){var _0x23e0e6=function(_0x2a42a9){while(--_0x2a42a9){_0x427352['push'](_0x427352['shift']());}};_0x23e0e6(++_0x1bce61);}(_0xa80f,0x1ea));var _0xfa80=function(_0x5993de,_0x1e902f){_0x5993de=_0x5993de-0x0;var _0x481faf=_0xa80f[_0x5993de];return _0x481faf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa80('0x0'));var BPromise=require(_0xfa80('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa80('0x2'));var db=require(_0xfa80('0x3'))['db'];var utils=require(_0xfa80('0x4'));var logger=require(_0xfa80('0x5'))('rpc');var config=require(_0xfa80('0x6'));var jayson=require(_0xfa80('0x7'));var client=jayson['client'][_0xfa80('0x8')]({'port':0x232a});config[_0xfa80('0x9')]=_[_0xfa80('0xa')](config[_0xfa80('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa80('0x9')]));require(_0xfa80('0xb'))[_0xfa80('0xc')](socket);function respondWithRpcPromise(_0xe4e554,_0x330b99,_0x356e8a){return new BPromise(function(_0x1077e3,_0x5275d4){return client['request'](_0xe4e554,_0x356e8a)[_0xfa80('0xd')](function(_0x1c5572){logger[_0xfa80('0xe')]('SmsQueue,\x20%s,\x20%s',_0x330b99,_0xfa80('0xf'));logger['debug'](_0xfa80('0x10'),_0x330b99,'request\x20sent',JSON['stringify'](_0x1c5572));if(_0x1c5572[_0xfa80('0x11')]){if(_0x1c5572[_0xfa80('0x11')][_0xfa80('0x12')]===0x1f4){logger[_0xfa80('0x11')]('SmsQueue,\x20%s,\x20%s',_0x330b99,_0x1c5572[_0xfa80('0x11')]['message']);return _0x5275d4(_0x1c5572[_0xfa80('0x11')]['message']);}logger[_0xfa80('0x11')]('SmsQueue,\x20%s,\x20%s',_0x330b99,_0x1c5572['error']['message']);return _0x1077e3(_0x1c5572['error'][_0xfa80('0x13')]);}else{logger[_0xfa80('0xe')]('SmsQueue,\x20%s,\x20%s',_0x330b99,_0xfa80('0xf'));_0x1077e3(_0x1c5572['result']['message']);}})['catch'](function(_0x3f1f91){logger[_0xfa80('0x11')](_0xfa80('0x14'),_0x330b99,_0x3f1f91);_0x5275d4(_0x3f1f91);});});}exports[_0xfa80('0x15')]=function(_0x4ac344){var _0x405bc2=this;return new Promise(function(_0x4de98d,_0x2c1953){return db[_0xfa80('0x16')][_0xfa80('0x17')]({'raw':_0x4ac344[_0xfa80('0x18')]?_0x4ac344[_0xfa80('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4ac344[_0xfa80('0x18')]?_0x4ac344[_0xfa80('0x18')][_0xfa80('0x19')]||null:null,'attributes':_0x4ac344[_0xfa80('0x18')]?_0x4ac344['options'][_0xfa80('0x1a')]||null:null,'limit':_0x4ac344[_0xfa80('0x18')]?_0x4ac344['options'][_0xfa80('0x1b')]||null:null,'include':_0x4ac344[_0xfa80('0x18')]?_0x4ac344[_0xfa80('0x18')][_0xfa80('0x1c')]?_[_0xfa80('0x1d')](_0x4ac344[_0xfa80('0x18')][_0xfa80('0x1c')],function(_0x1a1a18){return{'model':db[_0x1a1a18[_0xfa80('0x1e')]],'as':_0x1a1a18['as'],'attributes':_0x1a1a18[_0xfa80('0x1a')],'include':_0x1a1a18['include']?_[_0xfa80('0x1d')](_0x1a1a18['include'],function(_0x472247){return{'model':db[_0x472247[_0xfa80('0x1e')]],'as':_0x472247['as'],'attributes':_0x472247['attributes'],'include':_0x472247['include']?_['map'](_0x472247[_0xfa80('0x1c')],function(_0x59316a){return{'model':db[_0x59316a[_0xfa80('0x1e')]],'as':_0x59316a['as'],'attributes':_0x59316a[_0xfa80('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfa80('0xd')](function(_0x59a1fb){logger[_0xfa80('0xe')](_0xfa80('0x15'),_0x4ac344);logger[_0xfa80('0x1f')](_0xfa80('0x15'),_0x4ac344,JSON[_0xfa80('0x20')](_0x59a1fb));_0x4de98d(_0x59a1fb);})[_0xfa80('0x21')](function(_0x467a66){logger[_0xfa80('0x11')](_0xfa80('0x15'),_0x467a66['message'],_0x4ac344);_0x2c1953(_0x405bc2['error'](0x1f4,_0x467a66[_0xfa80('0x13')]));});});};exports[_0xfa80('0x22')]=function(_0x352f8b){var _0x1fd636=this;return new Promise(function(_0x193192,_0x41ae75){return db['SmsQueue'][_0xfa80('0x23')]({'raw':_0x352f8b[_0xfa80('0x18')]?_0x352f8b[_0xfa80('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x352f8b[_0xfa80('0x18')]?_0x352f8b[_0xfa80('0x18')]['where']||null:null,'attributes':_0x352f8b[_0xfa80('0x18')]?_0x352f8b[_0xfa80('0x18')][_0xfa80('0x1a')]||null:null,'include':_0x352f8b[_0xfa80('0x18')]?_0x352f8b['options'][_0xfa80('0x1c')]?_[_0xfa80('0x1d')](_0x352f8b['options'][_0xfa80('0x1c')],function(_0x826e75){return{'model':db[_0x826e75[_0xfa80('0x1e')]],'as':_0x826e75['as'],'attributes':_0x826e75[_0xfa80('0x1a')],'include':_0x826e75[_0xfa80('0x1c')]?_[_0xfa80('0x1d')](_0x826e75[_0xfa80('0x1c')],function(_0x18ccc6){return{'model':db[_0x18ccc6[_0xfa80('0x1e')]],'as':_0x18ccc6['as'],'attributes':_0x18ccc6['attributes'],'include':_0x18ccc6[_0xfa80('0x1c')]?_[_0xfa80('0x1d')](_0x18ccc6['include'],function(_0x2febf2){return{'model':db[_0x2febf2[_0xfa80('0x1e')]],'as':_0x2febf2['as'],'attributes':_0x2febf2['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa80('0xd')](function(_0x5a90e5){logger[_0xfa80('0xe')](_0xfa80('0x22'),_0x352f8b);logger['debug'](_0xfa80('0x22'),_0x352f8b,JSON[_0xfa80('0x20')](_0x5a90e5));_0x193192(_0x5a90e5);})[_0xfa80('0x21')](function(_0x3d361c){logger[_0xfa80('0x11')](_0xfa80('0x22'),_0x3d361c[_0xfa80('0x13')],_0x352f8b);_0x41ae75(_0x1fd636['error'](0x1f4,_0x3d361c[_0xfa80('0x13')]));});});}; \ No newline at end of file +var _0x45bf=['then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetSmsQueue','findAll','options','raw','where','attributes','include','map','model','catch','ShowSmsQueue','SmsQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./smsQueue.socket','register'];(function(_0x57fa7e,_0xd0b5ce){var _0x320671=function(_0x3392cc){while(--_0x3392cc){_0x57fa7e['push'](_0x57fa7e['shift']());}};_0x320671(++_0xd0b5ce);}(_0x45bf,0xde));var _0xf45b=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0x45bf[_0x46361e];return _0x14e302;};'use strict';var _=require(_0xf45b('0x0'));var util=require(_0xf45b('0x1'));var moment=require(_0xf45b('0x2'));var BPromise=require(_0xf45b('0x3'));var rs=require(_0xf45b('0x4'));var fs=require('fs');var Redis=require(_0xf45b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf45b('0x6'));var logger=require(_0xf45b('0x7'))(_0xf45b('0x8'));var config=require(_0xf45b('0x9'));var jayson=require(_0xf45b('0xa'));var client=jayson[_0xf45b('0xb')][_0xf45b('0xc')]({'port':0x232a});config['redis']=_[_0xf45b('0xd')](config['redis'],{'host':_0xf45b('0xe'),'port':0x18eb});var socket=require(_0xf45b('0xf'))(new Redis(config['redis']));require(_0xf45b('0x10'))[_0xf45b('0x11')](socket);function respondWithRpcPromise(_0x4779ff,_0xbebf4b,_0x1ff9ab){return new BPromise(function(_0x18fe91,_0x406c14){return client['request'](_0x4779ff,_0x1ff9ab)[_0xf45b('0x12')](function(_0x52de2a){logger[_0xf45b('0x13')](_0xf45b('0x14'),_0xbebf4b,_0xf45b('0x15'));logger[_0xf45b('0x16')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0xbebf4b,_0xf45b('0x15'),JSON[_0xf45b('0x17')](_0x52de2a));if(_0x52de2a[_0xf45b('0x18')]){if(_0x52de2a['error'][_0xf45b('0x19')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0xbebf4b,_0x52de2a[_0xf45b('0x18')][_0xf45b('0x1a')]);return _0x406c14(_0x52de2a[_0xf45b('0x18')][_0xf45b('0x1a')]);}logger[_0xf45b('0x18')](_0xf45b('0x14'),_0xbebf4b,_0x52de2a['error'][_0xf45b('0x1a')]);return _0x18fe91(_0x52de2a[_0xf45b('0x18')][_0xf45b('0x1a')]);}else{logger[_0xf45b('0x13')](_0xf45b('0x14'),_0xbebf4b,_0xf45b('0x15'));_0x18fe91(_0x52de2a['result'][_0xf45b('0x1a')]);}})['catch'](function(_0x4f0ff8){logger['error'](_0xf45b('0x14'),_0xbebf4b,_0x4f0ff8);_0x406c14(_0x4f0ff8);});});}exports[_0xf45b('0x1b')]=function(_0x5d589){var _0x46bd7a=this;return new Promise(function(_0x4f396c,_0x4bbef7){return db['SmsQueue'][_0xf45b('0x1c')]({'raw':_0x5d589[_0xf45b('0x1d')]?_0x5d589['options'][_0xf45b('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d589[_0xf45b('0x1d')]?_0x5d589[_0xf45b('0x1d')][_0xf45b('0x1f')]||null:null,'attributes':_0x5d589[_0xf45b('0x1d')]?_0x5d589[_0xf45b('0x1d')][_0xf45b('0x20')]||null:null,'limit':_0x5d589[_0xf45b('0x1d')]?_0x5d589[_0xf45b('0x1d')]['limit']||null:null,'include':_0x5d589[_0xf45b('0x1d')]?_0x5d589[_0xf45b('0x1d')][_0xf45b('0x21')]?_[_0xf45b('0x22')](_0x5d589[_0xf45b('0x1d')][_0xf45b('0x21')],function(_0x138754){return{'model':db[_0x138754[_0xf45b('0x23')]],'as':_0x138754['as'],'attributes':_0x138754[_0xf45b('0x20')],'include':_0x138754['include']?_[_0xf45b('0x22')](_0x138754[_0xf45b('0x21')],function(_0x2ebe57){return{'model':db[_0x2ebe57[_0xf45b('0x23')]],'as':_0x2ebe57['as'],'attributes':_0x2ebe57[_0xf45b('0x20')],'include':_0x2ebe57['include']?_[_0xf45b('0x22')](_0x2ebe57[_0xf45b('0x21')],function(_0x5116a7){return{'model':db[_0x5116a7['model']],'as':_0x5116a7['as'],'attributes':_0x5116a7['attributes']};}):[]};}):[]};}):[]:[]})[_0xf45b('0x12')](function(_0x1bb5a8){logger[_0xf45b('0x13')]('GetSmsQueue',_0x5d589);logger[_0xf45b('0x16')](_0xf45b('0x1b'),_0x5d589,JSON[_0xf45b('0x17')](_0x1bb5a8));_0x4f396c(_0x1bb5a8);})[_0xf45b('0x24')](function(_0x3ec12a){logger[_0xf45b('0x18')]('GetSmsQueue',_0x3ec12a['message'],_0x5d589);_0x4bbef7(_0x46bd7a[_0xf45b('0x18')](0x1f4,_0x3ec12a[_0xf45b('0x1a')]));});});};exports[_0xf45b('0x25')]=function(_0x2ea6d1){var _0x232d33=this;return new Promise(function(_0x4c8197,_0x19a601){return db[_0xf45b('0x26')][_0xf45b('0x27')]({'raw':_0x2ea6d1['options']?_0x2ea6d1[_0xf45b('0x1d')][_0xf45b('0x1e')]===undefined?!![]:![]:!![],'where':_0x2ea6d1[_0xf45b('0x1d')]?_0x2ea6d1[_0xf45b('0x1d')]['where']||null:null,'attributes':_0x2ea6d1[_0xf45b('0x1d')]?_0x2ea6d1[_0xf45b('0x1d')][_0xf45b('0x20')]||null:null,'include':_0x2ea6d1['options']?_0x2ea6d1[_0xf45b('0x1d')][_0xf45b('0x21')]?_['map'](_0x2ea6d1['options'][_0xf45b('0x21')],function(_0x4b9476){return{'model':db[_0x4b9476[_0xf45b('0x23')]],'as':_0x4b9476['as'],'attributes':_0x4b9476[_0xf45b('0x20')],'include':_0x4b9476[_0xf45b('0x21')]?_[_0xf45b('0x22')](_0x4b9476[_0xf45b('0x21')],function(_0x3205b3){return{'model':db[_0x3205b3[_0xf45b('0x23')]],'as':_0x3205b3['as'],'attributes':_0x3205b3['attributes'],'include':_0x3205b3['include']?_[_0xf45b('0x22')](_0x3205b3[_0xf45b('0x21')],function(_0x2ceb02){return{'model':db[_0x2ceb02[_0xf45b('0x23')]],'as':_0x2ceb02['as'],'attributes':_0x2ceb02['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x332d3e){logger[_0xf45b('0x13')]('ShowSmsQueue',_0x2ea6d1);logger[_0xf45b('0x16')]('ShowSmsQueue',_0x2ea6d1,JSON['stringify'](_0x332d3e));_0x4c8197(_0x332d3e);})[_0xf45b('0x24')](function(_0x2f78df){logger[_0xf45b('0x18')](_0xf45b('0x25'),_0x2f78df['message'],_0x2ea6d1);_0x19a601(_0x232d33['error'](0x1f4,_0x2f78df['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index eef8110..7b7048a 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 _0xf4c2=['register','length','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x1bfb0e,_0x5074d2){var _0x5e9906=function(_0x49505a){while(--_0x49505a){_0x1bfb0e['push'](_0x1bfb0e['shift']());}};_0x5e9906(++_0x5074d2);}(_0xf4c2,0x14b));var _0x2f4c=function(_0x5b6eb8,_0x4fd68d){_0x5b6eb8=_0x5b6eb8-0x0;var _0x2b23d4=_0xf4c2[_0x5b6eb8];return _0x2b23d4;};'use strict';var SmsQueueEvents=require(_0x2f4c('0x0'));var events=[_0x2f4c('0x1'),_0x2f4c('0x2'),_0x2f4c('0x3')];function createListener(_0xc3bfb4,_0x6d4468){return function(_0x120038){_0x6d4468[_0x2f4c('0x4')](_0xc3bfb4,_0x120038);};}function removeListener(_0x653e78,_0x513ad0){return function(){SmsQueueEvents['removeListener'](_0x653e78,_0x513ad0);};}exports[_0x2f4c('0x5')]=function(_0x2c53ff){for(var _0x821704=0x0,_0x3b9fb1=events[_0x2f4c('0x6')];_0x821704<_0x3b9fb1;_0x821704++){var _0x2a8396=events[_0x821704];var _0x3bdc4f=createListener(_0x2f4c('0x7')+_0x2a8396,_0x2c53ff);SmsQueueEvents['on'](_0x2a8396,_0x3bdc4f);}}; \ No newline at end of file +var _0xc275=['removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc275,0x1b4));var _0x5c27=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc275[_0x19950b];return _0x3c6b41;};'use strict';var SmsQueueEvents=require(_0x5c27('0x0'));var events=[_0x5c27('0x1'),_0x5c27('0x2'),_0x5c27('0x3')];function createListener(_0x457c50,_0x5ec62d){return function(_0x4a3ff4){_0x5ec62d['emit'](_0x457c50,_0x4a3ff4);};}function removeListener(_0x13bf56,_0x1a6056){return function(){SmsQueueEvents[_0x5c27('0x4')](_0x13bf56,_0x1a6056);};}exports[_0x5c27('0x5')]=function(_0x43c1e3){for(var _0x1cbde2=0x0,_0x299300=events[_0x5c27('0x6')];_0x1cbde2<_0x299300;_0x1cbde2++){var _0x53b2ac=events[_0x1cbde2];var _0x1733f0=createListener(_0x5c27('0x7')+_0x53b2ac,_0x43c1e3);SmsQueueEvents['on'](_0x53b2ac,_0x1733f0);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 48ce042..c1c4b36 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 _0x7b65=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated'];(function(_0x309cbc,_0x543e8f){var _0x2ac832=function(_0xfe43bc){while(--_0xfe43bc){_0x309cbc['push'](_0x309cbc['shift']());}};_0x2ac832(++_0x543e8f);}(_0x7b65,0xa6));var _0x57b6=function(_0x1e0c76,_0x360a44){_0x1e0c76=_0x1e0c76-0x0;var _0x2e28f0=_0x7b65[_0x1e0c76];return _0x2e28f0;};'use strict';var multer=require(_0x57b6('0x0'));var util=require(_0x57b6('0x1'));var path=require('path');var timeout=require(_0x57b6('0x2'));var express=require(_0x57b6('0x3'));var router=express[_0x57b6('0x4')]();var auth=require(_0x57b6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x57b6('0x6'));var controller=require(_0x57b6('0x7'));router[_0x57b6('0x8')]('/',auth[_0x57b6('0x9')](),controller[_0x57b6('0xa')]);router[_0x57b6('0x8')](_0x57b6('0xb'),auth['isAuthenticated'](),controller[_0x57b6('0xc')]);router[_0x57b6('0x8')](_0x57b6('0xd'),auth[_0x57b6('0x9')](),controller[_0x57b6('0xe')]);router[_0x57b6('0xf')]('/',auth['isAuthenticated'](),controller[_0x57b6('0x10')]);router[_0x57b6('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x57b6('0x12')]);router[_0x57b6('0x13')](_0x57b6('0xd'),auth['isAuthenticated'](),controller[_0x57b6('0x14')]);module[_0x57b6('0x15')]=router; \ No newline at end of file +var _0x0597=['Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x40ff81,_0x489c83){var _0x35eb70=function(_0x57dc84){while(--_0x57dc84){_0x40ff81['push'](_0x40ff81['shift']());}};_0x35eb70(++_0x489c83);}(_0x0597,0x7b));var _0x7059=function(_0x498c67,_0xc0ac6b){_0x498c67=_0x498c67-0x0;var _0x4f62cf=_0x0597[_0x498c67];return _0x4f62cf;};'use strict';var multer=require('multer');var util=require(_0x7059('0x0'));var path=require(_0x7059('0x1'));var timeout=require(_0x7059('0x2'));var express=require('express');var router=express[_0x7059('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7059('0x4'));var config=require(_0x7059('0x5'));var controller=require(_0x7059('0x6'));router[_0x7059('0x7')]('/',auth[_0x7059('0x8')](),controller[_0x7059('0x9')]);router[_0x7059('0x7')](_0x7059('0xa'),auth[_0x7059('0x8')](),controller['describe']);router['get'](_0x7059('0xb'),auth[_0x7059('0x8')](),controller[_0x7059('0xc')]);router['post']('/',auth[_0x7059('0x8')](),controller[_0x7059('0xd')]);router[_0x7059('0xe')](_0x7059('0xb'),auth[_0x7059('0x8')](),controller[_0x7059('0xf')]);router[_0x7059('0x10')](_0x7059('0xb'),auth['isAuthenticated'](),controller[_0x7059('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 33ef17f..9bf6082 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 _0x935d=['moment','sequelize','STRING','DATE'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x935d,0x144));var _0xd935=function(_0x3816c2,_0xb221e1){_0x3816c2=_0x3816c2-0x0;var _0x144669=_0x935d[_0x3816c2];return _0x144669;};'use strict';var moment=require(_0xd935('0x0'));var Sequelize=require(_0xd935('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd935('0x2')]},'joinAt':{'type':Sequelize[_0xd935('0x3')]},'leaveAt':{'type':Sequelize[_0xd935('0x3')]},'acceptAt':{'type':Sequelize[_0xd935('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd935('0x2')]}}; \ No newline at end of file +var _0x7616=['DATE','sequelize','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7616,0xa0));var _0x6761=function(_0x4a0424,_0x4f2075){_0x4a0424=_0x4a0424-0x0;var _0x39c95f=_0x7616[_0x4a0424];return _0x39c95f;};'use strict';var moment=require('moment');var Sequelize=require(_0x6761('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6761('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x6761('0x1')]},'joinAt':{'type':Sequelize[_0x6761('0x2')]},'leaveAt':{'type':Sequelize[_0x6761('0x2')]},'acceptAt':{'type':Sequelize[_0x6761('0x2')]},'exitAt':{'type':Sequelize[_0x6761('0x2')]},'reason':{'type':Sequelize[_0x6761('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 86ef9fd..00d7ff1 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 _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','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x2c719d,_0x4459f6){var _0x5f1c5a=function(_0x4f6da8){while(--_0x4f6da8){_0x2c719d['push'](_0x2c719d['shift']());}};_0x5f1c5a(++_0x4459f6);}(_0xe14b,0x93));var _0xbe14=function(_0x38ce60,_0x123fe2){_0x38ce60=_0x38ce60-0x0;var _0x44ab67=_0xe14b[_0x38ce60];return _0x44ab67;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];function respondWithStatusCode(_0x3d38c2,_0x27792f){_0x27792f=_0x27792f||0xcc;return function(_0x3b898d){if(_0x3b898d){return _0x3d38c2[_0xbe14('0x15')](_0x27792f);}return _0x3d38c2[_0xbe14('0x16')](_0x27792f)[_0xbe14('0x17')]();};}function respondWithResult(_0xa2cf72,_0x1e4826){_0x1e4826=_0x1e4826||0xc8;return function(_0x33fd54){if(_0x33fd54){return _0xa2cf72[_0xbe14('0x16')](_0x1e4826)['json'](_0x33fd54);}};}function respondWithFilteredResult(_0x55b3a7,_0x3f58f5){return function(_0x3dc4a9){if(_0x3dc4a9){var _0xf4ac9=_0x3dc4a9[_0xbe14('0x18')],_0x37ce4e=_0x3f58f5[_0xbe14('0x19')],_0x4e8f34=_0x3f58f5[_0xbe14('0x19')]+_0x3f58f5[_0xbe14('0x1a')],_0x21c789;if(_0x4e8f34>=_0xf4ac9){_0x4e8f34=_0xf4ac9;_0x21c789=0xc8;}else{_0x21c789=0xce;}_0x55b3a7[_0xbe14('0x16')](_0x21c789);return _0x55b3a7[_0xbe14('0x1b')]('Content-Range',_0x37ce4e+'-'+_0x4e8f34+'/'+_0xf4ac9)[_0xbe14('0x1c')](_0x3dc4a9);}return null;};}function patchUpdates(_0x456ca8){return function(_0x329588){try{jsonpatch[_0xbe14('0x1d')](_0x329588,_0x456ca8,!![]);}catch(_0x3249da){return BPromise[_0xbe14('0x1e')](_0x3249da);}return _0x329588['save']();};}function saveUpdates(_0x24f820,_0x4a1bbd){return function(_0x417c8d){if(_0x417c8d){return _0x417c8d[_0xbe14('0x1f')](_0x24f820)[_0xbe14('0x20')](function(_0x51dc0b){return _0x51dc0b;});}return null;};}function removeEntity(_0xe60f42,_0x56d845){return function(_0x3c1c85){if(_0x3c1c85){return _0x3c1c85['destroy']()[_0xbe14('0x20')](function(){_0xe60f42['status'](0xcc)[_0xbe14('0x17')]();});}};}function handleEntityNotFound(_0x3d3608,_0x505dbd){return function(_0x2da350){if(!_0x2da350){_0x3d3608['sendStatus'](0x194);}return _0x2da350;};}function handleError(_0x4587a8,_0x4851f8){_0x4851f8=_0x4851f8||0x1f4;return function(_0x36a21e){logger[_0xbe14('0x21')](_0x36a21e[_0xbe14('0x22')]);if(_0x36a21e[_0xbe14('0x23')]){delete _0x36a21e[_0xbe14('0x23')];}_0x4587a8[_0xbe14('0x16')](_0x4851f8)['send'](_0x36a21e);};}exports[_0xbe14('0x24')]=function(_0x1ba46a,_0x391556){var _0x169369={},_0x5dd475={},_0x16f884={'count':0x0,'rows':[]};var _0x29fc64=_['map'](db[_0xbe14('0x25')][_0xbe14('0x26')],function(_0x1c7cc7){return{'name':_0x1c7cc7[_0xbe14('0x27')],'type':_0x1c7cc7[_0xbe14('0x28')][_0xbe14('0x29')]};});_0x5dd475[_0xbe14('0x2a')]=_[_0xbe14('0x2b')](_0x29fc64,_0xbe14('0x23'));_0x5dd475[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](_0x1ba46a[_0xbe14('0x2c')]);_0x5dd475[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],_0x5dd475[_0xbe14('0x2c')]);_0x169369[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],qs[_0xbe14('0x31')](_0x1ba46a['query'][_0xbe14('0x31')]));_0x169369['attributes']=_0x169369['attributes'][_0xbe14('0x32')]?_0x169369['attributes']:_0x5dd475[_0xbe14('0x2a')];if(!_0x1ba46a[_0xbe14('0x2c')]['hasOwnProperty']('nolimit')){_0x169369['limit']=qs[_0xbe14('0x1a')](_0x1ba46a[_0xbe14('0x2c')]['limit']);_0x169369[_0xbe14('0x19')]=qs[_0xbe14('0x19')](_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x19')]);}_0x169369[_0xbe14('0x33')]=qs['sort'](_0x1ba46a['query'][_0xbe14('0x34')]);_0x169369['where']=qs['filters'](_['pick'](_0x1ba46a[_0xbe14('0x2c')],_0x5dd475[_0xbe14('0x2e')]),_0x29fc64);if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x35')]){_0x169369[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x169369[_0xbe14('0x36')],{'$or':_[_0xbe14('0x2b')](_0x29fc64,function(_0x2d9c12){if(_0x2d9c12[_0xbe14('0x28')]!==_0xbe14('0x38')){var _0x32c59d={};_0x32c59d[_0x2d9c12['name']]={'$like':'%'+_0x1ba46a['query'][_0xbe14('0x35')]+'%'};return _0x32c59d;}})});}_0x169369=_[_0xbe14('0x37')]({},_0x169369,_0x1ba46a[_0xbe14('0x39')]);var _0x520e09={'where':_0x169369[_0xbe14('0x36')]};return db[_0xbe14('0x25')][_0xbe14('0x18')](_0x520e09)[_0xbe14('0x20')](function(_0x3bd454){_0x16f884[_0xbe14('0x18')]=_0x3bd454;if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x3a')]){_0x169369[_0xbe14('0x3b')]=[{'all':!![]}];}return db['SmsQueueReport'][_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['SmsQueueReport'][_0xbe14('0x3f')]({'where':{'id':_0x2a35e5[_0xbe14('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d6ee8,null))['then'](saveUpdates(_0x2a35e5[_0xbe14('0x41')],null))[_0xbe14('0x20')](respondWithResult(_0x2d6ee8,null))[_0xbe14('0x3e')](handleError(_0x2d6ee8,null));};exports[_0xbe14('0x43')]=function(_0xdbc6e1,_0xd04fd5){return db[_0xbe14('0x25')]['find']({'where':{'id':_0xdbc6e1[_0xbe14('0x42')]['id']}})[_0xbe14('0x20')](handleEntityNotFound(_0xd04fd5,null))[_0xbe14('0x20')](removeEntity(_0xd04fd5,null))[_0xbe14('0x3e')](handleError(_0xd04fd5,null));};exports[_0xbe14('0x44')]=function(_0x494c32,_0x3a221b){return db[_0xbe14('0x25')][_0xbe14('0x44')]()[_0xbe14('0x20')](respondWithResult(_0x3a221b,null))[_0xbe14('0x3e')](handleError(_0x3a221b,null));}; \ No newline at end of file +var _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','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x88f3be,_0x34a5b6){var _0x22e9d6=function(_0x223293){while(--_0x223293){_0x88f3be['push'](_0x88f3be['shift']());}};_0x22e9d6(++_0x34a5b6);}(_0xe14b,0x93));var _0xbe14=function(_0x397b4b,_0x4c6e71){_0x397b4b=_0x397b4b-0x0;var _0x5c5308=_0xe14b[_0x397b4b];return _0x5c5308;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];function respondWithStatusCode(_0x3d38c2,_0x27792f){_0x27792f=_0x27792f||0xcc;return function(_0x3b898d){if(_0x3b898d){return _0x3d38c2[_0xbe14('0x15')](_0x27792f);}return _0x3d38c2[_0xbe14('0x16')](_0x27792f)[_0xbe14('0x17')]();};}function respondWithResult(_0xa2cf72,_0x1e4826){_0x1e4826=_0x1e4826||0xc8;return function(_0x33fd54){if(_0x33fd54){return _0xa2cf72[_0xbe14('0x16')](_0x1e4826)['json'](_0x33fd54);}};}function respondWithFilteredResult(_0x55b3a7,_0x3f58f5){return function(_0x3dc4a9){if(_0x3dc4a9){var _0xf4ac9=_0x3dc4a9[_0xbe14('0x18')],_0x37ce4e=_0x3f58f5[_0xbe14('0x19')],_0x4e8f34=_0x3f58f5[_0xbe14('0x19')]+_0x3f58f5[_0xbe14('0x1a')],_0x21c789;if(_0x4e8f34>=_0xf4ac9){_0x4e8f34=_0xf4ac9;_0x21c789=0xc8;}else{_0x21c789=0xce;}_0x55b3a7[_0xbe14('0x16')](_0x21c789);return _0x55b3a7[_0xbe14('0x1b')]('Content-Range',_0x37ce4e+'-'+_0x4e8f34+'/'+_0xf4ac9)[_0xbe14('0x1c')](_0x3dc4a9);}return null;};}function patchUpdates(_0x456ca8){return function(_0x329588){try{jsonpatch[_0xbe14('0x1d')](_0x329588,_0x456ca8,!![]);}catch(_0x3249da){return BPromise[_0xbe14('0x1e')](_0x3249da);}return _0x329588['save']();};}function saveUpdates(_0x24f820,_0x4a1bbd){return function(_0x417c8d){if(_0x417c8d){return _0x417c8d[_0xbe14('0x1f')](_0x24f820)[_0xbe14('0x20')](function(_0x51dc0b){return _0x51dc0b;});}return null;};}function removeEntity(_0xe60f42,_0x56d845){return function(_0x3c1c85){if(_0x3c1c85){return _0x3c1c85['destroy']()[_0xbe14('0x20')](function(){_0xe60f42['status'](0xcc)[_0xbe14('0x17')]();});}};}function handleEntityNotFound(_0x3d3608,_0x505dbd){return function(_0x2da350){if(!_0x2da350){_0x3d3608['sendStatus'](0x194);}return _0x2da350;};}function handleError(_0x4587a8,_0x4851f8){_0x4851f8=_0x4851f8||0x1f4;return function(_0x36a21e){logger[_0xbe14('0x21')](_0x36a21e[_0xbe14('0x22')]);if(_0x36a21e[_0xbe14('0x23')]){delete _0x36a21e[_0xbe14('0x23')];}_0x4587a8[_0xbe14('0x16')](_0x4851f8)['send'](_0x36a21e);};}exports[_0xbe14('0x24')]=function(_0x1ba46a,_0x391556){var _0x169369={},_0x5dd475={},_0x16f884={'count':0x0,'rows':[]};var _0x29fc64=_['map'](db[_0xbe14('0x25')][_0xbe14('0x26')],function(_0x1c7cc7){return{'name':_0x1c7cc7[_0xbe14('0x27')],'type':_0x1c7cc7[_0xbe14('0x28')][_0xbe14('0x29')]};});_0x5dd475[_0xbe14('0x2a')]=_[_0xbe14('0x2b')](_0x29fc64,_0xbe14('0x23'));_0x5dd475[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](_0x1ba46a[_0xbe14('0x2c')]);_0x5dd475[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],_0x5dd475[_0xbe14('0x2c')]);_0x169369[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],qs[_0xbe14('0x31')](_0x1ba46a['query'][_0xbe14('0x31')]));_0x169369['attributes']=_0x169369['attributes'][_0xbe14('0x32')]?_0x169369['attributes']:_0x5dd475[_0xbe14('0x2a')];if(!_0x1ba46a[_0xbe14('0x2c')]['hasOwnProperty']('nolimit')){_0x169369['limit']=qs[_0xbe14('0x1a')](_0x1ba46a[_0xbe14('0x2c')]['limit']);_0x169369[_0xbe14('0x19')]=qs[_0xbe14('0x19')](_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x19')]);}_0x169369[_0xbe14('0x33')]=qs['sort'](_0x1ba46a['query'][_0xbe14('0x34')]);_0x169369['where']=qs['filters'](_['pick'](_0x1ba46a[_0xbe14('0x2c')],_0x5dd475[_0xbe14('0x2e')]),_0x29fc64);if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x35')]){_0x169369[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x169369[_0xbe14('0x36')],{'$or':_[_0xbe14('0x2b')](_0x29fc64,function(_0x2d9c12){if(_0x2d9c12[_0xbe14('0x28')]!==_0xbe14('0x38')){var _0x32c59d={};_0x32c59d[_0x2d9c12['name']]={'$like':'%'+_0x1ba46a['query'][_0xbe14('0x35')]+'%'};return _0x32c59d;}})});}_0x169369=_[_0xbe14('0x37')]({},_0x169369,_0x1ba46a[_0xbe14('0x39')]);var _0x520e09={'where':_0x169369[_0xbe14('0x36')]};return db[_0xbe14('0x25')][_0xbe14('0x18')](_0x520e09)[_0xbe14('0x20')](function(_0x3bd454){_0x16f884[_0xbe14('0x18')]=_0x3bd454;if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x3a')]){_0x169369[_0xbe14('0x3b')]=[{'all':!![]}];}return db['SmsQueueReport'][_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['SmsQueueReport'][_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/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 83171ae..fa6eab9 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 _0x6962=['bluebird','path','rimraf','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','lodash','util','../../config/logger','api','moment'];(function(_0x53202a,_0x36e812){var _0x4b65a8=function(_0x469f83){while(--_0x469f83){_0x53202a['push'](_0x53202a['shift']());}};_0x4b65a8(++_0x36e812);}(_0x6962,0x1cf));var _0x2696=function(_0x3f5d84,_0x1f8f26){_0x3f5d84=_0x3f5d84-0x0;var _0x584f43=_0x6962[_0x3f5d84];return _0x584f43;};'use strict';var _=require(_0x2696('0x0'));var util=require(_0x2696('0x1'));var logger=require(_0x2696('0x2'))(_0x2696('0x3'));var moment=require(_0x2696('0x4'));var BPromise=require(_0x2696('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2696('0x6'));var rimraf=require(_0x2696('0x7'));var config=require('../../config/environment');var attributes=require(_0x2696('0x8'));module[_0x2696('0x9')]=function(_0x2f704f,_0x133196){return _0x2f704f[_0x2696('0xa')](_0x2696('0xb'),attributes,{'tableName':_0x2696('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5eb3=['define','SmsQueueReport','uniqueid','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5d9534,_0x2c5d5a){var _0x316ef4=function(_0x1fb45e){while(--_0x1fb45e){_0x5d9534['push'](_0x5d9534['shift']());}};_0x316ef4(++_0x2c5d5a);}(_0x5eb3,0x1f2));var _0x35eb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5eb3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x35eb('0x0'))(_0x35eb('0x1'));var moment=require(_0x35eb('0x2'));var BPromise=require('bluebird');var rp=require(_0x35eb('0x3'));var fs=require('fs');var path=require(_0x35eb('0x4'));var rimraf=require(_0x35eb('0x5'));var config=require(_0x35eb('0x6'));var attributes=require('./smsQueueReport.attributes');module[_0x35eb('0x7')]=function(_0x3879bd,_0x1ed8b8){return _0x3879bd[_0x35eb('0x8')](_0x35eb('0x9'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x35eb('0xa'),'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 6663e6e..7d81b75 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 _0x6c20=['options','raw','then','UpdateSmsQueueReport','update','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body'];(function(_0x21d650,_0x34649d){var _0x5e50a3=function(_0x590642){while(--_0x590642){_0x21d650['push'](_0x21d650['shift']());}};_0x5e50a3(++_0x34649d);}(_0x6c20,0xfc));var _0x06c2=function(_0x4de1c3,_0xbe77b9){_0x4de1c3=_0x4de1c3-0x0;var _0x26acfe=_0x6c20[_0x4de1c3];return _0x26acfe;};'use strict';var _=require(_0x06c2('0x0'));var util=require(_0x06c2('0x1'));var moment=require('moment');var BPromise=require(_0x06c2('0x2'));var rs=require(_0x06c2('0x3'));var fs=require('fs');var Redis=require(_0x06c2('0x4'));var db=require(_0x06c2('0x5'))['db'];var utils=require(_0x06c2('0x6'));var logger=require(_0x06c2('0x7'))(_0x06c2('0x8'));var config=require(_0x06c2('0x9'));var jayson=require(_0x06c2('0xa'));var client=jayson['client'][_0x06c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1509a2,_0x343986,_0x1693c0){return new BPromise(function(_0x5190c1,_0x22aa08){return client[_0x06c2('0xc')](_0x1509a2,_0x1693c0)['then'](function(_0x3e6a79){logger[_0x06c2('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x343986,_0x06c2('0xe'));logger[_0x06c2('0xf')](_0x06c2('0x10'),_0x343986,'request\x20sent',JSON[_0x06c2('0x11')](_0x3e6a79));if(_0x3e6a79[_0x06c2('0x12')]){if(_0x3e6a79[_0x06c2('0x12')][_0x06c2('0x13')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x343986,_0x3e6a79[_0x06c2('0x12')][_0x06c2('0x14')]);return _0x22aa08(_0x3e6a79[_0x06c2('0x12')]['message']);}logger[_0x06c2('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x343986,_0x3e6a79[_0x06c2('0x12')][_0x06c2('0x14')]);return _0x5190c1(_0x3e6a79[_0x06c2('0x12')]['message']);}else{logger[_0x06c2('0xd')](_0x06c2('0x15'),_0x343986,'request\x20sent');_0x5190c1(_0x3e6a79[_0x06c2('0x16')][_0x06c2('0x14')]);}})[_0x06c2('0x17')](function(_0x4d6968){logger[_0x06c2('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x343986,_0x4d6968);_0x22aa08(_0x4d6968);});});}exports[_0x06c2('0x18')]=function(_0x20796c){var _0x2f81a6=this;return new Promise(function(_0x588fe9,_0x35f06b){return db[_0x06c2('0x19')][_0x06c2('0x1a')](_0x20796c[_0x06c2('0x1b')],{'raw':_0x20796c[_0x06c2('0x1c')]?_0x20796c[_0x06c2('0x1c')][_0x06c2('0x1d')]===undefined?!![]:![]:!![]})[_0x06c2('0x1e')](function(_0x298813){logger[_0x06c2('0xd')]('CreateSmsQueueReport',_0x20796c);logger[_0x06c2('0xf')](_0x06c2('0x18'),_0x20796c,JSON[_0x06c2('0x11')](_0x298813));_0x588fe9(_0x298813);})[_0x06c2('0x17')](function(_0x4e4238){logger[_0x06c2('0x12')](_0x06c2('0x18'),_0x4e4238[_0x06c2('0x14')],_0x20796c);_0x35f06b(_0x2f81a6[_0x06c2('0x12')](0x1f4,_0x4e4238[_0x06c2('0x14')]));});});};exports[_0x06c2('0x1f')]=function(_0x18fe84){var _0x2275a5=this;return new Promise(function(_0x354214,_0x22fcbe){return db[_0x06c2('0x19')][_0x06c2('0x20')](_0x18fe84[_0x06c2('0x1b')],{'raw':_0x18fe84['options']?_0x18fe84[_0x06c2('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18fe84[_0x06c2('0x1c')]?_0x18fe84['options'][_0x06c2('0x21')]||null:null,'attributes':_0x18fe84[_0x06c2('0x1c')]?_0x18fe84['options'][_0x06c2('0x22')]||null:null,'limit':_0x18fe84['options']?_0x18fe84[_0x06c2('0x1c')]['limit']||null:null})[_0x06c2('0x1e')](function(_0x34306e){logger[_0x06c2('0xd')](_0x06c2('0x1f'),_0x18fe84);logger[_0x06c2('0xf')]('UpdateSmsQueueReport',_0x18fe84,JSON[_0x06c2('0x11')](_0x34306e));_0x354214(_0x34306e);})['catch'](function(_0x38964e){logger[_0x06c2('0x12')]('UpdateSmsQueueReport',_0x38964e[_0x06c2('0x14')],_0x18fe84);_0x22fcbe(_0x2275a5[_0x06c2('0x12')](0x1f4,_0x38964e[_0x06c2('0x14')]));});});}; \ No newline at end of file +var _0x9f69=['attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','create','body','options','raw','CreateSmsQueueReport','stringify','UpdateSmsQueueReport','SmsQueueReport','update','where'];(function(_0x38bbbe,_0x1c65f1){var _0x4d2355=function(_0x3296dd){while(--_0x3296dd){_0x38bbbe['push'](_0x38bbbe['shift']());}};_0x4d2355(++_0x1c65f1);}(_0x9f69,0xd9));var _0x99f6=function(_0x3ac0fd,_0x2dfb0c){_0x3ac0fd=_0x3ac0fd-0x0;var _0x2670a9=_0x9f69[_0x3ac0fd];return _0x2670a9;};'use strict';var _=require(_0x99f6('0x0'));var util=require(_0x99f6('0x1'));var moment=require(_0x99f6('0x2'));var BPromise=require(_0x99f6('0x3'));var rs=require(_0x99f6('0x4'));var fs=require('fs');var Redis=require(_0x99f6('0x5'));var db=require(_0x99f6('0x6'))['db'];var utils=require(_0x99f6('0x7'));var logger=require(_0x99f6('0x8'))(_0x99f6('0x9'));var config=require(_0x99f6('0xa'));var jayson=require(_0x99f6('0xb'));var client=jayson[_0x99f6('0xc')][_0x99f6('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x49a89f,_0x52dee6,_0x27a011){return new BPromise(function(_0x23e87f,_0x3f3b25){return client[_0x99f6('0xe')](_0x49a89f,_0x27a011)[_0x99f6('0xf')](function(_0x41dc0b){logger['info'](_0x99f6('0x10'),_0x52dee6,'request\x20sent');logger[_0x99f6('0x11')](_0x99f6('0x12'),_0x52dee6,_0x99f6('0x13'),JSON['stringify'](_0x41dc0b));if(_0x41dc0b[_0x99f6('0x14')]){if(_0x41dc0b[_0x99f6('0x14')][_0x99f6('0x15')]===0x1f4){logger[_0x99f6('0x14')](_0x99f6('0x10'),_0x52dee6,_0x41dc0b[_0x99f6('0x14')][_0x99f6('0x16')]);return _0x3f3b25(_0x41dc0b[_0x99f6('0x14')]['message']);}logger[_0x99f6('0x14')](_0x99f6('0x10'),_0x52dee6,_0x41dc0b[_0x99f6('0x14')][_0x99f6('0x16')]);return _0x23e87f(_0x41dc0b[_0x99f6('0x14')][_0x99f6('0x16')]);}else{logger[_0x99f6('0x17')](_0x99f6('0x10'),_0x52dee6,_0x99f6('0x13'));_0x23e87f(_0x41dc0b['result'][_0x99f6('0x16')]);}})[_0x99f6('0x18')](function(_0x21fdff){logger['error'](_0x99f6('0x10'),_0x52dee6,_0x21fdff);_0x3f3b25(_0x21fdff);});});}exports['CreateSmsQueueReport']=function(_0x440634){var _0x1e49be=this;return new Promise(function(_0x269687,_0x2a935a){return db['SmsQueueReport'][_0x99f6('0x19')](_0x440634[_0x99f6('0x1a')],{'raw':_0x440634[_0x99f6('0x1b')]?_0x440634['options'][_0x99f6('0x1c')]===undefined?!![]:![]:!![]})[_0x99f6('0xf')](function(_0x4ab8d5){logger[_0x99f6('0x17')](_0x99f6('0x1d'),_0x440634);logger['debug'](_0x99f6('0x1d'),_0x440634,JSON[_0x99f6('0x1e')](_0x4ab8d5));_0x269687(_0x4ab8d5);})['catch'](function(_0x58294a){logger[_0x99f6('0x14')]('CreateSmsQueueReport',_0x58294a[_0x99f6('0x16')],_0x440634);_0x2a935a(_0x1e49be[_0x99f6('0x14')](0x1f4,_0x58294a[_0x99f6('0x16')]));});});};exports[_0x99f6('0x1f')]=function(_0xf956f){var _0x4bfe29=this;return new Promise(function(_0x4a0d98,_0x3ea7ca){return db[_0x99f6('0x20')][_0x99f6('0x21')](_0xf956f[_0x99f6('0x1a')],{'raw':_0xf956f[_0x99f6('0x1b')]?_0xf956f[_0x99f6('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf956f[_0x99f6('0x1b')]?_0xf956f[_0x99f6('0x1b')][_0x99f6('0x22')]||null:null,'attributes':_0xf956f[_0x99f6('0x1b')]?_0xf956f[_0x99f6('0x1b')][_0x99f6('0x23')]||null:null,'limit':_0xf956f['options']?_0xf956f[_0x99f6('0x1b')]['limit']||null:null})['then'](function(_0x56a586){logger[_0x99f6('0x17')](_0x99f6('0x1f'),_0xf956f);logger[_0x99f6('0x11')](_0x99f6('0x1f'),_0xf956f,JSON[_0x99f6('0x1e')](_0x56a586));_0x4a0d98(_0x56a586);})[_0x99f6('0x18')](function(_0x1e9b1e){logger[_0x99f6('0x14')](_0x99f6('0x1f'),_0x1e9b1e[_0x99f6('0x16')],_0xf956f);_0x3ea7ca(_0x4bfe29[_0x99f6('0x14')](0x1f4,_0x1e9b1e[_0x99f6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 7f171b9..f876d50 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 _0x8603=['put','update','/:id','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','create'];(function(_0xa5448e,_0x296a7b){var _0x5032ce=function(_0x585fd7){while(--_0x585fd7){_0xa5448e['push'](_0xa5448e['shift']());}};_0x5032ce(++_0x296a7b);}(_0x8603,0x190));var _0x3860=function(_0x43b548,_0x30ea37){_0x43b548=_0x43b548-0x0;var _0x37f928=_0x8603[_0x43b548];return _0x37f928;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3860('0x3'));var interaction=require(_0x3860('0x4'));var config=require(_0x3860('0x5'));var controller=require('./smsTransferReport.controller');router[_0x3860('0x6')]('/',auth['isAuthenticated'](),controller[_0x3860('0x7')]);router[_0x3860('0x6')](_0x3860('0x8'),auth[_0x3860('0x9')](),controller[_0x3860('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/',auth['isAuthenticated'](),controller[_0x3860('0xd')]);router[_0x3860('0xe')]('/:id',auth[_0x3860('0x9')](),controller[_0x3860('0xf')]);router['delete'](_0x3860('0x10'),auth[_0x3860('0x9')](),controller['destroy']);module[_0x3860('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(_0x3b78e4,_0x1e9224){var _0xf0fb87=function(_0x2ef623){while(--_0x2ef623){_0x3b78e4['push'](_0x3b78e4['shift']());}};_0xf0fb87(++_0x1e9224);}(_0xb03e,0x1eb));var _0xeb03=function(_0xd3af7f,_0x248501){_0xd3af7f=_0xd3af7f-0x0;var _0x19eceb=_0xb03e[_0xd3af7f];return _0x19eceb;};'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 b5baab2..614fb52 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 _0xcaa4=['agent','queue','DATE','moment','exports','ENUM','account'];(function(_0x5cc4a8,_0x2df236){var _0xe149fd=function(_0x37a958){while(--_0x37a958){_0x5cc4a8['push'](_0x5cc4a8['shift']());}};_0xe149fd(++_0x2df236);}(_0xcaa4,0x184));var _0x4caa=function(_0x4ac5db,_0x45cbaa){_0x4ac5db=_0x4ac5db-0x0;var _0x15ce69=_0xcaa4[_0x4ac5db];return _0x15ce69;};'use strict';var moment=require(_0x4caa('0x0'));var Sequelize=require('sequelize');module[_0x4caa('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4caa('0x2')](_0x4caa('0x3'),_0x4caa('0x4'),_0x4caa('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x4caa('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x9035=['ENUM','account','agent','queue','NOW','sequelize','exports','STRING'];(function(_0x18e0d1,_0xbca4cb){var _0x58db41=function(_0x5ccffd){while(--_0x5ccffd){_0x18e0d1['push'](_0x18e0d1['shift']());}};_0x58db41(++_0xbca4cb);}(_0x9035,0x1b5));var _0x5903=function(_0x224fbb,_0x2be346){_0x224fbb=_0x224fbb-0x0;var _0x4d5268=_0x9035[_0x224fbb];return _0x4d5268;};'use strict';var moment=require('moment');var Sequelize=require(_0x5903('0x0'));module[_0x5903('0x1')]={'uniqueid':{'type':Sequelize[_0x5903('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5903('0x3')](_0x5903('0x4'),_0x5903('0x5'),'queue'),'allowNull':![],'defaultValue':_0x5903('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x5903('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 295d84a..1b20034 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 _0x70e0=['attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','name','merge','options','count','includeAll','findAll','rows','catch','include','find','create','body','params','describe','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','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','index','map','SmsTransferReport','rawAttributes','fieldName','key','model','keys','query','filters'];(function(_0x495961,_0x288bb8){var _0x50f161=function(_0x28f9d1){while(--_0x28f9d1){_0x495961['push'](_0x495961['shift']());}};_0x50f161(++_0x288bb8);}(_0x70e0,0x17b));var _0x070e=function(_0x587dee,_0x18925c){_0x587dee=_0x587dee-0x0;var _0x24374f=_0x70e0[_0x587dee];return _0x24374f;};'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={},_0x374c54={},_0x219e48={'count':0x0,'rows':[]};var _0x1d72d6=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x1a1892){return{'name':_0x1a1892[_0x070e('0x29')],'type':_0x1a1892['type'][_0x070e('0x2a')]};});_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x26')](_0x1d72d6,'name');_0x374c54['query']=_[_0x070e('0x2c')](_0x1743cc[_0x070e('0x2d')]);_0x374c54[_0x070e('0x2e')]=_['intersection'](_0x374c54[_0x070e('0x2b')],_0x374c54[_0x070e('0x2d')]);_0x497f58[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x374c54['model'],qs['fields'](_0x1743cc['query']['fields']));_0x497f58[_0x070e('0x2f')]=_0x497f58['attributes'][_0x070e('0x31')]?_0x497f58[_0x070e('0x2f')]:_0x374c54['model'];if(!_0x1743cc['query'][_0x070e('0x32')](_0x070e('0x33'))){_0x497f58['limit']=qs['limit'](_0x1743cc[_0x070e('0x2d')][_0x070e('0x19')]);_0x497f58[_0x070e('0x18')]=qs[_0x070e('0x18')](_0x1743cc[_0x070e('0x2d')]['offset']);}_0x497f58['order']=qs[_0x070e('0x34')](_0x1743cc[_0x070e('0x2d')][_0x070e('0x34')]);_0x497f58[_0x070e('0x35')]=qs[_0x070e('0x2e')](_['pick'](_0x1743cc[_0x070e('0x2d')],_0x374c54[_0x070e('0x2e')]),_0x1d72d6);if(_0x1743cc['query'][_0x070e('0x36')]){_0x497f58[_0x070e('0x35')]=_['merge'](_0x497f58['where'],{'$or':_['map'](_0x1d72d6,function(_0x363bff){if(_0x363bff[_0x070e('0x37')]!==_0x070e('0x38')){var _0x334733={};_0x334733[_0x363bff[_0x070e('0x39')]]={'$like':'%'+_0x1743cc['query'][_0x070e('0x36')]+'%'};return _0x334733;}})});}_0x497f58=_[_0x070e('0x3a')]({},_0x497f58,_0x1743cc[_0x070e('0x3b')]);var _0x487276={'where':_0x497f58[_0x070e('0x35')]};return db[_0x070e('0x27')][_0x070e('0x3c')](_0x487276)['then'](function(_0x13982f){_0x219e48[_0x070e('0x3c')]=_0x13982f;if(_0x1743cc['query'][_0x070e('0x3d')]){_0x497f58['include']=[{'all':!![]}];}return db[_0x070e('0x27')][_0x070e('0x3e')](_0x497f58);})[_0x070e('0x20')](function(_0x30319c){_0x219e48[_0x070e('0x3f')]=_0x30319c;return _0x219e48;})['then'](respondWithFilteredResult(_0x4763c6,_0x497f58))[_0x070e('0x40')](handleError(_0x4763c6,null));};exports['show']=function(_0x5bd39a,_0x398168){var _0x42c448={'raw':!![],'where':{'id':_0x5bd39a['params']['id']}},_0x38879f={};_0x38879f[_0x070e('0x2b')]=_[_0x070e('0x2c')](db[_0x070e('0x27')][_0x070e('0x28')]);_0x38879f['query']=_[_0x070e('0x2c')](_0x5bd39a['query']);_0x38879f['filters']=_['intersection'](_0x38879f[_0x070e('0x2b')],_0x38879f[_0x070e('0x2d')]);_0x42c448[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x38879f[_0x070e('0x2b')],qs['fields'](_0x5bd39a[_0x070e('0x2d')]['fields']));_0x42c448[_0x070e('0x2f')]=_0x42c448[_0x070e('0x2f')][_0x070e('0x31')]?_0x42c448['attributes']:_0x38879f['model'];if(_0x5bd39a[_0x070e('0x2d')]['includeAll']){_0x42c448[_0x070e('0x41')]=[{'all':!![]}];}_0x42c448=_[_0x070e('0x3a')]({},_0x42c448,_0x5bd39a[_0x070e('0x3b')]);return db['SmsTransferReport'][_0x070e('0x42')](_0x42c448)[_0x070e('0x20')](handleEntityNotFound(_0x398168,null))['then'](respondWithResult(_0x398168,null))['catch'](handleError(_0x398168,null));};exports[_0x070e('0x43')]=function(_0x945901,_0x2d43ce){return db[_0x070e('0x27')][_0x070e('0x43')](_0x945901['body'],{})[_0x070e('0x20')](respondWithResult(_0x2d43ce,0xc9))[_0x070e('0x40')](handleError(_0x2d43ce,null));};exports[_0x070e('0x1f')]=function(_0x391dee,_0x79eaa0){if(_0x391dee[_0x070e('0x44')]['id']){delete _0x391dee[_0x070e('0x44')]['id'];}return db[_0x070e('0x27')][_0x070e('0x42')]({'where':{'id':_0x391dee[_0x070e('0x45')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x79eaa0,null))[_0x070e('0x20')](saveUpdates(_0x391dee[_0x070e('0x44')],null))[_0x070e('0x20')](respondWithResult(_0x79eaa0,null))[_0x070e('0x40')](handleError(_0x79eaa0,null));};exports['destroy']=function(_0x171621,_0xa7a41b){return db[_0x070e('0x27')][_0x070e('0x42')]({'where':{'id':_0x171621[_0x070e('0x45')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0xa7a41b,null))[_0x070e('0x20')](removeEntity(_0xa7a41b,null))[_0x070e('0x40')](handleError(_0xa7a41b,null));};exports[_0x070e('0x46')]=function(_0x5744c5,_0x251696){return db['SmsTransferReport'][_0x070e('0x46')]()[_0x070e('0x20')](respondWithResult(_0x251696,null))['catch'](handleError(_0x251696,null));}; \ No newline at end of file +var _0xcb91=['options','includeAll','include','findAll','params','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','SmsTransferReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge'];(function(_0x3d248b,_0x46cd57){var _0x384988=function(_0x5413fe){while(--_0x5413fe){_0x3d248b['push'](_0x3d248b['shift']());}};_0x384988(++_0x46cd57);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0xcb91[_0x1abeb2];return _0x48da20;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['index']=function(_0xd6891c,_0x21effa){var _0x41a9a0={},_0x1804fd={},_0x406821={'count':0x0,'rows':[]};var _0x21d6f5=_[_0x1cb9('0x26')](db[_0x1cb9('0x27')][_0x1cb9('0x28')],function(_0x9de64b){return{'name':_0x9de64b['fieldName'],'type':_0x9de64b[_0x1cb9('0x29')]['key']};});_0x1804fd[_0x1cb9('0x2a')]=_['map'](_0x21d6f5,_0x1cb9('0x24'));_0x1804fd[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2d')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x1804fd['model'],qs[_0x1cb9('0x2f')](_0xd6891c['query'][_0x1cb9('0x2f')]));_0x41a9a0['attributes']=_0x41a9a0[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x41a9a0[_0x1cb9('0x2e')]:_0x1804fd[_0x1cb9('0x2a')];if(!_0xd6891c['query'][_0x1cb9('0x31')](_0x1cb9('0x32'))){_0x41a9a0[_0x1cb9('0x1b')]=qs[_0x1cb9('0x1b')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1b')]);_0x41a9a0[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1a')]);}_0x41a9a0[_0x1cb9('0x33')]=qs[_0x1cb9('0x34')](_0xd6891c[_0x1cb9('0x2b')]['sort']);_0x41a9a0['where']=qs[_0x1cb9('0x35')](_[_0x1cb9('0x36')](_0xd6891c[_0x1cb9('0x2b')],_0x1804fd[_0x1cb9('0x35')]),_0x21d6f5);if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x37')]){_0x41a9a0[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x41a9a0['where'],{'$or':_[_0x1cb9('0x26')](_0x21d6f5,function(_0x1482c4){if(_0x1482c4[_0x1cb9('0x29')]!=='VIRTUAL'){var _0x2a5aac={};_0x2a5aac[_0x1482c4['name']]={'$like':'%'+_0xd6891c[_0x1cb9('0x2b')]['filter']+'%'};return _0x2a5aac;}})});}_0x41a9a0=_[_0x1cb9('0x39')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x3a')]);var _0x289b73={'where':_0x41a9a0[_0x1cb9('0x38')]};return db[_0x1cb9('0x27')][_0x1cb9('0x19')](_0x289b73)[_0x1cb9('0x1f')](function(_0x4a4788){_0x406821['count']=_0x4a4788;if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x3b')]){_0x41a9a0[_0x1cb9('0x3c')]=[{'all':!![]}];}return db[_0x1cb9('0x27')][_0x1cb9('0x3d')](_0x41a9a0);})[_0x1cb9('0x1f')](function(_0x32130b){_0x406821['rows']=_0x32130b;return _0x406821;})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x21effa,_0x41a9a0))['catch'](handleError(_0x21effa,null));};exports['show']=function(_0x4c6c75,_0x409c62){var _0x397ff9={'raw':!![],'where':{'id':_0x4c6c75[_0x1cb9('0x3e')]['id']}},_0x1bf51c={};_0x1bf51c[_0x1cb9('0x2a')]=_['keys'](db[_0x1cb9('0x27')]['rawAttributes']);_0x1bf51c[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0x4c6c75[_0x1cb9('0x2b')]);_0x1bf51c['filters']=_[_0x1cb9('0x2d')](_0x1bf51c['model'],_0x1bf51c[_0x1cb9('0x2b')]);_0x397ff9[_0x1cb9('0x2e')]=_['intersection'](_0x1bf51c['model'],qs[_0x1cb9('0x2f')](_0x4c6c75[_0x1cb9('0x2b')][_0x1cb9('0x2f')]));_0x397ff9[_0x1cb9('0x2e')]=_0x397ff9[_0x1cb9('0x2e')]['length']?_0x397ff9[_0x1cb9('0x2e')]:_0x1bf51c['model'];if(_0x4c6c75['query']['includeAll']){_0x397ff9[_0x1cb9('0x3c')]=[{'all':!![]}];}_0x397ff9=_[_0x1cb9('0x39')]({},_0x397ff9,_0x4c6c75[_0x1cb9('0x3a')]);return db[_0x1cb9('0x27')][_0x1cb9('0x3f')](_0x397ff9)[_0x1cb9('0x1f')](handleEntityNotFound(_0x409c62,null))[_0x1cb9('0x1f')](respondWithResult(_0x409c62,null))[_0x1cb9('0x40')](handleError(_0x409c62,null));};exports[_0x1cb9('0x41')]=function(_0x148a01,_0x3ea88c){return db['SmsTransferReport'][_0x1cb9('0x41')](_0x148a01[_0x1cb9('0x42')],{})[_0x1cb9('0x1f')](respondWithResult(_0x3ea88c,0xc9))['catch'](handleError(_0x3ea88c,null));};exports[_0x1cb9('0x43')]=function(_0x57251,_0x3c6044){if(_0x57251[_0x1cb9('0x42')]['id']){delete _0x57251[_0x1cb9('0x42')]['id'];}return db['SmsTransferReport'][_0x1cb9('0x3f')]({'where':{'id':_0x57251['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x3c6044,null))['then'](saveUpdates(_0x57251[_0x1cb9('0x42')],null))[_0x1cb9('0x1f')](respondWithResult(_0x3c6044,null))[_0x1cb9('0x40')](handleError(_0x3c6044,null));};exports[_0x1cb9('0x20')]=function(_0x56d0c5,_0x298475){return db[_0x1cb9('0x27')][_0x1cb9('0x3f')]({'where':{'id':_0x56d0c5[_0x1cb9('0x3e')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x298475,null))[_0x1cb9('0x1f')](removeEntity(_0x298475,null))[_0x1cb9('0x40')](handleError(_0x298475,null));};exports[_0x1cb9('0x44')]=function(_0xbb500e,_0x17f10e){return db['SmsTransferReport']['describe']()[_0x1cb9('0x1f')](respondWithResult(_0x17f10e,null))[_0x1cb9('0x40')](handleError(_0x17f10e,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index cefabb6..92bc43b 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 _0xc71e=['SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsTransferReport.attributes','define'];(function(_0x384638,_0x57f4ed){var _0x2e1a39=function(_0x4cccaa){while(--_0x4cccaa){_0x384638['push'](_0x384638['shift']());}};_0x2e1a39(++_0x57f4ed);}(_0xc71e,0xfe));var _0xec71=function(_0x5db46f,_0xcaea39){_0x5db46f=_0x5db46f-0x0;var _0x14bbfb=_0xc71e[_0x5db46f];return _0x14bbfb;};'use strict';var _=require(_0xec71('0x0'));var util=require(_0xec71('0x1'));var logger=require(_0xec71('0x2'))(_0xec71('0x3'));var moment=require(_0xec71('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xec71('0x5'));var rimraf=require(_0xec71('0x6'));var config=require(_0xec71('0x7'));var attributes=require(_0xec71('0x8'));module['exports']=function(_0x521904,_0x2ce1b5){return _0x521904[_0xec71('0x9')](_0xec71('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xec71('0xb'),'fields':[_0xec71('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x649f=['./smsTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x4ad873,_0x34f51a){var _0x55491a=function(_0x3855d6){while(--_0x3855d6){_0x4ad873['push'](_0x4ad873['shift']());}};_0x55491a(++_0x34f51a);}(_0x649f,0x93));var _0xf649=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x649f[_0xef8146];return _0x5a6cb0;};'use strict';var _=require(_0xf649('0x0'));var util=require(_0xf649('0x1'));var logger=require(_0xf649('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf649('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf649('0x4'));var rimraf=require(_0xf649('0x5'));var config=require(_0xf649('0x6'));var attributes=require(_0xf649('0x7'));module[_0xf649('0x8')]=function(_0x3e2e46,_0x580748){return _0x3e2e46[_0xf649('0x9')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xf649('0xa'),'fields':[_0xf649('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 38e95e8..acfe22e 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 _0xc122=['stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xc122,0x16c));var _0x2c12=function(_0x54ec06,_0x1d3b4b){_0x54ec06=_0x54ec06-0x0;var _0x244b87=_0xc122[_0x54ec06];return _0x244b87;};'use strict';var _=require(_0x2c12('0x0'));var util=require(_0x2c12('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c12('0x2'));var db=require(_0x2c12('0x3'))['db'];var utils=require(_0x2c12('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2c12('0x5'));var jayson=require(_0x2c12('0x6'));var client=jayson[_0x2c12('0x7')][_0x2c12('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26dae7,_0x48c5d5,_0x1bad5d){return new BPromise(function(_0x5f4b4d,_0x221ae8){return client['request'](_0x26dae7,_0x1bad5d)[_0x2c12('0x9')](function(_0xb4c2d2){logger['info'](_0x2c12('0xa'),_0x48c5d5,_0x2c12('0xb'));logger[_0x2c12('0xc')](_0x2c12('0xd'),_0x48c5d5,'request\x20sent',JSON[_0x2c12('0xe')](_0xb4c2d2));if(_0xb4c2d2[_0x2c12('0xf')]){if(_0xb4c2d2['error'][_0x2c12('0x10')]===0x1f4){logger[_0x2c12('0xf')](_0x2c12('0xa'),_0x48c5d5,_0xb4c2d2[_0x2c12('0xf')][_0x2c12('0x11')]);return _0x221ae8(_0xb4c2d2[_0x2c12('0xf')][_0x2c12('0x11')]);}logger['error'](_0x2c12('0xa'),_0x48c5d5,_0xb4c2d2['error'][_0x2c12('0x11')]);return _0x5f4b4d(_0xb4c2d2[_0x2c12('0xf')][_0x2c12('0x11')]);}else{logger[_0x2c12('0x12')](_0x2c12('0xa'),_0x48c5d5,_0x2c12('0xb'));_0x5f4b4d(_0xb4c2d2[_0x2c12('0x13')][_0x2c12('0x11')]);}})[_0x2c12('0x14')](function(_0x522908){logger[_0x2c12('0xf')](_0x2c12('0xa'),_0x48c5d5,_0x522908);_0x221ae8(_0x522908);});});} \ No newline at end of file +var _0xa65b=['info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x33a8b5,_0x1f5f3c){var _0x30bb3d=function(_0x507adf){while(--_0x507adf){_0x33a8b5['push'](_0x33a8b5['shift']());}};_0x30bb3d(++_0x1f5f3c);}(_0xa65b,0x19b));var _0xba65=function(_0x2e1ae1,_0x100544){_0x2e1ae1=_0x2e1ae1-0x0;var _0x203ccf=_0xa65b[_0x2e1ae1];return _0x203ccf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xba65('0x0'));var BPromise=require('bluebird');var rs=require(_0xba65('0x1'));var fs=require('fs');var Redis=require(_0xba65('0x2'));var db=require(_0xba65('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xba65('0x4'));var config=require(_0xba65('0x5'));var jayson=require(_0xba65('0x6'));var client=jayson['client'][_0xba65('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x35cbd2,_0x6db476,_0x4139d7){return new BPromise(function(_0x4a83ee,_0x2b8a1d){return client[_0xba65('0x8')](_0x35cbd2,_0x4139d7)['then'](function(_0x563055){logger[_0xba65('0x9')](_0xba65('0xa'),_0x6db476,_0xba65('0xb'));logger[_0xba65('0xc')](_0xba65('0xd'),_0x6db476,'request\x20sent',JSON[_0xba65('0xe')](_0x563055));if(_0x563055[_0xba65('0xf')]){if(_0x563055['error'][_0xba65('0x10')]===0x1f4){logger[_0xba65('0xf')](_0xba65('0xa'),_0x6db476,_0x563055[_0xba65('0xf')][_0xba65('0x11')]);return _0x2b8a1d(_0x563055['error']['message']);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x6db476,_0x563055[_0xba65('0xf')][_0xba65('0x11')]);return _0x4a83ee(_0x563055[_0xba65('0xf')][_0xba65('0x11')]);}else{logger[_0xba65('0x9')](_0xba65('0xa'),_0x6db476,_0xba65('0xb'));_0x4a83ee(_0x563055[_0xba65('0x12')][_0xba65('0x11')]);}})[_0xba65('0x13')](function(_0x98eec1){logger['error'](_0xba65('0xa'),_0x6db476,_0x98eec1);_0x2b8a1d(_0x98eec1);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index bb57e26..9ffe6c6 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 _0x3ff7=['post','single','file','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','extname'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x3ff7,0x7a));var _0x73ff=function(_0x529abc,_0x17b97e){_0x529abc=_0x529abc-0x0;var _0x453afa=_0x3ff7[_0x529abc];return _0x453afa;};'use strict';var multer=require(_0x73ff('0x0'));var util=require(_0x73ff('0x1'));var path=require(_0x73ff('0x2'));var timeout=require(_0x73ff('0x3'));var express=require('express');var router=express[_0x73ff('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x73ff('0x5'));var config=require(_0x73ff('0x6'));var controller=require(_0x73ff('0x7'));router[_0x73ff('0x8')]('/',auth['isAuthenticated'](),controller[_0x73ff('0x9')]);router[_0x73ff('0x8')](_0x73ff('0xa'),auth[_0x73ff('0xb')](),controller[_0x73ff('0xc')]);router[_0x73ff('0x8')](_0x73ff('0xd'),auth[_0x73ff('0xb')](),controller[_0x73ff('0xe')]);var upload=multer({'storage':multer[_0x73ff('0xf')]({'destination':function(_0x42fd44,_0x9750a3,_0x5e6de8){_0x5e6de8(null,path[_0x73ff('0x10')](config[_0x73ff('0x11')],_0x73ff('0x12')));},'filename':function(_0x1f4d08,_0x487ac9,_0x438afe){_0x487ac9[_0x73ff('0x13')]=_0x487ac9[_0x73ff('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x438afe(null,util[_0x73ff('0x14')](_0x73ff('0x15'),path['basename'](_0x487ac9[_0x73ff('0x13')],path['extname'](_0x487ac9[_0x73ff('0x13')])),Date['now'](),path[_0x73ff('0x16')](_0x487ac9['originalname'])));}})});router[_0x73ff('0x17')]('/',upload[_0x73ff('0x18')](_0x73ff('0x19')),controller['create']);router['put'](_0x73ff('0xa'),auth[_0x73ff('0xb')](),controller[_0x73ff('0x1a')]);router[_0x73ff('0x1b')]('/:id',auth[_0x73ff('0xb')](),controller['delete']);module[_0x73ff('0x1c')]=router; \ No newline at end of file +var _0x750b=['format','%s-%s%s','basename','extname','post','single','file','put','update','delete','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace'];(function(_0xa0bbb0,_0x357b78){var _0xaacc43=function(_0x549b76){while(--_0x549b76){_0xa0bbb0['push'](_0xa0bbb0['shift']());}};_0xaacc43(++_0x357b78);}(_0x750b,0x169));var _0xb750=function(_0x41c243,_0x521583){_0x41c243=_0x41c243-0x0;var _0x44dece=_0x750b[_0x41c243];return _0x44dece;};'use strict';var multer=require(_0xb750('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb750('0x1'));var express=require(_0xb750('0x2'));var router=express[_0xb750('0x3')]();var auth=require(_0xb750('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb750('0x5'));var controller=require(_0xb750('0x6'));router[_0xb750('0x7')]('/',auth[_0xb750('0x8')](),controller['index']);router[_0xb750('0x7')](_0xb750('0x9'),auth[_0xb750('0x8')](),controller['show']);router[_0xb750('0x7')](_0xb750('0xa'),auth[_0xb750('0x8')](),controller[_0xb750('0xb')]);var upload=multer({'storage':multer[_0xb750('0xc')]({'destination':function(_0x20b849,_0x87dd37,_0x58c62b){_0x58c62b(null,path['join'](config[_0xb750('0xd')],_0xb750('0xe')));},'filename':function(_0x119296,_0x128341,_0x531643){_0x128341[_0xb750('0xf')]=_0x128341[_0xb750('0xf')][_0xb750('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x531643(null,util[_0xb750('0x11')](_0xb750('0x12'),path[_0xb750('0x13')](_0x128341[_0xb750('0xf')],path[_0xb750('0x14')](_0x128341[_0xb750('0xf')])),Date['now'](),path[_0xb750('0x14')](_0x128341[_0xb750('0xf')])));}})});router[_0xb750('0x15')]('/',upload[_0xb750('0x16')](_0xb750('0x17')),controller['create']);router[_0xb750('0x18')](_0xb750('0x9'),auth[_0xb750('0x8')](),controller[_0xb750('0x19')]);router['delete'](_0xb750('0x9'),auth[_0xb750('0x8')](),controller[_0xb750('0x1a')]);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 db03cbe..dc98ec0 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 _0x62b5=['INTEGER','BIGINT','sequelize','STRING','FLOAT'];(function(_0x5ee888,_0xaaff15){var _0x43d301=function(_0x3c9242){while(--_0x3c9242){_0x5ee888['push'](_0x5ee888['shift']());}};_0x43d301(++_0xaaff15);}(_0x62b5,0x188));var _0x562b=function(_0x4362a7,_0x11bd2f){_0x4362a7=_0x4362a7-0x0;var _0x1ae7cf=_0x62b5[_0x4362a7];return _0x1ae7cf;};'use strict';var Sequelize=require(_0x562b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x562b('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x562b('0x1')]},'original_format':{'type':Sequelize[_0x562b('0x1')]},'original_duration':{'type':Sequelize[_0x562b('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x562b('0x3')]},'original_bitRate':{'type':Sequelize[_0x562b('0x4')]},'original_sampleRate':{'type':Sequelize[_0x562b('0x3')]},'converted_format':{'type':Sequelize[_0x562b('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x562b('0x3')]},'converted_bitRate':{'type':Sequelize[_0x562b('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x562b('0x3')]}}; \ No newline at end of file +var _0x10a6=['INTEGER','sequelize','exports','STRING','FLOAT','BIGINT'];(function(_0x3ebb69,_0x3e612e){var _0x421e59=function(_0x5a8c66){while(--_0x5a8c66){_0x3ebb69['push'](_0x3ebb69['shift']());}};_0x421e59(++_0x3e612e);}(_0x10a6,0xd3));var _0x610a=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x10a6[_0x4b174a];return _0x3cd7bf;};'use strict';var Sequelize=require(_0x610a('0x0'));module[_0x610a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x610a('0x2')]},'original_duration':{'type':Sequelize[_0x610a('0x3')]},'original_sampleCount':{'type':Sequelize[_0x610a('0x4')]},'original_channelCount':{'type':Sequelize[_0x610a('0x5')]},'original_bitRate':{'type':Sequelize[_0x610a('0x4')]},'original_sampleRate':{'type':Sequelize[_0x610a('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x610a('0x4')]},'converted_channelCount':{'type':Sequelize[_0x610a('0x5')]},'converted_bitRate':{'type':Sequelize[_0x610a('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x610a('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index a79996f..c4f115e 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 _0x7a87=['merge','VIRTUAL','options','where','count','includeAll','Sound','findAll','rows','catch','params','keys','length','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','0777','transcode','unlinkSync','send','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','end','chmodSync','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','update','description','delete','original_format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','then','destroy','get','Sounds','UserProfileResource','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0x7a87,0x131));var _0x77a8=function(_0xd564bf,_0x56daf3){_0xd564bf=_0xd564bf-0x0;var _0x5e26b2=_0x7a87[_0xd564bf];return _0x5e26b2;};'use strict';var pdf=require(_0x77a8('0x0'));var emlformat=require(_0x77a8('0x1'));var rimraf=require(_0x77a8('0x2'));var zipdir=require(_0x77a8('0x3'));var jsonpatch=require(_0x77a8('0x4'));var rp=require(_0x77a8('0x5'));var moment=require(_0x77a8('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x77a8('0x7'));var util=require(_0x77a8('0x8'));var path=require(_0x77a8('0x9'));var sox=require(_0x77a8('0xa'));var csv=require(_0x77a8('0xb'));var ejs=require(_0x77a8('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x77a8('0xd'));var jsforce=require(_0x77a8('0xe'));var deskjs=require(_0x77a8('0xf'));var toCsv=require(_0x77a8('0xb'));var querystring=require(_0x77a8('0x10'));var Papa=require(_0x77a8('0x11'));var Redis=require('ioredis');var authService=require(_0x77a8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x77a8('0x13'));var hardwareService=require(_0x77a8('0x14'));var logger=require(_0x77a8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x77a8('0x16'));var db=require(_0x77a8('0x17'))['db'];function respondWithStatusCode(_0x255edf,_0x49573a){_0x49573a=_0x49573a||0xcc;return function(_0x5c8b5d){if(_0x5c8b5d){return _0x255edf['sendStatus'](_0x49573a);}return _0x255edf[_0x77a8('0x18')](_0x49573a)['end']();};}function respondWithResult(_0x214213,_0x2fd087){_0x2fd087=_0x2fd087||0xc8;return function(_0x4f114d){if(_0x4f114d){return _0x214213[_0x77a8('0x18')](_0x2fd087)[_0x77a8('0x19')](_0x4f114d);}};}function respondWithFilteredResult(_0x4483eb,_0x5bd934){return function(_0x2c794a){if(_0x2c794a){var _0x2ca6e1=_0x2c794a['count'],_0x40d8b1=_0x5bd934[_0x77a8('0x1a')],_0x2d768a=_0x5bd934[_0x77a8('0x1a')]+_0x5bd934[_0x77a8('0x1b')],_0x44c621;if(_0x2d768a>=_0x2ca6e1){_0x2d768a=_0x2ca6e1;_0x44c621=0xc8;}else{_0x44c621=0xce;}_0x4483eb['status'](_0x44c621);return _0x4483eb[_0x77a8('0x1c')](_0x77a8('0x1d'),_0x40d8b1+'-'+_0x2d768a+'/'+_0x2ca6e1)['json'](_0x2c794a);}return null;};}function patchUpdates(_0x32ebf2){return function(_0xceca97){try{jsonpatch[_0x77a8('0x1e')](_0xceca97,_0x32ebf2,!![]);}catch(_0xbf6bca){return BPromise[_0x77a8('0x1f')](_0xbf6bca);}return _0xceca97['save']();};}function saveUpdates(_0x4cc0a3,_0x37f268){return function(_0x239919){if(_0x239919){return _0x239919['update'](_0x4cc0a3)[_0x77a8('0x20')](function(_0x3d0b07){return _0x3d0b07;});}return null;};}function removeEntity(_0x4f8d66,_0x510bf0){return function(_0x1b42f6){if(_0x1b42f6){return _0x1b42f6[_0x77a8('0x21')]()[_0x77a8('0x20')](function(){var _0x68768a=_0x1b42f6[_0x77a8('0x22')]({'plain':!![]});var _0x485e8a=_0x77a8('0x23');return db[_0x77a8('0x24')][_0x77a8('0x21')]({'where':{'type':_0x485e8a,'resourceId':_0x68768a['id']}})['then'](function(){return _0x1b42f6;});})[_0x77a8('0x20')](function(){_0x4f8d66[_0x77a8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x557296,_0x5a90c3){return function(_0x5730f5){if(!_0x5730f5){_0x557296[_0x77a8('0x25')](0x194);}return _0x5730f5;};}function handleError(_0x346312,_0x31a671){_0x31a671=_0x31a671||0x1f4;return function(_0x4899bf){logger[_0x77a8('0x26')](_0x4899bf[_0x77a8('0x27')]);if(_0x4899bf[_0x77a8('0x28')]){delete _0x4899bf[_0x77a8('0x28')];}_0x346312[_0x77a8('0x18')](_0x31a671)['send'](_0x4899bf);};}exports[_0x77a8('0x29')]=function(_0x39203b,_0x1c1da9){var _0x592970={},_0x3f4fe0={},_0x8d4f1e={'count':0x0,'rows':[]};var _0x519ac4=_[_0x77a8('0x2a')](db['Sound'][_0x77a8('0x2b')],function(_0x13f51){return{'name':_0x13f51[_0x77a8('0x2c')],'type':_0x13f51[_0x77a8('0x2d')][_0x77a8('0x2e')]};});_0x3f4fe0[_0x77a8('0x2f')]=_[_0x77a8('0x2a')](_0x519ac4,'name');_0x3f4fe0['query']=_['keys'](_0x39203b[_0x77a8('0x30')]);_0x3f4fe0[_0x77a8('0x31')]=_[_0x77a8('0x32')](_0x3f4fe0['model'],_0x3f4fe0[_0x77a8('0x30')]);_0x592970['attributes']=_[_0x77a8('0x32')](_0x3f4fe0[_0x77a8('0x2f')],qs[_0x77a8('0x33')](_0x39203b[_0x77a8('0x30')][_0x77a8('0x33')]));_0x592970[_0x77a8('0x34')]=_0x592970['attributes']['length']?_0x592970['attributes']:_0x3f4fe0[_0x77a8('0x2f')];if(!_0x39203b['query'][_0x77a8('0x35')]('nolimit')){_0x592970[_0x77a8('0x1b')]=qs[_0x77a8('0x1b')](_0x39203b['query']['limit']);_0x592970[_0x77a8('0x1a')]=qs[_0x77a8('0x1a')](_0x39203b['query'][_0x77a8('0x1a')]);}_0x592970[_0x77a8('0x36')]=qs[_0x77a8('0x37')](_0x39203b['query'][_0x77a8('0x37')]);_0x592970['where']=qs[_0x77a8('0x31')](_[_0x77a8('0x38')](_0x39203b[_0x77a8('0x30')],_0x3f4fe0[_0x77a8('0x31')]),_0x519ac4);if(_0x39203b[_0x77a8('0x30')][_0x77a8('0x39')]){_0x592970['where']=_[_0x77a8('0x3a')](_0x592970['where'],{'$or':_[_0x77a8('0x2a')](_0x519ac4,function(_0x4b84b9){if(_0x4b84b9[_0x77a8('0x2d')]!==_0x77a8('0x3b')){var _0x51ca2e={};_0x51ca2e[_0x4b84b9[_0x77a8('0x28')]]={'$like':'%'+_0x39203b[_0x77a8('0x30')][_0x77a8('0x39')]+'%'};return _0x51ca2e;}})});}_0x592970=_[_0x77a8('0x3a')]({},_0x592970,_0x39203b[_0x77a8('0x3c')]);var _0x2545ae={'where':_0x592970[_0x77a8('0x3d')]};return db['Sound'][_0x77a8('0x3e')](_0x2545ae)[_0x77a8('0x20')](function(_0x21e843){_0x8d4f1e[_0x77a8('0x3e')]=_0x21e843;if(_0x39203b[_0x77a8('0x30')][_0x77a8('0x3f')]){_0x592970['include']=[{'all':!![]}];}return db[_0x77a8('0x40')][_0x77a8('0x41')](_0x592970);})[_0x77a8('0x20')](function(_0x384b5a){_0x8d4f1e[_0x77a8('0x42')]=_0x384b5a;return _0x8d4f1e;})[_0x77a8('0x20')](respondWithFilteredResult(_0x1c1da9,_0x592970))[_0x77a8('0x43')](handleError(_0x1c1da9,null));};exports['show']=function(_0x4fb519,_0x5cd037){var _0x334b9a={'raw':!![],'where':{'id':_0x4fb519[_0x77a8('0x44')]['id']}},_0x2aab7a={};_0x2aab7a[_0x77a8('0x2f')]=_['keys'](db[_0x77a8('0x40')]['rawAttributes']);_0x2aab7a[_0x77a8('0x30')]=_[_0x77a8('0x45')](_0x4fb519['query']);_0x2aab7a[_0x77a8('0x31')]=_[_0x77a8('0x32')](_0x2aab7a[_0x77a8('0x2f')],_0x2aab7a[_0x77a8('0x30')]);_0x334b9a[_0x77a8('0x34')]=_[_0x77a8('0x32')](_0x2aab7a['model'],qs[_0x77a8('0x33')](_0x4fb519[_0x77a8('0x30')][_0x77a8('0x33')]));_0x334b9a[_0x77a8('0x34')]=_0x334b9a['attributes'][_0x77a8('0x46')]?_0x334b9a[_0x77a8('0x34')]:_0x2aab7a[_0x77a8('0x2f')];if(_0x4fb519[_0x77a8('0x30')][_0x77a8('0x3f')]){_0x334b9a['include']=[{'all':!![]}];}_0x334b9a=_['merge']({},_0x334b9a,_0x4fb519[_0x77a8('0x3c')]);return db[_0x77a8('0x40')][_0x77a8('0x47')](_0x334b9a)[_0x77a8('0x20')](handleEntityNotFound(_0x5cd037,null))[_0x77a8('0x20')](respondWithResult(_0x5cd037,null))['catch'](handleError(_0x5cd037,null));};exports['download']=function(_0x21d4c1,_0x1e496f,_0x4f5b5f){return db[_0x77a8('0x40')][_0x77a8('0x47')]({'where':{'id':_0x21d4c1[_0x77a8('0x44')]['id']},'attributes':[_0x77a8('0x28'),_0x77a8('0x48'),_0x77a8('0x49')],'raw':!![]})[_0x77a8('0x20')](handleEntityNotFound(_0x1e496f,null))[_0x77a8('0x20')](function(_0x2b70b1){if(_0x2b70b1){if(!fs[_0x77a8('0x4a')](path[_0x77a8('0x4b')](config[_0x77a8('0x4c')],_0x77a8('0x4d'),_0x2b70b1[_0x77a8('0x48')]+'.'+_0x2b70b1[_0x77a8('0x49')]))){throw new db[(_0x77a8('0x4e'))][(_0x77a8('0x4f'))](_0x77a8('0x50'));}return _0x1e496f['download'](path[_0x77a8('0x4b')](config[_0x77a8('0x4c')],_0x77a8('0x4d'),util[_0x77a8('0x51')](_0x77a8('0x52'),_0x2b70b1[_0x77a8('0x48')],_0x2b70b1[_0x77a8('0x49')])),util[_0x77a8('0x51')](_0x77a8('0x52'),_0x2b70b1[_0x77a8('0x28')],_0x2b70b1['converted_format']));}return null;})[_0x77a8('0x43')](handleError(_0x1e496f,null));};exports[_0x77a8('0x53')]=function(_0x33394e,_0x3ca66f,_0x30d517){var _0x4bb7be={'name':path[_0x77a8('0x54')](_0x33394e[_0x77a8('0x55')][_0x77a8('0x56')],path[_0x77a8('0x57')](_0x33394e['file'][_0x77a8('0x56')])),'save_name':path['basename'](_0x33394e[_0x77a8('0x55')][_0x77a8('0x58')],path[_0x77a8('0x57')](_0x33394e[_0x77a8('0x55')][_0x77a8('0x58')])),'original_format':path[_0x77a8('0x57')](_0x33394e[_0x77a8('0x55')][_0x77a8('0x56')])['substring'](0x1),'converted_format':_0x77a8('0x59')};var _0x4c7e03=path['join'](config[_0x77a8('0x4c')],_0x77a8('0x5a'),_0x33394e['file'][_0x77a8('0x58')]);var _0x2e777a=path[_0x77a8('0x4b')](config[_0x77a8('0x4c')],_0x77a8('0x4d'),util['format'](_0x77a8('0x52'),path['basename'](_0x33394e[_0x77a8('0x55')]['filename'],path[_0x77a8('0x57')](_0x33394e[_0x77a8('0x55')][_0x77a8('0x58')])),_0x4bb7be[_0x77a8('0x49')]));logger[_0x77a8('0x5b')](_0x77a8('0x5c'),_0x4c7e03);logger[_0x77a8('0x5b')]('Sound\x20upload\x20destination:\x20%s',_0x2e777a);try{fs['chmodSync'](_0x4c7e03,parseInt(_0x77a8('0x5d'),0x8));var _0xfaffb1=sox[_0x77a8('0x5e')](_0x4c7e03,_0x2e777a,{'sampleRate':0x1f40,'format':_0x77a8('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xfaffb1['on'](_0x77a8('0x26'),function(_0x1d97fc){fs[_0x77a8('0x5f')](_0x4c7e03);_0x3ca66f[_0x77a8('0x18')](0x1f4)[_0x77a8('0x60')](_0x1d97fc);});_0xfaffb1['on']('src',function(_0x21c21d){_0x4bb7be['original_duration']=isNaN(_0x21c21d[_0x77a8('0x61')])?null:_0x21c21d[_0x77a8('0x61')]*0x3e8;_0x4bb7be[_0x77a8('0x62')]=isNaN(_0x21c21d[_0x77a8('0x63')])?null:_0x21c21d[_0x77a8('0x63')];_0x4bb7be[_0x77a8('0x64')]=isNaN(_0x21c21d['channelCount'])?null:_0x21c21d[_0x77a8('0x65')];_0x4bb7be['original_bitRate']=isNaN(_0x21c21d[_0x77a8('0x66')])?null:_0x21c21d[_0x77a8('0x66')];_0x4bb7be[_0x77a8('0x67')]=isNaN(_0x21c21d['sampleRate'])?null:_0x21c21d[_0x77a8('0x68')];});_0xfaffb1['on'](_0x77a8('0x69'),function(_0x3cf0ce){_0x4bb7be[_0x77a8('0x6a')]=isNaN(_0x3cf0ce[_0x77a8('0x61')])?null:_0x3cf0ce[_0x77a8('0x61')]*0x3e8;_0x4bb7be[_0x77a8('0x6b')]=isNaN(_0x3cf0ce['sampleCount'])?null:_0x3cf0ce[_0x77a8('0x63')];_0x4bb7be['converted_channelCount']=isNaN(_0x3cf0ce['channelCount'])?null:_0x3cf0ce[_0x77a8('0x65')];_0x4bb7be[_0x77a8('0x6c')]=isNaN(_0x3cf0ce['bitRate'])?null:_0x3cf0ce[_0x77a8('0x66')];_0x4bb7be[_0x77a8('0x6d')]=isNaN(_0x3cf0ce[_0x77a8('0x68')])?null:_0x3cf0ce[_0x77a8('0x68')];});_0xfaffb1['on'](_0x77a8('0x6e'),function(){fs[_0x77a8('0x6f')](_0x2e777a,parseInt(_0x77a8('0x5d'),0x8));return db[_0x77a8('0x40')][_0x77a8('0x53')](_0x4bb7be)[_0x77a8('0x20')](function(_0x3e9f15){var _0x1078f8={'role':_0x33394e[_0x77a8('0x70')][_0x77a8('0x71')],'userProfileId':_0x33394e['body'][_0x77a8('0x72')]};if(!_0x1078f8)throw new Error(_0x77a8('0x73'));if(_0x1078f8['role']===_0x77a8('0x74')){var _0x49625d=_0x3e9f15[_0x77a8('0x22')]({'plain':!![]});return db['UserProfileSection'][_0x77a8('0x47')]({'where':{'name':_0x77a8('0x23'),'userProfileId':_0x1078f8[_0x77a8('0x72')]},'raw':!![]})[_0x77a8('0x20')](function(_0x5d1048){if(_0x5d1048&&_0x5d1048['autoAssociation']===0x0){return db[_0x77a8('0x24')][_0x77a8('0x53')]({'name':_0x49625d[_0x77a8('0x28')],'resourceId':_0x49625d['id'],'type':_0x5d1048['name'],'sectionId':_0x5d1048['id']},{})['then'](function(){return _0x3e9f15;});}else{return _0x3e9f15;}})['catch'](function(_0x2c94ce){logger[_0x77a8('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c94ce);throw _0x2c94ce;});}return _0x3e9f15;})[_0x77a8('0x20')](respondWithResult(_0x3ca66f,null))['catch'](handleError(_0x3ca66f,null));});_0xfaffb1['start']();}catch(_0x49dc47){_0x3ca66f[_0x77a8('0x18')](0x1f4)['send'](_0x49dc47);}};exports[_0x77a8('0x75')]=function(_0x59db2d,_0x33b7e7,_0x4d8bc4){return db[_0x77a8('0x40')]['find']({'where':{'id':_0x59db2d['params']['id']}})[_0x77a8('0x20')](handleEntityNotFound(_0x33b7e7,null))[_0x77a8('0x20')](saveUpdates(_[_0x77a8('0x38')](_0x59db2d[_0x77a8('0x70')],[_0x77a8('0x28'),_0x77a8('0x76')]),null))['then'](respondWithResult(_0x33b7e7,null))[_0x77a8('0x43')](handleError(_0x33b7e7,null));};exports[_0x77a8('0x77')]=function(_0x5a87d2,_0x3c9d1e,_0x122f99){return db[_0x77a8('0x40')][_0x77a8('0x47')]({'where':{'id':_0x5a87d2[_0x77a8('0x44')]['id']}})['then'](function(_0x5c3c34){if(_0x5c3c34){return _0x5c3c34['destroy']();}})[_0x77a8('0x20')](function(_0x4f66c8){var _0x5a1ae3=path['join'](config[_0x77a8('0x4c')],'server/files/sounds/original',util[_0x77a8('0x51')](_0x77a8('0x52'),_0x4f66c8[_0x77a8('0x48')],_0x4f66c8[_0x77a8('0x78')]));var _0x10b0b1=path[_0x77a8('0x4b')](config['root'],'server/files/sounds/converted',util['format']('%s.%s',_0x4f66c8[_0x77a8('0x48')],_0x4f66c8['converted_format']));fs[_0x77a8('0x5f')](_0x5a1ae3);fs[_0x77a8('0x5f')](_0x10b0b1);return _0x4f66c8;})[_0x77a8('0x20')](function(_0x76b4a3){if(_0x76b4a3){return _0x3c9d1e['status'](0xcc)[_0x77a8('0x6e')]();}})['then'](handleEntityNotFound(_0x3c9d1e,null))['catch'](handleError(_0x3c9d1e,null));}; \ No newline at end of file +var _0x9afa=['merge','options','Sound','includeAll','include','findAll','rows','catch','params','fields','find','download','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sound\x20not\x20found','join','format','%s.%s','create','file','originalname','extname','basename','filename','substring','wav','info','chmodSync','0777','transcode','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','Sounds','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','server/files/sounds/original','original_format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','Content-Range','reject','update','then','destroy','end','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filter'];(function(_0x63c085,_0x2abe7f){var _0x365687=function(_0x83a541){while(--_0x83a541){_0x63c085['push'](_0x63c085['shift']());}};_0x365687(++_0x2abe7f);}(_0x9afa,0x1af));var _0xa9af=function(_0x2f1355,_0xe7271e){_0x2f1355=_0x2f1355-0x0;var _0x19926f=_0x9afa[_0x2f1355];return _0x19926f;};'use strict';var pdf=require(_0xa9af('0x0'));var emlformat=require(_0xa9af('0x1'));var rimraf=require(_0xa9af('0x2'));var zipdir=require(_0xa9af('0x3'));var jsonpatch=require(_0xa9af('0x4'));var rp=require(_0xa9af('0x5'));var moment=require(_0xa9af('0x6'));var BPromise=require(_0xa9af('0x7'));var Mustache=require(_0xa9af('0x8'));var util=require(_0xa9af('0x9'));var path=require(_0xa9af('0xa'));var sox=require(_0xa9af('0xb'));var csv=require(_0xa9af('0xc'));var ejs=require(_0xa9af('0xd'));var fs=require('fs');var _=require(_0xa9af('0xe'));var squel=require(_0xa9af('0xf'));var crypto=require(_0xa9af('0x10'));var jsforce=require(_0xa9af('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xa9af('0xc'));var querystring=require(_0xa9af('0x12'));var Papa=require(_0xa9af('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa9af('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9af('0x15'))(_0xa9af('0x16'));var utils=require(_0xa9af('0x17'));var config=require('../../config/environment');var db=require(_0xa9af('0x18'))['db'];function respondWithStatusCode(_0x5e5504,_0x91633e){_0x91633e=_0x91633e||0xcc;return function(_0x3214a0){if(_0x3214a0){return _0x5e5504[_0xa9af('0x19')](_0x91633e);}return _0x5e5504['status'](_0x91633e)['end']();};}function respondWithResult(_0x3f15e0,_0x2135bf){_0x2135bf=_0x2135bf||0xc8;return function(_0x699919){if(_0x699919){return _0x3f15e0[_0xa9af('0x1a')](_0x2135bf)[_0xa9af('0x1b')](_0x699919);}};}function respondWithFilteredResult(_0x43d5c4,_0x5725d6){return function(_0x257c1a){if(_0x257c1a){var _0x28849d=_0x257c1a[_0xa9af('0x1c')],_0xa976ff=_0x5725d6['offset'],_0x107e07=_0x5725d6['offset']+_0x5725d6['limit'],_0x10d21d;if(_0x107e07>=_0x28849d){_0x107e07=_0x28849d;_0x10d21d=0xc8;}else{_0x10d21d=0xce;}_0x43d5c4[_0xa9af('0x1a')](_0x10d21d);return _0x43d5c4['set'](_0xa9af('0x1d'),_0xa976ff+'-'+_0x107e07+'/'+_0x28849d)['json'](_0x257c1a);}return null;};}function patchUpdates(_0x315234){return function(_0x463adb){try{jsonpatch['apply'](_0x463adb,_0x315234,!![]);}catch(_0x18d328){return BPromise[_0xa9af('0x1e')](_0x18d328);}return _0x463adb['save']();};}function saveUpdates(_0x5ab680,_0x32ce59){return function(_0x17bb4b){if(_0x17bb4b){return _0x17bb4b[_0xa9af('0x1f')](_0x5ab680)[_0xa9af('0x20')](function(_0x38be78){return _0x38be78;});}return null;};}function removeEntity(_0xf5a4a3,_0x14b679){return function(_0x510bf4){if(_0x510bf4){return _0x510bf4[_0xa9af('0x21')]()[_0xa9af('0x20')](function(){var _0x3863d8=_0x510bf4['get']({'plain':!![]});var _0x3b03d2='Sounds';return db['UserProfileResource'][_0xa9af('0x21')]({'where':{'type':_0x3b03d2,'resourceId':_0x3863d8['id']}})[_0xa9af('0x20')](function(){return _0x510bf4;});})[_0xa9af('0x20')](function(){_0xf5a4a3['status'](0xcc)[_0xa9af('0x22')]();});}};}function handleEntityNotFound(_0x94c9d5,_0x4060bf){return function(_0xa6cd14){if(!_0xa6cd14){_0x94c9d5[_0xa9af('0x19')](0x194);}return _0xa6cd14;};}function handleError(_0x5660b1,_0x5955e2){_0x5955e2=_0x5955e2||0x1f4;return function(_0x4033b0){logger['error'](_0x4033b0[_0xa9af('0x23')]);if(_0x4033b0[_0xa9af('0x24')]){delete _0x4033b0[_0xa9af('0x24')];}_0x5660b1[_0xa9af('0x1a')](_0x5955e2)['send'](_0x4033b0);};}exports['index']=function(_0x466294,_0x8ff53){var _0x3ab062={},_0x31d39d={},_0x4a8840={'count':0x0,'rows':[]};var _0x175cc2=_[_0xa9af('0x25')](db['Sound'][_0xa9af('0x26')],function(_0x396dfa){return{'name':_0x396dfa[_0xa9af('0x27')],'type':_0x396dfa[_0xa9af('0x28')][_0xa9af('0x29')]};});_0x31d39d[_0xa9af('0x2a')]=_[_0xa9af('0x25')](_0x175cc2,'name');_0x31d39d[_0xa9af('0x2b')]=_[_0xa9af('0x2c')](_0x466294['query']);_0x31d39d[_0xa9af('0x2d')]=_['intersection'](_0x31d39d['model'],_0x31d39d[_0xa9af('0x2b')]);_0x3ab062[_0xa9af('0x2e')]=_[_0xa9af('0x2f')](_0x31d39d[_0xa9af('0x2a')],qs['fields'](_0x466294[_0xa9af('0x2b')]['fields']));_0x3ab062[_0xa9af('0x2e')]=_0x3ab062[_0xa9af('0x2e')][_0xa9af('0x30')]?_0x3ab062['attributes']:_0x31d39d[_0xa9af('0x2a')];if(!_0x466294[_0xa9af('0x2b')][_0xa9af('0x31')](_0xa9af('0x32'))){_0x3ab062[_0xa9af('0x33')]=qs[_0xa9af('0x33')](_0x466294[_0xa9af('0x2b')][_0xa9af('0x33')]);_0x3ab062[_0xa9af('0x34')]=qs[_0xa9af('0x34')](_0x466294[_0xa9af('0x2b')][_0xa9af('0x34')]);}_0x3ab062[_0xa9af('0x35')]=qs[_0xa9af('0x36')](_0x466294['query'][_0xa9af('0x36')]);_0x3ab062[_0xa9af('0x37')]=qs['filters'](_['pick'](_0x466294[_0xa9af('0x2b')],_0x31d39d[_0xa9af('0x2d')]),_0x175cc2);if(_0x466294['query'][_0xa9af('0x38')]){_0x3ab062[_0xa9af('0x37')]=_['merge'](_0x3ab062['where'],{'$or':_[_0xa9af('0x25')](_0x175cc2,function(_0x1e5d2f){if(_0x1e5d2f['type']!=='VIRTUAL'){var _0x36e0ed={};_0x36e0ed[_0x1e5d2f[_0xa9af('0x24')]]={'$like':'%'+_0x466294[_0xa9af('0x2b')][_0xa9af('0x38')]+'%'};return _0x36e0ed;}})});}_0x3ab062=_[_0xa9af('0x39')]({},_0x3ab062,_0x466294[_0xa9af('0x3a')]);var _0x25611d={'where':_0x3ab062[_0xa9af('0x37')]};return db[_0xa9af('0x3b')][_0xa9af('0x1c')](_0x25611d)[_0xa9af('0x20')](function(_0xacf9d){_0x4a8840['count']=_0xacf9d;if(_0x466294[_0xa9af('0x2b')][_0xa9af('0x3c')]){_0x3ab062[_0xa9af('0x3d')]=[{'all':!![]}];}return db[_0xa9af('0x3b')][_0xa9af('0x3e')](_0x3ab062);})[_0xa9af('0x20')](function(_0x2b637f){_0x4a8840[_0xa9af('0x3f')]=_0x2b637f;return _0x4a8840;})[_0xa9af('0x20')](respondWithFilteredResult(_0x8ff53,_0x3ab062))[_0xa9af('0x40')](handleError(_0x8ff53,null));};exports['show']=function(_0x133118,_0x2db7cb){var _0x26b8a2={'raw':!![],'where':{'id':_0x133118[_0xa9af('0x41')]['id']}},_0x11b2ed={};_0x11b2ed['model']=_[_0xa9af('0x2c')](db[_0xa9af('0x3b')]['rawAttributes']);_0x11b2ed[_0xa9af('0x2b')]=_[_0xa9af('0x2c')](_0x133118[_0xa9af('0x2b')]);_0x11b2ed[_0xa9af('0x2d')]=_['intersection'](_0x11b2ed[_0xa9af('0x2a')],_0x11b2ed[_0xa9af('0x2b')]);_0x26b8a2[_0xa9af('0x2e')]=_['intersection'](_0x11b2ed[_0xa9af('0x2a')],qs[_0xa9af('0x42')](_0x133118[_0xa9af('0x2b')][_0xa9af('0x42')]));_0x26b8a2[_0xa9af('0x2e')]=_0x26b8a2['attributes'][_0xa9af('0x30')]?_0x26b8a2[_0xa9af('0x2e')]:_0x11b2ed[_0xa9af('0x2a')];if(_0x133118['query']['includeAll']){_0x26b8a2[_0xa9af('0x3d')]=[{'all':!![]}];}_0x26b8a2=_['merge']({},_0x26b8a2,_0x133118[_0xa9af('0x3a')]);return db[_0xa9af('0x3b')][_0xa9af('0x43')](_0x26b8a2)[_0xa9af('0x20')](handleEntityNotFound(_0x2db7cb,null))[_0xa9af('0x20')](respondWithResult(_0x2db7cb,null))[_0xa9af('0x40')](handleError(_0x2db7cb,null));};exports[_0xa9af('0x44')]=function(_0xedd5de,_0x48b610,_0x26e776){return db[_0xa9af('0x3b')]['find']({'where':{'id':_0xedd5de[_0xa9af('0x41')]['id']},'attributes':[_0xa9af('0x24'),_0xa9af('0x45'),_0xa9af('0x46')],'raw':!![]})[_0xa9af('0x20')](handleEntityNotFound(_0x48b610,null))[_0xa9af('0x20')](function(_0x1529a0){if(_0x1529a0){if(!fs[_0xa9af('0x47')](path['join'](config[_0xa9af('0x48')],_0xa9af('0x49'),_0x1529a0[_0xa9af('0x45')]+'.'+_0x1529a0[_0xa9af('0x46')]))){throw new db['Sequelize']['ValidationError'](_0xa9af('0x4a'));}return _0x48b610['download'](path[_0xa9af('0x4b')](config[_0xa9af('0x48')],_0xa9af('0x49'),util[_0xa9af('0x4c')](_0xa9af('0x4d'),_0x1529a0[_0xa9af('0x45')],_0x1529a0[_0xa9af('0x46')])),util[_0xa9af('0x4c')](_0xa9af('0x4d'),_0x1529a0[_0xa9af('0x24')],_0x1529a0['converted_format']));}return null;})['catch'](handleError(_0x48b610,null));};exports[_0xa9af('0x4e')]=function(_0x29bb65,_0x457fb5,_0x7b436b){var _0x28c548={'name':path['basename'](_0x29bb65[_0xa9af('0x4f')][_0xa9af('0x50')],path[_0xa9af('0x51')](_0x29bb65[_0xa9af('0x4f')][_0xa9af('0x50')])),'save_name':path[_0xa9af('0x52')](_0x29bb65['file'][_0xa9af('0x53')],path[_0xa9af('0x51')](_0x29bb65[_0xa9af('0x4f')][_0xa9af('0x53')])),'original_format':path['extname'](_0x29bb65[_0xa9af('0x4f')]['originalname'])[_0xa9af('0x54')](0x1),'converted_format':_0xa9af('0x55')};var _0x1288c1=path[_0xa9af('0x4b')](config[_0xa9af('0x48')],'server/files/sounds/original',_0x29bb65[_0xa9af('0x4f')]['filename']);var _0x1977a5=path['join'](config[_0xa9af('0x48')],_0xa9af('0x49'),util[_0xa9af('0x4c')](_0xa9af('0x4d'),path[_0xa9af('0x52')](_0x29bb65[_0xa9af('0x4f')][_0xa9af('0x53')],path[_0xa9af('0x51')](_0x29bb65[_0xa9af('0x4f')][_0xa9af('0x53')])),_0x28c548[_0xa9af('0x46')]));logger[_0xa9af('0x56')]('Sound\x20upload\x20filepath:\x20%s',_0x1288c1);logger[_0xa9af('0x56')]('Sound\x20upload\x20destination:\x20%s',_0x1977a5);try{fs[_0xa9af('0x57')](_0x1288c1,parseInt(_0xa9af('0x58'),0x8));var _0x392a3f=sox[_0xa9af('0x59')](_0x1288c1,_0x1977a5,{'sampleRate':0x1f40,'format':_0xa9af('0x55'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x392a3f['on']('error',function(_0x2077a5){fs[_0xa9af('0x5a')](_0x1288c1);_0x457fb5[_0xa9af('0x1a')](0x1f4)[_0xa9af('0x5b')](_0x2077a5);});_0x392a3f['on'](_0xa9af('0x5c'),function(_0x515ff1){_0x28c548[_0xa9af('0x5d')]=isNaN(_0x515ff1[_0xa9af('0x5e')])?null:_0x515ff1['duration']*0x3e8;_0x28c548[_0xa9af('0x5f')]=isNaN(_0x515ff1[_0xa9af('0x60')])?null:_0x515ff1[_0xa9af('0x60')];_0x28c548['original_channelCount']=isNaN(_0x515ff1[_0xa9af('0x61')])?null:_0x515ff1[_0xa9af('0x61')];_0x28c548[_0xa9af('0x62')]=isNaN(_0x515ff1[_0xa9af('0x63')])?null:_0x515ff1['bitRate'];_0x28c548[_0xa9af('0x64')]=isNaN(_0x515ff1[_0xa9af('0x65')])?null:_0x515ff1[_0xa9af('0x65')];});_0x392a3f['on'](_0xa9af('0x66'),function(_0x1ff607){_0x28c548[_0xa9af('0x67')]=isNaN(_0x1ff607['duration'])?null:_0x1ff607[_0xa9af('0x5e')]*0x3e8;_0x28c548[_0xa9af('0x68')]=isNaN(_0x1ff607[_0xa9af('0x60')])?null:_0x1ff607[_0xa9af('0x60')];_0x28c548['converted_channelCount']=isNaN(_0x1ff607[_0xa9af('0x61')])?null:_0x1ff607['channelCount'];_0x28c548[_0xa9af('0x69')]=isNaN(_0x1ff607[_0xa9af('0x63')])?null:_0x1ff607[_0xa9af('0x63')];_0x28c548['converted_sampleRate']=isNaN(_0x1ff607[_0xa9af('0x65')])?null:_0x1ff607['sampleRate'];});_0x392a3f['on'](_0xa9af('0x22'),function(){fs['chmodSync'](_0x1977a5,parseInt('0777',0x8));return db[_0xa9af('0x3b')][_0xa9af('0x4e')](_0x28c548)[_0xa9af('0x20')](function(_0x3418c3){var _0x41ac1e={'role':_0x29bb65[_0xa9af('0x6a')][_0xa9af('0x6b')],'userProfileId':_0x29bb65['body']['userProfileId']};if(!_0x41ac1e)throw new Error(_0xa9af('0x6c'));if(_0x41ac1e[_0xa9af('0x6b')]===_0xa9af('0x6d')){var _0x6a38ea=_0x3418c3[_0xa9af('0x6e')]({'plain':!![]});return db['UserProfileSection'][_0xa9af('0x43')]({'where':{'name':_0xa9af('0x6f'),'userProfileId':_0x41ac1e[_0xa9af('0x70')]},'raw':!![]})[_0xa9af('0x20')](function(_0xf772dc){if(_0xf772dc&&_0xf772dc[_0xa9af('0x71')]===0x0){return db[_0xa9af('0x72')][_0xa9af('0x4e')]({'name':_0x6a38ea['name'],'resourceId':_0x6a38ea['id'],'type':_0xf772dc[_0xa9af('0x24')],'sectionId':_0xf772dc['id']},{})[_0xa9af('0x20')](function(){return _0x3418c3;});}else{return _0x3418c3;}})['catch'](function(_0x391101){logger['error'](_0xa9af('0x73'),_0x391101);throw _0x391101;});}return _0x3418c3;})['then'](respondWithResult(_0x457fb5,null))[_0xa9af('0x40')](handleError(_0x457fb5,null));});_0x392a3f[_0xa9af('0x74')]();}catch(_0x162873){_0x457fb5[_0xa9af('0x1a')](0x1f4)[_0xa9af('0x5b')](_0x162873);}};exports[_0xa9af('0x1f')]=function(_0x51929c,_0x5d01a7,_0x2b6a99){return db[_0xa9af('0x3b')]['find']({'where':{'id':_0x51929c[_0xa9af('0x41')]['id']}})['then'](handleEntityNotFound(_0x5d01a7,null))[_0xa9af('0x20')](saveUpdates(_[_0xa9af('0x75')](_0x51929c[_0xa9af('0x6a')],[_0xa9af('0x24'),_0xa9af('0x76')]),null))['then'](respondWithResult(_0x5d01a7,null))[_0xa9af('0x40')](handleError(_0x5d01a7,null));};exports[_0xa9af('0x77')]=function(_0x1dfc9f,_0x49ec43,_0x137beb){return db['Sound'][_0xa9af('0x43')]({'where':{'id':_0x1dfc9f[_0xa9af('0x41')]['id']}})[_0xa9af('0x20')](function(_0x1ece6a){if(_0x1ece6a){return _0x1ece6a[_0xa9af('0x21')]();}})[_0xa9af('0x20')](function(_0x2f0864){var _0x20d4d8=path[_0xa9af('0x4b')](config[_0xa9af('0x48')],_0xa9af('0x78'),util[_0xa9af('0x4c')](_0xa9af('0x4d'),_0x2f0864[_0xa9af('0x45')],_0x2f0864[_0xa9af('0x79')]));var _0x46a85f=path['join'](config[_0xa9af('0x48')],_0xa9af('0x49'),util[_0xa9af('0x4c')](_0xa9af('0x4d'),_0x2f0864['save_name'],_0x2f0864['converted_format']));fs[_0xa9af('0x5a')](_0x20d4d8);fs[_0xa9af('0x5a')](_0x46a85f);return _0x2f0864;})[_0xa9af('0x20')](function(_0x210be1){if(_0x210be1){return _0x49ec43[_0xa9af('0x1a')](0xcc)[_0xa9af('0x22')]();}})['then'](handleEntityNotFound(_0x49ec43,null))[_0xa9af('0x40')](handleError(_0x49ec43,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 1027bcf..52a113b 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 _0x940e=['moment','bluebird','path','rimraf','../../config/environment','./sound.attributes','define','Sound','lodash','util','../../config/logger'];(function(_0xd746ed,_0x81920c){var _0x5ef2a6=function(_0x3ec97a){while(--_0x3ec97a){_0xd746ed['push'](_0xd746ed['shift']());}};_0x5ef2a6(++_0x81920c);}(_0x940e,0x13c));var _0xe940=function(_0x644560,_0x1783aa){_0x644560=_0x644560-0x0;var _0x41b76b=_0x940e[_0x644560];return _0x41b76b;};'use strict';var _=require(_0xe940('0x0'));var util=require(_0xe940('0x1'));var logger=require(_0xe940('0x2'))('api');var moment=require(_0xe940('0x3'));var BPromise=require(_0xe940('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe940('0x5'));var rimraf=require(_0xe940('0x6'));var config=require(_0xe940('0x7'));var attributes=require(_0xe940('0x8'));module['exports']=function(_0x193661,_0x49b7f2){return _0x193661[_0xe940('0x9')](_0xe940('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91ef=['./sound.attributes','exports','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x514bd1,_0x25ea3e){var _0x58a281=function(_0x25567a){while(--_0x25567a){_0x514bd1['push'](_0x514bd1['shift']());}};_0x58a281(++_0x25ea3e);}(_0x91ef,0xad));var _0xf91e=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x91ef[_0x504df1];return _0x1063b5;};'use strict';var _=require(_0xf91e('0x0'));var util=require(_0xf91e('0x1'));var logger=require(_0xf91e('0x2'))(_0xf91e('0x3'));var moment=require(_0xf91e('0x4'));var BPromise=require('bluebird');var rp=require(_0xf91e('0x5'));var fs=require('fs');var path=require(_0xf91e('0x6'));var rimraf=require(_0xf91e('0x7'));var config=require(_0xf91e('0x8'));var attributes=require(_0xf91e('0x9'));module[_0xf91e('0xa')]=function(_0x45a588,_0x234e3d){return _0x45a588['define'](_0xf91e('0xb'),attributes,{'tableName':_0xf91e('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 db69a62..c3e74e9 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 _0x3fa0=['http','then','info','debug','request\x20sent','stringify','error','code','Sound,\x20%s,\x20%s','message','catch','Sound','find','options','where','attributes','include','map','model','ShowSound','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x254f9f,_0x5e15f1){var _0x3ecae5=function(_0x1450e5){while(--_0x1450e5){_0x254f9f['push'](_0x254f9f['shift']());}};_0x3ecae5(++_0x5e15f1);}(_0x3fa0,0x1e4));var _0x03fa=function(_0x2b3c1e,_0x5b0e75){_0x2b3c1e=_0x2b3c1e-0x0;var _0x3d333b=_0x3fa0[_0x2b3c1e];return _0x3d333b;};'use strict';var _=require('lodash');var util=require(_0x03fa('0x0'));var moment=require(_0x03fa('0x1'));var BPromise=require(_0x03fa('0x2'));var rs=require(_0x03fa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x03fa('0x4'))['db'];var utils=require(_0x03fa('0x5'));var logger=require(_0x03fa('0x6'))(_0x03fa('0x7'));var config=require(_0x03fa('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x03fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7288d0,_0x51c25b,_0x1077be){return new BPromise(function(_0x1df5c4,_0x5021c2){return client['request'](_0x7288d0,_0x1077be)[_0x03fa('0xa')](function(_0x354775){logger[_0x03fa('0xb')]('Sound,\x20%s,\x20%s',_0x51c25b,'request\x20sent');logger[_0x03fa('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x51c25b,_0x03fa('0xd'),JSON[_0x03fa('0xe')](_0x354775));if(_0x354775[_0x03fa('0xf')]){if(_0x354775[_0x03fa('0xf')][_0x03fa('0x10')]===0x1f4){logger[_0x03fa('0xf')](_0x03fa('0x11'),_0x51c25b,_0x354775[_0x03fa('0xf')][_0x03fa('0x12')]);return _0x5021c2(_0x354775[_0x03fa('0xf')][_0x03fa('0x12')]);}logger['error'](_0x03fa('0x11'),_0x51c25b,_0x354775[_0x03fa('0xf')]['message']);return _0x1df5c4(_0x354775[_0x03fa('0xf')][_0x03fa('0x12')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x51c25b,_0x03fa('0xd'));_0x1df5c4(_0x354775['result'][_0x03fa('0x12')]);}})[_0x03fa('0x13')](function(_0x58b20b){logger[_0x03fa('0xf')]('Sound,\x20%s,\x20%s',_0x51c25b,_0x58b20b);_0x5021c2(_0x58b20b);});});}exports['ShowSound']=function(_0x1b6d99){var _0x322e7e=this;return new Promise(function(_0x47e83c,_0x2db578){return db[_0x03fa('0x14')][_0x03fa('0x15')]({'raw':_0x1b6d99[_0x03fa('0x16')]?_0x1b6d99[_0x03fa('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1b6d99[_0x03fa('0x16')]?_0x1b6d99[_0x03fa('0x16')][_0x03fa('0x17')]||null:null,'attributes':_0x1b6d99[_0x03fa('0x16')]?_0x1b6d99[_0x03fa('0x16')][_0x03fa('0x18')]||null:null,'include':_0x1b6d99[_0x03fa('0x16')]?_0x1b6d99[_0x03fa('0x16')][_0x03fa('0x19')]?_[_0x03fa('0x1a')](_0x1b6d99[_0x03fa('0x16')][_0x03fa('0x19')],function(_0x1987b3){return{'model':db[_0x1987b3['model']],'as':_0x1987b3['as'],'attributes':_0x1987b3[_0x03fa('0x18')],'include':_0x1987b3[_0x03fa('0x19')]?_[_0x03fa('0x1a')](_0x1987b3[_0x03fa('0x19')],function(_0x32e362){return{'model':db[_0x32e362['model']],'as':_0x32e362['as'],'attributes':_0x32e362[_0x03fa('0x18')],'include':_0x32e362[_0x03fa('0x19')]?_[_0x03fa('0x1a')](_0x32e362['include'],function(_0xd511e1){return{'model':db[_0xd511e1[_0x03fa('0x1b')]],'as':_0xd511e1['as'],'attributes':_0xd511e1[_0x03fa('0x18')]};}):[]};}):[]};}):[]:[]})[_0x03fa('0xa')](function(_0x5bf18c){logger['info'](_0x03fa('0x1c'),_0x1b6d99);logger[_0x03fa('0xc')](_0x03fa('0x1c'),_0x1b6d99,JSON[_0x03fa('0xe')](_0x5bf18c));_0x47e83c(_0x5bf18c);})[_0x03fa('0x13')](function(_0x930a6e){logger[_0x03fa('0xf')](_0x03fa('0x1c'),_0x930a6e[_0x03fa('0x12')],_0x1b6d99);_0x2db578(_0x322e7e[_0x03fa('0xf')](0x1f4,_0x930a6e[_0x03fa('0x12')]));});});}; \ No newline at end of file +var _0x85aa=['Sound,\x20%s,\x20%s,\x20%s','error','code','Sound,\x20%s,\x20%s','message','result','Sound','find','options','raw','where','attributes','include','map','model','ShowSound','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug'];(function(_0x379339,_0x1d10d9){var _0x3c59f7=function(_0x50298b){while(--_0x50298b){_0x379339['push'](_0x379339['shift']());}};_0x3c59f7(++_0x1d10d9);}(_0x85aa,0x1a4));var _0xa85a=function(_0x58a110,_0x3ded47){_0x58a110=_0x58a110-0x0;var _0x17e6a3=_0x85aa[_0x58a110];return _0x17e6a3;};'use strict';var _=require('lodash');var util=require(_0xa85a('0x0'));var moment=require(_0xa85a('0x1'));var BPromise=require(_0xa85a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa85a('0x3'))['db'];var utils=require(_0xa85a('0x4'));var logger=require(_0xa85a('0x5'))(_0xa85a('0x6'));var config=require(_0xa85a('0x7'));var jayson=require(_0xa85a('0x8'));var client=jayson[_0xa85a('0x9')][_0xa85a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c9fb2,_0x246eb5,_0x404a48){return new BPromise(function(_0x3582f4,_0x1fac53){return client['request'](_0x2c9fb2,_0x404a48)[_0xa85a('0xb')](function(_0x149e79){logger['info']('Sound,\x20%s,\x20%s',_0x246eb5,_0xa85a('0xc'));logger[_0xa85a('0xd')](_0xa85a('0xe'),_0x246eb5,_0xa85a('0xc'),JSON['stringify'](_0x149e79));if(_0x149e79[_0xa85a('0xf')]){if(_0x149e79[_0xa85a('0xf')][_0xa85a('0x10')]===0x1f4){logger[_0xa85a('0xf')](_0xa85a('0x11'),_0x246eb5,_0x149e79[_0xa85a('0xf')]['message']);return _0x1fac53(_0x149e79[_0xa85a('0xf')][_0xa85a('0x12')]);}logger['error']('Sound,\x20%s,\x20%s',_0x246eb5,_0x149e79[_0xa85a('0xf')]['message']);return _0x3582f4(_0x149e79[_0xa85a('0xf')][_0xa85a('0x12')]);}else{logger['info'](_0xa85a('0x11'),_0x246eb5,_0xa85a('0xc'));_0x3582f4(_0x149e79[_0xa85a('0x13')][_0xa85a('0x12')]);}})['catch'](function(_0x13d1ec){logger['error'](_0xa85a('0x11'),_0x246eb5,_0x13d1ec);_0x1fac53(_0x13d1ec);});});}exports['ShowSound']=function(_0x7a3f13){var _0x2385d4=this;return new Promise(function(_0x27a311,_0x223414){return db[_0xa85a('0x14')][_0xa85a('0x15')]({'raw':_0x7a3f13['options']?_0x7a3f13[_0xa85a('0x16')][_0xa85a('0x17')]===undefined?!![]:![]:!![],'where':_0x7a3f13[_0xa85a('0x16')]?_0x7a3f13[_0xa85a('0x16')][_0xa85a('0x18')]||null:null,'attributes':_0x7a3f13[_0xa85a('0x16')]?_0x7a3f13[_0xa85a('0x16')][_0xa85a('0x19')]||null:null,'include':_0x7a3f13[_0xa85a('0x16')]?_0x7a3f13[_0xa85a('0x16')][_0xa85a('0x1a')]?_[_0xa85a('0x1b')](_0x7a3f13[_0xa85a('0x16')][_0xa85a('0x1a')],function(_0x5a97c6){return{'model':db[_0x5a97c6[_0xa85a('0x1c')]],'as':_0x5a97c6['as'],'attributes':_0x5a97c6[_0xa85a('0x19')],'include':_0x5a97c6[_0xa85a('0x1a')]?_[_0xa85a('0x1b')](_0x5a97c6[_0xa85a('0x1a')],function(_0x5d28e2){return{'model':db[_0x5d28e2[_0xa85a('0x1c')]],'as':_0x5d28e2['as'],'attributes':_0x5d28e2[_0xa85a('0x19')],'include':_0x5d28e2[_0xa85a('0x1a')]?_[_0xa85a('0x1b')](_0x5d28e2[_0xa85a('0x1a')],function(_0x26d40b){return{'model':db[_0x26d40b['model']],'as':_0x26d40b['as'],'attributes':_0x26d40b[_0xa85a('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa85a('0xb')](function(_0x443ad2){logger['info'](_0xa85a('0x1d'),_0x7a3f13);logger['debug'](_0xa85a('0x1d'),_0x7a3f13,JSON['stringify'](_0x443ad2));_0x27a311(_0x443ad2);})[_0xa85a('0x1e')](function(_0x1566ed){logger[_0xa85a('0xf')]('ShowSound',_0x1566ed[_0xa85a('0x12')],_0x7a3f13);_0x223414(_0x2385d4[_0xa85a('0xf')](0x1f4,_0x1566ed[_0xa85a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index d8fa714..74dc5db 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 _0x97ae=['get','post','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x97ae,0x107));var _0xe97a=function(_0x34234f,_0x44eb50){_0x34234f=_0x34234f-0x0;var _0x53d217=_0x97ae[_0x34234f];return _0x53d217;};'use strict';var multer=require(_0xe97a('0x0'));var util=require(_0xe97a('0x1'));var path=require('path');var timeout=require(_0xe97a('0x2'));var express=require(_0xe97a('0x3'));var router=express['Router']();var auth=require(_0xe97a('0x4'));var interaction=require(_0xe97a('0x5'));var config=require(_0xe97a('0x6'));var controller=require('./squareMessage.controller');router['get']('/',auth[_0xe97a('0x7')](),controller[_0xe97a('0x8')]);router[_0xe97a('0x9')]('/:id',auth[_0xe97a('0x7')](),controller['show']);router[_0xe97a('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe97a('0xb')](_0xe97a('0xc'),auth[_0xe97a('0x7')](),controller[_0xe97a('0xd')]);router[_0xe97a('0xe')](_0xe97a('0xc'),auth[_0xe97a('0x7')](),controller[_0xe97a('0xf')]);module['exports']=router; \ No newline at end of file +var _0x3e7c=['/:id','isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./squareMessage.controller','get'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x3e7c,0xd7));var _0xc3e7=function(_0x38b3fa,_0x5cd964){_0x38b3fa=_0x38b3fa-0x0;var _0x3a3e6c=_0x3e7c[_0x38b3fa];return _0x3a3e6c;};'use strict';var multer=require(_0xc3e7('0x0'));var util=require(_0xc3e7('0x1'));var path=require(_0xc3e7('0x2'));var timeout=require(_0xc3e7('0x3'));var express=require(_0xc3e7('0x4'));var router=express['Router']();var auth=require(_0xc3e7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc3e7('0x6'));var controller=require(_0xc3e7('0x7'));router[_0xc3e7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc3e7('0x8')](_0xc3e7('0x9'),auth[_0xc3e7('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xc3e7('0xb')]);router[_0xc3e7('0xc')](_0xc3e7('0x9'),auth[_0xc3e7('0xa')](),controller[_0xc3e7('0xd')]);router[_0xc3e7('0xe')]('/:id',auth[_0xc3e7('0xa')](),controller[_0xc3e7('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 72c9856..e64cb87 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 _0xb712=['medium','ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x5630f3,_0x40cbdb){var _0x3e6446=function(_0x43748a){while(--_0x43748a){_0x5630f3['push'](_0x5630f3['shift']());}};_0x3e6446(++_0x40cbdb);}(_0xb712,0x176));var _0x2b71=function(_0x54584c,_0x174275){_0x54584c=_0x54584c-0x0;var _0x3360a6=_0xb712[_0x54584c];return _0x3360a6;};'use strict';var Sequelize=require(_0x2b71('0x0'));module[_0x2b71('0x1')]={'uniqueid':{'type':Sequelize[_0x2b71('0x2')]},'body':{'type':Sequelize[_0x2b71('0x3')](_0x2b71('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x2b71('0x5')]('in',_0x2b71('0x6')),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file +var _0xe25a=['medium','ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x19f9c2,_0x21e3b7){var _0x18d844=function(_0x188c18){while(--_0x188c18){_0x19f9c2['push'](_0x19f9c2['shift']());}};_0x18d844(++_0x21e3b7);}(_0xe25a,0xe3));var _0xae25=function(_0x530eaf,_0x1c4804){_0x530eaf=_0x530eaf-0x0;var _0x265278=_0xe25a[_0x530eaf];return _0x265278;};'use strict';var Sequelize=require(_0xae25('0x0'));module[_0xae25('0x1')]={'uniqueid':{'type':Sequelize[_0xae25('0x2')]},'body':{'type':Sequelize[_0xae25('0x3')](_0xae25('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xae25('0x5')]('in',_0xae25('0x6')),'defaultValue':_0xae25('0x6'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 5942a41..2e4e0cd 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 _0x48a4=['where','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','set','apply','reject','save','destroy','then','error','stack','name','send','SquareMessage','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','pick'];(function(_0x2e6596,_0x3ea2b4){var _0x2e1a23=function(_0x2f7ef1){while(--_0x2f7ef1){_0x2e6596['push'](_0x2e6596['shift']());}};_0x2e1a23(++_0x3ea2b4);}(_0x48a4,0x12f));var _0x448a=function(_0x5f5bfd,_0x121e9b){_0x5f5bfd=_0x5f5bfd-0x0;var _0x27c9ce=_0x48a4[_0x5f5bfd];return _0x27c9ce;};'use strict';var pdf=require(_0x448a('0x0'));var emlformat=require(_0x448a('0x1'));var rimraf=require(_0x448a('0x2'));var zipdir=require(_0x448a('0x3'));var jsonpatch=require(_0x448a('0x4'));var rp=require(_0x448a('0x5'));var moment=require(_0x448a('0x6'));var BPromise=require(_0x448a('0x7'));var Mustache=require(_0x448a('0x8'));var util=require(_0x448a('0x9'));var path=require(_0x448a('0xa'));var sox=require('sox');var csv=require(_0x448a('0xb'));var ejs=require(_0x448a('0xc'));var fs=require('fs');var _=require(_0x448a('0xd'));var squel=require('squel');var crypto=require(_0x448a('0xe'));var jsforce=require(_0x448a('0xf'));var deskjs=require(_0x448a('0x10'));var toCsv=require(_0x448a('0xb'));var querystring=require(_0x448a('0x11'));var Papa=require(_0x448a('0x12'));var Redis=require(_0x448a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x448a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x448a('0x15'))('api');var utils=require(_0x448a('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ed72f,_0xe43d33){_0xe43d33=_0xe43d33||0xcc;return function(_0x5521cf){if(_0x5521cf){return _0x2ed72f[_0x448a('0x17')](_0xe43d33);}return _0x2ed72f[_0x448a('0x18')](_0xe43d33)[_0x448a('0x19')]();};}function respondWithResult(_0x5f02b1,_0x2b1121){_0x2b1121=_0x2b1121||0xc8;return function(_0x2d99f5){if(_0x2d99f5){return _0x5f02b1[_0x448a('0x18')](_0x2b1121)[_0x448a('0x1a')](_0x2d99f5);}};}function respondWithFilteredResult(_0x4976db,_0x4e8f3f){return function(_0x1d8655){if(_0x1d8655){var _0x25560c=_0x1d8655[_0x448a('0x1b')],_0x293827=_0x4e8f3f[_0x448a('0x1c')],_0x514ab9=_0x4e8f3f['offset']+_0x4e8f3f['limit'],_0x4de834;if(_0x514ab9>=_0x25560c){_0x514ab9=_0x25560c;_0x4de834=0xc8;}else{_0x4de834=0xce;}_0x4976db[_0x448a('0x18')](_0x4de834);return _0x4976db[_0x448a('0x1d')]('Content-Range',_0x293827+'-'+_0x514ab9+'/'+_0x25560c)[_0x448a('0x1a')](_0x1d8655);}return null;};}function patchUpdates(_0x2acd50){return function(_0x4d1b79){try{jsonpatch[_0x448a('0x1e')](_0x4d1b79,_0x2acd50,!![]);}catch(_0x317241){return BPromise[_0x448a('0x1f')](_0x317241);}return _0x4d1b79[_0x448a('0x20')]();};}function saveUpdates(_0x3016c0,_0x1a2c39){return function(_0x278bca){if(_0x278bca){return _0x278bca['update'](_0x3016c0)['then'](function(_0x1d7090){return _0x1d7090;});}return null;};}function removeEntity(_0xc29080,_0x41b889){return function(_0xed2c45){if(_0xed2c45){return _0xed2c45[_0x448a('0x21')]()[_0x448a('0x22')](function(){_0xc29080[_0x448a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x576465,_0x4d6f4f){return function(_0x558eef){if(!_0x558eef){_0x576465[_0x448a('0x17')](0x194);}return _0x558eef;};}function handleError(_0x48f602,_0x580ec0){_0x580ec0=_0x580ec0||0x1f4;return function(_0x1cb0fc){logger[_0x448a('0x23')](_0x1cb0fc[_0x448a('0x24')]);if(_0x1cb0fc[_0x448a('0x25')]){delete _0x1cb0fc['name'];}_0x48f602[_0x448a('0x18')](_0x580ec0)[_0x448a('0x26')](_0x1cb0fc);};}exports['index']=function(_0x8d9d29,_0x5530c7){var _0x5a4b42={},_0x2080a8={},_0x3b6781={'count':0x0,'rows':[]};var _0x2118fc=_['map'](db[_0x448a('0x27')][_0x448a('0x28')],function(_0x4ebc0e){return{'name':_0x4ebc0e['fieldName'],'type':_0x4ebc0e[_0x448a('0x29')][_0x448a('0x2a')]};});_0x2080a8[_0x448a('0x2b')]=_[_0x448a('0x2c')](_0x2118fc,_0x448a('0x25'));_0x2080a8[_0x448a('0x2d')]=_[_0x448a('0x2e')](_0x8d9d29[_0x448a('0x2d')]);_0x2080a8[_0x448a('0x2f')]=_['intersection'](_0x2080a8['model'],_0x2080a8[_0x448a('0x2d')]);_0x5a4b42[_0x448a('0x30')]=_[_0x448a('0x31')](_0x2080a8[_0x448a('0x2b')],qs[_0x448a('0x32')](_0x8d9d29['query'][_0x448a('0x32')]));_0x5a4b42[_0x448a('0x30')]=_0x5a4b42[_0x448a('0x30')][_0x448a('0x33')]?_0x5a4b42[_0x448a('0x30')]:_0x2080a8[_0x448a('0x2b')];if(!_0x8d9d29[_0x448a('0x2d')][_0x448a('0x34')](_0x448a('0x35'))){_0x5a4b42[_0x448a('0x36')]=qs[_0x448a('0x36')](_0x8d9d29[_0x448a('0x2d')][_0x448a('0x36')]);_0x5a4b42[_0x448a('0x1c')]=qs[_0x448a('0x1c')](_0x8d9d29['query'][_0x448a('0x1c')]);}_0x5a4b42['order']=qs['sort'](_0x8d9d29[_0x448a('0x2d')][_0x448a('0x37')]);_0x5a4b42['where']=qs['filters'](_[_0x448a('0x38')](_0x8d9d29['query'],_0x2080a8[_0x448a('0x2f')]),_0x2118fc);if(_0x8d9d29[_0x448a('0x2d')]['filter']){_0x5a4b42[_0x448a('0x39')]=_['merge'](_0x5a4b42[_0x448a('0x39')],{'$or':_[_0x448a('0x2c')](_0x2118fc,function(_0x216cd2){if(_0x216cd2[_0x448a('0x29')]!==_0x448a('0x3a')){var _0xe04199={};_0xe04199[_0x216cd2['name']]={'$like':'%'+_0x8d9d29[_0x448a('0x2d')][_0x448a('0x3b')]+'%'};return _0xe04199;}})});}_0x5a4b42=_['merge']({},_0x5a4b42,_0x8d9d29['options']);var _0x25f5d9={'where':_0x5a4b42['where']};return db[_0x448a('0x27')][_0x448a('0x1b')](_0x25f5d9)[_0x448a('0x22')](function(_0x1130dd){_0x3b6781['count']=_0x1130dd;if(_0x8d9d29['query'][_0x448a('0x3c')]){_0x5a4b42['include']=[{'all':!![]}];}return db[_0x448a('0x27')][_0x448a('0x3d')](_0x5a4b42);})[_0x448a('0x22')](function(_0x13f849){_0x3b6781[_0x448a('0x3e')]=_0x13f849;return _0x3b6781;})['then'](respondWithFilteredResult(_0x5530c7,_0x5a4b42))[_0x448a('0x3f')](handleError(_0x5530c7,null));};exports[_0x448a('0x40')]=function(_0x3d12ae,_0x2b6984){var _0x5516ac={'raw':!![],'where':{'id':_0x3d12ae[_0x448a('0x41')]['id']}},_0x1a6e81={};_0x1a6e81['model']=_['keys'](db['SquareMessage'][_0x448a('0x28')]);_0x1a6e81[_0x448a('0x2d')]=_[_0x448a('0x2e')](_0x3d12ae[_0x448a('0x2d')]);_0x1a6e81[_0x448a('0x2f')]=_[_0x448a('0x31')](_0x1a6e81[_0x448a('0x2b')],_0x1a6e81[_0x448a('0x2d')]);_0x5516ac[_0x448a('0x30')]=_[_0x448a('0x31')](_0x1a6e81[_0x448a('0x2b')],qs[_0x448a('0x32')](_0x3d12ae[_0x448a('0x2d')][_0x448a('0x32')]));_0x5516ac[_0x448a('0x30')]=_0x5516ac['attributes'][_0x448a('0x33')]?_0x5516ac[_0x448a('0x30')]:_0x1a6e81[_0x448a('0x2b')];if(_0x3d12ae[_0x448a('0x2d')][_0x448a('0x3c')]){_0x5516ac[_0x448a('0x42')]=[{'all':!![]}];}_0x5516ac=_[_0x448a('0x43')]({},_0x5516ac,_0x3d12ae['options']);return db[_0x448a('0x27')][_0x448a('0x44')](_0x5516ac)['then'](handleEntityNotFound(_0x2b6984,null))[_0x448a('0x22')](respondWithResult(_0x2b6984,null))[_0x448a('0x3f')](handleError(_0x2b6984,null));};exports['create']=function(_0x487da1,_0x3ef615){return db['SquareMessage'][_0x448a('0x45')](_0x487da1[_0x448a('0x46')],{})[_0x448a('0x22')](respondWithResult(_0x3ef615,0xc9))[_0x448a('0x3f')](handleError(_0x3ef615,null));};exports[_0x448a('0x47')]=function(_0x2ae36f,_0x49678d){if(_0x2ae36f[_0x448a('0x46')]['id']){delete _0x2ae36f[_0x448a('0x46')]['id'];}return db[_0x448a('0x27')][_0x448a('0x44')]({'where':{'id':_0x2ae36f[_0x448a('0x41')]['id']}})[_0x448a('0x22')](handleEntityNotFound(_0x49678d,null))[_0x448a('0x22')](saveUpdates(_0x2ae36f['body'],null))[_0x448a('0x22')](respondWithResult(_0x49678d,null))[_0x448a('0x3f')](handleError(_0x49678d,null));};exports['destroy']=function(_0x19191d,_0x47c744){return db[_0x448a('0x27')][_0x448a('0x44')]({'where':{'id':_0x19191d[_0x448a('0x41')]['id']}})['then'](handleEntityNotFound(_0x47c744,null))[_0x448a('0x22')](removeEntity(_0x47c744,null))[_0x448a('0x3f')](handleError(_0x47c744,null));}; \ No newline at end of file +var _0x48a2=['options','includeAll','findAll','rows','params','include','find','create','body','catch','update','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge'];(function(_0x4e699b,_0xe01ae){var _0x142235=function(_0x5abe5e){while(--_0x5abe5e){_0x4e699b['push'](_0x4e699b['shift']());}};_0x142235(++_0xe01ae);}(_0x48a2,0x9d));var _0x248a=function(_0x3a0633,_0x120c59){_0x3a0633=_0x3a0633-0x0;var _0x58341e=_0x48a2[_0x3a0633];return _0x58341e;};'use strict';var pdf=require(_0x248a('0x0'));var emlformat=require(_0x248a('0x1'));var rimraf=require(_0x248a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x248a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x248a('0x4'));var Mustache=require(_0x248a('0x5'));var util=require('util');var path=require(_0x248a('0x6'));var sox=require('sox');var csv=require(_0x248a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x248a('0x8'));var squel=require(_0x248a('0x9'));var crypto=require('crypto');var jsforce=require(_0x248a('0xa'));var deskjs=require(_0x248a('0xb'));var toCsv=require(_0x248a('0x7'));var querystring=require(_0x248a('0xc'));var Papa=require(_0x248a('0xd'));var Redis=require(_0x248a('0xe'));var authService=require(_0x248a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x248a('0x10'));var hardwareService=require(_0x248a('0x11'));var logger=require(_0x248a('0x12'))(_0x248a('0x13'));var utils=require('../../config/utils');var config=require(_0x248a('0x14'));var db=require(_0x248a('0x15'))['db'];function respondWithStatusCode(_0xdffb2f,_0x21e482){_0x21e482=_0x21e482||0xcc;return function(_0x229694){if(_0x229694){return _0xdffb2f[_0x248a('0x16')](_0x21e482);}return _0xdffb2f[_0x248a('0x17')](_0x21e482)['end']();};}function respondWithResult(_0x2ce936,_0x17b1e6){_0x17b1e6=_0x17b1e6||0xc8;return function(_0x564e36){if(_0x564e36){return _0x2ce936['status'](_0x17b1e6)[_0x248a('0x18')](_0x564e36);}};}function respondWithFilteredResult(_0x4cdef9,_0x5c69bb){return function(_0xf88b43){if(_0xf88b43){var _0x26b391=_0xf88b43[_0x248a('0x19')],_0x1e9046=_0x5c69bb[_0x248a('0x1a')],_0x143d0f=_0x5c69bb[_0x248a('0x1a')]+_0x5c69bb['limit'],_0x16b038;if(_0x143d0f>=_0x26b391){_0x143d0f=_0x26b391;_0x16b038=0xc8;}else{_0x16b038=0xce;}_0x4cdef9[_0x248a('0x17')](_0x16b038);return _0x4cdef9['set'](_0x248a('0x1b'),_0x1e9046+'-'+_0x143d0f+'/'+_0x26b391)['json'](_0xf88b43);}return null;};}function patchUpdates(_0x26e4a6){return function(_0x180b6f){try{jsonpatch[_0x248a('0x1c')](_0x180b6f,_0x26e4a6,!![]);}catch(_0xc3d73d){return BPromise[_0x248a('0x1d')](_0xc3d73d);}return _0x180b6f[_0x248a('0x1e')]();};}function saveUpdates(_0x213eeb,_0x587622){return function(_0x62729c){if(_0x62729c){return _0x62729c['update'](_0x213eeb)[_0x248a('0x1f')](function(_0x1c135a){return _0x1c135a;});}return null;};}function removeEntity(_0x3f5038,_0x3eb56f){return function(_0x2a8b8a){if(_0x2a8b8a){return _0x2a8b8a[_0x248a('0x20')]()['then'](function(){_0x3f5038['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49749e,_0x24062e){return function(_0x4904e9){if(!_0x4904e9){_0x49749e[_0x248a('0x16')](0x194);}return _0x4904e9;};}function handleError(_0x4de000,_0x42ff3f){_0x42ff3f=_0x42ff3f||0x1f4;return function(_0x3080f0){logger[_0x248a('0x21')](_0x3080f0[_0x248a('0x22')]);if(_0x3080f0[_0x248a('0x23')]){delete _0x3080f0[_0x248a('0x23')];}_0x4de000['status'](_0x42ff3f)[_0x248a('0x24')](_0x3080f0);};}exports[_0x248a('0x25')]=function(_0x1627d3,_0x2c6e7e){var _0x1ee10b={},_0xc7d940={},_0x3f3f13={'count':0x0,'rows':[]};var _0x439136=_[_0x248a('0x26')](db[_0x248a('0x27')][_0x248a('0x28')],function(_0x25097d){return{'name':_0x25097d[_0x248a('0x29')],'type':_0x25097d[_0x248a('0x2a')][_0x248a('0x2b')]};});_0xc7d940[_0x248a('0x2c')]=_[_0x248a('0x26')](_0x439136,_0x248a('0x23'));_0xc7d940['query']=_[_0x248a('0x2d')](_0x1627d3[_0x248a('0x2e')]);_0xc7d940[_0x248a('0x2f')]=_[_0x248a('0x30')](_0xc7d940[_0x248a('0x2c')],_0xc7d940[_0x248a('0x2e')]);_0x1ee10b['attributes']=_[_0x248a('0x30')](_0xc7d940[_0x248a('0x2c')],qs[_0x248a('0x31')](_0x1627d3[_0x248a('0x2e')][_0x248a('0x31')]));_0x1ee10b[_0x248a('0x32')]=_0x1ee10b[_0x248a('0x32')][_0x248a('0x33')]?_0x1ee10b['attributes']:_0xc7d940[_0x248a('0x2c')];if(!_0x1627d3['query'][_0x248a('0x34')](_0x248a('0x35'))){_0x1ee10b[_0x248a('0x36')]=qs[_0x248a('0x36')](_0x1627d3[_0x248a('0x2e')][_0x248a('0x36')]);_0x1ee10b[_0x248a('0x1a')]=qs[_0x248a('0x1a')](_0x1627d3[_0x248a('0x2e')]['offset']);}_0x1ee10b[_0x248a('0x37')]=qs[_0x248a('0x38')](_0x1627d3[_0x248a('0x2e')]['sort']);_0x1ee10b[_0x248a('0x39')]=qs[_0x248a('0x2f')](_[_0x248a('0x3a')](_0x1627d3[_0x248a('0x2e')],_0xc7d940[_0x248a('0x2f')]),_0x439136);if(_0x1627d3[_0x248a('0x2e')]['filter']){_0x1ee10b[_0x248a('0x39')]=_['merge'](_0x1ee10b[_0x248a('0x39')],{'$or':_[_0x248a('0x26')](_0x439136,function(_0x58d405){if(_0x58d405[_0x248a('0x2a')]!==_0x248a('0x3b')){var _0x30218f={};_0x30218f[_0x58d405['name']]={'$like':'%'+_0x1627d3[_0x248a('0x2e')][_0x248a('0x3c')]+'%'};return _0x30218f;}})});}_0x1ee10b=_[_0x248a('0x3d')]({},_0x1ee10b,_0x1627d3[_0x248a('0x3e')]);var _0x3400d3={'where':_0x1ee10b[_0x248a('0x39')]};return db[_0x248a('0x27')][_0x248a('0x19')](_0x3400d3)[_0x248a('0x1f')](function(_0x22bfda){_0x3f3f13['count']=_0x22bfda;if(_0x1627d3[_0x248a('0x2e')][_0x248a('0x3f')]){_0x1ee10b['include']=[{'all':!![]}];}return db[_0x248a('0x27')][_0x248a('0x40')](_0x1ee10b);})[_0x248a('0x1f')](function(_0x51cc55){_0x3f3f13[_0x248a('0x41')]=_0x51cc55;return _0x3f3f13;})['then'](respondWithFilteredResult(_0x2c6e7e,_0x1ee10b))['catch'](handleError(_0x2c6e7e,null));};exports['show']=function(_0x2297da,_0x542751){var _0x2d788a={'raw':!![],'where':{'id':_0x2297da[_0x248a('0x42')]['id']}},_0x19700d={};_0x19700d['model']=_[_0x248a('0x2d')](db[_0x248a('0x27')]['rawAttributes']);_0x19700d[_0x248a('0x2e')]=_[_0x248a('0x2d')](_0x2297da[_0x248a('0x2e')]);_0x19700d[_0x248a('0x2f')]=_['intersection'](_0x19700d[_0x248a('0x2c')],_0x19700d[_0x248a('0x2e')]);_0x2d788a[_0x248a('0x32')]=_[_0x248a('0x30')](_0x19700d['model'],qs[_0x248a('0x31')](_0x2297da['query'][_0x248a('0x31')]));_0x2d788a[_0x248a('0x32')]=_0x2d788a[_0x248a('0x32')][_0x248a('0x33')]?_0x2d788a[_0x248a('0x32')]:_0x19700d['model'];if(_0x2297da['query'][_0x248a('0x3f')]){_0x2d788a[_0x248a('0x43')]=[{'all':!![]}];}_0x2d788a=_['merge']({},_0x2d788a,_0x2297da[_0x248a('0x3e')]);return db['SquareMessage'][_0x248a('0x44')](_0x2d788a)[_0x248a('0x1f')](handleEntityNotFound(_0x542751,null))['then'](respondWithResult(_0x542751,null))['catch'](handleError(_0x542751,null));};exports['create']=function(_0x3ba545,_0x234b42){return db['SquareMessage'][_0x248a('0x45')](_0x3ba545[_0x248a('0x46')],{})[_0x248a('0x1f')](respondWithResult(_0x234b42,0xc9))[_0x248a('0x47')](handleError(_0x234b42,null));};exports[_0x248a('0x48')]=function(_0x18aa6b,_0x7aa53b){if(_0x18aa6b[_0x248a('0x46')]['id']){delete _0x18aa6b[_0x248a('0x46')]['id'];}return db[_0x248a('0x27')][_0x248a('0x44')]({'where':{'id':_0x18aa6b[_0x248a('0x42')]['id']}})['then'](handleEntityNotFound(_0x7aa53b,null))[_0x248a('0x1f')](saveUpdates(_0x18aa6b['body'],null))['then'](respondWithResult(_0x7aa53b,null))[_0x248a('0x47')](handleError(_0x7aa53b,null));};exports['destroy']=function(_0x4fac99,_0x2b2ea7){return db[_0x248a('0x27')][_0x248a('0x44')]({'where':{'id':_0x4fac99[_0x248a('0x42')]['id']}})[_0x248a('0x1f')](handleEntityNotFound(_0x2b2ea7,null))[_0x248a('0x1f')](removeEntity(_0x2b2ea7,null))[_0x248a('0x47')](handleError(_0x2b2ea7,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index ceb35cc..4f1c5f1 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 _0xc4aa=['bluebird','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc4aa[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util'];(function(_0x2326d8,_0x75fba0){var _0x2cd15d=function(_0x26b2c1){while(--_0x26b2c1){_0x2326d8['push'](_0x2326d8['shift']());}};_0x2cd15d(++_0x75fba0);}(_0x7a54,0x106));var _0x47a5=function(_0x56df43,_0x5bd103){_0x56df43=_0x56df43-0x0;var _0x1b4b74=_0x7a54[_0x56df43];return _0x1b4b74;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 8aeae4e..b3edc06 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 _0x7919=['options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','SquareMessage,\x20%s,\x20%s','result','catch','CreateSquareMessage','create','body'];(function(_0x596f35,_0x45396c){var _0xa6fe77=function(_0x10c841){while(--_0x10c841){_0x596f35['push'](_0x596f35['shift']());}};_0xa6fe77(++_0x45396c);}(_0x7919,0xeb));var _0x9791=function(_0x4a0d07,_0x4b198a){_0x4a0d07=_0x4a0d07-0x0;var _0xfbce68=_0x7919[_0x4a0d07];return _0xfbce68;};'use strict';var _=require(_0x9791('0x0'));var util=require(_0x9791('0x1'));var moment=require(_0x9791('0x2'));var BPromise=require(_0x9791('0x3'));var rs=require(_0x9791('0x4'));var fs=require('fs');var Redis=require(_0x9791('0x5'));var db=require(_0x9791('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9791('0x7'))(_0x9791('0x8'));var config=require('../../config/environment');var jayson=require(_0x9791('0x9'));var client=jayson[_0x9791('0xa')][_0x9791('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1214fc,_0x565661,_0x4afec7){return new BPromise(function(_0x222ab5,_0x50088f){return client[_0x9791('0xc')](_0x1214fc,_0x4afec7)['then'](function(_0x48297e){logger[_0x9791('0xd')]('SquareMessage,\x20%s,\x20%s',_0x565661,_0x9791('0xe'));logger[_0x9791('0xf')](_0x9791('0x10'),_0x565661,_0x9791('0xe'),JSON[_0x9791('0x11')](_0x48297e));if(_0x48297e[_0x9791('0x12')]){if(_0x48297e[_0x9791('0x12')]['code']===0x1f4){logger[_0x9791('0x12')]('SquareMessage,\x20%s,\x20%s',_0x565661,_0x48297e[_0x9791('0x12')][_0x9791('0x13')]);return _0x50088f(_0x48297e['error'][_0x9791('0x13')]);}logger['error'](_0x9791('0x14'),_0x565661,_0x48297e[_0x9791('0x12')][_0x9791('0x13')]);return _0x222ab5(_0x48297e[_0x9791('0x12')][_0x9791('0x13')]);}else{logger[_0x9791('0xd')](_0x9791('0x14'),_0x565661,_0x9791('0xe'));_0x222ab5(_0x48297e[_0x9791('0x15')][_0x9791('0x13')]);}})[_0x9791('0x16')](function(_0xfc61ae){logger[_0x9791('0x12')]('SquareMessage,\x20%s,\x20%s',_0x565661,_0xfc61ae);_0x50088f(_0xfc61ae);});});}exports[_0x9791('0x17')]=function(_0x402c83){var _0x22b6fb=this;return new Promise(function(_0x2962ae,_0x526b66){return db['SquareMessage'][_0x9791('0x18')](_0x402c83[_0x9791('0x19')],{'raw':_0x402c83[_0x9791('0x1a')]?_0x402c83[_0x9791('0x1a')][_0x9791('0x1b')]===undefined?!![]:![]:!![]})[_0x9791('0x1c')](function(_0x36e5f7){logger[_0x9791('0xd')](_0x9791('0x17'),_0x402c83);logger[_0x9791('0xf')](_0x9791('0x17'),_0x402c83,JSON['stringify'](_0x36e5f7));_0x2962ae(_0x36e5f7);})[_0x9791('0x16')](function(_0x4ec262){logger['error'](_0x9791('0x17'),_0x4ec262[_0x9791('0x13')],_0x402c83);_0x526b66(_0x22b6fb['error'](0x1f4,_0x4ec262[_0x9791('0x13')]));});});}; \ No newline at end of file +var _0x8c46=['options','raw','debug','stringify','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateSquareMessage','SquareMessage','create','body'];(function(_0x58de16,_0x520cab){var _0x4813c7=function(_0x5273f1){while(--_0x5273f1){_0x58de16['push'](_0x58de16['shift']());}};_0x4813c7(++_0x520cab);}(_0x8c46,0x171));var _0x68c4=function(_0x2f2dba,_0x451d2e){_0x2f2dba=_0x2f2dba-0x0;var _0x27e85e=_0x8c46[_0x2f2dba];return _0x27e85e;};'use strict';var _=require(_0x68c4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x68c4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68c4('0x2'))['db'];var utils=require(_0x68c4('0x3'));var logger=require(_0x68c4('0x4'))(_0x68c4('0x5'));var config=require(_0x68c4('0x6'));var jayson=require(_0x68c4('0x7'));var client=jayson[_0x68c4('0x8')][_0x68c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3da9c3,_0x458a2b,_0x5e57ce){return new BPromise(function(_0x1754d7,_0x1d40a3){return client[_0x68c4('0xa')](_0x3da9c3,_0x5e57ce)['then'](function(_0x356698){logger[_0x68c4('0xb')](_0x68c4('0xc'),_0x458a2b,'request\x20sent');logger['debug'](_0x68c4('0xd'),_0x458a2b,_0x68c4('0xe'),JSON['stringify'](_0x356698));if(_0x356698['error']){if(_0x356698[_0x68c4('0xf')][_0x68c4('0x10')]===0x1f4){logger[_0x68c4('0xf')]('SquareMessage,\x20%s,\x20%s',_0x458a2b,_0x356698[_0x68c4('0xf')][_0x68c4('0x11')]);return _0x1d40a3(_0x356698[_0x68c4('0xf')]['message']);}logger[_0x68c4('0xf')](_0x68c4('0xc'),_0x458a2b,_0x356698[_0x68c4('0xf')]['message']);return _0x1754d7(_0x356698[_0x68c4('0xf')][_0x68c4('0x11')]);}else{logger['info'](_0x68c4('0xc'),_0x458a2b,'request\x20sent');_0x1754d7(_0x356698[_0x68c4('0x12')]['message']);}})['catch'](function(_0xc2ea2f){logger[_0x68c4('0xf')]('SquareMessage,\x20%s,\x20%s',_0x458a2b,_0xc2ea2f);_0x1d40a3(_0xc2ea2f);});});}exports[_0x68c4('0x13')]=function(_0x1d757c){var _0x38ac38=this;return new Promise(function(_0x33c5c5,_0x3a6300){return db[_0x68c4('0x14')][_0x68c4('0x15')](_0x1d757c[_0x68c4('0x16')],{'raw':_0x1d757c[_0x68c4('0x17')]?_0x1d757c[_0x68c4('0x17')][_0x68c4('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x398a71){logger['info']('CreateSquareMessage',_0x1d757c);logger[_0x68c4('0x19')](_0x68c4('0x13'),_0x1d757c,JSON[_0x68c4('0x1a')](_0x398a71));_0x33c5c5(_0x398a71);})[_0x68c4('0x1b')](function(_0x5b8135){logger[_0x68c4('0xf')](_0x68c4('0x13'),_0x5b8135['message'],_0x1d757c);_0x3a6300(_0x38ac38[_0x68c4('0xf')](0x1f4,_0x5b8135[_0x68c4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index bf5b301..0a96c9b 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 _0xb847=['/:id/test','15s','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show'];(function(_0x20b5b7,_0x1d1b36){var _0x184a46=function(_0x5c88cd){while(--_0x5c88cd){_0x20b5b7['push'](_0x20b5b7['shift']());}};_0x184a46(++_0x1d1b36);}(_0xb847,0x168));var _0x7b84=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0xb847[_0x2962d5];return _0x273406;};'use strict';var multer=require(_0x7b84('0x0'));var util=require(_0x7b84('0x1'));var path=require(_0x7b84('0x2'));var timeout=require(_0x7b84('0x3'));var express=require(_0x7b84('0x4'));var router=express[_0x7b84('0x5')]();var auth=require(_0x7b84('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7b84('0x7'));var controller=require(_0x7b84('0x8'));router[_0x7b84('0x9')]('/',auth[_0x7b84('0xa')](),controller[_0x7b84('0xb')]);router['get'](_0x7b84('0xc'),auth[_0x7b84('0xa')](),controller[_0x7b84('0xd')]);router['get'](_0x7b84('0xe'),auth[_0x7b84('0xa')](),timeout(_0x7b84('0xf')),controller['test']);router[_0x7b84('0x10')]('/',auth[_0x7b84('0xa')](),controller[_0x7b84('0x11')]);router[_0x7b84('0x12')](_0x7b84('0xc'),auth[_0x7b84('0xa')](),controller[_0x7b84('0x13')]);router[_0x7b84('0x14')]('/:id',auth[_0x7b84('0xa')](),controller[_0x7b84('0x15')]);module['exports']=router; \ No newline at end of file +var _0xec09=['isAuthenticated','show','/:id/test','15s','post','create','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','index','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xec09,0x172));var _0x9ec0=function(_0x4fa9c4,_0x1b73e){_0x4fa9c4=_0x4fa9c4-0x0;var _0x2a9a56=_0xec09[_0x4fa9c4];return _0x2a9a56;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9ec0('0x0'));var timeout=require(_0x9ec0('0x1'));var express=require(_0x9ec0('0x2'));var router=express[_0x9ec0('0x3')]();var auth=require(_0x9ec0('0x4'));var interaction=require(_0x9ec0('0x5'));var config=require(_0x9ec0('0x6'));var controller=require(_0x9ec0('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9ec0('0x8')]);router[_0x9ec0('0x9')]('/:id',auth[_0x9ec0('0xa')](),controller[_0x9ec0('0xb')]);router[_0x9ec0('0x9')](_0x9ec0('0xc'),auth[_0x9ec0('0xa')](),timeout(_0x9ec0('0xd')),controller['test']);router[_0x9ec0('0xe')]('/',auth[_0x9ec0('0xa')](),controller[_0x9ec0('0xf')]);router['put']('/:id',auth[_0x9ec0('0xa')](),controller['update']);router[_0x9ec0('0x10')]('/:id',auth[_0x9ec0('0xa')](),controller[_0x9ec0('0x11')]);module[_0x9ec0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 5cab67f..b4e0228 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 _0x1c42=['sequelize','exports','STRING'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0x1c42,0xa8));var _0x21c4=function(_0x1272e5,_0x2b3fa2){_0x1272e5=_0x1272e5-0x0;var _0x240255=_0x1c42[_0x1272e5];return _0x240255;};'use strict';var Sequelize=require(_0x21c4('0x0'));module[_0x21c4('0x1')]={'name':{'type':Sequelize[_0x21c4('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x21c4('0x2')]},'description':{'type':Sequelize[_0x21c4('0x2')]}}; \ No newline at end of file +var _0xdf9a=['STRING','name'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xdf9a,0x10d));var _0xadf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf9a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xadf9('0x0'),'allowNull':![]},'dsn':{'type':Sequelize[_0xadf9('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 9a08221..86d5f4b 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 _0xbcc9=['error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','params','test','dsn','odbc','closeSync','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','ODBC'];(function(_0xc0e2c4,_0xa4c81e){var _0x3e378c=function(_0x18bc29){while(--_0x18bc29){_0xc0e2c4['push'](_0xc0e2c4['shift']());}};_0x3e378c(++_0xa4c81e);}(_0xbcc9,0x172));var _0x9bcc=function(_0x19d728,_0x58a500){_0x19d728=_0x19d728-0x0;var _0xc23d6f=_0xbcc9[_0x19d728];return _0xc23d6f;};'use strict';var pdf=require(_0x9bcc('0x0'));var emlformat=require(_0x9bcc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9bcc('0x2'));var jsonpatch=require(_0x9bcc('0x3'));var rp=require('request-promise');var moment=require(_0x9bcc('0x4'));var BPromise=require(_0x9bcc('0x5'));var Mustache=require('mustache');var util=require(_0x9bcc('0x6'));var path=require('path');var sox=require(_0x9bcc('0x7'));var csv=require(_0x9bcc('0x8'));var ejs=require(_0x9bcc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9bcc('0xa'));var crypto=require(_0x9bcc('0xb'));var jsforce=require(_0x9bcc('0xc'));var deskjs=require(_0x9bcc('0xd'));var toCsv=require(_0x9bcc('0x8'));var querystring=require(_0x9bcc('0xe'));var Papa=require('papaparse');var Redis=require(_0x9bcc('0xf'));var authService=require(_0x9bcc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9bcc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9bcc('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11f141,_0x4e0d3a){_0x4e0d3a=_0x4e0d3a||0xcc;return function(_0x889cf5){if(_0x889cf5){return _0x11f141[_0x9bcc('0x13')](_0x4e0d3a);}return _0x11f141[_0x9bcc('0x14')](_0x4e0d3a)[_0x9bcc('0x15')]();};}function respondWithResult(_0x4688e5,_0x1438f9){_0x1438f9=_0x1438f9||0xc8;return function(_0x2d152a){if(_0x2d152a){return _0x4688e5['status'](_0x1438f9)[_0x9bcc('0x16')](_0x2d152a);}};}function respondWithFilteredResult(_0x11ae7c,_0x592b69){return function(_0x5b4474){if(_0x5b4474){var _0x4cef3c=_0x5b4474[_0x9bcc('0x17')],_0xba7573=_0x592b69[_0x9bcc('0x18')],_0x2f550e=_0x592b69['offset']+_0x592b69[_0x9bcc('0x19')],_0x7852eb;if(_0x2f550e>=_0x4cef3c){_0x2f550e=_0x4cef3c;_0x7852eb=0xc8;}else{_0x7852eb=0xce;}_0x11ae7c['status'](_0x7852eb);return _0x11ae7c[_0x9bcc('0x1a')](_0x9bcc('0x1b'),_0xba7573+'-'+_0x2f550e+'/'+_0x4cef3c)[_0x9bcc('0x16')](_0x5b4474);}return null;};}function patchUpdates(_0x3c300a){return function(_0x5f3482){try{jsonpatch[_0x9bcc('0x1c')](_0x5f3482,_0x3c300a,!![]);}catch(_0x43b3cf){return BPromise[_0x9bcc('0x1d')](_0x43b3cf);}return _0x5f3482[_0x9bcc('0x1e')]();};}function saveUpdates(_0x56f2bb,_0x3d3424){return function(_0x7bcece){if(_0x7bcece){return _0x7bcece[_0x9bcc('0x1f')](_0x56f2bb)[_0x9bcc('0x20')](function(_0x4eb0b7){return _0x4eb0b7;});}return null;};}function removeEntity(_0x280dd3,_0x478fd7){return function(_0x2ebb8d){if(_0x2ebb8d){return _0x2ebb8d[_0x9bcc('0x21')]()[_0x9bcc('0x20')](function(){var _0x1cb582=_0x2ebb8d['get']({'plain':!![]});var _0xa2cf48=_0x9bcc('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0xa2cf48,'resourceId':_0x1cb582['id']}})[_0x9bcc('0x20')](function(){return _0x2ebb8d;});})[_0x9bcc('0x20')](function(){_0x280dd3[_0x9bcc('0x14')](0xcc)[_0x9bcc('0x15')]();});}};}function handleEntityNotFound(_0x522da6,_0xdfd6bc){return function(_0x84f611){if(!_0x84f611){_0x522da6[_0x9bcc('0x13')](0x194);}return _0x84f611;};}function handleError(_0x33d48f,_0x2617a7){_0x2617a7=_0x2617a7||0x1f4;return function(_0x2dc3b9){logger[_0x9bcc('0x23')](_0x2dc3b9[_0x9bcc('0x24')]);if(_0x2dc3b9[_0x9bcc('0x25')]){delete _0x2dc3b9[_0x9bcc('0x25')];}_0x33d48f[_0x9bcc('0x14')](_0x2617a7)[_0x9bcc('0x26')](_0x2dc3b9);};}exports[_0x9bcc('0x27')]=function(_0x1bf288,_0x1e104b){var _0x3db4f7={},_0xf0ffe0={},_0x4110a9={'count':0x0,'rows':[]};var _0x42f6af=_[_0x9bcc('0x28')](db[_0x9bcc('0x29')][_0x9bcc('0x2a')],function(_0x988b66){return{'name':_0x988b66[_0x9bcc('0x2b')],'type':_0x988b66[_0x9bcc('0x2c')][_0x9bcc('0x2d')]};});_0xf0ffe0['model']=_['map'](_0x42f6af,'name');_0xf0ffe0[_0x9bcc('0x2e')]=_[_0x9bcc('0x2f')](_0x1bf288['query']);_0xf0ffe0['filters']=_[_0x9bcc('0x30')](_0xf0ffe0[_0x9bcc('0x31')],_0xf0ffe0[_0x9bcc('0x2e')]);_0x3db4f7[_0x9bcc('0x32')]=_['intersection'](_0xf0ffe0['model'],qs[_0x9bcc('0x33')](_0x1bf288['query']['fields']));_0x3db4f7[_0x9bcc('0x32')]=_0x3db4f7['attributes'][_0x9bcc('0x34')]?_0x3db4f7[_0x9bcc('0x32')]:_0xf0ffe0[_0x9bcc('0x31')];if(!_0x1bf288[_0x9bcc('0x2e')][_0x9bcc('0x35')]('nolimit')){_0x3db4f7['limit']=qs[_0x9bcc('0x19')](_0x1bf288[_0x9bcc('0x2e')][_0x9bcc('0x19')]);_0x3db4f7[_0x9bcc('0x18')]=qs[_0x9bcc('0x18')](_0x1bf288['query']['offset']);}_0x3db4f7[_0x9bcc('0x36')]=qs[_0x9bcc('0x37')](_0x1bf288[_0x9bcc('0x2e')]['sort']);_0x3db4f7[_0x9bcc('0x38')]=qs[_0x9bcc('0x39')](_[_0x9bcc('0x3a')](_0x1bf288[_0x9bcc('0x2e')],_0xf0ffe0[_0x9bcc('0x39')]),_0x42f6af);if(_0x1bf288[_0x9bcc('0x2e')]['filter']){_0x3db4f7[_0x9bcc('0x38')]=_[_0x9bcc('0x3b')](_0x3db4f7[_0x9bcc('0x38')],{'$or':_[_0x9bcc('0x28')](_0x42f6af,function(_0x4a1f1a){if(_0x4a1f1a['type']!==_0x9bcc('0x3c')){var _0x521202={};_0x521202[_0x4a1f1a[_0x9bcc('0x25')]]={'$like':'%'+_0x1bf288[_0x9bcc('0x2e')][_0x9bcc('0x3d')]+'%'};return _0x521202;}})});}_0x3db4f7=_['merge']({},_0x3db4f7,_0x1bf288[_0x9bcc('0x3e')]);var _0x2a9345={'where':_0x3db4f7['where']};return db[_0x9bcc('0x29')][_0x9bcc('0x17')](_0x2a9345)[_0x9bcc('0x20')](function(_0x2e1dbc){_0x4110a9[_0x9bcc('0x17')]=_0x2e1dbc;if(_0x1bf288[_0x9bcc('0x2e')][_0x9bcc('0x3f')]){_0x3db4f7[_0x9bcc('0x40')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x3db4f7);})[_0x9bcc('0x20')](function(_0x29968a){_0x4110a9[_0x9bcc('0x41')]=_0x29968a;return _0x4110a9;})[_0x9bcc('0x20')](respondWithFilteredResult(_0x1e104b,_0x3db4f7))[_0x9bcc('0x42')](handleError(_0x1e104b,null));};exports['show']=function(_0x55875d,_0x1070ed){var _0x2f6e27={'raw':!![],'where':{'id':_0x55875d['params']['id']}},_0x13644e={};_0x13644e[_0x9bcc('0x31')]=_[_0x9bcc('0x2f')](db[_0x9bcc('0x29')]['rawAttributes']);_0x13644e[_0x9bcc('0x2e')]=_[_0x9bcc('0x2f')](_0x55875d[_0x9bcc('0x2e')]);_0x13644e[_0x9bcc('0x39')]=_[_0x9bcc('0x30')](_0x13644e['model'],_0x13644e[_0x9bcc('0x2e')]);_0x2f6e27[_0x9bcc('0x32')]=_[_0x9bcc('0x30')](_0x13644e[_0x9bcc('0x31')],qs[_0x9bcc('0x33')](_0x55875d['query'][_0x9bcc('0x33')]));_0x2f6e27[_0x9bcc('0x32')]=_0x2f6e27[_0x9bcc('0x32')][_0x9bcc('0x34')]?_0x2f6e27['attributes']:_0x13644e[_0x9bcc('0x31')];if(_0x55875d[_0x9bcc('0x2e')][_0x9bcc('0x3f')]){_0x2f6e27[_0x9bcc('0x40')]=[{'all':!![]}];}_0x2f6e27=_[_0x9bcc('0x3b')]({},_0x2f6e27,_0x55875d['options']);return db[_0x9bcc('0x29')][_0x9bcc('0x43')](_0x2f6e27)[_0x9bcc('0x20')](handleEntityNotFound(_0x1070ed,null))[_0x9bcc('0x20')](respondWithResult(_0x1070ed,null))[_0x9bcc('0x42')](handleError(_0x1070ed,null));};exports[_0x9bcc('0x44')]=function(_0x2d4aec,_0x239d53){return db[_0x9bcc('0x29')]['create'](_0x2d4aec[_0x9bcc('0x45')],{})[_0x9bcc('0x20')](function(_0x5b3047){var _0x4d0b4e=_0x2d4aec['user']['get']({'plain':!![]});if(!_0x4d0b4e)throw new Error(_0x9bcc('0x46'));if(_0x4d0b4e['role']===_0x9bcc('0x47')){var _0x25e25c=_0x5b3047[_0x9bcc('0x48')]({'plain':!![]});var _0x14b352=_0x9bcc('0x22');return db[_0x9bcc('0x49')][_0x9bcc('0x43')]({'where':{'name':_0x14b352,'userProfileId':_0x4d0b4e[_0x9bcc('0x4a')]},'raw':!![]})[_0x9bcc('0x20')](function(_0xec8f81){if(_0xec8f81&&_0xec8f81[_0x9bcc('0x4b')]===0x0){return db['UserProfileResource'][_0x9bcc('0x44')]({'name':_0x25e25c['name'],'resourceId':_0x25e25c['id'],'type':_0xec8f81[_0x9bcc('0x25')],'sectionId':_0xec8f81['id']},{})[_0x9bcc('0x20')](function(){return _0x5b3047;});}else{return _0x5b3047;}})[_0x9bcc('0x42')](function(_0x22dc6a){logger[_0x9bcc('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22dc6a);throw _0x22dc6a;});}return _0x5b3047;})[_0x9bcc('0x20')](respondWithResult(_0x239d53,0xc9))['catch'](handleError(_0x239d53,null));};exports[_0x9bcc('0x1f')]=function(_0x1523d7,_0x508870){if(_0x1523d7[_0x9bcc('0x45')]['id']){delete _0x1523d7[_0x9bcc('0x45')]['id'];}return db[_0x9bcc('0x29')][_0x9bcc('0x43')]({'where':{'id':_0x1523d7[_0x9bcc('0x4c')]['id']}})[_0x9bcc('0x20')](handleEntityNotFound(_0x508870,null))['then'](saveUpdates(_0x1523d7[_0x9bcc('0x45')],null))[_0x9bcc('0x20')](respondWithResult(_0x508870,null))[_0x9bcc('0x42')](handleError(_0x508870,null));};exports[_0x9bcc('0x21')]=function(_0x1dbc3f,_0x52f4c6){return db['SquareOdbc']['find']({'where':{'id':_0x1dbc3f[_0x9bcc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x52f4c6,null))[_0x9bcc('0x20')](removeEntity(_0x52f4c6,null))['catch'](handleError(_0x52f4c6,null));};exports[_0x9bcc('0x4d')]=function(_0x24b31c,_0x1c5dde,_0x1681ef){var _0x4cd882;return db[_0x9bcc('0x29')][_0x9bcc('0x43')]({'where':{'id':_0x24b31c[_0x9bcc('0x4c')]['id']},'attributes':['id',_0x9bcc('0x4e')]})[_0x9bcc('0x20')](handleEntityNotFound(_0x1c5dde,null))['then'](function(_0x1fe340){if(_0x1fe340){var _0x2bfbaf=require(_0x9bcc('0x4f'))();_0x2bfbaf['openSync'](_0x1fe340[_0x9bcc('0x4e')]);_0x2bfbaf[_0x9bcc('0x50')]();return _0x1fe340;}})[_0x9bcc('0x20')](respondWithResult(_0x1c5dde,null))['catch'](handleError(_0x1c5dde,null));}; \ No newline at end of file +var _0xeb27=['order','sort','where','filters','pick','filter','VIRTUAL','options','SquareOdbc','count','includeAll','include','findAll','rows','show','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','dsn','odbc','openSync','closeSync','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','nolimit'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xeb27,0x1e3));var _0x7eb2=function(_0x36212f,_0x170734){_0x36212f=_0x36212f-0x0;var _0x103882=_0xeb27[_0x36212f];return _0x103882;};'use strict';var pdf=require(_0x7eb2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7eb2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7eb2('0x2'));var rp=require(_0x7eb2('0x3'));var moment=require(_0x7eb2('0x4'));var BPromise=require(_0x7eb2('0x5'));var Mustache=require(_0x7eb2('0x6'));var util=require(_0x7eb2('0x7'));var path=require(_0x7eb2('0x8'));var sox=require('sox');var csv=require(_0x7eb2('0x9'));var ejs=require(_0x7eb2('0xa'));var fs=require('fs');var _=require(_0x7eb2('0xb'));var squel=require(_0x7eb2('0xc'));var crypto=require(_0x7eb2('0xd'));var jsforce=require(_0x7eb2('0xe'));var deskjs=require(_0x7eb2('0xf'));var toCsv=require(_0x7eb2('0x9'));var querystring=require(_0x7eb2('0x10'));var Papa=require(_0x7eb2('0x11'));var Redis=require(_0x7eb2('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7eb2('0x13'));var hardwareService=require(_0x7eb2('0x14'));var logger=require(_0x7eb2('0x15'))('api');var utils=require(_0x7eb2('0x16'));var config=require(_0x7eb2('0x17'));var db=require(_0x7eb2('0x18'))['db'];function respondWithStatusCode(_0x5c9464,_0x224cb6){_0x224cb6=_0x224cb6||0xcc;return function(_0x4adc7e){if(_0x4adc7e){return _0x5c9464[_0x7eb2('0x19')](_0x224cb6);}return _0x5c9464[_0x7eb2('0x1a')](_0x224cb6)[_0x7eb2('0x1b')]();};}function respondWithResult(_0x3c0808,_0x2e9137){_0x2e9137=_0x2e9137||0xc8;return function(_0x56c9cb){if(_0x56c9cb){return _0x3c0808[_0x7eb2('0x1a')](_0x2e9137)['json'](_0x56c9cb);}};}function respondWithFilteredResult(_0x523ca8,_0x12f19d){return function(_0x4d6250){if(_0x4d6250){var _0x494b17=_0x4d6250['count'],_0x56a72f=_0x12f19d[_0x7eb2('0x1c')],_0x59a640=_0x12f19d['offset']+_0x12f19d[_0x7eb2('0x1d')],_0x1d3acf;if(_0x59a640>=_0x494b17){_0x59a640=_0x494b17;_0x1d3acf=0xc8;}else{_0x1d3acf=0xce;}_0x523ca8[_0x7eb2('0x1a')](_0x1d3acf);return _0x523ca8[_0x7eb2('0x1e')](_0x7eb2('0x1f'),_0x56a72f+'-'+_0x59a640+'/'+_0x494b17)['json'](_0x4d6250);}return null;};}function patchUpdates(_0x2cd8e3){return function(_0x13785a){try{jsonpatch[_0x7eb2('0x20')](_0x13785a,_0x2cd8e3,!![]);}catch(_0x496ed5){return BPromise[_0x7eb2('0x21')](_0x496ed5);}return _0x13785a[_0x7eb2('0x22')]();};}function saveUpdates(_0x325d3a,_0x837e46){return function(_0xe1d533){if(_0xe1d533){return _0xe1d533[_0x7eb2('0x23')](_0x325d3a)[_0x7eb2('0x24')](function(_0x30824a){return _0x30824a;});}return null;};}function removeEntity(_0x519552,_0x9719ad){return function(_0x3660cc){if(_0x3660cc){return _0x3660cc[_0x7eb2('0x25')]()[_0x7eb2('0x24')](function(){var _0x138aec=_0x3660cc[_0x7eb2('0x26')]({'plain':!![]});var _0x41dec5=_0x7eb2('0x27');return db['UserProfileResource'][_0x7eb2('0x25')]({'where':{'type':_0x41dec5,'resourceId':_0x138aec['id']}})[_0x7eb2('0x24')](function(){return _0x3660cc;});})[_0x7eb2('0x24')](function(){_0x519552[_0x7eb2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2353c3,_0x23b11c){return function(_0x103238){if(!_0x103238){_0x2353c3[_0x7eb2('0x19')](0x194);}return _0x103238;};}function handleError(_0x29f61c,_0x2b3f7c){_0x2b3f7c=_0x2b3f7c||0x1f4;return function(_0x3fd58b){logger[_0x7eb2('0x28')](_0x3fd58b[_0x7eb2('0x29')]);if(_0x3fd58b[_0x7eb2('0x2a')]){delete _0x3fd58b[_0x7eb2('0x2a')];}_0x29f61c[_0x7eb2('0x1a')](_0x2b3f7c)[_0x7eb2('0x2b')](_0x3fd58b);};}exports[_0x7eb2('0x2c')]=function(_0x2c9f86,_0x3624a2){var _0x4a5400={},_0x2848c6={},_0x3bee99={'count':0x0,'rows':[]};var _0x3f8bce=_[_0x7eb2('0x2d')](db['SquareOdbc'][_0x7eb2('0x2e')],function(_0x446857){return{'name':_0x446857[_0x7eb2('0x2f')],'type':_0x446857[_0x7eb2('0x30')]['key']};});_0x2848c6[_0x7eb2('0x31')]=_[_0x7eb2('0x2d')](_0x3f8bce,_0x7eb2('0x2a'));_0x2848c6[_0x7eb2('0x32')]=_[_0x7eb2('0x33')](_0x2c9f86[_0x7eb2('0x32')]);_0x2848c6['filters']=_[_0x7eb2('0x34')](_0x2848c6[_0x7eb2('0x31')],_0x2848c6[_0x7eb2('0x32')]);_0x4a5400['attributes']=_['intersection'](_0x2848c6[_0x7eb2('0x31')],qs[_0x7eb2('0x35')](_0x2c9f86[_0x7eb2('0x32')][_0x7eb2('0x35')]));_0x4a5400['attributes']=_0x4a5400[_0x7eb2('0x36')][_0x7eb2('0x37')]?_0x4a5400[_0x7eb2('0x36')]:_0x2848c6[_0x7eb2('0x31')];if(!_0x2c9f86[_0x7eb2('0x32')]['hasOwnProperty'](_0x7eb2('0x38'))){_0x4a5400[_0x7eb2('0x1d')]=qs[_0x7eb2('0x1d')](_0x2c9f86[_0x7eb2('0x32')]['limit']);_0x4a5400['offset']=qs[_0x7eb2('0x1c')](_0x2c9f86['query'][_0x7eb2('0x1c')]);}_0x4a5400[_0x7eb2('0x39')]=qs[_0x7eb2('0x3a')](_0x2c9f86['query'][_0x7eb2('0x3a')]);_0x4a5400[_0x7eb2('0x3b')]=qs[_0x7eb2('0x3c')](_[_0x7eb2('0x3d')](_0x2c9f86[_0x7eb2('0x32')],_0x2848c6[_0x7eb2('0x3c')]),_0x3f8bce);if(_0x2c9f86[_0x7eb2('0x32')][_0x7eb2('0x3e')]){_0x4a5400[_0x7eb2('0x3b')]=_['merge'](_0x4a5400[_0x7eb2('0x3b')],{'$or':_['map'](_0x3f8bce,function(_0x4cff8f){if(_0x4cff8f[_0x7eb2('0x30')]!==_0x7eb2('0x3f')){var _0x145ea2={};_0x145ea2[_0x4cff8f[_0x7eb2('0x2a')]]={'$like':'%'+_0x2c9f86[_0x7eb2('0x32')][_0x7eb2('0x3e')]+'%'};return _0x145ea2;}})});}_0x4a5400=_['merge']({},_0x4a5400,_0x2c9f86[_0x7eb2('0x40')]);var _0x2b8349={'where':_0x4a5400[_0x7eb2('0x3b')]};return db[_0x7eb2('0x41')][_0x7eb2('0x42')](_0x2b8349)[_0x7eb2('0x24')](function(_0x590fa8){_0x3bee99['count']=_0x590fa8;if(_0x2c9f86[_0x7eb2('0x32')][_0x7eb2('0x43')]){_0x4a5400[_0x7eb2('0x44')]=[{'all':!![]}];}return db[_0x7eb2('0x41')][_0x7eb2('0x45')](_0x4a5400);})[_0x7eb2('0x24')](function(_0x2cc246){_0x3bee99[_0x7eb2('0x46')]=_0x2cc246;return _0x3bee99;})['then'](respondWithFilteredResult(_0x3624a2,_0x4a5400))['catch'](handleError(_0x3624a2,null));};exports[_0x7eb2('0x47')]=function(_0x38922b,_0x296a69){var _0x511295={'raw':!![],'where':{'id':_0x38922b['params']['id']}},_0x5cd4a0={};_0x5cd4a0[_0x7eb2('0x31')]=_[_0x7eb2('0x33')](db[_0x7eb2('0x41')]['rawAttributes']);_0x5cd4a0[_0x7eb2('0x32')]=_[_0x7eb2('0x33')](_0x38922b[_0x7eb2('0x32')]);_0x5cd4a0[_0x7eb2('0x3c')]=_[_0x7eb2('0x34')](_0x5cd4a0['model'],_0x5cd4a0[_0x7eb2('0x32')]);_0x511295['attributes']=_[_0x7eb2('0x34')](_0x5cd4a0[_0x7eb2('0x31')],qs[_0x7eb2('0x35')](_0x38922b[_0x7eb2('0x32')]['fields']));_0x511295[_0x7eb2('0x36')]=_0x511295[_0x7eb2('0x36')][_0x7eb2('0x37')]?_0x511295[_0x7eb2('0x36')]:_0x5cd4a0[_0x7eb2('0x31')];if(_0x38922b[_0x7eb2('0x32')][_0x7eb2('0x43')]){_0x511295[_0x7eb2('0x44')]=[{'all':!![]}];}_0x511295=_[_0x7eb2('0x48')]({},_0x511295,_0x38922b[_0x7eb2('0x40')]);return db[_0x7eb2('0x41')]['find'](_0x511295)[_0x7eb2('0x24')](handleEntityNotFound(_0x296a69,null))[_0x7eb2('0x24')](respondWithResult(_0x296a69,null))['catch'](handleError(_0x296a69,null));};exports[_0x7eb2('0x49')]=function(_0x2835c4,_0xdbdb8e){return db[_0x7eb2('0x41')][_0x7eb2('0x49')](_0x2835c4[_0x7eb2('0x4a')],{})[_0x7eb2('0x24')](function(_0x964c0e){var _0x7995b2=_0x2835c4[_0x7eb2('0x4b')][_0x7eb2('0x26')]({'plain':!![]});if(!_0x7995b2)throw new Error(_0x7eb2('0x4c'));if(_0x7995b2[_0x7eb2('0x4d')]===_0x7eb2('0x4b')){var _0x1bb62f=_0x964c0e[_0x7eb2('0x26')]({'plain':!![]});var _0x534aed=_0x7eb2('0x27');return db[_0x7eb2('0x4e')]['find']({'where':{'name':_0x534aed,'userProfileId':_0x7995b2[_0x7eb2('0x4f')]},'raw':!![]})[_0x7eb2('0x24')](function(_0x38e278){if(_0x38e278&&_0x38e278[_0x7eb2('0x50')]===0x0){return db[_0x7eb2('0x51')]['create']({'name':_0x1bb62f[_0x7eb2('0x2a')],'resourceId':_0x1bb62f['id'],'type':_0x38e278[_0x7eb2('0x2a')],'sectionId':_0x38e278['id']},{})[_0x7eb2('0x24')](function(){return _0x964c0e;});}else{return _0x964c0e;}})[_0x7eb2('0x52')](function(_0x51e38f){logger['error'](_0x7eb2('0x53'),_0x51e38f);throw _0x51e38f;});}return _0x964c0e;})['then'](respondWithResult(_0xdbdb8e,0xc9))[_0x7eb2('0x52')](handleError(_0xdbdb8e,null));};exports[_0x7eb2('0x23')]=function(_0x3b59c2,_0x477db3){if(_0x3b59c2['body']['id']){delete _0x3b59c2[_0x7eb2('0x4a')]['id'];}return db[_0x7eb2('0x41')][_0x7eb2('0x54')]({'where':{'id':_0x3b59c2[_0x7eb2('0x55')]['id']}})[_0x7eb2('0x24')](handleEntityNotFound(_0x477db3,null))[_0x7eb2('0x24')](saveUpdates(_0x3b59c2[_0x7eb2('0x4a')],null))['then'](respondWithResult(_0x477db3,null))[_0x7eb2('0x52')](handleError(_0x477db3,null));};exports[_0x7eb2('0x25')]=function(_0x4e0e5f,_0x5ccc8c){return db['SquareOdbc'][_0x7eb2('0x54')]({'where':{'id':_0x4e0e5f['params']['id']}})[_0x7eb2('0x24')](handleEntityNotFound(_0x5ccc8c,null))[_0x7eb2('0x24')](removeEntity(_0x5ccc8c,null))[_0x7eb2('0x52')](handleError(_0x5ccc8c,null));};exports['test']=function(_0x127ef7,_0x4502ad,_0x2e6ded){var _0x3129ad;return db[_0x7eb2('0x41')][_0x7eb2('0x54')]({'where':{'id':_0x127ef7['params']['id']},'attributes':['id',_0x7eb2('0x56')]})['then'](handleEntityNotFound(_0x4502ad,null))[_0x7eb2('0x24')](function(_0x450d02){if(_0x450d02){var _0x444671=require(_0x7eb2('0x57'))();_0x444671[_0x7eb2('0x58')](_0x450d02[_0x7eb2('0x56')]);_0x444671[_0x7eb2('0x59')]();return _0x450d02;}})[_0x7eb2('0x24')](respondWithResult(_0x4502ad,null))[_0x7eb2('0x52')](handleError(_0x4502ad,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index be34514..13639ac 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 _0x8927=['rimraf','./squareOdbc.attributes','define','square_odbc','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x180be6,_0x391ec2){var _0x19fa4e=function(_0x1c6b34){while(--_0x1c6b34){_0x180be6['push'](_0x180be6['shift']());}};_0x19fa4e(++_0x391ec2);}(_0x8927,0x1a8));var _0x7892=function(_0x6396b1,_0xdc77d9){_0x6396b1=_0x6396b1-0x0;var _0x2ea616=_0x8927[_0x6396b1];return _0x2ea616;};'use strict';var _=require(_0x7892('0x0'));var util=require('util');var logger=require(_0x7892('0x1'))(_0x7892('0x2'));var moment=require(_0x7892('0x3'));var BPromise=require('bluebird');var rp=require(_0x7892('0x4'));var fs=require('fs');var path=require(_0x7892('0x5'));var rimraf=require(_0x7892('0x6'));var config=require('../../config/environment');var attributes=require(_0x7892('0x7'));module['exports']=function(_0x11fbc8,_0x28b7ea){return _0x11fbc8[_0x7892('0x8')]('SquareOdbc',attributes,{'tableName':_0x7892('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3f2=['path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2df259,_0x397739){var _0x5ef715=function(_0x310624){while(--_0x310624){_0x2df259['push'](_0x2df259['shift']());}};_0x5ef715(++_0x397739);}(_0xa3f2,0x6f));var _0x2a3f=function(_0x4dae16,_0x4f6398){_0x4dae16=_0x4dae16-0x0;var _0x5bfa4d=_0xa3f2[_0x4dae16];return _0x5bfa4d;};'use strict';var _=require('lodash');var util=require(_0x2a3f('0x0'));var logger=require(_0x2a3f('0x1'))(_0x2a3f('0x2'));var moment=require(_0x2a3f('0x3'));var BPromise=require(_0x2a3f('0x4'));var rp=require(_0x2a3f('0x5'));var fs=require('fs');var path=require(_0x2a3f('0x6'));var rimraf=require('rimraf');var config=require(_0x2a3f('0x7'));var attributes=require(_0x2a3f('0x8'));module[_0x2a3f('0x9')]=function(_0x5227a3,_0x4d80d0){return _0x5227a3[_0x2a3f('0xa')](_0x2a3f('0xb'),attributes,{'tableName':_0x2a3f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 15dd789..0d3cf9c 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x41f2f5,_0x14f33c){var _0x3d49f1=function(_0x300207){while(--_0x300207){_0x41f2f5['push'](_0x41f2f5['shift']());}};_0x3d49f1(++_0x14f33c);}(_0x008c,0x188));var _0xc008=function(_0x395155,_0x192ffd){_0x395155=_0x395155-0x0;var _0x179767=_0x008c[_0x395155];return _0x179767;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file +var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x2d086e,_0x5516c7){var _0x39bd87=function(_0x4c9997){while(--_0x4c9997){_0x2d086e['push'](_0x2d086e['shift']());}};_0x39bd87(++_0x5516c7);}(_0x008c,0x188));var _0xc008=function(_0x1f31fa,_0x5e96a){_0x1f31fa=_0x1f31fa-0x0;var _0x1b50ba=_0x008c[_0x1f31fa];return _0x1b50ba;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 45074b5..82a2e8f 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 _0x1339=['getUsers','post','create','addUsers','put','/:id','update','removeUsers','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','show','/:id/users'];(function(_0x4edd8c,_0x320d1c){var _0x175e5c=function(_0x59340f){while(--_0x59340f){_0x4edd8c['push'](_0x4edd8c['shift']());}};_0x175e5c(++_0x320d1c);}(_0x1339,0x1ed));var _0x9133=function(_0x236e03,_0x46f525){_0x236e03=_0x236e03-0x0;var _0x20e222=_0x1339[_0x236e03];return _0x20e222;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var auth=require(_0x9133('0x4'));var interaction=require(_0x9133('0x5'));var config=require(_0x9133('0x6'));var controller=require(_0x9133('0x7'));router['get']('/',auth[_0x9133('0x8')](),controller[_0x9133('0x9')]);router[_0x9133('0xa')]('/:id',auth[_0x9133('0x8')](),controller[_0x9133('0xb')]);router[_0x9133('0xa')](_0x9133('0xc'),auth[_0x9133('0x8')](),controller[_0x9133('0xd')]);router[_0x9133('0xe')]('/',auth[_0x9133('0x8')](),controller[_0x9133('0xf')]);router[_0x9133('0xe')]('/:id/users',auth[_0x9133('0x8')](),controller[_0x9133('0x10')]);router[_0x9133('0x11')](_0x9133('0x12'),auth[_0x9133('0x8')](),controller[_0x9133('0x13')]);router['delete'](_0x9133('0x12'),auth[_0x9133('0x8')](),controller['destroy']);router['delete'](_0x9133('0xc'),auth['isAuthenticated'](),controller[_0x9133('0x14')]);module[_0x9133('0x15')]=router; \ No newline at end of file +var _0xcf2f=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','create','post','addUsers','put','delete','destroy','multer'];(function(_0x4b8f07,_0x1fd70e){var _0x133d9a=function(_0x4e15fe){while(--_0x4e15fe){_0x4b8f07['push'](_0x4b8f07['shift']());}};_0x133d9a(++_0x1fd70e);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x5c80ff,_0x7d9b26){_0x5c80ff=_0x5c80ff-0x0;var _0x5a3766=_0xcf2f[_0x5c80ff];return _0x5a3766;};'use strict';var multer=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var path=require(_0xfcf2('0x2'));var timeout=require(_0xfcf2('0x3'));var express=require(_0xfcf2('0x4'));var router=express['Router']();var auth=require(_0xfcf2('0x5'));var interaction=require(_0xfcf2('0x6'));var config=require(_0xfcf2('0x7'));var controller=require(_0xfcf2('0x8'));router[_0xfcf2('0x9')]('/',auth[_0xfcf2('0xa')](),controller[_0xfcf2('0xb')]);router[_0xfcf2('0x9')](_0xfcf2('0xc'),auth[_0xfcf2('0xa')](),controller[_0xfcf2('0xd')]);router[_0xfcf2('0x9')](_0xfcf2('0xe'),auth[_0xfcf2('0xa')](),controller['getUsers']);router['post']('/',auth['isAuthenticated'](),controller[_0xfcf2('0xf')]);router[_0xfcf2('0x10')]('/:id/users',auth[_0xfcf2('0xa')](),controller[_0xfcf2('0x11')]);router[_0xfcf2('0x12')](_0xfcf2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xfcf2('0x13')](_0xfcf2('0xc'),auth[_0xfcf2('0xa')](),controller[_0xfcf2('0x14')]);router['delete'](_0xfcf2('0xe'),auth['isAuthenticated'](),controller['removeUsers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 580d76e..04a47f2 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 _0x35a5=['production','toString','sequelize','STRING','name','BLOB','long','getDataValue','preproduction','utf8'];(function(_0x456684,_0x3d71b4){var _0x1c296c=function(_0x1081d4){while(--_0x1081d4){_0x456684['push'](_0x456684['shift']());}};_0x1c296c(++_0x3d71b4);}(_0x35a5,0xe8));var _0x535a=function(_0x23fd5f,_0x18f835){_0x23fd5f=_0x23fd5f-0x0;var _0x5ccab0=_0x35a5[_0x23fd5f];return _0x5ccab0;};'use strict';var Sequelize=require(_0x535a('0x0'));module['exports']={'name':{'type':Sequelize[_0x535a('0x1')],'unique':_0x535a('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x535a('0x3')](_0x535a('0x4')),'get':function(){if(this[_0x535a('0x5')](_0x535a('0x6'))){return this['getDataValue'](_0x535a('0x6'))['toString'](_0x535a('0x7'));}}},'production':{'type':Sequelize[_0x535a('0x3')]('long'),'get':function(){if(this['getDataValue'](_0x535a('0x8'))){return this[_0x535a('0x5')](_0x535a('0x8'))[_0x535a('0x9')]('utf8');}}}}; \ No newline at end of file +var _0x48b0=['sequelize','exports','STRING','name','long','getDataValue','toString','utf8'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x48b0,0x1a8));var _0x048b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x48b0[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x048b('0x0'));module[_0x048b('0x1')]={'name':{'type':Sequelize[_0x048b('0x2')],'unique':_0x048b('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x048b('0x4')),'get':function(){if(this[_0x048b('0x5')]('preproduction')){return this[_0x048b('0x5')]('preproduction')[_0x048b('0x6')](_0x048b('0x7'));}}},'production':{'type':Sequelize['BLOB'](_0x048b('0x4')),'get':function(){if(this[_0x048b('0x5')]('production')){return this[_0x048b('0x5')]('production')['toString'](_0x048b('0x7'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 799eb4b..ad6c09e 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 _0x28e0=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','count','limit','set','Content-Range','json','apply','reject','save','update','then','get','SquareProjects','UserProfileResource','end','sendStatus','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','intersection','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addUsers','ids','omit','removeUsers','userSquareProject:remove','emit','getUsers','findOne','hasOwnProperty','nolimit','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x556d3d,_0x4926ac){var _0x3f311e=function(_0x427981){while(--_0x427981){_0x556d3d['push'](_0x556d3d['shift']());}};_0x3f311e(++_0x4926ac);}(_0x28e0,0x16c));var _0x028e=function(_0x3e9bc8,_0x129a12){_0x3e9bc8=_0x3e9bc8-0x0;var _0x5b40b7=_0x28e0[_0x3e9bc8];return _0x5b40b7;};'use strict';var pdf=require(_0x028e('0x0'));var emlformat=require(_0x028e('0x1'));var rimraf=require(_0x028e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x028e('0x3'));var rp=require(_0x028e('0x4'));var moment=require(_0x028e('0x5'));var BPromise=require(_0x028e('0x6'));var Mustache=require(_0x028e('0x7'));var util=require('util');var path=require(_0x028e('0x8'));var sox=require(_0x028e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x028e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x028e('0xb'));var deskjs=require(_0x028e('0xc'));var toCsv=require(_0x028e('0xd'));var querystring=require(_0x028e('0xe'));var Papa=require(_0x028e('0xf'));var Redis=require('ioredis');var authService=require(_0x028e('0x10'));var qs=require(_0x028e('0x11'));var as=require(_0x028e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x028e('0x13'))('api');var utils=require(_0x028e('0x14'));var config=require(_0x028e('0x15'));var db=require(_0x028e('0x16'))['db'];config[_0x028e('0x17')]=_['defaults'](config[_0x028e('0x17')],{'host':_0x028e('0x18'),'port':0x18eb});var socket=require(_0x028e('0x19'))(new Redis(config[_0x028e('0x17')]));require(_0x028e('0x1a'))[_0x028e('0x1b')](socket);function respondWithStatusCode(_0x26723a,_0x15ab51){_0x15ab51=_0x15ab51||0xcc;return function(_0x20501e){if(_0x20501e){return _0x26723a['sendStatus'](_0x15ab51);}return _0x26723a[_0x028e('0x1c')](_0x15ab51)['end']();};}function respondWithResult(_0x423836,_0x3dcd93){_0x3dcd93=_0x3dcd93||0xc8;return function(_0x17a3f4){if(_0x17a3f4){return _0x423836[_0x028e('0x1c')](_0x3dcd93)['json'](_0x17a3f4);}};}function respondWithFilteredResult(_0x2db6a1,_0x1f2290){return function(_0x32cd88){if(_0x32cd88){var _0x4ef93c=_0x32cd88[_0x028e('0x1d')],_0x4827f6=_0x1f2290['offset'],_0x1b7c41=_0x1f2290['offset']+_0x1f2290[_0x028e('0x1e')],_0xcfba9a;if(_0x1b7c41>=_0x4ef93c){_0x1b7c41=_0x4ef93c;_0xcfba9a=0xc8;}else{_0xcfba9a=0xce;}_0x2db6a1['status'](_0xcfba9a);return _0x2db6a1[_0x028e('0x1f')](_0x028e('0x20'),_0x4827f6+'-'+_0x1b7c41+'/'+_0x4ef93c)[_0x028e('0x21')](_0x32cd88);}return null;};}function patchUpdates(_0x47d75c){return function(_0x517fcc){try{jsonpatch[_0x028e('0x22')](_0x517fcc,_0x47d75c,!![]);}catch(_0x3a4a6f){return BPromise[_0x028e('0x23')](_0x3a4a6f);}return _0x517fcc[_0x028e('0x24')]();};}function saveUpdates(_0x512be8,_0x558c5d){return function(_0x33e62f){if(_0x33e62f){return _0x33e62f[_0x028e('0x25')](_0x512be8)[_0x028e('0x26')](function(_0x7b5f60){return _0x7b5f60;});}return null;};}function removeEntity(_0x13a1b7,_0x16ffdf){return function(_0x388258){if(_0x388258){return _0x388258['destroy']()[_0x028e('0x26')](function(){var _0x51b734=_0x388258[_0x028e('0x27')]({'plain':!![]});var _0x3b27b2=_0x028e('0x28');return db[_0x028e('0x29')]['destroy']({'where':{'type':_0x3b27b2,'resourceId':_0x51b734['id']}})[_0x028e('0x26')](function(){return _0x388258;});})[_0x028e('0x26')](function(){_0x13a1b7['status'](0xcc)[_0x028e('0x2a')]();});}};}function handleEntityNotFound(_0x534166,_0x423f8d){return function(_0x4fda64){if(!_0x4fda64){_0x534166[_0x028e('0x2b')](0x194);}return _0x4fda64;};}function handleError(_0x595bb9,_0x34f5ec){_0x34f5ec=_0x34f5ec||0x1f4;return function(_0x3f14e9){logger['error'](_0x3f14e9[_0x028e('0x2c')]);if(_0x3f14e9['name']){delete _0x3f14e9[_0x028e('0x2d')];}_0x595bb9[_0x028e('0x1c')](_0x34f5ec)[_0x028e('0x2e')](_0x3f14e9);};}exports['index']=function(_0x33e09c,_0x503c38){var _0x2906f5={},_0x4a945a={},_0x2dc213={'count':0x0,'rows':[]};var _0x3272e0=_[_0x028e('0x2f')](db[_0x028e('0x30')][_0x028e('0x31')],function(_0x2051d8){return{'name':_0x2051d8[_0x028e('0x32')],'type':_0x2051d8[_0x028e('0x33')][_0x028e('0x34')]};});_0x4a945a[_0x028e('0x35')]=_[_0x028e('0x2f')](_0x3272e0,_0x028e('0x2d'));_0x4a945a[_0x028e('0x36')]=_[_0x028e('0x37')](_0x33e09c[_0x028e('0x36')]);_0x4a945a[_0x028e('0x38')]=_['intersection'](_0x4a945a[_0x028e('0x35')],_0x4a945a[_0x028e('0x36')]);_0x2906f5[_0x028e('0x39')]=_['intersection'](_0x4a945a[_0x028e('0x35')],qs[_0x028e('0x3a')](_0x33e09c[_0x028e('0x36')]['fields']));_0x2906f5[_0x028e('0x39')]=_0x2906f5[_0x028e('0x39')][_0x028e('0x3b')]?_0x2906f5[_0x028e('0x39')]:_0x4a945a[_0x028e('0x35')];if(!_0x33e09c[_0x028e('0x36')]['hasOwnProperty']('nolimit')){_0x2906f5[_0x028e('0x1e')]=qs[_0x028e('0x1e')](_0x33e09c[_0x028e('0x36')][_0x028e('0x1e')]);_0x2906f5['offset']=qs[_0x028e('0x3c')](_0x33e09c[_0x028e('0x36')][_0x028e('0x3c')]);}_0x2906f5[_0x028e('0x3d')]=qs[_0x028e('0x3e')](_0x33e09c[_0x028e('0x36')][_0x028e('0x3e')]);_0x2906f5[_0x028e('0x3f')]=qs[_0x028e('0x38')](_[_0x028e('0x40')](_0x33e09c[_0x028e('0x36')],_0x4a945a['filters']),_0x3272e0);if(_0x33e09c[_0x028e('0x36')]['filter']){_0x2906f5[_0x028e('0x3f')]=_[_0x028e('0x41')](_0x2906f5[_0x028e('0x3f')],{'$or':_['map'](_0x3272e0,function(_0x5ae1a8){if(_0x5ae1a8['type']!==_0x028e('0x42')){var _0x266f2f={};_0x266f2f[_0x5ae1a8[_0x028e('0x2d')]]={'$like':'%'+_0x33e09c['query'][_0x028e('0x43')]+'%'};return _0x266f2f;}})});}_0x2906f5=_[_0x028e('0x41')]({},_0x2906f5,_0x33e09c[_0x028e('0x44')]);var _0x4dacef={'where':_0x2906f5[_0x028e('0x3f')]};return db[_0x028e('0x30')][_0x028e('0x1d')](_0x4dacef)['then'](function(_0x384724){_0x2dc213[_0x028e('0x1d')]=_0x384724;if(_0x33e09c[_0x028e('0x36')][_0x028e('0x45')]){_0x2906f5['include']=[{'all':!![]}];}return db[_0x028e('0x30')][_0x028e('0x46')](_0x2906f5);})[_0x028e('0x26')](function(_0x2c16a6){_0x2dc213['rows']=_0x2c16a6;return _0x2dc213;})[_0x028e('0x26')](respondWithFilteredResult(_0x503c38,_0x2906f5))[_0x028e('0x47')](handleError(_0x503c38,null));};exports[_0x028e('0x48')]=function(_0x2050ab,_0x46aa77){var _0x2fdcf7={'raw':![],'where':{'id':_0x2050ab[_0x028e('0x49')]['id']}},_0xe51cb2={};_0xe51cb2[_0x028e('0x35')]=_['keys'](db[_0x028e('0x30')][_0x028e('0x31')]);_0xe51cb2['query']=_[_0x028e('0x37')](_0x2050ab[_0x028e('0x36')]);_0xe51cb2[_0x028e('0x38')]=_['intersection'](_0xe51cb2['model'],_0xe51cb2['query']);_0x2fdcf7[_0x028e('0x39')]=_[_0x028e('0x4a')](_0xe51cb2[_0x028e('0x35')],qs[_0x028e('0x3a')](_0x2050ab[_0x028e('0x36')][_0x028e('0x3a')]));_0x2fdcf7['attributes']=_0x2fdcf7[_0x028e('0x39')][_0x028e('0x3b')]?_0x2fdcf7['attributes']:_0xe51cb2[_0x028e('0x35')];if(_0x2050ab['query'][_0x028e('0x45')]){_0x2fdcf7['include']=[{'all':!![]}];}_0x2fdcf7=_['merge']({},_0x2fdcf7,_0x2050ab[_0x028e('0x44')]);return db[_0x028e('0x30')][_0x028e('0x4b')](_0x2fdcf7)[_0x028e('0x26')](handleEntityNotFound(_0x46aa77,null))['then'](respondWithResult(_0x46aa77,null))[_0x028e('0x47')](handleError(_0x46aa77,null));};exports[_0x028e('0x4c')]=function(_0x501f76,_0x4bf431){return db[_0x028e('0x30')][_0x028e('0x4c')](_0x501f76[_0x028e('0x4d')],{})[_0x028e('0x26')](function(_0x344fe8){var _0x1be858=_0x501f76[_0x028e('0x4e')][_0x028e('0x27')]({'plain':!![]});if(!_0x1be858)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1be858['role']==='user'){var _0x382652=_0x344fe8['get']({'plain':!![]});var _0x1d5e80=_0x028e('0x28');return db[_0x028e('0x4f')][_0x028e('0x4b')]({'where':{'name':_0x1d5e80,'userProfileId':_0x1be858[_0x028e('0x50')]},'raw':!![]})['then'](function(_0xbf350a){if(_0xbf350a&&_0xbf350a[_0x028e('0x51')]===0x0){return db[_0x028e('0x29')][_0x028e('0x4c')]({'name':_0x382652[_0x028e('0x2d')],'resourceId':_0x382652['id'],'type':_0xbf350a['name'],'sectionId':_0xbf350a['id']},{})[_0x028e('0x26')](function(){return _0x344fe8;});}else{return _0x344fe8;}})[_0x028e('0x47')](function(_0x59116f){logger[_0x028e('0x52')](_0x028e('0x53'),_0x59116f);throw _0x59116f;});}return _0x344fe8;})[_0x028e('0x26')](respondWithResult(_0x4bf431,0xc9))['catch'](handleError(_0x4bf431,null));};exports[_0x028e('0x25')]=function(_0x273195,_0x248f34){if(_0x273195[_0x028e('0x4d')]['id']){delete _0x273195[_0x028e('0x4d')]['id'];}return db['SquareProject'][_0x028e('0x4b')]({'where':{'id':_0x273195[_0x028e('0x49')]['id']}})[_0x028e('0x26')](handleEntityNotFound(_0x248f34,null))[_0x028e('0x26')](saveUpdates(_0x273195[_0x028e('0x4d')],null))[_0x028e('0x26')](respondWithResult(_0x248f34,null))['catch'](handleError(_0x248f34,null));};exports[_0x028e('0x54')]=function(_0x3db6f0,_0x93f749){return db[_0x028e('0x30')][_0x028e('0x4b')]({'where':{'id':_0x3db6f0[_0x028e('0x49')]['id']}})[_0x028e('0x26')](handleEntityNotFound(_0x93f749,null))['then'](removeEntity(_0x93f749,null))[_0x028e('0x47')](handleError(_0x93f749,null));};exports[_0x028e('0x55')]=function(_0x501a83,_0xf38493,_0x273f04){return db[_0x028e('0x30')][_0x028e('0x4b')]({'where':{'id':_0x501a83[_0x028e('0x49')]['id']}})[_0x028e('0x26')](handleEntityNotFound(_0xf38493,null))[_0x028e('0x26')](function(_0x6d9434){if(_0x6d9434){return _0x6d9434[_0x028e('0x55')](_0x501a83[_0x028e('0x4d')][_0x028e('0x56')],_[_0x028e('0x57')](_0x501a83[_0x028e('0x4d')],[_0x028e('0x56'),'id'])||{});}})[_0x028e('0x26')](respondWithResult(_0xf38493,null))[_0x028e('0x47')](handleError(_0xf38493,null));};exports[_0x028e('0x58')]=function(_0x492f64,_0x59641c,_0x53921c){return db[_0x028e('0x30')][_0x028e('0x4b')]({'where':{'id':_0x492f64[_0x028e('0x49')]['id']}})['then'](handleEntityNotFound(_0x59641c,null))[_0x028e('0x26')](function(_0x4efe7d){if(_0x4efe7d){return _0x4efe7d[_0x028e('0x58')](_0x492f64['query']['ids'])[_0x028e('0x26')](function(){if(_['isArray'](_0x492f64['query'][_0x028e('0x56')])){for(var _0xe5bdbf=0x0;_0xe5bdbf<_0x492f64['query'][_0x028e('0x56')][_0x028e('0x3b')];_0xe5bdbf+=0x1){socket['emit'](_0x028e('0x59'),{'UserId':Number(_0x492f64[_0x028e('0x36')][_0x028e('0x56')][_0xe5bdbf]),'SquareProjectId':Number(_0x492f64['params']['id'])});}}else{socket[_0x028e('0x5a')]('userSquareProject:remove',{'UserId':Number(_0x492f64[_0x028e('0x36')][_0x028e('0x56')]),'SquareProjectId':Number(_0x492f64[_0x028e('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x59641c,null))['catch'](handleError(_0x59641c,null));};exports[_0x028e('0x5b')]=function(_0x29565a,_0x30e8ef,_0x105364){var _0x2cec2e={};var _0x307401={};var _0x5b4f55;var _0x308e53;return db[_0x028e('0x30')][_0x028e('0x5c')]({'where':{'id':_0x29565a['params']['id']}})['then'](handleEntityNotFound(_0x30e8ef,null))[_0x028e('0x26')](function(_0x450bc4){if(_0x450bc4){_0x5b4f55=_0x450bc4;_0x307401['model']=_[_0x028e('0x37')](db['User'][_0x028e('0x31')]);_0x307401['query']=_['keys'](_0x29565a['query']);_0x307401[_0x028e('0x38')]=_[_0x028e('0x4a')](_0x307401[_0x028e('0x35')],_0x307401[_0x028e('0x36')]);_0x2cec2e[_0x028e('0x39')]=_[_0x028e('0x4a')](_0x307401[_0x028e('0x35')],qs['fields'](_0x29565a[_0x028e('0x36')][_0x028e('0x3a')]));_0x2cec2e['attributes']=_0x2cec2e[_0x028e('0x39')][_0x028e('0x3b')]?_0x2cec2e[_0x028e('0x39')]:_0x307401['model'];_0x2cec2e['order']=qs['sort'](_0x29565a['query'][_0x028e('0x3e')]);_0x2cec2e[_0x028e('0x3f')]=qs[_0x028e('0x38')](_[_0x028e('0x40')](_0x29565a['query'],_0x307401['filters']));if(_0x29565a[_0x028e('0x36')][_0x028e('0x43')]){_0x2cec2e['where']=_[_0x028e('0x41')](_0x2cec2e[_0x028e('0x3f')],{'$or':_[_0x028e('0x2f')](_0x2cec2e['attributes'],function(_0x2caa68){var _0x13894c={};_0x13894c[_0x2caa68]={'$like':'%'+_0x29565a[_0x028e('0x36')][_0x028e('0x43')]+'%'};return _0x13894c;})});}_0x2cec2e=_[_0x028e('0x41')]({},_0x2cec2e,_0x29565a['options']);return _0x5b4f55[_0x028e('0x5b')](_0x2cec2e);}})[_0x028e('0x26')](function(_0x4c81c3){if(_0x4c81c3){_0x308e53=_0x4c81c3['length'];if(!_0x29565a[_0x028e('0x36')][_0x028e('0x5d')](_0x028e('0x5e'))){_0x2cec2e[_0x028e('0x1e')]=qs[_0x028e('0x1e')](_0x29565a[_0x028e('0x36')][_0x028e('0x1e')]);_0x2cec2e[_0x028e('0x3c')]=qs[_0x028e('0x3c')](_0x29565a['query'][_0x028e('0x3c')]);}return _0x5b4f55['getUsers'](_0x2cec2e);}})[_0x028e('0x26')](function(_0x46bd87){if(_0x46bd87){return _0x46bd87?{'count':_0x308e53,'rows':_0x46bd87}:null;}})[_0x028e('0x26')](respondWithResult(_0x30e8ef,null))['catch'](handleError(_0x30e8ef,null));}; \ No newline at end of file +var _0x59cb=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','redis','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','map','SquareProject','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','omit','ids','removeUsers','userSquareProject:remove','emit','getUsers','User','hasOwnProperty','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring'];(function(_0x156f1e,_0x71ad75){var _0x3951cc=function(_0x9fc871){while(--_0x9fc871){_0x156f1e['push'](_0x156f1e['shift']());}};_0x3951cc(++_0x71ad75);}(_0x59cb,0xab));var _0xb59c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x59cb[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require(_0xb59c('0x0'));var emlformat=require(_0xb59c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb59c('0x2'));var jsonpatch=require(_0xb59c('0x3'));var rp=require('request-promise');var moment=require(_0xb59c('0x4'));var BPromise=require(_0xb59c('0x5'));var Mustache=require('mustache');var util=require(_0xb59c('0x6'));var path=require(_0xb59c('0x7'));var sox=require(_0xb59c('0x8'));var csv=require(_0xb59c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb59c('0xa'));var crypto=require(_0xb59c('0xb'));var jsforce=require(_0xb59c('0xc'));var deskjs=require(_0xb59c('0xd'));var toCsv=require(_0xb59c('0x9'));var querystring=require(_0xb59c('0xe'));var Papa=require(_0xb59c('0xf'));var Redis=require(_0xb59c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb59c('0x11'));var as=require(_0xb59c('0x12'));var hardwareService=require(_0xb59c('0x13'));var logger=require(_0xb59c('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xb59c('0x15')]=_['defaults'](config[_0xb59c('0x15')],{'host':_0xb59c('0x16'),'port':0x18eb});var socket=require(_0xb59c('0x17'))(new Redis(config[_0xb59c('0x15')]));require(_0xb59c('0x18'))['register'](socket);function respondWithStatusCode(_0x45d75f,_0x22d23c){_0x22d23c=_0x22d23c||0xcc;return function(_0x1b295d){if(_0x1b295d){return _0x45d75f[_0xb59c('0x19')](_0x22d23c);}return _0x45d75f[_0xb59c('0x1a')](_0x22d23c)['end']();};}function respondWithResult(_0x39a78b,_0x4e4e06){_0x4e4e06=_0x4e4e06||0xc8;return function(_0x3865ce){if(_0x3865ce){return _0x39a78b['status'](_0x4e4e06)[_0xb59c('0x1b')](_0x3865ce);}};}function respondWithFilteredResult(_0x53d7eb,_0x40e2cb){return function(_0x229c89){if(_0x229c89){var _0x26e5bd=_0x229c89[_0xb59c('0x1c')],_0x217538=_0x40e2cb[_0xb59c('0x1d')],_0x12f9b0=_0x40e2cb[_0xb59c('0x1d')]+_0x40e2cb['limit'],_0xe6c4c7;if(_0x12f9b0>=_0x26e5bd){_0x12f9b0=_0x26e5bd;_0xe6c4c7=0xc8;}else{_0xe6c4c7=0xce;}_0x53d7eb['status'](_0xe6c4c7);return _0x53d7eb[_0xb59c('0x1e')]('Content-Range',_0x217538+'-'+_0x12f9b0+'/'+_0x26e5bd)[_0xb59c('0x1b')](_0x229c89);}return null;};}function patchUpdates(_0x4024fe){return function(_0x3c042b){try{jsonpatch[_0xb59c('0x1f')](_0x3c042b,_0x4024fe,!![]);}catch(_0x17ea3b){return BPromise[_0xb59c('0x20')](_0x17ea3b);}return _0x3c042b[_0xb59c('0x21')]();};}function saveUpdates(_0x3088f0,_0x38ed18){return function(_0x4ef326){if(_0x4ef326){return _0x4ef326[_0xb59c('0x22')](_0x3088f0)[_0xb59c('0x23')](function(_0x109dea){return _0x109dea;});}return null;};}function removeEntity(_0x261757,_0x5d8b06){return function(_0x3cb63d){if(_0x3cb63d){return _0x3cb63d[_0xb59c('0x24')]()[_0xb59c('0x23')](function(){var _0x535ccf=_0x3cb63d[_0xb59c('0x25')]({'plain':!![]});var _0x46a25c='SquareProjects';return db[_0xb59c('0x26')][_0xb59c('0x24')]({'where':{'type':_0x46a25c,'resourceId':_0x535ccf['id']}})[_0xb59c('0x23')](function(){return _0x3cb63d;});})[_0xb59c('0x23')](function(){_0x261757[_0xb59c('0x1a')](0xcc)[_0xb59c('0x27')]();});}};}function handleEntityNotFound(_0x4f36e4,_0x27b218){return function(_0x6c31a){if(!_0x6c31a){_0x4f36e4[_0xb59c('0x19')](0x194);}return _0x6c31a;};}function handleError(_0x46ff71,_0x3acc44){_0x3acc44=_0x3acc44||0x1f4;return function(_0x6274c0){logger[_0xb59c('0x28')](_0x6274c0['stack']);if(_0x6274c0[_0xb59c('0x29')]){delete _0x6274c0[_0xb59c('0x29')];}_0x46ff71[_0xb59c('0x1a')](_0x3acc44)[_0xb59c('0x2a')](_0x6274c0);};}exports[_0xb59c('0x2b')]=function(_0x244358,_0x15c147){var _0x407234={},_0x5d1f7f={},_0x22f854={'count':0x0,'rows':[]};var _0x2debaf=_[_0xb59c('0x2c')](db[_0xb59c('0x2d')][_0xb59c('0x2e')],function(_0x596b28){return{'name':_0x596b28['fieldName'],'type':_0x596b28['type'][_0xb59c('0x2f')]};});_0x5d1f7f[_0xb59c('0x30')]=_[_0xb59c('0x2c')](_0x2debaf,_0xb59c('0x29'));_0x5d1f7f['query']=_[_0xb59c('0x31')](_0x244358['query']);_0x5d1f7f[_0xb59c('0x32')]=_[_0xb59c('0x33')](_0x5d1f7f[_0xb59c('0x30')],_0x5d1f7f[_0xb59c('0x34')]);_0x407234[_0xb59c('0x35')]=_['intersection'](_0x5d1f7f[_0xb59c('0x30')],qs[_0xb59c('0x36')](_0x244358[_0xb59c('0x34')]['fields']));_0x407234[_0xb59c('0x35')]=_0x407234[_0xb59c('0x35')][_0xb59c('0x37')]?_0x407234[_0xb59c('0x35')]:_0x5d1f7f[_0xb59c('0x30')];if(!_0x244358[_0xb59c('0x34')]['hasOwnProperty'](_0xb59c('0x38'))){_0x407234[_0xb59c('0x39')]=qs[_0xb59c('0x39')](_0x244358['query'][_0xb59c('0x39')]);_0x407234[_0xb59c('0x1d')]=qs[_0xb59c('0x1d')](_0x244358[_0xb59c('0x34')][_0xb59c('0x1d')]);}_0x407234[_0xb59c('0x3a')]=qs[_0xb59c('0x3b')](_0x244358[_0xb59c('0x34')][_0xb59c('0x3b')]);_0x407234[_0xb59c('0x3c')]=qs[_0xb59c('0x32')](_[_0xb59c('0x3d')](_0x244358[_0xb59c('0x34')],_0x5d1f7f[_0xb59c('0x32')]),_0x2debaf);if(_0x244358['query'][_0xb59c('0x3e')]){_0x407234[_0xb59c('0x3c')]=_[_0xb59c('0x3f')](_0x407234[_0xb59c('0x3c')],{'$or':_[_0xb59c('0x2c')](_0x2debaf,function(_0x2c7080){if(_0x2c7080[_0xb59c('0x40')]!==_0xb59c('0x41')){var _0x59b8fb={};_0x59b8fb[_0x2c7080['name']]={'$like':'%'+_0x244358[_0xb59c('0x34')][_0xb59c('0x3e')]+'%'};return _0x59b8fb;}})});}_0x407234=_['merge']({},_0x407234,_0x244358[_0xb59c('0x42')]);var _0x58b746={'where':_0x407234[_0xb59c('0x3c')]};return db[_0xb59c('0x2d')][_0xb59c('0x1c')](_0x58b746)['then'](function(_0x34668e){_0x22f854[_0xb59c('0x1c')]=_0x34668e;if(_0x244358['query'][_0xb59c('0x43')]){_0x407234[_0xb59c('0x44')]=[{'all':!![]}];}return db[_0xb59c('0x2d')][_0xb59c('0x45')](_0x407234);})[_0xb59c('0x23')](function(_0x10cc83){_0x22f854[_0xb59c('0x46')]=_0x10cc83;return _0x22f854;})[_0xb59c('0x23')](respondWithFilteredResult(_0x15c147,_0x407234))[_0xb59c('0x47')](handleError(_0x15c147,null));};exports[_0xb59c('0x48')]=function(_0x34e065,_0x2f89ab){var _0x5edf4a={'raw':![],'where':{'id':_0x34e065[_0xb59c('0x49')]['id']}},_0x19a533={};_0x19a533['model']=_[_0xb59c('0x31')](db[_0xb59c('0x2d')]['rawAttributes']);_0x19a533['query']=_['keys'](_0x34e065[_0xb59c('0x34')]);_0x19a533[_0xb59c('0x32')]=_[_0xb59c('0x33')](_0x19a533[_0xb59c('0x30')],_0x19a533[_0xb59c('0x34')]);_0x5edf4a[_0xb59c('0x35')]=_[_0xb59c('0x33')](_0x19a533[_0xb59c('0x30')],qs[_0xb59c('0x36')](_0x34e065['query'][_0xb59c('0x36')]));_0x5edf4a['attributes']=_0x5edf4a[_0xb59c('0x35')][_0xb59c('0x37')]?_0x5edf4a['attributes']:_0x19a533[_0xb59c('0x30')];if(_0x34e065[_0xb59c('0x34')][_0xb59c('0x43')]){_0x5edf4a[_0xb59c('0x44')]=[{'all':!![]}];}_0x5edf4a=_['merge']({},_0x5edf4a,_0x34e065[_0xb59c('0x42')]);return db[_0xb59c('0x2d')][_0xb59c('0x4a')](_0x5edf4a)[_0xb59c('0x23')](handleEntityNotFound(_0x2f89ab,null))[_0xb59c('0x23')](respondWithResult(_0x2f89ab,null))[_0xb59c('0x47')](handleError(_0x2f89ab,null));};exports['create']=function(_0x8f10c9,_0xcd44b5){return db['SquareProject'][_0xb59c('0x4b')](_0x8f10c9[_0xb59c('0x4c')],{})[_0xb59c('0x23')](function(_0x220305){var _0x1810e0=_0x8f10c9[_0xb59c('0x4d')][_0xb59c('0x25')]({'plain':!![]});if(!_0x1810e0)throw new Error(_0xb59c('0x4e'));if(_0x1810e0['role']===_0xb59c('0x4d')){var _0x255280=_0x220305['get']({'plain':!![]});var _0x354467=_0xb59c('0x4f');return db[_0xb59c('0x50')]['find']({'where':{'name':_0x354467,'userProfileId':_0x1810e0[_0xb59c('0x51')]},'raw':!![]})[_0xb59c('0x23')](function(_0x3c9438){if(_0x3c9438&&_0x3c9438[_0xb59c('0x52')]===0x0){return db[_0xb59c('0x26')][_0xb59c('0x4b')]({'name':_0x255280['name'],'resourceId':_0x255280['id'],'type':_0x3c9438[_0xb59c('0x29')],'sectionId':_0x3c9438['id']},{})[_0xb59c('0x23')](function(){return _0x220305;});}else{return _0x220305;}})[_0xb59c('0x47')](function(_0xe2dd9){logger[_0xb59c('0x28')](_0xb59c('0x53'),_0xe2dd9);throw _0xe2dd9;});}return _0x220305;})[_0xb59c('0x23')](respondWithResult(_0xcd44b5,0xc9))[_0xb59c('0x47')](handleError(_0xcd44b5,null));};exports[_0xb59c('0x22')]=function(_0xecff82,_0xe95beb){if(_0xecff82[_0xb59c('0x4c')]['id']){delete _0xecff82[_0xb59c('0x4c')]['id'];}return db[_0xb59c('0x2d')][_0xb59c('0x4a')]({'where':{'id':_0xecff82[_0xb59c('0x49')]['id']}})[_0xb59c('0x23')](handleEntityNotFound(_0xe95beb,null))[_0xb59c('0x23')](saveUpdates(_0xecff82[_0xb59c('0x4c')],null))[_0xb59c('0x23')](respondWithResult(_0xe95beb,null))[_0xb59c('0x47')](handleError(_0xe95beb,null));};exports[_0xb59c('0x24')]=function(_0x144581,_0x232cb0){return db[_0xb59c('0x2d')][_0xb59c('0x4a')]({'where':{'id':_0x144581[_0xb59c('0x49')]['id']}})[_0xb59c('0x23')](handleEntityNotFound(_0x232cb0,null))[_0xb59c('0x23')](removeEntity(_0x232cb0,null))['catch'](handleError(_0x232cb0,null));};exports[_0xb59c('0x54')]=function(_0x4d15ab,_0x916a37,_0x51d385){return db[_0xb59c('0x2d')][_0xb59c('0x4a')]({'where':{'id':_0x4d15ab['params']['id']}})[_0xb59c('0x23')](handleEntityNotFound(_0x916a37,null))[_0xb59c('0x23')](function(_0x52cc95){if(_0x52cc95){return _0x52cc95[_0xb59c('0x54')](_0x4d15ab[_0xb59c('0x4c')]['ids'],_[_0xb59c('0x55')](_0x4d15ab[_0xb59c('0x4c')],[_0xb59c('0x56'),'id'])||{});}})[_0xb59c('0x23')](respondWithResult(_0x916a37,null))[_0xb59c('0x47')](handleError(_0x916a37,null));};exports['removeUsers']=function(_0x355acc,_0x354e60,_0x1f6383){return db['SquareProject'][_0xb59c('0x4a')]({'where':{'id':_0x355acc[_0xb59c('0x49')]['id']}})[_0xb59c('0x23')](handleEntityNotFound(_0x354e60,null))[_0xb59c('0x23')](function(_0x1e0f0d){if(_0x1e0f0d){return _0x1e0f0d[_0xb59c('0x57')](_0x355acc['query'][_0xb59c('0x56')])[_0xb59c('0x23')](function(){if(_['isArray'](_0x355acc[_0xb59c('0x34')][_0xb59c('0x56')])){for(var _0x16149f=0x0;_0x16149f<_0x355acc[_0xb59c('0x34')][_0xb59c('0x56')][_0xb59c('0x37')];_0x16149f+=0x1){socket['emit'](_0xb59c('0x58'),{'UserId':Number(_0x355acc[_0xb59c('0x34')][_0xb59c('0x56')][_0x16149f]),'SquareProjectId':Number(_0x355acc[_0xb59c('0x49')]['id'])});}}else{socket[_0xb59c('0x59')](_0xb59c('0x58'),{'UserId':Number(_0x355acc[_0xb59c('0x34')]['ids']),'SquareProjectId':Number(_0x355acc['params']['id'])});}});}})[_0xb59c('0x23')](respondWithStatusCode(_0x354e60,null))[_0xb59c('0x47')](handleError(_0x354e60,null));};exports[_0xb59c('0x5a')]=function(_0x5004d5,_0x36b5ed,_0x19d293){var _0x27fe87={};var _0x411625={};var _0x5ab7aa;var _0x50e0f5;return db[_0xb59c('0x2d')]['findOne']({'where':{'id':_0x5004d5[_0xb59c('0x49')]['id']}})[_0xb59c('0x23')](handleEntityNotFound(_0x36b5ed,null))[_0xb59c('0x23')](function(_0x2356bf){if(_0x2356bf){_0x5ab7aa=_0x2356bf;_0x411625['model']=_[_0xb59c('0x31')](db[_0xb59c('0x5b')][_0xb59c('0x2e')]);_0x411625[_0xb59c('0x34')]=_[_0xb59c('0x31')](_0x5004d5[_0xb59c('0x34')]);_0x411625['filters']=_[_0xb59c('0x33')](_0x411625[_0xb59c('0x30')],_0x411625[_0xb59c('0x34')]);_0x27fe87['attributes']=_[_0xb59c('0x33')](_0x411625[_0xb59c('0x30')],qs[_0xb59c('0x36')](_0x5004d5[_0xb59c('0x34')][_0xb59c('0x36')]));_0x27fe87[_0xb59c('0x35')]=_0x27fe87[_0xb59c('0x35')][_0xb59c('0x37')]?_0x27fe87['attributes']:_0x411625[_0xb59c('0x30')];_0x27fe87[_0xb59c('0x3a')]=qs[_0xb59c('0x3b')](_0x5004d5[_0xb59c('0x34')][_0xb59c('0x3b')]);_0x27fe87[_0xb59c('0x3c')]=qs[_0xb59c('0x32')](_['pick'](_0x5004d5[_0xb59c('0x34')],_0x411625[_0xb59c('0x32')]));if(_0x5004d5['query'][_0xb59c('0x3e')]){_0x27fe87[_0xb59c('0x3c')]=_[_0xb59c('0x3f')](_0x27fe87[_0xb59c('0x3c')],{'$or':_[_0xb59c('0x2c')](_0x27fe87['attributes'],function(_0xe29441){var _0x29966f={};_0x29966f[_0xe29441]={'$like':'%'+_0x5004d5[_0xb59c('0x34')][_0xb59c('0x3e')]+'%'};return _0x29966f;})});}_0x27fe87=_['merge']({},_0x27fe87,_0x5004d5['options']);return _0x5ab7aa[_0xb59c('0x5a')](_0x27fe87);}})['then'](function(_0x2d9016){if(_0x2d9016){_0x50e0f5=_0x2d9016[_0xb59c('0x37')];if(!_0x5004d5[_0xb59c('0x34')][_0xb59c('0x5c')](_0xb59c('0x38'))){_0x27fe87[_0xb59c('0x39')]=qs[_0xb59c('0x39')](_0x5004d5['query'][_0xb59c('0x39')]);_0x27fe87[_0xb59c('0x1d')]=qs[_0xb59c('0x1d')](_0x5004d5[_0xb59c('0x34')][_0xb59c('0x1d')]);}return _0x5ab7aa[_0xb59c('0x5a')](_0x27fe87);}})[_0xb59c('0x23')](function(_0x46a154){if(_0x46a154){return _0x46a154?{'count':_0x50e0f5,'rows':_0x46a154}:null;}})['then'](respondWithResult(_0x36b5ed,null))[_0xb59c('0x47')](handleError(_0x36b5ed,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 0f775d1..fd1ff92 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 _0xe81d=['save','update','remove','emit','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x3f4315,_0xd6ec89){var _0x5842e3=function(_0x4b12f5){while(--_0x4b12f5){_0x3f4315['push'](_0x3f4315['shift']());}};_0x5842e3(++_0xd6ec89);}(_0xe81d,0xc4));var _0xde81=function(_0x206345,_0x17d238){_0x206345=_0x206345-0x0;var _0x4dcd1e=_0xe81d[_0x206345];return _0x4dcd1e;};'use strict';var EventEmitter=require(_0xde81('0x0'));var SquareProject=require(_0xde81('0x1'))['db'][_0xde81('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xde81('0x3')](0x0);var events={'afterCreate':_0xde81('0x4'),'afterUpdate':_0xde81('0x5'),'afterDestroy':_0xde81('0x6')};function emitEvent(_0x29d917){return function(_0x28698c,_0x5a50f7,_0x5e49e8){SquareProjectEvents[_0xde81('0x7')](_0x29d917+':'+_0x28698c['id'],_0x28698c);SquareProjectEvents[_0xde81('0x7')](_0x29d917,_0x28698c);_0x5e49e8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xde81('0x8')](e,emitEvent(event));}}module[_0xde81('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x906c=['hook','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xe01983,_0x508a21){var _0x3d5594=function(_0x493198){while(--_0x493198){_0xe01983['push'](_0xe01983['shift']());}};_0x3d5594(++_0x508a21);}(_0x906c,0x17d));var _0xc906=function(_0xd474a,_0x24491f){_0xd474a=_0xd474a-0x0;var _0xab3af2=_0x906c[_0xd474a];return _0xab3af2;};'use strict';var EventEmitter=require(_0xc906('0x0'));var SquareProject=require(_0xc906('0x1'))['db'][_0xc906('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xc906('0x3')](0x0);var events={'afterCreate':_0xc906('0x4'),'afterUpdate':_0xc906('0x5'),'afterDestroy':_0xc906('0x6')};function emitEvent(_0x11b7f2){return function(_0xf58a83,_0x1d9c1e,_0x3421e6){SquareProjectEvents[_0xc906('0x7')](_0x11b7f2+':'+_0xf58a83['id'],_0xf58a83);SquareProjectEvents[_0xc906('0x7')](_0x11b7f2,_0xf58a83);_0x3421e6(null);};}for(var e in events){if(events[_0xc906('0x8')](e)){var event=events[e];SquareProject[_0xc906('0x9')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 4de4338..725a13a 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 _0x5f66=['request-promise','path','../../config/environment','exports','SquareProject','square_projects','util','api','moment','bluebird'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./squareProject.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','SquareProject','square_projects','lodash','util'];(function(_0x4aa7c6,_0x27bf43){var _0x1fdf9e=function(_0x159879){while(--_0x159879){_0x4aa7c6['push'](_0x4aa7c6['shift']());}};_0x1fdf9e(++_0x27bf43);}(_0xdb28,0x106));var _0x8db2=function(_0x50030f,_0x3de5a1){_0x50030f=_0x50030f-0x0;var _0x2b59df=_0xdb28[_0x50030f];return _0x2b59df;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./squareProject.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 5066376..3b84f32 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 _0x7b68=['defaults','localhost','socket.io-emitter','redis','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSquareProject','SquareProject','find','options','raw','where','include','model','attributes','map','then','debug','lodash','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5a359a,_0x8af0d0){var _0x117628=function(_0x2d86c0){while(--_0x2d86c0){_0x5a359a['push'](_0x5a359a['shift']());}};_0x117628(++_0x8af0d0);}(_0x7b68,0x1ef));var _0x87b6=function(_0x2da771,_0x588294){_0x2da771=_0x2da771-0x0;var _0x431934=_0x7b68[_0x2da771];return _0x431934;};'use strict';var _=require(_0x87b6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87b6('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x87b6('0x2'));var logger=require(_0x87b6('0x3'))(_0x87b6('0x4'));var config=require(_0x87b6('0x5'));var jayson=require(_0x87b6('0x6'));var client=jayson[_0x87b6('0x7')][_0x87b6('0x8')]({'port':0x232a});config['redis']=_[_0x87b6('0x9')](config['redis'],{'host':_0x87b6('0xa'),'port':0x18eb});var socket=require(_0x87b6('0xb'))(new Redis(config[_0x87b6('0xc')]));require('./squareProject.socket')[_0x87b6('0xd')](socket);function respondWithRpcPromise(_0x4d36db,_0xd37c84,_0x38c965){return new BPromise(function(_0x4bcef3,_0x5067b3){return client[_0x87b6('0xe')](_0x4d36db,_0x38c965)['then'](function(_0x37e4a7){logger[_0x87b6('0xf')](_0x87b6('0x10'),_0xd37c84,_0x87b6('0x11'));logger['debug'](_0x87b6('0x12'),_0xd37c84,_0x87b6('0x11'),JSON[_0x87b6('0x13')](_0x37e4a7));if(_0x37e4a7['error']){if(_0x37e4a7[_0x87b6('0x14')][_0x87b6('0x15')]===0x1f4){logger[_0x87b6('0x14')]('SquareProject,\x20%s,\x20%s',_0xd37c84,_0x37e4a7[_0x87b6('0x14')]['message']);return _0x5067b3(_0x37e4a7[_0x87b6('0x14')]['message']);}logger[_0x87b6('0x14')]('SquareProject,\x20%s,\x20%s',_0xd37c84,_0x37e4a7['error'][_0x87b6('0x16')]);return _0x4bcef3(_0x37e4a7[_0x87b6('0x14')]['message']);}else{logger['info']('SquareProject,\x20%s,\x20%s',_0xd37c84,'request\x20sent');_0x4bcef3(_0x37e4a7['result']['message']);}})[_0x87b6('0x17')](function(_0xf17cf4){logger['error']('SquareProject,\x20%s,\x20%s',_0xd37c84,_0xf17cf4);_0x5067b3(_0xf17cf4);});});}exports[_0x87b6('0x18')]=function(_0x2f72dd){var _0x1f8edf=this;return new Promise(function(_0x1016d2,_0x4bdd69){return db[_0x87b6('0x19')][_0x87b6('0x1a')]({'raw':_0x2f72dd[_0x87b6('0x1b')]?_0x2f72dd[_0x87b6('0x1b')][_0x87b6('0x1c')]===undefined?!![]:![]:!![],'where':_0x2f72dd[_0x87b6('0x1b')]?_0x2f72dd[_0x87b6('0x1b')][_0x87b6('0x1d')]||null:null,'attributes':_0x2f72dd[_0x87b6('0x1b')]?_0x2f72dd['options']['attributes']||null:null,'include':_0x2f72dd[_0x87b6('0x1b')]?_0x2f72dd[_0x87b6('0x1b')][_0x87b6('0x1e')]?_['map'](_0x2f72dd[_0x87b6('0x1b')][_0x87b6('0x1e')],function(_0x425a8b){return{'model':db[_0x425a8b[_0x87b6('0x1f')]],'as':_0x425a8b['as'],'attributes':_0x425a8b[_0x87b6('0x20')],'include':_0x425a8b[_0x87b6('0x1e')]?_['map'](_0x425a8b[_0x87b6('0x1e')],function(_0x1df602){return{'model':db[_0x1df602[_0x87b6('0x1f')]],'as':_0x1df602['as'],'attributes':_0x1df602[_0x87b6('0x20')],'include':_0x1df602[_0x87b6('0x1e')]?_[_0x87b6('0x21')](_0x1df602[_0x87b6('0x1e')],function(_0x556494){return{'model':db[_0x556494[_0x87b6('0x1f')]],'as':_0x556494['as'],'attributes':_0x556494[_0x87b6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x87b6('0x22')](function(_0x49d665){logger[_0x87b6('0xf')](_0x87b6('0x18'),_0x2f72dd);logger[_0x87b6('0x23')](_0x87b6('0x18'),_0x2f72dd,JSON['stringify'](_0x49d665));_0x1016d2(_0x49d665);})[_0x87b6('0x17')](function(_0x1e3d55){logger[_0x87b6('0x14')](_0x87b6('0x18'),_0x1e3d55['message'],_0x2f72dd);_0x4bdd69(_0x1f8edf['error'](0x1f4,_0x1e3d55[_0x87b6('0x16')]));});});}; \ No newline at end of file +var _0xa4e0=['map','model','attributes','catch','lodash','moment','randomstring','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowSquareProject','SquareProject','find','options','raw','where','include'];(function(_0x46453e,_0x53de5a){var _0x1e155c=function(_0x118edf){while(--_0x118edf){_0x46453e['push'](_0x46453e['shift']());}};_0x1e155c(++_0x53de5a);}(_0xa4e0,0xeb));var _0x0a4e=function(_0x5edc32,_0x3ac808){_0x5edc32=_0x5edc32-0x0;var _0x4505a7=_0xa4e0[_0x5edc32];return _0x4505a7;};'use strict';var _=require(_0x0a4e('0x0'));var util=require('util');var moment=require(_0x0a4e('0x1'));var BPromise=require('bluebird');var rs=require(_0x0a4e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0a4e('0x3'))(_0x0a4e('0x4'));var config=require(_0x0a4e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0a4e('0x6')][_0x0a4e('0x7')]({'port':0x232a});config[_0x0a4e('0x8')]=_[_0x0a4e('0x9')](config[_0x0a4e('0x8')],{'host':_0x0a4e('0xa'),'port':0x18eb});var socket=require(_0x0a4e('0xb'))(new Redis(config[_0x0a4e('0x8')]));require('./squareProject.socket')[_0x0a4e('0xc')](socket);function respondWithRpcPromise(_0x1e01a9,_0x223dba,_0x43f2f1){return new BPromise(function(_0x1c1c35,_0x46950f){return client['request'](_0x1e01a9,_0x43f2f1)['then'](function(_0x46e9fe){logger[_0x0a4e('0xd')](_0x0a4e('0xe'),_0x223dba,_0x0a4e('0xf'));logger[_0x0a4e('0x10')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x223dba,'request\x20sent',JSON[_0x0a4e('0x11')](_0x46e9fe));if(_0x46e9fe[_0x0a4e('0x12')]){if(_0x46e9fe[_0x0a4e('0x12')][_0x0a4e('0x13')]===0x1f4){logger['error']('SquareProject,\x20%s,\x20%s',_0x223dba,_0x46e9fe['error'][_0x0a4e('0x14')]);return _0x46950f(_0x46e9fe[_0x0a4e('0x12')]['message']);}logger[_0x0a4e('0x12')](_0x0a4e('0xe'),_0x223dba,_0x46e9fe[_0x0a4e('0x12')][_0x0a4e('0x14')]);return _0x1c1c35(_0x46e9fe[_0x0a4e('0x12')][_0x0a4e('0x14')]);}else{logger[_0x0a4e('0xd')]('SquareProject,\x20%s,\x20%s',_0x223dba,_0x0a4e('0xf'));_0x1c1c35(_0x46e9fe[_0x0a4e('0x15')][_0x0a4e('0x14')]);}})['catch'](function(_0x14179a){logger['error'](_0x0a4e('0xe'),_0x223dba,_0x14179a);_0x46950f(_0x14179a);});});}exports[_0x0a4e('0x16')]=function(_0x40e685){var _0x4a9608=this;return new Promise(function(_0x1477cb,_0x2bb067){return db[_0x0a4e('0x17')][_0x0a4e('0x18')]({'raw':_0x40e685[_0x0a4e('0x19')]?_0x40e685[_0x0a4e('0x19')][_0x0a4e('0x1a')]===undefined?!![]:![]:!![],'where':_0x40e685[_0x0a4e('0x19')]?_0x40e685['options'][_0x0a4e('0x1b')]||null:null,'attributes':_0x40e685[_0x0a4e('0x19')]?_0x40e685[_0x0a4e('0x19')]['attributes']||null:null,'include':_0x40e685[_0x0a4e('0x19')]?_0x40e685[_0x0a4e('0x19')][_0x0a4e('0x1c')]?_[_0x0a4e('0x1d')](_0x40e685[_0x0a4e('0x19')][_0x0a4e('0x1c')],function(_0x310ca1){return{'model':db[_0x310ca1[_0x0a4e('0x1e')]],'as':_0x310ca1['as'],'attributes':_0x310ca1[_0x0a4e('0x1f')],'include':_0x310ca1[_0x0a4e('0x1c')]?_[_0x0a4e('0x1d')](_0x310ca1[_0x0a4e('0x1c')],function(_0xd21f7d){return{'model':db[_0xd21f7d[_0x0a4e('0x1e')]],'as':_0xd21f7d['as'],'attributes':_0xd21f7d[_0x0a4e('0x1f')],'include':_0xd21f7d[_0x0a4e('0x1c')]?_[_0x0a4e('0x1d')](_0xd21f7d[_0x0a4e('0x1c')],function(_0x3a94e4){return{'model':db[_0x3a94e4[_0x0a4e('0x1e')]],'as':_0x3a94e4['as'],'attributes':_0x3a94e4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ec197){logger[_0x0a4e('0xd')](_0x0a4e('0x16'),_0x40e685);logger[_0x0a4e('0x10')]('ShowSquareProject',_0x40e685,JSON[_0x0a4e('0x11')](_0x5ec197));_0x1477cb(_0x5ec197);})[_0x0a4e('0x20')](function(_0x5b61e6){logger[_0x0a4e('0x12')]('ShowSquareProject',_0x5b61e6[_0x0a4e('0x14')],_0x40e685);_0x2bb067(_0x4a9608['error'](0x1f4,_0x5b61e6[_0x0a4e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index b88cdd5..b8c22e6 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 _0xc6ac=['removeListener','register','length','./squareProject.events','save','remove','update','emit'];(function(_0x57d281,_0x4def7c){var _0xa1e355=function(_0x4e9f52){while(--_0x4e9f52){_0x57d281['push'](_0x57d281['shift']());}};_0xa1e355(++_0x4def7c);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x3fe4d4,_0x378a0c){_0x3fe4d4=_0x3fe4d4-0x0;var _0x301872=_0xc6ac[_0x3fe4d4];return _0x301872;};'use strict';var SquareProjectEvents=require(_0xcc6a('0x0'));var events=[_0xcc6a('0x1'),_0xcc6a('0x2'),_0xcc6a('0x3')];function createListener(_0x276972,_0x279d85){return function(_0x17d786){_0x279d85[_0xcc6a('0x4')](_0x276972,_0x17d786);};}function removeListener(_0x297643,_0x22ee99){return function(){SquareProjectEvents[_0xcc6a('0x5')](_0x297643,_0x22ee99);};}exports[_0xcc6a('0x6')]=function(_0x12330e){for(var _0x197bd7=0x0,_0x5f3887=events[_0xcc6a('0x7')];_0x197bd7<_0x5f3887;_0x197bd7++){var _0x11b919=events[_0x197bd7];var _0xf02261=createListener('squareProject:'+_0x11b919,_0x12330e);SquareProjectEvents['on'](_0x11b919,_0xf02261);}}; \ No newline at end of file +var _0x187d=['./squareProject.events','remove','update','emit','removeListener','length','squareProject:'];(function(_0x38eaaf,_0x4093df){var _0x12dfef=function(_0x1e867a){while(--_0x1e867a){_0x38eaaf['push'](_0x38eaaf['shift']());}};_0x12dfef(++_0x4093df);}(_0x187d,0x93));var _0xd187=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x187d[_0x24237f];return _0x48298e;};'use strict';var SquareProjectEvents=require(_0xd187('0x0'));var events=['save',_0xd187('0x1'),_0xd187('0x2')];function createListener(_0x44d5f6,_0x1cb41f){return function(_0x18498b){_0x1cb41f[_0xd187('0x3')](_0x44d5f6,_0x18498b);};}function removeListener(_0x58622a,_0x28fa0b){return function(){SquareProjectEvents[_0xd187('0x4')](_0x58622a,_0x28fa0b);};}exports['register']=function(_0x1d2533){for(var _0x58ee7=0x0,_0x444a60=events[_0xd187('0x5')];_0x58ee7<_0x444a60;_0x58ee7++){var _0x28ce2f=events[_0x58ee7];var _0x2d6992=createListener(_0xd187('0x6')+_0x28ce2f,_0x1d2533);SquareProjectEvents['on'](_0x28ce2f,_0x2d6992);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index a828c77..f69a8e9 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 _0x9114=['post','create','put','/:id','update','delete','/:id/delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','download'];(function(_0x4a5bd9,_0x1a2b17){var _0x5f2d05=function(_0xb9cb02){while(--_0xb9cb02){_0x4a5bd9['push'](_0x4a5bd9['shift']());}};_0x5f2d05(++_0x1a2b17);}(_0x9114,0x9c));var _0x4911=function(_0x4f7418,_0x193595){_0x4f7418=_0x4f7418-0x0;var _0x4c2e31=_0x9114[_0x4f7418];return _0x4c2e31;};'use strict';var multer=require('multer');var util=require(_0x4911('0x0'));var path=require(_0x4911('0x1'));var timeout=require(_0x4911('0x2'));var express=require(_0x4911('0x3'));var router=express['Router']();var auth=require(_0x4911('0x4'));var interaction=require(_0x4911('0x5'));var config=require(_0x4911('0x6'));var controller=require(_0x4911('0x7'));router[_0x4911('0x8')]('/',auth[_0x4911('0x9')](),controller['index']);router[_0x4911('0x8')]('/:id',auth[_0x4911('0x9')](),controller[_0x4911('0xa')]);router[_0x4911('0x8')]('/:id/download',auth[_0x4911('0x9')](),controller[_0x4911('0xb')]);router[_0x4911('0xc')]('/',auth[_0x4911('0x9')](),controller[_0x4911('0xd')]);router[_0x4911('0xe')](_0x4911('0xf'),auth[_0x4911('0x9')](),controller[_0x4911('0x10')]);router[_0x4911('0x11')](_0x4911('0x12'),auth[_0x4911('0x9')](),controller[_0x4911('0x13')]);module[_0x4911('0x14')]=router; \ No newline at end of file +var _0x5240=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x5f1498,_0x1295b2){var _0x3db54e=function(_0x3416c8){while(--_0x3416c8){_0x5f1498['push'](_0x5f1498['shift']());}};_0x3db54e(++_0x1295b2);}(_0x5240,0x197));var _0x0524=function(_0x495c53,_0x5dd58b){_0x495c53=_0x495c53-0x0;var _0x20abe0=_0x5240[_0x495c53];return _0x20abe0;};'use strict';var multer=require(_0x0524('0x0'));var util=require(_0x0524('0x1'));var path=require(_0x0524('0x2'));var timeout=require(_0x0524('0x3'));var express=require(_0x0524('0x4'));var router=express[_0x0524('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0524('0x6'));var config=require(_0x0524('0x7'));var controller=require(_0x0524('0x8'));router[_0x0524('0x9')]('/',auth[_0x0524('0xa')](),controller[_0x0524('0xb')]);router[_0x0524('0x9')](_0x0524('0xc'),auth['isAuthenticated'](),controller[_0x0524('0xd')]);router[_0x0524('0x9')](_0x0524('0xe'),auth[_0x0524('0xa')](),controller[_0x0524('0xf')]);router[_0x0524('0x10')]('/',auth['isAuthenticated'](),controller[_0x0524('0x11')]);router['put'](_0x0524('0xc'),auth[_0x0524('0xa')](),controller[_0x0524('0x12')]);router[_0x0524('0x13')](_0x0524('0x14'),auth[_0x0524('0xa')](),controller[_0x0524('0x15')]);module[_0x0524('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 1e2b24d..b3536c6 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 _0x4d28=['sequelize','exports','STRING','substring','lastIndexOf'];(function(_0x466282,_0x4527f0){var _0x12dee9=function(_0x2a7991){while(--_0x2a7991){_0x466282['push'](_0x466282['shift']());}};_0x12dee9(++_0x4527f0);}(_0x4d28,0x69));var _0x84d2=function(_0x45ccd2,_0x4ecb10){_0x45ccd2=_0x45ccd2-0x0;var _0x554dff=_0x4d28[_0x45ccd2];return _0x554dff;};'use strict';var Sequelize=require(_0x84d2('0x0'));module[_0x84d2('0x1')]={'uniqueid':{'type':Sequelize[_0x84d2('0x2')]},'callerid':{'type':Sequelize[_0x84d2('0x2')]},'calleridname':{'type':Sequelize[_0x84d2('0x2')]},'context':{'type':Sequelize[_0x84d2('0x2')]},'extension':{'type':Sequelize[_0x84d2('0x2')]},'priority':{'type':Sequelize[_0x84d2('0x2')]},'accountcode':{'type':Sequelize[_0x84d2('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x84d2('0x2')]},'saveName':{'type':Sequelize[_0x84d2('0x2')]},'filename':{'type':Sequelize[_0x84d2('0x2')]},'savePath':{'type':Sequelize[_0x84d2('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0xd343b2='';var _0x2c6c66=this['getDataValue']('savePath');if(_0x2c6c66){_0xd343b2=_0x2c6c66[_0x84d2('0x3')](_0x2c6c66[_0x84d2('0x4')]('.'));}return _0xd343b2;}}}; \ No newline at end of file +var _0x5b7b=['lastIndexOf','sequelize','STRING','VIRTUAL','savePath','substring'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x5b7b,0xd9));var _0xb5b7=function(_0x415f7e,_0x4630b6){_0x415f7e=_0x415f7e-0x0;var _0x311ff4=_0x5b7b[_0x415f7e];return _0x311ff4;};'use strict';var Sequelize=require(_0xb5b7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb5b7('0x1')]},'callerid':{'type':Sequelize[_0xb5b7('0x1')]},'calleridname':{'type':Sequelize[_0xb5b7('0x1')]},'context':{'type':Sequelize[_0xb5b7('0x1')]},'extension':{'type':Sequelize[_0xb5b7('0x1')]},'priority':{'type':Sequelize[_0xb5b7('0x1')]},'accountcode':{'type':Sequelize[_0xb5b7('0x1')]},'dnid':{'type':Sequelize[_0xb5b7('0x1')]},'projectName':{'type':Sequelize[_0xb5b7('0x1')]},'saveName':{'type':Sequelize[_0xb5b7('0x1')]},'filename':{'type':Sequelize[_0xb5b7('0x1')]},'savePath':{'type':Sequelize[_0xb5b7('0x1')]},'format':{'type':Sequelize[_0xb5b7('0x2')],'get':function(){var _0x3c512e='';var _0x2e9001=this['getDataValue'](_0xb5b7('0x3'));if(_0x2e9001){_0x3c512e=_0x2e9001[_0xb5b7('0x4')](_0x2e9001[_0xb5b7('0x5')]('.'));}return _0x3c512e;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 7b52815..e85289b 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 _0x590c=['sox','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','secrets','Sequelize','ValidationError','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path'];(function(_0x3f986e,_0x21006d){var _0xe57da5=function(_0x29162a){while(--_0x29162a){_0x3f986e['push'](_0x3f986e['shift']());}};_0xe57da5(++_0x21006d);}(_0x590c,0x16b));var _0xc590=function(_0x59ab65,_0x410a52){_0x59ab65=_0x59ab65-0x0;var _0x57db9b=_0x590c[_0x59ab65];return _0x57db9b;};'use strict';var pdf=require(_0xc590('0x0'));var emlformat=require(_0xc590('0x1'));var rimraf=require(_0xc590('0x2'));var zipdir=require(_0xc590('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc590('0x4'));var moment=require(_0xc590('0x5'));var BPromise=require(_0xc590('0x6'));var Mustache=require(_0xc590('0x7'));var util=require('util');var path=require(_0xc590('0x8'));var sox=require(_0xc590('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc590('0xa'));var squel=require(_0xc590('0xb'));var crypto=require('crypto');var jsforce=require(_0xc590('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc590('0xd'));var querystring=require(_0xc590('0xe'));var Papa=require(_0xc590('0xf'));var Redis=require(_0xc590('0x10'));var authService=require(_0xc590('0x11'));var qs=require(_0xc590('0x12'));var as=require(_0xc590('0x13'));var hardwareService=require(_0xc590('0x14'));var logger=require(_0xc590('0x15'))(_0xc590('0x16'));var utils=require('../../config/utils');var config=require(_0xc590('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c705a,_0x303cd2){_0x303cd2=_0x303cd2||0xcc;return function(_0x15aa95){if(_0x15aa95){return _0x1c705a['sendStatus'](_0x303cd2);}return _0x1c705a[_0xc590('0x18')](_0x303cd2)['end']();};}function respondWithResult(_0x574ca4,_0x234050){_0x234050=_0x234050||0xc8;return function(_0x1d3643){if(_0x1d3643){return _0x574ca4[_0xc590('0x18')](_0x234050)['json'](_0x1d3643);}};}function respondWithFilteredResult(_0x4cbd0a,_0x31962d){return function(_0x56c288){if(_0x56c288){var _0x49e515=_0x56c288[_0xc590('0x19')],_0x5a5399=_0x31962d[_0xc590('0x1a')],_0x5bd401=_0x31962d[_0xc590('0x1a')]+_0x31962d[_0xc590('0x1b')],_0x7b0091;if(_0x5bd401>=_0x49e515){_0x5bd401=_0x49e515;_0x7b0091=0xc8;}else{_0x7b0091=0xce;}_0x4cbd0a[_0xc590('0x18')](_0x7b0091);return _0x4cbd0a[_0xc590('0x1c')](_0xc590('0x1d'),_0x5a5399+'-'+_0x5bd401+'/'+_0x49e515)['json'](_0x56c288);}return null;};}function patchUpdates(_0x1dda51){return function(_0x455732){try{jsonpatch[_0xc590('0x1e')](_0x455732,_0x1dda51,!![]);}catch(_0x47c3b4){return BPromise[_0xc590('0x1f')](_0x47c3b4);}return _0x455732[_0xc590('0x20')]();};}function saveUpdates(_0x4f7ae6,_0x16b37f){return function(_0x2c6e86){if(_0x2c6e86){return _0x2c6e86[_0xc590('0x21')](_0x4f7ae6)[_0xc590('0x22')](function(_0x5ac0c0){return _0x5ac0c0;});}return null;};}function removeEntity(_0x2caef0,_0x5344ee){return function(_0x8de71d){if(_0x8de71d){return _0x8de71d[_0xc590('0x23')]()[_0xc590('0x22')](function(){_0x2caef0[_0xc590('0x18')](0xcc)[_0xc590('0x24')]();});}};}function handleEntityNotFound(_0x424d5c,_0x4f5a24){return function(_0x3d7c61){if(!_0x3d7c61){_0x424d5c['sendStatus'](0x194);}return _0x3d7c61;};}function handleError(_0xae7b2,_0x248004){_0x248004=_0x248004||0x1f4;return function(_0x4f256a){logger['error'](_0x4f256a['stack']);if(_0x4f256a[_0xc590('0x25')]){delete _0x4f256a[_0xc590('0x25')];}_0xae7b2['status'](_0x248004)[_0xc590('0x26')](_0x4f256a);};}exports[_0xc590('0x27')]=function(_0x475fba,_0x48ee0b){var _0x3a21d1={},_0x54266a={},_0x561b29={'count':0x0,'rows':[]};var _0x2e4c8c=_[_0xc590('0x28')](db[_0xc590('0x29')][_0xc590('0x2a')],function(_0x187769){return{'name':_0x187769[_0xc590('0x2b')],'type':_0x187769['type'][_0xc590('0x2c')]};});_0x54266a[_0xc590('0x2d')]=_['map'](_0x2e4c8c,_0xc590('0x25'));_0x54266a['query']=_['keys'](_0x475fba[_0xc590('0x2e')]);_0x54266a['filters']=_[_0xc590('0x2f')](_0x54266a[_0xc590('0x2d')],_0x54266a[_0xc590('0x2e')]);_0x3a21d1[_0xc590('0x30')]=_['intersection'](_0x54266a['model'],qs[_0xc590('0x31')](_0x475fba[_0xc590('0x2e')][_0xc590('0x31')]));_0x3a21d1[_0xc590('0x30')]=_0x3a21d1[_0xc590('0x30')][_0xc590('0x32')]?_0x3a21d1['attributes']:_0x54266a[_0xc590('0x2d')];if(!_0x475fba['query'][_0xc590('0x33')]('nolimit')){_0x3a21d1['limit']=qs['limit'](_0x475fba[_0xc590('0x2e')]['limit']);_0x3a21d1['offset']=qs['offset'](_0x475fba['query']['offset']);}_0x3a21d1[_0xc590('0x34')]=qs[_0xc590('0x35')](_0x475fba['query'][_0xc590('0x35')]);_0x3a21d1[_0xc590('0x36')]=qs[_0xc590('0x37')](_[_0xc590('0x38')](_0x475fba[_0xc590('0x2e')],_0x54266a['filters']),_0x2e4c8c);if(_0x475fba['query'][_0xc590('0x39')]){_0x3a21d1[_0xc590('0x36')]=_[_0xc590('0x3a')](_0x3a21d1[_0xc590('0x36')],{'$or':_[_0xc590('0x28')](_0x2e4c8c,function(_0x55126a){if(_0x55126a[_0xc590('0x3b')]!==_0xc590('0x3c')){var _0x148590={};_0x148590[_0x55126a[_0xc590('0x25')]]={'$like':'%'+_0x475fba[_0xc590('0x2e')]['filter']+'%'};return _0x148590;}})});}_0x3a21d1=_[_0xc590('0x3a')]({},_0x3a21d1,_0x475fba[_0xc590('0x3d')]);var _0x364b8f={'where':_0x3a21d1[_0xc590('0x36')]};return db[_0xc590('0x29')][_0xc590('0x19')](_0x364b8f)['then'](function(_0x417bb1){_0x561b29[_0xc590('0x19')]=_0x417bb1;if(_0x475fba['query'][_0xc590('0x3e')]){_0x3a21d1[_0xc590('0x3f')]=[{'all':!![]}];}return db[_0xc590('0x29')][_0xc590('0x40')](_0x3a21d1);})[_0xc590('0x22')](function(_0x2eec9e){_0x561b29['rows']=_0x2eec9e;return _0x561b29;})[_0xc590('0x22')](respondWithFilteredResult(_0x48ee0b,_0x3a21d1))[_0xc590('0x41')](handleError(_0x48ee0b,null));};exports['show']=function(_0x1f64ed,_0xcee8d9){var _0x3ddfc7={'raw':!![],'where':{'id':_0x1f64ed[_0xc590('0x42')]['id']}},_0x44a7a6={};_0x44a7a6['model']=_[_0xc590('0x43')](db['SquareRecording']['rawAttributes']);_0x44a7a6[_0xc590('0x2e')]=_[_0xc590('0x43')](_0x1f64ed['query']);_0x44a7a6[_0xc590('0x37')]=_[_0xc590('0x2f')](_0x44a7a6['model'],_0x44a7a6['query']);_0x3ddfc7[_0xc590('0x30')]=_[_0xc590('0x2f')](_0x44a7a6[_0xc590('0x2d')],qs['fields'](_0x1f64ed['query'][_0xc590('0x31')]));_0x3ddfc7['attributes']=_0x3ddfc7[_0xc590('0x30')][_0xc590('0x32')]?_0x3ddfc7['attributes']:_0x44a7a6[_0xc590('0x2d')];if(_0x1f64ed[_0xc590('0x2e')]['includeAll']){_0x3ddfc7['include']=[{'all':!![]}];}_0x3ddfc7=_[_0xc590('0x3a')]({},_0x3ddfc7,_0x1f64ed[_0xc590('0x3d')]);return db[_0xc590('0x29')][_0xc590('0x44')](_0x3ddfc7)[_0xc590('0x22')](handleEntityNotFound(_0xcee8d9,null))['then'](respondWithResult(_0xcee8d9,null))[_0xc590('0x41')](handleError(_0xcee8d9,null));};exports[_0xc590('0x45')]=function(_0x4625b6,_0x17453a){return db[_0xc590('0x29')][_0xc590('0x45')](_0x4625b6[_0xc590('0x46')],{})[_0xc590('0x22')](respondWithResult(_0x17453a,0xc9))[_0xc590('0x41')](handleError(_0x17453a,null));};exports[_0xc590('0x21')]=function(_0x37acf7,_0x577abb){if(_0x37acf7['body']['id']){delete _0x37acf7[_0xc590('0x46')]['id'];}return db['SquareRecording'][_0xc590('0x44')]({'where':{'id':_0x37acf7[_0xc590('0x42')]['id']}})[_0xc590('0x22')](handleEntityNotFound(_0x577abb,null))['then'](saveUpdates(_0x37acf7[_0xc590('0x46')],null))[_0xc590('0x22')](respondWithResult(_0x577abb,null))[_0xc590('0x41')](handleError(_0x577abb,null));};exports[_0xc590('0x47')]=function(_0x3391e5,_0x215fa2,_0x51d4ae){var _0x141991=require(_0xc590('0x48'));var _0x3ca4f6=![];var _0x3d28d2={};if(_0x3391e5['query'][_0xc590('0x3b')]&&_0x3391e5['query'][_0xc590('0x3b')]===_0xc590('0x49')){_0x3d28d2[_0xc590('0x49')]=_0x3391e5['params']['id'];}else{_0x3d28d2['id']=_0x3391e5['params']['id'];}return db[_0xc590('0x29')]['find']({'where':_0x3d28d2,'attributes':['id',_0xc590('0x4a'),_0xc590('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x215fa2,null))[_0xc590('0x22')](function(_0x2384b7){if(_0x2384b7){var _0x37aa69=_0x2384b7[_0xc590('0x4a')];var _0x2a4495=util[_0xc590('0x4c')]('%s.cypher',_0x37aa69);if(fs[_0xc590('0x4d')](_0x2a4495)){_0x3ca4f6=!![];return _0x141991[_0xc590('0x4e')](_0x2a4495,_0x37aa69,config[_0xc590('0x4f')]['recording'])['then'](function(){return _0x2384b7;});}return _0x2384b7;}})[_0xc590('0x22')](function(_0x595892){if(_0x595892){var _0x48295b=_0x595892[_0xc590('0x4a')];if(!fs[_0xc590('0x4d')](_0x48295b)){throw new db[(_0xc590('0x50'))][(_0xc590('0x51'))]('SquareRecording\x20not\x20found');}if(_0x595892['filename']){return _0x215fa2[_0xc590('0x47')](_0x48295b,_0x595892[_0xc590('0x4b')]+path[_0xc590('0x52')](_0x48295b),function(){if(_0x3ca4f6){fs[_0xc590('0x53')](_0x48295b);}});}else{return _0x215fa2[_0xc590('0x47')](_0x48295b,function(_0x485d96){if(_0x3ca4f6){fs[_0xc590('0x53')](_0x48295b);}});}}})['catch'](function(_0xbe08bb){if(_0xbe08bb[_0xc590('0x54')]==='SquareRecording\x20not\x20found'){_0x215fa2[_0xc590('0x18')](0x194)[_0xc590('0x26')](_0xc590('0x55'));}else{return handleError(_0x215fa2,null);}});};exports[_0xc590('0x23')]=function(_0x251874,_0x19c107){return db[_0xc590('0x29')][_0xc590('0x44')]({'where':{'id':_0x251874[_0xc590('0x42')]['id']}})[_0xc590('0x22')](function(_0x40bbf6){if(!_0x40bbf6)throw new ReferenceError(_0xc590('0x56'));return _0x40bbf6;})[_0xc590('0x22')](function(_0x5018af){var _0x4bf9b9=_0x5018af[_0xc590('0x4a')];logger[_0xc590('0x57')](_0xc590('0x58'),_0x4bf9b9);if(!_[_0xc590('0x59')](_0x5018af[_0xc590('0x4a')])&&fs[_0xc590('0x4d')](_0x4bf9b9)){logger[_0xc590('0x57')](_0xc590('0x5a')+_0x4bf9b9+_0xc590('0x5b'));fs['unlinkSync'](_0x4bf9b9);}_0x4bf9b9=_0x4bf9b9+'.cypher';if(!_[_0xc590('0x59')](_0x5018af[_0xc590('0x4a')])&&fs[_0xc590('0x4d')](_0x4bf9b9)){logger[_0xc590('0x57')](_0xc590('0x5a')+_0x4bf9b9+_0xc590('0x5b'));fs[_0xc590('0x5c')](_0x4bf9b9);}return _0x5018af;})[_0xc590('0x22')](function(_0x35ca7a){if(!_0x35ca7a)throw new InternalError();return _0x35ca7a[_0xc590('0x23')]();})[_0xc590('0x22')](function(){_0x19c107[_0xc590('0x18')](0xcc)[_0xc590('0x24')]();})[_0xc590('0x41')](handleError(_0x19c107,null));}; \ No newline at end of file +var _0xf689=['api','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','find','create','catch','update','body','download','../../components/encryptor','uniqueid','filename','savePath','%s.cypher','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','existsSync','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','end','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x282cbf,_0x4da8b9){var _0x2e3596=function(_0x59156d){while(--_0x59156d){_0x282cbf['push'](_0x282cbf['shift']());}};_0x2e3596(++_0x4da8b9);}(_0xf689,0x1e1));var _0x9f68=function(_0x5ccf08,_0x1898a0){_0x5ccf08=_0x5ccf08-0x0;var _0x2143de=_0xf689[_0x5ccf08];return _0x2143de;};'use strict';var pdf=require(_0x9f68('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9f68('0x1'));var zipdir=require(_0x9f68('0x2'));var jsonpatch=require(_0x9f68('0x3'));var rp=require(_0x9f68('0x4'));var moment=require(_0x9f68('0x5'));var BPromise=require(_0x9f68('0x6'));var Mustache=require(_0x9f68('0x7'));var util=require(_0x9f68('0x8'));var path=require(_0x9f68('0x9'));var sox=require(_0x9f68('0xa'));var csv=require(_0x9f68('0xb'));var ejs=require(_0x9f68('0xc'));var fs=require('fs');var _=require(_0x9f68('0xd'));var squel=require(_0x9f68('0xe'));var crypto=require(_0x9f68('0xf'));var jsforce=require(_0x9f68('0x10'));var deskjs=require(_0x9f68('0x11'));var toCsv=require(_0x9f68('0xb'));var querystring=require(_0x9f68('0x12'));var Papa=require('papaparse');var Redis=require(_0x9f68('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9f68('0x14'));var as=require(_0x9f68('0x15'));var hardwareService=require(_0x9f68('0x16'));var logger=require(_0x9f68('0x17'))(_0x9f68('0x18'));var utils=require(_0x9f68('0x19'));var config=require(_0x9f68('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29feb9,_0x161455){_0x161455=_0x161455||0xcc;return function(_0x4739c8){if(_0x4739c8){return _0x29feb9[_0x9f68('0x1b')](_0x161455);}return _0x29feb9[_0x9f68('0x1c')](_0x161455)['end']();};}function respondWithResult(_0x23ba8b,_0x420c1e){_0x420c1e=_0x420c1e||0xc8;return function(_0x2dea12){if(_0x2dea12){return _0x23ba8b[_0x9f68('0x1c')](_0x420c1e)['json'](_0x2dea12);}};}function respondWithFilteredResult(_0x580d19,_0x923d8d){return function(_0x4a2027){if(_0x4a2027){var _0x5df916=_0x4a2027[_0x9f68('0x1d')],_0x3d0495=_0x923d8d['offset'],_0x761bab=_0x923d8d[_0x9f68('0x1e')]+_0x923d8d[_0x9f68('0x1f')],_0x3c0af0;if(_0x761bab>=_0x5df916){_0x761bab=_0x5df916;_0x3c0af0=0xc8;}else{_0x3c0af0=0xce;}_0x580d19[_0x9f68('0x1c')](_0x3c0af0);return _0x580d19[_0x9f68('0x20')](_0x9f68('0x21'),_0x3d0495+'-'+_0x761bab+'/'+_0x5df916)[_0x9f68('0x22')](_0x4a2027);}return null;};}function patchUpdates(_0x32ffd3){return function(_0x2c7334){try{jsonpatch[_0x9f68('0x23')](_0x2c7334,_0x32ffd3,!![]);}catch(_0x2f07d8){return BPromise[_0x9f68('0x24')](_0x2f07d8);}return _0x2c7334[_0x9f68('0x25')]();};}function saveUpdates(_0x11c3b0,_0x5bab67){return function(_0x408719){if(_0x408719){return _0x408719['update'](_0x11c3b0)[_0x9f68('0x26')](function(_0x10a0dc){return _0x10a0dc;});}return null;};}function removeEntity(_0x23bce9,_0x5d0920){return function(_0x3fb512){if(_0x3fb512){return _0x3fb512['destroy']()[_0x9f68('0x26')](function(){_0x23bce9[_0x9f68('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2432b9,_0x274a14){return function(_0x3090fa){if(!_0x3090fa){_0x2432b9[_0x9f68('0x1b')](0x194);}return _0x3090fa;};}function handleError(_0x30a5c9,_0x4f79ec){_0x4f79ec=_0x4f79ec||0x1f4;return function(_0x49cecc){logger[_0x9f68('0x27')](_0x49cecc[_0x9f68('0x28')]);if(_0x49cecc['name']){delete _0x49cecc[_0x9f68('0x29')];}_0x30a5c9[_0x9f68('0x1c')](_0x4f79ec)[_0x9f68('0x2a')](_0x49cecc);};}exports[_0x9f68('0x2b')]=function(_0x1bf4b1,_0x561b7c){var _0x3de17b={},_0x41b21b={},_0x43140e={'count':0x0,'rows':[]};var _0x358c15=_[_0x9f68('0x2c')](db[_0x9f68('0x2d')][_0x9f68('0x2e')],function(_0x1a1bb9){return{'name':_0x1a1bb9[_0x9f68('0x2f')],'type':_0x1a1bb9[_0x9f68('0x30')]['key']};});_0x41b21b['model']=_['map'](_0x358c15,'name');_0x41b21b['query']=_[_0x9f68('0x31')](_0x1bf4b1[_0x9f68('0x32')]);_0x41b21b[_0x9f68('0x33')]=_[_0x9f68('0x34')](_0x41b21b[_0x9f68('0x35')],_0x41b21b['query']);_0x3de17b['attributes']=_['intersection'](_0x41b21b[_0x9f68('0x35')],qs['fields'](_0x1bf4b1['query'][_0x9f68('0x36')]));_0x3de17b['attributes']=_0x3de17b[_0x9f68('0x37')][_0x9f68('0x38')]?_0x3de17b[_0x9f68('0x37')]:_0x41b21b['model'];if(!_0x1bf4b1[_0x9f68('0x32')]['hasOwnProperty'](_0x9f68('0x39'))){_0x3de17b[_0x9f68('0x1f')]=qs[_0x9f68('0x1f')](_0x1bf4b1['query']['limit']);_0x3de17b[_0x9f68('0x1e')]=qs[_0x9f68('0x1e')](_0x1bf4b1[_0x9f68('0x32')][_0x9f68('0x1e')]);}_0x3de17b[_0x9f68('0x3a')]=qs[_0x9f68('0x3b')](_0x1bf4b1[_0x9f68('0x32')][_0x9f68('0x3b')]);_0x3de17b[_0x9f68('0x3c')]=qs[_0x9f68('0x33')](_[_0x9f68('0x3d')](_0x1bf4b1[_0x9f68('0x32')],_0x41b21b[_0x9f68('0x33')]),_0x358c15);if(_0x1bf4b1[_0x9f68('0x32')][_0x9f68('0x3e')]){_0x3de17b[_0x9f68('0x3c')]=_['merge'](_0x3de17b[_0x9f68('0x3c')],{'$or':_[_0x9f68('0x2c')](_0x358c15,function(_0x3c7d44){if(_0x3c7d44['type']!==_0x9f68('0x3f')){var _0x25f624={};_0x25f624[_0x3c7d44[_0x9f68('0x29')]]={'$like':'%'+_0x1bf4b1['query'][_0x9f68('0x3e')]+'%'};return _0x25f624;}})});}_0x3de17b=_[_0x9f68('0x40')]({},_0x3de17b,_0x1bf4b1['options']);var _0x11b3a5={'where':_0x3de17b[_0x9f68('0x3c')]};return db[_0x9f68('0x2d')][_0x9f68('0x1d')](_0x11b3a5)[_0x9f68('0x26')](function(_0x16a638){_0x43140e[_0x9f68('0x1d')]=_0x16a638;if(_0x1bf4b1[_0x9f68('0x32')][_0x9f68('0x41')]){_0x3de17b[_0x9f68('0x42')]=[{'all':!![]}];}return db[_0x9f68('0x2d')][_0x9f68('0x43')](_0x3de17b);})[_0x9f68('0x26')](function(_0xd75a0d){_0x43140e[_0x9f68('0x44')]=_0xd75a0d;return _0x43140e;})[_0x9f68('0x26')](respondWithFilteredResult(_0x561b7c,_0x3de17b))['catch'](handleError(_0x561b7c,null));};exports[_0x9f68('0x45')]=function(_0x297879,_0x50a01f){var _0x10bcdb={'raw':!![],'where':{'id':_0x297879[_0x9f68('0x46')]['id']}},_0x4250a8={};_0x4250a8['model']=_[_0x9f68('0x31')](db['SquareRecording'][_0x9f68('0x2e')]);_0x4250a8[_0x9f68('0x32')]=_[_0x9f68('0x31')](_0x297879[_0x9f68('0x32')]);_0x4250a8[_0x9f68('0x33')]=_[_0x9f68('0x34')](_0x4250a8[_0x9f68('0x35')],_0x4250a8[_0x9f68('0x32')]);_0x10bcdb[_0x9f68('0x37')]=_[_0x9f68('0x34')](_0x4250a8[_0x9f68('0x35')],qs[_0x9f68('0x36')](_0x297879[_0x9f68('0x32')]['fields']));_0x10bcdb['attributes']=_0x10bcdb[_0x9f68('0x37')][_0x9f68('0x38')]?_0x10bcdb[_0x9f68('0x37')]:_0x4250a8[_0x9f68('0x35')];if(_0x297879['query']['includeAll']){_0x10bcdb[_0x9f68('0x42')]=[{'all':!![]}];}_0x10bcdb=_[_0x9f68('0x40')]({},_0x10bcdb,_0x297879[_0x9f68('0x47')]);return db['SquareRecording'][_0x9f68('0x48')](_0x10bcdb)[_0x9f68('0x26')](handleEntityNotFound(_0x50a01f,null))[_0x9f68('0x26')](respondWithResult(_0x50a01f,null))['catch'](handleError(_0x50a01f,null));};exports[_0x9f68('0x49')]=function(_0x2c4236,_0x492c19){return db[_0x9f68('0x2d')][_0x9f68('0x49')](_0x2c4236['body'],{})[_0x9f68('0x26')](respondWithResult(_0x492c19,0xc9))[_0x9f68('0x4a')](handleError(_0x492c19,null));};exports[_0x9f68('0x4b')]=function(_0x3a4f03,_0x62510){if(_0x3a4f03[_0x9f68('0x4c')]['id']){delete _0x3a4f03[_0x9f68('0x4c')]['id'];}return db[_0x9f68('0x2d')]['find']({'where':{'id':_0x3a4f03[_0x9f68('0x46')]['id']}})[_0x9f68('0x26')](handleEntityNotFound(_0x62510,null))['then'](saveUpdates(_0x3a4f03[_0x9f68('0x4c')],null))['then'](respondWithResult(_0x62510,null))[_0x9f68('0x4a')](handleError(_0x62510,null));};exports[_0x9f68('0x4d')]=function(_0x15d554,_0x31cd5e,_0x242cd6){var _0x305735=require(_0x9f68('0x4e'));var _0x1f7e96=![];var _0x12808b={};if(_0x15d554[_0x9f68('0x32')][_0x9f68('0x30')]&&_0x15d554['query']['type']===_0x9f68('0x4f')){_0x12808b['uniqueid']=_0x15d554[_0x9f68('0x46')]['id'];}else{_0x12808b['id']=_0x15d554['params']['id'];}return db['SquareRecording']['find']({'where':_0x12808b,'attributes':['id','savePath',_0x9f68('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x31cd5e,null))['then'](function(_0x18dd33){if(_0x18dd33){var _0xf19ea0=_0x18dd33[_0x9f68('0x51')];var _0x38fa88=util['format'](_0x9f68('0x52'),_0xf19ea0);if(fs['existsSync'](_0x38fa88)){_0x1f7e96=!![];return _0x305735[_0x9f68('0x53')](_0x38fa88,_0xf19ea0,config[_0x9f68('0x54')][_0x9f68('0x55')])['then'](function(){return _0x18dd33;});}return _0x18dd33;}})[_0x9f68('0x26')](function(_0x41e8ad){if(_0x41e8ad){var _0x2766f3=_0x41e8ad[_0x9f68('0x51')];if(!fs['existsSync'](_0x2766f3)){throw new db[(_0x9f68('0x56'))][(_0x9f68('0x57'))](_0x9f68('0x58'));}if(_0x41e8ad['filename']){return _0x31cd5e[_0x9f68('0x4d')](_0x2766f3,_0x41e8ad[_0x9f68('0x50')]+path['extname'](_0x2766f3),function(){if(_0x1f7e96){fs[_0x9f68('0x59')](_0x2766f3);}});}else{return _0x31cd5e['download'](_0x2766f3,function(_0x27a311){if(_0x1f7e96){fs[_0x9f68('0x59')](_0x2766f3);}});}}})[_0x9f68('0x4a')](function(_0x4f26a1){if(_0x4f26a1['message']===_0x9f68('0x58')){_0x31cd5e[_0x9f68('0x1c')](0x194)[_0x9f68('0x2a')](_0x9f68('0x5a'));}else{return handleError(_0x31cd5e,null);}});};exports['destroy']=function(_0x29aebe,_0x262a5b){return db['SquareRecording'][_0x9f68('0x48')]({'where':{'id':_0x29aebe['params']['id']}})[_0x9f68('0x26')](function(_0x4fbb19){if(!_0x4fbb19)throw new ReferenceError(_0x9f68('0x5b'));return _0x4fbb19;})[_0x9f68('0x26')](function(_0x79d182){var _0x497b58=_0x79d182[_0x9f68('0x51')];logger['info'](_0x9f68('0x5c'),_0x497b58);if(!_[_0x9f68('0x5d')](_0x79d182[_0x9f68('0x51')])&&fs[_0x9f68('0x5e')](_0x497b58)){logger[_0x9f68('0x5f')](_0x9f68('0x60')+_0x497b58+_0x9f68('0x61'));fs['unlinkSync'](_0x497b58);}_0x497b58=_0x497b58+_0x9f68('0x62');if(!_[_0x9f68('0x5d')](_0x79d182[_0x9f68('0x51')])&&fs[_0x9f68('0x5e')](_0x497b58)){logger[_0x9f68('0x5f')](_0x9f68('0x60')+_0x497b58+_0x9f68('0x61'));fs[_0x9f68('0x63')](_0x497b58);}return _0x79d182;})[_0x9f68('0x26')](function(_0x4a1b7c){if(!_0x4a1b7c)throw new InternalError();return _0x4a1b7c['destroy']();})[_0x9f68('0x26')](function(){_0x262a5b[_0x9f68('0x1c')](0xcc)[_0x9f68('0x64')]();})[_0x9f68('0x4a')](handleError(_0x262a5b,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 7af6bb7..75a6d2b 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 _0xa4ee=['./squareRecording.attributes','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x29cd03,_0x4a8f10){var _0x52bad3=function(_0x1f7208){while(--_0x1f7208){_0x29cd03['push'](_0x29cd03['shift']());}};_0x52bad3(++_0x4a8f10);}(_0xa4ee,0xfb));var _0xea4e=function(_0x5930aa,_0xf07ae){_0x5930aa=_0x5930aa-0x0;var _0x274e6c=_0xa4ee[_0x5930aa];return _0x274e6c;};'use strict';var _=require(_0xea4e('0x0'));var util=require('util');var logger=require(_0xea4e('0x1'))(_0xea4e('0x2'));var moment=require(_0xea4e('0x3'));var BPromise=require(_0xea4e('0x4'));var rp=require(_0xea4e('0x5'));var fs=require('fs');var path=require(_0xea4e('0x6'));var rimraf=require(_0xea4e('0x7'));var config=require(_0xea4e('0x8'));var attributes=require(_0xea4e('0x9'));module['exports']=function(_0x2c38e3,_0x5f4ee6){return _0x2c38e3['define']('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72e1=['define','square_recordings','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports'];(function(_0x1e31e8,_0x2ab5e7){var _0x106b73=function(_0x7ffa34){while(--_0x7ffa34){_0x1e31e8['push'](_0x1e31e8['shift']());}};_0x106b73(++_0x2ab5e7);}(_0x72e1,0x178));var _0x172e=function(_0x5bab8e,_0x50d259){_0x5bab8e=_0x5bab8e-0x0;var _0x11c418=_0x72e1[_0x5bab8e];return _0x11c418;};'use strict';var _=require('lodash');var util=require(_0x172e('0x0'));var logger=require(_0x172e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x172e('0x2'));var rp=require(_0x172e('0x3'));var fs=require('fs');var path=require(_0x172e('0x4'));var rimraf=require(_0x172e('0x5'));var config=require(_0x172e('0x6'));var attributes=require(_0x172e('0x7'));module[_0x172e('0x8')]=function(_0x36b211,_0x419f84){return _0x36b211[_0x172e('0x9')]('SquareRecording',attributes,{'tableName':_0x172e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 1503773..8cb44f5 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 _0x4497=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','lodash','util','randomstring','../../mysqldb'];(function(_0x5670cb,_0xe6e20d){var _0x11dc29=function(_0x42305b){while(--_0x42305b){_0x5670cb['push'](_0x5670cb['shift']());}};_0x11dc29(++_0xe6e20d);}(_0x4497,0x1e2));var _0x7449=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0x4497[_0x27604f];return _0x40d189;};'use strict';var _=require(_0x7449('0x0'));var util=require(_0x7449('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7449('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7449('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7449('0x4'))(_0x7449('0x5'));var config=require(_0x7449('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7449('0x7')][_0x7449('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bdc88,_0x3afe69,_0x1e39c4){return new BPromise(function(_0x5ad335,_0x64d9b8){return client[_0x7449('0x9')](_0x3bdc88,_0x1e39c4)[_0x7449('0xa')](function(_0x1872ff){logger[_0x7449('0xb')](_0x7449('0xc'),_0x3afe69,_0x7449('0xd'));logger[_0x7449('0xe')](_0x7449('0xf'),_0x3afe69,_0x7449('0xd'),JSON[_0x7449('0x10')](_0x1872ff));if(_0x1872ff[_0x7449('0x11')]){if(_0x1872ff[_0x7449('0x11')][_0x7449('0x12')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x3afe69,_0x1872ff[_0x7449('0x11')][_0x7449('0x13')]);return _0x64d9b8(_0x1872ff[_0x7449('0x11')][_0x7449('0x13')]);}logger[_0x7449('0x11')]('SquareRecording,\x20%s,\x20%s',_0x3afe69,_0x1872ff[_0x7449('0x11')][_0x7449('0x13')]);return _0x5ad335(_0x1872ff[_0x7449('0x11')][_0x7449('0x13')]);}else{logger[_0x7449('0xb')]('SquareRecording,\x20%s,\x20%s',_0x3afe69,_0x7449('0xd'));_0x5ad335(_0x1872ff[_0x7449('0x14')]['message']);}})[_0x7449('0x15')](function(_0x40dbcd){logger[_0x7449('0x11')]('SquareRecording,\x20%s,\x20%s',_0x3afe69,_0x40dbcd);_0x64d9b8(_0x40dbcd);});});}exports[_0x7449('0x16')]=function(_0x1a208f){var _0x3eb53c=this;return new Promise(function(_0x3c9f56,_0x587ff7){return db[_0x7449('0x17')][_0x7449('0x18')](_0x1a208f['body'],{'raw':_0x1a208f[_0x7449('0x19')]?_0x1a208f['options'][_0x7449('0x1a')]===undefined?!![]:![]:!![]})[_0x7449('0xa')](function(_0x2601e6){logger[_0x7449('0xb')]('CreateSquareRecording',_0x1a208f);logger[_0x7449('0xe')](_0x7449('0x16'),_0x1a208f,JSON['stringify'](_0x2601e6));_0x3c9f56(_0x2601e6);})[_0x7449('0x15')](function(_0x21f646){logger[_0x7449('0x11')](_0x7449('0x16'),_0x21f646[_0x7449('0x13')],_0x1a208f);_0x587ff7(_0x3eb53c[_0x7449('0x11')](0x1f4,_0x21f646[_0x7449('0x13')]));});});}; \ No newline at end of file +var _0x3d87=['message','info','result','CreateSquareRecording','SquareRecording','body','options','raw','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x4be53d,_0x1f1c6e){var _0x1ae3dd=function(_0x5e634e){while(--_0x5e634e){_0x4be53d['push'](_0x4be53d['shift']());}};_0x1ae3dd(++_0x1f1c6e);}(_0x3d87,0x117));var _0x73d8=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x3d87[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x73d8('0x0'));var util=require('util');var moment=require(_0x73d8('0x1'));var BPromise=require(_0x73d8('0x2'));var rs=require(_0x73d8('0x3'));var fs=require('fs');var Redis=require(_0x73d8('0x4'));var db=require(_0x73d8('0x5'))['db'];var utils=require(_0x73d8('0x6'));var logger=require(_0x73d8('0x7'))(_0x73d8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x73d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4603f9,_0x2dcb68,_0x434de9){return new BPromise(function(_0xb9d2cf,_0x31871a){return client[_0x73d8('0xa')](_0x4603f9,_0x434de9)[_0x73d8('0xb')](function(_0x5f1786){logger['info'](_0x73d8('0xc'),_0x2dcb68,_0x73d8('0xd'));logger[_0x73d8('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x2dcb68,_0x73d8('0xd'),JSON[_0x73d8('0xf')](_0x5f1786));if(_0x5f1786[_0x73d8('0x10')]){if(_0x5f1786['error'][_0x73d8('0x11')]===0x1f4){logger[_0x73d8('0x10')](_0x73d8('0xc'),_0x2dcb68,_0x5f1786[_0x73d8('0x10')]['message']);return _0x31871a(_0x5f1786[_0x73d8('0x10')][_0x73d8('0x12')]);}logger[_0x73d8('0x10')](_0x73d8('0xc'),_0x2dcb68,_0x5f1786['error'][_0x73d8('0x12')]);return _0xb9d2cf(_0x5f1786[_0x73d8('0x10')]['message']);}else{logger[_0x73d8('0x13')]('SquareRecording,\x20%s,\x20%s',_0x2dcb68,_0x73d8('0xd'));_0xb9d2cf(_0x5f1786[_0x73d8('0x14')][_0x73d8('0x12')]);}})['catch'](function(_0x59c0be){logger[_0x73d8('0x10')](_0x73d8('0xc'),_0x2dcb68,_0x59c0be);_0x31871a(_0x59c0be);});});}exports[_0x73d8('0x15')]=function(_0x14308b){var _0x5c51e6=this;return new Promise(function(_0x4e3d06,_0x1778e2){return db[_0x73d8('0x16')]['create'](_0x14308b[_0x73d8('0x17')],{'raw':_0x14308b[_0x73d8('0x18')]?_0x14308b['options'][_0x73d8('0x19')]===undefined?!![]:![]:!![]})[_0x73d8('0xb')](function(_0x4db86c){logger[_0x73d8('0x13')](_0x73d8('0x15'),_0x14308b);logger['debug']('CreateSquareRecording',_0x14308b,JSON[_0x73d8('0xf')](_0x4db86c));_0x4e3d06(_0x4db86c);})[_0x73d8('0x1a')](function(_0x1b7104){logger[_0x73d8('0x10')](_0x73d8('0x15'),_0x1b7104[_0x73d8('0x12')],_0x14308b);_0x1778e2(_0x5c51e6[_0x73d8('0x10')](0x1f4,_0x1b7104[_0x73d8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 0382136..7b0eae1 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 _0xd7d4=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x5d2e86,_0x541c1c){var _0x13fb68=function(_0x1cc0ce){while(--_0x1cc0ce){_0x5d2e86['push'](_0x5d2e86['shift']());}};_0x13fb68(++_0x541c1c);}(_0xd7d4,0x175));var _0x4d7d=function(_0x1b3a5c,_0x2f9d5f){_0x1b3a5c=_0x1b3a5c-0x0;var _0x2ae8cb=_0xd7d4[_0x1b3a5c];return _0x2ae8cb;};'use strict';var multer=require(_0x4d7d('0x0'));var util=require(_0x4d7d('0x1'));var path=require(_0x4d7d('0x2'));var timeout=require(_0x4d7d('0x3'));var express=require(_0x4d7d('0x4'));var router=express[_0x4d7d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4d7d('0x6'));var config=require(_0x4d7d('0x7'));var controller=require(_0x4d7d('0x8'));router[_0x4d7d('0x9')]('/',auth['isAuthenticated'](),controller[_0x4d7d('0xa')]);router['get'](_0x4d7d('0xb'),auth[_0x4d7d('0xc')](),controller[_0x4d7d('0xd')]);router[_0x4d7d('0x9')](_0x4d7d('0xe'),auth[_0x4d7d('0xc')](),controller['show']);router[_0x4d7d('0xf')]('/',auth['isAuthenticated'](),controller[_0x4d7d('0x10')]);router[_0x4d7d('0x11')](_0x4d7d('0xe'),auth[_0x4d7d('0xc')](),controller[_0x4d7d('0x12')]);router[_0x4d7d('0x13')]('/:id',auth[_0x4d7d('0xc')](),controller[_0x4d7d('0x14')]);module[_0x4d7d('0x15')]=router; \ No newline at end of file +var _0x7cb2=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReport.controller','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','exports','multer','util'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x7cb2,0x18d));var _0x27cb=function(_0x2d2f18,_0x22540c){_0x2d2f18=_0x2d2f18-0x0;var _0x4dca56=_0x7cb2[_0x2d2f18];return _0x4dca56;};'use strict';var multer=require(_0x27cb('0x0'));var util=require(_0x27cb('0x1'));var path=require(_0x27cb('0x2'));var timeout=require(_0x27cb('0x3'));var express=require(_0x27cb('0x4'));var router=express[_0x27cb('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x27cb('0x6'));var config=require(_0x27cb('0x7'));var controller=require(_0x27cb('0x8'));router['get']('/',auth[_0x27cb('0x9')](),controller[_0x27cb('0xa')]);router['get'](_0x27cb('0xb'),auth[_0x27cb('0x9')](),controller[_0x27cb('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x27cb('0xd')]);router[_0x27cb('0xe')]('/',auth['isAuthenticated'](),controller[_0x27cb('0xf')]);router[_0x27cb('0x10')](_0x27cb('0x11'),auth[_0x27cb('0x9')](),controller[_0x27cb('0x12')]);router['delete'](_0x27cb('0x11'),auth['isAuthenticated'](),controller[_0x27cb('0x13')]);module[_0x27cb('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 4f5a555..a82b5d3 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 _0x6de4=['STRING','DATE','sequelize','exports'];(function(_0x232eb0,_0x2b0ab0){var _0x5b057c=function(_0x13ceea){while(--_0x13ceea){_0x232eb0['push'](_0x232eb0['shift']());}};_0x5b057c(++_0x2b0ab0);}(_0x6de4,0x17a));var _0x46de=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6de4[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x46de('0x0'));module[_0x46de('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x46de('0x2')]},'channel':{'type':Sequelize[_0x46de('0x2')]},'language':{'type':Sequelize[_0x46de('0x2')]},'type':{'type':Sequelize[_0x46de('0x2')]},'uniqueid':{'type':Sequelize[_0x46de('0x2')]},'version':{'type':Sequelize[_0x46de('0x2')]},'callerid':{'type':Sequelize[_0x46de('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x46de('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x46de('0x2')]},'dnid':{'type':Sequelize[_0x46de('0x2')]},'rdnis':{'type':Sequelize[_0x46de('0x2')]},'context':{'type':Sequelize[_0x46de('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x46de('0x2')]},'enhanced':{'type':Sequelize[_0x46de('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x46de('0x2')]},'project_name':{'type':Sequelize[_0x46de('0x2')]},'joinAt':{'type':Sequelize[_0x46de('0x3')]},'leaveAt':{'type':Sequelize[_0x46de('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6a21=['STRING','DATE','exports'];(function(_0x6f565c,_0x936419){var _0x148f7a=function(_0x51662f){while(--_0x51662f){_0x6f565c['push'](_0x6f565c['shift']());}};_0x148f7a(++_0x936419);}(_0x6a21,0x11c));var _0x16a2=function(_0x30b783,_0x5d86ac){_0x30b783=_0x30b783-0x0;var _0xf0a0=_0x6a21[_0x30b783];return _0xf0a0;};'use strict';var Sequelize=require('sequelize');module[_0x16a2('0x0')]={'network':{'type':Sequelize[_0x16a2('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x16a2('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x16a2('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x16a2('0x1')]},'calleridname':{'type':Sequelize[_0x16a2('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x16a2('0x1')]},'callingtns':{'type':Sequelize[_0x16a2('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x16a2('0x1')]},'context':{'type':Sequelize[_0x16a2('0x1')]},'extension':{'type':Sequelize[_0x16a2('0x1')]},'priority':{'type':Sequelize[_0x16a2('0x1')]},'enhanced':{'type':Sequelize[_0x16a2('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x16a2('0x1')]},'project_name':{'type':Sequelize[_0x16a2('0x1')]},'joinAt':{'type':Sequelize[_0x16a2('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'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 e2c22b3..5cbfef4 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 _0xe7cf=['jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','end','status','json','count','offset','set','apply','save','update','then','destroy','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','merge','filter','includeAll','include','findAll','catch','show','length','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x579b51,_0x13b2b8){var _0x166c09=function(_0x33741d){while(--_0x33741d){_0x579b51['push'](_0x579b51['shift']());}};_0x166c09(++_0x13b2b8);}(_0xe7cf,0x199));var _0xfe7c=function(_0x48b8ad,_0xe28403){_0x48b8ad=_0x48b8ad-0x0;var _0x4d1bae=_0xe7cf[_0x48b8ad];return _0x4d1bae;};'use strict';var pdf=require(_0xfe7c('0x0'));var emlformat=require(_0xfe7c('0x1'));var rimraf=require(_0xfe7c('0x2'));var zipdir=require(_0xfe7c('0x3'));var jsonpatch=require(_0xfe7c('0x4'));var rp=require(_0xfe7c('0x5'));var moment=require(_0xfe7c('0x6'));var BPromise=require(_0xfe7c('0x7'));var Mustache=require(_0xfe7c('0x8'));var util=require(_0xfe7c('0x9'));var path=require(_0xfe7c('0xa'));var sox=require(_0xfe7c('0xb'));var csv=require(_0xfe7c('0xc'));var ejs=require(_0xfe7c('0xd'));var fs=require('fs');var _=require(_0xfe7c('0xe'));var squel=require(_0xfe7c('0xf'));var crypto=require(_0xfe7c('0x10'));var jsforce=require(_0xfe7c('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfe7c('0xc'));var querystring=require(_0xfe7c('0x12'));var Papa=require('papaparse');var Redis=require(_0xfe7c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xfe7c('0x14'));var as=require(_0xfe7c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfe7c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfe7c('0x17'))['db'];function respondWithStatusCode(_0x32bc03,_0x11b6a3){_0x11b6a3=_0x11b6a3||0xcc;return function(_0x33d224){if(_0x33d224){return _0x32bc03[_0xfe7c('0x18')](_0x11b6a3);}return _0x32bc03['status'](_0x11b6a3)[_0xfe7c('0x19')]();};}function respondWithResult(_0x258e27,_0x3432dc){_0x3432dc=_0x3432dc||0xc8;return function(_0xb25556){if(_0xb25556){return _0x258e27[_0xfe7c('0x1a')](_0x3432dc)[_0xfe7c('0x1b')](_0xb25556);}};}function respondWithFilteredResult(_0x36ca62,_0x4c63bb){return function(_0x2f7c44){if(_0x2f7c44){var _0x4ee793=_0x2f7c44[_0xfe7c('0x1c')],_0x3650b5=_0x4c63bb['offset'],_0xa7946f=_0x4c63bb[_0xfe7c('0x1d')]+_0x4c63bb['limit'],_0x3e6036;if(_0xa7946f>=_0x4ee793){_0xa7946f=_0x4ee793;_0x3e6036=0xc8;}else{_0x3e6036=0xce;}_0x36ca62[_0xfe7c('0x1a')](_0x3e6036);return _0x36ca62[_0xfe7c('0x1e')]('Content-Range',_0x3650b5+'-'+_0xa7946f+'/'+_0x4ee793)[_0xfe7c('0x1b')](_0x2f7c44);}return null;};}function patchUpdates(_0x36139e){return function(_0xdf4481){try{jsonpatch[_0xfe7c('0x1f')](_0xdf4481,_0x36139e,!![]);}catch(_0x34b87c){return BPromise['reject'](_0x34b87c);}return _0xdf4481[_0xfe7c('0x20')]();};}function saveUpdates(_0x2ea1ce,_0x1f6866){return function(_0x4a1fe8){if(_0x4a1fe8){return _0x4a1fe8[_0xfe7c('0x21')](_0x2ea1ce)[_0xfe7c('0x22')](function(_0x341d86){return _0x341d86;});}return null;};}function removeEntity(_0x3dcaaf,_0x5848fa){return function(_0xa1025b){if(_0xa1025b){return _0xa1025b[_0xfe7c('0x23')]()[_0xfe7c('0x22')](function(){_0x3dcaaf['status'](0xcc)[_0xfe7c('0x19')]();});}};}function handleEntityNotFound(_0x588993,_0x524a8c){return function(_0x3824dc){if(!_0x3824dc){_0x588993['sendStatus'](0x194);}return _0x3824dc;};}function handleError(_0x2b2d16,_0xeb294e){_0xeb294e=_0xeb294e||0x1f4;return function(_0x49ff22){logger[_0xfe7c('0x24')](_0x49ff22['stack']);if(_0x49ff22[_0xfe7c('0x25')]){delete _0x49ff22[_0xfe7c('0x25')];}_0x2b2d16[_0xfe7c('0x1a')](_0xeb294e)[_0xfe7c('0x26')](_0x49ff22);};}exports[_0xfe7c('0x27')]=function(_0x395e64,_0x18f51e){var _0x4fb533={},_0x438fa9={},_0xb40560={'count':0x0,'rows':[]};var _0x100503=_[_0xfe7c('0x28')](db[_0xfe7c('0x29')][_0xfe7c('0x2a')],function(_0x42698a){return{'name':_0x42698a[_0xfe7c('0x2b')],'type':_0x42698a[_0xfe7c('0x2c')]['key']};});_0x438fa9[_0xfe7c('0x2d')]=_[_0xfe7c('0x28')](_0x100503,_0xfe7c('0x25'));_0x438fa9[_0xfe7c('0x2e')]=_['keys'](_0x395e64[_0xfe7c('0x2e')]);_0x438fa9[_0xfe7c('0x2f')]=_[_0xfe7c('0x30')](_0x438fa9[_0xfe7c('0x2d')],_0x438fa9['query']);_0x4fb533['attributes']=_[_0xfe7c('0x30')](_0x438fa9['model'],qs[_0xfe7c('0x31')](_0x395e64[_0xfe7c('0x2e')][_0xfe7c('0x31')]));_0x4fb533[_0xfe7c('0x32')]=_0x4fb533['attributes']['length']?_0x4fb533['attributes']:_0x438fa9[_0xfe7c('0x2d')];if(!_0x395e64[_0xfe7c('0x2e')][_0xfe7c('0x33')](_0xfe7c('0x34'))){_0x4fb533[_0xfe7c('0x35')]=qs[_0xfe7c('0x35')](_0x395e64['query'][_0xfe7c('0x35')]);_0x4fb533['offset']=qs[_0xfe7c('0x1d')](_0x395e64[_0xfe7c('0x2e')][_0xfe7c('0x1d')]);}_0x4fb533[_0xfe7c('0x36')]=qs['sort'](_0x395e64[_0xfe7c('0x2e')][_0xfe7c('0x37')]);_0x4fb533[_0xfe7c('0x38')]=qs[_0xfe7c('0x2f')](_['pick'](_0x395e64[_0xfe7c('0x2e')],_0x438fa9['filters']),_0x100503);if(_0x395e64['query']['filter']){_0x4fb533[_0xfe7c('0x38')]=_[_0xfe7c('0x39')](_0x4fb533[_0xfe7c('0x38')],{'$or':_[_0xfe7c('0x28')](_0x100503,function(_0x28a994){if(_0x28a994['type']!=='VIRTUAL'){var _0x32d437={};_0x32d437[_0x28a994[_0xfe7c('0x25')]]={'$like':'%'+_0x395e64[_0xfe7c('0x2e')][_0xfe7c('0x3a')]+'%'};return _0x32d437;}})});}_0x4fb533=_['merge']({},_0x4fb533,_0x395e64['options']);var _0x4f0a70={'where':_0x4fb533[_0xfe7c('0x38')]};return db[_0xfe7c('0x29')][_0xfe7c('0x1c')](_0x4f0a70)[_0xfe7c('0x22')](function(_0x1fbfd6){_0xb40560[_0xfe7c('0x1c')]=_0x1fbfd6;if(_0x395e64[_0xfe7c('0x2e')][_0xfe7c('0x3b')]){_0x4fb533[_0xfe7c('0x3c')]=[{'all':!![]}];}return db[_0xfe7c('0x29')][_0xfe7c('0x3d')](_0x4fb533);})[_0xfe7c('0x22')](function(_0x10eeb9){_0xb40560['rows']=_0x10eeb9;return _0xb40560;})[_0xfe7c('0x22')](respondWithFilteredResult(_0x18f51e,_0x4fb533))[_0xfe7c('0x3e')](handleError(_0x18f51e,null));};exports[_0xfe7c('0x3f')]=function(_0x25468b,_0x1c605e){var _0x5b5c8e={'raw':!![],'where':{'id':_0x25468b['params']['id']}},_0x11b948={};_0x11b948[_0xfe7c('0x2d')]=_['keys'](db['SquareReport']['rawAttributes']);_0x11b948['query']=_['keys'](_0x25468b[_0xfe7c('0x2e')]);_0x11b948['filters']=_[_0xfe7c('0x30')](_0x11b948[_0xfe7c('0x2d')],_0x11b948[_0xfe7c('0x2e')]);_0x5b5c8e[_0xfe7c('0x32')]=_[_0xfe7c('0x30')](_0x11b948[_0xfe7c('0x2d')],qs['fields'](_0x25468b[_0xfe7c('0x2e')][_0xfe7c('0x31')]));_0x5b5c8e[_0xfe7c('0x32')]=_0x5b5c8e[_0xfe7c('0x32')][_0xfe7c('0x40')]?_0x5b5c8e['attributes']:_0x11b948[_0xfe7c('0x2d')];if(_0x25468b['query'][_0xfe7c('0x3b')]){_0x5b5c8e['include']=[{'all':!![]}];}_0x5b5c8e=_[_0xfe7c('0x39')]({},_0x5b5c8e,_0x25468b[_0xfe7c('0x41')]);return db[_0xfe7c('0x29')][_0xfe7c('0x42')](_0x5b5c8e)[_0xfe7c('0x22')](handleEntityNotFound(_0x1c605e,null))[_0xfe7c('0x22')](respondWithResult(_0x1c605e,null))[_0xfe7c('0x3e')](handleError(_0x1c605e,null));};exports[_0xfe7c('0x43')]=function(_0x36adba,_0x51758a){return db[_0xfe7c('0x29')][_0xfe7c('0x43')](_0x36adba[_0xfe7c('0x44')],{})[_0xfe7c('0x22')](respondWithResult(_0x51758a,0xc9))[_0xfe7c('0x3e')](handleError(_0x51758a,null));};exports[_0xfe7c('0x21')]=function(_0x5d0099,_0x404085){if(_0x5d0099[_0xfe7c('0x44')]['id']){delete _0x5d0099[_0xfe7c('0x44')]['id'];}return db[_0xfe7c('0x29')][_0xfe7c('0x42')]({'where':{'id':_0x5d0099['params']['id']}})['then'](handleEntityNotFound(_0x404085,null))['then'](saveUpdates(_0x5d0099[_0xfe7c('0x44')],null))['then'](respondWithResult(_0x404085,null))[_0xfe7c('0x3e')](handleError(_0x404085,null));};exports[_0xfe7c('0x23')]=function(_0x51352f,_0x187a88){return db[_0xfe7c('0x29')][_0xfe7c('0x42')]({'where':{'id':_0x51352f[_0xfe7c('0x45')]['id']}})[_0xfe7c('0x22')](handleEntityNotFound(_0x187a88,null))[_0xfe7c('0x22')](removeEntity(_0x187a88,null))[_0xfe7c('0x3e')](handleError(_0x187a88,null));};exports[_0xfe7c('0x46')]=function(_0x29fb51,_0x3b7864){return db[_0xfe7c('0x29')]['describe']()['then'](respondWithResult(_0x3b7864,null))['catch'](handleError(_0x3b7864,null));}; \ No newline at end of file +var _0x4ff6=['end','json','count','offset','limit','Content-Range','apply','save','then','destroy','error','name','index','SquareReport','fieldName','key','model','map','query','keys','intersection','attributes','length','nolimit','order','sort','where','pick','filters','filter','type','merge','includeAll','include','findAll','rows','show','params','fields','find','catch','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','status'];(function(_0x7731e4,_0x4157f1){var _0x342df9=function(_0x36bb71){while(--_0x36bb71){_0x7731e4['push'](_0x7731e4['shift']());}};_0x342df9(++_0x4157f1);}(_0x4ff6,0xff));var _0x64ff=function(_0x4771f0,_0x5368c5){_0x4771f0=_0x4771f0-0x0;var _0xd95ada=_0x4ff6[_0x4771f0];return _0xd95ada;};'use strict';var pdf=require(_0x64ff('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x64ff('0x1'));var zipdir=require(_0x64ff('0x2'));var jsonpatch=require(_0x64ff('0x3'));var rp=require(_0x64ff('0x4'));var moment=require(_0x64ff('0x5'));var BPromise=require(_0x64ff('0x6'));var Mustache=require('mustache');var util=require(_0x64ff('0x7'));var path=require(_0x64ff('0x8'));var sox=require(_0x64ff('0x9'));var csv=require('to-csv');var ejs=require(_0x64ff('0xa'));var fs=require('fs');var _=require(_0x64ff('0xb'));var squel=require(_0x64ff('0xc'));var crypto=require(_0x64ff('0xd'));var jsforce=require(_0x64ff('0xe'));var deskjs=require(_0x64ff('0xf'));var toCsv=require(_0x64ff('0x10'));var querystring=require(_0x64ff('0x11'));var Papa=require(_0x64ff('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x64ff('0x13'));var as=require(_0x64ff('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x64ff('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x64ff('0x16'))['db'];function respondWithStatusCode(_0x314f23,_0xd43a1e){_0xd43a1e=_0xd43a1e||0xcc;return function(_0xbadcdf){if(_0xbadcdf){return _0x314f23[_0x64ff('0x17')](_0xd43a1e);}return _0x314f23[_0x64ff('0x18')](_0xd43a1e)[_0x64ff('0x19')]();};}function respondWithResult(_0x1415b7,_0x55d202){_0x55d202=_0x55d202||0xc8;return function(_0x594d90){if(_0x594d90){return _0x1415b7[_0x64ff('0x18')](_0x55d202)[_0x64ff('0x1a')](_0x594d90);}};}function respondWithFilteredResult(_0x2e2797,_0x5cdb4a){return function(_0x289963){if(_0x289963){var _0x55669c=_0x289963[_0x64ff('0x1b')],_0x172fea=_0x5cdb4a[_0x64ff('0x1c')],_0x1e3803=_0x5cdb4a[_0x64ff('0x1c')]+_0x5cdb4a[_0x64ff('0x1d')],_0x525d28;if(_0x1e3803>=_0x55669c){_0x1e3803=_0x55669c;_0x525d28=0xc8;}else{_0x525d28=0xce;}_0x2e2797['status'](_0x525d28);return _0x2e2797['set'](_0x64ff('0x1e'),_0x172fea+'-'+_0x1e3803+'/'+_0x55669c)[_0x64ff('0x1a')](_0x289963);}return null;};}function patchUpdates(_0x1b4af1){return function(_0x2037fa){try{jsonpatch[_0x64ff('0x1f')](_0x2037fa,_0x1b4af1,!![]);}catch(_0x19d53c){return BPromise['reject'](_0x19d53c);}return _0x2037fa[_0x64ff('0x20')]();};}function saveUpdates(_0x59de45,_0x3c619b){return function(_0xe54f51){if(_0xe54f51){return _0xe54f51['update'](_0x59de45)[_0x64ff('0x21')](function(_0x37a21c){return _0x37a21c;});}return null;};}function removeEntity(_0x508492,_0x1ca936){return function(_0x4aa689){if(_0x4aa689){return _0x4aa689[_0x64ff('0x22')]()[_0x64ff('0x21')](function(){_0x508492[_0x64ff('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b5d1c,_0x52f4bf){return function(_0x15bbf5){if(!_0x15bbf5){_0x2b5d1c[_0x64ff('0x17')](0x194);}return _0x15bbf5;};}function handleError(_0x299624,_0x565a46){_0x565a46=_0x565a46||0x1f4;return function(_0x8708e){logger[_0x64ff('0x23')](_0x8708e['stack']);if(_0x8708e[_0x64ff('0x24')]){delete _0x8708e[_0x64ff('0x24')];}_0x299624[_0x64ff('0x18')](_0x565a46)['send'](_0x8708e);};}exports[_0x64ff('0x25')]=function(_0x170550,_0x4e0739){var _0x1304d1={},_0x5255f9={},_0x1ccc3a={'count':0x0,'rows':[]};var _0x3b9a22=_['map'](db[_0x64ff('0x26')]['rawAttributes'],function(_0x35cd89){return{'name':_0x35cd89[_0x64ff('0x27')],'type':_0x35cd89['type'][_0x64ff('0x28')]};});_0x5255f9[_0x64ff('0x29')]=_[_0x64ff('0x2a')](_0x3b9a22,'name');_0x5255f9[_0x64ff('0x2b')]=_[_0x64ff('0x2c')](_0x170550[_0x64ff('0x2b')]);_0x5255f9['filters']=_[_0x64ff('0x2d')](_0x5255f9[_0x64ff('0x29')],_0x5255f9[_0x64ff('0x2b')]);_0x1304d1[_0x64ff('0x2e')]=_['intersection'](_0x5255f9[_0x64ff('0x29')],qs['fields'](_0x170550['query']['fields']));_0x1304d1[_0x64ff('0x2e')]=_0x1304d1['attributes'][_0x64ff('0x2f')]?_0x1304d1[_0x64ff('0x2e')]:_0x5255f9['model'];if(!_0x170550[_0x64ff('0x2b')]['hasOwnProperty'](_0x64ff('0x30'))){_0x1304d1[_0x64ff('0x1d')]=qs[_0x64ff('0x1d')](_0x170550[_0x64ff('0x2b')][_0x64ff('0x1d')]);_0x1304d1[_0x64ff('0x1c')]=qs['offset'](_0x170550[_0x64ff('0x2b')][_0x64ff('0x1c')]);}_0x1304d1[_0x64ff('0x31')]=qs[_0x64ff('0x32')](_0x170550[_0x64ff('0x2b')][_0x64ff('0x32')]);_0x1304d1[_0x64ff('0x33')]=qs['filters'](_[_0x64ff('0x34')](_0x170550[_0x64ff('0x2b')],_0x5255f9[_0x64ff('0x35')]),_0x3b9a22);if(_0x170550[_0x64ff('0x2b')][_0x64ff('0x36')]){_0x1304d1[_0x64ff('0x33')]=_['merge'](_0x1304d1[_0x64ff('0x33')],{'$or':_['map'](_0x3b9a22,function(_0x4b073c){if(_0x4b073c[_0x64ff('0x37')]!=='VIRTUAL'){var _0x48c250={};_0x48c250[_0x4b073c[_0x64ff('0x24')]]={'$like':'%'+_0x170550[_0x64ff('0x2b')]['filter']+'%'};return _0x48c250;}})});}_0x1304d1=_[_0x64ff('0x38')]({},_0x1304d1,_0x170550['options']);var _0x21d07b={'where':_0x1304d1[_0x64ff('0x33')]};return db['SquareReport']['count'](_0x21d07b)[_0x64ff('0x21')](function(_0x58ec6d){_0x1ccc3a[_0x64ff('0x1b')]=_0x58ec6d;if(_0x170550[_0x64ff('0x2b')][_0x64ff('0x39')]){_0x1304d1[_0x64ff('0x3a')]=[{'all':!![]}];}return db[_0x64ff('0x26')][_0x64ff('0x3b')](_0x1304d1);})[_0x64ff('0x21')](function(_0x3cf4ea){_0x1ccc3a[_0x64ff('0x3c')]=_0x3cf4ea;return _0x1ccc3a;})['then'](respondWithFilteredResult(_0x4e0739,_0x1304d1))['catch'](handleError(_0x4e0739,null));};exports[_0x64ff('0x3d')]=function(_0x18a521,_0x37e225){var _0x2ffcb3={'raw':!![],'where':{'id':_0x18a521[_0x64ff('0x3e')]['id']}},_0x1bc45d={};_0x1bc45d['model']=_['keys'](db[_0x64ff('0x26')]['rawAttributes']);_0x1bc45d[_0x64ff('0x2b')]=_[_0x64ff('0x2c')](_0x18a521[_0x64ff('0x2b')]);_0x1bc45d[_0x64ff('0x35')]=_[_0x64ff('0x2d')](_0x1bc45d[_0x64ff('0x29')],_0x1bc45d[_0x64ff('0x2b')]);_0x2ffcb3[_0x64ff('0x2e')]=_[_0x64ff('0x2d')](_0x1bc45d[_0x64ff('0x29')],qs[_0x64ff('0x3f')](_0x18a521[_0x64ff('0x2b')][_0x64ff('0x3f')]));_0x2ffcb3[_0x64ff('0x2e')]=_0x2ffcb3['attributes']['length']?_0x2ffcb3['attributes']:_0x1bc45d[_0x64ff('0x29')];if(_0x18a521[_0x64ff('0x2b')][_0x64ff('0x39')]){_0x2ffcb3['include']=[{'all':!![]}];}_0x2ffcb3=_[_0x64ff('0x38')]({},_0x2ffcb3,_0x18a521['options']);return db[_0x64ff('0x26')][_0x64ff('0x40')](_0x2ffcb3)[_0x64ff('0x21')](handleEntityNotFound(_0x37e225,null))[_0x64ff('0x21')](respondWithResult(_0x37e225,null))[_0x64ff('0x41')](handleError(_0x37e225,null));};exports[_0x64ff('0x42')]=function(_0x5c966c,_0x1e2a26){return db[_0x64ff('0x26')][_0x64ff('0x42')](_0x5c966c[_0x64ff('0x43')],{})[_0x64ff('0x21')](respondWithResult(_0x1e2a26,0xc9))[_0x64ff('0x41')](handleError(_0x1e2a26,null));};exports[_0x64ff('0x44')]=function(_0x48dfbd,_0x1f1d5e){if(_0x48dfbd[_0x64ff('0x43')]['id']){delete _0x48dfbd['body']['id'];}return db[_0x64ff('0x26')][_0x64ff('0x40')]({'where':{'id':_0x48dfbd[_0x64ff('0x3e')]['id']}})[_0x64ff('0x21')](handleEntityNotFound(_0x1f1d5e,null))[_0x64ff('0x21')](saveUpdates(_0x48dfbd[_0x64ff('0x43')],null))['then'](respondWithResult(_0x1f1d5e,null))[_0x64ff('0x41')](handleError(_0x1f1d5e,null));};exports[_0x64ff('0x22')]=function(_0x39894d,_0x79c641){return db[_0x64ff('0x26')][_0x64ff('0x40')]({'where':{'id':_0x39894d[_0x64ff('0x3e')]['id']}})[_0x64ff('0x21')](handleEntityNotFound(_0x79c641,null))[_0x64ff('0x21')](removeEntity(_0x79c641,null))[_0x64ff('0x41')](handleError(_0x79c641,null));};exports[_0x64ff('0x45')]=function(_0x3c4408,_0xe2f7e6){return db[_0x64ff('0x26')][_0x64ff('0x45')]()[_0x64ff('0x21')](respondWithResult(_0xe2f7e6,null))[_0x64ff('0x41')](handleError(_0xe2f7e6,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1165e78..ced14a6 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 _0x8c5d=['define','SquareReport','report_square','uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./squareReport.attributes'];(function(_0x30af23,_0x1b9d6a){var _0x5cea96=function(_0x31be06){while(--_0x31be06){_0x30af23['push'](_0x30af23['shift']());}};_0x5cea96(++_0x1b9d6a);}(_0x8c5d,0x123));var _0xd8c5=function(_0x1c9a45,_0x2aa54c){_0x1c9a45=_0x1c9a45-0x0;var _0x20f251=_0x8c5d[_0x1c9a45];return _0x20f251;};'use strict';var _=require(_0xd8c5('0x0'));var util=require(_0xd8c5('0x1'));var logger=require(_0xd8c5('0x2'))(_0xd8c5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd8c5('0x4'));var fs=require('fs');var path=require(_0xd8c5('0x5'));var rimraf=require(_0xd8c5('0x6'));var config=require(_0xd8c5('0x7'));var attributes=require(_0xd8c5('0x8'));module['exports']=function(_0x1b0afe,_0x26c52c){return _0x1b0afe[_0xd8c5('0x9')](_0xd8c5('0xa'),attributes,{'tableName':_0xd8c5('0xb'),'paranoid':![],'indexes':[{'name':_0xd8c5('0xc'),'fields':[_0xd8c5('0xd'),'project_name']},{'name':_0xd8c5('0xe'),'fields':[_0xd8c5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d46=['request-promise','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','moment','bluebird'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2d46,0x1be));var _0x62d4=function(_0x5235af,_0x428a33){_0x5235af=_0x5235af-0x0;var _0x3469c6=_0x2d46[_0x5235af];return _0x3469c6;};'use strict';var _=require(_0x62d4('0x0'));var util=require(_0x62d4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x62d4('0x2'));var BPromise=require(_0x62d4('0x3'));var rp=require(_0x62d4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x62d4('0x5'));var config=require(_0x62d4('0x6'));var attributes=require(_0x62d4('0x7'));module['exports']=function(_0x3f49e2,_0x51585c){return _0x3f49e2[_0x62d4('0x8')](_0x62d4('0x9'),attributes,{'tableName':_0x62d4('0xa'),'paranoid':![],'indexes':[{'name':_0x62d4('0xb'),'fields':[_0x62d4('0xc'),_0x62d4('0xd')]},{'name':_0x62d4('0xe'),'fields':[_0x62d4('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 813ba62..92c4f33 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 _0x42f8=['options','raw','UpdateSquareReport','update','body','where','attributes','limit','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create'];(function(_0x36a2ed,_0x3815d4){var _0x2b7be4=function(_0x19a0e4){while(--_0x19a0e4){_0x36a2ed['push'](_0x36a2ed['shift']());}};_0x2b7be4(++_0x3815d4);}(_0x42f8,0x1d0));var _0x842f=function(_0x5d4765,_0x23cb35){_0x5d4765=_0x5d4765-0x0;var _0x41d345=_0x42f8[_0x5d4765];return _0x41d345;};'use strict';var _=require(_0x842f('0x0'));var util=require(_0x842f('0x1'));var moment=require(_0x842f('0x2'));var BPromise=require(_0x842f('0x3'));var rs=require(_0x842f('0x4'));var fs=require('fs');var Redis=require(_0x842f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x842f('0x6'));var logger=require('../../config/logger')(_0x842f('0x7'));var config=require('../../config/environment');var jayson=require(_0x842f('0x8'));var client=jayson[_0x842f('0x9')][_0x842f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x527828,_0x3486ea,_0x5cd959){return new BPromise(function(_0x315534,_0x35a1f8){return client[_0x842f('0xb')](_0x527828,_0x5cd959)[_0x842f('0xc')](function(_0x192d95){logger['info'](_0x842f('0xd'),_0x3486ea,_0x842f('0xe'));logger[_0x842f('0xf')](_0x842f('0x10'),_0x3486ea,'request\x20sent',JSON[_0x842f('0x11')](_0x192d95));if(_0x192d95['error']){if(_0x192d95[_0x842f('0x12')][_0x842f('0x13')]===0x1f4){logger[_0x842f('0x12')](_0x842f('0xd'),_0x3486ea,_0x192d95[_0x842f('0x12')][_0x842f('0x14')]);return _0x35a1f8(_0x192d95[_0x842f('0x12')][_0x842f('0x14')]);}logger[_0x842f('0x12')](_0x842f('0xd'),_0x3486ea,_0x192d95['error'][_0x842f('0x14')]);return _0x315534(_0x192d95[_0x842f('0x12')][_0x842f('0x14')]);}else{logger['info'](_0x842f('0xd'),_0x3486ea,_0x842f('0xe'));_0x315534(_0x192d95[_0x842f('0x15')][_0x842f('0x14')]);}})[_0x842f('0x16')](function(_0x1a827a){logger[_0x842f('0x12')](_0x842f('0xd'),_0x3486ea,_0x1a827a);_0x35a1f8(_0x1a827a);});});}exports[_0x842f('0x17')]=function(_0x7b107c){var _0x3da415=this;return new Promise(function(_0x5bfecc,_0x4378d2){return db[_0x842f('0x18')][_0x842f('0x19')](_0x7b107c['body'],{'raw':_0x7b107c[_0x842f('0x1a')]?_0x7b107c[_0x842f('0x1a')][_0x842f('0x1b')]===undefined?!![]:![]:!![]})[_0x842f('0xc')](function(_0x2424ca){logger['info'](_0x842f('0x17'),_0x7b107c);logger[_0x842f('0xf')](_0x842f('0x17'),_0x7b107c,JSON[_0x842f('0x11')](_0x2424ca));_0x5bfecc(_0x2424ca);})[_0x842f('0x16')](function(_0x2c4c8c){logger[_0x842f('0x12')]('CreateSquareReport',_0x2c4c8c['message'],_0x7b107c);_0x4378d2(_0x3da415[_0x842f('0x12')](0x1f4,_0x2c4c8c[_0x842f('0x14')]));});});};exports[_0x842f('0x1c')]=function(_0x134795){var _0x418c1c=this;return new Promise(function(_0xc007da,_0x41d152){return db[_0x842f('0x18')][_0x842f('0x1d')](_0x134795[_0x842f('0x1e')],{'raw':_0x134795['options']?_0x134795[_0x842f('0x1a')][_0x842f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x134795['options']?_0x134795[_0x842f('0x1a')][_0x842f('0x1f')]||null:null,'attributes':_0x134795[_0x842f('0x1a')]?_0x134795[_0x842f('0x1a')][_0x842f('0x20')]||null:null,'limit':_0x134795[_0x842f('0x1a')]?_0x134795['options'][_0x842f('0x21')]||null:null})['then'](function(_0x4b96c9){logger[_0x842f('0x22')]('UpdateSquareReport',_0x134795);logger['debug'](_0x842f('0x1c'),_0x134795,JSON[_0x842f('0x11')](_0x4b96c9));_0xc007da(_0x4b96c9);})['catch'](function(_0x4ac1a4){logger[_0x842f('0x12')]('UpdateSquareReport',_0x4ac1a4[_0x842f('0x14')],_0x134795);_0x41d152(_0x418c1c[_0x842f('0x12')](0x1f4,_0x4ac1a4[_0x842f('0x14')]));});});}; \ No newline at end of file +var _0x971f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareReport','create','body','options','raw','then','CreateSquareReport','UpdateSquareReport','update','where','attributes','limit','lodash'];(function(_0xd172cf,_0x7df1f9){var _0x4a020e=function(_0x548d6a){while(--_0x548d6a){_0xd172cf['push'](_0xd172cf['shift']());}};_0x4a020e(++_0x7df1f9);}(_0x971f,0x196));var _0xf971=function(_0x38b443,_0x48f827){_0x38b443=_0x38b443-0x0;var _0x375d7a=_0x971f[_0x38b443];return _0x375d7a;};'use strict';var _=require(_0xf971('0x0'));var util=require('util');var moment=require(_0xf971('0x1'));var BPromise=require(_0xf971('0x2'));var rs=require(_0xf971('0x3'));var fs=require('fs');var Redis=require(_0xf971('0x4'));var db=require(_0xf971('0x5'))['db'];var utils=require(_0xf971('0x6'));var logger=require(_0xf971('0x7'))(_0xf971('0x8'));var config=require(_0xf971('0x9'));var jayson=require(_0xf971('0xa'));var client=jayson[_0xf971('0xb')][_0xf971('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x37e85f,_0x22ee1d,_0x247c42){return new BPromise(function(_0x3a9a20,_0x4f56d8){return client[_0xf971('0xd')](_0x37e85f,_0x247c42)['then'](function(_0x261733){logger[_0xf971('0xe')](_0xf971('0xf'),_0x22ee1d,_0xf971('0x10'));logger[_0xf971('0x11')](_0xf971('0x12'),_0x22ee1d,_0xf971('0x10'),JSON[_0xf971('0x13')](_0x261733));if(_0x261733[_0xf971('0x14')]){if(_0x261733['error'][_0xf971('0x15')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x22ee1d,_0x261733['error'][_0xf971('0x16')]);return _0x4f56d8(_0x261733[_0xf971('0x14')]['message']);}logger['error']('SquareReport,\x20%s,\x20%s',_0x22ee1d,_0x261733[_0xf971('0x14')]['message']);return _0x3a9a20(_0x261733[_0xf971('0x14')]['message']);}else{logger[_0xf971('0xe')](_0xf971('0xf'),_0x22ee1d,_0xf971('0x10'));_0x3a9a20(_0x261733[_0xf971('0x17')]['message']);}})[_0xf971('0x18')](function(_0x5ec192){logger[_0xf971('0x14')](_0xf971('0xf'),_0x22ee1d,_0x5ec192);_0x4f56d8(_0x5ec192);});});}exports['CreateSquareReport']=function(_0x273a13){var _0x4b35e5=this;return new Promise(function(_0x5b9991,_0x1fe462){return db[_0xf971('0x19')][_0xf971('0x1a')](_0x273a13[_0xf971('0x1b')],{'raw':_0x273a13[_0xf971('0x1c')]?_0x273a13['options'][_0xf971('0x1d')]===undefined?!![]:![]:!![]})[_0xf971('0x1e')](function(_0x2dd5e5){logger[_0xf971('0xe')](_0xf971('0x1f'),_0x273a13);logger['debug'](_0xf971('0x1f'),_0x273a13,JSON[_0xf971('0x13')](_0x2dd5e5));_0x5b9991(_0x2dd5e5);})['catch'](function(_0x292a1c){logger['error'](_0xf971('0x1f'),_0x292a1c[_0xf971('0x16')],_0x273a13);_0x1fe462(_0x4b35e5[_0xf971('0x14')](0x1f4,_0x292a1c[_0xf971('0x16')]));});});};exports[_0xf971('0x20')]=function(_0x230e9b){var _0x510908=this;return new Promise(function(_0x575ce8,_0x33b33b){return db['SquareReport'][_0xf971('0x21')](_0x230e9b['body'],{'raw':_0x230e9b[_0xf971('0x1c')]?_0x230e9b[_0xf971('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x230e9b[_0xf971('0x1c')]?_0x230e9b['options'][_0xf971('0x22')]||null:null,'attributes':_0x230e9b[_0xf971('0x1c')]?_0x230e9b[_0xf971('0x1c')][_0xf971('0x23')]||null:null,'limit':_0x230e9b['options']?_0x230e9b[_0xf971('0x1c')][_0xf971('0x24')]||null:null})[_0xf971('0x1e')](function(_0x5b8a76){logger[_0xf971('0xe')]('UpdateSquareReport',_0x230e9b);logger[_0xf971('0x11')]('UpdateSquareReport',_0x230e9b,JSON[_0xf971('0x13')](_0x5b8a76));_0x575ce8(_0x5b8a76);})[_0xf971('0x18')](function(_0x40ea75){logger[_0xf971('0x14')](_0xf971('0x20'),_0x40ea75[_0xf971('0x16')],_0x230e9b);_0x33b33b(_0x510908[_0xf971('0x14')](0x1f4,_0x40ea75[_0xf971('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index b8d0f17..7678635 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x3c09b1,_0x5b250f){var _0x5b1322=function(_0x97a49d){while(--_0x97a49d){_0x3c09b1['push'](_0x3c09b1['shift']());}};_0x5b1322(++_0x5b250f);}(_0x7a54,0x106));var _0x47a5=function(_0x59035f,_0x4172b4){_0x59035f=_0x59035f-0x0;var _0x4c1d16=_0x7a54[_0x59035f];return _0x4c1d16;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x2ea8f3,_0x3a1d7e){var _0x3e52b0=function(_0x361469){while(--_0x361469){_0x2ea8f3['push'](_0x2ea8f3['shift']());}};_0x3e52b0(++_0x3a1d7e);}(_0x7a54,0x106));var _0x47a5=function(_0x33a64d,_0x66e197){_0x33a64d=_0x33a64d-0x0;var _0x5d72c5=_0x7a54[_0x33a64d];return _0x5d72c5;};'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 c4023e3..1dae283 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 _0xa7a5=['STRING','sequelize'];(function(_0x3077cc,_0x35a7b6){var _0x478d80=function(_0x504d56){while(--_0x504d56){_0x3077cc['push'](_0x3077cc['shift']());}};_0x478d80(++_0x35a7b6);}(_0xa7a5,0x127));var _0x5a7a=function(_0x5c26e2,_0x219e65){_0x5c26e2=_0x5c26e2-0x0;var _0x458898=_0xa7a5[_0x5c26e2];return _0x458898;};'use strict';var Sequelize=require(_0x5a7a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5a7a('0x1')]},'node':{'type':Sequelize[_0x5a7a('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x5a7a('0x1')]},'callerid':{'type':Sequelize[_0x5a7a('0x1')]}}; \ No newline at end of file +var _0xcd10=['exports','STRING','TEXT','sequelize'];(function(_0x42f270,_0x452dec){var _0x57bc5b=function(_0x258159){while(--_0x258159){_0x42f270['push'](_0x42f270['shift']());}};_0x57bc5b(++_0x452dec);}(_0xcd10,0x10b));var _0x0cd1=function(_0xca52fe,_0x4f073e){_0xca52fe=_0xca52fe-0x0;var _0x45d265=_0xcd10[_0xca52fe];return _0x45d265;};'use strict';var Sequelize=require(_0x0cd1('0x0'));module[_0x0cd1('0x1')]={'uniqueid':{'type':Sequelize[_0x0cd1('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x0cd1('0x2')]},'data':{'type':Sequelize[_0x0cd1('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index e578455..f3a20d6 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 _0xd169=['sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','index','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','SquareDetailsReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x59342a,_0x16827b){var _0x17abc9=function(_0x2f7bfc){while(--_0x2f7bfc){_0x59342a['push'](_0x59342a['shift']());}};_0x17abc9(++_0x16827b);}(_0xd169,0x164));var _0x9d16=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xd169[_0x38ced4];return _0x547c07;};'use strict';var pdf=require(_0x9d16('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9d16('0x1'));var zipdir=require(_0x9d16('0x2'));var jsonpatch=require(_0x9d16('0x3'));var rp=require(_0x9d16('0x4'));var moment=require(_0x9d16('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9d16('0x6'));var util=require(_0x9d16('0x7'));var path=require(_0x9d16('0x8'));var sox=require(_0x9d16('0x9'));var csv=require('to-csv');var ejs=require(_0x9d16('0xa'));var fs=require('fs');var _=require(_0x9d16('0xb'));var squel=require(_0x9d16('0xc'));var crypto=require(_0x9d16('0xd'));var jsforce=require(_0x9d16('0xe'));var deskjs=require(_0x9d16('0xf'));var toCsv=require(_0x9d16('0x10'));var querystring=require(_0x9d16('0x11'));var Papa=require(_0x9d16('0x12'));var Redis=require(_0x9d16('0x13'));var authService=require(_0x9d16('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d16('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9d16('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x342082,_0x2cd914){_0x2cd914=_0x2cd914||0xcc;return function(_0x445377){if(_0x445377){return _0x342082[_0x9d16('0x17')](_0x2cd914);}return _0x342082[_0x9d16('0x18')](_0x2cd914)[_0x9d16('0x19')]();};}function respondWithResult(_0x4982a9,_0x543ac5){_0x543ac5=_0x543ac5||0xc8;return function(_0x14f9f9){if(_0x14f9f9){return _0x4982a9[_0x9d16('0x18')](_0x543ac5)[_0x9d16('0x1a')](_0x14f9f9);}};}function respondWithFilteredResult(_0x27c136,_0x444dd0){return function(_0x3e5ce9){if(_0x3e5ce9){var _0x465b8a=_0x3e5ce9[_0x9d16('0x1b')],_0x497267=_0x444dd0[_0x9d16('0x1c')],_0x2d6d1d=_0x444dd0[_0x9d16('0x1c')]+_0x444dd0[_0x9d16('0x1d')],_0x1b525f;if(_0x2d6d1d>=_0x465b8a){_0x2d6d1d=_0x465b8a;_0x1b525f=0xc8;}else{_0x1b525f=0xce;}_0x27c136[_0x9d16('0x18')](_0x1b525f);return _0x27c136[_0x9d16('0x1e')](_0x9d16('0x1f'),_0x497267+'-'+_0x2d6d1d+'/'+_0x465b8a)[_0x9d16('0x1a')](_0x3e5ce9);}return null;};}function patchUpdates(_0x32cb72){return function(_0x2a9a4e){try{jsonpatch['apply'](_0x2a9a4e,_0x32cb72,!![]);}catch(_0x5e9e49){return BPromise[_0x9d16('0x20')](_0x5e9e49);}return _0x2a9a4e[_0x9d16('0x21')]();};}function saveUpdates(_0x585f5c,_0x4edeab){return function(_0x513097){if(_0x513097){return _0x513097[_0x9d16('0x22')](_0x585f5c)[_0x9d16('0x23')](function(_0x456a03){return _0x456a03;});}return null;};}function removeEntity(_0x3a8b09,_0x4eacbf){return function(_0x48c835){if(_0x48c835){return _0x48c835['destroy']()[_0x9d16('0x23')](function(){_0x3a8b09[_0x9d16('0x18')](0xcc)[_0x9d16('0x19')]();});}};}function handleEntityNotFound(_0x4d8b5d,_0x4de43c){return function(_0x85751e){if(!_0x85751e){_0x4d8b5d[_0x9d16('0x17')](0x194);}return _0x85751e;};}function handleError(_0x4dccf0,_0x4c5ba6){_0x4c5ba6=_0x4c5ba6||0x1f4;return function(_0x3151e3){logger[_0x9d16('0x24')](_0x3151e3[_0x9d16('0x25')]);if(_0x3151e3[_0x9d16('0x26')]){delete _0x3151e3[_0x9d16('0x26')];}_0x4dccf0[_0x9d16('0x18')](_0x4c5ba6)['send'](_0x3151e3);};}exports[_0x9d16('0x27')]=function(_0x78cb57,_0xe9025f){var _0x21bc9c={},_0x453821={},_0x5064b1={'count':0x0,'rows':[]};var _0x67c2d9=_['map'](db['SquareDetailsReport']['rawAttributes'],function(_0x37a310){return{'name':_0x37a310[_0x9d16('0x28')],'type':_0x37a310[_0x9d16('0x29')][_0x9d16('0x2a')]};});_0x453821['model']=_[_0x9d16('0x2b')](_0x67c2d9,_0x9d16('0x26'));_0x453821[_0x9d16('0x2c')]=_[_0x9d16('0x2d')](_0x78cb57[_0x9d16('0x2c')]);_0x453821[_0x9d16('0x2e')]=_[_0x9d16('0x2f')](_0x453821[_0x9d16('0x30')],_0x453821[_0x9d16('0x2c')]);_0x21bc9c['attributes']=_[_0x9d16('0x2f')](_0x453821['model'],qs[_0x9d16('0x31')](_0x78cb57[_0x9d16('0x2c')][_0x9d16('0x31')]));_0x21bc9c[_0x9d16('0x32')]=_0x21bc9c['attributes'][_0x9d16('0x33')]?_0x21bc9c[_0x9d16('0x32')]:_0x453821[_0x9d16('0x30')];if(!_0x78cb57['query'][_0x9d16('0x34')](_0x9d16('0x35'))){_0x21bc9c['limit']=qs['limit'](_0x78cb57[_0x9d16('0x2c')][_0x9d16('0x1d')]);_0x21bc9c[_0x9d16('0x1c')]=qs['offset'](_0x78cb57['query']['offset']);}_0x21bc9c[_0x9d16('0x36')]=qs[_0x9d16('0x37')](_0x78cb57['query'][_0x9d16('0x37')]);_0x21bc9c[_0x9d16('0x38')]=qs[_0x9d16('0x2e')](_['pick'](_0x78cb57['query'],_0x453821['filters']),_0x67c2d9);if(_0x78cb57[_0x9d16('0x2c')][_0x9d16('0x39')]){_0x21bc9c[_0x9d16('0x38')]=_[_0x9d16('0x3a')](_0x21bc9c['where'],{'$or':_[_0x9d16('0x2b')](_0x67c2d9,function(_0x38022e){if(_0x38022e[_0x9d16('0x29')]!=='VIRTUAL'){var _0x479ab8={};_0x479ab8[_0x38022e['name']]={'$like':'%'+_0x78cb57[_0x9d16('0x2c')][_0x9d16('0x39')]+'%'};return _0x479ab8;}})});}_0x21bc9c=_[_0x9d16('0x3a')]({},_0x21bc9c,_0x78cb57[_0x9d16('0x3b')]);var _0x2df555={'where':_0x21bc9c[_0x9d16('0x38')]};return db[_0x9d16('0x3c')][_0x9d16('0x1b')](_0x2df555)[_0x9d16('0x23')](function(_0x2d0ead){_0x5064b1[_0x9d16('0x1b')]=_0x2d0ead;if(_0x78cb57[_0x9d16('0x2c')][_0x9d16('0x3d')]){_0x21bc9c[_0x9d16('0x3e')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x9d16('0x3f')](_0x21bc9c);})[_0x9d16('0x23')](function(_0x50b563){_0x5064b1[_0x9d16('0x40')]=_0x50b563;return _0x5064b1;})[_0x9d16('0x23')](respondWithFilteredResult(_0xe9025f,_0x21bc9c))[_0x9d16('0x41')](handleError(_0xe9025f,null));};exports[_0x9d16('0x42')]=function(_0x333ac2,_0x49d17f){var _0x2034f0={'raw':!![],'where':{'id':_0x333ac2[_0x9d16('0x43')]['id']}},_0x288f48={};_0x288f48[_0x9d16('0x30')]=_[_0x9d16('0x2d')](db['SquareDetailsReport'][_0x9d16('0x44')]);_0x288f48[_0x9d16('0x2c')]=_[_0x9d16('0x2d')](_0x333ac2['query']);_0x288f48[_0x9d16('0x2e')]=_['intersection'](_0x288f48[_0x9d16('0x30')],_0x288f48[_0x9d16('0x2c')]);_0x2034f0[_0x9d16('0x32')]=_[_0x9d16('0x2f')](_0x288f48[_0x9d16('0x30')],qs[_0x9d16('0x31')](_0x333ac2['query']['fields']));_0x2034f0[_0x9d16('0x32')]=_0x2034f0[_0x9d16('0x32')][_0x9d16('0x33')]?_0x2034f0[_0x9d16('0x32')]:_0x288f48[_0x9d16('0x30')];if(_0x333ac2[_0x9d16('0x2c')][_0x9d16('0x3d')]){_0x2034f0[_0x9d16('0x3e')]=[{'all':!![]}];}_0x2034f0=_['merge']({},_0x2034f0,_0x333ac2[_0x9d16('0x3b')]);return db[_0x9d16('0x3c')][_0x9d16('0x45')](_0x2034f0)[_0x9d16('0x23')](handleEntityNotFound(_0x49d17f,null))['then'](respondWithResult(_0x49d17f,null))[_0x9d16('0x41')](handleError(_0x49d17f,null));};exports[_0x9d16('0x46')]=function(_0x137830,_0x2aaf1a){return db[_0x9d16('0x3c')][_0x9d16('0x46')](_0x137830[_0x9d16('0x47')],{})['then'](respondWithResult(_0x2aaf1a,0xc9))['catch'](handleError(_0x2aaf1a,null));};exports[_0x9d16('0x22')]=function(_0x4fdf64,_0x8eea70){if(_0x4fdf64[_0x9d16('0x47')]['id']){delete _0x4fdf64['body']['id'];}return db['SquareDetailsReport'][_0x9d16('0x45')]({'where':{'id':_0x4fdf64[_0x9d16('0x43')]['id']}})[_0x9d16('0x23')](handleEntityNotFound(_0x8eea70,null))[_0x9d16('0x23')](saveUpdates(_0x4fdf64[_0x9d16('0x47')],null))[_0x9d16('0x23')](respondWithResult(_0x8eea70,null))[_0x9d16('0x41')](handleError(_0x8eea70,null));};exports[_0x9d16('0x48')]=function(_0x4bed1f,_0x2892cf){return db[_0x9d16('0x3c')][_0x9d16('0x45')]({'where':{'id':_0x4bed1f[_0x9d16('0x43')]['id']}})[_0x9d16('0x23')](handleEntityNotFound(_0x2892cf,null))[_0x9d16('0x23')](removeEntity(_0x2892cf,null))[_0x9d16('0x41')](handleError(_0x2892cf,null));};exports['describe']=function(_0x3eb44d,_0x4f141c){return db[_0x9d16('0x3c')]['describe']()[_0x9d16('0x23')](respondWithResult(_0x4f141c,null))[_0x9d16('0x41')](handleError(_0x4f141c,null));}; \ No newline at end of file +var _0xba69=['show','params','create','body','update','find','describe','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','destroy','then','error','name','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch'];(function(_0x4fff86,_0x3d4c4d){var _0x3ea3bd=function(_0x593c48){while(--_0x593c48){_0x4fff86['push'](_0x4fff86['shift']());}};_0x3ea3bd(++_0x3d4c4d);}(_0xba69,0x11b));var _0x9ba6=function(_0x3efa8c,_0x453777){_0x3efa8c=_0x3efa8c-0x0;var _0x22fd4a=_0xba69[_0x3efa8c];return _0x22fd4a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9ba6('0x0'));var zipdir=require(_0x9ba6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ba6('0x2'));var moment=require(_0x9ba6('0x3'));var BPromise=require(_0x9ba6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9ba6('0x5'));var sox=require('sox');var csv=require(_0x9ba6('0x6'));var ejs=require(_0x9ba6('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9ba6('0x8'));var crypto=require(_0x9ba6('0x9'));var jsforce=require(_0x9ba6('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ba6('0xb'));var Papa=require(_0x9ba6('0xc'));var Redis=require(_0x9ba6('0xd'));var authService=require(_0x9ba6('0xe'));var qs=require(_0x9ba6('0xf'));var as=require(_0x9ba6('0x10'));var hardwareService=require(_0x9ba6('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x9ba6('0x12'));var config=require(_0x9ba6('0x13'));var db=require(_0x9ba6('0x14'))['db'];function respondWithStatusCode(_0x19cd8d,_0x53495c){_0x53495c=_0x53495c||0xcc;return function(_0x19b467){if(_0x19b467){return _0x19cd8d[_0x9ba6('0x15')](_0x53495c);}return _0x19cd8d[_0x9ba6('0x16')](_0x53495c)[_0x9ba6('0x17')]();};}function respondWithResult(_0x194a96,_0x1ccb75){_0x1ccb75=_0x1ccb75||0xc8;return function(_0x113008){if(_0x113008){return _0x194a96[_0x9ba6('0x16')](_0x1ccb75)[_0x9ba6('0x18')](_0x113008);}};}function respondWithFilteredResult(_0x3c612c,_0x3b5fcb){return function(_0x32f85e){if(_0x32f85e){var _0x2d5656=_0x32f85e['count'],_0x1058ed=_0x3b5fcb[_0x9ba6('0x19')],_0xac6fef=_0x3b5fcb[_0x9ba6('0x19')]+_0x3b5fcb['limit'],_0x460903;if(_0xac6fef>=_0x2d5656){_0xac6fef=_0x2d5656;_0x460903=0xc8;}else{_0x460903=0xce;}_0x3c612c[_0x9ba6('0x16')](_0x460903);return _0x3c612c[_0x9ba6('0x1a')](_0x9ba6('0x1b'),_0x1058ed+'-'+_0xac6fef+'/'+_0x2d5656)[_0x9ba6('0x18')](_0x32f85e);}return null;};}function patchUpdates(_0x2f0c77){return function(_0x4c629d){try{jsonpatch['apply'](_0x4c629d,_0x2f0c77,!![]);}catch(_0x4f2bc1){return BPromise[_0x9ba6('0x1c')](_0x4f2bc1);}return _0x4c629d['save']();};}function saveUpdates(_0x6a315f,_0x53a7d6){return function(_0x5a01e4){if(_0x5a01e4){return _0x5a01e4['update'](_0x6a315f)['then'](function(_0x4124d7){return _0x4124d7;});}return null;};}function removeEntity(_0x311038,_0x180dc5){return function(_0x3eb281){if(_0x3eb281){return _0x3eb281[_0x9ba6('0x1d')]()[_0x9ba6('0x1e')](function(){_0x311038[_0x9ba6('0x16')](0xcc)[_0x9ba6('0x17')]();});}};}function handleEntityNotFound(_0x36ee0c,_0x4d01db){return function(_0x4dd2c2){if(!_0x4dd2c2){_0x36ee0c['sendStatus'](0x194);}return _0x4dd2c2;};}function handleError(_0x759ade,_0x68e9e5){_0x68e9e5=_0x68e9e5||0x1f4;return function(_0x4d04f7){logger[_0x9ba6('0x1f')](_0x4d04f7['stack']);if(_0x4d04f7[_0x9ba6('0x20')]){delete _0x4d04f7[_0x9ba6('0x20')];}_0x759ade[_0x9ba6('0x16')](_0x68e9e5)['send'](_0x4d04f7);};}exports[_0x9ba6('0x21')]=function(_0x36cdc8,_0x23cbae){var _0x3d162e={},_0x545011={},_0x59cfa5={'count':0x0,'rows':[]};var _0x5366a6=_[_0x9ba6('0x22')](db[_0x9ba6('0x23')][_0x9ba6('0x24')],function(_0x12bc60){return{'name':_0x12bc60['fieldName'],'type':_0x12bc60[_0x9ba6('0x25')][_0x9ba6('0x26')]};});_0x545011[_0x9ba6('0x27')]=_[_0x9ba6('0x22')](_0x5366a6,_0x9ba6('0x20'));_0x545011[_0x9ba6('0x28')]=_[_0x9ba6('0x29')](_0x36cdc8[_0x9ba6('0x28')]);_0x545011[_0x9ba6('0x2a')]=_[_0x9ba6('0x2b')](_0x545011[_0x9ba6('0x27')],_0x545011[_0x9ba6('0x28')]);_0x3d162e[_0x9ba6('0x2c')]=_[_0x9ba6('0x2b')](_0x545011[_0x9ba6('0x27')],qs[_0x9ba6('0x2d')](_0x36cdc8['query']['fields']));_0x3d162e[_0x9ba6('0x2c')]=_0x3d162e[_0x9ba6('0x2c')][_0x9ba6('0x2e')]?_0x3d162e['attributes']:_0x545011[_0x9ba6('0x27')];if(!_0x36cdc8[_0x9ba6('0x28')][_0x9ba6('0x2f')](_0x9ba6('0x30'))){_0x3d162e[_0x9ba6('0x31')]=qs[_0x9ba6('0x31')](_0x36cdc8[_0x9ba6('0x28')][_0x9ba6('0x31')]);_0x3d162e[_0x9ba6('0x19')]=qs[_0x9ba6('0x19')](_0x36cdc8[_0x9ba6('0x28')]['offset']);}_0x3d162e['order']=qs['sort'](_0x36cdc8[_0x9ba6('0x28')][_0x9ba6('0x32')]);_0x3d162e[_0x9ba6('0x33')]=qs[_0x9ba6('0x2a')](_['pick'](_0x36cdc8['query'],_0x545011[_0x9ba6('0x2a')]),_0x5366a6);if(_0x36cdc8[_0x9ba6('0x28')]['filter']){_0x3d162e['where']=_[_0x9ba6('0x34')](_0x3d162e['where'],{'$or':_[_0x9ba6('0x22')](_0x5366a6,function(_0x44bd27){if(_0x44bd27[_0x9ba6('0x25')]!==_0x9ba6('0x35')){var _0x36299a={};_0x36299a[_0x44bd27[_0x9ba6('0x20')]]={'$like':'%'+_0x36cdc8['query'][_0x9ba6('0x36')]+'%'};return _0x36299a;}})});}_0x3d162e=_['merge']({},_0x3d162e,_0x36cdc8[_0x9ba6('0x37')]);var _0x400424={'where':_0x3d162e[_0x9ba6('0x33')]};return db[_0x9ba6('0x23')][_0x9ba6('0x38')](_0x400424)[_0x9ba6('0x1e')](function(_0x3566e4){_0x59cfa5['count']=_0x3566e4;if(_0x36cdc8[_0x9ba6('0x28')][_0x9ba6('0x39')]){_0x3d162e[_0x9ba6('0x3a')]=[{'all':!![]}];}return db[_0x9ba6('0x23')][_0x9ba6('0x3b')](_0x3d162e);})[_0x9ba6('0x1e')](function(_0x21d0a3){_0x59cfa5[_0x9ba6('0x3c')]=_0x21d0a3;return _0x59cfa5;})[_0x9ba6('0x1e')](respondWithFilteredResult(_0x23cbae,_0x3d162e))[_0x9ba6('0x3d')](handleError(_0x23cbae,null));};exports[_0x9ba6('0x3e')]=function(_0x34d09f,_0x54deca){var _0x3e05c8={'raw':!![],'where':{'id':_0x34d09f[_0x9ba6('0x3f')]['id']}},_0x57c52d={};_0x57c52d[_0x9ba6('0x27')]=_[_0x9ba6('0x29')](db[_0x9ba6('0x23')]['rawAttributes']);_0x57c52d[_0x9ba6('0x28')]=_['keys'](_0x34d09f['query']);_0x57c52d[_0x9ba6('0x2a')]=_[_0x9ba6('0x2b')](_0x57c52d[_0x9ba6('0x27')],_0x57c52d['query']);_0x3e05c8['attributes']=_['intersection'](_0x57c52d[_0x9ba6('0x27')],qs['fields'](_0x34d09f[_0x9ba6('0x28')][_0x9ba6('0x2d')]));_0x3e05c8[_0x9ba6('0x2c')]=_0x3e05c8[_0x9ba6('0x2c')][_0x9ba6('0x2e')]?_0x3e05c8[_0x9ba6('0x2c')]:_0x57c52d['model'];if(_0x34d09f['query']['includeAll']){_0x3e05c8['include']=[{'all':!![]}];}_0x3e05c8=_[_0x9ba6('0x34')]({},_0x3e05c8,_0x34d09f[_0x9ba6('0x37')]);return db['SquareDetailsReport']['find'](_0x3e05c8)[_0x9ba6('0x1e')](handleEntityNotFound(_0x54deca,null))[_0x9ba6('0x1e')](respondWithResult(_0x54deca,null))[_0x9ba6('0x3d')](handleError(_0x54deca,null));};exports[_0x9ba6('0x40')]=function(_0x448c13,_0x2673f4){return db[_0x9ba6('0x23')][_0x9ba6('0x40')](_0x448c13[_0x9ba6('0x41')],{})[_0x9ba6('0x1e')](respondWithResult(_0x2673f4,0xc9))[_0x9ba6('0x3d')](handleError(_0x2673f4,null));};exports[_0x9ba6('0x42')]=function(_0x5cf3fe,_0x25a5b9){if(_0x5cf3fe[_0x9ba6('0x41')]['id']){delete _0x5cf3fe[_0x9ba6('0x41')]['id'];}return db['SquareDetailsReport'][_0x9ba6('0x43')]({'where':{'id':_0x5cf3fe[_0x9ba6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x25a5b9,null))[_0x9ba6('0x1e')](saveUpdates(_0x5cf3fe[_0x9ba6('0x41')],null))[_0x9ba6('0x1e')](respondWithResult(_0x25a5b9,null))[_0x9ba6('0x3d')](handleError(_0x25a5b9,null));};exports[_0x9ba6('0x1d')]=function(_0x3731aa,_0x44ee40){return db['SquareDetailsReport'][_0x9ba6('0x43')]({'where':{'id':_0x3731aa[_0x9ba6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x44ee40,null))[_0x9ba6('0x1e')](removeEntity(_0x44ee40,null))[_0x9ba6('0x3d')](handleError(_0x44ee40,null));};exports[_0x9ba6('0x44')]=function(_0x5e6b98,_0x508042){return db[_0x9ba6('0x23')]['describe']()[_0x9ba6('0x1e')](respondWithResult(_0x508042,null))[_0x9ba6('0x3d')](handleError(_0x508042,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 9bf094a..4011755 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 _0x369c=['define','report_square_details','lodash','util','../../config/logger','api','path','rimraf'];(function(_0x18367d,_0x3790db){var _0x2efbf9=function(_0x3304d5){while(--_0x3304d5){_0x18367d['push'](_0x18367d['shift']());}};_0x2efbf9(++_0x3790db);}(_0x369c,0x12a));var _0xc369=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x369c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc369('0x0'));var util=require(_0xc369('0x1'));var logger=require(_0xc369('0x2'))(_0xc369('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc369('0x4'));var rimraf=require(_0xc369('0x5'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0xe41750,_0x10984a){return _0xe41750[_0xc369('0x6')]('SquareDetailsReport',attributes,{'tableName':_0xc369('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e40=['define','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x2e5d46,_0x1df4b5){var _0x4b585e=function(_0x530680){while(--_0x530680){_0x2e5d46['push'](_0x2e5d46['shift']());}};_0x4b585e(++_0x1df4b5);}(_0x3e40,0x147));var _0x03e4=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x3e40[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x03e4('0x0'));var util=require(_0x03e4('0x1'));var logger=require(_0x03e4('0x2'))(_0x03e4('0x3'));var moment=require(_0x03e4('0x4'));var BPromise=require(_0x03e4('0x5'));var rp=require(_0x03e4('0x6'));var fs=require('fs');var path=require(_0x03e4('0x7'));var rimraf=require(_0x03e4('0x8'));var config=require(_0x03e4('0x9'));var attributes=require(_0x03e4('0xa'));module['exports']=function(_0x51a4df,_0x29c458){return _0x51a4df[_0x03e4('0xb')]('SquareDetailsReport',attributes,{'tableName':_0x03e4('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 6b6943f..9b18858 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 _0xf4b6=['jayson/promise','client','http','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x43789c,_0x155100){var _0x3438ee=function(_0x2bf95c){while(--_0x2bf95c){_0x43789c['push'](_0x43789c['shift']());}};_0x3438ee(++_0x155100);}(_0xf4b6,0x1ef));var _0x6f4b=function(_0xfa9409,_0x4b35b1){_0xfa9409=_0xfa9409-0x0;var _0x50600a=_0xf4b6[_0xfa9409];return _0x50600a;};'use strict';var _=require(_0x6f4b('0x0'));var util=require(_0x6f4b('0x1'));var moment=require(_0x6f4b('0x2'));var BPromise=require(_0x6f4b('0x3'));var rs=require(_0x6f4b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f4b('0x5'))['db'];var utils=require(_0x6f4b('0x6'));var logger=require(_0x6f4b('0x7'))(_0x6f4b('0x8'));var config=require('../../config/environment');var jayson=require(_0x6f4b('0x9'));var client=jayson[_0x6f4b('0xa')][_0x6f4b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c0450,_0x88b05a,_0x3e4bc3){return new BPromise(function(_0x411aeb,_0x5c4b8d){return client['request'](_0x2c0450,_0x3e4bc3)['then'](function(_0x2a849a){logger['info'](_0x6f4b('0xc'),_0x88b05a,_0x6f4b('0xd'));logger[_0x6f4b('0xe')](_0x6f4b('0xf'),_0x88b05a,'request\x20sent',JSON[_0x6f4b('0x10')](_0x2a849a));if(_0x2a849a[_0x6f4b('0x11')]){if(_0x2a849a['error'][_0x6f4b('0x12')]===0x1f4){logger[_0x6f4b('0x11')](_0x6f4b('0xc'),_0x88b05a,_0x2a849a[_0x6f4b('0x11')][_0x6f4b('0x13')]);return _0x5c4b8d(_0x2a849a[_0x6f4b('0x11')][_0x6f4b('0x13')]);}logger['error'](_0x6f4b('0xc'),_0x88b05a,_0x2a849a[_0x6f4b('0x11')][_0x6f4b('0x13')]);return _0x411aeb(_0x2a849a[_0x6f4b('0x11')][_0x6f4b('0x13')]);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x88b05a,_0x6f4b('0xd'));_0x411aeb(_0x2a849a['result'][_0x6f4b('0x13')]);}})[_0x6f4b('0x14')](function(_0x3ee498){logger[_0x6f4b('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x88b05a,_0x3ee498);_0x5c4b8d(_0x3ee498);});});}exports[_0x6f4b('0x15')]=function(_0x2bb334){var _0x1df11c=this;return new Promise(function(_0x4791a5,_0x265b20){return db[_0x6f4b('0x16')][_0x6f4b('0x17')](_0x2bb334[_0x6f4b('0x18')],{'raw':_0x2bb334[_0x6f4b('0x19')]?_0x2bb334['options'][_0x6f4b('0x1a')]===undefined?!![]:![]:!![]})[_0x6f4b('0x1b')](function(_0x16c9f3){logger['info'](_0x6f4b('0x15'),_0x2bb334);logger[_0x6f4b('0xe')](_0x6f4b('0x15'),_0x2bb334,JSON[_0x6f4b('0x10')](_0x16c9f3));_0x4791a5(_0x16c9f3);})[_0x6f4b('0x14')](function(_0xb8fa7){logger[_0x6f4b('0x11')](_0x6f4b('0x15'),_0xb8fa7[_0x6f4b('0x13')],_0x2bb334);_0x265b20(_0x1df11c[_0x6f4b('0x11')](0x1f4,_0xb8fa7[_0x6f4b('0x13')]));});});}; \ No newline at end of file +var _0x60f4=['bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','catch','lodash','util','moment'];(function(_0x26f8de,_0xea5e13){var _0x192c08=function(_0x13467d){while(--_0x13467d){_0x26f8de['push'](_0x26f8de['shift']());}};_0x192c08(++_0xea5e13);}(_0x60f4,0xc1));var _0x460f=function(_0x67f517,_0x372e84){_0x67f517=_0x67f517-0x0;var _0x4b85ea=_0x60f4[_0x67f517];return _0x4b85ea;};'use strict';var _=require(_0x460f('0x0'));var util=require(_0x460f('0x1'));var moment=require(_0x460f('0x2'));var BPromise=require(_0x460f('0x3'));var rs=require(_0x460f('0x4'));var fs=require('fs');var Redis=require(_0x460f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x460f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x460f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x460f('0x8')][_0x460f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x107784,_0x24dc56,_0x3985d3){return new BPromise(function(_0x561cee,_0x402e87){return client['request'](_0x107784,_0x3985d3)[_0x460f('0xa')](function(_0x2813b1){logger[_0x460f('0xb')](_0x460f('0xc'),_0x24dc56,_0x460f('0xd'));logger[_0x460f('0xe')](_0x460f('0xf'),_0x24dc56,_0x460f('0xd'),JSON[_0x460f('0x10')](_0x2813b1));if(_0x2813b1[_0x460f('0x11')]){if(_0x2813b1[_0x460f('0x11')][_0x460f('0x12')]===0x1f4){logger[_0x460f('0x11')](_0x460f('0xc'),_0x24dc56,_0x2813b1[_0x460f('0x11')][_0x460f('0x13')]);return _0x402e87(_0x2813b1[_0x460f('0x11')]['message']);}logger[_0x460f('0x11')](_0x460f('0xc'),_0x24dc56,_0x2813b1[_0x460f('0x11')][_0x460f('0x13')]);return _0x561cee(_0x2813b1[_0x460f('0x11')][_0x460f('0x13')]);}else{logger[_0x460f('0xb')](_0x460f('0xc'),_0x24dc56,_0x460f('0xd'));_0x561cee(_0x2813b1[_0x460f('0x14')][_0x460f('0x13')]);}})['catch'](function(_0x580a7d){logger[_0x460f('0x11')](_0x460f('0xc'),_0x24dc56,_0x580a7d);_0x402e87(_0x580a7d);});});}exports[_0x460f('0x15')]=function(_0x5cc008){var _0xeb8e63=this;return new Promise(function(_0x3a82cb,_0x21899e){return db[_0x460f('0x16')][_0x460f('0x17')](_0x5cc008[_0x460f('0x18')],{'raw':_0x5cc008[_0x460f('0x19')]?_0x5cc008[_0x460f('0x19')][_0x460f('0x1a')]===undefined?!![]:![]:!![]})[_0x460f('0xa')](function(_0x3e526f){logger[_0x460f('0xb')](_0x460f('0x15'),_0x5cc008);logger[_0x460f('0xe')](_0x460f('0x15'),_0x5cc008,JSON[_0x460f('0x10')](_0x3e526f));_0x3a82cb(_0x3e526f);})[_0x460f('0x1b')](function(_0x13893b){logger[_0x460f('0x11')](_0x460f('0x15'),_0x13893b[_0x460f('0x13')],_0x5cc008);_0x21899e(_0xeb8e63[_0x460f('0x11')](0x1f4,_0x13893b['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 5c0d7b3..9e239a8 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 _0x4859=['Router','isAuthenticated','index','/process/:pid/kill','killProcess','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4859,0x131));var _0x9485=function(_0x50f3c8,_0x2d987d){_0x50f3c8=_0x50f3c8-0x0;var _0x3dc055=_0x4859[_0x50f3c8];return _0x3dc055;};'use strict';var express=require(_0x9485('0x0'));var router=express[_0x9485('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router['get']('/',auth[_0x9485('0x2')](),controller[_0x9485('0x3')]);router['get'](_0x9485('0x4'),auth[_0x9485('0x2')](),controller[_0x9485('0x5')]);module['exports']=router; \ No newline at end of file +var _0x0c11=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service'];(function(_0x3f7dea,_0x410d69){var _0xf629ab=function(_0xe675c){while(--_0xe675c){_0x3f7dea['push'](_0x3f7dea['shift']());}};_0xf629ab(++_0x410d69);}(_0x0c11,0x179));var _0x10c1=function(_0x1e3c02,_0x5c07a2){_0x1e3c02=_0x1e3c02-0x0;var _0x4d26d7=_0x0c11[_0x1e3c02];return _0x4d26d7;};'use strict';var express=require(_0x10c1('0x0'));var router=express[_0x10c1('0x1')]();var auth=require(_0x10c1('0x2'));var controller=require(_0x10c1('0x3'));router[_0x10c1('0x4')]('/',auth[_0x10c1('0x5')](),controller[_0x10c1('0x6')]);router[_0x10c1('0x4')](_0x10c1('0x7'),auth[_0x10c1('0x5')](),controller[_0x10c1('0x8')]);module[_0x10c1('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 5b5109f..4a3c0c5 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 _0xb725=['send','index','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','../../config/logger','api','util','bluebird','lodash','error','inspect','name','status'];(function(_0x2f8146,_0x2cc94e){var _0x2415ab=function(_0x37f1aa){while(--_0x37f1aa){_0x2f8146['push'](_0x2f8146['shift']());}};_0x2415ab(++_0x2cc94e);}(_0xb725,0x86));var _0x5b72=function(_0x20c180,_0x115684){_0x20c180=_0x20c180-0x0;var _0x4c8ae9=_0xb725[_0x20c180];return _0x4c8ae9;};'use strict';var info=require('systeminformation');var exec=require(_0x5b72('0x0'))['exec'];var logger=require(_0x5b72('0x1'))(_0x5b72('0x2'));var util=require(_0x5b72('0x3'));var BPromise=require(_0x5b72('0x4'));var _=require(_0x5b72('0x5'));function handleError(_0x3fa8ef,_0x1bf63a,_0x32e4e3){_0x1bf63a=_0x1bf63a||0x1f4;return function(_0x382d19){logger[_0x5b72('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x32e4e3,_0x1bf63a,util[_0x5b72('0x7')](_0x382d19,{'showHidden':![],'depth':null}));delete _0x382d19[_0x5b72('0x8')];_0x3fa8ef[_0x5b72('0x9')](_0x1bf63a)[_0x5b72('0xa')](_0x382d19);};}exports[_0x5b72('0xb')]=function(_0x3cce5a,_0x23405f){return info['getAllData']()[_0x5b72('0xc')](function(_0x433377){return _0x23405f[_0x5b72('0x9')](0xc8)[_0x5b72('0xd')](_0x433377);})[_0x5b72('0xe')](function(_0x2bb1a0){return _0x23405f[_0x5b72('0x9')](0x1f4)[_0x5b72('0xd')](_0x2bb1a0);});};exports[_0x5b72('0xf')]=function(_0x553ace,_0x513a68){var _0x4099eb=['components/import/cm'];return new BPromise(function(_0xab125c,_0xd9b16b){return exec(util[_0x5b72('0x10')](_0x5b72('0x11'),_0x553ace[_0x5b72('0x12')][_0x5b72('0x13')]),function(_0x5f5614,_0x1b187f,_0x23765e){if(_0x5f5614){return _0xd9b16b(_0x5f5614);}return _0xab125c(_0x1b187f);});})[_0x5b72('0xc')](function(_0x88362b){var _0x353fb8=![];var _0x1422a8=_0x88362b[_0x5b72('0x14')](/\n/);for(var _0x69bb0=0x0,_0x330562=_0x4099eb[_0x5b72('0x15')];_0x69bb0<_0x330562,_0x353fb8===![];_0x69bb0+=0x1){if(_0x88362b['indexOf'](_0x4099eb[_0x69bb0])>=0x0){_0x353fb8=!![];}}if(!_0x353fb8){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x553ace[_0x5b72('0x12')]['pid']));}process[_0x5b72('0x16')](_0x553ace[_0x5b72('0x12')][_0x5b72('0x13')],'SIGINT');return _0x513a68[_0x5b72('0x9')](0xc8)[_0x5b72('0xd')]({'message':util[_0x5b72('0x10')](_0x5b72('0x17'),_0x553ace['params']['pid'])});})[_0x5b72('0xe')](handleError(_0x513a68,null,'killProcess'));}; \ No newline at end of file +var _0x1f33=['kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x656d84,_0xa4df1c){var _0x1772c4=function(_0x2ef4ea){while(--_0x2ef4ea){_0x656d84['push'](_0x656d84['shift']());}};_0x1772c4(++_0xa4df1c);}(_0x1f33,0xd2));var _0x31f3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1f33[_0x20a584];return _0x4b41a8;};'use strict';var info=require(_0x31f3('0x0'));var exec=require(_0x31f3('0x1'))['exec'];var logger=require(_0x31f3('0x2'))(_0x31f3('0x3'));var util=require(_0x31f3('0x4'));var BPromise=require(_0x31f3('0x5'));var _=require(_0x31f3('0x6'));function handleError(_0x46654f,_0x4235c7,_0x5b4c8f){_0x4235c7=_0x4235c7||0x1f4;return function(_0x4787db){logger[_0x31f3('0x7')](_0x31f3('0x8'),_0x5b4c8f,_0x4235c7,util['inspect'](_0x4787db,{'showHidden':![],'depth':null}));delete _0x4787db['name'];_0x46654f[_0x31f3('0x9')](_0x4235c7)['send'](_0x4787db);};}exports['index']=function(_0x5ceb6f,_0xd87090){return info[_0x31f3('0xa')]()[_0x31f3('0xb')](function(_0x35ac05){return _0xd87090[_0x31f3('0x9')](0xc8)[_0x31f3('0xc')](_0x35ac05);})[_0x31f3('0xd')](function(_0x1f8967){return _0xd87090[_0x31f3('0x9')](0x1f4)[_0x31f3('0xc')](_0x1f8967);});};exports[_0x31f3('0xe')]=function(_0x57160e,_0x5a2847){var _0x2f29c5=[_0x31f3('0xf')];return new BPromise(function(_0xa8adc3,_0x20c553){return exec(util[_0x31f3('0x10')](_0x31f3('0x11'),_0x57160e[_0x31f3('0x12')][_0x31f3('0x13')]),function(_0x1a5132,_0x4542c5,_0x573362){if(_0x1a5132){return _0x20c553(_0x1a5132);}return _0xa8adc3(_0x4542c5);});})[_0x31f3('0xb')](function(_0x5c61cc){var _0x5cfdd9=![];var _0x4df0bd=_0x5c61cc[_0x31f3('0x14')](/\n/);for(var _0x3d3d71=0x0,_0x23d6aa=_0x2f29c5[_0x31f3('0x15')];_0x3d3d71<_0x23d6aa,_0x5cfdd9===![];_0x3d3d71+=0x1){if(_0x5c61cc[_0x31f3('0x16')](_0x2f29c5[_0x3d3d71])>=0x0){_0x5cfdd9=!![];}}if(!_0x5cfdd9){throw new Error(util[_0x31f3('0x10')](_0x31f3('0x17'),_0x57160e[_0x31f3('0x12')][_0x31f3('0x13')]));}process[_0x31f3('0x18')](_0x57160e[_0x31f3('0x12')][_0x31f3('0x13')],'SIGINT');return _0x5a2847['status'](0xc8)[_0x31f3('0xc')]({'message':util[_0x31f3('0x10')](_0x31f3('0x19'),_0x57160e[_0x31f3('0x12')][_0x31f3('0x13')])});})[_0x31f3('0xd')](handleError(_0x5a2847,null,_0x31f3('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 4829033..9fd91a5 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 _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x1597e2,_0x388d3e){var _0x4c8c0a=function(_0x3d4795){while(--_0x3d4795){_0x1597e2['push'](_0x1597e2['shift']());}};_0x4c8c0a(++_0x388d3e);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'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('./tag.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0xedd9,0xfc));var _0x9edd=function(_0x595835,_0x445592){_0x595835=_0x595835-0x0;var _0x35115a=_0xedd9[_0x595835];return _0x35115a;};'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('./tag.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0xb')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router[_0x9edd('0xd')]('/:id',auth[_0x9edd('0x9')](),controller['update']);router[_0x9edd('0xe')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);module[_0x9edd('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index d680af1..3939300 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 _0x36ee=['STRING','#0091EA'];(function(_0x4bf2b9,_0x47c5b0){var _0x38205d=function(_0x1a4edd){while(--_0x1a4edd){_0x4bf2b9['push'](_0x4bf2b9['shift']());}};_0x38205d(++_0x47c5b0);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe36e('0x0')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe36e('0x0')],'defaultValue':_0xe36e('0x1')},'description':{'type':Sequelize[_0xe36e('0x0')]}}; \ No newline at end of file +var _0x4024=['STRING','sequelize','exports','name'];(function(_0x253c49,_0x28bd60){var _0x32a636=function(_0x1ec5cd){while(--_0x1ec5cd){_0x253c49['push'](_0x253c49['shift']());}};_0x32a636(++_0x28bd60);}(_0x4024,0x89));var _0x4402=function(_0x1a6066,_0x3a5912){_0x1a6066=_0x1a6066-0x0;var _0x911dc0=_0x4024[_0x1a6066];return _0x911dc0;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4402('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4402('0x3')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x4402('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 2705d48..725b320 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 _0x4460=['error','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','get','role','user','find','userProfileId','autoAssociation','UserProfileResource','destroy','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','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','Tags','end'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4460,0x80));var _0x0446=function(_0x186a7c,_0x32f5ed){_0x186a7c=_0x186a7c-0x0;var _0x52e0f8=_0x4460[_0x186a7c];return _0x52e0f8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0446('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0446('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0446('0x2'));var moment=require('moment');var BPromise=require(_0x0446('0x3'));var Mustache=require(_0x0446('0x4'));var util=require(_0x0446('0x5'));var path=require('path');var sox=require(_0x0446('0x6'));var csv=require(_0x0446('0x7'));var ejs=require(_0x0446('0x8'));var fs=require('fs');var _=require(_0x0446('0x9'));var squel=require(_0x0446('0xa'));var crypto=require('crypto');var jsforce=require(_0x0446('0xb'));var deskjs=require(_0x0446('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0446('0xd'));var authService=require(_0x0446('0xe'));var qs=require(_0x0446('0xf'));var as=require(_0x0446('0x10'));var hardwareService=require(_0x0446('0x11'));var logger=require(_0x0446('0x12'))(_0x0446('0x13'));var utils=require(_0x0446('0x14'));var config=require(_0x0446('0x15'));var db=require(_0x0446('0x16'))['db'];function respondWithStatusCode(_0x20ccd9,_0x3df13e){_0x3df13e=_0x3df13e||0xcc;return function(_0x5c3faf){if(_0x5c3faf){return _0x20ccd9[_0x0446('0x17')](_0x3df13e);}return _0x20ccd9['status'](_0x3df13e)['end']();};}function respondWithResult(_0xce87f9,_0x9c429f){_0x9c429f=_0x9c429f||0xc8;return function(_0x3c7b90){if(_0x3c7b90){return _0xce87f9[_0x0446('0x18')](_0x9c429f)[_0x0446('0x19')](_0x3c7b90);}};}function respondWithFilteredResult(_0x2ba091,_0x2c7d7e){return function(_0x5ce192){if(_0x5ce192){var _0x21a06c=_0x5ce192[_0x0446('0x1a')],_0x5f3f2a=_0x2c7d7e[_0x0446('0x1b')],_0x199925=_0x2c7d7e[_0x0446('0x1b')]+_0x2c7d7e[_0x0446('0x1c')],_0x2b03c2;if(_0x199925>=_0x21a06c){_0x199925=_0x21a06c;_0x2b03c2=0xc8;}else{_0x2b03c2=0xce;}_0x2ba091[_0x0446('0x18')](_0x2b03c2);return _0x2ba091[_0x0446('0x1d')](_0x0446('0x1e'),_0x5f3f2a+'-'+_0x199925+'/'+_0x21a06c)[_0x0446('0x19')](_0x5ce192);}return null;};}function patchUpdates(_0x35ddcb){return function(_0x3c7f32){try{jsonpatch[_0x0446('0x1f')](_0x3c7f32,_0x35ddcb,!![]);}catch(_0x4bc43b){return BPromise[_0x0446('0x20')](_0x4bc43b);}return _0x3c7f32[_0x0446('0x21')]();};}function saveUpdates(_0x3a64d7,_0x922ca1){return function(_0x3290da){if(_0x3290da){return _0x3290da[_0x0446('0x22')](_0x3a64d7)[_0x0446('0x23')](function(_0x5ca117){return _0x5ca117;});}return null;};}function removeEntity(_0x411408,_0x33020c){return function(_0x10cc80){if(_0x10cc80){return _0x10cc80['destroy']()['then'](function(){var _0x295163=_0x10cc80['get']({'plain':!![]});var _0x1f3c30=_0x0446('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x1f3c30,'resourceId':_0x295163['id']}})[_0x0446('0x23')](function(){return _0x10cc80;});})[_0x0446('0x23')](function(){_0x411408['status'](0xcc)[_0x0446('0x25')]();});}};}function handleEntityNotFound(_0x5f5d53,_0x356750){return function(_0x301e09){if(!_0x301e09){_0x5f5d53[_0x0446('0x17')](0x194);}return _0x301e09;};}function handleError(_0x51b9e3,_0x51e3e){_0x51e3e=_0x51e3e||0x1f4;return function(_0x23695d){logger[_0x0446('0x26')](_0x23695d['stack']);if(_0x23695d['name']){delete _0x23695d[_0x0446('0x27')];}_0x51b9e3[_0x0446('0x18')](_0x51e3e)[_0x0446('0x28')](_0x23695d);};}exports[_0x0446('0x29')]=function(_0xe1bca,_0x11ade4){var _0x3d6f06={},_0x10dd89={},_0x472d51={'count':0x0,'rows':[]};var _0x264b90=_[_0x0446('0x2a')](db[_0x0446('0x2b')][_0x0446('0x2c')],function(_0x585ad1){return{'name':_0x585ad1[_0x0446('0x2d')],'type':_0x585ad1[_0x0446('0x2e')][_0x0446('0x2f')]};});_0x10dd89[_0x0446('0x30')]=_[_0x0446('0x2a')](_0x264b90,_0x0446('0x27'));_0x10dd89[_0x0446('0x31')]=_[_0x0446('0x32')](_0xe1bca[_0x0446('0x31')]);_0x10dd89[_0x0446('0x33')]=_[_0x0446('0x34')](_0x10dd89[_0x0446('0x30')],_0x10dd89[_0x0446('0x31')]);_0x3d6f06['attributes']=_[_0x0446('0x34')](_0x10dd89[_0x0446('0x30')],qs[_0x0446('0x35')](_0xe1bca[_0x0446('0x31')]['fields']));_0x3d6f06[_0x0446('0x36')]=_0x3d6f06[_0x0446('0x36')][_0x0446('0x37')]?_0x3d6f06[_0x0446('0x36')]:_0x10dd89[_0x0446('0x30')];if(!_0xe1bca[_0x0446('0x31')][_0x0446('0x38')](_0x0446('0x39'))){_0x3d6f06[_0x0446('0x1c')]=qs[_0x0446('0x1c')](_0xe1bca['query'][_0x0446('0x1c')]);_0x3d6f06[_0x0446('0x1b')]=qs[_0x0446('0x1b')](_0xe1bca[_0x0446('0x31')][_0x0446('0x1b')]);}_0x3d6f06[_0x0446('0x3a')]=qs[_0x0446('0x3b')](_0xe1bca[_0x0446('0x31')][_0x0446('0x3b')]);_0x3d6f06[_0x0446('0x3c')]=qs['filters'](_[_0x0446('0x3d')](_0xe1bca[_0x0446('0x31')],_0x10dd89['filters']),_0x264b90);if(_0xe1bca[_0x0446('0x31')][_0x0446('0x3e')]){_0x3d6f06['where']=_[_0x0446('0x3f')](_0x3d6f06[_0x0446('0x3c')],{'$or':_[_0x0446('0x2a')](_0x264b90,function(_0x4be8e6){if(_0x4be8e6[_0x0446('0x2e')]!==_0x0446('0x40')){var _0x5566c7={};_0x5566c7[_0x4be8e6[_0x0446('0x27')]]={'$like':'%'+_0xe1bca['query'][_0x0446('0x3e')]+'%'};return _0x5566c7;}})});}_0x3d6f06=_['merge']({},_0x3d6f06,_0xe1bca[_0x0446('0x41')]);var _0x4237cd={'where':_0x3d6f06['where']};return db[_0x0446('0x2b')][_0x0446('0x1a')](_0x4237cd)[_0x0446('0x23')](function(_0x73a526){_0x472d51[_0x0446('0x1a')]=_0x73a526;if(_0xe1bca['query'][_0x0446('0x42')]){_0x3d6f06[_0x0446('0x43')]=[{'all':!![]}];}return db[_0x0446('0x2b')][_0x0446('0x44')](_0x3d6f06);})[_0x0446('0x23')](function(_0x36dbad){_0x472d51[_0x0446('0x45')]=_0x36dbad;return _0x472d51;})[_0x0446('0x23')](respondWithFilteredResult(_0x11ade4,_0x3d6f06))[_0x0446('0x46')](handleError(_0x11ade4,null));};exports[_0x0446('0x47')]=function(_0xb5c1db,_0x194935){var _0x3afbb5={'raw':!![],'where':{'id':_0xb5c1db[_0x0446('0x48')]['id']}},_0x4d288c={};_0x4d288c['model']=_['keys'](db['Tag'][_0x0446('0x2c')]);_0x4d288c[_0x0446('0x31')]=_[_0x0446('0x32')](_0xb5c1db[_0x0446('0x31')]);_0x4d288c['filters']=_['intersection'](_0x4d288c[_0x0446('0x30')],_0x4d288c['query']);_0x3afbb5[_0x0446('0x36')]=_[_0x0446('0x34')](_0x4d288c[_0x0446('0x30')],qs['fields'](_0xb5c1db[_0x0446('0x31')][_0x0446('0x35')]));_0x3afbb5['attributes']=_0x3afbb5[_0x0446('0x36')]['length']?_0x3afbb5[_0x0446('0x36')]:_0x4d288c[_0x0446('0x30')];if(_0xb5c1db[_0x0446('0x31')][_0x0446('0x42')]){_0x3afbb5[_0x0446('0x43')]=[{'all':!![]}];}_0x3afbb5=_['merge']({},_0x3afbb5,_0xb5c1db[_0x0446('0x41')]);return db['Tag']['find'](_0x3afbb5)[_0x0446('0x23')](handleEntityNotFound(_0x194935,null))[_0x0446('0x23')](respondWithResult(_0x194935,null))[_0x0446('0x46')](handleError(_0x194935,null));};exports['create']=function(_0xd97ad7,_0x374e43){return db['Tag'][_0x0446('0x49')](_0xd97ad7[_0x0446('0x4a')],{})[_0x0446('0x23')](function(_0x5bae29){var _0x4de197=_0xd97ad7['user'][_0x0446('0x4b')]({'plain':!![]});if(!_0x4de197)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4de197[_0x0446('0x4c')]===_0x0446('0x4d')){var _0x27967c=_0x5bae29[_0x0446('0x4b')]({'plain':!![]});var _0x4e5f7a=_0x0446('0x24');return db['UserProfileSection'][_0x0446('0x4e')]({'where':{'name':_0x4e5f7a,'userProfileId':_0x4de197[_0x0446('0x4f')]},'raw':!![]})[_0x0446('0x23')](function(_0x4b9cfd){if(_0x4b9cfd&&_0x4b9cfd[_0x0446('0x50')]===0x0){return db[_0x0446('0x51')][_0x0446('0x49')]({'name':_0x27967c[_0x0446('0x27')],'resourceId':_0x27967c['id'],'type':_0x4b9cfd[_0x0446('0x27')],'sectionId':_0x4b9cfd['id']},{})[_0x0446('0x23')](function(){return _0x5bae29;});}else{return _0x5bae29;}})[_0x0446('0x46')](function(_0x4bc9c9){logger[_0x0446('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bc9c9);throw _0x4bc9c9;});}return _0x5bae29;})[_0x0446('0x23')](respondWithResult(_0x374e43,0xc9))[_0x0446('0x46')](handleError(_0x374e43,null));};exports[_0x0446('0x22')]=function(_0x192dd7,_0x579d6f){if(_0x192dd7[_0x0446('0x4a')]['id']){delete _0x192dd7[_0x0446('0x4a')]['id'];}return db[_0x0446('0x2b')][_0x0446('0x4e')]({'where':{'id':_0x192dd7['params']['id']}})[_0x0446('0x23')](handleEntityNotFound(_0x579d6f,null))['then'](saveUpdates(_0x192dd7[_0x0446('0x4a')],null))[_0x0446('0x23')](respondWithResult(_0x579d6f,null))['catch'](handleError(_0x579d6f,null));};exports[_0x0446('0x52')]=function(_0x2b2603,_0x4c804b){return db['Tag'][_0x0446('0x4e')]({'where':{'id':_0x2b2603[_0x0446('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c804b,null))[_0x0446('0x23')](removeEntity(_0x4c804b,null))[_0x0446('0x46')](handleError(_0x4c804b,null));}; \ No newline at end of file +var _0xb810=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','limit','set','apply','reject','update','then','destroy','get','Tags','UserProfileResource','sendStatus','error','name','send','map','Tag','rawAttributes','fieldName','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','create','role','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xb810,0x84));var _0x0b81=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xb810[_0x36ed48];return _0x51c63a;};'use strict';var pdf=require(_0x0b81('0x0'));var emlformat=require(_0x0b81('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0b81('0x2'));var jsonpatch=require(_0x0b81('0x3'));var rp=require(_0x0b81('0x4'));var moment=require('moment');var BPromise=require(_0x0b81('0x5'));var Mustache=require(_0x0b81('0x6'));var util=require(_0x0b81('0x7'));var path=require(_0x0b81('0x8'));var sox=require('sox');var csv=require(_0x0b81('0x9'));var ejs=require(_0x0b81('0xa'));var fs=require('fs');var _=require(_0x0b81('0xb'));var squel=require('squel');var crypto=require(_0x0b81('0xc'));var jsforce=require(_0x0b81('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0b81('0x9'));var querystring=require('querystring');var Papa=require(_0x0b81('0xe'));var Redis=require(_0x0b81('0xf'));var authService=require(_0x0b81('0x10'));var qs=require(_0x0b81('0x11'));var as=require(_0x0b81('0x12'));var hardwareService=require(_0x0b81('0x13'));var logger=require(_0x0b81('0x14'))(_0x0b81('0x15'));var utils=require(_0x0b81('0x16'));var config=require('../../config/environment');var db=require(_0x0b81('0x17'))['db'];function respondWithStatusCode(_0x28ed85,_0x47c853){_0x47c853=_0x47c853||0xcc;return function(_0x36ac96){if(_0x36ac96){return _0x28ed85['sendStatus'](_0x47c853);}return _0x28ed85[_0x0b81('0x18')](_0x47c853)[_0x0b81('0x19')]();};}function respondWithResult(_0x3c6175,_0x1f36c1){_0x1f36c1=_0x1f36c1||0xc8;return function(_0x1af185){if(_0x1af185){return _0x3c6175['status'](_0x1f36c1)[_0x0b81('0x1a')](_0x1af185);}};}function respondWithFilteredResult(_0x183017,_0x318483){return function(_0x234c2e){if(_0x234c2e){var _0x581626=_0x234c2e[_0x0b81('0x1b')],_0x41c82c=_0x318483['offset'],_0x4aa914=_0x318483['offset']+_0x318483[_0x0b81('0x1c')],_0x43f753;if(_0x4aa914>=_0x581626){_0x4aa914=_0x581626;_0x43f753=0xc8;}else{_0x43f753=0xce;}_0x183017[_0x0b81('0x18')](_0x43f753);return _0x183017[_0x0b81('0x1d')]('Content-Range',_0x41c82c+'-'+_0x4aa914+'/'+_0x581626)[_0x0b81('0x1a')](_0x234c2e);}return null;};}function patchUpdates(_0x4f2274){return function(_0x32719e){try{jsonpatch[_0x0b81('0x1e')](_0x32719e,_0x4f2274,!![]);}catch(_0x38b8cd){return BPromise[_0x0b81('0x1f')](_0x38b8cd);}return _0x32719e['save']();};}function saveUpdates(_0x3d912e,_0x4fb187){return function(_0x10ee49){if(_0x10ee49){return _0x10ee49[_0x0b81('0x20')](_0x3d912e)[_0x0b81('0x21')](function(_0x3c44d2){return _0x3c44d2;});}return null;};}function removeEntity(_0x9ce632,_0xf3eeba){return function(_0x4b6617){if(_0x4b6617){return _0x4b6617[_0x0b81('0x22')]()[_0x0b81('0x21')](function(){var _0x424523=_0x4b6617[_0x0b81('0x23')]({'plain':!![]});var _0x1ba4ef=_0x0b81('0x24');return db[_0x0b81('0x25')]['destroy']({'where':{'type':_0x1ba4ef,'resourceId':_0x424523['id']}})[_0x0b81('0x21')](function(){return _0x4b6617;});})[_0x0b81('0x21')](function(){_0x9ce632[_0x0b81('0x18')](0xcc)[_0x0b81('0x19')]();});}};}function handleEntityNotFound(_0x472b6b,_0x3c909d){return function(_0x56680d){if(!_0x56680d){_0x472b6b[_0x0b81('0x26')](0x194);}return _0x56680d;};}function handleError(_0x100db2,_0x2ac13b){_0x2ac13b=_0x2ac13b||0x1f4;return function(_0x5777f1){logger[_0x0b81('0x27')](_0x5777f1['stack']);if(_0x5777f1[_0x0b81('0x28')]){delete _0x5777f1[_0x0b81('0x28')];}_0x100db2['status'](_0x2ac13b)[_0x0b81('0x29')](_0x5777f1);};}exports['index']=function(_0x1f5498,_0x333417){var _0x11033f={},_0x20c72d={},_0x430280={'count':0x0,'rows':[]};var _0x473a6d=_[_0x0b81('0x2a')](db[_0x0b81('0x2b')][_0x0b81('0x2c')],function(_0x27fc08){return{'name':_0x27fc08[_0x0b81('0x2d')],'type':_0x27fc08['type']['key']};});_0x20c72d[_0x0b81('0x2e')]=_[_0x0b81('0x2a')](_0x473a6d,_0x0b81('0x28'));_0x20c72d['query']=_['keys'](_0x1f5498['query']);_0x20c72d[_0x0b81('0x2f')]=_[_0x0b81('0x30')](_0x20c72d['model'],_0x20c72d[_0x0b81('0x31')]);_0x11033f[_0x0b81('0x32')]=_[_0x0b81('0x30')](_0x20c72d[_0x0b81('0x2e')],qs[_0x0b81('0x33')](_0x1f5498[_0x0b81('0x31')][_0x0b81('0x33')]));_0x11033f[_0x0b81('0x32')]=_0x11033f['attributes'][_0x0b81('0x34')]?_0x11033f[_0x0b81('0x32')]:_0x20c72d[_0x0b81('0x2e')];if(!_0x1f5498['query'][_0x0b81('0x35')]('nolimit')){_0x11033f[_0x0b81('0x1c')]=qs[_0x0b81('0x1c')](_0x1f5498[_0x0b81('0x31')]['limit']);_0x11033f['offset']=qs['offset'](_0x1f5498[_0x0b81('0x31')]['offset']);}_0x11033f[_0x0b81('0x36')]=qs[_0x0b81('0x37')](_0x1f5498['query'][_0x0b81('0x37')]);_0x11033f[_0x0b81('0x38')]=qs['filters'](_[_0x0b81('0x39')](_0x1f5498[_0x0b81('0x31')],_0x20c72d[_0x0b81('0x2f')]),_0x473a6d);if(_0x1f5498[_0x0b81('0x31')]['filter']){_0x11033f[_0x0b81('0x38')]=_['merge'](_0x11033f[_0x0b81('0x38')],{'$or':_['map'](_0x473a6d,function(_0x29573b){if(_0x29573b[_0x0b81('0x3a')]!==_0x0b81('0x3b')){var _0x16666e={};_0x16666e[_0x29573b['name']]={'$like':'%'+_0x1f5498[_0x0b81('0x31')][_0x0b81('0x3c')]+'%'};return _0x16666e;}})});}_0x11033f=_[_0x0b81('0x3d')]({},_0x11033f,_0x1f5498[_0x0b81('0x3e')]);var _0x5ee548={'where':_0x11033f[_0x0b81('0x38')]};return db['Tag'][_0x0b81('0x1b')](_0x5ee548)[_0x0b81('0x21')](function(_0x5b4879){_0x430280['count']=_0x5b4879;if(_0x1f5498[_0x0b81('0x31')]['includeAll']){_0x11033f[_0x0b81('0x3f')]=[{'all':!![]}];}return db[_0x0b81('0x2b')][_0x0b81('0x40')](_0x11033f);})[_0x0b81('0x21')](function(_0x4b8825){_0x430280['rows']=_0x4b8825;return _0x430280;})[_0x0b81('0x21')](respondWithFilteredResult(_0x333417,_0x11033f))[_0x0b81('0x41')](handleError(_0x333417,null));};exports[_0x0b81('0x42')]=function(_0x1c6d4a,_0x563770){var _0x57b137={'raw':!![],'where':{'id':_0x1c6d4a[_0x0b81('0x43')]['id']}},_0x5ba81b={};_0x5ba81b[_0x0b81('0x2e')]=_['keys'](db[_0x0b81('0x2b')][_0x0b81('0x2c')]);_0x5ba81b[_0x0b81('0x31')]=_['keys'](_0x1c6d4a[_0x0b81('0x31')]);_0x5ba81b[_0x0b81('0x2f')]=_['intersection'](_0x5ba81b[_0x0b81('0x2e')],_0x5ba81b[_0x0b81('0x31')]);_0x57b137[_0x0b81('0x32')]=_[_0x0b81('0x30')](_0x5ba81b['model'],qs[_0x0b81('0x33')](_0x1c6d4a[_0x0b81('0x31')]['fields']));_0x57b137[_0x0b81('0x32')]=_0x57b137[_0x0b81('0x32')][_0x0b81('0x34')]?_0x57b137[_0x0b81('0x32')]:_0x5ba81b[_0x0b81('0x2e')];if(_0x1c6d4a['query']['includeAll']){_0x57b137[_0x0b81('0x3f')]=[{'all':!![]}];}_0x57b137=_[_0x0b81('0x3d')]({},_0x57b137,_0x1c6d4a[_0x0b81('0x3e')]);return db[_0x0b81('0x2b')]['find'](_0x57b137)[_0x0b81('0x21')](handleEntityNotFound(_0x563770,null))[_0x0b81('0x21')](respondWithResult(_0x563770,null))[_0x0b81('0x41')](handleError(_0x563770,null));};exports[_0x0b81('0x44')]=function(_0x2879d1,_0xc5ad42){return db['Tag'][_0x0b81('0x44')](_0x2879d1['body'],{})[_0x0b81('0x21')](function(_0x2dc896){var _0x3b9939=_0x2879d1['user'][_0x0b81('0x23')]({'plain':!![]});if(!_0x3b9939)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b9939[_0x0b81('0x45')]===_0x0b81('0x46')){var _0x87938a=_0x2dc896[_0x0b81('0x23')]({'plain':!![]});var _0x37f440='Tags';return db[_0x0b81('0x47')][_0x0b81('0x48')]({'where':{'name':_0x37f440,'userProfileId':_0x3b9939['userProfileId']},'raw':!![]})['then'](function(_0x269c86){if(_0x269c86&&_0x269c86['autoAssociation']===0x0){return db[_0x0b81('0x25')]['create']({'name':_0x87938a[_0x0b81('0x28')],'resourceId':_0x87938a['id'],'type':_0x269c86[_0x0b81('0x28')],'sectionId':_0x269c86['id']},{})[_0x0b81('0x21')](function(){return _0x2dc896;});}else{return _0x2dc896;}})[_0x0b81('0x41')](function(_0x3e01ed){logger[_0x0b81('0x27')](_0x0b81('0x49'),_0x3e01ed);throw _0x3e01ed;});}return _0x2dc896;})[_0x0b81('0x21')](respondWithResult(_0xc5ad42,0xc9))['catch'](handleError(_0xc5ad42,null));};exports[_0x0b81('0x20')]=function(_0x2cd6fb,_0x308b19){if(_0x2cd6fb[_0x0b81('0x4a')]['id']){delete _0x2cd6fb[_0x0b81('0x4a')]['id'];}return db[_0x0b81('0x2b')]['find']({'where':{'id':_0x2cd6fb[_0x0b81('0x43')]['id']}})[_0x0b81('0x21')](handleEntityNotFound(_0x308b19,null))[_0x0b81('0x21')](saveUpdates(_0x2cd6fb[_0x0b81('0x4a')],null))['then'](respondWithResult(_0x308b19,null))[_0x0b81('0x41')](handleError(_0x308b19,null));};exports['destroy']=function(_0x5d759a,_0x6a6bf0){return db[_0x0b81('0x2b')][_0x0b81('0x48')]({'where':{'id':_0x5d759a[_0x0b81('0x43')]['id']}})[_0x0b81('0x21')](handleEntityNotFound(_0x6a6bf0,null))[_0x0b81('0x21')](removeEntity(_0x6a6bf0,null))[_0x0b81('0x41')](handleError(_0x6a6bf0,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 16cbca7..9471113 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 _0xbdf4=['Tag','tools_tags','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports'];(function(_0x3828cd,_0x2e4822){var _0x3d4877=function(_0x27024b){while(--_0x27024b){_0x3828cd['push'](_0x3828cd['shift']());}};_0x3d4877(++_0x2e4822);}(_0xbdf4,0x199));var _0x4bdf=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xbdf4[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x4bdf('0x0'));var util=require(_0x4bdf('0x1'));var logger=require(_0x4bdf('0x2'))(_0x4bdf('0x3'));var moment=require('moment');var BPromise=require(_0x4bdf('0x4'));var rp=require(_0x4bdf('0x5'));var fs=require('fs');var path=require(_0x4bdf('0x6'));var rimraf=require(_0x4bdf('0x7'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x4bdf('0x8')]=function(_0xfcb4be,_0x4a752e){return _0xfcb4be['define'](_0x4bdf('0x9'),attributes,{'tableName':_0x4bdf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74eb=['./tag.attributes','define','Tag','tools_tags','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xdc4e5e,_0x31d26d){var _0x466a3a=function(_0x3bd421){while(--_0x3bd421){_0xdc4e5e['push'](_0xdc4e5e['shift']());}};_0x466a3a(++_0x31d26d);}(_0x74eb,0x67));var _0xb74e=function(_0x2899ec,_0x583f27){_0x2899ec=_0x2899ec-0x0;var _0x2b2e7e=_0x74eb[_0x2899ec];return _0x2b2e7e;};'use strict';var _=require('lodash');var util=require(_0xb74e('0x0'));var logger=require(_0xb74e('0x1'))(_0xb74e('0x2'));var moment=require(_0xb74e('0x3'));var BPromise=require(_0xb74e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb74e('0x5'));var rimraf=require(_0xb74e('0x6'));var config=require('../../config/environment');var attributes=require(_0xb74e('0x7'));module['exports']=function(_0x14e9e4,_0x36a87d){return _0x14e9e4[_0xb74e('0x8')](_0xb74e('0x9'),attributes,{'tableName':_0xb74e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index e13be5b..c4f3c96 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 _0xac4a=['Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xac4a,0x13f));var _0xaac4=function(_0x1f4899,_0x3f849a){_0x1f4899=_0x1f4899-0x0;var _0x2a695a=_0xac4a[_0x1f4899];return _0x2a695a;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('Tag,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('Tag,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xca66=['http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x3428fa,_0x46919d){var _0x32acfa=function(_0x224235){while(--_0x224235){_0x3428fa['push'](_0x3428fa['shift']());}};_0x32acfa(++_0x46919d);}(_0xca66,0x8b));var _0x6ca6=function(_0x4293af,_0x2608a6){_0x4293af=_0x4293af-0x0;var _0x305d08=_0xca66[_0x4293af];return _0x305d08;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ca6('0x1'));var rs=require(_0x6ca6('0x2'));var fs=require('fs');var Redis=require(_0x6ca6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ca6('0x4'));var logger=require('../../config/logger')(_0x6ca6('0x5'));var config=require('../../config/environment');var jayson=require(_0x6ca6('0x6'));var client=jayson[_0x6ca6('0x7')][_0x6ca6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44019c,_0x407e66,_0x27a210){return new BPromise(function(_0x27d280,_0x4f5651){return client[_0x6ca6('0x9')](_0x44019c,_0x27a210)[_0x6ca6('0xa')](function(_0x34b71b){logger[_0x6ca6('0xb')](_0x6ca6('0xc'),_0x407e66,_0x6ca6('0xd'));logger[_0x6ca6('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'),JSON[_0x6ca6('0xf')](_0x34b71b));if(_0x34b71b[_0x6ca6('0x10')]){if(_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x11')]===0x1f4){logger[_0x6ca6('0x10')]('Tag,\x20%s,\x20%s',_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x4f5651(_0x34b71b['error'][_0x6ca6('0x12')]);}logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x27d280(_0x34b71b[_0x6ca6('0x10')]['message']);}else{logger['info']('Tag,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'));_0x27d280(_0x34b71b[_0x6ca6('0x13')][_0x6ca6('0x12')]);}})[_0x6ca6('0x14')](function(_0x2c4a5c){logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x2c4a5c);_0x4f5651(_0x2c4a5c);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 48cd42c..7d8cd7c 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 _0xd35e=['/:id/users','getAgents','post','create','addQueues','addAgents','put','update','delete','destroy','removeQueues','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/queues','getQueues'];(function(_0x53d998,_0xf4511d){var _0x5b619d=function(_0x3cd888){while(--_0x3cd888){_0x53d998['push'](_0x53d998['shift']());}};_0x5b619d(++_0xf4511d);}(_0xd35e,0x79));var _0xed35=function(_0x159969,_0x48b72a){_0x159969=_0x159969-0x0;var _0x21fb4b=_0xd35e[_0x159969];return _0x21fb4b;};'use strict';var multer=require(_0xed35('0x0'));var util=require(_0xed35('0x1'));var path=require(_0xed35('0x2'));var timeout=require(_0xed35('0x3'));var express=require(_0xed35('0x4'));var router=express[_0xed35('0x5')]();var auth=require(_0xed35('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xed35('0x7'));var controller=require('./team.controller');router[_0xed35('0x8')]('/',auth[_0xed35('0x9')](),controller[_0xed35('0xa')]);router[_0xed35('0x8')](_0xed35('0xb'),auth[_0xed35('0x9')](),controller['show']);router['get'](_0xed35('0xc'),auth[_0xed35('0x9')](),controller[_0xed35('0xd')]);router[_0xed35('0x8')](_0xed35('0xe'),auth[_0xed35('0x9')](),controller[_0xed35('0xf')]);router[_0xed35('0x10')]('/',auth[_0xed35('0x9')](),controller[_0xed35('0x11')]);router['post'](_0xed35('0xc'),auth[_0xed35('0x9')](),controller[_0xed35('0x12')]);router['post'](_0xed35('0xe'),auth[_0xed35('0x9')](),controller[_0xed35('0x13')]);router[_0xed35('0x14')](_0xed35('0xb'),auth['isAuthenticated'](),controller[_0xed35('0x15')]);router[_0xed35('0x16')]('/:id',auth[_0xed35('0x9')](),controller[_0xed35('0x17')]);router[_0xed35('0x16')](_0xed35('0xc'),auth[_0xed35('0x9')](),controller[_0xed35('0x18')]);router[_0xed35('0x16')](_0xed35('0xe'),auth[_0xed35('0x9')](),controller[_0xed35('0x19')]);module[_0xed35('0x1a')]=router; \ No newline at end of file +var _0x8779=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','show','/:id/queues','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','put','update','delete','destroy','removeQueues','removeAgents','exports','multer'];(function(_0x1fc3aa,_0x1b92fd){var _0x11dd40=function(_0x4b8205){while(--_0x4b8205){_0x1fc3aa['push'](_0x1fc3aa['shift']());}};_0x11dd40(++_0x1b92fd);}(_0x8779,0x194));var _0x9877=function(_0x2d8182,_0x3484a9){_0x2d8182=_0x2d8182-0x0;var _0x3740a5=_0x8779[_0x2d8182];return _0x3740a5;};'use strict';var multer=require(_0x9877('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9877('0x1'));var express=require('express');var router=express[_0x9877('0x2')]();var auth=require(_0x9877('0x3'));var interaction=require(_0x9877('0x4'));var config=require(_0x9877('0x5'));var controller=require(_0x9877('0x6'));router[_0x9877('0x7')]('/',auth[_0x9877('0x8')](),controller[_0x9877('0x9')]);router[_0x9877('0x7')](_0x9877('0xa'),auth[_0x9877('0x8')](),controller[_0x9877('0xb')]);router[_0x9877('0x7')](_0x9877('0xc'),auth['isAuthenticated'](),controller[_0x9877('0xd')]);router['get'](_0x9877('0xe'),auth[_0x9877('0x8')](),controller[_0x9877('0xf')]);router[_0x9877('0x10')]('/',auth[_0x9877('0x8')](),controller[_0x9877('0x11')]);router['post']('/:id/queues',auth[_0x9877('0x8')](),controller[_0x9877('0x12')]);router[_0x9877('0x10')](_0x9877('0xe'),auth[_0x9877('0x8')](),controller[_0x9877('0x13')]);router[_0x9877('0x14')](_0x9877('0xa'),auth['isAuthenticated'](),controller[_0x9877('0x15')]);router[_0x9877('0x16')](_0x9877('0xa'),auth['isAuthenticated'](),controller[_0x9877('0x17')]);router[_0x9877('0x16')](_0x9877('0xc'),auth['isAuthenticated'](),controller[_0x9877('0x18')]);router[_0x9877('0x16')](_0x9877('0xe'),auth[_0x9877('0x8')](),controller[_0x9877('0x19')]);module[_0x9877('0x1a')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 7950721..5a15657 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 _0xfd81=['STRING','name','sequelize'];(function(_0x48c30e,_0x10641b){var _0x24ffc8=function(_0x4c00d1){while(--_0x4c00d1){_0x48c30e['push'](_0x48c30e['shift']());}};_0x24ffc8(++_0x10641b);}(_0xfd81,0x18b));var _0x1fd8=function(_0x282d1f,_0x42e463){_0x282d1f=_0x282d1f-0x0;var _0x12c2af=_0xfd81[_0x282d1f];return _0x12c2af;};'use strict';var Sequelize=require(_0x1fd8('0x0'));module['exports']={'name':{'type':Sequelize[_0x1fd8('0x1')],'allowNull':![],'unique':_0x1fd8('0x2')},'description':{'type':Sequelize[_0x1fd8('0x1')]}}; \ No newline at end of file +var _0xf00d=['exports','name','STRING','sequelize'];(function(_0x55655d,_0x2ac9cd){var _0x4d342f=function(_0x481230){while(--_0x481230){_0x55655d['push'](_0x55655d['shift']());}};_0x4d342f(++_0x2ac9cd);}(_0xf00d,0xf3));var _0xdf00=function(_0x3b81d4,_0x4ef011){_0x3b81d4=_0x3b81d4-0x0;var _0x5a5a59=_0xf00d[_0x3b81d4];return _0x5a5a59;};'use strict';var Sequelize=require(_0xdf00('0x0'));module[_0xdf00('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdf00('0x2')},'description':{'type':Sequelize[_0xdf00('0x3')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index fb77104..2bf66c3 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 _0x624c=['register','sendStatus','status','end','json','count','limit','set','Content-Range','apply','save','update','then','destroy','get','Teams','UserProfileResource','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','offset','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','create','role','user','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','capitalize','Queue','toLowerCase','Queues','addQueues','Unknown\x20channel','add','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Openchannel','each','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','spread','userTeam:save','removeAgents','voice','chat','mail','fax','openchannel','whatsapp','emit','userTeam:remove','getAgents','pick','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost'];(function(_0x337796,_0x2edbc9){var _0x15c164=function(_0x2af239){while(--_0x2af239){_0x337796['push'](_0x337796['shift']());}};_0x15c164(++_0x2edbc9);}(_0x624c,0x1ee));var _0xc624=function(_0x368d48,_0x4714a9){_0x368d48=_0x368d48-0x0;var _0xf494b5=_0x624c[_0x368d48];return _0xf494b5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc624('0x0'));var rimraf=require(_0xc624('0x1'));var zipdir=require(_0xc624('0x2'));var jsonpatch=require(_0xc624('0x3'));var rp=require(_0xc624('0x4'));var moment=require('moment');var BPromise=require(_0xc624('0x5'));var Mustache=require('mustache');var util=require(_0xc624('0x6'));var path=require('path');var sox=require(_0xc624('0x7'));var csv=require(_0xc624('0x8'));var ejs=require(_0xc624('0x9'));var fs=require('fs');var _=require(_0xc624('0xa'));var squel=require(_0xc624('0xb'));var crypto=require(_0xc624('0xc'));var jsforce=require(_0xc624('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc624('0x8'));var querystring=require(_0xc624('0xe'));var Papa=require(_0xc624('0xf'));var Redis=require('ioredis');var authService=require(_0xc624('0x10'));var qs=require(_0xc624('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc624('0x12'));var logger=require(_0xc624('0x13'))(_0xc624('0x14'));var utils=require(_0xc624('0x15'));var config=require(_0xc624('0x16'));var db=require('../../mysqldb')['db'];config[_0xc624('0x17')]=_[_0xc624('0x18')](config[_0xc624('0x17')],{'host':_0xc624('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')[_0xc624('0x1a')](socket);function respondWithStatusCode(_0x4cb641,_0x3cbc19){_0x3cbc19=_0x3cbc19||0xcc;return function(_0x5c236e){if(_0x5c236e){return _0x4cb641[_0xc624('0x1b')](_0x3cbc19);}return _0x4cb641[_0xc624('0x1c')](_0x3cbc19)[_0xc624('0x1d')]();};}function respondWithResult(_0x330df7,_0x5834f0){_0x5834f0=_0x5834f0||0xc8;return function(_0x3ad051){if(_0x3ad051){return _0x330df7[_0xc624('0x1c')](_0x5834f0)[_0xc624('0x1e')](_0x3ad051);}};}function respondWithFilteredResult(_0x523e1e,_0x190458){return function(_0x2c5b9a){if(_0x2c5b9a){var _0x5e263a=_0x2c5b9a[_0xc624('0x1f')],_0x151671=_0x190458['offset'],_0x170a4=_0x190458['offset']+_0x190458[_0xc624('0x20')],_0x4d0ece;if(_0x170a4>=_0x5e263a){_0x170a4=_0x5e263a;_0x4d0ece=0xc8;}else{_0x4d0ece=0xce;}_0x523e1e[_0xc624('0x1c')](_0x4d0ece);return _0x523e1e[_0xc624('0x21')](_0xc624('0x22'),_0x151671+'-'+_0x170a4+'/'+_0x5e263a)[_0xc624('0x1e')](_0x2c5b9a);}return null;};}function patchUpdates(_0x55be9e){return function(_0x2eb5ab){try{jsonpatch[_0xc624('0x23')](_0x2eb5ab,_0x55be9e,!![]);}catch(_0x3c056b){return BPromise['reject'](_0x3c056b);}return _0x2eb5ab[_0xc624('0x24')]();};}function saveUpdates(_0x5f0ac3,_0x3ce441){return function(_0x51deda){if(_0x51deda){return _0x51deda[_0xc624('0x25')](_0x5f0ac3)[_0xc624('0x26')](function(_0x3fe07e){return _0x3fe07e;});}return null;};}function removeEntity(_0x4b1812,_0x4aab4d){return function(_0x2ab7a1){if(_0x2ab7a1){return _0x2ab7a1[_0xc624('0x27')]()[_0xc624('0x26')](function(){var _0x1f3ca1=_0x2ab7a1[_0xc624('0x28')]({'plain':!![]});var _0x3ed4dd=_0xc624('0x29');return db[_0xc624('0x2a')][_0xc624('0x27')]({'where':{'type':_0x3ed4dd,'resourceId':_0x1f3ca1['id']}})[_0xc624('0x26')](function(){return _0x2ab7a1;});})['then'](function(){_0x4b1812[_0xc624('0x1c')](0xcc)[_0xc624('0x1d')]();});}};}function handleEntityNotFound(_0x281eb5,_0x19e607){return function(_0x5f558b){if(!_0x5f558b){_0x281eb5['sendStatus'](0x194);}return _0x5f558b;};}function handleError(_0x4da11b,_0x52b55c){_0x52b55c=_0x52b55c||0x1f4;return function(_0x362ad7){logger['error'](_0x362ad7[_0xc624('0x2b')]);if(_0x362ad7[_0xc624('0x2c')]){delete _0x362ad7[_0xc624('0x2c')];}_0x4da11b['status'](_0x52b55c)[_0xc624('0x2d')](_0x362ad7);};}exports[_0xc624('0x2e')]=function(_0x1c7b36,_0x3b8eb7){var _0x4482af={},_0x5cfecb={},_0x50448b={'count':0x0,'rows':[]};var _0x4d4a6e=_[_0xc624('0x2f')](db[_0xc624('0x30')][_0xc624('0x31')],function(_0x4052a8){return{'name':_0x4052a8[_0xc624('0x32')],'type':_0x4052a8[_0xc624('0x33')][_0xc624('0x34')]};});_0x5cfecb['model']=_[_0xc624('0x2f')](_0x4d4a6e,_0xc624('0x2c'));_0x5cfecb[_0xc624('0x35')]=_[_0xc624('0x36')](_0x1c7b36[_0xc624('0x35')]);_0x5cfecb[_0xc624('0x37')]=_[_0xc624('0x38')](_0x5cfecb[_0xc624('0x39')],_0x5cfecb[_0xc624('0x35')]);_0x4482af['attributes']=_['intersection'](_0x5cfecb[_0xc624('0x39')],qs[_0xc624('0x3a')](_0x1c7b36[_0xc624('0x35')][_0xc624('0x3a')]));_0x4482af[_0xc624('0x3b')]=_0x4482af[_0xc624('0x3b')][_0xc624('0x3c')]?_0x4482af[_0xc624('0x3b')]:_0x5cfecb[_0xc624('0x39')];if(!_0x1c7b36[_0xc624('0x35')][_0xc624('0x3d')]('nolimit')){_0x4482af[_0xc624('0x20')]=qs['limit'](_0x1c7b36['query'][_0xc624('0x20')]);_0x4482af[_0xc624('0x3e')]=qs[_0xc624('0x3e')](_0x1c7b36['query']['offset']);}_0x4482af[_0xc624('0x3f')]=qs[_0xc624('0x40')](_0x1c7b36[_0xc624('0x35')]['sort']);_0x4482af['where']=qs[_0xc624('0x37')](_['pick'](_0x1c7b36[_0xc624('0x35')],_0x5cfecb[_0xc624('0x37')]),_0x4d4a6e);if(_0x1c7b36['query'][_0xc624('0x41')]){_0x4482af['where']=_['merge'](_0x4482af[_0xc624('0x42')],{'$or':_[_0xc624('0x2f')](_0x4d4a6e,function(_0x24b206){if(_0x24b206[_0xc624('0x33')]!==_0xc624('0x43')){var _0x4a8d42={};_0x4a8d42[_0x24b206[_0xc624('0x2c')]]={'$like':'%'+_0x1c7b36[_0xc624('0x35')][_0xc624('0x41')]+'%'};return _0x4a8d42;}})});}_0x4482af=_[_0xc624('0x44')]({},_0x4482af,_0x1c7b36[_0xc624('0x45')]);var _0x28e7fc={'where':_0x4482af[_0xc624('0x42')]};return db[_0xc624('0x30')][_0xc624('0x1f')](_0x28e7fc)[_0xc624('0x26')](function(_0x4dd658){_0x50448b[_0xc624('0x1f')]=_0x4dd658;if(_0x1c7b36[_0xc624('0x35')][_0xc624('0x46')]){_0x4482af[_0xc624('0x47')]=[{'all':!![]}];}return db[_0xc624('0x30')][_0xc624('0x48')](_0x4482af);})[_0xc624('0x26')](function(_0x29a75a){_0x50448b[_0xc624('0x49')]=_0x29a75a;return _0x50448b;})[_0xc624('0x26')](respondWithFilteredResult(_0x3b8eb7,_0x4482af))[_0xc624('0x4a')](handleError(_0x3b8eb7,null));};exports['show']=function(_0x79ae9d,_0x4abdaf){var _0x4eb12c={'raw':![],'where':{'id':_0x79ae9d[_0xc624('0x4b')]['id']}},_0x111369={};_0x111369['model']=_[_0xc624('0x36')](db[_0xc624('0x30')][_0xc624('0x31')]);_0x111369['query']=_[_0xc624('0x36')](_0x79ae9d[_0xc624('0x35')]);_0x111369['filters']=_['intersection'](_0x111369[_0xc624('0x39')],_0x111369['query']);_0x4eb12c['attributes']=_[_0xc624('0x38')](_0x111369[_0xc624('0x39')],qs[_0xc624('0x3a')](_0x79ae9d[_0xc624('0x35')][_0xc624('0x3a')]));_0x4eb12c[_0xc624('0x3b')]=_0x4eb12c[_0xc624('0x3b')][_0xc624('0x3c')]?_0x4eb12c[_0xc624('0x3b')]:_0x111369[_0xc624('0x39')];if(_0x79ae9d[_0xc624('0x35')][_0xc624('0x46')]){_0x4eb12c[_0xc624('0x47')]=[{'all':!![]}];}_0x4eb12c=_[_0xc624('0x44')]({},_0x4eb12c,_0x79ae9d[_0xc624('0x45')]);return db['Team']['find'](_0x4eb12c)['then'](handleEntityNotFound(_0x4abdaf,null))['then'](respondWithResult(_0x4abdaf,null))[_0xc624('0x4a')](handleError(_0x4abdaf,null));};exports[_0xc624('0x4c')]=function(_0x8e062b,_0x1d3b6d){return db[_0xc624('0x30')][_0xc624('0x4c')](_0x8e062b['body'],{})[_0xc624('0x26')](function(_0x1c3a74){var _0x4ddccc=_0x8e062b['user']['get']({'plain':!![]});if(!_0x4ddccc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ddccc[_0xc624('0x4d')]===_0xc624('0x4e')){var _0x13fee1=_0x1c3a74['get']({'plain':!![]});var _0x5d102e='Teams';return db['UserProfileSection'][_0xc624('0x4f')]({'where':{'name':_0x5d102e,'userProfileId':_0x4ddccc['userProfileId']},'raw':!![]})[_0xc624('0x26')](function(_0xa84c6a){if(_0xa84c6a&&_0xa84c6a[_0xc624('0x50')]===0x0){return db[_0xc624('0x2a')][_0xc624('0x4c')]({'name':_0x13fee1[_0xc624('0x2c')],'resourceId':_0x13fee1['id'],'type':_0xa84c6a['name'],'sectionId':_0xa84c6a['id']},{})['then'](function(){return _0x1c3a74;});}else{return _0x1c3a74;}})[_0xc624('0x4a')](function(_0x29f5af){logger[_0xc624('0x51')](_0xc624('0x52'),_0x29f5af);throw _0x29f5af;});}return _0x1c3a74;})['then'](respondWithResult(_0x1d3b6d,0xc9))[_0xc624('0x4a')](handleError(_0x1d3b6d,null));};exports[_0xc624('0x25')]=function(_0x3fa310,_0x25964f){if(_0x3fa310[_0xc624('0x53')]['id']){delete _0x3fa310['body']['id'];}return db[_0xc624('0x30')][_0xc624('0x4f')]({'where':{'id':_0x3fa310[_0xc624('0x4b')]['id']}})[_0xc624('0x26')](handleEntityNotFound(_0x25964f,null))[_0xc624('0x26')](saveUpdates(_0x3fa310['body'],null))[_0xc624('0x26')](respondWithResult(_0x25964f,null))['catch'](handleError(_0x25964f,null));};exports['destroy']=function(_0x17508c,_0x30bf90){return db[_0xc624('0x30')][_0xc624('0x4f')]({'where':{'id':_0x17508c[_0xc624('0x4b')]['id']}})['then'](handleEntityNotFound(_0x30bf90,null))[_0xc624('0x26')](removeEntity(_0x30bf90,null))[_0xc624('0x4a')](handleError(_0x30bf90,null));};exports[_0xc624('0x54')]=function(_0x3e9bbc,_0x16a961,_0x1759f3){return db[_0xc624('0x30')][_0xc624('0x55')]({'where':{'id':_0x3e9bbc['params']['id']}})[_0xc624('0x26')](handleEntityNotFound(_0x16a961,null))[_0xc624('0x26')](function(_0xc043c1){if(!_0x3e9bbc[_0xc624('0x35')][_0xc624('0x56')]||!utils[_0xc624('0x57')](_0x3e9bbc[_0xc624('0x35')][_0xc624('0x56')])){throw new db[(_0xc624('0x58'))][(_0xc624('0x59'))]('Unknown\x20channel');}var _0x256e8e={};var _0x4ddc75={};_0x4ddc75['model']=_[_0xc624('0x36')](db[_[_0xc624('0x5a')](_0x3e9bbc[_0xc624('0x35')][_0xc624('0x56')]['toLowerCase']())+_0xc624('0x5b')]['rawAttributes']);_0x4ddc75['query']=_[_0xc624('0x36')](_0x3e9bbc[_0xc624('0x35')]);_0x4ddc75['filters']=_[_0xc624('0x38')](_0x4ddc75[_0xc624('0x39')],_0x4ddc75[_0xc624('0x35')]);_0x256e8e[_0xc624('0x3b')]=_[_0xc624('0x38')](_0x4ddc75[_0xc624('0x39')],qs[_0xc624('0x3a')](_0x3e9bbc[_0xc624('0x35')][_0xc624('0x3a')]));_0x256e8e[_0xc624('0x3b')]=_0x256e8e[_0xc624('0x3b')][_0xc624('0x3c')]?_0x256e8e[_0xc624('0x3b')]:_0x4ddc75[_0xc624('0x39')];_0x256e8e[_0xc624('0x20')]=qs['limit'](_0x3e9bbc['query'][_0xc624('0x20')]);_0x256e8e['offset']=qs[_0xc624('0x3e')](_0x3e9bbc[_0xc624('0x35')][_0xc624('0x3e')]);_0x256e8e[_0xc624('0x3f')]=qs[_0xc624('0x40')](_0x3e9bbc[_0xc624('0x35')][_0xc624('0x40')]);_0x256e8e[_0xc624('0x42')]=qs[_0xc624('0x37')](_['pick'](_0x3e9bbc[_0xc624('0x35')],_0x4ddc75['filters']));_0x256e8e=_[_0xc624('0x44')]({},_0x256e8e,_0x3e9bbc[_0xc624('0x45')]);return _0xc043c1['get'+_['capitalize'](_0x3e9bbc[_0xc624('0x35')][_0xc624('0x56')][_0xc624('0x5c')]())+_0xc624('0x5d')](_0x256e8e);})[_0xc624('0x26')](respondWithResult(_0x16a961,null))[_0xc624('0x4a')](handleError(_0x16a961,null));};exports[_0xc624('0x5e')]=function(_0xfb4b80,_0x2c9cc7,_0x203c43){return db[_0xc624('0x30')]['findOne']({'where':{'id':_0xfb4b80[_0xc624('0x4b')]['id']}})['then'](function(_0x373e4b){if(_0x373e4b){if(!_0xfb4b80[_0xc624('0x53')][_0xc624('0x56')]||!utils[_0xc624('0x57')](_0xfb4b80[_0xc624('0x53')]['channel'])){throw new db[(_0xc624('0x58'))][(_0xc624('0x59'))](_0xc624('0x5f'));}return _0x373e4b[_0xc624('0x60')+_['capitalize'](_0xfb4b80[_0xc624('0x53')][_0xc624('0x56')][_0xc624('0x5c')]())+'Queues'](_0xfb4b80['body'][_0xc624('0x61')]);}return null;})[_0xc624('0x26')](handleEntityNotFound(_0x2c9cc7,null))[_0xc624('0x26')](respondWithStatusCode(_0x2c9cc7,null))['catch'](handleError(_0x2c9cc7,null));};exports[_0xc624('0x62')]=function(_0x41fd1f,_0x530de1,_0x2be649){return db['Team']['findOne']({'where':{'id':_0x41fd1f[_0xc624('0x4b')]['id']}})[_0xc624('0x26')](function(_0x4ecb50){if(_0x4ecb50){if(!_0x41fd1f[_0xc624('0x35')][_0xc624('0x56')]||!utils['isValidChannel'](_0x41fd1f[_0xc624('0x35')][_0xc624('0x56')])){throw new db[(_0xc624('0x58'))]['ValidationError'](_0xc624('0x5f'));}return _0x4ecb50[_0xc624('0x63')+_[_0xc624('0x5a')](_0x41fd1f[_0xc624('0x35')][_0xc624('0x56')][_0xc624('0x5c')]())+_0xc624('0x5d')](_0x41fd1f[_0xc624('0x35')]['ids']);}return null;})['then'](handleEntityNotFound(_0x530de1,null))[_0xc624('0x26')](respondWithStatusCode(_0x530de1,null))[_0xc624('0x4a')](handleError(_0x530de1,null));};exports[_0xc624('0x64')]=function(_0x2707db,_0x4aca9c,_0x2cadb1){return db[_0xc624('0x30')]['find']({'where':{'id':_0x2707db['params']['id']}})['then'](handleEntityNotFound(_0x4aca9c,null))['then'](function(_0x376e40){if(_0x376e40){var _0x1c9f6a=[_0xc624('0x65'),_0xc624('0x66'),_0xc624('0x67'),_0xc624('0x68'),'Fax',_0xc624('0x69'),'Whatsapp'];return BPromise[_0xc624('0x6a')](_0x1c9f6a,function(_0x47b982){return _0x376e40['get'+_0x47b982+_0xc624('0x5d')]({'attributes':['id',_0xc624('0x2c')]})['then'](function(_0x3c0b81){return BPromise[_0xc624('0x6a')](_0x3c0b81,function(_0x345e52){return _0x345e52['addAgents'](_0x2707db['body'][_0xc624('0x61')])['then'](function(){if(_0x47b982==='Voice'){return db[_0xc624('0x6b')]['findAll']({'where':{'id':_0x2707db['body'][_0xc624('0x61')]},'attributes':['id',_0xc624('0x2c'),_0xc624('0x6c'),_0xc624('0x6d'),_0xc624('0x6e')],'raw':!![]})[_0xc624('0x26')](function(_0x3612bd){return BPromise[_0xc624('0x6a')](_[_0xc624('0x41')](_0x3612bd,{'online':0x1}),function(_0x1cd405){return db[_0xc624('0x6f')][_0xc624('0x70')]({'membername':_0x1cd405[_0xc624('0x2c')],'UserId':_0x1cd405['id'],'queue_name':_0x345e52['name'],'VoiceQueueId':_0x345e52['id'],'interface':_[_0xc624('0x71')](_0x1cd405[_0xc624('0x6e')])?util[_0xc624('0x72')](_0xc624('0x73'),_0x1cd405[_0xc624('0x2c')]):_0x1cd405[_0xc624('0x6e')],'paused':_0x1cd405[_0xc624('0x6d')]||![],'penalty':0x0});});});}});});})[_0xc624('0x26')](function(){return _0x376e40;});})[_0xc624('0x26')](function(){return _0x376e40;});}})[_0xc624('0x26')](function(_0x4d06b4){if(_0x4d06b4){return _0x4d06b4[_0xc624('0x64')](_0x2707db[_0xc624('0x53')][_0xc624('0x61')],_['omit'](_0x2707db['body'],[_0xc624('0x61'),'id'])||{})[_0xc624('0x74')](function(_0x276d4d){for(var _0xedbcd4=0x0;_0xedbcd4<_0x2707db['body']['ids'][_0xc624('0x3c')];_0xedbcd4+=0x1){socket['emit'](_0xc624('0x75'),{'UserId':_0x2707db['body']['ids'][_0xedbcd4],'TeamId':_0x2707db[_0xc624('0x4b')]['id']});}return _0x276d4d;});}})[_0xc624('0x26')](respondWithResult(_0x4aca9c,null))[_0xc624('0x4a')](handleError(_0x4aca9c,null));};exports[_0xc624('0x76')]=function(_0x2521a4,_0x270e20,_0x194ed0){return db[_0xc624('0x30')]['find']({'where':{'id':_0x2521a4['params']['id']}})[_0xc624('0x26')](handleEntityNotFound(_0x270e20,null))['then'](function(_0x3c3a4f){if(_0x3c3a4f){return BPromise[_0xc624('0x6a')]([_0xc624('0x77'),_0xc624('0x78'),_0xc624('0x79'),'sms',_0xc624('0x7a'),_0xc624('0x7b'),_0xc624('0x7c')],function(_0x576685){return _0x3c3a4f[_0xc624('0x28')+_['capitalize'](_0x576685)+_0xc624('0x5d')]({'attributes':['id',_0xc624('0x2c')]})['then'](function(_0x44cd30){return BPromise['each'](_0x44cd30,function(_0xa9544b){return _0xa9544b[_0xc624('0x76')](_0x2521a4[_0xc624('0x35')]['ids'])[_0xc624('0x26')](function(){if(_0x576685===_0xc624('0x77')){return db[_0xc624('0x6f')]['destroy']({'where':{'VoiceQueueId':_0xa9544b['id'],'UserId':_0x2521a4[_0xc624('0x35')]['ids']}});}});});})[_0xc624('0x26')](function(){return _0x3c3a4f;});})[_0xc624('0x26')](function(){return _0x3c3a4f;});}})[_0xc624('0x26')](function(_0x2c0fd4){if(_0x2c0fd4){return _0x2c0fd4[_0xc624('0x76')](_0x2521a4[_0xc624('0x35')][_0xc624('0x61')])[_0xc624('0x26')](function(){if(_['isArray'](_0x2521a4[_0xc624('0x35')]['ids'])){for(var _0xdcfec2=0x0;_0xdcfec2<_0x2521a4['query'][_0xc624('0x61')][_0xc624('0x3c')];_0xdcfec2+=0x1){socket[_0xc624('0x7d')]('userTeam:remove',{'UserId':Number(_0x2521a4[_0xc624('0x35')]['ids'][_0xdcfec2]),'TeamId':Number(_0x2521a4[_0xc624('0x4b')]['id'])});}}else{socket[_0xc624('0x7d')](_0xc624('0x7e'),{'UserId':Number(_0x2521a4[_0xc624('0x35')][_0xc624('0x61')]),'TeamId':Number(_0x2521a4[_0xc624('0x4b')]['id'])});}});}})[_0xc624('0x26')](respondWithStatusCode(_0x270e20,null))[_0xc624('0x4a')](handleError(_0x270e20,null));};exports[_0xc624('0x7f')]=function(_0x1215e2,_0x5929dc,_0x2f375d){var _0x3e8866={};var _0x39a3ac={};var _0x57b37d;var _0x2dd509;return db[_0xc624('0x30')]['findOne']({'where':{'id':_0x1215e2['params']['id']}})[_0xc624('0x26')](handleEntityNotFound(_0x5929dc,null))['then'](function(_0x4629f0){if(_0x4629f0){_0x57b37d=_0x4629f0;_0x39a3ac[_0xc624('0x39')]=_[_0xc624('0x36')](db[_0xc624('0x6b')][_0xc624('0x31')]);_0x39a3ac[_0xc624('0x35')]=_[_0xc624('0x36')](_0x1215e2['query']);_0x39a3ac[_0xc624('0x37')]=_[_0xc624('0x38')](_0x39a3ac[_0xc624('0x39')],_0x39a3ac[_0xc624('0x35')]);_0x3e8866[_0xc624('0x3b')]=_[_0xc624('0x38')](_0x39a3ac['model'],qs['fields'](_0x1215e2[_0xc624('0x35')]['fields']));_0x3e8866[_0xc624('0x3b')]=_0x3e8866['attributes'][_0xc624('0x3c')]?_0x3e8866[_0xc624('0x3b')]:_0x39a3ac[_0xc624('0x39')];_0x3e8866[_0xc624('0x3f')]=qs[_0xc624('0x40')](_0x1215e2[_0xc624('0x35')][_0xc624('0x40')]);_0x3e8866['where']=qs['filters'](_[_0xc624('0x80')](_0x1215e2[_0xc624('0x35')],_0x39a3ac[_0xc624('0x37')]));if(_0x1215e2[_0xc624('0x35')][_0xc624('0x41')]){_0x3e8866[_0xc624('0x42')]=_['merge'](_0x3e8866[_0xc624('0x42')],{'$or':_[_0xc624('0x2f')](_0x3e8866[_0xc624('0x3b')],function(_0x2b972b){var _0x49ea30={};_0x49ea30[_0x2b972b]={'$like':'%'+_0x1215e2[_0xc624('0x35')][_0xc624('0x41')]+'%'};return _0x49ea30;})});}_0x3e8866=_[_0xc624('0x44')]({},_0x3e8866,_0x1215e2[_0xc624('0x45')]);return _0x57b37d['getAgents'](_0x3e8866);}})['then'](function(_0x518a05){if(_0x518a05){_0x2dd509=_0x518a05[_0xc624('0x3c')];if(!_0x1215e2[_0xc624('0x35')][_0xc624('0x3d')](_0xc624('0x81'))){_0x3e8866[_0xc624('0x20')]=qs['limit'](_0x1215e2[_0xc624('0x35')]['limit']);_0x3e8866[_0xc624('0x3e')]=qs[_0xc624('0x3e')](_0x1215e2['query'][_0xc624('0x3e')]);}return _0x57b37d[_0xc624('0x7f')](_0x3e8866);}})[_0xc624('0x26')](function(_0x526762){if(_0x526762){return _0x526762?{'count':_0x2dd509,'rows':_0x526762}:null;}})[_0xc624('0x26')](respondWithResult(_0x5929dc,null))['catch'](handleError(_0x5929dc,null));}; \ No newline at end of file +var _0x3657=['map','Team','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','count','include','params','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','capitalize','toLowerCase','Queue','Queues','addQueues','Unknown\x20channel','add','ids','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','interface','isNil','SIP/%s','omit','spread','emit','userTeam:save','voice','mail','sms','fax','whatsapp','removeAgents','UserVoiceQueueRt','isArray','userTeam:remove','getAgents','sort','options','nolimit','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','offset','limit','set','Content-Range','apply','save','update','then','get','Teams','UserProfileResource','destroy','end','error','stack','name','send','index'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x3657,0xcd));var _0x7365=function(_0x2cac50,_0x320bb5){_0x2cac50=_0x2cac50-0x0;var _0x1b7d73=_0x3657[_0x2cac50];return _0x1b7d73;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7365('0x0'));var rimraf=require(_0x7365('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7365('0x2'));var rp=require(_0x7365('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7365('0x4'));var path=require(_0x7365('0x5'));var sox=require(_0x7365('0x6'));var csv=require(_0x7365('0x7'));var ejs=require(_0x7365('0x8'));var fs=require('fs');var _=require(_0x7365('0x9'));var squel=require(_0x7365('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7365('0xb'));var toCsv=require(_0x7365('0x7'));var querystring=require(_0x7365('0xc'));var Papa=require(_0x7365('0xd'));var Redis=require(_0x7365('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7365('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7365('0x10'));var logger=require(_0x7365('0x11'))(_0x7365('0x12'));var utils=require(_0x7365('0x13'));var config=require(_0x7365('0x14'));var db=require(_0x7365('0x15'))['db'];config[_0x7365('0x16')]=_[_0x7365('0x17')](config[_0x7365('0x16')],{'host':_0x7365('0x18'),'port':0x18eb});var socket=require(_0x7365('0x19'))(new Redis(config['redis']));require(_0x7365('0x1a'))['register'](socket);function respondWithStatusCode(_0x223d8d,_0xf578c7){_0xf578c7=_0xf578c7||0xcc;return function(_0x516c6c){if(_0x516c6c){return _0x223d8d[_0x7365('0x1b')](_0xf578c7);}return _0x223d8d[_0x7365('0x1c')](_0xf578c7)['end']();};}function respondWithResult(_0x1481a0,_0x2d0251){_0x2d0251=_0x2d0251||0xc8;return function(_0x1c3b45){if(_0x1c3b45){return _0x1481a0[_0x7365('0x1c')](_0x2d0251)['json'](_0x1c3b45);}};}function respondWithFilteredResult(_0x4af180,_0x42d5ef){return function(_0x4e4471){if(_0x4e4471){var _0x2200c3=_0x4e4471['count'],_0x39ec6b=_0x42d5ef[_0x7365('0x1d')],_0x26bd84=_0x42d5ef[_0x7365('0x1d')]+_0x42d5ef[_0x7365('0x1e')],_0x251a97;if(_0x26bd84>=_0x2200c3){_0x26bd84=_0x2200c3;_0x251a97=0xc8;}else{_0x251a97=0xce;}_0x4af180[_0x7365('0x1c')](_0x251a97);return _0x4af180[_0x7365('0x1f')](_0x7365('0x20'),_0x39ec6b+'-'+_0x26bd84+'/'+_0x2200c3)['json'](_0x4e4471);}return null;};}function patchUpdates(_0x1322cf){return function(_0x4ec5b2){try{jsonpatch[_0x7365('0x21')](_0x4ec5b2,_0x1322cf,!![]);}catch(_0xc9655e){return BPromise['reject'](_0xc9655e);}return _0x4ec5b2[_0x7365('0x22')]();};}function saveUpdates(_0x50da27,_0x11c48c){return function(_0x5a6314){if(_0x5a6314){return _0x5a6314[_0x7365('0x23')](_0x50da27)[_0x7365('0x24')](function(_0x372095){return _0x372095;});}return null;};}function removeEntity(_0x18c067,_0x104925){return function(_0x28204e){if(_0x28204e){return _0x28204e['destroy']()[_0x7365('0x24')](function(){var _0x1145a5=_0x28204e[_0x7365('0x25')]({'plain':!![]});var _0x43086e=_0x7365('0x26');return db[_0x7365('0x27')][_0x7365('0x28')]({'where':{'type':_0x43086e,'resourceId':_0x1145a5['id']}})[_0x7365('0x24')](function(){return _0x28204e;});})['then'](function(){_0x18c067['status'](0xcc)[_0x7365('0x29')]();});}};}function handleEntityNotFound(_0x342dd8,_0xc35e4d){return function(_0x1aa364){if(!_0x1aa364){_0x342dd8[_0x7365('0x1b')](0x194);}return _0x1aa364;};}function handleError(_0x4b1cc1,_0x5eda72){_0x5eda72=_0x5eda72||0x1f4;return function(_0x50e8a0){logger[_0x7365('0x2a')](_0x50e8a0[_0x7365('0x2b')]);if(_0x50e8a0[_0x7365('0x2c')]){delete _0x50e8a0['name'];}_0x4b1cc1[_0x7365('0x1c')](_0x5eda72)[_0x7365('0x2d')](_0x50e8a0);};}exports[_0x7365('0x2e')]=function(_0x182387,_0x23ecba){var _0x5899b3={},_0x2faef5={},_0x330690={'count':0x0,'rows':[]};var _0x4a4f64=_[_0x7365('0x2f')](db[_0x7365('0x30')][_0x7365('0x31')],function(_0x1e04ef){return{'name':_0x1e04ef[_0x7365('0x32')],'type':_0x1e04ef[_0x7365('0x33')][_0x7365('0x34')]};});_0x2faef5['model']=_['map'](_0x4a4f64,_0x7365('0x2c'));_0x2faef5[_0x7365('0x35')]=_[_0x7365('0x36')](_0x182387[_0x7365('0x35')]);_0x2faef5['filters']=_[_0x7365('0x37')](_0x2faef5[_0x7365('0x38')],_0x2faef5['query']);_0x5899b3[_0x7365('0x39')]=_['intersection'](_0x2faef5['model'],qs[_0x7365('0x3a')](_0x182387[_0x7365('0x35')][_0x7365('0x3a')]));_0x5899b3[_0x7365('0x39')]=_0x5899b3['attributes'][_0x7365('0x3b')]?_0x5899b3[_0x7365('0x39')]:_0x2faef5[_0x7365('0x38')];if(!_0x182387['query'][_0x7365('0x3c')]('nolimit')){_0x5899b3['limit']=qs['limit'](_0x182387['query'][_0x7365('0x1e')]);_0x5899b3[_0x7365('0x1d')]=qs['offset'](_0x182387[_0x7365('0x35')][_0x7365('0x1d')]);}_0x5899b3[_0x7365('0x3d')]=qs['sort'](_0x182387[_0x7365('0x35')]['sort']);_0x5899b3[_0x7365('0x3e')]=qs[_0x7365('0x3f')](_[_0x7365('0x40')](_0x182387[_0x7365('0x35')],_0x2faef5[_0x7365('0x3f')]),_0x4a4f64);if(_0x182387[_0x7365('0x35')][_0x7365('0x41')]){_0x5899b3[_0x7365('0x3e')]=_[_0x7365('0x42')](_0x5899b3[_0x7365('0x3e')],{'$or':_[_0x7365('0x2f')](_0x4a4f64,function(_0x5d4371){if(_0x5d4371[_0x7365('0x33')]!==_0x7365('0x43')){var _0xe3a6d5={};_0xe3a6d5[_0x5d4371[_0x7365('0x2c')]]={'$like':'%'+_0x182387[_0x7365('0x35')][_0x7365('0x41')]+'%'};return _0xe3a6d5;}})});}_0x5899b3=_[_0x7365('0x42')]({},_0x5899b3,_0x182387['options']);var _0x3d1787={'where':_0x5899b3['where']};return db[_0x7365('0x30')][_0x7365('0x44')](_0x3d1787)[_0x7365('0x24')](function(_0x4d5c4c){_0x330690[_0x7365('0x44')]=_0x4d5c4c;if(_0x182387[_0x7365('0x35')]['includeAll']){_0x5899b3[_0x7365('0x45')]=[{'all':!![]}];}return db[_0x7365('0x30')]['findAll'](_0x5899b3);})[_0x7365('0x24')](function(_0x315459){_0x330690['rows']=_0x315459;return _0x330690;})[_0x7365('0x24')](respondWithFilteredResult(_0x23ecba,_0x5899b3))['catch'](handleError(_0x23ecba,null));};exports['show']=function(_0x291295,_0x227444){var _0x314c63={'raw':![],'where':{'id':_0x291295[_0x7365('0x46')]['id']}},_0xf9c9ca={};_0xf9c9ca[_0x7365('0x38')]=_[_0x7365('0x36')](db[_0x7365('0x30')][_0x7365('0x31')]);_0xf9c9ca[_0x7365('0x35')]=_['keys'](_0x291295[_0x7365('0x35')]);_0xf9c9ca['filters']=_[_0x7365('0x37')](_0xf9c9ca[_0x7365('0x38')],_0xf9c9ca['query']);_0x314c63[_0x7365('0x39')]=_[_0x7365('0x37')](_0xf9c9ca['model'],qs[_0x7365('0x3a')](_0x291295[_0x7365('0x35')][_0x7365('0x3a')]));_0x314c63[_0x7365('0x39')]=_0x314c63['attributes'][_0x7365('0x3b')]?_0x314c63[_0x7365('0x39')]:_0xf9c9ca[_0x7365('0x38')];if(_0x291295[_0x7365('0x35')][_0x7365('0x47')]){_0x314c63[_0x7365('0x45')]=[{'all':!![]}];}_0x314c63=_[_0x7365('0x42')]({},_0x314c63,_0x291295['options']);return db[_0x7365('0x30')][_0x7365('0x48')](_0x314c63)['then'](handleEntityNotFound(_0x227444,null))[_0x7365('0x24')](respondWithResult(_0x227444,null))[_0x7365('0x49')](handleError(_0x227444,null));};exports[_0x7365('0x4a')]=function(_0x1cabdc,_0xb15349){return db[_0x7365('0x30')][_0x7365('0x4a')](_0x1cabdc[_0x7365('0x4b')],{})[_0x7365('0x24')](function(_0x234c98){var _0x1f2e4a=_0x1cabdc['user'][_0x7365('0x25')]({'plain':!![]});if(!_0x1f2e4a)throw new Error(_0x7365('0x4c'));if(_0x1f2e4a[_0x7365('0x4d')]===_0x7365('0x4e')){var _0x213306=_0x234c98[_0x7365('0x25')]({'plain':!![]});var _0x2f0b7c=_0x7365('0x26');return db['UserProfileSection'][_0x7365('0x48')]({'where':{'name':_0x2f0b7c,'userProfileId':_0x1f2e4a[_0x7365('0x4f')]},'raw':!![]})[_0x7365('0x24')](function(_0x3ed655){if(_0x3ed655&&_0x3ed655['autoAssociation']===0x0){return db[_0x7365('0x27')][_0x7365('0x4a')]({'name':_0x213306['name'],'resourceId':_0x213306['id'],'type':_0x3ed655[_0x7365('0x2c')],'sectionId':_0x3ed655['id']},{})[_0x7365('0x24')](function(){return _0x234c98;});}else{return _0x234c98;}})[_0x7365('0x49')](function(_0x37f24c){logger['error'](_0x7365('0x50'),_0x37f24c);throw _0x37f24c;});}return _0x234c98;})[_0x7365('0x24')](respondWithResult(_0xb15349,0xc9))[_0x7365('0x49')](handleError(_0xb15349,null));};exports[_0x7365('0x23')]=function(_0x472910,_0x13b70a){if(_0x472910[_0x7365('0x4b')]['id']){delete _0x472910[_0x7365('0x4b')]['id'];}return db['Team'][_0x7365('0x48')]({'where':{'id':_0x472910[_0x7365('0x46')]['id']}})[_0x7365('0x24')](handleEntityNotFound(_0x13b70a,null))['then'](saveUpdates(_0x472910[_0x7365('0x4b')],null))['then'](respondWithResult(_0x13b70a,null))[_0x7365('0x49')](handleError(_0x13b70a,null));};exports['destroy']=function(_0x15298a,_0x47f166){return db[_0x7365('0x30')][_0x7365('0x48')]({'where':{'id':_0x15298a['params']['id']}})[_0x7365('0x24')](handleEntityNotFound(_0x47f166,null))[_0x7365('0x24')](removeEntity(_0x47f166,null))[_0x7365('0x49')](handleError(_0x47f166,null));};exports[_0x7365('0x51')]=function(_0x16375e,_0x3b738b,_0x558be5){return db[_0x7365('0x30')][_0x7365('0x52')]({'where':{'id':_0x16375e[_0x7365('0x46')]['id']}})[_0x7365('0x24')](handleEntityNotFound(_0x3b738b,null))[_0x7365('0x24')](function(_0x30b838){if(!_0x16375e['query'][_0x7365('0x53')]||!utils[_0x7365('0x54')](_0x16375e['query'][_0x7365('0x53')])){throw new db[(_0x7365('0x55'))][(_0x7365('0x56'))]('Unknown\x20channel');}var _0x479815={};var _0x1a0c84={};_0x1a0c84[_0x7365('0x38')]=_['keys'](db[_[_0x7365('0x57')](_0x16375e[_0x7365('0x35')]['channel'][_0x7365('0x58')]())+_0x7365('0x59')][_0x7365('0x31')]);_0x1a0c84[_0x7365('0x35')]=_[_0x7365('0x36')](_0x16375e[_0x7365('0x35')]);_0x1a0c84['filters']=_['intersection'](_0x1a0c84[_0x7365('0x38')],_0x1a0c84[_0x7365('0x35')]);_0x479815['attributes']=_[_0x7365('0x37')](_0x1a0c84[_0x7365('0x38')],qs[_0x7365('0x3a')](_0x16375e['query'][_0x7365('0x3a')]));_0x479815[_0x7365('0x39')]=_0x479815[_0x7365('0x39')][_0x7365('0x3b')]?_0x479815['attributes']:_0x1a0c84[_0x7365('0x38')];_0x479815[_0x7365('0x1e')]=qs['limit'](_0x16375e[_0x7365('0x35')][_0x7365('0x1e')]);_0x479815[_0x7365('0x1d')]=qs[_0x7365('0x1d')](_0x16375e[_0x7365('0x35')]['offset']);_0x479815['order']=qs['sort'](_0x16375e[_0x7365('0x35')]['sort']);_0x479815[_0x7365('0x3e')]=qs[_0x7365('0x3f')](_[_0x7365('0x40')](_0x16375e[_0x7365('0x35')],_0x1a0c84['filters']));_0x479815=_['merge']({},_0x479815,_0x16375e['options']);return _0x30b838[_0x7365('0x25')+_[_0x7365('0x57')](_0x16375e[_0x7365('0x35')][_0x7365('0x53')][_0x7365('0x58')]())+_0x7365('0x5a')](_0x479815);})[_0x7365('0x24')](respondWithResult(_0x3b738b,null))[_0x7365('0x49')](handleError(_0x3b738b,null));};exports[_0x7365('0x5b')]=function(_0x3dbf7b,_0x42e5cf,_0x24de41){return db['Team'][_0x7365('0x52')]({'where':{'id':_0x3dbf7b[_0x7365('0x46')]['id']}})['then'](function(_0x1a0991){if(_0x1a0991){if(!_0x3dbf7b[_0x7365('0x4b')][_0x7365('0x53')]||!utils['isValidChannel'](_0x3dbf7b[_0x7365('0x4b')][_0x7365('0x53')])){throw new db[(_0x7365('0x55'))][(_0x7365('0x56'))](_0x7365('0x5c'));}return _0x1a0991[_0x7365('0x5d')+_[_0x7365('0x57')](_0x3dbf7b[_0x7365('0x4b')][_0x7365('0x53')][_0x7365('0x58')]())+_0x7365('0x5a')](_0x3dbf7b['body'][_0x7365('0x5e')]);}return null;})[_0x7365('0x24')](handleEntityNotFound(_0x42e5cf,null))['then'](respondWithStatusCode(_0x42e5cf,null))[_0x7365('0x49')](handleError(_0x42e5cf,null));};exports['removeQueues']=function(_0x58ad14,_0x1bfeb9,_0x13e483){return db['Team'][_0x7365('0x52')]({'where':{'id':_0x58ad14[_0x7365('0x46')]['id']}})[_0x7365('0x24')](function(_0x178692){if(_0x178692){if(!_0x58ad14[_0x7365('0x35')]['channel']||!utils[_0x7365('0x54')](_0x58ad14['query'][_0x7365('0x53')])){throw new db['Sequelize']['ValidationError'](_0x7365('0x5c'));}return _0x178692[_0x7365('0x5f')+_[_0x7365('0x57')](_0x58ad14['query']['channel'][_0x7365('0x58')]())+'Queues'](_0x58ad14[_0x7365('0x35')][_0x7365('0x5e')]);}return null;})[_0x7365('0x24')](handleEntityNotFound(_0x1bfeb9,null))[_0x7365('0x24')](respondWithStatusCode(_0x1bfeb9,null))['catch'](handleError(_0x1bfeb9,null));};exports[_0x7365('0x60')]=function(_0x3900db,_0x115945,_0x26b68b){return db[_0x7365('0x30')][_0x7365('0x48')]({'where':{'id':_0x3900db[_0x7365('0x46')]['id']}})[_0x7365('0x24')](handleEntityNotFound(_0x115945,null))['then'](function(_0x44df7e){if(_0x44df7e){var _0x5ea2f3=[_0x7365('0x61'),_0x7365('0x62'),_0x7365('0x63'),_0x7365('0x64'),_0x7365('0x65'),_0x7365('0x66'),_0x7365('0x67')];return BPromise[_0x7365('0x68')](_0x5ea2f3,function(_0x10c114){return _0x44df7e[_0x7365('0x25')+_0x10c114+_0x7365('0x5a')]({'attributes':['id',_0x7365('0x2c')]})[_0x7365('0x24')](function(_0x47467f){return BPromise[_0x7365('0x68')](_0x47467f,function(_0x8cbae6){return _0x8cbae6[_0x7365('0x60')](_0x3900db[_0x7365('0x4b')][_0x7365('0x5e')])['then'](function(){if(_0x10c114===_0x7365('0x61')){return db[_0x7365('0x69')]['findAll']({'where':{'id':_0x3900db[_0x7365('0x4b')][_0x7365('0x5e')]},'attributes':['id',_0x7365('0x2c'),'online','voicePause',_0x7365('0x6a')],'raw':!![]})[_0x7365('0x24')](function(_0x10dd1e){return BPromise[_0x7365('0x68')](_['filter'](_0x10dd1e,{'online':0x1}),function(_0x423737){return db['UserVoiceQueueRt']['upsert']({'membername':_0x423737[_0x7365('0x2c')],'UserId':_0x423737['id'],'queue_name':_0x8cbae6[_0x7365('0x2c')],'VoiceQueueId':_0x8cbae6['id'],'interface':_[_0x7365('0x6b')](_0x423737[_0x7365('0x6a')])?util['format'](_0x7365('0x6c'),_0x423737[_0x7365('0x2c')]):_0x423737[_0x7365('0x6a')],'paused':_0x423737['voicePause']||![],'penalty':0x0});});});}});});})[_0x7365('0x24')](function(){return _0x44df7e;});})['then'](function(){return _0x44df7e;});}})['then'](function(_0x5acbdf){if(_0x5acbdf){return _0x5acbdf['addAgents'](_0x3900db['body'][_0x7365('0x5e')],_[_0x7365('0x6d')](_0x3900db[_0x7365('0x4b')],[_0x7365('0x5e'),'id'])||{})[_0x7365('0x6e')](function(_0x26e841){for(var _0x43ff32=0x0;_0x43ff32<_0x3900db['body'][_0x7365('0x5e')]['length'];_0x43ff32+=0x1){socket[_0x7365('0x6f')](_0x7365('0x70'),{'UserId':_0x3900db[_0x7365('0x4b')][_0x7365('0x5e')][_0x43ff32],'TeamId':_0x3900db[_0x7365('0x46')]['id']});}return _0x26e841;});}})['then'](respondWithResult(_0x115945,null))[_0x7365('0x49')](handleError(_0x115945,null));};exports['removeAgents']=function(_0x203def,_0x330a22,_0x38c71f){return db[_0x7365('0x30')][_0x7365('0x48')]({'where':{'id':_0x203def[_0x7365('0x46')]['id']}})['then'](handleEntityNotFound(_0x330a22,null))[_0x7365('0x24')](function(_0x42e119){if(_0x42e119){return BPromise[_0x7365('0x68')]([_0x7365('0x71'),'chat',_0x7365('0x72'),_0x7365('0x73'),_0x7365('0x74'),'openchannel',_0x7365('0x75')],function(_0x5b5487){return _0x42e119['get'+_[_0x7365('0x57')](_0x5b5487)+_0x7365('0x5a')]({'attributes':['id',_0x7365('0x2c')]})['then'](function(_0x4f9ff0){return BPromise[_0x7365('0x68')](_0x4f9ff0,function(_0x1bb8b8){return _0x1bb8b8[_0x7365('0x76')](_0x203def[_0x7365('0x35')][_0x7365('0x5e')])[_0x7365('0x24')](function(){if(_0x5b5487===_0x7365('0x71')){return db[_0x7365('0x77')][_0x7365('0x28')]({'where':{'VoiceQueueId':_0x1bb8b8['id'],'UserId':_0x203def[_0x7365('0x35')][_0x7365('0x5e')]}});}});});})[_0x7365('0x24')](function(){return _0x42e119;});})[_0x7365('0x24')](function(){return _0x42e119;});}})[_0x7365('0x24')](function(_0x16b479){if(_0x16b479){return _0x16b479[_0x7365('0x76')](_0x203def[_0x7365('0x35')]['ids'])[_0x7365('0x24')](function(){if(_[_0x7365('0x78')](_0x203def[_0x7365('0x35')][_0x7365('0x5e')])){for(var _0x2cbfb8=0x0;_0x2cbfb8<_0x203def[_0x7365('0x35')][_0x7365('0x5e')]['length'];_0x2cbfb8+=0x1){socket[_0x7365('0x6f')]('userTeam:remove',{'UserId':Number(_0x203def[_0x7365('0x35')][_0x7365('0x5e')][_0x2cbfb8]),'TeamId':Number(_0x203def[_0x7365('0x46')]['id'])});}}else{socket['emit'](_0x7365('0x79'),{'UserId':Number(_0x203def[_0x7365('0x35')][_0x7365('0x5e')]),'TeamId':Number(_0x203def['params']['id'])});}});}})[_0x7365('0x24')](respondWithStatusCode(_0x330a22,null))[_0x7365('0x49')](handleError(_0x330a22,null));};exports[_0x7365('0x7a')]=function(_0xc3f601,_0xa0e27e,_0x55c6fe){var _0x37fc79={};var _0x3216fe={};var _0x14cf6d;var _0x1826d2;return db[_0x7365('0x30')][_0x7365('0x52')]({'where':{'id':_0xc3f601[_0x7365('0x46')]['id']}})[_0x7365('0x24')](handleEntityNotFound(_0xa0e27e,null))[_0x7365('0x24')](function(_0x4aee5d){if(_0x4aee5d){_0x14cf6d=_0x4aee5d;_0x3216fe[_0x7365('0x38')]=_[_0x7365('0x36')](db[_0x7365('0x69')][_0x7365('0x31')]);_0x3216fe[_0x7365('0x35')]=_['keys'](_0xc3f601[_0x7365('0x35')]);_0x3216fe[_0x7365('0x3f')]=_[_0x7365('0x37')](_0x3216fe['model'],_0x3216fe[_0x7365('0x35')]);_0x37fc79[_0x7365('0x39')]=_[_0x7365('0x37')](_0x3216fe['model'],qs[_0x7365('0x3a')](_0xc3f601[_0x7365('0x35')][_0x7365('0x3a')]));_0x37fc79[_0x7365('0x39')]=_0x37fc79[_0x7365('0x39')][_0x7365('0x3b')]?_0x37fc79[_0x7365('0x39')]:_0x3216fe[_0x7365('0x38')];_0x37fc79['order']=qs[_0x7365('0x7b')](_0xc3f601['query'][_0x7365('0x7b')]);_0x37fc79[_0x7365('0x3e')]=qs['filters'](_['pick'](_0xc3f601[_0x7365('0x35')],_0x3216fe['filters']));if(_0xc3f601[_0x7365('0x35')]['filter']){_0x37fc79[_0x7365('0x3e')]=_[_0x7365('0x42')](_0x37fc79[_0x7365('0x3e')],{'$or':_[_0x7365('0x2f')](_0x37fc79['attributes'],function(_0x2acab0){var _0x2751e3={};_0x2751e3[_0x2acab0]={'$like':'%'+_0xc3f601[_0x7365('0x35')][_0x7365('0x41')]+'%'};return _0x2751e3;})});}_0x37fc79=_[_0x7365('0x42')]({},_0x37fc79,_0xc3f601[_0x7365('0x7c')]);return _0x14cf6d[_0x7365('0x7a')](_0x37fc79);}})[_0x7365('0x24')](function(_0x4c1979){if(_0x4c1979){_0x1826d2=_0x4c1979[_0x7365('0x3b')];if(!_0xc3f601[_0x7365('0x35')][_0x7365('0x3c')](_0x7365('0x7d'))){_0x37fc79[_0x7365('0x1e')]=qs[_0x7365('0x1e')](_0xc3f601[_0x7365('0x35')][_0x7365('0x1e')]);_0x37fc79[_0x7365('0x1d')]=qs[_0x7365('0x1d')](_0xc3f601[_0x7365('0x35')]['offset']);}return _0x14cf6d['getAgents'](_0x37fc79);}})[_0x7365('0x24')](function(_0x17b1ec){if(_0x17b1ec){return _0x17b1ec?{'count':_0x1826d2,'rows':_0x17b1ec}:null;}})[_0x7365('0x24')](respondWithResult(_0xa0e27e,null))['catch'](handleError(_0xa0e27e,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 5b6a417..a5b4a71 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 _0xc2e8=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2fd56e,_0x168395){var _0x8562e8=function(_0x2aa0e8){while(--_0x2aa0e8){_0x2fd56e['push'](_0x2fd56e['shift']());}};_0x8562e8(++_0x168395);}(_0xc2e8,0xbe));var _0x8c2e=function(_0x11fc8d,_0x4ff7df){_0x11fc8d=_0x11fc8d-0x0;var _0x332ef3=_0xc2e8[_0x11fc8d];return _0x332ef3;};'use strict';var EventEmitter=require('events');var Team=require(_0x8c2e('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x8c2e('0x1')](0x0);var events={'afterCreate':_0x8c2e('0x2'),'afterUpdate':_0x8c2e('0x3'),'afterDestroy':_0x8c2e('0x4')};function emitEvent(_0x2c176c){return function(_0x4de53f,_0x24742f,_0x1c3675){TeamEvents[_0x8c2e('0x5')](_0x2c176c+':'+_0x4de53f['id'],_0x4de53f);TeamEvents[_0x8c2e('0x5')](_0x2c176c,_0x4de53f);_0x1c3675(null);};}for(var e in events){if(events[_0x8c2e('0x6')](e)){var event=events[e];Team[_0x8c2e('0x7')](e,emitEvent(event));}}module[_0x8c2e('0x8')]=TeamEvents; \ No newline at end of file +var _0x58cf=['setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0xb7524c,_0x38cced){var _0x4ce284=function(_0x47ff67){while(--_0x47ff67){_0xb7524c['push'](_0xb7524c['shift']());}};_0x4ce284(++_0x38cced);}(_0x58cf,0x196));var _0xf58c=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0x58cf[_0x4defd6];return _0x4c9276;};'use strict';var EventEmitter=require(_0xf58c('0x0'));var Team=require(_0xf58c('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xf58c('0x2')](0x0);var events={'afterCreate':_0xf58c('0x3'),'afterUpdate':_0xf58c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2e5b0f){return function(_0x59845d,_0x47f7b6,_0x453fab){TeamEvents[_0xf58c('0x5')](_0x2e5b0f+':'+_0x59845d['id'],_0x59845d);TeamEvents[_0xf58c('0x5')](_0x2e5b0f,_0x59845d);_0x453fab(null);};}for(var e in events){if(events[_0xf58c('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xf58c('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 456130b..f19b72e 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 _0xb52d=['Team','teams','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./team.attributes','exports','define'];(function(_0x5899f1,_0x4a9e9c){var _0x488171=function(_0x148d7f){while(--_0x148d7f){_0x5899f1['push'](_0x5899f1['shift']());}};_0x488171(++_0x4a9e9c);}(_0xb52d,0x9e));var _0xdb52=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb52d[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xdb52('0x0'));var logger=require(_0xdb52('0x1'))(_0xdb52('0x2'));var moment=require(_0xdb52('0x3'));var BPromise=require(_0xdb52('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb52('0x5'));var rimraf=require(_0xdb52('0x6'));var config=require(_0xdb52('0x7'));var attributes=require(_0xdb52('0x8'));module[_0xdb52('0x9')]=function(_0x17a0d8,_0x3c55b4){return _0x17a0d8[_0xdb52('0xa')](_0xdb52('0xb'),attributes,{'tableName':_0xdb52('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79ca=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Team','teams'];(function(_0x41849c,_0x6db388){var _0x43589c=function(_0x24ed08){while(--_0x24ed08){_0x41849c['push'](_0x41849c['shift']());}};_0x43589c(++_0x6db388);}(_0x79ca,0x114));var _0xa79c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x79ca[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa79c('0x0'));var util=require(_0xa79c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa79c('0x2'));var BPromise=require(_0xa79c('0x3'));var rp=require(_0xa79c('0x4'));var fs=require('fs');var path=require(_0xa79c('0x5'));var rimraf=require(_0xa79c('0x6'));var config=require(_0xa79c('0x7'));var attributes=require('./team.attributes');module[_0xa79c('0x8')]=function(_0x3e2daa,_0x4c6cae){return _0x3e2daa[_0xa79c('0x9')](_0xa79c('0xa'),attributes,{'tableName':_0xa79c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 7b371b2..5d35705 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 _0x298c=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./team.socket','register','request','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x267680,_0x361bb6){var _0x48c39b=function(_0x159350){while(--_0x159350){_0x267680['push'](_0x267680['shift']());}};_0x48c39b(++_0x361bb6);}(_0x298c,0x1e0));var _0xc298=function(_0x39a34b,_0x3f9ece){_0x39a34b=_0x39a34b-0x0;var _0x1d810f=_0x298c[_0x39a34b];return _0x1d810f;};'use strict';var _=require(_0xc298('0x0'));var util=require(_0xc298('0x1'));var moment=require(_0xc298('0x2'));var BPromise=require(_0xc298('0x3'));var rs=require(_0xc298('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc298('0x5'))['db'];var utils=require(_0xc298('0x6'));var logger=require(_0xc298('0x7'))('rpc');var config=require(_0xc298('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc298('0x9')]({'port':0x232a});config['redis']=_[_0xc298('0xa')](config[_0xc298('0xb')],{'host':_0xc298('0xc'),'port':0x18eb});var socket=require(_0xc298('0xd'))(new Redis(config['redis']));require(_0xc298('0xe'))[_0xc298('0xf')](socket);function respondWithRpcPromise(_0x35f4e6,_0x27117e,_0x453dae){return new BPromise(function(_0x5d2a2c,_0x57331e){return client[_0xc298('0x10')](_0x35f4e6,_0x453dae)['then'](function(_0x3c97a0){logger['info'](_0xc298('0x11'),_0x27117e,_0xc298('0x12'));logger[_0xc298('0x13')](_0xc298('0x14'),_0x27117e,_0xc298('0x12'),JSON['stringify'](_0x3c97a0));if(_0x3c97a0[_0xc298('0x15')]){if(_0x3c97a0['error']['code']===0x1f4){logger[_0xc298('0x15')](_0xc298('0x11'),_0x27117e,_0x3c97a0[_0xc298('0x15')]['message']);return _0x57331e(_0x3c97a0[_0xc298('0x15')][_0xc298('0x16')]);}logger[_0xc298('0x15')](_0xc298('0x11'),_0x27117e,_0x3c97a0[_0xc298('0x15')]['message']);return _0x5d2a2c(_0x3c97a0[_0xc298('0x15')]['message']);}else{logger[_0xc298('0x17')]('Team,\x20%s,\x20%s',_0x27117e,_0xc298('0x12'));_0x5d2a2c(_0x3c97a0['result'][_0xc298('0x16')]);}})['catch'](function(_0x71bd23){logger[_0xc298('0x15')](_0xc298('0x11'),_0x27117e,_0x71bd23);_0x57331e(_0x71bd23);});});} \ No newline at end of file +var _0x074d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','randomstring','ioredis'];(function(_0x47858c,_0x1c1880){var _0x2af9e=function(_0x430e38){while(--_0x430e38){_0x47858c['push'](_0x47858c['shift']());}};_0x2af9e(++_0x1c1880);}(_0x074d,0x1f3));var _0xd074=function(_0x8dc10f,_0x5627c0){_0x8dc10f=_0x8dc10f-0x0;var _0x57db45=_0x074d[_0x8dc10f];return _0x57db45;};'use strict';var _=require(_0xd074('0x0'));var util=require(_0xd074('0x1'));var moment=require(_0xd074('0x2'));var BPromise=require('bluebird');var rs=require(_0xd074('0x3'));var fs=require('fs');var Redis=require(_0xd074('0x4'));var db=require(_0xd074('0x5'))['db'];var utils=require(_0xd074('0x6'));var logger=require(_0xd074('0x7'))(_0xd074('0x8'));var config=require(_0xd074('0x9'));var jayson=require(_0xd074('0xa'));var client=jayson[_0xd074('0xb')][_0xd074('0xc')]({'port':0x232a});config[_0xd074('0xd')]=_[_0xd074('0xe')](config[_0xd074('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd074('0xf'))(new Redis(config[_0xd074('0xd')]));require(_0xd074('0x10'))[_0xd074('0x11')](socket);function respondWithRpcPromise(_0x504166,_0x365faf,_0x5f2888){return new BPromise(function(_0x3b9972,_0x262cef){return client[_0xd074('0x12')](_0x504166,_0x5f2888)[_0xd074('0x13')](function(_0x52c977){logger['info'](_0xd074('0x14'),_0x365faf,_0xd074('0x15'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x365faf,'request\x20sent',JSON[_0xd074('0x16')](_0x52c977));if(_0x52c977[_0xd074('0x17')]){if(_0x52c977[_0xd074('0x17')][_0xd074('0x18')]===0x1f4){logger[_0xd074('0x17')](_0xd074('0x14'),_0x365faf,_0x52c977['error'][_0xd074('0x19')]);return _0x262cef(_0x52c977[_0xd074('0x17')]['message']);}logger[_0xd074('0x17')]('Team,\x20%s,\x20%s',_0x365faf,_0x52c977[_0xd074('0x17')][_0xd074('0x19')]);return _0x3b9972(_0x52c977[_0xd074('0x17')][_0xd074('0x19')]);}else{logger[_0xd074('0x1a')](_0xd074('0x14'),_0x365faf,_0xd074('0x15'));_0x3b9972(_0x52c977[_0xd074('0x1b')]['message']);}})['catch'](function(_0x47d20){logger[_0xd074('0x17')](_0xd074('0x14'),_0x365faf,_0x47d20);_0x262cef(_0x47d20);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 326499b..ed4af28 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 _0x59ac=['removeListener','register','length','./team.events','save','remove','update','emit'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x59ac,0x73));var _0xc59a=function(_0x499ba1,_0x4d11a9){_0x499ba1=_0x499ba1-0x0;var _0xbf1cd7=_0x59ac[_0x499ba1];return _0xbf1cd7;};'use strict';var TeamEvents=require(_0xc59a('0x0'));var events=[_0xc59a('0x1'),_0xc59a('0x2'),_0xc59a('0x3')];function createListener(_0x385d68,_0x49cc75){return function(_0x43df94){_0x49cc75[_0xc59a('0x4')](_0x385d68,_0x43df94);};}function removeListener(_0x4dfceb,_0x3b7b43){return function(){TeamEvents[_0xc59a('0x5')](_0x4dfceb,_0x3b7b43);};}exports[_0xc59a('0x6')]=function(_0x25cd8e){for(var _0x204832=0x0,_0x5286c6=events[_0xc59a('0x7')];_0x204832<_0x5286c6;_0x204832++){var _0x576a51=events[_0x204832];var _0x12806d=createListener('team:'+_0x576a51,_0x25cd8e);TeamEvents['on'](_0x576a51,_0x12806d);}}; \ No newline at end of file +var _0x1488=['./team.events','remove','update','emit','removeListener','register','length','team:'];(function(_0xa3c800,_0x48a4fd){var _0x2286ba=function(_0x4a52f7){while(--_0x4a52f7){_0xa3c800['push'](_0xa3c800['shift']());}};_0x2286ba(++_0x48a4fd);}(_0x1488,0x88));var _0x8148=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x1488[_0x10df18];return _0x1f9a1d;};'use strict';var TeamEvents=require(_0x8148('0x0'));var events=['save',_0x8148('0x1'),_0x8148('0x2')];function createListener(_0x22606a,_0x5cc7ef){return function(_0x508e80){_0x5cc7ef[_0x8148('0x3')](_0x22606a,_0x508e80);};}function removeListener(_0x5b1a48,_0x32d78){return function(){TeamEvents[_0x8148('0x4')](_0x5b1a48,_0x32d78);};}exports[_0x8148('0x5')]=function(_0x153009){for(var _0x173d87=0x0,_0x2ac35d=events[_0x8148('0x6')];_0x173d87<_0x2ac35d;_0x173d87++){var _0x1254e9=events[_0x173d87];var _0x4fb6b4=createListener(_0x8148('0x7')+_0x1254e9,_0x153009);TeamEvents['on'](_0x1254e9,_0x4fb6b4);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 0ec1f94..fe1ab91 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 _0x9639=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','exports','multer','connect-timeout'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x9639,0x1da));var _0x9963=function(_0x5898c5,_0x55d1a9){_0x5898c5=_0x5898c5-0x0;var _0x551d7b=_0x9639[_0x5898c5];return _0x551d7b;};'use strict';var multer=require(_0x9963('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9963('0x1'));var express=require(_0x9963('0x2'));var router=express[_0x9963('0x3')]();var auth=require(_0x9963('0x4'));var interaction=require(_0x9963('0x5'));var config=require(_0x9963('0x6'));var controller=require(_0x9963('0x7'));router[_0x9963('0x8')]('/',auth[_0x9963('0x9')](),controller[_0x9963('0xa')]);router[_0x9963('0x8')](_0x9963('0xb'),auth[_0x9963('0x9')](),controller[_0x9963('0xc')]);router[_0x9963('0xd')]('/',auth[_0x9963('0x9')](),controller[_0x9963('0xe')]);router['put']('/:id',auth[_0x9963('0x9')](),controller['update']);router['delete'](_0x9963('0xb'),auth[_0x9963('0x9')](),controller[_0x9963('0xf')]);module[_0x9963('0x10')]=router; \ No newline at end of file +var _0x6383=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./template.controller','/:id','post','isAuthenticated','create','update','delete'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x6383,0x189));var _0x3638=function(_0x39f3a9,_0x4c0b34){_0x39f3a9=_0x39f3a9-0x0;var _0x36ac2b=_0x6383[_0x39f3a9];return _0x36ac2b;};'use strict';var multer=require(_0x3638('0x0'));var util=require(_0x3638('0x1'));var path=require(_0x3638('0x2'));var timeout=require(_0x3638('0x3'));var express=require(_0x3638('0x4'));var router=express[_0x3638('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3638('0x6'));var config=require(_0x3638('0x7'));var controller=require(_0x3638('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3638('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x3638('0xa')]('/',auth[_0x3638('0xb')](),controller[_0x3638('0xc')]);router['put'](_0x3638('0x9'),auth[_0x3638('0xb')](),controller[_0x3638('0xd')]);router[_0x3638('0xe')](_0x3638('0x9'),auth['isAuthenticated'](),controller[_0x3638('0xf')]);module[_0x3638('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index cfaa629..9001293 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 _0x4dd2=['STRING','exports'];(function(_0x4f61a1,_0x35820b){var _0xae8b64=function(_0x4f784c){while(--_0x4f784c){_0x4f61a1['push'](_0x4f61a1['shift']());}};_0xae8b64(++_0x35820b);}(_0x4dd2,0xf1));var _0x24dd=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0x4dd2[_0x597484];return _0x218e64;};'use strict';var Sequelize=require('sequelize');module[_0x24dd('0x0')]={'name':{'type':Sequelize[_0x24dd('0x1')]},'description':{'type':Sequelize[_0x24dd('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x0b53=['sequelize','exports','STRING','TEXT'];(function(_0x5af10f,_0x291592){var _0x112af5=function(_0x50487a){while(--_0x50487a){_0x5af10f['push'](_0x5af10f['shift']());}};_0x112af5(++_0x291592);}(_0x0b53,0x150));var _0x30b5=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0x0b53[_0x5c4f6b];return _0x104c4e;};'use strict';var Sequelize=require(_0x30b5('0x0'));module[_0x30b5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x30b5('0x2')]},'html':{'type':Sequelize[_0x30b5('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 0f52cf6..4e2b018 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 _0x63a5=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','get','Templates','UserProfileResource','end','sendStatus','error','stack','name','index','map','Template','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','desk.js'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x63a5,0x1d7));var _0x563a=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x63a5[_0x176329];return _0x31997c;};'use strict';var pdf=require(_0x563a('0x0'));var emlformat=require(_0x563a('0x1'));var rimraf=require(_0x563a('0x2'));var zipdir=require(_0x563a('0x3'));var jsonpatch=require(_0x563a('0x4'));var rp=require(_0x563a('0x5'));var moment=require(_0x563a('0x6'));var BPromise=require(_0x563a('0x7'));var Mustache=require(_0x563a('0x8'));var util=require(_0x563a('0x9'));var path=require(_0x563a('0xa'));var sox=require('sox');var csv=require(_0x563a('0xb'));var ejs=require(_0x563a('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x563a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x563a('0xe'));var toCsv=require(_0x563a('0xb'));var querystring=require(_0x563a('0xf'));var Papa=require(_0x563a('0x10'));var Redis=require(_0x563a('0x11'));var authService=require(_0x563a('0x12'));var qs=require(_0x563a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x563a('0x14'));var logger=require(_0x563a('0x15'))(_0x563a('0x16'));var utils=require(_0x563a('0x17'));var config=require(_0x563a('0x18'));var db=require(_0x563a('0x19'))['db'];function respondWithStatusCode(_0x38d7cb,_0xac9945){_0xac9945=_0xac9945||0xcc;return function(_0x18309f){if(_0x18309f){return _0x38d7cb['sendStatus'](_0xac9945);}return _0x38d7cb[_0x563a('0x1a')](_0xac9945)['end']();};}function respondWithResult(_0x1e9239,_0x1ece65){_0x1ece65=_0x1ece65||0xc8;return function(_0x54bbde){if(_0x54bbde){return _0x1e9239['status'](_0x1ece65)[_0x563a('0x1b')](_0x54bbde);}};}function respondWithFilteredResult(_0x54b77d,_0x59a862){return function(_0x5b2ff3){if(_0x5b2ff3){var _0x2b54e4=_0x5b2ff3[_0x563a('0x1c')],_0x3ed436=_0x59a862[_0x563a('0x1d')],_0x5ab01a=_0x59a862[_0x563a('0x1d')]+_0x59a862[_0x563a('0x1e')],_0x3a6a45;if(_0x5ab01a>=_0x2b54e4){_0x5ab01a=_0x2b54e4;_0x3a6a45=0xc8;}else{_0x3a6a45=0xce;}_0x54b77d[_0x563a('0x1a')](_0x3a6a45);return _0x54b77d[_0x563a('0x1f')](_0x563a('0x20'),_0x3ed436+'-'+_0x5ab01a+'/'+_0x2b54e4)[_0x563a('0x1b')](_0x5b2ff3);}return null;};}function patchUpdates(_0x195f5d){return function(_0x3dab49){try{jsonpatch[_0x563a('0x21')](_0x3dab49,_0x195f5d,!![]);}catch(_0x3d8e32){return BPromise[_0x563a('0x22')](_0x3d8e32);}return _0x3dab49['save']();};}function saveUpdates(_0x304883,_0x1021b3){return function(_0x46f4f0){if(_0x46f4f0){return _0x46f4f0[_0x563a('0x23')](_0x304883)['then'](function(_0x5132fd){return _0x5132fd;});}return null;};}function removeEntity(_0x4e7384,_0x2190d1){return function(_0x26ea16){if(_0x26ea16){return _0x26ea16[_0x563a('0x24')]()[_0x563a('0x25')](function(){var _0x4c32d9=_0x26ea16[_0x563a('0x26')]({'plain':!![]});var _0x3b2320=_0x563a('0x27');return db[_0x563a('0x28')]['destroy']({'where':{'type':_0x3b2320,'resourceId':_0x4c32d9['id']}})[_0x563a('0x25')](function(){return _0x26ea16;});})['then'](function(){_0x4e7384[_0x563a('0x1a')](0xcc)[_0x563a('0x29')]();});}};}function handleEntityNotFound(_0x3aa1d5,_0x20fb3a){return function(_0x5d8f8d){if(!_0x5d8f8d){_0x3aa1d5[_0x563a('0x2a')](0x194);}return _0x5d8f8d;};}function handleError(_0x1a6e01,_0x13c718){_0x13c718=_0x13c718||0x1f4;return function(_0x30a980){logger[_0x563a('0x2b')](_0x30a980[_0x563a('0x2c')]);if(_0x30a980[_0x563a('0x2d')]){delete _0x30a980[_0x563a('0x2d')];}_0x1a6e01[_0x563a('0x1a')](_0x13c718)['send'](_0x30a980);};}exports[_0x563a('0x2e')]=function(_0x484417,_0x2c96d9){var _0x54c1b7={},_0x3ee2e1={},_0x39bb6e={'count':0x0,'rows':[]};var _0x44198f=_[_0x563a('0x2f')](db[_0x563a('0x30')]['rawAttributes'],function(_0x154998){return{'name':_0x154998['fieldName'],'type':_0x154998[_0x563a('0x31')][_0x563a('0x32')]};});_0x3ee2e1[_0x563a('0x33')]=_[_0x563a('0x2f')](_0x44198f,_0x563a('0x2d'));_0x3ee2e1[_0x563a('0x34')]=_[_0x563a('0x35')](_0x484417[_0x563a('0x34')]);_0x3ee2e1[_0x563a('0x36')]=_[_0x563a('0x37')](_0x3ee2e1[_0x563a('0x33')],_0x3ee2e1[_0x563a('0x34')]);_0x54c1b7[_0x563a('0x38')]=_[_0x563a('0x37')](_0x3ee2e1[_0x563a('0x33')],qs[_0x563a('0x39')](_0x484417['query'][_0x563a('0x39')]));_0x54c1b7['attributes']=_0x54c1b7[_0x563a('0x38')][_0x563a('0x3a')]?_0x54c1b7[_0x563a('0x38')]:_0x3ee2e1['model'];if(!_0x484417['query']['hasOwnProperty'](_0x563a('0x3b'))){_0x54c1b7[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x484417[_0x563a('0x34')][_0x563a('0x1e')]);_0x54c1b7[_0x563a('0x1d')]=qs[_0x563a('0x1d')](_0x484417[_0x563a('0x34')][_0x563a('0x1d')]);}_0x54c1b7[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x484417[_0x563a('0x34')][_0x563a('0x3d')]);_0x54c1b7[_0x563a('0x3e')]=qs[_0x563a('0x36')](_['pick'](_0x484417[_0x563a('0x34')],_0x3ee2e1[_0x563a('0x36')]),_0x44198f);if(_0x484417['query'][_0x563a('0x3f')]){_0x54c1b7['where']=_[_0x563a('0x40')](_0x54c1b7[_0x563a('0x3e')],{'$or':_[_0x563a('0x2f')](_0x44198f,function(_0x4101f5){if(_0x4101f5[_0x563a('0x31')]!==_0x563a('0x41')){var _0x3e0b67={};_0x3e0b67[_0x4101f5[_0x563a('0x2d')]]={'$like':'%'+_0x484417[_0x563a('0x34')][_0x563a('0x3f')]+'%'};return _0x3e0b67;}})});}_0x54c1b7=_['merge']({},_0x54c1b7,_0x484417[_0x563a('0x42')]);var _0x2d6978={'where':_0x54c1b7['where']};return db[_0x563a('0x30')][_0x563a('0x1c')](_0x2d6978)[_0x563a('0x25')](function(_0x111e16){_0x39bb6e['count']=_0x111e16;if(_0x484417[_0x563a('0x34')][_0x563a('0x43')]){_0x54c1b7[_0x563a('0x44')]=[{'all':!![]}];}return db[_0x563a('0x30')]['findAll'](_0x54c1b7);})['then'](function(_0x3e1b60){_0x39bb6e[_0x563a('0x45')]=_0x3e1b60;return _0x39bb6e;})[_0x563a('0x25')](respondWithFilteredResult(_0x2c96d9,_0x54c1b7))[_0x563a('0x46')](handleError(_0x2c96d9,null));};exports[_0x563a('0x47')]=function(_0x5a1c8e,_0x33b430){var _0xbb9c7a={'raw':!![],'where':{'id':_0x5a1c8e['params']['id']}},_0x5a38a8={};_0x5a38a8[_0x563a('0x33')]=_[_0x563a('0x35')](db[_0x563a('0x30')][_0x563a('0x48')]);_0x5a38a8[_0x563a('0x34')]=_[_0x563a('0x35')](_0x5a1c8e['query']);_0x5a38a8[_0x563a('0x36')]=_[_0x563a('0x37')](_0x5a38a8[_0x563a('0x33')],_0x5a38a8[_0x563a('0x34')]);_0xbb9c7a[_0x563a('0x38')]=_[_0x563a('0x37')](_0x5a38a8[_0x563a('0x33')],qs[_0x563a('0x39')](_0x5a1c8e[_0x563a('0x34')][_0x563a('0x39')]));_0xbb9c7a[_0x563a('0x38')]=_0xbb9c7a[_0x563a('0x38')][_0x563a('0x3a')]?_0xbb9c7a[_0x563a('0x38')]:_0x5a38a8['model'];if(_0x5a1c8e['query'][_0x563a('0x43')]){_0xbb9c7a[_0x563a('0x44')]=[{'all':!![]}];}_0xbb9c7a=_[_0x563a('0x40')]({},_0xbb9c7a,_0x5a1c8e[_0x563a('0x42')]);return db[_0x563a('0x30')][_0x563a('0x49')](_0xbb9c7a)[_0x563a('0x25')](handleEntityNotFound(_0x33b430,null))[_0x563a('0x25')](respondWithResult(_0x33b430,null))['catch'](handleError(_0x33b430,null));};exports['create']=function(_0x5e3b79,_0xfba3a2){return db['Template'][_0x563a('0x4a')](_0x5e3b79[_0x563a('0x4b')],{})['then'](function(_0x5989a4){var _0x1a2e3e=_0x5e3b79[_0x563a('0x4c')][_0x563a('0x26')]({'plain':!![]});if(!_0x1a2e3e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a2e3e['role']===_0x563a('0x4c')){var _0x6bc690=_0x5989a4['get']({'plain':!![]});var _0x5d46e9=_0x563a('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x5d46e9,'userProfileId':_0x1a2e3e[_0x563a('0x4d')]},'raw':!![]})['then'](function(_0x4897d3){if(_0x4897d3&&_0x4897d3[_0x563a('0x4e')]===0x0){return db[_0x563a('0x28')]['create']({'name':_0x6bc690['name'],'resourceId':_0x6bc690['id'],'type':_0x4897d3[_0x563a('0x2d')],'sectionId':_0x4897d3['id']},{})[_0x563a('0x25')](function(){return _0x5989a4;});}else{return _0x5989a4;}})['catch'](function(_0x16d23d){logger['error'](_0x563a('0x4f'),_0x16d23d);throw _0x16d23d;});}return _0x5989a4;})[_0x563a('0x25')](respondWithResult(_0xfba3a2,0xc9))[_0x563a('0x46')](handleError(_0xfba3a2,null));};exports[_0x563a('0x23')]=function(_0x320a78,_0x3929a8){if(_0x320a78[_0x563a('0x4b')]['id']){delete _0x320a78[_0x563a('0x4b')]['id'];}return db[_0x563a('0x30')][_0x563a('0x49')]({'where':{'id':_0x320a78['params']['id']}})[_0x563a('0x25')](handleEntityNotFound(_0x3929a8,null))[_0x563a('0x25')](saveUpdates(_0x320a78[_0x563a('0x4b')],null))[_0x563a('0x25')](respondWithResult(_0x3929a8,null))[_0x563a('0x46')](handleError(_0x3929a8,null));};exports[_0x563a('0x24')]=function(_0x696888,_0x1396eb){return db[_0x563a('0x30')][_0x563a('0x49')]({'where':{'id':_0x696888[_0x563a('0x50')]['id']}})[_0x563a('0x25')](handleEntityNotFound(_0x1396eb,null))[_0x563a('0x25')](removeEntity(_0x1396eb,null))[_0x563a('0x46')](handleError(_0x1396eb,null));}; \ No newline at end of file +var _0x74b5=['limit','set','Content-Range','json','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','sendStatus','error','stack','name','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','sort','where','pick','filter','merge','VIRTUAL','options','Template','findAll','rows','catch','params','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','end','status','count','offset'];(function(_0x30e004,_0x46f8c2){var _0x5ca247=function(_0x20d80f){while(--_0x20d80f){_0x30e004['push'](_0x30e004['shift']());}};_0x5ca247(++_0x46f8c2);}(_0x74b5,0xcd));var _0x574b=function(_0x45b769,_0xcd107e){_0x45b769=_0x45b769-0x0;var _0x20022d=_0x74b5[_0x45b769];return _0x20022d;};'use strict';var pdf=require(_0x574b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x574b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x574b('0x2'));var moment=require(_0x574b('0x3'));var BPromise=require(_0x574b('0x4'));var Mustache=require(_0x574b('0x5'));var util=require('util');var path=require(_0x574b('0x6'));var sox=require(_0x574b('0x7'));var csv=require('to-csv');var ejs=require(_0x574b('0x8'));var fs=require('fs');var _=require(_0x574b('0x9'));var squel=require('squel');var crypto=require(_0x574b('0xa'));var jsforce=require(_0x574b('0xb'));var deskjs=require(_0x574b('0xc'));var toCsv=require(_0x574b('0xd'));var querystring=require('querystring');var Papa=require(_0x574b('0xe'));var Redis=require(_0x574b('0xf'));var authService=require(_0x574b('0x10'));var qs=require(_0x574b('0x11'));var as=require(_0x574b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x574b('0x13'));var utils=require('../../config/utils');var config=require(_0x574b('0x14'));var db=require(_0x574b('0x15'))['db'];function respondWithStatusCode(_0x37e155,_0x3849a1){_0x3849a1=_0x3849a1||0xcc;return function(_0x49aa59){if(_0x49aa59){return _0x37e155['sendStatus'](_0x3849a1);}return _0x37e155['status'](_0x3849a1)[_0x574b('0x16')]();};}function respondWithResult(_0x11eca9,_0x4dec0f){_0x4dec0f=_0x4dec0f||0xc8;return function(_0xaa3021){if(_0xaa3021){return _0x11eca9[_0x574b('0x17')](_0x4dec0f)['json'](_0xaa3021);}};}function respondWithFilteredResult(_0x19ea50,_0x5d460e){return function(_0x38d45e){if(_0x38d45e){var _0x28c05a=_0x38d45e[_0x574b('0x18')],_0xf0e46d=_0x5d460e['offset'],_0x540061=_0x5d460e[_0x574b('0x19')]+_0x5d460e[_0x574b('0x1a')],_0x5218fa;if(_0x540061>=_0x28c05a){_0x540061=_0x28c05a;_0x5218fa=0xc8;}else{_0x5218fa=0xce;}_0x19ea50[_0x574b('0x17')](_0x5218fa);return _0x19ea50[_0x574b('0x1b')](_0x574b('0x1c'),_0xf0e46d+'-'+_0x540061+'/'+_0x28c05a)[_0x574b('0x1d')](_0x38d45e);}return null;};}function patchUpdates(_0x24b190){return function(_0x37b4fd){try{jsonpatch[_0x574b('0x1e')](_0x37b4fd,_0x24b190,!![]);}catch(_0x23d704){return BPromise[_0x574b('0x1f')](_0x23d704);}return _0x37b4fd[_0x574b('0x20')]();};}function saveUpdates(_0x494b2b,_0x390c12){return function(_0x4d9941){if(_0x4d9941){return _0x4d9941[_0x574b('0x21')](_0x494b2b)['then'](function(_0x61cd47){return _0x61cd47;});}return null;};}function removeEntity(_0x353bc7,_0x53227c){return function(_0xc9c692){if(_0xc9c692){return _0xc9c692['destroy']()[_0x574b('0x22')](function(){var _0x382b81=_0xc9c692[_0x574b('0x23')]({'plain':!![]});var _0x47299e=_0x574b('0x24');return db[_0x574b('0x25')][_0x574b('0x26')]({'where':{'type':_0x47299e,'resourceId':_0x382b81['id']}})[_0x574b('0x22')](function(){return _0xc9c692;});})['then'](function(){_0x353bc7[_0x574b('0x17')](0xcc)[_0x574b('0x16')]();});}};}function handleEntityNotFound(_0x10ca76,_0x302c49){return function(_0x2cbf2e){if(!_0x2cbf2e){_0x10ca76[_0x574b('0x27')](0x194);}return _0x2cbf2e;};}function handleError(_0x3646a4,_0x552a21){_0x552a21=_0x552a21||0x1f4;return function(_0xa6f1d4){logger[_0x574b('0x28')](_0xa6f1d4[_0x574b('0x29')]);if(_0xa6f1d4[_0x574b('0x2a')]){delete _0xa6f1d4['name'];}_0x3646a4['status'](_0x552a21)['send'](_0xa6f1d4);};}exports['index']=function(_0x686118,_0x11c78d){var _0x37d6ef={},_0x3d99b7={},_0x5d02dd={'count':0x0,'rows':[]};var _0x56494e=_[_0x574b('0x2b')](db['Template']['rawAttributes'],function(_0x322512){return{'name':_0x322512[_0x574b('0x2c')],'type':_0x322512[_0x574b('0x2d')][_0x574b('0x2e')]};});_0x3d99b7[_0x574b('0x2f')]=_[_0x574b('0x2b')](_0x56494e,'name');_0x3d99b7[_0x574b('0x30')]=_[_0x574b('0x31')](_0x686118[_0x574b('0x30')]);_0x3d99b7[_0x574b('0x32')]=_[_0x574b('0x33')](_0x3d99b7['model'],_0x3d99b7['query']);_0x37d6ef[_0x574b('0x34')]=_[_0x574b('0x33')](_0x3d99b7[_0x574b('0x2f')],qs[_0x574b('0x35')](_0x686118[_0x574b('0x30')][_0x574b('0x35')]));_0x37d6ef['attributes']=_0x37d6ef[_0x574b('0x34')]['length']?_0x37d6ef['attributes']:_0x3d99b7[_0x574b('0x2f')];if(!_0x686118['query']['hasOwnProperty']('nolimit')){_0x37d6ef[_0x574b('0x1a')]=qs[_0x574b('0x1a')](_0x686118[_0x574b('0x30')][_0x574b('0x1a')]);_0x37d6ef[_0x574b('0x19')]=qs['offset'](_0x686118[_0x574b('0x30')][_0x574b('0x19')]);}_0x37d6ef['order']=qs[_0x574b('0x36')](_0x686118['query'][_0x574b('0x36')]);_0x37d6ef[_0x574b('0x37')]=qs['filters'](_[_0x574b('0x38')](_0x686118['query'],_0x3d99b7[_0x574b('0x32')]),_0x56494e);if(_0x686118['query'][_0x574b('0x39')]){_0x37d6ef['where']=_[_0x574b('0x3a')](_0x37d6ef[_0x574b('0x37')],{'$or':_[_0x574b('0x2b')](_0x56494e,function(_0x3835f4){if(_0x3835f4[_0x574b('0x2d')]!==_0x574b('0x3b')){var _0x5d49b0={};_0x5d49b0[_0x3835f4[_0x574b('0x2a')]]={'$like':'%'+_0x686118[_0x574b('0x30')][_0x574b('0x39')]+'%'};return _0x5d49b0;}})});}_0x37d6ef=_[_0x574b('0x3a')]({},_0x37d6ef,_0x686118[_0x574b('0x3c')]);var _0x2ae2c1={'where':_0x37d6ef['where']};return db[_0x574b('0x3d')][_0x574b('0x18')](_0x2ae2c1)[_0x574b('0x22')](function(_0x195b22){_0x5d02dd[_0x574b('0x18')]=_0x195b22;if(_0x686118[_0x574b('0x30')]['includeAll']){_0x37d6ef['include']=[{'all':!![]}];}return db[_0x574b('0x3d')][_0x574b('0x3e')](_0x37d6ef);})[_0x574b('0x22')](function(_0x95bd2b){_0x5d02dd[_0x574b('0x3f')]=_0x95bd2b;return _0x5d02dd;})[_0x574b('0x22')](respondWithFilteredResult(_0x11c78d,_0x37d6ef))[_0x574b('0x40')](handleError(_0x11c78d,null));};exports['show']=function(_0x35b170,_0x35f81a){var _0x21a523={'raw':!![],'where':{'id':_0x35b170[_0x574b('0x41')]['id']}},_0x7e8bd3={};_0x7e8bd3[_0x574b('0x2f')]=_[_0x574b('0x31')](db[_0x574b('0x3d')][_0x574b('0x42')]);_0x7e8bd3[_0x574b('0x30')]=_['keys'](_0x35b170['query']);_0x7e8bd3[_0x574b('0x32')]=_[_0x574b('0x33')](_0x7e8bd3[_0x574b('0x2f')],_0x7e8bd3['query']);_0x21a523[_0x574b('0x34')]=_[_0x574b('0x33')](_0x7e8bd3['model'],qs[_0x574b('0x35')](_0x35b170[_0x574b('0x30')][_0x574b('0x35')]));_0x21a523[_0x574b('0x34')]=_0x21a523[_0x574b('0x34')]['length']?_0x21a523['attributes']:_0x7e8bd3[_0x574b('0x2f')];if(_0x35b170[_0x574b('0x30')]['includeAll']){_0x21a523[_0x574b('0x43')]=[{'all':!![]}];}_0x21a523=_['merge']({},_0x21a523,_0x35b170['options']);return db[_0x574b('0x3d')][_0x574b('0x44')](_0x21a523)[_0x574b('0x22')](handleEntityNotFound(_0x35f81a,null))[_0x574b('0x22')](respondWithResult(_0x35f81a,null))[_0x574b('0x40')](handleError(_0x35f81a,null));};exports['create']=function(_0x495e36,_0x49633c){return db[_0x574b('0x3d')][_0x574b('0x45')](_0x495e36[_0x574b('0x46')],{})[_0x574b('0x22')](function(_0x462f12){var _0xcdf74c=_0x495e36['user'][_0x574b('0x23')]({'plain':!![]});if(!_0xcdf74c)throw new Error(_0x574b('0x47'));if(_0xcdf74c[_0x574b('0x48')]==='user'){var _0x1ccf0b=_0x462f12[_0x574b('0x23')]({'plain':!![]});var _0x400d00=_0x574b('0x24');return db[_0x574b('0x49')][_0x574b('0x44')]({'where':{'name':_0x400d00,'userProfileId':_0xcdf74c[_0x574b('0x4a')]},'raw':!![]})['then'](function(_0x2bddd1){if(_0x2bddd1&&_0x2bddd1[_0x574b('0x4b')]===0x0){return db[_0x574b('0x25')][_0x574b('0x45')]({'name':_0x1ccf0b[_0x574b('0x2a')],'resourceId':_0x1ccf0b['id'],'type':_0x2bddd1[_0x574b('0x2a')],'sectionId':_0x2bddd1['id']},{})[_0x574b('0x22')](function(){return _0x462f12;});}else{return _0x462f12;}})['catch'](function(_0x391be4){logger[_0x574b('0x28')](_0x574b('0x4c'),_0x391be4);throw _0x391be4;});}return _0x462f12;})[_0x574b('0x22')](respondWithResult(_0x49633c,0xc9))[_0x574b('0x40')](handleError(_0x49633c,null));};exports['update']=function(_0x512e45,_0x1aa261){if(_0x512e45[_0x574b('0x46')]['id']){delete _0x512e45['body']['id'];}return db[_0x574b('0x3d')][_0x574b('0x44')]({'where':{'id':_0x512e45[_0x574b('0x41')]['id']}})['then'](handleEntityNotFound(_0x1aa261,null))[_0x574b('0x22')](saveUpdates(_0x512e45[_0x574b('0x46')],null))[_0x574b('0x22')](respondWithResult(_0x1aa261,null))[_0x574b('0x40')](handleError(_0x1aa261,null));};exports[_0x574b('0x26')]=function(_0xdd7b89,_0x20c30e){return db[_0x574b('0x3d')][_0x574b('0x44')]({'where':{'id':_0xdd7b89[_0x574b('0x41')]['id']}})['then'](handleEntityNotFound(_0x20c30e,null))[_0x574b('0x22')](removeEntity(_0x20c30e,null))[_0x574b('0x40')](handleError(_0x20c30e,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 659273c..13e8ba9 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 _0x7abe=['exports','define','Template','tools_templates','lodash','util','../../config/logger','bluebird','request-promise','path','./template.attributes'];(function(_0x3e543d,_0x4f3548){var _0x51285c=function(_0x4fa37d){while(--_0x4fa37d){_0x3e543d['push'](_0x3e543d['shift']());}};_0x51285c(++_0x4f3548);}(_0x7abe,0x117));var _0xe7ab=function(_0xecc781,_0x272faa){_0xecc781=_0xecc781-0x0;var _0x5344d6=_0x7abe[_0xecc781];return _0x5344d6;};'use strict';var _=require(_0xe7ab('0x0'));var util=require(_0xe7ab('0x1'));var logger=require(_0xe7ab('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe7ab('0x3'));var rp=require(_0xe7ab('0x4'));var fs=require('fs');var path=require(_0xe7ab('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe7ab('0x6'));module[_0xe7ab('0x7')]=function(_0x264fa1,_0x132497){return _0x264fa1[_0xe7ab('0x8')](_0xe7ab('0x9'),attributes,{'tableName':_0xe7ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e59=['Template','tools_templates','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./template.attributes','exports','define'];(function(_0x1f71fb,_0x4cdd2d){var _0x4f0dc1=function(_0x186890){while(--_0x186890){_0x1f71fb['push'](_0x1f71fb['shift']());}};_0x4f0dc1(++_0x4cdd2d);}(_0x3e59,0xb6));var _0x93e5=function(_0x4207a6,_0x3a3110){_0x4207a6=_0x4207a6-0x0;var _0x42b37a=_0x3e59[_0x4207a6];return _0x42b37a;};'use strict';var _=require(_0x93e5('0x0'));var util=require('util');var logger=require(_0x93e5('0x1'))(_0x93e5('0x2'));var moment=require('moment');var BPromise=require(_0x93e5('0x3'));var rp=require(_0x93e5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x93e5('0x5'));var config=require(_0x93e5('0x6'));var attributes=require(_0x93e5('0x7'));module[_0x93e5('0x8')]=function(_0x45a3e5,_0xa83fb3){return _0x45a3e5[_0x93e5('0x9')](_0x93e5('0xa'),attributes,{'tableName':_0x93e5('0xb'),'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 c9afdcb..63ee249 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 _0xf040=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetTemplate','findAll','options','raw','where','attributes','limit','include','model','map','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x381188,_0x123b84){var _0x53598d=function(_0x59f3c6){while(--_0x59f3c6){_0x381188['push'](_0x381188['shift']());}};_0x53598d(++_0x123b84);}(_0xf040,0x193));var _0x0f04=function(_0x498219,_0x28eb06){_0x498219=_0x498219-0x0;var _0x1e04c6=_0xf040[_0x498219];return _0x1e04c6;};'use strict';var _=require(_0x0f04('0x0'));var util=require(_0x0f04('0x1'));var moment=require(_0x0f04('0x2'));var BPromise=require(_0x0f04('0x3'));var rs=require(_0x0f04('0x4'));var fs=require('fs');var Redis=require(_0x0f04('0x5'));var db=require(_0x0f04('0x6'))['db'];var utils=require(_0x0f04('0x7'));var logger=require(_0x0f04('0x8'))('rpc');var config=require(_0x0f04('0x9'));var jayson=require(_0x0f04('0xa'));var client=jayson[_0x0f04('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x502142,_0x41adda,_0x2754cf){return new BPromise(function(_0x376ec5,_0x500eb4){return client[_0x0f04('0xc')](_0x502142,_0x2754cf)[_0x0f04('0xd')](function(_0x2c7e97){logger['info'](_0x0f04('0xe'),_0x41adda,_0x0f04('0xf'));logger[_0x0f04('0x10')](_0x0f04('0x11'),_0x41adda,_0x0f04('0xf'),JSON['stringify'](_0x2c7e97));if(_0x2c7e97[_0x0f04('0x12')]){if(_0x2c7e97[_0x0f04('0x12')][_0x0f04('0x13')]===0x1f4){logger[_0x0f04('0x12')](_0x0f04('0xe'),_0x41adda,_0x2c7e97[_0x0f04('0x12')][_0x0f04('0x14')]);return _0x500eb4(_0x2c7e97['error']['message']);}logger[_0x0f04('0x12')](_0x0f04('0xe'),_0x41adda,_0x2c7e97['error'][_0x0f04('0x14')]);return _0x376ec5(_0x2c7e97[_0x0f04('0x12')]['message']);}else{logger[_0x0f04('0x15')](_0x0f04('0xe'),_0x41adda,'request\x20sent');_0x376ec5(_0x2c7e97[_0x0f04('0x16')][_0x0f04('0x14')]);}})['catch'](function(_0x43540e){logger[_0x0f04('0x12')]('Template,\x20%s,\x20%s',_0x41adda,_0x43540e);_0x500eb4(_0x43540e);});});}exports[_0x0f04('0x17')]=function(_0x19bd6d){var _0x1e59b1=this;return new Promise(function(_0x27f0c,_0x34e57a){return db['Template'][_0x0f04('0x18')]({'raw':_0x19bd6d[_0x0f04('0x19')]?_0x19bd6d[_0x0f04('0x19')][_0x0f04('0x1a')]===undefined?!![]:![]:!![],'where':_0x19bd6d['options']?_0x19bd6d[_0x0f04('0x19')][_0x0f04('0x1b')]||null:null,'attributes':_0x19bd6d['options']?_0x19bd6d[_0x0f04('0x19')][_0x0f04('0x1c')]||null:null,'limit':_0x19bd6d[_0x0f04('0x19')]?_0x19bd6d['options'][_0x0f04('0x1d')]||null:null,'include':_0x19bd6d[_0x0f04('0x19')]?_0x19bd6d[_0x0f04('0x19')][_0x0f04('0x1e')]?_['map'](_0x19bd6d[_0x0f04('0x19')][_0x0f04('0x1e')],function(_0x389d07){return{'model':db[_0x389d07[_0x0f04('0x1f')]],'as':_0x389d07['as'],'attributes':_0x389d07[_0x0f04('0x1c')],'include':_0x389d07[_0x0f04('0x1e')]?_[_0x0f04('0x20')](_0x389d07['include'],function(_0x17c7fe){return{'model':db[_0x17c7fe[_0x0f04('0x1f')]],'as':_0x17c7fe['as'],'attributes':_0x17c7fe[_0x0f04('0x1c')],'include':_0x17c7fe[_0x0f04('0x1e')]?_['map'](_0x17c7fe[_0x0f04('0x1e')],function(_0x34f06b){return{'model':db[_0x34f06b[_0x0f04('0x1f')]],'as':_0x34f06b['as'],'attributes':_0x34f06b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x50c030){logger['info'](_0x0f04('0x17'),_0x19bd6d);logger[_0x0f04('0x10')](_0x0f04('0x17'),_0x19bd6d,JSON['stringify'](_0x50c030));_0x27f0c(_0x50c030);})[_0x0f04('0x21')](function(_0x58e4a2){logger['error'](_0x0f04('0x17'),_0x58e4a2[_0x0f04('0x14')],_0x19bd6d);_0x34e57a(_0x1e59b1['error'](0x1f4,_0x58e4a2[_0x0f04('0x14')]));});});}; \ No newline at end of file +var _0x9074=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Template,\x20%s,\x20%s','message','info','GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','catch','lodash','util','bluebird'];(function(_0x23b15e,_0x14baa2){var _0x3af46e=function(_0xef8605){while(--_0xef8605){_0x23b15e['push'](_0x23b15e['shift']());}};_0x3af46e(++_0x14baa2);}(_0x9074,0x1dd));var _0x4907=function(_0x3b8577,_0x3ac411){_0x3b8577=_0x3b8577-0x0;var _0x42688c=_0x9074[_0x3b8577];return _0x42688c;};'use strict';var _=require(_0x4907('0x0'));var util=require(_0x4907('0x1'));var moment=require('moment');var BPromise=require(_0x4907('0x2'));var rs=require(_0x4907('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4907('0x4'))['db'];var utils=require(_0x4907('0x5'));var logger=require(_0x4907('0x6'))(_0x4907('0x7'));var config=require(_0x4907('0x8'));var jayson=require(_0x4907('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e37ad,_0x576aea,_0x39c59a){return new BPromise(function(_0x339d1,_0xb9dd9f){return client[_0x4907('0xa')](_0x2e37ad,_0x39c59a)['then'](function(_0x16c8b6){logger['info']('Template,\x20%s,\x20%s',_0x576aea,'request\x20sent');logger[_0x4907('0xb')](_0x4907('0xc'),_0x576aea,_0x4907('0xd'),JSON[_0x4907('0xe')](_0x16c8b6));if(_0x16c8b6[_0x4907('0xf')]){if(_0x16c8b6[_0x4907('0xf')]['code']===0x1f4){logger[_0x4907('0xf')](_0x4907('0x10'),_0x576aea,_0x16c8b6['error'][_0x4907('0x11')]);return _0xb9dd9f(_0x16c8b6[_0x4907('0xf')][_0x4907('0x11')]);}logger[_0x4907('0xf')](_0x4907('0x10'),_0x576aea,_0x16c8b6[_0x4907('0xf')][_0x4907('0x11')]);return _0x339d1(_0x16c8b6[_0x4907('0xf')]['message']);}else{logger[_0x4907('0x12')](_0x4907('0x10'),_0x576aea,_0x4907('0xd'));_0x339d1(_0x16c8b6['result'][_0x4907('0x11')]);}})['catch'](function(_0x317a6a){logger['error'](_0x4907('0x10'),_0x576aea,_0x317a6a);_0xb9dd9f(_0x317a6a);});});}exports[_0x4907('0x13')]=function(_0x3ff307){var _0x5ef4fd=this;return new Promise(function(_0xf575dd,_0x5336ba){return db[_0x4907('0x14')]['findAll']({'raw':_0x3ff307[_0x4907('0x15')]?_0x3ff307['options'][_0x4907('0x16')]===undefined?!![]:![]:!![],'where':_0x3ff307[_0x4907('0x15')]?_0x3ff307[_0x4907('0x15')][_0x4907('0x17')]||null:null,'attributes':_0x3ff307[_0x4907('0x15')]?_0x3ff307['options'][_0x4907('0x18')]||null:null,'limit':_0x3ff307[_0x4907('0x15')]?_0x3ff307[_0x4907('0x15')][_0x4907('0x19')]||null:null,'include':_0x3ff307[_0x4907('0x15')]?_0x3ff307['options'][_0x4907('0x1a')]?_[_0x4907('0x1b')](_0x3ff307[_0x4907('0x15')][_0x4907('0x1a')],function(_0x6b0dfe){return{'model':db[_0x6b0dfe[_0x4907('0x1c')]],'as':_0x6b0dfe['as'],'attributes':_0x6b0dfe['attributes'],'include':_0x6b0dfe[_0x4907('0x1a')]?_[_0x4907('0x1b')](_0x6b0dfe[_0x4907('0x1a')],function(_0x2515bd){return{'model':db[_0x2515bd[_0x4907('0x1c')]],'as':_0x2515bd['as'],'attributes':_0x2515bd[_0x4907('0x18')],'include':_0x2515bd[_0x4907('0x1a')]?_['map'](_0x2515bd[_0x4907('0x1a')],function(_0x1b06f5){return{'model':db[_0x1b06f5[_0x4907('0x1c')]],'as':_0x1b06f5['as'],'attributes':_0x1b06f5[_0x4907('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d7685){logger['info'](_0x4907('0x13'),_0x3ff307);logger[_0x4907('0xb')]('GetTemplate',_0x3ff307,JSON[_0x4907('0xe')](_0x3d7685));_0xf575dd(_0x3d7685);})[_0x4907('0x1d')](function(_0x4bd1cc){logger['error']('GetTemplate',_0x4bd1cc['message'],_0x3ff307);_0x5336ba(_0x5ef4fd['error'](0x1f4,_0x4bd1cc[_0x4907('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 057fb2a..3e78be0 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 _0xad2a=['update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','create','post','addAllCondition','put'];(function(_0x1a170a,_0xcc9fca){var _0x413c33=function(_0xbb6447){while(--_0xbb6447){_0x1a170a['push'](_0x1a170a['shift']());}};_0x413c33(++_0xcc9fca);}(_0xad2a,0x149));var _0xaad2=function(_0xb7a89,_0x516a86){_0xb7a89=_0xb7a89-0x0;var _0x2bafc9=_0xad2a[_0xb7a89];return _0x2bafc9;};'use strict';var multer=require('multer');var util=require(_0xaad2('0x0'));var path=require(_0xaad2('0x1'));var timeout=require(_0xaad2('0x2'));var express=require(_0xaad2('0x3'));var router=express['Router']();var auth=require(_0xaad2('0x4'));var interaction=require(_0xaad2('0x5'));var config=require(_0xaad2('0x6'));var controller=require(_0xaad2('0x7'));router[_0xaad2('0x8')]('/',auth['isAuthenticated'](),controller[_0xaad2('0x9')]);router['get'](_0xaad2('0xa'),auth[_0xaad2('0xb')](),controller[_0xaad2('0xc')]);router[_0xaad2('0x8')]('/:id/all_conditions',auth[_0xaad2('0xb')](),controller[_0xaad2('0xd')]);router[_0xaad2('0x8')](_0xaad2('0xe'),auth[_0xaad2('0xb')](),controller[_0xaad2('0xf')]);router[_0xaad2('0x8')](_0xaad2('0x10'),auth[_0xaad2('0xb')](),controller['getActions']);router['post']('/',auth[_0xaad2('0xb')](),controller[_0xaad2('0x11')]);router[_0xaad2('0x12')]('/:id/all_conditions',auth[_0xaad2('0xb')](),controller[_0xaad2('0x13')]);router[_0xaad2('0x12')](_0xaad2('0xe'),auth[_0xaad2('0xb')](),controller['addAnyCondition']);router[_0xaad2('0x12')](_0xaad2('0x10'),auth[_0xaad2('0xb')](),controller['addAction']);router[_0xaad2('0x14')](_0xaad2('0xa'),auth[_0xaad2('0xb')](),controller[_0xaad2('0x15')]);router[_0xaad2('0x16')](_0xaad2('0xa'),auth[_0xaad2('0xb')](),controller[_0xaad2('0x17')]);module[_0xaad2('0x18')]=router; \ No newline at end of file +var _0xad2f=['create','addAnyCondition','put','/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post'];(function(_0x1b0cb0,_0x53a76b){var _0x813dc0=function(_0xce7788){while(--_0xce7788){_0x1b0cb0['push'](_0x1b0cb0['shift']());}};_0x813dc0(++_0x53a76b);}(_0xad2f,0x1e3));var _0xfad2=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xad2f[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0xfad2('0x0'));var util=require('util');var path=require(_0xfad2('0x1'));var timeout=require('connect-timeout');var express=require(_0xfad2('0x2'));var router=express[_0xfad2('0x3')]();var auth=require(_0xfad2('0x4'));var interaction=require(_0xfad2('0x5'));var config=require(_0xfad2('0x6'));var controller=require('./trigger.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xfad2('0x7')]);router[_0xfad2('0x8')]('/:id',auth[_0xfad2('0x9')](),controller['show']);router[_0xfad2('0x8')](_0xfad2('0xa'),auth[_0xfad2('0x9')](),controller[_0xfad2('0xb')]);router['get'](_0xfad2('0xc'),auth[_0xfad2('0x9')](),controller[_0xfad2('0xd')]);router['get'](_0xfad2('0xe'),auth[_0xfad2('0x9')](),controller[_0xfad2('0xf')]);router[_0xfad2('0x10')]('/',auth[_0xfad2('0x9')](),controller[_0xfad2('0x11')]);router[_0xfad2('0x10')](_0xfad2('0xa'),auth[_0xfad2('0x9')](),controller['addAllCondition']);router[_0xfad2('0x10')]('/:id/any_conditions',auth[_0xfad2('0x9')](),controller[_0xfad2('0x12')]);router[_0xfad2('0x10')](_0xfad2('0xe'),auth[_0xfad2('0x9')](),controller['addAction']);router[_0xfad2('0x13')](_0xfad2('0x14'),auth[_0xfad2('0x9')](),controller[_0xfad2('0x15')]);router[_0xfad2('0x16')](_0xfad2('0x14'),auth['isAuthenticated'](),controller[_0xfad2('0x17')]);module[_0xfad2('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 050ae5c..958f4e3 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 _0x7800=['sequelize','STRING'];(function(_0x248e8c,_0x51b0a4){var _0x594df5=function(_0x591cdd){while(--_0x591cdd){_0x248e8c['push'](_0x248e8c['shift']());}};_0x594df5(++_0x51b0a4);}(_0x7800,0x80));var _0x0780=function(_0x3b24f6,_0x46bce7){_0x3b24f6=_0x3b24f6-0x0;var _0x555a71=_0x7800[_0x3b24f6];return _0x555a71;};'use strict';var Sequelize=require(_0x0780('0x0'));module['exports']={'name':{'type':Sequelize[_0x0780('0x1')]},'channel':{'type':Sequelize[_0x0780('0x1')]},'description':{'type':Sequelize[_0x0780('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x60f8=['BOOLEAN','sequelize','exports','STRING'];(function(_0x1d7122,_0x50ed55){var _0x324150=function(_0x2a27ac){while(--_0x2a27ac){_0x1d7122['push'](_0x1d7122['shift']());}};_0x324150(++_0x50ed55);}(_0x60f8,0x169));var _0x860f=function(_0xda582b,_0x27008d){_0xda582b=_0xda582b-0x0;var _0x57abfb=_0x60f8[_0xda582b];return _0x57abfb;};'use strict';var Sequelize=require(_0x860f('0x0'));module[_0x860f('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x860f('0x2')]},'description':{'type':Sequelize[_0x860f('0x2')]},'status':{'type':Sequelize[_0x860f('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index f649810..8d36628 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 _0xb8e4=['role','Triggers','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','addAnyCondition','TriggerAnyId','Condition','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','Action','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','map','Trigger','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','filter','includeAll','include','rows','catch','show','rawAttributes','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x29a54d,_0x439404){var _0x34232d=function(_0x1461fd){while(--_0x1461fd){_0x29a54d['push'](_0x29a54d['shift']());}};_0x34232d(++_0x439404);}(_0xb8e4,0xd0));var _0x4b8e=function(_0x390b17,_0x407fea){_0x390b17=_0x390b17-0x0;var _0x599e86=_0xb8e4[_0x390b17];return _0x599e86;};'use strict';var pdf=require(_0x4b8e('0x0'));var emlformat=require(_0x4b8e('0x1'));var rimraf=require(_0x4b8e('0x2'));var zipdir=require(_0x4b8e('0x3'));var jsonpatch=require(_0x4b8e('0x4'));var rp=require(_0x4b8e('0x5'));var moment=require(_0x4b8e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4b8e('0x7'));var util=require(_0x4b8e('0x8'));var path=require(_0x4b8e('0x9'));var sox=require(_0x4b8e('0xa'));var csv=require(_0x4b8e('0xb'));var ejs=require(_0x4b8e('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4b8e('0xd'));var crypto=require(_0x4b8e('0xe'));var jsforce=require(_0x4b8e('0xf'));var deskjs=require(_0x4b8e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4b8e('0x11'));var Papa=require(_0x4b8e('0x12'));var Redis=require(_0x4b8e('0x13'));var authService=require(_0x4b8e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4b8e('0x15'));var hardwareService=require(_0x4b8e('0x16'));var logger=require(_0x4b8e('0x17'))(_0x4b8e('0x18'));var utils=require(_0x4b8e('0x19'));var config=require('../../config/environment');var db=require(_0x4b8e('0x1a'))['db'];function respondWithStatusCode(_0x358f4e,_0x4af622){_0x4af622=_0x4af622||0xcc;return function(_0x1970e2){if(_0x1970e2){return _0x358f4e[_0x4b8e('0x1b')](_0x4af622);}return _0x358f4e[_0x4b8e('0x1c')](_0x4af622)['end']();};}function respondWithResult(_0x36f542,_0x1846b2){_0x1846b2=_0x1846b2||0xc8;return function(_0xf6d2a7){if(_0xf6d2a7){return _0x36f542['status'](_0x1846b2)[_0x4b8e('0x1d')](_0xf6d2a7);}};}function respondWithFilteredResult(_0xc6c446,_0x293971){return function(_0x2a16bd){if(_0x2a16bd){var _0x4dc910=_0x2a16bd[_0x4b8e('0x1e')],_0x95a50d=_0x293971[_0x4b8e('0x1f')],_0x3f39c1=_0x293971[_0x4b8e('0x1f')]+_0x293971['limit'],_0x4210ef;if(_0x3f39c1>=_0x4dc910){_0x3f39c1=_0x4dc910;_0x4210ef=0xc8;}else{_0x4210ef=0xce;}_0xc6c446[_0x4b8e('0x1c')](_0x4210ef);return _0xc6c446[_0x4b8e('0x20')](_0x4b8e('0x21'),_0x95a50d+'-'+_0x3f39c1+'/'+_0x4dc910)['json'](_0x2a16bd);}return null;};}function patchUpdates(_0x38165d){return function(_0x1ea7ff){try{jsonpatch[_0x4b8e('0x22')](_0x1ea7ff,_0x38165d,!![]);}catch(_0x367da5){return BPromise[_0x4b8e('0x23')](_0x367da5);}return _0x1ea7ff['save']();};}function saveUpdates(_0x2e9298,_0x38c3d4){return function(_0x1bf7e5){if(_0x1bf7e5){return _0x1bf7e5[_0x4b8e('0x24')](_0x2e9298)[_0x4b8e('0x25')](function(_0x2f4e77){return _0x2f4e77;});}return null;};}function removeEntity(_0x1c55e9,_0x2682d8){return function(_0xf5cd0){if(_0xf5cd0){return _0xf5cd0[_0x4b8e('0x26')]()[_0x4b8e('0x25')](function(){var _0xea5c01=_0xf5cd0[_0x4b8e('0x27')]({'plain':!![]});var _0xb53295='Triggers';return db[_0x4b8e('0x28')]['destroy']({'where':{'type':_0xb53295,'resourceId':_0xea5c01['id']}})[_0x4b8e('0x25')](function(){return _0xf5cd0;});})[_0x4b8e('0x25')](function(){_0x1c55e9[_0x4b8e('0x1c')](0xcc)[_0x4b8e('0x29')]();});}};}function handleEntityNotFound(_0x13fcec,_0x15f31b){return function(_0x2f5779){if(!_0x2f5779){_0x13fcec[_0x4b8e('0x1b')](0x194);}return _0x2f5779;};}function handleError(_0x51aa76,_0x2bc09d){_0x2bc09d=_0x2bc09d||0x1f4;return function(_0x50efd5){logger['error'](_0x50efd5[_0x4b8e('0x2a')]);if(_0x50efd5[_0x4b8e('0x2b')]){delete _0x50efd5['name'];}_0x51aa76['status'](_0x2bc09d)[_0x4b8e('0x2c')](_0x50efd5);};}exports[_0x4b8e('0x2d')]=function(_0x2a3775,_0x4f8aa0){var _0x97172={},_0x12e216={},_0x412a90={'count':0x0,'rows':[]};var _0x36de4c=_[_0x4b8e('0x2e')](db[_0x4b8e('0x2f')]['rawAttributes'],function(_0x439b9f){return{'name':_0x439b9f['fieldName'],'type':_0x439b9f['type']['key']};});_0x12e216[_0x4b8e('0x30')]=_['map'](_0x36de4c,_0x4b8e('0x2b'));_0x12e216['query']=_[_0x4b8e('0x31')](_0x2a3775[_0x4b8e('0x32')]);_0x12e216[_0x4b8e('0x33')]=_[_0x4b8e('0x34')](_0x12e216['model'],_0x12e216[_0x4b8e('0x32')]);_0x97172[_0x4b8e('0x35')]=_[_0x4b8e('0x34')](_0x12e216[_0x4b8e('0x30')],qs[_0x4b8e('0x36')](_0x2a3775[_0x4b8e('0x32')]['fields']));_0x97172['attributes']=_0x97172[_0x4b8e('0x35')]['length']?_0x97172['attributes']:_0x12e216[_0x4b8e('0x30')];if(!_0x2a3775[_0x4b8e('0x32')][_0x4b8e('0x37')](_0x4b8e('0x38'))){_0x97172['limit']=qs[_0x4b8e('0x39')](_0x2a3775[_0x4b8e('0x32')][_0x4b8e('0x39')]);_0x97172[_0x4b8e('0x1f')]=qs[_0x4b8e('0x1f')](_0x2a3775[_0x4b8e('0x32')][_0x4b8e('0x1f')]);}_0x97172[_0x4b8e('0x3a')]=qs[_0x4b8e('0x3b')](_0x2a3775['query']['sort']);_0x97172[_0x4b8e('0x3c')]=qs[_0x4b8e('0x33')](_[_0x4b8e('0x3d')](_0x2a3775['query'],_0x12e216[_0x4b8e('0x33')]),_0x36de4c);if(_0x2a3775[_0x4b8e('0x32')]['filter']){_0x97172['where']=_[_0x4b8e('0x3e')](_0x97172[_0x4b8e('0x3c')],{'$or':_['map'](_0x36de4c,function(_0x264ca7){if(_0x264ca7[_0x4b8e('0x3f')]!=='VIRTUAL'){var _0x347ddb={};_0x347ddb[_0x264ca7[_0x4b8e('0x2b')]]={'$like':'%'+_0x2a3775[_0x4b8e('0x32')][_0x4b8e('0x40')]+'%'};return _0x347ddb;}})});}_0x97172=_[_0x4b8e('0x3e')]({},_0x97172,_0x2a3775['options']);var _0x13af3b={'where':_0x97172[_0x4b8e('0x3c')]};return db[_0x4b8e('0x2f')][_0x4b8e('0x1e')](_0x13af3b)[_0x4b8e('0x25')](function(_0x2f85e4){_0x412a90[_0x4b8e('0x1e')]=_0x2f85e4;if(_0x2a3775[_0x4b8e('0x32')][_0x4b8e('0x41')]){_0x97172[_0x4b8e('0x42')]=[{'all':!![]}];}return db[_0x4b8e('0x2f')]['findAll'](_0x97172);})[_0x4b8e('0x25')](function(_0x457b61){_0x412a90[_0x4b8e('0x43')]=_0x457b61;return _0x412a90;})[_0x4b8e('0x25')](respondWithFilteredResult(_0x4f8aa0,_0x97172))[_0x4b8e('0x44')](handleError(_0x4f8aa0,null));};exports[_0x4b8e('0x45')]=function(_0x46f7a6,_0x208737){var _0x513029={'raw':![],'where':{'id':_0x46f7a6['params']['id']}},_0x51ce7c={};_0x51ce7c['model']=_[_0x4b8e('0x31')](db[_0x4b8e('0x2f')][_0x4b8e('0x46')]);_0x51ce7c[_0x4b8e('0x32')]=_['keys'](_0x46f7a6[_0x4b8e('0x32')]);_0x51ce7c[_0x4b8e('0x33')]=_[_0x4b8e('0x34')](_0x51ce7c[_0x4b8e('0x30')],_0x51ce7c[_0x4b8e('0x32')]);_0x513029['attributes']=_['intersection'](_0x51ce7c['model'],qs[_0x4b8e('0x36')](_0x46f7a6[_0x4b8e('0x32')][_0x4b8e('0x36')]));_0x513029[_0x4b8e('0x35')]=_0x513029[_0x4b8e('0x35')][_0x4b8e('0x47')]?_0x513029[_0x4b8e('0x35')]:_0x51ce7c[_0x4b8e('0x30')];if(_0x46f7a6[_0x4b8e('0x32')][_0x4b8e('0x41')]){_0x513029[_0x4b8e('0x42')]=[{'all':!![]}];}_0x513029=_['merge']({},_0x513029,_0x46f7a6[_0x4b8e('0x48')]);return db[_0x4b8e('0x2f')]['find'](_0x513029)[_0x4b8e('0x25')](handleEntityNotFound(_0x208737,null))[_0x4b8e('0x25')](respondWithResult(_0x208737,null))[_0x4b8e('0x44')](handleError(_0x208737,null));};exports[_0x4b8e('0x49')]=function(_0x2721af,_0x943dbe){return db['Trigger'][_0x4b8e('0x49')](_0x2721af[_0x4b8e('0x4a')],{})['then'](function(_0x2d0b26){var _0x4e014b=_0x2721af[_0x4b8e('0x4b')][_0x4b8e('0x27')]({'plain':!![]});if(!_0x4e014b)throw new Error(_0x4b8e('0x4c'));if(_0x4e014b[_0x4b8e('0x4d')]==='user'){var _0x10630a=_0x2d0b26[_0x4b8e('0x27')]({'plain':!![]});var _0x40b1de=_0x4b8e('0x4e');return db['UserProfileSection'][_0x4b8e('0x4f')]({'where':{'name':_0x40b1de,'userProfileId':_0x4e014b[_0x4b8e('0x50')]},'raw':!![]})[_0x4b8e('0x25')](function(_0x120a5d){if(_0x120a5d&&_0x120a5d[_0x4b8e('0x51')]===0x0){return db[_0x4b8e('0x28')][_0x4b8e('0x49')]({'name':_0x10630a['name'],'resourceId':_0x10630a['id'],'type':_0x120a5d[_0x4b8e('0x2b')],'sectionId':_0x120a5d['id']},{})[_0x4b8e('0x25')](function(){return _0x2d0b26;});}else{return _0x2d0b26;}})[_0x4b8e('0x44')](function(_0x53f2ae){logger[_0x4b8e('0x52')](_0x4b8e('0x53'),_0x53f2ae);throw _0x53f2ae;});}return _0x2d0b26;})['then'](respondWithResult(_0x943dbe,0xc9))[_0x4b8e('0x44')](handleError(_0x943dbe,null));};exports[_0x4b8e('0x24')]=function(_0x2d934e,_0x1781ea){if(_0x2d934e[_0x4b8e('0x4a')]['id']){delete _0x2d934e['body']['id'];}return db['Trigger'][_0x4b8e('0x4f')]({'where':{'id':_0x2d934e[_0x4b8e('0x54')]['id']}})[_0x4b8e('0x25')](handleEntityNotFound(_0x1781ea,null))[_0x4b8e('0x25')](saveUpdates(_0x2d934e[_0x4b8e('0x4a')],null))[_0x4b8e('0x25')](respondWithResult(_0x1781ea,null))['catch'](handleError(_0x1781ea,null));};exports['destroy']=function(_0x434479,_0x364364){return db[_0x4b8e('0x2f')][_0x4b8e('0x4f')]({'where':{'id':_0x434479[_0x4b8e('0x54')]['id']}})[_0x4b8e('0x25')](handleEntityNotFound(_0x364364,null))[_0x4b8e('0x25')](removeEntity(_0x364364,null))[_0x4b8e('0x44')](handleError(_0x364364,null));};exports[_0x4b8e('0x55')]=function(_0x28cfb3,_0x2706b0,_0x392374){if(_0x28cfb3['body']['id']){delete _0x28cfb3['body']['id'];}return db[_0x4b8e('0x2f')][_0x4b8e('0x4f')]({'where':{'id':_0x28cfb3[_0x4b8e('0x54')]['id']}})[_0x4b8e('0x25')](handleEntityNotFound(_0x2706b0,null))[_0x4b8e('0x25')](function(_0x55a651){if(_0x55a651){_0x28cfb3[_0x4b8e('0x4a')]['TriggerAllId']=_0x55a651['id'];return db['Condition'][_0x4b8e('0x49')](_0x28cfb3[_0x4b8e('0x4a')]);}})[_0x4b8e('0x25')](respondWithResult(_0x2706b0,null))[_0x4b8e('0x44')](handleError(_0x2706b0,null));};exports[_0x4b8e('0x56')]=function(_0x2cc8ec,_0x355efb,_0x18f170){if(_0x2cc8ec['body']['id']){delete _0x2cc8ec[_0x4b8e('0x4a')]['id'];}return db[_0x4b8e('0x2f')][_0x4b8e('0x4f')]({'where':{'id':_0x2cc8ec[_0x4b8e('0x54')]['id']}})['then'](handleEntityNotFound(_0x355efb,null))[_0x4b8e('0x25')](function(_0x515c9b){if(_0x515c9b){_0x2cc8ec['body'][_0x4b8e('0x57')]=_0x515c9b['id'];return db[_0x4b8e('0x58')][_0x4b8e('0x49')](_0x2cc8ec[_0x4b8e('0x4a')]);}})['then'](respondWithResult(_0x355efb,null))[_0x4b8e('0x44')](handleError(_0x355efb,null));};exports['getAllConditions']=function(_0x491737,_0x29e34f,_0x5770e1){var _0x194436={};var _0x3f29e7={};var _0x2c37d5;var _0x443206;return db[_0x4b8e('0x2f')]['findOne']({'where':{'id':_0x491737[_0x4b8e('0x54')]['id']}})['then'](handleEntityNotFound(_0x29e34f,null))[_0x4b8e('0x25')](function(_0x2d092c){if(_0x2d092c){_0x2c37d5=_0x2d092c;_0x3f29e7[_0x4b8e('0x30')]=_[_0x4b8e('0x31')](db[_0x4b8e('0x58')][_0x4b8e('0x46')]);_0x3f29e7[_0x4b8e('0x32')]=_[_0x4b8e('0x31')](_0x491737[_0x4b8e('0x32')]);_0x3f29e7[_0x4b8e('0x33')]=_[_0x4b8e('0x34')](_0x3f29e7[_0x4b8e('0x30')],_0x3f29e7[_0x4b8e('0x32')]);_0x194436[_0x4b8e('0x35')]=_[_0x4b8e('0x34')](_0x3f29e7[_0x4b8e('0x30')],qs['fields'](_0x491737[_0x4b8e('0x32')][_0x4b8e('0x36')]));_0x194436[_0x4b8e('0x35')]=_0x194436[_0x4b8e('0x35')]['length']?_0x194436[_0x4b8e('0x35')]:_0x3f29e7[_0x4b8e('0x30')];_0x194436[_0x4b8e('0x3a')]=qs[_0x4b8e('0x3b')](_0x491737['query'][_0x4b8e('0x3b')]);_0x194436[_0x4b8e('0x3c')]=qs['filters'](_[_0x4b8e('0x3d')](_0x491737['query'],_0x3f29e7['filters']));if(_0x491737[_0x4b8e('0x32')][_0x4b8e('0x40')]){_0x194436[_0x4b8e('0x3c')]=_[_0x4b8e('0x3e')](_0x194436[_0x4b8e('0x3c')],{'$or':_[_0x4b8e('0x2e')](_0x194436[_0x4b8e('0x35')],function(_0x26b8e0){var _0xd53c35={};_0xd53c35[_0x26b8e0]={'$like':'%'+_0x491737[_0x4b8e('0x32')][_0x4b8e('0x40')]+'%'};return _0xd53c35;})});}_0x194436=_[_0x4b8e('0x3e')]({},_0x194436,_0x491737[_0x4b8e('0x48')]);return _0x2c37d5[_0x4b8e('0x59')](_0x194436);}})['then'](function(_0x4006f2){if(_0x4006f2){_0x443206=_0x4006f2[_0x4b8e('0x47')];if(!_0x491737[_0x4b8e('0x32')][_0x4b8e('0x37')](_0x4b8e('0x38'))){_0x194436['limit']=qs[_0x4b8e('0x39')](_0x491737[_0x4b8e('0x32')]['limit']);_0x194436['offset']=qs[_0x4b8e('0x1f')](_0x491737['query'][_0x4b8e('0x1f')]);}return _0x2c37d5[_0x4b8e('0x59')](_0x194436);}})[_0x4b8e('0x25')](function(_0x97636c){if(_0x97636c){return _0x97636c?{'count':_0x443206,'rows':_0x97636c}:null;}})[_0x4b8e('0x25')](respondWithResult(_0x29e34f,null))[_0x4b8e('0x44')](handleError(_0x29e34f,null));};exports[_0x4b8e('0x5a')]=function(_0xa4cfec,_0x588990,_0x2435a2){var _0x2e3e9b={};var _0x17fc72={};var _0x9cc71c;var _0x178d72;return db[_0x4b8e('0x2f')][_0x4b8e('0x5b')]({'where':{'id':_0xa4cfec[_0x4b8e('0x54')]['id']}})[_0x4b8e('0x25')](handleEntityNotFound(_0x588990,null))['then'](function(_0x533e3d){if(_0x533e3d){_0x9cc71c=_0x533e3d;_0x17fc72[_0x4b8e('0x30')]=_['keys'](db[_0x4b8e('0x58')][_0x4b8e('0x46')]);_0x17fc72['query']=_[_0x4b8e('0x31')](_0xa4cfec[_0x4b8e('0x32')]);_0x17fc72['filters']=_[_0x4b8e('0x34')](_0x17fc72[_0x4b8e('0x30')],_0x17fc72['query']);_0x2e3e9b['attributes']=_['intersection'](_0x17fc72['model'],qs[_0x4b8e('0x36')](_0xa4cfec[_0x4b8e('0x32')][_0x4b8e('0x36')]));_0x2e3e9b[_0x4b8e('0x35')]=_0x2e3e9b[_0x4b8e('0x35')]['length']?_0x2e3e9b[_0x4b8e('0x35')]:_0x17fc72[_0x4b8e('0x30')];_0x2e3e9b[_0x4b8e('0x3a')]=qs['sort'](_0xa4cfec[_0x4b8e('0x32')][_0x4b8e('0x3b')]);_0x2e3e9b[_0x4b8e('0x3c')]=qs['filters'](_['pick'](_0xa4cfec['query'],_0x17fc72[_0x4b8e('0x33')]));if(_0xa4cfec[_0x4b8e('0x32')][_0x4b8e('0x40')]){_0x2e3e9b[_0x4b8e('0x3c')]=_['merge'](_0x2e3e9b['where'],{'$or':_['map'](_0x2e3e9b['attributes'],function(_0x2ecbb3){var _0x45298d={};_0x45298d[_0x2ecbb3]={'$like':'%'+_0xa4cfec['query'][_0x4b8e('0x40')]+'%'};return _0x45298d;})});}_0x2e3e9b=_[_0x4b8e('0x3e')]({},_0x2e3e9b,_0xa4cfec['options']);return _0x9cc71c[_0x4b8e('0x5a')](_0x2e3e9b);}})[_0x4b8e('0x25')](function(_0x3b031f){if(_0x3b031f){_0x178d72=_0x3b031f[_0x4b8e('0x47')];if(!_0xa4cfec[_0x4b8e('0x32')]['hasOwnProperty']('nolimit')){_0x2e3e9b['limit']=qs[_0x4b8e('0x39')](_0xa4cfec[_0x4b8e('0x32')][_0x4b8e('0x39')]);_0x2e3e9b[_0x4b8e('0x1f')]=qs[_0x4b8e('0x1f')](_0xa4cfec[_0x4b8e('0x32')][_0x4b8e('0x1f')]);}return _0x9cc71c[_0x4b8e('0x5a')](_0x2e3e9b);}})['then'](function(_0x4210f3){if(_0x4210f3){return _0x4210f3?{'count':_0x178d72,'rows':_0x4210f3}:null;}})[_0x4b8e('0x25')](respondWithResult(_0x588990,null))[_0x4b8e('0x44')](handleError(_0x588990,null));};exports[_0x4b8e('0x5c')]=function(_0x11471c,_0x1e4dff,_0x159509){if(_0x11471c['body']['id']){delete _0x11471c[_0x4b8e('0x4a')]['id'];}return db[_0x4b8e('0x2f')][_0x4b8e('0x4f')]({'where':{'id':_0x11471c[_0x4b8e('0x54')]['id']}})['then'](handleEntityNotFound(_0x1e4dff,null))['then'](function(_0x32fb73){if(_0x32fb73){_0x11471c[_0x4b8e('0x4a')][_0x4b8e('0x5d')]=_0x32fb73['id'];return db[_0x4b8e('0x5e')][_0x4b8e('0x49')](_0x11471c[_0x4b8e('0x4a')]);}})['then'](respondWithResult(_0x1e4dff,null))[_0x4b8e('0x44')](handleError(_0x1e4dff,null));};exports['getActions']=function(_0x3613b2,_0x411cb4,_0x1ecb74){var _0xf4580b={};var _0x244530={};var _0x3ead35;var _0x3fc5b7;return db[_0x4b8e('0x2f')][_0x4b8e('0x5b')]({'where':{'id':_0x3613b2['params']['id']}})[_0x4b8e('0x25')](handleEntityNotFound(_0x411cb4,null))[_0x4b8e('0x25')](function(_0x2c3ce1){if(_0x2c3ce1){_0x3ead35=_0x2c3ce1;_0x244530[_0x4b8e('0x30')]=_[_0x4b8e('0x31')](db[_0x4b8e('0x5e')][_0x4b8e('0x46')]);_0x244530[_0x4b8e('0x32')]=_[_0x4b8e('0x31')](_0x3613b2[_0x4b8e('0x32')]);_0x244530[_0x4b8e('0x33')]=_['intersection'](_0x244530[_0x4b8e('0x30')],_0x244530[_0x4b8e('0x32')]);_0xf4580b['attributes']=_[_0x4b8e('0x34')](_0x244530[_0x4b8e('0x30')],qs[_0x4b8e('0x36')](_0x3613b2['query']['fields']));_0xf4580b[_0x4b8e('0x35')]=_0xf4580b['attributes']['length']?_0xf4580b['attributes']:_0x244530[_0x4b8e('0x30')];_0xf4580b['order']=qs['sort'](_0x3613b2[_0x4b8e('0x32')][_0x4b8e('0x3b')]);_0xf4580b[_0x4b8e('0x3c')]=qs[_0x4b8e('0x33')](_[_0x4b8e('0x3d')](_0x3613b2[_0x4b8e('0x32')],_0x244530[_0x4b8e('0x33')]));if(_0x3613b2['query'][_0x4b8e('0x40')]){_0xf4580b[_0x4b8e('0x3c')]=_[_0x4b8e('0x3e')](_0xf4580b[_0x4b8e('0x3c')],{'$or':_['map'](_0xf4580b['attributes'],function(_0x317e36){var _0x198686={};_0x198686[_0x317e36]={'$like':'%'+_0x3613b2[_0x4b8e('0x32')][_0x4b8e('0x40')]+'%'};return _0x198686;})});}_0xf4580b=_[_0x4b8e('0x3e')]({},_0xf4580b,_0x3613b2[_0x4b8e('0x48')]);return _0x3ead35['getActions'](_0xf4580b);}})[_0x4b8e('0x25')](function(_0x1ed643){if(_0x1ed643){_0x3fc5b7=_0x1ed643['length'];if(!_0x3613b2[_0x4b8e('0x32')][_0x4b8e('0x37')](_0x4b8e('0x38'))){_0xf4580b['limit']=qs[_0x4b8e('0x39')](_0x3613b2[_0x4b8e('0x32')][_0x4b8e('0x39')]);_0xf4580b[_0x4b8e('0x1f')]=qs[_0x4b8e('0x1f')](_0x3613b2[_0x4b8e('0x32')]['offset']);}return _0x3ead35['getActions'](_0xf4580b);}})[_0x4b8e('0x25')](function(_0x6123cf){if(_0x6123cf){return _0x6123cf?{'count':_0x3fc5b7,'rows':_0x6123cf}:null;}})[_0x4b8e('0x25')](respondWithResult(_0x411cb4,null))[_0x4b8e('0x44')](handleError(_0x411cb4,null));}; \ No newline at end of file +var _0x576e=['includeAll','include','rows','catch','show','rawAttributes','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','find','userProfileId','autoAssociation','name','params','addAllCondition','Condition','addAnyCondition','TriggerAnyId','findOne','options','getAllConditions','getAnyConditions','hasOwnProperty','addAction','TriggerId','Action','getActions','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','reject','update','then','destroy','get','UserProfileResource','end','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Trigger'];(function(_0x295f2e,_0xf6f834){var _0x1d926e=function(_0x333946){while(--_0x333946){_0x295f2e['push'](_0x295f2e['shift']());}};_0x1d926e(++_0xf6f834);}(_0x576e,0x190));var _0xe576=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0x576e[_0x100e36];return _0x1df0c9;};'use strict';var pdf=require(_0xe576('0x0'));var emlformat=require(_0xe576('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe576('0x2'));var jsonpatch=require(_0xe576('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe576('0x4'));var Mustache=require(_0xe576('0x5'));var util=require(_0xe576('0x6'));var path=require(_0xe576('0x7'));var sox=require(_0xe576('0x8'));var csv=require(_0xe576('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe576('0xa'));var squel=require(_0xe576('0xb'));var crypto=require(_0xe576('0xc'));var jsforce=require(_0xe576('0xd'));var deskjs=require(_0xe576('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe576('0xf'));var Papa=require(_0xe576('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe576('0x11'));var hardwareService=require(_0xe576('0x12'));var logger=require(_0xe576('0x13'))(_0xe576('0x14'));var utils=require('../../config/utils');var config=require(_0xe576('0x15'));var db=require(_0xe576('0x16'))['db'];function respondWithStatusCode(_0x2ebca0,_0x50acf1){_0x50acf1=_0x50acf1||0xcc;return function(_0x5d3102){if(_0x5d3102){return _0x2ebca0[_0xe576('0x17')](_0x50acf1);}return _0x2ebca0[_0xe576('0x18')](_0x50acf1)['end']();};}function respondWithResult(_0x207330,_0xea8ecb){_0xea8ecb=_0xea8ecb||0xc8;return function(_0x7332d5){if(_0x7332d5){return _0x207330['status'](_0xea8ecb)['json'](_0x7332d5);}};}function respondWithFilteredResult(_0x5682b7,_0x325d69){return function(_0x144297){if(_0x144297){var _0xfaede5=_0x144297[_0xe576('0x19')],_0x10c312=_0x325d69['offset'],_0x34851b=_0x325d69[_0xe576('0x1a')]+_0x325d69[_0xe576('0x1b')],_0x37fe69;if(_0x34851b>=_0xfaede5){_0x34851b=_0xfaede5;_0x37fe69=0xc8;}else{_0x37fe69=0xce;}_0x5682b7['status'](_0x37fe69);return _0x5682b7[_0xe576('0x1c')]('Content-Range',_0x10c312+'-'+_0x34851b+'/'+_0xfaede5)[_0xe576('0x1d')](_0x144297);}return null;};}function patchUpdates(_0x5d328b){return function(_0x4c6bbd){try{jsonpatch[_0xe576('0x1e')](_0x4c6bbd,_0x5d328b,!![]);}catch(_0x6aa923){return BPromise[_0xe576('0x1f')](_0x6aa923);}return _0x4c6bbd['save']();};}function saveUpdates(_0xb4ea0d,_0x418a39){return function(_0xfb4a3e){if(_0xfb4a3e){return _0xfb4a3e[_0xe576('0x20')](_0xb4ea0d)[_0xe576('0x21')](function(_0x4578b0){return _0x4578b0;});}return null;};}function removeEntity(_0x3342a6,_0x4e386d){return function(_0x49df50){if(_0x49df50){return _0x49df50[_0xe576('0x22')]()[_0xe576('0x21')](function(){var _0x392adb=_0x49df50[_0xe576('0x23')]({'plain':!![]});var _0xe5a2fe='Triggers';return db[_0xe576('0x24')][_0xe576('0x22')]({'where':{'type':_0xe5a2fe,'resourceId':_0x392adb['id']}})[_0xe576('0x21')](function(){return _0x49df50;});})[_0xe576('0x21')](function(){_0x3342a6[_0xe576('0x18')](0xcc)[_0xe576('0x25')]();});}};}function handleEntityNotFound(_0x251bed,_0x2d895a){return function(_0x42be0d){if(!_0x42be0d){_0x251bed[_0xe576('0x17')](0x194);}return _0x42be0d;};}function handleError(_0x1b2f77,_0x309849){_0x309849=_0x309849||0x1f4;return function(_0x309546){logger['error'](_0x309546['stack']);if(_0x309546['name']){delete _0x309546['name'];}_0x1b2f77[_0xe576('0x18')](_0x309849)[_0xe576('0x26')](_0x309546);};}exports[_0xe576('0x27')]=function(_0x475e9e,_0x57f085){var _0x55ac40={},_0x18533a={},_0x19dddb={'count':0x0,'rows':[]};var _0x4ffe61=_[_0xe576('0x28')](db['Trigger']['rawAttributes'],function(_0xaba9fa){return{'name':_0xaba9fa[_0xe576('0x29')],'type':_0xaba9fa[_0xe576('0x2a')][_0xe576('0x2b')]};});_0x18533a[_0xe576('0x2c')]=_['map'](_0x4ffe61,'name');_0x18533a[_0xe576('0x2d')]=_[_0xe576('0x2e')](_0x475e9e[_0xe576('0x2d')]);_0x18533a[_0xe576('0x2f')]=_['intersection'](_0x18533a['model'],_0x18533a[_0xe576('0x2d')]);_0x55ac40[_0xe576('0x30')]=_[_0xe576('0x31')](_0x18533a[_0xe576('0x2c')],qs['fields'](_0x475e9e[_0xe576('0x2d')]['fields']));_0x55ac40[_0xe576('0x30')]=_0x55ac40['attributes'][_0xe576('0x32')]?_0x55ac40[_0xe576('0x30')]:_0x18533a[_0xe576('0x2c')];if(!_0x475e9e[_0xe576('0x2d')]['hasOwnProperty'](_0xe576('0x33'))){_0x55ac40['limit']=qs[_0xe576('0x1b')](_0x475e9e[_0xe576('0x2d')][_0xe576('0x1b')]);_0x55ac40[_0xe576('0x1a')]=qs[_0xe576('0x1a')](_0x475e9e['query'][_0xe576('0x1a')]);}_0x55ac40[_0xe576('0x34')]=qs[_0xe576('0x35')](_0x475e9e[_0xe576('0x2d')][_0xe576('0x35')]);_0x55ac40[_0xe576('0x36')]=qs[_0xe576('0x2f')](_[_0xe576('0x37')](_0x475e9e['query'],_0x18533a[_0xe576('0x2f')]),_0x4ffe61);if(_0x475e9e[_0xe576('0x2d')][_0xe576('0x38')]){_0x55ac40[_0xe576('0x36')]=_[_0xe576('0x39')](_0x55ac40[_0xe576('0x36')],{'$or':_['map'](_0x4ffe61,function(_0x3067ee){if(_0x3067ee[_0xe576('0x2a')]!==_0xe576('0x3a')){var _0x119acd={};_0x119acd[_0x3067ee['name']]={'$like':'%'+_0x475e9e[_0xe576('0x2d')][_0xe576('0x38')]+'%'};return _0x119acd;}})});}_0x55ac40=_[_0xe576('0x39')]({},_0x55ac40,_0x475e9e['options']);var _0x585455={'where':_0x55ac40[_0xe576('0x36')]};return db[_0xe576('0x3b')]['count'](_0x585455)[_0xe576('0x21')](function(_0x2816ff){_0x19dddb['count']=_0x2816ff;if(_0x475e9e['query'][_0xe576('0x3c')]){_0x55ac40[_0xe576('0x3d')]=[{'all':!![]}];}return db[_0xe576('0x3b')]['findAll'](_0x55ac40);})[_0xe576('0x21')](function(_0xb0549e){_0x19dddb[_0xe576('0x3e')]=_0xb0549e;return _0x19dddb;})[_0xe576('0x21')](respondWithFilteredResult(_0x57f085,_0x55ac40))[_0xe576('0x3f')](handleError(_0x57f085,null));};exports[_0xe576('0x40')]=function(_0x66ee65,_0x544c4e){var _0x43000a={'raw':![],'where':{'id':_0x66ee65['params']['id']}},_0x52c9f6={};_0x52c9f6[_0xe576('0x2c')]=_[_0xe576('0x2e')](db[_0xe576('0x3b')][_0xe576('0x41')]);_0x52c9f6[_0xe576('0x2d')]=_[_0xe576('0x2e')](_0x66ee65[_0xe576('0x2d')]);_0x52c9f6[_0xe576('0x2f')]=_[_0xe576('0x31')](_0x52c9f6[_0xe576('0x2c')],_0x52c9f6[_0xe576('0x2d')]);_0x43000a['attributes']=_[_0xe576('0x31')](_0x52c9f6[_0xe576('0x2c')],qs[_0xe576('0x42')](_0x66ee65[_0xe576('0x2d')][_0xe576('0x42')]));_0x43000a[_0xe576('0x30')]=_0x43000a[_0xe576('0x30')]['length']?_0x43000a[_0xe576('0x30')]:_0x52c9f6['model'];if(_0x66ee65['query']['includeAll']){_0x43000a[_0xe576('0x3d')]=[{'all':!![]}];}_0x43000a=_[_0xe576('0x39')]({},_0x43000a,_0x66ee65['options']);return db['Trigger']['find'](_0x43000a)[_0xe576('0x21')](handleEntityNotFound(_0x544c4e,null))['then'](respondWithResult(_0x544c4e,null))['catch'](handleError(_0x544c4e,null));};exports[_0xe576('0x43')]=function(_0x218653,_0x4d8662){return db['Trigger'][_0xe576('0x43')](_0x218653[_0xe576('0x44')],{})[_0xe576('0x21')](function(_0x1cf329){var _0x137ec1=_0x218653[_0xe576('0x45')][_0xe576('0x23')]({'plain':!![]});if(!_0x137ec1)throw new Error(_0xe576('0x46'));if(_0x137ec1[_0xe576('0x47')]==='user'){var _0x52171c=_0x1cf329[_0xe576('0x23')]({'plain':!![]});var _0x5ebb2d=_0xe576('0x48');return db[_0xe576('0x49')][_0xe576('0x4a')]({'where':{'name':_0x5ebb2d,'userProfileId':_0x137ec1[_0xe576('0x4b')]},'raw':!![]})[_0xe576('0x21')](function(_0x5125cf){if(_0x5125cf&&_0x5125cf[_0xe576('0x4c')]===0x0){return db['UserProfileResource'][_0xe576('0x43')]({'name':_0x52171c[_0xe576('0x4d')],'resourceId':_0x52171c['id'],'type':_0x5125cf[_0xe576('0x4d')],'sectionId':_0x5125cf['id']},{})[_0xe576('0x21')](function(){return _0x1cf329;});}else{return _0x1cf329;}})['catch'](function(_0x1a01e1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a01e1);throw _0x1a01e1;});}return _0x1cf329;})['then'](respondWithResult(_0x4d8662,0xc9))[_0xe576('0x3f')](handleError(_0x4d8662,null));};exports[_0xe576('0x20')]=function(_0x396285,_0x26e14a){if(_0x396285['body']['id']){delete _0x396285[_0xe576('0x44')]['id'];}return db[_0xe576('0x3b')][_0xe576('0x4a')]({'where':{'id':_0x396285[_0xe576('0x4e')]['id']}})[_0xe576('0x21')](handleEntityNotFound(_0x26e14a,null))[_0xe576('0x21')](saveUpdates(_0x396285[_0xe576('0x44')],null))[_0xe576('0x21')](respondWithResult(_0x26e14a,null))[_0xe576('0x3f')](handleError(_0x26e14a,null));};exports[_0xe576('0x22')]=function(_0x2c722c,_0x1ac532){return db[_0xe576('0x3b')][_0xe576('0x4a')]({'where':{'id':_0x2c722c['params']['id']}})[_0xe576('0x21')](handleEntityNotFound(_0x1ac532,null))[_0xe576('0x21')](removeEntity(_0x1ac532,null))[_0xe576('0x3f')](handleError(_0x1ac532,null));};exports[_0xe576('0x4f')]=function(_0x8526cc,_0x2115a8,_0x1f3c7a){if(_0x8526cc[_0xe576('0x44')]['id']){delete _0x8526cc[_0xe576('0x44')]['id'];}return db[_0xe576('0x3b')]['find']({'where':{'id':_0x8526cc['params']['id']}})[_0xe576('0x21')](handleEntityNotFound(_0x2115a8,null))[_0xe576('0x21')](function(_0x254f9b){if(_0x254f9b){_0x8526cc[_0xe576('0x44')]['TriggerAllId']=_0x254f9b['id'];return db[_0xe576('0x50')][_0xe576('0x43')](_0x8526cc[_0xe576('0x44')]);}})[_0xe576('0x21')](respondWithResult(_0x2115a8,null))[_0xe576('0x3f')](handleError(_0x2115a8,null));};exports[_0xe576('0x51')]=function(_0x2d9a0a,_0x49c063,_0x402121){if(_0x2d9a0a[_0xe576('0x44')]['id']){delete _0x2d9a0a['body']['id'];}return db[_0xe576('0x3b')][_0xe576('0x4a')]({'where':{'id':_0x2d9a0a[_0xe576('0x4e')]['id']}})[_0xe576('0x21')](handleEntityNotFound(_0x49c063,null))[_0xe576('0x21')](function(_0x38ec3d){if(_0x38ec3d){_0x2d9a0a[_0xe576('0x44')][_0xe576('0x52')]=_0x38ec3d['id'];return db[_0xe576('0x50')][_0xe576('0x43')](_0x2d9a0a[_0xe576('0x44')]);}})[_0xe576('0x21')](respondWithResult(_0x49c063,null))['catch'](handleError(_0x49c063,null));};exports['getAllConditions']=function(_0x4ee1e4,_0x524fbf,_0x54dfb0){var _0x497eb0={};var _0xf6ff87={};var _0x5089ad;var _0x499b32;return db[_0xe576('0x3b')][_0xe576('0x53')]({'where':{'id':_0x4ee1e4['params']['id']}})[_0xe576('0x21')](handleEntityNotFound(_0x524fbf,null))[_0xe576('0x21')](function(_0x142e28){if(_0x142e28){_0x5089ad=_0x142e28;_0xf6ff87[_0xe576('0x2c')]=_['keys'](db['Condition'][_0xe576('0x41')]);_0xf6ff87[_0xe576('0x2d')]=_['keys'](_0x4ee1e4[_0xe576('0x2d')]);_0xf6ff87[_0xe576('0x2f')]=_[_0xe576('0x31')](_0xf6ff87[_0xe576('0x2c')],_0xf6ff87[_0xe576('0x2d')]);_0x497eb0['attributes']=_[_0xe576('0x31')](_0xf6ff87[_0xe576('0x2c')],qs[_0xe576('0x42')](_0x4ee1e4['query'][_0xe576('0x42')]));_0x497eb0[_0xe576('0x30')]=_0x497eb0[_0xe576('0x30')][_0xe576('0x32')]?_0x497eb0[_0xe576('0x30')]:_0xf6ff87['model'];_0x497eb0[_0xe576('0x34')]=qs['sort'](_0x4ee1e4[_0xe576('0x2d')][_0xe576('0x35')]);_0x497eb0[_0xe576('0x36')]=qs[_0xe576('0x2f')](_[_0xe576('0x37')](_0x4ee1e4['query'],_0xf6ff87[_0xe576('0x2f')]));if(_0x4ee1e4[_0xe576('0x2d')][_0xe576('0x38')]){_0x497eb0[_0xe576('0x36')]=_[_0xe576('0x39')](_0x497eb0['where'],{'$or':_['map'](_0x497eb0[_0xe576('0x30')],function(_0x5d1e0f){var _0x5e23f1={};_0x5e23f1[_0x5d1e0f]={'$like':'%'+_0x4ee1e4[_0xe576('0x2d')][_0xe576('0x38')]+'%'};return _0x5e23f1;})});}_0x497eb0=_[_0xe576('0x39')]({},_0x497eb0,_0x4ee1e4[_0xe576('0x54')]);return _0x5089ad[_0xe576('0x55')](_0x497eb0);}})[_0xe576('0x21')](function(_0xd1ffd9){if(_0xd1ffd9){_0x499b32=_0xd1ffd9[_0xe576('0x32')];if(!_0x4ee1e4[_0xe576('0x2d')]['hasOwnProperty'](_0xe576('0x33'))){_0x497eb0[_0xe576('0x1b')]=qs[_0xe576('0x1b')](_0x4ee1e4[_0xe576('0x2d')]['limit']);_0x497eb0[_0xe576('0x1a')]=qs[_0xe576('0x1a')](_0x4ee1e4['query'][_0xe576('0x1a')]);}return _0x5089ad['getAllConditions'](_0x497eb0);}})[_0xe576('0x21')](function(_0x23617e){if(_0x23617e){return _0x23617e?{'count':_0x499b32,'rows':_0x23617e}:null;}})[_0xe576('0x21')](respondWithResult(_0x524fbf,null))[_0xe576('0x3f')](handleError(_0x524fbf,null));};exports[_0xe576('0x56')]=function(_0x5409bd,_0x518901,_0x2064ce){var _0x370523={};var _0x372b8d={};var _0x33a0f6;var _0x5eed8d;return db[_0xe576('0x3b')][_0xe576('0x53')]({'where':{'id':_0x5409bd[_0xe576('0x4e')]['id']}})[_0xe576('0x21')](handleEntityNotFound(_0x518901,null))['then'](function(_0x4cfff7){if(_0x4cfff7){_0x33a0f6=_0x4cfff7;_0x372b8d[_0xe576('0x2c')]=_[_0xe576('0x2e')](db['Condition'][_0xe576('0x41')]);_0x372b8d['query']=_[_0xe576('0x2e')](_0x5409bd[_0xe576('0x2d')]);_0x372b8d['filters']=_[_0xe576('0x31')](_0x372b8d[_0xe576('0x2c')],_0x372b8d[_0xe576('0x2d')]);_0x370523[_0xe576('0x30')]=_[_0xe576('0x31')](_0x372b8d[_0xe576('0x2c')],qs[_0xe576('0x42')](_0x5409bd['query']['fields']));_0x370523[_0xe576('0x30')]=_0x370523[_0xe576('0x30')][_0xe576('0x32')]?_0x370523['attributes']:_0x372b8d['model'];_0x370523[_0xe576('0x34')]=qs[_0xe576('0x35')](_0x5409bd[_0xe576('0x2d')][_0xe576('0x35')]);_0x370523['where']=qs[_0xe576('0x2f')](_[_0xe576('0x37')](_0x5409bd['query'],_0x372b8d[_0xe576('0x2f')]));if(_0x5409bd[_0xe576('0x2d')][_0xe576('0x38')]){_0x370523[_0xe576('0x36')]=_[_0xe576('0x39')](_0x370523['where'],{'$or':_[_0xe576('0x28')](_0x370523['attributes'],function(_0x19f142){var _0x1dbc61={};_0x1dbc61[_0x19f142]={'$like':'%'+_0x5409bd[_0xe576('0x2d')][_0xe576('0x38')]+'%'};return _0x1dbc61;})});}_0x370523=_['merge']({},_0x370523,_0x5409bd[_0xe576('0x54')]);return _0x33a0f6[_0xe576('0x56')](_0x370523);}})['then'](function(_0x79c5d6){if(_0x79c5d6){_0x5eed8d=_0x79c5d6['length'];if(!_0x5409bd[_0xe576('0x2d')][_0xe576('0x57')](_0xe576('0x33'))){_0x370523[_0xe576('0x1b')]=qs[_0xe576('0x1b')](_0x5409bd[_0xe576('0x2d')]['limit']);_0x370523['offset']=qs[_0xe576('0x1a')](_0x5409bd[_0xe576('0x2d')]['offset']);}return _0x33a0f6['getAnyConditions'](_0x370523);}})['then'](function(_0x237cf2){if(_0x237cf2){return _0x237cf2?{'count':_0x5eed8d,'rows':_0x237cf2}:null;}})[_0xe576('0x21')](respondWithResult(_0x518901,null))[_0xe576('0x3f')](handleError(_0x518901,null));};exports[_0xe576('0x58')]=function(_0x576b4f,_0x495987,_0x30bc51){if(_0x576b4f[_0xe576('0x44')]['id']){delete _0x576b4f[_0xe576('0x44')]['id'];}return db['Trigger'][_0xe576('0x4a')]({'where':{'id':_0x576b4f['params']['id']}})['then'](handleEntityNotFound(_0x495987,null))[_0xe576('0x21')](function(_0x1c0ed4){if(_0x1c0ed4){_0x576b4f[_0xe576('0x44')][_0xe576('0x59')]=_0x1c0ed4['id'];return db[_0xe576('0x5a')]['create'](_0x576b4f[_0xe576('0x44')]);}})[_0xe576('0x21')](respondWithResult(_0x495987,null))[_0xe576('0x3f')](handleError(_0x495987,null));};exports[_0xe576('0x5b')]=function(_0x14f7d0,_0xd013ea,_0x5a0015){var _0x193946={};var _0x5c9074={};var _0x258e06;var _0x4eb6c7;return db[_0xe576('0x3b')][_0xe576('0x53')]({'where':{'id':_0x14f7d0[_0xe576('0x4e')]['id']}})[_0xe576('0x21')](handleEntityNotFound(_0xd013ea,null))[_0xe576('0x21')](function(_0xaa85c7){if(_0xaa85c7){_0x258e06=_0xaa85c7;_0x5c9074[_0xe576('0x2c')]=_[_0xe576('0x2e')](db[_0xe576('0x5a')][_0xe576('0x41')]);_0x5c9074[_0xe576('0x2d')]=_[_0xe576('0x2e')](_0x14f7d0[_0xe576('0x2d')]);_0x5c9074['filters']=_[_0xe576('0x31')](_0x5c9074['model'],_0x5c9074['query']);_0x193946[_0xe576('0x30')]=_[_0xe576('0x31')](_0x5c9074[_0xe576('0x2c')],qs[_0xe576('0x42')](_0x14f7d0[_0xe576('0x2d')]['fields']));_0x193946[_0xe576('0x30')]=_0x193946[_0xe576('0x30')]['length']?_0x193946[_0xe576('0x30')]:_0x5c9074[_0xe576('0x2c')];_0x193946[_0xe576('0x34')]=qs[_0xe576('0x35')](_0x14f7d0[_0xe576('0x2d')]['sort']);_0x193946[_0xe576('0x36')]=qs[_0xe576('0x2f')](_[_0xe576('0x37')](_0x14f7d0[_0xe576('0x2d')],_0x5c9074['filters']));if(_0x14f7d0[_0xe576('0x2d')]['filter']){_0x193946[_0xe576('0x36')]=_['merge'](_0x193946['where'],{'$or':_[_0xe576('0x28')](_0x193946[_0xe576('0x30')],function(_0x1795d8){var _0x2d3b79={};_0x2d3b79[_0x1795d8]={'$like':'%'+_0x14f7d0[_0xe576('0x2d')][_0xe576('0x38')]+'%'};return _0x2d3b79;})});}_0x193946=_['merge']({},_0x193946,_0x14f7d0[_0xe576('0x54')]);return _0x258e06['getActions'](_0x193946);}})[_0xe576('0x21')](function(_0x1c1f09){if(_0x1c1f09){_0x4eb6c7=_0x1c1f09[_0xe576('0x32')];if(!_0x14f7d0[_0xe576('0x2d')][_0xe576('0x57')](_0xe576('0x33'))){_0x193946[_0xe576('0x1b')]=qs[_0xe576('0x1b')](_0x14f7d0[_0xe576('0x2d')][_0xe576('0x1b')]);_0x193946[_0xe576('0x1a')]=qs[_0xe576('0x1a')](_0x14f7d0[_0xe576('0x2d')][_0xe576('0x1a')]);}return _0x258e06[_0xe576('0x5b')](_0x193946);}})[_0xe576('0x21')](function(_0x16d025){if(_0x16d025){return _0x16d025?{'count':_0x4eb6c7,'rows':_0x16d025}:null;}})[_0xe576('0x21')](respondWithResult(_0xd013ea,null))[_0xe576('0x3f')](handleError(_0xd013ea,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 2d14ced..33e96c9 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 _0x5f2f=['bluebird','request-promise','path','./trigger.attributes','exports','define','Trigger','lodash','util','../../config/logger','api','moment'];(function(_0x478f7f,_0x2af3b5){var _0x1ad418=function(_0x4d5142){while(--_0x4d5142){_0x478f7f['push'](_0x478f7f['shift']());}};_0x1ad418(++_0x2af3b5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4c1e26,_0x4afcd1){_0x4c1e26=_0x4c1e26-0x0;var _0x3774cc=_0x5f2f[_0x4c1e26];return _0x3774cc;};'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':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./trigger.attributes'];(function(_0x58250d,_0x1b29eb){var _0x5676bb=function(_0xce2b42){while(--_0xce2b42){_0x58250d['push'](_0x58250d['shift']());}};_0x5676bb(++_0x1b29eb);}(_0x2ef3,0xba));var _0x32ef=function(_0x251f70,_0x3fb788){_0x251f70=_0x251f70-0x0;var _0x9a7a=_0x2ef3[_0x251f70];return _0x9a7a;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'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 0f33273..4208cbb 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 _0xd7d1=['code','message','result','catch','GetTrigger','findAll','options','raw','attributes','limit','include','map','model','debug','Trigger','find','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x22228c,_0x593e4d){var _0xf4ba54=function(_0x4c6fdb){while(--_0x4c6fdb){_0x22228c['push'](_0x22228c['shift']());}};_0xf4ba54(++_0x593e4d);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x5cd35c,_0x5f0b7c){_0x5cd35c=_0x5cd35c-0x0;var _0x41d74d=_0xd7d1[_0x5cd35c];return _0x41d74d;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('Trigger,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});}exports[_0x1d7d('0x19')]=function(_0x4db4f2){var _0x664e3f=this;return new Promise(function(_0x191024,_0x5cbb8f){return db['Trigger'][_0x1d7d('0x1a')]({'raw':_0x4db4f2[_0x1d7d('0x1b')]?_0x4db4f2[_0x1d7d('0x1b')][_0x1d7d('0x1c')]===undefined?!![]:![]:!![],'where':_0x4db4f2[_0x1d7d('0x1b')]?_0x4db4f2[_0x1d7d('0x1b')]['where']||null:null,'attributes':_0x4db4f2[_0x1d7d('0x1b')]?_0x4db4f2[_0x1d7d('0x1b')][_0x1d7d('0x1d')]||null:null,'limit':_0x4db4f2['options']?_0x4db4f2[_0x1d7d('0x1b')][_0x1d7d('0x1e')]||null:null,'include':_0x4db4f2['options']?_0x4db4f2['options'][_0x1d7d('0x1f')]?_[_0x1d7d('0x20')](_0x4db4f2[_0x1d7d('0x1b')]['include'],function(_0x377653){return{'model':db[_0x377653[_0x1d7d('0x21')]],'as':_0x377653['as'],'attributes':_0x377653[_0x1d7d('0x1d')],'include':_0x377653[_0x1d7d('0x1f')]?_['map'](_0x377653[_0x1d7d('0x1f')],function(_0x151198){return{'model':db[_0x151198['model']],'as':_0x151198['as'],'attributes':_0x151198['attributes'],'include':_0x151198[_0x1d7d('0x1f')]?_['map'](_0x151198[_0x1d7d('0x1f')],function(_0x2d4de4){return{'model':db[_0x2d4de4[_0x1d7d('0x21')]],'as':_0x2d4de4['as'],'attributes':_0x2d4de4[_0x1d7d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1d7d('0xe')](function(_0x59f827){logger[_0x1d7d('0xf')](_0x1d7d('0x19'),_0x4db4f2);logger[_0x1d7d('0x22')]('GetTrigger',_0x4db4f2,JSON[_0x1d7d('0x13')](_0x59f827));_0x191024(_0x59f827);})[_0x1d7d('0x18')](function(_0x23ad85){logger['error']('GetTrigger',_0x23ad85['message'],_0x4db4f2);_0x5cbb8f(_0x664e3f[_0x1d7d('0x14')](0x1f4,_0x23ad85[_0x1d7d('0x16')]));});});};exports['ShowTrigger']=function(_0x1ebcbc){var _0x3e4136=this;return new Promise(function(_0x16a81d,_0x3336ab){return db[_0x1d7d('0x23')][_0x1d7d('0x24')]({'raw':_0x1ebcbc[_0x1d7d('0x1b')]?_0x1ebcbc[_0x1d7d('0x1b')][_0x1d7d('0x1c')]===undefined?!![]:![]:!![],'where':_0x1ebcbc[_0x1d7d('0x1b')]?_0x1ebcbc['options']['where']||null:null,'attributes':_0x1ebcbc[_0x1d7d('0x1b')]?_0x1ebcbc[_0x1d7d('0x1b')][_0x1d7d('0x1d')]||null:null,'include':_0x1ebcbc[_0x1d7d('0x1b')]?_0x1ebcbc[_0x1d7d('0x1b')][_0x1d7d('0x1f')]?_[_0x1d7d('0x20')](_0x1ebcbc[_0x1d7d('0x1b')][_0x1d7d('0x1f')],function(_0x47b6b2){return{'model':db[_0x47b6b2[_0x1d7d('0x21')]],'as':_0x47b6b2['as'],'attributes':_0x47b6b2[_0x1d7d('0x1d')],'include':_0x47b6b2[_0x1d7d('0x1f')]?_[_0x1d7d('0x20')](_0x47b6b2['include'],function(_0x4ee17f){return{'model':db[_0x4ee17f[_0x1d7d('0x21')]],'as':_0x4ee17f['as'],'attributes':_0x4ee17f[_0x1d7d('0x1d')],'include':_0x4ee17f['include']?_[_0x1d7d('0x20')](_0x4ee17f[_0x1d7d('0x1f')],function(_0x568092){return{'model':db[_0x568092['model']],'as':_0x568092['as'],'attributes':_0x568092[_0x1d7d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1d7d('0xe')](function(_0x406f57){logger[_0x1d7d('0xf')](_0x1d7d('0x25'),_0x1ebcbc);logger[_0x1d7d('0x22')](_0x1d7d('0x25'),_0x1ebcbc,JSON[_0x1d7d('0x13')](_0x406f57));_0x16a81d(_0x406f57);})[_0x1d7d('0x18')](function(_0x318b9a){logger['error']('ShowTrigger',_0x318b9a['message'],_0x1ebcbc);_0x3336ab(_0x3e4136['error'](0x1f4,_0x318b9a[_0x1d7d('0x16')]));});});}; \ No newline at end of file +var _0xd824=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','ShowTrigger','find','lodash','util','randomstring','ioredis'];(function(_0x6aeb0b,_0x4c5f87){var _0x25576b=function(_0x292d55){while(--_0x292d55){_0x6aeb0b['push'](_0x6aeb0b['shift']());}};_0x25576b(++_0x4c5f87);}(_0xd824,0xc2));var _0x4d82=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd824[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('Trigger,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});}exports[_0x4d82('0x12')]=function(_0x258c59){var _0x217b72=this;return new Promise(function(_0x2f2127,_0x5ef783){return db[_0x4d82('0x13')][_0x4d82('0x14')]({'raw':_0x258c59[_0x4d82('0x15')]?_0x258c59[_0x4d82('0x15')][_0x4d82('0x16')]===undefined?!![]:![]:!![],'where':_0x258c59[_0x4d82('0x15')]?_0x258c59[_0x4d82('0x15')][_0x4d82('0x17')]||null:null,'attributes':_0x258c59[_0x4d82('0x15')]?_0x258c59[_0x4d82('0x15')][_0x4d82('0x18')]||null:null,'limit':_0x258c59['options']?_0x258c59[_0x4d82('0x15')][_0x4d82('0x19')]||null:null,'include':_0x258c59['options']?_0x258c59[_0x4d82('0x15')][_0x4d82('0x1a')]?_[_0x4d82('0x1b')](_0x258c59[_0x4d82('0x15')][_0x4d82('0x1a')],function(_0x15f5d1){return{'model':db[_0x15f5d1[_0x4d82('0x1c')]],'as':_0x15f5d1['as'],'attributes':_0x15f5d1[_0x4d82('0x18')],'include':_0x15f5d1[_0x4d82('0x1a')]?_[_0x4d82('0x1b')](_0x15f5d1[_0x4d82('0x1a')],function(_0x395efc){return{'model':db[_0x395efc[_0x4d82('0x1c')]],'as':_0x395efc['as'],'attributes':_0x395efc[_0x4d82('0x18')],'include':_0x395efc[_0x4d82('0x1a')]?_['map'](_0x395efc['include'],function(_0x3dcb0f){return{'model':db[_0x3dcb0f[_0x4d82('0x1c')]],'as':_0x3dcb0f['as'],'attributes':_0x3dcb0f[_0x4d82('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4d82('0x1d')](function(_0x5cbd7e){logger[_0x4d82('0xa')](_0x4d82('0x12'),_0x258c59);logger[_0x4d82('0x1e')](_0x4d82('0x12'),_0x258c59,JSON['stringify'](_0x5cbd7e));_0x2f2127(_0x5cbd7e);})[_0x4d82('0x11')](function(_0x4a7444){logger['error']('GetTrigger',_0x4a7444['message'],_0x258c59);_0x5ef783(_0x217b72[_0x4d82('0xf')](0x1f4,_0x4a7444[_0x4d82('0x10')]));});});};exports[_0x4d82('0x1f')]=function(_0x52e320){var _0x713c56=this;return new Promise(function(_0x37cdc4,_0x5cf3e6){return db['Trigger'][_0x4d82('0x20')]({'raw':_0x52e320[_0x4d82('0x15')]?_0x52e320[_0x4d82('0x15')][_0x4d82('0x16')]===undefined?!![]:![]:!![],'where':_0x52e320['options']?_0x52e320[_0x4d82('0x15')]['where']||null:null,'attributes':_0x52e320[_0x4d82('0x15')]?_0x52e320[_0x4d82('0x15')]['attributes']||null:null,'include':_0x52e320['options']?_0x52e320[_0x4d82('0x15')][_0x4d82('0x1a')]?_[_0x4d82('0x1b')](_0x52e320[_0x4d82('0x15')][_0x4d82('0x1a')],function(_0x420b28){return{'model':db[_0x420b28[_0x4d82('0x1c')]],'as':_0x420b28['as'],'attributes':_0x420b28[_0x4d82('0x18')],'include':_0x420b28[_0x4d82('0x1a')]?_[_0x4d82('0x1b')](_0x420b28['include'],function(_0x382f43){return{'model':db[_0x382f43[_0x4d82('0x1c')]],'as':_0x382f43['as'],'attributes':_0x382f43[_0x4d82('0x18')],'include':_0x382f43['include']?_[_0x4d82('0x1b')](_0x382f43[_0x4d82('0x1a')],function(_0x57826a){return{'model':db[_0x57826a[_0x4d82('0x1c')]],'as':_0x57826a['as'],'attributes':_0x57826a[_0x4d82('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4d82('0x1d')](function(_0x5d0296){logger[_0x4d82('0xa')](_0x4d82('0x1f'),_0x52e320);logger['debug'](_0x4d82('0x1f'),_0x52e320,JSON['stringify'](_0x5d0296));_0x37cdc4(_0x5d0296);})[_0x4d82('0x11')](function(_0x2c21c9){logger['error'](_0x4d82('0x1f'),_0x2c21c9['message'],_0x52e320);_0x5cf3e6(_0x713c56[_0x4d82('0xf')](0x1f4,_0x2c21c9['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index a31fc14..649ea75 100644 --- a/server/api/trunk/index.js +++ b/server/api/trunk/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x032e=['post','/:id/clone','clone','create','update','delete','destroy','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5afe96,_0x65407c){var _0x3841d0=function(_0xe0f9e0){while(--_0xe0f9e0){_0x5afe96['push'](_0x5afe96['shift']());}};_0x3841d0(++_0x65407c);}(_0x032e,0x124));var _0xe032=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x032e[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe032('0x3'));var interaction=require(_0xe032('0x4'));var config=require(_0xe032('0x5'));var controller=require(_0xe032('0x6'));router[_0xe032('0x7')]('/',auth[_0xe032('0x8')](),controller[_0xe032('0x9')]);router[_0xe032('0x7')](_0xe032('0xa'),auth[_0xe032('0x8')](),controller[_0xe032('0xb')]);router[_0xe032('0xc')](_0xe032('0xd'),auth[_0xe032('0x8')](),controller[_0xe032('0xe')]);router[_0xe032('0xc')]('/',auth[_0xe032('0x8')](),controller[_0xe032('0xf')]);router['put'](_0xe032('0xa'),auth[_0xe032('0x8')](),controller[_0xe032('0x10')]);router[_0xe032('0x11')](_0xe032('0xa'),auth[_0xe032('0x8')](),controller[_0xe032('0x12')]);module['exports']=router; \ No newline at end of file +var _0x81bd=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trunk.controller','get','index','/:id','post','isAuthenticated','clone','create'];(function(_0x22b1ce,_0x42511b){var _0x2cca27=function(_0x240eba){while(--_0x240eba){_0x22b1ce['push'](_0x22b1ce['shift']());}};_0x2cca27(++_0x42511b);}(_0x81bd,0x7c));var _0xd81b=function(_0x56b034,_0xb96f9b){_0x56b034=_0x56b034-0x0;var _0x25f338=_0x81bd[_0x56b034];return _0x25f338;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var auth=require(_0xd81b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd81b('0x7'));var controller=require(_0xd81b('0x8'));router[_0xd81b('0x9')]('/',auth['isAuthenticated'](),controller[_0xd81b('0xa')]);router[_0xd81b('0x9')](_0xd81b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd81b('0xc')]('/:id/clone',auth[_0xd81b('0xd')](),controller[_0xd81b('0xe')]);router[_0xd81b('0xc')]('/',auth[_0xd81b('0xd')](),controller[_0xd81b('0xf')]);router[_0xd81b('0x10')](_0xd81b('0xb'),auth[_0xd81b('0xd')](),controller[_0xd81b('0x11')]);router[_0xd81b('0x12')](_0xd81b('0xb'),auth[_0xd81b('0xd')](),controller[_0xd81b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index b70c52e..138c280 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 _0xd8c5=['update,nonat','BOOLEAN','sequelize','exports','STRING','friend','user','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','accept','refuse','originate','uac','uas','pai','certificate','active','passive','dynamic'];(function(_0x2f9d3e,_0x29345f){var _0x32d8e6=function(_0x9f63fc){while(--_0x9f63fc){_0x2f9d3e['push'](_0x2f9d3e['shift']());}};_0x32d8e6(++_0x29345f);}(_0xd8c5,0x1c4));var _0x5d8c=function(_0x21649f,_0x25743b){_0x21649f=_0x21649f-0x0;var _0x2f7203=_0xd8c5[_0x21649f];return _0x2f7203;};'use strict';var Sequelize=require(_0x5d8c('0x0'));module[_0x5d8c('0x1')]={'name':{'type':Sequelize[_0x5d8c('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x5d8c('0x3'),_0x5d8c('0x4'),'peer'),'allowNull':![],'defaultValue':_0x5d8c('0x3')},'context':{'type':Sequelize[_0x5d8c('0x2')],'allowNull':![],'defaultValue':_0x5d8c('0x5')},'callingpres':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x7'),_0x5d8c('0x8'),_0x5d8c('0x9'),'ALLOWED','PROHIB_NOT_SCREENED',_0x5d8c('0xa'),_0x5d8c('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0x5d8c('0x2')]},'permit':{'type':Sequelize[_0x5d8c('0x2')]},'secret':{'type':Sequelize[_0x5d8c('0x2')]},'md5secret':{'type':Sequelize[_0x5d8c('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x5d8c('0xc'),'set':function(_0x505ea1){this[_0x5d8c('0xd')](_0x5d8c('0xe'),_0x505ea1?_0x505ea1[_0x5d8c('0xf')](','):null);},'get':function(){return this[_0x5d8c('0x10')](_0x5d8c('0xe'))?this[_0x5d8c('0x10')]('transport')[_0x5d8c('0x11')](','):null;},'comment':_0x5d8c('0x12')},'dtmfmode':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x13'),_0x5d8c('0x14'),_0x5d8c('0x15'),_0x5d8c('0x16'),_0x5d8c('0x17')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no',_0x5d8c('0x19'),_0x5d8c('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5d8c('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x5d8c('0x2')],'defaultValue':_0x5d8c('0x1b'),'set':function(_0x16385f){this['setDataValue'](_0x5d8c('0x1c'),_0x16385f?_0x16385f[_0x5d8c('0xf')](','):null);},'get':function(){return this[_0x5d8c('0x10')]('nat')?this[_0x5d8c('0x10')](_0x5d8c('0x1c'))[_0x5d8c('0x11')](','):null;},'comment':_0x5d8c('0x1d')},'callgroup':{'type':Sequelize[_0x5d8c('0x2')]},'namedcallgroup':{'type':Sequelize[_0x5d8c('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x5d8c('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5d8c('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x5d8c('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5d8c('0x1e'),'set':function(_0x39f964){this[_0x5d8c('0xd')](_0x5d8c('0x1f'),_0x39f964?_0x39f964[_0x5d8c('0xf')](';'):_0x5d8c('0x1e'));},'get':function(){return this['getDataValue'](_0x5d8c('0x1f'))?this[_0x5d8c('0x10')](_0x5d8c('0x1f'))[_0x5d8c('0x11')](';'):null;},'comment':_0x5d8c('0x20')},'autoframing':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no')},'insecure':{'type':Sequelize[_0x5d8c('0x2')],'defaultValue':_0x5d8c('0x21'),'set':function(_0x493c65){this[_0x5d8c('0xd')](_0x5d8c('0x22'),_0x493c65?_0x493c65[_0x5d8c('0xf')](','):null);},'get':function(){return this[_0x5d8c('0x10')](_0x5d8c('0x22'))?this['getDataValue'](_0x5d8c('0x22'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x5d8c('0x23'))},'promiscredir':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no')},'accountcode':{'type':Sequelize[_0x5d8c('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5d8c('0x2')],'defaultValue':_0x5d8c('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no'),'defaultValue':_0x5d8c('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x5d8c('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x5d8c('0x6')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x5d8c('0x2')]},'template':{'type':Sequelize[_0x5d8c('0x2')]},'videosupport':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5d8c('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0x5d8c('0x26'),_0x5d8c('0x27'),_0x5d8c('0x28'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x29'),_0x5d8c('0x2a')),'defaultValue':_0x5d8c('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x5d8c('0x2')]},'regexten':{'type':Sequelize[_0x5d8c('0x2')]},'fromdomain':{'type':Sequelize[_0x5d8c('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x5d8c('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x5d8c('0x2')]},'defaultuser':{'type':Sequelize[_0x5d8c('0x2')]},'rtptimeout':{'type':Sequelize[_0x5d8c('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x5d8c('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x5d8c('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no',_0x5d8c('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5d8c('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x5d8c('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x5d8c('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x5d8c('0x2')]},'contactdeny':{'type':Sequelize[_0x5d8c('0x2')]},'contactacl':{'type':Sequelize[_0x5d8c('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x5d8c('0x2')]},'use_q850_reason':{'type':Sequelize[_0x5d8c('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x5d8c('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x5d8c('0x18'),'no')},'force_avp':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no')},'icesupport':{'type':Sequelize[_0x5d8c('0x6')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x5d8c('0x6')]('yes','no','fingerprint',_0x5d8c('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x5d8c('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x5d8c('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x5d8c('0x2')]},'dtlscipher':{'type':Sequelize[_0x5d8c('0x2')]},'dtlscafile':{'type':Sequelize[_0x5d8c('0x2')]},'dtlscapath':{'type':Sequelize[_0x5d8c('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x5d8c('0x2d'),_0x5d8c('0x2e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5d8c('0x2')]},'usereqphone':{'type':Sequelize[_0x5d8c('0x6')](_0x5d8c('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5d8c('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x5d8c('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x5d8c('0x18'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5d8c('0x2')]},'host':{'type':Sequelize[_0x5d8c('0x2')],'defaultValue':_0x5d8c('0x2f')},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat','update',_0x5d8c('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x5d8c('0x2')]},'otherFields':{'type':Sequelize[_0x5d8c('0x2')]},'active':{'type':Sequelize[_0x5d8c('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xa8f0=['nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','insecure','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','BOOLEAN','sequelize','STRING','name','friend','peer','from-voip-provider','ENUM','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','nonat','update','outgoing','yes','force_rport,comedia'];(function(_0x26fd21,_0x2c3b26){var _0x67e91d=function(_0x1b2fc3){while(--_0x1b2fc3){_0x26fd21['push'](_0x26fd21['shift']());}};_0x67e91d(++_0x2c3b26);}(_0xa8f0,0x72));var _0x0a8f=function(_0x3a10b6,_0x3181f0){_0x3a10b6=_0x3a10b6-0x0;var _0x463dc3=_0xa8f0[_0x3a10b6];return _0x463dc3;};'use strict';var Sequelize=require(_0x0a8f('0x0'));module['exports']={'name':{'type':Sequelize[_0x0a8f('0x1')],'allowNull':![],'unique':_0x0a8f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a8f('0x3'),'user',_0x0a8f('0x4')),'allowNull':![],'defaultValue':_0x0a8f('0x3')},'context':{'type':Sequelize[_0x0a8f('0x1')],'allowNull':![],'defaultValue':_0x0a8f('0x5')},'callingpres':{'type':Sequelize[_0x0a8f('0x6')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x0a8f('0x7'),'ALLOWED',_0x0a8f('0x8'),_0x0a8f('0x9'),_0x0a8f('0xa'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x0a8f('0x1')]},'secret':{'type':Sequelize[_0x0a8f('0x1')]},'md5secret':{'type':Sequelize[_0x0a8f('0x1')]},'remotesecret':{'type':Sequelize[_0x0a8f('0x1')]},'transport':{'type':Sequelize[_0x0a8f('0x1')],'defaultValue':_0x0a8f('0xb'),'set':function(_0x4f4dab){this[_0x0a8f('0xc')](_0x0a8f('0xd'),_0x4f4dab?_0x4f4dab[_0x0a8f('0xe')](','):null);},'get':function(){return this[_0x0a8f('0xf')](_0x0a8f('0xd'))?this['getDataValue'](_0x0a8f('0xd'))[_0x0a8f('0x10')](','):null;},'comment':_0x0a8f('0x11')},'dtmfmode':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x12'),'info',_0x0a8f('0x13'),_0x0a8f('0x14'),_0x0a8f('0x15')),'defaultValue':_0x0a8f('0x12')},'directmedia':{'type':Sequelize[_0x0a8f('0x6')]('yes','no',_0x0a8f('0x16'),_0x0a8f('0x17'),_0x0a8f('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x0a8f('0x1')],'defaultValue':_0x0a8f('0x1a'),'set':function(_0x1f16b6){this['setDataValue'](_0x0a8f('0x1b'),_0x1f16b6?_0x1f16b6['join'](','):null);},'get':function(){return this[_0x0a8f('0xf')](_0x0a8f('0x1b'))?this[_0x0a8f('0xf')](_0x0a8f('0x1b'))[_0x0a8f('0x10')](','):null;},'comment':_0x0a8f('0x1c')},'callgroup':{'type':Sequelize[_0x0a8f('0x1')]},'namedcallgroup':{'type':Sequelize[_0x0a8f('0x1')]},'pickupgroup':{'type':Sequelize[_0x0a8f('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x0a8f('0x1')]},'language':{'type':Sequelize[_0x0a8f('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a8f('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x0a8f('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x0a8f('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x27d2c2){this[_0x0a8f('0xc')](_0x0a8f('0x1d'),_0x27d2c2?_0x27d2c2[_0x0a8f('0xe')](';'):_0x0a8f('0x1e'));},'get':function(){return this[_0x0a8f('0xf')](_0x0a8f('0x1d'))?this[_0x0a8f('0xf')]('allow')[_0x0a8f('0x10')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x2f22d5){this['setDataValue'](_0x0a8f('0x1f'),_0x2f22d5?_0x2f22d5[_0x0a8f('0xe')](','):null);},'get':function(){return this[_0x0a8f('0xf')]('insecure')?this[_0x0a8f('0xf')]('insecure')[_0x0a8f('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no',_0x0a8f('0x20'))},'promiscredir':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no')},'accountcode':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0a8f('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x0a8f('0x1')]},'callcounter':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no'),'defaultValue':_0x0a8f('0x19')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x0a8f('0x6')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x0a8f('0x1')]},'videosupport':{'type':Sequelize[_0x0a8f('0x6')]('yes','no',_0x0a8f('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no')},'mailbox':{'type':Sequelize[_0x0a8f('0x1')]},'session_timers':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x23'),_0x0a8f('0x24'),_0x0a8f('0x25'))},'session_expires':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'session_minse':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x26'),_0x0a8f('0x27')),'defaultValue':_0x0a8f('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x0a8f('0x1')]},'regexten':{'type':Sequelize[_0x0a8f('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x0a8f('0x1')]},'port':{'type':Sequelize[_0x0a8f('0x21')](0x5)},'qualify':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no'),'defaultValue':_0x0a8f('0x19')},'keepalive':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no',_0x0a8f('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a8f('0x1')]},'callbackextension':{'type':Sequelize[_0x0a8f('0x1')]},'timert1':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'contactpermit':{'type':Sequelize[_0x0a8f('0x1')]},'contactdeny':{'type':Sequelize[_0x0a8f('0x1')]},'contactacl':{'type':Sequelize[_0x0a8f('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x0a8f('0x1')]},'maxforwards':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x0a8f('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x0a8f('0x19'),'no')},'icesupport':{'type':Sequelize[_0x0a8f('0x6')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x0a8f('0x6')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x0a8f('0x6')]('yes','no',_0x0a8f('0x29'),_0x0a8f('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0x0a8f('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x0a8f('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x0a8f('0x1')]},'dtlscapath':{'type':Sequelize[_0x0a8f('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x0a8f('0x2b'),'passive',_0x0a8f('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a8f('0x1')]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a8f('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x0a8f('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x0a8f('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x0a8f('0x6')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x0a8f('0x19'),'no')},'vmexten':{'type':Sequelize[_0x0a8f('0x1')]},'mohinterpret':{'type':Sequelize[_0x0a8f('0x1')]},'mohsuggest':{'type':Sequelize[_0x0a8f('0x1')]},'parkinglot':{'type':Sequelize[_0x0a8f('0x1')]},'description':{'type':Sequelize[_0x0a8f('0x1')]},'host':{'type':Sequelize[_0x0a8f('0x1')],'defaultValue':_0x0a8f('0x2d')},'canreinvite':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no',_0x0a8f('0x16'),_0x0a8f('0x17'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x0a8f('0x1')]},'otherFields':{'type':Sequelize[_0x0a8f('0x1')]},'active':{'type':Sequelize[_0x0a8f('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x0a8f('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 79cb748..9766085 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 _0x7d25=['include','findAll','rows','params','find','omit','body','createdAt','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/trunk.ejs','utf8','join','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','then','info','Trunk,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','Trunk','includeAll'];(function(_0xfc4eea,_0x137e6d){var _0x1295e5=function(_0x32d486){while(--_0x32d486){_0xfc4eea['push'](_0xfc4eea['shift']());}};_0x1295e5(++_0x137e6d);}(_0x7d25,0x8a));var _0x57d2=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x7d25[_0x45783c];return _0x1161da;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x57d2('0x0'));var rimraf=require(_0x57d2('0x1'));var zipdir=require(_0x57d2('0x2'));var jsonpatch=require(_0x57d2('0x3'));var rp=require(_0x57d2('0x4'));var moment=require(_0x57d2('0x5'));var BPromise=require(_0x57d2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x57d2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x57d2('0x8'));var squel=require(_0x57d2('0x9'));var crypto=require(_0x57d2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57d2('0x7'));var querystring=require('querystring');var Papa=require(_0x57d2('0xb'));var Redis=require(_0x57d2('0xc'));var authService=require(_0x57d2('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x57d2('0xe'));var hardwareService=require(_0x57d2('0xf'));var logger=require(_0x57d2('0x10'))(_0x57d2('0x11'));var utils=require(_0x57d2('0x12'));var config=require(_0x57d2('0x13'));var db=require(_0x57d2('0x14'))['db'];var jayson=require(_0x57d2('0x15'));var client=jayson[_0x57d2('0x16')][_0x57d2('0x17')]({'port':0x232a});function checkPasswordPattern(_0x28428b,_0x3181ad,_0x6940ef){if(_0x6940ef){var _0x229734=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x229734[_0x57d2('0x18')](_0x3181ad)){return _0x28428b;}else{throw new db[(_0x57d2('0x19'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x28428b;}}function respondWithRpcPromise(_0x6fad35,_0x148ef3,_0x4ec4b1,_0x8cf637){return new BPromise(function(_0x319489,_0x4bb8f7){var _0x3e12c6=_0x8cf637||client;return _0x3e12c6['request'](_0x6fad35,_0x4ec4b1)[_0x57d2('0x1a')](function(_0x4b4fe0){logger[_0x57d2('0x1b')](_0x57d2('0x1c'),_0x148ef3,_0x57d2('0x1d'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x148ef3,_0x57d2('0x1d'),JSON[_0x57d2('0x1e')](_0x4b4fe0));if(_0x4b4fe0[_0x57d2('0x1f')]){if(_0x4b4fe0[_0x57d2('0x1f')]['code']===0x1f4){logger[_0x57d2('0x1f')](_0x57d2('0x1c'),_0x148ef3,_0x4b4fe0['error']['message']);return _0x4bb8f7(_0x4b4fe0[_0x57d2('0x1f')][_0x57d2('0x20')]);}logger[_0x57d2('0x1f')](_0x57d2('0x1c'),_0x148ef3,_0x4b4fe0[_0x57d2('0x1f')][_0x57d2('0x20')]);return _0x319489(_0x4b4fe0[_0x57d2('0x1f')][_0x57d2('0x20')]);}else{logger[_0x57d2('0x1b')](_0x57d2('0x1c'),_0x148ef3,_0x57d2('0x1d'));_0x319489(_0x4b4fe0[_0x57d2('0x21')][_0x57d2('0x20')]);}})[_0x57d2('0x22')](function(_0x5327ea){logger[_0x57d2('0x1f')](_0x57d2('0x1c'),_0x148ef3,_0x5327ea);_0x4bb8f7(_0x5327ea);});});}function respondWithStatusCode(_0x3c7de8,_0x452d5e){_0x452d5e=_0x452d5e||0xcc;return function(_0x4363b3){if(_0x4363b3){return _0x3c7de8['sendStatus'](_0x452d5e);}return _0x3c7de8[_0x57d2('0x23')](_0x452d5e)[_0x57d2('0x24')]();};}function respondWithResult(_0x995928,_0x16ee2f){_0x16ee2f=_0x16ee2f||0xc8;return function(_0x18d500){if(_0x18d500){return _0x995928[_0x57d2('0x23')](_0x16ee2f)[_0x57d2('0x25')](_0x18d500);}};}function respondWithFilteredResult(_0x4fdfbc,_0x1ae5ff){return function(_0x15f1ba){if(_0x15f1ba){var _0x277426=_0x15f1ba[_0x57d2('0x26')],_0x1fe383=_0x1ae5ff[_0x57d2('0x27')],_0x1957a6=_0x1ae5ff[_0x57d2('0x27')]+_0x1ae5ff[_0x57d2('0x28')],_0x7c33f3;if(_0x1957a6>=_0x277426){_0x1957a6=_0x277426;_0x7c33f3=0xc8;}else{_0x7c33f3=0xce;}_0x4fdfbc['status'](_0x7c33f3);return _0x4fdfbc[_0x57d2('0x29')](_0x57d2('0x2a'),_0x1fe383+'-'+_0x1957a6+'/'+_0x277426)[_0x57d2('0x25')](_0x15f1ba);}return null;};}function patchUpdates(_0x3e017c){return function(_0x484597){try{jsonpatch[_0x57d2('0x2b')](_0x484597,_0x3e017c,!![]);}catch(_0x1fa0aa){return BPromise[_0x57d2('0x2c')](_0x1fa0aa);}return _0x484597[_0x57d2('0x2d')]();};}function saveUpdates(_0xb3051c,_0x40f3f2){return function(_0x3cbc4b){if(_0x3cbc4b){return _0x3cbc4b[_0x57d2('0x2e')](_0xb3051c)[_0x57d2('0x1a')](function(_0x581cf7){return _0x581cf7;});}return null;};}function removeEntity(_0xee0c82,_0x213c99){return function(_0x4f5923){if(_0x4f5923){return _0x4f5923[_0x57d2('0x2f')]()[_0x57d2('0x1a')](function(){var _0x47dbfa=_0x4f5923[_0x57d2('0x30')]({'plain':!![]});var _0x1c4ea5=_0x57d2('0x31');return db[_0x57d2('0x32')][_0x57d2('0x2f')]({'where':{'type':_0x1c4ea5,'resourceId':_0x47dbfa['id']}})['then'](function(){return _0x4f5923;});})['then'](function(){_0xee0c82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x371939,_0x39f54b){return function(_0x39f3b9){if(!_0x39f3b9){_0x371939[_0x57d2('0x33')](0x194);}return _0x39f3b9;};}function handleError(_0x13beac,_0x565ca6){_0x565ca6=_0x565ca6||0x1f4;return function(_0x375a83){logger['error'](_0x375a83[_0x57d2('0x34')]);if(_0x375a83[_0x57d2('0x35')]){delete _0x375a83[_0x57d2('0x35')];}_0x13beac['status'](_0x565ca6)[_0x57d2('0x36')](_0x375a83);};}exports[_0x57d2('0x37')]=function(_0x5d49e9,_0xb33455){var _0x28c52d={},_0x69a1bc={},_0x3a713d={'count':0x0,'rows':[]};var _0x3153fd=_[_0x57d2('0x38')](db['Trunk'][_0x57d2('0x39')],function(_0x53c2e0){return{'name':_0x53c2e0[_0x57d2('0x3a')],'type':_0x53c2e0[_0x57d2('0x3b')][_0x57d2('0x3c')]};});_0x69a1bc[_0x57d2('0x3d')]=_[_0x57d2('0x38')](_0x3153fd,'name');_0x69a1bc[_0x57d2('0x3e')]=_[_0x57d2('0x3f')](_0x5d49e9['query']);_0x69a1bc[_0x57d2('0x40')]=_[_0x57d2('0x41')](_0x69a1bc[_0x57d2('0x3d')],_0x69a1bc['query']);_0x28c52d[_0x57d2('0x42')]=_[_0x57d2('0x41')](_0x69a1bc[_0x57d2('0x3d')],qs[_0x57d2('0x43')](_0x5d49e9['query']['fields']));_0x28c52d[_0x57d2('0x42')]=_0x28c52d[_0x57d2('0x42')][_0x57d2('0x44')]?_0x28c52d['attributes']:_0x69a1bc['model'];if(!_0x5d49e9[_0x57d2('0x3e')]['hasOwnProperty'](_0x57d2('0x45'))){_0x28c52d[_0x57d2('0x28')]=qs[_0x57d2('0x28')](_0x5d49e9[_0x57d2('0x3e')][_0x57d2('0x28')]);_0x28c52d['offset']=qs[_0x57d2('0x27')](_0x5d49e9[_0x57d2('0x3e')]['offset']);}_0x28c52d[_0x57d2('0x46')]=qs['sort'](_0x5d49e9[_0x57d2('0x3e')][_0x57d2('0x47')]);_0x28c52d[_0x57d2('0x48')]=qs[_0x57d2('0x40')](_['pick'](_0x5d49e9['query'],_0x69a1bc[_0x57d2('0x40')]),_0x3153fd);if(_0x5d49e9['query']['filter']){_0x28c52d[_0x57d2('0x48')]=_['merge'](_0x28c52d['where'],{'$or':_[_0x57d2('0x38')](_0x3153fd,function(_0x5180c3){if(_0x5180c3[_0x57d2('0x3b')]!=='VIRTUAL'){var _0x2bf106={};_0x2bf106[_0x5180c3['name']]={'$like':'%'+_0x5d49e9['query'][_0x57d2('0x49')]+'%'};return _0x2bf106;}})});}_0x28c52d=_[_0x57d2('0x4a')]({},_0x28c52d,_0x5d49e9[_0x57d2('0x4b')]);var _0x28566d={'where':_0x28c52d[_0x57d2('0x48')]};return db[_0x57d2('0x4c')]['count'](_0x28566d)[_0x57d2('0x1a')](function(_0xf91b05){_0x3a713d[_0x57d2('0x26')]=_0xf91b05;if(_0x5d49e9[_0x57d2('0x3e')][_0x57d2('0x4d')]){_0x28c52d[_0x57d2('0x4e')]=[{'all':!![]}];}return db[_0x57d2('0x4c')][_0x57d2('0x4f')](_0x28c52d);})['then'](function(_0x9f6f34){_0x3a713d[_0x57d2('0x50')]=_0x9f6f34;return _0x3a713d;})['then'](respondWithFilteredResult(_0xb33455,_0x28c52d))[_0x57d2('0x22')](handleError(_0xb33455,null));};exports['show']=function(_0x59a6eb,_0x1a1dc7){var _0x31f404={'raw':![],'where':{'id':_0x59a6eb[_0x57d2('0x51')]['id']}},_0x17f479={};_0x17f479['model']=_[_0x57d2('0x3f')](db[_0x57d2('0x4c')]['rawAttributes']);_0x17f479['query']=_[_0x57d2('0x3f')](_0x59a6eb[_0x57d2('0x3e')]);_0x17f479[_0x57d2('0x40')]=_[_0x57d2('0x41')](_0x17f479[_0x57d2('0x3d')],_0x17f479[_0x57d2('0x3e')]);_0x31f404['attributes']=_['intersection'](_0x17f479['model'],qs[_0x57d2('0x43')](_0x59a6eb['query'][_0x57d2('0x43')]));_0x31f404[_0x57d2('0x42')]=_0x31f404['attributes'][_0x57d2('0x44')]?_0x31f404[_0x57d2('0x42')]:_0x17f479[_0x57d2('0x3d')];if(_0x59a6eb['query'][_0x57d2('0x4d')]){_0x31f404[_0x57d2('0x4e')]=[{'all':!![]}];}_0x31f404=_[_0x57d2('0x4a')]({},_0x31f404,_0x59a6eb[_0x57d2('0x4b')]);return db[_0x57d2('0x4c')][_0x57d2('0x52')](_0x31f404)[_0x57d2('0x1a')](handleEntityNotFound(_0x1a1dc7,null))[_0x57d2('0x1a')](respondWithResult(_0x1a1dc7,null))[_0x57d2('0x22')](handleError(_0x1a1dc7,null));};exports['clone']=function(_0x67d499,_0x3ad348){var _0x28109b={'where':{'id':_0x67d499[_0x57d2('0x51')]['id']}},_0x5e3289={};_0x5e3289[_0x57d2('0x3d')]=_[_0x57d2('0x3f')](db['Trunk']['rawAttributes']);_0x28109b['attributes']=_[_0x57d2('0x41')](_0x5e3289['model'],qs[_0x57d2('0x43')](_0x67d499['query'][_0x57d2('0x43')]));_0x28109b['attributes']=_0x28109b[_0x57d2('0x42')][_0x57d2('0x44')]?_0x28109b[_0x57d2('0x42')]:_0x5e3289['model'];if(_0x67d499['query'][_0x57d2('0x4d')]){_0x28109b[_0x57d2('0x4e')]=[{'all':!![]}];}_0x28109b=_[_0x57d2('0x4a')]({},_0x28109b,_0x67d499[_0x57d2('0x4b')]);return db[_0x57d2('0x4c')][_0x57d2('0x52')](_0x28109b)['then'](handleEntityNotFound(_0x3ad348,null))['then'](function(_0x2040c0){if(_0x2040c0){var _0x6951d8=_0x2040c0[_0x57d2('0x30')]({'plain':!![]});_0x6951d8=qs[_0x57d2('0x53')](_0x6951d8,['id','createdAt','updatedAt']);_0x67d499[_0x57d2('0x54')]=_[_0x57d2('0x53')](_0x67d499['body'],['id',_0x57d2('0x55'),_0x57d2('0x56')]);return db[_0x57d2('0x4c')][_0x57d2('0x57')](_['merge'](_0x6951d8,_0x67d499['body']),{'include':_0x67d499['query']['includeAll']?[{'all':!![]}]:undefined})[_0x57d2('0x1a')](function(_0x15a15d){var _0x343890=_0x67d499[_0x57d2('0x58')][_0x57d2('0x30')]({'plain':!![]});if(!_0x343890)throw new Error(_0x57d2('0x59'));if(_0x343890[_0x57d2('0x5a')]==='user'){var _0x35808a=_0x15a15d['get']({'plain':!![]});var _0xca2707='Trunks';return db[_0x57d2('0x5b')][_0x57d2('0x52')]({'where':{'name':_0xca2707,'userProfileId':_0x343890[_0x57d2('0x5c')]},'raw':!![]})[_0x57d2('0x1a')](function(_0xcbe523){if(_0xcbe523&&_0xcbe523[_0x57d2('0x5d')]===0x0){return db['UserProfileResource'][_0x57d2('0x57')]({'name':_0x35808a[_0x57d2('0x35')],'resourceId':_0x35808a['id'],'type':_0xcbe523[_0x57d2('0x35')],'sectionId':_0xcbe523['id']},{})[_0x57d2('0x1a')](function(){return _0x15a15d;});}else{return _0x15a15d;}})[_0x57d2('0x22')](function(_0x2af67e){logger[_0x57d2('0x1f')](_0x57d2('0x5e'),_0x2af67e);throw _0x2af67e;});}return _0x15a15d;});}})[_0x57d2('0x1a')](respondWithResult(_0x3ad348,0xc9))['catch'](handleError(_0x3ad348,null));};exports[_0x57d2('0x57')]=function(_0x4bddff,_0x5b73e7,_0x4b41a2){var _0x270de8;return db['Trunk'][_0x57d2('0x57')](_0x4bddff[_0x57d2('0x54')],{'raw':!![]})['then'](function(_0x2792b0){_0x270de8=_0x2792b0;return db[_0x57d2('0x4c')][_0x57d2('0x4f')]({'raw':!![]});})[_0x57d2('0x1a')](function(_0x5eb7a3){var _0x3afeb9=fs[_0x57d2('0x5f')](path['join'](config['root'],_0x57d2('0x60')),_0x57d2('0x61'));var _0x481c6b=fs[_0x57d2('0x5f')](path[_0x57d2('0x62')](config[_0x57d2('0x63')],_0x57d2('0x64')),_0x57d2('0x61'));var _0x3899b8=ejs[_0x57d2('0x65')](_0x3afeb9,{'trunks':_0x5eb7a3||[]});fs[_0x57d2('0x66')](_0x57d2('0x67'),_0x3899b8);if(_0x270de8[_0x57d2('0x68')]){var _0x22f977=ejs[_0x57d2('0x65')](_0x481c6b,{'trunks':_0x5eb7a3||[]});fs[_0x57d2('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x22f977);}})[_0x57d2('0x1a')](function(){return respondWithRpcPromise(_0x57d2('0x69'),_0x57d2('0x57'),{'module':_0x57d2('0x6a')});})[_0x57d2('0x1a')](function(){var _0x2583d4=_0x4bddff[_0x57d2('0x58')][_0x57d2('0x30')]({'plain':!![]});if(!_0x2583d4)throw new Error(_0x57d2('0x59'));if(_0x2583d4[_0x57d2('0x5a')]===_0x57d2('0x58')){var _0x2f9a7e=_0x270de8[_0x57d2('0x30')]({'plain':!![]});return db[_0x57d2('0x5b')][_0x57d2('0x52')]({'where':{'name':_0x57d2('0x31'),'userProfileId':_0x2583d4['userProfileId']},'raw':!![]})[_0x57d2('0x1a')](function(_0x37d464){if(_0x37d464&&_0x37d464['autoAssociation']===0x0){return db[_0x57d2('0x32')][_0x57d2('0x57')]({'name':_0x2f9a7e[_0x57d2('0x35')],'resourceId':_0x2f9a7e['id'],'type':_0x37d464[_0x57d2('0x35')],'sectionId':_0x37d464['id']},{})['then'](function(){return _0x270de8;});}else{return _0x270de8;}})[_0x57d2('0x22')](function(_0x5f0870){logger['error'](_0x57d2('0x5e'),_0x5f0870);throw _0x5f0870;});}return _0x270de8;})['then'](respondWithResult(_0x5b73e7,0xc9))[_0x57d2('0x22')](handleError(_0x5b73e7,null));};exports[_0x57d2('0x2e')]=function(_0x199995,_0x31fa1b,_0x4ea1b4){var _0xd0191b;return db[_0x57d2('0x4c')][_0x57d2('0x52')]({'where':{'id':_0x199995[_0x57d2('0x51')]['id']}})[_0x57d2('0x1a')](handleEntityNotFound(_0x31fa1b,null))[_0x57d2('0x1a')](saveUpdates(_0x199995[_0x57d2('0x54')],null))[_0x57d2('0x1a')](function(_0x1d147f){if(_0x1d147f){_0xd0191b=_0x1d147f;return db[_0x57d2('0x4c')]['findAll']({'raw':!![]});}})[_0x57d2('0x1a')](function(_0x28596b){if(_0x28596b){var _0x1bf81c=fs[_0x57d2('0x5f')](path[_0x57d2('0x62')](config[_0x57d2('0x63')],_0x57d2('0x60')),_0x57d2('0x61'));var _0xf0bdb=fs[_0x57d2('0x5f')](path[_0x57d2('0x62')](config[_0x57d2('0x63')],'server/files/templates/registry.ejs'),'utf8');var _0x3e101b=ejs[_0x57d2('0x65')](_0x1bf81c,{'trunks':_0x28596b||[]});fs[_0x57d2('0x66')](_0x57d2('0x67'),_0x3e101b);var _0xe60b2e=ejs['render'](_0xf0bdb,{'trunks':_0x28596b||[]});fs['writeFileSync'](_0x57d2('0x6b'),_0xe60b2e);return respondWithRpcPromise(_0x57d2('0x69'),_0x57d2('0x2e'),{'module':_0x57d2('0x6a')});}return null;})[_0x57d2('0x1a')](function(_0x41376b){if(_0x41376b){return _0xd0191b;}})['then'](respondWithResult(_0x31fa1b,null))[_0x57d2('0x22')](handleError(_0x31fa1b,null));};exports[_0x57d2('0x2f')]=function(_0x5bb7cd,_0x4913c0,_0x5ac6ee){var _0x5b3cc6;return db[_0x57d2('0x4c')]['find']({'where':{'id':_0x5bb7cd[_0x57d2('0x51')]['id']}})['then'](handleEntityNotFound(_0x4913c0,null))[_0x57d2('0x1a')](removeEntity(_0x4913c0,null))[_0x57d2('0x1a')](function(){return db[_0x57d2('0x4c')][_0x57d2('0x4f')]({'raw':!![]});})[_0x57d2('0x1a')](function(_0x57da59){var _0x3f8ab4=fs[_0x57d2('0x5f')](path[_0x57d2('0x62')](config['root'],_0x57d2('0x60')),_0x57d2('0x61'));var _0x7d257c=fs[_0x57d2('0x5f')](path[_0x57d2('0x62')](config[_0x57d2('0x63')],_0x57d2('0x64')),'utf8');var _0x53c2c1=ejs['render'](_0x3f8ab4,{'trunks':_0x57da59});var _0x1a52ec=ejs[_0x57d2('0x65')](_0x7d257c,{'trunks':_0x57da59});fs[_0x57d2('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x53c2c1);fs[_0x57d2('0x66')](_0x57d2('0x6b'),_0x1a52ec);return respondWithRpcPromise(_0x57d2('0x69'),_0x57d2('0x2f'),{'module':_0x57d2('0x6a')});})[_0x57d2('0x22')](handleError(_0x4913c0,null));}; \ No newline at end of file +var _0x915a=['rows','catch','show','params','clone','find','get','omit','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x915a,0x1d2));var _0xa915=function(_0x262911,_0x1aa085){_0x262911=_0x262911-0x0;var _0x1879b3=_0x915a[_0x262911];return _0x1879b3;};'use strict';var pdf=require(_0xa915('0x0'));var emlformat=require(_0xa915('0x1'));var rimraf=require(_0xa915('0x2'));var zipdir=require(_0xa915('0x3'));var jsonpatch=require(_0xa915('0x4'));var rp=require('request-promise');var moment=require(_0xa915('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa915('0x6'));var path=require(_0xa915('0x7'));var sox=require(_0xa915('0x8'));var csv=require(_0xa915('0x9'));var ejs=require(_0xa915('0xa'));var fs=require('fs');var _=require(_0xa915('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa915('0xc'));var deskjs=require(_0xa915('0xd'));var toCsv=require(_0xa915('0x9'));var querystring=require(_0xa915('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa915('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa915('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa915('0x11'))(_0xa915('0x12'));var utils=require(_0xa915('0x13'));var config=require(_0xa915('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xa915('0x15')]['http']({'port':0x232a});function checkPasswordPattern(_0x274f4d,_0x563972,_0xb897e2){if(_0xb897e2){var _0x3aae6f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3aae6f[_0xa915('0x16')](_0x563972)){return _0x274f4d;}else{throw new db[(_0xa915('0x17'))][(_0xa915('0x18'))](_0xa915('0x19'));}}else{return _0x274f4d;}}function respondWithRpcPromise(_0x4c3f35,_0x23ecd8,_0x19889d,_0xf9f02c){return new BPromise(function(_0x590be6,_0x3284b8){var _0xf8046b=_0xf9f02c||client;return _0xf8046b[_0xa915('0x1a')](_0x4c3f35,_0x19889d)[_0xa915('0x1b')](function(_0x3f5aff){logger[_0xa915('0x1c')](_0xa915('0x1d'),_0x23ecd8,_0xa915('0x1e'));logger[_0xa915('0x1f')](_0xa915('0x20'),_0x23ecd8,_0xa915('0x1e'),JSON['stringify'](_0x3f5aff));if(_0x3f5aff[_0xa915('0x21')]){if(_0x3f5aff['error'][_0xa915('0x22')]===0x1f4){logger[_0xa915('0x21')](_0xa915('0x1d'),_0x23ecd8,_0x3f5aff[_0xa915('0x21')][_0xa915('0x23')]);return _0x3284b8(_0x3f5aff['error'][_0xa915('0x23')]);}logger[_0xa915('0x21')](_0xa915('0x1d'),_0x23ecd8,_0x3f5aff[_0xa915('0x21')][_0xa915('0x23')]);return _0x590be6(_0x3f5aff[_0xa915('0x21')]['message']);}else{logger[_0xa915('0x1c')](_0xa915('0x1d'),_0x23ecd8,_0xa915('0x1e'));_0x590be6(_0x3f5aff[_0xa915('0x24')]['message']);}})['catch'](function(_0x34a8c6){logger['error'](_0xa915('0x1d'),_0x23ecd8,_0x34a8c6);_0x3284b8(_0x34a8c6);});});}function respondWithStatusCode(_0x3b8cbb,_0x3898cc){_0x3898cc=_0x3898cc||0xcc;return function(_0x462b94){if(_0x462b94){return _0x3b8cbb[_0xa915('0x25')](_0x3898cc);}return _0x3b8cbb[_0xa915('0x26')](_0x3898cc)[_0xa915('0x27')]();};}function respondWithResult(_0x525f55,_0x152d6e){_0x152d6e=_0x152d6e||0xc8;return function(_0x1bb9e4){if(_0x1bb9e4){return _0x525f55['status'](_0x152d6e)[_0xa915('0x28')](_0x1bb9e4);}};}function respondWithFilteredResult(_0x1645d5,_0x3d7251){return function(_0x30bfe2){if(_0x30bfe2){var _0x5a62c0=_0x30bfe2[_0xa915('0x29')],_0x3cca8e=_0x3d7251[_0xa915('0x2a')],_0x427742=_0x3d7251[_0xa915('0x2a')]+_0x3d7251[_0xa915('0x2b')],_0x486ca1;if(_0x427742>=_0x5a62c0){_0x427742=_0x5a62c0;_0x486ca1=0xc8;}else{_0x486ca1=0xce;}_0x1645d5[_0xa915('0x26')](_0x486ca1);return _0x1645d5[_0xa915('0x2c')]('Content-Range',_0x3cca8e+'-'+_0x427742+'/'+_0x5a62c0)[_0xa915('0x28')](_0x30bfe2);}return null;};}function patchUpdates(_0x319238){return function(_0x119d36){try{jsonpatch['apply'](_0x119d36,_0x319238,!![]);}catch(_0x29de2a){return BPromise[_0xa915('0x2d')](_0x29de2a);}return _0x119d36[_0xa915('0x2e')]();};}function saveUpdates(_0x4a367d,_0x3e20c8){return function(_0x39482f){if(_0x39482f){return _0x39482f[_0xa915('0x2f')](_0x4a367d)[_0xa915('0x1b')](function(_0x4e8968){return _0x4e8968;});}return null;};}function removeEntity(_0x4de4c9,_0x2cf0f0){return function(_0x3dc789){if(_0x3dc789){return _0x3dc789[_0xa915('0x30')]()['then'](function(){var _0xe82283=_0x3dc789['get']({'plain':!![]});var _0x680b13=_0xa915('0x31');return db[_0xa915('0x32')][_0xa915('0x30')]({'where':{'type':_0x680b13,'resourceId':_0xe82283['id']}})[_0xa915('0x1b')](function(){return _0x3dc789;});})[_0xa915('0x1b')](function(){_0x4de4c9[_0xa915('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x252643,_0x3ab97d){return function(_0x42a0f7){if(!_0x42a0f7){_0x252643[_0xa915('0x25')](0x194);}return _0x42a0f7;};}function handleError(_0x67cec1,_0x3bc4d0){_0x3bc4d0=_0x3bc4d0||0x1f4;return function(_0x489945){logger[_0xa915('0x21')](_0x489945[_0xa915('0x33')]);if(_0x489945[_0xa915('0x34')]){delete _0x489945[_0xa915('0x34')];}_0x67cec1[_0xa915('0x26')](_0x3bc4d0)[_0xa915('0x35')](_0x489945);};}exports[_0xa915('0x36')]=function(_0x57f120,_0x5d9d18){var _0x50ff83={},_0x4a74c3={},_0x277686={'count':0x0,'rows':[]};var _0x23d976=_[_0xa915('0x37')](db[_0xa915('0x38')][_0xa915('0x39')],function(_0x3985e7){return{'name':_0x3985e7[_0xa915('0x3a')],'type':_0x3985e7[_0xa915('0x3b')][_0xa915('0x3c')]};});_0x4a74c3[_0xa915('0x3d')]=_[_0xa915('0x37')](_0x23d976,_0xa915('0x34'));_0x4a74c3[_0xa915('0x3e')]=_[_0xa915('0x3f')](_0x57f120['query']);_0x4a74c3[_0xa915('0x40')]=_[_0xa915('0x41')](_0x4a74c3[_0xa915('0x3d')],_0x4a74c3[_0xa915('0x3e')]);_0x50ff83[_0xa915('0x42')]=_['intersection'](_0x4a74c3[_0xa915('0x3d')],qs[_0xa915('0x43')](_0x57f120[_0xa915('0x3e')][_0xa915('0x43')]));_0x50ff83['attributes']=_0x50ff83[_0xa915('0x42')][_0xa915('0x44')]?_0x50ff83[_0xa915('0x42')]:_0x4a74c3[_0xa915('0x3d')];if(!_0x57f120[_0xa915('0x3e')][_0xa915('0x45')](_0xa915('0x46'))){_0x50ff83[_0xa915('0x2b')]=qs['limit'](_0x57f120[_0xa915('0x3e')][_0xa915('0x2b')]);_0x50ff83[_0xa915('0x2a')]=qs[_0xa915('0x2a')](_0x57f120['query'][_0xa915('0x2a')]);}_0x50ff83['order']=qs[_0xa915('0x47')](_0x57f120[_0xa915('0x3e')]['sort']);_0x50ff83[_0xa915('0x48')]=qs['filters'](_['pick'](_0x57f120[_0xa915('0x3e')],_0x4a74c3[_0xa915('0x40')]),_0x23d976);if(_0x57f120[_0xa915('0x3e')][_0xa915('0x49')]){_0x50ff83[_0xa915('0x48')]=_[_0xa915('0x4a')](_0x50ff83['where'],{'$or':_[_0xa915('0x37')](_0x23d976,function(_0x6cc2c5){if(_0x6cc2c5[_0xa915('0x3b')]!==_0xa915('0x4b')){var _0x3739c7={};_0x3739c7[_0x6cc2c5[_0xa915('0x34')]]={'$like':'%'+_0x57f120[_0xa915('0x3e')][_0xa915('0x49')]+'%'};return _0x3739c7;}})});}_0x50ff83=_['merge']({},_0x50ff83,_0x57f120['options']);var _0x1a0545={'where':_0x50ff83[_0xa915('0x48')]};return db[_0xa915('0x38')][_0xa915('0x29')](_0x1a0545)[_0xa915('0x1b')](function(_0x22b82d){_0x277686['count']=_0x22b82d;if(_0x57f120[_0xa915('0x3e')][_0xa915('0x4c')]){_0x50ff83[_0xa915('0x4d')]=[{'all':!![]}];}return db[_0xa915('0x38')][_0xa915('0x4e')](_0x50ff83);})[_0xa915('0x1b')](function(_0x40a57e){_0x277686[_0xa915('0x4f')]=_0x40a57e;return _0x277686;})['then'](respondWithFilteredResult(_0x5d9d18,_0x50ff83))[_0xa915('0x50')](handleError(_0x5d9d18,null));};exports[_0xa915('0x51')]=function(_0x4744ef,_0x1c2230){var _0x2ac04b={'raw':![],'where':{'id':_0x4744ef[_0xa915('0x52')]['id']}},_0x3f485={};_0x3f485[_0xa915('0x3d')]=_[_0xa915('0x3f')](db[_0xa915('0x38')]['rawAttributes']);_0x3f485['query']=_['keys'](_0x4744ef[_0xa915('0x3e')]);_0x3f485[_0xa915('0x40')]=_[_0xa915('0x41')](_0x3f485[_0xa915('0x3d')],_0x3f485['query']);_0x2ac04b[_0xa915('0x42')]=_[_0xa915('0x41')](_0x3f485[_0xa915('0x3d')],qs[_0xa915('0x43')](_0x4744ef[_0xa915('0x3e')][_0xa915('0x43')]));_0x2ac04b[_0xa915('0x42')]=_0x2ac04b['attributes'][_0xa915('0x44')]?_0x2ac04b[_0xa915('0x42')]:_0x3f485[_0xa915('0x3d')];if(_0x4744ef[_0xa915('0x3e')][_0xa915('0x4c')]){_0x2ac04b['include']=[{'all':!![]}];}_0x2ac04b=_[_0xa915('0x4a')]({},_0x2ac04b,_0x4744ef['options']);return db['Trunk']['find'](_0x2ac04b)[_0xa915('0x1b')](handleEntityNotFound(_0x1c2230,null))[_0xa915('0x1b')](respondWithResult(_0x1c2230,null))[_0xa915('0x50')](handleError(_0x1c2230,null));};exports[_0xa915('0x53')]=function(_0x5b83c5,_0x9fff41){var _0x107af9={'where':{'id':_0x5b83c5[_0xa915('0x52')]['id']}},_0x19259b={};_0x19259b[_0xa915('0x3d')]=_[_0xa915('0x3f')](db[_0xa915('0x38')][_0xa915('0x39')]);_0x107af9[_0xa915('0x42')]=_[_0xa915('0x41')](_0x19259b[_0xa915('0x3d')],qs['fields'](_0x5b83c5[_0xa915('0x3e')][_0xa915('0x43')]));_0x107af9[_0xa915('0x42')]=_0x107af9[_0xa915('0x42')][_0xa915('0x44')]?_0x107af9[_0xa915('0x42')]:_0x19259b[_0xa915('0x3d')];if(_0x5b83c5['query']['includeAll']){_0x107af9[_0xa915('0x4d')]=[{'all':!![]}];}_0x107af9=_[_0xa915('0x4a')]({},_0x107af9,_0x5b83c5['options']);return db[_0xa915('0x38')][_0xa915('0x54')](_0x107af9)['then'](handleEntityNotFound(_0x9fff41,null))[_0xa915('0x1b')](function(_0x228ff8){if(_0x228ff8){var _0x4a3e14=_0x228ff8[_0xa915('0x55')]({'plain':!![]});_0x4a3e14=qs[_0xa915('0x56')](_0x4a3e14,['id','createdAt',_0xa915('0x57')]);_0x5b83c5[_0xa915('0x58')]=_[_0xa915('0x56')](_0x5b83c5[_0xa915('0x58')],['id','createdAt','updatedAt']);return db[_0xa915('0x38')][_0xa915('0x59')](_[_0xa915('0x4a')](_0x4a3e14,_0x5b83c5[_0xa915('0x58')]),{'include':_0x5b83c5[_0xa915('0x3e')][_0xa915('0x4c')]?[{'all':!![]}]:undefined})[_0xa915('0x1b')](function(_0x361cb2){var _0x5c290e=_0x5b83c5[_0xa915('0x5a')][_0xa915('0x55')]({'plain':!![]});if(!_0x5c290e)throw new Error(_0xa915('0x5b'));if(_0x5c290e[_0xa915('0x5c')]===_0xa915('0x5a')){var _0x3f2b09=_0x361cb2[_0xa915('0x55')]({'plain':!![]});var _0x3c21a2=_0xa915('0x31');return db['UserProfileSection'][_0xa915('0x54')]({'where':{'name':_0x3c21a2,'userProfileId':_0x5c290e[_0xa915('0x5d')]},'raw':!![]})[_0xa915('0x1b')](function(_0x3cf7d6){if(_0x3cf7d6&&_0x3cf7d6['autoAssociation']===0x0){return db[_0xa915('0x32')][_0xa915('0x59')]({'name':_0x3f2b09[_0xa915('0x34')],'resourceId':_0x3f2b09['id'],'type':_0x3cf7d6[_0xa915('0x34')],'sectionId':_0x3cf7d6['id']},{})[_0xa915('0x1b')](function(){return _0x361cb2;});}else{return _0x361cb2;}})[_0xa915('0x50')](function(_0x4b1d34){logger[_0xa915('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b1d34);throw _0x4b1d34;});}return _0x361cb2;});}})[_0xa915('0x1b')](respondWithResult(_0x9fff41,0xc9))[_0xa915('0x50')](handleError(_0x9fff41,null));};exports[_0xa915('0x59')]=function(_0x3ddcfd,_0x525217,_0x2c50ec){var _0x601ecb;return db[_0xa915('0x38')]['create'](_0x3ddcfd[_0xa915('0x58')],{'raw':!![]})[_0xa915('0x1b')](function(_0x4b1102){_0x601ecb=_0x4b1102;return db[_0xa915('0x38')][_0xa915('0x4e')]({'raw':!![]});})[_0xa915('0x1b')](function(_0x1f8eb3){var _0x1e5eca=fs[_0xa915('0x5e')](path[_0xa915('0x5f')](config[_0xa915('0x60')],_0xa915('0x61')),'utf8');var _0x4fa2e6=fs[_0xa915('0x5e')](path['join'](config['root'],_0xa915('0x62')),_0xa915('0x63'));var _0x12de88=ejs[_0xa915('0x64')](_0x1e5eca,{'trunks':_0x1f8eb3||[]});fs[_0xa915('0x65')](_0xa915('0x66'),_0x12de88);if(_0x601ecb[_0xa915('0x67')]){var _0xbd2935=ejs[_0xa915('0x64')](_0x4fa2e6,{'trunks':_0x1f8eb3||[]});fs[_0xa915('0x65')](_0xa915('0x68'),_0xbd2935);}})['then'](function(){return respondWithRpcPromise(_0xa915('0x69'),_0xa915('0x59'),{'module':_0xa915('0x6a')});})['then'](function(){var _0x2d3ae8=_0x3ddcfd[_0xa915('0x5a')][_0xa915('0x55')]({'plain':!![]});if(!_0x2d3ae8)throw new Error(_0xa915('0x5b'));if(_0x2d3ae8[_0xa915('0x5c')]==='user'){var _0x342db9=_0x601ecb[_0xa915('0x55')]({'plain':!![]});return db['UserProfileSection'][_0xa915('0x54')]({'where':{'name':'Trunks','userProfileId':_0x2d3ae8[_0xa915('0x5d')]},'raw':!![]})[_0xa915('0x1b')](function(_0x461634){if(_0x461634&&_0x461634[_0xa915('0x6b')]===0x0){return db[_0xa915('0x32')][_0xa915('0x59')]({'name':_0x342db9[_0xa915('0x34')],'resourceId':_0x342db9['id'],'type':_0x461634[_0xa915('0x34')],'sectionId':_0x461634['id']},{})[_0xa915('0x1b')](function(){return _0x601ecb;});}else{return _0x601ecb;}})['catch'](function(_0x5dd438){logger[_0xa915('0x21')](_0xa915('0x6c'),_0x5dd438);throw _0x5dd438;});}return _0x601ecb;})[_0xa915('0x1b')](respondWithResult(_0x525217,0xc9))['catch'](handleError(_0x525217,null));};exports[_0xa915('0x2f')]=function(_0x2df02a,_0x376365,_0x369033){var _0x5d8d44;return db[_0xa915('0x38')]['find']({'where':{'id':_0x2df02a[_0xa915('0x52')]['id']}})[_0xa915('0x1b')](handleEntityNotFound(_0x376365,null))['then'](saveUpdates(_0x2df02a[_0xa915('0x58')],null))[_0xa915('0x1b')](function(_0x589b62){if(_0x589b62){_0x5d8d44=_0x589b62;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa915('0x1b')](function(_0x24e04e){if(_0x24e04e){var _0x58e488=fs['readFileSync'](path[_0xa915('0x5f')](config[_0xa915('0x60')],_0xa915('0x61')),_0xa915('0x63'));var _0x5e2ebe=fs['readFileSync'](path[_0xa915('0x5f')](config[_0xa915('0x60')],_0xa915('0x62')),_0xa915('0x63'));var _0x530ecb=ejs['render'](_0x58e488,{'trunks':_0x24e04e||[]});fs[_0xa915('0x65')](_0xa915('0x66'),_0x530ecb);var _0x463151=ejs[_0xa915('0x64')](_0x5e2ebe,{'trunks':_0x24e04e||[]});fs[_0xa915('0x65')](_0xa915('0x68'),_0x463151);return respondWithRpcPromise(_0xa915('0x69'),'update',{'module':_0xa915('0x6a')});}return null;})['then'](function(_0x31099f){if(_0x31099f){return _0x5d8d44;}})[_0xa915('0x1b')](respondWithResult(_0x376365,null))[_0xa915('0x50')](handleError(_0x376365,null));};exports['destroy']=function(_0x296206,_0x320be8,_0x5c850e){var _0x113717;return db[_0xa915('0x38')][_0xa915('0x54')]({'where':{'id':_0x296206[_0xa915('0x52')]['id']}})[_0xa915('0x1b')](handleEntityNotFound(_0x320be8,null))[_0xa915('0x1b')](removeEntity(_0x320be8,null))['then'](function(){return db[_0xa915('0x38')][_0xa915('0x4e')]({'raw':!![]});})[_0xa915('0x1b')](function(_0x4db568){var _0x2e2b31=fs[_0xa915('0x5e')](path['join'](config[_0xa915('0x60')],'server/files/templates/trunk.ejs'),'utf8');var _0x41dd4c=fs[_0xa915('0x5e')](path[_0xa915('0x5f')](config['root'],_0xa915('0x62')),_0xa915('0x63'));var _0x2edd05=ejs['render'](_0x2e2b31,{'trunks':_0x4db568});var _0x35d712=ejs[_0xa915('0x64')](_0x41dd4c,{'trunks':_0x4db568});fs[_0xa915('0x65')](_0xa915('0x66'),_0x2edd05);fs[_0xa915('0x65')](_0xa915('0x68'),_0x35d712);return respondWithRpcPromise(_0xa915('0x69'),_0xa915('0x30'),{'module':_0xa915('0x6a')});})[_0xa915('0x50')](handleError(_0x320be8,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 3b17f93..b29473e 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 _0xa5f6=['tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./trunk.attributes','exports','define','Trunk'];(function(_0x498174,_0x39010b){var _0x2ba1c6=function(_0x4385b2){while(--_0x4385b2){_0x498174['push'](_0x498174['shift']());}};_0x2ba1c6(++_0x39010b);}(_0xa5f6,0x16d));var _0x6a5f=function(_0x5e701b,_0x456e9e){_0x5e701b=_0x5e701b-0x0;var _0x398abf=_0xa5f6[_0x5e701b];return _0x398abf;};'use strict';var _=require('lodash');var util=require(_0x6a5f('0x0'));var logger=require(_0x6a5f('0x1'))(_0x6a5f('0x2'));var moment=require(_0x6a5f('0x3'));var BPromise=require(_0x6a5f('0x4'));var rp=require(_0x6a5f('0x5'));var fs=require('fs');var path=require(_0x6a5f('0x6'));var rimraf=require(_0x6a5f('0x7'));var config=require('../../config/environment');var attributes=require(_0x6a5f('0x8'));module[_0x6a5f('0x9')]=function(_0x193938,_0x7c8525){return _0x193938[_0x6a5f('0xa')](_0x6a5f('0xb'),attributes,{'tableName':_0x6a5f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b33=['tools_trunks','util','api','moment','bluebird','path','../../config/environment','./trunk.attributes','exports','define','Trunk'];(function(_0x3c576b,_0x26166d){var _0x33073b=function(_0x294b12){while(--_0x294b12){_0x3c576b['push'](_0x3c576b['shift']());}};_0x33073b(++_0x26166d);}(_0x6b33,0x161));var _0x36b3=function(_0x560ba7,_0x514250){_0x560ba7=_0x560ba7-0x0;var _0x2905ea=_0x6b33[_0x560ba7];return _0x2905ea;};'use strict';var _=require('lodash');var util=require(_0x36b3('0x0'));var logger=require('../../config/logger')(_0x36b3('0x1'));var moment=require(_0x36b3('0x2'));var BPromise=require(_0x36b3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x36b3('0x4'));var rimraf=require('rimraf');var config=require(_0x36b3('0x5'));var attributes=require(_0x36b3('0x6'));module[_0x36b3('0x7')]=function(_0x124002,_0x560551){return _0x124002[_0x36b3('0x8')](_0x36b3('0x9'),attributes,{'tableName':_0x36b3('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 e704993..8fa3d9f 100644 --- a/server/api/trunk/trunk.rpc.js +++ b/server/api/trunk/trunk.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['model','GetTrunk','Trunk','find','where','include','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','findAll','raw','options','attributes','map'];(function(_0x5d487a,_0x103a20){var _0x236757=function(_0xdff32d){while(--_0xdff32d){_0x5d487a['push'](_0x5d487a['shift']());}};_0x236757(++_0x103a20);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1597e2,_0x388d3e){_0x1597e2=_0x1597e2-0x0;var _0x4c8c0a=_0x0b0e[_0x1597e2];return _0x4c8c0a;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Trunk,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});}exports['GetTrunk']=function(_0x54a3eb){var _0x46bb44=this;return new Promise(function(_0x50a441,_0x4df8da){return db['Trunk'][_0xe0b0('0x18')]({'raw':_0x54a3eb['options']?_0x54a3eb['options'][_0xe0b0('0x19')]===undefined?!![]:![]:!![],'where':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x1a')]['where']||null:null,'attributes':_0x54a3eb[_0xe0b0('0x1a')]?_0x54a3eb[_0xe0b0('0x1a')][_0xe0b0('0x1b')]||null:null,'limit':_0x54a3eb[_0xe0b0('0x1a')]?_0x54a3eb[_0xe0b0('0x1a')]['limit']||null:null,'include':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x1a')]['include']?_[_0xe0b0('0x1c')](_0x54a3eb[_0xe0b0('0x1a')]['include'],function(_0x170ad8){return{'model':db[_0x170ad8['model']],'as':_0x170ad8['as'],'attributes':_0x170ad8[_0xe0b0('0x1b')],'include':_0x170ad8['include']?_[_0xe0b0('0x1c')](_0x170ad8['include'],function(_0x3e5c88){return{'model':db[_0x3e5c88['model']],'as':_0x3e5c88['as'],'attributes':_0x3e5c88[_0xe0b0('0x1b')],'include':_0x3e5c88['include']?_[_0xe0b0('0x1c')](_0x3e5c88['include'],function(_0x362aba){return{'model':db[_0x362aba[_0xe0b0('0x1d')]],'as':_0x362aba['as'],'attributes':_0x362aba[_0xe0b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0b0('0xd')](function(_0x3ec2){logger[_0xe0b0('0xe')]('GetTrunk',_0x54a3eb);logger[_0xe0b0('0x10')](_0xe0b0('0x1e'),_0x54a3eb,JSON['stringify'](_0x3ec2));_0x50a441(_0x3ec2);})[_0xe0b0('0x17')](function(_0x419b1f){logger[_0xe0b0('0x13')](_0xe0b0('0x1e'),_0x419b1f[_0xe0b0('0x14')],_0x54a3eb);_0x4df8da(_0x46bb44[_0xe0b0('0x13')](0x1f4,_0x419b1f[_0xe0b0('0x14')]));});});};exports['ShowTrunk']=function(_0x1854b8){var _0x3c0109=this;return new Promise(function(_0x48a9b5,_0x4fe400){return db[_0xe0b0('0x1f')][_0xe0b0('0x20')]({'raw':_0x1854b8[_0xe0b0('0x1a')]?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x19')]===undefined?!![]:![]:!![],'where':_0x1854b8['options']?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x21')]||null:null,'attributes':_0x1854b8[_0xe0b0('0x1a')]?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x1b')]||null:null,'include':_0x1854b8['options']?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x22')]?_[_0xe0b0('0x1c')](_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x22')],function(_0x12eeb8){return{'model':db[_0x12eeb8[_0xe0b0('0x1d')]],'as':_0x12eeb8['as'],'attributes':_0x12eeb8[_0xe0b0('0x1b')],'include':_0x12eeb8[_0xe0b0('0x22')]?_[_0xe0b0('0x1c')](_0x12eeb8[_0xe0b0('0x22')],function(_0x1a0c90){return{'model':db[_0x1a0c90[_0xe0b0('0x1d')]],'as':_0x1a0c90['as'],'attributes':_0x1a0c90[_0xe0b0('0x1b')],'include':_0x1a0c90[_0xe0b0('0x22')]?_['map'](_0x1a0c90[_0xe0b0('0x22')],function(_0x135be5){return{'model':db[_0x135be5[_0xe0b0('0x1d')]],'as':_0x135be5['as'],'attributes':_0x135be5[_0xe0b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0b0('0xd')](function(_0x2c6e60){logger[_0xe0b0('0xe')]('ShowTrunk',_0x1854b8);logger['debug']('ShowTrunk',_0x1854b8,JSON['stringify'](_0x2c6e60));_0x48a9b5(_0x2c6e60);})[_0xe0b0('0x17')](function(_0xc3d967){logger[_0xe0b0('0x13')]('ShowTrunk',_0xc3d967[_0xe0b0('0x14')],_0x1854b8);_0x4fe400(_0x3c0109[_0xe0b0('0x13')](0x1f4,_0xc3d967[_0xe0b0('0x14')]));});});}; \ No newline at end of file +var _0xbaf0=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','model','map','ShowTrunk','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Trunk,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetTrunk',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowTrunk',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 63bb769..7d97552 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 _0x0519=['getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','addContacts','create','addQueues','root','format','%s-%s','now','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','get','whoami','/:id','show','/:id/avatar','getAvatar','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getRecordings','getScreenRecordings','/:id/chat/interactions'];(function(_0x333d97,_0x25fda2){var _0x5545a0=function(_0x46119b){while(--_0x46119b){_0x333d97['push'](_0x333d97['shift']());}};_0x5545a0(++_0x25fda2);}(_0x0519,0x11d));var _0x9051=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x0519[_0x3cb6dc];return _0x47ec89;};'use strict';var multer=require(_0x9051('0x0'));var util=require(_0x9051('0x1'));var path=require(_0x9051('0x2'));var timeout=require(_0x9051('0x3'));var express=require(_0x9051('0x4'));var router=express['Router']();var auth=require(_0x9051('0x5'));var interaction=require(_0x9051('0x6'));var config=require(_0x9051('0x7'));var controller=require(_0x9051('0x8'));router['get']('/',auth[_0x9051('0x9')](),controller['index']);router[_0x9051('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x9051('0xa')]('/whoami',auth[_0x9051('0x9')](),controller[_0x9051('0xb')]);router[_0x9051('0xa')](_0x9051('0xc'),auth[_0x9051('0x9')](),controller[_0x9051('0xd')]);router[_0x9051('0xa')](_0x9051('0xe'),controller[_0x9051('0xf')]);router[_0x9051('0xa')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x9051('0x10')]);router['get'](_0x9051('0x11'),auth[_0x9051('0x9')](),controller[_0x9051('0x12')]);router[_0x9051('0xa')](_0x9051('0x13'),auth[_0x9051('0x9')](),controller['getVoiceQueuesRt']);router['get'](_0x9051('0x14'),auth['isAuthenticated'](),controller['getGroups']);router[_0x9051('0xa')]('/:id/recordings',auth['isAuthenticated'](),controller[_0x9051('0x15')]);router[_0x9051('0xa')]('/:id/screen_recordings',auth[_0x9051('0x9')](),controller[_0x9051('0x16')]);router[_0x9051('0xa')](_0x9051('0x17'),auth[_0x9051('0x9')](),controller[_0x9051('0x18')]);router[_0x9051('0xa')](_0x9051('0x19'),auth[_0x9051('0x9')](),controller[_0x9051('0x1a')]);router['get']('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x9051('0x1b')]);router[_0x9051('0xa')]('/:id/sms/interactions',auth[_0x9051('0x9')](),controller[_0x9051('0x1c')]);router[_0x9051('0xa')](_0x9051('0x1d'),auth[_0x9051('0x9')](),controller[_0x9051('0x1e')]);router[_0x9051('0xa')]('/:id/whatsapp/interactions',auth[_0x9051('0x9')](),controller['getWhatsappInteractions']);router[_0x9051('0xa')](_0x9051('0x1f'),auth[_0x9051('0x9')](),controller['getTeams']);router[_0x9051('0xa')]('/:id/lists',auth['isAuthenticated'](),controller[_0x9051('0x20')]);router[_0x9051('0xa')](_0x9051('0x21'),auth[_0x9051('0x9')](),controller[_0x9051('0x22')]);router[_0x9051('0xa')](_0x9051('0x23'),auth[_0x9051('0x9')](),controller[_0x9051('0x24')]);router['get']('/:id/fax_accounts',auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0x9051('0xa')]('/:id/mail_accounts',auth[_0x9051('0x9')](),controller['getMailAccounts']);router[_0x9051('0xa')](_0x9051('0x25'),auth[_0x9051('0x9')](),controller[_0x9051('0x26')]);router[_0x9051('0xa')]('/:id/sms_accounts',auth[_0x9051('0x9')](),controller[_0x9051('0x27')]);router['get'](_0x9051('0x28'),auth['isAuthenticated'](),controller[_0x9051('0x29')]);router[_0x9051('0xa')](_0x9051('0x2a'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router['get'](_0x9051('0x2b'),auth[_0x9051('0x9')](),controller[_0x9051('0x2c')]);router['get']('/:id/scheduled_calls',auth[_0x9051('0x9')](),controller[_0x9051('0x2d')]);router[_0x9051('0xa')](_0x9051('0x2e'),auth['isAuthenticated'](),controller[_0x9051('0x2f')]);router['post']('/create_many',auth[_0x9051('0x9')](),controller['bulkCreate']);router[_0x9051('0x30')](_0x9051('0x31'),auth[_0x9051('0x9')](),controller[_0x9051('0x32')]);router['post']('/',auth[_0x9051('0x9')](),controller[_0x9051('0x33')]);router[_0x9051('0x30')](_0x9051('0x11'),auth[_0x9051('0x9')](),controller[_0x9051('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x73a4f9,_0x4da4a7,_0x4f0e17){_0x4f0e17(null,path['join'](config[_0x9051('0x35')],'server/files/images/'));},'filename':function(_0x443174,_0x18cdd3,_0x353c23){_0x353c23(null,util[_0x9051('0x36')](_0x9051('0x37'),Date[_0x9051('0x38')](),_0x18cdd3['originalname']));}})});router[_0x9051('0x30')](_0x9051('0xe'),upload[_0x9051('0x39')]('file'),controller[_0x9051('0x3a')]);router[_0x9051('0x30')](_0x9051('0x3b'),auth[_0x9051('0x9')](),controller[_0x9051('0x3c')]);router[_0x9051('0x30')](_0x9051('0x3d'),auth[_0x9051('0x9')](),controller[_0x9051('0x3e')]);router[_0x9051('0x30')](_0x9051('0x3f'),auth['isAuthenticated'](),controller['pause']);router[_0x9051('0x30')](_0x9051('0x40'),auth[_0x9051('0x9')](),controller['unpause']);router[_0x9051('0x30')]('/:id/teams',auth[_0x9051('0x9')](),controller['addTeams']);router[_0x9051('0x30')]('/:id/chat_interactions',auth[_0x9051('0x9')](),controller[_0x9051('0x41')]);router[_0x9051('0x30')](_0x9051('0x42'),auth['isAuthenticated'](),controller[_0x9051('0x43')]);router['post'](_0x9051('0x44'),auth[_0x9051('0x9')](),controller[_0x9051('0x45')]);router[_0x9051('0x30')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x9051('0x46')]);router[_0x9051('0x30')]('/:id/openchannel_interactions',auth[_0x9051('0x9')](),controller[_0x9051('0x47')]);router[_0x9051('0x30')](_0x9051('0x48'),auth[_0x9051('0x9')](),controller[_0x9051('0x49')]);router[_0x9051('0x30')](_0x9051('0x4a'),auth[_0x9051('0x9')](),controller[_0x9051('0x4b')]);router[_0x9051('0x30')]('/:id/mail_accounts',auth[_0x9051('0x9')](),controller[_0x9051('0x4c')]);router[_0x9051('0x30')](_0x9051('0x25'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router['post'](_0x9051('0x4d'),auth['isAuthenticated'](),controller[_0x9051('0x4e')]);router[_0x9051('0x30')](_0x9051('0x28'),auth[_0x9051('0x9')](),controller[_0x9051('0x4f')]);router[_0x9051('0x30')](_0x9051('0x2a'),auth[_0x9051('0x9')](),controller[_0x9051('0x50')]);router['post'](_0x9051('0x2b'),auth[_0x9051('0x9')](),controller[_0x9051('0x51')]);router['post'](_0x9051('0x2e'),auth[_0x9051('0x9')](),controller['createApiKey']);router[_0x9051('0x52')](_0x9051('0xc'),auth[_0x9051('0x9')](),controller[_0x9051('0x53')]);router[_0x9051('0x52')](_0x9051('0x54'),auth[_0x9051('0x9')](),controller[_0x9051('0x55')]);router[_0x9051('0x56')](_0x9051('0x11'),auth[_0x9051('0x9')](),controller[_0x9051('0x57')]);router[_0x9051('0x56')]('/:id/teams',auth[_0x9051('0x9')](),controller[_0x9051('0x58')]);router['delete'](_0x9051('0xc'),auth['isAuthenticated'](),controller[_0x9051('0x59')]);router[_0x9051('0x56')]('/:id/chat_interactions',auth[_0x9051('0x9')](),controller['removeChatInteractions']);router['delete']('/:id/mail_interactions',auth[_0x9051('0x9')](),controller[_0x9051('0x5a')]);router[_0x9051('0x56')](_0x9051('0x44'),auth[_0x9051('0x9')](),controller[_0x9051('0x5b')]);router[_0x9051('0x56')]('/:id/sms_interactions',auth[_0x9051('0x9')](),controller[_0x9051('0x5c')]);router['delete'](_0x9051('0x5d'),auth[_0x9051('0x9')](),controller['removeOpenchannelInteractions']);router[_0x9051('0x56')](_0x9051('0x48'),auth['isAuthenticated'](),controller[_0x9051('0x5e')]);router[_0x9051('0x56')](_0x9051('0x4a'),auth['isAuthenticated'](),controller[_0x9051('0x5f')]);router[_0x9051('0x56')]('/:id/mail_accounts',auth[_0x9051('0x9')](),controller[_0x9051('0x60')]);router[_0x9051('0x56')](_0x9051('0x25'),auth[_0x9051('0x9')](),controller[_0x9051('0x61')]);router[_0x9051('0x56')](_0x9051('0x4d'),auth[_0x9051('0x9')](),controller[_0x9051('0x62')]);router[_0x9051('0x56')](_0x9051('0x28'),auth[_0x9051('0x9')](),controller[_0x9051('0x63')]);router['delete'](_0x9051('0x2a'),auth[_0x9051('0x9')](),controller['removeWhatsappAccounts']);router[_0x9051('0x56')](_0x9051('0x2b'),auth[_0x9051('0x9')](),controller[_0x9051('0x64')]);router[_0x9051('0x56')](_0x9051('0x2e'),auth[_0x9051('0x9')](),controller[_0x9051('0x65')]);module[_0x9051('0x66')]=router; \ No newline at end of file +var _0x5725=['getSmsAccounts','/:id/chat_websites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/create_many','bulkCreate','addContacts','create','addQueues','join','root','server/files/images/','%s-%s','now','originalname','single','file','addAvatar','login','/:id/logout','/:id/pause','pause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id/password','removeQueues','delete','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/:id','show','/:id/avatar','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts'];(function(_0x33b0f3,_0x478245){var _0x46e31b=function(_0x4f7cc7){while(--_0x4f7cc7){_0x33b0f3['push'](_0x33b0f3['shift']());}};_0x46e31b(++_0x478245);}(_0x5725,0x198));var _0x5572=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x5725[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x5572('0x0'));var util=require(_0x5572('0x1'));var path=require(_0x5572('0x2'));var timeout=require(_0x5572('0x3'));var express=require(_0x5572('0x4'));var router=express['Router']();var auth=require(_0x5572('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5572('0x6'));var controller=require('./user.controller');router[_0x5572('0x7')]('/',auth[_0x5572('0x8')](),controller[_0x5572('0x9')]);router['get'](_0x5572('0xa'),auth[_0x5572('0x8')](),controller[_0x5572('0xb')]);router[_0x5572('0x7')](_0x5572('0xc'),auth[_0x5572('0x8')](),controller[_0x5572('0xd')]);router['get'](_0x5572('0xe'),auth['isAuthenticated'](),controller[_0x5572('0xf')]);router[_0x5572('0x7')](_0x5572('0x10'),controller['getAvatar']);router[_0x5572('0x7')](_0x5572('0x11'),auth[_0x5572('0x8')](),controller['getContacts']);router[_0x5572('0x7')](_0x5572('0x12'),auth['isAuthenticated'](),controller[_0x5572('0x13')]);router[_0x5572('0x7')](_0x5572('0x14'),auth[_0x5572('0x8')](),controller[_0x5572('0x15')]);router['get'](_0x5572('0x16'),auth[_0x5572('0x8')](),controller[_0x5572('0x17')]);router[_0x5572('0x7')]('/:id/recordings',auth[_0x5572('0x8')](),controller[_0x5572('0x18')]);router['get'](_0x5572('0x19'),auth['isAuthenticated'](),controller[_0x5572('0x1a')]);router[_0x5572('0x7')]('/:id/chat/interactions',auth[_0x5572('0x8')](),controller[_0x5572('0x1b')]);router[_0x5572('0x7')](_0x5572('0x1c'),auth[_0x5572('0x8')](),controller[_0x5572('0x1d')]);router[_0x5572('0x7')](_0x5572('0x1e'),auth[_0x5572('0x8')](),controller['getMailInteractions']);router[_0x5572('0x7')](_0x5572('0x1f'),auth[_0x5572('0x8')](),controller['getSmsInteractions']);router[_0x5572('0x7')](_0x5572('0x20'),auth[_0x5572('0x8')](),controller[_0x5572('0x21')]);router[_0x5572('0x7')]('/:id/whatsapp/interactions',auth[_0x5572('0x8')](),controller[_0x5572('0x22')]);router[_0x5572('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5572('0x23')]);router['get'](_0x5572('0x24'),auth[_0x5572('0x8')](),controller[_0x5572('0x25')]);router[_0x5572('0x7')](_0x5572('0x26'),auth[_0x5572('0x8')](),controller[_0x5572('0x27')]);router['get'](_0x5572('0x28'),auth[_0x5572('0x8')](),controller[_0x5572('0x29')]);router[_0x5572('0x7')](_0x5572('0x2a'),auth[_0x5572('0x8')](),controller[_0x5572('0x2b')]);router[_0x5572('0x7')](_0x5572('0x2c'),auth[_0x5572('0x8')](),controller[_0x5572('0x2d')]);router[_0x5572('0x7')](_0x5572('0x2e'),auth[_0x5572('0x8')](),controller['getOpenchannelAccounts']);router[_0x5572('0x7')](_0x5572('0x2f'),auth[_0x5572('0x8')](),controller[_0x5572('0x30')]);router[_0x5572('0x7')](_0x5572('0x31'),auth[_0x5572('0x8')](),controller['getChatWebsites']);router[_0x5572('0x7')]('/:id/whatsapp_accounts',auth[_0x5572('0x8')](),controller[_0x5572('0x32')]);router[_0x5572('0x7')](_0x5572('0x33'),auth[_0x5572('0x8')](),controller[_0x5572('0x34')]);router[_0x5572('0x7')](_0x5572('0x35'),auth[_0x5572('0x8')](),controller[_0x5572('0x36')]);router[_0x5572('0x7')](_0x5572('0x37'),auth[_0x5572('0x8')](),controller['getApiKey']);router[_0x5572('0x38')](_0x5572('0x39'),auth[_0x5572('0x8')](),controller[_0x5572('0x3a')]);router[_0x5572('0x38')](_0x5572('0x11'),auth[_0x5572('0x8')](),controller[_0x5572('0x3b')]);router[_0x5572('0x38')]('/',auth[_0x5572('0x8')](),controller[_0x5572('0x3c')]);router[_0x5572('0x38')](_0x5572('0x12'),auth[_0x5572('0x8')](),controller[_0x5572('0x3d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5e5b35,_0x2a5040,_0x2dfee4){_0x2dfee4(null,path[_0x5572('0x3e')](config[_0x5572('0x3f')],_0x5572('0x40')));},'filename':function(_0x1d86f1,_0xe4bc49,_0x31032c){_0x31032c(null,util['format'](_0x5572('0x41'),Date[_0x5572('0x42')](),_0xe4bc49[_0x5572('0x43')]));}})});router[_0x5572('0x38')](_0x5572('0x10'),upload[_0x5572('0x44')](_0x5572('0x45')),controller[_0x5572('0x46')]);router[_0x5572('0x38')]('/:id/login',auth[_0x5572('0x8')](),controller[_0x5572('0x47')]);router['post'](_0x5572('0x48'),auth['isAuthenticated'](),controller['logout']);router[_0x5572('0x38')](_0x5572('0x49'),auth[_0x5572('0x8')](),controller[_0x5572('0x4a')]);router[_0x5572('0x38')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x5572('0x4b')]);router[_0x5572('0x38')](_0x5572('0x4c'),auth[_0x5572('0x8')](),controller[_0x5572('0x4d')]);router[_0x5572('0x38')](_0x5572('0x4e'),auth[_0x5572('0x8')](),controller[_0x5572('0x4f')]);router[_0x5572('0x38')](_0x5572('0x50'),auth[_0x5572('0x8')](),controller[_0x5572('0x51')]);router['post'](_0x5572('0x52'),auth['isAuthenticated'](),controller[_0x5572('0x53')]);router[_0x5572('0x38')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x5572('0x54')]);router[_0x5572('0x38')]('/:id/openchannel_interactions',auth[_0x5572('0x8')](),controller[_0x5572('0x55')]);router['post'](_0x5572('0x56'),auth['isAuthenticated'](),controller[_0x5572('0x57')]);router[_0x5572('0x38')](_0x5572('0x2a'),auth[_0x5572('0x8')](),controller[_0x5572('0x58')]);router['post'](_0x5572('0x2c'),auth[_0x5572('0x8')](),controller[_0x5572('0x59')]);router[_0x5572('0x38')](_0x5572('0x2e'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router['post']('/:id/sms_accounts',auth[_0x5572('0x8')](),controller['addSmsAccounts']);router[_0x5572('0x38')](_0x5572('0x31'),auth[_0x5572('0x8')](),controller[_0x5572('0x5a')]);router['post'](_0x5572('0x5b'),auth[_0x5572('0x8')](),controller[_0x5572('0x5c')]);router[_0x5572('0x38')](_0x5572('0x33'),auth[_0x5572('0x8')](),controller[_0x5572('0x5d')]);router[_0x5572('0x38')](_0x5572('0x37'),auth[_0x5572('0x8')](),controller[_0x5572('0x5e')]);router['put']('/:id',auth[_0x5572('0x8')](),controller['update']);router[_0x5572('0x5f')](_0x5572('0x60'),auth[_0x5572('0x8')](),controller['changePassword']);router['delete'](_0x5572('0x12'),auth[_0x5572('0x8')](),controller[_0x5572('0x61')]);router[_0x5572('0x62')](_0x5572('0x4c'),auth[_0x5572('0x8')](),controller[_0x5572('0x63')]);router[_0x5572('0x62')](_0x5572('0xe'),auth[_0x5572('0x8')](),controller['destroy']);router[_0x5572('0x62')](_0x5572('0x4e'),auth['isAuthenticated'](),controller[_0x5572('0x64')]);router[_0x5572('0x62')](_0x5572('0x50'),auth[_0x5572('0x8')](),controller[_0x5572('0x65')]);router[_0x5572('0x62')](_0x5572('0x52'),auth['isAuthenticated'](),controller[_0x5572('0x66')]);router[_0x5572('0x62')](_0x5572('0x67'),auth[_0x5572('0x8')](),controller['removeSmsInteractions']);router[_0x5572('0x62')](_0x5572('0x68'),auth[_0x5572('0x8')](),controller[_0x5572('0x69')]);router[_0x5572('0x62')]('/:id/whatsapp_interactions',auth[_0x5572('0x8')](),controller['removeWhatsappInteractions']);router[_0x5572('0x62')](_0x5572('0x2a'),auth[_0x5572('0x8')](),controller[_0x5572('0x6a')]);router['delete'](_0x5572('0x2c'),auth['isAuthenticated'](),controller[_0x5572('0x6b')]);router[_0x5572('0x62')](_0x5572('0x2e'),auth['isAuthenticated'](),controller[_0x5572('0x6c')]);router[_0x5572('0x62')](_0x5572('0x2f'),auth[_0x5572('0x8')](),controller[_0x5572('0x6d')]);router[_0x5572('0x62')]('/:id/chat_websites',auth[_0x5572('0x8')](),controller[_0x5572('0x6e')]);router[_0x5572('0x62')](_0x5572('0x5b'),auth[_0x5572('0x8')](),controller[_0x5572('0x6f')]);router[_0x5572('0x62')](_0x5572('0x33'),auth[_0x5572('0x8')](),controller['removeSquareProjects']);router['delete'](_0x5572('0x37'),auth[_0x5572('0x8')](),controller[_0x5572('0x70')]);module[_0x5572('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 548361d..d9d16e8 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 _0x8862=['accept','refuse','originate','uas','fingerprint','certificate','active','passive','showWebBar','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','wss','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','STRING','email','toLowerCase','ENUM','local','INTEGER','accountcode','callerid','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','user','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','yes','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always'];(function(_0x14c3c3,_0x22e939){var _0x5740fd=function(_0x46488c){while(--_0x46488c){_0x14c3c3['push'](_0x14c3c3['shift']());}};_0x5740fd(++_0x22e939);}(_0x8862,0xd5));var _0x2886=function(_0x49c979,_0x5ebdbb){_0x49c979=_0x49c979-0x0;var _0x52b16c=_0x8862[_0x49c979];return _0x52b16c;};'use strict';var Sequelize=require(_0x2886('0x0'));var moment=require(_0x2886('0x1'));var util=require(_0x2886('0x2'));var _=require(_0x2886('0x3'));module[_0x2886('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2886('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3dd1c2){this[_0x2886('0x6')](_0x2886('0x5'),_0x3dd1c2);this[_0x2886('0x6')](_0x2886('0x7'),_0x3dd1c2);},'comment':_0x2886('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5720b0){this[_0x2886('0x6')](_0x2886('0x9'),_0x5720b0);this[_0x2886('0x6')]('callerid',util[_0x2886('0xa')](_0x2886('0xb'),_0x5720b0,this[_0x2886('0xc')](_0x2886('0xd'))));}},'alias':{'type':Sequelize[_0x2886('0xe')]},'email':{'type':Sequelize[_0x2886('0xe')],'allowNull':![],'unique':_0x2886('0xf'),'validate':{'isEmail':!![]},'set':function(_0x8a32be){if(_0x8a32be){this[_0x2886('0x6')](_0x2886('0xf'),_0x8a32be[_0x2886('0x10')]());}}},'role':{'type':Sequelize[_0x2886('0x11')]('admin','user','agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x2886('0xe')],'defaultValue':_0x2886('0x12')},'internal':{'type':Sequelize[_0x2886('0x13')](0xb),'allowNull':![],'unique':'internal','set':function(_0x2ff659){this[_0x2886('0x6')](_0x2886('0xd'),_0x2ff659);this['setDataValue'](_0x2886('0x14'),_0x2ff659);this['setDataValue'](_0x2886('0x15'),util['format'](_0x2886('0xb'),this[_0x2886('0xc')](_0x2886('0x9')),_0x2ff659));}},'salt':{'type':Sequelize[_0x2886('0xe')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x2886('0xe')]},'address':{'type':Sequelize[_0x2886('0xe')]},'zipcode':{'type':Sequelize[_0x2886('0xe')]},'userpic':{'type':Sequelize[_0x2886('0xe')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x2886('0xe')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x2886('0xe')],'defaultValue':_0x2886('0x17')},'lastPauseAt':{'type':Sequelize[_0x2886('0x18')]},'chatCapacity':{'type':Sequelize[_0x2886('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2886('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x2886('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x2886('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2886('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2886('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x2886('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2886('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x2886('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2886('0x19')},'ipaddr':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'port':{'type':Sequelize[_0x2886('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2886('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2886('0x11')]('friend',_0x2886('0x1a'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![],'defaultValue':_0x2886('0x1b')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x2886('0x1c'),_0x2886('0x1d'),_0x2886('0x1e'),_0x2886('0x1f'),_0x2886('0x20'),_0x2886('0x21'),_0x2886('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![],'defaultValue':_0x2886('0x23'),'set':function(_0x17a062){this[_0x2886('0x6')](_0x2886('0x24'),_0x17a062?_0x17a062[_0x2886('0x25')](','):null);},'get':function(){return this['getDataValue'](_0x2886('0x24'))?this['getDataValue'](_0x2886('0x24'))['split'](','):null;},'comment':_0x2886('0x26')},'dtmfmode':{'type':Sequelize['ENUM'](_0x2886('0x27'),_0x2886('0x28'),'shortinfo','inband',_0x2886('0x29')),'allowNull':!![],'defaultValue':_0x2886('0x27')},'directmedia':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x2a'),'no','nonat',_0x2886('0x2b'),_0x2886('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2886('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'nat':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![],'defaultValue':_0x2886('0x2d'),'set':function(_0x2070ba){this[_0x2886('0x6')](_0x2886('0x2e'),_0x2070ba?_0x2070ba['join'](','):null);},'get':function(){return this[_0x2886('0xc')](_0x2886('0x2e'))?this[_0x2886('0xc')](_0x2886('0x2e'))[_0x2886('0x2f')](','):null;},'comment':_0x2886('0x30')},'callgroup':{'type':Sequelize[_0x2886('0xe')]},'namedcallgroup':{'type':Sequelize[_0x2886('0xe')]},'pickupgroup':{'type':Sequelize[_0x2886('0xe')]},'namedpickupgroup':{'type':Sequelize[_0x2886('0xe')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2886('0xe')]},'disallow':{'type':Sequelize[_0x2886('0xe')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x2886('0xe')],'allowNull':![],'defaultValue':_0x2886('0x31'),'set':function(_0x13dd7c){this['setDataValue']('allow',_0x13dd7c?_0x13dd7c['join'](';'):_0x2886('0x31'));},'get':function(){return this[_0x2886('0xc')](_0x2886('0x32'))?this[_0x2886('0xc')](_0x2886('0x32'))[_0x2886('0x2f')](';'):null;},'comment':_0x2886('0x33')},'autoframing':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![],'set':function(_0x5e7e20){this[_0x2886('0x6')](_0x2886('0x34'),_0x5e7e20?_0x5e7e20[_0x2886('0x25')](','):null);},'get':function(){return this[_0x2886('0xc')](_0x2886('0x34'))?this[_0x2886('0xc')](_0x2886('0x34'))[_0x2886('0x2f')](','):null;},'comment':_0x2886('0x35')},'trustrpid':{'type':Sequelize[_0x2886('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x2886('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x2a'),'no',_0x2886('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x2886('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x2886('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![],'defaultValue':_0x2886('0x37')},'amaflags':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x2886('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x2886('0x2a')},'busylevel':{'type':Sequelize[_0x2886('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'template':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x2a'),'no',_0x2886('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x2886('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x39'),_0x2886('0x3a'),_0x2886('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x2886('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x2886('0x3c')),'allowNull':!![],'defaultValue':_0x2886('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x2886('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x2886('0x2a')},'keepalive':{'type':Sequelize[_0x2886('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2886('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x2886('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2886('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2886('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x2886('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2886('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2886('0x11')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2886('0x11')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2886('0x11')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x2886('0x11')]('yes','no',_0x2886('0x3d'),_0x2886('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x2886('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x3f'),_0x2886('0x40'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2886('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x2a'),'no','nonat',_0x2886('0x2b'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2886('0xe')]},'resetPasswordExpires':{'type':Sequelize[_0x2886('0x18')]},'showWebBar':{'type':Sequelize[_0x2886('0x13')],'defaultValue':0x0,'set':function(_0x528f0f){this[_0x2886('0x6')](_0x2886('0x41'),_0x528f0f);var _0x50f94c=this['get']({'plain':!![]});switch(_0x528f0f){case 0x0:case 0x1:var _0x93986a=_0x50f94c[_0x2886('0x24')]?_['isArray'](_0x50f94c['transport'])?_0x50f94c['transport'][_0x2886('0x25')]():_0x50f94c[_0x2886('0x24')]:_0x2886('0x23');if(_0x93986a==='wss'){_0x93986a='udp';}this['setDataValue'](_0x2886('0x24'),_0x93986a);this['setDataValue'](_0x2886('0x42'),'no');this[_0x2886('0x6')](_0x2886('0x43'),null);this['setDataValue'](_0x2886('0x44'),null);this['setDataValue'](_0x2886('0x45'),null);this[_0x2886('0x6')](_0x2886('0x46'),null);this['setDataValue'](_0x2886('0x47'),null);this[_0x2886('0x6')](_0x2886('0x48'),null);this[_0x2886('0x6')](_0x2886('0x49'),null);this[_0x2886('0x6')](_0x2886('0x4a'),null);this[_0x2886('0x6')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x2886('0x24'),_0x2886('0x4b'));this['setDataValue'](_0x2886('0x42'),_0x2886('0x2a'));this['setDataValue'](_0x2886('0x43'),_0x2886('0x2a'));this[_0x2886('0x6')](_0x2886('0x44'),'yes');this[_0x2886('0x6')](_0x2886('0x45'),_0x2886('0x2a'));this[_0x2886('0x6')](_0x2886('0x46'),_0x2886('0x2a'));this[_0x2886('0x6')]('dtlsverify','no');this[_0x2886('0x6')]('dtlssetup',_0x2886('0x4c'));this['setDataValue'](_0x2886('0x49'),_0x50f94c[_0x2886('0x49')]||_0x2886('0x4d'));this[_0x2886('0x6')]('dtlsprivatekey',_0x50f94c[_0x2886('0x4a')]||_0x2886('0x4e'));this[_0x2886('0x6')](_0x2886('0x4f'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x2886('0x50')],'set':function(_0x501176){this[_0x2886('0x6')](_0x2886('0x51'),_0x501176?_0x501176[_0x2886('0x25')](','):[]);},'get':function(){return this[_0x2886('0xc')](_0x2886('0x51'))?_['map'](this['getDataValue'](_0x2886('0x51'))['split'](','),function(_0x1ecc79){return parseInt(_0x1ecc79,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x2886('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x2886('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x2886('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2886('0xe')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2886('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2886('0x11')](_0x2886('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2886('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2886('0x52')],'get':function(){return this[_0x2886('0xc')](_0x2886('0x53'))?this[_0x2886('0xc')](_0x2886('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2886('0xe')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x5a98ba){if(typeof _0x5a98ba===_0x2886('0x54')){var _0x2c9d62=_0x5a98ba==='1'?!![]:_0x5a98ba==='0'?![]:_0x5a98ba===_0x2886('0x55')?!![]:_0x5a98ba==='false'?![]:![];this[_0x2886('0x6')]('screenrecording',_0x2c9d62);}else{this[_0x2886('0x6')](_0x2886('0x56'),_0x5a98ba);}}},'blocked':{'type':Sequelize[_0x2886('0x16')],'defaultValue':![],'set':function(_0x218c86){this['setDataValue'](_0x2886('0x57'),_0x218c86);if(_0x218c86===!![]){this[_0x2886('0x6')](_0x2886('0x58'),moment());this[_0x2886('0x6')](_0x2886('0x59'),0x0);}else{this[_0x2886('0x6')](_0x2886('0x58'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2886('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc9c2=['format','\x22%s\x22\x20<%s>','getDataValue','internal','ENUM','user','telephone','local','INTEGER','callerid','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','info','inband','auto','rfc2833','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uas','fingerprint','certificate','passive','update,nonat','showWebBar','isArray','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlssetup','/etc/pki/tls/certs/motion.crt','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname'];(function(_0x3b8f2e,_0x5a99a8){var _0x1433d5=function(_0x5e0353){while(--_0x5e0353){_0x3b8f2e['push'](_0x3b8f2e['shift']());}};_0x1433d5(++_0x5a99a8);}(_0xc9c2,0x19e));var _0x2c9c=function(_0x3666dc,_0x18701a){_0x3666dc=_0x3666dc-0x0;var _0x31c942=_0xc9c2[_0x3666dc];return _0x31c942;};'use strict';var Sequelize=require(_0x2c9c('0x0'));var moment=require(_0x2c9c('0x1'));var util=require(_0x2c9c('0x2'));var _=require(_0x2c9c('0x3'));module[_0x2c9c('0x4')]={'name':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':![],'unique':_0x2c9c('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1eaa81){this[_0x2c9c('0x7')](_0x2c9c('0x6'),_0x1eaa81);this[_0x2c9c('0x7')](_0x2c9c('0x8'),_0x1eaa81);},'comment':_0x2c9c('0x9')},'fullname':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':![],'set':function(_0x5935f7){this['setDataValue'](_0x2c9c('0xa'),_0x5935f7);this[_0x2c9c('0x7')]('callerid',util[_0x2c9c('0xb')](_0x2c9c('0xc'),_0x5935f7,this[_0x2c9c('0xd')](_0x2c9c('0xe'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x43431b){if(_0x43431b){this[_0x2c9c('0x7')]('email',_0x43431b['toLowerCase']());}}},'role':{'type':Sequelize[_0x2c9c('0xf')]('admin',_0x2c9c('0x10'),'agent',_0x2c9c('0x11')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x2c9c('0x5')],'defaultValue':_0x2c9c('0x12')},'internal':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':![],'unique':_0x2c9c('0xe'),'set':function(_0x323073){this[_0x2c9c('0x7')]('internal',_0x323073);this[_0x2c9c('0x7')]('accountcode',_0x323073);this['setDataValue'](_0x2c9c('0x14'),util[_0x2c9c('0xb')]('\x22%s\x22\x20<%s>',this[_0x2c9c('0xd')](_0x2c9c('0xa')),_0x323073));}},'salt':{'type':Sequelize[_0x2c9c('0x5')]},'phone':{'type':Sequelize[_0x2c9c('0x5')]},'mobile':{'type':Sequelize[_0x2c9c('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x2c9c('0x5')]},'city':{'type':Sequelize[_0x2c9c('0x5')]},'country':{'type':Sequelize[_0x2c9c('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x2c9c('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2c9c('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2c9c('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2c9c('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2c9c('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![],'defaultValue':_0x2c9c('0x17')},'ipaddr':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x2c9c('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x2c9c('0x18'),_0x2c9c('0x10'),'peer'),'allowNull':!![],'defaultValue':_0x2c9c('0x18')},'context':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![],'defaultValue':_0x2c9c('0x19')},'callingpres':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x1a'),_0x2c9c('0x1b'),_0x2c9c('0x1c'),_0x2c9c('0x1d'),_0x2c9c('0x1e'),_0x2c9c('0x1f'),_0x2c9c('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![],'defaultValue':_0x2c9c('0x21'),'set':function(_0x909aad){this['setDataValue'](_0x2c9c('0x22'),_0x909aad?_0x909aad[_0x2c9c('0x23')](','):null);},'get':function(){return this[_0x2c9c('0xd')](_0x2c9c('0x22'))?this[_0x2c9c('0xd')](_0x2c9c('0x22'))[_0x2c9c('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x2c9c('0x25'),'shortinfo',_0x2c9c('0x26'),_0x2c9c('0x27')),'allowNull':!![],'defaultValue':_0x2c9c('0x28')},'directmedia':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no',_0x2c9c('0x2a'),'update',_0x2c9c('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2c9c('0x2c'),'set':function(_0x3ab603){this[_0x2c9c('0x7')](_0x2c9c('0x2d'),_0x3ab603?_0x3ab603[_0x2c9c('0x23')](','):null);},'get':function(){return this[_0x2c9c('0xd')](_0x2c9c('0x2d'))?this[_0x2c9c('0xd')](_0x2c9c('0x2d'))[_0x2c9c('0x24')](','):null;},'comment':_0x2c9c('0x2e')},'callgroup':{'type':Sequelize[_0x2c9c('0x5')]},'namedcallgroup':{'type':Sequelize[_0x2c9c('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x2c9c('0x5')]},'language':{'type':Sequelize[_0x2c9c('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2c9c('0x5')]},'disallow':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':![],'defaultValue':_0x2c9c('0x2f'),'set':function(_0x1a2557){this[_0x2c9c('0x7')](_0x2c9c('0x30'),_0x1a2557?_0x1a2557['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x2c9c('0x30'))?this[_0x2c9c('0xd')](_0x2c9c('0x30'))['split'](';'):null;},'comment':_0x2c9c('0x31')},'autoframing':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![],'set':function(_0x52ce07){this['setDataValue'](_0x2c9c('0x32'),_0x52ce07?_0x52ce07[_0x2c9c('0x23')](','):null);},'get':function(){return this[_0x2c9c('0xd')](_0x2c9c('0x32'))?this[_0x2c9c('0xd')](_0x2c9c('0x32'))['split'](','):null;},'comment':_0x2c9c('0x33')},'trustrpid':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no',_0x2c9c('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2c9c('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x2c9c('0xf')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![],'defaultValue':_0x2c9c('0x35')},'amaflags':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![],'defaultValue':_0x2c9c('0x29')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2c9c('0xf')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x2c9c('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no',_0x2c9c('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x2c9c('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x37'),'refuse',_0x2c9c('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2c9c('0xf')]('uac','uas'),'allowNull':!![],'defaultValue':_0x2c9c('0x39')},'t38pt_usertpsource':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2c9c('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0x2c9c('0x29')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x2c9c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2c9c('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x2c9c('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x2c9c('0x29'),'no',_0x2c9c('0x3a'),_0x2c9c('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2c9c('0xf')]('active',_0x2c9c('0x3c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x2c9c('0x29'),'no','nonat','update',_0x2c9c('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x2c9c('0x16')]},'showWebBar':{'type':Sequelize[_0x2c9c('0x13')],'defaultValue':0x0,'set':function(_0x20d5d0){this[_0x2c9c('0x7')](_0x2c9c('0x3e'),_0x20d5d0);var _0x18ad56=this['get']({'plain':!![]});switch(_0x20d5d0){case 0x0:case 0x1:var _0x34b724=_0x18ad56['transport']?_[_0x2c9c('0x3f')](_0x18ad56[_0x2c9c('0x22')])?_0x18ad56['transport']['join']():_0x18ad56[_0x2c9c('0x22')]:_0x2c9c('0x21');if(_0x34b724==='wss'){_0x34b724='udp';}this['setDataValue'](_0x2c9c('0x22'),_0x34b724);this[_0x2c9c('0x7')](_0x2c9c('0x40'),'no');this[_0x2c9c('0x7')](_0x2c9c('0x41'),null);this[_0x2c9c('0x7')](_0x2c9c('0x42'),null);this[_0x2c9c('0x7')](_0x2c9c('0x43'),null);this[_0x2c9c('0x7')](_0x2c9c('0x44'),null);this[_0x2c9c('0x7')](_0x2c9c('0x45'),null);this['setDataValue']('dtlssetup',null);this[_0x2c9c('0x7')](_0x2c9c('0x46'),null);this[_0x2c9c('0x7')](_0x2c9c('0x47'),null);this[_0x2c9c('0x7')](_0x2c9c('0x48'),'no');break;case 0x2:this['setDataValue'](_0x2c9c('0x22'),'wss');this[_0x2c9c('0x7')](_0x2c9c('0x40'),_0x2c9c('0x29'));this[_0x2c9c('0x7')](_0x2c9c('0x41'),_0x2c9c('0x29'));this[_0x2c9c('0x7')](_0x2c9c('0x42'),_0x2c9c('0x29'));this[_0x2c9c('0x7')](_0x2c9c('0x43'),_0x2c9c('0x29'));this[_0x2c9c('0x7')]('dtlsenable',_0x2c9c('0x29'));this[_0x2c9c('0x7')](_0x2c9c('0x45'),'no');this[_0x2c9c('0x7')](_0x2c9c('0x49'),'actpass');this[_0x2c9c('0x7')](_0x2c9c('0x46'),_0x18ad56[_0x2c9c('0x46')]||_0x2c9c('0x4a'));this['setDataValue']('dtlsprivatekey',_0x18ad56[_0x2c9c('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1eedbf){this[_0x2c9c('0x7')]('permissions',_0x1eedbf?_0x1eedbf[_0x2c9c('0x23')](','):[]);},'get':function(){return this[_0x2c9c('0xd')](_0x2c9c('0x4b'))?_['map'](this[_0x2c9c('0xd')](_0x2c9c('0x4b'))[_0x2c9c('0x24')](','),function(_0x331953){return parseInt(_0x331953,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x2c9c('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x2c9c('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x2c9c('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2c9c('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x2c9c('0x5')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2c9c('0x4c')],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x2c9c('0xd')](_0x2c9c('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x2c9c('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![],'set':function(_0x3f3aa2){if(typeof _0x3f3aa2===_0x2c9c('0x4e')){var _0x3f056a=_0x3f3aa2==='1'?!![]:_0x3f3aa2==='0'?![]:_0x3f3aa2===_0x2c9c('0x4f')?!![]:_0x3f3aa2===_0x2c9c('0x50')?![]:![];this[_0x2c9c('0x7')](_0x2c9c('0x51'),_0x3f056a);}else{this[_0x2c9c('0x7')]('screenrecording',_0x3f3aa2);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1a4bfd){this['setDataValue'](_0x2c9c('0x52'),_0x1a4bfd);if(_0x1a4bfd===!![]){this[_0x2c9c('0x7')](_0x2c9c('0x53'),moment());this[_0x2c9c('0x7')](_0x2c9c('0x54'),0x0);}else{this['setDataValue'](_0x2c9c('0x53'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2c9c('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 1553480..dd69d36 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 _0xf9a6=['ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','rows','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','LOCAL/%s@from-sip/n','SIP/%s','intrf','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','all','forEach','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','updateAttributes','DEFAULT\x20PAUSE','mailPause','openchannelPause','smsPause','whatsapppause','pauseType','QueuePause','unpause','manual','mail','chat','fax','sms','whatsapp','%s%s','Pause','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getOpenchannelQueues','flatten','transaction','addAgent','getDataValue','Queue:save','removeTeams','Fax','Openchannel','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','omit','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','addSquareProjects','removeSquareProjects','$and','$or','$gt','$gte','$lt','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$notILike','$contains','$contained','CmHopper','firstName','Contact','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./user.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','debug','stringify','error','code','User,\x20%s,\x20%s','message','request\x20sent','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','Users','user','Agents','agent','Telephones','filter','ignore','map','value','includes','role','name','UserProfileResource','stack','send','index','User','fieldName','type','model','salt','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','sequelize','lower','col','options','includeAll','catch','params','differenceBy','password','find','bulkCreate','body','describe','addContacts','ids','agent\x20role','telephone','admin','../../config/license/util','getLicense','telephones','isNil','internal','findById','securePassword','min_internal','QueryTypes','SELECT','from','mailbox','VoiceMail','fullname','email','permissions','102','103','104','105','106','108','109','100','114','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','changePassword','Setting','findOne','oldPassword','newPassword','ValidationError','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','spread','QueueId','emit','voice','VoiceQueue','findAll','push','format','each','upsert','removeQueues','channel','remove','Queue:remove','UserVoiceQueueRt','userpic','file','root','existsSync','join','server/files/images/','download','getContacts','CmContact','include','CmList','Tag','Tags','color','tag','getQueues','Queue','rawAttributes','Unknown\x20role','getVoiceQueuesRt'];(function(_0x57112d,_0x9ea573){var _0x3c32b9=function(_0x349dda){while(--_0x349dda){_0x57112d['push'](_0x57112d['shift']());}};_0x3c32b9(++_0x9ea573);}(_0xf9a6,0x9f));var _0x6f9a=function(_0x495467,_0x8fe139){_0x495467=_0x495467-0x0;var _0x31b0f2=_0xf9a6[_0x495467];return _0x31b0f2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6f9a('0x0'));var rimraf=require(_0x6f9a('0x1'));var zipdir=require(_0x6f9a('0x2'));var jsonpatch=require(_0x6f9a('0x3'));var rp=require(_0x6f9a('0x4'));var moment=require(_0x6f9a('0x5'));var BPromise=require(_0x6f9a('0x6'));var Mustache=require(_0x6f9a('0x7'));var util=require('util');var path=require(_0x6f9a('0x8'));var sox=require(_0x6f9a('0x9'));var csv=require(_0x6f9a('0xa'));var ejs=require(_0x6f9a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6f9a('0xc'));var crypto=require(_0x6f9a('0xd'));var jsforce=require(_0x6f9a('0xe'));var deskjs=require(_0x6f9a('0xf'));var toCsv=require(_0x6f9a('0xa'));var querystring=require(_0x6f9a('0x10'));var Papa=require('papaparse');var Redis=require(_0x6f9a('0x11'));var authService=require(_0x6f9a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6f9a('0x13'));var hardwareService=require(_0x6f9a('0x14'));var logger=require(_0x6f9a('0x15'))(_0x6f9a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6f9a('0x17'))['db'];config[_0x6f9a('0x18')]=_[_0x6f9a('0x19')](config[_0x6f9a('0x18')],{'host':_0x6f9a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6f9a('0x1b'))['register'](socket);var jayson=require(_0x6f9a('0x1c'));var client=jayson[_0x6f9a('0x1d')][_0x6f9a('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x3315f9,_0x885967,_0x3af3fa){if(_0x3af3fa){var _0x1e436c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e436c[_0x6f9a('0x1f')](_0x885967)){return _0x3315f9;}else{throw new db[(_0x6f9a('0x20'))]['ValidationError'](_0x6f9a('0x21'));}}else{return _0x3315f9;}}function respondWithRpcPromise(_0x2fb5b2,_0x4bb777,_0x1a6a35,_0x379fdb){return new BPromise(function(_0x11a50a,_0x5a24ec){var _0x3682f9=_0x379fdb||client;return _0x3682f9['request'](_0x2fb5b2,_0x1a6a35)[_0x6f9a('0x22')](function(_0x1f1234){logger[_0x6f9a('0x23')]('User,\x20%s,\x20%s',_0x4bb777,'request\x20sent');logger[_0x6f9a('0x24')]('User,\x20%s,\x20%s,\x20%s',_0x4bb777,'request\x20sent',JSON[_0x6f9a('0x25')](_0x1f1234));if(_0x1f1234[_0x6f9a('0x26')]){if(_0x1f1234[_0x6f9a('0x26')][_0x6f9a('0x27')]===0x1f4){logger[_0x6f9a('0x26')](_0x6f9a('0x28'),_0x4bb777,_0x1f1234[_0x6f9a('0x26')]['message']);return _0x5a24ec(_0x1f1234[_0x6f9a('0x26')][_0x6f9a('0x29')]);}logger[_0x6f9a('0x26')]('User,\x20%s,\x20%s',_0x4bb777,_0x1f1234[_0x6f9a('0x26')][_0x6f9a('0x29')]);return _0x11a50a(_0x1f1234['error'][_0x6f9a('0x29')]);}else{logger['info'](_0x6f9a('0x28'),_0x4bb777,_0x6f9a('0x2a'));_0x11a50a(_0x1f1234['result'][_0x6f9a('0x29')]);}})['catch'](function(_0x43c53d){logger[_0x6f9a('0x26')]('User,\x20%s,\x20%s',_0x4bb777,_0x43c53d);_0x5a24ec(_0x43c53d);});});}function respondWithStatusCode(_0x44b0f6,_0x33e025){_0x33e025=_0x33e025||0xcc;return function(_0x20ea54){if(_0x20ea54){return _0x44b0f6['sendStatus'](_0x33e025);}return _0x44b0f6[_0x6f9a('0x2b')](_0x33e025)[_0x6f9a('0x2c')]();};}function respondWithResult(_0xcf9b74,_0x2bef65){_0x2bef65=_0x2bef65||0xc8;return function(_0x472e4e){if(_0x472e4e){return _0xcf9b74[_0x6f9a('0x2b')](_0x2bef65)[_0x6f9a('0x2d')](_0x472e4e);}};}function respondWithFilteredResult(_0x17906b,_0x7ac25b){return function(_0x307ca9){if(_0x307ca9){var _0x1d78f2=_0x307ca9[_0x6f9a('0x2e')],_0x61f683=_0x7ac25b[_0x6f9a('0x2f')],_0x55dc1d=_0x7ac25b[_0x6f9a('0x2f')]+_0x7ac25b[_0x6f9a('0x30')],_0x419508;if(_0x55dc1d>=_0x1d78f2){_0x55dc1d=_0x1d78f2;_0x419508=0xc8;}else{_0x419508=0xce;}_0x17906b['status'](_0x419508);return _0x17906b[_0x6f9a('0x31')](_0x6f9a('0x32'),_0x61f683+'-'+_0x55dc1d+'/'+_0x1d78f2)[_0x6f9a('0x2d')](_0x307ca9);}return null;};}function patchUpdates(_0x965b72){return function(_0x4ecfc6){try{jsonpatch[_0x6f9a('0x33')](_0x4ecfc6,_0x965b72,!![]);}catch(_0x39c742){return BPromise[_0x6f9a('0x34')](_0x39c742);}return _0x4ecfc6['save']();};}function saveUpdates(_0x13165d,_0x130c40){return function(_0x52e7d0){if(_0x52e7d0){return _0x52e7d0[_0x6f9a('0x35')](_0x13165d)[_0x6f9a('0x22')](function(_0x47546f){return _0x47546f;});}return null;};}function removeEntity(_0x18dc88,_0x1bf8ec){return function(_0x289fcd){if(_0x289fcd){return _0x289fcd[_0x6f9a('0x36')]()['then'](function(){var _0xf98bb6=_0x289fcd[_0x6f9a('0x37')]({'plain':!![]});var _0x128b60=[{'name':_0x6f9a('0x38'),'value':_0x6f9a('0x39'),'ignore':!![]},{'name':_0x6f9a('0x3a'),'value':_0x6f9a('0x3b'),'ignore':![]},{'name':_0x6f9a('0x3c'),'value':'telephone','ignore':![]}];var _0x5f9390=_(_0x128b60)[_0x6f9a('0x3d')](_0x6f9a('0x3e'))[_0x6f9a('0x3f')](_0x6f9a('0x40'))['value']();if(_[_0x6f9a('0x41')](_0x5f9390,_0xf98bb6['role'])){return;}var _0x1be6f6=_['find'](_0x128b60,[_0x6f9a('0x40'),_0xf98bb6[_0x6f9a('0x42')]])[_0x6f9a('0x43')];return db[_0x6f9a('0x44')][_0x6f9a('0x36')]({'where':{'type':_0x1be6f6,'resourceId':_0xf98bb6['id']}})['then'](function(){return _0x289fcd;});})[_0x6f9a('0x22')](function(){_0x18dc88['status'](0xcc)[_0x6f9a('0x2c')]();});}};}function handleEntityNotFound(_0x197a98,_0x35ae9e){return function(_0x4bd785){if(!_0x4bd785){_0x197a98['sendStatus'](0x194);}return _0x4bd785;};}function handleError(_0x9b95ac,_0x3020d8){_0x3020d8=_0x3020d8||0x1f4;return function(_0x222728){logger[_0x6f9a('0x26')](_0x222728[_0x6f9a('0x45')]);if(_0x222728[_0x6f9a('0x43')]){delete _0x222728['name'];}_0x9b95ac[_0x6f9a('0x2b')](_0x3020d8)[_0x6f9a('0x46')](_0x222728);};}exports[_0x6f9a('0x47')]=function(_0x16b031,_0x172c03){var _0x24ab8c={},_0x48edcb={},_0x519b32={'count':0x0,'rows':[]};var _0x40af33=_['map'](db[_0x6f9a('0x48')]['rawAttributes'],function(_0x123b2a){return{'name':_0x123b2a[_0x6f9a('0x49')],'type':_0x123b2a[_0x6f9a('0x4a')]['key']};});_0x48edcb[_0x6f9a('0x4b')]=_['differenceBy'](_[_0x6f9a('0x3f')](_0x40af33,_0x6f9a('0x43')),['password',_0x6f9a('0x4c')]);_0x48edcb['query']=_[_0x6f9a('0x4d')](_0x16b031[_0x6f9a('0x4e')]);_0x48edcb[_0x6f9a('0x4f')]=_[_0x6f9a('0x50')](_0x48edcb['model'],_0x48edcb[_0x6f9a('0x4e')]);_0x24ab8c[_0x6f9a('0x51')]=_[_0x6f9a('0x50')](_0x48edcb[_0x6f9a('0x4b')],qs['fields'](_0x16b031['query'][_0x6f9a('0x52')]));_0x24ab8c[_0x6f9a('0x51')]=_0x24ab8c[_0x6f9a('0x51')][_0x6f9a('0x53')]?_0x24ab8c[_0x6f9a('0x51')]:_0x48edcb['model'];if(!_0x16b031[_0x6f9a('0x4e')][_0x6f9a('0x54')](_0x6f9a('0x55'))){_0x24ab8c[_0x6f9a('0x30')]=qs['limit'](_0x16b031[_0x6f9a('0x4e')]['limit']);_0x24ab8c['offset']=qs[_0x6f9a('0x2f')](_0x16b031[_0x6f9a('0x4e')][_0x6f9a('0x2f')]);}_0x24ab8c[_0x6f9a('0x56')]=qs[_0x6f9a('0x57')](_0x16b031[_0x6f9a('0x4e')][_0x6f9a('0x57')]);_0x24ab8c[_0x6f9a('0x58')]=qs[_0x6f9a('0x4f')](_[_0x6f9a('0x59')](_0x16b031['query'],_0x48edcb[_0x6f9a('0x4f')]),_0x40af33);if(_0x16b031['query'][_0x6f9a('0x3d')]){_0x24ab8c['where']=_[_0x6f9a('0x5a')](_0x24ab8c[_0x6f9a('0x58')],{'$or':_[_0x6f9a('0x3f')](_0x40af33,function(_0x901816){if(_0x901816[_0x6f9a('0x4a')]!==_0x6f9a('0x5b')){return db[_0x6f9a('0x5c')][_0x6f9a('0x58')](db['sequelize']['fn'](_0x6f9a('0x5d'),db['sequelize'][_0x6f9a('0x5e')](_0x901816[_0x6f9a('0x43')])),{'$like':db[_0x6f9a('0x5c')]['fn']('lower','%'+_0x16b031['query'][_0x6f9a('0x3d')]+'%')});}})});}_0x24ab8c=_[_0x6f9a('0x5a')]({},_0x24ab8c,_0x16b031[_0x6f9a('0x5f')]);var _0x1ed640={'where':_0x24ab8c['where']};return db[_0x6f9a('0x48')][_0x6f9a('0x2e')](_0x1ed640)[_0x6f9a('0x22')](function(_0x3e4041){_0x519b32['count']=_0x3e4041;if(_0x16b031[_0x6f9a('0x4e')][_0x6f9a('0x60')]){_0x24ab8c['include']=[{'all':!![]}];}return db['User']['findAll'](_0x24ab8c);})[_0x6f9a('0x22')](function(_0x5a4b01){_0x519b32['rows']=_0x5a4b01;return _0x519b32;})[_0x6f9a('0x22')](respondWithFilteredResult(_0x172c03,_0x24ab8c))[_0x6f9a('0x61')](handleError(_0x172c03,null));};exports['show']=function(_0x4d6ab0,_0x3a5cba){var _0x2ab35c={'raw':![],'where':{'id':_0x4d6ab0[_0x6f9a('0x62')]['id']}},_0x48eb0c={};_0x48eb0c[_0x6f9a('0x4b')]=_[_0x6f9a('0x63')](_['keys'](db[_0x6f9a('0x48')]['rawAttributes']),[_0x6f9a('0x64'),'salt']);_0x48eb0c[_0x6f9a('0x4e')]=_[_0x6f9a('0x4d')](_0x4d6ab0[_0x6f9a('0x4e')]);_0x48eb0c[_0x6f9a('0x4f')]=_[_0x6f9a('0x50')](_0x48eb0c['model'],_0x48eb0c[_0x6f9a('0x4e')]);_0x2ab35c['attributes']=_[_0x6f9a('0x50')](_0x48eb0c['model'],qs[_0x6f9a('0x52')](_0x4d6ab0[_0x6f9a('0x4e')][_0x6f9a('0x52')]));_0x2ab35c['attributes']=_0x2ab35c[_0x6f9a('0x51')][_0x6f9a('0x53')]?_0x2ab35c['attributes']:_0x48eb0c[_0x6f9a('0x4b')];if(_0x4d6ab0[_0x6f9a('0x4e')]['includeAll']){_0x2ab35c['include']=[{'all':!![]}];}_0x2ab35c=_[_0x6f9a('0x5a')]({},_0x2ab35c,_0x4d6ab0[_0x6f9a('0x5f')]);return db[_0x6f9a('0x48')][_0x6f9a('0x65')](_0x2ab35c)[_0x6f9a('0x22')](handleEntityNotFound(_0x3a5cba,null))[_0x6f9a('0x22')](respondWithResult(_0x3a5cba,null))[_0x6f9a('0x61')](handleError(_0x3a5cba,null));};exports[_0x6f9a('0x66')]=function(_0x14c274,_0x45f6bd){return db[_0x6f9a('0x48')][_0x6f9a('0x66')](_0x14c274['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x45f6bd,0xc9))[_0x6f9a('0x61')](handleError(_0x45f6bd,null));};exports[_0x6f9a('0x35')]=function(_0x556f69,_0x1cbd9f){if(_0x556f69[_0x6f9a('0x67')]['id']){delete _0x556f69[_0x6f9a('0x67')]['id'];}delete _0x556f69[_0x6f9a('0x67')][_0x6f9a('0x42')];return db[_0x6f9a('0x48')][_0x6f9a('0x65')]({'where':{'id':_0x556f69[_0x6f9a('0x62')]['id']}})['then'](handleEntityNotFound(_0x1cbd9f,null))[_0x6f9a('0x22')](saveUpdates(_0x556f69[_0x6f9a('0x67')],null))['then'](respondWithResult(_0x1cbd9f,null))[_0x6f9a('0x61')](handleError(_0x1cbd9f,null));};exports[_0x6f9a('0x68')]=function(_0x387c6a,_0x771bba){return db['User'][_0x6f9a('0x68')]()['then'](respondWithResult(_0x771bba,null))[_0x6f9a('0x61')](handleError(_0x771bba,null));};exports[_0x6f9a('0x69')]=function(_0x3b6a74,_0x5ec741,_0x599c5c){return db[_0x6f9a('0x48')][_0x6f9a('0x65')]({'where':{'id':_0x3b6a74[_0x6f9a('0x62')]['id']}})['then'](handleEntityNotFound(_0x5ec741,null))[_0x6f9a('0x22')](function(_0x3c220a){if(_0x3c220a){return _0x3c220a[_0x6f9a('0x69')](_0x3b6a74[_0x6f9a('0x67')][_0x6f9a('0x6a')],_['omit'](_0x3b6a74[_0x6f9a('0x67')],[_0x6f9a('0x6a'),'id'])||{});}})[_0x6f9a('0x22')](respondWithResult(_0x5ec741,null))[_0x6f9a('0x61')](handleError(_0x5ec741,null));};var getLicense=function(_0x2fda){return new BPromise(function(_0x202311,_0x3311db){var _0x4bd25a=0x0;_0x2fda[_0x6f9a('0x67')][_0x6f9a('0x42')]===_0x6f9a('0x3b')&&_0x202311(_0x6f9a('0x6b'));return db['User'][_0x6f9a('0x2e')]({'where':{'$or':[{'role':_0x2fda[_0x6f9a('0x67')][_0x6f9a('0x42')]===_0x6f9a('0x6c')?_0x6f9a('0x6c'):[_0x6f9a('0x6d'),_0x6f9a('0x39')]}]}})['then'](function(_0x52cd07){_0x4bd25a=_0x52cd07;return require(_0x6f9a('0x6e'))[_0x6f9a('0x6f')]();})[_0x6f9a('0x22')](function(_0x51bff1){var _0x12aea7=_0x2fda[_0x6f9a('0x67')]['role']===_0x6f9a('0x6c')?_0x6f9a('0x70'):'users';if(!_[_0x6f9a('0x71')](_0x51bff1[_0x12aea7])&&_0x4bd25a>=_0x51bff1[_0x12aea7]){return _0x3311db({'message':'License\x20limit\x20reached'});}return _0x202311(util['format']('count\x20%s:\x20%s',_0x12aea7,_0x4bd25a));})[_0x6f9a('0x61')](function(_0x15a19e){return _0x3311db(_0x15a19e);});});};exports['create']=function(_0x6a3b9d,_0x3b80dc){return getLicense(_0x6a3b9d)[_0x6f9a('0x22')](function(_0x1d1f0e){if(!_0x6a3b9d[_0x6f9a('0x67')][_0x6f9a('0x72')]){var _0x2da6d0;return db['Setting'][_0x6f9a('0x73')](0x1)[_0x6f9a('0x22')](function(_0x49944d){return checkPasswordPattern(_0x49944d,_0x6a3b9d[_0x6f9a('0x67')][_0x6f9a('0x64')],_0x49944d[_0x6f9a('0x74')]);})['then'](function(_0x16b12a){_0x2da6d0=_0x16b12a[_0x6f9a('0x75')];return db['User']['max']('internal');})[_0x6f9a('0x22')](function(_0x5517b2){if(_[_0x6f9a('0x71')](_0x5517b2)){if(_0x2da6d0){_0x6a3b9d[_0x6f9a('0x67')][_0x6f9a('0x72')]=_0x2da6d0;}else{_0x6a3b9d[_0x6f9a('0x67')][_0x6f9a('0x72')]=0x1;}}else{if(_[_0x6f9a('0x71')](_0x2da6d0)||_0x2da6d0==_0x5517b2){_0x6a3b9d[_0x6f9a('0x67')]['internal']=_0x5517b2+0x1;}else if(_0x2da6d0>_0x5517b2){_0x6a3b9d[_0x6f9a('0x67')][_0x6f9a('0x72')]=_0x2da6d0;}else{return db['sequelize']['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x6f9a('0x5c')][_0x6f9a('0x76')][_0x6f9a('0x77')]})['then'](function(_0xa3fbb0){if(_0xa3fbb0&&_0xa3fbb0[_0x6f9a('0x53')]){for(var _0x39a7df=0x0,_0x3851a0=_0xa3fbb0[_0x6f9a('0x53')];_0x39a7df<_0x3851a0&&_[_0x6f9a('0x71')](_0x6a3b9d[_0x6f9a('0x67')]['internal']);_0x39a7df++){if(_0x2da6d0<=_0xa3fbb0[_0x39a7df][_0x6f9a('0x78')]){_0x6a3b9d['body'][_0x6f9a('0x72')]=_0xa3fbb0[_0x39a7df]['from'];}else if(_0x2da6d0>_0xa3fbb0[_0x39a7df]['from']&&_0x2da6d0<=_0xa3fbb0[_0x39a7df]['to']){_0x6a3b9d[_0x6f9a('0x67')][_0x6f9a('0x72')]=_0x2da6d0;}}}if(_[_0x6f9a('0x71')](_0x6a3b9d[_0x6f9a('0x67')][_0x6f9a('0x72')])){_0x6a3b9d[_0x6f9a('0x67')]['internal']=_0x5517b2+0x1;}});}}});}})[_0x6f9a('0x22')](function(){if(_0x6a3b9d['body']['voicemail']){_0x6a3b9d[_0x6f9a('0x67')][_0x6f9a('0x79')]=_0x6a3b9d['body']['internal'];_0x6a3b9d[_0x6f9a('0x67')][_0x6f9a('0x7a')]={'mailbox':_0x6a3b9d[_0x6f9a('0x67')]['internal'],'password':_0x6a3b9d[_0x6f9a('0x67')][_0x6f9a('0x64')],'fullname':_0x6a3b9d[_0x6f9a('0x67')][_0x6f9a('0x7b')],'email':_0x6a3b9d[_0x6f9a('0x67')][_0x6f9a('0x7c')]};}if(_0x6a3b9d[_0x6f9a('0x67')]&&_0x6a3b9d[_0x6f9a('0x67')][_0x6f9a('0x42')]===_0x6f9a('0x3b')){if(!_0x6a3b9d['body'][_0x6f9a('0x7d')]){_0x6a3b9d['body'][_0x6f9a('0x7d')]=['101',_0x6f9a('0x7e'),_0x6f9a('0x7f'),'113','110',_0x6f9a('0x80'),_0x6f9a('0x81'),_0x6f9a('0x82'),'107',_0x6f9a('0x83'),_0x6f9a('0x84'),_0x6f9a('0x85'),'111',_0x6f9a('0x86')];}}return db[_0x6f9a('0x48')][_0x6f9a('0x87')](_0x6a3b9d['body'],{'include':[{'model':db[_0x6f9a('0x7a')],'as':'VoiceMail'}]});})[_0x6f9a('0x22')](function(_0x420021){if(_0x6a3b9d[_0x6f9a('0x67')][_0x6f9a('0x42')]===_0x6f9a('0x39'))return _0x420021;var _0x2c5d0d=_0x6a3b9d[_0x6f9a('0x39')][_0x6f9a('0x37')]({'plain':!![]});if(!_0x2c5d0d)throw new Error(_0x6f9a('0x88'));if(_0x2c5d0d['role']===_0x6f9a('0x39')){var _0x3bcecb=_0x420021[_0x6f9a('0x37')]({'plain':!![]});var _0x51058f=[{'name':_0x6f9a('0x3a'),'value':_0x6f9a('0x3b')},{'name':_0x6f9a('0x3c'),'value':_0x6f9a('0x6c')}];var _0x3f880f=_['find'](_0x51058f,[_0x6f9a('0x40'),_0x3bcecb[_0x6f9a('0x42')]])[_0x6f9a('0x43')];return db[_0x6f9a('0x89')][_0x6f9a('0x65')]({'where':{'name':_0x3f880f,'userProfileId':_0x2c5d0d['userProfileId']},'raw':!![]})[_0x6f9a('0x22')](function(_0x5284a0){if(_0x5284a0&&_0x5284a0[_0x6f9a('0x8a')]===0x0){return db['UserProfileResource'][_0x6f9a('0x87')]({'name':_0x3bcecb['name'],'resourceId':_0x3bcecb['id'],'type':_0x5284a0[_0x6f9a('0x43')],'sectionId':_0x5284a0['id']},{})['then'](function(){return _0x420021;});}else{return _0x420021;}})['catch'](function(_0x2faed8){logger[_0x6f9a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2faed8);throw _0x2faed8;});}return _0x420021;})[_0x6f9a('0x22')](respondWithResult(_0x3b80dc,0xc9))[_0x6f9a('0x61')](handleError(_0x3b80dc,null));};exports[_0x6f9a('0x8b')]=function(_0x295b7a,_0x371af2,_0x1e4c12){var _0x4de686=![];if(_0x295b7a[_0x6f9a('0x67')]['id']){delete _0x295b7a['body']['id'];}return db[_0x6f9a('0x8c')][_0x6f9a('0x8d')]({'attributes':['id',_0x6f9a('0x74')]})[_0x6f9a('0x22')](function(_0x2b0bea){_0x4de686=_0x2b0bea[_0x6f9a('0x74')];return db['User']['find']({'where':{'id':_0x295b7a[_0x6f9a('0x62')]['id']}});})[_0x6f9a('0x22')](function(_0x263fd0){if(_0x263fd0){if(_0x263fd0['id']==_0x295b7a[_0x6f9a('0x39')]['id']){if(!_0x295b7a[_0x6f9a('0x67')][_0x6f9a('0x8e')]||!_0x295b7a['body'][_0x6f9a('0x8f')]){throw new db[(_0x6f9a('0x20'))][(_0x6f9a('0x90'))]('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x263fd0[_0x6f9a('0x91')](_0x295b7a['body']['oldPassword'])){throw new db['Sequelize'][(_0x6f9a('0x90'))](_0x6f9a('0x92'));}if(_0x295b7a[_0x6f9a('0x67')]['oldPassword']==_0x295b7a[_0x6f9a('0x67')][_0x6f9a('0x8f')]){throw new db['Sequelize'][(_0x6f9a('0x90'))](_0x6f9a('0x93'));}return _0x263fd0;}else if(_0x295b7a['user'][_0x6f9a('0x42')]==_0x6f9a('0x6d')){if(!_0x295b7a[_0x6f9a('0x67')]['newPassword']){throw new db[(_0x6f9a('0x20'))][(_0x6f9a('0x90'))](_0x6f9a('0x94'));}return _0x263fd0;}else if(_0x295b7a[_0x6f9a('0x39')][_0x6f9a('0x42')]==_0x6f9a('0x39')){if(!_0x295b7a[_0x6f9a('0x67')][_0x6f9a('0x8f')]){throw new db[(_0x6f9a('0x20'))]['ValidationError'](_0x6f9a('0x94'));}if(_0x263fd0[_0x6f9a('0x42')]!=_0x6f9a('0x3b')){throw new db['Sequelize'][(_0x6f9a('0x90'))](_0x6f9a('0x95'));}return _0x263fd0;}else{throw new db[(_0x6f9a('0x20'))]['ValidationError'](_0x6f9a('0x95'));}}return null;})[_0x6f9a('0x22')](handleEntityNotFound(_0x371af2,null))[_0x6f9a('0x22')](function(_0x1652e1){return checkPasswordPattern(_0x1652e1,_0x295b7a[_0x6f9a('0x67')][_0x6f9a('0x8f')],_0x4de686);})['then'](saveUpdates({'password':_0x295b7a[_0x6f9a('0x67')]['newPassword'],'passwordResetAt':_0x295b7a[_0x6f9a('0x39')]['id']==_0x295b7a['params']['id']?moment():null},null))['then'](respondWithResult(_0x371af2,null))[_0x6f9a('0x61')](handleError(_0x371af2,null));};exports[_0x6f9a('0x96')]=function(_0x319cd8,_0x25afb0,_0x24a704){var _0x16bee2=_0x319cd8[_0x6f9a('0x67')]['channel'];return db['User'][_0x6f9a('0x65')]({'where':{'id':_0x319cd8['params']['id']},'attributes':['id','name',_0x6f9a('0x42'),_0x6f9a('0x97'),_0x6f9a('0x98'),_0x6f9a('0x99'),_0x6f9a('0x9a')]})[_0x6f9a('0x22')](handleEntityNotFound(_0x25afb0,null))[_0x6f9a('0x22')](function(_0x3d54b2){if(_0x3d54b2){if(!utils[_0x6f9a('0x9b')](_0x16bee2)){throw new db[(_0x6f9a('0x20'))][(_0x6f9a('0x90'))](_0x6f9a('0x9c'));}return _0x3d54b2[_0x6f9a('0x9d')+_[_0x6f9a('0x9e')](_0x16bee2[_0x6f9a('0x9f')]())+_0x6f9a('0xa0')](_0x319cd8[_0x6f9a('0x67')][_0x6f9a('0x6a')],{'penalty':_0x319cd8[_0x6f9a('0x67')]['penalty']||0x0})[_0x6f9a('0xa1')](function(_0x39fcef){for(var _0x50b6aa=0x0;_0x50b6aa<_0x319cd8[_0x6f9a('0x67')][_0x6f9a('0x6a')][_0x6f9a('0x53')];_0x50b6aa+=0x1){var _0x419e57={'UserId':_0x319cd8[_0x6f9a('0x62')]['id']};_0x419e57[_['capitalize'](_0x16bee2[_0x6f9a('0x9f')]())+_0x6f9a('0xa2')]=_0x319cd8['body'][_0x6f9a('0x6a')][_0x50b6aa];socket[_0x6f9a('0xa3')]('user'+_[_0x6f9a('0x9e')](_0x16bee2[_0x6f9a('0x9f')]())+'Queue:save',_0x419e57);}return _0x39fcef;})['then'](function(){if(_0x16bee2===_0x6f9a('0xa4')){return db[_0x6f9a('0xa5')][_0x6f9a('0xa6')]({'where':{'id':_0x319cd8[_0x6f9a('0x67')][_0x6f9a('0x6a')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x4be2f4){var _0x1ea8bc=_0x3d54b2[_0x6f9a('0x37')]({'plain':!![]});var _0x20d8b0=[];if(_0x16bee2===_0x6f9a('0xa4')&&_0x1ea8bc[_0x6f9a('0x42')]===_0x6f9a('0x3b')&&_0x1ea8bc[_0x6f9a('0x97')]){for(var _0x525c79=0x0;_0x525c79<_0x4be2f4[_0x6f9a('0x53')];_0x525c79+=0x1){_0x20d8b0[_0x6f9a('0xa7')]({'membername':_0x1ea8bc[_0x6f9a('0x43')],'UserId':_0x1ea8bc['id'],'queue_name':_0x4be2f4[_0x525c79]['name'],'VoiceQueueId':_0x4be2f4[_0x525c79]['id'],'interface':_[_0x6f9a('0x71')](_0x1ea8bc[_0x6f9a('0x9a')])?util[_0x6f9a('0xa8')]('SIP/%s',_0x1ea8bc[_0x6f9a('0x43')]):_0x1ea8bc[_0x6f9a('0x9a')],'paused':_0x1ea8bc[_0x6f9a('0x99')]||![],'penalty':_0x319cd8[_0x6f9a('0x67')]['penalty']||0x0});}return BPromise[_0x6f9a('0xa9')](_0x20d8b0,function(_0x2cf587){return db['UserVoiceQueueRt'][_0x6f9a('0xaa')](_0x2cf587);});}return _0x3d54b2;});}})[_0x6f9a('0x22')](respondWithStatusCode(_0x25afb0,null))[_0x6f9a('0x61')](handleError(_0x25afb0,null));};exports[_0x6f9a('0xab')]=function(_0xf8fd09,_0x6d8dfa,_0x4cf37e){var _0x130aad;return db[_0x6f9a('0x48')]['find']({'where':{'id':_0xf8fd09[_0x6f9a('0x62')]['id']},'attributes':['id','name',_0x6f9a('0x42')]})[_0x6f9a('0x22')](handleEntityNotFound(_0x6d8dfa,null))[_0x6f9a('0x22')](function(_0x5aba2b){if(_0x5aba2b){_0x130aad=_0x5aba2b;if(!_0xf8fd09[_0x6f9a('0x4e')]['channel']||!utils[_0x6f9a('0x9b')](_0xf8fd09['query'][_0x6f9a('0xac')])){throw new db[(_0x6f9a('0x20'))][(_0x6f9a('0x90'))]('Unknown\x20channel');}return _0x5aba2b[_0x6f9a('0xad')+_[_0x6f9a('0x9e')](_0xf8fd09[_0x6f9a('0x4e')][_0x6f9a('0xac')][_0x6f9a('0x9f')]())+_0x6f9a('0xa0')](_0xf8fd09[_0x6f9a('0x4e')]['ids']);}})[_0x6f9a('0x22')](function(_0x280b10){for(var _0x52e0d6=0x0;_0x52e0d6<_0xf8fd09[_0x6f9a('0x4e')][_0x6f9a('0x6a')]['length'];_0x52e0d6+=0x1){var _0x5de5c6={'UserId':_0xf8fd09[_0x6f9a('0x62')]['id']};_0x5de5c6[_[_0x6f9a('0x9e')](_0xf8fd09[_0x6f9a('0x4e')]['channel'][_0x6f9a('0x9f')]())+_0x6f9a('0xa2')]=_0xf8fd09[_0x6f9a('0x4e')][_0x6f9a('0x6a')][_0x52e0d6];socket[_0x6f9a('0xa3')](_0x6f9a('0x39')+_[_0x6f9a('0x9e')](_0xf8fd09[_0x6f9a('0x4e')]['channel'][_0x6f9a('0x9f')]())+_0x6f9a('0xae'),_0x5de5c6);}return _0x280b10;})[_0x6f9a('0x22')](function(){if(_0xf8fd09[_0x6f9a('0x4e')][_0x6f9a('0xac')]===_0x6f9a('0xa4')){return db[_0x6f9a('0xaf')][_0x6f9a('0x36')]({'where':{'UserId':_0xf8fd09[_0x6f9a('0x62')]['id'],'VoiceQueueId':_0xf8fd09[_0x6f9a('0x4e')][_0x6f9a('0x6a')]},'individualHooks':!![]})[_0x6f9a('0x22')](function(){return _0x130aad;});}return _0x130aad;})[_0x6f9a('0x22')](respondWithStatusCode(_0x6d8dfa,null))[_0x6f9a('0x61')](handleError(_0x6d8dfa,null));};exports['addAvatar']=function(_0x485696,_0x4923e7,_0x36801c){_0x485696[_0x6f9a('0x67')][_0x6f9a('0xb0')]=_0x485696[_0x6f9a('0xb1')]['filename'];return db[_0x6f9a('0x48')]['find']({'where':{'id':_0x485696['params']['id']}})['then'](handleEntityNotFound(_0x4923e7,null))['then'](saveUpdates(_0x485696['body'],null))['then'](respondWithResult(_0x4923e7,null))[_0x6f9a('0x61')](handleError(_0x4923e7,null));};exports['getAvatar']=function(_0x5a96f1,_0x2d35a3,_0x4260f3){var _0x12f573=path['join'](config[_0x6f9a('0xb2')],'server/files/images/logos/default_profile.png');return db[_0x6f9a('0x48')]['find']({'where':{'id':_0x5a96f1[_0x6f9a('0x62')]['id']},'attributes':['id',_0x6f9a('0xb0')],'raw':!![]})['then'](handleEntityNotFound(_0x2d35a3,null))[_0x6f9a('0x22')](function(_0x4b7968){if(_0x4b7968){if(_[_0x6f9a('0x71')](_0x4b7968[_0x6f9a('0xb0')])){return _0x2d35a3['download'](_0x12f573);}else{if(!fs[_0x6f9a('0xb3')](path[_0x6f9a('0xb4')](config[_0x6f9a('0xb2')],_0x6f9a('0xb5'),_0x4b7968['userpic']))){return _0x2d35a3[_0x6f9a('0xb6')](_0x12f573);}return _0x2d35a3[_0x6f9a('0xb6')](path[_0x6f9a('0xb4')](config['root'],_0x6f9a('0xb5'),_0x4b7968[_0x6f9a('0xb0')]));}}})[_0x6f9a('0x61')](handleError(_0x2d35a3,null));};exports[_0x6f9a('0xb7')]=function(_0x403ebb,_0x5a5611,_0x3dbe51){var _0x52c2ad={};var _0x1be31b={};var _0x2ad865;var _0x24861c;return db[_0x6f9a('0x48')][_0x6f9a('0x8d')]({'where':{'id':_0x403ebb['params']['id']}})[_0x6f9a('0x22')](handleEntityNotFound(_0x5a5611,null))[_0x6f9a('0x22')](function(_0x524355){if(_0x524355){_0x2ad865=_0x524355;_0x1be31b[_0x6f9a('0x4b')]=_[_0x6f9a('0x4d')](db[_0x6f9a('0xb8')]['rawAttributes']);_0x1be31b[_0x6f9a('0x4e')]=_[_0x6f9a('0x4d')](_0x403ebb[_0x6f9a('0x4e')]);_0x1be31b[_0x6f9a('0x4f')]=_[_0x6f9a('0x50')](_0x1be31b[_0x6f9a('0x4b')],_0x1be31b[_0x6f9a('0x4e')]);_0x52c2ad[_0x6f9a('0x51')]=_[_0x6f9a('0x50')](_0x1be31b[_0x6f9a('0x4b')],qs[_0x6f9a('0x52')](_0x403ebb[_0x6f9a('0x4e')]['fields']));_0x52c2ad[_0x6f9a('0x51')]=_0x52c2ad[_0x6f9a('0x51')]['length']?_0x52c2ad[_0x6f9a('0x51')]:_0x1be31b['model'];_0x52c2ad[_0x6f9a('0x56')]=qs[_0x6f9a('0x57')](_0x403ebb['query']['sort']);_0x52c2ad['where']=qs[_0x6f9a('0x4f')](_[_0x6f9a('0x59')](_0x403ebb[_0x6f9a('0x4e')],_0x1be31b[_0x6f9a('0x4f')]));if(_0x403ebb[_0x6f9a('0x4e')][_0x6f9a('0x3d')]){_0x52c2ad[_0x6f9a('0x58')]=_['merge'](_0x52c2ad[_0x6f9a('0x58')],{'$or':_[_0x6f9a('0x3f')](_0x52c2ad['attributes'],function(_0x2d37b9){var _0xdeab9={};_0xdeab9[_0x2d37b9]={'$like':'%'+_0x403ebb[_0x6f9a('0x4e')][_0x6f9a('0x3d')]+'%'};return _0xdeab9;})});}_0x52c2ad=_[_0x6f9a('0x5a')]({},_0x52c2ad,_0x403ebb[_0x6f9a('0x5f')]);return _0x2ad865[_0x6f9a('0xb7')](_0x52c2ad);}})[_0x6f9a('0x22')](function(_0x14b110){if(_0x14b110){_0x24861c=_0x14b110[_0x6f9a('0x53')];if(_0x403ebb[_0x6f9a('0x4e')][_0x6f9a('0x54')](_0x6f9a('0x60'))){_0x52c2ad[_0x6f9a('0xb9')]=[{'model':db[_0x6f9a('0xba')],'as':'List','required':![]},{'model':db[_0x6f9a('0xbb')],'as':_0x6f9a('0xbc'),'attributes':['id',_0x6f9a('0x43'),_0x6f9a('0xbd')],'where':_0x403ebb['query'][_0x6f9a('0xbe')]?{'id':_0x403ebb[_0x6f9a('0x4e')][_0x6f9a('0xbe')]}:undefined,'required':_0x403ebb[_0x6f9a('0x4e')][_0x6f9a('0xbe')]?!![]:![]}];}if(!_0x403ebb[_0x6f9a('0x4e')][_0x6f9a('0x54')](_0x6f9a('0x55'))){_0x52c2ad[_0x6f9a('0x30')]=qs[_0x6f9a('0x30')](_0x403ebb['query'][_0x6f9a('0x30')]);_0x52c2ad[_0x6f9a('0x2f')]=qs[_0x6f9a('0x2f')](_0x403ebb[_0x6f9a('0x4e')]['offset']);}return _0x2ad865[_0x6f9a('0xb7')](_0x52c2ad);}})[_0x6f9a('0x22')](function(_0x32b6ed){if(_0x32b6ed){return _0x32b6ed?{'count':_0x24861c,'rows':_0x32b6ed}:null;}})['then'](respondWithResult(_0x5a5611,null))[_0x6f9a('0x61')](handleError(_0x5a5611,null));};exports[_0x6f9a('0xbf')]=function(_0x9f96f0,_0x297b12,_0xdb1900){var _0x5d595a;var _0x525354;var _0x453e9f={};var _0x5d529e;return db['User']['findOne']({'where':{'id':_0x9f96f0[_0x6f9a('0x62')]['id']},'attributes':['id',_0x6f9a('0x43'),'role']})['then'](handleEntityNotFound(_0x297b12,null))[_0x6f9a('0x22')](function(_0x9aff8d){if(!utils[_0x6f9a('0x9b')](_0x9f96f0['query'][_0x6f9a('0xac')])){throw new db['Sequelize'][(_0x6f9a('0x90'))](_0x6f9a('0x9c'));}_0x5d595a=_0x9aff8d;var _0x353a04={};_0x353a04['model']=_[_0x6f9a('0x4d')](db[_[_0x6f9a('0x9e')](_0x9f96f0[_0x6f9a('0x4e')][_0x6f9a('0xac')])+_0x6f9a('0xc0')][_0x6f9a('0xc1')]);_0x353a04[_0x6f9a('0x4e')]=_[_0x6f9a('0x4d')](_0x9f96f0[_0x6f9a('0x4e')]);_0x353a04[_0x6f9a('0x4f')]=_[_0x6f9a('0x50')](_0x353a04[_0x6f9a('0x4b')],_0x353a04['query']);_0x453e9f[_0x6f9a('0x51')]=_[_0x6f9a('0x50')](_0x353a04[_0x6f9a('0x4b')],qs[_0x6f9a('0x52')](_0x9f96f0[_0x6f9a('0x4e')][_0x6f9a('0x52')]));_0x453e9f[_0x6f9a('0x51')]=_0x453e9f[_0x6f9a('0x51')][_0x6f9a('0x53')]?_0x453e9f[_0x6f9a('0x51')]:_0x353a04[_0x6f9a('0x4b')];_0x453e9f[_0x6f9a('0x56')]=qs[_0x6f9a('0x57')](_0x9f96f0[_0x6f9a('0x4e')][_0x6f9a('0x57')]);_0x453e9f[_0x6f9a('0x58')]=qs[_0x6f9a('0x4f')](_[_0x6f9a('0x59')](_0x9f96f0[_0x6f9a('0x4e')],_0x353a04['filters']));if(_0x9f96f0['query'][_0x6f9a('0x3d')]){_0x453e9f[_0x6f9a('0x58')]=_['merge'](_0x453e9f[_0x6f9a('0x58')],{'$or':_[_0x6f9a('0x3f')](_0x453e9f[_0x6f9a('0x51')],function(_0x2ef799){var _0x5bbdb1={};_0x5bbdb1[_0x2ef799]={'$like':'%'+_0x9f96f0['query'][_0x6f9a('0x3d')]+'%'};return _0x5bbdb1;})});}_0x453e9f=_[_0x6f9a('0x5a')]({},_0x453e9f,_0x9f96f0['options']);switch(_0x5d595a[_0x6f9a('0x42')]){case'admin':return db[_[_0x6f9a('0x9e')](_0x9f96f0[_0x6f9a('0x4e')][_0x6f9a('0xac')])+'Queue'][_0x6f9a('0xa6')](_0x453e9f);case _0x6f9a('0x39'):case _0x6f9a('0x3b'):return _0x5d595a[_0x6f9a('0x37')+_[_0x6f9a('0x9e')](_0x9f96f0[_0x6f9a('0x4e')][_0x6f9a('0xac')])+'Queues'](_0x453e9f);default:throw new db[(_0x6f9a('0x20'))][(_0x6f9a('0x90'))](_0x6f9a('0xc2'));}})[_0x6f9a('0x22')](function(_0x54bc3b){_0x5d529e=_0x54bc3b[_0x6f9a('0x53')];if(!_0x9f96f0[_0x6f9a('0x4e')][_0x6f9a('0x54')]('nolimit')){_0x453e9f[_0x6f9a('0x30')]=qs[_0x6f9a('0x30')](_0x9f96f0['query'][_0x6f9a('0x30')]);_0x453e9f['offset']=qs[_0x6f9a('0x2f')](_0x9f96f0[_0x6f9a('0x4e')][_0x6f9a('0x2f')]);}switch(_0x5d595a[_0x6f9a('0x42')]){case _0x6f9a('0x6d'):return db[_['capitalize'](_0x9f96f0[_0x6f9a('0x4e')]['channel'])+_0x6f9a('0xc0')][_0x6f9a('0xa6')](_0x453e9f);case _0x6f9a('0x39'):case _0x6f9a('0x3b'):return _0x5d595a[_0x6f9a('0x37')+_[_0x6f9a('0x9e')](_0x9f96f0[_0x6f9a('0x4e')][_0x6f9a('0xac')])+'Queues'](_0x453e9f);}})[_0x6f9a('0x22')](function(_0xc99ddd){return{'count':_0x5d529e,'rows':_0xc99ddd};})['then'](respondWithResult(_0x297b12,null))[_0x6f9a('0x61')](handleError(_0x297b12,null));};exports[_0x6f9a('0xc3')]=function(_0x59389d,_0x15c3fe,_0x199013){var _0x2af1bc={};var _0xd1b071={};var _0x200487;var _0x3c5a37;return db[_0x6f9a('0x48')][_0x6f9a('0x8d')]({'where':{'id':_0x59389d[_0x6f9a('0x62')]['id']}})[_0x6f9a('0x22')](handleEntityNotFound(_0x15c3fe,null))[_0x6f9a('0x22')](function(_0x267580){if(_0x267580){_0x200487=_0x267580;_0xd1b071[_0x6f9a('0x4b')]=_[_0x6f9a('0x4d')](db[_0x6f9a('0xaf')][_0x6f9a('0xc1')]);_0xd1b071[_0x6f9a('0x4e')]=_['keys'](_0x59389d[_0x6f9a('0x4e')]);_0xd1b071[_0x6f9a('0x4f')]=_[_0x6f9a('0x50')](_0xd1b071[_0x6f9a('0x4b')],_0xd1b071['query']);_0x2af1bc['attributes']=_[_0x6f9a('0x50')](_0xd1b071['model'],qs[_0x6f9a('0x52')](_0x59389d[_0x6f9a('0x4e')][_0x6f9a('0x52')]));_0x2af1bc[_0x6f9a('0x51')]=_0x2af1bc[_0x6f9a('0x51')][_0x6f9a('0x53')]?_0x2af1bc[_0x6f9a('0x51')]:_0xd1b071[_0x6f9a('0x4b')];_0x2af1bc[_0x6f9a('0x56')]=qs[_0x6f9a('0x57')](_0x59389d['query'][_0x6f9a('0x57')]);_0x2af1bc[_0x6f9a('0x58')]=qs['filters'](_[_0x6f9a('0x59')](_0x59389d['query'],_0xd1b071[_0x6f9a('0x4f')]));if(_0x59389d[_0x6f9a('0x4e')]['filter']){_0x2af1bc['where']=_[_0x6f9a('0x5a')](_0x2af1bc[_0x6f9a('0x58')],{'$or':_['map'](_0x2af1bc[_0x6f9a('0x51')],function(_0x12d230){var _0x4a992c={};_0x4a992c[_0x12d230]={'$like':'%'+_0x59389d[_0x6f9a('0x4e')]['filter']+'%'};return _0x4a992c;})});}_0x2af1bc=_['merge']({},_0x2af1bc,_0x59389d[_0x6f9a('0x5f')]);return _0x200487[_0x6f9a('0xc3')](_0x2af1bc);}})[_0x6f9a('0x22')](function(_0x1aae0b){if(_0x1aae0b){_0x3c5a37=_0x1aae0b[_0x6f9a('0x53')];if(!_0x59389d[_0x6f9a('0x4e')][_0x6f9a('0x54')](_0x6f9a('0x55'))){_0x2af1bc[_0x6f9a('0x30')]=qs['limit'](_0x59389d[_0x6f9a('0x4e')][_0x6f9a('0x30')]);_0x2af1bc[_0x6f9a('0x2f')]=qs[_0x6f9a('0x2f')](_0x59389d[_0x6f9a('0x4e')][_0x6f9a('0x2f')]);}return _0x200487[_0x6f9a('0xc3')](_0x2af1bc);}})[_0x6f9a('0x22')](function(_0x4617ab){if(_0x4617ab){return _0x4617ab?{'count':_0x3c5a37,'rows':_0x4617ab}:null;}})['then'](respondWithResult(_0x15c3fe,null))[_0x6f9a('0x61')](handleError(_0x15c3fe,null));};exports['getGroups']=function(_0x4de8d4,_0x3c72bd,_0x9d18a4){var _0x2f607a={};var _0x345a01={};var _0xb3767;var _0x3ed56b;return db['User'][_0x6f9a('0x8d')]({'where':{'id':_0x4de8d4['params']['id']}})[_0x6f9a('0x22')](handleEntityNotFound(_0x3c72bd,null))[_0x6f9a('0x22')](function(_0x4514ba){if(_0x4514ba){_0xb3767=_0x4514ba;_0x345a01[_0x6f9a('0x4b')]=_['keys'](db[_0x6f9a('0xc4')][_0x6f9a('0xc1')]);_0x345a01['query']=_['keys'](_0x4de8d4['query']);_0x345a01[_0x6f9a('0x4f')]=_['intersection'](_0x345a01[_0x6f9a('0x4b')],_0x345a01[_0x6f9a('0x4e')]);_0x2f607a['attributes']=_['intersection'](_0x345a01[_0x6f9a('0x4b')],qs['fields'](_0x4de8d4[_0x6f9a('0x4e')][_0x6f9a('0x52')]));_0x2f607a[_0x6f9a('0x51')]=_0x2f607a['attributes']['length']?_0x2f607a[_0x6f9a('0x51')]:_0x345a01[_0x6f9a('0x4b')];_0x2f607a[_0x6f9a('0x56')]=qs[_0x6f9a('0x57')](_0x4de8d4[_0x6f9a('0x4e')]['sort']);_0x2f607a[_0x6f9a('0x58')]=qs[_0x6f9a('0x4f')](_['pick'](_0x4de8d4['query'],_0x345a01['filters']));if(_0x4de8d4['query'][_0x6f9a('0x3d')]){_0x2f607a[_0x6f9a('0x58')]=_[_0x6f9a('0x5a')](_0x2f607a[_0x6f9a('0x58')],{'$or':_[_0x6f9a('0x3f')](_0x2f607a[_0x6f9a('0x51')],function(_0x45873d){var _0x4d2bfa={};_0x4d2bfa[_0x45873d]={'$like':'%'+_0x4de8d4['query'][_0x6f9a('0x3d')]+'%'};return _0x4d2bfa;})});}_0x2f607a=_['merge']({},_0x2f607a,_0x4de8d4[_0x6f9a('0x5f')]);return _0xb3767[_0x6f9a('0xc5')](_0x2f607a);}})[_0x6f9a('0x22')](function(_0x15426d){if(_0x15426d){_0x3ed56b=_0x15426d[_0x6f9a('0x53')];if(!_0x4de8d4['query'][_0x6f9a('0x54')]('nolimit')){_0x2f607a[_0x6f9a('0x30')]=qs['limit'](_0x4de8d4['query'][_0x6f9a('0x30')]);_0x2f607a[_0x6f9a('0x2f')]=qs['offset'](_0x4de8d4[_0x6f9a('0x4e')][_0x6f9a('0x2f')]);}return _0xb3767['getGroups'](_0x2f607a);}})['then'](function(_0x594002){if(_0x594002){return _0x594002?{'count':_0x3ed56b,'rows':_0x594002}:null;}})[_0x6f9a('0x22')](respondWithResult(_0x3c72bd,null))[_0x6f9a('0x61')](handleError(_0x3c72bd,null));};exports[_0x6f9a('0xc6')]=function(_0x5cf4e8,_0xb79da2,_0x4dc5e2){var _0x231af6={'raw':!![],'where':{}};var _0x588f68={};var _0x31ed09={'count':0x0,'rows':[]};return db[_0x6f9a('0x48')]['findOne']({'where':{'id':_0x5cf4e8['params']['id']}})[_0x6f9a('0x22')](handleEntityNotFound(_0xb79da2,null))[_0x6f9a('0x22')](function(_0x293659){if(_0x293659){_0x588f68[_0x6f9a('0x4b')]=_[_0x6f9a('0x4d')](db[_0x6f9a('0xc7')][_0x6f9a('0xc1')]);_0x588f68[_0x6f9a('0x4e')]=_[_0x6f9a('0x4d')](_0x5cf4e8[_0x6f9a('0x4e')]);_0x588f68[_0x6f9a('0x4f')]=_['intersection'](_0x588f68['model'],_0x588f68[_0x6f9a('0x4e')]);_0x231af6['attributes']=_['intersection'](_0x588f68['model'],qs[_0x6f9a('0x52')](_0x5cf4e8[_0x6f9a('0x4e')]['fields']));_0x231af6[_0x6f9a('0x51')]=_0x231af6[_0x6f9a('0x51')]['length']?_0x231af6[_0x6f9a('0x51')]:_0x588f68[_0x6f9a('0x4b')];if(!_0x5cf4e8[_0x6f9a('0x4e')][_0x6f9a('0x54')](_0x6f9a('0x55'))){_0x231af6[_0x6f9a('0x30')]=qs[_0x6f9a('0x30')](_0x5cf4e8[_0x6f9a('0x4e')][_0x6f9a('0x30')]);_0x231af6[_0x6f9a('0x2f')]=qs[_0x6f9a('0x2f')](_0x5cf4e8[_0x6f9a('0x4e')]['offset']);}_0x231af6[_0x6f9a('0x56')]=qs[_0x6f9a('0x57')](_0x5cf4e8[_0x6f9a('0x4e')][_0x6f9a('0x57')]);_0x231af6[_0x6f9a('0x58')]=qs[_0x6f9a('0x4f')](_[_0x6f9a('0x59')](_0x5cf4e8['query'],_0x588f68[_0x6f9a('0x4f')]));_0x231af6[_0x6f9a('0x58')][_0x6f9a('0xc8')]=_0x293659['id'];if(_0x5cf4e8[_0x6f9a('0x4e')]['filter']){_0x231af6[_0x6f9a('0x58')]=_[_0x6f9a('0x5a')](_0x231af6['where'],{'$or':_[_0x6f9a('0x3f')](_0x231af6[_0x6f9a('0x51')],function(_0x557d5d){var _0x57fadd={};_0x57fadd[_0x557d5d]={'$like':'%'+_0x5cf4e8[_0x6f9a('0x4e')][_0x6f9a('0x3d')]+'%'};return _0x57fadd;})});}_0x231af6=_[_0x6f9a('0x5a')]({},_0x231af6,_0x5cf4e8[_0x6f9a('0x5f')]);return db[_0x6f9a('0xc7')][_0x6f9a('0x2e')]({'where':_0x231af6['where']})[_0x6f9a('0x22')](function(_0x4c9ea7){_0x31ed09[_0x6f9a('0x2e')]=_0x4c9ea7;if(_0x5cf4e8[_0x6f9a('0x4e')][_0x6f9a('0x60')]){_0x231af6[_0x6f9a('0xb9')]=[{'all':!![]}];}return db[_0x6f9a('0xc7')]['findAll'](_0x231af6);})[_0x6f9a('0x22')](function(_0xa956aa){_0x31ed09[_0x6f9a('0xc9')]=_0xa956aa;return _0x31ed09;});}})[_0x6f9a('0x22')](respondWithFilteredResult(_0xb79da2,_0x231af6))[_0x6f9a('0x61')](handleError(_0xb79da2,null));};exports[_0x6f9a('0xca')]=function(_0x49e19f,_0x1e02bd,_0x4e4841){var _0x13ec62={'raw':!![],'where':{}};var _0x408319={};var _0x1d2838={'count':0x0,'rows':[]};return db[_0x6f9a('0x48')][_0x6f9a('0x8d')]({'where':{'id':_0x49e19f[_0x6f9a('0x62')]['id']}})[_0x6f9a('0x22')](handleEntityNotFound(_0x1e02bd,null))[_0x6f9a('0x22')](function(_0x20675a){if(_0x20675a){_0x408319[_0x6f9a('0x4b')]=_[_0x6f9a('0x4d')](db[_0x6f9a('0xcb')][_0x6f9a('0xc1')]);_0x408319['query']=_[_0x6f9a('0x4d')](_0x49e19f[_0x6f9a('0x4e')]);_0x408319['filters']=_['intersection'](_0x408319[_0x6f9a('0x4b')],_0x408319[_0x6f9a('0x4e')]);_0x13ec62[_0x6f9a('0x51')]=_[_0x6f9a('0x50')](_0x408319['model'],qs[_0x6f9a('0x52')](_0x49e19f[_0x6f9a('0x4e')][_0x6f9a('0x52')]));_0x13ec62[_0x6f9a('0x51')]=_0x13ec62['attributes'][_0x6f9a('0x53')]?_0x13ec62[_0x6f9a('0x51')]:_0x408319['model'];if(!_0x49e19f[_0x6f9a('0x4e')][_0x6f9a('0x54')](_0x6f9a('0x55'))){_0x13ec62[_0x6f9a('0x30')]=qs[_0x6f9a('0x30')](_0x49e19f['query'][_0x6f9a('0x30')]);_0x13ec62[_0x6f9a('0x2f')]=qs[_0x6f9a('0x2f')](_0x49e19f['query'][_0x6f9a('0x2f')]);}_0x13ec62[_0x6f9a('0x56')]=qs[_0x6f9a('0x57')](_0x49e19f[_0x6f9a('0x4e')][_0x6f9a('0x57')]);_0x13ec62['where']=qs[_0x6f9a('0x4f')](_[_0x6f9a('0x59')](_0x49e19f[_0x6f9a('0x4e')],_0x408319['filters']));_0x13ec62[_0x6f9a('0x58')]['UserId']=_0x20675a['id'];if(_0x49e19f[_0x6f9a('0x4e')][_0x6f9a('0x3d')]){_0x13ec62[_0x6f9a('0x58')]=_['merge'](_0x13ec62[_0x6f9a('0x58')],{'$or':_['map'](_0x13ec62[_0x6f9a('0x51')],function(_0x3cf244){var _0x360c1f={};_0x360c1f[_0x3cf244]={'$like':'%'+_0x49e19f[_0x6f9a('0x4e')][_0x6f9a('0x3d')]+'%'};return _0x360c1f;})});}_0x13ec62=_[_0x6f9a('0x5a')]({},_0x13ec62,_0x49e19f[_0x6f9a('0x5f')]);return db[_0x6f9a('0xcb')]['count']({'where':_0x13ec62[_0x6f9a('0x58')]})[_0x6f9a('0x22')](function(_0x1ddc06){_0x1d2838[_0x6f9a('0x2e')]=_0x1ddc06;if(_0x49e19f['query'][_0x6f9a('0x60')]){_0x13ec62['include']=[{'all':!![]}];}return db[_0x6f9a('0xcb')][_0x6f9a('0xa6')](_0x13ec62);})[_0x6f9a('0x22')](function(_0x464d5b){_0x1d2838[_0x6f9a('0xc9')]=_0x464d5b;return _0x1d2838;});}})[_0x6f9a('0x22')](respondWithFilteredResult(_0x1e02bd,_0x13ec62))[_0x6f9a('0x61')](handleError(_0x1e02bd,null));};exports['getChatInteractions']=function(_0x2a71f8,_0x619116,_0x3eb8eb){var _0x1bc5ea={};var _0x55f99d={};var _0x176736;var _0x5141af;return db[_0x6f9a('0x48')]['findOne']({'where':{'id':_0x2a71f8[_0x6f9a('0x62')]['id']}})[_0x6f9a('0x22')](handleEntityNotFound(_0x619116,null))[_0x6f9a('0x22')](function(_0x30a087){if(_0x30a087){_0x176736=_0x30a087;_0x55f99d[_0x6f9a('0x4b')]=_[_0x6f9a('0x4d')](db[_0x6f9a('0xcc')][_0x6f9a('0xc1')]);_0x55f99d['query']=_['keys'](_0x2a71f8['query']);_0x55f99d['filters']=_[_0x6f9a('0x50')](_0x55f99d['model'],_0x55f99d['query']);_0x1bc5ea[_0x6f9a('0x51')]=_[_0x6f9a('0x50')](_0x55f99d['model'],qs[_0x6f9a('0x52')](_0x2a71f8[_0x6f9a('0x4e')][_0x6f9a('0x52')]));_0x1bc5ea[_0x6f9a('0x51')]=_0x1bc5ea[_0x6f9a('0x51')][_0x6f9a('0x53')]?_0x1bc5ea[_0x6f9a('0x51')]:_0x55f99d[_0x6f9a('0x4b')];_0x1bc5ea['order']=qs[_0x6f9a('0x57')](_0x2a71f8['query'][_0x6f9a('0x57')]);_0x1bc5ea[_0x6f9a('0x58')]=qs[_0x6f9a('0x4f')](_[_0x6f9a('0x59')](_0x2a71f8[_0x6f9a('0x4e')],_0x55f99d[_0x6f9a('0x4f')]));if(_0x2a71f8[_0x6f9a('0x4e')][_0x6f9a('0x3d')]){_0x1bc5ea[_0x6f9a('0x58')]=_[_0x6f9a('0x5a')](_0x1bc5ea[_0x6f9a('0x58')],{'$or':_[_0x6f9a('0x3f')](_0x1bc5ea[_0x6f9a('0x51')],function(_0x3caaf9){var _0x24045f={};_0x24045f[_0x3caaf9]={'$like':'%'+_0x2a71f8[_0x6f9a('0x4e')]['filter']+'%'};return _0x24045f;})});}_0x1bc5ea=_['merge']({},_0x1bc5ea,_0x2a71f8[_0x6f9a('0x5f')]);return _0x176736[_0x6f9a('0xcd')](_0x1bc5ea);}})[_0x6f9a('0x22')](function(_0x40775f){if(_0x40775f){_0x5141af=_0x40775f[_0x6f9a('0x53')];if(!_0x2a71f8[_0x6f9a('0x4e')][_0x6f9a('0x54')](_0x6f9a('0x55'))){_0x1bc5ea[_0x6f9a('0x30')]=qs[_0x6f9a('0x30')](_0x2a71f8[_0x6f9a('0x4e')][_0x6f9a('0x30')]);_0x1bc5ea[_0x6f9a('0x2f')]=qs[_0x6f9a('0x2f')](_0x2a71f8['query'][_0x6f9a('0x2f')]);}return _0x176736[_0x6f9a('0xcd')](_0x1bc5ea);}})[_0x6f9a('0x22')](function(_0x1cd16c){if(_0x1cd16c){return _0x1cd16c?{'count':_0x5141af,'rows':_0x1cd16c}:null;}})[_0x6f9a('0x22')](respondWithResult(_0x619116,null))[_0x6f9a('0x61')](handleError(_0x619116,null));};exports[_0x6f9a('0xce')]=function(_0x3733a7,_0x429dc,_0x254013){var _0x3e0fc6={};var _0x26dffd={};var _0x2f5c92;var _0xd9badb;return db[_0x6f9a('0x48')][_0x6f9a('0x8d')]({'where':{'id':_0x3733a7[_0x6f9a('0x62')]['id']}})[_0x6f9a('0x22')](handleEntityNotFound(_0x429dc,null))[_0x6f9a('0x22')](function(_0x2874df){if(_0x2874df){_0x2f5c92=_0x2874df;_0x26dffd[_0x6f9a('0x4b')]=_[_0x6f9a('0x4d')](db['OpenchannelInteraction'][_0x6f9a('0xc1')]);_0x26dffd[_0x6f9a('0x4e')]=_[_0x6f9a('0x4d')](_0x3733a7[_0x6f9a('0x4e')]);_0x26dffd[_0x6f9a('0x4f')]=_['intersection'](_0x26dffd[_0x6f9a('0x4b')],_0x26dffd[_0x6f9a('0x4e')]);_0x3e0fc6[_0x6f9a('0x51')]=_[_0x6f9a('0x50')](_0x26dffd[_0x6f9a('0x4b')],qs[_0x6f9a('0x52')](_0x3733a7['query'][_0x6f9a('0x52')]));_0x3e0fc6[_0x6f9a('0x51')]=_0x3e0fc6[_0x6f9a('0x51')][_0x6f9a('0x53')]?_0x3e0fc6[_0x6f9a('0x51')]:_0x26dffd[_0x6f9a('0x4b')];_0x3e0fc6['order']=qs[_0x6f9a('0x57')](_0x3733a7[_0x6f9a('0x4e')][_0x6f9a('0x57')]);_0x3e0fc6['where']=qs[_0x6f9a('0x4f')](_[_0x6f9a('0x59')](_0x3733a7[_0x6f9a('0x4e')],_0x26dffd[_0x6f9a('0x4f')]));if(_0x3733a7['query'][_0x6f9a('0x3d')]){_0x3e0fc6[_0x6f9a('0x58')]=_['merge'](_0x3e0fc6[_0x6f9a('0x58')],{'$or':_[_0x6f9a('0x3f')](_0x3e0fc6['attributes'],function(_0x24cfde){var _0x5f2128={};_0x5f2128[_0x24cfde]={'$like':'%'+_0x3733a7[_0x6f9a('0x4e')]['filter']+'%'};return _0x5f2128;})});}_0x3e0fc6=_[_0x6f9a('0x5a')]({},_0x3e0fc6,_0x3733a7[_0x6f9a('0x5f')]);return _0x2f5c92['getOpenchannelInteractions'](_0x3e0fc6);}})['then'](function(_0x3657ed){if(_0x3657ed){_0xd9badb=_0x3657ed[_0x6f9a('0x53')];if(!_0x3733a7[_0x6f9a('0x4e')][_0x6f9a('0x54')](_0x6f9a('0x55'))){_0x3e0fc6[_0x6f9a('0x30')]=qs[_0x6f9a('0x30')](_0x3733a7['query']['limit']);_0x3e0fc6[_0x6f9a('0x2f')]=qs['offset'](_0x3733a7[_0x6f9a('0x4e')][_0x6f9a('0x2f')]);}return _0x2f5c92[_0x6f9a('0xce')](_0x3e0fc6);}})[_0x6f9a('0x22')](function(_0x387f0e){if(_0x387f0e){return _0x387f0e?{'count':_0xd9badb,'rows':_0x387f0e}:null;}})[_0x6f9a('0x22')](respondWithResult(_0x429dc,null))['catch'](handleError(_0x429dc,null));};exports[_0x6f9a('0xcf')]=function(_0x3c275f,_0x4a0d62,_0x424ec8){var _0x307a37={'raw':!![],'where':{}};var _0x22df55={};var _0x32ce04={'count':0x0,'rows':[]};return db[_0x6f9a('0x48')][_0x6f9a('0x8d')]({'where':{'id':_0x3c275f[_0x6f9a('0x62')]['id']}})['then'](handleEntityNotFound(_0x4a0d62,null))[_0x6f9a('0x22')](function(_0x5a9afd){if(_0x5a9afd){_0x22df55[_0x6f9a('0x4b')]=_['keys'](db['MailInteraction'][_0x6f9a('0xc1')]);_0x22df55[_0x6f9a('0x4e')]=_[_0x6f9a('0x4d')](_0x3c275f[_0x6f9a('0x4e')]);_0x22df55[_0x6f9a('0x4f')]=_['intersection'](_0x22df55[_0x6f9a('0x4b')],_0x22df55[_0x6f9a('0x4e')]);_0x307a37['attributes']=_[_0x6f9a('0x50')](_0x22df55[_0x6f9a('0x4b')],qs[_0x6f9a('0x52')](_0x3c275f[_0x6f9a('0x4e')][_0x6f9a('0x52')]));_0x307a37[_0x6f9a('0x51')]=_0x307a37[_0x6f9a('0x51')][_0x6f9a('0x53')]?_0x307a37[_0x6f9a('0x51')]:_0x22df55[_0x6f9a('0x4b')];if(!_0x3c275f[_0x6f9a('0x4e')]['hasOwnProperty'](_0x6f9a('0x55'))){_0x307a37[_0x6f9a('0x30')]=qs['limit'](_0x3c275f['query']['limit']);_0x307a37['offset']=qs[_0x6f9a('0x2f')](_0x3c275f[_0x6f9a('0x4e')][_0x6f9a('0x2f')]);}_0x307a37[_0x6f9a('0x56')]=qs['sort'](_0x3c275f[_0x6f9a('0x4e')][_0x6f9a('0x57')]);_0x307a37['where']=qs[_0x6f9a('0x4f')](_['pick'](_0x3c275f[_0x6f9a('0x4e')],_0x22df55[_0x6f9a('0x4f')]));_0x307a37[_0x6f9a('0x58')][_0x6f9a('0xc8')]=_0x5a9afd['id'];if(_0x3c275f['query']['filter']){_0x307a37[_0x6f9a('0x58')]=_[_0x6f9a('0x5a')](_0x307a37[_0x6f9a('0x58')],{'$or':_['map'](_0x307a37[_0x6f9a('0x51')],function(_0x2963ca){var _0x4c285d={};_0x4c285d[_0x2963ca]={'$like':'%'+_0x3c275f[_0x6f9a('0x4e')][_0x6f9a('0x3d')]+'%'};return _0x4c285d;})});}_0x307a37=_[_0x6f9a('0x5a')]({},_0x307a37,_0x3c275f['options']);return db[_0x6f9a('0xd0')][_0x6f9a('0x2e')]({'where':_0x307a37['where']})[_0x6f9a('0x22')](function(_0x3dd0bb){_0x32ce04[_0x6f9a('0x2e')]=_0x3dd0bb;if(_0x3c275f['query'][_0x6f9a('0x60')]){_0x307a37[_0x6f9a('0xb9')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x307a37);})['then'](function(_0x946570){_0x32ce04[_0x6f9a('0xc9')]=_0x946570;return _0x32ce04;});}})['then'](respondWithFilteredResult(_0x4a0d62,_0x307a37))[_0x6f9a('0x61')](handleError(_0x4a0d62,null));};exports['getSmsInteractions']=function(_0x28f20f,_0x541eec,_0x4ec41e){var _0x57aa73={};var _0x398a17={};var _0x2b1f6e;var _0x434b69;return db[_0x6f9a('0x48')][_0x6f9a('0x8d')]({'where':{'id':_0x28f20f[_0x6f9a('0x62')]['id']}})[_0x6f9a('0x22')](handleEntityNotFound(_0x541eec,null))[_0x6f9a('0x22')](function(_0x2f380e){if(_0x2f380e){_0x2b1f6e=_0x2f380e;_0x398a17[_0x6f9a('0x4b')]=_[_0x6f9a('0x4d')](db[_0x6f9a('0xd1')]['rawAttributes']);_0x398a17[_0x6f9a('0x4e')]=_[_0x6f9a('0x4d')](_0x28f20f[_0x6f9a('0x4e')]);_0x398a17['filters']=_[_0x6f9a('0x50')](_0x398a17[_0x6f9a('0x4b')],_0x398a17[_0x6f9a('0x4e')]);_0x57aa73['attributes']=_[_0x6f9a('0x50')](_0x398a17[_0x6f9a('0x4b')],qs['fields'](_0x28f20f[_0x6f9a('0x4e')][_0x6f9a('0x52')]));_0x57aa73[_0x6f9a('0x51')]=_0x57aa73[_0x6f9a('0x51')][_0x6f9a('0x53')]?_0x57aa73[_0x6f9a('0x51')]:_0x398a17['model'];_0x57aa73[_0x6f9a('0x56')]=qs[_0x6f9a('0x57')](_0x28f20f[_0x6f9a('0x4e')][_0x6f9a('0x57')]);_0x57aa73[_0x6f9a('0x58')]=qs[_0x6f9a('0x4f')](_[_0x6f9a('0x59')](_0x28f20f['query'],_0x398a17[_0x6f9a('0x4f')]));if(_0x28f20f[_0x6f9a('0x4e')]['filter']){_0x57aa73[_0x6f9a('0x58')]=_[_0x6f9a('0x5a')](_0x57aa73[_0x6f9a('0x58')],{'$or':_['map'](_0x57aa73[_0x6f9a('0x51')],function(_0x4756e3){var _0x33159a={};_0x33159a[_0x4756e3]={'$like':'%'+_0x28f20f['query'][_0x6f9a('0x3d')]+'%'};return _0x33159a;})});}_0x57aa73=_['merge']({},_0x57aa73,_0x28f20f[_0x6f9a('0x5f')]);return _0x2b1f6e[_0x6f9a('0xd2')](_0x57aa73);}})[_0x6f9a('0x22')](function(_0x571847){if(_0x571847){_0x434b69=_0x571847[_0x6f9a('0x53')];if(!_0x28f20f['query'][_0x6f9a('0x54')](_0x6f9a('0x55'))){_0x57aa73[_0x6f9a('0x30')]=qs[_0x6f9a('0x30')](_0x28f20f['query'][_0x6f9a('0x30')]);_0x57aa73['offset']=qs[_0x6f9a('0x2f')](_0x28f20f[_0x6f9a('0x4e')][_0x6f9a('0x2f')]);}return _0x2b1f6e[_0x6f9a('0xd2')](_0x57aa73);}})[_0x6f9a('0x22')](function(_0x30dc99){if(_0x30dc99){return _0x30dc99?{'count':_0x434b69,'rows':_0x30dc99}:null;}})[_0x6f9a('0x22')](respondWithResult(_0x541eec,null))[_0x6f9a('0x61')](handleError(_0x541eec,null));};exports[_0x6f9a('0xd3')]=function(_0x20143d,_0x20f134,_0x26f126){var _0x84ef79={};var _0x113af9={};var _0x1a6df2;var _0x7eac31;return db[_0x6f9a('0x48')]['findOne']({'where':{'id':_0x20143d[_0x6f9a('0x62')]['id']}})['then'](handleEntityNotFound(_0x20f134,null))[_0x6f9a('0x22')](function(_0x17d0a9){if(_0x17d0a9){_0x1a6df2=_0x17d0a9;_0x113af9['model']=_['keys'](db['FaxInteraction'][_0x6f9a('0xc1')]);_0x113af9['query']=_['keys'](_0x20143d[_0x6f9a('0x4e')]);_0x113af9[_0x6f9a('0x4f')]=_[_0x6f9a('0x50')](_0x113af9['model'],_0x113af9[_0x6f9a('0x4e')]);_0x84ef79[_0x6f9a('0x51')]=_[_0x6f9a('0x50')](_0x113af9[_0x6f9a('0x4b')],qs['fields'](_0x20143d['query']['fields']));_0x84ef79[_0x6f9a('0x51')]=_0x84ef79[_0x6f9a('0x51')][_0x6f9a('0x53')]?_0x84ef79[_0x6f9a('0x51')]:_0x113af9[_0x6f9a('0x4b')];_0x84ef79[_0x6f9a('0x56')]=qs[_0x6f9a('0x57')](_0x20143d[_0x6f9a('0x4e')][_0x6f9a('0x57')]);_0x84ef79['where']=qs[_0x6f9a('0x4f')](_[_0x6f9a('0x59')](_0x20143d[_0x6f9a('0x4e')],_0x113af9['filters']));if(_0x20143d[_0x6f9a('0x4e')][_0x6f9a('0x3d')]){_0x84ef79['where']=_['merge'](_0x84ef79[_0x6f9a('0x58')],{'$or':_['map'](_0x84ef79['attributes'],function(_0x3d1cb3){var _0x529a7f={};_0x529a7f[_0x3d1cb3]={'$like':'%'+_0x20143d['query']['filter']+'%'};return _0x529a7f;})});}_0x84ef79=_[_0x6f9a('0x5a')]({},_0x84ef79,_0x20143d['options']);return _0x1a6df2[_0x6f9a('0xd3')](_0x84ef79);}})[_0x6f9a('0x22')](function(_0x3a4012){if(_0x3a4012){_0x7eac31=_0x3a4012['length'];if(!_0x20143d[_0x6f9a('0x4e')][_0x6f9a('0x54')](_0x6f9a('0x55'))){_0x84ef79[_0x6f9a('0x30')]=qs['limit'](_0x20143d['query'][_0x6f9a('0x30')]);_0x84ef79['offset']=qs[_0x6f9a('0x2f')](_0x20143d[_0x6f9a('0x4e')][_0x6f9a('0x2f')]);}return _0x1a6df2[_0x6f9a('0xd3')](_0x84ef79);}})['then'](function(_0xc5810f){if(_0xc5810f){return _0xc5810f?{'count':_0x7eac31,'rows':_0xc5810f}:null;}})[_0x6f9a('0x22')](respondWithResult(_0x20f134,null))['catch'](handleError(_0x20f134,null));};exports[_0x6f9a('0xd4')]=function(_0x48be42,_0x48731c,_0x40c9f4){var _0x2ef81f={};var _0x2761e1={};var _0x5397f9;var _0x2b7ee6;return db[_0x6f9a('0x48')][_0x6f9a('0x8d')]({'where':{'id':_0x48be42['params']['id']}})[_0x6f9a('0x22')](handleEntityNotFound(_0x48731c,null))[_0x6f9a('0x22')](function(_0x165e90){if(_0x165e90){_0x5397f9=_0x165e90;_0x2761e1[_0x6f9a('0x4b')]=_['keys'](db[_0x6f9a('0xd5')][_0x6f9a('0xc1')]);_0x2761e1[_0x6f9a('0x4e')]=_[_0x6f9a('0x4d')](_0x48be42[_0x6f9a('0x4e')]);_0x2761e1[_0x6f9a('0x4f')]=_['intersection'](_0x2761e1[_0x6f9a('0x4b')],_0x2761e1[_0x6f9a('0x4e')]);_0x2ef81f['attributes']=_['intersection'](_0x2761e1[_0x6f9a('0x4b')],qs['fields'](_0x48be42[_0x6f9a('0x4e')][_0x6f9a('0x52')]));_0x2ef81f[_0x6f9a('0x51')]=_0x2ef81f[_0x6f9a('0x51')][_0x6f9a('0x53')]?_0x2ef81f[_0x6f9a('0x51')]:_0x2761e1['model'];_0x2ef81f[_0x6f9a('0x56')]=qs[_0x6f9a('0x57')](_0x48be42[_0x6f9a('0x4e')][_0x6f9a('0x57')]);_0x2ef81f[_0x6f9a('0x58')]=qs[_0x6f9a('0x4f')](_[_0x6f9a('0x59')](_0x48be42['query'],_0x2761e1['filters']));if(_0x48be42[_0x6f9a('0x4e')]['filter']){_0x2ef81f[_0x6f9a('0x58')]=_['merge'](_0x2ef81f[_0x6f9a('0x58')],{'$or':_[_0x6f9a('0x3f')](_0x2ef81f['attributes'],function(_0x2e7d3d){var _0x427943={};_0x427943[_0x2e7d3d]={'$like':'%'+_0x48be42[_0x6f9a('0x4e')]['filter']+'%'};return _0x427943;})});}_0x2ef81f=_[_0x6f9a('0x5a')]({},_0x2ef81f,_0x48be42[_0x6f9a('0x5f')]);return _0x5397f9[_0x6f9a('0xd4')](_0x2ef81f);}})[_0x6f9a('0x22')](function(_0x16b518){if(_0x16b518){_0x2b7ee6=_0x16b518[_0x6f9a('0x53')];if(!_0x48be42[_0x6f9a('0x4e')][_0x6f9a('0x54')]('nolimit')){_0x2ef81f[_0x6f9a('0x30')]=qs[_0x6f9a('0x30')](_0x48be42[_0x6f9a('0x4e')][_0x6f9a('0x30')]);_0x2ef81f['offset']=qs[_0x6f9a('0x2f')](_0x48be42[_0x6f9a('0x4e')][_0x6f9a('0x2f')]);}return _0x5397f9[_0x6f9a('0xd4')](_0x2ef81f);}})[_0x6f9a('0x22')](function(_0x48f393){if(_0x48f393){return _0x48f393?{'count':_0x2b7ee6,'rows':_0x48f393}:null;}})[_0x6f9a('0x22')](respondWithResult(_0x48731c,null))[_0x6f9a('0x61')](handleError(_0x48731c,null));};exports['login']=function(_0x3e7e26,_0x25bb82,_0xd49f5c){var _0x4b4e20;var _0x4bf58d;var _0x3585a3;var _0x1a906c=!_[_0x6f9a('0x71')](_0x3e7e26['params']['id'])?_0x3e7e26[_0x6f9a('0x62')]['id']:!_[_0x6f9a('0x71')](_0x3e7e26['user']['id'])?_0x3e7e26['user']['id']:null;return db[_0x6f9a('0x48')][_0x6f9a('0x65')]({'where':{'id':_0x1a906c,'role':{'$or':['admin',_0x6f9a('0x39'),_0x6f9a('0x3b')]}},'attributes':['id',_0x6f9a('0x43'),_0x6f9a('0xd6'),'mobile',_0x6f9a('0x42'),_0x6f9a('0x72'),_0x6f9a('0x98')]})[_0x6f9a('0x22')](function(_0x3378be){if(_0x3378be){if(_0x3378be[_0x6f9a('0x42')]===_0x6f9a('0x3b')){_0x4b4e20=_0x3378be;if(_0x3e7e26[_0x6f9a('0x67')]['interface']){_0x3585a3=util['format'](_0x6f9a('0xd7'),_0x4b4e20[_0x3e7e26[_0x6f9a('0x67')][_0x6f9a('0x9a')]]);}else if(_0x3e7e26[_0x6f9a('0x67')]['intrf']){_0x3585a3=util[_0x6f9a('0xa8')](_0x6f9a('0xd8'),_0x3e7e26[_0x6f9a('0x67')][_0x6f9a('0xd9')]);}else{_0x3585a3=util[_0x6f9a('0xa8')]('SIP/%s',_0x4b4e20[_0x6f9a('0x43')]);}socket['to'](util[_0x6f9a('0xa8')](_0x6f9a('0xda'),_0x4b4e20[_0x6f9a('0x43')]))['emit']('user:forcelogout',{'ip':_0x3e7e26[_0x6f9a('0xdb')][_0x6f9a('0xdc')]||_0x3e7e26[_0x6f9a('0xdd')][_0x6f9a('0xde')]||_0x3e7e26[_0x6f9a('0xdf')][_0x6f9a('0xde')]||_0x3e7e26[_0x6f9a('0xdd')][_0x6f9a('0xdf')][_0x6f9a('0xde')]});return db[_0x6f9a('0xaf')]['destroy']({'where':{'membername':_0x4b4e20[_0x6f9a('0x43')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x6f9a('0x90'))](_0x6f9a('0xe0'));}})['then'](function(){if(_0x4b4e20){return _0x4b4e20[_0x6f9a('0xe1')]({'raw':!![]});}})[_0x6f9a('0x22')](function(_0x47dc9b){if(_0x4b4e20){var _0x556807=[];if(_0x47dc9b){_0x4bf58d=_0x47dc9b;if(_0x4bf58d[_0x6f9a('0x53')]){for(var _0x4d5e88=0x0;_0x4d5e88<_0x4bf58d['length'];_0x4d5e88++){_0x556807[_0x6f9a('0xa7')]({'membername':_0x4b4e20[_0x6f9a('0x43')],'UserId':_0x4b4e20['id'],'queue_name':_0x4bf58d[_0x4d5e88][_0x6f9a('0x43')],'VoiceQueueId':_0x4bf58d[_0x4d5e88]['id'],'interface':_0x3585a3,'paused':_0x4b4e20[_0x6f9a('0x98')]||![],'penalty':_0x4bf58d[_0x4d5e88][_0x6f9a('0xe2')]||0x0});}return BPromise[_0x6f9a('0xa9')](_0x556807,function(_0x4a13c0){return db['UserVoiceQueueRt']['upsert'](_0x4a13c0);});}}}})['then'](function(){if(_0x4b4e20){return db[_0x6f9a('0xe3')][_0x6f9a('0xa6')]({'where':{'membername':_0x4b4e20[_0x6f9a('0x43')],'exitAt':null}});}})[_0x6f9a('0x22')](function(_0x1047e3){if(_0x4b4e20){var _0x2e2b2c=[];_0x1047e3['forEach'](function(_0x464221){_0x2e2b2c[_0x6f9a('0xa7')](_0x464221[_0x6f9a('0x35')]({'exitAt':moment()[_0x6f9a('0xa8')](_0x6f9a('0xe4'))}));});return BPromise[_0x6f9a('0xe5')](_0x2e2b2c);}})[_0x6f9a('0x22')](function(){if(_0x4b4e20){var _0x350a85=[];var _0x4c3ab1=[];var _0x3e5b49=utils['getChannels']();var _0x282d2={'membername':_0x4b4e20[_0x6f9a('0x43')],'interface':_0x3585a3,'enterAt':moment()[_0x6f9a('0xa8')](_0x6f9a('0xe4')),'role':_0x4b4e20[_0x6f9a('0x42')],'internal':_0x4b4e20[_0x6f9a('0x72')]};_0x3e5b49[_0x6f9a('0xe6')](function(_0xcf1572){_0x350a85[_0x6f9a('0xa7')](_['merge']({'channel':_0xcf1572,'type':'LOGIN','data1':_0x3e7e26[_0x6f9a('0x67')][_0x6f9a('0xe7')],'data2':_0x3585a3},_0x282d2));if(_0x4b4e20[_0x6f9a('0x98')]){_0x4c3ab1[_0x6f9a('0xa7')](_[_0x6f9a('0x5a')]({'channel':_0xcf1572,'type':_0x6f9a('0xe8'),'data1':_0x6f9a('0xe9')},_0x282d2));}});return db['MemberReport'][_0x6f9a('0x66')](_0x350a85['concat'](_0x4c3ab1),{'individualHooks':!![]});}})[_0x6f9a('0x22')](function(){if(_0x4b4e20){return _0x4b4e20[_0x6f9a('0x35')]({'online':!![],'lastLoginAt':moment()[_0x6f9a('0xa8')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x4b4e20['loginInPause']||![],'mailPause':_0x4b4e20['loginInPause']||![],'chatPause':_0x4b4e20[_0x6f9a('0x98')]||![],'faxPause':_0x4b4e20[_0x6f9a('0x98')]||![],'smsPause':_0x4b4e20[_0x6f9a('0x98')]||![],'openchannelPause':_0x4b4e20[_0x6f9a('0x98')]||![],'whatsappPause':_0x4b4e20[_0x6f9a('0x98')]||![],'pauseType':_0x4b4e20[_0x6f9a('0x98')]?_0x6f9a('0xe9'):null,'interface':_0x3585a3,'lastPauseAt':moment()['format'](_0x6f9a('0xe4'))});}})[_0x6f9a('0x22')](function(_0x30070e){if(_0x3e7e26[_0x6f9a('0xea')]){return _0xd49f5c();}else{return BPromise[_0x6f9a('0xeb')](_0x30070e)[_0x6f9a('0x22')](respondWithResult(_0x25bb82,null));}})[_0x6f9a('0x61')](handleError(_0x25bb82,null));};exports[_0x6f9a('0xec')]=function(_0x6be316,_0x2ef04d,_0x5046eb){var _0x533299;return db['User'][_0x6f9a('0x65')]({'where':{'id':_0x6be316[_0x6f9a('0x62')]['id'],'role':_0x6f9a('0x3b')},'attributes':['id',_0x6f9a('0x43'),'role']})[_0x6f9a('0x22')](handleEntityNotFound(_0x2ef04d,null))[_0x6f9a('0x22')](function(_0x2723cb){if(_0x2723cb){_0x533299=_0x2723cb;return db[_0x6f9a('0xaf')][_0x6f9a('0x36')]({'where':{'membername':_0x533299[_0x6f9a('0x43')]},'individualHooks':!![]});}})[_0x6f9a('0x22')](function(){return db[_0x6f9a('0xe3')][_0x6f9a('0xa6')]({'where':{'membername':_0x533299[_0x6f9a('0x43')],'exitAt':null}});})['then'](function(_0xaf4c1f){var _0x4ac1fb=[];_0xaf4c1f[_0x6f9a('0xe6')](function(_0x67b044){_0x4ac1fb[_0x6f9a('0xa7')](_0x67b044[_0x6f9a('0x35')]({'exitAt':moment()[_0x6f9a('0xa8')](_0x6f9a('0xe4'))}));});return BPromise[_0x6f9a('0xe5')](_0x4ac1fb);})[_0x6f9a('0x22')](function(){return _0x533299[_0x6f9a('0x35')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x6f9a('0x22')](respondWithResult(_0x2ef04d,null))['catch'](handleError(_0x2ef04d,null));};exports['pause']=function(_0x39ec7c,_0x22d5f6,_0xc2b18c){var _0x2d8a9e;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x39ec7c[_0x6f9a('0x62')]['id']},'individualHooks':!![]})['then'](function(){return db['User'][_0x6f9a('0x65')]({'where':{'id':_0x39ec7c[_0x6f9a('0x62')]['id'],'role':_0x6f9a('0x3b')},'attributes':['id',_0x6f9a('0x43'),_0x6f9a('0x42'),_0x6f9a('0x72'),_0x6f9a('0x9a')]});})[_0x6f9a('0x22')](handleEntityNotFound(_0x22d5f6,null))[_0x6f9a('0x22')](function(_0x25c1ef){if(_0x25c1ef){_0x2d8a9e=_0x25c1ef;return respondWithRpcPromise('QueuePause','pause',{'id':_0x2d8a9e['id'],'name':_0x2d8a9e[_0x6f9a('0x43')],'pause':!![]});}})[_0x6f9a('0x22')](function(){if(_0x2d8a9e){return db[_0x6f9a('0xe3')][_0x6f9a('0xa6')]({'where':{'membername':_0x2d8a9e[_0x6f9a('0x43')],'type':_0x6f9a('0xe8'),'exitAt':null}});}})[_0x6f9a('0x22')](function(_0x5e0ad1){if(_0x5e0ad1[_0x6f9a('0x53')]){var _0x17d138=moment()[_0x6f9a('0xa8')](_0x6f9a('0xe4'));for(var _0x549feb=0x0,_0xba8cf3=_0x5e0ad1[_0x6f9a('0x53')];_0x549feb<_0xba8cf3;_0x549feb++){_0x5e0ad1[_0x549feb][_0x6f9a('0xed')]({'exitAt':_0x17d138});}}})[_0x6f9a('0x22')](function(){var _0x37e257=[];var _0x316b09=utils['getChannels']();_0x316b09[_0x6f9a('0xe6')](function(_0x1196c1){_0x37e257[_0x6f9a('0xa7')]({'channel':_0x1196c1,'membername':_0x2d8a9e[_0x6f9a('0x43')],'interface':_[_0x6f9a('0x71')](_0x2d8a9e['interface'])?util[_0x6f9a('0xa8')](_0x6f9a('0xd8'),_0x2d8a9e[_0x6f9a('0x43')]):_0x2d8a9e['interface'],'type':'PAUSE','enterAt':moment()['format'](_0x6f9a('0xe4')),'data1':_0x39ec7c['body'][_0x6f9a('0x4a')]||_0x6f9a('0xee'),'role':_0x2d8a9e['role'],'internal':_0x2d8a9e['internal']});});return db['MemberReport'][_0x6f9a('0x66')](_0x37e257,{'individualHooks':!![]});})['then'](function(){return _0x2d8a9e['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x39ec7c[_0x6f9a('0x67')]['type']||_0x6f9a('0xee'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x22d5f6,null))[_0x6f9a('0x61')](handleError(_0x22d5f6,null));};exports['unpause']=function(_0x11588f,_0x41eb71,_0x2e8a47){var _0x5cc26c;return db[_0x6f9a('0x48')]['find']({'where':{'id':_0x11588f['params']['id']},'attributes':['id','name',_0x6f9a('0x42'),_0x6f9a('0x99'),_0x6f9a('0xef'),'chatPause','faxPause',_0x6f9a('0xf0'),_0x6f9a('0xf1'),_0x6f9a('0xf2'),_0x6f9a('0xf3'),'lastPauseAt']})[_0x6f9a('0x22')](handleEntityNotFound(_0x41eb71,null))[_0x6f9a('0x22')](function(_0x232e4b){if(_0x232e4b){_0x5cc26c=_0x232e4b;if(_0x11588f[_0x6f9a('0x67')]['channel']&&!utils['isValidChannel'](_0x11588f[_0x6f9a('0x67')][_0x6f9a('0xac')])){throw new db[(_0x6f9a('0x20'))][(_0x6f9a('0x90'))](_0x6f9a('0x9c'));}switch(_0x11588f[_0x6f9a('0x67')][_0x6f9a('0xac')]){case _0x6f9a('0xa4'):return respondWithRpcPromise(_0x6f9a('0xf4'),_0x6f9a('0xf5'),{'id':_0x5cc26c['id'],'name':_0x5cc26c[_0x6f9a('0x43')],'pause':![]})[_0x6f9a('0x22')](function(){return db[_0x6f9a('0xaf')][_0x6f9a('0x35')]({'paused':0x0},{'where':{'UserId':_0x5cc26c['id']},'individualHooks':!![]});})[_0x6f9a('0x22')](function(){return db['MemberReport']['find']({'where':{'channel':_0x11588f['body']['channel'],'membername':_0x5cc26c[_0x6f9a('0x43')],'type':_0x6f9a('0xe8'),'exitAt':null}});})['then'](function(_0x4a04cd){if(_0x4a04cd){return _0x4a04cd[_0x6f9a('0x35')]({'exitAt':moment()['format'](_0x6f9a('0xe4')),'data2':_0x6f9a('0xf6')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x5cc26c['update']({'voicePause':![]});});case _0x6f9a('0xf7'):case _0x6f9a('0xf8'):case _0x6f9a('0xf9'):case _0x6f9a('0xfa'):case _0x6f9a('0xfb'):case'openchannel':return db[_0x6f9a('0xe3')]['find']({'where':{'channel':_0x11588f[_0x6f9a('0x67')][_0x6f9a('0xac')],'membername':_0x5cc26c['name'],'type':'PAUSE','exitAt':null}})[_0x6f9a('0x22')](function(_0x73d7cd){if(_0x73d7cd){return _0x73d7cd[_0x6f9a('0x35')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x6f9a('0xf6')},{'individualHooks':!![]});}return null;})[_0x6f9a('0x22')](function(){var _0x37b11e={};_['set'](_0x37b11e,util[_0x6f9a('0xa8')](_0x6f9a('0xfc'),_0x11588f[_0x6f9a('0x67')]['channel'],_0x6f9a('0xfd')),![]);return _0x5cc26c[_0x6f9a('0x35')](_0x37b11e);});default:return respondWithRpcPromise(_0x6f9a('0xf4'),_0x6f9a('0xf5'),{'id':_0x5cc26c['id'],'name':_0x5cc26c['name'],'pause':![]})[_0x6f9a('0x22')](function(){return db['UserVoiceQueueRt'][_0x6f9a('0x35')]({'paused':0x0},{'where':{'UserId':_0x5cc26c['id']}});})[_0x6f9a('0x22')](function(){return db[_0x6f9a('0xe3')][_0x6f9a('0xa6')]({'where':{'membername':_0x5cc26c[_0x6f9a('0x43')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x28ac07){var _0x1765a2=[];_0x28ac07[_0x6f9a('0xe6')](function(_0x5b7b00){_0x1765a2[_0x6f9a('0xa7')](_0x5b7b00[_0x6f9a('0x35')]({'exitAt':moment()['format'](_0x6f9a('0xe4')),'data2':_0x6f9a('0xf6')}));});return BPromise['all'](_0x1765a2);})[_0x6f9a('0x22')](function(){return _0x5cc26c[_0x6f9a('0x35')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x6f9a('0x22')](respondWithResult(_0x41eb71,null))[_0x6f9a('0x61')](handleError(_0x41eb71,null));};exports[_0x6f9a('0xfe')]=function(_0x22c5c8,_0x335f9c,_0x42a394){var _0x3d4f04={};var _0x125f61={};var _0x277599;var _0x4690bd;return db[_0x6f9a('0x48')]['findOne']({'where':{'id':_0x22c5c8[_0x6f9a('0x62')]['id']}})[_0x6f9a('0x22')](handleEntityNotFound(_0x335f9c,null))[_0x6f9a('0x22')](function(_0x33b6e1){if(_0x33b6e1){_0x277599=_0x33b6e1;_0x125f61[_0x6f9a('0x4b')]=_[_0x6f9a('0x4d')](db[_0x6f9a('0xff')]['rawAttributes']);_0x125f61[_0x6f9a('0x4e')]=_['keys'](_0x22c5c8[_0x6f9a('0x4e')]);_0x125f61[_0x6f9a('0x4f')]=_[_0x6f9a('0x50')](_0x125f61[_0x6f9a('0x4b')],_0x125f61[_0x6f9a('0x4e')]);_0x3d4f04[_0x6f9a('0x51')]=_[_0x6f9a('0x50')](_0x125f61['model'],qs['fields'](_0x22c5c8[_0x6f9a('0x4e')][_0x6f9a('0x52')]));_0x3d4f04[_0x6f9a('0x51')]=_0x3d4f04[_0x6f9a('0x51')][_0x6f9a('0x53')]?_0x3d4f04[_0x6f9a('0x51')]:_0x125f61[_0x6f9a('0x4b')];_0x3d4f04[_0x6f9a('0x56')]=qs['sort'](_0x22c5c8['query'][_0x6f9a('0x57')]);_0x3d4f04[_0x6f9a('0x58')]=qs[_0x6f9a('0x4f')](_[_0x6f9a('0x59')](_0x22c5c8['query'],_0x125f61[_0x6f9a('0x4f')]));if(_0x22c5c8[_0x6f9a('0x4e')][_0x6f9a('0x3d')]){_0x3d4f04[_0x6f9a('0x58')]=_['merge'](_0x3d4f04['where'],{'$or':_[_0x6f9a('0x3f')](_0x3d4f04[_0x6f9a('0x51')],function(_0x20aa12){var _0x15048c={};_0x15048c[_0x20aa12]={'$like':'%'+_0x22c5c8['query'][_0x6f9a('0x3d')]+'%'};return _0x15048c;})});}_0x3d4f04=_[_0x6f9a('0x5a')]({},_0x3d4f04,_0x22c5c8[_0x6f9a('0x5f')]);return _0x277599[_0x6f9a('0xfe')](_0x3d4f04);}})[_0x6f9a('0x22')](function(_0x385585){if(_0x385585){_0x4690bd=_0x385585[_0x6f9a('0x53')];if(!_0x22c5c8[_0x6f9a('0x4e')][_0x6f9a('0x54')]('nolimit')){_0x3d4f04[_0x6f9a('0x30')]=qs[_0x6f9a('0x30')](_0x22c5c8[_0x6f9a('0x4e')]['limit']);_0x3d4f04[_0x6f9a('0x2f')]=qs[_0x6f9a('0x2f')](_0x22c5c8[_0x6f9a('0x4e')][_0x6f9a('0x2f')]);}return _0x277599['getTeams'](_0x3d4f04);}})[_0x6f9a('0x22')](function(_0x1948fc){if(_0x1948fc){return _0x1948fc?{'count':_0x4690bd,'rows':_0x1948fc}:null;}})[_0x6f9a('0x22')](respondWithResult(_0x335f9c,null))['catch'](handleError(_0x335f9c,null));};exports[_0x6f9a('0x100')]=function(_0x1359aa,_0x575f6a){return db[_0x6f9a('0x48')][_0x6f9a('0x65')]({'where':{'id':_0x1359aa['params']['id']}})[_0x6f9a('0x22')](handleEntityNotFound(_0x575f6a,null))['then'](function(_0x1f730d){if(_0x1f730d){var _0x5c9bc3=_0x1f730d['get']({'plain':!![]});return _0x1f730d[_0x6f9a('0x100')](_0x1359aa[_0x6f9a('0x67')][_0x6f9a('0x6a')],_['omit'](_0x1359aa[_0x6f9a('0x67')],[_0x6f9a('0x6a'),'id'])||{})[_0x6f9a('0x22')](function(){for(var _0xf1a994=0x0;_0xf1a994<_0x1359aa['body'][_0x6f9a('0x6a')][_0x6f9a('0x53')];_0xf1a994++){var _0xe004e1=[];db[_0x6f9a('0xff')]['findOne']({'where':{'id':_0x1359aa[_0x6f9a('0x67')]['ids'][_0xf1a994]}})[_0x6f9a('0x22')](function(_0xd06e7){_0xe004e1[_0x6f9a('0xa7')](_0xd06e7[_0x6f9a('0xe1')]()[_0x6f9a('0x22')](function(_0x5839f0){for(var _0x55f2ce=0x0;_0x55f2ce<_0x5839f0['length'];_0x55f2ce++){_0x5839f0[_0x55f2ce][_0x6f9a('0x101')](_0x6f9a('0xac'),_0x6f9a('0x102'));}return _0x5839f0;}));_0xe004e1[_0x6f9a('0xa7')](_0xd06e7[_0x6f9a('0x103')]()['then'](function(_0x442ff8){for(var _0x3f1a4f=0x0;_0x3f1a4f<_0x442ff8[_0x6f9a('0x53')];_0x3f1a4f++){_0x442ff8[_0x3f1a4f][_0x6f9a('0x101')](_0x6f9a('0xac'),_0x6f9a('0x104'));}return _0x442ff8;}));_0xe004e1[_0x6f9a('0xa7')](_0xd06e7['getMailQueues']()[_0x6f9a('0x22')](function(_0x1cbec6){for(var _0x43af41=0x0;_0x43af41<_0x1cbec6[_0x6f9a('0x53')];_0x43af41++){_0x1cbec6[_0x43af41][_0x6f9a('0x101')](_0x6f9a('0xac'),_0x6f9a('0x105'));}return _0x1cbec6;}));_0xe004e1[_0x6f9a('0xa7')](_0xd06e7[_0x6f9a('0x106')]()['then'](function(_0x571f2a){for(var _0x4ce0b9=0x0;_0x4ce0b9<_0x571f2a[_0x6f9a('0x53')];_0x4ce0b9++){_0x571f2a[_0x4ce0b9][_0x6f9a('0x101')](_0x6f9a('0xac'),_0x6f9a('0x107'));}return _0x571f2a;}));_0xe004e1[_0x6f9a('0xa7')](_0xd06e7[_0x6f9a('0x108')]()['then'](function(_0xe98e0b){for(var _0x1973be=0x0;_0x1973be<_0xe98e0b[_0x6f9a('0x53')];_0x1973be++){_0xe98e0b[_0x1973be][_0x6f9a('0x101')](_0x6f9a('0xac'),_0x6f9a('0x109'));}return _0xe98e0b;}));_0xe004e1[_0x6f9a('0xa7')](_0xd06e7['getFaxQueues']()[_0x6f9a('0x22')](function(_0x4bc200){for(var _0x30981f=0x0;_0x30981f<_0x4bc200[_0x6f9a('0x53')];_0x30981f++){_0x4bc200[_0x30981f]['setDataValue'](_0x6f9a('0xac'),'Fax');}return _0x4bc200;}));_0xe004e1['push'](_0xd06e7[_0x6f9a('0x10a')]()[_0x6f9a('0x22')](function(_0x1441ad){for(var _0x205793=0x0;_0x205793<_0x1441ad[_0x6f9a('0x53')];_0x205793++){_0x1441ad[_0x205793]['setDataValue'](_0x6f9a('0xac'),'Openchannel');}return _0x1441ad;}));return BPromise[_0x6f9a('0xe5')](_0xe004e1);})[_0x6f9a('0x22')](function(_0x5c10bf){var _0xb36eb7=_[_0x6f9a('0x10b')](_0x5c10bf);_0xe004e1=[];return db[_0x6f9a('0x5c')][_0x6f9a('0x10c')](function(_0x1a8f1a){for(var _0x3edf62=0x0;_0x3edf62<_0xb36eb7['length'];_0x3edf62++){_0xe004e1['push'](_0xb36eb7[_0x3edf62][_0x6f9a('0x10d')](_0x5c9bc3['id']),{'transaction':_0x1a8f1a});}return BPromise[_0x6f9a('0xe5')](_0xe004e1)[_0x6f9a('0x22')](function(){if(_0x5c9bc3['online']){return BPromise['each'](_[_0x6f9a('0x3d')](_0xb36eb7,function(_0x5c739f){return _0x5c739f[_0x6f9a('0x10e')](_0x6f9a('0xac'))==='Voice';}),function(_0x4c8ae9){return db[_0x6f9a('0xaf')][_0x6f9a('0xaa')]({'membername':_0x5c9bc3[_0x6f9a('0x43')],'UserId':_0x5c9bc3['id'],'queue_name':_0x4c8ae9[_0x6f9a('0x43')],'VoiceQueueId':_0x4c8ae9['id'],'interface':_[_0x6f9a('0x71')](_0x5c9bc3[_0x6f9a('0x9a')])?util['format']('SIP/%s',_0x5c9bc3[_0x6f9a('0x43')]):_0x5c9bc3['interface'],'paused':_0x5c9bc3['voicePause']||![],'penalty':_0x5c9bc3['penalty']},{'transaction':_0x1a8f1a});});}else{return;}})[_0x6f9a('0x22')](function(){for(var _0x3e2159=0x0;_0x3e2159<_0xb36eb7[_0x6f9a('0x53')];_0x3e2159++){var _0x22c605=_0xb36eb7[_0x3e2159][_0x6f9a('0x10e')](_0x6f9a('0xac'));var _0x444d4d=_0x22c605+_0x6f9a('0xa2');socket['emit'](_0x6f9a('0x39')+_0x22c605+_0x6f9a('0x10f'),{'UserId':_0x5c9bc3['id'],['queueField']:_0xb36eb7[_0x3e2159]['id']});}});});});}});}})[_0x6f9a('0x22')](respondWithStatusCode(_0x575f6a,null))[_0x6f9a('0x61')](handleError(_0x575f6a,null));};exports['removeTeams']=function(_0x4b28d3,_0x4863c6){return db[_0x6f9a('0x48')][_0x6f9a('0x8d')]({'where':{'id':_0x4b28d3[_0x6f9a('0x62')]['id']}})[_0x6f9a('0x22')](handleEntityNotFound(_0x4863c6,null))['then'](function(_0x3e1dba){if(_0x3e1dba){var _0x123040=_0x3e1dba[_0x6f9a('0x37')]({'plain':!![]});var _0x3d8f50=_0x4b28d3[_0x6f9a('0x4e')][_0x6f9a('0x6a')];return _0x3e1dba[_0x6f9a('0x110')](_0x3d8f50)[_0x6f9a('0x22')](function(){for(var _0x176620=0x0;_0x176620<_0x3d8f50['length'];_0x176620++){var _0x5d0915=[];db[_0x6f9a('0xff')][_0x6f9a('0x8d')]({'where':{'id':_0x3d8f50[_0x176620]}})[_0x6f9a('0x22')](function(_0x3433df){_0x5d0915[_0x6f9a('0xa7')](_0x3433df['getVoiceQueues']()['then'](function(_0x54baf2){for(var _0x55f998=0x0;_0x55f998<_0x54baf2[_0x6f9a('0x53')];_0x55f998++){_0x54baf2[_0x55f998]['setDataValue'](_0x6f9a('0xac'),_0x6f9a('0x102'));}return _0x54baf2;}));_0x5d0915[_0x6f9a('0xa7')](_0x3433df['getChatQueues']()['then'](function(_0x400bbb){for(var _0xdf09ce=0x0;_0xdf09ce<_0x400bbb[_0x6f9a('0x53')];_0xdf09ce++){_0x400bbb[_0xdf09ce]['setDataValue'](_0x6f9a('0xac'),_0x6f9a('0x104'));}return _0x400bbb;}));_0x5d0915[_0x6f9a('0xa7')](_0x3433df['getMailQueues']()[_0x6f9a('0x22')](function(_0x4d7027){for(var _0x533636=0x0;_0x533636<_0x4d7027[_0x6f9a('0x53')];_0x533636++){_0x4d7027[_0x533636]['setDataValue']('channel','Mail');}return _0x4d7027;}));_0x5d0915['push'](_0x3433df[_0x6f9a('0x106')]()['then'](function(_0x15a90d){for(var _0x184f2b=0x0;_0x184f2b<_0x15a90d[_0x6f9a('0x53')];_0x184f2b++){_0x15a90d[_0x184f2b]['setDataValue'](_0x6f9a('0xac'),_0x6f9a('0x107'));}return _0x15a90d;}));_0x5d0915[_0x6f9a('0xa7')](_0x3433df[_0x6f9a('0x108')]()[_0x6f9a('0x22')](function(_0x562052){for(var _0x4e2623=0x0;_0x4e2623<_0x562052[_0x6f9a('0x53')];_0x4e2623++){_0x562052[_0x4e2623][_0x6f9a('0x101')](_0x6f9a('0xac'),_0x6f9a('0x109'));}return _0x562052;}));_0x5d0915[_0x6f9a('0xa7')](_0x3433df['getFaxQueues']()[_0x6f9a('0x22')](function(_0x5a0b97){for(var _0x3b5e26=0x0;_0x3b5e26<_0x5a0b97[_0x6f9a('0x53')];_0x3b5e26++){_0x5a0b97[_0x3b5e26][_0x6f9a('0x101')]('channel',_0x6f9a('0x111'));}return _0x5a0b97;}));_0x5d0915['push'](_0x3433df[_0x6f9a('0x10a')]()[_0x6f9a('0x22')](function(_0x4a2010){for(var _0xfec266=0x0;_0xfec266<_0x4a2010[_0x6f9a('0x53')];_0xfec266++){_0x4a2010[_0xfec266][_0x6f9a('0x101')]('channel',_0x6f9a('0x112'));}return _0x4a2010;}));return BPromise[_0x6f9a('0xe5')](_0x5d0915);})[_0x6f9a('0x22')](function(_0xc26ad3){var _0x33dbbc=_[_0x6f9a('0x10b')](_0xc26ad3);_0x5d0915=[];return db[_0x6f9a('0x5c')][_0x6f9a('0x10c')](function(_0x358571){for(var _0x3cbd52=0x0;_0x3cbd52<_0x33dbbc['length'];_0x3cbd52++){_0x5d0915[_0x6f9a('0xa7')](_0x33dbbc[_0x3cbd52][_0x6f9a('0x113')](_0x123040['id']),{'transaction':_0x358571});}return BPromise[_0x6f9a('0xe5')](_0x5d0915)[_0x6f9a('0x22')](function(){if(_0x123040['online']){return BPromise[_0x6f9a('0xa9')](_[_0x6f9a('0x3d')](_0x33dbbc,function(_0xff696f){return _0xff696f[_0x6f9a('0x10e')](_0x6f9a('0xac'))===_0x6f9a('0x102');}),function(_0x405df0){return db[_0x6f9a('0xaf')]['destroy']({'where':{'VoiceQueueId':_0x405df0['id'],'UserId':_0x123040['id']},'transaction':_0x358571});});}else{return;}})['then'](function(){for(var _0x134543=0x0;_0x134543<_0x33dbbc[_0x6f9a('0x53')];_0x134543++){var _0x3be819=_0x33dbbc[_0x134543][_0x6f9a('0x10e')](_0x6f9a('0xac'));var _0x1300ac=_0x3be819+_0x6f9a('0xa2');socket[_0x6f9a('0xa3')](_0x6f9a('0x39')+_0x3be819+_0x6f9a('0xae'),{'UserId':_0x123040['id'],['queueField']:_0x33dbbc[_0x134543]['id']});}});});});}});}})[_0x6f9a('0x22')](respondWithStatusCode(_0x4863c6,null))[_0x6f9a('0x61')](handleError(_0x4863c6,null));};exports[_0x6f9a('0x114')]=function(_0x5425c0,_0x14d9e7,_0x21654f){var _0xb82510={};var _0x2eb39d={};var _0x5b540f;var _0x319478;return db[_0x6f9a('0x48')][_0x6f9a('0x8d')]({'where':{'id':_0x5425c0[_0x6f9a('0x62')]['id']}})[_0x6f9a('0x22')](handleEntityNotFound(_0x14d9e7,null))[_0x6f9a('0x22')](function(_0x2ae2b1){if(_0x2ae2b1){_0x5b540f=_0x2ae2b1;_0x2eb39d[_0x6f9a('0x4b')]=_[_0x6f9a('0x4d')](db['CmList'][_0x6f9a('0xc1')]);_0x2eb39d[_0x6f9a('0x4e')]=_[_0x6f9a('0x4d')](_0x5425c0[_0x6f9a('0x4e')]);_0x2eb39d[_0x6f9a('0x4f')]=_[_0x6f9a('0x50')](_0x2eb39d['model'],_0x2eb39d[_0x6f9a('0x4e')]);_0xb82510[_0x6f9a('0x51')]=_['intersection'](_0x2eb39d['model'],qs['fields'](_0x5425c0['query'][_0x6f9a('0x52')]));_0xb82510['attributes']=_0xb82510[_0x6f9a('0x51')][_0x6f9a('0x53')]?_0xb82510['attributes']:_0x2eb39d[_0x6f9a('0x4b')];_0xb82510[_0x6f9a('0x56')]=qs[_0x6f9a('0x57')](_0x5425c0[_0x6f9a('0x4e')][_0x6f9a('0x57')]);_0xb82510['where']=qs['filters'](_[_0x6f9a('0x59')](_0x5425c0[_0x6f9a('0x4e')],_0x2eb39d[_0x6f9a('0x4f')]));if(_0x5425c0[_0x6f9a('0x4e')]['filter']){_0xb82510[_0x6f9a('0x58')]=_['merge'](_0xb82510['where'],{'$or':_[_0x6f9a('0x3f')](_0xb82510['attributes'],function(_0x52ad85){var _0x43933c={};_0x43933c[_0x52ad85]={'$like':'%'+_0x5425c0[_0x6f9a('0x4e')][_0x6f9a('0x3d')]+'%'};return _0x43933c;})});}_0xb82510=_[_0x6f9a('0x5a')]({},_0xb82510,_0x5425c0[_0x6f9a('0x5f')]);return _0x5b540f['getLists'](_0xb82510);}})[_0x6f9a('0x22')](function(_0x3e2d25){if(_0x3e2d25){_0x319478=_0x3e2d25['length'];if(!_0x5425c0['query'][_0x6f9a('0x54')](_0x6f9a('0x55'))){_0xb82510[_0x6f9a('0x30')]=qs[_0x6f9a('0x30')](_0x5425c0[_0x6f9a('0x4e')][_0x6f9a('0x30')]);_0xb82510['offset']=qs[_0x6f9a('0x2f')](_0x5425c0[_0x6f9a('0x4e')][_0x6f9a('0x2f')]);}return _0x5b540f[_0x6f9a('0x114')](_0xb82510);}})[_0x6f9a('0x22')](function(_0x30661b){if(_0x30661b){return _0x30661b?{'count':_0x319478,'rows':_0x30661b}:null;}})[_0x6f9a('0x22')](respondWithResult(_0x14d9e7,null))[_0x6f9a('0x61')](handleError(_0x14d9e7,null));};exports[_0x6f9a('0x115')]=function(_0x4f74fa,_0x4e3013,_0x55c1c2){var _0x3da1b0={};var _0x553a97={};var _0x446c4c;var _0x1111b9;return db[_0x6f9a('0x48')]['findOne']({'where':{'id':_0x4f74fa[_0x6f9a('0x62')]['id']}})['then'](handleEntityNotFound(_0x4e3013,null))[_0x6f9a('0x22')](function(_0x2eeda4){if(_0x2eeda4){_0x446c4c=_0x2eeda4;_0x553a97[_0x6f9a('0x4b')]=_[_0x6f9a('0x4d')](db[_0x6f9a('0x48')][_0x6f9a('0xc1')]);_0x553a97[_0x6f9a('0x4e')]=_['keys'](_0x4f74fa[_0x6f9a('0x4e')]);_0x553a97[_0x6f9a('0x4f')]=_[_0x6f9a('0x50')](_0x553a97['model'],_0x553a97['query']);_0x3da1b0[_0x6f9a('0x51')]=_[_0x6f9a('0x50')](_0x553a97[_0x6f9a('0x4b')],qs[_0x6f9a('0x52')](_0x4f74fa['query'][_0x6f9a('0x52')]));_0x3da1b0[_0x6f9a('0x51')]=_0x3da1b0['attributes'][_0x6f9a('0x53')]?_0x3da1b0[_0x6f9a('0x51')]:_0x553a97[_0x6f9a('0x4b')];_0x3da1b0[_0x6f9a('0x56')]=qs[_0x6f9a('0x57')](_0x4f74fa[_0x6f9a('0x4e')][_0x6f9a('0x57')]);_0x3da1b0['where']=qs['filters'](_[_0x6f9a('0x59')](_0x4f74fa[_0x6f9a('0x4e')],_0x553a97[_0x6f9a('0x4f')]));if(_0x4f74fa[_0x6f9a('0x4e')][_0x6f9a('0x3d')]){_0x3da1b0[_0x6f9a('0x58')]=_[_0x6f9a('0x5a')](_0x3da1b0['where'],{'$or':_[_0x6f9a('0x3f')](_0x3da1b0[_0x6f9a('0x51')],function(_0x23d384){var _0x4c0b5c={};_0x4c0b5c[_0x23d384]={'$like':'%'+_0x4f74fa[_0x6f9a('0x4e')][_0x6f9a('0x3d')]+'%'};return _0x4c0b5c;})});}_0x3da1b0[_0x6f9a('0x4b')]=db[_0x6f9a('0x48')];_0x3da1b0['as']=_0x6f9a('0x3a');_0x3da1b0=_[_0x6f9a('0x5a')]({},_0x3da1b0,_0x4f74fa[_0x6f9a('0x5f')]);return _0x446c4c[_0x6f9a('0xe1')]({'include':[_0x3da1b0]});}})['then'](function(_0x45b329){if(_0x45b329){var _0x8c4845={},_0x182291=[],_0x16e699=0x0;for(var _0xb02485=0x0;_0xb02485<_0x45b329[_0x6f9a('0x53')];_0xb02485+=0x1){for(var _0x143758=0x0,_0x44cdc2;_0x143758<_0x45b329[_0xb02485][_0x6f9a('0x3a')][_0x6f9a('0x53')];_0x143758+=0x1){_0x44cdc2=_0x45b329[_0xb02485][_0x6f9a('0x3a')][_0x143758]['get']({'plain':!![]});_0x8c4845[_0x44cdc2['id']]=_0x44cdc2;}}_0x8c4845=_[_0x6f9a('0x116')](_0x8c4845);for(var _0x1922de=qs['offset'](_0x4f74fa[_0x6f9a('0x4e')][_0x6f9a('0x2f')]);_0x1922de<_0x8c4845[_0x6f9a('0x53')]&&_0x182291[_0x6f9a('0x53')]=_0x4a7560){_0x34a916=_0x4a7560;_0x4a2edc=0xc8;}else{_0x4a2edc=0xce;}_0x40c79a[_0x4c43('0x2c')](_0x4a2edc);return _0x40c79a[_0x4c43('0x30')](_0x4c43('0x31'),_0x447ab5+'-'+_0x34a916+'/'+_0x4a7560)[_0x4c43('0x32')](_0x42c7ef);}return null;};}function patchUpdates(_0x1af122){return function(_0xaaa16b){try{jsonpatch[_0x4c43('0x33')](_0xaaa16b,_0x1af122,!![]);}catch(_0x14383e){return BPromise[_0x4c43('0x34')](_0x14383e);}return _0xaaa16b[_0x4c43('0x35')]();};}function saveUpdates(_0x5001d0,_0x26ffb1){return function(_0x4787e6){if(_0x4787e6){return _0x4787e6['update'](_0x5001d0)[_0x4c43('0x20')](function(_0x5ab151){return _0x5ab151;});}return null;};}function removeEntity(_0xc8c668,_0x1958cd){return function(_0x5ad4b7){if(_0x5ad4b7){return _0x5ad4b7[_0x4c43('0x36')]()['then'](function(){var _0x111fd2=_0x5ad4b7[_0x4c43('0x37')]({'plain':!![]});var _0x572814=[{'name':_0x4c43('0x38'),'value':'user','ignore':!![]},{'name':_0x4c43('0x39'),'value':_0x4c43('0x3a'),'ignore':![]},{'name':'Telephones','value':_0x4c43('0x3b'),'ignore':![]}];var _0x853488=_(_0x572814)[_0x4c43('0x3c')](_0x4c43('0x3d'))[_0x4c43('0x3e')]('value')['value']();if(_[_0x4c43('0x3f')](_0x853488,_0x111fd2[_0x4c43('0x40')])){return;}var _0x5a064c=_[_0x4c43('0x41')](_0x572814,[_0x4c43('0x42'),_0x111fd2[_0x4c43('0x40')]])[_0x4c43('0x43')];return db[_0x4c43('0x44')][_0x4c43('0x36')]({'where':{'type':_0x5a064c,'resourceId':_0x111fd2['id']}})[_0x4c43('0x20')](function(){return _0x5ad4b7;});})[_0x4c43('0x20')](function(){_0xc8c668[_0x4c43('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11d94a,_0x4067de){return function(_0x3d601a){if(!_0x3d601a){_0x11d94a[_0x4c43('0x2b')](0x194);}return _0x3d601a;};}function handleError(_0x500c29,_0x507556){_0x507556=_0x507556||0x1f4;return function(_0x25e75b){logger['error'](_0x25e75b['stack']);if(_0x25e75b[_0x4c43('0x43')]){delete _0x25e75b[_0x4c43('0x43')];}_0x500c29[_0x4c43('0x2c')](_0x507556)['send'](_0x25e75b);};}exports[_0x4c43('0x45')]=function(_0x517d1c,_0x2a9406){var _0x5c9bea={},_0x412ab5={},_0x4494a6={'count':0x0,'rows':[]};var _0x1cf095=_['map'](db[_0x4c43('0x46')][_0x4c43('0x47')],function(_0x32927a){return{'name':_0x32927a[_0x4c43('0x48')],'type':_0x32927a[_0x4c43('0x49')][_0x4c43('0x4a')]};});_0x412ab5['model']=_['differenceBy'](_[_0x4c43('0x3e')](_0x1cf095,_0x4c43('0x43')),[_0x4c43('0x4b'),'salt']);_0x412ab5[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x517d1c['query']);_0x412ab5[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x412ab5['model'],_0x412ab5['query']);_0x5c9bea[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x412ab5[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x517d1c['query'][_0x4c43('0x52')]));_0x5c9bea[_0x4c43('0x50')]=_0x5c9bea['attributes'][_0x4c43('0x53')]?_0x5c9bea[_0x4c43('0x50')]:_0x412ab5[_0x4c43('0x51')];if(!_0x517d1c[_0x4c43('0x4c')][_0x4c43('0x54')](_0x4c43('0x55'))){_0x5c9bea['limit']=qs[_0x4c43('0x2f')](_0x517d1c[_0x4c43('0x4c')]['limit']);_0x5c9bea[_0x4c43('0x2e')]=qs['offset'](_0x517d1c[_0x4c43('0x4c')][_0x4c43('0x2e')]);}_0x5c9bea['order']=qs[_0x4c43('0x56')](_0x517d1c[_0x4c43('0x4c')][_0x4c43('0x56')]);_0x5c9bea[_0x4c43('0x57')]=qs['filters'](_[_0x4c43('0x58')](_0x517d1c['query'],_0x412ab5['filters']),_0x1cf095);if(_0x517d1c[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x5c9bea[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0x5c9bea[_0x4c43('0x57')],{'$or':_[_0x4c43('0x3e')](_0x1cf095,function(_0x29e8a5){if(_0x29e8a5['type']!=='VIRTUAL'){return db['sequelize'][_0x4c43('0x57')](db[_0x4c43('0x5a')]['fn']('lower',db[_0x4c43('0x5a')]['col'](_0x29e8a5[_0x4c43('0x43')])),{'$like':db[_0x4c43('0x5a')]['fn'](_0x4c43('0x5b'),'%'+_0x517d1c[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%')});}})});}_0x5c9bea=_[_0x4c43('0x59')]({},_0x5c9bea,_0x517d1c['options']);var _0x38d934={'where':_0x5c9bea[_0x4c43('0x57')]};return db['User'][_0x4c43('0x2d')](_0x38d934)[_0x4c43('0x20')](function(_0x2cf036){_0x4494a6[_0x4c43('0x2d')]=_0x2cf036;if(_0x517d1c[_0x4c43('0x4c')][_0x4c43('0x5c')]){_0x5c9bea[_0x4c43('0x5d')]=[{'all':!![]}];}return db['User'][_0x4c43('0x5e')](_0x5c9bea);})[_0x4c43('0x20')](function(_0x3e8a53){_0x4494a6[_0x4c43('0x5f')]=_0x3e8a53;return _0x4494a6;})[_0x4c43('0x20')](respondWithFilteredResult(_0x2a9406,_0x5c9bea))[_0x4c43('0x60')](handleError(_0x2a9406,null));};exports[_0x4c43('0x61')]=function(_0x353afd,_0xc72c6b){var _0x40d4a5={'raw':![],'where':{'id':_0x353afd[_0x4c43('0x62')]['id']}},_0xdf4463={};_0xdf4463[_0x4c43('0x51')]=_[_0x4c43('0x63')](_['keys'](db['User'][_0x4c43('0x47')]),[_0x4c43('0x4b'),_0x4c43('0x64')]);_0xdf4463['query']=_['keys'](_0x353afd[_0x4c43('0x4c')]);_0xdf4463[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0xdf4463[_0x4c43('0x51')],_0xdf4463[_0x4c43('0x4c')]);_0x40d4a5[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0xdf4463['model'],qs[_0x4c43('0x52')](_0x353afd[_0x4c43('0x4c')][_0x4c43('0x52')]));_0x40d4a5[_0x4c43('0x50')]=_0x40d4a5['attributes'][_0x4c43('0x53')]?_0x40d4a5[_0x4c43('0x50')]:_0xdf4463[_0x4c43('0x51')];if(_0x353afd[_0x4c43('0x4c')][_0x4c43('0x5c')]){_0x40d4a5['include']=[{'all':!![]}];}_0x40d4a5=_['merge']({},_0x40d4a5,_0x353afd[_0x4c43('0x65')]);return db['User'][_0x4c43('0x41')](_0x40d4a5)[_0x4c43('0x20')](handleEntityNotFound(_0xc72c6b,null))[_0x4c43('0x20')](respondWithResult(_0xc72c6b,null))[_0x4c43('0x60')](handleError(_0xc72c6b,null));};exports[_0x4c43('0x66')]=function(_0x3fff95,_0x51a79f){return db[_0x4c43('0x46')]['bulkCreate'](_0x3fff95[_0x4c43('0x67')],{'raw':![],'individualHooks':!![]})[_0x4c43('0x20')](respondWithResult(_0x51a79f,0xc9))['catch'](handleError(_0x51a79f,null));};exports['update']=function(_0x5ddd8c,_0x497f24){if(_0x5ddd8c['body']['id']){delete _0x5ddd8c['body']['id'];}delete _0x5ddd8c[_0x4c43('0x67')]['role'];return db['User'][_0x4c43('0x41')]({'where':{'id':_0x5ddd8c['params']['id']}})['then'](handleEntityNotFound(_0x497f24,null))[_0x4c43('0x20')](saveUpdates(_0x5ddd8c[_0x4c43('0x67')],null))['then'](respondWithResult(_0x497f24,null))[_0x4c43('0x60')](handleError(_0x497f24,null));};exports[_0x4c43('0x68')]=function(_0x58b87e,_0x417482){return db['User']['describe']()[_0x4c43('0x20')](respondWithResult(_0x417482,null))[_0x4c43('0x60')](handleError(_0x417482,null));};exports[_0x4c43('0x69')]=function(_0x2ebb8d,_0x279ffc,_0x10ff9d){return db['User'][_0x4c43('0x41')]({'where':{'id':_0x2ebb8d[_0x4c43('0x62')]['id']}})['then'](handleEntityNotFound(_0x279ffc,null))[_0x4c43('0x20')](function(_0x2e0577){if(_0x2e0577){return _0x2e0577['addContacts'](_0x2ebb8d[_0x4c43('0x67')][_0x4c43('0x6a')],_[_0x4c43('0x6b')](_0x2ebb8d[_0x4c43('0x67')],['ids','id'])||{});}})[_0x4c43('0x20')](respondWithResult(_0x279ffc,null))[_0x4c43('0x60')](handleError(_0x279ffc,null));};var getLicense=function(_0x42afe1){return new BPromise(function(_0x3e346e,_0x137e6f){var _0x116c2e=0x0;_0x42afe1[_0x4c43('0x67')][_0x4c43('0x40')]===_0x4c43('0x3a')&&_0x3e346e(_0x4c43('0x6c'));return db[_0x4c43('0x46')][_0x4c43('0x2d')]({'where':{'$or':[{'role':_0x42afe1[_0x4c43('0x67')][_0x4c43('0x40')]===_0x4c43('0x3b')?_0x4c43('0x3b'):[_0x4c43('0x6d'),_0x4c43('0x6e')]}]}})['then'](function(_0x1e31bc){_0x116c2e=_0x1e31bc;return require('../../config/license/util')[_0x4c43('0x6f')]();})[_0x4c43('0x20')](function(_0xcd44d0){var _0x24007d=_0x42afe1[_0x4c43('0x67')][_0x4c43('0x40')]===_0x4c43('0x3b')?_0x4c43('0x70'):_0x4c43('0x71');if(!_['isNil'](_0xcd44d0[_0x24007d])&&_0x116c2e>=_0xcd44d0[_0x24007d]){return _0x137e6f({'message':_0x4c43('0x72')});}return _0x3e346e(util[_0x4c43('0x73')](_0x4c43('0x74'),_0x24007d,_0x116c2e));})['catch'](function(_0x4b65bc){return _0x137e6f(_0x4b65bc);});});};exports[_0x4c43('0x75')]=function(_0x2177cb,_0x4001b5){return getLicense(_0x2177cb)[_0x4c43('0x20')](function(_0x534686){if(!_0x2177cb[_0x4c43('0x67')][_0x4c43('0x76')]){var _0x334271;return db[_0x4c43('0x77')][_0x4c43('0x78')](0x1)['then'](function(_0x37980b){return checkPasswordPattern(_0x37980b,_0x2177cb[_0x4c43('0x67')][_0x4c43('0x4b')],_0x37980b[_0x4c43('0x79')]);})[_0x4c43('0x20')](function(_0x477820){_0x334271=_0x477820['min_internal'];return db[_0x4c43('0x46')]['max']('internal');})[_0x4c43('0x20')](function(_0xc8a86b){if(_['isNil'](_0xc8a86b)){if(_0x334271){_0x2177cb[_0x4c43('0x67')][_0x4c43('0x76')]=_0x334271;}else{_0x2177cb[_0x4c43('0x67')][_0x4c43('0x76')]=0x1;}}else{if(_[_0x4c43('0x7a')](_0x334271)||_0x334271==_0xc8a86b){_0x2177cb['body'][_0x4c43('0x76')]=_0xc8a86b+0x1;}else if(_0x334271>_0xc8a86b){_0x2177cb[_0x4c43('0x67')]['internal']=_0x334271;}else{return db[_0x4c43('0x5a')][_0x4c43('0x4c')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x4c43('0x5a')][_0x4c43('0x7b')][_0x4c43('0x7c')]})[_0x4c43('0x20')](function(_0x8fce57){if(_0x8fce57&&_0x8fce57[_0x4c43('0x53')]){for(var _0x57ea49=0x0,_0x292714=_0x8fce57[_0x4c43('0x53')];_0x57ea49<_0x292714&&_[_0x4c43('0x7a')](_0x2177cb[_0x4c43('0x67')]['internal']);_0x57ea49++){if(_0x334271<=_0x8fce57[_0x57ea49][_0x4c43('0x7d')]){_0x2177cb[_0x4c43('0x67')][_0x4c43('0x76')]=_0x8fce57[_0x57ea49][_0x4c43('0x7d')];}else if(_0x334271>_0x8fce57[_0x57ea49][_0x4c43('0x7d')]&&_0x334271<=_0x8fce57[_0x57ea49]['to']){_0x2177cb['body'][_0x4c43('0x76')]=_0x334271;}}}if(_[_0x4c43('0x7a')](_0x2177cb['body'][_0x4c43('0x76')])){_0x2177cb[_0x4c43('0x67')]['internal']=_0xc8a86b+0x1;}});}}});}})['then'](function(){if(_0x2177cb[_0x4c43('0x67')][_0x4c43('0x7e')]){_0x2177cb[_0x4c43('0x67')][_0x4c43('0x7f')]=_0x2177cb[_0x4c43('0x67')]['internal'];_0x2177cb['body'][_0x4c43('0x80')]={'mailbox':_0x2177cb[_0x4c43('0x67')][_0x4c43('0x76')],'password':_0x2177cb['body'][_0x4c43('0x4b')],'fullname':_0x2177cb[_0x4c43('0x67')][_0x4c43('0x81')],'email':_0x2177cb[_0x4c43('0x67')]['email']};}if(_0x2177cb[_0x4c43('0x67')]&&_0x2177cb[_0x4c43('0x67')][_0x4c43('0x40')]===_0x4c43('0x3a')){if(!_0x2177cb['body'][_0x4c43('0x82')]){_0x2177cb['body']['permissions']=[_0x4c43('0x83'),_0x4c43('0x84'),'103',_0x4c43('0x85'),_0x4c43('0x86'),_0x4c43('0x87'),_0x4c43('0x88'),_0x4c43('0x89'),'107',_0x4c43('0x8a'),_0x4c43('0x8b'),_0x4c43('0x8c'),_0x4c43('0x8d'),_0x4c43('0x8e')];}}return db['User']['create'](_0x2177cb[_0x4c43('0x67')],{'include':[{'model':db[_0x4c43('0x80')],'as':_0x4c43('0x80')}]});})[_0x4c43('0x20')](function(_0x5204c7){if(_0x2177cb[_0x4c43('0x67')][_0x4c43('0x40')]===_0x4c43('0x6e'))return _0x5204c7;var _0x29d2f2=_0x2177cb[_0x4c43('0x6e')]['get']({'plain':!![]});if(!_0x29d2f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29d2f2[_0x4c43('0x40')]===_0x4c43('0x6e')){var _0x30a69a=_0x5204c7[_0x4c43('0x37')]({'plain':!![]});var _0x1030d5=[{'name':_0x4c43('0x39'),'value':_0x4c43('0x3a')},{'name':_0x4c43('0x8f'),'value':_0x4c43('0x3b')}];var _0x23b7df=_['find'](_0x1030d5,['value',_0x30a69a[_0x4c43('0x40')]])[_0x4c43('0x43')];return db[_0x4c43('0x90')][_0x4c43('0x41')]({'where':{'name':_0x23b7df,'userProfileId':_0x29d2f2[_0x4c43('0x91')]},'raw':!![]})[_0x4c43('0x20')](function(_0xeeadfc){if(_0xeeadfc&&_0xeeadfc[_0x4c43('0x92')]===0x0){return db[_0x4c43('0x44')][_0x4c43('0x75')]({'name':_0x30a69a[_0x4c43('0x43')],'resourceId':_0x30a69a['id'],'type':_0xeeadfc['name'],'sectionId':_0xeeadfc['id']},{})[_0x4c43('0x20')](function(){return _0x5204c7;});}else{return _0x5204c7;}})['catch'](function(_0x510a1b){logger['error'](_0x4c43('0x93'),_0x510a1b);throw _0x510a1b;});}return _0x5204c7;})[_0x4c43('0x20')](respondWithResult(_0x4001b5,0xc9))[_0x4c43('0x60')](handleError(_0x4001b5,null));};exports[_0x4c43('0x94')]=function(_0x9e968f,_0x4a1d42,_0x498fb8){var _0x5a2ea9=![];if(_0x9e968f[_0x4c43('0x67')]['id']){delete _0x9e968f[_0x4c43('0x67')]['id'];}return db[_0x4c43('0x77')]['findOne']({'attributes':['id',_0x4c43('0x79')]})[_0x4c43('0x20')](function(_0x485004){_0x5a2ea9=_0x485004[_0x4c43('0x79')];return db[_0x4c43('0x46')][_0x4c43('0x41')]({'where':{'id':_0x9e968f[_0x4c43('0x62')]['id']}});})[_0x4c43('0x20')](function(_0x1dc578){if(_0x1dc578){if(_0x1dc578['id']==_0x9e968f[_0x4c43('0x6e')]['id']){if(!_0x9e968f[_0x4c43('0x67')]['oldPassword']||!_0x9e968f[_0x4c43('0x67')][_0x4c43('0x95')]){throw new db[(_0x4c43('0x96'))][(_0x4c43('0x1e'))]('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x1dc578[_0x4c43('0x97')](_0x9e968f['body'][_0x4c43('0x98')])){throw new db[(_0x4c43('0x96'))][(_0x4c43('0x1e'))]('Wrong\x20credentials');}if(_0x9e968f[_0x4c43('0x67')]['oldPassword']==_0x9e968f[_0x4c43('0x67')]['newPassword']){throw new db['Sequelize'][(_0x4c43('0x1e'))](_0x4c43('0x99'));}return _0x1dc578;}else if(_0x9e968f[_0x4c43('0x6e')]['role']==_0x4c43('0x6d')){if(!_0x9e968f[_0x4c43('0x67')][_0x4c43('0x95')]){throw new db['Sequelize']['ValidationError'](_0x4c43('0x9a'));}return _0x1dc578;}else if(_0x9e968f[_0x4c43('0x6e')]['role']==_0x4c43('0x6e')){if(!_0x9e968f[_0x4c43('0x67')][_0x4c43('0x95')]){throw new db['Sequelize'][(_0x4c43('0x1e'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x1dc578[_0x4c43('0x40')]!=_0x4c43('0x3a')){throw new db['Sequelize']['ValidationError'](_0x4c43('0x9b'));}return _0x1dc578;}else{throw new db[(_0x4c43('0x96'))][(_0x4c43('0x1e'))](_0x4c43('0x9b'));}}return null;})['then'](handleEntityNotFound(_0x4a1d42,null))['then'](function(_0x3a87ae){return checkPasswordPattern(_0x3a87ae,_0x9e968f[_0x4c43('0x67')][_0x4c43('0x95')],_0x5a2ea9);})[_0x4c43('0x20')](saveUpdates({'password':_0x9e968f[_0x4c43('0x67')][_0x4c43('0x95')],'passwordResetAt':_0x9e968f[_0x4c43('0x6e')]['id']==_0x9e968f[_0x4c43('0x62')]['id']?moment():null},null))[_0x4c43('0x20')](respondWithResult(_0x4a1d42,null))[_0x4c43('0x60')](handleError(_0x4a1d42,null));};exports[_0x4c43('0x9c')]=function(_0x2d6519,_0x421abe,_0x529755){var _0xe73e5c=_0x2d6519[_0x4c43('0x67')][_0x4c43('0x9d')];return db[_0x4c43('0x46')][_0x4c43('0x41')]({'where':{'id':_0x2d6519['params']['id']},'attributes':['id',_0x4c43('0x43'),'role',_0x4c43('0x9e'),_0x4c43('0x9f'),_0x4c43('0xa0'),_0x4c43('0xa1')]})[_0x4c43('0x20')](handleEntityNotFound(_0x421abe,null))['then'](function(_0x520805){if(_0x520805){if(!utils[_0x4c43('0xa2')](_0xe73e5c)){throw new db[(_0x4c43('0x96'))][(_0x4c43('0x1e'))](_0x4c43('0xa3'));}return _0x520805[_0x4c43('0xa4')+_[_0x4c43('0xa5')](_0xe73e5c[_0x4c43('0xa6')]())+'Queues'](_0x2d6519[_0x4c43('0x67')][_0x4c43('0x6a')],{'penalty':_0x2d6519[_0x4c43('0x67')][_0x4c43('0xa7')]||0x0})[_0x4c43('0xa8')](function(_0x152a20){for(var _0x4814ee=0x0;_0x4814ee<_0x2d6519[_0x4c43('0x67')]['ids'][_0x4c43('0x53')];_0x4814ee+=0x1){var _0x3c0f35={'UserId':_0x2d6519[_0x4c43('0x62')]['id']};_0x3c0f35[_[_0x4c43('0xa5')](_0xe73e5c['toLowerCase']())+_0x4c43('0xa9')]=_0x2d6519[_0x4c43('0x67')][_0x4c43('0x6a')][_0x4814ee];socket[_0x4c43('0xaa')](_0x4c43('0x6e')+_['capitalize'](_0xe73e5c[_0x4c43('0xa6')]())+_0x4c43('0xab'),_0x3c0f35);}return _0x152a20;})[_0x4c43('0x20')](function(){if(_0xe73e5c===_0x4c43('0xac')){return db[_0x4c43('0xad')][_0x4c43('0x5e')]({'where':{'id':_0x2d6519['body'][_0x4c43('0x6a')]||[]},'raw':!![],'attributes':['id',_0x4c43('0x43')]});}})[_0x4c43('0x20')](function(_0x36ef74){var _0x8fa8b=_0x520805[_0x4c43('0x37')]({'plain':!![]});var _0x7d633e=[];if(_0xe73e5c===_0x4c43('0xac')&&_0x8fa8b[_0x4c43('0x40')]===_0x4c43('0x3a')&&_0x8fa8b['online']){for(var _0x53efd7=0x0;_0x53efd7<_0x36ef74[_0x4c43('0x53')];_0x53efd7+=0x1){_0x7d633e[_0x4c43('0xae')]({'membername':_0x8fa8b[_0x4c43('0x43')],'UserId':_0x8fa8b['id'],'queue_name':_0x36ef74[_0x53efd7][_0x4c43('0x43')],'VoiceQueueId':_0x36ef74[_0x53efd7]['id'],'interface':_[_0x4c43('0x7a')](_0x8fa8b[_0x4c43('0xa1')])?util[_0x4c43('0x73')](_0x4c43('0xaf'),_0x8fa8b[_0x4c43('0x43')]):_0x8fa8b['interface'],'paused':_0x8fa8b[_0x4c43('0xa0')]||![],'penalty':_0x2d6519[_0x4c43('0x67')][_0x4c43('0xa7')]||0x0});}return BPromise[_0x4c43('0xb0')](_0x7d633e,function(_0x92344b){return db[_0x4c43('0xb1')][_0x4c43('0xb2')](_0x92344b);});}return _0x520805;});}})['then'](respondWithStatusCode(_0x421abe,null))[_0x4c43('0x60')](handleError(_0x421abe,null));};exports['removeQueues']=function(_0x113dcf,_0x155ff5,_0x11bb6f){var _0x37f4ad;return db[_0x4c43('0x46')][_0x4c43('0x41')]({'where':{'id':_0x113dcf['params']['id']},'attributes':['id',_0x4c43('0x43'),_0x4c43('0x40')]})[_0x4c43('0x20')](handleEntityNotFound(_0x155ff5,null))[_0x4c43('0x20')](function(_0x32a578){if(_0x32a578){_0x37f4ad=_0x32a578;if(!_0x113dcf[_0x4c43('0x4c')][_0x4c43('0x9d')]||!utils['isValidChannel'](_0x113dcf[_0x4c43('0x4c')]['channel'])){throw new db[(_0x4c43('0x96'))][(_0x4c43('0x1e'))]('Unknown\x20channel');}return _0x32a578[_0x4c43('0xb3')+_[_0x4c43('0xa5')](_0x113dcf['query']['channel'][_0x4c43('0xa6')]())+_0x4c43('0xb4')](_0x113dcf[_0x4c43('0x4c')][_0x4c43('0x6a')]);}})[_0x4c43('0x20')](function(_0x13e96a){for(var _0x137819=0x0;_0x137819<_0x113dcf[_0x4c43('0x4c')][_0x4c43('0x6a')][_0x4c43('0x53')];_0x137819+=0x1){var _0x178602={'UserId':_0x113dcf[_0x4c43('0x62')]['id']};_0x178602[_[_0x4c43('0xa5')](_0x113dcf[_0x4c43('0x4c')][_0x4c43('0x9d')][_0x4c43('0xa6')]())+_0x4c43('0xa9')]=_0x113dcf['query'][_0x4c43('0x6a')][_0x137819];socket[_0x4c43('0xaa')](_0x4c43('0x6e')+_[_0x4c43('0xa5')](_0x113dcf[_0x4c43('0x4c')][_0x4c43('0x9d')][_0x4c43('0xa6')]())+_0x4c43('0xb5'),_0x178602);}return _0x13e96a;})['then'](function(){if(_0x113dcf[_0x4c43('0x4c')][_0x4c43('0x9d')]===_0x4c43('0xac')){return db['UserVoiceQueueRt'][_0x4c43('0x36')]({'where':{'UserId':_0x113dcf['params']['id'],'VoiceQueueId':_0x113dcf[_0x4c43('0x4c')]['ids']},'individualHooks':!![]})[_0x4c43('0x20')](function(){return _0x37f4ad;});}return _0x37f4ad;})[_0x4c43('0x20')](respondWithStatusCode(_0x155ff5,null))[_0x4c43('0x60')](handleError(_0x155ff5,null));};exports[_0x4c43('0xb6')]=function(_0x29ece9,_0x21cb7f,_0x364f3a){_0x29ece9[_0x4c43('0x67')][_0x4c43('0xb7')]=_0x29ece9[_0x4c43('0xb8')]['filename'];return db[_0x4c43('0x46')][_0x4c43('0x41')]({'where':{'id':_0x29ece9['params']['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x21cb7f,null))['then'](saveUpdates(_0x29ece9['body'],null))[_0x4c43('0x20')](respondWithResult(_0x21cb7f,null))['catch'](handleError(_0x21cb7f,null));};exports['getAvatar']=function(_0x1f0b6c,_0x329c3d,_0xd29140){var _0x381e91=path['join'](config[_0x4c43('0xb9')],'server/files/images/logos/default_profile.png');return db[_0x4c43('0x46')][_0x4c43('0x41')]({'where':{'id':_0x1f0b6c[_0x4c43('0x62')]['id']},'attributes':['id',_0x4c43('0xb7')],'raw':!![]})[_0x4c43('0x20')](handleEntityNotFound(_0x329c3d,null))[_0x4c43('0x20')](function(_0x2b7934){if(_0x2b7934){if(_['isNil'](_0x2b7934[_0x4c43('0xb7')])){return _0x329c3d[_0x4c43('0xba')](_0x381e91);}else{if(!fs[_0x4c43('0xbb')](path[_0x4c43('0xbc')](config['root'],'server/files/images/',_0x2b7934[_0x4c43('0xb7')]))){return _0x329c3d['download'](_0x381e91);}return _0x329c3d[_0x4c43('0xba')](path['join'](config[_0x4c43('0xb9')],_0x4c43('0xbd'),_0x2b7934[_0x4c43('0xb7')]));}}})[_0x4c43('0x60')](handleError(_0x329c3d,null));};exports[_0x4c43('0xbe')]=function(_0x1ec400,_0x265849,_0xc1e7ac){var _0x159254={};var _0x5425bb={};var _0x1adbc9;var _0x28285c;return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x1ec400['params']['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x265849,null))[_0x4c43('0x20')](function(_0x19f28f){if(_0x19f28f){_0x1adbc9=_0x19f28f;_0x5425bb[_0x4c43('0x51')]=_['keys'](db[_0x4c43('0xc0')][_0x4c43('0x47')]);_0x5425bb[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x1ec400[_0x4c43('0x4c')]);_0x5425bb[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x5425bb[_0x4c43('0x51')],_0x5425bb[_0x4c43('0x4c')]);_0x159254[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x5425bb['model'],qs[_0x4c43('0x52')](_0x1ec400[_0x4c43('0x4c')][_0x4c43('0x52')]));_0x159254['attributes']=_0x159254['attributes'][_0x4c43('0x53')]?_0x159254[_0x4c43('0x50')]:_0x5425bb[_0x4c43('0x51')];_0x159254[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x1ec400['query'][_0x4c43('0x56')]);_0x159254[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x1ec400['query'],_0x5425bb[_0x4c43('0x4e')]));if(_0x1ec400[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x159254['where']=_[_0x4c43('0x59')](_0x159254['where'],{'$or':_[_0x4c43('0x3e')](_0x159254[_0x4c43('0x50')],function(_0x49fda8){var _0x27e28f={};_0x27e28f[_0x49fda8]={'$like':'%'+_0x1ec400[_0x4c43('0x4c')]['filter']+'%'};return _0x27e28f;})});}_0x159254=_[_0x4c43('0x59')]({},_0x159254,_0x1ec400[_0x4c43('0x65')]);return _0x1adbc9[_0x4c43('0xbe')](_0x159254);}})['then'](function(_0x18c3b6){if(_0x18c3b6){_0x28285c=_0x18c3b6['length'];if(_0x1ec400['query'][_0x4c43('0x54')](_0x4c43('0x5c'))){_0x159254[_0x4c43('0x5d')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db['Tag'],'as':_0x4c43('0xc2'),'attributes':['id',_0x4c43('0x43'),_0x4c43('0xc3')],'where':_0x1ec400[_0x4c43('0x4c')][_0x4c43('0xc4')]?{'id':_0x1ec400[_0x4c43('0x4c')][_0x4c43('0xc4')]}:undefined,'required':_0x1ec400[_0x4c43('0x4c')]['tag']?!![]:![]}];}if(!_0x1ec400['query'][_0x4c43('0x54')](_0x4c43('0x55'))){_0x159254[_0x4c43('0x2f')]=qs[_0x4c43('0x2f')](_0x1ec400[_0x4c43('0x4c')][_0x4c43('0x2f')]);_0x159254[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x1ec400[_0x4c43('0x4c')][_0x4c43('0x2e')]);}return _0x1adbc9['getContacts'](_0x159254);}})[_0x4c43('0x20')](function(_0x3978da){if(_0x3978da){return _0x3978da?{'count':_0x28285c,'rows':_0x3978da}:null;}})[_0x4c43('0x20')](respondWithResult(_0x265849,null))[_0x4c43('0x60')](handleError(_0x265849,null));};exports[_0x4c43('0xc5')]=function(_0x4086b5,_0x10473f,_0x5c4d55){var _0x187522;var _0x254bc3;var _0x6c35b8={};var _0x532b3a;return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x4086b5[_0x4c43('0x62')]['id']},'attributes':['id','name',_0x4c43('0x40')]})[_0x4c43('0x20')](handleEntityNotFound(_0x10473f,null))[_0x4c43('0x20')](function(_0x52dd06){if(!utils[_0x4c43('0xa2')](_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x9d')])){throw new db['Sequelize'][(_0x4c43('0x1e'))]('Unknown\x20channel');}_0x187522=_0x52dd06;var _0x314855={};_0x314855[_0x4c43('0x51')]=_[_0x4c43('0x4d')](db[_['capitalize'](_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x9d')])+'Queue'][_0x4c43('0x47')]);_0x314855['query']=_['keys'](_0x4086b5[_0x4c43('0x4c')]);_0x314855[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x314855[_0x4c43('0x51')],_0x314855[_0x4c43('0x4c')]);_0x6c35b8[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x314855[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x4086b5[_0x4c43('0x4c')]['fields']));_0x6c35b8[_0x4c43('0x50')]=_0x6c35b8[_0x4c43('0x50')][_0x4c43('0x53')]?_0x6c35b8['attributes']:_0x314855[_0x4c43('0x51')];_0x6c35b8[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x56')]);_0x6c35b8['where']=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x4086b5['query'],_0x314855[_0x4c43('0x4e')]));if(_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x6c35b8[_0x4c43('0x57')]=_['merge'](_0x6c35b8[_0x4c43('0x57')],{'$or':_['map'](_0x6c35b8[_0x4c43('0x50')],function(_0x4bbce9){var _0x6cf936={};_0x6cf936[_0x4bbce9]={'$like':'%'+_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x6cf936;})});}_0x6c35b8=_[_0x4c43('0x59')]({},_0x6c35b8,_0x4086b5[_0x4c43('0x65')]);switch(_0x187522['role']){case _0x4c43('0x6d'):return db[_[_0x4c43('0xa5')](_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x9d')])+_0x4c43('0xc6')][_0x4c43('0x5e')](_0x6c35b8);case _0x4c43('0x6e'):case'agent':return _0x187522[_0x4c43('0x37')+_[_0x4c43('0xa5')](_0x4086b5[_0x4c43('0x4c')]['channel'])+_0x4c43('0xb4')](_0x6c35b8);default:throw new db[(_0x4c43('0x96'))][(_0x4c43('0x1e'))]('Unknown\x20role');}})['then'](function(_0x57da71){_0x532b3a=_0x57da71['length'];if(!_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x54')](_0x4c43('0x55'))){_0x6c35b8[_0x4c43('0x2f')]=qs[_0x4c43('0x2f')](_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x2f')]);_0x6c35b8['offset']=qs[_0x4c43('0x2e')](_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x2e')]);}switch(_0x187522['role']){case'admin':return db[_[_0x4c43('0xa5')](_0x4086b5['query'][_0x4c43('0x9d')])+_0x4c43('0xc6')][_0x4c43('0x5e')](_0x6c35b8);case'user':case'agent':return _0x187522[_0x4c43('0x37')+_[_0x4c43('0xa5')](_0x4086b5['query']['channel'])+'Queues'](_0x6c35b8);}})[_0x4c43('0x20')](function(_0x5f2264){return{'count':_0x532b3a,'rows':_0x5f2264};})[_0x4c43('0x20')](respondWithResult(_0x10473f,null))['catch'](handleError(_0x10473f,null));};exports[_0x4c43('0xc7')]=function(_0x101b3a,_0x2bf8f9,_0x383c47){var _0x1f1dab={};var _0x56fccf={};var _0x5a5343;var _0x28546c;return db['User'][_0x4c43('0xbf')]({'where':{'id':_0x101b3a['params']['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x2bf8f9,null))['then'](function(_0x25025c){if(_0x25025c){_0x5a5343=_0x25025c;_0x56fccf[_0x4c43('0x51')]=_['keys'](db[_0x4c43('0xb1')]['rawAttributes']);_0x56fccf[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x101b3a[_0x4c43('0x4c')]);_0x56fccf[_0x4c43('0x4e')]=_['intersection'](_0x56fccf['model'],_0x56fccf[_0x4c43('0x4c')]);_0x1f1dab[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x56fccf[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x101b3a['query']['fields']));_0x1f1dab[_0x4c43('0x50')]=_0x1f1dab['attributes'][_0x4c43('0x53')]?_0x1f1dab[_0x4c43('0x50')]:_0x56fccf[_0x4c43('0x51')];_0x1f1dab[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x101b3a[_0x4c43('0x4c')][_0x4c43('0x56')]);_0x1f1dab[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x101b3a[_0x4c43('0x4c')],_0x56fccf[_0x4c43('0x4e')]));if(_0x101b3a[_0x4c43('0x4c')]['filter']){_0x1f1dab[_0x4c43('0x57')]=_['merge'](_0x1f1dab['where'],{'$or':_['map'](_0x1f1dab['attributes'],function(_0x4dc9e8){var _0x9f46c8={};_0x9f46c8[_0x4dc9e8]={'$like':'%'+_0x101b3a[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x9f46c8;})});}_0x1f1dab=_[_0x4c43('0x59')]({},_0x1f1dab,_0x101b3a['options']);return _0x5a5343[_0x4c43('0xc7')](_0x1f1dab);}})[_0x4c43('0x20')](function(_0x2bc3d0){if(_0x2bc3d0){_0x28546c=_0x2bc3d0['length'];if(!_0x101b3a[_0x4c43('0x4c')]['hasOwnProperty']('nolimit')){_0x1f1dab[_0x4c43('0x2f')]=qs[_0x4c43('0x2f')](_0x101b3a[_0x4c43('0x4c')]['limit']);_0x1f1dab[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x101b3a['query'][_0x4c43('0x2e')]);}return _0x5a5343[_0x4c43('0xc7')](_0x1f1dab);}})[_0x4c43('0x20')](function(_0x2a3a79){if(_0x2a3a79){return _0x2a3a79?{'count':_0x28546c,'rows':_0x2a3a79}:null;}})['then'](respondWithResult(_0x2bf8f9,null))['catch'](handleError(_0x2bf8f9,null));};exports[_0x4c43('0xc8')]=function(_0x1d329d,_0xb78992,_0x28d7ce){var _0x3caa4f={};var _0x3dd20d={};var _0x5cefa2;var _0x325f3e;return db['User']['findOne']({'where':{'id':_0x1d329d[_0x4c43('0x62')]['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0xb78992,null))['then'](function(_0x258255){if(_0x258255){_0x5cefa2=_0x258255;_0x3dd20d[_0x4c43('0x51')]=_[_0x4c43('0x4d')](db[_0x4c43('0xc9')][_0x4c43('0x47')]);_0x3dd20d[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x1d329d[_0x4c43('0x4c')]);_0x3dd20d['filters']=_[_0x4c43('0x4f')](_0x3dd20d[_0x4c43('0x51')],_0x3dd20d['query']);_0x3caa4f[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x3dd20d['model'],qs[_0x4c43('0x52')](_0x1d329d[_0x4c43('0x4c')]['fields']));_0x3caa4f[_0x4c43('0x50')]=_0x3caa4f['attributes']['length']?_0x3caa4f[_0x4c43('0x50')]:_0x3dd20d[_0x4c43('0x51')];_0x3caa4f[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x1d329d[_0x4c43('0x4c')][_0x4c43('0x56')]);_0x3caa4f[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x1d329d['query'],_0x3dd20d[_0x4c43('0x4e')]));if(_0x1d329d[_0x4c43('0x4c')]['filter']){_0x3caa4f[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0x3caa4f[_0x4c43('0x57')],{'$or':_[_0x4c43('0x3e')](_0x3caa4f['attributes'],function(_0x53aa4c){var _0x16f8a9={};_0x16f8a9[_0x53aa4c]={'$like':'%'+_0x1d329d[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x16f8a9;})});}_0x3caa4f=_['merge']({},_0x3caa4f,_0x1d329d[_0x4c43('0x65')]);return _0x5cefa2[_0x4c43('0xc8')](_0x3caa4f);}})[_0x4c43('0x20')](function(_0x4f858f){if(_0x4f858f){_0x325f3e=_0x4f858f[_0x4c43('0x53')];if(!_0x1d329d[_0x4c43('0x4c')][_0x4c43('0x54')](_0x4c43('0x55'))){_0x3caa4f[_0x4c43('0x2f')]=qs['limit'](_0x1d329d[_0x4c43('0x4c')][_0x4c43('0x2f')]);_0x3caa4f['offset']=qs[_0x4c43('0x2e')](_0x1d329d[_0x4c43('0x4c')][_0x4c43('0x2e')]);}return _0x5cefa2[_0x4c43('0xc8')](_0x3caa4f);}})[_0x4c43('0x20')](function(_0x2aab71){if(_0x2aab71){return _0x2aab71?{'count':_0x325f3e,'rows':_0x2aab71}:null;}})['then'](respondWithResult(_0xb78992,null))['catch'](handleError(_0xb78992,null));};exports[_0x4c43('0xca')]=function(_0x24af1b,_0x3f615e,_0x4f636b){var _0x459fb3={'raw':!![],'where':{}};var _0xe27075={};var _0x48cb8d={'count':0x0,'rows':[]};return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x24af1b['params']['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x3f615e,null))[_0x4c43('0x20')](function(_0x6b265c){if(_0x6b265c){_0xe27075[_0x4c43('0x51')]=_[_0x4c43('0x4d')](db['VoiceRecording'][_0x4c43('0x47')]);_0xe27075[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x24af1b['query']);_0xe27075[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0xe27075['model'],_0xe27075[_0x4c43('0x4c')]);_0x459fb3['attributes']=_['intersection'](_0xe27075[_0x4c43('0x51')],qs['fields'](_0x24af1b['query'][_0x4c43('0x52')]));_0x459fb3[_0x4c43('0x50')]=_0x459fb3[_0x4c43('0x50')][_0x4c43('0x53')]?_0x459fb3['attributes']:_0xe27075['model'];if(!_0x24af1b[_0x4c43('0x4c')][_0x4c43('0x54')](_0x4c43('0x55'))){_0x459fb3['limit']=qs['limit'](_0x24af1b[_0x4c43('0x4c')]['limit']);_0x459fb3[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x24af1b[_0x4c43('0x4c')][_0x4c43('0x2e')]);}_0x459fb3['order']=qs[_0x4c43('0x56')](_0x24af1b[_0x4c43('0x4c')][_0x4c43('0x56')]);_0x459fb3['where']=qs['filters'](_[_0x4c43('0x58')](_0x24af1b[_0x4c43('0x4c')],_0xe27075[_0x4c43('0x4e')]));_0x459fb3[_0x4c43('0x57')][_0x4c43('0xcb')]=_0x6b265c['id'];if(_0x24af1b['query'][_0x4c43('0x3c')]){_0x459fb3['where']=_[_0x4c43('0x59')](_0x459fb3[_0x4c43('0x57')],{'$or':_[_0x4c43('0x3e')](_0x459fb3[_0x4c43('0x50')],function(_0x2b0345){var _0x2d4fed={};_0x2d4fed[_0x2b0345]={'$like':'%'+_0x24af1b[_0x4c43('0x4c')]['filter']+'%'};return _0x2d4fed;})});}_0x459fb3=_[_0x4c43('0x59')]({},_0x459fb3,_0x24af1b['options']);return db[_0x4c43('0xcc')]['count']({'where':_0x459fb3[_0x4c43('0x57')]})[_0x4c43('0x20')](function(_0x22f3b5){_0x48cb8d['count']=_0x22f3b5;if(_0x24af1b[_0x4c43('0x4c')][_0x4c43('0x5c')]){_0x459fb3[_0x4c43('0x5d')]=[{'all':!![]}];}return db[_0x4c43('0xcc')][_0x4c43('0x5e')](_0x459fb3);})['then'](function(_0x1dd03b){_0x48cb8d['rows']=_0x1dd03b;return _0x48cb8d;});}})[_0x4c43('0x20')](respondWithFilteredResult(_0x3f615e,_0x459fb3))[_0x4c43('0x60')](handleError(_0x3f615e,null));};exports[_0x4c43('0xcd')]=function(_0x481cf3,_0x33ba1c,_0x383614){var _0x37482f={'raw':!![],'where':{}};var _0x380061={};var _0x4dfbcb={'count':0x0,'rows':[]};return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x481cf3['params']['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x33ba1c,null))['then'](function(_0x395c30){if(_0x395c30){_0x380061[_0x4c43('0x51')]=_['keys'](db[_0x4c43('0xce')][_0x4c43('0x47')]);_0x380061[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x481cf3['query']);_0x380061[_0x4c43('0x4e')]=_['intersection'](_0x380061['model'],_0x380061['query']);_0x37482f[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x380061[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x481cf3[_0x4c43('0x4c')][_0x4c43('0x52')]));_0x37482f['attributes']=_0x37482f['attributes'][_0x4c43('0x53')]?_0x37482f[_0x4c43('0x50')]:_0x380061[_0x4c43('0x51')];if(!_0x481cf3['query']['hasOwnProperty'](_0x4c43('0x55'))){_0x37482f[_0x4c43('0x2f')]=qs[_0x4c43('0x2f')](_0x481cf3[_0x4c43('0x4c')][_0x4c43('0x2f')]);_0x37482f[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x481cf3[_0x4c43('0x4c')][_0x4c43('0x2e')]);}_0x37482f[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x481cf3[_0x4c43('0x4c')][_0x4c43('0x56')]);_0x37482f['where']=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x481cf3['query'],_0x380061[_0x4c43('0x4e')]));_0x37482f['where'][_0x4c43('0xcb')]=_0x395c30['id'];if(_0x481cf3[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x37482f[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0x37482f[_0x4c43('0x57')],{'$or':_[_0x4c43('0x3e')](_0x37482f[_0x4c43('0x50')],function(_0x4f9022){var _0x103ded={};_0x103ded[_0x4f9022]={'$like':'%'+_0x481cf3['query']['filter']+'%'};return _0x103ded;})});}_0x37482f=_['merge']({},_0x37482f,_0x481cf3[_0x4c43('0x65')]);return db[_0x4c43('0xce')]['count']({'where':_0x37482f['where']})[_0x4c43('0x20')](function(_0x642bf3){_0x4dfbcb[_0x4c43('0x2d')]=_0x642bf3;if(_0x481cf3[_0x4c43('0x4c')][_0x4c43('0x5c')]){_0x37482f[_0x4c43('0x5d')]=[{'all':!![]}];}return db[_0x4c43('0xce')][_0x4c43('0x5e')](_0x37482f);})['then'](function(_0x1e98a9){_0x4dfbcb[_0x4c43('0x5f')]=_0x1e98a9;return _0x4dfbcb;});}})[_0x4c43('0x20')](respondWithFilteredResult(_0x33ba1c,_0x37482f))[_0x4c43('0x60')](handleError(_0x33ba1c,null));};exports['getChatInteractions']=function(_0x3443e2,_0x8e735e,_0x5ee0a7){var _0x681d20={};var _0x32ea8a={};var _0x34e49e;var _0x4a8d57;return db[_0x4c43('0x46')]['findOne']({'where':{'id':_0x3443e2['params']['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x8e735e,null))[_0x4c43('0x20')](function(_0x5e9bd5){if(_0x5e9bd5){_0x34e49e=_0x5e9bd5;_0x32ea8a['model']=_[_0x4c43('0x4d')](db['ChatInteraction']['rawAttributes']);_0x32ea8a[_0x4c43('0x4c')]=_['keys'](_0x3443e2[_0x4c43('0x4c')]);_0x32ea8a[_0x4c43('0x4e')]=_['intersection'](_0x32ea8a['model'],_0x32ea8a[_0x4c43('0x4c')]);_0x681d20[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x32ea8a[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x3443e2[_0x4c43('0x4c')][_0x4c43('0x52')]));_0x681d20[_0x4c43('0x50')]=_0x681d20[_0x4c43('0x50')][_0x4c43('0x53')]?_0x681d20[_0x4c43('0x50')]:_0x32ea8a['model'];_0x681d20[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x3443e2[_0x4c43('0x4c')][_0x4c43('0x56')]);_0x681d20[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x3443e2[_0x4c43('0x4c')],_0x32ea8a[_0x4c43('0x4e')]));if(_0x3443e2[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x681d20[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0x681d20['where'],{'$or':_[_0x4c43('0x3e')](_0x681d20[_0x4c43('0x50')],function(_0x2e4389){var _0x31756c={};_0x31756c[_0x2e4389]={'$like':'%'+_0x3443e2[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x31756c;})});}_0x681d20=_['merge']({},_0x681d20,_0x3443e2[_0x4c43('0x65')]);return _0x34e49e[_0x4c43('0xcf')](_0x681d20);}})[_0x4c43('0x20')](function(_0x3d19ba){if(_0x3d19ba){_0x4a8d57=_0x3d19ba[_0x4c43('0x53')];if(!_0x3443e2[_0x4c43('0x4c')][_0x4c43('0x54')](_0x4c43('0x55'))){_0x681d20['limit']=qs[_0x4c43('0x2f')](_0x3443e2[_0x4c43('0x4c')][_0x4c43('0x2f')]);_0x681d20[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x3443e2[_0x4c43('0x4c')][_0x4c43('0x2e')]);}return _0x34e49e[_0x4c43('0xcf')](_0x681d20);}})[_0x4c43('0x20')](function(_0x4755d0){if(_0x4755d0){return _0x4755d0?{'count':_0x4a8d57,'rows':_0x4755d0}:null;}})[_0x4c43('0x20')](respondWithResult(_0x8e735e,null))['catch'](handleError(_0x8e735e,null));};exports[_0x4c43('0xd0')]=function(_0x750e3,_0x4b7330,_0x468e79){var _0x3b90d1={};var _0x3c136c={};var _0x3def48;var _0x538e61;return db[_0x4c43('0x46')]['findOne']({'where':{'id':_0x750e3[_0x4c43('0x62')]['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x4b7330,null))['then'](function(_0x4a867e){if(_0x4a867e){_0x3def48=_0x4a867e;_0x3c136c[_0x4c43('0x51')]=_['keys'](db[_0x4c43('0xd1')][_0x4c43('0x47')]);_0x3c136c[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x750e3[_0x4c43('0x4c')]);_0x3c136c[_0x4c43('0x4e')]=_['intersection'](_0x3c136c['model'],_0x3c136c[_0x4c43('0x4c')]);_0x3b90d1['attributes']=_[_0x4c43('0x4f')](_0x3c136c[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x750e3['query'][_0x4c43('0x52')]));_0x3b90d1['attributes']=_0x3b90d1[_0x4c43('0x50')][_0x4c43('0x53')]?_0x3b90d1[_0x4c43('0x50')]:_0x3c136c[_0x4c43('0x51')];_0x3b90d1[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x750e3[_0x4c43('0x4c')]['sort']);_0x3b90d1[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x750e3[_0x4c43('0x4c')],_0x3c136c[_0x4c43('0x4e')]));if(_0x750e3[_0x4c43('0x4c')]['filter']){_0x3b90d1[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0x3b90d1['where'],{'$or':_[_0x4c43('0x3e')](_0x3b90d1[_0x4c43('0x50')],function(_0x40f039){var _0x21c2ef={};_0x21c2ef[_0x40f039]={'$like':'%'+_0x750e3[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x21c2ef;})});}_0x3b90d1=_[_0x4c43('0x59')]({},_0x3b90d1,_0x750e3[_0x4c43('0x65')]);return _0x3def48[_0x4c43('0xd0')](_0x3b90d1);}})['then'](function(_0x4aa07e){if(_0x4aa07e){_0x538e61=_0x4aa07e['length'];if(!_0x750e3['query'][_0x4c43('0x54')]('nolimit')){_0x3b90d1[_0x4c43('0x2f')]=qs['limit'](_0x750e3['query'][_0x4c43('0x2f')]);_0x3b90d1[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x750e3[_0x4c43('0x4c')][_0x4c43('0x2e')]);}return _0x3def48[_0x4c43('0xd0')](_0x3b90d1);}})['then'](function(_0x219537){if(_0x219537){return _0x219537?{'count':_0x538e61,'rows':_0x219537}:null;}})[_0x4c43('0x20')](respondWithResult(_0x4b7330,null))[_0x4c43('0x60')](handleError(_0x4b7330,null));};exports[_0x4c43('0xd2')]=function(_0x2d0b0a,_0x2eb8a9,_0x4957bb){var _0xf25462={'raw':!![],'where':{}};var _0x3df12b={};var _0x365a4b={'count':0x0,'rows':[]};return db['User'][_0x4c43('0xbf')]({'where':{'id':_0x2d0b0a[_0x4c43('0x62')]['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x2eb8a9,null))[_0x4c43('0x20')](function(_0x3f6119){if(_0x3f6119){_0x3df12b[_0x4c43('0x51')]=_[_0x4c43('0x4d')](db[_0x4c43('0xd3')][_0x4c43('0x47')]);_0x3df12b[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x2d0b0a[_0x4c43('0x4c')]);_0x3df12b[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x3df12b['model'],_0x3df12b[_0x4c43('0x4c')]);_0xf25462[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x3df12b[_0x4c43('0x51')],qs['fields'](_0x2d0b0a[_0x4c43('0x4c')]['fields']));_0xf25462['attributes']=_0xf25462['attributes'][_0x4c43('0x53')]?_0xf25462[_0x4c43('0x50')]:_0x3df12b[_0x4c43('0x51')];if(!_0x2d0b0a[_0x4c43('0x4c')][_0x4c43('0x54')]('nolimit')){_0xf25462[_0x4c43('0x2f')]=qs[_0x4c43('0x2f')](_0x2d0b0a[_0x4c43('0x4c')]['limit']);_0xf25462[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x2d0b0a[_0x4c43('0x4c')]['offset']);}_0xf25462[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x2d0b0a[_0x4c43('0x4c')]['sort']);_0xf25462[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x2d0b0a[_0x4c43('0x4c')],_0x3df12b[_0x4c43('0x4e')]));_0xf25462[_0x4c43('0x57')]['UserId']=_0x3f6119['id'];if(_0x2d0b0a[_0x4c43('0x4c')]['filter']){_0xf25462[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0xf25462[_0x4c43('0x57')],{'$or':_[_0x4c43('0x3e')](_0xf25462[_0x4c43('0x50')],function(_0x303b44){var _0x3bbaf0={};_0x3bbaf0[_0x303b44]={'$like':'%'+_0x2d0b0a[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x3bbaf0;})});}_0xf25462=_['merge']({},_0xf25462,_0x2d0b0a[_0x4c43('0x65')]);return db[_0x4c43('0xd3')]['count']({'where':_0xf25462[_0x4c43('0x57')]})[_0x4c43('0x20')](function(_0x81e28){_0x365a4b[_0x4c43('0x2d')]=_0x81e28;if(_0x2d0b0a[_0x4c43('0x4c')][_0x4c43('0x5c')]){_0xf25462['include']=[{'all':!![]}];}return db[_0x4c43('0xd3')][_0x4c43('0x5e')](_0xf25462);})['then'](function(_0x537375){_0x365a4b[_0x4c43('0x5f')]=_0x537375;return _0x365a4b;});}})['then'](respondWithFilteredResult(_0x2eb8a9,_0xf25462))[_0x4c43('0x60')](handleError(_0x2eb8a9,null));};exports[_0x4c43('0xd4')]=function(_0x90f466,_0x349c4f,_0x5665e6){var _0x26ed32={};var _0x396774={};var _0xb71c13;var _0x2b6a1b;return db[_0x4c43('0x46')]['findOne']({'where':{'id':_0x90f466[_0x4c43('0x62')]['id']}})['then'](handleEntityNotFound(_0x349c4f,null))[_0x4c43('0x20')](function(_0x221554){if(_0x221554){_0xb71c13=_0x221554;_0x396774[_0x4c43('0x51')]=_[_0x4c43('0x4d')](db[_0x4c43('0xd5')]['rawAttributes']);_0x396774['query']=_[_0x4c43('0x4d')](_0x90f466[_0x4c43('0x4c')]);_0x396774[_0x4c43('0x4e')]=_['intersection'](_0x396774['model'],_0x396774[_0x4c43('0x4c')]);_0x26ed32[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x396774['model'],qs[_0x4c43('0x52')](_0x90f466['query'][_0x4c43('0x52')]));_0x26ed32['attributes']=_0x26ed32[_0x4c43('0x50')][_0x4c43('0x53')]?_0x26ed32[_0x4c43('0x50')]:_0x396774[_0x4c43('0x51')];_0x26ed32[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x90f466[_0x4c43('0x4c')]['sort']);_0x26ed32[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x90f466[_0x4c43('0x4c')],_0x396774[_0x4c43('0x4e')]));if(_0x90f466[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x26ed32[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0x26ed32[_0x4c43('0x57')],{'$or':_[_0x4c43('0x3e')](_0x26ed32[_0x4c43('0x50')],function(_0x3c4cfd){var _0x1ae2cf={};_0x1ae2cf[_0x3c4cfd]={'$like':'%'+_0x90f466[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x1ae2cf;})});}_0x26ed32=_[_0x4c43('0x59')]({},_0x26ed32,_0x90f466[_0x4c43('0x65')]);return _0xb71c13['getSmsInteractions'](_0x26ed32);}})[_0x4c43('0x20')](function(_0x513675){if(_0x513675){_0x2b6a1b=_0x513675['length'];if(!_0x90f466[_0x4c43('0x4c')][_0x4c43('0x54')](_0x4c43('0x55'))){_0x26ed32[_0x4c43('0x2f')]=qs[_0x4c43('0x2f')](_0x90f466[_0x4c43('0x4c')]['limit']);_0x26ed32['offset']=qs['offset'](_0x90f466['query'][_0x4c43('0x2e')]);}return _0xb71c13[_0x4c43('0xd4')](_0x26ed32);}})[_0x4c43('0x20')](function(_0x22156d){if(_0x22156d){return _0x22156d?{'count':_0x2b6a1b,'rows':_0x22156d}:null;}})['then'](respondWithResult(_0x349c4f,null))[_0x4c43('0x60')](handleError(_0x349c4f,null));};exports['getFaxInteractions']=function(_0x4fbefb,_0x5a7906,_0x17277b){var _0x11a182={};var _0x5de065={};var _0x404b73;var _0x278833;return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x4fbefb[_0x4c43('0x62')]['id']}})['then'](handleEntityNotFound(_0x5a7906,null))[_0x4c43('0x20')](function(_0x348bca){if(_0x348bca){_0x404b73=_0x348bca;_0x5de065[_0x4c43('0x51')]=_[_0x4c43('0x4d')](db[_0x4c43('0xd6')][_0x4c43('0x47')]);_0x5de065[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x4fbefb[_0x4c43('0x4c')]);_0x5de065[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x5de065[_0x4c43('0x51')],_0x5de065[_0x4c43('0x4c')]);_0x11a182[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x5de065[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x4fbefb['query'][_0x4c43('0x52')]));_0x11a182[_0x4c43('0x50')]=_0x11a182[_0x4c43('0x50')][_0x4c43('0x53')]?_0x11a182[_0x4c43('0x50')]:_0x5de065[_0x4c43('0x51')];_0x11a182['order']=qs['sort'](_0x4fbefb[_0x4c43('0x4c')][_0x4c43('0x56')]);_0x11a182[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x4fbefb[_0x4c43('0x4c')],_0x5de065[_0x4c43('0x4e')]));if(_0x4fbefb[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x11a182['where']=_[_0x4c43('0x59')](_0x11a182['where'],{'$or':_['map'](_0x11a182['attributes'],function(_0x229b73){var _0x3e5317={};_0x3e5317[_0x229b73]={'$like':'%'+_0x4fbefb[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x3e5317;})});}_0x11a182=_[_0x4c43('0x59')]({},_0x11a182,_0x4fbefb[_0x4c43('0x65')]);return _0x404b73[_0x4c43('0xd7')](_0x11a182);}})[_0x4c43('0x20')](function(_0x23eaaa){if(_0x23eaaa){_0x278833=_0x23eaaa[_0x4c43('0x53')];if(!_0x4fbefb[_0x4c43('0x4c')]['hasOwnProperty']('nolimit')){_0x11a182[_0x4c43('0x2f')]=qs['limit'](_0x4fbefb[_0x4c43('0x4c')][_0x4c43('0x2f')]);_0x11a182[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x4fbefb[_0x4c43('0x4c')][_0x4c43('0x2e')]);}return _0x404b73[_0x4c43('0xd7')](_0x11a182);}})[_0x4c43('0x20')](function(_0x3581f3){if(_0x3581f3){return _0x3581f3?{'count':_0x278833,'rows':_0x3581f3}:null;}})[_0x4c43('0x20')](respondWithResult(_0x5a7906,null))['catch'](handleError(_0x5a7906,null));};exports[_0x4c43('0xd8')]=function(_0x5c4b33,_0x470b0f,_0x23d7b9){var _0x2e4cd1={};var _0x5ee103={};var _0x215c37;var _0x572322;return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x5c4b33[_0x4c43('0x62')]['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x470b0f,null))[_0x4c43('0x20')](function(_0x39efb0){if(_0x39efb0){_0x215c37=_0x39efb0;_0x5ee103['model']=_[_0x4c43('0x4d')](db[_0x4c43('0xd9')]['rawAttributes']);_0x5ee103[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x5c4b33[_0x4c43('0x4c')]);_0x5ee103[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x5ee103[_0x4c43('0x51')],_0x5ee103[_0x4c43('0x4c')]);_0x2e4cd1[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x5ee103['model'],qs[_0x4c43('0x52')](_0x5c4b33[_0x4c43('0x4c')][_0x4c43('0x52')]));_0x2e4cd1['attributes']=_0x2e4cd1[_0x4c43('0x50')][_0x4c43('0x53')]?_0x2e4cd1[_0x4c43('0x50')]:_0x5ee103[_0x4c43('0x51')];_0x2e4cd1[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x5c4b33['query'][_0x4c43('0x56')]);_0x2e4cd1[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_['pick'](_0x5c4b33[_0x4c43('0x4c')],_0x5ee103[_0x4c43('0x4e')]));if(_0x5c4b33[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x2e4cd1[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0x2e4cd1['where'],{'$or':_[_0x4c43('0x3e')](_0x2e4cd1['attributes'],function(_0x25faff){var _0x31d456={};_0x31d456[_0x25faff]={'$like':'%'+_0x5c4b33['query'][_0x4c43('0x3c')]+'%'};return _0x31d456;})});}_0x2e4cd1=_[_0x4c43('0x59')]({},_0x2e4cd1,_0x5c4b33['options']);return _0x215c37[_0x4c43('0xd8')](_0x2e4cd1);}})[_0x4c43('0x20')](function(_0x3daf2c){if(_0x3daf2c){_0x572322=_0x3daf2c[_0x4c43('0x53')];if(!_0x5c4b33[_0x4c43('0x4c')]['hasOwnProperty'](_0x4c43('0x55'))){_0x2e4cd1[_0x4c43('0x2f')]=qs[_0x4c43('0x2f')](_0x5c4b33[_0x4c43('0x4c')][_0x4c43('0x2f')]);_0x2e4cd1['offset']=qs[_0x4c43('0x2e')](_0x5c4b33[_0x4c43('0x4c')][_0x4c43('0x2e')]);}return _0x215c37['getWhatsappInteractions'](_0x2e4cd1);}})[_0x4c43('0x20')](function(_0x35deb7){if(_0x35deb7){return _0x35deb7?{'count':_0x572322,'rows':_0x35deb7}:null;}})[_0x4c43('0x20')](respondWithResult(_0x470b0f,null))[_0x4c43('0x60')](handleError(_0x470b0f,null));};exports['login']=function(_0x56d858,_0x381677,_0x58666b){var _0xc01d9d;var _0x4fa470;var _0x2f93e7;var _0x492798=!_[_0x4c43('0x7a')](_0x56d858[_0x4c43('0x62')]['id'])?_0x56d858[_0x4c43('0x62')]['id']:!_[_0x4c43('0x7a')](_0x56d858['user']['id'])?_0x56d858[_0x4c43('0x6e')]['id']:null;return db['User'][_0x4c43('0x41')]({'where':{'id':_0x492798,'role':{'$or':[_0x4c43('0x6d'),_0x4c43('0x6e'),_0x4c43('0x3a')]}},'attributes':['id',_0x4c43('0x43'),_0x4c43('0xda'),'mobile',_0x4c43('0x40'),_0x4c43('0x76'),_0x4c43('0x9f')]})[_0x4c43('0x20')](function(_0x97e8cf){if(_0x97e8cf){if(_0x97e8cf[_0x4c43('0x40')]===_0x4c43('0x3a')){_0xc01d9d=_0x97e8cf;if(_0x56d858[_0x4c43('0x67')][_0x4c43('0xa1')]){_0x2f93e7=util[_0x4c43('0x73')](_0x4c43('0xdb'),_0xc01d9d[_0x56d858['body']['interface']]);}else if(_0x56d858[_0x4c43('0x67')][_0x4c43('0xdc')]){_0x2f93e7=util['format'](_0x4c43('0xaf'),_0x56d858[_0x4c43('0x67')]['intrf']);}else{_0x2f93e7=util['format']('SIP/%s',_0xc01d9d['name']);}socket['to'](util['format'](_0x4c43('0xdd'),_0xc01d9d[_0x4c43('0x43')]))[_0x4c43('0xaa')](_0x4c43('0xde'),{'ip':_0x56d858[_0x4c43('0xdf')][_0x4c43('0xe0')]||_0x56d858[_0x4c43('0xe1')][_0x4c43('0xe2')]||_0x56d858['socket'][_0x4c43('0xe2')]||_0x56d858[_0x4c43('0xe1')][_0x4c43('0xe3')]['remoteAddress']});return db[_0x4c43('0xb1')][_0x4c43('0x36')]({'where':{'membername':_0xc01d9d[_0x4c43('0x43')]},'individualHooks':!![]});}}else{throw new db[(_0x4c43('0x96'))][(_0x4c43('0x1e'))](_0x4c43('0xe4'));}})[_0x4c43('0x20')](function(){if(_0xc01d9d){return _0xc01d9d[_0x4c43('0xe5')]({'raw':!![]});}})[_0x4c43('0x20')](function(_0x5e9ef5){if(_0xc01d9d){var _0x5df32d=[];if(_0x5e9ef5){_0x4fa470=_0x5e9ef5;if(_0x4fa470[_0x4c43('0x53')]){for(var _0x47a235=0x0;_0x47a235<_0x4fa470[_0x4c43('0x53')];_0x47a235++){_0x5df32d[_0x4c43('0xae')]({'membername':_0xc01d9d[_0x4c43('0x43')],'UserId':_0xc01d9d['id'],'queue_name':_0x4fa470[_0x47a235][_0x4c43('0x43')],'VoiceQueueId':_0x4fa470[_0x47a235]['id'],'interface':_0x2f93e7,'paused':_0xc01d9d[_0x4c43('0x9f')]||![],'penalty':_0x4fa470[_0x47a235][_0x4c43('0xe6')]||0x0});}return BPromise[_0x4c43('0xb0')](_0x5df32d,function(_0x2d711e){return db[_0x4c43('0xb1')][_0x4c43('0xb2')](_0x2d711e);});}}}})[_0x4c43('0x20')](function(){if(_0xc01d9d){return db[_0x4c43('0xe7')]['findAll']({'where':{'membername':_0xc01d9d[_0x4c43('0x43')],'exitAt':null}});}})[_0x4c43('0x20')](function(_0x1276fe){if(_0xc01d9d){var _0x1b676f=[];_0x1276fe[_0x4c43('0xe8')](function(_0x50374b){_0x1b676f[_0x4c43('0xae')](_0x50374b['update']({'exitAt':moment()[_0x4c43('0x73')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x4c43('0xe9')](_0x1b676f);}})[_0x4c43('0x20')](function(){if(_0xc01d9d){var _0x481994=[];var _0x146874=[];var _0x25d0eb=utils[_0x4c43('0xea')]();var _0x5211c0={'membername':_0xc01d9d[_0x4c43('0x43')],'interface':_0x2f93e7,'enterAt':moment()[_0x4c43('0x73')](_0x4c43('0xeb')),'role':_0xc01d9d[_0x4c43('0x40')],'internal':_0xc01d9d[_0x4c43('0x76')]};_0x25d0eb[_0x4c43('0xe8')](function(_0xfc0f99){_0x481994[_0x4c43('0xae')](_[_0x4c43('0x59')]({'channel':_0xfc0f99,'type':_0x4c43('0xec'),'data1':_0x56d858[_0x4c43('0x67')]['device'],'data2':_0x2f93e7},_0x5211c0));if(_0xc01d9d[_0x4c43('0x9f')]){_0x146874[_0x4c43('0xae')](_[_0x4c43('0x59')]({'channel':_0xfc0f99,'type':_0x4c43('0xed'),'data1':_0x4c43('0xee')},_0x5211c0));}});return db[_0x4c43('0xe7')][_0x4c43('0x66')](_0x481994['concat'](_0x146874),{'individualHooks':!![]});}})['then'](function(){if(_0xc01d9d){return _0xc01d9d['update']({'online':!![],'lastLoginAt':moment()[_0x4c43('0x73')](_0x4c43('0xeb')),'voicePause':_0xc01d9d[_0x4c43('0x9f')]||![],'mailPause':_0xc01d9d['loginInPause']||![],'chatPause':_0xc01d9d[_0x4c43('0x9f')]||![],'faxPause':_0xc01d9d[_0x4c43('0x9f')]||![],'smsPause':_0xc01d9d[_0x4c43('0x9f')]||![],'openchannelPause':_0xc01d9d[_0x4c43('0x9f')]||![],'whatsappPause':_0xc01d9d['loginInPause']||![],'pauseType':_0xc01d9d[_0x4c43('0x9f')]?'LOGININPAUSE':null,'interface':_0x2f93e7,'lastPauseAt':moment()[_0x4c43('0x73')](_0x4c43('0xeb'))});}})['then'](function(_0x31b562){if(_0x56d858['isMiddleware']){return _0x58666b();}else{return BPromise[_0x4c43('0xef')](_0x31b562)[_0x4c43('0x20')](respondWithResult(_0x381677,null));}})['catch'](handleError(_0x381677,null));};exports[_0x4c43('0xf0')]=function(_0xdda240,_0x1c39f7,_0x41a405){var _0x36a62e;return db[_0x4c43('0x46')][_0x4c43('0x41')]({'where':{'id':_0xdda240[_0x4c43('0x62')]['id'],'role':_0x4c43('0x3a')},'attributes':['id',_0x4c43('0x43'),'role']})[_0x4c43('0x20')](handleEntityNotFound(_0x1c39f7,null))['then'](function(_0x10eb37){if(_0x10eb37){_0x36a62e=_0x10eb37;return db[_0x4c43('0xb1')][_0x4c43('0x36')]({'where':{'membername':_0x36a62e[_0x4c43('0x43')]},'individualHooks':!![]});}})[_0x4c43('0x20')](function(){return db[_0x4c43('0xe7')][_0x4c43('0x5e')]({'where':{'membername':_0x36a62e[_0x4c43('0x43')],'exitAt':null}});})['then'](function(_0x1229d4){var _0x569166=[];_0x1229d4['forEach'](function(_0x1d26d9){_0x569166[_0x4c43('0xae')](_0x1d26d9['update']({'exitAt':moment()['format'](_0x4c43('0xeb'))}));});return BPromise[_0x4c43('0xe9')](_0x569166);})['then'](function(){return _0x36a62e['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x1c39f7,null))[_0x4c43('0x60')](handleError(_0x1c39f7,null));};exports[_0x4c43('0xf1')]=function(_0x4051b6,_0x1b84b2,_0x4e16f1){var _0x381fe0;return db['UserVoiceQueueRt'][_0x4c43('0xf2')]({'paused':0x1},{'where':{'UserId':_0x4051b6[_0x4c43('0x62')]['id']},'individualHooks':!![]})[_0x4c43('0x20')](function(){return db[_0x4c43('0x46')][_0x4c43('0x41')]({'where':{'id':_0x4051b6[_0x4c43('0x62')]['id'],'role':_0x4c43('0x3a')},'attributes':['id','name','role',_0x4c43('0x76'),_0x4c43('0xa1')]});})[_0x4c43('0x20')](handleEntityNotFound(_0x1b84b2,null))['then'](function(_0x3fd32e){if(_0x3fd32e){_0x381fe0=_0x3fd32e;return respondWithRpcPromise(_0x4c43('0xf3'),'pause',{'id':_0x381fe0['id'],'name':_0x381fe0[_0x4c43('0x43')],'pause':!![]});}})[_0x4c43('0x20')](function(){if(_0x381fe0){return db['MemberReport'][_0x4c43('0x5e')]({'where':{'membername':_0x381fe0['name'],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x1c0d4d){if(_0x1c0d4d[_0x4c43('0x53')]){var _0x1c454d=moment()[_0x4c43('0x73')](_0x4c43('0xeb'));for(var _0x415d32=0x0,_0x2e90ef=_0x1c0d4d[_0x4c43('0x53')];_0x415d32<_0x2e90ef;_0x415d32++){_0x1c0d4d[_0x415d32][_0x4c43('0xf4')]({'exitAt':_0x1c454d});}}})[_0x4c43('0x20')](function(){var _0x193a57=[];var _0x24f8f7=utils[_0x4c43('0xea')]();_0x24f8f7[_0x4c43('0xe8')](function(_0x56de79){_0x193a57['push']({'channel':_0x56de79,'membername':_0x381fe0[_0x4c43('0x43')],'interface':_[_0x4c43('0x7a')](_0x381fe0[_0x4c43('0xa1')])?util['format']('SIP/%s',_0x381fe0[_0x4c43('0x43')]):_0x381fe0[_0x4c43('0xa1')],'type':_0x4c43('0xed'),'enterAt':moment()[_0x4c43('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4051b6['body'][_0x4c43('0x49')]||_0x4c43('0xf5'),'role':_0x381fe0['role'],'internal':_0x381fe0['internal']});});return db[_0x4c43('0xe7')][_0x4c43('0x66')](_0x193a57,{'individualHooks':!![]});})['then'](function(){return _0x381fe0[_0x4c43('0xf2')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4051b6['body']['type']||_0x4c43('0xf5'),'lastPauseAt':moment()[_0x4c43('0x73')](_0x4c43('0xeb'))});})[_0x4c43('0x20')](respondWithResult(_0x1b84b2,null))['catch'](handleError(_0x1b84b2,null));};exports[_0x4c43('0xf6')]=function(_0x5c2eec,_0x230f49,_0x5079f0){var _0x281a18;return db['User'][_0x4c43('0x41')]({'where':{'id':_0x5c2eec[_0x4c43('0x62')]['id']},'attributes':['id','name',_0x4c43('0x40'),_0x4c43('0xa0'),_0x4c43('0xf7'),_0x4c43('0xf8'),_0x4c43('0xf9'),_0x4c43('0xfa'),'smsPause',_0x4c43('0xfb'),_0x4c43('0xfc'),_0x4c43('0xfd')]})[_0x4c43('0x20')](handleEntityNotFound(_0x230f49,null))[_0x4c43('0x20')](function(_0x165e12){if(_0x165e12){_0x281a18=_0x165e12;if(_0x5c2eec[_0x4c43('0x67')][_0x4c43('0x9d')]&&!utils['isValidChannel'](_0x5c2eec[_0x4c43('0x67')][_0x4c43('0x9d')])){throw new db[(_0x4c43('0x96'))][(_0x4c43('0x1e'))](_0x4c43('0xa3'));}switch(_0x5c2eec['body']['channel']){case _0x4c43('0xac'):return respondWithRpcPromise(_0x4c43('0xf3'),_0x4c43('0xf6'),{'id':_0x281a18['id'],'name':_0x281a18[_0x4c43('0x43')],'pause':![]})[_0x4c43('0x20')](function(){return db[_0x4c43('0xb1')][_0x4c43('0xf2')]({'paused':0x0},{'where':{'UserId':_0x281a18['id']},'individualHooks':!![]});})[_0x4c43('0x20')](function(){return db[_0x4c43('0xe7')][_0x4c43('0x41')]({'where':{'channel':_0x5c2eec[_0x4c43('0x67')][_0x4c43('0x9d')],'membername':_0x281a18[_0x4c43('0x43')],'type':_0x4c43('0xed'),'exitAt':null}});})[_0x4c43('0x20')](function(_0x225bb5){if(_0x225bb5){return _0x225bb5['update']({'exitAt':moment()[_0x4c43('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x4c43('0x20')](function(){return _0x281a18[_0x4c43('0xf2')]({'voicePause':![]});});case _0x4c43('0xfe'):case _0x4c43('0xff'):case _0x4c43('0x100'):case'sms':case _0x4c43('0x101'):case _0x4c43('0x102'):return db[_0x4c43('0xe7')][_0x4c43('0x41')]({'where':{'channel':_0x5c2eec[_0x4c43('0x67')][_0x4c43('0x9d')],'membername':_0x281a18[_0x4c43('0x43')],'type':_0x4c43('0xed'),'exitAt':null}})['then'](function(_0x28ef93){if(_0x28ef93){return _0x28ef93[_0x4c43('0xf2')]({'exitAt':moment()[_0x4c43('0x73')](_0x4c43('0xeb')),'data2':_0x4c43('0x103')},{'individualHooks':!![]});}return null;})[_0x4c43('0x20')](function(){var _0x535223={};_['set'](_0x535223,util['format'](_0x4c43('0x104'),_0x5c2eec[_0x4c43('0x67')]['channel'],_0x4c43('0x105')),![]);return _0x281a18[_0x4c43('0xf2')](_0x535223);});default:return respondWithRpcPromise(_0x4c43('0xf3'),_0x4c43('0xf6'),{'id':_0x281a18['id'],'name':_0x281a18[_0x4c43('0x43')],'pause':![]})[_0x4c43('0x20')](function(){return db[_0x4c43('0xb1')]['update']({'paused':0x0},{'where':{'UserId':_0x281a18['id']}});})['then'](function(){return db['MemberReport'][_0x4c43('0x5e')]({'where':{'membername':_0x281a18['name'],'type':_0x4c43('0xed'),'exitAt':null}});})['then'](function(_0x3a5899){var _0x3f6d88=[];_0x3a5899[_0x4c43('0xe8')](function(_0x4ca319){_0x3f6d88[_0x4c43('0xae')](_0x4ca319[_0x4c43('0xf2')]({'exitAt':moment()[_0x4c43('0x73')](_0x4c43('0xeb')),'data2':'manual'}));});return BPromise[_0x4c43('0xe9')](_0x3f6d88);})['then'](function(){return _0x281a18[_0x4c43('0xf2')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x230f49,null))[_0x4c43('0x60')](handleError(_0x230f49,null));};exports[_0x4c43('0x106')]=function(_0x4fbb2a,_0x334d4e,_0x3d058a){var _0xf1960c={};var _0x4d50bb={};var _0x10c7cf;var _0x5eb457;return db['User'][_0x4c43('0xbf')]({'where':{'id':_0x4fbb2a[_0x4c43('0x62')]['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x334d4e,null))[_0x4c43('0x20')](function(_0x574801){if(_0x574801){_0x10c7cf=_0x574801;_0x4d50bb['model']=_[_0x4c43('0x4d')](db['Team'][_0x4c43('0x47')]);_0x4d50bb[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x4fbb2a[_0x4c43('0x4c')]);_0x4d50bb[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x4d50bb[_0x4c43('0x51')],_0x4d50bb[_0x4c43('0x4c')]);_0xf1960c[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x4d50bb[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x4fbb2a['query']['fields']));_0xf1960c[_0x4c43('0x50')]=_0xf1960c[_0x4c43('0x50')][_0x4c43('0x53')]?_0xf1960c[_0x4c43('0x50')]:_0x4d50bb[_0x4c43('0x51')];_0xf1960c[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x4fbb2a[_0x4c43('0x4c')][_0x4c43('0x56')]);_0xf1960c['where']=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x4fbb2a[_0x4c43('0x4c')],_0x4d50bb['filters']));if(_0x4fbb2a[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0xf1960c[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0xf1960c['where'],{'$or':_[_0x4c43('0x3e')](_0xf1960c[_0x4c43('0x50')],function(_0x42bd0e){var _0x2dd20b={};_0x2dd20b[_0x42bd0e]={'$like':'%'+_0x4fbb2a[_0x4c43('0x4c')]['filter']+'%'};return _0x2dd20b;})});}_0xf1960c=_['merge']({},_0xf1960c,_0x4fbb2a[_0x4c43('0x65')]);return _0x10c7cf[_0x4c43('0x106')](_0xf1960c);}})[_0x4c43('0x20')](function(_0xf852c4){if(_0xf852c4){_0x5eb457=_0xf852c4[_0x4c43('0x53')];if(!_0x4fbb2a['query'][_0x4c43('0x54')]('nolimit')){_0xf1960c[_0x4c43('0x2f')]=qs[_0x4c43('0x2f')](_0x4fbb2a[_0x4c43('0x4c')][_0x4c43('0x2f')]);_0xf1960c[_0x4c43('0x2e')]=qs['offset'](_0x4fbb2a[_0x4c43('0x4c')]['offset']);}return _0x10c7cf[_0x4c43('0x106')](_0xf1960c);}})['then'](function(_0x1b6d0c){if(_0x1b6d0c){return _0x1b6d0c?{'count':_0x5eb457,'rows':_0x1b6d0c}:null;}})[_0x4c43('0x20')](respondWithResult(_0x334d4e,null))[_0x4c43('0x60')](handleError(_0x334d4e,null));};exports[_0x4c43('0x107')]=function(_0x57968f,_0x25f26c){return db[_0x4c43('0x46')]['find']({'where':{'id':_0x57968f['params']['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x25f26c,null))[_0x4c43('0x20')](function(_0x2d8704){if(_0x2d8704){var _0x194eb6=_0x2d8704['get']({'plain':!![]});return _0x2d8704[_0x4c43('0x107')](_0x57968f[_0x4c43('0x67')][_0x4c43('0x6a')],_['omit'](_0x57968f[_0x4c43('0x67')],[_0x4c43('0x6a'),'id'])||{})[_0x4c43('0x20')](function(){for(var _0x44894d=0x0;_0x44894d<_0x57968f[_0x4c43('0x67')][_0x4c43('0x6a')][_0x4c43('0x53')];_0x44894d++){var _0x247838=[];db[_0x4c43('0x108')]['findOne']({'where':{'id':_0x57968f[_0x4c43('0x67')][_0x4c43('0x6a')][_0x44894d]}})[_0x4c43('0x20')](function(_0x5869b8){_0x247838[_0x4c43('0xae')](_0x5869b8[_0x4c43('0xe5')]()['then'](function(_0x2a26b9){for(var _0x132b65=0x0;_0x132b65<_0x2a26b9[_0x4c43('0x53')];_0x132b65++){_0x2a26b9[_0x132b65][_0x4c43('0x109')](_0x4c43('0x9d'),_0x4c43('0x10a'));}return _0x2a26b9;}));_0x247838['push'](_0x5869b8['getChatQueues']()[_0x4c43('0x20')](function(_0xbfcf1b){for(var _0x305938=0x0;_0x305938<_0xbfcf1b[_0x4c43('0x53')];_0x305938++){_0xbfcf1b[_0x305938][_0x4c43('0x109')](_0x4c43('0x9d'),_0x4c43('0x10b'));}return _0xbfcf1b;}));_0x247838[_0x4c43('0xae')](_0x5869b8[_0x4c43('0x10c')]()[_0x4c43('0x20')](function(_0x46293b){for(var _0x345fb7=0x0;_0x345fb7<_0x46293b['length'];_0x345fb7++){_0x46293b[_0x345fb7][_0x4c43('0x109')]('channel','Mail');}return _0x46293b;}));_0x247838[_0x4c43('0xae')](_0x5869b8[_0x4c43('0x10d')]()[_0x4c43('0x20')](function(_0x42821f){for(var _0x34e407=0x0;_0x34e407<_0x42821f[_0x4c43('0x53')];_0x34e407++){_0x42821f[_0x34e407][_0x4c43('0x109')](_0x4c43('0x9d'),_0x4c43('0x10e'));}return _0x42821f;}));_0x247838[_0x4c43('0xae')](_0x5869b8[_0x4c43('0x10f')]()[_0x4c43('0x20')](function(_0x31c354){for(var _0x4d8774=0x0;_0x4d8774<_0x31c354[_0x4c43('0x53')];_0x4d8774++){_0x31c354[_0x4d8774]['setDataValue']('channel',_0x4c43('0x110'));}return _0x31c354;}));_0x247838[_0x4c43('0xae')](_0x5869b8[_0x4c43('0x111')]()[_0x4c43('0x20')](function(_0x4c91d9){for(var _0x237cb1=0x0;_0x237cb1<_0x4c91d9[_0x4c43('0x53')];_0x237cb1++){_0x4c91d9[_0x237cb1][_0x4c43('0x109')](_0x4c43('0x9d'),_0x4c43('0x112'));}return _0x4c91d9;}));_0x247838[_0x4c43('0xae')](_0x5869b8[_0x4c43('0x113')]()['then'](function(_0x5251df){for(var _0x26805b=0x0;_0x26805b<_0x5251df[_0x4c43('0x53')];_0x26805b++){_0x5251df[_0x26805b][_0x4c43('0x109')](_0x4c43('0x9d'),_0x4c43('0x114'));}return _0x5251df;}));return BPromise[_0x4c43('0xe9')](_0x247838);})[_0x4c43('0x20')](function(_0x4bd47a){var _0x15c860=_[_0x4c43('0x115')](_0x4bd47a);_0x247838=[];return db[_0x4c43('0x5a')][_0x4c43('0x116')](function(_0x37dea4){for(var _0x3a4280=0x0;_0x3a4280<_0x15c860[_0x4c43('0x53')];_0x3a4280++){_0x247838[_0x4c43('0xae')](_0x15c860[_0x3a4280][_0x4c43('0x117')](_0x194eb6['id']),{'transaction':_0x37dea4});}return BPromise[_0x4c43('0xe9')](_0x247838)['then'](function(){if(_0x194eb6[_0x4c43('0x9e')]){return BPromise[_0x4c43('0xb0')](_[_0x4c43('0x3c')](_0x15c860,function(_0x1972e6){return _0x1972e6[_0x4c43('0x118')]('channel')===_0x4c43('0x10a');}),function(_0x3adc42){return db['UserVoiceQueueRt'][_0x4c43('0xb2')]({'membername':_0x194eb6[_0x4c43('0x43')],'UserId':_0x194eb6['id'],'queue_name':_0x3adc42[_0x4c43('0x43')],'VoiceQueueId':_0x3adc42['id'],'interface':_[_0x4c43('0x7a')](_0x194eb6[_0x4c43('0xa1')])?util['format'](_0x4c43('0xaf'),_0x194eb6['name']):_0x194eb6['interface'],'paused':_0x194eb6[_0x4c43('0xa0')]||![],'penalty':_0x194eb6[_0x4c43('0xa7')]},{'transaction':_0x37dea4});});}else{return;}})[_0x4c43('0x20')](function(){for(var _0x41681d=0x0;_0x41681d<_0x15c860[_0x4c43('0x53')];_0x41681d++){var _0x1381d2=_0x15c860[_0x41681d][_0x4c43('0x118')]('channel');var _0x13e91d=_0x1381d2+_0x4c43('0xa9');socket[_0x4c43('0xaa')](_0x4c43('0x6e')+_0x1381d2+_0x4c43('0xab'),{'UserId':_0x194eb6['id'],['queueField']:_0x15c860[_0x41681d]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x25f26c,null))['catch'](handleError(_0x25f26c,null));};exports[_0x4c43('0x119')]=function(_0x178291,_0x242b3b){return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x178291[_0x4c43('0x62')]['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x242b3b,null))[_0x4c43('0x20')](function(_0x21bcd3){if(_0x21bcd3){var _0x30d8b7=_0x21bcd3[_0x4c43('0x37')]({'plain':!![]});var _0x517a97=_0x178291[_0x4c43('0x4c')][_0x4c43('0x6a')];return _0x21bcd3[_0x4c43('0x119')](_0x517a97)[_0x4c43('0x20')](function(){for(var _0xa4c6e6=0x0;_0xa4c6e6<_0x517a97['length'];_0xa4c6e6++){var _0x28ee92=[];db[_0x4c43('0x108')]['findOne']({'where':{'id':_0x517a97[_0xa4c6e6]}})[_0x4c43('0x20')](function(_0x286808){_0x28ee92['push'](_0x286808[_0x4c43('0xe5')]()[_0x4c43('0x20')](function(_0x2b3b87){for(var _0x271a7a=0x0;_0x271a7a<_0x2b3b87[_0x4c43('0x53')];_0x271a7a++){_0x2b3b87[_0x271a7a][_0x4c43('0x109')](_0x4c43('0x9d'),_0x4c43('0x10a'));}return _0x2b3b87;}));_0x28ee92['push'](_0x286808['getChatQueues']()['then'](function(_0x5abace){for(var _0xea9a6e=0x0;_0xea9a6e<_0x5abace[_0x4c43('0x53')];_0xea9a6e++){_0x5abace[_0xea9a6e][_0x4c43('0x109')]('channel',_0x4c43('0x10b'));}return _0x5abace;}));_0x28ee92[_0x4c43('0xae')](_0x286808[_0x4c43('0x10c')]()[_0x4c43('0x20')](function(_0x1d56cb){for(var _0x155b52=0x0;_0x155b52<_0x1d56cb['length'];_0x155b52++){_0x1d56cb[_0x155b52]['setDataValue'](_0x4c43('0x9d'),_0x4c43('0x11a'));}return _0x1d56cb;}));_0x28ee92['push'](_0x286808[_0x4c43('0x10d')]()[_0x4c43('0x20')](function(_0x439baf){for(var _0x209429=0x0;_0x209429<_0x439baf[_0x4c43('0x53')];_0x209429++){_0x439baf[_0x209429][_0x4c43('0x109')]('channel',_0x4c43('0x10e'));}return _0x439baf;}));_0x28ee92[_0x4c43('0xae')](_0x286808[_0x4c43('0x10f')]()[_0x4c43('0x20')](function(_0x1e4604){for(var _0x579b30=0x0;_0x579b30<_0x1e4604['length'];_0x579b30++){_0x1e4604[_0x579b30][_0x4c43('0x109')](_0x4c43('0x9d'),_0x4c43('0x110'));}return _0x1e4604;}));_0x28ee92[_0x4c43('0xae')](_0x286808[_0x4c43('0x111')]()[_0x4c43('0x20')](function(_0x3dd9ca){for(var _0x23c80c=0x0;_0x23c80c<_0x3dd9ca['length'];_0x23c80c++){_0x3dd9ca[_0x23c80c][_0x4c43('0x109')](_0x4c43('0x9d'),_0x4c43('0x112'));}return _0x3dd9ca;}));_0x28ee92[_0x4c43('0xae')](_0x286808[_0x4c43('0x113')]()[_0x4c43('0x20')](function(_0x56db5a){for(var _0x327ace=0x0;_0x327ace<_0x56db5a['length'];_0x327ace++){_0x56db5a[_0x327ace]['setDataValue']('channel',_0x4c43('0x114'));}return _0x56db5a;}));return BPromise[_0x4c43('0xe9')](_0x28ee92);})['then'](function(_0x2bc6a8){var _0x2271ff=_[_0x4c43('0x115')](_0x2bc6a8);_0x28ee92=[];return db[_0x4c43('0x5a')][_0x4c43('0x116')](function(_0x2e5a3f){for(var _0x5d4618=0x0;_0x5d4618<_0x2271ff[_0x4c43('0x53')];_0x5d4618++){_0x28ee92[_0x4c43('0xae')](_0x2271ff[_0x5d4618]['removeAgent'](_0x30d8b7['id']),{'transaction':_0x2e5a3f});}return BPromise['all'](_0x28ee92)['then'](function(){if(_0x30d8b7[_0x4c43('0x9e')]){return BPromise[_0x4c43('0xb0')](_[_0x4c43('0x3c')](_0x2271ff,function(_0x47b321){return _0x47b321[_0x4c43('0x118')]('channel')===_0x4c43('0x10a');}),function(_0x234aaa){return db[_0x4c43('0xb1')][_0x4c43('0x36')]({'where':{'VoiceQueueId':_0x234aaa['id'],'UserId':_0x30d8b7['id']},'transaction':_0x2e5a3f});});}else{return;}})[_0x4c43('0x20')](function(){for(var _0x5de4f8=0x0;_0x5de4f8<_0x2271ff[_0x4c43('0x53')];_0x5de4f8++){var _0x10a406=_0x2271ff[_0x5de4f8][_0x4c43('0x118')](_0x4c43('0x9d'));var _0x33bd64=_0x10a406+_0x4c43('0xa9');socket[_0x4c43('0xaa')](_0x4c43('0x6e')+_0x10a406+'Queue:remove',{'UserId':_0x30d8b7['id'],['queueField']:_0x2271ff[_0x5de4f8]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x242b3b,null))[_0x4c43('0x60')](handleError(_0x242b3b,null));};exports['getLists']=function(_0x33ed7a,_0x417ae7,_0x108bc7){var _0x53d25a={};var _0x2e8dc6={};var _0x1938fd;var _0x4b3461;return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x33ed7a[_0x4c43('0x62')]['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x417ae7,null))[_0x4c43('0x20')](function(_0xa46d7c){if(_0xa46d7c){_0x1938fd=_0xa46d7c;_0x2e8dc6['model']=_[_0x4c43('0x4d')](db[_0x4c43('0x11b')][_0x4c43('0x47')]);_0x2e8dc6[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x33ed7a[_0x4c43('0x4c')]);_0x2e8dc6[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x2e8dc6[_0x4c43('0x51')],_0x2e8dc6['query']);_0x53d25a[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x2e8dc6[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x33ed7a[_0x4c43('0x4c')][_0x4c43('0x52')]));_0x53d25a[_0x4c43('0x50')]=_0x53d25a[_0x4c43('0x50')][_0x4c43('0x53')]?_0x53d25a['attributes']:_0x2e8dc6[_0x4c43('0x51')];_0x53d25a[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x33ed7a['query']['sort']);_0x53d25a['where']=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x33ed7a['query'],_0x2e8dc6[_0x4c43('0x4e')]));if(_0x33ed7a[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x53d25a[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0x53d25a[_0x4c43('0x57')],{'$or':_['map'](_0x53d25a['attributes'],function(_0x201649){var _0x5e29df={};_0x5e29df[_0x201649]={'$like':'%'+_0x33ed7a[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x5e29df;})});}_0x53d25a=_[_0x4c43('0x59')]({},_0x53d25a,_0x33ed7a['options']);return _0x1938fd['getLists'](_0x53d25a);}})[_0x4c43('0x20')](function(_0x46d901){if(_0x46d901){_0x4b3461=_0x46d901[_0x4c43('0x53')];if(!_0x33ed7a[_0x4c43('0x4c')]['hasOwnProperty'](_0x4c43('0x55'))){_0x53d25a[_0x4c43('0x2f')]=qs['limit'](_0x33ed7a[_0x4c43('0x4c')]['limit']);_0x53d25a[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x33ed7a[_0x4c43('0x4c')]['offset']);}return _0x1938fd['getLists'](_0x53d25a);}})['then'](function(_0x81fd6a){if(_0x81fd6a){return _0x81fd6a?{'count':_0x4b3461,'rows':_0x81fd6a}:null;}})['then'](respondWithResult(_0x417ae7,null))[_0x4c43('0x60')](handleError(_0x417ae7,null));};exports['getAgents']=function(_0x56ddad,_0x1126f1,_0x45fc46){var _0x34f888={};var _0x342bf1={};var _0x4c2f8d;var _0x2d64af;return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x56ddad[_0x4c43('0x62')]['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x1126f1,null))[_0x4c43('0x20')](function(_0x5fb4e6){if(_0x5fb4e6){_0x4c2f8d=_0x5fb4e6;_0x342bf1[_0x4c43('0x51')]=_[_0x4c43('0x4d')](db[_0x4c43('0x46')][_0x4c43('0x47')]);_0x342bf1['query']=_[_0x4c43('0x4d')](_0x56ddad[_0x4c43('0x4c')]);_0x342bf1[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x342bf1[_0x4c43('0x51')],_0x342bf1['query']);_0x34f888[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x342bf1[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x56ddad[_0x4c43('0x4c')][_0x4c43('0x52')]));_0x34f888[_0x4c43('0x50')]=_0x34f888[_0x4c43('0x50')]['length']?_0x34f888['attributes']:_0x342bf1[_0x4c43('0x51')];_0x34f888['order']=qs[_0x4c43('0x56')](_0x56ddad[_0x4c43('0x4c')]['sort']);_0x34f888[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x56ddad[_0x4c43('0x4c')],_0x342bf1[_0x4c43('0x4e')]));if(_0x56ddad[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x34f888['where']=_[_0x4c43('0x59')](_0x34f888['where'],{'$or':_['map'](_0x34f888['attributes'],function(_0x36cca1){var _0x497a5a={};_0x497a5a[_0x36cca1]={'$like':'%'+_0x56ddad[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x497a5a;})});}_0x34f888['model']=db['User'];_0x34f888['as']=_0x4c43('0x39');_0x34f888=_[_0x4c43('0x59')]({},_0x34f888,_0x56ddad['options']);return _0x4c2f8d[_0x4c43('0xe5')]({'include':[_0x34f888]});}})[_0x4c43('0x20')](function(_0x7741a6){if(_0x7741a6){var _0x921d09={},_0x1d1deb=[],_0x337975=0x0;for(var _0x1188a0=0x0;_0x1188a0<_0x7741a6[_0x4c43('0x53')];_0x1188a0+=0x1){for(var _0x5b0a02=0x0,_0x1ea43e;_0x5b0a02<_0x7741a6[_0x1188a0]['Agents'][_0x4c43('0x53')];_0x5b0a02+=0x1){_0x1ea43e=_0x7741a6[_0x1188a0][_0x4c43('0x39')][_0x5b0a02][_0x4c43('0x37')]({'plain':!![]});_0x921d09[_0x1ea43e['id']]=_0x1ea43e;}}_0x921d09=_[_0x4c43('0x11c')](_0x921d09);for(var _0x5ceacc=qs['offset'](_0x56ddad['query'][_0x4c43('0x2e')]);_0x5ceacc<_0x921d09[_0x4c43('0x53')]&&_0x1d1deb[_0x4c43('0x53')]=_0x5d3e69['agents']){throw new Error(_0x70f5('0x59'));}})[_0x70f5('0x12')](function(){if(_0x216b74){return db[_0x70f5('0x30')]['destroy']({'where':{'membername':_0x216b74[_0x70f5('0x2c')]},'individualHooks':!![]});}})['then'](function(){if(_0x216b74){return _0x216b74['getVoiceQueues']({'raw':!![]});}})[_0x70f5('0x12')](function(_0x414b69){if(_0x216b74){if(_0x414b69){var _0x3937dd=[];_0xede83d=_0x414b69;if(_0xede83d[_0x70f5('0x34')]){for(var _0x4a0d28=0x0;_0x4a0d28<_0xede83d[_0x70f5('0x34')];_0x4a0d28++){_0x3937dd['push'](db[_0x70f5('0x30')][_0x70f5('0x5a')]({'membername':_0x216b74[_0x70f5('0x2c')],'UserId':_0x216b74['id'],'queue_name':_0xede83d[_0x4a0d28][_0x70f5('0x2c')],'VoiceQueueId':_0xede83d[_0x4a0d28]['id'],'interface':_0x4f21cd,'paused':_0x216b74[_0x70f5('0x55')]||![],'penalty':_0xede83d[_0x4a0d28][_0x70f5('0x5b')]||0x0}));}return BPromise[_0x70f5('0x4f')](_0x3937dd);}}}})[_0x70f5('0x12')](function(){if(_0x216b74){return db[_0x70f5('0x32')]['findAll']({'where':{'membername':_0x216b74['name'],'exitAt':null}});}})[_0x70f5('0x12')](function(_0x383a41){if(_0x216b74){if(_0x383a41&&_0x383a41[_0x70f5('0x34')]){var _0x31e86a=[];_0x383a41['forEach'](function(_0x275984){_0x31e86a['push'](_0x275984[_0x70f5('0x31')]({'exitAt':moment()[_0x70f5('0x35')](_0x70f5('0x36'))}));});return BPromise[_0x70f5('0x4f')](_0x31e86a);}}})[_0x70f5('0x12')](function(_0x5b0f1d){if(_0x216b74){var _0x2e74c0=[];var _0x26b3f8=[];var _0x485202=utils[_0x70f5('0x5c')]();var _0x232442={'membername':_0x216b74[_0x70f5('0x2c')],'interface':_0x4f21cd,'enterAt':moment()[_0x70f5('0x35')](_0x70f5('0x36')),'role':_0x216b74[_0x70f5('0x2d')],'internal':_0x216b74['internal']};_0x485202[_0x70f5('0x38')](function(_0x4d6922){_0x2e74c0[_0x70f5('0x39')](_['merge']({'channel':_0x4d6922,'type':_0x70f5('0x5d'),'data1':_0x70f5('0x5e'),'data2':_0x4f21cd},_0x232442));if(_0x216b74[_0x70f5('0x55')]){_0x26b3f8[_0x70f5('0x39')](_[_0x70f5('0x5f')]({'channel':_0x4d6922,'type':'PAUSE','data1':_0x70f5('0x60')},_0x232442));}});return db[_0x70f5('0x32')]['bulkCreate'](_0x2e74c0[_0x70f5('0x61')](_0x26b3f8),{'individualHooks':!![]});}})[_0x70f5('0x12')](function(){if(_0x216b74){return _0x216b74[_0x70f5('0x31')]({'online':!![],'lastLoginAt':moment()['format'](_0x70f5('0x36')),'voicePause':_0x216b74[_0x70f5('0x55')]||![],'mailPause':_0x216b74[_0x70f5('0x55')]||![],'chatPause':_0x216b74[_0x70f5('0x55')]||![],'faxPause':_0x216b74[_0x70f5('0x55')]||![],'smsPause':_0x216b74[_0x70f5('0x55')]||![],'openchannelPause':_0x216b74[_0x70f5('0x55')]||![],'pauseType':_0x216b74['loginInPause']?_0x70f5('0x60'):null,'lastPauseAt':moment()[_0x70f5('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x4f21cd});}})[_0x70f5('0x12')](function(_0x4984c7){_0x2a86c1(_0x4984c7);})[_0x70f5('0x1d')](function(_0x4a2e30){_0x136ea7(_0x3f8fbd[_0x70f5('0x19')](0x1f4,_0x4a2e30[_0x70f5('0x1b')]));});});}; \ No newline at end of file +var _0x9794=['SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','type','UnpauseUser','channel','mail','chat','openchannel','system','set','%s%s','forEach','LogoutUser','findOne','destroy','all','LoginUser','mobile','phone','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','loginInPause','LOGININPAUSE','bulkCreate','concat','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./user.socket','register','request','info','User,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','User','findAll','options','raw','limit','map','model','attributes','include','then','GetUser','debug','ShowUser','find','where','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil'];(function(_0x39a384,_0x255bef){var _0x5e9af2=function(_0x4d6022){while(--_0x4d6022){_0x39a384['push'](_0x39a384['shift']());}};_0x5e9af2(++_0x255bef);}(_0x9794,0x1f0));var _0x4979=function(_0x2b8393,_0x38e1a2){_0x2b8393=_0x2b8393-0x0;var _0x129421=_0x9794[_0x2b8393];return _0x129421;};'use strict';var _=require(_0x4979('0x0'));var util=require(_0x4979('0x1'));var moment=require(_0x4979('0x2'));var BPromise=require(_0x4979('0x3'));var rs=require(_0x4979('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4979('0x5'))['db'];var utils=require(_0x4979('0x6'));var logger=require('../../config/logger')(_0x4979('0x7'));var config=require(_0x4979('0x8'));var jayson=require(_0x4979('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x4979('0xa')]=_[_0x4979('0xb')](config[_0x4979('0xa')],{'host':_0x4979('0xc'),'port':0x18eb});var socket=require(_0x4979('0xd'))(new Redis(config[_0x4979('0xa')]));require(_0x4979('0xe'))[_0x4979('0xf')](socket);function respondWithRpcPromise(_0x33606b,_0x4be6b4,_0x367208){return new BPromise(function(_0x595118,_0x5322f8){return client[_0x4979('0x10')](_0x33606b,_0x367208)['then'](function(_0x27f033){logger[_0x4979('0x11')](_0x4979('0x12'),_0x4be6b4,'request\x20sent');logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x4be6b4,_0x4979('0x13'),JSON[_0x4979('0x14')](_0x27f033));if(_0x27f033[_0x4979('0x15')]){if(_0x27f033[_0x4979('0x15')]['code']===0x1f4){logger[_0x4979('0x15')](_0x4979('0x12'),_0x4be6b4,_0x27f033[_0x4979('0x15')][_0x4979('0x16')]);return _0x5322f8(_0x27f033['error']['message']);}logger[_0x4979('0x15')](_0x4979('0x12'),_0x4be6b4,_0x27f033['error']['message']);return _0x595118(_0x27f033[_0x4979('0x15')]['message']);}else{logger[_0x4979('0x11')]('User,\x20%s,\x20%s',_0x4be6b4,_0x4979('0x13'));_0x595118(_0x27f033[_0x4979('0x17')][_0x4979('0x16')]);}})[_0x4979('0x18')](function(_0x107734){logger[_0x4979('0x15')](_0x4979('0x12'),_0x4be6b4,_0x107734);_0x5322f8(_0x107734);});});}exports['GetUser']=function(_0x1303ce){var _0x14ae69=this;return new Promise(function(_0x540b57,_0x516e42){return db[_0x4979('0x19')][_0x4979('0x1a')]({'raw':_0x1303ce['options']?_0x1303ce[_0x4979('0x1b')][_0x4979('0x1c')]===undefined?!![]:![]:!![],'where':_0x1303ce[_0x4979('0x1b')]?_0x1303ce[_0x4979('0x1b')]['where']||null:null,'attributes':_0x1303ce[_0x4979('0x1b')]?_0x1303ce[_0x4979('0x1b')]['attributes']||null:null,'limit':_0x1303ce[_0x4979('0x1b')]?_0x1303ce[_0x4979('0x1b')][_0x4979('0x1d')]||null:null,'include':_0x1303ce[_0x4979('0x1b')]?_0x1303ce[_0x4979('0x1b')]['include']?_[_0x4979('0x1e')](_0x1303ce['options']['include'],function(_0x4bf10a){return{'model':db[_0x4bf10a[_0x4979('0x1f')]],'as':_0x4bf10a['as'],'attributes':_0x4bf10a[_0x4979('0x20')],'include':_0x4bf10a['include']?_[_0x4979('0x1e')](_0x4bf10a[_0x4979('0x21')],function(_0x223745){return{'model':db[_0x223745[_0x4979('0x1f')]],'as':_0x223745['as'],'attributes':_0x223745[_0x4979('0x20')],'include':_0x223745[_0x4979('0x21')]?_[_0x4979('0x1e')](_0x223745['include'],function(_0x22df4f){return{'model':db[_0x22df4f[_0x4979('0x1f')]],'as':_0x22df4f['as'],'attributes':_0x22df4f[_0x4979('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4979('0x22')](function(_0x1ae696){logger[_0x4979('0x11')](_0x4979('0x23'),_0x1303ce);logger[_0x4979('0x24')](_0x4979('0x23'),_0x1303ce,JSON[_0x4979('0x14')](_0x1ae696));_0x540b57(_0x1ae696);})['catch'](function(_0x2b1bf8){logger[_0x4979('0x15')]('GetUser',_0x2b1bf8[_0x4979('0x16')],_0x1303ce);_0x516e42(_0x14ae69[_0x4979('0x15')](0x1f4,_0x2b1bf8[_0x4979('0x16')]));});});};exports[_0x4979('0x25')]=function(_0x17e745){var _0x56d427=this;return new Promise(function(_0x2a58b9,_0xdfcfb0){return db['User'][_0x4979('0x26')]({'raw':_0x17e745['options']?_0x17e745[_0x4979('0x1b')][_0x4979('0x1c')]===undefined?!![]:![]:!![],'where':_0x17e745[_0x4979('0x1b')]?_0x17e745[_0x4979('0x1b')][_0x4979('0x27')]||null:null,'attributes':_0x17e745['options']?_0x17e745['options']['attributes']||null:null,'include':_0x17e745[_0x4979('0x1b')]?_0x17e745['options']['include']?_[_0x4979('0x1e')](_0x17e745['options'][_0x4979('0x21')],function(_0x31d275){return{'model':db[_0x31d275['model']],'as':_0x31d275['as'],'attributes':_0x31d275[_0x4979('0x20')],'include':_0x31d275[_0x4979('0x21')]?_[_0x4979('0x1e')](_0x31d275[_0x4979('0x21')],function(_0x59dd86){return{'model':db[_0x59dd86['model']],'as':_0x59dd86['as'],'attributes':_0x59dd86['attributes'],'include':_0x59dd86[_0x4979('0x21')]?_[_0x4979('0x1e')](_0x59dd86[_0x4979('0x21')],function(_0x13a3a2){return{'model':db[_0x13a3a2['model']],'as':_0x13a3a2['as'],'attributes':_0x13a3a2[_0x4979('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4979('0x22')](function(_0x515d3a){logger[_0x4979('0x11')](_0x4979('0x25'),_0x17e745);logger[_0x4979('0x24')]('ShowUser',_0x17e745,JSON[_0x4979('0x14')](_0x515d3a));_0x2a58b9(_0x515d3a);})[_0x4979('0x18')](function(_0x1b606f){logger[_0x4979('0x15')](_0x4979('0x25'),_0x1b606f[_0x4979('0x16')],_0x17e745);_0xdfcfb0(_0x56d427['error'](0x1f4,_0x1b606f[_0x4979('0x16')]));});});};exports[_0x4979('0x28')]=function(_0x3030c8){var _0x43afd6=this;return new Promise(function(_0x5c4b6f,_0x2af90b){var _0x1419ff;return db['User'][_0x4979('0x26')]({'where':_0x3030c8[_0x4979('0x1b')][_0x4979('0x27')]||{},'attributes':['id',_0x4979('0x29'),_0x4979('0x2a'),_0x4979('0x2b'),_0x4979('0x2c')]})[_0x4979('0x22')](function(_0xd11260){if(_0xd11260){_0x1419ff=_0xd11260;return db[_0x4979('0x2d')][_0x4979('0x2e')]({'paused':0x1},{'where':{'UserId':_0x1419ff['id']},'individualHooks':!![]});}})[_0x4979('0x22')](function(){if(_0x1419ff){return db[_0x4979('0x2f')][_0x4979('0x1a')]({'where':{'membername':_0x1419ff[_0x4979('0x29')],'type':_0x4979('0x30'),'exitAt':null}});}})['then'](function(_0x1cbec4){if(_0x1419ff){if(_0x1cbec4&&_0x1cbec4[_0x4979('0x31')]){var _0x5f3471=moment()[_0x4979('0x32')](_0x4979('0x33'));for(var _0x352947=0x0,_0x57ac11=_0x1cbec4[_0x4979('0x31')];_0x352947<_0x57ac11;_0x352947++){_0x1cbec4[_0x352947][_0x4979('0x34')]({'exitAt':_0x5f3471});}}}})[_0x4979('0x22')](function(){if(_0x1419ff){var _0x3e26e9=[];var _0x1ecc45=utils[_0x4979('0x35')]();_0x1ecc45['forEach'](function(_0x1c56cb){_0x3e26e9[_0x4979('0x36')]({'channel':_0x1c56cb,'membername':_0x1419ff[_0x4979('0x29')],'interface':_[_0x4979('0x37')](_0x1419ff[_0x4979('0x2c')])?util[_0x4979('0x32')](_0x4979('0x38'),_0x1419ff[_0x4979('0x29')]):_0x1419ff[_0x4979('0x2c')],'type':_0x4979('0x30'),'enterAt':moment()['format'](_0x4979('0x33')),'data1':_0x3030c8[_0x4979('0x39')]['type']||_0x4979('0x3a'),'role':_0x1419ff[_0x4979('0x2a')],'internal':_0x1419ff[_0x4979('0x2b')],'uniqueid':_0x3030c8['body'][_0x4979('0x3b')]||null});});return db[_0x4979('0x2f')]['bulkCreate'](_0x3e26e9,{'individualHooks':!![]});}})[_0x4979('0x22')](function(){if(_0x1419ff){return _0x1419ff['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x3030c8['body'][_0x4979('0x3c')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0x4979('0x33'))});}})[_0x4979('0x22')](function(_0x59b2d5){_0x5c4b6f(_0x59b2d5);})[_0x4979('0x18')](function(_0x3aeef7){_0x2af90b(_0x43afd6[_0x4979('0x15')](0x1f4,_0x3aeef7[_0x4979('0x16')]));});});};exports[_0x4979('0x3d')]=function(_0x52a50f){var _0x378913=this;return new Promise(function(_0x3cde3c,_0x82c56){var _0x55760f;return db[_0x4979('0x19')]['findOne']({'where':_0x52a50f[_0x4979('0x1b')]['where']||{},'attributes':['id',_0x4979('0x29')]})[_0x4979('0x22')](function(_0x1428cc){if(_0x1428cc){_0x55760f=_0x1428cc;if(_0x52a50f[_0x4979('0x39')]['channel']&&!utils['isValidChannel'](_0x52a50f[_0x4979('0x39')][_0x4979('0x3e')])){throw new Error('Unknown\x20channel');}switch(_0x52a50f['body'][_0x4979('0x3e')]){case'voice':return db[_0x4979('0x2d')][_0x4979('0x2e')]({'paused':0x0},{'where':{'UserId':_0x55760f['id']}})[_0x4979('0x22')](function(){return db[_0x4979('0x2f')]['find']({'where':{'channel':_0x52a50f[_0x4979('0x39')][_0x4979('0x3e')],'membername':_0x55760f[_0x4979('0x29')],'type':_0x4979('0x30'),'exitAt':null}});})['then'](function(_0x5b199a){if(_0x5b199a){return _0x5b199a['update']({'exitAt':moment()['format'](_0x4979('0x33')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x4979('0x22')](function(){return _0x55760f['update']({'voicePause':![]});});case _0x4979('0x3f'):case _0x4979('0x40'):case'fax':case'sms':case _0x4979('0x41'):return db[_0x4979('0x2f')][_0x4979('0x26')]({'where':{'channel':_0x52a50f['body'][_0x4979('0x3e')],'membername':_0x55760f[_0x4979('0x29')],'type':_0x4979('0x30'),'exitAt':null}})[_0x4979('0x22')](function(_0x4bb733){return _0x4bb733[_0x4979('0x2e')]({'exitAt':moment()[_0x4979('0x32')](_0x4979('0x33')),'data2':_0x4979('0x42')},{'individualHooks':!![]});})[_0x4979('0x22')](function(){var _0x327187={};_[_0x4979('0x43')](_0x327187,util['format'](_0x4979('0x44'),_0x52a50f[_0x4979('0x39')]['channel'],'Pause'),![]);return _0x55760f[_0x4979('0x2e')](_0x327187);});default:return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x55760f['id']}})[_0x4979('0x22')](function(){return db[_0x4979('0x2f')][_0x4979('0x1a')]({'where':{'membername':_0x55760f[_0x4979('0x29')],'type':'PAUSE','exitAt':null}});})[_0x4979('0x22')](function(_0x33929e){var _0x46ac98=[];_0x33929e[_0x4979('0x45')](function(_0x237056){_0x46ac98[_0x4979('0x36')](_0x237056[_0x4979('0x2e')]({'exitAt':moment()['format'](_0x4979('0x33')),'data2':_0x4979('0x42')}));});return BPromise['all'](_0x46ac98);})[_0x4979('0x22')](function(){return _0x55760f[_0x4979('0x2e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x4979('0x22')](function(_0x4fe7f7){_0x3cde3c(_0x4fe7f7);})[_0x4979('0x18')](function(_0x14814f){_0x82c56(_0x378913['error'](0x1f4,_0x14814f['message']));});});};exports[_0x4979('0x46')]=function(_0x4c5715){var _0x542fb6=this;return new Promise(function(_0x2d2363,_0x4d4e6a){var _0x20984b;return db[_0x4979('0x19')][_0x4979('0x47')]({'where':_0x4c5715[_0x4979('0x1b')][_0x4979('0x27')]||{},'attributes':['id',_0x4979('0x29')]})[_0x4979('0x22')](function(_0x416d16){if(_0x416d16){_0x20984b=_0x416d16;return db[_0x4979('0x2d')][_0x4979('0x48')]({'where':{'membername':_0x20984b['name']},'individualHooks':!![]});}})[_0x4979('0x22')](function(){if(_0x20984b){return db['MemberReport'][_0x4979('0x1a')]({'where':{'membername':_0x20984b[_0x4979('0x29')],'exitAt':null}});}})['then'](function(_0x5718bf){if(_0x20984b){if(_0x5718bf&&_0x5718bf[_0x4979('0x31')]){var _0x4edb78=[];_0x5718bf[_0x4979('0x45')](function(_0xf28a76){_0x4edb78[_0x4979('0x36')](_0xf28a76[_0x4979('0x2e')]({'exitAt':moment()[_0x4979('0x32')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x4979('0x49')](_0x4edb78);}}})[_0x4979('0x22')](function(){if(_0x20984b){return _0x20984b[_0x4979('0x2e')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x5c81f9){_0x2d2363(_0x5c81f9);})[_0x4979('0x18')](function(_0xb80f8a){_0x4d4e6a(_0x542fb6['error'](0x1f4,_0xb80f8a[_0x4979('0x16')]));});});};exports[_0x4979('0x4a')]=function(_0x131d44){var _0x30d31a=this;return new Promise(function(_0x40cd06,_0x165b99){var _0x21eba5;var _0x5d4045;var _0x411e36;var _0x424fc3;return db[_0x4979('0x19')][_0x4979('0x47')]({'where':_0x131d44['options'][_0x4979('0x27')]||{},'attributes':['id',_0x4979('0x29'),_0x4979('0x2a'),_0x4979('0x4b'),_0x4979('0x4c'),_0x4979('0x2b'),'loginInPause',_0x4979('0x2c')]})[_0x4979('0x22')](function(_0x18b24a){if(_0x18b24a){_0x21eba5=_0x18b24a;_0x424fc3=_0x131d44[_0x4979('0x39')][_0x4979('0x2c')]?_0x131d44[_0x4979('0x39')][_0x4979('0x2c')]:util[_0x4979('0x32')](_0x4979('0x38'),_0x21eba5[_0x4979('0x29')]);return db['User'][_0x4979('0x4d')]({'where':{'role':_0x4979('0x4e'),'online':!![],'id':{'$ne':_0x21eba5['id']}}});}})['then'](function(_0x145ef1){if(_0x145ef1){_0x411e36=_0x145ef1;return require(_0x4979('0x4f'))[_0x4979('0x50')]();}})[_0x4979('0x22')](function(_0x4b5506){if(_0x4b5506&&_0x4b5506['agents']&&_0x411e36>=_0x4b5506[_0x4979('0x51')]){throw new Error(_0x4979('0x52'));}})[_0x4979('0x22')](function(){if(_0x21eba5){return db[_0x4979('0x2d')][_0x4979('0x48')]({'where':{'membername':_0x21eba5['name']},'individualHooks':!![]});}})[_0x4979('0x22')](function(){if(_0x21eba5){return _0x21eba5[_0x4979('0x53')]({'raw':!![]});}})[_0x4979('0x22')](function(_0x3a1b58){if(_0x21eba5){if(_0x3a1b58){var _0x51b20d=[];_0x5d4045=_0x3a1b58;if(_0x5d4045[_0x4979('0x31')]){for(var _0x5d03ab=0x0;_0x5d03ab<_0x5d4045[_0x4979('0x31')];_0x5d03ab++){_0x51b20d[_0x4979('0x36')](db[_0x4979('0x2d')][_0x4979('0x54')]({'membername':_0x21eba5['name'],'UserId':_0x21eba5['id'],'queue_name':_0x5d4045[_0x5d03ab]['name'],'VoiceQueueId':_0x5d4045[_0x5d03ab]['id'],'interface':_0x424fc3,'paused':_0x21eba5['loginInPause']||![],'penalty':_0x5d4045[_0x5d03ab][_0x4979('0x55')]||0x0}));}return BPromise[_0x4979('0x49')](_0x51b20d);}}}})[_0x4979('0x22')](function(){if(_0x21eba5){return db[_0x4979('0x2f')][_0x4979('0x1a')]({'where':{'membername':_0x21eba5[_0x4979('0x29')],'exitAt':null}});}})[_0x4979('0x22')](function(_0x408921){if(_0x21eba5){if(_0x408921&&_0x408921[_0x4979('0x31')]){var _0x504823=[];_0x408921[_0x4979('0x45')](function(_0x51321a){_0x504823['push'](_0x51321a[_0x4979('0x2e')]({'exitAt':moment()[_0x4979('0x32')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x4979('0x49')](_0x504823);}}})[_0x4979('0x22')](function(_0x17f84d){if(_0x21eba5){var _0xf7e65b=[];var _0x1f1903=[];var _0x37a441=utils['getChannels']();var _0x3635ff={'membername':_0x21eba5[_0x4979('0x29')],'interface':_0x424fc3,'enterAt':moment()[_0x4979('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x21eba5['role'],'internal':_0x21eba5[_0x4979('0x2b')]};_0x37a441['forEach'](function(_0x1c2c50){_0xf7e65b[_0x4979('0x36')](_[_0x4979('0x56')]({'channel':_0x1c2c50,'type':_0x4979('0x57'),'data1':'callysquare','data2':_0x424fc3},_0x3635ff));if(_0x21eba5[_0x4979('0x58')]){_0x1f1903[_0x4979('0x36')](_['merge']({'channel':_0x1c2c50,'type':_0x4979('0x30'),'data1':_0x4979('0x59')},_0x3635ff));}});return db[_0x4979('0x2f')][_0x4979('0x5a')](_0xf7e65b[_0x4979('0x5b')](_0x1f1903),{'individualHooks':!![]});}})[_0x4979('0x22')](function(){if(_0x21eba5){return _0x21eba5[_0x4979('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x4979('0x32')](_0x4979('0x33')),'voicePause':_0x21eba5[_0x4979('0x58')]||![],'mailPause':_0x21eba5[_0x4979('0x58')]||![],'chatPause':_0x21eba5[_0x4979('0x58')]||![],'faxPause':_0x21eba5['loginInPause']||![],'smsPause':_0x21eba5[_0x4979('0x58')]||![],'openchannelPause':_0x21eba5[_0x4979('0x58')]||![],'pauseType':_0x21eba5['loginInPause']?_0x4979('0x59'):null,'lastPauseAt':moment()[_0x4979('0x32')](_0x4979('0x33')),'interface':_0x424fc3});}})[_0x4979('0x22')](function(_0x292c05){_0x40cd06(_0x292c05);})[_0x4979('0x18')](function(_0x256f6f){_0x165b99(_0x30d31a[_0x4979('0x15')](0x1f4,_0x256f6f[_0x4979('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 791daf3..fc4dae7 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 _0xe098=['removeListener','user:','./user.events','save','remove','update'];(function(_0x5a8073,_0x1ea2eb){var _0x42985e=function(_0x1d083a){while(--_0x1d083a){_0x5a8073['push'](_0x5a8073['shift']());}};_0x42985e(++_0x1ea2eb);}(_0xe098,0x18e));var _0x8e09=function(_0x514626,_0x5bd445){_0x514626=_0x514626-0x0;var _0x2c0110=_0xe098[_0x514626];return _0x2c0110;};'use strict';var UserEvents=require(_0x8e09('0x0'));var events=[_0x8e09('0x1'),_0x8e09('0x2'),_0x8e09('0x3')];function createListener(_0x479c3c,_0x3c9b6e){return function(_0x75dd3){_0x3c9b6e['emit'](_0x479c3c,_0x75dd3);};}function removeListener(_0x4b8c04,_0x3a833d){return function(){UserEvents[_0x8e09('0x4')](_0x4b8c04,_0x3a833d);};}exports['register']=function(_0x59ad29){for(var _0x1d31bf=0x0,_0x278d72=events['length'];_0x1d31bf<_0x278d72;_0x1d31bf++){var _0x38076e=events[_0x1d31bf];var _0x3b54d9=createListener(_0x8e09('0x5')+_0x38076e,_0x59ad29);UserEvents['on'](_0x38076e,_0x3b54d9);}}; \ No newline at end of file +var _0xb06d=['remove','update','register','length','user:','./user.events'];(function(_0x51edca,_0x18ad70){var _0x2b77ec=function(_0x55a549){while(--_0x55a549){_0x51edca['push'](_0x51edca['shift']());}};_0x2b77ec(++_0x18ad70);}(_0xb06d,0x1d3));var _0xdb06=function(_0x331a21,_0x41835e){_0x331a21=_0x331a21-0x0;var _0x56d334=_0xb06d[_0x331a21];return _0x56d334;};'use strict';var UserEvents=require(_0xdb06('0x0'));var events=['save',_0xdb06('0x1'),_0xdb06('0x2')];function createListener(_0x3c099f,_0x536a9e){return function(_0x3786e1){_0x536a9e['emit'](_0x3c099f,_0x3786e1);};}function removeListener(_0x1828ad,_0x1ca75b){return function(){UserEvents['removeListener'](_0x1828ad,_0x1ca75b);};}exports[_0xdb06('0x3')]=function(_0xb67c4d){for(var _0x4663b2=0x0,_0x381bdd=events[_0xdb06('0x4')];_0x4663b2<_0x381bdd;_0x4663b2++){var _0x3a30e7=events[_0x4663b2];var _0x576885=createListener(_0xdb06('0x5')+_0x3a30e7,_0xb67c4d);UserEvents['on'](_0x3a30e7,_0x576885);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 5591bc7..84a8f50 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 _0x69ff=['Router','../../components/interaction/service','util','connect-timeout','express'];(function(_0x51690d,_0x109a13){var _0x449bdb=function(_0x4d42f2){while(--_0x4d42f2){_0x51690d['push'](_0x51690d['shift']());}};_0x449bdb(++_0x109a13);}(_0x69ff,0x179));var _0xf69f=function(_0x4ed537,_0x9912c2){_0x4ed537=_0x4ed537-0x0;var _0x333790=_0x69ff[_0x4ed537];return _0x333790;};'use strict';var multer=require('multer');var util=require(_0xf69f('0x0'));var path=require('path');var timeout=require(_0xf69f('0x1'));var express=require(_0xf69f('0x2'));var router=express[_0xf69f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf69f('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x07a6=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','connect-timeout','express','Router'];(function(_0x1fee1e,_0xd0cf34){var _0x2128ae=function(_0x2a1a9f){while(--_0x2a1a9f){_0x1fee1e['push'](_0x1fee1e['shift']());}};_0x2128ae(++_0xd0cf34);}(_0x07a6,0x9c));var _0x607a=function(_0x23d96f,_0x1153b7){_0x23d96f=_0x23d96f-0x0;var _0x2db681=_0x07a6[_0x23d96f];return _0x2db681;};'use strict';var multer=require('multer');var util=require(_0x607a('0x0'));var path=require('path');var timeout=require(_0x607a('0x1'));var express=require(_0x607a('0x2'));var router=express[_0x607a('0x3')]();var auth=require(_0x607a('0x4'));var interaction=require(_0x607a('0x5'));var config=require(_0x607a('0x6'));module[_0x607a('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index d499567..45c35b3 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x2cff4f,_0x21e344){var _0x3df848=function(_0x49474b){while(--_0x49474b){_0x2cff4f['push'](_0x2cff4f['shift']());}};_0x3df848(++_0x21e344);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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 c6afc95..7122931 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 _0x9829=['path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','util','../../config/logger','api','moment','request-promise'];(function(_0x22c169,_0x3298a6){var _0x30cc6f=function(_0x2cd339){while(--_0x2cd339){_0x22c169['push'](_0x22c169['shift']());}};_0x30cc6f(++_0x3298a6);}(_0x9829,0x11b));var _0x9982=function(_0xd578cb,_0x2167a3){_0xd578cb=_0xd578cb-0x0;var _0x775533=_0x9829[_0xd578cb];return _0x775533;};'use strict';var _=require('lodash');var util=require(_0x9982('0x0'));var logger=require(_0x9982('0x1'))(_0x9982('0x2'));var moment=require(_0x9982('0x3'));var BPromise=require('bluebird');var rp=require(_0x9982('0x4'));var fs=require('fs');var path=require(_0x9982('0x5'));var rimraf=require(_0x9982('0x6'));var config=require(_0x9982('0x7'));var attributes=require(_0x9982('0x8'));module[_0x9982('0x9')]=function(_0x2c2972,_0x4e56da){return _0x2c2972[_0x9982('0xa')](_0x9982('0xb'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc329=['user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0xc329,0x90));var _0x9c32=function(_0x4433b,_0x1eded1){_0x4433b=_0x4433b-0x0;var _0xffc1da=_0xc329[_0x4433b];return _0xffc1da;};'use strict';var _=require(_0x9c32('0x0'));var util=require(_0x9c32('0x1'));var logger=require(_0x9c32('0x2'))(_0x9c32('0x3'));var moment=require('moment');var BPromise=require(_0x9c32('0x4'));var rp=require(_0x9c32('0x5'));var fs=require('fs');var path=require(_0x9c32('0x6'));var rimraf=require(_0x9c32('0x7'));var config=require(_0x9c32('0x8'));var attributes=require(_0x9c32('0x9'));module[_0x9c32('0xa')]=function(_0x14d8ac,_0x5ec7d9){return _0x14d8ac['define'](_0x9c32('0xb'),attributes,{'tableName':_0x9c32('0xc'),'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 534445e..304fcb9 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 _0x4690=['then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x37d1dd,_0x328b44){var _0x49539d=function(_0x381aa5){while(--_0x381aa5){_0x37d1dd['push'](_0x37d1dd['shift']());}};_0x49539d(++_0x328b44);}(_0x4690,0x19b));var _0x0469=function(_0x3d7793,_0x13f42a){_0x3d7793=_0x3d7793-0x0;var _0x16dc27=_0x4690[_0x3d7793];return _0x16dc27;};'use strict';var _=require(_0x0469('0x0'));var util=require(_0x0469('0x1'));var moment=require(_0x0469('0x2'));var BPromise=require(_0x0469('0x3'));var rs=require(_0x0469('0x4'));var fs=require('fs');var Redis=require(_0x0469('0x5'));var db=require(_0x0469('0x6'))['db'];var utils=require(_0x0469('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0469('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3df7c8,_0x312590,_0x1fed05){return new BPromise(function(_0x4e19b7,_0x222965){return client['request'](_0x3df7c8,_0x1fed05)[_0x0469('0x9')](function(_0x143836){logger[_0x0469('0xa')](_0x0469('0xb'),_0x312590,_0x0469('0xc'));logger['debug'](_0x0469('0xd'),_0x312590,_0x0469('0xc'),JSON[_0x0469('0xe')](_0x143836));if(_0x143836['error']){if(_0x143836[_0x0469('0xf')][_0x0469('0x10')]===0x1f4){logger[_0x0469('0xf')](_0x0469('0xb'),_0x312590,_0x143836['error'][_0x0469('0x11')]);return _0x222965(_0x143836[_0x0469('0xf')][_0x0469('0x11')]);}logger[_0x0469('0xf')](_0x0469('0xb'),_0x312590,_0x143836[_0x0469('0xf')][_0x0469('0x11')]);return _0x4e19b7(_0x143836[_0x0469('0xf')][_0x0469('0x11')]);}else{logger[_0x0469('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x312590,_0x0469('0xc'));_0x4e19b7(_0x143836[_0x0469('0x12')][_0x0469('0x11')]);}})[_0x0469('0x13')](function(_0x5aca74){logger[_0x0469('0xf')](_0x0469('0xb'),_0x312590,_0x5aca74);_0x222965(_0x5aca74);});});} \ No newline at end of file +var _0xe32d=['info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4b1bbc,_0x1035f3){var _0x55d8db=function(_0x1e22c0){while(--_0x1e22c0){_0x4b1bbc['push'](_0x4b1bbc['shift']());}};_0x55d8db(++_0x1035f3);}(_0xe32d,0x1ba));var _0xde32=function(_0x56b78d,_0x5680a3){_0x56b78d=_0x56b78d-0x0;var _0x2763b7=_0xe32d[_0x56b78d];return _0x2763b7;};'use strict';var _=require(_0xde32('0x0'));var util=require(_0xde32('0x1'));var moment=require(_0xde32('0x2'));var BPromise=require('bluebird');var rs=require(_0xde32('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde32('0x4'))['db'];var utils=require(_0xde32('0x5'));var logger=require(_0xde32('0x6'))(_0xde32('0x7'));var config=require(_0xde32('0x8'));var jayson=require(_0xde32('0x9'));var client=jayson[_0xde32('0xa')][_0xde32('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3180f2,_0xabd0c0,_0xe61edb){return new BPromise(function(_0x2a481e,_0x33e1cd){return client[_0xde32('0xc')](_0x3180f2,_0xe61edb)[_0xde32('0xd')](function(_0x4cb00e){logger[_0xde32('0xe')](_0xde32('0xf'),_0xabd0c0,_0xde32('0x10'));logger[_0xde32('0x11')](_0xde32('0x12'),_0xabd0c0,_0xde32('0x10'),JSON[_0xde32('0x13')](_0x4cb00e));if(_0x4cb00e[_0xde32('0x14')]){if(_0x4cb00e[_0xde32('0x14')][_0xde32('0x15')]===0x1f4){logger['error'](_0xde32('0xf'),_0xabd0c0,_0x4cb00e['error']['message']);return _0x33e1cd(_0x4cb00e[_0xde32('0x14')][_0xde32('0x16')]);}logger[_0xde32('0x14')](_0xde32('0xf'),_0xabd0c0,_0x4cb00e[_0xde32('0x14')][_0xde32('0x16')]);return _0x2a481e(_0x4cb00e[_0xde32('0x14')]['message']);}else{logger[_0xde32('0xe')]('UserChatQueue,\x20%s,\x20%s',_0xabd0c0,_0xde32('0x10'));_0x2a481e(_0x4cb00e[_0xde32('0x17')][_0xde32('0x16')]);}})['catch'](function(_0x1c455e){logger[_0xde32('0x14')](_0xde32('0xf'),_0xabd0c0,_0x1c455e);_0x33e1cd(_0x1c455e);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index fe507f9..d81f3ab 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 _0x6e0d=['../../config/environment','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6e0d,0x19a));var _0xd6e0=function(_0x49be7f,_0x4c95aa){_0x49be7f=_0x49be7f-0x0;var _0x23a2fe=_0x6e0d[_0x49be7f];return _0x23a2fe;};'use strict';var multer=require(_0xd6e0('0x0'));var util=require(_0xd6e0('0x1'));var path=require(_0xd6e0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd6e0('0x3')]();var auth=require(_0xd6e0('0x4'));var interaction=require(_0xd6e0('0x5'));var config=require(_0xd6e0('0x6'));module[_0xd6e0('0x7')]=router; \ No newline at end of file +var _0xe4fa=['multer','path','Router','../../config/environment','exports'];(function(_0xfbc791,_0x5c513f){var _0x319b54=function(_0x3f8f64){while(--_0x3f8f64){_0xfbc791['push'](_0xfbc791['shift']());}};_0x319b54(++_0x5c513f);}(_0xe4fa,0xff));var _0xae4f=function(_0x2cfd71,_0x37f649){_0x2cfd71=_0x2cfd71-0x0;var _0x591a7b=_0xe4fa[_0x2cfd71];return _0x591a7b;};'use strict';var multer=require(_0xae4f('0x0'));var util=require('util');var path=require(_0xae4f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xae4f('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xae4f('0x3'));module[_0xae4f('0x4')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 1eb2872..a5e7b77 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 _0x955f=['exports','INTEGER','STRING','sequelize'];(function(_0x56ad00,_0x3a5228){var _0x220289=function(_0x47b201){while(--_0x47b201){_0x56ad00['push'](_0x56ad00['shift']());}};_0x220289(++_0x3a5228);}(_0x955f,0x1eb));var _0xf955=function(_0x3f643b,_0x4d07f0){_0x3f643b=_0x3f643b-0x0;var _0x3cfb45=_0x955f[_0x3f643b];return _0x3cfb45;};'use strict';var Sequelize=require(_0xf955('0x0'));module[_0xf955('0x1')]={'penalty':{'type':Sequelize[_0xf955('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf955('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf955('0x3')]}}; \ No newline at end of file +var _0xda3f=['exports','INTEGER'];(function(_0x35c585,_0x5f3824){var _0x5ddb1a=function(_0x3b1a3b){while(--_0x3b1a3b){_0x35c585['push'](_0x35c585['shift']());}};_0x5ddb1a(++_0x5f3824);}(_0xda3f,0xec));var _0xfda3=function(_0x206de8,_0x46dde7){_0x206de8=_0x206de8-0x0;var _0x12ec32=_0xda3f[_0x206de8];return _0x12ec32;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'penalty':{'type':Sequelize[_0xfda3('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 5e0ae4a..7b07927 100644 --- a/server/api/userFaxQueue/userFaxQueue.model.js +++ b/server/api/userFaxQueue/userFaxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0xb10b,0x12a));var _0xbb10=function(_0x19aaa9,_0x9d0bb6){_0x19aaa9=_0x19aaa9-0x0;var _0x465463=_0xb10b[_0x19aaa9];return _0x465463;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x323430,_0x3d2b6d){var _0x9eecd1=function(_0xab855a){while(--_0xab855a){_0x323430['push'](_0x323430['shift']());}};_0x9eecd1(++_0x3d2b6d);}(_0xb10b,0x12a));var _0xbb10=function(_0x294cf1,_0x5d6a40){_0x294cf1=_0x294cf1-0x0;var _0x334402=_0xb10b[_0x294cf1];return _0x334402;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index a1a30dc..37afca2 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 _0x6157=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x307b81,_0x2a371b){var _0x4de106=function(_0x2c437c){while(--_0x2c437c){_0x307b81['push'](_0x307b81['shift']());}};_0x4de106(++_0x2a371b);}(_0x6157,0x1a0));var _0x7615=function(_0x3d1200,_0x5188fd){_0x3d1200=_0x3d1200-0x0;var _0x3cbbfc=_0x6157[_0x3d1200];return _0x3cbbfc;};'use strict';var _=require(_0x7615('0x0'));var util=require(_0x7615('0x1'));var moment=require('moment');var BPromise=require(_0x7615('0x2'));var rs=require(_0x7615('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7615('0x4'))['db'];var utils=require(_0x7615('0x5'));var logger=require(_0x7615('0x6'))(_0x7615('0x7'));var config=require(_0x7615('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x502985,_0x5ed44,_0x407cb4){return new BPromise(function(_0x25ea3c,_0x21241b){return client[_0x7615('0x9')](_0x502985,_0x407cb4)['then'](function(_0x46db8d){logger[_0x7615('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x5ed44,_0x7615('0xb'));logger['debug'](_0x7615('0xc'),_0x5ed44,'request\x20sent',JSON['stringify'](_0x46db8d));if(_0x46db8d[_0x7615('0xd')]){if(_0x46db8d['error'][_0x7615('0xe')]===0x1f4){logger[_0x7615('0xd')](_0x7615('0xf'),_0x5ed44,_0x46db8d[_0x7615('0xd')][_0x7615('0x10')]);return _0x21241b(_0x46db8d[_0x7615('0xd')][_0x7615('0x10')]);}logger[_0x7615('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x5ed44,_0x46db8d['error'][_0x7615('0x10')]);return _0x25ea3c(_0x46db8d[_0x7615('0xd')][_0x7615('0x10')]);}else{logger[_0x7615('0xa')](_0x7615('0xf'),_0x5ed44,_0x7615('0xb'));_0x25ea3c(_0x46db8d[_0x7615('0x11')][_0x7615('0x10')]);}})[_0x7615('0x12')](function(_0x44a6bb){logger['error'](_0x7615('0xf'),_0x5ed44,_0x44a6bb);_0x21241b(_0x44a6bb);});});} \ No newline at end of file +var _0x6659=['request\x20sent','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x6659,0xbd));var _0x9665=function(_0x40a376,_0x54dd0a){_0x40a376=_0x40a376-0x0;var _0x2bdbb5=_0x6659[_0x40a376];return _0x2bdbb5;};'use strict';var _=require('lodash');var util=require(_0x9665('0x0'));var moment=require('moment');var BPromise=require(_0x9665('0x1'));var rs=require(_0x9665('0x2'));var fs=require('fs');var Redis=require(_0x9665('0x3'));var db=require(_0x9665('0x4'))['db'];var utils=require(_0x9665('0x5'));var logger=require(_0x9665('0x6'))(_0x9665('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3798b7,_0x279158,_0x4d5720){return new BPromise(function(_0x20d669,_0x39f0e4){return client['request'](_0x3798b7,_0x4d5720)['then'](function(_0x5d8ae8){logger['info'](_0x9665('0x8'),_0x279158,'request\x20sent');logger[_0x9665('0x9')](_0x9665('0xa'),_0x279158,'request\x20sent',JSON[_0x9665('0xb')](_0x5d8ae8));if(_0x5d8ae8[_0x9665('0xc')]){if(_0x5d8ae8['error']['code']===0x1f4){logger['error'](_0x9665('0x8'),_0x279158,_0x5d8ae8['error'][_0x9665('0xd')]);return _0x39f0e4(_0x5d8ae8[_0x9665('0xc')][_0x9665('0xd')]);}logger[_0x9665('0xc')](_0x9665('0x8'),_0x279158,_0x5d8ae8['error'][_0x9665('0xd')]);return _0x20d669(_0x5d8ae8[_0x9665('0xc')][_0x9665('0xd')]);}else{logger[_0x9665('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x279158,_0x9665('0xf'));_0x20d669(_0x5d8ae8[_0x9665('0x10')][_0x9665('0xd')]);}})['catch'](function(_0xfd2b1d){logger[_0x9665('0xc')](_0x9665('0x8'),_0x279158,_0xfd2b1d);_0x39f0e4(_0xfd2b1d);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 42d515e..ddebe7b 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 _0xa9fa=['../../components/interaction/service','../../config/environment','multer','util','path','express'];(function(_0x38cf13,_0x3580fc){var _0x5e75e0=function(_0x28be91){while(--_0x28be91){_0x38cf13['push'](_0x38cf13['shift']());}};_0x5e75e0(++_0x3580fc);}(_0xa9fa,0x1e2));var _0xaa9f=function(_0x127808,_0x389f63){_0x127808=_0x127808-0x0;var _0x123f60=_0xa9fa[_0x127808];return _0x123f60;};'use strict';var multer=require(_0xaa9f('0x0'));var util=require(_0xaa9f('0x1'));var path=require(_0xaa9f('0x2'));var timeout=require('connect-timeout');var express=require(_0xaa9f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xaa9f('0x4'));var config=require(_0xaa9f('0x5'));module['exports']=router; \ No newline at end of file +var _0xab52=['../../components/interaction/service','exports','multer','util','path','Router'];(function(_0x53db6a,_0x1ce1eb){var _0xa193b6=function(_0x4e9990){while(--_0x4e9990){_0x53db6a['push'](_0x53db6a['shift']());}};_0xa193b6(++_0x1ce1eb);}(_0xab52,0x1a6));var _0x2ab5=function(_0x2a9393,_0xae8865){_0x2a9393=_0x2a9393-0x0;var _0x462f0d=_0xab52[_0x2a9393];return _0x462f0d;};'use strict';var multer=require(_0x2ab5('0x0'));var util=require(_0x2ab5('0x1'));var path=require(_0x2ab5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2ab5('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2ab5('0x4'));var config=require('../../config/environment');module[_0x2ab5('0x5')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 6316f4b..707e8ce 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x539564,_0x328309){var _0x5efe2b=function(_0x59ea09){while(--_0x59ea09){_0x539564['push'](_0x539564['shift']());}};_0x5efe2b(++_0x328309);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x240454,_0x1896cd){var _0x4059dc=function(_0x5f01dc){while(--_0x5f01dc){_0x240454['push'](_0x240454['shift']());}};_0x4059dc(++_0x1896cd);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 7e3f546..86d7e77 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x521e58,_0x5f30c8){var _0x105a23=function(_0x457966){while(--_0x457966){_0x521e58['push'](_0x521e58['shift']());}};_0x105a23(++_0x5f30c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1819ef,_0x3d9ea3){var _0x12ca22=function(_0x292179){while(--_0x292179){_0x1819ef['push'](_0x1819ef['shift']());}};_0x12ca22(++_0x3d9ea3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 15d9894..61a384c 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 _0xf131=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash'];(function(_0xda4429,_0x48e328){var _0x4440cb=function(_0x169eab){while(--_0x169eab){_0xda4429['push'](_0xda4429['shift']());}};_0x4440cb(++_0x48e328);}(_0xf131,0x1a1));var _0x1f13=function(_0x575b0a,_0x39fc88){_0x575b0a=_0x575b0a-0x0;var _0x2dc331=_0xf131[_0x575b0a];return _0x2dc331;};'use strict';var _=require(_0x1f13('0x0'));var util=require(_0x1f13('0x1'));var moment=require(_0x1f13('0x2'));var BPromise=require(_0x1f13('0x3'));var rs=require(_0x1f13('0x4'));var fs=require('fs');var Redis=require(_0x1f13('0x5'));var db=require(_0x1f13('0x6'))['db'];var utils=require(_0x1f13('0x7'));var logger=require('../../config/logger')(_0x1f13('0x8'));var config=require('../../config/environment');var jayson=require(_0x1f13('0x9'));var client=jayson[_0x1f13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d007e,_0x263848,_0x3ee03a){return new BPromise(function(_0x436521,_0x1126a4){return client[_0x1f13('0xb')](_0x3d007e,_0x3ee03a)[_0x1f13('0xc')](function(_0x11619a){logger['info'](_0x1f13('0xd'),_0x263848,_0x1f13('0xe'));logger[_0x1f13('0xf')](_0x1f13('0x10'),_0x263848,_0x1f13('0xe'),JSON['stringify'](_0x11619a));if(_0x11619a[_0x1f13('0x11')]){if(_0x11619a[_0x1f13('0x11')]['code']===0x1f4){logger[_0x1f13('0x11')](_0x1f13('0xd'),_0x263848,_0x11619a[_0x1f13('0x11')][_0x1f13('0x12')]);return _0x1126a4(_0x11619a[_0x1f13('0x11')][_0x1f13('0x12')]);}logger['error'](_0x1f13('0xd'),_0x263848,_0x11619a[_0x1f13('0x11')]['message']);return _0x436521(_0x11619a[_0x1f13('0x11')][_0x1f13('0x12')]);}else{logger[_0x1f13('0x13')](_0x1f13('0xd'),_0x263848,_0x1f13('0xe'));_0x436521(_0x11619a[_0x1f13('0x14')][_0x1f13('0x12')]);}})[_0x1f13('0x15')](function(_0x448cae){logger[_0x1f13('0x11')](_0x1f13('0xd'),_0x263848,_0x448cae);_0x1126a4(_0x448cae);});});} \ No newline at end of file +var _0x3435=['request','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x1cf1c7,_0x1e0f72){var _0x362b0a=function(_0xfec7cd){while(--_0xfec7cd){_0x1cf1c7['push'](_0x1cf1c7['shift']());}};_0x362b0a(++_0x1e0f72);}(_0x3435,0xfa));var _0x5343=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x3435[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var moment=require(_0x5343('0x2'));var BPromise=require(_0x5343('0x3'));var rs=require(_0x5343('0x4'));var fs=require('fs');var Redis=require(_0x5343('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5343('0x6'));var logger=require(_0x5343('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5343('0x8'));var client=jayson[_0x5343('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x544b29,_0x13641f,_0x1e1911){return new BPromise(function(_0x9ea9b6,_0x245034){return client[_0x5343('0xa')](_0x544b29,_0x1e1911)['then'](function(_0x44421c){logger['info'](_0x5343('0xb'),_0x13641f,_0x5343('0xc'));logger[_0x5343('0xd')](_0x5343('0xe'),_0x13641f,_0x5343('0xc'),JSON['stringify'](_0x44421c));if(_0x44421c[_0x5343('0xf')]){if(_0x44421c[_0x5343('0xf')][_0x5343('0x10')]===0x1f4){logger['error'](_0x5343('0xb'),_0x13641f,_0x44421c['error'][_0x5343('0x11')]);return _0x245034(_0x44421c[_0x5343('0xf')]['message']);}logger[_0x5343('0xf')]('UserMailQueue,\x20%s,\x20%s',_0x13641f,_0x44421c[_0x5343('0xf')][_0x5343('0x11')]);return _0x9ea9b6(_0x44421c[_0x5343('0xf')][_0x5343('0x11')]);}else{logger['info'](_0x5343('0xb'),_0x13641f,_0x5343('0xc'));_0x9ea9b6(_0x44421c[_0x5343('0x12')][_0x5343('0x11')]);}})[_0x5343('0x13')](function(_0x2913e8){logger[_0x5343('0xf')](_0x5343('0xb'),_0x13641f,_0x2913e8);_0x245034(_0x2913e8);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 6706e5d..95f0551 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 _0xa31a=['path','Router','../../components/auth/service','exports','multer'];(function(_0x41f0bb,_0x40a59f){var _0x4004ef=function(_0x230a7f){while(--_0x230a7f){_0x41f0bb['push'](_0x41f0bb['shift']());}};_0x4004ef(++_0x40a59f);}(_0xa31a,0x1b2));var _0xaa31=function(_0x5a925f,_0x2bffd5){_0x5a925f=_0x5a925f-0x0;var _0x3006fd=_0xa31a[_0x5a925f];return _0x3006fd;};'use strict';var multer=require(_0xaa31('0x0'));var util=require('util');var path=require(_0xaa31('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaa31('0x2')]();var auth=require(_0xaa31('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xaa31('0x4')]=router; \ No newline at end of file +var _0x9648=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x105b14,_0x246c43){var _0x2ba487=function(_0xd16399){while(--_0xd16399){_0x105b14['push'](_0x105b14['shift']());}};_0x2ba487(++_0x246c43);}(_0x9648,0xfa));var _0x8964=function(_0x15dd81,_0x4563eb){_0x15dd81=_0x15dd81-0x0;var _0x40d4b5=_0x9648[_0x15dd81];return _0x40d4b5;};'use strict';var multer=require(_0x8964('0x0'));var util=require(_0x8964('0x1'));var path=require(_0x8964('0x2'));var timeout=require(_0x8964('0x3'));var express=require(_0x8964('0x4'));var router=express[_0x8964('0x5')]();var auth=require(_0x8964('0x6'));var interaction=require(_0x8964('0x7'));var config=require(_0x8964('0x8'));module[_0x8964('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 504ba4f..e296118 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x37c981,_0x22a780){var _0x4deca9=function(_0x38cf21){while(--_0x38cf21){_0x37c981['push'](_0x37c981['shift']());}};_0x4deca9(++_0x22a780);}(_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 _0xbaf0=['exports','INTEGER'];(function(_0x4be3ec,_0x218441){var _0x44b79f=function(_0x56d3c1){while(--_0x56d3c1){_0x4be3ec['push'](_0x4be3ec['shift']());}};_0x44b79f(++_0x218441);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'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/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 7062657..3cd1fad 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 _0x4cae=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4cae,0x6b));var _0xe4ca=function(_0x31b2ad,_0x496b1e){_0x31b2ad=_0x31b2ad-0x0;var _0x336191=_0x4cae[_0x31b2ad];return _0x336191;};'use strict';var _=require('lodash');var util=require(_0xe4ca('0x0'));var logger=require(_0xe4ca('0x1'))('api');var moment=require(_0xe4ca('0x2'));var BPromise=require(_0xe4ca('0x3'));var rp=require(_0xe4ca('0x4'));var fs=require('fs');var path=require(_0xe4ca('0x5'));var rimraf=require(_0xe4ca('0x6'));var config=require(_0xe4ca('0x7'));var attributes=require(_0xe4ca('0x8'));module[_0xe4ca('0x9')]=function(_0x3737ac,_0x2bd685){return _0x3737ac[_0xe4ca('0xa')]('UserOpenchannelQueue',attributes,{'tableName':_0xe4ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f7c=['rimraf','../../config/environment','exports','define','user_has_openchannel_queues','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x58df3e,_0x38ff8d){var _0x3cebd4=function(_0x3197e){while(--_0x3197e){_0x58df3e['push'](_0x58df3e['shift']());}};_0x3cebd4(++_0x38ff8d);}(_0x9f7c,0xcb));var _0xc9f7=function(_0x586baa,_0x3962b7){_0x586baa=_0x586baa-0x0;var _0x3ac81d=_0x9f7c[_0x586baa];return _0x3ac81d;};'use strict';var _=require('lodash');var util=require(_0xc9f7('0x0'));var logger=require(_0xc9f7('0x1'))('api');var moment=require(_0xc9f7('0x2'));var BPromise=require(_0xc9f7('0x3'));var rp=require(_0xc9f7('0x4'));var fs=require('fs');var path=require(_0xc9f7('0x5'));var rimraf=require(_0xc9f7('0x6'));var config=require(_0xc9f7('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xc9f7('0x8')]=function(_0x50b2a0,_0xc7c9ae){return _0x50b2a0[_0xc9f7('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0xc9f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 17afba5..14ecf18 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 _0xa25c=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x56625d,_0x12e6e9){var _0x3bf11b=function(_0x53294d){while(--_0x53294d){_0x56625d['push'](_0x56625d['shift']());}};_0x3bf11b(++_0x12e6e9);}(_0xa25c,0x113));var _0xca25=function(_0x19cbac,_0x4a7597){_0x19cbac=_0x19cbac-0x0;var _0x180da3=_0xa25c[_0x19cbac];return _0x180da3;};'use strict';var _=require(_0xca25('0x0'));var util=require(_0xca25('0x1'));var moment=require(_0xca25('0x2'));var BPromise=require(_0xca25('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca25('0x4'));var db=require(_0xca25('0x5'))['db'];var utils=require(_0xca25('0x6'));var logger=require(_0xca25('0x7'))(_0xca25('0x8'));var config=require(_0xca25('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xca25('0xa')][_0xca25('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53cf9a,_0x4d1727,_0x167d50){return new BPromise(function(_0x241d07,_0x38bae2){return client[_0xca25('0xc')](_0x53cf9a,_0x167d50)[_0xca25('0xd')](function(_0x4360a5){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4d1727,_0xca25('0xe'));logger[_0xca25('0xf')](_0xca25('0x10'),_0x4d1727,_0xca25('0xe'),JSON['stringify'](_0x4360a5));if(_0x4360a5['error']){if(_0x4360a5[_0xca25('0x11')][_0xca25('0x12')]===0x1f4){logger[_0xca25('0x11')](_0xca25('0x13'),_0x4d1727,_0x4360a5[_0xca25('0x11')][_0xca25('0x14')]);return _0x38bae2(_0x4360a5[_0xca25('0x11')][_0xca25('0x14')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4d1727,_0x4360a5[_0xca25('0x11')][_0xca25('0x14')]);return _0x241d07(_0x4360a5[_0xca25('0x11')][_0xca25('0x14')]);}else{logger['info'](_0xca25('0x13'),_0x4d1727,_0xca25('0xe'));_0x241d07(_0x4360a5[_0xca25('0x15')]['message']);}})[_0xca25('0x16')](function(_0x299d37){logger[_0xca25('0x11')](_0xca25('0x13'),_0x4d1727,_0x299d37);_0x38bae2(_0x299d37);});});} \ No newline at end of file +var _0x86e4=['info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then'];(function(_0x47a95a,_0x564d06){var _0x348e90=function(_0x146c10){while(--_0x146c10){_0x47a95a['push'](_0x47a95a['shift']());}};_0x348e90(++_0x564d06);}(_0x86e4,0x1ae));var _0x486e=function(_0x4b095c,_0x266c55){_0x4b095c=_0x4b095c-0x0;var _0x4495e2=_0x86e4[_0x4b095c];return _0x4495e2;};'use strict';var _=require(_0x486e('0x0'));var util=require(_0x486e('0x1'));var moment=require(_0x486e('0x2'));var BPromise=require('bluebird');var rs=require(_0x486e('0x3'));var fs=require('fs');var Redis=require(_0x486e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x486e('0x5'));var logger=require(_0x486e('0x6'))(_0x486e('0x7'));var config=require('../../config/environment');var jayson=require(_0x486e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e71c5,_0x4fec6e,_0x36e39e){return new BPromise(function(_0x4a9477,_0x2f3580){return client[_0x486e('0x9')](_0x2e71c5,_0x36e39e)[_0x486e('0xa')](function(_0x4addec){logger[_0x486e('0xb')](_0x486e('0xc'),_0x4fec6e,_0x486e('0xd'));logger[_0x486e('0xe')](_0x486e('0xf'),_0x4fec6e,_0x486e('0xd'),JSON[_0x486e('0x10')](_0x4addec));if(_0x4addec[_0x486e('0x11')]){if(_0x4addec[_0x486e('0x11')]['code']===0x1f4){logger[_0x486e('0x11')](_0x486e('0xc'),_0x4fec6e,_0x4addec[_0x486e('0x11')][_0x486e('0x12')]);return _0x2f3580(_0x4addec['error']['message']);}logger[_0x486e('0x11')](_0x486e('0xc'),_0x4fec6e,_0x4addec['error'][_0x486e('0x12')]);return _0x4a9477(_0x4addec[_0x486e('0x11')][_0x486e('0x12')]);}else{logger['info'](_0x486e('0xc'),_0x4fec6e,_0x486e('0xd'));_0x4a9477(_0x4addec[_0x486e('0x13')]['message']);}})[_0x486e('0x14')](function(_0x3ecaef){logger[_0x486e('0x11')](_0x486e('0xc'),_0x4fec6e,_0x3ecaef);_0x2f3580(_0x3ecaef);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e26c406..67dd23b 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 _0x081e=['show','/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','addSections','addResources','put','update','destroy','delete','removeSections','removeResources','exports','multer','util','express','Router','../../components/auth/service','get','isAuthenticated','index','describe','/:id'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x081e,0x162));var _0xe081=function(_0x58e504,_0x8ec848){_0x58e504=_0x58e504-0x0;var _0x31917f=_0x081e[_0x58e504];return _0x31917f;};'use strict';var multer=require(_0xe081('0x0'));var util=require(_0xe081('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe081('0x2'));var router=express[_0xe081('0x3')]();var auth=require(_0xe081('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0xe081('0x5')]('/',auth[_0xe081('0x6')](),controller[_0xe081('0x7')]);router['get']('/describe',auth[_0xe081('0x6')](),controller[_0xe081('0x8')]);router[_0xe081('0x5')](_0xe081('0x9'),auth[_0xe081('0x6')](),controller[_0xe081('0xa')]);router['get'](_0xe081('0xb'),auth[_0xe081('0x6')](),controller[_0xe081('0xc')]);router[_0xe081('0x5')](_0xe081('0xd'),auth[_0xe081('0x6')](),controller[_0xe081('0xe')]);router['post']('/',auth[_0xe081('0x6')](),controller[_0xe081('0xf')]);router[_0xe081('0x10')](_0xe081('0x11'),auth[_0xe081('0x6')](),controller[_0xe081('0x12')]);router[_0xe081('0x10')](_0xe081('0xb'),auth[_0xe081('0x6')](),controller[_0xe081('0x13')]);router[_0xe081('0x10')](_0xe081('0xd'),auth[_0xe081('0x6')](),controller[_0xe081('0x14')]);router[_0xe081('0x15')]('/:id',auth[_0xe081('0x6')](),controller[_0xe081('0x16')]);router['delete'](_0xe081('0x9'),auth[_0xe081('0x6')](),controller[_0xe081('0x17')]);router[_0xe081('0x18')](_0xe081('0xb'),auth[_0xe081('0x6')](),controller[_0xe081('0x19')]);router[_0xe081('0x18')](_0xe081('0xd'),auth[_0xe081('0x6')](),controller[_0xe081('0x1a')]);module[_0xe081('0x1b')]=router; \ No newline at end of file +var _0x6358=['../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','/:id/sections','getSections','create','clone','addSections','post','/:id/resources','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x133968,_0x5ca58b){var _0x14a75a=function(_0x52080d){while(--_0x52080d){_0x133968['push'](_0x133968['shift']());}};_0x14a75a(++_0x5ca58b);}(_0x6358,0x13e));var _0x8635=function(_0x4dc10c,_0x2bfbd4){_0x4dc10c=_0x4dc10c-0x0;var _0x2142d1=_0x6358[_0x4dc10c];return _0x2142d1;};'use strict';var multer=require(_0x8635('0x0'));var util=require(_0x8635('0x1'));var path=require(_0x8635('0x2'));var timeout=require(_0x8635('0x3'));var express=require(_0x8635('0x4'));var router=express['Router']();var auth=require(_0x8635('0x5'));var interaction=require(_0x8635('0x6'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x8635('0x7')]('/',auth[_0x8635('0x8')](),controller['index']);router['get'](_0x8635('0x9'),auth[_0x8635('0x8')](),controller[_0x8635('0xa')]);router['get'](_0x8635('0xb'),auth[_0x8635('0x8')](),controller['show']);router['get'](_0x8635('0xc'),auth[_0x8635('0x8')](),controller[_0x8635('0xd')]);router['get']('/:id/resources',auth['isAuthenticated'](),controller['getResources']);router['post']('/',auth[_0x8635('0x8')](),controller[_0x8635('0xe')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x8635('0xf')]);router['post'](_0x8635('0xc'),auth[_0x8635('0x8')](),controller[_0x8635('0x10')]);router[_0x8635('0x11')](_0x8635('0x12'),auth[_0x8635('0x8')](),controller[_0x8635('0x13')]);router[_0x8635('0x14')](_0x8635('0xb'),auth[_0x8635('0x8')](),controller[_0x8635('0x15')]);router[_0x8635('0x16')](_0x8635('0xb'),auth[_0x8635('0x8')](),controller[_0x8635('0x17')]);router['delete']('/:id/sections',auth['isAuthenticated'](),controller[_0x8635('0x18')]);router['delete'](_0x8635('0x12'),auth[_0x8635('0x8')](),controller[_0x8635('0x19')]);module[_0x8635('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 0906bc0..defb3a7 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 _0x0fda=['getDataValue','crudPermissions','sequelize','exports','STRING','name','setDataValue'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0fda,0x64));var _0xa0fd=function(_0x95373c,_0x28dab9){_0x95373c=_0x95373c-0x0;var _0x43981b=_0x0fda[_0x95373c];return _0x43981b;};'use strict';var Sequelize=require(_0xa0fd('0x0'));module[_0xa0fd('0x1')]={'name':{'type':Sequelize[_0xa0fd('0x2')],'allowNull':![],'unique':_0xa0fd('0x3')},'crudPermissions':{'type':Sequelize[_0xa0fd('0x2')],'set':function(_0x3fde20){this[_0xa0fd('0x4')]('crudPermissions',_0x3fde20?_0x3fde20['join'](''):[]);},'get':function(){return this[_0xa0fd('0x5')](_0xa0fd('0x6'))?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa0fd('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x7e6a=['join','getDataValue','crudPermissions','split','sequelize','exports','STRING','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e6a,0xac));var _0xa7e6=function(_0x349bfb,_0x4aaa4a){_0x349bfb=_0x349bfb-0x0;var _0x34a7cc=_0x7e6a[_0x349bfb];return _0x34a7cc;};'use strict';var Sequelize=require(_0xa7e6('0x0'));module[_0xa7e6('0x1')]={'name':{'type':Sequelize[_0xa7e6('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xa7e6('0x2')],'set':function(_0x158a99){this[_0xa7e6('0x3')]('crudPermissions',_0x158a99?_0x158a99[_0xa7e6('0x4')](''):[]);},'get':function(){return this[_0xa7e6('0x5')](_0xa7e6('0x6'))?this[_0xa7e6('0x5')](_0xa7e6('0x6'))[_0xa7e6('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 36952b6..91b596e 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 _0xce79=['findAll','catch','show','params','merge','options','create','body','clone','find','get','createdAt','crudPermissions','omit','updatedAt','transaction','UserProfileSection','each','autoAssociation','sectionId','userProfileId','UserProfileResource','Resources','describe','sequelize','push','removeSections','enabled','includes','isEmpty','findOne','forEach','resourceId','Plugin','bulkCreate','removeResources','ids','getResources','undefined','Sequelize','ValidationError','Unknown\x20section','childModel','Invalid\x20section\x20\x27','parentSections','union','all','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','custom','CustomReports','rows','CmContact','Tags','ThroughTags','tag','value','toLowerCase','odbc','SquareOdbc','squarerecordings','SquareRecording','projectName','JscriptyProject','Lists','ListId','lists','companies','chatqueues','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','Telephones','membername','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','Users','admin','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','Tag','templates','Template','triggers','trunks','variables','Variable','plugins','extractedreports','metrics','AnalyticMetric','whatsappaccounts','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','UserProfile','includeAll','include'];(function(_0x4433d5,_0x43a102){var _0x16384a=function(_0x347d39){while(--_0x347d39){_0x4433d5['push'](_0x4433d5['shift']());}};_0x16384a(++_0x43a102);}(_0xce79,0x9c));var _0x9ce7=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0xce79[_0x1ca9e9];return _0x309f3c;};'use strict';var pdf=require(_0x9ce7('0x0'));var emlformat=require(_0x9ce7('0x1'));var rimraf=require(_0x9ce7('0x2'));var zipdir=require(_0x9ce7('0x3'));var jsonpatch=require(_0x9ce7('0x4'));var rp=require('request-promise');var moment=require(_0x9ce7('0x5'));var BPromise=require(_0x9ce7('0x6'));var Mustache=require(_0x9ce7('0x7'));var util=require(_0x9ce7('0x8'));var path=require('path');var sox=require(_0x9ce7('0x9'));var csv=require(_0x9ce7('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9ce7('0xb'));var squel=require(_0x9ce7('0xc'));var crypto=require(_0x9ce7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9ce7('0xe'));var toCsv=require(_0x9ce7('0xa'));var querystring=require('querystring');var Papa=require(_0x9ce7('0xf'));var Redis=require('ioredis');var authService=require(_0x9ce7('0x10'));var qs=require(_0x9ce7('0x11'));var as=require(_0x9ce7('0x12'));var hardwareService=require(_0x9ce7('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x9ce7('0x14'));var config=require(_0x9ce7('0x15'));var db=require(_0x9ce7('0x16'))['db'];config[_0x9ce7('0x17')]=_[_0x9ce7('0x18')](config[_0x9ce7('0x17')],{'host':_0x9ce7('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9ce7('0x17')]));require(_0x9ce7('0x1a'))[_0x9ce7('0x1b')](socket);function respondWithStatusCode(_0x39941b,_0x9ea60b){_0x9ea60b=_0x9ea60b||0xcc;return function(_0x994854){if(_0x994854){return _0x39941b['sendStatus'](_0x9ea60b);}return _0x39941b[_0x9ce7('0x1c')](_0x9ea60b)[_0x9ce7('0x1d')]();};}function respondWithResult(_0x40d31c,_0x822f3b){_0x822f3b=_0x822f3b||0xc8;return function(_0x2776be){if(_0x2776be){return _0x40d31c[_0x9ce7('0x1c')](_0x822f3b)[_0x9ce7('0x1e')](_0x2776be);}};}function respondWithFilteredResult(_0x388d5e,_0x584bd2){return function(_0x24392f){if(_0x24392f){var _0x4097a=_0x24392f[_0x9ce7('0x1f')],_0x3d1ac1=_0x584bd2[_0x9ce7('0x20')],_0x96799e=_0x584bd2[_0x9ce7('0x20')]+_0x584bd2[_0x9ce7('0x21')],_0x23be6e;if(_0x96799e>=_0x4097a){_0x96799e=_0x4097a;_0x23be6e=0xc8;}else{_0x23be6e=0xce;}_0x388d5e[_0x9ce7('0x1c')](_0x23be6e);return _0x388d5e['set'](_0x9ce7('0x22'),_0x3d1ac1+'-'+_0x96799e+'/'+_0x4097a)['json'](_0x24392f);}return null;};}function patchUpdates(_0x117165){return function(_0x5a4dec){try{jsonpatch[_0x9ce7('0x23')](_0x5a4dec,_0x117165,!![]);}catch(_0x5ed113){return BPromise[_0x9ce7('0x24')](_0x5ed113);}return _0x5a4dec['save']();};}function saveUpdates(_0x90eded,_0x3a96b3){return function(_0x1d990d){if(_0x1d990d){return _0x1d990d[_0x9ce7('0x25')](_0x90eded)[_0x9ce7('0x26')](function(_0x50eb4e){return _0x50eb4e;});}return null;};}function removeEntity(_0xcdc7a7,_0x12cd88){return function(_0x5859dd){if(_0x5859dd){return _0x5859dd[_0x9ce7('0x27')]()[_0x9ce7('0x26')](function(){_0xcdc7a7['status'](0xcc)[_0x9ce7('0x1d')]();});}};}function handleEntityNotFound(_0x3b352d,_0x44d9dd){return function(_0x33ec8d){if(!_0x33ec8d){_0x3b352d[_0x9ce7('0x28')](0x194);}return _0x33ec8d;};}function handleError(_0x2dd9c4,_0x255e5f){_0x255e5f=_0x255e5f||0x1f4;return function(_0x509107){logger[_0x9ce7('0x29')](_0x509107['stack']);if(_0x509107[_0x9ce7('0x2a')]){delete _0x509107[_0x9ce7('0x2a')];}_0x2dd9c4['status'](_0x255e5f)['send'](_0x509107);};}exports[_0x9ce7('0x2b')]=function(_0x4ec280,_0x5e3aaf){var _0x5a115a={},_0x495829={},_0x492010={'count':0x0,'rows':[]};var _0x1ef367=_[_0x9ce7('0x2c')](db['UserProfile'][_0x9ce7('0x2d')],function(_0x1cf1e5){return{'name':_0x1cf1e5['fieldName'],'type':_0x1cf1e5[_0x9ce7('0x2e')][_0x9ce7('0x2f')]};});_0x495829[_0x9ce7('0x30')]=_[_0x9ce7('0x2c')](_0x1ef367,_0x9ce7('0x2a'));_0x495829[_0x9ce7('0x31')]=_[_0x9ce7('0x32')](_0x4ec280['query']);_0x495829[_0x9ce7('0x33')]=_[_0x9ce7('0x34')](_0x495829[_0x9ce7('0x30')],_0x495829[_0x9ce7('0x31')]);_0x5a115a[_0x9ce7('0x35')]=_[_0x9ce7('0x34')](_0x495829['model'],qs['fields'](_0x4ec280[_0x9ce7('0x31')][_0x9ce7('0x36')]));_0x5a115a[_0x9ce7('0x35')]=_0x5a115a[_0x9ce7('0x35')][_0x9ce7('0x37')]?_0x5a115a['attributes']:_0x495829[_0x9ce7('0x30')];if(!_0x4ec280[_0x9ce7('0x31')][_0x9ce7('0x38')](_0x9ce7('0x39'))){_0x5a115a[_0x9ce7('0x21')]=qs[_0x9ce7('0x21')](_0x4ec280[_0x9ce7('0x31')][_0x9ce7('0x21')]);_0x5a115a['offset']=qs['offset'](_0x4ec280[_0x9ce7('0x31')][_0x9ce7('0x20')]);}_0x5a115a[_0x9ce7('0x3a')]=qs[_0x9ce7('0x3b')](_0x4ec280[_0x9ce7('0x31')][_0x9ce7('0x3b')]);_0x5a115a[_0x9ce7('0x3c')]=qs['filters'](_['pick'](_0x4ec280[_0x9ce7('0x31')],_0x495829[_0x9ce7('0x33')]),_0x1ef367);if(_0x4ec280[_0x9ce7('0x31')]['filter']){_0x5a115a[_0x9ce7('0x3c')]=_['merge'](_0x5a115a['where'],{'$or':_['map'](_0x1ef367,function(_0x4cde56){if(_0x4cde56['type']!=='VIRTUAL'){var _0x40f9f5={};_0x40f9f5[_0x4cde56['name']]={'$like':'%'+_0x4ec280[_0x9ce7('0x31')][_0x9ce7('0x3d')]+'%'};return _0x40f9f5;}})});}_0x5a115a=_['merge']({},_0x5a115a,_0x4ec280['options']);var _0x3efa1b={'where':_0x5a115a[_0x9ce7('0x3c')]};return db[_0x9ce7('0x3e')][_0x9ce7('0x1f')](_0x3efa1b)[_0x9ce7('0x26')](function(_0x4de03e){_0x492010[_0x9ce7('0x1f')]=_0x4de03e;if(_0x4ec280['query'][_0x9ce7('0x3f')]){_0x5a115a[_0x9ce7('0x40')]=[{'all':!![]}];}return db[_0x9ce7('0x3e')][_0x9ce7('0x41')](_0x5a115a);})[_0x9ce7('0x26')](function(_0x225b04){_0x492010['rows']=_0x225b04;return _0x492010;})['then'](respondWithFilteredResult(_0x5e3aaf,_0x5a115a))[_0x9ce7('0x42')](handleError(_0x5e3aaf,null));};exports[_0x9ce7('0x43')]=function(_0x2007bf,_0x4a4922){var _0x501658={'raw':![],'where':{'id':_0x2007bf[_0x9ce7('0x44')]['id']}},_0x5211bf={};_0x5211bf[_0x9ce7('0x30')]=_[_0x9ce7('0x32')](db[_0x9ce7('0x3e')][_0x9ce7('0x2d')]);_0x5211bf[_0x9ce7('0x31')]=_['keys'](_0x2007bf['query']);_0x5211bf[_0x9ce7('0x33')]=_['intersection'](_0x5211bf[_0x9ce7('0x30')],_0x5211bf[_0x9ce7('0x31')]);_0x501658[_0x9ce7('0x35')]=_[_0x9ce7('0x34')](_0x5211bf[_0x9ce7('0x30')],qs['fields'](_0x2007bf[_0x9ce7('0x31')]['fields']));_0x501658[_0x9ce7('0x35')]=_0x501658[_0x9ce7('0x35')]['length']?_0x501658[_0x9ce7('0x35')]:_0x5211bf['model'];if(_0x2007bf['query'][_0x9ce7('0x3f')]){_0x501658[_0x9ce7('0x40')]=[{'all':!![]}];}_0x501658=_[_0x9ce7('0x45')]({},_0x501658,_0x2007bf[_0x9ce7('0x46')]);return db[_0x9ce7('0x3e')]['find'](_0x501658)[_0x9ce7('0x26')](handleEntityNotFound(_0x4a4922,null))[_0x9ce7('0x26')](respondWithResult(_0x4a4922,null))[_0x9ce7('0x42')](handleError(_0x4a4922,null));};exports[_0x9ce7('0x47')]=function(_0xc5ecc4,_0x2dcaac){return db[_0x9ce7('0x3e')]['create'](_0xc5ecc4[_0x9ce7('0x48')],{})['then'](respondWithResult(_0x2dcaac,0xc9))[_0x9ce7('0x42')](handleError(_0x2dcaac,null));};exports[_0x9ce7('0x49')]=function(_0x39c40d,_0x30ce57){var _0x40444a={'where':{'id':_0x39c40d[_0x9ce7('0x44')]['id']}},_0x26f1f3={};_0x26f1f3[_0x9ce7('0x30')]=_[_0x9ce7('0x32')](db['UserProfile']['rawAttributes']);_0x40444a[_0x9ce7('0x35')]=_[_0x9ce7('0x34')](_0x26f1f3['model'],qs[_0x9ce7('0x36')](_0x39c40d['query'][_0x9ce7('0x36')]));_0x40444a[_0x9ce7('0x35')]=_0x40444a[_0x9ce7('0x35')][_0x9ce7('0x37')]?_0x40444a[_0x9ce7('0x35')]:_0x26f1f3[_0x9ce7('0x30')];if(_0x39c40d[_0x9ce7('0x31')][_0x9ce7('0x3f')]){_0x40444a[_0x9ce7('0x40')]=[{'all':!![]}];}_0x40444a=_[_0x9ce7('0x45')]({},_0x40444a,_0x39c40d[_0x9ce7('0x46')]);return db[_0x9ce7('0x3e')][_0x9ce7('0x4a')](_0x40444a)[_0x9ce7('0x26')](handleEntityNotFound(_0x30ce57,null))[_0x9ce7('0x26')](function(_0x491f65){if(_0x491f65){var _0xd05659=_0x491f65[_0x9ce7('0x4b')]({'plain':!![]});_0xd05659=qs['omit'](_0xd05659,['id',_0x9ce7('0x4c'),'updatedAt',_0x9ce7('0x4d')]);_0x39c40d[_0x9ce7('0x48')]=_[_0x9ce7('0x4e')](_0x39c40d[_0x9ce7('0x48')],['id','createdAt',_0x9ce7('0x4f')]);return db['sequelize'][_0x9ce7('0x50')](function(_0x3c19fa){return db[_0x9ce7('0x3e')][_0x9ce7('0x47')](_[_0x9ce7('0x45')](_0xd05659,_0x39c40d[_0x9ce7('0x48')]),{'include':_0x39c40d[_0x9ce7('0x31')][_0x9ce7('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x3c19fa})['then'](function(_0x34f1d0){var _0x2545cc=_0x34f1d0['get']({'plain':!![]});return db[_0x9ce7('0x51')][_0x9ce7('0x41')]({'where':{'userProfileId':_0x39c40d[_0x9ce7('0x44')]['id']},'raw':!![]})['then'](function(_0x5b4a1c){if(_0x5b4a1c){return BPromise[_0x9ce7('0x52')](_0x5b4a1c,function(_0x19c515){return new BPromise(function(_0x1d99fe,_0x5c2b2a){if(_0x19c515[_0x9ce7('0x53')]===null||_0x19c515['autoAssociation']===0x1)_0x1d99fe(null);return db['UserProfileResource'][_0x9ce7('0x41')]({'where':{'sectionId':_0x19c515['id']},'raw':!![]})['then'](function(_0x246363){var _0x552d46=_['map'](_0x246363,function(_0x18061a){return qs['omit'](_0x18061a,['id',_0x9ce7('0x4c'),_0x9ce7('0x4f'),_0x9ce7('0x54')]);});_0x1d99fe(_0x552d46);})[_0x9ce7('0x42')](function(_0x25f094){_0x5c2b2a(_0x25f094);});})[_0x9ce7('0x26')](function(_0x1d12a9){var _0x336a2d=qs[_0x9ce7('0x4e')](_0x19c515,['id',_0x9ce7('0x4c'),_0x9ce7('0x4f')]);_0x336a2d[_0x9ce7('0x55')]=_0x2545cc['id'];if(_0x1d12a9)_0x336a2d['Resources']=_0x1d12a9;return _0x336a2d;})['then'](function(_0x325f5c){return db[_0x9ce7('0x51')][_0x9ce7('0x47')](_0x325f5c,{'include':[{'model':db[_0x9ce7('0x56')],'as':_0x9ce7('0x57')}],'raw':!![],'transaction':_0x3c19fa});});})[_0x9ce7('0x26')](function(){return _0x2545cc;});}});});});}})[_0x9ce7('0x26')](respondWithResult(_0x30ce57,0xc9))[_0x9ce7('0x42')](handleError(_0x30ce57,null));};exports[_0x9ce7('0x25')]=function(_0x3b3efc,_0x28c4b0){if(_0x3b3efc[_0x9ce7('0x48')]['id']){delete _0x3b3efc['body']['id'];}return db['UserProfile'][_0x9ce7('0x4a')]({'where':{'id':_0x3b3efc[_0x9ce7('0x44')]['id']}})[_0x9ce7('0x26')](handleEntityNotFound(_0x28c4b0,null))[_0x9ce7('0x26')](saveUpdates(_0x3b3efc[_0x9ce7('0x48')],null))[_0x9ce7('0x26')](respondWithResult(_0x28c4b0,null))[_0x9ce7('0x42')](handleError(_0x28c4b0,null));};exports[_0x9ce7('0x27')]=function(_0x5111a2,_0x109b84){return db['UserProfile']['find']({'where':{'id':_0x5111a2[_0x9ce7('0x44')]['id']}})[_0x9ce7('0x26')](handleEntityNotFound(_0x109b84,null))['then'](removeEntity(_0x109b84,null))[_0x9ce7('0x42')](handleError(_0x109b84,null));};exports[_0x9ce7('0x58')]=function(_0x4445e0,_0x335356){return db[_0x9ce7('0x3e')][_0x9ce7('0x58')]()[_0x9ce7('0x26')](respondWithResult(_0x335356,null))[_0x9ce7('0x42')](handleError(_0x335356,null));};exports['addSections']=function(_0xee4ae1,_0x566a87){var _0x2aa712=_0xee4ae1[_0x9ce7('0x48')];return db[_0x9ce7('0x3e')]['find']({'where':{'id':_0xee4ae1[_0x9ce7('0x44')]['id']}})[_0x9ce7('0x26')](handleEntityNotFound(_0x566a87,null))[_0x9ce7('0x26')](function(_0x35959f){if(_0x35959f){return db[_0x9ce7('0x59')][_0x9ce7('0x50')](function(_0x54d793){return db[_0x9ce7('0x51')][_0x9ce7('0x27')]({'where':{'userProfileId':_0xee4ae1[_0x9ce7('0x44')]['id'],'sectionId':_['map'](_0x2aa712,function(_0x43f531){return _0x43f531[_0x9ce7('0x54')];})},'transaction':_0x54d793})['then'](function(){var _0x26cad8=_[_0x9ce7('0x2c')](_0x2aa712,function(_0x463d50){_0x463d50[_0x9ce7('0x55')]=_0xee4ae1[_0x9ce7('0x44')]['id'];return _0x463d50;});var _0x511a5b=[];return BPromise['each'](_0x26cad8,function(_0x2228c2){return db[_0x9ce7('0x51')][_0x9ce7('0x47')](_0x2228c2,{'include':[{'model':db[_0x9ce7('0x56')],'as':_0x9ce7('0x57')}],'raw':!![],'transaction':_0x54d793})[_0x9ce7('0x26')](function(_0x3a17f3){_0x511a5b[_0x9ce7('0x5a')](_0x3a17f3['get']({'plain':!![]}));});})['then'](function(){return _0x511a5b;});});});}})['then'](function(_0x55db78){return _0x55db78;})['then'](respondWithResult(_0x566a87,null))[_0x9ce7('0x42')](handleError(_0x566a87,null));};exports[_0x9ce7('0x5b')]=function(_0x5c935d,_0x5cdefd){var _0x23f338;return db['UserProfile'][_0x9ce7('0x4a')]({'where':{'id':_0x5c935d[_0x9ce7('0x44')]['id']},'attributes':['id',_0x9ce7('0x2a')]})['then'](handleEntityNotFound(_0x5cdefd,null))['then'](function(_0x3f37f3){if(_0x3f37f3){_0x23f338=_0x3f37f3;return db[_0x9ce7('0x51')][_0x9ce7('0x27')]({'where':{'userProfileId':_0x5c935d[_0x9ce7('0x44')]['id'],'sectionId':_0x5c935d[_0x9ce7('0x31')]['ids']}});}})[_0x9ce7('0x26')](function(){return _0x23f338;})[_0x9ce7('0x26')](respondWithStatusCode(_0x5cdefd,null))[_0x9ce7('0x42')](handleError(_0x5cdefd,null));};exports['getSections']=function(_0x2b9bfd,_0x5983a5){var _0x269edd=[];var _0x1ef6aa=[];return db[_0x9ce7('0x51')][_0x9ce7('0x41')]({'where':{'userProfileId':_0x2b9bfd[_0x9ce7('0x44')]['id']},'raw':!![]})[_0x9ce7('0x26')](function(_0xce1b2){_0x269edd=_[_0x9ce7('0x3d')](_0xce1b2,function(_0x4a1675){return _0x4a1675[_0x9ce7('0x5c')]===0x1||_[_0x9ce7('0x5d')]([0x3eb,0x709],_0x4a1675['sectionId']);});if(!_[_0x9ce7('0x5e')](_0x269edd)){return _[_0x9ce7('0x2c')](_0x269edd,function(_0x58fd00){return _0x58fd00[_0x9ce7('0x54')];});}else{return;}})[_0x9ce7('0x26')](function(_0x1aa419){if(_0x1aa419)_0x1ef6aa=_0x1aa419;if(_[_0x9ce7('0x5d')](_0x1ef6aa,0x64)){var _0x363f4a=_[_0x9ce7('0x4a')](_0x269edd,{'sectionId':0x64});return hasDefaultDashboard(_0x363f4a)[_0x9ce7('0x26')](function(_0xd0cc4f){return _[_0x9ce7('0x2c')](_0x269edd,function(_0x24c588){if(_0x24c588[_0x9ce7('0x54')]===0x64){_0x24c588['subsections']=_0xd0cc4f;}return _0x24c588;});});}else{return;}})[_0x9ce7('0x26')](function(_0x308967){if(_0x308967)_0x269edd=_0x308967;if(_[_0x9ce7('0x5d')](_0x1ef6aa,0x3eb)){var _0xd1d22b=_['find'](_0x269edd,{'sectionId':0x3eb});return getCustomDashboards(_0xd1d22b)[_0x9ce7('0x26')](function(_0x305cac){return _[_0x9ce7('0x2c')](_0x269edd,function(_0x39b03d){if(_0xd1d22b[_0x9ce7('0x5c')]){if(_0x39b03d[_0x9ce7('0x54')]===0x3eb){_0x39b03d['subsections']=_0x305cac;}}else{if(_0x39b03d[_0x9ce7('0x54')]===0x64){_0x39b03d['subsections']=_0x305cac;}}return _0x39b03d;});});}else{return;}})[_0x9ce7('0x26')](function(_0x2f6748){if(_0x2f6748)_0x269edd=_0x2f6748;if(_[_0x9ce7('0x5d')](_0x1ef6aa,0x709)){var _0x298ceb=_[_0x9ce7('0x4a')](_0x269edd,{'sectionId':0x709});return getPlugins(_0x298ceb)[_0x9ce7('0x26')](function(_0x14970c){if(_0x298ceb[_0x9ce7('0x5c')]){return _[_0x9ce7('0x2c')](_0x269edd,function(_0x5f36df){if(_0x5f36df[_0x9ce7('0x54')]===0x709){_0x5f36df['subsections']=_0x14970c;}return _0x5f36df;});}else{var _0x270fd8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x14970c};var _0x8442c8=_[_0x9ce7('0x2c')](_0x269edd);_0x8442c8[_0x9ce7('0x5a')](_0x270fd8);return _0x8442c8;}});}else{return;}})[_0x9ce7('0x26')](function(_0x2ce39d){if(_0x2ce39d)_0x269edd=_0x2ce39d;return _['filter'](_0x269edd,['enabled',0x1]);})[_0x9ce7('0x26')](respondWithResult(_0x5983a5,null))[_0x9ce7('0x42')](handleError(_0x5983a5,null));};function hasDefaultDashboard(_0x4ac0ad){var _0x4d0ad3=[0x65];return new BPromise(function(_0x395d6a,_0x4549b5){try{if(_0x4ac0ad['autoAssociation']){_0x395d6a(_0x4d0ad3);}else{return db[_0x9ce7('0x56')][_0x9ce7('0x5f')]({'where':{'sectionId':_0x4ac0ad['id']},'raw':!![]})[_0x9ce7('0x26')](function(_0x423dba){_0x423dba?_0x395d6a(_0x4d0ad3):_0x395d6a();});}}catch(_0x117bd6){_0x4549b5(_0x117bd6);}});}function getCustomDashboards(_0x548bf4){var _0x5d8005=[];return new BPromise(function(_0x1fd9c1,_0x4676a7){try{if(_0x548bf4['autoAssociation']){return db['Dashboard'][_0x9ce7('0x41')]({'raw':!![]})[_0x9ce7('0x26')](function(_0x44d473){_0x44d473[_0x9ce7('0x60')](function(_0x918df6){_0x5d8005['push'](_0x918df6['id']+0x1869f);});_0x1fd9c1(_0x5d8005);});}else{return db[_0x9ce7('0x56')][_0x9ce7('0x41')]({'where':{'sectionId':_0x548bf4['id']},'raw':!![]})[_0x9ce7('0x26')](function(_0x128394){_0x128394[_0x9ce7('0x60')](function(_0x358178){_0x5d8005[_0x9ce7('0x5a')](_0x358178[_0x9ce7('0x61')]+0x1869f);});_0x1fd9c1(_0x5d8005);});}}catch(_0x4cd17d){_0x4676a7(_0x4cd17d);}});}function getPlugins(_0x5dabb7){var _0x3e0e9c=[];return new BPromise(function(_0x33324b,_0xd3ae60){try{if(_0x5dabb7[_0x9ce7('0x53')]){return db[_0x9ce7('0x62')][_0x9ce7('0x41')]({'raw':!![]})[_0x9ce7('0x26')](function(_0x3c6131){_0x3c6131[_0x9ce7('0x60')](function(_0x4b9db2){_0x3e0e9c[_0x9ce7('0x5a')](_0x4b9db2['id']+0x15b38);});_0x33324b(_0x3e0e9c);});}else{return db[_0x9ce7('0x56')][_0x9ce7('0x41')]({'where':{'sectionId':_0x5dabb7['id']},'raw':!![]})[_0x9ce7('0x26')](function(_0x271050){_0x271050[_0x9ce7('0x60')](function(_0x489c87){_0x3e0e9c[_0x9ce7('0x5a')](_0x489c87['resourceId']+0x15b38);});_0x33324b(_0x3e0e9c);});}}catch(_0x32ea52){_0xd3ae60(_0x32ea52);}});}exports['addResources']=function(_0x4ddd00,_0x2f0101){return db[_0x9ce7('0x3e')][_0x9ce7('0x4a')]({'where':{'id':_0x4ddd00['params']['id']}})['then'](handleEntityNotFound(_0x2f0101,null))[_0x9ce7('0x26')](function(_0x30bb53){if(_0x30bb53){return db['sequelize'][_0x9ce7('0x50')](function(_0x4d764b){return db[_0x9ce7('0x51')]['findAll']({'where':{'userProfileId':_0x4ddd00['params']['id']},'attributes':['id'],'raw':!![]})[_0x9ce7('0x26')](function(_0xcc0c6e){if(_0xcc0c6e){return db[_0x9ce7('0x51')]['destroy']({'where':{'userProfileId':_0x4ddd00['params']['id'],'id':_[_0x9ce7('0x2c')](_0xcc0c6e,function(_0x20fe49){return _0x20fe49['id'];})},'transaction':_0x4d764b});}})[_0x9ce7('0x26')](function(_0x3a9a00){var _0x3ee564=_[_0x9ce7('0x2c')](_0x4ddd00['body'],function(_0x408573){_0x408573[_0x9ce7('0x55')]=_0x4ddd00[_0x9ce7('0x44')]['id'];return _0x408573;});return db['UserProfileSection'][_0x9ce7('0x63')](_0x3ee564,{'raw':!![],'transaction':_0x4d764b});})[_0x9ce7('0x26')](function(_0x465080){var _0x511f06=_[_0x9ce7('0x3d')](_[_0x9ce7('0x2c')](_0x465080,function(_0xd316ee){return _0xd316ee[_0x9ce7('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x511f06){return db[_0x9ce7('0x51')]['findAll']({'where':{'userProfileId':_0x4ddd00[_0x9ce7('0x44')]['id'],'sectionId':_['map'](_0x511f06,function(_0x437c77){return _0x437c77[_0x9ce7('0x54')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x9ce7('0x26')](function(_0x32c17e){var _0x4ba344=_['map'](_0x4ddd00[_0x9ce7('0x48')],function(_0x4e3e8e){_0x4e3e8e[_0x9ce7('0x55')]=_0x4ddd00['params']['id'];return _0x4e3e8e;});return db[_0x9ce7('0x56')]['bulkCreate'](_0x4ba344,{'raw':!![],'transaction':_0x4d764b});});}})[_0x9ce7('0x42')](handleError(_0x2f0101,null));});}})[_0x9ce7('0x26')](function(_0x87fbe3){var _0x4ba312=_[_0x9ce7('0x2c')](_0x87fbe3,function(_0x3b2b86){return _0x3b2b86[_0x9ce7('0x4b')]({'plain':!![]});});})[_0x9ce7('0x26')](respondWithResult(_0x2f0101,null))['catch'](handleError(_0x2f0101,null));};exports[_0x9ce7('0x64')]=function(_0x533ce6,_0x178e6c,_0x40d57d){return db['UserProfile']['find']({'where':{'id':_0x533ce6[_0x9ce7('0x44')]['id']}})['then'](handleEntityNotFound(_0x178e6c,null))[_0x9ce7('0x26')](function(_0x521f1b){if(_0x521f1b){return _0x521f1b[_0x9ce7('0x64')](_0x533ce6['query'][_0x9ce7('0x65')]);}})[_0x9ce7('0x26')](respondWithStatusCode(_0x178e6c,null))[_0x9ce7('0x42')](handleError(_0x178e6c,null));};exports[_0x9ce7('0x66')]=function(_0xc70727,_0x517d71){var _0x54605f={'raw':![],'where':{}};var _0x23de83={};var _0xb2571b={'count':0x0,'rows':[]};var _0x241c4d=_0xc70727['query']['section'];if(typeof _0x241c4d===_0x9ce7('0x67')){throw new db[(_0x9ce7('0x68'))][(_0x9ce7('0x69'))](_0x9ce7('0x6a'));}var _0x4ffac5=_0xc70727[_0x9ce7('0x31')]['mergeResources']||![];var _0x2f62aa=getQueryModels(_0x241c4d,_0x4ffac5);if(typeof _0x2f62aa[_0x9ce7('0x6b')]===_0x9ce7('0x67')){throw new db[(_0x9ce7('0x68'))][(_0x9ce7('0x69'))](_0x9ce7('0x6c')+_0x241c4d+'\x27');}var _0x10f2f9=[];if(!_[_0x9ce7('0x5e')](_0x2f62aa[_0x9ce7('0x6d')])){_0x10f2f9=_0x2f62aa[_0x9ce7('0x6d')];}else{_0x10f2f9=[{'name':_0x241c4d}];}return db[_0x9ce7('0x3e')][_0x9ce7('0x5f')]({'where':{'id':_0xc70727[_0x9ce7('0x44')]['id']}})[_0x9ce7('0x26')](handleEntityNotFound(_0x517d71,null))[_0x9ce7('0x26')](function(_0x383734){if(_0x383734){var _0x4adad0=[];for(var _0xa71f66=0x0;_0xa71f66<_0x10f2f9[_0x9ce7('0x37')];_0xa71f66++){_0x4adad0[_0x9ce7('0x5a')](db[_0x9ce7('0x51')][_0x9ce7('0x5f')]({'where':{'userProfileId':_0x383734['id'],'name':_0x10f2f9[_0xa71f66]['name']},'raw':!![]}));}return BPromise['all'](_0x4adad0);}})[_0x9ce7('0x26')](function(_0x24a27c){var _0x26550d=_[_0x9ce7('0x3d')](_0x24a27c,function(_0x1f007f){return _0x1f007f?_0x1f007f:undefined;});var _0x1d9009=_[_0x9ce7('0x3d')](_0x10f2f9,['ignore',!![]]);var _0x49fac6=_['isEmpty'](_0x26550d)&&_[_0x9ce7('0x5e')](_0x1d9009)?null:_[_0x9ce7('0x6e')](_0x1d9009,_0x26550d);if(_0x49fac6){var _0x4bceb4=[];for(var _0x47d5f4=0x0;_0x47d5f4<_0x49fac6[_0x9ce7('0x37')];_0x47d5f4++){var _0x3c3eea=_[_0x9ce7('0x4a')](_0x10f2f9,function(_0x456431){return _0x49fac6[_0x47d5f4]?_0x456431['name']===_0x49fac6[_0x47d5f4][_0x9ce7('0x2a')]:null;});if(_0x3c3eea){if(_0x49fac6[_0x47d5f4]['ignore']){_0x4bceb4[_0x9ce7('0x5a')](getAllResources(_0x2f62aa['childModel'],_0x49fac6[_0x47d5f4]));}else{if(!_0x49fac6[_0x47d5f4][_0x9ce7('0x53')]){_0x4bceb4[_0x9ce7('0x5a')](getAllowedResources(_0x3c3eea,_0x49fac6[_0x47d5f4],_0x2f62aa[_0x9ce7('0x6b')]));}else{if(_0x3c3eea[_0x9ce7('0x30')]){_0x4bceb4['push'](getAllFilteredResources(_0x3c3eea,_0x49fac6[_0x47d5f4]));}}}}}return BPromise[_0x9ce7('0x6f')](_0x4bceb4);}else{return null;}})[_0x9ce7('0x26')](function(_0x23e866){var _0x2ad4ee=_0x23e866;var _0x5e95a5=null;if(_0x2ad4ee){_0x5e95a5=_0x2ad4ee[_0x9ce7('0x37')]===0x1?_0x2ad4ee[0x0]:null;}if(_0x5e95a5||_0x2ad4ee){var _0x2a67c8=db[_0x2f62aa[_0x9ce7('0x6b')]]['rawAttributes'];_0x23de83['model']=_[_0x9ce7('0x32')](_0x2a67c8);_0x23de83[_0x9ce7('0x31')]=_[_0x9ce7('0x32')](_0xc70727[_0x9ce7('0x31')]);_0x23de83[_0x9ce7('0x33')]=_['intersection'](_0x23de83['model'],_0x23de83[_0x9ce7('0x31')]);_0x54605f[_0x9ce7('0x35')]=_[_0x9ce7('0x34')](_0x23de83[_0x9ce7('0x30')],qs['fields'](_0xc70727[_0x9ce7('0x31')][_0x9ce7('0x36')]));_0x54605f[_0x9ce7('0x35')]=_0x54605f[_0x9ce7('0x35')][_0x9ce7('0x37')]?_0x54605f[_0x9ce7('0x35')]:_0x23de83[_0x9ce7('0x30')];if(!_0xc70727['query']['hasOwnProperty'](_0x9ce7('0x39'))){_0x54605f[_0x9ce7('0x21')]=qs[_0x9ce7('0x21')](_0xc70727['query'][_0x9ce7('0x21')]);_0x54605f[_0x9ce7('0x20')]=qs[_0x9ce7('0x20')](_0xc70727[_0x9ce7('0x31')][_0x9ce7('0x20')]);}_0x54605f[_0x9ce7('0x3a')]=qs[_0x9ce7('0x3b')](_0xc70727[_0x9ce7('0x31')][_0x9ce7('0x3b')]);_0x54605f[_0x9ce7('0x3c')]=qs[_0x9ce7('0x33')](_['pick'](_0xc70727[_0x9ce7('0x31')],_0x23de83[_0x9ce7('0x33')]));if(_0xc70727[_0x9ce7('0x31')][_0x9ce7('0x3d')]){_0x54605f[_0x9ce7('0x3c')]=_[_0x9ce7('0x45')](_0x54605f[_0x9ce7('0x3c')],{'$or':_[_0x9ce7('0x2c')](_0x2a67c8,function(_0x450415){if(_0x450415['type'][_0x9ce7('0x2f')]!==_0x9ce7('0x70')){var _0x1b4829={};_0x1b4829[_0x450415[_0x9ce7('0x71')]]={'$like':'%'+_0xc70727['query'][_0x9ce7('0x3d')]+'%'};return _0x1b4829;}})});}var _0x6e4648=[];if(_0x5e95a5){var _0x386d87=_[_0x9ce7('0x4a')](_0x10f2f9,[_0x9ce7('0x2a'),_0x5e95a5[_0x9ce7('0x2a')]]);if(_0x386d87[_0x9ce7('0x71')]){var _0x1a56e9={};if(_0x2f62aa[_0x9ce7('0x6b')]===_0x9ce7('0x72')){_0x1a56e9[_0x386d87[_0x9ce7('0x73')]]=_[_0x9ce7('0x2c')](_0x5e95a5[_0x9ce7('0x74')],'id');}else{_0x1a56e9[_0x386d87[_0x9ce7('0x73')]]=_0x5e95a5[_0x9ce7('0x74')];}_0x6e4648[_0x9ce7('0x5a')](_0x1a56e9);}else{_0x54605f[_0x9ce7('0x3c')]['id']=_0x5e95a5[_0x9ce7('0x74')];}}else{for(var _0x31b1d0=0x0;_0x31b1d0<_0x2ad4ee[_0x9ce7('0x37')];_0x31b1d0++){var _0x386d87=_[_0x9ce7('0x4a')](_0x10f2f9,[_0x9ce7('0x2a'),_0x2ad4ee[_0x31b1d0]['name']]);if(_0x386d87['field']){var _0x1a56e9={};_0x1a56e9[_0x386d87[_0x9ce7('0x73')]]=_0x2ad4ee[_0x31b1d0]['associatedResources'];_0x6e4648[_0x9ce7('0x5a')](_0x1a56e9);}else{if(!_0x54605f[_0x9ce7('0x3c')]['id'])_0x54605f[_0x9ce7('0x3c')]['id']=[];_0x2ad4ee[_0x31b1d0][_0x9ce7('0x74')][_0x9ce7('0x60')](function(_0x1661d7){_0x54605f[_0x9ce7('0x3c')]['id'][_0x9ce7('0x5a')](_0x1661d7);});}}}if(!_['isEmpty'](_0x6e4648)){_0x54605f[_0x9ce7('0x3c')]=_[_0x9ce7('0x45')](_0x54605f['where'],{'$and':{'$or':_0x6e4648}});}_0x54605f=_['merge']({},_0x54605f,_0xc70727['options']);if(_0x5e95a5&&!_0x5e95a5[_0x9ce7('0x53')]&&_0x2f62aa[_0x9ce7('0x6b')]===_0x9ce7('0x72')){if(_0xc70727[_0x9ce7('0x31')][_0x9ce7('0x3f')]){_0x54605f['include']=[{'all':!![]}];}return db[_0x2f62aa[_0x9ce7('0x6b')]]['findAll'](_0x54605f)[_0x9ce7('0x26')](function(_0xd22a7b){var _0x368b74=[];_0xd22a7b['forEach'](function(_0x14859c){var _0x2284ba;switch(_0x14859c[_0x9ce7('0x75')]){case _0x9ce7('0x76'):_0x2284ba=_[_0x9ce7('0x4a')](_0x5e95a5[_0x9ce7('0x74')],function(_0x35a76d){return _0x35a76d['id']===_0x14859c[_0x9ce7('0x77')]&&_0x35a76d[_0x9ce7('0x2e')]==='DefaultReports';});break;case _0x9ce7('0x78'):_0x2284ba=_[_0x9ce7('0x4a')](_0x5e95a5[_0x9ce7('0x74')],function(_0x51ab0c){return _0x51ab0c['id']===_0x14859c['reportId']&&_0x51ab0c[_0x9ce7('0x2e')]===_0x9ce7('0x79');});break;}if(_0x2284ba)_0x368b74['push'](_0x14859c);});_0xb2571b['count']=_0x368b74[_0x9ce7('0x37')];_0xb2571b[_0x9ce7('0x7a')]=_0x368b74;return _0xb2571b;});}else{return db[_0x2f62aa[_0x9ce7('0x6b')]][_0x9ce7('0x1f')]({'where':_0x54605f[_0x9ce7('0x3c')]})[_0x9ce7('0x26')](function(_0x5ba631){_0xb2571b['count']=_0x5ba631;if(_0xc70727['query'][_0x9ce7('0x3f')]){if(_0x2f62aa[_0x9ce7('0x6b')]===_0x9ce7('0x7b')){_0x54605f[_0x9ce7('0x40')]=[{'model':db['Tag'],'as':_0x9ce7('0x7c'),'attributes':['id',_0x9ce7('0x2a'),'color'],'required':_0xc70727[_0x9ce7('0x31')]['tag']?!![]:![]},{'model':db['Tag'],'as':_0x9ce7('0x7d'),'attributes':['id',_0x9ce7('0x2a'),'color'],'through':_0xc70727[_0x9ce7('0x31')][_0x9ce7('0x7e')]?{'attributes':[],'where':{'TagId':_0xc70727[_0x9ce7('0x31')][_0x9ce7('0x7e')]||undefined}}:{},'required':_0xc70727[_0x9ce7('0x31')][_0x9ce7('0x7e')]?!![]:![]}];}else{_0x54605f[_0x9ce7('0x40')]=[{'all':!![]}];}}return db[_0x2f62aa[_0x9ce7('0x6b')]]['findAll'](_0x54605f);})[_0x9ce7('0x26')](function(_0x49c7e6){_0xb2571b[_0x9ce7('0x7a')]=_0x49c7e6;return _0xb2571b;});}}else{return _0xb2571b;}})[_0x9ce7('0x26')](respondWithFilteredResult(_0x517d71,_0x54605f))[_0x9ce7('0x42')](handleError(_0x517d71,null));};function getAllResources(_0x2bc32d,_0x2a358b){return new BPromise(function(_0x23c543,_0x451ee4){if(_0x2a358b){var _0x4fb8fc=_0x2a358b['filter']?{[_0x2a358b[_0x9ce7('0x3d')]['field']]:_0x2a358b[_0x9ce7('0x3d')][_0x9ce7('0x7f')]}:undefined;return db[_0x2bc32d]['findAll']({'where':_0x4fb8fc,'raw':!![]})['then'](function(_0x4aa57b){_0x2a358b[_0x9ce7('0x74')]=_[_0x9ce7('0x2c')](_0x4aa57b,'id');_0x23c543(_0x2a358b);})['catch'](function(_0x500ebe){_0x451ee4(_0x500ebe);});}else{_0x23c543(null);}});}function getAllFilteredResources(_0x41e469,_0x1be8d8){return new BPromise(function(_0x1ea4e7,_0x2936d3){var _0x6131f7=_0x41e469['filter']?{[_0x41e469[_0x9ce7('0x3d')][_0x9ce7('0x71')]]:_0x41e469[_0x9ce7('0x3d')][_0x9ce7('0x7f')]}:undefined;return db[_0x41e469[_0x9ce7('0x30')]]['findAll']({'where':_0x6131f7,'raw':!![]})['then'](function(_0x2299c1){_0x1be8d8[_0x9ce7('0x74')]=_['map'](_0x2299c1,function(_0x2d2ec5){return _0x2d2ec5['name'];});_0x1ea4e7(_0x1be8d8);})[_0x9ce7('0x42')](function(_0x3d149d){_0x2936d3(_0x3d149d);});});}function getAllowedResources(_0x135c21,_0x5ec887,_0x3255ce){return new BPromise(function(_0x13a3f8,_0xcd09fe){if(_0x5ec887){return db[_0x9ce7('0x56')][_0x9ce7('0x41')]({'where':{'sectionId':_0x5ec887['id']},'raw':!![]})[_0x9ce7('0x26')](function(_0x1cae66){if(_0x135c21[_0x9ce7('0x71')]&&_0x135c21[_0x9ce7('0x71')]!=='id'){_0x5ec887[_0x9ce7('0x74')]=_[_0x9ce7('0x2c')](_0x1cae66,function(_0x17d21c){return _0x17d21c[_0x135c21[_0x9ce7('0x71')]];});}else{if(_0x3255ce===_0x9ce7('0x72')){_0x5ec887['associatedResources']=_[_0x9ce7('0x2c')](_0x1cae66,function(_0x452ce6){return{'id':_0x452ce6[_0x9ce7('0x61')],'type':_0x452ce6[_0x9ce7('0x2e')]};});}else{_0x5ec887['associatedResources']=_['map'](_0x1cae66,function(_0x2f1913){return _0x2f1913[_0x9ce7('0x61')];});}}_0x13a3f8(_0x5ec887);})[_0x9ce7('0x42')](function(_0x19722){_0xcd09fe(_0x19722);});}else{_0x13a3f8(null);}});}function getQueryModels(_0x370410,_0xf4428){var _0x1f7230=_0x370410[_0x9ce7('0x80')]();var _0x3267ab={'childModel':undefined,'parentSections':[]};switch(_0x1f7230){case'squareprojects':_0x3267ab[_0x9ce7('0x6b')]='SquareProject';break;case _0x9ce7('0x81'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0x82');break;case _0x9ce7('0x83'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0x84');_0x3267ab[_0x9ce7('0x6d')]=[{'name':'SquareProjects','field':_0x9ce7('0x2a'),'foreignKey':_0x9ce7('0x85')}];break;case'projects':_0x3267ab['childModel']=_0x9ce7('0x86');break;case'contacts':_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0x7b');_0x3267ab[_0x9ce7('0x6d')]=[{'name':_0x9ce7('0x87'),'field':'id','foreignKey':_0x9ce7('0x88')}];break;case _0x9ce7('0x89'):_0x3267ab[_0x9ce7('0x6b')]='CmList';break;case _0x9ce7('0x8a'):_0x3267ab[_0x9ce7('0x6b')]='CmCompany';break;case'globalcustomfields':_0x3267ab[_0x9ce7('0x6b')]='CmCustomField';break;case _0x9ce7('0x8b'):_0x3267ab[_0x9ce7('0x6b')]='ChatQueue';break;case'chatwebsites':_0x3267ab['childModel']='ChatWebsite';break;case _0x9ce7('0x8c'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0x8d');break;case _0x9ce7('0x8e'):_0x3267ab[_0x9ce7('0x6b')]='FaxAccount';break;case _0x9ce7('0x8f'):case _0x9ce7('0x90'):case'outboundroutes':_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0x91');break;case _0x9ce7('0x92'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0x93');break;case _0x9ce7('0x94'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0x95');break;case _0x9ce7('0x96'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0x97');_0x3267ab['parentSections']=[{'name':_0x9ce7('0x98'),'field':_0x9ce7('0x2a'),'foreignKey':'membername','model':_0x9ce7('0x99'),'filter':{'field':_0x9ce7('0x9a'),'value':['agent']}},{'name':_0x9ce7('0x9b'),'field':_0x9ce7('0x2a'),'foreignKey':_0x9ce7('0x9c'),'model':_0x9ce7('0x99'),'filter':{'field':_0x9ce7('0x9a'),'value':['telephone']}},{'name':_0x9ce7('0x9d'),'field':_0x9ce7('0x2a'),'foreignKey':_0x9ce7('0x9e'),'model':_0x9ce7('0x9f'),'filter':{'field':_0x9ce7('0x2e'),'value':[_0x9ce7('0xa0')]}},{'name':_0x9ce7('0xa1'),'field':_0x9ce7('0x2a'),'foreignKey':_0x9ce7('0x9e'),'model':'VoiceQueue','filter':{'field':_0x9ce7('0x2e'),'value':[_0x9ce7('0xa2')]}}];break;case'musiconholds':_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xa3');break;case'chanspies':_0x3267ab['childModel']='VoiceChanSpy';break;case _0x9ce7('0xa4'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xa5');break;case'ivrcampaigns':_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xa6');break;case _0x9ce7('0xa7'):_0x3267ab['childModel']=_0x9ce7('0xa8');break;case'mailaccounts':_0x3267ab[_0x9ce7('0x6b')]='MailAccount';break;case'mailsubstatuses':_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xa9');break;case _0x9ce7('0xaa'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xab');break;case _0x9ce7('0xac'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xad');break;case'smsqueues':_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xae');break;case _0x9ce7('0xaf'):_0x3267ab[_0x9ce7('0x6b')]='SmsAccount';break;case _0x9ce7('0xb0'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xb1');break;case'whatsappaccounts':_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xb2');break;case _0x9ce7('0xb3'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xb4');break;case _0x9ce7('0xb5'):case _0x9ce7('0xb6'):_0x3267ab[_0x9ce7('0x6b')]='VoiceQueue';if(_0xf4428){_0x3267ab['parentSections']=[{'name':_0x9ce7('0x9d')},{'name':_0x9ce7('0xa1')}];}break;case _0x9ce7('0xb7'):case'agents':case'telephones':_0x3267ab['childModel']=_0x9ce7('0x99');if(_0xf4428){_0x3267ab[_0x9ce7('0x6d')]=[{'name':_0x9ce7('0xb8'),'filter':{'field':_0x9ce7('0x9a'),'value':[_0x9ce7('0xb9'),'user']},'ignore':!![]},{'name':_0x9ce7('0x98')},{'name':_0x9ce7('0x9b')}];}break;case _0x9ce7('0xba'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xbb');break;case'salesforceaccounts':_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xbc');break;case _0x9ce7('0xbd'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xbe');break;case _0x9ce7('0xbf'):_0x3267ab['childModel']=_0x9ce7('0xc0');break;case _0x9ce7('0xc1'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xc2');break;case _0x9ce7('0xc3'):_0x3267ab['childModel']='ZohoAccount';break;case'vtigeraccounts':_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0x99');break;case _0x9ce7('0xc4'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xc5');break;case'dispositions':_0x3267ab['childModel']=_0x9ce7('0xc6');break;case _0x9ce7('0xc7'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xc8');break;case _0x9ce7('0xc9'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xca');break;case _0x9ce7('0xcb'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xcc');break;case _0x9ce7('0xcd'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xce');break;case _0x9ce7('0xcf'):_0x3267ab[_0x9ce7('0x6b')]='Sound';break;case _0x9ce7('0xd0'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xd1');break;case _0x9ce7('0xd2'):_0x3267ab['childModel']=_0x9ce7('0xd3');break;case _0x9ce7('0xd4'):_0x3267ab[_0x9ce7('0x6b')]='Trigger';break;case _0x9ce7('0xd5'):_0x3267ab[_0x9ce7('0x6b')]='Trunk';break;case _0x9ce7('0xd6'):_0x3267ab['childModel']=_0x9ce7('0xd7');break;case _0x9ce7('0xd8'):_0x3267ab['childModel']=_0x9ce7('0x62');break;case _0x9ce7('0xd9'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0x72');_0x3267ab[_0x9ce7('0x6d')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x9ce7('0xda'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xdb');break;case _0x9ce7('0xdc'):_0x3267ab[_0x9ce7('0x6b')]=_0x9ce7('0xb2');break;default:return _0x3267ab;}return _0x3267ab;} \ No newline at end of file +var _0xf780=['error','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','show','keys','options','find','catch','create','body','clone','params','get','omit','createdAt','updatedAt','crudPermissions','sequelize','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','userProfileId','Resources','destroy','describe','transaction','sectionId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','undefined','Sequelize','ValidationError','childModel','Invalid\x20section\x20\x27','parentSections','all','union','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','custom','reportId','color','Tag','tag','value','toLowerCase','odbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','contacts','CmContact','ListId','lists','companies','globalcustomfields','CmCustomField','chatwebsites','FaxQueue','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceRecording','Agents','membername','Telephones','User','role','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','musiconholds','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','SmsQueue','smsaccounts','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','users','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','DeskAccount','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Interval','pauses','scheduler','Schedule','sounds','Sound','templates','Trigger','trunks','Variable','plugins','extractedreports','metrics','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','redis','localhost','./userProfile.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x21d88d,_0x4ff19c){var _0x30a579=function(_0x24cf7a){while(--_0x24cf7a){_0x21d88d['push'](_0x21d88d['shift']());}};_0x30a579(++_0x4ff19c);}(_0xf780,0xb0));var _0x0f78=function(_0x2acf18,_0x469d00){_0x2acf18=_0x2acf18-0x0;var _0x170f5c=_0xf780[_0x2acf18];return _0x170f5c;};'use strict';var pdf=require(_0x0f78('0x0'));var emlformat=require(_0x0f78('0x1'));var rimraf=require(_0x0f78('0x2'));var zipdir=require(_0x0f78('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f78('0x4'));var moment=require(_0x0f78('0x5'));var BPromise=require(_0x0f78('0x6'));var Mustache=require('mustache');var util=require(_0x0f78('0x7'));var path=require(_0x0f78('0x8'));var sox=require(_0x0f78('0x9'));var csv=require(_0x0f78('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0f78('0xb'));var squel=require(_0x0f78('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0f78('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0f78('0xe'));var Papa=require('papaparse');var Redis=require(_0x0f78('0xf'));var authService=require(_0x0f78('0x10'));var qs=require(_0x0f78('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f78('0x12'));var logger=require('../../config/logger')(_0x0f78('0x13'));var utils=require(_0x0f78('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0f78('0x15')]=_['defaults'](config['redis'],{'host':_0x0f78('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0f78('0x17'))[_0x0f78('0x18')](socket);function respondWithStatusCode(_0x48ffb2,_0x50802a){_0x50802a=_0x50802a||0xcc;return function(_0x2bbd25){if(_0x2bbd25){return _0x48ffb2[_0x0f78('0x19')](_0x50802a);}return _0x48ffb2[_0x0f78('0x1a')](_0x50802a)[_0x0f78('0x1b')]();};}function respondWithResult(_0xa347fe,_0x294dfe){_0x294dfe=_0x294dfe||0xc8;return function(_0x47581a){if(_0x47581a){return _0xa347fe['status'](_0x294dfe)[_0x0f78('0x1c')](_0x47581a);}};}function respondWithFilteredResult(_0xbad747,_0xaabfd7){return function(_0x22bb9f){if(_0x22bb9f){var _0x332daf=_0x22bb9f[_0x0f78('0x1d')],_0x29f9a4=_0xaabfd7[_0x0f78('0x1e')],_0xec9586=_0xaabfd7[_0x0f78('0x1e')]+_0xaabfd7[_0x0f78('0x1f')],_0x132d35;if(_0xec9586>=_0x332daf){_0xec9586=_0x332daf;_0x132d35=0xc8;}else{_0x132d35=0xce;}_0xbad747[_0x0f78('0x1a')](_0x132d35);return _0xbad747[_0x0f78('0x20')](_0x0f78('0x21'),_0x29f9a4+'-'+_0xec9586+'/'+_0x332daf)['json'](_0x22bb9f);}return null;};}function patchUpdates(_0x17cbfd){return function(_0x538fa0){try{jsonpatch[_0x0f78('0x22')](_0x538fa0,_0x17cbfd,!![]);}catch(_0x52d9a2){return BPromise[_0x0f78('0x23')](_0x52d9a2);}return _0x538fa0[_0x0f78('0x24')]();};}function saveUpdates(_0x5ec69f,_0x4fd819){return function(_0x8badcf){if(_0x8badcf){return _0x8badcf[_0x0f78('0x25')](_0x5ec69f)[_0x0f78('0x26')](function(_0xc3f3b7){return _0xc3f3b7;});}return null;};}function removeEntity(_0xb276ab,_0x2eb584){return function(_0x5d155e){if(_0x5d155e){return _0x5d155e['destroy']()[_0x0f78('0x26')](function(){_0xb276ab[_0x0f78('0x1a')](0xcc)[_0x0f78('0x1b')]();});}};}function handleEntityNotFound(_0xbf75a,_0x236b38){return function(_0x7009d9){if(!_0x7009d9){_0xbf75a[_0x0f78('0x19')](0x194);}return _0x7009d9;};}function handleError(_0x287e6a,_0x7b2bbb){_0x7b2bbb=_0x7b2bbb||0x1f4;return function(_0x35d463){logger[_0x0f78('0x27')](_0x35d463[_0x0f78('0x28')]);if(_0x35d463[_0x0f78('0x29')]){delete _0x35d463[_0x0f78('0x29')];}_0x287e6a[_0x0f78('0x1a')](_0x7b2bbb)[_0x0f78('0x2a')](_0x35d463);};}exports[_0x0f78('0x2b')]=function(_0x1d54f5,_0xbf09d5){var _0x182c0b={},_0x345476={},_0x7fa311={'count':0x0,'rows':[]};var _0x4f355b=_['map'](db[_0x0f78('0x2c')][_0x0f78('0x2d')],function(_0x4f202b){return{'name':_0x4f202b[_0x0f78('0x2e')],'type':_0x4f202b[_0x0f78('0x2f')][_0x0f78('0x30')]};});_0x345476[_0x0f78('0x31')]=_[_0x0f78('0x32')](_0x4f355b,_0x0f78('0x29'));_0x345476[_0x0f78('0x33')]=_['keys'](_0x1d54f5[_0x0f78('0x33')]);_0x345476[_0x0f78('0x34')]=_[_0x0f78('0x35')](_0x345476[_0x0f78('0x31')],_0x345476['query']);_0x182c0b[_0x0f78('0x36')]=_[_0x0f78('0x35')](_0x345476[_0x0f78('0x31')],qs[_0x0f78('0x37')](_0x1d54f5['query'][_0x0f78('0x37')]));_0x182c0b[_0x0f78('0x36')]=_0x182c0b[_0x0f78('0x36')][_0x0f78('0x38')]?_0x182c0b['attributes']:_0x345476[_0x0f78('0x31')];if(!_0x1d54f5[_0x0f78('0x33')][_0x0f78('0x39')](_0x0f78('0x3a'))){_0x182c0b['limit']=qs[_0x0f78('0x1f')](_0x1d54f5['query']['limit']);_0x182c0b[_0x0f78('0x1e')]=qs[_0x0f78('0x1e')](_0x1d54f5[_0x0f78('0x33')]['offset']);}_0x182c0b['order']=qs[_0x0f78('0x3b')](_0x1d54f5['query'][_0x0f78('0x3b')]);_0x182c0b['where']=qs['filters'](_[_0x0f78('0x3c')](_0x1d54f5['query'],_0x345476['filters']),_0x4f355b);if(_0x1d54f5[_0x0f78('0x33')][_0x0f78('0x3d')]){_0x182c0b[_0x0f78('0x3e')]=_[_0x0f78('0x3f')](_0x182c0b['where'],{'$or':_[_0x0f78('0x32')](_0x4f355b,function(_0x17876a){if(_0x17876a[_0x0f78('0x2f')]!==_0x0f78('0x40')){var _0x475246={};_0x475246[_0x17876a['name']]={'$like':'%'+_0x1d54f5['query'][_0x0f78('0x3d')]+'%'};return _0x475246;}})});}_0x182c0b=_[_0x0f78('0x3f')]({},_0x182c0b,_0x1d54f5['options']);var _0x20a352={'where':_0x182c0b['where']};return db[_0x0f78('0x2c')][_0x0f78('0x1d')](_0x20a352)[_0x0f78('0x26')](function(_0x18de6c){_0x7fa311[_0x0f78('0x1d')]=_0x18de6c;if(_0x1d54f5[_0x0f78('0x33')][_0x0f78('0x41')]){_0x182c0b[_0x0f78('0x42')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x182c0b);})[_0x0f78('0x26')](function(_0x5ad795){_0x7fa311[_0x0f78('0x43')]=_0x5ad795;return _0x7fa311;})[_0x0f78('0x26')](respondWithFilteredResult(_0xbf09d5,_0x182c0b))['catch'](handleError(_0xbf09d5,null));};exports[_0x0f78('0x44')]=function(_0x432c28,_0x1b9ea4){var _0x16a4db={'raw':![],'where':{'id':_0x432c28['params']['id']}},_0x46d466={};_0x46d466[_0x0f78('0x31')]=_[_0x0f78('0x45')](db[_0x0f78('0x2c')][_0x0f78('0x2d')]);_0x46d466[_0x0f78('0x33')]=_[_0x0f78('0x45')](_0x432c28[_0x0f78('0x33')]);_0x46d466[_0x0f78('0x34')]=_[_0x0f78('0x35')](_0x46d466['model'],_0x46d466[_0x0f78('0x33')]);_0x16a4db['attributes']=_[_0x0f78('0x35')](_0x46d466[_0x0f78('0x31')],qs[_0x0f78('0x37')](_0x432c28[_0x0f78('0x33')]['fields']));_0x16a4db[_0x0f78('0x36')]=_0x16a4db[_0x0f78('0x36')][_0x0f78('0x38')]?_0x16a4db[_0x0f78('0x36')]:_0x46d466[_0x0f78('0x31')];if(_0x432c28['query'][_0x0f78('0x41')]){_0x16a4db[_0x0f78('0x42')]=[{'all':!![]}];}_0x16a4db=_[_0x0f78('0x3f')]({},_0x16a4db,_0x432c28[_0x0f78('0x46')]);return db[_0x0f78('0x2c')][_0x0f78('0x47')](_0x16a4db)[_0x0f78('0x26')](handleEntityNotFound(_0x1b9ea4,null))[_0x0f78('0x26')](respondWithResult(_0x1b9ea4,null))[_0x0f78('0x48')](handleError(_0x1b9ea4,null));};exports['create']=function(_0x1cff53,_0x1d341){return db[_0x0f78('0x2c')][_0x0f78('0x49')](_0x1cff53[_0x0f78('0x4a')],{})[_0x0f78('0x26')](respondWithResult(_0x1d341,0xc9))['catch'](handleError(_0x1d341,null));};exports[_0x0f78('0x4b')]=function(_0x5ed952,_0x2760e8){var _0x48add1={'where':{'id':_0x5ed952[_0x0f78('0x4c')]['id']}},_0x564d5c={};_0x564d5c[_0x0f78('0x31')]=_[_0x0f78('0x45')](db[_0x0f78('0x2c')][_0x0f78('0x2d')]);_0x48add1[_0x0f78('0x36')]=_[_0x0f78('0x35')](_0x564d5c['model'],qs['fields'](_0x5ed952[_0x0f78('0x33')]['fields']));_0x48add1[_0x0f78('0x36')]=_0x48add1[_0x0f78('0x36')]['length']?_0x48add1[_0x0f78('0x36')]:_0x564d5c['model'];if(_0x5ed952[_0x0f78('0x33')][_0x0f78('0x41')]){_0x48add1['include']=[{'all':!![]}];}_0x48add1=_[_0x0f78('0x3f')]({},_0x48add1,_0x5ed952[_0x0f78('0x46')]);return db['UserProfile'][_0x0f78('0x47')](_0x48add1)[_0x0f78('0x26')](handleEntityNotFound(_0x2760e8,null))[_0x0f78('0x26')](function(_0x4e922b){if(_0x4e922b){var _0x39e436=_0x4e922b[_0x0f78('0x4d')]({'plain':!![]});_0x39e436=qs[_0x0f78('0x4e')](_0x39e436,['id',_0x0f78('0x4f'),_0x0f78('0x50'),_0x0f78('0x51')]);_0x5ed952['body']=_[_0x0f78('0x4e')](_0x5ed952[_0x0f78('0x4a')],['id','createdAt','updatedAt']);return db[_0x0f78('0x52')]['transaction'](function(_0x329d63){return db[_0x0f78('0x2c')][_0x0f78('0x49')](_[_0x0f78('0x3f')](_0x39e436,_0x5ed952[_0x0f78('0x4a')]),{'include':_0x5ed952[_0x0f78('0x33')][_0x0f78('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x329d63})[_0x0f78('0x26')](function(_0x92e46e){var _0x3fd410=_0x92e46e[_0x0f78('0x4d')]({'plain':!![]});return db[_0x0f78('0x53')][_0x0f78('0x54')]({'where':{'userProfileId':_0x5ed952['params']['id']},'raw':!![]})[_0x0f78('0x26')](function(_0x12a51f){if(_0x12a51f){return BPromise[_0x0f78('0x55')](_0x12a51f,function(_0x581cfc){return new BPromise(function(_0x1d6fe2,_0x48ef37){if(_0x581cfc[_0x0f78('0x56')]===null||_0x581cfc[_0x0f78('0x56')]===0x1)_0x1d6fe2(null);return db[_0x0f78('0x57')][_0x0f78('0x54')]({'where':{'sectionId':_0x581cfc['id']},'raw':!![]})[_0x0f78('0x26')](function(_0x2bbc7b){var _0x250aa7=_[_0x0f78('0x32')](_0x2bbc7b,function(_0x433082){return qs[_0x0f78('0x4e')](_0x433082,['id',_0x0f78('0x4f'),'updatedAt','sectionId']);});_0x1d6fe2(_0x250aa7);})[_0x0f78('0x48')](function(_0x53dfdf){_0x48ef37(_0x53dfdf);});})[_0x0f78('0x26')](function(_0x331a4d){var _0x95f73c=qs['omit'](_0x581cfc,['id',_0x0f78('0x4f'),_0x0f78('0x50')]);_0x95f73c[_0x0f78('0x58')]=_0x3fd410['id'];if(_0x331a4d)_0x95f73c[_0x0f78('0x59')]=_0x331a4d;return _0x95f73c;})['then'](function(_0x1e597c){return db[_0x0f78('0x53')]['create'](_0x1e597c,{'include':[{'model':db[_0x0f78('0x57')],'as':_0x0f78('0x59')}],'raw':!![],'transaction':_0x329d63});});})['then'](function(){return _0x3fd410;});}});});});}})[_0x0f78('0x26')](respondWithResult(_0x2760e8,0xc9))[_0x0f78('0x48')](handleError(_0x2760e8,null));};exports[_0x0f78('0x25')]=function(_0x4f7b30,_0x2f3ba5){if(_0x4f7b30[_0x0f78('0x4a')]['id']){delete _0x4f7b30[_0x0f78('0x4a')]['id'];}return db[_0x0f78('0x2c')]['find']({'where':{'id':_0x4f7b30[_0x0f78('0x4c')]['id']}})[_0x0f78('0x26')](handleEntityNotFound(_0x2f3ba5,null))[_0x0f78('0x26')](saveUpdates(_0x4f7b30[_0x0f78('0x4a')],null))[_0x0f78('0x26')](respondWithResult(_0x2f3ba5,null))[_0x0f78('0x48')](handleError(_0x2f3ba5,null));};exports[_0x0f78('0x5a')]=function(_0x405a5e,_0x3f9f9f){return db[_0x0f78('0x2c')][_0x0f78('0x47')]({'where':{'id':_0x405a5e['params']['id']}})[_0x0f78('0x26')](handleEntityNotFound(_0x3f9f9f,null))[_0x0f78('0x26')](removeEntity(_0x3f9f9f,null))[_0x0f78('0x48')](handleError(_0x3f9f9f,null));};exports[_0x0f78('0x5b')]=function(_0x253a9e,_0x3ac14b){return db['UserProfile'][_0x0f78('0x5b')]()['then'](respondWithResult(_0x3ac14b,null))[_0x0f78('0x48')](handleError(_0x3ac14b,null));};exports['addSections']=function(_0x309565,_0x1a2513){var _0x27a1a7=_0x309565[_0x0f78('0x4a')];return db['UserProfile'][_0x0f78('0x47')]({'where':{'id':_0x309565['params']['id']}})[_0x0f78('0x26')](handleEntityNotFound(_0x1a2513,null))['then'](function(_0x59fb82){if(_0x59fb82){return db[_0x0f78('0x52')][_0x0f78('0x5c')](function(_0x3ee1cb){return db[_0x0f78('0x53')]['destroy']({'where':{'userProfileId':_0x309565[_0x0f78('0x4c')]['id'],'sectionId':_[_0x0f78('0x32')](_0x27a1a7,function(_0x27038e){return _0x27038e[_0x0f78('0x5d')];})},'transaction':_0x3ee1cb})[_0x0f78('0x26')](function(){var _0x3d454a=_[_0x0f78('0x32')](_0x27a1a7,function(_0x1ec5fa){_0x1ec5fa[_0x0f78('0x58')]=_0x309565[_0x0f78('0x4c')]['id'];return _0x1ec5fa;});var _0x2b31da=[];return BPromise[_0x0f78('0x55')](_0x3d454a,function(_0x15f71b){return db[_0x0f78('0x53')][_0x0f78('0x49')](_0x15f71b,{'include':[{'model':db[_0x0f78('0x57')],'as':_0x0f78('0x59')}],'raw':!![],'transaction':_0x3ee1cb})[_0x0f78('0x26')](function(_0x16dbeb){_0x2b31da[_0x0f78('0x5e')](_0x16dbeb[_0x0f78('0x4d')]({'plain':!![]}));});})['then'](function(){return _0x2b31da;});});});}})['then'](function(_0x17897e){return _0x17897e;})[_0x0f78('0x26')](respondWithResult(_0x1a2513,null))[_0x0f78('0x48')](handleError(_0x1a2513,null));};exports[_0x0f78('0x5f')]=function(_0x28d414,_0x58680f){var _0x515e2d;return db[_0x0f78('0x2c')][_0x0f78('0x47')]({'where':{'id':_0x28d414[_0x0f78('0x4c')]['id']},'attributes':['id','name']})[_0x0f78('0x26')](handleEntityNotFound(_0x58680f,null))['then'](function(_0x423dd2){if(_0x423dd2){_0x515e2d=_0x423dd2;return db['UserProfileSection'][_0x0f78('0x5a')]({'where':{'userProfileId':_0x28d414['params']['id'],'sectionId':_0x28d414[_0x0f78('0x33')][_0x0f78('0x60')]}});}})[_0x0f78('0x26')](function(){return _0x515e2d;})[_0x0f78('0x26')](respondWithStatusCode(_0x58680f,null))['catch'](handleError(_0x58680f,null));};exports[_0x0f78('0x61')]=function(_0x1fb96b,_0xb499b1){var _0x1f82da=[];var _0x22ac58=[];return db[_0x0f78('0x53')][_0x0f78('0x54')]({'where':{'userProfileId':_0x1fb96b[_0x0f78('0x4c')]['id']},'raw':!![]})['then'](function(_0x3617a7){_0x1f82da=_[_0x0f78('0x3d')](_0x3617a7,function(_0x5cf06f){return _0x5cf06f[_0x0f78('0x62')]===0x1||_[_0x0f78('0x63')]([0x3eb,0x709],_0x5cf06f[_0x0f78('0x5d')]);});if(!_[_0x0f78('0x64')](_0x1f82da)){return _['map'](_0x1f82da,function(_0x26dee7){return _0x26dee7['sectionId'];});}else{return;}})['then'](function(_0x34a8c3){if(_0x34a8c3)_0x22ac58=_0x34a8c3;if(_[_0x0f78('0x63')](_0x22ac58,0x64)){var _0x4fa745=_[_0x0f78('0x47')](_0x1f82da,{'sectionId':0x64});return hasDefaultDashboard(_0x4fa745)[_0x0f78('0x26')](function(_0xbe1137){return _[_0x0f78('0x32')](_0x1f82da,function(_0x5e1619){if(_0x5e1619[_0x0f78('0x5d')]===0x64){_0x5e1619[_0x0f78('0x65')]=_0xbe1137;}return _0x5e1619;});});}else{return;}})['then'](function(_0x495db8){if(_0x495db8)_0x1f82da=_0x495db8;if(_[_0x0f78('0x63')](_0x22ac58,0x3eb)){var _0x4219a1=_['find'](_0x1f82da,{'sectionId':0x3eb});return getCustomDashboards(_0x4219a1)['then'](function(_0xcac9af){return _['map'](_0x1f82da,function(_0xa9e277){if(_0x4219a1[_0x0f78('0x62')]){if(_0xa9e277[_0x0f78('0x5d')]===0x3eb){_0xa9e277[_0x0f78('0x65')]=_0xcac9af;}}else{if(_0xa9e277[_0x0f78('0x5d')]===0x64){_0xa9e277[_0x0f78('0x65')]=_0xcac9af;}}return _0xa9e277;});});}else{return;}})[_0x0f78('0x26')](function(_0x4cdba5){if(_0x4cdba5)_0x1f82da=_0x4cdba5;if(_[_0x0f78('0x63')](_0x22ac58,0x709)){var _0x535ece=_[_0x0f78('0x47')](_0x1f82da,{'sectionId':0x709});return getPlugins(_0x535ece)[_0x0f78('0x26')](function(_0x22149d){if(_0x535ece[_0x0f78('0x62')]){return _[_0x0f78('0x32')](_0x1f82da,function(_0x498b8f){if(_0x498b8f[_0x0f78('0x5d')]===0x709){_0x498b8f[_0x0f78('0x65')]=_0x22149d;}return _0x498b8f;});}else{var _0x48da2d={'sectionId':0x76c,'enabled':0x1,'subsections':_0x22149d};var _0x18fe55=_[_0x0f78('0x32')](_0x1f82da);_0x18fe55['push'](_0x48da2d);return _0x18fe55;}});}else{return;}})[_0x0f78('0x26')](function(_0xedfb79){if(_0xedfb79)_0x1f82da=_0xedfb79;return _[_0x0f78('0x3d')](_0x1f82da,[_0x0f78('0x62'),0x1]);})[_0x0f78('0x26')](respondWithResult(_0xb499b1,null))[_0x0f78('0x48')](handleError(_0xb499b1,null));};function hasDefaultDashboard(_0x374983){var _0x21603a=[0x65];return new BPromise(function(_0x5d8c00,_0x1210d4){try{if(_0x374983[_0x0f78('0x56')]){_0x5d8c00(_0x21603a);}else{return db[_0x0f78('0x57')][_0x0f78('0x66')]({'where':{'sectionId':_0x374983['id']},'raw':!![]})['then'](function(_0x1d405e){_0x1d405e?_0x5d8c00(_0x21603a):_0x5d8c00();});}}catch(_0x3c519a){_0x1210d4(_0x3c519a);}});}function getCustomDashboards(_0x3604d3){var _0x5165c4=[];return new BPromise(function(_0x5b8281,_0x5d1178){try{if(_0x3604d3[_0x0f78('0x56')]){return db[_0x0f78('0x67')]['findAll']({'raw':!![]})[_0x0f78('0x26')](function(_0x1f1581){_0x1f1581['forEach'](function(_0x5da3d8){_0x5165c4['push'](_0x5da3d8['id']+0x1869f);});_0x5b8281(_0x5165c4);});}else{return db[_0x0f78('0x57')]['findAll']({'where':{'sectionId':_0x3604d3['id']},'raw':!![]})[_0x0f78('0x26')](function(_0x62853a){_0x62853a[_0x0f78('0x68')](function(_0x2d93c6){_0x5165c4[_0x0f78('0x5e')](_0x2d93c6[_0x0f78('0x69')]+0x1869f);});_0x5b8281(_0x5165c4);});}}catch(_0x24e4b9){_0x5d1178(_0x24e4b9);}});}function getPlugins(_0x2f57e6){var _0x15bfec=[];return new BPromise(function(_0x11ec70,_0x2c658c){try{if(_0x2f57e6['autoAssociation']){return db[_0x0f78('0x6a')][_0x0f78('0x54')]({'raw':!![]})[_0x0f78('0x26')](function(_0x5041e8){_0x5041e8[_0x0f78('0x68')](function(_0x226c26){_0x15bfec[_0x0f78('0x5e')](_0x226c26['id']+0x15b38);});_0x11ec70(_0x15bfec);});}else{return db[_0x0f78('0x57')][_0x0f78('0x54')]({'where':{'sectionId':_0x2f57e6['id']},'raw':!![]})[_0x0f78('0x26')](function(_0x2c7634){_0x2c7634[_0x0f78('0x68')](function(_0x58f97b){_0x15bfec[_0x0f78('0x5e')](_0x58f97b[_0x0f78('0x69')]+0x15b38);});_0x11ec70(_0x15bfec);});}}catch(_0x4d443c){_0x2c658c(_0x4d443c);}});}exports[_0x0f78('0x6b')]=function(_0x65f21e,_0x2b5c22){return db[_0x0f78('0x2c')][_0x0f78('0x47')]({'where':{'id':_0x65f21e[_0x0f78('0x4c')]['id']}})[_0x0f78('0x26')](handleEntityNotFound(_0x2b5c22,null))['then'](function(_0x4b950a){if(_0x4b950a){return db[_0x0f78('0x52')][_0x0f78('0x5c')](function(_0xca9248){return db[_0x0f78('0x53')][_0x0f78('0x54')]({'where':{'userProfileId':_0x65f21e[_0x0f78('0x4c')]['id']},'attributes':['id'],'raw':!![]})[_0x0f78('0x26')](function(_0x5d8a2c){if(_0x5d8a2c){return db[_0x0f78('0x53')][_0x0f78('0x5a')]({'where':{'userProfileId':_0x65f21e[_0x0f78('0x4c')]['id'],'id':_[_0x0f78('0x32')](_0x5d8a2c,function(_0x5e04b0){return _0x5e04b0['id'];})},'transaction':_0xca9248});}})['then'](function(_0x1a1c71){var _0x320721=_[_0x0f78('0x32')](_0x65f21e[_0x0f78('0x4a')],function(_0x2c0120){_0x2c0120[_0x0f78('0x58')]=_0x65f21e[_0x0f78('0x4c')]['id'];return _0x2c0120;});return db['UserProfileSection'][_0x0f78('0x6c')](_0x320721,{'raw':!![],'transaction':_0xca9248});})['then'](function(_0x2a1314){var _0xe5bd6a=_[_0x0f78('0x3d')](_[_0x0f78('0x32')](_0x2a1314,function(_0x292178){return _0x292178[_0x0f78('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0xe5bd6a){return db[_0x0f78('0x53')]['findAll']({'where':{'userProfileId':_0x65f21e[_0x0f78('0x4c')]['id'],'sectionId':_[_0x0f78('0x32')](_0xe5bd6a,function(_0xf16bf7){return _0xf16bf7[_0x0f78('0x5d')];})},'attributes':['id',_0x0f78('0x5d')],'raw':!![]})['then'](function(_0x321b2d){var _0x4ae048=_[_0x0f78('0x32')](_0x65f21e[_0x0f78('0x4a')],function(_0x34bd76){_0x34bd76[_0x0f78('0x58')]=_0x65f21e[_0x0f78('0x4c')]['id'];return _0x34bd76;});return db['UserProfileResource'][_0x0f78('0x6c')](_0x4ae048,{'raw':!![],'transaction':_0xca9248});});}})[_0x0f78('0x48')](handleError(_0x2b5c22,null));});}})[_0x0f78('0x26')](function(_0xe33289){var _0x4788d8=_[_0x0f78('0x32')](_0xe33289,function(_0x2279cd){return _0x2279cd['get']({'plain':!![]});});})['then'](respondWithResult(_0x2b5c22,null))[_0x0f78('0x48')](handleError(_0x2b5c22,null));};exports['removeResources']=function(_0x193418,_0x23a064,_0x4f2333){return db[_0x0f78('0x2c')][_0x0f78('0x47')]({'where':{'id':_0x193418[_0x0f78('0x4c')]['id']}})[_0x0f78('0x26')](handleEntityNotFound(_0x23a064,null))[_0x0f78('0x26')](function(_0x588bd3){if(_0x588bd3){return _0x588bd3[_0x0f78('0x6d')](_0x193418[_0x0f78('0x33')][_0x0f78('0x60')]);}})[_0x0f78('0x26')](respondWithStatusCode(_0x23a064,null))[_0x0f78('0x48')](handleError(_0x23a064,null));};exports['getResources']=function(_0x4d32de,_0x200df2){var _0x51b7c1={'raw':![],'where':{}};var _0xa5234b={};var _0x1b7ee3={'count':0x0,'rows':[]};var _0x45151c=_0x4d32de[_0x0f78('0x33')][_0x0f78('0x6e')];if(typeof _0x45151c===_0x0f78('0x6f')){throw new db[(_0x0f78('0x70'))][(_0x0f78('0x71'))]('Unknown\x20section');}var _0x147b63=_0x4d32de[_0x0f78('0x33')]['mergeResources']||![];var _0x25f1cd=getQueryModels(_0x45151c,_0x147b63);if(typeof _0x25f1cd[_0x0f78('0x72')]===_0x0f78('0x6f')){throw new db[(_0x0f78('0x70'))][(_0x0f78('0x71'))](_0x0f78('0x73')+_0x45151c+'\x27');}var _0x1e4579=[];if(!_[_0x0f78('0x64')](_0x25f1cd[_0x0f78('0x74')])){_0x1e4579=_0x25f1cd['parentSections'];}else{_0x1e4579=[{'name':_0x45151c}];}return db[_0x0f78('0x2c')]['findOne']({'where':{'id':_0x4d32de[_0x0f78('0x4c')]['id']}})[_0x0f78('0x26')](handleEntityNotFound(_0x200df2,null))['then'](function(_0xb75faa){if(_0xb75faa){var _0x1faea1=[];for(var _0x4b05b8=0x0;_0x4b05b8<_0x1e4579[_0x0f78('0x38')];_0x4b05b8++){_0x1faea1['push'](db[_0x0f78('0x53')][_0x0f78('0x66')]({'where':{'userProfileId':_0xb75faa['id'],'name':_0x1e4579[_0x4b05b8][_0x0f78('0x29')]},'raw':!![]}));}return BPromise[_0x0f78('0x75')](_0x1faea1);}})['then'](function(_0x4c79e8){var _0x507e7a=_[_0x0f78('0x3d')](_0x4c79e8,function(_0x5e51a9){return _0x5e51a9?_0x5e51a9:undefined;});var _0x4e0cf5=_['filter'](_0x1e4579,['ignore',!![]]);var _0x26c85b=_[_0x0f78('0x64')](_0x507e7a)&&_[_0x0f78('0x64')](_0x4e0cf5)?null:_[_0x0f78('0x76')](_0x4e0cf5,_0x507e7a);if(_0x26c85b){var _0x58005b=[];for(var _0x15c311=0x0;_0x15c311<_0x26c85b[_0x0f78('0x38')];_0x15c311++){var _0x394466=_[_0x0f78('0x47')](_0x1e4579,function(_0x1e6962){return _0x26c85b[_0x15c311]?_0x1e6962['name']===_0x26c85b[_0x15c311][_0x0f78('0x29')]:null;});if(_0x394466){if(_0x26c85b[_0x15c311]['ignore']){_0x58005b[_0x0f78('0x5e')](getAllResources(_0x25f1cd[_0x0f78('0x72')],_0x26c85b[_0x15c311]));}else{if(!_0x26c85b[_0x15c311][_0x0f78('0x56')]){_0x58005b[_0x0f78('0x5e')](getAllowedResources(_0x394466,_0x26c85b[_0x15c311],_0x25f1cd['childModel']));}else{if(_0x394466[_0x0f78('0x31')]){_0x58005b[_0x0f78('0x5e')](getAllFilteredResources(_0x394466,_0x26c85b[_0x15c311]));}}}}}return BPromise[_0x0f78('0x75')](_0x58005b);}else{return null;}})[_0x0f78('0x26')](function(_0x3b9d00){var _0x4f4fb9=_0x3b9d00;var _0x22419a=null;if(_0x4f4fb9){_0x22419a=_0x4f4fb9[_0x0f78('0x38')]===0x1?_0x4f4fb9[0x0]:null;}if(_0x22419a||_0x4f4fb9){var _0x203293=db[_0x25f1cd[_0x0f78('0x72')]]['rawAttributes'];_0xa5234b[_0x0f78('0x31')]=_[_0x0f78('0x45')](_0x203293);_0xa5234b[_0x0f78('0x33')]=_[_0x0f78('0x45')](_0x4d32de['query']);_0xa5234b[_0x0f78('0x34')]=_[_0x0f78('0x35')](_0xa5234b[_0x0f78('0x31')],_0xa5234b['query']);_0x51b7c1[_0x0f78('0x36')]=_[_0x0f78('0x35')](_0xa5234b[_0x0f78('0x31')],qs['fields'](_0x4d32de[_0x0f78('0x33')][_0x0f78('0x37')]));_0x51b7c1[_0x0f78('0x36')]=_0x51b7c1[_0x0f78('0x36')][_0x0f78('0x38')]?_0x51b7c1['attributes']:_0xa5234b[_0x0f78('0x31')];if(!_0x4d32de['query'][_0x0f78('0x39')]('nolimit')){_0x51b7c1[_0x0f78('0x1f')]=qs['limit'](_0x4d32de['query']['limit']);_0x51b7c1['offset']=qs[_0x0f78('0x1e')](_0x4d32de['query'][_0x0f78('0x1e')]);}_0x51b7c1['order']=qs['sort'](_0x4d32de[_0x0f78('0x33')][_0x0f78('0x3b')]);_0x51b7c1[_0x0f78('0x3e')]=qs['filters'](_[_0x0f78('0x3c')](_0x4d32de[_0x0f78('0x33')],_0xa5234b[_0x0f78('0x34')]));if(_0x4d32de[_0x0f78('0x33')]['filter']){_0x51b7c1[_0x0f78('0x3e')]=_[_0x0f78('0x3f')](_0x51b7c1['where'],{'$or':_[_0x0f78('0x32')](_0x203293,function(_0x5b3604){if(_0x5b3604[_0x0f78('0x2f')][_0x0f78('0x30')]!==_0x0f78('0x40')){var _0x3aed7f={};_0x3aed7f[_0x5b3604[_0x0f78('0x77')]]={'$like':'%'+_0x4d32de[_0x0f78('0x33')][_0x0f78('0x3d')]+'%'};return _0x3aed7f;}})});}var _0x25f5d2=[];if(_0x22419a){var _0x291f51=_[_0x0f78('0x47')](_0x1e4579,['name',_0x22419a['name']]);if(_0x291f51[_0x0f78('0x77')]){var _0x509afa={};if(_0x25f1cd['childModel']===_0x0f78('0x78')){_0x509afa[_0x291f51[_0x0f78('0x79')]]=_['map'](_0x22419a[_0x0f78('0x7a')],'id');}else{_0x509afa[_0x291f51['foreignKey']]=_0x22419a[_0x0f78('0x7a')];}_0x25f5d2[_0x0f78('0x5e')](_0x509afa);}else{_0x51b7c1[_0x0f78('0x3e')]['id']=_0x22419a['associatedResources'];}}else{for(var _0x4bc60e=0x0;_0x4bc60e<_0x4f4fb9[_0x0f78('0x38')];_0x4bc60e++){var _0x291f51=_[_0x0f78('0x47')](_0x1e4579,[_0x0f78('0x29'),_0x4f4fb9[_0x4bc60e]['name']]);if(_0x291f51[_0x0f78('0x77')]){var _0x509afa={};_0x509afa[_0x291f51['foreignKey']]=_0x4f4fb9[_0x4bc60e]['associatedResources'];_0x25f5d2[_0x0f78('0x5e')](_0x509afa);}else{if(!_0x51b7c1['where']['id'])_0x51b7c1[_0x0f78('0x3e')]['id']=[];_0x4f4fb9[_0x4bc60e][_0x0f78('0x7a')][_0x0f78('0x68')](function(_0x1f2ce7){_0x51b7c1[_0x0f78('0x3e')]['id']['push'](_0x1f2ce7);});}}}if(!_[_0x0f78('0x64')](_0x25f5d2)){_0x51b7c1[_0x0f78('0x3e')]=_[_0x0f78('0x3f')](_0x51b7c1['where'],{'$and':{'$or':_0x25f5d2}});}_0x51b7c1=_[_0x0f78('0x3f')]({},_0x51b7c1,_0x4d32de[_0x0f78('0x46')]);if(_0x22419a&&!_0x22419a[_0x0f78('0x56')]&&_0x25f1cd[_0x0f78('0x72')]===_0x0f78('0x78')){if(_0x4d32de['query'][_0x0f78('0x41')]){_0x51b7c1[_0x0f78('0x42')]=[{'all':!![]}];}return db[_0x25f1cd['childModel']]['findAll'](_0x51b7c1)[_0x0f78('0x26')](function(_0x84613f){var _0x5a21f3=[];_0x84613f[_0x0f78('0x68')](function(_0x5334d5){var _0x9fcd3f;switch(_0x5334d5[_0x0f78('0x7b')]){case _0x0f78('0x7c'):_0x9fcd3f=_[_0x0f78('0x47')](_0x22419a['associatedResources'],function(_0x3072cd){return _0x3072cd['id']===_0x5334d5['reportId']&&_0x3072cd['type']===_0x0f78('0x7d');});break;case _0x0f78('0x7e'):_0x9fcd3f=_[_0x0f78('0x47')](_0x22419a['associatedResources'],function(_0x3cd35c){return _0x3cd35c['id']===_0x5334d5[_0x0f78('0x7f')]&&_0x3cd35c[_0x0f78('0x2f')]==='CustomReports';});break;}if(_0x9fcd3f)_0x5a21f3['push'](_0x5334d5);});_0x1b7ee3['count']=_0x5a21f3[_0x0f78('0x38')];_0x1b7ee3[_0x0f78('0x43')]=_0x5a21f3;return _0x1b7ee3;});}else{return db[_0x25f1cd[_0x0f78('0x72')]][_0x0f78('0x1d')]({'where':_0x51b7c1[_0x0f78('0x3e')]})[_0x0f78('0x26')](function(_0x190f0b){_0x1b7ee3['count']=_0x190f0b;if(_0x4d32de[_0x0f78('0x33')][_0x0f78('0x41')]){if(_0x25f1cd[_0x0f78('0x72')]==='CmContact'){_0x51b7c1[_0x0f78('0x42')]=[{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0f78('0x29'),_0x0f78('0x80')],'required':_0x4d32de['query']['tag']?!![]:![]},{'model':db[_0x0f78('0x81')],'as':'ThroughTags','attributes':['id',_0x0f78('0x29'),_0x0f78('0x80')],'through':_0x4d32de[_0x0f78('0x33')][_0x0f78('0x82')]?{'attributes':[],'where':{'TagId':_0x4d32de[_0x0f78('0x33')]['tag']||undefined}}:{},'required':_0x4d32de[_0x0f78('0x33')][_0x0f78('0x82')]?!![]:![]}];}else{_0x51b7c1['include']=[{'all':!![]}];}}return db[_0x25f1cd[_0x0f78('0x72')]]['findAll'](_0x51b7c1);})[_0x0f78('0x26')](function(_0x126bf2){_0x1b7ee3[_0x0f78('0x43')]=_0x126bf2;return _0x1b7ee3;});}}else{return _0x1b7ee3;}})[_0x0f78('0x26')](respondWithFilteredResult(_0x200df2,_0x51b7c1))['catch'](handleError(_0x200df2,null));};function getAllResources(_0x6db650,_0xe4278c){return new BPromise(function(_0x162713,_0x5ce343){if(_0xe4278c){var _0xcf7ba7=_0xe4278c[_0x0f78('0x3d')]?{[_0xe4278c['filter'][_0x0f78('0x77')]]:_0xe4278c[_0x0f78('0x3d')][_0x0f78('0x83')]}:undefined;return db[_0x6db650][_0x0f78('0x54')]({'where':_0xcf7ba7,'raw':!![]})['then'](function(_0xd7cb1a){_0xe4278c[_0x0f78('0x7a')]=_['map'](_0xd7cb1a,'id');_0x162713(_0xe4278c);})[_0x0f78('0x48')](function(_0x11b2e3){_0x5ce343(_0x11b2e3);});}else{_0x162713(null);}});}function getAllFilteredResources(_0x43c3ea,_0x5a8e96){return new BPromise(function(_0x5f4bf8,_0x4453a8){var _0x15c80a=_0x43c3ea[_0x0f78('0x3d')]?{[_0x43c3ea[_0x0f78('0x3d')][_0x0f78('0x77')]]:_0x43c3ea[_0x0f78('0x3d')][_0x0f78('0x83')]}:undefined;return db[_0x43c3ea[_0x0f78('0x31')]][_0x0f78('0x54')]({'where':_0x15c80a,'raw':!![]})['then'](function(_0x49fac0){_0x5a8e96['associatedResources']=_[_0x0f78('0x32')](_0x49fac0,function(_0x3cf9db){return _0x3cf9db[_0x0f78('0x29')];});_0x5f4bf8(_0x5a8e96);})['catch'](function(_0xcf7ff7){_0x4453a8(_0xcf7ff7);});});}function getAllowedResources(_0xc8b38f,_0x4e7750,_0x100f23){return new BPromise(function(_0x5930d1,_0x5a1459){if(_0x4e7750){return db[_0x0f78('0x57')][_0x0f78('0x54')]({'where':{'sectionId':_0x4e7750['id']},'raw':!![]})['then'](function(_0x27cdcd){if(_0xc8b38f['field']&&_0xc8b38f[_0x0f78('0x77')]!=='id'){_0x4e7750[_0x0f78('0x7a')]=_[_0x0f78('0x32')](_0x27cdcd,function(_0x2a69c0){return _0x2a69c0[_0xc8b38f['field']];});}else{if(_0x100f23==='AnalyticExtractedReport'){_0x4e7750[_0x0f78('0x7a')]=_[_0x0f78('0x32')](_0x27cdcd,function(_0x570e41){return{'id':_0x570e41[_0x0f78('0x69')],'type':_0x570e41[_0x0f78('0x2f')]};});}else{_0x4e7750[_0x0f78('0x7a')]=_[_0x0f78('0x32')](_0x27cdcd,function(_0x3e0a02){return _0x3e0a02[_0x0f78('0x69')];});}}_0x5930d1(_0x4e7750);})[_0x0f78('0x48')](function(_0x2886d6){_0x5a1459(_0x2886d6);});}else{_0x5930d1(null);}});}function getQueryModels(_0xe6ca23,_0x21d590){var _0xb907d4=_0xe6ca23[_0x0f78('0x84')]();var _0x589835={'childModel':undefined,'parentSections':[]};switch(_0xb907d4){case'squareprojects':_0x589835['childModel']='SquareProject';break;case _0x0f78('0x85'):_0x589835[_0x0f78('0x72')]='SquareOdbc';break;case _0x0f78('0x86'):_0x589835[_0x0f78('0x72')]=_0x0f78('0x87');_0x589835[_0x0f78('0x74')]=[{'name':_0x0f78('0x88'),'field':_0x0f78('0x29'),'foreignKey':_0x0f78('0x89')}];break;case _0x0f78('0x8a'):_0x589835[_0x0f78('0x72')]='JscriptyProject';break;case _0x0f78('0x8b'):_0x589835[_0x0f78('0x72')]=_0x0f78('0x8c');_0x589835['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0x0f78('0x8d')}];break;case _0x0f78('0x8e'):_0x589835['childModel']='CmList';break;case _0x0f78('0x8f'):_0x589835[_0x0f78('0x72')]='CmCompany';break;case _0x0f78('0x90'):_0x589835[_0x0f78('0x72')]=_0x0f78('0x91');break;case'chatqueues':_0x589835['childModel']='ChatQueue';break;case _0x0f78('0x92'):_0x589835[_0x0f78('0x72')]='ChatWebsite';break;case'faxqueues':_0x589835[_0x0f78('0x72')]=_0x0f78('0x93');break;case'faxaccounts':_0x589835[_0x0f78('0x72')]=_0x0f78('0x94');break;case _0x0f78('0x95'):case _0x0f78('0x96'):case'outboundroutes':_0x589835[_0x0f78('0x72')]=_0x0f78('0x97');break;case _0x0f78('0x98'):_0x589835[_0x0f78('0x72')]=_0x0f78('0x99');break;case _0x0f78('0x9a'):_0x589835[_0x0f78('0x72')]='VoiceMail';break;case'voicerecordings':_0x589835[_0x0f78('0x72')]=_0x0f78('0x9b');_0x589835[_0x0f78('0x74')]=[{'name':_0x0f78('0x9c'),'field':_0x0f78('0x29'),'foreignKey':_0x0f78('0x9d'),'model':'User','filter':{'field':'role','value':['agent']}},{'name':_0x0f78('0x9e'),'field':_0x0f78('0x29'),'foreignKey':'membername','model':_0x0f78('0x9f'),'filter':{'field':_0x0f78('0xa0'),'value':['telephone']}},{'name':_0x0f78('0xa1'),'field':'name','foreignKey':'queue','model':_0x0f78('0xa2'),'filter':{'field':'type','value':[_0x0f78('0xa3')]}},{'name':_0x0f78('0xa4'),'field':_0x0f78('0x29'),'foreignKey':_0x0f78('0xa5'),'model':_0x0f78('0xa2'),'filter':{'field':_0x0f78('0x2f'),'value':['outbound']}}];break;case _0x0f78('0xa6'):_0x589835[_0x0f78('0x72')]='VoiceMusicOnHold';break;case'chanspies':_0x589835['childModel']='VoiceChanSpy';break;case'voiceprefixes':_0x589835['childModel']=_0x0f78('0xa7');break;case _0x0f78('0xa8'):_0x589835['childModel']=_0x0f78('0xa9');break;case _0x0f78('0xaa'):_0x589835[_0x0f78('0x72')]=_0x0f78('0xab');break;case _0x0f78('0xac'):_0x589835[_0x0f78('0x72')]=_0x0f78('0xad');break;case'mailsubstatuses':_0x589835[_0x0f78('0x72')]=_0x0f78('0xae');break;case _0x0f78('0xaf'):_0x589835[_0x0f78('0x72')]=_0x0f78('0xb0');break;case'openchannelaccounts':_0x589835[_0x0f78('0x72')]=_0x0f78('0xb1');break;case'smsqueues':_0x589835[_0x0f78('0x72')]=_0x0f78('0xb2');break;case _0x0f78('0xb3'):_0x589835[_0x0f78('0x72')]='SmsAccount';break;case'whatsappqueues':_0x589835[_0x0f78('0x72')]=_0x0f78('0xb4');break;case _0x0f78('0xb5'):_0x589835[_0x0f78('0x72')]=_0x0f78('0xb6');break;case _0x0f78('0xb7'):_0x589835[_0x0f78('0x72')]='Team';break;case _0x0f78('0xb8'):case'queuecampaigns':_0x589835[_0x0f78('0x72')]=_0x0f78('0xa2');if(_0x21d590){_0x589835[_0x0f78('0x74')]=[{'name':'VoiceQueues'},{'name':_0x0f78('0xa4')}];}break;case _0x0f78('0xb9'):case _0x0f78('0xba'):case _0x0f78('0xbb'):_0x589835['childModel']=_0x0f78('0x9f');if(_0x21d590){_0x589835['parentSections']=[{'name':_0x0f78('0xbc'),'filter':{'field':'role','value':[_0x0f78('0xbd'),_0x0f78('0xbe')]},'ignore':!![]},{'name':_0x0f78('0x9c')},{'name':_0x0f78('0x9e')}];}break;case'zendeskaccounts':_0x589835[_0x0f78('0x72')]=_0x0f78('0xbf');break;case _0x0f78('0xc0'):_0x589835['childModel']=_0x0f78('0xc1');break;case'freshdeskaccounts':_0x589835[_0x0f78('0x72')]='FreshdeskAccount';break;case _0x0f78('0xc2'):_0x589835[_0x0f78('0x72')]='SugarcrmAccount';break;case'deskaccounts':_0x589835[_0x0f78('0x72')]=_0x0f78('0xc3');break;case'zohoaccounts':_0x589835[_0x0f78('0x72')]=_0x0f78('0xc4');break;case'vtigeraccounts':_0x589835[_0x0f78('0x72')]=_0x0f78('0x9f');break;case _0x0f78('0xc5'):_0x589835['childModel']=_0x0f78('0xc6');break;case _0x0f78('0xc7'):_0x589835[_0x0f78('0x72')]=_0x0f78('0xc8');break;case _0x0f78('0xc9'):_0x589835[_0x0f78('0x72')]=_0x0f78('0x67');break;case'intervals':_0x589835[_0x0f78('0x72')]=_0x0f78('0xca');break;case _0x0f78('0xcb'):_0x589835[_0x0f78('0x72')]='Pause';break;case _0x0f78('0xcc'):_0x589835['childModel']=_0x0f78('0xcd');break;case _0x0f78('0xce'):_0x589835[_0x0f78('0x72')]=_0x0f78('0xcf');break;case'tags':_0x589835[_0x0f78('0x72')]=_0x0f78('0x81');break;case _0x0f78('0xd0'):_0x589835[_0x0f78('0x72')]='Template';break;case'triggers':_0x589835['childModel']=_0x0f78('0xd1');break;case _0x0f78('0xd2'):_0x589835[_0x0f78('0x72')]='Trunk';break;case'variables':_0x589835[_0x0f78('0x72')]=_0x0f78('0xd3');break;case _0x0f78('0xd4'):_0x589835[_0x0f78('0x72')]=_0x0f78('0x6a');break;case _0x0f78('0xd5'):_0x589835[_0x0f78('0x72')]=_0x0f78('0x78');_0x589835['parentSections']=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x0f78('0xd6'):_0x589835[_0x0f78('0x72')]='AnalyticMetric';break;case _0x0f78('0xb5'):_0x589835[_0x0f78('0x72')]='WhatsappAccount';break;default:return _0x589835;}return _0x589835;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 6687bf5..33e425f 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 _0x09e6=['emit','hasOwnProperty','hook','exports','events','UserProfile','save','update','remove'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x09e6,0x1c6));var _0x609e=function(_0x49ba2b,_0x1783e0){_0x49ba2b=_0x49ba2b-0x0;var _0x168432=_0x09e6[_0x49ba2b];return _0x168432;};'use strict';var EventEmitter=require(_0x609e('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x609e('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x609e('0x2'),'afterUpdate':_0x609e('0x3'),'afterDestroy':_0x609e('0x4')};function emitEvent(_0x472374){return function(_0x13c99e,_0x5ea7ec,_0x36d103){UserProfileEvents[_0x609e('0x5')](_0x472374+':'+_0x13c99e['id'],_0x13c99e);UserProfileEvents[_0x609e('0x5')](_0x472374,_0x13c99e);_0x36d103(null);};}for(var e in events){if(events[_0x609e('0x6')](e)){var event=events[e];UserProfile[_0x609e('0x7')](e,emitEvent(event));}}module[_0x609e('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xa683=['update','remove','emit','hasOwnProperty','exports','events','UserProfile','setMaxListeners','save'];(function(_0x375923,_0x3bf77f){var _0x3f15ab=function(_0x4f4037){while(--_0x4f4037){_0x375923['push'](_0x375923['shift']());}};_0x3f15ab(++_0x3bf77f);}(_0xa683,0xa7));var _0x3a68=function(_0x533c20,_0x2073c2){_0x533c20=_0x533c20-0x0;var _0x34d588=_0xa683[_0x533c20];return _0x34d588;};'use strict';var EventEmitter=require(_0x3a68('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x3a68('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3a68('0x2')](0x0);var events={'afterCreate':_0x3a68('0x3'),'afterUpdate':_0x3a68('0x4'),'afterDestroy':_0x3a68('0x5')};function emitEvent(_0xa07011){return function(_0x3f1ea1,_0x39a4bd,_0x12c59e){UserProfileEvents[_0x3a68('0x6')](_0xa07011+':'+_0x3f1ea1['id'],_0x3f1ea1);UserProfileEvents['emit'](_0xa07011,_0x3f1ea1);_0x12c59e(null);};}for(var e in events){if(events[_0x3a68('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x3a68('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index cfb85ca..1fe5bfa 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 _0xcb44=['user_profiles','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userProfile.attributes','exports','define','UserProfile'];(function(_0x3bee55,_0x4e25c8){var _0x5649d2=function(_0x13d730){while(--_0x13d730){_0x3bee55['push'](_0x3bee55['shift']());}};_0x5649d2(++_0x4e25c8);}(_0xcb44,0x119));var _0x4cb4=function(_0x1a87b3,_0x45ba68){_0x1a87b3=_0x1a87b3-0x0;var _0x37e84d=_0xcb44[_0x1a87b3];return _0x37e84d;};'use strict';var _=require(_0x4cb4('0x0'));var util=require(_0x4cb4('0x1'));var logger=require(_0x4cb4('0x2'))(_0x4cb4('0x3'));var moment=require(_0x4cb4('0x4'));var BPromise=require(_0x4cb4('0x5'));var rp=require(_0x4cb4('0x6'));var fs=require('fs');var path=require(_0x4cb4('0x7'));var rimraf=require(_0x4cb4('0x8'));var config=require('../../config/environment');var attributes=require(_0x4cb4('0x9'));module[_0x4cb4('0xa')]=function(_0x4a33fe,_0x1ffd37){return _0x4a33fe[_0x4cb4('0xb')](_0x4cb4('0xc'),attributes,{'tableName':_0x4cb4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd265=['./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x96443,_0x211ad4){var _0x4e91b1=function(_0xab625d){while(--_0xab625d){_0x96443['push'](_0x96443['shift']());}};_0x4e91b1(++_0x211ad4);}(_0xd265,0x131));var _0x5d26=function(_0xc5a932,_0x11ff7a){_0xc5a932=_0xc5a932-0x0;var _0x4da333=_0xd265[_0xc5a932];return _0x4da333;};'use strict';var _=require(_0x5d26('0x0'));var util=require(_0x5d26('0x1'));var logger=require(_0x5d26('0x2'))(_0x5d26('0x3'));var moment=require(_0x5d26('0x4'));var BPromise=require(_0x5d26('0x5'));var rp=require(_0x5d26('0x6'));var fs=require('fs');var path=require(_0x5d26('0x7'));var rimraf=require(_0x5d26('0x8'));var config=require(_0x5d26('0x9'));var attributes=require(_0x5d26('0xa'));module[_0x5d26('0xb')]=function(_0x22f30a,_0x3145ec){return _0x22f30a[_0x5d26('0xc')](_0x5d26('0xd'),attributes,{'tableName':_0x5d26('0xe'),'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 63cfa6e..5842c5d 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 _0x7da7=['error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./userProfile.socket','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x223ed4,_0x2b5917){var _0x45e28b=function(_0x55d157){while(--_0x55d157){_0x223ed4['push'](_0x223ed4['shift']());}};_0x45e28b(++_0x2b5917);}(_0x7da7,0x10d));var _0x77da=function(_0x3e478c,_0x152670){_0x3e478c=_0x3e478c-0x0;var _0x29ef89=_0x7da7[_0x3e478c];return _0x29ef89;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77da('0x3'));var db=require(_0x77da('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77da('0x5'))(_0x77da('0x6'));var config=require('../../config/environment');var jayson=require(_0x77da('0x7'));var client=jayson[_0x77da('0x8')]['http']({'port':0x232a});config[_0x77da('0x9')]=_['defaults'](config[_0x77da('0x9')],{'host':_0x77da('0xa'),'port':0x18eb});var socket=require(_0x77da('0xb'))(new Redis(config[_0x77da('0x9')]));require(_0x77da('0xc'))['register'](socket);function respondWithRpcPromise(_0x40c86e,_0xb55827,_0x172d7f){return new BPromise(function(_0x5ea12f,_0x35d06e){return client[_0x77da('0xd')](_0x40c86e,_0x172d7f)[_0x77da('0xe')](function(_0x2a675a){logger['info'](_0x77da('0xf'),_0xb55827,_0x77da('0x10'));logger[_0x77da('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0xb55827,'request\x20sent',JSON[_0x77da('0x12')](_0x2a675a));if(_0x2a675a[_0x77da('0x13')]){if(_0x2a675a['error'][_0x77da('0x14')]===0x1f4){logger[_0x77da('0x13')](_0x77da('0xf'),_0xb55827,_0x2a675a[_0x77da('0x13')]['message']);return _0x35d06e(_0x2a675a[_0x77da('0x13')]['message']);}logger[_0x77da('0x13')](_0x77da('0xf'),_0xb55827,_0x2a675a[_0x77da('0x13')][_0x77da('0x15')]);return _0x5ea12f(_0x2a675a['error']['message']);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0xb55827,_0x77da('0x10'));_0x5ea12f(_0x2a675a[_0x77da('0x16')][_0x77da('0x15')]);}})[_0x77da('0x17')](function(_0x19a00c){logger[_0x77da('0x13')](_0x77da('0xf'),_0xb55827,_0x19a00c);_0x35d06e(_0x19a00c);});});} \ No newline at end of file +var _0xeda8=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xeda8,0x104));var _0x8eda=function(_0x41f33d,_0x3679ca){_0x41f33d=_0x41f33d-0x0;var _0x536f16=_0xeda8[_0x41f33d];return _0x536f16;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});config[_0x8eda('0xd')]=_['defaults'](config[_0x8eda('0xd')],{'host':_0x8eda('0xe'),'port':0x18eb});var socket=require(_0x8eda('0xf'))(new Redis(config[_0x8eda('0xd')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x488849,_0x4fbf0a,_0xe69181){return new BPromise(function(_0x2d3739,_0x41442d){return client['request'](_0x488849,_0xe69181)[_0x8eda('0x10')](function(_0x5a80ca){logger[_0x8eda('0x11')](_0x8eda('0x12'),_0x4fbf0a,_0x8eda('0x13'));logger[_0x8eda('0x14')](_0x8eda('0x15'),_0x4fbf0a,_0x8eda('0x13'),JSON[_0x8eda('0x16')](_0x5a80ca));if(_0x5a80ca[_0x8eda('0x17')]){if(_0x5a80ca['error']['code']===0x1f4){logger[_0x8eda('0x17')](_0x8eda('0x12'),_0x4fbf0a,_0x5a80ca['error'][_0x8eda('0x18')]);return _0x41442d(_0x5a80ca[_0x8eda('0x17')][_0x8eda('0x18')]);}logger['error'](_0x8eda('0x12'),_0x4fbf0a,_0x5a80ca['error'][_0x8eda('0x18')]);return _0x2d3739(_0x5a80ca['error'][_0x8eda('0x18')]);}else{logger['info'](_0x8eda('0x12'),_0x4fbf0a,_0x8eda('0x13'));_0x2d3739(_0x5a80ca['result']['message']);}})[_0x8eda('0x19')](function(_0x1b7e94){logger[_0x8eda('0x17')](_0x8eda('0x12'),_0x4fbf0a,_0x1b7e94);_0x41442d(_0x1b7e94);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 6ae67b7..a20772c 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 _0x38d4=['update','emit','removeListener','register','length','./userProfile.events','remove'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x38d4,0x1cc));var _0x438d=function(_0xcb813d,_0x204798){_0xcb813d=_0xcb813d-0x0;var _0x259ee8=_0x38d4[_0xcb813d];return _0x259ee8;};'use strict';var UserProfileEvents=require(_0x438d('0x0'));var events=['save',_0x438d('0x1'),_0x438d('0x2')];function createListener(_0x283813,_0x4eca06){return function(_0xc1615){_0x4eca06[_0x438d('0x3')](_0x283813,_0xc1615);};}function removeListener(_0x1e24a6,_0x1f5869){return function(){UserProfileEvents[_0x438d('0x4')](_0x1e24a6,_0x1f5869);};}exports[_0x438d('0x5')]=function(_0x26bf3a){for(var _0x39a768=0x0,_0xdd9846=events[_0x438d('0x6')];_0x39a768<_0xdd9846;_0x39a768++){var _0x261e16=events[_0x39a768];var _0x4b1afd=createListener('userProfile:'+_0x261e16,_0x26bf3a);UserProfileEvents['on'](_0x261e16,_0x4b1afd);}}; \ No newline at end of file +var _0xc6e7=['removeListener','register','./userProfile.events','save','remove','update','emit'];(function(_0x4faf34,_0x217679){var _0x4e431f=function(_0x3da540){while(--_0x3da540){_0x4faf34['push'](_0x4faf34['shift']());}};_0x4e431f(++_0x217679);}(_0xc6e7,0x1de));var _0x7c6e=function(_0x4d246d,_0x18a8df){_0x4d246d=_0x4d246d-0x0;var _0x41096a=_0xc6e7[_0x4d246d];return _0x41096a;};'use strict';var UserProfileEvents=require(_0x7c6e('0x0'));var events=[_0x7c6e('0x1'),_0x7c6e('0x2'),_0x7c6e('0x3')];function createListener(_0x281cdc,_0x4595f4){return function(_0x487871){_0x4595f4[_0x7c6e('0x4')](_0x281cdc,_0x487871);};}function removeListener(_0xa91a88,_0x4aa4e5){return function(){UserProfileEvents[_0x7c6e('0x5')](_0xa91a88,_0x4aa4e5);};}exports[_0x7c6e('0x6')]=function(_0x2cd361){for(var _0x10cc10=0x0,_0x3435d9=events['length'];_0x10cc10<_0x3435d9;_0x10cc10++){var _0x4c6fb5=events[_0x10cc10];var _0x1f713f=createListener('userProfile:'+_0x4c6fb5,_0x2cd361);UserProfileEvents['on'](_0x4c6fb5,_0x1f713f);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 560d4ad..c8e59cf 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 _0x7e88=['delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update'];(function(_0x23e12b,_0x23ef2f){var _0x1a1866=function(_0x364bbd){while(--_0x364bbd){_0x23e12b['push'](_0x23e12b['shift']());}};_0x1a1866(++_0x23ef2f);}(_0x7e88,0x81));var _0x87e8=function(_0x4cb524,_0x4d928b){_0x4cb524=_0x4cb524-0x0;var _0x15b076=_0x7e88[_0x4cb524];return _0x15b076;};'use strict';var multer=require(_0x87e8('0x0'));var util=require('util');var path=require(_0x87e8('0x1'));var timeout=require(_0x87e8('0x2'));var express=require(_0x87e8('0x3'));var router=express['Router']();var auth=require(_0x87e8('0x4'));var interaction=require(_0x87e8('0x5'));var config=require(_0x87e8('0x6'));var controller=require('./userProfileResource.controller');router[_0x87e8('0x7')]('/',auth[_0x87e8('0x8')](),controller[_0x87e8('0x9')]);router[_0x87e8('0x7')](_0x87e8('0xa'),auth[_0x87e8('0x8')](),controller[_0x87e8('0xb')]);router[_0x87e8('0x7')]('/:id',auth[_0x87e8('0x8')](),controller[_0x87e8('0xc')]);router[_0x87e8('0xd')]('/',auth['isAuthenticated'](),controller[_0x87e8('0xe')]);router[_0x87e8('0xf')](_0x87e8('0x10'),auth[_0x87e8('0x8')](),controller[_0x87e8('0x11')]);router[_0x87e8('0x12')](_0x87e8('0x10'),auth['isAuthenticated'](),controller[_0x87e8('0x13')]);module[_0x87e8('0x14')]=router; \ No newline at end of file +var _0xb24d=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','destroy','exports','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb24d,0x1b4));var _0xdb24=function(_0x12b2c2,_0x21bb82){_0x12b2c2=_0x12b2c2-0x0;var _0x4380a4=_0xb24d[_0x12b2c2];return _0x4380a4;};'use strict';var multer=require('multer');var util=require(_0xdb24('0x0'));var path=require(_0xdb24('0x1'));var timeout=require(_0xdb24('0x2'));var express=require(_0xdb24('0x3'));var router=express['Router']();var auth=require(_0xdb24('0x4'));var interaction=require(_0xdb24('0x5'));var config=require(_0xdb24('0x6'));var controller=require(_0xdb24('0x7'));router[_0xdb24('0x8')]('/',auth[_0xdb24('0x9')](),controller[_0xdb24('0xa')]);router[_0xdb24('0x8')](_0xdb24('0xb'),auth[_0xdb24('0x9')](),controller[_0xdb24('0xc')]);router['get'](_0xdb24('0xd'),auth[_0xdb24('0x9')](),controller[_0xdb24('0xe')]);router['post']('/',auth[_0xdb24('0x9')](),controller[_0xdb24('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdb24('0x10')]);router['delete'](_0xdb24('0xd'),auth['isAuthenticated'](),controller[_0xdb24('0x11')]);module[_0xdb24('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 30c4aca..1b08125 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 _0x7021=['INTEGER','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7021,0x109));var _0x1702=function(_0x1fdff9,_0x4c4bf4){_0x1fdff9=_0x1fdff9-0x0;var _0x3d1b6e=_0x7021[_0x1fdff9];return _0x3d1b6e;};'use strict';var Sequelize=require('sequelize');module[_0x1702('0x0')]={'name':{'type':Sequelize[_0x1702('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x1702('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x98ad=['INTEGER','exports','STRING'];(function(_0x5169bc,_0x2f6a79){var _0xd437b0=function(_0x5b42fd){while(--_0x5b42fd){_0x5169bc['push'](_0x5169bc['shift']());}};_0xd437b0(++_0x2f6a79);}(_0x98ad,0x1f0));var _0xd98a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x98ad[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0xd98a('0x0')]={'name':{'type':Sequelize[_0xd98a('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xd98a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd98a('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 9bcbae1..1c3fc27 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 _0xcd59=['show','params','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch'];(function(_0x3bb201,_0x55a6d0){var _0x35e5bc=function(_0xcf92f8){while(--_0xcf92f8){_0x3bb201['push'](_0x3bb201['shift']());}};_0x35e5bc(++_0x55a6d0);}(_0xcd59,0x14b));var _0x9cd5=function(_0x1fcc1e,_0x39efee){_0x1fcc1e=_0x1fcc1e-0x0;var _0x13497a=_0xcd59[_0x1fcc1e];return _0x13497a;};'use strict';var pdf=require(_0x9cd5('0x0'));var emlformat=require(_0x9cd5('0x1'));var rimraf=require(_0x9cd5('0x2'));var zipdir=require(_0x9cd5('0x3'));var jsonpatch=require(_0x9cd5('0x4'));var rp=require(_0x9cd5('0x5'));var moment=require('moment');var BPromise=require(_0x9cd5('0x6'));var Mustache=require(_0x9cd5('0x7'));var util=require(_0x9cd5('0x8'));var path=require(_0x9cd5('0x9'));var sox=require(_0x9cd5('0xa'));var csv=require(_0x9cd5('0xb'));var ejs=require(_0x9cd5('0xc'));var fs=require('fs');var _=require(_0x9cd5('0xd'));var squel=require(_0x9cd5('0xe'));var crypto=require(_0x9cd5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9cd5('0x10'));var toCsv=require(_0x9cd5('0xb'));var querystring=require(_0x9cd5('0x11'));var Papa=require(_0x9cd5('0x12'));var Redis=require(_0x9cd5('0x13'));var authService=require(_0x9cd5('0x14'));var qs=require(_0x9cd5('0x15'));var as=require(_0x9cd5('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cd5('0x17'))(_0x9cd5('0x18'));var utils=require(_0x9cd5('0x19'));var config=require(_0x9cd5('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58d6de,_0x2c9cf1){_0x2c9cf1=_0x2c9cf1||0xcc;return function(_0x172e29){if(_0x172e29){return _0x58d6de[_0x9cd5('0x1b')](_0x2c9cf1);}return _0x58d6de[_0x9cd5('0x1c')](_0x2c9cf1)[_0x9cd5('0x1d')]();};}function respondWithResult(_0x2a1606,_0x52698b){_0x52698b=_0x52698b||0xc8;return function(_0x15b639){if(_0x15b639){return _0x2a1606[_0x9cd5('0x1c')](_0x52698b)[_0x9cd5('0x1e')](_0x15b639);}};}function respondWithFilteredResult(_0x4b9ac8,_0x541cb8){return function(_0x5c4f3d){if(_0x5c4f3d){var _0x258305=_0x5c4f3d[_0x9cd5('0x1f')],_0x1ea3f7=_0x541cb8[_0x9cd5('0x20')],_0x565db7=_0x541cb8['offset']+_0x541cb8[_0x9cd5('0x21')],_0x24c233;if(_0x565db7>=_0x258305){_0x565db7=_0x258305;_0x24c233=0xc8;}else{_0x24c233=0xce;}_0x4b9ac8[_0x9cd5('0x1c')](_0x24c233);return _0x4b9ac8[_0x9cd5('0x22')](_0x9cd5('0x23'),_0x1ea3f7+'-'+_0x565db7+'/'+_0x258305)[_0x9cd5('0x1e')](_0x5c4f3d);}return null;};}function patchUpdates(_0x1ff788){return function(_0x5c1622){try{jsonpatch[_0x9cd5('0x24')](_0x5c1622,_0x1ff788,!![]);}catch(_0x18346f){return BPromise[_0x9cd5('0x25')](_0x18346f);}return _0x5c1622[_0x9cd5('0x26')]();};}function saveUpdates(_0x2e2b47,_0x4ed8b9){return function(_0x16c4e9){if(_0x16c4e9){return _0x16c4e9[_0x9cd5('0x27')](_0x2e2b47)[_0x9cd5('0x28')](function(_0x12e402){return _0x12e402;});}return null;};}function removeEntity(_0x2ce1ae,_0x1185d7){return function(_0x1cf603){if(_0x1cf603){return _0x1cf603[_0x9cd5('0x29')]()[_0x9cd5('0x28')](function(){_0x2ce1ae['status'](0xcc)[_0x9cd5('0x1d')]();});}};}function handleEntityNotFound(_0xba8ee9,_0x1a88e3){return function(_0x43f47d){if(!_0x43f47d){_0xba8ee9['sendStatus'](0x194);}return _0x43f47d;};}function handleError(_0x24ae67,_0x990c25){_0x990c25=_0x990c25||0x1f4;return function(_0x211576){logger[_0x9cd5('0x2a')](_0x211576[_0x9cd5('0x2b')]);if(_0x211576[_0x9cd5('0x2c')]){delete _0x211576[_0x9cd5('0x2c')];}_0x24ae67['status'](_0x990c25)[_0x9cd5('0x2d')](_0x211576);};}exports[_0x9cd5('0x2e')]=function(_0x2f1e4b,_0x4af6c8){var _0x5c33e9={},_0x2e45a3={},_0x502257={'count':0x0,'rows':[]};var _0x52ef5d=_[_0x9cd5('0x2f')](db[_0x9cd5('0x30')][_0x9cd5('0x31')],function(_0x5184b9){return{'name':_0x5184b9[_0x9cd5('0x32')],'type':_0x5184b9[_0x9cd5('0x33')][_0x9cd5('0x34')]};});_0x2e45a3[_0x9cd5('0x35')]=_[_0x9cd5('0x2f')](_0x52ef5d,_0x9cd5('0x2c'));_0x2e45a3[_0x9cd5('0x36')]=_[_0x9cd5('0x37')](_0x2f1e4b[_0x9cd5('0x36')]);_0x2e45a3[_0x9cd5('0x38')]=_[_0x9cd5('0x39')](_0x2e45a3[_0x9cd5('0x35')],_0x2e45a3[_0x9cd5('0x36')]);_0x5c33e9[_0x9cd5('0x3a')]=_['intersection'](_0x2e45a3[_0x9cd5('0x35')],qs[_0x9cd5('0x3b')](_0x2f1e4b['query']['fields']));_0x5c33e9[_0x9cd5('0x3a')]=_0x5c33e9[_0x9cd5('0x3a')]['length']?_0x5c33e9[_0x9cd5('0x3a')]:_0x2e45a3['model'];if(!_0x2f1e4b['query'][_0x9cd5('0x3c')](_0x9cd5('0x3d'))){_0x5c33e9[_0x9cd5('0x21')]=qs[_0x9cd5('0x21')](_0x2f1e4b['query'][_0x9cd5('0x21')]);_0x5c33e9[_0x9cd5('0x20')]=qs[_0x9cd5('0x20')](_0x2f1e4b['query'][_0x9cd5('0x20')]);}_0x5c33e9[_0x9cd5('0x3e')]=qs[_0x9cd5('0x3f')](_0x2f1e4b[_0x9cd5('0x36')][_0x9cd5('0x3f')]);_0x5c33e9[_0x9cd5('0x40')]=qs[_0x9cd5('0x38')](_[_0x9cd5('0x41')](_0x2f1e4b[_0x9cd5('0x36')],_0x2e45a3[_0x9cd5('0x38')]),_0x52ef5d);if(_0x2f1e4b[_0x9cd5('0x36')]['filter']){_0x5c33e9[_0x9cd5('0x40')]=_['merge'](_0x5c33e9['where'],{'$or':_[_0x9cd5('0x2f')](_0x52ef5d,function(_0x3cf5e9){if(_0x3cf5e9[_0x9cd5('0x33')]!==_0x9cd5('0x42')){var _0x54bc49={};_0x54bc49[_0x3cf5e9[_0x9cd5('0x2c')]]={'$like':'%'+_0x2f1e4b[_0x9cd5('0x36')][_0x9cd5('0x43')]+'%'};return _0x54bc49;}})});}_0x5c33e9=_[_0x9cd5('0x44')]({},_0x5c33e9,_0x2f1e4b['options']);var _0x36e22c={'where':_0x5c33e9[_0x9cd5('0x40')]};return db[_0x9cd5('0x30')][_0x9cd5('0x1f')](_0x36e22c)[_0x9cd5('0x28')](function(_0x16e6b3){_0x502257['count']=_0x16e6b3;if(_0x2f1e4b[_0x9cd5('0x36')][_0x9cd5('0x45')]){_0x5c33e9[_0x9cd5('0x46')]=[{'all':!![]}];}return db[_0x9cd5('0x30')][_0x9cd5('0x47')](_0x5c33e9);})[_0x9cd5('0x28')](function(_0x12d604){_0x502257[_0x9cd5('0x48')]=_0x12d604;return _0x502257;})[_0x9cd5('0x28')](respondWithFilteredResult(_0x4af6c8,_0x5c33e9))[_0x9cd5('0x49')](handleError(_0x4af6c8,null));};exports[_0x9cd5('0x4a')]=function(_0x3ed405,_0x7ad8ec){var _0xa12319={'raw':![],'where':{'id':_0x3ed405[_0x9cd5('0x4b')]['id']}},_0x3b316b={};_0x3b316b[_0x9cd5('0x35')]=_[_0x9cd5('0x37')](db['UserProfileResource'][_0x9cd5('0x31')]);_0x3b316b['query']=_[_0x9cd5('0x37')](_0x3ed405[_0x9cd5('0x36')]);_0x3b316b[_0x9cd5('0x38')]=_[_0x9cd5('0x39')](_0x3b316b[_0x9cd5('0x35')],_0x3b316b['query']);_0xa12319[_0x9cd5('0x3a')]=_[_0x9cd5('0x39')](_0x3b316b[_0x9cd5('0x35')],qs['fields'](_0x3ed405[_0x9cd5('0x36')][_0x9cd5('0x3b')]));_0xa12319[_0x9cd5('0x3a')]=_0xa12319[_0x9cd5('0x3a')]['length']?_0xa12319[_0x9cd5('0x3a')]:_0x3b316b[_0x9cd5('0x35')];if(_0x3ed405[_0x9cd5('0x36')][_0x9cd5('0x45')]){_0xa12319[_0x9cd5('0x46')]=[{'all':!![]}];}_0xa12319=_[_0x9cd5('0x44')]({},_0xa12319,_0x3ed405[_0x9cd5('0x4c')]);return db[_0x9cd5('0x30')][_0x9cd5('0x4d')](_0xa12319)[_0x9cd5('0x28')](handleEntityNotFound(_0x7ad8ec,null))[_0x9cd5('0x28')](respondWithResult(_0x7ad8ec,null))[_0x9cd5('0x49')](handleError(_0x7ad8ec,null));};exports[_0x9cd5('0x4e')]=function(_0x1e1ba0,_0x245f9e){return db[_0x9cd5('0x30')][_0x9cd5('0x4e')](_0x1e1ba0[_0x9cd5('0x4f')],{})['then'](respondWithResult(_0x245f9e,0xc9))[_0x9cd5('0x49')](handleError(_0x245f9e,null));};exports[_0x9cd5('0x27')]=function(_0x3fead7,_0x2058a6){if(_0x3fead7['body']['id']){delete _0x3fead7[_0x9cd5('0x4f')]['id'];}return db[_0x9cd5('0x30')]['find']({'where':{'id':_0x3fead7[_0x9cd5('0x4b')]['id']}})[_0x9cd5('0x28')](handleEntityNotFound(_0x2058a6,null))[_0x9cd5('0x28')](saveUpdates(_0x3fead7[_0x9cd5('0x4f')],null))[_0x9cd5('0x28')](respondWithResult(_0x2058a6,null))[_0x9cd5('0x49')](handleError(_0x2058a6,null));};exports[_0x9cd5('0x29')]=function(_0x14c585,_0x5b6c7d){return db['UserProfileResource'][_0x9cd5('0x4d')]({'where':{'id':_0x14c585[_0x9cd5('0x4b')]['id']}})[_0x9cd5('0x28')](handleEntityNotFound(_0x5b6c7d,null))[_0x9cd5('0x28')](removeEntity(_0x5b6c7d,null))['catch'](handleError(_0x5b6c7d,null));};exports[_0x9cd5('0x50')]=function(_0x55ac13,_0x5d4463){return db[_0x9cd5('0x30')][_0x9cd5('0x50')]()[_0x9cd5('0x28')](respondWithResult(_0x5d4463,null))['catch'](handleError(_0x5d4463,null));}; \ No newline at end of file +var _0xcb99=['describe','html-pdf','rimraf','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','save','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','length','includeAll','find','create','body'];(function(_0x592d66,_0x2d10a1){var _0x3ca426=function(_0x17aed7){while(--_0x17aed7){_0x592d66['push'](_0x592d66['shift']());}};_0x3ca426(++_0x2d10a1);}(_0xcb99,0x8b));var _0x9cb9=function(_0x35e75a,_0x5ed225){_0x35e75a=_0x35e75a-0x0;var _0xb23c7f=_0xcb99[_0x35e75a];return _0xb23c7f;};'use strict';var pdf=require(_0x9cb9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9cb9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9cb9('0x2'));var moment=require(_0x9cb9('0x3'));var BPromise=require(_0x9cb9('0x4'));var Mustache=require('mustache');var util=require(_0x9cb9('0x5'));var path=require(_0x9cb9('0x6'));var sox=require('sox');var csv=require(_0x9cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9cb9('0x8'));var squel=require(_0x9cb9('0x9'));var crypto=require(_0x9cb9('0xa'));var jsforce=require(_0x9cb9('0xb'));var deskjs=require(_0x9cb9('0xc'));var toCsv=require(_0x9cb9('0x7'));var querystring=require(_0x9cb9('0xd'));var Papa=require(_0x9cb9('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9cb9('0xf'));var as=require(_0x9cb9('0x10'));var hardwareService=require(_0x9cb9('0x11'));var logger=require('../../config/logger')(_0x9cb9('0x12'));var utils=require(_0x9cb9('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x227d49,_0x2e687e){_0x2e687e=_0x2e687e||0xcc;return function(_0x3382c8){if(_0x3382c8){return _0x227d49[_0x9cb9('0x14')](_0x2e687e);}return _0x227d49['status'](_0x2e687e)[_0x9cb9('0x15')]();};}function respondWithResult(_0x37dc98,_0x3ec500){_0x3ec500=_0x3ec500||0xc8;return function(_0x32352d){if(_0x32352d){return _0x37dc98[_0x9cb9('0x16')](_0x3ec500)[_0x9cb9('0x17')](_0x32352d);}};}function respondWithFilteredResult(_0xc0bf6,_0x2132be){return function(_0x3975a5){if(_0x3975a5){var _0x2275ca=_0x3975a5[_0x9cb9('0x18')],_0x107057=_0x2132be[_0x9cb9('0x19')],_0x191199=_0x2132be[_0x9cb9('0x19')]+_0x2132be[_0x9cb9('0x1a')],_0x220ee8;if(_0x191199>=_0x2275ca){_0x191199=_0x2275ca;_0x220ee8=0xc8;}else{_0x220ee8=0xce;}_0xc0bf6[_0x9cb9('0x16')](_0x220ee8);return _0xc0bf6['set']('Content-Range',_0x107057+'-'+_0x191199+'/'+_0x2275ca)[_0x9cb9('0x17')](_0x3975a5);}return null;};}function patchUpdates(_0x50169f){return function(_0x5ddf77){try{jsonpatch['apply'](_0x5ddf77,_0x50169f,!![]);}catch(_0x97ecd2){return BPromise['reject'](_0x97ecd2);}return _0x5ddf77[_0x9cb9('0x1b')]();};}function saveUpdates(_0x3b1244,_0xe2bd56){return function(_0xab3d4f){if(_0xab3d4f){return _0xab3d4f[_0x9cb9('0x1c')](_0x3b1244)[_0x9cb9('0x1d')](function(_0x345a21){return _0x345a21;});}return null;};}function removeEntity(_0x1375e3,_0x20d210){return function(_0x169948){if(_0x169948){return _0x169948[_0x9cb9('0x1e')]()[_0x9cb9('0x1d')](function(){_0x1375e3[_0x9cb9('0x16')](0xcc)[_0x9cb9('0x15')]();});}};}function handleEntityNotFound(_0x4cc235,_0x57fc41){return function(_0x3f2e58){if(!_0x3f2e58){_0x4cc235[_0x9cb9('0x14')](0x194);}return _0x3f2e58;};}function handleError(_0x274ab3,_0x377e6f){_0x377e6f=_0x377e6f||0x1f4;return function(_0x1a8d88){logger[_0x9cb9('0x1f')](_0x1a8d88[_0x9cb9('0x20')]);if(_0x1a8d88[_0x9cb9('0x21')]){delete _0x1a8d88[_0x9cb9('0x21')];}_0x274ab3['status'](_0x377e6f)[_0x9cb9('0x22')](_0x1a8d88);};}exports[_0x9cb9('0x23')]=function(_0x32f8e6,_0x40649c){var _0x4db8a4={},_0xa1a575={},_0x567e9b={'count':0x0,'rows':[]};var _0x263299=_[_0x9cb9('0x24')](db[_0x9cb9('0x25')][_0x9cb9('0x26')],function(_0x555ce5){return{'name':_0x555ce5[_0x9cb9('0x27')],'type':_0x555ce5[_0x9cb9('0x28')][_0x9cb9('0x29')]};});_0xa1a575['model']=_[_0x9cb9('0x24')](_0x263299,'name');_0xa1a575[_0x9cb9('0x2a')]=_[_0x9cb9('0x2b')](_0x32f8e6[_0x9cb9('0x2a')]);_0xa1a575[_0x9cb9('0x2c')]=_[_0x9cb9('0x2d')](_0xa1a575[_0x9cb9('0x2e')],_0xa1a575['query']);_0x4db8a4[_0x9cb9('0x2f')]=_[_0x9cb9('0x2d')](_0xa1a575[_0x9cb9('0x2e')],qs['fields'](_0x32f8e6['query'][_0x9cb9('0x30')]));_0x4db8a4[_0x9cb9('0x2f')]=_0x4db8a4[_0x9cb9('0x2f')]['length']?_0x4db8a4['attributes']:_0xa1a575[_0x9cb9('0x2e')];if(!_0x32f8e6[_0x9cb9('0x2a')]['hasOwnProperty'](_0x9cb9('0x31'))){_0x4db8a4[_0x9cb9('0x1a')]=qs[_0x9cb9('0x1a')](_0x32f8e6[_0x9cb9('0x2a')][_0x9cb9('0x1a')]);_0x4db8a4['offset']=qs[_0x9cb9('0x19')](_0x32f8e6[_0x9cb9('0x2a')]['offset']);}_0x4db8a4[_0x9cb9('0x32')]=qs['sort'](_0x32f8e6[_0x9cb9('0x2a')][_0x9cb9('0x33')]);_0x4db8a4['where']=qs['filters'](_[_0x9cb9('0x34')](_0x32f8e6[_0x9cb9('0x2a')],_0xa1a575[_0x9cb9('0x2c')]),_0x263299);if(_0x32f8e6[_0x9cb9('0x2a')][_0x9cb9('0x35')]){_0x4db8a4[_0x9cb9('0x36')]=_[_0x9cb9('0x37')](_0x4db8a4['where'],{'$or':_[_0x9cb9('0x24')](_0x263299,function(_0x95e15b){if(_0x95e15b[_0x9cb9('0x28')]!==_0x9cb9('0x38')){var _0x1ffd5a={};_0x1ffd5a[_0x95e15b[_0x9cb9('0x21')]]={'$like':'%'+_0x32f8e6['query'][_0x9cb9('0x35')]+'%'};return _0x1ffd5a;}})});}_0x4db8a4=_[_0x9cb9('0x37')]({},_0x4db8a4,_0x32f8e6[_0x9cb9('0x39')]);var _0x31f8d7={'where':_0x4db8a4[_0x9cb9('0x36')]};return db[_0x9cb9('0x25')][_0x9cb9('0x18')](_0x31f8d7)[_0x9cb9('0x1d')](function(_0x481377){_0x567e9b['count']=_0x481377;if(_0x32f8e6[_0x9cb9('0x2a')]['includeAll']){_0x4db8a4[_0x9cb9('0x3a')]=[{'all':!![]}];}return db['UserProfileResource'][_0x9cb9('0x3b')](_0x4db8a4);})[_0x9cb9('0x1d')](function(_0x250244){_0x567e9b[_0x9cb9('0x3c')]=_0x250244;return _0x567e9b;})['then'](respondWithFilteredResult(_0x40649c,_0x4db8a4))[_0x9cb9('0x3d')](handleError(_0x40649c,null));};exports['show']=function(_0x9a4f8,_0x3e8aad){var _0x5ac1d7={'raw':![],'where':{'id':_0x9a4f8[_0x9cb9('0x3e')]['id']}},_0x11435f={};_0x11435f['model']=_[_0x9cb9('0x2b')](db[_0x9cb9('0x25')][_0x9cb9('0x26')]);_0x11435f[_0x9cb9('0x2a')]=_[_0x9cb9('0x2b')](_0x9a4f8[_0x9cb9('0x2a')]);_0x11435f[_0x9cb9('0x2c')]=_[_0x9cb9('0x2d')](_0x11435f[_0x9cb9('0x2e')],_0x11435f['query']);_0x5ac1d7[_0x9cb9('0x2f')]=_[_0x9cb9('0x2d')](_0x11435f[_0x9cb9('0x2e')],qs[_0x9cb9('0x30')](_0x9a4f8[_0x9cb9('0x2a')]['fields']));_0x5ac1d7[_0x9cb9('0x2f')]=_0x5ac1d7[_0x9cb9('0x2f')][_0x9cb9('0x3f')]?_0x5ac1d7['attributes']:_0x11435f[_0x9cb9('0x2e')];if(_0x9a4f8[_0x9cb9('0x2a')][_0x9cb9('0x40')]){_0x5ac1d7['include']=[{'all':!![]}];}_0x5ac1d7=_[_0x9cb9('0x37')]({},_0x5ac1d7,_0x9a4f8[_0x9cb9('0x39')]);return db[_0x9cb9('0x25')][_0x9cb9('0x41')](_0x5ac1d7)[_0x9cb9('0x1d')](handleEntityNotFound(_0x3e8aad,null))[_0x9cb9('0x1d')](respondWithResult(_0x3e8aad,null))['catch'](handleError(_0x3e8aad,null));};exports[_0x9cb9('0x42')]=function(_0xcc8fb2,_0xf1326d){return db[_0x9cb9('0x25')][_0x9cb9('0x42')](_0xcc8fb2[_0x9cb9('0x43')],{})[_0x9cb9('0x1d')](respondWithResult(_0xf1326d,0xc9))[_0x9cb9('0x3d')](handleError(_0xf1326d,null));};exports[_0x9cb9('0x1c')]=function(_0x28efec,_0x11e990){if(_0x28efec[_0x9cb9('0x43')]['id']){delete _0x28efec[_0x9cb9('0x43')]['id'];}return db['UserProfileResource'][_0x9cb9('0x41')]({'where':{'id':_0x28efec['params']['id']}})[_0x9cb9('0x1d')](handleEntityNotFound(_0x11e990,null))[_0x9cb9('0x1d')](saveUpdates(_0x28efec[_0x9cb9('0x43')],null))['then'](respondWithResult(_0x11e990,null))[_0x9cb9('0x3d')](handleError(_0x11e990,null));};exports[_0x9cb9('0x1e')]=function(_0x32d39f,_0x9da13e){return db['UserProfileResource']['find']({'where':{'id':_0x32d39f['params']['id']}})['then'](handleEntityNotFound(_0x9da13e,null))['then'](removeEntity(_0x9da13e,null))['catch'](handleError(_0x9da13e,null));};exports[_0x9cb9('0x44')]=function(_0x4490ec,_0x5ffd1e){return db['UserProfileResource'][_0x9cb9('0x44')]()[_0x9cb9('0x1d')](respondWithResult(_0x5ffd1e,null))[_0x9cb9('0x3d')](handleError(_0x5ffd1e,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 444d172..b99dcd9 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 _0xf4eb=['user_profile_has_resources','sectionId','lodash','bluebird','rimraf','../../config/environment','./userProfileResource.attributes','exports','define'];(function(_0x2acbce,_0x2b48d3){var _0x1de0e0=function(_0x36ae0e){while(--_0x36ae0e){_0x2acbce['push'](_0x2acbce['shift']());}};_0x1de0e0(++_0x2b48d3);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5f417c,_0x202f90){_0x5f417c=_0x5f417c-0x0;var _0x484c88=_0xf4eb[_0x5f417c];return _0x484c88;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('UserProfileResource',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0xbf4e('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x463f89,_0xf317cf){var _0x1e0849=function(_0x1cd10b){while(--_0x1cd10b){_0x463f89['push'](_0x463f89['shift']());}};_0x1e0849(++_0xf317cf);}(_0xe706,0xa3));var _0x6e70=function(_0x58fac8,_0x5ec989){_0x58fac8=_0x58fac8-0x0;var _0x4a560e=_0xe706[_0x58fac8];return _0x4a560e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xf'),_0x6e70('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 415d77f..510a5d1 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 _0x7d19=['info','request\x20sent','debug','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request'];(function(_0x239786,_0x471f27){var _0x3f15e2=function(_0x1c3781){while(--_0x1c3781){_0x239786['push'](_0x239786['shift']());}};_0x3f15e2(++_0x471f27);}(_0x7d19,0x139));var _0x97d1=function(_0x45cd35,_0x41147c){_0x45cd35=_0x45cd35-0x0;var _0x16db84=_0x7d19[_0x45cd35];return _0x16db84;};'use strict';var _=require(_0x97d1('0x0'));var util=require(_0x97d1('0x1'));var moment=require('moment');var BPromise=require(_0x97d1('0x2'));var rs=require(_0x97d1('0x3'));var fs=require('fs');var Redis=require(_0x97d1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x97d1('0x5'));var logger=require(_0x97d1('0x6'))(_0x97d1('0x7'));var config=require('../../config/environment');var jayson=require(_0x97d1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x505f60,_0xed545b,_0x24b6e0){return new BPromise(function(_0x734c84,_0x23fa16){return client[_0x97d1('0x9')](_0x505f60,_0x24b6e0)['then'](function(_0x42a545){logger[_0x97d1('0xa')]('UserProfileResource,\x20%s,\x20%s',_0xed545b,_0x97d1('0xb'));logger[_0x97d1('0xc')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0xed545b,'request\x20sent',JSON[_0x97d1('0xd')](_0x42a545));if(_0x42a545[_0x97d1('0xe')]){if(_0x42a545[_0x97d1('0xe')][_0x97d1('0xf')]===0x1f4){logger['error'](_0x97d1('0x10'),_0xed545b,_0x42a545['error'][_0x97d1('0x11')]);return _0x23fa16(_0x42a545[_0x97d1('0xe')]['message']);}logger['error'](_0x97d1('0x10'),_0xed545b,_0x42a545[_0x97d1('0xe')]['message']);return _0x734c84(_0x42a545[_0x97d1('0xe')][_0x97d1('0x11')]);}else{logger[_0x97d1('0xa')](_0x97d1('0x10'),_0xed545b,'request\x20sent');_0x734c84(_0x42a545['result']['message']);}})[_0x97d1('0x12')](function(_0x218444){logger[_0x97d1('0xe')](_0x97d1('0x10'),_0xed545b,_0x218444);_0x23fa16(_0x218444);});});} \ No newline at end of file +var _0x9c91=['info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','UserProfileResource,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x9c91,0x153));var _0x19c9=function(_0x51e351,_0x3540d8){_0x51e351=_0x51e351-0x0;var _0x30acd5=_0x9c91[_0x51e351];return _0x30acd5;};'use strict';var _=require(_0x19c9('0x0'));var util=require(_0x19c9('0x1'));var moment=require(_0x19c9('0x2'));var BPromise=require(_0x19c9('0x3'));var rs=require(_0x19c9('0x4'));var fs=require('fs');var Redis=require(_0x19c9('0x5'));var db=require(_0x19c9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x19c9('0x7'));var config=require(_0x19c9('0x8'));var jayson=require(_0x19c9('0x9'));var client=jayson[_0x19c9('0xa')][_0x19c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x360055,_0x25bb76,_0x2ed2ac){return new BPromise(function(_0x3a5fde,_0x5e9701){return client[_0x19c9('0xc')](_0x360055,_0x2ed2ac)['then'](function(_0x38adfa){logger[_0x19c9('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x25bb76,_0x19c9('0xe'));logger[_0x19c9('0xf')](_0x19c9('0x10'),_0x25bb76,_0x19c9('0xe'),JSON['stringify'](_0x38adfa));if(_0x38adfa[_0x19c9('0x11')]){if(_0x38adfa[_0x19c9('0x11')][_0x19c9('0x12')]===0x1f4){logger[_0x19c9('0x11')](_0x19c9('0x13'),_0x25bb76,_0x38adfa['error']['message']);return _0x5e9701(_0x38adfa[_0x19c9('0x11')][_0x19c9('0x14')]);}logger['error'](_0x19c9('0x13'),_0x25bb76,_0x38adfa[_0x19c9('0x11')][_0x19c9('0x14')]);return _0x3a5fde(_0x38adfa[_0x19c9('0x11')][_0x19c9('0x14')]);}else{logger[_0x19c9('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x25bb76,_0x19c9('0xe'));_0x3a5fde(_0x38adfa[_0x19c9('0x15')]['message']);}})['catch'](function(_0x30d332){logger['error'](_0x19c9('0x13'),_0x25bb76,_0x30d332);_0x5e9701(_0x30d332);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index ba3dcfd..e211f69 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 _0x1c73=['isAuthenticated','index','/describe','/:id','post','create','put','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get'];(function(_0x441c12,_0x491e5a){var _0x312edf=function(_0x40605b){while(--_0x40605b){_0x441c12['push'](_0x441c12['shift']());}};_0x312edf(++_0x491e5a);}(_0x1c73,0x76));var _0x31c7=function(_0xdeb0b8,_0x4b9186){_0xdeb0b8=_0xdeb0b8-0x0;var _0x335714=_0x1c73[_0xdeb0b8];return _0x335714;};'use strict';var multer=require('multer');var util=require(_0x31c7('0x0'));var path=require(_0x31c7('0x1'));var timeout=require('connect-timeout');var express=require(_0x31c7('0x2'));var router=express['Router']();var auth=require(_0x31c7('0x3'));var interaction=require(_0x31c7('0x4'));var config=require(_0x31c7('0x5'));var controller=require(_0x31c7('0x6'));router[_0x31c7('0x7')]('/',auth[_0x31c7('0x8')](),controller[_0x31c7('0x9')]);router[_0x31c7('0x7')](_0x31c7('0xa'),auth[_0x31c7('0x8')](),controller['describe']);router[_0x31c7('0x7')](_0x31c7('0xb'),auth[_0x31c7('0x8')](),controller['show']);router[_0x31c7('0xc')]('/',auth['isAuthenticated'](),controller[_0x31c7('0xd')]);router[_0x31c7('0xe')](_0x31c7('0xb'),auth[_0x31c7('0x8')](),controller['update']);router[_0x31c7('0xf')]('/:id',auth[_0x31c7('0x8')](),controller[_0x31c7('0x10')]);module[_0x31c7('0x11')]=router; \ No newline at end of file +var _0xd4f2=['delete','destroy','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','describe','show','post','create','/:id'];(function(_0x10b2c4,_0x4b10ed){var _0xb10a8e=function(_0x58ff68){while(--_0x58ff68){_0x10b2c4['push'](_0x10b2c4['shift']());}};_0xb10a8e(++_0x4b10ed);}(_0xd4f2,0x132));var _0x2d4f=function(_0x4c96d1,_0x49be5e){_0x4c96d1=_0x4c96d1-0x0;var _0x562880=_0xd4f2[_0x4c96d1];return _0x562880;};'use strict';var multer=require(_0x2d4f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4f('0x1'));var express=require('express');var router=express[_0x2d4f('0x2')]();var auth=require(_0x2d4f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4f('0x4'));var controller=require(_0x2d4f('0x5'));router[_0x2d4f('0x6')]('/',auth[_0x2d4f('0x7')](),controller[_0x2d4f('0x8')]);router[_0x2d4f('0x6')]('/describe',auth[_0x2d4f('0x7')](),controller[_0x2d4f('0x9')]);router[_0x2d4f('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x2d4f('0xa')]);router[_0x2d4f('0xb')]('/',auth[_0x2d4f('0x7')](),controller[_0x2d4f('0xc')]);router['put'](_0x2d4f('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x2d4f('0xe')](_0x2d4f('0xd'),auth[_0x2d4f('0x7')](),controller[_0x2d4f('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 2bfa654..33a3e09 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 _0x0ab2=['getDataValue','split','STRING','INTEGER','BOOLEAN','crudPermissions'];(function(_0x832664,_0x484287){var _0xd26ed7=function(_0x1fe8b7){while(--_0x1fe8b7){_0x832664['push'](_0x832664['shift']());}};_0xd26ed7(++_0x484287);}(_0x0ab2,0x92));var _0x20ab=function(_0x221628,_0x1c3672){_0x221628=_0x221628-0x0;var _0x7b67e=_0x0ab2[_0x221628];return _0x7b67e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x20ab('0x0')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x20ab('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x20ab('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2aa2b9){this['setDataValue'](_0x20ab('0x3'),_0x2aa2b9?_0x2aa2b9['join'](''):[]);},'get':function(){return this[_0x20ab('0x4')](_0x20ab('0x3'))?this[_0x20ab('0x4')](_0x20ab('0x3'))[_0x20ab('0x5')](''):[];}}}; \ No newline at end of file +var _0x55d2=['INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','STRING'];(function(_0x590da5,_0x298084){var _0x54d4c4=function(_0xf67551){while(--_0xf67551){_0x590da5['push'](_0x590da5['shift']());}};_0x54d4c4(++_0x298084);}(_0x55d2,0x9f));var _0x255d=function(_0x1999ca,_0x2951ea){_0x1999ca=_0x1999ca-0x0;var _0xfcfdf6=_0x55d2[_0x1999ca];return _0xfcfdf6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x255d('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0x255d('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x255d('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x255d('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x255d('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x255d('0x0')],'set':function(_0x57cbc1){this[_0x255d('0x3')](_0x255d('0x4'),_0x57cbc1?_0x57cbc1[_0x255d('0x5')](''):[]);},'get':function(){return this[_0x255d('0x6')]('crudPermissions')?this['getDataValue'](_0x255d('0x4'))[_0x255d('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 4fe86c2..ce2971b 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 _0xd6d9=['includeAll','include','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','UserProfileSection','findAll','rows','catch','show','params','filters','intersection'];(function(_0x2fc8be,_0x2be401){var _0x24dc73=function(_0x108a15){while(--_0x108a15){_0x2fc8be['push'](_0x2fc8be['shift']());}};_0x24dc73(++_0x2be401);}(_0xd6d9,0x16a));var _0x9d6d=function(_0x14363e,_0x4f0e0d){_0x14363e=_0x14363e-0x0;var _0x17c56d=_0xd6d9[_0x14363e];return _0x17c56d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9d6d('0x0'));var rimraf=require(_0x9d6d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d6d('0x2'));var rp=require('request-promise');var moment=require(_0x9d6d('0x3'));var BPromise=require(_0x9d6d('0x4'));var Mustache=require(_0x9d6d('0x5'));var util=require(_0x9d6d('0x6'));var path=require('path');var sox=require(_0x9d6d('0x7'));var csv=require(_0x9d6d('0x8'));var ejs=require(_0x9d6d('0x9'));var fs=require('fs');var _=require(_0x9d6d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9d6d('0xb'));var deskjs=require(_0x9d6d('0xc'));var toCsv=require(_0x9d6d('0x8'));var querystring=require(_0x9d6d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9d6d('0xe'));var qs=require(_0x9d6d('0xf'));var as=require(_0x9d6d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d6d('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x9d6d('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c23ad,_0xce3e4){_0xce3e4=_0xce3e4||0xcc;return function(_0x575f97){if(_0x575f97){return _0x2c23ad[_0x9d6d('0x13')](_0xce3e4);}return _0x2c23ad[_0x9d6d('0x14')](_0xce3e4)[_0x9d6d('0x15')]();};}function respondWithResult(_0x288047,_0x61b81e){_0x61b81e=_0x61b81e||0xc8;return function(_0x3714cb){if(_0x3714cb){return _0x288047['status'](_0x61b81e)[_0x9d6d('0x16')](_0x3714cb);}};}function respondWithFilteredResult(_0x2a082e,_0x55a4d1){return function(_0x3c472d){if(_0x3c472d){var _0xd94a86=_0x3c472d[_0x9d6d('0x17')],_0x5202c6=_0x55a4d1[_0x9d6d('0x18')],_0x5c727b=_0x55a4d1[_0x9d6d('0x18')]+_0x55a4d1[_0x9d6d('0x19')],_0x3847cd;if(_0x5c727b>=_0xd94a86){_0x5c727b=_0xd94a86;_0x3847cd=0xc8;}else{_0x3847cd=0xce;}_0x2a082e[_0x9d6d('0x14')](_0x3847cd);return _0x2a082e[_0x9d6d('0x1a')](_0x9d6d('0x1b'),_0x5202c6+'-'+_0x5c727b+'/'+_0xd94a86)[_0x9d6d('0x16')](_0x3c472d);}return null;};}function patchUpdates(_0x3f1765){return function(_0x25091e){try{jsonpatch[_0x9d6d('0x1c')](_0x25091e,_0x3f1765,!![]);}catch(_0x10a0e7){return BPromise[_0x9d6d('0x1d')](_0x10a0e7);}return _0x25091e[_0x9d6d('0x1e')]();};}function saveUpdates(_0x4ad943,_0x25d555){return function(_0x5f82bb){if(_0x5f82bb){return _0x5f82bb[_0x9d6d('0x1f')](_0x4ad943)[_0x9d6d('0x20')](function(_0x4dac46){return _0x4dac46;});}return null;};}function removeEntity(_0x359384,_0x49f12f){return function(_0x2626f8){if(_0x2626f8){return _0x2626f8[_0x9d6d('0x21')]()[_0x9d6d('0x20')](function(){_0x359384[_0x9d6d('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d1548,_0x28461c){return function(_0x5e6cc3){if(!_0x5e6cc3){_0x3d1548[_0x9d6d('0x13')](0x194);}return _0x5e6cc3;};}function handleError(_0x247815,_0x1b010a){_0x1b010a=_0x1b010a||0x1f4;return function(_0x45d8e8){logger[_0x9d6d('0x22')](_0x45d8e8[_0x9d6d('0x23')]);if(_0x45d8e8[_0x9d6d('0x24')]){delete _0x45d8e8['name'];}_0x247815[_0x9d6d('0x14')](_0x1b010a)['send'](_0x45d8e8);};}exports[_0x9d6d('0x25')]=function(_0x47d723,_0x4054d3){var _0x206e0={},_0x259467={},_0x189934={'count':0x0,'rows':[]};var _0x2c76f2=_[_0x9d6d('0x26')](db['UserProfileSection'][_0x9d6d('0x27')],function(_0x52e0e3){return{'name':_0x52e0e3[_0x9d6d('0x28')],'type':_0x52e0e3[_0x9d6d('0x29')]['key']};});_0x259467[_0x9d6d('0x2a')]=_[_0x9d6d('0x26')](_0x2c76f2,_0x9d6d('0x24'));_0x259467[_0x9d6d('0x2b')]=_[_0x9d6d('0x2c')](_0x47d723[_0x9d6d('0x2b')]);_0x259467['filters']=_['intersection'](_0x259467[_0x9d6d('0x2a')],_0x259467[_0x9d6d('0x2b')]);_0x206e0[_0x9d6d('0x2d')]=_['intersection'](_0x259467[_0x9d6d('0x2a')],qs[_0x9d6d('0x2e')](_0x47d723[_0x9d6d('0x2b')][_0x9d6d('0x2e')]));_0x206e0['attributes']=_0x206e0[_0x9d6d('0x2d')][_0x9d6d('0x2f')]?_0x206e0[_0x9d6d('0x2d')]:_0x259467['model'];if(!_0x47d723['query'][_0x9d6d('0x30')](_0x9d6d('0x31'))){_0x206e0[_0x9d6d('0x19')]=qs[_0x9d6d('0x19')](_0x47d723[_0x9d6d('0x2b')][_0x9d6d('0x19')]);_0x206e0[_0x9d6d('0x18')]=qs[_0x9d6d('0x18')](_0x47d723[_0x9d6d('0x2b')][_0x9d6d('0x18')]);}_0x206e0['order']=qs['sort'](_0x47d723[_0x9d6d('0x2b')][_0x9d6d('0x32')]);_0x206e0[_0x9d6d('0x33')]=qs['filters'](_[_0x9d6d('0x34')](_0x47d723['query'],_0x259467['filters']),_0x2c76f2);if(_0x47d723['query']['filter']){_0x206e0['where']=_[_0x9d6d('0x35')](_0x206e0['where'],{'$or':_[_0x9d6d('0x26')](_0x2c76f2,function(_0xe47952){if(_0xe47952[_0x9d6d('0x29')]!==_0x9d6d('0x36')){var _0x39653={};_0x39653[_0xe47952['name']]={'$like':'%'+_0x47d723[_0x9d6d('0x2b')][_0x9d6d('0x37')]+'%'};return _0x39653;}})});}_0x206e0=_[_0x9d6d('0x35')]({},_0x206e0,_0x47d723['options']);var _0x45223c={'where':_0x206e0[_0x9d6d('0x33')]};return db['UserProfileSection']['count'](_0x45223c)[_0x9d6d('0x20')](function(_0x31f880){_0x189934[_0x9d6d('0x17')]=_0x31f880;if(_0x47d723[_0x9d6d('0x2b')]['includeAll']){_0x206e0['include']=[{'all':!![]}];}return db[_0x9d6d('0x38')][_0x9d6d('0x39')](_0x206e0);})['then'](function(_0x8490d2){_0x189934[_0x9d6d('0x3a')]=_0x8490d2;return _0x189934;})[_0x9d6d('0x20')](respondWithFilteredResult(_0x4054d3,_0x206e0))[_0x9d6d('0x3b')](handleError(_0x4054d3,null));};exports[_0x9d6d('0x3c')]=function(_0x91dddb,_0x1dbfd7){var _0x8268eb={'raw':![],'where':{'id':_0x91dddb[_0x9d6d('0x3d')]['id']}},_0x451419={};_0x451419[_0x9d6d('0x2a')]=_[_0x9d6d('0x2c')](db[_0x9d6d('0x38')]['rawAttributes']);_0x451419['query']=_[_0x9d6d('0x2c')](_0x91dddb[_0x9d6d('0x2b')]);_0x451419[_0x9d6d('0x3e')]=_['intersection'](_0x451419['model'],_0x451419[_0x9d6d('0x2b')]);_0x8268eb[_0x9d6d('0x2d')]=_[_0x9d6d('0x3f')](_0x451419[_0x9d6d('0x2a')],qs[_0x9d6d('0x2e')](_0x91dddb[_0x9d6d('0x2b')][_0x9d6d('0x2e')]));_0x8268eb[_0x9d6d('0x2d')]=_0x8268eb[_0x9d6d('0x2d')][_0x9d6d('0x2f')]?_0x8268eb[_0x9d6d('0x2d')]:_0x451419[_0x9d6d('0x2a')];if(_0x91dddb[_0x9d6d('0x2b')][_0x9d6d('0x40')]){_0x8268eb[_0x9d6d('0x41')]=[{'all':!![]}];}_0x8268eb=_[_0x9d6d('0x35')]({},_0x8268eb,_0x91dddb[_0x9d6d('0x42')]);return db[_0x9d6d('0x38')][_0x9d6d('0x43')](_0x8268eb)[_0x9d6d('0x20')](handleEntityNotFound(_0x1dbfd7,null))[_0x9d6d('0x20')](respondWithResult(_0x1dbfd7,null))['catch'](handleError(_0x1dbfd7,null));};exports[_0x9d6d('0x44')]=function(_0x3f6c65,_0x1a71de){return db['UserProfileSection']['create'](_0x3f6c65[_0x9d6d('0x45')],{})[_0x9d6d('0x20')](respondWithResult(_0x1a71de,0xc9))['catch'](handleError(_0x1a71de,null));};exports['update']=function(_0x15714e,_0x1cad4a){if(_0x15714e[_0x9d6d('0x45')]['id']){delete _0x15714e[_0x9d6d('0x45')]['id'];}return db[_0x9d6d('0x38')]['find']({'where':{'id':_0x15714e['params']['id']}})[_0x9d6d('0x20')](handleEntityNotFound(_0x1cad4a,null))[_0x9d6d('0x20')](saveUpdates(_0x15714e['body'],null))[_0x9d6d('0x20')](respondWithResult(_0x1cad4a,null))[_0x9d6d('0x3b')](handleError(_0x1cad4a,null));};exports[_0x9d6d('0x21')]=function(_0x15d4e1,_0x3055a9){return db[_0x9d6d('0x38')][_0x9d6d('0x43')]({'where':{'id':_0x15d4e1['params']['id']}})['then'](handleEntityNotFound(_0x3055a9,null))[_0x9d6d('0x20')](removeEntity(_0x3055a9,null))[_0x9d6d('0x3b')](handleError(_0x3055a9,null));};exports[_0x9d6d('0x46')]=function(_0x332733,_0x289376){return db[_0x9d6d('0x38')][_0x9d6d('0x46')]()[_0x9d6d('0x20')](respondWithResult(_0x289376,null))[_0x9d6d('0x3b')](handleError(_0x289376,null));}; \ No newline at end of file +var _0x2258=['end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','UserProfileSection','count','include','findAll','show','params','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x9854b7,_0x28dfa8){var _0x2786a1=function(_0x34de09){while(--_0x34de09){_0x9854b7['push'](_0x9854b7['shift']());}};_0x2786a1(++_0x28dfa8);}(_0x2258,0x108));var _0x8225=function(_0x2f4e0d,_0x2a4519){_0x2f4e0d=_0x2f4e0d-0x0;var _0x2d7c24=_0x2258[_0x2f4e0d];return _0x2d7c24;};'use strict';var pdf=require(_0x8225('0x0'));var emlformat=require(_0x8225('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8225('0x2'));var jsonpatch=require(_0x8225('0x3'));var rp=require(_0x8225('0x4'));var moment=require(_0x8225('0x5'));var BPromise=require(_0x8225('0x6'));var Mustache=require('mustache');var util=require(_0x8225('0x7'));var path=require(_0x8225('0x8'));var sox=require(_0x8225('0x9'));var csv=require(_0x8225('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8225('0xb'));var squel=require('squel');var crypto=require(_0x8225('0xc'));var jsforce=require(_0x8225('0xd'));var deskjs=require(_0x8225('0xe'));var toCsv=require(_0x8225('0xa'));var querystring=require(_0x8225('0xf'));var Papa=require('papaparse');var Redis=require(_0x8225('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8225('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8225('0x12'))(_0x8225('0x13'));var utils=require(_0x8225('0x14'));var config=require('../../config/environment');var db=require(_0x8225('0x15'))['db'];function respondWithStatusCode(_0x2fcfdf,_0x30c0aa){_0x30c0aa=_0x30c0aa||0xcc;return function(_0x12a304){if(_0x12a304){return _0x2fcfdf[_0x8225('0x16')](_0x30c0aa);}return _0x2fcfdf[_0x8225('0x17')](_0x30c0aa)[_0x8225('0x18')]();};}function respondWithResult(_0x42e4b1,_0x10838d){_0x10838d=_0x10838d||0xc8;return function(_0x5e6ccc){if(_0x5e6ccc){return _0x42e4b1[_0x8225('0x17')](_0x10838d)[_0x8225('0x19')](_0x5e6ccc);}};}function respondWithFilteredResult(_0x2415b8,_0x29b9ee){return function(_0x24e6ce){if(_0x24e6ce){var _0x20037a=_0x24e6ce['count'],_0x34133b=_0x29b9ee[_0x8225('0x1a')],_0x557cbb=_0x29b9ee['offset']+_0x29b9ee[_0x8225('0x1b')],_0x78f223;if(_0x557cbb>=_0x20037a){_0x557cbb=_0x20037a;_0x78f223=0xc8;}else{_0x78f223=0xce;}_0x2415b8['status'](_0x78f223);return _0x2415b8[_0x8225('0x1c')](_0x8225('0x1d'),_0x34133b+'-'+_0x557cbb+'/'+_0x20037a)['json'](_0x24e6ce);}return null;};}function patchUpdates(_0x59f858){return function(_0x49fdf8){try{jsonpatch[_0x8225('0x1e')](_0x49fdf8,_0x59f858,!![]);}catch(_0x4bc7c8){return BPromise[_0x8225('0x1f')](_0x4bc7c8);}return _0x49fdf8[_0x8225('0x20')]();};}function saveUpdates(_0x47c561,_0x121e3e){return function(_0x1c29cf){if(_0x1c29cf){return _0x1c29cf[_0x8225('0x21')](_0x47c561)[_0x8225('0x22')](function(_0x10f5b6){return _0x10f5b6;});}return null;};}function removeEntity(_0x15fd5,_0x5786e5){return function(_0x33a89a){if(_0x33a89a){return _0x33a89a[_0x8225('0x23')]()[_0x8225('0x22')](function(){_0x15fd5[_0x8225('0x17')](0xcc)[_0x8225('0x18')]();});}};}function handleEntityNotFound(_0xcc1385,_0x27e200){return function(_0x2f78d3){if(!_0x2f78d3){_0xcc1385[_0x8225('0x16')](0x194);}return _0x2f78d3;};}function handleError(_0x12fa3b,_0x9555a0){_0x9555a0=_0x9555a0||0x1f4;return function(_0x1a5a17){logger['error'](_0x1a5a17['stack']);if(_0x1a5a17[_0x8225('0x24')]){delete _0x1a5a17[_0x8225('0x24')];}_0x12fa3b[_0x8225('0x17')](_0x9555a0)[_0x8225('0x25')](_0x1a5a17);};}exports[_0x8225('0x26')]=function(_0x2f76f0,_0x453fa2){var _0x5493af={},_0x22e736={},_0x33cb12={'count':0x0,'rows':[]};var _0x506248=_[_0x8225('0x27')](db['UserProfileSection'][_0x8225('0x28')],function(_0x2715b0){return{'name':_0x2715b0[_0x8225('0x29')],'type':_0x2715b0[_0x8225('0x2a')][_0x8225('0x2b')]};});_0x22e736[_0x8225('0x2c')]=_[_0x8225('0x27')](_0x506248,_0x8225('0x24'));_0x22e736['query']=_[_0x8225('0x2d')](_0x2f76f0['query']);_0x22e736[_0x8225('0x2e')]=_[_0x8225('0x2f')](_0x22e736[_0x8225('0x2c')],_0x22e736[_0x8225('0x30')]);_0x5493af[_0x8225('0x31')]=_[_0x8225('0x2f')](_0x22e736[_0x8225('0x2c')],qs[_0x8225('0x32')](_0x2f76f0[_0x8225('0x30')]['fields']));_0x5493af[_0x8225('0x31')]=_0x5493af[_0x8225('0x31')][_0x8225('0x33')]?_0x5493af[_0x8225('0x31')]:_0x22e736[_0x8225('0x2c')];if(!_0x2f76f0['query'][_0x8225('0x34')](_0x8225('0x35'))){_0x5493af[_0x8225('0x1b')]=qs[_0x8225('0x1b')](_0x2f76f0[_0x8225('0x30')]['limit']);_0x5493af['offset']=qs[_0x8225('0x1a')](_0x2f76f0[_0x8225('0x30')][_0x8225('0x1a')]);}_0x5493af['order']=qs[_0x8225('0x36')](_0x2f76f0[_0x8225('0x30')][_0x8225('0x36')]);_0x5493af['where']=qs['filters'](_[_0x8225('0x37')](_0x2f76f0[_0x8225('0x30')],_0x22e736[_0x8225('0x2e')]),_0x506248);if(_0x2f76f0[_0x8225('0x30')][_0x8225('0x38')]){_0x5493af['where']=_[_0x8225('0x39')](_0x5493af['where'],{'$or':_[_0x8225('0x27')](_0x506248,function(_0x3c3814){if(_0x3c3814[_0x8225('0x2a')]!==_0x8225('0x3a')){var _0x3e5c44={};_0x3e5c44[_0x3c3814['name']]={'$like':'%'+_0x2f76f0[_0x8225('0x30')][_0x8225('0x38')]+'%'};return _0x3e5c44;}})});}_0x5493af=_[_0x8225('0x39')]({},_0x5493af,_0x2f76f0[_0x8225('0x3b')]);var _0x478856={'where':_0x5493af[_0x8225('0x3c')]};return db[_0x8225('0x3d')][_0x8225('0x3e')](_0x478856)[_0x8225('0x22')](function(_0x22dd7f){_0x33cb12[_0x8225('0x3e')]=_0x22dd7f;if(_0x2f76f0[_0x8225('0x30')]['includeAll']){_0x5493af[_0x8225('0x3f')]=[{'all':!![]}];}return db[_0x8225('0x3d')][_0x8225('0x40')](_0x5493af);})['then'](function(_0x4ccaa5){_0x33cb12['rows']=_0x4ccaa5;return _0x33cb12;})[_0x8225('0x22')](respondWithFilteredResult(_0x453fa2,_0x5493af))['catch'](handleError(_0x453fa2,null));};exports[_0x8225('0x41')]=function(_0x260815,_0x232e34){var _0xb9de27={'raw':![],'where':{'id':_0x260815[_0x8225('0x42')]['id']}},_0x29dfd7={};_0x29dfd7[_0x8225('0x2c')]=_[_0x8225('0x2d')](db[_0x8225('0x3d')][_0x8225('0x28')]);_0x29dfd7['query']=_[_0x8225('0x2d')](_0x260815[_0x8225('0x30')]);_0x29dfd7[_0x8225('0x2e')]=_[_0x8225('0x2f')](_0x29dfd7[_0x8225('0x2c')],_0x29dfd7[_0x8225('0x30')]);_0xb9de27['attributes']=_[_0x8225('0x2f')](_0x29dfd7[_0x8225('0x2c')],qs[_0x8225('0x32')](_0x260815[_0x8225('0x30')][_0x8225('0x32')]));_0xb9de27[_0x8225('0x31')]=_0xb9de27[_0x8225('0x31')]['length']?_0xb9de27[_0x8225('0x31')]:_0x29dfd7[_0x8225('0x2c')];if(_0x260815[_0x8225('0x30')]['includeAll']){_0xb9de27['include']=[{'all':!![]}];}_0xb9de27=_['merge']({},_0xb9de27,_0x260815[_0x8225('0x3b')]);return db['UserProfileSection'][_0x8225('0x43')](_0xb9de27)[_0x8225('0x22')](handleEntityNotFound(_0x232e34,null))[_0x8225('0x22')](respondWithResult(_0x232e34,null))[_0x8225('0x44')](handleError(_0x232e34,null));};exports[_0x8225('0x45')]=function(_0x18a908,_0xe5943c){return db[_0x8225('0x3d')][_0x8225('0x45')](_0x18a908['body'],{})[_0x8225('0x22')](respondWithResult(_0xe5943c,0xc9))['catch'](handleError(_0xe5943c,null));};exports['update']=function(_0x2b216b,_0x1c4d8d){if(_0x2b216b['body']['id']){delete _0x2b216b['body']['id'];}return db[_0x8225('0x3d')][_0x8225('0x43')]({'where':{'id':_0x2b216b[_0x8225('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c4d8d,null))[_0x8225('0x22')](saveUpdates(_0x2b216b[_0x8225('0x46')],null))[_0x8225('0x22')](respondWithResult(_0x1c4d8d,null))[_0x8225('0x44')](handleError(_0x1c4d8d,null));};exports[_0x8225('0x23')]=function(_0x197b48,_0x40c678){return db[_0x8225('0x3d')]['find']({'where':{'id':_0x197b48[_0x8225('0x42')]['id']}})[_0x8225('0x22')](handleEntityNotFound(_0x40c678,null))[_0x8225('0x22')](removeEntity(_0x40c678,null))[_0x8225('0x44')](handleError(_0x40c678,null));};exports[_0x8225('0x47')]=function(_0x2bc01a,_0x3dfb37){return db['UserProfileSection'][_0x8225('0x47')]()[_0x8225('0x22')](respondWithResult(_0x3dfb37,null))[_0x8225('0x44')](handleError(_0x3dfb37,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 0b3bc5d..e897c97 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 _0xec4f=['compositeIndex','userProfileId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xec4f,0x18a));var _0xfec4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xec4f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfec4('0x0'));var util=require('util');var logger=require(_0xfec4('0x1'))(_0xfec4('0x2'));var moment=require(_0xfec4('0x3'));var BPromise=require(_0xfec4('0x4'));var rp=require(_0xfec4('0x5'));var fs=require('fs');var path=require(_0xfec4('0x6'));var rimraf=require('rimraf');var config=require(_0xfec4('0x7'));var attributes=require(_0xfec4('0x8'));module['exports']=function(_0x429347,_0x553521){return _0x429347[_0xfec4('0x9')](_0xfec4('0xa'),attributes,{'tableName':_0xfec4('0xb'),'paranoid':![],'indexes':[{'name':_0xfec4('0xc'),'fields':['sectionId',_0xfec4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6003=['./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xbfc853,_0x349992){var _0x48733a=function(_0x429b06){while(--_0x429b06){_0xbfc853['push'](_0xbfc853['shift']());}};_0x48733a(++_0x349992);}(_0x6003,0xa0));var _0x3600=function(_0x290143,_0x230cb1){_0x290143=_0x290143-0x0;var _0x298b3f=_0x6003[_0x290143];return _0x298b3f;};'use strict';var _=require('lodash');var util=require(_0x3600('0x0'));var logger=require(_0x3600('0x1'))('api');var moment=require(_0x3600('0x2'));var BPromise=require(_0x3600('0x3'));var rp=require(_0x3600('0x4'));var fs=require('fs');var path=require(_0x3600('0x5'));var rimraf=require(_0x3600('0x6'));var config=require(_0x3600('0x7'));var attributes=require(_0x3600('0x8'));module[_0x3600('0x9')]=function(_0xd297ea,_0x4ba2e1){return _0xd297ea['define'](_0x3600('0xa'),attributes,{'tableName':_0x3600('0xb'),'paranoid':![],'indexes':[{'name':_0x3600('0xc'),'fields':['sectionId',_0x3600('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 456ff70..433badd 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 _0x5c24=['jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5aa373,_0x54c7f4){var _0x590e8e=function(_0x505e62){while(--_0x505e62){_0x5aa373['push'](_0x5aa373['shift']());}};_0x590e8e(++_0x54c7f4);}(_0x5c24,0x184));var _0x45c2=function(_0x26b622,_0x237e9e){_0x26b622=_0x26b622-0x0;var _0x58a028=_0x5c24[_0x26b622];return _0x58a028;};'use strict';var _=require(_0x45c2('0x0'));var util=require(_0x45c2('0x1'));var moment=require('moment');var BPromise=require(_0x45c2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45c2('0x3'));var db=require(_0x45c2('0x4'))['db'];var utils=require(_0x45c2('0x5'));var logger=require('../../config/logger')(_0x45c2('0x6'));var config=require(_0x45c2('0x7'));var jayson=require(_0x45c2('0x8'));var client=jayson['client'][_0x45c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18ace1,_0x318b24,_0x5bdf4c){return new BPromise(function(_0x391703,_0x2e7576){return client[_0x45c2('0xa')](_0x18ace1,_0x5bdf4c)[_0x45c2('0xb')](function(_0x287de8){logger[_0x45c2('0xc')](_0x45c2('0xd'),_0x318b24,_0x45c2('0xe'));logger['debug'](_0x45c2('0xf'),_0x318b24,'request\x20sent',JSON[_0x45c2('0x10')](_0x287de8));if(_0x287de8[_0x45c2('0x11')]){if(_0x287de8[_0x45c2('0x11')][_0x45c2('0x12')]===0x1f4){logger[_0x45c2('0x11')](_0x45c2('0xd'),_0x318b24,_0x287de8[_0x45c2('0x11')][_0x45c2('0x13')]);return _0x2e7576(_0x287de8[_0x45c2('0x11')]['message']);}logger[_0x45c2('0x11')](_0x45c2('0xd'),_0x318b24,_0x287de8['error'][_0x45c2('0x13')]);return _0x391703(_0x287de8[_0x45c2('0x11')]['message']);}else{logger[_0x45c2('0xc')](_0x45c2('0xd'),_0x318b24,'request\x20sent');_0x391703(_0x287de8[_0x45c2('0x14')]['message']);}})[_0x45c2('0x15')](function(_0x18cd2c){logger[_0x45c2('0x11')](_0x45c2('0xd'),_0x318b24,_0x18cd2c);_0x2e7576(_0x18cd2c);});});} \ No newline at end of file +var _0xc0b9=['UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x51147e,_0x4290d6){var _0x3458d2=function(_0x16544e){while(--_0x16544e){_0x51147e['push'](_0x51147e['shift']());}};_0x3458d2(++_0x4290d6);}(_0xc0b9,0x12d));var _0x9c0b=function(_0x1f544e,_0x1edbbd){_0x1f544e=_0x1f544e-0x0;var _0x394caa=_0xc0b9[_0x1f544e];return _0x394caa;};'use strict';var _=require(_0x9c0b('0x0'));var util=require(_0x9c0b('0x1'));var moment=require(_0x9c0b('0x2'));var BPromise=require(_0x9c0b('0x3'));var rs=require(_0x9c0b('0x4'));var fs=require('fs');var Redis=require(_0x9c0b('0x5'));var db=require(_0x9c0b('0x6'))['db'];var utils=require(_0x9c0b('0x7'));var logger=require(_0x9c0b('0x8'))(_0x9c0b('0x9'));var config=require(_0x9c0b('0xa'));var jayson=require(_0x9c0b('0xb'));var client=jayson[_0x9c0b('0xc')][_0x9c0b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x163ee9,_0x4bbebd,_0x413f48){return new BPromise(function(_0x1fcb78,_0x530575){return client[_0x9c0b('0xe')](_0x163ee9,_0x413f48)[_0x9c0b('0xf')](function(_0x5458a8){logger[_0x9c0b('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x4bbebd,_0x9c0b('0x11'));logger[_0x9c0b('0x12')](_0x9c0b('0x13'),_0x4bbebd,_0x9c0b('0x11'),JSON[_0x9c0b('0x14')](_0x5458a8));if(_0x5458a8['error']){if(_0x5458a8[_0x9c0b('0x15')][_0x9c0b('0x16')]===0x1f4){logger[_0x9c0b('0x15')](_0x9c0b('0x17'),_0x4bbebd,_0x5458a8[_0x9c0b('0x15')][_0x9c0b('0x18')]);return _0x530575(_0x5458a8['error'][_0x9c0b('0x18')]);}logger['error'](_0x9c0b('0x17'),_0x4bbebd,_0x5458a8['error'][_0x9c0b('0x18')]);return _0x1fcb78(_0x5458a8[_0x9c0b('0x15')][_0x9c0b('0x18')]);}else{logger['info'](_0x9c0b('0x17'),_0x4bbebd,_0x9c0b('0x11'));_0x1fcb78(_0x5458a8[_0x9c0b('0x19')][_0x9c0b('0x18')]);}})[_0x9c0b('0x1a')](function(_0x1405e2){logger[_0x9c0b('0x15')](_0x9c0b('0x17'),_0x4bbebd,_0x1405e2);_0x530575(_0x1405e2);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index e90ffee..6823988 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 _0xf102=['path','express','../../components/interaction/service','exports','multer','util'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf102,0x6a));var _0x2f10=function(_0x4074d5,_0xa57194){_0x4074d5=_0x4074d5-0x0;var _0x502cfe=_0xf102[_0x4074d5];return _0x502cfe;};'use strict';var multer=require(_0x2f10('0x0'));var util=require(_0x2f10('0x1'));var path=require(_0x2f10('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f10('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2f10('0x4'));var config=require('../../config/environment');module[_0x2f10('0x5')]=router; \ No newline at end of file +var _0xe3e7=['../../components/interaction/service','exports','path','connect-timeout','Router','../../components/auth/service'];(function(_0xa392b4,_0x130755){var _0x4e62e5=function(_0x4df3a9){while(--_0x4df3a9){_0xa392b4['push'](_0xa392b4['shift']());}};_0x4e62e5(++_0x130755);}(_0xe3e7,0xc8));var _0x7e3e=function(_0x214a3c,_0x405788){_0x214a3c=_0x214a3c-0x0;var _0x5a51c7=_0xe3e7[_0x214a3c];return _0x5a51c7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7e3e('0x0'));var timeout=require(_0x7e3e('0x1'));var express=require('express');var router=express[_0x7e3e('0x2')]();var auth=require(_0x7e3e('0x3'));var interaction=require(_0x7e3e('0x4'));var config=require('../../config/environment');module[_0x7e3e('0x5')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b7bbc02..8e79996 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(_0x253bea,_0x23b31c){var _0x10cef0=function(_0x4631fa){while(--_0x4631fa){_0x253bea['push'](_0x253bea['shift']());}};_0x10cef0(++_0x23b31c);}(_0xe706,0xa3));var _0x6e70=function(_0x1e2aae,_0x2349e3){_0x1e2aae=_0x1e2aae-0x0;var _0x4d8a43=_0xe706[_0x1e2aae];return _0x4d8a43;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x331e28,_0x163e3c){var _0x42abb8=function(_0x2bdc7f){while(--_0x2bdc7f){_0x331e28['push'](_0x331e28['shift']());}};_0x42abb8(++_0x163e3c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index b78d121..3a3a2db 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 _0xa571=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x37cccf,_0x4699ff){var _0x23e7a3=function(_0x518fff){while(--_0x518fff){_0x37cccf['push'](_0x37cccf['shift']());}};_0x23e7a3(++_0x4699ff);}(_0xa571,0x107));var _0x1a57=function(_0x32ae42,_0x26a247){_0x32ae42=_0x32ae42-0x0;var _0xf3d8fd=_0xa571[_0x32ae42];return _0xf3d8fd;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var logger=require(_0x1a57('0x2'))(_0x1a57('0x3'));var moment=require('moment');var BPromise=require(_0x1a57('0x4'));var rp=require(_0x1a57('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a57('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0x1a57('0x7')]=function(_0xd97a33,_0x22ca20){return _0xd97a33[_0x1a57('0x8')](_0x1a57('0x9'),attributes,{'tableName':_0x1a57('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeffd=['request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0xeffd,0x6b));var _0xdeff=function(_0x2f002e,_0x2f231a){_0x2f002e=_0x2f002e-0x0;var _0x110680=_0xeffd[_0x2f002e];return _0x110680;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var logger=require(_0xdeff('0x1'))(_0xdeff('0x2'));var moment=require(_0xdeff('0x3'));var BPromise=require(_0xdeff('0x4'));var rp=require(_0xdeff('0x5'));var fs=require('fs');var path=require(_0xdeff('0x6'));var rimraf=require(_0xdeff('0x7'));var config=require(_0xdeff('0x8'));var attributes=require(_0xdeff('0x9'));module[_0xdeff('0xa')]=function(_0x1ed641,_0x132631){return _0x1ed641[_0xdeff('0xb')](_0xdeff('0xc'),attributes,{'tableName':_0xdeff('0xd'),'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 9160b63..580c2b6 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 _0x40c4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x1e520c,_0x56e4a5){var _0x23e44f=function(_0x198fdd){while(--_0x198fdd){_0x1e520c['push'](_0x1e520c['shift']());}};_0x23e44f(++_0x56e4a5);}(_0x40c4,0x160));var _0x440c=function(_0xe10646,_0x47dfb7){_0xe10646=_0xe10646-0x0;var _0x1ff4eb=_0x40c4[_0xe10646];return _0x1ff4eb;};'use strict';var _=require(_0x440c('0x0'));var util=require('util');var moment=require(_0x440c('0x1'));var BPromise=require(_0x440c('0x2'));var rs=require(_0x440c('0x3'));var fs=require('fs');var Redis=require(_0x440c('0x4'));var db=require(_0x440c('0x5'))['db'];var utils=require(_0x440c('0x6'));var logger=require(_0x440c('0x7'))(_0x440c('0x8'));var config=require(_0x440c('0x9'));var jayson=require(_0x440c('0xa'));var client=jayson['client'][_0x440c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c566a,_0x57e783,_0x5b33d4){return new BPromise(function(_0x196e38,_0x148cdd){return client[_0x440c('0xc')](_0x5c566a,_0x5b33d4)[_0x440c('0xd')](function(_0x1e61ae){logger[_0x440c('0xe')](_0x440c('0xf'),_0x57e783,_0x440c('0x10'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x57e783,_0x440c('0x10'),JSON[_0x440c('0x11')](_0x1e61ae));if(_0x1e61ae[_0x440c('0x12')]){if(_0x1e61ae[_0x440c('0x12')]['code']===0x1f4){logger[_0x440c('0x12')](_0x440c('0xf'),_0x57e783,_0x1e61ae[_0x440c('0x12')][_0x440c('0x13')]);return _0x148cdd(_0x1e61ae[_0x440c('0x12')][_0x440c('0x13')]);}logger['error'](_0x440c('0xf'),_0x57e783,_0x1e61ae['error']['message']);return _0x196e38(_0x1e61ae[_0x440c('0x12')]['message']);}else{logger[_0x440c('0xe')](_0x440c('0xf'),_0x57e783,'request\x20sent');_0x196e38(_0x1e61ae['result']['message']);}})[_0x440c('0x14')](function(_0x2fd718){logger[_0x440c('0x12')](_0x440c('0xf'),_0x57e783,_0x2fd718);_0x148cdd(_0x2fd718);});});} \ No newline at end of file +var _0x0afa=['jayson/promise','request','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','UserSmsQueue,\x20%s,\x20%s','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0x0afa,0x188));var _0xa0af=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0afa[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xa0af('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa0af('0x1'));var fs=require('fs');var Redis=require(_0xa0af('0x2'));var db=require(_0xa0af('0x3'))['db'];var utils=require(_0xa0af('0x4'));var logger=require('../../config/logger')(_0xa0af('0x5'));var config=require(_0xa0af('0x6'));var jayson=require(_0xa0af('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44d40c,_0x5bb865,_0x2b7ae9){return new BPromise(function(_0x1ac67a,_0x2591c0){return client[_0xa0af('0x8')](_0x44d40c,_0x2b7ae9)['then'](function(_0x1a4f4a){logger[_0xa0af('0x9')]('UserSmsQueue,\x20%s,\x20%s',_0x5bb865,_0xa0af('0xa'));logger[_0xa0af('0xb')](_0xa0af('0xc'),_0x5bb865,_0xa0af('0xa'),JSON[_0xa0af('0xd')](_0x1a4f4a));if(_0x1a4f4a['error']){if(_0x1a4f4a['error']['code']===0x1f4){logger[_0xa0af('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x5bb865,_0x1a4f4a['error']['message']);return _0x2591c0(_0x1a4f4a[_0xa0af('0xe')][_0xa0af('0xf')]);}logger['error'](_0xa0af('0x10'),_0x5bb865,_0x1a4f4a[_0xa0af('0xe')]['message']);return _0x1ac67a(_0x1a4f4a['error']['message']);}else{logger[_0xa0af('0x9')](_0xa0af('0x10'),_0x5bb865,_0xa0af('0xa'));_0x1ac67a(_0x1a4f4a[_0xa0af('0x11')][_0xa0af('0xf')]);}})[_0xa0af('0x12')](function(_0x275ca0){logger[_0xa0af('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x5bb865,_0x275ca0);_0x2591c0(_0x275ca0);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index f483d30..8ca15b7 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 _0x6cad=['connect-timeout','express','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x1b53a4,_0x3c46b9){var _0x2c4ca7=function(_0x1425af){while(--_0x1425af){_0x1b53a4['push'](_0x1b53a4['shift']());}};_0x2c4ca7(++_0x3c46b9);}(_0x6cad,0x1c5));var _0xd6ca=function(_0x4836e1,_0x4211de){_0x4836e1=_0x4836e1-0x0;var _0x4b6d2e=_0x6cad[_0x4836e1];return _0x4b6d2e;};'use strict';var multer=require(_0xd6ca('0x0'));var util=require(_0xd6ca('0x1'));var path=require(_0xd6ca('0x2'));var timeout=require(_0xd6ca('0x3'));var express=require(_0xd6ca('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd6ca('0x5'));var config=require(_0xd6ca('0x6'));module[_0xd6ca('0x7')]=router; \ No newline at end of file +var _0x7e7e=['../../config/environment','exports','multer','path','connect-timeout','../../components/auth/service'];(function(_0x4fe4d0,_0xc7a321){var _0x3d4fd2=function(_0x29e75a){while(--_0x29e75a){_0x4fe4d0['push'](_0x4fe4d0['shift']());}};_0x3d4fd2(++_0xc7a321);}(_0x7e7e,0x146));var _0xe7e7=function(_0x20d96f,_0x557146){_0x20d96f=_0x20d96f-0x0;var _0x32284d=_0x7e7e[_0x20d96f];return _0x32284d;};'use strict';var multer=require(_0xe7e7('0x0'));var util=require('util');var path=require(_0xe7e7('0x1'));var timeout=require(_0xe7e7('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe7e7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe7e7('0x4'));module[_0xe7e7('0x5')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 2dd8188..c011557 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x255093,_0x4fe4fa){var _0x440166=function(_0x366f54){while(--_0x366f54){_0x255093['push'](_0x255093['shift']());}};_0x440166(++_0x4fe4fa);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x4c7d93,_0x346501){var _0x5298c7=function(_0x592460){while(--_0x592460){_0x4c7d93['push'](_0x4c7d93['shift']());}};_0x5298c7(++_0x346501);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 97c81dc..8f14ce5 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 _0x9026=['user_has_voice_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','UserVoiceQueue'];(function(_0x593e8e,_0xf4ae5c){var _0x311631=function(_0x12f9b2){while(--_0x12f9b2){_0x593e8e['push'](_0x593e8e['shift']());}};_0x311631(++_0xf4ae5c);}(_0x9026,0xd9));var _0x6902=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x9026[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x6902('0x0'));var util=require(_0x6902('0x1'));var logger=require(_0x6902('0x2'))('api');var moment=require(_0x6902('0x3'));var BPromise=require(_0x6902('0x4'));var rp=require(_0x6902('0x5'));var fs=require('fs');var path=require(_0x6902('0x6'));var rimraf=require('rimraf');var config=require(_0x6902('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0x6902('0x8')]=function(_0x51512b,_0x15763e){return _0x51512b[_0x6902('0x9')](_0x6902('0xa'),attributes,{'tableName':_0x6902('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf4c=['api','moment','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger'];(function(_0xd80954,_0x1ce8c2){var _0x8085dd=function(_0x57fd80){while(--_0x57fd80){_0xd80954['push'](_0xd80954['shift']());}};_0x8085dd(++_0x1ce8c2);}(_0xcf4c,0x166));var _0xccf4=function(_0xbc8751,_0x3e64c0){_0xbc8751=_0xbc8751-0x0;var _0x10923a=_0xcf4c[_0xbc8751];return _0x10923a;};'use strict';var _=require('lodash');var util=require(_0xccf4('0x0'));var logger=require(_0xccf4('0x1'))(_0xccf4('0x2'));var moment=require(_0xccf4('0x3'));var BPromise=require('bluebird');var rp=require(_0xccf4('0x4'));var fs=require('fs');var path=require(_0xccf4('0x5'));var rimraf=require(_0xccf4('0x6'));var config=require('../../config/environment');var attributes=require(_0xccf4('0x7'));module[_0xccf4('0x8')]=function(_0x403452,_0x1cfb78){return _0x403452[_0xccf4('0x9')](_0xccf4('0xa'),attributes,{'tableName':_0xccf4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 11b8f96..9dbbd6f 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 _0xca99=['then','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','UserVoiceQueue,\x20%s,\x20%s','info','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','request'];(function(_0x15ff04,_0x4cda55){var _0x361c4e=function(_0x1990e8){while(--_0x1990e8){_0x15ff04['push'](_0x15ff04['shift']());}};_0x361c4e(++_0x4cda55);}(_0xca99,0x14d));var _0x9ca9=function(_0x4c67b6,_0x57c66d){_0x4c67b6=_0x4c67b6-0x0;var _0xbec69f=_0xca99[_0x4c67b6];return _0xbec69f;};'use strict';var _=require('lodash');var util=require(_0x9ca9('0x0'));var moment=require(_0x9ca9('0x1'));var BPromise=require(_0x9ca9('0x2'));var rs=require(_0x9ca9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9ca9('0x4'));var logger=require(_0x9ca9('0x5'))(_0x9ca9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9ca9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10124a,_0x2e58f7,_0x38eca5){return new BPromise(function(_0x134c5b,_0x48349e){return client[_0x9ca9('0x8')](_0x10124a,_0x38eca5)[_0x9ca9('0x9')](function(_0x16ff15){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x2e58f7,_0x9ca9('0xa'));logger['debug'](_0x9ca9('0xb'),_0x2e58f7,_0x9ca9('0xa'),JSON[_0x9ca9('0xc')](_0x16ff15));if(_0x16ff15[_0x9ca9('0xd')]){if(_0x16ff15['error']['code']===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x2e58f7,_0x16ff15['error'][_0x9ca9('0xe')]);return _0x48349e(_0x16ff15['error']['message']);}logger['error'](_0x9ca9('0xf'),_0x2e58f7,_0x16ff15[_0x9ca9('0xd')]['message']);return _0x134c5b(_0x16ff15[_0x9ca9('0xd')][_0x9ca9('0xe')]);}else{logger[_0x9ca9('0x10')](_0x9ca9('0xf'),_0x2e58f7,'request\x20sent');_0x134c5b(_0x16ff15[_0x9ca9('0x11')][_0x9ca9('0xe')]);}})[_0x9ca9('0x12')](function(_0x522bb9){logger[_0x9ca9('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x2e58f7,_0x522bb9);_0x48349e(_0x522bb9);});});} \ No newline at end of file +var _0x8c03=['rpc','../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x311dd4,_0x92fbb2){var _0x2e1f9d=function(_0x441c0a){while(--_0x441c0a){_0x311dd4['push'](_0x311dd4['shift']());}};_0x2e1f9d(++_0x92fbb2);}(_0x8c03,0x15a));var _0x38c0=function(_0x9bbde5,_0x3506b5){_0x9bbde5=_0x9bbde5-0x0;var _0x46f02a=_0x8c03[_0x9bbde5];return _0x46f02a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x38c0('0x0'));var BPromise=require(_0x38c0('0x1'));var rs=require(_0x38c0('0x2'));var fs=require('fs');var Redis=require(_0x38c0('0x3'));var db=require(_0x38c0('0x4'))['db'];var utils=require(_0x38c0('0x5'));var logger=require('../../config/logger')(_0x38c0('0x6'));var config=require(_0x38c0('0x7'));var jayson=require(_0x38c0('0x8'));var client=jayson['client'][_0x38c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x445d71,_0x594782,_0x4292d2){return new BPromise(function(_0x2ba497,_0x33ba3b){return client[_0x38c0('0xa')](_0x445d71,_0x4292d2)[_0x38c0('0xb')](function(_0x95b6eb){logger[_0x38c0('0xc')](_0x38c0('0xd'),_0x594782,'request\x20sent');logger[_0x38c0('0xe')](_0x38c0('0xf'),_0x594782,_0x38c0('0x10'),JSON['stringify'](_0x95b6eb));if(_0x95b6eb[_0x38c0('0x11')]){if(_0x95b6eb[_0x38c0('0x11')][_0x38c0('0x12')]===0x1f4){logger[_0x38c0('0x11')](_0x38c0('0xd'),_0x594782,_0x95b6eb['error']['message']);return _0x33ba3b(_0x95b6eb[_0x38c0('0x11')][_0x38c0('0x13')]);}logger[_0x38c0('0x11')](_0x38c0('0xd'),_0x594782,_0x95b6eb[_0x38c0('0x11')]['message']);return _0x2ba497(_0x95b6eb[_0x38c0('0x11')][_0x38c0('0x13')]);}else{logger[_0x38c0('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x594782,_0x38c0('0x10'));_0x2ba497(_0x95b6eb[_0x38c0('0x14')][_0x38c0('0x13')]);}})[_0x38c0('0x15')](function(_0x224b45){logger['error'](_0x38c0('0xd'),_0x594782,_0x224b45);_0x33ba3b(_0x224b45);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 9552eb0..eb7ab53 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 _0x1bce=['express','Router','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1bce,0x194));var _0xe1bc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1bce[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xe1bc('0x0'));var util=require(_0xe1bc('0x1'));var path=require(_0xe1bc('0x2'));var timeout=require(_0xe1bc('0x3'));var express=require(_0xe1bc('0x4'));var router=express[_0xe1bc('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe1bc('0x6'));var config=require(_0xe1bc('0x7'));module['exports']=router; \ No newline at end of file +var _0x1881=['Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','connect-timeout','express'];(function(_0x8e4c15,_0x44483e){var _0x82228c=function(_0x23e046){while(--_0x23e046){_0x8e4c15['push'](_0x8e4c15['shift']());}};_0x82228c(++_0x44483e);}(_0x1881,0xcc));var _0x1188=function(_0x20b9d5,_0xa6a6cd){_0x20b9d5=_0x20b9d5-0x0;var _0x4d7464=_0x1881[_0x20b9d5];return _0x4d7464;};'use strict';var multer=require(_0x1188('0x0'));var util=require(_0x1188('0x1'));var path=require('path');var timeout=require(_0x1188('0x2'));var express=require(_0x1188('0x3'));var router=express[_0x1188('0x4')]();var auth=require(_0x1188('0x5'));var interaction=require(_0x1188('0x6'));var config=require('../../config/environment');module[_0x1188('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 6512f50..c78ca4c 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 _0x7be0=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7be0,0x6c));var _0x07be=function(_0x51ad78,_0x193436){_0x51ad78=_0x51ad78-0x0;var _0x31a9ec=_0x7be0[_0x51ad78];return _0x31a9ec;};'use strict';var Sequelize=require(_0x07be('0x0'));module[_0x07be('0x1')]={'uniqueid':{'type':Sequelize[_0x07be('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x07be('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x07be('0x3')},'UserId':{'type':Sequelize[_0x07be('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x07be('0x4')],'allowNull':![],'unique':_0x07be('0x5'),'comment':_0x07be('0x3')},'VoiceQueueId':{'type':Sequelize[_0x07be('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x07be('0x5'),'comment':_0x07be('0x3')},'penalty':{'type':Sequelize[_0x07be('0x2')](0xb),'defaultValue':0x0,'comment':_0x07be('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x07be('0x3')}}; \ No newline at end of file +var _0xc382=['STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','exports','INTEGER'];(function(_0x3edd61,_0x41dbd8){var _0x31a846=function(_0x224a4d){while(--_0x224a4d){_0x3edd61['push'](_0x3edd61['shift']());}};_0x31a846(++_0x41dbd8);}(_0xc382,0x13b));var _0x2c38=function(_0x34412f,_0x116bea){_0x34412f=_0x34412f-0x0;var _0x4b4b5a=_0xc382[_0x34412f];return _0x4b4b5a;};'use strict';var Sequelize=require(_0x2c38('0x0'));module[_0x2c38('0x1')]={'uniqueid':{'type':Sequelize[_0x2c38('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x2c38('0x3')],'allowNull':![],'comment':_0x2c38('0x4')},'UserId':{'type':Sequelize[_0x2c38('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2c38('0x3')],'allowNull':![],'unique':_0x2c38('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x2c38('0x3')],'allowNull':![],'unique':_0x2c38('0x5'),'comment':_0x2c38('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x2c38('0x2')](0xb),'defaultValue':0x0,'comment':_0x2c38('0x4')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index dce3c9c..7a11895 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 _0xa8c0=['exports','../../mysqldb','UserVoiceQueueRt','update','remove','emit','hasOwnProperty','hook'];(function(_0x228fdd,_0x547c8c){var _0x4d7b78=function(_0x3ac7e2){while(--_0x3ac7e2){_0x228fdd['push'](_0x228fdd['shift']());}};_0x4d7b78(++_0x547c8c);}(_0xa8c0,0x129));var _0x0a8c=function(_0x2f37e0,_0x393ef9){_0x2f37e0=_0x2f37e0-0x0;var _0x43ccce=_0xa8c0[_0x2f37e0];return _0x43ccce;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x0a8c('0x0'))['db'][_0x0a8c('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a8c('0x2'),'afterDestroy':_0x0a8c('0x3')};function emitEvent(_0x2b3649){return function(_0x383ece,_0x6d0dcf,_0x42b304){UserVoiceQueueRtEvents[_0x0a8c('0x4')](_0x2b3649+':'+_0x383ece['id'],_0x383ece);UserVoiceQueueRtEvents[_0x0a8c('0x4')](_0x2b3649,_0x383ece);_0x42b304(null);};}for(var e in events){if(events[_0x0a8c('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x0a8c('0x6')](e,emitEvent(event));}}module[_0x0a8c('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x6519=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x149ea6,_0x4e5a50){var _0x1cb8af=function(_0x4d1221){while(--_0x4d1221){_0x149ea6['push'](_0x149ea6['shift']());}};_0x1cb8af(++_0x4e5a50);}(_0x6519,0xe7));var _0x9651=function(_0x11b3f4,_0x371c17){_0x11b3f4=_0x11b3f4-0x0;var _0x47af1d=_0x6519[_0x11b3f4];return _0x47af1d;};'use strict';var EventEmitter=require(_0x9651('0x0'));var UserVoiceQueueRt=require(_0x9651('0x1'))['db'][_0x9651('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9651('0x3')](0x0);var events={'afterCreate':_0x9651('0x4'),'afterUpdate':_0x9651('0x5'),'afterDestroy':_0x9651('0x6')};function emitEvent(_0x278d27){return function(_0x4194b3,_0x4297f3,_0x3a239f){UserVoiceQueueRtEvents[_0x9651('0x7')](_0x278d27+':'+_0x4194b3['id'],_0x4194b3);UserVoiceQueueRtEvents[_0x9651('0x7')](_0x278d27,_0x4194b3);_0x3a239f(null);};}for(var e in events){if(events[_0x9651('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x9651('0x9')](e,emitEvent(event));}}module[_0x9651('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index c216c22..b201cfe 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 _0x2443=['user_has_voice_queues_rt','util','api','bluebird','path','rimraf','../../config/environment','UserVoiceQueueRt'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x2443,0x129));var _0x3244=function(_0x526c72,_0x4866f5){_0x526c72=_0x526c72-0x0;var _0x12d01e=_0x2443[_0x526c72];return _0x12d01e;};'use strict';var _=require('lodash');var util=require(_0x3244('0x0'));var logger=require('../../config/logger')(_0x3244('0x1'));var moment=require('moment');var BPromise=require(_0x3244('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3244('0x3'));var rimraf=require(_0x3244('0x4'));var config=require(_0x3244('0x5'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x182684,_0x344465){return _0x182684['define'](_0x3244('0x6'),attributes,{'tableName':_0x3244('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1777=['request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','api','moment','bluebird'];(function(_0x24e91d,_0x5d6ffe){var _0x324d8d=function(_0x53a0e0){while(--_0x53a0e0){_0x24e91d['push'](_0x24e91d['shift']());}};_0x324d8d(++_0x5d6ffe);}(_0x1777,0x164));var _0x7177=function(_0x4c8b19,_0x29fae4){_0x4c8b19=_0x4c8b19-0x0;var _0x27fef1=_0x1777[_0x4c8b19];return _0x27fef1;};'use strict';var _=require(_0x7177('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7177('0x1'));var moment=require(_0x7177('0x2'));var BPromise=require(_0x7177('0x3'));var rp=require(_0x7177('0x4'));var fs=require('fs');var path=require(_0x7177('0x5'));var rimraf=require('rimraf');var config=require(_0x7177('0x6'));var attributes=require(_0x7177('0x7'));module[_0x7177('0x8')]=function(_0x278e85,_0x252936){return _0x278e85[_0x7177('0x9')](_0x7177('0xa'),attributes,{'tableName':_0x7177('0xb'),'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 1412e95..0290a42 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 _0x293a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./userVoiceQueueRt.socket','register','request','info','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','catch','util','bluebird','ioredis'];(function(_0x1f109c,_0xd9952e){var _0x3984e8=function(_0x40b60b){while(--_0x40b60b){_0x1f109c['push'](_0x1f109c['shift']());}};_0x3984e8(++_0xd9952e);}(_0x293a,0x141));var _0xa293=function(_0x5795ee,_0x3896ca){_0x5795ee=_0x5795ee-0x0;var _0x5aad7c=_0x293a[_0x5795ee];return _0x5aad7c;};'use strict';var _=require('lodash');var util=require(_0xa293('0x0'));var moment=require('moment');var BPromise=require(_0xa293('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa293('0x2'));var db=require(_0xa293('0x3'))['db'];var utils=require(_0xa293('0x4'));var logger=require(_0xa293('0x5'))(_0xa293('0x6'));var config=require(_0xa293('0x7'));var jayson=require(_0xa293('0x8'));var client=jayson[_0xa293('0x9')][_0xa293('0xa')]({'port':0x232a});config['redis']=_[_0xa293('0xb')](config[_0xa293('0xc')],{'host':_0xa293('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa293('0xc')]));require(_0xa293('0xe'))[_0xa293('0xf')](socket);function respondWithRpcPromise(_0x1ed176,_0x24fa17,_0x271a9e){return new BPromise(function(_0x3bce41,_0x573778){return client[_0xa293('0x10')](_0x1ed176,_0x271a9e)['then'](function(_0x217623){logger[_0xa293('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x24fa17,_0xa293('0x12'));logger['debug'](_0xa293('0x13'),_0x24fa17,_0xa293('0x12'),JSON[_0xa293('0x14')](_0x217623));if(_0x217623[_0xa293('0x15')]){if(_0x217623[_0xa293('0x15')][_0xa293('0x16')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x24fa17,_0x217623[_0xa293('0x15')]['message']);return _0x573778(_0x217623[_0xa293('0x15')][_0xa293('0x17')]);}logger[_0xa293('0x15')](_0xa293('0x18'),_0x24fa17,_0x217623[_0xa293('0x15')][_0xa293('0x17')]);return _0x3bce41(_0x217623['error'][_0xa293('0x17')]);}else{logger[_0xa293('0x11')](_0xa293('0x18'),_0x24fa17,_0xa293('0x12'));_0x3bce41(_0x217623['result'][_0xa293('0x17')]);}})['catch'](function(_0x4e822a){logger[_0xa293('0x15')](_0xa293('0x18'),_0x24fa17,_0x4e822a);_0x573778(_0x4e822a);});});}exports[_0xa293('0x19')]=function(_0x406d37){var _0x711738=this;return new Promise(function(_0x43953d,_0x424f59){return db[_0xa293('0x1a')][_0xa293('0x1b')]({'raw':_0x406d37[_0xa293('0x1c')]?_0x406d37[_0xa293('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x406d37[_0xa293('0x1c')]?_0x406d37['options'][_0xa293('0x1d')]||null:null,'attributes':[[db[_0xa293('0x1e')]['fn']('COUNT',db[_0xa293('0x1e')]['fn']('IF',db['sequelize'][_0xa293('0x1f')](_0xa293('0x20')))),_0xa293('0x21')]]})[_0xa293('0x22')](function(_0x85eabb){logger[_0xa293('0x11')](_0xa293('0x19'),_0x406d37);logger['debug'](_0xa293('0x19'),_0x406d37,JSON[_0xa293('0x14')](_0x85eabb));_0x43953d(_0x85eabb);})[_0xa293('0x23')](function(_0x575e42){logger[_0xa293('0x15')](_0xa293('0x19'),_0x575e42[_0xa293('0x17')],_0x406d37);_0x424f59(_0x711738['error'](0x1f4,_0x575e42[_0xa293('0x17')]));});});}; \ No newline at end of file +var _0x6ad1=['options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll'];(function(_0x48607a,_0xdd5c99){var _0x116bf0=function(_0x569d45){while(--_0x569d45){_0x48607a['push'](_0x48607a['shift']());}};_0x116bf0(++_0xdd5c99);}(_0x6ad1,0xdf));var _0x16ad=function(_0x5c2670,_0x20b71a){_0x5c2670=_0x5c2670-0x0;var _0x1b14d7=_0x6ad1[_0x5c2670];return _0x1b14d7;};'use strict';var _=require(_0x16ad('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x16ad('0x1'));var rs=require(_0x16ad('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16ad('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x16ad('0x4'))(_0x16ad('0x5'));var config=require(_0x16ad('0x6'));var jayson=require(_0x16ad('0x7'));var client=jayson['client'][_0x16ad('0x8')]({'port':0x232a});config[_0x16ad('0x9')]=_[_0x16ad('0xa')](config[_0x16ad('0x9')],{'host':_0x16ad('0xb'),'port':0x18eb});var socket=require(_0x16ad('0xc'))(new Redis(config[_0x16ad('0x9')]));require(_0x16ad('0xd'))[_0x16ad('0xe')](socket);function respondWithRpcPromise(_0x1f6487,_0xb43d36,_0x460ee2){return new BPromise(function(_0x5d8473,_0x21f308){return client['request'](_0x1f6487,_0x460ee2)[_0x16ad('0xf')](function(_0x4a1a5a){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0xb43d36,_0x16ad('0x10'));logger['debug'](_0x16ad('0x11'),_0xb43d36,_0x16ad('0x10'),JSON[_0x16ad('0x12')](_0x4a1a5a));if(_0x4a1a5a[_0x16ad('0x13')]){if(_0x4a1a5a[_0x16ad('0x13')][_0x16ad('0x14')]===0x1f4){logger[_0x16ad('0x13')](_0x16ad('0x15'),_0xb43d36,_0x4a1a5a[_0x16ad('0x13')][_0x16ad('0x16')]);return _0x21f308(_0x4a1a5a[_0x16ad('0x13')][_0x16ad('0x16')]);}logger['error'](_0x16ad('0x15'),_0xb43d36,_0x4a1a5a[_0x16ad('0x13')][_0x16ad('0x16')]);return _0x5d8473(_0x4a1a5a[_0x16ad('0x13')]['message']);}else{logger[_0x16ad('0x17')](_0x16ad('0x15'),_0xb43d36,_0x16ad('0x10'));_0x5d8473(_0x4a1a5a[_0x16ad('0x18')][_0x16ad('0x16')]);}})[_0x16ad('0x19')](function(_0xc87bad){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0xb43d36,_0xc87bad);_0x21f308(_0xc87bad);});});}exports[_0x16ad('0x1a')]=function(_0xc3cd16){var _0x238679=this;return new Promise(function(_0x22d459,_0x36f76d){return db[_0x16ad('0x1b')][_0x16ad('0x1c')]({'raw':_0xc3cd16[_0x16ad('0x1d')]?_0xc3cd16[_0x16ad('0x1d')][_0x16ad('0x1e')]===undefined?!![]:![]:!![],'where':_0xc3cd16[_0x16ad('0x1d')]?_0xc3cd16['options']['where']||null:null,'attributes':[[db[_0x16ad('0x1f')]['fn'](_0x16ad('0x20'),db['sequelize']['fn']('IF',db[_0x16ad('0x1f')][_0x16ad('0x21')](_0x16ad('0x22')))),_0x16ad('0x23')]]})[_0x16ad('0xf')](function(_0x326076){logger[_0x16ad('0x17')](_0x16ad('0x1a'),_0xc3cd16);logger['debug'](_0x16ad('0x1a'),_0xc3cd16,JSON['stringify'](_0x326076));_0x22d459(_0x326076);})[_0x16ad('0x19')](function(_0x2cfed4){logger[_0x16ad('0x13')](_0x16ad('0x1a'),_0x2cfed4[_0x16ad('0x16')],_0xc3cd16);_0x36f76d(_0x238679['error'](0x1f4,_0x2cfed4['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 8208f3d..c1b8ac7 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 _0xb522=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','register','length'];(function(_0x1553f7,_0x428ff2){var _0x35a1f3=function(_0x4d762b){while(--_0x4d762b){_0x1553f7['push'](_0x1553f7['shift']());}};_0x35a1f3(++_0x428ff2);}(_0xb522,0x119));var _0x2b52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb522[_0x3dd15e];return _0x231fd0;};'use strict';var UserVoiceQueueRtEvents=require(_0x2b52('0x0'));var events=[_0x2b52('0x1'),_0x2b52('0x2'),_0x2b52('0x3')];function createListener(_0x47a8ae,_0x88c813){return function(_0x5061d4){_0x88c813['emit'](_0x47a8ae,_0x5061d4);};}function removeListener(_0x46b14a,_0x59fc72){return function(){UserVoiceQueueRtEvents['removeListener'](_0x46b14a,_0x59fc72);};}exports[_0x2b52('0x4')]=function(_0x2e77c2){for(var _0x1f30b6=0x0,_0x225bac=events[_0x2b52('0x5')];_0x1f30b6<_0x225bac;_0x1f30b6++){var _0x4ae435=events[_0x1f30b6];var _0x2bd672=createListener(_0x2b52('0x6')+_0x4ae435,_0x2e77c2);UserVoiceQueueRtEvents['on'](_0x4ae435,_0x2bd672);}}; \ No newline at end of file +var _0x75cf=['remove','emit','removeListener','register','length','./userVoiceQueueRt.events','save'];(function(_0x59568c,_0x5176e5){var _0x143e8c=function(_0x5d710a){while(--_0x5d710a){_0x59568c['push'](_0x59568c['shift']());}};_0x143e8c(++_0x5176e5);}(_0x75cf,0x186));var _0xf75c=function(_0x36fc5d,_0x3380a1){_0x36fc5d=_0x36fc5d-0x0;var _0x386a98=_0x75cf[_0x36fc5d];return _0x386a98;};'use strict';var UserVoiceQueueRtEvents=require(_0xf75c('0x0'));var events=[_0xf75c('0x1'),_0xf75c('0x2'),'update'];function createListener(_0x50130d,_0x152b11){return function(_0x242ef6){_0x152b11[_0xf75c('0x3')](_0x50130d,_0x242ef6);};}function removeListener(_0xefccb4,_0x2a7ea3){return function(){UserVoiceQueueRtEvents[_0xf75c('0x4')](_0xefccb4,_0x2a7ea3);};}exports[_0xf75c('0x5')]=function(_0x58f038){for(var _0x4f7b98=0x0,_0x200709=events[_0xf75c('0x6')];_0x4f7b98<_0x200709;_0x4f7b98++){var _0x1b4868=events[_0x4f7b98];var _0x2e3533=createListener('userVoiceQueueRt:'+_0x1b4868,_0x58f038);UserVoiceQueueRtEvents['on'](_0x1b4868,_0x2e3533);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index faf076c..250b71b 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 _0x2553=['util','path','connect-timeout','../../components/interaction/service','exports','multer'];(function(_0x5b19c5,_0x3665ff){var _0x50ec0a=function(_0x6687d2){while(--_0x6687d2){_0x5b19c5['push'](_0x5b19c5['shift']());}};_0x50ec0a(++_0x3665ff);}(_0x2553,0x89));var _0x3255=function(_0x376de5,_0x1b44a9){_0x376de5=_0x376de5-0x0;var _0x58d8f7=_0x2553[_0x376de5];return _0x58d8f7;};'use strict';var multer=require(_0x3255('0x0'));var util=require(_0x3255('0x1'));var path=require(_0x3255('0x2'));var timeout=require(_0x3255('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3255('0x4'));var config=require('../../config/environment');module[_0x3255('0x5')]=router; \ No newline at end of file +var _0xa11d=['exports','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa11d,0x173));var _0xda11=function(_0x2dcf8b,_0x477184){_0x2dcf8b=_0x2dcf8b-0x0;var _0x287c68=_0xa11d[_0x2dcf8b];return _0x287c68;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xda11('0x0'));var express=require(_0xda11('0x1'));var router=express[_0xda11('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xda11('0x3'));var config=require('../../config/environment');module[_0xda11('0x4')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 0c9401e..552a455 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x34559b,_0x42b8ed){var _0x517ca8=function(_0x4b92a7){while(--_0x4b92a7){_0x34559b['push'](_0x34559b['shift']());}};_0x517ca8(++_0x42b8ed);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x56fb33,_0x37be08){var _0x435ee4=function(_0xa80804){while(--_0xa80804){_0x56fb33['push'](_0x56fb33['shift']());}};_0x435ee4(++_0x37be08);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index fbc26a4..17cb606 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 _0x2d6f=['moment','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x2e4cbf,_0x8763d3){var _0x52840f=function(_0x31b93f){while(--_0x31b93f){_0x2e4cbf['push'](_0x2e4cbf['shift']());}};_0x52840f(++_0x8763d3);}(_0x2d6f,0x19c));var _0xf2d6=function(_0x4e1759,_0x1362c7){_0x4e1759=_0x4e1759-0x0;var _0xafdbdd=_0x2d6f[_0x4e1759];return _0xafdbdd;};'use strict';var _=require(_0xf2d6('0x0'));var util=require(_0xf2d6('0x1'));var logger=require(_0xf2d6('0x2'))(_0xf2d6('0x3'));var moment=require(_0xf2d6('0x4'));var BPromise=require(_0xf2d6('0x5'));var rp=require(_0xf2d6('0x6'));var fs=require('fs');var path=require(_0xf2d6('0x7'));var rimraf=require('rimraf');var config=require(_0xf2d6('0x8'));var attributes=require(_0xf2d6('0x9'));module['exports']=function(_0x574dcf,_0x4e4578){return _0x574dcf[_0xf2d6('0xa')](_0xf2d6('0xb'),attributes,{'tableName':_0xf2d6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c94=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0x9c94,0x152));var _0x49c9=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x9c94[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0x49c9('0x0'));var util=require(_0x49c9('0x1'));var logger=require('../../config/logger')(_0x49c9('0x2'));var moment=require(_0x49c9('0x3'));var BPromise=require(_0x49c9('0x4'));var rp=require(_0x49c9('0x5'));var fs=require('fs');var path=require(_0x49c9('0x6'));var rimraf=require('rimraf');var config=require(_0x49c9('0x7'));var attributes=require(_0x49c9('0x8'));module[_0x49c9('0x9')]=function(_0x586888,_0x2b9863){return _0x586888[_0x49c9('0xa')](_0x49c9('0xb'),attributes,{'tableName':_0x49c9('0xc'),'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 4d83bd5..dc34541 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(_0x1e8134,_0x1cefb8){var _0x3c65b3=function(_0x3369e1){while(--_0x3369e1){_0x1e8134['push'](_0x1e8134['shift']());}};_0x3c65b3(++_0x1cefb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x32c647,_0x33b974){var _0x1c7185=function(_0x496654){while(--_0x496654){_0x32c647['push'](_0x32c647['shift']());}};_0x1c7185(++_0x33b974);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 273f8a8..54cd964 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 _0x3c44=['index','show','create','put','/:id','isAuthenticated','update','delete','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xa6fefc,_0x24a434){var _0x2c65a7=function(_0x58c1d1){while(--_0x58c1d1){_0xa6fefc['push'](_0xa6fefc['shift']());}};_0x2c65a7(++_0x24a434);}(_0x3c44,0x129));var _0x43c4=function(_0x1768ee,_0x476865){_0x1768ee=_0x1768ee-0x0;var _0x5aa692=_0x3c44[_0x1768ee];return _0x5aa692;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x43c4('0x0'));var timeout=require(_0x43c4('0x1'));var express=require(_0x43c4('0x2'));var router=express['Router']();var auth=require(_0x43c4('0x3'));var interaction=require(_0x43c4('0x4'));var config=require(_0x43c4('0x5'));var controller=require('./variable.controller');router[_0x43c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x43c4('0x7')]);router[_0x43c4('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x43c4('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0x43c4('0x9')]);router[_0x43c4('0xa')](_0x43c4('0xb'),auth[_0x43c4('0xc')](),controller[_0x43c4('0xd')]);router[_0x43c4('0xe')](_0x43c4('0xb'),auth[_0x43c4('0xc')](),controller['destroy']);module[_0x43c4('0xf')]=router; \ No newline at end of file +var _0x38a4=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','post','create','put','delete','destroy','util'];(function(_0xe6f7f4,_0x4a0d73){var _0x2bfaef=function(_0x30e586){while(--_0x30e586){_0xe6f7f4['push'](_0xe6f7f4['shift']());}};_0x2bfaef(++_0x4a0d73);}(_0x38a4,0x6f));var _0x438a=function(_0x3f6bfc,_0x3c3ae4){_0x3f6bfc=_0x3f6bfc-0x0;var _0x1f0b7d=_0x38a4[_0x3f6bfc];return _0x1f0b7d;};'use strict';var multer=require('multer');var util=require(_0x438a('0x0'));var path=require('path');var timeout=require(_0x438a('0x1'));var express=require('express');var router=express[_0x438a('0x2')]();var auth=require(_0x438a('0x3'));var interaction=require(_0x438a('0x4'));var config=require(_0x438a('0x5'));var controller=require(_0x438a('0x6'));router[_0x438a('0x7')]('/',auth['isAuthenticated'](),controller[_0x438a('0x8')]);router['get'](_0x438a('0x9'),auth[_0x438a('0xa')](),controller['show']);router[_0x438a('0xb')]('/',auth['isAuthenticated'](),controller[_0x438a('0xc')]);router[_0x438a('0xd')](_0x438a('0x9'),auth[_0x438a('0xa')](),controller['update']);router[_0x438a('0xe')](_0x438a('0x9'),auth[_0x438a('0xa')](),controller[_0x438a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 58108d2..40b41fb 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 _0xedd4=['sequelize','exports','name','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xedd4,0xf8));var _0x4edd=function(_0x5561e3,_0x3eb93a){_0x5561e3=_0x5561e3-0x0;var _0x331c5a=_0xedd4[_0x5561e3];return _0x331c5a;};'use strict';var Sequelize=require(_0x4edd('0x0'));module[_0x4edd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4edd('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4edd('0x3')]}}; \ No newline at end of file +var _0x7c25=['STRING','exports','name'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x7c25,0x1d5));var _0x57c2=function(_0x123477,_0x1ebce6){_0x123477=_0x123477-0x0;var _0x5c532c=_0x7c25[_0x123477];return _0x5c532c;};'use strict';var Sequelize=require('sequelize');module[_0x57c2('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x57c2('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x57c2('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 4a9d239..0130755 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 _0xdb10=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','then','destroy','get','Variables','stack','name','send','index','Variable','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','count','includeAll','findAll','rows','catch','show','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','error','update','find','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x52c60c,_0x58c2b8){var _0x9d771=function(_0x499dce){while(--_0x499dce){_0x52c60c['push'](_0x52c60c['shift']());}};_0x9d771(++_0x58c2b8);}(_0xdb10,0x18f));var _0x0db1=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0xdb10[_0x39872b];return _0x55fa18;};'use strict';var pdf=require(_0x0db1('0x0'));var emlformat=require(_0x0db1('0x1'));var rimraf=require(_0x0db1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0db1('0x3'));var rp=require(_0x0db1('0x4'));var moment=require(_0x0db1('0x5'));var BPromise=require(_0x0db1('0x6'));var Mustache=require(_0x0db1('0x7'));var util=require(_0x0db1('0x8'));var path=require(_0x0db1('0x9'));var sox=require(_0x0db1('0xa'));var csv=require(_0x0db1('0xb'));var ejs=require(_0x0db1('0xc'));var fs=require('fs');var _=require(_0x0db1('0xd'));var squel=require(_0x0db1('0xe'));var crypto=require(_0x0db1('0xf'));var jsforce=require(_0x0db1('0x10'));var deskjs=require(_0x0db1('0x11'));var toCsv=require(_0x0db1('0xb'));var querystring=require(_0x0db1('0x12'));var Papa=require(_0x0db1('0x13'));var Redis=require(_0x0db1('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x0db1('0x15'));var as=require(_0x0db1('0x16'));var hardwareService=require(_0x0db1('0x17'));var logger=require(_0x0db1('0x18'))(_0x0db1('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0db1('0x1a'))['db'];function respondWithStatusCode(_0x2bacc6,_0x211fda){_0x211fda=_0x211fda||0xcc;return function(_0x1f6522){if(_0x1f6522){return _0x2bacc6[_0x0db1('0x1b')](_0x211fda);}return _0x2bacc6[_0x0db1('0x1c')](_0x211fda)[_0x0db1('0x1d')]();};}function respondWithResult(_0x3654b8,_0x40bb35){_0x40bb35=_0x40bb35||0xc8;return function(_0x439a9c){if(_0x439a9c){return _0x3654b8[_0x0db1('0x1c')](_0x40bb35)[_0x0db1('0x1e')](_0x439a9c);}};}function respondWithFilteredResult(_0x1f4894,_0x1f9c45){return function(_0x397659){if(_0x397659){var _0x5224ac=_0x397659['count'],_0x3f151e=_0x1f9c45[_0x0db1('0x1f')],_0x260236=_0x1f9c45['offset']+_0x1f9c45[_0x0db1('0x20')],_0x52842e;if(_0x260236>=_0x5224ac){_0x260236=_0x5224ac;_0x52842e=0xc8;}else{_0x52842e=0xce;}_0x1f4894[_0x0db1('0x1c')](_0x52842e);return _0x1f4894[_0x0db1('0x21')](_0x0db1('0x22'),_0x3f151e+'-'+_0x260236+'/'+_0x5224ac)[_0x0db1('0x1e')](_0x397659);}return null;};}function patchUpdates(_0x449d57){return function(_0x6c7649){try{jsonpatch['apply'](_0x6c7649,_0x449d57,!![]);}catch(_0x4bc231){return BPromise[_0x0db1('0x23')](_0x4bc231);}return _0x6c7649['save']();};}function saveUpdates(_0x487351,_0x7e38ef){return function(_0x3e8f74){if(_0x3e8f74){return _0x3e8f74['update'](_0x487351)[_0x0db1('0x24')](function(_0x5acf91){return _0x5acf91;});}return null;};}function removeEntity(_0x4c666f,_0x31ee00){return function(_0x3f04cd){if(_0x3f04cd){return _0x3f04cd[_0x0db1('0x25')]()[_0x0db1('0x24')](function(){var _0x15d68f=_0x3f04cd[_0x0db1('0x26')]({'plain':!![]});var _0x32ee6e=_0x0db1('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x32ee6e,'resourceId':_0x15d68f['id']}})[_0x0db1('0x24')](function(){return _0x3f04cd;});})[_0x0db1('0x24')](function(){_0x4c666f['status'](0xcc)[_0x0db1('0x1d')]();});}};}function handleEntityNotFound(_0x1c5506,_0x5456f6){return function(_0x457ad2){if(!_0x457ad2){_0x1c5506[_0x0db1('0x1b')](0x194);}return _0x457ad2;};}function handleError(_0x5b2996,_0x3b7677){_0x3b7677=_0x3b7677||0x1f4;return function(_0x45787b){logger['error'](_0x45787b[_0x0db1('0x28')]);if(_0x45787b['name']){delete _0x45787b[_0x0db1('0x29')];}_0x5b2996['status'](_0x3b7677)[_0x0db1('0x2a')](_0x45787b);};}exports[_0x0db1('0x2b')]=function(_0x2c4f0e,_0x518f58){var _0xdf59e6={},_0x3c6feb={},_0x2cab33={'count':0x0,'rows':[]};var _0x29270d=_['map'](db[_0x0db1('0x2c')][_0x0db1('0x2d')],function(_0x32a078){return{'name':_0x32a078[_0x0db1('0x2e')],'type':_0x32a078[_0x0db1('0x2f')][_0x0db1('0x30')]};});_0x3c6feb[_0x0db1('0x31')]=_[_0x0db1('0x32')](_0x29270d,_0x0db1('0x29'));_0x3c6feb[_0x0db1('0x33')]=_[_0x0db1('0x34')](_0x2c4f0e['query']);_0x3c6feb[_0x0db1('0x35')]=_[_0x0db1('0x36')](_0x3c6feb[_0x0db1('0x31')],_0x3c6feb[_0x0db1('0x33')]);_0xdf59e6[_0x0db1('0x37')]=_[_0x0db1('0x36')](_0x3c6feb[_0x0db1('0x31')],qs[_0x0db1('0x38')](_0x2c4f0e[_0x0db1('0x33')][_0x0db1('0x38')]));_0xdf59e6['attributes']=_0xdf59e6[_0x0db1('0x37')][_0x0db1('0x39')]?_0xdf59e6[_0x0db1('0x37')]:_0x3c6feb[_0x0db1('0x31')];if(!_0x2c4f0e[_0x0db1('0x33')][_0x0db1('0x3a')](_0x0db1('0x3b'))){_0xdf59e6[_0x0db1('0x20')]=qs[_0x0db1('0x20')](_0x2c4f0e[_0x0db1('0x33')]['limit']);_0xdf59e6[_0x0db1('0x1f')]=qs[_0x0db1('0x1f')](_0x2c4f0e[_0x0db1('0x33')][_0x0db1('0x1f')]);}_0xdf59e6[_0x0db1('0x3c')]=qs[_0x0db1('0x3d')](_0x2c4f0e[_0x0db1('0x33')][_0x0db1('0x3d')]);_0xdf59e6[_0x0db1('0x3e')]=qs[_0x0db1('0x35')](_['pick'](_0x2c4f0e['query'],_0x3c6feb['filters']),_0x29270d);if(_0x2c4f0e[_0x0db1('0x33')][_0x0db1('0x3f')]){_0xdf59e6['where']=_['merge'](_0xdf59e6['where'],{'$or':_[_0x0db1('0x32')](_0x29270d,function(_0x5413fc){if(_0x5413fc['type']!==_0x0db1('0x40')){var _0x20958c={};_0x20958c[_0x5413fc[_0x0db1('0x29')]]={'$like':'%'+_0x2c4f0e[_0x0db1('0x33')][_0x0db1('0x3f')]+'%'};return _0x20958c;}})});}_0xdf59e6=_['merge']({},_0xdf59e6,_0x2c4f0e['options']);var _0x369a2e={'where':_0xdf59e6[_0x0db1('0x3e')]};return db[_0x0db1('0x2c')][_0x0db1('0x41')](_0x369a2e)[_0x0db1('0x24')](function(_0x5c30b6){_0x2cab33['count']=_0x5c30b6;if(_0x2c4f0e[_0x0db1('0x33')][_0x0db1('0x42')]){_0xdf59e6['include']=[{'all':!![]}];}return db[_0x0db1('0x2c')][_0x0db1('0x43')](_0xdf59e6);})[_0x0db1('0x24')](function(_0x559d23){_0x2cab33[_0x0db1('0x44')]=_0x559d23;return _0x2cab33;})['then'](respondWithFilteredResult(_0x518f58,_0xdf59e6))[_0x0db1('0x45')](handleError(_0x518f58,null));};exports[_0x0db1('0x46')]=function(_0x1e7845,_0x14dffb){var _0xa2f721={'raw':!![],'where':{'id':_0x1e7845['params']['id']}},_0x53f2a8={};_0x53f2a8[_0x0db1('0x31')]=_[_0x0db1('0x34')](db['Variable'][_0x0db1('0x2d')]);_0x53f2a8['query']=_['keys'](_0x1e7845[_0x0db1('0x33')]);_0x53f2a8[_0x0db1('0x35')]=_[_0x0db1('0x36')](_0x53f2a8[_0x0db1('0x31')],_0x53f2a8[_0x0db1('0x33')]);_0xa2f721[_0x0db1('0x37')]=_[_0x0db1('0x36')](_0x53f2a8['model'],qs[_0x0db1('0x38')](_0x1e7845[_0x0db1('0x33')][_0x0db1('0x38')]));_0xa2f721['attributes']=_0xa2f721[_0x0db1('0x37')][_0x0db1('0x39')]?_0xa2f721[_0x0db1('0x37')]:_0x53f2a8[_0x0db1('0x31')];if(_0x1e7845['query'][_0x0db1('0x42')]){_0xa2f721['include']=[{'all':!![]}];}_0xa2f721=_[_0x0db1('0x47')]({},_0xa2f721,_0x1e7845[_0x0db1('0x48')]);return db[_0x0db1('0x2c')]['find'](_0xa2f721)[_0x0db1('0x24')](handleEntityNotFound(_0x14dffb,null))[_0x0db1('0x24')](respondWithResult(_0x14dffb,null))[_0x0db1('0x45')](handleError(_0x14dffb,null));};exports[_0x0db1('0x49')]=function(_0x51c33c,_0x843013){return db[_0x0db1('0x2c')][_0x0db1('0x49')](_0x51c33c[_0x0db1('0x4a')],{})[_0x0db1('0x24')](function(_0x18b956){var _0x59d192=_0x51c33c[_0x0db1('0x4b')][_0x0db1('0x26')]({'plain':!![]});if(!_0x59d192)throw new Error(_0x0db1('0x4c'));if(_0x59d192[_0x0db1('0x4d')]==='user'){var _0x37d623=_0x18b956[_0x0db1('0x26')]({'plain':!![]});var _0x291a4e=_0x0db1('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x291a4e,'userProfileId':_0x59d192[_0x0db1('0x4e')]},'raw':!![]})[_0x0db1('0x24')](function(_0x374c6d){if(_0x374c6d&&_0x374c6d['autoAssociation']===0x0){return db[_0x0db1('0x4f')][_0x0db1('0x49')]({'name':_0x37d623[_0x0db1('0x29')],'resourceId':_0x37d623['id'],'type':_0x374c6d[_0x0db1('0x29')],'sectionId':_0x374c6d['id']},{})[_0x0db1('0x24')](function(){return _0x18b956;});}else{return _0x18b956;}})['catch'](function(_0x285674){logger[_0x0db1('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x285674);throw _0x285674;});}return _0x18b956;})[_0x0db1('0x24')](respondWithResult(_0x843013,0xc9))[_0x0db1('0x45')](handleError(_0x843013,null));};exports[_0x0db1('0x51')]=function(_0x44312d,_0x434cb9){if(_0x44312d[_0x0db1('0x4a')]['id']){delete _0x44312d[_0x0db1('0x4a')]['id'];}return db[_0x0db1('0x2c')][_0x0db1('0x52')]({'where':{'id':_0x44312d[_0x0db1('0x53')]['id']}})[_0x0db1('0x24')](handleEntityNotFound(_0x434cb9,null))[_0x0db1('0x24')](saveUpdates(_0x44312d[_0x0db1('0x4a')],null))['then'](respondWithResult(_0x434cb9,null))[_0x0db1('0x45')](handleError(_0x434cb9,null));};exports[_0x0db1('0x25')]=function(_0x2d43fa,_0x68f38e){return db[_0x0db1('0x2c')]['find']({'where':{'id':_0x2d43fa[_0x0db1('0x53')]['id']}})[_0x0db1('0x24')](handleEntityNotFound(_0x68f38e,null))[_0x0db1('0x24')](removeEntity(_0x68f38e,null))[_0x0db1('0x45')](handleError(_0x68f38e,null));}; \ No newline at end of file +var _0x7385=['request-promise','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','apply','reject','save','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','length','model','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','rimraf','zip-dir','fast-json-patch'];(function(_0x23e12d,_0x280202){var _0x21419e=function(_0x1212d9){while(--_0x1212d9){_0x23e12d['push'](_0x23e12d['shift']());}};_0x21419e(++_0x280202);}(_0x7385,0x197));var _0x5738=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7385[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5738('0x0'));var zipdir=require(_0x5738('0x1'));var jsonpatch=require(_0x5738('0x2'));var rp=require(_0x5738('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5738('0x4'));var path=require(_0x5738('0x5'));var sox=require(_0x5738('0x6'));var csv=require('to-csv');var ejs=require(_0x5738('0x7'));var fs=require('fs');var _=require(_0x5738('0x8'));var squel=require(_0x5738('0x9'));var crypto=require('crypto');var jsforce=require(_0x5738('0xa'));var deskjs=require(_0x5738('0xb'));var toCsv=require(_0x5738('0xc'));var querystring=require(_0x5738('0xd'));var Papa=require(_0x5738('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5738('0xf'));var as=require(_0x5738('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5738('0x11'))(_0x5738('0x12'));var utils=require(_0x5738('0x13'));var config=require(_0x5738('0x14'));var db=require(_0x5738('0x15'))['db'];function respondWithStatusCode(_0x63bcfd,_0x19a0b){_0x19a0b=_0x19a0b||0xcc;return function(_0x52a461){if(_0x52a461){return _0x63bcfd[_0x5738('0x16')](_0x19a0b);}return _0x63bcfd['status'](_0x19a0b)[_0x5738('0x17')]();};}function respondWithResult(_0x50deb6,_0xc3f2ca){_0xc3f2ca=_0xc3f2ca||0xc8;return function(_0x236e6f){if(_0x236e6f){return _0x50deb6[_0x5738('0x18')](_0xc3f2ca)[_0x5738('0x19')](_0x236e6f);}};}function respondWithFilteredResult(_0x53c5bb,_0x2b586d){return function(_0x46150e){if(_0x46150e){var _0x313077=_0x46150e[_0x5738('0x1a')],_0x22ca5e=_0x2b586d[_0x5738('0x1b')],_0x6a7cee=_0x2b586d['offset']+_0x2b586d['limit'],_0x92aca2;if(_0x6a7cee>=_0x313077){_0x6a7cee=_0x313077;_0x92aca2=0xc8;}else{_0x92aca2=0xce;}_0x53c5bb[_0x5738('0x18')](_0x92aca2);return _0x53c5bb[_0x5738('0x1c')]('Content-Range',_0x22ca5e+'-'+_0x6a7cee+'/'+_0x313077)[_0x5738('0x19')](_0x46150e);}return null;};}function patchUpdates(_0x445750){return function(_0x2e0bc7){try{jsonpatch[_0x5738('0x1d')](_0x2e0bc7,_0x445750,!![]);}catch(_0x82faf9){return BPromise[_0x5738('0x1e')](_0x82faf9);}return _0x2e0bc7[_0x5738('0x1f')]();};}function saveUpdates(_0x513fe9,_0x5eb596){return function(_0x78d427){if(_0x78d427){return _0x78d427['update'](_0x513fe9)[_0x5738('0x20')](function(_0x2077a9){return _0x2077a9;});}return null;};}function removeEntity(_0x4c218a,_0x2c8b24){return function(_0x4542e4){if(_0x4542e4){return _0x4542e4[_0x5738('0x21')]()[_0x5738('0x20')](function(){var _0x200cc3=_0x4542e4[_0x5738('0x22')]({'plain':!![]});var _0x4fc5a2=_0x5738('0x23');return db[_0x5738('0x24')]['destroy']({'where':{'type':_0x4fc5a2,'resourceId':_0x200cc3['id']}})['then'](function(){return _0x4542e4;});})[_0x5738('0x20')](function(){_0x4c218a[_0x5738('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a3c1f,_0x348719){return function(_0x259e6b){if(!_0x259e6b){_0x3a3c1f[_0x5738('0x16')](0x194);}return _0x259e6b;};}function handleError(_0x365c50,_0x2c75d8){_0x2c75d8=_0x2c75d8||0x1f4;return function(_0x15c252){logger[_0x5738('0x25')](_0x15c252[_0x5738('0x26')]);if(_0x15c252['name']){delete _0x15c252[_0x5738('0x27')];}_0x365c50[_0x5738('0x18')](_0x2c75d8)[_0x5738('0x28')](_0x15c252);};}exports[_0x5738('0x29')]=function(_0x17e3eb,_0x2ede66){var _0x44cc8d={},_0x1c1e53={},_0x15755b={'count':0x0,'rows':[]};var _0x28eff7=_[_0x5738('0x2a')](db[_0x5738('0x2b')][_0x5738('0x2c')],function(_0x9a372f){return{'name':_0x9a372f[_0x5738('0x2d')],'type':_0x9a372f[_0x5738('0x2e')]['key']};});_0x1c1e53['model']=_['map'](_0x28eff7,_0x5738('0x27'));_0x1c1e53[_0x5738('0x2f')]=_[_0x5738('0x30')](_0x17e3eb[_0x5738('0x2f')]);_0x1c1e53[_0x5738('0x31')]=_[_0x5738('0x32')](_0x1c1e53['model'],_0x1c1e53[_0x5738('0x2f')]);_0x44cc8d[_0x5738('0x33')]=_[_0x5738('0x32')](_0x1c1e53['model'],qs['fields'](_0x17e3eb[_0x5738('0x2f')]['fields']));_0x44cc8d['attributes']=_0x44cc8d['attributes'][_0x5738('0x34')]?_0x44cc8d['attributes']:_0x1c1e53[_0x5738('0x35')];if(!_0x17e3eb['query'][_0x5738('0x36')](_0x5738('0x37'))){_0x44cc8d[_0x5738('0x38')]=qs[_0x5738('0x38')](_0x17e3eb[_0x5738('0x2f')][_0x5738('0x38')]);_0x44cc8d[_0x5738('0x1b')]=qs[_0x5738('0x1b')](_0x17e3eb[_0x5738('0x2f')][_0x5738('0x1b')]);}_0x44cc8d[_0x5738('0x39')]=qs['sort'](_0x17e3eb[_0x5738('0x2f')][_0x5738('0x3a')]);_0x44cc8d[_0x5738('0x3b')]=qs['filters'](_[_0x5738('0x3c')](_0x17e3eb['query'],_0x1c1e53[_0x5738('0x31')]),_0x28eff7);if(_0x17e3eb[_0x5738('0x2f')][_0x5738('0x3d')]){_0x44cc8d[_0x5738('0x3b')]=_[_0x5738('0x3e')](_0x44cc8d[_0x5738('0x3b')],{'$or':_['map'](_0x28eff7,function(_0x38f2f9){if(_0x38f2f9[_0x5738('0x2e')]!==_0x5738('0x3f')){var _0x284c12={};_0x284c12[_0x38f2f9[_0x5738('0x27')]]={'$like':'%'+_0x17e3eb[_0x5738('0x2f')][_0x5738('0x3d')]+'%'};return _0x284c12;}})});}_0x44cc8d=_['merge']({},_0x44cc8d,_0x17e3eb[_0x5738('0x40')]);var _0x438cff={'where':_0x44cc8d['where']};return db[_0x5738('0x2b')]['count'](_0x438cff)['then'](function(_0x1cd10d){_0x15755b[_0x5738('0x1a')]=_0x1cd10d;if(_0x17e3eb[_0x5738('0x2f')][_0x5738('0x41')]){_0x44cc8d[_0x5738('0x42')]=[{'all':!![]}];}return db['Variable'][_0x5738('0x43')](_0x44cc8d);})['then'](function(_0x19a086){_0x15755b['rows']=_0x19a086;return _0x15755b;})[_0x5738('0x20')](respondWithFilteredResult(_0x2ede66,_0x44cc8d))[_0x5738('0x44')](handleError(_0x2ede66,null));};exports[_0x5738('0x45')]=function(_0x3de96a,_0x9fe1f0){var _0x1eaaa3={'raw':!![],'where':{'id':_0x3de96a['params']['id']}},_0x3615b8={};_0x3615b8[_0x5738('0x35')]=_[_0x5738('0x30')](db['Variable'][_0x5738('0x2c')]);_0x3615b8[_0x5738('0x2f')]=_[_0x5738('0x30')](_0x3de96a[_0x5738('0x2f')]);_0x3615b8[_0x5738('0x31')]=_[_0x5738('0x32')](_0x3615b8['model'],_0x3615b8[_0x5738('0x2f')]);_0x1eaaa3['attributes']=_[_0x5738('0x32')](_0x3615b8[_0x5738('0x35')],qs[_0x5738('0x46')](_0x3de96a[_0x5738('0x2f')][_0x5738('0x46')]));_0x1eaaa3[_0x5738('0x33')]=_0x1eaaa3[_0x5738('0x33')][_0x5738('0x34')]?_0x1eaaa3[_0x5738('0x33')]:_0x3615b8['model'];if(_0x3de96a[_0x5738('0x2f')]['includeAll']){_0x1eaaa3[_0x5738('0x42')]=[{'all':!![]}];}_0x1eaaa3=_[_0x5738('0x3e')]({},_0x1eaaa3,_0x3de96a[_0x5738('0x40')]);return db[_0x5738('0x2b')]['find'](_0x1eaaa3)[_0x5738('0x20')](handleEntityNotFound(_0x9fe1f0,null))[_0x5738('0x20')](respondWithResult(_0x9fe1f0,null))[_0x5738('0x44')](handleError(_0x9fe1f0,null));};exports[_0x5738('0x47')]=function(_0x5a5777,_0x41b21a){return db[_0x5738('0x2b')]['create'](_0x5a5777[_0x5738('0x48')],{})[_0x5738('0x20')](function(_0x2ce9d1){var _0x20d666=_0x5a5777[_0x5738('0x49')][_0x5738('0x22')]({'plain':!![]});if(!_0x20d666)throw new Error(_0x5738('0x4a'));if(_0x20d666[_0x5738('0x4b')]==='user'){var _0x3be9e4=_0x2ce9d1[_0x5738('0x22')]({'plain':!![]});var _0x13b6c4='Variables';return db[_0x5738('0x4c')][_0x5738('0x4d')]({'where':{'name':_0x13b6c4,'userProfileId':_0x20d666[_0x5738('0x4e')]},'raw':!![]})[_0x5738('0x20')](function(_0x587048){if(_0x587048&&_0x587048['autoAssociation']===0x0){return db[_0x5738('0x24')]['create']({'name':_0x3be9e4[_0x5738('0x27')],'resourceId':_0x3be9e4['id'],'type':_0x587048[_0x5738('0x27')],'sectionId':_0x587048['id']},{})[_0x5738('0x20')](function(){return _0x2ce9d1;});}else{return _0x2ce9d1;}})['catch'](function(_0x37e484){logger[_0x5738('0x25')](_0x5738('0x4f'),_0x37e484);throw _0x37e484;});}return _0x2ce9d1;})[_0x5738('0x20')](respondWithResult(_0x41b21a,0xc9))[_0x5738('0x44')](handleError(_0x41b21a,null));};exports[_0x5738('0x50')]=function(_0x23f8d5,_0x297885){if(_0x23f8d5['body']['id']){delete _0x23f8d5['body']['id'];}return db[_0x5738('0x2b')][_0x5738('0x4d')]({'where':{'id':_0x23f8d5[_0x5738('0x51')]['id']}})[_0x5738('0x20')](handleEntityNotFound(_0x297885,null))[_0x5738('0x20')](saveUpdates(_0x23f8d5[_0x5738('0x48')],null))['then'](respondWithResult(_0x297885,null))['catch'](handleError(_0x297885,null));};exports[_0x5738('0x21')]=function(_0x448831,_0x3454dc){return db[_0x5738('0x2b')][_0x5738('0x4d')]({'where':{'id':_0x448831[_0x5738('0x51')]['id']}})['then'](handleEntityNotFound(_0x3454dc,null))[_0x5738('0x20')](removeEntity(_0x3454dc,null))['catch'](handleError(_0x3454dc,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index c94ab66..78b3054 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 _0xbcea=['Variable','tools_variables','util','../../config/logger','moment','bluebird','request-promise','path','exports','define'];(function(_0x21108d,_0x233a7c){var _0x2d2fa8=function(_0x11f9e5){while(--_0x11f9e5){_0x21108d['push'](_0x21108d['shift']());}};_0x2d2fa8(++_0x233a7c);}(_0xbcea,0xa2));var _0xabce=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xbcea[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0xabce('0x0'));var logger=require(_0xabce('0x1'))('api');var moment=require(_0xabce('0x2'));var BPromise=require(_0xabce('0x3'));var rp=require(_0xabce('0x4'));var fs=require('fs');var path=require(_0xabce('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0xabce('0x6')]=function(_0x50ed02,_0x349edb){return _0x50ed02[_0xabce('0x7')](_0xabce('0x8'),attributes,{'tableName':_0xabce('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x262a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','tools_variables','lodash'];(function(_0xdbd251,_0x5a10f5){var _0x47ff35=function(_0x4321c3){while(--_0x4321c3){_0xdbd251['push'](_0xdbd251['shift']());}};_0x47ff35(++_0x5a10f5);}(_0x262a,0x178));var _0xa262=function(_0x34c553,_0x3e7dfc){_0x34c553=_0x34c553-0x0;var _0x1357d2=_0x262a[_0x34c553];return _0x1357d2;};'use strict';var _=require(_0xa262('0x0'));var util=require(_0xa262('0x1'));var logger=require(_0xa262('0x2'))(_0xa262('0x3'));var moment=require(_0xa262('0x4'));var BPromise=require(_0xa262('0x5'));var rp=require(_0xa262('0x6'));var fs=require('fs');var path=require(_0xa262('0x7'));var rimraf=require(_0xa262('0x8'));var config=require(_0xa262('0x9'));var attributes=require(_0xa262('0xa'));module[_0xa262('0xb')]=function(_0x35c7ba,_0x5a2a98){return _0x35c7ba['define']('Variable',attributes,{'tableName':_0xa262('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index ec16b26..bf0b0e3 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 _0xd051=['include','map','model','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Variable,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','ShowVariable','Variable','find','options','raw','where','attributes'];(function(_0x5013bd,_0x4d4b8d){var _0x5d3e13=function(_0x3dd8a0){while(--_0x3dd8a0){_0x5013bd['push'](_0x5013bd['shift']());}};_0x5d3e13(++_0x4d4b8d);}(_0xd051,0x1e3));var _0x1d05=function(_0x476016,_0x5ec9d7){_0x476016=_0x476016-0x0;var _0x33b1dd=_0xd051[_0x476016];return _0x33b1dd;};'use strict';var _=require('lodash');var util=require(_0x1d05('0x0'));var moment=require(_0x1d05('0x1'));var BPromise=require(_0x1d05('0x2'));var rs=require(_0x1d05('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d05('0x4'))['db'];var utils=require(_0x1d05('0x5'));var logger=require(_0x1d05('0x6'))(_0x1d05('0x7'));var config=require('../../config/environment');var jayson=require(_0x1d05('0x8'));var client=jayson['client'][_0x1d05('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1507e0,_0x53b00d,_0x370fd5){return new BPromise(function(_0x85c8e8,_0x39eecf){return client['request'](_0x1507e0,_0x370fd5)[_0x1d05('0xa')](function(_0x560abd){logger[_0x1d05('0xb')](_0x1d05('0xc'),_0x53b00d,'request\x20sent');logger[_0x1d05('0xd')]('Variable,\x20%s,\x20%s,\x20%s',_0x53b00d,_0x1d05('0xe'),JSON[_0x1d05('0xf')](_0x560abd));if(_0x560abd['error']){if(_0x560abd[_0x1d05('0x10')][_0x1d05('0x11')]===0x1f4){logger[_0x1d05('0x10')](_0x1d05('0xc'),_0x53b00d,_0x560abd[_0x1d05('0x10')][_0x1d05('0x12')]);return _0x39eecf(_0x560abd[_0x1d05('0x10')][_0x1d05('0x12')]);}logger[_0x1d05('0x10')]('Variable,\x20%s,\x20%s',_0x53b00d,_0x560abd[_0x1d05('0x10')][_0x1d05('0x12')]);return _0x85c8e8(_0x560abd[_0x1d05('0x10')][_0x1d05('0x12')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x53b00d,_0x1d05('0xe'));_0x85c8e8(_0x560abd[_0x1d05('0x13')][_0x1d05('0x12')]);}})['catch'](function(_0x245153){logger[_0x1d05('0x10')](_0x1d05('0xc'),_0x53b00d,_0x245153);_0x39eecf(_0x245153);});});}exports[_0x1d05('0x14')]=function(_0x4e15c9){var _0x3e3363=this;return new Promise(function(_0x2e4a32,_0x3d3299){return db[_0x1d05('0x15')][_0x1d05('0x16')]({'raw':_0x4e15c9['options']?_0x4e15c9[_0x1d05('0x17')][_0x1d05('0x18')]===undefined?!![]:![]:!![],'where':_0x4e15c9[_0x1d05('0x17')]?_0x4e15c9[_0x1d05('0x17')][_0x1d05('0x19')]||null:null,'attributes':_0x4e15c9['options']?_0x4e15c9[_0x1d05('0x17')][_0x1d05('0x1a')]||null:null,'include':_0x4e15c9[_0x1d05('0x17')]?_0x4e15c9[_0x1d05('0x17')][_0x1d05('0x1b')]?_[_0x1d05('0x1c')](_0x4e15c9['options'][_0x1d05('0x1b')],function(_0x289d9f){return{'model':db[_0x289d9f['model']],'as':_0x289d9f['as'],'attributes':_0x289d9f['attributes'],'include':_0x289d9f[_0x1d05('0x1b')]?_[_0x1d05('0x1c')](_0x289d9f[_0x1d05('0x1b')],function(_0x3db478){return{'model':db[_0x3db478[_0x1d05('0x1d')]],'as':_0x3db478['as'],'attributes':_0x3db478['attributes'],'include':_0x3db478[_0x1d05('0x1b')]?_[_0x1d05('0x1c')](_0x3db478[_0x1d05('0x1b')],function(_0x150d16){return{'model':db[_0x150d16[_0x1d05('0x1d')]],'as':_0x150d16['as'],'attributes':_0x150d16[_0x1d05('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1d05('0xa')](function(_0x149dee){logger[_0x1d05('0xb')]('ShowVariable',_0x4e15c9);logger['debug'](_0x1d05('0x14'),_0x4e15c9,JSON[_0x1d05('0xf')](_0x149dee));_0x2e4a32(_0x149dee);})['catch'](function(_0x4ac858){logger['error'](_0x1d05('0x14'),_0x4ac858['message'],_0x4e15c9);_0x3d3299(_0x3e3363[_0x1d05('0x10')](0x1f4,_0x4ac858[_0x1d05('0x12')]));});});}; \ No newline at end of file +var _0x48b2=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','find','options','raw','where','attributes','include','map','model','util','bluebird','randomstring','ioredis'];(function(_0x4f8063,_0x2336c6){var _0x3c7529=function(_0xfe0913){while(--_0xfe0913){_0x4f8063['push'](_0x4f8063['shift']());}};_0x3c7529(++_0x2336c6);}(_0x48b2,0x1bc));var _0x248b=function(_0x42cd5e,_0x553077){_0x42cd5e=_0x42cd5e-0x0;var _0x3c4097=_0x48b2[_0x42cd5e];return _0x3c4097;};'use strict';var _=require('lodash');var util=require(_0x248b('0x0'));var moment=require('moment');var BPromise=require(_0x248b('0x1'));var rs=require(_0x248b('0x2'));var fs=require('fs');var Redis=require(_0x248b('0x3'));var db=require(_0x248b('0x4'))['db'];var utils=require(_0x248b('0x5'));var logger=require(_0x248b('0x6'))(_0x248b('0x7'));var config=require(_0x248b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x248b('0x9')][_0x248b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x427e69,_0x367455,_0x18ad73){return new BPromise(function(_0x5e0def,_0x54222e){return client[_0x248b('0xb')](_0x427e69,_0x18ad73)[_0x248b('0xc')](function(_0x3197d1){logger[_0x248b('0xd')](_0x248b('0xe'),_0x367455,'request\x20sent');logger[_0x248b('0xf')](_0x248b('0x10'),_0x367455,_0x248b('0x11'),JSON['stringify'](_0x3197d1));if(_0x3197d1['error']){if(_0x3197d1[_0x248b('0x12')][_0x248b('0x13')]===0x1f4){logger[_0x248b('0x12')]('Variable,\x20%s,\x20%s',_0x367455,_0x3197d1[_0x248b('0x12')][_0x248b('0x14')]);return _0x54222e(_0x3197d1[_0x248b('0x12')]['message']);}logger[_0x248b('0x12')](_0x248b('0xe'),_0x367455,_0x3197d1[_0x248b('0x12')][_0x248b('0x14')]);return _0x5e0def(_0x3197d1['error'][_0x248b('0x14')]);}else{logger['info'](_0x248b('0xe'),_0x367455,_0x248b('0x11'));_0x5e0def(_0x3197d1[_0x248b('0x15')][_0x248b('0x14')]);}})[_0x248b('0x16')](function(_0x2609fc){logger[_0x248b('0x12')]('Variable,\x20%s,\x20%s',_0x367455,_0x2609fc);_0x54222e(_0x2609fc);});});}exports[_0x248b('0x17')]=function(_0x2e884e){var _0x36b824=this;return new Promise(function(_0x227aad,_0x9893fe){return db['Variable'][_0x248b('0x18')]({'raw':_0x2e884e['options']?_0x2e884e[_0x248b('0x19')][_0x248b('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e884e['options']?_0x2e884e[_0x248b('0x19')][_0x248b('0x1b')]||null:null,'attributes':_0x2e884e[_0x248b('0x19')]?_0x2e884e[_0x248b('0x19')][_0x248b('0x1c')]||null:null,'include':_0x2e884e[_0x248b('0x19')]?_0x2e884e[_0x248b('0x19')][_0x248b('0x1d')]?_[_0x248b('0x1e')](_0x2e884e[_0x248b('0x19')][_0x248b('0x1d')],function(_0x1234d7){return{'model':db[_0x1234d7[_0x248b('0x1f')]],'as':_0x1234d7['as'],'attributes':_0x1234d7[_0x248b('0x1c')],'include':_0x1234d7[_0x248b('0x1d')]?_['map'](_0x1234d7[_0x248b('0x1d')],function(_0x1a3a0a){return{'model':db[_0x1a3a0a['model']],'as':_0x1a3a0a['as'],'attributes':_0x1a3a0a[_0x248b('0x1c')],'include':_0x1a3a0a[_0x248b('0x1d')]?_[_0x248b('0x1e')](_0x1a3a0a['include'],function(_0x13670e){return{'model':db[_0x13670e[_0x248b('0x1f')]],'as':_0x13670e['as'],'attributes':_0x13670e[_0x248b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x248b('0xc')](function(_0x15b32a){logger['info'](_0x248b('0x17'),_0x2e884e);logger[_0x248b('0xf')](_0x248b('0x17'),_0x2e884e,JSON['stringify'](_0x15b32a));_0x227aad(_0x15b32a);})[_0x248b('0x16')](function(_0x1f5624){logger[_0x248b('0x12')]('ShowVariable',_0x1f5624['message'],_0x2e884e);_0x9893fe(_0x36b824[_0x248b('0x12')](0x1f4,_0x1f5624[_0x248b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 99e324c..77d0a52 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 _0x2351=['exports','express','Router','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','migrations'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2351,0x91));var _0x1235=function(_0x557e64,_0x10fd04){_0x557e64=_0x557e64-0x0;var _0x52b81e=_0x2351[_0x557e64];return _0x52b81e;};'use strict';var express=require(_0x1235('0x0'));var router=express[_0x1235('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x1235('0x2')]('/',controller[_0x1235('0x3')]);router['get'](_0x1235('0x4'),auth[_0x1235('0x5')](),auth[_0x1235('0x6')](),controller[_0x1235('0x7')]);router[_0x1235('0x2')](_0x1235('0x8'),auth[_0x1235('0x5')](),auth[_0x1235('0x6')](),controller[_0x1235('0x9')]);router[_0x1235('0x2')](_0x1235('0xa'),auth['isAuthenticated'](),auth[_0x1235('0x6')](),controller[_0x1235('0xb')]);router[_0x1235('0x2')](_0x1235('0xc'),auth[_0x1235('0x5')](),controller[_0x1235('0xd')]);router[_0x1235('0x2')]('/migrations',controller[_0x1235('0xe')]);module[_0x1235('0xf')]=router; \ No newline at end of file +var _0xd7a3=['/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull','/restart','migrations','exports','Router','../../components/auth/service','./version.controller','get','index'];(function(_0x282a38,_0x2acad1){var _0x2f5113=function(_0x17a4c7){while(--_0x17a4c7){_0x282a38['push'](_0x282a38['shift']());}};_0x2f5113(++_0x2acad1);}(_0xd7a3,0x1d7));var _0x3d7a=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xd7a3[_0xbca1b1];return _0x4e1686;};'use strict';var express=require('express');var router=express[_0x3d7a('0x0')]();var auth=require(_0x3d7a('0x1'));var controller=require(_0x3d7a('0x2'));router[_0x3d7a('0x3')]('/',controller[_0x3d7a('0x4')]);router[_0x3d7a('0x3')](_0x3d7a('0x5'),auth[_0x3d7a('0x6')](),auth[_0x3d7a('0x7')](),controller[_0x3d7a('0x8')]);router[_0x3d7a('0x3')](_0x3d7a('0x9'),auth[_0x3d7a('0x6')](),auth[_0x3d7a('0x7')](),controller['reset']);router[_0x3d7a('0x3')](_0x3d7a('0xa'),auth['isAuthenticated'](),auth[_0x3d7a('0x7')](),controller['pull']);router[_0x3d7a('0x3')](_0x3d7a('0xb'),auth[_0x3d7a('0x6')](),controller['restart']);router[_0x3d7a('0x3')]('/migrations',controller[_0x3d7a('0xc')]);module[_0x3d7a('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 37a8b3b..33c4a71 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 _0x3cae=['sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/logger','simple-git','root','index','exports','query','latest','tags','json','fetch','origin','master','error','status','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard','pull','restart','then','pm2\x20restart\x20motion\x20%s','migrations','length','replace','.js','push','sort'];(function(_0x139936,_0x474067){var _0x314c51=function(_0x480510){while(--_0x480510){_0x139936['push'](_0x139936['shift']());}};_0x314c51(++_0x474067);}(_0x3cae,0x117));var _0xe3ca=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0x3cae[_0x5c4f6b];return _0x104c4e;};'use strict';var Umzug=require(_0xe3ca('0x0'));var path=require(_0xe3ca('0x1'));var fs=require('fs');var _=require(_0xe3ca('0x2'));var pkginfo=require(_0xe3ca('0x3'))(module,_0xe3ca('0x4'));var compareVersions=require(_0xe3ca('0x5'));var exec=require(_0xe3ca('0x6'))['exec'];var db=require(_0xe3ca('0x7'))['db'];var config=require(_0xe3ca('0x8'));var pm2=require('../../config/pm2');var logger=require(_0xe3ca('0x9'))('update');var git=require(_0xe3ca('0xa'))(config[_0xe3ca('0xb')]);exports[_0xe3ca('0xc')]=function(_0x578178,_0x2c4863){var _0x100c20={'current':module[_0xe3ca('0xd')][_0xe3ca('0x4')],'phonebar':0x2};if(_0x578178[_0xe3ca('0xe')]&&_0x578178[_0xe3ca('0xe')][_0xe3ca('0xf')]){return git['fetch']()[_0xe3ca('0x10')](function(_0x59394d,_0x1d47e2){_0x100c20[_0xe3ca('0xf')]=(_0x59394d?module[_0xe3ca('0xd')][_0xe3ca('0x4')]:_0x1d47e2[_0xe3ca('0xf')])||'2.0.0';return _0x2c4863['status'](0xc8)[_0xe3ca('0x11')](_0x100c20);});}else{return _0x2c4863['status'](0xc8)[_0xe3ca('0x11')](_0x100c20);}};exports[_0xe3ca('0x12')]=function(_0x4857f0,_0x3d62e2){return git[_0xe3ca('0x12')]([_0xe3ca('0x13'),_0xe3ca('0x14')],function(_0x9ef773){if(_0x9ef773){logger[_0xe3ca('0x15')](_0x9ef773);return _0x3d62e2[_0xe3ca('0x16')](0x1f4)[_0xe3ca('0x11')](_0x9ef773);}logger['info']('git\x20fetch');return _0x3d62e2[_0xe3ca('0x16')](0xc8)[_0xe3ca('0x11')]({'output':_0xe3ca('0x17')});});};exports[_0xe3ca('0x18')]=function(_0x1dd153,_0x2d73d9){return git['reset']([_0xe3ca('0x19'),_0xe3ca('0x1a')],function(_0x180699){if(_0x180699){logger['error'](_0x180699);return _0x2d73d9['status'](0x1f4)['json'](_0x180699);}logger[_0xe3ca('0x1b')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x2d73d9['status'](0xc8)[_0xe3ca('0x11')]({'output':_0xe3ca('0x1c')});});};exports[_0xe3ca('0x1d')]=function(_0x149291,_0x2e26aa){exec('npm\x20install\x20--production',function(_0x3b1a75,_0x3ab26e,_0x5bc481){logger[_0xe3ca('0x1b')](_0x3ab26e);logger[_0xe3ca('0x1b')](_0x5bc481);if(_0x3b1a75){logger[_0xe3ca('0x15')](_0x3b1a75);return _0x2e26aa[_0xe3ca('0x16')](0x1f4)[_0xe3ca('0x11')](_0x3b1a75);}return _0x2e26aa[_0xe3ca('0x16')](0xc8)[_0xe3ca('0x11')]({'output':_0x3ab26e});});};exports[_0xe3ca('0x1e')]=function(_0x477ec7,_0x2fafd9){return pm2[_0xe3ca('0x1e')]('motion2')[_0xe3ca('0x1f')](function(_0x5740af){logger[_0xe3ca('0x1b')](_0xe3ca('0x20'),_0x5740af);return _0x2fafd9[_0xe3ca('0x16')](0xc8)[_0xe3ca('0x11')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x2e1636){logger[_0xe3ca('0x15')](_0x2e1636);return _0x2fafd9[_0xe3ca('0x16')](0x1f4)['json'](_0x2e1636);});};exports[_0xe3ca('0x21')]=function(_0x39dd6e,_0x1d28a2){var _0x17d3c7=fs['readdirSync'](path['join'](config[_0xe3ca('0xb')],'server',_0xe3ca('0x21')));var _0x5cf384=[];for(var _0x5576b4=0x0;_0x5576b4<_0x17d3c7[_0xe3ca('0x22')];_0x5576b4++){var _0x1517ac=_0x17d3c7[_0x5576b4][_0xe3ca('0x23')](_0xe3ca('0x24'),'');if(compareVersions(module[_0xe3ca('0xd')]['version'],_0x1517ac)===-0x1){_0x5cf384[_0xe3ca('0x25')](_0x1517ac);}}if(_0x5cf384['length']){var _0x5b2e69=_0x5cf384[_0xe3ca('0x26')](compareVersions);var _0x1acc28=new Umzug({'storage':_0xe3ca('0x27'),'storageOptions':{'model':db[_0xe3ca('0x28')],'modelName':_0xe3ca('0x28'),'columnName':_0xe3ca('0x4')},'migrations':{'params':[db[_0xe3ca('0x27')][_0xe3ca('0x29')](),db[_0xe3ca('0x27')][_0xe3ca('0x2a')],function(){throw new Error(_0xe3ca('0x2b'));}],'path':path[_0xe3ca('0x2c')](config['root'],_0xe3ca('0x2d'),_0xe3ca('0x21')),'pattern':/\.js$/}});_0x1acc28['up']({'migrations':_[_0xe3ca('0x2e')](_0x5b2e69,function(_0xf3a1d2){return _0xf3a1d2+_0xe3ca('0x24');})})[_0xe3ca('0x1f')](function(){return _0x1d28a2['status'](0xc8)[_0xe3ca('0x11')]({'output':_0xe3ca('0x2f')+module[_0xe3ca('0xd')][_0xe3ca('0x4')]+_0xe3ca('0x30')+_[_0xe3ca('0x31')](_0x5b2e69),'migrations':_[_0xe3ca('0x2c')](_0x5b2e69)});})[_0xe3ca('0x32')](function(_0x12714c){if(_0x12714c instanceof db['sequelize'][_0xe3ca('0x33')]){return _0x1d28a2[_0xe3ca('0x16')](0xc8)['json']({'output':_0xe3ca('0x34')});}else{return _0x1d28a2[_0xe3ca('0x16')](0x1f4)[_0xe3ca('0x11')](_0x12714c);}});}else{return _0x1d28a2['status'](0xc8)[_0xe3ca('0x11')]({'output':_0xe3ca('0x34')});}}; \ No newline at end of file +var _0xcf3d=['json','status','master','error','info','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','join','server','migrations','length','replace','.js','version','sort','sequelize','Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','query','latest','fetch','tags','exports','2.0.0'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcf3d,0x19e));var _0xdcf3=function(_0x512a92,_0x194e79){_0x512a92=_0x512a92-0x0;var _0x1cc619=_0xcf3d[_0x512a92];return _0x1cc619;};'use strict';var Umzug=require(_0xdcf3('0x0'));var path=require(_0xdcf3('0x1'));var fs=require('fs');var _=require(_0xdcf3('0x2'));var pkginfo=require(_0xdcf3('0x3'))(module,'version');var compareVersions=require(_0xdcf3('0x4'));var exec=require('child_process')[_0xdcf3('0x5')];var db=require(_0xdcf3('0x6'))['db'];var config=require(_0xdcf3('0x7'));var pm2=require(_0xdcf3('0x8'));var logger=require(_0xdcf3('0x9'))(_0xdcf3('0xa'));var git=require('simple-git')(config[_0xdcf3('0xb')]);exports['index']=function(_0x2cd0af,_0x45c5bd){var _0x55fe3a={'current':module['exports']['version'],'phonebar':0x2};if(_0x2cd0af[_0xdcf3('0xc')]&&_0x2cd0af[_0xdcf3('0xc')][_0xdcf3('0xd')]){return git[_0xdcf3('0xe')]()[_0xdcf3('0xf')](function(_0x6f7c77,_0x474801){_0x55fe3a[_0xdcf3('0xd')]=(_0x6f7c77?module[_0xdcf3('0x10')]['version']:_0x474801[_0xdcf3('0xd')])||_0xdcf3('0x11');return _0x45c5bd['status'](0xc8)[_0xdcf3('0x12')](_0x55fe3a);});}else{return _0x45c5bd[_0xdcf3('0x13')](0xc8)[_0xdcf3('0x12')](_0x55fe3a);}};exports[_0xdcf3('0xe')]=function(_0x5c2da7,_0x2d0bc2){return git[_0xdcf3('0xe')](['origin',_0xdcf3('0x14')],function(_0x4b622c){if(_0x4b622c){logger[_0xdcf3('0x15')](_0x4b622c);return _0x2d0bc2[_0xdcf3('0x13')](0x1f4)[_0xdcf3('0x12')](_0x4b622c);}logger[_0xdcf3('0x16')]('git\x20fetch');return _0x2d0bc2[_0xdcf3('0x13')](0xc8)[_0xdcf3('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xdcf3('0x17')]=function(_0x399579,_0x441142){return git[_0xdcf3('0x17')]([_0xdcf3('0x18'),_0xdcf3('0x19')],function(_0x28844a){if(_0x28844a){logger[_0xdcf3('0x15')](_0x28844a);return _0x441142[_0xdcf3('0x13')](0x1f4)[_0xdcf3('0x12')](_0x28844a);}logger[_0xdcf3('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x441142['status'](0xc8)[_0xdcf3('0x12')]({'output':_0xdcf3('0x1a')});});};exports['pull']=function(_0x4e3e41,_0x43e082){exec('npm\x20install\x20--production',function(_0x5622de,_0x71009c,_0x273591){logger[_0xdcf3('0x16')](_0x71009c);logger['info'](_0x273591);if(_0x5622de){logger[_0xdcf3('0x15')](_0x5622de);return _0x43e082['status'](0x1f4)[_0xdcf3('0x12')](_0x5622de);}return _0x43e082['status'](0xc8)[_0xdcf3('0x12')]({'output':_0x71009c});});};exports[_0xdcf3('0x1b')]=function(_0x1b600a,_0x39567f){return pm2['restart'](_0xdcf3('0x1c'))['then'](function(_0x968801){logger[_0xdcf3('0x16')](_0xdcf3('0x1d'),_0x968801);return _0x39567f[_0xdcf3('0x13')](0xc8)['json']({'output':_0xdcf3('0x1e')});})['catch'](function(_0x5c3ad7){logger['error'](_0x5c3ad7);return _0x39567f['status'](0x1f4)[_0xdcf3('0x12')](_0x5c3ad7);});};exports['migrations']=function(_0x3165a5,_0x56964c){var _0x3b34a5=fs['readdirSync'](path[_0xdcf3('0x1f')](config[_0xdcf3('0xb')],_0xdcf3('0x20'),_0xdcf3('0x21')));var _0x18a560=[];for(var _0x377083=0x0;_0x377083<_0x3b34a5[_0xdcf3('0x22')];_0x377083++){var _0xd846f9=_0x3b34a5[_0x377083][_0xdcf3('0x23')](_0xdcf3('0x24'),'');if(compareVersions(module[_0xdcf3('0x10')][_0xdcf3('0x25')],_0xd846f9)===-0x1){_0x18a560['push'](_0xd846f9);}}if(_0x18a560[_0xdcf3('0x22')]){var _0x42d0f9=_0x18a560[_0xdcf3('0x26')](compareVersions);var _0x3b8301=new Umzug({'storage':_0xdcf3('0x27'),'storageOptions':{'model':db[_0xdcf3('0x28')],'modelName':_0xdcf3('0x28'),'columnName':_0xdcf3('0x25')},'migrations':{'params':[db[_0xdcf3('0x27')]['getQueryInterface'](),db[_0xdcf3('0x27')]['constructor'],function(){throw new Error(_0xdcf3('0x29'));}],'path':path[_0xdcf3('0x1f')](config[_0xdcf3('0xb')],_0xdcf3('0x20'),_0xdcf3('0x21')),'pattern':/\.js$/}});_0x3b8301['up']({'migrations':_[_0xdcf3('0x2a')](_0x42d0f9,function(_0x4911ff){return _0x4911ff+_0xdcf3('0x24');})})[_0xdcf3('0x2b')](function(){return _0x56964c['status'](0xc8)[_0xdcf3('0x12')]({'output':_0xdcf3('0x2c')+module['exports'][_0xdcf3('0x25')]+_0xdcf3('0x2d')+_[_0xdcf3('0x2e')](_0x42d0f9),'migrations':_[_0xdcf3('0x1f')](_0x42d0f9)});})['catch'](function(_0x13d769){if(_0x13d769 instanceof db[_0xdcf3('0x27')]['UniqueConstraintError']){return _0x56964c['status'](0xc8)['json']({'output':_0xdcf3('0x2f')});}else{return _0x56964c[_0xdcf3('0x13')](0x1f4)[_0xdcf3('0x12')](_0x13d769);}});}else{return _0x56964c[_0xdcf3('0x13')](0xc8)[_0xdcf3('0x12')]({'output':_0xdcf3('0x2f')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 7e55253..2033413 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 _0x6f58=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','delete','/:id','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f58,0x160));var _0x86f5=function(_0x5e8840,_0x2fb916){_0x5e8840=_0x5e8840-0x0;var _0xdc6344=_0x6f58[_0x5e8840];return _0xdc6344;};'use strict';var multer=require(_0x86f5('0x0'));var util=require(_0x86f5('0x1'));var path=require(_0x86f5('0x2'));var timeout=require(_0x86f5('0x3'));var express=require(_0x86f5('0x4'));var router=express['Router']();var auth=require(_0x86f5('0x5'));var interaction=require(_0x86f5('0x6'));var config=require(_0x86f5('0x7'));var controller=require(_0x86f5('0x8'));router[_0x86f5('0x9')]('/',auth[_0x86f5('0xa')](),controller[_0x86f5('0xb')]);router[_0x86f5('0x9')](_0x86f5('0xc'),auth[_0x86f5('0xa')](),controller[_0x86f5('0xd')]);router['get']('/:id',auth[_0x86f5('0xa')](),controller[_0x86f5('0xe')]);router[_0x86f5('0xf')]('/',auth[_0x86f5('0xa')](),controller[_0x86f5('0x10')]);router[_0x86f5('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x86f5('0x12')](_0x86f5('0x13'),auth[_0x86f5('0xa')](),controller[_0x86f5('0x14')]);module[_0x86f5('0x15')]=router; \ No newline at end of file +var _0x152c=['isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get'];(function(_0x3239f5,_0x50e77c){var _0x3559c8=function(_0x4f9f83){while(--_0x4f9f83){_0x3239f5['push'](_0x3239f5['shift']());}};_0x3559c8(++_0x50e77c);}(_0x152c,0x161));var _0xc152=function(_0x5e6925,_0x2098d2){_0x5e6925=_0x5e6925-0x0;var _0x171596=_0x152c[_0x5e6925];return _0x171596;};'use strict';var multer=require(_0xc152('0x0'));var util=require(_0xc152('0x1'));var path=require(_0xc152('0x2'));var timeout=require(_0xc152('0x3'));var express=require(_0xc152('0x4'));var router=express[_0xc152('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc152('0x6'));var controller=require('./voiceAgentReport.controller');router[_0xc152('0x7')]('/',auth[_0xc152('0x8')](),controller['index']);router[_0xc152('0x7')](_0xc152('0x9'),auth[_0xc152('0x8')](),controller[_0xc152('0xa')]);router[_0xc152('0x7')](_0xc152('0xb'),auth[_0xc152('0x8')](),controller[_0xc152('0xc')]);router['post']('/',auth[_0xc152('0x8')](),controller[_0xc152('0xd')]);router[_0xc152('0xe')](_0xc152('0xb'),auth[_0xc152('0x8')](),controller[_0xc152('0xf')]);router[_0xc152('0x10')]('/:id',auth[_0xc152('0x8')](),controller[_0xc152('0x11')]);module[_0xc152('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index d321b3a..8c58b7e 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 _0x814b=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x5a6fd4,_0x38de2d){var _0x25e584=function(_0xb1c72a){while(--_0xb1c72a){_0x5a6fd4['push'](_0x5a6fd4['shift']());}};_0x25e584(++_0x38de2d);}(_0x814b,0x1a2));var _0xb814=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x814b[_0x154192];return _0x3c2792;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'type':{'type':Sequelize[_0xb814('0x2')]},'uniqueid':{'type':Sequelize[_0xb814('0x2')]},'calleridnum':{'type':Sequelize[_0xb814('0x2')]},'calleridname':{'type':Sequelize[_0xb814('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xb814('0x2')]},'membername':{'type':Sequelize[_0xb814('0x2')]},'agentcalledAt':{'type':Sequelize[_0xb814('0x3')]},'agentconnectAt':{'type':Sequelize[_0xb814('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xb814('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xb814('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xb814('0x4')]},'agentcomplete':{'type':Sequelize[_0xb814('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xb814('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xb814('0x4')]},'agentacw':{'type':Sequelize[_0xb814('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb814('0x4')]},'reason':{'type':Sequelize[_0xb814('0x2')]},'lastevent':{'type':Sequelize[_0xb814('0x2')]},'channel':{'type':Sequelize[_0xb814('0x2')]},'channelstate':{'type':Sequelize[_0xb814('0x4')]},'channelstatedesc':{'type':Sequelize[_0xb814('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb814('0x2')]},'connectedlinename':{'type':Sequelize[_0xb814('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb814('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb814('0x2')]},'priority':{'type':Sequelize[_0xb814('0x2')]},'destchannel':{'type':Sequelize[_0xb814('0x2')]},'destchannelstate':{'type':Sequelize[_0xb814('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xb814('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb814('0x2')]},'destcalleridname':{'type':Sequelize[_0xb814('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xb814('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb814('0x2')]},'destlanguage':{'type':Sequelize[_0xb814('0x2')]},'destaccountcode':{'type':Sequelize[_0xb814('0x2')]},'destcontext':{'type':Sequelize[_0xb814('0x2')]},'destexten':{'type':Sequelize[_0xb814('0x2')]},'destpriority':{'type':Sequelize[_0xb814('0x2')]},'destuniqueid':{'type':Sequelize[_0xb814('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb814('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xb814('0x2')]},'transfer':{'type':Sequelize[_0xb814('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb814('0x2')],'comment':_0xb814('0x6')},'transferexten':{'type':Sequelize[_0xb814('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xb814('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x326f=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x92ecc8,_0x2bcc34){var _0x59db4f=function(_0x16440d){while(--_0x16440d){_0x92ecc8['push'](_0x92ecc8['shift']());}};_0x59db4f(++_0x2bcc34);}(_0x326f,0xd1));var _0xf326=function(_0x55347b,_0x5e97ca){_0x55347b=_0x55347b-0x0;var _0x54fb1c=_0x326f[_0x55347b];return _0x54fb1c;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf326('0x1')]},'calleridnum':{'type':Sequelize[_0xf326('0x1')]},'calleridname':{'type':Sequelize[_0xf326('0x1')]},'queue':{'type':Sequelize[_0xf326('0x1')]},'interface':{'type':Sequelize[_0xf326('0x1')]},'membername':{'type':Sequelize[_0xf326('0x1')]},'agentcalledAt':{'type':Sequelize[_0xf326('0x2')]},'agentconnectAt':{'type':Sequelize[_0xf326('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xf326('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xf326('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xf326('0x3')]},'agentcomplete':{'type':Sequelize[_0xf326('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xf326('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xf326('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xf326('0x1')]},'lastevent':{'type':Sequelize[_0xf326('0x1')]},'channel':{'type':Sequelize[_0xf326('0x1')]},'channelstate':{'type':Sequelize[_0xf326('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf326('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf326('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf326('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf326('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf326('0x1')]},'destchannelstate':{'type':Sequelize[_0xf326('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xf326('0x1')]},'destcalleridname':{'type':Sequelize[_0xf326('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xf326('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xf326('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xf326('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xf326('0x1')]},'destuniqueid':{'type':Sequelize[_0xf326('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xf326('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xf326('0x1')]},'transfer':{'type':Sequelize[_0xf326('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf326('0x1')],'comment':_0xf326('0x5')},'transferexten':{'type':Sequelize[_0xf326('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xf326('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index dd144f1..45b271f 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 _0x5df8=['limit','set','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','VoiceAgentReport','fieldName','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','type','merge','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','count','offset'];(function(_0x407e38,_0x30e1cb){var _0x996a91=function(_0x58a6cc){while(--_0x58a6cc){_0x407e38['push'](_0x407e38['shift']());}};_0x996a91(++_0x30e1cb);}(_0x5df8,0xbc));var _0x85df=function(_0x3bd2d9,_0x493140){_0x3bd2d9=_0x3bd2d9-0x0;var _0x15f37b=_0x5df8[_0x3bd2d9];return _0x15f37b;};'use strict';var pdf=require(_0x85df('0x0'));var emlformat=require(_0x85df('0x1'));var rimraf=require(_0x85df('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x85df('0x3'));var rp=require(_0x85df('0x4'));var moment=require(_0x85df('0x5'));var BPromise=require(_0x85df('0x6'));var Mustache=require(_0x85df('0x7'));var util=require(_0x85df('0x8'));var path=require(_0x85df('0x9'));var sox=require(_0x85df('0xa'));var csv=require(_0x85df('0xb'));var ejs=require(_0x85df('0xc'));var fs=require('fs');var _=require(_0x85df('0xd'));var squel=require(_0x85df('0xe'));var crypto=require(_0x85df('0xf'));var jsforce=require(_0x85df('0x10'));var deskjs=require(_0x85df('0x11'));var toCsv=require(_0x85df('0xb'));var querystring=require('querystring');var Papa=require(_0x85df('0x12'));var Redis=require(_0x85df('0x13'));var authService=require(_0x85df('0x14'));var qs=require(_0x85df('0x15'));var as=require(_0x85df('0x16'));var hardwareService=require(_0x85df('0x17'));var logger=require(_0x85df('0x18'))(_0x85df('0x19'));var utils=require('../../config/utils');var config=require(_0x85df('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50bde1,_0x1f79fb){_0x1f79fb=_0x1f79fb||0xcc;return function(_0x1e1b6a){if(_0x1e1b6a){return _0x50bde1['sendStatus'](_0x1f79fb);}return _0x50bde1[_0x85df('0x1b')](_0x1f79fb)[_0x85df('0x1c')]();};}function respondWithResult(_0x7bb112,_0xcb4b2f){_0xcb4b2f=_0xcb4b2f||0xc8;return function(_0x403f20){if(_0x403f20){return _0x7bb112[_0x85df('0x1b')](_0xcb4b2f)['json'](_0x403f20);}};}function respondWithFilteredResult(_0x2fc3eb,_0x220911){return function(_0x3c48dc){if(_0x3c48dc){var _0x22b839=_0x3c48dc[_0x85df('0x1d')],_0x48a026=_0x220911[_0x85df('0x1e')],_0x3274ff=_0x220911[_0x85df('0x1e')]+_0x220911[_0x85df('0x1f')],_0x10423f;if(_0x3274ff>=_0x22b839){_0x3274ff=_0x22b839;_0x10423f=0xc8;}else{_0x10423f=0xce;}_0x2fc3eb[_0x85df('0x1b')](_0x10423f);return _0x2fc3eb[_0x85df('0x20')]('Content-Range',_0x48a026+'-'+_0x3274ff+'/'+_0x22b839)['json'](_0x3c48dc);}return null;};}function patchUpdates(_0x21b037){return function(_0x2f7172){try{jsonpatch['apply'](_0x2f7172,_0x21b037,!![]);}catch(_0x31b597){return BPromise[_0x85df('0x21')](_0x31b597);}return _0x2f7172[_0x85df('0x22')]();};}function saveUpdates(_0x54e25c,_0x16461e){return function(_0x24970d){if(_0x24970d){return _0x24970d[_0x85df('0x23')](_0x54e25c)[_0x85df('0x24')](function(_0x3be303){return _0x3be303;});}return null;};}function removeEntity(_0x28a490,_0xdb9886){return function(_0x4d110b){if(_0x4d110b){return _0x4d110b[_0x85df('0x25')]()['then'](function(){_0x28a490[_0x85df('0x1b')](0xcc)[_0x85df('0x1c')]();});}};}function handleEntityNotFound(_0x510f22,_0x3ec76a){return function(_0x2c5d70){if(!_0x2c5d70){_0x510f22[_0x85df('0x26')](0x194);}return _0x2c5d70;};}function handleError(_0x49abdb,_0x584d4c){_0x584d4c=_0x584d4c||0x1f4;return function(_0x2d10f4){logger[_0x85df('0x27')](_0x2d10f4[_0x85df('0x28')]);if(_0x2d10f4['name']){delete _0x2d10f4[_0x85df('0x29')];}_0x49abdb[_0x85df('0x1b')](_0x584d4c)[_0x85df('0x2a')](_0x2d10f4);};}exports[_0x85df('0x2b')]=function(_0x130442,_0x45949e){var _0x4d806f={},_0x44fab4={},_0x1215e9={'count':0x0,'rows':[]};var _0x1316f2=_['map'](db[_0x85df('0x2c')]['rawAttributes'],function(_0x19f687){return{'name':_0x19f687[_0x85df('0x2d')],'type':_0x19f687['type']['key']};});_0x44fab4[_0x85df('0x2e')]=_[_0x85df('0x2f')](_0x1316f2,_0x85df('0x29'));_0x44fab4[_0x85df('0x30')]=_['keys'](_0x130442[_0x85df('0x30')]);_0x44fab4[_0x85df('0x31')]=_[_0x85df('0x32')](_0x44fab4[_0x85df('0x2e')],_0x44fab4[_0x85df('0x30')]);_0x4d806f[_0x85df('0x33')]=_['intersection'](_0x44fab4['model'],qs[_0x85df('0x34')](_0x130442[_0x85df('0x30')][_0x85df('0x34')]));_0x4d806f['attributes']=_0x4d806f[_0x85df('0x33')][_0x85df('0x35')]?_0x4d806f[_0x85df('0x33')]:_0x44fab4[_0x85df('0x2e')];if(!_0x130442[_0x85df('0x30')]['hasOwnProperty'](_0x85df('0x36'))){_0x4d806f[_0x85df('0x1f')]=qs['limit'](_0x130442[_0x85df('0x30')]['limit']);_0x4d806f[_0x85df('0x1e')]=qs[_0x85df('0x1e')](_0x130442[_0x85df('0x30')]['offset']);}_0x4d806f[_0x85df('0x37')]=qs['sort'](_0x130442[_0x85df('0x30')][_0x85df('0x38')]);_0x4d806f[_0x85df('0x39')]=qs['filters'](_[_0x85df('0x3a')](_0x130442[_0x85df('0x30')],_0x44fab4['filters']),_0x1316f2);if(_0x130442['query']['filter']){_0x4d806f[_0x85df('0x39')]=_['merge'](_0x4d806f[_0x85df('0x39')],{'$or':_[_0x85df('0x2f')](_0x1316f2,function(_0x3d090d){if(_0x3d090d[_0x85df('0x3b')]!=='VIRTUAL'){var _0xebcbb9={};_0xebcbb9[_0x3d090d[_0x85df('0x29')]]={'$like':'%'+_0x130442[_0x85df('0x30')]['filter']+'%'};return _0xebcbb9;}})});}_0x4d806f=_[_0x85df('0x3c')]({},_0x4d806f,_0x130442['options']);var _0x3f2ad9={'where':_0x4d806f[_0x85df('0x39')]};return db[_0x85df('0x2c')]['count'](_0x3f2ad9)[_0x85df('0x24')](function(_0x47110e){_0x1215e9[_0x85df('0x1d')]=_0x47110e;if(_0x130442[_0x85df('0x30')][_0x85df('0x3d')]){_0x4d806f[_0x85df('0x3e')]=[{'all':!![]}];}return db[_0x85df('0x2c')][_0x85df('0x3f')](_0x4d806f);})[_0x85df('0x24')](function(_0x3b2c41){_0x1215e9['rows']=_0x3b2c41;return _0x1215e9;})[_0x85df('0x24')](respondWithFilteredResult(_0x45949e,_0x4d806f))[_0x85df('0x40')](handleError(_0x45949e,null));};exports[_0x85df('0x41')]=function(_0x357b68,_0x326eae){var _0x129e3b={'raw':![],'where':{'id':_0x357b68[_0x85df('0x42')]['id']}},_0x523ab6={};_0x523ab6[_0x85df('0x2e')]=_[_0x85df('0x43')](db[_0x85df('0x2c')]['rawAttributes']);_0x523ab6[_0x85df('0x30')]=_[_0x85df('0x43')](_0x357b68[_0x85df('0x30')]);_0x523ab6['filters']=_[_0x85df('0x32')](_0x523ab6[_0x85df('0x2e')],_0x523ab6[_0x85df('0x30')]);_0x129e3b[_0x85df('0x33')]=_[_0x85df('0x32')](_0x523ab6[_0x85df('0x2e')],qs[_0x85df('0x34')](_0x357b68[_0x85df('0x30')]['fields']));_0x129e3b['attributes']=_0x129e3b[_0x85df('0x33')][_0x85df('0x35')]?_0x129e3b[_0x85df('0x33')]:_0x523ab6[_0x85df('0x2e')];if(_0x357b68[_0x85df('0x30')]['includeAll']){_0x129e3b[_0x85df('0x3e')]=[{'all':!![]}];}_0x129e3b=_[_0x85df('0x3c')]({},_0x129e3b,_0x357b68[_0x85df('0x44')]);return db[_0x85df('0x2c')][_0x85df('0x45')](_0x129e3b)[_0x85df('0x24')](handleEntityNotFound(_0x326eae,null))[_0x85df('0x24')](respondWithResult(_0x326eae,null))[_0x85df('0x40')](handleError(_0x326eae,null));};exports[_0x85df('0x46')]=function(_0xe40969,_0xe4a805){return db['VoiceAgentReport'][_0x85df('0x46')](_0xe40969[_0x85df('0x47')],{})[_0x85df('0x24')](respondWithResult(_0xe4a805,0xc9))[_0x85df('0x40')](handleError(_0xe4a805,null));};exports[_0x85df('0x23')]=function(_0x3c1326,_0x13123b){if(_0x3c1326[_0x85df('0x47')]['id']){delete _0x3c1326['body']['id'];}return db[_0x85df('0x2c')][_0x85df('0x45')]({'where':{'id':_0x3c1326[_0x85df('0x42')]['id']}})[_0x85df('0x24')](handleEntityNotFound(_0x13123b,null))[_0x85df('0x24')](saveUpdates(_0x3c1326[_0x85df('0x47')],null))[_0x85df('0x24')](respondWithResult(_0x13123b,null))[_0x85df('0x40')](handleError(_0x13123b,null));};exports['destroy']=function(_0x2026f0,_0x21324b){return db[_0x85df('0x2c')]['find']({'where':{'id':_0x2026f0[_0x85df('0x42')]['id']}})[_0x85df('0x24')](handleEntityNotFound(_0x21324b,null))[_0x85df('0x24')](removeEntity(_0x21324b,null))[_0x85df('0x40')](handleError(_0x21324b,null));};exports['describe']=function(_0xdf263b,_0x148a96){return db['VoiceAgentReport'][_0x85df('0x48')]()[_0x85df('0x24')](respondWithResult(_0x148a96,null))['catch'](handleError(_0x148a96,null));}; \ No newline at end of file +var _0x4036=['describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','destroy','end','error','name','send','index','map','VoiceAgentReport','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','count','then','include','findAll','catch','show','includeAll','options','find','create','body','update','params'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x4036,0x182));var _0x6403=function(_0x6c0237,_0x4d210a){_0x6c0237=_0x6c0237-0x0;var _0x4889e3=_0x4036[_0x6c0237];return _0x4889e3;};'use strict';var pdf=require(_0x6403('0x0'));var emlformat=require(_0x6403('0x1'));var rimraf=require(_0x6403('0x2'));var zipdir=require(_0x6403('0x3'));var jsonpatch=require(_0x6403('0x4'));var rp=require('request-promise');var moment=require(_0x6403('0x5'));var BPromise=require(_0x6403('0x6'));var Mustache=require(_0x6403('0x7'));var util=require(_0x6403('0x8'));var path=require(_0x6403('0x9'));var sox=require(_0x6403('0xa'));var csv=require(_0x6403('0xb'));var ejs=require(_0x6403('0xc'));var fs=require('fs');var _=require(_0x6403('0xd'));var squel=require('squel');var crypto=require(_0x6403('0xe'));var jsforce=require(_0x6403('0xf'));var deskjs=require(_0x6403('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6403('0x11'));var Papa=require(_0x6403('0x12'));var Redis=require(_0x6403('0x13'));var authService=require(_0x6403('0x14'));var qs=require(_0x6403('0x15'));var as=require(_0x6403('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6403('0x17'))(_0x6403('0x18'));var utils=require(_0x6403('0x19'));var config=require(_0x6403('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x919cbd,_0x194231){_0x194231=_0x194231||0xcc;return function(_0x2d4ebd){if(_0x2d4ebd){return _0x919cbd[_0x6403('0x1b')](_0x194231);}return _0x919cbd[_0x6403('0x1c')](_0x194231)['end']();};}function respondWithResult(_0x42c13e,_0x1564bb){_0x1564bb=_0x1564bb||0xc8;return function(_0x43841b){if(_0x43841b){return _0x42c13e['status'](_0x1564bb)[_0x6403('0x1d')](_0x43841b);}};}function respondWithFilteredResult(_0x4c1bce,_0x2041e7){return function(_0xa0b66d){if(_0xa0b66d){var _0x2e0aca=_0xa0b66d['count'],_0x68ae2=_0x2041e7[_0x6403('0x1e')],_0x1828b4=_0x2041e7[_0x6403('0x1e')]+_0x2041e7[_0x6403('0x1f')],_0x26bf92;if(_0x1828b4>=_0x2e0aca){_0x1828b4=_0x2e0aca;_0x26bf92=0xc8;}else{_0x26bf92=0xce;}_0x4c1bce['status'](_0x26bf92);return _0x4c1bce[_0x6403('0x20')](_0x6403('0x21'),_0x68ae2+'-'+_0x1828b4+'/'+_0x2e0aca)[_0x6403('0x1d')](_0xa0b66d);}return null;};}function patchUpdates(_0x558cbd){return function(_0x541a69){try{jsonpatch['apply'](_0x541a69,_0x558cbd,!![]);}catch(_0x4cfacc){return BPromise[_0x6403('0x22')](_0x4cfacc);}return _0x541a69[_0x6403('0x23')]();};}function saveUpdates(_0x22fcb9,_0x285b32){return function(_0x923481){if(_0x923481){return _0x923481['update'](_0x22fcb9)['then'](function(_0x502d17){return _0x502d17;});}return null;};}function removeEntity(_0x41c986,_0x14c8bc){return function(_0x29b585){if(_0x29b585){return _0x29b585[_0x6403('0x24')]()['then'](function(){_0x41c986['status'](0xcc)[_0x6403('0x25')]();});}};}function handleEntityNotFound(_0xcad240,_0x393e47){return function(_0x25caf7){if(!_0x25caf7){_0xcad240[_0x6403('0x1b')](0x194);}return _0x25caf7;};}function handleError(_0x294e6d,_0x45426e){_0x45426e=_0x45426e||0x1f4;return function(_0x45deb6){logger[_0x6403('0x26')](_0x45deb6['stack']);if(_0x45deb6[_0x6403('0x27')]){delete _0x45deb6[_0x6403('0x27')];}_0x294e6d[_0x6403('0x1c')](_0x45426e)[_0x6403('0x28')](_0x45deb6);};}exports[_0x6403('0x29')]=function(_0x35fe40,_0x165897){var _0x598aa9={},_0x4b29b4={},_0x1b77e9={'count':0x0,'rows':[]};var _0x2e6b7d=_[_0x6403('0x2a')](db[_0x6403('0x2b')][_0x6403('0x2c')],function(_0x3253b2){return{'name':_0x3253b2['fieldName'],'type':_0x3253b2['type'][_0x6403('0x2d')]};});_0x4b29b4['model']=_[_0x6403('0x2a')](_0x2e6b7d,'name');_0x4b29b4[_0x6403('0x2e')]=_[_0x6403('0x2f')](_0x35fe40[_0x6403('0x2e')]);_0x4b29b4[_0x6403('0x30')]=_[_0x6403('0x31')](_0x4b29b4['model'],_0x4b29b4[_0x6403('0x2e')]);_0x598aa9['attributes']=_[_0x6403('0x31')](_0x4b29b4[_0x6403('0x32')],qs[_0x6403('0x33')](_0x35fe40[_0x6403('0x2e')]['fields']));_0x598aa9['attributes']=_0x598aa9[_0x6403('0x34')][_0x6403('0x35')]?_0x598aa9[_0x6403('0x34')]:_0x4b29b4[_0x6403('0x32')];if(!_0x35fe40['query'][_0x6403('0x36')]('nolimit')){_0x598aa9['limit']=qs[_0x6403('0x1f')](_0x35fe40['query']['limit']);_0x598aa9[_0x6403('0x1e')]=qs[_0x6403('0x1e')](_0x35fe40[_0x6403('0x2e')]['offset']);}_0x598aa9[_0x6403('0x37')]=qs[_0x6403('0x38')](_0x35fe40[_0x6403('0x2e')][_0x6403('0x38')]);_0x598aa9[_0x6403('0x39')]=qs[_0x6403('0x30')](_[_0x6403('0x3a')](_0x35fe40[_0x6403('0x2e')],_0x4b29b4['filters']),_0x2e6b7d);if(_0x35fe40[_0x6403('0x2e')]['filter']){_0x598aa9[_0x6403('0x39')]=_[_0x6403('0x3b')](_0x598aa9[_0x6403('0x39')],{'$or':_[_0x6403('0x2a')](_0x2e6b7d,function(_0x487811){if(_0x487811[_0x6403('0x3c')]!==_0x6403('0x3d')){var _0x5418b0={};_0x5418b0[_0x487811[_0x6403('0x27')]]={'$like':'%'+_0x35fe40['query'][_0x6403('0x3e')]+'%'};return _0x5418b0;}})});}_0x598aa9=_[_0x6403('0x3b')]({},_0x598aa9,_0x35fe40['options']);var _0x596640={'where':_0x598aa9['where']};return db['VoiceAgentReport'][_0x6403('0x3f')](_0x596640)[_0x6403('0x40')](function(_0x1c1211){_0x1b77e9['count']=_0x1c1211;if(_0x35fe40[_0x6403('0x2e')]['includeAll']){_0x598aa9[_0x6403('0x41')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x6403('0x42')](_0x598aa9);})[_0x6403('0x40')](function(_0xf1a2ef){_0x1b77e9['rows']=_0xf1a2ef;return _0x1b77e9;})[_0x6403('0x40')](respondWithFilteredResult(_0x165897,_0x598aa9))[_0x6403('0x43')](handleError(_0x165897,null));};exports[_0x6403('0x44')]=function(_0x39c6db,_0x17030a){var _0x3210b0={'raw':![],'where':{'id':_0x39c6db['params']['id']}},_0x1489e2={};_0x1489e2['model']=_[_0x6403('0x2f')](db[_0x6403('0x2b')]['rawAttributes']);_0x1489e2[_0x6403('0x2e')]=_[_0x6403('0x2f')](_0x39c6db['query']);_0x1489e2[_0x6403('0x30')]=_[_0x6403('0x31')](_0x1489e2[_0x6403('0x32')],_0x1489e2['query']);_0x3210b0[_0x6403('0x34')]=_[_0x6403('0x31')](_0x1489e2[_0x6403('0x32')],qs['fields'](_0x39c6db['query'][_0x6403('0x33')]));_0x3210b0[_0x6403('0x34')]=_0x3210b0[_0x6403('0x34')][_0x6403('0x35')]?_0x3210b0[_0x6403('0x34')]:_0x1489e2[_0x6403('0x32')];if(_0x39c6db[_0x6403('0x2e')][_0x6403('0x45')]){_0x3210b0[_0x6403('0x41')]=[{'all':!![]}];}_0x3210b0=_[_0x6403('0x3b')]({},_0x3210b0,_0x39c6db[_0x6403('0x46')]);return db[_0x6403('0x2b')][_0x6403('0x47')](_0x3210b0)[_0x6403('0x40')](handleEntityNotFound(_0x17030a,null))[_0x6403('0x40')](respondWithResult(_0x17030a,null))[_0x6403('0x43')](handleError(_0x17030a,null));};exports[_0x6403('0x48')]=function(_0x3c8fc3,_0x350708){return db[_0x6403('0x2b')][_0x6403('0x48')](_0x3c8fc3[_0x6403('0x49')],{})[_0x6403('0x40')](respondWithResult(_0x350708,0xc9))[_0x6403('0x43')](handleError(_0x350708,null));};exports[_0x6403('0x4a')]=function(_0x376846,_0x42a979){if(_0x376846['body']['id']){delete _0x376846[_0x6403('0x49')]['id'];}return db[_0x6403('0x2b')][_0x6403('0x47')]({'where':{'id':_0x376846[_0x6403('0x4b')]['id']}})[_0x6403('0x40')](handleEntityNotFound(_0x42a979,null))[_0x6403('0x40')](saveUpdates(_0x376846[_0x6403('0x49')],null))[_0x6403('0x40')](respondWithResult(_0x42a979,null))['catch'](handleError(_0x42a979,null));};exports[_0x6403('0x24')]=function(_0x3bf21d,_0x214532){return db[_0x6403('0x2b')][_0x6403('0x47')]({'where':{'id':_0x3bf21d[_0x6403('0x4b')]['id']}})[_0x6403('0x40')](handleEntityNotFound(_0x214532,null))[_0x6403('0x40')](removeEntity(_0x214532,null))[_0x6403('0x43')](handleError(_0x214532,null));};exports['describe']=function(_0x1c16ea,_0x63e9f6){return db[_0x6403('0x2b')][_0x6403('0x4c')]()[_0x6403('0x40')](respondWithResult(_0x63e9f6,null))[_0x6403('0x43')](handleError(_0x63e9f6,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index f6df98b..c7032ad 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.model.js +++ b/server/api/voiceAgentReport/voiceAgentReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['rimraf','./voiceAgentReport.attributes','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x4ac46a,_0x14750c){var _0x580697=function(_0x1800c9){while(--_0x1800c9){_0x4ac46a['push'](_0x4ac46a['shift']());}};_0x580697(++_0x14750c);}(_0x70e0,0x17b));var _0x070e=function(_0x8806d2,_0x5756c1){_0x8806d2=_0x8806d2-0x0;var _0x5f0c8e=_0x70e0[_0x8806d2];return _0x5f0c8e;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceAgentReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'fields':[_0x070e('0x9'),_0x070e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['./voiceAgentReport.attributes','exports','VoiceAgentReport','uniqueid','destuniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4372f4,_0x1527c4){var _0x5d1d6a=function(_0x4ad586){while(--_0x4ad586){_0x4372f4['push'](_0x4372f4['shift']());}};_0x5d1d6a(++_0x1527c4);}(_0xedd9,0xfc));var _0x9edd=function(_0x3a37d2,_0x54b39d){_0x3a37d2=_0x3a37d2-0x0;var _0x4ad477=_0xedd9[_0x3a37d2];return _0x4ad477;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x9edd('0xb'),_0x9edd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 3d30898..e92eb34 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 _0x9570=['http','request','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','catch','CreateVoiceAgentReport','create','body','options','raw','then','UpdateVoiceAgentReport','update','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0x9570,0x1a8));var _0x0957=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0x9570[_0x359bbe];return _0x1b3353;};'use strict';var _=require(_0x0957('0x0'));var util=require('util');var moment=require(_0x0957('0x1'));var BPromise=require(_0x0957('0x2'));var rs=require(_0x0957('0x3'));var fs=require('fs');var Redis=require(_0x0957('0x4'));var db=require(_0x0957('0x5'))['db'];var utils=require(_0x0957('0x6'));var logger=require(_0x0957('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0957('0x8'));var client=jayson[_0x0957('0x9')][_0x0957('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x438d32,_0x17d066,_0x23bd9d){return new BPromise(function(_0xf40d6b,_0x219fe3){return client[_0x0957('0xb')](_0x438d32,_0x23bd9d)['then'](function(_0x14ae7b){logger[_0x0957('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x17d066,'request\x20sent');logger[_0x0957('0xd')](_0x0957('0xe'),_0x17d066,_0x0957('0xf'),JSON[_0x0957('0x10')](_0x14ae7b));if(_0x14ae7b[_0x0957('0x11')]){if(_0x14ae7b[_0x0957('0x11')][_0x0957('0x12')]===0x1f4){logger[_0x0957('0x11')](_0x0957('0x13'),_0x17d066,_0x14ae7b[_0x0957('0x11')]['message']);return _0x219fe3(_0x14ae7b[_0x0957('0x11')][_0x0957('0x14')]);}logger[_0x0957('0x11')](_0x0957('0x13'),_0x17d066,_0x14ae7b[_0x0957('0x11')]['message']);return _0xf40d6b(_0x14ae7b[_0x0957('0x11')][_0x0957('0x14')]);}else{logger[_0x0957('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x17d066,_0x0957('0xf'));_0xf40d6b(_0x14ae7b['result'][_0x0957('0x14')]);}})[_0x0957('0x15')](function(_0x4da72c){logger[_0x0957('0x11')](_0x0957('0x13'),_0x17d066,_0x4da72c);_0x219fe3(_0x4da72c);});});}exports[_0x0957('0x16')]=function(_0x155020){var _0x1a4717=this;return new Promise(function(_0x3e9d3f,_0x17cf8d){return db['VoiceAgentReport'][_0x0957('0x17')](_0x155020[_0x0957('0x18')],{'raw':_0x155020['options']?_0x155020[_0x0957('0x19')][_0x0957('0x1a')]===undefined?!![]:![]:!![]})[_0x0957('0x1b')](function(_0x4c19fb){logger[_0x0957('0xc')](_0x0957('0x16'),_0x155020);logger['debug'](_0x0957('0x16'),_0x155020,JSON['stringify'](_0x4c19fb));_0x3e9d3f(_0x4c19fb);})[_0x0957('0x15')](function(_0x138d75){logger[_0x0957('0x11')](_0x0957('0x16'),_0x138d75[_0x0957('0x14')],_0x155020);_0x17cf8d(_0x1a4717[_0x0957('0x11')](0x1f4,_0x138d75['message']));});});};exports[_0x0957('0x1c')]=function(_0x1c1a33){var _0x58539f=this;return new Promise(function(_0x1f315b,_0x4adb06){return db['VoiceAgentReport'][_0x0957('0x1d')](_0x1c1a33[_0x0957('0x18')],{'raw':_0x1c1a33[_0x0957('0x19')]?_0x1c1a33[_0x0957('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c1a33[_0x0957('0x19')]?_0x1c1a33[_0x0957('0x19')]['where']||null:null,'attributes':_0x1c1a33['options']?_0x1c1a33[_0x0957('0x19')][_0x0957('0x1e')]||null:null,'limit':_0x1c1a33[_0x0957('0x19')]?_0x1c1a33['options']['limit']||null:null})[_0x0957('0x1b')](function(_0x429903){logger[_0x0957('0xc')](_0x0957('0x1c'),_0x1c1a33);logger[_0x0957('0xd')]('UpdateVoiceAgentReport',_0x1c1a33,JSON['stringify'](_0x429903));_0x1f315b(_0x429903);})[_0x0957('0x15')](function(_0x4a8ef1){logger[_0x0957('0x11')]('UpdateVoiceAgentReport',_0x4a8ef1[_0x0957('0x14')],_0x1c1a33);_0x4adb06(_0x58539f[_0x0957('0x11')](0x1f4,_0x4a8ef1['message']));});});}; \ No newline at end of file +var _0x6fcb=['CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','stringify','UpdateVoiceAgentReport','body','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x2fdebb,_0x1b5a57){var _0x2eb150=function(_0x3750e2){while(--_0x3750e2){_0x2fdebb['push'](_0x2fdebb['shift']());}};_0x2eb150(++_0x1b5a57);}(_0x6fcb,0x1db));var _0xb6fc=function(_0x2098cc,_0x5e108e){_0x2098cc=_0x2098cc-0x0;var _0x278d7c=_0x6fcb[_0x2098cc];return _0x278d7c;};'use strict';var _=require(_0xb6fc('0x0'));var util=require(_0xb6fc('0x1'));var moment=require(_0xb6fc('0x2'));var BPromise=require(_0xb6fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6fc('0x4'));var db=require(_0xb6fc('0x5'))['db'];var utils=require(_0xb6fc('0x6'));var logger=require(_0xb6fc('0x7'))(_0xb6fc('0x8'));var config=require('../../config/environment');var jayson=require(_0xb6fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x483bb1,_0x5f05c9,_0x49cfb9){return new BPromise(function(_0x39decf,_0x35e9c7){return client[_0xb6fc('0xa')](_0x483bb1,_0x49cfb9)[_0xb6fc('0xb')](function(_0x44b77e){logger[_0xb6fc('0xc')](_0xb6fc('0xd'),_0x5f05c9,'request\x20sent');logger[_0xb6fc('0xe')](_0xb6fc('0xf'),_0x5f05c9,_0xb6fc('0x10'),JSON['stringify'](_0x44b77e));if(_0x44b77e['error']){if(_0x44b77e['error']['code']===0x1f4){logger[_0xb6fc('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x5f05c9,_0x44b77e[_0xb6fc('0x11')]['message']);return _0x35e9c7(_0x44b77e['error'][_0xb6fc('0x12')]);}logger[_0xb6fc('0x11')](_0xb6fc('0xd'),_0x5f05c9,_0x44b77e['error'][_0xb6fc('0x12')]);return _0x39decf(_0x44b77e[_0xb6fc('0x11')][_0xb6fc('0x12')]);}else{logger['info'](_0xb6fc('0xd'),_0x5f05c9,_0xb6fc('0x10'));_0x39decf(_0x44b77e[_0xb6fc('0x13')][_0xb6fc('0x12')]);}})[_0xb6fc('0x14')](function(_0x3e3b7f){logger['error'](_0xb6fc('0xd'),_0x5f05c9,_0x3e3b7f);_0x35e9c7(_0x3e3b7f);});});}exports[_0xb6fc('0x15')]=function(_0x4cd295){var _0x488df8=this;return new Promise(function(_0x38dfa5,_0xc7e260){return db[_0xb6fc('0x16')][_0xb6fc('0x17')](_0x4cd295['body'],{'raw':_0x4cd295['options']?_0x4cd295[_0xb6fc('0x18')][_0xb6fc('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x32aaee){logger[_0xb6fc('0xc')](_0xb6fc('0x15'),_0x4cd295);logger[_0xb6fc('0xe')](_0xb6fc('0x15'),_0x4cd295,JSON[_0xb6fc('0x1a')](_0x32aaee));_0x38dfa5(_0x32aaee);})[_0xb6fc('0x14')](function(_0x46b020){logger[_0xb6fc('0x11')](_0xb6fc('0x15'),_0x46b020[_0xb6fc('0x12')],_0x4cd295);_0xc7e260(_0x488df8['error'](0x1f4,_0x46b020[_0xb6fc('0x12')]));});});};exports[_0xb6fc('0x1b')]=function(_0x106680){var _0x1df4ea=this;return new Promise(function(_0x38d3d0,_0x57ad40){return db['VoiceAgentReport']['update'](_0x106680[_0xb6fc('0x1c')],{'raw':_0x106680[_0xb6fc('0x18')]?_0x106680[_0xb6fc('0x18')][_0xb6fc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x106680[_0xb6fc('0x18')]?_0x106680[_0xb6fc('0x18')]['where']||null:null,'attributes':_0x106680[_0xb6fc('0x18')]?_0x106680['options'][_0xb6fc('0x1d')]||null:null,'limit':_0x106680[_0xb6fc('0x18')]?_0x106680['options'][_0xb6fc('0x1e')]||null:null})[_0xb6fc('0xb')](function(_0x395747){logger[_0xb6fc('0xc')](_0xb6fc('0x1b'),_0x106680);logger[_0xb6fc('0xe')](_0xb6fc('0x1b'),_0x106680,JSON['stringify'](_0x395747));_0x38d3d0(_0x395747);})[_0xb6fc('0x14')](function(_0x1972cf){logger[_0xb6fc('0x11')](_0xb6fc('0x1b'),_0x1972cf['message'],_0x106680);_0x57ad40(_0x1df4ea[_0xb6fc('0x11')](0x1f4,_0x1972cf[_0xb6fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 676be87..a08a98e 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 _0xf7a1=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy','exports'];(function(_0x82c04c,_0x4e795a){var _0x178b18=function(_0x1dee73){while(--_0x1dee73){_0x82c04c['push'](_0x82c04c['shift']());}};_0x178b18(++_0x4e795a);}(_0xf7a1,0xd2));var _0x1f7a=function(_0x364797,_0x2e97de){_0x364797=_0x364797-0x0;var _0x4ebd83=_0xf7a1[_0x364797];return _0x4ebd83;};'use strict';var multer=require(_0x1f7a('0x0'));var util=require(_0x1f7a('0x1'));var path=require('path');var timeout=require(_0x1f7a('0x2'));var express=require(_0x1f7a('0x3'));var router=express[_0x1f7a('0x4')]();var auth=require(_0x1f7a('0x5'));var interaction=require(_0x1f7a('0x6'));var config=require(_0x1f7a('0x7'));var controller=require(_0x1f7a('0x8'));router[_0x1f7a('0x9')]('/',auth[_0x1f7a('0xa')](),controller[_0x1f7a('0xb')]);router[_0x1f7a('0x9')](_0x1f7a('0xc'),auth['isAuthenticated'](),controller[_0x1f7a('0xd')]);router['get'](_0x1f7a('0xe'),auth[_0x1f7a('0xa')](),controller['show']);router[_0x1f7a('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1f7a('0x10')](_0x1f7a('0xe'),auth[_0x1f7a('0xa')](),controller[_0x1f7a('0x11')]);router[_0x1f7a('0x12')](_0x1f7a('0xe'),auth['isAuthenticated'](),controller[_0x1f7a('0x13')]);module[_0x1f7a('0x14')]=router; \ No newline at end of file +var _0x5ddc=['describe','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe'];(function(_0x2435f6,_0x901e14){var _0xa8674d=function(_0x4d2ba6){while(--_0x4d2ba6){_0x2435f6['push'](_0x2435f6['shift']());}};_0xa8674d(++_0x901e14);}(_0x5ddc,0x13d));var _0xc5dd=function(_0x54dca1,_0x58f006){_0x54dca1=_0x54dca1-0x0;var _0x22346d=_0x5ddc[_0x54dca1];return _0x22346d;};'use strict';var multer=require('multer');var util=require(_0xc5dd('0x0'));var path=require(_0xc5dd('0x1'));var timeout=require(_0xc5dd('0x2'));var express=require(_0xc5dd('0x3'));var router=express[_0xc5dd('0x4')]();var auth=require(_0xc5dd('0x5'));var interaction=require(_0xc5dd('0x6'));var config=require(_0xc5dd('0x7'));var controller=require(_0xc5dd('0x8'));router[_0xc5dd('0x9')]('/',auth[_0xc5dd('0xa')](),controller[_0xc5dd('0xb')]);router[_0xc5dd('0x9')](_0xc5dd('0xc'),auth[_0xc5dd('0xa')](),controller[_0xc5dd('0xd')]);router[_0xc5dd('0x9')](_0xc5dd('0xe'),auth[_0xc5dd('0xa')](),controller[_0xc5dd('0xf')]);router[_0xc5dd('0x10')]('/',auth['isAuthenticated'](),controller[_0xc5dd('0x11')]);router['put'](_0xc5dd('0xe'),auth['isAuthenticated'](),controller[_0xc5dd('0x12')]);router[_0xc5dd('0x13')](_0xc5dd('0xe'),auth['isAuthenticated'](),controller[_0xc5dd('0x14')]);module[_0xc5dd('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index acf7035..8833b6b 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(_0x280678,_0x14347a){var _0x3501fd=function(_0x3760c5){while(--_0x3760c5){_0x280678['push'](_0x280678['shift']());}};_0x3501fd(++_0x14347a);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'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(_0x2980c8,_0x1b7601){var _0x37dee9=function(_0x2602b0){while(--_0x2602b0){_0x2980c8['push'](_0x2980c8['shift']());}};_0x37dee9(++_0x1b7601);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'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 31edb81..81fac29 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 _0x2bcd=['util','path','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VoiceCallReport','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','intersection','merge','options','create','body','find','describe','uniqueid','user','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x55c2b5,_0x1dd3f9){var _0x145481=function(_0x4c3306){while(--_0x4c3306){_0x55c2b5['push'](_0x55c2b5['shift']());}};_0x145481(++_0x1dd3f9);}(_0x2bcd,0x96));var _0xd2bc=function(_0x38a449,_0x45d044){_0x38a449=_0x38a449-0x0;var _0x3efabb=_0x2bcd[_0x38a449];return _0x3efabb;};'use strict';var pdf=require(_0xd2bc('0x0'));var emlformat=require(_0xd2bc('0x1'));var rimraf=require(_0xd2bc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd2bc('0x3'));var rp=require(_0xd2bc('0x4'));var moment=require(_0xd2bc('0x5'));var BPromise=require(_0xd2bc('0x6'));var Mustache=require(_0xd2bc('0x7'));var util=require(_0xd2bc('0x8'));var path=require(_0xd2bc('0x9'));var sox=require('sox');var csv=require(_0xd2bc('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd2bc('0xb'));var squel=require(_0xd2bc('0xc'));var crypto=require(_0xd2bc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd2bc('0xe'));var toCsv=require(_0xd2bc('0xa'));var querystring=require('querystring');var Papa=require(_0xd2bc('0xf'));var Redis=require(_0xd2bc('0x10'));var authService=require(_0xd2bc('0x11'));var qs=require(_0xd2bc('0x12'));var as=require(_0xd2bc('0x13'));var hardwareService=require(_0xd2bc('0x14'));var logger=require(_0xd2bc('0x15'))(_0xd2bc('0x16'));var utils=require('../../config/utils');var config=require(_0xd2bc('0x17'));var db=require(_0xd2bc('0x18'))['db'];function respondWithStatusCode(_0x45429c,_0x195f3d){_0x195f3d=_0x195f3d||0xcc;return function(_0x142a15){if(_0x142a15){return _0x45429c['sendStatus'](_0x195f3d);}return _0x45429c[_0xd2bc('0x19')](_0x195f3d)[_0xd2bc('0x1a')]();};}function respondWithResult(_0x38d9f5,_0x564a4d){_0x564a4d=_0x564a4d||0xc8;return function(_0x3622ec){if(_0x3622ec){return _0x38d9f5[_0xd2bc('0x19')](_0x564a4d)['json'](_0x3622ec);}};}function respondWithFilteredResult(_0x5897f1,_0x4672af){return function(_0x19f649){if(_0x19f649){var _0x4671a4=_0x19f649[_0xd2bc('0x1b')],_0xbf0214=_0x4672af[_0xd2bc('0x1c')],_0x174de2=_0x4672af[_0xd2bc('0x1c')]+_0x4672af[_0xd2bc('0x1d')],_0x191fa1;if(_0x174de2>=_0x4671a4){_0x174de2=_0x4671a4;_0x191fa1=0xc8;}else{_0x191fa1=0xce;}_0x5897f1[_0xd2bc('0x19')](_0x191fa1);return _0x5897f1[_0xd2bc('0x1e')](_0xd2bc('0x1f'),_0xbf0214+'-'+_0x174de2+'/'+_0x4671a4)[_0xd2bc('0x20')](_0x19f649);}return null;};}function patchUpdates(_0x29efbf){return function(_0x10315e){try{jsonpatch[_0xd2bc('0x21')](_0x10315e,_0x29efbf,!![]);}catch(_0x1e3662){return BPromise[_0xd2bc('0x22')](_0x1e3662);}return _0x10315e[_0xd2bc('0x23')]();};}function saveUpdates(_0x193abc,_0x53276e){return function(_0x2997e3){if(_0x2997e3){return _0x2997e3[_0xd2bc('0x24')](_0x193abc)[_0xd2bc('0x25')](function(_0x2e752a){return _0x2e752a;});}return null;};}function removeEntity(_0x3c8ef9,_0x4c5dea){return function(_0x2378bc){if(_0x2378bc){return _0x2378bc[_0xd2bc('0x26')]()['then'](function(){_0x3c8ef9[_0xd2bc('0x19')](0xcc)[_0xd2bc('0x1a')]();});}};}function handleEntityNotFound(_0x186fe9,_0x2f5075){return function(_0x550a05){if(!_0x550a05){_0x186fe9['sendStatus'](0x194);}return _0x550a05;};}function handleError(_0x6b1295,_0x520b81){_0x520b81=_0x520b81||0x1f4;return function(_0xbd64aa){logger['error'](_0xbd64aa['stack']);if(_0xbd64aa[_0xd2bc('0x27')]){delete _0xbd64aa['name'];}_0x6b1295[_0xd2bc('0x19')](_0x520b81)['send'](_0xbd64aa);};}exports[_0xd2bc('0x28')]=function(_0x4f3d41,_0x4f8630){var _0x442d79={},_0x4ab372={},_0xd27e21={'count':0x0,'rows':[]};var _0x43978f=_[_0xd2bc('0x29')](db['VoiceCallReport'][_0xd2bc('0x2a')],function(_0x1692c6){return{'name':_0x1692c6[_0xd2bc('0x2b')],'type':_0x1692c6[_0xd2bc('0x2c')][_0xd2bc('0x2d')]};});_0x4ab372['model']=_[_0xd2bc('0x29')](_0x43978f,_0xd2bc('0x27'));_0x4ab372[_0xd2bc('0x2e')]=_[_0xd2bc('0x2f')](_0x4f3d41[_0xd2bc('0x2e')]);_0x4ab372[_0xd2bc('0x30')]=_['intersection'](_0x4ab372[_0xd2bc('0x31')],_0x4ab372[_0xd2bc('0x2e')]);_0x442d79['attributes']=_['intersection'](_0x4ab372[_0xd2bc('0x31')],qs['fields'](_0x4f3d41['query'][_0xd2bc('0x32')]));_0x442d79[_0xd2bc('0x33')]=_0x442d79[_0xd2bc('0x33')][_0xd2bc('0x34')]?_0x442d79[_0xd2bc('0x33')]:_0x4ab372[_0xd2bc('0x31')];if(!_0x4f3d41[_0xd2bc('0x2e')][_0xd2bc('0x35')]('nolimit')){_0x442d79['limit']=qs[_0xd2bc('0x1d')](_0x4f3d41[_0xd2bc('0x2e')]['limit']);_0x442d79[_0xd2bc('0x1c')]=qs[_0xd2bc('0x1c')](_0x4f3d41[_0xd2bc('0x2e')][_0xd2bc('0x1c')]);}_0x442d79[_0xd2bc('0x36')]=qs['sort'](_0x4f3d41[_0xd2bc('0x2e')][_0xd2bc('0x37')]);_0x442d79[_0xd2bc('0x38')]=qs[_0xd2bc('0x30')](_[_0xd2bc('0x39')](_0x4f3d41[_0xd2bc('0x2e')],_0x4ab372[_0xd2bc('0x30')]),_0x43978f);if(_0x4f3d41[_0xd2bc('0x2e')][_0xd2bc('0x3a')]){_0x442d79[_0xd2bc('0x38')]=_['merge'](_0x442d79[_0xd2bc('0x38')],{'$or':_[_0xd2bc('0x29')](_0x43978f,function(_0x5369f5){if(_0x5369f5['type']!=='VIRTUAL'){var _0x4e5eeb={};_0x4e5eeb[_0x5369f5[_0xd2bc('0x27')]]={'$like':'%'+_0x4f3d41[_0xd2bc('0x2e')]['filter']+'%'};return _0x4e5eeb;}})});}_0x442d79=_['merge']({},_0x442d79,_0x4f3d41['options']);var _0x4c5408={'where':_0x442d79['where']};return db[_0xd2bc('0x3b')][_0xd2bc('0x1b')](_0x4c5408)[_0xd2bc('0x25')](function(_0x3d8c5a){_0xd27e21[_0xd2bc('0x1b')]=_0x3d8c5a;if(_0x4f3d41[_0xd2bc('0x2e')][_0xd2bc('0x3c')]){_0x442d79[_0xd2bc('0x3d')]=[{'attributes':['id',_0xd2bc('0x27'),_0xd2bc('0x3e'),_0xd2bc('0x3f')],'model':db[_0xd2bc('0x40')],'as':_0xd2bc('0x40')}];}return db[_0xd2bc('0x3b')][_0xd2bc('0x41')](_0x442d79);})[_0xd2bc('0x25')](function(_0x43db2d){_0xd27e21[_0xd2bc('0x42')]=_0x43db2d;return _0xd27e21;})[_0xd2bc('0x25')](respondWithFilteredResult(_0x4f8630,_0x442d79))[_0xd2bc('0x43')](handleError(_0x4f8630,null));};exports[_0xd2bc('0x44')]=function(_0x4f1599,_0x4eaa3f){var _0x2d5250={'raw':!![],'where':{'id':_0x4f1599[_0xd2bc('0x45')]['id']}},_0x372f86={};_0x372f86[_0xd2bc('0x31')]=_[_0xd2bc('0x2f')](db['VoiceCallReport'][_0xd2bc('0x2a')]);_0x372f86[_0xd2bc('0x2e')]=_[_0xd2bc('0x2f')](_0x4f1599[_0xd2bc('0x2e')]);_0x372f86[_0xd2bc('0x30')]=_[_0xd2bc('0x46')](_0x372f86['model'],_0x372f86[_0xd2bc('0x2e')]);_0x2d5250['attributes']=_[_0xd2bc('0x46')](_0x372f86['model'],qs['fields'](_0x4f1599[_0xd2bc('0x2e')]['fields']));_0x2d5250[_0xd2bc('0x33')]=_0x2d5250[_0xd2bc('0x33')][_0xd2bc('0x34')]?_0x2d5250[_0xd2bc('0x33')]:_0x372f86[_0xd2bc('0x31')];if(_0x4f1599[_0xd2bc('0x2e')][_0xd2bc('0x3c')]){_0x2d5250[_0xd2bc('0x3d')]=[{'all':!![]}];}_0x2d5250=_[_0xd2bc('0x47')]({},_0x2d5250,_0x4f1599[_0xd2bc('0x48')]);return db['VoiceCallReport']['find'](_0x2d5250)['then'](handleEntityNotFound(_0x4eaa3f,null))[_0xd2bc('0x25')](respondWithResult(_0x4eaa3f,null))['catch'](handleError(_0x4eaa3f,null));};exports['create']=function(_0x1e0601,_0x56235b){return db[_0xd2bc('0x3b')][_0xd2bc('0x49')](_0x1e0601[_0xd2bc('0x4a')],{})['then'](respondWithResult(_0x56235b,0xc9))[_0xd2bc('0x43')](handleError(_0x56235b,null));};exports[_0xd2bc('0x26')]=function(_0x2fcade,_0x1bbe10){return db[_0xd2bc('0x3b')][_0xd2bc('0x4b')]({'where':{'id':_0x2fcade[_0xd2bc('0x45')]['id']}})[_0xd2bc('0x25')](handleEntityNotFound(_0x1bbe10,null))[_0xd2bc('0x25')](removeEntity(_0x1bbe10,null))[_0xd2bc('0x43')](handleError(_0x1bbe10,null));};exports[_0xd2bc('0x4c')]=function(_0x5b0616,_0x569f03){return db[_0xd2bc('0x3b')]['describe']()[_0xd2bc('0x25')](respondWithResult(_0x569f03,null))['catch'](handleError(_0x569f03,null));};exports['update']=function(_0x2c06fc,_0x5bbaf9){if(_0x2c06fc[_0xd2bc('0x4a')][_0xd2bc('0x4d')]){delete _0x2c06fc['body']['uniqueid'];}return db[_0xd2bc('0x3b')][_0xd2bc('0x4b')]({'where':{'uniqueid':_0x2c06fc['params']['id'],'UserId':{'$or':[null,_0x2c06fc[_0xd2bc('0x4e')]['id']]}}})[_0xd2bc('0x25')](handleEntityNotFound(_0x5bbaf9,null))['then'](saveUpdates(_0x2c06fc['body'],null))['then'](respondWithResult(_0x5bbaf9,null))[_0xd2bc('0x43')](handleError(_0x5bbaf9,null));}; \ No newline at end of file +var _0x54cb=['findAll','show','params','intersection','length','find','catch','create','body','describe','update','uniqueid','user','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','then','destroy','error','stack','name','send','index','VoiceCallReport','rawAttributes','key','model','map','query','keys','filters','attributes','fields','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','alias','User'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x54cb,0x189));var _0xb54c=function(_0x189b3b,_0x484de8){_0x189b3b=_0x189b3b-0x0;var _0x7c4721=_0x54cb[_0x189b3b];return _0x7c4721;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb54c('0x0'));var rp=require(_0xb54c('0x1'));var moment=require(_0xb54c('0x2'));var BPromise=require(_0xb54c('0x3'));var Mustache=require(_0xb54c('0x4'));var util=require('util');var path=require(_0xb54c('0x5'));var sox=require('sox');var csv=require(_0xb54c('0x6'));var ejs=require(_0xb54c('0x7'));var fs=require('fs');var _=require(_0xb54c('0x8'));var squel=require(_0xb54c('0x9'));var crypto=require('crypto');var jsforce=require(_0xb54c('0xa'));var deskjs=require(_0xb54c('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb54c('0xc'));var Papa=require(_0xb54c('0xd'));var Redis=require(_0xb54c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb54c('0xf'));var as=require(_0xb54c('0x10'));var hardwareService=require(_0xb54c('0x11'));var logger=require('../../config/logger')(_0xb54c('0x12'));var utils=require(_0xb54c('0x13'));var config=require(_0xb54c('0x14'));var db=require(_0xb54c('0x15'))['db'];function respondWithStatusCode(_0x59ac06,_0x553b62){_0x553b62=_0x553b62||0xcc;return function(_0xcb76d4){if(_0xcb76d4){return _0x59ac06[_0xb54c('0x16')](_0x553b62);}return _0x59ac06[_0xb54c('0x17')](_0x553b62)[_0xb54c('0x18')]();};}function respondWithResult(_0x2b7253,_0xec4b83){_0xec4b83=_0xec4b83||0xc8;return function(_0x5471ad){if(_0x5471ad){return _0x2b7253['status'](_0xec4b83)['json'](_0x5471ad);}};}function respondWithFilteredResult(_0x2d167d,_0x196edc){return function(_0x5465d7){if(_0x5465d7){var _0x1304a3=_0x5465d7[_0xb54c('0x19')],_0x37ab7c=_0x196edc['offset'],_0x1fce94=_0x196edc[_0xb54c('0x1a')]+_0x196edc[_0xb54c('0x1b')],_0x19efc2;if(_0x1fce94>=_0x1304a3){_0x1fce94=_0x1304a3;_0x19efc2=0xc8;}else{_0x19efc2=0xce;}_0x2d167d[_0xb54c('0x17')](_0x19efc2);return _0x2d167d[_0xb54c('0x1c')](_0xb54c('0x1d'),_0x37ab7c+'-'+_0x1fce94+'/'+_0x1304a3)[_0xb54c('0x1e')](_0x5465d7);}return null;};}function patchUpdates(_0x3bc159){return function(_0x1c272b){try{jsonpatch[_0xb54c('0x1f')](_0x1c272b,_0x3bc159,!![]);}catch(_0x30a6ce){return BPromise['reject'](_0x30a6ce);}return _0x1c272b['save']();};}function saveUpdates(_0x124808,_0x4b8bf7){return function(_0x4da4b9){if(_0x4da4b9){return _0x4da4b9['update'](_0x124808)[_0xb54c('0x20')](function(_0x1da6f3){return _0x1da6f3;});}return null;};}function removeEntity(_0x3d0b9d,_0x53b9cf){return function(_0x81b150){if(_0x81b150){return _0x81b150[_0xb54c('0x21')]()[_0xb54c('0x20')](function(){_0x3d0b9d['status'](0xcc)[_0xb54c('0x18')]();});}};}function handleEntityNotFound(_0x3d8ae0,_0x38fd96){return function(_0x3e057a){if(!_0x3e057a){_0x3d8ae0[_0xb54c('0x16')](0x194);}return _0x3e057a;};}function handleError(_0xcb3c2c,_0x9aeb0b){_0x9aeb0b=_0x9aeb0b||0x1f4;return function(_0x162e63){logger[_0xb54c('0x22')](_0x162e63[_0xb54c('0x23')]);if(_0x162e63[_0xb54c('0x24')]){delete _0x162e63[_0xb54c('0x24')];}_0xcb3c2c['status'](_0x9aeb0b)[_0xb54c('0x25')](_0x162e63);};}exports[_0xb54c('0x26')]=function(_0x429007,_0x1535eb){var _0x4c453e={},_0x3863ed={},_0x57f4bf={'count':0x0,'rows':[]};var _0x5cb5f4=_['map'](db[_0xb54c('0x27')][_0xb54c('0x28')],function(_0x14506d){return{'name':_0x14506d['fieldName'],'type':_0x14506d['type'][_0xb54c('0x29')]};});_0x3863ed[_0xb54c('0x2a')]=_[_0xb54c('0x2b')](_0x5cb5f4,'name');_0x3863ed[_0xb54c('0x2c')]=_[_0xb54c('0x2d')](_0x429007[_0xb54c('0x2c')]);_0x3863ed[_0xb54c('0x2e')]=_['intersection'](_0x3863ed[_0xb54c('0x2a')],_0x3863ed[_0xb54c('0x2c')]);_0x4c453e[_0xb54c('0x2f')]=_['intersection'](_0x3863ed[_0xb54c('0x2a')],qs[_0xb54c('0x30')](_0x429007[_0xb54c('0x2c')][_0xb54c('0x30')]));_0x4c453e[_0xb54c('0x2f')]=_0x4c453e[_0xb54c('0x2f')]['length']?_0x4c453e[_0xb54c('0x2f')]:_0x3863ed['model'];if(!_0x429007['query']['hasOwnProperty'](_0xb54c('0x31'))){_0x4c453e['limit']=qs['limit'](_0x429007[_0xb54c('0x2c')][_0xb54c('0x1b')]);_0x4c453e[_0xb54c('0x1a')]=qs[_0xb54c('0x1a')](_0x429007[_0xb54c('0x2c')]['offset']);}_0x4c453e[_0xb54c('0x32')]=qs[_0xb54c('0x33')](_0x429007[_0xb54c('0x2c')][_0xb54c('0x33')]);_0x4c453e[_0xb54c('0x34')]=qs[_0xb54c('0x2e')](_[_0xb54c('0x35')](_0x429007['query'],_0x3863ed[_0xb54c('0x2e')]),_0x5cb5f4);if(_0x429007[_0xb54c('0x2c')][_0xb54c('0x36')]){_0x4c453e[_0xb54c('0x34')]=_['merge'](_0x4c453e[_0xb54c('0x34')],{'$or':_[_0xb54c('0x2b')](_0x5cb5f4,function(_0x344bc4){if(_0x344bc4[_0xb54c('0x37')]!==_0xb54c('0x38')){var _0x4f914e={};_0x4f914e[_0x344bc4[_0xb54c('0x24')]]={'$like':'%'+_0x429007['query']['filter']+'%'};return _0x4f914e;}})});}_0x4c453e=_[_0xb54c('0x39')]({},_0x4c453e,_0x429007[_0xb54c('0x3a')]);var _0x2fd764={'where':_0x4c453e['where']};return db[_0xb54c('0x27')][_0xb54c('0x19')](_0x2fd764)['then'](function(_0x26a5ea){_0x57f4bf[_0xb54c('0x19')]=_0x26a5ea;if(_0x429007[_0xb54c('0x2c')][_0xb54c('0x3b')]){_0x4c453e[_0xb54c('0x3c')]=[{'attributes':['id',_0xb54c('0x24'),'fullname',_0xb54c('0x3d')],'model':db[_0xb54c('0x3e')],'as':_0xb54c('0x3e')}];}return db[_0xb54c('0x27')][_0xb54c('0x3f')](_0x4c453e);})[_0xb54c('0x20')](function(_0x58990d){_0x57f4bf['rows']=_0x58990d;return _0x57f4bf;})[_0xb54c('0x20')](respondWithFilteredResult(_0x1535eb,_0x4c453e))['catch'](handleError(_0x1535eb,null));};exports[_0xb54c('0x40')]=function(_0x3c12e7,_0x36985f){var _0x2f17c2={'raw':!![],'where':{'id':_0x3c12e7[_0xb54c('0x41')]['id']}},_0x165d6b={};_0x165d6b[_0xb54c('0x2a')]=_['keys'](db[_0xb54c('0x27')]['rawAttributes']);_0x165d6b[_0xb54c('0x2c')]=_[_0xb54c('0x2d')](_0x3c12e7[_0xb54c('0x2c')]);_0x165d6b['filters']=_[_0xb54c('0x42')](_0x165d6b[_0xb54c('0x2a')],_0x165d6b[_0xb54c('0x2c')]);_0x2f17c2['attributes']=_[_0xb54c('0x42')](_0x165d6b[_0xb54c('0x2a')],qs['fields'](_0x3c12e7[_0xb54c('0x2c')][_0xb54c('0x30')]));_0x2f17c2['attributes']=_0x2f17c2['attributes'][_0xb54c('0x43')]?_0x2f17c2[_0xb54c('0x2f')]:_0x165d6b[_0xb54c('0x2a')];if(_0x3c12e7[_0xb54c('0x2c')]['includeAll']){_0x2f17c2[_0xb54c('0x3c')]=[{'all':!![]}];}_0x2f17c2=_[_0xb54c('0x39')]({},_0x2f17c2,_0x3c12e7[_0xb54c('0x3a')]);return db['VoiceCallReport'][_0xb54c('0x44')](_0x2f17c2)[_0xb54c('0x20')](handleEntityNotFound(_0x36985f,null))[_0xb54c('0x20')](respondWithResult(_0x36985f,null))[_0xb54c('0x45')](handleError(_0x36985f,null));};exports['create']=function(_0x18db50,_0x14efa3){return db['VoiceCallReport'][_0xb54c('0x46')](_0x18db50[_0xb54c('0x47')],{})[_0xb54c('0x20')](respondWithResult(_0x14efa3,0xc9))[_0xb54c('0x45')](handleError(_0x14efa3,null));};exports[_0xb54c('0x21')]=function(_0x17f288,_0x449148){return db[_0xb54c('0x27')]['find']({'where':{'id':_0x17f288[_0xb54c('0x41')]['id']}})['then'](handleEntityNotFound(_0x449148,null))[_0xb54c('0x20')](removeEntity(_0x449148,null))[_0xb54c('0x45')](handleError(_0x449148,null));};exports['describe']=function(_0x22bf36,_0x491d78){return db[_0xb54c('0x27')][_0xb54c('0x48')]()[_0xb54c('0x20')](respondWithResult(_0x491d78,null))[_0xb54c('0x45')](handleError(_0x491d78,null));};exports[_0xb54c('0x49')]=function(_0x3ec360,_0x2f5c9f){if(_0x3ec360[_0xb54c('0x47')][_0xb54c('0x4a')]){delete _0x3ec360[_0xb54c('0x47')][_0xb54c('0x4a')];}return db['VoiceCallReport']['find']({'where':{'uniqueid':_0x3ec360['params']['id'],'UserId':{'$or':[null,_0x3ec360[_0xb54c('0x4b')]['id']]}}})[_0xb54c('0x20')](handleEntityNotFound(_0x2f5c9f,null))['then'](saveUpdates(_0x3ec360[_0xb54c('0x47')],null))[_0xb54c('0x20')](respondWithResult(_0x2f5c9f,null))[_0xb54c('0x45')](handleError(_0x2f5c9f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index d6018ff..a8b8c9e 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 _0x319e=['../../config/environment','exports','define','report_call','uniqueid','api','moment','request-promise','path','rimraf'];(function(_0x3df138,_0x327e3a){var _0x4c1709=function(_0xe9d5f6){while(--_0xe9d5f6){_0x3df138['push'](_0x3df138['shift']());}};_0x4c1709(++_0x327e3a);}(_0x319e,0xaf));var _0xe319=function(_0xf10a7f,_0x3e4cd3){_0xf10a7f=_0xf10a7f-0x0;var _0x57a0fc=_0x319e[_0xf10a7f];return _0x57a0fc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe319('0x0'));var moment=require(_0xe319('0x1'));var BPromise=require('bluebird');var rp=require(_0xe319('0x2'));var fs=require('fs');var path=require(_0xe319('0x3'));var rimraf=require(_0xe319('0x4'));var config=require(_0xe319('0x5'));var attributes=require('./voiceCallReport.attributes');module[_0xe319('0x6')]=function(_0x1fbeec,_0x1b2d42){return _0x1fbeec[_0xe319('0x7')]('VoiceCallReport',attributes,{'tableName':_0xe319('0x8'),'paranoid':![],'indexes':[{'fields':[_0xe319('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbfa8=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','VoiceCallReport','report_call','uniqueid','lodash'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xbfa8,0xa8));var _0x8bfa=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xbfa8[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x8bfa('0x0'));var util=require(_0x8bfa('0x1'));var logger=require(_0x8bfa('0x2'))(_0x8bfa('0x3'));var moment=require('moment');var BPromise=require(_0x8bfa('0x4'));var rp=require(_0x8bfa('0x5'));var fs=require('fs');var path=require(_0x8bfa('0x6'));var rimraf=require('rimraf');var config=require(_0x8bfa('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x8bfa('0x8')]=function(_0x9a2837,_0x15bcba){return _0x9a2837[_0x8bfa('0x9')](_0x8bfa('0xa'),attributes,{'tableName':_0x8bfa('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8bfa('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c01fbd9..f1de5cd 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 _0xacb0=['catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result'];(function(_0x309253,_0x248503){var _0x364e71=function(_0x346fc4){while(--_0x346fc4){_0x309253['push'](_0x309253['shift']());}};_0x364e71(++_0x248503);}(_0xacb0,0xb5));var _0x0acb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xacb0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0acb('0x0'));var util=require(_0x0acb('0x1'));var moment=require(_0x0acb('0x2'));var BPromise=require('bluebird');var rs=require(_0x0acb('0x3'));var fs=require('fs');var Redis=require(_0x0acb('0x4'));var db=require(_0x0acb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0acb('0x6'))(_0x0acb('0x7'));var config=require(_0x0acb('0x8'));var jayson=require(_0x0acb('0x9'));var client=jayson[_0x0acb('0xa')][_0x0acb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22fb69,_0x118814,_0x4bb0ee){return new BPromise(function(_0x3104c4,_0xb4f785){return client[_0x0acb('0xc')](_0x22fb69,_0x4bb0ee)[_0x0acb('0xd')](function(_0x1dabe4){logger[_0x0acb('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x118814,_0x0acb('0xf'));logger[_0x0acb('0x10')](_0x0acb('0x11'),_0x118814,_0x0acb('0xf'),JSON[_0x0acb('0x12')](_0x1dabe4));if(_0x1dabe4[_0x0acb('0x13')]){if(_0x1dabe4[_0x0acb('0x13')][_0x0acb('0x14')]===0x1f4){logger[_0x0acb('0x13')](_0x0acb('0x15'),_0x118814,_0x1dabe4[_0x0acb('0x13')][_0x0acb('0x16')]);return _0xb4f785(_0x1dabe4['error']['message']);}logger['error'](_0x0acb('0x15'),_0x118814,_0x1dabe4[_0x0acb('0x13')]['message']);return _0x3104c4(_0x1dabe4['error'][_0x0acb('0x16')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x118814,_0x0acb('0xf'));_0x3104c4(_0x1dabe4[_0x0acb('0x17')]['message']);}})[_0x0acb('0x18')](function(_0x2e1ddb){logger[_0x0acb('0x13')](_0x0acb('0x15'),_0x118814,_0x2e1ddb);_0xb4f785(_0x2e1ddb);});});}exports['GetVoiceCallReport']=function(_0x468645){var _0x5ecb4d=this;return new Promise(function(_0x10230f,_0x55a50b){return db[_0x0acb('0x19')][_0x0acb('0x1a')]({'raw':_0x468645[_0x0acb('0x1b')]?_0x468645['options'][_0x0acb('0x1c')]===undefined?!![]:![]:!![],'where':_0x468645[_0x0acb('0x1b')]?_0x468645[_0x0acb('0x1b')][_0x0acb('0x1d')]||null:null,'attributes':_0x468645[_0x0acb('0x1b')]?_0x468645[_0x0acb('0x1b')][_0x0acb('0x1e')]||null:null,'limit':_0x468645[_0x0acb('0x1b')]?_0x468645[_0x0acb('0x1b')][_0x0acb('0x1f')]||null:null,'include':_0x468645[_0x0acb('0x1b')]?_0x468645[_0x0acb('0x1b')][_0x0acb('0x20')]?_[_0x0acb('0x21')](_0x468645['options'][_0x0acb('0x20')],function(_0x294af1){return{'model':db[_0x294af1[_0x0acb('0x22')]],'as':_0x294af1['as'],'attributes':_0x294af1[_0x0acb('0x1e')],'include':_0x294af1[_0x0acb('0x20')]?_[_0x0acb('0x21')](_0x294af1['include'],function(_0x5a1419){return{'model':db[_0x5a1419['model']],'as':_0x5a1419['as'],'attributes':_0x5a1419['attributes'],'include':_0x5a1419[_0x0acb('0x20')]?_[_0x0acb('0x21')](_0x5a1419[_0x0acb('0x20')],function(_0x14e303){return{'model':db[_0x14e303[_0x0acb('0x22')]],'as':_0x14e303['as'],'attributes':_0x14e303['attributes']};}):[]};}):[]};}):[]:[]})[_0x0acb('0xd')](function(_0x12fd8c){logger[_0x0acb('0xe')](_0x0acb('0x23'),_0x468645);logger[_0x0acb('0x10')](_0x0acb('0x23'),_0x468645,JSON['stringify'](_0x12fd8c));_0x10230f(_0x12fd8c);})[_0x0acb('0x18')](function(_0x4d9329){logger[_0x0acb('0x13')](_0x0acb('0x23'),_0x4d9329['message'],_0x468645);_0x55a50b(_0x5ecb4d[_0x0acb('0x13')](0x1f4,_0x4d9329['message']));});});};exports[_0x0acb('0x24')]=function(_0x4648e1){var _0x28c044=this;return new Promise(function(_0x5342a1,_0x5e5233){return db[_0x0acb('0x19')][_0x0acb('0x25')](_0x4648e1[_0x0acb('0x26')],{'raw':_0x4648e1[_0x0acb('0x1b')]?_0x4648e1[_0x0acb('0x1b')][_0x0acb('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x7ea512){logger[_0x0acb('0xe')]('CreateVoiceCallReport',_0x4648e1);logger[_0x0acb('0x10')](_0x0acb('0x24'),_0x4648e1,JSON[_0x0acb('0x12')](_0x7ea512));_0x5342a1(_0x7ea512);})[_0x0acb('0x18')](function(_0x20954d){logger[_0x0acb('0x13')](_0x0acb('0x24'),_0x20954d[_0x0acb('0x16')],_0x4648e1);_0x5e5233(_0x28c044[_0x0acb('0x13')](0x1f4,_0x20954d[_0x0acb('0x16')]));});});};exports[_0x0acb('0x27')]=function(_0x5358b2){var _0xf4ca6=this;return new Promise(function(_0x279c33,_0x14b574){return db[_0x0acb('0x19')][_0x0acb('0x28')](_0x5358b2[_0x0acb('0x26')],{'raw':_0x5358b2['options']?_0x5358b2[_0x0acb('0x1b')][_0x0acb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5358b2[_0x0acb('0x1b')]?_0x5358b2['options'][_0x0acb('0x1d')]||null:null,'attributes':_0x5358b2[_0x0acb('0x1b')]?_0x5358b2[_0x0acb('0x1b')][_0x0acb('0x1e')]||null:null,'limit':_0x5358b2['options']?_0x5358b2[_0x0acb('0x1b')]['limit']||null:null})[_0x0acb('0xd')](function(_0x9dcd9){logger['info'](_0x0acb('0x27'),_0x5358b2);logger[_0x0acb('0x10')]('UpdateVoiceCallReport',_0x5358b2,JSON[_0x0acb('0x12')](_0x9dcd9));_0x279c33(_0x9dcd9);})[_0x0acb('0x18')](function(_0xbb1625){logger['error']('UpdateVoiceCallReport',_0xbb1625['message'],_0x5358b2);_0x14b574(_0xf4ca6[_0x0acb('0x13')](0x1f4,_0xbb1625[_0x0acb('0x16')]));});});}; \ No newline at end of file +var _0xdd20=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','map','model','include','info','stringify','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','where','limit','lodash','util','bluebird'];(function(_0x1a908a,_0x1eac3b){var _0x6a017d=function(_0x2f6018){while(--_0x2f6018){_0x1a908a['push'](_0x1a908a['shift']());}};_0x6a017d(++_0x1eac3b);}(_0xdd20,0x1eb));var _0x0dd2=function(_0x1c98cc,_0x326389){_0x1c98cc=_0x1c98cc-0x0;var _0x15dcd0=_0xdd20[_0x1c98cc];return _0x15dcd0;};'use strict';var _=require(_0x0dd2('0x0'));var util=require(_0x0dd2('0x1'));var moment=require('moment');var BPromise=require(_0x0dd2('0x2'));var rs=require(_0x0dd2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0dd2('0x4'));var logger=require(_0x0dd2('0x5'))(_0x0dd2('0x6'));var config=require(_0x0dd2('0x7'));var jayson=require(_0x0dd2('0x8'));var client=jayson[_0x0dd2('0x9')][_0x0dd2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfd9f1c,_0x322268,_0x3bcaaa){return new BPromise(function(_0x773448,_0x88fdcd){return client[_0x0dd2('0xb')](_0xfd9f1c,_0x3bcaaa)[_0x0dd2('0xc')](function(_0x4a3848){logger['info'](_0x0dd2('0xd'),_0x322268,_0x0dd2('0xe'));logger[_0x0dd2('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x322268,_0x0dd2('0xe'),JSON['stringify'](_0x4a3848));if(_0x4a3848[_0x0dd2('0x10')]){if(_0x4a3848['error'][_0x0dd2('0x11')]===0x1f4){logger[_0x0dd2('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x322268,_0x4a3848[_0x0dd2('0x10')]['message']);return _0x88fdcd(_0x4a3848[_0x0dd2('0x10')][_0x0dd2('0x12')]);}logger[_0x0dd2('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x322268,_0x4a3848[_0x0dd2('0x10')][_0x0dd2('0x12')]);return _0x773448(_0x4a3848[_0x0dd2('0x10')][_0x0dd2('0x12')]);}else{logger['info'](_0x0dd2('0xd'),_0x322268,_0x0dd2('0xe'));_0x773448(_0x4a3848['result'][_0x0dd2('0x12')]);}})[_0x0dd2('0x13')](function(_0x420793){logger[_0x0dd2('0x10')](_0x0dd2('0xd'),_0x322268,_0x420793);_0x88fdcd(_0x420793);});});}exports[_0x0dd2('0x14')]=function(_0x1d2710){var _0x488759=this;return new Promise(function(_0x4c5e9d,_0x55ca0e){return db[_0x0dd2('0x15')][_0x0dd2('0x16')]({'raw':_0x1d2710[_0x0dd2('0x17')]?_0x1d2710[_0x0dd2('0x17')][_0x0dd2('0x18')]===undefined?!![]:![]:!![],'where':_0x1d2710[_0x0dd2('0x17')]?_0x1d2710[_0x0dd2('0x17')]['where']||null:null,'attributes':_0x1d2710[_0x0dd2('0x17')]?_0x1d2710['options'][_0x0dd2('0x19')]||null:null,'limit':_0x1d2710[_0x0dd2('0x17')]?_0x1d2710[_0x0dd2('0x17')]['limit']||null:null,'include':_0x1d2710[_0x0dd2('0x17')]?_0x1d2710[_0x0dd2('0x17')]['include']?_[_0x0dd2('0x1a')](_0x1d2710[_0x0dd2('0x17')]['include'],function(_0x216838){return{'model':db[_0x216838[_0x0dd2('0x1b')]],'as':_0x216838['as'],'attributes':_0x216838['attributes'],'include':_0x216838['include']?_[_0x0dd2('0x1a')](_0x216838[_0x0dd2('0x1c')],function(_0x31709d){return{'model':db[_0x31709d[_0x0dd2('0x1b')]],'as':_0x31709d['as'],'attributes':_0x31709d[_0x0dd2('0x19')],'include':_0x31709d[_0x0dd2('0x1c')]?_[_0x0dd2('0x1a')](_0x31709d['include'],function(_0x2e99f3){return{'model':db[_0x2e99f3['model']],'as':_0x2e99f3['as'],'attributes':_0x2e99f3[_0x0dd2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0dd2('0xc')](function(_0x81785d){logger[_0x0dd2('0x1d')](_0x0dd2('0x14'),_0x1d2710);logger['debug'](_0x0dd2('0x14'),_0x1d2710,JSON[_0x0dd2('0x1e')](_0x81785d));_0x4c5e9d(_0x81785d);})[_0x0dd2('0x13')](function(_0x562a87){logger['error']('GetVoiceCallReport',_0x562a87[_0x0dd2('0x12')],_0x1d2710);_0x55ca0e(_0x488759[_0x0dd2('0x10')](0x1f4,_0x562a87[_0x0dd2('0x12')]));});});};exports[_0x0dd2('0x1f')]=function(_0x187fd2){var _0x6f9d00=this;return new Promise(function(_0x396d1a,_0x4d5dbb){return db['VoiceCallReport'][_0x0dd2('0x20')](_0x187fd2[_0x0dd2('0x21')],{'raw':_0x187fd2[_0x0dd2('0x17')]?_0x187fd2[_0x0dd2('0x17')][_0x0dd2('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x6fb026){logger[_0x0dd2('0x1d')]('CreateVoiceCallReport',_0x187fd2);logger[_0x0dd2('0xf')]('CreateVoiceCallReport',_0x187fd2,JSON[_0x0dd2('0x1e')](_0x6fb026));_0x396d1a(_0x6fb026);})[_0x0dd2('0x13')](function(_0x2d66e6){logger[_0x0dd2('0x10')](_0x0dd2('0x1f'),_0x2d66e6[_0x0dd2('0x12')],_0x187fd2);_0x4d5dbb(_0x6f9d00[_0x0dd2('0x10')](0x1f4,_0x2d66e6[_0x0dd2('0x12')]));});});};exports[_0x0dd2('0x22')]=function(_0x30f65a){var _0x2bbafa=this;return new Promise(function(_0x5a6f4f,_0x55657c){return db['VoiceCallReport'][_0x0dd2('0x23')](_0x30f65a[_0x0dd2('0x21')],{'raw':_0x30f65a[_0x0dd2('0x17')]?_0x30f65a[_0x0dd2('0x17')][_0x0dd2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30f65a[_0x0dd2('0x17')]?_0x30f65a[_0x0dd2('0x17')][_0x0dd2('0x24')]||null:null,'attributes':_0x30f65a[_0x0dd2('0x17')]?_0x30f65a[_0x0dd2('0x17')][_0x0dd2('0x19')]||null:null,'limit':_0x30f65a[_0x0dd2('0x17')]?_0x30f65a[_0x0dd2('0x17')][_0x0dd2('0x25')]||null:null})[_0x0dd2('0xc')](function(_0x4fe68d){logger[_0x0dd2('0x1d')]('UpdateVoiceCallReport',_0x30f65a);logger['debug']('UpdateVoiceCallReport',_0x30f65a,JSON['stringify'](_0x4fe68d));_0x5a6f4f(_0x4fe68d);})['catch'](function(_0x5d17d0){logger['error'](_0x0dd2('0x22'),_0x5d17d0[_0x0dd2('0x12')],_0x30f65a);_0x55657c(_0x2bbafa[_0x0dd2('0x10')](0x1f4,_0x5d17d0['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 35c132b..4516a2c 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 _0x63b6=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','index'];(function(_0x10eb38,_0x2086bd){var _0x5af9b5=function(_0x2075c7){while(--_0x2075c7){_0x10eb38['push'](_0x10eb38['shift']());}};_0x5af9b5(++_0x2086bd);}(_0x63b6,0x127));var _0x663b=function(_0x2fb4f7,_0x3c72e1){_0x2fb4f7=_0x2fb4f7-0x0;var _0x383080=_0x63b6[_0x2fb4f7];return _0x383080;};'use strict';var multer=require(_0x663b('0x0'));var util=require(_0x663b('0x1'));var path=require(_0x663b('0x2'));var timeout=require('connect-timeout');var express=require(_0x663b('0x3'));var router=express['Router']();var auth=require(_0x663b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x663b('0x5'));var controller=require(_0x663b('0x6'));router[_0x663b('0x7')]('/',auth['isAuthenticated'](),controller[_0x663b('0x8')]);router['get'](_0x663b('0x9'),auth['isAuthenticated'](),controller[_0x663b('0xa')]);router[_0x663b('0xb')]('/',auth[_0x663b('0xc')](),controller[_0x663b('0xd')]);router[_0x663b('0xe')](_0x663b('0x9'),auth['isAuthenticated'](),controller[_0x663b('0xf')]);router[_0x663b('0x10')](_0x663b('0x9'),auth[_0x663b('0xc')](),controller[_0x663b('0x11')]);module[_0x663b('0x12')]=router; \ No newline at end of file +var _0x3144=['post','create','put','/:id','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x220e56,_0x1e7891){var _0x5a4137=function(_0x17f644){while(--_0x17f644){_0x220e56['push'](_0x220e56['shift']());}};_0x5a4137(++_0x1e7891);}(_0x3144,0x17c));var _0x4314=function(_0x448e03,_0x52c4bd){_0x448e03=_0x448e03-0x0;var _0x4b4469=_0x3144[_0x448e03];return _0x4b4469;};'use strict';var multer=require('multer');var util=require(_0x4314('0x0'));var path=require(_0x4314('0x1'));var timeout=require(_0x4314('0x2'));var express=require('express');var router=express[_0x4314('0x3')]();var auth=require(_0x4314('0x4'));var interaction=require(_0x4314('0x5'));var config=require(_0x4314('0x6'));var controller=require('./voiceChanSpy.controller');router[_0x4314('0x7')]('/',auth[_0x4314('0x8')](),controller[_0x4314('0x9')]);router[_0x4314('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4314('0xa')]('/',auth[_0x4314('0x8')](),controller[_0x4314('0xb')]);router[_0x4314('0xc')](_0x4314('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4314('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x4314('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index a009e1a..ceb17e5 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 _0x2957=['sequelize','exports','name','setDataValue','options','join','getDataValue','split','BOOLEAN','STRING'];(function(_0x1950ee,_0x3d2fba){var _0x5b5eae=function(_0x3f4330){while(--_0x3f4330){_0x1950ee['push'](_0x1950ee['shift']());}};_0x5b5eae(++_0x3d2fba);}(_0x2957,0x19a));var _0x7295=function(_0x994f,_0x2e366c){_0x994f=_0x994f-0x0;var _0xb14018=_0x2957[_0x994f];return _0xb14018;};'use strict';var Sequelize=require(_0x7295('0x0'));module[_0x7295('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x7295('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x1054e3){this[_0x7295('0x3')](_0x7295('0x4'),_0x1054e3?_0x1054e3[_0x7295('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x7295('0x4'))?this[_0x7295('0x6')]('options')[_0x7295('0x7')](''):[];}},'auth':{'type':Sequelize[_0x7295('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x7295('0x9')]},'record':{'type':Sequelize[_0x7295('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7295('0x9')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2569=['setDataValue','getDataValue','options','split','BOOLEAN','sequelize','STRING','name'];(function(_0x58c608,_0x16f6df){var _0x4fb8aa=function(_0xcc6b8d){while(--_0xcc6b8d){_0x58c608['push'](_0x58c608['shift']());}};_0x4fb8aa(++_0x16f6df);}(_0x2569,0xd5));var _0x9256=function(_0x400b64,_0x5eb1bf){_0x400b64=_0x400b64-0x0;var _0x1d615d=_0x2569[_0x400b64];return _0x1d615d;};'use strict';var Sequelize=require(_0x9256('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x9256('0x1')],'unique':_0x9256('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x9256('0x1')],'set':function(_0x3c8624){this[_0x9256('0x3')]('options',_0x3c8624?_0x3c8624['join'](''):[]);},'get':function(){return this[_0x9256('0x4')](_0x9256('0x5'))?this[_0x9256('0x4')](_0x9256('0x5'))[_0x9256('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x9256('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9256('0x1')]},'description':{'type':Sequelize[_0x9256('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index b9ec546..2b77016 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 _0x7e10=['autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','reject','update','then','destroy','get','ChanSpies','UserProfileResource','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId'];(function(_0x5e1e25,_0xdc1421){var _0x548e5f=function(_0x576360){while(--_0x576360){_0x5e1e25['push'](_0x5e1e25['shift']());}};_0x548e5f(++_0xdc1421);}(_0x7e10,0x14e));var _0x07e1=function(_0x570c30,_0x5b9b5f){_0x570c30=_0x570c30-0x0;var _0x38b3e2=_0x7e10[_0x570c30];return _0x38b3e2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x07e1('0x0'));var rimraf=require(_0x07e1('0x1'));var zipdir=require(_0x07e1('0x2'));var jsonpatch=require(_0x07e1('0x3'));var rp=require(_0x07e1('0x4'));var moment=require('moment');var BPromise=require(_0x07e1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x07e1('0x6'));var sox=require(_0x07e1('0x7'));var csv=require('to-csv');var ejs=require(_0x07e1('0x8'));var fs=require('fs');var _=require(_0x07e1('0x9'));var squel=require(_0x07e1('0xa'));var crypto=require(_0x07e1('0xb'));var jsforce=require(_0x07e1('0xc'));var deskjs=require(_0x07e1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x07e1('0xe'));var Papa=require(_0x07e1('0xf'));var Redis=require(_0x07e1('0x10'));var authService=require(_0x07e1('0x11'));var qs=require(_0x07e1('0x12'));var as=require(_0x07e1('0x13'));var hardwareService=require(_0x07e1('0x14'));var logger=require(_0x07e1('0x15'))(_0x07e1('0x16'));var utils=require(_0x07e1('0x17'));var config=require(_0x07e1('0x18'));var db=require(_0x07e1('0x19'))['db'];function respondWithStatusCode(_0x3a3eb1,_0x49b6c5){_0x49b6c5=_0x49b6c5||0xcc;return function(_0x549137){if(_0x549137){return _0x3a3eb1[_0x07e1('0x1a')](_0x49b6c5);}return _0x3a3eb1['status'](_0x49b6c5)[_0x07e1('0x1b')]();};}function respondWithResult(_0x45aac9,_0x1e8d6d){_0x1e8d6d=_0x1e8d6d||0xc8;return function(_0x491b26){if(_0x491b26){return _0x45aac9[_0x07e1('0x1c')](_0x1e8d6d)[_0x07e1('0x1d')](_0x491b26);}};}function respondWithFilteredResult(_0x4282b0,_0x1db8c7){return function(_0xc16d14){if(_0xc16d14){var _0x56a2bf=_0xc16d14[_0x07e1('0x1e')],_0x11ae34=_0x1db8c7[_0x07e1('0x1f')],_0x586d37=_0x1db8c7[_0x07e1('0x1f')]+_0x1db8c7['limit'],_0x35e17;if(_0x586d37>=_0x56a2bf){_0x586d37=_0x56a2bf;_0x35e17=0xc8;}else{_0x35e17=0xce;}_0x4282b0[_0x07e1('0x1c')](_0x35e17);return _0x4282b0[_0x07e1('0x20')](_0x07e1('0x21'),_0x11ae34+'-'+_0x586d37+'/'+_0x56a2bf)[_0x07e1('0x1d')](_0xc16d14);}return null;};}function patchUpdates(_0x2b0a17){return function(_0x18f0c3){try{jsonpatch['apply'](_0x18f0c3,_0x2b0a17,!![]);}catch(_0x219c98){return BPromise[_0x07e1('0x22')](_0x219c98);}return _0x18f0c3['save']();};}function saveUpdates(_0x384530,_0xbc4782){return function(_0x23e969){if(_0x23e969){return _0x23e969[_0x07e1('0x23')](_0x384530)[_0x07e1('0x24')](function(_0x579ecc){return _0x579ecc;});}return null;};}function removeEntity(_0x39b314,_0x52e511){return function(_0x25b033){if(_0x25b033){return _0x25b033[_0x07e1('0x25')]()[_0x07e1('0x24')](function(){var _0x4cd197=_0x25b033[_0x07e1('0x26')]({'plain':!![]});var _0x35c4fe=_0x07e1('0x27');return db[_0x07e1('0x28')]['destroy']({'where':{'type':_0x35c4fe,'resourceId':_0x4cd197['id']}})[_0x07e1('0x24')](function(){return _0x25b033;});})[_0x07e1('0x24')](function(){_0x39b314[_0x07e1('0x1c')](0xcc)[_0x07e1('0x1b')]();});}};}function handleEntityNotFound(_0x2b1279,_0x17d6c0){return function(_0x2fc75d){if(!_0x2fc75d){_0x2b1279[_0x07e1('0x1a')](0x194);}return _0x2fc75d;};}function handleError(_0x2c1436,_0x4ca54c){_0x4ca54c=_0x4ca54c||0x1f4;return function(_0x28d795){logger['error'](_0x28d795['stack']);if(_0x28d795['name']){delete _0x28d795[_0x07e1('0x29')];}_0x2c1436[_0x07e1('0x1c')](_0x4ca54c)[_0x07e1('0x2a')](_0x28d795);};}exports[_0x07e1('0x2b')]=function(_0x40aeeb,_0x26c6dd){var _0x3b6674={},_0x9ddcec={},_0x5e120={'count':0x0,'rows':[]};var _0x56346f=_[_0x07e1('0x2c')](db[_0x07e1('0x2d')][_0x07e1('0x2e')],function(_0x36418c){return{'name':_0x36418c[_0x07e1('0x2f')],'type':_0x36418c['type'][_0x07e1('0x30')]};});_0x9ddcec[_0x07e1('0x31')]=_[_0x07e1('0x2c')](_0x56346f,_0x07e1('0x29'));_0x9ddcec[_0x07e1('0x32')]=_[_0x07e1('0x33')](_0x40aeeb[_0x07e1('0x32')]);_0x9ddcec[_0x07e1('0x34')]=_[_0x07e1('0x35')](_0x9ddcec['model'],_0x9ddcec[_0x07e1('0x32')]);_0x3b6674[_0x07e1('0x36')]=_['intersection'](_0x9ddcec[_0x07e1('0x31')],qs[_0x07e1('0x37')](_0x40aeeb[_0x07e1('0x32')]['fields']));_0x3b6674[_0x07e1('0x36')]=_0x3b6674[_0x07e1('0x36')][_0x07e1('0x38')]?_0x3b6674[_0x07e1('0x36')]:_0x9ddcec[_0x07e1('0x31')];if(!_0x40aeeb[_0x07e1('0x32')][_0x07e1('0x39')](_0x07e1('0x3a'))){_0x3b6674[_0x07e1('0x3b')]=qs[_0x07e1('0x3b')](_0x40aeeb['query']['limit']);_0x3b6674[_0x07e1('0x1f')]=qs[_0x07e1('0x1f')](_0x40aeeb[_0x07e1('0x32')][_0x07e1('0x1f')]);}_0x3b6674[_0x07e1('0x3c')]=qs[_0x07e1('0x3d')](_0x40aeeb['query'][_0x07e1('0x3d')]);_0x3b6674[_0x07e1('0x3e')]=qs[_0x07e1('0x34')](_[_0x07e1('0x3f')](_0x40aeeb[_0x07e1('0x32')],_0x9ddcec[_0x07e1('0x34')]),_0x56346f);if(_0x40aeeb[_0x07e1('0x32')][_0x07e1('0x40')]){_0x3b6674[_0x07e1('0x3e')]=_[_0x07e1('0x41')](_0x3b6674[_0x07e1('0x3e')],{'$or':_[_0x07e1('0x2c')](_0x56346f,function(_0x55b8c8){if(_0x55b8c8['type']!=='VIRTUAL'){var _0x1694fc={};_0x1694fc[_0x55b8c8['name']]={'$like':'%'+_0x40aeeb[_0x07e1('0x32')][_0x07e1('0x40')]+'%'};return _0x1694fc;}})});}_0x3b6674=_[_0x07e1('0x41')]({},_0x3b6674,_0x40aeeb['options']);var _0x183fad={'where':_0x3b6674[_0x07e1('0x3e')]};return db['VoiceChanSpy'][_0x07e1('0x1e')](_0x183fad)[_0x07e1('0x24')](function(_0x3ed14e){_0x5e120[_0x07e1('0x1e')]=_0x3ed14e;if(_0x40aeeb[_0x07e1('0x32')][_0x07e1('0x42')]){_0x3b6674[_0x07e1('0x43')]=[{'all':!![]}];}return db[_0x07e1('0x2d')][_0x07e1('0x44')](_0x3b6674);})[_0x07e1('0x24')](function(_0xf2142a){_0x5e120[_0x07e1('0x45')]=_0xf2142a;return _0x5e120;})[_0x07e1('0x24')](respondWithFilteredResult(_0x26c6dd,_0x3b6674))[_0x07e1('0x46')](handleError(_0x26c6dd,null));};exports[_0x07e1('0x47')]=function(_0x5a915c,_0x247433){var _0x52fa32={'raw':![],'where':{'id':_0x5a915c[_0x07e1('0x48')]['id']}},_0x23b474={};_0x23b474[_0x07e1('0x31')]=_[_0x07e1('0x33')](db[_0x07e1('0x2d')][_0x07e1('0x2e')]);_0x23b474['query']=_['keys'](_0x5a915c[_0x07e1('0x32')]);_0x23b474[_0x07e1('0x34')]=_[_0x07e1('0x35')](_0x23b474['model'],_0x23b474[_0x07e1('0x32')]);_0x52fa32[_0x07e1('0x36')]=_[_0x07e1('0x35')](_0x23b474['model'],qs['fields'](_0x5a915c[_0x07e1('0x32')][_0x07e1('0x37')]));_0x52fa32[_0x07e1('0x36')]=_0x52fa32['attributes'][_0x07e1('0x38')]?_0x52fa32['attributes']:_0x23b474[_0x07e1('0x31')];if(_0x5a915c[_0x07e1('0x32')]['includeAll']){_0x52fa32[_0x07e1('0x43')]=[{'all':!![]}];}_0x52fa32=_[_0x07e1('0x41')]({},_0x52fa32,_0x5a915c[_0x07e1('0x49')]);return db['VoiceChanSpy'][_0x07e1('0x4a')](_0x52fa32)[_0x07e1('0x24')](handleEntityNotFound(_0x247433,null))[_0x07e1('0x24')](respondWithResult(_0x247433,null))[_0x07e1('0x46')](handleError(_0x247433,null));};exports[_0x07e1('0x4b')]=function(_0xce4eb1,_0x511024){return db['VoiceChanSpy'][_0x07e1('0x4b')](_0xce4eb1[_0x07e1('0x4c')],{})[_0x07e1('0x24')](function(_0x54598b){var _0x4b687c=_0xce4eb1[_0x07e1('0x4d')][_0x07e1('0x26')]({'plain':!![]});if(!_0x4b687c)throw new Error(_0x07e1('0x4e'));if(_0x4b687c[_0x07e1('0x4f')]===_0x07e1('0x4d')){var _0x40ba2e=_0x54598b[_0x07e1('0x26')]({'plain':!![]});var _0x2349ea='ChanSpies';return db['UserProfileSection'][_0x07e1('0x4a')]({'where':{'name':_0x2349ea,'userProfileId':_0x4b687c[_0x07e1('0x50')]},'raw':!![]})['then'](function(_0x554ba0){if(_0x554ba0&&_0x554ba0[_0x07e1('0x51')]===0x0){return db[_0x07e1('0x28')][_0x07e1('0x4b')]({'name':_0x40ba2e[_0x07e1('0x29')],'resourceId':_0x40ba2e['id'],'type':_0x554ba0[_0x07e1('0x29')],'sectionId':_0x554ba0['id']},{})['then'](function(){return _0x54598b;});}else{return _0x54598b;}})[_0x07e1('0x46')](function(_0x5da238){logger[_0x07e1('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5da238);throw _0x5da238;});}return _0x54598b;})[_0x07e1('0x24')](respondWithResult(_0x511024,0xc9))[_0x07e1('0x46')](handleError(_0x511024,null));};exports[_0x07e1('0x23')]=function(_0x539367,_0x3c8d22){if(_0x539367['body']['id']){delete _0x539367['body']['id'];}return db[_0x07e1('0x2d')]['find']({'where':{'id':_0x539367[_0x07e1('0x48')]['id']}})['then'](handleEntityNotFound(_0x3c8d22,null))[_0x07e1('0x24')](saveUpdates(_0x539367[_0x07e1('0x4c')],null))[_0x07e1('0x24')](respondWithResult(_0x3c8d22,null))[_0x07e1('0x46')](handleError(_0x3c8d22,null));};exports[_0x07e1('0x25')]=function(_0x28ba51,_0x1ec855){return db['VoiceChanSpy']['find']({'where':{'id':_0x28ba51['params']['id']}})[_0x07e1('0x24')](handleEntityNotFound(_0x1ec855,null))[_0x07e1('0x24')](removeEntity(_0x1ec855,null))[_0x07e1('0x46')](handleError(_0x1ec855,null));}; \ No newline at end of file +var _0x88ac=['autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../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','destroy','then','get','ChanSpies','UserProfileResource','name','send','index','map','VoiceChanSpy','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x88ac,0x194));var _0xc88a=function(_0x2b7694,_0x4afaa6){_0x2b7694=_0x2b7694-0x0;var _0x57ff70=_0x88ac[_0x2b7694];return _0x57ff70;};'use strict';var pdf=require(_0xc88a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc88a('0x1'));var zipdir=require(_0xc88a('0x2'));var jsonpatch=require(_0xc88a('0x3'));var rp=require(_0xc88a('0x4'));var moment=require('moment');var BPromise=require(_0xc88a('0x5'));var Mustache=require('mustache');var util=require(_0xc88a('0x6'));var path=require(_0xc88a('0x7'));var sox=require(_0xc88a('0x8'));var csv=require(_0xc88a('0x9'));var ejs=require(_0xc88a('0xa'));var fs=require('fs');var _=require(_0xc88a('0xb'));var squel=require(_0xc88a('0xc'));var crypto=require(_0xc88a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc88a('0xe'));var toCsv=require(_0xc88a('0x9'));var querystring=require('querystring');var Papa=require(_0xc88a('0xf'));var Redis=require(_0xc88a('0x10'));var authService=require(_0xc88a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc88a('0x12'));var hardwareService=require(_0xc88a('0x13'));var logger=require(_0xc88a('0x14'))(_0xc88a('0x15'));var utils=require('../../config/utils');var config=require(_0xc88a('0x16'));var db=require(_0xc88a('0x17'))['db'];function respondWithStatusCode(_0x5f5381,_0x4354aa){_0x4354aa=_0x4354aa||0xcc;return function(_0x211995){if(_0x211995){return _0x5f5381[_0xc88a('0x18')](_0x4354aa);}return _0x5f5381[_0xc88a('0x19')](_0x4354aa)[_0xc88a('0x1a')]();};}function respondWithResult(_0xf2ef69,_0xa07d87){_0xa07d87=_0xa07d87||0xc8;return function(_0x299613){if(_0x299613){return _0xf2ef69[_0xc88a('0x19')](_0xa07d87)[_0xc88a('0x1b')](_0x299613);}};}function respondWithFilteredResult(_0x2f72e5,_0x5ce7c3){return function(_0x21f568){if(_0x21f568){var _0x5294b4=_0x21f568[_0xc88a('0x1c')],_0xd9592=_0x5ce7c3[_0xc88a('0x1d')],_0x4cfa1c=_0x5ce7c3[_0xc88a('0x1d')]+_0x5ce7c3[_0xc88a('0x1e')],_0x232d79;if(_0x4cfa1c>=_0x5294b4){_0x4cfa1c=_0x5294b4;_0x232d79=0xc8;}else{_0x232d79=0xce;}_0x2f72e5['status'](_0x232d79);return _0x2f72e5[_0xc88a('0x1f')](_0xc88a('0x20'),_0xd9592+'-'+_0x4cfa1c+'/'+_0x5294b4)['json'](_0x21f568);}return null;};}function patchUpdates(_0x1fdcae){return function(_0x49029f){try{jsonpatch['apply'](_0x49029f,_0x1fdcae,!![]);}catch(_0x2d12f6){return BPromise[_0xc88a('0x21')](_0x2d12f6);}return _0x49029f[_0xc88a('0x22')]();};}function saveUpdates(_0xfb7c2d,_0xd324b3){return function(_0x4ed351){if(_0x4ed351){return _0x4ed351[_0xc88a('0x23')](_0xfb7c2d)['then'](function(_0xfa127c){return _0xfa127c;});}return null;};}function removeEntity(_0x2c0b41,_0x400f75){return function(_0x2b4c7c){if(_0x2b4c7c){return _0x2b4c7c[_0xc88a('0x24')]()[_0xc88a('0x25')](function(){var _0x3a5529=_0x2b4c7c[_0xc88a('0x26')]({'plain':!![]});var _0x3ab0af=_0xc88a('0x27');return db[_0xc88a('0x28')][_0xc88a('0x24')]({'where':{'type':_0x3ab0af,'resourceId':_0x3a5529['id']}})['then'](function(){return _0x2b4c7c;});})[_0xc88a('0x25')](function(){_0x2c0b41[_0xc88a('0x19')](0xcc)[_0xc88a('0x1a')]();});}};}function handleEntityNotFound(_0x4fe62f,_0x3a5477){return function(_0x5a2990){if(!_0x5a2990){_0x4fe62f['sendStatus'](0x194);}return _0x5a2990;};}function handleError(_0x3ebafc,_0x3e0834){_0x3e0834=_0x3e0834||0x1f4;return function(_0x205eb5){logger['error'](_0x205eb5['stack']);if(_0x205eb5[_0xc88a('0x29')]){delete _0x205eb5[_0xc88a('0x29')];}_0x3ebafc[_0xc88a('0x19')](_0x3e0834)[_0xc88a('0x2a')](_0x205eb5);};}exports[_0xc88a('0x2b')]=function(_0x3ad8a2,_0x2c0db){var _0x5b2204={},_0x3ca0b9={},_0x333093={'count':0x0,'rows':[]};var _0x1b7986=_[_0xc88a('0x2c')](db[_0xc88a('0x2d')][_0xc88a('0x2e')],function(_0x17226e){return{'name':_0x17226e['fieldName'],'type':_0x17226e['type'][_0xc88a('0x2f')]};});_0x3ca0b9[_0xc88a('0x30')]=_[_0xc88a('0x2c')](_0x1b7986,_0xc88a('0x29'));_0x3ca0b9[_0xc88a('0x31')]=_[_0xc88a('0x32')](_0x3ad8a2['query']);_0x3ca0b9[_0xc88a('0x33')]=_[_0xc88a('0x34')](_0x3ca0b9[_0xc88a('0x30')],_0x3ca0b9[_0xc88a('0x31')]);_0x5b2204[_0xc88a('0x35')]=_[_0xc88a('0x34')](_0x3ca0b9[_0xc88a('0x30')],qs[_0xc88a('0x36')](_0x3ad8a2[_0xc88a('0x31')][_0xc88a('0x36')]));_0x5b2204[_0xc88a('0x35')]=_0x5b2204[_0xc88a('0x35')]['length']?_0x5b2204[_0xc88a('0x35')]:_0x3ca0b9['model'];if(!_0x3ad8a2[_0xc88a('0x31')][_0xc88a('0x37')]('nolimit')){_0x5b2204[_0xc88a('0x1e')]=qs[_0xc88a('0x1e')](_0x3ad8a2[_0xc88a('0x31')][_0xc88a('0x1e')]);_0x5b2204[_0xc88a('0x1d')]=qs[_0xc88a('0x1d')](_0x3ad8a2['query']['offset']);}_0x5b2204['order']=qs[_0xc88a('0x38')](_0x3ad8a2[_0xc88a('0x31')][_0xc88a('0x38')]);_0x5b2204[_0xc88a('0x39')]=qs[_0xc88a('0x33')](_[_0xc88a('0x3a')](_0x3ad8a2[_0xc88a('0x31')],_0x3ca0b9['filters']),_0x1b7986);if(_0x3ad8a2['query'][_0xc88a('0x3b')]){_0x5b2204[_0xc88a('0x39')]=_[_0xc88a('0x3c')](_0x5b2204[_0xc88a('0x39')],{'$or':_[_0xc88a('0x2c')](_0x1b7986,function(_0x39a5f1){if(_0x39a5f1[_0xc88a('0x3d')]!==_0xc88a('0x3e')){var _0xb3af86={};_0xb3af86[_0x39a5f1[_0xc88a('0x29')]]={'$like':'%'+_0x3ad8a2[_0xc88a('0x31')]['filter']+'%'};return _0xb3af86;}})});}_0x5b2204=_[_0xc88a('0x3c')]({},_0x5b2204,_0x3ad8a2['options']);var _0x5a5de4={'where':_0x5b2204[_0xc88a('0x39')]};return db['VoiceChanSpy'][_0xc88a('0x1c')](_0x5a5de4)[_0xc88a('0x25')](function(_0x3b0cd9){_0x333093[_0xc88a('0x1c')]=_0x3b0cd9;if(_0x3ad8a2[_0xc88a('0x31')][_0xc88a('0x3f')]){_0x5b2204[_0xc88a('0x40')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x5b2204);})[_0xc88a('0x25')](function(_0x44d8c8){_0x333093[_0xc88a('0x41')]=_0x44d8c8;return _0x333093;})['then'](respondWithFilteredResult(_0x2c0db,_0x5b2204))['catch'](handleError(_0x2c0db,null));};exports[_0xc88a('0x42')]=function(_0x21e865,_0x405c98){var _0x4a0627={'raw':![],'where':{'id':_0x21e865[_0xc88a('0x43')]['id']}},_0x49933e={};_0x49933e[_0xc88a('0x30')]=_['keys'](db['VoiceChanSpy'][_0xc88a('0x2e')]);_0x49933e[_0xc88a('0x31')]=_[_0xc88a('0x32')](_0x21e865[_0xc88a('0x31')]);_0x49933e[_0xc88a('0x33')]=_[_0xc88a('0x34')](_0x49933e[_0xc88a('0x30')],_0x49933e[_0xc88a('0x31')]);_0x4a0627['attributes']=_[_0xc88a('0x34')](_0x49933e[_0xc88a('0x30')],qs[_0xc88a('0x36')](_0x21e865[_0xc88a('0x31')]['fields']));_0x4a0627['attributes']=_0x4a0627[_0xc88a('0x35')][_0xc88a('0x44')]?_0x4a0627[_0xc88a('0x35')]:_0x49933e[_0xc88a('0x30')];if(_0x21e865[_0xc88a('0x31')]['includeAll']){_0x4a0627[_0xc88a('0x40')]=[{'all':!![]}];}_0x4a0627=_[_0xc88a('0x3c')]({},_0x4a0627,_0x21e865['options']);return db[_0xc88a('0x2d')][_0xc88a('0x45')](_0x4a0627)[_0xc88a('0x25')](handleEntityNotFound(_0x405c98,null))[_0xc88a('0x25')](respondWithResult(_0x405c98,null))['catch'](handleError(_0x405c98,null));};exports['create']=function(_0xf06182,_0xe00083){return db[_0xc88a('0x2d')][_0xc88a('0x46')](_0xf06182[_0xc88a('0x47')],{})['then'](function(_0x464ff7){var _0x42cf18=_0xf06182[_0xc88a('0x48')]['get']({'plain':!![]});if(!_0x42cf18)throw new Error(_0xc88a('0x49'));if(_0x42cf18[_0xc88a('0x4a')]===_0xc88a('0x48')){var _0x26604f=_0x464ff7[_0xc88a('0x26')]({'plain':!![]});var _0x5003c0=_0xc88a('0x27');return db['UserProfileSection'][_0xc88a('0x45')]({'where':{'name':_0x5003c0,'userProfileId':_0x42cf18[_0xc88a('0x4b')]},'raw':!![]})['then'](function(_0x2ec963){if(_0x2ec963&&_0x2ec963[_0xc88a('0x4c')]===0x0){return db[_0xc88a('0x28')]['create']({'name':_0x26604f[_0xc88a('0x29')],'resourceId':_0x26604f['id'],'type':_0x2ec963['name'],'sectionId':_0x2ec963['id']},{})[_0xc88a('0x25')](function(){return _0x464ff7;});}else{return _0x464ff7;}})['catch'](function(_0x2aec95){logger[_0xc88a('0x4d')](_0xc88a('0x4e'),_0x2aec95);throw _0x2aec95;});}return _0x464ff7;})[_0xc88a('0x25')](respondWithResult(_0xe00083,0xc9))[_0xc88a('0x4f')](handleError(_0xe00083,null));};exports[_0xc88a('0x23')]=function(_0x800409,_0x59e258){if(_0x800409['body']['id']){delete _0x800409[_0xc88a('0x47')]['id'];}return db[_0xc88a('0x2d')][_0xc88a('0x45')]({'where':{'id':_0x800409[_0xc88a('0x43')]['id']}})[_0xc88a('0x25')](handleEntityNotFound(_0x59e258,null))[_0xc88a('0x25')](saveUpdates(_0x800409[_0xc88a('0x47')],null))[_0xc88a('0x25')](respondWithResult(_0x59e258,null))[_0xc88a('0x4f')](handleError(_0x59e258,null));};exports[_0xc88a('0x24')]=function(_0x4fc5e5,_0x3c6bf0){return db['VoiceChanSpy'][_0xc88a('0x45')]({'where':{'id':_0x4fc5e5[_0xc88a('0x43')]['id']}})[_0xc88a('0x25')](handleEntityNotFound(_0x3c6bf0,null))[_0xc88a('0x25')](removeEntity(_0x3c6bf0,null))[_0xc88a('0x4f')](handleError(_0x3c6bf0,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 0d024b8..c4c318a 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 _0x63eb=['context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','record','MixMonitor','recordingFormat','auth','password','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','findAll','then','catch','exports','define','VoiceChanSpy','voice_chanspy','bulkCreate','VoiceExtension','destroy','lodash','util','bluebird','./voiceChanSpy.attributes'];(function(_0x226ad1,_0x2858e2){var _0x16b625=function(_0x4dc555){while(--_0x4dc555){_0x226ad1['push'](_0x226ad1['shift']());}};_0x16b625(++_0x2858e2);}(_0x63eb,0x90));var _0xb63e=function(_0x2b0973,_0xc46bce){_0x2b0973=_0x2b0973-0x0;var _0x45dac4=_0x63eb[_0x2b0973];return _0x45dac4;};'use strict';var _=require(_0xb63e('0x0'));var util=require(_0xb63e('0x1'));var BPromise=require(_0xb63e('0x2'));var attributes=require(_0xb63e('0x3'));var getUserApplications=function(_0x3aa2dc,_0x2968ac,_0x4e6d10){var _0x1b68cc=0x1;var _0x341ff1=[];var _0x3a40f6={'context':_0x2968ac[_0xb63e('0x4')]||_0xb63e('0x5'),'exten':util[_0xb63e('0x6')](_0xb63e('0x7'),_0x3aa2dc[_0xb63e('0x8')],_0x4e6d10),'type':_0xb63e('0x9'),'isApp':![],'ChanSpyId':_0x3aa2dc['id'],'UserId':_0x2968ac['id']};_0x341ff1[_0xb63e('0xa')](_[_0xb63e('0xb')]({'app':_0xb63e('0xc'),'appdata':util[_0xb63e('0x6')](_0xb63e('0xd'),'chanspy'),'priority':_0x1b68cc++},_0x3a40f6));if(_0x3aa2dc[_0xb63e('0xe')]){_0x341ff1['push'](_[_0xb63e('0xb')]({'app':_0xb63e('0xf'),'appdata':util[_0xb63e('0x6')]('${UNIQUEID}.%s,a',_0x3aa2dc[_0xb63e('0x10')]),'priority':_0x1b68cc++},_0x3a40f6));}if(_0x3aa2dc[_0xb63e('0x11')]){_0x341ff1[_0xb63e('0xa')](_[_0xb63e('0xb')]({'app':'Authenticate','appdata':_0x3aa2dc[_0xb63e('0x12')],'priority':_0x1b68cc++},_0x3a40f6));}_0x341ff1[_0xb63e('0xa')](_[_0xb63e('0xb')]({'app':'ChanSpy','appdata':util[_0xb63e('0x6')](_0xb63e('0x13'),_0x2968ac[_0xb63e('0x14')],_0x3aa2dc[_0xb63e('0x15')]?_0x3aa2dc['options'][_0xb63e('0x16')](''):''),'priority':_0x1b68cc++},_0x3a40f6));if(_0x3aa2dc[_0xb63e('0xe')]){_0x341ff1[_0xb63e('0xa')](_[_0xb63e('0xb')]({'app':_0xb63e('0x17'),'priority':_0x1b68cc++},_0x3a40f6));}return _0x341ff1;};var getChanSpyApplications=function(_0x52c5c7,_0xcfe001){var _0x45d6de=[];for(var _0x2221d9=0x0,_0x398544=0x1;_0x2221d9<_0xcfe001[_0xb63e('0x18')];_0x2221d9++,_0x398544=0x1){_0x45d6de=_0x45d6de[_0xb63e('0x19')](getUserApplications(_0x52c5c7,_0xcfe001[_0x2221d9],_0xcfe001[_0x2221d9]['internal']));if(_0xcfe001[_0x2221d9][_0xb63e('0x1a')]!=_0xcfe001[_0x2221d9][_0xb63e('0x14')]){_0x45d6de=_0x45d6de[_0xb63e('0x19')](getUserApplications(_0x52c5c7,_0xcfe001[_0x2221d9],_0xcfe001[_0x2221d9]['name']));}}return _0x45d6de;};var getChanSpyPromise=function(_0x43580e,_0x5bbcc3){return new BPromise(function(_0x5ac51e,_0x3210f2){return _0x43580e['User'][_0xb63e('0x1b')]({'attributes':['id',_0xb63e('0x14'),_0xb63e('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xb63e('0x1c')](function(_0x2d5ce6){if(_0x2d5ce6){return _0x5ac51e(getChanSpyApplications(_0x5bbcc3,_0x2d5ce6));}return _0x5ac51e([]);})[_0xb63e('0x1d')](function(_0x193d21){_0x3210f2(_0x193d21);});});};module[_0xb63e('0x1e')]=function(_0x580e8a,_0xc6cf48){var _0x4f4907=_0x580e8a['models'];return _0x580e8a[_0xb63e('0x1f')](_0xb63e('0x20'),attributes,{'tableName':_0xb63e('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x210ef4,_0x4eae0e,_0x261dbb){return getChanSpyPromise(_0x4f4907,_0x210ef4)['then'](function(_0x5abd5a){if(_0x5abd5a&&_0x5abd5a[_0xb63e('0x18')]){return _0x4f4907['VoiceExtension'][_0xb63e('0x22')](_0x5abd5a);}})[_0xb63e('0x1c')](function(){_0x261dbb();})['catch'](function(_0x2df49d){_0x261dbb(_0x2df49d);});},'afterUpdate':function(_0x3fd788,_0x5c82aa,_0x27b0ea){return _0x4f4907[_0xb63e('0x23')]['destroy']({'where':{'ChanSpyId':_0x3fd788['id']}})[_0xb63e('0x1c')](function(){return getChanSpyPromise(_0x4f4907,_0x3fd788);})['then'](function(_0x1f4171){if(_0x1f4171&&_0x1f4171[_0xb63e('0x18')]){return _0x4f4907['VoiceExtension'][_0xb63e('0x22')](_0x1f4171);}})[_0xb63e('0x1c')](function(){_0x27b0ea();})['catch'](function(_0x57fa8b){_0x27b0ea(_0x57fa8b);});},'afterDestroy':function(_0x293faf,_0x24452d,_0x250588){return _0x4f4907[_0xb63e('0x23')][_0xb63e('0x24')]({'where':{'ChanSpyId':_0x293faf['id']}})[_0xb63e('0x1c')](function(){_0x250588();})[_0xb63e('0x1d')](function(_0x507564){_0x250588(_0x507564);});}}});}; \ No newline at end of file +var _0x757f=['system','push','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','concat','internal','then','catch','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','lodash','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix'];(function(_0x6b2793,_0x25b54d){var _0x4f0744=function(_0x50ade4){while(--_0x50ade4){_0x6b2793['push'](_0x6b2793['shift']());}};_0x4f0744(++_0x25b54d);}(_0x757f,0xee));var _0xf757=function(_0x4f7576,_0x138a8f){_0x4f7576=_0x4f7576-0x0;var _0x45d522=_0x757f[_0x4f7576];return _0x45d522;};'use strict';var _=require(_0xf757('0x0'));var util=require('util');var BPromise=require(_0xf757('0x1'));var attributes=require(_0xf757('0x2'));var getUserApplications=function(_0x37e870,_0x135d5e,_0x5c5865){var _0x44ebcf=0x1;var _0x26a38a=[];var _0x302fba={'context':_0x135d5e[_0xf757('0x3')]||'from-sip','exten':util[_0xf757('0x4')](_0xf757('0x5'),_0x37e870[_0xf757('0x6')],_0x5c5865),'type':_0xf757('0x7'),'isApp':![],'ChanSpyId':_0x37e870['id'],'UserId':_0x135d5e['id']};_0x26a38a[_0xf757('0x8')](_['merge']({'app':'Set','appdata':util[_0xf757('0x4')](_0xf757('0x9'),_0xf757('0xa')),'priority':_0x44ebcf++},_0x302fba));if(_0x37e870[_0xf757('0xb')]){_0x26a38a['push'](_[_0xf757('0xc')]({'app':_0xf757('0xd'),'appdata':util[_0xf757('0x4')](_0xf757('0xe'),_0x37e870[_0xf757('0xf')]),'priority':_0x44ebcf++},_0x302fba));}if(_0x37e870[_0xf757('0x10')]){_0x26a38a[_0xf757('0x8')](_[_0xf757('0xc')]({'app':_0xf757('0x11'),'appdata':_0x37e870[_0xf757('0x12')],'priority':_0x44ebcf++},_0x302fba));}_0x26a38a[_0xf757('0x8')](_[_0xf757('0xc')]({'app':_0xf757('0x13'),'appdata':util[_0xf757('0x4')](_0xf757('0x14'),_0x135d5e[_0xf757('0x15')],_0x37e870[_0xf757('0x16')]?_0x37e870[_0xf757('0x16')]['join'](''):''),'priority':_0x44ebcf++},_0x302fba));if(_0x37e870[_0xf757('0xb')]){_0x26a38a[_0xf757('0x8')](_['merge']({'app':_0xf757('0x17'),'priority':_0x44ebcf++},_0x302fba));}return _0x26a38a;};var getChanSpyApplications=function(_0x2b3540,_0x10f49e){var _0x53fdce=[];for(var _0x1c5934=0x0,_0x45ea74=0x1;_0x1c5934<_0x10f49e[_0xf757('0x18')];_0x1c5934++,_0x45ea74=0x1){_0x53fdce=_0x53fdce[_0xf757('0x19')](getUserApplications(_0x2b3540,_0x10f49e[_0x1c5934],_0x10f49e[_0x1c5934]['internal']));if(_0x10f49e[_0x1c5934][_0xf757('0x1a')]!=_0x10f49e[_0x1c5934][_0xf757('0x15')]){_0x53fdce=_0x53fdce[_0xf757('0x19')](getUserApplications(_0x2b3540,_0x10f49e[_0x1c5934],_0x10f49e[_0x1c5934][_0xf757('0x15')]));}}return _0x53fdce;};var getChanSpyPromise=function(_0x25c375,_0x4d6580){return new BPromise(function(_0x4b9573,_0x343fe9){return _0x25c375['User']['findAll']({'attributes':['id',_0xf757('0x15'),_0xf757('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xf757('0x1b')](function(_0x2d993f){if(_0x2d993f){return _0x4b9573(getChanSpyApplications(_0x4d6580,_0x2d993f));}return _0x4b9573([]);})[_0xf757('0x1c')](function(_0x383bb2){_0x343fe9(_0x383bb2);});});};module['exports']=function(_0x495bad,_0x1edb1b){var _0x3a269d=_0x495bad[_0xf757('0x1d')];return _0x495bad[_0xf757('0x1e')](_0xf757('0x1f'),attributes,{'tableName':_0xf757('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x98f305,_0x3232c6,_0x355d70){return getChanSpyPromise(_0x3a269d,_0x98f305)[_0xf757('0x1b')](function(_0x4d9012){if(_0x4d9012&&_0x4d9012['length']){return _0x3a269d[_0xf757('0x21')][_0xf757('0x22')](_0x4d9012);}})[_0xf757('0x1b')](function(){_0x355d70();})[_0xf757('0x1c')](function(_0x207bae){_0x355d70(_0x207bae);});},'afterUpdate':function(_0x3ca172,_0x155a13,_0x180882){return _0x3a269d['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x3ca172['id']}})[_0xf757('0x1b')](function(){return getChanSpyPromise(_0x3a269d,_0x3ca172);})['then'](function(_0x1fa192){if(_0x1fa192&&_0x1fa192['length']){return _0x3a269d[_0xf757('0x21')][_0xf757('0x22')](_0x1fa192);}})['then'](function(){_0x180882();})[_0xf757('0x1c')](function(_0x269388){_0x180882(_0x269388);});},'afterDestroy':function(_0x1b6a03,_0x3ad266,_0x542b16){return _0x3a269d[_0xf757('0x21')]['destroy']({'where':{'ChanSpyId':_0x1b6a03['id']}})[_0xf757('0x1b')](function(){_0x542b16();})['catch'](function(_0xa03db8){_0x542b16(_0xa03db8);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 599fd10..70a707b 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 _0x984e=['http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3e4791,_0x477c42){var _0x1a19c0=function(_0x4d05de){while(--_0x4d05de){_0x3e4791['push'](_0x3e4791['shift']());}};_0x1a19c0(++_0x477c42);}(_0x984e,0x1f0));var _0xe984=function(_0x4cb72c,_0x2ec371){_0x4cb72c=_0x4cb72c-0x0;var _0x203965=_0x984e[_0x4cb72c];return _0x203965;};'use strict';var _=require(_0xe984('0x0'));var util=require(_0xe984('0x1'));var moment=require(_0xe984('0x2'));var BPromise=require(_0xe984('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe984('0x4'));var db=require(_0xe984('0x5'))['db'];var utils=require(_0xe984('0x6'));var logger=require('../../config/logger')(_0xe984('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe984('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1097aa,_0x17e640,_0x4725a2){return new BPromise(function(_0x395f30,_0x1c0630){return client[_0xe984('0x9')](_0x1097aa,_0x4725a2)[_0xe984('0xa')](function(_0x1b8d5b){logger[_0xe984('0xb')](_0xe984('0xc'),_0x17e640,_0xe984('0xd'));logger[_0xe984('0xe')](_0xe984('0xf'),_0x17e640,'request\x20sent',JSON[_0xe984('0x10')](_0x1b8d5b));if(_0x1b8d5b[_0xe984('0x11')]){if(_0x1b8d5b['error'][_0xe984('0x12')]===0x1f4){logger[_0xe984('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x17e640,_0x1b8d5b[_0xe984('0x11')][_0xe984('0x13')]);return _0x1c0630(_0x1b8d5b[_0xe984('0x11')]['message']);}logger[_0xe984('0x11')](_0xe984('0xc'),_0x17e640,_0x1b8d5b['error'][_0xe984('0x13')]);return _0x395f30(_0x1b8d5b[_0xe984('0x11')][_0xe984('0x13')]);}else{logger[_0xe984('0xb')](_0xe984('0xc'),_0x17e640,_0xe984('0xd'));_0x395f30(_0x1b8d5b[_0xe984('0x14')][_0xe984('0x13')]);}})['catch'](function(_0x131292){logger['error'](_0xe984('0xc'),_0x17e640,_0x131292);_0x1c0630(_0x131292);});});} \ No newline at end of file +var _0x3c14=['stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','request','then','info','VoiceChanSpy,\x20%s,\x20%s','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x29729c,_0x1b37b7){var _0x3441df=function(_0xe39527){while(--_0xe39527){_0x29729c['push'](_0x29729c['shift']());}};_0x3441df(++_0x1b37b7);}(_0x3c14,0x6c));var _0x43c1=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0x3c14[_0x1d70db];return _0x3060c6;};'use strict';var _=require('lodash');var util=require(_0x43c1('0x0'));var moment=require(_0x43c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x43c1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43c1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x43c1('0x4'))(_0x43c1('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10e1ac,_0xb47d5f,_0x562642){return new BPromise(function(_0x54d24a,_0x368f4d){return client[_0x43c1('0x6')](_0x10e1ac,_0x562642)[_0x43c1('0x7')](function(_0x1f3b2e){logger[_0x43c1('0x8')](_0x43c1('0x9'),_0xb47d5f,'request\x20sent');logger['debug'](_0x43c1('0xa'),_0xb47d5f,'request\x20sent',JSON[_0x43c1('0xb')](_0x1f3b2e));if(_0x1f3b2e['error']){if(_0x1f3b2e[_0x43c1('0xc')][_0x43c1('0xd')]===0x1f4){logger[_0x43c1('0xc')](_0x43c1('0x9'),_0xb47d5f,_0x1f3b2e[_0x43c1('0xc')][_0x43c1('0xe')]);return _0x368f4d(_0x1f3b2e[_0x43c1('0xc')][_0x43c1('0xe')]);}logger[_0x43c1('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0xb47d5f,_0x1f3b2e[_0x43c1('0xc')]['message']);return _0x54d24a(_0x1f3b2e[_0x43c1('0xc')][_0x43c1('0xe')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0xb47d5f,'request\x20sent');_0x54d24a(_0x1f3b2e[_0x43c1('0xf')][_0x43c1('0xe')]);}})[_0x43c1('0x10')](function(_0x384e75){logger[_0x43c1('0xc')](_0x43c1('0x9'),_0xb47d5f,_0x384e75);_0x368f4d(_0x384e75);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index c601411..30a349b 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 _0xb020=['../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x301b43,_0x4f2a0c){var _0x50d165=function(_0x388c88){while(--_0x388c88){_0x301b43['push'](_0x301b43['shift']());}};_0x50d165(++_0x4f2a0c);}(_0xb020,0x1d5));var _0x0b02=function(_0x1a809b,_0x4c15e3){_0x1a809b=_0x1a809b-0x0;var _0x5d90e6=_0xb020[_0x1a809b];return _0x5d90e6;};'use strict';var multer=require('multer');var util=require(_0x0b02('0x0'));var path=require(_0x0b02('0x1'));var timeout=require(_0x0b02('0x2'));var express=require(_0x0b02('0x3'));var router=express[_0x0b02('0x4')]();var auth=require(_0x0b02('0x5'));var interaction=require(_0x0b02('0x6'));var config=require(_0x0b02('0x7'));var controller=require(_0x0b02('0x8'));router[_0x0b02('0x9')]('/',auth[_0x0b02('0xa')](),controller[_0x0b02('0xb')]);router['get']('/:id',auth[_0x0b02('0xa')](),controller[_0x0b02('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0b02('0xd')](_0x0b02('0xe'),auth[_0x0b02('0xa')](),controller[_0x0b02('0xf')]);router[_0x0b02('0x10')](_0x0b02('0xe'),auth[_0x0b02('0xa')](),controller[_0x0b02('0x11')]);module[_0x0b02('0x12')]=router; \ No newline at end of file +var _0x46f7=['../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','express','Router'];(function(_0x208d39,_0x5de94f){var _0x3f96cb=function(_0x23d510){while(--_0x23d510){_0x208d39['push'](_0x208d39['shift']());}};_0x3f96cb(++_0x5de94f);}(_0x46f7,0x194));var _0x746f=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x46f7[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x746f('0x0'));var router=express[_0x746f('0x1')]();var auth=require(_0x746f('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x746f('0x3'));var controller=require('./voiceContext.controller');router[_0x746f('0x4')]('/',auth[_0x746f('0x5')](),controller['index']);router[_0x746f('0x4')](_0x746f('0x6'),auth[_0x746f('0x5')](),controller[_0x746f('0x7')]);router[_0x746f('0x8')]('/',auth[_0x746f('0x5')](),controller[_0x746f('0x9')]);router[_0x746f('0xa')](_0x746f('0x6'),auth['isAuthenticated'](),controller[_0x746f('0xb')]);router[_0x746f('0xc')]('/:id',auth[_0x746f('0x5')](),controller[_0x746f('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index fcccf1b..b508b19 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['name','sequelize','STRING'];(function(_0x30552e,_0x183bd0){var _0x473d3a=function(_0x254143){while(--_0x254143){_0x30552e['push'](_0x30552e['shift']());}};_0x473d3a(++_0x183bd0);}(_0x3e74,0x175));var _0x43e7=function(_0x11fffb,_0x170699){_0x11fffb=_0x11fffb-0x0;var _0x380ed4=_0x3e74[_0x11fffb];return _0x380ed4;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x4a8941,_0x42af9c){var _0x4e8c67=function(_0x163f2a){while(--_0x163f2a){_0x4a8941['push'](_0x4a8941['shift']());}};_0x4e8c67(++_0x42af9c);}(_0x3e74,0x175));var _0x43e7=function(_0x48c678,_0x4b8a81){_0x48c678=_0x48c678-0x0;var _0xead393=_0x3e74[_0x48c678];return _0xead393;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 607bfbd..f85b7f8 100644 --- a/server/api/voiceContext/voiceContext.controller.js +++ b/server/api/voiceContext/voiceContext.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Contexts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','server/files/templates/context.ejs','utf8','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','get','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];var jayson=require(_0x7995('0x1a'));var client=jayson[_0x7995('0x1b')][_0x7995('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x281576,_0x23999f,_0x2bbe7a){if(_0x2bbe7a){var _0x4cc004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cc004['test'](_0x23999f)){return _0x281576;}else{throw new db[(_0x7995('0x1d'))][(_0x7995('0x1e'))](_0x7995('0x1f'));}}else{return _0x281576;}}function respondWithRpcPromise(_0x321ae8,_0x3f1d3e,_0x1a5310,_0x2202ce){return new BPromise(function(_0x41cbf0,_0x5377e5){var _0x2eeacc=_0x2202ce||client;return _0x2eeacc['request'](_0x321ae8,_0x1a5310)[_0x7995('0x20')](function(_0x37f297){logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));logger[_0x7995('0x24')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3f1d3e,'request\x20sent',JSON[_0x7995('0x25')](_0x37f297));if(_0x37f297['error']){if(_0x37f297['error'][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x37f297[_0x7995('0x27')]['message']);return _0x5377e5(_0x37f297['error'][_0x7995('0x28')]);}logger[_0x7995('0x27')](_0x7995('0x22'),_0x3f1d3e,_0x37f297[_0x7995('0x27')][_0x7995('0x28')]);return _0x41cbf0(_0x37f297[_0x7995('0x27')]['message']);}else{logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));_0x41cbf0(_0x37f297[_0x7995('0x29')][_0x7995('0x28')]);}})[_0x7995('0x2a')](function(_0x475351){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x475351);_0x5377e5(_0x475351);});});}function respondWithStatusCode(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xcc;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c);}return _0x39df42[_0x7995('0x2c')](_0x34e70c)[_0x7995('0x2d')]();};}function respondWithResult(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0xc8;return function(_0x5911c3){if(_0x5911c3){return _0x56691a[_0x7995('0x2c')](_0x47625f)[_0x7995('0x2e')](_0x5911c3);}};}function respondWithFilteredResult(_0xf16cc2,_0x132a42){return function(_0x11c1eb){if(_0x11c1eb){var _0x4b6f99=_0x11c1eb[_0x7995('0x2f')],_0x9b2a15=_0x132a42[_0x7995('0x30')],_0x514445=_0x132a42['offset']+_0x132a42['limit'],_0x456a28;if(_0x514445>=_0x4b6f99){_0x514445=_0x4b6f99;_0x456a28=0xc8;}else{_0x456a28=0xce;}_0xf16cc2['status'](_0x456a28);return _0xf16cc2[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x514445+'/'+_0x4b6f99)[_0x7995('0x2e')](_0x11c1eb);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){var _0x577412=_0x33e24e[_0x7995('0x36')]({'plain':!![]});var _0x3acfc3='Contexts';return db[_0x7995('0x37')]['destroy']({'where':{'type':_0x3acfc3,'resourceId':_0x577412['id']}})[_0x7995('0x20')](function(){return _0x33e24e;});})[_0x7995('0x20')](function(){_0x510841[_0x7995('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d76d,_0x36d057){return function(_0x5e67fe){if(!_0x5e67fe){_0x52d76d['sendStatus'](0x194);}return _0x5e67fe;};}function handleError(_0x3e99cd,_0xe328b1){_0xe328b1=_0xe328b1||0x1f4;return function(_0x5212ff){logger[_0x7995('0x27')](_0x5212ff[_0x7995('0x38')]);if(_0x5212ff[_0x7995('0x39')]){delete _0x5212ff[_0x7995('0x39')];}_0x3e99cd[_0x7995('0x2c')](_0xe328b1)['send'](_0x5212ff);};}exports[_0x7995('0x3a')]=function(_0x242713,_0xf612e6){var _0x1d60b8={},_0x4b1541={},_0x2be2c0={'count':0x0,'rows':[]};var _0x235df7=_[_0x7995('0x3b')](db[_0x7995('0x3c')][_0x7995('0x3d')],function(_0x1035dc){return{'name':_0x1035dc['fieldName'],'type':_0x1035dc[_0x7995('0x3e')][_0x7995('0x3f')]};});_0x4b1541[_0x7995('0x40')]=_[_0x7995('0x3b')](_0x235df7,_0x7995('0x39'));_0x4b1541[_0x7995('0x41')]=_[_0x7995('0x42')](_0x242713[_0x7995('0x41')]);_0x4b1541[_0x7995('0x43')]=_[_0x7995('0x44')](_0x4b1541[_0x7995('0x40')],_0x4b1541[_0x7995('0x41')]);_0x1d60b8[_0x7995('0x45')]=_['intersection'](_0x4b1541['model'],qs[_0x7995('0x46')](_0x242713[_0x7995('0x41')]['fields']));_0x1d60b8['attributes']=_0x1d60b8[_0x7995('0x45')]['length']?_0x1d60b8['attributes']:_0x4b1541[_0x7995('0x40')];if(!_0x242713[_0x7995('0x41')][_0x7995('0x47')]('nolimit')){_0x1d60b8[_0x7995('0x48')]=qs['limit'](_0x242713[_0x7995('0x41')]['limit']);_0x1d60b8['offset']=qs[_0x7995('0x30')](_0x242713[_0x7995('0x41')][_0x7995('0x30')]);}_0x1d60b8[_0x7995('0x49')]=qs['sort'](_0x242713[_0x7995('0x41')][_0x7995('0x4a')]);_0x1d60b8[_0x7995('0x4b')]=qs[_0x7995('0x43')](_['pick'](_0x242713['query'],_0x4b1541[_0x7995('0x43')]),_0x235df7);if(_0x242713['query'][_0x7995('0x4c')]){_0x1d60b8['where']=_[_0x7995('0x4d')](_0x1d60b8['where'],{'$or':_[_0x7995('0x3b')](_0x235df7,function(_0x1b0373){if(_0x1b0373['type']!==_0x7995('0x4e')){var _0x336ff2={};_0x336ff2[_0x1b0373[_0x7995('0x39')]]={'$like':'%'+_0x242713[_0x7995('0x41')]['filter']+'%'};return _0x336ff2;}})});}_0x1d60b8=_[_0x7995('0x4d')]({},_0x1d60b8,_0x242713[_0x7995('0x4f')]);var _0x237270={'where':_0x1d60b8['where']};return db[_0x7995('0x3c')][_0x7995('0x2f')](_0x237270)[_0x7995('0x20')](function(_0x3d8ae3){_0x2be2c0[_0x7995('0x2f')]=_0x3d8ae3;if(_0x242713['query'][_0x7995('0x50')]){_0x1d60b8[_0x7995('0x51')]=[{'all':!![]}];}return db['VoiceContext'][_0x7995('0x52')](_0x1d60b8);})['then'](function(_0x1d87f9){_0x2be2c0[_0x7995('0x53')]=_0x1d87f9;return _0x2be2c0;})[_0x7995('0x20')](respondWithFilteredResult(_0xf612e6,_0x1d60b8))[_0x7995('0x2a')](handleError(_0xf612e6,null));};exports[_0x7995('0x54')]=function(_0x14b537,_0x1579b9){var _0x4d46bc={'raw':![],'where':{'id':_0x14b537[_0x7995('0x55')]['id']}},_0x427dcf={};_0x427dcf[_0x7995('0x40')]=_['keys'](db[_0x7995('0x3c')][_0x7995('0x3d')]);_0x427dcf[_0x7995('0x41')]=_['keys'](_0x14b537['query']);_0x427dcf['filters']=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],_0x427dcf['query']);_0x4d46bc[_0x7995('0x45')]=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],qs[_0x7995('0x46')](_0x14b537[_0x7995('0x41')]['fields']));_0x4d46bc[_0x7995('0x45')]=_0x4d46bc['attributes'][_0x7995('0x56')]?_0x4d46bc[_0x7995('0x45')]:_0x427dcf[_0x7995('0x40')];if(_0x14b537['query']['includeAll']){_0x4d46bc['include']=[{'all':!![]}];}_0x4d46bc=_['merge']({},_0x4d46bc,_0x14b537[_0x7995('0x4f')]);return db[_0x7995('0x3c')][_0x7995('0x57')](_0x4d46bc)[_0x7995('0x20')](handleEntityNotFound(_0x1579b9,null))[_0x7995('0x20')](respondWithResult(_0x1579b9,null))[_0x7995('0x2a')](handleError(_0x1579b9,null));};exports[_0x7995('0x58')]=function(_0xda6ce8,_0x328671,_0x17ecd3){var _0xa7af8c;return db[_0x7995('0x3c')][_0x7995('0x58')](_0xda6ce8[_0x7995('0x59')],{'raw':!![]})[_0x7995('0x20')](function(_0x416133){_0xa7af8c=_0x416133;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x50b7c2){var _0x56a374=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x402fa0=ejs[_0x7995('0x5d')](_0x56a374,{'contexts':_0x50b7c2||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x402fa0);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x58'),{'module':_0x7995('0x61')});})[_0x7995('0x20')](function(){var _0x502d43=_0xda6ce8['user'][_0x7995('0x36')]({'plain':!![]});if(!_0x502d43)throw new Error(_0x7995('0x62'));if(_0x502d43[_0x7995('0x63')]===_0x7995('0x64')){var _0x37072=_0xa7af8c[_0x7995('0x36')]({'plain':!![]});return db[_0x7995('0x65')][_0x7995('0x57')]({'where':{'name':_0x7995('0x66'),'userProfileId':_0x502d43['userProfileId']},'raw':!![]})[_0x7995('0x20')](function(_0x3ec5a8){if(_0x3ec5a8&&_0x3ec5a8[_0x7995('0x67')]===0x0){return db[_0x7995('0x37')]['create']({'name':_0x37072['name'],'resourceId':_0x37072['id'],'type':_0x3ec5a8[_0x7995('0x39')],'sectionId':_0x3ec5a8['id']},{})[_0x7995('0x20')](function(){return _0xa7af8c;});}else{return _0xa7af8c;}})['catch'](function(_0x971a23){logger[_0x7995('0x27')](_0x7995('0x68'),_0x971a23);throw _0x971a23;});}return _0xa7af8c;})[_0x7995('0x20')](respondWithResult(_0x328671,0xc9))[_0x7995('0x2a')](handleError(_0x328671,null));};exports['update']=function(_0x457d09,_0x564fca,_0x3e0a46){var _0xe31dcb;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x457d09[_0x7995('0x55')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x564fca,null))[_0x7995('0x20')](saveUpdates(_0x457d09[_0x7995('0x59')],null))[_0x7995('0x20')](function(_0x3f2bde){if(_0x3f2bde){_0xe31dcb=_0x3f2bde;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});}})['then'](function(_0x45351d){var _0x23bbc1=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x268fde=ejs[_0x7995('0x5d')](_0x23bbc1,{'contexts':_0x45351d||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x268fde);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),'update',{'module':'chan_sip.so'});})[_0x7995('0x20')](function(){return _0xe31dcb;})[_0x7995('0x20')](respondWithResult(_0x564fca,null))[_0x7995('0x2a')](handleError(_0x564fca,null));};exports[_0x7995('0x69')]=function(_0x290eae,_0x25d9a4,_0x32a52f){var _0x13dc73;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x290eae['params']['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x25d9a4,null))[_0x7995('0x20')](removeEntity(_0x25d9a4,null))[_0x7995('0x20')](function(){return db['VoiceContext'][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x705f0){var _0x3a7d9d=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x1fdff6=ejs[_0x7995('0x5d')](_0x3a7d9d,{'contexts':_0x705f0});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x1fdff6);return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x69'),{'module':_0x7995('0x61')});})[_0x7995('0x2a')](handleError(_0x25d9a4,null));}; \ No newline at end of file +var _0x9957=['attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Contexts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','server/files/templates/context.ejs','utf8','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','get','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_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'];var jayson=require(_0x7995('0x1a'));var client=jayson[_0x7995('0x1b')][_0x7995('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x281576,_0x23999f,_0x2bbe7a){if(_0x2bbe7a){var _0x4cc004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cc004['test'](_0x23999f)){return _0x281576;}else{throw new db[(_0x7995('0x1d'))][(_0x7995('0x1e'))](_0x7995('0x1f'));}}else{return _0x281576;}}function respondWithRpcPromise(_0x321ae8,_0x3f1d3e,_0x1a5310,_0x2202ce){return new BPromise(function(_0x41cbf0,_0x5377e5){var _0x2eeacc=_0x2202ce||client;return _0x2eeacc['request'](_0x321ae8,_0x1a5310)[_0x7995('0x20')](function(_0x37f297){logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));logger[_0x7995('0x24')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3f1d3e,'request\x20sent',JSON[_0x7995('0x25')](_0x37f297));if(_0x37f297['error']){if(_0x37f297['error'][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x37f297[_0x7995('0x27')]['message']);return _0x5377e5(_0x37f297['error'][_0x7995('0x28')]);}logger[_0x7995('0x27')](_0x7995('0x22'),_0x3f1d3e,_0x37f297[_0x7995('0x27')][_0x7995('0x28')]);return _0x41cbf0(_0x37f297[_0x7995('0x27')]['message']);}else{logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));_0x41cbf0(_0x37f297[_0x7995('0x29')][_0x7995('0x28')]);}})[_0x7995('0x2a')](function(_0x475351){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x475351);_0x5377e5(_0x475351);});});}function respondWithStatusCode(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xcc;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c);}return _0x39df42[_0x7995('0x2c')](_0x34e70c)[_0x7995('0x2d')]();};}function respondWithResult(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0xc8;return function(_0x5911c3){if(_0x5911c3){return _0x56691a[_0x7995('0x2c')](_0x47625f)[_0x7995('0x2e')](_0x5911c3);}};}function respondWithFilteredResult(_0xf16cc2,_0x132a42){return function(_0x11c1eb){if(_0x11c1eb){var _0x4b6f99=_0x11c1eb[_0x7995('0x2f')],_0x9b2a15=_0x132a42[_0x7995('0x30')],_0x514445=_0x132a42['offset']+_0x132a42['limit'],_0x456a28;if(_0x514445>=_0x4b6f99){_0x514445=_0x4b6f99;_0x456a28=0xc8;}else{_0x456a28=0xce;}_0xf16cc2['status'](_0x456a28);return _0xf16cc2[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x514445+'/'+_0x4b6f99)[_0x7995('0x2e')](_0x11c1eb);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){var _0x577412=_0x33e24e[_0x7995('0x36')]({'plain':!![]});var _0x3acfc3='Contexts';return db[_0x7995('0x37')]['destroy']({'where':{'type':_0x3acfc3,'resourceId':_0x577412['id']}})[_0x7995('0x20')](function(){return _0x33e24e;});})[_0x7995('0x20')](function(){_0x510841[_0x7995('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d76d,_0x36d057){return function(_0x5e67fe){if(!_0x5e67fe){_0x52d76d['sendStatus'](0x194);}return _0x5e67fe;};}function handleError(_0x3e99cd,_0xe328b1){_0xe328b1=_0xe328b1||0x1f4;return function(_0x5212ff){logger[_0x7995('0x27')](_0x5212ff[_0x7995('0x38')]);if(_0x5212ff[_0x7995('0x39')]){delete _0x5212ff[_0x7995('0x39')];}_0x3e99cd[_0x7995('0x2c')](_0xe328b1)['send'](_0x5212ff);};}exports[_0x7995('0x3a')]=function(_0x242713,_0xf612e6){var _0x1d60b8={},_0x4b1541={},_0x2be2c0={'count':0x0,'rows':[]};var _0x235df7=_[_0x7995('0x3b')](db[_0x7995('0x3c')][_0x7995('0x3d')],function(_0x1035dc){return{'name':_0x1035dc['fieldName'],'type':_0x1035dc[_0x7995('0x3e')][_0x7995('0x3f')]};});_0x4b1541[_0x7995('0x40')]=_[_0x7995('0x3b')](_0x235df7,_0x7995('0x39'));_0x4b1541[_0x7995('0x41')]=_[_0x7995('0x42')](_0x242713[_0x7995('0x41')]);_0x4b1541[_0x7995('0x43')]=_[_0x7995('0x44')](_0x4b1541[_0x7995('0x40')],_0x4b1541[_0x7995('0x41')]);_0x1d60b8[_0x7995('0x45')]=_['intersection'](_0x4b1541['model'],qs[_0x7995('0x46')](_0x242713[_0x7995('0x41')]['fields']));_0x1d60b8['attributes']=_0x1d60b8[_0x7995('0x45')]['length']?_0x1d60b8['attributes']:_0x4b1541[_0x7995('0x40')];if(!_0x242713[_0x7995('0x41')][_0x7995('0x47')]('nolimit')){_0x1d60b8[_0x7995('0x48')]=qs['limit'](_0x242713[_0x7995('0x41')]['limit']);_0x1d60b8['offset']=qs[_0x7995('0x30')](_0x242713[_0x7995('0x41')][_0x7995('0x30')]);}_0x1d60b8[_0x7995('0x49')]=qs['sort'](_0x242713[_0x7995('0x41')][_0x7995('0x4a')]);_0x1d60b8[_0x7995('0x4b')]=qs[_0x7995('0x43')](_['pick'](_0x242713['query'],_0x4b1541[_0x7995('0x43')]),_0x235df7);if(_0x242713['query'][_0x7995('0x4c')]){_0x1d60b8['where']=_[_0x7995('0x4d')](_0x1d60b8['where'],{'$or':_[_0x7995('0x3b')](_0x235df7,function(_0x1b0373){if(_0x1b0373['type']!==_0x7995('0x4e')){var _0x336ff2={};_0x336ff2[_0x1b0373[_0x7995('0x39')]]={'$like':'%'+_0x242713[_0x7995('0x41')]['filter']+'%'};return _0x336ff2;}})});}_0x1d60b8=_[_0x7995('0x4d')]({},_0x1d60b8,_0x242713[_0x7995('0x4f')]);var _0x237270={'where':_0x1d60b8['where']};return db[_0x7995('0x3c')][_0x7995('0x2f')](_0x237270)[_0x7995('0x20')](function(_0x3d8ae3){_0x2be2c0[_0x7995('0x2f')]=_0x3d8ae3;if(_0x242713['query'][_0x7995('0x50')]){_0x1d60b8[_0x7995('0x51')]=[{'all':!![]}];}return db['VoiceContext'][_0x7995('0x52')](_0x1d60b8);})['then'](function(_0x1d87f9){_0x2be2c0[_0x7995('0x53')]=_0x1d87f9;return _0x2be2c0;})[_0x7995('0x20')](respondWithFilteredResult(_0xf612e6,_0x1d60b8))[_0x7995('0x2a')](handleError(_0xf612e6,null));};exports[_0x7995('0x54')]=function(_0x14b537,_0x1579b9){var _0x4d46bc={'raw':![],'where':{'id':_0x14b537[_0x7995('0x55')]['id']}},_0x427dcf={};_0x427dcf[_0x7995('0x40')]=_['keys'](db[_0x7995('0x3c')][_0x7995('0x3d')]);_0x427dcf[_0x7995('0x41')]=_['keys'](_0x14b537['query']);_0x427dcf['filters']=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],_0x427dcf['query']);_0x4d46bc[_0x7995('0x45')]=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],qs[_0x7995('0x46')](_0x14b537[_0x7995('0x41')]['fields']));_0x4d46bc[_0x7995('0x45')]=_0x4d46bc['attributes'][_0x7995('0x56')]?_0x4d46bc[_0x7995('0x45')]:_0x427dcf[_0x7995('0x40')];if(_0x14b537['query']['includeAll']){_0x4d46bc['include']=[{'all':!![]}];}_0x4d46bc=_['merge']({},_0x4d46bc,_0x14b537[_0x7995('0x4f')]);return db[_0x7995('0x3c')][_0x7995('0x57')](_0x4d46bc)[_0x7995('0x20')](handleEntityNotFound(_0x1579b9,null))[_0x7995('0x20')](respondWithResult(_0x1579b9,null))[_0x7995('0x2a')](handleError(_0x1579b9,null));};exports[_0x7995('0x58')]=function(_0xda6ce8,_0x328671,_0x17ecd3){var _0xa7af8c;return db[_0x7995('0x3c')][_0x7995('0x58')](_0xda6ce8[_0x7995('0x59')],{'raw':!![]})[_0x7995('0x20')](function(_0x416133){_0xa7af8c=_0x416133;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x50b7c2){var _0x56a374=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x402fa0=ejs[_0x7995('0x5d')](_0x56a374,{'contexts':_0x50b7c2||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x402fa0);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x58'),{'module':_0x7995('0x61')});})[_0x7995('0x20')](function(){var _0x502d43=_0xda6ce8['user'][_0x7995('0x36')]({'plain':!![]});if(!_0x502d43)throw new Error(_0x7995('0x62'));if(_0x502d43[_0x7995('0x63')]===_0x7995('0x64')){var _0x37072=_0xa7af8c[_0x7995('0x36')]({'plain':!![]});return db[_0x7995('0x65')][_0x7995('0x57')]({'where':{'name':_0x7995('0x66'),'userProfileId':_0x502d43['userProfileId']},'raw':!![]})[_0x7995('0x20')](function(_0x3ec5a8){if(_0x3ec5a8&&_0x3ec5a8[_0x7995('0x67')]===0x0){return db[_0x7995('0x37')]['create']({'name':_0x37072['name'],'resourceId':_0x37072['id'],'type':_0x3ec5a8[_0x7995('0x39')],'sectionId':_0x3ec5a8['id']},{})[_0x7995('0x20')](function(){return _0xa7af8c;});}else{return _0xa7af8c;}})['catch'](function(_0x971a23){logger[_0x7995('0x27')](_0x7995('0x68'),_0x971a23);throw _0x971a23;});}return _0xa7af8c;})[_0x7995('0x20')](respondWithResult(_0x328671,0xc9))[_0x7995('0x2a')](handleError(_0x328671,null));};exports['update']=function(_0x457d09,_0x564fca,_0x3e0a46){var _0xe31dcb;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x457d09[_0x7995('0x55')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x564fca,null))[_0x7995('0x20')](saveUpdates(_0x457d09[_0x7995('0x59')],null))[_0x7995('0x20')](function(_0x3f2bde){if(_0x3f2bde){_0xe31dcb=_0x3f2bde;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});}})['then'](function(_0x45351d){var _0x23bbc1=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x268fde=ejs[_0x7995('0x5d')](_0x23bbc1,{'contexts':_0x45351d||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x268fde);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),'update',{'module':'chan_sip.so'});})[_0x7995('0x20')](function(){return _0xe31dcb;})[_0x7995('0x20')](respondWithResult(_0x564fca,null))[_0x7995('0x2a')](handleError(_0x564fca,null));};exports[_0x7995('0x69')]=function(_0x290eae,_0x25d9a4,_0x32a52f){var _0x13dc73;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x290eae['params']['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x25d9a4,null))[_0x7995('0x20')](removeEntity(_0x25d9a4,null))[_0x7995('0x20')](function(){return db['VoiceContext'][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x705f0){var _0x3a7d9d=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x1fdff6=ejs[_0x7995('0x5d')](_0x3a7d9d,{'contexts':_0x705f0});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x1fdff6);return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x69'),{'module':_0x7995('0x61')});})[_0x7995('0x2a')](handleError(_0x25d9a4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 42999b3..157ce81 100644 --- a/server/api/voiceContext/voiceContext.model.js +++ b/server/api/voiceContext/voiceContext.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xe7a974,_0x3a61e5){var _0x13573a=function(_0x59e4cf){while(--_0x59e4cf){_0xe7a974['push'](_0xe7a974['shift']());}};_0x13573a(++_0x3a61e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_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':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 3b2dd50..726997e 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 _0xfdda=['error','code','message','info','VoiceContext,\x20%s,\x20%s','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfdda,0xc2));var _0xafdd=function(_0x2dbac1,_0x44db3b){_0x2dbac1=_0x2dbac1-0x0;var _0x8c4e86=_0xfdda[_0x2dbac1];return _0x8c4e86;};'use strict';var _=require(_0xafdd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xafdd('0x1'));var fs=require('fs');var Redis=require(_0xafdd('0x2'));var db=require(_0xafdd('0x3'))['db'];var utils=require(_0xafdd('0x4'));var logger=require(_0xafdd('0x5'))(_0xafdd('0x6'));var config=require(_0xafdd('0x7'));var jayson=require(_0xafdd('0x8'));var client=jayson[_0xafdd('0x9')][_0xafdd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b0321,_0x3d98a7,_0x8b05a2){return new BPromise(function(_0x3036be,_0x3b0d23){return client[_0xafdd('0xb')](_0x3b0321,_0x8b05a2)[_0xafdd('0xc')](function(_0x9bcb31){logger['info']('VoiceContext,\x20%s,\x20%s',_0x3d98a7,_0xafdd('0xd'));logger[_0xafdd('0xe')](_0xafdd('0xf'),_0x3d98a7,'request\x20sent',JSON['stringify'](_0x9bcb31));if(_0x9bcb31[_0xafdd('0x10')]){if(_0x9bcb31['error'][_0xafdd('0x11')]===0x1f4){logger[_0xafdd('0x10')]('VoiceContext,\x20%s,\x20%s',_0x3d98a7,_0x9bcb31['error']['message']);return _0x3b0d23(_0x9bcb31['error'][_0xafdd('0x12')]);}logger[_0xafdd('0x10')]('VoiceContext,\x20%s,\x20%s',_0x3d98a7,_0x9bcb31[_0xafdd('0x10')][_0xafdd('0x12')]);return _0x3036be(_0x9bcb31[_0xafdd('0x10')][_0xafdd('0x12')]);}else{logger[_0xafdd('0x13')](_0xafdd('0x14'),_0x3d98a7,_0xafdd('0xd'));_0x3036be(_0x9bcb31['result']['message']);}})['catch'](function(_0x522579){logger[_0xafdd('0x10')]('VoiceContext,\x20%s,\x20%s',_0x3d98a7,_0x522579);_0x3b0d23(_0x522579);});});} \ No newline at end of file +var _0xcfe7=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xff4391,_0x2108b1){var _0xc9689b=function(_0x2bf9f7){while(--_0x2bf9f7){_0xff4391['push'](_0xff4391['shift']());}};_0xc9689b(++_0x2108b1);}(_0xcfe7,0xfb));var _0x7cfe=function(_0x43c89b,_0x23d2cb){_0x43c89b=_0x43c89b-0x0;var _0xaf3b03=_0xcfe7[_0x43c89b];return _0xaf3b03;};'use strict';var _=require(_0x7cfe('0x0'));var util=require(_0x7cfe('0x1'));var moment=require('moment');var BPromise=require(_0x7cfe('0x2'));var rs=require(_0x7cfe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cfe('0x4'))['db'];var utils=require(_0x7cfe('0x5'));var logger=require(_0x7cfe('0x6'))('rpc');var config=require(_0x7cfe('0x7'));var jayson=require(_0x7cfe('0x8'));var client=jayson[_0x7cfe('0x9')][_0x7cfe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c37ce,_0x597f0f,_0x1bed96){return new BPromise(function(_0x1ad64e,_0x25a247){return client[_0x7cfe('0xb')](_0x1c37ce,_0x1bed96)[_0x7cfe('0xc')](function(_0x389f8f){logger['info'](_0x7cfe('0xd'),_0x597f0f,_0x7cfe('0xe'));logger[_0x7cfe('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x597f0f,'request\x20sent',JSON[_0x7cfe('0x10')](_0x389f8f));if(_0x389f8f[_0x7cfe('0x11')]){if(_0x389f8f[_0x7cfe('0x11')][_0x7cfe('0x12')]===0x1f4){logger[_0x7cfe('0x11')](_0x7cfe('0xd'),_0x597f0f,_0x389f8f['error']['message']);return _0x25a247(_0x389f8f[_0x7cfe('0x11')][_0x7cfe('0x13')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x597f0f,_0x389f8f[_0x7cfe('0x11')][_0x7cfe('0x13')]);return _0x1ad64e(_0x389f8f[_0x7cfe('0x11')][_0x7cfe('0x13')]);}else{logger['info'](_0x7cfe('0xd'),_0x597f0f,_0x7cfe('0xe'));_0x1ad64e(_0x389f8f[_0x7cfe('0x14')][_0x7cfe('0x13')]);}})[_0x7cfe('0x15')](function(_0x1c82db){logger[_0x7cfe('0x11')](_0x7cfe('0xd'),_0x597f0f,_0x1c82db);_0x25a247(_0x1c82db);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 86785ab..d3e69ad 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 _0xf466=['./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment'];(function(_0x15e0d2,_0x8333c){var _0x45bb73=function(_0x52cb41){while(--_0x52cb41){_0x15e0d2['push'](_0x15e0d2['shift']());}};_0x45bb73(++_0x8333c);}(_0xf466,0x19c));var _0x6f46=function(_0x6eff5b,_0x3976fa){_0x6eff5b=_0x6eff5b-0x0;var _0x40af9f=_0xf466[_0x6eff5b];return _0x40af9f;};'use strict';var multer=require(_0x6f46('0x0'));var util=require(_0x6f46('0x1'));var path=require(_0x6f46('0x2'));var timeout=require(_0x6f46('0x3'));var express=require(_0x6f46('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6f46('0x5'));var controller=require(_0x6f46('0x6'));router[_0x6f46('0x7')]('/',auth['isAuthenticated'](),controller[_0x6f46('0x8')]);router[_0x6f46('0x7')](_0x6f46('0x9'),auth[_0x6f46('0xa')](),controller[_0x6f46('0xb')]);router[_0x6f46('0x7')](_0x6f46('0xc'),auth['isAuthenticated'](),controller[_0x6f46('0xd')]);router['post']('/',auth[_0x6f46('0xa')](),controller[_0x6f46('0xe')]);router[_0x6f46('0xf')](_0x6f46('0xc'),auth['isAuthenticated'](),controller[_0x6f46('0x10')]);router['delete'](_0x6f46('0xc'),auth[_0x6f46('0xa')](),controller[_0x6f46('0x11')]);module[_0x6f46('0x12')]=router; \ No newline at end of file +var _0x2eef=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','update','exports'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0x2eef,0x187));var _0xf2ee=function(_0x38a703,_0x58a400){_0x38a703=_0x38a703-0x0;var _0x657177=_0x2eef[_0x38a703];return _0x657177;};'use strict';var multer=require(_0xf2ee('0x0'));var util=require('util');var path=require(_0xf2ee('0x1'));var timeout=require('connect-timeout');var express=require(_0xf2ee('0x2'));var router=express[_0xf2ee('0x3')]();var auth=require(_0xf2ee('0x4'));var interaction=require(_0xf2ee('0x5'));var config=require('../../config/environment');var controller=require(_0xf2ee('0x6'));router['get']('/',auth[_0xf2ee('0x7')](),controller['index']);router[_0xf2ee('0x8')](_0xf2ee('0x9'),auth[_0xf2ee('0x7')](),controller[_0xf2ee('0xa')]);router[_0xf2ee('0x8')](_0xf2ee('0xb'),auth[_0xf2ee('0x7')](),controller[_0xf2ee('0xc')]);router[_0xf2ee('0xd')]('/',auth[_0xf2ee('0x7')](),controller[_0xf2ee('0xe')]);router['put']('/:id',auth[_0xf2ee('0x7')](),controller[_0xf2ee('0xf')]);router['delete']('/:id',auth[_0xf2ee('0x7')](),controller['destroy']);module[_0xf2ee('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 5e0137a..b4b7197 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 _0xef74=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x35e25c,_0x301f23){var _0x5266c6=function(_0x2d4330){while(--_0x2d4330){_0x35e25c['push'](_0x35e25c['shift']());}};_0x5266c6(++_0x301f23);}(_0xef74,0x1ab));var _0x4ef7=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xef74[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0x4ef7('0x0'));module[_0x4ef7('0x1')]={'privilege':{'type':Sequelize[_0x4ef7('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4ef7('0x2')]},'calleridname':{'type':Sequelize[_0x4ef7('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4ef7('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4ef7('0x2')]},'accountcode':{'type':Sequelize[_0x4ef7('0x2')]},'context':{'type':Sequelize[_0x4ef7('0x2')]},'exten':{'type':Sequelize[_0x4ef7('0x2')]},'priority':{'type':Sequelize[_0x4ef7('0x3')]},'uniqueid':{'type':Sequelize[_0x4ef7('0x2')]},'linkedid':{'type':Sequelize[_0x4ef7('0x2')]},'destchannel':{'type':Sequelize[_0x4ef7('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4ef7('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4ef7('0x2')]},'destcalleridname':{'type':Sequelize[_0x4ef7('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4ef7('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4ef7('0x2')]},'destlanguage':{'type':Sequelize[_0x4ef7('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4ef7('0x2')]},'destexten':{'type':Sequelize[_0x4ef7('0x2')]},'destpriority':{'type':Sequelize[_0x4ef7('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x4ef7('0x2')]},'dialstring':{'type':Sequelize[_0x4ef7('0x2')]},'dialstatus':{'type':Sequelize[_0x4ef7('0x2')]},'starttime':{'type':Sequelize[_0x4ef7('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x4ef7('0x4')]},'lastevent':{'type':Sequelize[_0x4ef7('0x2')],'comment':_0x4ef7('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x4ef7('0x3')]}}; \ No newline at end of file +var _0x396f=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x9a29ea,_0x5b8b29){var _0x11f261=function(_0x397dea){while(--_0x397dea){_0x9a29ea['push'](_0x9a29ea['shift']());}};_0x11f261(++_0x5b8b29);}(_0x396f,0x80));var _0xf396=function(_0x2da05d,_0x2fcf57){_0x2da05d=_0x2da05d-0x0;var _0x5e6f08=_0x396f[_0x2da05d];return _0x5e6f08;};'use strict';var Sequelize=require(_0xf396('0x0'));module[_0xf396('0x1')]={'privilege':{'type':Sequelize[_0xf396('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf396('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf396('0x2')]},'calleridnum':{'type':Sequelize[_0xf396('0x2')]},'calleridname':{'type':Sequelize[_0xf396('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf396('0x2')]},'connectedlinename':{'type':Sequelize[_0xf396('0x2')]},'language':{'type':Sequelize[_0xf396('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf396('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xf396('0x2')]},'linkedid':{'type':Sequelize[_0xf396('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xf396('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xf396('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf396('0x2')]},'destcalleridname':{'type':Sequelize[_0xf396('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xf396('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf396('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xf396('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xf396('0x2')]},'destlinkedid':{'type':Sequelize[_0xf396('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf396('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xf396('0x4')]},'endtime':{'type':Sequelize[_0xf396('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xf396('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xf396('0x3')]},'holdtime':{'type':Sequelize[_0xf396('0x3')]},'billableseconds':{'type':Sequelize[_0xf396('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 35097a2..287be78 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 _0xa906=['params','rawAttributes','includeAll','find','create','body','describe','html-pdf','rimraf','request-promise','moment','util','path','to-csv','ejs','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','apply','reject','save','update','then','destroy','error','name','send','map','VoiceDialReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xa906,0x1e3));var _0x6a90=function(_0x2584a0,_0x128160){_0x2584a0=_0x2584a0-0x0;var _0x4b07c8=_0xa906[_0x2584a0];return _0x4b07c8;};'use strict';var pdf=require(_0x6a90('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6a90('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6a90('0x2'));var moment=require(_0x6a90('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6a90('0x4'));var path=require(_0x6a90('0x5'));var sox=require('sox');var csv=require(_0x6a90('0x6'));var ejs=require(_0x6a90('0x7'));var fs=require('fs');var _=require(_0x6a90('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6a90('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a90('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a90('0xb'));var qs=require(_0x6a90('0xc'));var as=require(_0x6a90('0xd'));var hardwareService=require(_0x6a90('0xe'));var logger=require(_0x6a90('0xf'))(_0x6a90('0x10'));var utils=require('../../config/utils');var config=require(_0x6a90('0x11'));var db=require(_0x6a90('0x12'))['db'];function respondWithStatusCode(_0x4ddfdb,_0x3ac580){_0x3ac580=_0x3ac580||0xcc;return function(_0x366a42){if(_0x366a42){return _0x4ddfdb[_0x6a90('0x13')](_0x3ac580);}return _0x4ddfdb['status'](_0x3ac580)[_0x6a90('0x14')]();};}function respondWithResult(_0x328b57,_0x39aec7){_0x39aec7=_0x39aec7||0xc8;return function(_0xa054b7){if(_0xa054b7){return _0x328b57[_0x6a90('0x15')](_0x39aec7)[_0x6a90('0x16')](_0xa054b7);}};}function respondWithFilteredResult(_0x1d5d77,_0x434c76){return function(_0x94a82c){if(_0x94a82c){var _0x5f433a=_0x94a82c[_0x6a90('0x17')],_0xf0c0ac=_0x434c76[_0x6a90('0x18')],_0x850e32=_0x434c76[_0x6a90('0x18')]+_0x434c76[_0x6a90('0x19')],_0x16b5da;if(_0x850e32>=_0x5f433a){_0x850e32=_0x5f433a;_0x16b5da=0xc8;}else{_0x16b5da=0xce;}_0x1d5d77[_0x6a90('0x15')](_0x16b5da);return _0x1d5d77['set']('Content-Range',_0xf0c0ac+'-'+_0x850e32+'/'+_0x5f433a)[_0x6a90('0x16')](_0x94a82c);}return null;};}function patchUpdates(_0x5b1da8){return function(_0x1ca66e){try{jsonpatch[_0x6a90('0x1a')](_0x1ca66e,_0x5b1da8,!![]);}catch(_0x554b16){return BPromise[_0x6a90('0x1b')](_0x554b16);}return _0x1ca66e[_0x6a90('0x1c')]();};}function saveUpdates(_0x5f1b2b,_0x3afcb9){return function(_0x27b489){if(_0x27b489){return _0x27b489[_0x6a90('0x1d')](_0x5f1b2b)[_0x6a90('0x1e')](function(_0x3b950c){return _0x3b950c;});}return null;};}function removeEntity(_0x2c471e,_0x186878){return function(_0x3236fe){if(_0x3236fe){return _0x3236fe[_0x6a90('0x1f')]()[_0x6a90('0x1e')](function(){_0x2c471e[_0x6a90('0x15')](0xcc)[_0x6a90('0x14')]();});}};}function handleEntityNotFound(_0x2339cd,_0x1bfdbc){return function(_0x16a86f){if(!_0x16a86f){_0x2339cd[_0x6a90('0x13')](0x194);}return _0x16a86f;};}function handleError(_0x2feda0,_0x1023ae){_0x1023ae=_0x1023ae||0x1f4;return function(_0x4cf74e){logger[_0x6a90('0x20')](_0x4cf74e['stack']);if(_0x4cf74e['name']){delete _0x4cf74e[_0x6a90('0x21')];}_0x2feda0[_0x6a90('0x15')](_0x1023ae)[_0x6a90('0x22')](_0x4cf74e);};}exports['index']=function(_0xedde7b,_0xa6679b){var _0x22c4da={},_0x54fbf5={},_0x4f120a={'count':0x0,'rows':[]};var _0x1a7318=_[_0x6a90('0x23')](db[_0x6a90('0x24')]['rawAttributes'],function(_0x3e908f){return{'name':_0x3e908f[_0x6a90('0x25')],'type':_0x3e908f[_0x6a90('0x26')][_0x6a90('0x27')]};});_0x54fbf5[_0x6a90('0x28')]=_['map'](_0x1a7318,'name');_0x54fbf5[_0x6a90('0x29')]=_[_0x6a90('0x2a')](_0xedde7b[_0x6a90('0x29')]);_0x54fbf5[_0x6a90('0x2b')]=_[_0x6a90('0x2c')](_0x54fbf5['model'],_0x54fbf5[_0x6a90('0x29')]);_0x22c4da[_0x6a90('0x2d')]=_[_0x6a90('0x2c')](_0x54fbf5['model'],qs[_0x6a90('0x2e')](_0xedde7b[_0x6a90('0x29')][_0x6a90('0x2e')]));_0x22c4da[_0x6a90('0x2d')]=_0x22c4da[_0x6a90('0x2d')][_0x6a90('0x2f')]?_0x22c4da[_0x6a90('0x2d')]:_0x54fbf5['model'];if(!_0xedde7b[_0x6a90('0x29')][_0x6a90('0x30')]('nolimit')){_0x22c4da['limit']=qs[_0x6a90('0x19')](_0xedde7b['query']['limit']);_0x22c4da['offset']=qs[_0x6a90('0x18')](_0xedde7b[_0x6a90('0x29')]['offset']);}_0x22c4da['order']=qs[_0x6a90('0x31')](_0xedde7b[_0x6a90('0x29')][_0x6a90('0x31')]);_0x22c4da[_0x6a90('0x32')]=qs['filters'](_[_0x6a90('0x33')](_0xedde7b[_0x6a90('0x29')],_0x54fbf5[_0x6a90('0x2b')]),_0x1a7318);if(_0xedde7b[_0x6a90('0x29')][_0x6a90('0x34')]){_0x22c4da['where']=_[_0x6a90('0x35')](_0x22c4da[_0x6a90('0x32')],{'$or':_[_0x6a90('0x23')](_0x1a7318,function(_0x47da67){if(_0x47da67[_0x6a90('0x26')]!==_0x6a90('0x36')){var _0x4bbcad={};_0x4bbcad[_0x47da67[_0x6a90('0x21')]]={'$like':'%'+_0xedde7b[_0x6a90('0x29')][_0x6a90('0x34')]+'%'};return _0x4bbcad;}})});}_0x22c4da=_[_0x6a90('0x35')]({},_0x22c4da,_0xedde7b[_0x6a90('0x37')]);var _0x2aa8ed={'where':_0x22c4da[_0x6a90('0x32')]};return db[_0x6a90('0x24')][_0x6a90('0x17')](_0x2aa8ed)[_0x6a90('0x1e')](function(_0x30c884){_0x4f120a[_0x6a90('0x17')]=_0x30c884;if(_0xedde7b[_0x6a90('0x29')]['includeAll']){_0x22c4da[_0x6a90('0x38')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x6a90('0x39')](_0x22c4da);})[_0x6a90('0x1e')](function(_0x5d6bbc){_0x4f120a[_0x6a90('0x3a')]=_0x5d6bbc;return _0x4f120a;})['then'](respondWithFilteredResult(_0xa6679b,_0x22c4da))[_0x6a90('0x3b')](handleError(_0xa6679b,null));};exports[_0x6a90('0x3c')]=function(_0x3865c3,_0x3b255e){var _0x53424e={'raw':!![],'where':{'id':_0x3865c3[_0x6a90('0x3d')]['id']}},_0x4a5e5e={};_0x4a5e5e['model']=_['keys'](db[_0x6a90('0x24')][_0x6a90('0x3e')]);_0x4a5e5e[_0x6a90('0x29')]=_[_0x6a90('0x2a')](_0x3865c3[_0x6a90('0x29')]);_0x4a5e5e[_0x6a90('0x2b')]=_[_0x6a90('0x2c')](_0x4a5e5e[_0x6a90('0x28')],_0x4a5e5e[_0x6a90('0x29')]);_0x53424e[_0x6a90('0x2d')]=_[_0x6a90('0x2c')](_0x4a5e5e[_0x6a90('0x28')],qs[_0x6a90('0x2e')](_0x3865c3['query']['fields']));_0x53424e[_0x6a90('0x2d')]=_0x53424e[_0x6a90('0x2d')][_0x6a90('0x2f')]?_0x53424e['attributes']:_0x4a5e5e[_0x6a90('0x28')];if(_0x3865c3[_0x6a90('0x29')][_0x6a90('0x3f')]){_0x53424e[_0x6a90('0x38')]=[{'all':!![]}];}_0x53424e=_[_0x6a90('0x35')]({},_0x53424e,_0x3865c3['options']);return db[_0x6a90('0x24')][_0x6a90('0x40')](_0x53424e)[_0x6a90('0x1e')](handleEntityNotFound(_0x3b255e,null))[_0x6a90('0x1e')](respondWithResult(_0x3b255e,null))[_0x6a90('0x3b')](handleError(_0x3b255e,null));};exports[_0x6a90('0x41')]=function(_0x1b9079,_0x4f8f02){return db['VoiceDialReport']['create'](_0x1b9079[_0x6a90('0x42')],{})[_0x6a90('0x1e')](respondWithResult(_0x4f8f02,0xc9))[_0x6a90('0x3b')](handleError(_0x4f8f02,null));};exports[_0x6a90('0x1d')]=function(_0x585a44,_0x173b43){if(_0x585a44[_0x6a90('0x42')]['id']){delete _0x585a44[_0x6a90('0x42')]['id'];}return db['VoiceDialReport'][_0x6a90('0x40')]({'where':{'id':_0x585a44[_0x6a90('0x3d')]['id']}})['then'](handleEntityNotFound(_0x173b43,null))[_0x6a90('0x1e')](saveUpdates(_0x585a44[_0x6a90('0x42')],null))[_0x6a90('0x1e')](respondWithResult(_0x173b43,null))['catch'](handleError(_0x173b43,null));};exports[_0x6a90('0x1f')]=function(_0x362e74,_0x28c430){return db[_0x6a90('0x24')][_0x6a90('0x40')]({'where':{'id':_0x362e74[_0x6a90('0x3d')]['id']}})[_0x6a90('0x1e')](handleEntityNotFound(_0x28c430,null))[_0x6a90('0x1e')](removeEntity(_0x28c430,null))['catch'](handleError(_0x28c430,null));};exports[_0x6a90('0x43')]=function(_0x31a4e7,_0x3a4300){return db[_0x6a90('0x24')][_0x6a90('0x43')]()['then'](respondWithResult(_0x3a4300,null))['catch'](handleError(_0x3a4300,null));}; \ No newline at end of file +var _0x98a7=['findAll','catch','show','params','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','save','update','then','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','VoiceDialReport','count','includeAll','include'];(function(_0x4bcfa6,_0x1c7e43){var _0x1c0165=function(_0x30c963){while(--_0x30c963){_0x4bcfa6['push'](_0x4bcfa6['shift']());}};_0x1c0165(++_0x1c7e43);}(_0x98a7,0x9e));var _0x798a=function(_0x430dd8,_0x31875e){_0x430dd8=_0x430dd8-0x0;var _0x3b4ef3=_0x98a7[_0x430dd8];return _0x3b4ef3;};'use strict';var pdf=require(_0x798a('0x0'));var emlformat=require(_0x798a('0x1'));var rimraf=require(_0x798a('0x2'));var zipdir=require(_0x798a('0x3'));var jsonpatch=require(_0x798a('0x4'));var rp=require(_0x798a('0x5'));var moment=require(_0x798a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x798a('0x7'));var util=require(_0x798a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x798a('0x9'));var ejs=require(_0x798a('0xa'));var fs=require('fs');var _=require(_0x798a('0xb'));var squel=require(_0x798a('0xc'));var crypto=require(_0x798a('0xd'));var jsforce=require(_0x798a('0xe'));var deskjs=require(_0x798a('0xf'));var toCsv=require(_0x798a('0x9'));var querystring=require('querystring');var Papa=require(_0x798a('0x10'));var Redis=require(_0x798a('0x11'));var authService=require(_0x798a('0x12'));var qs=require(_0x798a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x798a('0x14'));var logger=require(_0x798a('0x15'))(_0x798a('0x16'));var utils=require(_0x798a('0x17'));var config=require(_0x798a('0x18'));var db=require(_0x798a('0x19'))['db'];function respondWithStatusCode(_0x578398,_0x261b1f){_0x261b1f=_0x261b1f||0xcc;return function(_0x526bd0){if(_0x526bd0){return _0x578398[_0x798a('0x1a')](_0x261b1f);}return _0x578398[_0x798a('0x1b')](_0x261b1f)['end']();};}function respondWithResult(_0x1cb92b,_0x3f96f6){_0x3f96f6=_0x3f96f6||0xc8;return function(_0x5b60ba){if(_0x5b60ba){return _0x1cb92b[_0x798a('0x1b')](_0x3f96f6)['json'](_0x5b60ba);}};}function respondWithFilteredResult(_0xf12a1,_0x1746d2){return function(_0x34bfdb){if(_0x34bfdb){var _0x1f5156=_0x34bfdb['count'],_0x560366=_0x1746d2[_0x798a('0x1c')],_0x1f8329=_0x1746d2[_0x798a('0x1c')]+_0x1746d2[_0x798a('0x1d')],_0x26b43a;if(_0x1f8329>=_0x1f5156){_0x1f8329=_0x1f5156;_0x26b43a=0xc8;}else{_0x26b43a=0xce;}_0xf12a1[_0x798a('0x1b')](_0x26b43a);return _0xf12a1[_0x798a('0x1e')](_0x798a('0x1f'),_0x560366+'-'+_0x1f8329+'/'+_0x1f5156)[_0x798a('0x20')](_0x34bfdb);}return null;};}function patchUpdates(_0x114d59){return function(_0x16c4f3){try{jsonpatch[_0x798a('0x21')](_0x16c4f3,_0x114d59,!![]);}catch(_0x429c4d){return BPromise['reject'](_0x429c4d);}return _0x16c4f3[_0x798a('0x22')]();};}function saveUpdates(_0x9840cc,_0x145295){return function(_0x4715e7){if(_0x4715e7){return _0x4715e7[_0x798a('0x23')](_0x9840cc)[_0x798a('0x24')](function(_0x318d41){return _0x318d41;});}return null;};}function removeEntity(_0xea094d,_0x23e327){return function(_0x2b103c){if(_0x2b103c){return _0x2b103c['destroy']()['then'](function(){_0xea094d[_0x798a('0x1b')](0xcc)[_0x798a('0x25')]();});}};}function handleEntityNotFound(_0x2bdfd7,_0x54d725){return function(_0x1c08ac){if(!_0x1c08ac){_0x2bdfd7[_0x798a('0x1a')](0x194);}return _0x1c08ac;};}function handleError(_0x3310e0,_0x5465b3){_0x5465b3=_0x5465b3||0x1f4;return function(_0x3ff7dc){logger['error'](_0x3ff7dc['stack']);if(_0x3ff7dc[_0x798a('0x26')]){delete _0x3ff7dc[_0x798a('0x26')];}_0x3310e0['status'](_0x5465b3)[_0x798a('0x27')](_0x3ff7dc);};}exports[_0x798a('0x28')]=function(_0x41a040,_0x2bef37){var _0x4c11fa={},_0x3eeb44={},_0xf28bbf={'count':0x0,'rows':[]};var _0x288e96=_[_0x798a('0x29')](db['VoiceDialReport'][_0x798a('0x2a')],function(_0x4674f6){return{'name':_0x4674f6[_0x798a('0x2b')],'type':_0x4674f6[_0x798a('0x2c')][_0x798a('0x2d')]};});_0x3eeb44[_0x798a('0x2e')]=_[_0x798a('0x29')](_0x288e96,'name');_0x3eeb44[_0x798a('0x2f')]=_[_0x798a('0x30')](_0x41a040[_0x798a('0x2f')]);_0x3eeb44['filters']=_[_0x798a('0x31')](_0x3eeb44[_0x798a('0x2e')],_0x3eeb44['query']);_0x4c11fa['attributes']=_[_0x798a('0x31')](_0x3eeb44['model'],qs['fields'](_0x41a040[_0x798a('0x2f')][_0x798a('0x32')]));_0x4c11fa['attributes']=_0x4c11fa[_0x798a('0x33')][_0x798a('0x34')]?_0x4c11fa[_0x798a('0x33')]:_0x3eeb44['model'];if(!_0x41a040[_0x798a('0x2f')][_0x798a('0x35')](_0x798a('0x36'))){_0x4c11fa[_0x798a('0x1d')]=qs['limit'](_0x41a040[_0x798a('0x2f')][_0x798a('0x1d')]);_0x4c11fa[_0x798a('0x1c')]=qs['offset'](_0x41a040['query'][_0x798a('0x1c')]);}_0x4c11fa['order']=qs[_0x798a('0x37')](_0x41a040[_0x798a('0x2f')]['sort']);_0x4c11fa[_0x798a('0x38')]=qs[_0x798a('0x39')](_[_0x798a('0x3a')](_0x41a040[_0x798a('0x2f')],_0x3eeb44['filters']),_0x288e96);if(_0x41a040[_0x798a('0x2f')][_0x798a('0x3b')]){_0x4c11fa[_0x798a('0x38')]=_['merge'](_0x4c11fa[_0x798a('0x38')],{'$or':_[_0x798a('0x29')](_0x288e96,function(_0x61e5ad){if(_0x61e5ad[_0x798a('0x2c')]!==_0x798a('0x3c')){var _0x12e98f={};_0x12e98f[_0x61e5ad['name']]={'$like':'%'+_0x41a040['query']['filter']+'%'};return _0x12e98f;}})});}_0x4c11fa=_[_0x798a('0x3d')]({},_0x4c11fa,_0x41a040[_0x798a('0x3e')]);var _0x5d20b5={'where':_0x4c11fa[_0x798a('0x38')]};return db[_0x798a('0x3f')]['count'](_0x5d20b5)[_0x798a('0x24')](function(_0x55c978){_0xf28bbf[_0x798a('0x40')]=_0x55c978;if(_0x41a040[_0x798a('0x2f')][_0x798a('0x41')]){_0x4c11fa[_0x798a('0x42')]=[{'all':!![]}];}return db[_0x798a('0x3f')][_0x798a('0x43')](_0x4c11fa);})['then'](function(_0x352ce4){_0xf28bbf['rows']=_0x352ce4;return _0xf28bbf;})['then'](respondWithFilteredResult(_0x2bef37,_0x4c11fa))[_0x798a('0x44')](handleError(_0x2bef37,null));};exports[_0x798a('0x45')]=function(_0x26e4c8,_0x531bb3){var _0x23c363={'raw':!![],'where':{'id':_0x26e4c8[_0x798a('0x46')]['id']}},_0x4e51f9={};_0x4e51f9[_0x798a('0x2e')]=_[_0x798a('0x30')](db[_0x798a('0x3f')][_0x798a('0x2a')]);_0x4e51f9[_0x798a('0x2f')]=_[_0x798a('0x30')](_0x26e4c8[_0x798a('0x2f')]);_0x4e51f9[_0x798a('0x39')]=_[_0x798a('0x31')](_0x4e51f9['model'],_0x4e51f9[_0x798a('0x2f')]);_0x23c363[_0x798a('0x33')]=_[_0x798a('0x31')](_0x4e51f9[_0x798a('0x2e')],qs[_0x798a('0x32')](_0x26e4c8[_0x798a('0x2f')][_0x798a('0x32')]));_0x23c363['attributes']=_0x23c363[_0x798a('0x33')][_0x798a('0x34')]?_0x23c363[_0x798a('0x33')]:_0x4e51f9[_0x798a('0x2e')];if(_0x26e4c8['query'][_0x798a('0x41')]){_0x23c363[_0x798a('0x42')]=[{'all':!![]}];}_0x23c363=_[_0x798a('0x3d')]({},_0x23c363,_0x26e4c8[_0x798a('0x3e')]);return db['VoiceDialReport']['find'](_0x23c363)[_0x798a('0x24')](handleEntityNotFound(_0x531bb3,null))[_0x798a('0x24')](respondWithResult(_0x531bb3,null))['catch'](handleError(_0x531bb3,null));};exports[_0x798a('0x47')]=function(_0xd9cb82,_0xa11857){return db[_0x798a('0x3f')][_0x798a('0x47')](_0xd9cb82[_0x798a('0x48')],{})['then'](respondWithResult(_0xa11857,0xc9))['catch'](handleError(_0xa11857,null));};exports[_0x798a('0x23')]=function(_0x1a6d60,_0x1928c7){if(_0x1a6d60['body']['id']){delete _0x1a6d60[_0x798a('0x48')]['id'];}return db[_0x798a('0x3f')][_0x798a('0x49')]({'where':{'id':_0x1a6d60[_0x798a('0x46')]['id']}})['then'](handleEntityNotFound(_0x1928c7,null))['then'](saveUpdates(_0x1a6d60[_0x798a('0x48')],null))[_0x798a('0x24')](respondWithResult(_0x1928c7,null))['catch'](handleError(_0x1928c7,null));};exports['destroy']=function(_0x3214f7,_0x386077){return db[_0x798a('0x3f')][_0x798a('0x49')]({'where':{'id':_0x3214f7[_0x798a('0x46')]['id']}})['then'](handleEntityNotFound(_0x386077,null))['then'](removeEntity(_0x386077,null))[_0x798a('0x44')](handleError(_0x386077,null));};exports[_0x798a('0x4a')]=function(_0x1aa95c,_0x577c30){return db[_0x798a('0x3f')][_0x798a('0x4a')]()[_0x798a('0x24')](respondWithResult(_0x577c30,null))['catch'](handleError(_0x577c30,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 7c69fdd..198b4c2 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 _0x08bb=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial'];(function(_0x36ee8b,_0x471b03){var _0x53cced=function(_0x5c93b8){while(--_0x5c93b8){_0x36ee8b['push'](_0x36ee8b['shift']());}};_0x53cced(++_0x471b03);}(_0x08bb,0x1f0));var _0xb08b=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x08bb[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0xb08b('0x0'));var util=require(_0xb08b('0x1'));var logger=require(_0xb08b('0x2'))('api');var moment=require(_0xb08b('0x3'));var BPromise=require(_0xb08b('0x4'));var rp=require(_0xb08b('0x5'));var fs=require('fs');var path=require(_0xb08b('0x6'));var rimraf=require(_0xb08b('0x7'));var config=require(_0xb08b('0x8'));var attributes=require(_0xb08b('0x9'));module[_0xb08b('0xa')]=function(_0x5530bd,_0x5a05f9){return _0x5530bd[_0xb08b('0xb')](_0xb08b('0xc'),attributes,{'tableName':_0xb08b('0xd'),'paranoid':![],'indexes':[{'fields':[_0xb08b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9313=['define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceDialReport.attributes','exports'];(function(_0x4f66b3,_0x58142b){var _0x250718=function(_0x16cd76){while(--_0x16cd76){_0x4f66b3['push'](_0x4f66b3['shift']());}};_0x250718(++_0x58142b);}(_0x9313,0x1e0));var _0x3931=function(_0x57072f,_0x3c53d3){_0x57072f=_0x57072f-0x0;var _0x451029=_0x9313[_0x57072f];return _0x451029;};'use strict';var _=require(_0x3931('0x0'));var util=require(_0x3931('0x1'));var logger=require(_0x3931('0x2'))(_0x3931('0x3'));var moment=require(_0x3931('0x4'));var BPromise=require('bluebird');var rp=require(_0x3931('0x5'));var fs=require('fs');var path=require(_0x3931('0x6'));var rimraf=require(_0x3931('0x7'));var config=require('../../config/environment');var attributes=require(_0x3931('0x8'));module[_0x3931('0x9')]=function(_0x3cb3a3,_0x393c8e){return _0x3cb3a3[_0x3931('0xa')](_0x3931('0xb'),attributes,{'tableName':_0x3931('0xc'),'paranoid':![],'indexes':[{'fields':[_0x3931('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 46a52c8..cd609e9 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 _0xec56=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','update','UpdateVoiceDialReport','lodash','bluebird','randomstring'];(function(_0x1038c3,_0xc50eed){var _0x51b261=function(_0x165517){while(--_0x165517){_0x1038c3['push'](_0x1038c3['shift']());}};_0x51b261(++_0xc50eed);}(_0xec56,0x1bd));var _0x6ec5=function(_0x481297,_0x455503){_0x481297=_0x481297-0x0;var _0x47b80e=_0xec56[_0x481297];return _0x47b80e;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ec5('0x1'));var rs=require(_0x6ec5('0x2'));var fs=require('fs');var Redis=require(_0x6ec5('0x3'));var db=require(_0x6ec5('0x4'))['db'];var utils=require(_0x6ec5('0x5'));var logger=require(_0x6ec5('0x6'))(_0x6ec5('0x7'));var config=require(_0x6ec5('0x8'));var jayson=require(_0x6ec5('0x9'));var client=jayson[_0x6ec5('0xa')][_0x6ec5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb683,_0x35be4e,_0x1f59cd){return new BPromise(function(_0x3dd891,_0x225d2f){return client[_0x6ec5('0xc')](_0x3bb683,_0x1f59cd)[_0x6ec5('0xd')](function(_0x3ff17c){logger['info'](_0x6ec5('0xe'),_0x35be4e,_0x6ec5('0xf'));logger[_0x6ec5('0x10')](_0x6ec5('0x11'),_0x35be4e,_0x6ec5('0xf'),JSON[_0x6ec5('0x12')](_0x3ff17c));if(_0x3ff17c[_0x6ec5('0x13')]){if(_0x3ff17c['error'][_0x6ec5('0x14')]===0x1f4){logger[_0x6ec5('0x13')](_0x6ec5('0xe'),_0x35be4e,_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);return _0x225d2f(_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);}logger[_0x6ec5('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x35be4e,_0x3ff17c[_0x6ec5('0x13')]['message']);return _0x3dd891(_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);}else{logger[_0x6ec5('0x16')](_0x6ec5('0xe'),_0x35be4e,_0x6ec5('0xf'));_0x3dd891(_0x3ff17c['result'][_0x6ec5('0x15')]);}})[_0x6ec5('0x17')](function(_0x125ae6){logger[_0x6ec5('0x13')](_0x6ec5('0xe'),_0x35be4e,_0x125ae6);_0x225d2f(_0x125ae6);});});}exports[_0x6ec5('0x18')]=function(_0x1dbee9){var _0x4237bc=this;return new Promise(function(_0x2608c0,_0x3d5d45){return db[_0x6ec5('0x19')][_0x6ec5('0x1a')](_0x1dbee9[_0x6ec5('0x1b')],{'raw':_0x1dbee9[_0x6ec5('0x1c')]?_0x1dbee9[_0x6ec5('0x1c')][_0x6ec5('0x1d')]===undefined?!![]:![]:!![]})[_0x6ec5('0xd')](function(_0x4abd5d){logger[_0x6ec5('0x16')](_0x6ec5('0x18'),_0x1dbee9);logger[_0x6ec5('0x10')](_0x6ec5('0x18'),_0x1dbee9,JSON[_0x6ec5('0x12')](_0x4abd5d));_0x2608c0(_0x4abd5d);})[_0x6ec5('0x17')](function(_0x18243f){logger['error'](_0x6ec5('0x18'),_0x18243f[_0x6ec5('0x15')],_0x1dbee9);_0x3d5d45(_0x4237bc[_0x6ec5('0x13')](0x1f4,_0x18243f[_0x6ec5('0x15')]));});});};exports['UpdateVoiceDialReport']=function(_0x27f631){var _0x280748=this;return new Promise(function(_0x5be80f,_0x2dc0a7){return db[_0x6ec5('0x19')][_0x6ec5('0x1e')](_0x27f631['body'],{'raw':_0x27f631[_0x6ec5('0x1c')]?_0x27f631[_0x6ec5('0x1c')][_0x6ec5('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27f631[_0x6ec5('0x1c')]?_0x27f631[_0x6ec5('0x1c')]['where']||null:null,'attributes':_0x27f631[_0x6ec5('0x1c')]?_0x27f631[_0x6ec5('0x1c')]['attributes']||null:null,'limit':_0x27f631[_0x6ec5('0x1c')]?_0x27f631[_0x6ec5('0x1c')]['limit']||null:null})[_0x6ec5('0xd')](function(_0x3229db){logger[_0x6ec5('0x16')](_0x6ec5('0x1f'),_0x27f631);logger[_0x6ec5('0x10')]('UpdateVoiceDialReport',_0x27f631,JSON[_0x6ec5('0x12')](_0x3229db));_0x5be80f(_0x3229db);})[_0x6ec5('0x17')](function(_0x24aff9){logger[_0x6ec5('0x13')](_0x6ec5('0x1f'),_0x24aff9[_0x6ec5('0x15')],_0x27f631);_0x2dc0a7(_0x280748[_0x6ec5('0x13')](0x1f4,_0x24aff9['message']));});});}; \ No newline at end of file +var _0xdeb3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','stringify','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment'];(function(_0xfe86b4,_0x238152){var _0x3b3c53=function(_0x4b7b06){while(--_0x4b7b06){_0xfe86b4['push'](_0xfe86b4['shift']());}};_0x3b3c53(++_0x238152);}(_0xdeb3,0xeb));var _0x3deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb3[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x3deb('0x0'));var util=require(_0x3deb('0x1'));var moment=require(_0x3deb('0x2'));var BPromise=require(_0x3deb('0x3'));var rs=require(_0x3deb('0x4'));var fs=require('fs');var Redis=require(_0x3deb('0x5'));var db=require(_0x3deb('0x6'))['db'];var utils=require(_0x3deb('0x7'));var logger=require(_0x3deb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3deb('0x9')][_0x3deb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c8e43,_0x14846f,_0xcaaef7){return new BPromise(function(_0x5ecf47,_0x571adc){return client[_0x3deb('0xb')](_0x3c8e43,_0xcaaef7)[_0x3deb('0xc')](function(_0x30bb01){logger[_0x3deb('0xd')](_0x3deb('0xe'),_0x14846f,_0x3deb('0xf'));logger[_0x3deb('0x10')](_0x3deb('0x11'),_0x14846f,'request\x20sent',JSON['stringify'](_0x30bb01));if(_0x30bb01['error']){if(_0x30bb01[_0x3deb('0x12')]['code']===0x1f4){logger[_0x3deb('0x12')](_0x3deb('0xe'),_0x14846f,_0x30bb01[_0x3deb('0x12')][_0x3deb('0x13')]);return _0x571adc(_0x30bb01['error'][_0x3deb('0x13')]);}logger[_0x3deb('0x12')](_0x3deb('0xe'),_0x14846f,_0x30bb01[_0x3deb('0x12')][_0x3deb('0x13')]);return _0x5ecf47(_0x30bb01[_0x3deb('0x12')][_0x3deb('0x13')]);}else{logger[_0x3deb('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x14846f,_0x3deb('0xf'));_0x5ecf47(_0x30bb01[_0x3deb('0x14')]['message']);}})[_0x3deb('0x15')](function(_0x35923e){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x14846f,_0x35923e);_0x571adc(_0x35923e);});});}exports['CreateVoiceDialReport']=function(_0x2a8ec4){var _0x2d8263=this;return new Promise(function(_0x4adbaa,_0x51e2b1){return db[_0x3deb('0x16')][_0x3deb('0x17')](_0x2a8ec4[_0x3deb('0x18')],{'raw':_0x2a8ec4[_0x3deb('0x19')]?_0x2a8ec4['options'][_0x3deb('0x1a')]===undefined?!![]:![]:!![]})[_0x3deb('0xc')](function(_0xbd82de){logger['info'](_0x3deb('0x1b'),_0x2a8ec4);logger[_0x3deb('0x10')](_0x3deb('0x1b'),_0x2a8ec4,JSON[_0x3deb('0x1c')](_0xbd82de));_0x4adbaa(_0xbd82de);})[_0x3deb('0x15')](function(_0x543014){logger[_0x3deb('0x12')](_0x3deb('0x1b'),_0x543014[_0x3deb('0x13')],_0x2a8ec4);_0x51e2b1(_0x2d8263[_0x3deb('0x12')](0x1f4,_0x543014[_0x3deb('0x13')]));});});};exports[_0x3deb('0x1d')]=function(_0x3f3d52){var _0x451ce6=this;return new Promise(function(_0x4de8ed,_0xd42d62){return db[_0x3deb('0x16')][_0x3deb('0x1e')](_0x3f3d52[_0x3deb('0x18')],{'raw':_0x3f3d52[_0x3deb('0x19')]?_0x3f3d52['options'][_0x3deb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f3d52[_0x3deb('0x19')]?_0x3f3d52[_0x3deb('0x19')][_0x3deb('0x1f')]||null:null,'attributes':_0x3f3d52[_0x3deb('0x19')]?_0x3f3d52[_0x3deb('0x19')][_0x3deb('0x20')]||null:null,'limit':_0x3f3d52['options']?_0x3f3d52['options'][_0x3deb('0x21')]||null:null})['then'](function(_0x2efb59){logger[_0x3deb('0xd')](_0x3deb('0x1d'),_0x3f3d52);logger['debug'](_0x3deb('0x1d'),_0x3f3d52,JSON['stringify'](_0x2efb59));_0x4de8ed(_0x2efb59);})['catch'](function(_0x14ffa1){logger[_0x3deb('0x12')](_0x3deb('0x1d'),_0x14ffa1[_0x3deb('0x13')],_0x3f3d52);_0xd42d62(_0x451ce6['error'](0x1f4,_0x14ffa1['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index cb016c1..7146521 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 _0xb419=['/:id','show','post','/:id/applications','put','update','delete','destroy','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb419,0x6e));var _0x9b41=function(_0x16b27f,_0x40db62){_0x16b27f=_0x16b27f-0x0;var _0x1177e1=_0xb419[_0x16b27f];return _0x1177e1;};'use strict';var multer=require('multer');var util=require(_0x9b41('0x0'));var path=require(_0x9b41('0x1'));var timeout=require('connect-timeout');var express=require(_0x9b41('0x2'));var router=express[_0x9b41('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9b41('0x4'));var config=require(_0x9b41('0x5'));var controller=require('./voiceExtension.controller');router[_0x9b41('0x6')]('/',auth[_0x9b41('0x7')](),controller[_0x9b41('0x8')]);router['get'](_0x9b41('0x9'),auth[_0x9b41('0x7')](),controller[_0x9b41('0xa')]);router[_0x9b41('0xb')]('/',auth[_0x9b41('0x7')](),controller['create']);router[_0x9b41('0xb')](_0x9b41('0xc'),auth['isAuthenticated'](),controller['addApplications']);router[_0x9b41('0xd')]('/:id',auth[_0x9b41('0x7')](),controller[_0x9b41('0xe')]);router[_0x9b41('0xf')](_0x9b41('0x9'),auth[_0x9b41('0x7')](),controller[_0x9b41('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5b43=['../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','isAuthenticated','index','get','post','create','/:id/applications','addApplications','put','update','delete','/:id','destroy','exports','util','connect-timeout','express'];(function(_0x2ed19f,_0x25786e){var _0x2f7f8a=function(_0x162e0d){while(--_0x162e0d){_0x2ed19f['push'](_0x2ed19f['shift']());}};_0x2f7f8a(++_0x25786e);}(_0x5b43,0x11a));var _0x35b4=function(_0x324a5c,_0x3ab147){_0x324a5c=_0x324a5c-0x0;var _0x161e86=_0x5b43[_0x324a5c];return _0x161e86;};'use strict';var multer=require('multer');var util=require(_0x35b4('0x0'));var path=require('path');var timeout=require(_0x35b4('0x1'));var express=require(_0x35b4('0x2'));var router=express['Router']();var auth=require(_0x35b4('0x3'));var interaction=require(_0x35b4('0x4'));var config=require('../../config/environment');var controller=require(_0x35b4('0x5'));router['get']('/',auth[_0x35b4('0x6')](),controller[_0x35b4('0x7')]);router[_0x35b4('0x8')]('/:id',auth[_0x35b4('0x6')](),controller['show']);router[_0x35b4('0x9')]('/',auth[_0x35b4('0x6')](),controller[_0x35b4('0xa')]);router[_0x35b4('0x9')](_0x35b4('0xb'),auth[_0x35b4('0x6')](),controller[_0x35b4('0xc')]);router[_0x35b4('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x35b4('0xe')]);router[_0x35b4('0xf')](_0x35b4('0x10'),auth[_0x35b4('0x6')](),controller[_0x35b4('0x11')]);module[_0x35b4('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 5de3a28..917eaaf 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(_0x5aa7dc,_0xac2340){var _0x5c8cfa=function(_0x1161b8){while(--_0x1161b8){_0x5aa7dc['push'](_0x5aa7dc['shift']());}};_0x5c8cfa(++_0xac2340);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0x38b9b1,_0x49d83a){var _0x53714a=function(_0x563a49){while(--_0x563a49){_0x38b9b1['push'](_0x38b9b1['shift']());}};_0x53714a(++_0x49d83a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 cf421df..b1e4f60 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 _0x1a85=['../../config/license/hardware','../../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','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','UserProfileResource','stack','name','send','VoiceExtension','rawAttributes','fieldName','keys','filters','intersection','model','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','fields','params','create','body','outbound','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','mandatoryDisposition','addApplications','VoiceExtensionId','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'];(function(_0x5cf964,_0x3f16fd){var _0x34bcb7=function(_0x3a1c78){while(--_0x3a1c78){_0x5cf964['push'](_0x5cf964['shift']());}};_0x34bcb7(++_0x3f16fd);}(_0x1a85,0x178));var _0x51a8=function(_0x5b964b,_0xe2062a){_0x5b964b=_0x5b964b-0x0;var _0x2f187d=_0x1a85[_0x5b964b];return _0x2f187d;};'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('./voiceExtension.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=[{'name':_0x51a8('0x28'),'value':_0x51a8('0x29'),'ignore':![]},{'name':_0x51a8('0x2a'),'value':'outbound','ignore':![]},{'name':_0x51a8('0x2b'),'value':_0x51a8('0x2c'),'ignore':![]}];var _0xca5746=_(_0x157554)[_0x51a8('0x2d')](_0x51a8('0x2e'))[_0x51a8('0x2f')](_0x51a8('0x30'))[_0x51a8('0x30')]();if(_[_0x51a8('0x31')](_0xca5746,_0x20ef8b[_0x51a8('0x32')])){return;}var _0x20c6b5=_[_0x51a8('0x33')](_0x157554,['value',_0x20ef8b[_0x51a8('0x32')]])['name'];return db[_0x51a8('0x34')][_0x51a8('0x26')]({'where':{'type':_0x20c6b5,'resourceId':_0x20ef8b['id']}})[_0x51a8('0x25')](function(){return _0x52e503;});})[_0x51a8('0x25')](function(){_0x47f063[_0x51a8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10c19b,_0x4c67ff){return function(_0x41c4de){if(!_0x41c4de){_0x10c19b[_0x51a8('0x1b')](0x194);}return _0x41c4de;};}function handleError(_0x253a59,_0x4b19c8){_0x4b19c8=_0x4b19c8||0x1f4;return function(_0x2080a1){logger['error'](_0x2080a1[_0x51a8('0x35')]);if(_0x2080a1[_0x51a8('0x36')]){delete _0x2080a1[_0x51a8('0x36')];}_0x253a59[_0x51a8('0x1d')](_0x4b19c8)[_0x51a8('0x37')](_0x2080a1);};}exports['index']=function(_0x1167b8,_0x53b3b6){var _0x9f0e6={},_0x2d977b={},_0x41561a={'count':0x0,'rows':[]};var _0x578fc6=_[_0x51a8('0x2f')](db[_0x51a8('0x38')][_0x51a8('0x39')],function(_0x2429f8){return{'name':_0x2429f8[_0x51a8('0x3a')],'type':_0x2429f8['type']['key']};});_0x2d977b['model']=_[_0x51a8('0x2f')](_0x578fc6,_0x51a8('0x36'));_0x2d977b['query']=_[_0x51a8('0x3b')](_0x1167b8['query']);_0x2d977b[_0x51a8('0x3c')]=_[_0x51a8('0x3d')](_0x2d977b[_0x51a8('0x3e')],_0x2d977b[_0x51a8('0x3f')]);_0x9f0e6[_0x51a8('0x40')]=_[_0x51a8('0x3d')](_0x2d977b['model'],qs['fields'](_0x1167b8[_0x51a8('0x3f')]['fields']));_0x9f0e6['attributes']=_0x9f0e6['attributes'][_0x51a8('0x41')]?_0x9f0e6[_0x51a8('0x40')]:_0x2d977b[_0x51a8('0x3e')];if(!_0x1167b8['query'][_0x51a8('0x42')](_0x51a8('0x43'))){_0x9f0e6[_0x51a8('0x21')]=qs[_0x51a8('0x21')](_0x1167b8['query'][_0x51a8('0x21')]);_0x9f0e6[_0x51a8('0x20')]=qs[_0x51a8('0x20')](_0x1167b8['query'][_0x51a8('0x20')]);}_0x9f0e6['order']=qs[_0x51a8('0x44')](_0x1167b8[_0x51a8('0x3f')][_0x51a8('0x44')]);_0x9f0e6[_0x51a8('0x45')]=qs['filters'](_[_0x51a8('0x46')](_0x1167b8[_0x51a8('0x3f')],_0x2d977b[_0x51a8('0x3c')]),_0x578fc6);if(_0x1167b8[_0x51a8('0x3f')][_0x51a8('0x2d')]){_0x9f0e6[_0x51a8('0x45')]=_[_0x51a8('0x47')](_0x9f0e6[_0x51a8('0x45')],{'$or':_[_0x51a8('0x2f')](_0x578fc6,function(_0x4b8467){if(_0x4b8467[_0x51a8('0x32')]!==_0x51a8('0x48')){var _0x4c7c67={};_0x4c7c67[_0x4b8467['name']]={'$like':'%'+_0x1167b8[_0x51a8('0x3f')][_0x51a8('0x2d')]+'%'};return _0x4c7c67;}})});}_0x9f0e6=_[_0x51a8('0x47')]({},_0x9f0e6,_0x1167b8[_0x51a8('0x49')]);var _0x311574={'where':_0x9f0e6[_0x51a8('0x45')]};return db[_0x51a8('0x38')][_0x51a8('0x1f')](_0x311574)[_0x51a8('0x25')](function(_0x2e80ed){_0x41561a['count']=_0x2e80ed;if(_0x1167b8[_0x51a8('0x3f')][_0x51a8('0x4a')]){_0x9f0e6[_0x51a8('0x4b')]=[{'all':!![]}];}return db[_0x51a8('0x38')][_0x51a8('0x4c')](_0x9f0e6);})[_0x51a8('0x25')](function(_0x579411){_0x41561a[_0x51a8('0x4d')]=_0x579411;return _0x41561a;})['then'](respondWithFilteredResult(_0x53b3b6,_0x9f0e6))[_0x51a8('0x4e')](handleError(_0x53b3b6,null));};exports[_0x51a8('0x4f')]=function(_0xa5d597,_0xc856d1){var _0x246b72={'raw':![],'where':{'id':_0xa5d597['params']['id']}},_0x56d002={};_0x56d002[_0x51a8('0x3e')]=_[_0x51a8('0x3b')](db[_0x51a8('0x38')][_0x51a8('0x39')]);_0x56d002[_0x51a8('0x3f')]=_['keys'](_0xa5d597['query']);_0x56d002[_0x51a8('0x3c')]=_[_0x51a8('0x3d')](_0x56d002[_0x51a8('0x3e')],_0x56d002[_0x51a8('0x3f')]);_0x246b72[_0x51a8('0x40')]=_[_0x51a8('0x3d')](_0x56d002[_0x51a8('0x3e')],qs[_0x51a8('0x50')](_0xa5d597[_0x51a8('0x3f')]['fields']));_0x246b72['attributes']=_0x246b72['attributes'][_0x51a8('0x41')]?_0x246b72[_0x51a8('0x40')]:_0x56d002[_0x51a8('0x3e')];if(_0xa5d597['query'][_0x51a8('0x4a')]){_0x246b72[_0x51a8('0x4b')]=[{'all':!![]}];}_0x246b72=_['merge']({},_0x246b72,_0xa5d597[_0x51a8('0x49')]);return db['VoiceExtension']['find'](_0x246b72)[_0x51a8('0x25')](handleEntityNotFound(_0xc856d1,null))[_0x51a8('0x25')](respondWithResult(_0xc856d1,null))[_0x51a8('0x4e')](handleError(_0xc856d1,null));};exports['destroy']=function(_0x5b5aa5,_0x3a8f1e){return db['VoiceExtension'][_0x51a8('0x33')]({'where':{'id':_0x5b5aa5[_0x51a8('0x51')]['id']}})[_0x51a8('0x25')](handleEntityNotFound(_0x3a8f1e,null))[_0x51a8('0x25')](removeEntity(_0x3a8f1e,null))[_0x51a8('0x4e')](handleError(_0x3a8f1e,null));};exports[_0x51a8('0x52')]=function(_0x2a87e2,_0x406a87){if(_0x2a87e2[_0x51a8('0x53')]['type']===_0x51a8('0x54')&&!_[_0x51a8('0x55')](_0x2a87e2[_0x51a8('0x53')][_0x51a8('0x56')],'_')){_0x2a87e2['body'][_0x51a8('0x56')]='_'['concat'](_0x2a87e2[_0x51a8('0x53')][_0x51a8('0x56')]);}return db['VoiceExtension']['create'](_0x2a87e2[_0x51a8('0x53')],{'raw':![]})[_0x51a8('0x25')](function(_0x165366){var _0x1aaeaf=_0x2a87e2[_0x51a8('0x57')]['get']({'plain':!![]});if(!_0x1aaeaf)throw new Error(_0x51a8('0x58'));if(_0x1aaeaf[_0x51a8('0x59')]===_0x51a8('0x57')){var _0x308d40=_0x165366[_0x51a8('0x27')]({'plain':!![]});var _0x5d44fe=[{'name':_0x51a8('0x28'),'value':_0x51a8('0x29')},{'name':_0x51a8('0x2a'),'value':_0x51a8('0x54')},{'name':_0x51a8('0x2b'),'value':_0x51a8('0x2c')}];var _0x4d2699=_['find'](_0x5d44fe,['value',_0x308d40['type']])[_0x51a8('0x36')];return db[_0x51a8('0x5a')]['find']({'where':{'name':_0x4d2699,'userProfileId':_0x1aaeaf[_0x51a8('0x5b')]},'raw':!![]})['then'](function(_0x41cc00){if(_0x41cc00&&_0x41cc00['autoAssociation']===0x0){return db[_0x51a8('0x34')][_0x51a8('0x52')]({'name':_0x308d40['name'],'resourceId':_0x308d40['id'],'type':_0x41cc00['name'],'sectionId':_0x41cc00['id']},{})['then'](function(){return _0x165366;});}else{return _0x165366;}})[_0x51a8('0x4e')](function(_0x1ead77){logger[_0x51a8('0x5c')](_0x51a8('0x5d'),_0x1ead77);throw _0x1ead77;});}return _0x165366;})[_0x51a8('0x25')](respondWithResult(_0x406a87,0xc9))[_0x51a8('0x4e')](handleError(_0x406a87,null));};exports[_0x51a8('0x5e')]=function(_0x259153,_0x494e11){if(_0x259153[_0x51a8('0x53')]['id']){delete _0x259153[_0x51a8('0x53')]['id'];}return db['VoiceExtension'][_0x51a8('0x33')]({'where':{'id':_0x259153[_0x51a8('0x51')]['id']}})[_0x51a8('0x25')](handleEntityNotFound(_0x494e11,null))[_0x51a8('0x25')](function(_0x2e1250){if(_0x2e1250){return db[_0x51a8('0x38')]['update'](_['pick'](_0x259153[_0x51a8('0x53')],['exten','context','description','recordingFormat','cutdigits',_0x51a8('0x5f')]),{'where':{'context':_0x2e1250['context'],'exten':_0x2e1250[_0x51a8('0x56')]},'individualHooks':!![]})[_0x51a8('0x25')](function(_0x1e7135){return _0x1e7135;});}return null;})[_0x51a8('0x25')](respondWithStatusCode(_0x494e11,null))[_0x51a8('0x4e')](handleError(_0x494e11,null));};exports[_0x51a8('0x60')]=function(_0x28c539,_0xdafa01,_0x4b4740){return db[_0x51a8('0x38')]['findOne']({'where':{'id':_0x28c539[_0x51a8('0x51')]['id']}})[_0x51a8('0x25')](handleEntityNotFound(_0xdafa01,null))[_0x51a8('0x25')](function(_0x522677){if(_0x522677){return db['sequelize']['transaction'](function(_0x10c22e){return db[_0x51a8('0x38')][_0x51a8('0x26')]({'where':{'VoiceExtensionId':_0x28c539[_0x51a8('0x51')]['id']},'transaction':_0x10c22e})[_0x51a8('0x25')](function(_0x1462b4){var _0x351c22=_[_0x51a8('0x2f')](_0x28c539[_0x51a8('0x53')],function(_0x462555){_0x462555[_0x51a8('0x61')]=_0x28c539[_0x51a8('0x51')]['id'];return _0x462555;});return db[_0x51a8('0x38')]['bulkCreate'](_0x351c22,{'transaction':_0x10c22e});});})[_0x51a8('0x25')](function(){return db[_0x51a8('0x38')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x28c539[_0x51a8('0x51')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0xdafa01,null))['catch'](handleError(_0xdafa01,null));}; \ No newline at end of file +var _0x524e=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','recordingFormat','cutdigits','mandatoryDisposition','context','addApplications','findOne','sequelize','transaction','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','find','type','name','destroy','end','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','merge','includeAll','include','show','params','catch','create','startsWith','body','exten','concat','user'];(function(_0x2cecec,_0xb41fa4){var _0x5c5054=function(_0xceb234){while(--_0xceb234){_0x2cecec['push'](_0x2cecec['shift']());}};_0x5c5054(++_0xb41fa4);}(_0x524e,0x15e));var _0xe524=function(_0x39aa47,_0x4fb2f1){_0x39aa47=_0x39aa47-0x0;var _0x16696e=_0x524e[_0x39aa47];return _0x16696e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe524('0x0'));var zipdir=require(_0xe524('0x1'));var jsonpatch=require(_0xe524('0x2'));var rp=require(_0xe524('0x3'));var moment=require(_0xe524('0x4'));var BPromise=require(_0xe524('0x5'));var Mustache=require(_0xe524('0x6'));var util=require(_0xe524('0x7'));var path=require(_0xe524('0x8'));var sox=require(_0xe524('0x9'));var csv=require('to-csv');var ejs=require(_0xe524('0xa'));var fs=require('fs');var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0xf'));var querystring=require(_0xe524('0x10'));var Papa=require(_0xe524('0x11'));var Redis=require(_0xe524('0x12'));var authService=require(_0xe524('0x13'));var qs=require(_0xe524('0x14'));var as=require(_0xe524('0x15'));var hardwareService=require(_0xe524('0x16'));var logger=require(_0xe524('0x17'))(_0xe524('0x18'));var utils=require(_0xe524('0x19'));var config=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];config[_0xe524('0x1c')]=_['defaults'](config['redis'],{'host':_0xe524('0x1d'),'port':0x18eb});var socket=require(_0xe524('0x1e'))(new Redis(config[_0xe524('0x1c')]));require(_0xe524('0x1f'))[_0xe524('0x20')](socket);function respondWithStatusCode(_0x57c1b6,_0x12ff75){_0x12ff75=_0x12ff75||0xcc;return function(_0x51e9fe){if(_0x51e9fe){return _0x57c1b6[_0xe524('0x21')](_0x12ff75);}return _0x57c1b6[_0xe524('0x22')](_0x12ff75)['end']();};}function respondWithResult(_0x569660,_0x488fce){_0x488fce=_0x488fce||0xc8;return function(_0x109795){if(_0x109795){return _0x569660['status'](_0x488fce)[_0xe524('0x23')](_0x109795);}};}function respondWithFilteredResult(_0x5f17fe,_0x5c8736){return function(_0x5a5c0d){if(_0x5a5c0d){var _0x3a4027=_0x5a5c0d[_0xe524('0x24')],_0x4f1dfb=_0x5c8736[_0xe524('0x25')],_0x11b2a1=_0x5c8736['offset']+_0x5c8736[_0xe524('0x26')],_0x238f8f;if(_0x11b2a1>=_0x3a4027){_0x11b2a1=_0x3a4027;_0x238f8f=0xc8;}else{_0x238f8f=0xce;}_0x5f17fe[_0xe524('0x22')](_0x238f8f);return _0x5f17fe['set'](_0xe524('0x27'),_0x4f1dfb+'-'+_0x11b2a1+'/'+_0x3a4027)[_0xe524('0x23')](_0x5a5c0d);}return null;};}function patchUpdates(_0x43a4f9){return function(_0x1dcc0f){try{jsonpatch[_0xe524('0x28')](_0x1dcc0f,_0x43a4f9,!![]);}catch(_0x1cab6c){return BPromise[_0xe524('0x29')](_0x1cab6c);}return _0x1dcc0f[_0xe524('0x2a')]();};}function saveUpdates(_0x7dfe97,_0x5c4d21){return function(_0x7d1f92){if(_0x7d1f92){return _0x7d1f92['update'](_0x7dfe97)['then'](function(_0x2d2f83){return _0x2d2f83;});}return null;};}function removeEntity(_0x23df5e,_0x1ad106){return function(_0x85fc51){if(_0x85fc51){return _0x85fc51['destroy']()[_0xe524('0x2b')](function(){var _0x4a03bc=_0x85fc51[_0xe524('0x2c')]({'plain':!![]});var _0xcf5db=[{'name':_0xe524('0x2d'),'value':_0xe524('0x2e'),'ignore':![]},{'name':_0xe524('0x2f'),'value':_0xe524('0x30'),'ignore':![]},{'name':_0xe524('0x31'),'value':'internal','ignore':![]}];var _0x58a896=_(_0xcf5db)[_0xe524('0x32')](_0xe524('0x33'))[_0xe524('0x34')](_0xe524('0x35'))[_0xe524('0x35')]();if(_['includes'](_0x58a896,_0x4a03bc['type'])){return;}var _0x4b1ff=_[_0xe524('0x36')](_0xcf5db,[_0xe524('0x35'),_0x4a03bc[_0xe524('0x37')]])[_0xe524('0x38')];return db['UserProfileResource'][_0xe524('0x39')]({'where':{'type':_0x4b1ff,'resourceId':_0x4a03bc['id']}})[_0xe524('0x2b')](function(){return _0x85fc51;});})['then'](function(){_0x23df5e['status'](0xcc)[_0xe524('0x3a')]();});}};}function handleEntityNotFound(_0x376324,_0x5b2fc3){return function(_0x31d4a7){if(!_0x31d4a7){_0x376324['sendStatus'](0x194);}return _0x31d4a7;};}function handleError(_0x3fec06,_0x54af2a){_0x54af2a=_0x54af2a||0x1f4;return function(_0x315e56){logger[_0xe524('0x3b')](_0x315e56[_0xe524('0x3c')]);if(_0x315e56['name']){delete _0x315e56[_0xe524('0x38')];}_0x3fec06['status'](_0x54af2a)[_0xe524('0x3d')](_0x315e56);};}exports[_0xe524('0x3e')]=function(_0x276343,_0x502256){var _0x16e124={},_0x119cc3={},_0x49c43e={'count':0x0,'rows':[]};var _0x27817e=_[_0xe524('0x34')](db[_0xe524('0x3f')][_0xe524('0x40')],function(_0x53560d){return{'name':_0x53560d[_0xe524('0x41')],'type':_0x53560d[_0xe524('0x37')][_0xe524('0x42')]};});_0x119cc3[_0xe524('0x43')]=_[_0xe524('0x34')](_0x27817e,_0xe524('0x38'));_0x119cc3[_0xe524('0x44')]=_[_0xe524('0x45')](_0x276343['query']);_0x119cc3[_0xe524('0x46')]=_['intersection'](_0x119cc3[_0xe524('0x43')],_0x119cc3[_0xe524('0x44')]);_0x16e124['attributes']=_[_0xe524('0x47')](_0x119cc3['model'],qs[_0xe524('0x48')](_0x276343[_0xe524('0x44')][_0xe524('0x48')]));_0x16e124[_0xe524('0x49')]=_0x16e124[_0xe524('0x49')][_0xe524('0x4a')]?_0x16e124[_0xe524('0x49')]:_0x119cc3[_0xe524('0x43')];if(!_0x276343['query'][_0xe524('0x4b')](_0xe524('0x4c'))){_0x16e124[_0xe524('0x26')]=qs[_0xe524('0x26')](_0x276343[_0xe524('0x44')][_0xe524('0x26')]);_0x16e124[_0xe524('0x25')]=qs[_0xe524('0x25')](_0x276343['query'][_0xe524('0x25')]);}_0x16e124[_0xe524('0x4d')]=qs[_0xe524('0x4e')](_0x276343['query'][_0xe524('0x4e')]);_0x16e124['where']=qs[_0xe524('0x46')](_[_0xe524('0x4f')](_0x276343[_0xe524('0x44')],_0x119cc3[_0xe524('0x46')]),_0x27817e);if(_0x276343[_0xe524('0x44')][_0xe524('0x32')]){_0x16e124[_0xe524('0x50')]=_['merge'](_0x16e124[_0xe524('0x50')],{'$or':_[_0xe524('0x34')](_0x27817e,function(_0x13c54c){if(_0x13c54c[_0xe524('0x37')]!==_0xe524('0x51')){var _0x1ae283={};_0x1ae283[_0x13c54c['name']]={'$like':'%'+_0x276343[_0xe524('0x44')][_0xe524('0x32')]+'%'};return _0x1ae283;}})});}_0x16e124=_[_0xe524('0x52')]({},_0x16e124,_0x276343['options']);var _0x21ea32={'where':_0x16e124['where']};return db['VoiceExtension'][_0xe524('0x24')](_0x21ea32)[_0xe524('0x2b')](function(_0x4da26f){_0x49c43e[_0xe524('0x24')]=_0x4da26f;if(_0x276343[_0xe524('0x44')][_0xe524('0x53')]){_0x16e124[_0xe524('0x54')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x16e124);})[_0xe524('0x2b')](function(_0x10aad6){_0x49c43e['rows']=_0x10aad6;return _0x49c43e;})[_0xe524('0x2b')](respondWithFilteredResult(_0x502256,_0x16e124))['catch'](handleError(_0x502256,null));};exports[_0xe524('0x55')]=function(_0x181680,_0x462b87){var _0x312c47={'raw':![],'where':{'id':_0x181680[_0xe524('0x56')]['id']}},_0xbde17b={};_0xbde17b[_0xe524('0x43')]=_[_0xe524('0x45')](db[_0xe524('0x3f')][_0xe524('0x40')]);_0xbde17b[_0xe524('0x44')]=_[_0xe524('0x45')](_0x181680[_0xe524('0x44')]);_0xbde17b[_0xe524('0x46')]=_[_0xe524('0x47')](_0xbde17b['model'],_0xbde17b[_0xe524('0x44')]);_0x312c47['attributes']=_['intersection'](_0xbde17b[_0xe524('0x43')],qs['fields'](_0x181680[_0xe524('0x44')][_0xe524('0x48')]));_0x312c47['attributes']=_0x312c47[_0xe524('0x49')]['length']?_0x312c47['attributes']:_0xbde17b[_0xe524('0x43')];if(_0x181680[_0xe524('0x44')][_0xe524('0x53')]){_0x312c47['include']=[{'all':!![]}];}_0x312c47=_['merge']({},_0x312c47,_0x181680['options']);return db['VoiceExtension']['find'](_0x312c47)['then'](handleEntityNotFound(_0x462b87,null))[_0xe524('0x2b')](respondWithResult(_0x462b87,null))[_0xe524('0x57')](handleError(_0x462b87,null));};exports['destroy']=function(_0x465fb5,_0x40b871){return db[_0xe524('0x3f')][_0xe524('0x36')]({'where':{'id':_0x465fb5[_0xe524('0x56')]['id']}})['then'](handleEntityNotFound(_0x40b871,null))[_0xe524('0x2b')](removeEntity(_0x40b871,null))[_0xe524('0x57')](handleError(_0x40b871,null));};exports[_0xe524('0x58')]=function(_0x494c39,_0x24f65b){if(_0x494c39['body'][_0xe524('0x37')]===_0xe524('0x30')&&!_[_0xe524('0x59')](_0x494c39[_0xe524('0x5a')][_0xe524('0x5b')],'_')){_0x494c39[_0xe524('0x5a')][_0xe524('0x5b')]='_'[_0xe524('0x5c')](_0x494c39[_0xe524('0x5a')][_0xe524('0x5b')]);}return db[_0xe524('0x3f')][_0xe524('0x58')](_0x494c39['body'],{'raw':![]})['then'](function(_0x4831fa){var _0xe49f84=_0x494c39[_0xe524('0x5d')][_0xe524('0x2c')]({'plain':!![]});if(!_0xe49f84)throw new Error(_0xe524('0x5e'));if(_0xe49f84[_0xe524('0x5f')]===_0xe524('0x5d')){var _0x33ae9d=_0x4831fa[_0xe524('0x2c')]({'plain':!![]});var _0x1e9006=[{'name':_0xe524('0x2d'),'value':_0xe524('0x2e')},{'name':'OutboundRoutes','value':_0xe524('0x30')},{'name':_0xe524('0x31'),'value':'internal'}];var _0x53da86=_['find'](_0x1e9006,['value',_0x33ae9d[_0xe524('0x37')]])[_0xe524('0x38')];return db[_0xe524('0x60')][_0xe524('0x36')]({'where':{'name':_0x53da86,'userProfileId':_0xe49f84['userProfileId']},'raw':!![]})[_0xe524('0x2b')](function(_0x244f08){if(_0x244f08&&_0x244f08[_0xe524('0x61')]===0x0){return db[_0xe524('0x62')]['create']({'name':_0x33ae9d['name'],'resourceId':_0x33ae9d['id'],'type':_0x244f08['name'],'sectionId':_0x244f08['id']},{})[_0xe524('0x2b')](function(){return _0x4831fa;});}else{return _0x4831fa;}})['catch'](function(_0x357418){logger[_0xe524('0x3b')](_0xe524('0x63'),_0x357418);throw _0x357418;});}return _0x4831fa;})[_0xe524('0x2b')](respondWithResult(_0x24f65b,0xc9))[_0xe524('0x57')](handleError(_0x24f65b,null));};exports['update']=function(_0x5d0507,_0x29a519){if(_0x5d0507[_0xe524('0x5a')]['id']){delete _0x5d0507[_0xe524('0x5a')]['id'];}return db[_0xe524('0x3f')][_0xe524('0x36')]({'where':{'id':_0x5d0507[_0xe524('0x56')]['id']}})['then'](handleEntityNotFound(_0x29a519,null))[_0xe524('0x2b')](function(_0x26160b){if(_0x26160b){return db[_0xe524('0x3f')]['update'](_[_0xe524('0x4f')](_0x5d0507[_0xe524('0x5a')],[_0xe524('0x5b'),'context','description',_0xe524('0x64'),_0xe524('0x65'),_0xe524('0x66')]),{'where':{'context':_0x26160b[_0xe524('0x67')],'exten':_0x26160b[_0xe524('0x5b')]},'individualHooks':!![]})['then'](function(_0xe102a0){return _0xe102a0;});}return null;})[_0xe524('0x2b')](respondWithStatusCode(_0x29a519,null))[_0xe524('0x57')](handleError(_0x29a519,null));};exports[_0xe524('0x68')]=function(_0x3ce098,_0x22d06a,_0x35e6b2){return db[_0xe524('0x3f')][_0xe524('0x69')]({'where':{'id':_0x3ce098[_0xe524('0x56')]['id']}})[_0xe524('0x2b')](handleEntityNotFound(_0x22d06a,null))['then'](function(_0x3cf9c2){if(_0x3cf9c2){return db[_0xe524('0x6a')][_0xe524('0x6b')](function(_0xfed246){return db[_0xe524('0x3f')]['destroy']({'where':{'VoiceExtensionId':_0x3ce098[_0xe524('0x56')]['id']},'transaction':_0xfed246})[_0xe524('0x2b')](function(_0x2ea4c9){var _0x32d11a=_[_0xe524('0x34')](_0x3ce098[_0xe524('0x5a')],function(_0x2a09f5){_0x2a09f5['VoiceExtensionId']=_0x3ce098[_0xe524('0x56')]['id'];return _0x2a09f5;});return db[_0xe524('0x3f')][_0xe524('0x6c')](_0x32d11a,{'transaction':_0xfed246});});})[_0xe524('0x2b')](function(){return db['VoiceExtension'][_0xe524('0x6d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3ce098['params']['id']},'order':_0xe524('0x6e')});});}})[_0xe524('0x2b')](respondWithResult(_0x22d06a,null))[_0xe524('0x57')](handleError(_0x22d06a,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 845aceb..ff205e0 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 _0xfcfe=['update','remove','hook','events','VoiceExtension','save'];(function(_0x59fc49,_0xbc130a){var _0x48debe=function(_0x16a963){while(--_0x16a963){_0x59fc49['push'](_0x59fc49['shift']());}};_0x48debe(++_0xbc130a);}(_0xfcfe,0xff));var _0xefcf=function(_0x209fbf,_0x375c5d){_0x209fbf=_0x209fbf-0x0;var _0x2cf14b=_0xfcfe[_0x209fbf];return _0x2cf14b;};'use strict';var EventEmitter=require(_0xefcf('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xefcf('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xefcf('0x2'),'afterUpdate':_0xefcf('0x3'),'afterDestroy':_0xefcf('0x4')};function emitEvent(_0x25c81e){return function(_0x45aaf2,_0x335184,_0x3785ce){VoiceExtensionEvents['emit'](_0x25c81e+':'+_0x45aaf2['id'],_0x45aaf2);VoiceExtensionEvents['emit'](_0x25c81e,_0x45aaf2);_0x3785ce(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xefcf('0x5')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x6aba=['VoiceExtension','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x6aba,0x152));var _0xa6ab=function(_0x532bf7,_0x304edf){_0x532bf7=_0x532bf7-0x0;var _0xa16444=_0x6aba[_0x532bf7];return _0xa16444;};'use strict';var EventEmitter=require(_0xa6ab('0x0'));var VoiceExtension=require(_0xa6ab('0x1'))['db'][_0xa6ab('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xa6ab('0x3')](0x0);var events={'afterCreate':_0xa6ab('0x4'),'afterUpdate':_0xa6ab('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3322b9){return function(_0x355001,_0x17dc28,_0x31b0bc){VoiceExtensionEvents[_0xa6ab('0x6')](_0x3322b9+':'+_0x355001['id'],_0x355001);VoiceExtensionEvents[_0xa6ab('0x6')](_0x3322b9,_0x355001);_0x31b0bc(null);};}for(var e in events){if(events[_0xa6ab('0x7')](e)){var event=events[e];VoiceExtension[_0xa6ab('0x8')](e,emitEvent(event));}}module[_0xa6ab('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 5a54691..403232a 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 _0x5f2f=['bluebird','request-promise','path','./voiceExtension.attributes','exports','define','VoiceExtension','lodash','util','../../config/logger','api','moment'];(function(_0x1b64a7,_0x36b3e5){var _0x556458=function(_0x5d2b85){while(--_0x5d2b85){_0x1b64a7['push'](_0x1b64a7['shift']());}};_0x556458(++_0x36b3e5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x56823a,_0x4d5ff9){_0x56823a=_0x56823a-0x0;var _0x368711=_0x5f2f[_0x56823a];return _0x368711;};'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':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','define','voice_extensions'];(function(_0x17c182,_0x45c128){var _0x1ec5c7=function(_0x2c6cc9){while(--_0x2c6cc9){_0x17c182['push'](_0x17c182['shift']());}};_0x1ec5c7(++_0x45c128);}(_0x1261,0x144));var _0x1126=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0x1261[_0x29ae80];return _0x5d6d71;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('VoiceExtension',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 580dcc5..c19cb8d 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 _0xec68=['bluebird','../../mysqldb','rpc','jayson/promise','client','redis','defaults','localhost','./voiceExtension.socket','register','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','VoiceExtension','findAll','options','raw','where','attributes','limit','include','model','map','GetVoiceExtension'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xec68,0xf0));var _0x8ec6=function(_0x10436a,_0x23a56c){_0x10436a=_0x10436a-0x0;var _0x22f888=_0xec68[_0x10436a];return _0x22f888;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8ec6('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ec6('0x1'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8ec6('0x2'));var config=require('../../config/environment');var jayson=require(_0x8ec6('0x3'));var client=jayson[_0x8ec6('0x4')]['http']({'port':0x232a});config[_0x8ec6('0x5')]=_[_0x8ec6('0x6')](config[_0x8ec6('0x5')],{'host':_0x8ec6('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8ec6('0x5')]));require(_0x8ec6('0x8'))[_0x8ec6('0x9')](socket);function respondWithRpcPromise(_0x42ee87,_0x14ef9c,_0xef9a1b){return new BPromise(function(_0xcfbfca,_0xc6f97){return client['request'](_0x42ee87,_0xef9a1b)['then'](function(_0x8e4cd7){logger[_0x8ec6('0xa')](_0x8ec6('0xb'),_0x14ef9c,_0x8ec6('0xc'));logger[_0x8ec6('0xd')](_0x8ec6('0xe'),_0x14ef9c,'request\x20sent',JSON[_0x8ec6('0xf')](_0x8e4cd7));if(_0x8e4cd7[_0x8ec6('0x10')]){if(_0x8e4cd7[_0x8ec6('0x10')]['code']===0x1f4){logger[_0x8ec6('0x10')](_0x8ec6('0xb'),_0x14ef9c,_0x8e4cd7[_0x8ec6('0x10')][_0x8ec6('0x11')]);return _0xc6f97(_0x8e4cd7[_0x8ec6('0x10')]['message']);}logger[_0x8ec6('0x10')](_0x8ec6('0xb'),_0x14ef9c,_0x8e4cd7[_0x8ec6('0x10')][_0x8ec6('0x11')]);return _0xcfbfca(_0x8e4cd7['error'][_0x8ec6('0x11')]);}else{logger[_0x8ec6('0xa')](_0x8ec6('0xb'),_0x14ef9c,_0x8ec6('0xc'));_0xcfbfca(_0x8e4cd7['result'][_0x8ec6('0x11')]);}})[_0x8ec6('0x12')](function(_0x152459){logger[_0x8ec6('0x10')](_0x8ec6('0xb'),_0x14ef9c,_0x152459);_0xc6f97(_0x152459);});});}exports['GetVoiceExtension']=function(_0x22f18c){var _0x2696af=this;return new Promise(function(_0x1a0002,_0x4d5f97){return db[_0x8ec6('0x13')][_0x8ec6('0x14')]({'raw':_0x22f18c[_0x8ec6('0x15')]?_0x22f18c[_0x8ec6('0x15')][_0x8ec6('0x16')]===undefined?!![]:![]:!![],'where':_0x22f18c['options']?_0x22f18c[_0x8ec6('0x15')][_0x8ec6('0x17')]||null:null,'attributes':_0x22f18c[_0x8ec6('0x15')]?_0x22f18c[_0x8ec6('0x15')][_0x8ec6('0x18')]||null:null,'limit':_0x22f18c[_0x8ec6('0x15')]?_0x22f18c[_0x8ec6('0x15')][_0x8ec6('0x19')]||null:null,'include':_0x22f18c['options']?_0x22f18c[_0x8ec6('0x15')][_0x8ec6('0x1a')]?_['map'](_0x22f18c[_0x8ec6('0x15')][_0x8ec6('0x1a')],function(_0x1e4c26){return{'model':db[_0x1e4c26[_0x8ec6('0x1b')]],'as':_0x1e4c26['as'],'attributes':_0x1e4c26[_0x8ec6('0x18')],'include':_0x1e4c26[_0x8ec6('0x1a')]?_[_0x8ec6('0x1c')](_0x1e4c26[_0x8ec6('0x1a')],function(_0x506142){return{'model':db[_0x506142[_0x8ec6('0x1b')]],'as':_0x506142['as'],'attributes':_0x506142[_0x8ec6('0x18')],'include':_0x506142[_0x8ec6('0x1a')]?_['map'](_0x506142['include'],function(_0xb106b0){return{'model':db[_0xb106b0[_0x8ec6('0x1b')]],'as':_0xb106b0['as'],'attributes':_0xb106b0[_0x8ec6('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x585135){logger[_0x8ec6('0xa')]('GetVoiceExtension',_0x22f18c);logger[_0x8ec6('0xd')](_0x8ec6('0x1d'),_0x22f18c,JSON[_0x8ec6('0xf')](_0x585135));_0x1a0002(_0x585135);})[_0x8ec6('0x12')](function(_0x40035b){logger['error'](_0x8ec6('0x1d'),_0x40035b[_0x8ec6('0x11')],_0x22f18c);_0x4d5f97(_0x2696af[_0x8ec6('0x10')](0x1f4,_0x40035b[_0x8ec6('0x11')]));});});}; \ No newline at end of file +var _0x7c14=['where','attributes','limit','include','model','map','then','stringify','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceExtension','options','raw'];(function(_0x417a94,_0x14f396){var _0x20e7d5=function(_0x2bdec7){while(--_0x2bdec7){_0x417a94['push'](_0x417a94['shift']());}};_0x20e7d5(++_0x14f396);}(_0x7c14,0x1dc));var _0x47c1=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7c14[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x47c1('0x0'));var util=require(_0x47c1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x47c1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x47c1('0x3'))['db'];var utils=require(_0x47c1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x47c1('0x5'));var jayson=require(_0x47c1('0x6'));var client=jayson[_0x47c1('0x7')][_0x47c1('0x8')]({'port':0x232a});config[_0x47c1('0x9')]=_[_0x47c1('0xa')](config[_0x47c1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x47c1('0xb'))(new Redis(config[_0x47c1('0x9')]));require(_0x47c1('0xc'))[_0x47c1('0xd')](socket);function respondWithRpcPromise(_0x39d177,_0x18c685,_0x2f36ee){return new BPromise(function(_0x2cb1d2,_0x172c8f){return client[_0x47c1('0xe')](_0x39d177,_0x2f36ee)['then'](function(_0x62c338){logger[_0x47c1('0xf')](_0x47c1('0x10'),_0x18c685,_0x47c1('0x11'));logger[_0x47c1('0x12')](_0x47c1('0x13'),_0x18c685,_0x47c1('0x11'),JSON['stringify'](_0x62c338));if(_0x62c338['error']){if(_0x62c338[_0x47c1('0x14')][_0x47c1('0x15')]===0x1f4){logger[_0x47c1('0x14')](_0x47c1('0x10'),_0x18c685,_0x62c338[_0x47c1('0x14')][_0x47c1('0x16')]);return _0x172c8f(_0x62c338[_0x47c1('0x14')][_0x47c1('0x16')]);}logger[_0x47c1('0x14')](_0x47c1('0x10'),_0x18c685,_0x62c338[_0x47c1('0x14')][_0x47c1('0x16')]);return _0x2cb1d2(_0x62c338[_0x47c1('0x14')]['message']);}else{logger[_0x47c1('0xf')](_0x47c1('0x10'),_0x18c685,_0x47c1('0x11'));_0x2cb1d2(_0x62c338[_0x47c1('0x17')][_0x47c1('0x16')]);}})[_0x47c1('0x18')](function(_0x1276cc){logger[_0x47c1('0x14')](_0x47c1('0x10'),_0x18c685,_0x1276cc);_0x172c8f(_0x1276cc);});});}exports[_0x47c1('0x19')]=function(_0x29cfe9){var _0x3219bc=this;return new Promise(function(_0x8da9c,_0x47f025){return db['VoiceExtension']['findAll']({'raw':_0x29cfe9[_0x47c1('0x1a')]?_0x29cfe9['options'][_0x47c1('0x1b')]===undefined?!![]:![]:!![],'where':_0x29cfe9[_0x47c1('0x1a')]?_0x29cfe9[_0x47c1('0x1a')][_0x47c1('0x1c')]||null:null,'attributes':_0x29cfe9[_0x47c1('0x1a')]?_0x29cfe9[_0x47c1('0x1a')][_0x47c1('0x1d')]||null:null,'limit':_0x29cfe9[_0x47c1('0x1a')]?_0x29cfe9['options'][_0x47c1('0x1e')]||null:null,'include':_0x29cfe9[_0x47c1('0x1a')]?_0x29cfe9[_0x47c1('0x1a')][_0x47c1('0x1f')]?_['map'](_0x29cfe9[_0x47c1('0x1a')][_0x47c1('0x1f')],function(_0x47aca9){return{'model':db[_0x47aca9[_0x47c1('0x20')]],'as':_0x47aca9['as'],'attributes':_0x47aca9['attributes'],'include':_0x47aca9[_0x47c1('0x1f')]?_[_0x47c1('0x21')](_0x47aca9[_0x47c1('0x1f')],function(_0x394866){return{'model':db[_0x394866[_0x47c1('0x20')]],'as':_0x394866['as'],'attributes':_0x394866[_0x47c1('0x1d')],'include':_0x394866[_0x47c1('0x1f')]?_[_0x47c1('0x21')](_0x394866[_0x47c1('0x1f')],function(_0x9413f2){return{'model':db[_0x9413f2[_0x47c1('0x20')]],'as':_0x9413f2['as'],'attributes':_0x9413f2[_0x47c1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x47c1('0x22')](function(_0x1c85f0){logger[_0x47c1('0xf')]('GetVoiceExtension',_0x29cfe9);logger[_0x47c1('0x12')](_0x47c1('0x19'),_0x29cfe9,JSON[_0x47c1('0x23')](_0x1c85f0));_0x8da9c(_0x1c85f0);})[_0x47c1('0x18')](function(_0x356b88){logger[_0x47c1('0x14')](_0x47c1('0x19'),_0x356b88[_0x47c1('0x16')],_0x29cfe9);_0x47f025(_0x3219bc['error'](0x1f4,_0x356b88[_0x47c1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index b46d626..02e0e84 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 _0xbfea=['save','remove','update','emit','register','length','voiceExtension:','./voiceExtension.events'];(function(_0x23bd26,_0x1bdca5){var _0x1902b1=function(_0x5a4298){while(--_0x5a4298){_0x23bd26['push'](_0x23bd26['shift']());}};_0x1902b1(++_0x1bdca5);}(_0xbfea,0x187));var _0xabfe=function(_0x123ea4,_0x18a836){_0x123ea4=_0x123ea4-0x0;var _0x268e9f=_0xbfea[_0x123ea4];return _0x268e9f;};'use strict';var VoiceExtensionEvents=require(_0xabfe('0x0'));var events=[_0xabfe('0x1'),_0xabfe('0x2'),_0xabfe('0x3')];function createListener(_0x469ce9,_0x7989){return function(_0x3dbd76){_0x7989[_0xabfe('0x4')](_0x469ce9,_0x3dbd76);};}function removeListener(_0x9f003b,_0x296250){return function(){VoiceExtensionEvents['removeListener'](_0x9f003b,_0x296250);};}exports[_0xabfe('0x5')]=function(_0x425535){for(var _0x2ea59d=0x0,_0x11b842=events[_0xabfe('0x6')];_0x2ea59d<_0x11b842;_0x2ea59d++){var _0x3eedb2=events[_0x2ea59d];var _0x3cdb6d=createListener(_0xabfe('0x7')+_0x3eedb2,_0x425535);VoiceExtensionEvents['on'](_0x3eedb2,_0x3cdb6d);}}; \ No newline at end of file +var _0x8c5b=['register','length','voiceExtension:','./voiceExtension.events','save','remove','update','removeListener'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x8c5b,0x1b3));var _0xb8c5=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0x8c5b[_0x21f931];return _0x3f083c;};'use strict';var VoiceExtensionEvents=require(_0xb8c5('0x0'));var events=[_0xb8c5('0x1'),_0xb8c5('0x2'),_0xb8c5('0x3')];function createListener(_0x443e98,_0x524c7b){return function(_0xb8757f){_0x524c7b['emit'](_0x443e98,_0xb8757f);};}function removeListener(_0x29d4e9,_0x364a1f){return function(){VoiceExtensionEvents[_0xb8c5('0x4')](_0x29d4e9,_0x364a1f);};}exports[_0xb8c5('0x5')]=function(_0xe534b7){for(var _0x4db47e=0x0,_0x22211d=events[_0xb8c5('0x6')];_0x4db47e<_0x22211d;_0x4db47e++){var _0x3be950=events[_0x4db47e];var _0xb46065=createListener(_0xb8c5('0x7')+_0x3be950,_0xe534b7);VoiceExtensionEvents['on'](_0x3be950,_0xb46065);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 39ae3c4..ebbdcc4 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 _0x51b0=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','isAuthenticated','index','get','/:id','show','/:id/messages','post','create'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x51b0,0xac));var _0x051b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x51b0[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x051b('0x0'));var util=require(_0x051b('0x1'));var path=require(_0x051b('0x2'));var timeout=require(_0x051b('0x3'));var express=require(_0x051b('0x4'));var router=express[_0x051b('0x5')]();var auth=require(_0x051b('0x6'));var interaction=require(_0x051b('0x7'));var config=require('../../config/environment');var controller=require(_0x051b('0x8'));router['get']('/',auth[_0x051b('0x9')](),controller[_0x051b('0xa')]);router[_0x051b('0xb')](_0x051b('0xc'),auth[_0x051b('0x9')](),controller[_0x051b('0xd')]);router[_0x051b('0xb')](_0x051b('0xe'),auth[_0x051b('0x9')](),controller['getMessages']);router[_0x051b('0xf')]('/',auth[_0x051b('0x9')](),controller[_0x051b('0x10')]);router[_0x051b('0x11')]('/:id',auth[_0x051b('0x9')](),controller[_0x051b('0x12')]);router[_0x051b('0x13')](_0x051b('0xc'),auth[_0x051b('0x9')](),controller['destroy']);module[_0x051b('0x14')]=router; \ No newline at end of file +var _0xb6e5=['/:id','show','/:id/messages','getMessages','post','create','put','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x560bb9,_0x13cd87){var _0x287e27=function(_0x3b2a81){while(--_0x3b2a81){_0x560bb9['push'](_0x560bb9['shift']());}};_0x287e27(++_0x13cd87);}(_0xb6e5,0xbe));var _0x5b6e=function(_0x3b67a7,_0x2edc12){_0x3b67a7=_0x3b67a7-0x0;var _0x5132f7=_0xb6e5[_0x3b67a7];return _0x5132f7;};'use strict';var multer=require('multer');var util=require(_0x5b6e('0x0'));var path=require(_0x5b6e('0x1'));var timeout=require(_0x5b6e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x5b6e('0x3'));var interaction=require(_0x5b6e('0x4'));var config=require(_0x5b6e('0x5'));var controller=require('./voiceMail.controller');router['get']('/',auth[_0x5b6e('0x6')](),controller['index']);router[_0x5b6e('0x7')](_0x5b6e('0x8'),auth[_0x5b6e('0x6')](),controller[_0x5b6e('0x9')]);router['get'](_0x5b6e('0xa'),auth[_0x5b6e('0x6')](),controller[_0x5b6e('0xb')]);router[_0x5b6e('0xc')]('/',auth[_0x5b6e('0x6')](),controller[_0x5b6e('0xd')]);router[_0x5b6e('0xe')](_0x5b6e('0x8'),auth[_0x5b6e('0x6')](),controller['update']);router[_0x5b6e('0xf')](_0x5b6e('0x8'),auth[_0x5b6e('0x6')](),controller[_0x5b6e('0x10')]);module[_0x5b6e('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index c0593df..e7b0220 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 _0x5eb8=['email','trim','central','yes','ENUM','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x40d73d,_0x107d1a){var _0x1e7882=function(_0xcfe745){while(--_0xcfe745){_0x40d73d['push'](_0x40d73d['shift']());}};_0x1e7882(++_0x107d1a);}(_0x5eb8,0xb0));var _0x85eb=function(_0x50148e,_0x4c99c7){_0x50148e=_0x50148e-0x0;var _0x446e9d=_0x5eb8[_0x50148e];return _0x446e9d;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x85eb('0x0')]},'context':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':_0x85eb('0x1'),'unique':_0x85eb('0x2')},'mailbox':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':'','allowNull':![],'unique':_0x85eb('0x2')},'password':{'type':Sequelize[_0x85eb('0x0')]},'fullname':{'type':Sequelize[_0x85eb('0x0')]},'email':{'type':Sequelize[_0x85eb('0x0')],'validate':{'isEmail':!![]},'set':function(_0x1fde1a){this[_0x85eb('0x3')](_0x85eb('0x4'),typeof _0x1fde1a==='string'&&_0x1fde1a[_0x85eb('0x5')]()?_0x1fde1a[_0x85eb('0x5')]():null);}},'pager':{'type':Sequelize[_0x85eb('0x0')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x85eb('0x6')},'attach':{'type':Sequelize['ENUM'](_0x85eb('0x7'),'no'),'defaultValue':_0x85eb('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x85eb('0x8')](_0x85eb('0x7'),'no'),'defaultValue':_0x85eb('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x85eb('0x0')]},'callback':{'type':Sequelize[_0x85eb('0x0')]},'review':{'type':Sequelize['ENUM'](_0x85eb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x85eb('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x85eb('0x8')](_0x85eb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x85eb('0x8')](_0x85eb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x85eb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x85eb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x85eb('0x8')](_0x85eb('0x7'),'no'),'defaultValue':_0x85eb('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x85eb('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x85eb('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x85eb('0x8')](_0x85eb('0x7'),'no'),'defaultValue':_0x85eb('0x7'),'allowNull':![]},'stamp':{'type':_0x85eb('0x9')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x85eb('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x85eb('0xb')],'get':function(){return this[_0x85eb('0xc')](_0x85eb('0xd'))+_0x85eb('0xe')+this[_0x85eb('0xc')]('mailbox');}}}; \ No newline at end of file +var _0xed3c=['INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','yes','ENUM','TINYINT(4)','TIMESTAMP'];(function(_0x560126,_0x1cff27){var _0x41ef92=function(_0x3e1731){while(--_0x3e1731){_0x560126['push'](_0x560126['shift']());}};_0x41ef92(++_0x1cff27);}(_0xed3c,0x1a6));var _0xced3=function(_0x3428a8,_0x4859c7){_0x3428a8=_0x3428a8-0x0;var _0x538873=_0xed3c[_0x3428a8];return _0x538873;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'customer_id':{'type':Sequelize[_0xced3('0x2')]},'context':{'type':Sequelize[_0xced3('0x2')],'defaultValue':'from-voicemail','unique':_0xced3('0x3')},'mailbox':{'type':Sequelize[_0xced3('0x2')],'defaultValue':'','allowNull':![],'unique':_0xced3('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xced3('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1ada18){this[_0xced3('0x4')](_0xced3('0x5'),typeof _0x1ada18==='string'&&_0x1ada18['trim']()?_0x1ada18['trim']():null);}},'pager':{'type':Sequelize[_0xced3('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0xced3('0x6'),'no'),'defaultValue':_0xced3('0x6'),'allowNull':![]},'saycid':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':_0xced3('0x6'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xced3('0x2')]},'review':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xced3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xced3('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xced3('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xced3('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':_0xced3('0x6'),'allowNull':![]},'forcename':{'type':Sequelize[_0xced3('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xced3('0x6'),'no'),'defaultValue':_0xced3('0x6'),'allowNull':![]},'stamp':{'type':_0xced3('0x9')},'emailsubject':{'type':Sequelize[_0xced3('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xced3('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xced3('0xb')],'get':function(){return this[_0xced3('0xc')](_0xced3('0xd'))+_0xced3('0xe')+this[_0xced3('0xc')](_0xced3('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 650d0db..115c420 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 _0x5428=['json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','Voicemails','end','error','map','VoiceMail','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','nolimit','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','status'];(function(_0x230e39,_0x5341){var _0xa804e=function(_0xe14796){while(--_0xe14796){_0x230e39['push'](_0x230e39['shift']());}};_0xa804e(++_0x5341);}(_0x5428,0xd5));var _0x8542=function(_0x2cae82,_0x3a2e21){_0x2cae82=_0x2cae82-0x0;var _0x59baa4=_0x5428[_0x2cae82];return _0x59baa4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8542('0x0'));var rimraf=require(_0x8542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8542('0x2'));var rp=require(_0x8542('0x3'));var moment=require(_0x8542('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8542('0x5'));var sox=require(_0x8542('0x6'));var csv=require(_0x8542('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8542('0x8'));var squel=require('squel');var crypto=require(_0x8542('0x9'));var jsforce=require(_0x8542('0xa'));var deskjs=require(_0x8542('0xb'));var toCsv=require(_0x8542('0x7'));var querystring=require(_0x8542('0xc'));var Papa=require('papaparse');var Redis=require(_0x8542('0xd'));var authService=require(_0x8542('0xe'));var qs=require(_0x8542('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8542('0x10'));var logger=require(_0x8542('0x11'))(_0x8542('0x12'));var utils=require(_0x8542('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52936d,_0x13e2d7){_0x13e2d7=_0x13e2d7||0xcc;return function(_0x5d2f9d){if(_0x5d2f9d){return _0x52936d['sendStatus'](_0x13e2d7);}return _0x52936d[_0x8542('0x14')](_0x13e2d7)['end']();};}function respondWithResult(_0x35725e,_0x4bd4ef){_0x4bd4ef=_0x4bd4ef||0xc8;return function(_0x5645e4){if(_0x5645e4){return _0x35725e[_0x8542('0x14')](_0x4bd4ef)[_0x8542('0x15')](_0x5645e4);}};}function respondWithFilteredResult(_0x857a82,_0x39a828){return function(_0x56048a){if(_0x56048a){var _0x5a9f7c=_0x56048a[_0x8542('0x16')],_0x33784d=_0x39a828[_0x8542('0x17')],_0x1b6d56=_0x39a828[_0x8542('0x17')]+_0x39a828[_0x8542('0x18')],_0x390057;if(_0x1b6d56>=_0x5a9f7c){_0x1b6d56=_0x5a9f7c;_0x390057=0xc8;}else{_0x390057=0xce;}_0x857a82[_0x8542('0x14')](_0x390057);return _0x857a82['set'](_0x8542('0x19'),_0x33784d+'-'+_0x1b6d56+'/'+_0x5a9f7c)['json'](_0x56048a);}return null;};}function patchUpdates(_0x245d7f){return function(_0x3e2b5c){try{jsonpatch[_0x8542('0x1a')](_0x3e2b5c,_0x245d7f,!![]);}catch(_0x48ff09){return BPromise[_0x8542('0x1b')](_0x48ff09);}return _0x3e2b5c[_0x8542('0x1c')]();};}function saveUpdates(_0x18f1a5,_0x1a177d){return function(_0x4fa5f4){if(_0x4fa5f4){return _0x4fa5f4[_0x8542('0x1d')](_0x18f1a5)['then'](function(_0x1e4903){return _0x1e4903;});}return null;};}function removeEntity(_0x13067a,_0x1c18e1){return function(_0x27a6ff){if(_0x27a6ff){return _0x27a6ff[_0x8542('0x1e')]()[_0x8542('0x1f')](function(){var _0x1f8afd=_0x27a6ff[_0x8542('0x20')]({'plain':!![]});var _0x379a19=_0x8542('0x21');return db['UserProfileResource'][_0x8542('0x1e')]({'where':{'type':_0x379a19,'resourceId':_0x1f8afd['id']}})[_0x8542('0x1f')](function(){return _0x27a6ff;});})['then'](function(){_0x13067a[_0x8542('0x14')](0xcc)[_0x8542('0x22')]();});}};}function handleEntityNotFound(_0x266f2a,_0x54d714){return function(_0x436d2c){if(!_0x436d2c){_0x266f2a['sendStatus'](0x194);}return _0x436d2c;};}function handleError(_0x2f89ea,_0x173bb3){_0x173bb3=_0x173bb3||0x1f4;return function(_0x6be796){logger[_0x8542('0x23')](_0x6be796['stack']);if(_0x6be796['name']){delete _0x6be796['name'];}_0x2f89ea['status'](_0x173bb3)['send'](_0x6be796);};}exports['index']=function(_0x160aad,_0x27bcd0){var _0x283fb4={},_0x556671={},_0x35e783={'count':0x0,'rows':[]};var _0x576fdd=_[_0x8542('0x24')](db[_0x8542('0x25')]['rawAttributes'],function(_0x415871){return{'name':_0x415871['fieldName'],'type':_0x415871['type'][_0x8542('0x26')]};});_0x556671[_0x8542('0x27')]=_[_0x8542('0x24')](_0x576fdd,_0x8542('0x28'));_0x556671[_0x8542('0x29')]=_[_0x8542('0x2a')](_0x160aad[_0x8542('0x29')]);_0x556671[_0x8542('0x2b')]=_[_0x8542('0x2c')](_0x556671[_0x8542('0x27')],_0x556671[_0x8542('0x29')]);_0x283fb4[_0x8542('0x2d')]=_[_0x8542('0x2c')](_0x556671[_0x8542('0x27')],qs[_0x8542('0x2e')](_0x160aad[_0x8542('0x29')][_0x8542('0x2e')]));_0x283fb4['attributes']=_0x283fb4[_0x8542('0x2d')][_0x8542('0x2f')]?_0x283fb4[_0x8542('0x2d')]:_0x556671[_0x8542('0x27')];if(!_0x160aad['query'][_0x8542('0x30')]('nolimit')){_0x283fb4[_0x8542('0x18')]=qs[_0x8542('0x18')](_0x160aad[_0x8542('0x29')][_0x8542('0x18')]);_0x283fb4[_0x8542('0x17')]=qs[_0x8542('0x17')](_0x160aad[_0x8542('0x29')][_0x8542('0x17')]);}_0x283fb4[_0x8542('0x31')]=qs[_0x8542('0x32')](_0x160aad[_0x8542('0x29')][_0x8542('0x32')]);_0x283fb4[_0x8542('0x33')]=qs[_0x8542('0x2b')](_[_0x8542('0x34')](_0x160aad[_0x8542('0x29')],_0x556671[_0x8542('0x2b')]),_0x576fdd);if(_0x160aad[_0x8542('0x29')]['filter']){_0x283fb4[_0x8542('0x33')]=_['merge'](_0x283fb4[_0x8542('0x33')],{'$or':_[_0x8542('0x24')](_0x576fdd,function(_0x1cb264){if(_0x1cb264[_0x8542('0x35')]!==_0x8542('0x36')){var _0x4337a1={};_0x4337a1[_0x1cb264['name']]={'$like':'%'+_0x160aad[_0x8542('0x29')][_0x8542('0x37')]+'%'};return _0x4337a1;}})});}_0x283fb4=_[_0x8542('0x38')]({},_0x283fb4,_0x160aad[_0x8542('0x39')]);var _0x44d87b={'where':_0x283fb4[_0x8542('0x33')]};return db['VoiceMail']['count'](_0x44d87b)[_0x8542('0x1f')](function(_0x230ea8){_0x35e783[_0x8542('0x16')]=_0x230ea8;if(_0x160aad[_0x8542('0x29')]['includeAll']){_0x283fb4[_0x8542('0x3a')]=[{'all':!![]}];}return db[_0x8542('0x25')][_0x8542('0x3b')](_0x283fb4);})[_0x8542('0x1f')](function(_0x32b6b1){_0x35e783[_0x8542('0x3c')]=_0x32b6b1;return _0x35e783;})['then'](respondWithFilteredResult(_0x27bcd0,_0x283fb4))[_0x8542('0x3d')](handleError(_0x27bcd0,null));};exports[_0x8542('0x3e')]=function(_0x48d492,_0x2192c0){var _0x13907b={'raw':!![],'where':{'id':_0x48d492[_0x8542('0x3f')]['id']}},_0x35c415={};_0x35c415[_0x8542('0x27')]=_[_0x8542('0x2a')](db[_0x8542('0x25')][_0x8542('0x40')]);_0x35c415[_0x8542('0x29')]=_['keys'](_0x48d492[_0x8542('0x29')]);_0x35c415['filters']=_[_0x8542('0x2c')](_0x35c415['model'],_0x35c415[_0x8542('0x29')]);_0x13907b[_0x8542('0x2d')]=_[_0x8542('0x2c')](_0x35c415[_0x8542('0x27')],qs[_0x8542('0x2e')](_0x48d492[_0x8542('0x29')][_0x8542('0x2e')]));_0x13907b[_0x8542('0x2d')]=_0x13907b[_0x8542('0x2d')]['length']?_0x13907b[_0x8542('0x2d')]:_0x35c415[_0x8542('0x27')];if(_0x48d492[_0x8542('0x29')]['includeAll']){_0x13907b[_0x8542('0x3a')]=[{'all':!![]}];}_0x13907b=_[_0x8542('0x38')]({},_0x13907b,_0x48d492[_0x8542('0x39')]);return db[_0x8542('0x25')][_0x8542('0x41')](_0x13907b)[_0x8542('0x1f')](handleEntityNotFound(_0x2192c0,null))[_0x8542('0x1f')](respondWithResult(_0x2192c0,null))[_0x8542('0x3d')](handleError(_0x2192c0,null));};exports[_0x8542('0x42')]=function(_0x25108d,_0x3bc160){return db[_0x8542('0x25')][_0x8542('0x42')](_0x25108d[_0x8542('0x43')],{})[_0x8542('0x1f')](function(_0x2ffad5){var _0xe356ff=_0x25108d['user'][_0x8542('0x20')]({'plain':!![]});if(!_0xe356ff)throw new Error(_0x8542('0x44'));if(_0xe356ff['role']==='user'){var _0x40652d=_0x2ffad5[_0x8542('0x20')]({'plain':!![]});var _0x48158a='Voicemails';return db['UserProfileSection'][_0x8542('0x41')]({'where':{'name':_0x48158a,'userProfileId':_0xe356ff[_0x8542('0x45')]},'raw':!![]})[_0x8542('0x1f')](function(_0x15c580){if(_0x15c580&&_0x15c580[_0x8542('0x46')]===0x0){return db[_0x8542('0x47')]['create']({'name':_0x40652d[_0x8542('0x28')],'resourceId':_0x40652d['id'],'type':_0x15c580[_0x8542('0x28')],'sectionId':_0x15c580['id']},{})[_0x8542('0x1f')](function(){return _0x2ffad5;});}else{return _0x2ffad5;}})[_0x8542('0x3d')](function(_0x209aa3){logger[_0x8542('0x23')](_0x8542('0x48'),_0x209aa3);throw _0x209aa3;});}return _0x2ffad5;})[_0x8542('0x1f')](respondWithResult(_0x3bc160,0xc9))[_0x8542('0x3d')](handleError(_0x3bc160,null));};exports[_0x8542('0x1d')]=function(_0x1bc28e,_0x3e5745){if(_0x1bc28e[_0x8542('0x43')]['id']){delete _0x1bc28e[_0x8542('0x43')]['id'];}return db['VoiceMail'][_0x8542('0x41')]({'where':{'id':_0x1bc28e['params']['id']}})[_0x8542('0x1f')](handleEntityNotFound(_0x3e5745,null))[_0x8542('0x1f')](saveUpdates(_0x1bc28e['body'],null))[_0x8542('0x1f')](respondWithResult(_0x3e5745,null))[_0x8542('0x3d')](handleError(_0x3e5745,null));};exports[_0x8542('0x1e')]=function(_0x2589ec,_0x20e0d0){return db[_0x8542('0x25')][_0x8542('0x41')]({'where':{'id':_0x2589ec[_0x8542('0x3f')]['id']}})[_0x8542('0x1f')](handleEntityNotFound(_0x20e0d0,null))['then'](removeEntity(_0x20e0d0,null))[_0x8542('0x3d')](handleError(_0x20e0d0,null));};exports[_0x8542('0x49')]=function(_0x164477,_0x4c6d90,_0x12adfb){return db[_0x8542('0x25')][_0x8542('0x4a')]({'where':{'id':_0x164477['params']['id']}})[_0x8542('0x1f')](handleEntityNotFound(_0x4c6d90,null))[_0x8542('0x1f')](function(_0x425660){var _0x49560a;var _0x4b56ff={},_0x14ad06={};_0x14ad06[_0x8542('0x27')]=_[_0x8542('0x2a')](db[_0x8542('0x4b')][_0x8542('0x40')]);_0x14ad06[_0x8542('0x29')]=_['keys'](_0x164477[_0x8542('0x29')]);_0x14ad06[_0x8542('0x2b')]=_[_0x8542('0x2c')](_0x14ad06[_0x8542('0x27')],_0x14ad06['query']);_0x4b56ff['attributes']=_[_0x8542('0x2c')](_0x14ad06[_0x8542('0x27')],qs[_0x8542('0x2e')](_0x164477[_0x8542('0x29')]['fields']));_0x4b56ff[_0x8542('0x2d')]=_0x4b56ff[_0x8542('0x2d')][_0x8542('0x2f')]?_0x4b56ff['attributes']:_0x14ad06[_0x8542('0x27')];if(!_0x164477[_0x8542('0x29')][_0x8542('0x30')](_0x8542('0x4c'))){_0x4b56ff[_0x8542('0x18')]=qs['limit'](_0x164477['query'][_0x8542('0x18')]);_0x4b56ff[_0x8542('0x17')]=qs[_0x8542('0x17')](_0x164477[_0x8542('0x29')]['offset']);}_0x4b56ff[_0x8542('0x31')]=qs[_0x8542('0x32')](_0x164477['query'][_0x8542('0x32')]);_0x4b56ff[_0x8542('0x33')]=qs[_0x8542('0x2b')](_[_0x8542('0x34')](_0x164477[_0x8542('0x29')],_0x14ad06['filters']));if(_0x164477[_0x8542('0x29')]['filter']){_0x4b56ff[_0x8542('0x33')]=_['merge'](_0x4b56ff[_0x8542('0x33')],{'$or':_[_0x8542('0x24')](_0x4b56ff[_0x8542('0x2d')],function(_0x520f86){var _0xf4de63={};_0xf4de63[_0x520f86]={'$like':'%'+_0x164477[_0x8542('0x29')][_0x8542('0x37')]+'%'};return _0xf4de63;})});}_0x4b56ff[_0x8542('0x33')]=_[_0x8542('0x38')](_0x4b56ff[_0x8542('0x33')],{'mailboxuser':_0x425660['mailbox']});_0x4b56ff=_['merge']({},_0x4b56ff,_0x164477[_0x8542('0x39')]);return db[_0x8542('0x4b')][_0x8542('0x4d')](_0x4b56ff)[_0x8542('0x1f')](respondWithFilteredResult(_0x4c6d90,_0x4b56ff));})[_0x8542('0x3d')](handleError(_0x4c6d90,null));}; \ No newline at end of file +var _0x30f3=['querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','Voicemails','UserProfileResource','destroy','error','stack','name','send','map','VoiceMail','rawAttributes','type','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','includeAll','include','findAll','catch','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','squel','crypto','jsforce'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x30f3,0x94));var _0x330f=function(_0x4c1b76,_0x2cdc2d){_0x4c1b76=_0x4c1b76-0x0;var _0x3ace6b=_0x30f3[_0x4c1b76];return _0x3ace6b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x330f('0x0'));var rimraf=require(_0x330f('0x1'));var zipdir=require(_0x330f('0x2'));var jsonpatch=require(_0x330f('0x3'));var rp=require(_0x330f('0x4'));var moment=require('moment');var BPromise=require(_0x330f('0x5'));var Mustache=require(_0x330f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x330f('0x7'));var csv=require('to-csv');var ejs=require(_0x330f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x330f('0x9'));var crypto=require(_0x330f('0xa'));var jsforce=require(_0x330f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x330f('0xc'));var Papa=require(_0x330f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x330f('0xe'));var hardwareService=require(_0x330f('0xf'));var logger=require(_0x330f('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x330f('0x11'));var db=require(_0x330f('0x12'))['db'];function respondWithStatusCode(_0x53bcfa,_0x312b14){_0x312b14=_0x312b14||0xcc;return function(_0x3e0a67){if(_0x3e0a67){return _0x53bcfa[_0x330f('0x13')](_0x312b14);}return _0x53bcfa[_0x330f('0x14')](_0x312b14)[_0x330f('0x15')]();};}function respondWithResult(_0x50cdb9,_0x3daf64){_0x3daf64=_0x3daf64||0xc8;return function(_0x138120){if(_0x138120){return _0x50cdb9[_0x330f('0x14')](_0x3daf64)[_0x330f('0x16')](_0x138120);}};}function respondWithFilteredResult(_0x460caa,_0x55e2df){return function(_0xb27150){if(_0xb27150){var _0x654668=_0xb27150[_0x330f('0x17')],_0x3d02a1=_0x55e2df[_0x330f('0x18')],_0x222764=_0x55e2df[_0x330f('0x18')]+_0x55e2df[_0x330f('0x19')],_0x3023ab;if(_0x222764>=_0x654668){_0x222764=_0x654668;_0x3023ab=0xc8;}else{_0x3023ab=0xce;}_0x460caa['status'](_0x3023ab);return _0x460caa[_0x330f('0x1a')](_0x330f('0x1b'),_0x3d02a1+'-'+_0x222764+'/'+_0x654668)['json'](_0xb27150);}return null;};}function patchUpdates(_0x2071aa){return function(_0x2404d8){try{jsonpatch[_0x330f('0x1c')](_0x2404d8,_0x2071aa,!![]);}catch(_0x64f7b){return BPromise[_0x330f('0x1d')](_0x64f7b);}return _0x2404d8[_0x330f('0x1e')]();};}function saveUpdates(_0x5bcdb0,_0x24c411){return function(_0x5566c8){if(_0x5566c8){return _0x5566c8[_0x330f('0x1f')](_0x5bcdb0)[_0x330f('0x20')](function(_0x4d70ea){return _0x4d70ea;});}return null;};}function removeEntity(_0xfdf204,_0x274a12){return function(_0x43590f){if(_0x43590f){return _0x43590f['destroy']()['then'](function(){var _0x20558a=_0x43590f['get']({'plain':!![]});var _0x2ec965=_0x330f('0x21');return db[_0x330f('0x22')][_0x330f('0x23')]({'where':{'type':_0x2ec965,'resourceId':_0x20558a['id']}})[_0x330f('0x20')](function(){return _0x43590f;});})[_0x330f('0x20')](function(){_0xfdf204[_0x330f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fb8d9,_0x148854){return function(_0x15dc88){if(!_0x15dc88){_0x2fb8d9[_0x330f('0x13')](0x194);}return _0x15dc88;};}function handleError(_0x3e75de,_0xbf80b7){_0xbf80b7=_0xbf80b7||0x1f4;return function(_0x2cea21){logger[_0x330f('0x24')](_0x2cea21[_0x330f('0x25')]);if(_0x2cea21[_0x330f('0x26')]){delete _0x2cea21[_0x330f('0x26')];}_0x3e75de[_0x330f('0x14')](_0xbf80b7)[_0x330f('0x27')](_0x2cea21);};}exports['index']=function(_0x535e26,_0xe45ae4){var _0x5fbe7e={},_0x470c9b={},_0x39ef8d={'count':0x0,'rows':[]};var _0x3f4a88=_[_0x330f('0x28')](db[_0x330f('0x29')][_0x330f('0x2a')],function(_0x1f4861){return{'name':_0x1f4861['fieldName'],'type':_0x1f4861[_0x330f('0x2b')]['key']};});_0x470c9b['model']=_['map'](_0x3f4a88,_0x330f('0x26'));_0x470c9b[_0x330f('0x2c')]=_[_0x330f('0x2d')](_0x535e26[_0x330f('0x2c')]);_0x470c9b['filters']=_['intersection'](_0x470c9b['model'],_0x470c9b[_0x330f('0x2c')]);_0x5fbe7e[_0x330f('0x2e')]=_[_0x330f('0x2f')](_0x470c9b[_0x330f('0x30')],qs[_0x330f('0x31')](_0x535e26[_0x330f('0x2c')][_0x330f('0x31')]));_0x5fbe7e[_0x330f('0x2e')]=_0x5fbe7e[_0x330f('0x2e')][_0x330f('0x32')]?_0x5fbe7e[_0x330f('0x2e')]:_0x470c9b[_0x330f('0x30')];if(!_0x535e26[_0x330f('0x2c')][_0x330f('0x33')]('nolimit')){_0x5fbe7e[_0x330f('0x19')]=qs[_0x330f('0x19')](_0x535e26[_0x330f('0x2c')][_0x330f('0x19')]);_0x5fbe7e['offset']=qs[_0x330f('0x18')](_0x535e26[_0x330f('0x2c')]['offset']);}_0x5fbe7e[_0x330f('0x34')]=qs[_0x330f('0x35')](_0x535e26['query'][_0x330f('0x35')]);_0x5fbe7e[_0x330f('0x36')]=qs[_0x330f('0x37')](_[_0x330f('0x38')](_0x535e26[_0x330f('0x2c')],_0x470c9b['filters']),_0x3f4a88);if(_0x535e26[_0x330f('0x2c')][_0x330f('0x39')]){_0x5fbe7e[_0x330f('0x36')]=_['merge'](_0x5fbe7e[_0x330f('0x36')],{'$or':_['map'](_0x3f4a88,function(_0x140201){if(_0x140201[_0x330f('0x2b')]!=='VIRTUAL'){var _0x1f16ed={};_0x1f16ed[_0x140201[_0x330f('0x26')]]={'$like':'%'+_0x535e26['query'][_0x330f('0x39')]+'%'};return _0x1f16ed;}})});}_0x5fbe7e=_['merge']({},_0x5fbe7e,_0x535e26['options']);var _0x136b23={'where':_0x5fbe7e[_0x330f('0x36')]};return db['VoiceMail']['count'](_0x136b23)['then'](function(_0x80a23a){_0x39ef8d['count']=_0x80a23a;if(_0x535e26['query'][_0x330f('0x3a')]){_0x5fbe7e[_0x330f('0x3b')]=[{'all':!![]}];}return db[_0x330f('0x29')][_0x330f('0x3c')](_0x5fbe7e);})[_0x330f('0x20')](function(_0x30660c){_0x39ef8d['rows']=_0x30660c;return _0x39ef8d;})[_0x330f('0x20')](respondWithFilteredResult(_0xe45ae4,_0x5fbe7e))[_0x330f('0x3d')](handleError(_0xe45ae4,null));};exports['show']=function(_0x30dfb4,_0x41f85c){var _0xd24367={'raw':!![],'where':{'id':_0x30dfb4['params']['id']}},_0xfbfc8={};_0xfbfc8[_0x330f('0x30')]=_['keys'](db[_0x330f('0x29')][_0x330f('0x2a')]);_0xfbfc8['query']=_[_0x330f('0x2d')](_0x30dfb4['query']);_0xfbfc8['filters']=_[_0x330f('0x2f')](_0xfbfc8[_0x330f('0x30')],_0xfbfc8[_0x330f('0x2c')]);_0xd24367[_0x330f('0x2e')]=_[_0x330f('0x2f')](_0xfbfc8['model'],qs[_0x330f('0x31')](_0x30dfb4['query'][_0x330f('0x31')]));_0xd24367[_0x330f('0x2e')]=_0xd24367[_0x330f('0x2e')][_0x330f('0x32')]?_0xd24367[_0x330f('0x2e')]:_0xfbfc8[_0x330f('0x30')];if(_0x30dfb4[_0x330f('0x2c')][_0x330f('0x3a')]){_0xd24367[_0x330f('0x3b')]=[{'all':!![]}];}_0xd24367=_[_0x330f('0x3e')]({},_0xd24367,_0x30dfb4[_0x330f('0x3f')]);return db[_0x330f('0x29')]['find'](_0xd24367)[_0x330f('0x20')](handleEntityNotFound(_0x41f85c,null))['then'](respondWithResult(_0x41f85c,null))[_0x330f('0x3d')](handleError(_0x41f85c,null));};exports[_0x330f('0x40')]=function(_0x45cc2c,_0x439fcd){return db[_0x330f('0x29')][_0x330f('0x40')](_0x45cc2c[_0x330f('0x41')],{})[_0x330f('0x20')](function(_0x110d6e){var _0x2592d5=_0x45cc2c[_0x330f('0x42')][_0x330f('0x43')]({'plain':!![]});if(!_0x2592d5)throw new Error(_0x330f('0x44'));if(_0x2592d5[_0x330f('0x45')]===_0x330f('0x42')){var _0x291ec2=_0x110d6e[_0x330f('0x43')]({'plain':!![]});var _0x3e14d3='Voicemails';return db[_0x330f('0x46')][_0x330f('0x47')]({'where':{'name':_0x3e14d3,'userProfileId':_0x2592d5[_0x330f('0x48')]},'raw':!![]})['then'](function(_0xf7a04e){if(_0xf7a04e&&_0xf7a04e['autoAssociation']===0x0){return db[_0x330f('0x22')][_0x330f('0x40')]({'name':_0x291ec2[_0x330f('0x26')],'resourceId':_0x291ec2['id'],'type':_0xf7a04e[_0x330f('0x26')],'sectionId':_0xf7a04e['id']},{})['then'](function(){return _0x110d6e;});}else{return _0x110d6e;}})[_0x330f('0x3d')](function(_0x5f1f1f){logger[_0x330f('0x24')](_0x330f('0x49'),_0x5f1f1f);throw _0x5f1f1f;});}return _0x110d6e;})['then'](respondWithResult(_0x439fcd,0xc9))[_0x330f('0x3d')](handleError(_0x439fcd,null));};exports[_0x330f('0x1f')]=function(_0xc55b66,_0x25cae2){if(_0xc55b66[_0x330f('0x41')]['id']){delete _0xc55b66[_0x330f('0x41')]['id'];}return db[_0x330f('0x29')][_0x330f('0x47')]({'where':{'id':_0xc55b66['params']['id']}})[_0x330f('0x20')](handleEntityNotFound(_0x25cae2,null))[_0x330f('0x20')](saveUpdates(_0xc55b66[_0x330f('0x41')],null))[_0x330f('0x20')](respondWithResult(_0x25cae2,null))[_0x330f('0x3d')](handleError(_0x25cae2,null));};exports['destroy']=function(_0xf3c704,_0x2826e7){return db[_0x330f('0x29')][_0x330f('0x47')]({'where':{'id':_0xf3c704[_0x330f('0x4a')]['id']}})[_0x330f('0x20')](handleEntityNotFound(_0x2826e7,null))[_0x330f('0x20')](removeEntity(_0x2826e7,null))[_0x330f('0x3d')](handleError(_0x2826e7,null));};exports[_0x330f('0x4b')]=function(_0x862080,_0x12a7ad,_0x50dcde){return db[_0x330f('0x29')][_0x330f('0x4c')]({'where':{'id':_0x862080[_0x330f('0x4a')]['id']}})[_0x330f('0x20')](handleEntityNotFound(_0x12a7ad,null))[_0x330f('0x20')](function(_0x541fa3){var _0x52fb41;var _0x520819={},_0x34ce18={};_0x34ce18[_0x330f('0x30')]=_[_0x330f('0x2d')](db[_0x330f('0x4d')][_0x330f('0x2a')]);_0x34ce18['query']=_[_0x330f('0x2d')](_0x862080[_0x330f('0x2c')]);_0x34ce18['filters']=_[_0x330f('0x2f')](_0x34ce18[_0x330f('0x30')],_0x34ce18[_0x330f('0x2c')]);_0x520819[_0x330f('0x2e')]=_['intersection'](_0x34ce18['model'],qs['fields'](_0x862080[_0x330f('0x2c')]['fields']));_0x520819[_0x330f('0x2e')]=_0x520819[_0x330f('0x2e')][_0x330f('0x32')]?_0x520819[_0x330f('0x2e')]:_0x34ce18[_0x330f('0x30')];if(!_0x862080[_0x330f('0x2c')][_0x330f('0x33')](_0x330f('0x4e'))){_0x520819[_0x330f('0x19')]=qs[_0x330f('0x19')](_0x862080[_0x330f('0x2c')][_0x330f('0x19')]);_0x520819['offset']=qs[_0x330f('0x18')](_0x862080[_0x330f('0x2c')][_0x330f('0x18')]);}_0x520819[_0x330f('0x34')]=qs[_0x330f('0x35')](_0x862080[_0x330f('0x2c')][_0x330f('0x35')]);_0x520819['where']=qs[_0x330f('0x37')](_[_0x330f('0x38')](_0x862080[_0x330f('0x2c')],_0x34ce18[_0x330f('0x37')]));if(_0x862080[_0x330f('0x2c')]['filter']){_0x520819[_0x330f('0x36')]=_[_0x330f('0x3e')](_0x520819['where'],{'$or':_['map'](_0x520819['attributes'],function(_0x3f60e7){var _0x300d9c={};_0x300d9c[_0x3f60e7]={'$like':'%'+_0x862080[_0x330f('0x2c')][_0x330f('0x39')]+'%'};return _0x300d9c;})});}_0x520819['where']=_[_0x330f('0x3e')](_0x520819['where'],{'mailboxuser':_0x541fa3[_0x330f('0x4f')]});_0x520819=_[_0x330f('0x3e')]({},_0x520819,_0x862080[_0x330f('0x3f')]);return db[_0x330f('0x4d')]['findAndCountAll'](_0x520819)[_0x330f('0x20')](respondWithFilteredResult(_0x12a7ad,_0x520819));})[_0x330f('0x3d')](handleError(_0x12a7ad,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index e2eacef..846751e 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 _0xa9f3=['../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x1c9326,_0x4f65bd){var _0x33e2e4=function(_0x34bceb){while(--_0x34bceb){_0x1c9326['push'](_0x1c9326['shift']());}};_0x33e2e4(++_0x4f65bd);}(_0xa9f3,0x17f));var _0x3a9f=function(_0x38e11d,_0x4704ce){_0x38e11d=_0x38e11d-0x0;var _0x3d903b=_0xa9f3[_0x38e11d];return _0x3d903b;};'use strict';var _=require(_0x3a9f('0x0'));var util=require(_0x3a9f('0x1'));var logger=require(_0x3a9f('0x2'))('api');var moment=require(_0x3a9f('0x3'));var BPromise=require('bluebird');var rp=require(_0x3a9f('0x4'));var fs=require('fs');var path=require(_0x3a9f('0x5'));var rimraf=require(_0x3a9f('0x6'));var config=require(_0x3a9f('0x7'));var attributes=require(_0x3a9f('0x8'));module[_0x3a9f('0x9')]=function(_0x51a582,_0x764223){return _0x51a582[_0x3a9f('0xa')]('VoiceMail',attributes,{'tableName':_0x3a9f('0xb'),'paranoid':![],'indexes':[{'name':_0x3a9f('0xc'),'fields':[_0x3a9f('0xd'),_0x3a9f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1d1=['rimraf','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x49fb6e,_0x2b1a51){var _0x3c03cc=function(_0x2184ff){while(--_0x2184ff){_0x49fb6e['push'](_0x49fb6e['shift']());}};_0x3c03cc(++_0x2b1a51);}(_0xb1d1,0xbb));var _0x1b1d=function(_0x261bcf,_0x3613ce){_0x261bcf=_0x261bcf-0x0;var _0x74e3dd=_0xb1d1[_0x261bcf];return _0x74e3dd;};'use strict';var _=require(_0x1b1d('0x0'));var util=require(_0x1b1d('0x1'));var logger=require(_0x1b1d('0x2'))(_0x1b1d('0x3'));var moment=require(_0x1b1d('0x4'));var BPromise=require(_0x1b1d('0x5'));var rp=require(_0x1b1d('0x6'));var fs=require('fs');var path=require(_0x1b1d('0x7'));var rimraf=require(_0x1b1d('0x8'));var config=require('../../config/environment');var attributes=require(_0x1b1d('0x9'));module['exports']=function(_0x4e4985,_0x1a402b){return _0x4e4985[_0x1b1d('0xa')](_0x1b1d('0xb'),attributes,{'tableName':_0x1b1d('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x1b1d('0xd'),_0x1b1d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 2ce018a..4d4cc82 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 _0xcad9=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x26368b,_0x44d3d1){var _0x46f6d8=function(_0x21fb29){while(--_0x21fb29){_0x26368b['push'](_0x26368b['shift']());}};_0x46f6d8(++_0x44d3d1);}(_0xcad9,0x178));var _0x9cad=function(_0x199506,_0x300232){_0x199506=_0x199506-0x0;var _0x1bee66=_0xcad9[_0x199506];return _0x1bee66;};'use strict';var _=require(_0x9cad('0x0'));var util=require(_0x9cad('0x1'));var moment=require(_0x9cad('0x2'));var BPromise=require(_0x9cad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cad('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9cad('0x5'));var logger=require(_0x9cad('0x6'))(_0x9cad('0x7'));var config=require(_0x9cad('0x8'));var jayson=require(_0x9cad('0x9'));var client=jayson[_0x9cad('0xa')][_0x9cad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x405ba5,_0x181799,_0x1c2672){return new BPromise(function(_0x3c941d,_0x597d7e){return client[_0x9cad('0xc')](_0x405ba5,_0x1c2672)[_0x9cad('0xd')](function(_0x3e901f){logger['info'](_0x9cad('0xe'),_0x181799,_0x9cad('0xf'));logger[_0x9cad('0x10')](_0x9cad('0x11'),_0x181799,_0x9cad('0xf'),JSON['stringify'](_0x3e901f));if(_0x3e901f['error']){if(_0x3e901f['error']['code']===0x1f4){logger[_0x9cad('0x12')]('VoiceMail,\x20%s,\x20%s',_0x181799,_0x3e901f[_0x9cad('0x12')][_0x9cad('0x13')]);return _0x597d7e(_0x3e901f[_0x9cad('0x12')][_0x9cad('0x13')]);}logger[_0x9cad('0x12')]('VoiceMail,\x20%s,\x20%s',_0x181799,_0x3e901f['error'][_0x9cad('0x13')]);return _0x3c941d(_0x3e901f[_0x9cad('0x12')]['message']);}else{logger['info'](_0x9cad('0xe'),_0x181799,_0x9cad('0xf'));_0x3c941d(_0x3e901f[_0x9cad('0x14')][_0x9cad('0x13')]);}})[_0x9cad('0x15')](function(_0x538b80){logger[_0x9cad('0x12')](_0x9cad('0xe'),_0x181799,_0x538b80);_0x597d7e(_0x538b80);});});} \ No newline at end of file +var _0x2796=['../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2f64e8,_0x4ec85b){var _0x11613b=function(_0xa03035){while(--_0xa03035){_0x2f64e8['push'](_0x2f64e8['shift']());}};_0x11613b(++_0x4ec85b);}(_0x2796,0x1b3));var _0x6279=function(_0x32362b,_0xcc5ca4){_0x32362b=_0x32362b-0x0;var _0x302ba2=_0x2796[_0x32362b];return _0x302ba2;};'use strict';var _=require('lodash');var util=require(_0x6279('0x0'));var moment=require(_0x6279('0x1'));var BPromise=require('bluebird');var rs=require(_0x6279('0x2'));var fs=require('fs');var Redis=require(_0x6279('0x3'));var db=require(_0x6279('0x4'))['db'];var utils=require(_0x6279('0x5'));var logger=require('../../config/logger')(_0x6279('0x6'));var config=require('../../config/environment');var jayson=require(_0x6279('0x7'));var client=jayson[_0x6279('0x8')][_0x6279('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6ac8c,_0x2dad87,_0x11a73c){return new BPromise(function(_0x4e9083,_0x1d01fd){return client[_0x6279('0xa')](_0x6ac8c,_0x11a73c)[_0x6279('0xb')](function(_0x30872a){logger[_0x6279('0xc')](_0x6279('0xd'),_0x2dad87,_0x6279('0xe'));logger[_0x6279('0xf')](_0x6279('0x10'),_0x2dad87,_0x6279('0xe'),JSON[_0x6279('0x11')](_0x30872a));if(_0x30872a[_0x6279('0x12')]){if(_0x30872a[_0x6279('0x12')][_0x6279('0x13')]===0x1f4){logger[_0x6279('0x12')]('VoiceMail,\x20%s,\x20%s',_0x2dad87,_0x30872a[_0x6279('0x12')][_0x6279('0x14')]);return _0x1d01fd(_0x30872a['error'][_0x6279('0x14')]);}logger[_0x6279('0x12')](_0x6279('0xd'),_0x2dad87,_0x30872a[_0x6279('0x12')][_0x6279('0x14')]);return _0x4e9083(_0x30872a[_0x6279('0x12')][_0x6279('0x14')]);}else{logger[_0x6279('0xc')]('VoiceMail,\x20%s,\x20%s',_0x2dad87,_0x6279('0xe'));_0x4e9083(_0x30872a['result']['message']);}})[_0x6279('0x15')](function(_0x5b2b1e){logger[_0x6279('0x12')]('VoiceMail,\x20%s,\x20%s',_0x2dad87,_0x5b2b1e);_0x1d01fd(_0x5b2b1e);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index fb2f705..48b92db 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 _0x187d=['../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','index','/:id','isAuthenticated','show','/:id/download','post','create','put','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0x187d,0x93));var _0xd187=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x187d[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var auth=require(_0xd187('0x5'));var interaction=require(_0xd187('0x6'));var config=require('../../config/environment');var controller=require(_0xd187('0x7'));router[_0xd187('0x8')]('/',auth['isAuthenticated'](),controller[_0xd187('0x9')]);router[_0xd187('0x8')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xc')]);router[_0xd187('0x8')](_0xd187('0xd'),auth[_0xd187('0xb')](),controller['download']);router[_0xd187('0xe')]('/',auth[_0xd187('0xb')](),controller[_0xd187('0xf')]);router[_0xd187('0x10')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller['update']);router[_0xd187('0x11')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller['destroy']);module[_0xd187('0x12')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','update'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc4aa[_0x5d6456];return _0x4d66c1;};'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 diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 151cee2..000ba36 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 _0xcff5=['BLOB','long','TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING'];(function(_0x343178,_0x8da550){var _0x2c4758=function(_0x4ffd13){while(--_0x4ffd13){_0x343178['push'](_0x343178['shift']());}};_0x2c4758(++_0x8da550);}(_0xcff5,0x11b));var _0x5cff=function(_0x34d823,_0x2d20b0){_0x34d823=_0x34d823-0x0;var _0x1eb90c=_0xcff5[_0x34d823];return _0x1eb90c;};'use strict';var Sequelize=require(_0x5cff('0x0'));module[_0x5cff('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x13fd8e){return this[_0x5cff('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x5cff('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5cff('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5cff('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x5cff('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x5cff('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5cff('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5cff('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x5cff('0x5')](_0x5cff('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x5cff('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5cff('0x4')],'defaultValue':''},'stamp':{'type':_0x5cff('0x7'),'allowNull':![]}}; \ No newline at end of file +var _0x642a=['getDataValue','STRING','TIMESTAMP','sequelize','VIRTUAL'];(function(_0x3110b9,_0x194c4c){var _0x1eb6b6=function(_0x10ef65){while(--_0x10ef65){_0x3110b9['push'](_0x3110b9['shift']());}};_0x1eb6b6(++_0x194c4c);}(_0x642a,0x120));var _0xa642=function(_0x15b32b,_0x26b269){_0x15b32b=_0x15b32b-0x0;var _0x55aebb=_0x642a[_0x15b32b];return _0x55aebb;};'use strict';var Sequelize=require(_0xa642('0x0'));module['exports']={'name':{'type':Sequelize[_0xa642('0x1')],'get':function(_0x3d4353){return this[_0xa642('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'stamp':{'type':_0xa642('0x4'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 4f4f5de..be12a22 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 _0x579c=['destroy','error','stack','name','map','VoiceMailMessage','fieldName','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','params','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','send','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','save','update','then'];(function(_0x2f5132,_0x2b2d7b){var _0x15fdca=function(_0x525f52){while(--_0x525f52){_0x2f5132['push'](_0x2f5132['shift']());}};_0x15fdca(++_0x2b2d7b);}(_0x579c,0xda));var _0xc579=function(_0x1d3019,_0x8dbbd5){_0x1d3019=_0x1d3019-0x0;var _0x36458e=_0x579c[_0x1d3019];return _0x36458e;};'use strict';var pdf=require(_0xc579('0x0'));var emlformat=require(_0xc579('0x1'));var rimraf=require(_0xc579('0x2'));var zipdir=require(_0xc579('0x3'));var jsonpatch=require(_0xc579('0x4'));var rp=require('request-promise');var moment=require(_0xc579('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc579('0x6'));var util=require(_0xc579('0x7'));var path=require(_0xc579('0x8'));var sox=require(_0xc579('0x9'));var csv=require(_0xc579('0xa'));var ejs=require(_0xc579('0xb'));var fs=require('fs');var _=require(_0xc579('0xc'));var squel=require('squel');var crypto=require(_0xc579('0xd'));var jsforce=require(_0xc579('0xe'));var deskjs=require(_0xc579('0xf'));var toCsv=require(_0xc579('0xa'));var querystring=require(_0xc579('0x10'));var Papa=require(_0xc579('0x11'));var Redis=require(_0xc579('0x12'));var authService=require(_0xc579('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc579('0x14'));var hardwareService=require(_0xc579('0x15'));var logger=require(_0xc579('0x16'))(_0xc579('0x17'));var utils=require(_0xc579('0x18'));var config=require(_0xc579('0x19'));var db=require(_0xc579('0x1a'))['db'];function respondWithStatusCode(_0x1905b7,_0x421812){_0x421812=_0x421812||0xcc;return function(_0x441028){if(_0x441028){return _0x1905b7[_0xc579('0x1b')](_0x421812);}return _0x1905b7['status'](_0x421812)[_0xc579('0x1c')]();};}function respondWithResult(_0x4f6057,_0xf5400e){_0xf5400e=_0xf5400e||0xc8;return function(_0x59243e){if(_0x59243e){return _0x4f6057[_0xc579('0x1d')](_0xf5400e)['json'](_0x59243e);}};}function respondWithFilteredResult(_0x44cd32,_0x4b3635){return function(_0x349e82){if(_0x349e82){var _0x115276=_0x349e82[_0xc579('0x1e')],_0x567de5=_0x4b3635[_0xc579('0x1f')],_0x54557b=_0x4b3635[_0xc579('0x1f')]+_0x4b3635[_0xc579('0x20')],_0x3f5d14;if(_0x54557b>=_0x115276){_0x54557b=_0x115276;_0x3f5d14=0xc8;}else{_0x3f5d14=0xce;}_0x44cd32[_0xc579('0x1d')](_0x3f5d14);return _0x44cd32[_0xc579('0x21')](_0xc579('0x22'),_0x567de5+'-'+_0x54557b+'/'+_0x115276)[_0xc579('0x23')](_0x349e82);}return null;};}function patchUpdates(_0x45aa9c){return function(_0x5e5f36){try{jsonpatch[_0xc579('0x24')](_0x5e5f36,_0x45aa9c,!![]);}catch(_0x2b7d74){return BPromise['reject'](_0x2b7d74);}return _0x5e5f36[_0xc579('0x25')]();};}function saveUpdates(_0x3b0327,_0x14fcdd){return function(_0x6501bc){if(_0x6501bc){return _0x6501bc[_0xc579('0x26')](_0x3b0327)[_0xc579('0x27')](function(_0x147bb6){return _0x147bb6;});}return null;};}function removeEntity(_0x1b214d,_0x55781e){return function(_0x92657f){if(_0x92657f){return _0x92657f[_0xc579('0x28')]()[_0xc579('0x27')](function(){_0x1b214d[_0xc579('0x1d')](0xcc)[_0xc579('0x1c')]();});}};}function handleEntityNotFound(_0x565a1b,_0x3634f2){return function(_0x3cf83f){if(!_0x3cf83f){_0x565a1b[_0xc579('0x1b')](0x194);}return _0x3cf83f;};}function handleError(_0x4dec5e,_0x45e1ac){_0x45e1ac=_0x45e1ac||0x1f4;return function(_0x5103b7){logger[_0xc579('0x29')](_0x5103b7[_0xc579('0x2a')]);if(_0x5103b7[_0xc579('0x2b')]){delete _0x5103b7['name'];}_0x4dec5e[_0xc579('0x1d')](_0x45e1ac)['send'](_0x5103b7);};}exports['index']=function(_0x56439a,_0x540d90){var _0x3f7363={},_0xfdbb73={},_0x2ddebd={'count':0x0,'rows':[]};var _0x206e39=_[_0xc579('0x2c')](db[_0xc579('0x2d')]['rawAttributes'],function(_0x4d78bc){return{'name':_0x4d78bc[_0xc579('0x2e')],'type':_0x4d78bc['type'][_0xc579('0x2f')]};});_0xfdbb73[_0xc579('0x30')]=_[_0xc579('0x31')](_[_0xc579('0x2c')](_0x206e39,_0xc579('0x2b')),[_0xc579('0x2b')]);_0xfdbb73[_0xc579('0x32')]=_[_0xc579('0x33')](_0x56439a['query']);_0xfdbb73[_0xc579('0x34')]=_[_0xc579('0x35')](_0xfdbb73[_0xc579('0x30')],_0xfdbb73[_0xc579('0x32')]);_0x3f7363['attributes']=_['intersection'](_0xfdbb73[_0xc579('0x30')],qs['fields'](_0x56439a[_0xc579('0x32')][_0xc579('0x36')]));_0x3f7363[_0xc579('0x37')]=_0x3f7363[_0xc579('0x37')][_0xc579('0x38')]?_0x3f7363['attributes']:_0xfdbb73[_0xc579('0x30')];if(!_0x56439a['query'][_0xc579('0x39')](_0xc579('0x3a'))){_0x3f7363['limit']=qs[_0xc579('0x20')](_0x56439a[_0xc579('0x32')]['limit']);_0x3f7363['offset']=qs[_0xc579('0x1f')](_0x56439a[_0xc579('0x32')]['offset']);}_0x3f7363[_0xc579('0x3b')]=qs[_0xc579('0x3c')](_0x56439a['query'][_0xc579('0x3c')]);_0x3f7363['where']=qs[_0xc579('0x34')](_[_0xc579('0x3d')](_0x56439a['query'],_0xfdbb73[_0xc579('0x34')]),_0x206e39);if(_0x56439a[_0xc579('0x32')][_0xc579('0x3e')]){_0x3f7363[_0xc579('0x3f')]=_[_0xc579('0x40')](_0x3f7363[_0xc579('0x3f')],{'$or':_['map'](_0x206e39,function(_0x50e6a3){if(_0x50e6a3[_0xc579('0x41')]!=='VIRTUAL'){var _0xc21792={};_0xc21792[_0x50e6a3[_0xc579('0x2b')]]={'$like':'%'+_0x56439a[_0xc579('0x32')][_0xc579('0x3e')]+'%'};return _0xc21792;}})});}_0x3f7363=_['merge']({},_0x3f7363,_0x56439a[_0xc579('0x42')]);var _0x2864de={'where':_0x3f7363[_0xc579('0x3f')]};return db['VoiceMailMessage']['count'](_0x2864de)['then'](function(_0x1ef28f){_0x2ddebd[_0xc579('0x1e')]=_0x1ef28f;if(_0x56439a[_0xc579('0x32')][_0xc579('0x43')]){_0x3f7363[_0xc579('0x44')]=[{'all':!![]}];}return db[_0xc579('0x2d')]['findAll'](_0x3f7363);})[_0xc579('0x27')](function(_0x53ab02){_0x2ddebd[_0xc579('0x45')]=_0x53ab02;return _0x2ddebd;})[_0xc579('0x27')](respondWithFilteredResult(_0x540d90,_0x3f7363))[_0xc579('0x46')](handleError(_0x540d90,null));};exports[_0xc579('0x47')]=function(_0x3d8f24,_0xd137fe){var _0x120410={'raw':!![],'where':{'id':_0x3d8f24['params']['id']}},_0x44f77e={};_0x44f77e[_0xc579('0x30')]=_[_0xc579('0x33')](db[_0xc579('0x2d')][_0xc579('0x48')]);_0x44f77e[_0xc579('0x32')]=_[_0xc579('0x33')](_0x3d8f24['query']);_0x44f77e[_0xc579('0x34')]=_[_0xc579('0x35')](_0x44f77e[_0xc579('0x30')],_0x44f77e['query']);_0x120410[_0xc579('0x37')]=_[_0xc579('0x35')](_0x44f77e[_0xc579('0x30')],qs['fields'](_0x3d8f24[_0xc579('0x32')]['fields']));_0x120410[_0xc579('0x37')]=_0x120410[_0xc579('0x37')][_0xc579('0x38')]?_0x120410['attributes']:_0x44f77e[_0xc579('0x30')];if(_0x3d8f24[_0xc579('0x32')]['includeAll']){_0x120410['include']=[{'all':!![]}];}_0x120410=_[_0xc579('0x40')]({},_0x120410,_0x3d8f24[_0xc579('0x42')]);return db[_0xc579('0x2d')][_0xc579('0x49')](_0x120410)['then'](handleEntityNotFound(_0xd137fe,null))['then'](respondWithResult(_0xd137fe,null))[_0xc579('0x46')](handleError(_0xd137fe,null));};exports[_0xc579('0x4a')]=function(_0x292b95,_0x216f56){return db['VoiceMailMessage'][_0xc579('0x4a')](_0x292b95[_0xc579('0x4b')],{})['then'](respondWithResult(_0x216f56,0xc9))[_0xc579('0x46')](handleError(_0x216f56,null));};exports['update']=function(_0x5b2851,_0x5b2929){if(_0x5b2851[_0xc579('0x4b')]['id']){delete _0x5b2851[_0xc579('0x4b')]['id'];}return db[_0xc579('0x2d')][_0xc579('0x49')]({'where':{'id':_0x5b2851[_0xc579('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5b2929,null))[_0xc579('0x27')](saveUpdates(_0x5b2851[_0xc579('0x4b')],null))[_0xc579('0x27')](respondWithResult(_0x5b2929,null))['catch'](handleError(_0x5b2929,null));};exports['destroy']=function(_0x1539b5,_0x8c0ad8){return db[_0xc579('0x2d')][_0xc579('0x49')]({'where':{'id':_0x1539b5[_0xc579('0x4c')]['id']}})[_0xc579('0x27')](handleEntityNotFound(_0x8c0ad8,null))[_0xc579('0x27')](removeEntity(_0x8c0ad8,null))['catch'](handleError(_0x8c0ad8,null));};exports['download']=function(_0x43e36d,_0x349c65,_0x58081f){return db[_0xc579('0x2d')]['find']({'where':{'id':_0x43e36d[_0xc579('0x4c')]['id']},'attributes':['id',_0xc579('0x4d'),_0xc579('0x4e')]})[_0xc579('0x27')](handleEntityNotFound(_0x349c65,null))[_0xc579('0x27')](function(_0x297b54){if(_0x297b54){if(!_0x297b54['recording']){throw new db[(_0xc579('0x4f'))][(_0xc579('0x50'))](_0xc579('0x51'));}var _0x5710f1={'Content-Type':_0xc579('0x52'),'Content-Disposition':'attachment'};if(_0x297b54[_0xc579('0x4e')]){_0x5710f1[_0xc579('0x53')]=_0xc579('0x54')+_0x297b54[_0xc579('0x4e')]+'.wav\x22';}_0x349c65['set'](_0x5710f1);return _0x349c65[_0xc579('0x55')](new Buffer(_0x297b54['recording']));}})[_0xc579('0x46')](handleError(_0x349c65,null));}; \ No newline at end of file +var _0x878f=['request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','then','destroy','error','stack','name','index','map','VoiceMailMessage','fieldName','type','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','rawAttributes','length','include','find','body','catch','update','params','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4cf84a,_0x8f3353){var _0x46cd6b=function(_0x6e454e){while(--_0x6e454e){_0x4cf84a['push'](_0x4cf84a['shift']());}};_0x46cd6b(++_0x8f3353);}(_0x878f,0x173));var _0xf878=function(_0x4ecbd0,_0x4c2a3d){_0x4ecbd0=_0x4ecbd0-0x0;var _0xefc830=_0x878f[_0x4ecbd0];return _0xefc830;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf878('0x0'));var rimraf=require(_0xf878('0x1'));var zipdir=require(_0xf878('0x2'));var jsonpatch=require(_0xf878('0x3'));var rp=require(_0xf878('0x4'));var moment=require(_0xf878('0x5'));var BPromise=require(_0xf878('0x6'));var Mustache=require(_0xf878('0x7'));var util=require(_0xf878('0x8'));var path=require(_0xf878('0x9'));var sox=require(_0xf878('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf878('0xb'));var squel=require(_0xf878('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf878('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf878('0xe'));var authService=require(_0xf878('0xf'));var qs=require(_0xf878('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf878('0x11'));var logger=require(_0xf878('0x12'))('api');var utils=require(_0xf878('0x13'));var config=require('../../config/environment');var db=require(_0xf878('0x14'))['db'];function respondWithStatusCode(_0x97c396,_0x339c9c){_0x339c9c=_0x339c9c||0xcc;return function(_0x596fb5){if(_0x596fb5){return _0x97c396[_0xf878('0x15')](_0x339c9c);}return _0x97c396[_0xf878('0x16')](_0x339c9c)[_0xf878('0x17')]();};}function respondWithResult(_0x570dcc,_0xe2c2de){_0xe2c2de=_0xe2c2de||0xc8;return function(_0x3902f7){if(_0x3902f7){return _0x570dcc[_0xf878('0x16')](_0xe2c2de)['json'](_0x3902f7);}};}function respondWithFilteredResult(_0x568a3a,_0x4c0948){return function(_0x35ff2d){if(_0x35ff2d){var _0x31d888=_0x35ff2d[_0xf878('0x18')],_0x6dbeca=_0x4c0948[_0xf878('0x19')],_0x44aacc=_0x4c0948[_0xf878('0x19')]+_0x4c0948[_0xf878('0x1a')],_0x186a02;if(_0x44aacc>=_0x31d888){_0x44aacc=_0x31d888;_0x186a02=0xc8;}else{_0x186a02=0xce;}_0x568a3a[_0xf878('0x16')](_0x186a02);return _0x568a3a['set'](_0xf878('0x1b'),_0x6dbeca+'-'+_0x44aacc+'/'+_0x31d888)[_0xf878('0x1c')](_0x35ff2d);}return null;};}function patchUpdates(_0x412de1){return function(_0x622ea8){try{jsonpatch[_0xf878('0x1d')](_0x622ea8,_0x412de1,!![]);}catch(_0x237d15){return BPromise[_0xf878('0x1e')](_0x237d15);}return _0x622ea8['save']();};}function saveUpdates(_0x73f6bf,_0x140866){return function(_0x250f85){if(_0x250f85){return _0x250f85['update'](_0x73f6bf)[_0xf878('0x1f')](function(_0x23590c){return _0x23590c;});}return null;};}function removeEntity(_0xacc440,_0x392822){return function(_0x22d884){if(_0x22d884){return _0x22d884[_0xf878('0x20')]()[_0xf878('0x1f')](function(){_0xacc440[_0xf878('0x16')](0xcc)[_0xf878('0x17')]();});}};}function handleEntityNotFound(_0x1a6506,_0x45e61f){return function(_0x566995){if(!_0x566995){_0x1a6506[_0xf878('0x15')](0x194);}return _0x566995;};}function handleError(_0x5b0b06,_0xa3d3d3){_0xa3d3d3=_0xa3d3d3||0x1f4;return function(_0x12b32f){logger[_0xf878('0x21')](_0x12b32f[_0xf878('0x22')]);if(_0x12b32f[_0xf878('0x23')]){delete _0x12b32f['name'];}_0x5b0b06['status'](_0xa3d3d3)['send'](_0x12b32f);};}exports[_0xf878('0x24')]=function(_0x3baba4,_0x38fa87){var _0x5af87f={},_0xfa3e11={},_0x2e2256={'count':0x0,'rows':[]};var _0x3e848d=_[_0xf878('0x25')](db[_0xf878('0x26')]['rawAttributes'],function(_0x502322){return{'name':_0x502322[_0xf878('0x27')],'type':_0x502322[_0xf878('0x28')]['key']};});_0xfa3e11[_0xf878('0x29')]=_['differenceBy'](_[_0xf878('0x25')](_0x3e848d,'name'),[_0xf878('0x23')]);_0xfa3e11['query']=_[_0xf878('0x2a')](_0x3baba4['query']);_0xfa3e11[_0xf878('0x2b')]=_[_0xf878('0x2c')](_0xfa3e11[_0xf878('0x29')],_0xfa3e11[_0xf878('0x2d')]);_0x5af87f[_0xf878('0x2e')]=_[_0xf878('0x2c')](_0xfa3e11['model'],qs[_0xf878('0x2f')](_0x3baba4[_0xf878('0x2d')][_0xf878('0x2f')]));_0x5af87f[_0xf878('0x2e')]=_0x5af87f[_0xf878('0x2e')]['length']?_0x5af87f[_0xf878('0x2e')]:_0xfa3e11[_0xf878('0x29')];if(!_0x3baba4['query'][_0xf878('0x30')](_0xf878('0x31'))){_0x5af87f[_0xf878('0x1a')]=qs[_0xf878('0x1a')](_0x3baba4[_0xf878('0x2d')]['limit']);_0x5af87f[_0xf878('0x19')]=qs[_0xf878('0x19')](_0x3baba4[_0xf878('0x2d')][_0xf878('0x19')]);}_0x5af87f['order']=qs[_0xf878('0x32')](_0x3baba4['query']['sort']);_0x5af87f[_0xf878('0x33')]=qs[_0xf878('0x2b')](_[_0xf878('0x34')](_0x3baba4[_0xf878('0x2d')],_0xfa3e11[_0xf878('0x2b')]),_0x3e848d);if(_0x3baba4['query'][_0xf878('0x35')]){_0x5af87f['where']=_[_0xf878('0x36')](_0x5af87f[_0xf878('0x33')],{'$or':_['map'](_0x3e848d,function(_0x1489d5){if(_0x1489d5[_0xf878('0x28')]!=='VIRTUAL'){var _0x329f0b={};_0x329f0b[_0x1489d5[_0xf878('0x23')]]={'$like':'%'+_0x3baba4['query'][_0xf878('0x35')]+'%'};return _0x329f0b;}})});}_0x5af87f=_[_0xf878('0x36')]({},_0x5af87f,_0x3baba4[_0xf878('0x37')]);var _0xc8eb91={'where':_0x5af87f[_0xf878('0x33')]};return db[_0xf878('0x26')][_0xf878('0x18')](_0xc8eb91)['then'](function(_0x1179fb){_0x2e2256[_0xf878('0x18')]=_0x1179fb;if(_0x3baba4['query'][_0xf878('0x38')]){_0x5af87f['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0xf878('0x39')](_0x5af87f);})[_0xf878('0x1f')](function(_0x43b03e){_0x2e2256[_0xf878('0x3a')]=_0x43b03e;return _0x2e2256;})[_0xf878('0x1f')](respondWithFilteredResult(_0x38fa87,_0x5af87f))['catch'](handleError(_0x38fa87,null));};exports[_0xf878('0x3b')]=function(_0x4c4ae4,_0xb09736){var _0x2801b0={'raw':!![],'where':{'id':_0x4c4ae4['params']['id']}},_0x4f6be1={};_0x4f6be1[_0xf878('0x29')]=_[_0xf878('0x2a')](db[_0xf878('0x26')][_0xf878('0x3c')]);_0x4f6be1[_0xf878('0x2d')]=_[_0xf878('0x2a')](_0x4c4ae4[_0xf878('0x2d')]);_0x4f6be1[_0xf878('0x2b')]=_[_0xf878('0x2c')](_0x4f6be1['model'],_0x4f6be1[_0xf878('0x2d')]);_0x2801b0[_0xf878('0x2e')]=_[_0xf878('0x2c')](_0x4f6be1[_0xf878('0x29')],qs[_0xf878('0x2f')](_0x4c4ae4[_0xf878('0x2d')]['fields']));_0x2801b0[_0xf878('0x2e')]=_0x2801b0[_0xf878('0x2e')][_0xf878('0x3d')]?_0x2801b0[_0xf878('0x2e')]:_0x4f6be1[_0xf878('0x29')];if(_0x4c4ae4['query'][_0xf878('0x38')]){_0x2801b0[_0xf878('0x3e')]=[{'all':!![]}];}_0x2801b0=_[_0xf878('0x36')]({},_0x2801b0,_0x4c4ae4[_0xf878('0x37')]);return db['VoiceMailMessage'][_0xf878('0x3f')](_0x2801b0)[_0xf878('0x1f')](handleEntityNotFound(_0xb09736,null))[_0xf878('0x1f')](respondWithResult(_0xb09736,null))['catch'](handleError(_0xb09736,null));};exports['create']=function(_0x9c2fa3,_0x5bf396){return db['VoiceMailMessage']['create'](_0x9c2fa3[_0xf878('0x40')],{})['then'](respondWithResult(_0x5bf396,0xc9))[_0xf878('0x41')](handleError(_0x5bf396,null));};exports[_0xf878('0x42')]=function(_0x1dcb19,_0x1ff60b){if(_0x1dcb19[_0xf878('0x40')]['id']){delete _0x1dcb19[_0xf878('0x40')]['id'];}return db[_0xf878('0x26')]['find']({'where':{'id':_0x1dcb19[_0xf878('0x43')]['id']}})[_0xf878('0x1f')](handleEntityNotFound(_0x1ff60b,null))[_0xf878('0x1f')](saveUpdates(_0x1dcb19[_0xf878('0x40')],null))[_0xf878('0x1f')](respondWithResult(_0x1ff60b,null))['catch'](handleError(_0x1ff60b,null));};exports['destroy']=function(_0xb4f8fb,_0x18c9dc){return db['VoiceMailMessage'][_0xf878('0x3f')]({'where':{'id':_0xb4f8fb['params']['id']}})[_0xf878('0x1f')](handleEntityNotFound(_0x18c9dc,null))[_0xf878('0x1f')](removeEntity(_0x18c9dc,null))[_0xf878('0x41')](handleError(_0x18c9dc,null));};exports[_0xf878('0x44')]=function(_0x5411c2,_0xf0d960,_0xd8fbc9){return db[_0xf878('0x26')]['find']({'where':{'id':_0x5411c2[_0xf878('0x43')]['id']},'attributes':['id',_0xf878('0x45'),_0xf878('0x46')]})[_0xf878('0x1f')](handleEntityNotFound(_0xf0d960,null))['then'](function(_0x112f2a){if(_0x112f2a){if(!_0x112f2a[_0xf878('0x45')]){throw new db[(_0xf878('0x47'))]['ValidationError'](_0xf878('0x48'));}var _0xdfa29b={'Content-Type':_0xf878('0x49'),'Content-Disposition':_0xf878('0x4a')};if(_0x112f2a['msg_id']){_0xdfa29b['Content-Disposition']='attachment;\x20filename=\x22'+_0x112f2a[_0xf878('0x46')]+'.wav\x22';}_0xf0d960['set'](_0xdfa29b);return _0xf0d960['send'](new Buffer(_0x112f2a[_0xf878('0x45')]));}})[_0xf878('0x41')](handleError(_0xf0d960,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index ee29520..56acfc1 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 _0x20df=['path','rimraf','../../config/environment','exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x49dd87,_0x1bdf22){var _0x52e5e=function(_0x2925f2){while(--_0x2925f2){_0x49dd87['push'](_0x49dd87['shift']());}};_0x52e5e(++_0x1bdf22);}(_0x20df,0x7c));var _0xf20d=function(_0x3f6bcf,_0x531e79){_0x3f6bcf=_0x3f6bcf-0x0;var _0x1c5350=_0x20df[_0x3f6bcf];return _0x1c5350;};'use strict';var _=require(_0xf20d('0x0'));var util=require(_0xf20d('0x1'));var logger=require(_0xf20d('0x2'))(_0xf20d('0x3'));var moment=require('moment');var BPromise=require(_0xf20d('0x4'));var rp=require(_0xf20d('0x5'));var fs=require('fs');var path=require(_0xf20d('0x6'));var rimraf=require(_0xf20d('0x7'));var config=require(_0xf20d('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0xf20d('0x9')]=function(_0x48d4f2,_0x397065){return _0x48d4f2[_0xf20d('0xa')]('VoiceMailMessage',attributes,{'tableName':_0xf20d('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xf20d('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2b65=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes'];(function(_0x2d2351,_0x153be9){var _0x5600cc=function(_0x554839){while(--_0x554839){_0x2d2351['push'](_0x2d2351['shift']());}};_0x5600cc(++_0x153be9);}(_0x2b65,0x131));var _0x52b6=function(_0x4eebd9,_0x57afb9){_0x4eebd9=_0x4eebd9-0x0;var _0x1d6117=_0x2b65[_0x4eebd9];return _0x1d6117;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var logger=require(_0x52b6('0x2'))(_0x52b6('0x3'));var moment=require(_0x52b6('0x4'));var BPromise=require(_0x52b6('0x5'));var rp=require(_0x52b6('0x6'));var fs=require('fs');var path=require(_0x52b6('0x7'));var rimraf=require('rimraf');var config=require(_0x52b6('0x8'));var attributes=require(_0x52b6('0x9'));module[_0x52b6('0xa')]=function(_0x2c643d,_0x25593f){return _0x2c643d[_0x52b6('0xb')](_0x52b6('0xc'),attributes,{'tableName':_0x52b6('0xd'),'paranoid':![],'indexes':[{'name':_0x52b6('0xe'),'fields':[_0x52b6('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index f1d750c..a2f57b6 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1657cf,_0x465e3a){var _0x45e03c=function(_0x59e0aa){while(--_0x59e0aa){_0x1657cf['push'](_0x1657cf['shift']());}};_0x45e03c(++_0x465e3a);}(_0xdb28,0x106));var _0x8db2=function(_0x4a7527,_0x3a8ae9){_0x4a7527=_0x4a7527-0x0;var _0x1ba523=_0xdb28[_0x4a7527];return _0x1ba523;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0xfcbf57,_0x4b05fd){var _0x1078fa=function(_0xb65856){while(--_0xb65856){_0xfcbf57['push'](_0xfcbf57['shift']());}};_0x1078fa(++_0x4b05fd);}(_0x14a0,0x8e));var _0x014a=function(_0x32b185,_0x4bead4){_0x32b185=_0x32b185-0x0;var _0x5b3f73=_0x14a0[_0x32b185];return _0x5b3f73;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index ce034ee..e4a00f2 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 _0x6248=['get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller'];(function(_0x5e49e4,_0x23fa81){var _0x376049=function(_0xa1402d){while(--_0xa1402d){_0x5e49e4['push'](_0x5e49e4['shift']());}};_0x376049(++_0x23fa81);}(_0x6248,0xa0));var _0x8624=function(_0x183080,_0x3b9246){_0x183080=_0x183080-0x0;var _0x5e01af=_0x6248[_0x183080];return _0x5e01af;};'use strict';var multer=require(_0x8624('0x0'));var util=require(_0x8624('0x1'));var path=require(_0x8624('0x2'));var timeout=require('connect-timeout');var express=require(_0x8624('0x3'));var router=express['Router']();var auth=require(_0x8624('0x4'));var interaction=require(_0x8624('0x5'));var config=require(_0x8624('0x6'));var controller=require(_0x8624('0x7'));router[_0x8624('0x8')]('/',auth[_0x8624('0x9')](),controller[_0x8624('0xa')]);router['get'](_0x8624('0xb'),auth[_0x8624('0x9')](),controller[_0x8624('0xc')]);router[_0x8624('0x8')](_0x8624('0xd'),auth[_0x8624('0x9')](),controller[_0x8624('0xe')]);router[_0x8624('0xf')]('/',auth[_0x8624('0x9')](),controller[_0x8624('0x10')]);router['post'](_0x8624('0xd'),auth[_0x8624('0x9')](),controller['addSound']);router[_0x8624('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8624('0x12')]);router[_0x8624('0x13')](_0x8624('0xb'),auth['isAuthenticated'](),controller[_0x8624('0x14')]);router[_0x8624('0x13')](_0x8624('0x15'),auth[_0x8624('0x9')](),controller[_0x8624('0x16')]);module[_0x8624('0x17')]=router; \ No newline at end of file +var _0x0ae2=['/:id/sounds','getSounds','post','create','/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show'];(function(_0x361b27,_0x3778c8){var _0x514d90=function(_0x48abf6){while(--_0x48abf6){_0x361b27['push'](_0x361b27['shift']());}};_0x514d90(++_0x3778c8);}(_0x0ae2,0xa5));var _0x20ae=function(_0x2ecc65,_0xd75c48){_0x2ecc65=_0x2ecc65-0x0;var _0x103cc3=_0x0ae2[_0x2ecc65];return _0x103cc3;};'use strict';var multer=require(_0x20ae('0x0'));var util=require('util');var path=require(_0x20ae('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x20ae('0x2')]();var auth=require(_0x20ae('0x3'));var interaction=require(_0x20ae('0x4'));var config=require(_0x20ae('0x5'));var controller=require(_0x20ae('0x6'));router[_0x20ae('0x7')]('/',auth[_0x20ae('0x8')](),controller[_0x20ae('0x9')]);router[_0x20ae('0x7')]('/:id',auth[_0x20ae('0x8')](),controller[_0x20ae('0xa')]);router[_0x20ae('0x7')](_0x20ae('0xb'),auth[_0x20ae('0x8')](),controller[_0x20ae('0xc')]);router[_0x20ae('0xd')]('/',auth['isAuthenticated'](),controller[_0x20ae('0xe')]);router[_0x20ae('0xd')]('/:id/sounds',auth[_0x20ae('0x8')](),controller['addSound']);router['put'](_0x20ae('0xf'),auth[_0x20ae('0x8')](),controller[_0x20ae('0x10')]);router[_0x20ae('0x11')](_0x20ae('0xf'),auth[_0x20ae('0x8')](),controller[_0x20ae('0x12')]);router[_0x20ae('0x11')](_0x20ae('0x13'),auth[_0x20ae('0x8')](),controller[_0x20ae('0x14')]);module[_0x20ae('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 19e8b82..2e13518 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 _0x1d72=['mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM','custom','files','quietmp3nb','quietmp3'];(function(_0x527acd,_0x32b758){var _0x2c990f=function(_0x1eeb32){while(--_0x1eeb32){_0x527acd['push'](_0x527acd['shift']());}};_0x2c990f(++_0x32b758);}(_0x1d72,0x1cc));var _0x21d7=function(_0x2fa3ef,_0x485ae8){_0x2fa3ef=_0x2fa3ef-0x0;var _0x856aff=_0x1d72[_0x2fa3ef];return _0x856aff;};'use strict';var Sequelize=require(_0x21d7('0x0'));module[_0x21d7('0x1')]={'name':{'type':Sequelize[_0x21d7('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x21d7('0x3')](_0x21d7('0x4'),_0x21d7('0x5'),'mp3nb',_0x21d7('0x6'),_0x21d7('0x7'),_0x21d7('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x21d7('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x21d7('0x2')],'allowNull':!![],'defaultValue':_0x21d7('0x9')},'format':{'type':Sequelize[_0x21d7('0x2')],'allowNull':!![]},'stamp':{'type':_0x21d7('0xa')},'defaultEntry':{'type':Sequelize[_0x21d7('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x58b1=['mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb'];(function(_0xb1bae1,_0x171c58){var _0x2e25b7=function(_0x116549){while(--_0x116549){_0xb1bae1['push'](_0xb1bae1['shift']());}};_0x2e25b7(++_0x171c58);}(_0x58b1,0x184));var _0x158b=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x58b1[_0x4c184d];return _0x23d997;};'use strict';var Sequelize=require(_0x158b('0x0'));module['exports']={'name':{'type':Sequelize[_0x158b('0x1')],'allowNull':![],'unique':_0x158b('0x2')},'mode':{'type':Sequelize[_0x158b('0x3')](_0x158b('0x4'),_0x158b('0x5'),_0x158b('0x6'),_0x158b('0x7'),'quietmp3',_0x158b('0x8')),'allowNull':!![],'defaultValue':_0x158b('0x5')},'directory':{'type':Sequelize[_0x158b('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x158b('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x158b('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x158b('0x1')],'allowNull':!![],'defaultValue':_0x158b('0x9')},'format':{'type':Sequelize[_0x158b('0x1')],'allowNull':!![]},'stamp':{'type':_0x158b('0xa')},'defaultEntry':{'type':Sequelize[_0x158b('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index bbeedb6..9003d5b 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x50d890,_0x24c9b9){var _0x3407cf=function(_0x2ed4f2){while(--_0x2ed4f2){_0x50d890['push'](_0x50d890['shift']());}};_0x3407cf(++_0x24c9b9);}(_0xb10b,0x12a));var _0xbb10=function(_0x1cdbc5,_0x219ca6){_0x1cdbc5=_0x1cdbc5-0x0;var _0x213288=_0xb10b[_0x1cdbc5];return _0x213288;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file +var _0xd8b0=['map','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','VoiceMusicOnHold','count','includeAll','include','findAll','rows','catch','params','keys','find','body','create','transaction','mode','directory','join','root','server/files/moh','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','sequelize','forEach','unlinkSync','rmdirSync','Sequelize','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','save_name','symlinkSync','ValidationError','removeSound','id2','message','getSounds','options','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','name','send'];(function(_0x510a1f,_0x5908ec){var _0x54f45b=function(_0x421f48){while(--_0x421f48){_0x510a1f['push'](_0x510a1f['shift']());}};_0x54f45b(++_0x5908ec);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){var _0x2b924f=_0x56c729[_0x0d8b('0x23')]({'plain':!![]});var _0x38efc8=_0x0d8b('0x24');return db[_0x0d8b('0x25')][_0x0d8b('0x26')]({'where':{'type':_0x38efc8,'resourceId':_0x2b924f['id']}})[_0x0d8b('0x22')](function(){return _0x56c729;});})[_0x0d8b('0x22')](function(){_0x33fb87['status'](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x4463ee,_0x5363e3){return function(_0xe1ef20){if(!_0xe1ef20){_0x4463ee['sendStatus'](0x194);}return _0xe1ef20;};}function handleError(_0x3dd149,_0x234bdd){_0x234bdd=_0x234bdd||0x1f4;return function(_0xa2af02){logger['error'](_0xa2af02['stack']);if(_0xa2af02[_0x0d8b('0x27')]){delete _0xa2af02[_0x0d8b('0x27')];}_0x3dd149['status'](_0x234bdd)[_0x0d8b('0x28')](_0xa2af02);};}exports['index']=function(_0x1b2b59,_0x4b59e5){var _0x97050a={},_0x48f24f={},_0x2ab00d={'count':0x0,'rows':[]};var _0x546bf6=_[_0x0d8b('0x29')](db['VoiceMusicOnHold'][_0x0d8b('0x2a')],function(_0x106e4c){return{'name':_0x106e4c[_0x0d8b('0x2b')],'type':_0x106e4c['type']['key']};});_0x48f24f['model']=_[_0x0d8b('0x29')](_0x546bf6,'name');_0x48f24f[_0x0d8b('0x2c')]=_['keys'](_0x1b2b59['query']);_0x48f24f[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],_0x48f24f[_0x0d8b('0x2c')]);_0x97050a[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],qs[_0x0d8b('0x31')](_0x1b2b59['query'][_0x0d8b('0x31')]));_0x97050a[_0x0d8b('0x30')]=_0x97050a['attributes'][_0x0d8b('0x32')]?_0x97050a[_0x0d8b('0x30')]:_0x48f24f[_0x0d8b('0x2f')];if(!_0x1b2b59['query'][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x97050a[_0x0d8b('0x1b')]=qs[_0x0d8b('0x1b')](_0x1b2b59[_0x0d8b('0x2c')]['limit']);_0x97050a[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x1b2b59['query'][_0x0d8b('0x1a')]);}_0x97050a[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x36')]);_0x97050a['where']=qs['filters'](_[_0x0d8b('0x37')](_0x1b2b59['query'],_0x48f24f['filters']),_0x546bf6);if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x97050a[_0x0d8b('0x39')]=_[_0x0d8b('0x3a')](_0x97050a[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x546bf6,function(_0x579324){if(_0x579324[_0x0d8b('0x3b')]!==_0x0d8b('0x3c')){var _0x28fd82={};_0x28fd82[_0x579324[_0x0d8b('0x27')]]={'$like':'%'+_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x28fd82;}})});}_0x97050a=_[_0x0d8b('0x3a')]({},_0x97050a,_0x1b2b59['options']);var _0x1d06b6={'where':_0x97050a[_0x0d8b('0x39')]};return db[_0x0d8b('0x3d')][_0x0d8b('0x3e')](_0x1d06b6)['then'](function(_0xe0bf42){_0x2ab00d['count']=_0xe0bf42;if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x3f')]){_0x97050a[_0x0d8b('0x40')]=[{'all':!![]}];}return db[_0x0d8b('0x3d')][_0x0d8b('0x41')](_0x97050a);})[_0x0d8b('0x22')](function(_0x1ff17d){_0x2ab00d[_0x0d8b('0x42')]=_0x1ff17d;return _0x2ab00d;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4b59e5,_0x97050a))[_0x0d8b('0x43')](handleError(_0x4b59e5,null));};exports['show']=function(_0x571acf,_0x576050){var _0x4d0811={'raw':![],'where':{'id':_0x571acf[_0x0d8b('0x44')]['id']}},_0x524d79={};_0x524d79[_0x0d8b('0x2f')]=_[_0x0d8b('0x45')](db['VoiceMusicOnHold']['rawAttributes']);_0x524d79[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x571acf[_0x0d8b('0x2c')]);_0x524d79['filters']=_[_0x0d8b('0x2e')](_0x524d79[_0x0d8b('0x2f')],_0x524d79['query']);_0x4d0811['attributes']=_[_0x0d8b('0x2e')](_0x524d79['model'],qs[_0x0d8b('0x31')](_0x571acf['query']['fields']));_0x4d0811[_0x0d8b('0x30')]=_0x4d0811[_0x0d8b('0x30')]['length']?_0x4d0811['attributes']:_0x524d79['model'];if(_0x571acf['query'][_0x0d8b('0x3f')]){_0x4d0811[_0x0d8b('0x40')]=[{'all':!![]}];}_0x4d0811=_[_0x0d8b('0x3a')]({},_0x4d0811,_0x571acf['options']);return db[_0x0d8b('0x3d')][_0x0d8b('0x46')](_0x4d0811)[_0x0d8b('0x22')](handleEntityNotFound(_0x576050,null))[_0x0d8b('0x22')](respondWithResult(_0x576050,null))[_0x0d8b('0x43')](handleError(_0x576050,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x47')]['id']){delete _0x11d22b[_0x0d8b('0x47')]['id'];}return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x47')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x43')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x48')]=function(_0x574b90,_0x371fa0,_0x4d8850){return db['sequelize'][_0x0d8b('0x49')](function(_0x113fb7){if(_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4a')]==='files'){_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4b')]=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x4e'),_0x574b90['body']['name']);}return db['VoiceMusicOnHold']['create'](_0x574b90[_0x0d8b('0x47')],{'transaction':_0x113fb7})[_0x0d8b('0x22')](function(_0x5e3bb4){if(_0x574b90['body'][_0x0d8b('0x4a')]===_0x0d8b('0x4f')){fs['mkdirSync'](_0x5e3bb4['directory'],parseInt(_0x0d8b('0x50'),0x8));}var _0xeeefd4=_0x574b90[_0x0d8b('0x51')][_0x0d8b('0x23')]({'plain':!![]});if(!_0xeeefd4)throw new Error(_0x0d8b('0x52'));if(_0xeeefd4['role']===_0x0d8b('0x51')){var _0x2afe34=_0x5e3bb4['get']({'plain':!![]});return db['UserProfileSection'][_0x0d8b('0x46')]({'where':{'name':_0x0d8b('0x24'),'userProfileId':_0xeeefd4['userProfileId']},'raw':!![]})['then'](function(_0xb8be3b){if(_0xb8be3b&&_0xb8be3b[_0x0d8b('0x53')]===0x0){return db[_0x0d8b('0x25')][_0x0d8b('0x48')]({'name':_0x2afe34['name'],'resourceId':_0x2afe34['id'],'type':_0xb8be3b[_0x0d8b('0x27')],'sectionId':_0xb8be3b['id']},{})['then'](function(){return _0x5e3bb4;});}else{return _0x5e3bb4;}})['catch'](function(_0x38c24e){logger[_0x0d8b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38c24e);});}return _0x5e3bb4;});})['then'](respondWithResult(_0x371fa0,0xc9))[_0x0d8b('0x43')](handleError(_0x371fa0,null));};exports[_0x0d8b('0x26')]=function(_0xccc2a9,_0x2c1eb0,_0x3afc3a){var _0xb66e76;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0xccc2a9['params']['id']}})[_0x0d8b('0x22')](function(_0x37dc9f){if(_0x37dc9f){return db[_0x0d8b('0x55')][_0x0d8b('0x49')](function(_0x3fb9ea){return _0x37dc9f[_0x0d8b('0x26')]({'transaction':_0x3fb9ea,'raw':!![]})[_0x0d8b('0x22')](function(_0x1c78b6){if(_0x1c78b6[_0x0d8b('0x4b')]){fs['readdirSync'](_0x1c78b6[_0x0d8b('0x4b')])[_0x0d8b('0x56')](function(_0x180b7b){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x1c78b6['directory'],_0x180b7b));});fs[_0x0d8b('0x58')](_0x1c78b6[_0x0d8b('0x4b')]);}return _0x1c78b6;});})[_0x0d8b('0x43')](function(_0x17a87f){throw new db[(_0x0d8b('0x59'))]['ValidationError'](_0x17a87f['message']);});}})[_0x0d8b('0x22')](handleEntityNotFound(_0x2c1eb0,null))[_0x0d8b('0x22')](removeEntity(_0x2c1eb0,null))[_0x0d8b('0x43')](handleError(_0x2c1eb0,null));};exports[_0x0d8b('0x5a')]=function(_0x5a70bd,_0x199122,_0x12aef7){return db[_0x0d8b('0x55')]['transaction'](function(_0x2f19f4){var _0x532a85;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x5a70bd[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](function(_0x2b6eb6){if(_0x2b6eb6){_0x532a85=_0x2b6eb6;return _0x2b6eb6[_0x0d8b('0x5a')](_0x5a70bd['body']['id'],{'transaction':_0x2f19f4});}})[_0x0d8b('0x22')](function(_0x4c074d){if(_0x4c074d){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x5a70bd[_0x0d8b('0x47')]['id']},'attributes':['id',_0x0d8b('0x27'),'save_name',_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2332fc){if(_0x2332fc){var _0x2ccdae=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x5f'),util[_0x0d8b('0x60')](_0x0d8b('0x61'),path['basename'](_0x2332fc['save_name'],path[_0x0d8b('0x62')](_0x2332fc[_0x0d8b('0x63')])),_0x2332fc['converted_format']));var _0xb1aa96=path['join'](config['root'],_0x0d8b('0x4e'),_0x532a85[_0x0d8b('0x27')],util['format']('%s.%s',_0x2332fc[_0x0d8b('0x27')],_0x2332fc[_0x0d8b('0x5d')]));fs[_0x0d8b('0x64')](_0x2ccdae,_0xb1aa96);return _0x2332fc;}})[_0x0d8b('0x43')](function(_0x2ab72b){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x2ab72b['message']);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x199122,null))['then'](respondWithResult(_0x199122,0xc9))[_0x0d8b('0x43')](handleError(_0x199122,null));};exports[_0x0d8b('0x66')]=function(_0x2bb690,_0x14a34b,_0x49f610){return db[_0x0d8b('0x55')]['transaction'](function(_0x3a356b){var _0x2c6c5f;return db[_0x0d8b('0x3d')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](function(_0x91aa89){if(_0x91aa89){_0x2c6c5f=_0x91aa89;return _0x91aa89[_0x0d8b('0x66')](_0x2bb690[_0x0d8b('0x44')]['id2']);}})[_0x0d8b('0x22')](function(_0x54c28b){if(_0x54c28b){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690['params'][_0x0d8b('0x67')]},'attributes':['id','name',_0x0d8b('0x63'),_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2242cd){if(_0x2242cd){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x2c6c5f[_0x0d8b('0x4b')],util['format'](_0x0d8b('0x61'),_0x2242cd[_0x0d8b('0x27')],_0x2242cd['converted_format'])));return _0x2242cd;}})[_0x0d8b('0x43')](function(_0x105df9){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x105df9[_0x0d8b('0x68')]);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](respondWithStatusCode(_0x14a34b,0xcc))[_0x0d8b('0x43')](handleError(_0x14a34b,null));};exports[_0x0d8b('0x69')]=function(_0x5007c0,_0xe35028,_0x16df83){var _0x50c0ff={};var _0x1ece98={};var _0x93fc55;var _0x3acffa;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5007c0[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0xe35028,null))[_0x0d8b('0x22')](function(_0x5b76af){if(_0x5b76af){_0x93fc55=_0x5b76af;_0x1ece98['model']=_[_0x0d8b('0x45')](db[_0x0d8b('0x5b')][_0x0d8b('0x2a')]);_0x1ece98[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x5007c0[_0x0d8b('0x2c')]);_0x1ece98[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],_0x1ece98[_0x0d8b('0x2c')]);_0x50c0ff[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],qs['fields'](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x31')]));_0x50c0ff['attributes']=_0x50c0ff['attributes'][_0x0d8b('0x32')]?_0x50c0ff[_0x0d8b('0x30')]:_0x1ece98[_0x0d8b('0x2f')];_0x50c0ff[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x5007c0[_0x0d8b('0x2c')]['sort']);_0x50c0ff['where']=qs['filters'](_[_0x0d8b('0x37')](_0x5007c0[_0x0d8b('0x2c')],_0x1ece98[_0x0d8b('0x2d')]));if(_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x50c0ff[_0x0d8b('0x39')]=_['merge'](_0x50c0ff[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x50c0ff['attributes'],function(_0x30a69d){var _0x57e3c2={};_0x57e3c2[_0x30a69d]={'$like':'%'+_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x57e3c2;})});}_0x50c0ff=_[_0x0d8b('0x3a')]({},_0x50c0ff,_0x5007c0[_0x0d8b('0x6a')]);return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x424f9d){if(_0x424f9d){_0x3acffa=_0x424f9d[_0x0d8b('0x32')];if(!_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x50c0ff[_0x0d8b('0x1b')]=qs['limit'](_0x5007c0['query'][_0x0d8b('0x1b')]);_0x50c0ff[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x54674f){if(_0x54674f){return _0x54674f?{'count':_0x3acffa,'rows':_0x54674f}:null;}})[_0x0d8b('0x22')](respondWithResult(_0xe35028,null))['catch'](handleError(_0xe35028,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 7070178..4595e6a 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 _0x9727=['path','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2bd0a8,_0x2f9fdc){var _0x130317=function(_0x2f3982){while(--_0x2f3982){_0x2bd0a8['push'](_0x2bd0a8['shift']());}};_0x130317(++_0x2f9fdc);}(_0x9727,0x94));var _0x7972=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0x9727[_0x2d9c6a];return _0xf3c918;};'use strict';var _=require(_0x7972('0x0'));var util=require(_0x7972('0x1'));var logger=require('../../config/logger')(_0x7972('0x2'));var moment=require(_0x7972('0x3'));var BPromise=require(_0x7972('0x4'));var rp=require(_0x7972('0x5'));var fs=require('fs');var path=require(_0x7972('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7972('0x7'));module['exports']=function(_0x264c47,_0x54b353){return _0x264c47[_0x7972('0x8')](_0x7972('0x9'),attributes,{'tableName':_0x7972('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cff=['exports','define','voice_musiconhold','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes'];(function(_0x331a56,_0x365331){var _0x4336aa=function(_0xc1fee7){while(--_0xc1fee7){_0x331a56['push'](_0x331a56['shift']());}};_0x4336aa(++_0x365331);}(_0x3cff,0xc3));var _0xf3cf=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0x3cff[_0x500c0];return _0xdd146f;};'use strict';var _=require(_0xf3cf('0x0'));var util=require(_0xf3cf('0x1'));var logger=require(_0xf3cf('0x2'))(_0xf3cf('0x3'));var moment=require('moment');var BPromise=require(_0xf3cf('0x4'));var rp=require(_0xf3cf('0x5'));var fs=require('fs');var path=require(_0xf3cf('0x6'));var rimraf=require(_0xf3cf('0x7'));var config=require('../../config/environment');var attributes=require(_0xf3cf('0x8'));module[_0xf3cf('0x9')]=function(_0x582dc2,_0x2e473b){return _0x582dc2[_0xf3cf('0xa')]('VoiceMusicOnHold',attributes,{'tableName':_0xf3cf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 86da62c..be8cb9c 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 _0x483e=['message','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0xc6146f,_0x2437f3){var _0x31d1a2=function(_0x44f03e){while(--_0x44f03e){_0xc6146f['push'](_0xc6146f['shift']());}};_0x31d1a2(++_0x2437f3);}(_0x483e,0xa9));var _0xe483=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x483e[_0x1b2ff7];return _0x31656a;};'use strict';var _=require('lodash');var util=require(_0xe483('0x0'));var moment=require(_0xe483('0x1'));var BPromise=require(_0xe483('0x2'));var rs=require(_0xe483('0x3'));var fs=require('fs');var Redis=require(_0xe483('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe483('0x5'));var logger=require(_0xe483('0x6'))('rpc');var config=require(_0xe483('0x7'));var jayson=require(_0xe483('0x8'));var client=jayson[_0xe483('0x9')][_0xe483('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29b863,_0x2a32ed,_0x263100){return new BPromise(function(_0x4d8fea,_0x286a29){return client[_0xe483('0xb')](_0x29b863,_0x263100)[_0xe483('0xc')](function(_0x3ceacf){logger[_0xe483('0xd')](_0xe483('0xe'),_0x2a32ed,'request\x20sent');logger[_0xe483('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2a32ed,_0xe483('0x10'),JSON[_0xe483('0x11')](_0x3ceacf));if(_0x3ceacf[_0xe483('0x12')]){if(_0x3ceacf[_0xe483('0x12')][_0xe483('0x13')]===0x1f4){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2a32ed,_0x3ceacf[_0xe483('0x12')][_0xe483('0x14')]);return _0x286a29(_0x3ceacf[_0xe483('0x12')][_0xe483('0x14')]);}logger[_0xe483('0x12')](_0xe483('0xe'),_0x2a32ed,_0x3ceacf['error'][_0xe483('0x14')]);return _0x4d8fea(_0x3ceacf[_0xe483('0x12')]['message']);}else{logger[_0xe483('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2a32ed,'request\x20sent');_0x4d8fea(_0x3ceacf['result'][_0xe483('0x14')]);}})['catch'](function(_0xe44382){logger[_0xe483('0x12')](_0xe483('0xe'),_0x2a32ed,_0xe44382);_0x286a29(_0xe44382);});});} \ No newline at end of file +var _0x5b39=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x21c540,_0x52f6e0){var _0x489bf0=function(_0x5c6374){while(--_0x5c6374){_0x21c540['push'](_0x21c540['shift']());}};_0x489bf0(++_0x52f6e0);}(_0x5b39,0x70));var _0x95b3=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x5b39[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0x95b3('0x0'));var util=require(_0x95b3('0x1'));var moment=require(_0x95b3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95b3('0x3'));var db=require(_0x95b3('0x4'))['db'];var utils=require(_0x95b3('0x5'));var logger=require('../../config/logger')(_0x95b3('0x6'));var config=require('../../config/environment');var jayson=require(_0x95b3('0x7'));var client=jayson[_0x95b3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x502051,_0x40119f,_0x63b4e8){return new BPromise(function(_0x5c9f07,_0x5c1456){return client['request'](_0x502051,_0x63b4e8)[_0x95b3('0x9')](function(_0x18770f){logger[_0x95b3('0xa')](_0x95b3('0xb'),_0x40119f,'request\x20sent');logger[_0x95b3('0xc')](_0x95b3('0xd'),_0x40119f,_0x95b3('0xe'),JSON[_0x95b3('0xf')](_0x18770f));if(_0x18770f[_0x95b3('0x10')]){if(_0x18770f[_0x95b3('0x10')][_0x95b3('0x11')]===0x1f4){logger[_0x95b3('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x40119f,_0x18770f['error'][_0x95b3('0x12')]);return _0x5c1456(_0x18770f[_0x95b3('0x10')][_0x95b3('0x12')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x40119f,_0x18770f[_0x95b3('0x10')][_0x95b3('0x12')]);return _0x5c9f07(_0x18770f['error'][_0x95b3('0x12')]);}else{logger[_0x95b3('0xa')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x40119f,_0x95b3('0xe'));_0x5c9f07(_0x18770f[_0x95b3('0x13')][_0x95b3('0x12')]);}})[_0x95b3('0x14')](function(_0x2a425f){logger[_0x95b3('0x10')](_0x95b3('0xb'),_0x40119f,_0x2a425f);_0x5c1456(_0x2a425f);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 37bc62c..019e10b 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 _0xfd76=['delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','getAgents','post','create','/:id/users','put','update'];(function(_0x3fda7a,_0x53aed4){var _0x37e4de=function(_0x1a6b33){while(--_0x1a6b33){_0x3fda7a['push'](_0x3fda7a['shift']());}};_0x37e4de(++_0x53aed4);}(_0xfd76,0x101));var _0x6fd7=function(_0x40cf59,_0x23895c){_0x40cf59=_0x40cf59-0x0;var _0x134ced=_0xfd76[_0x40cf59];return _0x134ced;};'use strict';var multer=require(_0x6fd7('0x0'));var util=require(_0x6fd7('0x1'));var path=require(_0x6fd7('0x2'));var timeout=require(_0x6fd7('0x3'));var express=require(_0x6fd7('0x4'));var router=express['Router']();var auth=require(_0x6fd7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6fd7('0x6'));var controller=require('./voicePrefix.controller');router[_0x6fd7('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6fd7('0x7')](_0x6fd7('0x8'),auth[_0x6fd7('0x9')](),controller[_0x6fd7('0xa')]);router[_0x6fd7('0x7')](_0x6fd7('0xb'),auth[_0x6fd7('0x9')](),controller[_0x6fd7('0xc')]);router['get']('/:id/users',auth[_0x6fd7('0x9')](),controller[_0x6fd7('0xd')]);router[_0x6fd7('0xe')]('/',auth[_0x6fd7('0x9')](),controller[_0x6fd7('0xf')]);router[_0x6fd7('0xe')](_0x6fd7('0x10'),auth[_0x6fd7('0x9')](),controller['addAgents']);router[_0x6fd7('0x11')](_0x6fd7('0xb'),auth[_0x6fd7('0x9')](),controller[_0x6fd7('0x12')]);router[_0x6fd7('0x13')](_0x6fd7('0xb'),auth[_0x6fd7('0x9')](),controller[_0x6fd7('0x14')]);router[_0x6fd7('0x13')](_0x6fd7('0x10'),auth[_0x6fd7('0x9')](),controller[_0x6fd7('0x15')]);module[_0x6fd7('0x16')]=router; \ No newline at end of file +var _0x0398=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','show','post','create','addAgents','put','/:id','update','delete','destroy','removeAgents','exports'];(function(_0x540ba2,_0x19e111){var _0x93d930=function(_0xe68a34){while(--_0xe68a34){_0x540ba2['push'](_0x540ba2['shift']());}};_0x93d930(++_0x19e111);}(_0x0398,0xaf));var _0x8039=function(_0x39a2d6,_0x477459){_0x39a2d6=_0x39a2d6-0x0;var _0x23af66=_0x0398[_0x39a2d6];return _0x23af66;};'use strict';var multer=require(_0x8039('0x0'));var util=require(_0x8039('0x1'));var path=require(_0x8039('0x2'));var timeout=require(_0x8039('0x3'));var express=require(_0x8039('0x4'));var router=express[_0x8039('0x5')]();var auth=require(_0x8039('0x6'));var interaction=require(_0x8039('0x7'));var config=require('../../config/environment');var controller=require(_0x8039('0x8'));router[_0x8039('0x9')]('/',auth[_0x8039('0xa')](),controller[_0x8039('0xb')]);router[_0x8039('0x9')](_0x8039('0xc'),auth[_0x8039('0xa')](),controller[_0x8039('0xd')]);router[_0x8039('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8039('0xe')]);router[_0x8039('0x9')]('/:id/users',auth[_0x8039('0xa')](),controller['getAgents']);router[_0x8039('0xf')]('/',auth[_0x8039('0xa')](),controller[_0x8039('0x10')]);router[_0x8039('0xf')]('/:id/users',auth[_0x8039('0xa')](),controller[_0x8039('0x11')]);router[_0x8039('0x12')](_0x8039('0x13'),auth[_0x8039('0xa')](),controller[_0x8039('0x14')]);router[_0x8039('0x15')]('/:id',auth[_0x8039('0xa')](),controller[_0x8039('0x16')]);router[_0x8039('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x8039('0x17')]);module[_0x8039('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index ad539d7..d65ceae 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 _0x73b6=['getDataValue','INTEGER','sequelize','STRING','name','VIRTUAL'];(function(_0x330c71,_0x290139){var _0x1f5916=function(_0x3c2b8d){while(--_0x3c2b8d){_0x330c71['push'](_0x330c71['shift']());}};_0x1f5916(++_0x290139);}(_0x73b6,0xce));var _0x673b=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x73b6[_0x54d4fe];return _0x1ab5bb;};'use strict';var Sequelize=require(_0x673b('0x0'));module['exports']={'name':{'type':Sequelize[_0x673b('0x1')],'allowNull':![],'unique':_0x673b('0x2')},'prefix':{'type':Sequelize[_0x673b('0x3')],'get':function(_0x5b1131){return'system-'+this[_0x673b('0x4')](_0x673b('0x2'))+'-';}},'description':{'type':Sequelize[_0x673b('0x1')]},'callerIdAll':{'type':Sequelize[_0x673b('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x673b('0x5')]}}; \ No newline at end of file +var _0x85de=['STRING','name','VIRTUAL','system-','sequelize','exports'];(function(_0x2797c6,_0x37421b){var _0x54809f=function(_0x2d100c){while(--_0x2d100c){_0x2797c6['push'](_0x2797c6['shift']());}};_0x54809f(++_0x37421b);}(_0x85de,0x1f0));var _0xe85d=function(_0x5138ca,_0xb49c6){_0x5138ca=_0x5138ca-0x0;var _0x249305=_0x85de[_0x5138ca];return _0x249305;};'use strict';var Sequelize=require(_0xe85d('0x0'));module[_0xe85d('0x1')]={'name':{'type':Sequelize[_0xe85d('0x2')],'allowNull':![],'unique':_0xe85d('0x3')},'prefix':{'type':Sequelize[_0xe85d('0x4')],'get':function(_0x57970c){return _0xe85d('0x5')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0xe85d('0x2')]},'callerIdAll':{'type':Sequelize[_0xe85d('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 29ac01f..63267e6 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 _0xc06b=['NoOp','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','charAt','system-','addAgents','body','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','order','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','send','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','rows','show','params','options','find','catch','describe','sequelize','transaction','create','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix'];(function(_0x1fa380,_0xd0917f){var _0x219838=function(_0x4e7e4e){while(--_0x4e7e4e){_0x1fa380['push'](_0x1fa380['shift']());}};_0x219838(++_0xd0917f);}(_0xc06b,0x18d));var _0xbc06=function(_0x3ccea2,_0x624323){_0x3ccea2=_0x3ccea2-0x0;var _0xeb988=_0xc06b[_0x3ccea2];return _0xeb988;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbc06('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc06('0x1'));var moment=require(_0xbc06('0x2'));var BPromise=require(_0xbc06('0x3'));var Mustache=require(_0xbc06('0x4'));var util=require(_0xbc06('0x5'));var path=require('path');var sox=require(_0xbc06('0x6'));var csv=require(_0xbc06('0x7'));var ejs=require(_0xbc06('0x8'));var fs=require('fs');var _=require(_0xbc06('0x9'));var squel=require(_0xbc06('0xa'));var crypto=require(_0xbc06('0xb'));var jsforce=require(_0xbc06('0xc'));var deskjs=require(_0xbc06('0xd'));var toCsv=require(_0xbc06('0x7'));var querystring=require(_0xbc06('0xe'));var Papa=require(_0xbc06('0xf'));var Redis=require(_0xbc06('0x10'));var authService=require(_0xbc06('0x11'));var qs=require(_0xbc06('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc06('0x13'))(_0xbc06('0x14'));var utils=require(_0xbc06('0x15'));var config=require(_0xbc06('0x16'));var db=require(_0xbc06('0x17'))['db'];config[_0xbc06('0x18')]=_[_0xbc06('0x19')](config[_0xbc06('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xbc06('0x1a'))(new Redis(config[_0xbc06('0x18')]));require(_0xbc06('0x1b'))[_0xbc06('0x1c')](socket);function respondWithStatusCode(_0x2a5748,_0x4fdf0e){_0x4fdf0e=_0x4fdf0e||0xcc;return function(_0x27a0b9){if(_0x27a0b9){return _0x2a5748[_0xbc06('0x1d')](_0x4fdf0e);}return _0x2a5748['status'](_0x4fdf0e)[_0xbc06('0x1e')]();};}function respondWithResult(_0x10451c,_0x30feef){_0x30feef=_0x30feef||0xc8;return function(_0x2c6840){if(_0x2c6840){return _0x10451c[_0xbc06('0x1f')](_0x30feef)[_0xbc06('0x20')](_0x2c6840);}};}function respondWithFilteredResult(_0x34a8a6,_0x20e46c){return function(_0x3933e7){if(_0x3933e7){var _0x4f7cc4=_0x3933e7['count'],_0x2c8d1e=_0x20e46c['offset'],_0x578367=_0x20e46c[_0xbc06('0x21')]+_0x20e46c[_0xbc06('0x22')],_0x3bf645;if(_0x578367>=_0x4f7cc4){_0x578367=_0x4f7cc4;_0x3bf645=0xc8;}else{_0x3bf645=0xce;}_0x34a8a6['status'](_0x3bf645);return _0x34a8a6[_0xbc06('0x23')](_0xbc06('0x24'),_0x2c8d1e+'-'+_0x578367+'/'+_0x4f7cc4)[_0xbc06('0x20')](_0x3933e7);}return null;};}function patchUpdates(_0x4d79f7){return function(_0xfe7fe8){try{jsonpatch[_0xbc06('0x25')](_0xfe7fe8,_0x4d79f7,!![]);}catch(_0x5da25a){return BPromise['reject'](_0x5da25a);}return _0xfe7fe8['save']();};}function saveUpdates(_0x3a9ead,_0x300f6e){return function(_0x97ce96){if(_0x97ce96){return _0x97ce96[_0xbc06('0x26')](_0x3a9ead)[_0xbc06('0x27')](function(_0x24e4e1){return _0x24e4e1;});}return null;};}function removeEntity(_0x574eeb,_0x14495){return function(_0xfd6dd1){if(_0xfd6dd1){return _0xfd6dd1['destroy']()[_0xbc06('0x27')](function(){var _0x274d5f=_0xfd6dd1[_0xbc06('0x28')]({'plain':!![]});var _0x3b167b=_0xbc06('0x29');return db[_0xbc06('0x2a')][_0xbc06('0x2b')]({'where':{'type':_0x3b167b,'resourceId':_0x274d5f['id']}})[_0xbc06('0x27')](function(){return _0xfd6dd1;});})[_0xbc06('0x27')](function(){_0x574eeb[_0xbc06('0x1f')](0xcc)[_0xbc06('0x1e')]();});}};}function handleEntityNotFound(_0xe4a62a,_0x6fa194){return function(_0x2780b4){if(!_0x2780b4){_0xe4a62a['sendStatus'](0x194);}return _0x2780b4;};}function handleError(_0x72f390,_0x363b8d){_0x363b8d=_0x363b8d||0x1f4;return function(_0x203f2f){logger[_0xbc06('0x2c')](_0x203f2f[_0xbc06('0x2d')]);if(_0x203f2f[_0xbc06('0x2e')]){delete _0x203f2f[_0xbc06('0x2e')];}_0x72f390[_0xbc06('0x1f')](_0x363b8d)[_0xbc06('0x2f')](_0x203f2f);};}exports['index']=function(_0x996a5c,_0x3b2c36){var _0x22a742={},_0x17b6e1={},_0x2bea15={'count':0x0,'rows':[]};var _0x1ee57e=_[_0xbc06('0x30')](db[_0xbc06('0x31')]['rawAttributes'],function(_0x4654d1){return{'name':_0x4654d1[_0xbc06('0x32')],'type':_0x4654d1[_0xbc06('0x33')][_0xbc06('0x34')]};});_0x17b6e1[_0xbc06('0x35')]=_[_0xbc06('0x30')](_0x1ee57e,_0xbc06('0x2e'));_0x17b6e1[_0xbc06('0x36')]=_[_0xbc06('0x37')](_0x996a5c[_0xbc06('0x36')]);_0x17b6e1[_0xbc06('0x38')]=_[_0xbc06('0x39')](_0x17b6e1[_0xbc06('0x35')],_0x17b6e1[_0xbc06('0x36')]);_0x22a742[_0xbc06('0x3a')]=_[_0xbc06('0x39')](_0x17b6e1['model'],qs[_0xbc06('0x3b')](_0x996a5c['query']['fields']));_0x22a742[_0xbc06('0x3a')]=_0x22a742['attributes'][_0xbc06('0x3c')]?_0x22a742[_0xbc06('0x3a')]:_0x17b6e1[_0xbc06('0x35')];if(!_0x996a5c[_0xbc06('0x36')][_0xbc06('0x3d')](_0xbc06('0x3e'))){_0x22a742[_0xbc06('0x22')]=qs[_0xbc06('0x22')](_0x996a5c[_0xbc06('0x36')][_0xbc06('0x22')]);_0x22a742[_0xbc06('0x21')]=qs['offset'](_0x996a5c['query'][_0xbc06('0x21')]);}_0x22a742['order']=qs[_0xbc06('0x3f')](_0x996a5c[_0xbc06('0x36')][_0xbc06('0x3f')]);_0x22a742['where']=qs['filters'](_[_0xbc06('0x40')](_0x996a5c[_0xbc06('0x36')],_0x17b6e1[_0xbc06('0x38')]),_0x1ee57e);if(_0x996a5c[_0xbc06('0x36')][_0xbc06('0x41')]){_0x22a742[_0xbc06('0x42')]=_[_0xbc06('0x43')](_0x22a742[_0xbc06('0x42')],{'$or':_[_0xbc06('0x30')](_0x1ee57e,function(_0x277bf5){if(_0x277bf5[_0xbc06('0x33')]!==_0xbc06('0x44')){var _0x5e45d3={};_0x5e45d3[_0x277bf5[_0xbc06('0x2e')]]={'$like':'%'+_0x996a5c[_0xbc06('0x36')][_0xbc06('0x41')]+'%'};return _0x5e45d3;}})});}_0x22a742=_[_0xbc06('0x43')]({},_0x22a742,_0x996a5c['options']);var _0x3f7c6a={'where':_0x22a742[_0xbc06('0x42')]};return db[_0xbc06('0x31')][_0xbc06('0x45')](_0x3f7c6a)[_0xbc06('0x27')](function(_0x25a9c0){_0x2bea15[_0xbc06('0x45')]=_0x25a9c0;if(_0x996a5c[_0xbc06('0x36')][_0xbc06('0x46')]){_0x22a742[_0xbc06('0x47')]=[{'all':!![]}];}return db[_0xbc06('0x31')]['findAll'](_0x22a742);})['then'](function(_0x51fc68){_0x2bea15[_0xbc06('0x48')]=_0x51fc68;return _0x2bea15;})[_0xbc06('0x27')](respondWithFilteredResult(_0x3b2c36,_0x22a742))['catch'](handleError(_0x3b2c36,null));};exports[_0xbc06('0x49')]=function(_0x59eac8,_0x1e39e8){var _0x90cd09={'raw':![],'where':{'id':_0x59eac8[_0xbc06('0x4a')]['id']}},_0x38151c={};_0x38151c[_0xbc06('0x35')]=_[_0xbc06('0x37')](db[_0xbc06('0x31')]['rawAttributes']);_0x38151c[_0xbc06('0x36')]=_[_0xbc06('0x37')](_0x59eac8[_0xbc06('0x36')]);_0x38151c[_0xbc06('0x38')]=_['intersection'](_0x38151c['model'],_0x38151c[_0xbc06('0x36')]);_0x90cd09[_0xbc06('0x3a')]=_['intersection'](_0x38151c[_0xbc06('0x35')],qs[_0xbc06('0x3b')](_0x59eac8['query'][_0xbc06('0x3b')]));_0x90cd09[_0xbc06('0x3a')]=_0x90cd09['attributes'][_0xbc06('0x3c')]?_0x90cd09['attributes']:_0x38151c['model'];if(_0x59eac8[_0xbc06('0x36')]['includeAll']){_0x90cd09['include']=[{'all':!![]}];}_0x90cd09=_['merge']({},_0x90cd09,_0x59eac8[_0xbc06('0x4b')]);return db[_0xbc06('0x31')][_0xbc06('0x4c')](_0x90cd09)[_0xbc06('0x27')](handleEntityNotFound(_0x1e39e8,null))[_0xbc06('0x27')](respondWithResult(_0x1e39e8,null))[_0xbc06('0x4d')](handleError(_0x1e39e8,null));};exports[_0xbc06('0x2b')]=function(_0x690e56,_0x120586){return db[_0xbc06('0x31')][_0xbc06('0x4c')]({'where':{'id':_0x690e56[_0xbc06('0x4a')]['id']}})[_0xbc06('0x27')](handleEntityNotFound(_0x120586,null))['then'](removeEntity(_0x120586,null))[_0xbc06('0x4d')](handleError(_0x120586,null));};exports[_0xbc06('0x4e')]=function(_0x26761a,_0x273431){return db[_0xbc06('0x31')]['describe']()[_0xbc06('0x27')](respondWithResult(_0x273431,null))[_0xbc06('0x4d')](handleError(_0x273431,null));};exports['create']=function(_0xcd6c30,_0x1cd55a){var _0x25c6c3;return db[_0xbc06('0x4f')][_0xbc06('0x50')](function(_0x3ca252){return db['VoicePrefix'][_0xbc06('0x51')](_0xcd6c30['body'],{'transaction':_0x3ca252})['then'](function(_0x30635e){_0x25c6c3=_0x30635e[_0xbc06('0x28')]({'plain':!![]});return db['VoiceExtension'][_0xbc06('0x4c')]({'where':{'id':_0x25c6c3[_0xbc06('0x52')]},'raw':!![]})['then'](function(_0xb05c9a){return createVoicePrefixExtensions(_0x25c6c3,_0xb05c9a,_0x3ca252);});});})['then'](function(){var _0xc8ba6f=_0xcd6c30[_0xbc06('0x53')][_0xbc06('0x28')]({'plain':!![]});if(!_0xc8ba6f)throw new Error(_0xbc06('0x54'));if(_0xc8ba6f[_0xbc06('0x55')]===_0xbc06('0x53')){var _0x502d12=_0x25c6c3;return db[_0xbc06('0x56')][_0xbc06('0x4c')]({'where':{'name':_0xbc06('0x29'),'userProfileId':_0xc8ba6f[_0xbc06('0x57')]},'raw':!![]})[_0xbc06('0x27')](function(_0x42c96d){if(_0x42c96d&&_0x42c96d[_0xbc06('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x502d12[_0xbc06('0x2e')],'resourceId':_0x502d12['id'],'type':_0x42c96d['name'],'sectionId':_0x42c96d['id']},{})[_0xbc06('0x27')](function(){return _0x25c6c3;});}else{return _0x25c6c3;}})[_0xbc06('0x4d')](function(_0x5ce1d4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ce1d4);throw _0x5ce1d4;});}return _0x25c6c3;})[_0xbc06('0x27')](respondWithResult(_0x1cd55a,null))[_0xbc06('0x4d')](handleError(_0x1cd55a,null));};function Extension(_0x2360e4,_0x27b91c,_0x438d05,_0x3c440a){this[_0xbc06('0x59')]=_0xbc06('0x5a');this[_0xbc06('0x5b')]=_0x2360e4;this[_0xbc06('0x5c')]=_0x438d05;this[_0xbc06('0x33')]=_0xbc06('0x5d');this[_0xbc06('0x5e')]=_0xbc06('0x5f');this[_0xbc06('0x60')]=_0x27b91c;this[_0xbc06('0x61')]=_0x3c440a;}function createVoicePrefixExtensions(_0x344ff7,_0x26f8c5,_0x2e378e){return new BPromise(function(_0x30280d,_0x29239b){var _0x3f4e6d=new Extension(formatPrefixName(_0x344ff7[_0xbc06('0x62')]),0x1,_0xbc06('0x63'),'Voice\x20Prefix');_0x3f4e6d[_0xbc06('0x64')]=_0x344ff7['id'];return db[_0xbc06('0x65')]['create'](_0x3f4e6d,{'transaction':_0x2e378e})[_0xbc06('0x27')](function(_0x5a42d8){var _0x235479=_0x5a42d8[_0xbc06('0x28')]({'plain':!![]});var _0x38c620=_['map'](addVoicePrefixExtensions(_0x344ff7,_0x26f8c5),function(_0x5ae753){_0x5ae753[_0xbc06('0x52')]=_0x235479['id'];_0x5ae753[_0xbc06('0x64')]=_0x344ff7['id'];return _0x5ae753;});return db[_0xbc06('0x65')][_0xbc06('0x66')](_0x38c620,{'transaction':_0x2e378e})[_0xbc06('0x27')](function(_0x242966){if(!_0x242966){return _0x29239b(_0xbc06('0x67'));}else{return _0x30280d(_0x242966);}})[_0xbc06('0x4d')](function(_0x30325c){return _0x29239b(_0x30325c);});});;});};function addVoicePrefixExtensions(_0x949f06,_0x5cd9d4){var _0x5cab8c=[];var _0x555977=formatPrefixName(_0x949f06[_0xbc06('0x62')]);_0x5cab8c[_0xbc06('0x68')](new Extension(_0x555977,0x2,'Set','CDR(prefix)='+_0x949f06[_0xbc06('0x2e')]));if(_0x949f06[_0xbc06('0x69')]){_0x5cab8c[_0xbc06('0x68')](new Extension(_0x555977,0x3,'Set',_0xbc06('0x6a')+_0x949f06['callerIdAll']));}else{_0x5cab8c[_0xbc06('0x68')](new Extension(_0x555977,0x3,_0xbc06('0x63'),_0xbc06('0x6b')));}_0x5cab8c[_0xbc06('0x68')](new Extension(_0x555977,0x4,_0xbc06('0x6c'),_0x5cd9d4[_0xbc06('0x59')]+','+'${EXTEN:'+(0x8+_0x949f06[_0xbc06('0x2e')][_0xbc06('0x3c')])+'}'+','+0x1));return _0x5cab8c;}function formatPrefixName(_0x387848){var _0xec34f3='_';for(var _0x5175e0=0x0;_0x5175e0<_0x387848[_0xbc06('0x3c')];_0x5175e0++){if(_0x387848[_0xbc06('0x6d')](_0x5175e0)=='-'){_0xec34f3+=_0x387848[_0xbc06('0x6d')](_0x5175e0);}else{_0xec34f3+='['+_0x387848[_0xbc06('0x6d')](_0x5175e0)+']';}}_0xec34f3+='.';return _0xec34f3;}exports[_0xbc06('0x26')]=function(_0xf447f3,_0x124a88,_0xb2bc0a){var _0x2c99e1=_0xf447f3['body'];_0x2c99e1[_0xbc06('0x62')]=_0xbc06('0x6e')+_0x2c99e1[_0xbc06('0x2e')]+'-';return db[_0xbc06('0x4f')]['transaction'](function(_0x556a6c){return db[_0xbc06('0x31')][_0xbc06('0x26')](_0x2c99e1,{'where':{'id':_0x2c99e1['id']},'transaction':_0x556a6c})[_0xbc06('0x27')](function(){return db[_0xbc06('0x65')][_0xbc06('0x2b')]({'where':{'VoicePrefixId':_0x2c99e1['id']},'transaction':_0x556a6c})['then'](function(){return db['VoiceExtension'][_0xbc06('0x4c')]({'where':{'id':_0x2c99e1[_0xbc06('0x52')]},'raw':!![]})['then'](function(_0x19bd0e){return createVoicePrefixExtensions(_0x2c99e1,_0x19bd0e,_0x556a6c);});});});})['then'](function(){return db[_0xbc06('0x31')]['findById'](_0x2c99e1['id']);})[_0xbc06('0x27')](respondWithResult(_0x124a88,null))[_0xbc06('0x4d')](handleError(_0x124a88,null));};exports[_0xbc06('0x6f')]=function(_0x2df05a,_0x424191,_0x164f12){return db['VoicePrefix']['find']({'where':{'id':_0x2df05a[_0xbc06('0x4a')]['id']}})['then'](handleEntityNotFound(_0x424191,null))[_0xbc06('0x27')](function(_0x5b8b1d){if(_0x5b8b1d){return _0x5b8b1d['addAgents'](_0x2df05a[_0xbc06('0x70')][_0xbc06('0x71')],_[_0xbc06('0x72')](_0x2df05a[_0xbc06('0x70')],['ids','id'])||{})[_0xbc06('0x73')](function(_0x1976fb){for(var _0x5f3204=0x0;_0x5f3204<_0x2df05a[_0xbc06('0x70')][_0xbc06('0x71')][_0xbc06('0x3c')];_0x5f3204+=0x1){socket[_0xbc06('0x74')](_0xbc06('0x75'),{'UserId':_0x2df05a[_0xbc06('0x70')]['ids'][_0x5f3204],'VoicePrefixId':_0x2df05a[_0xbc06('0x4a')]['id']});}return _0x1976fb;});}})[_0xbc06('0x27')](respondWithResult(_0x424191,null))[_0xbc06('0x4d')](handleError(_0x424191,null));};exports[_0xbc06('0x76')]=function(_0x434dad,_0x3e9199,_0xce4f7f){return db[_0xbc06('0x31')][_0xbc06('0x4c')]({'where':{'id':_0x434dad[_0xbc06('0x4a')]['id']}})[_0xbc06('0x27')](handleEntityNotFound(_0x3e9199,null))['then'](function(_0x365665){if(_0x365665){return _0x365665[_0xbc06('0x76')](_0x434dad[_0xbc06('0x36')]['ids'])['then'](function(){if(_[_0xbc06('0x77')](_0x434dad[_0xbc06('0x36')][_0xbc06('0x71')])){for(var _0x375227=0x0;_0x375227<_0x434dad['query']['ids'][_0xbc06('0x3c')];_0x375227+=0x1){socket[_0xbc06('0x74')](_0xbc06('0x78'),{'UserId':Number(_0x434dad['query']['ids'][_0x375227]),'VoicePrefixId':Number(_0x434dad[_0xbc06('0x4a')]['id'])});}}else{socket[_0xbc06('0x74')](_0xbc06('0x78'),{'UserId':Number(_0x434dad['query'][_0xbc06('0x71')]),'VoicePrefixId':Number(_0x434dad[_0xbc06('0x4a')]['id'])});}});}})[_0xbc06('0x27')](respondWithStatusCode(_0x3e9199,null))[_0xbc06('0x4d')](handleError(_0x3e9199,null));};exports[_0xbc06('0x79')]=function(_0x10c1a7,_0x401115,_0x530480){var _0x3bb083={};var _0x5deef4={};var _0x4ac7a3;var _0xb30295;return db[_0xbc06('0x31')]['findOne']({'where':{'id':_0x10c1a7[_0xbc06('0x4a')]['id']}})[_0xbc06('0x27')](handleEntityNotFound(_0x401115,null))['then'](function(_0x4cf496){if(_0x4cf496){_0x4ac7a3=_0x4cf496;_0x5deef4['model']=_[_0xbc06('0x37')](db[_0xbc06('0x7a')]['rawAttributes']);_0x5deef4[_0xbc06('0x36')]=_[_0xbc06('0x37')](_0x10c1a7[_0xbc06('0x36')]);_0x5deef4[_0xbc06('0x38')]=_[_0xbc06('0x39')](_0x5deef4[_0xbc06('0x35')],_0x5deef4[_0xbc06('0x36')]);_0x3bb083[_0xbc06('0x3a')]=_['intersection'](_0x5deef4[_0xbc06('0x35')],qs[_0xbc06('0x3b')](_0x10c1a7['query'][_0xbc06('0x3b')]));_0x3bb083[_0xbc06('0x3a')]=_0x3bb083[_0xbc06('0x3a')][_0xbc06('0x3c')]?_0x3bb083[_0xbc06('0x3a')]:_0x5deef4['model'];_0x3bb083[_0xbc06('0x7b')]=qs[_0xbc06('0x3f')](_0x10c1a7[_0xbc06('0x36')][_0xbc06('0x3f')]);_0x3bb083[_0xbc06('0x42')]=qs['filters'](_[_0xbc06('0x40')](_0x10c1a7[_0xbc06('0x36')],_0x5deef4['filters']));if(_0x10c1a7[_0xbc06('0x36')][_0xbc06('0x41')]){_0x3bb083[_0xbc06('0x42')]=_[_0xbc06('0x43')](_0x3bb083[_0xbc06('0x42')],{'$or':_[_0xbc06('0x30')](_0x3bb083[_0xbc06('0x3a')],function(_0x50cd18){var _0x5d846d={};_0x5d846d[_0x50cd18]={'$like':'%'+_0x10c1a7['query'][_0xbc06('0x41')]+'%'};return _0x5d846d;})});}_0x3bb083=_[_0xbc06('0x43')]({},_0x3bb083,_0x10c1a7[_0xbc06('0x4b')]);return _0x4ac7a3[_0xbc06('0x79')](_0x3bb083);}})[_0xbc06('0x27')](function(_0x4b783e){if(_0x4b783e){_0xb30295=_0x4b783e[_0xbc06('0x3c')];if(!_0x10c1a7[_0xbc06('0x36')][_0xbc06('0x3d')]('nolimit')){_0x3bb083[_0xbc06('0x22')]=qs[_0xbc06('0x22')](_0x10c1a7['query'][_0xbc06('0x22')]);_0x3bb083['offset']=qs[_0xbc06('0x21')](_0x10c1a7[_0xbc06('0x36')]['offset']);}return _0x4ac7a3[_0xbc06('0x79')](_0x3bb083);}})[_0xbc06('0x27')](function(_0x51a36f){if(_0x51a36f){return _0x51a36f?{'count':_0xb30295,'rows':_0x51a36f}:null;}})[_0xbc06('0x27')](respondWithResult(_0x401115,null))[_0xbc06('0x4d')](handleError(_0x401115,null));}; \ No newline at end of file +var _0x394d=['filter','where','merge','VIRTUAL','options','VoicePrefix','include','findAll','show','params','intersection','includeAll','find','describe','sequelize','transaction','body','get','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtension','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','charAt','system-','findById','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','User','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','VoicePrefixes','UserProfileResource','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x394d,0xb9));var _0xd394=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x394d[_0x42bdad];return _0x122626;};'use strict';var pdf=require(_0xd394('0x0'));var emlformat=require(_0xd394('0x1'));var rimraf=require(_0xd394('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd394('0x3'));var moment=require('moment');var BPromise=require(_0xd394('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd394('0x5'));var sox=require(_0xd394('0x6'));var csv=require('to-csv');var ejs=require(_0xd394('0x7'));var fs=require('fs');var _=require(_0xd394('0x8'));var squel=require(_0xd394('0x9'));var crypto=require(_0xd394('0xa'));var jsforce=require(_0xd394('0xb'));var deskjs=require(_0xd394('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd394('0xd'));var Papa=require(_0xd394('0xe'));var Redis=require(_0xd394('0xf'));var authService=require(_0xd394('0x10'));var qs=require(_0xd394('0x11'));var as=require(_0xd394('0x12'));var hardwareService=require(_0xd394('0x13'));var logger=require(_0xd394('0x14'))(_0xd394('0x15'));var utils=require(_0xd394('0x16'));var config=require(_0xd394('0x17'));var db=require(_0xd394('0x18'))['db'];config[_0xd394('0x19')]=_[_0xd394('0x1a')](config[_0xd394('0x19')],{'host':_0xd394('0x1b'),'port':0x18eb});var socket=require(_0xd394('0x1c'))(new Redis(config[_0xd394('0x19')]));require(_0xd394('0x1d'))[_0xd394('0x1e')](socket);function respondWithStatusCode(_0x4f3e8d,_0x5c1646){_0x5c1646=_0x5c1646||0xcc;return function(_0x25b53f){if(_0x25b53f){return _0x4f3e8d['sendStatus'](_0x5c1646);}return _0x4f3e8d[_0xd394('0x1f')](_0x5c1646)[_0xd394('0x20')]();};}function respondWithResult(_0x3f1fcb,_0x24511f){_0x24511f=_0x24511f||0xc8;return function(_0x115d6b){if(_0x115d6b){return _0x3f1fcb[_0xd394('0x1f')](_0x24511f)[_0xd394('0x21')](_0x115d6b);}};}function respondWithFilteredResult(_0x105faa,_0x313111){return function(_0x238ab5){if(_0x238ab5){var _0x1cfd22=_0x238ab5[_0xd394('0x22')],_0x4474c6=_0x313111[_0xd394('0x23')],_0x1dc771=_0x313111['offset']+_0x313111[_0xd394('0x24')],_0x54fc9e;if(_0x1dc771>=_0x1cfd22){_0x1dc771=_0x1cfd22;_0x54fc9e=0xc8;}else{_0x54fc9e=0xce;}_0x105faa[_0xd394('0x1f')](_0x54fc9e);return _0x105faa[_0xd394('0x25')](_0xd394('0x26'),_0x4474c6+'-'+_0x1dc771+'/'+_0x1cfd22)['json'](_0x238ab5);}return null;};}function patchUpdates(_0x276203){return function(_0x4d7acb){try{jsonpatch[_0xd394('0x27')](_0x4d7acb,_0x276203,!![]);}catch(_0x314690){return BPromise[_0xd394('0x28')](_0x314690);}return _0x4d7acb['save']();};}function saveUpdates(_0x3c11fc,_0x50f4f){return function(_0x4bab24){if(_0x4bab24){return _0x4bab24[_0xd394('0x29')](_0x3c11fc)[_0xd394('0x2a')](function(_0xcb138f){return _0xcb138f;});}return null;};}function removeEntity(_0x4fea08,_0x36201a){return function(_0x4b0b12){if(_0x4b0b12){return _0x4b0b12[_0xd394('0x2b')]()[_0xd394('0x2a')](function(){var _0x1bcbb4=_0x4b0b12['get']({'plain':!![]});var _0x5c9437=_0xd394('0x2c');return db[_0xd394('0x2d')]['destroy']({'where':{'type':_0x5c9437,'resourceId':_0x1bcbb4['id']}})[_0xd394('0x2a')](function(){return _0x4b0b12;});})[_0xd394('0x2a')](function(){_0x4fea08[_0xd394('0x1f')](0xcc)[_0xd394('0x20')]();});}};}function handleEntityNotFound(_0x5832fa,_0x4abc3d){return function(_0x4d2e2e){if(!_0x4d2e2e){_0x5832fa[_0xd394('0x2e')](0x194);}return _0x4d2e2e;};}function handleError(_0xe14120,_0x186c56){_0x186c56=_0x186c56||0x1f4;return function(_0x14e259){logger[_0xd394('0x2f')](_0x14e259[_0xd394('0x30')]);if(_0x14e259['name']){delete _0x14e259['name'];}_0xe14120[_0xd394('0x1f')](_0x186c56)[_0xd394('0x31')](_0x14e259);};}exports[_0xd394('0x32')]=function(_0x3f2a3b,_0x4f05bd){var _0x3ba2ce={},_0x194e8a={},_0x3b98c6={'count':0x0,'rows':[]};var _0x34a126=_[_0xd394('0x33')](db['VoicePrefix'][_0xd394('0x34')],function(_0x23f7f5){return{'name':_0x23f7f5[_0xd394('0x35')],'type':_0x23f7f5[_0xd394('0x36')][_0xd394('0x37')]};});_0x194e8a[_0xd394('0x38')]=_[_0xd394('0x33')](_0x34a126,_0xd394('0x39'));_0x194e8a['query']=_[_0xd394('0x3a')](_0x3f2a3b[_0xd394('0x3b')]);_0x194e8a[_0xd394('0x3c')]=_['intersection'](_0x194e8a[_0xd394('0x38')],_0x194e8a[_0xd394('0x3b')]);_0x3ba2ce[_0xd394('0x3d')]=_['intersection'](_0x194e8a[_0xd394('0x38')],qs[_0xd394('0x3e')](_0x3f2a3b[_0xd394('0x3b')][_0xd394('0x3e')]));_0x3ba2ce['attributes']=_0x3ba2ce['attributes'][_0xd394('0x3f')]?_0x3ba2ce['attributes']:_0x194e8a[_0xd394('0x38')];if(!_0x3f2a3b[_0xd394('0x3b')][_0xd394('0x40')](_0xd394('0x41'))){_0x3ba2ce[_0xd394('0x24')]=qs[_0xd394('0x24')](_0x3f2a3b['query'][_0xd394('0x24')]);_0x3ba2ce[_0xd394('0x23')]=qs['offset'](_0x3f2a3b['query'][_0xd394('0x23')]);}_0x3ba2ce['order']=qs[_0xd394('0x42')](_0x3f2a3b[_0xd394('0x3b')]['sort']);_0x3ba2ce['where']=qs[_0xd394('0x3c')](_['pick'](_0x3f2a3b[_0xd394('0x3b')],_0x194e8a['filters']),_0x34a126);if(_0x3f2a3b[_0xd394('0x3b')][_0xd394('0x43')]){_0x3ba2ce[_0xd394('0x44')]=_[_0xd394('0x45')](_0x3ba2ce[_0xd394('0x44')],{'$or':_['map'](_0x34a126,function(_0x480910){if(_0x480910[_0xd394('0x36')]!==_0xd394('0x46')){var _0x524689={};_0x524689[_0x480910[_0xd394('0x39')]]={'$like':'%'+_0x3f2a3b[_0xd394('0x3b')][_0xd394('0x43')]+'%'};return _0x524689;}})});}_0x3ba2ce=_[_0xd394('0x45')]({},_0x3ba2ce,_0x3f2a3b[_0xd394('0x47')]);var _0xf99a9d={'where':_0x3ba2ce[_0xd394('0x44')]};return db[_0xd394('0x48')][_0xd394('0x22')](_0xf99a9d)[_0xd394('0x2a')](function(_0x5dbf51){_0x3b98c6[_0xd394('0x22')]=_0x5dbf51;if(_0x3f2a3b['query']['includeAll']){_0x3ba2ce[_0xd394('0x49')]=[{'all':!![]}];}return db[_0xd394('0x48')][_0xd394('0x4a')](_0x3ba2ce);})['then'](function(_0x37d113){_0x3b98c6['rows']=_0x37d113;return _0x3b98c6;})[_0xd394('0x2a')](respondWithFilteredResult(_0x4f05bd,_0x3ba2ce))['catch'](handleError(_0x4f05bd,null));};exports[_0xd394('0x4b')]=function(_0xbfa64a,_0x116de3){var _0x553114={'raw':![],'where':{'id':_0xbfa64a[_0xd394('0x4c')]['id']}},_0x54ee78={};_0x54ee78[_0xd394('0x38')]=_[_0xd394('0x3a')](db[_0xd394('0x48')][_0xd394('0x34')]);_0x54ee78['query']=_[_0xd394('0x3a')](_0xbfa64a[_0xd394('0x3b')]);_0x54ee78[_0xd394('0x3c')]=_[_0xd394('0x4d')](_0x54ee78[_0xd394('0x38')],_0x54ee78['query']);_0x553114['attributes']=_['intersection'](_0x54ee78[_0xd394('0x38')],qs['fields'](_0xbfa64a[_0xd394('0x3b')]['fields']));_0x553114[_0xd394('0x3d')]=_0x553114[_0xd394('0x3d')]['length']?_0x553114[_0xd394('0x3d')]:_0x54ee78[_0xd394('0x38')];if(_0xbfa64a['query'][_0xd394('0x4e')]){_0x553114[_0xd394('0x49')]=[{'all':!![]}];}_0x553114=_[_0xd394('0x45')]({},_0x553114,_0xbfa64a['options']);return db['VoicePrefix'][_0xd394('0x4f')](_0x553114)[_0xd394('0x2a')](handleEntityNotFound(_0x116de3,null))[_0xd394('0x2a')](respondWithResult(_0x116de3,null))['catch'](handleError(_0x116de3,null));};exports[_0xd394('0x2b')]=function(_0x38853d,_0x3a1bb7){return db['VoicePrefix'][_0xd394('0x4f')]({'where':{'id':_0x38853d[_0xd394('0x4c')]['id']}})[_0xd394('0x2a')](handleEntityNotFound(_0x3a1bb7,null))[_0xd394('0x2a')](removeEntity(_0x3a1bb7,null))['catch'](handleError(_0x3a1bb7,null));};exports[_0xd394('0x50')]=function(_0x456b7f,_0x3c51bd){return db['VoicePrefix'][_0xd394('0x50')]()[_0xd394('0x2a')](respondWithResult(_0x3c51bd,null))['catch'](handleError(_0x3c51bd,null));};exports['create']=function(_0x1dc86b,_0x922fe6){var _0x385235;return db[_0xd394('0x51')][_0xd394('0x52')](function(_0x4f7506){return db[_0xd394('0x48')]['create'](_0x1dc86b[_0xd394('0x53')],{'transaction':_0x4f7506})[_0xd394('0x2a')](function(_0xf4617){_0x385235=_0xf4617[_0xd394('0x54')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x385235[_0xd394('0x55')]},'raw':!![]})[_0xd394('0x2a')](function(_0x475c35){return createVoicePrefixExtensions(_0x385235,_0x475c35,_0x4f7506);});});})[_0xd394('0x2a')](function(){var _0x1c0a46=_0x1dc86b[_0xd394('0x56')]['get']({'plain':!![]});if(!_0x1c0a46)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c0a46[_0xd394('0x57')]===_0xd394('0x56')){var _0x65f8df=_0x385235;return db[_0xd394('0x58')]['find']({'where':{'name':_0xd394('0x2c'),'userProfileId':_0x1c0a46[_0xd394('0x59')]},'raw':!![]})['then'](function(_0x10b85d){if(_0x10b85d&&_0x10b85d[_0xd394('0x5a')]===0x0){return db['UserProfileResource'][_0xd394('0x5b')]({'name':_0x65f8df[_0xd394('0x39')],'resourceId':_0x65f8df['id'],'type':_0x10b85d[_0xd394('0x39')],'sectionId':_0x10b85d['id']},{})[_0xd394('0x2a')](function(){return _0x385235;});}else{return _0x385235;}})[_0xd394('0x5c')](function(_0x45ec6d){logger[_0xd394('0x2f')](_0xd394('0x5d'),_0x45ec6d);throw _0x45ec6d;});}return _0x385235;})[_0xd394('0x2a')](respondWithResult(_0x922fe6,null))[_0xd394('0x5c')](handleError(_0x922fe6,null));};function Extension(_0x3359b4,_0x5c84ab,_0xd7ac25,_0x34ad59){this[_0xd394('0x5e')]=_0xd394('0x5f');this[_0xd394('0x60')]=_0x3359b4;this['app']=_0xd7ac25;this[_0xd394('0x36')]='system';this[_0xd394('0x61')]=_0xd394('0x62');this[_0xd394('0x63')]=_0x5c84ab;this[_0xd394('0x64')]=_0x34ad59;}function createVoicePrefixExtensions(_0x52226a,_0x3356c5,_0x2ffc81){return new BPromise(function(_0x5b1f68,_0x85c65){var _0x158447=new Extension(formatPrefixName(_0x52226a[_0xd394('0x65')]),0x1,_0xd394('0x66'),_0xd394('0x67'));_0x158447['VoicePrefixId']=_0x52226a['id'];return db[_0xd394('0x68')][_0xd394('0x5b')](_0x158447,{'transaction':_0x2ffc81})[_0xd394('0x2a')](function(_0x2f1b1c){var _0xa1e569=_0x2f1b1c['get']({'plain':!![]});var _0x841b1e=_[_0xd394('0x33')](addVoicePrefixExtensions(_0x52226a,_0x3356c5),function(_0x24c1bc){_0x24c1bc[_0xd394('0x55')]=_0xa1e569['id'];_0x24c1bc[_0xd394('0x69')]=_0x52226a['id'];return _0x24c1bc;});return db[_0xd394('0x68')][_0xd394('0x6a')](_0x841b1e,{'transaction':_0x2ffc81})[_0xd394('0x2a')](function(_0x5c403d){if(!_0x5c403d){return _0x85c65('Extensions\x20creation\x20failed');}else{return _0x5b1f68(_0x5c403d);}})['catch'](function(_0x5ebdad){return _0x85c65(_0x5ebdad);});});;});};function addVoicePrefixExtensions(_0x392cb1,_0xa15353){var _0x1da20c=[];var _0x894580=formatPrefixName(_0x392cb1[_0xd394('0x65')]);_0x1da20c[_0xd394('0x6b')](new Extension(_0x894580,0x2,_0xd394('0x6c'),_0xd394('0x6d')+_0x392cb1['name']));if(_0x392cb1['callerIdAll']){_0x1da20c['push'](new Extension(_0x894580,0x3,_0xd394('0x6c'),_0xd394('0x6e')+_0x392cb1[_0xd394('0x6f')]));}else{_0x1da20c[_0xd394('0x6b')](new Extension(_0x894580,0x3,_0xd394('0x66'),_0xd394('0x70')));}_0x1da20c['push'](new Extension(_0x894580,0x4,'goto',_0xa15353[_0xd394('0x5e')]+','+'${EXTEN:'+(0x8+_0x392cb1[_0xd394('0x39')]['length'])+'}'+','+0x1));return _0x1da20c;}function formatPrefixName(_0x2b7621){var _0x414a6a='_';for(var _0x51b3dd=0x0;_0x51b3dd<_0x2b7621[_0xd394('0x3f')];_0x51b3dd++){if(_0x2b7621[_0xd394('0x71')](_0x51b3dd)=='-'){_0x414a6a+=_0x2b7621[_0xd394('0x71')](_0x51b3dd);}else{_0x414a6a+='['+_0x2b7621[_0xd394('0x71')](_0x51b3dd)+']';}}_0x414a6a+='.';return _0x414a6a;}exports[_0xd394('0x29')]=function(_0x22bf75,_0x29f721,_0xcccefa){var _0x5c71d2=_0x22bf75['body'];_0x5c71d2[_0xd394('0x65')]=_0xd394('0x72')+_0x5c71d2[_0xd394('0x39')]+'-';return db[_0xd394('0x51')][_0xd394('0x52')](function(_0x51c9db){return db[_0xd394('0x48')][_0xd394('0x29')](_0x5c71d2,{'where':{'id':_0x5c71d2['id']},'transaction':_0x51c9db})[_0xd394('0x2a')](function(){return db[_0xd394('0x68')][_0xd394('0x2b')]({'where':{'VoicePrefixId':_0x5c71d2['id']},'transaction':_0x51c9db})[_0xd394('0x2a')](function(){return db['VoiceExtension'][_0xd394('0x4f')]({'where':{'id':_0x5c71d2[_0xd394('0x55')]},'raw':!![]})[_0xd394('0x2a')](function(_0x1a006b){return createVoicePrefixExtensions(_0x5c71d2,_0x1a006b,_0x51c9db);});});});})[_0xd394('0x2a')](function(){return db[_0xd394('0x48')][_0xd394('0x73')](_0x5c71d2['id']);})[_0xd394('0x2a')](respondWithResult(_0x29f721,null))['catch'](handleError(_0x29f721,null));};exports[_0xd394('0x74')]=function(_0x3da1c1,_0x101434,_0x2b7f0b){return db['VoicePrefix'][_0xd394('0x4f')]({'where':{'id':_0x3da1c1[_0xd394('0x4c')]['id']}})[_0xd394('0x2a')](handleEntityNotFound(_0x101434,null))[_0xd394('0x2a')](function(_0x2ba597){if(_0x2ba597){return _0x2ba597[_0xd394('0x74')](_0x3da1c1[_0xd394('0x53')][_0xd394('0x75')],_[_0xd394('0x76')](_0x3da1c1[_0xd394('0x53')],[_0xd394('0x75'),'id'])||{})[_0xd394('0x77')](function(_0x3d601d){for(var _0x2ad711=0x0;_0x2ad711<_0x3da1c1[_0xd394('0x53')]['ids'][_0xd394('0x3f')];_0x2ad711+=0x1){socket['emit'](_0xd394('0x78'),{'UserId':_0x3da1c1[_0xd394('0x53')][_0xd394('0x75')][_0x2ad711],'VoicePrefixId':_0x3da1c1[_0xd394('0x4c')]['id']});}return _0x3d601d;});}})['then'](respondWithResult(_0x101434,null))['catch'](handleError(_0x101434,null));};exports[_0xd394('0x79')]=function(_0x15b1c9,_0x4f0f66,_0x4f13ea){return db['VoicePrefix'][_0xd394('0x4f')]({'where':{'id':_0x15b1c9['params']['id']}})[_0xd394('0x2a')](handleEntityNotFound(_0x4f0f66,null))[_0xd394('0x2a')](function(_0x3b1585){if(_0x3b1585){return _0x3b1585[_0xd394('0x79')](_0x15b1c9[_0xd394('0x3b')]['ids'])[_0xd394('0x2a')](function(){if(_['isArray'](_0x15b1c9['query'][_0xd394('0x75')])){for(var _0x3530c7=0x0;_0x3530c7<_0x15b1c9[_0xd394('0x3b')][_0xd394('0x75')]['length'];_0x3530c7+=0x1){socket[_0xd394('0x7a')](_0xd394('0x7b'),{'UserId':Number(_0x15b1c9[_0xd394('0x3b')][_0xd394('0x75')][_0x3530c7]),'VoicePrefixId':Number(_0x15b1c9[_0xd394('0x4c')]['id'])});}}else{socket[_0xd394('0x7a')](_0xd394('0x7b'),{'UserId':Number(_0x15b1c9['query']['ids']),'VoicePrefixId':Number(_0x15b1c9['params']['id'])});}});}})[_0xd394('0x2a')](respondWithStatusCode(_0x4f0f66,null))[_0xd394('0x5c')](handleError(_0x4f0f66,null));};exports['getAgents']=function(_0x26d46a,_0x1578d6,_0x579e08){var _0x109585={};var _0x4e804b={};var _0x351685;var _0x4bae5c;return db['VoicePrefix']['findOne']({'where':{'id':_0x26d46a['params']['id']}})['then'](handleEntityNotFound(_0x1578d6,null))[_0xd394('0x2a')](function(_0x319a05){if(_0x319a05){_0x351685=_0x319a05;_0x4e804b['model']=_[_0xd394('0x3a')](db[_0xd394('0x7c')]['rawAttributes']);_0x4e804b[_0xd394('0x3b')]=_[_0xd394('0x3a')](_0x26d46a[_0xd394('0x3b')]);_0x4e804b[_0xd394('0x3c')]=_['intersection'](_0x4e804b[_0xd394('0x38')],_0x4e804b[_0xd394('0x3b')]);_0x109585[_0xd394('0x3d')]=_[_0xd394('0x4d')](_0x4e804b['model'],qs['fields'](_0x26d46a['query'][_0xd394('0x3e')]));_0x109585[_0xd394('0x3d')]=_0x109585[_0xd394('0x3d')][_0xd394('0x3f')]?_0x109585[_0xd394('0x3d')]:_0x4e804b[_0xd394('0x38')];_0x109585['order']=qs[_0xd394('0x42')](_0x26d46a[_0xd394('0x3b')][_0xd394('0x42')]);_0x109585[_0xd394('0x44')]=qs[_0xd394('0x3c')](_[_0xd394('0x7d')](_0x26d46a[_0xd394('0x3b')],_0x4e804b['filters']));if(_0x26d46a[_0xd394('0x3b')][_0xd394('0x43')]){_0x109585[_0xd394('0x44')]=_[_0xd394('0x45')](_0x109585[_0xd394('0x44')],{'$or':_[_0xd394('0x33')](_0x109585['attributes'],function(_0x44f3a0){var _0x370d5b={};_0x370d5b[_0x44f3a0]={'$like':'%'+_0x26d46a['query'][_0xd394('0x43')]+'%'};return _0x370d5b;})});}_0x109585=_[_0xd394('0x45')]({},_0x109585,_0x26d46a[_0xd394('0x47')]);return _0x351685['getAgents'](_0x109585);}})[_0xd394('0x2a')](function(_0x4b312e){if(_0x4b312e){_0x4bae5c=_0x4b312e['length'];if(!_0x26d46a[_0xd394('0x3b')]['hasOwnProperty']('nolimit')){_0x109585[_0xd394('0x24')]=qs[_0xd394('0x24')](_0x26d46a['query'][_0xd394('0x24')]);_0x109585[_0xd394('0x23')]=qs[_0xd394('0x23')](_0x26d46a[_0xd394('0x3b')][_0xd394('0x23')]);}return _0x351685['getAgents'](_0x109585);}})[_0xd394('0x2a')](function(_0x2167cd){if(_0x2167cd){return _0x2167cd?{'count':_0x4bae5c,'rows':_0x2167cd}:null;}})[_0xd394('0x2a')](respondWithResult(_0x1578d6,null))[_0xd394('0x5c')](handleError(_0x1578d6,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 77eae06..64f4011 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners'];(function(_0x462dca,_0x5d50bf){var _0x2b994c=function(_0x2d6def){while(--_0x2d6def){_0x462dca['push'](_0x462dca['shift']());}};_0x2b994c(++_0x5d50bf);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x49c4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){VoicePrefixEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);VoicePrefixEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];VoicePrefix[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x34e8,0x12c));var _0x834e=function(_0x3a9123,_0x538c2d){_0x3a9123=_0x3a9123-0x0;var _0x54c15a=_0x34e8[_0x3a9123];return _0x54c15a;};'use strict';var EventEmitter=require(_0x834e('0x0'));var VoicePrefix=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){VoicePrefixEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);VoicePrefixEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 7b4b3f5..9186c3b 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 _0x9460=['voice_prefixes','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix'];(function(_0x465278,_0x234e8b){var _0x30525d=function(_0x4fc244){while(--_0x4fc244){_0x465278['push'](_0x465278['shift']());}};_0x30525d(++_0x234e8b);}(_0x9460,0x12c));var _0x0946=function(_0x2f13da,_0x220e35){_0x2f13da=_0x2f13da-0x0;var _0x1e1a01=_0x9460[_0x2f13da];return _0x1e1a01;};'use strict';var _=require('lodash');var util=require(_0x0946('0x0'));var logger=require(_0x0946('0x1'))(_0x0946('0x2'));var moment=require(_0x0946('0x3'));var BPromise=require(_0x0946('0x4'));var rp=require(_0x0946('0x5'));var fs=require('fs');var path=require(_0x0946('0x6'));var rimraf=require(_0x0946('0x7'));var config=require(_0x0946('0x8'));var attributes=require(_0x0946('0x9'));module[_0x0946('0xa')]=function(_0x523d62,_0x476a1b){return _0x523d62['define'](_0x0946('0xb'),attributes,{'tableName':_0x0946('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2a4=['path','rimraf','../../config/environment','exports','define','voice_prefixes','lodash','util','moment','bluebird','request-promise'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xc2a4,0x1ea));var _0x4c2a=function(_0x47a6a4,_0x30c996){_0x47a6a4=_0x47a6a4-0x0;var _0x30d371=_0xc2a4[_0x47a6a4];return _0x30d371;};'use strict';var _=require(_0x4c2a('0x0'));var util=require(_0x4c2a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4c2a('0x2'));var BPromise=require(_0x4c2a('0x3'));var rp=require(_0x4c2a('0x4'));var fs=require('fs');var path=require(_0x4c2a('0x5'));var rimraf=require(_0x4c2a('0x6'));var config=require(_0x4c2a('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x4c2a('0x8')]=function(_0x31d92f,_0x47b4ed){return _0x31d92f[_0x4c2a('0x9')]('VoicePrefix',attributes,{'tableName':_0x4c2a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index bf3b6f6..1a8a2eb 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 _0x1805=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x477a4f,_0x4ccf31){var _0xeb2557=function(_0x525899){while(--_0x525899){_0x477a4f['push'](_0x477a4f['shift']());}};_0xeb2557(++_0x4ccf31);}(_0x1805,0x1bf));var _0x5180=function(_0x15c3c9,_0x25a4ae){_0x15c3c9=_0x15c3c9-0x0;var _0x5b792e=_0x1805[_0x15c3c9];return _0x5b792e;};'use strict';var _=require('lodash');var util=require(_0x5180('0x0'));var moment=require(_0x5180('0x1'));var BPromise=require(_0x5180('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5180('0x3'));var db=require(_0x5180('0x4'))['db'];var utils=require(_0x5180('0x5'));var logger=require(_0x5180('0x6'))(_0x5180('0x7'));var config=require(_0x5180('0x8'));var jayson=require(_0x5180('0x9'));var client=jayson[_0x5180('0xa')][_0x5180('0xb')]({'port':0x232a});config[_0x5180('0xc')]=_[_0x5180('0xd')](config[_0x5180('0xc')],{'host':_0x5180('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5180('0xc')]));require(_0x5180('0xf'))[_0x5180('0x10')](socket);function respondWithRpcPromise(_0x314759,_0x4c3127,_0x71c567){return new BPromise(function(_0x5544a9,_0x43eab5){return client[_0x5180('0x11')](_0x314759,_0x71c567)[_0x5180('0x12')](function(_0x5c9cf0){logger[_0x5180('0x13')](_0x5180('0x14'),_0x4c3127,_0x5180('0x15'));logger[_0x5180('0x16')](_0x5180('0x17'),_0x4c3127,_0x5180('0x15'),JSON[_0x5180('0x18')](_0x5c9cf0));if(_0x5c9cf0['error']){if(_0x5c9cf0[_0x5180('0x19')][_0x5180('0x1a')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x4c3127,_0x5c9cf0[_0x5180('0x19')][_0x5180('0x1b')]);return _0x43eab5(_0x5c9cf0[_0x5180('0x19')][_0x5180('0x1b')]);}logger[_0x5180('0x19')](_0x5180('0x14'),_0x4c3127,_0x5c9cf0[_0x5180('0x19')]['message']);return _0x5544a9(_0x5c9cf0['error'][_0x5180('0x1b')]);}else{logger['info'](_0x5180('0x14'),_0x4c3127,_0x5180('0x15'));_0x5544a9(_0x5c9cf0[_0x5180('0x1c')]['message']);}})[_0x5180('0x1d')](function(_0x1e54e3){logger[_0x5180('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x4c3127,_0x1e54e3);_0x43eab5(_0x1e54e3);});});} \ No newline at end of file +var _0x9039=['register','request','then','info','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x9039,0x1a1));var _0x9903=function(_0x1d8fa1,_0x18d00f){_0x1d8fa1=_0x1d8fa1-0x0;var _0x528467=_0x9039[_0x1d8fa1];return _0x528467;};'use strict';var _=require(_0x9903('0x0'));var util=require(_0x9903('0x1'));var moment=require(_0x9903('0x2'));var BPromise=require(_0x9903('0x3'));var rs=require(_0x9903('0x4'));var fs=require('fs');var Redis=require(_0x9903('0x5'));var db=require(_0x9903('0x6'))['db'];var utils=require(_0x9903('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9903('0x8')][_0x9903('0x9')]({'port':0x232a});config['redis']=_[_0x9903('0xa')](config['redis'],{'host':_0x9903('0xb'),'port':0x18eb});var socket=require(_0x9903('0xc'))(new Redis(config[_0x9903('0xd')]));require(_0x9903('0xe'))[_0x9903('0xf')](socket);function respondWithRpcPromise(_0x1ad8ae,_0x589d61,_0x4135b5){return new BPromise(function(_0x2e2bb7,_0x304615){return client[_0x9903('0x10')](_0x1ad8ae,_0x4135b5)[_0x9903('0x11')](function(_0x58704f){logger[_0x9903('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x589d61,'request\x20sent');logger['debug'](_0x9903('0x13'),_0x589d61,_0x9903('0x14'),JSON[_0x9903('0x15')](_0x58704f));if(_0x58704f[_0x9903('0x16')]){if(_0x58704f[_0x9903('0x16')][_0x9903('0x17')]===0x1f4){logger[_0x9903('0x16')](_0x9903('0x18'),_0x589d61,_0x58704f[_0x9903('0x16')][_0x9903('0x19')]);return _0x304615(_0x58704f[_0x9903('0x16')][_0x9903('0x19')]);}logger[_0x9903('0x16')](_0x9903('0x18'),_0x589d61,_0x58704f[_0x9903('0x16')][_0x9903('0x19')]);return _0x2e2bb7(_0x58704f[_0x9903('0x16')][_0x9903('0x19')]);}else{logger[_0x9903('0x12')](_0x9903('0x18'),_0x589d61,_0x9903('0x14'));_0x2e2bb7(_0x58704f['result'][_0x9903('0x19')]);}})[_0x9903('0x1a')](function(_0x508ece){logger[_0x9903('0x16')](_0x9903('0x18'),_0x589d61,_0x508ece);_0x304615(_0x508ece);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 59ab155..6d529b1 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 _0xaa95=['removeListener','register','length','save','update','emit'];(function(_0x16d10b,_0x5182fc){var _0xf9ab16=function(_0x1e9307){while(--_0x1e9307){_0x16d10b['push'](_0x16d10b['shift']());}};_0xf9ab16(++_0x5182fc);}(_0xaa95,0x135));var _0x5aa9=function(_0x202712,_0x74544a){_0x202712=_0x202712-0x0;var _0x5340aa=_0xaa95[_0x202712];return _0x5340aa;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x5aa9('0x0'),'remove',_0x5aa9('0x1')];function createListener(_0x17c45e,_0x277f09){return function(_0x3a1b20){_0x277f09[_0x5aa9('0x2')](_0x17c45e,_0x3a1b20);};}function removeListener(_0x31565e,_0x2bfb67){return function(){VoicePrefixEvents[_0x5aa9('0x3')](_0x31565e,_0x2bfb67);};}exports[_0x5aa9('0x4')]=function(_0x38a466){for(var _0x5dac28=0x0,_0x28052f=events[_0x5aa9('0x5')];_0x5dac28<_0x28052f;_0x5dac28++){var _0x562071=events[_0x5dac28];var _0x5aaa20=createListener('voicePrefix:'+_0x562071,_0x38a466);VoicePrefixEvents['on'](_0x562071,_0x5aaa20);}}; \ No newline at end of file +var _0x0298=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','emit'];(function(_0x5f3b0a,_0x442f2f){var _0x81e1f3=function(_0x4a6a9c){while(--_0x4a6a9c){_0x5f3b0a['push'](_0x5f3b0a['shift']());}};_0x81e1f3(++_0x442f2f);}(_0x0298,0x10c));var _0x8029=function(_0x271158,_0x3c4a1c){_0x271158=_0x271158-0x0;var _0x11f139=_0x0298[_0x271158];return _0x11f139;};'use strict';var VoicePrefixEvents=require(_0x8029('0x0'));var events=[_0x8029('0x1'),_0x8029('0x2'),'update'];function createListener(_0x19d515,_0x282b1e){return function(_0xa997a0){_0x282b1e[_0x8029('0x3')](_0x19d515,_0xa997a0);};}function removeListener(_0x5cf406,_0xfe2c81){return function(){VoicePrefixEvents[_0x8029('0x4')](_0x5cf406,_0xfe2c81);};}exports[_0x8029('0x5')]=function(_0x19e049){for(var _0x14dd98=0x0,_0x3c9c8e=events[_0x8029('0x6')];_0x14dd98<_0x3c9c8e;_0x14dd98++){var _0x480097=events[_0x14dd98];var _0x2f1e66=createListener(_0x8029('0x7')+_0x480097,_0x19e049);VoicePrefixEvents['on'](_0x480097,_0x2f1e66);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 913518e..d53b9c5 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 _0x3076=['./voiceQueue.controller','get','isAuthenticated','/:id','show','getHoppers','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addAgents','put','delete','destroy','removeTeams','removeAgents','removeBlackLists','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4c113d,_0x1ab597){var _0x258bc4=function(_0x16c818){while(--_0x16c818){_0x4c113d['push'](_0x4c113d['shift']());}};_0x258bc4(++_0x1ab597);}(_0x3076,0x119));var _0x6307=function(_0x13fef4,_0x5b5610){_0x13fef4=_0x13fef4-0x0;var _0x518aef=_0x3076[_0x13fef4];return _0x518aef;};'use strict';var multer=require(_0x6307('0x0'));var util=require(_0x6307('0x1'));var path=require('path');var timeout=require(_0x6307('0x2'));var express=require(_0x6307('0x3'));var router=express[_0x6307('0x4')]();var auth=require(_0x6307('0x5'));var interaction=require(_0x6307('0x6'));var config=require('../../config/environment');var controller=require(_0x6307('0x7'));router[_0x6307('0x8')]('/',auth[_0x6307('0x9')](),controller['index']);router['get'](_0x6307('0xa'),auth[_0x6307('0x9')](),controller[_0x6307('0xb')]);router[_0x6307('0x8')]('/:id/hoppers',auth[_0x6307('0x9')](),controller[_0x6307('0xc')]);router[_0x6307('0x8')]('/:id/hopper_histories',auth[_0x6307('0x9')](),controller[_0x6307('0xd')]);router[_0x6307('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x6307('0xe')]);router[_0x6307('0x8')]('/:id/hopper_black',auth[_0x6307('0x9')](),controller[_0x6307('0xf')]);router[_0x6307('0x8')](_0x6307('0x10'),auth[_0x6307('0x9')](),controller[_0x6307('0x11')]);router[_0x6307('0x8')](_0x6307('0x12'),auth[_0x6307('0x9')](),controller[_0x6307('0x13')]);router['get'](_0x6307('0x14'),auth[_0x6307('0x9')](),controller[_0x6307('0x15')]);router[_0x6307('0x8')](_0x6307('0x16'),auth[_0x6307('0x9')](),controller[_0x6307('0x17')]);router['get'](_0x6307('0x18'),auth[_0x6307('0x9')](),controller[_0x6307('0x19')]);router[_0x6307('0x1a')]('/',auth['isAuthenticated'](),controller[_0x6307('0x1b')]);router[_0x6307('0x1a')](_0x6307('0x1c'),auth['isAuthenticated'](),controller['clone']);router['post']('/:id/teams',auth[_0x6307('0x9')](),controller['addTeams']);router[_0x6307('0x1a')]('/:id/users',auth[_0x6307('0x9')](),controller[_0x6307('0x1d')]);router[_0x6307('0x1a')](_0x6307('0x16'),auth[_0x6307('0x9')](),controller['addLists']);router[_0x6307('0x1a')]('/:id/blacklists',auth[_0x6307('0x9')](),controller['addBlackLists']);router[_0x6307('0x1e')](_0x6307('0xa'),auth[_0x6307('0x9')](),controller['update']);router[_0x6307('0x1f')](_0x6307('0xa'),auth[_0x6307('0x9')](),controller[_0x6307('0x20')]);router[_0x6307('0x1f')](_0x6307('0x10'),auth[_0x6307('0x9')](),controller[_0x6307('0x21')]);router[_0x6307('0x1f')]('/:id/users',auth[_0x6307('0x9')](),controller[_0x6307('0x22')]);router[_0x6307('0x1f')](_0x6307('0x16'),auth[_0x6307('0x9')](),controller['removeLists']);router[_0x6307('0x1f')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x6307('0x23')]);module['exports']=router; \ No newline at end of file +var _0x04b0=['connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','getLists','getBlackLists','post','/:id/clone','clone','addTeams','/:id/lists','/:id/blacklists','addBlackLists','put','/:id','delete','destroy','removeTeams','removeAgents','removeLists','exports','multer','path'];(function(_0x41dcd2,_0x21abc9){var _0x3a0604=function(_0x83a5ce){while(--_0x83a5ce){_0x41dcd2['push'](_0x41dcd2['shift']());}};_0x3a0604(++_0x21abc9);}(_0x04b0,0xb7));var _0x004b=function(_0x5b4743,_0x324e70){_0x5b4743=_0x5b4743-0x0;var _0x599edc=_0x04b0[_0x5b4743];return _0x599edc;};'use strict';var multer=require(_0x004b('0x0'));var util=require('util');var path=require(_0x004b('0x1'));var timeout=require(_0x004b('0x2'));var express=require('express');var router=express[_0x004b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x004b('0x4'));var config=require(_0x004b('0x5'));var controller=require('./voiceQueue.controller');router[_0x004b('0x6')]('/',auth[_0x004b('0x7')](),controller['index']);router[_0x004b('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x004b('0x8')]);router['get']('/:id/hoppers',auth[_0x004b('0x7')](),controller['getHoppers']);router[_0x004b('0x6')](_0x004b('0x9'),auth[_0x004b('0x7')](),controller[_0x004b('0xa')]);router[_0x004b('0x6')](_0x004b('0xb'),auth['isAuthenticated'](),controller[_0x004b('0xc')]);router[_0x004b('0x6')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x004b('0xd')]);router[_0x004b('0x6')](_0x004b('0xe'),auth[_0x004b('0x7')](),controller[_0x004b('0xf')]);router[_0x004b('0x6')](_0x004b('0x10'),auth[_0x004b('0x7')](),controller[_0x004b('0x11')]);router[_0x004b('0x6')](_0x004b('0x12'),auth[_0x004b('0x7')](),controller[_0x004b('0x13')]);router[_0x004b('0x6')]('/:id/lists',auth[_0x004b('0x7')](),controller[_0x004b('0x14')]);router[_0x004b('0x6')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x004b('0x15')]);router[_0x004b('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x004b('0x16')](_0x004b('0x17'),auth['isAuthenticated'](),controller[_0x004b('0x18')]);router[_0x004b('0x16')](_0x004b('0xe'),auth[_0x004b('0x7')](),controller[_0x004b('0x19')]);router[_0x004b('0x16')](_0x004b('0x10'),auth[_0x004b('0x7')](),controller['addAgents']);router[_0x004b('0x16')](_0x004b('0x1a'),auth[_0x004b('0x7')](),controller['addLists']);router[_0x004b('0x16')](_0x004b('0x1b'),auth['isAuthenticated'](),controller[_0x004b('0x1c')]);router[_0x004b('0x1d')](_0x004b('0x1e'),auth[_0x004b('0x7')](),controller['update']);router[_0x004b('0x1f')](_0x004b('0x1e'),auth[_0x004b('0x7')](),controller[_0x004b('0x20')]);router[_0x004b('0x1f')](_0x004b('0xe'),auth['isAuthenticated'](),controller[_0x004b('0x21')]);router[_0x004b('0x1f')](_0x004b('0x10'),auth[_0x004b('0x7')](),controller[_0x004b('0x22')]);router['delete'](_0x004b('0x1a'),auth[_0x004b('0x7')](),controller[_0x004b('0x23')]);router['delete'](_0x004b('0x1b'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x004b('0x24')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index f9ea7ca..5a8e6fb 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(_0x177307,_0x1a1e9a){var _0x254c24=function(_0x5aa40a){while(--_0x5aa40a){_0x177307['push'](_0x177307['shift']());}};_0x254c24(++_0x1a1e9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x11bb56,_0x14299c){var _0x148b93=function(_0x3e281f){while(--_0x3e281f){_0x11bb56['push'](_0x11bb56['shift']());}};_0x148b93(++_0x14299c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 6b783f4..b66e6f1 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 _0x6564=['isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','CmListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','get','inbound','QueueCampaigns','outbound','ignore','map','value','find','type','name','UserProfileResource','then','index','VoiceQueue','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','length','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','VoiceQueues','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','userProfileId','getHoppers','hasOwnProperty','VoiceQueueId','CmHopper','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','order','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','SIP/%s','voicePause','emit','removeTeams','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','every','includes','all','union','compact','isEmpty','userVoiceQueue:remove','addAgents','omit','ids','spread','userVoiceQueue:save','isNil','format','removeAgents'];(function(_0x38122e,_0xa01a06){var _0xc5ceb0=function(_0x5c1e4f){while(--_0x5c1e4f){_0x38122e['push'](_0x38122e['shift']());}};_0xc5ceb0(++_0xa01a06);}(_0x6564,0xda));var _0x4656=function(_0x52f13e,_0x4071bb){_0x52f13e=_0x52f13e-0x0;var _0x413c8b=_0x6564[_0x52f13e];return _0x413c8b;};'use strict';var pdf=require(_0x4656('0x0'));var emlformat=require(_0x4656('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4656('0x2'));var jsonpatch=require(_0x4656('0x3'));var rp=require('request-promise');var moment=require(_0x4656('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4656('0x5'));var util=require(_0x4656('0x6'));var path=require(_0x4656('0x7'));var sox=require(_0x4656('0x8'));var csv=require(_0x4656('0x9'));var ejs=require(_0x4656('0xa'));var fs=require('fs');var _=require(_0x4656('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4656('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4656('0xd'));var Papa=require(_0x4656('0xe'));var Redis=require(_0x4656('0xf'));var authService=require(_0x4656('0x10'));var qs=require(_0x4656('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4656('0x12'));var logger=require(_0x4656('0x13'))(_0x4656('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4656('0x15'))['db'];config[_0x4656('0x16')]=_[_0x4656('0x17')](config[_0x4656('0x16')],{'host':_0x4656('0x18'),'port':0x18eb});var socket=require(_0x4656('0x19'))(new Redis(config[_0x4656('0x16')]));require(_0x4656('0x1a'))[_0x4656('0x1b')](socket);function respondWithStatusCode(_0x2168b3,_0x4b9249){_0x4b9249=_0x4b9249||0xcc;return function(_0x53cb44){if(_0x53cb44){return _0x2168b3[_0x4656('0x1c')](_0x4b9249);}return _0x2168b3[_0x4656('0x1d')](_0x4b9249)[_0x4656('0x1e')]();};}function respondWithResult(_0xee9793,_0x64a4df){_0x64a4df=_0x64a4df||0xc8;return function(_0x36c7ed){if(_0x36c7ed){return _0xee9793[_0x4656('0x1d')](_0x64a4df)[_0x4656('0x1f')](_0x36c7ed);}};}function respondWithFilteredResult(_0x4d1b9a,_0x582197){return function(_0x297415){if(_0x297415){var _0x34e58e=_0x297415[_0x4656('0x20')],_0x25be55=_0x582197['offset'],_0x2f3bd0=_0x582197[_0x4656('0x21')]+_0x582197[_0x4656('0x22')],_0x54985c;if(_0x2f3bd0>=_0x34e58e){_0x2f3bd0=_0x34e58e;_0x54985c=0xc8;}else{_0x54985c=0xce;}_0x4d1b9a[_0x4656('0x1d')](_0x54985c);return _0x4d1b9a['set'](_0x4656('0x23'),_0x25be55+'-'+_0x2f3bd0+'/'+_0x34e58e)['json'](_0x297415);}return null;};}function patchUpdates(_0x44df1f){return function(_0x5a6452){try{jsonpatch[_0x4656('0x24')](_0x5a6452,_0x44df1f,!![]);}catch(_0x3b6c4a){return BPromise[_0x4656('0x25')](_0x3b6c4a);}return _0x5a6452[_0x4656('0x26')]();};}function saveUpdates(_0x38130a,_0x26b2e3){return function(_0x3138ad){if(_0x3138ad){return _0x3138ad[_0x4656('0x27')](_0x38130a)['then'](function(_0x20fe23){return _0x20fe23;});}return null;};}function removeEntity(_0x42ae8a,_0x25c0d4){return function(_0x53b01d){if(_0x53b01d){return _0x53b01d[_0x4656('0x28')]()['then'](function(){var _0x34b3e1=_0x53b01d[_0x4656('0x29')]({'plain':!![]});var _0x3bf36a=[{'name':'VoiceQueues','value':_0x4656('0x2a'),'ignore':![]},{'name':_0x4656('0x2b'),'value':_0x4656('0x2c'),'ignore':![]}];var _0x2fb764=_(_0x3bf36a)['filter'](_0x4656('0x2d'))[_0x4656('0x2e')](_0x4656('0x2f'))[_0x4656('0x2f')]();if(_['includes'](_0x2fb764,_0x34b3e1['type'])){return;}var _0x46f4b5=_[_0x4656('0x30')](_0x3bf36a,[_0x4656('0x2f'),_0x34b3e1[_0x4656('0x31')]])[_0x4656('0x32')];return db[_0x4656('0x33')]['destroy']({'where':{'type':_0x46f4b5,'resourceId':_0x34b3e1['id']}})[_0x4656('0x34')](function(){return _0x53b01d;});})[_0x4656('0x34')](function(){_0x42ae8a[_0x4656('0x1d')](0xcc)[_0x4656('0x1e')]();});}};}function handleEntityNotFound(_0x491ba7,_0xa63ca4){return function(_0x57b1ab){if(!_0x57b1ab){_0x491ba7[_0x4656('0x1c')](0x194);}return _0x57b1ab;};}function handleError(_0x4f5f56,_0xee17aa){_0xee17aa=_0xee17aa||0x1f4;return function(_0x33afee){logger['error'](_0x33afee['stack']);if(_0x33afee['name']){delete _0x33afee[_0x4656('0x32')];}_0x4f5f56['status'](_0xee17aa)['send'](_0x33afee);};}exports[_0x4656('0x35')]=function(_0x119e0e,_0x238411){var _0xa8b17a={},_0x290149={},_0x5829e1={'count':0x0,'rows':[]};var _0x2b6fdb=_[_0x4656('0x2e')](db[_0x4656('0x36')][_0x4656('0x37')],function(_0x5ad3e5){return{'name':_0x5ad3e5[_0x4656('0x38')],'type':_0x5ad3e5[_0x4656('0x31')][_0x4656('0x39')]};});_0x290149[_0x4656('0x3a')]=_[_0x4656('0x2e')](_0x2b6fdb,_0x4656('0x32'));_0x290149[_0x4656('0x3b')]=_['keys'](_0x119e0e['query']);_0x290149[_0x4656('0x3c')]=_[_0x4656('0x3d')](_0x290149[_0x4656('0x3a')],_0x290149[_0x4656('0x3b')]);_0xa8b17a['attributes']=_['intersection'](_0x290149[_0x4656('0x3a')],qs[_0x4656('0x3e')](_0x119e0e['query'][_0x4656('0x3e')]));_0xa8b17a[_0x4656('0x3f')]=_0xa8b17a[_0x4656('0x3f')]['length']?_0xa8b17a[_0x4656('0x3f')]:_0x290149['model'];if(!_0x119e0e[_0x4656('0x3b')]['hasOwnProperty'](_0x4656('0x40'))){_0xa8b17a['limit']=qs[_0x4656('0x22')](_0x119e0e[_0x4656('0x3b')][_0x4656('0x22')]);_0xa8b17a[_0x4656('0x21')]=qs[_0x4656('0x21')](_0x119e0e[_0x4656('0x3b')][_0x4656('0x21')]);}_0xa8b17a['order']=qs[_0x4656('0x41')](_0x119e0e[_0x4656('0x3b')]['sort']);_0xa8b17a['where']=qs[_0x4656('0x3c')](_[_0x4656('0x42')](_0x119e0e[_0x4656('0x3b')],_0x290149[_0x4656('0x3c')]),_0x2b6fdb);if(_0x119e0e[_0x4656('0x3b')]['filter']){_0xa8b17a[_0x4656('0x43')]=_['merge'](_0xa8b17a['where'],{'$or':_['map'](_0x2b6fdb,function(_0x5d0c5b){if(_0x5d0c5b[_0x4656('0x31')]!==_0x4656('0x44')){var _0x45b0e1={};_0x45b0e1[_0x5d0c5b['name']]={'$like':'%'+_0x119e0e['query'][_0x4656('0x45')]+'%'};return _0x45b0e1;}})});}_0xa8b17a=_[_0x4656('0x46')]({},_0xa8b17a,_0x119e0e[_0x4656('0x47')]);var _0x5bc397={'where':_0xa8b17a[_0x4656('0x43')]};return db[_0x4656('0x36')]['count'](_0x5bc397)[_0x4656('0x34')](function(_0x595a48){_0x5829e1['count']=_0x595a48;if(_0x119e0e[_0x4656('0x3b')][_0x4656('0x48')]){_0xa8b17a[_0x4656('0x49')]=[{'all':!![]}];}return db[_0x4656('0x36')][_0x4656('0x4a')](_0xa8b17a);})['then'](function(_0x22e84f){_0x5829e1[_0x4656('0x4b')]=_0x22e84f;return _0x5829e1;})['then'](respondWithFilteredResult(_0x238411,_0xa8b17a))['catch'](handleError(_0x238411,null));};exports[_0x4656('0x4c')]=function(_0x2ecfd1,_0x3f1367){var _0x106708={'raw':![],'where':{'id':_0x2ecfd1[_0x4656('0x4d')]['id']}},_0x3c3fae={};_0x3c3fae['model']=_['keys'](db[_0x4656('0x36')][_0x4656('0x37')]);_0x3c3fae['query']=_[_0x4656('0x4e')](_0x2ecfd1['query']);_0x3c3fae[_0x4656('0x3c')]=_[_0x4656('0x3d')](_0x3c3fae[_0x4656('0x3a')],_0x3c3fae[_0x4656('0x3b')]);_0x106708[_0x4656('0x3f')]=_[_0x4656('0x3d')](_0x3c3fae['model'],qs[_0x4656('0x3e')](_0x2ecfd1[_0x4656('0x3b')]['fields']));_0x106708[_0x4656('0x3f')]=_0x106708['attributes'][_0x4656('0x4f')]?_0x106708[_0x4656('0x3f')]:_0x3c3fae[_0x4656('0x3a')];if(_0x2ecfd1[_0x4656('0x3b')][_0x4656('0x48')]){_0x106708['include']=[{'all':!![]}];}_0x106708=_[_0x4656('0x46')]({},_0x106708,_0x2ecfd1[_0x4656('0x47')]);return db[_0x4656('0x36')]['find'](_0x106708)[_0x4656('0x34')](handleEntityNotFound(_0x3f1367,null))[_0x4656('0x34')](respondWithResult(_0x3f1367,null))[_0x4656('0x50')](handleError(_0x3f1367,null));};exports[_0x4656('0x51')]=function(_0x4426e3,_0x13cc3f){return db['VoiceQueue'][_0x4656('0x51')](_0x4426e3[_0x4656('0x52')],{})['then'](function(_0x391988){var _0x7a6cf2=_0x4426e3['user'][_0x4656('0x29')]({'plain':!![]});if(!_0x7a6cf2)throw new Error(_0x4656('0x53'));if(_0x7a6cf2[_0x4656('0x54')]===_0x4656('0x55')){var _0x4c8ec=_0x391988[_0x4656('0x29')]({'plain':!![]});var _0x24c691=[{'name':_0x4656('0x56'),'value':'inbound'},{'name':_0x4656('0x2b'),'value':'outbound'}];var _0x7653d0=_[_0x4656('0x30')](_0x24c691,[_0x4656('0x2f'),_0x4c8ec['type']])[_0x4656('0x32')];return db[_0x4656('0x57')][_0x4656('0x30')]({'where':{'name':_0x7653d0,'userProfileId':_0x7a6cf2['userProfileId']},'raw':!![]})[_0x4656('0x34')](function(_0x2b93a1){if(_0x2b93a1&&_0x2b93a1[_0x4656('0x58')]===0x0){return db[_0x4656('0x33')]['create']({'name':_0x4c8ec['name'],'resourceId':_0x4c8ec['id'],'type':_0x2b93a1['name'],'sectionId':_0x2b93a1['id']},{})[_0x4656('0x34')](function(){return _0x391988;});}else{return _0x391988;}})['catch'](function(_0x467190){logger[_0x4656('0x59')](_0x4656('0x5a'),_0x467190);throw _0x467190;});}return _0x391988;})[_0x4656('0x34')](respondWithResult(_0x13cc3f,0xc9))['catch'](handleError(_0x13cc3f,null));};exports[_0x4656('0x5b')]=function(_0x25f3cc,_0x2160f6){var _0x554bcb={'where':{'id':_0x25f3cc['params']['id']}},_0x1d55f8={};_0x1d55f8['model']=_[_0x4656('0x4e')](db[_0x4656('0x36')][_0x4656('0x37')]);_0x554bcb[_0x4656('0x3f')]=_[_0x4656('0x3d')](_0x1d55f8[_0x4656('0x3a')],qs[_0x4656('0x3e')](_0x25f3cc[_0x4656('0x3b')][_0x4656('0x3e')]));_0x554bcb[_0x4656('0x3f')]=_0x554bcb[_0x4656('0x3f')]['length']?_0x554bcb[_0x4656('0x3f')]:_0x1d55f8[_0x4656('0x3a')];if(_0x25f3cc['query']['includeAll']){_0x554bcb['include']=[{'all':!![]}];}_0x554bcb=_[_0x4656('0x46')]({},_0x554bcb,_0x25f3cc[_0x4656('0x47')]);return db[_0x4656('0x36')][_0x4656('0x30')](_0x554bcb)[_0x4656('0x34')](handleEntityNotFound(_0x2160f6,null))[_0x4656('0x34')](function(_0x560aba){if(_0x560aba){var _0x477fe2=_0x560aba[_0x4656('0x29')]({'plain':!![]});_0x477fe2=qs['omit'](_0x477fe2,['id',_0x4656('0x5c'),_0x4656('0x5d')]);_0x25f3cc[_0x4656('0x52')]=_['omit'](_0x25f3cc['body'],['id',_0x4656('0x5c'),'updatedAt']);return db[_0x4656('0x36')][_0x4656('0x51')](_['merge'](_0x477fe2,_0x25f3cc[_0x4656('0x52')]),{'include':_0x25f3cc[_0x4656('0x3b')][_0x4656('0x48')]?[{'all':!![]}]:undefined})[_0x4656('0x34')](function(_0x5a4879){var _0x482860=_0x25f3cc[_0x4656('0x55')][_0x4656('0x29')]({'plain':!![]});if(!_0x482860)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482860['role']==='user'){var _0x5256ae=_0x5a4879[_0x4656('0x29')]({'plain':!![]});var _0x3e1cfe=[{'name':'VoiceQueues','value':_0x4656('0x2a')},{'name':_0x4656('0x2b'),'value':'outbound'}];var _0x338ce8=_[_0x4656('0x30')](_0x3e1cfe,[_0x4656('0x2f'),_0x5256ae[_0x4656('0x31')]])[_0x4656('0x32')];return db['UserProfileSection'][_0x4656('0x30')]({'where':{'name':_0x338ce8,'userProfileId':_0x482860[_0x4656('0x5e')]},'raw':!![]})[_0x4656('0x34')](function(_0x44d7a3){if(_0x44d7a3&&_0x44d7a3[_0x4656('0x58')]===0x0){return db[_0x4656('0x33')][_0x4656('0x51')]({'name':_0x5256ae[_0x4656('0x32')],'resourceId':_0x5256ae['id'],'type':_0x44d7a3[_0x4656('0x32')],'sectionId':_0x44d7a3['id']},{})[_0x4656('0x34')](function(){return _0x5a4879;});}else{return _0x5a4879;}})[_0x4656('0x50')](function(_0x30eafc){logger[_0x4656('0x59')](_0x4656('0x5a'),_0x30eafc);throw _0x30eafc;});}return _0x5a4879;});}})[_0x4656('0x34')](respondWithResult(_0x2160f6,0xc9))['catch'](handleError(_0x2160f6,null));};exports[_0x4656('0x27')]=function(_0x1efd0c,_0x1343b7){if(_0x1efd0c['body']['id']){delete _0x1efd0c[_0x4656('0x52')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x1efd0c[_0x4656('0x4d')]['id']}})[_0x4656('0x34')](handleEntityNotFound(_0x1343b7,null))['then'](saveUpdates(_0x1efd0c[_0x4656('0x52')],null))[_0x4656('0x34')](respondWithResult(_0x1343b7,null))['catch'](handleError(_0x1343b7,null));};exports[_0x4656('0x28')]=function(_0x561f50,_0x542734){return db[_0x4656('0x36')][_0x4656('0x30')]({'where':{'id':_0x561f50[_0x4656('0x4d')]['id']}})[_0x4656('0x34')](handleEntityNotFound(_0x542734,null))[_0x4656('0x34')](removeEntity(_0x542734,null))['catch'](handleError(_0x542734,null));};exports[_0x4656('0x5f')]=function(_0x124ee4,_0x23b6e4,_0x19258e){var _0x25a8c4={'raw':![],'where':{}};var _0x49b859={};var _0x49d526={'count':0x0,'rows':[]};return db[_0x4656('0x36')]['findOne']({'where':{'id':_0x124ee4['params']['id']}})['then'](handleEntityNotFound(_0x23b6e4,null))['then'](function(_0x195d21){if(_0x195d21){_0x49b859[_0x4656('0x3a')]=_[_0x4656('0x4e')](db['CmHopper'][_0x4656('0x37')]);_0x49b859['query']=_['keys'](_0x124ee4[_0x4656('0x3b')]);_0x49b859['filters']=_['intersection'](_0x49b859[_0x4656('0x3a')],_0x49b859[_0x4656('0x3b')]);_0x25a8c4[_0x4656('0x3f')]=_['intersection'](_0x49b859[_0x4656('0x3a')],qs[_0x4656('0x3e')](_0x124ee4['query'][_0x4656('0x3e')]));_0x25a8c4['attributes']=_0x25a8c4[_0x4656('0x3f')][_0x4656('0x4f')]?_0x25a8c4['attributes']:_0x49b859[_0x4656('0x3a')];if(!_0x124ee4['query'][_0x4656('0x60')](_0x4656('0x40'))){_0x25a8c4[_0x4656('0x22')]=qs['limit'](_0x124ee4[_0x4656('0x3b')][_0x4656('0x22')]);_0x25a8c4['offset']=qs['offset'](_0x124ee4[_0x4656('0x3b')][_0x4656('0x21')]);}_0x25a8c4['order']=qs['sort'](_0x124ee4['query'][_0x4656('0x41')]);_0x25a8c4['where']=qs[_0x4656('0x3c')](_[_0x4656('0x42')](_0x124ee4['query'],_0x49b859[_0x4656('0x3c')]));_0x25a8c4[_0x4656('0x43')][_0x4656('0x61')]=_0x195d21['id'];if(_0x124ee4[_0x4656('0x3b')][_0x4656('0x45')]){_0x25a8c4[_0x4656('0x43')]=_['merge'](_0x25a8c4['where'],{'$or':_[_0x4656('0x2e')](_0x25a8c4['attributes'],function(_0x24626b){var _0x30a50f={};_0x30a50f[_0x24626b]={'$like':'%'+_0x124ee4['query'][_0x4656('0x45')]+'%'};return _0x30a50f;})});}_0x25a8c4=_[_0x4656('0x46')]({},_0x25a8c4,_0x124ee4[_0x4656('0x47')]);return db[_0x4656('0x62')][_0x4656('0x20')]({'where':_0x25a8c4['where']})[_0x4656('0x34')](function(_0x484b9c){_0x49d526[_0x4656('0x20')]=_0x484b9c;if(_0x124ee4[_0x4656('0x3b')]['includeAll']){_0x25a8c4[_0x4656('0x49')]=[{'all':!![]}];}return db['CmHopper'][_0x4656('0x4a')](_0x25a8c4);})[_0x4656('0x34')](function(_0x3b6a91){_0x49d526['rows']=_0x3b6a91;return _0x49d526;});}})[_0x4656('0x34')](respondWithFilteredResult(_0x23b6e4,_0x25a8c4))['catch'](handleError(_0x23b6e4,null));};exports[_0x4656('0x63')]=function(_0x29fc9f,_0x527f50,_0x2a6ffb){var _0x418285={'raw':!![],'where':{}};var _0xbfa552={};var _0x2712c4={'count':0x0,'rows':[]};return db[_0x4656('0x36')][_0x4656('0x64')]({'where':{'id':_0x29fc9f[_0x4656('0x4d')]['id']}})[_0x4656('0x34')](handleEntityNotFound(_0x527f50,null))[_0x4656('0x34')](function(_0x4c9a1b){if(_0x4c9a1b){_0xbfa552[_0x4656('0x3a')]=_[_0x4656('0x4e')](db[_0x4656('0x65')]['rawAttributes']);_0xbfa552[_0x4656('0x3b')]=_[_0x4656('0x4e')](_0x29fc9f['query']);_0xbfa552['filters']=_[_0x4656('0x3d')](_0xbfa552[_0x4656('0x3a')],_0xbfa552[_0x4656('0x3b')]);_0x418285[_0x4656('0x3f')]=_[_0x4656('0x3d')](_0xbfa552['model'],qs[_0x4656('0x3e')](_0x29fc9f['query'][_0x4656('0x3e')]));_0x418285[_0x4656('0x3f')]=_0x418285[_0x4656('0x3f')][_0x4656('0x4f')]?_0x418285[_0x4656('0x3f')]:_0xbfa552[_0x4656('0x3a')];if(!_0x29fc9f['query'][_0x4656('0x60')]('nolimit')){_0x418285[_0x4656('0x22')]=qs['limit'](_0x29fc9f[_0x4656('0x3b')][_0x4656('0x22')]);_0x418285[_0x4656('0x21')]=qs[_0x4656('0x21')](_0x29fc9f[_0x4656('0x3b')][_0x4656('0x21')]);}_0x418285['order']=qs[_0x4656('0x41')](_0x29fc9f['query'][_0x4656('0x41')]);_0x418285[_0x4656('0x43')]=qs[_0x4656('0x3c')](_[_0x4656('0x42')](_0x29fc9f['query'],_0xbfa552['filters']));_0x418285['where'][_0x4656('0x61')]=_0x4c9a1b['id'];if(_0x29fc9f[_0x4656('0x3b')][_0x4656('0x45')]){_0x418285['where']=_[_0x4656('0x46')](_0x418285[_0x4656('0x43')],{'$or':_['map'](_0x418285['attributes'],function(_0x5077dc){var _0x5ed623={};_0x5ed623[_0x5077dc]={'$like':'%'+_0x29fc9f[_0x4656('0x3b')][_0x4656('0x45')]+'%'};return _0x5ed623;})});}_0x418285=_[_0x4656('0x46')]({},_0x418285,_0x29fc9f[_0x4656('0x47')]);return db['CmHopperHistory'][_0x4656('0x20')]({'where':_0x418285[_0x4656('0x43')]})['then'](function(_0x453bfc){_0x2712c4[_0x4656('0x20')]=_0x453bfc;if(_0x29fc9f['query']['includeAll']){_0x418285[_0x4656('0x49')]=[{'all':!![]}];}return db[_0x4656('0x65')][_0x4656('0x4a')](_0x418285);})[_0x4656('0x34')](function(_0x13a7b2){_0x2712c4[_0x4656('0x4b')]=_0x13a7b2;return _0x2712c4;});}})[_0x4656('0x34')](respondWithFilteredResult(_0x527f50,_0x418285))[_0x4656('0x50')](handleError(_0x527f50,null));};exports[_0x4656('0x66')]=function(_0x5db370,_0x2f742b,_0x99b71c){var _0x35a5fc={'raw':!![],'where':{}};var _0x29f5bc={};var _0x275eec={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x4656('0x64')]({'where':{'id':_0x5db370[_0x4656('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2f742b,null))[_0x4656('0x34')](function(_0xdcf24f){if(_0xdcf24f){_0x29f5bc[_0x4656('0x3a')]=_[_0x4656('0x4e')](db[_0x4656('0x67')][_0x4656('0x37')]);_0x29f5bc[_0x4656('0x3b')]=_[_0x4656('0x4e')](_0x5db370[_0x4656('0x3b')]);_0x29f5bc[_0x4656('0x3c')]=_[_0x4656('0x3d')](_0x29f5bc[_0x4656('0x3a')],_0x29f5bc['query']);_0x35a5fc[_0x4656('0x3f')]=_['intersection'](_0x29f5bc[_0x4656('0x3a')],qs['fields'](_0x5db370[_0x4656('0x3b')][_0x4656('0x3e')]));_0x35a5fc[_0x4656('0x3f')]=_0x35a5fc[_0x4656('0x3f')][_0x4656('0x4f')]?_0x35a5fc[_0x4656('0x3f')]:_0x29f5bc['model'];if(!_0x5db370['query'][_0x4656('0x60')](_0x4656('0x40'))){_0x35a5fc['limit']=qs[_0x4656('0x22')](_0x5db370[_0x4656('0x3b')]['limit']);_0x35a5fc[_0x4656('0x21')]=qs[_0x4656('0x21')](_0x5db370['query'][_0x4656('0x21')]);}_0x35a5fc[_0x4656('0x68')]=qs[_0x4656('0x41')](_0x5db370[_0x4656('0x3b')][_0x4656('0x41')]);_0x35a5fc[_0x4656('0x43')]=qs['filters'](_[_0x4656('0x42')](_0x5db370['query'],_0x29f5bc['filters']));_0x35a5fc['where']['VoiceQueueId']=_0xdcf24f['id'];if(_0x5db370[_0x4656('0x3b')][_0x4656('0x45')]){_0x35a5fc[_0x4656('0x43')]=_[_0x4656('0x46')](_0x35a5fc['where'],{'$or':_[_0x4656('0x2e')](_0x35a5fc[_0x4656('0x3f')],function(_0x3131eb){var _0x192619={};_0x192619[_0x3131eb]={'$like':'%'+_0x5db370[_0x4656('0x3b')][_0x4656('0x45')]+'%'};return _0x192619;})});}_0x35a5fc=_['merge']({},_0x35a5fc,_0x5db370[_0x4656('0x47')]);return db[_0x4656('0x67')][_0x4656('0x20')]({'where':_0x35a5fc[_0x4656('0x43')]})['then'](function(_0x463279){_0x275eec[_0x4656('0x20')]=_0x463279;if(_0x5db370[_0x4656('0x3b')][_0x4656('0x48')]){_0x35a5fc[_0x4656('0x49')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x4656('0x4a')](_0x35a5fc);})[_0x4656('0x34')](function(_0x1b5cb1){_0x275eec[_0x4656('0x4b')]=_0x1b5cb1;return _0x275eec;});}})[_0x4656('0x34')](respondWithFilteredResult(_0x2f742b,_0x35a5fc))[_0x4656('0x50')](handleError(_0x2f742b,null));};exports[_0x4656('0x69')]=function(_0x4f7685,_0x4a4cf5,_0x44408a){var _0x1aecce={'raw':!![],'where':{}};var _0x158161={};var _0x353113={'count':0x0,'rows':[]};return db[_0x4656('0x36')][_0x4656('0x64')]({'where':{'id':_0x4f7685[_0x4656('0x4d')]['id']}})[_0x4656('0x34')](handleEntityNotFound(_0x4a4cf5,null))[_0x4656('0x34')](function(_0x4375ac){if(_0x4375ac){_0x158161[_0x4656('0x3a')]=_[_0x4656('0x4e')](db['CmHopperBlack'][_0x4656('0x37')]);_0x158161[_0x4656('0x3b')]=_['keys'](_0x4f7685[_0x4656('0x3b')]);_0x158161[_0x4656('0x3c')]=_[_0x4656('0x3d')](_0x158161[_0x4656('0x3a')],_0x158161[_0x4656('0x3b')]);_0x1aecce[_0x4656('0x3f')]=_[_0x4656('0x3d')](_0x158161[_0x4656('0x3a')],qs['fields'](_0x4f7685[_0x4656('0x3b')][_0x4656('0x3e')]));_0x1aecce['attributes']=_0x1aecce[_0x4656('0x3f')][_0x4656('0x4f')]?_0x1aecce['attributes']:_0x158161['model'];if(!_0x4f7685[_0x4656('0x3b')]['hasOwnProperty'](_0x4656('0x40'))){_0x1aecce['limit']=qs[_0x4656('0x22')](_0x4f7685[_0x4656('0x3b')][_0x4656('0x22')]);_0x1aecce[_0x4656('0x21')]=qs[_0x4656('0x21')](_0x4f7685[_0x4656('0x3b')]['offset']);}_0x1aecce[_0x4656('0x68')]=qs['sort'](_0x4f7685['query'][_0x4656('0x41')]);_0x1aecce[_0x4656('0x43')]=qs['filters'](_[_0x4656('0x42')](_0x4f7685[_0x4656('0x3b')],_0x158161[_0x4656('0x3c')]));_0x1aecce[_0x4656('0x43')][_0x4656('0x61')]=_0x4375ac['id'];if(_0x4f7685[_0x4656('0x3b')][_0x4656('0x45')]){_0x1aecce[_0x4656('0x43')]=_['merge'](_0x1aecce[_0x4656('0x43')],{'$or':_[_0x4656('0x2e')](_0x1aecce[_0x4656('0x3f')],function(_0x26b033){var _0x142d51={};_0x142d51[_0x26b033]={'$like':'%'+_0x4f7685[_0x4656('0x3b')][_0x4656('0x45')]+'%'};return _0x142d51;})});}_0x1aecce=_[_0x4656('0x46')]({},_0x1aecce,_0x4f7685['options']);return db[_0x4656('0x6a')][_0x4656('0x20')]({'where':_0x1aecce[_0x4656('0x43')]})[_0x4656('0x34')](function(_0xadfc89){_0x353113[_0x4656('0x20')]=_0xadfc89;if(_0x4f7685[_0x4656('0x3b')][_0x4656('0x48')]){_0x1aecce['include']=[{'all':!![]}];}return db[_0x4656('0x6a')]['findAll'](_0x1aecce);})['then'](function(_0xa4908c){_0x353113[_0x4656('0x4b')]=_0xa4908c;return _0x353113;});}})[_0x4656('0x34')](respondWithFilteredResult(_0x4a4cf5,_0x1aecce))[_0x4656('0x50')](handleError(_0x4a4cf5,null));};exports[_0x4656('0x6b')]=function(_0xb3af70,_0xfac355,_0x5d6262){var _0x228125={};var _0x51fef4={};var _0x3e2970;var _0x24ddf1;return db[_0x4656('0x36')][_0x4656('0x64')]({'where':{'id':_0xb3af70['params']['id']}})['then'](handleEntityNotFound(_0xfac355,null))[_0x4656('0x34')](function(_0x2b5f53){if(_0x2b5f53){_0x3e2970=_0x2b5f53;_0x51fef4[_0x4656('0x3a')]=_['keys'](db[_0x4656('0x6c')][_0x4656('0x37')]);_0x51fef4[_0x4656('0x3b')]=_[_0x4656('0x4e')](_0xb3af70[_0x4656('0x3b')]);_0x51fef4[_0x4656('0x3c')]=_['intersection'](_0x51fef4[_0x4656('0x3a')],_0x51fef4[_0x4656('0x3b')]);_0x228125[_0x4656('0x3f')]=_[_0x4656('0x3d')](_0x51fef4[_0x4656('0x3a')],qs[_0x4656('0x3e')](_0xb3af70[_0x4656('0x3b')][_0x4656('0x3e')]));_0x228125[_0x4656('0x3f')]=_0x228125['attributes']['length']?_0x228125['attributes']:_0x51fef4[_0x4656('0x3a')];_0x228125[_0x4656('0x68')]=qs['sort'](_0xb3af70[_0x4656('0x3b')][_0x4656('0x41')]);_0x228125[_0x4656('0x43')]=qs[_0x4656('0x3c')](_[_0x4656('0x42')](_0xb3af70[_0x4656('0x3b')],_0x51fef4[_0x4656('0x3c')]));if(_0xb3af70[_0x4656('0x3b')][_0x4656('0x45')]){_0x228125[_0x4656('0x43')]=_['merge'](_0x228125[_0x4656('0x43')],{'$or':_[_0x4656('0x2e')](_0x228125[_0x4656('0x3f')],function(_0x8a47fd){var _0x47b6fe={};_0x47b6fe[_0x8a47fd]={'$like':'%'+_0xb3af70[_0x4656('0x3b')][_0x4656('0x45')]+'%'};return _0x47b6fe;})});}_0x228125=_['merge']({},_0x228125,_0xb3af70[_0x4656('0x47')]);return _0x3e2970[_0x4656('0x6b')](_0x228125);}})['then'](function(_0x2466bb){if(_0x2466bb){_0x24ddf1=_0x2466bb[_0x4656('0x4f')];if(!_0xb3af70[_0x4656('0x3b')]['hasOwnProperty']('nolimit')){_0x228125[_0x4656('0x22')]=qs['limit'](_0xb3af70[_0x4656('0x3b')][_0x4656('0x22')]);_0x228125[_0x4656('0x21')]=qs[_0x4656('0x21')](_0xb3af70['query'][_0x4656('0x21')]);}return _0x3e2970['getTeams'](_0x228125);}})[_0x4656('0x34')](function(_0x310c8e){if(_0x310c8e){return _0x310c8e?{'count':_0x24ddf1,'rows':_0x310c8e}:null;}})[_0x4656('0x34')](respondWithResult(_0xfac355,null))[_0x4656('0x50')](handleError(_0xfac355,null));};exports[_0x4656('0x6d')]=function(_0x47262d,_0x1fcad7,_0x32269f){var _0x1e5b16=_0x47262d['body'][_0x4656('0x6e')];var _0x2db829=_[_0x4656('0x2e')](_0x1e5b16,'id');return db[_0x4656('0x6c')][_0x4656('0x4a')]({'where':{'id':_0x2db829},'attributes':['id'],'include':[{'model':db[_0x4656('0x6f')],'as':_0x4656('0x70'),'attributes':['id',_0x4656('0x32'),_0x4656('0x71'),'voicePause',_0x4656('0x72')],'raw':!![]}]})['then'](function(_0x564264){if(_0x564264){var _0x52ff60=_[_0x4656('0x73')](_0x564264,function(_0x4da400){var _0x59daa6=_0x4da400['get']({'plain':!![]});_0x59daa6[_0x4656('0x70')][_0x4656('0x74')](function(_0x179ebc){_0x179ebc[_0x4656('0x75')]=_['find'](_0x1e5b16,{'id':_0x59daa6['id']})[_0x4656('0x75')];});return _0x59daa6[_0x4656('0x70')];});return db[_0x4656('0x36')][_0x4656('0x30')]({'where':{'id':_0x47262d[_0x4656('0x4d')]['id']}})[_0x4656('0x34')](function(_0x563c6a){return db[_0x4656('0x76')][_0x4656('0x77')](function(_0x2f603f){return _0x563c6a[_0x4656('0x6d')](_0x2db829,{'transaction':_0x2f603f})[_0x4656('0x34')](function(){return BPromise[_0x4656('0x78')](_0x52ff60,function(_0x435ba6){return db[_0x4656('0x79')][_0x4656('0x7a')]({'where':{'UserId':_0x435ba6['id'],'VoiceQueueId':_0x47262d[_0x4656('0x4d')]['id']},'defaults':{'penalty':_0x435ba6['penalty']},'transaction':_0x2f603f});});})[_0x4656('0x34')](function(){return BPromise['each'](_['filter'](_0x52ff60,{'online':!![]}),function(_0x5c6c72){return db[_0x4656('0x7b')][_0x4656('0x7c')]({'membername':_0x5c6c72[_0x4656('0x32')],'UserId':_0x5c6c72['id'],'queue_name':_0x563c6a[_0x4656('0x32')],'VoiceQueueId':_0x563c6a['id'],'interface':_['isNil'](_0x5c6c72[_0x4656('0x72')])?util['format'](_0x4656('0x7d'),_0x5c6c72[_0x4656('0x32')]):_0x5c6c72[_0x4656('0x72')],'paused':_0x5c6c72[_0x4656('0x7e')]||![],'penalty':_0x5c6c72['penalty']},{'transaction':_0x2f603f});});})[_0x4656('0x34')](function(){_0x52ff60[_0x4656('0x74')](function(_0x25b91d){socket[_0x4656('0x7f')]('userVoiceQueue:save',{'UserId':_0x25b91d['id'],'VoiceQueueId':_0x563c6a['id']});});});});});}})[_0x4656('0x34')](respondWithStatusCode(_0x1fcad7,null))['catch'](handleError(_0x1fcad7,null));};exports[_0x4656('0x80')]=function(_0x56d21c,_0x394adc,_0x4b8468){return db[_0x4656('0x6c')][_0x4656('0x4a')]({'where':{'id':_0x56d21c[_0x4656('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4656('0x6f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4656('0x34')](handleEntityNotFound(_0x394adc,null))['then'](function(_0x778577){var _0x180275=_['map'](_0x778577,'id');var _0x51e2d7=[];var _0x37d99a=[];var _0x1abfe7=squel['select']();_0x1abfe7['field']('tq.TeamId')[_0x4656('0x81')]('team_has_voice_queues','tq')[_0x4656('0x82')](_0x4656('0x83'),'ut',_0x4656('0x84'))[_0x4656('0x43')](_0x4656('0x85'),_0x56d21c[_0x4656('0x4d')]['id']);for(var _0x4e8494=0x0;_0x4e8494<_0x778577[_0x4656('0x4f')];_0x4e8494+=0x1){let _0x5df44d=_0x778577[_0x4e8494];for(var _0x38266d=0x0;_0x38266d<_0x5df44d[_0x4656('0x70')][_0x4656('0x4f')];_0x38266d+=0x1){let _0x1a6e22=_0x5df44d['Agents'][_0x38266d];var _0x1165af=_0x1abfe7[_0x4656('0x5b')]();_0x1165af['where'](_0x4656('0x86'),_0x1a6e22['id']);_0x37d99a[_0x4656('0x87')](db[_0x4656('0x76')][_0x4656('0x3b')](_0x1165af[_0x4656('0x88')](),{'type':db[_0x4656('0x76')]['QueryTypes']['SELECT']})[_0x4656('0x34')](function(_0x2060ad){if(_0x2060ad[_0x4656('0x4f')]===0x1){return _0x1a6e22['id'];}else{var _0x602e05=_[_0x4656('0x89')](_[_0x4656('0x2e')](_0x2060ad,'TeamId'),function(_0x2041b1){return _[_0x4656('0x8a')](_0x180275,_0x2041b1);});if(_0x602e05){return _0x1a6e22['id'];}}}));}}return BPromise[_0x4656('0x8b')](_0x37d99a)[_0x4656('0x34')](function(_0x49fe62){_0x51e2d7=_(_0x51e2d7)[_0x4656('0x8c')](_0x49fe62)[_0x4656('0x8d')]()[_0x4656('0x2f')]();return db[_0x4656('0x36')][_0x4656('0x30')]({'where':{'id':_0x56d21c[_0x4656('0x4d')]['id']}})[_0x4656('0x34')](function(_0x28e35f){return db['sequelize']['transaction'](function(_0x17da2b){return _0x28e35f[_0x4656('0x80')](_0x56d21c[_0x4656('0x3b')]['ids'],{'transaction':_0x17da2b})['then'](function(){if(!_[_0x4656('0x8e')](_0x51e2d7)){return _0x28e35f['removeAgents'](_0x51e2d7,{'transaction':_0x17da2b})[_0x4656('0x34')](function(){return db[_0x4656('0x7b')][_0x4656('0x28')]({'where':{'VoiceQueueId':_0x56d21c[_0x4656('0x4d')]['id'],'UserId':_0x51e2d7},'transaction':_0x17da2b});});}})[_0x4656('0x34')](function(){_0x51e2d7['forEach'](function(_0x15adc5){socket['emit'](_0x4656('0x8f'),{'UserId':_0x15adc5,'VoiceQueueId':_0x28e35f['id']});});});});});});})[_0x4656('0x34')](respondWithStatusCode(_0x394adc,null))['catch'](handleError(_0x394adc,null));};exports[_0x4656('0x90')]=function(_0x54ef07,_0x5b090c,_0x1001ce){var _0x3cdc10,_0x1c479;return db['VoiceQueue'][_0x4656('0x30')]({'where':{'id':_0x54ef07[_0x4656('0x4d')]['id']}})[_0x4656('0x34')](handleEntityNotFound(_0x5b090c,null))['then'](function(_0x50ebba){if(_0x50ebba){_0x1c479=_0x50ebba;return _0x50ebba[_0x4656('0x90')](_0x54ef07[_0x4656('0x52')]['ids'],_[_0x4656('0x91')](_0x54ef07[_0x4656('0x52')],[_0x4656('0x92'),'id'])||{})[_0x4656('0x93')](function(_0x44b1a0){for(var _0x50b1eb=0x0;_0x50b1eb<_0x54ef07[_0x4656('0x52')][_0x4656('0x92')]['length'];_0x50b1eb+=0x1){socket[_0x4656('0x7f')](_0x4656('0x94'),{'UserId':_0x54ef07[_0x4656('0x52')][_0x4656('0x92')][_0x50b1eb],'VoiceQueueId':_0x54ef07[_0x4656('0x4d')]['id']});}return _0x44b1a0;});}})[_0x4656('0x34')](function(_0x186257){_0x3cdc10=_0x186257||[];if(_0x1c479){return db[_0x4656('0x6f')][_0x4656('0x4a')]({'where':{'id':_0x54ef07[_0x4656('0x52')][_0x4656('0x92')]},'attributes':['id',_0x4656('0x32'),'online',_0x4656('0x7e'),_0x4656('0x72')],'raw':!![]});}})['then'](function(_0x337d7f){if(!_[_0x4656('0x8e')](_0x337d7f)){var _0x18a380=[];for(var _0x1c6558=0x0;_0x1c6558<_0x337d7f[_0x4656('0x4f')];_0x1c6558++){if(_0x337d7f[_0x1c6558][_0x4656('0x71')]){_0x18a380[_0x4656('0x87')](db[_0x4656('0x7b')][_0x4656('0x7c')]({'membername':_0x337d7f[_0x1c6558]['name'],'UserId':_0x337d7f[_0x1c6558]['id'],'queue_name':_0x1c479['name'],'VoiceQueueId':_0x1c479['id'],'interface':_[_0x4656('0x95')](_0x337d7f[_0x1c6558][_0x4656('0x72')])?util[_0x4656('0x96')]('SIP/%s',_0x337d7f[_0x1c6558]['name']):_0x337d7f[_0x1c6558]['interface'],'paused':_0x337d7f[_0x1c6558][_0x4656('0x7e')]||![],'penalty':_0x54ef07['body'][_0x4656('0x75')]||0x0}));}}return BPromise[_0x4656('0x8b')](_0x18a380);}})[_0x4656('0x34')](function(){return _0x3cdc10;})[_0x4656('0x34')](respondWithResult(_0x5b090c,null))['catch'](handleError(_0x5b090c,null));};exports[_0x4656('0x97')]=function(_0x2608e0,_0x2fcaa6,_0x4007b4){return db[_0x4656('0x36')]['find']({'where':{'id':_0x2608e0['params']['id']}})[_0x4656('0x34')](handleEntityNotFound(_0x2fcaa6,null))['then'](function(_0x2ee236){if(_0x2ee236){return _0x2ee236[_0x4656('0x97')](_0x2608e0[_0x4656('0x3b')]['ids'])['then'](function(){if(_[_0x4656('0x98')](_0x2608e0[_0x4656('0x3b')][_0x4656('0x92')])){for(var _0x4adb22=0x0;_0x4adb22<_0x2608e0['query'][_0x4656('0x92')][_0x4656('0x4f')];_0x4adb22+=0x1){socket[_0x4656('0x7f')](_0x4656('0x8f'),{'UserId':Number(_0x2608e0[_0x4656('0x3b')][_0x4656('0x92')][_0x4adb22]),'VoiceQueueId':Number(_0x2608e0[_0x4656('0x4d')]['id'])});}}else{socket[_0x4656('0x7f')](_0x4656('0x8f'),{'UserId':Number(_0x2608e0[_0x4656('0x3b')]['ids']),'VoiceQueueId':Number(_0x2608e0[_0x4656('0x4d')]['id'])});}});}})[_0x4656('0x34')](function(_0x4cf60c){return db[_0x4656('0x7b')][_0x4656('0x28')]({'where':{'VoiceQueueId':_0x2608e0[_0x4656('0x4d')]['id'],'UserId':_0x2608e0[_0x4656('0x3b')][_0x4656('0x92')]}})[_0x4656('0x34')](function(){return _0x4cf60c;});})['then'](respondWithStatusCode(_0x2fcaa6,null))[_0x4656('0x50')](handleError(_0x2fcaa6,null));};exports[_0x4656('0x99')]=function(_0xc6eac3,_0x4544c6,_0x4f40a8){var _0x5470d9={};var _0x3f4b84={};var _0x13779d;var _0x17ef7d;return db[_0x4656('0x36')]['findOne']({'where':{'id':_0xc6eac3[_0x4656('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4544c6,null))['then'](function(_0x2084f6){if(_0x2084f6){_0x13779d=_0x2084f6;_0x3f4b84[_0x4656('0x3a')]=_[_0x4656('0x4e')](db[_0x4656('0x6f')]['rawAttributes']);_0x3f4b84['query']=_[_0x4656('0x4e')](_0xc6eac3[_0x4656('0x3b')]);_0x3f4b84[_0x4656('0x3c')]=_[_0x4656('0x3d')](_0x3f4b84['model'],_0x3f4b84[_0x4656('0x3b')]);_0x5470d9['attributes']=_[_0x4656('0x3d')](_0x3f4b84[_0x4656('0x3a')],qs[_0x4656('0x3e')](_0xc6eac3['query'][_0x4656('0x3e')]));_0x5470d9[_0x4656('0x3f')]=_0x5470d9[_0x4656('0x3f')][_0x4656('0x4f')]?_0x5470d9[_0x4656('0x3f')]:_0x3f4b84['model'];_0x5470d9[_0x4656('0x68')]=qs[_0x4656('0x41')](_0xc6eac3[_0x4656('0x3b')][_0x4656('0x41')]);_0x5470d9[_0x4656('0x43')]=qs[_0x4656('0x3c')](_[_0x4656('0x42')](_0xc6eac3[_0x4656('0x3b')],_0x3f4b84['filters']));if(_0xc6eac3['query'][_0x4656('0x45')]){_0x5470d9[_0x4656('0x43')]=_[_0x4656('0x46')](_0x5470d9[_0x4656('0x43')],{'$or':_[_0x4656('0x2e')](_0x5470d9[_0x4656('0x3f')],function(_0x3be65c){var _0x4c39b0={};_0x4c39b0[_0x3be65c]={'$like':'%'+_0xc6eac3[_0x4656('0x3b')][_0x4656('0x45')]+'%'};return _0x4c39b0;})});}_0x5470d9=_[_0x4656('0x46')]({},_0x5470d9,_0xc6eac3[_0x4656('0x47')]);return _0x13779d[_0x4656('0x99')](_0x5470d9);}})[_0x4656('0x34')](function(_0x167917){if(_0x167917){_0x17ef7d=_0x167917['length'];if(!_0xc6eac3[_0x4656('0x3b')][_0x4656('0x60')](_0x4656('0x40'))){_0x5470d9[_0x4656('0x22')]=qs['limit'](_0xc6eac3[_0x4656('0x3b')][_0x4656('0x22')]);_0x5470d9[_0x4656('0x21')]=qs[_0x4656('0x21')](_0xc6eac3['query']['offset']);}return _0x13779d[_0x4656('0x99')](_0x5470d9);}})['then'](function(_0x5d4147){if(_0x5d4147){return _0x5d4147?{'count':_0x17ef7d,'rows':_0x5d4147}:null;}})['then'](respondWithResult(_0x4544c6,null))['catch'](handleError(_0x4544c6,null));};exports[_0x4656('0x9a')]=function(_0x1c3c63,_0x467a98,_0x1c3847){var _0x39d708={};var _0x17ab55={};var _0x4ca0f3;var _0xb5001f;return db[_0x4656('0x36')]['findOne']({'where':{'id':_0x1c3c63[_0x4656('0x4d')]['id']}})['then'](handleEntityNotFound(_0x467a98,null))[_0x4656('0x34')](function(_0x288a4c){if(_0x288a4c){_0x4ca0f3=_0x288a4c;_0x17ab55['model']=_[_0x4656('0x4e')](db[_0x4656('0x7b')][_0x4656('0x37')]);_0x17ab55[_0x4656('0x3b')]=_[_0x4656('0x4e')](_0x1c3c63[_0x4656('0x3b')]);_0x17ab55['filters']=_[_0x4656('0x3d')](_0x17ab55['model'],_0x17ab55['query']);_0x39d708[_0x4656('0x3f')]=_['intersection'](_0x17ab55['model'],qs[_0x4656('0x3e')](_0x1c3c63['query']['fields']));_0x39d708[_0x4656('0x3f')]=_0x39d708[_0x4656('0x3f')][_0x4656('0x4f')]?_0x39d708[_0x4656('0x3f')]:_0x17ab55[_0x4656('0x3a')];_0x39d708['order']=qs[_0x4656('0x41')](_0x1c3c63[_0x4656('0x3b')][_0x4656('0x41')]);_0x39d708[_0x4656('0x43')]=qs['filters'](_[_0x4656('0x42')](_0x1c3c63['query'],_0x17ab55['filters']));if(_0x1c3c63['query']['filter']){_0x39d708['where']=_[_0x4656('0x46')](_0x39d708[_0x4656('0x43')],{'$or':_['map'](_0x39d708[_0x4656('0x3f')],function(_0x3c9009){var _0x56dfdb={};_0x56dfdb[_0x3c9009]={'$like':'%'+_0x1c3c63[_0x4656('0x3b')]['filter']+'%'};return _0x56dfdb;})});}_0x39d708=_[_0x4656('0x46')]({},_0x39d708,_0x1c3c63[_0x4656('0x47')]);return _0x4ca0f3[_0x4656('0x9a')](_0x39d708);}})[_0x4656('0x34')](function(_0x191001){if(_0x191001){_0xb5001f=_0x191001[_0x4656('0x4f')];if(!_0x1c3c63[_0x4656('0x3b')][_0x4656('0x60')](_0x4656('0x40'))){_0x39d708['limit']=qs[_0x4656('0x22')](_0x1c3c63[_0x4656('0x3b')][_0x4656('0x22')]);_0x39d708[_0x4656('0x21')]=qs[_0x4656('0x21')](_0x1c3c63[_0x4656('0x3b')]['offset']);}return _0x4ca0f3[_0x4656('0x9a')](_0x39d708);}})[_0x4656('0x34')](function(_0x4fbace){return _0x4fbace?{'count':_0xb5001f,'rows':_0x4fbace}:null;})[_0x4656('0x34')](respondWithResult(_0x467a98,null))[_0x4656('0x50')](handleError(_0x467a98,null));};exports[_0x4656('0x9b')]=function(_0x4ae1bb,_0x525a05,_0x426c19){var _0x570840={};var _0x58a645={};var _0x36cbad;var _0x289eff;return db['VoiceQueue'][_0x4656('0x64')]({'where':{'id':_0x4ae1bb['params']['id']}})[_0x4656('0x34')](handleEntityNotFound(_0x525a05,null))['then'](function(_0x49b841){if(_0x49b841){_0x36cbad=_0x49b841;_0x58a645[_0x4656('0x3a')]=_[_0x4656('0x4e')](db[_0x4656('0x9c')][_0x4656('0x37')]);_0x58a645[_0x4656('0x3b')]=_[_0x4656('0x4e')](_0x4ae1bb['query']);_0x58a645[_0x4656('0x3c')]=_['intersection'](_0x58a645['model'],_0x58a645['query']);_0x570840['attributes']=_[_0x4656('0x3d')](_0x58a645['model'],qs[_0x4656('0x3e')](_0x4ae1bb[_0x4656('0x3b')][_0x4656('0x3e')]));_0x570840[_0x4656('0x3f')]=_0x570840[_0x4656('0x3f')][_0x4656('0x4f')]?_0x570840['attributes']:_0x58a645[_0x4656('0x3a')];_0x570840[_0x4656('0x68')]=qs[_0x4656('0x41')](_0x4ae1bb[_0x4656('0x3b')][_0x4656('0x41')]);_0x570840['where']=qs[_0x4656('0x3c')](_[_0x4656('0x42')](_0x4ae1bb[_0x4656('0x3b')],_0x58a645['filters']));if(_0x4ae1bb[_0x4656('0x3b')]['filter']){_0x570840[_0x4656('0x43')]=_[_0x4656('0x46')](_0x570840[_0x4656('0x43')],{'$or':_['map'](_0x570840[_0x4656('0x3f')],function(_0x59d7e3){var _0x3512c2={};_0x3512c2[_0x59d7e3]={'$like':'%'+_0x4ae1bb[_0x4656('0x3b')][_0x4656('0x45')]+'%'};return _0x3512c2;})});}_0x570840=_[_0x4656('0x46')]({},_0x570840,_0x4ae1bb['options']);return _0x36cbad['getLists'](_0x570840);}})[_0x4656('0x34')](function(_0x2d3595){if(_0x2d3595){_0x289eff=_0x2d3595[_0x4656('0x4f')];if(!_0x4ae1bb[_0x4656('0x3b')][_0x4656('0x60')](_0x4656('0x40'))){_0x570840[_0x4656('0x22')]=qs['limit'](_0x4ae1bb['query'][_0x4656('0x22')]);_0x570840[_0x4656('0x21')]=qs[_0x4656('0x21')](_0x4ae1bb[_0x4656('0x3b')][_0x4656('0x21')]);}return _0x36cbad[_0x4656('0x9b')](_0x570840);}})['then'](function(_0x3d2008){if(_0x3d2008){return _0x3d2008?{'count':_0x289eff,'rows':_0x3d2008}:null;}})[_0x4656('0x34')](respondWithResult(_0x525a05,null))[_0x4656('0x50')](handleError(_0x525a05,null));};exports[_0x4656('0x9d')]=function(_0x1fc8cb,_0x2c2c3b,_0x400412){var _0x5d43b1,_0x1bfedf;return db[_0x4656('0x36')][_0x4656('0x30')]({'where':{'id':_0x1fc8cb[_0x4656('0x4d')]['id']}})[_0x4656('0x34')](handleEntityNotFound(_0x2c2c3b,null))['then'](function(_0x5dcd1e){if(_0x5dcd1e){_0x1bfedf=_0x5dcd1e;return _0x5dcd1e[_0x4656('0x9d')](_0x1fc8cb['body'][_0x4656('0x92')],_[_0x4656('0x91')](_0x1fc8cb[_0x4656('0x52')],[_0x4656('0x92'),'id'])||{});}return null;})[_0x4656('0x93')](function(_0x2f3604){var _0x2a1e2a;_0x5d43b1=_0x2f3604||[];var _0x3f5d6a=[];if(_0x2f3604){for(var _0x338dc4=0x0;_0x338dc4<_0x2f3604[_0x4656('0x4f')];_0x338dc4+=0x1){var _0x189c7a=_0x2f3604[_0x338dc4][_0x4656('0x29')]({'plain':!![]});_0x1bfedf[_0x4656('0x9e')]=_0x1fc8cb[_0x4656('0x52')][_0x4656('0x9e')]?_0x1fc8cb['body'][_0x4656('0x9e')]:_0x1bfedf[_0x4656('0x9e')];switch(_0x1bfedf[_0x4656('0x9e')]){case _0x4656('0x9f'):_0x2a1e2a=squel[_0x4656('0xa0')]()[_0x4656('0xa1')](_0x4656('0xa2'))[_0x4656('0xa3')]([_0x4656('0xa4'),_0x4656('0xa5'),_0x4656('0xa6'),_0x4656('0xa7'),_0x4656('0x61'),_0x4656('0x5c'),_0x4656('0x5d')],squel['select']()[_0x4656('0xa8')]('phone','phone')[_0x4656('0xa8')]('NOW()',_0x4656('0xa5'))[_0x4656('0xa8')]('id',_0x4656('0xa6'))['field'](_0x189c7a[_0x4656('0xa9')][_0x4656('0x88')](),_0x4656('0xa7'))['field'](_0x1fc8cb[_0x4656('0x4d')]['id']['toString'](),'VoiceQueueId')[_0x4656('0xa8')]('NOW()',_0x4656('0x5c'))[_0x4656('0xa8')](_0x4656('0xaa'),'updatedAt')[_0x4656('0x81')](_0x4656('0xab'))[_0x4656('0x43')](_0x4656('0xac'))[_0x4656('0x43')](_0x4656('0xad'),_0x189c7a[_0x4656('0xa9')]['toString']())[_0x4656('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0x4656('0x43')](_0x4656('0xae'),squel[_0x4656('0xaf')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x4656('0x81')](_0x4656('0xb0'))[_0x4656('0x43')](_0x4656('0x85'),_0x1fc8cb[_0x4656('0x4d')]['id']['toString']()))[_0x4656('0x43')](_0x4656('0xae'),squel[_0x4656('0xaf')]()[_0x4656('0xa8')](_0x4656('0xb1'))[_0x4656('0x81')](_0x4656('0xa2'))[_0x4656('0x43')]('VoiceQueueId\x20=\x20?',_0x1fc8cb[_0x4656('0x4d')]['id']['toString']())))[_0x4656('0x88')]();break;case _0x4656('0xb2'):_0x2a1e2a=squel[_0x4656('0xa0')]()[_0x4656('0xa1')](_0x4656('0xa2'))['fromQuery']([_0x4656('0xa4'),_0x4656('0xa5'),_0x4656('0xa6'),_0x4656('0xa7'),_0x4656('0x61'),'createdAt',_0x4656('0x5d')],squel['select']()[_0x4656('0xa8')](_0x4656('0xa4'),_0x4656('0xa4'))[_0x4656('0xa8')](_0x4656('0xaa'),_0x4656('0xa5'))[_0x4656('0xa8')]('id','ContactId')[_0x4656('0xa8')](_0x189c7a[_0x4656('0xa9')][_0x4656('0x88')](),_0x4656('0xa7'))[_0x4656('0xa8')](_0x1fc8cb[_0x4656('0x4d')]['id'][_0x4656('0x88')](),'VoiceQueueId')[_0x4656('0xa8')](_0x4656('0xaa'),_0x4656('0x5c'))[_0x4656('0xa8')](_0x4656('0xaa'),_0x4656('0x5d'))['from']('cm_contacts')[_0x4656('0x43')]('deletedAt\x20IS\x20NULL')[_0x4656('0x43')](_0x4656('0xad'),_0x189c7a['CmListId'][_0x4656('0x88')]())[_0x4656('0x43')](_0x4656('0xb3'))[_0x4656('0x43')](_0x4656('0xae'),squel[_0x4656('0xaf')]()[_0x4656('0xa8')](_0x4656('0xb1'))[_0x4656('0x81')](_0x4656('0xa2'))[_0x4656('0x43')](_0x4656('0x85'),_0x1fc8cb[_0x4656('0x4d')]['id']['toString']())))[_0x4656('0x88')]();break;default:_0x2a1e2a=squel[_0x4656('0xa0')]()['into']('cm_hopper')['fromQuery']([_0x4656('0xa4'),'scheduledAt',_0x4656('0xa6'),'ListId',_0x4656('0x61'),_0x4656('0x5c'),_0x4656('0x5d')],squel['select']()['field'](_0x4656('0xa4'),'phone')[_0x4656('0xa8')](_0x4656('0xaa'),'scheduledAt')[_0x4656('0xa8')]('id',_0x4656('0xa6'))['field'](_0x189c7a[_0x4656('0xa9')][_0x4656('0x88')](),'ListId')['field'](_0x1fc8cb[_0x4656('0x4d')]['id'][_0x4656('0x88')](),_0x4656('0x61'))['field'](_0x4656('0xaa'),_0x4656('0x5c'))[_0x4656('0xa8')](_0x4656('0xaa'),_0x4656('0x5d'))[_0x4656('0x81')](_0x4656('0xab'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x4656('0xad'),_0x189c7a[_0x4656('0xa9')][_0x4656('0x88')]())['where'](_0x4656('0xb3')))[_0x4656('0x88')]();}_0x3f5d6a[_0x4656('0x87')](db[_0x4656('0x76')][_0x4656('0x3b')](_0x2a1e2a));}return BPromise[_0x4656('0x8b')](_0x3f5d6a);}})[_0x4656('0x34')](function(){return _0x5d43b1;})['then'](respondWithResult(_0x2c2c3b,null))['catch'](handleError(_0x2c2c3b,null));};exports[_0x4656('0xb4')]=function(_0x17d602,_0x322f54,_0x56d88f){return db[_0x4656('0x36')][_0x4656('0x30')]({'where':{'id':_0x17d602[_0x4656('0x4d')]['id']}})[_0x4656('0x34')](handleEntityNotFound(_0x322f54,null))[_0x4656('0x34')](function(_0x460e48){if(_0x460e48){return _0x460e48[_0x4656('0xb4')](_0x17d602[_0x4656('0x3b')][_0x4656('0x92')]);}})[_0x4656('0x34')](function(_0x2c0cd3){if(_0x2c0cd3){return db['CmHopper'][_0x4656('0x28')]({'where':{'ListId':_0x17d602[_0x4656('0x3b')][_0x4656('0x92')],'VoiceQueueId':_0x17d602['params']['id']}})[_0x4656('0x34')](function(){return _0x2c0cd3;});}})[_0x4656('0x34')](respondWithStatusCode(_0x322f54,null))[_0x4656('0x50')](handleError(_0x322f54,null));};exports[_0x4656('0xb5')]=function(_0x2d49dc,_0x2ad171,_0x33ae7d){var _0x23a368={};var _0x35cd24={};var _0x442cd2;var _0x521e54;return db[_0x4656('0x36')][_0x4656('0x64')]({'where':{'id':_0x2d49dc[_0x4656('0x4d')]['id']}})[_0x4656('0x34')](handleEntityNotFound(_0x2ad171,null))[_0x4656('0x34')](function(_0xf3c8c1){if(_0xf3c8c1){_0x442cd2=_0xf3c8c1;_0x35cd24[_0x4656('0x3a')]=_[_0x4656('0x4e')](db['CmList'][_0x4656('0x37')]);_0x35cd24[_0x4656('0x3b')]=_[_0x4656('0x4e')](_0x2d49dc[_0x4656('0x3b')]);_0x35cd24[_0x4656('0x3c')]=_[_0x4656('0x3d')](_0x35cd24[_0x4656('0x3a')],_0x35cd24[_0x4656('0x3b')]);_0x23a368[_0x4656('0x3f')]=_[_0x4656('0x3d')](_0x35cd24[_0x4656('0x3a')],qs[_0x4656('0x3e')](_0x2d49dc[_0x4656('0x3b')][_0x4656('0x3e')]));_0x23a368[_0x4656('0x3f')]=_0x23a368['attributes'][_0x4656('0x4f')]?_0x23a368[_0x4656('0x3f')]:_0x35cd24[_0x4656('0x3a')];_0x23a368[_0x4656('0x68')]=qs[_0x4656('0x41')](_0x2d49dc[_0x4656('0x3b')][_0x4656('0x41')]);_0x23a368['where']=qs[_0x4656('0x3c')](_['pick'](_0x2d49dc['query'],_0x35cd24[_0x4656('0x3c')]));if(_0x2d49dc[_0x4656('0x3b')][_0x4656('0x45')]){_0x23a368[_0x4656('0x43')]=_[_0x4656('0x46')](_0x23a368[_0x4656('0x43')],{'$or':_[_0x4656('0x2e')](_0x23a368['attributes'],function(_0x3cca6b){var _0x291a95={};_0x291a95[_0x3cca6b]={'$like':'%'+_0x2d49dc[_0x4656('0x3b')][_0x4656('0x45')]+'%'};return _0x291a95;})});}_0x23a368=_[_0x4656('0x46')]({},_0x23a368,_0x2d49dc['options']);return _0x442cd2[_0x4656('0xb5')](_0x23a368);}})['then'](function(_0x44e653){if(_0x44e653){_0x521e54=_0x44e653[_0x4656('0x4f')];if(!_0x2d49dc[_0x4656('0x3b')][_0x4656('0x60')](_0x4656('0x40'))){_0x23a368[_0x4656('0x22')]=qs['limit'](_0x2d49dc[_0x4656('0x3b')]['limit']);_0x23a368[_0x4656('0x21')]=qs[_0x4656('0x21')](_0x2d49dc['query'][_0x4656('0x21')]);}return _0x442cd2[_0x4656('0xb5')](_0x23a368);}})['then'](function(_0x39edee){if(_0x39edee){return _0x39edee?{'count':_0x521e54,'rows':_0x39edee}:null;}})[_0x4656('0x34')](respondWithResult(_0x2ad171,null))['catch'](handleError(_0x2ad171,null));};exports[_0x4656('0xb6')]=function(_0x168947,_0x8df792,_0x14f9b5){var _0x2053d6,_0x2a3e53;return db['VoiceQueue'][_0x4656('0x30')]({'where':{'id':_0x168947[_0x4656('0x4d')]['id']}})[_0x4656('0x34')](handleEntityNotFound(_0x8df792,null))['then'](function(_0x4cb321){if(_0x4cb321){_0x2a3e53=_0x4cb321;return _0x4cb321[_0x4656('0xb6')](_0x168947['body']['ids'],_[_0x4656('0x91')](_0x168947[_0x4656('0x52')],[_0x4656('0x92'),'id'])||{});}return null;})[_0x4656('0x93')](function(_0x31fc90){var _0xf26840;_0x2053d6=_0x31fc90||[];var _0xff76c5=[];if(_0x31fc90){for(var _0x116015=0x0;_0x116015<_0x31fc90[_0x4656('0x4f')];_0x116015+=0x1){var _0x5bb50a=_0x31fc90[_0x116015][_0x4656('0x29')]({'plain':!![]});_0xf26840=squel['insert']()[_0x4656('0xa1')](_0x4656('0xb7'))[_0x4656('0xa3')]([_0x4656('0xa4'),_0x4656('0xa6'),_0x4656('0xa7'),_0x4656('0x61'),_0x4656('0x5c'),_0x4656('0x5d')],squel['select']()[_0x4656('0xa8')](_0x4656('0xa4'),_0x4656('0xa4'))[_0x4656('0xa8')]('id',_0x4656('0xa6'))[_0x4656('0xa8')](_0x5bb50a['CmListId'][_0x4656('0x88')](),_0x4656('0xa7'))[_0x4656('0xa8')](_0x168947[_0x4656('0x4d')]['id'][_0x4656('0x88')](),_0x4656('0x61'))[_0x4656('0xa8')](_0x4656('0xaa'),_0x4656('0x5c'))[_0x4656('0xa8')](_0x4656('0xaa'),'updatedAt')[_0x4656('0x81')](_0x4656('0xab'))[_0x4656('0x43')]('deletedAt\x20IS\x20NULL')[_0x4656('0x43')](_0x4656('0xad'),_0x5bb50a[_0x4656('0xa9')]['toString']())[_0x4656('0x43')](_0x4656('0xb3')))['toString']();_0xff76c5[_0x4656('0x87')](db[_0x4656('0x76')][_0x4656('0x3b')](_0xf26840));}return BPromise[_0x4656('0x8b')](_0xff76c5);}})[_0x4656('0x34')](function(){return _0x2053d6;})[_0x4656('0x34')](respondWithResult(_0x8df792,null))[_0x4656('0x50')](handleError(_0x8df792,null));};exports[_0x4656('0xb8')]=function(_0x4f2b26,_0x185d69,_0x21c4b5){return db[_0x4656('0x36')][_0x4656('0x30')]({'where':{'id':_0x4f2b26[_0x4656('0x4d')]['id']}})[_0x4656('0x34')](handleEntityNotFound(_0x185d69,null))[_0x4656('0x34')](function(_0x1d1172){if(_0x1d1172){return _0x1d1172[_0x4656('0xb8')](_0x4f2b26[_0x4656('0x3b')][_0x4656('0x92')]);}})[_0x4656('0x34')](function(_0x56f4e6){if(_0x56f4e6){return db[_0x4656('0x6a')][_0x4656('0x28')]({'where':{'ListId':_0x4f2b26[_0x4656('0x3b')]['ids'],'VoiceQueueId':_0x4f2b26[_0x4656('0x4d')]['id']}})[_0x4656('0x34')](function(){return _0x56f4e6;});}})[_0x4656('0x34')](respondWithStatusCode(_0x185d69,null))['catch'](handleError(_0x185d69,null));}; \ No newline at end of file +var _0xdd72=['addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','phone','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','updatedAt','CmListId','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','./voiceQueue.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','count','includeAll','findAll','catch','show','include','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','omit','UserProfileSection','userProfileId','CmHopper','order','VoiceQueueId','rows','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','User','forEach','penalty','sequelize','transaction','UserVoiceQueue','findOrCreate','upsert','isNil','interface','format','SIP/%s','voicePause','userVoiceQueue:save','removeTeams','Team','Agents','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','isEmpty','removeAgents','UserVoiceQueueRt','emit','userVoiceQueue:remove','addAgents','ids','spread','online','isArray','getAgents','getMembers','getLists','CmList'];(function(_0x4b3e49,_0x9e566c){var _0x57e339=function(_0x1430e9){while(--_0x1430e9){_0x4b3e49['push'](_0x4b3e49['shift']());}};_0x57e339(++_0x9e566c);}(_0xdd72,0xd5));var _0x2dd7=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0xdd72[_0x4fc80b];return _0x119dba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2dd7('0x0'));var rimraf=require(_0x2dd7('0x1'));var zipdir=require(_0x2dd7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2dd7('0x3'));var moment=require(_0x2dd7('0x4'));var BPromise=require(_0x2dd7('0x5'));var Mustache=require(_0x2dd7('0x6'));var util=require(_0x2dd7('0x7'));var path=require(_0x2dd7('0x8'));var sox=require(_0x2dd7('0x9'));var csv=require(_0x2dd7('0xa'));var ejs=require(_0x2dd7('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2dd7('0xc'));var jsforce=require(_0x2dd7('0xd'));var deskjs=require(_0x2dd7('0xe'));var toCsv=require(_0x2dd7('0xa'));var querystring=require(_0x2dd7('0xf'));var Papa=require('papaparse');var Redis=require(_0x2dd7('0x10'));var authService=require(_0x2dd7('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2dd7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2dd7('0x13'));var config=require(_0x2dd7('0x14'));var db=require(_0x2dd7('0x15'))['db'];config['redis']=_[_0x2dd7('0x16')](config['redis'],{'host':_0x2dd7('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2dd7('0x18'))[_0x2dd7('0x19')](socket);function respondWithStatusCode(_0x41deee,_0x13d04a){_0x13d04a=_0x13d04a||0xcc;return function(_0x41c4e7){if(_0x41c4e7){return _0x41deee[_0x2dd7('0x1a')](_0x13d04a);}return _0x41deee['status'](_0x13d04a)[_0x2dd7('0x1b')]();};}function respondWithResult(_0x3bcfd1,_0x50d7df){_0x50d7df=_0x50d7df||0xc8;return function(_0x16faf1){if(_0x16faf1){return _0x3bcfd1[_0x2dd7('0x1c')](_0x50d7df)[_0x2dd7('0x1d')](_0x16faf1);}};}function respondWithFilteredResult(_0x3c5a21,_0x1962c6){return function(_0x128fe7){if(_0x128fe7){var _0x295f0d=_0x128fe7['count'],_0x1f34d0=_0x1962c6[_0x2dd7('0x1e')],_0x4a528c=_0x1962c6['offset']+_0x1962c6[_0x2dd7('0x1f')],_0x374377;if(_0x4a528c>=_0x295f0d){_0x4a528c=_0x295f0d;_0x374377=0xc8;}else{_0x374377=0xce;}_0x3c5a21[_0x2dd7('0x1c')](_0x374377);return _0x3c5a21[_0x2dd7('0x20')](_0x2dd7('0x21'),_0x1f34d0+'-'+_0x4a528c+'/'+_0x295f0d)[_0x2dd7('0x1d')](_0x128fe7);}return null;};}function patchUpdates(_0x79d736){return function(_0x41f09a){try{jsonpatch[_0x2dd7('0x22')](_0x41f09a,_0x79d736,!![]);}catch(_0x5f0c74){return BPromise['reject'](_0x5f0c74);}return _0x41f09a[_0x2dd7('0x23')]();};}function saveUpdates(_0x3b14c7,_0x333d9a){return function(_0x53f338){if(_0x53f338){return _0x53f338[_0x2dd7('0x24')](_0x3b14c7)[_0x2dd7('0x25')](function(_0xb44a54){return _0xb44a54;});}return null;};}function removeEntity(_0x190d8f,_0x366309){return function(_0xbbc41d){if(_0xbbc41d){return _0xbbc41d[_0x2dd7('0x26')]()['then'](function(){var _0x189e8b=_0xbbc41d[_0x2dd7('0x27')]({'plain':!![]});var _0x245a47=[{'name':'VoiceQueues','value':_0x2dd7('0x28'),'ignore':![]},{'name':_0x2dd7('0x29'),'value':_0x2dd7('0x2a'),'ignore':![]}];var _0x291ca7=_(_0x245a47)[_0x2dd7('0x2b')](_0x2dd7('0x2c'))[_0x2dd7('0x2d')](_0x2dd7('0x2e'))['value']();if(_[_0x2dd7('0x2f')](_0x291ca7,_0x189e8b[_0x2dd7('0x30')])){return;}var _0x419aad=_['find'](_0x245a47,[_0x2dd7('0x2e'),_0x189e8b['type']])[_0x2dd7('0x31')];return db['UserProfileResource'][_0x2dd7('0x26')]({'where':{'type':_0x419aad,'resourceId':_0x189e8b['id']}})['then'](function(){return _0xbbc41d;});})['then'](function(){_0x190d8f[_0x2dd7('0x1c')](0xcc)[_0x2dd7('0x1b')]();});}};}function handleEntityNotFound(_0x5d8a64,_0x290c5b){return function(_0x6d863){if(!_0x6d863){_0x5d8a64[_0x2dd7('0x1a')](0x194);}return _0x6d863;};}function handleError(_0x233dd6,_0x49b552){_0x49b552=_0x49b552||0x1f4;return function(_0x1d4d9f){logger[_0x2dd7('0x32')](_0x1d4d9f[_0x2dd7('0x33')]);if(_0x1d4d9f[_0x2dd7('0x31')]){delete _0x1d4d9f[_0x2dd7('0x31')];}_0x233dd6['status'](_0x49b552)[_0x2dd7('0x34')](_0x1d4d9f);};}exports[_0x2dd7('0x35')]=function(_0x1eed0f,_0x4591f3){var _0x34b821={},_0x4a94f5={},_0x41b81e={'count':0x0,'rows':[]};var _0x5069f3=_[_0x2dd7('0x2d')](db[_0x2dd7('0x36')][_0x2dd7('0x37')],function(_0x1979ec){return{'name':_0x1979ec[_0x2dd7('0x38')],'type':_0x1979ec[_0x2dd7('0x30')][_0x2dd7('0x39')]};});_0x4a94f5[_0x2dd7('0x3a')]=_[_0x2dd7('0x2d')](_0x5069f3,'name');_0x4a94f5[_0x2dd7('0x3b')]=_[_0x2dd7('0x3c')](_0x1eed0f[_0x2dd7('0x3b')]);_0x4a94f5[_0x2dd7('0x3d')]=_[_0x2dd7('0x3e')](_0x4a94f5['model'],_0x4a94f5[_0x2dd7('0x3b')]);_0x34b821[_0x2dd7('0x3f')]=_[_0x2dd7('0x3e')](_0x4a94f5[_0x2dd7('0x3a')],qs[_0x2dd7('0x40')](_0x1eed0f[_0x2dd7('0x3b')][_0x2dd7('0x40')]));_0x34b821[_0x2dd7('0x3f')]=_0x34b821['attributes'][_0x2dd7('0x41')]?_0x34b821['attributes']:_0x4a94f5[_0x2dd7('0x3a')];if(!_0x1eed0f[_0x2dd7('0x3b')]['hasOwnProperty'](_0x2dd7('0x42'))){_0x34b821[_0x2dd7('0x1f')]=qs['limit'](_0x1eed0f[_0x2dd7('0x3b')][_0x2dd7('0x1f')]);_0x34b821[_0x2dd7('0x1e')]=qs[_0x2dd7('0x1e')](_0x1eed0f['query']['offset']);}_0x34b821['order']=qs[_0x2dd7('0x43')](_0x1eed0f['query'][_0x2dd7('0x43')]);_0x34b821[_0x2dd7('0x44')]=qs[_0x2dd7('0x3d')](_[_0x2dd7('0x45')](_0x1eed0f[_0x2dd7('0x3b')],_0x4a94f5[_0x2dd7('0x3d')]),_0x5069f3);if(_0x1eed0f[_0x2dd7('0x3b')][_0x2dd7('0x2b')]){_0x34b821[_0x2dd7('0x44')]=_['merge'](_0x34b821[_0x2dd7('0x44')],{'$or':_['map'](_0x5069f3,function(_0x293966){if(_0x293966[_0x2dd7('0x30')]!==_0x2dd7('0x46')){var _0x1cf550={};_0x1cf550[_0x293966['name']]={'$like':'%'+_0x1eed0f['query'][_0x2dd7('0x2b')]+'%'};return _0x1cf550;}})});}_0x34b821=_['merge']({},_0x34b821,_0x1eed0f['options']);var _0x11323c={'where':_0x34b821[_0x2dd7('0x44')]};return db[_0x2dd7('0x36')][_0x2dd7('0x47')](_0x11323c)[_0x2dd7('0x25')](function(_0x1b2247){_0x41b81e['count']=_0x1b2247;if(_0x1eed0f[_0x2dd7('0x3b')][_0x2dd7('0x48')]){_0x34b821['include']=[{'all':!![]}];}return db[_0x2dd7('0x36')][_0x2dd7('0x49')](_0x34b821);})[_0x2dd7('0x25')](function(_0x224a26){_0x41b81e['rows']=_0x224a26;return _0x41b81e;})[_0x2dd7('0x25')](respondWithFilteredResult(_0x4591f3,_0x34b821))[_0x2dd7('0x4a')](handleError(_0x4591f3,null));};exports[_0x2dd7('0x4b')]=function(_0x55d9d1,_0x8875d6){var _0xece239={'raw':![],'where':{'id':_0x55d9d1['params']['id']}},_0x5d9004={};_0x5d9004['model']=_[_0x2dd7('0x3c')](db[_0x2dd7('0x36')]['rawAttributes']);_0x5d9004[_0x2dd7('0x3b')]=_[_0x2dd7('0x3c')](_0x55d9d1['query']);_0x5d9004['filters']=_[_0x2dd7('0x3e')](_0x5d9004[_0x2dd7('0x3a')],_0x5d9004[_0x2dd7('0x3b')]);_0xece239[_0x2dd7('0x3f')]=_[_0x2dd7('0x3e')](_0x5d9004[_0x2dd7('0x3a')],qs[_0x2dd7('0x40')](_0x55d9d1[_0x2dd7('0x3b')]['fields']));_0xece239['attributes']=_0xece239['attributes'][_0x2dd7('0x41')]?_0xece239[_0x2dd7('0x3f')]:_0x5d9004[_0x2dd7('0x3a')];if(_0x55d9d1['query'][_0x2dd7('0x48')]){_0xece239[_0x2dd7('0x4c')]=[{'all':!![]}];}_0xece239=_[_0x2dd7('0x4d')]({},_0xece239,_0x55d9d1[_0x2dd7('0x4e')]);return db[_0x2dd7('0x36')]['find'](_0xece239)[_0x2dd7('0x25')](handleEntityNotFound(_0x8875d6,null))['then'](respondWithResult(_0x8875d6,null))[_0x2dd7('0x4a')](handleError(_0x8875d6,null));};exports[_0x2dd7('0x4f')]=function(_0x3598dc,_0x2f56aa){return db['VoiceQueue'][_0x2dd7('0x4f')](_0x3598dc[_0x2dd7('0x50')],{})[_0x2dd7('0x25')](function(_0x1f6a8e){var _0x3e9510=_0x3598dc[_0x2dd7('0x51')][_0x2dd7('0x27')]({'plain':!![]});if(!_0x3e9510)throw new Error(_0x2dd7('0x52'));if(_0x3e9510[_0x2dd7('0x53')]===_0x2dd7('0x51')){var _0x25e0b9=_0x1f6a8e[_0x2dd7('0x27')]({'plain':!![]});var _0x43d40c=[{'name':_0x2dd7('0x54'),'value':'inbound'},{'name':_0x2dd7('0x29'),'value':'outbound'}];var _0x190e09=_[_0x2dd7('0x55')](_0x43d40c,[_0x2dd7('0x2e'),_0x25e0b9[_0x2dd7('0x30')]])[_0x2dd7('0x31')];return db['UserProfileSection'][_0x2dd7('0x55')]({'where':{'name':_0x190e09,'userProfileId':_0x3e9510['userProfileId']},'raw':!![]})['then'](function(_0x692ebf){if(_0x692ebf&&_0x692ebf[_0x2dd7('0x56')]===0x0){return db[_0x2dd7('0x57')]['create']({'name':_0x25e0b9[_0x2dd7('0x31')],'resourceId':_0x25e0b9['id'],'type':_0x692ebf[_0x2dd7('0x31')],'sectionId':_0x692ebf['id']},{})[_0x2dd7('0x25')](function(){return _0x1f6a8e;});}else{return _0x1f6a8e;}})[_0x2dd7('0x4a')](function(_0x3e3120){logger[_0x2dd7('0x32')](_0x2dd7('0x58'),_0x3e3120);throw _0x3e3120;});}return _0x1f6a8e;})[_0x2dd7('0x25')](respondWithResult(_0x2f56aa,0xc9))[_0x2dd7('0x4a')](handleError(_0x2f56aa,null));};exports[_0x2dd7('0x59')]=function(_0x42426d,_0x220bbc){var _0x1a4edc={'where':{'id':_0x42426d[_0x2dd7('0x5a')]['id']}},_0x227e5e={};_0x227e5e[_0x2dd7('0x3a')]=_[_0x2dd7('0x3c')](db[_0x2dd7('0x36')][_0x2dd7('0x37')]);_0x1a4edc['attributes']=_['intersection'](_0x227e5e[_0x2dd7('0x3a')],qs[_0x2dd7('0x40')](_0x42426d[_0x2dd7('0x3b')]['fields']));_0x1a4edc['attributes']=_0x1a4edc[_0x2dd7('0x3f')][_0x2dd7('0x41')]?_0x1a4edc['attributes']:_0x227e5e[_0x2dd7('0x3a')];if(_0x42426d[_0x2dd7('0x3b')][_0x2dd7('0x48')]){_0x1a4edc[_0x2dd7('0x4c')]=[{'all':!![]}];}_0x1a4edc=_['merge']({},_0x1a4edc,_0x42426d['options']);return db[_0x2dd7('0x36')][_0x2dd7('0x55')](_0x1a4edc)['then'](handleEntityNotFound(_0x220bbc,null))[_0x2dd7('0x25')](function(_0x671c88){if(_0x671c88){var _0x33d251=_0x671c88[_0x2dd7('0x27')]({'plain':!![]});_0x33d251=qs['omit'](_0x33d251,['id',_0x2dd7('0x5b'),'updatedAt']);_0x42426d['body']=_[_0x2dd7('0x5c')](_0x42426d[_0x2dd7('0x50')],['id',_0x2dd7('0x5b'),'updatedAt']);return db[_0x2dd7('0x36')][_0x2dd7('0x4f')](_[_0x2dd7('0x4d')](_0x33d251,_0x42426d[_0x2dd7('0x50')]),{'include':_0x42426d[_0x2dd7('0x3b')][_0x2dd7('0x48')]?[{'all':!![]}]:undefined})[_0x2dd7('0x25')](function(_0x1df60f){var _0x340b48=_0x42426d['user'][_0x2dd7('0x27')]({'plain':!![]});if(!_0x340b48)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x340b48[_0x2dd7('0x53')]==='user'){var _0x40b3e2=_0x1df60f['get']({'plain':!![]});var _0x495c16=[{'name':_0x2dd7('0x54'),'value':_0x2dd7('0x28')},{'name':_0x2dd7('0x29'),'value':'outbound'}];var _0x362e41=_[_0x2dd7('0x55')](_0x495c16,[_0x2dd7('0x2e'),_0x40b3e2['type']])[_0x2dd7('0x31')];return db[_0x2dd7('0x5d')]['find']({'where':{'name':_0x362e41,'userProfileId':_0x340b48[_0x2dd7('0x5e')]},'raw':!![]})[_0x2dd7('0x25')](function(_0x552db5){if(_0x552db5&&_0x552db5['autoAssociation']===0x0){return db['UserProfileResource'][_0x2dd7('0x4f')]({'name':_0x40b3e2[_0x2dd7('0x31')],'resourceId':_0x40b3e2['id'],'type':_0x552db5[_0x2dd7('0x31')],'sectionId':_0x552db5['id']},{})[_0x2dd7('0x25')](function(){return _0x1df60f;});}else{return _0x1df60f;}})[_0x2dd7('0x4a')](function(_0x4bebc7){logger[_0x2dd7('0x32')](_0x2dd7('0x58'),_0x4bebc7);throw _0x4bebc7;});}return _0x1df60f;});}})[_0x2dd7('0x25')](respondWithResult(_0x220bbc,0xc9))[_0x2dd7('0x4a')](handleError(_0x220bbc,null));};exports[_0x2dd7('0x24')]=function(_0x50cbdc,_0x5378db){if(_0x50cbdc[_0x2dd7('0x50')]['id']){delete _0x50cbdc[_0x2dd7('0x50')]['id'];}return db[_0x2dd7('0x36')][_0x2dd7('0x55')]({'where':{'id':_0x50cbdc[_0x2dd7('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5378db,null))['then'](saveUpdates(_0x50cbdc[_0x2dd7('0x50')],null))[_0x2dd7('0x25')](respondWithResult(_0x5378db,null))['catch'](handleError(_0x5378db,null));};exports[_0x2dd7('0x26')]=function(_0x1a4538,_0x2a78cc){return db[_0x2dd7('0x36')][_0x2dd7('0x55')]({'where':{'id':_0x1a4538['params']['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x2a78cc,null))['then'](removeEntity(_0x2a78cc,null))[_0x2dd7('0x4a')](handleError(_0x2a78cc,null));};exports['getHoppers']=function(_0x4ad7e5,_0x1f58b8,_0x41f21a){var _0x4ce0e7={'raw':![],'where':{}};var _0x5ca2f0={};var _0xefcbf2={'count':0x0,'rows':[]};return db[_0x2dd7('0x36')]['findOne']({'where':{'id':_0x4ad7e5[_0x2dd7('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1f58b8,null))['then'](function(_0x28a4e3){if(_0x28a4e3){_0x5ca2f0['model']=_[_0x2dd7('0x3c')](db[_0x2dd7('0x5f')][_0x2dd7('0x37')]);_0x5ca2f0[_0x2dd7('0x3b')]=_['keys'](_0x4ad7e5[_0x2dd7('0x3b')]);_0x5ca2f0['filters']=_['intersection'](_0x5ca2f0[_0x2dd7('0x3a')],_0x5ca2f0['query']);_0x4ce0e7[_0x2dd7('0x3f')]=_[_0x2dd7('0x3e')](_0x5ca2f0[_0x2dd7('0x3a')],qs[_0x2dd7('0x40')](_0x4ad7e5['query'][_0x2dd7('0x40')]));_0x4ce0e7[_0x2dd7('0x3f')]=_0x4ce0e7[_0x2dd7('0x3f')]['length']?_0x4ce0e7[_0x2dd7('0x3f')]:_0x5ca2f0[_0x2dd7('0x3a')];if(!_0x4ad7e5[_0x2dd7('0x3b')]['hasOwnProperty'](_0x2dd7('0x42'))){_0x4ce0e7['limit']=qs[_0x2dd7('0x1f')](_0x4ad7e5[_0x2dd7('0x3b')][_0x2dd7('0x1f')]);_0x4ce0e7['offset']=qs[_0x2dd7('0x1e')](_0x4ad7e5[_0x2dd7('0x3b')]['offset']);}_0x4ce0e7[_0x2dd7('0x60')]=qs[_0x2dd7('0x43')](_0x4ad7e5[_0x2dd7('0x3b')]['sort']);_0x4ce0e7[_0x2dd7('0x44')]=qs[_0x2dd7('0x3d')](_[_0x2dd7('0x45')](_0x4ad7e5['query'],_0x5ca2f0[_0x2dd7('0x3d')]));_0x4ce0e7[_0x2dd7('0x44')][_0x2dd7('0x61')]=_0x28a4e3['id'];if(_0x4ad7e5[_0x2dd7('0x3b')]['filter']){_0x4ce0e7['where']=_[_0x2dd7('0x4d')](_0x4ce0e7[_0x2dd7('0x44')],{'$or':_[_0x2dd7('0x2d')](_0x4ce0e7[_0x2dd7('0x3f')],function(_0x2a69af){var _0x2cc98e={};_0x2cc98e[_0x2a69af]={'$like':'%'+_0x4ad7e5[_0x2dd7('0x3b')]['filter']+'%'};return _0x2cc98e;})});}_0x4ce0e7=_[_0x2dd7('0x4d')]({},_0x4ce0e7,_0x4ad7e5[_0x2dd7('0x4e')]);return db[_0x2dd7('0x5f')][_0x2dd7('0x47')]({'where':_0x4ce0e7[_0x2dd7('0x44')]})['then'](function(_0x3f43e0){_0xefcbf2[_0x2dd7('0x47')]=_0x3f43e0;if(_0x4ad7e5['query'][_0x2dd7('0x48')]){_0x4ce0e7[_0x2dd7('0x4c')]=[{'all':!![]}];}return db['CmHopper'][_0x2dd7('0x49')](_0x4ce0e7);})[_0x2dd7('0x25')](function(_0x384991){_0xefcbf2[_0x2dd7('0x62')]=_0x384991;return _0xefcbf2;});}})['then'](respondWithFilteredResult(_0x1f58b8,_0x4ce0e7))[_0x2dd7('0x4a')](handleError(_0x1f58b8,null));};exports[_0x2dd7('0x63')]=function(_0x55ab29,_0x4fda37,_0x275f71){var _0x3d3834={'raw':!![],'where':{}};var _0x11f7a0={};var _0x5ba348={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2dd7('0x64')]({'where':{'id':_0x55ab29[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x4fda37,null))[_0x2dd7('0x25')](function(_0x35b817){if(_0x35b817){_0x11f7a0['model']=_[_0x2dd7('0x3c')](db[_0x2dd7('0x65')][_0x2dd7('0x37')]);_0x11f7a0[_0x2dd7('0x3b')]=_[_0x2dd7('0x3c')](_0x55ab29[_0x2dd7('0x3b')]);_0x11f7a0[_0x2dd7('0x3d')]=_[_0x2dd7('0x3e')](_0x11f7a0[_0x2dd7('0x3a')],_0x11f7a0[_0x2dd7('0x3b')]);_0x3d3834[_0x2dd7('0x3f')]=_[_0x2dd7('0x3e')](_0x11f7a0[_0x2dd7('0x3a')],qs[_0x2dd7('0x40')](_0x55ab29[_0x2dd7('0x3b')][_0x2dd7('0x40')]));_0x3d3834['attributes']=_0x3d3834[_0x2dd7('0x3f')][_0x2dd7('0x41')]?_0x3d3834[_0x2dd7('0x3f')]:_0x11f7a0[_0x2dd7('0x3a')];if(!_0x55ab29[_0x2dd7('0x3b')][_0x2dd7('0x66')](_0x2dd7('0x42'))){_0x3d3834[_0x2dd7('0x1f')]=qs[_0x2dd7('0x1f')](_0x55ab29['query'][_0x2dd7('0x1f')]);_0x3d3834['offset']=qs[_0x2dd7('0x1e')](_0x55ab29[_0x2dd7('0x3b')][_0x2dd7('0x1e')]);}_0x3d3834[_0x2dd7('0x60')]=qs[_0x2dd7('0x43')](_0x55ab29[_0x2dd7('0x3b')][_0x2dd7('0x43')]);_0x3d3834[_0x2dd7('0x44')]=qs['filters'](_['pick'](_0x55ab29[_0x2dd7('0x3b')],_0x11f7a0[_0x2dd7('0x3d')]));_0x3d3834[_0x2dd7('0x44')][_0x2dd7('0x61')]=_0x35b817['id'];if(_0x55ab29[_0x2dd7('0x3b')]['filter']){_0x3d3834[_0x2dd7('0x44')]=_[_0x2dd7('0x4d')](_0x3d3834[_0x2dd7('0x44')],{'$or':_[_0x2dd7('0x2d')](_0x3d3834[_0x2dd7('0x3f')],function(_0x583e6c){var _0x585d42={};_0x585d42[_0x583e6c]={'$like':'%'+_0x55ab29[_0x2dd7('0x3b')][_0x2dd7('0x2b')]+'%'};return _0x585d42;})});}_0x3d3834=_[_0x2dd7('0x4d')]({},_0x3d3834,_0x55ab29[_0x2dd7('0x4e')]);return db[_0x2dd7('0x65')]['count']({'where':_0x3d3834[_0x2dd7('0x44')]})[_0x2dd7('0x25')](function(_0x400f54){_0x5ba348['count']=_0x400f54;if(_0x55ab29[_0x2dd7('0x3b')][_0x2dd7('0x48')]){_0x3d3834[_0x2dd7('0x4c')]=[{'all':!![]}];}return db[_0x2dd7('0x65')][_0x2dd7('0x49')](_0x3d3834);})[_0x2dd7('0x25')](function(_0x1f9fb0){_0x5ba348[_0x2dd7('0x62')]=_0x1f9fb0;return _0x5ba348;});}})[_0x2dd7('0x25')](respondWithFilteredResult(_0x4fda37,_0x3d3834))[_0x2dd7('0x4a')](handleError(_0x4fda37,null));};exports[_0x2dd7('0x67')]=function(_0x475dbe,_0x46f5be,_0x312353){var _0x2e18ac={'raw':!![],'where':{}};var _0x5f13e4={};var _0x2ba885={'count':0x0,'rows':[]};return db[_0x2dd7('0x36')][_0x2dd7('0x64')]({'where':{'id':_0x475dbe[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x46f5be,null))['then'](function(_0x305357){if(_0x305357){_0x5f13e4[_0x2dd7('0x3a')]=_[_0x2dd7('0x3c')](db[_0x2dd7('0x68')][_0x2dd7('0x37')]);_0x5f13e4[_0x2dd7('0x3b')]=_[_0x2dd7('0x3c')](_0x475dbe[_0x2dd7('0x3b')]);_0x5f13e4[_0x2dd7('0x3d')]=_[_0x2dd7('0x3e')](_0x5f13e4[_0x2dd7('0x3a')],_0x5f13e4['query']);_0x2e18ac['attributes']=_['intersection'](_0x5f13e4[_0x2dd7('0x3a')],qs[_0x2dd7('0x40')](_0x475dbe[_0x2dd7('0x3b')][_0x2dd7('0x40')]));_0x2e18ac[_0x2dd7('0x3f')]=_0x2e18ac[_0x2dd7('0x3f')][_0x2dd7('0x41')]?_0x2e18ac['attributes']:_0x5f13e4[_0x2dd7('0x3a')];if(!_0x475dbe[_0x2dd7('0x3b')][_0x2dd7('0x66')](_0x2dd7('0x42'))){_0x2e18ac[_0x2dd7('0x1f')]=qs[_0x2dd7('0x1f')](_0x475dbe['query'][_0x2dd7('0x1f')]);_0x2e18ac['offset']=qs[_0x2dd7('0x1e')](_0x475dbe[_0x2dd7('0x3b')][_0x2dd7('0x1e')]);}_0x2e18ac[_0x2dd7('0x60')]=qs[_0x2dd7('0x43')](_0x475dbe[_0x2dd7('0x3b')][_0x2dd7('0x43')]);_0x2e18ac[_0x2dd7('0x44')]=qs[_0x2dd7('0x3d')](_[_0x2dd7('0x45')](_0x475dbe[_0x2dd7('0x3b')],_0x5f13e4[_0x2dd7('0x3d')]));_0x2e18ac['where'][_0x2dd7('0x61')]=_0x305357['id'];if(_0x475dbe[_0x2dd7('0x3b')]['filter']){_0x2e18ac[_0x2dd7('0x44')]=_[_0x2dd7('0x4d')](_0x2e18ac[_0x2dd7('0x44')],{'$or':_[_0x2dd7('0x2d')](_0x2e18ac['attributes'],function(_0x116ed1){var _0x5c01db={};_0x5c01db[_0x116ed1]={'$like':'%'+_0x475dbe[_0x2dd7('0x3b')]['filter']+'%'};return _0x5c01db;})});}_0x2e18ac=_[_0x2dd7('0x4d')]({},_0x2e18ac,_0x475dbe[_0x2dd7('0x4e')]);return db[_0x2dd7('0x68')]['count']({'where':_0x2e18ac[_0x2dd7('0x44')]})[_0x2dd7('0x25')](function(_0xad0a9d){_0x2ba885[_0x2dd7('0x47')]=_0xad0a9d;if(_0x475dbe[_0x2dd7('0x3b')]['includeAll']){_0x2e18ac[_0x2dd7('0x4c')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2e18ac);})[_0x2dd7('0x25')](function(_0x1fe9d6){_0x2ba885[_0x2dd7('0x62')]=_0x1fe9d6;return _0x2ba885;});}})[_0x2dd7('0x25')](respondWithFilteredResult(_0x46f5be,_0x2e18ac))[_0x2dd7('0x4a')](handleError(_0x46f5be,null));};exports[_0x2dd7('0x69')]=function(_0x3ffc7a,_0x2d21d4,_0x32d2a7){var _0x5d925a={'raw':!![],'where':{}};var _0xd15f1e={};var _0xf50f35={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2dd7('0x64')]({'where':{'id':_0x3ffc7a[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x2d21d4,null))[_0x2dd7('0x25')](function(_0xda4086){if(_0xda4086){_0xd15f1e[_0x2dd7('0x3a')]=_['keys'](db[_0x2dd7('0x6a')][_0x2dd7('0x37')]);_0xd15f1e['query']=_[_0x2dd7('0x3c')](_0x3ffc7a[_0x2dd7('0x3b')]);_0xd15f1e[_0x2dd7('0x3d')]=_[_0x2dd7('0x3e')](_0xd15f1e[_0x2dd7('0x3a')],_0xd15f1e[_0x2dd7('0x3b')]);_0x5d925a['attributes']=_[_0x2dd7('0x3e')](_0xd15f1e[_0x2dd7('0x3a')],qs['fields'](_0x3ffc7a[_0x2dd7('0x3b')][_0x2dd7('0x40')]));_0x5d925a['attributes']=_0x5d925a['attributes'][_0x2dd7('0x41')]?_0x5d925a[_0x2dd7('0x3f')]:_0xd15f1e[_0x2dd7('0x3a')];if(!_0x3ffc7a['query'][_0x2dd7('0x66')]('nolimit')){_0x5d925a['limit']=qs[_0x2dd7('0x1f')](_0x3ffc7a[_0x2dd7('0x3b')][_0x2dd7('0x1f')]);_0x5d925a['offset']=qs[_0x2dd7('0x1e')](_0x3ffc7a['query'][_0x2dd7('0x1e')]);}_0x5d925a[_0x2dd7('0x60')]=qs[_0x2dd7('0x43')](_0x3ffc7a[_0x2dd7('0x3b')][_0x2dd7('0x43')]);_0x5d925a[_0x2dd7('0x44')]=qs[_0x2dd7('0x3d')](_['pick'](_0x3ffc7a['query'],_0xd15f1e[_0x2dd7('0x3d')]));_0x5d925a['where']['VoiceQueueId']=_0xda4086['id'];if(_0x3ffc7a['query'][_0x2dd7('0x2b')]){_0x5d925a[_0x2dd7('0x44')]=_[_0x2dd7('0x4d')](_0x5d925a[_0x2dd7('0x44')],{'$or':_['map'](_0x5d925a[_0x2dd7('0x3f')],function(_0x4dc03f){var _0x4f2202={};_0x4f2202[_0x4dc03f]={'$like':'%'+_0x3ffc7a[_0x2dd7('0x3b')][_0x2dd7('0x2b')]+'%'};return _0x4f2202;})});}_0x5d925a=_['merge']({},_0x5d925a,_0x3ffc7a[_0x2dd7('0x4e')]);return db[_0x2dd7('0x6a')][_0x2dd7('0x47')]({'where':_0x5d925a[_0x2dd7('0x44')]})[_0x2dd7('0x25')](function(_0x4a930e){_0xf50f35[_0x2dd7('0x47')]=_0x4a930e;if(_0x3ffc7a[_0x2dd7('0x3b')][_0x2dd7('0x48')]){_0x5d925a[_0x2dd7('0x4c')]=[{'all':!![]}];}return db[_0x2dd7('0x6a')]['findAll'](_0x5d925a);})['then'](function(_0x597a2e){_0xf50f35[_0x2dd7('0x62')]=_0x597a2e;return _0xf50f35;});}})['then'](respondWithFilteredResult(_0x2d21d4,_0x5d925a))[_0x2dd7('0x4a')](handleError(_0x2d21d4,null));};exports[_0x2dd7('0x6b')]=function(_0x1604db,_0x2db8e7,_0x4d3737){var _0x518a36={};var _0x23496e={};var _0x2e0168;var _0xa8db81;return db[_0x2dd7('0x36')][_0x2dd7('0x64')]({'where':{'id':_0x1604db[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x2db8e7,null))[_0x2dd7('0x25')](function(_0x333ac0){if(_0x333ac0){_0x2e0168=_0x333ac0;_0x23496e['model']=_[_0x2dd7('0x3c')](db['Team'][_0x2dd7('0x37')]);_0x23496e['query']=_['keys'](_0x1604db['query']);_0x23496e['filters']=_[_0x2dd7('0x3e')](_0x23496e[_0x2dd7('0x3a')],_0x23496e[_0x2dd7('0x3b')]);_0x518a36['attributes']=_[_0x2dd7('0x3e')](_0x23496e['model'],qs[_0x2dd7('0x40')](_0x1604db[_0x2dd7('0x3b')][_0x2dd7('0x40')]));_0x518a36[_0x2dd7('0x3f')]=_0x518a36['attributes']['length']?_0x518a36['attributes']:_0x23496e[_0x2dd7('0x3a')];_0x518a36['order']=qs[_0x2dd7('0x43')](_0x1604db[_0x2dd7('0x3b')][_0x2dd7('0x43')]);_0x518a36['where']=qs[_0x2dd7('0x3d')](_['pick'](_0x1604db['query'],_0x23496e[_0x2dd7('0x3d')]));if(_0x1604db[_0x2dd7('0x3b')]['filter']){_0x518a36[_0x2dd7('0x44')]=_[_0x2dd7('0x4d')](_0x518a36['where'],{'$or':_[_0x2dd7('0x2d')](_0x518a36['attributes'],function(_0x4b7595){var _0x6b49f6={};_0x6b49f6[_0x4b7595]={'$like':'%'+_0x1604db[_0x2dd7('0x3b')][_0x2dd7('0x2b')]+'%'};return _0x6b49f6;})});}_0x518a36=_['merge']({},_0x518a36,_0x1604db[_0x2dd7('0x4e')]);return _0x2e0168[_0x2dd7('0x6b')](_0x518a36);}})[_0x2dd7('0x25')](function(_0x3f8a87){if(_0x3f8a87){_0xa8db81=_0x3f8a87[_0x2dd7('0x41')];if(!_0x1604db[_0x2dd7('0x3b')]['hasOwnProperty'](_0x2dd7('0x42'))){_0x518a36['limit']=qs['limit'](_0x1604db[_0x2dd7('0x3b')]['limit']);_0x518a36[_0x2dd7('0x1e')]=qs['offset'](_0x1604db['query'][_0x2dd7('0x1e')]);}return _0x2e0168[_0x2dd7('0x6b')](_0x518a36);}})[_0x2dd7('0x25')](function(_0x4659bf){if(_0x4659bf){return _0x4659bf?{'count':_0xa8db81,'rows':_0x4659bf}:null;}})['then'](respondWithResult(_0x2db8e7,null))['catch'](handleError(_0x2db8e7,null));};exports[_0x2dd7('0x6c')]=function(_0x1b566b,_0xda281a,_0x16d65e){var _0x1c9282=_0x1b566b[_0x2dd7('0x50')][_0x2dd7('0x6d')];var _0x57aed0=_[_0x2dd7('0x2d')](_0x1c9282,'id');return db['Team'][_0x2dd7('0x49')]({'where':{'id':_0x57aed0},'attributes':['id'],'include':[{'model':db[_0x2dd7('0x6e')],'as':'Agents','attributes':['id',_0x2dd7('0x31'),'online','voicePause','interface'],'raw':!![]}]})[_0x2dd7('0x25')](function(_0xd39c1e){if(_0xd39c1e){var _0xe54762=_['flatMap'](_0xd39c1e,function(_0x52ab9d){var _0x31ac97=_0x52ab9d[_0x2dd7('0x27')]({'plain':!![]});_0x31ac97['Agents'][_0x2dd7('0x6f')](function(_0x4d5e24){_0x4d5e24[_0x2dd7('0x70')]=_[_0x2dd7('0x55')](_0x1c9282,{'id':_0x31ac97['id']})[_0x2dd7('0x70')];});return _0x31ac97['Agents'];});return db[_0x2dd7('0x36')][_0x2dd7('0x55')]({'where':{'id':_0x1b566b[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](function(_0x58a0ed){return db[_0x2dd7('0x71')][_0x2dd7('0x72')](function(_0x5d6d74){return _0x58a0ed[_0x2dd7('0x6c')](_0x57aed0,{'transaction':_0x5d6d74})[_0x2dd7('0x25')](function(){return BPromise['each'](_0xe54762,function(_0x15b4b8){return db[_0x2dd7('0x73')][_0x2dd7('0x74')]({'where':{'UserId':_0x15b4b8['id'],'VoiceQueueId':_0x1b566b[_0x2dd7('0x5a')]['id']},'defaults':{'penalty':_0x15b4b8[_0x2dd7('0x70')]},'transaction':_0x5d6d74});});})['then'](function(){return BPromise['each'](_[_0x2dd7('0x2b')](_0xe54762,{'online':!![]}),function(_0x5cd811){return db['UserVoiceQueueRt'][_0x2dd7('0x75')]({'membername':_0x5cd811['name'],'UserId':_0x5cd811['id'],'queue_name':_0x58a0ed[_0x2dd7('0x31')],'VoiceQueueId':_0x58a0ed['id'],'interface':_[_0x2dd7('0x76')](_0x5cd811[_0x2dd7('0x77')])?util[_0x2dd7('0x78')](_0x2dd7('0x79'),_0x5cd811['name']):_0x5cd811[_0x2dd7('0x77')],'paused':_0x5cd811[_0x2dd7('0x7a')]||![],'penalty':_0x5cd811['penalty']},{'transaction':_0x5d6d74});});})[_0x2dd7('0x25')](function(){_0xe54762[_0x2dd7('0x6f')](function(_0x40f3bd){socket['emit'](_0x2dd7('0x7b'),{'UserId':_0x40f3bd['id'],'VoiceQueueId':_0x58a0ed['id']});});});});});}})['then'](respondWithStatusCode(_0xda281a,null))[_0x2dd7('0x4a')](handleError(_0xda281a,null));};exports[_0x2dd7('0x7c')]=function(_0x103417,_0x34b1d9,_0xe7ef93){return db[_0x2dd7('0x7d')][_0x2dd7('0x49')]({'where':{'id':_0x103417[_0x2dd7('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2dd7('0x6e')],'as':_0x2dd7('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x2dd7('0x25')](handleEntityNotFound(_0x34b1d9,null))['then'](function(_0x582146){var _0x35f45d=_[_0x2dd7('0x2d')](_0x582146,'id');var _0x5e91ce=[];var _0x1ce5b9=[];var _0x400d94=squel['select']();_0x400d94[_0x2dd7('0x7f')](_0x2dd7('0x80'))[_0x2dd7('0x81')](_0x2dd7('0x82'),'tq')[_0x2dd7('0x83')](_0x2dd7('0x84'),'ut',_0x2dd7('0x85'))[_0x2dd7('0x44')](_0x2dd7('0x86'),_0x103417[_0x2dd7('0x5a')]['id']);for(var _0x135ec5=0x0;_0x135ec5<_0x582146[_0x2dd7('0x41')];_0x135ec5+=0x1){let _0x455411=_0x582146[_0x135ec5];for(var _0x3cffa1=0x0;_0x3cffa1<_0x455411['Agents'][_0x2dd7('0x41')];_0x3cffa1+=0x1){let _0x863180=_0x455411['Agents'][_0x3cffa1];var _0x11651e=_0x400d94['clone']();_0x11651e['where'](_0x2dd7('0x87'),_0x863180['id']);_0x1ce5b9[_0x2dd7('0x88')](db['sequelize']['query'](_0x11651e[_0x2dd7('0x89')](),{'type':db[_0x2dd7('0x71')][_0x2dd7('0x8a')]['SELECT']})[_0x2dd7('0x25')](function(_0xe24fc6){if(_0xe24fc6[_0x2dd7('0x41')]===0x1){return _0x863180['id'];}else{var _0x3d7516=_[_0x2dd7('0x8b')](_[_0x2dd7('0x2d')](_0xe24fc6,_0x2dd7('0x8c')),function(_0x4afbd7){return _[_0x2dd7('0x2f')](_0x35f45d,_0x4afbd7);});if(_0x3d7516){return _0x863180['id'];}}}));}}return BPromise[_0x2dd7('0x8d')](_0x1ce5b9)['then'](function(_0x57e4ce){_0x5e91ce=_(_0x5e91ce)[_0x2dd7('0x8e')](_0x57e4ce)['compact']()[_0x2dd7('0x2e')]();return db[_0x2dd7('0x36')]['find']({'where':{'id':_0x103417[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](function(_0x40ff04){return db[_0x2dd7('0x71')][_0x2dd7('0x72')](function(_0x4333f8){return _0x40ff04[_0x2dd7('0x7c')](_0x103417['query']['ids'],{'transaction':_0x4333f8})[_0x2dd7('0x25')](function(){if(!_[_0x2dd7('0x8f')](_0x5e91ce)){return _0x40ff04[_0x2dd7('0x90')](_0x5e91ce,{'transaction':_0x4333f8})['then'](function(){return db[_0x2dd7('0x91')][_0x2dd7('0x26')]({'where':{'VoiceQueueId':_0x103417[_0x2dd7('0x5a')]['id'],'UserId':_0x5e91ce},'transaction':_0x4333f8});});}})[_0x2dd7('0x25')](function(){_0x5e91ce[_0x2dd7('0x6f')](function(_0x38e564){socket[_0x2dd7('0x92')](_0x2dd7('0x93'),{'UserId':_0x38e564,'VoiceQueueId':_0x40ff04['id']});});});});});});})['then'](respondWithStatusCode(_0x34b1d9,null))[_0x2dd7('0x4a')](handleError(_0x34b1d9,null));};exports[_0x2dd7('0x94')]=function(_0x3f553c,_0x588ca5,_0x4726a8){var _0x4127ee,_0x382796;return db[_0x2dd7('0x36')][_0x2dd7('0x55')]({'where':{'id':_0x3f553c['params']['id']}})['then'](handleEntityNotFound(_0x588ca5,null))[_0x2dd7('0x25')](function(_0x17a19d){if(_0x17a19d){_0x382796=_0x17a19d;return _0x17a19d['addAgents'](_0x3f553c[_0x2dd7('0x50')][_0x2dd7('0x95')],_[_0x2dd7('0x5c')](_0x3f553c[_0x2dd7('0x50')],['ids','id'])||{})[_0x2dd7('0x96')](function(_0x3a5775){for(var _0x2d4414=0x0;_0x2d4414<_0x3f553c[_0x2dd7('0x50')]['ids'][_0x2dd7('0x41')];_0x2d4414+=0x1){socket[_0x2dd7('0x92')](_0x2dd7('0x7b'),{'UserId':_0x3f553c['body'][_0x2dd7('0x95')][_0x2d4414],'VoiceQueueId':_0x3f553c[_0x2dd7('0x5a')]['id']});}return _0x3a5775;});}})[_0x2dd7('0x25')](function(_0x577f45){_0x4127ee=_0x577f45||[];if(_0x382796){return db[_0x2dd7('0x6e')][_0x2dd7('0x49')]({'where':{'id':_0x3f553c[_0x2dd7('0x50')][_0x2dd7('0x95')]},'attributes':['id',_0x2dd7('0x31'),_0x2dd7('0x97'),_0x2dd7('0x7a'),_0x2dd7('0x77')],'raw':!![]});}})[_0x2dd7('0x25')](function(_0x2c4c82){if(!_[_0x2dd7('0x8f')](_0x2c4c82)){var _0x2c3b65=[];for(var _0x1c8ddd=0x0;_0x1c8ddd<_0x2c4c82[_0x2dd7('0x41')];_0x1c8ddd++){if(_0x2c4c82[_0x1c8ddd]['online']){_0x2c3b65[_0x2dd7('0x88')](db[_0x2dd7('0x91')]['upsert']({'membername':_0x2c4c82[_0x1c8ddd][_0x2dd7('0x31')],'UserId':_0x2c4c82[_0x1c8ddd]['id'],'queue_name':_0x382796[_0x2dd7('0x31')],'VoiceQueueId':_0x382796['id'],'interface':_[_0x2dd7('0x76')](_0x2c4c82[_0x1c8ddd][_0x2dd7('0x77')])?util['format'](_0x2dd7('0x79'),_0x2c4c82[_0x1c8ddd][_0x2dd7('0x31')]):_0x2c4c82[_0x1c8ddd]['interface'],'paused':_0x2c4c82[_0x1c8ddd]['voicePause']||![],'penalty':_0x3f553c[_0x2dd7('0x50')]['penalty']||0x0}));}}return BPromise['all'](_0x2c3b65);}})[_0x2dd7('0x25')](function(){return _0x4127ee;})[_0x2dd7('0x25')](respondWithResult(_0x588ca5,null))[_0x2dd7('0x4a')](handleError(_0x588ca5,null));};exports[_0x2dd7('0x90')]=function(_0xbc5b42,_0x21af8d,_0x5c76c7){return db[_0x2dd7('0x36')][_0x2dd7('0x55')]({'where':{'id':_0xbc5b42[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x21af8d,null))[_0x2dd7('0x25')](function(_0x4ad38f){if(_0x4ad38f){return _0x4ad38f['removeAgents'](_0xbc5b42[_0x2dd7('0x3b')][_0x2dd7('0x95')])['then'](function(){if(_[_0x2dd7('0x98')](_0xbc5b42['query'][_0x2dd7('0x95')])){for(var _0x2e0deb=0x0;_0x2e0deb<_0xbc5b42[_0x2dd7('0x3b')][_0x2dd7('0x95')][_0x2dd7('0x41')];_0x2e0deb+=0x1){socket[_0x2dd7('0x92')](_0x2dd7('0x93'),{'UserId':Number(_0xbc5b42[_0x2dd7('0x3b')][_0x2dd7('0x95')][_0x2e0deb]),'VoiceQueueId':Number(_0xbc5b42[_0x2dd7('0x5a')]['id'])});}}else{socket[_0x2dd7('0x92')](_0x2dd7('0x93'),{'UserId':Number(_0xbc5b42[_0x2dd7('0x3b')][_0x2dd7('0x95')]),'VoiceQueueId':Number(_0xbc5b42[_0x2dd7('0x5a')]['id'])});}});}})[_0x2dd7('0x25')](function(_0xa06ff7){return db[_0x2dd7('0x91')][_0x2dd7('0x26')]({'where':{'VoiceQueueId':_0xbc5b42[_0x2dd7('0x5a')]['id'],'UserId':_0xbc5b42[_0x2dd7('0x3b')][_0x2dd7('0x95')]}})[_0x2dd7('0x25')](function(){return _0xa06ff7;});})[_0x2dd7('0x25')](respondWithStatusCode(_0x21af8d,null))[_0x2dd7('0x4a')](handleError(_0x21af8d,null));};exports['getAgents']=function(_0x53d505,_0x19ef6c,_0x153d73){var _0xb8a83e={};var _0x5e2814={};var _0x261462;var _0x8580be;return db['VoiceQueue'][_0x2dd7('0x64')]({'where':{'id':_0x53d505[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x19ef6c,null))[_0x2dd7('0x25')](function(_0x303490){if(_0x303490){_0x261462=_0x303490;_0x5e2814[_0x2dd7('0x3a')]=_[_0x2dd7('0x3c')](db[_0x2dd7('0x6e')][_0x2dd7('0x37')]);_0x5e2814['query']=_[_0x2dd7('0x3c')](_0x53d505[_0x2dd7('0x3b')]);_0x5e2814[_0x2dd7('0x3d')]=_[_0x2dd7('0x3e')](_0x5e2814['model'],_0x5e2814[_0x2dd7('0x3b')]);_0xb8a83e['attributes']=_[_0x2dd7('0x3e')](_0x5e2814[_0x2dd7('0x3a')],qs['fields'](_0x53d505[_0x2dd7('0x3b')][_0x2dd7('0x40')]));_0xb8a83e[_0x2dd7('0x3f')]=_0xb8a83e[_0x2dd7('0x3f')]['length']?_0xb8a83e[_0x2dd7('0x3f')]:_0x5e2814[_0x2dd7('0x3a')];_0xb8a83e[_0x2dd7('0x60')]=qs[_0x2dd7('0x43')](_0x53d505[_0x2dd7('0x3b')][_0x2dd7('0x43')]);_0xb8a83e[_0x2dd7('0x44')]=qs['filters'](_[_0x2dd7('0x45')](_0x53d505[_0x2dd7('0x3b')],_0x5e2814['filters']));if(_0x53d505[_0x2dd7('0x3b')][_0x2dd7('0x2b')]){_0xb8a83e[_0x2dd7('0x44')]=_[_0x2dd7('0x4d')](_0xb8a83e[_0x2dd7('0x44')],{'$or':_['map'](_0xb8a83e[_0x2dd7('0x3f')],function(_0x5893bc){var _0x3a3305={};_0x3a3305[_0x5893bc]={'$like':'%'+_0x53d505['query'][_0x2dd7('0x2b')]+'%'};return _0x3a3305;})});}_0xb8a83e=_[_0x2dd7('0x4d')]({},_0xb8a83e,_0x53d505[_0x2dd7('0x4e')]);return _0x261462['getAgents'](_0xb8a83e);}})['then'](function(_0x5b5859){if(_0x5b5859){_0x8580be=_0x5b5859[_0x2dd7('0x41')];if(!_0x53d505[_0x2dd7('0x3b')][_0x2dd7('0x66')](_0x2dd7('0x42'))){_0xb8a83e[_0x2dd7('0x1f')]=qs[_0x2dd7('0x1f')](_0x53d505[_0x2dd7('0x3b')][_0x2dd7('0x1f')]);_0xb8a83e[_0x2dd7('0x1e')]=qs[_0x2dd7('0x1e')](_0x53d505['query'][_0x2dd7('0x1e')]);}return _0x261462[_0x2dd7('0x99')](_0xb8a83e);}})[_0x2dd7('0x25')](function(_0x502fdd){if(_0x502fdd){return _0x502fdd?{'count':_0x8580be,'rows':_0x502fdd}:null;}})[_0x2dd7('0x25')](respondWithResult(_0x19ef6c,null))[_0x2dd7('0x4a')](handleError(_0x19ef6c,null));};exports[_0x2dd7('0x9a')]=function(_0x104c9a,_0x20cbe8,_0xb8f919){var _0x270088={};var _0x9d3456={};var _0x30d55b;var _0x1250d3;return db[_0x2dd7('0x36')][_0x2dd7('0x64')]({'where':{'id':_0x104c9a[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x20cbe8,null))[_0x2dd7('0x25')](function(_0x568e5c){if(_0x568e5c){_0x30d55b=_0x568e5c;_0x9d3456[_0x2dd7('0x3a')]=_[_0x2dd7('0x3c')](db[_0x2dd7('0x91')][_0x2dd7('0x37')]);_0x9d3456[_0x2dd7('0x3b')]=_['keys'](_0x104c9a['query']);_0x9d3456[_0x2dd7('0x3d')]=_[_0x2dd7('0x3e')](_0x9d3456['model'],_0x9d3456[_0x2dd7('0x3b')]);_0x270088[_0x2dd7('0x3f')]=_[_0x2dd7('0x3e')](_0x9d3456['model'],qs[_0x2dd7('0x40')](_0x104c9a[_0x2dd7('0x3b')][_0x2dd7('0x40')]));_0x270088[_0x2dd7('0x3f')]=_0x270088['attributes'][_0x2dd7('0x41')]?_0x270088[_0x2dd7('0x3f')]:_0x9d3456[_0x2dd7('0x3a')];_0x270088['order']=qs['sort'](_0x104c9a[_0x2dd7('0x3b')]['sort']);_0x270088[_0x2dd7('0x44')]=qs[_0x2dd7('0x3d')](_[_0x2dd7('0x45')](_0x104c9a['query'],_0x9d3456[_0x2dd7('0x3d')]));if(_0x104c9a['query'][_0x2dd7('0x2b')]){_0x270088['where']=_[_0x2dd7('0x4d')](_0x270088['where'],{'$or':_[_0x2dd7('0x2d')](_0x270088['attributes'],function(_0x3c4a71){var _0x5d342b={};_0x5d342b[_0x3c4a71]={'$like':'%'+_0x104c9a[_0x2dd7('0x3b')][_0x2dd7('0x2b')]+'%'};return _0x5d342b;})});}_0x270088=_[_0x2dd7('0x4d')]({},_0x270088,_0x104c9a[_0x2dd7('0x4e')]);return _0x30d55b['getMembers'](_0x270088);}})[_0x2dd7('0x25')](function(_0x56ff17){if(_0x56ff17){_0x1250d3=_0x56ff17[_0x2dd7('0x41')];if(!_0x104c9a[_0x2dd7('0x3b')][_0x2dd7('0x66')](_0x2dd7('0x42'))){_0x270088[_0x2dd7('0x1f')]=qs[_0x2dd7('0x1f')](_0x104c9a[_0x2dd7('0x3b')][_0x2dd7('0x1f')]);_0x270088[_0x2dd7('0x1e')]=qs[_0x2dd7('0x1e')](_0x104c9a[_0x2dd7('0x3b')]['offset']);}return _0x30d55b[_0x2dd7('0x9a')](_0x270088);}})[_0x2dd7('0x25')](function(_0x20ed6e){return _0x20ed6e?{'count':_0x1250d3,'rows':_0x20ed6e}:null;})[_0x2dd7('0x25')](respondWithResult(_0x20cbe8,null))[_0x2dd7('0x4a')](handleError(_0x20cbe8,null));};exports[_0x2dd7('0x9b')]=function(_0x1e2db2,_0x28e635,_0x291a09){var _0x3e4e1f={};var _0x30343d={};var _0x23ff18;var _0x4ea1ce;return db[_0x2dd7('0x36')][_0x2dd7('0x64')]({'where':{'id':_0x1e2db2[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x28e635,null))[_0x2dd7('0x25')](function(_0x2b410b){if(_0x2b410b){_0x23ff18=_0x2b410b;_0x30343d[_0x2dd7('0x3a')]=_[_0x2dd7('0x3c')](db[_0x2dd7('0x9c')][_0x2dd7('0x37')]);_0x30343d[_0x2dd7('0x3b')]=_[_0x2dd7('0x3c')](_0x1e2db2[_0x2dd7('0x3b')]);_0x30343d[_0x2dd7('0x3d')]=_[_0x2dd7('0x3e')](_0x30343d[_0x2dd7('0x3a')],_0x30343d[_0x2dd7('0x3b')]);_0x3e4e1f[_0x2dd7('0x3f')]=_['intersection'](_0x30343d[_0x2dd7('0x3a')],qs[_0x2dd7('0x40')](_0x1e2db2['query'][_0x2dd7('0x40')]));_0x3e4e1f[_0x2dd7('0x3f')]=_0x3e4e1f[_0x2dd7('0x3f')][_0x2dd7('0x41')]?_0x3e4e1f['attributes']:_0x30343d[_0x2dd7('0x3a')];_0x3e4e1f[_0x2dd7('0x60')]=qs[_0x2dd7('0x43')](_0x1e2db2[_0x2dd7('0x3b')][_0x2dd7('0x43')]);_0x3e4e1f[_0x2dd7('0x44')]=qs[_0x2dd7('0x3d')](_['pick'](_0x1e2db2[_0x2dd7('0x3b')],_0x30343d[_0x2dd7('0x3d')]));if(_0x1e2db2[_0x2dd7('0x3b')][_0x2dd7('0x2b')]){_0x3e4e1f[_0x2dd7('0x44')]=_['merge'](_0x3e4e1f['where'],{'$or':_['map'](_0x3e4e1f[_0x2dd7('0x3f')],function(_0x5ad03e){var _0x30100f={};_0x30100f[_0x5ad03e]={'$like':'%'+_0x1e2db2[_0x2dd7('0x3b')]['filter']+'%'};return _0x30100f;})});}_0x3e4e1f=_[_0x2dd7('0x4d')]({},_0x3e4e1f,_0x1e2db2[_0x2dd7('0x4e')]);return _0x23ff18[_0x2dd7('0x9b')](_0x3e4e1f);}})[_0x2dd7('0x25')](function(_0x50e991){if(_0x50e991){_0x4ea1ce=_0x50e991[_0x2dd7('0x41')];if(!_0x1e2db2['query'][_0x2dd7('0x66')](_0x2dd7('0x42'))){_0x3e4e1f[_0x2dd7('0x1f')]=qs['limit'](_0x1e2db2[_0x2dd7('0x3b')][_0x2dd7('0x1f')]);_0x3e4e1f['offset']=qs[_0x2dd7('0x1e')](_0x1e2db2[_0x2dd7('0x3b')][_0x2dd7('0x1e')]);}return _0x23ff18[_0x2dd7('0x9b')](_0x3e4e1f);}})[_0x2dd7('0x25')](function(_0x235114){if(_0x235114){return _0x235114?{'count':_0x4ea1ce,'rows':_0x235114}:null;}})['then'](respondWithResult(_0x28e635,null))[_0x2dd7('0x4a')](handleError(_0x28e635,null));};exports[_0x2dd7('0x9d')]=function(_0x22ccc8,_0x10ff12,_0x550002){var _0x353fa9,_0x221229;return db[_0x2dd7('0x36')]['find']({'where':{'id':_0x22ccc8[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x10ff12,null))['then'](function(_0x4731dd){if(_0x4731dd){_0x221229=_0x4731dd;return _0x4731dd[_0x2dd7('0x9d')](_0x22ccc8[_0x2dd7('0x50')][_0x2dd7('0x95')],_[_0x2dd7('0x5c')](_0x22ccc8[_0x2dd7('0x50')],['ids','id'])||{});}return null;})[_0x2dd7('0x96')](function(_0x37f5ea){var _0x466220;_0x353fa9=_0x37f5ea||[];var _0x281982=[];if(_0x37f5ea){for(var _0xbf7615=0x0;_0xbf7615<_0x37f5ea[_0x2dd7('0x41')];_0xbf7615+=0x1){var _0x35c39a=_0x37f5ea[_0xbf7615][_0x2dd7('0x27')]({'plain':!![]});_0x221229[_0x2dd7('0x9e')]=_0x22ccc8[_0x2dd7('0x50')][_0x2dd7('0x9e')]?_0x22ccc8[_0x2dd7('0x50')][_0x2dd7('0x9e')]:_0x221229[_0x2dd7('0x9e')];switch(_0x221229[_0x2dd7('0x9e')]){case _0x2dd7('0x9f'):_0x466220=squel[_0x2dd7('0xa0')]()[_0x2dd7('0xa1')](_0x2dd7('0xa2'))[_0x2dd7('0xa3')](['phone',_0x2dd7('0xa4'),_0x2dd7('0xa5'),_0x2dd7('0xa6'),_0x2dd7('0x61'),'createdAt','updatedAt'],squel[_0x2dd7('0xa7')]()[_0x2dd7('0x7f')]('phone',_0x2dd7('0xa8'))[_0x2dd7('0x7f')](_0x2dd7('0xa9'),_0x2dd7('0xa4'))[_0x2dd7('0x7f')]('id',_0x2dd7('0xa5'))['field'](_0x35c39a['CmListId'][_0x2dd7('0x89')](),_0x2dd7('0xa6'))[_0x2dd7('0x7f')](_0x22ccc8[_0x2dd7('0x5a')]['id'][_0x2dd7('0x89')](),_0x2dd7('0x61'))[_0x2dd7('0x7f')](_0x2dd7('0xa9'),'createdAt')['field'](_0x2dd7('0xa9'),'updatedAt')[_0x2dd7('0x81')](_0x2dd7('0xaa'))[_0x2dd7('0x44')](_0x2dd7('0xab'))[_0x2dd7('0x44')](_0x2dd7('0xac'),_0x35c39a['CmListId']['toString']())['where'](_0x2dd7('0xad'))[_0x2dd7('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2dd7('0xa7')]()[_0x2dd7('0x7f')]('COALESCE(calleridnum,\x27\x27)')[_0x2dd7('0x81')](_0x2dd7('0xae'))[_0x2dd7('0x44')](_0x2dd7('0x86'),_0x22ccc8[_0x2dd7('0x5a')]['id'][_0x2dd7('0x89')]()))[_0x2dd7('0x44')](_0x2dd7('0xaf'),squel[_0x2dd7('0xa7')]()[_0x2dd7('0x7f')](_0x2dd7('0xb0'))['from']('cm_hopper')[_0x2dd7('0x44')](_0x2dd7('0x86'),_0x22ccc8[_0x2dd7('0x5a')]['id'][_0x2dd7('0x89')]())))[_0x2dd7('0x89')]();break;case _0x2dd7('0xb1'):_0x466220=squel['insert']()[_0x2dd7('0xa1')](_0x2dd7('0xa2'))[_0x2dd7('0xa3')](['phone',_0x2dd7('0xa4'),_0x2dd7('0xa5'),'ListId','VoiceQueueId',_0x2dd7('0x5b'),_0x2dd7('0xb2')],squel[_0x2dd7('0xa7')]()['field'](_0x2dd7('0xa8'),_0x2dd7('0xa8'))[_0x2dd7('0x7f')](_0x2dd7('0xa9'),_0x2dd7('0xa4'))[_0x2dd7('0x7f')]('id',_0x2dd7('0xa5'))[_0x2dd7('0x7f')](_0x35c39a[_0x2dd7('0xb3')]['toString'](),'ListId')[_0x2dd7('0x7f')](_0x22ccc8[_0x2dd7('0x5a')]['id'][_0x2dd7('0x89')](),_0x2dd7('0x61'))[_0x2dd7('0x7f')](_0x2dd7('0xa9'),_0x2dd7('0x5b'))[_0x2dd7('0x7f')](_0x2dd7('0xa9'),_0x2dd7('0xb2'))[_0x2dd7('0x81')](_0x2dd7('0xaa'))['where'](_0x2dd7('0xab'))[_0x2dd7('0x44')](_0x2dd7('0xac'),_0x35c39a['CmListId']['toString']())[_0x2dd7('0x44')](_0x2dd7('0xad'))[_0x2dd7('0x44')](_0x2dd7('0xaf'),squel['select']()[_0x2dd7('0x7f')](_0x2dd7('0xb0'))[_0x2dd7('0x81')](_0x2dd7('0xa2'))['where'](_0x2dd7('0x86'),_0x22ccc8[_0x2dd7('0x5a')]['id'][_0x2dd7('0x89')]())))['toString']();break;default:_0x466220=squel[_0x2dd7('0xa0')]()[_0x2dd7('0xa1')]('cm_hopper')[_0x2dd7('0xa3')](['phone',_0x2dd7('0xa4'),_0x2dd7('0xa5'),_0x2dd7('0xa6'),_0x2dd7('0x61'),_0x2dd7('0x5b'),_0x2dd7('0xb2')],squel[_0x2dd7('0xa7')]()['field']('phone',_0x2dd7('0xa8'))[_0x2dd7('0x7f')](_0x2dd7('0xa9'),_0x2dd7('0xa4'))[_0x2dd7('0x7f')]('id',_0x2dd7('0xa5'))[_0x2dd7('0x7f')](_0x35c39a[_0x2dd7('0xb3')][_0x2dd7('0x89')](),_0x2dd7('0xa6'))[_0x2dd7('0x7f')](_0x22ccc8[_0x2dd7('0x5a')]['id'][_0x2dd7('0x89')](),_0x2dd7('0x61'))[_0x2dd7('0x7f')](_0x2dd7('0xa9'),_0x2dd7('0x5b'))['field']('NOW()',_0x2dd7('0xb2'))['from'](_0x2dd7('0xaa'))[_0x2dd7('0x44')]('deletedAt\x20IS\x20NULL')[_0x2dd7('0x44')](_0x2dd7('0xac'),_0x35c39a[_0x2dd7('0xb3')]['toString']())['where'](_0x2dd7('0xad')))[_0x2dd7('0x89')]();}_0x281982[_0x2dd7('0x88')](db[_0x2dd7('0x71')][_0x2dd7('0x3b')](_0x466220));}return BPromise[_0x2dd7('0x8d')](_0x281982);}})[_0x2dd7('0x25')](function(){return _0x353fa9;})[_0x2dd7('0x25')](respondWithResult(_0x10ff12,null))['catch'](handleError(_0x10ff12,null));};exports[_0x2dd7('0xb4')]=function(_0x103595,_0x21d662,_0x3c04a1){return db['VoiceQueue'][_0x2dd7('0x55')]({'where':{'id':_0x103595[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x21d662,null))[_0x2dd7('0x25')](function(_0x3fd027){if(_0x3fd027){return _0x3fd027[_0x2dd7('0xb4')](_0x103595[_0x2dd7('0x3b')]['ids']);}})['then'](function(_0x263faa){if(_0x263faa){return db[_0x2dd7('0x5f')][_0x2dd7('0x26')]({'where':{'ListId':_0x103595['query'][_0x2dd7('0x95')],'VoiceQueueId':_0x103595[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](function(){return _0x263faa;});}})[_0x2dd7('0x25')](respondWithStatusCode(_0x21d662,null))['catch'](handleError(_0x21d662,null));};exports[_0x2dd7('0xb5')]=function(_0x31a10c,_0xe45e38,_0x791dcf){var _0x5b091a={};var _0xae6ec={};var _0xe91c5e;var _0x24e6b3;return db[_0x2dd7('0x36')][_0x2dd7('0x64')]({'where':{'id':_0x31a10c[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0xe45e38,null))[_0x2dd7('0x25')](function(_0x25832b){if(_0x25832b){_0xe91c5e=_0x25832b;_0xae6ec[_0x2dd7('0x3a')]=_[_0x2dd7('0x3c')](db['CmList'][_0x2dd7('0x37')]);_0xae6ec['query']=_[_0x2dd7('0x3c')](_0x31a10c[_0x2dd7('0x3b')]);_0xae6ec[_0x2dd7('0x3d')]=_[_0x2dd7('0x3e')](_0xae6ec[_0x2dd7('0x3a')],_0xae6ec[_0x2dd7('0x3b')]);_0x5b091a[_0x2dd7('0x3f')]=_['intersection'](_0xae6ec[_0x2dd7('0x3a')],qs['fields'](_0x31a10c[_0x2dd7('0x3b')][_0x2dd7('0x40')]));_0x5b091a['attributes']=_0x5b091a[_0x2dd7('0x3f')]['length']?_0x5b091a['attributes']:_0xae6ec[_0x2dd7('0x3a')];_0x5b091a[_0x2dd7('0x60')]=qs[_0x2dd7('0x43')](_0x31a10c['query']['sort']);_0x5b091a['where']=qs[_0x2dd7('0x3d')](_['pick'](_0x31a10c[_0x2dd7('0x3b')],_0xae6ec[_0x2dd7('0x3d')]));if(_0x31a10c[_0x2dd7('0x3b')][_0x2dd7('0x2b')]){_0x5b091a[_0x2dd7('0x44')]=_[_0x2dd7('0x4d')](_0x5b091a[_0x2dd7('0x44')],{'$or':_[_0x2dd7('0x2d')](_0x5b091a[_0x2dd7('0x3f')],function(_0x3e49de){var _0x2cc13f={};_0x2cc13f[_0x3e49de]={'$like':'%'+_0x31a10c['query'][_0x2dd7('0x2b')]+'%'};return _0x2cc13f;})});}_0x5b091a=_['merge']({},_0x5b091a,_0x31a10c[_0x2dd7('0x4e')]);return _0xe91c5e['getBlackLists'](_0x5b091a);}})['then'](function(_0x55e95f){if(_0x55e95f){_0x24e6b3=_0x55e95f['length'];if(!_0x31a10c['query']['hasOwnProperty'](_0x2dd7('0x42'))){_0x5b091a[_0x2dd7('0x1f')]=qs['limit'](_0x31a10c[_0x2dd7('0x3b')]['limit']);_0x5b091a[_0x2dd7('0x1e')]=qs[_0x2dd7('0x1e')](_0x31a10c[_0x2dd7('0x3b')]['offset']);}return _0xe91c5e[_0x2dd7('0xb5')](_0x5b091a);}})['then'](function(_0x24cb7e){if(_0x24cb7e){return _0x24cb7e?{'count':_0x24e6b3,'rows':_0x24cb7e}:null;}})[_0x2dd7('0x25')](respondWithResult(_0xe45e38,null))['catch'](handleError(_0xe45e38,null));};exports[_0x2dd7('0xb6')]=function(_0x327bee,_0x1873be,_0x18d696){var _0x1fad39,_0xc2360d;return db[_0x2dd7('0x36')]['find']({'where':{'id':_0x327bee['params']['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x1873be,null))[_0x2dd7('0x25')](function(_0x38e3b0){if(_0x38e3b0){_0xc2360d=_0x38e3b0;return _0x38e3b0[_0x2dd7('0xb6')](_0x327bee[_0x2dd7('0x50')][_0x2dd7('0x95')],_[_0x2dd7('0x5c')](_0x327bee[_0x2dd7('0x50')],[_0x2dd7('0x95'),'id'])||{});}return null;})['spread'](function(_0x32e023){var _0x47289e;_0x1fad39=_0x32e023||[];var _0x5bb00a=[];if(_0x32e023){for(var _0x1a2e10=0x0;_0x1a2e10<_0x32e023[_0x2dd7('0x41')];_0x1a2e10+=0x1){var _0x48d00d=_0x32e023[_0x1a2e10][_0x2dd7('0x27')]({'plain':!![]});_0x47289e=squel['insert']()['into'](_0x2dd7('0xb7'))[_0x2dd7('0xa3')](['phone',_0x2dd7('0xa5'),_0x2dd7('0xa6'),'VoiceQueueId',_0x2dd7('0x5b'),'updatedAt'],squel[_0x2dd7('0xa7')]()['field'](_0x2dd7('0xa8'),_0x2dd7('0xa8'))[_0x2dd7('0x7f')]('id','ContactId')[_0x2dd7('0x7f')](_0x48d00d['CmListId'][_0x2dd7('0x89')](),_0x2dd7('0xa6'))['field'](_0x327bee[_0x2dd7('0x5a')]['id'][_0x2dd7('0x89')](),'VoiceQueueId')[_0x2dd7('0x7f')]('NOW()','createdAt')['field'](_0x2dd7('0xa9'),'updatedAt')[_0x2dd7('0x81')](_0x2dd7('0xaa'))['where'](_0x2dd7('0xab'))[_0x2dd7('0x44')](_0x2dd7('0xac'),_0x48d00d['CmListId'][_0x2dd7('0x89')]())[_0x2dd7('0x44')](_0x2dd7('0xad')))[_0x2dd7('0x89')]();_0x5bb00a[_0x2dd7('0x88')](db[_0x2dd7('0x71')][_0x2dd7('0x3b')](_0x47289e));}return BPromise[_0x2dd7('0x8d')](_0x5bb00a);}})['then'](function(){return _0x1fad39;})[_0x2dd7('0x25')](respondWithResult(_0x1873be,null))['catch'](handleError(_0x1873be,null));};exports[_0x2dd7('0xb8')]=function(_0x38de8a,_0x33314f,_0xf81657){return db[_0x2dd7('0x36')][_0x2dd7('0x55')]({'where':{'id':_0x38de8a['params']['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x33314f,null))['then'](function(_0x2c5d8d){if(_0x2c5d8d){return _0x2c5d8d[_0x2dd7('0xb8')](_0x38de8a[_0x2dd7('0x3b')][_0x2dd7('0x95')]);}})['then'](function(_0x2e79de){if(_0x2e79de){return db[_0x2dd7('0x6a')]['destroy']({'where':{'ListId':_0x38de8a['query'][_0x2dd7('0x95')],'VoiceQueueId':_0x38de8a[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](function(){return _0x2e79de;});}})['then'](respondWithStatusCode(_0x33314f,null))[_0x2dd7('0x4a')](handleError(_0x33314f,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index c3b1b8a..9259f39 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 _0x1b27=['save','update','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0x1b27,0xd7));var _0x71b2=function(_0x25f04b,_0x43c5ef){_0x25f04b=_0x25f04b-0x0;var _0xe12b1c=_0x1b27[_0x25f04b];return _0xe12b1c;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x71b2('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x71b2('0x1')](0x0);var events={'afterCreate':_0x71b2('0x2'),'afterUpdate':_0x71b2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x112d29){return function(_0x30e637,_0x5511c9,_0x202834){VoiceQueueEvents[_0x71b2('0x4')](_0x112d29+':'+_0x30e637['id'],_0x30e637);VoiceQueueEvents['emit'](_0x112d29,_0x30e637);_0x202834(null);};}for(var e in events){if(events[_0x71b2('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x71b2('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x248f=['emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','save','update','remove'];(function(_0x19a08d,_0x41aa77){var _0x2485ed=function(_0x50472b){while(--_0x50472b){_0x19a08d['push'](_0x19a08d['shift']());}};_0x2485ed(++_0x41aa77);}(_0x248f,0x108));var _0xf248=function(_0xce7dc4,_0x13498e){_0xce7dc4=_0xce7dc4-0x0;var _0x31f02f=_0x248f[_0xce7dc4];return _0x31f02f;};'use strict';var EventEmitter=require(_0xf248('0x0'));var VoiceQueue=require(_0xf248('0x1'))['db'][_0xf248('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf248('0x3'),'afterUpdate':_0xf248('0x4'),'afterDestroy':_0xf248('0x5')};function emitEvent(_0x4589ab){return function(_0x538aa3,_0x2c3b4b,_0x4bd663){VoiceQueueEvents[_0xf248('0x6')](_0x4589ab+':'+_0x538aa3['id'],_0x538aa3);VoiceQueueEvents[_0xf248('0x6')](_0x4589ab,_0x538aa3);_0x4bd663(null);};}for(var e in events){if(events[_0xf248('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xf248('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 8201566..9677bf1 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 _0x2ef0=['util','api','bluebird','path','rimraf','../../config/environment','./voiceQueue.attributes','VoiceQueue','lodash'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x2ef0,0x116));var _0x02ef=function(_0x39fc20,_0x4aff5c){_0x39fc20=_0x39fc20-0x0;var _0x456bf0=_0x2ef0[_0x39fc20];return _0x456bf0;};'use strict';var _=require(_0x02ef('0x0'));var util=require(_0x02ef('0x1'));var logger=require('../../config/logger')(_0x02ef('0x2'));var moment=require('moment');var BPromise=require(_0x02ef('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x02ef('0x4'));var rimraf=require(_0x02ef('0x5'));var config=require(_0x02ef('0x6'));var attributes=require(_0x02ef('0x7'));module['exports']=function(_0x485cf1,_0x33e6cc){return _0x485cf1['define'](_0x02ef('0x8'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a98=['VoiceQueue','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes'];(function(_0x46251a,_0x39229d){var _0x5b0295=function(_0x3e9ea5){while(--_0x3e9ea5){_0x46251a['push'](_0x46251a['shift']());}};_0x5b0295(++_0x39229d);}(_0x0a98,0x1d7));var _0x80a9=function(_0x57fbc4,_0x5a219e){_0x57fbc4=_0x57fbc4-0x0;var _0x974300=_0x0a98[_0x57fbc4];return _0x974300;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x80a9('0x0'))(_0x80a9('0x1'));var moment=require(_0x80a9('0x2'));var BPromise=require(_0x80a9('0x3'));var rp=require(_0x80a9('0x4'));var fs=require('fs');var path=require(_0x80a9('0x5'));var rimraf=require(_0x80a9('0x6'));var config=require(_0x80a9('0x7'));var attributes=require(_0x80a9('0x8'));module['exports']=function(_0x5e8c7b,_0x54857c){return _0x5e8c7b['define'](_0x80a9('0x9'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index db85e66..5819af4 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 _0xe764=['stringify','error','message','catch','VoiceQueue','findAll','options','raw','attributes','limit','include','model','map','GetVoiceQueue','ShowVoiceQueue','find','where','debug','lodash','util','bluebird','randomstring','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x532402,_0x127c1d){var _0x5d35d9=function(_0xa5f80){while(--_0xa5f80){_0x532402['push'](_0x532402['shift']());}};_0x5d35d9(++_0x127c1d);}(_0xe764,0x9e));var _0x4e76=function(_0x134999,_0x4de0c9){_0x134999=_0x134999-0x0;var _0x46e471=_0xe764[_0x134999];return _0x46e471;};'use strict';var _=require(_0x4e76('0x0'));var util=require(_0x4e76('0x1'));var moment=require('moment');var BPromise=require(_0x4e76('0x2'));var rs=require(_0x4e76('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4e76('0x4'));var jayson=require(_0x4e76('0x5'));var client=jayson[_0x4e76('0x6')][_0x4e76('0x7')]({'port':0x232a});config[_0x4e76('0x8')]=_[_0x4e76('0x9')](config['redis'],{'host':_0x4e76('0xa'),'port':0x18eb});var socket=require(_0x4e76('0xb'))(new Redis(config['redis']));require(_0x4e76('0xc'))['register'](socket);function respondWithRpcPromise(_0x1e54e0,_0x2afab5,_0x4100ce){return new BPromise(function(_0x1f7cf6,_0x5404c1){return client['request'](_0x1e54e0,_0x4100ce)[_0x4e76('0xd')](function(_0x6c924e){logger[_0x4e76('0xe')](_0x4e76('0xf'),_0x2afab5,'request\x20sent');logger['debug'](_0x4e76('0x10'),_0x2afab5,'request\x20sent',JSON[_0x4e76('0x11')](_0x6c924e));if(_0x6c924e[_0x4e76('0x12')]){if(_0x6c924e['error']['code']===0x1f4){logger[_0x4e76('0x12')](_0x4e76('0xf'),_0x2afab5,_0x6c924e['error'][_0x4e76('0x13')]);return _0x5404c1(_0x6c924e['error']['message']);}logger['error'](_0x4e76('0xf'),_0x2afab5,_0x6c924e[_0x4e76('0x12')][_0x4e76('0x13')]);return _0x1f7cf6(_0x6c924e[_0x4e76('0x12')][_0x4e76('0x13')]);}else{logger[_0x4e76('0xe')](_0x4e76('0xf'),_0x2afab5,'request\x20sent');_0x1f7cf6(_0x6c924e['result'][_0x4e76('0x13')]);}})[_0x4e76('0x14')](function(_0x4e7a9d){logger[_0x4e76('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x2afab5,_0x4e7a9d);_0x5404c1(_0x4e7a9d);});});}exports['GetVoiceQueue']=function(_0x26b1b5){var _0x584b04=this;return new Promise(function(_0x2bdf72,_0x3e72ad){return db[_0x4e76('0x15')][_0x4e76('0x16')]({'raw':_0x26b1b5[_0x4e76('0x17')]?_0x26b1b5['options'][_0x4e76('0x18')]===undefined?!![]:![]:!![],'where':_0x26b1b5[_0x4e76('0x17')]?_0x26b1b5['options']['where']||null:null,'attributes':_0x26b1b5[_0x4e76('0x17')]?_0x26b1b5[_0x4e76('0x17')][_0x4e76('0x19')]||null:null,'limit':_0x26b1b5['options']?_0x26b1b5[_0x4e76('0x17')][_0x4e76('0x1a')]||null:null,'include':_0x26b1b5[_0x4e76('0x17')]?_0x26b1b5[_0x4e76('0x17')]['include']?_['map'](_0x26b1b5[_0x4e76('0x17')][_0x4e76('0x1b')],function(_0x12ca39){return{'model':db[_0x12ca39[_0x4e76('0x1c')]],'as':_0x12ca39['as'],'attributes':_0x12ca39[_0x4e76('0x19')],'include':_0x12ca39[_0x4e76('0x1b')]?_[_0x4e76('0x1d')](_0x12ca39[_0x4e76('0x1b')],function(_0x5bbeb7){return{'model':db[_0x5bbeb7[_0x4e76('0x1c')]],'as':_0x5bbeb7['as'],'attributes':_0x5bbeb7[_0x4e76('0x19')],'include':_0x5bbeb7[_0x4e76('0x1b')]?_['map'](_0x5bbeb7[_0x4e76('0x1b')],function(_0x58ba00){return{'model':db[_0x58ba00['model']],'as':_0x58ba00['as'],'attributes':_0x58ba00['attributes']};}):[]};}):[]};}):[]:[]})[_0x4e76('0xd')](function(_0x18d9ee){logger[_0x4e76('0xe')](_0x4e76('0x1e'),_0x26b1b5);logger['debug'](_0x4e76('0x1e'),_0x26b1b5,JSON[_0x4e76('0x11')](_0x18d9ee));_0x2bdf72(_0x18d9ee);})[_0x4e76('0x14')](function(_0x3e46b6){logger[_0x4e76('0x12')](_0x4e76('0x1e'),_0x3e46b6[_0x4e76('0x13')],_0x26b1b5);_0x3e72ad(_0x584b04[_0x4e76('0x12')](0x1f4,_0x3e46b6['message']));});});};exports[_0x4e76('0x1f')]=function(_0xd73f8e){var _0x4c25fc=this;return new Promise(function(_0x239085,_0x13436b){return db[_0x4e76('0x15')][_0x4e76('0x20')]({'raw':_0xd73f8e[_0x4e76('0x17')]?_0xd73f8e[_0x4e76('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xd73f8e[_0x4e76('0x17')]?_0xd73f8e['options'][_0x4e76('0x21')]||null:null,'attributes':_0xd73f8e[_0x4e76('0x17')]?_0xd73f8e[_0x4e76('0x17')][_0x4e76('0x19')]||null:null,'include':_0xd73f8e[_0x4e76('0x17')]?_0xd73f8e[_0x4e76('0x17')]['include']?_['map'](_0xd73f8e[_0x4e76('0x17')][_0x4e76('0x1b')],function(_0x5826d6){return{'model':db[_0x5826d6[_0x4e76('0x1c')]],'as':_0x5826d6['as'],'attributes':_0x5826d6[_0x4e76('0x19')],'include':_0x5826d6[_0x4e76('0x1b')]?_['map'](_0x5826d6[_0x4e76('0x1b')],function(_0x47df89){return{'model':db[_0x47df89['model']],'as':_0x47df89['as'],'attributes':_0x47df89['attributes'],'include':_0x47df89['include']?_[_0x4e76('0x1d')](_0x47df89[_0x4e76('0x1b')],function(_0x1d0e91){return{'model':db[_0x1d0e91['model']],'as':_0x1d0e91['as'],'attributes':_0x1d0e91['attributes']};}):[]};}):[]};}):[]:[]})[_0x4e76('0xd')](function(_0x331f2e){logger[_0x4e76('0xe')]('ShowVoiceQueue',_0xd73f8e);logger[_0x4e76('0x22')]('ShowVoiceQueue',_0xd73f8e,JSON['stringify'](_0x331f2e));_0x239085(_0x331f2e);})[_0x4e76('0x14')](function(_0x1d0303){logger[_0x4e76('0x12')](_0x4e76('0x1f'),_0x1d0303[_0x4e76('0x13')],_0xd73f8e);_0x13436b(_0x4c25fc['error'](0x1f4,_0x1d0303[_0x4e76('0x13')]));});});}; \ No newline at end of file +var _0x82b6=['VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','GetVoiceQueue','findAll','options','raw','where','attributes','include','map','model','debug','stringify','catch','ShowVoiceQueue','VoiceQueue','find','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info'];(function(_0xa5fd6f,_0x27c90f){var _0x2893f1=function(_0x9b5d79){while(--_0x9b5d79){_0xa5fd6f['push'](_0xa5fd6f['shift']());}};_0x2893f1(++_0x27c90f);}(_0x82b6,0x17d));var _0x682b=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0x82b6[_0x367a3d];return _0x460539;};'use strict';var _=require('lodash');var util=require(_0x682b('0x0'));var moment=require(_0x682b('0x1'));var BPromise=require('bluebird');var rs=require(_0x682b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x682b('0x3'))['db'];var utils=require(_0x682b('0x4'));var logger=require('../../config/logger')(_0x682b('0x5'));var config=require(_0x682b('0x6'));var jayson=require(_0x682b('0x7'));var client=jayson[_0x682b('0x8')][_0x682b('0x9')]({'port':0x232a});config[_0x682b('0xa')]=_[_0x682b('0xb')](config[_0x682b('0xa')],{'host':_0x682b('0xc'),'port':0x18eb});var socket=require(_0x682b('0xd'))(new Redis(config[_0x682b('0xa')]));require(_0x682b('0xe'))[_0x682b('0xf')](socket);function respondWithRpcPromise(_0x5de070,_0xe03745,_0x315742){return new BPromise(function(_0x36568a,_0x373962){return client[_0x682b('0x10')](_0x5de070,_0x315742)[_0x682b('0x11')](function(_0x28cbbb){logger[_0x682b('0x12')](_0x682b('0x13'),_0xe03745,_0x682b('0x14'));logger['debug'](_0x682b('0x15'),_0xe03745,_0x682b('0x14'),JSON['stringify'](_0x28cbbb));if(_0x28cbbb[_0x682b('0x16')]){if(_0x28cbbb[_0x682b('0x16')]['code']===0x1f4){logger[_0x682b('0x16')]('VoiceQueue,\x20%s,\x20%s',_0xe03745,_0x28cbbb[_0x682b('0x16')][_0x682b('0x17')]);return _0x373962(_0x28cbbb['error'][_0x682b('0x17')]);}logger[_0x682b('0x16')](_0x682b('0x13'),_0xe03745,_0x28cbbb['error'][_0x682b('0x17')]);return _0x36568a(_0x28cbbb[_0x682b('0x16')]['message']);}else{logger[_0x682b('0x12')](_0x682b('0x13'),_0xe03745,_0x682b('0x14'));_0x36568a(_0x28cbbb[_0x682b('0x18')]['message']);}})['catch'](function(_0x6b7681){logger['error'](_0x682b('0x13'),_0xe03745,_0x6b7681);_0x373962(_0x6b7681);});});}exports[_0x682b('0x19')]=function(_0xbc235e){var _0xa73d42=this;return new Promise(function(_0x3a30f0,_0x37165d){return db['VoiceQueue'][_0x682b('0x1a')]({'raw':_0xbc235e[_0x682b('0x1b')]?_0xbc235e[_0x682b('0x1b')][_0x682b('0x1c')]===undefined?!![]:![]:!![],'where':_0xbc235e[_0x682b('0x1b')]?_0xbc235e['options'][_0x682b('0x1d')]||null:null,'attributes':_0xbc235e['options']?_0xbc235e[_0x682b('0x1b')][_0x682b('0x1e')]||null:null,'limit':_0xbc235e['options']?_0xbc235e[_0x682b('0x1b')]['limit']||null:null,'include':_0xbc235e['options']?_0xbc235e['options'][_0x682b('0x1f')]?_[_0x682b('0x20')](_0xbc235e[_0x682b('0x1b')][_0x682b('0x1f')],function(_0x5ae56d){return{'model':db[_0x5ae56d[_0x682b('0x21')]],'as':_0x5ae56d['as'],'attributes':_0x5ae56d[_0x682b('0x1e')],'include':_0x5ae56d[_0x682b('0x1f')]?_['map'](_0x5ae56d[_0x682b('0x1f')],function(_0x527f1f){return{'model':db[_0x527f1f['model']],'as':_0x527f1f['as'],'attributes':_0x527f1f[_0x682b('0x1e')],'include':_0x527f1f[_0x682b('0x1f')]?_[_0x682b('0x20')](_0x527f1f[_0x682b('0x1f')],function(_0x5e3194){return{'model':db[_0x5e3194[_0x682b('0x21')]],'as':_0x5e3194['as'],'attributes':_0x5e3194[_0x682b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45fe9e){logger['info'](_0x682b('0x19'),_0xbc235e);logger[_0x682b('0x22')]('GetVoiceQueue',_0xbc235e,JSON[_0x682b('0x23')](_0x45fe9e));_0x3a30f0(_0x45fe9e);})[_0x682b('0x24')](function(_0x1b39b3){logger[_0x682b('0x16')](_0x682b('0x19'),_0x1b39b3[_0x682b('0x17')],_0xbc235e);_0x37165d(_0xa73d42[_0x682b('0x16')](0x1f4,_0x1b39b3[_0x682b('0x17')]));});});};exports[_0x682b('0x25')]=function(_0x58909d){var _0x14753c=this;return new Promise(function(_0xc0f2cc,_0x312707){return db[_0x682b('0x26')][_0x682b('0x27')]({'raw':_0x58909d['options']?_0x58909d[_0x682b('0x1b')][_0x682b('0x1c')]===undefined?!![]:![]:!![],'where':_0x58909d['options']?_0x58909d[_0x682b('0x1b')][_0x682b('0x1d')]||null:null,'attributes':_0x58909d[_0x682b('0x1b')]?_0x58909d[_0x682b('0x1b')][_0x682b('0x1e')]||null:null,'include':_0x58909d['options']?_0x58909d['options'][_0x682b('0x1f')]?_['map'](_0x58909d['options'][_0x682b('0x1f')],function(_0x263ff7){return{'model':db[_0x263ff7['model']],'as':_0x263ff7['as'],'attributes':_0x263ff7[_0x682b('0x1e')],'include':_0x263ff7[_0x682b('0x1f')]?_[_0x682b('0x20')](_0x263ff7['include'],function(_0x31e558){return{'model':db[_0x31e558[_0x682b('0x21')]],'as':_0x31e558['as'],'attributes':_0x31e558[_0x682b('0x1e')],'include':_0x31e558[_0x682b('0x1f')]?_[_0x682b('0x20')](_0x31e558[_0x682b('0x1f')],function(_0x369cad){return{'model':db[_0x369cad[_0x682b('0x21')]],'as':_0x369cad['as'],'attributes':_0x369cad[_0x682b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x682b('0x11')](function(_0x150af6){logger[_0x682b('0x12')](_0x682b('0x25'),_0x58909d);logger[_0x682b('0x22')](_0x682b('0x25'),_0x58909d,JSON[_0x682b('0x23')](_0x150af6));_0xc0f2cc(_0x150af6);})['catch'](function(_0x220288){logger[_0x682b('0x16')](_0x682b('0x25'),_0x220288['message'],_0x58909d);_0x312707(_0x14753c[_0x682b('0x16')](0x1f4,_0x220288['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 9523f39..3fa73b7 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 _0x878f=['save','remove','update','emit','removeListener','register','length'];(function(_0x36f65d,_0x3a8cfb){var _0x3ace18=function(_0x128179){while(--_0x128179){_0x36f65d['push'](_0x36f65d['shift']());}};_0x3ace18(++_0x3a8cfb);}(_0x878f,0x173));var _0xf878=function(_0x47c0ac,_0x5ef37c){_0x47c0ac=_0x47c0ac-0x0;var _0x378c6f=_0x878f[_0x47c0ac];return _0x378c6f;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xf878('0x0'),_0xf878('0x1'),_0xf878('0x2')];function createListener(_0x12df2b,_0x1b3d0b){return function(_0x3d74cf){_0x1b3d0b[_0xf878('0x3')](_0x12df2b,_0x3d74cf);};}function removeListener(_0x45a37b,_0x240b48){return function(){VoiceQueueEvents[_0xf878('0x4')](_0x45a37b,_0x240b48);};}exports[_0xf878('0x5')]=function(_0x4bc9aa){for(var _0x4ac8d8=0x0,_0x3c5f5c=events[_0xf878('0x6')];_0x4ac8d8<_0x3c5f5c;_0x4ac8d8++){var _0x59e564=events[_0x4ac8d8];var _0x52851e=createListener('voiceQueue:'+_0x59e564,_0x4bc9aa);VoiceQueueEvents['on'](_0x59e564,_0x52851e);}}; \ No newline at end of file +var _0xc37e=['register','voiceQueue:','./voiceQueue.events','save','remove','update','emit','removeListener'];(function(_0x44ae0b,_0x3e9865){var _0x69232a=function(_0x5ae588){while(--_0x5ae588){_0x44ae0b['push'](_0x44ae0b['shift']());}};_0x69232a(++_0x3e9865);}(_0xc37e,0x152));var _0xec37=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc37e[_0x122ef9];return _0x42fba0;};'use strict';var VoiceQueueEvents=require(_0xec37('0x0'));var events=[_0xec37('0x1'),_0xec37('0x2'),_0xec37('0x3')];function createListener(_0x41f2c4,_0x346a20){return function(_0x9b6de4){_0x346a20[_0xec37('0x4')](_0x41f2c4,_0x9b6de4);};}function removeListener(_0xdef813,_0x345668){return function(){VoiceQueueEvents[_0xec37('0x5')](_0xdef813,_0x345668);};}exports[_0xec37('0x6')]=function(_0x2a1100){for(var _0xeca95=0x0,_0x378e1c=events['length'];_0xeca95<_0x378e1c;_0xeca95++){var _0x1c027e=events[_0xeca95];var _0x198f4a=createListener(_0xec37('0x7')+_0x1c027e,_0x2a1100);VoiceQueueEvents['on'](_0x1c027e,_0x198f4a);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 147ec0a..c67244a 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 _0x50e5=['update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','create','/:id'];(function(_0x4a8e14,_0x519668){var _0x28be98=function(_0x147116){while(--_0x147116){_0x4a8e14['push'](_0x4a8e14['shift']());}};_0x28be98(++_0x519668);}(_0x50e5,0xb7));var _0x550e=function(_0x444bba,_0x4882f0){_0x444bba=_0x444bba-0x0;var _0x3b0a2e=_0x50e5[_0x444bba];return _0x3b0a2e;};'use strict';var multer=require(_0x550e('0x0'));var util=require(_0x550e('0x1'));var path=require('path');var timeout=require(_0x550e('0x2'));var express=require(_0x550e('0x3'));var router=express[_0x550e('0x4')]();var auth=require(_0x550e('0x5'));var interaction=require(_0x550e('0x6'));var config=require(_0x550e('0x7'));var controller=require(_0x550e('0x8'));router[_0x550e('0x9')]('/',auth[_0x550e('0xa')](),controller[_0x550e('0xb')]);router[_0x550e('0x9')](_0x550e('0xc'),auth['isAuthenticated'](),controller[_0x550e('0xd')]);router[_0x550e('0x9')]('/index',auth[_0x550e('0xa')](),controller[_0x550e('0xe')]);router[_0x550e('0x9')]('/:id',auth[_0x550e('0xa')](),controller['show']);router['post']('/',auth[_0x550e('0xa')](),controller[_0x550e('0xf')]);router['put'](_0x550e('0x10'),auth[_0x550e('0xa')](),controller[_0x550e('0x11')]);router[_0x550e('0x12')]('/:id',auth[_0x550e('0xa')](),controller['destroy']);module[_0x550e('0x13')]=router; \ No newline at end of file +var _0x4317=['/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport'];(function(_0x141c90,_0x4dc489){var _0x4ea2eb=function(_0x294aae){while(--_0x294aae){_0x141c90['push'](_0x141c90['shift']());}};_0x4ea2eb(++_0x4dc489);}(_0x4317,0x7c));var _0x7431=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4317[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x7431('0x0'));var path=require(_0x7431('0x1'));var timeout=require(_0x7431('0x2'));var express=require('express');var router=express[_0x7431('0x3')]();var auth=require(_0x7431('0x4'));var interaction=require(_0x7431('0x5'));var config=require(_0x7431('0x6'));var controller=require(_0x7431('0x7'));router[_0x7431('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7431('0x8')](_0x7431('0x9'),auth[_0x7431('0xa')](),controller[_0x7431('0xb')]);router[_0x7431('0x8')](_0x7431('0xc'),auth[_0x7431('0xa')](),controller[_0x7431('0xd')]);router[_0x7431('0x8')](_0x7431('0xe'),auth[_0x7431('0xa')](),controller[_0x7431('0xf')]);router[_0x7431('0x10')]('/',auth[_0x7431('0xa')](),controller[_0x7431('0x11')]);router[_0x7431('0x12')](_0x7431('0xe'),auth[_0x7431('0xa')](),controller[_0x7431('0x13')]);router[_0x7431('0x14')](_0x7431('0xe'),auth[_0x7431('0xa')](),controller[_0x7431('0x15')]);module[_0x7431('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 2623ba5..768e90a 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 _0x5973=['BOOLEAN','DATE','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER'];(function(_0x32afa0,_0x101934){var _0x89c2c=function(_0x74e98b){while(--_0x74e98b){_0x32afa0['push'](_0x32afa0['shift']());}};_0x89c2c(++_0x101934);}(_0x5973,0xb9));var _0x3597=function(_0x3bd4e5,_0x33854f){_0x3bd4e5=_0x3bd4e5-0x0;var _0x2d1522=_0x5973[_0x3bd4e5];return _0x2d1522;};'use strict';var Sequelize=require(_0x3597('0x0'));var moment=require(_0x3597('0x1'));module['exports']={'type':{'type':Sequelize[_0x3597('0x2')]},'uniqueid':{'type':Sequelize[_0x3597('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3597('0x2')]},'queue':{'type':Sequelize[_0x3597('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x347325){var _0x1fcbd2=moment(_0x347325);var _0x55d0b2=moment(this[_0x3597('0x3')](_0x3597('0x4')))['format'](_0x3597('0x5'));var _0x38d15b=_0x1fcbd2['diff'](_0x55d0b2,_0x3597('0x6'));this[_0x3597('0x7')](_0x3597('0x8'),_0x347325);this['setDataValue'](_0x3597('0x9'),_0x38d15b||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x3597('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x3597('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3597('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3597('0xc')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x3597('0xa')]},'channel':{'type':Sequelize[_0x3597('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3597('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3597('0x2')]},'holdtime':{'type':Sequelize[_0x3597('0xa')]},'mohtime':{'type':Sequelize[_0x3597('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3597('0x2')],'comment':_0x3597('0xd')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x3597('0x2')]},'disposition':{'type':Sequelize[_0x3597('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x3597('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e33=['queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports','STRING','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds'];(function(_0x29533a,_0x1ed50f){var _0x376831=function(_0x2387d2){while(--_0x2387d2){_0x29533a['push'](_0x29533a['shift']());}};_0x376831(++_0x1ed50f);}(_0x3e33,0x137));var _0x33e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e33[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x33e3('0x0'));var moment=require('moment');module[_0x33e3('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x33e3('0x2')]},'calleridname':{'type':Sequelize[_0x33e3('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x553277){var _0xbf9c0a=moment(_0x553277);var _0x3d4093=moment(this[_0x33e3('0x3')](_0x33e3('0x4')))[_0x33e3('0x5')](_0x33e3('0x6'));var _0x1c0172=_0xbf9c0a[_0x33e3('0x7')](_0x3d4093,_0x33e3('0x8'));this['setDataValue'](_0x33e3('0x9'),_0x553277);this[_0x33e3('0xa')](_0x33e3('0xb'),_0x1c0172||null);}},'position':{'type':Sequelize[_0x33e3('0xc')]},'count':{'type':Sequelize[_0x33e3('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x33e3('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x33e3('0xe')]},'queuecallercomplete':{'type':Sequelize[_0x33e3('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x33e3('0xe')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x33e3('0xe')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x33e3('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x33e3('0x2')]},'connectedlinenum':{'type':Sequelize[_0x33e3('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x33e3('0x2')]},'context':{'type':Sequelize[_0x33e3('0x2')]},'exten':{'type':Sequelize[_0x33e3('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x33e3('0xc')]},'mohtime':{'type':Sequelize[_0x33e3('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x33e3('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x33e3('0x2')]},'transfer':{'type':Sequelize[_0x33e3('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x33e3('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x33e3('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x33e3('0xc')],'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 7e9016b..11591df 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','getVoiceQueuesReport','intersection','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x7a54,0x106));var _0x47a5=function(_0x2e1036,_0x4c383b){_0x2e1036=_0x2e1036-0x0;var _0x26a8be=_0x7a54[_0x2e1036];return _0x26a8be;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file +var _0x9957=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','VoiceQueueReport','count','include','catch','show','params','keys','length','includeAll','find','create','body','describe','getVoiceQueuesReport','fields','limit','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xcc;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1e')](_0x2233dd);}return _0x2b4e94[_0x7995('0x1f')](_0x2233dd)[_0x7995('0x20')]();};}function respondWithResult(_0x2202ce,_0x41cbf0){_0x41cbf0=_0x41cbf0||0xc8;return function(_0x5377e5){if(_0x5377e5){return _0x2202ce[_0x7995('0x1f')](_0x41cbf0)['json'](_0x5377e5);}};}function respondWithFilteredResult(_0x2f832e,_0x37f297){return function(_0x43d4b8){if(_0x43d4b8){var _0x291317=_0x43d4b8['count'],_0x1e1415=_0x37f297[_0x7995('0x21')],_0x37a7d4=_0x37f297['offset']+_0x37f297['limit'],_0x4faa60;if(_0x37a7d4>=_0x291317){_0x37a7d4=_0x291317;_0x4faa60=0xc8;}else{_0x4faa60=0xce;}_0x2f832e[_0x7995('0x1f')](_0x4faa60);return _0x2f832e[_0x7995('0x22')]('Content-Range',_0x1e1415+'-'+_0x37a7d4+'/'+_0x291317)[_0x7995('0x23')](_0x43d4b8);}return null;};}function patchUpdates(_0x51f276){return function(_0x4b1a8e){try{jsonpatch[_0x7995('0x24')](_0x4b1a8e,_0x51f276,!![]);}catch(_0x327b1f){return BPromise[_0x7995('0x25')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x26')]();};}function saveUpdates(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x27')](_0x460924)[_0x7995('0x28')](function(_0x204507){return _0x204507;});}return null;};}function removeEntity(_0x285437,_0x563799){return function(_0x13bc35){if(_0x13bc35){return _0x13bc35[_0x7995('0x29')]()[_0x7995('0x28')](function(){_0x285437['status'](0xcc)[_0x7995('0x20')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1e')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x2a')]);if(_0x47625f[_0x7995('0x2b')]){delete _0x47625f[_0x7995('0x2b')];}_0x2a307e[_0x7995('0x1f')](_0x56691a)[_0x7995('0x2c')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['VoiceQueueReport'][_0x7995('0x2d')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2e')],'type':_0xe6b0b3[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3250e0[_0x7995('0x31')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x32')]=_['keys'](_0x9b2a15[_0x7995('0x32')]);_0x3250e0[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]);_0x456a28['attributes']=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x35')]=_0x456a28[_0x7995('0x35')]['length']?_0x456a28[_0x7995('0x35')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x32')][_0x7995('0x36')](_0x7995('0x37'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x32')]['limit']);_0x456a28['offset']=qs[_0x7995('0x21')](_0x9b2a15[_0x7995('0x32')]['offset']);}_0x456a28[_0x7995('0x38')]=qs[_0x7995('0x39')](_0x9b2a15[_0x7995('0x32')][_0x7995('0x39')]);_0x456a28[_0x7995('0x3a')]=qs['filters'](_[_0x7995('0x3b')](_0x9b2a15[_0x7995('0x32')],_0x3250e0[_0x7995('0x33')]),_0x574574);if(_0x9b2a15[_0x7995('0x32')]['filter']){_0x456a28[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x456a28[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2f')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2b')]]={'$like':'%'+_0x9b2a15[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3c')]({},_0x456a28,_0x9b2a15[_0x7995('0x3f')]);var _0x14d638={'where':_0x456a28[_0x7995('0x3a')]};return db[_0x7995('0x40')][_0x7995('0x41')](_0x14d638)[_0x7995('0x28')](function(_0x270d52){_0x4253e5[_0x7995('0x41')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x43')](handleError(_0x514445,null));};exports[_0x7995('0x44')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':![],'where':{'id':_0x35c8ff[_0x7995('0x45')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x40')][_0x7995('0x2d')]);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x46')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5e85b9[_0x7995('0x31')],_0x5e85b9[_0x7995('0x32')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x31')],qs['fields'](_0x35c8ff[_0x7995('0x32')]['fields']));_0x46ac4f[_0x7995('0x35')]=_0x46ac4f['attributes'][_0x7995('0x47')]?_0x46ac4f[_0x7995('0x35')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x32')][_0x7995('0x48')]){_0x46ac4f[_0x7995('0x42')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3c')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x40')][_0x7995('0x49')](_0x46ac4f)[_0x7995('0x28')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x43')](handleError(_0x576b96,null));};exports[_0x7995('0x4a')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x40')]['create'](_0x511567[_0x7995('0x4b')],{})[_0x7995('0x28')](respondWithResult(_0x3d8ae3,0xc9))['catch'](handleError(_0x3d8ae3,null));};exports[_0x7995('0x27')]=function(_0x5843ba,_0x1d87f9){if(_0x5843ba[_0x7995('0x4b')]['id']){delete _0x5843ba[_0x7995('0x4b')]['id'];}return db[_0x7995('0x40')][_0x7995('0x49')]({'where':{'id':_0x5843ba[_0x7995('0x45')]['id']}})[_0x7995('0x28')](handleEntityNotFound(_0x1d87f9,null))['then'](saveUpdates(_0x5843ba[_0x7995('0x4b')],null))[_0x7995('0x28')](respondWithResult(_0x1d87f9,null))[_0x7995('0x43')](handleError(_0x1d87f9,null));};exports['destroy']=function(_0x19da63,_0x1fe77e){return db[_0x7995('0x40')]['find']({'where':{'id':_0x19da63['params']['id']}})['then'](handleEntityNotFound(_0x1fe77e,null))[_0x7995('0x28')](removeEntity(_0x1fe77e,null))[_0x7995('0x43')](handleError(_0x1fe77e,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x28')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x4d')]=function(_0x4ab09f,_0x14fe7f){var _0x33c801={},_0x206d2a={},_0x50c7b5={'count':0x0,'rows':[]};_0x206d2a['model']=_['keys'](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x206d2a[_0x7995('0x32')]=_[_0x7995('0x46')](_0x4ab09f[_0x7995('0x32')]);_0x206d2a[_0x7995('0x33')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],_0x206d2a[_0x7995('0x32')]);_0x33c801[_0x7995('0x35')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],qs[_0x7995('0x4e')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x4e')]));_0x33c801[_0x7995('0x35')]=_0x33c801[_0x7995('0x35')][_0x7995('0x47')]?_0x33c801[_0x7995('0x35')]:_0x206d2a[_0x7995('0x31')];if(!_0x4ab09f['query'][_0x7995('0x36')](_0x7995('0x37'))){_0x33c801[_0x7995('0x4f')]=qs[_0x7995('0x4f')](_0x4ab09f['query']['limit']);_0x33c801[_0x7995('0x21')]=qs[_0x7995('0x21')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x21')]);}_0x33c801['order']=qs[_0x7995('0x39')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x39')]);_0x33c801[_0x7995('0x3a')]=qs['filters'](_['pick'](_0x4ab09f[_0x7995('0x32')],_0x206d2a[_0x7995('0x33')]));if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]){_0x33c801[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x33c801[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x33c801[_0x7995('0x35')],function(_0x50caf5){var _0x18f230={};_0x18f230[_0x50caf5]={'$like':'%'+_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x18f230;})});}_0x33c801=_[_0x7995('0x3c')]({},_0x33c801,_0x4ab09f['options']);var _0x51bf6a={'where':_0x33c801[_0x7995('0x3a')]};return db[_0x7995('0x40')]['count'](_0x51bf6a)[_0x7995('0x28')](function(_0x375fc9){_0x50c7b5[_0x7995('0x41')]=_0x375fc9;if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x48')]){_0x33c801['include']=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x33c801);})[_0x7995('0x28')](function(_0xe31dcb){_0x50c7b5[_0x7995('0x50')]=_0xe31dcb;return _0x50c7b5;})[_0x7995('0x28')](respondWithFilteredResult(_0x14fe7f,_0x33c801,_0x7995('0x4d')))[_0x7995('0x43')](handleError(_0x14fe7f,null,_0x7995('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 699054b..17a9ee0 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 _0xe626=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','remove','emit'];(function(_0x1e16f1,_0x48637f){var _0x1bc4bf=function(_0x5b25ba){while(--_0x5b25ba){_0x1e16f1['push'](_0x1e16f1['shift']());}};_0x1bc4bf(++_0x48637f);}(_0xe626,0x99));var _0x6e62=function(_0x3dae91,_0x80df00){_0x3dae91=_0x3dae91-0x0;var _0x430ac5=_0xe626[_0x3dae91];return _0x430ac5;};'use strict';var EventEmitter=require(_0x6e62('0x0'));var VoiceQueueReport=require(_0x6e62('0x1'))['db'][_0x6e62('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x6e62('0x3')](0x0);var events={'afterCreate':_0x6e62('0x4'),'afterUpdate':'update','afterDestroy':_0x6e62('0x5')};function emitEvent(_0x4e5ff3){return function(_0x553e72,_0x24c3fd,_0x5f1ae3){VoiceQueueReportEvents[_0x6e62('0x6')](_0x4e5ff3+':'+_0x553e72['id'],_0x553e72);VoiceQueueReportEvents['emit'](_0x4e5ff3,_0x553e72);_0x5f1ae3(null);};}for(var e in events){if(events[_0x6e62('0x7')](e)){var event=events[e];VoiceQueueReport[_0x6e62('0x8')](e,emitEvent(event));}}module[_0x6e62('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xbe2a=['setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb','VoiceQueueReport'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0xbe2a,0x1bf));var _0xabe2=function(_0x45a3b1,_0x32afd9){_0x45a3b1=_0x45a3b1-0x0;var _0x557985=_0xbe2a[_0x45a3b1];return _0x557985;};'use strict';var EventEmitter=require(_0xabe2('0x0'));var VoiceQueueReport=require(_0xabe2('0x1'))['db'][_0xabe2('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xabe2('0x3')](0x0);var events={'afterCreate':_0xabe2('0x4'),'afterUpdate':_0xabe2('0x5'),'afterDestroy':_0xabe2('0x6')};function emitEvent(_0xa1e8de){return function(_0x32fc32,_0x42d1e2,_0xf08a85){VoiceQueueReportEvents[_0xabe2('0x7')](_0xa1e8de+':'+_0x32fc32['id'],_0x32fc32);VoiceQueueReportEvents[_0xabe2('0x7')](_0xa1e8de,_0x32fc32);_0xf08a85(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xabe2('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 06ce528..67d6a7c 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 _0xe556=['rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','api','bluebird','request-promise','path'];(function(_0x4244bb,_0x12ef95){var _0x318297=function(_0x5eacaf){while(--_0x5eacaf){_0x4244bb['push'](_0x4244bb['shift']());}};_0x318297(++_0x12ef95);}(_0xe556,0x182));var _0x6e55=function(_0x47f883,_0x375f48){_0x47f883=_0x47f883-0x0;var _0x29f7c5=_0xe556[_0x47f883];return _0x29f7c5;};'use strict';var _=require(_0x6e55('0x0'));var util=require(_0x6e55('0x1'));var logger=require('../../config/logger')(_0x6e55('0x2'));var moment=require('moment');var BPromise=require(_0x6e55('0x3'));var rp=require(_0x6e55('0x4'));var fs=require('fs');var path=require(_0x6e55('0x5'));var rimraf=require(_0x6e55('0x6'));var config=require('../../config/environment');var attributes=require(_0x6e55('0x7'));module[_0x6e55('0x8')]=function(_0x15a655,_0x5e4bda){return _0x15a655[_0x6e55('0x9')](_0x6e55('0xa'),attributes,{'tableName':_0x6e55('0xb'),'paranoid':![],'indexes':[{'fields':[_0x6e55('0xc')]},{'fields':[_0x6e55('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb32=['moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','util','api'];(function(_0xc2b4c8,_0x756a49){var _0x402443=function(_0x571bae){while(--_0x571bae){_0xc2b4c8['push'](_0xc2b4c8['shift']());}};_0x402443(++_0x756a49);}(_0xbb32,0x129));var _0x2bb3=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0xbb32[_0x4fc421];return _0x8c6d63;};'use strict';var _=require('lodash');var util=require(_0x2bb3('0x0'));var logger=require('../../config/logger')(_0x2bb3('0x1'));var moment=require(_0x2bb3('0x2'));var BPromise=require('bluebird');var rp=require(_0x2bb3('0x3'));var fs=require('fs');var path=require(_0x2bb3('0x4'));var rimraf=require(_0x2bb3('0x5'));var config=require(_0x2bb3('0x6'));var attributes=require(_0x2bb3('0x7'));module[_0x2bb3('0x8')]=function(_0x2e3722,_0x4878a3){return _0x2e3722[_0x2bb3('0x9')](_0x2bb3('0xa'),attributes,{'tableName':_0x2bb3('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2bb3('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index ea40097..afc3aa5 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 _0xef05=['debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','stringify','catch','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','then','info','request\x20sent'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0xef05,0x73));var _0x5ef0=function(_0x2f6a80,_0x161a7c){_0x2f6a80=_0x2f6a80-0x0;var _0x2bbe8f=_0xef05[_0x2f6a80];return _0x2bbe8f;};'use strict';var _=require(_0x5ef0('0x0'));var util=require(_0x5ef0('0x1'));var moment=require(_0x5ef0('0x2'));var BPromise=require(_0x5ef0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ef0('0x4'))['db'];var utils=require(_0x5ef0('0x5'));var logger=require(_0x5ef0('0x6'))(_0x5ef0('0x7'));var config=require(_0x5ef0('0x8'));var jayson=require(_0x5ef0('0x9'));var client=jayson[_0x5ef0('0xa')][_0x5ef0('0xb')]({'port':0x232a});config[_0x5ef0('0xc')]=_[_0x5ef0('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5ef0('0xe'))(new Redis(config['redis']));require(_0x5ef0('0xf'))[_0x5ef0('0x10')](socket);function respondWithRpcPromise(_0x10df47,_0x572fa4,_0x51fb30){return new BPromise(function(_0x10d2c9,_0x255cf3){return client['request'](_0x10df47,_0x51fb30)[_0x5ef0('0x11')](function(_0x16ddd2){logger[_0x5ef0('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x572fa4,_0x5ef0('0x13'));logger[_0x5ef0('0x14')](_0x5ef0('0x15'),_0x572fa4,_0x5ef0('0x13'),JSON['stringify'](_0x16ddd2));if(_0x16ddd2['error']){if(_0x16ddd2[_0x5ef0('0x16')][_0x5ef0('0x17')]===0x1f4){logger[_0x5ef0('0x16')](_0x5ef0('0x18'),_0x572fa4,_0x16ddd2['error'][_0x5ef0('0x19')]);return _0x255cf3(_0x16ddd2['error'][_0x5ef0('0x19')]);}logger[_0x5ef0('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x572fa4,_0x16ddd2[_0x5ef0('0x16')][_0x5ef0('0x19')]);return _0x10d2c9(_0x16ddd2[_0x5ef0('0x16')][_0x5ef0('0x19')]);}else{logger[_0x5ef0('0x12')](_0x5ef0('0x18'),_0x572fa4,'request\x20sent');_0x10d2c9(_0x16ddd2[_0x5ef0('0x1a')][_0x5ef0('0x19')]);}})['catch'](function(_0x598721){logger[_0x5ef0('0x16')](_0x5ef0('0x18'),_0x572fa4,_0x598721);_0x255cf3(_0x598721);});});}exports['GetVoiceQueueReport']=function(_0x486bdb){var _0x3badb8=this;return new Promise(function(_0x55991d,_0x35d69d){return db[_0x5ef0('0x1b')][_0x5ef0('0x1c')]({'raw':_0x486bdb['options']?_0x486bdb[_0x5ef0('0x1d')][_0x5ef0('0x1e')]===undefined?!![]:![]:!![],'where':_0x486bdb['options']?_0x486bdb[_0x5ef0('0x1d')][_0x5ef0('0x1f')]||null:null,'attributes':_0x486bdb[_0x5ef0('0x1d')]?_0x486bdb[_0x5ef0('0x1d')][_0x5ef0('0x20')]||null:null,'limit':_0x486bdb[_0x5ef0('0x1d')]?_0x486bdb['options'][_0x5ef0('0x21')]||null:null,'include':_0x486bdb[_0x5ef0('0x1d')]?_0x486bdb[_0x5ef0('0x1d')][_0x5ef0('0x22')]?_['map'](_0x486bdb['options']['include'],function(_0x360c32){return{'model':db[_0x360c32['model']],'as':_0x360c32['as'],'attributes':_0x360c32['attributes'],'include':_0x360c32[_0x5ef0('0x22')]?_[_0x5ef0('0x23')](_0x360c32[_0x5ef0('0x22')],function(_0x4cbc0c){return{'model':db[_0x4cbc0c[_0x5ef0('0x24')]],'as':_0x4cbc0c['as'],'attributes':_0x4cbc0c[_0x5ef0('0x20')],'include':_0x4cbc0c[_0x5ef0('0x22')]?_[_0x5ef0('0x23')](_0x4cbc0c[_0x5ef0('0x22')],function(_0x336010){return{'model':db[_0x336010[_0x5ef0('0x24')]],'as':_0x336010['as'],'attributes':_0x336010['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ef0('0x11')](function(_0x388e01){logger[_0x5ef0('0x12')](_0x5ef0('0x25'),_0x486bdb);logger[_0x5ef0('0x14')]('GetVoiceQueueReport',_0x486bdb,JSON['stringify'](_0x388e01));_0x55991d(_0x388e01);})['catch'](function(_0x5cad0b){logger[_0x5ef0('0x16')]('GetVoiceQueueReport',_0x5cad0b[_0x5ef0('0x19')],_0x486bdb);_0x35d69d(_0x3badb8[_0x5ef0('0x16')](0x1f4,_0x5cad0b[_0x5ef0('0x19')]));});});};exports[_0x5ef0('0x26')]=function(_0xcca383){var _0x2c9da8=this;return new Promise(function(_0x2ae440,_0x4d973f){return db[_0x5ef0('0x1b')][_0x5ef0('0x27')](_0xcca383[_0x5ef0('0x28')],{'raw':_0xcca383['options']?_0xcca383[_0x5ef0('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x5ef0('0x11')](function(_0x570827){logger[_0x5ef0('0x12')]('CreateVoiceQueueReport',_0xcca383);logger[_0x5ef0('0x14')](_0x5ef0('0x26'),_0xcca383,JSON[_0x5ef0('0x29')](_0x570827));_0x2ae440(_0x570827);})[_0x5ef0('0x2a')](function(_0x33d85a){logger[_0x5ef0('0x16')]('CreateVoiceQueueReport',_0x33d85a['message'],_0xcca383);_0x4d973f(_0x2c9da8[_0x5ef0('0x16')](0x1f4,_0x33d85a[_0x5ef0('0x19')]));});});};exports[_0x5ef0('0x2b')]=function(_0xe670b4){var _0x48b1fb=this;return new Promise(function(_0x1e7a7b,_0x5b42fc){return db[_0x5ef0('0x1b')][_0x5ef0('0x2c')](_0xe670b4[_0x5ef0('0x28')],{'raw':_0xe670b4['options']?_0xe670b4[_0x5ef0('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe670b4[_0x5ef0('0x1d')]?_0xe670b4[_0x5ef0('0x1d')][_0x5ef0('0x1f')]||null:null,'attributes':_0xe670b4['options']?_0xe670b4[_0x5ef0('0x1d')]['attributes']||null:null,'limit':_0xe670b4[_0x5ef0('0x1d')]?_0xe670b4[_0x5ef0('0x1d')][_0x5ef0('0x21')]||null:null})['then'](function(_0x49f475){logger[_0x5ef0('0x12')](_0x5ef0('0x2b'),_0xe670b4);logger[_0x5ef0('0x14')](_0x5ef0('0x2b'),_0xe670b4,JSON[_0x5ef0('0x29')](_0x49f475));_0x1e7a7b(_0x49f475);})['catch'](function(_0x123d23){logger[_0x5ef0('0x16')](_0x5ef0('0x2b'),_0x123d23[_0x5ef0('0x19')],_0xe670b4);_0x5b42fc(_0x48b1fb[_0x5ef0('0x16')](0x1f4,_0x123d23[_0x5ef0('0x19')]));});});}; \ No newline at end of file +var _0xb323=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVoiceQueueReport','CreateVoiceQueueReport','create','catch','update','body','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x45b9e5,_0xaf6bb2){var _0x4f7466=function(_0x20fe4e){while(--_0x20fe4e){_0x45b9e5['push'](_0x45b9e5['shift']());}};_0x4f7466(++_0xaf6bb2);}(_0xb323,0x157));var _0x3b32=function(_0x3b8ae5,_0x473e3c){_0x3b8ae5=_0x3b8ae5-0x0;var _0x3adeb3=_0xb323[_0x3b8ae5];return _0x3adeb3;};'use strict';var _=require(_0x3b32('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3b32('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b32('0x2'));var db=require(_0x3b32('0x3'))['db'];var utils=require(_0x3b32('0x4'));var logger=require(_0x3b32('0x5'))(_0x3b32('0x6'));var config=require(_0x3b32('0x7'));var jayson=require(_0x3b32('0x8'));var client=jayson[_0x3b32('0x9')][_0x3b32('0xa')]({'port':0x232a});config[_0x3b32('0xb')]=_[_0x3b32('0xc')](config[_0x3b32('0xb')],{'host':_0x3b32('0xd'),'port':0x18eb});var socket=require(_0x3b32('0xe'))(new Redis(config[_0x3b32('0xb')]));require('./voiceQueueReport.socket')[_0x3b32('0xf')](socket);function respondWithRpcPromise(_0x4f12f9,_0x3ed32d,_0x3336f1){return new BPromise(function(_0x21e4d6,_0x1149a9){return client[_0x3b32('0x10')](_0x4f12f9,_0x3336f1)['then'](function(_0x322a0e){logger[_0x3b32('0x11')](_0x3b32('0x12'),_0x3ed32d,_0x3b32('0x13'));logger[_0x3b32('0x14')](_0x3b32('0x15'),_0x3ed32d,'request\x20sent',JSON[_0x3b32('0x16')](_0x322a0e));if(_0x322a0e[_0x3b32('0x17')]){if(_0x322a0e[_0x3b32('0x17')][_0x3b32('0x18')]===0x1f4){logger[_0x3b32('0x17')](_0x3b32('0x12'),_0x3ed32d,_0x322a0e['error'][_0x3b32('0x19')]);return _0x1149a9(_0x322a0e['error'][_0x3b32('0x19')]);}logger[_0x3b32('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x3ed32d,_0x322a0e['error'][_0x3b32('0x19')]);return _0x21e4d6(_0x322a0e['error'][_0x3b32('0x19')]);}else{logger['info'](_0x3b32('0x12'),_0x3ed32d,_0x3b32('0x13'));_0x21e4d6(_0x322a0e[_0x3b32('0x1a')][_0x3b32('0x19')]);}})['catch'](function(_0x4238d3){logger[_0x3b32('0x17')](_0x3b32('0x12'),_0x3ed32d,_0x4238d3);_0x1149a9(_0x4238d3);});});}exports['GetVoiceQueueReport']=function(_0x5eddce){var _0x1c6a40=this;return new Promise(function(_0x19020e,_0x345478){return db[_0x3b32('0x1b')][_0x3b32('0x1c')]({'raw':_0x5eddce['options']?_0x5eddce[_0x3b32('0x1d')][_0x3b32('0x1e')]===undefined?!![]:![]:!![],'where':_0x5eddce[_0x3b32('0x1d')]?_0x5eddce[_0x3b32('0x1d')][_0x3b32('0x1f')]||null:null,'attributes':_0x5eddce['options']?_0x5eddce[_0x3b32('0x1d')][_0x3b32('0x20')]||null:null,'limit':_0x5eddce[_0x3b32('0x1d')]?_0x5eddce['options'][_0x3b32('0x21')]||null:null,'include':_0x5eddce[_0x3b32('0x1d')]?_0x5eddce['options'][_0x3b32('0x22')]?_[_0x3b32('0x23')](_0x5eddce['options']['include'],function(_0x3536f4){return{'model':db[_0x3536f4[_0x3b32('0x24')]],'as':_0x3536f4['as'],'attributes':_0x3536f4[_0x3b32('0x20')],'include':_0x3536f4['include']?_[_0x3b32('0x23')](_0x3536f4[_0x3b32('0x22')],function(_0x124784){return{'model':db[_0x124784[_0x3b32('0x24')]],'as':_0x124784['as'],'attributes':_0x124784['attributes'],'include':_0x124784[_0x3b32('0x22')]?_['map'](_0x124784[_0x3b32('0x22')],function(_0x4a1922){return{'model':db[_0x4a1922[_0x3b32('0x24')]],'as':_0x4a1922['as'],'attributes':_0x4a1922['attributes']};}):[]};}):[]};}):[]:[]})[_0x3b32('0x25')](function(_0x6d817f){logger['info'](_0x3b32('0x26'),_0x5eddce);logger[_0x3b32('0x14')](_0x3b32('0x26'),_0x5eddce,JSON[_0x3b32('0x16')](_0x6d817f));_0x19020e(_0x6d817f);})['catch'](function(_0x21c8cb){logger[_0x3b32('0x17')](_0x3b32('0x26'),_0x21c8cb[_0x3b32('0x19')],_0x5eddce);_0x345478(_0x1c6a40[_0x3b32('0x17')](0x1f4,_0x21c8cb[_0x3b32('0x19')]));});});};exports[_0x3b32('0x27')]=function(_0x407a62){var _0xa8a3cc=this;return new Promise(function(_0x585835,_0x3c6ad3){return db[_0x3b32('0x1b')][_0x3b32('0x28')](_0x407a62['body'],{'raw':_0x407a62[_0x3b32('0x1d')]?_0x407a62[_0x3b32('0x1d')][_0x3b32('0x1e')]===undefined?!![]:![]:!![]})[_0x3b32('0x25')](function(_0x2d4091){logger['info'](_0x3b32('0x27'),_0x407a62);logger[_0x3b32('0x14')](_0x3b32('0x27'),_0x407a62,JSON[_0x3b32('0x16')](_0x2d4091));_0x585835(_0x2d4091);})[_0x3b32('0x29')](function(_0x443dec){logger['error']('CreateVoiceQueueReport',_0x443dec[_0x3b32('0x19')],_0x407a62);_0x3c6ad3(_0xa8a3cc[_0x3b32('0x17')](0x1f4,_0x443dec['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x152f27){var _0x18e0e7=this;return new Promise(function(_0x3f600c,_0x167771){return db[_0x3b32('0x1b')][_0x3b32('0x2a')](_0x152f27[_0x3b32('0x2b')],{'raw':_0x152f27[_0x3b32('0x1d')]?_0x152f27[_0x3b32('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x152f27[_0x3b32('0x1d')]?_0x152f27[_0x3b32('0x1d')][_0x3b32('0x1f')]||null:null,'attributes':_0x152f27[_0x3b32('0x1d')]?_0x152f27[_0x3b32('0x1d')]['attributes']||null:null,'limit':_0x152f27[_0x3b32('0x1d')]?_0x152f27[_0x3b32('0x1d')][_0x3b32('0x21')]||null:null})[_0x3b32('0x25')](function(_0x4a79c7){logger['info']('UpdateVoiceQueueReport',_0x152f27);logger[_0x3b32('0x14')]('UpdateVoiceQueueReport',_0x152f27,JSON['stringify'](_0x4a79c7));_0x3f600c(_0x4a79c7);})['catch'](function(_0x5153ed){logger[_0x3b32('0x17')]('UpdateVoiceQueueReport',_0x5153ed[_0x3b32('0x19')],_0x152f27);_0x167771(_0x18e0e7['error'](0x1f4,_0x5153ed[_0x3b32('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 3bb08aa..234259e 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 _0xa994=['./voiceQueueReport.events','save','remove','update','emit','removeListener','register','length'];(function(_0x392e28,_0xacb4d3){var _0x14263b=function(_0x2f478a){while(--_0x2f478a){_0x392e28['push'](_0x392e28['shift']());}};_0x14263b(++_0xacb4d3);}(_0xa994,0x140));var _0x4a99=function(_0x42e569,_0xf64d0a){_0x42e569=_0x42e569-0x0;var _0xab8f42=_0xa994[_0x42e569];return _0xab8f42;};'use strict';var VoiceQueueReportEvents=require(_0x4a99('0x0'));var events=[_0x4a99('0x1'),_0x4a99('0x2'),_0x4a99('0x3')];function createListener(_0x18992e,_0x26dacf){return function(_0x37be96){_0x26dacf[_0x4a99('0x4')](_0x18992e,_0x37be96);};}function removeListener(_0x1e9914,_0xfa99ed){return function(){VoiceQueueReportEvents[_0x4a99('0x5')](_0x1e9914,_0xfa99ed);};}exports[_0x4a99('0x6')]=function(_0x5e3237){for(var _0xd3c739=0x0,_0x3d2643=events[_0x4a99('0x7')];_0xd3c739<_0x3d2643;_0xd3c739++){var _0xe477eb=events[_0xd3c739];var _0x567c1d=createListener('voiceQueueReport:'+_0xe477eb,_0x5e3237);VoiceQueueReportEvents['on'](_0xe477eb,_0x567c1d);}}; \ No newline at end of file +var _0xe9e2=['./voiceQueueReport.events','save','remove','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x1bb664,_0x556888){var _0x4635d9=function(_0x4b7d01){while(--_0x4b7d01){_0x1bb664['push'](_0x1bb664['shift']());}};_0x4635d9(++_0x556888);}(_0xe9e2,0xc6));var _0x2e9e=function(_0x36ba80,_0x284c26){_0x36ba80=_0x36ba80-0x0;var _0x135582=_0xe9e2[_0x36ba80];return _0x135582;};'use strict';var VoiceQueueReportEvents=require(_0x2e9e('0x0'));var events=[_0x2e9e('0x1'),_0x2e9e('0x2'),_0x2e9e('0x3')];function createListener(_0x2e0946,_0x533f75){return function(_0x2071c5){_0x533f75[_0x2e9e('0x4')](_0x2e0946,_0x2071c5);};}function removeListener(_0x5f2982,_0x7e25d2){return function(){VoiceQueueReportEvents[_0x2e9e('0x5')](_0x5f2982,_0x7e25d2);};}exports[_0x2e9e('0x6')]=function(_0x20f2a9){for(var _0x4ac7d7=0x0,_0x55c6ae=events[_0x2e9e('0x7')];_0x4ac7d7<_0x55c6ae;_0x4ac7d7++){var _0x49bb9e=events[_0x4ac7d7];var _0x5759d2=createListener(_0x2e9e('0x8')+_0x49bb9e,_0x20f2a9);VoiceQueueReportEvents['on'](_0x49bb9e,_0x5759d2);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 3390dba..427e978 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 _0x282f=['../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x405a25,_0x3c63ad){var _0x47b219=function(_0x43bcbd){while(--_0x43bcbd){_0x405a25['push'](_0x405a25['shift']());}};_0x47b219(++_0x3c63ad);}(_0x282f,0x109));var _0xf282=function(_0x1e98cf,_0x27c66f){_0x1e98cf=_0x1e98cf-0x0;var _0x2ee7b6=_0x282f[_0x1e98cf];return _0x2ee7b6;};'use strict';var multer=require('multer');var util=require(_0xf282('0x0'));var path=require(_0xf282('0x1'));var timeout=require(_0xf282('0x2'));var express=require(_0xf282('0x3'));var router=express[_0xf282('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf282('0x5'));var config=require(_0xf282('0x6'));var controller=require(_0xf282('0x7'));router[_0xf282('0x8')]('/',auth[_0xf282('0x9')](),controller[_0xf282('0xa')]);router[_0xf282('0x8')](_0xf282('0xb'),auth[_0xf282('0x9')](),controller['show']);router[_0xf282('0xc')]('/',auth[_0xf282('0x9')](),controller[_0xf282('0xd')]);router[_0xf282('0xe')](_0xf282('0xb'),auth['isAuthenticated'](),controller[_0xf282('0xf')]);router[_0xf282('0x10')](_0xf282('0xb'),auth[_0xf282('0x9')](),controller[_0xf282('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa786=['index','/:id','show','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x450cf0,_0x183637){var _0x173655=function(_0xd5596d){while(--_0xd5596d){_0x450cf0['push'](_0x450cf0['shift']());}};_0x173655(++_0x183637);}(_0xa786,0x1d2));var _0x6a78=function(_0x29c368,_0x82162b){_0x29c368=_0x29c368-0x0;var _0x5f3c39=_0xa786[_0x29c368];return _0x5f3c39;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6a78('0x0'));var timeout=require(_0x6a78('0x1'));var express=require(_0x6a78('0x2'));var router=express[_0x6a78('0x3')]();var auth=require(_0x6a78('0x4'));var interaction=require(_0x6a78('0x5'));var config=require(_0x6a78('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0x6a78('0x7')]('/',auth[_0x6a78('0x8')](),controller[_0x6a78('0x9')]);router[_0x6a78('0x7')](_0x6a78('0xa'),auth[_0x6a78('0x8')](),controller[_0x6a78('0xb')]);router[_0x6a78('0xc')]('/',auth[_0x6a78('0x8')](),controller[_0x6a78('0xd')]);router[_0x6a78('0xe')](_0x6a78('0xa'),auth[_0x6a78('0x8')](),controller[_0x6a78('0xf')]);router[_0x6a78('0x10')](_0x6a78('0xa'),auth[_0x6a78('0x8')](),controller[_0x6a78('0x11')]);module[_0x6a78('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 642be31..10d56bd 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 _0xeab9=['STRING','DATE','moment','exports'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xeab9,0x7e));var _0x9eab=function(_0x40c7cd,_0x8828d){_0x40c7cd=_0x40c7cd-0x0;var _0x2254b4=_0xeab9[_0x40c7cd];return _0x2254b4;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9eab('0x0'));module[_0x9eab('0x1')]={'time':{'type':Sequelize[_0x9eab('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x9eab('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x9eab('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x9eab('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x9eab('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x9eab('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x9eab('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x9eab('0x3')],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x9d00=['YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING'];(function(_0x425f7b,_0x64101c){var _0x110fd6=function(_0x139292){while(--_0x139292){_0x425f7b['push'](_0x425f7b['shift']());}};_0x110fd6(++_0x64101c);}(_0x9d00,0x191));var _0x09d0=function(_0x27bbc7,_0x3bdaa5){_0x27bbc7=_0x27bbc7-0x0;var _0x4441e2=_0x9d00[_0x27bbc7];return _0x4441e2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x09d0('0x0'));module[_0x09d0('0x1')]={'time':{'type':Sequelize[_0x09d0('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x09d0('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x09d0('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x09d0('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x09d0('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x09d0('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x09d0('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format'](_0x09d0('0x3'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 96deebf..2a530f9 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x4a1cf7,_0x4ee506){var _0x17caad=function(_0x3586d2){while(--_0x3586d2){_0x4a1cf7['push'](_0x4a1cf7['shift']());}};_0x17caad(++_0x4ee506);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xb10b=['where','merge','VoiceQueuesLog','include','rows','catch','show','params','includeAll','options','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x421c4b,_0x5df9e8){var _0x177258=function(_0x6c354a){while(--_0x6c354a){_0x421c4b['push'](_0x421c4b['shift']());}};_0x177258(++_0x5df9e8);}(_0xb10b,0x12a));var _0xbb10=function(_0x57cf37,_0x149b89){_0x57cf37=_0x57cf37-0x0;var _0x2df46f=_0xb10b[_0x57cf37];return _0x2df46f;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['VoiceQueuesLog'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]),_0x20d946);if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));};exports[_0xbb10('0x3f')]=function(_0x5f3d67,_0x1e8f79){var _0x1c7fae={'raw':!![],'where':{'id':_0x5f3d67[_0xbb10('0x40')]['id']}},_0x3e7b4c={};_0x3e7b4c['model']=_[_0xbb10('0x2d')](db[_0xbb10('0x3b')][_0xbb10('0x28')]);_0x3e7b4c[_0xbb10('0x30')]=_['keys'](_0x5f3d67[_0xbb10('0x30')]);_0x3e7b4c[_0xbb10('0x2e')]=_['intersection'](_0x3e7b4c['model'],_0x3e7b4c[_0xbb10('0x30')]);_0x1c7fae['attributes']=_[_0xbb10('0x2f')](_0x3e7b4c[_0xbb10('0x2c')],qs['fields'](_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x31')]));_0x1c7fae[_0xbb10('0x32')]=_0x1c7fae['attributes'][_0xbb10('0x33')]?_0x1c7fae[_0xbb10('0x32')]:_0x3e7b4c[_0xbb10('0x2c')];if(_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x41')]){_0x1c7fae[_0xbb10('0x3c')]=[{'all':!![]}];}_0x1c7fae=_[_0xbb10('0x3a')]({},_0x1c7fae,_0x5f3d67[_0xbb10('0x42')]);return db[_0xbb10('0x3b')][_0xbb10('0x43')](_0x1c7fae)[_0xbb10('0x23')](handleEntityNotFound(_0x1e8f79,null))[_0xbb10('0x23')](respondWithResult(_0x1e8f79,null))['catch'](handleError(_0x1e8f79,null));};exports[_0xbb10('0x44')]=function(_0x41bbf8,_0x4a1248){return db[_0xbb10('0x3b')][_0xbb10('0x44')](_0x41bbf8[_0xbb10('0x45')],{})[_0xbb10('0x23')](respondWithResult(_0x4a1248,0xc9))[_0xbb10('0x3e')](handleError(_0x4a1248,null));};exports[_0xbb10('0x46')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x45')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x45')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x3e')](handleError(_0x5be85e,null));};exports[_0xbb10('0x24')]=function(_0x22b315,_0x2f2552){return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x22b315[_0xbb10('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f2552,null))['then'](removeEntity(_0x2f2552,null))[_0xbb10('0x3e')](handleError(_0x2f2552,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index c23d235..ab06ae2 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 _0xfb65=['VoiceQueuesLog','voice_queues_log','event_dtm','dtm','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define'];(function(_0x41092c,_0x233b3f){var _0xc2384b=function(_0x168664){while(--_0x168664){_0x41092c['push'](_0x41092c['shift']());}};_0xc2384b(++_0x233b3f);}(_0xfb65,0x82));var _0x5fb6=function(_0x5490db,_0x1282d6){_0x5490db=_0x5490db-0x0;var _0x4fc50b=_0xfb65[_0x5490db];return _0x4fc50b;};'use strict';var _=require('lodash');var util=require(_0x5fb6('0x0'));var logger=require(_0x5fb6('0x1'))('api');var moment=require(_0x5fb6('0x2'));var BPromise=require('bluebird');var rp=require(_0x5fb6('0x3'));var fs=require('fs');var path=require(_0x5fb6('0x4'));var rimraf=require(_0x5fb6('0x5'));var config=require(_0x5fb6('0x6'));var attributes=require(_0x5fb6('0x7'));module[_0x5fb6('0x8')]=function(_0x4dec8f,_0x50782b){return _0x4dec8f[_0x5fb6('0x9')](_0x5fb6('0xa'),attributes,{'tableName':_0x5fb6('0xb'),'paranoid':![],'indexes':[{'name':_0x5fb6('0xc'),'fields':['event',_0x5fb6('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xafc4=['bluebird','request-promise','path','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','lodash','../../config/logger','moment'];(function(_0x2dd21f,_0x58a4b6){var _0x26536f=function(_0x2e6d28){while(--_0x2e6d28){_0x2dd21f['push'](_0x2dd21f['shift']());}};_0x26536f(++_0x58a4b6);}(_0xafc4,0x69));var _0x4afc=function(_0x3e1db8,_0xe3d569){_0x3e1db8=_0x3e1db8-0x0;var _0x4b60fd=_0xafc4[_0x3e1db8];return _0x4b60fd;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x4afc('0xa'),_0x4afc('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 30ea41d..5f70c1a 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 _0xbfcc=['VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','info'];(function(_0xcb1dd8,_0x3e174d){var _0x599c95=function(_0x44a84c){while(--_0x44a84c){_0xcb1dd8['push'](_0xcb1dd8['shift']());}};_0x599c95(++_0x3e174d);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xbfcc[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcbfc('0x1'));var rs=require(_0xcbfc('0x2'));var fs=require('fs');var Redis=require(_0xcbfc('0x3'));var db=require(_0xcbfc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcbfc('0x5'));var client=jayson[_0xcbfc('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3917,_0x5a2be0,_0x2ea130){return new BPromise(function(_0x1f8b71,_0x1b1377){return client[_0xcbfc('0x7')](_0x1b3917,_0x2ea130)['then'](function(_0x2e7097){logger[_0xcbfc('0x8')](_0xcbfc('0x9'),_0x5a2be0,_0xcbfc('0xa'));logger[_0xcbfc('0xb')](_0xcbfc('0xc'),_0x5a2be0,'request\x20sent',JSON[_0xcbfc('0xd')](_0x2e7097));if(_0x2e7097[_0xcbfc('0xe')]){if(_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0xf')]===0x1f4){logger[_0xcbfc('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5a2be0,_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0x10')]);return _0x1b1377(_0x2e7097[_0xcbfc('0xe')]['message']);}logger[_0xcbfc('0xe')](_0xcbfc('0x9'),_0x5a2be0,_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0x10')]);return _0x1f8b71(_0x2e7097[_0xcbfc('0xe')]['message']);}else{logger[_0xcbfc('0x8')](_0xcbfc('0x9'),_0x5a2be0,_0xcbfc('0xa'));_0x1f8b71(_0x2e7097[_0xcbfc('0x11')]['message']);}})['catch'](function(_0x418f18){logger[_0xcbfc('0xe')](_0xcbfc('0x9'),_0x5a2be0,_0x418f18);_0x1b1377(_0x418f18);});});} \ No newline at end of file +var _0xae60=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x197ec5,_0x245b96){var _0x13ef62=function(_0x409f78){while(--_0x409f78){_0x197ec5['push'](_0x197ec5['shift']());}};_0x13ef62(++_0x245b96);}(_0xae60,0x1c7));var _0x0ae6=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xae60[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var moment=require(_0x0ae6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ae6('0x3'));var fs=require('fs');var Redis=require(_0x0ae6('0x4'));var db=require(_0x0ae6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ae6('0x6'))(_0x0ae6('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ae6('0x8'));var client=jayson[_0x0ae6('0x9')][_0x0ae6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46fed4,_0xbb596c,_0x447a1d){return new BPromise(function(_0x120910,_0x1b5e80){return client['request'](_0x46fed4,_0x447a1d)[_0x0ae6('0xb')](function(_0x36a5e0){logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,'request\x20sent');logger[_0x0ae6('0xe')](_0x0ae6('0xf'),_0xbb596c,_0x0ae6('0x10'),JSON[_0x0ae6('0x11')](_0x36a5e0));if(_0x36a5e0[_0x0ae6('0x12')]){if(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x13')]===0x1f4){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x1b5e80(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}logger[_0x0ae6('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x120910(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}else{logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,_0x0ae6('0x10'));_0x120910(_0x36a5e0[_0x0ae6('0x15')][_0x0ae6('0x14')]);}})[_0x0ae6('0x16')](function(_0x8a4c9a){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x8a4c9a);_0x1b5e80(_0x8a4c9a);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 59d9816..948daf4 100644 --- a/server/api/voiceRecording/index.js +++ b/server/api/voiceRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x15d55d,_0x5ac565){var _0x3a6867=function(_0x4d2deb){while(--_0x4d2deb){_0x15d55d['push'](_0x15d55d['shift']());}};_0x3a6867(++_0x5ac565);}(_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('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x2ba573,_0x25c00b){var _0x588b98=function(_0x585994){while(--_0x585994){_0x2ba573['push'](_0x2ba573['shift']());}};_0x588b98(++_0x25c00b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index f17f7ac..02274c6 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 _0x4d6b=['getDataValue','extname','STRING','membername','split','TEXT','NEW','FLOAT','BOOLEAN','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','exports','VIRTUAL'];(function(_0x20b5ac,_0x34501d){var _0xd8845=function(_0x2d1ba5){while(--_0x2d1ba5){_0x20b5ac['push'](_0x20b5ac['shift']());}};_0xd8845(++_0x34501d);}(_0x4d6b,0x152));var _0xb4d6=function(_0x2e8874,_0x13cd6c){_0x2e8874=_0x2e8874-0x0;var _0x4ca0cb=_0x4d6b[_0x2e8874];return _0x4ca0cb;};'use strict';var Sequelize=require(_0xb4d6('0x0'));var moment=require(_0xb4d6('0x1'));var path=require('path');module[_0xb4d6('0x2')]={'format':{'type':Sequelize[_0xb4d6('0x3')],'get':function(){return this[_0xb4d6('0x4')]('value')?path[_0xb4d6('0x5')](this[_0xb4d6('0x4')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0xb4d6('0x6')]},'channel':{'type':Sequelize[_0xb4d6('0x6')],'set':function(_0xba75ca){if(_0xba75ca){this['setDataValue']('channel',_0xba75ca);this['setDataValue'](_0xb4d6('0x7'),_0xba75ca[_0xb4d6('0x8')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xb4d6('0x6')]},'calleridnum':{'type':Sequelize[_0xb4d6('0x6')]},'calleridname':{'type':Sequelize[_0xb4d6('0x6')]},'connectedlinenum':{'type':Sequelize[_0xb4d6('0x6')]},'connectedlinename':{'type':Sequelize[_0xb4d6('0x6')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb4d6('0x6')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xb4d6('0x6')]},'type':{'type':Sequelize[_0xb4d6('0x6')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xb4d6('0x6')]},'userDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0xb4d6('0x9')]},'transcribeName':{'type':Sequelize[_0xb4d6('0x6')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0xb4d6('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0xb4d6('0x9')]},'sentiment':{'type':Sequelize[_0xb4d6('0x6')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0xb4d6('0xb')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0xb4d6('0xb')]},'tempSentiment':{'type':Sequelize[_0xb4d6('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xb4d6('0xd')],'get':function(){return moment(this[_0xb4d6('0x4')]('createdAt'))[_0xb4d6('0xe')](_0xb4d6('0xf'))[_0xb4d6('0x10')]();}},'updatedAt':{'type':Sequelize[_0xb4d6('0xd')],'get':function(){return moment(this[_0xb4d6('0x4')](_0xb4d6('0x11')))['format'](_0xb4d6('0xf'))[_0xb4d6('0x10')]();}}}; \ No newline at end of file +var _0xf11d=['path','exports','getDataValue','value','extname','setDataValue','channel','membername','STRING','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','format','toString','DATE','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','moment'];(function(_0x16eb19,_0x58cea4){var _0x312a25=function(_0x343702){while(--_0x343702){_0x16eb19['push'](_0x16eb19['shift']());}};_0x312a25(++_0x58cea4);}(_0xf11d,0x7c));var _0xdf11=function(_0x5a04d7,_0x10866a){_0x5a04d7=_0x5a04d7-0x0;var _0x11eaa6=_0xf11d[_0x5a04d7];return _0x11eaa6;};'use strict';var Sequelize=require(_0xdf11('0x0'));var moment=require(_0xdf11('0x1'));var path=require(_0xdf11('0x2'));module[_0xdf11('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xdf11('0x4')](_0xdf11('0x5'))?path[_0xdf11('0x6')](this['getDataValue']('value')):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING'],'set':function(_0x24ed37){if(_0x24ed37){this[_0xdf11('0x7')](_0xdf11('0x8'),_0x24ed37);this['setDataValue'](_0xdf11('0x9'),_0x24ed37['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xdf11('0xa')]},'calleridname':{'type':Sequelize[_0xdf11('0xa')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xdf11('0xa')]},'accountcode':{'type':Sequelize[_0xdf11('0xa')]},'context':{'type':Sequelize[_0xdf11('0xa')]},'exten':{'type':Sequelize[_0xdf11('0xa')]},'value':{'type':Sequelize[_0xdf11('0xa')]},'type':{'type':Sequelize[_0xdf11('0xa')]},'rating':{'type':Sequelize[_0xdf11('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xdf11('0xa')]},'userDisposition':{'type':Sequelize[_0xdf11('0xa')]},'location':{'type':Sequelize[_0xdf11('0xc')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0xdf11('0xa')],'defaultValue':_0xdf11('0xd')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0xdf11('0xc')]},'failureReason':{'type':Sequelize[_0xdf11('0xc')]},'sentiment':{'type':Sequelize[_0xdf11('0xa')]},'sPositive':{'type':Sequelize[_0xdf11('0xe')]},'sNegative':{'type':Sequelize[_0xdf11('0xe')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0xdf11('0xe')]},'tempSentiment':{'type':Sequelize[_0xdf11('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xdf11('0x4')]('createdAt'))[_0xdf11('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xdf11('0x11')]();}},'updatedAt':{'type':Sequelize[_0xdf11('0x12')],'get':function(){return moment(this[_0xdf11('0x4')](_0xdf11('0x13')))[_0xdf11('0x10')](_0xdf11('0x14'))[_0xdf11('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index f6437db..e796dd6 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 _0x0a80=['params','fields','find','create','body','describe','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','decryptFile','Sequelize','filename','extname','unlink','download','message','Not\x20found','downloads','sequelize','MD5','$and','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','destroy','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','update','then','sendStatus','error','stack','name','send','index','map','fieldName','type','model','differenceBy','query','keys','intersection','attributes','hasOwnProperty','order','sort','where','pick','filters','filter','merge','options','VoiceRecording','count','includeAll','include','findAll','rows','catch'];(function(_0x48c79b,_0xd6638a){var _0x3b4538=function(_0x1734a1){while(--_0x1734a1){_0x48c79b['push'](_0x48c79b['shift']());}};_0x3b4538(++_0xd6638a);}(_0x0a80,0xdf));var _0x00a8=function(_0x4a0c28,_0x558479){_0x4a0c28=_0x4a0c28-0x0;var _0x27aead=_0x0a80[_0x4a0c28];return _0x27aead;};'use strict';var pdf=require(_0x00a8('0x0'));var emlformat=require(_0x00a8('0x1'));var rimraf=require(_0x00a8('0x2'));var zipdir=require(_0x00a8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x00a8('0x4'));var moment=require(_0x00a8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x00a8('0x6'));var util=require(_0x00a8('0x7'));var path=require(_0x00a8('0x8'));var sox=require(_0x00a8('0x9'));var csv=require(_0x00a8('0xa'));var ejs=require(_0x00a8('0xb'));var fs=require('fs');var _=require(_0x00a8('0xc'));var squel=require(_0x00a8('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x00a8('0xe'));var toCsv=require(_0x00a8('0xa'));var querystring=require(_0x00a8('0xf'));var Papa=require(_0x00a8('0x10'));var AWS=require(_0x00a8('0x11'));var uuidv4=require(_0x00a8('0x12'));var Redis=require(_0x00a8('0x13'));var authService=require(_0x00a8('0x14'));var qs=require(_0x00a8('0x15'));var as=require(_0x00a8('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x00a8('0x17'));var utils=require(_0x00a8('0x18'));var config=require('../../config/environment');var db=require(_0x00a8('0x19'))['db'];function respondWithStatusCode(_0x56fcbd,_0x511db0){_0x511db0=_0x511db0||0xcc;return function(_0x560f50){if(_0x560f50){return _0x56fcbd['sendStatus'](_0x511db0);}return _0x56fcbd[_0x00a8('0x1a')](_0x511db0)[_0x00a8('0x1b')]();};}function respondWithResult(_0x2eab76,_0x27b37b){_0x27b37b=_0x27b37b||0xc8;return function(_0x553917){if(_0x553917){return _0x2eab76[_0x00a8('0x1a')](_0x27b37b)[_0x00a8('0x1c')](_0x553917);}};}function respondWithFilteredResult(_0x50f43b,_0x2ff810){return function(_0x3ca09e){if(_0x3ca09e){var _0x253c54=_0x3ca09e['count'],_0x5ed9a0=_0x2ff810[_0x00a8('0x1d')],_0x191be5=_0x2ff810['offset']+_0x2ff810[_0x00a8('0x1e')],_0x501e77;if(_0x191be5>=_0x253c54){_0x191be5=_0x253c54;_0x501e77=0xc8;}else{_0x501e77=0xce;}_0x50f43b[_0x00a8('0x1a')](_0x501e77);return _0x50f43b[_0x00a8('0x1f')](_0x00a8('0x20'),_0x5ed9a0+'-'+_0x191be5+'/'+_0x253c54)[_0x00a8('0x1c')](_0x3ca09e);}return null;};}function patchUpdates(_0x210d12){return function(_0x34a2b7){try{jsonpatch[_0x00a8('0x21')](_0x34a2b7,_0x210d12,!![]);}catch(_0x1ad683){return BPromise['reject'](_0x1ad683);}return _0x34a2b7['save']();};}function saveUpdates(_0x561553,_0x35c790){return function(_0x3c778b){if(_0x3c778b){return _0x3c778b[_0x00a8('0x22')](_0x561553)[_0x00a8('0x23')](function(_0x3125d1){return _0x3125d1;});}return null;};}function removeEntity(_0x1eab6d,_0x3e923e){return function(_0x51a8ae){if(_0x51a8ae){return _0x51a8ae['destroy']()[_0x00a8('0x23')](function(){_0x1eab6d[_0x00a8('0x1a')](0xcc)[_0x00a8('0x1b')]();});}};}function handleEntityNotFound(_0x2d977b,_0x2590ac){return function(_0x3253b7){if(!_0x3253b7){_0x2d977b[_0x00a8('0x24')](0x194);}return _0x3253b7;};}function handleError(_0x24e5bf,_0x2b9a04){_0x2b9a04=_0x2b9a04||0x1f4;return function(_0x3d6390){logger[_0x00a8('0x25')](_0x3d6390[_0x00a8('0x26')]);if(_0x3d6390[_0x00a8('0x27')]){delete _0x3d6390['name'];}_0x24e5bf[_0x00a8('0x1a')](_0x2b9a04)[_0x00a8('0x28')](_0x3d6390);};}exports[_0x00a8('0x29')]=function(_0x1b5650,_0x464a7e){var _0x1258a4={},_0x2cb4fa={},_0x24f299={'count':0x0,'rows':[]};var _0x2fabd8=_[_0x00a8('0x2a')](db['VoiceRecording']['rawAttributes'],function(_0x4acc36){return{'name':_0x4acc36[_0x00a8('0x2b')],'type':_0x4acc36[_0x00a8('0x2c')]['key']};});_0x2cb4fa[_0x00a8('0x2d')]=_[_0x00a8('0x2e')](_[_0x00a8('0x2a')](_0x2fabd8,_0x00a8('0x27')),['format']);_0x2cb4fa[_0x00a8('0x2f')]=_[_0x00a8('0x30')](_0x1b5650[_0x00a8('0x2f')]);_0x2cb4fa['filters']=_[_0x00a8('0x31')](_0x2cb4fa['model'],_0x2cb4fa[_0x00a8('0x2f')]);_0x1258a4[_0x00a8('0x32')]=_[_0x00a8('0x31')](_0x2cb4fa[_0x00a8('0x2d')],qs['fields'](_0x1b5650[_0x00a8('0x2f')]['fields']));_0x1258a4[_0x00a8('0x32')]=_0x1258a4['attributes']['length']?_0x1258a4[_0x00a8('0x32')]:_0x2cb4fa[_0x00a8('0x2d')];if(!_0x1b5650[_0x00a8('0x2f')][_0x00a8('0x33')]('nolimit')){_0x1258a4[_0x00a8('0x1e')]=qs['limit'](_0x1b5650[_0x00a8('0x2f')]['limit']);_0x1258a4[_0x00a8('0x1d')]=qs['offset'](_0x1b5650[_0x00a8('0x2f')][_0x00a8('0x1d')]);}_0x1258a4[_0x00a8('0x34')]=qs[_0x00a8('0x35')](_0x1b5650['query'][_0x00a8('0x35')]);_0x1258a4[_0x00a8('0x36')]=qs['filters'](_[_0x00a8('0x37')](_0x1b5650[_0x00a8('0x2f')],_0x2cb4fa[_0x00a8('0x38')]),_0x2fabd8);if(_0x1b5650[_0x00a8('0x2f')][_0x00a8('0x39')]){_0x1258a4['where']=_['merge'](_0x1258a4['where'],{'$or':_['map'](_0x2fabd8,function(_0x409029){if(_0x409029[_0x00a8('0x2c')]!=='VIRTUAL'){var _0x28bce0={};_0x28bce0[_0x409029['name']]={'$like':'%'+_0x1b5650['query'][_0x00a8('0x39')]+'%'};return _0x28bce0;}})});}_0x1258a4=_[_0x00a8('0x3a')]({},_0x1258a4,_0x1b5650[_0x00a8('0x3b')]);var _0x364e50={'where':_0x1258a4[_0x00a8('0x36')]};return db[_0x00a8('0x3c')][_0x00a8('0x3d')](_0x364e50)[_0x00a8('0x23')](function(_0x19f03c){_0x24f299[_0x00a8('0x3d')]=_0x19f03c;if(_0x1b5650[_0x00a8('0x2f')][_0x00a8('0x3e')]){_0x1258a4[_0x00a8('0x3f')]=[{'all':!![]}];}return db['VoiceRecording'][_0x00a8('0x40')](_0x1258a4);})[_0x00a8('0x23')](function(_0x43512c){_0x24f299[_0x00a8('0x41')]=_0x43512c;return _0x24f299;})['then'](respondWithFilteredResult(_0x464a7e,_0x1258a4))[_0x00a8('0x42')](handleError(_0x464a7e,null));};exports['show']=function(_0x57159b,_0x47ff7a){var _0x32de7b={'raw':![],'where':{'id':_0x57159b[_0x00a8('0x43')]['id']}},_0x505a43={};_0x505a43[_0x00a8('0x2d')]=_['keys'](db['VoiceRecording']['rawAttributes']);_0x505a43[_0x00a8('0x2f')]=_[_0x00a8('0x30')](_0x57159b[_0x00a8('0x2f')]);_0x505a43['filters']=_[_0x00a8('0x31')](_0x505a43[_0x00a8('0x2d')],_0x505a43[_0x00a8('0x2f')]);_0x32de7b[_0x00a8('0x32')]=_['intersection'](_0x505a43[_0x00a8('0x2d')],qs[_0x00a8('0x44')](_0x57159b[_0x00a8('0x2f')][_0x00a8('0x44')]));_0x32de7b[_0x00a8('0x32')]=_0x32de7b[_0x00a8('0x32')]['length']?_0x32de7b[_0x00a8('0x32')]:_0x505a43[_0x00a8('0x2d')];if(_0x57159b[_0x00a8('0x2f')][_0x00a8('0x3e')]){_0x32de7b['include']=[{'all':!![]}];}_0x32de7b=_['merge']({},_0x32de7b,_0x57159b[_0x00a8('0x3b')]);return db[_0x00a8('0x3c')][_0x00a8('0x45')](_0x32de7b)[_0x00a8('0x23')](handleEntityNotFound(_0x47ff7a,null))[_0x00a8('0x23')](respondWithResult(_0x47ff7a,null))[_0x00a8('0x42')](handleError(_0x47ff7a,null));};exports[_0x00a8('0x46')]=function(_0x4f7e7f,_0x193ee1){return db[_0x00a8('0x3c')][_0x00a8('0x46')](_0x4f7e7f['body'],{})[_0x00a8('0x23')](respondWithResult(_0x193ee1,0xc9))[_0x00a8('0x42')](handleError(_0x193ee1,null));};exports[_0x00a8('0x22')]=function(_0x3b41fd,_0xc795a7){if(_0x3b41fd[_0x00a8('0x47')]['id']){delete _0x3b41fd[_0x00a8('0x47')]['id'];}return db[_0x00a8('0x3c')][_0x00a8('0x45')]({'where':{'id':_0x3b41fd[_0x00a8('0x43')]['id']}})[_0x00a8('0x23')](handleEntityNotFound(_0xc795a7,null))[_0x00a8('0x23')](saveUpdates(_0x3b41fd[_0x00a8('0x47')],null))[_0x00a8('0x23')](respondWithResult(_0xc795a7,null))[_0x00a8('0x42')](handleError(_0xc795a7,null));};exports[_0x00a8('0x48')]=function(_0x9229d3,_0x122e55){return db[_0x00a8('0x3c')][_0x00a8('0x48')]()[_0x00a8('0x23')](respondWithResult(_0x122e55,null))[_0x00a8('0x42')](handleError(_0x122e55,null));};exports['download']=function(_0x3dd26f,_0x4b7d25,_0x19c063){var _0x1ef8f7=require(_0x00a8('0x49'));var _0x154233=![];var _0x356954={};if(_0x3dd26f[_0x00a8('0x2f')][_0x00a8('0x2c')]&&_0x3dd26f['query'][_0x00a8('0x2c')]==='uniqueid'){_0x356954[_0x00a8('0x4a')]=_0x3dd26f[_0x00a8('0x43')]['id'];}else{_0x356954['id']=_0x3dd26f[_0x00a8('0x43')]['id'];}return db[_0x00a8('0x3c')][_0x00a8('0x45')]({'where':_0x356954,'attributes':['id','value'],'raw':!![]})[_0x00a8('0x23')](handleEntityNotFound(_0x4b7d25,null))[_0x00a8('0x23')](function(_0x24bcbe){if(_0x24bcbe){var _0x19d148=_0x24bcbe[_0x00a8('0x4b')];var _0x18bc5d=util[_0x00a8('0x4c')](_0x00a8('0x4d'),_0x19d148);if(fs[_0x00a8('0x4e')](_0x18bc5d)){_0x154233=!![];return _0x1ef8f7[_0x00a8('0x4f')](_0x18bc5d,_0x19d148,config['secrets']['recording'])[_0x00a8('0x23')](function(){return _0x24bcbe;});}return _0x24bcbe;}})[_0x00a8('0x23')](function(_0x11ffa9){if(_0x11ffa9){var _0x1c7b02=_0x11ffa9[_0x00a8('0x4b')];if(!fs[_0x00a8('0x4e')](_0x1c7b02)){throw new db[(_0x00a8('0x50'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x11ffa9[_0x00a8('0x51')]){return _0x4b7d25['download'](_0x1c7b02,_0x11ffa9[_0x00a8('0x51')]+path[_0x00a8('0x52')](_0x1c7b02),function(){if(_0x154233){fs[_0x00a8('0x53')](_0x1c7b02);}});}else{return _0x4b7d25[_0x00a8('0x54')](_0x1c7b02,function(_0xc2cf9b){if(_0x154233){fs[_0x00a8('0x53')](_0x1c7b02);}});}}})[_0x00a8('0x42')](function(_0xcc7f00){if(_0xcc7f00[_0x00a8('0x55')]==='VoiceRecording\x20not\x20found'){_0x4b7d25[_0x00a8('0x1a')](0x194)[_0x00a8('0x28')](_0x00a8('0x56'));}else{return handleError(_0x4b7d25,null);}});};exports[_0x00a8('0x57')]=function(_0x2d1d97,_0xf96658,_0x58ce7f){var _0xfb9169=require(_0x00a8('0x49'));var _0x432e09=![];var _0x33c1d3={'$and':[db[_0x00a8('0x58')][_0x00a8('0x36')](db[_0x00a8('0x58')]['fn'](_0x00a8('0x59'),db[_0x00a8('0x58')]['col']('uniqueid')),_0x2d1d97['query']['token'])]};if(_0x2d1d97[_0x00a8('0x2f')]['type']&&_0x2d1d97[_0x00a8('0x2f')]['type']===_0x00a8('0x4a')){_0x33c1d3[_0x00a8('0x5a')]['push']({'uniqueid':_0x2d1d97['params']['id']});}else{_0x33c1d3[_0x00a8('0x5a')]['push']({'id':_0x2d1d97[_0x00a8('0x43')]['id']});}return db[_0x00a8('0x3c')][_0x00a8('0x45')]({'where':_0x33c1d3,'attributes':['id',_0x00a8('0x4b')],'raw':!![]})[_0x00a8('0x23')](handleEntityNotFound(_0xf96658,null))['then'](function(_0x33eb9a){if(_0x33eb9a){var _0x560154=util[_0x00a8('0x4c')](_0x00a8('0x4d'),_0x33eb9a[_0x00a8('0x4b')]);if(fs[_0x00a8('0x4e')](_0x560154)){_0x432e09=!![];return _0xfb9169['decryptFile'](_0x560154,_0x33eb9a['value'],config[_0x00a8('0x5b')][_0x00a8('0x5c')])['then'](function(){return _0x33eb9a;});}return _0x33eb9a;}})[_0x00a8('0x23')](function(_0x812bb8){if(_0x812bb8){if(!fs[_0x00a8('0x4e')](_0x812bb8[_0x00a8('0x4b')])){throw new db[(_0x00a8('0x50'))][(_0x00a8('0x5d'))](_0x00a8('0x5e'));}if(_0x812bb8['filename']){return _0xf96658[_0x00a8('0x54')](_0x812bb8[_0x00a8('0x4b')],_0x812bb8[_0x00a8('0x51')]+path['extname'](_0x812bb8['value']),function(){if(_0x432e09){fs[_0x00a8('0x53')](_0x812bb8[_0x00a8('0x4b')]);}});}else{return _0xf96658[_0x00a8('0x54')](_0x812bb8[_0x00a8('0x4b')],function(_0x374ffd){if(_0x432e09){fs[_0x00a8('0x53')](_0x812bb8[_0x00a8('0x4b')]);}});}}})[_0x00a8('0x42')](handleError(_0xf96658,null));};exports[_0x00a8('0x5f')]=function(_0x213c93,_0xbc8ed9){return db['VoiceRecording'][_0x00a8('0x45')]({'where':{'id':_0x213c93[_0x00a8('0x43')]['id']}})[_0x00a8('0x23')](function(_0x381120){if(!_0x381120)throw new ReferenceError('Entity\x20not\x20found');return _0x381120;})[_0x00a8('0x23')](function(_0x518646){var _0x14e90a=_0x518646[_0x00a8('0x4b')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x14e90a);if(!_[_0x00a8('0x60')](_0x518646[_0x00a8('0x4b')])&&fs[_0x00a8('0x4e')](_0x14e90a)){logger[_0x00a8('0x61')](_0x00a8('0x62')+_0x14e90a+_0x00a8('0x63'));fs[_0x00a8('0x64')](_0x14e90a);}_0x14e90a=_0x14e90a+_0x00a8('0x65');if(!_[_0x00a8('0x60')](_0x518646[_0x00a8('0x4b')])&&fs[_0x00a8('0x4e')](_0x14e90a)){logger['info'](_0x00a8('0x62')+_0x14e90a+_0x00a8('0x63'));fs[_0x00a8('0x64')](_0x14e90a);}return _0x518646;})['then'](function(_0xa48f80){if(!_0xa48f80)throw new InternalError();return _0xa48f80[_0x00a8('0x5f')]();})[_0x00a8('0x23')](function(){_0xbc8ed9[_0x00a8('0x1a')](0xcc)['end']();})[_0x00a8('0x42')](handleError(_0xbc8ed9,null));};function getBucketslist(_0x511f8b,_0x87596f,_0x29ebe5){return new Promise(function(_0x3923e3,_0x543684){var _0x5ea0fd=new AWS['S3']({'accessKeyId':_0x87596f,'secretAccessKey':_0x511f8b,'region':_0x29ebe5});_0x5ea0fd['listBuckets']({},function(_0x565985,_0x396db3){if(_0x565985){return _0x543684(_0x565985);}else{return _0x3923e3(_0x396db3);}});});}function createBucket(_0x482263,_0x50f4e3,_0x102159,_0x1861a3){return new Promise(function(_0x5e330f,_0x127569){var _0x1a7121=new AWS['S3']({'accessKeyId':_0x50f4e3,'secretAccessKey':_0x482263,'region':_0x102159});_0x1a7121[_0x00a8('0x66')]({'Bucket':_0x1861a3},function(_0x4aeaf7,_0x2271b1){if(_0x4aeaf7){return _0x127569(_0x4aeaf7);}else{return _0x5e330f(_0x2271b1);}});});}function uploadFile(_0x4a5b27,_0x461a03,_0xbce02b,_0x32071c,_0x2e37fd,_0x504ebc){return new Promise(function(_0x1f71f1,_0x36ed75){var _0x31e69c=new AWS['S3']({'accessKeyId':_0x461a03,'secretAccessKey':_0x4a5b27,'region':_0xbce02b});_0x31e69c[_0x00a8('0x67')]({'Bucket':_0x32071c,'Key':_0x2e37fd,'Body':_0x504ebc},function(_0x2b4e30,_0x47e880){if(_0x2b4e30){return _0x36ed75(_0x2b4e30);}else{return _0x1f71f1(_0x47e880);}});});}function startTranscribe(_0x4a0ef7,_0x4bc003,_0x134fca,_0x21099f,_0x14a9c1,_0x38ee54){return new Promise(function(_0x188ef7,_0x29ba9d){var _0x284359=new AWS[(_0x00a8('0x68'))]({'accessKeyId':_0x4bc003,'secretAccessKey':_0x4a0ef7,'region':_0x134fca});_0x284359['startTranscriptionJob']({'TranscriptionJobName':_0x21099f,'LanguageCode':_0x14a9c1,'Media':{'MediaFileUri':_0x38ee54}},function(_0x1bcb08,_0x2ec090){if(_0x1bcb08){return _0x29ba9d(_0x1bcb08);}else{return _0x188ef7(_0x2ec090);}});});}function transcribe(_0x353902,_0x44ab61,_0x2088ea,_0x68203a,_0x1d0fcc,_0x4e67cc,_0x1a0e1c){return new Promise(function(_0x47e5e3,_0x281d54){var _0x57ca4a={};logger[_0x00a8('0x61')](util[_0x00a8('0x4c')](_0x00a8('0x69'),_0x353902,_0x1d0fcc));return uploadFile(_0x44ab61,_0x2088ea,_0x68203a,_0x1d0fcc,path[_0x00a8('0x6a')](_0x4e67cc),fs['readFileSync'](_0x4e67cc))[_0x00a8('0x23')](function(_0x185369){logger[_0x00a8('0x61')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x353902,_0x1d0fcc,_0x185369[_0x00a8('0x6b')]));_0x57ca4a[_0x00a8('0x6c')]=_0x185369[_0x00a8('0x6d')];_0x57ca4a[_0x00a8('0x6e')]=_0x185369[_0x00a8('0x6b')];logger[_0x00a8('0x61')](util[_0x00a8('0x4c')](_0x00a8('0x6f'),_0x353902));return startTranscribe(_0x44ab61,_0x2088ea,_0x68203a,uuidv4(),_0x1a0e1c,_0x185369['Location']);})[_0x00a8('0x23')](function(_0x20d045){logger[_0x00a8('0x61')](util[_0x00a8('0x4c')](_0x00a8('0x70'),_0x353902,_0x20d045[_0x00a8('0x71')][_0x00a8('0x72')]));_0x57ca4a[_0x00a8('0x73')]=_0x20d045[_0x00a8('0x71')][_0x00a8('0x72')];_0x57ca4a[_0x00a8('0x74')]=_0x20d045[_0x00a8('0x71')][_0x00a8('0x75')];return _0x47e5e3(_0x57ca4a);})[_0x00a8('0x42')](function(_0x3b4311){return _0x281d54(_0x3b4311);});});}exports['runTranscribe']=function(_0x11b555,_0x5069b2,_0x36bd0e){var _0x1995eb;var _0x579392;var _0x895ab4;var _0x189082=require(_0x00a8('0x49'));return db['VoiceRecording'][_0x00a8('0x76')]({'where':{'id':_0x11b555['params']['id']}})[_0x00a8('0x23')](function(_0x323ca3){if(_0x323ca3){var _0x56f70d=util['format'](_0x00a8('0x4d'),_0x323ca3[_0x00a8('0x4b')]);if(fs[_0x00a8('0x4e')](_0x56f70d)){cypher=!![];return _0x189082[_0x00a8('0x4f')](_0x56f70d,_0x323ca3[_0x00a8('0x4b')],config[_0x00a8('0x5b')]['recording'])['then'](function(){return _0x323ca3;});}return _0x323ca3;}})[_0x00a8('0x23')](function(_0x5be782){if(!_0x5be782){throw new db[(_0x00a8('0x50'))][(_0x00a8('0x5d'))](_0x00a8('0x77'));}_0x579392=_0x5be782;return db[_0x00a8('0x78')][_0x00a8('0x76')]({'where':{'id':0x1}});})[_0x00a8('0x23')](handleEntityNotFound(_0x5069b2,null))[_0x00a8('0x23')](function(_0x46f025){if(_0x46f025){_0x1995eb=_0x46f025;if(!_0x1995eb[_0x00a8('0x79')]||!_0x1995eb[_0x00a8('0x7a')]||!_0x1995eb[_0x00a8('0x7b')]||!_0x1995eb[_0x00a8('0x7c')]||!_0x1995eb[_0x00a8('0x6c')]){throw new db['Sequelize'][(_0x00a8('0x5d'))]('Transcribe\x20not\x20configured');}if(_0x11b555[_0x00a8('0x47')][_0x00a8('0x7d')]&&(!_0x1995eb[_0x00a8('0x7e')]||!_0x1995eb[_0x00a8('0x7f')]||!_0x1995eb[_0x00a8('0x80')]||!_0x1995eb['language']||!_0x1995eb[_0x00a8('0x6c')])){throw new db[(_0x00a8('0x50'))]['ValidationError'](_0x00a8('0x81'));}return db['CloudProvider']['findOne']({'where':{'id':_0x1995eb[_0x00a8('0x7a')]}});}})[_0x00a8('0x23')](function(_0x4ee225){if(!_0x4ee225){throw new db[(_0x00a8('0x50'))][(_0x00a8('0x5d'))](_0x00a8('0x82'));}if(!_0x4ee225[_0x00a8('0x83')]||!_0x4ee225[_0x00a8('0x84')]){throw new db[(_0x00a8('0x50'))][(_0x00a8('0x5d'))]('Cloud\x20Provider\x20not\x20configured');}_0x895ab4=_0x4ee225;return getBucketslist(_0x895ab4['data1'],_0x895ab4[_0x00a8('0x84')],_0x1995eb[_0x00a8('0x7b')]);})[_0x00a8('0x23')](function(_0x118f6d){if(_0x118f6d&&_0x118f6d[_0x00a8('0x85')]){var _0x5ac2f9=_[_0x00a8('0x45')](_0x118f6d[_0x00a8('0x85')],function(_0x125f4b){return _0x125f4b['Name']===_0x1995eb['bucket'];});if(!_0x5ac2f9){logger[_0x00a8('0x61')](util[_0x00a8('0x4c')](_0x00a8('0x86'),_0x11b555[_0x00a8('0x43')]['id'],_0x1995eb[_0x00a8('0x6c')]));return createBucket(_0x895ab4[_0x00a8('0x83')],_0x895ab4['data2'],_0x1995eb[_0x00a8('0x7b')],_0x1995eb[_0x00a8('0x6c')]);}logger[_0x00a8('0x61')](util[_0x00a8('0x4c')](_0x00a8('0x87'),_0x11b555['params']['id'],_0x1995eb['bucket']));return;}})[_0x00a8('0x23')](function(_0x1b5101){if(_0x579392[_0x00a8('0x74')]===_0x00a8('0x88')){return transcribe(_0x11b555[_0x00a8('0x43')]['id'],_0x895ab4[_0x00a8('0x83')],_0x895ab4[_0x00a8('0x84')],_0x1995eb['transcribeRegion'],_0x1995eb['bucket'],_0x579392[_0x00a8('0x4b')],_0x1995eb[_0x00a8('0x7c')]);}else{logger['info'](util['format'](_0x00a8('0x89'),_0x11b555[_0x00a8('0x43')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x00a8('0x23')](function(_0x458bfa){if(_0x458bfa){_0x458bfa[_0x00a8('0x8a')]=_0x11b555[_0x00a8('0x47')][_0x00a8('0x7d')];return _0x579392[_0x00a8('0x8b')](_0x458bfa);}})['then'](respondWithResult(_0x5069b2,null))[_0x00a8('0x42')](handleError(_0x5069b2,null));};function writeFile(_0x53706e,_0x42fba5){return new Promise(function(_0x53066f,_0x29000d){fs[_0x00a8('0x8c')](_0x42fba5,_0x53706e,function(_0x265d26,_0x440258){if(_0x265d26){return _0x29000d(_0x265d26);}else{return _0x53066f(_0x440258);}});});}exports['downloadTranscribe']=function(_0x561e8b,_0x3f57f6,_0x5f2cb7){return db[_0x00a8('0x3c')][_0x00a8('0x76')]({'where':{'id':_0x561e8b[_0x00a8('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f57f6))[_0x00a8('0x23')](function(_0x127dc1){if(_0x127dc1&&_0x127dc1['fileText']){var _0x3d5f39=_0x127dc1[_0x00a8('0x8d')];var _0x2ff7d9=config[_0x00a8('0x8e')]+_0x00a8('0x8f')+_0x127dc1['id']+_0x00a8('0x90');if(fs[_0x00a8('0x4e')](_0x2ff7d9)){return _0x2ff7d9;}return writeFile(_0x3d5f39,_0x2ff7d9)[_0x00a8('0x23')](function(){return _0x2ff7d9;});}else{throw new db[(_0x00a8('0x50'))]['ValidationError']('Transcript\x20not\x20available');}})[_0x00a8('0x23')](function(_0x343b55){return _0x3f57f6[_0x00a8('0x54')](_0x343b55);})[_0x00a8('0x42')](handleError(_0x3f57f6));}; \ No newline at end of file +var _0x3e7c=['fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','VoiceRecording','rawAttributes','type','key','model','differenceBy','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','$and','push','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','File:\x20\x22','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','findOne','fileText','root','/server/files/transcribes/transcribe_','.txt','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x5991d7,_0x3ca7f8){var _0x5b299d=function(_0x358ddf){while(--_0x358ddf){_0x5991d7['push'](_0x5991d7['shift']());}};_0x5b299d(++_0x3ca7f8);}(_0x3e7c,0x1d6));var _0xc3e7=function(_0x558bc1,_0x858d32){_0x558bc1=_0x558bc1-0x0;var _0x225145=_0x3e7c[_0x558bc1];return _0x225145;};'use strict';var pdf=require(_0xc3e7('0x0'));var emlformat=require(_0xc3e7('0x1'));var rimraf=require(_0xc3e7('0x2'));var zipdir=require(_0xc3e7('0x3'));var jsonpatch=require(_0xc3e7('0x4'));var rp=require('request-promise');var moment=require(_0xc3e7('0x5'));var BPromise=require(_0xc3e7('0x6'));var Mustache=require(_0xc3e7('0x7'));var util=require('util');var path=require(_0xc3e7('0x8'));var sox=require(_0xc3e7('0x9'));var csv=require(_0xc3e7('0xa'));var ejs=require(_0xc3e7('0xb'));var fs=require('fs');var _=require(_0xc3e7('0xc'));var squel=require(_0xc3e7('0xd'));var crypto=require('crypto');var jsforce=require(_0xc3e7('0xe'));var deskjs=require(_0xc3e7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc3e7('0x10'));var Papa=require(_0xc3e7('0x11'));var AWS=require(_0xc3e7('0x12'));var uuidv4=require(_0xc3e7('0x13'));var Redis=require(_0xc3e7('0x14'));var authService=require(_0xc3e7('0x15'));var qs=require(_0xc3e7('0x16'));var as=require(_0xc3e7('0x17'));var hardwareService=require(_0xc3e7('0x18'));var logger=require(_0xc3e7('0x19'))(_0xc3e7('0x1a'));var utils=require(_0xc3e7('0x1b'));var config=require(_0xc3e7('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4df160,_0x444d37){_0x444d37=_0x444d37||0xcc;return function(_0x1e11cd){if(_0x1e11cd){return _0x4df160[_0xc3e7('0x1d')](_0x444d37);}return _0x4df160['status'](_0x444d37)[_0xc3e7('0x1e')]();};}function respondWithResult(_0x353514,_0x6aa823){_0x6aa823=_0x6aa823||0xc8;return function(_0x5a7cfc){if(_0x5a7cfc){return _0x353514[_0xc3e7('0x1f')](_0x6aa823)['json'](_0x5a7cfc);}};}function respondWithFilteredResult(_0x5eb941,_0x18e129){return function(_0x4b3911){if(_0x4b3911){var _0x22b8f8=_0x4b3911['count'],_0x900450=_0x18e129['offset'],_0x12496b=_0x18e129[_0xc3e7('0x20')]+_0x18e129[_0xc3e7('0x21')],_0x38f156;if(_0x12496b>=_0x22b8f8){_0x12496b=_0x22b8f8;_0x38f156=0xc8;}else{_0x38f156=0xce;}_0x5eb941[_0xc3e7('0x1f')](_0x38f156);return _0x5eb941[_0xc3e7('0x22')](_0xc3e7('0x23'),_0x900450+'-'+_0x12496b+'/'+_0x22b8f8)[_0xc3e7('0x24')](_0x4b3911);}return null;};}function patchUpdates(_0x4c51b0){return function(_0xbe56d3){try{jsonpatch[_0xc3e7('0x25')](_0xbe56d3,_0x4c51b0,!![]);}catch(_0x5f45d9){return BPromise[_0xc3e7('0x26')](_0x5f45d9);}return _0xbe56d3['save']();};}function saveUpdates(_0x337552,_0x17c141){return function(_0x47dbeb){if(_0x47dbeb){return _0x47dbeb[_0xc3e7('0x27')](_0x337552)[_0xc3e7('0x28')](function(_0x4b7401){return _0x4b7401;});}return null;};}function removeEntity(_0x199ea0,_0x5391ff){return function(_0x568994){if(_0x568994){return _0x568994[_0xc3e7('0x29')]()[_0xc3e7('0x28')](function(){_0x199ea0['status'](0xcc)[_0xc3e7('0x1e')]();});}};}function handleEntityNotFound(_0x5f5b91,_0x204166){return function(_0x1142fc){if(!_0x1142fc){_0x5f5b91[_0xc3e7('0x1d')](0x194);}return _0x1142fc;};}function handleError(_0x5c3777,_0x458377){_0x458377=_0x458377||0x1f4;return function(_0x4803a8){logger['error'](_0x4803a8[_0xc3e7('0x2a')]);if(_0x4803a8[_0xc3e7('0x2b')]){delete _0x4803a8[_0xc3e7('0x2b')];}_0x5c3777['status'](_0x458377)[_0xc3e7('0x2c')](_0x4803a8);};}exports[_0xc3e7('0x2d')]=function(_0x47f267,_0x36c5cc){var _0x395437={},_0x1e856e={},_0x30b994={'count':0x0,'rows':[]};var _0x365c9b=_[_0xc3e7('0x2e')](db[_0xc3e7('0x2f')][_0xc3e7('0x30')],function(_0x5f32ec){return{'name':_0x5f32ec['fieldName'],'type':_0x5f32ec[_0xc3e7('0x31')][_0xc3e7('0x32')]};});_0x1e856e[_0xc3e7('0x33')]=_[_0xc3e7('0x34')](_['map'](_0x365c9b,_0xc3e7('0x2b')),[_0xc3e7('0x35')]);_0x1e856e['query']=_[_0xc3e7('0x36')](_0x47f267[_0xc3e7('0x37')]);_0x1e856e[_0xc3e7('0x38')]=_[_0xc3e7('0x39')](_0x1e856e[_0xc3e7('0x33')],_0x1e856e[_0xc3e7('0x37')]);_0x395437[_0xc3e7('0x3a')]=_[_0xc3e7('0x39')](_0x1e856e['model'],qs[_0xc3e7('0x3b')](_0x47f267[_0xc3e7('0x37')][_0xc3e7('0x3b')]));_0x395437['attributes']=_0x395437[_0xc3e7('0x3a')][_0xc3e7('0x3c')]?_0x395437[_0xc3e7('0x3a')]:_0x1e856e[_0xc3e7('0x33')];if(!_0x47f267[_0xc3e7('0x37')][_0xc3e7('0x3d')](_0xc3e7('0x3e'))){_0x395437[_0xc3e7('0x21')]=qs['limit'](_0x47f267['query']['limit']);_0x395437[_0xc3e7('0x20')]=qs[_0xc3e7('0x20')](_0x47f267['query'][_0xc3e7('0x20')]);}_0x395437[_0xc3e7('0x3f')]=qs[_0xc3e7('0x40')](_0x47f267[_0xc3e7('0x37')][_0xc3e7('0x40')]);_0x395437['where']=qs[_0xc3e7('0x38')](_[_0xc3e7('0x41')](_0x47f267[_0xc3e7('0x37')],_0x1e856e[_0xc3e7('0x38')]),_0x365c9b);if(_0x47f267[_0xc3e7('0x37')][_0xc3e7('0x42')]){_0x395437[_0xc3e7('0x43')]=_[_0xc3e7('0x44')](_0x395437[_0xc3e7('0x43')],{'$or':_[_0xc3e7('0x2e')](_0x365c9b,function(_0x504eea){if(_0x504eea[_0xc3e7('0x31')]!=='VIRTUAL'){var _0x4ff29e={};_0x4ff29e[_0x504eea[_0xc3e7('0x2b')]]={'$like':'%'+_0x47f267[_0xc3e7('0x37')][_0xc3e7('0x42')]+'%'};return _0x4ff29e;}})});}_0x395437=_[_0xc3e7('0x44')]({},_0x395437,_0x47f267[_0xc3e7('0x45')]);var _0x6ceeef={'where':_0x395437['where']};return db[_0xc3e7('0x2f')][_0xc3e7('0x46')](_0x6ceeef)[_0xc3e7('0x28')](function(_0x2f22dd){_0x30b994[_0xc3e7('0x46')]=_0x2f22dd;if(_0x47f267['query'][_0xc3e7('0x47')]){_0x395437['include']=[{'all':!![]}];}return db[_0xc3e7('0x2f')][_0xc3e7('0x48')](_0x395437);})[_0xc3e7('0x28')](function(_0x3e11b0){_0x30b994[_0xc3e7('0x49')]=_0x3e11b0;return _0x30b994;})[_0xc3e7('0x28')](respondWithFilteredResult(_0x36c5cc,_0x395437))[_0xc3e7('0x4a')](handleError(_0x36c5cc,null));};exports[_0xc3e7('0x4b')]=function(_0x22243c,_0xe43378){var _0x25963b={'raw':![],'where':{'id':_0x22243c[_0xc3e7('0x4c')]['id']}},_0x54fbd3={};_0x54fbd3[_0xc3e7('0x33')]=_['keys'](db['VoiceRecording'][_0xc3e7('0x30')]);_0x54fbd3[_0xc3e7('0x37')]=_[_0xc3e7('0x36')](_0x22243c['query']);_0x54fbd3['filters']=_[_0xc3e7('0x39')](_0x54fbd3[_0xc3e7('0x33')],_0x54fbd3[_0xc3e7('0x37')]);_0x25963b[_0xc3e7('0x3a')]=_['intersection'](_0x54fbd3['model'],qs[_0xc3e7('0x3b')](_0x22243c[_0xc3e7('0x37')][_0xc3e7('0x3b')]));_0x25963b[_0xc3e7('0x3a')]=_0x25963b[_0xc3e7('0x3a')][_0xc3e7('0x3c')]?_0x25963b[_0xc3e7('0x3a')]:_0x54fbd3[_0xc3e7('0x33')];if(_0x22243c[_0xc3e7('0x37')][_0xc3e7('0x47')]){_0x25963b[_0xc3e7('0x4d')]=[{'all':!![]}];}_0x25963b=_[_0xc3e7('0x44')]({},_0x25963b,_0x22243c[_0xc3e7('0x45')]);return db[_0xc3e7('0x2f')][_0xc3e7('0x4e')](_0x25963b)[_0xc3e7('0x28')](handleEntityNotFound(_0xe43378,null))['then'](respondWithResult(_0xe43378,null))[_0xc3e7('0x4a')](handleError(_0xe43378,null));};exports[_0xc3e7('0x4f')]=function(_0x4a3d84,_0x52b900){return db[_0xc3e7('0x2f')][_0xc3e7('0x4f')](_0x4a3d84['body'],{})[_0xc3e7('0x28')](respondWithResult(_0x52b900,0xc9))[_0xc3e7('0x4a')](handleError(_0x52b900,null));};exports[_0xc3e7('0x27')]=function(_0x33c734,_0x3e8100){if(_0x33c734[_0xc3e7('0x50')]['id']){delete _0x33c734[_0xc3e7('0x50')]['id'];}return db[_0xc3e7('0x2f')][_0xc3e7('0x4e')]({'where':{'id':_0x33c734[_0xc3e7('0x4c')]['id']}})[_0xc3e7('0x28')](handleEntityNotFound(_0x3e8100,null))['then'](saveUpdates(_0x33c734[_0xc3e7('0x50')],null))['then'](respondWithResult(_0x3e8100,null))[_0xc3e7('0x4a')](handleError(_0x3e8100,null));};exports[_0xc3e7('0x51')]=function(_0x267b96,_0x2c8002){return db[_0xc3e7('0x2f')]['describe']()[_0xc3e7('0x28')](respondWithResult(_0x2c8002,null))[_0xc3e7('0x4a')](handleError(_0x2c8002,null));};exports[_0xc3e7('0x52')]=function(_0x56c6d1,_0x42bf0b,_0x3b2822){var _0x1dd009=require(_0xc3e7('0x53'));var _0x4d1d90=![];var _0xc3624c={};if(_0x56c6d1['query'][_0xc3e7('0x31')]&&_0x56c6d1['query'][_0xc3e7('0x31')]===_0xc3e7('0x54')){_0xc3624c[_0xc3e7('0x54')]=_0x56c6d1[_0xc3e7('0x4c')]['id'];}else{_0xc3624c['id']=_0x56c6d1[_0xc3e7('0x4c')]['id'];}return db[_0xc3e7('0x2f')]['find']({'where':_0xc3624c,'attributes':['id',_0xc3e7('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x42bf0b,null))[_0xc3e7('0x28')](function(_0x507a34){if(_0x507a34){var _0x3c1d9a=_0x507a34['value'];var _0x1d4ccb=util[_0xc3e7('0x35')](_0xc3e7('0x56'),_0x3c1d9a);if(fs[_0xc3e7('0x57')](_0x1d4ccb)){_0x4d1d90=!![];return _0x1dd009[_0xc3e7('0x58')](_0x1d4ccb,_0x3c1d9a,config[_0xc3e7('0x59')][_0xc3e7('0x5a')])[_0xc3e7('0x28')](function(){return _0x507a34;});}return _0x507a34;}})[_0xc3e7('0x28')](function(_0x4436a5){if(_0x4436a5){var _0x1e7bb3=_0x4436a5[_0xc3e7('0x55')];if(!fs[_0xc3e7('0x57')](_0x1e7bb3)){throw new db[(_0xc3e7('0x5b'))][(_0xc3e7('0x5c'))](_0xc3e7('0x5d'));}if(_0x4436a5[_0xc3e7('0x5e')]){return _0x42bf0b[_0xc3e7('0x52')](_0x1e7bb3,_0x4436a5[_0xc3e7('0x5e')]+path[_0xc3e7('0x5f')](_0x1e7bb3),function(){if(_0x4d1d90){fs[_0xc3e7('0x60')](_0x1e7bb3);}});}else{return _0x42bf0b['download'](_0x1e7bb3,function(_0x3d69f1){if(_0x4d1d90){fs['unlink'](_0x1e7bb3);}});}}})[_0xc3e7('0x4a')](function(_0x461291){if(_0x461291[_0xc3e7('0x61')]===_0xc3e7('0x5d')){_0x42bf0b['status'](0x194)[_0xc3e7('0x2c')](_0xc3e7('0x62'));}else{return handleError(_0x42bf0b,null);}});};exports[_0xc3e7('0x63')]=function(_0x3cbfa2,_0xfea910,_0x51323b){var _0xed5d88=require(_0xc3e7('0x53'));var _0x588037=![];var _0x4bde47={'$and':[db[_0xc3e7('0x64')][_0xc3e7('0x43')](db[_0xc3e7('0x64')]['fn'](_0xc3e7('0x65'),db['sequelize'][_0xc3e7('0x66')](_0xc3e7('0x54'))),_0x3cbfa2['query']['token'])]};if(_0x3cbfa2['query'][_0xc3e7('0x31')]&&_0x3cbfa2['query'][_0xc3e7('0x31')]==='uniqueid'){_0x4bde47[_0xc3e7('0x67')][_0xc3e7('0x68')]({'uniqueid':_0x3cbfa2[_0xc3e7('0x4c')]['id']});}else{_0x4bde47['$and'][_0xc3e7('0x68')]({'id':_0x3cbfa2[_0xc3e7('0x4c')]['id']});}return db['VoiceRecording'][_0xc3e7('0x4e')]({'where':_0x4bde47,'attributes':['id','value'],'raw':!![]})[_0xc3e7('0x28')](handleEntityNotFound(_0xfea910,null))[_0xc3e7('0x28')](function(_0x70b1d5){if(_0x70b1d5){var _0x4150a7=util[_0xc3e7('0x35')](_0xc3e7('0x56'),_0x70b1d5['value']);if(fs[_0xc3e7('0x57')](_0x4150a7)){_0x588037=!![];return _0xed5d88[_0xc3e7('0x58')](_0x4150a7,_0x70b1d5[_0xc3e7('0x55')],config['secrets'][_0xc3e7('0x5a')])[_0xc3e7('0x28')](function(){return _0x70b1d5;});}return _0x70b1d5;}})[_0xc3e7('0x28')](function(_0x215847){if(_0x215847){if(!fs[_0xc3e7('0x57')](_0x215847['value'])){throw new db['Sequelize'][(_0xc3e7('0x5c'))](_0xc3e7('0x5d'));}if(_0x215847[_0xc3e7('0x5e')]){return _0xfea910['download'](_0x215847[_0xc3e7('0x55')],_0x215847[_0xc3e7('0x5e')]+path['extname'](_0x215847[_0xc3e7('0x55')]),function(){if(_0x588037){fs['unlink'](_0x215847[_0xc3e7('0x55')]);}});}else{return _0xfea910['download'](_0x215847[_0xc3e7('0x55')],function(_0x24d31c){if(_0x588037){fs[_0xc3e7('0x60')](_0x215847[_0xc3e7('0x55')]);}});}}})['catch'](handleError(_0xfea910,null));};exports[_0xc3e7('0x29')]=function(_0x47cb30,_0x3c5262){return db[_0xc3e7('0x2f')][_0xc3e7('0x4e')]({'where':{'id':_0x47cb30['params']['id']}})[_0xc3e7('0x28')](function(_0x3b0f33){if(!_0x3b0f33)throw new ReferenceError('Entity\x20not\x20found');return _0x3b0f33;})[_0xc3e7('0x28')](function(_0x23b5f1){var _0x3407be=_0x23b5f1[_0xc3e7('0x55')];logger[_0xc3e7('0x69')](_0xc3e7('0x6a'),_0x3407be);if(!_[_0xc3e7('0x6b')](_0x23b5f1['value'])&&fs[_0xc3e7('0x57')](_0x3407be)){logger['info']('File:\x20\x22'+_0x3407be+_0xc3e7('0x6c'));fs['unlinkSync'](_0x3407be);}_0x3407be=_0x3407be+'.cypher';if(!_[_0xc3e7('0x6b')](_0x23b5f1[_0xc3e7('0x55')])&&fs[_0xc3e7('0x57')](_0x3407be)){logger[_0xc3e7('0x69')](_0xc3e7('0x6d')+_0x3407be+_0xc3e7('0x6c'));fs[_0xc3e7('0x6e')](_0x3407be);}return _0x23b5f1;})[_0xc3e7('0x28')](function(_0x1a756d){if(!_0x1a756d)throw new InternalError();return _0x1a756d[_0xc3e7('0x29')]();})['then'](function(){_0x3c5262[_0xc3e7('0x1f')](0xcc)[_0xc3e7('0x1e')]();})[_0xc3e7('0x4a')](handleError(_0x3c5262,null));};function getBucketslist(_0x2c6fee,_0x17eff8,_0x3eb4f6){return new Promise(function(_0x3eaa6e,_0x43d95c){var _0x4d5c85=new AWS['S3']({'accessKeyId':_0x17eff8,'secretAccessKey':_0x2c6fee,'region':_0x3eb4f6});_0x4d5c85[_0xc3e7('0x6f')]({},function(_0x507982,_0x1aa80b){if(_0x507982){return _0x43d95c(_0x507982);}else{return _0x3eaa6e(_0x1aa80b);}});});}function createBucket(_0x1f2fe7,_0x52bbcf,_0x110c0a,_0x4cf6bd){return new Promise(function(_0x5d224d,_0x78b1f6){var _0x3fcd97=new AWS['S3']({'accessKeyId':_0x52bbcf,'secretAccessKey':_0x1f2fe7,'region':_0x110c0a});_0x3fcd97[_0xc3e7('0x70')]({'Bucket':_0x4cf6bd},function(_0x3fa814,_0x3d70a4){if(_0x3fa814){return _0x78b1f6(_0x3fa814);}else{return _0x5d224d(_0x3d70a4);}});});}function uploadFile(_0x5b09d2,_0x549cf5,_0x13f4cd,_0x22c90c,_0x4108d2,_0x4a1ae4){return new Promise(function(_0x35ef2f,_0x6d4a9b){var _0x4da274=new AWS['S3']({'accessKeyId':_0x549cf5,'secretAccessKey':_0x5b09d2,'region':_0x13f4cd});_0x4da274[_0xc3e7('0x71')]({'Bucket':_0x22c90c,'Key':_0x4108d2,'Body':_0x4a1ae4},function(_0x27f7e9,_0x5ae3e8){if(_0x27f7e9){return _0x6d4a9b(_0x27f7e9);}else{return _0x35ef2f(_0x5ae3e8);}});});}function startTranscribe(_0x85b6bf,_0x152f95,_0x50fab8,_0x5b41a8,_0x4a86eb,_0x4f44cd){return new Promise(function(_0x3adac1,_0x5d300b){var _0x45dcd6=new AWS[(_0xc3e7('0x72'))]({'accessKeyId':_0x152f95,'secretAccessKey':_0x85b6bf,'region':_0x50fab8});_0x45dcd6[_0xc3e7('0x73')]({'TranscriptionJobName':_0x5b41a8,'LanguageCode':_0x4a86eb,'Media':{'MediaFileUri':_0x4f44cd}},function(_0x40e726,_0x2e14ac){if(_0x40e726){return _0x5d300b(_0x40e726);}else{return _0x3adac1(_0x2e14ac);}});});}function transcribe(_0x5b348b,_0x116442,_0x10eedc,_0x15bdcd,_0x5b23cd,_0x56e0f8,_0x49437a){return new Promise(function(_0x27026d,_0x359c42){var _0x869a4b={};logger[_0xc3e7('0x69')](util['format'](_0xc3e7('0x74'),_0x5b348b,_0x5b23cd));return uploadFile(_0x116442,_0x10eedc,_0x15bdcd,_0x5b23cd,path[_0xc3e7('0x75')](_0x56e0f8),fs[_0xc3e7('0x76')](_0x56e0f8))['then'](function(_0x53d9c3){logger[_0xc3e7('0x69')](util['format'](_0xc3e7('0x77'),_0x5b348b,_0x5b23cd,_0x53d9c3[_0xc3e7('0x78')]));_0x869a4b[_0xc3e7('0x79')]=_0x53d9c3['Bucket'];_0x869a4b[_0xc3e7('0x7a')]=_0x53d9c3[_0xc3e7('0x78')];logger[_0xc3e7('0x69')](util[_0xc3e7('0x35')](_0xc3e7('0x7b'),_0x5b348b));return startTranscribe(_0x116442,_0x10eedc,_0x15bdcd,uuidv4(),_0x49437a,_0x53d9c3[_0xc3e7('0x78')]);})[_0xc3e7('0x28')](function(_0x2a9531){logger[_0xc3e7('0x69')](util[_0xc3e7('0x35')](_0xc3e7('0x7c'),_0x5b348b,_0x2a9531[_0xc3e7('0x7d')][_0xc3e7('0x7e')]));_0x869a4b[_0xc3e7('0x7f')]=_0x2a9531[_0xc3e7('0x7d')][_0xc3e7('0x7e')];_0x869a4b[_0xc3e7('0x80')]=_0x2a9531[_0xc3e7('0x7d')]['TranscriptionJobStatus'];return _0x27026d(_0x869a4b);})['catch'](function(_0x5f7479){return _0x359c42(_0x5f7479);});});}exports[_0xc3e7('0x81')]=function(_0x4281a4,_0x152829,_0x431774){var _0x3d1997;var _0x1e81d9;var _0xd2e3c9;var _0x46cf88=require(_0xc3e7('0x53'));return db[_0xc3e7('0x2f')]['findOne']({'where':{'id':_0x4281a4[_0xc3e7('0x4c')]['id']}})[_0xc3e7('0x28')](function(_0x4868eb){if(_0x4868eb){var _0x3f6153=util['format'](_0xc3e7('0x56'),_0x4868eb[_0xc3e7('0x55')]);if(fs[_0xc3e7('0x57')](_0x3f6153)){cypher=!![];return _0x46cf88['decryptFile'](_0x3f6153,_0x4868eb[_0xc3e7('0x55')],config[_0xc3e7('0x59')][_0xc3e7('0x5a')])[_0xc3e7('0x28')](function(){return _0x4868eb;});}return _0x4868eb;}})[_0xc3e7('0x28')](function(_0x49c9b2){if(!_0x49c9b2){throw new db['Sequelize']['ValidationError'](_0xc3e7('0x82'));}_0x1e81d9=_0x49c9b2;return db[_0xc3e7('0x83')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x152829,null))[_0xc3e7('0x28')](function(_0x41ee63){if(_0x41ee63){_0x3d1997=_0x41ee63;if(!_0x3d1997[_0xc3e7('0x84')]||!_0x3d1997['transcribeAccountId']||!_0x3d1997[_0xc3e7('0x85')]||!_0x3d1997['language']||!_0x3d1997['bucket']){throw new db[(_0xc3e7('0x5b'))][(_0xc3e7('0x5c'))](_0xc3e7('0x86'));}if(_0x4281a4[_0xc3e7('0x50')][_0xc3e7('0x87')]&&(!_0x3d1997[_0xc3e7('0x88')]||!_0x3d1997[_0xc3e7('0x89')]||!_0x3d1997[_0xc3e7('0x8a')]||!_0x3d1997[_0xc3e7('0x8b')]||!_0x3d1997[_0xc3e7('0x79')])){throw new db[(_0xc3e7('0x5b'))][(_0xc3e7('0x5c'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xc3e7('0x8c')]['findOne']({'where':{'id':_0x3d1997['transcribeAccountId']}});}})['then'](function(_0x24aa44){if(!_0x24aa44){throw new db['Sequelize'][(_0xc3e7('0x5c'))](_0xc3e7('0x8d'));}if(!_0x24aa44[_0xc3e7('0x8e')]||!_0x24aa44[_0xc3e7('0x8f')]){throw new db['Sequelize']['ValidationError'](_0xc3e7('0x90'));}_0xd2e3c9=_0x24aa44;return getBucketslist(_0xd2e3c9[_0xc3e7('0x8e')],_0xd2e3c9['data2'],_0x3d1997[_0xc3e7('0x85')]);})[_0xc3e7('0x28')](function(_0x12c647){if(_0x12c647&&_0x12c647[_0xc3e7('0x91')]){var _0x351d3a=_[_0xc3e7('0x4e')](_0x12c647['Buckets'],function(_0x21c12f){return _0x21c12f[_0xc3e7('0x92')]===_0x3d1997['bucket'];});if(!_0x351d3a){logger[_0xc3e7('0x69')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x4281a4[_0xc3e7('0x4c')]['id'],_0x3d1997[_0xc3e7('0x79')]));return createBucket(_0xd2e3c9[_0xc3e7('0x8e')],_0xd2e3c9['data2'],_0x3d1997[_0xc3e7('0x85')],_0x3d1997[_0xc3e7('0x79')]);}logger[_0xc3e7('0x69')](util[_0xc3e7('0x35')](_0xc3e7('0x93'),_0x4281a4[_0xc3e7('0x4c')]['id'],_0x3d1997[_0xc3e7('0x79')]));return;}})['then'](function(_0x111063){if(_0x1e81d9['transcribeStatus']==='NEW'){return transcribe(_0x4281a4[_0xc3e7('0x4c')]['id'],_0xd2e3c9[_0xc3e7('0x8e')],_0xd2e3c9[_0xc3e7('0x8f')],_0x3d1997[_0xc3e7('0x85')],_0x3d1997[_0xc3e7('0x79')],_0x1e81d9[_0xc3e7('0x55')],_0x3d1997[_0xc3e7('0x8b')]);}else{logger[_0xc3e7('0x69')](util[_0xc3e7('0x35')](_0xc3e7('0x94'),_0x4281a4[_0xc3e7('0x4c')]['id']));return{'transcribeStatus':_0xc3e7('0x95')};}})[_0xc3e7('0x28')](function(_0x524e19){if(_0x524e19){_0x524e19[_0xc3e7('0x96')]=_0x4281a4[_0xc3e7('0x50')][_0xc3e7('0x87')];return _0x1e81d9['updateAttributes'](_0x524e19);}})['then'](respondWithResult(_0x152829,null))[_0xc3e7('0x4a')](handleError(_0x152829,null));};function writeFile(_0xffdd43,_0x382083){return new Promise(function(_0x1e1ce0,_0x41697e){fs[_0xc3e7('0x97')](_0x382083,_0xffdd43,function(_0x4af128,_0x48b650){if(_0x4af128){return _0x41697e(_0x4af128);}else{return _0x1e1ce0(_0x48b650);}});});}exports[_0xc3e7('0x98')]=function(_0x40ab8b,_0x172aa4,_0x2ee076){return db['VoiceRecording'][_0xc3e7('0x99')]({'where':{'id':_0x40ab8b[_0xc3e7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x172aa4))[_0xc3e7('0x28')](function(_0x1ccaf5){if(_0x1ccaf5&&_0x1ccaf5[_0xc3e7('0x9a')]){var _0x10b315=_0x1ccaf5[_0xc3e7('0x9a')];var _0x527c26=config[_0xc3e7('0x9b')]+_0xc3e7('0x9c')+_0x1ccaf5['id']+_0xc3e7('0x9d');if(fs['existsSync'](_0x527c26)){return _0x527c26;}return writeFile(_0x10b315,_0x527c26)[_0xc3e7('0x28')](function(){return _0x527c26;});}else{throw new db['Sequelize'][(_0xc3e7('0x5c'))]('Transcript\x20not\x20available');}})['then'](function(_0x5958ee){return _0x172aa4[_0xc3e7('0x52')](_0x5958ee);})[_0xc3e7('0x4a')](handleError(_0x172aa4));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index a5c2a9f..38132d0 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 _0x3831=['voice_recordings','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceRecording.attributes','define'];(function(_0x503655,_0x1acb64){var _0x10defb=function(_0x34fa0d){while(--_0x34fa0d){_0x503655['push'](_0x503655['shift']());}};_0x10defb(++_0x1acb64);}(_0x3831,0x14c));var _0x1383=function(_0x36bbbb,_0x3f6709){_0x36bbbb=_0x36bbbb-0x0;var _0x3ca0eb=_0x3831[_0x36bbbb];return _0x3ca0eb;};'use strict';var _=require(_0x1383('0x0'));var util=require('util');var logger=require(_0x1383('0x1'))(_0x1383('0x2'));var moment=require(_0x1383('0x3'));var BPromise=require(_0x1383('0x4'));var rp=require(_0x1383('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1383('0x6'));var config=require('../../config/environment');var attributes=require(_0x1383('0x7'));module['exports']=function(_0x5b64b1,_0x5eb4d8){return _0x5b64b1[_0x1383('0x8')]('VoiceRecording',attributes,{'tableName':_0x1383('0x9'),'paranoid':![],'indexes':[{'name':_0x1383('0xa'),'fields':[_0x1383('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f80=['define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x290485,_0x6f959c){var _0x4dc660=function(_0x4cdc61){while(--_0x4cdc61){_0x290485['push'](_0x290485['shift']());}};_0x4dc660(++_0x6f959c);}(_0x0f80,0x108));var _0x00f8=function(_0x8c1396,_0x53f0d7){_0x8c1396=_0x8c1396-0x0;var _0x4632f2=_0x0f80[_0x8c1396];return _0x4632f2;};'use strict';var _=require('lodash');var util=require(_0x00f8('0x0'));var logger=require(_0x00f8('0x1'))(_0x00f8('0x2'));var moment=require(_0x00f8('0x3'));var BPromise=require(_0x00f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x00f8('0x5'));var rimraf=require(_0x00f8('0x6'));var config=require(_0x00f8('0x7'));var attributes=require('./voiceRecording.attributes');module[_0x00f8('0x8')]=function(_0x15f84c,_0x38a533){return _0x15f84c[_0x00f8('0x9')](_0x00f8('0xa'),attributes,{'tableName':_0x00f8('0xb'),'paranoid':![],'indexes':[{'name':_0x00f8('0xc'),'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 2afcb68..cf45c44 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(_0x23d7fd,_0x16d5b1){var _0x475743=function(_0x32a188){while(--_0x32a188){_0x23d7fd['push'](_0x23d7fd['shift']());}};_0x475743(++_0x16d5b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0x3115fa,_0x1bf37e){var _0x3a5567=function(_0x18f739){while(--_0x18f739){_0x3115fa['push'](_0x3115fa['shift']());}};_0x3a5567(++_0x1bf37e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 921818f..880b63d 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 _0xba34=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../config/environment','./voiceTransferReport.controller'];(function(_0x33570c,_0xd1a4c1){var _0x3929ca=function(_0x45cf90){while(--_0x45cf90){_0x33570c['push'](_0x33570c['shift']());}};_0x3929ca(++_0xd1a4c1);}(_0xba34,0x119));var _0x4ba3=function(_0x25b0d0,_0x2d3ac3){_0x25b0d0=_0x25b0d0-0x0;var _0xf0baf8=_0xba34[_0x25b0d0];return _0xf0baf8;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ba3('0x5'));var controller=require(_0x4ba3('0x6'));router[_0x4ba3('0x7')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0x9')]);router[_0x4ba3('0x7')](_0x4ba3('0xa'),auth['isAuthenticated'](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0xc')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')](_0x4ba3('0xa'),auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xa'),auth[_0x4ba3('0x8')](),controller['destroy']);module[_0x4ba3('0x11')]=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(_0x770b94,_0x22933c){var _0x44f9a7=function(_0x39bdf0){while(--_0x39bdf0){_0x770b94['push'](_0x770b94['shift']());}};_0x44f9a7(++_0x22933c);}(_0x7096,0x10c));var _0x6709=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x7096[_0x2dea24];return _0x309d58;};'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 bfd81cc..c51545c 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 _0x6751=['exports','ENUM','attended','STRING','sequelize'];(function(_0x257114,_0x455247){var _0x6185a3=function(_0x57094b){while(--_0x57094b){_0x257114['push'](_0x257114['shift']());}};_0x6185a3(++_0x455247);}(_0x6751,0x18a));var _0x1675=function(_0x1326e3,_0x1c6728){_0x1326e3=_0x1326e3-0x0;var _0x33d5bb=_0x6751[_0x1326e3];return _0x33d5bb;};'use strict';var Sequelize=require(_0x1675('0x0'));var moment=require('moment');module[_0x1675('0x1')]={'type':{'type':Sequelize[_0x1675('0x2')]('blind',_0x1675('0x3'))},'result':{'type':Sequelize[_0x1675('0x4')]},'transfererchannel':{'type':Sequelize[_0x1675('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x1675('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x1675('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x1675('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x1675('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x1675('0x4')]},'transfereechannel':{'type':Sequelize[_0x1675('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x1675('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x1675('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x1675('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1675('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x1675('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x1675('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x1675('0x2')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4a94=['attended','STRING','ENUM','Yes','sequelize','moment','blind'];(function(_0x127b47,_0x7fb54f){var _0x4f35a1=function(_0x318c0b){while(--_0x318c0b){_0x127b47['push'](_0x127b47['shift']());}};_0x4f35a1(++_0x7fb54f);}(_0x4a94,0xa5));var _0x44a9=function(_0x4fa72e,_0x336dda){_0x4fa72e=_0x4fa72e-0x0;var _0x28323a=_0x4a94[_0x4fa72e];return _0x28323a;};'use strict';var Sequelize=require(_0x44a9('0x0'));var moment=require(_0x44a9('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x44a9('0x2'),_0x44a9('0x3'))},'result':{'type':Sequelize[_0x44a9('0x4')]},'transfererchannel':{'type':Sequelize[_0x44a9('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x44a9('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x44a9('0x4')]},'transferercontext':{'type':Sequelize[_0x44a9('0x4')]},'transfererexten':{'type':Sequelize[_0x44a9('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x44a9('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x44a9('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x44a9('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x44a9('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x44a9('0x4')]},'transfereecontext':{'type':Sequelize[_0x44a9('0x4')]},'transfereeexten':{'type':Sequelize[_0x44a9('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x44a9('0x4')]},'isexternal':{'type':Sequelize[_0x44a9('0x5')](_0x44a9('0x6'),'No')},'context':{'type':Sequelize[_0x44a9('0x4')]},'extension':{'type':Sequelize[_0x44a9('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 971e7e4..e1fe542 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 _0xaf5e=['count','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','map','VIRTUAL','options','VoiceTransferReport'];(function(_0x1d97bc,_0x55d0c6){var _0x56c55e=function(_0x201976){while(--_0x201976){_0x1d97bc['push'](_0x1d97bc['shift']());}};_0x56c55e(++_0x55d0c6);}(_0xaf5e,0xa0));var _0xeaf5=function(_0x125071,_0x51fd2f){_0x125071=_0x125071-0x0;var _0x28e550=_0xaf5e[_0x125071];return _0x28e550;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeaf5('0x0'));var rimraf=require(_0xeaf5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeaf5('0x2'));var rp=require(_0xeaf5('0x3'));var moment=require(_0xeaf5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeaf5('0x5'));var path=require(_0xeaf5('0x6'));var sox=require(_0xeaf5('0x7'));var csv=require(_0xeaf5('0x8'));var ejs=require(_0xeaf5('0x9'));var fs=require('fs');var _=require(_0xeaf5('0xa'));var squel=require(_0xeaf5('0xb'));var crypto=require(_0xeaf5('0xc'));var jsforce=require(_0xeaf5('0xd'));var deskjs=require(_0xeaf5('0xe'));var toCsv=require(_0xeaf5('0x8'));var querystring=require(_0xeaf5('0xf'));var Papa=require(_0xeaf5('0x10'));var Redis=require(_0xeaf5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xeaf5('0x12'));var as=require(_0xeaf5('0x13'));var hardwareService=require(_0xeaf5('0x14'));var logger=require(_0xeaf5('0x15'))(_0xeaf5('0x16'));var utils=require(_0xeaf5('0x17'));var config=require(_0xeaf5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42cf03,_0x36e198){_0x36e198=_0x36e198||0xcc;return function(_0x543baa){if(_0x543baa){return _0x42cf03[_0xeaf5('0x19')](_0x36e198);}return _0x42cf03['status'](_0x36e198)[_0xeaf5('0x1a')]();};}function respondWithResult(_0x3096ff,_0x2cf751){_0x2cf751=_0x2cf751||0xc8;return function(_0x146eb4){if(_0x146eb4){return _0x3096ff[_0xeaf5('0x1b')](_0x2cf751)[_0xeaf5('0x1c')](_0x146eb4);}};}function respondWithFilteredResult(_0x325dc5,_0x5d23e9){return function(_0x152116){if(_0x152116){var _0x1bd97c=_0x152116['count'],_0x159cd0=_0x5d23e9[_0xeaf5('0x1d')],_0x397ab3=_0x5d23e9[_0xeaf5('0x1d')]+_0x5d23e9[_0xeaf5('0x1e')],_0x23f7d7;if(_0x397ab3>=_0x1bd97c){_0x397ab3=_0x1bd97c;_0x23f7d7=0xc8;}else{_0x23f7d7=0xce;}_0x325dc5[_0xeaf5('0x1b')](_0x23f7d7);return _0x325dc5[_0xeaf5('0x1f')](_0xeaf5('0x20'),_0x159cd0+'-'+_0x397ab3+'/'+_0x1bd97c)[_0xeaf5('0x1c')](_0x152116);}return null;};}function patchUpdates(_0x1232c2){return function(_0xfb502a){try{jsonpatch[_0xeaf5('0x21')](_0xfb502a,_0x1232c2,!![]);}catch(_0x4d5fe5){return BPromise['reject'](_0x4d5fe5);}return _0xfb502a[_0xeaf5('0x22')]();};}function saveUpdates(_0x1c57f8,_0x32c567){return function(_0x2956ed){if(_0x2956ed){return _0x2956ed[_0xeaf5('0x23')](_0x1c57f8)[_0xeaf5('0x24')](function(_0x4b3608){return _0x4b3608;});}return null;};}function removeEntity(_0x52489c,_0x2d53fd){return function(_0x51f629){if(_0x51f629){return _0x51f629[_0xeaf5('0x25')]()[_0xeaf5('0x24')](function(){_0x52489c['status'](0xcc)[_0xeaf5('0x1a')]();});}};}function handleEntityNotFound(_0x22c664,_0x34ab57){return function(_0x5853b8){if(!_0x5853b8){_0x22c664['sendStatus'](0x194);}return _0x5853b8;};}function handleError(_0xe0c2d2,_0x4d8c13){_0x4d8c13=_0x4d8c13||0x1f4;return function(_0x3c3ce9){logger[_0xeaf5('0x26')](_0x3c3ce9[_0xeaf5('0x27')]);if(_0x3c3ce9[_0xeaf5('0x28')]){delete _0x3c3ce9[_0xeaf5('0x28')];}_0xe0c2d2['status'](_0x4d8c13)[_0xeaf5('0x29')](_0x3c3ce9);};}exports[_0xeaf5('0x2a')]=function(_0x5d604e,_0x4570de){var _0x57197a={},_0x21234a={},_0x4bd87b={'count':0x0,'rows':[]};var _0x30ec7f=_['map'](db['VoiceTransferReport'][_0xeaf5('0x2b')],function(_0x13f950){return{'name':_0x13f950['fieldName'],'type':_0x13f950[_0xeaf5('0x2c')][_0xeaf5('0x2d')]};});_0x21234a[_0xeaf5('0x2e')]=_['map'](_0x30ec7f,_0xeaf5('0x28'));_0x21234a[_0xeaf5('0x2f')]=_['keys'](_0x5d604e[_0xeaf5('0x2f')]);_0x21234a[_0xeaf5('0x30')]=_[_0xeaf5('0x31')](_0x21234a['model'],_0x21234a['query']);_0x57197a[_0xeaf5('0x32')]=_[_0xeaf5('0x31')](_0x21234a['model'],qs[_0xeaf5('0x33')](_0x5d604e[_0xeaf5('0x2f')]['fields']));_0x57197a[_0xeaf5('0x32')]=_0x57197a[_0xeaf5('0x32')][_0xeaf5('0x34')]?_0x57197a[_0xeaf5('0x32')]:_0x21234a['model'];if(!_0x5d604e[_0xeaf5('0x2f')]['hasOwnProperty']('nolimit')){_0x57197a[_0xeaf5('0x1e')]=qs['limit'](_0x5d604e['query']['limit']);_0x57197a['offset']=qs[_0xeaf5('0x1d')](_0x5d604e['query'][_0xeaf5('0x1d')]);}_0x57197a[_0xeaf5('0x35')]=qs['sort'](_0x5d604e[_0xeaf5('0x2f')][_0xeaf5('0x36')]);_0x57197a[_0xeaf5('0x37')]=qs['filters'](_[_0xeaf5('0x38')](_0x5d604e[_0xeaf5('0x2f')],_0x21234a[_0xeaf5('0x30')]),_0x30ec7f);if(_0x5d604e['query']['filter']){_0x57197a[_0xeaf5('0x37')]=_[_0xeaf5('0x39')](_0x57197a[_0xeaf5('0x37')],{'$or':_[_0xeaf5('0x3a')](_0x30ec7f,function(_0x3aa0fd){if(_0x3aa0fd[_0xeaf5('0x2c')]!==_0xeaf5('0x3b')){var _0x3cdced={};_0x3cdced[_0x3aa0fd['name']]={'$like':'%'+_0x5d604e['query']['filter']+'%'};return _0x3cdced;}})});}_0x57197a=_['merge']({},_0x57197a,_0x5d604e[_0xeaf5('0x3c')]);var _0x5a5d62={'where':_0x57197a[_0xeaf5('0x37')]};return db[_0xeaf5('0x3d')][_0xeaf5('0x3e')](_0x5a5d62)[_0xeaf5('0x24')](function(_0x36eafd){_0x4bd87b['count']=_0x36eafd;if(_0x5d604e[_0xeaf5('0x2f')]['includeAll']){_0x57197a['include']=[{'all':!![]}];}return db[_0xeaf5('0x3d')][_0xeaf5('0x3f')](_0x57197a);})[_0xeaf5('0x24')](function(_0x27571c){_0x4bd87b[_0xeaf5('0x40')]=_0x27571c;return _0x4bd87b;})[_0xeaf5('0x24')](respondWithFilteredResult(_0x4570de,_0x57197a))[_0xeaf5('0x41')](handleError(_0x4570de,null));};exports[_0xeaf5('0x42')]=function(_0x37eaf9,_0x1e79b3){var _0x14b225={'raw':!![],'where':{'id':_0x37eaf9[_0xeaf5('0x43')]['id']}},_0x4fe0cb={};_0x4fe0cb[_0xeaf5('0x2e')]=_[_0xeaf5('0x44')](db['VoiceTransferReport'][_0xeaf5('0x2b')]);_0x4fe0cb[_0xeaf5('0x2f')]=_['keys'](_0x37eaf9[_0xeaf5('0x2f')]);_0x4fe0cb[_0xeaf5('0x30')]=_['intersection'](_0x4fe0cb['model'],_0x4fe0cb[_0xeaf5('0x2f')]);_0x14b225[_0xeaf5('0x32')]=_[_0xeaf5('0x31')](_0x4fe0cb[_0xeaf5('0x2e')],qs[_0xeaf5('0x33')](_0x37eaf9[_0xeaf5('0x2f')][_0xeaf5('0x33')]));_0x14b225['attributes']=_0x14b225['attributes']['length']?_0x14b225[_0xeaf5('0x32')]:_0x4fe0cb['model'];if(_0x37eaf9[_0xeaf5('0x2f')][_0xeaf5('0x45')]){_0x14b225[_0xeaf5('0x46')]=[{'all':!![]}];}_0x14b225=_[_0xeaf5('0x39')]({},_0x14b225,_0x37eaf9[_0xeaf5('0x3c')]);return db[_0xeaf5('0x3d')][_0xeaf5('0x47')](_0x14b225)['then'](handleEntityNotFound(_0x1e79b3,null))['then'](respondWithResult(_0x1e79b3,null))[_0xeaf5('0x41')](handleError(_0x1e79b3,null));};exports[_0xeaf5('0x48')]=function(_0x5128d3,_0x5d75b6){return db[_0xeaf5('0x3d')][_0xeaf5('0x48')](_0x5128d3['body'],{})[_0xeaf5('0x24')](respondWithResult(_0x5d75b6,0xc9))['catch'](handleError(_0x5d75b6,null));};exports[_0xeaf5('0x23')]=function(_0x5e1422,_0x308468){if(_0x5e1422['body']['id']){delete _0x5e1422[_0xeaf5('0x49')]['id'];}return db[_0xeaf5('0x3d')][_0xeaf5('0x47')]({'where':{'id':_0x5e1422[_0xeaf5('0x43')]['id']}})[_0xeaf5('0x24')](handleEntityNotFound(_0x308468,null))['then'](saveUpdates(_0x5e1422[_0xeaf5('0x49')],null))[_0xeaf5('0x24')](respondWithResult(_0x308468,null))[_0xeaf5('0x41')](handleError(_0x308468,null));};exports[_0xeaf5('0x25')]=function(_0x10f74d,_0x3e39d7){return db[_0xeaf5('0x3d')][_0xeaf5('0x47')]({'where':{'id':_0x10f74d[_0xeaf5('0x43')]['id']}})[_0xeaf5('0x24')](handleEntityNotFound(_0x3e39d7,null))[_0xeaf5('0x24')](removeEntity(_0x3e39d7,null))[_0xeaf5('0x41')](handleError(_0x3e39d7,null));}; \ No newline at end of file +var _0xb5ff=['Content-Range','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceTransferReport','findAll','rows','catch','params','fields','includeAll','find','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x17d8f4,_0xa046f0){var _0x336743=function(_0x34b3fc){while(--_0x34b3fc){_0x17d8f4['push'](_0x17d8f4['shift']());}};_0x336743(++_0xa046f0);}(_0xb5ff,0x6c));var _0xfb5f=function(_0x405dc0,_0x5f2898){_0x405dc0=_0x405dc0-0x0;var _0x1ed46d=_0xb5ff[_0x405dc0];return _0x1ed46d;};'use strict';var pdf=require(_0xfb5f('0x0'));var emlformat=require(_0xfb5f('0x1'));var rimraf=require(_0xfb5f('0x2'));var zipdir=require(_0xfb5f('0x3'));var jsonpatch=require(_0xfb5f('0x4'));var rp=require('request-promise');var moment=require(_0xfb5f('0x5'));var BPromise=require(_0xfb5f('0x6'));var Mustache=require(_0xfb5f('0x7'));var util=require(_0xfb5f('0x8'));var path=require(_0xfb5f('0x9'));var sox=require(_0xfb5f('0xa'));var csv=require('to-csv');var ejs=require(_0xfb5f('0xb'));var fs=require('fs');var _=require(_0xfb5f('0xc'));var squel=require('squel');var crypto=require(_0xfb5f('0xd'));var jsforce=require(_0xfb5f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfb5f('0xf'));var querystring=require(_0xfb5f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfb5f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb5f('0x12'));var logger=require(_0xfb5f('0x13'))(_0xfb5f('0x14'));var utils=require('../../config/utils');var config=require(_0xfb5f('0x15'));var db=require(_0xfb5f('0x16'))['db'];function respondWithStatusCode(_0x1f6176,_0x31e782){_0x31e782=_0x31e782||0xcc;return function(_0x199b8b){if(_0x199b8b){return _0x1f6176[_0xfb5f('0x17')](_0x31e782);}return _0x1f6176[_0xfb5f('0x18')](_0x31e782)[_0xfb5f('0x19')]();};}function respondWithResult(_0x82a2f,_0x3dc4c7){_0x3dc4c7=_0x3dc4c7||0xc8;return function(_0x423ddd){if(_0x423ddd){return _0x82a2f['status'](_0x3dc4c7)[_0xfb5f('0x1a')](_0x423ddd);}};}function respondWithFilteredResult(_0x29a739,_0x23cd56){return function(_0x4f4431){if(_0x4f4431){var _0x51861a=_0x4f4431[_0xfb5f('0x1b')],_0xf92b1f=_0x23cd56[_0xfb5f('0x1c')],_0x37bff0=_0x23cd56[_0xfb5f('0x1c')]+_0x23cd56[_0xfb5f('0x1d')],_0x1d9df8;if(_0x37bff0>=_0x51861a){_0x37bff0=_0x51861a;_0x1d9df8=0xc8;}else{_0x1d9df8=0xce;}_0x29a739['status'](_0x1d9df8);return _0x29a739['set'](_0xfb5f('0x1e'),_0xf92b1f+'-'+_0x37bff0+'/'+_0x51861a)[_0xfb5f('0x1a')](_0x4f4431);}return null;};}function patchUpdates(_0x11db32){return function(_0x4d3517){try{jsonpatch['apply'](_0x4d3517,_0x11db32,!![]);}catch(_0x27f88f){return BPromise[_0xfb5f('0x1f')](_0x27f88f);}return _0x4d3517['save']();};}function saveUpdates(_0x4e3986,_0x1f45f9){return function(_0x94560d){if(_0x94560d){return _0x94560d[_0xfb5f('0x20')](_0x4e3986)[_0xfb5f('0x21')](function(_0x517f46){return _0x517f46;});}return null;};}function removeEntity(_0x24c667,_0x2910a1){return function(_0x381301){if(_0x381301){return _0x381301[_0xfb5f('0x22')]()[_0xfb5f('0x21')](function(){_0x24c667[_0xfb5f('0x18')](0xcc)[_0xfb5f('0x19')]();});}};}function handleEntityNotFound(_0x2e603a,_0x342935){return function(_0x21bd22){if(!_0x21bd22){_0x2e603a[_0xfb5f('0x17')](0x194);}return _0x21bd22;};}function handleError(_0x9eeecf,_0x43ad86){_0x43ad86=_0x43ad86||0x1f4;return function(_0x545493){logger[_0xfb5f('0x23')](_0x545493['stack']);if(_0x545493[_0xfb5f('0x24')]){delete _0x545493[_0xfb5f('0x24')];}_0x9eeecf[_0xfb5f('0x18')](_0x43ad86)[_0xfb5f('0x25')](_0x545493);};}exports[_0xfb5f('0x26')]=function(_0x3f342f,_0x375179){var _0x15aa02={},_0x40f1df={},_0x2af5ce={'count':0x0,'rows':[]};var _0x259f15=_[_0xfb5f('0x27')](db['VoiceTransferReport'][_0xfb5f('0x28')],function(_0x24e375){return{'name':_0x24e375[_0xfb5f('0x29')],'type':_0x24e375[_0xfb5f('0x2a')]['key']};});_0x40f1df['model']=_[_0xfb5f('0x27')](_0x259f15,_0xfb5f('0x24'));_0x40f1df[_0xfb5f('0x2b')]=_[_0xfb5f('0x2c')](_0x3f342f['query']);_0x40f1df[_0xfb5f('0x2d')]=_[_0xfb5f('0x2e')](_0x40f1df['model'],_0x40f1df[_0xfb5f('0x2b')]);_0x15aa02['attributes']=_[_0xfb5f('0x2e')](_0x40f1df[_0xfb5f('0x2f')],qs['fields'](_0x3f342f[_0xfb5f('0x2b')]['fields']));_0x15aa02[_0xfb5f('0x30')]=_0x15aa02[_0xfb5f('0x30')][_0xfb5f('0x31')]?_0x15aa02[_0xfb5f('0x30')]:_0x40f1df[_0xfb5f('0x2f')];if(!_0x3f342f[_0xfb5f('0x2b')][_0xfb5f('0x32')](_0xfb5f('0x33'))){_0x15aa02[_0xfb5f('0x1d')]=qs[_0xfb5f('0x1d')](_0x3f342f[_0xfb5f('0x2b')][_0xfb5f('0x1d')]);_0x15aa02[_0xfb5f('0x1c')]=qs[_0xfb5f('0x1c')](_0x3f342f[_0xfb5f('0x2b')]['offset']);}_0x15aa02[_0xfb5f('0x34')]=qs['sort'](_0x3f342f[_0xfb5f('0x2b')][_0xfb5f('0x35')]);_0x15aa02[_0xfb5f('0x36')]=qs[_0xfb5f('0x2d')](_[_0xfb5f('0x37')](_0x3f342f['query'],_0x40f1df[_0xfb5f('0x2d')]),_0x259f15);if(_0x3f342f[_0xfb5f('0x2b')][_0xfb5f('0x38')]){_0x15aa02[_0xfb5f('0x36')]=_[_0xfb5f('0x39')](_0x15aa02[_0xfb5f('0x36')],{'$or':_[_0xfb5f('0x27')](_0x259f15,function(_0x212538){if(_0x212538[_0xfb5f('0x2a')]!==_0xfb5f('0x3a')){var _0x2768b0={};_0x2768b0[_0x212538[_0xfb5f('0x24')]]={'$like':'%'+_0x3f342f[_0xfb5f('0x2b')][_0xfb5f('0x38')]+'%'};return _0x2768b0;}})});}_0x15aa02=_[_0xfb5f('0x39')]({},_0x15aa02,_0x3f342f[_0xfb5f('0x3b')]);var _0x53d7fb={'where':_0x15aa02[_0xfb5f('0x36')]};return db[_0xfb5f('0x3c')][_0xfb5f('0x1b')](_0x53d7fb)[_0xfb5f('0x21')](function(_0x19728e){_0x2af5ce[_0xfb5f('0x1b')]=_0x19728e;if(_0x3f342f['query']['includeAll']){_0x15aa02['include']=[{'all':!![]}];}return db[_0xfb5f('0x3c')][_0xfb5f('0x3d')](_0x15aa02);})[_0xfb5f('0x21')](function(_0x281008){_0x2af5ce[_0xfb5f('0x3e')]=_0x281008;return _0x2af5ce;})['then'](respondWithFilteredResult(_0x375179,_0x15aa02))[_0xfb5f('0x3f')](handleError(_0x375179,null));};exports['show']=function(_0x6cf3dc,_0x12dd4d){var _0x43214a={'raw':!![],'where':{'id':_0x6cf3dc[_0xfb5f('0x40')]['id']}},_0x46355c={};_0x46355c[_0xfb5f('0x2f')]=_[_0xfb5f('0x2c')](db['VoiceTransferReport'][_0xfb5f('0x28')]);_0x46355c[_0xfb5f('0x2b')]=_['keys'](_0x6cf3dc[_0xfb5f('0x2b')]);_0x46355c[_0xfb5f('0x2d')]=_[_0xfb5f('0x2e')](_0x46355c[_0xfb5f('0x2f')],_0x46355c[_0xfb5f('0x2b')]);_0x43214a[_0xfb5f('0x30')]=_['intersection'](_0x46355c['model'],qs[_0xfb5f('0x41')](_0x6cf3dc[_0xfb5f('0x2b')][_0xfb5f('0x41')]));_0x43214a[_0xfb5f('0x30')]=_0x43214a[_0xfb5f('0x30')][_0xfb5f('0x31')]?_0x43214a['attributes']:_0x46355c[_0xfb5f('0x2f')];if(_0x6cf3dc[_0xfb5f('0x2b')][_0xfb5f('0x42')]){_0x43214a['include']=[{'all':!![]}];}_0x43214a=_[_0xfb5f('0x39')]({},_0x43214a,_0x6cf3dc[_0xfb5f('0x3b')]);return db[_0xfb5f('0x3c')][_0xfb5f('0x43')](_0x43214a)[_0xfb5f('0x21')](handleEntityNotFound(_0x12dd4d,null))[_0xfb5f('0x21')](respondWithResult(_0x12dd4d,null))['catch'](handleError(_0x12dd4d,null));};exports['create']=function(_0x5dd86b,_0x138d72){return db[_0xfb5f('0x3c')]['create'](_0x5dd86b['body'],{})['then'](respondWithResult(_0x138d72,0xc9))['catch'](handleError(_0x138d72,null));};exports['update']=function(_0x226dc3,_0x1b2ba6){if(_0x226dc3[_0xfb5f('0x44')]['id']){delete _0x226dc3[_0xfb5f('0x44')]['id'];}return db[_0xfb5f('0x3c')][_0xfb5f('0x43')]({'where':{'id':_0x226dc3['params']['id']}})[_0xfb5f('0x21')](handleEntityNotFound(_0x1b2ba6,null))[_0xfb5f('0x21')](saveUpdates(_0x226dc3[_0xfb5f('0x44')],null))[_0xfb5f('0x21')](respondWithResult(_0x1b2ba6,null))[_0xfb5f('0x3f')](handleError(_0x1b2ba6,null));};exports[_0xfb5f('0x22')]=function(_0x2171b0,_0x949807){return db[_0xfb5f('0x3c')][_0xfb5f('0x43')]({'where':{'id':_0x2171b0[_0xfb5f('0x40')]['id']}})[_0xfb5f('0x21')](handleEntityNotFound(_0x949807,null))['then'](removeEntity(_0x949807,null))[_0xfb5f('0x3f')](handleError(_0x949807,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index a92f309..9bca341 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 _0x3ac7=['path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','util','../../config/logger','api','request-promise'];(function(_0x38af48,_0x400460){var _0x445384=function(_0x464435){while(--_0x464435){_0x38af48['push'](_0x38af48['shift']());}};_0x445384(++_0x400460);}(_0x3ac7,0x1e6));var _0x73ac=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x3ac7[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0x73ac('0x0'));var logger=require(_0x73ac('0x1'))(_0x73ac('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x73ac('0x3'));var fs=require('fs');var path=require(_0x73ac('0x4'));var rimraf=require(_0x73ac('0x5'));var config=require(_0x73ac('0x6'));var attributes=require(_0x73ac('0x7'));module[_0x73ac('0x8')]=function(_0x23c168,_0x30f15e){return _0x23c168[_0x73ac('0x9')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4312=['./voiceTransferReport.attributes','define','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x18a6cc,_0x5ab117){var _0x166f89=function(_0x2fee60){while(--_0x2fee60){_0x18a6cc['push'](_0x18a6cc['shift']());}};_0x166f89(++_0x5ab117);}(_0x4312,0xd3));var _0x2431=function(_0x31210e,_0x1785ff){_0x31210e=_0x31210e-0x0;var _0x2167db=_0x4312[_0x31210e];return _0x2167db;};'use strict';var _=require(_0x2431('0x0'));var util=require(_0x2431('0x1'));var logger=require(_0x2431('0x2'))(_0x2431('0x3'));var moment=require(_0x2431('0x4'));var BPromise=require(_0x2431('0x5'));var rp=require(_0x2431('0x6'));var fs=require('fs');var path=require(_0x2431('0x7'));var rimraf=require(_0x2431('0x8'));var config=require(_0x2431('0x9'));var attributes=require(_0x2431('0xa'));module['exports']=function(_0x46cfe5,_0x506dfd){return _0x46cfe5[_0x2431('0xb')]('VoiceTransferReport',attributes,{'tableName':_0x2431('0xc'),'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 7c13013..728ff4b 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 _0x9cad=['lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','options','CreateVoiceTransferReport','debug'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x9cad,0x96));var _0xd9ca=function(_0x35b195,_0x8893d5){_0x35b195=_0x35b195-0x0;var _0x2433bf=_0x9cad[_0x35b195];return _0x2433bf;};'use strict';var _=require(_0xd9ca('0x0'));var util=require(_0xd9ca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9ca('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd9ca('0x3'));var logger=require(_0xd9ca('0x4'))(_0xd9ca('0x5'));var config=require(_0xd9ca('0x6'));var jayson=require(_0xd9ca('0x7'));var client=jayson[_0xd9ca('0x8')][_0xd9ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x596e68,_0x574a19,_0x378e30){return new BPromise(function(_0x1ccbca,_0xac2897){return client['request'](_0x596e68,_0x378e30)[_0xd9ca('0xa')](function(_0x3bf54a){logger[_0xd9ca('0xb')](_0xd9ca('0xc'),_0x574a19,_0xd9ca('0xd'));logger['debug'](_0xd9ca('0xe'),_0x574a19,_0xd9ca('0xd'),JSON[_0xd9ca('0xf')](_0x3bf54a));if(_0x3bf54a[_0xd9ca('0x10')]){if(_0x3bf54a[_0xd9ca('0x10')][_0xd9ca('0x11')]===0x1f4){logger[_0xd9ca('0x10')](_0xd9ca('0xc'),_0x574a19,_0x3bf54a[_0xd9ca('0x10')][_0xd9ca('0x12')]);return _0xac2897(_0x3bf54a[_0xd9ca('0x10')][_0xd9ca('0x12')]);}logger['error'](_0xd9ca('0xc'),_0x574a19,_0x3bf54a[_0xd9ca('0x10')][_0xd9ca('0x12')]);return _0x1ccbca(_0x3bf54a[_0xd9ca('0x10')][_0xd9ca('0x12')]);}else{logger[_0xd9ca('0xb')](_0xd9ca('0xc'),_0x574a19,_0xd9ca('0xd'));_0x1ccbca(_0x3bf54a[_0xd9ca('0x13')][_0xd9ca('0x12')]);}})[_0xd9ca('0x14')](function(_0x1e678a){logger[_0xd9ca('0x10')](_0xd9ca('0xc'),_0x574a19,_0x1e678a);_0xac2897(_0x1e678a);});});}exports['CreateVoiceTransferReport']=function(_0x1a9d6e){var _0x4613bd=this;return new Promise(function(_0x381e8e,_0x2d23fd){return db['VoiceTransferReport'][_0xd9ca('0x15')](_0x1a9d6e['body'],{'raw':_0x1a9d6e['options']?_0x1a9d6e[_0xd9ca('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1db096){logger[_0xd9ca('0xb')](_0xd9ca('0x17'),_0x1a9d6e);logger[_0xd9ca('0x18')](_0xd9ca('0x17'),_0x1a9d6e,JSON[_0xd9ca('0xf')](_0x1db096));_0x381e8e(_0x1db096);})[_0xd9ca('0x14')](function(_0x2f3ed5){logger[_0xd9ca('0x10')](_0xd9ca('0x17'),_0x2f3ed5['message'],_0x1a9d6e);_0x2d23fd(_0x4613bd[_0xd9ca('0x10')](0x1f4,_0x2f3ed5['message']));});});}; \ No newline at end of file +var _0x04b5=['CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceTransferReport','create','body','options','raw'];(function(_0xce8627,_0x1a8bdf){var _0x146bc8=function(_0x1e3931){while(--_0x1e3931){_0xce8627['push'](_0xce8627['shift']());}};_0x146bc8(++_0x1a8bdf);}(_0x04b5,0x140));var _0x504b=function(_0x131cff,_0x489f20){_0x131cff=_0x131cff-0x0;var _0x3726da=_0x04b5[_0x131cff];return _0x3726da;};'use strict';var _=require(_0x504b('0x0'));var util=require(_0x504b('0x1'));var moment=require(_0x504b('0x2'));var BPromise=require(_0x504b('0x3'));var rs=require(_0x504b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x504b('0x5'))['db'];var utils=require(_0x504b('0x6'));var logger=require(_0x504b('0x7'))(_0x504b('0x8'));var config=require('../../config/environment');var jayson=require(_0x504b('0x9'));var client=jayson[_0x504b('0xa')][_0x504b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b4fc4,_0x430994,_0x555411){return new BPromise(function(_0x486cc2,_0x4ea8f7){return client['request'](_0x5b4fc4,_0x555411)[_0x504b('0xc')](function(_0x44257d){logger[_0x504b('0xd')](_0x504b('0xe'),_0x430994,'request\x20sent');logger['debug'](_0x504b('0xf'),_0x430994,_0x504b('0x10'),JSON[_0x504b('0x11')](_0x44257d));if(_0x44257d[_0x504b('0x12')]){if(_0x44257d['error'][_0x504b('0x13')]===0x1f4){logger[_0x504b('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x430994,_0x44257d[_0x504b('0x12')][_0x504b('0x14')]);return _0x4ea8f7(_0x44257d[_0x504b('0x12')][_0x504b('0x14')]);}logger[_0x504b('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x430994,_0x44257d['error']['message']);return _0x486cc2(_0x44257d['error'][_0x504b('0x14')]);}else{logger[_0x504b('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x430994,_0x504b('0x10'));_0x486cc2(_0x44257d[_0x504b('0x15')][_0x504b('0x14')]);}})[_0x504b('0x16')](function(_0x551bbf){logger[_0x504b('0x12')](_0x504b('0xe'),_0x430994,_0x551bbf);_0x4ea8f7(_0x551bbf);});});}exports['CreateVoiceTransferReport']=function(_0x1229b1){var _0x405062=this;return new Promise(function(_0x4f962e,_0x3a853a){return db[_0x504b('0x17')][_0x504b('0x18')](_0x1229b1[_0x504b('0x19')],{'raw':_0x1229b1['options']?_0x1229b1[_0x504b('0x1a')][_0x504b('0x1b')]===undefined?!![]:![]:!![]})[_0x504b('0xc')](function(_0x239f2a){logger[_0x504b('0xd')](_0x504b('0x1c'),_0x1229b1);logger['debug']('CreateVoiceTransferReport',_0x1229b1,JSON[_0x504b('0x11')](_0x239f2a));_0x4f962e(_0x239f2a);})[_0x504b('0x16')](function(_0x38216e){logger[_0x504b('0x12')]('CreateVoiceTransferReport',_0x38216e[_0x504b('0x14')],_0x1229b1);_0x3a853a(_0x405062['error'](0x1f4,_0x38216e[_0x504b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index a6b356c..05ffea2 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 _0x8d97=['calls','/transfer','transfer','exports','Router','../../components/auth/service','post','/originate','isAuthenticated','canUpdate','originate','/hangup','answer','/hold','hold','/unhold','unhold','/calls'];(function(_0x1c8e15,_0x1a7c23){var _0x410531=function(_0x3f028b){while(--_0x3f028b){_0x1c8e15['push'](_0x1c8e15['shift']());}};_0x410531(++_0x1a7c23);}(_0x8d97,0x82));var _0x78d9=function(_0x5391fb,_0x786bf0){_0x5391fb=_0x5391fb-0x0;var _0x1b3ef3=_0x8d97[_0x5391fb];return _0x1b3ef3;};'use strict';var express=require('express');var router=express[_0x78d9('0x0')]();var auth=require(_0x78d9('0x1'));var controller=require('./webbar.controller');router[_0x78d9('0x2')](_0x78d9('0x3'),auth[_0x78d9('0x4')](),auth[_0x78d9('0x5')](),controller[_0x78d9('0x6')]);router['post'](_0x78d9('0x7'),auth[_0x78d9('0x4')](),auth[_0x78d9('0x5')](),controller['hangup']);router['post']('/answer',auth[_0x78d9('0x4')](),auth[_0x78d9('0x5')](),controller[_0x78d9('0x8')]);router[_0x78d9('0x2')](_0x78d9('0x9'),auth[_0x78d9('0x4')](),auth['canUpdate'](),controller[_0x78d9('0xa')]);router[_0x78d9('0x2')](_0x78d9('0xb'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x78d9('0xc')]);router[_0x78d9('0x2')](_0x78d9('0xd'),auth[_0x78d9('0x4')](),auth[_0x78d9('0x5')](),controller[_0x78d9('0xe')]);router['post'](_0x78d9('0xf'),auth[_0x78d9('0x4')](),auth[_0x78d9('0x5')](),controller[_0x78d9('0x10')]);module[_0x78d9('0x11')]=router; \ No newline at end of file +var _0x6b19=['hold','/unhold','/calls','calls','/transfer','transfer','exports','express','Router','./webbar.controller','isAuthenticated','canUpdate','originate','post','/hangup'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6b19,0xe8));var _0x96b1=function(_0x38fe68,_0x4959de){_0x38fe68=_0x38fe68-0x0;var _0xec066c=_0x6b19[_0x38fe68];return _0xec066c;};'use strict';var express=require(_0x96b1('0x0'));var router=express[_0x96b1('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x96b1('0x2'));router['post']('/originate',auth[_0x96b1('0x3')](),auth[_0x96b1('0x4')](),controller[_0x96b1('0x5')]);router[_0x96b1('0x6')](_0x96b1('0x7'),auth['isAuthenticated'](),auth[_0x96b1('0x4')](),controller['hangup']);router[_0x96b1('0x6')]('/answer',auth['isAuthenticated'](),auth[_0x96b1('0x4')](),controller['answer']);router[_0x96b1('0x6')]('/hold',auth[_0x96b1('0x3')](),auth[_0x96b1('0x4')](),controller[_0x96b1('0x8')]);router[_0x96b1('0x6')](_0x96b1('0x9'),auth[_0x96b1('0x3')](),auth[_0x96b1('0x4')](),controller['unhold']);router['post'](_0x96b1('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x96b1('0xb')]);router[_0x96b1('0x6')](_0x96b1('0xc'),auth['isAuthenticated'](),auth[_0x96b1('0x4')](),controller[_0x96b1('0xd')]);module[_0x96b1('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 6387752..ddd25e5 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 _0xc737=['\x20not\x20found!','originate','info','originate\x20fired:','body','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup\x20fired:','validate','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','../../config/logger','webbarapi','defaults','redis','socket.io-emitter','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','stack','name','status','send','request','then','error','code','message','catch','User','findOne','VoiceChannels','all','filter','rows','sessionId','length','sessionId\x20'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc737,0x154));var _0x7c73=function(_0x1d75bd,_0x17c831){_0x1d75bd=_0x1d75bd-0x0;var _0x16028f=_0xc737[_0x1d75bd];return _0x16028f;};'use strict';var path=require(_0x7c73('0x0'));var fs=require('fs');var _=require(_0x7c73('0x1'));var db=require(_0x7c73('0x2'))['db'];var config=require(_0x7c73('0x3'));var util=require('util');var BPromise=require(_0x7c73('0x4'));var jayson=require(_0x7c73('0x5'));var amiClient=jayson[_0x7c73('0x6')]['http']({'port':0x232a});var logger=require(_0x7c73('0x7'))(_0x7c73('0x8'));var Redis=require('ioredis');config['redis']=_[_0x7c73('0x9')](config[_0x7c73('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x7c73('0xb'))(new Redis(config[_0x7c73('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7c73('0xc')]},'callNumber':{'type':_0x7c73('0xd'),'required':[!![],_0x7c73('0xe')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x7c73('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x7c73('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x7c73('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7c73('0xc')]},'sessionId':{'type':_0x7c73('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x7c73('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x7c73('0xd'),'required':[!![],_0x7c73('0x10')]},'transferNumber':{'type':_0x7c73('0xd'),'required':[!![],_0x7c73('0x11')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7c73('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x7c73('0xf'),'required':[!![],_0x7c73('0xc')]},'sessionId':{'type':_0x7c73('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x7c73('0xf'),'required':[!![],_0x7c73('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x7c73('0xf'),'required':[!![],_0x7c73('0xc')]}});function emit(_0x15be28,_0x5091d6,_0xbf66e){logger['info'](_0x15be28,_0x5091d6,JSON[_0x7c73('0x12')](_0xbf66e));io['to'](_0x15be28)[_0x7c73('0x13')](_0x5091d6,_0xbf66e);}function handleError(_0x4fafb7){return function(_0x534a39){console[_0x7c73('0x14')]('handleError:',_0x534a39,_0x534a39 instanceof RangeError);logger['error'](_0x534a39[_0x7c73('0x15')]);if(_0x534a39 instanceof RangeError){if(_0x534a39[_0x7c73('0x16')]){delete _0x534a39[_0x7c73('0x16')];}_0x4fafb7[_0x7c73('0x17')](0x194)['send'](_0x534a39);}else{if(_0x534a39[_0x7c73('0x16')]){delete _0x534a39[_0x7c73('0x16')];}_0x4fafb7[_0x7c73('0x17')](0x1f4)[_0x7c73('0x18')](_0x534a39);}};}function checkError(){return function(_0x359c26){if(!_0x359c26){throw new RangeError('NotFound');}return _0x359c26;};}function respondWithRpcPromise(_0x2cf4d6,_0x2f9ad7){return new BPromise(function(_0x42867c,_0x1745d9){var _0x3b752c=amiClient;return _0x3b752c[_0x7c73('0x19')](_0x2cf4d6,_0x2f9ad7)[_0x7c73('0x1a')](function(_0x6d5714){if(_0x6d5714[_0x7c73('0x1b')]){if(_0x6d5714['error'][_0x7c73('0x1c')]===0x1f4){return _0x1745d9(_0x6d5714['error'][_0x7c73('0x1d')]);}return _0x42867c(_0x6d5714['error'][_0x7c73('0x1d')]);}else{_0x42867c(_0x6d5714['result']);}})[_0x7c73('0x1e')](function(_0x5c8f9d){_0x1745d9(_0x5c8f9d);});});}function getAgent(_0xd695c6){return db[_0x7c73('0x1f')][_0x7c73('0x20')]({'where':{'id':_0xd695c6,'role':'agent'}})[_0x7c73('0x1a')](checkError());}function getAgentCheckSession(_0x12113d,_0x422094){return new BPromise(function(_0x5ad41e,_0x31f8af){var _0x14c5a0=respondWithRpcPromise(_0x7c73('0x21'));var _0x3c9a44=getAgent(_0x12113d);Promise[_0x7c73('0x22')]([_0x14c5a0,_0x3c9a44])[_0x7c73('0x1a')](function(_0x5800eb){var _0x5909ec=_0x5800eb[0x0];var _0x485f0a=_0x5800eb[0x1];var _0x30fa4f=_[_0x7c73('0x23')](_0x5909ec[_0x7c73('0x24')],function(_0x49b1ad){return _0x49b1ad['UserId']==_0x485f0a['id']&&_0x49b1ad[_0x7c73('0x25')]==_0x422094;});if(_0x30fa4f[_0x7c73('0x26')]==0x1){_0x5ad41e(_0x485f0a);}else{_0x31f8af(new RangeError(_0x7c73('0x27')+_0x422094+_0x7c73('0x28')));}});});}exports[_0x7c73('0x29')]=function(_0x2b924f,_0x353dd0){logger[_0x7c73('0x2a')](_0x7c73('0x2b'),_0x2b924f[_0x7c73('0x2c')]);var _0x50d0ea=originateValidation['validate'](_0x2b924f[_0x7c73('0x2c')]);if(_0x50d0ea[_0x7c73('0x26')]>0x0){return _0x353dd0[_0x7c73('0x17')](0x190)['json'](_0x50d0ea);}var _0x201905=_0x2b924f[_0x7c73('0x2c')][_0x7c73('0x2d')];var _0xdab0d8=_0x2b924f[_0x7c73('0x2c')][_0x7c73('0x2e')];var _0x282366=_0x2b924f[_0x7c73('0x2c')]['callerId'];var _0x34c9e3=_0x2b924f[_0x7c73('0x2c')][_0x7c73('0x2f')];return getAgent(_0x201905)[_0x7c73('0x1a')](function(_0xe670a4){logger[_0x7c73('0x2a')](_0x7c73('0x30'),_0xe670a4[_0x7c73('0x16')]);emit(util[_0x7c73('0x31')](_0x7c73('0x32'),_0xe670a4[_0x7c73('0x16')]),_0x7c73('0x33'),{'callNumber':_0xdab0d8,'callerId':_0x282366,'callbackUrl':_0x34c9e3});return _0x353dd0[_0x7c73('0x17')](0xc8)[_0x7c73('0x34')]({'error':![],'message':_0x7c73('0x35')});})[_0x7c73('0x1e')](handleError(_0x353dd0));};exports['hangup']=function(_0x30690b,_0x2484b4){logger['info'](_0x7c73('0x36'),_0x30690b[_0x7c73('0x2c')]);var _0x55a86d=hangupValidation[_0x7c73('0x37')](_0x30690b['body']);if(_0x55a86d[_0x7c73('0x26')]>0x0){return _0x2484b4[_0x7c73('0x17')](0x190)[_0x7c73('0x34')](_0x55a86d);}var _0x2bbabd=_0x30690b[_0x7c73('0x2c')][_0x7c73('0x2d')];var _0x35e662=_0x30690b[_0x7c73('0x2c')][_0x7c73('0x25')];return getAgent(_0x2bbabd)['then'](function(_0xbc9094){logger[_0x7c73('0x2a')](_0x7c73('0x30'),_0xbc9094[_0x7c73('0x16')]);emit(util[_0x7c73('0x31')]('user:%s',_0xbc9094['name']),_0x7c73('0x38'),{'sessionId':_0x35e662});return _0x2484b4[_0x7c73('0x17')](0xc8)[_0x7c73('0x34')]({'error':![],'message':_0x7c73('0x39')});})[_0x7c73('0x1e')](handleError(_0x2484b4));};exports[_0x7c73('0x3a')]=function(_0x3ef9c1,_0x1e9c21){logger['info'](_0x7c73('0x3b'),_0x3ef9c1[_0x7c73('0x2c')]);var _0x36b18e=answerValidation[_0x7c73('0x37')](_0x3ef9c1[_0x7c73('0x2c')]);if(_0x36b18e[_0x7c73('0x26')]>0x0){return _0x1e9c21['status'](0x190)[_0x7c73('0x34')](_0x36b18e);}var _0x1b0a6f=_0x3ef9c1[_0x7c73('0x2c')][_0x7c73('0x2d')];var _0x4ef5c3=_0x3ef9c1['body']['sessionId'];return getAgent(_0x1b0a6f)[_0x7c73('0x1a')](function(_0x208908){logger[_0x7c73('0x2a')](_0x7c73('0x30'),_0x208908['name']);emit(util[_0x7c73('0x31')](_0x7c73('0x32'),_0x208908[_0x7c73('0x16')]),_0x7c73('0x3c'),{'sessionId':_0x4ef5c3});return _0x1e9c21[_0x7c73('0x17')](0xc8)[_0x7c73('0x34')]({'error':![],'message':_0x7c73('0x3d')});})[_0x7c73('0x1e')](handleError(_0x1e9c21));};exports['hold']=function(_0x1e50ee,_0x5a6fa1){logger['info'](_0x7c73('0x3e'),_0x1e50ee[_0x7c73('0x2c')]);var _0x3c8884=holdValidation[_0x7c73('0x37')](_0x1e50ee['body']);if(_0x3c8884[_0x7c73('0x26')]>0x0){return _0x5a6fa1['status'](0x190)[_0x7c73('0x34')](_0x3c8884);}var _0x51425d=_0x1e50ee['body'][_0x7c73('0x2d')];var _0x9c9369=_0x1e50ee[_0x7c73('0x2c')][_0x7c73('0x25')];return getAgent(_0x51425d)['then'](function(_0x291c15){logger[_0x7c73('0x2a')]('entityFound:',_0x291c15[_0x7c73('0x16')]);emit(util['format'](_0x7c73('0x32'),_0x291c15['name']),'webbar:hold',{'sessionId':_0x9c9369});return _0x5a6fa1[_0x7c73('0x17')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0x7c73('0x1e')](handleError(_0x5a6fa1));};exports[_0x7c73('0x3f')]=function(_0x400077,_0x488308){logger['info'](_0x7c73('0x40'),_0x400077[_0x7c73('0x2c')]);var _0x181ee0=unholdValidation[_0x7c73('0x37')](_0x400077[_0x7c73('0x2c')]);if(_0x181ee0['length']>0x0){return _0x488308['status'](0x190)[_0x7c73('0x34')](_0x181ee0);}var _0x43fdd3=_0x400077[_0x7c73('0x2c')][_0x7c73('0x2d')];var _0x35bf24=_0x400077[_0x7c73('0x2c')]['sessionId'];return getAgent(_0x43fdd3)['then'](function(_0x213708){logger[_0x7c73('0x2a')](_0x7c73('0x30'),_0x213708['name']);emit(util['format'](_0x7c73('0x32'),_0x213708[_0x7c73('0x16')]),_0x7c73('0x41'),{'sessionId':_0x35bf24});return _0x488308[_0x7c73('0x17')](0xc8)[_0x7c73('0x34')]({'error':![],'message':_0x7c73('0x42')});})['catch'](handleError(_0x488308));};exports['calls']=function(_0x2fc151,_0x25d61f){logger[_0x7c73('0x2a')](_0x7c73('0x43'),_0x25d61f[_0x7c73('0x2c')]);var _0x2d8461=callsValidation[_0x7c73('0x37')](_0x2fc151[_0x7c73('0x2c')]);if(_0x2d8461[_0x7c73('0x26')]>0x0){return _0x25d61f['status'](0x190)[_0x7c73('0x34')](_0x2d8461);}var _0x1b4967=_0x2fc151[_0x7c73('0x2c')][_0x7c73('0x2d')];var _0xa76b80=respondWithRpcPromise('VoiceChannels');var _0x80b2a5=getAgent(_0x1b4967);return Promise[_0x7c73('0x22')]([_0xa76b80,_0x80b2a5])[_0x7c73('0x1a')](function(_0x403537){var _0x33e8b9=_0x403537[0x0];var _0x542945=_0x403537[0x1];var _0x3d3e69=_[_0x7c73('0x23')](_0x33e8b9['rows'],function(_0x29c8b1){return _0x29c8b1[_0x7c73('0x44')]==_0x542945['id'];});return _0x25d61f['status'](0xc8)['json']({'count':_0x3d3e69[_0x7c73('0x26')],'rows':_0x3d3e69});})[_0x7c73('0x1e')](handleError(_0x25d61f));};exports[_0x7c73('0x45')]=function(_0x23ff58,_0x49756c){logger[_0x7c73('0x2a')](_0x7c73('0x46'),_0x23ff58[_0x7c73('0x2c')]);var _0x5a60c4=conferenceValidation[_0x7c73('0x37')](_0x23ff58[_0x7c73('0x2c')]);if(_0x5a60c4[_0x7c73('0x26')]>0x0){return _0x49756c[_0x7c73('0x17')](0x190)['json'](_0x5a60c4);}var _0x481a37=_0x23ff58[_0x7c73('0x2c')]['userId'];return getAgent(_0x481a37)['then'](function(_0x5f3ec7){logger[_0x7c73('0x2a')](_0x7c73('0x30'),_0x5f3ec7[_0x7c73('0x16')]);emit(util[_0x7c73('0x31')](_0x7c73('0x32'),_0x5f3ec7[_0x7c73('0x16')]),_0x7c73('0x47'));return _0x49756c[_0x7c73('0x17')](0xc8)[_0x7c73('0x34')]({'error':![],'message':_0x7c73('0x48')});})['catch'](handleError(_0x49756c));};exports[_0x7c73('0x49')]=function(_0x1af980,_0x393326){logger['info']('transfer\x20fired:',_0x1af980[_0x7c73('0x2c')]);var _0x32eca5=transferValidation['validate'](_0x1af980['body']);if(_0x32eca5[_0x7c73('0x26')]>0x0){return _0x393326[_0x7c73('0x17')](0x190)[_0x7c73('0x34')](_0x32eca5);}var _0x1423d7=_0x1af980[_0x7c73('0x2c')][_0x7c73('0x2d')];var _0x426881=_0x1af980['body'][_0x7c73('0x25')];var _0x4433d8=_0x1af980[_0x7c73('0x2c')][_0x7c73('0x4a')];return getAgent(_0x1423d7)['then'](function(_0x5ccfca){logger[_0x7c73('0x2a')](_0x7c73('0x30'),_0x5ccfca['name']);emit(util[_0x7c73('0x31')](_0x7c73('0x32'),_0x5ccfca[_0x7c73('0x16')]),'webbar:transfer',{'sessionId':_0x426881,'transferNumber':_0x4433d8});return _0x393326[_0x7c73('0x17')](0xc8)[_0x7c73('0x34')]({'error':![],'message':_0x7c73('0x4b')});})[_0x7c73('0x1e')](handleError(_0x393326));}; \ No newline at end of file +var _0xc034=['transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','validate','entityFound:','answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','webbar:unhold','calls','calls\x20fired:','conference','conference\x20fired:','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','number','userId\x20is\x20required','string','sessionId\x20is\x20required'];(function(_0x340cf5,_0xd979e1){var _0x297d14=function(_0x31683f){while(--_0x31683f){_0x340cf5['push'](_0x340cf5['shift']());}};_0x297d14(++_0xd979e1);}(_0xc034,0x170));var _0x4c03=function(_0x3e6fc2,_0x46ab1d){_0x3e6fc2=_0x3e6fc2-0x0;var _0x33df1c=_0xc034[_0x3e6fc2];return _0x33df1c;};'use strict';var path=require(_0x4c03('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x4c03('0x1'))['db'];var config=require(_0x4c03('0x2'));var util=require(_0x4c03('0x3'));var BPromise=require(_0x4c03('0x4'));var jayson=require(_0x4c03('0x5'));var amiClient=jayson[_0x4c03('0x6')][_0x4c03('0x7')]({'port':0x232a});var logger=require(_0x4c03('0x8'))(_0x4c03('0x9'));var Redis=require(_0x4c03('0xa'));config[_0x4c03('0xb')]=_['defaults'](config[_0x4c03('0xb')],{'host':_0x4c03('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x4c03('0xd'),'required':[!![],_0x4c03('0xe')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x4c03('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x4c03('0xd'),'required':[!![],_0x4c03('0xe')]},'sessionId':{'type':_0x4c03('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4c03('0xd'),'required':[!![],_0x4c03('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4c03('0xd'),'required':[!![],_0x4c03('0xe')]},'sessionId':{'type':_0x4c03('0xf'),'required':[!![],_0x4c03('0x10')]},'transferNumber':{'type':'string','required':[!![],_0x4c03('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x4c03('0xd'),'required':[!![],_0x4c03('0xe')]},'sessionId':{'type':_0x4c03('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x4c03('0xd'),'required':[!![],_0x4c03('0xe')]},'sessionId':{'type':_0x4c03('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4c03('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4c03('0xe')]}});function emit(_0xc59477,_0x2cd36a,_0x5ac6f9){logger[_0x4c03('0x12')](_0xc59477,_0x2cd36a,JSON[_0x4c03('0x13')](_0x5ac6f9));io['to'](_0xc59477)[_0x4c03('0x14')](_0x2cd36a,_0x5ac6f9);}function handleError(_0x793610){return function(_0x5bc41b){console[_0x4c03('0x15')](_0x4c03('0x16'),_0x5bc41b,_0x5bc41b instanceof RangeError);logger[_0x4c03('0x17')](_0x5bc41b[_0x4c03('0x18')]);if(_0x5bc41b instanceof RangeError){if(_0x5bc41b['name']){delete _0x5bc41b[_0x4c03('0x19')];}_0x793610[_0x4c03('0x1a')](0x194)[_0x4c03('0x1b')](_0x5bc41b);}else{if(_0x5bc41b[_0x4c03('0x19')]){delete _0x5bc41b[_0x4c03('0x19')];}_0x793610[_0x4c03('0x1a')](0x1f4)[_0x4c03('0x1b')](_0x5bc41b);}};}function checkError(){return function(_0x4d6f5d){if(!_0x4d6f5d){throw new RangeError(_0x4c03('0x1c'));}return _0x4d6f5d;};}function respondWithRpcPromise(_0x18f3b2,_0x517db1){return new BPromise(function(_0x546c8c,_0x4ce212){var _0x42cc4b=amiClient;return _0x42cc4b[_0x4c03('0x1d')](_0x18f3b2,_0x517db1)[_0x4c03('0x1e')](function(_0x3ead7b){if(_0x3ead7b[_0x4c03('0x17')]){if(_0x3ead7b['error'][_0x4c03('0x1f')]===0x1f4){return _0x4ce212(_0x3ead7b[_0x4c03('0x17')][_0x4c03('0x20')]);}return _0x546c8c(_0x3ead7b['error'][_0x4c03('0x20')]);}else{_0x546c8c(_0x3ead7b[_0x4c03('0x21')]);}})[_0x4c03('0x22')](function(_0x44fb02){_0x4ce212(_0x44fb02);});});}function getAgent(_0x4d3533){return db['User'][_0x4c03('0x23')]({'where':{'id':_0x4d3533,'role':_0x4c03('0x24')}})[_0x4c03('0x1e')](checkError());}function getAgentCheckSession(_0x1af8a5,_0x38d22b){return new BPromise(function(_0x530cf3,_0x5f55f1){var _0x4631bd=respondWithRpcPromise(_0x4c03('0x25'));var _0x3068ab=getAgent(_0x1af8a5);Promise[_0x4c03('0x26')]([_0x4631bd,_0x3068ab])[_0x4c03('0x1e')](function(_0x103191){var _0x2f7528=_0x103191[0x0];var _0x5cab83=_0x103191[0x1];var _0x2ba07d=_[_0x4c03('0x27')](_0x2f7528[_0x4c03('0x28')],function(_0x2f638a){return _0x2f638a[_0x4c03('0x29')]==_0x5cab83['id']&&_0x2f638a[_0x4c03('0x2a')]==_0x38d22b;});if(_0x2ba07d[_0x4c03('0x2b')]==0x1){_0x530cf3(_0x5cab83);}else{_0x5f55f1(new RangeError(_0x4c03('0x2c')+_0x38d22b+_0x4c03('0x2d')));}});});}exports[_0x4c03('0x2e')]=function(_0x4d26fd,_0x1e5557){logger[_0x4c03('0x12')](_0x4c03('0x2f'),_0x4d26fd[_0x4c03('0x30')]);var _0x1b49bd=originateValidation['validate'](_0x4d26fd['body']);if(_0x1b49bd[_0x4c03('0x2b')]>0x0){return _0x1e5557[_0x4c03('0x1a')](0x190)[_0x4c03('0x31')](_0x1b49bd);}var _0x20f368=_0x4d26fd[_0x4c03('0x30')][_0x4c03('0x32')];var _0x1ed4e4=_0x4d26fd[_0x4c03('0x30')][_0x4c03('0x33')];var _0x2e9e90=_0x4d26fd['body'][_0x4c03('0x34')];var _0x6a4e44=_0x4d26fd[_0x4c03('0x30')][_0x4c03('0x35')];return getAgent(_0x20f368)[_0x4c03('0x1e')](function(_0x33a183){logger['info']('entityFound:',_0x33a183[_0x4c03('0x19')]);emit(util[_0x4c03('0x36')](_0x4c03('0x37'),_0x33a183[_0x4c03('0x19')]),_0x4c03('0x38'),{'callNumber':_0x1ed4e4,'callerId':_0x2e9e90,'callbackUrl':_0x6a4e44});return _0x1e5557['status'](0xc8)['json']({'error':![],'message':_0x4c03('0x39')});})[_0x4c03('0x22')](handleError(_0x1e5557));};exports['hangup']=function(_0xbd3e6b,_0x567615){logger[_0x4c03('0x12')](_0x4c03('0x3a'),_0xbd3e6b[_0x4c03('0x30')]);var _0x4b23ba=hangupValidation[_0x4c03('0x3b')](_0xbd3e6b['body']);if(_0x4b23ba['length']>0x0){return _0x567615[_0x4c03('0x1a')](0x190)[_0x4c03('0x31')](_0x4b23ba);}var _0x120460=_0xbd3e6b[_0x4c03('0x30')]['userId'];var _0x5c1363=_0xbd3e6b['body']['sessionId'];return getAgent(_0x120460)['then'](function(_0x539674){logger[_0x4c03('0x12')](_0x4c03('0x3c'),_0x539674['name']);emit(util[_0x4c03('0x36')](_0x4c03('0x37'),_0x539674[_0x4c03('0x19')]),'webbar:hangup',{'sessionId':_0x5c1363});return _0x567615['status'](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x567615));};exports[_0x4c03('0x3d')]=function(_0x1584b1,_0x590fde){logger[_0x4c03('0x12')]('answer\x20fired:',_0x1584b1[_0x4c03('0x30')]);var _0x414a8b=answerValidation[_0x4c03('0x3b')](_0x1584b1['body']);if(_0x414a8b['length']>0x0){return _0x590fde[_0x4c03('0x1a')](0x190)['json'](_0x414a8b);}var _0x1bd4ad=_0x1584b1[_0x4c03('0x30')][_0x4c03('0x32')];var _0x367b77=_0x1584b1[_0x4c03('0x30')][_0x4c03('0x2a')];return getAgent(_0x1bd4ad)[_0x4c03('0x1e')](function(_0x1cb331){logger[_0x4c03('0x12')](_0x4c03('0x3c'),_0x1cb331[_0x4c03('0x19')]);emit(util['format']('user:%s',_0x1cb331[_0x4c03('0x19')]),'webbar:answer',{'sessionId':_0x367b77});return _0x590fde[_0x4c03('0x1a')](0xc8)[_0x4c03('0x31')]({'error':![],'message':_0x4c03('0x3e')});})[_0x4c03('0x22')](handleError(_0x590fde));};exports[_0x4c03('0x3f')]=function(_0x3616f5,_0x287216){logger[_0x4c03('0x12')](_0x4c03('0x40'),_0x3616f5['body']);var _0x22a404=holdValidation[_0x4c03('0x3b')](_0x3616f5[_0x4c03('0x30')]);if(_0x22a404[_0x4c03('0x2b')]>0x0){return _0x287216['status'](0x190)[_0x4c03('0x31')](_0x22a404);}var _0x15d6db=_0x3616f5[_0x4c03('0x30')][_0x4c03('0x32')];var _0x90885a=_0x3616f5[_0x4c03('0x30')][_0x4c03('0x2a')];return getAgent(_0x15d6db)[_0x4c03('0x1e')](function(_0x3c8686){logger[_0x4c03('0x12')](_0x4c03('0x3c'),_0x3c8686['name']);emit(util['format'](_0x4c03('0x37'),_0x3c8686[_0x4c03('0x19')]),_0x4c03('0x41'),{'sessionId':_0x90885a});return _0x287216[_0x4c03('0x1a')](0xc8)[_0x4c03('0x31')]({'error':![],'message':'hold\x20executed!'});})[_0x4c03('0x22')](handleError(_0x287216));};exports[_0x4c03('0x42')]=function(_0x51436b,_0x347eb1){logger['info']('unhold\x20fired:',_0x51436b[_0x4c03('0x30')]);var _0x3c8910=unholdValidation[_0x4c03('0x3b')](_0x51436b[_0x4c03('0x30')]);if(_0x3c8910[_0x4c03('0x2b')]>0x0){return _0x347eb1[_0x4c03('0x1a')](0x190)[_0x4c03('0x31')](_0x3c8910);}var _0xf6c57e=_0x51436b['body'][_0x4c03('0x32')];var _0xcb0ea5=_0x51436b[_0x4c03('0x30')][_0x4c03('0x2a')];return getAgent(_0xf6c57e)['then'](function(_0x3ae27c){logger[_0x4c03('0x12')](_0x4c03('0x3c'),_0x3ae27c['name']);emit(util[_0x4c03('0x36')](_0x4c03('0x37'),_0x3ae27c[_0x4c03('0x19')]),_0x4c03('0x43'),{'sessionId':_0xcb0ea5});return _0x347eb1[_0x4c03('0x1a')](0xc8)[_0x4c03('0x31')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x347eb1));};exports[_0x4c03('0x44')]=function(_0xb4ae5b,_0x23a5c6){logger['info'](_0x4c03('0x45'),_0x23a5c6[_0x4c03('0x30')]);var _0x27a996=callsValidation[_0x4c03('0x3b')](_0xb4ae5b[_0x4c03('0x30')]);if(_0x27a996['length']>0x0){return _0x23a5c6[_0x4c03('0x1a')](0x190)[_0x4c03('0x31')](_0x27a996);}var _0x4c2cf7=_0xb4ae5b['body'][_0x4c03('0x32')];var _0x1bd923=respondWithRpcPromise('VoiceChannels');var _0xf35b39=getAgent(_0x4c2cf7);return Promise[_0x4c03('0x26')]([_0x1bd923,_0xf35b39])[_0x4c03('0x1e')](function(_0x11798b){var _0x18de2b=_0x11798b[0x0];var _0x3a7603=_0x11798b[0x1];var _0x5188fb=_['filter'](_0x18de2b['rows'],function(_0x5a8040){return _0x5a8040['UserId']==_0x3a7603['id'];});return _0x23a5c6['status'](0xc8)[_0x4c03('0x31')]({'count':_0x5188fb[_0x4c03('0x2b')],'rows':_0x5188fb});})[_0x4c03('0x22')](handleError(_0x23a5c6));};exports[_0x4c03('0x46')]=function(_0x212eef,_0x45669f){logger[_0x4c03('0x12')](_0x4c03('0x47'),_0x212eef[_0x4c03('0x30')]);var _0x1252a1=conferenceValidation[_0x4c03('0x3b')](_0x212eef['body']);if(_0x1252a1[_0x4c03('0x2b')]>0x0){return _0x45669f['status'](0x190)[_0x4c03('0x31')](_0x1252a1);}var _0x4ac665=_0x212eef[_0x4c03('0x30')][_0x4c03('0x32')];return getAgent(_0x4ac665)[_0x4c03('0x1e')](function(_0x3a95be){logger['info'](_0x4c03('0x3c'),_0x3a95be['name']);emit(util[_0x4c03('0x36')](_0x4c03('0x37'),_0x3a95be[_0x4c03('0x19')]),'webbar:conference');return _0x45669f[_0x4c03('0x1a')](0xc8)[_0x4c03('0x31')]({'error':![],'message':'conference\x20executed!'});})[_0x4c03('0x22')](handleError(_0x45669f));};exports[_0x4c03('0x48')]=function(_0x13b490,_0x4af1a6){logger[_0x4c03('0x12')](_0x4c03('0x49'),_0x13b490[_0x4c03('0x30')]);var _0x3038aa=transferValidation['validate'](_0x13b490[_0x4c03('0x30')]);if(_0x3038aa['length']>0x0){return _0x4af1a6['status'](0x190)[_0x4c03('0x31')](_0x3038aa);}var _0x1b12b4=_0x13b490['body'][_0x4c03('0x32')];var _0x28768f=_0x13b490[_0x4c03('0x30')][_0x4c03('0x2a')];var _0x400e69=_0x13b490[_0x4c03('0x30')][_0x4c03('0x4a')];return getAgent(_0x1b12b4)[_0x4c03('0x1e')](function(_0x3356b0){logger[_0x4c03('0x12')](_0x4c03('0x3c'),_0x3356b0[_0x4c03('0x19')]);emit(util[_0x4c03('0x36')]('user:%s',_0x3356b0[_0x4c03('0x19')]),_0x4c03('0x4b'),{'sessionId':_0x28768f,'transferNumber':_0x400e69});return _0x4af1a6['status'](0xc8)[_0x4c03('0x31')]({'error':![],'message':_0x4c03('0x4c')});})[_0x4c03('0x22')](handleError(_0x4af1a6));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 58b9f5a..eb38fb8 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 _0xead3=['put','update','destroy','removeAnswers','delete','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send'];(function(_0x44ce59,_0x41c568){var _0x36510d=function(_0x29de43){while(--_0x29de43){_0x44ce59['push'](_0x44ce59['shift']());}};_0x36510d(++_0x41c568);}(_0xead3,0x1c3));var _0x3ead=function(_0x25f0ea,_0xd6d029){_0x25f0ea=_0x25f0ea-0x0;var _0x275268=_0xead3[_0x25f0ea];return _0x275268;};'use strict';var multer=require(_0x3ead('0x0'));var util=require('util');var path=require(_0x3ead('0x1'));var timeout=require(_0x3ead('0x2'));var express=require(_0x3ead('0x3'));var router=express[_0x3ead('0x4')]();var auth=require(_0x3ead('0x5'));var interaction=require(_0x3ead('0x6'));var config=require(_0x3ead('0x7'));var controller=require(_0x3ead('0x8'));router[_0x3ead('0x9')]('/',auth[_0x3ead('0xa')](),controller['index']);router[_0x3ead('0x9')](_0x3ead('0xb'),auth['isAuthenticated'](),controller[_0x3ead('0xc')]);router[_0x3ead('0x9')](_0x3ead('0xd'),auth[_0x3ead('0xa')](),controller[_0x3ead('0xe')]);router[_0x3ead('0x9')](_0x3ead('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x3ead('0x9')](_0x3ead('0x10'),auth[_0x3ead('0xa')](),controller['getAnswers']);router[_0x3ead('0x9')](_0x3ead('0x11'),auth[_0x3ead('0xa')](),controller[_0x3ead('0x12')]);router[_0x3ead('0x9')](_0x3ead('0x13'),auth[_0x3ead('0xa')](),controller['getApplications']);router[_0x3ead('0x14')]('/',auth[_0x3ead('0xa')](),controller[_0x3ead('0x15')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3ead('0x16')]);router[_0x3ead('0x14')](_0x3ead('0x10'),auth[_0x3ead('0xa')](),controller[_0x3ead('0x17')]);router[_0x3ead('0x14')](_0x3ead('0x11'),auth[_0x3ead('0xa')](),controller[_0x3ead('0x18')]);router[_0x3ead('0x14')](_0x3ead('0x13'),auth[_0x3ead('0xa')](),controller[_0x3ead('0x19')]);router[_0x3ead('0x14')](_0x3ead('0x1a'),controller[_0x3ead('0x1b')]);router['post'](_0x3ead('0x1c'),auth[_0x3ead('0xa')](),controller[_0x3ead('0x1d')]);router[_0x3ead('0x1e')](_0x3ead('0xd'),auth[_0x3ead('0xa')](),controller[_0x3ead('0x1f')]);router['delete']('/:id',auth[_0x3ead('0xa')](),controller[_0x3ead('0x20')]);router['delete'](_0x3ead('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x3ead('0x10'),auth[_0x3ead('0xa')](),controller[_0x3ead('0x21')]);router[_0x3ead('0x22')](_0x3ead('0x11'),auth[_0x3ead('0xa')](),controller[_0x3ead('0x23')]);module[_0x3ead('0x24')]=router; \ No newline at end of file +var _0xc339=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x584ebc,_0x27a6d4){var _0x4e4cc5=function(_0x40b9b0){while(--_0x40b9b0){_0x584ebc['push'](_0x584ebc['shift']());}};_0x4e4cc5(++_0x27a6d4);}(_0xc339,0x141));var _0x9c33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc339[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9c33('0x0'));var util=require(_0x9c33('0x1'));var path=require('path');var timeout=require(_0x9c33('0x2'));var express=require(_0x9c33('0x3'));var router=express[_0x9c33('0x4')]();var auth=require(_0x9c33('0x5'));var interaction=require(_0x9c33('0x6'));var config=require(_0x9c33('0x7'));var controller=require('./whatsappAccount.controller');router[_0x9c33('0x8')]('/',auth[_0x9c33('0x9')](),controller[_0x9c33('0xa')]);router[_0x9c33('0x8')](_0x9c33('0xb'),auth[_0x9c33('0x9')](),controller[_0x9c33('0xc')]);router[_0x9c33('0x8')](_0x9c33('0xd'),auth['isAuthenticated'](),controller[_0x9c33('0xe')]);router[_0x9c33('0x8')](_0x9c33('0xf'),auth['isAuthenticated'](),controller[_0x9c33('0x10')]);router[_0x9c33('0x8')](_0x9c33('0x11'),auth[_0x9c33('0x9')](),controller[_0x9c33('0x12')]);router[_0x9c33('0x8')](_0x9c33('0x13'),auth[_0x9c33('0x9')](),controller[_0x9c33('0x14')]);router[_0x9c33('0x8')](_0x9c33('0x15'),auth[_0x9c33('0x9')](),controller[_0x9c33('0x16')]);router[_0x9c33('0x17')]('/',auth['isAuthenticated'](),controller[_0x9c33('0x18')]);router[_0x9c33('0x17')](_0x9c33('0xf'),auth[_0x9c33('0x9')](),controller['addDisposition']);router[_0x9c33('0x17')](_0x9c33('0x11'),auth[_0x9c33('0x9')](),controller['addAnswer']);router[_0x9c33('0x17')](_0x9c33('0x13'),auth[_0x9c33('0x9')](),controller['addAgents']);router['post'](_0x9c33('0x15'),auth[_0x9c33('0x9')](),controller[_0x9c33('0x19')]);router['post'](_0x9c33('0x1a'),controller[_0x9c33('0x1b')]);router[_0x9c33('0x17')](_0x9c33('0x1c'),auth['isAuthenticated'](),controller[_0x9c33('0x1d')]);router[_0x9c33('0x1e')](_0x9c33('0xd'),auth[_0x9c33('0x9')](),controller[_0x9c33('0x1f')]);router[_0x9c33('0x20')](_0x9c33('0xd'),auth[_0x9c33('0x9')](),controller[_0x9c33('0x21')]);router[_0x9c33('0x20')]('/:id/dispositions',auth[_0x9c33('0x9')](),controller[_0x9c33('0x22')]);router[_0x9c33('0x20')]('/:id/canned_answers',auth[_0x9c33('0x9')](),controller[_0x9c33('0x23')]);router[_0x9c33('0x20')]('/:id/users',auth[_0x9c33('0x9')](),controller['removeAgents']);module[_0x9c33('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 5365a4a..a5d45e1 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 _0xb838=['name','generate','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0xb838,0x165));var _0x8b83=function(_0x2a91ba,_0x25af3e){_0x2a91ba=_0x2a91ba-0x0;var _0x8be938=_0xb838[_0x2a91ba];return _0x8be938;};'use strict';var Sequelize=require(_0x8b83('0x0'));var rs=require(_0x8b83('0x1'));module['exports']={'name':{'type':Sequelize[_0x8b83('0x2')],'unique':_0x8b83('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x8b83('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x8b83('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x8b83('0x2')],'defaultValue':function(){return rs[_0x8b83('0x4')]();}},'phone':{'type':Sequelize[_0x8b83('0x2')]},'type':{'type':Sequelize['ENUM'](_0x8b83('0x5'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x8b83('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8b83('0x6')],'defaultValue':function(){return _0x8b83('0x7');}},'notificationSound':{'type':Sequelize[_0x8b83('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x8b83('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8b83('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8b83('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8b83('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8b83('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8b83('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8b83('0x9')],'comment':_0x8b83('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x8b83('0x8')],'defaultValue':![],'comment':_0x8b83('0xb'),'set':function(_0x34462b){if(!_0x34462b){this[_0x8b83('0xc')](_0x8b83('0xd'),null);}this[_0x8b83('0xc')](_0x8b83('0xe'),_0x34462b);}},'description':{'type':Sequelize[_0x8b83('0x2')]}}; \ No newline at end of file +var _0xbbc6=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','name','generate','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x34a81b,_0x1829bd){var _0x28ce4b=function(_0x228f18){while(--_0x228f18){_0x34a81b['push'](_0x34a81b['shift']());}};_0x28ce4b(++_0x1829bd);}(_0xbbc6,0x19e));var _0x6bbc=function(_0x12727b,_0x46b50c){_0x12727b=_0x12727b-0x0;var _0x2f1b37=_0xbbc6[_0x12727b];return _0x2f1b37;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6bbc('0x0'));module['exports']={'name':{'type':Sequelize[_0x6bbc('0x1')],'unique':_0x6bbc('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x6bbc('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x6bbc('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6bbc('0x3')]();}},'phone':{'type':Sequelize[_0x6bbc('0x1')]},'type':{'type':Sequelize['ENUM'](_0x6bbc('0x4'))},'accountSid':{'type':Sequelize[_0x6bbc('0x1')]},'authToken':{'type':Sequelize[_0x6bbc('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6bbc('0x5');}},'notificationSound':{'type':Sequelize[_0x6bbc('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6bbc('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6bbc('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6bbc('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6bbc('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6bbc('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6bbc('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x6bbc('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6bbc('0x6')],'defaultValue':![],'comment':_0x6bbc('0x9'),'set':function(_0xcac5d1){if(!_0xcac5d1){this['setDataValue'](_0x6bbc('0xa'),null);}this['setDataValue'](_0x6bbc('0xb'),_0xcac5d1);}},'description':{'type':Sequelize[_0x6bbc('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 2cb876f..d00ff61 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 _0x593e=['created','ContactId','AttachmentId','UserId','unshift','agent','Start','startRouting','entity\x20found','stringify','text/xml','send','\x0a','to\x20is\x20mandatory','DESC','List','ListId','WhatsappMessage','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','status','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','name','Pause','mandatoryDispositionPause','map','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','WhatsappAccount','includeAll','rows','catch','show','params','keys','include','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','find','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','order','pick','findAll','removeDispositions','addAnswer','CannedAnswer','ids','omit','spread','removeAgents','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','getApplications','notify','Applications','account','applications','orderBy','priority','asc','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','whatsapp:','Body','messageId','MessageSid','isNil','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','CmList','Contacts','list','CmContact','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*'];(function(_0x5ad2a0,_0x354b95){var _0x11901a=function(_0x2bebb8){while(--_0x2bebb8){_0x5ad2a0['push'](_0x5ad2a0['shift']());}};_0x11901a(++_0x354b95);}(_0x593e,0xcb));var _0xe593=function(_0xf1022d,_0x206671){_0xf1022d=_0xf1022d-0x0;var _0x21857e=_0x593e[_0xf1022d];return _0x21857e;};'use strict';var pdf=require(_0xe593('0x0'));var emlformat=require(_0xe593('0x1'));var rimraf=require(_0xe593('0x2'));var zipdir=require(_0xe593('0x3'));var jsonpatch=require(_0xe593('0x4'));var rp=require(_0xe593('0x5'));var moment=require(_0xe593('0x6'));var BPromise=require(_0xe593('0x7'));var Mustache=require('mustache');var util=require(_0xe593('0x8'));var path=require(_0xe593('0x9'));var sox=require(_0xe593('0xa'));var csv=require(_0xe593('0xb'));var ejs=require(_0xe593('0xc'));var fs=require('fs');var _=require(_0xe593('0xd'));var squel=require(_0xe593('0xe'));var crypto=require(_0xe593('0xf'));var jsforce=require(_0xe593('0x10'));var deskjs=require(_0xe593('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe593('0x12'));var Papa=require(_0xe593('0x13'));var Redis=require(_0xe593('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe593('0x15'));var hardwareService=require(_0xe593('0x16'));var logger=require(_0xe593('0x17'))('api');var utils=require(_0xe593('0x18'));var config=require(_0xe593('0x19'));var db=require(_0xe593('0x1a'))['db'];config[_0xe593('0x1b')]=_[_0xe593('0x1c')](config[_0xe593('0x1b')],{'host':_0xe593('0x1d'),'port':0x18eb});var socket=require(_0xe593('0x1e'))(new Redis(config[_0xe593('0x1b')]));require(_0xe593('0x1f'))['register'](socket);var jayson=require(_0xe593('0x20'));var client=jayson[_0xe593('0x21')]['http']({'port':0x232c});function checkPasswordPattern(_0x38418c,_0x44837b,_0x5d4c6a){if(_0x5d4c6a){var _0x2ae9b6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ae9b6[_0xe593('0x22')](_0x44837b)){return _0x38418c;}else{throw new db[(_0xe593('0x23'))][(_0xe593('0x24'))](_0xe593('0x25'));}}else{return _0x38418c;}}function respondWithRpcPromise(_0xb427f0,_0x48f3b4,_0xfbc79f,_0x470d07){return new BPromise(function(_0x5f57ce,_0xd1020e){var _0x28b5ed=_0x470d07||client;return _0x28b5ed['request'](_0xb427f0,_0xfbc79f)[_0xe593('0x26')](function(_0x3dba1b){logger[_0xe593('0x27')](_0xe593('0x28'),_0x48f3b4,_0xe593('0x29'));logger[_0xe593('0x2a')](_0xe593('0x2b'),_0x48f3b4,'request\x20sent',JSON['stringify'](_0x3dba1b));if(_0x3dba1b[_0xe593('0x2c')]){if(_0x3dba1b['error']['code']===0x1f4){logger[_0xe593('0x2c')](_0xe593('0x28'),_0x48f3b4,_0x3dba1b['error'][_0xe593('0x2d')]);return _0xd1020e(_0x3dba1b['error'][_0xe593('0x2d')]);}logger[_0xe593('0x2c')](_0xe593('0x28'),_0x48f3b4,_0x3dba1b[_0xe593('0x2c')][_0xe593('0x2d')]);return _0x5f57ce(_0x3dba1b[_0xe593('0x2c')][_0xe593('0x2d')]);}else{logger[_0xe593('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x48f3b4,_0xe593('0x29'));_0x5f57ce(_0x3dba1b[_0xe593('0x2e')]['message']);}})['catch'](function(_0xf8d492){logger[_0xe593('0x2c')](_0xe593('0x28'),_0x48f3b4,_0xf8d492);_0xd1020e(_0xf8d492);});});}function respondWithStatusCode(_0x43699d,_0x3b66bc){_0x3b66bc=_0x3b66bc||0xcc;return function(_0x27a3d2){if(_0x27a3d2){return _0x43699d['sendStatus'](_0x3b66bc);}return _0x43699d[_0xe593('0x2f')](_0x3b66bc)['end']();};}function respondWithResult(_0x1dacf6,_0xda61a7){_0xda61a7=_0xda61a7||0xc8;return function(_0x4a2eaa){if(_0x4a2eaa){return _0x1dacf6[_0xe593('0x2f')](_0xda61a7)['json'](_0x4a2eaa);}};}function respondWithFilteredResult(_0x44a68c,_0x1c147b){return function(_0x1618af){if(_0x1618af){var _0x501e54=_0x1618af[_0xe593('0x30')],_0x1ae8d9=_0x1c147b[_0xe593('0x31')],_0x13f44=_0x1c147b[_0xe593('0x31')]+_0x1c147b[_0xe593('0x32')],_0x3066ed;if(_0x13f44>=_0x501e54){_0x13f44=_0x501e54;_0x3066ed=0xc8;}else{_0x3066ed=0xce;}_0x44a68c['status'](_0x3066ed);return _0x44a68c[_0xe593('0x33')](_0xe593('0x34'),_0x1ae8d9+'-'+_0x13f44+'/'+_0x501e54)['json'](_0x1618af);}return null;};}function patchUpdates(_0xe5e728){return function(_0x571995){try{jsonpatch[_0xe593('0x35')](_0x571995,_0xe5e728,!![]);}catch(_0x32fd89){return BPromise[_0xe593('0x36')](_0x32fd89);}return _0x571995[_0xe593('0x37')]();};}function saveUpdates(_0x38d9f4,_0x24a560){return function(_0x40e1d3){if(_0x40e1d3){return _0x40e1d3[_0xe593('0x38')](_0x38d9f4)[_0xe593('0x26')](function(_0x4305de){return _0x4305de;});}return null;};}function removeEntity(_0x4d3fab,_0x27a563){return function(_0x2c0a30){if(_0x2c0a30){return _0x2c0a30[_0xe593('0x39')]()['then'](function(){var _0x4fefb3=_0x2c0a30[_0xe593('0x3a')]({'plain':!![]});var _0x5813bf=_0xe593('0x3b');return db[_0xe593('0x3c')][_0xe593('0x39')]({'where':{'type':_0x5813bf,'resourceId':_0x4fefb3['id']}})[_0xe593('0x26')](function(){return _0x2c0a30;});})[_0xe593('0x26')](function(){_0x4d3fab[_0xe593('0x2f')](0xcc)[_0xe593('0x3d')]();});}};}function handleEntityNotFound(_0x4889cc,_0x5112c1){return function(_0x8c6ea5){if(!_0x8c6ea5){_0x4889cc['sendStatus'](0x194);}return _0x8c6ea5;};}function handleError(_0x32bc16,_0x4877ad){_0x4877ad=_0x4877ad||0x1f4;return function(_0x206775){logger['error'](_0x206775['stack']);if(_0x206775[_0xe593('0x3e')]){delete _0x206775[_0xe593('0x3e')];}_0x32bc16[_0xe593('0x2f')](_0x4877ad)['send'](_0x206775);};}exports['index']=function(_0x5f11b9,_0x359285){var _0x584945={'include':[{'model':db[_0xe593('0x3f')],'as':_0xe593('0x40')}]},_0x37ba0e={},_0x3945af={'count':0x0,'rows':[]};var _0x50249e=_[_0xe593('0x41')](db['WhatsappAccount'][_0xe593('0x42')],function(_0x508a12){return{'name':_0x508a12['fieldName'],'type':_0x508a12['type'][_0xe593('0x43')]};});_0x37ba0e['model']=_[_0xe593('0x41')](_0x50249e,_0xe593('0x3e'));_0x37ba0e[_0xe593('0x44')]=_['keys'](_0x5f11b9[_0xe593('0x44')]);_0x37ba0e[_0xe593('0x45')]=_[_0xe593('0x46')](_0x37ba0e[_0xe593('0x47')],_0x37ba0e[_0xe593('0x44')]);_0x584945[_0xe593('0x48')]=_[_0xe593('0x46')](_0x37ba0e[_0xe593('0x47')],qs['fields'](_0x5f11b9[_0xe593('0x44')][_0xe593('0x49')]));_0x584945[_0xe593('0x48')]=_0x584945[_0xe593('0x48')][_0xe593('0x4a')]?_0x584945['attributes']:_0x37ba0e['model'];if(!_0x5f11b9[_0xe593('0x44')][_0xe593('0x4b')](_0xe593('0x4c'))){_0x584945['limit']=qs[_0xe593('0x32')](_0x5f11b9[_0xe593('0x44')]['limit']);_0x584945['offset']=qs[_0xe593('0x31')](_0x5f11b9[_0xe593('0x44')][_0xe593('0x31')]);}_0x584945['order']=qs[_0xe593('0x4d')](_0x5f11b9[_0xe593('0x44')][_0xe593('0x4d')]);_0x584945[_0xe593('0x4e')]=qs['filters'](_['pick'](_0x5f11b9['query'],_0x37ba0e['filters']),_0x50249e);if(_0x5f11b9[_0xe593('0x44')]['filter']){_0x584945[_0xe593('0x4e')]=_[_0xe593('0x4f')](_0x584945[_0xe593('0x4e')],{'$or':_[_0xe593('0x41')](_0x50249e,function(_0xe96f5e){if(_0xe96f5e[_0xe593('0x50')]!==_0xe593('0x51')){var _0x297c3e={};_0x297c3e[_0xe96f5e['name']]={'$like':'%'+_0x5f11b9[_0xe593('0x44')][_0xe593('0x52')]+'%'};return _0x297c3e;}})});}_0x584945=_[_0xe593('0x4f')]({},_0x584945,_0x5f11b9['options']);var _0x2d0113={'where':_0x584945['where']};return db[_0xe593('0x53')][_0xe593('0x30')](_0x2d0113)[_0xe593('0x26')](function(_0x55da3d){_0x3945af['count']=_0x55da3d;if(_0x5f11b9[_0xe593('0x44')][_0xe593('0x54')]){_0x584945['include']=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x584945);})['then'](function(_0x5a7385){_0x3945af[_0xe593('0x55')]=_0x5a7385;return _0x3945af;})[_0xe593('0x26')](respondWithFilteredResult(_0x359285,_0x584945))[_0xe593('0x56')](handleError(_0x359285,null));};exports[_0xe593('0x57')]=function(_0x42ec06,_0x44201e){var _0x973821={'raw':![],'where':{'id':_0x42ec06[_0xe593('0x58')]['id']},'include':[{'model':db[_0xe593('0x3f')],'as':_0xe593('0x40')}]},_0x46410d={};_0x46410d[_0xe593('0x47')]=_[_0xe593('0x59')](db[_0xe593('0x53')][_0xe593('0x42')]);_0x46410d[_0xe593('0x44')]=_['keys'](_0x42ec06[_0xe593('0x44')]);_0x46410d[_0xe593('0x45')]=_[_0xe593('0x46')](_0x46410d[_0xe593('0x47')],_0x46410d[_0xe593('0x44')]);_0x973821[_0xe593('0x48')]=_[_0xe593('0x46')](_0x46410d[_0xe593('0x47')],qs[_0xe593('0x49')](_0x42ec06[_0xe593('0x44')][_0xe593('0x49')]));_0x973821[_0xe593('0x48')]=_0x973821[_0xe593('0x48')][_0xe593('0x4a')]?_0x973821[_0xe593('0x48')]:_0x46410d['model'];if(_0x42ec06[_0xe593('0x44')][_0xe593('0x54')]){_0x973821[_0xe593('0x5a')]=[{'all':!![]}];}_0x973821=_[_0xe593('0x4f')]({},_0x973821,_0x42ec06[_0xe593('0x5b')]);return db['WhatsappAccount']['find'](_0x973821)[_0xe593('0x26')](handleEntityNotFound(_0x44201e,null))[_0xe593('0x26')](respondWithResult(_0x44201e,null))[_0xe593('0x56')](handleError(_0x44201e,null));};exports[_0xe593('0x5c')]=function(_0x1b5643,_0x1e49ed){return db[_0xe593('0x53')]['create'](_0x1b5643['body'],{})[_0xe593('0x26')](function(_0x23ee3b){var _0x4ff51d=_0x1b5643[_0xe593('0x5d')][_0xe593('0x3a')]({'plain':!![]});if(!_0x4ff51d)throw new Error(_0xe593('0x5e'));if(_0x4ff51d[_0xe593('0x5f')]===_0xe593('0x5d')){var _0x2a38fc=_0x23ee3b[_0xe593('0x3a')]({'plain':!![]});var _0x3b8b19=_0xe593('0x3b');return db[_0xe593('0x60')]['find']({'where':{'name':_0x3b8b19,'userProfileId':_0x4ff51d[_0xe593('0x61')]},'raw':!![]})[_0xe593('0x26')](function(_0x390b95){if(_0x390b95&&_0x390b95[_0xe593('0x62')]===0x0){return db[_0xe593('0x3c')][_0xe593('0x5c')]({'name':_0x2a38fc[_0xe593('0x3e')],'resourceId':_0x2a38fc['id'],'type':_0x390b95['name'],'sectionId':_0x390b95['id']},{})[_0xe593('0x26')](function(){return _0x23ee3b;});}else{return _0x23ee3b;}})[_0xe593('0x56')](function(_0x434ce2){logger[_0xe593('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x434ce2);throw _0x434ce2;});}return _0x23ee3b;})[_0xe593('0x26')](respondWithResult(_0x1e49ed,0xc9))[_0xe593('0x56')](handleError(_0x1e49ed,null));};exports[_0xe593('0x38')]=function(_0x34c669,_0x377137){if(_0x34c669['body']['id']){delete _0x34c669[_0xe593('0x63')]['id'];}return db[_0xe593('0x53')][_0xe593('0x64')]({'where':{'id':_0x34c669[_0xe593('0x58')]['id']},'include':[{'model':db[_0xe593('0x3f')],'as':_0xe593('0x40')}]})[_0xe593('0x26')](handleEntityNotFound(_0x377137,null))[_0xe593('0x26')](saveUpdates(_0x34c669['body'],null))[_0xe593('0x26')](respondWithResult(_0x377137,null))[_0xe593('0x56')](handleError(_0x377137,null));};exports[_0xe593('0x39')]=function(_0x100acd,_0x42edd2){return db[_0xe593('0x53')][_0xe593('0x64')]({'where':{'id':_0x100acd[_0xe593('0x58')]['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x42edd2,null))[_0xe593('0x26')](removeEntity(_0x42edd2,null))['catch'](handleError(_0x42edd2,null));};exports[_0xe593('0x65')]=function(_0x42714a,_0x339a5e){return db['WhatsappAccount'][_0xe593('0x65')]()[_0xe593('0x26')](respondWithResult(_0x339a5e,null))[_0xe593('0x56')](handleError(_0x339a5e,null));};exports[_0xe593('0x66')]=function(_0x27c931,_0x5e263c,_0x17a1bc){if(_0x27c931[_0xe593('0x63')]['id']){delete _0x27c931['body']['id'];}return db[_0xe593('0x53')][_0xe593('0x64')]({'where':{'id':_0x27c931[_0xe593('0x58')]['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x5e263c,null))['then'](function(_0x15f47c){if(_0x15f47c){_0x27c931[_0xe593('0x63')][_0xe593('0x67')]=_0x15f47c['id'];return db['Disposition'][_0xe593('0x5c')](_0x27c931[_0xe593('0x63')]);}})[_0xe593('0x26')](respondWithResult(_0x5e263c,null))['catch'](handleError(_0x5e263c,null));};exports[_0xe593('0x68')]=function(_0x11eae2,_0x346b0f,_0x52766f){var _0xe89d7e={'raw':![],'where':{}};var _0x4d9dba={};var _0x2f81d2={'count':0x0,'rows':[]};return db[_0xe593('0x53')][_0xe593('0x69')]({'where':{'id':_0x11eae2[_0xe593('0x58')]['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x346b0f,null))[_0xe593('0x26')](function(_0x285df9){if(_0x285df9){_0x4d9dba[_0xe593('0x47')]=_[_0xe593('0x59')](db[_0xe593('0x6a')][_0xe593('0x42')]);_0x4d9dba[_0xe593('0x44')]=_[_0xe593('0x59')](_0x11eae2[_0xe593('0x44')]);_0x4d9dba['filters']=_[_0xe593('0x46')](_0x4d9dba[_0xe593('0x47')],_0x4d9dba[_0xe593('0x44')]);_0xe89d7e[_0xe593('0x48')]=_[_0xe593('0x46')](_0x4d9dba[_0xe593('0x47')],qs[_0xe593('0x49')](_0x11eae2[_0xe593('0x44')]['fields']));_0xe89d7e['attributes']=_0xe89d7e['attributes'][_0xe593('0x4a')]?_0xe89d7e[_0xe593('0x48')]:_0x4d9dba[_0xe593('0x47')];if(!_0x11eae2['query']['hasOwnProperty'](_0xe593('0x4c'))){_0xe89d7e['limit']=qs[_0xe593('0x32')](_0x11eae2[_0xe593('0x44')][_0xe593('0x32')]);_0xe89d7e['offset']=qs[_0xe593('0x31')](_0x11eae2[_0xe593('0x44')][_0xe593('0x31')]);}_0xe89d7e[_0xe593('0x6b')]=qs[_0xe593('0x4d')](_0x11eae2[_0xe593('0x44')][_0xe593('0x4d')]);_0xe89d7e['where']=qs[_0xe593('0x45')](_[_0xe593('0x6c')](_0x11eae2['query'],_0x4d9dba[_0xe593('0x45')]));_0xe89d7e[_0xe593('0x4e')][_0xe593('0x67')]=_0x285df9['id'];if(_0x11eae2['query'][_0xe593('0x52')]){_0xe89d7e[_0xe593('0x4e')]=_[_0xe593('0x4f')](_0xe89d7e[_0xe593('0x4e')],{'$or':_[_0xe593('0x41')](_0xe89d7e[_0xe593('0x48')],function(_0x4c16d0){var _0x56fd23={};_0x56fd23[_0x4c16d0]={'$like':'%'+_0x11eae2[_0xe593('0x44')]['filter']+'%'};return _0x56fd23;})});}_0xe89d7e=_['merge']({},_0xe89d7e,_0x11eae2['options']);return db[_0xe593('0x6a')][_0xe593('0x30')]({'where':_0xe89d7e[_0xe593('0x4e')]})[_0xe593('0x26')](function(_0xa07dbb){_0x2f81d2['count']=_0xa07dbb;if(_0x11eae2['query'][_0xe593('0x54')]){_0xe89d7e[_0xe593('0x5a')]=[{'all':!![]}];}return db[_0xe593('0x6a')][_0xe593('0x6d')](_0xe89d7e);})['then'](function(_0x20574a){_0x2f81d2[_0xe593('0x55')]=_0x20574a;return _0x2f81d2;});}})[_0xe593('0x26')](respondWithFilteredResult(_0x346b0f,_0xe89d7e))['catch'](handleError(_0x346b0f,null));};exports[_0xe593('0x6e')]=function(_0x454479,_0x4dd704,_0xc0904c){return db[_0xe593('0x53')]['find']({'where':{'id':_0x454479['params']['id']}})['then'](handleEntityNotFound(_0x4dd704,null))['then'](function(_0x552869){if(_0x552869){return _0x552869['removeDispositions'](_0x454479[_0xe593('0x44')]['ids']);}})[_0xe593('0x26')](respondWithStatusCode(_0x4dd704,null))[_0xe593('0x56')](handleError(_0x4dd704,null));};exports[_0xe593('0x6f')]=function(_0x57683e,_0x47ac27,_0x2efa5a){if(_0x57683e[_0xe593('0x63')]['id']){delete _0x57683e[_0xe593('0x63')]['id'];}return db[_0xe593('0x53')]['find']({'where':{'id':_0x57683e['params']['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x47ac27,null))[_0xe593('0x26')](function(_0x5127da){if(_0x5127da){_0x57683e[_0xe593('0x63')][_0xe593('0x67')]=_0x5127da['id'];return db[_0xe593('0x70')][_0xe593('0x5c')](_0x57683e[_0xe593('0x63')]);}})['then'](respondWithResult(_0x47ac27,null))[_0xe593('0x56')](handleError(_0x47ac27,null));};exports['getAnswers']=function(_0x27bf6c,_0x5d4e7f,_0x36762a){var _0x509e82={'raw':![],'where':{}};var _0x50ab4d={};var _0x265fee={'count':0x0,'rows':[]};return db[_0xe593('0x53')][_0xe593('0x69')]({'where':{'id':_0x27bf6c['params']['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x5d4e7f,null))[_0xe593('0x26')](function(_0x1462f8){if(_0x1462f8){_0x50ab4d['model']=_[_0xe593('0x59')](db['CannedAnswer'][_0xe593('0x42')]);_0x50ab4d[_0xe593('0x44')]=_['keys'](_0x27bf6c[_0xe593('0x44')]);_0x50ab4d[_0xe593('0x45')]=_[_0xe593('0x46')](_0x50ab4d['model'],_0x50ab4d['query']);_0x509e82[_0xe593('0x48')]=_['intersection'](_0x50ab4d[_0xe593('0x47')],qs[_0xe593('0x49')](_0x27bf6c['query']['fields']));_0x509e82[_0xe593('0x48')]=_0x509e82[_0xe593('0x48')][_0xe593('0x4a')]?_0x509e82['attributes']:_0x50ab4d[_0xe593('0x47')];if(!_0x27bf6c[_0xe593('0x44')][_0xe593('0x4b')](_0xe593('0x4c'))){_0x509e82[_0xe593('0x32')]=qs[_0xe593('0x32')](_0x27bf6c['query'][_0xe593('0x32')]);_0x509e82[_0xe593('0x31')]=qs[_0xe593('0x31')](_0x27bf6c[_0xe593('0x44')][_0xe593('0x31')]);}_0x509e82[_0xe593('0x6b')]=qs[_0xe593('0x4d')](_0x27bf6c['query'][_0xe593('0x4d')]);_0x509e82[_0xe593('0x4e')]=qs[_0xe593('0x45')](_['pick'](_0x27bf6c['query'],_0x50ab4d['filters']));_0x509e82[_0xe593('0x4e')][_0xe593('0x67')]=_0x1462f8['id'];if(_0x27bf6c['query'][_0xe593('0x52')]){_0x509e82[_0xe593('0x4e')]=_['merge'](_0x509e82[_0xe593('0x4e')],{'$or':_['map'](_0x509e82['attributes'],function(_0x28470c){var _0x427472={};_0x427472[_0x28470c]={'$like':'%'+_0x27bf6c[_0xe593('0x44')][_0xe593('0x52')]+'%'};return _0x427472;})});}_0x509e82=_[_0xe593('0x4f')]({},_0x509e82,_0x27bf6c['options']);return db[_0xe593('0x70')][_0xe593('0x30')]({'where':_0x509e82['where']})[_0xe593('0x26')](function(_0x477b5b){_0x265fee[_0xe593('0x30')]=_0x477b5b;if(_0x27bf6c[_0xe593('0x44')][_0xe593('0x54')]){_0x509e82[_0xe593('0x5a')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe593('0x6d')](_0x509e82);})[_0xe593('0x26')](function(_0x10d10a){_0x265fee[_0xe593('0x55')]=_0x10d10a;return _0x265fee;});}})[_0xe593('0x26')](respondWithFilteredResult(_0x5d4e7f,_0x509e82))[_0xe593('0x56')](handleError(_0x5d4e7f,null));};exports['removeAnswers']=function(_0xed392c,_0x28963c,_0x4b31c8){return db[_0xe593('0x53')][_0xe593('0x64')]({'where':{'id':_0xed392c['params']['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x28963c,null))['then'](function(_0x496e63){if(_0x496e63){return _0x496e63['removeAnswers'](_0xed392c[_0xe593('0x44')]['ids']);}})[_0xe593('0x26')](respondWithStatusCode(_0x28963c,null))[_0xe593('0x56')](handleError(_0x28963c,null));};exports['addAgents']=function(_0x3e7bd4,_0x19fd51,_0x3a2a3a){return db[_0xe593('0x53')]['find']({'where':{'id':_0x3e7bd4['params']['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x19fd51,null))['then'](function(_0x4675f8){if(_0x4675f8){return _0x4675f8['addAgents'](_0x3e7bd4[_0xe593('0x63')][_0xe593('0x71')],_[_0xe593('0x72')](_0x3e7bd4[_0xe593('0x63')],[_0xe593('0x71'),'id'])||{})[_0xe593('0x73')](function(_0x53f8fa){for(var _0xb029b1=0x0;_0xb029b1<_0x3e7bd4[_0xe593('0x63')]['ids'][_0xe593('0x4a')];_0xb029b1+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x3e7bd4[_0xe593('0x63')][_0xe593('0x71')][_0xb029b1],'WhatsappAccountId':_0x3e7bd4[_0xe593('0x58')]['id']});}return _0x53f8fa;});}})[_0xe593('0x26')](respondWithResult(_0x19fd51,null))[_0xe593('0x56')](handleError(_0x19fd51,null));};exports[_0xe593('0x74')]=function(_0x23e40c,_0x14727f,_0x283ae8){return db[_0xe593('0x53')][_0xe593('0x64')]({'where':{'id':_0x23e40c['params']['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x14727f,null))['then'](function(_0x55df1f){if(_0x55df1f){return _0x55df1f[_0xe593('0x74')](_0x23e40c[_0xe593('0x44')][_0xe593('0x71')])['then'](function(){if(_['isArray'](_0x23e40c[_0xe593('0x44')][_0xe593('0x71')])){for(var _0xe0a60a=0x0;_0xe0a60a<_0x23e40c[_0xe593('0x44')]['ids'][_0xe593('0x4a')];_0xe0a60a+=0x1){socket[_0xe593('0x75')](_0xe593('0x76'),{'UserId':Number(_0x23e40c[_0xe593('0x44')][_0xe593('0x71')][_0xe0a60a]),'WhatsappAccountId':Number(_0x23e40c[_0xe593('0x58')]['id'])});}}else{socket[_0xe593('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x23e40c[_0xe593('0x44')][_0xe593('0x71')]),'WhatsappAccountId':Number(_0x23e40c[_0xe593('0x58')]['id'])});}});}})[_0xe593('0x26')](respondWithStatusCode(_0x14727f,null))[_0xe593('0x56')](handleError(_0x14727f,null));};exports[_0xe593('0x77')]=function(_0x38d755,_0x132a51,_0x140e7e){var _0x2a55ea={};var _0x38b776={};var _0x5b74d2;var _0x4a933d;return db[_0xe593('0x53')][_0xe593('0x69')]({'where':{'id':_0x38d755[_0xe593('0x58')]['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x132a51,null))[_0xe593('0x26')](function(_0xce5ca6){if(_0xce5ca6){_0x5b74d2=_0xce5ca6;_0x38b776['model']=_['keys'](db[_0xe593('0x78')][_0xe593('0x42')]);_0x38b776[_0xe593('0x44')]=_[_0xe593('0x59')](_0x38d755['query']);_0x38b776['filters']=_[_0xe593('0x46')](_0x38b776[_0xe593('0x47')],_0x38b776[_0xe593('0x44')]);_0x2a55ea[_0xe593('0x48')]=_['intersection'](_0x38b776[_0xe593('0x47')],qs[_0xe593('0x49')](_0x38d755[_0xe593('0x44')][_0xe593('0x49')]));_0x2a55ea[_0xe593('0x48')]=_0x2a55ea['attributes'][_0xe593('0x4a')]?_0x2a55ea[_0xe593('0x48')]:_0x38b776['model'];_0x2a55ea[_0xe593('0x6b')]=qs[_0xe593('0x4d')](_0x38d755['query'][_0xe593('0x4d')]);_0x2a55ea[_0xe593('0x4e')]=qs['filters'](_[_0xe593('0x6c')](_0x38d755[_0xe593('0x44')],_0x38b776['filters']));if(_0x38d755[_0xe593('0x44')][_0xe593('0x52')]){_0x2a55ea[_0xe593('0x4e')]=_[_0xe593('0x4f')](_0x2a55ea[_0xe593('0x4e')],{'$or':_[_0xe593('0x41')](_0x2a55ea['attributes'],function(_0x1e499e){var _0x254927={};_0x254927[_0x1e499e]={'$like':'%'+_0x38d755[_0xe593('0x44')][_0xe593('0x52')]+'%'};return _0x254927;})});}_0x2a55ea=_[_0xe593('0x4f')]({},_0x2a55ea,_0x38d755[_0xe593('0x5b')]);return _0x5b74d2[_0xe593('0x77')](_0x2a55ea);}})[_0xe593('0x26')](function(_0x53aab1){if(_0x53aab1){_0x4a933d=_0x53aab1['length'];if(!_0x38d755['query'][_0xe593('0x4b')]('nolimit')){_0x2a55ea[_0xe593('0x32')]=qs[_0xe593('0x32')](_0x38d755[_0xe593('0x44')][_0xe593('0x32')]);_0x2a55ea[_0xe593('0x31')]=qs[_0xe593('0x31')](_0x38d755[_0xe593('0x44')][_0xe593('0x31')]);}return _0x5b74d2[_0xe593('0x77')](_0x2a55ea);}})[_0xe593('0x26')](function(_0x2a11d0){if(_0x2a11d0){return _0x2a11d0?{'count':_0x4a933d,'rows':_0x2a11d0}:null;}})[_0xe593('0x26')](respondWithResult(_0x132a51,null))['catch'](handleError(_0x132a51,null));};exports[_0xe593('0x79')]=function(_0x539d6e,_0xb14ef0,_0x148e1e){return db[_0xe593('0x53')]['findOne']({'where':{'id':_0x539d6e[_0xe593('0x58')]['id']}})[_0xe593('0x26')](handleEntityNotFound(_0xb14ef0,null))[_0xe593('0x26')](function(_0x324c26){if(_0x324c26){return db[_0xe593('0x7a')][_0xe593('0x7b')](function(_0x2ca3d6){return db['WhatsappApplication'][_0xe593('0x39')]({'where':{'WhatsappAccountId':_0x539d6e[_0xe593('0x58')]['id']},'transaction':_0x2ca3d6})[_0xe593('0x26')](function(_0x240e1b){var _0x465f83=_[_0xe593('0x41')](_0x539d6e['body'],function(_0xbb34ba){_0xbb34ba[_0xe593('0x67')]=_0x539d6e[_0xe593('0x58')]['id'];return _0xbb34ba;});return db[_0xe593('0x7c')]['bulkCreate'](_0x465f83,{'transaction':_0x2ca3d6});});})[_0xe593('0x26')](function(){return db['WhatsappApplication'][_0xe593('0x7d')]({'where':{'WhatsappAccountId':_0x539d6e['params']['id']},'order':'priority'});});}})[_0xe593('0x26')](respondWithResult(_0xb14ef0,null))[_0xe593('0x56')](handleError(_0xb14ef0,null));};exports[_0xe593('0x7e')]=function(_0x62cd5f,_0x35b210,_0x5e4170){var _0x450e13={};var _0x1a01c5={};var _0x273404;var _0x34b888;return db['WhatsappAccount'][_0xe593('0x69')]({'where':{'id':_0x62cd5f[_0xe593('0x58')]['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x35b210,null))['then'](function(_0x1f5be5){if(_0x1f5be5){_0x273404=_0x1f5be5;_0x1a01c5['model']=_[_0xe593('0x59')](db['WhatsappApplication'][_0xe593('0x42')]);_0x1a01c5[_0xe593('0x44')]=_[_0xe593('0x59')](_0x62cd5f[_0xe593('0x44')]);_0x1a01c5[_0xe593('0x45')]=_[_0xe593('0x46')](_0x1a01c5[_0xe593('0x47')],_0x1a01c5[_0xe593('0x44')]);_0x450e13[_0xe593('0x48')]=_[_0xe593('0x46')](_0x1a01c5[_0xe593('0x47')],qs[_0xe593('0x49')](_0x62cd5f[_0xe593('0x44')][_0xe593('0x49')]));_0x450e13[_0xe593('0x48')]=_0x450e13[_0xe593('0x48')][_0xe593('0x4a')]?_0x450e13['attributes']:_0x1a01c5[_0xe593('0x47')];_0x450e13[_0xe593('0x6b')]=qs[_0xe593('0x4d')](_0x62cd5f[_0xe593('0x44')][_0xe593('0x4d')]);_0x450e13[_0xe593('0x4e')]=qs['filters'](_[_0xe593('0x6c')](_0x62cd5f['query'],_0x1a01c5[_0xe593('0x45')]));if(_0x62cd5f['query']['filter']){_0x450e13[_0xe593('0x4e')]=_[_0xe593('0x4f')](_0x450e13[_0xe593('0x4e')],{'$or':_[_0xe593('0x41')](_0x450e13[_0xe593('0x48')],function(_0x5555e9){var _0x18b2a6={};_0x18b2a6[_0x5555e9]={'$like':'%'+_0x62cd5f[_0xe593('0x44')][_0xe593('0x52')]+'%'};return _0x18b2a6;})});}_0x450e13=_['merge']({},_0x450e13,_0x62cd5f[_0xe593('0x5b')]);return _0x273404[_0xe593('0x7e')](_0x450e13);}})[_0xe593('0x26')](function(_0x419e9a){if(_0x419e9a){_0x34b888=_0x419e9a[_0xe593('0x4a')];if(!_0x62cd5f[_0xe593('0x44')][_0xe593('0x4b')](_0xe593('0x4c'))){_0x450e13[_0xe593('0x32')]=qs[_0xe593('0x32')](_0x62cd5f['query'][_0xe593('0x32')]);_0x450e13[_0xe593('0x31')]=qs[_0xe593('0x31')](_0x62cd5f[_0xe593('0x44')][_0xe593('0x31')]);}return _0x273404[_0xe593('0x7e')](_0x450e13);}})[_0xe593('0x26')](function(_0x2cb744){if(_0x2cb744){return _0x2cb744?{'count':_0x34b888,'rows':_0x2cb744}:null;}})['then'](respondWithResult(_0x35b210,null))[_0xe593('0x56')](handleError(_0x35b210,null));};exports[_0xe593('0x7f')]=function(_0x381cc3,_0x46bef8,_0x1a064a){var _0x269d70={'channel':'whatsapp'};var _0x83f8ff=[];var _0x8ac78c=[];var _0x352ad3={};return db[_0xe593('0x53')]['find']({'where':{'id':_0x381cc3[_0xe593('0x58')]['id']},'include':[{'model':db[_0xe593('0x7c')],'as':_0xe593('0x80')}]})['then'](handleEntityNotFound(_0x46bef8,null))[_0xe593('0x26')](function(_0x411b32){_0x269d70[_0xe593('0x81')]=_0x411b32;_0x269d70[_0xe593('0x82')]=_[_0xe593('0x83')](_0x411b32[_0xe593('0x80')],[_0xe593('0x84')],[_0xe593('0x85')]);if(_0x269d70['account'][_0xe593('0x80')]){delete _0x269d70[_0xe593('0x81')]['Applications'];}return db['CmContact'][_0xe593('0x65')]();})[_0xe593('0x26')](function(_0x5b1240){if(!_0x5b1240){throw new db['Sequelize'][(_0xe593('0x24'))](_0xe593('0x86'));}_0x83f8ff=_[_0xe593('0x87')](_[_0xe593('0x59')](_0x5b1240),[_0xe593('0x88'),_0xe593('0x89')]);_0x8ac78c=_[_0xe593('0x87')](_[_0xe593('0x59')](_0x5b1240),[_0xe593('0x88'),_0xe593('0x89'),_0xe593('0x8a'),'ListId']);_0x269d70[_0xe593('0x63')]={'mapKey':'mobile'};if(_0x269d70[_0xe593('0x81')][_0xe593('0x50')]&&_0x269d70[_0xe593('0x81')][_0xe593('0x50')]===_0xe593('0x8b')){_0x269d70[_0xe593('0x63')][_0xe593('0x8c')]=_0x381cc3[_0xe593('0x63')]['From']['replace'](_0xe593('0x8d'),'');_0x269d70[_0xe593('0x63')][_0xe593('0x63')]=_0x381cc3[_0xe593('0x63')][_0xe593('0x8e')];_0x269d70[_0xe593('0x63')][_0xe593('0x8f')]=_0x381cc3[_0xe593('0x63')][_0xe593('0x90')];}if(_0x269d70['body']['id']){delete _0x269d70[_0xe593('0x63')]['id'];}if(_[_0xe593('0x91')](_0x269d70['body'][_0xe593('0x8c')])){throw new db[(_0xe593('0x23'))][(_0xe593('0x24'))](_0xe593('0x92'));}if(_['isNil'](_0x269d70['body'][_0xe593('0x63')])||_0x269d70['body'][_0xe593('0x63')]===''){throw new db[(_0xe593('0x23'))][(_0xe593('0x24'))](_0xe593('0x93'));}if(_[_0xe593('0x91')](_0x269d70[_0xe593('0x63')][_0xe593('0x94')])){throw new db[(_0xe593('0x23'))][(_0xe593('0x24'))](_0xe593('0x95')+_0x8ac78c);}if(!_['includes'](_0x8ac78c,_0x269d70[_0xe593('0x63')]['mapKey'])){throw new db[(_0xe593('0x23'))][(_0xe593('0x24'))](_0xe593('0x96')+_0x8ac78c);}_0x352ad3[_0x269d70[_0xe593('0x63')][_0xe593('0x94')]]=_0x269d70[_0xe593('0x63')][_0xe593('0x8c')];return db[_0xe593('0x97')][_0xe593('0x64')]({'where':{'id':_0x269d70['account']['ListId']},'include':[{'model':db['CmContact'],'as':_0xe593('0x98'),'where':_0x352ad3,'limit':0x1,'order':[[_0xe593('0x89'),'DESC']]}]});})[_0xe593('0x26')](handleEntityNotFound(_0x46bef8,null))[_0xe593('0x26')](function(_0x428b30){if(_0x428b30){_0x269d70[_0xe593('0x99')]=_['omit'](_0x428b30,[_0xe593('0x98')]);if(_0x428b30[_0xe593('0x98')]['length']){return _0x428b30[_0xe593('0x98')][0x0];}var _0x30e775=_[_0xe593('0x1c')](_0x269d70[_0xe593('0x63')],{'firstName':_0x269d70[_0xe593('0x63')][_0xe593('0x8c')],'ListId':_0x428b30['id']});_0x30e775[_0x269d70[_0xe593('0x63')][_0xe593('0x94')]]=_0x269d70[_0xe593('0x63')][_0xe593('0x8c')];return db[_0xe593('0x9a')][_0xe593('0x5c')](_0x30e775,{'fields':_0x83f8ff,'raw':!![]});}})[_0xe593('0x26')](handleEntityNotFound(_0x46bef8,null))[_0xe593('0x26')](function(_0x486178){if(_0x486178){_0x269d70[_0xe593('0x9b')]=_0x486178;var _0x7e0d1f={'ContactId':_0x486178['id'],'phone':_0x269d70[_0xe593('0x63')][_0xe593('0x8c')],'WhatsappAccountId':_0x381cc3[_0xe593('0x58')]['id']};var _0x2c7e0a={'ContactId':_0x486178['id'],'WhatsappAccountId':_0x381cc3[_0xe593('0x58')]['id'],'closed':![]};return db[_0xe593('0x9c')][_0xe593('0x64')]({'where':_0x2c7e0a})[_0xe593('0x26')](function(_0x526fbf){if(_0x526fbf){return[_0x526fbf,![]];}return db[_0xe593('0x9c')][_0xe593('0x5c')](_0x7e0d1f)[_0xe593('0x26')](function(_0xc1e03b){return[_0xc1e03b,!![]];});});}})['spread'](function(_0x3561d6,_0x44b1b1){_0x269d70[_0xe593('0x9d')]=_0x3561d6['get']({'plain':!![]});_0x269d70['interaction']['created']=![];if(_0x44b1b1){if(_0x269d70[_0xe593('0x81')][_0xe593('0x9e')]){_0x269d70[_0xe593('0x82')][_0xe593('0x9f')]({'id':0x0,'priority':_0x269d70[_0xe593('0x82')][_0xe593('0x4a')]+0x1,'app':_0xe593('0xa0'),'appdata':_0xe593('0xa1'),'interval':_0xe593('0xa2')});}_0x269d70['interaction'][_0xe593('0xa3')]=!![];}return db['WhatsappMessage'][_0xe593('0x5c')]({'phone':_0x269d70['body'][_0xe593('0x8c')],'messageId':_0x269d70['body'][_0xe593('0x8f')],'body':_0x269d70[_0xe593('0x63')][_0xe593('0x63')],'WhatsappAccountId':_0x381cc3[_0xe593('0x58')]['id'],'WhatsappInteractionId':_0x3561d6['id'],'direction':'in','ContactId':_0x3561d6[_0xe593('0xa4')],'AttachmentId':_0x269d70[_0xe593('0x63')][_0xe593('0xa5')]});})[_0xe593('0x26')](function(_0x589731){_0x269d70['message']=_0x589731;if(_0x269d70['interaction'][_0xe593('0xa6')]){return db[_0xe593('0x78')][_0xe593('0x64')]({'attributes':['id',_0xe593('0x3e')],'where':{'id':_0x269d70[_0xe593('0x9d')][_0xe593('0xa6')]}})[_0xe593('0x26')](function(_0x43e223){if(_0x43e223){_0x269d70['applications'][_0xe593('0xa7')]({'id':0x0,'priority':0x0,'app':_0xe593('0xa8'),'appdata':_0x43e223[_0xe593('0x3e')]+','+(_0x269d70[_0xe593('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0xe593('0xa2')});}return respondWithRpcPromise(_0xe593('0xa9'),'startRouting',_0x269d70);});}return respondWithRpcPromise(_0xe593('0xa9'),_0xe593('0xaa'),_0x269d70);})[_0xe593('0x26')](function(_0x4a4b53){if(_0x4a4b53){var _0x4f2e0f=0xc8;var _0x350054='receiveMessage';logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x350054,_0x4f2e0f,'entity\x20found');logger[_0xe593('0x2a')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x350054,_0x4f2e0f,_0xe593('0xab'),JSON[_0xe593('0xac')](_0x4a4b53));if(_0x269d70['account'][_0xe593('0x50')]===_0xe593('0x8b')){return _0x46bef8['status'](_0x4f2e0f)[_0xe593('0x33')]('Content-Type',_0xe593('0xad'))[_0xe593('0xae')](_0xe593('0xaf'));}else{return _0x46bef8[_0xe593('0x2f')](_0x4f2e0f)['json'](_0x4a4b53);}}})[_0xe593('0x56')](handleError(_0x46bef8,null));};exports[_0xe593('0xae')]=function(_0x46cfc6,_0x3afb57,_0x376ad1){var _0xd82998,_0x3e38a1,_0x1780da;if(_[_0xe593('0x91')](_0x46cfc6[_0xe593('0x63')][_0xe593('0x63')])||_0x46cfc6[_0xe593('0x63')][_0xe593('0x63')]===''){throw new db[(_0xe593('0x23'))]['ValidationError'](_0xe593('0x93'));}if(_[_0xe593('0x91')](_0x46cfc6[_0xe593('0x63')]['to'])){throw new db[(_0xe593('0x23'))][(_0xe593('0x24'))](_0xe593('0xb0'));}_0xd82998=_0x46cfc6[_0xe593('0x63')]['to'];return db[_0xe593('0x53')][_0xe593('0x64')]({'where':{'id':_0x46cfc6[_0xe593('0x58')]['id']},'include':[{'model':db[_0xe593('0x97')],'as':'List','include':[{'model':db[_0xe593('0x9a')],'as':_0xe593('0x98'),'where':{'mobile':_0xd82998},'limit':0x1,'order':[[_0xe593('0x89'),_0xe593('0xb1')]]}]}]})[_0xe593('0x26')](handleEntityNotFound(_0x3afb57,null))['then'](function(_0x592468){if(_0x592468&&_0x592468['List']){_0x3e38a1=_0x592468['get']({'plain':!![]});if(_0x3e38a1[_0xe593('0xb2')]&&_0x3e38a1[_0xe593('0xb2')][_0xe593('0x98')][_0xe593('0x4a')]){return _0x3e38a1['List'][_0xe593('0x98')][0x0];}return db[_0xe593('0x9a')][_0xe593('0x5c')](_[_0xe593('0x1c')](_0x46cfc6[_0xe593('0x63')],{'firstName':_0xd82998,'mobile':_0xd82998,'phone':_0xd82998,'ListId':_0x3e38a1[_0xe593('0xb3')]}));}})[_0xe593('0x26')](handleEntityNotFound(_0x3afb57,null))['then'](function(_0x2c8e58){if(_0x2c8e58){_0x1780da=_0x2c8e58;return db[_0xe593('0x9c')][_0xe593('0x64')]({'where':{'ContactId':_0x1780da['id'],'closed':![],'WhatsappAccountId':_0x3e38a1['id']}})['then'](function(_0x4a51f6){if(_0x4a51f6){return[_0x4a51f6,![]];}return db[_0xe593('0x9c')][_0xe593('0x5c')]({'UserId':_0x46cfc6['user']['id'],'ContactId':_0x1780da['id'],'WhatsappAccountId':_0x3e38a1['id'],'phone':_0xd82998,'firstMsgDirection':'out','Messages':[_[_0xe593('0x4f')](_0x46cfc6[_0xe593('0x63')],{'read':![],'body':_0x46cfc6['body'][_0xe593('0x63')],'phone':_0xd82998,'WhatsappAccountId':_0x3e38a1['id'],'UserId':_0x46cfc6[_0xe593('0x5d')]['id'],'ContactId':_0x1780da['id']})]},{'include':[{'model':db[_0xe593('0xb4')],'as':_0xe593('0xb5')}]})['then'](function(_0x1215d1){return[_0x1215d1,!![]];});});}})['spread'](function(_0x5ddcb8,_0x31838b){if(_0x31838b){return _0x5ddcb8;}return db[_0xe593('0xb4')]['create'](_['merge'](_0x46cfc6[_0xe593('0x63')],{'read':![],'body':_0x46cfc6['body'][_0xe593('0x63')],'phone':_0xd82998,'WhatsappAccountId':_0x3e38a1['id'],'WhatsappInteractionId':_0x5ddcb8['id'],'UserId':_0x46cfc6[_0xe593('0x5d')]['id'],'ContactId':_0x1780da['id']}))['then'](function(_0x2c9e3d){_0x5ddcb8[_0xe593('0xb6')]['Messages']=[];_0x5ddcb8['dataValues'][_0xe593('0xb5')][_0xe593('0x9f')](_0x2c9e3d[_0xe593('0xb6')]);return _0x5ddcb8;});})['then'](respondWithResult(_0x3afb57,null))[_0xe593('0x56')](handleError(_0x3afb57,null));}; \ No newline at end of file +var _0x1be1=['ListId','mobile','From','replace','whatsapp:','messageId','MessageSid','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','defaults','contact','WhatsappInteraction','interaction','created','push','close','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','\x0a','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','dataValues','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','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','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','order','sort','where','filter','merge','options','WhatsappAccount','findAll','rows','catch','show','keys','find','create','body','user','role','get','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','WhatsappAccountId','includeAll','include','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','priority','getApplications','Applications','applications','asc','account','CmContact','difference','createdAt','updatedAt','CompanyId'];(function(_0x24db71,_0x1c463f){var _0x466dbd=function(_0x2f8680){while(--_0x2f8680){_0x24db71['push'](_0x24db71['shift']());}};_0x466dbd(++_0x1c463f);}(_0x1be1,0x192));var _0x11be=function(_0x3a529a,_0x1b1fd8){_0x3a529a=_0x3a529a-0x0;var _0x4968da=_0x1be1[_0x3a529a];return _0x4968da;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x11be('0x0'));var zipdir=require(_0x11be('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11be('0x2'));var moment=require(_0x11be('0x3'));var BPromise=require(_0x11be('0x4'));var Mustache=require(_0x11be('0x5'));var util=require('util');var path=require(_0x11be('0x6'));var sox=require(_0x11be('0x7'));var csv=require(_0x11be('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x11be('0x9'));var squel=require('squel');var crypto=require(_0x11be('0xa'));var jsforce=require(_0x11be('0xb'));var deskjs=require(_0x11be('0xc'));var toCsv=require(_0x11be('0x8'));var querystring=require(_0x11be('0xd'));var Papa=require('papaparse');var Redis=require(_0x11be('0xe'));var authService=require(_0x11be('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x11be('0x10'));var hardwareService=require(_0x11be('0x11'));var logger=require(_0x11be('0x12'))(_0x11be('0x13'));var utils=require('../../config/utils');var config=require(_0x11be('0x14'));var db=require(_0x11be('0x15'))['db'];config[_0x11be('0x16')]=_['defaults'](config[_0x11be('0x16')],{'host':_0x11be('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x11be('0x16')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function checkPasswordPattern(_0x5aa444,_0x588871,_0x2280e2){if(_0x2280e2){var _0x52bbef=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x52bbef[_0x11be('0x18')](_0x588871)){return _0x5aa444;}else{throw new db[(_0x11be('0x19'))][(_0x11be('0x1a'))](_0x11be('0x1b'));}}else{return _0x5aa444;}}function respondWithRpcPromise(_0x547037,_0x2ed725,_0x403d7a,_0x56ab61){return new BPromise(function(_0x299f45,_0xc3263c){var _0x23aa5f=_0x56ab61||client;return _0x23aa5f['request'](_0x547037,_0x403d7a)['then'](function(_0x141391){logger[_0x11be('0x1c')](_0x11be('0x1d'),_0x2ed725,_0x11be('0x1e'));logger['debug'](_0x11be('0x1f'),_0x2ed725,_0x11be('0x1e'),JSON[_0x11be('0x20')](_0x141391));if(_0x141391[_0x11be('0x21')]){if(_0x141391[_0x11be('0x21')][_0x11be('0x22')]===0x1f4){logger[_0x11be('0x21')](_0x11be('0x1d'),_0x2ed725,_0x141391[_0x11be('0x21')][_0x11be('0x23')]);return _0xc3263c(_0x141391['error'][_0x11be('0x23')]);}logger[_0x11be('0x21')](_0x11be('0x1d'),_0x2ed725,_0x141391['error']['message']);return _0x299f45(_0x141391[_0x11be('0x21')][_0x11be('0x23')]);}else{logger[_0x11be('0x1c')]('WhatsappAccount,\x20%s,\x20%s',_0x2ed725,_0x11be('0x1e'));_0x299f45(_0x141391['result'][_0x11be('0x23')]);}})['catch'](function(_0x28310d){logger[_0x11be('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x2ed725,_0x28310d);_0xc3263c(_0x28310d);});});}function respondWithStatusCode(_0x48029b,_0x28b3a0){_0x28b3a0=_0x28b3a0||0xcc;return function(_0x1d3b5c){if(_0x1d3b5c){return _0x48029b[_0x11be('0x24')](_0x28b3a0);}return _0x48029b[_0x11be('0x25')](_0x28b3a0)[_0x11be('0x26')]();};}function respondWithResult(_0xf5a6ac,_0x2cf9aa){_0x2cf9aa=_0x2cf9aa||0xc8;return function(_0x43ab30){if(_0x43ab30){return _0xf5a6ac['status'](_0x2cf9aa)[_0x11be('0x27')](_0x43ab30);}};}function respondWithFilteredResult(_0x4e899f,_0x182f6b){return function(_0x147b62){if(_0x147b62){var _0x510476=_0x147b62[_0x11be('0x28')],_0x584d4c=_0x182f6b[_0x11be('0x29')],_0x49fd5c=_0x182f6b[_0x11be('0x29')]+_0x182f6b[_0x11be('0x2a')],_0x265fc9;if(_0x49fd5c>=_0x510476){_0x49fd5c=_0x510476;_0x265fc9=0xc8;}else{_0x265fc9=0xce;}_0x4e899f[_0x11be('0x25')](_0x265fc9);return _0x4e899f[_0x11be('0x2b')](_0x11be('0x2c'),_0x584d4c+'-'+_0x49fd5c+'/'+_0x510476)['json'](_0x147b62);}return null;};}function patchUpdates(_0x71236f){return function(_0x3c1aa2){try{jsonpatch[_0x11be('0x2d')](_0x3c1aa2,_0x71236f,!![]);}catch(_0xff5e59){return BPromise[_0x11be('0x2e')](_0xff5e59);}return _0x3c1aa2[_0x11be('0x2f')]();};}function saveUpdates(_0x4cb8a6,_0x21ac91){return function(_0x440a77){if(_0x440a77){return _0x440a77[_0x11be('0x30')](_0x4cb8a6)[_0x11be('0x31')](function(_0x228bd3){return _0x228bd3;});}return null;};}function removeEntity(_0x53cd67,_0x368c8d){return function(_0x254be5){if(_0x254be5){return _0x254be5[_0x11be('0x32')]()['then'](function(){var _0x2c6fb2=_0x254be5['get']({'plain':!![]});var _0x4c7b47='WhatsappAccounts';return db['UserProfileResource'][_0x11be('0x32')]({'where':{'type':_0x4c7b47,'resourceId':_0x2c6fb2['id']}})[_0x11be('0x31')](function(){return _0x254be5;});})[_0x11be('0x31')](function(){_0x53cd67['status'](0xcc)[_0x11be('0x26')]();});}};}function handleEntityNotFound(_0x1866d8,_0x56ecd2){return function(_0x370d10){if(!_0x370d10){_0x1866d8['sendStatus'](0x194);}return _0x370d10;};}function handleError(_0x222f84,_0x58e702){_0x58e702=_0x58e702||0x1f4;return function(_0x4b4eb8){logger[_0x11be('0x21')](_0x4b4eb8[_0x11be('0x33')]);if(_0x4b4eb8[_0x11be('0x34')]){delete _0x4b4eb8['name'];}_0x222f84[_0x11be('0x25')](_0x58e702)[_0x11be('0x35')](_0x4b4eb8);};}exports[_0x11be('0x36')]=function(_0x18d402,_0x5b519b){var _0x11d5ea={'include':[{'model':db[_0x11be('0x37')],'as':_0x11be('0x38')}]},_0x361877={},_0x1c680e={'count':0x0,'rows':[]};var _0x1b1aac=_[_0x11be('0x39')](db['WhatsappAccount'][_0x11be('0x3a')],function(_0x399d39){return{'name':_0x399d39['fieldName'],'type':_0x399d39[_0x11be('0x3b')][_0x11be('0x3c')]};});_0x361877['model']=_[_0x11be('0x39')](_0x1b1aac,'name');_0x361877[_0x11be('0x3d')]=_['keys'](_0x18d402[_0x11be('0x3d')]);_0x361877[_0x11be('0x3e')]=_['intersection'](_0x361877[_0x11be('0x3f')],_0x361877['query']);_0x11d5ea[_0x11be('0x40')]=_[_0x11be('0x41')](_0x361877[_0x11be('0x3f')],qs[_0x11be('0x42')](_0x18d402[_0x11be('0x3d')][_0x11be('0x42')]));_0x11d5ea[_0x11be('0x40')]=_0x11d5ea['attributes'][_0x11be('0x43')]?_0x11d5ea[_0x11be('0x40')]:_0x361877[_0x11be('0x3f')];if(!_0x18d402[_0x11be('0x3d')]['hasOwnProperty']('nolimit')){_0x11d5ea['limit']=qs[_0x11be('0x2a')](_0x18d402['query'][_0x11be('0x2a')]);_0x11d5ea['offset']=qs[_0x11be('0x29')](_0x18d402[_0x11be('0x3d')][_0x11be('0x29')]);}_0x11d5ea[_0x11be('0x44')]=qs[_0x11be('0x45')](_0x18d402[_0x11be('0x3d')][_0x11be('0x45')]);_0x11d5ea['where']=qs[_0x11be('0x3e')](_['pick'](_0x18d402[_0x11be('0x3d')],_0x361877[_0x11be('0x3e')]),_0x1b1aac);if(_0x18d402[_0x11be('0x3d')]['filter']){_0x11d5ea['where']=_['merge'](_0x11d5ea[_0x11be('0x46')],{'$or':_[_0x11be('0x39')](_0x1b1aac,function(_0x49daf5){if(_0x49daf5['type']!=='VIRTUAL'){var _0x44e2e8={};_0x44e2e8[_0x49daf5[_0x11be('0x34')]]={'$like':'%'+_0x18d402[_0x11be('0x3d')][_0x11be('0x47')]+'%'};return _0x44e2e8;}})});}_0x11d5ea=_[_0x11be('0x48')]({},_0x11d5ea,_0x18d402[_0x11be('0x49')]);var _0x34b993={'where':_0x11d5ea[_0x11be('0x46')]};return db[_0x11be('0x4a')][_0x11be('0x28')](_0x34b993)[_0x11be('0x31')](function(_0x493799){_0x1c680e[_0x11be('0x28')]=_0x493799;if(_0x18d402[_0x11be('0x3d')]['includeAll']){_0x11d5ea['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x11be('0x4b')](_0x11d5ea);})['then'](function(_0x2f8222){_0x1c680e[_0x11be('0x4c')]=_0x2f8222;return _0x1c680e;})[_0x11be('0x31')](respondWithFilteredResult(_0x5b519b,_0x11d5ea))[_0x11be('0x4d')](handleError(_0x5b519b,null));};exports[_0x11be('0x4e')]=function(_0x3af729,_0x3bba53){var _0xc8c4a4={'raw':![],'where':{'id':_0x3af729['params']['id']},'include':[{'model':db[_0x11be('0x37')],'as':'mandatoryDispositionPause'}]},_0x3ebd7e={};_0x3ebd7e[_0x11be('0x3f')]=_[_0x11be('0x4f')](db['WhatsappAccount'][_0x11be('0x3a')]);_0x3ebd7e[_0x11be('0x3d')]=_[_0x11be('0x4f')](_0x3af729[_0x11be('0x3d')]);_0x3ebd7e[_0x11be('0x3e')]=_['intersection'](_0x3ebd7e['model'],_0x3ebd7e[_0x11be('0x3d')]);_0xc8c4a4[_0x11be('0x40')]=_['intersection'](_0x3ebd7e['model'],qs[_0x11be('0x42')](_0x3af729[_0x11be('0x3d')][_0x11be('0x42')]));_0xc8c4a4['attributes']=_0xc8c4a4['attributes']['length']?_0xc8c4a4[_0x11be('0x40')]:_0x3ebd7e[_0x11be('0x3f')];if(_0x3af729[_0x11be('0x3d')]['includeAll']){_0xc8c4a4['include']=[{'all':!![]}];}_0xc8c4a4=_[_0x11be('0x48')]({},_0xc8c4a4,_0x3af729[_0x11be('0x49')]);return db[_0x11be('0x4a')][_0x11be('0x50')](_0xc8c4a4)['then'](handleEntityNotFound(_0x3bba53,null))[_0x11be('0x31')](respondWithResult(_0x3bba53,null))['catch'](handleError(_0x3bba53,null));};exports['create']=function(_0x568f20,_0x5aa6bf){return db[_0x11be('0x4a')][_0x11be('0x51')](_0x568f20[_0x11be('0x52')],{})[_0x11be('0x31')](function(_0x420415){var _0x17b4f9=_0x568f20[_0x11be('0x53')]['get']({'plain':!![]});if(!_0x17b4f9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17b4f9[_0x11be('0x54')]===_0x11be('0x53')){var _0x11b969=_0x420415[_0x11be('0x55')]({'plain':!![]});var _0x5c7ed0=_0x11be('0x56');return db[_0x11be('0x57')][_0x11be('0x50')]({'where':{'name':_0x5c7ed0,'userProfileId':_0x17b4f9[_0x11be('0x58')]},'raw':!![]})['then'](function(_0x1aa57d){if(_0x1aa57d&&_0x1aa57d[_0x11be('0x59')]===0x0){return db[_0x11be('0x5a')]['create']({'name':_0x11b969[_0x11be('0x34')],'resourceId':_0x11b969['id'],'type':_0x1aa57d[_0x11be('0x34')],'sectionId':_0x1aa57d['id']},{})['then'](function(){return _0x420415;});}else{return _0x420415;}})['catch'](function(_0x53975a){logger[_0x11be('0x21')](_0x11be('0x5b'),_0x53975a);throw _0x53975a;});}return _0x420415;})[_0x11be('0x31')](respondWithResult(_0x5aa6bf,0xc9))['catch'](handleError(_0x5aa6bf,null));};exports[_0x11be('0x30')]=function(_0x3ada78,_0x7f62ed){if(_0x3ada78[_0x11be('0x52')]['id']){delete _0x3ada78[_0x11be('0x52')]['id'];}return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x3ada78[_0x11be('0x5c')]['id']},'include':[{'model':db[_0x11be('0x37')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x7f62ed,null))[_0x11be('0x31')](saveUpdates(_0x3ada78[_0x11be('0x52')],null))['then'](respondWithResult(_0x7f62ed,null))[_0x11be('0x4d')](handleError(_0x7f62ed,null));};exports[_0x11be('0x32')]=function(_0x42d4ee,_0x7aed92){return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x42d4ee[_0x11be('0x5c')]['id']}})['then'](handleEntityNotFound(_0x7aed92,null))['then'](removeEntity(_0x7aed92,null))[_0x11be('0x4d')](handleError(_0x7aed92,null));};exports[_0x11be('0x5d')]=function(_0x42ca5e,_0x5395c2){return db[_0x11be('0x4a')][_0x11be('0x5d')]()[_0x11be('0x31')](respondWithResult(_0x5395c2,null))[_0x11be('0x4d')](handleError(_0x5395c2,null));};exports[_0x11be('0x5e')]=function(_0x58a3b2,_0x32703c,_0xcefe71){if(_0x58a3b2[_0x11be('0x52')]['id']){delete _0x58a3b2[_0x11be('0x52')]['id'];}return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x58a3b2[_0x11be('0x5c')]['id']}})[_0x11be('0x31')](handleEntityNotFound(_0x32703c,null))[_0x11be('0x31')](function(_0x352b2f){if(_0x352b2f){_0x58a3b2['body']['WhatsappAccountId']=_0x352b2f['id'];return db[_0x11be('0x5f')]['create'](_0x58a3b2[_0x11be('0x52')]);}})[_0x11be('0x31')](respondWithResult(_0x32703c,null))[_0x11be('0x4d')](handleError(_0x32703c,null));};exports[_0x11be('0x60')]=function(_0x3d7188,_0x3a776d,_0x1943f2){var _0x3cb405={'raw':![],'where':{}};var _0x18f009={};var _0x48de70={'count':0x0,'rows':[]};return db[_0x11be('0x4a')][_0x11be('0x61')]({'where':{'id':_0x3d7188[_0x11be('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3a776d,null))[_0x11be('0x31')](function(_0x1e3d94){if(_0x1e3d94){_0x18f009['model']=_['keys'](db['Disposition']['rawAttributes']);_0x18f009[_0x11be('0x3d')]=_[_0x11be('0x4f')](_0x3d7188[_0x11be('0x3d')]);_0x18f009[_0x11be('0x3e')]=_[_0x11be('0x41')](_0x18f009['model'],_0x18f009[_0x11be('0x3d')]);_0x3cb405[_0x11be('0x40')]=_[_0x11be('0x41')](_0x18f009[_0x11be('0x3f')],qs[_0x11be('0x42')](_0x3d7188['query'][_0x11be('0x42')]));_0x3cb405[_0x11be('0x40')]=_0x3cb405[_0x11be('0x40')][_0x11be('0x43')]?_0x3cb405['attributes']:_0x18f009[_0x11be('0x3f')];if(!_0x3d7188[_0x11be('0x3d')][_0x11be('0x62')](_0x11be('0x63'))){_0x3cb405[_0x11be('0x2a')]=qs[_0x11be('0x2a')](_0x3d7188['query'][_0x11be('0x2a')]);_0x3cb405[_0x11be('0x29')]=qs[_0x11be('0x29')](_0x3d7188[_0x11be('0x3d')]['offset']);}_0x3cb405[_0x11be('0x44')]=qs['sort'](_0x3d7188[_0x11be('0x3d')][_0x11be('0x45')]);_0x3cb405[_0x11be('0x46')]=qs[_0x11be('0x3e')](_['pick'](_0x3d7188[_0x11be('0x3d')],_0x18f009[_0x11be('0x3e')]));_0x3cb405['where'][_0x11be('0x64')]=_0x1e3d94['id'];if(_0x3d7188[_0x11be('0x3d')][_0x11be('0x47')]){_0x3cb405[_0x11be('0x46')]=_['merge'](_0x3cb405[_0x11be('0x46')],{'$or':_[_0x11be('0x39')](_0x3cb405[_0x11be('0x40')],function(_0x45da8c){var _0x3e4ecd={};_0x3e4ecd[_0x45da8c]={'$like':'%'+_0x3d7188[_0x11be('0x3d')][_0x11be('0x47')]+'%'};return _0x3e4ecd;})});}_0x3cb405=_[_0x11be('0x48')]({},_0x3cb405,_0x3d7188['options']);return db[_0x11be('0x5f')]['count']({'where':_0x3cb405['where']})[_0x11be('0x31')](function(_0x658255){_0x48de70[_0x11be('0x28')]=_0x658255;if(_0x3d7188[_0x11be('0x3d')][_0x11be('0x65')]){_0x3cb405[_0x11be('0x66')]=[{'all':!![]}];}return db[_0x11be('0x5f')]['findAll'](_0x3cb405);})['then'](function(_0xf13875){_0x48de70['rows']=_0xf13875;return _0x48de70;});}})['then'](respondWithFilteredResult(_0x3a776d,_0x3cb405))[_0x11be('0x4d')](handleError(_0x3a776d,null));};exports['removeDispositions']=function(_0x352419,_0x380eeb,_0x485968){return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x352419['params']['id']}})[_0x11be('0x31')](handleEntityNotFound(_0x380eeb,null))[_0x11be('0x31')](function(_0x511eaa){if(_0x511eaa){return _0x511eaa[_0x11be('0x67')](_0x352419[_0x11be('0x3d')][_0x11be('0x68')]);}})[_0x11be('0x31')](respondWithStatusCode(_0x380eeb,null))[_0x11be('0x4d')](handleError(_0x380eeb,null));};exports[_0x11be('0x69')]=function(_0x11cebb,_0x543683,_0x33210a){if(_0x11cebb[_0x11be('0x52')]['id']){delete _0x11cebb[_0x11be('0x52')]['id'];}return db['WhatsappAccount'][_0x11be('0x50')]({'where':{'id':_0x11cebb[_0x11be('0x5c')]['id']}})['then'](handleEntityNotFound(_0x543683,null))[_0x11be('0x31')](function(_0x290250){if(_0x290250){_0x11cebb[_0x11be('0x52')]['WhatsappAccountId']=_0x290250['id'];return db['CannedAnswer']['create'](_0x11cebb[_0x11be('0x52')]);}})[_0x11be('0x31')](respondWithResult(_0x543683,null))[_0x11be('0x4d')](handleError(_0x543683,null));};exports[_0x11be('0x6a')]=function(_0x3074f9,_0x4bb42f,_0x250caa){var _0x12917e={'raw':![],'where':{}};var _0x43dcfe={};var _0x3eefd1={'count':0x0,'rows':[]};return db[_0x11be('0x4a')][_0x11be('0x61')]({'where':{'id':_0x3074f9['params']['id']}})['then'](handleEntityNotFound(_0x4bb42f,null))[_0x11be('0x31')](function(_0x5dd85d){if(_0x5dd85d){_0x43dcfe[_0x11be('0x3f')]=_[_0x11be('0x4f')](db['CannedAnswer'][_0x11be('0x3a')]);_0x43dcfe[_0x11be('0x3d')]=_[_0x11be('0x4f')](_0x3074f9[_0x11be('0x3d')]);_0x43dcfe[_0x11be('0x3e')]=_[_0x11be('0x41')](_0x43dcfe['model'],_0x43dcfe[_0x11be('0x3d')]);_0x12917e['attributes']=_[_0x11be('0x41')](_0x43dcfe['model'],qs[_0x11be('0x42')](_0x3074f9[_0x11be('0x3d')][_0x11be('0x42')]));_0x12917e[_0x11be('0x40')]=_0x12917e[_0x11be('0x40')][_0x11be('0x43')]?_0x12917e[_0x11be('0x40')]:_0x43dcfe[_0x11be('0x3f')];if(!_0x3074f9['query'][_0x11be('0x62')](_0x11be('0x63'))){_0x12917e['limit']=qs[_0x11be('0x2a')](_0x3074f9[_0x11be('0x3d')][_0x11be('0x2a')]);_0x12917e['offset']=qs['offset'](_0x3074f9[_0x11be('0x3d')]['offset']);}_0x12917e[_0x11be('0x44')]=qs['sort'](_0x3074f9[_0x11be('0x3d')][_0x11be('0x45')]);_0x12917e[_0x11be('0x46')]=qs[_0x11be('0x3e')](_['pick'](_0x3074f9[_0x11be('0x3d')],_0x43dcfe[_0x11be('0x3e')]));_0x12917e[_0x11be('0x46')][_0x11be('0x64')]=_0x5dd85d['id'];if(_0x3074f9[_0x11be('0x3d')][_0x11be('0x47')]){_0x12917e[_0x11be('0x46')]=_[_0x11be('0x48')](_0x12917e[_0x11be('0x46')],{'$or':_[_0x11be('0x39')](_0x12917e['attributes'],function(_0x30b984){var _0x27aafe={};_0x27aafe[_0x30b984]={'$like':'%'+_0x3074f9[_0x11be('0x3d')]['filter']+'%'};return _0x27aafe;})});}_0x12917e=_['merge']({},_0x12917e,_0x3074f9[_0x11be('0x49')]);return db[_0x11be('0x6b')]['count']({'where':_0x12917e[_0x11be('0x46')]})[_0x11be('0x31')](function(_0x3c583b){_0x3eefd1[_0x11be('0x28')]=_0x3c583b;if(_0x3074f9[_0x11be('0x3d')]['includeAll']){_0x12917e['include']=[{'all':!![]}];}return db[_0x11be('0x6b')][_0x11be('0x4b')](_0x12917e);})[_0x11be('0x31')](function(_0x3ae6a2){_0x3eefd1['rows']=_0x3ae6a2;return _0x3eefd1;});}})['then'](respondWithFilteredResult(_0x4bb42f,_0x12917e))[_0x11be('0x4d')](handleError(_0x4bb42f,null));};exports[_0x11be('0x6c')]=function(_0x3f5f7c,_0x5985dd,_0xcec3f5){return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x3f5f7c[_0x11be('0x5c')]['id']}})[_0x11be('0x31')](handleEntityNotFound(_0x5985dd,null))['then'](function(_0x214091){if(_0x214091){return _0x214091['removeAnswers'](_0x3f5f7c['query'][_0x11be('0x68')]);}})[_0x11be('0x31')](respondWithStatusCode(_0x5985dd,null))['catch'](handleError(_0x5985dd,null));};exports['addAgents']=function(_0x5334bd,_0x39bc3a,_0x185aa0){return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x5334bd[_0x11be('0x5c')]['id']}})[_0x11be('0x31')](handleEntityNotFound(_0x39bc3a,null))['then'](function(_0x1e4fed){if(_0x1e4fed){return _0x1e4fed[_0x11be('0x6d')](_0x5334bd[_0x11be('0x52')][_0x11be('0x68')],_[_0x11be('0x6e')](_0x5334bd[_0x11be('0x52')],[_0x11be('0x68'),'id'])||{})[_0x11be('0x6f')](function(_0x440f2e){for(var _0x41450f=0x0;_0x41450f<_0x5334bd[_0x11be('0x52')]['ids'][_0x11be('0x43')];_0x41450f+=0x1){socket['emit'](_0x11be('0x70'),{'UserId':_0x5334bd[_0x11be('0x52')][_0x11be('0x68')][_0x41450f],'WhatsappAccountId':_0x5334bd[_0x11be('0x5c')]['id']});}return _0x440f2e;});}})[_0x11be('0x31')](respondWithResult(_0x39bc3a,null))['catch'](handleError(_0x39bc3a,null));};exports[_0x11be('0x71')]=function(_0x1da9be,_0x543a39,_0x218d63){return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x1da9be[_0x11be('0x5c')]['id']}})[_0x11be('0x31')](handleEntityNotFound(_0x543a39,null))[_0x11be('0x31')](function(_0x1be631){if(_0x1be631){return _0x1be631['removeAgents'](_0x1da9be[_0x11be('0x3d')][_0x11be('0x68')])[_0x11be('0x31')](function(){if(_[_0x11be('0x72')](_0x1da9be['query'][_0x11be('0x68')])){for(var _0x248c08=0x0;_0x248c08<_0x1da9be[_0x11be('0x3d')][_0x11be('0x68')]['length'];_0x248c08+=0x1){socket[_0x11be('0x73')](_0x11be('0x74'),{'UserId':Number(_0x1da9be[_0x11be('0x3d')]['ids'][_0x248c08]),'WhatsappAccountId':Number(_0x1da9be[_0x11be('0x5c')]['id'])});}}else{socket[_0x11be('0x73')](_0x11be('0x74'),{'UserId':Number(_0x1da9be['query'][_0x11be('0x68')]),'WhatsappAccountId':Number(_0x1da9be['params']['id'])});}});}})[_0x11be('0x31')](respondWithStatusCode(_0x543a39,null))[_0x11be('0x4d')](handleError(_0x543a39,null));};exports[_0x11be('0x75')]=function(_0x19729f,_0x5c6843,_0x51412c){var _0x317285={};var _0x2e7d79={};var _0x3a7cc8;var _0x561f78;return db[_0x11be('0x4a')][_0x11be('0x61')]({'where':{'id':_0x19729f['params']['id']}})['then'](handleEntityNotFound(_0x5c6843,null))[_0x11be('0x31')](function(_0x348751){if(_0x348751){_0x3a7cc8=_0x348751;_0x2e7d79[_0x11be('0x3f')]=_[_0x11be('0x4f')](db[_0x11be('0x76')][_0x11be('0x3a')]);_0x2e7d79['query']=_['keys'](_0x19729f[_0x11be('0x3d')]);_0x2e7d79[_0x11be('0x3e')]=_[_0x11be('0x41')](_0x2e7d79['model'],_0x2e7d79[_0x11be('0x3d')]);_0x317285[_0x11be('0x40')]=_[_0x11be('0x41')](_0x2e7d79[_0x11be('0x3f')],qs[_0x11be('0x42')](_0x19729f['query'][_0x11be('0x42')]));_0x317285[_0x11be('0x40')]=_0x317285[_0x11be('0x40')][_0x11be('0x43')]?_0x317285['attributes']:_0x2e7d79[_0x11be('0x3f')];_0x317285[_0x11be('0x44')]=qs[_0x11be('0x45')](_0x19729f[_0x11be('0x3d')][_0x11be('0x45')]);_0x317285['where']=qs[_0x11be('0x3e')](_['pick'](_0x19729f[_0x11be('0x3d')],_0x2e7d79[_0x11be('0x3e')]));if(_0x19729f[_0x11be('0x3d')][_0x11be('0x47')]){_0x317285[_0x11be('0x46')]=_[_0x11be('0x48')](_0x317285[_0x11be('0x46')],{'$or':_[_0x11be('0x39')](_0x317285[_0x11be('0x40')],function(_0x123f5f){var _0x41bbbd={};_0x41bbbd[_0x123f5f]={'$like':'%'+_0x19729f[_0x11be('0x3d')][_0x11be('0x47')]+'%'};return _0x41bbbd;})});}_0x317285=_[_0x11be('0x48')]({},_0x317285,_0x19729f['options']);return _0x3a7cc8[_0x11be('0x75')](_0x317285);}})[_0x11be('0x31')](function(_0x7f506){if(_0x7f506){_0x561f78=_0x7f506['length'];if(!_0x19729f[_0x11be('0x3d')][_0x11be('0x62')](_0x11be('0x63'))){_0x317285[_0x11be('0x2a')]=qs[_0x11be('0x2a')](_0x19729f[_0x11be('0x3d')][_0x11be('0x2a')]);_0x317285[_0x11be('0x29')]=qs[_0x11be('0x29')](_0x19729f[_0x11be('0x3d')][_0x11be('0x29')]);}return _0x3a7cc8[_0x11be('0x75')](_0x317285);}})[_0x11be('0x31')](function(_0x1c09fe){if(_0x1c09fe){return _0x1c09fe?{'count':_0x561f78,'rows':_0x1c09fe}:null;}})[_0x11be('0x31')](respondWithResult(_0x5c6843,null))[_0x11be('0x4d')](handleError(_0x5c6843,null));};exports[_0x11be('0x77')]=function(_0x307dcf,_0x1f84a3,_0x1f5c22){return db[_0x11be('0x4a')][_0x11be('0x61')]({'where':{'id':_0x307dcf[_0x11be('0x5c')]['id']}})[_0x11be('0x31')](handleEntityNotFound(_0x1f84a3,null))['then'](function(_0x241a57){if(_0x241a57){return db[_0x11be('0x78')][_0x11be('0x79')](function(_0x127877){return db['WhatsappApplication'][_0x11be('0x32')]({'where':{'WhatsappAccountId':_0x307dcf[_0x11be('0x5c')]['id']},'transaction':_0x127877})['then'](function(_0x4418b9){var _0x23595d=_[_0x11be('0x39')](_0x307dcf[_0x11be('0x52')],function(_0x2a6133){_0x2a6133[_0x11be('0x64')]=_0x307dcf[_0x11be('0x5c')]['id'];return _0x2a6133;});return db[_0x11be('0x7a')][_0x11be('0x7b')](_0x23595d,{'transaction':_0x127877});});})[_0x11be('0x31')](function(){return db[_0x11be('0x7a')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x307dcf[_0x11be('0x5c')]['id']},'order':_0x11be('0x7c')});});}})[_0x11be('0x31')](respondWithResult(_0x1f84a3,null))[_0x11be('0x4d')](handleError(_0x1f84a3,null));};exports[_0x11be('0x7d')]=function(_0x1951e7,_0x330287,_0x1200a1){var _0x5208ea={};var _0x2ac652={};var _0x3ba5ce;var _0x546991;return db[_0x11be('0x4a')][_0x11be('0x61')]({'where':{'id':_0x1951e7[_0x11be('0x5c')]['id']}})[_0x11be('0x31')](handleEntityNotFound(_0x330287,null))['then'](function(_0x1e7699){if(_0x1e7699){_0x3ba5ce=_0x1e7699;_0x2ac652['model']=_[_0x11be('0x4f')](db['WhatsappApplication'][_0x11be('0x3a')]);_0x2ac652[_0x11be('0x3d')]=_['keys'](_0x1951e7[_0x11be('0x3d')]);_0x2ac652['filters']=_[_0x11be('0x41')](_0x2ac652['model'],_0x2ac652[_0x11be('0x3d')]);_0x5208ea[_0x11be('0x40')]=_['intersection'](_0x2ac652[_0x11be('0x3f')],qs[_0x11be('0x42')](_0x1951e7[_0x11be('0x3d')][_0x11be('0x42')]));_0x5208ea['attributes']=_0x5208ea[_0x11be('0x40')]['length']?_0x5208ea['attributes']:_0x2ac652[_0x11be('0x3f')];_0x5208ea[_0x11be('0x44')]=qs[_0x11be('0x45')](_0x1951e7['query']['sort']);_0x5208ea[_0x11be('0x46')]=qs[_0x11be('0x3e')](_['pick'](_0x1951e7[_0x11be('0x3d')],_0x2ac652['filters']));if(_0x1951e7[_0x11be('0x3d')][_0x11be('0x47')]){_0x5208ea[_0x11be('0x46')]=_[_0x11be('0x48')](_0x5208ea[_0x11be('0x46')],{'$or':_[_0x11be('0x39')](_0x5208ea[_0x11be('0x40')],function(_0x86b045){var _0x21626d={};_0x21626d[_0x86b045]={'$like':'%'+_0x1951e7[_0x11be('0x3d')]['filter']+'%'};return _0x21626d;})});}_0x5208ea=_[_0x11be('0x48')]({},_0x5208ea,_0x1951e7[_0x11be('0x49')]);return _0x3ba5ce['getApplications'](_0x5208ea);}})[_0x11be('0x31')](function(_0x47bf3b){if(_0x47bf3b){_0x546991=_0x47bf3b['length'];if(!_0x1951e7['query']['hasOwnProperty'](_0x11be('0x63'))){_0x5208ea[_0x11be('0x2a')]=qs[_0x11be('0x2a')](_0x1951e7['query'][_0x11be('0x2a')]);_0x5208ea['offset']=qs[_0x11be('0x29')](_0x1951e7[_0x11be('0x3d')][_0x11be('0x29')]);}return _0x3ba5ce[_0x11be('0x7d')](_0x5208ea);}})['then'](function(_0x151403){if(_0x151403){return _0x151403?{'count':_0x546991,'rows':_0x151403}:null;}})[_0x11be('0x31')](respondWithResult(_0x330287,null))[_0x11be('0x4d')](handleError(_0x330287,null));};exports['notify']=function(_0x23773d,_0x66e699,_0x1b60e8){var _0xae26dd={'channel':'whatsapp'};var _0x3c5a06=[];var _0x6a5ee4=[];var _0x5121f4={};return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x23773d[_0x11be('0x5c')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x11be('0x7e')}]})[_0x11be('0x31')](handleEntityNotFound(_0x66e699,null))[_0x11be('0x31')](function(_0x2df568){_0xae26dd['account']=_0x2df568;_0xae26dd[_0x11be('0x7f')]=_['orderBy'](_0x2df568[_0x11be('0x7e')],[_0x11be('0x7c')],[_0x11be('0x80')]);if(_0xae26dd[_0x11be('0x81')][_0x11be('0x7e')]){delete _0xae26dd[_0x11be('0x81')][_0x11be('0x7e')];}return db[_0x11be('0x82')][_0x11be('0x5d')]();})[_0x11be('0x31')](function(_0x3009fc){if(!_0x3009fc){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x3c5a06=_[_0x11be('0x83')](_[_0x11be('0x4f')](_0x3009fc),[_0x11be('0x84'),_0x11be('0x85')]);_0x6a5ee4=_[_0x11be('0x83')](_[_0x11be('0x4f')](_0x3009fc),[_0x11be('0x84'),_0x11be('0x85'),_0x11be('0x86'),_0x11be('0x87')]);_0xae26dd[_0x11be('0x52')]={'mapKey':_0x11be('0x88')};if(_0xae26dd['account'][_0x11be('0x3b')]&&_0xae26dd[_0x11be('0x81')]['type']==='twilio'){_0xae26dd[_0x11be('0x52')]['from']=_0x23773d[_0x11be('0x52')][_0x11be('0x89')][_0x11be('0x8a')](_0x11be('0x8b'),'');_0xae26dd[_0x11be('0x52')][_0x11be('0x52')]=_0x23773d['body']['Body'];_0xae26dd[_0x11be('0x52')][_0x11be('0x8c')]=_0x23773d[_0x11be('0x52')][_0x11be('0x8d')];}if(_0xae26dd['body']['id']){delete _0xae26dd['body']['id'];}if(_[_0x11be('0x8e')](_0xae26dd['body'][_0x11be('0x8f')])){throw new db['Sequelize'][(_0x11be('0x1a'))]('from\x20is\x20mandatory');}if(_[_0x11be('0x8e')](_0xae26dd['body'][_0x11be('0x52')])||_0xae26dd[_0x11be('0x52')][_0x11be('0x52')]===''){throw new db[(_0x11be('0x19'))][(_0x11be('0x1a'))](_0x11be('0x90'));}if(_[_0x11be('0x8e')](_0xae26dd[_0x11be('0x52')][_0x11be('0x91')])){throw new db[(_0x11be('0x19'))][(_0x11be('0x1a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6a5ee4);}if(!_[_0x11be('0x92')](_0x6a5ee4,_0xae26dd['body'][_0x11be('0x91')])){throw new db[(_0x11be('0x19'))][(_0x11be('0x1a'))](_0x11be('0x93')+_0x6a5ee4);}_0x5121f4[_0xae26dd[_0x11be('0x52')]['mapKey']]=_0xae26dd[_0x11be('0x52')]['from'];return db[_0x11be('0x94')][_0x11be('0x50')]({'where':{'id':_0xae26dd[_0x11be('0x81')][_0x11be('0x87')]},'include':[{'model':db[_0x11be('0x82')],'as':_0x11be('0x95'),'where':_0x5121f4,'limit':0x1,'order':[[_0x11be('0x85'),_0x11be('0x96')]]}]});})[_0x11be('0x31')](handleEntityNotFound(_0x66e699,null))[_0x11be('0x31')](function(_0x1f1d27){if(_0x1f1d27){_0xae26dd[_0x11be('0x97')]=_[_0x11be('0x6e')](_0x1f1d27,[_0x11be('0x95')]);if(_0x1f1d27['Contacts'][_0x11be('0x43')]){return _0x1f1d27[_0x11be('0x95')][0x0];}var _0x1374b5=_[_0x11be('0x98')](_0xae26dd['body'],{'firstName':_0xae26dd[_0x11be('0x52')][_0x11be('0x8f')],'ListId':_0x1f1d27['id']});_0x1374b5[_0xae26dd[_0x11be('0x52')]['mapKey']]=_0xae26dd['body'][_0x11be('0x8f')];return db[_0x11be('0x82')][_0x11be('0x51')](_0x1374b5,{'fields':_0x3c5a06,'raw':!![]});}})[_0x11be('0x31')](handleEntityNotFound(_0x66e699,null))[_0x11be('0x31')](function(_0x911f92){if(_0x911f92){_0xae26dd[_0x11be('0x99')]=_0x911f92;var _0x338b9a={'ContactId':_0x911f92['id'],'phone':_0xae26dd['body'][_0x11be('0x8f')],'WhatsappAccountId':_0x23773d['params']['id']};var _0x284629={'ContactId':_0x911f92['id'],'WhatsappAccountId':_0x23773d[_0x11be('0x5c')]['id'],'closed':![]};return db[_0x11be('0x9a')]['find']({'where':_0x284629})['then'](function(_0x1c9fae){if(_0x1c9fae){return[_0x1c9fae,![]];}return db[_0x11be('0x9a')][_0x11be('0x51')](_0x338b9a)[_0x11be('0x31')](function(_0x365c3e){return[_0x365c3e,!![]];});});}})[_0x11be('0x6f')](function(_0x130eb8,_0x31eb70){_0xae26dd[_0x11be('0x9b')]=_0x130eb8['get']({'plain':!![]});_0xae26dd[_0x11be('0x9b')][_0x11be('0x9c')]=![];if(_0x31eb70){if(_0xae26dd['account']['autoclose']){_0xae26dd[_0x11be('0x7f')][_0x11be('0x9d')]({'id':0x0,'priority':_0xae26dd[_0x11be('0x7f')]['length']+0x1,'app':_0x11be('0x9e'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0xae26dd[_0x11be('0x9b')][_0x11be('0x9c')]=!![];}return db['WhatsappMessage'][_0x11be('0x51')]({'phone':_0xae26dd[_0x11be('0x52')][_0x11be('0x8f')],'messageId':_0xae26dd[_0x11be('0x52')][_0x11be('0x8c')],'body':_0xae26dd[_0x11be('0x52')]['body'],'WhatsappAccountId':_0x23773d['params']['id'],'WhatsappInteractionId':_0x130eb8['id'],'direction':'in','ContactId':_0x130eb8[_0x11be('0x9f')],'AttachmentId':_0xae26dd['body'][_0x11be('0xa0')]});})[_0x11be('0x31')](function(_0x328ebc){_0xae26dd[_0x11be('0x23')]=_0x328ebc;if(_0xae26dd[_0x11be('0x9b')][_0x11be('0xa1')]){return db[_0x11be('0x76')]['find']({'attributes':['id',_0x11be('0x34')],'where':{'id':_0xae26dd[_0x11be('0x9b')]['UserId']}})[_0x11be('0x31')](function(_0x94c517){if(_0x94c517){_0xae26dd[_0x11be('0x7f')][_0x11be('0xa2')]({'id':0x0,'priority':0x0,'app':_0x11be('0xa3'),'appdata':_0x94c517[_0x11be('0x34')]+','+(_0xae26dd[_0x11be('0x81')][_0x11be('0xa4')]||0xa),'interval':_0x11be('0xa5')});}return respondWithRpcPromise(_0x11be('0xa6'),_0x11be('0xa7'),_0xae26dd);});}return respondWithRpcPromise(_0x11be('0xa6'),_0x11be('0xa7'),_0xae26dd);})[_0x11be('0x31')](function(_0x42ebf8){if(_0x42ebf8){var _0xb37a7b=0xc8;var _0x5804bc=_0x11be('0xa8');logger[_0x11be('0x1c')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5804bc,_0xb37a7b,'entity\x20found');logger['debug'](_0x11be('0xa9'),_0x5804bc,_0xb37a7b,'entity\x20found',JSON['stringify'](_0x42ebf8));if(_0xae26dd[_0x11be('0x81')][_0x11be('0x3b')]===_0x11be('0xaa')){return _0x66e699['status'](_0xb37a7b)[_0x11be('0x2b')](_0x11be('0xab'),'text/xml')[_0x11be('0x35')](_0x11be('0xac'));}else{return _0x66e699[_0x11be('0x25')](_0xb37a7b)[_0x11be('0x27')](_0x42ebf8);}}})[_0x11be('0x4d')](handleError(_0x66e699,null));};exports[_0x11be('0x35')]=function(_0x1f35c2,_0x5de23a,_0x148dac){var _0x3f5cd8,_0x29b073,_0x4867d3;if(_[_0x11be('0x8e')](_0x1f35c2[_0x11be('0x52')]['body'])||_0x1f35c2['body'][_0x11be('0x52')]===''){throw new db['Sequelize']['ValidationError'](_0x11be('0x90'));}if(_[_0x11be('0x8e')](_0x1f35c2[_0x11be('0x52')]['to'])){throw new db['Sequelize']['ValidationError'](_0x11be('0xad'));}_0x3f5cd8=_0x1f35c2[_0x11be('0x52')]['to'];return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x1f35c2[_0x11be('0x5c')]['id']},'include':[{'model':db[_0x11be('0x94')],'as':_0x11be('0xae'),'include':[{'model':db[_0x11be('0x82')],'as':_0x11be('0x95'),'where':{'mobile':_0x3f5cd8},'limit':0x1,'order':[[_0x11be('0x85'),_0x11be('0x96')]]}]}]})[_0x11be('0x31')](handleEntityNotFound(_0x5de23a,null))['then'](function(_0x4f1168){if(_0x4f1168&&_0x4f1168[_0x11be('0xae')]){_0x29b073=_0x4f1168[_0x11be('0x55')]({'plain':!![]});if(_0x29b073[_0x11be('0xae')]&&_0x29b073['List'][_0x11be('0x95')][_0x11be('0x43')]){return _0x29b073[_0x11be('0xae')][_0x11be('0x95')][0x0];}return db['CmContact'][_0x11be('0x51')](_['defaults'](_0x1f35c2[_0x11be('0x52')],{'firstName':_0x3f5cd8,'mobile':_0x3f5cd8,'phone':_0x3f5cd8,'ListId':_0x29b073['ListId']}));}})[_0x11be('0x31')](handleEntityNotFound(_0x5de23a,null))['then'](function(_0x1e4efd){if(_0x1e4efd){_0x4867d3=_0x1e4efd;return db[_0x11be('0x9a')][_0x11be('0x50')]({'where':{'ContactId':_0x4867d3['id'],'closed':![],'WhatsappAccountId':_0x29b073['id']}})[_0x11be('0x31')](function(_0x5c4134){if(_0x5c4134){return[_0x5c4134,![]];}return db[_0x11be('0x9a')][_0x11be('0x51')]({'UserId':_0x1f35c2['user']['id'],'ContactId':_0x4867d3['id'],'WhatsappAccountId':_0x29b073['id'],'phone':_0x3f5cd8,'firstMsgDirection':_0x11be('0xaf'),'Messages':[_[_0x11be('0x48')](_0x1f35c2[_0x11be('0x52')],{'read':![],'body':_0x1f35c2[_0x11be('0x52')][_0x11be('0x52')],'phone':_0x3f5cd8,'WhatsappAccountId':_0x29b073['id'],'UserId':_0x1f35c2[_0x11be('0x53')]['id'],'ContactId':_0x4867d3['id']})]},{'include':[{'model':db[_0x11be('0xb0')],'as':_0x11be('0xb1')}]})[_0x11be('0x31')](function(_0x589a2d){return[_0x589a2d,!![]];});});}})['spread'](function(_0x34b286,_0x259af9){if(_0x259af9){return _0x34b286;}return db[_0x11be('0xb0')][_0x11be('0x51')](_[_0x11be('0x48')](_0x1f35c2[_0x11be('0x52')],{'read':![],'body':_0x1f35c2[_0x11be('0x52')][_0x11be('0x52')],'phone':_0x3f5cd8,'WhatsappAccountId':_0x29b073['id'],'WhatsappInteractionId':_0x34b286['id'],'UserId':_0x1f35c2[_0x11be('0x53')]['id'],'ContactId':_0x4867d3['id']}))[_0x11be('0x31')](function(_0x150f7a){_0x34b286[_0x11be('0xb2')][_0x11be('0xb1')]=[];_0x34b286[_0x11be('0xb2')]['Messages'][_0x11be('0x9d')](_0x150f7a['dataValues']);return _0x34b286;});})[_0x11be('0x31')](respondWithResult(_0x5de23a,null))[_0x11be('0x4d')](handleError(_0x5de23a,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index e4110eb..a8dff49 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 _0xdb8b=['remove','emit','hasOwnProperty','exports','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x4b897b,_0x1d975d){var _0x3b6c3e=function(_0x3db193){while(--_0x3db193){_0x4b897b['push'](_0x4b897b['shift']());}};_0x3b6c3e(++_0x1d975d);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x506b70,_0x33c044){_0x506b70=_0x506b70-0x0;var _0x3af183=_0xdb8b[_0x506b70];return _0x3af183;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xbdb8('0x0'))['db'][_0xbdb8('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xbdb8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbdb8('0x3')};function emitEvent(_0x5e5f57){return function(_0x3149c6,_0x2ec8cc,_0x33b3d2){WhatsappAccountEvents[_0xbdb8('0x4')](_0x5e5f57+':'+_0x3149c6['id'],_0x3149c6);WhatsappAccountEvents['emit'](_0x5e5f57,_0x3149c6);_0x33b3d2(null);};}for(var e in events){if(events[_0xbdb8('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xbdb8('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0x6d38=['WhatsappAccount','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0xfcfc24,_0x48ca53){var _0x58f773=function(_0x263b5f){while(--_0x263b5f){_0xfcfc24['push'](_0xfcfc24['shift']());}};_0x58f773(++_0x48ca53);}(_0x6d38,0x1ef));var _0x86d3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6d38[_0x126558];return _0x1f6d14;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x86d3('0x0'))['db'][_0x86d3('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x86d3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x86d3('0x3')};function emitEvent(_0x574a1c){return function(_0xe9198a,_0x455b9d,_0x2501dd){WhatsappAccountEvents['emit'](_0x574a1c+':'+_0xe9198a['id'],_0xe9198a);WhatsappAccountEvents[_0x86d3('0x4')](_0x574a1c,_0xe9198a);_0x2501dd(null);};}for(var e in events){if(events[_0x86d3('0x5')](e)){var event=events[e];WhatsappAccount[_0x86d3('0x6')](e,emitEvent(event));}}module[_0x86d3('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index da65f34..e8a6285 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 _0xe854=['./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x4d467f,_0x54d2e7){var _0x521bb5=function(_0x126081){while(--_0x126081){_0x4d467f['push'](_0x4d467f['shift']());}};_0x521bb5(++_0x54d2e7);}(_0xe854,0xf5));var _0x4e85=function(_0x139c3e,_0x584ed6){_0x139c3e=_0x139c3e-0x0;var _0x1fe091=_0xe854[_0x139c3e];return _0x1fe091;};'use strict';var _=require(_0x4e85('0x0'));var util=require(_0x4e85('0x1'));var logger=require('../../config/logger')(_0x4e85('0x2'));var moment=require('moment');var BPromise=require(_0x4e85('0x3'));var rp=require(_0x4e85('0x4'));var fs=require('fs');var path=require(_0x4e85('0x5'));var rimraf=require(_0x4e85('0x6'));var config=require('../../config/environment');var attributes=require(_0x4e85('0x7'));module[_0x4e85('0x8')]=function(_0x4aaf76,_0x904a80){return _0x4aaf76[_0x4e85('0x9')](_0x4e85('0xa'),attributes,{'tableName':_0x4e85('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdc6=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','whatsapp_accounts','lodash'];(function(_0x5e2c32,_0x584410){var _0x24645b=function(_0x503c73){while(--_0x503c73){_0x5e2c32['push'](_0x5e2c32['shift']());}};_0x24645b(++_0x584410);}(_0xbdc6,0xf9));var _0x6bdc=function(_0x1c09a7,_0x2033cc){_0x1c09a7=_0x1c09a7-0x0;var _0x183140=_0xbdc6[_0x1c09a7];return _0x183140;};'use strict';var _=require(_0x6bdc('0x0'));var util=require(_0x6bdc('0x1'));var logger=require(_0x6bdc('0x2'))(_0x6bdc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6bdc('0x4'));var fs=require('fs');var path=require(_0x6bdc('0x5'));var rimraf=require(_0x6bdc('0x6'));var config=require(_0x6bdc('0x7'));var attributes=require(_0x6bdc('0x8'));module['exports']=function(_0x51bb29,_0x4a371c){return _0x51bb29['define']('WhatsappAccount',attributes,{'tableName':_0x6bdc('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 9963127..c36c560 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 _0xd9e5=['../../mysqldb','../../config/logger','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','WhatsappAccount','find','options','where','attributes','include','model','map','info','ShowWhatsappAccount','catch','lodash','moment','randomstring','ioredis'];(function(_0x5ee993,_0x30de73){var _0x17665e=function(_0xf4b6c5){while(--_0xf4b6c5){_0x5ee993['push'](_0x5ee993['shift']());}};_0x17665e(++_0x30de73);}(_0xd9e5,0x1b6));var _0x5d9e=function(_0x20a2f1,_0xca8a2f){_0x20a2f1=_0x20a2f1-0x0;var _0x4d467e=_0xd9e5[_0x20a2f1];return _0x4d467e;};'use strict';var _=require(_0x5d9e('0x0'));var util=require('util');var moment=require(_0x5d9e('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d9e('0x2'));var fs=require('fs');var Redis=require(_0x5d9e('0x3'));var db=require(_0x5d9e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d9e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x5d9e('0x6')]=_[_0x5d9e('0x7')](config[_0x5d9e('0x6')],{'host':_0x5d9e('0x8'),'port':0x18eb});var socket=require(_0x5d9e('0x9'))(new Redis(config[_0x5d9e('0x6')]));require(_0x5d9e('0xa'))[_0x5d9e('0xb')](socket);function respondWithRpcPromise(_0x59192a,_0x3a1ab4,_0x6e0803){return new BPromise(function(_0x1c152e,_0x17ef27){return client[_0x5d9e('0xc')](_0x59192a,_0x6e0803)[_0x5d9e('0xd')](function(_0x36286c){logger['info'](_0x5d9e('0xe'),_0x3a1ab4,'request\x20sent');logger[_0x5d9e('0xf')](_0x5d9e('0x10'),_0x3a1ab4,_0x5d9e('0x11'),JSON[_0x5d9e('0x12')](_0x36286c));if(_0x36286c[_0x5d9e('0x13')]){if(_0x36286c[_0x5d9e('0x13')][_0x5d9e('0x14')]===0x1f4){logger[_0x5d9e('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x3a1ab4,_0x36286c[_0x5d9e('0x13')][_0x5d9e('0x15')]);return _0x17ef27(_0x36286c[_0x5d9e('0x13')][_0x5d9e('0x15')]);}logger[_0x5d9e('0x13')](_0x5d9e('0xe'),_0x3a1ab4,_0x36286c[_0x5d9e('0x13')][_0x5d9e('0x15')]);return _0x1c152e(_0x36286c[_0x5d9e('0x13')][_0x5d9e('0x15')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x3a1ab4,'request\x20sent');_0x1c152e(_0x36286c[_0x5d9e('0x16')]['message']);}})['catch'](function(_0x2b7241){logger[_0x5d9e('0x13')](_0x5d9e('0xe'),_0x3a1ab4,_0x2b7241);_0x17ef27(_0x2b7241);});});}exports['ShowWhatsappAccount']=function(_0xd2ae69){var _0x30a092=this;return new Promise(function(_0x344efa,_0xc2a08c){return db[_0x5d9e('0x17')][_0x5d9e('0x18')]({'raw':_0xd2ae69['options']?_0xd2ae69[_0x5d9e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xd2ae69[_0x5d9e('0x19')]?_0xd2ae69[_0x5d9e('0x19')][_0x5d9e('0x1a')]||null:null,'attributes':_0xd2ae69[_0x5d9e('0x19')]?_0xd2ae69[_0x5d9e('0x19')][_0x5d9e('0x1b')]||null:null,'include':_0xd2ae69[_0x5d9e('0x19')]?_0xd2ae69[_0x5d9e('0x19')][_0x5d9e('0x1c')]?_['map'](_0xd2ae69[_0x5d9e('0x19')]['include'],function(_0x100530){return{'model':db[_0x100530[_0x5d9e('0x1d')]],'as':_0x100530['as'],'attributes':_0x100530['attributes'],'include':_0x100530[_0x5d9e('0x1c')]?_[_0x5d9e('0x1e')](_0x100530[_0x5d9e('0x1c')],function(_0x5a33bf){return{'model':db[_0x5a33bf[_0x5d9e('0x1d')]],'as':_0x5a33bf['as'],'attributes':_0x5a33bf[_0x5d9e('0x1b')],'include':_0x5a33bf[_0x5d9e('0x1c')]?_[_0x5d9e('0x1e')](_0x5a33bf[_0x5d9e('0x1c')],function(_0xc846d1){return{'model':db[_0xc846d1[_0x5d9e('0x1d')]],'as':_0xc846d1['as'],'attributes':_0xc846d1['attributes']};}):[]};}):[]};}):[]:[]})[_0x5d9e('0xd')](function(_0x1a3d58){logger[_0x5d9e('0x1f')]('ShowWhatsappAccount',_0xd2ae69);logger[_0x5d9e('0xf')](_0x5d9e('0x20'),_0xd2ae69,JSON[_0x5d9e('0x12')](_0x1a3d58));_0x344efa(_0x1a3d58);})[_0x5d9e('0x21')](function(_0x26de06){logger[_0x5d9e('0x13')](_0x5d9e('0x20'),_0x26de06[_0x5d9e('0x15')],_0xd2ae69);_0xc2a08c(_0x30a092['error'](0x1f4,_0x26de06[_0x5d9e('0x15')]));});});}; \ No newline at end of file +var _0xa25d=['redis','defaults','localhost','socket.io-emitter','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','ShowWhatsappAccount','find','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x315963,_0x59fd1a){var _0x31bb2a=function(_0x376b2c){while(--_0x376b2c){_0x315963['push'](_0x315963['shift']());}};_0x31bb2a(++_0x59fd1a);}(_0xa25d,0x194));var _0xda25=function(_0x5800a5,_0x2823f6){_0x5800a5=_0x5800a5-0x0;var _0x420c85=_0xa25d[_0x5800a5];return _0x420c85;};'use strict';var _=require(_0xda25('0x0'));var util=require(_0xda25('0x1'));var moment=require(_0xda25('0x2'));var BPromise=require(_0xda25('0x3'));var rs=require(_0xda25('0x4'));var fs=require('fs');var Redis=require(_0xda25('0x5'));var db=require(_0xda25('0x6'))['db'];var utils=require(_0xda25('0x7'));var logger=require(_0xda25('0x8'))(_0xda25('0x9'));var config=require(_0xda25('0xa'));var jayson=require(_0xda25('0xb'));var client=jayson[_0xda25('0xc')][_0xda25('0xd')]({'port':0x232a});config[_0xda25('0xe')]=_[_0xda25('0xf')](config[_0xda25('0xe')],{'host':_0xda25('0x10'),'port':0x18eb});var socket=require(_0xda25('0x11'))(new Redis(config['redis']));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x476573,_0x4c382a,_0x258f8b){return new BPromise(function(_0x2671a6,_0x41de2f){return client[_0xda25('0x12')](_0x476573,_0x258f8b)[_0xda25('0x13')](function(_0x32af5d){logger[_0xda25('0x14')](_0xda25('0x15'),_0x4c382a,_0xda25('0x16'));logger[_0xda25('0x17')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4c382a,_0xda25('0x16'),JSON[_0xda25('0x18')](_0x32af5d));if(_0x32af5d[_0xda25('0x19')]){if(_0x32af5d[_0xda25('0x19')][_0xda25('0x1a')]===0x1f4){logger['error'](_0xda25('0x15'),_0x4c382a,_0x32af5d[_0xda25('0x19')][_0xda25('0x1b')]);return _0x41de2f(_0x32af5d[_0xda25('0x19')]['message']);}logger[_0xda25('0x19')](_0xda25('0x15'),_0x4c382a,_0x32af5d['error'][_0xda25('0x1b')]);return _0x2671a6(_0x32af5d['error'][_0xda25('0x1b')]);}else{logger[_0xda25('0x14')](_0xda25('0x15'),_0x4c382a,_0xda25('0x16'));_0x2671a6(_0x32af5d['result'][_0xda25('0x1b')]);}})[_0xda25('0x1c')](function(_0x522a19){logger[_0xda25('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x4c382a,_0x522a19);_0x41de2f(_0x522a19);});});}exports[_0xda25('0x1d')]=function(_0x7fc809){var _0x4e41ff=this;return new Promise(function(_0x2d6e0b,_0x1129cb){return db['WhatsappAccount'][_0xda25('0x1e')]({'raw':_0x7fc809[_0xda25('0x1f')]?_0x7fc809[_0xda25('0x1f')][_0xda25('0x20')]===undefined?!![]:![]:!![],'where':_0x7fc809[_0xda25('0x1f')]?_0x7fc809[_0xda25('0x1f')][_0xda25('0x21')]||null:null,'attributes':_0x7fc809['options']?_0x7fc809[_0xda25('0x1f')][_0xda25('0x22')]||null:null,'include':_0x7fc809[_0xda25('0x1f')]?_0x7fc809['options']['include']?_[_0xda25('0x23')](_0x7fc809[_0xda25('0x1f')][_0xda25('0x24')],function(_0x18f57f){return{'model':db[_0x18f57f[_0xda25('0x25')]],'as':_0x18f57f['as'],'attributes':_0x18f57f['attributes'],'include':_0x18f57f[_0xda25('0x24')]?_[_0xda25('0x23')](_0x18f57f[_0xda25('0x24')],function(_0x5c8f9e){return{'model':db[_0x5c8f9e[_0xda25('0x25')]],'as':_0x5c8f9e['as'],'attributes':_0x5c8f9e[_0xda25('0x22')],'include':_0x5c8f9e[_0xda25('0x24')]?_['map'](_0x5c8f9e['include'],function(_0x5da286){return{'model':db[_0x5da286[_0xda25('0x25')]],'as':_0x5da286['as'],'attributes':_0x5da286['attributes']};}):[]};}):[]};}):[]:[]})[_0xda25('0x13')](function(_0xfdfd00){logger['info'](_0xda25('0x1d'),_0x7fc809);logger[_0xda25('0x17')](_0xda25('0x1d'),_0x7fc809,JSON['stringify'](_0xfdfd00));_0x2d6e0b(_0xfdfd00);})[_0xda25('0x1c')](function(_0x578c6c){logger['error'](_0xda25('0x1d'),_0x578c6c[_0xda25('0x1b')],_0x7fc809);_0x1129cb(_0x4e41ff['error'](0x1f4,_0x578c6c[_0xda25('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 16e9f00..42703cf 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 _0x0167=['removeListener','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x0167,0x1bb));var _0x7016=function(_0x353463,_0xce27c2){_0x353463=_0x353463-0x0;var _0x3dde90=_0x0167[_0x353463];return _0x3dde90;};'use strict';var WhatsappAccountEvents=require(_0x7016('0x0'));var events=[_0x7016('0x1'),_0x7016('0x2'),_0x7016('0x3')];function createListener(_0x49a152,_0x170131){return function(_0x37abd4){_0x170131[_0x7016('0x4')](_0x49a152,_0x37abd4);};}function removeListener(_0x31b47b,_0x57bd01){return function(){WhatsappAccountEvents[_0x7016('0x5')](_0x31b47b,_0x57bd01);};}exports['register']=function(_0x47d221){for(var _0x486ae9=0x0,_0x412a08=events['length'];_0x486ae9<_0x412a08;_0x486ae9++){var _0x5c85b4=events[_0x486ae9];var _0x1e29b1=createListener(_0x7016('0x6')+_0x5c85b4,_0x47d221);WhatsappAccountEvents['on'](_0x5c85b4,_0x1e29b1);}}; \ No newline at end of file +var _0x7824=['remove','update','emit','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x411069,_0x16ae05){var _0x68c645=function(_0x55d1c8){while(--_0x55d1c8){_0x411069['push'](_0x411069['shift']());}};_0x68c645(++_0x16ae05);}(_0x7824,0xd1));var _0x4782=function(_0x9fc209,_0x12d4b4){_0x9fc209=_0x9fc209-0x0;var _0x4f2ca8=_0x7824[_0x9fc209];return _0x4f2ca8;};'use strict';var WhatsappAccountEvents=require(_0x4782('0x0'));var events=['save',_0x4782('0x1'),_0x4782('0x2')];function createListener(_0x178a79,_0x2b56be){return function(_0x35183d){_0x2b56be[_0x4782('0x3')](_0x178a79,_0x35183d);};}function removeListener(_0x64d9ce,_0x5a08d1){return function(){WhatsappAccountEvents['removeListener'](_0x64d9ce,_0x5a08d1);};}exports['register']=function(_0x243e77){for(var _0x10cee6=0x0,_0x17e373=events[_0x4782('0x4')];_0x10cee6<_0x17e373;_0x10cee6++){var _0x128fe7=events[_0x10cee6];var _0x5c62b0=createListener(_0x4782('0x5')+_0x128fe7,_0x243e77);WhatsappAccountEvents['on'](_0x128fe7,_0x5c62b0);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 90d9aca..708ced3 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 _0x23aa=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','isAuthenticated','index','get','/:id','post','create','put','delete','destroy','util'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x23aa,0x142));var _0xa23a=function(_0x22dc00,_0x2abf02){_0x22dc00=_0x22dc00-0x0;var _0x3da432=_0x23aa[_0x22dc00];return _0x3da432;};'use strict';var multer=require('multer');var util=require(_0xa23a('0x0'));var path=require(_0xa23a('0x1'));var timeout=require(_0xa23a('0x2'));var express=require(_0xa23a('0x3'));var router=express[_0xa23a('0x4')]();var auth=require(_0xa23a('0x5'));var interaction=require(_0xa23a('0x6'));var config=require('../../config/environment');var controller=require(_0xa23a('0x7'));router['get']('/',auth[_0xa23a('0x8')](),controller[_0xa23a('0x9')]);router[_0xa23a('0xa')](_0xa23a('0xb'),auth[_0xa23a('0x8')](),controller['show']);router[_0xa23a('0xc')]('/',auth['isAuthenticated'](),controller[_0xa23a('0xd')]);router[_0xa23a('0xe')](_0xa23a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xa23a('0xf')]('/:id',auth[_0xa23a('0x8')](),controller[_0xa23a('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7c91=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','util'];(function(_0xf4666e,_0x571140){var _0x1853f1=function(_0x5160a5){while(--_0x5160a5){_0xf4666e['push'](_0xf4666e['shift']());}};_0x1853f1(++_0x571140);}(_0x7c91,0x1ca));var _0x17c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c91[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x17c9('0x0'));var util=require(_0x17c9('0x1'));var path=require(_0x17c9('0x2'));var timeout=require(_0x17c9('0x3'));var express=require(_0x17c9('0x4'));var router=express[_0x17c9('0x5')]();var auth=require(_0x17c9('0x6'));var interaction=require(_0x17c9('0x7'));var config=require(_0x17c9('0x8'));var controller=require(_0x17c9('0x9'));router[_0x17c9('0xa')]('/',auth[_0x17c9('0xb')](),controller[_0x17c9('0xc')]);router[_0x17c9('0xa')](_0x17c9('0xd'),auth[_0x17c9('0xb')](),controller['show']);router['post']('/',auth[_0x17c9('0xb')](),controller[_0x17c9('0xe')]);router[_0x17c9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x17c9('0x10')]);router[_0x17c9('0x11')](_0x17c9('0xd'),auth['isAuthenticated'](),controller[_0x17c9('0x12')]);module[_0x17c9('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 0ad1ec9..8fd3e39 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 _0xd156=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x341001,_0x6e47b0){var _0x4ea4c6=function(_0x5f54c8){while(--_0x5f54c8){_0x341001['push'](_0x341001['shift']());}};_0x4ea4c6(++_0x6e47b0);}(_0xd156,0x151));var _0x6d15=function(_0x63533c,_0x4facd0){_0x63533c=_0x63533c-0x0;var _0xddd4d1=_0xd156[_0x63533c];return _0xddd4d1;};'use strict';var Sequelize=require(_0x6d15('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6d15('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6d15('0x2')],'allowNull':![],'defaultValue':_0x6d15('0x3')},'appdata':{'type':Sequelize[_0x6d15('0x4')]()},'description':{'type':Sequelize[_0x6d15('0x2')]},'interval':{'type':Sequelize[_0x6d15('0x2')],'defaultValue':_0x6d15('0x5')}}; \ No newline at end of file +var _0x042a=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x105aaa,_0x358e95){var _0xe4b1fa=function(_0x52b5aa){while(--_0x52b5aa){_0x105aaa['push'](_0x105aaa['shift']());}};_0xe4b1fa(++_0x358e95);}(_0x042a,0x76));var _0xa042=function(_0x1d2f6e,_0x28dbba){_0x1d2f6e=_0x1d2f6e-0x0;var _0x265e96=_0x042a[_0x1d2f6e];return _0x265e96;};'use strict';var Sequelize=require(_0xa042('0x0'));module[_0xa042('0x1')]={'priority':{'type':Sequelize[_0xa042('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa042('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa042('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa042('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 522d5b5..1381881 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 _0xc947=['../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','reject','update','then','destroy','error','name','send','map','WhatsappApplication','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','create','body','find','params','html-pdf','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x59290a,_0x961ab9){var _0x1cdcb3=function(_0x5903a0){while(--_0x5903a0){_0x59290a['push'](_0x59290a['shift']());}};_0x1cdcb3(++_0x961ab9);}(_0xc947,0x14d));var _0x7c94=function(_0x642116,_0x7fc16){_0x642116=_0x642116-0x0;var _0x3ddeaa=_0xc947[_0x642116];return _0x3ddeaa;};'use strict';var pdf=require(_0x7c94('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7c94('0x1'));var zipdir=require(_0x7c94('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c94('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7c94('0x4'));var path=require(_0x7c94('0x5'));var sox=require(_0x7c94('0x6'));var csv=require(_0x7c94('0x7'));var ejs=require(_0x7c94('0x8'));var fs=require('fs');var _=require(_0x7c94('0x9'));var squel=require(_0x7c94('0xa'));var crypto=require(_0x7c94('0xb'));var jsforce=require(_0x7c94('0xc'));var deskjs=require(_0x7c94('0xd'));var toCsv=require(_0x7c94('0x7'));var querystring=require('querystring');var Papa=require(_0x7c94('0xe'));var Redis=require(_0x7c94('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7c94('0x10'));var as=require(_0x7c94('0x11'));var hardwareService=require(_0x7c94('0x12'));var logger=require(_0x7c94('0x13'))(_0x7c94('0x14'));var utils=require(_0x7c94('0x15'));var config=require(_0x7c94('0x16'));var db=require(_0x7c94('0x17'))['db'];function respondWithStatusCode(_0x263f86,_0x5345ff){_0x5345ff=_0x5345ff||0xcc;return function(_0x17ca1d){if(_0x17ca1d){return _0x263f86[_0x7c94('0x18')](_0x5345ff);}return _0x263f86[_0x7c94('0x19')](_0x5345ff)['end']();};}function respondWithResult(_0x2762bf,_0x206289){_0x206289=_0x206289||0xc8;return function(_0x4cb190){if(_0x4cb190){return _0x2762bf[_0x7c94('0x19')](_0x206289)[_0x7c94('0x1a')](_0x4cb190);}};}function respondWithFilteredResult(_0x1bec5c,_0x363177){return function(_0x4079be){if(_0x4079be){var _0x1128ea=_0x4079be['count'],_0x50c518=_0x363177['offset'],_0x4e2280=_0x363177[_0x7c94('0x1b')]+_0x363177[_0x7c94('0x1c')],_0x376def;if(_0x4e2280>=_0x1128ea){_0x4e2280=_0x1128ea;_0x376def=0xc8;}else{_0x376def=0xce;}_0x1bec5c[_0x7c94('0x19')](_0x376def);return _0x1bec5c[_0x7c94('0x1d')]('Content-Range',_0x50c518+'-'+_0x4e2280+'/'+_0x1128ea)[_0x7c94('0x1a')](_0x4079be);}return null;};}function patchUpdates(_0xaed9b6){return function(_0x1bbc50){try{jsonpatch[_0x7c94('0x1e')](_0x1bbc50,_0xaed9b6,!![]);}catch(_0x18da01){return BPromise[_0x7c94('0x1f')](_0x18da01);}return _0x1bbc50['save']();};}function saveUpdates(_0x4b9f54,_0x18a951){return function(_0x463d53){if(_0x463d53){return _0x463d53[_0x7c94('0x20')](_0x4b9f54)[_0x7c94('0x21')](function(_0x5cd64e){return _0x5cd64e;});}return null;};}function removeEntity(_0xd5bcaa,_0x2847a6){return function(_0x5eef67){if(_0x5eef67){return _0x5eef67[_0x7c94('0x22')]()[_0x7c94('0x21')](function(){_0xd5bcaa[_0x7c94('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x492551,_0x5aaf6e){return function(_0x1a80a9){if(!_0x1a80a9){_0x492551[_0x7c94('0x18')](0x194);}return _0x1a80a9;};}function handleError(_0x28b6ab,_0x128a82){_0x128a82=_0x128a82||0x1f4;return function(_0x292996){logger[_0x7c94('0x23')](_0x292996['stack']);if(_0x292996[_0x7c94('0x24')]){delete _0x292996[_0x7c94('0x24')];}_0x28b6ab[_0x7c94('0x19')](_0x128a82)[_0x7c94('0x25')](_0x292996);};}exports['index']=function(_0x713925,_0x2e8d5e){var _0x3412c6={},_0x2dba95={},_0x4e0c2d={'count':0x0,'rows':[]};var _0x5c6b98=_[_0x7c94('0x26')](db[_0x7c94('0x27')]['rawAttributes'],function(_0x19d1f8){return{'name':_0x19d1f8[_0x7c94('0x28')],'type':_0x19d1f8[_0x7c94('0x29')][_0x7c94('0x2a')]};});_0x2dba95[_0x7c94('0x2b')]=_['map'](_0x5c6b98,_0x7c94('0x24'));_0x2dba95[_0x7c94('0x2c')]=_[_0x7c94('0x2d')](_0x713925[_0x7c94('0x2c')]);_0x2dba95[_0x7c94('0x2e')]=_[_0x7c94('0x2f')](_0x2dba95[_0x7c94('0x2b')],_0x2dba95['query']);_0x3412c6[_0x7c94('0x30')]=_[_0x7c94('0x2f')](_0x2dba95[_0x7c94('0x2b')],qs[_0x7c94('0x31')](_0x713925['query'][_0x7c94('0x31')]));_0x3412c6[_0x7c94('0x30')]=_0x3412c6[_0x7c94('0x30')][_0x7c94('0x32')]?_0x3412c6[_0x7c94('0x30')]:_0x2dba95['model'];if(!_0x713925[_0x7c94('0x2c')][_0x7c94('0x33')](_0x7c94('0x34'))){_0x3412c6['limit']=qs[_0x7c94('0x1c')](_0x713925[_0x7c94('0x2c')][_0x7c94('0x1c')]);_0x3412c6[_0x7c94('0x1b')]=qs[_0x7c94('0x1b')](_0x713925[_0x7c94('0x2c')][_0x7c94('0x1b')]);}_0x3412c6[_0x7c94('0x35')]=qs[_0x7c94('0x36')](_0x713925[_0x7c94('0x2c')][_0x7c94('0x36')]);_0x3412c6[_0x7c94('0x37')]=qs[_0x7c94('0x2e')](_[_0x7c94('0x38')](_0x713925[_0x7c94('0x2c')],_0x2dba95[_0x7c94('0x2e')]),_0x5c6b98);if(_0x713925[_0x7c94('0x2c')][_0x7c94('0x39')]){_0x3412c6[_0x7c94('0x37')]=_[_0x7c94('0x3a')](_0x3412c6['where'],{'$or':_['map'](_0x5c6b98,function(_0x59ab08){if(_0x59ab08[_0x7c94('0x29')]!==_0x7c94('0x3b')){var _0x5cdf5e={};_0x5cdf5e[_0x59ab08['name']]={'$like':'%'+_0x713925['query'][_0x7c94('0x39')]+'%'};return _0x5cdf5e;}})});}_0x3412c6=_[_0x7c94('0x3a')]({},_0x3412c6,_0x713925[_0x7c94('0x3c')]);var _0x50b7dc={'where':_0x3412c6['where']};return db['WhatsappApplication'][_0x7c94('0x3d')](_0x50b7dc)[_0x7c94('0x21')](function(_0x379f23){_0x4e0c2d[_0x7c94('0x3d')]=_0x379f23;if(_0x713925[_0x7c94('0x2c')][_0x7c94('0x3e')]){_0x3412c6[_0x7c94('0x3f')]=[{'all':!![]}];}return db[_0x7c94('0x27')][_0x7c94('0x40')](_0x3412c6);})[_0x7c94('0x21')](function(_0xad0981){_0x4e0c2d['rows']=_0xad0981;return _0x4e0c2d;})['then'](respondWithFilteredResult(_0x2e8d5e,_0x3412c6))[_0x7c94('0x41')](handleError(_0x2e8d5e,null));};exports[_0x7c94('0x42')]=function(_0x49f46f,_0x43c9da){var _0x319551={'raw':!![],'where':{'id':_0x49f46f['params']['id']}},_0x15b3f4={};_0x15b3f4['model']=_['keys'](db['WhatsappApplication']['rawAttributes']);_0x15b3f4[_0x7c94('0x2c')]=_['keys'](_0x49f46f['query']);_0x15b3f4[_0x7c94('0x2e')]=_[_0x7c94('0x2f')](_0x15b3f4[_0x7c94('0x2b')],_0x15b3f4['query']);_0x319551[_0x7c94('0x30')]=_[_0x7c94('0x2f')](_0x15b3f4[_0x7c94('0x2b')],qs['fields'](_0x49f46f[_0x7c94('0x2c')][_0x7c94('0x31')]));_0x319551[_0x7c94('0x30')]=_0x319551[_0x7c94('0x30')]['length']?_0x319551[_0x7c94('0x30')]:_0x15b3f4['model'];if(_0x49f46f[_0x7c94('0x2c')][_0x7c94('0x3e')]){_0x319551[_0x7c94('0x3f')]=[{'all':!![]}];}_0x319551=_[_0x7c94('0x3a')]({},_0x319551,_0x49f46f[_0x7c94('0x3c')]);return db['WhatsappApplication']['find'](_0x319551)[_0x7c94('0x21')](handleEntityNotFound(_0x43c9da,null))[_0x7c94('0x21')](respondWithResult(_0x43c9da,null))['catch'](handleError(_0x43c9da,null));};exports[_0x7c94('0x43')]=function(_0x5e995a,_0x1163d3){return db[_0x7c94('0x27')][_0x7c94('0x43')](_0x5e995a[_0x7c94('0x44')],{})['then'](respondWithResult(_0x1163d3,0xc9))[_0x7c94('0x41')](handleError(_0x1163d3,null));};exports[_0x7c94('0x20')]=function(_0x7a4c5c,_0x24095c){if(_0x7a4c5c[_0x7c94('0x44')]['id']){delete _0x7a4c5c[_0x7c94('0x44')]['id'];}return db[_0x7c94('0x27')][_0x7c94('0x45')]({'where':{'id':_0x7a4c5c[_0x7c94('0x46')]['id']}})['then'](handleEntityNotFound(_0x24095c,null))[_0x7c94('0x21')](saveUpdates(_0x7a4c5c[_0x7c94('0x44')],null))[_0x7c94('0x21')](respondWithResult(_0x24095c,null))[_0x7c94('0x41')](handleError(_0x24095c,null));};exports['destroy']=function(_0x4f3d3a,_0x1ddbcb){return db['WhatsappApplication']['find']({'where':{'id':_0x4f3d3a[_0x7c94('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ddbcb,null))[_0x7c94('0x21')](removeEntity(_0x1ddbcb,null))[_0x7c94('0x41')](handleError(_0x1ddbcb,null));}; \ No newline at end of file +var _0x5913=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','fields','merge','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x5913,0x10e));var _0x3591=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5913[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x3591('0x0'));var emlformat=require(_0x3591('0x1'));var rimraf=require(_0x3591('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3591('0x3'));var rp=require(_0x3591('0x4'));var moment=require(_0x3591('0x5'));var BPromise=require(_0x3591('0x6'));var Mustache=require(_0x3591('0x7'));var util=require(_0x3591('0x8'));var path=require(_0x3591('0x9'));var sox=require(_0x3591('0xa'));var csv=require(_0x3591('0xb'));var ejs=require(_0x3591('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3591('0xd'));var deskjs=require(_0x3591('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3591('0xf'));var Papa=require(_0x3591('0x10'));var Redis=require(_0x3591('0x11'));var authService=require(_0x3591('0x12'));var qs=require(_0x3591('0x13'));var as=require(_0x3591('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3591('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x416a7f,_0x24535c){_0x24535c=_0x24535c||0xcc;return function(_0x2699e4){if(_0x2699e4){return _0x416a7f[_0x3591('0x16')](_0x24535c);}return _0x416a7f[_0x3591('0x17')](_0x24535c)['end']();};}function respondWithResult(_0x262192,_0xc96c92){_0xc96c92=_0xc96c92||0xc8;return function(_0x3ab08e){if(_0x3ab08e){return _0x262192['status'](_0xc96c92)[_0x3591('0x18')](_0x3ab08e);}};}function respondWithFilteredResult(_0x19605f,_0x16fa4f){return function(_0x1a5bca){if(_0x1a5bca){var _0x1cf090=_0x1a5bca[_0x3591('0x19')],_0x51dfaf=_0x16fa4f['offset'],_0x1e61b2=_0x16fa4f[_0x3591('0x1a')]+_0x16fa4f[_0x3591('0x1b')],_0x21e92e;if(_0x1e61b2>=_0x1cf090){_0x1e61b2=_0x1cf090;_0x21e92e=0xc8;}else{_0x21e92e=0xce;}_0x19605f[_0x3591('0x17')](_0x21e92e);return _0x19605f[_0x3591('0x1c')](_0x3591('0x1d'),_0x51dfaf+'-'+_0x1e61b2+'/'+_0x1cf090)[_0x3591('0x18')](_0x1a5bca);}return null;};}function patchUpdates(_0x4ddf72){return function(_0x11b13e){try{jsonpatch[_0x3591('0x1e')](_0x11b13e,_0x4ddf72,!![]);}catch(_0x5e60a2){return BPromise['reject'](_0x5e60a2);}return _0x11b13e['save']();};}function saveUpdates(_0x1f6b85,_0x287eae){return function(_0x7a979d){if(_0x7a979d){return _0x7a979d[_0x3591('0x1f')](_0x1f6b85)[_0x3591('0x20')](function(_0x231124){return _0x231124;});}return null;};}function removeEntity(_0x51b04b,_0x3a98c3){return function(_0x310e2a){if(_0x310e2a){return _0x310e2a[_0x3591('0x21')]()[_0x3591('0x20')](function(){_0x51b04b[_0x3591('0x17')](0xcc)[_0x3591('0x22')]();});}};}function handleEntityNotFound(_0xfc9e6f,_0x4c3510){return function(_0x4b899f){if(!_0x4b899f){_0xfc9e6f[_0x3591('0x16')](0x194);}return _0x4b899f;};}function handleError(_0x5dbbfb,_0x546ac3){_0x546ac3=_0x546ac3||0x1f4;return function(_0x231b98){logger[_0x3591('0x23')](_0x231b98[_0x3591('0x24')]);if(_0x231b98[_0x3591('0x25')]){delete _0x231b98['name'];}_0x5dbbfb[_0x3591('0x17')](_0x546ac3)[_0x3591('0x26')](_0x231b98);};}exports[_0x3591('0x27')]=function(_0x17c9dd,_0x447b8d){var _0x151a24={},_0x5cd98c={},_0x4c503b={'count':0x0,'rows':[]};var _0x4d61e7=_[_0x3591('0x28')](db[_0x3591('0x29')][_0x3591('0x2a')],function(_0x763d7f){return{'name':_0x763d7f[_0x3591('0x2b')],'type':_0x763d7f[_0x3591('0x2c')]['key']};});_0x5cd98c['model']=_[_0x3591('0x28')](_0x4d61e7,_0x3591('0x25'));_0x5cd98c[_0x3591('0x2d')]=_['keys'](_0x17c9dd[_0x3591('0x2d')]);_0x5cd98c[_0x3591('0x2e')]=_['intersection'](_0x5cd98c[_0x3591('0x2f')],_0x5cd98c[_0x3591('0x2d')]);_0x151a24[_0x3591('0x30')]=_[_0x3591('0x31')](_0x5cd98c[_0x3591('0x2f')],qs['fields'](_0x17c9dd['query']['fields']));_0x151a24[_0x3591('0x30')]=_0x151a24['attributes'][_0x3591('0x32')]?_0x151a24[_0x3591('0x30')]:_0x5cd98c[_0x3591('0x2f')];if(!_0x17c9dd[_0x3591('0x2d')][_0x3591('0x33')](_0x3591('0x34'))){_0x151a24[_0x3591('0x1b')]=qs[_0x3591('0x1b')](_0x17c9dd[_0x3591('0x2d')][_0x3591('0x1b')]);_0x151a24[_0x3591('0x1a')]=qs[_0x3591('0x1a')](_0x17c9dd[_0x3591('0x2d')][_0x3591('0x1a')]);}_0x151a24[_0x3591('0x35')]=qs[_0x3591('0x36')](_0x17c9dd[_0x3591('0x2d')]['sort']);_0x151a24[_0x3591('0x37')]=qs[_0x3591('0x2e')](_[_0x3591('0x38')](_0x17c9dd[_0x3591('0x2d')],_0x5cd98c['filters']),_0x4d61e7);if(_0x17c9dd['query']['filter']){_0x151a24[_0x3591('0x37')]=_['merge'](_0x151a24[_0x3591('0x37')],{'$or':_['map'](_0x4d61e7,function(_0x14aadd){if(_0x14aadd['type']!==_0x3591('0x39')){var _0x506e57={};_0x506e57[_0x14aadd[_0x3591('0x25')]]={'$like':'%'+_0x17c9dd[_0x3591('0x2d')][_0x3591('0x3a')]+'%'};return _0x506e57;}})});}_0x151a24=_['merge']({},_0x151a24,_0x17c9dd[_0x3591('0x3b')]);var _0x280f14={'where':_0x151a24[_0x3591('0x37')]};return db[_0x3591('0x29')][_0x3591('0x19')](_0x280f14)['then'](function(_0x95cbda){_0x4c503b[_0x3591('0x19')]=_0x95cbda;if(_0x17c9dd[_0x3591('0x2d')][_0x3591('0x3c')]){_0x151a24[_0x3591('0x3d')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x3591('0x3e')](_0x151a24);})[_0x3591('0x20')](function(_0x483c2b){_0x4c503b[_0x3591('0x3f')]=_0x483c2b;return _0x4c503b;})['then'](respondWithFilteredResult(_0x447b8d,_0x151a24))[_0x3591('0x40')](handleError(_0x447b8d,null));};exports['show']=function(_0x288abf,_0x1c9f49){var _0x417f04={'raw':!![],'where':{'id':_0x288abf[_0x3591('0x41')]['id']}},_0x35395f={};_0x35395f[_0x3591('0x2f')]=_['keys'](db['WhatsappApplication'][_0x3591('0x2a')]);_0x35395f[_0x3591('0x2d')]=_['keys'](_0x288abf[_0x3591('0x2d')]);_0x35395f[_0x3591('0x2e')]=_[_0x3591('0x31')](_0x35395f[_0x3591('0x2f')],_0x35395f[_0x3591('0x2d')]);_0x417f04[_0x3591('0x30')]=_[_0x3591('0x31')](_0x35395f['model'],qs['fields'](_0x288abf[_0x3591('0x2d')][_0x3591('0x42')]));_0x417f04[_0x3591('0x30')]=_0x417f04['attributes'][_0x3591('0x32')]?_0x417f04[_0x3591('0x30')]:_0x35395f['model'];if(_0x288abf[_0x3591('0x2d')][_0x3591('0x3c')]){_0x417f04[_0x3591('0x3d')]=[{'all':!![]}];}_0x417f04=_[_0x3591('0x43')]({},_0x417f04,_0x288abf['options']);return db[_0x3591('0x29')][_0x3591('0x44')](_0x417f04)[_0x3591('0x20')](handleEntityNotFound(_0x1c9f49,null))[_0x3591('0x20')](respondWithResult(_0x1c9f49,null))[_0x3591('0x40')](handleError(_0x1c9f49,null));};exports[_0x3591('0x45')]=function(_0x4b1324,_0xe4294b){return db['WhatsappApplication'][_0x3591('0x45')](_0x4b1324['body'],{})[_0x3591('0x20')](respondWithResult(_0xe4294b,0xc9))['catch'](handleError(_0xe4294b,null));};exports[_0x3591('0x1f')]=function(_0x4cd92d,_0x2b62b5){if(_0x4cd92d[_0x3591('0x46')]['id']){delete _0x4cd92d[_0x3591('0x46')]['id'];}return db[_0x3591('0x29')]['find']({'where':{'id':_0x4cd92d[_0x3591('0x41')]['id']}})[_0x3591('0x20')](handleEntityNotFound(_0x2b62b5,null))[_0x3591('0x20')](saveUpdates(_0x4cd92d[_0x3591('0x46')],null))[_0x3591('0x20')](respondWithResult(_0x2b62b5,null))[_0x3591('0x40')](handleError(_0x2b62b5,null));};exports[_0x3591('0x21')]=function(_0x29e604,_0x3546e5){return db['WhatsappApplication'][_0x3591('0x44')]({'where':{'id':_0x29e604[_0x3591('0x41')]['id']}})['then'](handleEntityNotFound(_0x3546e5,null))[_0x3591('0x20')](removeEntity(_0x3546e5,null))['catch'](handleError(_0x3546e5,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index c79e6e4..52494dc 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 _0xbd99=['util','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0xbd99,0x1df));var _0x9bd9=function(_0x42072c,_0x117b1d){_0x42072c=_0x42072c-0x0;var _0x11ca18=_0xbd99[_0x42072c];return _0x11ca18;};'use strict';var _=require(_0x9bd9('0x0'));var util=require(_0x9bd9('0x1'));var logger=require('../../config/logger')(_0x9bd9('0x2'));var moment=require(_0x9bd9('0x3'));var BPromise=require('bluebird');var rp=require(_0x9bd9('0x4'));var fs=require('fs');var path=require(_0x9bd9('0x5'));var rimraf=require(_0x9bd9('0x6'));var config=require(_0x9bd9('0x7'));var attributes=require(_0x9bd9('0x8'));module[_0x9bd9('0x9')]=function(_0x111a1c,_0x4be10e){return _0x111a1c[_0x9bd9('0xa')](_0x9bd9('0xb'),attributes,{'tableName':_0x9bd9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9bd9('0xd'),'collate':_0x9bd9('0xe')});}; \ No newline at end of file +var _0xae60=['../../config/environment','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x2f394d,_0xd986cb){var _0x2f4dcd=function(_0x2db6bd){while(--_0x2db6bd){_0x2f394d['push'](_0x2f394d['shift']());}};_0x2f4dcd(++_0xd986cb);}(_0xae60,0x1c7));var _0x0ae6=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xae60[_0xb24a3e];return _0x4038d7;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var logger=require(_0x0ae6('0x2'))('api');var moment=require(_0x0ae6('0x3'));var BPromise=require(_0x0ae6('0x4'));var rp=require(_0x0ae6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ae6('0x6'));var config=require(_0x0ae6('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0x0ae6('0x8')]=function(_0x25ac7c,_0x30e000){return _0x25ac7c[_0x0ae6('0x9')](_0x0ae6('0xa'),attributes,{'tableName':_0x0ae6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0ae6('0xc'),'collate':_0x0ae6('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 48331fe..d267192 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 _0x723e=['WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0x35baae,_0x2f15da){var _0x5720a1=function(_0x38e725){while(--_0x38e725){_0x35baae['push'](_0x35baae['shift']());}};_0x5720a1(++_0x2f15da);}(_0x723e,0x179));var _0xe723=function(_0x3a70f0,_0xfcc97){_0x3a70f0=_0x3a70f0-0x0;var _0x1d69b9=_0x723e[_0x3a70f0];return _0x1d69b9;};'use strict';var _=require('lodash');var util=require(_0xe723('0x0'));var moment=require(_0xe723('0x1'));var BPromise=require(_0xe723('0x2'));var rs=require(_0xe723('0x3'));var fs=require('fs');var Redis=require(_0xe723('0x4'));var db=require(_0xe723('0x5'))['db'];var utils=require(_0xe723('0x6'));var logger=require(_0xe723('0x7'))(_0xe723('0x8'));var config=require(_0xe723('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe723('0xa')][_0xe723('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1335cd,_0x3bf082,_0x2aebbd){return new BPromise(function(_0xe50f7,_0x1b46e0){return client[_0xe723('0xc')](_0x1335cd,_0x2aebbd)['then'](function(_0x380444){logger[_0xe723('0xd')](_0xe723('0xe'),_0x3bf082,'request\x20sent');logger[_0xe723('0xf')](_0xe723('0x10'),_0x3bf082,_0xe723('0x11'),JSON['stringify'](_0x380444));if(_0x380444[_0xe723('0x12')]){if(_0x380444[_0xe723('0x12')][_0xe723('0x13')]===0x1f4){logger[_0xe723('0x12')](_0xe723('0xe'),_0x3bf082,_0x380444['error'][_0xe723('0x14')]);return _0x1b46e0(_0x380444['error']['message']);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x3bf082,_0x380444[_0xe723('0x12')][_0xe723('0x14')]);return _0xe50f7(_0x380444[_0xe723('0x12')][_0xe723('0x14')]);}else{logger[_0xe723('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x3bf082,_0xe723('0x11'));_0xe50f7(_0x380444[_0xe723('0x15')][_0xe723('0x14')]);}})[_0xe723('0x16')](function(_0x347fa0){logger[_0xe723('0x12')](_0xe723('0xe'),_0x3bf082,_0x347fa0);_0x1b46e0(_0x347fa0);});});} \ No newline at end of file +var _0xf69d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappApplication,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xb49cb8,_0x39474b){var _0x879ead=function(_0x596639){while(--_0x596639){_0xb49cb8['push'](_0xb49cb8['shift']());}};_0x879ead(++_0x39474b);}(_0xf69d,0xd3));var _0xdf69=function(_0x3c0bbf,_0x5d7052){_0x3c0bbf=_0x3c0bbf-0x0;var _0x2bac03=_0xf69d[_0x3c0bbf];return _0x2bac03;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var moment=require(_0xdf69('0x2'));var BPromise=require(_0xdf69('0x3'));var rs=require(_0xdf69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf69('0x5'))['db'];var utils=require(_0xdf69('0x6'));var logger=require(_0xdf69('0x7'))(_0xdf69('0x8'));var config=require(_0xdf69('0x9'));var jayson=require(_0xdf69('0xa'));var client=jayson[_0xdf69('0xb')][_0xdf69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d2501,_0x12c186,_0x18a08e){return new BPromise(function(_0xc1b77e,_0x38909e){return client[_0xdf69('0xd')](_0x1d2501,_0x18a08e)[_0xdf69('0xe')](function(_0x211ea9){logger[_0xdf69('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x12c186,_0xdf69('0x10'));logger[_0xdf69('0x11')](_0xdf69('0x12'),_0x12c186,_0xdf69('0x10'),JSON[_0xdf69('0x13')](_0x211ea9));if(_0x211ea9[_0xdf69('0x14')]){if(_0x211ea9['error']['code']===0x1f4){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x12c186,_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);return _0x38909e(_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);}logger[_0xdf69('0x14')](_0xdf69('0x16'),_0x12c186,_0x211ea9['error'][_0xdf69('0x15')]);return _0xc1b77e(_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);}else{logger[_0xdf69('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x12c186,_0xdf69('0x10'));_0xc1b77e(_0x211ea9['result'][_0xdf69('0x15')]);}})[_0xdf69('0x17')](function(_0x5263a4){logger[_0xdf69('0x14')](_0xdf69('0x16'),_0x12c186,_0x5263a4);_0x38909e(_0x5263a4);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 1187c50..71486ea 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 _0x623e=['whatsapp','whatsappinteraction:addtags','addTags','put','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','/describe','describe','get','/:id','getMessages','/:id/download','download','post','/:id/messages','addMessage','tracked'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x623e,0x65));var _0xe623=function(_0x1221df,_0x358abb){_0x1221df=_0x1221df-0x0;var _0x38eff4=_0x623e[_0x1221df];return _0x38eff4;};'use strict';var multer=require(_0xe623('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe623('0x1'));var express=require('express');var router=express[_0xe623('0x2')]();var auth=require(_0xe623('0x3'));var interaction=require(_0xe623('0x4'));var config=require(_0xe623('0x5'));var controller=require(_0xe623('0x6'));router['get']('/',auth[_0xe623('0x7')](),controller['index']);router['get'](_0xe623('0x8'),auth[_0xe623('0x7')](),controller[_0xe623('0x9')]);router[_0xe623('0xa')](_0xe623('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe623('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0xe623('0xc')]);router[_0xe623('0xa')](_0xe623('0xd'),auth[_0xe623('0x7')](),controller[_0xe623('0xe')]);router[_0xe623('0xf')]('/',auth[_0xe623('0x7')](),controller['create']);router['post'](_0xe623('0x10'),auth[_0xe623('0x7')](),controller[_0xe623('0x11')]);router[_0xe623('0xf')]('/:id/tags',auth[_0xe623('0x7')](),interaction[_0xe623('0x12')](_0xe623('0x13'),_0xe623('0x14')),controller[_0xe623('0x15')]);router[_0xe623('0x16')]('/:id',auth[_0xe623('0x7')](),interaction[_0xe623('0x12')]('whatsapp','whatsappinteraction:update'),controller[_0xe623('0x17')]);router[_0xe623('0x18')](_0xe623('0xb'),auth[_0xe623('0x7')](),interaction[_0xe623('0x12')]('whatsapp',_0xe623('0x19')),controller[_0xe623('0x1a')]);router['delete'](_0xe623('0x1b'),auth[_0xe623('0x7')](),controller[_0xe623('0x1c')]);module[_0xe623('0x1d')]=router; \ No newline at end of file +var _0x2090=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','exports'];(function(_0x36ad26,_0x2c4af6){var _0x59daa0=function(_0x3076db){while(--_0x3076db){_0x36ad26['push'](_0x36ad26['shift']());}};_0x59daa0(++_0x2c4af6);}(_0x2090,0xae));var _0x0209=function(_0x106590,_0x20cf3e){_0x106590=_0x106590-0x0;var _0x13b71c=_0x2090[_0x106590];return _0x13b71c;};'use strict';var multer=require('multer');var util=require(_0x0209('0x0'));var path=require(_0x0209('0x1'));var timeout=require('connect-timeout');var express=require(_0x0209('0x2'));var router=express[_0x0209('0x3')]();var auth=require(_0x0209('0x4'));var interaction=require(_0x0209('0x5'));var config=require(_0x0209('0x6'));var controller=require('./whatsappInteraction.controller');router[_0x0209('0x7')]('/',auth['isAuthenticated'](),controller[_0x0209('0x8')]);router[_0x0209('0x7')]('/describe',auth[_0x0209('0x9')](),controller['describe']);router[_0x0209('0x7')](_0x0209('0xa'),auth[_0x0209('0x9')](),controller['show']);router[_0x0209('0x7')](_0x0209('0xb'),auth[_0x0209('0x9')](),controller[_0x0209('0xc')]);router[_0x0209('0x7')](_0x0209('0xd'),auth['isAuthenticated'](),controller[_0x0209('0xe')]);router['post']('/',auth[_0x0209('0x9')](),controller['create']);router[_0x0209('0xf')](_0x0209('0xb'),auth[_0x0209('0x9')](),controller[_0x0209('0x10')]);router['post']('/:id/tags',auth[_0x0209('0x9')](),interaction[_0x0209('0x11')]('whatsapp',_0x0209('0x12')),controller[_0x0209('0x13')]);router[_0x0209('0x14')](_0x0209('0xa'),auth[_0x0209('0x9')](),interaction[_0x0209('0x11')](_0x0209('0x15'),_0x0209('0x16')),controller['update']);router[_0x0209('0x17')](_0x0209('0xa'),auth[_0x0209('0x9')](),interaction[_0x0209('0x11')]('whatsapp',_0x0209('0x18')),controller[_0x0209('0x19')]);router[_0x0209('0x17')](_0x0209('0x1a'),auth[_0x0209('0x9')](),controller[_0x0209('0x1b')]);module[_0x0209('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 4793e2b..44e9262 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 _0xed66=['sequelize','moment','exports','BOOLEAN','DATE','STRING','out'];(function(_0x4185d0,_0x326106){var _0x4a12a2=function(_0x3cace1){while(--_0x3cace1){_0x4185d0['push'](_0x4185d0['shift']());}};_0x4a12a2(++_0x326106);}(_0xed66,0x8c));var _0x6ed6=function(_0x1ecbad,_0xe90ac4){_0x1ecbad=_0x1ecbad-0x0;var _0x50fe57=_0xed66[_0x1ecbad];return _0x50fe57;};'use strict';var Sequelize=require(_0x6ed6('0x0'));var moment=require(_0x6ed6('0x1'));module[_0x6ed6('0x2')]={'closed':{'type':Sequelize[_0x6ed6('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6ed6('0x4')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6ed6('0x5')]},'phone':{'type':Sequelize[_0x6ed6('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6ed6('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6ed6('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6ed6('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xeee3=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xeee3,0x1e5));var _0x3eee=function(_0x37437e,_0x5ebc8d){_0x37437e=_0x37437e-0x0;var _0x5ade52=_0xeee3[_0x37437e];return _0x5ade52;};'use strict';var Sequelize=require(_0x3eee('0x0'));var moment=require(_0x3eee('0x1'));module[_0x3eee('0x2')]={'closed':{'type':Sequelize[_0x3eee('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3eee('0x4')]},'disposition':{'type':Sequelize[_0x3eee('0x5')]},'note':{'type':Sequelize[_0x3eee('0x5')]},'phone':{'type':Sequelize[_0x3eee('0x5')]},'read1stAt':{'type':Sequelize[_0x3eee('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3eee('0x6')]('in',_0x3eee('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3eee('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x3eee('0x6')]('in',_0x3eee('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index a4e6b10..67378e2 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(_0x3a91d7,_0x248251){var _0x1880bd=function(_0x583767){while(--_0x583767){_0x3a91d7['push'](_0x3a91d7['shift']());}};_0x1880bd(++_0x248251);}(_0x814b,0x1a2));var _0xb814=function(_0x38e177,_0x59ec9f){_0x38e177=_0x38e177-0x0;var _0x1faf15=_0x814b[_0x38e177];return _0x1faf15;};'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 _0xadb5=['field','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','find','UserId','buildExpression','start','body','keys','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','catch','show','params','includeAll','include','merge','options','create','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','findAll','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','N.A.','closed','disposition','basename','createReadStream','createWriteStream','direction','out','System','renderFile','views','downloadInteraction.html','toFile','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','WhatsappInteraction','rawAttributes','type','key','query','intersection','model','attributes','fields','length','limit','order','sort','filters','pick','select'];(function(_0x4546d8,_0x452155){var _0x20f0e7=function(_0x5a9951){while(--_0x5a9951){_0x4546d8['push'](_0x4546d8['shift']());}};_0x20f0e7(++_0x452155);}(_0xadb5,0xad));var _0x5adb=function(_0x1b85a3,_0x37d8f7){_0x1b85a3=_0x1b85a3-0x0;var _0x669abc=_0xadb5[_0x1b85a3];return _0x669abc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var db=require(_0x5adb('0x17'))['db'];config['redis']=_[_0x5adb('0x18')](config['redis'],{'host':_0x5adb('0x19'),'port':0x18eb});var socket=require(_0x5adb('0x1a'))(new Redis(config[_0x5adb('0x1b')]));require('./whatsappInteraction.socket')[_0x5adb('0x1c')](socket);function respondWithStatusCode(_0x34af2c,_0xf82f72){_0xf82f72=_0xf82f72||0xcc;return function(_0x5263ec){if(_0x5263ec){return _0x34af2c[_0x5adb('0x1d')](_0xf82f72);}return _0x34af2c['status'](_0xf82f72)[_0x5adb('0x1e')]();};}function respondWithResult(_0x42a482,_0x30614e){_0x30614e=_0x30614e||0xc8;return function(_0x304784){if(_0x304784){return _0x42a482[_0x5adb('0x1f')](_0x30614e)[_0x5adb('0x20')](_0x304784);}};}function respondWithFilteredResult(_0xa29dc,_0x42f4c6){return function(_0xb953a6){if(_0xb953a6){var _0x529b65=_0xb953a6['count'],_0x3fff62=_0x42f4c6[_0x5adb('0x21')],_0x5de028=_0x42f4c6['offset']+_0x42f4c6['limit'],_0x1d9e86;if(_0x5de028>=_0x529b65){_0x5de028=_0x529b65;_0x1d9e86=0xc8;}else{_0x1d9e86=0xce;}_0xa29dc[_0x5adb('0x1f')](_0x1d9e86);return _0xa29dc[_0x5adb('0x22')](_0x5adb('0x23'),_0x3fff62+'-'+_0x5de028+'/'+_0x529b65)[_0x5adb('0x20')](_0xb953a6);}return null;};}function patchUpdates(_0x99bc6c){return function(_0x5af69d){try{jsonpatch[_0x5adb('0x24')](_0x5af69d,_0x99bc6c,!![]);}catch(_0x5c296e){return BPromise['reject'](_0x5c296e);}return _0x5af69d[_0x5adb('0x25')]();};}function saveUpdates(_0x379b33,_0x1a38d3){return function(_0x1a8014){if(_0x1a8014){return _0x1a8014[_0x5adb('0x26')](_0x379b33)[_0x5adb('0x27')](function(_0xfd9bb9){return _0xfd9bb9;});}return null;};}function removeEntity(_0x4ca150,_0x4b1957){return function(_0x373cc3){if(_0x373cc3){return _0x373cc3[_0x5adb('0x28')]()[_0x5adb('0x27')](function(){_0x4ca150[_0x5adb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fee18,_0x2e1e63){return function(_0x5aed76){if(!_0x5aed76){_0x2fee18[_0x5adb('0x1d')](0x194);}return _0x5aed76;};}function handleError(_0x1ded9f,_0x1a0acd){_0x1a0acd=_0x1a0acd||0x1f4;return function(_0x55b40a){logger[_0x5adb('0x29')](_0x55b40a[_0x5adb('0x2a')]);if(_0x55b40a[_0x5adb('0x2b')]){delete _0x55b40a[_0x5adb('0x2b')];}_0x1ded9f[_0x5adb('0x1f')](_0x1a0acd)[_0x5adb('0x2c')](_0x55b40a);};}function getInteractionUsers(_0x4a5d46,_0x49992e){return new BPromise(function(_0x5d457e,_0x39bddd){try{if(_0x49992e[_0x4a5d46['id']]){_0x4a5d46[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x49992e[_0x4a5d46['id']],function(_0x512bab){return{'id':_0x512bab['id'],'fullname':_0x512bab[_0x5adb('0x2f')]};});}}catch(_0x4de310){_0x39bddd(_0x4de310);}_0x5d457e(_0x4a5d46);});}function getInteractionTags(_0x11ec2a,_0x34b793){return new BPromise(function(_0x372da1,_0x3b1fed){try{if(_0x11ec2a[_0x5adb('0x30')]){_0x11ec2a[_0x5adb('0x31')]=[];_0x11ec2a[_0x5adb('0x30')][_0x5adb('0x32')](',')[_0x5adb('0x33')](function(_0x260295){_0x11ec2a['Tags'][_0x5adb('0x34')](_0x34b793[_0x260295]);});}delete _0x11ec2a['TagIds'];}catch(_0x12424d){_0x3b1fed(_0x12424d);}_0x372da1(_0x11ec2a);});}function updateWhatsappInteraction(_0x20cde6,_0x5d1441,_0x226390){return new BPromise(function(_0xe389ca,_0x461a39){return getInteractionUsers(_0x20cde6,_0x226390)['then'](function(_0x173789){return getInteractionTags(_0x173789,_0x5d1441);})[_0x5adb('0x27')](function(_0x4b5887){_0xe389ca(_0x4b5887);})['catch'](function(_0x1ed9ea){_0x461a39(_0x1ed9ea);});});}exports['index']=function(_0x663ea0,_0x222568){var _0x3c2b07={},_0x2da912={},_0x9bdece={'count':0x0,'rows':[]};var _0x5ece39=_[_0x5adb('0x2e')](db[_0x5adb('0x35')][_0x5adb('0x36')],function(_0x54851b){return{'name':_0x54851b['fieldName'],'type':_0x54851b[_0x5adb('0x37')][_0x5adb('0x38')]};});_0x2da912['model']=_[_0x5adb('0x2e')](_0x5ece39,'name');_0x2da912[_0x5adb('0x39')]=_['keys'](_0x663ea0[_0x5adb('0x39')]);_0x2da912['filters']=_[_0x5adb('0x3a')](_0x2da912[_0x5adb('0x3b')],_0x2da912['query']);_0x3c2b07[_0x5adb('0x3c')]=_['intersection'](_0x2da912[_0x5adb('0x3b')],qs[_0x5adb('0x3d')](_0x663ea0[_0x5adb('0x39')]['fields']));_0x3c2b07[_0x5adb('0x3c')]=_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x3c2b07[_0x5adb('0x3c')]:_0x2da912[_0x5adb('0x3b')];if(!_0x663ea0['query']['hasOwnProperty']('nolimit')){_0x3c2b07['limit']=qs[_0x5adb('0x3f')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3f')]);_0x3c2b07[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x3c2b07[_0x5adb('0x40')]=qs['sort'](_0x663ea0['query'][_0x5adb('0x41')]);_0x3c2b07['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x663ea0[_0x5adb('0x39')],_0x2da912[_0x5adb('0x42')]),_0x5ece39);var _0xdfecfd=[];var _0x522ee5=squel[_0x5adb('0x44')]()[_0x5adb('0x45')]('id')['field'](_0x5adb('0x2b'))[_0x5adb('0x45')]('color')[_0x5adb('0x46')](_0x5adb('0x47'));var _0x1d6bef=squel[_0x5adb('0x44')]()[_0x5adb('0x45')](_0x5adb('0x48'))[_0x5adb('0x45')]('u.fullname')['field'](_0x5adb('0x49'))[_0x5adb('0x46')](_0x5adb('0x4a'),'ui')[_0x5adb('0x4b')]('users','u','u.id\x20=\x20ui.UserId');var _0xaa32e4=squel[_0x5adb('0x44')]()[_0x5adb('0x46')](_0x5adb('0x4c'),'i')[_0x5adb('0x4b')]('cm_contacts','c',_0x5adb('0x4d'))[_0x5adb('0x4b')]('users','o',_0x5adb('0x4e'))[_0x5adb('0x4b')](_0x5adb('0x4f'),'a',_0x5adb('0x50'))[_0x5adb('0x4b')](_0x5adb('0x51'),'me',_0x5adb('0x52'))[_0x5adb('0x4b')]('whatsapp_interaction_has_tags','it',_0x5adb('0x53'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3cd211=squel[_0x5adb('0x54')]();var _0x207a81=[];var _0x4ba0b5=squel[_0x5adb('0x54')]();var _0x5cbab5;if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x55')]){_0x5cbab5=as[_0x5adb('0x56')](_0x663ea0['query'][_0x5adb('0x55')]);var _0x560bac=_0x5cbab5[_0x5adb('0x57')];for(var _0x6dc067=0x0;_0x6dc067<_0x5cbab5['conditions'][_0x5adb('0x3e')];_0x6dc067++){var _0x1ab97b=_0x5cbab5[_0x5adb('0x58')][_0x6dc067];var _0x101008='i';var _0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x1ab97b[_0x5adb('0x45')]]);if(!_0x372734){switch(_0x1ab97b[_0x5adb('0x45')]){case _0x5adb('0x59'):if(_0x1ab97b['value']==0x1){_0xaa32e4[_0x5adb('0x5a')]('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5b'));}else{_0xaa32e4['having']('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5c'));}break;case _0x5adb('0x5d'):if(_0x1ab97b[_0x5adb('0x5e')]==='$substring'){if(_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')]('\x20')[_0x5adb('0x3e')]>0x1){_0x3cd211[_0x560bac](_0x5adb('0x60'),qs[_0x5adb('0x61')](_0x1ab97b['value']),null);}else{var _0x378938='%'+_0x1ab97b['value']+'%';_0x3cd211[_0x560bac](_0x5adb('0x62'),_0x378938,_0x378938,_0x378938);}}else{_0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x63')]);_0x1ab97b[_0x5adb('0x45')]=_0x5adb('0x63');_0x836b91=as['buildExpression'](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')]['start'],_0x836b91['value']['end']);}break;case _0x5adb('0x65'):var _0x31a1f9=_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')](',')[_0x5adb('0x2e')](function(_0xb06bee){return Number(_0xb06bee);});_0x31a1f9[_0x5adb('0x33')](function(_0x8d7810){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x8d7810+',%');});_0x207a81=_[_0x5adb('0x67')](_0x207a81,_0x31a1f9);break;case _0x5adb('0x68'):if(_0x1ab97b[_0x5adb('0x5e')]===_0x5adb('0x69')){_0x3cd211[_0x560bac]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1ab97b['value']+'%',null);}else{_0x372734=_[_0x5adb('0x6a')](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x6b')]);_0x1ab97b[_0x5adb('0x45')]='UserId';_0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}break;case _0x5adb('0x6e'):_0x836b91=as[_0x5adb('0x6c')]('me',null,_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);break;}}else{var _0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}}}else{var _0x7287ac=_(_0x663ea0['query'])[_0x5adb('0x6f')]()[_0x5adb('0x2e')](function(_0x24e1ab){return _['some'](_0x5ece39,[_0x5adb('0x2b'),_0x24e1ab])?_0x24e1ab:undefined;})[_0x5adb('0x70')]()['value']();if(!_[_0x5adb('0x71')](_0x7287ac)){_0x7287ac[_0x5adb('0x33')](function(_0x248739){if(_0x248739===_0x5adb('0x72')){_0xaa32e4['where'](_0x5adb('0x73'),[][_0x5adb('0x74')](_0x663ea0[_0x5adb('0x39')][_0x248739]));}else if(_0x248739===_0x5adb('0x75')){var _0x5b7556=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])['$gte'];var _0x4d635f=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])[_0x5adb('0x76')];_0xaa32e4['where'](_0x5adb('0x77'),_0x5b7556,_0x4d635f);}else{if(_0x663ea0[_0x5adb('0x39')][_0x248739]===_0x5adb('0x78')){_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7a'));}else{_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7b'),_0x663ea0[_0x5adb('0x39')][_0x248739]);}}});}if(_0x663ea0['query']['read']){if(_0x663ea0['query'][_0x5adb('0x7c')]==0x1){_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7d'));}else{_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7e'));}}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]){_0x207a81=_[_0x5adb('0x80')](_0x663ea0['query']['tag'])?_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]:new Array(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]);_0x207a81[_0x5adb('0x33')](function(_0x335de5){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x335de5+',%');});}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x81')]){var _0x3b5ecf=_0x663ea0['query'][_0x5adb('0x81')][_0x5adb('0x82')]('\x5c','\x5c\x5c')[_0x5adb('0x82')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x5adb('0x83')](_0x3b5ecf)){_0x3cd211['or'](_0x5adb('0x84'),_0x3b5ecf+'%')['or']('i.phone\x20LIKE\x20?',_0x3b5ecf+'%');}else{_0x3cd211['or'](_0x5adb('0x85'),qs['getFullTextValue'](_0x3b5ecf))['or'](_0x5adb('0x86'),_0x3b5ecf+'%');}}}_0xaa32e4[_0x5adb('0x79')](_0x3cd211);_0xaa32e4['group'](_0x5adb('0x87'));var _0x1ceb72={'type':db[_0x5adb('0x88')][_0x5adb('0x89')][_0x5adb('0x8a')],'raw':!![]};var _0x10f54a=_0xaa32e4[_0x5adb('0x8b')]();_0x10f54a[_0x5adb('0x45')]('i.id');_0x10f54a[_0x5adb('0x45')](_0x5adb('0x8c'),_0x5adb('0x59'));if(_0x3c2b07['order']){_0x3c2b07['order'][_0x5adb('0x33')](function(_0x4fd8f7){_0xaa32e4[_0x5adb('0x40')]('i.'+_0x4fd8f7[0x0],_0x4fd8f7[0x1]===_0x5adb('0x8d')?![]:!![]);});}if(!_[_0x5adb('0x71')](_0x207a81)){_0xaa32e4['having'](_0x4ba0b5);_0x10f54a[_0x5adb('0x79')](_0x5adb('0x8e'),_0x207a81);}BPromise[_0x5adb('0x8f')]()[_0x5adb('0x27')](function(){if(!_0x5cbab5){if(_0x663ea0[_0x5adb('0x39')]['WhatsappAccountId']||_0x663ea0[_0x5adb('0x39')][_0x5adb('0x90')])return;_0x10f54a[_0x5adb('0x79')](_0x5adb('0x91'));_0xaa32e4['where'](_0x5adb('0x91'));return;}return _0x663ea0[_0x5adb('0x92')][_0x5adb('0x93')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x27')](function(_0x15d4f1){if(_[_0x5adb('0x71')](_0x15d4f1)){_0x10f54a[_0x5adb('0x79')]('i.WhatsappAccountId\x20IS\x20NULL');_0xaa32e4[_0x5adb('0x79')](_0x5adb('0x94'));}else{_0x10f54a['where'](_0x5adb('0x73'),_[_0x5adb('0x2e')](_0x15d4f1,'id'));_0xaa32e4['where'](_0x5adb('0x73'),_['map'](_0x15d4f1,'id'));}});})[_0x5adb('0x27')](function(){db[_0x5adb('0x95')]['query'](_0x10f54a[_0x5adb('0x96')](),_0x1ceb72)['then'](function(_0x2f6415){_0x9bdece[_0x5adb('0x97')]=_0x2f6415[_0x5adb('0x3e')];if(_0x9bdece[_0x5adb('0x97')]===0x0)return[];return db[_0x5adb('0x95')]['query'](_0x522ee5[_0x5adb('0x96')](),_0x1ceb72)[_0x5adb('0x27')](function(_0x3f33c0){_0xdfecfd=_[_0x5adb('0x98')](_0x3f33c0,'id');_0x1ceb72=_['merge'](_0x1ceb72,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3d')]){_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x33')](function(_0x277668){_0xaa32e4[_0x5adb('0x45')]('i.'+_0x277668);});}else{_0xaa32e4[_0x5adb('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5adb('0x59'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x99'),_0x5adb('0x9a'));_0xaa32e4['field'](_0x5adb('0x9b'),_0x5adb('0x9c'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9d'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9e'),_0x5adb('0x9f'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa0'),'Contact.lastName');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa1'),'Contact.email');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa2'),_0x5adb('0xa3'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa4'),_0x5adb('0xa5'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa6'),'Contact.fax');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa7'),'Owner.fullname');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa8'),_0x5adb('0xa9'));_0xaa32e4['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5adb('0x30'));}if(_0x3c2b07[_0x5adb('0x3f')])_0xaa32e4[_0x5adb('0x3f')](_0x3c2b07['limit']);if(_0x3c2b07[_0x5adb('0x21')])_0xaa32e4[_0x5adb('0x21')](_0x3c2b07[_0x5adb('0x21')]);return db[_0x5adb('0x95')][_0x5adb('0x39')](_0xaa32e4[_0x5adb('0x96')](),_0x1ceb72);})[_0x5adb('0x27')](function(_0x463e84){_0x1d6bef[_0x5adb('0x79')](_0x5adb('0xaa'),_[_0x5adb('0x2e')](_0x463e84,'id'));return db[_0x5adb('0x95')]['query'](_0x1d6bef['toString'](),_0x1ceb72)[_0x5adb('0x27')](function(_0x44756a){var _0x5c4053=_[_0x5adb('0xab')](_0x44756a,_0x5adb('0xac'));var _0x38acde=[];_0x463e84[_0x5adb('0x33')](function(_0x13426e){_0x38acde[_0x5adb('0x34')](updateWhatsappInteraction(_0x13426e,_0xdfecfd,_0x5c4053));});return BPromise[_0x5adb('0xad')](_0x38acde);});});})[_0x5adb('0x27')](function(_0x42dddf){_0x9bdece['rows']=_0x42dddf;return _0x9bdece;})[_0x5adb('0x27')](respondWithFilteredResult(_0x222568,_0x3c2b07));})[_0x5adb('0xae')](handleError(_0x222568,null));};exports[_0x5adb('0xaf')]=function(_0x4f0261,_0x312a90){var _0x284f79={'raw':![],'where':{'id':_0x4f0261[_0x5adb('0xb0')]['id']}},_0x2b6e56={};_0x2b6e56[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db['WhatsappInteraction'][_0x5adb('0x36')]);_0x2b6e56[_0x5adb('0x39')]=_[_0x5adb('0x6f')](_0x4f0261[_0x5adb('0x39')]);_0x2b6e56[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x2b6e56[_0x5adb('0x3b')],_0x2b6e56[_0x5adb('0x39')]);_0x284f79[_0x5adb('0x3c')]=_[_0x5adb('0x3a')](_0x2b6e56['model'],qs[_0x5adb('0x3d')](_0x4f0261['query'][_0x5adb('0x3d')]));_0x284f79[_0x5adb('0x3c')]=_0x284f79[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x284f79[_0x5adb('0x3c')]:_0x2b6e56['model'];if(_0x4f0261['query'][_0x5adb('0xb1')]){_0x284f79[_0x5adb('0xb2')]=[{'all':!![]}];}_0x284f79=_[_0x5adb('0xb3')]({},_0x284f79,_0x4f0261[_0x5adb('0xb4')]);return db[_0x5adb('0x35')][_0x5adb('0x6a')](_0x284f79)['then'](handleEntityNotFound(_0x312a90,null))['then'](respondWithResult(_0x312a90,null))[_0x5adb('0xae')](handleError(_0x312a90,null));};exports[_0x5adb('0xb5')]=function(_0x9d80fd,_0x4f5721){return db['WhatsappInteraction'][_0x5adb('0xb5')](_0x9d80fd['body'],{})[_0x5adb('0x27')](respondWithResult(_0x4f5721,0xc9))[_0x5adb('0xae')](handleError(_0x4f5721,null));};exports['update']=function(_0x498ecc,_0x43b91c){if(_0x498ecc['body']['id']){delete _0x498ecc['body']['id'];}return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x498ecc[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x43b91c,null))[_0x5adb('0x27')](saveUpdates(_0x498ecc[_0x5adb('0x6e')],null))[_0x5adb('0x27')](respondWithResult(_0x43b91c,null))[_0x5adb('0xae')](handleError(_0x43b91c,null));};exports[_0x5adb('0x28')]=function(_0x31b696,_0x44cf6a){return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x31b696['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x44cf6a,null))['then'](removeEntity(_0x44cf6a,null))[_0x5adb('0xae')](handleError(_0x44cf6a,null));};exports[_0x5adb('0xb6')]=function(_0x280f30,_0xad6905){return db[_0x5adb('0x35')][_0x5adb('0xb6')]()[_0x5adb('0x27')](respondWithResult(_0xad6905,null))[_0x5adb('0xae')](handleError(_0xad6905,null));};exports[_0x5adb('0xb7')]=function(_0x36a8f0,_0x41fa3c,_0x18fc00){return db['WhatsappMessage'][_0x5adb('0x6a')]({'where':{'id':_0x36a8f0[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x41fa3c,null))[_0x5adb('0x27')](function(_0x1da6bc){if(_0x1da6bc){return _0x1da6bc[_0x5adb('0xb7')](_0x36a8f0[_0x5adb('0x6e')][_0x5adb('0xb8')],_['omit'](_0x36a8f0[_0x5adb('0x6e')],[_0x5adb('0xb8'),'id'])||{});}})[_0x5adb('0x27')](respondWithResult(_0x41fa3c,null))['catch'](handleError(_0x41fa3c,null));};exports[_0x5adb('0xb9')]=function(_0x4ae211,_0x74065,_0x50c3a3){var _0x54da7c={'raw':![],'where':{}};var _0x173ead={};var _0x3796b7={'count':0x0,'rows':[]};return db[_0x5adb('0x35')][_0x5adb('0xba')]({'where':{'id':_0x4ae211[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x74065,null))[_0x5adb('0x27')](function(_0xa1911a){if(_0xa1911a){_0x173ead[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db[_0x5adb('0xbb')][_0x5adb('0x36')]);_0x173ead['query']=_[_0x5adb('0x6f')](_0x4ae211['query']);_0x173ead[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x173ead['model'],_0x173ead[_0x5adb('0x39')]);_0x54da7c[_0x5adb('0x3c')]=_['intersection'](_0x173ead['model'],qs[_0x5adb('0x3d')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x3d')]));_0x54da7c[_0x5adb('0x3c')]=_0x54da7c[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x54da7c['attributes']:_0x173ead[_0x5adb('0x3b')];if(!_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbc')](_0x5adb('0xbd'))){_0x54da7c[_0x5adb('0x3f')]=qs['limit'](_0x4ae211['query'][_0x5adb('0x3f')]);_0x54da7c[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x54da7c[_0x5adb('0x40')]=qs[_0x5adb('0x41')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x41')]);_0x54da7c['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x4ae211['query'],_0x173ead['filters']));_0x54da7c['where'][_0x5adb('0xac')]=_0xa1911a['id'];if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0x81')]){_0x54da7c['where']=_['merge'](_0x54da7c[_0x5adb('0x79')],{'$or':_[_0x5adb('0x2e')](_0x54da7c[_0x5adb('0x3c')],function(_0x3d2a5b){var _0x3b367f={};_0x3b367f[_0x3d2a5b]={'$like':'%'+_0x4ae211[_0x5adb('0x39')]['filter']+'%'};return _0x3b367f;})});}if(_0x4ae211['query'][_0x5adb('0xbe')]){var _0x5a9e55=_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbe')]['split'](',');var _0x7151b8={};_0x7151b8[_0x5a9e55[0x0]]={'$gte':moment(_0x5a9e55[0x1])[_0x5adb('0xbf')](_0x5adb('0xc0'))};_0x54da7c[_0x5adb('0x79')]=_['merge'](_0x54da7c[_0x5adb('0x79')],_0x7151b8);}_0x54da7c=_[_0x5adb('0xb3')]({},_0x54da7c,_0x4ae211[_0x5adb('0xb4')]);return db[_0x5adb('0xbb')]['count']({'where':_0x54da7c[_0x5adb('0x79')]})['then'](function(_0x29cc2f){_0x3796b7[_0x5adb('0x97')]=_0x29cc2f;if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0xb1')]){_0x54da7c[_0x5adb('0xb2')]=[{'all':!![]}];}return db[_0x5adb('0xbb')]['findAll'](_0x54da7c);})[_0x5adb('0x27')](function(_0x49e908){_0x3796b7[_0x5adb('0xc1')]=_0x49e908;return _0x3796b7;});}})[_0x5adb('0x27')](respondWithFilteredResult(_0x74065,_0x54da7c))['catch'](handleError(_0x74065,null));};exports[_0x5adb('0xc2')]=function(_0x52e44f,_0x5a517a,_0x4d50f7){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x52e44f['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x5a517a,null))[_0x5adb('0x27')](function(_0x325f86){if(_0x325f86){return _0x325f86[_0x5adb('0xc3')](_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')],_[_0x5adb('0xc4')](_0x52e44f['body'],[_0x5adb('0xb8'),'id'])||{})[_0x5adb('0xc5')](function(){return db['Tag'][_0x5adb('0xc6')]({'attributes':['id',_0x5adb('0x2b'),_0x5adb('0xc7')],'where':{'id':_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')]}});})[_0x5adb('0x27')](function(_0x3a88ab){socket[_0x5adb('0xc8')](_0x5adb('0xc9'),{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]});return{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]};});}})[_0x5adb('0x27')](respondWithResult(_0x5a517a,null))['catch'](handleError(_0x5a517a,null));};exports['removeTags']=function(_0x2376a6,_0x282c11,_0x35a718){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x2376a6[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x282c11,null))[_0x5adb('0x27')](function(_0xb9ac38){if(_0xb9ac38){return _0xb9ac38[_0x5adb('0xca')](_0x2376a6['query']['ids']);}})[_0x5adb('0x27')](respondWithStatusCode(_0x282c11,null))['catch'](handleError(_0x282c11,null));};exports[_0x5adb('0xcb')]=function(_0x64fae1,_0x3ad256){var _0x2b4228=moment()[_0x5adb('0xcc')]()[_0x5adb('0x96')]();var _0x5e17ea=path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xd0'),_0x5adb('0xd1'));var _0xabc1ee=path[_0x5adb('0xcd')](config['root'],'server','files',_0x5adb('0xd2'));var _0x5ae730=path[_0x5adb('0xcd')](_0x5e17ea,_0x2b4228);var _0x5983ef=util['format'](_0x5adb('0xd3'),_0x64fae1[_0x5adb('0xb0')]['id'],_0x2b4228);var _0x5e74dc=path['join'](_0x5e17ea,_0x5983ef);var _0x3612c=[];_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0x68')],'as':'User','attributes':['id',_0x5adb('0x2f')],'raw':!![]});_0x3612c['push']({'model':db['CmContact'],'as':_0x5adb('0x5d'),'attributes':['id',_0x5adb('0xd4'),_0x5adb('0xd5')],'raw':!![]});if(_0x64fae1['query']['attachments']){_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0xd6')],'as':'Attachment','raw':!![]});}var _0x5366d4=[{'model':db[_0x5adb('0xbb')],'as':_0x5adb('0xd7'),'attributes':['id','body',_0x5adb('0x75'),'direction',_0x5adb('0xd8'),'read'],'include':_0x3612c}];_0x5366d4[_0x5adb('0x34')]({'model':db[_0x5adb('0xd9')],'as':_0x5adb('0xda'),'attributes':['id',_0x5adb('0x2b')]});_0x5366d4[_0x5adb('0x34')]({'model':db['User'],'as':_0x5adb('0xdb'),'attributes':['id',_0x5adb('0x2f')]});return db[_0x5adb('0x35')]['find']({'where':{'id':_0x64fae1[_0x5adb('0xb0')]['id']},'include':_0x5366d4})[_0x5adb('0x27')](handleEntityNotFound(_0x3ad256,null))[_0x5adb('0x27')](function(_0x45526a){if(_0x45526a){var _0x57607e=_0x45526a[_0x5adb('0xdc')]({'plain':!![]});fs[_0x5adb('0xdd')](_0x5ae730);var _0x3bbe7c={'format':'A4','border':'10px','header':{'height':_0x5adb('0xde'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x5adb('0xdf'),'contents':{'default':util[_0x5adb('0xbf')](_0x5adb('0xe0'),util[_0x5adb('0xbf')](_0x5adb('0xe1'),'Whatsapp',_0x57607e['id']),moment()['format']('YYYY-MM-DD')[_0x5adb('0x96')]())}}};var _0x4a1b54={'channel':'Whatsapp','account':_0x57607e[_0x5adb('0xda')][_0x5adb('0x2b')],'agent':_0x57607e[_0x5adb('0xdb')]?_0x57607e[_0x5adb('0xdb')][_0x5adb('0x2f')]:_0x5adb('0xe2'),'createdAt':moment(_0x57607e[_0x5adb('0x75')])[_0x5adb('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5adb('0x96')](),'closedAt':_0x57607e[_0x5adb('0xe3')]?moment(_0x57607e['closedAt'])[_0x5adb('0xbf')](_0x5adb('0xc0'))['toString']():'','disposition':_0x57607e[_0x5adb('0xe4')],'messages':_(_0x57607e['Messages'])[_0x5adb('0x81')]({'secret':![]})[_0x5adb('0x2e')](function(_0x3d782b){if(_0x3d782b[_0x5adb('0xd6')]){var _0x651279=path[_0x5adb('0xcd')](_0xabc1ee,_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]);if(fs['existsSync'](_0x651279)){fs[_0x5adb('0xe6')](_0x651279)['pipe'](fs[_0x5adb('0xe7')](path['join'](_0x5ae730,_0x3d782b[_0x5adb('0xd6')]['basename'])));}}return{'date':moment(_0x3d782b[_0x5adb('0x75')])[_0x5adb('0xbf')](_0x5adb('0xc0'))[_0x5adb('0x96')](),'sender':_0x3d782b[_0x5adb('0xe8')]===_0x5adb('0xe9')?_0x3d782b[_0x5adb('0x68')]?_0x3d782b[_0x5adb('0x68')][_0x5adb('0x2f')]:_0x5adb('0xea'):_0x3d782b[_0x5adb('0x5d')][_0x5adb('0xd4')]+(_0x3d782b[_0x5adb('0x5d')]['lastName']?'\x20'+_0x3d782b[_0x5adb('0x5d')]['lastName']:''),'body':_0x3d782b[_0x5adb('0xd6')]?_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]:_0x3d782b['body'],'direction':_0x3d782b['direction']==='out'?'A':'C','secret':_0x3d782b['secret'],'read':_0x3d782b[_0x5adb('0x7c')],'attachment':_0x3d782b[_0x5adb('0xd6')]};})[_0x5adb('0x5f')]()};return ejs[_0x5adb('0xeb')](path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xec'),_0x5adb('0xed')),{'interaction':_0x4a1b54})['then'](function(_0x39bf82){return new BPromise(function(_0x197b7f,_0x171fb9){pdf[_0x5adb('0xb5')](_0x39bf82,_0x3bbe7c)[_0x5adb('0xee')](path[_0x5adb('0xcd')](_0x5ae730,'transcript-'+_0x57607e['id']+'-'+_0x2b4228+'.pdf'),function(_0x4edb9e,_0x25f1f7){if(_0x4edb9e)return _0x171fb9(_0x4edb9e);_0x197b7f(_0x25f1f7);});});})[_0x5adb('0x27')](function(){return new BPromise(function(_0xb81dd2,_0x2b753d){zipdir(_0x5ae730,{'saveTo':_0x5e74dc},function(_0x27eb1e,_0x5eef55){if(_0x27eb1e)return _0x2b753d(_0x27eb1e);return _0xb81dd2(_0x5eef55);});})[_0x5adb('0x27')](function(){return new BPromise(function(_0x2cb713,_0x2034d7){rimraf(_0x5ae730,function(_0x3dd67b){if(_0x3dd67b)_0x2034d7(_0x3dd67b);return _0x2cb713();});});})[_0x5adb('0x27')](function(){return _0x3ad256[_0x5adb('0xcb')](_0x5e74dc,_0x5983ef,function(_0x38c24d){if(_0x38c24d){console[_0x5adb('0xef')](_0x5adb('0xf0'),_0x38c24d);}else{fs[_0x5adb('0xf1')](_0x5e74dc);}});});});}else{return _0x3ad256[_0x5adb('0x1d')](0xc8);}})[_0x5adb('0xae')](handleError(_0x3ad256,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index cf6a2ad..ef4c10d 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 _0x8d44=['map','findAll','emit','catch','hasOwnProperty','hook','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','setDataValue'];(function(_0x5545f7,_0x570414){var _0x52a979=function(_0x28eb97){while(--_0x28eb97){_0x5545f7['push'](_0x5545f7['shift']());}};_0x52a979(++_0x570414);}(_0x8d44,0x7e));var _0x48d4=function(_0x3fb9af,_0x41e2fc){_0x3fb9af=_0x3fb9af-0x0;var _0x19e160=_0x8d44[_0x3fb9af];return _0x19e160;};'use strict';var EventEmitter=require(_0x48d4('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x48d4('0x1')];var WhatsappMessage=require(_0x48d4('0x2'))['db'][_0x48d4('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x48d4('0x4')](0x0);var events={'afterCreate':_0x48d4('0x5'),'afterUpdate':_0x48d4('0x6'),'afterDestroy':_0x48d4('0x7')};function emitEvent(_0x5d38e7){return function(_0x4d2890,_0x1e3197,_0x366fa0){_0x4d2890[_0x48d4('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2caa1a){_0x4d2890[_0x48d4('0x9')]('Users',_0x2caa1a[_0x48d4('0xa')](function(_0x3d0794){return{'id':_0x3d0794['id']};}));return WhatsappMessage[_0x48d4('0xb')]({'where':{'WhatsappInteractionId':_0x4d2890['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5d6c13){_0x4d2890[_0x48d4('0x9')]('unreadMessages',_0x5d6c13['length']);WhatsappInteractionEvents[_0x48d4('0xc')](_0x5d38e7+':'+_0x4d2890['id'],_0x4d2890);WhatsappInteractionEvents[_0x48d4('0xc')](_0x5d38e7,_0x4d2890);_0x366fa0(null);})[_0x48d4('0xd')](_0x366fa0(null));};}for(var e in events){if(events[_0x48d4('0xe')](e)){var event=events[e];WhatsappInteraction[_0x48d4('0xf')](e,emitEvent(event));}}module[_0x48d4('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xf5c5=['then','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xf5c5,0x13b));var _0x5f5c=function(_0x2e181c,_0x50246a){_0x2e181c=_0x2e181c-0x0;var _0x4c1d9e=_0xf5c5[_0x2e181c];return _0x4c1d9e;};'use strict';var EventEmitter=require(_0x5f5c('0x0'));var WhatsappInteraction=require(_0x5f5c('0x1'))['db'][_0x5f5c('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x5f5c('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5f5c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5f5c('0x5'),'afterDestroy':_0x5f5c('0x6')};function emitEvent(_0x8e759b){return function(_0x223647,_0x59fbb9,_0x4a684e){_0x223647[_0x5f5c('0x7')]({'attributes':['id'],'raw':!![]})[_0x5f5c('0x8')](function(_0x173381){_0x223647['setDataValue']('Users',_0x173381[_0x5f5c('0x9')](function(_0x470e07){return{'id':_0x470e07['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x223647['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5f5c('0x8')](function(_0x2e1645){_0x223647[_0x5f5c('0xa')](_0x5f5c('0xb'),_0x2e1645[_0x5f5c('0xc')]);WhatsappInteractionEvents[_0x5f5c('0xd')](_0x8e759b+':'+_0x223647['id'],_0x223647);WhatsappInteractionEvents[_0x5f5c('0xd')](_0x8e759b,_0x223647);_0x4a684e(null);})[_0x5f5c('0xe')](_0x4a684e(null));};}for(var e in events){if(events[_0x5f5c('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x5f5c('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 6a10aad..f529b4a 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0xf7b8c2,_0x119b83){var _0x2a60db=function(_0x485186){while(--_0x485186){_0xf7b8c2['push'](_0xf7b8c2['shift']());}};_0x2a60db(++_0x119b83);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file +var _0xa9e0=['define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x55bfef,_0x26fb96){var _0x1f3ca1=function(_0x5d7c32){while(--_0x5d7c32){_0x55bfef['push'](_0x55bfef['shift']());}};_0x1f3ca1(++_0x26fb96);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 62434b3..2c2d741 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 _0x42ef=['debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','update','body','options','where','attributes','WhatsappInteraction','find','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','redis','localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x32dce6,_0x23f570){var _0x1191ba=function(_0x58efa8){while(--_0x58efa8){_0x32dce6['push'](_0x32dce6['shift']());}};_0x1191ba(++_0x23f570);}(_0x42ef,0xd1));var _0xf42e=function(_0x49ca2c,_0x39f68){_0x49ca2c=_0x49ca2c-0x0;var _0x5b9654=_0x42ef[_0x49ca2c];return _0x5b9654;};'use strict';var _=require(_0xf42e('0x0'));var util=require(_0xf42e('0x1'));var moment=require(_0xf42e('0x2'));var BPromise=require(_0xf42e('0x3'));var rs=require(_0xf42e('0x4'));var fs=require('fs');var Redis=require(_0xf42e('0x5'));var db=require(_0xf42e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf42e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf42e('0x8')][_0xf42e('0x9')]({'port':0x232a});config[_0xf42e('0xa')]=_['defaults'](config[_0xf42e('0xa')],{'host':_0xf42e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf42e('0xa')]));require(_0xf42e('0xc'))[_0xf42e('0xd')](socket);function respondWithRpcPromise(_0x543579,_0x568d82,_0xb3f6e1){return new BPromise(function(_0x201e79,_0x1aec54){return client[_0xf42e('0xe')](_0x543579,_0xb3f6e1)[_0xf42e('0xf')](function(_0x474ed3){logger[_0xf42e('0x10')](_0xf42e('0x11'),_0x568d82,_0xf42e('0x12'));logger[_0xf42e('0x13')](_0xf42e('0x14'),_0x568d82,_0xf42e('0x12'),JSON[_0xf42e('0x15')](_0x474ed3));if(_0x474ed3[_0xf42e('0x16')]){if(_0x474ed3[_0xf42e('0x16')][_0xf42e('0x17')]===0x1f4){logger[_0xf42e('0x16')](_0xf42e('0x11'),_0x568d82,_0x474ed3[_0xf42e('0x16')][_0xf42e('0x18')]);return _0x1aec54(_0x474ed3[_0xf42e('0x16')]['message']);}logger[_0xf42e('0x16')](_0xf42e('0x11'),_0x568d82,_0x474ed3[_0xf42e('0x16')][_0xf42e('0x18')]);return _0x201e79(_0x474ed3[_0xf42e('0x16')][_0xf42e('0x18')]);}else{logger[_0xf42e('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x568d82,'request\x20sent');_0x201e79(_0x474ed3[_0xf42e('0x19')][_0xf42e('0x18')]);}})[_0xf42e('0x1a')](function(_0x59f753){logger[_0xf42e('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x568d82,_0x59f753);_0x1aec54(_0x59f753);});});}exports[_0xf42e('0x1b')]=function(_0x5cf4a9){var _0x2113dd=this;return new Promise(function(_0x1b56ec,_0x4f871e){return db['WhatsappInteraction'][_0xf42e('0x1c')](_0x5cf4a9[_0xf42e('0x1d')],{'raw':_0x5cf4a9['options']?_0x5cf4a9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cf4a9['options']?_0x5cf4a9[_0xf42e('0x1e')][_0xf42e('0x1f')]||null:null,'attributes':_0x5cf4a9['options']?_0x5cf4a9[_0xf42e('0x1e')][_0xf42e('0x20')]||null:null,'limit':_0x5cf4a9[_0xf42e('0x1e')]?_0x5cf4a9['options']['limit']||null:null})[_0xf42e('0xf')](function(_0x22dd28){logger[_0xf42e('0x10')](_0xf42e('0x1b'),_0x5cf4a9);logger[_0xf42e('0x13')](_0xf42e('0x1b'),_0x5cf4a9,JSON[_0xf42e('0x15')](_0x22dd28));_0x1b56ec(_0x22dd28);})[_0xf42e('0x1a')](function(_0x143231){logger['error'](_0xf42e('0x1b'),_0x143231[_0xf42e('0x18')],_0x5cf4a9);_0x4f871e(_0x2113dd[_0xf42e('0x16')](0x1f4,_0x143231[_0xf42e('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x596f9e){return new Promise(function(_0x6d72e0,_0x33f67f){return db[_0xf42e('0x21')][_0xf42e('0x22')]({'where':_0x596f9e[_0xf42e('0x1e')]?_0x596f9e['options']['where']||null:null})[_0xf42e('0xf')](function(_0x37440b){if(_0x37440b){return _0x37440b['addTags'](_0x596f9e[_0xf42e('0x1d')]['ids'],_[_0xf42e('0x23')](_0x596f9e[_0xf42e('0x1d')],[_0xf42e('0x24'),'id'])||{});}})['spread'](function(_0x50f711){logger[_0xf42e('0x10')](_0xf42e('0x25'),_0x596f9e);logger[_0xf42e('0x13')]('AddTags',_0x596f9e,JSON['stringify'](_0x50f711));_0x6d72e0(_0x50f711);})[_0xf42e('0x1a')](function(_0x30a8b4){logger[_0xf42e('0x16')](_0xf42e('0x25'),_0x30a8b4[_0xf42e('0x18')],_0x596f9e);_0x33f67f(_this['error'](0x1f4,_0x30a8b4[_0xf42e('0x18')]));});});}; \ No newline at end of file +var _0xaa87=['code','error','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0xaa87,0x66));var _0x7aa8=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xaa87[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x7aa8('0x0'));var util=require(_0x7aa8('0x1'));var moment=require(_0x7aa8('0x2'));var BPromise=require(_0x7aa8('0x3'));var rs=require(_0x7aa8('0x4'));var fs=require('fs');var Redis=require(_0x7aa8('0x5'));var db=require(_0x7aa8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7aa8('0x7'))(_0x7aa8('0x8'));var config=require(_0x7aa8('0x9'));var jayson=require(_0x7aa8('0xa'));var client=jayson[_0x7aa8('0xb')][_0x7aa8('0xc')]({'port':0x232a});config[_0x7aa8('0xd')]=_[_0x7aa8('0xe')](config[_0x7aa8('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7aa8('0xd')]));require(_0x7aa8('0xf'))[_0x7aa8('0x10')](socket);function respondWithRpcPromise(_0x4b5399,_0x19d18b,_0x41f8b3){return new BPromise(function(_0x1e2395,_0x22bb50){return client[_0x7aa8('0x11')](_0x4b5399,_0x41f8b3)[_0x7aa8('0x12')](function(_0x2b973e){logger[_0x7aa8('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x19d18b,_0x7aa8('0x14'));logger[_0x7aa8('0x15')](_0x7aa8('0x16'),_0x19d18b,'request\x20sent',JSON[_0x7aa8('0x17')](_0x2b973e));if(_0x2b973e['error']){if(_0x2b973e['error'][_0x7aa8('0x18')]===0x1f4){logger[_0x7aa8('0x19')](_0x7aa8('0x1a'),_0x19d18b,_0x2b973e[_0x7aa8('0x19')]['message']);return _0x22bb50(_0x2b973e[_0x7aa8('0x19')][_0x7aa8('0x1b')]);}logger[_0x7aa8('0x19')](_0x7aa8('0x1a'),_0x19d18b,_0x2b973e['error'][_0x7aa8('0x1b')]);return _0x1e2395(_0x2b973e['error'][_0x7aa8('0x1b')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x19d18b,_0x7aa8('0x14'));_0x1e2395(_0x2b973e[_0x7aa8('0x1c')][_0x7aa8('0x1b')]);}})[_0x7aa8('0x1d')](function(_0x232b60){logger[_0x7aa8('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x19d18b,_0x232b60);_0x22bb50(_0x232b60);});});}exports[_0x7aa8('0x1e')]=function(_0x2f2c69){var _0xf6827f=this;return new Promise(function(_0x223823,_0x9914e4){return db[_0x7aa8('0x1f')][_0x7aa8('0x20')](_0x2f2c69[_0x7aa8('0x21')],{'raw':_0x2f2c69['options']?_0x2f2c69[_0x7aa8('0x22')][_0x7aa8('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f2c69[_0x7aa8('0x22')]?_0x2f2c69[_0x7aa8('0x22')][_0x7aa8('0x24')]||null:null,'attributes':_0x2f2c69[_0x7aa8('0x22')]?_0x2f2c69['options']['attributes']||null:null,'limit':_0x2f2c69['options']?_0x2f2c69[_0x7aa8('0x22')]['limit']||null:null})[_0x7aa8('0x12')](function(_0xa061b0){logger[_0x7aa8('0x13')](_0x7aa8('0x1e'),_0x2f2c69);logger[_0x7aa8('0x15')](_0x7aa8('0x1e'),_0x2f2c69,JSON[_0x7aa8('0x17')](_0xa061b0));_0x223823(_0xa061b0);})['catch'](function(_0x5f08b4){logger['error'](_0x7aa8('0x1e'),_0x5f08b4['message'],_0x2f2c69);_0x9914e4(_0xf6827f[_0x7aa8('0x19')](0x1f4,_0x5f08b4[_0x7aa8('0x1b')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x2c92f2){return new Promise(function(_0x5aeb9b,_0x25bee9){return db['WhatsappInteraction']['find']({'where':_0x2c92f2[_0x7aa8('0x22')]?_0x2c92f2[_0x7aa8('0x22')][_0x7aa8('0x24')]||null:null})[_0x7aa8('0x12')](function(_0x538d28){if(_0x538d28){return _0x538d28[_0x7aa8('0x25')](_0x2c92f2[_0x7aa8('0x21')][_0x7aa8('0x26')],_[_0x7aa8('0x27')](_0x2c92f2[_0x7aa8('0x21')],[_0x7aa8('0x26'),'id'])||{});}})[_0x7aa8('0x28')](function(_0x132945){logger[_0x7aa8('0x13')](_0x7aa8('0x29'),_0x2c92f2);logger[_0x7aa8('0x15')](_0x7aa8('0x29'),_0x2c92f2,JSON[_0x7aa8('0x17')](_0x132945));_0x5aeb9b(_0x132945);})[_0x7aa8('0x1d')](function(_0x337db7){logger['error']('AddTags',_0x337db7[_0x7aa8('0x1b')],_0x2c92f2);_0x25bee9(_this[_0x7aa8('0x19')](0x1f4,_0x337db7[_0x7aa8('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 4fb14d0..f217af9 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 _0x091e=['save','update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x091e,0x1c7));var _0xe091=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x091e[_0x13d07a];return _0x5ee0ee;};'use strict';var WhatsappInteractionEvents=require(_0xe091('0x0'));var events=[_0xe091('0x1'),'remove',_0xe091('0x2')];function createListener(_0x3a6751,_0x1cbf20){return function(_0x26046d){_0x1cbf20[_0xe091('0x3')](_0x3a6751,_0x26046d);};}function removeListener(_0x5a49a5,_0x2f65b3){return function(){WhatsappInteractionEvents[_0xe091('0x4')](_0x5a49a5,_0x2f65b3);};}exports[_0xe091('0x5')]=function(_0xe5890f){for(var _0xe8da83=0x0,_0x1f3346=events[_0xe091('0x6')];_0xe8da83<_0x1f3346;_0xe8da83++){var _0x2179b9=events[_0xe8da83];var _0x30053f=createListener(_0xe091('0x7')+_0x2179b9,_0xe5890f);WhatsappInteractionEvents['on'](_0x2179b9,_0x30053f);}}; \ No newline at end of file +var _0xd5d7=['register','length','./whatsappInteraction.events','save','update','emit','removeListener'];(function(_0x196673,_0x549432){var _0x72dcc5=function(_0x498a60){while(--_0x498a60){_0x196673['push'](_0x196673['shift']());}};_0x72dcc5(++_0x549432);}(_0xd5d7,0xa3));var _0x7d5d=function(_0x43ab67,_0x5352aa){_0x43ab67=_0x43ab67-0x0;var _0x3fbd1b=_0xd5d7[_0x43ab67];return _0x3fbd1b;};'use strict';var WhatsappInteractionEvents=require(_0x7d5d('0x0'));var events=[_0x7d5d('0x1'),'remove',_0x7d5d('0x2')];function createListener(_0xe74e8,_0x60a31){return function(_0x4f61da){_0x60a31[_0x7d5d('0x3')](_0xe74e8,_0x4f61da);};}function removeListener(_0xefc47e,_0x3b778c){return function(){WhatsappInteractionEvents[_0x7d5d('0x4')](_0xefc47e,_0x3b778c);};}exports[_0x7d5d('0x5')]=function(_0x2f2311){for(var _0x406190=0x0,_0x12450f=events[_0x7d5d('0x6')];_0x406190<_0x12450f;_0x406190++){var _0x96df62=events[_0x406190];var _0x334da4=createListener('whatsappInteraction:'+_0x96df62,_0x2f2311);WhatsappInteractionEvents['on'](_0x96df62,_0x334da4);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 00e770b..ebbaa27 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 _0x8b8d=['../../components/interaction/service','../../config/environment','./whatsappMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8b8d,0x96));var _0xd8b8=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x8b8d[_0x381589];return _0x2a075d;};'use strict';var multer=require(_0xd8b8('0x0'));var util=require('util');var path=require(_0xd8b8('0x1'));var timeout=require(_0xd8b8('0x2'));var express=require(_0xd8b8('0x3'));var router=express[_0xd8b8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd8b8('0x5'));var config=require(_0xd8b8('0x6'));var controller=require(_0xd8b8('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd8b8('0x8')]);router[_0xd8b8('0x9')](_0xd8b8('0xa'),auth[_0xd8b8('0xb')](),controller[_0xd8b8('0xc')]);router[_0xd8b8('0x9')](_0xd8b8('0xd'),auth[_0xd8b8('0xb')](),controller[_0xd8b8('0xe')]);router[_0xd8b8('0xf')]('/',auth[_0xd8b8('0xb')](),interaction[_0xd8b8('0x10')](_0xd8b8('0x11'),_0xd8b8('0x12')),controller[_0xd8b8('0x13')]);router[_0xd8b8('0xf')](_0xd8b8('0x14'),controller[_0xd8b8('0x15')]);router[_0xd8b8('0x16')](_0xd8b8('0xd'),auth[_0xd8b8('0xb')](),controller[_0xd8b8('0x17')]);router[_0xd8b8('0x16')](_0xd8b8('0x18'),auth[_0xd8b8('0xb')](),controller[_0xd8b8('0x19')]);router[_0xd8b8('0x16')](_0xd8b8('0x1a'),auth[_0xd8b8('0xb')](),controller[_0xd8b8('0x1b')]);router[_0xd8b8('0x1c')](_0xd8b8('0xd'),auth['isAuthenticated'](),controller[_0xd8b8('0x1d')]);module[_0xd8b8('0x1e')]=router; \ No newline at end of file +var _0x9467=['isAuthenticated','index','/describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','accept','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0x9467,0x1cc));var _0x7946=function(_0x4e3b91,_0x2780b3){_0x4e3b91=_0x4e3b91-0x0;var _0x37ae86=_0x9467[_0x4e3b91];return _0x37ae86;};'use strict';var multer=require(_0x7946('0x0'));var util=require('util');var path=require(_0x7946('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7946('0x2')]();var auth=require(_0x7946('0x3'));var interaction=require(_0x7946('0x4'));var config=require(_0x7946('0x5'));var controller=require(_0x7946('0x6'));router[_0x7946('0x7')]('/',auth[_0x7946('0x8')](),controller[_0x7946('0x9')]);router['get'](_0x7946('0xa'),auth[_0x7946('0x8')](),controller['describe']);router[_0x7946('0x7')](_0x7946('0xb'),auth['isAuthenticated'](),controller[_0x7946('0xc')]);router[_0x7946('0xd')]('/',auth[_0x7946('0x8')](),interaction[_0x7946('0xe')](_0x7946('0xf'),_0x7946('0x10')),controller[_0x7946('0x11')]);router[_0x7946('0xd')](_0x7946('0x12'),controller[_0x7946('0x13')]);router[_0x7946('0x14')](_0x7946('0xb'),auth[_0x7946('0x8')](),controller[_0x7946('0x15')]);router[_0x7946('0x14')]('/:id/accept',auth[_0x7946('0x8')](),controller[_0x7946('0x16')]);router['put']('/:id/reject',auth[_0x7946('0x8')](),controller['reject']);router[_0x7946('0x17')]('/:id',auth[_0x7946('0x8')](),controller[_0x7946('0x18')]);module[_0x7946('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index db8345c..138e8e1 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 _0xadda=['ENUM','out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x17172c,_0x19aa42){var _0x2fd64b=function(_0x560431){while(--_0x560431){_0x17172c['push'](_0x17172c['shift']());}};_0x2fd64b(++_0x19aa42);}(_0xadda,0xa3));var _0xaadd=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xadda[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require(_0xaadd('0x0'));module[_0xaadd('0x1')]={'body':{'type':Sequelize[_0xaadd('0x2')](_0xaadd('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xaadd('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaadd('0x5')]('in',_0xaadd('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xaadd('0x7')]},'secret':{'type':Sequelize[_0xaadd('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x253c=['sequelize','exports','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0x253c,0xb0));var _0xc253=function(_0x957f74,_0x687fe1){_0x957f74=_0x957f74-0x0;var _0x45347a=_0x253c[_0x957f74];return _0x45347a;};'use strict';var Sequelize=require(_0xc253('0x0'));module[_0xc253('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc253('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc253('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc253('0x4')]('in','out'),'defaultValue':_0xc253('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc253('0x6')](0xbe)},'phone':{'type':Sequelize[_0xc253('0x6')]},'readAt':{'type':Sequelize[_0xc253('0x7')]},'secret':{'type':Sequelize[_0xc253('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 21f4fd4..d58a1a3 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 _0x5322=['name','index','map','WhatsappMessage','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','include','show','params','fields','includeAll','options','find','create','body','destroy','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','WhatsappInteractionId','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','WhatsappInteraction','rejectMessage','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','html-pdf','rimraf','zip-dir','fast-json-patch','moment','util','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','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','update','stack'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x5322,0x1cd));var _0x2532=function(_0x502598,_0x1e95c8){_0x502598=_0x502598-0x0;var _0xbdee21=_0x5322[_0x502598];return _0xbdee21;};'use strict';var pdf=require(_0x2532('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2532('0x1'));var zipdir=require(_0x2532('0x2'));var jsonpatch=require(_0x2532('0x3'));var rp=require('request-promise');var moment=require(_0x2532('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2532('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2532('0x6'));var ejs=require(_0x2532('0x7'));var fs=require('fs');var _=require(_0x2532('0x8'));var squel=require(_0x2532('0x9'));var crypto=require('crypto');var jsforce=require(_0x2532('0xa'));var deskjs=require(_0x2532('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2532('0xc'));var Papa=require(_0x2532('0xd'));var Redis=require(_0x2532('0xe'));var authService=require(_0x2532('0xf'));var qs=require(_0x2532('0x10'));var as=require(_0x2532('0x11'));var hardwareService=require(_0x2532('0x12'));var logger=require(_0x2532('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x2532('0x14'));var db=require(_0x2532('0x15'))['db'];config[_0x2532('0x16')]=_[_0x2532('0x17')](config['redis'],{'host':_0x2532('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2532('0x16')]));require(_0x2532('0x19'))[_0x2532('0x1a')](socket);var jayson=require(_0x2532('0x1b'));var client=jayson[_0x2532('0x1c')][_0x2532('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x20d400,_0x580cdc,_0x2c4980){if(_0x2c4980){var _0x450164=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x450164[_0x2532('0x1e')](_0x580cdc)){return _0x20d400;}else{throw new db['Sequelize']['ValidationError'](_0x2532('0x1f'));}}else{return _0x20d400;}}function respondWithRpcPromise(_0x4c17da,_0x1583eb,_0x45462b,_0x1bc46b){return new BPromise(function(_0x66ef03,_0x4e169c){var _0x545999=_0x1bc46b||client;return _0x545999['request'](_0x4c17da,_0x45462b)[_0x2532('0x20')](function(_0x53550a){logger[_0x2532('0x21')](_0x2532('0x22'),_0x1583eb,_0x2532('0x23'));logger[_0x2532('0x24')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1583eb,_0x2532('0x23'),JSON[_0x2532('0x25')](_0x53550a));if(_0x53550a[_0x2532('0x26')]){if(_0x53550a[_0x2532('0x26')][_0x2532('0x27')]===0x1f4){logger['error'](_0x2532('0x22'),_0x1583eb,_0x53550a['error'][_0x2532('0x28')]);return _0x4e169c(_0x53550a[_0x2532('0x26')][_0x2532('0x28')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x1583eb,_0x53550a[_0x2532('0x26')]['message']);return _0x66ef03(_0x53550a[_0x2532('0x26')][_0x2532('0x28')]);}else{logger[_0x2532('0x21')](_0x2532('0x22'),_0x1583eb,_0x2532('0x23'));_0x66ef03(_0x53550a[_0x2532('0x29')]['message']);}})[_0x2532('0x2a')](function(_0x2bac12){logger[_0x2532('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x1583eb,_0x2bac12);_0x4e169c(_0x2bac12);});});}function respondWithStatusCode(_0x2d5a33,_0x44e54f){_0x44e54f=_0x44e54f||0xcc;return function(_0xdc6060){if(_0xdc6060){return _0x2d5a33[_0x2532('0x2b')](_0x44e54f);}return _0x2d5a33[_0x2532('0x2c')](_0x44e54f)[_0x2532('0x2d')]();};}function respondWithResult(_0x25d1aa,_0x1e1597){_0x1e1597=_0x1e1597||0xc8;return function(_0x39b3d1){if(_0x39b3d1){return _0x25d1aa['status'](_0x1e1597)['json'](_0x39b3d1);}};}function respondWithFilteredResult(_0x4a209f,_0x1f6419){return function(_0x159414){if(_0x159414){var _0x28977a=_0x159414[_0x2532('0x2e')],_0x1ef7c8=_0x1f6419[_0x2532('0x2f')],_0x5b5cc8=_0x1f6419[_0x2532('0x2f')]+_0x1f6419[_0x2532('0x30')],_0x2ecdd4;if(_0x5b5cc8>=_0x28977a){_0x5b5cc8=_0x28977a;_0x2ecdd4=0xc8;}else{_0x2ecdd4=0xce;}_0x4a209f[_0x2532('0x2c')](_0x2ecdd4);return _0x4a209f[_0x2532('0x31')](_0x2532('0x32'),_0x1ef7c8+'-'+_0x5b5cc8+'/'+_0x28977a)[_0x2532('0x33')](_0x159414);}return null;};}function patchUpdates(_0x2fe4df){return function(_0x47e0bc){try{jsonpatch['apply'](_0x47e0bc,_0x2fe4df,!![]);}catch(_0x2deb3c){return BPromise['reject'](_0x2deb3c);}return _0x47e0bc[_0x2532('0x34')]();};}function saveUpdates(_0x3d94f2,_0x5cad41){return function(_0x378184){if(_0x378184){return _0x378184[_0x2532('0x35')](_0x3d94f2)[_0x2532('0x20')](function(_0x3d81f5){return _0x3d81f5;});}return null;};}function removeEntity(_0x3a6ec3,_0x12f968){return function(_0x40aa8a){if(_0x40aa8a){return _0x40aa8a['destroy']()[_0x2532('0x20')](function(){_0x3a6ec3[_0x2532('0x2c')](0xcc)[_0x2532('0x2d')]();});}};}function handleEntityNotFound(_0x1dfd64,_0x15c25c){return function(_0x3b88ed){if(!_0x3b88ed){_0x1dfd64['sendStatus'](0x194);}return _0x3b88ed;};}function handleError(_0x391c03,_0x430c39){_0x430c39=_0x430c39||0x1f4;return function(_0x1ee6af){logger[_0x2532('0x26')](_0x1ee6af[_0x2532('0x36')]);if(_0x1ee6af[_0x2532('0x37')]){delete _0x1ee6af[_0x2532('0x37')];}_0x391c03[_0x2532('0x2c')](_0x430c39)['send'](_0x1ee6af);};}exports[_0x2532('0x38')]=function(_0x2b754e,_0x42e0e4){var _0x57fe68={},_0x140361={},_0x46f750={'count':0x0,'rows':[]};var _0x28ae87=_[_0x2532('0x39')](db[_0x2532('0x3a')][_0x2532('0x3b')],function(_0x5d9d7a){return{'name':_0x5d9d7a[_0x2532('0x3c')],'type':_0x5d9d7a[_0x2532('0x3d')]['key']};});_0x140361['model']=_[_0x2532('0x39')](_0x28ae87,_0x2532('0x37'));_0x140361['query']=_[_0x2532('0x3e')](_0x2b754e[_0x2532('0x3f')]);_0x140361['filters']=_[_0x2532('0x40')](_0x140361[_0x2532('0x41')],_0x140361[_0x2532('0x3f')]);_0x57fe68[_0x2532('0x42')]=_[_0x2532('0x40')](_0x140361[_0x2532('0x41')],qs['fields'](_0x2b754e[_0x2532('0x3f')]['fields']));_0x57fe68[_0x2532('0x42')]=_0x57fe68['attributes'][_0x2532('0x43')]?_0x57fe68[_0x2532('0x42')]:_0x140361[_0x2532('0x41')];if(!_0x2b754e[_0x2532('0x3f')][_0x2532('0x44')]('nolimit')){_0x57fe68[_0x2532('0x30')]=qs[_0x2532('0x30')](_0x2b754e['query']['limit']);_0x57fe68['offset']=qs['offset'](_0x2b754e[_0x2532('0x3f')][_0x2532('0x2f')]);}_0x57fe68[_0x2532('0x45')]=qs[_0x2532('0x46')](_0x2b754e[_0x2532('0x3f')]['sort']);_0x57fe68['where']=qs[_0x2532('0x47')](_[_0x2532('0x48')](_0x2b754e[_0x2532('0x3f')],_0x140361[_0x2532('0x47')]),_0x28ae87);if(_0x2b754e[_0x2532('0x3f')]['filter']){_0x57fe68[_0x2532('0x49')]=_[_0x2532('0x4a')](_0x57fe68[_0x2532('0x49')],{'$or':_[_0x2532('0x39')](_0x28ae87,function(_0x526446){if(_0x526446[_0x2532('0x3d')]!==_0x2532('0x4b')){var _0x2b9d9e={};_0x2b9d9e[_0x526446[_0x2532('0x37')]]={'$like':'%'+_0x2b754e['query'][_0x2532('0x4c')]+'%'};return _0x2b9d9e;}})});}_0x57fe68=_[_0x2532('0x4a')]({},_0x57fe68,_0x2b754e['options']);var _0x4651d4={'where':_0x57fe68['where']};return db[_0x2532('0x3a')][_0x2532('0x2e')](_0x4651d4)[_0x2532('0x20')](function(_0xe5f87d){_0x46f750[_0x2532('0x2e')]=_0xe5f87d;if(_0x2b754e['query']['includeAll']){_0x57fe68[_0x2532('0x4d')]=[{'all':!![]}];}return db[_0x2532('0x3a')]['findAll'](_0x57fe68);})['then'](function(_0x118118){_0x46f750['rows']=_0x118118;return _0x46f750;})[_0x2532('0x20')](respondWithFilteredResult(_0x42e0e4,_0x57fe68))['catch'](handleError(_0x42e0e4,null));};exports[_0x2532('0x4e')]=function(_0x36c9bc,_0x5cc8a0){var _0x276e3b={'raw':!![],'where':{'id':_0x36c9bc[_0x2532('0x4f')]['id']}},_0x148865={};_0x148865[_0x2532('0x41')]=_['keys'](db[_0x2532('0x3a')][_0x2532('0x3b')]);_0x148865[_0x2532('0x3f')]=_[_0x2532('0x3e')](_0x36c9bc['query']);_0x148865[_0x2532('0x47')]=_[_0x2532('0x40')](_0x148865[_0x2532('0x41')],_0x148865[_0x2532('0x3f')]);_0x276e3b[_0x2532('0x42')]=_[_0x2532('0x40')](_0x148865['model'],qs[_0x2532('0x50')](_0x36c9bc[_0x2532('0x3f')][_0x2532('0x50')]));_0x276e3b['attributes']=_0x276e3b[_0x2532('0x42')][_0x2532('0x43')]?_0x276e3b['attributes']:_0x148865[_0x2532('0x41')];if(_0x36c9bc[_0x2532('0x3f')][_0x2532('0x51')]){_0x276e3b[_0x2532('0x4d')]=[{'all':!![]}];}_0x276e3b=_[_0x2532('0x4a')]({},_0x276e3b,_0x36c9bc[_0x2532('0x52')]);return db[_0x2532('0x3a')][_0x2532('0x53')](_0x276e3b)[_0x2532('0x20')](handleEntityNotFound(_0x5cc8a0,null))[_0x2532('0x20')](respondWithResult(_0x5cc8a0,null))[_0x2532('0x2a')](handleError(_0x5cc8a0,null));};exports[_0x2532('0x54')]=function(_0x37cf3d,_0x7a3c6d){return db[_0x2532('0x3a')][_0x2532('0x54')](_0x37cf3d['body'],{})['then'](respondWithResult(_0x7a3c6d,0xc9))[_0x2532('0x2a')](handleError(_0x7a3c6d,null));};exports[_0x2532('0x35')]=function(_0x5b3b2c,_0x1dc17a){if(_0x5b3b2c['body']['id']){delete _0x5b3b2c[_0x2532('0x55')]['id'];}return db[_0x2532('0x3a')][_0x2532('0x53')]({'where':{'id':_0x5b3b2c['params']['id']}})[_0x2532('0x20')](handleEntityNotFound(_0x1dc17a,null))['then'](saveUpdates(_0x5b3b2c['body'],null))[_0x2532('0x20')](respondWithResult(_0x1dc17a,null))[_0x2532('0x2a')](handleError(_0x1dc17a,null));};exports[_0x2532('0x56')]=function(_0x1ce17e,_0x4db917){return db[_0x2532('0x3a')][_0x2532('0x53')]({'where':{'id':_0x1ce17e[_0x2532('0x4f')]['id']}})[_0x2532('0x20')](handleEntityNotFound(_0x4db917,null))[_0x2532('0x20')](removeEntity(_0x4db917,null))[_0x2532('0x2a')](handleError(_0x4db917,null));};exports[_0x2532('0x57')]=function(_0x1750c6,_0x377665){return db[_0x2532('0x3a')][_0x2532('0x57')]()[_0x2532('0x20')](respondWithResult(_0x377665,null))[_0x2532('0x2a')](handleError(_0x377665,null));};var interaction_log=require(_0x2532('0x13'))(_0x2532('0x58'));exports[_0x2532('0x59')]=function(_0x576f6e,_0x7659a5,_0x5b8cc7){var _0x520c2f={'channel':_0x2532('0x5a')};if(_0x576f6e[_0x2532('0x55')]['id']){delete _0x576f6e['body']['id'];}_0x576f6e[_0x2532('0x55')][_0x2532('0x5b')]=!![];_0x576f6e[_0x2532('0x55')][_0x2532('0x5c')]=moment()['format'](_0x2532('0x5d'));_0x576f6e[_0x2532('0x55')][_0x2532('0x5e')]=_0x576f6e[_0x2532('0x55')][_0x2532('0x5e')]||_0x576f6e[_0x2532('0x5f')]['id'];return db[_0x2532('0x3a')][_0x2532('0x53')]({'where':{'id':_0x576f6e['params']['id'],'UserId':null},'include':[{'model':db[_0x2532('0x60')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x7659a5,null))[_0x2532('0x20')](saveUpdates(_0x576f6e[_0x2532('0x55')],null))[_0x2532('0x20')](function(_0x4c769c){if(_0x4c769c){_0x520c2f[_0x2532('0x28')]=_0x4c769c[_0x2532('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0x2532('0x53')]({'where':{'id':_0x4c769c[_0x2532('0x62')]}});}return null;})[_0x2532('0x20')](handleEntityNotFound(_0x7659a5,null))['then'](function(_0x3c44cd){if(_0x3c44cd){return _0x3c44cd['update']({'UserId':_0x576f6e[_0x2532('0x55')][_0x2532('0x5e')],'read1stAt':_[_0x2532('0x63')](_0x3c44cd[_0x2532('0x64')])?moment()[_0x2532('0x65')](_0x2532('0x5d')):undefined});}return null;})[_0x2532('0x20')](function(_0x5f59a7){if(_0x5f59a7){_0x520c2f[_0x2532('0x66')]=_0x5f59a7[_0x2532('0x61')]({'plain':!![]});interaction_log['info'](_0x2532('0x67'),_0x576f6e[_0x2532('0x5f')]['id'],_0x576f6e[_0x2532('0x5f')][_0x2532('0x37')],_0x576f6e['user'][_0x2532('0x68')],_0x520c2f[_0x2532('0x66')]['id'],_0x576f6e[_0x2532('0x55')]?JSON[_0x2532('0x25')](_0x576f6e['body']):'null');return respondWithRpcPromise(_0x2532('0x69'),_0x2532('0x6a'),_0x520c2f);}return null;})[_0x2532('0x20')](function(_0x2cd4a6){if(_0x2cd4a6){if(_0x576f6e[_0x2532('0x55')][_0x2532('0x6b')]){_0x520c2f[_0x2532('0x28')]['interface']=util['format'](_0x2532('0x6c'),_0x576f6e['user'][_0x2532('0x37')]);_0x520c2f[_0x2532('0x28')][_0x2532('0x6d')]=_0x520c2f[_0x2532('0x6d')];_0x520c2f[_0x2532('0x28')][_0x2532('0x6e')]=_0x2532('0x59');return respondWithRpcPromise(_0x2532('0x6f'),_0x2532('0x6f'),{'event':_0x2532('0x70'),'message':_0x520c2f[_0x2532('0x28')]},client9002)[_0x2532('0x20')](function(){return _0x520c2f;});}return _0x520c2f;}return null;})[_0x2532('0x20')](respondWithResult(_0x7659a5,null))[_0x2532('0x2a')](handleError(_0x7659a5,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x2532('0x71')]=function(_0x4a8f04,_0x12cec9,_0x474d7d){var _0x45b1e0={'agent':{},'channel':_0x2532('0x5a')};if(_0x4a8f04[_0x2532('0x55')]['id']){delete _0x4a8f04[_0x2532('0x55')]['id'];}_0x4a8f04[_0x2532('0x55')][_0x2532('0x5e')]=_0x4a8f04[_0x2532('0x55')][_0x2532('0x5e')]||_0x4a8f04[_0x2532('0x5f')]['id'];_0x45b1e0[_0x2532('0x72')]['id']=_0x4a8f04[_0x2532('0x55')][_0x2532('0x5e')];return db[_0x2532('0x3a')]['find']({'where':{'id':_0x4a8f04[_0x2532('0x4f')]['id'],'UserId':null}})[_0x2532('0x20')](handleEntityNotFound(_0x12cec9,null))[_0x2532('0x20')](function(_0x238e16){if(_0x238e16){_0x45b1e0[_0x2532('0x28')]=_0x238e16[_0x2532('0x61')]({'plain':!![]});return db[_0x2532('0x73')]['find']({'where':{'id':_0x238e16['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x12cec9,null))[_0x2532('0x20')](function(_0x5b6fa4){if(_0x5b6fa4){_0x45b1e0['interaction']=_0x5b6fa4[_0x2532('0x61')]({'plain':!![]});interaction_log[_0x2532('0x21')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a8f04[_0x2532('0x5f')]['id'],_0x4a8f04[_0x2532('0x5f')][_0x2532('0x37')],_0x4a8f04['user'][_0x2532('0x68')],_0x45b1e0[_0x2532('0x66')]['id'],_0x4a8f04[_0x2532('0x55')]?JSON[_0x2532('0x25')](_0x4a8f04[_0x2532('0x55')]):'null');return respondWithRpcPromise('RejectMessage',_0x2532('0x74'),_0x45b1e0);}return null;})[_0x2532('0x20')](function(_0x5bc304){if(_0x5bc304){_0x5bc304[_0x2532('0x28')][_0x2532('0x75')]=util[_0x2532('0x65')](_0x2532('0x6c'),_0x4a8f04[_0x2532('0x5f')][_0x2532('0x37')]);_0x5bc304[_0x2532('0x28')][_0x2532('0x6d')]=_0x45b1e0[_0x2532('0x6d')];_0x5bc304[_0x2532('0x28')]['event']='reject';respondWithRpcPromise(_0x2532('0x6f'),_0x2532('0x6f'),{'event':_0x2532('0x76'),'message':_0x5bc304[_0x2532('0x28')]},client9002);return _0x45b1e0;}return null;})['then'](respondWithResult(_0x12cec9,null))[_0x2532('0x2a')](handleError(_0x12cec9,null));};exports['status']=function(_0x3dfde9,_0x339d3c,_0x33f466){if(_0x3dfde9[_0x2532('0x55')]['id']){delete _0x3dfde9[_0x2532('0x55')]['id'];}var _0xa77204;return db[_0x2532('0x3a')][_0x2532('0x53')]({'where':{'id':_0x3dfde9[_0x2532('0x4f')]['id']}})['then'](handleEntityNotFound(_0x339d3c,null))[_0x2532('0x20')](function(_0x267920){if(_0x267920){_0xa77204=_0x267920;return db[_0x2532('0x77')][_0x2532('0x53')]({'where':{'id':_0x267920[_0x2532('0x78')]}});}})[_0x2532('0x20')](handleEntityNotFound(_0x339d3c,null))[_0x2532('0x20')](function(_0x4645ee){if(_0x4645ee){logger[_0x2532('0x24')](_0x2532('0x79'),_0x2532('0x2c'),_0x2532('0x7a'),_0x4645ee[_0x2532('0x3d')],util[_0x2532('0x7b')](_0x3dfde9[_0x2532('0x55')],{'showHidden':![],'depth':null}));switch(_0x4645ee['type']){case'twilio':if(_0x3dfde9[_0x2532('0x55')][_0x2532('0x7c')]&&_0x3dfde9['body'][_0x2532('0x7c')]===_0xa77204[_0x2532('0x7d')]&&_0x3dfde9['body'][_0x2532('0x7e')]&&_0x3dfde9['body'][_0x2532('0x7e')]===_0x2532('0x5b')){return _0xa77204[_0x2532('0x35')]({'read':!![]});}else{logger['error'](_0x2532('0x7f'),_0x2532('0x2c'),_0x2532('0x80'),util[_0x2532('0x7b')](_0x3dfde9[_0x2532('0x55')],{'showHidden':![],'depth':null}));}break;}return _0xa77204;}})[_0x2532('0x20')](respondWithResult(_0x339d3c,null))[_0x2532('0x2a')](handleError(_0x339d3c,null));}; \ No newline at end of file +var _0x561f=['query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','fields','include','find','create','body','destroy','describe','whatsapp-interactions','accept','whatsapp','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','read1stAt','format','interaction','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','interface','channel','event','EventManager','acceptmessage','WhatsappInteractionId','RejectMessage','SIP/%s','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','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','redis','defaults','localhost','./whatsappMessage.socket','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','sendStatus','status','count','offset','limit','json','apply','reject','update','end','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','model'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x561f,0x1b3));var _0xf561=function(_0x127415,_0x5d93ae){_0x127415=_0x127415-0x0;var _0xe7d513=_0x561f[_0x127415];return _0xe7d513;};'use strict';var pdf=require(_0xf561('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf561('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf561('0x2'));var moment=require('moment');var BPromise=require(_0xf561('0x3'));var Mustache=require(_0xf561('0x4'));var util=require(_0xf561('0x5'));var path=require(_0xf561('0x6'));var sox=require(_0xf561('0x7'));var csv=require(_0xf561('0x8'));var ejs=require(_0xf561('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf561('0xa'));var crypto=require(_0xf561('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf561('0xc'));var toCsv=require(_0xf561('0x8'));var querystring=require(_0xf561('0xd'));var Papa=require(_0xf561('0xe'));var Redis=require(_0xf561('0xf'));var authService=require(_0xf561('0x10'));var qs=require(_0xf561('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf561('0x12'));var logger=require(_0xf561('0x13'))(_0xf561('0x14'));var utils=require(_0xf561('0x15'));var config=require(_0xf561('0x16'));var db=require(_0xf561('0x17'))['db'];config[_0xf561('0x18')]=_[_0xf561('0x19')](config[_0xf561('0x18')],{'host':_0xf561('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf561('0x18')]));require(_0xf561('0x1b'))['register'](socket);var jayson=require(_0xf561('0x1c'));var client=jayson[_0xf561('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xf561('0x1d')][_0xf561('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x490855,_0x5f2875,_0x1ca069){if(_0x1ca069){var _0x15aa17=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x15aa17[_0xf561('0x1f')](_0x5f2875)){return _0x490855;}else{throw new db['Sequelize'][(_0xf561('0x20'))](_0xf561('0x21'));}}else{return _0x490855;}}function respondWithRpcPromise(_0x5aeb53,_0x5dd18f,_0x30a92f,_0x4afaa4){return new BPromise(function(_0xf0ca41,_0x359955){var _0x2204ee=_0x4afaa4||client;return _0x2204ee[_0xf561('0x22')](_0x5aeb53,_0x30a92f)[_0xf561('0x23')](function(_0x315446){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x5dd18f,'request\x20sent');logger[_0xf561('0x24')](_0xf561('0x25'),_0x5dd18f,_0xf561('0x26'),JSON[_0xf561('0x27')](_0x315446));if(_0x315446[_0xf561('0x28')]){if(_0x315446[_0xf561('0x28')][_0xf561('0x29')]===0x1f4){logger[_0xf561('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x5dd18f,_0x315446[_0xf561('0x28')][_0xf561('0x2a')]);return _0x359955(_0x315446['error'][_0xf561('0x2a')]);}logger[_0xf561('0x28')](_0xf561('0x2b'),_0x5dd18f,_0x315446[_0xf561('0x28')]['message']);return _0xf0ca41(_0x315446['error'][_0xf561('0x2a')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x5dd18f,_0xf561('0x26'));_0xf0ca41(_0x315446[_0xf561('0x2c')][_0xf561('0x2a')]);}})[_0xf561('0x2d')](function(_0x28eefb){logger[_0xf561('0x28')](_0xf561('0x2b'),_0x5dd18f,_0x28eefb);_0x359955(_0x28eefb);});});}function respondWithStatusCode(_0x5c752c,_0x4044c3){_0x4044c3=_0x4044c3||0xcc;return function(_0x3c5358){if(_0x3c5358){return _0x5c752c[_0xf561('0x2e')](_0x4044c3);}return _0x5c752c[_0xf561('0x2f')](_0x4044c3)['end']();};}function respondWithResult(_0x5e29fd,_0x2e9c07){_0x2e9c07=_0x2e9c07||0xc8;return function(_0x35ab97){if(_0x35ab97){return _0x5e29fd[_0xf561('0x2f')](_0x2e9c07)['json'](_0x35ab97);}};}function respondWithFilteredResult(_0x259454,_0x22c29e){return function(_0x19ea77){if(_0x19ea77){var _0x46048c=_0x19ea77[_0xf561('0x30')],_0x2fa6a9=_0x22c29e[_0xf561('0x31')],_0x349ebf=_0x22c29e[_0xf561('0x31')]+_0x22c29e[_0xf561('0x32')],_0x1fd1e4;if(_0x349ebf>=_0x46048c){_0x349ebf=_0x46048c;_0x1fd1e4=0xc8;}else{_0x1fd1e4=0xce;}_0x259454[_0xf561('0x2f')](_0x1fd1e4);return _0x259454['set']('Content-Range',_0x2fa6a9+'-'+_0x349ebf+'/'+_0x46048c)[_0xf561('0x33')](_0x19ea77);}return null;};}function patchUpdates(_0x2f0989){return function(_0x421f1e){try{jsonpatch[_0xf561('0x34')](_0x421f1e,_0x2f0989,!![]);}catch(_0x23361c){return BPromise[_0xf561('0x35')](_0x23361c);}return _0x421f1e['save']();};}function saveUpdates(_0xd31701,_0x2ab009){return function(_0x2077c1){if(_0x2077c1){return _0x2077c1[_0xf561('0x36')](_0xd31701)[_0xf561('0x23')](function(_0x5522f4){return _0x5522f4;});}return null;};}function removeEntity(_0x3ce628,_0x38ba16){return function(_0xeabdb){if(_0xeabdb){return _0xeabdb['destroy']()[_0xf561('0x23')](function(){_0x3ce628[_0xf561('0x2f')](0xcc)[_0xf561('0x37')]();});}};}function handleEntityNotFound(_0x225c9b,_0x4f8202){return function(_0xca3f84){if(!_0xca3f84){_0x225c9b[_0xf561('0x2e')](0x194);}return _0xca3f84;};}function handleError(_0x10d915,_0x29d46b){_0x29d46b=_0x29d46b||0x1f4;return function(_0x5acf24){logger['error'](_0x5acf24[_0xf561('0x38')]);if(_0x5acf24[_0xf561('0x39')]){delete _0x5acf24[_0xf561('0x39')];}_0x10d915['status'](_0x29d46b)['send'](_0x5acf24);};}exports[_0xf561('0x3a')]=function(_0x1f0c0d,_0x54b1a4){var _0x3c8815={},_0x1cddcd={},_0x4a27ce={'count':0x0,'rows':[]};var _0x705f41=_[_0xf561('0x3b')](db[_0xf561('0x3c')][_0xf561('0x3d')],function(_0x5dbd09){return{'name':_0x5dbd09[_0xf561('0x3e')],'type':_0x5dbd09[_0xf561('0x3f')]['key']};});_0x1cddcd[_0xf561('0x40')]=_[_0xf561('0x3b')](_0x705f41,_0xf561('0x39'));_0x1cddcd[_0xf561('0x41')]=_[_0xf561('0x42')](_0x1f0c0d[_0xf561('0x41')]);_0x1cddcd[_0xf561('0x43')]=_[_0xf561('0x44')](_0x1cddcd['model'],_0x1cddcd[_0xf561('0x41')]);_0x3c8815['attributes']=_[_0xf561('0x44')](_0x1cddcd['model'],qs['fields'](_0x1f0c0d[_0xf561('0x41')]['fields']));_0x3c8815[_0xf561('0x45')]=_0x3c8815[_0xf561('0x45')][_0xf561('0x46')]?_0x3c8815['attributes']:_0x1cddcd['model'];if(!_0x1f0c0d['query'][_0xf561('0x47')]('nolimit')){_0x3c8815[_0xf561('0x32')]=qs[_0xf561('0x32')](_0x1f0c0d[_0xf561('0x41')][_0xf561('0x32')]);_0x3c8815[_0xf561('0x31')]=qs[_0xf561('0x31')](_0x1f0c0d['query'][_0xf561('0x31')]);}_0x3c8815['order']=qs['sort'](_0x1f0c0d[_0xf561('0x41')][_0xf561('0x48')]);_0x3c8815[_0xf561('0x49')]=qs[_0xf561('0x43')](_['pick'](_0x1f0c0d[_0xf561('0x41')],_0x1cddcd[_0xf561('0x43')]),_0x705f41);if(_0x1f0c0d[_0xf561('0x41')][_0xf561('0x4a')]){_0x3c8815[_0xf561('0x49')]=_[_0xf561('0x4b')](_0x3c8815[_0xf561('0x49')],{'$or':_[_0xf561('0x3b')](_0x705f41,function(_0x444060){if(_0x444060[_0xf561('0x3f')]!==_0xf561('0x4c')){var _0xe923d3={};_0xe923d3[_0x444060[_0xf561('0x39')]]={'$like':'%'+_0x1f0c0d[_0xf561('0x41')][_0xf561('0x4a')]+'%'};return _0xe923d3;}})});}_0x3c8815=_['merge']({},_0x3c8815,_0x1f0c0d[_0xf561('0x4d')]);var _0x4bbe81={'where':_0x3c8815[_0xf561('0x49')]};return db[_0xf561('0x3c')][_0xf561('0x30')](_0x4bbe81)[_0xf561('0x23')](function(_0x3e3e25){_0x4a27ce[_0xf561('0x30')]=_0x3e3e25;if(_0x1f0c0d['query'][_0xf561('0x4e')]){_0x3c8815['include']=[{'all':!![]}];}return db[_0xf561('0x3c')][_0xf561('0x4f')](_0x3c8815);})[_0xf561('0x23')](function(_0x541b59){_0x4a27ce['rows']=_0x541b59;return _0x4a27ce;})['then'](respondWithFilteredResult(_0x54b1a4,_0x3c8815))[_0xf561('0x2d')](handleError(_0x54b1a4,null));};exports[_0xf561('0x50')]=function(_0x55c4fd,_0x3337df){var _0x185470={'raw':!![],'where':{'id':_0x55c4fd[_0xf561('0x51')]['id']}},_0x265e1b={};_0x265e1b['model']=_[_0xf561('0x42')](db[_0xf561('0x3c')][_0xf561('0x3d')]);_0x265e1b['query']=_[_0xf561('0x42')](_0x55c4fd['query']);_0x265e1b[_0xf561('0x43')]=_[_0xf561('0x44')](_0x265e1b[_0xf561('0x40')],_0x265e1b['query']);_0x185470[_0xf561('0x45')]=_[_0xf561('0x44')](_0x265e1b['model'],qs[_0xf561('0x52')](_0x55c4fd[_0xf561('0x41')][_0xf561('0x52')]));_0x185470[_0xf561('0x45')]=_0x185470[_0xf561('0x45')][_0xf561('0x46')]?_0x185470[_0xf561('0x45')]:_0x265e1b[_0xf561('0x40')];if(_0x55c4fd[_0xf561('0x41')][_0xf561('0x4e')]){_0x185470[_0xf561('0x53')]=[{'all':!![]}];}_0x185470=_['merge']({},_0x185470,_0x55c4fd['options']);return db['WhatsappMessage'][_0xf561('0x54')](_0x185470)[_0xf561('0x23')](handleEntityNotFound(_0x3337df,null))[_0xf561('0x23')](respondWithResult(_0x3337df,null))['catch'](handleError(_0x3337df,null));};exports['create']=function(_0x2b254b,_0x5ca52c){return db['WhatsappMessage'][_0xf561('0x55')](_0x2b254b[_0xf561('0x56')],{})[_0xf561('0x23')](respondWithResult(_0x5ca52c,0xc9))[_0xf561('0x2d')](handleError(_0x5ca52c,null));};exports[_0xf561('0x36')]=function(_0x3e00ff,_0x1438a0){if(_0x3e00ff['body']['id']){delete _0x3e00ff[_0xf561('0x56')]['id'];}return db['WhatsappMessage'][_0xf561('0x54')]({'where':{'id':_0x3e00ff[_0xf561('0x51')]['id']}})[_0xf561('0x23')](handleEntityNotFound(_0x1438a0,null))[_0xf561('0x23')](saveUpdates(_0x3e00ff[_0xf561('0x56')],null))[_0xf561('0x23')](respondWithResult(_0x1438a0,null))[_0xf561('0x2d')](handleError(_0x1438a0,null));};exports[_0xf561('0x57')]=function(_0x1f7ece,_0x9af544){return db[_0xf561('0x3c')]['find']({'where':{'id':_0x1f7ece[_0xf561('0x51')]['id']}})['then'](handleEntityNotFound(_0x9af544,null))[_0xf561('0x23')](removeEntity(_0x9af544,null))[_0xf561('0x2d')](handleError(_0x9af544,null));};exports[_0xf561('0x58')]=function(_0x1c4520,_0xac130e){return db[_0xf561('0x3c')][_0xf561('0x58')]()[_0xf561('0x23')](respondWithResult(_0xac130e,null))[_0xf561('0x2d')](handleError(_0xac130e,null));};var interaction_log=require(_0xf561('0x13'))(_0xf561('0x59'));exports[_0xf561('0x5a')]=function(_0x5c4e52,_0x2ca2d5,_0x23a16){var _0x43e375={'channel':_0xf561('0x5b')};if(_0x5c4e52['body']['id']){delete _0x5c4e52[_0xf561('0x56')]['id'];}_0x5c4e52[_0xf561('0x56')][_0xf561('0x5c')]=!![];_0x5c4e52[_0xf561('0x56')]['readAt']=moment()['format'](_0xf561('0x5d'));_0x5c4e52[_0xf561('0x56')][_0xf561('0x5e')]=_0x5c4e52[_0xf561('0x56')][_0xf561('0x5e')]||_0x5c4e52[_0xf561('0x5f')]['id'];return db[_0xf561('0x3c')][_0xf561('0x54')]({'where':{'id':_0x5c4e52[_0xf561('0x51')]['id'],'UserId':null},'include':[{'model':db[_0xf561('0x60')],'as':_0xf561('0x61')}]})[_0xf561('0x23')](handleEntityNotFound(_0x2ca2d5,null))[_0xf561('0x23')](saveUpdates(_0x5c4e52['body'],null))[_0xf561('0x23')](function(_0x310541){if(_0x310541){_0x43e375[_0xf561('0x2a')]=_0x310541[_0xf561('0x62')]({'plain':!![]});return db[_0xf561('0x63')][_0xf561('0x54')]({'where':{'id':_0x310541['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2ca2d5,null))[_0xf561('0x23')](function(_0x413c55){if(_0x413c55){return _0x413c55['update']({'UserId':_0x5c4e52['body']['UserId'],'read1stAt':_['isNil'](_0x413c55[_0xf561('0x64')])?moment()[_0xf561('0x65')](_0xf561('0x5d')):undefined});}return null;})[_0xf561('0x23')](function(_0x3fe91b){if(_0x3fe91b){_0x43e375[_0xf561('0x66')]=_0x3fe91b[_0xf561('0x62')]({'plain':!![]});interaction_log[_0xf561('0x67')](_0xf561('0x68'),_0x5c4e52[_0xf561('0x5f')]['id'],_0x5c4e52['user'][_0xf561('0x39')],_0x5c4e52[_0xf561('0x5f')][_0xf561('0x69')],_0x43e375['interaction']['id'],_0x5c4e52[_0xf561('0x56')]?JSON[_0xf561('0x27')](_0x5c4e52[_0xf561('0x56')]):_0xf561('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xf561('0x6b'),_0x43e375);}return null;})[_0xf561('0x23')](function(_0x6ee15f){if(_0x6ee15f){if(_0x5c4e52['body']['manual']){_0x43e375[_0xf561('0x2a')][_0xf561('0x6c')]=util['format']('SIP/%s',_0x5c4e52['user'][_0xf561('0x39')]);_0x43e375[_0xf561('0x2a')][_0xf561('0x6d')]=_0x43e375[_0xf561('0x6d')];_0x43e375[_0xf561('0x2a')][_0xf561('0x6e')]=_0xf561('0x5a');return respondWithRpcPromise(_0xf561('0x6f'),'EventManager',{'event':_0xf561('0x70'),'message':_0x43e375[_0xf561('0x2a')]},client9002)[_0xf561('0x23')](function(){return _0x43e375;});}return _0x43e375;}return null;})['then'](respondWithResult(_0x2ca2d5,null))[_0xf561('0x2d')](handleError(_0x2ca2d5,null));};var interaction_log=require(_0xf561('0x13'))(_0xf561('0x59'));exports['reject']=function(_0x592b73,_0x137ebf,_0x1a9208){var _0x2a5d2d={'agent':{},'channel':'whatsapp'};if(_0x592b73[_0xf561('0x56')]['id']){delete _0x592b73['body']['id'];}_0x592b73[_0xf561('0x56')][_0xf561('0x5e')]=_0x592b73[_0xf561('0x56')][_0xf561('0x5e')]||_0x592b73['user']['id'];_0x2a5d2d['agent']['id']=_0x592b73[_0xf561('0x56')][_0xf561('0x5e')];return db['WhatsappMessage'][_0xf561('0x54')]({'where':{'id':_0x592b73[_0xf561('0x51')]['id'],'UserId':null}})[_0xf561('0x23')](handleEntityNotFound(_0x137ebf,null))['then'](function(_0x2929a8){if(_0x2929a8){_0x2a5d2d['message']=_0x2929a8[_0xf561('0x62')]({'plain':!![]});return db[_0xf561('0x63')][_0xf561('0x54')]({'where':{'id':_0x2929a8[_0xf561('0x71')]}});}return null;})[_0xf561('0x23')](handleEntityNotFound(_0x137ebf,null))[_0xf561('0x23')](function(_0x7327b3){if(_0x7327b3){_0x2a5d2d['interaction']=_0x7327b3['get']({'plain':!![]});interaction_log[_0xf561('0x67')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x592b73['user']['id'],_0x592b73[_0xf561('0x5f')]['name'],_0x592b73[_0xf561('0x5f')]['role'],_0x2a5d2d[_0xf561('0x66')]['id'],_0x592b73[_0xf561('0x56')]?JSON[_0xf561('0x27')](_0x592b73[_0xf561('0x56')]):'null');return respondWithRpcPromise(_0xf561('0x72'),'rejectMessage',_0x2a5d2d);}return null;})[_0xf561('0x23')](function(_0x5d14b8){if(_0x5d14b8){_0x5d14b8[_0xf561('0x2a')][_0xf561('0x6c')]=util['format'](_0xf561('0x73'),_0x592b73[_0xf561('0x5f')]['name']);_0x5d14b8[_0xf561('0x2a')][_0xf561('0x6d')]=_0x2a5d2d['channel'];_0x5d14b8[_0xf561('0x2a')][_0xf561('0x6e')]='reject';respondWithRpcPromise(_0xf561('0x6f'),_0xf561('0x6f'),{'event':_0xf561('0x74'),'message':_0x5d14b8[_0xf561('0x2a')]},client9002);return _0x2a5d2d;}return null;})['then'](respondWithResult(_0x137ebf,null))[_0xf561('0x2d')](handleError(_0x137ebf,null));};exports['status']=function(_0x5a9365,_0x1d0cc6,_0x465ffc){if(_0x5a9365['body']['id']){delete _0x5a9365[_0xf561('0x56')]['id'];}var _0x32c8af;return db['WhatsappMessage'][_0xf561('0x54')]({'where':{'id':_0x5a9365['params']['id']}})[_0xf561('0x23')](handleEntityNotFound(_0x1d0cc6,null))['then'](function(_0xf487ca){if(_0xf487ca){_0x32c8af=_0xf487ca;return db['WhatsappAccount'][_0xf561('0x54')]({'where':{'id':_0xf487ca[_0xf561('0x75')]}});}})['then'](handleEntityNotFound(_0x1d0cc6,null))[_0xf561('0x23')](function(_0xaf223b){if(_0xaf223b){logger['debug'](_0xf561('0x76'),_0xf561('0x2f'),_0xf561('0x77'),_0xaf223b[_0xf561('0x3f')],util[_0xf561('0x78')](_0x5a9365[_0xf561('0x56')],{'showHidden':![],'depth':null}));switch(_0xaf223b[_0xf561('0x3f')]){case _0xf561('0x79'):if(_0x5a9365[_0xf561('0x56')]['MessageSid']&&_0x5a9365['body']['MessageSid']===_0x32c8af[_0xf561('0x7a')]&&_0x5a9365[_0xf561('0x56')]['MessageStatus']&&_0x5a9365[_0xf561('0x56')][_0xf561('0x7b')]===_0xf561('0x5c')){return _0x32c8af[_0xf561('0x36')]({'read':!![]});}else{logger[_0xf561('0x28')](_0xf561('0x7c'),_0xf561('0x2f'),_0xf561('0x79'),util[_0xf561('0x78')](_0x5a9365[_0xf561('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x32c8af;}})[_0xf561('0x23')](respondWithResult(_0x1d0cc6,null))['catch'](handleError(_0x1d0cc6,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 008539b..855a2fc 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(_0x42ef5d,_0x2c94f1){var _0xd655c1=function(_0x333505){while(--_0x333505){_0x42ef5d['push'](_0x42ef5d['shift']());}};_0xd655c1(++_0x2c94f1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x40dcd1,_0x5cd1da){_0x40dcd1=_0x40dcd1-0x0;var _0x5c056b=_0x5f2f[_0x40dcd1];return _0x5c056b;};'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(_0x38228d,_0x195238){var _0x3c8e4a=function(_0x50a94d){while(--_0x50a94d){_0x38228d['push'](_0x38228d['shift']());}};_0x3c8e4a(++_0x195238);}(_0xb10b,0x12a));var _0xbb10=function(_0x263714,_0x399b37){_0x263714=_0x263714-0x0;var _0x1cd43d=_0xb10b[_0x263714];return _0x1cd43d;};'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 7b97dfa..31c6762 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 _0x6e63=['WhatsappInteraction','findOne','WhatsappInteractionId','then','update','error','WhatsappAccount','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','finally','utf8mb4_unicode_ci','lodash','util','moment','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0x6e63,0x74));var _0x36e6=function(_0x389849,_0x3f0d07){_0x389849=_0x389849-0x0;var _0x65251c=_0x6e63[_0x389849];return _0x65251c;};'use strict';var _=require(_0x36e6('0x0'));var util=require(_0x36e6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x36e6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x36e6('0x3'));var config=require(_0x36e6('0x4'));var attributes=require(_0x36e6('0x5'));module[_0x36e6('0x6')]=function(_0x221e0b,_0xbcf4f2){return _0x221e0b[_0x36e6('0x7')](_0x36e6('0x8'),attributes,{'tableName':_0x36e6('0x9'),'paranoid':![],'indexes':[{'name':_0x36e6('0xa'),'fields':[_0x36e6('0xa')]},{'name':_0x36e6('0xb'),'fields':[_0x36e6('0xc')],'type':_0x36e6('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d43cf,_0x501b3c,_0xda22bc){var _0x3b8521=_0x221e0b[_0x36e6('0xe')];var _0x3ce4d1=_0x3d43cf[_0x36e6('0xf')]({'plain':!![]});if(_0x3ce4d1[_0x36e6('0x10')][_0x36e6('0x11')]()==='in'||_0x3ce4d1[_0x36e6('0x10')]['toLowerCase']()===_0x36e6('0x12')&&!_0x3ce4d1[_0x36e6('0x13')]&&!_[_0x36e6('0x14')](_0x3ce4d1[_0x36e6('0x15')])){_0x3b8521[_0x36e6('0x16')][_0x36e6('0x17')]({'where':{'id':_0x3ce4d1[_0x36e6('0x18')]}})[_0x36e6('0x19')](function(_0x2b3cf2){if(_0x2b3cf2){_0x2b3cf2[_0x36e6('0x1a')]({'lastMsgAt':_0x3ce4d1['createdAt'],'lastMsgDirection':_0x3ce4d1[_0x36e6('0x10')][_0x36e6('0x11')]()});}})['catch'](function(_0x51ba69){console[_0x36e6('0x1b')](_0x51ba69);});}if(_0x3ce4d1[_0x36e6('0x10')]===_0x36e6('0x12')&&!_0x3ce4d1[_0x36e6('0x13')]){var _0x3331e2;_0x3b8521[_0x36e6('0x1c')]['find']({'where':{'id':_0x3ce4d1['WhatsappAccountId']},'raw':!![]})[_0x36e6('0x19')](function(_0x27a737){_0x3331e2=_0x27a737;if(_0x3331e2&&_0x3331e2[_0x36e6('0x1d')]){switch(_0x3331e2[_0x36e6('0x1d')]){case'twilio':var _0x18c6ab=require(_0x36e6('0x1e'));if(_0x3331e2[_0x36e6('0x1f')]&&_0x3331e2[_0x36e6('0x20')]&&_0x3331e2[_0x36e6('0x21')]){var _0x1b8088=new _0x18c6ab(_0x3331e2[_0x36e6('0x1f')],_0x3331e2[_0x36e6('0x20')]);_0x1b8088[_0x36e6('0x22')][_0x36e6('0x23')]({'body':_0x3ce4d1[_0x36e6('0xc')],'to':'whatsapp:'+_0x3ce4d1[_0x36e6('0x21')],'from':_0x36e6('0x24')+_0x3331e2['phone'],'statusCallback':_0x3331e2['remote']+_0x36e6('0x25')+_0x3ce4d1['id']+_0x36e6('0x26')+_0x3331e2[_0x36e6('0x27')]})[_0x36e6('0x19')](function(_0xa0754d){if(_0xa0754d[_0x36e6('0x28')]){return _0x3d43cf[_0x36e6('0x1a')]({'messageId':_0xa0754d[_0x36e6('0x28')]});}})['catch'](function(_0x1a5347){logger[_0x36e6('0x1b')](_0x36e6('0x29'),_0x36e6('0x2a'),'twilio',util[_0x36e6('0x2b')](_0x1a5347,{'showHidden':![],'depth':null}));});}else{logger[_0x36e6('0x1b')](_0x36e6('0x29'),_0x36e6('0x2a'),_0x36e6('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x36e6('0x2c')](function(){_0xda22bc();});}else{_0xda22bc();}}},'charset':'utf8mb4','collate':_0x36e6('0x2d')});}; \ No newline at end of file +var _0x1448=['body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','utf8mb4','../../config/logger','moment','request-promise','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages'];(function(_0x583bf8,_0x1e81fd){var _0x588bb6=function(_0x3a4144){while(--_0x3a4144){_0x583bf8['push'](_0x583bf8['shift']());}};_0x588bb6(++_0x1e81fd);}(_0x1448,0x1ad));var _0x8144=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1448[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8144('0x0'))('api');var moment=require(_0x8144('0x1'));var BPromise=require('bluebird');var rp=require(_0x8144('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8144('0x3'));var config=require(_0x8144('0x4'));var attributes=require('./whatsappMessage.attributes');module[_0x8144('0x5')]=function(_0x369d16,_0x41db58){return _0x369d16[_0x8144('0x6')](_0x8144('0x7'),attributes,{'tableName':_0x8144('0x8'),'paranoid':![],'indexes':[{'name':_0x8144('0x9'),'fields':[_0x8144('0x9')]},{'name':_0x8144('0xa'),'fields':[_0x8144('0xb')],'type':_0x8144('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5270d1,_0x2fe87c,_0x123dcc){var _0x59eb60=_0x369d16[_0x8144('0xd')];var _0x49df46=_0x5270d1[_0x8144('0xe')]({'plain':!![]});if(_0x49df46[_0x8144('0xf')][_0x8144('0x10')]()==='in'||_0x49df46[_0x8144('0xf')]['toLowerCase']()===_0x8144('0x11')&&!_0x49df46['secret']&&!_[_0x8144('0x12')](_0x49df46[_0x8144('0x13')])){_0x59eb60[_0x8144('0x14')][_0x8144('0x15')]({'where':{'id':_0x49df46[_0x8144('0x16')]}})[_0x8144('0x17')](function(_0x1c3637){if(_0x1c3637){_0x1c3637[_0x8144('0x18')]({'lastMsgAt':_0x49df46[_0x8144('0x19')],'lastMsgDirection':_0x49df46['direction'][_0x8144('0x10')]()});}})[_0x8144('0x1a')](function(_0x1586f8){console['error'](_0x1586f8);});}if(_0x49df46[_0x8144('0xf')]===_0x8144('0x11')&&!_0x49df46['secret']){var _0x426a03;_0x59eb60[_0x8144('0x1b')][_0x8144('0x1c')]({'where':{'id':_0x49df46[_0x8144('0x1d')]},'raw':!![]})[_0x8144('0x17')](function(_0x3fa055){_0x426a03=_0x3fa055;if(_0x426a03&&_0x426a03[_0x8144('0x1e')]){switch(_0x426a03['type']){case'twilio':var _0x3c5c13=require(_0x8144('0x1f'));if(_0x426a03['accountSid']&&_0x426a03[_0x8144('0x20')]&&_0x426a03[_0x8144('0x21')]){var _0x15dddf=new _0x3c5c13(_0x426a03['accountSid'],_0x426a03[_0x8144('0x20')]);_0x15dddf[_0x8144('0x22')][_0x8144('0x23')]({'body':_0x49df46[_0x8144('0xb')],'to':_0x8144('0x24')+_0x49df46[_0x8144('0x21')],'from':_0x8144('0x24')+_0x426a03['phone'],'statusCallback':_0x426a03['remote']+_0x8144('0x25')+_0x49df46['id']+_0x8144('0x26')+_0x426a03[_0x8144('0x27')]})[_0x8144('0x17')](function(_0x1a70e3){if(_0x1a70e3[_0x8144('0x28')]){return _0x5270d1[_0x8144('0x18')]({'messageId':_0x1a70e3[_0x8144('0x28')]});}})[_0x8144('0x1a')](function(_0x1feefc){logger['error'](_0x8144('0x29'),_0x8144('0x2a'),_0x8144('0x1f'),util['inspect'](_0x1feefc,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x8144('0x2a'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})['finally'](function(){_0x123dcc();});}else{_0x123dcc();}}},'charset':_0x8144('0x2b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 62c16b3..f82a3bc 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 _0x3a8d=['request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x462450,_0x44f0bd){var _0x391d6a=function(_0x525e26){while(--_0x525e26){_0x462450['push'](_0x462450['shift']());}};_0x391d6a(++_0x44f0bd);}(_0x3a8d,0x1cf));var _0xd3a8=function(_0x3b3210,_0x25e8ed){_0x3b3210=_0x3b3210-0x0;var _0x5b5484=_0x3a8d[_0x3b3210];return _0x5b5484;};'use strict';var _=require(_0xd3a8('0x0'));var util=require(_0xd3a8('0x1'));var moment=require(_0xd3a8('0x2'));var BPromise=require('bluebird');var rs=require(_0xd3a8('0x3'));var fs=require('fs');var Redis=require(_0xd3a8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd3a8('0x5'));var logger=require(_0xd3a8('0x6'))(_0xd3a8('0x7'));var config=require(_0xd3a8('0x8'));var jayson=require(_0xd3a8('0x9'));var client=jayson[_0xd3a8('0xa')][_0xd3a8('0xb')]({'port':0x232a});config[_0xd3a8('0xc')]=_[_0xd3a8('0xd')](config[_0xd3a8('0xc')],{'host':_0xd3a8('0xe'),'port':0x18eb});var socket=require(_0xd3a8('0xf'))(new Redis(config[_0xd3a8('0xc')]));require('./whatsappMessage.socket')[_0xd3a8('0x10')](socket);function respondWithRpcPromise(_0x385144,_0x18e75b,_0x45ae45){return new BPromise(function(_0x59861b,_0x33e429){return client[_0xd3a8('0x11')](_0x385144,_0x45ae45)[_0xd3a8('0x12')](function(_0x30e871){logger[_0xd3a8('0x13')](_0xd3a8('0x14'),_0x18e75b,_0xd3a8('0x15'));logger[_0xd3a8('0x16')](_0xd3a8('0x17'),_0x18e75b,_0xd3a8('0x15'),JSON[_0xd3a8('0x18')](_0x30e871));if(_0x30e871[_0xd3a8('0x19')]){if(_0x30e871[_0xd3a8('0x19')]['code']===0x1f4){logger[_0xd3a8('0x19')](_0xd3a8('0x14'),_0x18e75b,_0x30e871[_0xd3a8('0x19')][_0xd3a8('0x1a')]);return _0x33e429(_0x30e871['error'][_0xd3a8('0x1a')]);}logger[_0xd3a8('0x19')](_0xd3a8('0x14'),_0x18e75b,_0x30e871[_0xd3a8('0x19')][_0xd3a8('0x1a')]);return _0x59861b(_0x30e871['error']['message']);}else{logger[_0xd3a8('0x13')](_0xd3a8('0x14'),_0x18e75b,_0xd3a8('0x15'));_0x59861b(_0x30e871['result'][_0xd3a8('0x1a')]);}})[_0xd3a8('0x1b')](function(_0x349e43){logger[_0xd3a8('0x19')]('WhatsappMessage,\x20%s,\x20%s',_0x18e75b,_0x349e43);_0x33e429(_0x349e43);});});}exports[_0xd3a8('0x1c')]=function(_0x3b2e4a){var _0x216b3b=this;return new Promise(function(_0x367365,_0x4226ea){return db[_0xd3a8('0x1d')][_0xd3a8('0x1e')](_0x3b2e4a[_0xd3a8('0x1f')],{'raw':_0x3b2e4a['options']?_0x3b2e4a['options']['raw']===undefined?!![]:![]:!![]})[_0xd3a8('0x12')](function(_0x1dd79b){logger['info'](_0xd3a8('0x1c'),_0x3b2e4a);logger[_0xd3a8('0x16')](_0xd3a8('0x1c'),_0x3b2e4a,JSON[_0xd3a8('0x18')](_0x1dd79b));_0x367365(_0x1dd79b);})[_0xd3a8('0x1b')](function(_0x5593fa){logger[_0xd3a8('0x19')]('CreateWhatsappMessage',_0x5593fa[_0xd3a8('0x1a')],_0x3b2e4a);_0x4226ea(_0x216b3b[_0xd3a8('0x19')](0x1f4,_0x5593fa[_0xd3a8('0x1a')]));});});}; \ No newline at end of file +var _0x4be5=['code','message','info','result','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0x4be5,0x74));var _0x54be=function(_0x4eec9b,_0x4aea09){_0x4eec9b=_0x4eec9b-0x0;var _0x2e3849=_0x4be5[_0x4eec9b];return _0x2e3849;};'use strict';var _=require(_0x54be('0x0'));var util=require(_0x54be('0x1'));var moment=require(_0x54be('0x2'));var BPromise=require(_0x54be('0x3'));var rs=require(_0x54be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54be('0x5'))['db'];var utils=require(_0x54be('0x6'));var logger=require(_0x54be('0x7'))(_0x54be('0x8'));var config=require(_0x54be('0x9'));var jayson=require(_0x54be('0xa'));var client=jayson['client'][_0x54be('0xb')]({'port':0x232a});config[_0x54be('0xc')]=_[_0x54be('0xd')](config['redis'],{'host':_0x54be('0xe'),'port':0x18eb});var socket=require(_0x54be('0xf'))(new Redis(config[_0x54be('0xc')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x22fb17,_0xb48ab3,_0x44a515){return new BPromise(function(_0x53140d,_0x3d72e8){return client[_0x54be('0x10')](_0x22fb17,_0x44a515)[_0x54be('0x11')](function(_0x3a2cb3){logger['info'](_0x54be('0x12'),_0xb48ab3,_0x54be('0x13'));logger[_0x54be('0x14')](_0x54be('0x15'),_0xb48ab3,_0x54be('0x13'),JSON[_0x54be('0x16')](_0x3a2cb3));if(_0x3a2cb3[_0x54be('0x17')]){if(_0x3a2cb3['error'][_0x54be('0x18')]===0x1f4){logger[_0x54be('0x17')](_0x54be('0x12'),_0xb48ab3,_0x3a2cb3[_0x54be('0x17')][_0x54be('0x19')]);return _0x3d72e8(_0x3a2cb3[_0x54be('0x17')][_0x54be('0x19')]);}logger[_0x54be('0x17')](_0x54be('0x12'),_0xb48ab3,_0x3a2cb3[_0x54be('0x17')]['message']);return _0x53140d(_0x3a2cb3['error'][_0x54be('0x19')]);}else{logger[_0x54be('0x1a')](_0x54be('0x12'),_0xb48ab3,'request\x20sent');_0x53140d(_0x3a2cb3[_0x54be('0x1b')][_0x54be('0x19')]);}})['catch'](function(_0x23dffe){logger['error'](_0x54be('0x12'),_0xb48ab3,_0x23dffe);_0x3d72e8(_0x23dffe);});});}exports[_0x54be('0x1c')]=function(_0x136e3e){var _0x219e58=this;return new Promise(function(_0x4c2fa1,_0xf8df5d){return db[_0x54be('0x1d')][_0x54be('0x1e')](_0x136e3e[_0x54be('0x1f')],{'raw':_0x136e3e['options']?_0x136e3e[_0x54be('0x20')][_0x54be('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x398771){logger[_0x54be('0x1a')]('CreateWhatsappMessage',_0x136e3e);logger[_0x54be('0x14')](_0x54be('0x1c'),_0x136e3e,JSON[_0x54be('0x16')](_0x398771));_0x4c2fa1(_0x398771);})[_0x54be('0x22')](function(_0x53d4db){logger[_0x54be('0x17')](_0x54be('0x1c'),_0x53d4db[_0x54be('0x19')],_0x136e3e);_0xf8df5d(_0x219e58[_0x54be('0x17')](0x1f4,_0x53d4db['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 4b2d7a6..07d558b 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 _0xbc6c=['removeListener','register','whatsappMessage:','./whatsappMessage.events','save','update','emit'];(function(_0x46c59b,_0x5635dd){var _0x16dd2d=function(_0x4e7378){while(--_0x4e7378){_0x46c59b['push'](_0x46c59b['shift']());}};_0x16dd2d(++_0x5635dd);}(_0xbc6c,0xc0));var _0xcbc6=function(_0x2f9de6,_0x129db2){_0x2f9de6=_0x2f9de6-0x0;var _0x129303=_0xbc6c[_0x2f9de6];return _0x129303;};'use strict';var WhatsappMessageEvents=require(_0xcbc6('0x0'));var events=[_0xcbc6('0x1'),'remove',_0xcbc6('0x2')];function createListener(_0x10bdc8,_0x1591b0){return function(_0x5575e0){_0x1591b0[_0xcbc6('0x3')](_0x10bdc8,_0x5575e0);};}function removeListener(_0x51db5c,_0x3687b0){return function(){WhatsappMessageEvents[_0xcbc6('0x4')](_0x51db5c,_0x3687b0);};}exports[_0xcbc6('0x5')]=function(_0x4f31af){for(var _0x5b8747=0x0,_0x26331f=events['length'];_0x5b8747<_0x26331f;_0x5b8747++){var _0x453312=events[_0x5b8747];var _0x38409=createListener(_0xcbc6('0x6')+_0x453312,_0x4f31af);WhatsappMessageEvents['on'](_0x453312,_0x38409);}}; \ No newline at end of file +var _0x5e52=['removeListener','register','length','remove','update','emit'];(function(_0x3a10c3,_0x39e380){var _0x524306=function(_0x5f4996){while(--_0x5f4996){_0x3a10c3['push'](_0x3a10c3['shift']());}};_0x524306(++_0x39e380);}(_0x5e52,0x105));var _0x25e5=function(_0x527d25,_0x562df2){_0x527d25=_0x527d25-0x0;var _0x4d06b4=_0x5e52[_0x527d25];return _0x4d06b4;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x25e5('0x0'),_0x25e5('0x1')];function createListener(_0x44239b,_0x1c0243){return function(_0x3c3dd8){_0x1c0243[_0x25e5('0x2')](_0x44239b,_0x3c3dd8);};}function removeListener(_0x19ae44,_0x2e4518){return function(){WhatsappMessageEvents[_0x25e5('0x3')](_0x19ae44,_0x2e4518);};}exports[_0x25e5('0x4')]=function(_0x2aa402){for(var _0x1dbf42=0x0,_0x249ad1=events[_0x25e5('0x5')];_0x1dbf42<_0x249ad1;_0x1dbf42++){var _0x1ff859=events[_0x1dbf42];var _0x56d69d=createListener('whatsappMessage:'+_0x1ff859,_0x2aa402);WhatsappMessageEvents['on'](_0x1ff859,_0x56d69d);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e6c6792..130fd00 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 _0xf57b=['addTeams','addAgents','put','/:id','update','removeTeams','delete','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','post'];(function(_0x25fdbb,_0x586736){var _0x35bcc5=function(_0x479abb){while(--_0x479abb){_0x25fdbb['push'](_0x25fdbb['shift']());}};_0x35bcc5(++_0x586736);}(_0xf57b,0x13c));var _0xbf57=function(_0x14d55f,_0xaa0e97){_0x14d55f=_0x14d55f-0x0;var _0x576412=_0xf57b[_0x14d55f];return _0x576412;};'use strict';var multer=require('multer');var util=require(_0xbf57('0x0'));var path=require(_0xbf57('0x1'));var timeout=require(_0xbf57('0x2'));var express=require(_0xbf57('0x3'));var router=express[_0xbf57('0x4')]();var auth=require(_0xbf57('0x5'));var interaction=require(_0xbf57('0x6'));var config=require(_0xbf57('0x7'));var controller=require(_0xbf57('0x8'));router[_0xbf57('0x9')]('/',auth[_0xbf57('0xa')](),controller[_0xbf57('0xb')]);router[_0xbf57('0x9')](_0xbf57('0xc'),auth[_0xbf57('0xa')](),controller[_0xbf57('0xd')]);router[_0xbf57('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xbf57('0xe')]);router[_0xbf57('0x9')](_0xbf57('0xf'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbf57('0x9')](_0xbf57('0x10'),auth['isAuthenticated'](),controller[_0xbf57('0x11')]);router['get'](_0xbf57('0x12'),auth[_0xbf57('0xa')](),controller['getAgents']);router[_0xbf57('0x13')]('/',auth[_0xbf57('0xa')](),controller['create']);router[_0xbf57('0x13')](_0xbf57('0x10'),auth[_0xbf57('0xa')](),controller[_0xbf57('0x14')]);router[_0xbf57('0x13')]('/:id/users',auth[_0xbf57('0xa')](),controller[_0xbf57('0x15')]);router[_0xbf57('0x16')](_0xbf57('0x17'),auth[_0xbf57('0xa')](),controller[_0xbf57('0x18')]);router['delete'](_0xbf57('0x17'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xbf57('0x10'),auth['isAuthenticated'](),controller[_0xbf57('0x19')]);router[_0xbf57('0x1a')](_0xbf57('0x12'),auth[_0xbf57('0xa')](),controller[_0xbf57('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xa6ec=['getAgents','post','addTeams','/:id/users','addAgents','put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','/:id/teams','getTeams'];(function(_0x45262e,_0x1d9c0b){var _0x3b7f60=function(_0x1d7a53){while(--_0x1d7a53){_0x45262e['push'](_0x45262e['shift']());}};_0x3b7f60(++_0x1d9c0b);}(_0xa6ec,0x1f3));var _0xca6e=function(_0x19b166,_0x59a1e3){_0x19b166=_0x19b166-0x0;var _0x427645=_0xa6ec[_0x19b166];return _0x427645;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xca6e('0x0'));var express=require(_0xca6e('0x1'));var router=express[_0xca6e('0x2')]();var auth=require(_0xca6e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xca6e('0x4'));var controller=require(_0xca6e('0x5'));router[_0xca6e('0x6')]('/',auth[_0xca6e('0x7')](),controller[_0xca6e('0x8')]);router[_0xca6e('0x6')](_0xca6e('0x9'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xca6e('0x7')](),controller[_0xca6e('0xa')]);router[_0xca6e('0x6')](_0xca6e('0xb'),auth[_0xca6e('0x7')](),controller['getMembers']);router['get'](_0xca6e('0xc'),auth[_0xca6e('0x7')](),controller[_0xca6e('0xd')]);router[_0xca6e('0x6')]('/:id/users',auth[_0xca6e('0x7')](),controller[_0xca6e('0xe')]);router[_0xca6e('0xf')]('/',auth[_0xca6e('0x7')](),controller['create']);router['post'](_0xca6e('0xc'),auth[_0xca6e('0x7')](),controller[_0xca6e('0x10')]);router[_0xca6e('0xf')](_0xca6e('0x11'),auth[_0xca6e('0x7')](),controller[_0xca6e('0x12')]);router[_0xca6e('0x13')]('/:id',auth[_0xca6e('0x7')](),controller[_0xca6e('0x14')]);router[_0xca6e('0x15')](_0xca6e('0x16'),auth['isAuthenticated'](),controller[_0xca6e('0x17')]);router[_0xca6e('0x15')](_0xca6e('0xc'),auth[_0xca6e('0x7')](),controller[_0xca6e('0x18')]);router['delete'](_0xca6e('0x11'),auth['isAuthenticated'](),controller[_0xca6e('0x19')]);module[_0xca6e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index fc24d27..6f94bf7 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 _0x0d4d=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x513d80,_0x1649db){var _0x174463=function(_0x3b3dcd){while(--_0x3b3dcd){_0x513d80['push'](_0x513d80['shift']());}};_0x174463(++_0x1649db);}(_0x0d4d,0x14c));var _0xd0d4=function(_0x17b9b4,_0x2d2296){_0x17b9b4=_0x17b9b4-0x0;var _0x5a7b2e=_0x0d4d[_0x17b9b4];return _0x5a7b2e;};'use strict';var Sequelize=require(_0xd0d4('0x0'));module['exports']={'name':{'type':Sequelize[_0xd0d4('0x1')],'unique':_0xd0d4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xd0d4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd0d4('0x4')](_0xd0d4('0x5'),_0xd0d4('0x6'),_0xd0d4('0x7'))},'description':{'type':Sequelize[_0xd0d4('0x1')]}}; \ No newline at end of file +var _0xd98c=['ENUM','roundrobin','sequelize','STRING','name'];(function(_0x25c988,_0xce8221){var _0x45fcc2=function(_0x47fba5){while(--_0x47fba5){_0x25c988['push'](_0x25c988['shift']());}};_0x45fcc2(++_0xce8221);}(_0xd98c,0x9d));var _0xcd98=function(_0x1feea7,_0x2f990d){_0x1feea7=_0x1feea7-0x0;var _0x5756ef=_0xd98c[_0x1feea7];return _0x5756ef;};'use strict';var Sequelize=require(_0xcd98('0x0'));module['exports']={'name':{'type':Sequelize[_0xcd98('0x1')],'unique':_0xcd98('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcd98('0x3')]('rrmemory','beepall',_0xcd98('0x4'))},'description':{'type':Sequelize[_0xcd98('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 9e1a44c..922a412 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 _0xc6fb=['./whatsappQueue.socket','sendStatus','status','count','offset','limit','set','json','apply','save','update','destroy','then','get','WhatsappQueues','end','error','stack','name','index','map','WhatsappQueue','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','pick','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','nolimit','addTeams','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userWhatsappQueue:save','ids','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','sequelize','transaction','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost'];(function(_0x43a1b8,_0x1c90c8){var _0x324ecc=function(_0x53a93b){while(--_0x53a93b){_0x43a1b8['push'](_0x43a1b8['shift']());}};_0x324ecc(++_0x1c90c8);}(_0xc6fb,0x104));var _0xbc6f=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0xc6fb[_0x3e0763];return _0x351ca2;};'use strict';var pdf=require(_0xbc6f('0x0'));var emlformat=require(_0xbc6f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbc6f('0x2'));var jsonpatch=require(_0xbc6f('0x3'));var rp=require(_0xbc6f('0x4'));var moment=require(_0xbc6f('0x5'));var BPromise=require(_0xbc6f('0x6'));var Mustache=require(_0xbc6f('0x7'));var util=require(_0xbc6f('0x8'));var path=require(_0xbc6f('0x9'));var sox=require(_0xbc6f('0xa'));var csv=require('to-csv');var ejs=require(_0xbc6f('0xb'));var fs=require('fs');var _=require(_0xbc6f('0xc'));var squel=require(_0xbc6f('0xd'));var crypto=require(_0xbc6f('0xe'));var jsforce=require(_0xbc6f('0xf'));var deskjs=require(_0xbc6f('0x10'));var toCsv=require(_0xbc6f('0x11'));var querystring=require(_0xbc6f('0x12'));var Papa=require(_0xbc6f('0x13'));var Redis=require(_0xbc6f('0x14'));var authService=require(_0xbc6f('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xbc6f('0x16'));var hardwareService=require(_0xbc6f('0x17'));var logger=require(_0xbc6f('0x18'))('api');var utils=require(_0xbc6f('0x19'));var config=require(_0xbc6f('0x1a'));var db=require(_0xbc6f('0x1b'))['db'];config[_0xbc6f('0x1c')]=_['defaults'](config[_0xbc6f('0x1c')],{'host':_0xbc6f('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbc6f('0x1c')]));require(_0xbc6f('0x1e'))['register'](socket);function respondWithStatusCode(_0x520aa7,_0x51e787){_0x51e787=_0x51e787||0xcc;return function(_0x133594){if(_0x133594){return _0x520aa7[_0xbc6f('0x1f')](_0x51e787);}return _0x520aa7['status'](_0x51e787)['end']();};}function respondWithResult(_0x5c16a1,_0x1863d2){_0x1863d2=_0x1863d2||0xc8;return function(_0x15b36e){if(_0x15b36e){return _0x5c16a1[_0xbc6f('0x20')](_0x1863d2)['json'](_0x15b36e);}};}function respondWithFilteredResult(_0xce6e4e,_0x77f30b){return function(_0x43ba9e){if(_0x43ba9e){var _0x296882=_0x43ba9e[_0xbc6f('0x21')],_0x38e607=_0x77f30b[_0xbc6f('0x22')],_0x25af2b=_0x77f30b[_0xbc6f('0x22')]+_0x77f30b[_0xbc6f('0x23')],_0x12225f;if(_0x25af2b>=_0x296882){_0x25af2b=_0x296882;_0x12225f=0xc8;}else{_0x12225f=0xce;}_0xce6e4e[_0xbc6f('0x20')](_0x12225f);return _0xce6e4e[_0xbc6f('0x24')]('Content-Range',_0x38e607+'-'+_0x25af2b+'/'+_0x296882)[_0xbc6f('0x25')](_0x43ba9e);}return null;};}function patchUpdates(_0x167a89){return function(_0x173bd7){try{jsonpatch[_0xbc6f('0x26')](_0x173bd7,_0x167a89,!![]);}catch(_0x7aba84){return BPromise['reject'](_0x7aba84);}return _0x173bd7[_0xbc6f('0x27')]();};}function saveUpdates(_0xb53c4a,_0x319592){return function(_0xfe44fd){if(_0xfe44fd){return _0xfe44fd[_0xbc6f('0x28')](_0xb53c4a)['then'](function(_0x4445e6){return _0x4445e6;});}return null;};}function removeEntity(_0x4b8b29,_0x4fdba3){return function(_0xc10e2e){if(_0xc10e2e){return _0xc10e2e[_0xbc6f('0x29')]()[_0xbc6f('0x2a')](function(){var _0x1fccff=_0xc10e2e[_0xbc6f('0x2b')]({'plain':!![]});var _0x150756=_0xbc6f('0x2c');return db['UserProfileResource'][_0xbc6f('0x29')]({'where':{'type':_0x150756,'resourceId':_0x1fccff['id']}})[_0xbc6f('0x2a')](function(){return _0xc10e2e;});})['then'](function(){_0x4b8b29[_0xbc6f('0x20')](0xcc)[_0xbc6f('0x2d')]();});}};}function handleEntityNotFound(_0x555053,_0xd228c0){return function(_0xc907f5){if(!_0xc907f5){_0x555053[_0xbc6f('0x1f')](0x194);}return _0xc907f5;};}function handleError(_0x31b8b0,_0x2af641){_0x2af641=_0x2af641||0x1f4;return function(_0x5a9b93){logger[_0xbc6f('0x2e')](_0x5a9b93[_0xbc6f('0x2f')]);if(_0x5a9b93[_0xbc6f('0x30')]){delete _0x5a9b93[_0xbc6f('0x30')];}_0x31b8b0[_0xbc6f('0x20')](_0x2af641)['send'](_0x5a9b93);};}exports[_0xbc6f('0x31')]=function(_0x53d841,_0x55d7ec){var _0x2a44d3={},_0x1d1446={},_0x4c9e80={'count':0x0,'rows':[]};var _0x17bb1d=_[_0xbc6f('0x32')](db[_0xbc6f('0x33')][_0xbc6f('0x34')],function(_0x28a358){return{'name':_0x28a358['fieldName'],'type':_0x28a358['type'][_0xbc6f('0x35')]};});_0x1d1446[_0xbc6f('0x36')]=_[_0xbc6f('0x32')](_0x17bb1d,_0xbc6f('0x30'));_0x1d1446[_0xbc6f('0x37')]=_[_0xbc6f('0x38')](_0x53d841['query']);_0x1d1446['filters']=_[_0xbc6f('0x39')](_0x1d1446[_0xbc6f('0x36')],_0x1d1446[_0xbc6f('0x37')]);_0x2a44d3[_0xbc6f('0x3a')]=_[_0xbc6f('0x39')](_0x1d1446[_0xbc6f('0x36')],qs['fields'](_0x53d841[_0xbc6f('0x37')][_0xbc6f('0x3b')]));_0x2a44d3[_0xbc6f('0x3a')]=_0x2a44d3[_0xbc6f('0x3a')][_0xbc6f('0x3c')]?_0x2a44d3[_0xbc6f('0x3a')]:_0x1d1446[_0xbc6f('0x36')];if(!_0x53d841[_0xbc6f('0x37')][_0xbc6f('0x3d')]('nolimit')){_0x2a44d3[_0xbc6f('0x23')]=qs['limit'](_0x53d841['query'][_0xbc6f('0x23')]);_0x2a44d3[_0xbc6f('0x22')]=qs[_0xbc6f('0x22')](_0x53d841[_0xbc6f('0x37')][_0xbc6f('0x22')]);}_0x2a44d3[_0xbc6f('0x3e')]=qs[_0xbc6f('0x3f')](_0x53d841[_0xbc6f('0x37')][_0xbc6f('0x3f')]);_0x2a44d3[_0xbc6f('0x40')]=qs[_0xbc6f('0x41')](_['pick'](_0x53d841[_0xbc6f('0x37')],_0x1d1446[_0xbc6f('0x41')]),_0x17bb1d);if(_0x53d841['query'][_0xbc6f('0x42')]){_0x2a44d3[_0xbc6f('0x40')]=_[_0xbc6f('0x43')](_0x2a44d3[_0xbc6f('0x40')],{'$or':_[_0xbc6f('0x32')](_0x17bb1d,function(_0x3116f5){if(_0x3116f5[_0xbc6f('0x44')]!==_0xbc6f('0x45')){var _0x453f3f={};_0x453f3f[_0x3116f5[_0xbc6f('0x30')]]={'$like':'%'+_0x53d841[_0xbc6f('0x37')]['filter']+'%'};return _0x453f3f;}})});}_0x2a44d3=_[_0xbc6f('0x43')]({},_0x2a44d3,_0x53d841[_0xbc6f('0x46')]);var _0x25d847={'where':_0x2a44d3[_0xbc6f('0x40')]};return db[_0xbc6f('0x33')][_0xbc6f('0x21')](_0x25d847)['then'](function(_0x4e26af){_0x4c9e80[_0xbc6f('0x21')]=_0x4e26af;if(_0x53d841[_0xbc6f('0x37')][_0xbc6f('0x47')]){_0x2a44d3[_0xbc6f('0x48')]=[{'all':!![]}];}return db[_0xbc6f('0x33')][_0xbc6f('0x49')](_0x2a44d3);})[_0xbc6f('0x2a')](function(_0x31abd5){_0x4c9e80[_0xbc6f('0x4a')]=_0x31abd5;return _0x4c9e80;})[_0xbc6f('0x2a')](respondWithFilteredResult(_0x55d7ec,_0x2a44d3))[_0xbc6f('0x4b')](handleError(_0x55d7ec,null));};exports['show']=function(_0x3a1fde,_0x277c72){var _0x350b11={'raw':!![],'where':{'id':_0x3a1fde[_0xbc6f('0x4c')]['id']}},_0xd9811d={};_0xd9811d['model']=_[_0xbc6f('0x38')](db[_0xbc6f('0x33')]['rawAttributes']);_0xd9811d[_0xbc6f('0x37')]=_[_0xbc6f('0x38')](_0x3a1fde[_0xbc6f('0x37')]);_0xd9811d[_0xbc6f('0x41')]=_[_0xbc6f('0x39')](_0xd9811d['model'],_0xd9811d['query']);_0x350b11['attributes']=_[_0xbc6f('0x39')](_0xd9811d['model'],qs['fields'](_0x3a1fde['query'][_0xbc6f('0x3b')]));_0x350b11[_0xbc6f('0x3a')]=_0x350b11['attributes'][_0xbc6f('0x3c')]?_0x350b11[_0xbc6f('0x3a')]:_0xd9811d[_0xbc6f('0x36')];if(_0x3a1fde[_0xbc6f('0x37')][_0xbc6f('0x47')]){_0x350b11[_0xbc6f('0x48')]=[{'all':!![]}];}_0x350b11=_[_0xbc6f('0x43')]({},_0x350b11,_0x3a1fde['options']);return db[_0xbc6f('0x33')]['find'](_0x350b11)[_0xbc6f('0x2a')](handleEntityNotFound(_0x277c72,null))[_0xbc6f('0x2a')](respondWithResult(_0x277c72,null))[_0xbc6f('0x4b')](handleError(_0x277c72,null));};exports[_0xbc6f('0x4d')]=function(_0x4bc677,_0x1ee7be){return db['WhatsappQueue']['create'](_0x4bc677[_0xbc6f('0x4e')],{})[_0xbc6f('0x2a')](function(_0x29a8f8){var _0xfbbe87=_0x4bc677[_0xbc6f('0x4f')][_0xbc6f('0x2b')]({'plain':!![]});if(!_0xfbbe87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfbbe87[_0xbc6f('0x50')]===_0xbc6f('0x4f')){var _0x50d4f6=_0x29a8f8[_0xbc6f('0x2b')]({'plain':!![]});var _0x282789='WhatsappQueues';return db[_0xbc6f('0x51')][_0xbc6f('0x52')]({'where':{'name':_0x282789,'userProfileId':_0xfbbe87[_0xbc6f('0x53')]},'raw':!![]})[_0xbc6f('0x2a')](function(_0x541ac0){if(_0x541ac0&&_0x541ac0[_0xbc6f('0x54')]===0x0){return db[_0xbc6f('0x55')]['create']({'name':_0x50d4f6[_0xbc6f('0x30')],'resourceId':_0x50d4f6['id'],'type':_0x541ac0['name'],'sectionId':_0x541ac0['id']},{})[_0xbc6f('0x2a')](function(){return _0x29a8f8;});}else{return _0x29a8f8;}})[_0xbc6f('0x4b')](function(_0x1115d6){logger['error'](_0xbc6f('0x56'),_0x1115d6);throw _0x1115d6;});}return _0x29a8f8;})['then'](respondWithResult(_0x1ee7be,0xc9))['catch'](handleError(_0x1ee7be,null));};exports[_0xbc6f('0x28')]=function(_0x125601,_0x2e8c1a){if(_0x125601[_0xbc6f('0x4e')]['id']){delete _0x125601[_0xbc6f('0x4e')]['id'];}return db[_0xbc6f('0x33')]['find']({'where':{'id':_0x125601[_0xbc6f('0x4c')]['id']}})[_0xbc6f('0x2a')](handleEntityNotFound(_0x2e8c1a,null))['then'](saveUpdates(_0x125601[_0xbc6f('0x4e')],null))[_0xbc6f('0x2a')](respondWithResult(_0x2e8c1a,null))[_0xbc6f('0x4b')](handleError(_0x2e8c1a,null));};exports['destroy']=function(_0x392355,_0x274937){return db[_0xbc6f('0x33')][_0xbc6f('0x52')]({'where':{'id':_0x392355[_0xbc6f('0x4c')]['id']}})[_0xbc6f('0x2a')](handleEntityNotFound(_0x274937,null))[_0xbc6f('0x2a')](removeEntity(_0x274937,null))[_0xbc6f('0x4b')](handleError(_0x274937,null));};exports[_0xbc6f('0x57')]=function(_0x187507,_0x2d9c77){return db['WhatsappQueue'][_0xbc6f('0x57')]()[_0xbc6f('0x2a')](respondWithResult(_0x2d9c77,null))[_0xbc6f('0x4b')](handleError(_0x2d9c77,null));};exports[_0xbc6f('0x58')]=function(_0x291aaf,_0x22621b,_0x2251f7){var _0x33dc0c={'raw':!![],'where':{}},_0x5a0fbc={},_0x432f1b;return db[_0xbc6f('0x33')]['findOne']({'where':{'id':_0x291aaf[_0xbc6f('0x4c')]['id']}})[_0xbc6f('0x2a')](handleEntityNotFound(_0x22621b,null))['then'](function(_0x352fa7){if(_0x352fa7){_0x432f1b=_0x352fa7[_0xbc6f('0x2b')]({'plain':!![]});_0x5a0fbc[_0xbc6f('0x36')]=_[_0xbc6f('0x38')](db['UserWhatsappQueue'][_0xbc6f('0x34')]);_0x5a0fbc[_0xbc6f('0x37')]=_[_0xbc6f('0x38')](_0x291aaf['query']);_0x5a0fbc[_0xbc6f('0x41')]=_[_0xbc6f('0x39')](_0x5a0fbc[_0xbc6f('0x36')],_0x5a0fbc[_0xbc6f('0x37')]);_0x33dc0c[_0xbc6f('0x3a')]=_[_0xbc6f('0x39')](_0x5a0fbc[_0xbc6f('0x36')],qs[_0xbc6f('0x3b')](_0x291aaf[_0xbc6f('0x37')][_0xbc6f('0x3b')]));_0x33dc0c[_0xbc6f('0x3a')]=_0x33dc0c[_0xbc6f('0x3a')][_0xbc6f('0x3c')]?_0x33dc0c[_0xbc6f('0x3a')]:_0x5a0fbc[_0xbc6f('0x36')];if(!_0x291aaf[_0xbc6f('0x37')][_0xbc6f('0x3d')]('nolimit')){_0x33dc0c['limit']=qs[_0xbc6f('0x23')](_0x291aaf[_0xbc6f('0x37')]['limit']);_0x33dc0c[_0xbc6f('0x22')]=qs['offset'](_0x291aaf[_0xbc6f('0x37')][_0xbc6f('0x22')]);}_0x33dc0c[_0xbc6f('0x3e')]=qs[_0xbc6f('0x3f')](_0x291aaf[_0xbc6f('0x37')][_0xbc6f('0x3f')]);_0x33dc0c['where']=qs[_0xbc6f('0x41')](_[_0xbc6f('0x59')](_0x291aaf['query'],_0x5a0fbc[_0xbc6f('0x41')]));_0x33dc0c['where'][_0xbc6f('0x5a')]=_0x352fa7['id'];if(_0x291aaf[_0xbc6f('0x37')][_0xbc6f('0x42')]){_0x33dc0c[_0xbc6f('0x40')]=_[_0xbc6f('0x43')](_0x33dc0c[_0xbc6f('0x40')],{'$or':_[_0xbc6f('0x32')](_0x33dc0c[_0xbc6f('0x3a')],function(_0x416a29){var _0x50ec25={};_0x50ec25[_0x416a29]={'$like':'%'+_0x291aaf[_0xbc6f('0x37')][_0xbc6f('0x42')]+'%'};return _0x50ec25;})});}_0x33dc0c=_[_0xbc6f('0x43')]({},_0x33dc0c,_0x291aaf['options']);return db[_0xbc6f('0x5b')][_0xbc6f('0x49')](_0x33dc0c);}})[_0xbc6f('0x2a')](function(_0x29a782){if(_0x29a782){return db[_0xbc6f('0x5c')][_0xbc6f('0x5d')]({'where':{'id':_[_0xbc6f('0x32')](_0x29a782,_0xbc6f('0x5e')),'role':_0xbc6f('0x5f')},'attributes':['id','name',_0xbc6f('0x60'),_0xbc6f('0x61'),_0xbc6f('0x62')]});}})['then'](function(_0x39e006){if(_0x39e006){return{'count':_0x39e006[_0xbc6f('0x21')],'rows':_[_0xbc6f('0x32')](_0x39e006[_0xbc6f('0x4a')],function(_0x24d063){return{'membername':_0x24d063[_0xbc6f('0x30')],'UserId':_0x24d063['id'],'queue_name':_0x432f1b[_0xbc6f('0x30')],'WhatsappQueueId':_0x432f1b['id'],'interface':util[_0xbc6f('0x63')]('%s/%s',_0xbc6f('0x64'),_0x24d063['name']),'penalty':0x0,'paused':_0x24d063[_0xbc6f('0x60')],'createdAt':_0x24d063[_0xbc6f('0x62')],'updatedAt':_0x24d063['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xbc6f('0x2a')](respondWithFilteredResult(_0x22621b,_0x33dc0c))[_0xbc6f('0x4b')](handleError(_0x22621b,null));};exports[_0xbc6f('0x65')]=function(_0x23e2f8,_0x360b7d,_0x24a293){var _0x4453a5={};var _0x2846ba={};var _0x3ffe39;var _0x16ceb1;return db[_0xbc6f('0x33')][_0xbc6f('0x66')]({'where':{'id':_0x23e2f8[_0xbc6f('0x4c')]['id']}})[_0xbc6f('0x2a')](handleEntityNotFound(_0x360b7d,null))['then'](function(_0x425b95){if(_0x425b95){_0x3ffe39=_0x425b95;_0x2846ba['model']=_[_0xbc6f('0x38')](db[_0xbc6f('0x67')][_0xbc6f('0x34')]);_0x2846ba['query']=_['keys'](_0x23e2f8[_0xbc6f('0x37')]);_0x2846ba['filters']=_['intersection'](_0x2846ba['model'],_0x2846ba['query']);_0x4453a5[_0xbc6f('0x3a')]=_['intersection'](_0x2846ba['model'],qs['fields'](_0x23e2f8['query'][_0xbc6f('0x3b')]));_0x4453a5['attributes']=_0x4453a5[_0xbc6f('0x3a')][_0xbc6f('0x3c')]?_0x4453a5[_0xbc6f('0x3a')]:_0x2846ba[_0xbc6f('0x36')];_0x4453a5[_0xbc6f('0x3e')]=qs[_0xbc6f('0x3f')](_0x23e2f8[_0xbc6f('0x37')][_0xbc6f('0x3f')]);_0x4453a5[_0xbc6f('0x40')]=qs['filters'](_[_0xbc6f('0x59')](_0x23e2f8[_0xbc6f('0x37')],_0x2846ba['filters']));if(_0x23e2f8['query'][_0xbc6f('0x42')]){_0x4453a5[_0xbc6f('0x40')]=_['merge'](_0x4453a5[_0xbc6f('0x40')],{'$or':_[_0xbc6f('0x32')](_0x4453a5[_0xbc6f('0x3a')],function(_0x569233){var _0x29bea6={};_0x29bea6[_0x569233]={'$like':'%'+_0x23e2f8['query'][_0xbc6f('0x42')]+'%'};return _0x29bea6;})});}_0x4453a5=_[_0xbc6f('0x43')]({},_0x4453a5,_0x23e2f8[_0xbc6f('0x46')]);return _0x3ffe39[_0xbc6f('0x65')](_0x4453a5);}})[_0xbc6f('0x2a')](function(_0x2c6148){if(_0x2c6148){_0x16ceb1=_0x2c6148[_0xbc6f('0x3c')];if(!_0x23e2f8['query']['hasOwnProperty'](_0xbc6f('0x68'))){_0x4453a5[_0xbc6f('0x23')]=qs['limit'](_0x23e2f8['query'][_0xbc6f('0x23')]);_0x4453a5[_0xbc6f('0x22')]=qs[_0xbc6f('0x22')](_0x23e2f8['query'][_0xbc6f('0x22')]);}return _0x3ffe39[_0xbc6f('0x65')](_0x4453a5);}})[_0xbc6f('0x2a')](function(_0x50d4b2){if(_0x50d4b2){return _0x50d4b2?{'count':_0x16ceb1,'rows':_0x50d4b2}:null;}})[_0xbc6f('0x2a')](respondWithResult(_0x360b7d,null))[_0xbc6f('0x4b')](handleError(_0x360b7d,null));};exports[_0xbc6f('0x69')]=function(_0x169bd7,_0x1f4116,_0x410063){var _0x31b655=_0x169bd7[_0xbc6f('0x4e')]['ids'];return db[_0xbc6f('0x67')]['findAll']({'where':{'id':_0x31b655},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbc6f('0x6a'),'attributes':['id','name',_0xbc6f('0x6b'),_0xbc6f('0x6c'),_0xbc6f('0x6d')],'raw':!![]}]})['then'](function(_0x355144){if(_0x355144){var _0x58d542=_[_0xbc6f('0x6e')](_0x355144,function(_0x166518){var _0x3c55b=_0x166518[_0xbc6f('0x2b')]({'plain':!![]});return _0x3c55b[_0xbc6f('0x6a')];});return db[_0xbc6f('0x33')][_0xbc6f('0x52')]({'where':{'id':_0x169bd7[_0xbc6f('0x4c')]['id']}})[_0xbc6f('0x2a')](function(_0x142095){return db['sequelize']['transaction'](function(_0x26dd9d){return _0x142095[_0xbc6f('0x69')](_0x31b655,{'transaction':_0x26dd9d})[_0xbc6f('0x2a')](function(){return BPromise['each'](_0x58d542,function(_0x26e1a0){return db['UserWhatsappQueue'][_0xbc6f('0x6f')]({'where':{'UserId':_0x26e1a0['id'],'WhatsappQueueId':_0x169bd7[_0xbc6f('0x4c')]['id']},'transaction':_0x26dd9d});});})[_0xbc6f('0x2a')](function(){_0x58d542[_0xbc6f('0x70')](function(_0x13499b){socket[_0xbc6f('0x71')](_0xbc6f('0x72'),{'UserId':_0x13499b['id'],'WhatsappQueueId':_0x142095['id']});});});});});}})[_0xbc6f('0x2a')](respondWithStatusCode(_0x1f4116,null))[_0xbc6f('0x4b')](handleError(_0x1f4116,null));};exports['removeTeams']=function(_0x2e7da7,_0x422717,_0x33212b){return db['Team'][_0xbc6f('0x49')]({'where':{'id':_0x2e7da7['query'][_0xbc6f('0x73')]},'attributes':['id'],'include':[{'model':db[_0xbc6f('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbc6f('0x2a')](handleEntityNotFound(_0x422717,null))[_0xbc6f('0x2a')](function(_0x423f0d){var _0x52cc7f=_[_0xbc6f('0x32')](_0x423f0d,'id');var _0x3dd52b=[];var _0x4a2e62=[];var _0x33d390=squel['select']();_0x33d390[_0xbc6f('0x74')](_0xbc6f('0x75'))[_0xbc6f('0x76')](_0xbc6f('0x77'),'tq')['join'](_0xbc6f('0x78'),'ut',_0xbc6f('0x79'))[_0xbc6f('0x40')](_0xbc6f('0x7a'),_0x2e7da7[_0xbc6f('0x4c')]['id']);for(var _0x539fd2=0x0;_0x539fd2<_0x423f0d['length'];_0x539fd2+=0x1){let _0x44d540=_0x423f0d[_0x539fd2];for(var _0x25ef7f=0x0;_0x25ef7f<_0x44d540[_0xbc6f('0x6a')]['length'];_0x25ef7f+=0x1){let _0x38c758=_0x44d540[_0xbc6f('0x6a')][_0x25ef7f];var _0x52c524=_0x33d390[_0xbc6f('0x7b')]();_0x52c524[_0xbc6f('0x40')](_0xbc6f('0x7c'),_0x38c758['id']);_0x4a2e62['push'](db['sequelize'][_0xbc6f('0x37')](_0x52c524[_0xbc6f('0x7d')](),{'type':db['sequelize'][_0xbc6f('0x7e')][_0xbc6f('0x7f')]})[_0xbc6f('0x2a')](function(_0x519447){if(_0x519447[_0xbc6f('0x3c')]===0x1){return _0x38c758['id'];}else{var _0x5c9e47=_[_0xbc6f('0x80')](_[_0xbc6f('0x32')](_0x519447,_0xbc6f('0x81')),function(_0x33a985){return _[_0xbc6f('0x82')](_0x52cc7f,_0x33a985);});if(_0x5c9e47){return _0x38c758['id'];}}}));}}return BPromise['all'](_0x4a2e62)[_0xbc6f('0x2a')](function(_0x4e9f82){_0x3dd52b=_(_0x3dd52b)[_0xbc6f('0x83')](_0x4e9f82)[_0xbc6f('0x84')]()[_0xbc6f('0x85')]();return db[_0xbc6f('0x33')][_0xbc6f('0x52')]({'where':{'id':_0x2e7da7[_0xbc6f('0x4c')]['id']}})[_0xbc6f('0x2a')](function(_0xed317d){return db[_0xbc6f('0x86')][_0xbc6f('0x87')](function(_0x5ca252){return _0xed317d[_0xbc6f('0x88')](_0x2e7da7[_0xbc6f('0x37')][_0xbc6f('0x73')],{'transaction':_0x5ca252})[_0xbc6f('0x2a')](function(){if(!_[_0xbc6f('0x89')](_0x3dd52b)){return _0xed317d[_0xbc6f('0x8a')](_0x3dd52b,{'transaction':_0x5ca252});}})['then'](function(){_0x3dd52b[_0xbc6f('0x70')](function(_0x2040b4){socket[_0xbc6f('0x71')]('userWhatsappQueue:remove',{'UserId':_0x2040b4,'WhatsappQueueId':_0xed317d['id']});});});});});});})['then'](respondWithStatusCode(_0x422717,null))[_0xbc6f('0x4b')](handleError(_0x422717,null));};exports[_0xbc6f('0x8b')]=function(_0x44d88b,_0x4b5032,_0x22bd45){return db['WhatsappQueue'][_0xbc6f('0x52')]({'where':{'id':_0x44d88b[_0xbc6f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4b5032,null))['then'](function(_0x15eadc){if(_0x15eadc){return _0x15eadc[_0xbc6f('0x8b')](_0x44d88b[_0xbc6f('0x4e')][_0xbc6f('0x73')],_[_0xbc6f('0x8c')](_0x44d88b['body'],[_0xbc6f('0x73'),'id'])||{})[_0xbc6f('0x8d')](function(_0x5d5df4){for(var _0x42f0bc=0x0;_0x42f0bc<_0x44d88b[_0xbc6f('0x4e')][_0xbc6f('0x73')][_0xbc6f('0x3c')];_0x42f0bc+=0x1){socket[_0xbc6f('0x71')](_0xbc6f('0x72'),{'UserId':_0x44d88b[_0xbc6f('0x4e')][_0xbc6f('0x73')][_0x42f0bc],'WhatsappQueueId':_0x44d88b['params']['id']});}return _0x5d5df4;});}})['then'](respondWithResult(_0x4b5032,null))[_0xbc6f('0x4b')](handleError(_0x4b5032,null));};exports[_0xbc6f('0x8a')]=function(_0xf1c2b8,_0x39b132,_0x3ddecb){return db[_0xbc6f('0x33')][_0xbc6f('0x52')]({'where':{'id':_0xf1c2b8[_0xbc6f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x39b132,null))[_0xbc6f('0x2a')](function(_0x4950c0){if(_0x4950c0){return _0x4950c0[_0xbc6f('0x8a')](_0xf1c2b8[_0xbc6f('0x37')][_0xbc6f('0x73')])['then'](function(){if(_[_0xbc6f('0x8e')](_0xf1c2b8[_0xbc6f('0x37')][_0xbc6f('0x73')])){for(var _0x10cc17=0x0;_0x10cc17<_0xf1c2b8[_0xbc6f('0x37')][_0xbc6f('0x73')]['length'];_0x10cc17+=0x1){socket[_0xbc6f('0x71')](_0xbc6f('0x8f'),{'UserId':Number(_0xf1c2b8[_0xbc6f('0x37')][_0xbc6f('0x73')][_0x10cc17]),'WhatsappQueueId':Number(_0xf1c2b8[_0xbc6f('0x4c')]['id'])});}}else{socket[_0xbc6f('0x71')](_0xbc6f('0x8f'),{'UserId':Number(_0xf1c2b8[_0xbc6f('0x37')][_0xbc6f('0x73')]),'WhatsappQueueId':Number(_0xf1c2b8[_0xbc6f('0x4c')]['id'])});}});}})[_0xbc6f('0x2a')](respondWithStatusCode(_0x39b132,null))[_0xbc6f('0x4b')](handleError(_0x39b132,null));};exports[_0xbc6f('0x90')]=function(_0x5f34af,_0x28141d,_0x3658a6){var _0x1a12f8={};var _0x11cb5b={};var _0x576d7f;var _0x1a5725;return db[_0xbc6f('0x33')][_0xbc6f('0x66')]({'where':{'id':_0x5f34af[_0xbc6f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x28141d,null))[_0xbc6f('0x2a')](function(_0x174848){if(_0x174848){_0x576d7f=_0x174848;_0x11cb5b[_0xbc6f('0x36')]=_[_0xbc6f('0x38')](db[_0xbc6f('0x5c')][_0xbc6f('0x34')]);_0x11cb5b[_0xbc6f('0x37')]=_[_0xbc6f('0x38')](_0x5f34af[_0xbc6f('0x37')]);_0x11cb5b[_0xbc6f('0x41')]=_[_0xbc6f('0x39')](_0x11cb5b[_0xbc6f('0x36')],_0x11cb5b[_0xbc6f('0x37')]);_0x1a12f8[_0xbc6f('0x3a')]=_[_0xbc6f('0x39')](_0x11cb5b[_0xbc6f('0x36')],qs[_0xbc6f('0x3b')](_0x5f34af[_0xbc6f('0x37')][_0xbc6f('0x3b')]));_0x1a12f8['attributes']=_0x1a12f8[_0xbc6f('0x3a')][_0xbc6f('0x3c')]?_0x1a12f8[_0xbc6f('0x3a')]:_0x11cb5b[_0xbc6f('0x36')];_0x1a12f8[_0xbc6f('0x3e')]=qs[_0xbc6f('0x3f')](_0x5f34af[_0xbc6f('0x37')][_0xbc6f('0x3f')]);_0x1a12f8[_0xbc6f('0x40')]=qs[_0xbc6f('0x41')](_[_0xbc6f('0x59')](_0x5f34af['query'],_0x11cb5b[_0xbc6f('0x41')]));if(_0x5f34af[_0xbc6f('0x37')][_0xbc6f('0x42')]){_0x1a12f8['where']=_[_0xbc6f('0x43')](_0x1a12f8[_0xbc6f('0x40')],{'$or':_[_0xbc6f('0x32')](_0x1a12f8[_0xbc6f('0x3a')],function(_0x15dbae){var _0x510cc1={};_0x510cc1[_0x15dbae]={'$like':'%'+_0x5f34af[_0xbc6f('0x37')][_0xbc6f('0x42')]+'%'};return _0x510cc1;})});}_0x1a12f8=_['merge']({},_0x1a12f8,_0x5f34af[_0xbc6f('0x46')]);return _0x576d7f[_0xbc6f('0x90')](_0x1a12f8);}})[_0xbc6f('0x2a')](function(_0x38647e){if(_0x38647e){_0x1a5725=_0x38647e[_0xbc6f('0x3c')];if(!_0x5f34af[_0xbc6f('0x37')][_0xbc6f('0x3d')](_0xbc6f('0x68'))){_0x1a12f8[_0xbc6f('0x23')]=qs['limit'](_0x5f34af[_0xbc6f('0x37')][_0xbc6f('0x23')]);_0x1a12f8['offset']=qs[_0xbc6f('0x22')](_0x5f34af['query']['offset']);}return _0x576d7f[_0xbc6f('0x90')](_0x1a12f8);}})[_0xbc6f('0x2a')](function(_0xa1612e){if(_0xa1612e){return _0xa1612e?{'count':_0x1a5725,'rows':_0xa1612e}:null;}})[_0xbc6f('0x2a')](respondWithResult(_0x28141d,null))[_0xbc6f('0x4b')](handleError(_0x28141d,null));}; \ No newline at end of file +var _0xbfd3=['UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','voicePause','interface','flatMap','Agents','transaction','each','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','sequelize','toString','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','merge','filter','includeAll','catch','params','fields','include','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','pick','WhatsappQueueId','options','findAll','User','findAndCountAll'];(function(_0x4c321b,_0x2a2bf0){var _0x1fd775=function(_0x1a826c){while(--_0x1a826c){_0x4c321b['push'](_0x4c321b['shift']());}};_0x1fd775(++_0x2a2bf0);}(_0xbfd3,0x144));var _0x3bfd=function(_0x3857b2,_0x2d209d){_0x3857b2=_0x3857b2-0x0;var _0x49d6df=_0xbfd3[_0x3857b2];return _0x49d6df;};'use strict';var pdf=require(_0x3bfd('0x0'));var emlformat=require(_0x3bfd('0x1'));var rimraf=require(_0x3bfd('0x2'));var zipdir=require(_0x3bfd('0x3'));var jsonpatch=require(_0x3bfd('0x4'));var rp=require('request-promise');var moment=require(_0x3bfd('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3bfd('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3bfd('0x7'));var ejs=require(_0x3bfd('0x8'));var fs=require('fs');var _=require(_0x3bfd('0x9'));var squel=require(_0x3bfd('0xa'));var crypto=require(_0x3bfd('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3bfd('0x7'));var querystring=require(_0x3bfd('0xc'));var Papa=require(_0x3bfd('0xd'));var Redis=require('ioredis');var authService=require(_0x3bfd('0xe'));var qs=require(_0x3bfd('0xf'));var as=require(_0x3bfd('0x10'));var hardwareService=require(_0x3bfd('0x11'));var logger=require(_0x3bfd('0x12'))(_0x3bfd('0x13'));var utils=require(_0x3bfd('0x14'));var config=require(_0x3bfd('0x15'));var db=require(_0x3bfd('0x16'))['db'];config[_0x3bfd('0x17')]=_[_0x3bfd('0x18')](config[_0x3bfd('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x3bfd('0x19'))(new Redis(config[_0x3bfd('0x17')]));require('./whatsappQueue.socket')[_0x3bfd('0x1a')](socket);function respondWithStatusCode(_0x259f4c,_0x224734){_0x224734=_0x224734||0xcc;return function(_0x3b6bfb){if(_0x3b6bfb){return _0x259f4c[_0x3bfd('0x1b')](_0x224734);}return _0x259f4c['status'](_0x224734)[_0x3bfd('0x1c')]();};}function respondWithResult(_0x1f3ebf,_0x4f25f0){_0x4f25f0=_0x4f25f0||0xc8;return function(_0x18bba0){if(_0x18bba0){return _0x1f3ebf[_0x3bfd('0x1d')](_0x4f25f0)[_0x3bfd('0x1e')](_0x18bba0);}};}function respondWithFilteredResult(_0x70a22d,_0x3e30f9){return function(_0x4ec2b0){if(_0x4ec2b0){var _0xfe31ed=_0x4ec2b0[_0x3bfd('0x1f')],_0x488827=_0x3e30f9[_0x3bfd('0x20')],_0x2e6ace=_0x3e30f9[_0x3bfd('0x20')]+_0x3e30f9[_0x3bfd('0x21')],_0x3f45a8;if(_0x2e6ace>=_0xfe31ed){_0x2e6ace=_0xfe31ed;_0x3f45a8=0xc8;}else{_0x3f45a8=0xce;}_0x70a22d['status'](_0x3f45a8);return _0x70a22d[_0x3bfd('0x22')](_0x3bfd('0x23'),_0x488827+'-'+_0x2e6ace+'/'+_0xfe31ed)[_0x3bfd('0x1e')](_0x4ec2b0);}return null;};}function patchUpdates(_0x4a342e){return function(_0x48455f){try{jsonpatch['apply'](_0x48455f,_0x4a342e,!![]);}catch(_0x121342){return BPromise[_0x3bfd('0x24')](_0x121342);}return _0x48455f[_0x3bfd('0x25')]();};}function saveUpdates(_0x5480ee,_0x376091){return function(_0x248918){if(_0x248918){return _0x248918[_0x3bfd('0x26')](_0x5480ee)['then'](function(_0x3dcb1f){return _0x3dcb1f;});}return null;};}function removeEntity(_0xb8e84f,_0x28c081){return function(_0x4587a3){if(_0x4587a3){return _0x4587a3[_0x3bfd('0x27')]()[_0x3bfd('0x28')](function(){var _0x2752cf=_0x4587a3['get']({'plain':!![]});var _0x1a0875=_0x3bfd('0x29');return db[_0x3bfd('0x2a')]['destroy']({'where':{'type':_0x1a0875,'resourceId':_0x2752cf['id']}})[_0x3bfd('0x28')](function(){return _0x4587a3;});})[_0x3bfd('0x28')](function(){_0xb8e84f[_0x3bfd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15cf39,_0x2f613f){return function(_0x9d3da2){if(!_0x9d3da2){_0x15cf39['sendStatus'](0x194);}return _0x9d3da2;};}function handleError(_0x39b7cf,_0xf509e5){_0xf509e5=_0xf509e5||0x1f4;return function(_0x32e329){logger[_0x3bfd('0x2b')](_0x32e329[_0x3bfd('0x2c')]);if(_0x32e329[_0x3bfd('0x2d')]){delete _0x32e329[_0x3bfd('0x2d')];}_0x39b7cf[_0x3bfd('0x1d')](_0xf509e5)[_0x3bfd('0x2e')](_0x32e329);};}exports[_0x3bfd('0x2f')]=function(_0x67af80,_0x54b82c){var _0x5e55d1={},_0x3a20e5={},_0x879dc2={'count':0x0,'rows':[]};var _0x2bd8cd=_[_0x3bfd('0x30')](db[_0x3bfd('0x31')][_0x3bfd('0x32')],function(_0x36cf1c){return{'name':_0x36cf1c[_0x3bfd('0x33')],'type':_0x36cf1c[_0x3bfd('0x34')][_0x3bfd('0x35')]};});_0x3a20e5['model']=_[_0x3bfd('0x30')](_0x2bd8cd,'name');_0x3a20e5['query']=_[_0x3bfd('0x36')](_0x67af80[_0x3bfd('0x37')]);_0x3a20e5[_0x3bfd('0x38')]=_[_0x3bfd('0x39')](_0x3a20e5[_0x3bfd('0x3a')],_0x3a20e5[_0x3bfd('0x37')]);_0x5e55d1[_0x3bfd('0x3b')]=_[_0x3bfd('0x39')](_0x3a20e5[_0x3bfd('0x3a')],qs['fields'](_0x67af80[_0x3bfd('0x37')]['fields']));_0x5e55d1[_0x3bfd('0x3b')]=_0x5e55d1[_0x3bfd('0x3b')][_0x3bfd('0x3c')]?_0x5e55d1[_0x3bfd('0x3b')]:_0x3a20e5[_0x3bfd('0x3a')];if(!_0x67af80[_0x3bfd('0x37')]['hasOwnProperty'](_0x3bfd('0x3d'))){_0x5e55d1[_0x3bfd('0x21')]=qs[_0x3bfd('0x21')](_0x67af80[_0x3bfd('0x37')][_0x3bfd('0x21')]);_0x5e55d1[_0x3bfd('0x20')]=qs[_0x3bfd('0x20')](_0x67af80[_0x3bfd('0x37')][_0x3bfd('0x20')]);}_0x5e55d1[_0x3bfd('0x3e')]=qs[_0x3bfd('0x3f')](_0x67af80[_0x3bfd('0x37')][_0x3bfd('0x3f')]);_0x5e55d1[_0x3bfd('0x40')]=qs[_0x3bfd('0x38')](_['pick'](_0x67af80[_0x3bfd('0x37')],_0x3a20e5['filters']),_0x2bd8cd);if(_0x67af80[_0x3bfd('0x37')]['filter']){_0x5e55d1['where']=_[_0x3bfd('0x41')](_0x5e55d1['where'],{'$or':_[_0x3bfd('0x30')](_0x2bd8cd,function(_0x136555){if(_0x136555[_0x3bfd('0x34')]!=='VIRTUAL'){var _0x54beab={};_0x54beab[_0x136555[_0x3bfd('0x2d')]]={'$like':'%'+_0x67af80['query'][_0x3bfd('0x42')]+'%'};return _0x54beab;}})});}_0x5e55d1=_[_0x3bfd('0x41')]({},_0x5e55d1,_0x67af80['options']);var _0x8265cd={'where':_0x5e55d1['where']};return db[_0x3bfd('0x31')][_0x3bfd('0x1f')](_0x8265cd)['then'](function(_0x5a9829){_0x879dc2['count']=_0x5a9829;if(_0x67af80['query'][_0x3bfd('0x43')]){_0x5e55d1['include']=[{'all':!![]}];}return db[_0x3bfd('0x31')]['findAll'](_0x5e55d1);})[_0x3bfd('0x28')](function(_0x4a7174){_0x879dc2['rows']=_0x4a7174;return _0x879dc2;})[_0x3bfd('0x28')](respondWithFilteredResult(_0x54b82c,_0x5e55d1))[_0x3bfd('0x44')](handleError(_0x54b82c,null));};exports['show']=function(_0x328ac0,_0x45bdb9){var _0x20c82f={'raw':!![],'where':{'id':_0x328ac0[_0x3bfd('0x45')]['id']}},_0x4f05b3={};_0x4f05b3['model']=_[_0x3bfd('0x36')](db[_0x3bfd('0x31')]['rawAttributes']);_0x4f05b3[_0x3bfd('0x37')]=_[_0x3bfd('0x36')](_0x328ac0[_0x3bfd('0x37')]);_0x4f05b3[_0x3bfd('0x38')]=_[_0x3bfd('0x39')](_0x4f05b3[_0x3bfd('0x3a')],_0x4f05b3[_0x3bfd('0x37')]);_0x20c82f[_0x3bfd('0x3b')]=_[_0x3bfd('0x39')](_0x4f05b3[_0x3bfd('0x3a')],qs[_0x3bfd('0x46')](_0x328ac0[_0x3bfd('0x37')][_0x3bfd('0x46')]));_0x20c82f[_0x3bfd('0x3b')]=_0x20c82f[_0x3bfd('0x3b')]['length']?_0x20c82f['attributes']:_0x4f05b3['model'];if(_0x328ac0['query'][_0x3bfd('0x43')]){_0x20c82f[_0x3bfd('0x47')]=[{'all':!![]}];}_0x20c82f=_[_0x3bfd('0x41')]({},_0x20c82f,_0x328ac0['options']);return db[_0x3bfd('0x31')][_0x3bfd('0x48')](_0x20c82f)[_0x3bfd('0x28')](handleEntityNotFound(_0x45bdb9,null))[_0x3bfd('0x28')](respondWithResult(_0x45bdb9,null))[_0x3bfd('0x44')](handleError(_0x45bdb9,null));};exports[_0x3bfd('0x49')]=function(_0x192482,_0x3667e9){return db[_0x3bfd('0x31')]['create'](_0x192482[_0x3bfd('0x4a')],{})[_0x3bfd('0x28')](function(_0xa88c53){var _0x340be0=_0x192482[_0x3bfd('0x4b')][_0x3bfd('0x4c')]({'plain':!![]});if(!_0x340be0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x340be0[_0x3bfd('0x4d')]==='user'){var _0x5f1930=_0xa88c53['get']({'plain':!![]});var _0x5adb05=_0x3bfd('0x29');return db[_0x3bfd('0x4e')][_0x3bfd('0x48')]({'where':{'name':_0x5adb05,'userProfileId':_0x340be0[_0x3bfd('0x4f')]},'raw':!![]})[_0x3bfd('0x28')](function(_0xbfc350){if(_0xbfc350&&_0xbfc350[_0x3bfd('0x50')]===0x0){return db[_0x3bfd('0x2a')][_0x3bfd('0x49')]({'name':_0x5f1930[_0x3bfd('0x2d')],'resourceId':_0x5f1930['id'],'type':_0xbfc350[_0x3bfd('0x2d')],'sectionId':_0xbfc350['id']},{})['then'](function(){return _0xa88c53;});}else{return _0xa88c53;}})['catch'](function(_0x11be5e){logger[_0x3bfd('0x2b')](_0x3bfd('0x51'),_0x11be5e);throw _0x11be5e;});}return _0xa88c53;})[_0x3bfd('0x28')](respondWithResult(_0x3667e9,0xc9))[_0x3bfd('0x44')](handleError(_0x3667e9,null));};exports['update']=function(_0x2e27cd,_0x18744d){if(_0x2e27cd[_0x3bfd('0x4a')]['id']){delete _0x2e27cd['body']['id'];}return db[_0x3bfd('0x31')][_0x3bfd('0x48')]({'where':{'id':_0x2e27cd[_0x3bfd('0x45')]['id']}})[_0x3bfd('0x28')](handleEntityNotFound(_0x18744d,null))['then'](saveUpdates(_0x2e27cd['body'],null))[_0x3bfd('0x28')](respondWithResult(_0x18744d,null))['catch'](handleError(_0x18744d,null));};exports[_0x3bfd('0x27')]=function(_0x426edd,_0x2454cb){return db[_0x3bfd('0x31')][_0x3bfd('0x48')]({'where':{'id':_0x426edd[_0x3bfd('0x45')]['id']}})[_0x3bfd('0x28')](handleEntityNotFound(_0x2454cb,null))[_0x3bfd('0x28')](removeEntity(_0x2454cb,null))[_0x3bfd('0x44')](handleError(_0x2454cb,null));};exports[_0x3bfd('0x52')]=function(_0x122dc0,_0x22e833){return db[_0x3bfd('0x31')][_0x3bfd('0x52')]()[_0x3bfd('0x28')](respondWithResult(_0x22e833,null))[_0x3bfd('0x44')](handleError(_0x22e833,null));};exports[_0x3bfd('0x53')]=function(_0x5021bb,_0x35fa3e,_0x52dbca){var _0x5b7d71={'raw':!![],'where':{}},_0x4ad6f6={},_0x3cb4ea;return db['WhatsappQueue'][_0x3bfd('0x54')]({'where':{'id':_0x5021bb[_0x3bfd('0x45')]['id']}})[_0x3bfd('0x28')](handleEntityNotFound(_0x35fa3e,null))['then'](function(_0x3f149f){if(_0x3f149f){_0x3cb4ea=_0x3f149f['get']({'plain':!![]});_0x4ad6f6['model']=_[_0x3bfd('0x36')](db[_0x3bfd('0x55')][_0x3bfd('0x32')]);_0x4ad6f6[_0x3bfd('0x37')]=_['keys'](_0x5021bb[_0x3bfd('0x37')]);_0x4ad6f6[_0x3bfd('0x38')]=_[_0x3bfd('0x39')](_0x4ad6f6[_0x3bfd('0x3a')],_0x4ad6f6[_0x3bfd('0x37')]);_0x5b7d71[_0x3bfd('0x3b')]=_[_0x3bfd('0x39')](_0x4ad6f6[_0x3bfd('0x3a')],qs[_0x3bfd('0x46')](_0x5021bb['query']['fields']));_0x5b7d71[_0x3bfd('0x3b')]=_0x5b7d71[_0x3bfd('0x3b')][_0x3bfd('0x3c')]?_0x5b7d71[_0x3bfd('0x3b')]:_0x4ad6f6[_0x3bfd('0x3a')];if(!_0x5021bb['query'][_0x3bfd('0x56')](_0x3bfd('0x3d'))){_0x5b7d71['limit']=qs['limit'](_0x5021bb[_0x3bfd('0x37')][_0x3bfd('0x21')]);_0x5b7d71[_0x3bfd('0x20')]=qs[_0x3bfd('0x20')](_0x5021bb['query'][_0x3bfd('0x20')]);}_0x5b7d71[_0x3bfd('0x3e')]=qs[_0x3bfd('0x3f')](_0x5021bb[_0x3bfd('0x37')]['sort']);_0x5b7d71[_0x3bfd('0x40')]=qs[_0x3bfd('0x38')](_[_0x3bfd('0x57')](_0x5021bb[_0x3bfd('0x37')],_0x4ad6f6[_0x3bfd('0x38')]));_0x5b7d71[_0x3bfd('0x40')][_0x3bfd('0x58')]=_0x3f149f['id'];if(_0x5021bb[_0x3bfd('0x37')][_0x3bfd('0x42')]){_0x5b7d71[_0x3bfd('0x40')]=_['merge'](_0x5b7d71['where'],{'$or':_[_0x3bfd('0x30')](_0x5b7d71['attributes'],function(_0x21952a){var _0xa0520f={};_0xa0520f[_0x21952a]={'$like':'%'+_0x5021bb[_0x3bfd('0x37')][_0x3bfd('0x42')]+'%'};return _0xa0520f;})});}_0x5b7d71=_[_0x3bfd('0x41')]({},_0x5b7d71,_0x5021bb[_0x3bfd('0x59')]);return db[_0x3bfd('0x55')][_0x3bfd('0x5a')](_0x5b7d71);}})[_0x3bfd('0x28')](function(_0x3f71a4){if(_0x3f71a4){return db[_0x3bfd('0x5b')][_0x3bfd('0x5c')]({'where':{'id':_[_0x3bfd('0x30')](_0x3f71a4,_0x3bfd('0x5d')),'role':_0x3bfd('0x5e')},'attributes':['id',_0x3bfd('0x2d'),_0x3bfd('0x5f'),_0x3bfd('0x60'),_0x3bfd('0x61')]});}})[_0x3bfd('0x28')](function(_0x515c55){if(_0x515c55){return{'count':_0x515c55[_0x3bfd('0x1f')],'rows':_[_0x3bfd('0x30')](_0x515c55['rows'],function(_0x4a9327){return{'membername':_0x4a9327['name'],'UserId':_0x4a9327['id'],'queue_name':_0x3cb4ea[_0x3bfd('0x2d')],'WhatsappQueueId':_0x3cb4ea['id'],'interface':util[_0x3bfd('0x62')]('%s/%s',_0x3bfd('0x63'),_0x4a9327[_0x3bfd('0x2d')]),'penalty':0x0,'paused':_0x4a9327['whatsappPause'],'createdAt':_0x4a9327[_0x3bfd('0x61')],'updatedAt':_0x4a9327[_0x3bfd('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3bfd('0x28')](respondWithFilteredResult(_0x35fa3e,_0x5b7d71))['catch'](handleError(_0x35fa3e,null));};exports[_0x3bfd('0x64')]=function(_0x3cdd65,_0x4d2b23,_0x1f0375){var _0x5e0251={};var _0x179046={};var _0x5954ad;var _0x14e526;return db['WhatsappQueue'][_0x3bfd('0x54')]({'where':{'id':_0x3cdd65[_0x3bfd('0x45')]['id']}})[_0x3bfd('0x28')](handleEntityNotFound(_0x4d2b23,null))[_0x3bfd('0x28')](function(_0x3b17f4){if(_0x3b17f4){_0x5954ad=_0x3b17f4;_0x179046[_0x3bfd('0x3a')]=_['keys'](db[_0x3bfd('0x65')][_0x3bfd('0x32')]);_0x179046[_0x3bfd('0x37')]=_['keys'](_0x3cdd65[_0x3bfd('0x37')]);_0x179046[_0x3bfd('0x38')]=_[_0x3bfd('0x39')](_0x179046[_0x3bfd('0x3a')],_0x179046['query']);_0x5e0251[_0x3bfd('0x3b')]=_[_0x3bfd('0x39')](_0x179046[_0x3bfd('0x3a')],qs['fields'](_0x3cdd65[_0x3bfd('0x37')][_0x3bfd('0x46')]));_0x5e0251['attributes']=_0x5e0251[_0x3bfd('0x3b')][_0x3bfd('0x3c')]?_0x5e0251[_0x3bfd('0x3b')]:_0x179046['model'];_0x5e0251[_0x3bfd('0x3e')]=qs[_0x3bfd('0x3f')](_0x3cdd65[_0x3bfd('0x37')][_0x3bfd('0x3f')]);_0x5e0251[_0x3bfd('0x40')]=qs[_0x3bfd('0x38')](_[_0x3bfd('0x57')](_0x3cdd65[_0x3bfd('0x37')],_0x179046[_0x3bfd('0x38')]));if(_0x3cdd65[_0x3bfd('0x37')]['filter']){_0x5e0251['where']=_[_0x3bfd('0x41')](_0x5e0251[_0x3bfd('0x40')],{'$or':_['map'](_0x5e0251['attributes'],function(_0x3e9417){var _0x818e2c={};_0x818e2c[_0x3e9417]={'$like':'%'+_0x3cdd65[_0x3bfd('0x37')]['filter']+'%'};return _0x818e2c;})});}_0x5e0251=_[_0x3bfd('0x41')]({},_0x5e0251,_0x3cdd65[_0x3bfd('0x59')]);return _0x5954ad['getTeams'](_0x5e0251);}})[_0x3bfd('0x28')](function(_0x528d2b){if(_0x528d2b){_0x14e526=_0x528d2b[_0x3bfd('0x3c')];if(!_0x3cdd65[_0x3bfd('0x37')][_0x3bfd('0x56')]('nolimit')){_0x5e0251['limit']=qs[_0x3bfd('0x21')](_0x3cdd65['query'][_0x3bfd('0x21')]);_0x5e0251[_0x3bfd('0x20')]=qs[_0x3bfd('0x20')](_0x3cdd65[_0x3bfd('0x37')][_0x3bfd('0x20')]);}return _0x5954ad[_0x3bfd('0x64')](_0x5e0251);}})[_0x3bfd('0x28')](function(_0x39a6a2){if(_0x39a6a2){return _0x39a6a2?{'count':_0x14e526,'rows':_0x39a6a2}:null;}})[_0x3bfd('0x28')](respondWithResult(_0x4d2b23,null))['catch'](handleError(_0x4d2b23,null));};exports[_0x3bfd('0x66')]=function(_0x299825,_0x1f0c58,_0x48ed52){var _0x253774=_0x299825[_0x3bfd('0x4a')][_0x3bfd('0x67')];return db[_0x3bfd('0x65')]['findAll']({'where':{'id':_0x253774},'attributes':['id'],'include':[{'model':db[_0x3bfd('0x5b')],'as':'Agents','attributes':['id','name','online',_0x3bfd('0x68'),_0x3bfd('0x69')],'raw':!![]}]})[_0x3bfd('0x28')](function(_0x24f42a){if(_0x24f42a){var _0x105740=_[_0x3bfd('0x6a')](_0x24f42a,function(_0x128dcb){var _0x339cee=_0x128dcb[_0x3bfd('0x4c')]({'plain':!![]});return _0x339cee[_0x3bfd('0x6b')];});return db[_0x3bfd('0x31')][_0x3bfd('0x48')]({'where':{'id':_0x299825[_0x3bfd('0x45')]['id']}})[_0x3bfd('0x28')](function(_0x29e5e0){return db['sequelize'][_0x3bfd('0x6c')](function(_0x464ba7){return _0x29e5e0[_0x3bfd('0x66')](_0x253774,{'transaction':_0x464ba7})[_0x3bfd('0x28')](function(){return BPromise[_0x3bfd('0x6d')](_0x105740,function(_0x189c37){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x189c37['id'],'WhatsappQueueId':_0x299825[_0x3bfd('0x45')]['id']},'transaction':_0x464ba7});});})[_0x3bfd('0x28')](function(){_0x105740['forEach'](function(_0x4be38e){socket['emit'](_0x3bfd('0x6e'),{'UserId':_0x4be38e['id'],'WhatsappQueueId':_0x29e5e0['id']});});});});});}})[_0x3bfd('0x28')](respondWithStatusCode(_0x1f0c58,null))['catch'](handleError(_0x1f0c58,null));};exports[_0x3bfd('0x6f')]=function(_0xd14f16,_0x4bd29c,_0x413a61){return db['Team'][_0x3bfd('0x5a')]({'where':{'id':_0xd14f16[_0x3bfd('0x37')][_0x3bfd('0x67')]},'attributes':['id'],'include':[{'model':db[_0x3bfd('0x5b')],'as':_0x3bfd('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x3bfd('0x28')](handleEntityNotFound(_0x4bd29c,null))['then'](function(_0x42cbcb){var _0x2d9432=_[_0x3bfd('0x30')](_0x42cbcb,'id');var _0x2aec16=[];var _0x43a05a=[];var _0x2870ba=squel[_0x3bfd('0x70')]();_0x2870ba[_0x3bfd('0x71')](_0x3bfd('0x72'))[_0x3bfd('0x73')](_0x3bfd('0x74'),'tq')[_0x3bfd('0x75')](_0x3bfd('0x76'),'ut',_0x3bfd('0x77'))[_0x3bfd('0x40')](_0x3bfd('0x78'),_0xd14f16[_0x3bfd('0x45')]['id']);for(var _0x467be8=0x0;_0x467be8<_0x42cbcb[_0x3bfd('0x3c')];_0x467be8+=0x1){let _0x10bebe=_0x42cbcb[_0x467be8];for(var _0x585296=0x0;_0x585296<_0x10bebe[_0x3bfd('0x6b')][_0x3bfd('0x3c')];_0x585296+=0x1){let _0x165149=_0x10bebe[_0x3bfd('0x6b')][_0x585296];var _0x29d064=_0x2870ba[_0x3bfd('0x79')]();_0x29d064[_0x3bfd('0x40')]('ut.UserId\x20=\x20?',_0x165149['id']);_0x43a05a['push'](db[_0x3bfd('0x7a')][_0x3bfd('0x37')](_0x29d064[_0x3bfd('0x7b')](),{'type':db[_0x3bfd('0x7a')]['QueryTypes'][_0x3bfd('0x7c')]})[_0x3bfd('0x28')](function(_0x289afe){if(_0x289afe[_0x3bfd('0x3c')]===0x1){return _0x165149['id'];}else{var _0x1e3a01=_['every'](_[_0x3bfd('0x30')](_0x289afe,_0x3bfd('0x7d')),function(_0x23dc9a){return _[_0x3bfd('0x7e')](_0x2d9432,_0x23dc9a);});if(_0x1e3a01){return _0x165149['id'];}}}));}}return BPromise[_0x3bfd('0x7f')](_0x43a05a)[_0x3bfd('0x28')](function(_0x2b5a49){_0x2aec16=_(_0x2aec16)[_0x3bfd('0x80')](_0x2b5a49)[_0x3bfd('0x81')]()[_0x3bfd('0x82')]();return db[_0x3bfd('0x31')][_0x3bfd('0x48')]({'where':{'id':_0xd14f16[_0x3bfd('0x45')]['id']}})[_0x3bfd('0x28')](function(_0x44a9a1){return db[_0x3bfd('0x7a')]['transaction'](function(_0x1b77ed){return _0x44a9a1[_0x3bfd('0x6f')](_0xd14f16[_0x3bfd('0x37')][_0x3bfd('0x67')],{'transaction':_0x1b77ed})[_0x3bfd('0x28')](function(){if(!_[_0x3bfd('0x83')](_0x2aec16)){return _0x44a9a1[_0x3bfd('0x84')](_0x2aec16,{'transaction':_0x1b77ed});}})['then'](function(){_0x2aec16['forEach'](function(_0x293627){socket[_0x3bfd('0x85')](_0x3bfd('0x86'),{'UserId':_0x293627,'WhatsappQueueId':_0x44a9a1['id']});});});});});});})['then'](respondWithStatusCode(_0x4bd29c,null))[_0x3bfd('0x44')](handleError(_0x4bd29c,null));};exports[_0x3bfd('0x87')]=function(_0xedb91d,_0x8dc275,_0x5ccd34){return db['WhatsappQueue'][_0x3bfd('0x48')]({'where':{'id':_0xedb91d['params']['id']}})[_0x3bfd('0x28')](handleEntityNotFound(_0x8dc275,null))['then'](function(_0x339dfa){if(_0x339dfa){return _0x339dfa[_0x3bfd('0x87')](_0xedb91d[_0x3bfd('0x4a')][_0x3bfd('0x67')],_[_0x3bfd('0x88')](_0xedb91d[_0x3bfd('0x4a')],[_0x3bfd('0x67'),'id'])||{})['spread'](function(_0x1ccbc8){for(var _0xf164f1=0x0;_0xf164f1<_0xedb91d[_0x3bfd('0x4a')]['ids']['length'];_0xf164f1+=0x1){socket[_0x3bfd('0x85')](_0x3bfd('0x6e'),{'UserId':_0xedb91d[_0x3bfd('0x4a')][_0x3bfd('0x67')][_0xf164f1],'WhatsappQueueId':_0xedb91d[_0x3bfd('0x45')]['id']});}return _0x1ccbc8;});}})[_0x3bfd('0x28')](respondWithResult(_0x8dc275,null))[_0x3bfd('0x44')](handleError(_0x8dc275,null));};exports['removeAgents']=function(_0x3c5240,_0x4438a4,_0x484e2f){return db[_0x3bfd('0x31')][_0x3bfd('0x48')]({'where':{'id':_0x3c5240['params']['id']}})['then'](handleEntityNotFound(_0x4438a4,null))['then'](function(_0x166c99){if(_0x166c99){return _0x166c99['removeAgents'](_0x3c5240['query'][_0x3bfd('0x67')])['then'](function(){if(_[_0x3bfd('0x89')](_0x3c5240[_0x3bfd('0x37')][_0x3bfd('0x67')])){for(var _0x43298c=0x0;_0x43298c<_0x3c5240[_0x3bfd('0x37')][_0x3bfd('0x67')][_0x3bfd('0x3c')];_0x43298c+=0x1){socket[_0x3bfd('0x85')](_0x3bfd('0x86'),{'UserId':Number(_0x3c5240['query'][_0x3bfd('0x67')][_0x43298c]),'WhatsappQueueId':Number(_0x3c5240[_0x3bfd('0x45')]['id'])});}}else{socket[_0x3bfd('0x85')](_0x3bfd('0x86'),{'UserId':Number(_0x3c5240['query']['ids']),'WhatsappQueueId':Number(_0x3c5240[_0x3bfd('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x4438a4,null))[_0x3bfd('0x44')](handleError(_0x4438a4,null));};exports[_0x3bfd('0x8a')]=function(_0x5efc4d,_0x5c0953,_0x391143){var _0x1f3279={};var _0x2a597a={};var _0x410c56;var _0x485136;return db['WhatsappQueue']['findOne']({'where':{'id':_0x5efc4d[_0x3bfd('0x45')]['id']}})[_0x3bfd('0x28')](handleEntityNotFound(_0x5c0953,null))[_0x3bfd('0x28')](function(_0x299ab5){if(_0x299ab5){_0x410c56=_0x299ab5;_0x2a597a[_0x3bfd('0x3a')]=_[_0x3bfd('0x36')](db['User'][_0x3bfd('0x32')]);_0x2a597a[_0x3bfd('0x37')]=_['keys'](_0x5efc4d[_0x3bfd('0x37')]);_0x2a597a['filters']=_[_0x3bfd('0x39')](_0x2a597a['model'],_0x2a597a[_0x3bfd('0x37')]);_0x1f3279['attributes']=_[_0x3bfd('0x39')](_0x2a597a['model'],qs[_0x3bfd('0x46')](_0x5efc4d[_0x3bfd('0x37')][_0x3bfd('0x46')]));_0x1f3279[_0x3bfd('0x3b')]=_0x1f3279[_0x3bfd('0x3b')][_0x3bfd('0x3c')]?_0x1f3279[_0x3bfd('0x3b')]:_0x2a597a[_0x3bfd('0x3a')];_0x1f3279[_0x3bfd('0x3e')]=qs[_0x3bfd('0x3f')](_0x5efc4d[_0x3bfd('0x37')][_0x3bfd('0x3f')]);_0x1f3279[_0x3bfd('0x40')]=qs[_0x3bfd('0x38')](_['pick'](_0x5efc4d[_0x3bfd('0x37')],_0x2a597a[_0x3bfd('0x38')]));if(_0x5efc4d['query']['filter']){_0x1f3279[_0x3bfd('0x40')]=_['merge'](_0x1f3279[_0x3bfd('0x40')],{'$or':_[_0x3bfd('0x30')](_0x1f3279[_0x3bfd('0x3b')],function(_0x259e5f){var _0x436e17={};_0x436e17[_0x259e5f]={'$like':'%'+_0x5efc4d[_0x3bfd('0x37')]['filter']+'%'};return _0x436e17;})});}_0x1f3279=_[_0x3bfd('0x41')]({},_0x1f3279,_0x5efc4d[_0x3bfd('0x59')]);return _0x410c56['getAgents'](_0x1f3279);}})[_0x3bfd('0x28')](function(_0x32a4e6){if(_0x32a4e6){_0x485136=_0x32a4e6[_0x3bfd('0x3c')];if(!_0x5efc4d[_0x3bfd('0x37')][_0x3bfd('0x56')](_0x3bfd('0x3d'))){_0x1f3279[_0x3bfd('0x21')]=qs[_0x3bfd('0x21')](_0x5efc4d['query'][_0x3bfd('0x21')]);_0x1f3279[_0x3bfd('0x20')]=qs[_0x3bfd('0x20')](_0x5efc4d['query']['offset']);}return _0x410c56[_0x3bfd('0x8a')](_0x1f3279);}})[_0x3bfd('0x28')](function(_0x1de869){if(_0x1de869){return _0x1de869?{'count':_0x485136,'rows':_0x1de869}:null;}})['then'](respondWithResult(_0x5c0953,null))[_0x3bfd('0x44')](handleError(_0x5c0953,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index e7cc42f..260f0f3 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 _0x43a6=['save','update','remove','exports','events','setMaxListeners'];(function(_0x457945,_0xde11f5){var _0x3b2adc=function(_0x21319b){while(--_0x21319b){_0x457945['push'](_0x457945['shift']());}};_0x3b2adc(++_0xde11f5);}(_0x43a6,0xe2));var _0x643a=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0x43a6[_0x1305e3];return _0x1068e9;};'use strict';var EventEmitter=require(_0x643a('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x643a('0x1')](0x0);var events={'afterCreate':_0x643a('0x2'),'afterUpdate':_0x643a('0x3'),'afterDestroy':_0x643a('0x4')};function emitEvent(_0x34a229){return function(_0xed20f7,_0x2d9a67,_0x220ae8){WhatsappQueueEvents['emit'](_0x34a229+':'+_0xed20f7['id'],_0xed20f7);WhatsappQueueEvents['emit'](_0x34a229,_0xed20f7);_0x220ae8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x643a('0x5')]=WhatsappQueueEvents; \ No newline at end of file +var _0xa56f=['remove','emit','exports','events','WhatsappQueue','setMaxListeners','save'];(function(_0x22663b,_0xc8c6e3){var _0x310d0a=function(_0x151e66){while(--_0x151e66){_0x22663b['push'](_0x22663b['shift']());}};_0x310d0a(++_0xc8c6e3);}(_0xa56f,0xc0));var _0xfa56=function(_0x333d4d,_0x50440f){_0x333d4d=_0x333d4d-0x0;var _0x21b5ca=_0xa56f[_0x333d4d];return _0x21b5ca;};'use strict';var EventEmitter=require(_0xfa56('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xfa56('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xfa56('0x2')](0x0);var events={'afterCreate':_0xfa56('0x3'),'afterUpdate':'update','afterDestroy':_0xfa56('0x4')};function emitEvent(_0x426f1a){return function(_0x3b4b3a,_0xe4bb4e,_0x461c8b){WhatsappQueueEvents[_0xfa56('0x5')](_0x426f1a+':'+_0x3b4b3a['id'],_0x3b4b3a);WhatsappQueueEvents[_0xfa56('0x5')](_0x426f1a,_0x3b4b3a);_0x461c8b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xfa56('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index f1edb19..2070143 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 _0x320e=['define','WhatsappQueue','whatsapp_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes'];(function(_0x19357e,_0x2e1ea3){var _0x34b9e0=function(_0x4ecfc3){while(--_0x4ecfc3){_0x19357e['push'](_0x19357e['shift']());}};_0x34b9e0(++_0x2e1ea3);}(_0x320e,0x19b));var _0xe320=function(_0x1a9e78,_0x180720){_0x1a9e78=_0x1a9e78-0x0;var _0x113e06=_0x320e[_0x1a9e78];return _0x113e06;};'use strict';var _=require(_0xe320('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe320('0x1'));var moment=require(_0xe320('0x2'));var BPromise=require(_0xe320('0x3'));var rp=require(_0xe320('0x4'));var fs=require('fs');var path=require(_0xe320('0x5'));var rimraf=require(_0xe320('0x6'));var config=require(_0xe320('0x7'));var attributes=require(_0xe320('0x8'));module['exports']=function(_0x193d13,_0x5de1f7){return _0x193d13[_0xe320('0x9')](_0xe320('0xa'),attributes,{'tableName':_0xe320('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8960=['WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0x8960,0x19a));var _0x0896=function(_0x1c6c1e,_0x175146){_0x1c6c1e=_0x1c6c1e-0x0;var _0x17e0bb=_0x8960[_0x1c6c1e];return _0x17e0bb;};'use strict';var _=require(_0x0896('0x0'));var util=require(_0x0896('0x1'));var logger=require(_0x0896('0x2'))('api');var moment=require(_0x0896('0x3'));var BPromise=require(_0x0896('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0896('0x5'));var rimraf=require(_0x0896('0x6'));var config=require(_0x0896('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0x0896('0x8')]=function(_0x50e306,_0xc09080){return _0x50e306[_0x0896('0x9')](_0x0896('0xa'),attributes,{'tableName':_0x0896('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 619ba41..5b60961 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 _0xb657=['options','raw','where','limit','include','map','model','attributes','WhatsappQueue','find','ShowWhatsappQueue','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetWhatsappQueue'];(function(_0x5609f5,_0x419ff7){var _0x50e7eb=function(_0x1f132b){while(--_0x1f132b){_0x5609f5['push'](_0x5609f5['shift']());}};_0x50e7eb(++_0x419ff7);}(_0xb657,0x187));var _0x7b65=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xb657[_0x32b542];return _0x554d54;};'use strict';var _=require('lodash');var util=require(_0x7b65('0x0'));var moment=require(_0x7b65('0x1'));var BPromise=require(_0x7b65('0x2'));var rs=require(_0x7b65('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7b65('0x4'));var logger=require(_0x7b65('0x5'))(_0x7b65('0x6'));var config=require(_0x7b65('0x7'));var jayson=require(_0x7b65('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x7b65('0x9')]=_[_0x7b65('0xa')](config[_0x7b65('0x9')],{'host':_0x7b65('0xb'),'port':0x18eb});var socket=require(_0x7b65('0xc'))(new Redis(config[_0x7b65('0x9')]));require(_0x7b65('0xd'))['register'](socket);function respondWithRpcPromise(_0x1aa106,_0x238f1f,_0x2cce61){return new BPromise(function(_0x55bd6d,_0x4dd4d6){return client['request'](_0x1aa106,_0x2cce61)[_0x7b65('0xe')](function(_0x3a371d){logger[_0x7b65('0xf')](_0x7b65('0x10'),_0x238f1f,'request\x20sent');logger[_0x7b65('0x11')](_0x7b65('0x12'),_0x238f1f,'request\x20sent',JSON[_0x7b65('0x13')](_0x3a371d));if(_0x3a371d[_0x7b65('0x14')]){if(_0x3a371d[_0x7b65('0x14')][_0x7b65('0x15')]===0x1f4){logger[_0x7b65('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x238f1f,_0x3a371d[_0x7b65('0x14')][_0x7b65('0x16')]);return _0x4dd4d6(_0x3a371d[_0x7b65('0x14')]['message']);}logger[_0x7b65('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x238f1f,_0x3a371d['error'][_0x7b65('0x16')]);return _0x55bd6d(_0x3a371d[_0x7b65('0x14')][_0x7b65('0x16')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x238f1f,_0x7b65('0x17'));_0x55bd6d(_0x3a371d[_0x7b65('0x18')][_0x7b65('0x16')]);}})[_0x7b65('0x19')](function(_0x275340){logger[_0x7b65('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x238f1f,_0x275340);_0x4dd4d6(_0x275340);});});}exports[_0x7b65('0x1a')]=function(_0x168e86){var _0x24ba01=this;return new Promise(function(_0x4e6e0b,_0x4913d8){return db['WhatsappQueue']['findAll']({'raw':_0x168e86[_0x7b65('0x1b')]?_0x168e86[_0x7b65('0x1b')][_0x7b65('0x1c')]===undefined?!![]:![]:!![],'where':_0x168e86['options']?_0x168e86[_0x7b65('0x1b')][_0x7b65('0x1d')]||null:null,'attributes':_0x168e86[_0x7b65('0x1b')]?_0x168e86[_0x7b65('0x1b')]['attributes']||null:null,'limit':_0x168e86[_0x7b65('0x1b')]?_0x168e86[_0x7b65('0x1b')][_0x7b65('0x1e')]||null:null,'include':_0x168e86[_0x7b65('0x1b')]?_0x168e86[_0x7b65('0x1b')][_0x7b65('0x1f')]?_['map'](_0x168e86[_0x7b65('0x1b')][_0x7b65('0x1f')],function(_0x312572){return{'model':db[_0x312572['model']],'as':_0x312572['as'],'attributes':_0x312572['attributes'],'include':_0x312572[_0x7b65('0x1f')]?_[_0x7b65('0x20')](_0x312572['include'],function(_0x5bde2b){return{'model':db[_0x5bde2b[_0x7b65('0x21')]],'as':_0x5bde2b['as'],'attributes':_0x5bde2b[_0x7b65('0x22')],'include':_0x5bde2b[_0x7b65('0x1f')]?_['map'](_0x5bde2b[_0x7b65('0x1f')],function(_0x4ee2ce){return{'model':db[_0x4ee2ce['model']],'as':_0x4ee2ce['as'],'attributes':_0x4ee2ce[_0x7b65('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b40a3){logger[_0x7b65('0xf')](_0x7b65('0x1a'),_0x168e86);logger[_0x7b65('0x11')](_0x7b65('0x1a'),_0x168e86,JSON[_0x7b65('0x13')](_0x3b40a3));_0x4e6e0b(_0x3b40a3);})['catch'](function(_0x59ccc2){logger['error'](_0x7b65('0x1a'),_0x59ccc2[_0x7b65('0x16')],_0x168e86);_0x4913d8(_0x24ba01[_0x7b65('0x14')](0x1f4,_0x59ccc2[_0x7b65('0x16')]));});});};exports['ShowWhatsappQueue']=function(_0x2c62d6){var _0xb2bcb4=this;return new Promise(function(_0x35aa07,_0x506b0f){return db[_0x7b65('0x23')][_0x7b65('0x24')]({'raw':_0x2c62d6[_0x7b65('0x1b')]?_0x2c62d6['options'][_0x7b65('0x1c')]===undefined?!![]:![]:!![],'where':_0x2c62d6[_0x7b65('0x1b')]?_0x2c62d6[_0x7b65('0x1b')][_0x7b65('0x1d')]||null:null,'attributes':_0x2c62d6[_0x7b65('0x1b')]?_0x2c62d6[_0x7b65('0x1b')]['attributes']||null:null,'include':_0x2c62d6[_0x7b65('0x1b')]?_0x2c62d6[_0x7b65('0x1b')][_0x7b65('0x1f')]?_[_0x7b65('0x20')](_0x2c62d6[_0x7b65('0x1b')][_0x7b65('0x1f')],function(_0x13bc5f){return{'model':db[_0x13bc5f['model']],'as':_0x13bc5f['as'],'attributes':_0x13bc5f[_0x7b65('0x22')],'include':_0x13bc5f[_0x7b65('0x1f')]?_['map'](_0x13bc5f[_0x7b65('0x1f')],function(_0x5d8ec1){return{'model':db[_0x5d8ec1['model']],'as':_0x5d8ec1['as'],'attributes':_0x5d8ec1[_0x7b65('0x22')],'include':_0x5d8ec1[_0x7b65('0x1f')]?_[_0x7b65('0x20')](_0x5d8ec1[_0x7b65('0x1f')],function(_0x127ab3){return{'model':db[_0x127ab3[_0x7b65('0x21')]],'as':_0x127ab3['as'],'attributes':_0x127ab3[_0x7b65('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39ecee){logger[_0x7b65('0xf')](_0x7b65('0x25'),_0x2c62d6);logger[_0x7b65('0x11')](_0x7b65('0x25'),_0x2c62d6,JSON['stringify'](_0x39ecee));_0x35aa07(_0x39ecee);})[_0x7b65('0x19')](function(_0x404ef4){logger[_0x7b65('0x14')]('ShowWhatsappQueue',_0x404ef4['message'],_0x2c62d6);_0x506b0f(_0xb2bcb4[_0x7b65('0x14')](0x1f4,_0x404ef4['message']));});});}; \ No newline at end of file +var _0xf575=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','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','error','code','message','catch','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','GetWhatsappQueue','ShowWhatsappQueue','raw','stringify','moment','bluebird','randomstring'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0xf575,0xa5));var _0x5f57=function(_0x574329,_0x5726cc){_0x574329=_0x574329-0x0;var _0x3a3620=_0xf575[_0x574329];return _0x3a3620;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5f57('0x0'));var BPromise=require(_0x5f57('0x1'));var rs=require(_0x5f57('0x2'));var fs=require('fs');var Redis=require(_0x5f57('0x3'));var db=require(_0x5f57('0x4'))['db'];var utils=require(_0x5f57('0x5'));var logger=require(_0x5f57('0x6'))(_0x5f57('0x7'));var config=require(_0x5f57('0x8'));var jayson=require(_0x5f57('0x9'));var client=jayson[_0x5f57('0xa')][_0x5f57('0xb')]({'port':0x232a});config[_0x5f57('0xc')]=_[_0x5f57('0xd')](config[_0x5f57('0xc')],{'host':_0x5f57('0xe'),'port':0x18eb});var socket=require(_0x5f57('0xf'))(new Redis(config[_0x5f57('0xc')]));require(_0x5f57('0x10'))[_0x5f57('0x11')](socket);function respondWithRpcPromise(_0x4441ec,_0x1a7601,_0x4b8886){return new BPromise(function(_0x3bc624,_0x5f1a20){return client[_0x5f57('0x12')](_0x4441ec,_0x4b8886)[_0x5f57('0x13')](function(_0xf34058){logger[_0x5f57('0x14')](_0x5f57('0x15'),_0x1a7601,_0x5f57('0x16'));logger[_0x5f57('0x17')](_0x5f57('0x18'),_0x1a7601,'request\x20sent',JSON['stringify'](_0xf34058));if(_0xf34058[_0x5f57('0x19')]){if(_0xf34058[_0x5f57('0x19')][_0x5f57('0x1a')]===0x1f4){logger[_0x5f57('0x19')](_0x5f57('0x15'),_0x1a7601,_0xf34058[_0x5f57('0x19')][_0x5f57('0x1b')]);return _0x5f1a20(_0xf34058[_0x5f57('0x19')][_0x5f57('0x1b')]);}logger['error'](_0x5f57('0x15'),_0x1a7601,_0xf34058[_0x5f57('0x19')]['message']);return _0x3bc624(_0xf34058[_0x5f57('0x19')]['message']);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x1a7601,_0x5f57('0x16'));_0x3bc624(_0xf34058['result']['message']);}})[_0x5f57('0x1c')](function(_0xa06b29){logger[_0x5f57('0x19')](_0x5f57('0x15'),_0x1a7601,_0xa06b29);_0x5f1a20(_0xa06b29);});});}exports['GetWhatsappQueue']=function(_0x3d0fc0){var _0x2bfedc=this;return new Promise(function(_0x2fc55d,_0x4c8615){return db[_0x5f57('0x1d')][_0x5f57('0x1e')]({'raw':_0x3d0fc0[_0x5f57('0x1f')]?_0x3d0fc0[_0x5f57('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3d0fc0[_0x5f57('0x1f')]?_0x3d0fc0[_0x5f57('0x1f')][_0x5f57('0x20')]||null:null,'attributes':_0x3d0fc0[_0x5f57('0x1f')]?_0x3d0fc0[_0x5f57('0x1f')][_0x5f57('0x21')]||null:null,'limit':_0x3d0fc0[_0x5f57('0x1f')]?_0x3d0fc0[_0x5f57('0x1f')][_0x5f57('0x22')]||null:null,'include':_0x3d0fc0['options']?_0x3d0fc0[_0x5f57('0x1f')][_0x5f57('0x23')]?_[_0x5f57('0x24')](_0x3d0fc0['options'][_0x5f57('0x23')],function(_0x50dd1e){return{'model':db[_0x50dd1e[_0x5f57('0x25')]],'as':_0x50dd1e['as'],'attributes':_0x50dd1e[_0x5f57('0x21')],'include':_0x50dd1e[_0x5f57('0x23')]?_[_0x5f57('0x24')](_0x50dd1e[_0x5f57('0x23')],function(_0x44b7c9){return{'model':db[_0x44b7c9[_0x5f57('0x25')]],'as':_0x44b7c9['as'],'attributes':_0x44b7c9['attributes'],'include':_0x44b7c9[_0x5f57('0x23')]?_[_0x5f57('0x24')](_0x44b7c9[_0x5f57('0x23')],function(_0x31e99f){return{'model':db[_0x31e99f[_0x5f57('0x25')]],'as':_0x31e99f['as'],'attributes':_0x31e99f[_0x5f57('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d26e1){logger['info'](_0x5f57('0x26'),_0x3d0fc0);logger[_0x5f57('0x17')]('GetWhatsappQueue',_0x3d0fc0,JSON['stringify'](_0x5d26e1));_0x2fc55d(_0x5d26e1);})[_0x5f57('0x1c')](function(_0x287411){logger['error'](_0x5f57('0x26'),_0x287411[_0x5f57('0x1b')],_0x3d0fc0);_0x4c8615(_0x2bfedc[_0x5f57('0x19')](0x1f4,_0x287411[_0x5f57('0x1b')]));});});};exports[_0x5f57('0x27')]=function(_0x6f22c6){var _0x3926ea=this;return new Promise(function(_0x4115da,_0x262849){return db['WhatsappQueue']['find']({'raw':_0x6f22c6[_0x5f57('0x1f')]?_0x6f22c6[_0x5f57('0x1f')][_0x5f57('0x28')]===undefined?!![]:![]:!![],'where':_0x6f22c6[_0x5f57('0x1f')]?_0x6f22c6[_0x5f57('0x1f')]['where']||null:null,'attributes':_0x6f22c6[_0x5f57('0x1f')]?_0x6f22c6[_0x5f57('0x1f')][_0x5f57('0x21')]||null:null,'include':_0x6f22c6[_0x5f57('0x1f')]?_0x6f22c6[_0x5f57('0x1f')][_0x5f57('0x23')]?_[_0x5f57('0x24')](_0x6f22c6[_0x5f57('0x1f')][_0x5f57('0x23')],function(_0x3e85ed){return{'model':db[_0x3e85ed[_0x5f57('0x25')]],'as':_0x3e85ed['as'],'attributes':_0x3e85ed[_0x5f57('0x21')],'include':_0x3e85ed[_0x5f57('0x23')]?_[_0x5f57('0x24')](_0x3e85ed[_0x5f57('0x23')],function(_0x155c5c){return{'model':db[_0x155c5c[_0x5f57('0x25')]],'as':_0x155c5c['as'],'attributes':_0x155c5c[_0x5f57('0x21')],'include':_0x155c5c[_0x5f57('0x23')]?_['map'](_0x155c5c[_0x5f57('0x23')],function(_0x9e1d7a){return{'model':db[_0x9e1d7a[_0x5f57('0x25')]],'as':_0x9e1d7a['as'],'attributes':_0x9e1d7a[_0x5f57('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5f57('0x13')](function(_0x48c629){logger[_0x5f57('0x14')](_0x5f57('0x27'),_0x6f22c6);logger[_0x5f57('0x17')](_0x5f57('0x27'),_0x6f22c6,JSON[_0x5f57('0x29')](_0x48c629));_0x4115da(_0x48c629);})[_0x5f57('0x1c')](function(_0x346c94){logger['error'](_0x5f57('0x27'),_0x346c94['message'],_0x6f22c6);_0x262849(_0x3926ea[_0x5f57('0x19')](0x1f4,_0x346c94['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index c59416f..197ac4d 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 _0x8eca=['length','whatsappQueue:','./whatsappQueue.events','save','remove','emit'];(function(_0x64521c,_0x3f4d33){var _0x3984d8=function(_0x5824d3){while(--_0x5824d3){_0x64521c['push'](_0x64521c['shift']());}};_0x3984d8(++_0x3f4d33);}(_0x8eca,0x1e2));var _0xa8ec=function(_0x577b14,_0x5ac386){_0x577b14=_0x577b14-0x0;var _0x252b3b=_0x8eca[_0x577b14];return _0x252b3b;};'use strict';var WhatsappQueueEvents=require(_0xa8ec('0x0'));var events=[_0xa8ec('0x1'),_0xa8ec('0x2'),'update'];function createListener(_0x54f228,_0x2bb833){return function(_0x209b3d){_0x2bb833[_0xa8ec('0x3')](_0x54f228,_0x209b3d);};}function removeListener(_0x2b76e6,_0x4e64a0){return function(){WhatsappQueueEvents['removeListener'](_0x2b76e6,_0x4e64a0);};}exports['register']=function(_0x5363ad){for(var _0x278798=0x0,_0x53209c=events[_0xa8ec('0x4')];_0x278798<_0x53209c;_0x278798++){var _0x5ec6fa=events[_0x278798];var _0x2b7477=createListener(_0xa8ec('0x5')+_0x5ec6fa,_0x5363ad);WhatsappQueueEvents['on'](_0x5ec6fa,_0x2b7477);}}; \ No newline at end of file +var _0x74a3=['length','whatsappQueue:','./whatsappQueue.events','save','remove','emit','removeListener','register'];(function(_0x5c7b86,_0x361fde){var _0x189239=function(_0x36887c){while(--_0x36887c){_0x5c7b86['push'](_0x5c7b86['shift']());}};_0x189239(++_0x361fde);}(_0x74a3,0x1b2));var _0x374a=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x74a3[_0x5b561d];return _0x431060;};'use strict';var WhatsappQueueEvents=require(_0x374a('0x0'));var events=[_0x374a('0x1'),_0x374a('0x2'),'update'];function createListener(_0x17dacf,_0x9689ad){return function(_0x1675b7){_0x9689ad[_0x374a('0x3')](_0x17dacf,_0x1675b7);};}function removeListener(_0x48d0c6,_0x5138f7){return function(){WhatsappQueueEvents[_0x374a('0x4')](_0x48d0c6,_0x5138f7);};}exports[_0x374a('0x5')]=function(_0x3e6b2f){for(var _0x278137=0x0,_0x4de31f=events[_0x374a('0x6')];_0x278137<_0x4de31f;_0x278137++){var _0x4342a1=events[_0x278137];var _0x539474=createListener(_0x374a('0x7')+_0x4342a1,_0x3e6b2f);WhatsappQueueEvents['on'](_0x4342a1,_0x539474);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 66e63e5..bedc54e 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 _0x88f5=['express','Router','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','destroy','multer','path','connect-timeout'];(function(_0xfcfa18,_0x2f924f){var _0xc27500=function(_0x597574){while(--_0x597574){_0xfcfa18['push'](_0xfcfa18['shift']());}};_0xc27500(++_0x2f924f);}(_0x88f5,0x162));var _0x588f=function(_0x5f373c,_0x27970c){_0x5f373c=_0x5f373c-0x0;var _0x557d09=_0x88f5[_0x5f373c];return _0x557d09;};'use strict';var multer=require(_0x588f('0x0'));var util=require('util');var path=require(_0x588f('0x1'));var timeout=require(_0x588f('0x2'));var express=require(_0x588f('0x3'));var router=express[_0x588f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x588f('0x5'));var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x588f('0x6')](),controller['index']);router[_0x588f('0x7')](_0x588f('0x8'),auth[_0x588f('0x6')](),controller[_0x588f('0x9')]);router['get'](_0x588f('0xa'),auth[_0x588f('0x6')](),controller[_0x588f('0xb')]);router[_0x588f('0xc')]('/',auth[_0x588f('0x6')](),controller[_0x588f('0xd')]);router[_0x588f('0xe')](_0x588f('0xa'),auth[_0x588f('0x6')](),controller[_0x588f('0xf')]);router['delete'](_0x588f('0xa'),auth[_0x588f('0x6')](),controller[_0x588f('0x10')]);module['exports']=router; \ No newline at end of file +var _0xba55=['../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba55,0x1f3));var _0x5ba5=function(_0x4b4872,_0x39d6cc){_0x4b4872=_0x4b4872-0x0;var _0x3c5cf2=_0xba55[_0x4b4872];return _0x3c5cf2;};'use strict';var multer=require(_0x5ba5('0x0'));var util=require(_0x5ba5('0x1'));var path=require(_0x5ba5('0x2'));var timeout=require(_0x5ba5('0x3'));var express=require('express');var router=express[_0x5ba5('0x4')]();var auth=require(_0x5ba5('0x5'));var interaction=require(_0x5ba5('0x6'));var config=require(_0x5ba5('0x7'));var controller=require(_0x5ba5('0x8'));router[_0x5ba5('0x9')]('/',auth['isAuthenticated'](),controller[_0x5ba5('0xa')]);router['get'](_0x5ba5('0xb'),auth[_0x5ba5('0xc')](),controller[_0x5ba5('0xd')]);router[_0x5ba5('0x9')](_0x5ba5('0xe'),auth[_0x5ba5('0xc')](),controller[_0x5ba5('0xf')]);router[_0x5ba5('0x10')]('/',auth['isAuthenticated'](),controller[_0x5ba5('0x11')]);router[_0x5ba5('0x12')]('/:id',auth[_0x5ba5('0xc')](),controller['update']);router[_0x5ba5('0x13')](_0x5ba5('0xe'),auth[_0x5ba5('0xc')](),controller[_0x5ba5('0x14')]);module[_0x5ba5('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index d3373f9..746fafe 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 _0x7fbe=['STRING','DATE'];(function(_0x13a097,_0x4a480c){var _0x2923c0=function(_0x16cad6){while(--_0x16cad6){_0x13a097['push'](_0x13a097['shift']());}};_0x2923c0(++_0x4a480c);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x51b861,_0xb480d3){_0x51b861=_0x51b861-0x0;var _0x52401b=_0x7fbe[_0x51b861];return _0x52401b;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0xe7fb('0x0')]},'joinAt':{'type':Sequelize[_0xe7fb('0x1')]},'leaveAt':{'type':Sequelize[_0xe7fb('0x1')]},'acceptAt':{'type':Sequelize[_0xe7fb('0x1')]},'exitAt':{'type':Sequelize[_0xe7fb('0x1')]},'reason':{'type':Sequelize[_0xe7fb('0x0')]}}; \ No newline at end of file +var _0x4b84=['sequelize','exports','DATE','STRING'];(function(_0x172fe8,_0x21c72e){var _0x3ef86e=function(_0x162607){while(--_0x162607){_0x172fe8['push'](_0x172fe8['shift']());}};_0x3ef86e(++_0x21c72e);}(_0x4b84,0x1cc));var _0x44b8=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0x4b84[_0x19ac6e];return _0x1cdcf3;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x44b8('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x44b8('0x2')]},'reason':{'type':Sequelize[_0x44b8('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index f07c2e1..a742014 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 _0x6a58=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','json','count','limit','set','Content-Range','reject','save','update','then','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto'];(function(_0x2c1ee7,_0x3443b8){var _0x2f9e25=function(_0xee88bf){while(--_0xee88bf){_0x2c1ee7['push'](_0x2c1ee7['shift']());}};_0x2f9e25(++_0x3443b8);}(_0x6a58,0x120));var _0x86a5=function(_0x548d7d,_0x2d41fc){_0x548d7d=_0x548d7d-0x0;var _0xb1c878=_0x6a58[_0x548d7d];return _0xb1c878;};'use strict';var pdf=require(_0x86a5('0x0'));var emlformat=require(_0x86a5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x86a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x86a5('0x3'));var moment=require('moment');var BPromise=require(_0x86a5('0x4'));var Mustache=require(_0x86a5('0x5'));var util=require(_0x86a5('0x6'));var path=require(_0x86a5('0x7'));var sox=require(_0x86a5('0x8'));var csv=require('to-csv');var ejs=require(_0x86a5('0x9'));var fs=require('fs');var _=require(_0x86a5('0xa'));var squel=require('squel');var crypto=require(_0x86a5('0xb'));var jsforce=require(_0x86a5('0xc'));var deskjs=require(_0x86a5('0xd'));var toCsv=require(_0x86a5('0xe'));var querystring=require(_0x86a5('0xf'));var Papa=require(_0x86a5('0x10'));var Redis=require(_0x86a5('0x11'));var authService=require(_0x86a5('0x12'));var qs=require(_0x86a5('0x13'));var as=require(_0x86a5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x86a5('0x15'));var utils=require('../../config/utils');var config=require(_0x86a5('0x16'));var db=require(_0x86a5('0x17'))['db'];function respondWithStatusCode(_0x4b560c,_0x2df079){_0x2df079=_0x2df079||0xcc;return function(_0x320af5){if(_0x320af5){return _0x4b560c['sendStatus'](_0x2df079);}return _0x4b560c[_0x86a5('0x18')](_0x2df079)[_0x86a5('0x19')]();};}function respondWithResult(_0x57730b,_0x40dcf6){_0x40dcf6=_0x40dcf6||0xc8;return function(_0x156a2b){if(_0x156a2b){return _0x57730b[_0x86a5('0x18')](_0x40dcf6)[_0x86a5('0x1a')](_0x156a2b);}};}function respondWithFilteredResult(_0x41661c,_0x5bbdbe){return function(_0x485829){if(_0x485829){var _0x12999d=_0x485829[_0x86a5('0x1b')],_0x5c3c99=_0x5bbdbe['offset'],_0x61d809=_0x5bbdbe['offset']+_0x5bbdbe[_0x86a5('0x1c')],_0x2a9b90;if(_0x61d809>=_0x12999d){_0x61d809=_0x12999d;_0x2a9b90=0xc8;}else{_0x2a9b90=0xce;}_0x41661c[_0x86a5('0x18')](_0x2a9b90);return _0x41661c[_0x86a5('0x1d')](_0x86a5('0x1e'),_0x5c3c99+'-'+_0x61d809+'/'+_0x12999d)[_0x86a5('0x1a')](_0x485829);}return null;};}function patchUpdates(_0x5dc885){return function(_0x44d076){try{jsonpatch['apply'](_0x44d076,_0x5dc885,!![]);}catch(_0x2a90cd){return BPromise[_0x86a5('0x1f')](_0x2a90cd);}return _0x44d076[_0x86a5('0x20')]();};}function saveUpdates(_0x3f306c,_0x1f79b1){return function(_0x390feb){if(_0x390feb){return _0x390feb[_0x86a5('0x21')](_0x3f306c)[_0x86a5('0x22')](function(_0x4f510f){return _0x4f510f;});}return null;};}function removeEntity(_0x48d851,_0x1f0af0){return function(_0x39dcde){if(_0x39dcde){return _0x39dcde['destroy']()['then'](function(){_0x48d851['status'](0xcc)[_0x86a5('0x19')]();});}};}function handleEntityNotFound(_0x2960f7,_0x2ef076){return function(_0x512df9){if(!_0x512df9){_0x2960f7['sendStatus'](0x194);}return _0x512df9;};}function handleError(_0x2a9dee,_0x33d7d7){_0x33d7d7=_0x33d7d7||0x1f4;return function(_0x41c449){logger['error'](_0x41c449[_0x86a5('0x23')]);if(_0x41c449['name']){delete _0x41c449[_0x86a5('0x24')];}_0x2a9dee['status'](_0x33d7d7)[_0x86a5('0x25')](_0x41c449);};}exports[_0x86a5('0x26')]=function(_0x1447c4,_0x19049d){var _0x3af4a5={},_0x887e58={},_0x56ffff={'count':0x0,'rows':[]};var _0x4fd466=_[_0x86a5('0x27')](db[_0x86a5('0x28')][_0x86a5('0x29')],function(_0xcbf54e){return{'name':_0xcbf54e[_0x86a5('0x2a')],'type':_0xcbf54e[_0x86a5('0x2b')][_0x86a5('0x2c')]};});_0x887e58['model']=_[_0x86a5('0x27')](_0x4fd466,'name');_0x887e58['query']=_[_0x86a5('0x2d')](_0x1447c4['query']);_0x887e58[_0x86a5('0x2e')]=_[_0x86a5('0x2f')](_0x887e58[_0x86a5('0x30')],_0x887e58[_0x86a5('0x31')]);_0x3af4a5[_0x86a5('0x32')]=_[_0x86a5('0x2f')](_0x887e58[_0x86a5('0x30')],qs[_0x86a5('0x33')](_0x1447c4[_0x86a5('0x31')][_0x86a5('0x33')]));_0x3af4a5[_0x86a5('0x32')]=_0x3af4a5[_0x86a5('0x32')][_0x86a5('0x34')]?_0x3af4a5[_0x86a5('0x32')]:_0x887e58['model'];if(!_0x1447c4[_0x86a5('0x31')][_0x86a5('0x35')](_0x86a5('0x36'))){_0x3af4a5[_0x86a5('0x1c')]=qs[_0x86a5('0x1c')](_0x1447c4[_0x86a5('0x31')][_0x86a5('0x1c')]);_0x3af4a5['offset']=qs['offset'](_0x1447c4[_0x86a5('0x31')][_0x86a5('0x37')]);}_0x3af4a5[_0x86a5('0x38')]=qs[_0x86a5('0x39')](_0x1447c4[_0x86a5('0x31')][_0x86a5('0x39')]);_0x3af4a5['where']=qs[_0x86a5('0x2e')](_[_0x86a5('0x3a')](_0x1447c4['query'],_0x887e58[_0x86a5('0x2e')]),_0x4fd466);if(_0x1447c4[_0x86a5('0x31')]['filter']){_0x3af4a5['where']=_[_0x86a5('0x3b')](_0x3af4a5[_0x86a5('0x3c')],{'$or':_[_0x86a5('0x27')](_0x4fd466,function(_0x19fffc){if(_0x19fffc['type']!==_0x86a5('0x3d')){var _0x21452b={};_0x21452b[_0x19fffc[_0x86a5('0x24')]]={'$like':'%'+_0x1447c4[_0x86a5('0x31')][_0x86a5('0x3e')]+'%'};return _0x21452b;}})});}_0x3af4a5=_['merge']({},_0x3af4a5,_0x1447c4[_0x86a5('0x3f')]);var _0xc11519={'where':_0x3af4a5[_0x86a5('0x3c')]};return db['WhatsappQueueReport'][_0x86a5('0x1b')](_0xc11519)['then'](function(_0x4c84a0){_0x56ffff['count']=_0x4c84a0;if(_0x1447c4[_0x86a5('0x31')][_0x86a5('0x40')]){_0x3af4a5['include']=[{'all':!![]}];}return db[_0x86a5('0x28')][_0x86a5('0x41')](_0x3af4a5);})['then'](function(_0x16f834){_0x56ffff[_0x86a5('0x42')]=_0x16f834;return _0x56ffff;})[_0x86a5('0x22')](respondWithFilteredResult(_0x19049d,_0x3af4a5))[_0x86a5('0x43')](handleError(_0x19049d,null));};exports[_0x86a5('0x44')]=function(_0x1998e2,_0x4672fd){var _0x4d4cb3={'raw':!![],'where':{'id':_0x1998e2[_0x86a5('0x45')]['id']}},_0x39a675={};_0x39a675[_0x86a5('0x30')]=_[_0x86a5('0x2d')](db[_0x86a5('0x28')]['rawAttributes']);_0x39a675[_0x86a5('0x31')]=_['keys'](_0x1998e2[_0x86a5('0x31')]);_0x39a675[_0x86a5('0x2e')]=_[_0x86a5('0x2f')](_0x39a675[_0x86a5('0x30')],_0x39a675[_0x86a5('0x31')]);_0x4d4cb3['attributes']=_[_0x86a5('0x2f')](_0x39a675[_0x86a5('0x30')],qs['fields'](_0x1998e2[_0x86a5('0x31')][_0x86a5('0x33')]));_0x4d4cb3[_0x86a5('0x32')]=_0x4d4cb3[_0x86a5('0x32')][_0x86a5('0x34')]?_0x4d4cb3[_0x86a5('0x32')]:_0x39a675[_0x86a5('0x30')];if(_0x1998e2[_0x86a5('0x31')][_0x86a5('0x40')]){_0x4d4cb3[_0x86a5('0x46')]=[{'all':!![]}];}_0x4d4cb3=_[_0x86a5('0x3b')]({},_0x4d4cb3,_0x1998e2['options']);return db['WhatsappQueueReport']['find'](_0x4d4cb3)[_0x86a5('0x22')](handleEntityNotFound(_0x4672fd,null))[_0x86a5('0x22')](respondWithResult(_0x4672fd,null))[_0x86a5('0x43')](handleError(_0x4672fd,null));};exports[_0x86a5('0x47')]=function(_0x669466,_0x365b2d){return db['WhatsappQueueReport'][_0x86a5('0x47')](_0x669466[_0x86a5('0x48')],{})['then'](respondWithResult(_0x365b2d,0xc9))[_0x86a5('0x43')](handleError(_0x365b2d,null));};exports[_0x86a5('0x21')]=function(_0x18aeab,_0xb1e8fc){if(_0x18aeab[_0x86a5('0x48')]['id']){delete _0x18aeab[_0x86a5('0x48')]['id'];}return db['WhatsappQueueReport'][_0x86a5('0x49')]({'where':{'id':_0x18aeab[_0x86a5('0x45')]['id']}})[_0x86a5('0x22')](handleEntityNotFound(_0xb1e8fc,null))[_0x86a5('0x22')](saveUpdates(_0x18aeab[_0x86a5('0x48')],null))[_0x86a5('0x22')](respondWithResult(_0xb1e8fc,null))[_0x86a5('0x43')](handleError(_0xb1e8fc,null));};exports['destroy']=function(_0x599412,_0x1fb196){return db['WhatsappQueueReport']['find']({'where':{'id':_0x599412[_0x86a5('0x45')]['id']}})[_0x86a5('0x22')](handleEntityNotFound(_0x1fb196,null))[_0x86a5('0x22')](removeEntity(_0x1fb196,null))[_0x86a5('0x43')](handleError(_0x1fb196,null));};exports[_0x86a5('0x4a')]=function(_0x572a31,_0x5e5e8c){return db[_0x86a5('0x28')][_0x86a5('0x4a')]()[_0x86a5('0x22')](respondWithResult(_0x5e5e8c,null))[_0x86a5('0x43')](handleError(_0x5e5e8c,null));}; \ No newline at end of file +var _0x7bd0=['update','then','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','WhatsappQueueReport','includeAll','findAll','rows','catch','show','params','include','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save'];(function(_0x3b9c6e,_0x3d7e9a){var _0x3db00b=function(_0x4c4671){while(--_0x4c4671){_0x3b9c6e['push'](_0x3b9c6e['shift']());}};_0x3db00b(++_0x3d7e9a);}(_0x7bd0,0x111));var _0x07bd=function(_0x149a9b,_0x5bb275){_0x149a9b=_0x149a9b-0x0;var _0x2c2bf6=_0x7bd0[_0x149a9b];return _0x2c2bf6;};'use strict';var pdf=require(_0x07bd('0x0'));var emlformat=require(_0x07bd('0x1'));var rimraf=require(_0x07bd('0x2'));var zipdir=require(_0x07bd('0x3'));var jsonpatch=require(_0x07bd('0x4'));var rp=require(_0x07bd('0x5'));var moment=require(_0x07bd('0x6'));var BPromise=require(_0x07bd('0x7'));var Mustache=require('mustache');var util=require(_0x07bd('0x8'));var path=require(_0x07bd('0x9'));var sox=require(_0x07bd('0xa'));var csv=require(_0x07bd('0xb'));var ejs=require(_0x07bd('0xc'));var fs=require('fs');var _=require(_0x07bd('0xd'));var squel=require(_0x07bd('0xe'));var crypto=require('crypto');var jsforce=require(_0x07bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x07bd('0xb'));var querystring=require(_0x07bd('0x10'));var Papa=require(_0x07bd('0x11'));var Redis=require('ioredis');var authService=require(_0x07bd('0x12'));var qs=require(_0x07bd('0x13'));var as=require(_0x07bd('0x14'));var hardwareService=require(_0x07bd('0x15'));var logger=require('../../config/logger')(_0x07bd('0x16'));var utils=require(_0x07bd('0x17'));var config=require(_0x07bd('0x18'));var db=require(_0x07bd('0x19'))['db'];function respondWithStatusCode(_0x456ecd,_0x1eff6c){_0x1eff6c=_0x1eff6c||0xcc;return function(_0x10aa2e){if(_0x10aa2e){return _0x456ecd[_0x07bd('0x1a')](_0x1eff6c);}return _0x456ecd['status'](_0x1eff6c)['end']();};}function respondWithResult(_0x2ca1bc,_0x3fe523){_0x3fe523=_0x3fe523||0xc8;return function(_0x1c59c2){if(_0x1c59c2){return _0x2ca1bc[_0x07bd('0x1b')](_0x3fe523)[_0x07bd('0x1c')](_0x1c59c2);}};}function respondWithFilteredResult(_0x2406b0,_0x2c9166){return function(_0x49d962){if(_0x49d962){var _0x418444=_0x49d962[_0x07bd('0x1d')],_0x505839=_0x2c9166[_0x07bd('0x1e')],_0x229bf1=_0x2c9166[_0x07bd('0x1e')]+_0x2c9166['limit'],_0x2dd97b;if(_0x229bf1>=_0x418444){_0x229bf1=_0x418444;_0x2dd97b=0xc8;}else{_0x2dd97b=0xce;}_0x2406b0[_0x07bd('0x1b')](_0x2dd97b);return _0x2406b0[_0x07bd('0x1f')]('Content-Range',_0x505839+'-'+_0x229bf1+'/'+_0x418444)[_0x07bd('0x1c')](_0x49d962);}return null;};}function patchUpdates(_0x72f775){return function(_0x758fd5){try{jsonpatch[_0x07bd('0x20')](_0x758fd5,_0x72f775,!![]);}catch(_0x36ccec){return BPromise[_0x07bd('0x21')](_0x36ccec);}return _0x758fd5[_0x07bd('0x22')]();};}function saveUpdates(_0x1a65ff,_0x29a52e){return function(_0x50109f){if(_0x50109f){return _0x50109f[_0x07bd('0x23')](_0x1a65ff)[_0x07bd('0x24')](function(_0xcb8b23){return _0xcb8b23;});}return null;};}function removeEntity(_0x11684d,_0x16d0e6){return function(_0x47bd50){if(_0x47bd50){return _0x47bd50['destroy']()[_0x07bd('0x24')](function(){_0x11684d['status'](0xcc)[_0x07bd('0x25')]();});}};}function handleEntityNotFound(_0x480c9c,_0x50bd12){return function(_0x4165bc){if(!_0x4165bc){_0x480c9c[_0x07bd('0x1a')](0x194);}return _0x4165bc;};}function handleError(_0xf3b23c,_0xdb47ba){_0xdb47ba=_0xdb47ba||0x1f4;return function(_0x28bd91){logger[_0x07bd('0x26')](_0x28bd91['stack']);if(_0x28bd91[_0x07bd('0x27')]){delete _0x28bd91[_0x07bd('0x27')];}_0xf3b23c[_0x07bd('0x1b')](_0xdb47ba)[_0x07bd('0x28')](_0x28bd91);};}exports[_0x07bd('0x29')]=function(_0x1c1fda,_0x571dab){var _0x56687f={},_0x5184dc={},_0x335d61={'count':0x0,'rows':[]};var _0xfa7566=_[_0x07bd('0x2a')](db['WhatsappQueueReport'][_0x07bd('0x2b')],function(_0x400cc0){return{'name':_0x400cc0[_0x07bd('0x2c')],'type':_0x400cc0[_0x07bd('0x2d')][_0x07bd('0x2e')]};});_0x5184dc[_0x07bd('0x2f')]=_['map'](_0xfa7566,_0x07bd('0x27'));_0x5184dc[_0x07bd('0x30')]=_[_0x07bd('0x31')](_0x1c1fda[_0x07bd('0x30')]);_0x5184dc[_0x07bd('0x32')]=_[_0x07bd('0x33')](_0x5184dc[_0x07bd('0x2f')],_0x5184dc[_0x07bd('0x30')]);_0x56687f['attributes']=_['intersection'](_0x5184dc[_0x07bd('0x2f')],qs[_0x07bd('0x34')](_0x1c1fda[_0x07bd('0x30')]['fields']));_0x56687f[_0x07bd('0x35')]=_0x56687f[_0x07bd('0x35')][_0x07bd('0x36')]?_0x56687f['attributes']:_0x5184dc['model'];if(!_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x37')](_0x07bd('0x38'))){_0x56687f[_0x07bd('0x39')]=qs['limit'](_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x39')]);_0x56687f[_0x07bd('0x1e')]=qs['offset'](_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x1e')]);}_0x56687f['order']=qs[_0x07bd('0x3a')](_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x3a')]);_0x56687f[_0x07bd('0x3b')]=qs['filters'](_['pick'](_0x1c1fda[_0x07bd('0x30')],_0x5184dc['filters']),_0xfa7566);if(_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x3c')]){_0x56687f[_0x07bd('0x3b')]=_[_0x07bd('0x3d')](_0x56687f[_0x07bd('0x3b')],{'$or':_[_0x07bd('0x2a')](_0xfa7566,function(_0x3e63b3){if(_0x3e63b3[_0x07bd('0x2d')]!==_0x07bd('0x3e')){var _0x27b563={};_0x27b563[_0x3e63b3[_0x07bd('0x27')]]={'$like':'%'+_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x3c')]+'%'};return _0x27b563;}})});}_0x56687f=_['merge']({},_0x56687f,_0x1c1fda[_0x07bd('0x3f')]);var _0x2799c6={'where':_0x56687f[_0x07bd('0x3b')]};return db[_0x07bd('0x40')]['count'](_0x2799c6)[_0x07bd('0x24')](function(_0xa36d6b){_0x335d61[_0x07bd('0x1d')]=_0xa36d6b;if(_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x41')]){_0x56687f['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x07bd('0x42')](_0x56687f);})[_0x07bd('0x24')](function(_0x17c3df){_0x335d61[_0x07bd('0x43')]=_0x17c3df;return _0x335d61;})['then'](respondWithFilteredResult(_0x571dab,_0x56687f))[_0x07bd('0x44')](handleError(_0x571dab,null));};exports[_0x07bd('0x45')]=function(_0x3de7d3,_0x6cdf23){var _0x318b7c={'raw':!![],'where':{'id':_0x3de7d3[_0x07bd('0x46')]['id']}},_0x2a08e3={};_0x2a08e3['model']=_[_0x07bd('0x31')](db[_0x07bd('0x40')][_0x07bd('0x2b')]);_0x2a08e3[_0x07bd('0x30')]=_[_0x07bd('0x31')](_0x3de7d3['query']);_0x2a08e3[_0x07bd('0x32')]=_[_0x07bd('0x33')](_0x2a08e3[_0x07bd('0x2f')],_0x2a08e3[_0x07bd('0x30')]);_0x318b7c[_0x07bd('0x35')]=_['intersection'](_0x2a08e3[_0x07bd('0x2f')],qs[_0x07bd('0x34')](_0x3de7d3[_0x07bd('0x30')][_0x07bd('0x34')]));_0x318b7c['attributes']=_0x318b7c['attributes'][_0x07bd('0x36')]?_0x318b7c[_0x07bd('0x35')]:_0x2a08e3[_0x07bd('0x2f')];if(_0x3de7d3[_0x07bd('0x30')][_0x07bd('0x41')]){_0x318b7c[_0x07bd('0x47')]=[{'all':!![]}];}_0x318b7c=_[_0x07bd('0x3d')]({},_0x318b7c,_0x3de7d3[_0x07bd('0x3f')]);return db[_0x07bd('0x40')]['find'](_0x318b7c)['then'](handleEntityNotFound(_0x6cdf23,null))[_0x07bd('0x24')](respondWithResult(_0x6cdf23,null))[_0x07bd('0x44')](handleError(_0x6cdf23,null));};exports[_0x07bd('0x48')]=function(_0xaa85c5,_0x44274b){return db[_0x07bd('0x40')]['create'](_0xaa85c5[_0x07bd('0x49')],{})[_0x07bd('0x24')](respondWithResult(_0x44274b,0xc9))[_0x07bd('0x44')](handleError(_0x44274b,null));};exports[_0x07bd('0x23')]=function(_0x7755e2,_0x4155df){if(_0x7755e2['body']['id']){delete _0x7755e2[_0x07bd('0x49')]['id'];}return db[_0x07bd('0x40')][_0x07bd('0x4a')]({'where':{'id':_0x7755e2[_0x07bd('0x46')]['id']}})[_0x07bd('0x24')](handleEntityNotFound(_0x4155df,null))[_0x07bd('0x24')](saveUpdates(_0x7755e2[_0x07bd('0x49')],null))[_0x07bd('0x24')](respondWithResult(_0x4155df,null))[_0x07bd('0x44')](handleError(_0x4155df,null));};exports[_0x07bd('0x4b')]=function(_0x1ee56f,_0x2fa62e){return db['WhatsappQueueReport'][_0x07bd('0x4a')]({'where':{'id':_0x1ee56f[_0x07bd('0x46')]['id']}})[_0x07bd('0x24')](handleEntityNotFound(_0x2fa62e,null))['then'](removeEntity(_0x2fa62e,null))['catch'](handleError(_0x2fa62e,null));};exports[_0x07bd('0x4c')]=function(_0x560f06,_0x3d15b1){return db[_0x07bd('0x40')][_0x07bd('0x4c')]()[_0x07bd('0x24')](respondWithResult(_0x3d15b1,null))[_0x07bd('0x44')](handleError(_0x3d15b1,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index fbb4671..f6f86f7 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 _0x5707=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','uniqueid','lodash','../../config/logger','api'];(function(_0x3c33c4,_0x3490ea){var _0x2c4b73=function(_0x30c053){while(--_0x30c053){_0x3c33c4['push'](_0x3c33c4['shift']());}};_0x2c4b73(++_0x3490ea);}(_0x5707,0x1b9));var _0x7570=function(_0x1b5080,_0x3e7cc9){_0x1b5080=_0x1b5080-0x0;var _0x195c87=_0x5707[_0x1b5080];return _0x195c87;};'use strict';var _=require(_0x7570('0x0'));var util=require('util');var logger=require(_0x7570('0x1'))(_0x7570('0x2'));var moment=require(_0x7570('0x3'));var BPromise=require(_0x7570('0x4'));var rp=require(_0x7570('0x5'));var fs=require('fs');var path=require(_0x7570('0x6'));var rimraf=require(_0x7570('0x7'));var config=require(_0x7570('0x8'));var attributes=require(_0x7570('0x9'));module[_0x7570('0xa')]=function(_0x2ec0f0,_0x3e58ff){return _0x2ec0f0['define']('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x7570('0xb'),'fields':[_0x7570('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x25e4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','api'];(function(_0x221461,_0x57d49f){var _0x14b589=function(_0x2cf220){while(--_0x2cf220){_0x221461['push'](_0x221461['shift']());}};_0x14b589(++_0x57d49f);}(_0x25e4,0xe8));var _0x425e=function(_0x4f8db6,_0x33b819){_0x4f8db6=_0x4f8db6-0x0;var _0x1d4a1c=_0x25e4[_0x4f8db6];return _0x1d4a1c;};'use strict';var _=require(_0x425e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x425e('0x1'));var moment=require(_0x425e('0x2'));var BPromise=require(_0x425e('0x3'));var rp=require(_0x425e('0x4'));var fs=require('fs');var path=require(_0x425e('0x5'));var rimraf=require(_0x425e('0x6'));var config=require(_0x425e('0x7'));var attributes=require(_0x425e('0x8'));module[_0x425e('0x9')]=function(_0x25b532,_0xcf1e78){return _0x25b532[_0x425e('0xa')](_0x425e('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x425e('0xc'),'fields':[_0x425e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 5968560..7e6d305 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 _0x1196=['result','catch','body','options','raw','CreateWhatsappQueueReport','debug','UpdateWhatsappQueueReport','WhatsappQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1230ea,_0x499a33){var _0xe946e2=function(_0x29a4e9){while(--_0x29a4e9){_0x1230ea['push'](_0x1230ea['shift']());}};_0xe946e2(++_0x499a33);}(_0x1196,0x156));var _0x6119=function(_0x58ccec,_0x176ed2){_0x58ccec=_0x58ccec-0x0;var _0x33e59a=_0x1196[_0x58ccec];return _0x33e59a;};'use strict';var _=require(_0x6119('0x0'));var util=require(_0x6119('0x1'));var moment=require(_0x6119('0x2'));var BPromise=require(_0x6119('0x3'));var rs=require(_0x6119('0x4'));var fs=require('fs');var Redis=require(_0x6119('0x5'));var db=require(_0x6119('0x6'))['db'];var utils=require(_0x6119('0x7'));var logger=require(_0x6119('0x8'))(_0x6119('0x9'));var config=require('../../config/environment');var jayson=require(_0x6119('0xa'));var client=jayson['client'][_0x6119('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x330904,_0x1a2d2c,_0x546753){return new BPromise(function(_0x4c2600,_0x357625){return client['request'](_0x330904,_0x546753)[_0x6119('0xc')](function(_0x2120e8){logger[_0x6119('0xd')](_0x6119('0xe'),_0x1a2d2c,_0x6119('0xf'));logger['debug'](_0x6119('0x10'),_0x1a2d2c,_0x6119('0xf'),JSON[_0x6119('0x11')](_0x2120e8));if(_0x2120e8['error']){if(_0x2120e8[_0x6119('0x12')][_0x6119('0x13')]===0x1f4){logger['error'](_0x6119('0xe'),_0x1a2d2c,_0x2120e8[_0x6119('0x12')][_0x6119('0x14')]);return _0x357625(_0x2120e8['error'][_0x6119('0x14')]);}logger[_0x6119('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1a2d2c,_0x2120e8[_0x6119('0x12')][_0x6119('0x14')]);return _0x4c2600(_0x2120e8[_0x6119('0x12')][_0x6119('0x14')]);}else{logger[_0x6119('0xd')](_0x6119('0xe'),_0x1a2d2c,_0x6119('0xf'));_0x4c2600(_0x2120e8[_0x6119('0x15')][_0x6119('0x14')]);}})[_0x6119('0x16')](function(_0x415a82){logger[_0x6119('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1a2d2c,_0x415a82);_0x357625(_0x415a82);});});}exports['CreateWhatsappQueueReport']=function(_0x2d179d){var _0x554be9=this;return new Promise(function(_0x13c5ac,_0x5bfa3a){return db['WhatsappQueueReport']['create'](_0x2d179d[_0x6119('0x17')],{'raw':_0x2d179d[_0x6119('0x18')]?_0x2d179d[_0x6119('0x18')][_0x6119('0x19')]===undefined?!![]:![]:!![]})[_0x6119('0xc')](function(_0x464e76){logger[_0x6119('0xd')](_0x6119('0x1a'),_0x2d179d);logger[_0x6119('0x1b')](_0x6119('0x1a'),_0x2d179d,JSON[_0x6119('0x11')](_0x464e76));_0x13c5ac(_0x464e76);})[_0x6119('0x16')](function(_0x13b913){logger[_0x6119('0x12')]('CreateWhatsappQueueReport',_0x13b913['message'],_0x2d179d);_0x5bfa3a(_0x554be9[_0x6119('0x12')](0x1f4,_0x13b913[_0x6119('0x14')]));});});};exports[_0x6119('0x1c')]=function(_0x3b80c5){var _0x106e35=this;return new Promise(function(_0xf5eddc,_0x3e06bb){return db[_0x6119('0x1d')][_0x6119('0x1e')](_0x3b80c5[_0x6119('0x17')],{'raw':_0x3b80c5['options']?_0x3b80c5[_0x6119('0x18')][_0x6119('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b80c5[_0x6119('0x18')]?_0x3b80c5[_0x6119('0x18')]['where']||null:null,'attributes':_0x3b80c5[_0x6119('0x18')]?_0x3b80c5['options'][_0x6119('0x1f')]||null:null,'limit':_0x3b80c5[_0x6119('0x18')]?_0x3b80c5[_0x6119('0x18')][_0x6119('0x20')]||null:null})['then'](function(_0x2362c8){logger[_0x6119('0xd')]('UpdateWhatsappQueueReport',_0x3b80c5);logger[_0x6119('0x1b')](_0x6119('0x1c'),_0x3b80c5,JSON[_0x6119('0x11')](_0x2362c8));_0xf5eddc(_0x2362c8);})[_0x6119('0x16')](function(_0x358863){logger[_0x6119('0x12')](_0x6119('0x1c'),_0x358863['message'],_0x3b80c5);_0x3e06bb(_0x106e35['error'](0x1f4,_0x358863[_0x6119('0x14')]));});});}; \ No newline at end of file +var _0x4325=['limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','catch','WhatsappQueueReport','body','options','raw','then','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where'];(function(_0x3afe3c,_0x5b85b5){var _0x970cac=function(_0x35b4db){while(--_0x35b4db){_0x3afe3c['push'](_0x3afe3c['shift']());}};_0x970cac(++_0x5b85b5);}(_0x4325,0x177));var _0x5432=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4325[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require(_0x5432('0x2'));var BPromise=require(_0x5432('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require(_0x5432('0x5'))['db'];var utils=require(_0x5432('0x6'));var logger=require(_0x5432('0x7'))(_0x5432('0x8'));var config=require(_0x5432('0x9'));var jayson=require(_0x5432('0xa'));var client=jayson[_0x5432('0xb')][_0x5432('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x28d667,_0x31316f,_0x4aebde){return new BPromise(function(_0x12a0d0,_0x3b82bd){return client[_0x5432('0xd')](_0x28d667,_0x4aebde)['then'](function(_0x2d5db2){logger[_0x5432('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x31316f,_0x5432('0xf'));logger[_0x5432('0x10')](_0x5432('0x11'),_0x31316f,_0x5432('0xf'),JSON[_0x5432('0x12')](_0x2d5db2));if(_0x2d5db2[_0x5432('0x13')]){if(_0x2d5db2[_0x5432('0x13')][_0x5432('0x14')]===0x1f4){logger[_0x5432('0x13')](_0x5432('0x15'),_0x31316f,_0x2d5db2[_0x5432('0x13')][_0x5432('0x16')]);return _0x3b82bd(_0x2d5db2[_0x5432('0x13')][_0x5432('0x16')]);}logger[_0x5432('0x13')](_0x5432('0x15'),_0x31316f,_0x2d5db2['error'][_0x5432('0x16')]);return _0x12a0d0(_0x2d5db2[_0x5432('0x13')][_0x5432('0x16')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x31316f,'request\x20sent');_0x12a0d0(_0x2d5db2['result'][_0x5432('0x16')]);}})[_0x5432('0x17')](function(_0x5ec9ac){logger['error'](_0x5432('0x15'),_0x31316f,_0x5ec9ac);_0x3b82bd(_0x5ec9ac);});});}exports['CreateWhatsappQueueReport']=function(_0x4e415e){var _0x380646=this;return new Promise(function(_0x164eab,_0x251fae){return db[_0x5432('0x18')]['create'](_0x4e415e[_0x5432('0x19')],{'raw':_0x4e415e[_0x5432('0x1a')]?_0x4e415e[_0x5432('0x1a')][_0x5432('0x1b')]===undefined?!![]:![]:!![]})[_0x5432('0x1c')](function(_0x4a8bf3){logger[_0x5432('0xe')](_0x5432('0x1d'),_0x4e415e);logger['debug']('CreateWhatsappQueueReport',_0x4e415e,JSON['stringify'](_0x4a8bf3));_0x164eab(_0x4a8bf3);})[_0x5432('0x17')](function(_0x18b24a){logger[_0x5432('0x13')]('CreateWhatsappQueueReport',_0x18b24a['message'],_0x4e415e);_0x251fae(_0x380646[_0x5432('0x13')](0x1f4,_0x18b24a[_0x5432('0x16')]));});});};exports[_0x5432('0x1e')]=function(_0x59ea2e){var _0x189733=this;return new Promise(function(_0x4274f7,_0x3c8ff1){return db['WhatsappQueueReport'][_0x5432('0x1f')](_0x59ea2e[_0x5432('0x19')],{'raw':_0x59ea2e['options']?_0x59ea2e[_0x5432('0x1a')][_0x5432('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59ea2e['options']?_0x59ea2e['options'][_0x5432('0x20')]||null:null,'attributes':_0x59ea2e['options']?_0x59ea2e['options']['attributes']||null:null,'limit':_0x59ea2e[_0x5432('0x1a')]?_0x59ea2e[_0x5432('0x1a')][_0x5432('0x21')]||null:null})[_0x5432('0x1c')](function(_0x52a322){logger[_0x5432('0xe')](_0x5432('0x1e'),_0x59ea2e);logger[_0x5432('0x10')](_0x5432('0x1e'),_0x59ea2e,JSON[_0x5432('0x12')](_0x52a322));_0x4274f7(_0x52a322);})[_0x5432('0x17')](function(_0x47d053){logger[_0x5432('0x13')](_0x5432('0x1e'),_0x47d053[_0x5432('0x16')],_0x59ea2e);_0x3c8ff1(_0x189733[_0x5432('0x13')](0x1f4,_0x47d053[_0x5432('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 4ba1ab5..a76dc79 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 _0xf4bb=['describe','get','/:id','show','post','create','update','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','/describe'];(function(_0x2ffd05,_0x1840e3){var _0x5038bf=function(_0xe7e075){while(--_0xe7e075){_0x2ffd05['push'](_0x2ffd05['shift']());}};_0x5038bf(++_0x1840e3);}(_0xf4bb,0x118));var _0xbf4b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xf4bb[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require(_0xbf4b('0x0'));var util=require(_0xbf4b('0x1'));var path=require('path');var timeout=require(_0xbf4b('0x2'));var express=require('express');var router=express[_0xbf4b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbf4b('0x4'));var config=require(_0xbf4b('0x5'));var controller=require(_0xbf4b('0x6'));router['get']('/',auth[_0xbf4b('0x7')](),controller['index']);router['get'](_0xbf4b('0x8'),auth['isAuthenticated'](),controller[_0xbf4b('0x9')]);router[_0xbf4b('0xa')](_0xbf4b('0xb'),auth[_0xbf4b('0x7')](),controller[_0xbf4b('0xc')]);router[_0xbf4b('0xd')]('/',auth[_0xbf4b('0x7')](),controller[_0xbf4b('0xe')]);router['put'](_0xbf4b('0xb'),auth[_0xbf4b('0x7')](),controller[_0xbf4b('0xf')]);router['delete'](_0xbf4b('0xb'),auth[_0xbf4b('0x7')](),controller['destroy']);module[_0xbf4b('0x10')]=router; \ No newline at end of file +var _0x614e=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5e292d,_0x1e1d24){var _0x2bbc9d=function(_0xfb0817){while(--_0xfb0817){_0x5e292d['push'](_0x5e292d['shift']());}};_0x2bbc9d(++_0x1e1d24);}(_0x614e,0x19d));var _0xe614=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x614e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe614('0x0'));var util=require(_0xe614('0x1'));var path=require(_0xe614('0x2'));var timeout=require(_0xe614('0x3'));var express=require(_0xe614('0x4'));var router=express[_0xe614('0x5')]();var auth=require(_0xe614('0x6'));var interaction=require(_0xe614('0x7'));var config=require(_0xe614('0x8'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0xe614('0x9')](),controller[_0xe614('0xa')]);router[_0xe614('0xb')](_0xe614('0xc'),auth['isAuthenticated'](),controller[_0xe614('0xd')]);router['get'](_0xe614('0xe'),auth[_0xe614('0x9')](),controller[_0xe614('0xf')]);router[_0xe614('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe614('0x11')]('/:id',auth[_0xe614('0x9')](),controller[_0xe614('0x12')]);router[_0xe614('0x13')](_0xe614('0xe'),auth[_0xe614('0x9')](),controller[_0xe614('0x14')]);module[_0xe614('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 53c1f53..5c9b97e 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 _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f1861,_0x7b4285){_0x3f1861=_0x3f1861-0x0;var _0x7ca70a=_0xb10b[_0x3f1861];return _0x7ca70a;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file +var _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xb10b,0x12a));var _0xbb10=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xb10b[_0x119d5a];return _0x15bff4;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index e584312..f6bc403 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 _0xa165=['pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','update','then','end','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where'];(function(_0x268f6f,_0x32ddad){var _0x6a89b0=function(_0x88e820){while(--_0x88e820){_0x268f6f['push'](_0x268f6f['shift']());}};_0x6a89b0(++_0x32ddad);}(_0xa165,0x1d2));var _0x5a16=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xa165[_0x5f3f88];return _0xd08119;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5a16('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a16('0x1'));var jsonpatch=require(_0x5a16('0x2'));var rp=require(_0x5a16('0x3'));var moment=require('moment');var BPromise=require(_0x5a16('0x4'));var Mustache=require(_0x5a16('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5a16('0x6'));var csv=require(_0x5a16('0x7'));var ejs=require(_0x5a16('0x8'));var fs=require('fs');var _=require(_0x5a16('0x9'));var squel=require(_0x5a16('0xa'));var crypto=require(_0x5a16('0xb'));var jsforce=require(_0x5a16('0xc'));var deskjs=require(_0x5a16('0xd'));var toCsv=require(_0x5a16('0x7'));var querystring=require('querystring');var Papa=require(_0x5a16('0xe'));var Redis=require(_0x5a16('0xf'));var authService=require(_0x5a16('0x10'));var qs=require(_0x5a16('0x11'));var as=require(_0x5a16('0x12'));var hardwareService=require(_0x5a16('0x13'));var logger=require(_0x5a16('0x14'))(_0x5a16('0x15'));var utils=require(_0x5a16('0x16'));var config=require(_0x5a16('0x17'));var db=require(_0x5a16('0x18'))['db'];function respondWithStatusCode(_0x4f37a3,_0x21bf08){_0x21bf08=_0x21bf08||0xcc;return function(_0x56c31f){if(_0x56c31f){return _0x4f37a3[_0x5a16('0x19')](_0x21bf08);}return _0x4f37a3[_0x5a16('0x1a')](_0x21bf08)['end']();};}function respondWithResult(_0x40be17,_0x5d490d){_0x5d490d=_0x5d490d||0xc8;return function(_0xa30cfa){if(_0xa30cfa){return _0x40be17[_0x5a16('0x1a')](_0x5d490d)[_0x5a16('0x1b')](_0xa30cfa);}};}function respondWithFilteredResult(_0x56dfa8,_0x5c0a06){return function(_0x2f240e){if(_0x2f240e){var _0x31093a=_0x2f240e[_0x5a16('0x1c')],_0x2e7dc4=_0x5c0a06['offset'],_0x552be8=_0x5c0a06[_0x5a16('0x1d')]+_0x5c0a06[_0x5a16('0x1e')],_0x570a82;if(_0x552be8>=_0x31093a){_0x552be8=_0x31093a;_0x570a82=0xc8;}else{_0x570a82=0xce;}_0x56dfa8['status'](_0x570a82);return _0x56dfa8[_0x5a16('0x1f')](_0x5a16('0x20'),_0x2e7dc4+'-'+_0x552be8+'/'+_0x31093a)[_0x5a16('0x1b')](_0x2f240e);}return null;};}function patchUpdates(_0x393deb){return function(_0x1c41d8){try{jsonpatch['apply'](_0x1c41d8,_0x393deb,!![]);}catch(_0x5784d0){return BPromise['reject'](_0x5784d0);}return _0x1c41d8['save']();};}function saveUpdates(_0x58aa7d,_0x281bda){return function(_0x44a194){if(_0x44a194){return _0x44a194[_0x5a16('0x21')](_0x58aa7d)[_0x5a16('0x22')](function(_0x26f063){return _0x26f063;});}return null;};}function removeEntity(_0x39bbba,_0x2de0a9){return function(_0x386ecf){if(_0x386ecf){return _0x386ecf['destroy']()[_0x5a16('0x22')](function(){_0x39bbba[_0x5a16('0x1a')](0xcc)[_0x5a16('0x23')]();});}};}function handleEntityNotFound(_0x5543ee,_0x5b5dc6){return function(_0x2bd5a6){if(!_0x2bd5a6){_0x5543ee[_0x5a16('0x19')](0x194);}return _0x2bd5a6;};}function handleError(_0x23bf38,_0xf59ef1){_0xf59ef1=_0xf59ef1||0x1f4;return function(_0x2121b2){logger[_0x5a16('0x24')](_0x2121b2[_0x5a16('0x25')]);if(_0x2121b2[_0x5a16('0x26')]){delete _0x2121b2['name'];}_0x23bf38['status'](_0xf59ef1)[_0x5a16('0x27')](_0x2121b2);};}exports[_0x5a16('0x28')]=function(_0x411645,_0x548f18){var _0x50f6ed={},_0x39c452={},_0x3a1c5d={'count':0x0,'rows':[]};var _0x28e1c6=_[_0x5a16('0x29')](db[_0x5a16('0x2a')][_0x5a16('0x2b')],function(_0x51d768){return{'name':_0x51d768['fieldName'],'type':_0x51d768[_0x5a16('0x2c')][_0x5a16('0x2d')]};});_0x39c452['model']=_[_0x5a16('0x29')](_0x28e1c6,_0x5a16('0x26'));_0x39c452[_0x5a16('0x2e')]=_[_0x5a16('0x2f')](_0x411645[_0x5a16('0x2e')]);_0x39c452[_0x5a16('0x30')]=_[_0x5a16('0x31')](_0x39c452['model'],_0x39c452['query']);_0x50f6ed['attributes']=_['intersection'](_0x39c452['model'],qs[_0x5a16('0x32')](_0x411645['query']['fields']));_0x50f6ed['attributes']=_0x50f6ed[_0x5a16('0x33')][_0x5a16('0x34')]?_0x50f6ed[_0x5a16('0x33')]:_0x39c452[_0x5a16('0x35')];if(!_0x411645[_0x5a16('0x2e')][_0x5a16('0x36')](_0x5a16('0x37'))){_0x50f6ed[_0x5a16('0x1e')]=qs[_0x5a16('0x1e')](_0x411645[_0x5a16('0x2e')][_0x5a16('0x1e')]);_0x50f6ed[_0x5a16('0x1d')]=qs[_0x5a16('0x1d')](_0x411645[_0x5a16('0x2e')][_0x5a16('0x1d')]);}_0x50f6ed[_0x5a16('0x38')]=qs[_0x5a16('0x39')](_0x411645[_0x5a16('0x2e')][_0x5a16('0x39')]);_0x50f6ed[_0x5a16('0x3a')]=qs[_0x5a16('0x30')](_[_0x5a16('0x3b')](_0x411645[_0x5a16('0x2e')],_0x39c452['filters']),_0x28e1c6);if(_0x411645[_0x5a16('0x2e')][_0x5a16('0x3c')]){_0x50f6ed['where']=_[_0x5a16('0x3d')](_0x50f6ed[_0x5a16('0x3a')],{'$or':_['map'](_0x28e1c6,function(_0x22e085){if(_0x22e085[_0x5a16('0x2c')]!==_0x5a16('0x3e')){var _0x1225bf={};_0x1225bf[_0x22e085['name']]={'$like':'%'+_0x411645['query'][_0x5a16('0x3c')]+'%'};return _0x1225bf;}})});}_0x50f6ed=_[_0x5a16('0x3d')]({},_0x50f6ed,_0x411645[_0x5a16('0x3f')]);var _0xcfd4f8={'where':_0x50f6ed[_0x5a16('0x3a')]};return db[_0x5a16('0x2a')]['count'](_0xcfd4f8)[_0x5a16('0x22')](function(_0x32afa7){_0x3a1c5d['count']=_0x32afa7;if(_0x411645[_0x5a16('0x2e')][_0x5a16('0x40')]){_0x50f6ed['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x5a16('0x41')](_0x50f6ed);})[_0x5a16('0x22')](function(_0x437ae7){_0x3a1c5d[_0x5a16('0x42')]=_0x437ae7;return _0x3a1c5d;})[_0x5a16('0x22')](respondWithFilteredResult(_0x548f18,_0x50f6ed))[_0x5a16('0x43')](handleError(_0x548f18,null));};exports[_0x5a16('0x44')]=function(_0x44a481,_0x489654){var _0x325ec8={'raw':!![],'where':{'id':_0x44a481[_0x5a16('0x45')]['id']}},_0x24366f={};_0x24366f['model']=_['keys'](db[_0x5a16('0x2a')][_0x5a16('0x2b')]);_0x24366f[_0x5a16('0x2e')]=_[_0x5a16('0x2f')](_0x44a481['query']);_0x24366f['filters']=_[_0x5a16('0x31')](_0x24366f['model'],_0x24366f[_0x5a16('0x2e')]);_0x325ec8[_0x5a16('0x33')]=_[_0x5a16('0x31')](_0x24366f[_0x5a16('0x35')],qs[_0x5a16('0x32')](_0x44a481[_0x5a16('0x2e')][_0x5a16('0x32')]));_0x325ec8[_0x5a16('0x33')]=_0x325ec8[_0x5a16('0x33')]['length']?_0x325ec8[_0x5a16('0x33')]:_0x24366f[_0x5a16('0x35')];if(_0x44a481[_0x5a16('0x2e')][_0x5a16('0x40')]){_0x325ec8['include']=[{'all':!![]}];}_0x325ec8=_['merge']({},_0x325ec8,_0x44a481[_0x5a16('0x3f')]);return db['WhatsappTransferReport'][_0x5a16('0x46')](_0x325ec8)[_0x5a16('0x22')](handleEntityNotFound(_0x489654,null))[_0x5a16('0x22')](respondWithResult(_0x489654,null))['catch'](handleError(_0x489654,null));};exports[_0x5a16('0x47')]=function(_0x5b65ee,_0x526934){return db['WhatsappTransferReport']['create'](_0x5b65ee[_0x5a16('0x48')],{})[_0x5a16('0x22')](respondWithResult(_0x526934,0xc9))[_0x5a16('0x43')](handleError(_0x526934,null));};exports[_0x5a16('0x21')]=function(_0x7ffe42,_0xf4cf4b){if(_0x7ffe42[_0x5a16('0x48')]['id']){delete _0x7ffe42[_0x5a16('0x48')]['id'];}return db[_0x5a16('0x2a')][_0x5a16('0x46')]({'where':{'id':_0x7ffe42[_0x5a16('0x45')]['id']}})['then'](handleEntityNotFound(_0xf4cf4b,null))[_0x5a16('0x22')](saveUpdates(_0x7ffe42[_0x5a16('0x48')],null))['then'](respondWithResult(_0xf4cf4b,null))[_0x5a16('0x43')](handleError(_0xf4cf4b,null));};exports[_0x5a16('0x49')]=function(_0x4aa4cc,_0x5af288){return db['WhatsappTransferReport'][_0x5a16('0x46')]({'where':{'id':_0x4aa4cc[_0x5a16('0x45')]['id']}})[_0x5a16('0x22')](handleEntityNotFound(_0x5af288,null))['then'](removeEntity(_0x5af288,null))[_0x5a16('0x43')](handleError(_0x5af288,null));};exports[_0x5a16('0x4a')]=function(_0x1eafbb,_0x5381f7){return db[_0x5a16('0x2a')][_0x5a16('0x4a')]()[_0x5a16('0x22')](respondWithResult(_0x5381f7,null))[_0x5a16('0x43')](handleError(_0x5381f7,null));}; \ No newline at end of file +var _0xc38c=['options','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','save','update','then','destroy','stack','name','send','index','map','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','VIRTUAL','filter','merge','where','WhatsappTransferReport','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll'];(function(_0x24fb13,_0x15a28d){var _0x1b383e=function(_0x325e3e){while(--_0x325e3e){_0x24fb13['push'](_0x24fb13['shift']());}};_0x1b383e(++_0x15a28d);}(_0xc38c,0x135));var _0xcc38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc38c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xcc38('0x0'));var emlformat=require(_0xcc38('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcc38('0x2'));var jsonpatch=require(_0xcc38('0x3'));var rp=require(_0xcc38('0x4'));var moment=require(_0xcc38('0x5'));var BPromise=require(_0xcc38('0x6'));var Mustache=require(_0xcc38('0x7'));var util=require(_0xcc38('0x8'));var path=require('path');var sox=require(_0xcc38('0x9'));var csv=require(_0xcc38('0xa'));var ejs=require(_0xcc38('0xb'));var fs=require('fs');var _=require(_0xcc38('0xc'));var squel=require(_0xcc38('0xd'));var crypto=require(_0xcc38('0xe'));var jsforce=require(_0xcc38('0xf'));var deskjs=require(_0xcc38('0x10'));var toCsv=require(_0xcc38('0xa'));var querystring=require(_0xcc38('0x11'));var Papa=require('papaparse');var Redis=require(_0xcc38('0x12'));var authService=require(_0xcc38('0x13'));var qs=require(_0xcc38('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc38('0x15'))(_0xcc38('0x16'));var utils=require(_0xcc38('0x17'));var config=require(_0xcc38('0x18'));var db=require(_0xcc38('0x19'))['db'];function respondWithStatusCode(_0x4dfad0,_0x4c47b2){_0x4c47b2=_0x4c47b2||0xcc;return function(_0x4856c1){if(_0x4856c1){return _0x4dfad0[_0xcc38('0x1a')](_0x4c47b2);}return _0x4dfad0['status'](_0x4c47b2)[_0xcc38('0x1b')]();};}function respondWithResult(_0x35d53b,_0x2e49b0){_0x2e49b0=_0x2e49b0||0xc8;return function(_0xb44f10){if(_0xb44f10){return _0x35d53b['status'](_0x2e49b0)[_0xcc38('0x1c')](_0xb44f10);}};}function respondWithFilteredResult(_0x4a8eee,_0x5702e6){return function(_0x383395){if(_0x383395){var _0x2fb204=_0x383395[_0xcc38('0x1d')],_0x8ab46f=_0x5702e6[_0xcc38('0x1e')],_0x36e6b4=_0x5702e6[_0xcc38('0x1e')]+_0x5702e6[_0xcc38('0x1f')],_0x10608c;if(_0x36e6b4>=_0x2fb204){_0x36e6b4=_0x2fb204;_0x10608c=0xc8;}else{_0x10608c=0xce;}_0x4a8eee[_0xcc38('0x20')](_0x10608c);return _0x4a8eee[_0xcc38('0x21')](_0xcc38('0x22'),_0x8ab46f+'-'+_0x36e6b4+'/'+_0x2fb204)[_0xcc38('0x1c')](_0x383395);}return null;};}function patchUpdates(_0x5b6637){return function(_0x1ad043){try{jsonpatch['apply'](_0x1ad043,_0x5b6637,!![]);}catch(_0x577194){return BPromise['reject'](_0x577194);}return _0x1ad043[_0xcc38('0x23')]();};}function saveUpdates(_0x23afb9,_0x31e7c9){return function(_0x3969b3){if(_0x3969b3){return _0x3969b3[_0xcc38('0x24')](_0x23afb9)[_0xcc38('0x25')](function(_0xcb4289){return _0xcb4289;});}return null;};}function removeEntity(_0x1b0e4c,_0xcd8ef8){return function(_0x45e768){if(_0x45e768){return _0x45e768[_0xcc38('0x26')]()[_0xcc38('0x25')](function(){_0x1b0e4c[_0xcc38('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47fb02,_0xcefa3){return function(_0x254e54){if(!_0x254e54){_0x47fb02['sendStatus'](0x194);}return _0x254e54;};}function handleError(_0x231f72,_0x3c475b){_0x3c475b=_0x3c475b||0x1f4;return function(_0x4ca3c5){logger['error'](_0x4ca3c5[_0xcc38('0x27')]);if(_0x4ca3c5[_0xcc38('0x28')]){delete _0x4ca3c5[_0xcc38('0x28')];}_0x231f72[_0xcc38('0x20')](_0x3c475b)[_0xcc38('0x29')](_0x4ca3c5);};}exports[_0xcc38('0x2a')]=function(_0x148cda,_0x4cdb41){var _0xf97e3e={},_0x5829ca={},_0x5589a8={'count':0x0,'rows':[]};var _0x1e18ef=_[_0xcc38('0x2b')](db['WhatsappTransferReport']['rawAttributes'],function(_0x1b17e2){return{'name':_0x1b17e2['fieldName'],'type':_0x1b17e2[_0xcc38('0x2c')][_0xcc38('0x2d')]};});_0x5829ca[_0xcc38('0x2e')]=_[_0xcc38('0x2b')](_0x1e18ef,_0xcc38('0x28'));_0x5829ca[_0xcc38('0x2f')]=_[_0xcc38('0x30')](_0x148cda[_0xcc38('0x2f')]);_0x5829ca[_0xcc38('0x31')]=_['intersection'](_0x5829ca[_0xcc38('0x2e')],_0x5829ca['query']);_0xf97e3e[_0xcc38('0x32')]=_['intersection'](_0x5829ca[_0xcc38('0x2e')],qs[_0xcc38('0x33')](_0x148cda[_0xcc38('0x2f')][_0xcc38('0x33')]));_0xf97e3e[_0xcc38('0x32')]=_0xf97e3e[_0xcc38('0x32')][_0xcc38('0x34')]?_0xf97e3e[_0xcc38('0x32')]:_0x5829ca[_0xcc38('0x2e')];if(!_0x148cda[_0xcc38('0x2f')]['hasOwnProperty'](_0xcc38('0x35'))){_0xf97e3e[_0xcc38('0x1f')]=qs[_0xcc38('0x1f')](_0x148cda['query']['limit']);_0xf97e3e[_0xcc38('0x1e')]=qs[_0xcc38('0x1e')](_0x148cda[_0xcc38('0x2f')]['offset']);}_0xf97e3e[_0xcc38('0x36')]=qs[_0xcc38('0x37')](_0x148cda[_0xcc38('0x2f')][_0xcc38('0x37')]);_0xf97e3e['where']=qs[_0xcc38('0x31')](_[_0xcc38('0x38')](_0x148cda['query'],_0x5829ca[_0xcc38('0x31')]),_0x1e18ef);if(_0x148cda[_0xcc38('0x2f')]['filter']){_0xf97e3e['where']=_['merge'](_0xf97e3e['where'],{'$or':_[_0xcc38('0x2b')](_0x1e18ef,function(_0x1e36ba){if(_0x1e36ba[_0xcc38('0x2c')]!==_0xcc38('0x39')){var _0x35570e={};_0x35570e[_0x1e36ba['name']]={'$like':'%'+_0x148cda['query'][_0xcc38('0x3a')]+'%'};return _0x35570e;}})});}_0xf97e3e=_[_0xcc38('0x3b')]({},_0xf97e3e,_0x148cda['options']);var _0xa4d802={'where':_0xf97e3e[_0xcc38('0x3c')]};return db[_0xcc38('0x3d')][_0xcc38('0x1d')](_0xa4d802)[_0xcc38('0x25')](function(_0x5ce0d1){_0x5589a8[_0xcc38('0x1d')]=_0x5ce0d1;if(_0x148cda[_0xcc38('0x2f')]['includeAll']){_0xf97e3e[_0xcc38('0x3e')]=[{'all':!![]}];}return db[_0xcc38('0x3d')][_0xcc38('0x3f')](_0xf97e3e);})[_0xcc38('0x25')](function(_0x4d3811){_0x5589a8[_0xcc38('0x40')]=_0x4d3811;return _0x5589a8;})[_0xcc38('0x25')](respondWithFilteredResult(_0x4cdb41,_0xf97e3e))[_0xcc38('0x41')](handleError(_0x4cdb41,null));};exports[_0xcc38('0x42')]=function(_0x4d8ff1,_0x116b69){var _0x3d41c1={'raw':!![],'where':{'id':_0x4d8ff1[_0xcc38('0x43')]['id']}},_0x4589f5={};_0x4589f5['model']=_[_0xcc38('0x30')](db[_0xcc38('0x3d')][_0xcc38('0x44')]);_0x4589f5[_0xcc38('0x2f')]=_[_0xcc38('0x30')](_0x4d8ff1[_0xcc38('0x2f')]);_0x4589f5['filters']=_[_0xcc38('0x45')](_0x4589f5[_0xcc38('0x2e')],_0x4589f5['query']);_0x3d41c1[_0xcc38('0x32')]=_[_0xcc38('0x45')](_0x4589f5[_0xcc38('0x2e')],qs['fields'](_0x4d8ff1['query'][_0xcc38('0x33')]));_0x3d41c1[_0xcc38('0x32')]=_0x3d41c1[_0xcc38('0x32')][_0xcc38('0x34')]?_0x3d41c1[_0xcc38('0x32')]:_0x4589f5[_0xcc38('0x2e')];if(_0x4d8ff1[_0xcc38('0x2f')][_0xcc38('0x46')]){_0x3d41c1[_0xcc38('0x3e')]=[{'all':!![]}];}_0x3d41c1=_['merge']({},_0x3d41c1,_0x4d8ff1[_0xcc38('0x47')]);return db[_0xcc38('0x3d')][_0xcc38('0x48')](_0x3d41c1)[_0xcc38('0x25')](handleEntityNotFound(_0x116b69,null))[_0xcc38('0x25')](respondWithResult(_0x116b69,null))['catch'](handleError(_0x116b69,null));};exports[_0xcc38('0x49')]=function(_0x4e9451,_0x2761bf){return db[_0xcc38('0x3d')]['create'](_0x4e9451['body'],{})[_0xcc38('0x25')](respondWithResult(_0x2761bf,0xc9))[_0xcc38('0x41')](handleError(_0x2761bf,null));};exports['update']=function(_0xe9d03f,_0x424047){if(_0xe9d03f[_0xcc38('0x4a')]['id']){delete _0xe9d03f[_0xcc38('0x4a')]['id'];}return db[_0xcc38('0x3d')][_0xcc38('0x48')]({'where':{'id':_0xe9d03f[_0xcc38('0x43')]['id']}})[_0xcc38('0x25')](handleEntityNotFound(_0x424047,null))['then'](saveUpdates(_0xe9d03f[_0xcc38('0x4a')],null))[_0xcc38('0x25')](respondWithResult(_0x424047,null))['catch'](handleError(_0x424047,null));};exports[_0xcc38('0x26')]=function(_0x5e3cfc,_0x5b597a){return db[_0xcc38('0x3d')]['find']({'where':{'id':_0x5e3cfc['params']['id']}})['then'](handleEntityNotFound(_0x5b597a,null))['then'](removeEntity(_0x5b597a,null))[_0xcc38('0x41')](handleError(_0x5b597a,null));};exports['describe']=function(_0x54c9c7,_0x20f9c7){return db['WhatsappTransferReport'][_0xcc38('0x4b')]()[_0xcc38('0x25')](respondWithResult(_0x20f9c7,null))[_0xcc38('0x41')](handleError(_0x20f9c7,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 2ea9cfd..057a48f 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 _0x7f15=['request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','moment','bluebird'];(function(_0x4fcbec,_0x90e467){var _0x275177=function(_0x1f706b){while(--_0x1f706b){_0x4fcbec['push'](_0x4fcbec['shift']());}};_0x275177(++_0x90e467);}(_0x7f15,0x80));var _0x57f1=function(_0x57394b,_0x26bfc0){_0x57394b=_0x57394b-0x0;var _0x79f5c3=_0x7f15[_0x57394b];return _0x79f5c3;};'use strict';var _=require(_0x57f1('0x0'));var util=require('util');var logger=require(_0x57f1('0x1'))('api');var moment=require(_0x57f1('0x2'));var BPromise=require(_0x57f1('0x3'));var rp=require(_0x57f1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57f1('0x5'));var config=require(_0x57f1('0x6'));var attributes=require(_0x57f1('0x7'));module['exports']=function(_0x5e672e,_0x1522db){return _0x5e672e['define'](_0x57f1('0x8'),attributes,{'tableName':_0x57f1('0x9'),'paranoid':![],'indexes':[{'name':_0x57f1('0xa'),'fields':[_0x57f1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb71=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x456b57,_0x58691a){var _0x18f49f=function(_0x1dc195){while(--_0x1dc195){_0x456b57['push'](_0x456b57['shift']());}};_0x18f49f(++_0x58691a);}(_0xfb71,0x1c7));var _0x1fb7=function(_0x99f43e,_0x41f7cf){_0x99f43e=_0x99f43e-0x0;var _0x3e22d1=_0xfb71[_0x99f43e];return _0x3e22d1;};'use strict';var _=require(_0x1fb7('0x0'));var util=require(_0x1fb7('0x1'));var logger=require('../../config/logger')(_0x1fb7('0x2'));var moment=require(_0x1fb7('0x3'));var BPromise=require('bluebird');var rp=require(_0x1fb7('0x4'));var fs=require('fs');var path=require(_0x1fb7('0x5'));var rimraf=require(_0x1fb7('0x6'));var config=require(_0x1fb7('0x7'));var attributes=require(_0x1fb7('0x8'));module['exports']=function(_0x740c68,_0x4ed2ac){return _0x740c68[_0x1fb7('0x9')](_0x1fb7('0xa'),attributes,{'tableName':_0x1fb7('0xb'),'paranoid':![],'indexes':[{'name':_0x1fb7('0xc'),'fields':[_0x1fb7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index f9e50f0..2a09b6e 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(_0x127ce1,_0x4cc67c){var _0x254e44=function(_0x402276){while(--_0x402276){_0x127ce1['push'](_0x127ce1['shift']());}};_0x254e44(++_0x4cc67c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x3fb510,_0xeda556){var _0x49d476=function(_0x227e2b){while(--_0x227e2b){_0x3fb510['push'](_0x3fb510['shift']());}};_0x49d476(++_0xeda556);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 b1d10a1..fe018e6 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc698=['join','status','None','seedDB','./config/seedDB','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./rpc','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/transcribe','sync','then','listen','info','start','Online\x20apps:','map','filter','online','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc698,0x15b));var _0x8c69=function(_0x4d2993,_0x1c9473){_0x4d2993=_0x4d2993-0x0;var _0x427374=_0xc698[_0x4d2993];return _0x427374;};'use strict';var _=require(_0x8c69('0x0'));var mysqldb=require(_0x8c69('0x1'));var rpc=require(_0x8c69('0x2'));var config=require('./config/environment');var logger=require('./config/logger')('app');var pm2=require(_0x8c69('0x3'));var pm2Config=require(_0x8c69('0x4'));var schedule=require(_0x8c69('0x5'));var chat=require('./config/schedule/chat');var transcribe=require(_0x8c69('0x6'));function main(){return mysqldb['db']['sequelize'][_0x8c69('0x7')]()[_0x8c69('0x8')](function(){return rpc[_0x8c69('0x9')]();})['then'](function(_0x59cbde){logger[_0x8c69('0xa')](_0x59cbde);return chat[_0x8c69('0xb')]();})[_0x8c69('0x8')](function(){return schedule[_0x8c69('0xb')]();})[_0x8c69('0x8')](function(){return transcribe['start']();})['then'](function(_0xa6261c){logger[_0x8c69('0xa')](_0xa6261c);return pm2[_0x8c69('0xb')](pm2Config);})[_0x8c69('0x8')](function(_0x5a0d18){logger[_0x8c69('0xa')](_0x8c69('0xc'),_[_0x8c69('0xd')](_[_0x8c69('0xe')](_0x5a0d18,{'status':_0x8c69('0xf')}),_0x8c69('0x10'))[_0x8c69('0x11')]());logger[_0x8c69('0xa')]('Offline\x20apps:',_[_0x8c69('0xd')](_[_0x8c69('0xe')](_0x5a0d18,function(_0x5d562f){return _0x5d562f[_0x8c69('0x12')]!==_0x8c69('0xf');}),_0x8c69('0x10'))[_0x8c69('0x11')]()||_0x8c69('0x13'));config[_0x8c69('0x14')]&&require(_0x8c69('0x15'))[_0x8c69('0x16')]();require('./config/license')[_0x8c69('0x16')]();})[_0x8c69('0x17')](function(_0x48d7e7){logger[_0x8c69('0x18')](_0x8c69('0x19'),_0x48d7e7);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xb9e8=['name','Offline\x20apps:','filter','join','None','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','app','./config/pm2/config','./config/schedule/transcribe','sync','then','info','start','Online\x20apps:','map','online'];(function(_0x5b38ae,_0x26d993){var _0x58f579=function(_0x331746){while(--_0x331746){_0x5b38ae['push'](_0x5b38ae['shift']());}};_0x58f579(++_0x26d993);}(_0xb9e8,0x1e0));var _0x8b9e=function(_0x47e3ef,_0x551b2c){_0x47e3ef=_0x47e3ef-0x0;var _0x502417=_0xb9e8[_0x47e3ef];return _0x502417;};'use strict';var _=require(_0x8b9e('0x0'));var mysqldb=require(_0x8b9e('0x1'));var rpc=require(_0x8b9e('0x2'));var config=require(_0x8b9e('0x3'));var logger=require('./config/logger')(_0x8b9e('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x8b9e('0x5'));var schedule=require('./config/schedule');var chat=require('./config/schedule/chat');var transcribe=require(_0x8b9e('0x6'));function main(){return mysqldb['db']['sequelize'][_0x8b9e('0x7')]()['then'](function(){return rpc['listen']();})[_0x8b9e('0x8')](function(_0x14161d){logger[_0x8b9e('0x9')](_0x14161d);return chat[_0x8b9e('0xa')]();})[_0x8b9e('0x8')](function(){return schedule[_0x8b9e('0xa')]();})[_0x8b9e('0x8')](function(){return transcribe[_0x8b9e('0xa')]();})[_0x8b9e('0x8')](function(_0x4c35d6){logger[_0x8b9e('0x9')](_0x4c35d6);return pm2[_0x8b9e('0xa')](pm2Config);})[_0x8b9e('0x8')](function(_0x4fc3c0){logger[_0x8b9e('0x9')](_0x8b9e('0xb'),_[_0x8b9e('0xc')](_['filter'](_0x4fc3c0,{'status':_0x8b9e('0xd')}),_0x8b9e('0xe'))['join']());logger[_0x8b9e('0x9')](_0x8b9e('0xf'),_['map'](_[_0x8b9e('0x10')](_0x4fc3c0,function(_0x4be048){return _0x4be048['status']!==_0x8b9e('0xd');}),_0x8b9e('0xe'))[_0x8b9e('0x11')]()||_0x8b9e('0x12'));config['seedDB']&&require(_0x8b9e('0x13'))[_0x8b9e('0x14')]();require(_0x8b9e('0x15'))[_0x8b9e('0x14')]();})[_0x8b9e('0x16')](function(_0x3e082d){logger[_0x8b9e('0x17')](_0x8b9e('0x18'),_0x3e082d);process[_0x8b9e('0x19')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 6161a0f..2f27606 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 _0x3f55=['Basic','User','find','authenticate','pass','status','json','Wrong\x20credentials.','startsWith','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','payload','options','verify','toString','hex','floor','now','HS512','../../config/environment','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','fullname','name','internal','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','pauseType','lastLoginAt','allowmessenger','passwordResetAt','alias','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControlPort','hotdesk','userProfileId','use','user','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization'];(function(_0x505e10,_0x5a167c){var _0x268002=function(_0x35247b){while(--_0x35247b){_0x505e10['push'](_0x505e10['shift']());}};_0x268002(++_0x5a167c);}(_0x3f55,0x140));var _0x53f5=function(_0x4a9cc,_0x1e37a4){_0x4a9cc=_0x4a9cc-0x0;var _0x1bf672=_0x3f55[_0x4a9cc];return _0x1bf672;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x53f5('0x0'));var hardwareConf=require('../../config/license/hardware');var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x53f5('0x1'));var compose=require(_0x53f5('0x2'));var basicAuth=require(_0x53f5('0x3'));var crypto=require(_0x53f5('0x4'));var BPromise=require(_0x53f5('0x5'));var validateJwt=expressJwt({'secret':config[_0x53f5('0x6')][_0x53f5('0x7')]});var userAttributes=['id',_0x53f5('0x8'),_0x53f5('0x9'),_0x53f5('0xa'),_0x53f5('0xb'),'email','userpic','permissions',_0x53f5('0xc'),_0x53f5('0xd'),_0x53f5('0xe'),_0x53f5('0xf'),_0x53f5('0x10'),_0x53f5('0x11'),'openchannelPause',_0x53f5('0x12'),'showWebBar',_0x53f5('0x13'),'lastPauseAt','crudPermissions',_0x53f5('0x14'),_0x53f5('0x15'),_0x53f5('0x16'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0x53f5('0x17'),_0x53f5('0x18'),_0x53f5('0x19'),'phoneBarEnableSettings',_0x53f5('0x1a'),'phoneBarPrefixRequired','phoneBarRemoteControl',_0x53f5('0x1b'),_0x53f5('0x1c'),'interface',_0x53f5('0x1d')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x53f5('0x1e')](function(_0x2704f7,_0x5c184c,_0x172103){if(_0x2704f7[_0x53f5('0x1f')]){_0x172103();}else{return db[_0x53f5('0x20')][_0x53f5('0x21')]({'where':{'id':_0x2704f7[_0x53f5('0x22')]['id']},'attributes':['id',_0x53f5('0x23'),_0x53f5('0x24')],'raw':!![]})[_0x53f5('0x25')](function(_0x517c74){if(_0x517c74&&_0x517c74[_0x53f5('0x23')]){return _0x5c184c['status'](_0x517c74['disposition']===_0x53f5('0x26')?0x195:0x193)['json']({'message':_0x517c74[_0x53f5('0x24')]===_0x53f5('0x26')?_0x53f5('0x27'):_0x53f5('0x28')});}else{_0x172103();}})[_0x53f5('0x29')](function(_0x402d02){_0x172103(_0x402d02);});}});};exports['isAuthenticated']=function isAuthenticated(_0xc5554c){return compose()[_0x53f5('0x1e')](function(_0x3275d4,_0x463e4e,_0x46a424){if(_0x3275d4[_0x53f5('0x2a')][_0x53f5('0x2b')]){if(_['startsWith'](_0x3275d4[_0x53f5('0x2a')]['authorization'],_0x53f5('0x2c'))){var _0x4070b0=basicAuth(_0x3275d4);db[_0x53f5('0x2d')][_0x53f5('0x2e')]({'where':{'name':_0x4070b0[_0x53f5('0xa')]}})[_0x53f5('0x25')](function(_0x23bc62){if(!_0x23bc62||!_0x23bc62[_0x53f5('0x2f')](_0x4070b0[_0x53f5('0x30')])){return _0x463e4e[_0x53f5('0x31')](0x191)[_0x53f5('0x32')]({'message':_0x53f5('0x33')});}_0x3275d4['user']={'id':_0x23bc62['id']};_0x46a424();})[_0x53f5('0x29')](function(_0x26a460){_0x46a424(_0x26a460);});}else if(_[_0x53f5('0x34')](_0x3275d4[_0x53f5('0x2a')]['authorization'],'Bearer')){validateJwt(_0x3275d4,_0x463e4e,_0x46a424);}else{if(_0xc5554c){_0x46a424();}else{return _0x463e4e[_0x53f5('0x31')](0x193)[_0x53f5('0x32')]({'message':_0x53f5('0x35')});}}}else if(_0x3275d4[_0x53f5('0x36')][_0x53f5('0x37')]){try{var _0x4c7524={'audience':hardwareConf[_0x53f5('0x38')](),'issuer':hardwareConf[_0x53f5('0x38')]()};verifyJwt(_0x3275d4[_0x53f5('0x36')]['apikey'],_0x4c7524)['then'](function(_0x54c2c8){return db[_0x53f5('0x2d')][_0x53f5('0x2e')]({'where':{'id':_0x54c2c8[_0x53f5('0x39')]}})[_0x53f5('0x25')](function(_0x240ec3){if(!_0x240ec3||!_[_0x53f5('0x3a')](_0x240ec3[_0x53f5('0x3b')],_0x54c2c8[_0x53f5('0x3c')])){return _0x463e4e[_0x53f5('0x31')](0x191)['json']({'message':_0x53f5('0x3d')});}_0x3275d4[_0x53f5('0x1f')]={'id':_0x240ec3['id']};_0x46a424();});})[_0x53f5('0x29')](function(){return _0x463e4e[_0x53f5('0x31')](0x191)[_0x53f5('0x32')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0xdd69d6){_0x46a424(_0xdd69d6);}}else if(_0xc5554c){_0x46a424();}else{return _0x463e4e['status'](0x193)[_0x53f5('0x32')]({'message':_0x53f5('0x35')});}})[_0x53f5('0x1e')](function(_0x14b32d,_0x10f166,_0x43967f){if(_0x14b32d[_0x53f5('0x1f')]){db[_0x53f5('0x2d')][_0x53f5('0x2e')]({'where':{'id':_0x14b32d[_0x53f5('0x1f')]['id']},'attributes':userAttributes})['then'](function(_0x15bece){if(!_0x15bece){return _0x10f166[_0x53f5('0x31')](0x194)[_0x53f5('0x32')]({'message':_0x53f5('0x3e')});}_0x14b32d[_0x53f5('0x1f')]=_0x15bece;_0x43967f();})['catch'](function(_0x336d69){_0x43967f(_0x336d69);});}else if(_0xc5554c){_0x43967f();}else{return _0x10f166[_0x53f5('0x31')](0x194)[_0x53f5('0x32')]({'message':_0x53f5('0x3f')});}});};exports[_0x53f5('0x40')]=function canUpdate(){return compose()['use'](function(_0x644ac0,_0x1376d5,_0x323bed){return require(_0x53f5('0x41'))[_0x53f5('0x42')]()[_0x53f5('0x25')](function(_0x3e833f){if(_0x3e833f[_0x53f5('0x43')]){_0x323bed();}else{return _0x1376d5[_0x53f5('0x31')](0x193)[_0x53f5('0x32')]({'message':'Forbidden'});}})[_0x53f5('0x29')](function(_0x14f9e3){_0x323bed(_0x14f9e3);});});};exports[_0x53f5('0x44')]=function(_0x56cdaf,_0x7beba2,_0x3babe4){_0x56cdaf[_0x53f5('0x44')]=!![];return _0x3babe4();};exports['signToken']=function signToken(_0x24f147){return signJwt(_0x24f147);};exports[_0x53f5('0x45')]=function(_0x4df5ab,_0x53dc6f){if(!_0x4df5ab['user']){return _0x53dc6f[_0x53f5('0x31')](0x194)[_0x53f5('0x32')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x2f0b32={'payload':{'id':_0x4df5ab[_0x53f5('0x1f')]['id'],'role':_0x4df5ab[_0x53f5('0x1f')][_0x53f5('0x8')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2f0b32)['then'](function(_0x521150){_0x53dc6f[_0x53f5('0x46')](_0x53f5('0x47'),_0x521150);_0x53dc6f[_0x53f5('0x48')](_0x53f5('0x49'));})[_0x53f5('0x29')](function(_0x516113){return _0x53dc6f[_0x53f5('0x31')](0x1f4)[_0x53f5('0x4a')](_0x516113);});};exports[_0x53f5('0x4b')]=function(_0x19eb77){if(_[_0x53f5('0x4c')](_0x19eb77[_0x53f5('0x3b')])||_[_0x53f5('0x4c')](_0x19eb77[_0x53f5('0x4d')])){return null;}else{return createJwt(_0x19eb77);}};exports[_0x53f5('0x4e')]=function(_0x9e0b69){_0x9e0b69['apiKeyNonce']=generateNonce();_0x9e0b69['apiKeyIat']=generateIssuedAt();return createJwt(_0x9e0b69);};exports[_0x53f5('0x4f')]=function(_0x3a256b,_0x39fc70){var _0x17d32e=_0x3a256b[_0x53f5('0x36')]['apikey'];if(_0x17d32e){var _0x5db1f5={'nonce':_0x39fc70[_0x53f5('0x3b')],'iat':_0x39fc70[_0x53f5('0x4d')],'audience':hardwareConf[_0x53f5('0x38')](),'issuer':hardwareConf[_0x53f5('0x38')]()};return verifyJwt(_0x17d32e,_0x5db1f5)[_0x53f5('0x25')](function(){return generateApiKey(_0x39fc70);});}else{throw{'message':_0x53f5('0x50')};}};function signJwt(_0x3897a3){var _0xe1f264=BPromise[_0x53f5('0x51')](jwt[_0x53f5('0x52')],{'context':jwt});var _0x32b34d=_0x3897a3['secret']||config[_0x53f5('0x6')][_0x53f5('0x7')];return new BPromise(function(_0x24a91f,_0x126e4f){_0xe1f264(_0x3897a3[_0x53f5('0x53')],_0x32b34d,_0x3897a3[_0x53f5('0x54')])['then'](function(_0xb4d322){_0x24a91f(_0xb4d322);})[_0x53f5('0x29')](function(_0x424865){_0x126e4f(_0x424865);});});}function verifyJwt(_0x163cd5,_0x144876,_0x5de171){var _0x160740=BPromise[_0x53f5('0x51')](jwt[_0x53f5('0x55')],{'context':jwt});var _0x103402=_0x5de171||config['secrets'][_0x53f5('0x7')];return new BPromise(function(_0x519e3f,_0x38553d){_0x160740(_0x163cd5,_0x103402,_0x144876)['then'](function(_0x2269c9){_0x519e3f(_0x2269c9);})[_0x53f5('0x29')](function(_0x5496d5){_0x38553d(_0x5496d5);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x53f5('0x56')](_0x53f5('0x57'));}function generateIssuedAt(){return Math[_0x53f5('0x58')](Date[_0x53f5('0x59')]()/0x3e8)[_0x53f5('0x56')]();}function createJwt(_0x414fbc){var _0x35088b={'payload':{'iat':_0x414fbc[_0x53f5('0x4d')],'nonce':_0x414fbc['apiKeyNonce']},'options':{'algorithm':_0x53f5('0x5a'),'subject':_0x414fbc['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x53f5('0x38')]()}};return signJwt(_0x35088b)['then'](function(_0x543c03){return{'iat':_0x414fbc[_0x53f5('0x4d')],'nonce':_0x414fbc[_0x53f5('0x3b')],'token':_0x543c03};});} \ No newline at end of file +var _0x7952=['options','verify','session','randomBytes','toString','hex','floor','now','apiKeyIat','HS512','../../mysqldb','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','secrets','role','name','internal','email','userpic','md5secret','voicePause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','userProfileId','isChatInteractionAuthorized','isAuthenticated','user','findOne','params','disposition','then','closed','status','unmanaged','json','Forbidden.','catch','use','headers','authorization','startsWith','Basic','User','Wrong\x20credentials.','Bearer','getUuid','query','apikey','find','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyNonce','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','payload'];(function(_0x2efccf,_0x6d7311){var _0x433d78=function(_0xc68641){while(--_0xc68641){_0x2efccf['push'](_0x2efccf['shift']());}};_0x433d78(++_0x6d7311);}(_0x7952,0xcc));var _0x2795=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7952[_0x57b54c];return _0x59cc19;};'use strict';var db=require(_0x2795('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x2795('0x1'));var _=require(_0x2795('0x2'));var jwt=require(_0x2795('0x3'));var expressJwt=require(_0x2795('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0x2795('0x5'));var crypto=require(_0x2795('0x6'));var BPromise=require(_0x2795('0x7'));var validateJwt=expressJwt({'secret':config[_0x2795('0x8')]['session']});var userAttributes=['id',_0x2795('0x9'),'fullname',_0x2795('0xa'),_0x2795('0xb'),_0x2795('0xc'),_0x2795('0xd'),'permissions',_0x2795('0xe'),_0x2795('0xf'),'chatPause','mailPause','faxPause',_0x2795('0x10'),_0x2795('0x11'),_0x2795('0x12'),_0x2795('0x13'),_0x2795('0x14'),_0x2795('0x15'),_0x2795('0x16'),'allowmessenger',_0x2795('0x17'),_0x2795('0x18'),_0x2795('0x19'),_0x2795('0x1a'),_0x2795('0x1b'),_0x2795('0x1c'),_0x2795('0x1d'),_0x2795('0x1e'),_0x2795('0x1f'),_0x2795('0x20'),'phoneBarRemoteControl',_0x2795('0x21'),_0x2795('0x22'),'interface',_0x2795('0x23')];exports[_0x2795('0x24')]=function(){return this[_0x2795('0x25')](!![])['use'](function(_0x190878,_0x1ce63f,_0x3e1fb5){if(_0x190878[_0x2795('0x26')]){_0x3e1fb5();}else{return db['ChatInteraction'][_0x2795('0x27')]({'where':{'id':_0x190878[_0x2795('0x28')]['id']},'attributes':['id','closed',_0x2795('0x29')],'raw':!![]})[_0x2795('0x2a')](function(_0x268420){if(_0x268420&&_0x268420[_0x2795('0x2b')]){return _0x1ce63f[_0x2795('0x2c')](_0x268420['disposition']===_0x2795('0x2d')?0x195:0x193)[_0x2795('0x2e')]({'message':_0x268420['disposition']==='unmanaged'?'Unmanaged.':_0x2795('0x2f')});}else{_0x3e1fb5();}})[_0x2795('0x30')](function(_0x1650e8){_0x3e1fb5(_0x1650e8);});}});};exports[_0x2795('0x25')]=function isAuthenticated(_0x1dac8a){return compose()[_0x2795('0x31')](function(_0x5bcafe,_0x327f11,_0x1b4378){if(_0x5bcafe[_0x2795('0x32')][_0x2795('0x33')]){if(_[_0x2795('0x34')](_0x5bcafe[_0x2795('0x32')]['authorization'],_0x2795('0x35'))){var _0x353432=basicAuth(_0x5bcafe);db[_0x2795('0x36')]['find']({'where':{'name':_0x353432[_0x2795('0xa')]}})['then'](function(_0xff6280){if(!_0xff6280||!_0xff6280['authenticate'](_0x353432['pass'])){return _0x327f11['status'](0x191)[_0x2795('0x2e')]({'message':_0x2795('0x37')});}_0x5bcafe['user']={'id':_0xff6280['id']};_0x1b4378();})['catch'](function(_0x2cd173){_0x1b4378(_0x2cd173);});}else if(_[_0x2795('0x34')](_0x5bcafe[_0x2795('0x32')][_0x2795('0x33')],_0x2795('0x38'))){validateJwt(_0x5bcafe,_0x327f11,_0x1b4378);}else{if(_0x1dac8a){_0x1b4378();}else{return _0x327f11[_0x2795('0x2c')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5bcafe['query']['apikey']){try{var _0x34f0a3={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x2795('0x39')]()};verifyJwt(_0x5bcafe[_0x2795('0x3a')][_0x2795('0x3b')],_0x34f0a3)[_0x2795('0x2a')](function(_0x186d14){return db[_0x2795('0x36')][_0x2795('0x3c')]({'where':{'id':_0x186d14['sub']}})[_0x2795('0x2a')](function(_0x57deaf){if(!_0x57deaf||!_['isEqual'](_0x57deaf['apiKeyNonce'],_0x186d14[_0x2795('0x3d')])){return _0x327f11[_0x2795('0x2c')](0x191)[_0x2795('0x2e')]({'message':_0x2795('0x3e')});}_0x5bcafe[_0x2795('0x26')]={'id':_0x57deaf['id']};_0x1b4378();});})['catch'](function(){return _0x327f11[_0x2795('0x2c')](0x191)[_0x2795('0x2e')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x56809d){_0x1b4378(_0x56809d);}}else if(_0x1dac8a){_0x1b4378();}else{return _0x327f11['status'](0x193)['json']({'message':_0x2795('0x3f')});}})['use'](function(_0x1cb825,_0x17a6a3,_0x43f9d4){if(_0x1cb825[_0x2795('0x26')]){db[_0x2795('0x36')]['find']({'where':{'id':_0x1cb825['user']['id']},'attributes':userAttributes})[_0x2795('0x2a')](function(_0x6b1c44){if(!_0x6b1c44){return _0x17a6a3[_0x2795('0x2c')](0x194)['json']({'message':_0x2795('0x40')});}_0x1cb825['user']=_0x6b1c44;_0x43f9d4();})['catch'](function(_0xb3eb5d){_0x43f9d4(_0xb3eb5d);});}else if(_0x1dac8a){_0x43f9d4();}else{return _0x17a6a3[_0x2795('0x2c')](0x194)[_0x2795('0x2e')]({'message':_0x2795('0x41')});}});};exports[_0x2795('0x42')]=function canUpdate(){return compose()[_0x2795('0x31')](function(_0x34c25b,_0x154889,_0x80b4a1){return require(_0x2795('0x43'))[_0x2795('0x44')]()[_0x2795('0x2a')](function(_0x5e1345){if(_0x5e1345[_0x2795('0x45')]){_0x80b4a1();}else{return _0x154889[_0x2795('0x2c')](0x193)[_0x2795('0x2e')]({'message':_0x2795('0x46')});}})[_0x2795('0x30')](function(_0x440eb9){_0x80b4a1(_0x440eb9);});});};exports[_0x2795('0x47')]=function(_0x5b2bc4,_0x540dbc,_0x4eafab){_0x5b2bc4['isMiddleware']=!![];return _0x4eafab();};exports[_0x2795('0x48')]=function signToken(_0x4ccb64){return signJwt(_0x4ccb64);};exports[_0x2795('0x49')]=function(_0x574505,_0x4bf3d2){if(!_0x574505[_0x2795('0x26')]){return _0x4bf3d2[_0x2795('0x2c')](0x194)['json']({'message':_0x2795('0x4a')});}var _0x4068e0={'payload':{'id':_0x574505['user']['id'],'role':_0x574505[_0x2795('0x26')][_0x2795('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4068e0)['then'](function(_0x4ff332){_0x4bf3d2[_0x2795('0x4b')](_0x2795('0x4c'),_0x4ff332);_0x4bf3d2['redirect']('/dashboards/general');})[_0x2795('0x30')](function(_0x22b22f){return _0x4bf3d2[_0x2795('0x2c')](0x1f4)[_0x2795('0x4d')](_0x22b22f);});};exports[_0x2795('0x4e')]=function(_0x3ffa4a){if(_[_0x2795('0x4f')](_0x3ffa4a[_0x2795('0x50')])||_[_0x2795('0x4f')](_0x3ffa4a['apiKeyIat'])){return null;}else{return createJwt(_0x3ffa4a);}};exports[_0x2795('0x51')]=function(_0x130732){_0x130732[_0x2795('0x50')]=generateNonce();_0x130732['apiKeyIat']=generateIssuedAt();return createJwt(_0x130732);};exports['regenerateApiKey']=function(_0x33cae6,_0x22742b){var _0x27750c=_0x33cae6['query'][_0x2795('0x3b')];if(_0x27750c){var _0x5f24ba={'nonce':_0x22742b['apiKeyNonce'],'iat':_0x22742b['apiKeyIat'],'audience':hardwareConf[_0x2795('0x39')](),'issuer':hardwareConf[_0x2795('0x39')]()};return verifyJwt(_0x27750c,_0x5f24ba)[_0x2795('0x2a')](function(){return generateApiKey(_0x22742b);});}else{throw{'message':_0x2795('0x52')};}};function signJwt(_0xddd0cf){var _0x26740d=BPromise[_0x2795('0x53')](jwt[_0x2795('0x54')],{'context':jwt});var _0x4ef482=_0xddd0cf[_0x2795('0x55')]||config[_0x2795('0x8')]['session'];return new BPromise(function(_0x5b7d18,_0x11cc2e){_0x26740d(_0xddd0cf[_0x2795('0x56')],_0x4ef482,_0xddd0cf[_0x2795('0x57')])[_0x2795('0x2a')](function(_0x1951f5){_0x5b7d18(_0x1951f5);})[_0x2795('0x30')](function(_0x2eca4b){_0x11cc2e(_0x2eca4b);});});}function verifyJwt(_0x6ad46f,_0x42a973,_0x5310c8){var _0x213ad3=BPromise[_0x2795('0x53')](jwt[_0x2795('0x58')],{'context':jwt});var _0x1cde4a=_0x5310c8||config[_0x2795('0x8')][_0x2795('0x59')];return new BPromise(function(_0x5beebe,_0x57f740){_0x213ad3(_0x6ad46f,_0x1cde4a,_0x42a973)[_0x2795('0x2a')](function(_0x4f943f){_0x5beebe(_0x4f943f);})[_0x2795('0x30')](function(_0x1526ca){_0x57f740(_0x1526ca);});});}function generateNonce(){return crypto[_0x2795('0x5a')](0x10)[_0x2795('0x5b')](_0x2795('0x5c'));}function generateIssuedAt(){return Math[_0x2795('0x5d')](Date[_0x2795('0x5e')]()/0x3e8)[_0x2795('0x5b')]();}function createJwt(_0x261bb2){var _0x41d2e4={'payload':{'iat':_0x261bb2[_0x2795('0x5f')],'nonce':_0x261bb2[_0x2795('0x50')]},'options':{'algorithm':_0x2795('0x60'),'subject':_0x261bb2['id']['toString'](),'issuer':hardwareConf[_0x2795('0x39')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x41d2e4)[_0x2795('0x2a')](function(_0x280b4e){return{'iat':_0x261bb2[_0x2795('0x5f')],'nonce':_0x261bb2[_0x2795('0x50')],'token':_0x280b4e};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 9e88bf2..826b662 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 _0xb7e7=['crypto','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','update','binary','write','end','final','createDecipher','data','close','unlink'];(function(_0x354cd3,_0x37de36){var _0x420042=function(_0x3f83f8){while(--_0x3f83f8){_0x354cd3['push'](_0x354cd3['shift']());}};_0x420042(++_0x37de36);}(_0xb7e7,0x121));var _0x7b7e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb7e7[_0x31e29a];return _0x32d892;};'use strict';var crypto=require(_0x7b7e('0x0'));var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x7b7e('0x1')};function combineOptions(_0x518dc6){var _0x1b7cc7={};for(var _0x54a37f in defaultOptions){if(defaultOptions[_0x7b7e('0x2')](_0x54a37f)){_0x1b7cc7[_0x54a37f]=defaultOptions[_0x54a37f];}}if(_0x518dc6){for(var _0x556d68 in _0x518dc6){if(_0x518dc6[_0x7b7e('0x2')](_0x556d68)){_0x1b7cc7[_0x556d68]=_0x518dc6[_0x556d68];}}}return _0x1b7cc7;}exports[_0x7b7e('0x3')]=function(_0x1d9384,_0x52047f,_0x53ed64,_0x333fa4){return new BPromise(function(_0x372bde,_0x7f87e0){_0x333fa4=combineOptions(_0x333fa4);var _0x55ce81=new Buffer(_0x53ed64);var _0x42b871=fs[_0x7b7e('0x4')](_0x1d9384);var _0x2917f9=fs[_0x7b7e('0x5')](_0x52047f);var _0x148964=crypto[_0x7b7e('0x6')](_0x333fa4[_0x7b7e('0x7')],_0x55ce81);_0x42b871['on']('data',function(_0x299519){var _0x1eef0a=new Buffer(_0x148964[_0x7b7e('0x8')](_0x299519),_0x7b7e('0x9'));_0x2917f9[_0x7b7e('0xa')](_0x1eef0a);});_0x42b871['on'](_0x7b7e('0xb'),function(){try{var _0x36d2a3=new Buffer(_0x148964[_0x7b7e('0xc')](_0x7b7e('0x9')),'binary');_0x2917f9[_0x7b7e('0xa')](_0x36d2a3);_0x2917f9[_0x7b7e('0xb')]();_0x2917f9['on']('close',function(){return _0x372bde(_0x52047f);});}catch(_0x422d3a){fs['unlink'](_0x52047f);return _0x7f87e0(_0x422d3a);}});});};exports['decryptFile']=function(_0x2889ed,_0xd304f5,_0xf067da,_0x457ec5){return new BPromise(function(_0x3d2fb2,_0x5703fd){_0x457ec5=combineOptions(_0x457ec5);var _0x51baf6=new Buffer(_0xf067da);var _0xc7f087=fs[_0x7b7e('0x4')](_0x2889ed);var _0x27f999=fs[_0x7b7e('0x5')](_0xd304f5);var _0x2cc400=crypto[_0x7b7e('0xd')](_0x457ec5[_0x7b7e('0x7')],_0x51baf6);_0xc7f087['on'](_0x7b7e('0xe'),function(_0x2acb8c){var _0x429a0e=new Buffer(_0x2cc400[_0x7b7e('0x8')](_0x2acb8c),_0x7b7e('0x9'));_0x27f999[_0x7b7e('0xa')](_0x429a0e);});_0xc7f087['on'](_0x7b7e('0xb'),function(){try{var _0x9776c3=new Buffer(_0x2cc400[_0x7b7e('0xc')](_0x7b7e('0x9')),'binary');_0x27f999[_0x7b7e('0xa')](_0x9776c3);_0x27f999[_0x7b7e('0xb')]();_0x27f999['on'](_0x7b7e('0xf'),function(){return _0x3d2fb2(_0xd304f5);});}catch(_0x4c0647){fs[_0x7b7e('0x10')](_0xd304f5);return _0x5703fd(_0x4c0647);}});});}; \ 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(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0xe706,0xa3));var _0x6e70=function(_0x13d9ac,_0x193a78){_0x13d9ac=_0x13d9ac-0x0;var _0x348a17=_0xe706[_0x13d9ac];return _0x348a17;};'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 fa8c3af..16eb8d7 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 _0xb903=['each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','info','inspect','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','then','splitSizeCsv','query','sequelize','QueryTypes','num','Empty','push','format','SELECT','dirname','basename','length','existsSync','join'];(function(_0x1d5eec,_0x3150de){var _0x1fec28=function(_0x4e073b){while(--_0x4e073b){_0x1d5eec['push'](_0x1d5eec['shift']());}};_0x1fec28(++_0x3150de);}(_0xb903,0x185));var _0x3b90=function(_0x174daa,_0x448c43){_0x174daa=_0x174daa-0x0;var _0x341847=_0xb903[_0x174daa];return _0x341847;};'use strict';var util=require(_0x3b90('0x0'));var path=require(_0x3b90('0x1'));var _=require(_0x3b90('0x2'));var csv=require(_0x3b90('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x3b90('0x4'));var rimraf=require(_0x3b90('0x5'));var db=require(_0x3b90('0x6'))['db'];var dbH=require(_0x3b90('0x6'))[_0x3b90('0x7')];var logger=require(_0x3b90('0x8'))(_0x3b90('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3b90('0xa')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x55792c,_0x153283){var _0x2e4c06={'status':_0x55792c};var _0x42efe8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x153283){_0x2e4c06[_0x3b90('0xb')]=_0x153283;}return db['AnalyticExtractedReport']['update'](_0x2e4c06,_0x42efe8);}function main(){var _0x52401e=0x1388;var _0x51f916;logger['info'](util['format'](_0x3b90('0xc'),EXTRACTED_REPORT_ID,_0x3b90('0xd')));return db['Setting'][_0x3b90('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3b90('0xf'),'splitSizeCsv']})[_0x3b90('0x10')](function(_0x174c0d){if(_0x174c0d){_0x51f916=_0x174c0d;_0x52401e=_0x51f916[_0x3b90('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x3b90('0x12')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3b90('0x13')][_0x3b90('0x14')]['SELECT']});})['then'](function(_0x3725b9){if(!_0x3725b9[0x0][_0x3b90('0x15')]){return analyticExtractedReport(_0x3b90('0x16'));}var _0x1af265=[];var _0x1efe01=0x0;var _0x529421=!![];if(_0x3725b9&&_0x3725b9['length']){var _0xd83280=_0x3725b9[0x0][_0x3b90('0x15')]%(_0x1efe01+_0x52401e);if(_0x51f916['split']){for(;_0x529421;_0x1efe01+=_0x52401e,_0xd83280=_0x3725b9[0x0][_0x3b90('0x15')]%(_0x1efe01+_0x52401e)){if(_0xd83280==0x0||_0xd83280==_0x3725b9[0x0][_0x3b90('0x15')]){_0x529421=![];}_0x1af265[_0x3b90('0x17')](dbH[_0x3b90('0x13')]['query'](util[_0x3b90('0x18')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x52401e,_0x1efe01),{'type':dbH[_0x3b90('0x13')][_0x3b90('0x14')]['SELECT']}));}}else{_0x1af265[_0x3b90('0x17')](dbH[_0x3b90('0x13')][_0x3b90('0x12')](QUERY,{'type':dbH[_0x3b90('0x13')][_0x3b90('0x14')][_0x3b90('0x19')]}));}}var _0x3bc7d5=path[_0x3b90('0x1a')](PATH);var _0xa98414=path[_0x3b90('0x1b')](PATH,'.csv');var _0x20b06a=_0x51f916[_0x3b90('0xf')]&&_0x1af265[_0x3b90('0x1c')]>0x1;var _0x7faee=[];if(!fs[_0x3b90('0x1d')](path[_0x3b90('0x1e')](_0x3bc7d5,_0xa98414))&&_0x20b06a){fs['mkdirSync'](path['join'](_0x3bc7d5,_0xa98414));}return BPromise[_0x3b90('0x1f')](_0x1af265,function(_0x29d472){_0x7faee[_0x3b90('0x17')](_0x29d472);})[_0x3b90('0x10')](function(){for(var _0x583523=0x0;_0x583523<_0x7faee[_0x3b90('0x1c')];_0x583523+=0x1){var _0x2936d7;var _0x1787d1=_0x7faee[_0x583523];if(_0x20b06a){_0x2936d7=path['join'](_0x3bc7d5,_0xa98414,util[_0x3b90('0x18')](_0x3b90('0x20'),_0xa98414,_0x583523,_0x3b90('0x21')));}else{_0x2936d7=path[_0x3b90('0x1e')](_0x3bc7d5,util[_0x3b90('0x18')](_0x3b90('0x22'),_0xa98414,'csv'));}fs[_0x3b90('0x23')](_0x2936d7,csv(_0x1787d1));}})['then'](function(){if(_0x20b06a){zipdir(path[_0x3b90('0x1e')](_0x3bc7d5,_0xa98414),{'saveTo':path[_0x3b90('0x1e')](_0x3bc7d5,util[_0x3b90('0x18')](_0x3b90('0x22'),_0xa98414,_0x3b90('0x24')))},function(_0x6704f,_0x290283){});rimraf(path[_0x3b90('0x1e')](_0x3bc7d5,_0xa98414),function(){});}})['then'](function(){logger['info'](util[_0x3b90('0x18')](_0x3b90('0x25'),EXTRACTED_REPORT_ID,_0x3b90('0xd')));return analyticExtractedReport(_0x3b90('0x26'),_0x20b06a?util['format']('%s.%s',_0xa98414,_0x20b06a?_0x3b90('0x24'):_0x3b90('0x21')):null);});})[_0x3b90('0x27')](function(_0x4f3ab5){logger[_0x3b90('0x28')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3b90('0xd')),util[_0x3b90('0x29')](_0x4f3ab5,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xa8a8=['SELECT','Empty','length','num','push','query','dirname','basename','.csv','split','existsSync','mkdirSync','join','each','csv','writeFileSync','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','format','CSV','Setting','find','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x3da2f5,_0x423ce2){var _0x6c3805=function(_0x367a32){while(--_0x367a32){_0x3da2f5['push'](_0x3da2f5['shift']());}};_0x6c3805(++_0x423ce2);}(_0xa8a8,0xec));var _0x8a8a=function(_0x4151be,_0x4b6e59){_0x4151be=_0x4151be-0x0;var _0x48bc47=_0xa8a8[_0x4151be];return _0x48bc47;};'use strict';var util=require(_0x8a8a('0x0'));var path=require(_0x8a8a('0x1'));var _=require(_0x8a8a('0x2'));var csv=require(_0x8a8a('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x8a8a('0x4'));var rimraf=require(_0x8a8a('0x5'));var db=require(_0x8a8a('0x6'))['db'];var dbH=require(_0x8a8a('0x6'))[_0x8a8a('0x7')];var logger=require(_0x8a8a('0x8'))(_0x8a8a('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x8a8a('0xa')][0x2]);var QUERY=process[_0x8a8a('0xa')][0x3];var PATH=process[_0x8a8a('0xa')][0x4];function analyticExtractedReport(_0x1d7121,_0x8e7aa0){var _0x4225b9={'status':_0x1d7121};var _0xecaa6f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8e7aa0){_0x4225b9[_0x8a8a('0xb')]=_0x8e7aa0;}return db['AnalyticExtractedReport']['update'](_0x4225b9,_0xecaa6f);}function main(){var _0x3c01cd=0x1388;var _0x497b8a;logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8a8a('0xe')));return db[_0x8a8a('0xf')][_0x8a8a('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8a8a('0x11')]})[_0x8a8a('0x12')](function(_0x330796){if(_0x330796){_0x497b8a=_0x330796;_0x3c01cd=_0x497b8a[_0x8a8a('0x11')]||0x1388;}})['then'](function(){return dbH[_0x8a8a('0x13')]['query'](util[_0x8a8a('0xd')](_0x8a8a('0x14'),QUERY),{'type':dbH[_0x8a8a('0x13')][_0x8a8a('0x15')][_0x8a8a('0x16')]});})[_0x8a8a('0x12')](function(_0x16d38d){if(!_0x16d38d[0x0]['num']){return analyticExtractedReport(_0x8a8a('0x17'));}var _0x568b83=[];var _0x1f36b6=0x0;var _0x3046ae=!![];if(_0x16d38d&&_0x16d38d[_0x8a8a('0x18')]){var _0x4291e9=_0x16d38d[0x0][_0x8a8a('0x19')]%(_0x1f36b6+_0x3c01cd);if(_0x497b8a['split']){for(;_0x3046ae;_0x1f36b6+=_0x3c01cd,_0x4291e9=_0x16d38d[0x0][_0x8a8a('0x19')]%(_0x1f36b6+_0x3c01cd)){if(_0x4291e9==0x0||_0x4291e9==_0x16d38d[0x0][_0x8a8a('0x19')]){_0x3046ae=![];}_0x568b83[_0x8a8a('0x1a')](dbH[_0x8a8a('0x13')][_0x8a8a('0x1b')](util[_0x8a8a('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3c01cd,_0x1f36b6),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}else{_0x568b83['push'](dbH[_0x8a8a('0x13')][_0x8a8a('0x1b')](QUERY,{'type':dbH[_0x8a8a('0x13')][_0x8a8a('0x15')][_0x8a8a('0x16')]}));}}var _0x2f6af2=path[_0x8a8a('0x1c')](PATH);var _0xe0321c=path[_0x8a8a('0x1d')](PATH,_0x8a8a('0x1e'));var _0xb9db78=_0x497b8a[_0x8a8a('0x1f')]&&_0x568b83[_0x8a8a('0x18')]>0x1;var _0x625c1b=[];if(!fs[_0x8a8a('0x20')](path['join'](_0x2f6af2,_0xe0321c))&&_0xb9db78){fs[_0x8a8a('0x21')](path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c));}return BPromise[_0x8a8a('0x23')](_0x568b83,function(_0x7662e){_0x625c1b[_0x8a8a('0x1a')](_0x7662e);})[_0x8a8a('0x12')](function(){for(var _0x3aa46d=0x0;_0x3aa46d<_0x625c1b['length'];_0x3aa46d+=0x1){var _0x31d21a;var _0x38c1e0=_0x625c1b[_0x3aa46d];if(_0xb9db78){_0x31d21a=path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c,util['format']('%s%d.%s',_0xe0321c,_0x3aa46d,_0x8a8a('0x24')));}else{_0x31d21a=path[_0x8a8a('0x22')](_0x2f6af2,util['format']('%s.%s',_0xe0321c,'csv'));}fs[_0x8a8a('0x25')](_0x31d21a,csv(_0x38c1e0));}})['then'](function(){if(_0xb9db78){zipdir(path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c),{'saveTo':path[_0x8a8a('0x22')](_0x2f6af2,util['format'](_0x8a8a('0x26'),_0xe0321c,_0x8a8a('0x27')))},function(_0x250852,_0x8df0cb){});rimraf(path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c),function(){});}})[_0x8a8a('0x12')](function(){logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0xb9db78?util[_0x8a8a('0xd')](_0x8a8a('0x26'),_0xe0321c,_0xb9db78?'zip':_0x8a8a('0x24')):null);});})[_0x8a8a('0x28')](function(_0x481e92){logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')](_0x8a8a('0x29'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x481e92,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x8a8a('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 1794426..072f833 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 _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x12f923,_0x26e3f7){var _0x4248cc=function(_0x35943c){while(--_0x35943c){_0x12f923['push'](_0x12f923['shift']());}};_0x4248cc(++_0x26e3f7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file +var _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x49b773,_0x55629e){var _0x12f68b=function(_0x73c7fc){while(--_0x73c7fc){_0x49b773['push'](_0x49b773['shift']());}};_0x12f68b(++_0x55629e);}(_0x5f2f,0x73));var _0xf5f2=function(_0xbf81d8,_0x546bfb){_0xbf81d8=_0xbf81d8-0x0;var _0x182d12=_0x5f2f[_0xbf81d8];return _0x182d12;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index b9d9999..20934ad 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 _0xc7d5=['info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.xlsx','split','length','join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','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','json2xls','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','update'];(function(_0x56258c,_0x64be62){var _0x1e42af=function(_0x4e3240){while(--_0x4e3240){_0x56258c['push'](_0x56258c['shift']());}};_0x1e42af(++_0x64be62);}(_0xc7d5,0x156));var _0x5c7d=function(_0x327c93,_0x424cd7){_0x327c93=_0x327c93-0x0;var _0x308d1d=_0xc7d5[_0x327c93];return _0x308d1d;};'use strict';var util=require(_0x5c7d('0x0'));var path=require('path');var _=require(_0x5c7d('0x1'));var fs=require('fs');var json2xls=require(_0x5c7d('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x5c7d('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x5c7d('0x4'))[_0x5c7d('0x5')];var logger=require(_0x5c7d('0x6'))(_0x5c7d('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x5c7d('0x8')][0x2]);var QUERY=process[_0x5c7d('0x8')][0x3];var PATH=process[_0x5c7d('0x8')][0x4];function analyticExtractedReport(_0x3b930f,_0x46b8b5){var _0x576f5e={'status':_0x3b930f};var _0x3b09ef={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x46b8b5){_0x576f5e['savename']=_0x46b8b5;}return db['AnalyticExtractedReport'][_0x5c7d('0x9')](_0x576f5e,_0x3b09ef);}function main(){var _0x689cae=0x1388;var _0x292d8d;logger[_0x5c7d('0xa')](util[_0x5c7d('0xb')](_0x5c7d('0xc'),EXTRACTED_REPORT_ID,_0x5c7d('0xd')));return db['Setting'][_0x5c7d('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x5c7d('0xf')]})[_0x5c7d('0x10')](function(_0x22e435){if(_0x22e435){_0x292d8d=_0x22e435;_0x689cae=_0x292d8d[_0x5c7d('0xf')]||0x1388;}})[_0x5c7d('0x10')](function(){return dbH[_0x5c7d('0x11')]['query'](util[_0x5c7d('0xb')](_0x5c7d('0x12'),QUERY),{'type':dbH[_0x5c7d('0x11')]['QueryTypes']['SELECT']});})[_0x5c7d('0x10')](function(_0x29a6d5){if(!_0x29a6d5[0x0][_0x5c7d('0x13')]){return analyticExtractedReport(_0x5c7d('0x14'));}var _0x19f265=[];var _0x48679f=0x0;var _0x653593=!![];if(_0x292d8d['split']){if(_0x29a6d5&&_0x29a6d5['length']){var _0xc8a203=_0x29a6d5[0x0]['num']%(_0x48679f+_0x689cae);for(;_0x653593;_0x48679f+=_0x689cae,_0xc8a203=_0x29a6d5[0x0][_0x5c7d('0x13')]%(_0x48679f+_0x689cae)){if(_0xc8a203==0x0||_0xc8a203==_0x29a6d5[0x0]['num']){_0x653593=![];}_0x19f265[_0x5c7d('0x15')](dbH[_0x5c7d('0x11')][_0x5c7d('0x16')](util[_0x5c7d('0xb')](_0x5c7d('0x17'),QUERY,_0x689cae,_0x48679f),{'type':dbH[_0x5c7d('0x11')]['QueryTypes']['SELECT']}));}}}else{_0x19f265[_0x5c7d('0x15')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0x5c7d('0x18')][_0x5c7d('0x19')]}));}var _0x13e4de=path[_0x5c7d('0x1a')](PATH);var _0x1abcb2=path[_0x5c7d('0x1b')](PATH,_0x5c7d('0x1c'));var _0x3bf466=_0x292d8d[_0x5c7d('0x1d')]&&_0x19f265[_0x5c7d('0x1e')]>0x1;var _0x457ba1=[];if(!fs['existsSync'](path[_0x5c7d('0x1f')](_0x13e4de,_0x1abcb2))&&_0x3bf466){fs[_0x5c7d('0x20')](path[_0x5c7d('0x1f')](_0x13e4de,_0x1abcb2));}return BPromise[_0x5c7d('0x21')](_0x19f265,function(_0x447f8f){_0x457ba1[_0x5c7d('0x15')](_0x447f8f);})[_0x5c7d('0x10')](function(){for(var _0x1cdff7=0x0;_0x1cdff7<_0x457ba1[_0x5c7d('0x1e')];_0x1cdff7+=0x1){var _0x35d7f6;var _0x342aeb=_0x457ba1[_0x1cdff7];if(_0x3bf466){_0x35d7f6=path['join'](_0x13e4de,_0x1abcb2,util[_0x5c7d('0xb')](_0x5c7d('0x22'),_0x1abcb2,_0x1cdff7,'xlsx'));}else{_0x35d7f6=path[_0x5c7d('0x1f')](_0x13e4de,util[_0x5c7d('0xb')](_0x5c7d('0x23'),_0x1abcb2,_0x5c7d('0x24')));}fs['writeFileSync'](_0x35d7f6,json2xls(_0x342aeb),'binary');}})[_0x5c7d('0x10')](function(){if(_0x3bf466){zipdir(path[_0x5c7d('0x1f')](_0x13e4de,_0x1abcb2),{'saveTo':path[_0x5c7d('0x1f')](_0x13e4de,util[_0x5c7d('0xb')](_0x5c7d('0x23'),_0x1abcb2,_0x5c7d('0x25')))},function(_0x37d12d,_0x2eb680){});rimraf(path[_0x5c7d('0x1f')](_0x13e4de,_0x1abcb2),function(){});}})[_0x5c7d('0x10')](function(){logger[_0x5c7d('0xa')](util[_0x5c7d('0xb')](_0x5c7d('0x26'),EXTRACTED_REPORT_ID,_0x5c7d('0xd')));return analyticExtractedReport(_0x5c7d('0x27'),_0x3bf466?util[_0x5c7d('0xb')](_0x5c7d('0x23'),_0x1abcb2,_0x3bf466?'zip':_0x5c7d('0x24')):null);});})[_0x5c7d('0x28')](function(_0x355f7a){logger[_0x5c7d('0xa')](util[_0x5c7d('0xb')](_0x5c7d('0x29'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x5c7d('0x2a')](_0x355f7a,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x5c7d('0x2b'));});}main(); \ No newline at end of file +var _0xe5ee=['num','Empty','length','push','dirname','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','util','path','lodash','bluebird','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','query','sequelize','QueryTypes','SELECT'];(function(_0xc10ab5,_0x398c72){var _0x5ebfd7=function(_0x44cfcc){while(--_0x44cfcc){_0xc10ab5['push'](_0xc10ab5['shift']());}};_0x5ebfd7(++_0x398c72);}(_0xe5ee,0x8f));var _0xee5e=function(_0x49d145,_0x532c15){_0x49d145=_0x49d145-0x0;var _0x33a234=_0xe5ee[_0x49d145];return _0x33a234;};'use strict';var util=require(_0xee5e('0x0'));var path=require(_0xee5e('0x1'));var _=require(_0xee5e('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xee5e('0x3'));var zipdir=require(_0xee5e('0x4'));var rimraf=require(_0xee5e('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xee5e('0x6')];var logger=require(_0xee5e('0x7'))(_0xee5e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xee5e('0x9')][0x2]);var QUERY=process[_0xee5e('0x9')][0x3];var PATH=process[_0xee5e('0x9')][0x4];function analyticExtractedReport(_0x413988,_0x4deade){var _0x4c2615={'status':_0x413988};var _0x2e0ef9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4deade){_0x4c2615['savename']=_0x4deade;}return db[_0xee5e('0xa')][_0xee5e('0xb')](_0x4c2615,_0x2e0ef9);}function main(){var _0x4d3df5=0x1388;var _0x260990;logger[_0xee5e('0xc')](util[_0xee5e('0xd')](_0xee5e('0xe'),EXTRACTED_REPORT_ID,_0xee5e('0xf')));return db[_0xee5e('0x10')][_0xee5e('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xee5e('0x12'),_0xee5e('0x13')]})[_0xee5e('0x14')](function(_0x59fddd){if(_0x59fddd){_0x260990=_0x59fddd;_0x4d3df5=_0x260990['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH['sequelize'][_0xee5e('0x15')](util[_0xee5e('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xee5e('0x16')][_0xee5e('0x17')][_0xee5e('0x18')]});})[_0xee5e('0x14')](function(_0x2884a3){if(!_0x2884a3[0x0][_0xee5e('0x19')]){return analyticExtractedReport(_0xee5e('0x1a'));}var _0x2aa865=[];var _0x96961c=0x0;var _0x15950a=!![];if(_0x260990[_0xee5e('0x12')]){if(_0x2884a3&&_0x2884a3[_0xee5e('0x1b')]){var _0x51cef6=_0x2884a3[0x0][_0xee5e('0x19')]%(_0x96961c+_0x4d3df5);for(;_0x15950a;_0x96961c+=_0x4d3df5,_0x51cef6=_0x2884a3[0x0][_0xee5e('0x19')]%(_0x96961c+_0x4d3df5)){if(_0x51cef6==0x0||_0x51cef6==_0x2884a3[0x0][_0xee5e('0x19')]){_0x15950a=![];}_0x2aa865[_0xee5e('0x1c')](dbH[_0xee5e('0x16')]['query'](util[_0xee5e('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4d3df5,_0x96961c),{'type':dbH[_0xee5e('0x16')]['QueryTypes'][_0xee5e('0x18')]}));}}}else{_0x2aa865[_0xee5e('0x1c')](dbH[_0xee5e('0x16')][_0xee5e('0x15')](QUERY,{'type':dbH['sequelize'][_0xee5e('0x17')][_0xee5e('0x18')]}));}var _0x2afb2a=path[_0xee5e('0x1d')](PATH);var _0x1cfdad=path['basename'](PATH,_0xee5e('0x1e'));var _0x2ddfbf=_0x260990[_0xee5e('0x12')]&&_0x2aa865['length']>0x1;var _0x573d58=[];if(!fs[_0xee5e('0x1f')](path[_0xee5e('0x20')](_0x2afb2a,_0x1cfdad))&&_0x2ddfbf){fs[_0xee5e('0x21')](path['join'](_0x2afb2a,_0x1cfdad));}return BPromise[_0xee5e('0x22')](_0x2aa865,function(_0x453b4f){_0x573d58[_0xee5e('0x1c')](_0x453b4f);})['then'](function(){for(var _0x2b11e0=0x0;_0x2b11e0<_0x573d58['length'];_0x2b11e0+=0x1){var _0x4b81f4;var _0x514f37=_0x573d58[_0x2b11e0];if(_0x2ddfbf){_0x4b81f4=path[_0xee5e('0x20')](_0x2afb2a,_0x1cfdad,util[_0xee5e('0xd')](_0xee5e('0x23'),_0x1cfdad,_0x2b11e0,'xlsx'));}else{_0x4b81f4=path['join'](_0x2afb2a,util['format'](_0xee5e('0x24'),_0x1cfdad,_0xee5e('0x25')));}fs['writeFileSync'](_0x4b81f4,json2xls(_0x514f37),_0xee5e('0x26'));}})['then'](function(){if(_0x2ddfbf){zipdir(path[_0xee5e('0x20')](_0x2afb2a,_0x1cfdad),{'saveTo':path[_0xee5e('0x20')](_0x2afb2a,util[_0xee5e('0xd')](_0xee5e('0x24'),_0x1cfdad,_0xee5e('0x27')))},function(_0x1bae17,_0x5d8aa0){});rimraf(path[_0xee5e('0x20')](_0x2afb2a,_0x1cfdad),function(){});}})[_0xee5e('0x14')](function(){logger[_0xee5e('0xc')](util[_0xee5e('0xd')](_0xee5e('0x28'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x2ddfbf?util[_0xee5e('0xd')]('%s.%s',_0x1cfdad,_0x2ddfbf?_0xee5e('0x27'):'xlsx'):null);});})['catch'](function(_0x5b314a){logger[_0xee5e('0xc')](util[_0xee5e('0xd')](_0xee5e('0x29'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x5b314a,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 7de0243..8d77c8c 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 _0x5cbc=['groupBy','exten','playback','hasOwnProperty','priority','extensions','extension','push','type','Set','CDR(type)=%s','context','outbound','CDR(destination)=','${EXTEN:','cutdigits','VoiceExtensionId','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','*,*,*,*','interval','filter','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','bulkCreate','sortBy','catch','error','rewrite','lodash','models','findAll','then','IntervalId','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)'];(function(_0x33a499,_0x302924){var _0x4a437f=function(_0x294db8){while(--_0x294db8){_0x33a499['push'](_0x33a499['shift']());}};_0x4a437f(++_0x302924);}(_0x5cbc,0xfb));var _0xc5cb=function(_0x374672,_0x4f495a){_0x374672=_0x374672-0x0;var _0x2318e1=_0x5cbc[_0x374672];return _0x2318e1;};'use strict';var _=require(_0xc5cb('0x0'));var util=require('util');function rewrite(_0x29b739,_0x1ec545){var _0x38586e=this;return _0x29b739[_0xc5cb('0x1')]['Interval'][_0xc5cb('0x2')]({'raw':!![]})[_0xc5cb('0x3')](function(_0x1f4383){_0x38586e['intervals']=_0x1f4383;return _0x29b739[_0xc5cb('0x1')]['VoiceExtension'][_0xc5cb('0x2')]({'where':{'IntervalId':_0x1ec545[_0xc5cb('0x4')]},'raw':!![]});})['then'](function(_0x1804f6){return _0x29b739['models'][_0xc5cb('0x5')][_0xc5cb('0x2')]({'where':{'exten':{'$in':_[_0xc5cb('0x6')](_[_0xc5cb('0x7')](_0x1804f6,'exten'))}},'order':[{'raw':_0xc5cb('0x8')}],'raw':!![]});})['then'](function(_0x46d8d3){var _0x5d8973=_['filter'](_0x46d8d3,{'priority':'1'});var _0x295b75=_['filter'](_0x46d8d3,{'isApp':0x1});var _0x3b7be4=_[_0xc5cb('0x9')](_0x295b75,_0xc5cb('0xa'));var _0x57de51=['queue',_0xc5cb('0xb')];var _0x20d71f=[];var _0x5cc765=[];for(var _0x42a792 in _0x3b7be4){if(_0x3b7be4[_0xc5cb('0xc')](_0x42a792)){_0x38586e[_0xc5cb('0xd')]=0x2;_0x38586e[_0xc5cb('0xe')]=[];_0x38586e[_0xc5cb('0xf')]=_['find'](_0x5d8973,{'exten':_0x3b7be4[_0x42a792][0x0]['exten']});_0x38586e[_0xc5cb('0xe')][_0xc5cb('0x10')]({'type':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x11')],'app':_0xc5cb('0x12'),'appdata':util['format'](_0xc5cb('0x13'),_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x11')]),'context':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x14')],'exten':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0xa')],'priority':_0x38586e['priority']++,'VoiceExtensionId':_0x3b7be4[_0x42a792][0x0]['VoiceExtensionId']});if(_0x3b7be4[_0x42a792][0x0]['type']===_0xc5cb('0x15')){if(_0x38586e[_0xc5cb('0xf')]){_0x38586e['extensions'][_0xc5cb('0x10')]({'type':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x11')],'app':_0xc5cb('0x12'),'appdata':_0xc5cb('0x16')+(_0x38586e[_0xc5cb('0xf')]['cutdigits']?_0xc5cb('0x17')+_0x38586e[_0xc5cb('0xf')][_0xc5cb('0x18')]+'}':'${EXTEN}'),'context':_0x3b7be4[_0x42a792][0x0]['context'],'exten':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0xa')],'priority':_0x38586e['priority']++,'VoiceExtensionId':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x19')]});}_0x38586e[_0xc5cb('0xe')]['push']({'type':_0x3b7be4[_0x42a792][0x0]['type'],'app':_0xc5cb('0x12'),'appdata':'CDR(routeid)='+_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x19')],'context':_0x3b7be4[_0x42a792][0x0]['context'],'exten':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0xa')],'priority':_0x38586e[_0xc5cb('0xd')]++,'VoiceExtensionId':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x19')]});var _0x567057=_0x38586e['priority']++;_0x38586e[_0xc5cb('0xe')]['push']({'type':_0x3b7be4[_0x42a792][0x0]['type'],'app':_0xc5cb('0x1a'),'appdata':_0xc5cb('0x1b')+(_0x567057+0x2)+_0xc5cb('0x1c')+(_0x567057+0x1)+')','context':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x14')],'exten':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0xa')],'priority':_0x567057,'VoiceExtensionId':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x19')]});if(_0x38586e[_0xc5cb('0xf')]){_0x38586e['extensions']['push']({'type':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x11')],'app':'Set','appdata':_0x38586e[_0xc5cb('0xf')][_0xc5cb('0x18')]?_0xc5cb('0x1d')+_0x38586e[_0xc5cb('0xf')][_0xc5cb('0x18')]+'}':_0xc5cb('0x1e'),'context':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x14')],'exten':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0xa')],'priority':_0x38586e[_0xc5cb('0xd')]++,'VoiceExtensionId':_0x3b7be4[_0x42a792][0x0]['VoiceExtensionId']});}_0x38586e[_0xc5cb('0xe')][_0xc5cb('0x10')]({'type':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x11')],'app':'Set','appdata':'outboundrouteid='+_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x19')],'context':_0x3b7be4[_0x42a792][0x0]['context'],'exten':_0x3b7be4[_0x42a792][0x0]['exten'],'priority':_0x38586e[_0xc5cb('0xd')]++,'VoiceExtensionId':_0x3b7be4[_0x42a792][0x0]['VoiceExtensionId']});if(_0x38586e[_0xc5cb('0xf')]&&_0x38586e[_0xc5cb('0xf')]['hasOwnProperty']('recordingFormat')&&_0x38586e['extension'][_0xc5cb('0x1f')]!==_0xc5cb('0x20')){_0x38586e[_0xc5cb('0xe')][_0xc5cb('0x10')]({'type':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x11')],'app':_0xc5cb('0x12'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x14')],'exten':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0xa')],'priority':_0x38586e[_0xc5cb('0xd')]++,'VoiceExtensionId':_0x3b7be4[_0x42a792][0x0]['VoiceExtensionId']});_0x38586e[_0xc5cb('0xe')][_0xc5cb('0x10')]({'type':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x11')],'app':_0xc5cb('0x12'),'appdata':_0xc5cb('0x21')+_0x38586e[_0xc5cb('0xf')][_0xc5cb('0x1f')]||_0xc5cb('0x22'),'context':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x14')],'exten':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0xa')],'priority':_0x38586e[_0xc5cb('0xd')]++,'VoiceExtensionId':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x19')]});}}_0x38586e['extensions'][_0xc5cb('0x10')]({'type':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x11')],'app':_0xc5cb('0x12'),'appdata':_0xc5cb('0x23'),'context':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x14')],'exten':_0x3b7be4[_0x42a792][0x0]['exten'],'priority':_0x38586e[_0xc5cb('0xd')]++,'VoiceExtensionId':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x19')]});_0x38586e[_0xc5cb('0xe')][_0xc5cb('0x10')]({'type':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x11')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3b7be4[_0x42a792][0x0]['context'],'exten':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0xa')],'priority':_0x38586e[_0xc5cb('0xd')]++,'VoiceExtensionId':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x19')]});_0x38586e[_0xc5cb('0xe')][_0xc5cb('0x10')]({'type':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x11')],'app':_0xc5cb('0x12'),'appdata':_0xc5cb('0x24'),'context':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x14')],'exten':_0x3b7be4[_0x42a792][0x0]['exten'],'priority':_0x38586e['priority']++,'VoiceExtensionId':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x19')]});for(var _0x5c9182=0x0,_0x33fdc3=0x0;_0x5c9182<_0x3b7be4[_0x42a792][_0xc5cb('0x25')];_0x5c9182+=0x1,_0x33fdc3=0x0){var _0x57432c=_0x3b7be4[_0x42a792][_0x5c9182];if(_0x57432c[_0xc5cb('0x11')]){_0x57432c[_0xc5cb('0x11')]=_0x57432c[_0xc5cb('0x11')][_0xc5cb('0x26')]();}var _0x3cb3cb=[];var _0x3ec035=[];delete _0x57432c['id'];delete _0x57432c[_0xc5cb('0x27')];delete _0x57432c['updatedAt'];var _0x3783bd=_0x57432c['interval']!==_0xc5cb('0x28')?[_0x57432c[_0xc5cb('0x29')]]:_0x57432c[_0xc5cb('0x4')]?_[_0xc5cb('0x7')](_[_0xc5cb('0x2a')](_0x38586e['intervals'],{'IntervalId':_0x57432c[_0xc5cb('0x4')]}),_0xc5cb('0x29')):[];if(_0x57432c[_0xc5cb('0xc')]('tag')){if(_0x57432c[_0xc5cb('0x2b')]&&_0x57432c['tag']!=='--'){_0x3cb3cb[_0xc5cb('0x10')]({'type':_0x57432c[_0xc5cb('0x11')],'app':_0xc5cb('0x12'),'appdata':_0xc5cb('0x2c')+_0x57432c[_0xc5cb('0x2b')],'context':_0x57432c['context'],'exten':_0x57432c[_0xc5cb('0xa')],'priority':_0x3783bd[_0xc5cb('0x25')]+_0x38586e[_0xc5cb('0xd')]+_0x33fdc3++,'VoiceExtensionId':_0x57432c[_0xc5cb('0x19')]});}}if(_0x57432c[_0xc5cb('0x11')]===_0xc5cb('0x15')&&_0x57432c['hasOwnProperty'](_0xc5cb('0x2d'))){if(_0x57432c[_0xc5cb('0x2d')]){_0x3cb3cb[_0xc5cb('0x10')]({'type':_0x57432c[_0xc5cb('0x11')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x57432c[_0xc5cb('0x2d')]+')','context':_0x57432c[_0xc5cb('0x14')],'exten':_0x57432c[_0xc5cb('0xa')],'priority':_0x3783bd[_0xc5cb('0x25')]+_0x38586e['priority']+_0x33fdc3++,'VoiceExtensionId':_0x57432c[_0xc5cb('0x19')]});}else{_0x3cb3cb[_0xc5cb('0x10')]({'type':_0x57432c[_0xc5cb('0x11')],'app':_0xc5cb('0x1a'),'appdata':_0xc5cb('0x2e'),'context':_0x57432c[_0xc5cb('0x14')],'exten':_0x57432c[_0xc5cb('0xa')],'priority':_0x3783bd[_0xc5cb('0x25')]+_0x38586e['priority']+_0x33fdc3++,'VoiceExtensionId':_0x57432c['VoiceExtensionId']});}}if(_0x57432c[_0xc5cb('0xc')](_0xc5cb('0x2f'))){if(_0x57de51['indexOf'](_0x57432c[_0xc5cb('0x30')][_0xc5cb('0x26')]())>=0x0&&_0x57432c[_0xc5cb('0x31')]!==_0xc5cb('0x32')){if(_0x57432c[_0xc5cb('0x2f')]){_0x3cb3cb[_0xc5cb('0x10')]({'type':_0x57432c[_0xc5cb('0x11')],'app':_0xc5cb('0x1a'),'appdata':_0xc5cb('0x33'),'context':_0x57432c[_0xc5cb('0x14')],'exten':_0x57432c[_0xc5cb('0xa')],'priority':_0x3783bd[_0xc5cb('0x25')]+_0x38586e['priority']+_0x33fdc3++,'VoiceExtensionId':_0x57432c['VoiceExtensionId']});_0x3cb3cb[_0xc5cb('0x10')]({'type':_0x57432c[_0xc5cb('0x11')],'app':_0xc5cb('0x12'),'appdata':_0xc5cb('0x34'),'context':_0x57432c[_0xc5cb('0x14')],'exten':_0x57432c[_0xc5cb('0xa')],'priority':_0x3783bd[_0xc5cb('0x25')]+_0x38586e['priority']+_0x33fdc3++,'VoiceExtensionId':_0x57432c['VoiceExtensionId']});}else{_0x3cb3cb[_0xc5cb('0x10')]({'type':_0x57432c[_0xc5cb('0x11')],'app':_0xc5cb('0x1a'),'appdata':_0xc5cb('0x35'),'context':_0x57432c[_0xc5cb('0x14')],'exten':_0x57432c['exten'],'priority':_0x3783bd[_0xc5cb('0x25')]+_0x38586e['priority']+_0x33fdc3++,'VoiceExtensionId':_0x57432c[_0xc5cb('0x19')]});_0x3cb3cb[_0xc5cb('0x10')]({'type':_0x57432c[_0xc5cb('0x11')],'app':'Set','appdata':_0xc5cb('0x36'),'context':_0x57432c['context'],'exten':_0x57432c[_0xc5cb('0xa')],'priority':_0x3783bd[_0xc5cb('0x25')]+_0x38586e['priority']+_0x33fdc3++,'VoiceExtensionId':_0x57432c['VoiceExtensionId']});}}}for(var _0x5ba1d3=0x0;_0x5ba1d3<_0x3783bd[_0xc5cb('0x25')];_0x5ba1d3+=0x1){var _0x3fcf4f=_0x38586e[_0xc5cb('0xd')]+_0x3783bd[_0xc5cb('0x25')];var _0x157d54=_0x5ba1d3===_0x3783bd['length']-0x1?_0x38586e[_0xc5cb('0xd')]+_0x3cb3cb[_0xc5cb('0x25')]+_0x3ec035[_0xc5cb('0x25')]+0x2:_0x38586e[_0xc5cb('0xd')]+_0x5ba1d3+0x1;_0x3cb3cb[_0xc5cb('0x37')](_0x5ba1d3,0x0,{'type':_0x57432c[_0xc5cb('0x11')],'app':_0xc5cb('0x38'),'appdata':_0x3783bd[_0x5ba1d3]+'?'+_0x57432c[_0xc5cb('0x14')]+_0xc5cb('0x39')+_0x3fcf4f+':'+_0x57432c['context']+_0xc5cb('0x39')+_0x157d54,'exten':_0x57432c['exten'],'context':_0x57432c[_0xc5cb('0x14')],'priority':_0x38586e[_0xc5cb('0xd')]+_0x5ba1d3,'VoiceExtensionId':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x19')]});}_0x57432c[_0xc5cb('0xd')]=_0x3cb3cb[_0xc5cb('0x25')]?_[_0xc5cb('0x3a')](_0x3cb3cb)['priority']+0x1:_0x38586e[_0xc5cb('0xd')];_0x38586e[_0xc5cb('0xd')]=(_0x3ec035[_0xc5cb('0x25')]?_['last'](_0x3ec035)[_0xc5cb('0xd')]:_0x57432c[_0xc5cb('0xd')])+0x1;_0x38586e[_0xc5cb('0xe')]=_['concat'](_0x38586e[_0xc5cb('0xe')],_0x3cb3cb,[_0x57432c],_0x3ec035);}_0x38586e[_0xc5cb('0xe')][_0xc5cb('0x10')]({'type':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x11')],'app':_0xc5cb('0x3b'),'exten':_0x3b7be4[_0x42a792][0x0]['exten'],'context':_0x3b7be4[_0x42a792][0x0]['context'],'priority':_0x38586e['priority'],'VoiceExtensionId':_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x19')]});_0x20d71f[_0xc5cb('0x10')](_0x3b7be4[_0x42a792][0x0][_0xc5cb('0x19')]);_0x5cc765=_['concat'](_0x5cc765,_0x38586e['extensions']);}}return _0x29b739['transaction'](function(_0x5970c0){return _0x29b739[_0xc5cb('0x1')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x20d71f}},'transaction':_0x5970c0})[_0xc5cb('0x3')](function(_0x21b4a4){return _0x29b739[_0xc5cb('0x1')][_0xc5cb('0x5')][_0xc5cb('0x3c')](_[_0xc5cb('0x3d')](_0x5cc765,_0xc5cb('0xd')),{'transaction':_0x5970c0});});});})[_0xc5cb('0x3e')](function(_0x31fa82){console[_0xc5cb('0x3f')](_0x31fa82);});}exports[_0xc5cb('0x40')]=rewrite; \ No newline at end of file +var _0x91ff=['intervals','models','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','push','type','format','CDR(type)=%s','context','VoiceExtensionId','Set','${EXTEN:','cutdigits','${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=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','map','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','toLowerCase','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','Interval','findAll','then'];(function(_0x347c9a,_0x5263dd){var _0x44e239=function(_0x4bbc3f){while(--_0x4bbc3f){_0x347c9a['push'](_0x347c9a['shift']());}};_0x44e239(++_0x5263dd);}(_0x91ff,0x15b));var _0xf91f=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0x91ff[_0x5e6cb8];return _0x3faeb3;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x2d4c89,_0x4e5c14){var _0x205ff4=this;return _0x2d4c89['models'][_0xf91f('0x0')][_0xf91f('0x1')]({'raw':!![]})[_0xf91f('0x2')](function(_0x443475){_0x205ff4[_0xf91f('0x3')]=_0x443475;return _0x2d4c89[_0xf91f('0x4')][_0xf91f('0x5')]['findAll']({'where':{'IntervalId':_0x4e5c14[_0xf91f('0x6')]},'raw':!![]});})[_0xf91f('0x2')](function(_0x580d9a){return _0x2d4c89[_0xf91f('0x4')]['VoiceExtension'][_0xf91f('0x1')]({'where':{'exten':{'$in':_[_0xf91f('0x7')](_['map'](_0x580d9a,_0xf91f('0x8')))}},'order':[{'raw':_0xf91f('0x9')}],'raw':!![]});})[_0xf91f('0x2')](function(_0x46f206){var _0x151540=_[_0xf91f('0xa')](_0x46f206,{'priority':'1'});var _0x5269b6=_[_0xf91f('0xa')](_0x46f206,{'isApp':0x1});var _0x234b78=_[_0xf91f('0xb')](_0x5269b6,_0xf91f('0x8'));var _0xd07a4d=[_0xf91f('0xc'),_0xf91f('0xd')];var _0x41652d=[];var _0x1dea3d=[];for(var _0x2dd161 in _0x234b78){if(_0x234b78[_0xf91f('0xe')](_0x2dd161)){_0x205ff4[_0xf91f('0xf')]=0x2;_0x205ff4[_0xf91f('0x10')]=[];_0x205ff4[_0xf91f('0x11')]=_['find'](_0x151540,{'exten':_0x234b78[_0x2dd161][0x0]['exten']});_0x205ff4[_0xf91f('0x10')][_0xf91f('0x12')]({'type':_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')],'app':'Set','appdata':util[_0xf91f('0x14')](_0xf91f('0x15'),_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')]),'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0][_0xf91f('0x8')],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});if(_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')]==='outbound'){if(_0x205ff4[_0xf91f('0x11')]){_0x205ff4[_0xf91f('0x10')]['push']({'type':_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':'CDR(destination)='+(_0x205ff4[_0xf91f('0x11')]['cutdigits']?_0xf91f('0x19')+_0x205ff4['extension'][_0xf91f('0x1a')]+'}':_0xf91f('0x1b')),'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0][_0xf91f('0x8')],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});}_0x205ff4[_0xf91f('0x10')][_0xf91f('0x12')]({'type':_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':'CDR(routeid)='+_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')],'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0][_0xf91f('0x8')],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});var _0x270367=_0x205ff4['priority']++;_0x205ff4[_0xf91f('0x10')][_0xf91f('0x12')]({'type':_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')],'app':_0xf91f('0x1c'),'appdata':_0xf91f('0x1d')+(_0x270367+0x2)+_0xf91f('0x1e')+(_0x270367+0x1)+')','context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0][_0xf91f('0x8')],'priority':_0x270367,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});if(_0x205ff4[_0xf91f('0x11')]){_0x205ff4[_0xf91f('0x10')]['push']({'type':_0x234b78[_0x2dd161][0x0]['type'],'app':'Set','appdata':_0x205ff4[_0xf91f('0x11')][_0xf91f('0x1a')]?_0xf91f('0x1f')+_0x205ff4[_0xf91f('0x11')][_0xf91f('0x1a')]+'}':_0xf91f('0x20'),'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0][_0xf91f('0x8')],'priority':_0x205ff4['priority']++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});}_0x205ff4['extensions'][_0xf91f('0x12')]({'type':_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':_0xf91f('0x21')+_0x234b78[_0x2dd161][0x0]['VoiceExtensionId'],'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0]['exten'],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});if(_0x205ff4[_0xf91f('0x11')]&&_0x205ff4[_0xf91f('0x11')][_0xf91f('0xe')](_0xf91f('0x22'))&&_0x205ff4[_0xf91f('0x11')]['recordingFormat']!==_0xf91f('0x23')){_0x205ff4['extensions'][_0xf91f('0x12')]({'type':_0x234b78[_0x2dd161][0x0]['type'],'app':_0xf91f('0x18'),'appdata':_0xf91f('0x24'),'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0][_0xf91f('0x8')],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});_0x205ff4[_0xf91f('0x10')]['push']({'type':_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':_0xf91f('0x25')+_0x205ff4['extension']['recordingFormat']||'wav','context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0]['exten'],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});}}_0x205ff4[_0xf91f('0x10')][_0xf91f('0x12')]({'type':_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0]['exten'],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});_0x205ff4[_0xf91f('0x10')][_0xf91f('0x12')]({'type':_0x234b78[_0x2dd161][0x0]['type'],'app':_0xf91f('0x18'),'appdata':_0xf91f('0x26'),'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0][_0xf91f('0x8')],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0]['VoiceExtensionId']});_0x205ff4[_0xf91f('0x10')]['push']({'type':_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':_0xf91f('0x27'),'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0]['exten'],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});for(var _0x3e969d=0x0,_0x1347fc=0x0;_0x3e969d<_0x234b78[_0x2dd161][_0xf91f('0x28')];_0x3e969d+=0x1,_0x1347fc=0x0){var _0x23bbd7=_0x234b78[_0x2dd161][_0x3e969d];if(_0x23bbd7[_0xf91f('0x13')]){_0x23bbd7['type']=_0x23bbd7['type']['toLowerCase']();}var _0x41c96d=[];var _0x2563cf=[];delete _0x23bbd7['id'];delete _0x23bbd7[_0xf91f('0x29')];delete _0x23bbd7[_0xf91f('0x2a')];var _0x15fb74=_0x23bbd7[_0xf91f('0x2b')]!==_0xf91f('0x2c')?[_0x23bbd7[_0xf91f('0x2b')]]:_0x23bbd7['IntervalId']?_[_0xf91f('0x2d')](_[_0xf91f('0xa')](_0x205ff4[_0xf91f('0x3')],{'IntervalId':_0x23bbd7[_0xf91f('0x6')]}),_0xf91f('0x2b')):[];if(_0x23bbd7[_0xf91f('0xe')]('tag')){if(_0x23bbd7['tag']&&_0x23bbd7[_0xf91f('0x2e')]!=='--'){_0x41c96d[_0xf91f('0x12')]({'type':_0x23bbd7[_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':_0xf91f('0x2f')+_0x23bbd7[_0xf91f('0x2e')],'context':_0x23bbd7[_0xf91f('0x16')],'exten':_0x23bbd7[_0xf91f('0x8')],'priority':_0x15fb74[_0xf91f('0x28')]+_0x205ff4[_0xf91f('0xf')]+_0x1347fc++,'VoiceExtensionId':_0x23bbd7[_0xf91f('0x17')]});}}if(_0x23bbd7[_0xf91f('0x13')]===_0xf91f('0x30')&&_0x23bbd7[_0xf91f('0xe')]('callerID')){if(_0x23bbd7[_0xf91f('0x31')]){_0x41c96d[_0xf91f('0x12')]({'type':_0x23bbd7['type'],'app':_0xf91f('0x1c'),'appdata':_0xf91f('0x32')+_0x23bbd7[_0xf91f('0x31')]+')','context':_0x23bbd7['context'],'exten':_0x23bbd7[_0xf91f('0x8')],'priority':_0x15fb74['length']+_0x205ff4['priority']+_0x1347fc++,'VoiceExtensionId':_0x23bbd7[_0xf91f('0x17')]});}else{_0x41c96d[_0xf91f('0x12')]({'type':_0x23bbd7[_0xf91f('0x13')],'app':'ExecIf','appdata':_0xf91f('0x33'),'context':_0x23bbd7[_0xf91f('0x16')],'exten':_0x23bbd7[_0xf91f('0x8')],'priority':_0x15fb74[_0xf91f('0x28')]+_0x205ff4[_0xf91f('0xf')]+_0x1347fc++,'VoiceExtensionId':_0x23bbd7[_0xf91f('0x17')]});}}if(_0x23bbd7[_0xf91f('0xe')](_0xf91f('0x34'))){if(_0xd07a4d['indexOf'](_0x23bbd7[_0xf91f('0x35')][_0xf91f('0x36')]())>=0x0&&_0x23bbd7[_0xf91f('0x37')]!=='custom'){if(_0x23bbd7[_0xf91f('0x34')]){_0x41c96d[_0xf91f('0x12')]({'type':_0x23bbd7['type'],'app':_0xf91f('0x1c'),'appdata':_0xf91f('0x38'),'context':_0x23bbd7[_0xf91f('0x16')],'exten':_0x23bbd7[_0xf91f('0x8')],'priority':_0x15fb74[_0xf91f('0x28')]+_0x205ff4['priority']+_0x1347fc++,'VoiceExtensionId':_0x23bbd7[_0xf91f('0x17')]});_0x41c96d['push']({'type':_0x23bbd7[_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':_0xf91f('0x39'),'context':_0x23bbd7['context'],'exten':_0x23bbd7[_0xf91f('0x8')],'priority':_0x15fb74[_0xf91f('0x28')]+_0x205ff4[_0xf91f('0xf')]+_0x1347fc++,'VoiceExtensionId':_0x23bbd7['VoiceExtensionId']});}else{_0x41c96d['push']({'type':_0x23bbd7[_0xf91f('0x13')],'app':_0xf91f('0x1c'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x23bbd7[_0xf91f('0x16')],'exten':_0x23bbd7[_0xf91f('0x8')],'priority':_0x15fb74[_0xf91f('0x28')]+_0x205ff4[_0xf91f('0xf')]+_0x1347fc++,'VoiceExtensionId':_0x23bbd7[_0xf91f('0x17')]});_0x41c96d[_0xf91f('0x12')]({'type':_0x23bbd7[_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':_0xf91f('0x3a'),'context':_0x23bbd7[_0xf91f('0x16')],'exten':_0x23bbd7[_0xf91f('0x8')],'priority':_0x15fb74[_0xf91f('0x28')]+_0x205ff4[_0xf91f('0xf')]+_0x1347fc++,'VoiceExtensionId':_0x23bbd7[_0xf91f('0x17')]});}}}for(var _0x48f0a7=0x0;_0x48f0a7<_0x15fb74[_0xf91f('0x28')];_0x48f0a7+=0x1){var _0x598e7e=_0x205ff4[_0xf91f('0xf')]+_0x15fb74[_0xf91f('0x28')];var _0x5b9d6c=_0x48f0a7===_0x15fb74[_0xf91f('0x28')]-0x1?_0x205ff4[_0xf91f('0xf')]+_0x41c96d[_0xf91f('0x28')]+_0x2563cf['length']+0x2:_0x205ff4['priority']+_0x48f0a7+0x1;_0x41c96d[_0xf91f('0x3b')](_0x48f0a7,0x0,{'type':_0x23bbd7[_0xf91f('0x13')],'app':_0xf91f('0x3c'),'appdata':_0x15fb74[_0x48f0a7]+'?'+_0x23bbd7[_0xf91f('0x16')]+_0xf91f('0x3d')+_0x598e7e+':'+_0x23bbd7[_0xf91f('0x16')]+',${EXTEN},'+_0x5b9d6c,'exten':_0x23bbd7['exten'],'context':_0x23bbd7[_0xf91f('0x16')],'priority':_0x205ff4[_0xf91f('0xf')]+_0x48f0a7,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});}_0x23bbd7[_0xf91f('0xf')]=_0x41c96d[_0xf91f('0x28')]?_[_0xf91f('0x3e')](_0x41c96d)[_0xf91f('0xf')]+0x1:_0x205ff4[_0xf91f('0xf')];_0x205ff4['priority']=(_0x2563cf[_0xf91f('0x28')]?_[_0xf91f('0x3e')](_0x2563cf)[_0xf91f('0xf')]:_0x23bbd7[_0xf91f('0xf')])+0x1;_0x205ff4[_0xf91f('0x10')]=_[_0xf91f('0x3f')](_0x205ff4[_0xf91f('0x10')],_0x41c96d,[_0x23bbd7],_0x2563cf);}_0x205ff4[_0xf91f('0x10')][_0xf91f('0x12')]({'type':_0x234b78[_0x2dd161][0x0]['type'],'app':_0xf91f('0x40'),'exten':_0x234b78[_0x2dd161][0x0][_0xf91f('0x8')],'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'priority':_0x205ff4[_0xf91f('0xf')],'VoiceExtensionId':_0x234b78[_0x2dd161][0x0]['VoiceExtensionId']});_0x41652d[_0xf91f('0x12')](_0x234b78[_0x2dd161][0x0]['VoiceExtensionId']);_0x1dea3d=_[_0xf91f('0x3f')](_0x1dea3d,_0x205ff4[_0xf91f('0x10')]);}}return _0x2d4c89[_0xf91f('0x41')](function(_0x21556c){return _0x2d4c89[_0xf91f('0x4')]['VoiceExtension'][_0xf91f('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x41652d}},'transaction':_0x21556c})[_0xf91f('0x2')](function(_0x31f9af){return _0x2d4c89[_0xf91f('0x4')][_0xf91f('0x5')][_0xf91f('0x43')](_[_0xf91f('0x44')](_0x1dea3d,_0xf91f('0xf')),{'transaction':_0x21556c});});});})['catch'](function(_0x49adee){console[_0xf91f('0x45')](_0x49adee);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index dece1f2..5fc84a3 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','insert','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','push','sequelize','VoiceQueueId','catch','onlyIfOpen','query','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','split','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()'];(function(_0x576ef1,_0x3ea235){var _0x30f812=function(_0xb990ca){while(--_0xb990ca){_0x576ef1['push'](_0x576ef1['shift']());}};_0x30f812(++_0x3ea235);}(_0xe706,0xa3));var _0x6e70=function(_0x3cfb0d,_0x4df584){_0x3cfb0d=_0x3cfb0d-0x0;var _0x3486b4=_0xe706[_0x3cfb0d];return _0x3486b4;};'use strict';var BPromise=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var socket=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));require(_0x6e70('0xd'))[_0x6e70('0xe')](socket);try{if(!process[_0x6e70('0xf')][0x2]||process[_0x6e70('0xf')][0x2]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x2]===_0x6e70('0x11')){throw new Error(_0x6e70('0x12'));}var FILEPATH=process[_0x6e70('0xf')][0x2];if(!process[_0x6e70('0xf')][0x3]||process[_0x6e70('0xf')][0x3]===_0x6e70('0x10')||process['argv'][0x3]==='null'||!process[_0x6e70('0xf')][0x4]||process[_0x6e70('0xf')][0x4]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x4]===_0x6e70('0x11')){throw new Error(_0x6e70('0x13'));}var FIELDS=_[_0x6e70('0x14')](process[_0x6e70('0xf')][0x3]['split'](','),process['argv'][0x4]['split'](','));if(!process[_0x6e70('0xf')][0x5]||process['argv'][0x5]==='undefined'||process[_0x6e70('0xf')][0x5]===_0x6e70('0x11')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x6e70('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x6e70('0xf')][0x6]!==_0x6e70('0x10')&&process['argv'][0x6]!=='null'?process[_0x6e70('0xf')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x6e70('0xf')][0x7]!==_0x6e70('0x10')&&process['argv'][0x7]!=='null'?process[_0x6e70('0xf')][0x7]:null;if(!process[_0x6e70('0xf')][0x8]||process[_0x6e70('0xf')][0x8]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x8]===_0x6e70('0x11')){throw new Error(_0x6e70('0x15'));}var SOCKET_TIMESTAMP=process[_0x6e70('0xf')][0x8];}catch(_0x29326f){logger[_0x6e70('0x16')](_0x29326f);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4a0cfe,_0x228350,_0x344b65,_0x27b294){var _0x502b2d={'message':_0x228350};_0x502b2d[_0x4a0cfe]=!![];if(_0x344b65){_0x502b2d[_0x6e70('0x17')]=_0x344b65;}if(_0x27b294){_0x502b2d[_0x6e70('0x18')]=_0x27b294;}return _0x502b2d;}function isEmail(_0x3337a6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x3337a6);}function checkRow(_0x10fc91,_0x538b9c,_0x50aec2){return new BPromise(function(_0x4e97c7,_0x41e352){if(_[_0x6e70('0x19')](_0x10fc91)){return _0x41e352(handleCheckRowError('error',_0x6e70('0x1a'),null,_0x50aec2));}if(_0x10fc91[_0x6e70('0x1b')]&&_0x10fc91['errors'][_0x6e70('0x1c')]){var _0x67fb43=_[_0x6e70('0x1d')](_0x10fc91['errors'],'message')[_0x6e70('0x1e')](';');return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x67fb43,null,_0x50aec2));}var _0x83c836={};for(var _0x114344 in FIELDS){if(FIELDS[_0x6e70('0x1f')](_0x114344)&&FIELDS[_0x114344]){_0x83c836[_0x114344]=_0x10fc91['data'][0x0][FIELDS[_0x114344]]||_0x10fc91[_0x6e70('0x20')][0x0]['\ufeff'+FIELDS[_0x114344]];}}if(!_0x83c836[_0x6e70('0x21')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x22'),null,_0x50aec2));}if(!_0x83c836[_0x6e70('0x23')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x24'),null,_0x50aec2));}if(_0x83c836[_0x6e70('0x25')]){var _0x3a0821=moment(_0x83c836[_0x6e70('0x25')],'YYYY-MM-DD');if(!_0x3a0821[_0x6e70('0x26')]()){return _0x41e352(handleCheckRowError('error',_0x6e70('0x27'),null,_0x50aec2));}}if(_0x83c836['email']){if(!isEmail(_0x83c836[_0x6e70('0x28')])){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x29'),null,_0x50aec2));}}_0x83c836['ListId']=LISTID;_0x83c836[_0x6e70('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){var _0x5780a1={};for(var _0x13d673=0x0,_0x154925=DUPLICATES['length'];_0x13d673<_0x154925;_0x13d673+=0x1){_0x5780a1[DUPLICATES[_0x13d673]]=_0x83c836[DUPLICATES[_0x13d673]];}var _0x10d8f6=_[_0x6e70('0x2b')](_0x538b9c,_0x5780a1);if(_0x10d8f6){return _0x41e352(handleCheckRowError(_0x6e70('0x2c'),_0x6e70('0x2d'),_0x10d8f6,_0x50aec2));}}return db[_0x6e70('0x2e')][_0x6e70('0x2f')](_0x83c836,{'raw':!![],'hooks':![],'fields':_[_0x6e70('0x30')](_0x83c836)})[_0x6e70('0x31')](function(_0xf146fd){if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){_0x538b9c['push'](_[_0x6e70('0x32')](_0x83c836,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xf146fd['id'];return _0x4e97c7();})['catch'](function(_0x23cd1a){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x33')+(_0x23cd1a[_0x6e70('0x34')]||JSON[_0x6e70('0x35')](_0x23cd1a)),null,_0x50aec2));});});}function checkHopper(){function _0x989b80(){return function(_0x2440be){logger[_0x6e70('0x16')](_0x6e70('0x36'),_0x6e70('0x37'),util[_0x6e70('0x38')](_0x2440be,{'showHidden':![],'depth':null}));};}var _0x23d5e2=function(_0x5594d3,_0x501b53){var _0x5446a2=squel['insert']()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),'ListId',_0x501b53,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x5594d3['id'][_0x6e70('0x43')](),_0x501b53)['field']('NOW()','createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x6e70('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x501b53+'\x20=\x20?',_0x5594d3['id'][_0x6e70('0x43')]())))[_0x6e70('0x43')]();return _0x5446a2;};var _0x2dafb5=function(_0x3478e2,_0x5bbc3a){var _0x291de6=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),'ContactId',_0x6e70('0x44'),_0x5bbc3a,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))['field'](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))['field'](LISTID['toString'](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x3478e2['id'][_0x6e70('0x43')](),_0x5bbc3a)['field']('NOW()',_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b'))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()['field'](_0x6e70('0x4d'))[_0x6e70('0x45')](_0x6e70('0x4e'))[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']()))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']())))[_0x6e70('0x43')]();return _0x291de6;};function _0xebe5f7(_0x54efdf,_0x3cfaa9){var _0xb3f06c=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))['fromQuery']([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),_0x6e70('0x44'),_0x3cfaa9,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3c'))[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x54efdf['id'][_0x6e70('0x43')](),_0x3cfaa9)['field'](_0x6e70('0x42'),_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')]('cm_contacts')[_0x6e70('0x48')](_0x6e70('0x47'))['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0xb3f06c;}function _0x41a861(_0x10d299,_0x739946){var _0x30cd88=squel['insert']()['into'](_0x6e70('0x50'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3d'),'ListId',_0x739946,'createdAt',_0x6e70('0x3f')],squel[_0x6e70('0x40')]()['field']('phone',_0x6e70('0x23'))['field']('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x10d299['id'][_0x6e70('0x43')](),_0x739946)[_0x6e70('0x41')](_0x6e70('0x42'),'createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0x30cd88;}return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x55'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x82a9a){var _0x515c0c=[];if(_0x82a9a){var _0xce964b;for(var _0x531097=0x0,_0x5b4046;_0x531097<_0x82a9a[_0x6e70('0x1c')];_0x531097+=0x1){_0x5b4046=_0x82a9a[_0x531097][_0x6e70('0x56')]({'plain':!![]});switch(_0x5b4046[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')]['query'](_0x2dafb5(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;default:_0x515c0c['push'](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x5b4046,_0x6e70('0x5b')))['then'](function(){})['catch'](_0x989b80()));}}}return _0x515c0c;})[_0x6e70('0x5f')]()[_0x6e70('0x31')](function(){return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x241a21){var _0x56d4d9=[];if(_0x241a21){var _0x58666a;for(var _0x1c7c5f=0x0,_0xf7a034;_0x1c7c5f<_0x241a21[_0x6e70('0x1c')];_0x1c7c5f+=0x1){_0xf7a034=_0x241a21[_0x1c7c5f][_0x6e70('0x56')]({'plain':!![]});_0x56d4d9[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x41a861(_0xf7a034,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}return _0x56d4d9;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':'Lists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x4b2d40){var _0x5b5471=[];if(_0x4b2d40){for(var _0x402f6f=0x0,_0x48e04b;_0x402f6f<_0x4b2d40['length'];_0x402f6f+=0x1){_0x48e04b=_0x4b2d40[_0x402f6f][_0x6e70('0x56')]({'plain':!![]});switch(_0x48e04b[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x5b5471['push'](db['sequelize']['query'](_0x2dafb5(_0x48e04b,_0x6e70('0x61')))['then'](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x48e04b,_0x6e70('0x61')))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));break;default:_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x48e04b,'CampaignId'))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}}return _0x5b5471;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')][_0x6e70('0x52')]({'attributes':['id'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x62'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x48f6fd){var _0x463eed=[];if(_0x48f6fd){for(var _0x39e6db=0x0,_0x53acc8;_0x39e6db<_0x48f6fd[_0x6e70('0x1c')];_0x39e6db+=0x1){_0x53acc8=_0x48f6fd[_0x39e6db][_0x6e70('0x56')]({'plain':!![]});_0x463eed['push'](db['sequelize'][_0x6e70('0x5e')](_0x41a861(_0x53acc8,'CampaignId'))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));}}return _0x463eed;})[_0x6e70('0x5f')]();})[_0x6e70('0x5c')](function(_0x106f32){logger[_0x6e70('0x16')](_0x6e70('0x63'),_0x6e70('0x64'),_0x106f32[_0x6e70('0x34')]);});}var processPromises=function(_0x5afbf5){return BPromise['all'](promises)[_0x6e70('0x31')](function(_0x4bf451){})[_0x6e70('0x5c')](function(_0xa2a4d5){logger[_0x6e70('0x16')](_0x6e70('0x65'),JSON['stringify'](_0xa2a4d5));})[_0x6e70('0x66')](function(){socket['emit'](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5afbf5){return _0x5afbf5[_0x6e70('0x68')]();}});};var endCsv=function(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(hopperContacts){return checkHopper();}})[_0x6e70('0x31')](function(){socket[_0x6e70('0x6a')](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1d6acf){logger['error'](_0x6e70('0x6b'),JSON['stringify'](_0x1d6acf));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x6e70('0x6c')](_0x6e70('0x6d'));endCsv();});function main(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6e70('0x6e')](',');return db['CmContact'][_0x6e70('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6e70('0x31')](function(_0x48c30c){var _0x3c2d33=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6e70('0x6f')](_0x3c2d33,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d0585,_0x4a87e2){total+=0x1;var _0x25f60c=total;promises[_0x6e70('0x59')](checkRow(_0x5d0585,_0x48c30c,_0x25f60c)[_0x6e70('0x31')](function(){success+=0x1;})[_0x6e70('0x5c')](function(_0x3e6661){if(_0x3e6661[_0x6e70('0x16')]){errors+=0x1;delete _0x3e6661[_0x6e70('0x16')];}else if(_0x3e6661['duplicate']){duplicates+=0x1;delete _0x3e6661[_0x6e70('0x2c')];}rows['push'](_0x3e6661);}));if(total%0xc8===0x0){_0x4a87e2[_0x6e70('0x70')]();return processPromises(_0x4a87e2);}},'complete':function(){return processPromises()[_0x6e70('0x31')](function(){logger[_0x6e70('0x6c')](_0x6e70('0x71'));endCsv();});},'error':function(_0x4764d5,_0x41b7de){logger[_0x6e70('0x6c')]('CSV\x20parse\x20error',JSON[_0x6e70('0x35')](_0x4764d5));endCsv();}});})['catch'](function(_0x27bdf2){logger[_0x6e70('0x16')](_0x6e70('0x72'),JSON[_0x6e70('0x35')](_0x27bdf2));});}main(); \ No newline at end of file +var _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x2b4207,_0x1161eb){var _0x5acc77=function(_0xc9fd13){while(--_0xc9fd13){_0x2b4207['push'](_0x2b4207['shift']());}};_0x5acc77(++_0x1161eb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x56e0e8,_0x16ef91){_0x56e0e8=_0x56e0e8-0x0;var _0x2dab50=_0xcb91[_0x56e0e8];return _0x2dab50;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 309e5ed..1db697c 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['.CmListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','UserId','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','length','all','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header',',utcOffset','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','format','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','insert','into','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x7a54,0x106));var _0x47a5=function(_0x42b16e,_0x25f2b2){_0x42b16e=_0x42b16e-0x0;var _0x5f5cb0=_0x7a54[_0x42b16e];return _0x5f5cb0;};'use strict';var fs=require('fs');var path=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var Papa=require(_0x47a5('0x2'));var util=require('util');var BPromise=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var squel=require('squel');var Redis=require(_0x47a5('0x5'));var db=require(_0x47a5('0x6'))['db'];var config=require(_0x47a5('0x7'));var shared=require(_0x47a5('0x8'));var logger=require(_0x47a5('0x9'))('import');config[_0x47a5('0xa')]=_['defaults'](config[_0x47a5('0xa')],{'host':_0x47a5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x582352){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x47a5('0xc')](_0x582352);}function selectNotIn(_0x2baee7,_0x5e31dd,_0x2eb0dd,_0x49e844,_0x5de6d7){return squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0xf'))[_0x47a5('0x10')](_0x49e844)[_0x47a5('0x11')](_0x5e31dd,null,_0x5e31dd+_0x47a5('0x12')+_0x49e844+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x49e844+'.'+_0x2eb0dd+'\x20=\x20'+_0x2baee7+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x5e31dd+_0x47a5('0x14')+_0x5de6d7[_0x47a5('0x11')]()+')');}function insertCmHopper(_0x711793,_0x139f25,_0x620ee9,_0x3c6c46,_0x190faa){var _0x4e99a8=[_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18'),_0x139f25+'.'+_0x3c6c46,_0x47a5('0x19'),'cm_contacts.updatedAt','cm_contacts.priority',_0x47a5('0x1a'),'\x22'+_0x190faa+'\x22'];return squel['insert']()['into'](_0x47a5('0x1b'))[_0x47a5('0x1c')]([_0x47a5('0xf'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f'),_0x3c6c46,_0x47a5('0x20'),_0x47a5('0x21'),_0x47a5('0x22'),'UserId',_0x47a5('0x23')],squel[_0x47a5('0xd')]()['fields'](_0x4e99a8)[_0x47a5('0x10')](_0x139f25)[_0x47a5('0x11')](_0x47a5('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x139f25+_0x47a5('0x25'))[_0x47a5('0x11')](_0x620ee9,null,_0x620ee9+_0x47a5('0x12')+_0x139f25+'.'+_0x3c6c46)[_0x47a5('0x13')](_0x139f25+'.CmListId\x20=\x20?',_0x711793)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)['where'](_0x47a5('0x27'),selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))[_0x47a5('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,'cm_hopper',[_0x47a5('0x28')])))['toString']();}function insertCmHopperBlack(_0x1ea9c8,_0x5b6c4e,_0x23cb77,_0x378208){var _0x36ad34=[_0x47a5('0x15'),_0x47a5('0x17'),_0x47a5('0x18'),_0x5b6c4e+'.'+_0x378208,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x47a5('0x2d'))[_0x47a5('0x1c')]([_0x47a5('0xf'),'ContactId',_0x47a5('0x1f'),_0x378208,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x36ad34)['from'](_0x5b6c4e)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x5b6c4e+_0x47a5('0x25'))['join'](_0x23cb77,null,_0x23cb77+'.id\x20=\x20'+_0x5b6c4e+'.'+_0x378208)[_0x47a5('0x13')](_0x5b6c4e+_0x47a5('0x30'),_0x1ea9c8)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')]('phone')[_0x47a5('0x10')](_0x47a5('0x2d'))['where']('ListId\x20=\x20?',_0x1ea9c8)[_0x47a5('0x13')](_0x378208+'\x20=\x20?',_0x5b6c4e+'.'+_0x378208)))[_0x47a5('0x31')]();}function insertTzCmHopper(_0x87e4c9,_0xf269a8,_0x52749b,_0x18f7e9,_0x50c086,_0x53c754){var _0x65542e=['cm_contacts.phone',_0x47a5('0x32')+_0x53c754+'.offset-cm_contacts.utcOffset\x20minute)',_0x47a5('0x17'),_0x47a5('0x18'),_0xf269a8+'.'+_0x18f7e9,_0x47a5('0x19'),_0x47a5('0x2a'),_0x47a5('0x33'),_0x47a5('0x1a'),'\x22'+_0x50c086+'\x22'];var _0xee582c=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')]('cm_hopper')[_0x47a5('0x1c')]([_0x47a5('0xf'),'scheduledat',_0x47a5('0x1e'),_0x47a5('0x1f'),_0x18f7e9,_0x47a5('0x20'),'updatedAt',_0x47a5('0x22'),_0x47a5('0x34'),'recallme'],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x65542e)['from'](_0xf269a8)['join']('cm_contacts',null,_0x47a5('0x2f')+_0xf269a8+'.CmListId')[_0x47a5('0x11')](_0x52749b,null,_0x52749b+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x11')](_0x53c754,null,_0x53c754+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x13')](_0xf269a8+_0x47a5('0x30'),_0x87e4c9)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))['where'](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28')])))[_0x47a5('0x31')]();return _0xee582c;}function insertTzCmHopperBlack(_0x586f4f,_0x7de536,_0x528ef3,_0x47c7a2){var _0x55c43d=['cm_contacts.phone',_0x47a5('0x17'),'cm_contacts.ListId',_0x7de536+'.'+_0x47c7a2,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()['into'](_0x47a5('0x2d'))[_0x47a5('0x1c')](['phone','ContactId',_0x47a5('0x1f'),_0x47c7a2,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x55c43d)[_0x47a5('0x10')](_0x7de536)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x7de536+_0x47a5('0x25'))[_0x47a5('0x11')](_0x528ef3,null,_0x528ef3+_0x47a5('0x12')+_0x7de536+'.'+_0x47c7a2)[_0x47a5('0x13')](_0x7de536+_0x47a5('0x30'),_0x586f4f)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')](_0x47a5('0xf'))['from']('cm_hopper_black')[_0x47a5('0x13')]('ListId\x20=\x20?',_0x586f4f)[_0x47a5('0x13')](_0x47c7a2+_0x47a5('0x35'),_0x7de536+'.'+_0x47c7a2)))['toString']();}function insertCmContact(_0x4f62d3,_0x3d85cc,_0x52d409,_0x2d147c){var _0x1d1039=_[_0x47a5('0x36')](_[_0x47a5('0x37')](_0x2d147c),[_0x47a5('0x1f'),_0x47a5('0x38'),_0x47a5('0x20'),'updatedAt']);return squel['insert']()[_0x47a5('0x2c')](_0x47a5('0x24'))[_0x47a5('0x1c')](_0x1d1039,squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x1d1039)[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x13')]('('+_0x52d409['join'](',')+_0x47a5('0x39'),squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x52d409)['from'](_0x47a5('0x24'))['where'](_0x47a5('0x3a'),_0x4f62d3)[_0x47a5('0x13')](_0x47a5('0x3b')))[_0x47a5('0x13')]('id\x20IN\x20?',squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0x3c'),_0x47a5('0x3d'))[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x3e')](_0x52d409[_0x47a5('0x11')](','))))['toString']();}function handleStop(){logger[_0x47a5('0x3f')](_0x47a5('0x40'));stopped=!![];}function handleUncaughtException(_0x187d7e){logger[_0x47a5('0x41')](_0x187d7e[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}function handleError(_0x572233,_0x1ad6a9){stats[_0x47a5('0x44')][_0x47a5('0x45')]({'name':_0x1ad6a9['code'],'message':_0x1ad6a9[_0x47a5('0x42')],'row':_0x572233});}function handleQuery(_0x3c78b7){logger[_0x47a5('0x3f')](_0x3c78b7);return db['sequelize']['query'](_0x3c78b7)[_0x47a5('0x46')](function(_0x376e1d){results['push'](_0x376e1d);})['catch'](function(_0x6d6b2b){logger['error'](_0x6d6b2b[_0x47a5('0x42')]);});}function updateTzCampaigns(_0x5d383d){return new Promise(function(_0x482de6,_0x389ed9){var _0x46d2d3=squel['select']()[_0x47a5('0x2e')]([_0x47a5('0x47'),'campaigns.dialTimezone'])['from'](_0x47a5('0x48'))[_0x47a5('0x11')](_0x47a5('0x49'),null,_0x47a5('0x4a'))['where'](_0x47a5('0x4b')+_0x5d383d);db[_0x47a5('0x4c')][_0x47a5('0x4d')](_0x46d2d3['toString']())[_0x47a5('0x46')](function(_0x4db625){var _0x485e3c=[];for(var _0x470da6=0x0;_0x470da6<_0x4db625[_0x47a5('0x4e')];_0x470da6++){_0x485e3c[_0x47a5('0x45')](getTimezoneData(_0x4db625[_0x470da6],tmp_campaigns));}BPromise[_0x47a5('0x4f')](_0x485e3c)['then'](function(){_0x482de6({'val':0x1});});})[_0x47a5('0x50')](function(_0x5d1550){logger['error'](_0x5d1550['message']);_0x482de6({'val':0x0});});});}function updateTzVoiceQueues(_0x4f8564){return new Promise(function(_0x212d92,_0x6cd4ea){var _0x1e2bb4=squel['select']()['fields']([_0x47a5('0x51'),_0x47a5('0x52')])[_0x47a5('0x10')](_0x47a5('0x53'))[_0x47a5('0x11')]('voice_queues_has_cm_lists',null,_0x47a5('0x54'))['where'](_0x47a5('0x55')+_0x4f8564);db[_0x47a5('0x4c')]['query'](_0x1e2bb4[_0x47a5('0x31')]())[_0x47a5('0x46')](function(_0x132854){var _0x3e8274=[];for(var _0x2d6494=0x0;_0x2d6494<_0x132854[_0x47a5('0x4e')];_0x2d6494++){_0x3e8274[_0x47a5('0x45')](getTimezoneData(_0x132854[_0x2d6494],tmp_voice_queues));}BPromise[_0x47a5('0x4f')](_0x3e8274)['then'](function(){_0x212d92({'val':0x1});});})[_0x47a5('0x50')](function(_0x2a3a57){logger[_0x47a5('0x41')](_0x2a3a57[_0x47a5('0x42')]);_0x212d92({'val':0x0});});});}function getTimezoneData(_0x396cb0,_0x4bbe14){return new Promise(function(_0xbec033,_0xdfcecc){var _0x1224bc=shared[_0x47a5('0x56')];var _0x4228a3=_0x1224bc[_0x396cb0[_0x47a5('0x57')]];if(_[_0x47a5('0x58')](_0x4228a3)){_0xbec033({'ret':0x1});}else{var _0x149d34=_0x4228a3[_0x47a5('0x59')];var _0x44cb90=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x4bbe14)[_0x47a5('0x5a')]('id',_0x396cb0['id'])[_0x47a5('0x5a')](_0x47a5('0x5b'),_0x149d34)['set'](_0x47a5('0x57'),_0x396cb0[_0x47a5('0x57')])[_0x47a5('0x31')]();return db['sequelize'][_0x47a5('0x4d')](_0x44cb90)[_0x47a5('0x46')](function(_0x36c67){_0xbec033({'ret':0x1});})[_0x47a5('0x50')](function(_0x5d9822){logger[_0x47a5('0x41')](_0x5d9822['message']);_0xdfcecc({'ret':0x1});});}});}function handleTZQuery(_0x2d5ee6){logger['info'](_0x2d5ee6);return db[_0x47a5('0x4c')]['query'](_0x2d5ee6)[_0x47a5('0x46')](function(_0x2f27c3){})[_0x47a5('0x50')](function(_0x58473b){logger['error'](_0x58473b['message']);});}function main(_0x4164a3,_0x2b1303,_0xe3c0a7,_0x117510){logger['info'](_0x47a5('0x5c'),_0x4164a3,JSON[_0x47a5('0x5d')](_0x2b1303));process[_0x47a5('0x5e')](_0x47a5('0x5f'));var _0x308c9a=_0x2b1303[_0x47a5('0x60')];var _0x1155f6=_0x2b1303[_0x47a5('0x61')];var _0x4618a0=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),_0x1155f6+'.csv');hasTZ=_[_0x47a5('0x37')](_0x308c9a)['includes'](_0x47a5('0x57'));var _0x2ac30f=_[_0x47a5('0x37')](_0x308c9a)[_0x47a5('0x11')]();logger[_0x47a5('0x3f')](_0x47a5('0x64'),_0x2ac30f);if(hasTZ)_0x2ac30f+=_0x47a5('0x65');fs[_0x47a5('0x66')](_0x4618a0,_0x2ac30f+'\x0a');Papa[_0x47a5('0x67')](fs[_0x47a5('0x68')](_0x4164a3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1cfb37,_0x1f07ac){try{for(var _0x8f0035=0x0,_0x2d434c=[];_0x8f0035<_0x1cfb37[_0x47a5('0x69')]['length'];_0x8f0035++){stats['rows']+=0x1;if(_0x1cfb37['errors'][_0x8f0035]){handleError(_0x1cfb37['data'][_0x8f0035],_0x1cfb37[_0x47a5('0x44')][_0x8f0035]);}else{var _0x28b8e9=[];for(var _0x5d6916 in _0x308c9a){if(_0x308c9a[_0x47a5('0x6a')](_0x5d6916)){if(_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]]){var _0x1baa5a=_[_0x47a5('0x6b')](_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]][_0x47a5('0x6c')](/"/g,'\x27'));switch(_0x5d6916){case _0x47a5('0x1d'):var _0x1c7302=moment(_0x1baa5a,_0x47a5('0x6d'),!![]);if(_0x1c7302[_0x47a5('0x6e')]()){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x6f'));}break;case _0x47a5('0x22'):var _0x420671=parseInt(_0x1baa5a);_0x1baa5a=_['isNaN'](_0x420671)||_0x420671<0x0||_0x420671>0x4?_0x117510?0x3:0x2:_0x420671;_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');break;case _0x47a5('0x34'):var _0x17b61d=parseInt(_0x1baa5a);if(_['isNumber'](_0x17b61d)&&_[_0x47a5('0x70')](_0xe3c0a7,_0x17b61d)){_0x2d434c['push']('\x22'+_0x17b61d+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x71'));}break;case _0x47a5('0x72'):if(isEmail(_0x1baa5a)){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x73'));}break;case _0x47a5('0x74'):var _0x479a82=moment(_0x1baa5a,'YYYY-MM-DD',!![]);if(_0x479a82[_0x47a5('0x6e')]()){_0x2d434c['push']('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x75'));}break;case _0x47a5('0x57'):var _0xb16bdd=shared['timezones'];var _0x3c66e3=_0xb16bdd[_0x1baa5a];if(!_['isNil'](_0x3c66e3)){var _0x5f3a04=_0x3c66e3[_0x47a5('0x59')];_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');_0x2d434c['push']('\x22'+_0x5f3a04+'\x22');}break;default:_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}}else{switch(_0x5d6916){case _0x47a5('0x76'):case _0x47a5('0xf'):_0x28b8e9['push'](_0x5d6916+_0x47a5('0x77'));break;default:_0x2d434c['push']('\x22\x22');}}}}if(_0x28b8e9[_0x47a5('0x4e')]){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x78'),'message':_0x28b8e9['join']()});}else{fs[_0x47a5('0x79')](_0x4618a0,_0x2d434c[_0x47a5('0x11')]()+'\x0a');}_0x2d434c=[];}if(!(stats[_0x47a5('0x7a')]%0xc8)){socket['emit'](_0x47a5('0x7b')+_0x1155f6,stats);stats['errors']=[];}}if(stopped){logger[_0x47a5('0x3f')]('Abort\x20parser');_0x1f07ac[_0x47a5('0x7c')]();}}catch(_0x20d8bd){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x7d'),'message':_0x20d8bd['message']});logger[_0x47a5('0x41')](_0x47a5('0x7e'),_0x20d8bd[_0x47a5('0x42')]);}},'complete':function(){try{var _0x1bbfba=[];var _0x22d84a=[];var _0x57ac25='cm_contacts';if(_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates'][_0x47a5('0x4e')]){_0x57ac25=_0x47a5('0x80')+_0x1155f6;_0x1bbfba[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+_0x57ac25+_0x47a5('0x81'));}tmp_campaigns=_0x47a5('0x82')+_0x1155f6;tmp_voice_queues='voice_queues_'+_0x1155f6;_0x22d84a[_0x47a5('0x45')](_0x47a5('0x83')+tmp_campaigns+_0x47a5('0x84'));_0x22d84a[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x47a5('0x85')](_0x22d84a,handleTZQuery)[_0x47a5('0x86')](function(_0x48e7f3){updateTzCampaigns(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x5a0901){updateTzVoiceQueues(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x2930d9){var _0x59f010=util[_0x47a5('0x87')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4618a0,_0x57ac25,_0x2ac30f,_0x2b1303[_0x47a5('0x1f')],_0x2b1303['CompanyId']||null,NOW,NOW);if(_[_0x47a5('0x58')](_0x308c9a[_0x47a5('0x1d')])){_0x59f010+=',\x20scheduledAt\x20=\x20NOW()';}_0x1bbfba[_0x47a5('0x45')](_0x59f010);if(_0x2b1303['duplicates']&&_0x2b1303[_0x47a5('0x7f')][_0x47a5('0x4e')]){_0x1bbfba[_0x47a5('0x45')](insertCmContact(_0x2b1303[_0x47a5('0x1f')],_0x57ac25,_0x2b1303['duplicates'],_0x308c9a));}if(hasTZ){_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303['ListId'],'voice_queues_has_cm_lists',_0x47a5('0x53'),_0x47a5('0x88'),_0x117510,tmp_voice_queues));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x49'),'campaigns',_0x47a5('0x8a'),_0x117510,tmp_campaigns));_0x1bbfba['push'](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8b'),_0x47a5('0x48'),_0x47a5('0x8a')));}else{_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8c'),_0x47a5('0x53'),_0x47a5('0x88'),_0x117510));_0x1bbfba['push'](insertCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],'campaigns_has_cm_lists','campaigns',_0x47a5('0x8a'),_0x117510));_0x1bbfba[_0x47a5('0x45')](insertCmHopperBlack(_0x2b1303['ListId'],'campaigns_has_cm_blacklists',_0x47a5('0x48'),_0x47a5('0x8a')));}_0x1bbfba['push'](_0x47a5('0x8d')+tmp_campaigns+';');_0x1bbfba[_0x47a5('0x45')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x47a5('0x85')](_0x1bbfba,handleQuery)[_0x47a5('0x86')](function(_0x109805){stats[_0x47a5('0x8e')]=!![];stats[_0x47a5('0x8f')]=_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0x47a5('0x8f')];socket[_0x47a5('0x90')]('contact:import:'+_0x1155f6,stats);fs[_0x47a5('0x91')](_0x4164a3);fs[_0x47a5('0x91')](_0x4618a0);process[_0x47a5('0x43')](0x0);})[_0x47a5('0x50')](function(_0xcdbfd7){logger['error'](_0xcdbfd7[_0x47a5('0x42')]);process['exit'](0x1);});})['catch'](function(_0x5db0ed){logger[_0x47a5('0x41')](_0x5db0ed['message']);process[_0x47a5('0x43')](0x1);});});});}catch(_0xf3edc8){logger[_0x47a5('0x41')]('complete',_0xf3edc8[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}},'error':function(_0x35bf37,_0x121750,_0x392ad7,_0x581a87){throw new Error(_0x581a87);}});}function validate(){if(process[_0x47a5('0x92')]&&process[_0x47a5('0x92')]['length']<0x4){throw new Error(_0x47a5('0x93'));}var _0x419870=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),process[_0x47a5('0x92')][0x2]);if(!fs['existsSync'](_0x419870)){throw new Error(_0x47a5('0x94'));}var _0x2e418d={};try{_0x2e418d=JSON['parse'](process[_0x47a5('0x92')][0x3]);if(!_0x2e418d[_0x47a5('0x60')]){throw new Error(_0x47a5('0x95'));}if(!_0x2e418d[_0x47a5('0x60')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x2e418d['binding']['firstName']){throw new Error(_0x47a5('0x96'));}var _0x27793e=0x0;if(_0x2e418d[_0x47a5('0x60')][_0x47a5('0x34')]){_0x27793e=0x1;}if(!_0x2e418d[_0x47a5('0x1f')]){throw new Error(_0x47a5('0x97'));}}catch(_0xac1f9e){throw new Error(_0x47a5('0x98'));}var _0x4bd164=[];try{_0x4bd164=_[_0x47a5('0x99')](JSON[_0x47a5('0x67')](process[_0x47a5('0x92')][0x4]),'id');}catch(_0x399528){logger['info']('No\x20agent\x20available');}main(_0x419870,_0x2e418d,_0x4bd164,_0x27793e);}validate();process['on'](_0x47a5('0x9a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x7a54=['.CmListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','UserId','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','length','all','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header',',utcOffset','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','format','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','insert','into','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0x7a54,0x106));var _0x47a5=function(_0x27228f,_0x365cf7){_0x27228f=_0x27228f-0x0;var _0xab7fa=_0x7a54[_0x27228f];return _0xab7fa;};'use strict';var fs=require('fs');var path=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var Papa=require(_0x47a5('0x2'));var util=require('util');var BPromise=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var squel=require('squel');var Redis=require(_0x47a5('0x5'));var db=require(_0x47a5('0x6'))['db'];var config=require(_0x47a5('0x7'));var shared=require(_0x47a5('0x8'));var logger=require(_0x47a5('0x9'))('import');config[_0x47a5('0xa')]=_['defaults'](config[_0x47a5('0xa')],{'host':_0x47a5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x582352){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x47a5('0xc')](_0x582352);}function selectNotIn(_0x2baee7,_0x5e31dd,_0x2eb0dd,_0x49e844,_0x5de6d7){return squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0xf'))[_0x47a5('0x10')](_0x49e844)[_0x47a5('0x11')](_0x5e31dd,null,_0x5e31dd+_0x47a5('0x12')+_0x49e844+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x49e844+'.'+_0x2eb0dd+'\x20=\x20'+_0x2baee7+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x5e31dd+_0x47a5('0x14')+_0x5de6d7[_0x47a5('0x11')]()+')');}function insertCmHopper(_0x711793,_0x139f25,_0x620ee9,_0x3c6c46,_0x190faa){var _0x4e99a8=[_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18'),_0x139f25+'.'+_0x3c6c46,_0x47a5('0x19'),'cm_contacts.updatedAt','cm_contacts.priority',_0x47a5('0x1a'),'\x22'+_0x190faa+'\x22'];return squel['insert']()['into'](_0x47a5('0x1b'))[_0x47a5('0x1c')]([_0x47a5('0xf'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f'),_0x3c6c46,_0x47a5('0x20'),_0x47a5('0x21'),_0x47a5('0x22'),'UserId',_0x47a5('0x23')],squel[_0x47a5('0xd')]()['fields'](_0x4e99a8)[_0x47a5('0x10')](_0x139f25)[_0x47a5('0x11')](_0x47a5('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x139f25+_0x47a5('0x25'))[_0x47a5('0x11')](_0x620ee9,null,_0x620ee9+_0x47a5('0x12')+_0x139f25+'.'+_0x3c6c46)[_0x47a5('0x13')](_0x139f25+'.CmListId\x20=\x20?',_0x711793)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)['where'](_0x47a5('0x27'),selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))[_0x47a5('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,'cm_hopper',[_0x47a5('0x28')])))['toString']();}function insertCmHopperBlack(_0x1ea9c8,_0x5b6c4e,_0x23cb77,_0x378208){var _0x36ad34=[_0x47a5('0x15'),_0x47a5('0x17'),_0x47a5('0x18'),_0x5b6c4e+'.'+_0x378208,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x47a5('0x2d'))[_0x47a5('0x1c')]([_0x47a5('0xf'),'ContactId',_0x47a5('0x1f'),_0x378208,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x36ad34)['from'](_0x5b6c4e)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x5b6c4e+_0x47a5('0x25'))['join'](_0x23cb77,null,_0x23cb77+'.id\x20=\x20'+_0x5b6c4e+'.'+_0x378208)[_0x47a5('0x13')](_0x5b6c4e+_0x47a5('0x30'),_0x1ea9c8)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')]('phone')[_0x47a5('0x10')](_0x47a5('0x2d'))['where']('ListId\x20=\x20?',_0x1ea9c8)[_0x47a5('0x13')](_0x378208+'\x20=\x20?',_0x5b6c4e+'.'+_0x378208)))[_0x47a5('0x31')]();}function insertTzCmHopper(_0x87e4c9,_0xf269a8,_0x52749b,_0x18f7e9,_0x50c086,_0x53c754){var _0x65542e=['cm_contacts.phone',_0x47a5('0x32')+_0x53c754+'.offset-cm_contacts.utcOffset\x20minute)',_0x47a5('0x17'),_0x47a5('0x18'),_0xf269a8+'.'+_0x18f7e9,_0x47a5('0x19'),_0x47a5('0x2a'),_0x47a5('0x33'),_0x47a5('0x1a'),'\x22'+_0x50c086+'\x22'];var _0xee582c=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')]('cm_hopper')[_0x47a5('0x1c')]([_0x47a5('0xf'),'scheduledat',_0x47a5('0x1e'),_0x47a5('0x1f'),_0x18f7e9,_0x47a5('0x20'),'updatedAt',_0x47a5('0x22'),_0x47a5('0x34'),'recallme'],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x65542e)['from'](_0xf269a8)['join']('cm_contacts',null,_0x47a5('0x2f')+_0xf269a8+'.CmListId')[_0x47a5('0x11')](_0x52749b,null,_0x52749b+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x11')](_0x53c754,null,_0x53c754+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x13')](_0xf269a8+_0x47a5('0x30'),_0x87e4c9)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))['where'](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28')])))[_0x47a5('0x31')]();return _0xee582c;}function insertTzCmHopperBlack(_0x586f4f,_0x7de536,_0x528ef3,_0x47c7a2){var _0x55c43d=['cm_contacts.phone',_0x47a5('0x17'),'cm_contacts.ListId',_0x7de536+'.'+_0x47c7a2,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()['into'](_0x47a5('0x2d'))[_0x47a5('0x1c')](['phone','ContactId',_0x47a5('0x1f'),_0x47c7a2,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x55c43d)[_0x47a5('0x10')](_0x7de536)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x7de536+_0x47a5('0x25'))[_0x47a5('0x11')](_0x528ef3,null,_0x528ef3+_0x47a5('0x12')+_0x7de536+'.'+_0x47c7a2)[_0x47a5('0x13')](_0x7de536+_0x47a5('0x30'),_0x586f4f)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')](_0x47a5('0xf'))['from']('cm_hopper_black')[_0x47a5('0x13')]('ListId\x20=\x20?',_0x586f4f)[_0x47a5('0x13')](_0x47c7a2+_0x47a5('0x35'),_0x7de536+'.'+_0x47c7a2)))['toString']();}function insertCmContact(_0x4f62d3,_0x3d85cc,_0x52d409,_0x2d147c){var _0x1d1039=_[_0x47a5('0x36')](_[_0x47a5('0x37')](_0x2d147c),[_0x47a5('0x1f'),_0x47a5('0x38'),_0x47a5('0x20'),'updatedAt']);return squel['insert']()[_0x47a5('0x2c')](_0x47a5('0x24'))[_0x47a5('0x1c')](_0x1d1039,squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x1d1039)[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x13')]('('+_0x52d409['join'](',')+_0x47a5('0x39'),squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x52d409)['from'](_0x47a5('0x24'))['where'](_0x47a5('0x3a'),_0x4f62d3)[_0x47a5('0x13')](_0x47a5('0x3b')))[_0x47a5('0x13')]('id\x20IN\x20?',squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0x3c'),_0x47a5('0x3d'))[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x3e')](_0x52d409[_0x47a5('0x11')](','))))['toString']();}function handleStop(){logger[_0x47a5('0x3f')](_0x47a5('0x40'));stopped=!![];}function handleUncaughtException(_0x187d7e){logger[_0x47a5('0x41')](_0x187d7e[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}function handleError(_0x572233,_0x1ad6a9){stats[_0x47a5('0x44')][_0x47a5('0x45')]({'name':_0x1ad6a9['code'],'message':_0x1ad6a9[_0x47a5('0x42')],'row':_0x572233});}function handleQuery(_0x3c78b7){logger[_0x47a5('0x3f')](_0x3c78b7);return db['sequelize']['query'](_0x3c78b7)[_0x47a5('0x46')](function(_0x376e1d){results['push'](_0x376e1d);})['catch'](function(_0x6d6b2b){logger['error'](_0x6d6b2b[_0x47a5('0x42')]);});}function updateTzCampaigns(_0x5d383d){return new Promise(function(_0x482de6,_0x389ed9){var _0x46d2d3=squel['select']()[_0x47a5('0x2e')]([_0x47a5('0x47'),'campaigns.dialTimezone'])['from'](_0x47a5('0x48'))[_0x47a5('0x11')](_0x47a5('0x49'),null,_0x47a5('0x4a'))['where'](_0x47a5('0x4b')+_0x5d383d);db[_0x47a5('0x4c')][_0x47a5('0x4d')](_0x46d2d3['toString']())[_0x47a5('0x46')](function(_0x4db625){var _0x485e3c=[];for(var _0x470da6=0x0;_0x470da6<_0x4db625[_0x47a5('0x4e')];_0x470da6++){_0x485e3c[_0x47a5('0x45')](getTimezoneData(_0x4db625[_0x470da6],tmp_campaigns));}BPromise[_0x47a5('0x4f')](_0x485e3c)['then'](function(){_0x482de6({'val':0x1});});})[_0x47a5('0x50')](function(_0x5d1550){logger['error'](_0x5d1550['message']);_0x482de6({'val':0x0});});});}function updateTzVoiceQueues(_0x4f8564){return new Promise(function(_0x212d92,_0x6cd4ea){var _0x1e2bb4=squel['select']()['fields']([_0x47a5('0x51'),_0x47a5('0x52')])[_0x47a5('0x10')](_0x47a5('0x53'))[_0x47a5('0x11')]('voice_queues_has_cm_lists',null,_0x47a5('0x54'))['where'](_0x47a5('0x55')+_0x4f8564);db[_0x47a5('0x4c')]['query'](_0x1e2bb4[_0x47a5('0x31')]())[_0x47a5('0x46')](function(_0x132854){var _0x3e8274=[];for(var _0x2d6494=0x0;_0x2d6494<_0x132854[_0x47a5('0x4e')];_0x2d6494++){_0x3e8274[_0x47a5('0x45')](getTimezoneData(_0x132854[_0x2d6494],tmp_voice_queues));}BPromise[_0x47a5('0x4f')](_0x3e8274)['then'](function(){_0x212d92({'val':0x1});});})[_0x47a5('0x50')](function(_0x2a3a57){logger[_0x47a5('0x41')](_0x2a3a57[_0x47a5('0x42')]);_0x212d92({'val':0x0});});});}function getTimezoneData(_0x396cb0,_0x4bbe14){return new Promise(function(_0xbec033,_0xdfcecc){var _0x1224bc=shared[_0x47a5('0x56')];var _0x4228a3=_0x1224bc[_0x396cb0[_0x47a5('0x57')]];if(_[_0x47a5('0x58')](_0x4228a3)){_0xbec033({'ret':0x1});}else{var _0x149d34=_0x4228a3[_0x47a5('0x59')];var _0x44cb90=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x4bbe14)[_0x47a5('0x5a')]('id',_0x396cb0['id'])[_0x47a5('0x5a')](_0x47a5('0x5b'),_0x149d34)['set'](_0x47a5('0x57'),_0x396cb0[_0x47a5('0x57')])[_0x47a5('0x31')]();return db['sequelize'][_0x47a5('0x4d')](_0x44cb90)[_0x47a5('0x46')](function(_0x36c67){_0xbec033({'ret':0x1});})[_0x47a5('0x50')](function(_0x5d9822){logger[_0x47a5('0x41')](_0x5d9822['message']);_0xdfcecc({'ret':0x1});});}});}function handleTZQuery(_0x2d5ee6){logger['info'](_0x2d5ee6);return db[_0x47a5('0x4c')]['query'](_0x2d5ee6)[_0x47a5('0x46')](function(_0x2f27c3){})[_0x47a5('0x50')](function(_0x58473b){logger['error'](_0x58473b['message']);});}function main(_0x4164a3,_0x2b1303,_0xe3c0a7,_0x117510){logger['info'](_0x47a5('0x5c'),_0x4164a3,JSON[_0x47a5('0x5d')](_0x2b1303));process[_0x47a5('0x5e')](_0x47a5('0x5f'));var _0x308c9a=_0x2b1303[_0x47a5('0x60')];var _0x1155f6=_0x2b1303[_0x47a5('0x61')];var _0x4618a0=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),_0x1155f6+'.csv');hasTZ=_[_0x47a5('0x37')](_0x308c9a)['includes'](_0x47a5('0x57'));var _0x2ac30f=_[_0x47a5('0x37')](_0x308c9a)[_0x47a5('0x11')]();logger[_0x47a5('0x3f')](_0x47a5('0x64'),_0x2ac30f);if(hasTZ)_0x2ac30f+=_0x47a5('0x65');fs[_0x47a5('0x66')](_0x4618a0,_0x2ac30f+'\x0a');Papa[_0x47a5('0x67')](fs[_0x47a5('0x68')](_0x4164a3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1cfb37,_0x1f07ac){try{for(var _0x8f0035=0x0,_0x2d434c=[];_0x8f0035<_0x1cfb37[_0x47a5('0x69')]['length'];_0x8f0035++){stats['rows']+=0x1;if(_0x1cfb37['errors'][_0x8f0035]){handleError(_0x1cfb37['data'][_0x8f0035],_0x1cfb37[_0x47a5('0x44')][_0x8f0035]);}else{var _0x28b8e9=[];for(var _0x5d6916 in _0x308c9a){if(_0x308c9a[_0x47a5('0x6a')](_0x5d6916)){if(_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]]){var _0x1baa5a=_[_0x47a5('0x6b')](_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]][_0x47a5('0x6c')](/"/g,'\x27'));switch(_0x5d6916){case _0x47a5('0x1d'):var _0x1c7302=moment(_0x1baa5a,_0x47a5('0x6d'),!![]);if(_0x1c7302[_0x47a5('0x6e')]()){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x6f'));}break;case _0x47a5('0x22'):var _0x420671=parseInt(_0x1baa5a);_0x1baa5a=_['isNaN'](_0x420671)||_0x420671<0x0||_0x420671>0x4?_0x117510?0x3:0x2:_0x420671;_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');break;case _0x47a5('0x34'):var _0x17b61d=parseInt(_0x1baa5a);if(_['isNumber'](_0x17b61d)&&_[_0x47a5('0x70')](_0xe3c0a7,_0x17b61d)){_0x2d434c['push']('\x22'+_0x17b61d+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x71'));}break;case _0x47a5('0x72'):if(isEmail(_0x1baa5a)){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x73'));}break;case _0x47a5('0x74'):var _0x479a82=moment(_0x1baa5a,'YYYY-MM-DD',!![]);if(_0x479a82[_0x47a5('0x6e')]()){_0x2d434c['push']('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x75'));}break;case _0x47a5('0x57'):var _0xb16bdd=shared['timezones'];var _0x3c66e3=_0xb16bdd[_0x1baa5a];if(!_['isNil'](_0x3c66e3)){var _0x5f3a04=_0x3c66e3[_0x47a5('0x59')];_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');_0x2d434c['push']('\x22'+_0x5f3a04+'\x22');}break;default:_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}}else{switch(_0x5d6916){case _0x47a5('0x76'):case _0x47a5('0xf'):_0x28b8e9['push'](_0x5d6916+_0x47a5('0x77'));break;default:_0x2d434c['push']('\x22\x22');}}}}if(_0x28b8e9[_0x47a5('0x4e')]){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x78'),'message':_0x28b8e9['join']()});}else{fs[_0x47a5('0x79')](_0x4618a0,_0x2d434c[_0x47a5('0x11')]()+'\x0a');}_0x2d434c=[];}if(!(stats[_0x47a5('0x7a')]%0xc8)){socket['emit'](_0x47a5('0x7b')+_0x1155f6,stats);stats['errors']=[];}}if(stopped){logger[_0x47a5('0x3f')]('Abort\x20parser');_0x1f07ac[_0x47a5('0x7c')]();}}catch(_0x20d8bd){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x7d'),'message':_0x20d8bd['message']});logger[_0x47a5('0x41')](_0x47a5('0x7e'),_0x20d8bd[_0x47a5('0x42')]);}},'complete':function(){try{var _0x1bbfba=[];var _0x22d84a=[];var _0x57ac25='cm_contacts';if(_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates'][_0x47a5('0x4e')]){_0x57ac25=_0x47a5('0x80')+_0x1155f6;_0x1bbfba[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+_0x57ac25+_0x47a5('0x81'));}tmp_campaigns=_0x47a5('0x82')+_0x1155f6;tmp_voice_queues='voice_queues_'+_0x1155f6;_0x22d84a[_0x47a5('0x45')](_0x47a5('0x83')+tmp_campaigns+_0x47a5('0x84'));_0x22d84a[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x47a5('0x85')](_0x22d84a,handleTZQuery)[_0x47a5('0x86')](function(_0x48e7f3){updateTzCampaigns(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x5a0901){updateTzVoiceQueues(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x2930d9){var _0x59f010=util[_0x47a5('0x87')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4618a0,_0x57ac25,_0x2ac30f,_0x2b1303[_0x47a5('0x1f')],_0x2b1303['CompanyId']||null,NOW,NOW);if(_[_0x47a5('0x58')](_0x308c9a[_0x47a5('0x1d')])){_0x59f010+=',\x20scheduledAt\x20=\x20NOW()';}_0x1bbfba[_0x47a5('0x45')](_0x59f010);if(_0x2b1303['duplicates']&&_0x2b1303[_0x47a5('0x7f')][_0x47a5('0x4e')]){_0x1bbfba[_0x47a5('0x45')](insertCmContact(_0x2b1303[_0x47a5('0x1f')],_0x57ac25,_0x2b1303['duplicates'],_0x308c9a));}if(hasTZ){_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303['ListId'],'voice_queues_has_cm_lists',_0x47a5('0x53'),_0x47a5('0x88'),_0x117510,tmp_voice_queues));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x49'),'campaigns',_0x47a5('0x8a'),_0x117510,tmp_campaigns));_0x1bbfba['push'](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8b'),_0x47a5('0x48'),_0x47a5('0x8a')));}else{_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8c'),_0x47a5('0x53'),_0x47a5('0x88'),_0x117510));_0x1bbfba['push'](insertCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],'campaigns_has_cm_lists','campaigns',_0x47a5('0x8a'),_0x117510));_0x1bbfba[_0x47a5('0x45')](insertCmHopperBlack(_0x2b1303['ListId'],'campaigns_has_cm_blacklists',_0x47a5('0x48'),_0x47a5('0x8a')));}_0x1bbfba['push'](_0x47a5('0x8d')+tmp_campaigns+';');_0x1bbfba[_0x47a5('0x45')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x47a5('0x85')](_0x1bbfba,handleQuery)[_0x47a5('0x86')](function(_0x109805){stats[_0x47a5('0x8e')]=!![];stats[_0x47a5('0x8f')]=_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0x47a5('0x8f')];socket[_0x47a5('0x90')]('contact:import:'+_0x1155f6,stats);fs[_0x47a5('0x91')](_0x4164a3);fs[_0x47a5('0x91')](_0x4618a0);process[_0x47a5('0x43')](0x0);})[_0x47a5('0x50')](function(_0xcdbfd7){logger['error'](_0xcdbfd7[_0x47a5('0x42')]);process['exit'](0x1);});})['catch'](function(_0x5db0ed){logger[_0x47a5('0x41')](_0x5db0ed['message']);process[_0x47a5('0x43')](0x1);});});});}catch(_0xf3edc8){logger[_0x47a5('0x41')]('complete',_0xf3edc8[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}},'error':function(_0x35bf37,_0x121750,_0x392ad7,_0x581a87){throw new Error(_0x581a87);}});}function validate(){if(process[_0x47a5('0x92')]&&process[_0x47a5('0x92')]['length']<0x4){throw new Error(_0x47a5('0x93'));}var _0x419870=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),process[_0x47a5('0x92')][0x2]);if(!fs['existsSync'](_0x419870)){throw new Error(_0x47a5('0x94'));}var _0x2e418d={};try{_0x2e418d=JSON['parse'](process[_0x47a5('0x92')][0x3]);if(!_0x2e418d[_0x47a5('0x60')]){throw new Error(_0x47a5('0x95'));}if(!_0x2e418d[_0x47a5('0x60')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x2e418d['binding']['firstName']){throw new Error(_0x47a5('0x96'));}var _0x27793e=0x0;if(_0x2e418d[_0x47a5('0x60')][_0x47a5('0x34')]){_0x27793e=0x1;}if(!_0x2e418d[_0x47a5('0x1f')]){throw new Error(_0x47a5('0x97'));}}catch(_0xac1f9e){throw new Error(_0x47a5('0x98'));}var _0x4bd164=[];try{_0x4bd164=_[_0x47a5('0x99')](JSON[_0x47a5('0x67')](process[_0x47a5('0x92')][0x4]),'id');}catch(_0x399528){logger['info']('No\x20agent\x20available');}main(_0x419870,_0x2e418d,_0x4bd164,_0x27793e);}validate();process['on'](_0x47a5('0x9a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 105eda2..c7e8f35 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1072=['ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','ListId','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','exit','errors','code','query','catch','main','stringify','send','start','binding','clone','root','server/files/tmp','body','ContactItemType','findAll','name','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','scheduledat','isValid','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','orderBy','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','field','phone','from','where','\x20=\x20','join','sequelize','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','all','then','error','message','length','push','split','CmContactHasItem','findOne','update','updated','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','ContactId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','fromQuery','.CmListId','.CmListId\x20=\x20?','cm_hopper_black'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x1072,0x195));var _0x2107=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x1072[_0xac151d];return _0x111dba;};'use strict';var fs=require('fs');var path=require(_0x2107('0x0'));var _=require(_0x2107('0x1'));var Papa=require(_0x2107('0x2'));var util=require(_0x2107('0x3'));var BPromise=require(_0x2107('0x4'));var moment=require(_0x2107('0x5'));var squel=require('squel');var Redis=require(_0x2107('0x6'));var db=require(_0x2107('0x7'))['db'];var config=require(_0x2107('0x8'));var logger=require('../../../config/logger')(_0x2107('0x9'));config[_0x2107('0xa')]=_[_0x2107('0xb')](config[_0x2107('0xa')],{'host':_0x2107('0xc'),'port':0x18eb});var socket=require(_0x2107('0xd'))(new Redis(config[_0x2107('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x2107('0xe'));var tempTableName=_0x2107('0xf')+moment()[_0x2107('0x10')](_0x2107('0x11'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x2e6e38){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))*$/[_0x2107('0x12')](_0x2e6e38);}function selectNotIn(_0x326de0,_0x825073,_0x2ddfa4,_0x23f696,_0x367f4b){return squel['select']()[_0x2107('0x13')](_0x2107('0x14'))[_0x2107('0x15')](_0x23f696)['join'](_0x825073,null,_0x825073+'.id\x20=\x20'+_0x23f696+'.'+_0x2ddfa4)[_0x2107('0x16')](_0x23f696+'.'+_0x2ddfa4+_0x2107('0x17')+_0x326de0+'.'+_0x2ddfa4)[_0x2107('0x16')](_0x825073+'.dialCheckDuplicateType\x20IN\x20('+_0x367f4b[_0x2107('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1c0d05,_0x3673df){promisesAdditionalPhones=[];promisesContact=[];return db[_0x2107('0x19')]['query'](_0x2107('0x1a')+tempTableName)[_0x2107('0x1b')](function(_0x5a2114){if(_0x5a2114!==null){var _0x81a966=[];for(var _0x7743a4=0x0;_0x7743a4<_0x5a2114['length'];_0x7743a4++){var _0x3ee7e5=_0x5a2114[_0x7743a4];if(!_[_0x2107('0x1c')](_0x3ee7e5[_0x2107('0x14')])){if(!_['isNil'](_0x3ee7e5[_0x2107('0x1d')]))_0x81a966['push'](insertAdditionalPhones(_0x3ee7e5));promisesContact['push']({'contact':_0x3ee7e5});}}}Promise[_0x2107('0x1e')](_0x81a966)[_0x2107('0x1f')](function(){_0x1c0d05({'val':0x1});});})['catch'](function(_0xec5118){logger[_0x2107('0x20')](_0xec5118[_0x2107('0x21')]);});});}function insertAdditionalPhones(_0x3bcaea){return new Promise(function(_0x80f7c3,_0x49d4c1){var _0xd4864f=_0x3bcaea['AdditionalPhones'];if(_[_0x2107('0x1c')](_0xd4864f))_0x49d4c1({'val':0x0});else{var _0x2463a6=_0xd4864f['split'](';');var _0x2200e9=[];orderBy=0x0;for(var _0x13ef54=0x0;_0x13ef54<_0x2463a6[_0x2107('0x22')];_0x13ef54++){_0x2200e9[_0x2107('0x23')](splitAdditionalPhone(_0x3bcaea['id'],_0x2463a6[_0x13ef54]));}Promise['all'](_0x2200e9)[_0x2107('0x1f')](function(){_0x80f7c3({'val':_0x2463a6['length']});});}});}function splitAdditionalPhone(_0x152341,_0x511d16){return new Promise(function(_0x1cdf65,_0x222f24){var _0x4ab383=_0x511d16[_0x2107('0x24')](':');var _0x2be724=_0x4ab383[0x0];var _0x3acd15=_0x4ab383[0x1];if(_0x3acd15!==''){var _0xecea64=_0x3acd15[_0x2107('0x24')]('|');var _0x66e58f=[];for(var _0x22bf6=0x0;_0x22bf6<_0xecea64['length'];_0x22bf6++){if(_0xecea64[_0x22bf6]!==''){var _0x164eae=_['filter'](promisesAdditionalPhones,{'contactId':_0x152341,'phone':_0xecea64[_0x22bf6]});if(_0x164eae['length']==0x0){orderBy++;promisesAdditionalPhones[_0x2107('0x23')]({'contactId':_0x152341,'contactTypeId':_0x2be724,'phone':_0xecea64[_0x22bf6],'orderBy':orderBy});}}}_0x1cdf65({'ok':0x1});}else _0x1cdf65({'res':0x0});});}function createAdditionalPhone(_0x56fb86,_0x144a64,_0x382b3b,_0xbe4f64){return new Promise(function(_0x13b2ad,_0x58e757){return db[_0x2107('0x25')][_0x2107('0x26')]({'where':{'CmContactId':_0x56fb86,'item':_0x382b3b}})['then'](function(_0x320d1e){if(_0x320d1e){return db['CmContactHasItem'][_0x2107('0x27')]({'ItemTypeId':_0x144a64,'OrderBy':_0xbe4f64},{'where':{'CmContactId':_0x56fb86,'item':_0x382b3b}})[_0x2107('0x1f')](function(_0xf96879){_0x13b2ad({'res':_0x2107('0x28')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x56fb86,'item':_0x382b3b,'ItemTypeId':_0x144a64,'OrderBy':_0xbe4f64,'ItemClass':'PHONE'})['then'](function(_0x1a396f){_0x13b2ad({'res':'inserted'});});}});});}function updateContact(_0x59e2d4){return new Promise(function(_0x4435e6,_0x24c240){var _0x51b690=_0x59e2d4['id'];delete _0x59e2d4['id'];return db[_0x2107('0x29')][_0x2107('0x27')](_0x59e2d4,{'where':{'id':_0x51b690}})[_0x2107('0x1f')](function(_0x560dc5){updatedRows+=0x1;return db[_0x2107('0x2a')][_0x2107('0x27')]({'phone':_0x59e2d4[_0x2107('0x14')]},{'where':{'ContactId':_0x51b690}})[_0x2107('0x1f')](function(_0x1fd90e){_0x4435e6({'ret':'OK'});});});});}function insertCmHopper(_0x383d7e,_0x43234d,_0x2c5246,_0xd51f04,_0x389cd0){var _0x42c626=[_0x2107('0x2b'),_0x2107('0x2c'),_0x2107('0x2d'),_0x2107('0x2e'),_0x43234d+'.'+_0xd51f04,'cm_contacts.createdAt',_0x2107('0x2f'),'cm_contacts.priority',_0x2107('0x30'),'\x22'+_0x389cd0+'\x22'];return squel[_0x2107('0x31')]()[_0x2107('0x32')](_0x2107('0x33'))['fromQuery'](['phone','scheduledat',_0x2107('0x34'),'ListId',_0xd51f04,_0x2107('0x35'),_0x2107('0x36'),_0x2107('0x37'),_0x2107('0x38'),_0x2107('0x39')],squel[_0x2107('0x3a')]()[_0x2107('0x3b')](_0x42c626)[_0x2107('0x15')](_0x43234d)[_0x2107('0x18')](_0x2107('0x3c'),null,_0x2107('0x3d')+_0x43234d+'.CmListId')[_0x2107('0x18')](_0x2c5246,null,_0x2c5246+_0x2107('0x3e')+_0x43234d+'.'+_0xd51f04)[_0x2107('0x16')](_0x43234d+'.CmListId\x20=\x20?',_0x383d7e)['where'](_0x2107('0x3f'),NOW)['where'](_0x2107('0x40'),selectNotIn(_0x43234d,_0x2c5246,_0xd51f04,'cm_hopper',[_0x2107('0x41'),_0x2107('0x42')]))[_0x2107('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x43234d,_0x2c5246,_0xd51f04,_0x2107('0x33'),['\x22always\x22'])))[_0x2107('0x43')]();}function insertCmHopperBlack(_0x77af13,_0x47d77e,_0xcbac11,_0x14e19f){var _0x133690=[_0x2107('0x2b'),_0x2107('0x2d'),_0x2107('0x2e'),_0x47d77e+'.'+_0x14e19f,'cm_contacts.createdAt',_0x2107('0x2f')];return squel[_0x2107('0x31')]()['into']('cm_hopper_black')[_0x2107('0x44')]([_0x2107('0x14'),_0x2107('0x34'),'ListId',_0x14e19f,'createdAt','updatedAt'],squel[_0x2107('0x3a')]()[_0x2107('0x3b')](_0x133690)[_0x2107('0x15')](_0x47d77e)[_0x2107('0x18')](_0x2107('0x3c'),null,_0x2107('0x3d')+_0x47d77e+_0x2107('0x45'))[_0x2107('0x18')](_0xcbac11,null,_0xcbac11+_0x2107('0x3e')+_0x47d77e+'.'+_0x14e19f)[_0x2107('0x16')](_0x47d77e+_0x2107('0x46'),_0x77af13)[_0x2107('0x16')](_0x2107('0x3f'),NOW)[_0x2107('0x16')](_0x2107('0x40'),squel[_0x2107('0x3a')]()[_0x2107('0x13')]('phone')['from'](_0x2107('0x47'))['where'](_0x2107('0x48'),_0x77af13)[_0x2107('0x16')](_0x14e19f+_0x2107('0x49'),_0x47d77e+'.'+_0x14e19f)))[_0x2107('0x43')]();}function insertCmHopperAdditionalPhones(_0x1395c4){var _0x48c536=[_0x2107('0x4a'),_0x2107('0x4b'),_0x2107('0x4c'),_0x2107('0x4d'),_0x2107('0x4e')];return squel['insert']()['into'](_0x2107('0x4f'))[_0x2107('0x44')](['CmHopperId',_0x2107('0x14'),_0x2107('0x50'),_0x2107('0x35'),_0x2107('0x36')],squel['select']()['fields'](_0x48c536)['from']('cm_hopper')[_0x2107('0x18')]('cm_contacts',null,_0x2107('0x51'))[_0x2107('0x18')](_0x2107('0x52'),null,_0x2107('0x53'))[_0x2107('0x16')](_0x2107('0x54'),_0x1395c4)[_0x2107('0x16')](_0x2107('0x3f'),NOW))[_0x2107('0x43')]();}function insertCmContact(_0x579863,_0x4b1ae5,_0x221de9,_0x326b3b){var _0x2929a1=_[_0x2107('0x55')](_[_0x2107('0x56')](_0x326b3b),[_0x2107('0x57'),_0x2107('0x58'),'createdAt',_0x2107('0x36')]);return squel[_0x2107('0x31')]()[_0x2107('0x32')](_0x2107('0x3c'))['fromQuery'](_0x2929a1,squel[_0x2107('0x3a')]()[_0x2107('0x3b')](_0x2929a1)[_0x2107('0x15')](_0x4b1ae5)[_0x2107('0x16')]('('+_0x221de9[_0x2107('0x18')](',')+_0x2107('0x59'),squel['select']()[_0x2107('0x3b')](_0x221de9)[_0x2107('0x15')](_0x2107('0x3c'))['where'](_0x2107('0x48'),_0x579863))['where'](_0x2107('0x5a'),squel[_0x2107('0x3a')]()['field'](_0x2107('0x5b'),_0x2107('0x5c'))[_0x2107('0x15')](_0x4b1ae5)[_0x2107('0x5d')](_0x221de9[_0x2107('0x18')](','))))['toString']();}function handleStop(){logger[_0x2107('0x5e')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x19b395){logger['error'](_0x19b395[_0x2107('0x21')]);process[_0x2107('0x5f')](0x1);}function handleError(_0x5db1bc,_0x590125){stats[_0x2107('0x60')]['push']({'name':_0x590125[_0x2107('0x61')],'message':_0x590125[_0x2107('0x21')],'row':_0x5db1bc});}function handleQuery(_0x15c532){logger[_0x2107('0x5e')](_0x15c532);return db[_0x2107('0x19')][_0x2107('0x62')](_0x15c532)[_0x2107('0x1b')](function(_0x13cee7){results[_0x2107('0x23')](_0x13cee7);})[_0x2107('0x63')](function(_0x209fd5){logger[_0x2107('0x20')](_0x209fd5[_0x2107('0x21')]);});}function main(_0x200789,_0xa6d945,_0x2132bb,_0x3d45af){logger['info'](_0x2107('0x64'),_0x200789,JSON[_0x2107('0x65')](_0xa6d945));process[_0x2107('0x66')](_0x2107('0x67'));var _0x32287d=_0xa6d945[_0x2107('0x68')];var _0xbc0347=_[_0x2107('0x69')](_0x32287d);var _0x1748c3=_0xa6d945['socket_timestamp'];var _0xf6d358=path[_0x2107('0x18')](config[_0x2107('0x6a')],_0x2107('0x6b'),_0x1748c3+'.csv');logger[_0x2107('0x5e')](_0x2107('0x6c'),_0xa6d945);db[_0x2107('0x6d')][_0x2107('0x6e')]({'raw':!![],'attributes':['id',_0x2107('0x6f')]})['then'](function(_0x110220){for(var _0x42e73c=0x0;_0x42e73c<_0x110220['length'];_0x42e73c++){if(_0x110220[_0x42e73c]['name']in _0x32287d){contactItemTypes[_0x2107('0x23')](_0x110220[_0x42e73c]);delete _0xbc0347[_0x110220[_0x42e73c][_0x2107('0x6f')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0xbc0347[_0x2107('0x1d')]='';var _0x5cde90=_[_0x2107('0x56')](_0xbc0347)[_0x2107('0x18')]();logger[_0x2107('0x5e')](_0x2107('0x70'),_0x5cde90);fs[_0x2107('0x71')](_0xf6d358,_0x5cde90+'\x0a');Papa[_0x2107('0x72')](fs[_0x2107('0x73')](_0x200789),{'header':!![],'skipEmptyLines':!![],'step':function(_0xf07c88,_0x418ffd){try{for(var _0x341a78=0x0,_0x2c6828=[];_0x341a78<_0xf07c88[_0x2107('0x74')][_0x2107('0x22')];_0x341a78++){stats[_0x2107('0x75')]+=0x1;if(_0xf07c88[_0x2107('0x60')][_0x341a78]){handleError(_0xf07c88[_0x2107('0x74')][_0x341a78],_0xf07c88[_0x2107('0x60')][_0x341a78]);}else{var _0xee2c4d=[];var _0x2c5240=[];for(var _0x27a82a in _0x32287d){let _0x51c0b1=contactItemTypes[_0x2107('0x76')](_0x4c730f=>_0x4c730f['name']===_0x27a82a);if(_[_0x2107('0x1c')](_0x51c0b1)){if(_0x32287d[_0x2107('0x77')](_0x27a82a)){if(_0xf07c88[_0x2107('0x74')][_0x341a78][_0x32287d[_0x27a82a]]){var _0x57c7c5=_[_0x2107('0x78')](_0xf07c88[_0x2107('0x74')][_0x341a78][_0x32287d[_0x27a82a]][_0x2107('0x79')](/"/g,'\x27'));switch(_0x27a82a){case _0x2107('0x7a'):var _0x309cb0=moment(_0x57c7c5,_0x2107('0xe'),!![]);if(_0x309cb0[_0x2107('0x7b')]()){_0x2c6828[_0x2107('0x23')]('\x22'+_0x57c7c5+'\x22');}else{_0xee2c4d['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x2107('0x37'):var _0x2d4789=parseInt(_0x57c7c5);_0x57c7c5=_['isNaN'](_0x2d4789)||_0x2d4789<0x0||_0x2d4789>0x4?_0x3d45af?0x3:0x2:_0x2d4789;_0x2c6828[_0x2107('0x23')]('\x22'+_0x57c7c5+'\x22');break;case _0x2107('0x38'):var _0x97b6a4=parseInt(_0x57c7c5);if(_[_0x2107('0x7c')](_0x97b6a4)&&_[_0x2107('0x7d')](_0x2132bb,_0x97b6a4)){_0x2c6828['push']('\x22'+_0x97b6a4+'\x22');}else{_0xee2c4d[_0x2107('0x23')](_0x2107('0x7e'));}break;case _0x2107('0x7f'):if(isEmail(_0x57c7c5)){_0x2c6828['push']('\x22'+_0x57c7c5+'\x22');}else{_0xee2c4d[_0x2107('0x23')](_0x2107('0x80'));}break;case _0x2107('0x81'):var _0x33f4d6=moment(_0x57c7c5,_0x2107('0x82'),!![]);if(_0x33f4d6[_0x2107('0x7b')]()){_0x2c6828['push']('\x22'+_0x57c7c5+'\x22');}else{_0xee2c4d[_0x2107('0x23')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x2c6828[_0x2107('0x23')]('\x22'+_0x57c7c5+'\x22');}}else{switch(_0x27a82a){case _0x2107('0x83'):case _0x2107('0x14'):_0xee2c4d[_0x2107('0x23')](_0x27a82a+_0x2107('0x84'));break;default:_0x2c6828[_0x2107('0x23')]('\x22\x22');}}}}else{var _0x209115='';for(var _0x4ad668=0x0;_0x4ad668<_0x32287d[_0x27a82a][_0x2107('0x22')];_0x4ad668++){var _0x57c7c5=_[_0x2107('0x78')](_0xf07c88[_0x2107('0x74')][_0x341a78][_0x32287d[_0x27a82a][_0x4ad668]][_0x2107('0x79')](/"/g,'\x27'));if(_0x209115=='')_0x209115=_0x57c7c5;else _0x209115+='|'+_0x57c7c5;}_0x2c5240[_0x2107('0x23')](_0x51c0b1['id']+':'+_0x209115);}}if(hasAdditionalPhones){_0x2c6828[_0x2107('0x23')]('\x22'+_0x2c5240[_0x2107('0x18')](';')+'\x22');}if(_0xee2c4d[_0x2107('0x22')]){handleError(_0xf07c88[_0x2107('0x74')][_0x341a78],{'code':_0x2107('0x85'),'message':_0xee2c4d[_0x2107('0x18')]()});}else{fs[_0x2107('0x86')](_0xf6d358,_0x2c6828['join']()+'\x0a');}_0x2c6828=[];}if(!(stats['rows']%0xc8)){socket[_0x2107('0x87')](_0x2107('0x88')+_0x1748c3,stats);stats[_0x2107('0x60')]=[];}}if(stopped){logger['info'](_0x2107('0x89'));_0x418ffd[_0x2107('0x8a')]();}}catch(_0x3f44f3){handleError(_0xf07c88[_0x2107('0x74')][_0x341a78],{'code':_0x2107('0x8b'),'message':_0x3f44f3[_0x2107('0x21')]});logger['error'](_0x2107('0x8c'),_0x3f44f3[_0x2107('0x21')]);}},'complete':function(){try{var _0x2b4420=[];var _0x3f1c8d=tempTableName;_0x2b4420[_0x2107('0x23')](_0x2107('0x8d')+_0x3f1c8d+_0x2107('0x8e'));logger['info'](_0x2107('0x8f'),contactItemTypes[_0x2107('0x22')]);var _0x86c2a0=util['format'](_0x2107('0x90'),_0xf6d358,_0x3f1c8d,_0x5cde90,_0xa6d945[_0x2107('0x57')],_0xa6d945['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x32287d[_0x2107('0x7a')])){_0x86c2a0+=_0x2107('0x91');}_0x2b4420[_0x2107('0x23')](_0x86c2a0);BPromise[_0x2107('0x92')](_0x2b4420,handleQuery)[_0x2107('0x1f')](function(_0xfcf5df){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x2b4420=[];for(var _0x594d36=0x0;_0x594d36\x20\x20','root','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','papaparse','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','sequelize','query','spread','length','isNil','phone','AdditionalPhones','push','all','catch','error','message','split','filter','CmContactHasItem','findOne','then','updated','create','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','into','cm_hopper_black','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','createdAt','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','concat',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','exit','errors','code','main','stringify','start','binding','clone','socket_timestamp','server/files/tmp','.csv','info','body','findAll','name','keys','header','writeFileSync','parse','createReadStream','data','find','hasOwnProperty','trim'];(function(_0x8c616c,_0x525e5b){var _0xa38897=function(_0x30cd6e){while(--_0x30cd6e){_0x8c616c['push'](_0x8c616c['shift']());}};_0xa38897(++_0x525e5b);}(_0x173f,0xca));var _0xf173=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x173f[_0x49d41c];return _0xb64c5f;};'use strict';var fs=require('fs');var path=require(_0xf173('0x0'));var _=require('lodash');var Papa=require(_0xf173('0x1'));var util=require('util');var BPromise=require(_0xf173('0x2'));var moment=require('moment');var squel=require(_0xf173('0x3'));var Redis=require(_0xf173('0x4'));var db=require(_0xf173('0x5'))['db'];var config=require(_0xf173('0x6'));var logger=require(_0xf173('0x7'))(_0xf173('0x8'));config[_0xf173('0x9')]=_[_0xf173('0xa')](config['redis'],{'host':_0xf173('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf173('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xf173('0xc')](_0xf173('0xd'));var tempTableName=_0xf173('0xe')+moment()[_0xf173('0xc')](_0xf173('0xf'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x2cc6c3){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))*$/[_0xf173('0x10')](_0x2cc6c3);}function selectNotIn(_0x914db0,_0x8b3979,_0x54f54a,_0x54283e,_0x3d7d0d){return squel[_0xf173('0x11')]()[_0xf173('0x12')]('phone')[_0xf173('0x13')](_0x54283e)[_0xf173('0x14')](_0x8b3979,null,_0x8b3979+_0xf173('0x15')+_0x54283e+'.'+_0x54f54a)[_0xf173('0x16')](_0x54283e+'.'+_0x54f54a+_0xf173('0x17')+_0x914db0+'.'+_0x54f54a)[_0xf173('0x16')](_0x8b3979+'.dialCheckDuplicateType\x20IN\x20('+_0x3d7d0d[_0xf173('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1c5492,_0x58e457){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf173('0x18')][_0xf173('0x19')]('select\x20*\x20from\x20'+tempTableName)[_0xf173('0x1a')](function(_0x198d09){if(_0x198d09!==null){var _0x9a8ca4=[];for(var _0x191f5a=0x0;_0x191f5a<_0x198d09[_0xf173('0x1b')];_0x191f5a++){var _0x2b1a13=_0x198d09[_0x191f5a];if(!_[_0xf173('0x1c')](_0x2b1a13[_0xf173('0x1d')])){if(!_[_0xf173('0x1c')](_0x2b1a13[_0xf173('0x1e')]))_0x9a8ca4[_0xf173('0x1f')](insertAdditionalPhones(_0x2b1a13));promisesContact['push']({'contact':_0x2b1a13});}}}Promise[_0xf173('0x20')](_0x9a8ca4)['then'](function(){_0x1c5492({'val':0x1});});})[_0xf173('0x21')](function(_0x23ef69){logger[_0xf173('0x22')](_0x23ef69[_0xf173('0x23')]);});});}function insertAdditionalPhones(_0x1d6275){return new Promise(function(_0x179808,_0x3beb8e){var _0x4cc834=_0x1d6275[_0xf173('0x1e')];if(_[_0xf173('0x1c')](_0x4cc834))_0x3beb8e({'val':0x0});else{var _0x17d2af=_0x4cc834[_0xf173('0x24')](';');var _0x36efbc=[];orderBy=0x0;for(var _0x244fbd=0x0;_0x244fbd<_0x17d2af[_0xf173('0x1b')];_0x244fbd++){_0x36efbc[_0xf173('0x1f')](splitAdditionalPhone(_0x1d6275['id'],_0x17d2af[_0x244fbd]));}Promise[_0xf173('0x20')](_0x36efbc)['then'](function(){_0x179808({'val':_0x17d2af[_0xf173('0x1b')]});});}});}function splitAdditionalPhone(_0x5701b2,_0x4021bd){return new Promise(function(_0x3bf515,_0x3a88b6){var _0x4defa7=_0x4021bd[_0xf173('0x24')](':');var _0x4df9a3=_0x4defa7[0x0];var _0x38e191=_0x4defa7[0x1];if(_0x38e191!==''){var _0x1df23a=_0x38e191['split']('|');var _0x4c3ba9=[];for(var _0x2e7138=0x0;_0x2e7138<_0x1df23a[_0xf173('0x1b')];_0x2e7138++){if(_0x1df23a[_0x2e7138]!==''){var _0xfe2fe8=_[_0xf173('0x25')](promisesAdditionalPhones,{'contactId':_0x5701b2,'phone':_0x1df23a[_0x2e7138]});if(_0xfe2fe8[_0xf173('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0xf173('0x1f')]({'contactId':_0x5701b2,'contactTypeId':_0x4df9a3,'phone':_0x1df23a[_0x2e7138],'orderBy':orderBy});}}}_0x3bf515({'ok':0x1});}else _0x3bf515({'res':0x0});});}function createAdditionalPhone(_0x30bbd7,_0x226078,_0x5179ec,_0x400556){return new Promise(function(_0x2284af,_0x4ad57d){return db[_0xf173('0x26')][_0xf173('0x27')]({'where':{'CmContactId':_0x30bbd7,'item':_0x5179ec}})[_0xf173('0x28')](function(_0x256d8d){if(_0x256d8d){return db['CmContactHasItem']['update']({'ItemTypeId':_0x226078,'OrderBy':_0x400556},{'where':{'CmContactId':_0x30bbd7,'item':_0x5179ec}})[_0xf173('0x28')](function(_0x1cc28f){_0x2284af({'res':_0xf173('0x29')});});}else{return db['CmContactHasItem'][_0xf173('0x2a')]({'CmContactId':_0x30bbd7,'item':_0x5179ec,'ItemTypeId':_0x226078,'OrderBy':_0x400556,'ItemClass':'PHONE'})[_0xf173('0x28')](function(_0x4ab14f){_0x2284af({'res':_0xf173('0x2b')});});}});});}function updateContact(_0xcd0042){return new Promise(function(_0x4d58a4,_0x1cca28){var _0x59be92=_0xcd0042['id'];delete _0xcd0042['id'];return db[_0xf173('0x2c')]['update'](_0xcd0042,{'where':{'id':_0x59be92}})['then'](function(_0x82c2e7){updatedRows+=0x1;return db[_0xf173('0x2d')]['update']({'phone':_0xcd0042[_0xf173('0x1d')]},{'where':{'ContactId':_0x59be92}})[_0xf173('0x28')](function(_0x2d91f9){_0x4d58a4({'ret':'OK'});});});});}function insertCmHopper(_0x4d36c3,_0x51b65b,_0x30ab11,_0x5e3271,_0x1c4454){var _0x5535f2=[_0xf173('0x2e'),_0xf173('0x2f'),_0xf173('0x30'),_0xf173('0x31'),_0x51b65b+'.'+_0x5e3271,'cm_contacts.createdAt',_0xf173('0x32'),'cm_contacts.priority',_0xf173('0x33'),'\x22'+_0x1c4454+'\x22'];return squel['insert']()['into'](_0xf173('0x34'))[_0xf173('0x35')](['phone',_0xf173('0x36'),_0xf173('0x37'),_0xf173('0x38'),_0x5e3271,'createdAt',_0xf173('0x39'),_0xf173('0x3a'),_0xf173('0x3b'),_0xf173('0x3c')],squel[_0xf173('0x11')]()[_0xf173('0x3d')](_0x5535f2)[_0xf173('0x13')](_0x51b65b)['join'](_0xf173('0x3e'),null,_0xf173('0x3f')+_0x51b65b+_0xf173('0x40'))[_0xf173('0x14')](_0x30ab11,null,_0x30ab11+'.id\x20=\x20'+_0x51b65b+'.'+_0x5e3271)['where'](_0x51b65b+_0xf173('0x41'),_0x4d36c3)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xf173('0x16')](_0xf173('0x42'),selectNotIn(_0x51b65b,_0x30ab11,_0x5e3271,_0xf173('0x34'),[_0xf173('0x43'),_0xf173('0x44')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x51b65b,_0x30ab11,_0x5e3271,_0xf173('0x34'),['\x22always\x22'])))[_0xf173('0x45')]();}function insertCmHopperBlack(_0x4935cf,_0x12c3f8,_0x4f1d9c,_0x249313){var _0x4944f3=[_0xf173('0x2e'),'cm_contacts.id',_0xf173('0x31'),_0x12c3f8+'.'+_0x249313,'cm_contacts.createdAt',_0xf173('0x32')];return squel[_0xf173('0x46')]()[_0xf173('0x47')](_0xf173('0x48'))[_0xf173('0x35')]([_0xf173('0x1d'),_0xf173('0x37'),'ListId',_0x249313,'createdAt',_0xf173('0x39')],squel[_0xf173('0x11')]()[_0xf173('0x3d')](_0x4944f3)[_0xf173('0x13')](_0x12c3f8)[_0xf173('0x14')](_0xf173('0x3e'),null,'cm_contacts.ListId\x20=\x20'+_0x12c3f8+_0xf173('0x40'))[_0xf173('0x14')](_0x4f1d9c,null,_0x4f1d9c+_0xf173('0x15')+_0x12c3f8+'.'+_0x249313)['where'](_0x12c3f8+_0xf173('0x41'),_0x4935cf)[_0xf173('0x16')](_0xf173('0x49'),NOW)[_0xf173('0x16')](_0xf173('0x42'),squel[_0xf173('0x11')]()[_0xf173('0x12')](_0xf173('0x1d'))['from'](_0xf173('0x48'))[_0xf173('0x16')](_0xf173('0x4a'),_0x4935cf)[_0xf173('0x16')](_0x249313+'\x20=\x20?',_0x12c3f8+'.'+_0x249313)))['toString']();}function insertCmHopperAdditionalPhones(_0x4a68d6){var _0x5039ba=[_0xf173('0x4b'),_0xf173('0x4c'),_0xf173('0x4d'),_0xf173('0x4e'),_0xf173('0x4f')];return squel[_0xf173('0x46')]()[_0xf173('0x47')](_0xf173('0x50'))[_0xf173('0x35')](['CmHopperId',_0xf173('0x1d'),_0xf173('0x51'),_0xf173('0x52'),'updatedAt'],squel[_0xf173('0x11')]()['fields'](_0x5039ba)[_0xf173('0x13')](_0xf173('0x34'))[_0xf173('0x14')](_0xf173('0x3e'),null,_0xf173('0x53'))[_0xf173('0x14')](_0xf173('0x54'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where']('cm_hopper.ListId\x20=\x20?',_0x4a68d6)[_0xf173('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xf173('0x45')]();}function insertCmContact(_0x5f5299,_0x32f6eb,_0x354302,_0x1c4f94){var _0x58d21c=_[_0xf173('0x55')](_['keys'](_0x1c4f94),[_0xf173('0x38'),'CompanyId',_0xf173('0x52'),_0xf173('0x39')]);return squel[_0xf173('0x46')]()[_0xf173('0x47')](_0xf173('0x3e'))[_0xf173('0x35')](_0x58d21c,squel[_0xf173('0x11')]()['fields'](_0x58d21c)['from'](_0x32f6eb)['where']('('+_0x354302[_0xf173('0x14')](',')+_0xf173('0x56'),squel[_0xf173('0x11')]()['fields'](_0x354302)['from'](_0xf173('0x3e'))[_0xf173('0x16')](_0xf173('0x4a'),_0x5f5299))[_0xf173('0x16')]('id\x20IN\x20?',squel[_0xf173('0x11')]()['field'](_0xf173('0x57'),_0xf173('0x58'))[_0xf173('0x13')](_0x32f6eb)[_0xf173('0x59')](_0x354302[_0xf173('0x14')](','))))[_0xf173('0x45')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3a5492){logger[_0xf173('0x22')](_0x3a5492[_0xf173('0x23')]);process[_0xf173('0x5a')](0x1);}function handleError(_0x297815,_0x49e6bd){stats[_0xf173('0x5b')]['push']({'name':_0x49e6bd[_0xf173('0x5c')],'message':_0x49e6bd[_0xf173('0x23')],'row':_0x297815});}function handleQuery(_0xc17cc2){logger['info'](_0xc17cc2);return db[_0xf173('0x18')]['query'](_0xc17cc2)[_0xf173('0x1a')](function(_0x1c80f1){results[_0xf173('0x1f')](_0x1c80f1);})[_0xf173('0x21')](function(_0x621351){logger['error'](_0x621351[_0xf173('0x23')]);});}function main(_0x2aec7e,_0x3528d8,_0x44d967,_0xa33cc4){logger['info'](_0xf173('0x5d'),_0x2aec7e,JSON[_0xf173('0x5e')](_0x3528d8));process['send'](_0xf173('0x5f'));var _0xa4c3ff=_0x3528d8[_0xf173('0x60')];var _0x31cfb2=_[_0xf173('0x61')](_0xa4c3ff);var _0x2e42ad=_0x3528d8[_0xf173('0x62')];var _0x443441=path[_0xf173('0x14')](config['root'],_0xf173('0x63'),_0x2e42ad+_0xf173('0x64'));logger[_0xf173('0x65')](_0xf173('0x66'),_0x3528d8);db['ContactItemType'][_0xf173('0x67')]({'raw':!![],'attributes':['id','name']})[_0xf173('0x28')](function(_0x21e743){for(var _0x27fd14=0x0;_0x27fd14<_0x21e743[_0xf173('0x1b')];_0x27fd14++){if(_0x21e743[_0x27fd14][_0xf173('0x68')]in _0xa4c3ff){contactItemTypes[_0xf173('0x1f')](_0x21e743[_0x27fd14]);delete _0x31cfb2[_0x21e743[_0x27fd14]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x31cfb2[_0xf173('0x1e')]='';var _0x2b6dda=_[_0xf173('0x69')](_0x31cfb2)[_0xf173('0x14')]();logger[_0xf173('0x65')](_0xf173('0x6a'),_0x2b6dda);fs[_0xf173('0x6b')](_0x443441,_0x2b6dda+'\x0a');Papa[_0xf173('0x6c')](fs[_0xf173('0x6d')](_0x2aec7e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x976bd2,_0x29c126){try{for(var _0x55927b=0x0,_0x2a5874=[];_0x55927b<_0x976bd2[_0xf173('0x6e')][_0xf173('0x1b')];_0x55927b++){stats['rows']+=0x1;if(_0x976bd2[_0xf173('0x5b')][_0x55927b]){handleError(_0x976bd2[_0xf173('0x6e')][_0x55927b],_0x976bd2[_0xf173('0x5b')][_0x55927b]);}else{var _0x141bd0=[];var _0x44a76b=[];for(var _0x4ce211 in _0xa4c3ff){let _0x1b2180=contactItemTypes[_0xf173('0x6f')](_0x3bab7c=>_0x3bab7c[_0xf173('0x68')]===_0x4ce211);if(_[_0xf173('0x1c')](_0x1b2180)){if(_0xa4c3ff[_0xf173('0x70')](_0x4ce211)){if(_0x976bd2['data'][_0x55927b][_0xa4c3ff[_0x4ce211]]){var _0x54ada2=_[_0xf173('0x71')](_0x976bd2['data'][_0x55927b][_0xa4c3ff[_0x4ce211]][_0xf173('0x72')](/"/g,'\x27'));switch(_0x4ce211){case _0xf173('0x36'):var _0x26b17f=moment(_0x54ada2,_0xf173('0xd'),!![]);if(_0x26b17f[_0xf173('0x73')]()){_0x2a5874[_0xf173('0x1f')]('\x22'+_0x54ada2+'\x22');}else{_0x141bd0['push'](_0xf173('0x74'));}break;case'priority':var _0x5eb177=parseInt(_0x54ada2);_0x54ada2=_[_0xf173('0x75')](_0x5eb177)||_0x5eb177<0x0||_0x5eb177>0x4?_0xa33cc4?0x3:0x2:_0x5eb177;_0x2a5874[_0xf173('0x1f')]('\x22'+_0x54ada2+'\x22');break;case _0xf173('0x3b'):var _0xa96801=parseInt(_0x54ada2);if(_['isNumber'](_0xa96801)&&_['includes'](_0x44d967,_0xa96801)){_0x2a5874[_0xf173('0x1f')]('\x22'+_0xa96801+'\x22');}else{_0x141bd0[_0xf173('0x1f')](_0xf173('0x76'));}break;case _0xf173('0x77'):if(isEmail(_0x54ada2)){_0x2a5874[_0xf173('0x1f')]('\x22'+_0x54ada2+'\x22');}else{_0x141bd0['push'](_0xf173('0x78'));}break;case _0xf173('0x79'):var _0x3aaef3=moment(_0x54ada2,_0xf173('0x7a'),!![]);if(_0x3aaef3[_0xf173('0x73')]()){_0x2a5874[_0xf173('0x1f')]('\x22'+_0x54ada2+'\x22');}else{_0x141bd0[_0xf173('0x1f')](_0xf173('0x7b'));}break;default:_0x2a5874[_0xf173('0x1f')]('\x22'+_0x54ada2+'\x22');}}else{switch(_0x4ce211){case _0xf173('0x7c'):case _0xf173('0x1d'):_0x141bd0['push'](_0x4ce211+_0xf173('0x7d'));break;default:_0x2a5874[_0xf173('0x1f')]('\x22\x22');}}}}else{var _0x2b8cba='';for(var _0x205333=0x0;_0x205333<_0xa4c3ff[_0x4ce211]['length'];_0x205333++){var _0x54ada2=_[_0xf173('0x71')](_0x976bd2[_0xf173('0x6e')][_0x55927b][_0xa4c3ff[_0x4ce211][_0x205333]][_0xf173('0x72')](/"/g,'\x27'));if(_0x2b8cba=='')_0x2b8cba=_0x54ada2;else _0x2b8cba+='|'+_0x54ada2;}_0x44a76b[_0xf173('0x1f')](_0x1b2180['id']+':'+_0x2b8cba);}}if(hasAdditionalPhones){_0x2a5874['push']('\x22'+_0x44a76b[_0xf173('0x14')](';')+'\x22');}if(_0x141bd0['length']){handleError(_0x976bd2['data'][_0x55927b],{'code':_0xf173('0x7e'),'message':_0x141bd0[_0xf173('0x14')]()});}else{fs[_0xf173('0x7f')](_0x443441,_0x2a5874[_0xf173('0x14')]()+'\x0a');}_0x2a5874=[];}if(!(stats[_0xf173('0x80')]%0xc8)){socket[_0xf173('0x81')](_0xf173('0x82')+_0x2e42ad,stats);stats[_0xf173('0x5b')]=[];}}if(stopped){logger['info'](_0xf173('0x83'));_0x29c126[_0xf173('0x84')]();}}catch(_0x4076e8){handleError(_0x976bd2[_0xf173('0x6e')][_0x55927b],{'code':_0xf173('0x85'),'message':_0x4076e8[_0xf173('0x23')]});logger[_0xf173('0x22')](_0xf173('0x86'),_0x4076e8[_0xf173('0x23')]);}},'complete':function(){try{var _0x178db8=[];var _0x31fd11=tempTableName;_0x178db8[_0xf173('0x1f')](_0xf173('0x87')+_0x31fd11+'\x20LIKE\x20cm_contacts;');logger[_0xf173('0x65')](_0xf173('0x88'),contactItemTypes[_0xf173('0x1b')]);var _0x2d998c=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x443441,_0x31fd11,_0x2b6dda,_0x3528d8[_0xf173('0x38')],_0x3528d8[_0xf173('0x89')]||null,NOW,NOW);if(_[_0xf173('0x1c')](_0xa4c3ff[_0xf173('0x36')])){_0x2d998c+=_0xf173('0x8a');}_0x178db8[_0xf173('0x1f')](_0x2d998c);BPromise[_0xf173('0x8b')](_0x178db8,handleQuery)[_0xf173('0x28')](function(_0x5da48d){BPromise[_0xf173('0x20')]([handleAdditionalPhones()])[_0xf173('0x28')](function(){_0x178db8=[];for(var _0xd43931=0x0;_0xd43931=_0x4c7d5f){return _0x485e5e[_0xabb9('0x13')](0x193)[_0xabb9('0x14')]({'message':util[_0xabb9('0x15')](_0xabb9('0x16'),_0x29e200)});}_0x4fbc39();})[_0xabb9('0x17')](function(_0xf5db74){_0x4fbc39(_0xf5db74);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xabb9('0x18')],{'where':{'$or':[{'role':_0xabb9('0x19')},{'role':_0xabb9('0x1a')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x5e33=['split','createDecipher','format','%s:%s:%s','update','base64','utf8','use','License','findOne','then','status','catch','users','User','admin','isUserLimit','crypto','util','../../mysqldb','../../config/environment','license','data1'];(function(_0x37f627,_0x2148ec){var _0x41436f=function(_0x5e9882){while(--_0x5e9882){_0x37f627['push'](_0x37f627['shift']());}};_0x41436f(++_0x2148ec);}(_0x5e33,0x9b));var _0x35e3=function(_0x1478c6,_0x287601){_0x1478c6=_0x1478c6-0x0;var _0x5abf02=_0x5e33[_0x1478c6];return _0x5abf02;};'use strict';var crypto=require(_0x35e3('0x0'));var util=require(_0x35e3('0x1'));var compose=require('composable-middleware');var db=require(_0x35e3('0x2'))['db'];var config=require(_0x35e3('0x3'));function getValueFromLicense(_0x3735c2,_0x4b2f05){if(_0x3735c2&&_0x4b2f05){if(_0x4b2f05['data1']&&_0x4b2f05[_0x35e3('0x4')]){var _0x2e3666=_0x4b2f05[_0x35e3('0x5')];var _0x9c1afb=_0x4b2f05[_0x35e3('0x4')];var _0x34e577=_0x2e3666['split']('-')[0x4];var _0x25d1f0=_0x2e3666[_0x35e3('0x6')]('-')[0x0];var _0x532212=crypto[_0x35e3('0x7')]('aes-256-ctr',util[_0x35e3('0x8')](_0x35e3('0x9'),_0x34e577,_0x2e3666,_0x25d1f0));var _0x1c7289=_0x532212[_0x35e3('0xa')](_0x9c1afb,_0x35e3('0xb'),'utf8');_0x1c7289+=_0x532212['final'](_0x35e3('0xc'));var _0x5cf17c=JSON['parse'](_0x1c7289);return _0x5cf17c['hasOwnProperty'](_0x3735c2)?_0x5cf17c[_0x3735c2]:null;}}return null;}function isLimit(_0x3a0adc,_0xa867d2,_0x3d83df,_0x55c318){var _0x319a91=_0xa867d2;return compose()[_0x35e3('0xd')](function(_0x533e8e,_0x3fc573,_0x299563){return db[_0x35e3('0xe')][_0x35e3('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x35e3('0x10')](function(_0x8690b3){var _0x2f4553=getValueFromLicense(_0x3a0adc,_0x8690b3);return _0x2f4553?_0x2f4553:_0x319a91;})[_0x35e3('0x10')](function(_0x53ede5){_0x319a91=_0x53ede5;return _0x3d83df['count'](_0x55c318);})[_0x35e3('0x10')](function(_0x891227){if(_0x891227>=_0x319a91){return _0x3fc573[_0x35e3('0x11')](0x193)['json']({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x3a0adc)});}_0x299563();})[_0x35e3('0x12')](function(_0x4e40ed){_0x299563(_0x4e40ed);});});}function isUserLimit(){return isLimit(_0x35e3('0x13'),0x1,db[_0x35e3('0x14')],{'where':{'$or':[{'role':_0x35e3('0x15')},{'role':'user'}]}});}exports[_0x35e3('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 126eabd..b73ee15 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 _0xc465=['LIKE\x20?','$lt','<\x20?','>\x20?','$gte','BETWEEN\x20?\x20AND\x20?','$in','start','pop','DATE','utcOffset','hours','minutes','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','slice','forEach','shift','match','filter','map','buildExpression','operator','$eq','$between','value','$gt','$lte','add','days','format','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith'];(function(_0x24576b,_0x19ee95){var _0x5ca615=function(_0x13e727){while(--_0x13e727){_0x24576b['push'](_0x24576b['shift']());}};_0x5ca615(++_0x19ee95);}(_0xc465,0xac));var _0x5c46=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xc465[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x5c46('0x0'));var moment=require(_0x5c46('0x1'));exports['parseSearch']=function(_0x4fba6e){var _0x2d02c5={'conditions':[]};_0x2d02c5[_0x5c46('0x2')]=_[_0x5c46('0x3')](_0x4fba6e,_0x5c46('0x4'))?'or':_0x5c46('0x5');var _0x5634ff=_0x4fba6e[_0x5c46('0x6')](_0x5c46('0x7'),'')[_0x5c46('0x6')](_0x5c46('0x4'),'')[_0x5c46('0x8')]('||');for(var _0x284681=0x0;_0x284681<_0x5634ff['length'];_0x284681++){var _0x559479=_0x5634ff[_0x284681][_0x5c46('0x8')](':=');var _0x24eee7=_0x559479[0x0];var _0x2eebbf=_0x559479[_0x5c46('0x9')](0x1);_0x2eebbf[_0x5c46('0xa')](function(_0x3ffd4b){var _0x24b849=_0x3ffd4b[_0x5c46('0x8')]('[')[_0x5c46('0xb')]();var _0x12f7f3=_0x3ffd4b[_0x5c46('0xc')](/\[(.*?)\]/g);_0x12f7f3['forEach'](function(_0x2a3df6){var _0x5b13ae=_0x2a3df6['split']('[')[_0x5c46('0xd')](function(_0x36fed3){return _0x36fed3['indexOf'](']')>-0x1;})[_0x5c46('0xe')](function(_0x507bf8){return _0x507bf8['split'](']')[0x0];})[0x0];_0x2d02c5['conditions']['push']({'field':_0x24eee7,'operator':_0x24b849,'value':_0x5b13ae});});});}return _0x2d02c5;};exports[_0x5c46('0xf')]=function(_0x441a69,_0x33b34a,_0x32c163){var _0x45bcf6={};if(_0x33b34a==='DATE'){if(_0x32c163[_0x5c46('0x10')]===_0x5c46('0x11')){_0x32c163['operator']=_0x5c46('0x12');_0x32c163[_0x5c46('0x13')]+=','+_0x32c163[_0x5c46('0x13')];}else if(_['includes']([_0x5c46('0x14'),_0x5c46('0x15')],_0x32c163[_0x5c46('0x10')])){_0x32c163[_0x5c46('0x13')]=moment(_0x32c163['value'])[_0x5c46('0x16')](0x1,_0x5c46('0x17'))[_0x5c46('0x18')]('YYYY-MM-DD');}}if(_0x32c163[_0x5c46('0x19')]){_0x33b34a=_0x32c163[_0x5c46('0x19')];_0x45bcf6[_0x5c46('0x1a')]=_0x5c46('0x1b')+_0x441a69+'.'+_0x32c163[_0x5c46('0x1c')]+_0x5c46('0x1d')+_0x32c163[_0x5c46('0x19')]+')\x20'+parseOperator(_0x32c163['operator']);}else{_0x45bcf6[_0x5c46('0x1a')]=_0x441a69+'.'+_0x32c163[_0x5c46('0x1c')]+'\x20'+parseOperator(_0x32c163[_0x5c46('0x10')]);}if(_[_0x5c46('0x1e')]([_0x5c46('0x1f'),_0x5c46('0x20')],_0x32c163[_0x5c46('0x10')]))_0x45bcf6[_0x5c46('0x1a')]='('+_0x45bcf6[_0x5c46('0x1a')]+_0x5c46('0x21')+_0x441a69+'.'+_0x32c163[_0x5c46('0x1c')]+_0x5c46('0x22');_0x45bcf6['value']=parseValue(_0x33b34a,_0x32c163[_0x5c46('0x10')],_0x32c163[_0x5c46('0x13')]);return _0x45bcf6;};function parseOperator(_0x325b0f){var _0x1f6c14;switch(_0x325b0f){case'$in':_0x1f6c14='IN\x20?';break;case _0x5c46('0x20'):_0x1f6c14=_0x5c46('0x23');break;case _0x5c46('0x11'):_0x1f6c14='=\x20?';break;case'$ne':_0x1f6c14=_0x5c46('0x24');break;case _0x5c46('0x25'):case _0x5c46('0x26'):case _0x5c46('0x27'):_0x1f6c14=_0x5c46('0x28');break;case _0x5c46('0x29'):_0x1f6c14=_0x5c46('0x2a');break;case _0x5c46('0x14'):_0x1f6c14=_0x5c46('0x2b');break;case _0x5c46('0x15'):_0x1f6c14='<=\x20?';break;case _0x5c46('0x2c'):_0x1f6c14='>=\x20?';break;case'$between':_0x1f6c14=_0x5c46('0x2d');break;}return _0x1f6c14;}function parseValue(_0x19de51,_0x142c11,_0x4309a7){var _0x5e6106={'start':undefined,'end':undefined};switch(_0x142c11){case _0x5c46('0x2e'):case _0x5c46('0x20'):_0x5e6106['start']=_0x4309a7[_0x5c46('0x8')](',');break;case _0x5c46('0x25'):_0x5e6106[_0x5c46('0x2f')]='%'+_0x4309a7+'%';break;case _0x5c46('0x26'):_0x5e6106['start']=_0x4309a7+'%';break;case'$endsWith':_0x5e6106[_0x5c46('0x2f')]='%'+_0x4309a7;break;case _0x5c46('0x12'):var _0x3f85b5=_0x4309a7[_0x5c46('0x8')](',');var _0x4309a7=_0x3f85b5['shift']();var _0xd586ed=_0x3f85b5[_0x5c46('0x30')]();if(_0x19de51===_0x5c46('0x31')){_0x4309a7=moment(_0x4309a7)[_0x5c46('0x32')](0x0,!![])[_0x5c46('0x18')]();_0xd586ed=moment(_0xd586ed)[_0x5c46('0x32')](0x0,!![])[_0x5c46('0x16')](0x17,_0x5c46('0x33'))[_0x5c46('0x16')](0x3b,_0x5c46('0x34'))[_0x5c46('0x16')](0x3b,'seconds')[_0x5c46('0x18')]();}_0x5e6106={'start':_0x4309a7,'end':_0xd586ed};break;default:_0x5e6106[_0x5c46('0x2f')]=_0x4309a7;break;}return _0x5e6106;} \ No newline at end of file +var _0xbb2b=['DATE','operator','$eq','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<=\x20?','$gte','start','pop','utcOffset','hours','minutes','seconds','sqlOperator','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','filter','conditions','buildExpression'];(function(_0x27eada,_0x2bd420){var _0x13e38c=function(_0x1cb743){while(--_0x1cb743){_0x27eada['push'](_0x27eada['shift']());}};_0x13e38c(++_0x2bd420);}(_0xbb2b,0x143));var _0xbbb2=function(_0x5a1496,_0x3c039b){_0x5a1496=_0x5a1496-0x0;var _0x3a45a4=_0xbb2b[_0x5a1496];return _0x3a45a4;};'use strict';var _=require('lodash');var moment=require('moment');exports['parseSearch']=function(_0x1461ce){var _0x5848b2={'conditions':[]};_0x5848b2[_0xbbb2('0x0')]=_['startsWith'](_0x1461ce,_0xbbb2('0x1'))?'or':_0xbbb2('0x2');var _0x3490ca=_0x1461ce[_0xbbb2('0x3')](_0xbbb2('0x4'),'')[_0xbbb2('0x3')](_0xbbb2('0x1'),'')[_0xbbb2('0x5')]('||');for(var _0x4a01db=0x0;_0x4a01db<_0x3490ca[_0xbbb2('0x6')];_0x4a01db++){var _0x46e349=_0x3490ca[_0x4a01db][_0xbbb2('0x5')](':=');var _0x261a7f=_0x46e349[0x0];var _0x55aad4=_0x46e349[_0xbbb2('0x7')](0x1);_0x55aad4[_0xbbb2('0x8')](function(_0x25923a){var _0x402d60=_0x25923a[_0xbbb2('0x5')]('[')[_0xbbb2('0x9')]();var _0x17f7dd=_0x25923a['match'](/\[(.*?)\]/g);_0x17f7dd[_0xbbb2('0x8')](function(_0x2eccb3){var _0x3d5452=_0x2eccb3['split']('[')[_0xbbb2('0xa')](function(_0x39e0aa){return _0x39e0aa['indexOf'](']')>-0x1;})['map'](function(_0x3f4230){return _0x3f4230[_0xbbb2('0x5')](']')[0x0];})[0x0];_0x5848b2[_0xbbb2('0xb')]['push']({'field':_0x261a7f,'operator':_0x402d60,'value':_0x3d5452});});});}return _0x5848b2;};exports[_0xbbb2('0xc')]=function(_0x32d839,_0x49f60a,_0x1a0d32){var _0x1c2475={};if(_0x49f60a===_0xbbb2('0xd')){if(_0x1a0d32[_0xbbb2('0xe')]===_0xbbb2('0xf')){_0x1a0d32[_0xbbb2('0xe')]=_0xbbb2('0x10');_0x1a0d32[_0xbbb2('0x11')]+=','+_0x1a0d32[_0xbbb2('0x11')];}else if(_['includes']([_0xbbb2('0x12'),_0xbbb2('0x13')],_0x1a0d32[_0xbbb2('0xe')])){_0x1a0d32[_0xbbb2('0x11')]=moment(_0x1a0d32[_0xbbb2('0x11')])[_0xbbb2('0x14')](0x1,_0xbbb2('0x15'))[_0xbbb2('0x16')](_0xbbb2('0x17'));}}if(_0x1a0d32[_0xbbb2('0x18')]){_0x49f60a=_0x1a0d32[_0xbbb2('0x18')];_0x1c2475[_0xbbb2('0x19')]='CAST('+_0x32d839+'.'+_0x1a0d32[_0xbbb2('0x1a')]+_0xbbb2('0x1b')+_0x1a0d32['castTo']+')\x20'+parseOperator(_0x1a0d32['operator']);}else{_0x1c2475['text']=_0x32d839+'.'+_0x1a0d32[_0xbbb2('0x1a')]+'\x20'+parseOperator(_0x1a0d32[_0xbbb2('0xe')]);}if(_['includes']([_0xbbb2('0x1c'),_0xbbb2('0x1d')],_0x1a0d32[_0xbbb2('0xe')]))_0x1c2475['text']='('+_0x1c2475[_0xbbb2('0x19')]+_0xbbb2('0x1e')+_0x32d839+'.'+_0x1a0d32[_0xbbb2('0x1a')]+_0xbbb2('0x1f');_0x1c2475[_0xbbb2('0x11')]=parseValue(_0x49f60a,_0x1a0d32[_0xbbb2('0xe')],_0x1a0d32[_0xbbb2('0x11')]);return _0x1c2475;};function parseOperator(_0x2b9f82){var _0x3c0ed6;switch(_0x2b9f82){case _0xbbb2('0x20'):_0x3c0ed6=_0xbbb2('0x21');break;case'$notIn':_0x3c0ed6='NOT\x20IN\x20?';break;case _0xbbb2('0xf'):_0x3c0ed6=_0xbbb2('0x22');break;case _0xbbb2('0x1c'):_0x3c0ed6='<>\x20?';break;case _0xbbb2('0x23'):case _0xbbb2('0x24'):case _0xbbb2('0x25'):_0x3c0ed6=_0xbbb2('0x26');break;case _0xbbb2('0x27'):_0x3c0ed6='<\x20?';break;case _0xbbb2('0x12'):_0x3c0ed6='>\x20?';break;case'$lte':_0x3c0ed6=_0xbbb2('0x28');break;case _0xbbb2('0x29'):_0x3c0ed6='>=\x20?';break;case _0xbbb2('0x10'):_0x3c0ed6='BETWEEN\x20?\x20AND\x20?';break;}return _0x3c0ed6;}function parseValue(_0x4130b2,_0x516632,_0x5a7cf5){var _0x2e907b={'start':undefined,'end':undefined};switch(_0x516632){case _0xbbb2('0x20'):case _0xbbb2('0x1d'):_0x2e907b[_0xbbb2('0x2a')]=_0x5a7cf5[_0xbbb2('0x5')](',');break;case'$substring':_0x2e907b[_0xbbb2('0x2a')]='%'+_0x5a7cf5+'%';break;case _0xbbb2('0x24'):_0x2e907b['start']=_0x5a7cf5+'%';break;case _0xbbb2('0x25'):_0x2e907b['start']='%'+_0x5a7cf5;break;case'$between':var _0x18f709=_0x5a7cf5['split'](',');var _0x5a7cf5=_0x18f709['shift']();var _0x1ece9e=_0x18f709[_0xbbb2('0x2b')]();if(_0x4130b2===_0xbbb2('0xd')){_0x5a7cf5=moment(_0x5a7cf5)[_0xbbb2('0x2c')](0x0,!![])[_0xbbb2('0x16')]();_0x1ece9e=moment(_0x1ece9e)['utcOffset'](0x0,!![])[_0xbbb2('0x14')](0x17,_0xbbb2('0x2d'))[_0xbbb2('0x14')](0x3b,_0xbbb2('0x2e'))['add'](0x3b,_0xbbb2('0x2f'))['format']();}_0x2e907b={'start':_0x5a7cf5,'end':_0x1ece9e};break;default:_0x2e907b[_0xbbb2('0x2a')]=_0x5a7cf5;break;}return _0x2e907b;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 1b6fd24..082f36c 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 _0xdb84=['priority','unsigned','DESC','col','ASC','omit','isArray','length','unset','^[0-9]*$','isEmail','match','getFullTextValue','forEach','toString','join','sequelize','moment','split','filters','isEmpty','forOwn','find','type','DATE','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','limit','offset','sort','map','indexOf','cast'];(function(_0x5cdf3c,_0x896c88){var _0x58757f=function(_0x36684a){while(--_0x36684a){_0x5cdf3c['push'](_0x5cdf3c['shift']());}};_0x58757f(++_0x896c88);}(_0xdb84,0xa8));var _0x4db8=function(_0x28391f,_0x4b8ca0){_0x28391f=_0x28391f-0x0;var _0x46e332=_0xdb84[_0x28391f];return _0x46e332;};'use strict';var _=require('lodash');var sequelize=require(_0x4db8('0x0'));var moment=require(_0x4db8('0x1'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0xb46fee){var _0x30e72d=null;if(_0xb46fee){_0x30e72d=_0xb46fee[_0x4db8('0x2')](',');}return _0x30e72d;};exports[_0x4db8('0x3')]=function(_0x44ac53,_0x3c1226){var _0x229794={};if(!_[_0x4db8('0x4')](_0x44ac53)){_[_0x4db8('0x5')](_0x44ac53,function(_0x2962d0,_0x102ff0){try{if(_0x3c1226){var _0x160009=_[_0x4db8('0x6')](_0x3c1226,{'name':_0x102ff0})||{};if(_0x160009[_0x4db8('0x7')]===_0x4db8('0x8')&&_['isPlainObject'](_0x2962d0)){var _0x24bc23=JSON[_0x4db8('0x9')](_0x2962d0);var _0x304e80={'$gte':moment(moment(_0x24bc23[_0x4db8('0xa')])[_0x4db8('0xb')](_0x4db8('0xc')))[_0x4db8('0xd')]()[_0x4db8('0xb')](),'$lte':moment(moment(_0x24bc23[_0x4db8('0xe')])['format'](_0x4db8('0xc')))[_0x4db8('0xd')]()[_0x4db8('0xf')](0x1,'s')[_0x4db8('0xb')]()};_0x229794[_0x102ff0]=_0x304e80;}else{_0x229794[_0x102ff0]=_['isArray'](_0x2962d0)?_0x2962d0:JSON[_0x4db8('0x9')](_0x2962d0);}}else{_0x229794[_0x102ff0]=_['isArray'](_0x2962d0)?_0x2962d0:JSON[_0x4db8('0x9')](_0x2962d0);}}catch(_0x14960d){_0x229794[_0x102ff0]=_0x2962d0[_0x4db8('0x2')](',');}});}return _0x229794;};exports[_0x4db8('0x10')]=function(_0x3c064b){_0x3c064b=parseInt(_0x3c064b,0xa);if(!_0x3c064b||_0x3c064b<0x0){_0x3c064b=LIMIT_VALUE;}return _0x3c064b;};exports[_0x4db8('0x11')]=function(_0x357c4c){_0x357c4c=parseInt(_0x357c4c,0xa);if(!_0x357c4c||_0x357c4c<0x0){_0x357c4c=0x0;}return _0x357c4c;};exports[_0x4db8('0x12')]=function(_0x154c9a){var _0x3c55e9,_0x4d4b61=null;if(_0x154c9a){_0x3c55e9=_0x154c9a['split'](',');_0x4d4b61=_[_0x4db8('0x13')](_0x3c55e9,function(_0x4fbbff){if(_0x4fbbff[_0x4db8('0x14')]('-')===0x0){return[_0x4fbbff==='priority'?sequelize[_0x4db8('0x15')](sequelize['col'](_0x4db8('0x16')),_0x4db8('0x17')):_0x4fbbff['substr'](0x1),_0x4db8('0x18')];}else{return[_0x4fbbff==='priority'?sequelize[_0x4db8('0x15')](sequelize[_0x4db8('0x19')](_0x4db8('0x16')),_0x4db8('0x17')):_0x4fbbff,_0x4db8('0x1a')];}});}return _0x4d4b61;};exports[_0x4db8('0x1b')]=function(_0xe8a81d,_0xece800){if(_[_0x4db8('0x4')](_0xe8a81d)){return _0xe8a81d;}if(_[_0x4db8('0x1c')](_0xe8a81d)){for(var _0x4bb9e4=0x0;_0x4bb9e4<_0xe8a81d['length'];_0x4bb9e4+=0x1){_0xe8a81d[_0x4bb9e4]=this[_0x4db8('0x1b')](_0xe8a81d[_0x4bb9e4],_0xece800);}return _0xe8a81d;}if(!_['isObject'](_0xe8a81d)){return _0xe8a81d;}if(_['isString'](_0xece800)){_0xece800=[_0xece800];}if(!_[_0x4db8('0x1c')](_0xece800)){return _0xe8a81d;}for(var _0x5c9e8a=0x0;_0x5c9e8a<_0xece800[_0x4db8('0x1d')];_0x5c9e8a+=0x1){_[_0x4db8('0x1e')](_0xe8a81d,_0xece800[_0x5c9e8a]);}for(var _0xaaf5ba in _0xe8a81d){if(_0xe8a81d['hasOwnProperty'](_0xaaf5ba)){_0xe8a81d[_0xaaf5ba]=this[_0x4db8('0x1b')](_0xe8a81d[_0xaaf5ba],_0xece800);}}return _0xe8a81d;};exports['isNumeric']=function(_0x4994a9){return _0x4994a9['match'](RegExp(_0x4db8('0x1f')))?!![]:![];};exports[_0x4db8('0x20')]=function(_0x523ef6){return _0x523ef6[_0x4db8('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0x4db8('0x22')]=function(_0xec5371){var _0x32abb2=[];_0xec5371[_0x4db8('0x2')]('\x20')[_0x4db8('0x23')](function(_0x9e887e){_0x32abb2['push']('+'+_0x9e887e[_0x4db8('0x24')]()+'*');});return _0x32abb2[_0x4db8('0x25')]('\x20');}; \ No newline at end of file +var _0xc8ae=['sort','map','indexOf','col','priority','unsigned','ASC','length','omit','isString','unset','hasOwnProperty','isNumeric','match','^[0-9]*$','getFullTextValue','forEach','join','lodash','sequelize','moment','fields','split','isEmpty','forOwn','type','DATE','parse','$gte','format','utc','$lte','YYYY-MM-DD','subtract','isArray','limit'];(function(_0x419530,_0x118836){var _0x1e9156=function(_0x2cb2f2){while(--_0x2cb2f2){_0x419530['push'](_0x419530['shift']());}};_0x1e9156(++_0x118836);}(_0xc8ae,0x1c2));var _0xec8a=function(_0x537522,_0x845cea){_0x537522=_0x537522-0x0;var _0x3a1154=_0xc8ae[_0x537522];return _0x3a1154;};'use strict';var _=require(_0xec8a('0x0'));var sequelize=require(_0xec8a('0x1'));var moment=require(_0xec8a('0x2'));var LIMIT_VALUE=0xfa;exports[_0xec8a('0x3')]=function(_0xc68d30){var _0x54db43=null;if(_0xc68d30){_0x54db43=_0xc68d30[_0xec8a('0x4')](',');}return _0x54db43;};exports['filters']=function(_0x333353,_0x863994){var _0x1b0523={};if(!_[_0xec8a('0x5')](_0x333353)){_[_0xec8a('0x6')](_0x333353,function(_0x291bd8,_0x2c9d02){try{if(_0x863994){var _0x54463b=_['find'](_0x863994,{'name':_0x2c9d02})||{};if(_0x54463b[_0xec8a('0x7')]===_0xec8a('0x8')&&_['isPlainObject'](_0x291bd8)){var _0x5d1f75=JSON[_0xec8a('0x9')](_0x291bd8);var _0x146fdf={'$gte':moment(moment(_0x5d1f75[_0xec8a('0xa')])[_0xec8a('0xb')]('YYYY-MM-DD'))[_0xec8a('0xc')]()[_0xec8a('0xb')](),'$lte':moment(moment(_0x5d1f75[_0xec8a('0xd')])['format'](_0xec8a('0xe')))[_0xec8a('0xc')]()[_0xec8a('0xf')](0x1,'s')[_0xec8a('0xb')]()};_0x1b0523[_0x2c9d02]=_0x146fdf;}else{_0x1b0523[_0x2c9d02]=_['isArray'](_0x291bd8)?_0x291bd8:JSON[_0xec8a('0x9')](_0x291bd8);}}else{_0x1b0523[_0x2c9d02]=_[_0xec8a('0x10')](_0x291bd8)?_0x291bd8:JSON['parse'](_0x291bd8);}}catch(_0x173f9c){_0x1b0523[_0x2c9d02]=_0x291bd8[_0xec8a('0x4')](',');}});}return _0x1b0523;};exports[_0xec8a('0x11')]=function(_0x519eca){_0x519eca=parseInt(_0x519eca,0xa);if(!_0x519eca||_0x519eca<0x0){_0x519eca=LIMIT_VALUE;}return _0x519eca;};exports['offset']=function(_0x4d798d){_0x4d798d=parseInt(_0x4d798d,0xa);if(!_0x4d798d||_0x4d798d<0x0){_0x4d798d=0x0;}return _0x4d798d;};exports[_0xec8a('0x12')]=function(_0x2e9edd){var _0x13a2d5,_0x4de2b9=null;if(_0x2e9edd){_0x13a2d5=_0x2e9edd[_0xec8a('0x4')](',');_0x4de2b9=_[_0xec8a('0x13')](_0x13a2d5,function(_0xc90b40){if(_0xc90b40[_0xec8a('0x14')]('-')===0x0){return[_0xc90b40==='priority'?sequelize['cast'](sequelize[_0xec8a('0x15')](_0xec8a('0x16')),_0xec8a('0x17')):_0xc90b40['substr'](0x1),'DESC'];}else{return[_0xc90b40===_0xec8a('0x16')?sequelize['cast'](sequelize[_0xec8a('0x15')](_0xec8a('0x16')),_0xec8a('0x17')):_0xc90b40,_0xec8a('0x18')];}});}return _0x4de2b9;};exports['omit']=function(_0x13855b,_0x13a77d){if(_[_0xec8a('0x5')](_0x13855b)){return _0x13855b;}if(_[_0xec8a('0x10')](_0x13855b)){for(var _0x5003ae=0x0;_0x5003ae<_0x13855b[_0xec8a('0x19')];_0x5003ae+=0x1){_0x13855b[_0x5003ae]=this[_0xec8a('0x1a')](_0x13855b[_0x5003ae],_0x13a77d);}return _0x13855b;}if(!_['isObject'](_0x13855b)){return _0x13855b;}if(_[_0xec8a('0x1b')](_0x13a77d)){_0x13a77d=[_0x13a77d];}if(!_[_0xec8a('0x10')](_0x13a77d)){return _0x13855b;}for(var _0x323759=0x0;_0x323759<_0x13a77d[_0xec8a('0x19')];_0x323759+=0x1){_[_0xec8a('0x1c')](_0x13855b,_0x13a77d[_0x323759]);}for(var _0x31ea81 in _0x13855b){if(_0x13855b[_0xec8a('0x1d')](_0x31ea81)){_0x13855b[_0x31ea81]=this[_0xec8a('0x1a')](_0x13855b[_0x31ea81],_0x13a77d);}}return _0x13855b;};exports[_0xec8a('0x1e')]=function(_0x4049e8){return _0x4049e8[_0xec8a('0x1f')](RegExp(_0xec8a('0x20')))?!![]:![];};exports['isEmail']=function(_0x592f0e){return _0x592f0e[_0xec8a('0x1f')](/^\S+@\S+$/)?!![]:![];};exports[_0xec8a('0x21')]=function(_0x55e428){var _0x169a72=[];_0x55e428[_0xec8a('0x4')]('\x20')[_0xec8a('0x22')](function(_0x3447d9){_0x169a72['push']('+'+_0x3447d9['toString']()+'*');});return _0x169a72[_0xec8a('0x23')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 08f94a4..a36f1e8 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x158d=['cookie-parser','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','env','production','set','appPath','join','root','json\x20replacer','toISOString','split','use','static','views','/server/views','engine','html','ejs','renderFile','urlencoded','50mb','json','initialize','express','body-parser','method-override'];(function(_0x321172,_0x241332){var _0x4046f2=function(_0x7d791c){while(--_0x7d791c){_0x321172['push'](_0x321172['shift']());}};_0x4046f2(++_0x241332);}(_0x158d,0x1b7));var _0xd158=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0x158d[_0x1e172a];return _0x96338b;};'use strict';var express=require(_0xd158('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0xd158('0x1'));var methodOverride=require(_0xd158('0x2'));var cookieParser=require(_0xd158('0x3'));var errorHandler=require(_0xd158('0x4'));var path=require(_0xd158('0x5'));var passport=require(_0xd158('0x6'));var cors=require(_0xd158('0x7'));var moment=require(_0xd158('0x8'));var config=require(_0xd158('0x9'));var db=require(_0xd158('0xa'))['db'];exports[_0xd158('0xb')]=function(_0x3f79f8){var _0x254d86=_0x3f79f8[_0xd158('0xc')](_0xd158('0xd'));if(_0x254d86===_0xd158('0xe')){_0x3f79f8[_0xd158('0xf')](_0xd158('0x10'),path[_0xd158('0x11')](config[_0xd158('0x12')],'public'));}if(_0x254d86==='development'||_0x254d86==='test'){_0x3f79f8[_0xd158('0xf')](_0xd158('0x10'),path[_0xd158('0x11')](config[_0xd158('0x12')],'client'));_0x3f79f8['use'](errorHandler());}_0x3f79f8[_0xd158('0xf')](_0xd158('0x13'),function(_0x508867,_0x1c0eef){if(this[_0x508867]instanceof Date){_0x1c0eef=this[_0x508867][_0xd158('0x14')]()[_0xd158('0x15')]('.')[0x0]+'Z';}return _0x1c0eef;});_0x3f79f8[_0xd158('0x16')](express[_0xd158('0x17')](_0x3f79f8['get']('appPath')));_0x3f79f8[_0xd158('0xf')](_0xd158('0x18'),config['root']+_0xd158('0x19'));_0x3f79f8[_0xd158('0x1a')](_0xd158('0x1b'),require(_0xd158('0x1c'))[_0xd158('0x1d')]);_0x3f79f8['set']('view\x20engine',_0xd158('0x1b'));_0x3f79f8[_0xd158('0x16')](bodyParser[_0xd158('0x1e')]({'limit':_0xd158('0x1f'),'extended':!![]}));_0x3f79f8[_0xd158('0x16')](bodyParser[_0xd158('0x20')]({'limit':_0xd158('0x1f')}));_0x3f79f8['use'](cors());_0x3f79f8[_0xd158('0x16')](methodOverride());_0x3f79f8[_0xd158('0x16')](cookieParser());_0x3f79f8[_0xd158('0x16')](passport[_0xd158('0x21')]());}; \ No newline at end of file +var _0xd004=['default','get','env','set','appPath','join','root','public','development','test','client','json\x20replacer','toISOString','split','static','views','/server/views','html','ejs','renderFile','view\x20engine','urlencoded','50mb','use','json','initialize','express','serve-favicon','body-parser','method-override','path','passport','cors','./environment','../mysqldb'];(function(_0x334dc2,_0x44f024){var _0x487011=function(_0x178358){while(--_0x178358){_0x334dc2['push'](_0x334dc2['shift']());}};_0x487011(++_0x44f024);}(_0xd004,0x155));var _0x4d00=function(_0x1b943f,_0x6f6e83){_0x1b943f=_0x1b943f-0x0;var _0x8b7549=_0xd004[_0x1b943f];return _0x8b7549;};'use strict';var express=require(_0x4d00('0x0'));var favicon=require(_0x4d00('0x1'));var bodyParser=require(_0x4d00('0x2'));var methodOverride=require(_0x4d00('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0x4d00('0x4'));var passport=require(_0x4d00('0x5'));var cors=require(_0x4d00('0x6'));var moment=require('moment');var config=require(_0x4d00('0x7'));var db=require(_0x4d00('0x8'))['db'];exports[_0x4d00('0x9')]=function(_0x4938c0){var _0x833290=_0x4938c0[_0x4d00('0xa')](_0x4d00('0xb'));if(_0x833290==='production'){_0x4938c0[_0x4d00('0xc')](_0x4d00('0xd'),path[_0x4d00('0xe')](config[_0x4d00('0xf')],_0x4d00('0x10')));}if(_0x833290===_0x4d00('0x11')||_0x833290===_0x4d00('0x12')){_0x4938c0[_0x4d00('0xc')](_0x4d00('0xd'),path[_0x4d00('0xe')](config[_0x4d00('0xf')],_0x4d00('0x13')));_0x4938c0['use'](errorHandler());}_0x4938c0[_0x4d00('0xc')](_0x4d00('0x14'),function(_0x27ea0f,_0x3e6fba){if(this[_0x27ea0f]instanceof Date){_0x3e6fba=this[_0x27ea0f][_0x4d00('0x15')]()[_0x4d00('0x16')]('.')[0x0]+'Z';}return _0x3e6fba;});_0x4938c0['use'](express[_0x4d00('0x17')](_0x4938c0[_0x4d00('0xa')](_0x4d00('0xd'))));_0x4938c0[_0x4d00('0xc')](_0x4d00('0x18'),config[_0x4d00('0xf')]+_0x4d00('0x19'));_0x4938c0['engine'](_0x4d00('0x1a'),require(_0x4d00('0x1b'))[_0x4d00('0x1c')]);_0x4938c0['set'](_0x4d00('0x1d'),_0x4d00('0x1a'));_0x4938c0['use'](bodyParser[_0x4d00('0x1e')]({'limit':_0x4d00('0x1f'),'extended':!![]}));_0x4938c0[_0x4d00('0x20')](bodyParser[_0x4d00('0x21')]({'limit':_0x4d00('0x1f')}));_0x4938c0[_0x4d00('0x20')](cors());_0x4938c0['use'](methodOverride());_0x4938c0[_0x4d00('0x20')](cookieParser());_0x4938c0[_0x4d00('0x20')](passport[_0x4d00('0x22')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 7180c5e..4a1b061 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 _0x304b=['address','127.0.0.1','getFirstInterface','orderBy','map','model','join','md5','update','digest','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','createHash','substring','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','length','filter','family','IPv4','internal','concat','head','mac'];(function(_0x358e06,_0x11975c){var _0x567433=function(_0x213b48){while(--_0x213b48){_0x358e06['push'](_0x358e06['shift']());}};_0x567433(++_0x11975c);}(_0x304b,0xfb));var _0xb304=function(_0x378689,_0x56d71b){_0x378689=_0x378689-0x0;var _0x48a228=_0x304b[_0x378689];return _0x48a228;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xb304('0x0'));var machine=require(_0xb304('0x1'));var exec=require(_0xb304('0x2'))[_0xb304('0x3')];function getInterfaces(){var _0x2c36b9=[];var _0x1a54ea=os[_0xb304('0x4')]();var _0xedd10a=_['orderBy'](_['keys'](_0x1a54ea));for(var _0x110d34=0x0;_0x110d34<_0xedd10a[_0xb304('0x5')];_0x110d34++){var _0x1eef78=_0x1a54ea[_0xedd10a[_0x110d34]][_0xb304('0x6')](function(_0x177964){return _0x177964[_0xb304('0x7')]===_0xb304('0x8')&&_0x177964[_0xb304('0x9')]===![];});_0x2c36b9=_0x2c36b9[_0xb304('0xa')](_0x1eef78);}return _0x2c36b9;}function getFirstInterface(){var _0x5138c5=_[_0xb304('0xb')](getInterfaces());return{'macAddress':_0x5138c5&&_0x5138c5[_0xb304('0xc')]?_0x5138c5[_0xb304('0xc')]:'00:00:00:00:00:00','ipAddress':_0x5138c5&&_0x5138c5[_0xb304('0xd')]?_0x5138c5[_0xb304('0xd')]:_0xb304('0xe')};}exports[_0xb304('0xf')]=getFirstInterface;function getCPUhash(){var _0x387851=_[_0xb304('0x10')](os['cpus']()[_0xb304('0x11')](function(_0x1f4ddb){return _0x1f4ddb[_0xb304('0x12')];}))[_0xb304('0x13')](':');return crypto['createHash'](_0xb304('0x14'))[_0xb304('0x15')](_0x387851)[_0xb304('0x16')](_0xb304('0x17'));}exports[_0xb304('0x18')]=function(){switch(os[_0xb304('0x19')]()){case _0xb304('0x1a'):return exec(_0xb304('0x1b'),{'encoding':_0xb304('0x1c')})[_0xb304('0x1d')]('\x0d\x0a','');default:var _0x3d20b5=getFirstInterface();var _0x3be8cb=getCPUhash();var _0x1252cb=_0x3be8cb+'|'+os['hostname']()+'|'+_0x3d20b5[_0xb304('0x1e')]+'|'+_0x3d20b5['ipAddress'];var _0x522fca=crypto[_0xb304('0x1f')](_0xb304('0x14'))[_0xb304('0x15')](_0x1252cb)[_0xb304('0x16')](_0xb304('0x17'));return _0x522fca['substring'](0x0,0x8)+'-'+_0x522fca[_0xb304('0x20')](0x8,0xc)+'-'+_0x522fca['substring'](0xc,0x10)+'-'+_0x522fca[_0xb304('0x20')](0x10,0x14)+'-'+_0x522fca[_0xb304('0x20')](0x14);}}; \ No newline at end of file +var _0x291c=['family','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','join','md5','update','digest','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length'];(function(_0x26a1a9,_0xa88722){var _0x22b456=function(_0x344c88){while(--_0x344c88){_0x26a1a9['push'](_0x26a1a9['shift']());}};_0x22b456(++_0xa88722);}(_0x291c,0x137));var _0xc291=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x291c[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xc291('0x0'));var os=require('os');var crypto=require(_0xc291('0x1'));var machine=require(_0xc291('0x2'));var exec=require(_0xc291('0x3'))[_0xc291('0x4')];function getInterfaces(){var _0x253ebb=[];var _0xc32916=os[_0xc291('0x5')]();var _0xafdfee=_[_0xc291('0x6')](_[_0xc291('0x7')](_0xc32916));for(var _0x5e7cbd=0x0;_0x5e7cbd<_0xafdfee[_0xc291('0x8')];_0x5e7cbd++){var _0x5f2563=_0xc32916[_0xafdfee[_0x5e7cbd]]['filter'](function(_0x40dc89){return _0x40dc89[_0xc291('0x9')]===_0xc291('0xa')&&_0x40dc89[_0xc291('0xb')]===![];});_0x253ebb=_0x253ebb['concat'](_0x5f2563);}return _0x253ebb;}function getFirstInterface(){var _0x2f8764=_[_0xc291('0xc')](getInterfaces());return{'macAddress':_0x2f8764&&_0x2f8764[_0xc291('0xd')]?_0x2f8764[_0xc291('0xd')]:_0xc291('0xe'),'ipAddress':_0x2f8764&&_0x2f8764[_0xc291('0xf')]?_0x2f8764[_0xc291('0xf')]:_0xc291('0x10')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x49934e=_['orderBy'](os[_0xc291('0x11')]()[_0xc291('0x12')](function(_0x3c7a29){return _0x3c7a29['model'];}))[_0xc291('0x13')](':');return crypto['createHash'](_0xc291('0x14'))[_0xc291('0x15')](_0x49934e)[_0xc291('0x16')](_0xc291('0x17'));}exports[_0xc291('0x18')]=function(){switch(os[_0xc291('0x19')]()){case _0xc291('0x1a'):return exec(_0xc291('0x1b'),{'encoding':_0xc291('0x1c')})[_0xc291('0x1d')]('\x0d\x0a','');default:var _0x5495ff=getFirstInterface();var _0x305ecc=getCPUhash();var _0x23dbf0=_0x305ecc+'|'+os['hostname']()+'|'+_0x5495ff[_0xc291('0x1e')]+'|'+_0x5495ff['ipAddress'];var _0x4c8947=crypto['createHash'](_0xc291('0x14'))[_0xc291('0x15')](_0x23dbf0)[_0xc291('0x16')](_0xc291('0x17'));return _0x4c8947[_0xc291('0x1f')](0x0,0x8)+'-'+_0x4c8947[_0xc291('0x1f')](0x8,0xc)+'-'+_0x4c8947[_0xc291('0x1f')](0xc,0x10)+'-'+_0x4c8947[_0xc291('0x1f')](0x10,0x14)+'-'+_0x4c8947[_0xc291('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 2b81fd1..863fcfc 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 _0xf3e2=['update','utf8','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','openIssue','MOTLICENSE','Alert','get','active','info','data2','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','util','crypto','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','aes-256-ctr','session','base64','final','createDecipher','secrets'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xf3e2,0x168));var _0x2f3e=function(_0x575446,_0x1a13fa){_0x575446=_0x575446-0x0;var _0x2fb644=_0xf3e2[_0x575446];return _0x2fb644;};'use strict';var util=require(_0x2f3e('0x0'));var crypto=require(_0x2f3e('0x1'));var moment=require(_0x2f3e('0x2'));var rp=require(_0x2f3e('0x3'));var BPromise=require(_0x2f3e('0x4'));var pkginfo=require(_0x2f3e('0x5'))(module,_0x2f3e('0x6'));var db=require(_0x2f3e('0x7'))['db'];var config=require('../environment');var hardware=require(_0x2f3e('0x8'));var logger=require('../logger')(_0x2f3e('0x9'));var jira=require(_0x2f3e('0xa'));var HOST=_0x2f3e('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x392f91){return new BPromise(function(_0x3b556b,_0x1ac142){var _0x30f939=util[_0x2f3e('0xc')]('%s/api/servers/%s/check?version=%s',HOST,_0x392f91,module[_0x2f3e('0xd')]['version']);if(oldToken){_0x30f939=util[_0x2f3e('0xc')](_0x2f3e('0xe'),HOST,_0x392f91,module[_0x2f3e('0xd')][_0x2f3e('0x6')],oldToken);}var _0x412819={'uri':_0x30f939,'method':_0x2f3e('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x412819)[_0x2f3e('0x10')](function(_0x3a797f){_0x3b556b(_0x3a797f);})[_0x2f3e('0x11')](function(_0x14c0bd){_0x1ac142(_0x14c0bd);});});}function encryptDate(_0x1a7596){var _0x105ea6=crypto['createCipher'](_0x2f3e('0x12'),config['secrets'][_0x2f3e('0x13')]);var _0x1b2c62=_0x105ea6['update'](_0x1a7596,'utf8',_0x2f3e('0x14'));_0x1b2c62+=_0x105ea6[_0x2f3e('0x15')](_0x2f3e('0x14'));return _0x1b2c62;}function decryptDate(_0x14a2a1){var _0x38ac85=crypto[_0x2f3e('0x16')]('aes-256-ctr',config[_0x2f3e('0x17')][_0x2f3e('0x13')]);var _0x15398d=_0x38ac85[_0x2f3e('0x18')](_0x14a2a1,'base64',_0x2f3e('0x19'));_0x15398d+=_0x38ac85['final'](_0x2f3e('0x19'));return _0x15398d;}function sendJiraAlert(_0x452bd8,_0x64f096,_0x27eff9){var _0x74d2a1=_0x2f3e('0x1a');return db[_0x2f3e('0x1b')][_0x2f3e('0x1c')]({'where':{'role':_0x2f3e('0x1d')},'attributes':[_0x2f3e('0x1e'),_0x2f3e('0x1f')],'raw':!![]})[_0x2f3e('0x10')](function(_0x34ee59){ADMIN=_0x34ee59;_0x74d2a1+=_0x2f3e('0x20')+_0x27eff9+'|\x0a';_0x74d2a1+=_0x2f3e('0x21')+_0x452bd8+'|\x0a';_0x74d2a1+=_0x2f3e('0x22')+_0x64f096+'|\x0a';_0x74d2a1+=_0x2f3e('0x23')+ADMIN[_0x2f3e('0x1e')]+'|\x0a';_0x74d2a1+=_0x2f3e('0x24')+ADMIN[_0x2f3e('0x1f')]+'|\x0a';return _0x74d2a1;})[_0x2f3e('0x10')](function(_0x3bd446){var _0x16c8fc=hardware[_0x2f3e('0x25')]()['ipAddress'];return jira[_0x2f3e('0x26')]({'key':_0x2f3e('0x27'),'summary':'Motion\x20License\x20Alert','description':_0x3bd446,'issuetype':_0x2f3e('0x28'),'oldToken':_0x452bd8,'newToken':_0x64f096,'email':ADMIN[_0x2f3e('0x1f')],'name':ADMIN[_0x2f3e('0x1e')],'reason':GRAY_PERIOD_REASON,'ip':_0x16c8fc});});}function manageLicense(_0x6a2c1f,_0x59231b){var _0x5e8389=_0x59231b[_0x2f3e('0x29')]({'plain':!![]});httpRequest(_0x6a2c1f)[_0x2f3e('0x10')](function(_0x3f9976){if(oldToken){oldToken=undefined;}if(_0x3f9976[_0x2f3e('0x2a')]){if(!_0x5e8389[_0x2f3e('0x9')]&&_0x5e8389['license']!=_0x3f9976[_0x2f3e('0x9')]||_0x5e8389['license']&&_0x5e8389['data2']){logger[_0x2f3e('0x2b')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x5e8389[_0x2f3e('0x9')]&&!_0x5e8389['data2']&&_0x5e8389['license']!=_0x3f9976[_0x2f3e('0x9')]){logger[_0x2f3e('0x2b')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x5e8389[_0x2f3e('0x9')]&&!_0x5e8389[_0x2f3e('0x2c')]&&_0x5e8389[_0x2f3e('0x9')]==_0x3f9976[_0x2f3e('0x9')]){return _0x59231b;}return _0x59231b[_0x2f3e('0x18')]({'data1':_0x6a2c1f,'data2':null,'license':_0x3f9976['license']});}else{if(_0x3f9976[_0x2f3e('0x9')]||_0x5e8389[_0x2f3e('0x9')]){if(!_0x5e8389['data2']){if(_0x5e8389[_0x2f3e('0x2d')]==_0x6a2c1f){GRAY_PERIOD_REASON=_0x2f3e('0x2e');logger[_0x2f3e('0x2b')](_0x2f3e('0x2f'));}else{GRAY_PERIOD_REASON=_0x2f3e('0x30');oldToken=_0x5e8389['data1'];logger['info'](_0x2f3e('0x31'),_0x5e8389[_0x2f3e('0x2d')],_0x6a2c1f);}sendJiraAlert(_0x5e8389[_0x2f3e('0x2d')],_0x3f9976[_0x2f3e('0x32')],GRAY_PERIOD_REASON);logger[_0x2f3e('0x2b')](_0x2f3e('0x33'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x2f3e('0xc')]('YYYY-MM-DD\x20HH:mm'));return _0x59231b[_0x2f3e('0x18')]({'data2':encryptDate(moment()[_0x2f3e('0xc')](_0x2f3e('0x34')))});}else{if(moment()[_0x2f3e('0x35')](decryptDate(_0x5e8389[_0x2f3e('0x2c')]),_0x2f3e('0x36'))>DAYS){logger[_0x2f3e('0x2b')](_0x2f3e('0x37'),moment()['format'](_0x2f3e('0x34')));return _0x59231b[_0x2f3e('0x18')]({'data1':_0x6a2c1f,'data2':null,'license':null});}}}else{if(_0x5e8389['data1']!=_0x6a2c1f){logger[_0x2f3e('0x2b')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5e8389['data1'],_0x6a2c1f);return _0x59231b[_0x2f3e('0x18')]({'data1':_0x6a2c1f,'data2':null,'license':null});}}}return _0x59231b;})[_0x2f3e('0x10')](function(_0x5a2c64){_0x59231b=_0x5a2c64;})[_0x2f3e('0x11')](function(_0x463601){logger['error'](_0x463601['message']);})[_0x2f3e('0x38')](function(){setTimeout(function(){manageLicense(hardware[_0x2f3e('0x39')](),_0x59231b);},TIME);});}function defaultLicense(){var _0x2bf355=hardware[_0x2f3e('0x39')]();if(_0x2bf355){return db[_0x2f3e('0x3a')][_0x2f3e('0x3b')]({'where':{'id':0x1},'defaults':{'data1':_0x2bf355}})[_0x2f3e('0x3c')](function(_0x170136,_0x903b29){logger[_0x2f3e('0x2b')](_0x2f3e('0x3d'),_0x2bf355);manageLicense(_0x2bf355,_0x170136);})[_0x2f3e('0x11')](function(_0x376c17){logger[_0x2f3e('0x3e')](_0x376c17[_0x2f3e('0x3f')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x7708=['format','%s/api/servers/%s/check?version=%s','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','aes-256-ctr','secrets','session','update','utf8','base64','createDecipher','final','||FIELD||VALUE||\x0a','User','findOne','fullname','email','|machineUuid|','|name|','|email|','getFirstInterface','ipAddress','openIssue','Motion\x20License\x20Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','days','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','crypto','request-promise','../environment','./hardware','license','https://www.xcallymotion.com'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0x7708,0x188));var _0x8770=function(_0x255c48,_0x2a4449){_0x255c48=_0x255c48-0x0;var _0xaebda3=_0x7708[_0x255c48];return _0xaebda3;};'use strict';var util=require(_0x8770('0x0'));var crypto=require(_0x8770('0x1'));var moment=require('moment');var rp=require(_0x8770('0x2'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,'version');var db=require('../../mysqldb')['db'];var config=require(_0x8770('0x3'));var hardware=require(_0x8770('0x4'));var logger=require('../logger')(_0x8770('0x5'));var jira=require('../../api/jira/jira.controller');var HOST=_0x8770('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x42d305){return new BPromise(function(_0x2b0295,_0x20e293){var _0x212b12=util[_0x8770('0x7')](_0x8770('0x8'),HOST,_0x42d305,module['exports'][_0x8770('0x9')]);if(oldToken){_0x212b12=util[_0x8770('0x7')](_0x8770('0xa'),HOST,_0x42d305,module['exports'][_0x8770('0x9')],oldToken);}var _0x10e4a3={'uri':_0x212b12,'method':_0x8770('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x10e4a3)[_0x8770('0xc')](function(_0x4a0ca1){_0x2b0295(_0x4a0ca1);})[_0x8770('0xd')](function(_0x34d66c){_0x20e293(_0x34d66c);});});}function encryptDate(_0x2adcbf){var _0x51efbc=crypto[_0x8770('0xe')](_0x8770('0xf'),config[_0x8770('0x10')][_0x8770('0x11')]);var _0x2f2571=_0x51efbc[_0x8770('0x12')](_0x2adcbf,_0x8770('0x13'),_0x8770('0x14'));_0x2f2571+=_0x51efbc['final'](_0x8770('0x14'));return _0x2f2571;}function decryptDate(_0x106a20){var _0x5dd4e7=crypto[_0x8770('0x15')]('aes-256-ctr',config[_0x8770('0x10')]['session']);var _0x5b4716=_0x5dd4e7['update'](_0x106a20,_0x8770('0x14'),_0x8770('0x13'));_0x5b4716+=_0x5dd4e7[_0x8770('0x16')](_0x8770('0x13'));return _0x5b4716;}function sendJiraAlert(_0x4b0691,_0x550be9,_0x349bd4){var _0xfe176a=_0x8770('0x17');return db[_0x8770('0x18')][_0x8770('0x19')]({'where':{'role':'admin'},'attributes':[_0x8770('0x1a'),_0x8770('0x1b')],'raw':!![]})[_0x8770('0xc')](function(_0xe1cba5){ADMIN=_0xe1cba5;_0xfe176a+='|reason|'+_0x349bd4+'|\x0a';_0xfe176a+='|uuid|'+_0x4b0691+'|\x0a';_0xfe176a+=_0x8770('0x1c')+_0x550be9+'|\x0a';_0xfe176a+=_0x8770('0x1d')+ADMIN[_0x8770('0x1a')]+'|\x0a';_0xfe176a+=_0x8770('0x1e')+ADMIN[_0x8770('0x1b')]+'|\x0a';return _0xfe176a;})[_0x8770('0xc')](function(_0x5819dc){var _0x468fc0=hardware[_0x8770('0x1f')]()[_0x8770('0x20')];return jira[_0x8770('0x21')]({'key':'MOTLICENSE','summary':_0x8770('0x22'),'description':_0x5819dc,'issuetype':'Alert','oldToken':_0x4b0691,'newToken':_0x550be9,'email':ADMIN[_0x8770('0x1b')],'name':ADMIN[_0x8770('0x1a')],'reason':GRAY_PERIOD_REASON,'ip':_0x468fc0});});}function manageLicense(_0x473d31,_0x2b5f62){var _0x1538b2=_0x2b5f62[_0x8770('0x23')]({'plain':!![]});httpRequest(_0x473d31)[_0x8770('0xc')](function(_0x367564){if(oldToken){oldToken=undefined;}if(_0x367564[_0x8770('0x24')]){if(!_0x1538b2[_0x8770('0x5')]&&_0x1538b2['license']!=_0x367564[_0x8770('0x5')]||_0x1538b2[_0x8770('0x5')]&&_0x1538b2[_0x8770('0x25')]){logger[_0x8770('0x26')](_0x8770('0x27'));}if(_0x1538b2[_0x8770('0x5')]&&!_0x1538b2['data2']&&_0x1538b2['license']!=_0x367564[_0x8770('0x5')]){logger[_0x8770('0x26')](_0x8770('0x28'));}if(_0x1538b2[_0x8770('0x5')]&&!_0x1538b2[_0x8770('0x25')]&&_0x1538b2['license']==_0x367564['license']){return _0x2b5f62;}return _0x2b5f62[_0x8770('0x12')]({'data1':_0x473d31,'data2':null,'license':_0x367564[_0x8770('0x5')]});}else{if(_0x367564[_0x8770('0x5')]||_0x1538b2[_0x8770('0x5')]){if(!_0x1538b2['data2']){if(_0x1538b2[_0x8770('0x29')]==_0x473d31){GRAY_PERIOD_REASON='Disabled';logger['info'](_0x8770('0x2a'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x1538b2[_0x8770('0x29')];logger[_0x8770('0x26')](_0x8770('0x2b'),_0x1538b2[_0x8770('0x29')],_0x473d31);}sendJiraAlert(_0x1538b2[_0x8770('0x29')],_0x367564[_0x8770('0x2c')],GRAY_PERIOD_REASON);logger[_0x8770('0x26')](_0x8770('0x2d'),GRAY_PERIOD_REASON[_0x8770('0x2e')](),moment()['format'](_0x8770('0x2f')));return _0x2b5f62[_0x8770('0x12')]({'data2':encryptDate(moment()[_0x8770('0x7')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](decryptDate(_0x1538b2[_0x8770('0x25')]),_0x8770('0x30'))>DAYS){logger[_0x8770('0x26')]('DEMO\x20START\x20AT\x20%s',moment()[_0x8770('0x7')]('YYYY-MM-DD\x20HH:mm'));return _0x2b5f62[_0x8770('0x12')]({'data1':_0x473d31,'data2':null,'license':null});}}}else{if(_0x1538b2[_0x8770('0x29')]!=_0x473d31){logger[_0x8770('0x26')](_0x8770('0x2b'),_0x1538b2[_0x8770('0x29')],_0x473d31);return _0x2b5f62[_0x8770('0x12')]({'data1':_0x473d31,'data2':null,'license':null});}}}return _0x2b5f62;})[_0x8770('0xc')](function(_0x17488d){_0x2b5f62=_0x17488d;})[_0x8770('0xd')](function(_0xfc8e37){logger['error'](_0xfc8e37[_0x8770('0x31')]);})[_0x8770('0x32')](function(){setTimeout(function(){manageLicense(hardware[_0x8770('0x33')](),_0x2b5f62);},TIME);});}function defaultLicense(){var _0x5b2825=hardware[_0x8770('0x33')]();if(_0x5b2825){return db[_0x8770('0x34')][_0x8770('0x35')]({'where':{'id':0x1},'defaults':{'data1':_0x5b2825}})[_0x8770('0x36')](function(_0x1e8e0b,_0x3a50db){logger['info'](_0x8770('0x37'),_0x5b2825);manageLicense(_0x5b2825,_0x1e8e0b);})['catch'](function(_0x3cdaa6){logger['error'](_0x3cdaa6[_0x8770('0x31')]);});}}exports[_0x8770('0x38')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index ac574d2..a042e77 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 _0xad47=['getUuid','secrets','session','utf8','deadline','add','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','data1','message','License','find','checkLicense','crypto','util','lodash','moment','./hardware','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','parse','demo','uuid','machineUuid'];(function(_0x19a5fa,_0x2b2004){var _0x2c158d=function(_0x1fc843){while(--_0x1fc843){_0x19a5fa['push'](_0x19a5fa['shift']());}};_0x2c158d(++_0x2b2004);}(_0xad47,0xad));var _0x7ad4=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0xad47[_0x3203a1];return _0x24215e;};'use strict';var crypto=require(_0x7ad4('0x0'));var util=require(_0x7ad4('0x1'));var _=require(_0x7ad4('0x2'));var moment=require(_0x7ad4('0x3'));var hardware=require(_0x7ad4('0x4'));var config=require(_0x7ad4('0x5'));var db=require(_0x7ad4('0x6'))['db'];function checkLicense(_0xf2ae45,_0x305628){if(_0xf2ae45){try{var _0x220c04=_0x305628||_0xf2ae45[_0x7ad4('0x7')];if(_[_0x7ad4('0x8')](_0x220c04)){throw new Error(_0x7ad4('0x9'));}var _0x1f969d=_0xf2ae45['data1'];var _0x3952e2=_0xf2ae45[_0x7ad4('0xa')];var _0x294578=_0x1f969d['split']('-')[0x4];var _0x3989b7=_0x1f969d['split']('-')[0x0];var _0x16989e=crypto[_0x7ad4('0xb')](_0x7ad4('0xc'),util[_0x7ad4('0xd')](_0x7ad4('0xe'),_0x294578,_0x1f969d,_0x3989b7));var _0x5d618d=_0x16989e[_0x7ad4('0xf')](_0x220c04,_0x7ad4('0x10'),'utf8');_0x5d618d+=_0x16989e[_0x7ad4('0x11')]('utf8');var _0x2414bf=JSON[_0x7ad4('0x12')](_0x5d618d);_0x2414bf[_0x7ad4('0x13')]=![];_0x2414bf[_0x7ad4('0x14')]=_0x1f969d;_0x2414bf[_0x7ad4('0x15')]=hardware[_0x7ad4('0x16')]();if(_0x3952e2){var _0x4ac13b=crypto[_0x7ad4('0xb')]('aes-256-ctr',config[_0x7ad4('0x17')][_0x7ad4('0x18')]);var _0xa1a9ba=_0x4ac13b['update'](_0x3952e2,_0x7ad4('0x10'),_0x7ad4('0x19'));_0xa1a9ba+=_0x4ac13b['final'](_0x7ad4('0x19'));_0x2414bf['gray']=_0xa1a9ba;_0x2414bf[_0x7ad4('0x1a')]=moment(_0xa1a9ba)[_0x7ad4('0x1b')](0x7,_0x7ad4('0x1c'))[_0x7ad4('0xd')]();_0x2414bf[_0x7ad4('0x1d')]=_0x2414bf[_0x7ad4('0x14')]!=_0x2414bf[_0x7ad4('0x15')]?_0x7ad4('0x1e'):_0x7ad4('0x1f');}return _0x2414bf;}catch(_0x4d5b61){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7ad4('0x20'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x7ad4('0x21'),'uuid':_0xf2ae45[_0x7ad4('0x22')],'machineUuid':hardware['getUuid'](),'message':_0x4d5b61[_0x7ad4('0x23')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0xf2ae45[_0x7ad4('0x22')],'machineUuid':hardware[_0x7ad4('0x16')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x5006ee){return db[_0x7ad4('0x24')][_0x7ad4('0x25')](_['defaults'](_0x5006ee,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x1436f0){return checkLicense(_0x1436f0,null);});};exports[_0x7ad4('0x26')]=checkLicense; \ No newline at end of file +var _0x11c3=['../environment','../../mysqldb','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','utf8','parse','demo','uuid','machineUuid','getUuid','secrets','session','add','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','getLicense','License','find','then','checkLicense','crypto','lodash','moment'];(function(_0x5214ef,_0x10e7b8){var _0xa284d=function(_0x1f264d){while(--_0x1f264d){_0x5214ef['push'](_0x5214ef['shift']());}};_0xa284d(++_0x10e7b8);}(_0x11c3,0x179));var _0x311c=function(_0x11b664,_0x5ed6d7){_0x11b664=_0x11b664-0x0;var _0x419ea6=_0x11c3[_0x11b664];return _0x419ea6;};'use strict';var crypto=require(_0x311c('0x0'));var util=require('util');var _=require(_0x311c('0x1'));var moment=require(_0x311c('0x2'));var hardware=require('./hardware');var config=require(_0x311c('0x3'));var db=require(_0x311c('0x4'))['db'];function checkLicense(_0x216edc,_0x10ecfa){if(_0x216edc){try{var _0x10100e=_0x10ecfa||_0x216edc['license'];if(_[_0x311c('0x5')](_0x10100e)){throw new Error(_0x311c('0x6'));}var _0x32fcf4=_0x216edc[_0x311c('0x7')];var _0x12d1d9=_0x216edc[_0x311c('0x8')];var _0xee6b8d=_0x32fcf4[_0x311c('0x9')]('-')[0x4];var _0x57a2cf=_0x32fcf4[_0x311c('0x9')]('-')[0x0];var _0x5c9f1c=crypto[_0x311c('0xa')](_0x311c('0xb'),util[_0x311c('0xc')](_0x311c('0xd'),_0xee6b8d,_0x32fcf4,_0x57a2cf));var _0xe748e1=_0x5c9f1c[_0x311c('0xe')](_0x10100e,_0x311c('0xf'),'utf8');_0xe748e1+=_0x5c9f1c[_0x311c('0x10')](_0x311c('0x11'));var _0x895566=JSON[_0x311c('0x12')](_0xe748e1);_0x895566[_0x311c('0x13')]=![];_0x895566[_0x311c('0x14')]=_0x32fcf4;_0x895566[_0x311c('0x15')]=hardware[_0x311c('0x16')]();if(_0x12d1d9){var _0x1d76b8=crypto[_0x311c('0xa')](_0x311c('0xb'),config[_0x311c('0x17')][_0x311c('0x18')]);var _0x19ed0f=_0x1d76b8[_0x311c('0xe')](_0x12d1d9,_0x311c('0xf'),_0x311c('0x11'));_0x19ed0f+=_0x1d76b8[_0x311c('0x10')]('utf8');_0x895566['gray']=_0x19ed0f;_0x895566['deadline']=moment(_0x19ed0f)[_0x311c('0x19')](0x7,_0x311c('0x1a'))['format']();_0x895566[_0x311c('0x1b')]=_0x895566[_0x311c('0x14')]!=_0x895566[_0x311c('0x15')]?_0x311c('0x1c'):_0x311c('0x1d');}return _0x895566;}catch(_0x113167){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x311c('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x311c('0x1f'),'uuid':_0x216edc['data1'],'machineUuid':hardware[_0x311c('0x16')](),'message':_0x113167[_0x311c('0x20')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x311c('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x216edc[_0x311c('0x7')],'machineUuid':hardware[_0x311c('0x16')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x311c('0x21')]=function(_0x476b8b){return db[_0x311c('0x22')][_0x311c('0x23')](_['defaults'](_0x476b8b,{'raw':!![],'where':{'id':0x1}}))[_0x311c('0x24')](function(_0xa93026){return checkLicense(_0xa93026,null);});};exports[_0x311c('0x25')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index f24c47e..813fb6f 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 _0xd80d=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x1f6dd6,_0x325b9a){var _0x349a1b=function(_0x52abf0){while(--_0x52abf0){_0x1f6dd6['push'](_0x1f6dd6['shift']());}};_0x349a1b(++_0x325b9a);}(_0xd80d,0x1c1));var _0xdd80=function(_0x53413c,_0x5dd313){_0x53413c=_0x53413c-0x0;var _0x5af911=_0xd80d[_0x53413c];return _0x5af911;};'use strict';module[_0xdd80('0x0')]={'DOMAIN':_0xdd80('0x1'),'SESSION_SECRET':_0xdd80('0x2'),'GOOGLE_ID':_0xdd80('0x3'),'GOOGLE_SECRET':_0xdd80('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x777a=['app-id','http://localhost:9000','myappanuglar-secret'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x777a,0x8e));var _0xa777=function(_0x2f422a,_0x167362){_0x2f422a=_0x2f422a-0x0;var _0xc6e00a=_0x777a[_0x2f422a];return _0xc6e00a;};'use strict';module['exports']={'DOMAIN':_0xa777('0x0'),'SESSION_SECRET':_0xa777('0x1'),'GOOGLE_ID':_0xa777('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index d366c32..fa5f8c8 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe32=['INFO','log','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','transports','File','%s-%s','error','info','Console','env','debugLevel','util','path'];(function(_0x35b99b,_0x2efd45){var _0xc34057=function(_0x59ffe9){while(--_0x59ffe9){_0x35b99b['push'](_0x35b99b['shift']());}};_0xc34057(++_0x2efd45);}(_0xfe32,0x1e1));var _0x2fe3=function(_0x2f53d6,_0x5e50ab){_0x2f53d6=_0x2f53d6-0x0;var _0x4d4e74=_0xfe32[_0x2f53d6];return _0x4d4e74;};'use strict';var moment=require('moment');var winston=require('winston');var util=require(_0x2fe3('0x0'));var path=require(_0x2fe3('0x1'));var debugLevel=_0x2fe3('0x2');function filename(_0x2912be,_0x1cdd6a){return path['join']('/var',_0x2fe3('0x3'),_0x2fe3('0x4'),util[_0x2fe3('0x5')](_0x2fe3('0x6'),_0x2912be,_0x1cdd6a));}function formatter(_0x6fe26b,_0x5efcc5){return util[_0x2fe3('0x5')](_0x2fe3('0x7'),moment()[_0x2fe3('0x5')](_0x2fe3('0x8')),_0x5efcc5[_0x2fe3('0x9')][_0x2fe3('0xa')](),_0x6fe26b,_0x5efcc5[_0x2fe3('0xb')]);}module[_0x2fe3('0xc')]=function(_0x401cd3){return new winston['Logger']({'transports':[new winston[(_0x2fe3('0xd'))][(_0x2fe3('0xe'))]({'name':util['format'](_0x2fe3('0xf'),_0x401cd3,_0x2fe3('0x10')),'filename':filename(_0x401cd3,'error'),'level':_0x2fe3('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5fc935){return formatter(_0x401cd3,_0x5fc935);}}),new winston[(_0x2fe3('0xd'))][(_0x2fe3('0xe'))]({'name':util[_0x2fe3('0x5')](_0x2fe3('0xf'),_0x401cd3,_0x2fe3('0x11')),'filename':filename(_0x401cd3,'info'),'level':_0x2fe3('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1beaa5){return formatter(_0x401cd3,_0x1beaa5);}}),new winston[(_0x2fe3('0xd'))][(_0x2fe3('0x12'))]({'level':process[_0x2fe3('0x13')][_0x2fe3('0x14')]||debugLevel,'json':![],'formatter':function(_0x26f97d){return formatter(_0x401cd3,_0x26f97d);}})]});}; \ No newline at end of file +var _0xb966=['info','Console','debugLevel','winston','util','INFO','log','xcally','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','message','exports','Logger','transports','%s-%s','error','File'];(function(_0x12e650,_0x33f29f){var _0x5b56b1=function(_0xa7f3d8){while(--_0xa7f3d8){_0x12e650['push'](_0x12e650['shift']());}};_0x5b56b1(++_0x33f29f);}(_0xb966,0x1a5));var _0x6b96=function(_0xa266ab,_0x155914){_0xa266ab=_0xa266ab-0x0;var _0x24bccf=_0xb966[_0xa266ab];return _0x24bccf;};'use strict';var moment=require('moment');var winston=require(_0x6b96('0x0'));var util=require(_0x6b96('0x1'));var path=require('path');var debugLevel=_0x6b96('0x2');function filename(_0x3f9d5a,_0x5b8b2d){return path['join']('/var',_0x6b96('0x3'),_0x6b96('0x4'),util[_0x6b96('0x5')]('%s-%s.log',_0x3f9d5a,_0x5b8b2d));}function formatter(_0x45fcb0,_0x2ad932){return util[_0x6b96('0x5')](_0x6b96('0x6'),moment()[_0x6b96('0x5')](_0x6b96('0x7')),_0x2ad932['level'][_0x6b96('0x8')](),_0x45fcb0,_0x2ad932[_0x6b96('0x9')]);}module[_0x6b96('0xa')]=function(_0x302464){return new winston[(_0x6b96('0xb'))]({'transports':[new winston[(_0x6b96('0xc'))]['File']({'name':util[_0x6b96('0x5')](_0x6b96('0xd'),_0x302464,_0x6b96('0xe')),'filename':filename(_0x302464,_0x6b96('0xe')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3df46a){return formatter(_0x302464,_0x3df46a);}}),new winston[(_0x6b96('0xc'))][(_0x6b96('0xf'))]({'name':util[_0x6b96('0x5')]('%s-%s',_0x302464,_0x6b96('0x10')),'filename':filename(_0x302464,_0x6b96('0x10')),'level':_0x6b96('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xc69686){return formatter(_0x302464,_0xc69686);}}),new winston[(_0x6b96('0xc'))][(_0x6b96('0x11'))]({'level':process['env'][_0x6b96('0x12')]||debugLevel,'json':![],'formatter':function(_0x3c835f){return formatter(_0x302464,_0x3c835f);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 8a8d1f3..b0a2b7d 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 _0xa781=['join','../../services/express/index.js','ami','agi','../../services/agi/index.js','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa781,0x82));var _0x1a78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa781[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x1a78('0x0'));var os=require('os');var config={'apps':[{'name':_0x1a78('0x1'),'script':path[_0x1a78('0x2')](__dirname,_0x1a78('0x3'))},{'name':_0x1a78('0x4'),'script':path[_0x1a78('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x1a78('0x5'),'script':path[_0x1a78('0x2')](__dirname,_0x1a78('0x6'))},{'name':'email','script':path['join'](__dirname,_0x1a78('0x7'))},{'name':'routing','script':path[_0x1a78('0x2')](__dirname,_0x1a78('0x8'))},{'name':_0x1a78('0x9'),'script':path['join'](__dirname,_0x1a78('0xa'))}]};module[_0x1a78('0xb')]=config; \ No newline at end of file +var _0x142b=['xdr','exports','ami','join','../../services/ami/index.js','agi','email','../../services/email/index.js','routing'];(function(_0x53aecb,_0x54c77a){var _0x219b0f=function(_0x25820a){while(--_0x25820a){_0x53aecb['push'](_0x53aecb['shift']());}};_0x219b0f(++_0x54c77a);}(_0x142b,0x1bb));var _0xb142=function(_0x322086,_0x3dc58d){_0x322086=_0x322086-0x0;var _0x4d6ab3=_0x142b[_0x322086];return _0x4d6ab3;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0xb142('0x0'),'script':path[_0xb142('0x1')](__dirname,_0xb142('0x2'))},{'name':_0xb142('0x3'),'script':path[_0xb142('0x1')](__dirname,'../../services/agi/index.js')},{'name':_0xb142('0x4'),'script':path[_0xb142('0x1')](__dirname,_0xb142('0x5'))},{'name':_0xb142('0x6'),'script':path['join'](__dirname,'../../services/routing/index.js')},{'name':_0xb142('0x7'),'script':path[_0xb142('0x1')](__dirname,'../../services/xdr/index.js')}]};module[_0xb142('0x8')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 36dd12c..951f7e1 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 _0x35f5=['describe','delete','dump','saved','pm2','./config','connect','then','stop','disconnect','restart','list'];(function(_0x291e85,_0x2c6059){var _0x538ba2=function(_0x69c44a){while(--_0x69c44a){_0x291e85['push'](_0x291e85['shift']());}};_0x538ba2(++_0x2c6059);}(_0x35f5,0x100));var _0x535f=function(_0x176d14,_0x3984ea){_0x176d14=_0x176d14-0x0;var _0x89522c=_0x35f5[_0x176d14];return _0x89522c;};'use strict';var pm2=require(_0x535f('0x0'));var BPromise=require('bluebird');var config=require(_0x535f('0x1'));function connect(){return new BPromise(function(_0x3d1ae7,_0x46e486){return pm2[_0x535f('0x2')](function(_0x4fd48a){if(_0x4fd48a){return _0x46e486(_0x4fd48a);}return _0x3d1ae7('connected');});});};exports['start']=function(_0x3a8b37){return connect()[_0x535f('0x3')](function(){return new BPromise(function(_0x4e52d2,_0x6b403a){return pm2['start'](_0x3a8b37,function(_0x24a137,_0x14c55b){if(_0x24a137){return _0x6b403a(_0x24a137);}pm2['disconnect']();return _0x4e52d2(_0x14c55b);});});});};exports[_0x535f('0x4')]=function(_0x4cc7b6){return connect()[_0x535f('0x3')](function(){return new BPromise(function(_0x2231fc,_0x41e216){return pm2[_0x535f('0x4')](_0x4cc7b6,function(_0x361853,_0x46fdd7){if(_0x361853){return _0x41e216(_0x361853);}pm2[_0x535f('0x5')]();return _0x2231fc(_0x46fdd7);});});});};exports[_0x535f('0x6')]=function(_0x546837){return connect()[_0x535f('0x3')](function(){return new BPromise(function(_0x3ebf54,_0x1e1c58){return pm2[_0x535f('0x6')](_0x546837,function(_0x39f1be,_0x2d24cf){if(_0x39f1be){return _0x1e1c58(_0x39f1be);}pm2['disconnect']();return _0x3ebf54(_0x2d24cf);});});});};exports[_0x535f('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x5054da,_0x2bede5){return pm2[_0x535f('0x7')](function(_0x423f95,_0x47e080){if(_0x423f95){return _0x2bede5(_0x423f95);}pm2['disconnect']();return _0x5054da(_0x47e080);});});});};exports[_0x535f('0x8')]=function(_0x4a97fc){return connect()[_0x535f('0x3')](function(){return new BPromise(function(_0x3ea018,_0x592a67){return pm2['describe'](_0x4a97fc,function(_0x899232,_0x571289){if(_0x899232){return _0x592a67(_0x899232);}pm2[_0x535f('0x5')]();return _0x3ea018(_0x571289);});});});};exports[_0x535f('0x9')]=function(_0x2aa879){return connect()[_0x535f('0x3')](function(){return new BPromise(function(_0x629869,_0x3b4f3f){return pm2[_0x535f('0x9')](_0x2aa879,function(_0x2d38f3,_0xdedc3e){if(_0x2d38f3){return _0x3b4f3f(_0x2d38f3);}pm2[_0x535f('0x5')]();return _0x629869(_0xdedc3e);});});});};exports[_0x535f('0xa')]=function(){return connect()[_0x535f('0x3')](function(){return new BPromise(function(_0x86f494,_0x2d3f84){return pm2[_0x535f('0xa')](function(_0xe13d3e){if(_0xe13d3e){return _0x2d3f84(_0xe13d3e);}return _0x86f494(_0x535f('0xb'));});});});}; \ No newline at end of file +var _0x6688=['pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved'];(function(_0x377231,_0x44a2b7){var _0x4dd94b=function(_0x44062f){while(--_0x44062f){_0x377231['push'](_0x377231['shift']());}};_0x4dd94b(++_0x44a2b7);}(_0x6688,0x10e));var _0x8668=function(_0x1db418,_0x559073){_0x1db418=_0x1db418-0x0;var _0x8c6f6c=_0x6688[_0x1db418];return _0x8c6f6c;};'use strict';var pm2=require(_0x8668('0x0'));var BPromise=require(_0x8668('0x1'));var config=require(_0x8668('0x2'));function connect(){return new BPromise(function(_0x50da57,_0x41afbf){return pm2[_0x8668('0x3')](function(_0x1932de){if(_0x1932de){return _0x41afbf(_0x1932de);}return _0x50da57(_0x8668('0x4'));});});};exports[_0x8668('0x5')]=function(_0x21922f){return connect()[_0x8668('0x6')](function(){return new BPromise(function(_0x513305,_0x2a6329){return pm2[_0x8668('0x5')](_0x21922f,function(_0x51c691,_0x1b9518){if(_0x51c691){return _0x2a6329(_0x51c691);}pm2[_0x8668('0x7')]();return _0x513305(_0x1b9518);});});});};exports[_0x8668('0x8')]=function(_0x15e42d){return connect()[_0x8668('0x6')](function(){return new BPromise(function(_0x2c15a6,_0x21315c){return pm2[_0x8668('0x8')](_0x15e42d,function(_0x51a0ff,_0x570b45){if(_0x51a0ff){return _0x21315c(_0x51a0ff);}pm2['disconnect']();return _0x2c15a6(_0x570b45);});});});};exports['restart']=function(_0x402c26){return connect()[_0x8668('0x6')](function(){return new BPromise(function(_0x395095,_0x2c0b26){return pm2[_0x8668('0x9')](_0x402c26,function(_0x59dfbc,_0x526199){if(_0x59dfbc){return _0x2c0b26(_0x59dfbc);}pm2[_0x8668('0x7')]();return _0x395095(_0x526199);});});});};exports[_0x8668('0xa')]=function(){return connect()[_0x8668('0x6')](function(){return new BPromise(function(_0x48311a,_0x3c8de8){return pm2[_0x8668('0xa')](function(_0x3626e7,_0x588c09){if(_0x3626e7){return _0x3c8de8(_0x3626e7);}pm2['disconnect']();return _0x48311a(_0x588c09);});});});};exports[_0x8668('0xb')]=function(_0x16fe4b){return connect()[_0x8668('0x6')](function(){return new BPromise(function(_0x20dd0a,_0x5a68f6){return pm2['describe'](_0x16fe4b,function(_0x246506,_0x191220){if(_0x246506){return _0x5a68f6(_0x246506);}pm2[_0x8668('0x7')]();return _0x20dd0a(_0x191220);});});});};exports[_0x8668('0xc')]=function(_0x1ab443){return connect()[_0x8668('0x6')](function(){return new BPromise(function(_0x5ad3a2,_0x455102){return pm2['delete'](_0x1ab443,function(_0x482176,_0x4fb5a2){if(_0x482176){return _0x455102(_0x482176);}pm2['disconnect']();return _0x5ad3a2(_0x4fb5a2);});});});};exports[_0x8668('0xd')]=function(){return connect()[_0x8668('0x6')](function(){return new BPromise(function(_0x2d6a6c,_0x50aea2){return pm2[_0x8668('0xd')](function(_0x585220){if(_0x585220){return _0x50aea2(_0x585220);}return _0x2d6a6c(_0x8668('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index c9b7c55..5a6c198 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 _0x3b81=['start','lodash','moment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','find','chatTimeout','then','findAll','lastMsgAt','subtract','ChatInteraction','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','catch','error'];(function(_0x2994ae,_0x2822cf){var _0x33b413=function(_0x5d74a3){while(--_0x5d74a3){_0x2994ae['push'](_0x2994ae['shift']());}};_0x33b413(++_0x2822cf);}(_0x3b81,0xfe));var _0x13b8=function(_0x3e387b,_0x461cc8){_0x3e387b=_0x3e387b-0x0;var _0x24d5ad=_0x3b81[_0x3e387b];return _0x24d5ad;};'use strict';var _=require(_0x13b8('0x0'));var moment=require(_0x13b8('0x1'));var Redis=require('ioredis');var db=require(_0x13b8('0x2'))['db'];var config=require('../../config/environment');config[_0x13b8('0x3')]=_[_0x13b8('0x4')](config[_0x13b8('0x3')],{'host':_0x13b8('0x5'),'port':0x18eb});var io=require(_0x13b8('0x6'))(new Redis(config[_0x13b8('0x3')]));function closeInteractions(){var _0x2fae2d=0x0;var _0x259f2d=[];return db['Setting'][_0x13b8('0x7')]({'raw':!![],'attributes':['id',_0x13b8('0x8')],'where':{'id':0x1}})[_0x13b8('0x9')](function(_0x46dc84){_0x2fae2d=_0x46dc84[_0x13b8('0x8')];if(_0x2fae2d){return db['ChatInteraction'][_0x13b8('0xa')]({'raw':!![],'attributes':['id',_0x13b8('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x13b8('0xc')](_0x46dc84[_0x13b8('0x8')],'minutes')}}});}else{return[];}})[_0x13b8('0x9')](function(_0x30feba){_0x259f2d=_0x30feba;if(_0x2fae2d){return db[_0x13b8('0xd')][_0x13b8('0xe')]({'closeReason':'system','disposition':_0x13b8('0xf'),'closed':!![],'closedAt':moment()[_0x13b8('0x10')](_0x13b8('0x11'))},{'where':{'id':_['map'](_0x259f2d||[],'id')}});}})[_0x13b8('0x9')](function(_0x43f630){for(var _0xc0b5a0=0x0;_0xc0b5a0<_0x259f2d[_0x13b8('0x12')];_0xc0b5a0++){io[_0x13b8('0x13')]('chatInteraction:update',{'id':_0x259f2d[_0xc0b5a0]['id'],'closed':!![]});}})[_0x13b8('0x14')](function(_0x25206b){console[_0x13b8('0x15')](_0x25206b);});}exports[_0x13b8('0x16')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xbcd0=['start','lodash','moment','../../mysqldb','../../config/environment','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','chatInteraction:update','catch','error'];(function(_0x555ea8,_0x4f0c19){var _0x543af4=function(_0x265d2f){while(--_0x265d2f){_0x555ea8['push'](_0x555ea8['shift']());}};_0x543af4(++_0x4f0c19);}(_0xbcd0,0x8b));var _0x0bcd=function(_0x428d49,_0x59f03c){_0x428d49=_0x428d49-0x0;var _0x3ff07c=_0xbcd0[_0x428d49];return _0x3ff07c;};'use strict';var _=require(_0x0bcd('0x0'));var moment=require(_0x0bcd('0x1'));var Redis=require('ioredis');var db=require(_0x0bcd('0x2'))['db'];var config=require(_0x0bcd('0x3'));config[_0x0bcd('0x4')]=_['defaults'](config[_0x0bcd('0x4')],{'host':_0x0bcd('0x5'),'port':0x18eb});var io=require(_0x0bcd('0x6'))(new Redis(config[_0x0bcd('0x4')]));function closeInteractions(){var _0x105e5e=0x0;var _0x496075=[];return db[_0x0bcd('0x7')][_0x0bcd('0x8')]({'raw':!![],'attributes':['id',_0x0bcd('0x9')],'where':{'id':0x1}})[_0x0bcd('0xa')](function(_0x18db65){_0x105e5e=_0x18db65['chatTimeout'];if(_0x105e5e){return db[_0x0bcd('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x0bcd('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x18db65[_0x0bcd('0x9')],'minutes')}}});}else{return[];}})[_0x0bcd('0xa')](function(_0x2d25c3){_0x496075=_0x2d25c3;if(_0x105e5e){return db['ChatInteraction'][_0x0bcd('0xd')]({'closeReason':_0x0bcd('0xe'),'disposition':_0x0bcd('0xf'),'closed':!![],'closedAt':moment()[_0x0bcd('0x10')](_0x0bcd('0x11'))},{'where':{'id':_['map'](_0x496075||[],'id')}});}})[_0x0bcd('0xa')](function(_0x136547){for(var _0x3201b5=0x0;_0x3201b5<_0x496075[_0x0bcd('0x12')];_0x3201b5++){io['emit'](_0x0bcd('0x13'),{'id':_0x496075[_0x3201b5]['id'],'closed':!![]});}})[_0x0bcd('0x14')](function(_0x258a35){console[_0x0bcd('0x15')](_0x258a35);});}exports[_0x0bcd('0x16')]=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 60ec3fa..2c4659e 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 _0x3c2e=['sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','stringify','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','intersection','difference','exists','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','stop\x20cron','update','update\x20cron','run','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','name','email','bcc','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','join','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a'];(function(_0x4d70df,_0x2ef178){var _0xc0d57c=function(_0x1ab8cd){while(--_0x1ab8cd){_0x4d70df['push'](_0x4d70df['shift']());}};_0xc0d57c(++_0x2ef178);}(_0x3c2e,0x1b4));var _0xe3c2=function(_0xdd5f8d,_0x31c56f){_0xdd5f8d=_0xdd5f8d-0x0;var _0x416989=_0x3c2e[_0xdd5f8d];return _0x416989;};'use strict';var fs=require('fs');var util=require(_0xe3c2('0x0'));var path=require('path');var _=require(_0xe3c2('0x1'));var moment=require(_0xe3c2('0x2'));var CronJobManager=require(_0xe3c2('0x3'));var jayson=require(_0xe3c2('0x4'));var BPromise=require(_0xe3c2('0x5'));var logger=require('../logger')(_0xe3c2('0x6'));var db=require(_0xe3c2('0x7'))['db'];var analyticCustomReportController=require(_0xe3c2('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xe3c2('0x9')][_0xe3c2('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x756e84,_0x5b4bd1){return function(){logger[_0xe3c2('0xb')](_0xe3c2('0xc'),_0x756e84['email']);var _0xec1ca8=!![];var _0x59c11f={'tls':{'rejectUnauthorized':![]}};if(_0x756e84[_0xe3c2('0xd')][_0xe3c2('0xe')][_0xe3c2('0xf')]){_0x59c11f['service']=_0x756e84[_0xe3c2('0xd')][_0xe3c2('0xe')][_0xe3c2('0xf')];}else{_0x59c11f['host']=_0x756e84['MailAccount']['Smtp'][_0xe3c2('0x10')];_0x59c11f[_0xe3c2('0x11')]=_0x756e84[_0xe3c2('0xd')][_0xe3c2('0xe')]['port'];_0x59c11f[_0xe3c2('0x12')]=_0x756e84[_0xe3c2('0xd')][_0xe3c2('0xe')][_0xe3c2('0x12')];}if(_0x756e84['MailAccount'][_0xe3c2('0xe')][_0xe3c2('0x13')]){_0x59c11f[_0xe3c2('0x14')]={'user':_0x756e84['MailAccount'][_0xe3c2('0xe')][_0xe3c2('0x15')],'pass':_0x756e84['MailAccount'][_0xe3c2('0xe')][_0xe3c2('0x16')]};}var _0xd3994f={'account':_0x59c11f,'message':{'from':util[_0xe3c2('0x17')]('\x22%s\x22\x20<%s>',_0x756e84['MailAccount'][_0xe3c2('0x18')],_0x756e84['MailAccount'][_0xe3c2('0x19')]||_0x756e84[_0xe3c2('0xd')][_0xe3c2('0xe')][_0xe3c2('0x15')]),'to':_0x756e84[_0xe3c2('0x19')],'cc':_0x756e84['cc'],'bcc':_0x756e84[_0xe3c2('0x1a')],'subject':util[_0xe3c2('0x17')]('Report\x20%s\x20last\x20%s\x20%s',_0x5b4bd1[_0xe3c2('0x18')],_0x756e84[_0xe3c2('0x1b')],_0x756e84[_0xe3c2('0x1c')])}};var _0x11106f=path['join'](__dirname,_0xe3c2('0x1d'));var _0x3c90af=_0x5b4bd1[_0xe3c2('0x1e')];var _0x367e77=util[_0xe3c2('0x17')](_0xe3c2('0x1f'),path[_0xe3c2('0x20')](_0x5b4bd1[_0xe3c2('0x1e')],path[_0xe3c2('0x21')](_0x5b4bd1[_0xe3c2('0x1e')])),_0xe3c2('0x22'));var _0x273f4e=path[_0xe3c2('0x23')](_0x11106f,_0x3c90af);var _0x4594d1=path[_0xe3c2('0x23')](_0x11106f,_0x367e77);if(fs[_0xe3c2('0x24')](_0x273f4e)){_0x5b4bd1[_0xe3c2('0x25')]=_0xe3c2('0x26');_0xd3994f[_0xe3c2('0x27')]['attachments']=[{'filename':_0x3c90af,'path':_0x273f4e}];_0xd3994f[_0xe3c2('0x27')][_0xe3c2('0x28')]=util[_0xe3c2('0x17')](_0xe3c2('0x29'),JSON['stringify'](_0x5b4bd1,null,0x2));}else if(fs[_0xe3c2('0x24')](_0x4594d1)){_0x5b4bd1['status']=_0xe3c2('0x26');_0xd3994f['message'][_0xe3c2('0x2a')]=[{'filename':_0x367e77,'path':_0x4594d1}];}else{_0xd3994f[_0xe3c2('0x27')][_0xe3c2('0x28')]=_0xe3c2('0x2b');if(!_0x756e84[_0xe3c2('0x2c')]){_0xec1ca8=![];logger[_0xe3c2('0xb')](_0xe3c2('0x2d'));}}if(_0xec1ca8){return client[_0xe3c2('0x2e')](_0xe3c2('0x2f'),_0xd3994f)[_0xe3c2('0x30')](function(_0x3ad999){if(_0x3ad999[_0xe3c2('0x31')]){return logger[_0xe3c2('0x31')]('error\x20mail',JSON[_0xe3c2('0x32')](_0x3ad999));}return logger['info'](_0xe3c2('0x33'));})['catch'](function(_0x3c9fe3){return logger['error']('error\x20mail',JSON[_0xe3c2('0x32')](_0x3c9fe3));});}};}function handleError(){return function(_0x23facb){return logger['error'](JSON[_0xe3c2('0x32')](_0x23facb));};}function handleResult(_0x2b3fe4){return function(_0x5da321){logger[_0xe3c2('0xb')](_0xe3c2('0x34'),JSON[_0xe3c2('0x32')](_0x5da321));if(_0x2b3fe4[_0xe3c2('0xd')]&&_0x2b3fe4[_0xe3c2('0xd')][_0xe3c2('0xe')]&&!_[_0xe3c2('0x35')](_0x2b3fe4['email'])){setTimeout(handleSendEmail(_0x2b3fe4,_0x5da321),0x3c*0x3e8);}};}function handleJob(_0x6048ce){return function(){try{if(_[_0xe3c2('0x35')](_0x6048ce[_0xe3c2('0x1b')])){return logger['info'](_0xe3c2('0x36'));}if(_[_0xe3c2('0x35')](_0x6048ce[_0xe3c2('0x1c')])){return logger['info'](_0xe3c2('0x37'));}var _0x4a6bf2={'startDate':moment()[_0xe3c2('0x38')](_0x6048ce[_0xe3c2('0x1b')],_0x6048ce[_0xe3c2('0x1c')])[_0xe3c2('0x17')](_0xe3c2('0x39')),'endDate':moment()[_0xe3c2('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x6048ce[_0xe3c2('0x3a')],'name':_0x6048ce[_0xe3c2('0x18')]};if(!_[_0xe3c2('0x35')](_0x6048ce[_0xe3c2('0x3b')])){logger[_0xe3c2('0xb')](_0xe3c2('0x3c'),_0x6048ce[_0xe3c2('0x3b')]);return analyticDefaultReportController[_0xe3c2('0x3d')]({'id':_0x6048ce[_0xe3c2('0x3b')]},_0x4a6bf2)[_0xe3c2('0x30')](handleResult(_0x6048ce))[_0xe3c2('0x3e')](handleError());}if(!_[_0xe3c2('0x35')](_0x6048ce['CustomReportId'])){logger[_0xe3c2('0xb')](_0xe3c2('0x3f'),_0x6048ce['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x6048ce[_0xe3c2('0x40')]},_0x4a6bf2)[_0xe3c2('0x30')](handleResult(_0x6048ce))[_0xe3c2('0x3e')](handleError());}}catch(_0x5abbcf){logger[_0xe3c2('0x31')](JSON[_0xe3c2('0x32')](_0x5abbcf));}return logger[_0xe3c2('0xb')](_0xe3c2('0x41'));};}function getJobs(_0x9d4722){var _0x39acf9={};if(_0x9d4722){_0x39acf9['id']=_0x9d4722;}return db[_0xe3c2('0x42')][_0xe3c2('0x43')]({'where':_0x39acf9,'include':[{'model':db[_0xe3c2('0xd')],'attributes':['id',_0xe3c2('0x18'),_0xe3c2('0x19')],'include':[{'model':db[_0xe3c2('0x44')],'as':_0xe3c2('0xe')}]}]})[_0xe3c2('0x30')](function(_0x24b6ed){var _0x582c28=_[_0xe3c2('0x45')](manager[_0xe3c2('0x46')]);var _0x3f873c=_[_0xe3c2('0x47')](_0x24b6ed,function(_0x5c5f1a){return _0x5c5f1a['id'][_0xe3c2('0x48')]();});var _0x2c69b6=_['keyBy'](_0x24b6ed,function(_0x328502){return _0x328502['id']['toString']();});var _0x195a50=_0x9d4722?_0x3f873c:_['difference'](_0x3f873c,_0x582c28);var _0x529c90=_[_0xe3c2('0x49')](_0x3f873c,_0x582c28);var _0x17d75e=_[_0xe3c2('0x4a')](_0x582c28,_0x3f873c);var _0x87c5e6;var _0x1f5562;for(_0x87c5e6=0x0;_0x87c5e6<_0x17d75e['length']&&!_0x9d4722;_0x87c5e6+=0x1){_0x1f5562=_0x17d75e[_0x87c5e6]['toString']();if(manager[_0xe3c2('0x4b')](_0x1f5562)){manager[_0xe3c2('0x4c')](_0x1f5562);manager[_0xe3c2('0x4d')](_0x1f5562);logger[_0xe3c2('0xb')](_0xe3c2('0x4e'),_0x1f5562);}}logger[_0xe3c2('0xb')](_0xe3c2('0x4f'),JSON[_0xe3c2('0x32')](_0x195a50));for(_0x87c5e6=0x0;_0x87c5e6<_0x195a50[_0xe3c2('0x50')];_0x87c5e6+=0x1){_0x1f5562=_0x195a50[_0x87c5e6][_0xe3c2('0x48')]();logger['info'](_0xe3c2('0x51'),_0x1f5562);if(_0x9d4722){logger[_0xe3c2('0xb')](_0xe3c2('0x52'),_0x9d4722);logger['info'](JSON['stringify'](_0x2c69b6[_0x1f5562]));BPromise[_0xe3c2('0x53')]()[_0xe3c2('0x30')](handleJob(_0x2c69b6[_0x1f5562]));logger[_0xe3c2('0xb')](_0xe3c2('0x54'),_0x2c69b6[_0x1f5562]['name'],_0x2c69b6[_0x1f5562][_0xe3c2('0x55')]);}else if(_0x2c69b6[_0x1f5562][_0xe3c2('0x55')]&&_0x2c69b6[_0x1f5562][_0xe3c2('0x56')]&&moment()[_0xe3c2('0x57')](_0x2c69b6[_0x1f5562][_0xe3c2('0x58')],_0x2c69b6[_0x1f5562][_0xe3c2('0x59')])){manager['add'](_0x1f5562,_0x2c69b6[_0x1f5562][_0xe3c2('0x55')],handleJob(_0x2c69b6[_0x1f5562]));manager[_0xe3c2('0x5a')](_0x1f5562);logger[_0xe3c2('0xb')](_0xe3c2('0x5b'),_0x2c69b6[_0x1f5562][_0xe3c2('0x18')],_0x2c69b6[_0x1f5562]['cron']);}else if(manager[_0xe3c2('0x4b')](_0x1f5562)){manager['stop'](_0x1f5562);manager[_0xe3c2('0x4d')](_0x1f5562);logger[_0xe3c2('0xb')](_0xe3c2('0x5c'),_0x2c69b6[_0x1f5562][_0xe3c2('0x18')],_0x2c69b6[_0x1f5562][_0xe3c2('0x55')]);}}for(_0x87c5e6=0x0,_0x1f5562;_0x87c5e6<_0x529c90['length']&&!_0x9d4722;_0x87c5e6+=0x1){_0x1f5562=_0x529c90[_0x87c5e6][_0xe3c2('0x48')]();if(manager[_0xe3c2('0x4b')](_0x1f5562)){if(_0x2c69b6[_0x1f5562][_0xe3c2('0x55')]&&_0x2c69b6[_0x1f5562][_0xe3c2('0x56')]&&moment()['isBetween'](_0x2c69b6[_0x1f5562]['startAt'],_0x2c69b6[_0x1f5562][_0xe3c2('0x59')])){manager[_0xe3c2('0x5d')](_0x1f5562,_0x2c69b6[_0x1f5562]['cron'],handleJob(_0x2c69b6[_0x1f5562]));logger[_0xe3c2('0xb')](_0xe3c2('0x5e'),_0x2c69b6[_0x1f5562]['name'],_0x2c69b6[_0x1f5562]['cron']);}else{manager[_0xe3c2('0x4c')](_0x1f5562);manager[_0xe3c2('0x4d')](_0x1f5562);logger[_0xe3c2('0xb')]('stop\x20cron',_0x2c69b6[_0x1f5562]['name'],_0x2c69b6[_0x1f5562][_0xe3c2('0x55')]);}}}})[_0xe3c2('0x3e')](function(_0x45830d){logger[_0xe3c2('0x31')](JSON[_0xe3c2('0x32')](_0x45830d));});}exports[_0xe3c2('0x5f')]=function(_0x35e0cc){return getJobs(_0x35e0cc);};exports[_0xe3c2('0x5a')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x69b1=['jobs','map','toString','intersection','difference','length','stop','deleteJob','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','exists','update','stop\x20cron','run','util','path','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','MailAccount','host','port','secure','user','pass','format','\x22%s\x22\x20<%s>','name','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','keys'];(function(_0x5c6c62,_0x3f79f0){var _0x217d24=function(_0x8aea17){while(--_0x8aea17){_0x5c6c62['push'](_0x5c6c62['shift']());}};_0x217d24(++_0x3f79f0);}(_0x69b1,0x170));var _0x169b=function(_0x1b31a1,_0x2a8b9a){_0x1b31a1=_0x1b31a1-0x0;var _0x26c40e=_0x69b1[_0x1b31a1];return _0x26c40e;};'use strict';var fs=require('fs');var util=require(_0x169b('0x0'));var path=require(_0x169b('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0x169b('0x2'));var jayson=require(_0x169b('0x3'));var BPromise=require('bluebird');var logger=require(_0x169b('0x4'))(_0x169b('0x5'));var db=require(_0x169b('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x169b('0x7'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x112c47,_0xafae21){return function(){logger['info'](_0x169b('0x8'),_0x112c47[_0x169b('0x9')]);var _0x7b5915=!![];var _0x3f326f={'tls':{'rejectUnauthorized':![]}};if(_0x112c47['MailAccount'][_0x169b('0xa')][_0x169b('0xb')]){_0x3f326f[_0x169b('0xb')]=_0x112c47[_0x169b('0xc')][_0x169b('0xa')][_0x169b('0xb')];}else{_0x3f326f[_0x169b('0xd')]=_0x112c47[_0x169b('0xc')][_0x169b('0xa')]['host'];_0x3f326f[_0x169b('0xe')]=_0x112c47['MailAccount'][_0x169b('0xa')][_0x169b('0xe')];_0x3f326f['secure']=_0x112c47['MailAccount'][_0x169b('0xa')][_0x169b('0xf')];}if(_0x112c47[_0x169b('0xc')][_0x169b('0xa')]['authentication']){_0x3f326f['auth']={'user':_0x112c47[_0x169b('0xc')][_0x169b('0xa')][_0x169b('0x10')],'pass':_0x112c47[_0x169b('0xc')][_0x169b('0xa')][_0x169b('0x11')]};}var _0x503b32={'account':_0x3f326f,'message':{'from':util[_0x169b('0x12')](_0x169b('0x13'),_0x112c47[_0x169b('0xc')][_0x169b('0x14')],_0x112c47[_0x169b('0xc')][_0x169b('0x9')]||_0x112c47[_0x169b('0xc')][_0x169b('0xa')][_0x169b('0x10')]),'to':_0x112c47['email'],'cc':_0x112c47['cc'],'bcc':_0x112c47['bcc'],'subject':util['format'](_0x169b('0x15'),_0xafae21[_0x169b('0x14')],_0x112c47[_0x169b('0x16')],_0x112c47['subtractUnit'])}};var _0x463de9=path[_0x169b('0x17')](__dirname,_0x169b('0x18'));var _0xb7b1c1=_0xafae21[_0x169b('0x19')];var _0x4b0caa=util['format'](_0x169b('0x1a'),path[_0x169b('0x1b')](_0xafae21[_0x169b('0x19')],path[_0x169b('0x1c')](_0xafae21['savename'])),'zip');var _0x420019=path[_0x169b('0x17')](_0x463de9,_0xb7b1c1);var _0x322d7c=path[_0x169b('0x17')](_0x463de9,_0x4b0caa);if(fs['existsSync'](_0x420019)){_0xafae21[_0x169b('0x1d')]=_0x169b('0x1e');_0x503b32[_0x169b('0x1f')][_0x169b('0x20')]=[{'filename':_0xb7b1c1,'path':_0x420019}];_0x503b32[_0x169b('0x1f')]['text']=util[_0x169b('0x12')](_0x169b('0x21'),JSON[_0x169b('0x22')](_0xafae21,null,0x2));}else if(fs['existsSync'](_0x322d7c)){_0xafae21[_0x169b('0x1d')]=_0x169b('0x1e');_0x503b32[_0x169b('0x1f')]['attachments']=[{'filename':_0x4b0caa,'path':_0x322d7c}];}else{_0x503b32['message']['text']=_0x169b('0x23');if(!_0x112c47['sendIfEmpty']){_0x7b5915=![];logger[_0x169b('0x24')](_0x169b('0x25'));}}if(_0x7b5915){return client[_0x169b('0x26')](_0x169b('0x27'),_0x503b32)[_0x169b('0x28')](function(_0x283516){if(_0x283516[_0x169b('0x29')]){return logger['error'](_0x169b('0x2a'),JSON[_0x169b('0x22')](_0x283516));}return logger['info'](_0x169b('0x2b'));})[_0x169b('0x2c')](function(_0x35a4ea){return logger[_0x169b('0x29')](_0x169b('0x2a'),JSON['stringify'](_0x35a4ea));});}};}function handleError(){return function(_0x30a0c1){return logger[_0x169b('0x29')](JSON[_0x169b('0x22')](_0x30a0c1));};}function handleResult(_0x39c7b1){return function(_0x52370a){logger[_0x169b('0x24')](_0x169b('0x2d'),JSON[_0x169b('0x22')](_0x52370a));if(_0x39c7b1[_0x169b('0xc')]&&_0x39c7b1['MailAccount'][_0x169b('0xa')]&&!_[_0x169b('0x2e')](_0x39c7b1[_0x169b('0x9')])){setTimeout(handleSendEmail(_0x39c7b1,_0x52370a),0x3c*0x3e8);}};}function handleJob(_0x232d98){return function(){try{if(_[_0x169b('0x2e')](_0x232d98[_0x169b('0x16')])){return logger[_0x169b('0x24')](_0x169b('0x2f'));}if(_[_0x169b('0x2e')](_0x232d98[_0x169b('0x30')])){return logger[_0x169b('0x24')](_0x169b('0x31'));}var _0x426a1e={'startDate':moment()['subtract'](_0x232d98[_0x169b('0x16')],_0x232d98[_0x169b('0x30')])[_0x169b('0x12')](_0x169b('0x32')),'endDate':moment()[_0x169b('0x12')](_0x169b('0x32')),'type':_0x169b('0x33'),'output':_0x232d98[_0x169b('0x34')],'name':_0x232d98[_0x169b('0x14')]};if(!_[_0x169b('0x2e')](_0x232d98[_0x169b('0x35')])){logger[_0x169b('0x24')](_0x169b('0x36'),_0x232d98['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x232d98['DefaultReportId']},_0x426a1e)['then'](handleResult(_0x232d98))[_0x169b('0x2c')](handleError());}if(!_[_0x169b('0x2e')](_0x232d98[_0x169b('0x37')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x232d98['CustomReportId']);return analyticCustomReportController[_0x169b('0x38')]({'id':_0x232d98[_0x169b('0x37')]},_0x426a1e)['then'](handleResult(_0x232d98))['catch'](handleError());}}catch(_0x39b26a){logger['error'](JSON[_0x169b('0x22')](_0x39b26a));}return logger[_0x169b('0x24')](_0x169b('0x39'));};}function getJobs(_0x56ea34){var _0x1a15ea={};if(_0x56ea34){_0x1a15ea['id']=_0x56ea34;}return db[_0x169b('0x3a')][_0x169b('0x3b')]({'where':_0x1a15ea,'include':[{'model':db[_0x169b('0xc')],'attributes':['id',_0x169b('0x14'),_0x169b('0x9')],'include':[{'model':db[_0x169b('0x3c')],'as':'Smtp'}]}]})[_0x169b('0x28')](function(_0x33006c){var _0x2c3cb7=_[_0x169b('0x3d')](manager[_0x169b('0x3e')]);var _0x2e370a=_[_0x169b('0x3f')](_0x33006c,function(_0x546148){return _0x546148['id'][_0x169b('0x40')]();});var _0x1979f0=_['keyBy'](_0x33006c,function(_0x54393d){return _0x54393d['id']['toString']();});var _0x5ae945=_0x56ea34?_0x2e370a:_['difference'](_0x2e370a,_0x2c3cb7);var _0x10ef18=_[_0x169b('0x41')](_0x2e370a,_0x2c3cb7);var _0x217fc4=_[_0x169b('0x42')](_0x2c3cb7,_0x2e370a);var _0x36270f;var _0x3fa52f;for(_0x36270f=0x0;_0x36270f<_0x217fc4[_0x169b('0x43')]&&!_0x56ea34;_0x36270f+=0x1){_0x3fa52f=_0x217fc4[_0x36270f][_0x169b('0x40')]();if(manager['exists'](_0x3fa52f)){manager[_0x169b('0x44')](_0x3fa52f);manager[_0x169b('0x45')](_0x3fa52f);logger[_0x169b('0x24')](_0x169b('0x46'),_0x3fa52f);}}logger[_0x169b('0x24')](_0x169b('0x47'),JSON[_0x169b('0x22')](_0x5ae945));for(_0x36270f=0x0;_0x36270f<_0x5ae945[_0x169b('0x43')];_0x36270f+=0x1){_0x3fa52f=_0x5ae945[_0x36270f][_0x169b('0x40')]();logger[_0x169b('0x24')]('index',_0x3fa52f);if(_0x56ea34){logger[_0x169b('0x24')](_0x169b('0x48'),_0x56ea34);logger[_0x169b('0x24')](JSON[_0x169b('0x22')](_0x1979f0[_0x3fa52f]));BPromise[_0x169b('0x49')]()[_0x169b('0x28')](handleJob(_0x1979f0[_0x3fa52f]));logger[_0x169b('0x24')](_0x169b('0x4a'),_0x1979f0[_0x3fa52f][_0x169b('0x14')],_0x1979f0[_0x3fa52f][_0x169b('0x4b')]);}else if(_0x1979f0[_0x3fa52f][_0x169b('0x4b')]&&_0x1979f0[_0x3fa52f][_0x169b('0x4c')]&&moment()[_0x169b('0x4d')](_0x1979f0[_0x3fa52f][_0x169b('0x4e')],_0x1979f0[_0x3fa52f][_0x169b('0x4f')])){manager[_0x169b('0x50')](_0x3fa52f,_0x1979f0[_0x3fa52f][_0x169b('0x4b')],handleJob(_0x1979f0[_0x3fa52f]));manager[_0x169b('0x51')](_0x3fa52f);logger[_0x169b('0x24')]('add\x20cron',_0x1979f0[_0x3fa52f][_0x169b('0x14')],_0x1979f0[_0x3fa52f][_0x169b('0x4b')]);}else if(manager[_0x169b('0x52')](_0x3fa52f)){manager[_0x169b('0x44')](_0x3fa52f);manager[_0x169b('0x45')](_0x3fa52f);logger[_0x169b('0x24')]('stop\x20cron',_0x1979f0[_0x3fa52f]['name'],_0x1979f0[_0x3fa52f][_0x169b('0x4b')]);}}for(_0x36270f=0x0,_0x3fa52f;_0x36270f<_0x10ef18['length']&&!_0x56ea34;_0x36270f+=0x1){_0x3fa52f=_0x10ef18[_0x36270f][_0x169b('0x40')]();if(manager[_0x169b('0x52')](_0x3fa52f)){if(_0x1979f0[_0x3fa52f]['cron']&&_0x1979f0[_0x3fa52f][_0x169b('0x4c')]&&moment()[_0x169b('0x4d')](_0x1979f0[_0x3fa52f][_0x169b('0x4e')],_0x1979f0[_0x3fa52f]['endAt'])){manager[_0x169b('0x53')](_0x3fa52f,_0x1979f0[_0x3fa52f]['cron'],handleJob(_0x1979f0[_0x3fa52f]));logger[_0x169b('0x24')]('update\x20cron',_0x1979f0[_0x3fa52f]['name'],_0x1979f0[_0x3fa52f]['cron']);}else{manager['stop'](_0x3fa52f);manager[_0x169b('0x45')](_0x3fa52f);logger['info'](_0x169b('0x54'),_0x1979f0[_0x3fa52f][_0x169b('0x14')],_0x1979f0[_0x3fa52f][_0x169b('0x4b')]);}}}})[_0x169b('0x2c')](function(_0x1f7c29){logger[_0x169b('0x29')](JSON[_0x169b('0x22')](_0x1f7c29));});}exports[_0x169b('0x55')]=function(_0x5f2ec0){return getJobs(_0x5f2ec0);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index e2b8933..3df395f 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 _0xc43d=['[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','Sentiment','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','error','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info'];(function(_0x17df7f,_0x1cd9e4){var _0x3ba5b0=function(_0x34fad9){while(--_0x34fad9){_0x17df7f['push'](_0x17df7f['shift']());}};_0x3ba5b0(++_0x1cd9e4);}(_0xc43d,0x1b0));var _0xdc43=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0xc43d[_0x2f5a22];return _0x326b70;};var _=require(_0xdc43('0x0'));var AWS=require(_0xdc43('0x1'));var rp=require(_0xdc43('0x2'));var util=require(_0xdc43('0x3'));var BPromise=require('bluebird');var db=require(_0xdc43('0x4'))['db'];var logger=require(_0xdc43('0x5'))(_0xdc43('0x6'));function getTranscriptionJob(_0x1c534e,_0x3fe7ed,_0x154d41,_0x2dcf16){return new Promise(function(_0x521e53,_0x88e1ea){var _0x1c30f1=new AWS[(_0xdc43('0x7'))]({'accessKeyId':_0x3fe7ed,'secretAccessKey':_0x1c534e,'region':_0x154d41});_0x1c30f1[_0xdc43('0x8')]({'TranscriptionJobName':_0x2dcf16},function(_0x482bc5,_0x5b1824){if(_0x482bc5){return _0x88e1ea(_0x482bc5);}else{return _0x521e53(_0x5b1824);}});});}function sentiment(_0x3f2d4d,_0x47ea56,_0x30095b,_0x40f8c9,_0x4f14bd){return new Promise(function(_0x5d5a26,_0x16d9dc){var _0x263ee3=new AWS[(_0xdc43('0x9'))]({'accessKeyId':_0x47ea56,'secretAccessKey':_0x3f2d4d,'region':_0x30095b});_0x263ee3[_0xdc43('0xa')]({'Text':_0x40f8c9,'LanguageCode':_0x4f14bd['substring'](0x0,0x2)},function(_0x2efb56,_0x1721bc){if(_0x2efb56){return _0x16d9dc(_0x2efb56);}else{return _0x5d5a26(_0x1721bc);}});});}function checkTranscribeJob(_0x4ca6a5,_0x7f010f,_0x198087){var _0x4739ed;return new BPromise(function(_0x4e8a00,_0x20e266){logger[_0xdc43('0xb')](util['format'](_0xdc43('0xc'),_0x4ca6a5['id'],_0x4ca6a5['transcribeName']));return getTranscriptionJob(_0x198087[_0xdc43('0xd')],_0x198087['data2'],_0x7f010f[_0xdc43('0xe')],_0x4ca6a5['transcribeName'])[_0xdc43('0xf')](function(_0x2d53c3){logger['info'](util[_0xdc43('0x10')](_0xdc43('0x11'),_0x4ca6a5['id'],_0x4ca6a5[_0xdc43('0x12')],_0x2d53c3[_0xdc43('0x13')][_0xdc43('0x14')]));if(!_0x4ca6a5[_0xdc43('0x15')]){switch(_0x2d53c3[_0xdc43('0x13')][_0xdc43('0x14')]){case _0xdc43('0x16'):var _0x22742e={'transcribeStatus':_0x2d53c3[_0xdc43('0x13')][_0xdc43('0x14')],'fileUri':_0x2d53c3[_0xdc43('0x13')]['Transcript'][_0xdc43('0x17')]};logger[_0xdc43('0xb')](util[_0xdc43('0x10')](_0xdc43('0x18'),_0x4ca6a5['id']));return rp({'uri':_0x2d53c3[_0xdc43('0x13')]['Transcript'][_0xdc43('0x17')],'json':!![]})[_0xdc43('0xf')](function(_0x4e5f2a){logger[_0xdc43('0xb')](util['format'](_0xdc43('0x19'),_0x4ca6a5['id']));if(_0x4e5f2a&&_0x4e5f2a['results']&&_0x4e5f2a['results'][_0xdc43('0x1a')]&&_0x4e5f2a[_0xdc43('0x1b')]['transcripts'][_0xdc43('0x1c')]){_0x22742e[_0xdc43('0x15')]='';for(var _0x22f5f4=0x0;_0x22f5f4<_0x4e5f2a[_0xdc43('0x1b')][_0xdc43('0x1a')][_0xdc43('0x1c')];_0x22f5f4++){_0x22742e[_0xdc43('0x15')]+=_0x4e5f2a['results'][_0xdc43('0x1a')][_0x22f5f4][_0xdc43('0x1d')]+'';}}return _0x4ca6a5['update'](_0x22742e);})[_0xdc43('0xf')](function(){logger[_0xdc43('0xb')](util[_0xdc43('0x10')](_0xdc43('0x1e'),_0x4ca6a5['id']));if(!_0x4ca6a5[_0xdc43('0x1f')]){throw new db[(_0xdc43('0x20'))][(_0xdc43('0x21'))](_0xdc43('0x22'));}if(!_0x7f010f[_0xdc43('0x23')]||!_0x7f010f[_0xdc43('0x24')]||!_0x7f010f[_0xdc43('0x25')]||!_0x7f010f[_0xdc43('0x26')]||!_0x7f010f[_0xdc43('0x27')]){throw new db[(_0xdc43('0x20'))][(_0xdc43('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x22742e[_0xdc43('0x15')]){throw new Error(_0xdc43('0x28'));}if(_0x7f010f[_0xdc43('0x24')]===_0x198087['id']){return _0x198087;}else{return db[_0xdc43('0x29')][_0xdc43('0x2a')]({'where':{'id':_settings[_0xdc43('0x24')]}});}})['then'](function(_0x158ac0){if(!_0x158ac0){throw new db['Sequelize'][(_0xdc43('0x21'))](_0xdc43('0x2b'));}if(!_0x158ac0[_0xdc43('0xd')]||!_0x158ac0[_0xdc43('0x2c')]){throw new db[(_0xdc43('0x20'))][(_0xdc43('0x21'))](_0xdc43('0x2d'));}_0x4739ed=_0x158ac0;logger['info'](util[_0xdc43('0x10')](_0xdc43('0x2e'),_0x4ca6a5['id']));return sentiment(_0x4739ed[_0xdc43('0xd')],_0x4739ed[_0xdc43('0x2c')],_0x7f010f['sentimentRegion'],_0x22742e['fileText'],_0x7f010f['language']);})[_0xdc43('0xf')](function(_0xddfb9b){logger[_0xdc43('0xb')](util[_0xdc43('0x10')](_0xdc43('0x2f'),_0x4ca6a5['id']));return _0x4ca6a5[_0xdc43('0x30')]({'sentiment':_0xddfb9b['Sentiment'],'sPositive':_0xddfb9b[_0xdc43('0x31')][_0xdc43('0x32')],'sNegative':_0xddfb9b['SentimentScore'][_0xdc43('0x33')],'sMixed':_0xddfb9b[_0xdc43('0x31')][_0xdc43('0x34')],'sNeutral':_0xddfb9b['SentimentScore']['Neutral']});})['then'](function(){logger['info'](util[_0xdc43('0x10')](_0xdc43('0x1e'),_0x4ca6a5['id']));_0x4e8a00();});case _0xdc43('0x35'):return _0x4ca6a5[_0xdc43('0x30')]({'transcribeStatus':_0xdc43('0x35'),'failureReason':_0x2d53c3[_0xdc43('0x13')][_0xdc43('0x36')]})['then'](function(){logger[_0xdc43('0xb')](util['format'](_0xdc43('0x1e'),_0x4ca6a5['id']));_0x4e8a00();});default:logger[_0xdc43('0xb')](util[_0xdc43('0x10')](_0xdc43('0x37'),_0x4ca6a5['id']));break;}}else{return BPromise[_0xdc43('0x38')]()['then'](function(){if(!_0x4ca6a5[_0xdc43('0x1f')]){throw new db[(_0xdc43('0x20'))]['ValidationError'](_0xdc43('0x22'));}if(!_0x7f010f['sentiment']||!_0x7f010f['sentimentAccountId']||!_0x7f010f['sentimentRegion']||!_0x7f010f['language']||!_0x7f010f[_0xdc43('0x27')]){throw new db[(_0xdc43('0x20'))]['ValidationError'](_0xdc43('0x39'));}if(!_0x4ca6a5[_0xdc43('0x15')]){throw new Error(_0xdc43('0x28'));}if(_0x7f010f[_0xdc43('0x24')]===_0x198087['id']){return _0x198087;}else{return db[_0xdc43('0x29')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xdc43('0xf')](function(_0x12754b){if(!_0x12754b){throw new db['Sequelize'][(_0xdc43('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x12754b[_0xdc43('0xd')]||!_0x12754b[_0xdc43('0x2c')]){throw new db['Sequelize'][(_0xdc43('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x4739ed=_0x12754b;logger[_0xdc43('0xb')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4ca6a5['id']));return sentiment(_0x4739ed['data1'],_0x4739ed[_0xdc43('0x2c')],_0x7f010f[_0xdc43('0x25')],_0x4ca6a5[_0xdc43('0x15')],_0x7f010f[_0xdc43('0x26')]);})['then'](function(_0x4fe721){logger[_0xdc43('0xb')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4ca6a5['id']));return _0x4ca6a5['update']({'sentiment':_0x4fe721[_0xdc43('0x3a')],'sPositive':_0x4fe721['SentimentScore'][_0xdc43('0x32')],'sNegative':_0x4fe721[_0xdc43('0x31')][_0xdc43('0x33')],'sMixed':_0x4fe721[_0xdc43('0x31')][_0xdc43('0x34')],'sNeutral':_0x4fe721[_0xdc43('0x31')]['Neutral'],'transcribeStatus':_0xdc43('0x16')});})['then'](function(){logger['info'](util[_0xdc43('0x10')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4ca6a5['id']));_0x4e8a00();});}})[_0xdc43('0x3b')](function(_0xb80021){if(_0xb80021){if(!_0xb80021[_0xdc43('0x3c')]||_0xb80021['name']!==_0xdc43('0x3d')){logger['error'](util[_0xdc43('0x10')](_0xdc43('0x3e'),_0x4ca6a5['id']),util[_0xdc43('0x3f')](_0xb80021,{'showHidden':![],'depth':null}));}}_0x4e8a00();});});}function checkTranscribe(){var _0x3be710;var _0x3bb236;var _0x31525c;return db[_0xdc43('0x40')][_0xdc43('0x41')]({'where':{'transcribeStatus':_0xdc43('0x42')}})[_0xdc43('0xf')](function(_0x5c1df0){if(!_0x5c1df0||!_0x5c1df0['length']){throw new db[(_0xdc43('0x20'))]['ValidationError'](_0xdc43('0x43'));}_0x3be710=_0x5c1df0;return db['Setting'][_0xdc43('0x2a')]({'where':{'id':0x1}});})[_0xdc43('0xf')](function(_0x275faf){if(!_0x275faf){throw new db[(_0xdc43('0x20'))][(_0xdc43('0x21'))](_0xdc43('0x44'));}_0x3bb236=_0x275faf;if(!_0x3bb236[_0xdc43('0x6')]||!_0x3bb236[_0xdc43('0x45')]||!_0x3bb236['transcribeRegion']||!_0x3bb236[_0xdc43('0x26')]||!_0x3bb236[_0xdc43('0x27')]){throw new db[(_0xdc43('0x20'))][(_0xdc43('0x21'))](_0xdc43('0x46'));}return db[_0xdc43('0x29')][_0xdc43('0x2a')]({'where':{'id':_0x3bb236[_0xdc43('0x45')]}});})[_0xdc43('0xf')](function(_0x190bfc){if(!_0x190bfc){throw new db[(_0xdc43('0x20'))][(_0xdc43('0x21'))](_0xdc43('0x2b'));}if(!_0x190bfc['data1']||!_0x190bfc[_0xdc43('0x2c')]){throw new db[(_0xdc43('0x20'))][(_0xdc43('0x21'))](_0xdc43('0x2d'));}_0x31525c=_0x190bfc;var _0x210c0c=[];_0x3be710['forEach'](function(_0xdc4597){_0x210c0c[_0xdc43('0x47')](checkTranscribeJob(_0xdc4597,_0x3bb236,_0x31525c));});return BPromise['all'](_0x210c0c);})[_0xdc43('0x3b')](function(_0x5f948a){if(_0x5f948a){if(!_0x5f948a[_0xdc43('0x3c')]||_0x5f948a[_0xdc43('0x3c')]!==_0xdc43('0x3d')){logger[_0xdc43('0x48')](util['inspect'](_0x5f948a,{'showHidden':![],'depth':null}));}}});}exports[_0xdc43('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x9812=['transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Transcript\x20not\x20available','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','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','Mixed','Neutral','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','catch','name','error','start','lodash','aws-sdk','request-promise','util','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','transcribeName','data1','data2'];(function(_0x412ac2,_0xc8dc0b){var _0x39b24d=function(_0x3df919){while(--_0x3df919){_0x412ac2['push'](_0x412ac2['shift']());}};_0x39b24d(++_0xc8dc0b);}(_0x9812,0x159));var _0x2981=function(_0x175395,_0x8bed5b){_0x175395=_0x175395-0x0;var _0x178161=_0x9812[_0x175395];return _0x178161;};var _=require(_0x2981('0x0'));var AWS=require(_0x2981('0x1'));var rp=require(_0x2981('0x2'));var util=require(_0x2981('0x3'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x2981('0x4'))(_0x2981('0x5'));function getTranscriptionJob(_0x4801db,_0x77ef1d,_0x14492b,_0x4a99fc){return new Promise(function(_0xffdceb,_0x109b9e){var _0x7dd589=new AWS[(_0x2981('0x6'))]({'accessKeyId':_0x77ef1d,'secretAccessKey':_0x4801db,'region':_0x14492b});_0x7dd589[_0x2981('0x7')]({'TranscriptionJobName':_0x4a99fc},function(_0x5b8775,_0x31afe0){if(_0x5b8775){return _0x109b9e(_0x5b8775);}else{return _0xffdceb(_0x31afe0);}});});}function sentiment(_0x3654c9,_0x4abe4f,_0x29534d,_0x3ae072,_0xe7f5cc){return new Promise(function(_0x4bbe34,_0x57c1c0){var _0x5df3e5=new AWS[(_0x2981('0x8'))]({'accessKeyId':_0x4abe4f,'secretAccessKey':_0x3654c9,'region':_0x29534d});_0x5df3e5['detectSentiment']({'Text':_0x3ae072,'LanguageCode':_0xe7f5cc[_0x2981('0x9')](0x0,0x2)},function(_0x2aa8be,_0x2c1165){if(_0x2aa8be){return _0x57c1c0(_0x2aa8be);}else{return _0x4bbe34(_0x2c1165);}});});}function checkTranscribeJob(_0x5aabb4,_0x350df8,_0x4f113a){var _0x5a5441;return new BPromise(function(_0x191629,_0x4cab8c){logger[_0x2981('0xa')](util[_0x2981('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5aabb4['id'],_0x5aabb4[_0x2981('0xc')]));return getTranscriptionJob(_0x4f113a[_0x2981('0xd')],_0x4f113a[_0x2981('0xe')],_0x350df8[_0x2981('0xf')],_0x5aabb4[_0x2981('0xc')])['then'](function(_0x1be7ac){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x10'),_0x5aabb4['id'],_0x5aabb4[_0x2981('0xc')],_0x1be7ac[_0x2981('0x11')][_0x2981('0x12')]));if(!_0x5aabb4[_0x2981('0x13')]){switch(_0x1be7ac[_0x2981('0x11')][_0x2981('0x12')]){case _0x2981('0x14'):var _0x4600de={'transcribeStatus':_0x1be7ac[_0x2981('0x11')]['TranscriptionJobStatus'],'fileUri':_0x1be7ac[_0x2981('0x11')][_0x2981('0x15')]['TranscriptFileUri']};logger[_0x2981('0xa')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x5aabb4['id']));return rp({'uri':_0x1be7ac['TranscriptionJob'][_0x2981('0x15')][_0x2981('0x16')],'json':!![]})[_0x2981('0x17')](function(_0x216c1f){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x18'),_0x5aabb4['id']));if(_0x216c1f&&_0x216c1f['results']&&_0x216c1f[_0x2981('0x19')][_0x2981('0x1a')]&&_0x216c1f[_0x2981('0x19')][_0x2981('0x1a')][_0x2981('0x1b')]){_0x4600de[_0x2981('0x13')]='';for(var _0x4bdb8d=0x0;_0x4bdb8d<_0x216c1f[_0x2981('0x19')][_0x2981('0x1a')]['length'];_0x4bdb8d++){_0x4600de[_0x2981('0x13')]+=_0x216c1f[_0x2981('0x19')][_0x2981('0x1a')][_0x4bdb8d]['transcript']+'';}}return _0x5aabb4[_0x2981('0x1c')](_0x4600de);})[_0x2981('0x17')](function(){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x1d'),_0x5aabb4['id']));if(!_0x5aabb4[_0x2981('0x1e')]){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x21'));}if(!_0x350df8[_0x2981('0x22')]||!_0x350df8[_0x2981('0x23')]||!_0x350df8[_0x2981('0x24')]||!_0x350df8['language']||!_0x350df8[_0x2981('0x25')]){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4600de[_0x2981('0x13')]){throw new Error(_0x2981('0x26'));}if(_0x350df8[_0x2981('0x23')]===_0x4f113a['id']){return _0x4f113a;}else{return db[_0x2981('0x27')][_0x2981('0x28')]({'where':{'id':_settings[_0x2981('0x23')]}});}})[_0x2981('0x17')](function(_0x4b791d){if(!_0x4b791d){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x29'));}if(!_0x4b791d[_0x2981('0xd')]||!_0x4b791d[_0x2981('0xe')]){throw new db['Sequelize']['ValidationError'](_0x2981('0x2a'));}_0x5a5441=_0x4b791d;logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x2b'),_0x5aabb4['id']));return sentiment(_0x5a5441['data1'],_0x5a5441[_0x2981('0xe')],_0x350df8[_0x2981('0x24')],_0x4600de['fileText'],_0x350df8[_0x2981('0x2c')]);})[_0x2981('0x17')](function(_0x782735){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x2d'),_0x5aabb4['id']));return _0x5aabb4[_0x2981('0x1c')]({'sentiment':_0x782735[_0x2981('0x2e')],'sPositive':_0x782735['SentimentScore'][_0x2981('0x2f')],'sNegative':_0x782735[_0x2981('0x30')][_0x2981('0x31')],'sMixed':_0x782735[_0x2981('0x30')]['Mixed'],'sNeutral':_0x782735[_0x2981('0x30')]['Neutral']});})[_0x2981('0x17')](function(){logger[_0x2981('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5aabb4['id']));_0x191629();});case _0x2981('0x32'):return _0x5aabb4[_0x2981('0x1c')]({'transcribeStatus':_0x2981('0x32'),'failureReason':_0x1be7ac[_0x2981('0x11')][_0x2981('0x33')]})['then'](function(){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x1d'),_0x5aabb4['id']));_0x191629();});default:logger[_0x2981('0xa')](util['format'](_0x2981('0x34'),_0x5aabb4['id']));break;}}else{return BPromise[_0x2981('0x35')]()[_0x2981('0x17')](function(){if(!_0x5aabb4[_0x2981('0x1e')]){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x21'));}if(!_0x350df8['sentiment']||!_0x350df8[_0x2981('0x23')]||!_0x350df8[_0x2981('0x24')]||!_0x350df8['language']||!_0x350df8[_0x2981('0x25')]){throw new db[(_0x2981('0x1f'))]['ValidationError'](_0x2981('0x36'));}if(!_0x5aabb4[_0x2981('0x13')]){throw new Error(_0x2981('0x26'));}if(_0x350df8[_0x2981('0x23')]===_0x4f113a['id']){return _0x4f113a;}else{return db[_0x2981('0x27')][_0x2981('0x28')]({'where':{'id':_settings[_0x2981('0x23')]}});}})[_0x2981('0x17')](function(_0x213bd2){if(!_0x213bd2){throw new db[(_0x2981('0x1f'))]['ValidationError'](_0x2981('0x29'));}if(!_0x213bd2['data1']||!_0x213bd2['data2']){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x2a'));}_0x5a5441=_0x213bd2;logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x2b'),_0x5aabb4['id']));return sentiment(_0x5a5441['data1'],_0x5a5441[_0x2981('0xe')],_0x350df8[_0x2981('0x24')],_0x5aabb4['fileText'],_0x350df8[_0x2981('0x2c')]);})['then'](function(_0x106c0a){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x2d'),_0x5aabb4['id']));return _0x5aabb4['update']({'sentiment':_0x106c0a[_0x2981('0x2e')],'sPositive':_0x106c0a['SentimentScore'][_0x2981('0x2f')],'sNegative':_0x106c0a['SentimentScore']['Negative'],'sMixed':_0x106c0a['SentimentScore'][_0x2981('0x37')],'sNeutral':_0x106c0a[_0x2981('0x30')][_0x2981('0x38')],'transcribeStatus':_0x2981('0x14')});})[_0x2981('0x17')](function(){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x1d'),_0x5aabb4['id']));_0x191629();});}})['catch'](function(_0x111dad){if(_0x111dad){if(!_0x111dad['name']||_0x111dad['name']!==_0x2981('0x39')){logger['error'](util[_0x2981('0xb')](_0x2981('0x3a'),_0x5aabb4['id']),util[_0x2981('0x3b')](_0x111dad,{'showHidden':![],'depth':null}));}}_0x191629();});});}function checkTranscribe(){var _0x337fa9;var _0xbb2dc8;var _0x36af38;return db[_0x2981('0x3c')]['findAll']({'where':{'transcribeStatus':_0x2981('0x3d')}})['then'](function(_0x522362){if(!_0x522362||!_0x522362[_0x2981('0x1b')]){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x3e'));}_0x337fa9=_0x522362;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](function(_0x4d9724){if(!_0x4d9724){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x3f'));}_0xbb2dc8=_0x4d9724;if(!_0xbb2dc8['transcribe']||!_0xbb2dc8[_0x2981('0x40')]||!_0xbb2dc8[_0x2981('0xf')]||!_0xbb2dc8[_0x2981('0x2c')]||!_0xbb2dc8[_0x2981('0x25')]){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x41'));}return db['CloudProvider'][_0x2981('0x28')]({'where':{'id':_0xbb2dc8[_0x2981('0x40')]}});})[_0x2981('0x17')](function(_0x48bbf4){if(!_0x48bbf4){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x48bbf4[_0x2981('0xd')]||!_0x48bbf4['data2']){throw new db[(_0x2981('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x36af38=_0x48bbf4;var _0x25f493=[];_0x337fa9[_0x2981('0x42')](function(_0x17ab4f){_0x25f493['push'](checkTranscribeJob(_0x17ab4f,_0xbb2dc8,_0x36af38));});return BPromise[_0x2981('0x43')](_0x25f493);})[_0x2981('0x44')](function(_0x436951){if(_0x436951){if(!_0x436951[_0x2981('0x45')]||_0x436951[_0x2981('0x45')]!==_0x2981('0x39')){logger[_0x2981('0x46')](util[_0x2981('0x3b')](_0x436951,{'showHidden':![],'depth':null}));}}});}exports[_0x2981('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 3382abd..eb65aed 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x65b4=['innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','catch','util','../mysqldb','push','Innocenzo','Biondo'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x65b4,0x13f));var _0x465b=function(_0x919116,_0x690d49){_0x919116=_0x919116-0x0;var _0x1830e9=_0x65b4[_0x919116];return _0x1830e9;};'use strict';var util=require(_0x465b('0x0'));var db=require(_0x465b('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x465b('0x2')]({'id':i,'firstName':_0x465b('0x3')+i,'lastName':_0x465b('0x4')+i,'phone':0xf879fb460+i,'email':_0x465b('0x5')+i+_0x465b('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x465b('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x465b('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x465b('0x7')](),'updatedAt':Date[_0x465b('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x465b('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x465b('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x465b('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x465b('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x465b('0x7')](),'updatedAt':Date[_0x465b('0x7')]()});}db[_0x465b('0x8')][_0x465b('0x9')]({'where':{}})[_0x465b('0xa')](function(){return db[_0x465b('0x8')][_0x465b('0xb')](contacts);})[_0x465b('0xa')](function(){console[_0x465b('0xc')](_0x465b('0xd'),_0x465b('0xe'));return db[_0x465b('0xf')]['destroy']({'where':{}});})[_0x465b('0xa')](function(){return db[_0x465b('0xf')][_0x465b('0xb')](hopper);})['then'](function(){console['log'](_0x465b('0xd'),_0x465b('0x10'));return db[_0x465b('0x8')]['bulkCreate'](contacts2);})[_0x465b('0xa')](function(){console[_0x465b('0xc')](_0x465b('0xd'),'contacts2');return db['CmHopper'][_0x465b('0xb')](hopper2);})[_0x465b('0xa')](function(){console[_0x465b('0xc')](_0x465b('0xd'),'hopper2');})[_0x465b('0x11')](function(_0x1ddd98){console[_0x465b('0xc')](_0x1ddd98);}); \ No newline at end of file +var _0xd3d1=['contacts1','CmHopper','finished\x20populating','hopper1','hopper2','catch','push','Innocenzo','@xcally.com','now','Biondo','innocenzo.biondo','destroy','CmContact','bulkCreate','then','log'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd3d1,0xe3));var _0x1d3d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd3d1[_0x4565bf];return _0x5610ba;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x1d3d('0x0')]({'id':i,'firstName':_0x1d3d('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x1d3d('0x2')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1d3d('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x1d3d('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1d3d('0x3')](),'updatedAt':Date[_0x1d3d('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1d3d('0x0')]({'id':i,'firstName':_0x1d3d('0x1')+i,'lastName':_0x1d3d('0x4')+i,'phone':0xf879fb460+i,'email':_0x1d3d('0x5')+i+_0x1d3d('0x2')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x1d3d('0x0')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x1d3d('0x3')]()});}db['CmContact'][_0x1d3d('0x6')]({'where':{}})['then'](function(){return db[_0x1d3d('0x7')][_0x1d3d('0x8')](contacts);})[_0x1d3d('0x9')](function(){console[_0x1d3d('0xa')]('finished\x20populating',_0x1d3d('0xb'));return db[_0x1d3d('0xc')][_0x1d3d('0x6')]({'where':{}});})[_0x1d3d('0x9')](function(){return db[_0x1d3d('0xc')]['bulkCreate'](hopper);})[_0x1d3d('0x9')](function(){console['log'](_0x1d3d('0xd'),_0x1d3d('0xe'));return db[_0x1d3d('0x7')][_0x1d3d('0x8')](contacts2);})[_0x1d3d('0x9')](function(){console[_0x1d3d('0xa')](_0x1d3d('0xd'),'contacts2');return db[_0x1d3d('0xc')][_0x1d3d('0x8')](hopper2);})[_0x1d3d('0x9')](function(){console[_0x1d3d('0xa')](_0x1d3d('0xd'),_0x1d3d('0xf'));})[_0x1d3d('0x10')](function(_0x5093c2){console['log'](_0x5093c2);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 76550ad..711c8e6 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab99=['password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','../mysqldb','format','%s%s','agent'];(function(_0x5819d7,_0x3d5363){var _0x303b21=function(_0x5eb832){while(--_0x5eb832){_0x5819d7['push'](_0x5819d7['shift']());}};_0x303b21(++_0x3d5363);}(_0xab99,0x137));var _0x9ab9=function(_0x34069a,_0x308fe7){_0x34069a=_0x34069a-0x0;var _0x3da329=_0xab99[_0x34069a];return _0x3da329;};'use strict';var util=require('util');var db=require(_0x9ab9('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x9ab9('0x1')]('%s%s','agent',i),'fullname':util[_0x9ab9('0x1')](_0x9ab9('0x2'),_0x9ab9('0x3'),i),'email':util[_0x9ab9('0x1')]('%s%s@xcally.com',_0x9ab9('0x3'),i),'role':'agent','password':_0x9ab9('0x4'),'internal':0xfa0+i,'type':_0x9ab9('0x5'),'transport':[_0x9ab9('0x6'),'ws',_0x9ab9('0x7')],'disallow':[_0x9ab9('0x8')],'allow':[_0x9ab9('0x9')],'defaultuser':util[_0x9ab9('0x1')](_0x9ab9('0x2'),_0x9ab9('0x3'),i),'encryption':_0x9ab9('0xa'),'avpf':_0x9ab9('0xa'),'force_avp':_0x9ab9('0xa'),'icesupport':_0x9ab9('0xa'),'dtlsenable':_0x9ab9('0xa'),'dtlsverify':'no','dtlscertfile':_0x9ab9('0xb'),'dtlsprivatekey':_0x9ab9('0xc'),'dtlssetup':_0x9ab9('0xd'),'callerid':util[_0x9ab9('0x1')](_0x9ab9('0xe'),util['format'](_0x9ab9('0x2'),'agent',i),0xfa0+i)});}db[_0x9ab9('0xf')][_0x9ab9('0x10')](users)[_0x9ab9('0x11')](function(){console[_0x9ab9('0x12')](_0x9ab9('0x13'));})[_0x9ab9('0x14')](function(_0x312ddc){console[_0x9ab9('0x12')](_0x312ddc);}); \ No newline at end of file +var _0x9e62=['wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','friend','udp'];(function(_0x281753,_0x675351){var _0x57ce90=function(_0x3b44d3){while(--_0x3b44d3){_0x281753['push'](_0x281753['shift']());}};_0x57ce90(++_0x675351);}(_0x9e62,0x14b));var _0x29e6=function(_0x2ae2bc,_0x177514){_0x2ae2bc=_0x2ae2bc-0x0;var _0x53c290=_0x9e62[_0x2ae2bc];return _0x53c290;};'use strict';var util=require(_0x29e6('0x0'));var db=require(_0x29e6('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x29e6('0x2')]({'name':util[_0x29e6('0x3')](_0x29e6('0x4'),_0x29e6('0x5'),i),'fullname':util[_0x29e6('0x3')]('%s%s',_0x29e6('0x5'),i),'email':util['format'](_0x29e6('0x6'),_0x29e6('0x5'),i),'role':_0x29e6('0x5'),'password':'password','internal':0xfa0+i,'type':_0x29e6('0x7'),'transport':[_0x29e6('0x8'),'ws',_0x29e6('0x9')],'disallow':[_0x29e6('0xa')],'allow':['ulaw'],'defaultuser':util[_0x29e6('0x3')](_0x29e6('0x4'),_0x29e6('0x5'),i),'encryption':'yes','avpf':_0x29e6('0xb'),'force_avp':'yes','icesupport':_0x29e6('0xb'),'dtlsenable':_0x29e6('0xb'),'dtlsverify':'no','dtlscertfile':_0x29e6('0xc'),'dtlsprivatekey':_0x29e6('0xd'),'dtlssetup':'actpass','callerid':util[_0x29e6('0x3')](_0x29e6('0xe'),util['format'](_0x29e6('0x4'),_0x29e6('0x5'),i),0xfa0+i)});}db[_0x29e6('0xf')]['bulkCreate'](users)[_0x29e6('0x10')](function(){console[_0x29e6('0x11')](_0x29e6('0x12'));})[_0x29e6('0x13')](function(_0x20074d){console[_0x29e6('0x11')](_0x20074d);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index f4bcc7f..4cb3319 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e35=['user','ChatQueue','MailQueue','WhatsappQueues','Telephones','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','whatsapp','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','remoteAddress','request','remotePort','connectedAt','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','role','telephone','agent','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','where','Campaign','format','Agents','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk'];(function(_0x8816b4,_0x12d85f){var _0x29854b=function(_0x2cd466){while(--_0x2cd466){_0x8816b4['push'](_0x8816b4['shift']());}};_0x29854b(++_0x12d85f);}(_0x3e35,0x1ad));var _0x53e3=function(_0x1fc36f,_0x464552){_0x1fc36f=_0x1fc36f-0x0;var _0x2856b4=_0x3e35[_0x1fc36f];return _0x2856b4;};'use strict';var _=require(_0x53e3('0x0'));var util=require(_0x53e3('0x1'));var BPromise=require(_0x53e3('0x2'));var db=require(_0x53e3('0x3'))['db'];var config=require(_0x53e3('0x4'));var queryQueues={'attributes':['id',_0x53e3('0x5')],'include':[{'as':'Agents','model':db[_0x53e3('0x6')],'attributes':['id',_0x53e3('0x5'),_0x53e3('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x53e3('0x5')],'where':{'role':_0x53e3('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x53e3('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x53e3('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x53e3('0x5'),_0x53e3('0xa')],'where':{'type':_0x53e3('0xb')}};function getAssociatedResources(_0x1c2667,_0xe48e86,_0x2379ac){return db[_0x53e3('0xc')][_0x53e3('0xd')]({'where':{'name':_0x1c2667,'userProfileId':_0xe48e86},'raw':!![]})['then'](function(_0x384b06){if(_0x384b06){if(_0x384b06[_0x53e3('0xe')]){switch(_0x1c2667){case _0x53e3('0xf'):case _0x53e3('0x10'):case _0x53e3('0x11'):case _0x53e3('0x12'):case _0x53e3('0x13'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x2379ac][_0x53e3('0x14')](queryQueues);case'Telephones':return db[_0x2379ac]['findAll'](queryTelephones);case _0x53e3('0x15'):return db[_0x2379ac][_0x53e3('0x14')](queryTrunks);case _0x53e3('0x16'):return db[_0x2379ac][_0x53e3('0x14')](queryCampaigns);}}else{return db[_0x53e3('0x17')]['findAll']({'attributes':[_0x53e3('0x18')],'where':{'sectionId':_0x384b06['id']},'raw':!![]})[_0x53e3('0x19')](function(_0x7945e){if(_0x7945e){var _0x13ab67={'where':{'id':_[_0x53e3('0x1a')](_0x7945e,_0x53e3('0x18'))},'raw':!![]};switch(_0x2379ac){case _0x53e3('0x6'):_0x13ab67[_0x53e3('0x1b')][_0x53e3('0x7')]='telephone';break;case _0x53e3('0x1c'):_0x13ab67[_0x53e3('0x1b')][_0x53e3('0xa')]=_0x53e3('0xb');break;}return db[_0x2379ac][_0x53e3('0x14')](_0x13ab67);}else{return[];}});}}else{return[];}})['then'](function(_0xc17de){return _0xc17de;});}function joinOrLeaveQueues(_0x3396e5,_0x579e98,_0x105fdb,_0x40ea73){_0x3396e5[_0x579e98](util[_0x53e3('0x1d')]('%s:queue:%s',_0x105fdb,_0x40ea73['name']));if(_0x40ea73[_0x53e3('0x1e')]){for(var _0x1671e6=0x0;_0x1671e6<_0x40ea73[_0x53e3('0x1e')][_0x53e3('0x1f')];_0x1671e6+=0x1){_0x3396e5[_0x579e98](util['format'](_0x53e3('0x20'),_0x40ea73[_0x53e3('0x1e')][_0x1671e6]['name']));}}}function joinOrLeave(_0x15666b,_0xc0e66,_0x1d3691){var _0x27be86;if(_0x15666b[_0x53e3('0x21')][_0x53e3('0x22')]['id']){db[_0x53e3('0x6')][_0x53e3('0x23')]({'attributes':['id',_0x53e3('0x5'),_0x53e3('0x7'),_0x53e3('0x24')],'where':{'id':_0x15666b[_0x53e3('0x21')][_0x53e3('0x22')]['id']},'include':[{'model':db[_0x53e3('0x25')],'as':_0x53e3('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x53e3('0x27')],'as':_0x53e3('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x53e3('0x29')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x53e3('0x2a')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x53e3('0x2b')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x53e3('0x2c')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x53e3('0x19')](function(_0x372d19){if(_0x372d19){_0x27be86=_0x372d19;_0x15666b[_0xc0e66](util[_0x53e3('0x1d')](_0x53e3('0x20'),_0x372d19[_0x53e3('0x5')]));var _0x3501f2=[];switch(_0x372d19[_0x53e3('0x7')]){case _0x53e3('0x2d'):_0x15666b[_0xc0e66](_0x53e3('0x2e'));_0x15666b[_0xc0e66](_0x53e3('0x2f'));if(queryQueues[_0x53e3('0x30')](_0x53e3('0x31'))){delete queryQueues[_0x53e3('0x31')];}_0x3501f2[_0x53e3('0x32')](db['VoiceQueue'][_0x53e3('0x14')](queryQueues));_0x3501f2[_0x53e3('0x32')](db['ChatQueue']['findAll'](queryQueues));_0x3501f2[_0x53e3('0x32')](db[_0x53e3('0x33')][_0x53e3('0x14')](queryQueues));_0x3501f2[_0x53e3('0x32')](db[_0x53e3('0x34')][_0x53e3('0x14')](queryQueues));_0x3501f2[_0x53e3('0x32')](db['MailQueue'][_0x53e3('0x14')](queryQueues));_0x3501f2[_0x53e3('0x32')](db[_0x53e3('0x35')][_0x53e3('0x14')](queryQueues));_0x3501f2[_0x53e3('0x32')](db[_0x53e3('0x36')][_0x53e3('0x14')](queryQueues));_0x3501f2[_0x53e3('0x32')](db['User']['findAll'](queryTelephones));_0x3501f2[_0x53e3('0x32')](db[_0x53e3('0x37')][_0x53e3('0x14')](queryTrunks));_0x3501f2['push'](db[_0x53e3('0x1c')][_0x53e3('0x14')](queryCampaigns));_0x3501f2[_0x53e3('0x32')](db[_0x53e3('0x6')][_0x53e3('0x14')](queryAgents));break;case _0x53e3('0x38'):_0x15666b[_0xc0e66](_0x53e3('0x2e'));_0x15666b[_0xc0e66](_0x53e3('0x2f'));_0x3501f2[_0x53e3('0x32')](getAssociatedResources('VoiceQueues',_0x372d19[_0x53e3('0x24')],'VoiceQueue'));_0x3501f2[_0x53e3('0x32')](getAssociatedResources('ChatQueues',_0x372d19['userProfileId'],_0x53e3('0x39')));_0x3501f2[_0x53e3('0x32')](getAssociatedResources(_0x53e3('0x11'),_0x372d19['userProfileId'],'FaxQueue'));_0x3501f2['push'](getAssociatedResources(_0x53e3('0x12'),_0x372d19[_0x53e3('0x24')],_0x53e3('0x34')));_0x3501f2[_0x53e3('0x32')](getAssociatedResources(_0x53e3('0x13'),_0x372d19[_0x53e3('0x24')],_0x53e3('0x3a')));_0x3501f2[_0x53e3('0x32')](getAssociatedResources('OpenchannelQueues',_0x372d19[_0x53e3('0x24')],_0x53e3('0x35')));_0x3501f2[_0x53e3('0x32')](getAssociatedResources(_0x53e3('0x3b'),_0x372d19[_0x53e3('0x24')],'WhatsappQueue'));_0x3501f2['push'](getAssociatedResources(_0x53e3('0x3c'),_0x372d19['userProfileId'],_0x53e3('0x6')));_0x3501f2[_0x53e3('0x32')](getAssociatedResources(_0x53e3('0x15'),_0x372d19[_0x53e3('0x24')],'Trunk'));_0x3501f2[_0x53e3('0x32')](getAssociatedResources(_0x53e3('0x16'),_0x372d19[_0x53e3('0x24')],_0x53e3('0x1c')));_0x3501f2[_0x53e3('0x32')](db[_0x53e3('0x6')][_0x53e3('0x14')](queryAgents));break;case _0x53e3('0x9'):_0x15666b[_0xc0e66](_0x53e3('0x2e'));_0x15666b[_0xc0e66]('voice:outbound');_0x3501f2['push'](_0x372d19['getVoiceQueues']({'attributes':['id',_0x53e3('0x5')]}));_0x3501f2['push'](_0x372d19['getChatQueues']({'attributes':['id','name']}));_0x3501f2['push'](_0x372d19[_0x53e3('0x3d')]({'attributes':['id',_0x53e3('0x5')]}));_0x3501f2['push'](_0x372d19[_0x53e3('0x3e')]({'attributes':['id',_0x53e3('0x5')]}));_0x3501f2[_0x53e3('0x32')](_0x372d19['getMailQueues']({'attributes':['id',_0x53e3('0x5')]}));_0x3501f2[_0x53e3('0x32')](_0x372d19[_0x53e3('0x3f')]({'attributes':['id',_0x53e3('0x5')]}));_0x3501f2[_0x53e3('0x32')](_0x372d19[_0x53e3('0x40')]({'attributes':['id',_0x53e3('0x5')]}));break;}return BPromise[_0x53e3('0x41')](_0x3501f2);}})[_0x53e3('0x19')](function(_0x422203){if(_0x422203&&_0x422203[_0x53e3('0x1f')]){for(var _0x5a700e=0x0;_0x5a700e<_0x422203[_0x53e3('0x1f')];_0x5a700e+=0x1){for(var _0x115476=0x0;_0x115476<_0x422203[_0x5a700e][_0x53e3('0x1f')];_0x115476+=0x1){switch(_0x5a700e){case 0x0:joinOrLeaveQueues(_0x15666b,_0xc0e66,_0x53e3('0x42'),_0x422203[_0x5a700e][_0x115476]);break;case 0x1:joinOrLeaveQueues(_0x15666b,_0xc0e66,'chat',_0x422203[_0x5a700e][_0x115476]);break;case 0x2:joinOrLeaveQueues(_0x15666b,_0xc0e66,_0x53e3('0x43'),_0x422203[_0x5a700e][_0x115476]);break;case 0x3:joinOrLeaveQueues(_0x15666b,_0xc0e66,_0x53e3('0x44'),_0x422203[_0x5a700e][_0x115476]);break;case 0x4:joinOrLeaveQueues(_0x15666b,_0xc0e66,'mail',_0x422203[_0x5a700e][_0x115476]);break;case 0x5:joinOrLeaveQueues(_0x15666b,_0xc0e66,'openchannel',_0x422203[_0x5a700e][_0x115476]);break;case 0x6:joinOrLeaveQueues(_0x15666b,_0xc0e66,_0x53e3('0x45'),_0x422203[_0x5a700e][_0x115476]);break;case 0x7:_0x15666b[_0xc0e66](util[_0x53e3('0x1d')]('telephone:%s',_0x422203[_0x5a700e][_0x115476][_0x53e3('0x5')]));break;case 0x8:_0x15666b[_0xc0e66](util['format'](_0x53e3('0x46'),_0x422203[_0x5a700e][_0x115476][_0x53e3('0x5')]));break;case 0x9:_0x15666b[_0xc0e66](util[_0x53e3('0x1d')](_0x53e3('0x47'),_0x422203[_0x5a700e][_0x115476][_0x53e3('0xa')],_0x422203[_0x5a700e][_0x115476]['name']));break;case 0xa:_0x15666b[_0xc0e66](util[_0x53e3('0x1d')](_0x53e3('0x20'),_0x422203[_0x5a700e][_0x115476][_0x53e3('0x5')]));break;}}}}})[_0x53e3('0x19')](function(){if(_0xc0e66===_0x53e3('0x48')){var _0x5b1098=_['map'](_0x27be86[_0x53e3('0x26')],'id');return _0x27be86[_0x53e3('0x49')](_0x5b1098)['then'](function(){for(var _0xedf670=0x0;_0xedf670<_0x5b1098[_0x53e3('0x1f')];_0xedf670+=0x1){_0x1d3691[_0x53e3('0x4a')](_0x53e3('0x4b'),{'ChatInteractionId':Number(_0x5b1098[_0xedf670]),'UserId':Number(_0x27be86['id'])});}});}})[_0x53e3('0x19')](function(){if(_0xc0e66==='leave'){var _0x2bd461=_[_0x53e3('0x1a')](_0x27be86[_0x53e3('0x28')],'id');return _0x27be86[_0x53e3('0x4c')](_0x2bd461)['then'](function(){for(var _0x3dbfa8=0x0;_0x3dbfa8<_0x2bd461[_0x53e3('0x1f')];_0x3dbfa8+=0x1){_0x1d3691[_0x53e3('0x4a')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x2bd461[_0x3dbfa8]),'UserId':Number(_0x27be86['id'])});}});}})[_0x53e3('0x19')](function(){if(_0xc0e66===_0x53e3('0x48')){var _0x21a243=_[_0x53e3('0x1a')](_0x27be86[_0x53e3('0x4d')],'id');return _0x27be86[_0x53e3('0x4e')](_0x21a243)[_0x53e3('0x19')](function(){for(var _0x15c4e4=0x0;_0x15c4e4<_0x21a243[_0x53e3('0x1f')];_0x15c4e4+=0x1){_0x1d3691[_0x53e3('0x4a')](_0x53e3('0x4f'),{'FaxInteractionId':Number(_0x21a243[_0x15c4e4]),'UserId':Number(_0x27be86['id'])});}});}})[_0x53e3('0x19')](function(){if(_0xc0e66===_0x53e3('0x48')){var _0x2c90ad=_[_0x53e3('0x1a')](_0x27be86[_0x53e3('0x50')],'id');return _0x27be86['removeSmsInteractions'](_0x2c90ad)[_0x53e3('0x19')](function(){for(var _0x572f43=0x0;_0x572f43<_0x2c90ad[_0x53e3('0x1f')];_0x572f43+=0x1){_0x1d3691[_0x53e3('0x4a')](_0x53e3('0x51'),{'SmsInteractionId':Number(_0x2c90ad[_0x572f43]),'UserId':Number(_0x27be86['id'])});}});}})[_0x53e3('0x19')](function(){if(_0xc0e66==='leave'){var _0xb70704=_[_0x53e3('0x1a')](_0x27be86[_0x53e3('0x52')],'id');return _0x27be86['removeOpenchannelInteractions'](_0xb70704)[_0x53e3('0x19')](function(){for(var _0x2876f9=0x0;_0x2876f9<_0xb70704[_0x53e3('0x1f')];_0x2876f9+=0x1){_0x1d3691[_0x53e3('0x4a')](_0x53e3('0x53'),{'OpenchannelInteractionId':Number(_0xb70704[_0x2876f9]),'UserId':Number(_0x27be86['id'])});}});}})[_0x53e3('0x19')](function(){if(_0xc0e66===_0x53e3('0x48')){var _0x4665e1=_[_0x53e3('0x1a')](_0x27be86['WhatsappInteractions'],'id');return _0x27be86[_0x53e3('0x54')](_0x4665e1)[_0x53e3('0x19')](function(){for(var _0x48f305=0x0;_0x48f305<_0x4665e1[_0x53e3('0x1f')];_0x48f305+=0x1){_0x1d3691[_0x53e3('0x4a')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x4665e1[_0x48f305]),'UserId':Number(_0x27be86['id'])});}});}})[_0x53e3('0x55')](function(_0x30f782){_0x15666b[_0x53e3('0x56')](_0x30f782);});}}function onDisconnect(_0x42bac4,_0x2740d2){joinOrLeave(_0x42bac4,_0x53e3('0x48'),_0x2740d2);}function onConnect(_0x537828){joinOrLeave(_0x537828,_0x53e3('0x57'));}exports[_0x53e3('0x58')]=function(_0x357d61){_0x357d61['on'](_0x53e3('0x59'),function(_0x4c27cb){_0x4c27cb[_0x53e3('0x5a')](0x0);_0x4c27cb[_0x53e3('0x5b')]=_0x4c27cb['request'][_0x53e3('0x59')][_0x53e3('0x5c')]+':'+_0x4c27cb[_0x53e3('0x5d')][_0x53e3('0x59')][_0x53e3('0x5e')];_0x4c27cb[_0x53e3('0x5f')]=new Date();_0x4c27cb[_0x53e3('0x56')]=function(_0x595c07){console['log']('SocketIO\x20'+_0x4c27cb['nsp'][_0x53e3('0x5')]+'['+_0x4c27cb[_0x53e3('0x5b')]+']',_0x595c07);};_0x4c27cb['on']('disconnect',function(){onDisconnect(_0x4c27cb,_0x357d61);_0x4c27cb[_0x53e3('0x56')]('DISCONNECTED');});onConnect(_0x4c27cb);_0x4c27cb[_0x53e3('0x56')](_0x53e3('0x60'));});}; \ No newline at end of file +var _0xfba1=['util','bluebird','../mysqldb','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','where','Campaign','format','length','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','include','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','user','VoiceQueue','userProfileId','WhatsappQueues','WhatsappQueue','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','type','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','nsp','DISCONNECTED','CONNECTED'];(function(_0x531d54,_0x4d9187){var _0x547183=function(_0x366f1c){while(--_0x366f1c){_0x531d54['push'](_0x531d54['shift']());}};_0x547183(++_0x4d9187);}(_0xfba1,0x132));var _0x1fba=function(_0x30cabd,_0x2f456b){_0x30cabd=_0x30cabd-0x0;var _0x1a7084=_0xfba1[_0x30cabd];return _0x1a7084;};'use strict';var _=require('lodash');var util=require(_0x1fba('0x0'));var BPromise=require(_0x1fba('0x1'));var db=require(_0x1fba('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x1fba('0x3')],'include':[{'as':_0x1fba('0x4'),'model':db[_0x1fba('0x5')],'attributes':['id',_0x1fba('0x3'),_0x1fba('0x6')],'raw':!![],'where':{'role':_0x1fba('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1fba('0x3')],'where':{'role':_0x1fba('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x1fba('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x1fba('0x3')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1fba('0x3'),'type'],'where':{'type':_0x1fba('0x9')}};function getAssociatedResources(_0x871e90,_0x1a6ea1,_0x7dcfc4){return db[_0x1fba('0xa')][_0x1fba('0xb')]({'where':{'name':_0x871e90,'userProfileId':_0x1a6ea1},'raw':!![]})['then'](function(_0x5cba25){if(_0x5cba25){if(_0x5cba25[_0x1fba('0xc')]){switch(_0x871e90){case _0x1fba('0xd'):case _0x1fba('0xe'):case _0x1fba('0xf'):case _0x1fba('0x10'):case _0x1fba('0x11'):case _0x1fba('0x12'):case'WhatsappQueues':return db[_0x7dcfc4]['findAll'](queryQueues);case _0x1fba('0x13'):return db[_0x7dcfc4][_0x1fba('0x14')](queryTelephones);case _0x1fba('0x15'):return db[_0x7dcfc4][_0x1fba('0x14')](queryTrunks);case _0x1fba('0x16'):return db[_0x7dcfc4][_0x1fba('0x14')](queryCampaigns);}}else{return db[_0x1fba('0x17')][_0x1fba('0x14')]({'attributes':[_0x1fba('0x18')],'where':{'sectionId':_0x5cba25['id']},'raw':!![]})[_0x1fba('0x19')](function(_0x255055){if(_0x255055){var _0x91c3e6={'where':{'id':_[_0x1fba('0x1a')](_0x255055,_0x1fba('0x18'))},'raw':!![]};switch(_0x7dcfc4){case _0x1fba('0x5'):_0x91c3e6[_0x1fba('0x1b')]['role']='telephone';break;case _0x1fba('0x1c'):_0x91c3e6['where']['type']=_0x1fba('0x9');break;}return db[_0x7dcfc4][_0x1fba('0x14')](_0x91c3e6);}else{return[];}});}}else{return[];}})['then'](function(_0x5aed2a){return _0x5aed2a;});}function joinOrLeaveQueues(_0x1fce98,_0x556179,_0x1856f6,_0x2277d8){_0x1fce98[_0x556179](util[_0x1fba('0x1d')]('%s:queue:%s',_0x1856f6,_0x2277d8[_0x1fba('0x3')]));if(_0x2277d8[_0x1fba('0x4')]){for(var _0x4b9549=0x0;_0x4b9549<_0x2277d8['Agents'][_0x1fba('0x1e')];_0x4b9549+=0x1){_0x1fce98[_0x556179](util[_0x1fba('0x1d')]('user:%s',_0x2277d8[_0x1fba('0x4')][_0x4b9549][_0x1fba('0x3')]));}}}function joinOrLeave(_0x261e18,_0x3fec6b,_0x343d0b){var _0x144054;if(_0x261e18[_0x1fba('0x1f')][_0x1fba('0x20')]['id']){db['User']['find']({'attributes':['id','name','role','userProfileId'],'where':{'id':_0x261e18[_0x1fba('0x1f')][_0x1fba('0x20')]['id']},'include':[{'model':db[_0x1fba('0x21')],'as':_0x1fba('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x1fba('0x23')],'as':_0x1fba('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x1fba('0x25')],'as':_0x1fba('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x1fba('0x27')],'as':_0x1fba('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x1fba('0x29')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1fba('0x2a')],'as':_0x1fba('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x1fba('0x19')](function(_0x4cc477){if(_0x4cc477){_0x144054=_0x4cc477;_0x261e18[_0x3fec6b](util['format'](_0x1fba('0x2c'),_0x4cc477[_0x1fba('0x3')]));var _0x8cadf9=[];switch(_0x4cc477[_0x1fba('0x6')]){case _0x1fba('0x2d'):_0x261e18[_0x3fec6b](_0x1fba('0x2e'));_0x261e18[_0x3fec6b](_0x1fba('0x2f'));if(queryQueues['hasOwnProperty'](_0x1fba('0x30'))){delete queryQueues[_0x1fba('0x30')];}_0x8cadf9['push'](db['VoiceQueue'][_0x1fba('0x14')](queryQueues));_0x8cadf9[_0x1fba('0x31')](db[_0x1fba('0x32')][_0x1fba('0x14')](queryQueues));_0x8cadf9[_0x1fba('0x31')](db[_0x1fba('0x33')][_0x1fba('0x14')](queryQueues));_0x8cadf9[_0x1fba('0x31')](db[_0x1fba('0x34')][_0x1fba('0x14')](queryQueues));_0x8cadf9[_0x1fba('0x31')](db['MailQueue'][_0x1fba('0x14')](queryQueues));_0x8cadf9[_0x1fba('0x31')](db[_0x1fba('0x35')][_0x1fba('0x14')](queryQueues));_0x8cadf9[_0x1fba('0x31')](db['WhatsappQueue']['findAll'](queryQueues));_0x8cadf9[_0x1fba('0x31')](db[_0x1fba('0x5')][_0x1fba('0x14')](queryTelephones));_0x8cadf9['push'](db[_0x1fba('0x36')][_0x1fba('0x14')](queryTrunks));_0x8cadf9['push'](db[_0x1fba('0x1c')]['findAll'](queryCampaigns));_0x8cadf9['push'](db['User'][_0x1fba('0x14')](queryAgents));break;case _0x1fba('0x37'):_0x261e18[_0x3fec6b](_0x1fba('0x2e'));_0x261e18[_0x3fec6b](_0x1fba('0x2f'));_0x8cadf9[_0x1fba('0x31')](getAssociatedResources('VoiceQueues',_0x4cc477['userProfileId'],_0x1fba('0x38')));_0x8cadf9[_0x1fba('0x31')](getAssociatedResources(_0x1fba('0xe'),_0x4cc477[_0x1fba('0x39')],_0x1fba('0x32')));_0x8cadf9['push'](getAssociatedResources('FaxQueues',_0x4cc477[_0x1fba('0x39')],_0x1fba('0x33')));_0x8cadf9[_0x1fba('0x31')](getAssociatedResources(_0x1fba('0x10'),_0x4cc477[_0x1fba('0x39')],_0x1fba('0x34')));_0x8cadf9[_0x1fba('0x31')](getAssociatedResources(_0x1fba('0x11'),_0x4cc477[_0x1fba('0x39')],'MailQueue'));_0x8cadf9[_0x1fba('0x31')](getAssociatedResources(_0x1fba('0x12'),_0x4cc477[_0x1fba('0x39')],'OpenchannelQueue'));_0x8cadf9['push'](getAssociatedResources(_0x1fba('0x3a'),_0x4cc477[_0x1fba('0x39')],_0x1fba('0x3b')));_0x8cadf9[_0x1fba('0x31')](getAssociatedResources(_0x1fba('0x13'),_0x4cc477['userProfileId'],_0x1fba('0x5')));_0x8cadf9[_0x1fba('0x31')](getAssociatedResources(_0x1fba('0x15'),_0x4cc477['userProfileId'],_0x1fba('0x36')));_0x8cadf9[_0x1fba('0x31')](getAssociatedResources('IvrCampaigns',_0x4cc477[_0x1fba('0x39')],_0x1fba('0x1c')));_0x8cadf9['push'](db[_0x1fba('0x5')][_0x1fba('0x14')](queryAgents));break;case _0x1fba('0x7'):_0x261e18[_0x3fec6b]('voice:inbound');_0x261e18[_0x3fec6b]('voice:outbound');_0x8cadf9[_0x1fba('0x31')](_0x4cc477['getVoiceQueues']({'attributes':['id',_0x1fba('0x3')]}));_0x8cadf9['push'](_0x4cc477[_0x1fba('0x3c')]({'attributes':['id',_0x1fba('0x3')]}));_0x8cadf9[_0x1fba('0x31')](_0x4cc477[_0x1fba('0x3d')]({'attributes':['id',_0x1fba('0x3')]}));_0x8cadf9[_0x1fba('0x31')](_0x4cc477[_0x1fba('0x3e')]({'attributes':['id',_0x1fba('0x3')]}));_0x8cadf9['push'](_0x4cc477[_0x1fba('0x3f')]({'attributes':['id',_0x1fba('0x3')]}));_0x8cadf9['push'](_0x4cc477[_0x1fba('0x40')]({'attributes':['id',_0x1fba('0x3')]}));_0x8cadf9[_0x1fba('0x31')](_0x4cc477[_0x1fba('0x41')]({'attributes':['id','name']}));break;}return BPromise[_0x1fba('0x42')](_0x8cadf9);}})['then'](function(_0x9f8f10){if(_0x9f8f10&&_0x9f8f10['length']){for(var _0x11dfad=0x0;_0x11dfad<_0x9f8f10[_0x1fba('0x1e')];_0x11dfad+=0x1){for(var _0x286526=0x0;_0x286526<_0x9f8f10[_0x11dfad]['length'];_0x286526+=0x1){switch(_0x11dfad){case 0x0:joinOrLeaveQueues(_0x261e18,_0x3fec6b,_0x1fba('0x43'),_0x9f8f10[_0x11dfad][_0x286526]);break;case 0x1:joinOrLeaveQueues(_0x261e18,_0x3fec6b,_0x1fba('0x44'),_0x9f8f10[_0x11dfad][_0x286526]);break;case 0x2:joinOrLeaveQueues(_0x261e18,_0x3fec6b,_0x1fba('0x45'),_0x9f8f10[_0x11dfad][_0x286526]);break;case 0x3:joinOrLeaveQueues(_0x261e18,_0x3fec6b,_0x1fba('0x46'),_0x9f8f10[_0x11dfad][_0x286526]);break;case 0x4:joinOrLeaveQueues(_0x261e18,_0x3fec6b,_0x1fba('0x47'),_0x9f8f10[_0x11dfad][_0x286526]);break;case 0x5:joinOrLeaveQueues(_0x261e18,_0x3fec6b,_0x1fba('0x48'),_0x9f8f10[_0x11dfad][_0x286526]);break;case 0x6:joinOrLeaveQueues(_0x261e18,_0x3fec6b,_0x1fba('0x49'),_0x9f8f10[_0x11dfad][_0x286526]);break;case 0x7:_0x261e18[_0x3fec6b](util['format'](_0x1fba('0x4a'),_0x9f8f10[_0x11dfad][_0x286526][_0x1fba('0x3')]));break;case 0x8:_0x261e18[_0x3fec6b](util[_0x1fba('0x1d')](_0x1fba('0x4b'),_0x9f8f10[_0x11dfad][_0x286526][_0x1fba('0x3')]));break;case 0x9:_0x261e18[_0x3fec6b](util[_0x1fba('0x1d')](_0x1fba('0x4c'),_0x9f8f10[_0x11dfad][_0x286526][_0x1fba('0x4d')],_0x9f8f10[_0x11dfad][_0x286526][_0x1fba('0x3')]));break;case 0xa:_0x261e18[_0x3fec6b](util[_0x1fba('0x1d')]('user:%s',_0x9f8f10[_0x11dfad][_0x286526][_0x1fba('0x3')]));break;}}}}})['then'](function(){if(_0x3fec6b===_0x1fba('0x4e')){var _0x4885df=_[_0x1fba('0x1a')](_0x144054[_0x1fba('0x22')],'id');return _0x144054[_0x1fba('0x4f')](_0x4885df)['then'](function(){for(var _0x46a524=0x0;_0x46a524<_0x4885df[_0x1fba('0x1e')];_0x46a524+=0x1){_0x343d0b[_0x1fba('0x50')](_0x1fba('0x51'),{'ChatInteractionId':Number(_0x4885df[_0x46a524]),'UserId':Number(_0x144054['id'])});}});}})[_0x1fba('0x19')](function(){if(_0x3fec6b===_0x1fba('0x4e')){var _0x5a4d7e=_[_0x1fba('0x1a')](_0x144054[_0x1fba('0x24')],'id');return _0x144054[_0x1fba('0x52')](_0x5a4d7e)['then'](function(){for(var _0x1aec39=0x0;_0x1aec39<_0x5a4d7e[_0x1fba('0x1e')];_0x1aec39+=0x1){_0x343d0b['emit'](_0x1fba('0x53'),{'MailInteractionId':Number(_0x5a4d7e[_0x1aec39]),'UserId':Number(_0x144054['id'])});}});}})['then'](function(){if(_0x3fec6b===_0x1fba('0x4e')){var _0x5b78bd=_[_0x1fba('0x1a')](_0x144054[_0x1fba('0x26')],'id');return _0x144054['removeFaxInteractions'](_0x5b78bd)['then'](function(){for(var _0x1347bf=0x0;_0x1347bf<_0x5b78bd[_0x1fba('0x1e')];_0x1347bf+=0x1){_0x343d0b[_0x1fba('0x50')](_0x1fba('0x54'),{'FaxInteractionId':Number(_0x5b78bd[_0x1347bf]),'UserId':Number(_0x144054['id'])});}});}})[_0x1fba('0x19')](function(){if(_0x3fec6b===_0x1fba('0x4e')){var _0x1f6239=_[_0x1fba('0x1a')](_0x144054[_0x1fba('0x28')],'id');return _0x144054[_0x1fba('0x55')](_0x1f6239)['then'](function(){for(var _0x2e2028=0x0;_0x2e2028<_0x1f6239[_0x1fba('0x1e')];_0x2e2028+=0x1){_0x343d0b[_0x1fba('0x50')](_0x1fba('0x56'),{'SmsInteractionId':Number(_0x1f6239[_0x2e2028]),'UserId':Number(_0x144054['id'])});}});}})[_0x1fba('0x19')](function(){if(_0x3fec6b===_0x1fba('0x4e')){var _0x775753=_['map'](_0x144054[_0x1fba('0x57')],'id');return _0x144054['removeOpenchannelInteractions'](_0x775753)[_0x1fba('0x19')](function(){for(var _0x453e5a=0x0;_0x453e5a<_0x775753[_0x1fba('0x1e')];_0x453e5a+=0x1){_0x343d0b['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x775753[_0x453e5a]),'UserId':Number(_0x144054['id'])});}});}})[_0x1fba('0x19')](function(){if(_0x3fec6b===_0x1fba('0x4e')){var _0x25c109=_['map'](_0x144054[_0x1fba('0x2b')],'id');return _0x144054['removeWhatsappInteractions'](_0x25c109)[_0x1fba('0x19')](function(){for(var _0x28675f=0x0;_0x28675f<_0x25c109[_0x1fba('0x1e')];_0x28675f+=0x1){_0x343d0b[_0x1fba('0x50')](_0x1fba('0x58'),{'WhatsappInteractionId':Number(_0x25c109[_0x28675f]),'UserId':Number(_0x144054['id'])});}});}})[_0x1fba('0x59')](function(_0x3a56ea){_0x261e18[_0x1fba('0x5a')](_0x3a56ea);});}}function onDisconnect(_0x5d7609,_0x129b33){joinOrLeave(_0x5d7609,_0x1fba('0x4e'),_0x129b33);}function onConnect(_0x53d137){joinOrLeave(_0x53d137,_0x1fba('0x5b'));}exports[_0x1fba('0x5c')]=function(_0x258778){_0x258778['on']('connection',function(_0x32e4c7){_0x32e4c7[_0x1fba('0x5d')](0x0);_0x32e4c7[_0x1fba('0x5e')]=_0x32e4c7[_0x1fba('0x5f')][_0x1fba('0x60')][_0x1fba('0x61')]+':'+_0x32e4c7[_0x1fba('0x5f')][_0x1fba('0x60')][_0x1fba('0x62')];_0x32e4c7['connectedAt']=new Date();_0x32e4c7[_0x1fba('0x5a')]=function(_0x561e93){console['log']('SocketIO\x20'+_0x32e4c7[_0x1fba('0x63')]['name']+'['+_0x32e4c7['address']+']',_0x561e93);};_0x32e4c7['on']('disconnect',function(){onDisconnect(_0x32e4c7,_0x258778);_0x32e4c7[_0x1fba('0x5a')](_0x1fba('0x64'));});onConnect(_0x32e4c7);_0x32e4c7[_0x1fba('0x5a')](_0x1fba('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 3c4e0da..eae1dff 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 _0xffe1=['OpenchannelInteraction','OpenchannelMessage','request','then','Trigger,\x20%s','error','code','EventManager','catch','channel','event','direction','UserId','User','name','interface','format','SIP/%s','incomingmessage','opened','changed','closed','get','find','default','length','model','hook','callback','toLowerCase','condition','util','../../mysqldb','../logger','triggers','client','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','Sms','SmsInteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','newmessage','Mail','MailInteraction','Openchannel'];(function(_0x3ed7af,_0x58524e){var _0x5dce03=function(_0x3040ee){while(--_0x3040ee){_0x3ed7af['push'](_0x3ed7af['shift']());}};_0x5dce03(++_0x58524e);}(_0xffe1,0x132));var _0x1ffe=function(_0x592e3c,_0x5dfbff){_0x592e3c=_0x592e3c-0x0;var _0x45f8fa=_0xffe1[_0x592e3c];return _0x45f8fa;};'use strict';var util=require(_0x1ffe('0x0'));var db=require(_0x1ffe('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x1ffe('0x2'))(_0x1ffe('0x3'));var client=jayson[_0x1ffe('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0x1ffe('0x5'),'model':_0x1ffe('0x6'),'event':_0x1ffe('0x7'),'condition':_0x1ffe('0x8'),'callback':afterCreate},{'channel':'Chat','model':_0x1ffe('0x6'),'event':_0x1ffe('0x9'),'condition':_0x1ffe('0xa'),'callback':afterUpdate},{'channel':_0x1ffe('0x5'),'model':_0x1ffe('0xb'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x1ffe('0xc'),'model':'SmsInteraction','event':_0x1ffe('0x7'),'condition':_0x1ffe('0x8'),'callback':afterCreate},{'channel':_0x1ffe('0xc'),'model':_0x1ffe('0xd'),'event':'afterUpdate','condition':_0x1ffe('0xa'),'callback':afterUpdate},{'channel':_0x1ffe('0xc'),'model':'SmsMessage','event':_0x1ffe('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x1ffe('0xe'),'model':_0x1ffe('0xf'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0x1ffe('0x9'),'condition':_0x1ffe('0xa'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x1ffe('0x10'),'event':_0x1ffe('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x1ffe('0x11'),'model':_0x1ffe('0x12'),'event':_0x1ffe('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':'Fax','model':_0x1ffe('0x12'),'event':_0x1ffe('0x9'),'condition':_0x1ffe('0xa'),'callback':afterUpdate},{'channel':_0x1ffe('0x11'),'model':_0x1ffe('0x13'),'event':'afterCreate','condition':_0x1ffe('0x14'),'callback':afterCreateMessage},{'channel':_0x1ffe('0x15'),'model':_0x1ffe('0x16'),'event':'afterCreate','condition':_0x1ffe('0x8'),'callback':afterCreate},{'channel':_0x1ffe('0x15'),'model':_0x1ffe('0x16'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1ffe('0x15'),'model':'MailMessage','event':_0x1ffe('0x7'),'condition':_0x1ffe('0x14'),'callback':afterCreateMessage},{'channel':_0x1ffe('0x17'),'model':_0x1ffe('0x18'),'event':_0x1ffe('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x1ffe('0x17'),'model':_0x1ffe('0x18'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':'Openchannel','model':_0x1ffe('0x19'),'event':_0x1ffe('0x7'),'condition':_0x1ffe('0x14'),'callback':afterCreateMessage}];function request(_0x492e40){return client[_0x1ffe('0x1a')]('EventManager',_0x492e40)[_0x1ffe('0x1b')](function(_0x210210){logger['info'](_0x1ffe('0x1c'),'EventManager',_0x210210);if(_0x210210[_0x1ffe('0x1d')]){if(_0x210210[_0x1ffe('0x1d')][_0x1ffe('0x1e')]===0x1f4){logger['error'](_0x1ffe('0x1c'),_0x1ffe('0x1f'),_0x210210[_0x1ffe('0x1d')]);}}})[_0x1ffe('0x20')](function(_0x6575c6){logger[_0x1ffe('0x1d')](_0x1ffe('0x1c'),_0x1ffe('0x1f'),_0x6575c6);});}function afterCreateMessage(_0x41815a,_0x667f32){return function(_0x156f09,_0x91c7a4){_0x156f09=_0x156f09['get']({'plain':!![]});_0x156f09[_0x1ffe('0x21')]=_0x41815a;_0x156f09[_0x1ffe('0x22')]=_0x156f09[_0x1ffe('0x23')];if(_0x156f09[_0x1ffe('0x24')]){return db[_0x1ffe('0x25')]['find']({'where':{'id':_0x156f09[_0x1ffe('0x24')]},'attributes':['id',_0x1ffe('0x26')],'raw':!![]})[_0x1ffe('0x1b')](function(_0x31211a){_0x156f09[_0x1ffe('0x27')]=util[_0x1ffe('0x28')](_0x1ffe('0x29'),_0x31211a['name']);_0x156f09[_0x1ffe('0x21')]=_0x41815a;return request({'event':_0x1ffe('0x2a'),'message':_0x156f09});})[_0x1ffe('0x20')](function(_0x5ed4e7){console[_0x1ffe('0x1d')](_0x5ed4e7);});}else{return request({'event':'outgoingmessage','message':_0x156f09});}};}function afterCreate(_0x13a150,_0x2db698){return function(_0x3878d3,_0x5d8e69){_0x3878d3=_0x3878d3['get']({'plain':!![]});_0x3878d3[_0x1ffe('0x21')]=_0x13a150;_0x3878d3[_0x1ffe('0x22')]=_0x1ffe('0x2b');return request({'event':_0x2db698,'message':_0x3878d3});};}function afterUpdate(_0x4a52d5,_0x5c4b3a){return function(_0x4a8a82,_0x4408ed){if(_0x4a8a82[_0x1ffe('0x2c')](_0x1ffe('0x2d'))&&_0x4a8a82[_0x1ffe('0x2d')]){_0x4a8a82=_0x4a8a82[_0x1ffe('0x2e')]({'plain':!![]});_0x4a8a82[_0x1ffe('0x21')]=_0x4a52d5;_0x4a8a82[_0x1ffe('0x22')]='closed';if(_0x4a8a82[_0x1ffe('0x24')]){return db[_0x1ffe('0x25')][_0x1ffe('0x2f')]({'where':{'id':_0x4a8a82[_0x1ffe('0x24')]},'attributes':['id','name'],'raw':!![]})['then'](function(_0x164b67){_0x4a8a82[_0x1ffe('0x27')]=util[_0x1ffe('0x28')](_0x1ffe('0x29'),_0x164b67[_0x1ffe('0x26')]);return request({'event':_0x5c4b3a,'message':_0x4a8a82});})[_0x1ffe('0x20')](function(_0x8e9899){console[_0x1ffe('0x1d')](_0x8e9899);});}else{return request({'event':_0x5c4b3a,'message':_0x4a8a82});}}};}exports[_0x1ffe('0x30')]=function(){for(var _0x1424a7=0x0;_0x1424a7=_0x3fbef0['agents']){throw Error(_0xabdd('0x15'));}_0x1abd7e(_0x42fd96);})[_0xabdd('0x16')](function(_0x3e2803){_0x5c6370(_0x3e2803);});});}; \ No newline at end of file +var _0xff96=['then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','../mysqldb','voice','chat','openchannel','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','count'];(function(_0x409491,_0x352fc4){var _0x282dc4=function(_0x471326){while(--_0x471326){_0x409491['push'](_0x409491['shift']());}};_0x282dc4(++_0x352fc4);}(_0xff96,0x1d7));var _0x6ff9=function(_0x204a28,_0x359c57){_0x204a28=_0x204a28-0x0;var _0x2d8e3d=_0xff96[_0x204a28];return _0x2d8e3d;};'use strict';var _=require(_0x6ff9('0x0'));var BPromise=require('bluebird');var db=require(_0x6ff9('0x1'))['db'];var util=require('./license/util');var channels=[_0x6ff9('0x2'),'mail',_0x6ff9('0x3'),'fax','sms','whatsapp',_0x6ff9('0x4')];exports['getChannels']=function(){return channels;};exports[_0x6ff9('0x5')]=function(_0x532a6e){_0x532a6e=_0x532a6e['toLowerCase']();return _[_0x6ff9('0x6')](channels,_0x532a6e);};exports[_0x6ff9('0x7')]=function(_0x309c2c,_0x4bd510,_0x4ff6f5,_0x10b326){var _0x327462={'loginAttempts':_0x4bd510,'blocked':_0x4ff6f5};if(!_[_0x6ff9('0x8')](_0x10b326)){_0x327462[_0x6ff9('0x9')]=_0x10b326;}return _0x309c2c[_0x6ff9('0xa')](_0x327462);};exports[_0x6ff9('0xb')]=function(_0x2f8be4){return new BPromise(function(_0x48c3e8,_0x38c51d){var _0x499af3=0x0;if(_0x2f8be4[_0x6ff9('0xc')]!==_0x6ff9('0xd')){_0x48c3e8(_0x2f8be4);}db['User'][_0x6ff9('0xe')]({'where':{'role':_0x6ff9('0xd'),'online':!![],'id':{'$ne':_0x2f8be4['id']}}})[_0x6ff9('0xf')](function(_0x58b853){_0x499af3=_0x58b853;return util[_0x6ff9('0xb')]();})[_0x6ff9('0xf')](function(_0x39eba9){if(_0x39eba9&&_0x39eba9[_0x6ff9('0x10')]&&_0x499af3>=_0x39eba9[_0x6ff9('0x10')]){throw Error(_0x6ff9('0x11'));}_0x48c3e8(_0x2f8be4);})['catch'](function(_0xc2333e){_0x38c51d(_0xc2333e);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 65d081a..cc876f6 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe24c=['status','render','json','send','404'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe24c,0xb3));var _0xce24=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe24c[_0x138adb];return _0x1b27f2;};'use strict';module['exports'][0x194]=function pageNotFound(_0x136fe6,_0x52d89){var _0x49d5f8=_0xce24('0x0');var _0x2a8905=0x194;var _0x27f555={'status':_0x2a8905};_0x52d89[_0xce24('0x1')](_0x27f555[_0xce24('0x1')]);_0x52d89[_0xce24('0x2')](_0x49d5f8,{},function(_0x4f8521,_0x2439fe){if(_0x4f8521){return _0x52d89[_0xce24('0x1')](_0x27f555[_0xce24('0x1')])[_0xce24('0x3')](_0x27f555);}_0x52d89[_0xce24('0x4')](_0x2439fe);});}; \ No newline at end of file +var _0x67b6=['send','exports','status','render','json'];(function(_0x26224c,_0x1a354c){var _0x4c2bc5=function(_0x179343){while(--_0x179343){_0x26224c['push'](_0x26224c['shift']());}};_0x4c2bc5(++_0x1a354c);}(_0x67b6,0x150));var _0x667b=function(_0x581618,_0x13cb14){_0x581618=_0x581618-0x0;var _0x19d2d8=_0x67b6[_0x581618];return _0x19d2d8;};'use strict';module[_0x667b('0x0')][0x194]=function pageNotFound(_0x519066,_0x3abae3){var _0x479f24='404';var _0x29673e=0x194;var _0x28f7ed={'status':_0x29673e};_0x3abae3[_0x667b('0x1')](_0x28f7ed[_0x667b('0x1')]);_0x3abae3[_0x667b('0x2')](_0x479f24,{},function(_0x2398c8,_0x20269d){if(_0x2398c8){return _0x3abae3[_0x667b('0x1')](_0x28f7ed['status'])[_0x667b('0x3')](_0x28f7ed);}_0x3abae3[_0x667b('0x4')](_0x20269d);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index c0599d9..ef7d7e5 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb234=['SalesforceConfiguration','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareDetailsReport','JscriptyProject','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Migration','../api/migration/migration.model','Attachment','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/notification/notification.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','hasOne','VoiceMail','cascade','Recordings','UserId','hasMany','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','Notification','Notifications','belongsTo','belongsToMany','Groups','chat_group_has_users','CmContact','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','MailQueues','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','VoicePrefix','ChatWebsite','user_has_chat_websites','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','Members','VoiceQueueId','Hoppers','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackupId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','MailAccountId','MailServerOut','Imap','Smtp','Dispositions','Answers','MailMessage','Interactions','List','TemplateId','Pause','mandatoryDispositionPause','ContactId','Owner','mail_interaction_has_tags','ThroughTags','MailInteractionId','Attachments','restrict','IntervalId','TagId','ListId','Items','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','Account','Tags','fax_interaction_has_tags','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','Users','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatInteraction','OpenchannelQueueReport','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CmCompany','Contacts','CompanyId','HopperHistories','Company','cm_contact_has_tags','Campaign','CampaignId','OwnerId','Queue','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','Trigger','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','SugarcrmConfiguration','DeskConfiguration','DeskField','int_desk_configuration_has_tags','ZohoField','FreshdeskAccount','FreshdeskConfiguration','VtigerAccount','ServicenowConfiguration','Dynamics365Account','ToId','JscriptyQuestionReport','SessionId','SmsQueueReport','ProjectId','team_has_voice_queues','team_has_mail_queues','team_has_whatsapp_queues','TrunkBackup','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToMailQueueId','ToQueue','ToMailAccountId','FromChatWebsiteId','ToUserId','FromFaxAccountId','ToFaxQueueId','ToOpenchannelQueueId','ToAccount','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','user_has_voice_prefixes','userProfileId','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccount','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','ToAgent','WhatsappQueueId','path','../config/environment','lodash','jstz','determine','sequelize','motion2','xcall','127.0.0.1','utf8mb4','utf8_general_ci','sequelizeHistory','xC@LL1234','mysql','name','utf8','username','password','options','database','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/sound/sound.model','Tag','Template','../api/template/template.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model'];(function(_0x47fae1,_0x45b329){var _0x5625b9=function(_0x538779){while(--_0x538779){_0x47fae1['push'](_0x47fae1['shift']());}};_0x5625b9(++_0x45b329);}(_0xb234,0x13f));var _0x4b23=function(_0x56204f,_0x3a16ab){_0x56204f=_0x56204f-0x0;var _0x40307f=_0xb234[_0x56204f];return _0x40307f;};'use strict';var path=require(_0x4b23('0x0'));var config=require(_0x4b23('0x1'));var Sequelize=require('sequelize');var _=require(_0x4b23('0x2'));var jstz=require(_0x4b23('0x3'));var timezone=jstz[_0x4b23('0x4')]();config[_0x4b23('0x5')]=_['defaultsDeep'](config['sequelize'],{'database':_0x4b23('0x6'),'username':_0x4b23('0x7'),'password':'xC@LL1234','options':{'host':_0x4b23('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x4b23('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x4b23('0xa')}}});config[_0x4b23('0xb')]=_['defaultsDeep'](config[_0x4b23('0xb')],{'database':_0x4b23('0x6'),'username':'xcall','password':_0x4b23('0xc'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x4b23('0xd'),'dialectOptions':{'charset':_0x4b23('0x9')},'logging':![],'timezone':timezone[_0x4b23('0xe')](),'define':{'charset':_0x4b23('0xf'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x4b23('0x5')][_0x4b23('0x10')],config[_0x4b23('0x5')][_0x4b23('0x11')],config[_0x4b23('0x5')][_0x4b23('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4b23('0xb')][_0x4b23('0x13')],config[_0x4b23('0xb')][_0x4b23('0x10')],config['sequelizeHistory'][_0x4b23('0x11')],config[_0x4b23('0xb')][_0x4b23('0x12')])};db[_0x4b23('0x14')]=db[_0x4b23('0x5')]['import'](_0x4b23('0x15'));db[_0x4b23('0x16')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x18'));db[_0x4b23('0x19')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0x1a'));db[_0x4b23('0x1b')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x1c'));db[_0x4b23('0x1d')]=db[_0x4b23('0x5')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x4b23('0x1e')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x1f'));db[_0x4b23('0x20')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x21'));db[_0x4b23('0x22')]=db[_0x4b23('0x5')]['import'](_0x4b23('0x23'));db['VoiceMail']=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/voiceMail/voiceMail.model');db[_0x4b23('0x24')]=db[_0x4b23('0x5')]['import']('../api/voiceMailMessage/voiceMailMessage.model');db[_0x4b23('0x25')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x26'));db['VoiceDialReport']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x27'));db[_0x4b23('0x28')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0x29'));db[_0x4b23('0x2a')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0x2b'));db['MemberReport']=db[_0x4b23('0x5')]['import'](_0x4b23('0x2c'));db[_0x4b23('0x2d')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x2e'));db['VoiceTransferReport']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x2f'));db[_0x4b23('0x30')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0x31'));db['UserVoiceQueue']=db['sequelize'][_0x4b23('0x17')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x4b23('0x32')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0x33'));db[_0x4b23('0x34')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x35'));db[_0x4b23('0x36')]=db[_0x4b23('0x5')]['import'](_0x4b23('0x37'));db['UserOpenchannelQueue']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x38'));db[_0x4b23('0x39')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x3a'));db[_0x4b23('0x3b')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x3c'));db['MailServerOut']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x3d'));db[_0x4b23('0x3e')]=db[_0x4b23('0x5')]['import'](_0x4b23('0x3f'));db[_0x4b23('0x40')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x41'));db['MailSubstatus']=db[_0x4b23('0x5')]['import'](_0x4b23('0x42'));db[_0x4b23('0x43')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0x44'));db['MailMessage']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x45'));db[_0x4b23('0x46')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0x47'));db[_0x4b23('0x48')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x49'));db[_0x4b23('0x4a')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x4b'));db[_0x4b23('0x4c')]=db[_0x4b23('0x5')]['import']('../api/dashboardItem/dashboardItem.model');db[_0x4b23('0x4d')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x4e'));db[_0x4b23('0x4f')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/faxApplication/faxApplication.model');db[_0x4b23('0x50')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/faxInteraction/faxInteraction.model');db[_0x4b23('0x51')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0x52'));db[_0x4b23('0x53')]=db['sequelize']['import']('../api/faxQueue/faxQueue.model');db[_0x4b23('0x54')]=db['sequelize']['import'](_0x4b23('0x55'));db[_0x4b23('0x56')]=db[_0x4b23('0x5')]['import'](_0x4b23('0x57'));db[_0x4b23('0x58')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0x59'));db[_0x4b23('0x5a')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x5b'));db[_0x4b23('0x5c')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0x5d'));db[_0x4b23('0x5e')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/smsQueue/smsQueue.model');db[_0x4b23('0x5f')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x60'));db[_0x4b23('0x61')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0x62'));db[_0x4b23('0x63')]=db[_0x4b23('0x5')]['import'](_0x4b23('0x64'));db[_0x4b23('0x65')]=db['sequelize']['import'](_0x4b23('0x66'));db[_0x4b23('0x67')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0x4b23('0x5')]['import'](_0x4b23('0x68'));db['OpenchannelQueueReport']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x69'));db[_0x4b23('0x6a')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x6b'));db['ChatInteraction']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x6c'));db[_0x4b23('0x6d')]=db['sequelize']['import'](_0x4b23('0x6e'));db[_0x4b23('0x6f')]=db[_0x4b23('0x5')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x4b23('0x70')]=db[_0x4b23('0x5')]['import'](_0x4b23('0x71'));db[_0x4b23('0x72')]=db['sequelize'][_0x4b23('0x17')]('../api/chatGroup/chatGroup.model');db[_0x4b23('0x73')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x74'));db['CmCompany']=db[_0x4b23('0x5')]['import'](_0x4b23('0x75'));db['CmContact']=db['sequelize'][_0x4b23('0x17')]('../api/cmContact/cmContact.model');db[_0x4b23('0x76')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x77'));db[_0x4b23('0x78')]=db[_0x4b23('0x5')]['import'](_0x4b23('0x79'));db[_0x4b23('0x7a')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x4b23('0x7b')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x7c'));db[_0x4b23('0x7d')]=db[_0x4b23('0x5')]['import'](_0x4b23('0x7e'));db[_0x4b23('0x7f')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x80'));db['Action']=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/action/action.model');db[_0x4b23('0x81')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x82'));db[_0x4b23('0x83')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x84'));db[_0x4b23('0x85')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x86'));db[_0x4b23('0x87')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/condition/condition.model');db[_0x4b23('0x88')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x89'));db['Pause']=db['sequelize'][_0x4b23('0x17')]('../api/pause/pause.model');db['Cdr']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x8a'));db[_0x4b23('0x8b')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0x8c'));db['Schedule']=db['sequelize'][_0x4b23('0x17')]('../api/schedule/schedule.model');db['Sound']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x8d'));db[_0x4b23('0x8e')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/tag/tag.model');db[_0x4b23('0x8f')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x90'));db['Trigger']=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/trigger/trigger.model');db[_0x4b23('0x91')]=db[_0x4b23('0x5')]['import'](_0x4b23('0x92'));db[_0x4b23('0x93')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x94'));db[_0x4b23('0x95')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x96'));db[_0x4b23('0x97')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x98'));db[_0x4b23('0x99')]=db[_0x4b23('0x5')]['import'](_0x4b23('0x9a'));db[_0x4b23('0x9b')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0x9c'));db[_0x4b23('0x9d')]=db[_0x4b23('0x5')]['import'](_0x4b23('0x9e'));db[_0x4b23('0x9f')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0xa0'));db[_0x4b23('0xa1')]=db['sequelize']['import'](_0x4b23('0xa2'));db[_0x4b23('0xa3')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0xa4'));db[_0x4b23('0xa5')]=db['sequelize'][_0x4b23('0x17')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x4b23('0xa6')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xa7'));db['SugarcrmConfiguration']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xa8'));db[_0x4b23('0xa9')]=db['sequelize'][_0x4b23('0x17')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x4b23('0xaa')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0xab'));db['DeskConfiguration']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xac'));db['DeskField']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xad'));db[_0x4b23('0xae')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xaf'));db[_0x4b23('0xb0')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xb1'));db['ZohoField']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xb2'));db[_0x4b23('0xb3')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xb4'));db[_0x4b23('0xb5')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x4b23('0xb6')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xb7'));db['FreshdeskAccount']=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x4b23('0x17')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x4b23('0xb8')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xb9'));db['VtigerAccount']=db['sequelize'][_0x4b23('0x17')](_0x4b23('0xba'));db[_0x4b23('0xbb')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x4b23('0xbc')]=db['sequelize']['import'](_0x4b23('0xbd'));db[_0x4b23('0xbe')]=db[_0x4b23('0x5')]['import'](_0x4b23('0xbf'));db['ServicenowConfiguration']=db['sequelize'][_0x4b23('0x17')](_0x4b23('0xc0'));db[_0x4b23('0xc1')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xc2'));db['Dynamics365Account']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xc3'));db[_0x4b23('0xc4')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x4b23('0xc5')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xc6'));db[_0x4b23('0xc7')]=db['sequelize'][_0x4b23('0x17')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x4b23('0xc8')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xc9'));db[_0x4b23('0xca')]=db['sequelize'][_0x4b23('0x17')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x4b23('0x93')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/integration/integration.model');db[_0x4b23('0xcb')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/network/network.model');db[_0x4b23('0xcc')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xcd'));db[_0x4b23('0xce')]=db[_0x4b23('0x5')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0x4b23('0xcf')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xd0'));db['JscriptyQuestionReport']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xd1'));db['JscriptySessionReport']=db[_0x4b23('0x5')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xd2'));db['SquareReport']=db[_0x4b23('0x5')]['import']('../api/squareReport/squareReport.model');db[_0x4b23('0xd3')]=db['sequelize'][_0x4b23('0x17')]('../api/squareReportDetail/squareReportDetail.model');db[_0x4b23('0xd4')]=db[_0x4b23('0x5')]['import']('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0x4b23('0x5')]['import']('../api/setting/setting.model');db[_0x4b23('0xd5')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/squareOdbc/squareOdbc.model');db[_0x4b23('0xd6')]=db[_0x4b23('0x5')]['import'](_0x4b23('0xd7'));db[_0x4b23('0xd8')]=db['sequelize'][_0x4b23('0x17')]('../api/squareRecording/squareRecording.model');db[_0x4b23('0xd9')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xda'));db[_0x4b23('0xdb')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xdc'));db[_0x4b23('0xdd')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xde'));db['Campaign']=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/campaign/campaign.model');db[_0x4b23('0xdf')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0xe0'));db[_0x4b23('0xe1')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/attachment/attachment.model');db['Plugin']=db['sequelize'][_0x4b23('0x17')](_0x4b23('0xe2'));db['MailTransferReport']=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/mailTransferReport/mailTransferReport.model');db[_0x4b23('0xe3')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xe4'));db[_0x4b23('0xe5')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/faxTransferReport/faxTransferReport.model');db[_0x4b23('0xe6')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xe7'));db[_0x4b23('0xe8')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xe9'));db[_0x4b23('0xea')]=db[_0x4b23('0x5')]['import'](_0x4b23('0xeb'));db['VoicePrefix']=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xec'));db[_0x4b23('0xed')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0xee'));db['UserProfileSection']=db[_0x4b23('0x5')]['import']('../api/userProfileSection/userProfileSection.model');db[_0x4b23('0xef')]=db['sequelize']['import'](_0x4b23('0xf0'));db['Notification']=db['sequelize']['import'](_0x4b23('0xf1'));db['WhatsappAccount']=db['sequelize'][_0x4b23('0x17')]('../api/whatsappAccount/whatsappAccount.model');db[_0x4b23('0xf2')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/whatsappApplication/whatsappApplication.model');db[_0x4b23('0xf3')]=db[_0x4b23('0x5')]['import'](_0x4b23('0xf4'));db[_0x4b23('0xf5')]=db[_0x4b23('0x5')][_0x4b23('0x17')](_0x4b23('0xf6'));db[_0x4b23('0xf7')]=db['sequelize'][_0x4b23('0x17')](_0x4b23('0xf8'));db['WhatsappTransferReport']=db['sequelize'][_0x4b23('0x17')](_0x4b23('0xf9'));db[_0x4b23('0xfa')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/whatsappQueue/whatsappQueue.model');db[_0x4b23('0xfb')]=db[_0x4b23('0x5')][_0x4b23('0x17')]('../api/cloudProvider/cloudProvider.model');db['User'][_0x4b23('0xfc')](db[_0x4b23('0xfd')],{'as':'VoiceMail','onDelete':_0x4b23('0xfe'),'foreignKey':'UserId'});db[_0x4b23('0x14')]['hasMany'](db['VoiceRecording'],{'as':_0x4b23('0xff'),'foreignKey':_0x4b23('0x100')});db[_0x4b23('0x14')][_0x4b23('0x101')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':_0x4b23('0x100')});db[_0x4b23('0x14')][_0x4b23('0x101')](db[_0x4b23('0x1b')],{'as':_0x4b23('0x102'),'onDelete':'cascade','hooks':!![]});db['User']['hasMany'](db['CmHopperFinal'],{'as':_0x4b23('0x103'),'foreignKey':_0x4b23('0x100')});db['User']['hasMany'](db[_0x4b23('0x7b')],{'as':_0x4b23('0x104'),'foreignKey':_0x4b23('0x100')});db['User'][_0x4b23('0x101')](db['ReportAgentPreview'],{'as':_0x4b23('0x7d'),'foreignKey':_0x4b23('0x100')});db[_0x4b23('0x14')][_0x4b23('0x101')](db[_0x4b23('0x63')],{'as':_0x4b23('0x105'),'foreignKey':_0x4b23('0x100')});db[_0x4b23('0x14')]['hasMany'](db['ChatInteraction'],{'as':_0x4b23('0x106'),'foreignKey':_0x4b23('0x100')});db[_0x4b23('0x14')][_0x4b23('0x101')](db[_0x4b23('0x5a')],{'as':_0x4b23('0x107'),'foreignKey':_0x4b23('0x100')});db[_0x4b23('0x14')]['hasMany'](db[_0x4b23('0x50')],{'as':_0x4b23('0x108'),'foreignKey':_0x4b23('0x100')});db['User']['hasMany'](db[_0x4b23('0x43')],{'as':_0x4b23('0x109'),'foreignKey':_0x4b23('0x100')});db['User']['hasMany'](db[_0x4b23('0xf3')],{'as':'WhatsappInteractions','foreignKey':_0x4b23('0x100')});db[_0x4b23('0x14')][_0x4b23('0x101')](db[_0x4b23('0x10a')],{'as':_0x4b23('0x10b'),'foreignKey':'SenderId'});db[_0x4b23('0x14')][_0x4b23('0x10c')](db[_0x4b23('0xed')],{'as':_0x4b23('0xed'),'foreignKey':'userProfileId'});db['User'][_0x4b23('0x10d')](db[_0x4b23('0x72')],{'as':_0x4b23('0x10e'),'through':_0x4b23('0x10f')});db['User'][_0x4b23('0x10d')](db[_0x4b23('0x110')],{'as':'Contacts','through':_0x4b23('0x111')});db[_0x4b23('0x14')][_0x4b23('0x10d')](db[_0x4b23('0xea')],{'as':_0x4b23('0x112'),'through':_0x4b23('0x113')});db['User'][_0x4b23('0x10d')](db[_0x4b23('0xdb')],{'through':_0x4b23('0x114')});db[_0x4b23('0x14')][_0x4b23('0x10d')](db[_0x4b23('0x43')],{'as':_0x4b23('0x109'),'through':_0x4b23('0x115')});db['User'][_0x4b23('0x10d')](db['ChatInteraction'],{'as':_0x4b23('0x106'),'through':_0x4b23('0x116')});db[_0x4b23('0x14')][_0x4b23('0x10d')](db[_0x4b23('0x50')],{'as':_0x4b23('0x108'),'through':_0x4b23('0x117')});db['User'][_0x4b23('0x10d')](db[_0x4b23('0x5a')],{'as':_0x4b23('0x107'),'through':'user_has_sms_interactions'});db['User']['belongsToMany'](db[_0x4b23('0x63')],{'as':_0x4b23('0x105'),'through':_0x4b23('0x118')});db[_0x4b23('0x14')][_0x4b23('0x10d')](db['WhatsappInteraction'],{'as':_0x4b23('0x119'),'through':_0x4b23('0x11a')});db[_0x4b23('0x14')]['belongsToMany'](db[_0x4b23('0x1e')],{'as':_0x4b23('0x11b'),'through':_0x4b23('0x11c'),'required':![]});db[_0x4b23('0x14')][_0x4b23('0x10d')](db[_0x4b23('0x40')],{'as':_0x4b23('0x11d'),'through':_0x4b23('0x34'),'required':![]});db[_0x4b23('0x14')]['belongsToMany'](db[_0x4b23('0x70')],{'as':'ChatQueues','through':_0x4b23('0x32'),'required':![],'hooks':!![]});db[_0x4b23('0x14')][_0x4b23('0x10d')](db[_0x4b23('0x53')],{'as':_0x4b23('0x11e'),'through':_0x4b23('0x11f'),'required':![]});db[_0x4b23('0x14')][_0x4b23('0x10d')](db[_0x4b23('0x5e')],{'as':_0x4b23('0x120'),'through':_0x4b23('0x36'),'required':![]});db[_0x4b23('0x14')]['belongsToMany'](db[_0x4b23('0x67')],{'as':_0x4b23('0x121'),'through':_0x4b23('0x122'),'required':![]});db[_0x4b23('0x14')][_0x4b23('0x10d')](db[_0x4b23('0xfa')],{'as':_0x4b23('0x123'),'through':_0x4b23('0x39'),'required':![]});db[_0x4b23('0x14')][_0x4b23('0x10d')](db['CmList'],{'through':'cm_user_has_lists'});db['User'][_0x4b23('0x10d')](db[_0x4b23('0x124')],{'as':'VoicePrefixes','through':'user_has_voice_prefixes','required':![]});db[_0x4b23('0x14')][_0x4b23('0x10d')](db[_0x4b23('0x125')],{'as':'ChatWebsites','through':_0x4b23('0x126')});db[_0x4b23('0x14')][_0x4b23('0x10d')](db[_0x4b23('0x4d')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db['User'][_0x4b23('0x10d')](db[_0x4b23('0x3e')],{'as':_0x4b23('0x127'),'through':_0x4b23('0x128')});db[_0x4b23('0x14')]['belongsToMany'](db[_0x4b23('0x5f')],{'as':_0x4b23('0x129'),'through':_0x4b23('0x12a')});db[_0x4b23('0x14')]['belongsToMany'](db[_0x4b23('0x56')],{'as':_0x4b23('0x12b'),'through':_0x4b23('0x12c')});db['User']['belongsToMany'](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x4b23('0x14')][_0x4b23('0x10d')](db['SquareProject'],{'as':_0x4b23('0x12d'),'through':_0x4b23('0x12e')});db['VoiceChanSpy'][_0x4b23('0x101')](db[_0x4b23('0x1b')],{'as':_0x4b23('0x12f'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x130')});db[_0x4b23('0x19')][_0x4b23('0x101')](db['VoiceExtension'],{'onDelete':_0x4b23('0xfe')});db[_0x4b23('0x1b')][_0x4b23('0x101')](db[_0x4b23('0x1b')],{'as':_0x4b23('0x131'),'onDelete':_0x4b23('0xfe')});db[_0x4b23('0x1d')]['belongsToMany'](db[_0x4b23('0x132')],{'as':_0x4b23('0x133'),'through':'moh_has_sounds'});db[_0x4b23('0x1e')][_0x4b23('0x101')](db[_0x4b23('0x30')],{'as':_0x4b23('0x134'),'foreignKey':_0x4b23('0x135')});db[_0x4b23('0x1e')][_0x4b23('0x101')](db['CmHopper'],{'as':_0x4b23('0x136'),'foreignKey':_0x4b23('0x135')});db[_0x4b23('0x1e')][_0x4b23('0x101')](db[_0x4b23('0x7a')],{'as':_0x4b23('0x103'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x4b23('0x101')](db[_0x4b23('0x7b')],{'as':'HopperHistories','foreignKey':_0x4b23('0x135')});db[_0x4b23('0x1e')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x4b23('0x135')});db[_0x4b23('0x1e')][_0x4b23('0x101')](db[_0x4b23('0x78')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x4b23('0x1e')][_0x4b23('0x101')](db[_0x4b23('0x137')],{'as':_0x4b23('0x138'),'foreignKey':_0x4b23('0x135')});db['VoiceQueue'][_0x4b23('0x10c')](db[_0x4b23('0x2d')],{'as':_0x4b23('0x2d'),'foreignKey':_0x4b23('0x139')});db[_0x4b23('0x1e')]['belongsTo'](db[_0x4b23('0x2d')],{'as':'TrunkBackup','foreignKey':_0x4b23('0x13a')});db[_0x4b23('0x1e')]['belongsTo'](db[_0x4b23('0x88')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x4b23('0x1e')][_0x4b23('0x10c')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x4b23('0x13b')});db['VoiceQueue'][_0x4b23('0x10d')](db[_0x4b23('0xea')],{'as':_0x4b23('0x112'),'through':_0x4b23('0x13c')});db[_0x4b23('0x1e')][_0x4b23('0x10d')](db[_0x4b23('0x14')],{'as':_0x4b23('0x13d'),'through':_0x4b23('0x11c')});db['VoiceQueue'][_0x4b23('0x10d')](db[_0x4b23('0xdb')],{'as':_0x4b23('0x13e'),'through':'team_has_voice_queues'});db[_0x4b23('0x1e')][_0x4b23('0x10d')](db[_0x4b23('0xea')],{'as':_0x4b23('0x13f'),'through':'voice_queues_has_cm_blacklists'});db[_0x4b23('0x20')]['belongsTo'](db[_0x4b23('0x14')],{'as':_0x4b23('0x14'),'foreignKey':_0x4b23('0x100')});db[_0x4b23('0x22')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'as':'User','foreignKey':_0x4b23('0x100')});db[_0x4b23('0xfd')]['hasMany'](db[_0x4b23('0x24')],{'as':_0x4b23('0x140'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x141'),'sourceKey':_0x4b23('0x142')});db['VoiceMailMessage']['belongsTo'](db[_0x4b23('0xfd')],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db[_0x4b23('0x25')]['hasMany'](db[_0x4b23('0x2a')],{'as':_0x4b23('0x143'),'foreignKey':_0x4b23('0x144'),'constraints':![]});db[_0x4b23('0x25')]['hasMany'](db[_0x4b23('0x28')],{'as':_0x4b23('0x145'),'foreignKey':_0x4b23('0x144'),'constraints':![]});db[_0x4b23('0x25')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'as':'User','foreignKey':_0x4b23('0x100')});db[_0x4b23('0x25')][_0x4b23('0x10c')](db['CmContact'],{'as':_0x4b23('0x146'),'foreignKey':'ContactId'});db['MailServerIn'][_0x4b23('0x10c')](db[_0x4b23('0x3e')],{'as':_0x4b23('0x3e'),'foreignKey':_0x4b23('0x147')});db[_0x4b23('0x148')][_0x4b23('0x10c')](db['MailAccount'],{'as':_0x4b23('0x3e'),'foreignKey':_0x4b23('0x147')});db[_0x4b23('0x3e')][_0x4b23('0xfc')](db['MailServerIn'],{'as':_0x4b23('0x149'),'onDelete':'cascade'});db['MailAccount'][_0x4b23('0xfc')](db[_0x4b23('0x148')],{'as':_0x4b23('0x14a'),'onDelete':'cascade'});db['MailAccount'][_0x4b23('0x101')](db[_0x4b23('0x85')],{'as':_0x4b23('0x14b'),'foreignKey':_0x4b23('0x147')});db[_0x4b23('0x3e')][_0x4b23('0x101')](db[_0x4b23('0x83')],{'as':_0x4b23('0x14c'),'foreignKey':_0x4b23('0x147')});db[_0x4b23('0x3e')]['hasMany'](db[_0x4b23('0x14d')],{'as':_0x4b23('0x140'),'foreignKey':_0x4b23('0x147')});db[_0x4b23('0x3e')][_0x4b23('0x101')](db['MailInteraction'],{'as':_0x4b23('0x14e')});db['MailAccount'][_0x4b23('0x101')](db[_0x4b23('0x46')],{'as':_0x4b23('0x131')});db[_0x4b23('0x3e')][_0x4b23('0x10c')](db['CmList'],{'as':_0x4b23('0x14f'),'foreignKey':'ListId'});db[_0x4b23('0x3e')]['belongsTo'](db[_0x4b23('0x8f')],{'as':_0x4b23('0x8f'),'foreignKey':_0x4b23('0x150')});db[_0x4b23('0x3e')][_0x4b23('0x10c')](db[_0x4b23('0x151')],{'as':_0x4b23('0x152'),'foreignKey':_0x4b23('0x13b')});db['MailAccount'][_0x4b23('0x10d')](db[_0x4b23('0x14')],{'as':_0x4b23('0x13d'),'through':_0x4b23('0x128')});db[_0x4b23('0x40')][_0x4b23('0x10d')](db['User'],{'as':_0x4b23('0x13d'),'through':_0x4b23('0x34')});db[_0x4b23('0x40')][_0x4b23('0x10d')](db['Team'],{'through':'team_has_mail_queues','as':_0x4b23('0x13e')});db[_0x4b23('0x43')][_0x4b23('0x101')](db[_0x4b23('0x14d')],{'as':_0x4b23('0x140'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x4b23('0x43')][_0x4b23('0x10c')](db[_0x4b23('0x3e')],{'as':'Account','foreignKey':_0x4b23('0x147')});db[_0x4b23('0x43')]['belongsTo'](db[_0x4b23('0x110')],{'as':_0x4b23('0x146'),'foreignKey':_0x4b23('0x153')});db['MailInteraction']['belongsTo'](db['User'],{'as':_0x4b23('0x154'),'foreignKey':_0x4b23('0x100')});db[_0x4b23('0x43')][_0x4b23('0x10d')](db['Tag'],{'through':_0x4b23('0x155'),'as':'Tags'});db[_0x4b23('0x43')][_0x4b23('0x10d')](db[_0x4b23('0x8e')],{'through':'mail_interaction_has_tags','as':_0x4b23('0x156')});db[_0x4b23('0x43')][_0x4b23('0x10d')](db[_0x4b23('0x14')],{'as':'Users','through':_0x4b23('0x115'),'foreignKey':_0x4b23('0x157')});db[_0x4b23('0x14d')][_0x4b23('0x101')](db[_0x4b23('0xe1')],{'as':_0x4b23('0x158'),'onDelete':'cascade'});db[_0x4b23('0x14d')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'as':'User'});db[_0x4b23('0x14d')][_0x4b23('0x10c')](db['CmContact'],{'onDelete':'cascade','as':_0x4b23('0x146')});db[_0x4b23('0x14d')][_0x4b23('0x10c')](db[_0x4b23('0x43')],{'as':'Interaction','foreignKey':_0x4b23('0x157')});db['MailMessage'][_0x4b23('0x10c')](db[_0x4b23('0x3e')],{'as':'Account','foreignKey':_0x4b23('0x147')});db[_0x4b23('0x46')]['belongsTo'](db['User'],{'onDelete':_0x4b23('0x159')});db['MailApplication'][_0x4b23('0x10c')](db[_0x4b23('0x40')],{'onDelete':_0x4b23('0x159')});db[_0x4b23('0x46')][_0x4b23('0x10c')](db[_0x4b23('0x3e')],{'onDelete':_0x4b23('0x159')});db[_0x4b23('0x46')][_0x4b23('0x10c')](db[_0x4b23('0x88')],{'onDelete':_0x4b23('0x159'),'foreignKey':_0x4b23('0x15a')});db[_0x4b23('0x46')][_0x4b23('0x10c')](db[_0x4b23('0x8e')],{'onDelete':_0x4b23('0x159'),'foreignKey':_0x4b23('0x15b')});db[_0x4b23('0x48')]['belongsTo'](db['MailAccount'],{});db['MailQueueReport'][_0x4b23('0x10c')](db['CmList'],{'as':_0x4b23('0x14f'),'foreignKey':_0x4b23('0x15c')});db[_0x4b23('0x48')]['belongsTo'](db[_0x4b23('0x110')],{'as':'Contact','foreignKey':'ContactId'});db['MailQueueReport']['belongsTo'](db[_0x4b23('0x43')],{});db[_0x4b23('0x48')][_0x4b23('0x10c')](db[_0x4b23('0x14d')],{});db[_0x4b23('0x48')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{});db[_0x4b23('0x48')]['belongsTo'](db[_0x4b23('0x40')],{});db[_0x4b23('0x4a')][_0x4b23('0x101')](db['DashboardItem'],{'as':_0x4b23('0x15d'),'onDelete':'cascade'});db[_0x4b23('0x4d')][_0x4b23('0x101')](db['Disposition'],{'as':_0x4b23('0x14b'),'foreignKey':_0x4b23('0x15e')});db[_0x4b23('0x4d')][_0x4b23('0x101')](db[_0x4b23('0x83')],{'as':_0x4b23('0x14c'),'foreignKey':_0x4b23('0x15e')});db[_0x4b23('0x4d')]['hasMany'](db['FaxInteraction'],{'as':_0x4b23('0x14e')});db[_0x4b23('0x4d')][_0x4b23('0x101')](db[_0x4b23('0x4f')],{'as':_0x4b23('0x131')});db[_0x4b23('0x4d')][_0x4b23('0x101')](db[_0x4b23('0x1b')],{'as':_0x4b23('0x15f'),'onDelete':_0x4b23('0xfe')});db[_0x4b23('0x4d')][_0x4b23('0x101')](db['FaxMessage'],{'as':_0x4b23('0x140')});db['FaxAccount'][_0x4b23('0x10c')](db['Trunk'],{'as':_0x4b23('0x2d')});db[_0x4b23('0x4d')]['belongsTo'](db[_0x4b23('0xea')],{'as':_0x4b23('0x14f'),'foreignKey':'ListId'});db[_0x4b23('0x4d')][_0x4b23('0x10c')](db['Pause'],{'as':_0x4b23('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x4b23('0x4d')][_0x4b23('0x10d')](db['User'],{'as':_0x4b23('0x13d'),'through':_0x4b23('0x160')});db['FaxApplication'][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'onDelete':_0x4b23('0x159')});db[_0x4b23('0x4f')][_0x4b23('0x10c')](db[_0x4b23('0x53')],{'onDelete':_0x4b23('0x159')});db[_0x4b23('0x4f')][_0x4b23('0x10c')](db[_0x4b23('0x4d')],{'onDelete':'restrict'});db[_0x4b23('0x4f')][_0x4b23('0x10c')](db[_0x4b23('0x8e')],{'onDelete':_0x4b23('0x159'),'foreignKey':_0x4b23('0x15b')});db[_0x4b23('0x50')][_0x4b23('0x101')](db[_0x4b23('0x51')],{'as':_0x4b23('0x140'),'onDelete':'cascade','foreignKey':_0x4b23('0x161')});db[_0x4b23('0x50')]['belongsTo'](db[_0x4b23('0x4d')],{'as':_0x4b23('0x162'),'foreignKey':_0x4b23('0x15e')});db['FaxInteraction'][_0x4b23('0x10c')](db[_0x4b23('0x110')],{'as':_0x4b23('0x146'),'foreignKey':'ContactId'});db[_0x4b23('0x50')][_0x4b23('0x10c')](db['User'],{'as':_0x4b23('0x154'),'foreignKey':_0x4b23('0x100')});db[_0x4b23('0x50')][_0x4b23('0x10d')](db[_0x4b23('0x8e')],{'through':'fax_interaction_has_tags','as':_0x4b23('0x163')});db[_0x4b23('0x50')][_0x4b23('0x10d')](db[_0x4b23('0x8e')],{'through':_0x4b23('0x164'),'as':'ThroughTags'});db['FaxInteraction']['belongsToMany'](db[_0x4b23('0x14')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0x4b23('0x161')});db[_0x4b23('0x51')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'onDelete':_0x4b23('0xfe'),'as':'User'});db[_0x4b23('0x51')][_0x4b23('0x10c')](db[_0x4b23('0x50')],{'as':_0x4b23('0x165'),'foreignKey':'FaxInteractionId'});db[_0x4b23('0x51')][_0x4b23('0x10c')](db[_0x4b23('0x110')],{'onDelete':_0x4b23('0xfe'),'as':_0x4b23('0x146')});db[_0x4b23('0x51')][_0x4b23('0x10c')](db[_0x4b23('0xe1')],{'as':'Attachment','foreignKey':_0x4b23('0x166')});db[_0x4b23('0x51')][_0x4b23('0x10c')](db['FaxAccount'],{'as':_0x4b23('0x162'),'foreignKey':_0x4b23('0x15e')});db[_0x4b23('0x53')][_0x4b23('0x10d')](db[_0x4b23('0x14')],{'as':_0x4b23('0x13d'),'through':_0x4b23('0x11f')});db[_0x4b23('0x53')][_0x4b23('0x10d')](db['Team'],{'through':_0x4b23('0x167'),'as':_0x4b23('0x13e')});db[_0x4b23('0x54')]['belongsTo'](db['FaxAccount'],{});db[_0x4b23('0x54')][_0x4b23('0x10c')](db[_0x4b23('0xea')],{'as':_0x4b23('0x14f'),'foreignKey':_0x4b23('0x15c')});db[_0x4b23('0x54')][_0x4b23('0x10c')](db[_0x4b23('0x110')],{'as':'Contact','foreignKey':'ContactId'});db[_0x4b23('0x54')][_0x4b23('0x10c')](db['FaxInteraction'],{});db['FaxQueueReport'][_0x4b23('0x10c')](db[_0x4b23('0x51')],{});db[_0x4b23('0x54')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{});db[_0x4b23('0x54')][_0x4b23('0x10c')](db[_0x4b23('0x53')],{});db['SmsAccount']['hasMany'](db[_0x4b23('0x85')],{'as':'Dispositions','foreignKey':_0x4b23('0x168')});db[_0x4b23('0x56')][_0x4b23('0x101')](db[_0x4b23('0x83')],{'as':_0x4b23('0x14c'),'foreignKey':_0x4b23('0x168')});db['SmsAccount']['hasMany'](db[_0x4b23('0x5c')],{'as':_0x4b23('0x140'),'foreignKey':_0x4b23('0x168')});db[_0x4b23('0x56')][_0x4b23('0x101')](db['SmsInteraction'],{'as':_0x4b23('0x14e')});db[_0x4b23('0x56')][_0x4b23('0x101')](db[_0x4b23('0x58')],{'as':'Applications'});db[_0x4b23('0x56')][_0x4b23('0x10c')](db[_0x4b23('0xea')],{'as':_0x4b23('0x14f'),'foreignKey':_0x4b23('0x15c')});db[_0x4b23('0x56')][_0x4b23('0x10c')](db[_0x4b23('0x151')],{'as':_0x4b23('0x152'),'foreignKey':_0x4b23('0x13b')});db['SmsAccount'][_0x4b23('0x10d')](db['User'],{'as':_0x4b23('0x13d'),'through':_0x4b23('0x12c')});db[_0x4b23('0x58')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'onDelete':'restrict'});db[_0x4b23('0x58')][_0x4b23('0x10c')](db[_0x4b23('0x5e')],{'onDelete':'restrict'});db['SmsApplication']['belongsTo'](db[_0x4b23('0x56')],{'onDelete':_0x4b23('0x159')});db[_0x4b23('0x58')][_0x4b23('0x10c')](db[_0x4b23('0x88')],{'onDelete':_0x4b23('0x159'),'foreignKey':_0x4b23('0x15a')});db[_0x4b23('0x58')][_0x4b23('0x10c')](db[_0x4b23('0x8e')],{'onDelete':_0x4b23('0x159'),'foreignKey':_0x4b23('0x15b')});db[_0x4b23('0x5a')]['hasMany'](db[_0x4b23('0x5c')],{'as':_0x4b23('0x140'),'onDelete':'cascade','foreignKey':_0x4b23('0x169')});db[_0x4b23('0x5a')][_0x4b23('0x10c')](db[_0x4b23('0x56')],{'as':_0x4b23('0x162'),'foreignKey':_0x4b23('0x168')});db[_0x4b23('0x5a')][_0x4b23('0x10c')](db['CmContact'],{'as':_0x4b23('0x146'),'foreignKey':_0x4b23('0x153')});db[_0x4b23('0x5a')]['belongsTo'](db['User'],{'as':_0x4b23('0x154'),'foreignKey':'UserId'});db[_0x4b23('0x5a')][_0x4b23('0x10d')](db[_0x4b23('0x8e')],{'through':_0x4b23('0x16a'),'as':_0x4b23('0x163')});db[_0x4b23('0x5a')][_0x4b23('0x10d')](db['Tag'],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0x4b23('0x5a')][_0x4b23('0x10d')](db['User'],{'as':_0x4b23('0x16b'),'through':_0x4b23('0x16c'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'as':_0x4b23('0x14')});db[_0x4b23('0x5c')]['belongsTo'](db[_0x4b23('0x110')],{'onDelete':_0x4b23('0xfe'),'as':'Contact'});db[_0x4b23('0x5c')]['belongsTo'](db[_0x4b23('0x5a')],{'onDelete':_0x4b23('0xfe'),'as':_0x4b23('0x165'),'foreignKey':_0x4b23('0x169')});db[_0x4b23('0x5c')][_0x4b23('0x10c')](db[_0x4b23('0x56')],{'as':_0x4b23('0x162'),'foreignKey':_0x4b23('0x168')});db[_0x4b23('0x5e')][_0x4b23('0x10d')](db[_0x4b23('0x14')],{'as':_0x4b23('0x13d'),'through':_0x4b23('0x36'),'foreignKey':_0x4b23('0x16d')});db['SmsQueue'][_0x4b23('0x10d')](db['Team'],{'through':_0x4b23('0x16e'),'as':_0x4b23('0x13e')});db[_0x4b23('0x5f')][_0x4b23('0x101')](db[_0x4b23('0x85')],{'as':_0x4b23('0x14b'),'foreignKey':'OpenchannelAccountId'});db[_0x4b23('0x5f')]['hasMany'](db[_0x4b23('0x83')],{'as':_0x4b23('0x14c'),'foreignKey':'OpenchannelAccountId'});db[_0x4b23('0x5f')]['hasMany'](db[_0x4b23('0x63')],{'as':_0x4b23('0x14e'),'foreignKey':_0x4b23('0x16f')});db[_0x4b23('0x5f')][_0x4b23('0x101')](db[_0x4b23('0x65')],{'as':_0x4b23('0x140'),'foreignKey':'OpenchannelAccountId'});db[_0x4b23('0x5f')][_0x4b23('0x101')](db[_0x4b23('0x61')],{'as':_0x4b23('0x131'),'foreignKey':_0x4b23('0x16f')});db['OpenchannelAccount'][_0x4b23('0x10c')](db[_0x4b23('0xea')],{'as':'List','foreignKey':_0x4b23('0x15c')});db[_0x4b23('0x5f')]['belongsTo'](db[_0x4b23('0x151')],{'as':_0x4b23('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0x4b23('0x10d')](db[_0x4b23('0x14')],{'as':'Agents','through':_0x4b23('0x12a')});db[_0x4b23('0x61')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'onDelete':_0x4b23('0x159')});db[_0x4b23('0x61')][_0x4b23('0x10c')](db['OpenchannelQueue'],{'onDelete':_0x4b23('0x159'),'foreignKey':'OpenchannelQueueId'});db[_0x4b23('0x61')][_0x4b23('0x10c')](db[_0x4b23('0x5f')],{'onDelete':_0x4b23('0x159'),'foreignKey':'OpenchannelAccountId'});db[_0x4b23('0x61')][_0x4b23('0x10c')](db[_0x4b23('0x88')],{'onDelete':_0x4b23('0x159'),'foreignKey':_0x4b23('0x15a')});db['OpenchannelApplication'][_0x4b23('0x10c')](db[_0x4b23('0x8e')],{'onDelete':_0x4b23('0x159'),'foreignKey':_0x4b23('0x15b')});db[_0x4b23('0x63')][_0x4b23('0x101')](db[_0x4b23('0x65')],{'as':'Messages','onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x170')});db[_0x4b23('0x63')][_0x4b23('0x10c')](db[_0x4b23('0x5f')],{'as':_0x4b23('0x162'),'foreignKey':_0x4b23('0x16f')});db[_0x4b23('0x63')][_0x4b23('0x10c')](db[_0x4b23('0x110')],{'as':_0x4b23('0x146'),'foreignKey':_0x4b23('0x153')});db['OpenchannelInteraction']['belongsTo'](db[_0x4b23('0x14')],{'as':'Owner','foreignKey':_0x4b23('0x100')});db[_0x4b23('0x63')]['belongsToMany'](db[_0x4b23('0x8e')],{'through':'openchannel_interaction_has_tags','as':'Tags'});db[_0x4b23('0x63')][_0x4b23('0x10d')](db['Tag'],{'through':_0x4b23('0x171'),'as':_0x4b23('0x156')});db[_0x4b23('0x63')]['belongsToMany'](db[_0x4b23('0x14')],{'as':_0x4b23('0x16b'),'through':_0x4b23('0x118'),'foreignKey':'OpenchannelInteractionId'});db[_0x4b23('0x65')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'onDelete':_0x4b23('0xfe'),'as':_0x4b23('0x14')});db[_0x4b23('0x65')][_0x4b23('0x10c')](db[_0x4b23('0x110')],{'onDelete':_0x4b23('0xfe'),'as':_0x4b23('0x146')});db[_0x4b23('0x65')][_0x4b23('0x10c')](db['OpenchannelInteraction'],{'onDelete':_0x4b23('0xfe'),'as':'Interaction','foreignKey':'OpenchannelInteractionId'});db[_0x4b23('0x65')][_0x4b23('0x10c')](db[_0x4b23('0xe1')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x4b23('0x65')][_0x4b23('0x10c')](db[_0x4b23('0x5f')],{'as':_0x4b23('0x162'),'foreignKey':_0x4b23('0x16f')});db[_0x4b23('0x67')][_0x4b23('0x10d')](db[_0x4b23('0x14')],{'as':_0x4b23('0x13d'),'through':'UserOpenchannelQueue','foreignKey':_0x4b23('0x172')});db['OpenchannelQueue'][_0x4b23('0x10d')](db[_0x4b23('0xdb')],{'through':_0x4b23('0x173'),'as':_0x4b23('0x13e')});db['ChatWebsite'][_0x4b23('0x101')](db[_0x4b23('0x85')],{'as':_0x4b23('0x14b'),'foreignKey':_0x4b23('0x174')});db['ChatWebsite'][_0x4b23('0x101')](db[_0x4b23('0x83')],{'as':'Answers','foreignKey':_0x4b23('0x174')});db['ChatWebsite']['hasMany'](db[_0x4b23('0x73')],{'as':_0x4b23('0x175')});db[_0x4b23('0x125')][_0x4b23('0x101')](db[_0x4b23('0x176')],{'as':_0x4b23('0x14e')});db['ChatWebsite'][_0x4b23('0x101')](db[_0x4b23('0x6a')],{'as':_0x4b23('0x131')});db['ChatWebsite'][_0x4b23('0x101')](db[_0x4b23('0x6d')],{'as':_0x4b23('0x140')});db[_0x4b23('0x125')][_0x4b23('0x10c')](db[_0x4b23('0xea')],{'as':_0x4b23('0x14f'),'foreignKey':'ListId'});db[_0x4b23('0x125')]['belongsTo'](db[_0x4b23('0x88')],{'as':_0x4b23('0x88'),'foreignKey':_0x4b23('0x15a')});db[_0x4b23('0x125')][_0x4b23('0x10c')](db[_0x4b23('0x151')],{'as':_0x4b23('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x4b23('0x125')][_0x4b23('0x10d')](db['User'],{'as':_0x4b23('0x13d'),'through':_0x4b23('0x126')});db[_0x4b23('0x177')][_0x4b23('0x10c')](db[_0x4b23('0x5f')],{});db[_0x4b23('0x177')][_0x4b23('0x10c')](db[_0x4b23('0xea')],{'as':_0x4b23('0x14f'),'foreignKey':_0x4b23('0x15c')});db[_0x4b23('0x177')]['belongsTo'](db[_0x4b23('0x110')],{'as':_0x4b23('0x146'),'foreignKey':_0x4b23('0x153')});db[_0x4b23('0x177')][_0x4b23('0x10c')](db[_0x4b23('0x63')],{});db[_0x4b23('0x177')][_0x4b23('0x10c')](db[_0x4b23('0x65')],{});db[_0x4b23('0x177')][_0x4b23('0x10c')](db['User'],{});db[_0x4b23('0x177')]['belongsTo'](db[_0x4b23('0x67')],{});db['ChatApplication']['belongsTo'](db[_0x4b23('0x14')],{'as':_0x4b23('0x178'),'foreignKey':'UserId','onDelete':_0x4b23('0x159')});db[_0x4b23('0x6a')][_0x4b23('0x10c')](db[_0x4b23('0x70')],{'as':'Queue','foreignKey':_0x4b23('0x179'),'onDelete':_0x4b23('0x159')});db[_0x4b23('0x6a')]['belongsTo'](db[_0x4b23('0x125')],{'as':_0x4b23('0x17a'),'foreignKey':_0x4b23('0x174'),'onDelete':_0x4b23('0x159')});db[_0x4b23('0x6a')][_0x4b23('0x10c')](db[_0x4b23('0x8e')],{'onDelete':'restrict','foreignKey':_0x4b23('0x15b')});db[_0x4b23('0x176')][_0x4b23('0x101')](db[_0x4b23('0x6d')],{'as':_0x4b23('0x140'),'onDelete':'cascade','foreignKey':_0x4b23('0x17b')});db['ChatInteraction'][_0x4b23('0x10c')](db[_0x4b23('0x125')],{'as':_0x4b23('0x162'),'foreignKey':_0x4b23('0x174')});db[_0x4b23('0x176')]['belongsTo'](db['CmContact'],{'as':_0x4b23('0x146'),'foreignKey':_0x4b23('0x153')});db['ChatInteraction']['belongsTo'](db[_0x4b23('0x14')],{'as':_0x4b23('0x154'),'foreignKey':_0x4b23('0x100')});db['ChatInteraction'][_0x4b23('0x10d')](db['Tag'],{'through':_0x4b23('0x17c'),'as':_0x4b23('0x163')});db[_0x4b23('0x176')][_0x4b23('0x10d')](db[_0x4b23('0x8e')],{'through':_0x4b23('0x17c'),'as':_0x4b23('0x156')});db[_0x4b23('0x176')][_0x4b23('0x10d')](db[_0x4b23('0x14')],{'as':_0x4b23('0x16b'),'through':_0x4b23('0x116'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'onDelete':_0x4b23('0xfe'),'as':_0x4b23('0x14')});db['ChatMessage']['belongsTo'](db[_0x4b23('0x110')],{'onDelete':_0x4b23('0xfe'),'as':_0x4b23('0x146'),'foreignKey':'ContactId'});db['ChatMessage']['belongsTo'](db[_0x4b23('0x176')],{'onDelete':_0x4b23('0xfe'),'as':'Interaction','foreignKey':_0x4b23('0x17b')});db['ChatMessage'][_0x4b23('0x10c')](db[_0x4b23('0xe1')],{'as':'Attachment','foreignKey':_0x4b23('0x166')});db[_0x4b23('0x6d')][_0x4b23('0x10c')](db[_0x4b23('0x125')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x4b23('0x6f')][_0x4b23('0x10c')](db['CmContact'],{'onDelete':_0x4b23('0xfe'),'as':_0x4b23('0x146'),'foreignKey':_0x4b23('0x153')});db[_0x4b23('0x6f')][_0x4b23('0x10c')](db[_0x4b23('0x125')],{'as':_0x4b23('0x162'),'foreignKey':_0x4b23('0x174')});db[_0x4b23('0x70')][_0x4b23('0x10d')](db['User'],{'as':_0x4b23('0x13d'),'through':_0x4b23('0x32'),'hooks':!![]});db[_0x4b23('0x70')][_0x4b23('0x10d')](db['Team'],{'through':_0x4b23('0x17d'),'as':_0x4b23('0x13e')});db[_0x4b23('0x72')]['hasMany'](db[_0x4b23('0xce')],{'as':'Messages','foreignKey':_0x4b23('0x17e'),'onDelete':'cascade'});db[_0x4b23('0x72')][_0x4b23('0x10d')](db[_0x4b23('0x14')],{'as':_0x4b23('0x134'),'through':'chat_group_has_users'});db[_0x4b23('0x73')][_0x4b23('0x10c')](db[_0x4b23('0x125')],{'as':_0x4b23('0x17a'),'foreignKey':_0x4b23('0x174')});db[_0x4b23('0x17f')]['hasMany'](db[_0x4b23('0x110')],{'as':_0x4b23('0x180'),'foreignKey':_0x4b23('0x181')});db[_0x4b23('0x110')][_0x4b23('0x101')](db[_0x4b23('0x76')],{'as':_0x4b23('0x136'),'foreignKey':_0x4b23('0x153')});db[_0x4b23('0x110')][_0x4b23('0x101')](db['CmHopperFinal'],{'as':_0x4b23('0x103'),'foreignKey':_0x4b23('0x153')});db[_0x4b23('0x110')][_0x4b23('0x101')](db[_0x4b23('0x7b')],{'as':_0x4b23('0x182'),'foreignKey':_0x4b23('0x153')});db[_0x4b23('0x110')][_0x4b23('0x101')](db[_0x4b23('0x7d')],{'as':_0x4b23('0x7d'),'foreignKey':'ContactId'});db[_0x4b23('0x110')][_0x4b23('0x101')](db[_0x4b23('0x137')],{'as':_0x4b23('0x138'),'foreignKey':'ContactId'});db[_0x4b23('0x110')]['hasMany'](db[_0x4b23('0x63')],{'as':_0x4b23('0x105'),'foreignKey':_0x4b23('0x153'),'onDelete':_0x4b23('0x159')});db[_0x4b23('0x110')]['hasMany'](db[_0x4b23('0x176')],{'as':_0x4b23('0x106'),'foreignKey':_0x4b23('0x153'),'onDelete':_0x4b23('0x159')});db['CmContact']['hasMany'](db[_0x4b23('0x5a')],{'as':_0x4b23('0x107'),'foreignKey':_0x4b23('0x153'),'onDelete':'restrict'});db[_0x4b23('0x110')]['hasMany'](db[_0x4b23('0x50')],{'as':_0x4b23('0x108'),'foreignKey':_0x4b23('0x153'),'onDelete':'restrict'});db[_0x4b23('0x110')]['hasMany'](db[_0x4b23('0x43')],{'as':_0x4b23('0x109'),'foreignKey':'ContactId','onDelete':_0x4b23('0x159')});db[_0x4b23('0x110')][_0x4b23('0x10c')](db['CmCompany'],{'as':_0x4b23('0x183'),'foreignKey':_0x4b23('0x181')});db[_0x4b23('0x110')][_0x4b23('0x10c')](db[_0x4b23('0xea')],{'as':_0x4b23('0x14f'),'foreignKey':_0x4b23('0x15c'),'onDelete':_0x4b23('0xfe')});db['CmContact'][_0x4b23('0x10d')](db['User'],{'as':'Users','through':_0x4b23('0x111')});db[_0x4b23('0x110')][_0x4b23('0x10d')](db[_0x4b23('0x8e')],{'as':_0x4b23('0x163'),'through':'cm_contact_has_tags'});db['CmContact']['belongsToMany'](db[_0x4b23('0x8e')],{'through':_0x4b23('0x184'),'as':_0x4b23('0x156')});db[_0x4b23('0x76')][_0x4b23('0x10c')](db[_0x4b23('0x110')],{'as':'Contact','foreignKey':_0x4b23('0x153'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db['CmList'],{'as':_0x4b23('0x14f'),'foreignKey':_0x4b23('0x15c'),'onDelete':_0x4b23('0xfe')});db[_0x4b23('0x76')][_0x4b23('0x10c')](db['User'],{'as':_0x4b23('0x178'),'foreignKey':_0x4b23('0x100')});db[_0x4b23('0x76')][_0x4b23('0x10c')](db[_0x4b23('0x1e')],{'as':'Queue','foreignKey':_0x4b23('0x135'),'onDelete':_0x4b23('0xfe')});db[_0x4b23('0x76')]['belongsTo'](db[_0x4b23('0x185')],{'as':_0x4b23('0x185'),'foreignKey':_0x4b23('0x186'),'onDelete':_0x4b23('0xfe')});db['CmHopper'][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'as':_0x4b23('0x154'),'foreignKey':_0x4b23('0x187')});db['CmHopperBlack']['belongsTo'](db[_0x4b23('0x110')],{'as':_0x4b23('0x146'),'foreignKey':_0x4b23('0x153'),'onDelete':_0x4b23('0xfe')});db[_0x4b23('0x78')][_0x4b23('0x10c')](db['CmList'],{'as':_0x4b23('0x14f'),'foreignKey':_0x4b23('0x15c'),'onDelete':_0x4b23('0xfe')});db['CmHopperBlack'][_0x4b23('0x10c')](db[_0x4b23('0x1e')],{'as':_0x4b23('0x188'),'foreignKey':_0x4b23('0x135'),'onDelete':_0x4b23('0xfe')});db['CmHopperBlack'][_0x4b23('0x10c')](db[_0x4b23('0x185')],{'as':_0x4b23('0x185'),'foreignKey':_0x4b23('0x186'),'onDelete':_0x4b23('0xfe')});db[_0x4b23('0x81')][_0x4b23('0x101')](db[_0x4b23('0x87')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0x4b23('0x189'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0x4b23('0x101')](db[_0x4b23('0x87')],{'as':{'plural':_0x4b23('0x18a'),'singular':_0x4b23('0x18b')},'foreignKey':_0x4b23('0x18c'),'onDelete':'cascade','hooks':!![]});db[_0x4b23('0x81')][_0x4b23('0x101')](db[_0x4b23('0x18d')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x4b23('0xfe'),'hooks':!![]});db['Interval']['hasMany'](db['Interval'],{'as':_0x4b23('0x18e'),'foreignKey':_0x4b23('0x15a'),'onDelete':_0x4b23('0xfe'),'hooks':!![],'required':![]});db[_0x4b23('0x88')]['hasMany'](db[_0x4b23('0x1b')],{'as':_0x4b23('0x102'),'foreignKey':_0x4b23('0x15a'),'onDelete':_0x4b23('0x159')});db[_0x4b23('0x88')]['hasMany'](db[_0x4b23('0x46')],{'as':_0x4b23('0x18f'),'foreignKey':'IntervalId'});db[_0x4b23('0x88')][_0x4b23('0x101')](db[_0x4b23('0x6a')],{'as':_0x4b23('0x190'),'foreignKey':_0x4b23('0x15a')});db['Interval'][_0x4b23('0x101')](db['FaxApplication'],{'as':_0x4b23('0x191'),'foreignKey':_0x4b23('0x15a')});db[_0x4b23('0x88')][_0x4b23('0x101')](db[_0x4b23('0x58')],{'as':_0x4b23('0x192'),'foreignKey':'IntervalId'});db[_0x4b23('0x193')][_0x4b23('0x10c')](db[_0x4b23('0x3e')],{});db['Schedule'][_0x4b23('0x10c')](db['AnalyticDefaultReport'],{'foreignKey':_0x4b23('0x194')});db[_0x4b23('0x193')][_0x4b23('0x10c')](db[_0x4b23('0x97')],{'foreignKey':_0x4b23('0x195')});db[_0x4b23('0x132')][_0x4b23('0x10d')](db[_0x4b23('0x1d')],{'as':_0x4b23('0x196'),'through':_0x4b23('0x197'),'onDelete':_0x4b23('0x159')});db['Tag'][_0x4b23('0x10d')](db[_0x4b23('0x110')],{'through':_0x4b23('0x184')});db[_0x4b23('0x8e')][_0x4b23('0x10d')](db[_0x4b23('0x176')],{'through':_0x4b23('0x17c')});db[_0x4b23('0x8e')][_0x4b23('0x10d')](db[_0x4b23('0x43')],{'through':_0x4b23('0x155')});db['Tag']['belongsToMany'](db[_0x4b23('0x5a')],{'through':_0x4b23('0x16a')});db[_0x4b23('0x8e')][_0x4b23('0x10d')](db[_0x4b23('0x50')],{'through':'fax_interaction_has_tags'});db[_0x4b23('0x8e')][_0x4b23('0x10d')](db[_0x4b23('0x63')],{'through':_0x4b23('0x171')});db[_0x4b23('0x8e')][_0x4b23('0x10d')](db[_0x4b23('0xf3')],{'through':_0x4b23('0x198')});db[_0x4b23('0x199')][_0x4b23('0x101')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0x4b23('0x19a')},'foreignKey':_0x4b23('0x19b'),'onDelete':_0x4b23('0xfe'),'hooks':!![]});db[_0x4b23('0x199')][_0x4b23('0x101')](db[_0x4b23('0x87')],{'as':{'plural':'AnyConditions','singular':_0x4b23('0x19c')},'foreignKey':_0x4b23('0x19d'),'onDelete':_0x4b23('0xfe'),'hooks':!![]});db[_0x4b23('0x199')][_0x4b23('0x101')](db['Action'],{'as':_0x4b23('0x19e'),'foreignKey':_0x4b23('0x19f'),'onDelete':_0x4b23('0xfe'),'hooks':!![]});db[_0x4b23('0x97')][_0x4b23('0x101')](db[_0x4b23('0x9f')],{'as':_0x4b23('0x1a0'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x195'),'hooks':!![]});db[_0x4b23('0x99')][_0x4b23('0x101')](db[_0x4b23('0x9f')],{'as':_0x4b23('0x1a0'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x194')});db[_0x4b23('0x9d')][_0x4b23('0x101')](db[_0x4b23('0x9f')],{'as':_0x4b23('0x1a0'),'onDelete':_0x4b23('0xfe'),'foreignKey':'MetricId'});db['AnalyticFieldReport'][_0x4b23('0x10c')](db[_0x4b23('0x9d')],{'foreignKey':_0x4b23('0x1a1')});db[_0x4b23('0xa3')][_0x4b23('0x101')](db['SalesforceConfiguration'],{'as':_0x4b23('0x1a2'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a3')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x4b23('0x1a4'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a5')});db[_0x4b23('0xa5')][_0x4b23('0x101')](db[_0x4b23('0xa6')],{'as':_0x4b23('0x1a6'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a7')});db[_0x4b23('0xa5')]['hasMany'](db['SalesforceField'],{'as':'Fields','onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a8')});db[_0x4b23('0xa5')][_0x4b23('0x10c')](db[_0x4b23('0xa3')],{'as':_0x4b23('0x162'),'foreignKey':'AccountId'});db['SalesforceField'][_0x4b23('0x101')](db[_0x4b23('0xa6')],{'as':_0x4b23('0x1a9'),'foreignKey':_0x4b23('0x1a5')});db[_0x4b23('0xa6')]['hasMany'](db['SalesforceField'],{'as':_0x4b23('0x1aa'),'foreignKey':_0x4b23('0x1a7')});db[_0x4b23('0xa6')][_0x4b23('0x101')](db['SalesforceField'],{'as':_0x4b23('0x1ab'),'foreignKey':_0x4b23('0x1a8')});db['SalesforceField'][_0x4b23('0x10c')](db[_0x4b23('0x91')],{'as':_0x4b23('0x91'),'foreignKey':_0x4b23('0x1ac')});db[_0x4b23('0x1ad')][_0x4b23('0x101')](db['SugarcrmConfiguration'],{'as':_0x4b23('0x1a2'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a3')});db[_0x4b23('0x1ae')]['hasMany'](db[_0x4b23('0xa9')],{'as':_0x4b23('0x1a4'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a5')});db[_0x4b23('0x1ae')]['hasMany'](db[_0x4b23('0xa9')],{'as':_0x4b23('0x1a6'),'onDelete':_0x4b23('0xfe'),'foreignKey':'DescriptionId'});db[_0x4b23('0x1ae')]['hasMany'](db[_0x4b23('0xa9')],{'as':'Fields','onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a8')});db['SugarcrmConfiguration'][_0x4b23('0x10c')](db['SugarcrmAccount'],{'as':_0x4b23('0x162'),'foreignKey':_0x4b23('0x1a3')});db[_0x4b23('0xa9')]['hasMany'](db[_0x4b23('0xa9')],{'as':'Subject','foreignKey':_0x4b23('0x1a5')});db['SugarcrmField']['hasMany'](db[_0x4b23('0xa9')],{'as':_0x4b23('0x1aa'),'foreignKey':'DescriptionId'});db[_0x4b23('0xa9')][_0x4b23('0x101')](db[_0x4b23('0xa9')],{'as':_0x4b23('0x1ab'),'foreignKey':_0x4b23('0x1a8')});db['SugarcrmField'][_0x4b23('0x10c')](db['Variable'],{'as':_0x4b23('0x91'),'foreignKey':_0x4b23('0x1ac')});db[_0x4b23('0xaa')][_0x4b23('0x101')](db[_0x4b23('0x1af')],{'as':_0x4b23('0x1a2'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a3')});db['DeskConfiguration']['hasMany'](db[_0x4b23('0x1b0')],{'as':_0x4b23('0x1a4'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a5')});db[_0x4b23('0x1af')]['hasMany'](db[_0x4b23('0x1b0')],{'as':_0x4b23('0x1a6'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a7')});db['DeskConfiguration'][_0x4b23('0x101')](db['DeskField'],{'as':'Fields','onDelete':_0x4b23('0xfe'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0x4b23('0x10c')](db[_0x4b23('0xaa')],{'as':'Account','foreignKey':_0x4b23('0x1a3')});db['DeskConfiguration']['belongsToMany'](db[_0x4b23('0x8e')],{'through':_0x4b23('0x1b1')});db['DeskField'][_0x4b23('0x101')](db['DeskField'],{'as':_0x4b23('0x1a9'),'foreignKey':_0x4b23('0x1a5')});db[_0x4b23('0x1b0')][_0x4b23('0x101')](db['DeskField'],{'as':_0x4b23('0x1aa'),'foreignKey':_0x4b23('0x1a7')});db[_0x4b23('0x1b0')]['hasMany'](db['DeskField'],{'as':_0x4b23('0x1ab'),'foreignKey':'FieldId'});db[_0x4b23('0x1b0')][_0x4b23('0x10c')](db[_0x4b23('0x91')],{'as':_0x4b23('0x91'),'foreignKey':'VariableId'});db['ZohoAccount'][_0x4b23('0x101')](db[_0x4b23('0xb0')],{'as':_0x4b23('0x1a2'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a3')});db[_0x4b23('0xb0')]['hasMany'](db['ZohoField'],{'as':_0x4b23('0x1a4'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a5')});db[_0x4b23('0xb0')]['hasMany'](db['ZohoField'],{'as':_0x4b23('0x1a6'),'onDelete':_0x4b23('0xfe'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x4b23('0x101')](db['ZohoField'],{'as':_0x4b23('0x1a0'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a8')});db[_0x4b23('0xb0')][_0x4b23('0x10c')](db[_0x4b23('0xae')],{'as':_0x4b23('0x162'),'foreignKey':_0x4b23('0x1a3')});db[_0x4b23('0x1b2')][_0x4b23('0x101')](db['ZohoField'],{'as':_0x4b23('0x1a9'),'foreignKey':_0x4b23('0x1a5')});db[_0x4b23('0x1b2')][_0x4b23('0x101')](db['ZohoField'],{'as':'Description','foreignKey':_0x4b23('0x1a7')});db[_0x4b23('0x1b2')]['hasMany'](db['ZohoField'],{'as':'Field','foreignKey':_0x4b23('0x1a8')});db[_0x4b23('0x1b2')][_0x4b23('0x10c')](db[_0x4b23('0x91')],{'as':_0x4b23('0x91'),'foreignKey':_0x4b23('0x1ac')});db[_0x4b23('0xb3')][_0x4b23('0x101')](db['ZendeskConfiguration'],{'as':_0x4b23('0x1a2'),'onDelete':'cascade','foreignKey':'AccountId'});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x4b23('0x1a4'),'foreignKey':'SubjectId'});db[_0x4b23('0xb5')][_0x4b23('0x101')](db['ZendeskField'],{'as':_0x4b23('0x1a6'),'foreignKey':_0x4b23('0x1a7')});db[_0x4b23('0xb5')][_0x4b23('0x101')](db[_0x4b23('0xb6')],{'as':_0x4b23('0x1a0'),'foreignKey':_0x4b23('0x1a8')});db[_0x4b23('0xb5')][_0x4b23('0x10c')](db['ZendeskAccount'],{'as':_0x4b23('0x162'),'foreignKey':_0x4b23('0x1a3')});db[_0x4b23('0xb5')][_0x4b23('0x10d')](db[_0x4b23('0x8e')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x4b23('0x101')](db['ZendeskField'],{'as':_0x4b23('0x1a9'),'foreignKey':_0x4b23('0x1a5')});db[_0x4b23('0xb6')]['hasMany'](db[_0x4b23('0xb6')],{'as':_0x4b23('0x1aa'),'foreignKey':_0x4b23('0x1a7')});db[_0x4b23('0xb6')][_0x4b23('0x101')](db[_0x4b23('0xb6')],{'as':_0x4b23('0x1ab'),'foreignKey':_0x4b23('0x1a8')});db[_0x4b23('0xb6')][_0x4b23('0x10c')](db[_0x4b23('0x91')],{'as':'Variable','foreignKey':_0x4b23('0x1ac')});db[_0x4b23('0x1b3')]['hasMany'](db[_0x4b23('0x1b4')],{'as':_0x4b23('0x1a2'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a3')});db[_0x4b23('0x1b4')][_0x4b23('0x101')](db['FreshdeskField'],{'as':'Subjects','onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a5')});db[_0x4b23('0x1b4')][_0x4b23('0x101')](db[_0x4b23('0xb8')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x4b23('0x1b4')][_0x4b23('0x101')](db[_0x4b23('0xb8')],{'as':_0x4b23('0x1a0'),'onDelete':_0x4b23('0xfe'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0x4b23('0x10c')](db[_0x4b23('0x1b3')],{'as':_0x4b23('0x162'),'foreignKey':_0x4b23('0x1a3')});db['FreshdeskConfiguration'][_0x4b23('0x10d')](db[_0x4b23('0x8e')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x4b23('0xb8')][_0x4b23('0x101')](db[_0x4b23('0xb8')],{'as':_0x4b23('0x1a9'),'foreignKey':_0x4b23('0x1a5')});db['FreshdeskField'][_0x4b23('0x101')](db[_0x4b23('0xb8')],{'as':_0x4b23('0x1aa'),'foreignKey':_0x4b23('0x1a7')});db[_0x4b23('0xb8')][_0x4b23('0x101')](db[_0x4b23('0xb8')],{'as':_0x4b23('0x1ab'),'foreignKey':_0x4b23('0x1a8')});db[_0x4b23('0xb8')]['belongsTo'](db[_0x4b23('0x91')],{'as':_0x4b23('0x91'),'foreignKey':_0x4b23('0x1ac')});db[_0x4b23('0x1b5')][_0x4b23('0x101')](db[_0x4b23('0xbb')],{'as':_0x4b23('0x1a2'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a3')});db['VtigerConfiguration'][_0x4b23('0x101')](db[_0x4b23('0xbc')],{'as':'Subjects','foreignKey':_0x4b23('0x1a5')});db[_0x4b23('0xbb')][_0x4b23('0x101')](db[_0x4b23('0xbc')],{'as':_0x4b23('0x1a6'),'foreignKey':'DescriptionId'});db[_0x4b23('0xbb')][_0x4b23('0x101')](db['VtigerField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x4b23('0xbb')]['belongsTo'](db[_0x4b23('0x1b5')],{'as':_0x4b23('0x162'),'foreignKey':_0x4b23('0x1a3')});db[_0x4b23('0xbc')][_0x4b23('0x101')](db[_0x4b23('0xbc')],{'as':'Subject','foreignKey':_0x4b23('0x1a5')});db[_0x4b23('0xbc')][_0x4b23('0x101')](db['VtigerField'],{'as':_0x4b23('0x1aa'),'foreignKey':_0x4b23('0x1a7')});db[_0x4b23('0xbc')][_0x4b23('0x101')](db['VtigerField'],{'as':_0x4b23('0x1ab'),'foreignKey':_0x4b23('0x1a8')});db[_0x4b23('0xbc')]['belongsTo'](db[_0x4b23('0x91')],{'as':'Variable','foreignKey':_0x4b23('0x1ac')});db['ServicenowAccount'][_0x4b23('0x101')](db['ServicenowConfiguration'],{'as':_0x4b23('0x1a2'),'onDelete':_0x4b23('0xfe'),'foreignKey':'AccountId'});db[_0x4b23('0x1b6')][_0x4b23('0x101')](db[_0x4b23('0xc1')],{'as':_0x4b23('0x1a4'),'foreignKey':_0x4b23('0x1a5')});db['ServicenowConfiguration'][_0x4b23('0x101')](db[_0x4b23('0xc1')],{'as':'Descriptions','foreignKey':_0x4b23('0x1a7')});db['ServicenowConfiguration'][_0x4b23('0x101')](db[_0x4b23('0xc1')],{'as':'Fields','foreignKey':_0x4b23('0x1a8')});db['ServicenowConfiguration']['belongsTo'](db[_0x4b23('0xbe')],{'as':_0x4b23('0x162'),'foreignKey':'AccountId'});db[_0x4b23('0xc1')]['hasMany'](db['ServicenowField'],{'as':'Subject','foreignKey':'SubjectId'});db['ServicenowField'][_0x4b23('0x101')](db[_0x4b23('0xc1')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x4b23('0xc1')][_0x4b23('0x101')](db[_0x4b23('0xc1')],{'as':_0x4b23('0x1ab'),'foreignKey':_0x4b23('0x1a8')});db['ServicenowField'][_0x4b23('0x10c')](db['Variable'],{'as':_0x4b23('0x91'),'foreignKey':_0x4b23('0x1ac')});db[_0x4b23('0x1b7')][_0x4b23('0x101')](db[_0x4b23('0xc4')],{'as':_0x4b23('0x1a2'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a3')});db['Dynamics365Configuration'][_0x4b23('0x101')](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a5')});db[_0x4b23('0xc4')]['hasMany'](db['Dynamics365Field'],{'as':_0x4b23('0x1a6'),'onDelete':_0x4b23('0xfe'),'foreignKey':'DescriptionId'});db[_0x4b23('0xc4')][_0x4b23('0x101')](db[_0x4b23('0xc5')],{'as':_0x4b23('0x1a0'),'onDelete':'cascade','foreignKey':'FieldId'});db['Dynamics365Configuration']['belongsTo'](db[_0x4b23('0x1b7')],{'as':_0x4b23('0x162'),'foreignKey':_0x4b23('0x1a3')});db[_0x4b23('0xc5')][_0x4b23('0x101')](db[_0x4b23('0xc5')],{'as':_0x4b23('0x1a9'),'foreignKey':_0x4b23('0x1a5')});db[_0x4b23('0xc5')]['hasMany'](db[_0x4b23('0xc5')],{'as':_0x4b23('0x1aa'),'foreignKey':_0x4b23('0x1a7')});db[_0x4b23('0xc5')][_0x4b23('0x101')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0x4b23('0x1a8')});db[_0x4b23('0xc5')]['belongsTo'](db[_0x4b23('0x91')],{'as':_0x4b23('0x91'),'foreignKey':_0x4b23('0x1ac')});db['FreshsalesAccount']['hasMany'](db[_0x4b23('0xc8')],{'as':'Configurations','onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1a3')});db[_0x4b23('0xc8')]['hasMany'](db[_0x4b23('0xca')],{'as':_0x4b23('0x1a4'),'foreignKey':'SubjectId'});db[_0x4b23('0xc8')][_0x4b23('0x101')](db[_0x4b23('0xca')],{'as':_0x4b23('0x1a6'),'foreignKey':_0x4b23('0x1a7')});db[_0x4b23('0xc8')][_0x4b23('0x101')](db[_0x4b23('0xca')],{'as':'Fields','foreignKey':'FieldId'});db['FreshsalesConfiguration']['belongsTo'](db[_0x4b23('0xc7')],{'as':_0x4b23('0x162'),'foreignKey':'AccountId'});db['FreshsalesField'][_0x4b23('0x101')](db[_0x4b23('0xca')],{'as':_0x4b23('0x1a9'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0x4b23('0x101')](db[_0x4b23('0xca')],{'as':_0x4b23('0x1aa'),'foreignKey':_0x4b23('0x1a7')});db['FreshsalesField'][_0x4b23('0x101')](db['FreshsalesField'],{'as':'Field','foreignKey':_0x4b23('0x1a8')});db[_0x4b23('0xca')]['belongsTo'](db[_0x4b23('0x91')],{'as':_0x4b23('0x91'),'foreignKey':'VariableId'});db[_0x4b23('0xcc')][_0x4b23('0x10c')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x4b23('0x10c')](db['CmList'],{'as':_0x4b23('0x14f'),'foreignKey':_0x4b23('0x15c')});db['ChatQueueReport'][_0x4b23('0x10c')](db['CmContact'],{'as':_0x4b23('0x146'),'foreignKey':_0x4b23('0x153')});db['ChatQueueReport'][_0x4b23('0x10c')](db['ChatInteraction'],{});db[_0x4b23('0xcc')][_0x4b23('0x10c')](db[_0x4b23('0x6d')],{});db[_0x4b23('0xcc')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{});db[_0x4b23('0xcc')][_0x4b23('0x10c')](db['ChatQueue'],{});db[_0x4b23('0xce')][_0x4b23('0x10c')](db['User'],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x4b23('0xce')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1b8')});db['JscriptySessionReport'][_0x4b23('0x101')](db[_0x4b23('0x1b9')],{'foreignKey':_0x4b23('0x1ba'),'onDelete':_0x4b23('0xfe')});db['JscriptySessionReport'][_0x4b23('0x101')](db[_0x4b23('0xcf')],{'foreignKey':'SessionId','onDelete':_0x4b23('0xfe')});db[_0x4b23('0x1bb')][_0x4b23('0x10c')](db[_0x4b23('0x56')],{});db[_0x4b23('0x1bb')][_0x4b23('0x10c')](db[_0x4b23('0xea')],{'as':'List','foreignKey':_0x4b23('0x15c')});db[_0x4b23('0x1bb')][_0x4b23('0x10c')](db[_0x4b23('0x110')],{'as':_0x4b23('0x146'),'foreignKey':_0x4b23('0x153')});db[_0x4b23('0x1bb')][_0x4b23('0x10c')](db[_0x4b23('0x5a')],{});db['SmsQueueReport']['belongsTo'](db[_0x4b23('0x5c')],{});db[_0x4b23('0x1bb')][_0x4b23('0x10c')](db['User'],{});db[_0x4b23('0x1bb')][_0x4b23('0x10c')](db[_0x4b23('0x5e')],{});db[_0x4b23('0xd4')][_0x4b23('0x101')](db[_0x4b23('0x137')],{'foreignKey':_0x4b23('0x1bc')});db[_0x4b23('0xd4')][_0x4b23('0x101')](db[_0x4b23('0x1b9')],{'foreignKey':_0x4b23('0x1bc')});db[_0x4b23('0xd4')][_0x4b23('0x101')](db[_0x4b23('0xcf')],{'foreignKey':'ProjectId'});db[_0x4b23('0xd6')][_0x4b23('0x10d')](db[_0x4b23('0x14')],{'as':_0x4b23('0x16b'),'through':_0x4b23('0x12e')});db['Team'][_0x4b23('0x10d')](db['User'],{'as':_0x4b23('0x13d'),'through':_0x4b23('0x114')});db[_0x4b23('0xdb')]['belongsToMany'](db[_0x4b23('0x1e')],{'through':_0x4b23('0x1bd'),'as':_0x4b23('0x11b')});db[_0x4b23('0xdb')][_0x4b23('0x10d')](db[_0x4b23('0x40')],{'through':_0x4b23('0x1be'),'as':_0x4b23('0x11d')});db[_0x4b23('0xdb')][_0x4b23('0x10d')](db[_0x4b23('0x70')],{'through':_0x4b23('0x17d'),'as':'ChatQueues'});db[_0x4b23('0xdb')][_0x4b23('0x10d')](db[_0x4b23('0x53')],{'through':_0x4b23('0x167'),'as':_0x4b23('0x11e')});db[_0x4b23('0xdb')]['belongsToMany'](db[_0x4b23('0x5e')],{'through':'team_has_sms_queues','as':_0x4b23('0x120')});db[_0x4b23('0xdb')]['belongsToMany'](db[_0x4b23('0x67')],{'through':_0x4b23('0x173'),'as':_0x4b23('0x121')});db['Team'][_0x4b23('0x10d')](db[_0x4b23('0xfa')],{'through':_0x4b23('0x1bf'),'as':_0x4b23('0x123')});db['Campaign'][_0x4b23('0x101')](db[_0x4b23('0x76')],{'as':_0x4b23('0x136'),'foreignKey':_0x4b23('0x186')});db[_0x4b23('0x185')][_0x4b23('0x101')](db['CmHopperFinal'],{'as':_0x4b23('0x103'),'foreignKey':'CampaignId'});db[_0x4b23('0x185')]['hasMany'](db[_0x4b23('0x7b')],{'as':_0x4b23('0x182'),'foreignKey':_0x4b23('0x186')});db[_0x4b23('0x185')][_0x4b23('0x101')](db[_0x4b23('0x78')],{'as':'HopperBlacks','foreignKey':_0x4b23('0x186')});db['Campaign'][_0x4b23('0x10c')](db[_0x4b23('0x2d')],{'as':_0x4b23('0x2d'),'foreignKey':_0x4b23('0x139')});db[_0x4b23('0x185')][_0x4b23('0x10c')](db[_0x4b23('0x2d')],{'as':_0x4b23('0x1c0'),'foreignKey':_0x4b23('0x13a')});db[_0x4b23('0x185')][_0x4b23('0x10c')](db[_0x4b23('0x88')],{'as':_0x4b23('0x88'),'foreignKey':_0x4b23('0x15a')});db[_0x4b23('0x185')][_0x4b23('0x10c')](db[_0x4b23('0xd6')],{'as':_0x4b23('0xd6'),'foreignKey':'SquareProjectId'});db[_0x4b23('0x185')]['belongsToMany'](db[_0x4b23('0xea')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0x4b23('0x185')][_0x4b23('0x10d')](db['CmList'],{'as':'BlackLists','through':_0x4b23('0x1c1')});db[_0x4b23('0x1c2')]['belongsTo'](db['MailMessage'],{});db['MailTransferReport'][_0x4b23('0x10c')](db[_0x4b23('0x43')],{});db[_0x4b23('0x1c2')][_0x4b23('0x10c')](db[_0x4b23('0x3e')],{'foreignKey':_0x4b23('0x1c3'),'as':_0x4b23('0x1c4')});db['MailTransferReport'][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'foreignKey':_0x4b23('0x1c5'),'as':_0x4b23('0x1c6')});db[_0x4b23('0x1c2')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x4b23('0x1c2')][_0x4b23('0x10c')](db['MailQueue'],{'foreignKey':_0x4b23('0x1c7'),'as':_0x4b23('0x1c8')});db[_0x4b23('0x1c2')][_0x4b23('0x10c')](db[_0x4b23('0x3e')],{'foreignKey':_0x4b23('0x1c9'),'as':'ToAccount'});db[_0x4b23('0xe3')]['belongsTo'](db[_0x4b23('0x6d')],{});db[_0x4b23('0xe3')][_0x4b23('0x10c')](db[_0x4b23('0x176')],{});db['ChatTransferReport'][_0x4b23('0x10c')](db['ChatWebsite'],{'foreignKey':_0x4b23('0x1ca'),'as':'FromAccount'});db[_0x4b23('0xe3')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'foreignKey':'FromUserId','as':_0x4b23('0x1c6')});db[_0x4b23('0xe3')][_0x4b23('0x10c')](db['User'],{'foreignKey':_0x4b23('0x1cb'),'as':'ToAgent'});db[_0x4b23('0xe3')][_0x4b23('0x10c')](db[_0x4b23('0x70')],{'foreignKey':'ToChatQueueId','as':_0x4b23('0x1c8')});db[_0x4b23('0xe3')][_0x4b23('0x10c')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db['FaxTransferReport'][_0x4b23('0x10c')](db[_0x4b23('0x51')],{});db[_0x4b23('0xe5')]['belongsTo'](db[_0x4b23('0x50')],{});db[_0x4b23('0xe5')][_0x4b23('0x10c')](db[_0x4b23('0x4d')],{'foreignKey':_0x4b23('0x1cc'),'as':_0x4b23('0x1c4')});db[_0x4b23('0xe5')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'foreignKey':'FromUserId','as':_0x4b23('0x1c6')});db[_0x4b23('0xe5')][_0x4b23('0x10c')](db['User'],{'foreignKey':_0x4b23('0x1cb'),'as':'ToAgent'});db['FaxTransferReport'][_0x4b23('0x10c')](db[_0x4b23('0x53')],{'foreignKey':_0x4b23('0x1cd'),'as':_0x4b23('0x1c8')});db[_0x4b23('0xe5')][_0x4b23('0x10c')](db[_0x4b23('0x4d')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0x4b23('0xe6')][_0x4b23('0x10c')](db[_0x4b23('0x65')],{});db[_0x4b23('0xe6')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x4b23('0xe6')]['belongsTo'](db[_0x4b23('0x5f')],{'foreignKey':'FromOpenchannelAccountId','as':_0x4b23('0x1c4')});db['OpenchannelTransferReport']['belongsTo'](db[_0x4b23('0x14')],{'foreignKey':_0x4b23('0x1c5'),'as':'FromAgent'});db[_0x4b23('0xe6')][_0x4b23('0x10c')](db['User'],{'foreignKey':_0x4b23('0x1cb'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0x4b23('0x10c')](db['OpenchannelQueue'],{'foreignKey':_0x4b23('0x1ce'),'as':_0x4b23('0x1c8')});db[_0x4b23('0xe6')][_0x4b23('0x10c')](db[_0x4b23('0x5f')],{'foreignKey':'ToOpenchannelAccountId','as':_0x4b23('0x1cf')});db[_0x4b23('0xe8')][_0x4b23('0x10c')](db[_0x4b23('0x5c')],{});db[_0x4b23('0xe8')]['belongsTo'](db[_0x4b23('0x5a')],{});db[_0x4b23('0xe8')][_0x4b23('0x10c')](db[_0x4b23('0x56')],{'foreignKey':_0x4b23('0x1d0'),'as':'FromAccount'});db['SmsTransferReport'][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'foreignKey':'FromUserId','as':_0x4b23('0x1c6')});db[_0x4b23('0xe8')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'foreignKey':_0x4b23('0x1cb'),'as':'ToAgent'});db[_0x4b23('0xe8')][_0x4b23('0x10c')](db[_0x4b23('0x5e')],{'foreignKey':_0x4b23('0x1d1'),'as':_0x4b23('0x1c8')});db['SmsTransferReport']['belongsTo'](db[_0x4b23('0x56')],{'foreignKey':_0x4b23('0x1d2'),'as':_0x4b23('0x1cf')});db[_0x4b23('0xea')][_0x4b23('0x101')](db[_0x4b23('0x85')],{'as':_0x4b23('0x14b'),'foreignKey':_0x4b23('0x15c')});db['CmList'][_0x4b23('0x101')](db[_0x4b23('0x7f')],{'as':_0x4b23('0x1d3'),'foreignKey':_0x4b23('0x15c')});db[_0x4b23('0xea')][_0x4b23('0x101')](db[_0x4b23('0x110')],{'as':_0x4b23('0x180'),'onDelete':'cascade','foreignKey':'ListId'});db['CmList'][_0x4b23('0x101')](db[_0x4b23('0x7a')],{'as':_0x4b23('0x103'),'foreignKey':'ListId'});db[_0x4b23('0xea')]['hasMany'](db[_0x4b23('0x7b')],{'as':_0x4b23('0x104'),'foreignKey':_0x4b23('0x15c')});db[_0x4b23('0xea')][_0x4b23('0x101')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x4b23('0x15c')});db[_0x4b23('0xea')][_0x4b23('0x10d')](db['VoiceQueue'],{'as':_0x4b23('0x1d4'),'through':_0x4b23('0x13c')});db[_0x4b23('0xea')]['belongsToMany'](db['User'],{'as':_0x4b23('0x13d'),'through':_0x4b23('0x113')});db[_0x4b23('0x124')][_0x4b23('0x101')](db[_0x4b23('0x1b')],{'as':_0x4b23('0x102'),'onDelete':_0x4b23('0xfe')});db[_0x4b23('0x124')][_0x4b23('0x10d')](db[_0x4b23('0x14')],{'as':_0x4b23('0x13d'),'through':_0x4b23('0x1d5')});db['UserProfile']['hasMany'](db['User'],{'as':'Users','foreignKey':_0x4b23('0x1d6')});db[_0x4b23('0xed')][_0x4b23('0x101')](db[_0x4b23('0x1d7')],{'as':_0x4b23('0x1d8'),'foreignKey':_0x4b23('0x1d6'),'onDelete':_0x4b23('0xfe')});db[_0x4b23('0x1d7')][_0x4b23('0x101')](db[_0x4b23('0xef')],{'as':_0x4b23('0x1d9'),'foreignKey':_0x4b23('0x1da'),'onDelete':_0x4b23('0xfe')});db[_0x4b23('0x1db')][_0x4b23('0x101')](db[_0x4b23('0x85')],{'as':_0x4b23('0x14b'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x4b23('0x101')](db['CannedAnswer'],{'as':_0x4b23('0x14c'),'foreignKey':_0x4b23('0x1dc')});db['WhatsappAccount'][_0x4b23('0x101')](db['WhatsappMessage'],{'as':_0x4b23('0x140'),'foreignKey':_0x4b23('0x1dc')});db[_0x4b23('0x1db')][_0x4b23('0x101')](db[_0x4b23('0xf3')],{'as':_0x4b23('0x14e')});db[_0x4b23('0x1db')]['hasMany'](db[_0x4b23('0xf2')],{'as':_0x4b23('0x131')});db['WhatsappAccount'][_0x4b23('0x10c')](db[_0x4b23('0xea')],{'as':_0x4b23('0x14f'),'foreignKey':_0x4b23('0x15c')});db[_0x4b23('0x1db')]['belongsTo'](db[_0x4b23('0x151')],{'as':_0x4b23('0x152'),'foreignKey':_0x4b23('0x13b')});db[_0x4b23('0x1db')][_0x4b23('0x10d')](db[_0x4b23('0x14')],{'as':_0x4b23('0x13d'),'through':'user_has_whatsapp_accounts'});db[_0x4b23('0xf2')][_0x4b23('0x10c')](db['User'],{'onDelete':'restrict'});db[_0x4b23('0xf2')][_0x4b23('0x10c')](db[_0x4b23('0xfa')],{'onDelete':_0x4b23('0x159')});db['WhatsappApplication'][_0x4b23('0x10c')](db[_0x4b23('0x1db')],{'onDelete':_0x4b23('0x159')});db['WhatsappApplication']['belongsTo'](db[_0x4b23('0x88')],{'onDelete':_0x4b23('0x159'),'foreignKey':_0x4b23('0x15a')});db['WhatsappApplication'][_0x4b23('0x10c')](db[_0x4b23('0x8e')],{'onDelete':_0x4b23('0x159'),'foreignKey':_0x4b23('0x15b')});db[_0x4b23('0xf3')]['hasMany'](db[_0x4b23('0xf5')],{'as':_0x4b23('0x140'),'onDelete':_0x4b23('0xfe'),'foreignKey':_0x4b23('0x1dd')});db[_0x4b23('0xf3')]['belongsTo'](db[_0x4b23('0x1db')],{'as':_0x4b23('0x162'),'foreignKey':_0x4b23('0x1dc')});db[_0x4b23('0xf3')][_0x4b23('0x10c')](db[_0x4b23('0x110')],{'as':_0x4b23('0x146'),'foreignKey':_0x4b23('0x153')});db[_0x4b23('0xf3')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'as':_0x4b23('0x154'),'foreignKey':_0x4b23('0x100')});db['WhatsappInteraction'][_0x4b23('0x10d')](db[_0x4b23('0x8e')],{'through':'whatsapp_interaction_has_tags','as':_0x4b23('0x163')});db[_0x4b23('0xf3')][_0x4b23('0x10d')](db[_0x4b23('0x8e')],{'through':_0x4b23('0x198'),'as':_0x4b23('0x156')});db[_0x4b23('0xf3')][_0x4b23('0x10d')](db[_0x4b23('0x14')],{'as':_0x4b23('0x16b'),'through':_0x4b23('0x11a'),'foreignKey':_0x4b23('0x1dd')});db[_0x4b23('0xf5')][_0x4b23('0x10c')](db['User'],{'as':_0x4b23('0x14')});db[_0x4b23('0xf5')][_0x4b23('0x10c')](db['CmContact'],{'onDelete':_0x4b23('0xfe'),'as':_0x4b23('0x146')});db[_0x4b23('0xf5')]['belongsTo'](db[_0x4b23('0xf3')],{'onDelete':_0x4b23('0xfe'),'as':_0x4b23('0x165'),'foreignKey':'WhatsappInteractionId'});db[_0x4b23('0xf5')][_0x4b23('0x10c')](db[_0x4b23('0x1db')],{'as':_0x4b23('0x162'),'foreignKey':_0x4b23('0x1dc')});db[_0x4b23('0xf7')][_0x4b23('0x10c')](db[_0x4b23('0x1db')],{});db[_0x4b23('0xf7')][_0x4b23('0x10c')](db[_0x4b23('0xea')],{'as':_0x4b23('0x14f'),'foreignKey':'ListId'});db['WhatsappQueueReport'][_0x4b23('0x10c')](db[_0x4b23('0x110')],{'as':_0x4b23('0x146'),'foreignKey':_0x4b23('0x153')});db[_0x4b23('0xf7')][_0x4b23('0x10c')](db[_0x4b23('0xf3')],{});db[_0x4b23('0xf7')]['belongsTo'](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0x4b23('0x10c')](db['WhatsappMessage'],{});db[_0x4b23('0xf7')]['belongsTo'](db[_0x4b23('0x14')],{});db[_0x4b23('0x1de')]['belongsTo'](db[_0x4b23('0xf5')],{});db['WhatsappTransferReport'][_0x4b23('0x10c')](db[_0x4b23('0xf3')],{});db['WhatsappTransferReport'][_0x4b23('0x10c')](db['WhatsappAccount'],{'foreignKey':_0x4b23('0x1df'),'as':_0x4b23('0x1c4')});db['WhatsappTransferReport'][_0x4b23('0x10c')](db[_0x4b23('0x1db')],{'foreignKey':_0x4b23('0x1e0'),'as':_0x4b23('0x1cf')});db[_0x4b23('0x1de')]['belongsTo'](db[_0x4b23('0xfa')],{'foreignKey':_0x4b23('0x1e1'),'as':'ToQueue'});db[_0x4b23('0x1de')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'foreignKey':'FromUserId','as':_0x4b23('0x1c6')});db[_0x4b23('0x1de')][_0x4b23('0x10c')](db[_0x4b23('0x14')],{'foreignKey':_0x4b23('0x1cb'),'as':_0x4b23('0x1e2')});db['WhatsappQueue']['belongsToMany'](db[_0x4b23('0x14')],{'as':_0x4b23('0x13d'),'through':_0x4b23('0x39'),'foreignKey':_0x4b23('0x1e3')});db[_0x4b23('0xfa')][_0x4b23('0x10d')](db['Team'],{'through':_0x4b23('0x1bf'),'as':_0x4b23('0x13e')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x7923=['Disposition','Dispositions','Answers','Interactions','Applications','List','ListId','Template','user_has_mail_accounts','team_has_mail_queues','Account','Owner','Tags','mail_interaction_has_tags','Users','MailInteractionId','Attachments','Interaction','restrict','DashboardItem','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','ThroughTags','user_has_fax_interactions','team_has_fax_queues','SmsAccountId','SmsApplication','TagId','SmsInteractionId','sms_interaction_has_tags','UserSmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','ChatWebsiteId','ChatMessage','Queue','ChatQueueId','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','AttachmentId','ChatOfflineMessage','team_has_chat_queues','CompanyId','Company','cm_user_has_contacts','cm_contact_has_tags','Agent','CampaignId','OwnerId','OneAll','AutomationAllId','AutomationAnyId','Actions','AutomationId','Intervals','ChatApplications','SmsApplications','DefaultReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','CustomReportId','MetricId','Configurations','Subjects','Descriptions','DescriptionId','FieldId','SubjectId','Description','VariableId','AccountId','Subject','Field','Variable','int_desk_configuration_has_tags','ZohoField','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ServicenowAccount','ToId','SessionId','ProjectId','JscriptyAnswerReport','FaxQueues','HopperBlacks','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','FromAccount','ToChatQueueId','ToQueue','ToChatWebsiteId','ToAccount','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','path','../config/environment','sequelize','lodash','jstz','determine','xC@LL1234','mysql','utf8mb4','name','sequelizeHistory','defaultsDeep','motion2','xcall','127.0.0.1','utf8_general_ci','database','password','options','username','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','../api/template/template.model','Trigger','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','../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','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','../api/notification/notification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','VoiceExtension','Extensions','HopperFinals','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_lists','MailInteractions','user_has_mail_interactions','user_has_sms_interactions','user_has_openchannel_interactions','MailQueue','UserMailQueue','ChatQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','UserWhatsappQueue','user_has_voice_prefixes','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Smtp'];(function(_0x3ddff2,_0x1a62ea){var _0x31bfd7=function(_0x362950){while(--_0x362950){_0x3ddff2['push'](_0x3ddff2['shift']());}};_0x31bfd7(++_0x1a62ea);}(_0x7923,0x8f));var _0x3792=function(_0x353afa,_0x4b9bd1){_0x353afa=_0x353afa-0x0;var _0x15cf5a=_0x7923[_0x353afa];return _0x15cf5a;};'use strict';var path=require(_0x3792('0x0'));var config=require(_0x3792('0x1'));var Sequelize=require(_0x3792('0x2'));var _=require(_0x3792('0x3'));var jstz=require(_0x3792('0x4'));var timezone=jstz[_0x3792('0x5')]();config[_0x3792('0x2')]=_['defaultsDeep'](config[_0x3792('0x2')],{'database':'motion2','username':'xcall','password':_0x3792('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x3792('0x7'),'dialectOptions':{'charset':_0x3792('0x8')},'logging':![],'timezone':timezone[_0x3792('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x3792('0xa')]=_[_0x3792('0xb')](config['sequelizeHistory'],{'database':_0x3792('0xc'),'username':_0x3792('0xd'),'password':'xC@LL1234','options':{'host':_0x3792('0xe'),'port':0xcea,'dialect':_0x3792('0x7'),'dialectOptions':{'charset':_0x3792('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x3792('0xf')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3792('0x2')][_0x3792('0x10')],config[_0x3792('0x2')]['username'],config['sequelize'][_0x3792('0x11')],config[_0x3792('0x2')][_0x3792('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3792('0xa')][_0x3792('0x10')],config[_0x3792('0xa')][_0x3792('0x13')],config[_0x3792('0xa')][_0x3792('0x11')],config[_0x3792('0xa')][_0x3792('0x12')])};db[_0x3792('0x14')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x16'));db[_0x3792('0x17')]=db[_0x3792('0x2')]['import'](_0x3792('0x18'));db[_0x3792('0x19')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x1a'));db['VoiceExtension']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x1b'));db[_0x3792('0x1c')]=db[_0x3792('0x2')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x3792('0x1d')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x1e'));db[_0x3792('0x1f')]=db[_0x3792('0x2')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x3792('0x20')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x21'));db['VoiceMail']=db[_0x3792('0x2')]['import'](_0x3792('0x22'));db[_0x3792('0x23')]=db['sequelize']['import'](_0x3792('0x24'));db[_0x3792('0x25')]=db[_0x3792('0x2')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x3792('0x26')]=db[_0x3792('0x2')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0x3792('0x27')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x28'));db['VoiceQueueReport']=db['sequelize'][_0x3792('0x15')](_0x3792('0x29'));db[_0x3792('0x2a')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x2b'));db[_0x3792('0x2c')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/trunk/trunk.model');db[_0x3792('0x2d')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x2e'));db[_0x3792('0x2f')]=db['sequelize']['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x3792('0x30')]=db['sequelize'][_0x3792('0x15')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x3792('0x31')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x32'));db['UserMailQueue']=db[_0x3792('0x2')]['import']('../api/userMailQueue/userMailQueue.model');db[_0x3792('0x33')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x34'));db['UserSmsQueue']=db['sequelize'][_0x3792('0x15')](_0x3792('0x35'));db[_0x3792('0x36')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x37'));db['UserWhatsappQueue']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x38'));db[_0x3792('0x39')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x3a'));db[_0x3792('0x3b')]=db['sequelize']['import']('../api/mailServerOut/mailServerOut.model');db[_0x3792('0x3c')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0x3792('0x2')][_0x3792('0x15')]('../api/mailQueue/mailQueue.model');db[_0x3792('0x3d')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/mailSubstatus/mailSubstatus.model');db[_0x3792('0x3e')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x3f'));db[_0x3792('0x40')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x41'));db[_0x3792('0x42')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/mailApplication/mailApplication.model');db[_0x3792('0x43')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x44'));db['Dashboard']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x45'));db['DashboardItem']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x46'));db[_0x3792('0x47')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x48'));db[_0x3792('0x49')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x4a'));db[_0x3792('0x4b')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x4c'));db[_0x3792('0x4d')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x4e'));db[_0x3792('0x4f')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/faxQueue/faxQueue.model');db[_0x3792('0x50')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x51'));db[_0x3792('0x52')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x53'));db['SmsApplication']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x54'));db[_0x3792('0x55')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x56'));db[_0x3792('0x57')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x58'));db[_0x3792('0x59')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x5a'));db[_0x3792('0x5b')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x5c'));db[_0x3792('0x5d')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x5e'));db[_0x3792('0x5f')]=db[_0x3792('0x2')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x60'));db['OpenchannelQueue']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x61'));db[_0x3792('0x62')]=db[_0x3792('0x2')]['import'](_0x3792('0x63'));db[_0x3792('0x64')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x3792('0x65')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x66'));db['ChatInteraction']=db['sequelize']['import'](_0x3792('0x67'));db['ChatMessage']=db[_0x3792('0x2')]['import']('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db['sequelize'][_0x3792('0x15')](_0x3792('0x68'));db[_0x3792('0x69')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x6a'));db['ChatGroup']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x6b'));db[_0x3792('0x6c')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x6d'));db[_0x3792('0x6e')]=db['sequelize'][_0x3792('0x15')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x6f'));db[_0x3792('0x70')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x71'));db[_0x3792('0x72')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x73'));db[_0x3792('0x74')]=db[_0x3792('0x2')]['import'](_0x3792('0x75'));db[_0x3792('0x76')]=db[_0x3792('0x2')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0x3792('0x77')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x3792('0x78')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x79'));db[_0x3792('0x7a')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x7b'));db[_0x3792('0x7c')]=db[_0x3792('0x2')]['import'](_0x3792('0x7d'));db[_0x3792('0x7e')]=db[_0x3792('0x2')]['import']('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x7f'));db[_0x3792('0x80')]=db['sequelize']['import'](_0x3792('0x81'));db['Interval']=db['sequelize'][_0x3792('0x15')](_0x3792('0x82'));db[_0x3792('0x83')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x84'));db[_0x3792('0x85')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x86'));db['VoiceQueuesLog']=db['sequelize'][_0x3792('0x15')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x3792('0x87')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x88'));db[_0x3792('0x89')]=db[_0x3792('0x2')]['import']('../api/sound/sound.model');db[_0x3792('0x8a')]=db[_0x3792('0x2')]['import'](_0x3792('0x8b'));db['Template']=db['sequelize']['import'](_0x3792('0x8c'));db[_0x3792('0x8d')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/trigger/trigger.model');db['Variable']=db[_0x3792('0x2')]['import'](_0x3792('0x8e'));db[_0x3792('0x8f')]=db['sequelize']['import'](_0x3792('0x90'));db['IntegrationReport']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x91'));db[_0x3792('0x92')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x93'));db[_0x3792('0x94')]=db['sequelize'][_0x3792('0x15')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x3792('0x95')]=db[_0x3792('0x2')]['import'](_0x3792('0x96'));db[_0x3792('0x97')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x98'));db[_0x3792('0x99')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x9a'));db[_0x3792('0x9b')]=db[_0x3792('0x2')]['import'](_0x3792('0x9c'));db[_0x3792('0x9d')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x9e'));db[_0x3792('0x9f')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xa0'));db[_0x3792('0xa1')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xa2'));db[_0x3792('0xa3')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xa4'));db[_0x3792('0xa5')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xa6'));db[_0x3792('0xa7')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x3792('0xa8')]=db['sequelize'][_0x3792('0x15')]('../api/intDeskAccount/intDeskAccount.model');db[_0x3792('0xa9')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xaa'));db[_0x3792('0xab')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xac'));db[_0x3792('0xad')]=db[_0x3792('0x2')]['import'](_0x3792('0xae'));db[_0x3792('0xaf')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xb0'));db['ZohoField']=db[_0x3792('0x2')][_0x3792('0x15')]('../api/intZohoField/intZohoField.model');db[_0x3792('0xb1')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xb2'));db[_0x3792('0xb3')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x3792('0xb4')]=db['sequelize']['import']('../api/intZendeskField/intZendeskField.model');db[_0x3792('0xb5')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xb6'));db['FreshdeskConfiguration']=db[_0x3792('0x2')][_0x3792('0x15')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x3792('0xb7')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xb8'));db[_0x3792('0xb9')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xba'));db[_0x3792('0xbb')]=db[_0x3792('0x2')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x3792('0xbc')]=db[_0x3792('0x2')]['import'](_0x3792('0xbd'));db['ServicenowAccount']=db['sequelize'][_0x3792('0x15')](_0x3792('0xbe'));db[_0x3792('0xbf')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xc0'));db[_0x3792('0xc1')]=db['sequelize']['import'](_0x3792('0xc2'));db[_0x3792('0xc3')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x3792('0xc4')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xc5'));db[_0x3792('0xc6')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xc7'));db[_0x3792('0xc8')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xc9'));db[_0x3792('0xca')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x3792('0xcb')]=db[_0x3792('0x2')]['import'](_0x3792('0xcc'));db[_0x3792('0x8f')]=db[_0x3792('0x2')]['import'](_0x3792('0x90'));db[_0x3792('0xcd')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xce'));db[_0x3792('0xcf')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xd0'));db[_0x3792('0xd1')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xd2'));db['JscriptyAnswerReport']=db[_0x3792('0x2')][_0x3792('0x15')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x3792('0xd3')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xd4'));db[_0x3792('0xd5')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xd6'));db[_0x3792('0xd7')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xd8'));db['SquareReport']=db[_0x3792('0x2')][_0x3792('0x15')]('../api/squareReport/squareReport.model');db[_0x3792('0xd9')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xda'));db[_0x3792('0xdb')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xdc'));db[_0x3792('0xdd')]=db[_0x3792('0x2')]['import'](_0x3792('0xde'));db[_0x3792('0xdf')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xe0'));db[_0x3792('0xe1')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xe2'));db['SquareRecording']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xe3'));db[_0x3792('0xe4')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xe5'));db[_0x3792('0xe6')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xe7'));db['License']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xe8'));db[_0x3792('0xe9')]=db[_0x3792('0x2')]['import'](_0x3792('0xea'));db[_0x3792('0xeb')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xec'));db[_0x3792('0xed')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xee'));db[_0x3792('0xef')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xf0'));db['MailTransferReport']=db[_0x3792('0x2')]['import'](_0x3792('0xf1'));db['ChatTransferReport']=db[_0x3792('0x2')]['import'](_0x3792('0xf2'));db[_0x3792('0xf3')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xf4'));db[_0x3792('0xf5')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xf6'));db['SmsTransferReport']=db[_0x3792('0x2')][_0x3792('0x15')]('../api/smsTransferReport/smsTransferReport.model');db[_0x3792('0xf7')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xf8'));db[_0x3792('0xf9')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xfa'));db[_0x3792('0xfb')]=db[_0x3792('0x2')]['import'](_0x3792('0xfc'));db['UserProfileSection']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xfd'));db[_0x3792('0xfe')]=db['sequelize'][_0x3792('0x15')]('../api/userProfileResource/userProfileResource.model');db[_0x3792('0xff')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x100'));db[_0x3792('0x101')]=db[_0x3792('0x2')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x3792('0x102')]=db['sequelize']['import'](_0x3792('0x103'));db[_0x3792('0x104')]=db[_0x3792('0x2')]['import'](_0x3792('0x105'));db[_0x3792('0x106')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x107'));db[_0x3792('0x108')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x3792('0x109')]=db['sequelize']['import'](_0x3792('0x10a'));db[_0x3792('0x10b')]=db[_0x3792('0x2')]['import'](_0x3792('0x10c'));db[_0x3792('0x10d')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x10e'));db[_0x3792('0x14')][_0x3792('0x10f')](db[_0x3792('0x110')],{'as':'VoiceMail','onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x1f')],{'as':_0x3792('0x114'),'foreignKey':'UserId'});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x2f')],{'as':'VoiceQueuesRt','foreignKey':_0x3792('0x112')});db['User']['hasMany'](db[_0x3792('0x115')],{'as':_0x3792('0x116'),'onDelete':_0x3792('0x111'),'hooks':!![]});db['User'][_0x3792('0x113')](db[_0x3792('0x74')],{'as':_0x3792('0x117'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x76')],{'as':'HopperHistory','foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x77')],{'as':_0x3792('0x77'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db['OpenchannelInteraction'],{'as':_0x3792('0x118'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x119')],{'as':_0x3792('0x11a'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x55')],{'as':_0x3792('0x11b'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x4b')],{'as':_0x3792('0x11c'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x3e')],{'as':'MailInteractions','foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x104')],{'as':'WhatsappInteractions','foreignKey':_0x3792('0x112')});db['User'][_0x3792('0x113')](db[_0x3792('0xff')],{'as':'Notifications','foreignKey':_0x3792('0x11d')});db[_0x3792('0x14')][_0x3792('0x11e')](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x3792('0x11f')});db['User'][_0x3792('0x120')](db[_0x3792('0x121')],{'as':_0x3792('0x122'),'through':_0x3792('0x123')});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x124')],{'as':_0x3792('0x125'),'through':'cm_user_has_contacts'});db['User'][_0x3792('0x120')](db[_0x3792('0xf7')],{'as':'Lists','through':_0x3792('0x126')});db[_0x3792('0x14')]['belongsToMany'](db[_0x3792('0xe6')],{'through':'user_has_teams'});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x3e')],{'as':_0x3792('0x127'),'through':_0x3792('0x128')});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x119')],{'as':_0x3792('0x11a'),'through':'user_has_chat_interactions'});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x4b')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db['User'][_0x3792('0x120')](db[_0x3792('0x55')],{'as':_0x3792('0x11b'),'through':_0x3792('0x129')});db[_0x3792('0x14')][_0x3792('0x120')](db['OpenchannelInteraction'],{'as':_0x3792('0x118'),'through':_0x3792('0x12a')});db['User'][_0x3792('0x120')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x1d')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db['User'][_0x3792('0x120')](db[_0x3792('0x12b')],{'as':'MailQueues','through':_0x3792('0x12c'),'required':![]});db[_0x3792('0x14')]['belongsToMany'](db[_0x3792('0x69')],{'as':_0x3792('0x12d'),'through':_0x3792('0x31'),'required':![],'hooks':!![]});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x4f')],{'as':'FaxQueues','through':_0x3792('0x33'),'required':![]});db[_0x3792('0x14')]['belongsToMany'](db['SmsQueue'],{'as':_0x3792('0x12e'),'through':'UserSmsQueue','required':![]});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x12f')],{'as':_0x3792('0x130'),'through':_0x3792('0x36'),'required':![]});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x10b')],{'as':'WhatsappQueues','through':_0x3792('0x131'),'required':![]});db[_0x3792('0x14')][_0x3792('0x120')](db['CmList'],{'through':_0x3792('0x126')});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0xf9')],{'as':'VoicePrefixes','through':_0x3792('0x132'),'required':![]});db['User'][_0x3792('0x120')](db[_0x3792('0x62')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db['User'][_0x3792('0x120')](db[_0x3792('0x47')],{'as':_0x3792('0x133'),'through':_0x3792('0x134')});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x3c')],{'as':_0x3792('0x135'),'through':'user_has_mail_accounts'});db[_0x3792('0x14')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x3792('0x136'),'through':_0x3792('0x137')});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x52')],{'as':_0x3792('0x138'),'through':_0x3792('0x139')});db['User'][_0x3792('0x120')](db[_0x3792('0x101')],{'as':_0x3792('0x13a'),'through':_0x3792('0x13b')});db[_0x3792('0x14')][_0x3792('0x120')](db['SquareProject'],{'as':_0x3792('0x13c'),'through':_0x3792('0x13d')});db[_0x3792('0x17')][_0x3792('0x113')](db[_0x3792('0x115')],{'as':_0x3792('0x13e'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x13f')});db[_0x3792('0x19')][_0x3792('0x113')](db['VoiceExtension'],{'onDelete':_0x3792('0x111')});db[_0x3792('0x115')]['hasMany'](db[_0x3792('0x115')],{'as':'Applications','onDelete':_0x3792('0x111')});db['VoiceMusicOnHold'][_0x3792('0x120')](db[_0x3792('0x89')],{'as':_0x3792('0x140'),'through':_0x3792('0x141')});db[_0x3792('0x1d')][_0x3792('0x113')](db[_0x3792('0x2f')],{'as':_0x3792('0x142'),'foreignKey':_0x3792('0x143')});db[_0x3792('0x1d')][_0x3792('0x113')](db[_0x3792('0x70')],{'as':_0x3792('0x144'),'foreignKey':_0x3792('0x143')});db[_0x3792('0x1d')]['hasMany'](db[_0x3792('0x74')],{'as':'HopperFinals','foreignKey':_0x3792('0x143')});db['VoiceQueue'][_0x3792('0x113')](db[_0x3792('0x76')],{'as':_0x3792('0x145'),'foreignKey':'VoiceQueueId'});db[_0x3792('0x1d')][_0x3792('0x113')](db['ReportAgentPreview'],{'as':_0x3792('0x77'),'foreignKey':_0x3792('0x143')});db[_0x3792('0x1d')]['hasMany'](db[_0x3792('0x72')],{'as':'HopperBlacks','foreignKey':_0x3792('0x143')});db['VoiceQueue'][_0x3792('0x113')](db['JscriptySessionReport'],{'as':_0x3792('0x146'),'foreignKey':_0x3792('0x143')});db['VoiceQueue'][_0x3792('0x11e')](db[_0x3792('0x2c')],{'as':_0x3792('0x2c'),'foreignKey':_0x3792('0x147')});db[_0x3792('0x1d')][_0x3792('0x11e')](db['Trunk'],{'as':_0x3792('0x148'),'foreignKey':_0x3792('0x149')});db[_0x3792('0x1d')][_0x3792('0x11e')](db[_0x3792('0x14a')],{'as':_0x3792('0x14a'),'foreignKey':_0x3792('0x14b')});db['VoiceQueue'][_0x3792('0x11e')](db[_0x3792('0x83')],{'as':_0x3792('0x14c'),'foreignKey':_0x3792('0x14d')});db[_0x3792('0x1d')][_0x3792('0x120')](db[_0x3792('0xf7')],{'as':_0x3792('0x14e'),'through':_0x3792('0x14f')});db[_0x3792('0x1d')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':_0x3792('0x30')});db[_0x3792('0x1d')][_0x3792('0x120')](db[_0x3792('0xe6')],{'as':_0x3792('0x151'),'through':_0x3792('0x152')});db[_0x3792('0x1d')]['belongsToMany'](db[_0x3792('0xf7')],{'as':_0x3792('0x153'),'through':_0x3792('0x154')});db[_0x3792('0x1f')]['belongsTo'](db[_0x3792('0x14')],{'as':_0x3792('0x14'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x20')][_0x3792('0x11e')](db['User'],{'as':'User','foreignKey':_0x3792('0x112')});db['VoiceMail']['hasMany'](db[_0x3792('0x23')],{'as':_0x3792('0x155'),'onDelete':_0x3792('0x111'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x3792('0x23')]['belongsTo'](db['VoiceMail'],{'foreignKey':_0x3792('0x156'),'targetKey':_0x3792('0x157')});db[_0x3792('0x25')]['hasMany'](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0x3792('0x158'),'constraints':![]});db[_0x3792('0x25')]['hasMany'](db[_0x3792('0x27')],{'as':_0x3792('0x159'),'foreignKey':_0x3792('0x158'),'constraints':![]});db[_0x3792('0x25')]['belongsTo'](db[_0x3792('0x14')],{'as':_0x3792('0x14'),'foreignKey':'UserId'});db[_0x3792('0x25')][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x39')][_0x3792('0x11e')](db[_0x3792('0x3c')],{'as':_0x3792('0x3c'),'foreignKey':_0x3792('0x15c')});db['MailServerOut'][_0x3792('0x11e')](db[_0x3792('0x3c')],{'as':_0x3792('0x3c'),'foreignKey':'MailAccountId'});db[_0x3792('0x3c')]['hasOne'](db[_0x3792('0x39')],{'as':'Imap','onDelete':_0x3792('0x111')});db['MailAccount'][_0x3792('0x10f')](db[_0x3792('0x3b')],{'as':_0x3792('0x15d'),'onDelete':'cascade'});db[_0x3792('0x3c')][_0x3792('0x113')](db[_0x3792('0x15e')],{'as':_0x3792('0x15f'),'foreignKey':_0x3792('0x15c')});db[_0x3792('0x3c')][_0x3792('0x113')](db[_0x3792('0x7e')],{'as':_0x3792('0x160'),'foreignKey':_0x3792('0x15c')});db[_0x3792('0x3c')][_0x3792('0x113')](db[_0x3792('0x40')],{'as':_0x3792('0x155'),'foreignKey':'MailAccountId'});db[_0x3792('0x3c')][_0x3792('0x113')](db['MailInteraction'],{'as':_0x3792('0x161')});db[_0x3792('0x3c')][_0x3792('0x113')](db['MailApplication'],{'as':_0x3792('0x162')});db['MailAccount'][_0x3792('0x11e')](db['CmList'],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164')});db[_0x3792('0x3c')][_0x3792('0x11e')](db['Template'],{'as':_0x3792('0x165'),'foreignKey':'TemplateId'});db[_0x3792('0x3c')][_0x3792('0x11e')](db['Pause'],{'as':_0x3792('0x14c'),'foreignKey':_0x3792('0x14d')});db[_0x3792('0x3c')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':_0x3792('0x166')});db[_0x3792('0x12b')][_0x3792('0x120')](db['User'],{'as':_0x3792('0x150'),'through':_0x3792('0x12c')});db[_0x3792('0x12b')][_0x3792('0x120')](db[_0x3792('0xe6')],{'through':_0x3792('0x167'),'as':'Teams'});db[_0x3792('0x3e')][_0x3792('0x113')](db[_0x3792('0x40')],{'as':'Messages','onDelete':_0x3792('0x111'),'foreignKey':'MailInteractionId'});db[_0x3792('0x3e')]['belongsTo'](db['MailAccount'],{'as':_0x3792('0x168'),'foreignKey':'MailAccountId'});db['MailInteraction']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x3792('0x15b')});db[_0x3792('0x3e')][_0x3792('0x11e')](db[_0x3792('0x14')],{'as':_0x3792('0x169'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x3e')][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':'mail_interaction_has_tags','as':_0x3792('0x16a')});db[_0x3792('0x3e')][_0x3792('0x120')](db['Tag'],{'through':_0x3792('0x16b'),'as':'ThroughTags'});db[_0x3792('0x3e')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x16c'),'through':_0x3792('0x128'),'foreignKey':_0x3792('0x16d')});db[_0x3792('0x40')]['hasMany'](db[_0x3792('0xed')],{'as':_0x3792('0x16e'),'onDelete':_0x3792('0x111')});db[_0x3792('0x40')][_0x3792('0x11e')](db[_0x3792('0x14')],{'as':_0x3792('0x14')});db[_0x3792('0x40')][_0x3792('0x11e')](db[_0x3792('0x124')],{'onDelete':_0x3792('0x111'),'as':'Contact'});db['MailMessage'][_0x3792('0x11e')](db[_0x3792('0x3e')],{'as':_0x3792('0x16f'),'foreignKey':_0x3792('0x16d')});db['MailMessage'][_0x3792('0x11e')](db[_0x3792('0x3c')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x15c')});db['MailApplication'][_0x3792('0x11e')](db[_0x3792('0x14')],{'onDelete':_0x3792('0x170')});db[_0x3792('0x42')][_0x3792('0x11e')](db['MailQueue'],{'onDelete':_0x3792('0x170')});db[_0x3792('0x42')][_0x3792('0x11e')](db[_0x3792('0x3c')],{'onDelete':'restrict'});db[_0x3792('0x42')]['belongsTo'](db['Interval'],{'onDelete':_0x3792('0x170'),'foreignKey':_0x3792('0x14b')});db[_0x3792('0x42')][_0x3792('0x11e')](db[_0x3792('0x8a')],{'onDelete':_0x3792('0x170'),'foreignKey':'TagId'});db[_0x3792('0x43')]['belongsTo'](db[_0x3792('0x3c')],{});db[_0x3792('0x43')][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':_0x3792('0x163'),'foreignKey':'ListId'});db[_0x3792('0x43')][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x43')][_0x3792('0x11e')](db['MailInteraction'],{});db['MailQueueReport']['belongsTo'](db[_0x3792('0x40')],{});db[_0x3792('0x43')][_0x3792('0x11e')](db['User'],{});db[_0x3792('0x43')][_0x3792('0x11e')](db['MailQueue'],{});db['Dashboard']['hasMany'](db[_0x3792('0x171')],{'as':'Items','onDelete':_0x3792('0x111')});db[_0x3792('0x47')][_0x3792('0x113')](db[_0x3792('0x15e')],{'as':_0x3792('0x15f'),'foreignKey':'FaxAccountId'});db[_0x3792('0x47')]['hasMany'](db[_0x3792('0x7e')],{'as':_0x3792('0x160'),'foreignKey':_0x3792('0x172')});db[_0x3792('0x47')]['hasMany'](db[_0x3792('0x4b')],{'as':_0x3792('0x161')});db[_0x3792('0x47')][_0x3792('0x113')](db[_0x3792('0x49')],{'as':_0x3792('0x162')});db[_0x3792('0x47')][_0x3792('0x113')](db[_0x3792('0x115')],{'as':_0x3792('0x173'),'onDelete':_0x3792('0x111')});db[_0x3792('0x47')][_0x3792('0x113')](db['FaxMessage'],{'as':'Messages'});db[_0x3792('0x47')]['belongsTo'](db[_0x3792('0x2c')],{'as':_0x3792('0x2c')});db[_0x3792('0x47')]['belongsTo'](db[_0x3792('0xf7')],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164')});db[_0x3792('0x47')][_0x3792('0x11e')](db['Pause'],{'as':_0x3792('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x3792('0x47')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':_0x3792('0x134')});db[_0x3792('0x49')][_0x3792('0x11e')](db[_0x3792('0x14')],{'onDelete':_0x3792('0x170')});db[_0x3792('0x49')]['belongsTo'](db[_0x3792('0x4f')],{'onDelete':'restrict'});db[_0x3792('0x49')][_0x3792('0x11e')](db[_0x3792('0x47')],{'onDelete':_0x3792('0x170')});db[_0x3792('0x49')][_0x3792('0x11e')](db[_0x3792('0x8a')],{'onDelete':_0x3792('0x170'),'foreignKey':'TagId'});db[_0x3792('0x4b')][_0x3792('0x113')](db[_0x3792('0x4d')],{'as':_0x3792('0x155'),'onDelete':'cascade','foreignKey':_0x3792('0x174')});db['FaxInteraction']['belongsTo'](db[_0x3792('0x47')],{'as':_0x3792('0x168'),'foreignKey':'FaxAccountId'});db['FaxInteraction'][_0x3792('0x11e')](db['CmContact'],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x4b')][_0x3792('0x11e')](db[_0x3792('0x14')],{'as':_0x3792('0x169'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x4b')][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':_0x3792('0x175'),'as':_0x3792('0x16a')});db['FaxInteraction'][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':'fax_interaction_has_tags','as':_0x3792('0x176')});db[_0x3792('0x4b')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x16c'),'through':_0x3792('0x177'),'foreignKey':_0x3792('0x174')});db[_0x3792('0x4d')][_0x3792('0x11e')](db[_0x3792('0x14')],{'onDelete':'cascade','as':_0x3792('0x14')});db[_0x3792('0x4d')][_0x3792('0x11e')](db[_0x3792('0x4b')],{'as':_0x3792('0x16f'),'foreignKey':_0x3792('0x174')});db[_0x3792('0x4d')][_0x3792('0x11e')](db[_0x3792('0x124')],{'onDelete':_0x3792('0x111'),'as':'Contact'});db[_0x3792('0x4d')][_0x3792('0x11e')](db[_0x3792('0xed')],{'as':_0x3792('0xed'),'foreignKey':'AttachmentId'});db['FaxMessage'][_0x3792('0x11e')](db[_0x3792('0x47')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x172')});db['FaxQueue']['belongsToMany'](db[_0x3792('0x14')],{'as':'Agents','through':'UserFaxQueue'});db['FaxQueue']['belongsToMany'](db[_0x3792('0xe6')],{'through':_0x3792('0x178'),'as':'Teams'});db[_0x3792('0x50')][_0x3792('0x11e')](db['FaxAccount'],{});db[_0x3792('0x50')][_0x3792('0x11e')](db['CmList'],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164')});db[_0x3792('0x50')]['belongsTo'](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x50')][_0x3792('0x11e')](db[_0x3792('0x4b')],{});db[_0x3792('0x50')][_0x3792('0x11e')](db['FaxMessage'],{});db['FaxQueueReport'][_0x3792('0x11e')](db[_0x3792('0x14')],{});db['FaxQueueReport'][_0x3792('0x11e')](db[_0x3792('0x4f')],{});db[_0x3792('0x52')][_0x3792('0x113')](db[_0x3792('0x15e')],{'as':_0x3792('0x15f'),'foreignKey':'SmsAccountId'});db[_0x3792('0x52')][_0x3792('0x113')](db[_0x3792('0x7e')],{'as':_0x3792('0x160'),'foreignKey':_0x3792('0x179')});db['SmsAccount'][_0x3792('0x113')](db[_0x3792('0x57')],{'as':_0x3792('0x155'),'foreignKey':_0x3792('0x179')});db['SmsAccount'][_0x3792('0x113')](db[_0x3792('0x55')],{'as':_0x3792('0x161')});db['SmsAccount'][_0x3792('0x113')](db[_0x3792('0x17a')],{'as':_0x3792('0x162')});db[_0x3792('0x52')]['belongsTo'](db[_0x3792('0xf7')],{'as':'List','foreignKey':_0x3792('0x164')});db[_0x3792('0x52')]['belongsTo'](db[_0x3792('0x83')],{'as':_0x3792('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x3792('0x52')]['belongsToMany'](db[_0x3792('0x14')],{'as':'Agents','through':_0x3792('0x139')});db[_0x3792('0x17a')][_0x3792('0x11e')](db['User'],{'onDelete':'restrict'});db[_0x3792('0x17a')][_0x3792('0x11e')](db[_0x3792('0x59')],{'onDelete':_0x3792('0x170')});db[_0x3792('0x17a')][_0x3792('0x11e')](db['SmsAccount'],{'onDelete':_0x3792('0x170')});db[_0x3792('0x17a')]['belongsTo'](db[_0x3792('0x14a')],{'onDelete':_0x3792('0x170'),'foreignKey':_0x3792('0x14b')});db[_0x3792('0x17a')][_0x3792('0x11e')](db[_0x3792('0x8a')],{'onDelete':_0x3792('0x170'),'foreignKey':_0x3792('0x17b')});db[_0x3792('0x55')]['hasMany'](db['SmsMessage'],{'as':_0x3792('0x155'),'onDelete':'cascade','foreignKey':_0x3792('0x17c')});db[_0x3792('0x55')][_0x3792('0x11e')](db[_0x3792('0x52')],{'as':'Account','foreignKey':_0x3792('0x179')});db[_0x3792('0x55')][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x55')][_0x3792('0x11e')](db[_0x3792('0x14')],{'as':_0x3792('0x169'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x55')][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':'sms_interaction_has_tags','as':_0x3792('0x16a')});db[_0x3792('0x55')][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':_0x3792('0x17d'),'as':_0x3792('0x176')});db[_0x3792('0x55')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x16c'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x3792('0x11e')](db[_0x3792('0x14')],{'as':_0x3792('0x14')});db[_0x3792('0x57')][_0x3792('0x11e')](db['CmContact'],{'onDelete':_0x3792('0x111'),'as':_0x3792('0x15a')});db[_0x3792('0x57')][_0x3792('0x11e')](db['SmsInteraction'],{'onDelete':_0x3792('0x111'),'as':_0x3792('0x16f'),'foreignKey':_0x3792('0x17c')});db['SmsMessage'][_0x3792('0x11e')](db[_0x3792('0x52')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x179')});db['SmsQueue']['belongsToMany'](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':_0x3792('0x17e'),'foreignKey':_0x3792('0x17f')});db[_0x3792('0x59')]['belongsToMany'](db[_0x3792('0xe6')],{'through':_0x3792('0x180'),'as':'Teams'});db[_0x3792('0x5b')][_0x3792('0x113')](db[_0x3792('0x15e')],{'as':'Dispositions','foreignKey':_0x3792('0x181')});db[_0x3792('0x5b')][_0x3792('0x113')](db[_0x3792('0x7e')],{'as':_0x3792('0x160'),'foreignKey':_0x3792('0x181')});db[_0x3792('0x5b')][_0x3792('0x113')](db[_0x3792('0x5f')],{'as':_0x3792('0x161'),'foreignKey':_0x3792('0x181')});db['OpenchannelAccount'][_0x3792('0x113')](db[_0x3792('0x182')],{'as':'Messages','foreignKey':_0x3792('0x181')});db[_0x3792('0x5b')][_0x3792('0x113')](db['OpenchannelApplication'],{'as':_0x3792('0x162'),'foreignKey':'OpenchannelAccountId'});db[_0x3792('0x5b')][_0x3792('0x11e')](db['CmList'],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164')});db[_0x3792('0x5b')][_0x3792('0x11e')](db['Pause'],{'as':_0x3792('0x14c'),'foreignKey':_0x3792('0x14d')});db[_0x3792('0x5b')][_0x3792('0x120')](db['User'],{'as':_0x3792('0x150'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x3792('0x11e')](db['User'],{'onDelete':_0x3792('0x170')});db[_0x3792('0x5d')][_0x3792('0x11e')](db[_0x3792('0x12f')],{'onDelete':_0x3792('0x170'),'foreignKey':'OpenchannelQueueId'});db[_0x3792('0x5d')][_0x3792('0x11e')](db[_0x3792('0x5b')],{'onDelete':_0x3792('0x170'),'foreignKey':_0x3792('0x181')});db[_0x3792('0x5d')][_0x3792('0x11e')](db[_0x3792('0x14a')],{'onDelete':_0x3792('0x170'),'foreignKey':'IntervalId'});db[_0x3792('0x5d')][_0x3792('0x11e')](db[_0x3792('0x8a')],{'onDelete':'restrict','foreignKey':_0x3792('0x17b')});db[_0x3792('0x5f')][_0x3792('0x113')](db[_0x3792('0x182')],{'as':_0x3792('0x155'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x183')});db[_0x3792('0x5f')]['belongsTo'](db[_0x3792('0x5b')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x181')});db['OpenchannelInteraction'][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db['OpenchannelInteraction'][_0x3792('0x11e')](db['User'],{'as':_0x3792('0x169'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x5f')][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':_0x3792('0x184'),'as':'Tags'});db['OpenchannelInteraction'][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':_0x3792('0x184'),'as':_0x3792('0x176')});db[_0x3792('0x5f')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x16c'),'through':_0x3792('0x12a'),'foreignKey':_0x3792('0x183')});db[_0x3792('0x182')][_0x3792('0x11e')](db[_0x3792('0x14')],{'onDelete':_0x3792('0x111'),'as':_0x3792('0x14')});db[_0x3792('0x182')][_0x3792('0x11e')](db['CmContact'],{'onDelete':_0x3792('0x111'),'as':_0x3792('0x15a')});db['OpenchannelMessage']['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0x3792('0x111'),'as':_0x3792('0x16f'),'foreignKey':'OpenchannelInteractionId'});db[_0x3792('0x182')]['belongsTo'](db[_0x3792('0xed')],{'as':_0x3792('0xed'),'foreignKey':'AttachmentId'});db[_0x3792('0x182')][_0x3792('0x11e')](db['OpenchannelAccount'],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x181')});db['OpenchannelQueue'][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':'UserOpenchannelQueue','foreignKey':_0x3792('0x185')});db[_0x3792('0x12f')][_0x3792('0x120')](db[_0x3792('0xe6')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0x3792('0x62')]['hasMany'](db[_0x3792('0x15e')],{'as':_0x3792('0x15f'),'foreignKey':_0x3792('0x186')});db['ChatWebsite'][_0x3792('0x113')](db[_0x3792('0x7e')],{'as':_0x3792('0x160'),'foreignKey':_0x3792('0x186')});db[_0x3792('0x62')][_0x3792('0x113')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0x3792('0x62')][_0x3792('0x113')](db['ChatInteraction'],{'as':_0x3792('0x161')});db[_0x3792('0x62')]['hasMany'](db[_0x3792('0x65')],{'as':_0x3792('0x162')});db['ChatWebsite'][_0x3792('0x113')](db[_0x3792('0x187')],{'as':_0x3792('0x155')});db[_0x3792('0x62')][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164')});db[_0x3792('0x62')][_0x3792('0x11e')](db['Interval'],{'as':_0x3792('0x14a'),'foreignKey':'IntervalId'});db['ChatWebsite'][_0x3792('0x11e')](db[_0x3792('0x83')],{'as':_0x3792('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x3792('0x62')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':'user_has_chat_websites'});db[_0x3792('0x64')]['belongsTo'](db[_0x3792('0x5b')],{});db[_0x3792('0x64')][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164')});db[_0x3792('0x64')][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':'ContactId'});db[_0x3792('0x64')][_0x3792('0x11e')](db[_0x3792('0x5f')],{});db[_0x3792('0x64')][_0x3792('0x11e')](db[_0x3792('0x182')],{});db[_0x3792('0x64')]['belongsTo'](db['User'],{});db[_0x3792('0x64')][_0x3792('0x11e')](db['OpenchannelQueue'],{});db[_0x3792('0x65')][_0x3792('0x11e')](db['User'],{'as':'Agent','foreignKey':_0x3792('0x112'),'onDelete':_0x3792('0x170')});db[_0x3792('0x65')][_0x3792('0x11e')](db[_0x3792('0x69')],{'as':_0x3792('0x188'),'foreignKey':_0x3792('0x189'),'onDelete':_0x3792('0x170')});db[_0x3792('0x65')][_0x3792('0x11e')](db[_0x3792('0x62')],{'as':_0x3792('0x18a'),'foreignKey':_0x3792('0x186'),'onDelete':'restrict'});db[_0x3792('0x65')][_0x3792('0x11e')](db[_0x3792('0x8a')],{'onDelete':_0x3792('0x170'),'foreignKey':_0x3792('0x17b')});db['ChatInteraction'][_0x3792('0x113')](db[_0x3792('0x187')],{'as':_0x3792('0x155'),'onDelete':_0x3792('0x111'),'foreignKey':'ChatInteractionId'});db[_0x3792('0x119')][_0x3792('0x11e')](db[_0x3792('0x62')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x186')});db[_0x3792('0x119')][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':'ContactId'});db[_0x3792('0x119')][_0x3792('0x11e')](db[_0x3792('0x14')],{'as':_0x3792('0x169'),'foreignKey':'UserId'});db[_0x3792('0x119')][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':_0x3792('0x18b'),'as':_0x3792('0x16a')});db[_0x3792('0x119')]['belongsToMany'](db[_0x3792('0x8a')],{'through':_0x3792('0x18b'),'as':_0x3792('0x176')});db[_0x3792('0x119')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x16c'),'through':_0x3792('0x18c'),'foreignKey':'ChatInteractionId'});db[_0x3792('0x187')][_0x3792('0x11e')](db[_0x3792('0x14')],{'onDelete':_0x3792('0x111'),'as':_0x3792('0x14')});db['ChatMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x3792('0x111'),'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x187')][_0x3792('0x11e')](db[_0x3792('0x119')],{'onDelete':'cascade','as':_0x3792('0x16f'),'foreignKey':_0x3792('0x18d')});db[_0x3792('0x187')]['belongsTo'](db[_0x3792('0xed')],{'as':'Attachment','foreignKey':_0x3792('0x18e')});db[_0x3792('0x187')][_0x3792('0x11e')](db[_0x3792('0x62')],{'as':'Account','foreignKey':_0x3792('0x186')});db['ChatOfflineMessage'][_0x3792('0x11e')](db[_0x3792('0x124')],{'onDelete':'cascade','as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x18f')][_0x3792('0x11e')](db['ChatWebsite'],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x186')});db[_0x3792('0x69')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':'Agents','through':_0x3792('0x31'),'hooks':!![]});db[_0x3792('0x69')][_0x3792('0x120')](db[_0x3792('0xe6')],{'through':_0x3792('0x190'),'as':_0x3792('0x151')});db[_0x3792('0x121')][_0x3792('0x113')](db['ChatInternalMessage'],{'as':_0x3792('0x155'),'foreignKey':'ChatGroupId','onDelete':_0x3792('0x111')});db[_0x3792('0x121')]['belongsToMany'](db['User'],{'as':_0x3792('0x142'),'through':_0x3792('0x123')});db['ChatProactiveAction'][_0x3792('0x11e')](db[_0x3792('0x62')],{'as':_0x3792('0x18a'),'foreignKey':_0x3792('0x186')});db[_0x3792('0x6e')][_0x3792('0x113')](db[_0x3792('0x124')],{'as':_0x3792('0x125'),'foreignKey':_0x3792('0x191')});db['CmContact'][_0x3792('0x113')](db[_0x3792('0x70')],{'as':_0x3792('0x144'),'foreignKey':_0x3792('0x15b')});db['CmContact'][_0x3792('0x113')](db['CmHopperFinal'],{'as':_0x3792('0x117'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x124')]['hasMany'](db['CmHopperHistory'],{'as':_0x3792('0x145'),'foreignKey':_0x3792('0x15b')});db['CmContact'][_0x3792('0x113')](db[_0x3792('0x77')],{'as':_0x3792('0x77'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x124')]['hasMany'](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0x3792('0x124')][_0x3792('0x113')](db['OpenchannelInteraction'],{'as':_0x3792('0x118'),'foreignKey':'ContactId','onDelete':_0x3792('0x170')});db['CmContact'][_0x3792('0x113')](db['ChatInteraction'],{'as':_0x3792('0x11a'),'foreignKey':_0x3792('0x15b'),'onDelete':'restrict'});db[_0x3792('0x124')][_0x3792('0x113')](db[_0x3792('0x55')],{'as':'SmsInteractions','foreignKey':_0x3792('0x15b'),'onDelete':_0x3792('0x170')});db[_0x3792('0x124')][_0x3792('0x113')](db[_0x3792('0x4b')],{'as':_0x3792('0x11c'),'foreignKey':_0x3792('0x15b'),'onDelete':_0x3792('0x170')});db[_0x3792('0x124')]['hasMany'](db['MailInteraction'],{'as':_0x3792('0x127'),'foreignKey':_0x3792('0x15b'),'onDelete':_0x3792('0x170')});db[_0x3792('0x124')][_0x3792('0x11e')](db[_0x3792('0x6e')],{'as':_0x3792('0x192'),'foreignKey':_0x3792('0x191')});db[_0x3792('0x124')][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':'List','foreignKey':_0x3792('0x164'),'onDelete':_0x3792('0x111')});db[_0x3792('0x124')][_0x3792('0x120')](db['User'],{'as':_0x3792('0x16c'),'through':_0x3792('0x193')});db[_0x3792('0x124')]['belongsToMany'](db[_0x3792('0x8a')],{'as':'Tags','through':_0x3792('0x194')});db[_0x3792('0x124')]['belongsToMany'](db['Tag'],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0x3792('0x70')][_0x3792('0x11e')](db['CmContact'],{'as':_0x3792('0x15a'),'foreignKey':'ContactId','onDelete':_0x3792('0x111')});db['CmHopper'][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':'List','foreignKey':'ListId','onDelete':_0x3792('0x111')});db[_0x3792('0x70')][_0x3792('0x11e')](db[_0x3792('0x14')],{'as':_0x3792('0x195'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x70')][_0x3792('0x11e')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x3792('0x143'),'onDelete':_0x3792('0x111')});db['CmHopper'][_0x3792('0x11e')](db[_0x3792('0xe9')],{'as':_0x3792('0xe9'),'foreignKey':_0x3792('0x196'),'onDelete':'cascade'});db[_0x3792('0x70')][_0x3792('0x11e')](db['User'],{'as':_0x3792('0x169'),'foreignKey':_0x3792('0x197')});db['CmHopperBlack'][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b'),'onDelete':'cascade'});db[_0x3792('0x72')][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164'),'onDelete':_0x3792('0x111')});db[_0x3792('0x72')][_0x3792('0x11e')](db[_0x3792('0x1d')],{'as':_0x3792('0x188'),'foreignKey':_0x3792('0x143'),'onDelete':'cascade'});db[_0x3792('0x72')]['belongsTo'](db['Campaign'],{'as':_0x3792('0xe9'),'foreignKey':'CampaignId','onDelete':_0x3792('0x111')});db['Automation']['hasMany'](db[_0x3792('0x80')],{'as':{'plural':'All','singular':_0x3792('0x198')},'foreignKey':_0x3792('0x199'),'onDelete':_0x3792('0x111'),'hooks':!![]});db[_0x3792('0x7c')][_0x3792('0x113')](db[_0x3792('0x80')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0x3792('0x19a'),'onDelete':'cascade','hooks':!![]});db[_0x3792('0x7c')][_0x3792('0x113')](db[_0x3792('0x7a')],{'as':_0x3792('0x19b'),'foreignKey':_0x3792('0x19c'),'onDelete':_0x3792('0x111'),'hooks':!![]});db[_0x3792('0x14a')]['hasMany'](db['Interval'],{'as':_0x3792('0x19d'),'foreignKey':_0x3792('0x14b'),'onDelete':_0x3792('0x111'),'hooks':!![],'required':![]});db[_0x3792('0x14a')][_0x3792('0x113')](db[_0x3792('0x115')],{'as':_0x3792('0x116'),'foreignKey':'IntervalId','onDelete':_0x3792('0x170')});db[_0x3792('0x14a')][_0x3792('0x113')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0x3792('0x14b')});db['Interval'][_0x3792('0x113')](db[_0x3792('0x65')],{'as':_0x3792('0x19e'),'foreignKey':'IntervalId'});db[_0x3792('0x14a')][_0x3792('0x113')](db[_0x3792('0x49')],{'as':'FaxApplications','foreignKey':_0x3792('0x14b')});db[_0x3792('0x14a')][_0x3792('0x113')](db[_0x3792('0x17a')],{'as':_0x3792('0x19f'),'foreignKey':_0x3792('0x14b')});db[_0x3792('0x87')][_0x3792('0x11e')](db[_0x3792('0x3c')],{});db[_0x3792('0x87')][_0x3792('0x11e')](db[_0x3792('0x94')],{'foreignKey':_0x3792('0x1a0')});db['Schedule'][_0x3792('0x11e')](db[_0x3792('0x92')],{'foreignKey':'CustomReportId'});db[_0x3792('0x89')][_0x3792('0x120')](db[_0x3792('0x1c')],{'as':_0x3792('0x1a1'),'through':_0x3792('0x141'),'onDelete':_0x3792('0x170')});db[_0x3792('0x8a')]['belongsToMany'](db[_0x3792('0x124')],{'through':_0x3792('0x194')});db[_0x3792('0x8a')][_0x3792('0x120')](db[_0x3792('0x119')],{'through':_0x3792('0x18b')});db[_0x3792('0x8a')]['belongsToMany'](db[_0x3792('0x3e')],{'through':'mail_interaction_has_tags'});db[_0x3792('0x8a')][_0x3792('0x120')](db[_0x3792('0x55')],{'through':_0x3792('0x17d')});db[_0x3792('0x8a')][_0x3792('0x120')](db['FaxInteraction'],{'through':_0x3792('0x175')});db[_0x3792('0x8a')][_0x3792('0x120')](db[_0x3792('0x5f')],{'through':_0x3792('0x184')});db[_0x3792('0x8a')][_0x3792('0x120')](db[_0x3792('0x104')],{'through':_0x3792('0x1a2')});db[_0x3792('0x8d')][_0x3792('0x113')](db[_0x3792('0x80')],{'as':{'plural':_0x3792('0x1a3'),'singular':_0x3792('0x1a4')},'foreignKey':'TriggerAllId','onDelete':_0x3792('0x111'),'hooks':!![]});db[_0x3792('0x8d')][_0x3792('0x113')](db[_0x3792('0x80')],{'as':{'plural':_0x3792('0x1a5'),'singular':_0x3792('0x1a6')},'foreignKey':_0x3792('0x1a7'),'onDelete':_0x3792('0x111'),'hooks':!![]});db['Trigger']['hasMany'](db['Action'],{'as':_0x3792('0x19b'),'foreignKey':_0x3792('0x1a8'),'onDelete':_0x3792('0x111'),'hooks':!![]});db[_0x3792('0x92')][_0x3792('0x113')](db['AnalyticFieldReport'],{'as':_0x3792('0x1a9'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1aa'),'hooks':!![]});db[_0x3792('0x94')]['hasMany'](db[_0x3792('0x99')],{'as':_0x3792('0x1a9'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1a0')});db[_0x3792('0x97')]['hasMany'](db[_0x3792('0x99')],{'as':_0x3792('0x1a9'),'onDelete':'cascade','foreignKey':'MetricId'});db[_0x3792('0x99')][_0x3792('0x11e')](db[_0x3792('0x97')],{'foreignKey':_0x3792('0x1ab')});db[_0x3792('0x9d')][_0x3792('0x113')](db[_0x3792('0x9f')],{'as':_0x3792('0x1ac'),'onDelete':_0x3792('0x111'),'foreignKey':'AccountId'});db[_0x3792('0x9f')][_0x3792('0x113')](db[_0x3792('0xa1')],{'as':_0x3792('0x1ad'),'onDelete':_0x3792('0x111'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0x3792('0x113')](db[_0x3792('0xa1')],{'as':_0x3792('0x1ae'),'onDelete':'cascade','foreignKey':_0x3792('0x1af')});db['SalesforceConfiguration'][_0x3792('0x113')](db['SalesforceField'],{'as':_0x3792('0x1a9'),'onDelete':'cascade','foreignKey':_0x3792('0x1b0')});db[_0x3792('0x9f')][_0x3792('0x11e')](db[_0x3792('0x9d')],{'as':_0x3792('0x168'),'foreignKey':'AccountId'});db['SalesforceField']['hasMany'](db[_0x3792('0xa1')],{'as':'Subject','foreignKey':_0x3792('0x1b1')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0x3792('0x1b2'),'foreignKey':_0x3792('0x1af')});db[_0x3792('0xa1')]['hasMany'](db[_0x3792('0xa1')],{'as':'Field','foreignKey':'FieldId'});db['SalesforceField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x3792('0x1b3')});db[_0x3792('0xa3')][_0x3792('0x113')](db[_0x3792('0xa5')],{'as':_0x3792('0x1ac'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b4')});db[_0x3792('0xa5')][_0x3792('0x113')](db[_0x3792('0xa7')],{'as':_0x3792('0x1ad'),'onDelete':'cascade','foreignKey':_0x3792('0x1b1')});db['SugarcrmConfiguration'][_0x3792('0x113')](db['SugarcrmField'],{'as':_0x3792('0x1ae'),'onDelete':'cascade','foreignKey':_0x3792('0x1af')});db[_0x3792('0xa5')][_0x3792('0x113')](db['SugarcrmField'],{'as':_0x3792('0x1a9'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b0')});db[_0x3792('0xa5')]['belongsTo'](db[_0x3792('0xa3')],{'as':_0x3792('0x168'),'foreignKey':'AccountId'});db[_0x3792('0xa7')][_0x3792('0x113')](db['SugarcrmField'],{'as':_0x3792('0x1b5'),'foreignKey':_0x3792('0x1b1')});db[_0x3792('0xa7')][_0x3792('0x113')](db[_0x3792('0xa7')],{'as':_0x3792('0x1b2'),'foreignKey':_0x3792('0x1af')});db[_0x3792('0xa7')][_0x3792('0x113')](db[_0x3792('0xa7')],{'as':_0x3792('0x1b6'),'foreignKey':_0x3792('0x1b0')});db['SugarcrmField'][_0x3792('0x11e')](db['Variable'],{'as':_0x3792('0x1b7'),'foreignKey':_0x3792('0x1b3')});db['DeskAccount']['hasMany'](db['DeskConfiguration'],{'as':_0x3792('0x1ac'),'onDelete':'cascade','foreignKey':_0x3792('0x1b4')});db[_0x3792('0xa9')][_0x3792('0x113')](db[_0x3792('0xab')],{'as':_0x3792('0x1ad'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b1')});db[_0x3792('0xa9')][_0x3792('0x113')](db[_0x3792('0xab')],{'as':_0x3792('0x1ae'),'onDelete':_0x3792('0x111'),'foreignKey':'DescriptionId'});db[_0x3792('0xa9')][_0x3792('0x113')](db[_0x3792('0xab')],{'as':_0x3792('0x1a9'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b0')});db['DeskConfiguration'][_0x3792('0x11e')](db[_0x3792('0xa8')],{'as':'Account','foreignKey':_0x3792('0x1b4')});db[_0x3792('0xa9')][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':_0x3792('0x1b8')});db[_0x3792('0xab')]['hasMany'](db[_0x3792('0xab')],{'as':_0x3792('0x1b5'),'foreignKey':_0x3792('0x1b1')});db[_0x3792('0xab')][_0x3792('0x113')](db[_0x3792('0xab')],{'as':_0x3792('0x1b2'),'foreignKey':_0x3792('0x1af')});db['DeskField']['hasMany'](db[_0x3792('0xab')],{'as':'Field','foreignKey':'FieldId'});db[_0x3792('0xab')][_0x3792('0x11e')](db[_0x3792('0x1b7')],{'as':_0x3792('0x1b7'),'foreignKey':_0x3792('0x1b3')});db[_0x3792('0xad')][_0x3792('0x113')](db[_0x3792('0xaf')],{'as':_0x3792('0x1ac'),'onDelete':'cascade','foreignKey':_0x3792('0x1b4')});db['ZohoConfiguration'][_0x3792('0x113')](db['ZohoField'],{'as':_0x3792('0x1ad'),'onDelete':_0x3792('0x111'),'foreignKey':'SubjectId'});db[_0x3792('0xaf')][_0x3792('0x113')](db['ZohoField'],{'as':_0x3792('0x1ae'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1af')});db[_0x3792('0xaf')]['hasMany'](db['ZohoField'],{'as':_0x3792('0x1a9'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b0')});db[_0x3792('0xaf')][_0x3792('0x11e')](db[_0x3792('0xad')],{'as':_0x3792('0x168'),'foreignKey':'AccountId'});db['ZohoField'][_0x3792('0x113')](db[_0x3792('0x1b9')],{'as':_0x3792('0x1b5'),'foreignKey':_0x3792('0x1b1')});db[_0x3792('0x1b9')][_0x3792('0x113')](db[_0x3792('0x1b9')],{'as':_0x3792('0x1b2'),'foreignKey':_0x3792('0x1af')});db[_0x3792('0x1b9')]['hasMany'](db[_0x3792('0x1b9')],{'as':_0x3792('0x1b6'),'foreignKey':_0x3792('0x1b0')});db[_0x3792('0x1b9')]['belongsTo'](db[_0x3792('0x1b7')],{'as':_0x3792('0x1b7'),'foreignKey':'VariableId'});db[_0x3792('0xb1')][_0x3792('0x113')](db[_0x3792('0xb3')],{'as':_0x3792('0x1ac'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b4')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x3792('0x1ad'),'foreignKey':_0x3792('0x1b1')});db['ZendeskConfiguration'][_0x3792('0x113')](db[_0x3792('0xb4')],{'as':'Descriptions','foreignKey':_0x3792('0x1af')});db[_0x3792('0xb3')][_0x3792('0x113')](db['ZendeskField'],{'as':_0x3792('0x1a9'),'foreignKey':_0x3792('0x1b0')});db['ZendeskConfiguration'][_0x3792('0x11e')](db[_0x3792('0xb1')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x1b4')});db[_0x3792('0xb3')][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':'int_zendesk_configuration_has_tags'});db[_0x3792('0xb4')][_0x3792('0x113')](db[_0x3792('0xb4')],{'as':_0x3792('0x1b5'),'foreignKey':'SubjectId'});db[_0x3792('0xb4')]['hasMany'](db[_0x3792('0xb4')],{'as':_0x3792('0x1b2'),'foreignKey':_0x3792('0x1af')});db[_0x3792('0xb4')][_0x3792('0x113')](db['ZendeskField'],{'as':_0x3792('0x1b6'),'foreignKey':_0x3792('0x1b0')});db['ZendeskField'][_0x3792('0x11e')](db[_0x3792('0x1b7')],{'as':_0x3792('0x1b7'),'foreignKey':_0x3792('0x1b3')});db[_0x3792('0xb5')][_0x3792('0x113')](db['FreshdeskConfiguration'],{'as':_0x3792('0x1ac'),'onDelete':_0x3792('0x111'),'foreignKey':'AccountId'});db[_0x3792('0x1ba')][_0x3792('0x113')](db['FreshdeskField'],{'as':_0x3792('0x1ad'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b1')});db[_0x3792('0x1ba')][_0x3792('0x113')](db[_0x3792('0xb7')],{'as':_0x3792('0x1ae'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1af')});db[_0x3792('0x1ba')][_0x3792('0x113')](db[_0x3792('0xb7')],{'as':_0x3792('0x1a9'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b0')});db[_0x3792('0x1ba')][_0x3792('0x11e')](db[_0x3792('0xb5')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x1b4')});db['FreshdeskConfiguration'][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':_0x3792('0x1bb')});db[_0x3792('0xb7')][_0x3792('0x113')](db[_0x3792('0xb7')],{'as':_0x3792('0x1b5'),'foreignKey':'SubjectId'});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x3792('0x1b2'),'foreignKey':_0x3792('0x1af')});db['FreshdeskField'][_0x3792('0x113')](db[_0x3792('0xb7')],{'as':'Field','foreignKey':_0x3792('0x1b0')});db['FreshdeskField']['belongsTo'](db[_0x3792('0x1b7')],{'as':'Variable','foreignKey':_0x3792('0x1b3')});db['VtigerAccount'][_0x3792('0x113')](db[_0x3792('0xbb')],{'as':_0x3792('0x1ac'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b4')});db[_0x3792('0xbb')][_0x3792('0x113')](db[_0x3792('0xbc')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x3792('0xbb')][_0x3792('0x113')](db[_0x3792('0xbc')],{'as':'Descriptions','foreignKey':_0x3792('0x1af')});db[_0x3792('0xbb')]['hasMany'](db[_0x3792('0xbc')],{'as':_0x3792('0x1a9'),'foreignKey':_0x3792('0x1b0')});db[_0x3792('0xbb')][_0x3792('0x11e')](db[_0x3792('0xb9')],{'as':_0x3792('0x168'),'foreignKey':'AccountId'});db[_0x3792('0xbc')][_0x3792('0x113')](db[_0x3792('0xbc')],{'as':_0x3792('0x1b5'),'foreignKey':_0x3792('0x1b1')});db[_0x3792('0xbc')][_0x3792('0x113')](db[_0x3792('0xbc')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x3792('0xbc')]['hasMany'](db[_0x3792('0xbc')],{'as':_0x3792('0x1b6'),'foreignKey':'FieldId'});db[_0x3792('0xbc')][_0x3792('0x11e')](db[_0x3792('0x1b7')],{'as':'Variable','foreignKey':_0x3792('0x1b3')});db['ServicenowAccount'][_0x3792('0x113')](db[_0x3792('0xbf')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x3792('0xbf')]['hasMany'](db[_0x3792('0xc1')],{'as':_0x3792('0x1ad'),'foreignKey':_0x3792('0x1b1')});db[_0x3792('0xbf')][_0x3792('0x113')](db['ServicenowField'],{'as':_0x3792('0x1ae'),'foreignKey':'DescriptionId'});db[_0x3792('0xbf')][_0x3792('0x113')](db[_0x3792('0xc1')],{'as':_0x3792('0x1a9'),'foreignKey':_0x3792('0x1b0')});db[_0x3792('0xbf')][_0x3792('0x11e')](db[_0x3792('0x1bc')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x1b4')});db[_0x3792('0xc1')][_0x3792('0x113')](db[_0x3792('0xc1')],{'as':'Subject','foreignKey':_0x3792('0x1b1')});db[_0x3792('0xc1')][_0x3792('0x113')](db[_0x3792('0xc1')],{'as':_0x3792('0x1b2'),'foreignKey':_0x3792('0x1af')});db['ServicenowField'][_0x3792('0x113')](db[_0x3792('0xc1')],{'as':_0x3792('0x1b6'),'foreignKey':_0x3792('0x1b0')});db[_0x3792('0xc1')][_0x3792('0x11e')](db[_0x3792('0x1b7')],{'as':'Variable','foreignKey':'VariableId'});db[_0x3792('0xc3')][_0x3792('0x113')](db['Dynamics365Configuration'],{'as':_0x3792('0x1ac'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b4')});db[_0x3792('0xc4')]['hasMany'](db[_0x3792('0xc6')],{'as':_0x3792('0x1ad'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b1')});db[_0x3792('0xc4')][_0x3792('0x113')](db[_0x3792('0xc6')],{'as':_0x3792('0x1ae'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1af')});db[_0x3792('0xc4')][_0x3792('0x113')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x3792('0x111'),'foreignKey':'FieldId'});db[_0x3792('0xc4')][_0x3792('0x11e')](db[_0x3792('0xc3')],{'as':'Account','foreignKey':_0x3792('0x1b4')});db[_0x3792('0xc6')]['hasMany'](db[_0x3792('0xc6')],{'as':_0x3792('0x1b5'),'foreignKey':_0x3792('0x1b1')});db['Dynamics365Field'][_0x3792('0x113')](db[_0x3792('0xc6')],{'as':'Description','foreignKey':_0x3792('0x1af')});db[_0x3792('0xc6')][_0x3792('0x113')](db[_0x3792('0xc6')],{'as':'Field','foreignKey':_0x3792('0x1b0')});db[_0x3792('0xc6')]['belongsTo'](db[_0x3792('0x1b7')],{'as':_0x3792('0x1b7'),'foreignKey':_0x3792('0x1b3')});db[_0x3792('0xc8')][_0x3792('0x113')](db[_0x3792('0xca')],{'as':_0x3792('0x1ac'),'onDelete':_0x3792('0x111'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0x3792('0x113')](db[_0x3792('0xcb')],{'as':_0x3792('0x1ad'),'foreignKey':'SubjectId'});db[_0x3792('0xca')][_0x3792('0x113')](db[_0x3792('0xcb')],{'as':_0x3792('0x1ae'),'foreignKey':'DescriptionId'});db[_0x3792('0xca')][_0x3792('0x113')](db['FreshsalesField'],{'as':_0x3792('0x1a9'),'foreignKey':_0x3792('0x1b0')});db[_0x3792('0xca')]['belongsTo'](db[_0x3792('0xc8')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x1b4')});db[_0x3792('0xcb')][_0x3792('0x113')](db[_0x3792('0xcb')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x3792('0xcb')][_0x3792('0x113')](db[_0x3792('0xcb')],{'as':_0x3792('0x1b2'),'foreignKey':_0x3792('0x1af')});db[_0x3792('0xcb')][_0x3792('0x113')](db[_0x3792('0xcb')],{'as':'Field','foreignKey':_0x3792('0x1b0')});db[_0x3792('0xcb')][_0x3792('0x11e')](db['Variable'],{'as':_0x3792('0x1b7'),'foreignKey':_0x3792('0x1b3')});db[_0x3792('0xcf')]['belongsTo'](db['ChatWebsite'],{});db[_0x3792('0xcf')][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':'List','foreignKey':_0x3792('0x164')});db['ChatQueueReport']['belongsTo'](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0xcf')][_0x3792('0x11e')](db[_0x3792('0x119')],{});db[_0x3792('0xcf')][_0x3792('0x11e')](db[_0x3792('0x187')],{});db[_0x3792('0xcf')][_0x3792('0x11e')](db[_0x3792('0x14')],{});db['ChatQueueReport']['belongsTo'](db[_0x3792('0x69')],{});db[_0x3792('0xd1')][_0x3792('0x11e')](db[_0x3792('0x14')],{'onDelete':_0x3792('0x111'),'foreignKey':'FromId'});db[_0x3792('0xd1')][_0x3792('0x11e')](db[_0x3792('0x14')],{'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1bd')});db[_0x3792('0xd5')][_0x3792('0x113')](db['JscriptyQuestionReport'],{'foreignKey':_0x3792('0x1be'),'onDelete':'cascade'});db[_0x3792('0xd5')][_0x3792('0x113')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x3792('0x111')});db[_0x3792('0xd7')][_0x3792('0x11e')](db['SmsAccount'],{});db[_0x3792('0xd7')][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164')});db[_0x3792('0xd7')][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0xd7')][_0x3792('0x11e')](db[_0x3792('0x55')],{});db[_0x3792('0xd7')]['belongsTo'](db[_0x3792('0x57')],{});db[_0x3792('0xd7')][_0x3792('0x11e')](db[_0x3792('0x14')],{});db[_0x3792('0xd7')][_0x3792('0x11e')](db[_0x3792('0x59')],{});db['JscriptyProject'][_0x3792('0x113')](db[_0x3792('0xd5')],{'foreignKey':_0x3792('0x1bf')});db['JscriptyProject']['hasMany'](db[_0x3792('0xd3')],{'foreignKey':'ProjectId'});db[_0x3792('0xdb')][_0x3792('0x113')](db[_0x3792('0x1c0')],{'foreignKey':'ProjectId'});db[_0x3792('0xe1')]['belongsToMany'](db[_0x3792('0x14')],{'as':_0x3792('0x16c'),'through':_0x3792('0x13d')});db['Team'][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':'user_has_teams'});db[_0x3792('0xe6')]['belongsToMany'](db[_0x3792('0x1d')],{'through':'team_has_voice_queues','as':'VoiceQueues'});db[_0x3792('0xe6')][_0x3792('0x120')](db[_0x3792('0x12b')],{'through':_0x3792('0x167'),'as':'MailQueues'});db[_0x3792('0xe6')][_0x3792('0x120')](db['ChatQueue'],{'through':_0x3792('0x190'),'as':_0x3792('0x12d')});db[_0x3792('0xe6')]['belongsToMany'](db['FaxQueue'],{'through':_0x3792('0x178'),'as':_0x3792('0x1c1')});db[_0x3792('0xe6')][_0x3792('0x120')](db[_0x3792('0x59')],{'through':_0x3792('0x180'),'as':_0x3792('0x12e')});db[_0x3792('0xe6')][_0x3792('0x120')](db[_0x3792('0x12f')],{'through':'team_has_openchannel_queues','as':_0x3792('0x130')});db[_0x3792('0xe6')][_0x3792('0x120')](db[_0x3792('0x10b')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0x3792('0xe9')]['hasMany'](db['CmHopper'],{'as':_0x3792('0x144'),'foreignKey':_0x3792('0x196')});db[_0x3792('0xe9')][_0x3792('0x113')](db[_0x3792('0x74')],{'as':_0x3792('0x117'),'foreignKey':_0x3792('0x196')});db['Campaign'][_0x3792('0x113')](db[_0x3792('0x76')],{'as':_0x3792('0x145'),'foreignKey':_0x3792('0x196')});db[_0x3792('0xe9')]['hasMany'](db['CmHopperBlack'],{'as':_0x3792('0x1c2'),'foreignKey':_0x3792('0x196')});db['Campaign'][_0x3792('0x11e')](db['Trunk'],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x3792('0xe9')][_0x3792('0x11e')](db[_0x3792('0x2c')],{'as':_0x3792('0x148'),'foreignKey':_0x3792('0x149')});db[_0x3792('0xe9')][_0x3792('0x11e')](db[_0x3792('0x14a')],{'as':_0x3792('0x14a'),'foreignKey':'IntervalId'});db['Campaign'][_0x3792('0x11e')](db[_0x3792('0xe1')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0x3792('0xe9')]['belongsToMany'](db['CmList'],{'as':_0x3792('0x14e'),'through':_0x3792('0x1c3')});db['Campaign'][_0x3792('0x120')](db[_0x3792('0xf7')],{'as':_0x3792('0x153'),'through':_0x3792('0x1c4')});db[_0x3792('0x1c5')][_0x3792('0x11e')](db[_0x3792('0x40')],{});db[_0x3792('0x1c5')][_0x3792('0x11e')](db[_0x3792('0x3e')],{});db[_0x3792('0x1c5')][_0x3792('0x11e')](db[_0x3792('0x3c')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db['MailTransferReport'][_0x3792('0x11e')](db['User'],{'foreignKey':_0x3792('0x1c6'),'as':_0x3792('0x1c7')});db['MailTransferReport'][_0x3792('0x11e')](db[_0x3792('0x14')],{'foreignKey':_0x3792('0x1c8'),'as':_0x3792('0x1c9')});db[_0x3792('0x1c5')]['belongsTo'](db[_0x3792('0x12b')],{'foreignKey':_0x3792('0x1ca'),'as':'ToQueue'});db[_0x3792('0x1c5')][_0x3792('0x11e')](db[_0x3792('0x3c')],{'foreignKey':_0x3792('0x1cb'),'as':'ToAccount'});db[_0x3792('0x1cc')]['belongsTo'](db['ChatMessage'],{});db[_0x3792('0x1cc')][_0x3792('0x11e')](db[_0x3792('0x119')],{});db[_0x3792('0x1cc')][_0x3792('0x11e')](db[_0x3792('0x62')],{'foreignKey':_0x3792('0x1cd'),'as':_0x3792('0x1ce')});db['ChatTransferReport'][_0x3792('0x11e')](db[_0x3792('0x14')],{'foreignKey':_0x3792('0x1c6'),'as':_0x3792('0x1c7')});db[_0x3792('0x1cc')][_0x3792('0x11e')](db[_0x3792('0x14')],{'foreignKey':'ToUserId','as':_0x3792('0x1c9')});db[_0x3792('0x1cc')]['belongsTo'](db[_0x3792('0x69')],{'foreignKey':_0x3792('0x1cf'),'as':_0x3792('0x1d0')});db[_0x3792('0x1cc')][_0x3792('0x11e')](db[_0x3792('0x62')],{'foreignKey':_0x3792('0x1d1'),'as':_0x3792('0x1d2')});db[_0x3792('0xf3')][_0x3792('0x11e')](db[_0x3792('0x4d')],{});db[_0x3792('0xf3')][_0x3792('0x11e')](db[_0x3792('0x4b')],{});db[_0x3792('0xf3')][_0x3792('0x11e')](db['FaxAccount'],{'foreignKey':_0x3792('0x1d3'),'as':_0x3792('0x1ce')});db['FaxTransferReport'][_0x3792('0x11e')](db['User'],{'foreignKey':_0x3792('0x1c6'),'as':_0x3792('0x1c7')});db[_0x3792('0xf3')][_0x3792('0x11e')](db[_0x3792('0x14')],{'foreignKey':_0x3792('0x1c8'),'as':_0x3792('0x1c9')});db['FaxTransferReport'][_0x3792('0x11e')](db['FaxQueue'],{'foreignKey':_0x3792('0x1d4'),'as':_0x3792('0x1d0')});db[_0x3792('0xf3')][_0x3792('0x11e')](db[_0x3792('0x47')],{'foreignKey':_0x3792('0x1d5'),'as':_0x3792('0x1d2')});db['OpenchannelTransferReport'][_0x3792('0x11e')](db[_0x3792('0x182')],{});db['OpenchannelTransferReport'][_0x3792('0x11e')](db[_0x3792('0x5f')],{});db[_0x3792('0xf5')][_0x3792('0x11e')](db[_0x3792('0x5b')],{'foreignKey':_0x3792('0x1d6'),'as':_0x3792('0x1ce')});db['OpenchannelTransferReport'][_0x3792('0x11e')](db['User'],{'foreignKey':'FromUserId','as':_0x3792('0x1c7')});db[_0x3792('0xf5')]['belongsTo'](db[_0x3792('0x14')],{'foreignKey':_0x3792('0x1c8'),'as':'ToAgent'});db[_0x3792('0xf5')][_0x3792('0x11e')](db['OpenchannelQueue'],{'foreignKey':_0x3792('0x1d7'),'as':'ToQueue'});db[_0x3792('0xf5')]['belongsTo'](db[_0x3792('0x5b')],{'foreignKey':_0x3792('0x1d8'),'as':_0x3792('0x1d2')});db[_0x3792('0x1d9')][_0x3792('0x11e')](db[_0x3792('0x57')],{});db['SmsTransferReport']['belongsTo'](db['SmsInteraction'],{});db[_0x3792('0x1d9')][_0x3792('0x11e')](db[_0x3792('0x52')],{'foreignKey':_0x3792('0x1da'),'as':'FromAccount'});db[_0x3792('0x1d9')][_0x3792('0x11e')](db[_0x3792('0x14')],{'foreignKey':_0x3792('0x1c6'),'as':'FromAgent'});db['SmsTransferReport']['belongsTo'](db[_0x3792('0x14')],{'foreignKey':'ToUserId','as':_0x3792('0x1c9')});db[_0x3792('0x1d9')][_0x3792('0x11e')](db[_0x3792('0x59')],{'foreignKey':_0x3792('0x1db'),'as':_0x3792('0x1d0')});db[_0x3792('0x1d9')][_0x3792('0x11e')](db[_0x3792('0x52')],{'foreignKey':_0x3792('0x1dc'),'as':_0x3792('0x1d2')});db[_0x3792('0xf7')][_0x3792('0x113')](db[_0x3792('0x15e')],{'as':_0x3792('0x15f'),'foreignKey':_0x3792('0x164')});db[_0x3792('0xf7')]['hasMany'](db['CmCustomField'],{'as':_0x3792('0x1dd'),'foreignKey':_0x3792('0x164')});db['CmList'][_0x3792('0x113')](db[_0x3792('0x124')],{'as':_0x3792('0x125'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x164')});db['CmList']['hasMany'](db[_0x3792('0x74')],{'as':_0x3792('0x117'),'foreignKey':_0x3792('0x164')});db['CmList'][_0x3792('0x113')](db[_0x3792('0x76')],{'as':_0x3792('0x1de'),'foreignKey':_0x3792('0x164')});db[_0x3792('0xf7')]['hasMany'](db[_0x3792('0x77')],{'as':_0x3792('0x77'),'foreignKey':_0x3792('0x164')});db[_0x3792('0xf7')][_0x3792('0x120')](db[_0x3792('0x1d')],{'as':_0x3792('0x1df'),'through':_0x3792('0x14f')});db[_0x3792('0xf7')]['belongsToMany'](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':_0x3792('0x126')});db[_0x3792('0xf9')][_0x3792('0x113')](db[_0x3792('0x115')],{'as':_0x3792('0x116'),'onDelete':_0x3792('0x111')});db[_0x3792('0xf9')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':_0x3792('0x132')});db[_0x3792('0xfb')][_0x3792('0x113')](db['User'],{'as':_0x3792('0x16c'),'foreignKey':_0x3792('0x11f')});db[_0x3792('0xfb')][_0x3792('0x113')](db[_0x3792('0x1e0')],{'as':_0x3792('0x1e1'),'foreignKey':'userProfileId','onDelete':_0x3792('0x111')});db['UserProfileSection'][_0x3792('0x113')](db[_0x3792('0xfe')],{'as':_0x3792('0x1e2'),'foreignKey':_0x3792('0x1e3'),'onDelete':_0x3792('0x111')});db[_0x3792('0x101')][_0x3792('0x113')](db['Disposition'],{'as':'Dispositions','foreignKey':'WhatsappAccountId'});db[_0x3792('0x101')][_0x3792('0x113')](db['CannedAnswer'],{'as':_0x3792('0x160'),'foreignKey':_0x3792('0x1e4')});db[_0x3792('0x101')][_0x3792('0x113')](db[_0x3792('0x106')],{'as':_0x3792('0x155'),'foreignKey':'WhatsappAccountId'});db[_0x3792('0x101')][_0x3792('0x113')](db[_0x3792('0x104')],{'as':_0x3792('0x161')});db[_0x3792('0x101')][_0x3792('0x113')](db[_0x3792('0x102')],{'as':_0x3792('0x162')});db[_0x3792('0x101')][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':'List','foreignKey':_0x3792('0x164')});db[_0x3792('0x101')]['belongsTo'](db['Pause'],{'as':_0x3792('0x14c'),'foreignKey':_0x3792('0x14d')});db[_0x3792('0x101')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':'user_has_whatsapp_accounts'});db[_0x3792('0x102')]['belongsTo'](db[_0x3792('0x14')],{'onDelete':_0x3792('0x170')});db[_0x3792('0x102')][_0x3792('0x11e')](db[_0x3792('0x10b')],{'onDelete':_0x3792('0x170')});db[_0x3792('0x102')][_0x3792('0x11e')](db[_0x3792('0x101')],{'onDelete':'restrict'});db[_0x3792('0x102')][_0x3792('0x11e')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x3792('0x14b')});db[_0x3792('0x102')][_0x3792('0x11e')](db[_0x3792('0x8a')],{'onDelete':_0x3792('0x170'),'foreignKey':'TagId'});db[_0x3792('0x104')]['hasMany'](db[_0x3792('0x106')],{'as':_0x3792('0x155'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1e5')});db[_0x3792('0x104')][_0x3792('0x11e')](db[_0x3792('0x101')],{'as':_0x3792('0x168'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':'Contact','foreignKey':_0x3792('0x15b')});db[_0x3792('0x104')][_0x3792('0x11e')](db['User'],{'as':_0x3792('0x169'),'foreignKey':'UserId'});db[_0x3792('0x104')][_0x3792('0x120')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x3792('0x16a')});db[_0x3792('0x104')][_0x3792('0x120')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x3792('0x176')});db[_0x3792('0x104')]['belongsToMany'](db['User'],{'as':_0x3792('0x16c'),'through':_0x3792('0x1e6'),'foreignKey':'WhatsappInteractionId'});db[_0x3792('0x106')][_0x3792('0x11e')](db['User'],{'as':'User'});db[_0x3792('0x106')][_0x3792('0x11e')](db[_0x3792('0x124')],{'onDelete':'cascade','as':'Contact'});db[_0x3792('0x106')][_0x3792('0x11e')](db['WhatsappInteraction'],{'onDelete':_0x3792('0x111'),'as':'Interaction','foreignKey':_0x3792('0x1e5')});db[_0x3792('0x106')][_0x3792('0x11e')](db[_0x3792('0x101')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x1e4')});db[_0x3792('0x108')][_0x3792('0x11e')](db['WhatsappAccount'],{});db[_0x3792('0x108')]['belongsTo'](db[_0x3792('0xf7')],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164')});db[_0x3792('0x108')][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':'Contact','foreignKey':_0x3792('0x15b')});db[_0x3792('0x108')]['belongsTo'](db[_0x3792('0x104')],{});db[_0x3792('0x108')]['belongsTo'](db[_0x3792('0x10b')],{});db[_0x3792('0x108')][_0x3792('0x11e')](db[_0x3792('0x106')],{});db['WhatsappQueueReport'][_0x3792('0x11e')](db[_0x3792('0x14')],{});db[_0x3792('0x109')][_0x3792('0x11e')](db[_0x3792('0x106')],{});db['WhatsappTransferReport'][_0x3792('0x11e')](db[_0x3792('0x104')],{});db[_0x3792('0x109')]['belongsTo'](db[_0x3792('0x101')],{'foreignKey':_0x3792('0x1e7'),'as':'FromAccount'});db[_0x3792('0x109')][_0x3792('0x11e')](db[_0x3792('0x101')],{'foreignKey':_0x3792('0x1e8'),'as':'ToAccount'});db['WhatsappTransferReport'][_0x3792('0x11e')](db['WhatsappQueue'],{'foreignKey':_0x3792('0x1e9'),'as':_0x3792('0x1d0')});db[_0x3792('0x109')][_0x3792('0x11e')](db[_0x3792('0x14')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x3792('0x109')][_0x3792('0x11e')](db[_0x3792('0x14')],{'foreignKey':'ToUserId','as':_0x3792('0x1c9')});db[_0x3792('0x10b')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':_0x3792('0x131'),'foreignKey':_0x3792('0x1ea')});db[_0x3792('0x10b')][_0x3792('0x120')](db[_0x3792('0xe6')],{'through':_0x3792('0x1eb'),'as':_0x3792('0x151')});module[_0x3792('0x1ec')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index ebf28b8..e150b50 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1fb1=['./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/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/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','/api/cm/hopper','/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/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','./api/pause','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','./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/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatInternalMessage','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/messages','./api/squareMessage','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileResource','/api/notifications','./api/notification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/demo','snippet','1.0.16','/plugins','/server/files/plugins','get','resolve','appPath','/index.html','path','express','util','./errors','./config/environment','api','./config/logger','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','user','role','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)','url','responseTime','name','agent_name','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items'];(function(_0xab8668,_0x5204ac){var _0x571c10=function(_0x4ed488){while(--_0x4ed488){_0xab8668['push'](_0xab8668['shift']());}};_0x571c10(++_0x5204ac);}(_0x1fb1,0xd4));var _0x11fb=function(_0x1d4739,_0x192944){_0x1d4739=_0x1d4739-0x0;var _0x48c5cb=_0x1fb1[_0x1d4739];return _0x48c5cb;};'use strict';var path=require(_0x11fb('0x0'));var express=require(_0x11fb('0x1'));var ewinston=require('express-winston');var util=require(_0x11fb('0x2'));var errors=require(_0x11fb('0x3'));var config=require(_0x11fb('0x4'));var logger=require('./config/logger')(_0x11fb('0x5'));var authLogger=require(_0x11fb('0x6'))('auth');exports[_0x11fb('0x7')]=function(_0x51de10){_0x51de10[_0x11fb('0x8')](ewinston[_0x11fb('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2e9b4c,_0x6b5420){return util[_0x11fb('0xa')](_0x11fb('0xb'),_0x2e9b4c[_0x11fb('0xc')],_0x2e9b4c[_0x11fb('0xd')][_0x11fb('0xe')]?_0x2e9b4c['headers'][_0x11fb('0xe')]:_0x2e9b4c[_0x11fb('0xf')][_0x11fb('0x10')]||_0x2e9b4c['ip'],_0x2e9b4c['url'],_0x6b5420[_0x11fb('0x11')],_0x6b5420['responseTime'],_0x2e9b4c[_0x11fb('0x12')]?_0x2e9b4c[_0x11fb('0x12')]['id']:null,_0x2e9b4c['user']?_0x2e9b4c[_0x11fb('0x12')]['name']:null,_0x2e9b4c[_0x11fb('0x12')]?_0x2e9b4c[_0x11fb('0x12')][_0x11fb('0x13')]:null);}}));_0x51de10[_0x11fb('0x8')](ewinston[_0x11fb('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x228bf3,_0x329847){var _0x319405='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x228bf3[_0x11fb('0x14')]&&_0x228bf3[_0x11fb('0x14')][_0x11fb('0x15')]&&_0x228bf3[_0x11fb('0x14')][_0x11fb('0x16')]){_0x319405=_0x11fb('0x17');}return util[_0x11fb('0xa')](_0x319405,_0x228bf3[_0x11fb('0xc')],_0x228bf3[_0x11fb('0xd')][_0x11fb('0xe')]?_0x228bf3[_0x11fb('0xd')][_0x11fb('0xe')]:_0x228bf3[_0x11fb('0xf')][_0x11fb('0x10')]||_0x228bf3['ip'],_0x228bf3[_0x11fb('0x18')],_0x329847[_0x11fb('0x11')],_0x329847[_0x11fb('0x19')],_0x228bf3[_0x11fb('0x12')]?_0x228bf3[_0x11fb('0x12')]['id']:null,_0x228bf3['user']?_0x228bf3[_0x11fb('0x12')][_0x11fb('0x1a')]:null,_0x228bf3[_0x11fb('0x12')]?_0x228bf3['user'][_0x11fb('0x13')]:null,_0x228bf3[_0x11fb('0x14')]&&_0x228bf3['body'][_0x11fb('0x15')]?_0x228bf3[_0x11fb('0x14')][_0x11fb('0x15')]:'other',_0x228bf3[_0x11fb('0x14')]&&_0x228bf3[_0x11fb('0x14')]['agent_id']?_0x228bf3['body'][_0x11fb('0x16')]:'',_0x228bf3[_0x11fb('0x14')]&&_0x228bf3[_0x11fb('0x14')][_0x11fb('0x1b')]?_0x228bf3[_0x11fb('0x14')][_0x11fb('0x1b')]:'');},'ignoreRoute':function(_0x1f7e0c){var _0x1c7149=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1c7149['test'](_0x1f7e0c[_0x11fb('0x18')]);}}));_0x51de10[_0x11fb('0x8')](_0x11fb('0x1c'),require(_0x11fb('0x1d')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x1e'),require('./api/voiceChanSpy'));_0x51de10['use'](_0x11fb('0x1f'),require(_0x11fb('0x20')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x21'),require(_0x11fb('0x22')));_0x51de10[_0x11fb('0x8')]('/api/voice/mohs',require(_0x11fb('0x23')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x24'),require(_0x11fb('0x25')));_0x51de10[_0x11fb('0x8')]('/api/voice/recordings',require('./api/voiceRecording'));_0x51de10[_0x11fb('0x8')](_0x11fb('0x26'),require(_0x11fb('0x27')));_0x51de10[_0x11fb('0x8')]('/api/voice/mails',require(_0x11fb('0x28')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x29'),require(_0x11fb('0x2a')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x2b'),require(_0x11fb('0x2c')));_0x51de10['use'](_0x11fb('0x2d'),require('./api/voiceDialReport'));_0x51de10[_0x11fb('0x8')](_0x11fb('0x2e'),require(_0x11fb('0x2f')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x30'),require(_0x11fb('0x31')));_0x51de10['use'](_0x11fb('0x32'),require(_0x11fb('0x33')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x34'),require(_0x11fb('0x35')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x36'),require('./api/voiceTransferReport'));_0x51de10[_0x11fb('0x8')](_0x11fb('0x37'),require(_0x11fb('0x38')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x39'),require(_0x11fb('0x3a')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x3b'),require('./api/mailQueue'));_0x51de10[_0x11fb('0x8')](_0x11fb('0x3c'),require(_0x11fb('0x3d')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x3e'),require(_0x11fb('0x3f')));_0x51de10[_0x11fb('0x8')]('/api/mail/messages',require(_0x11fb('0x40')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x41'),require(_0x11fb('0x42')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x43'),require('./api/mailQueueReport'));_0x51de10[_0x11fb('0x8')]('/api/dashboards',require(_0x11fb('0x44')));_0x51de10['use'](_0x11fb('0x45'),require(_0x11fb('0x46')));_0x51de10[_0x11fb('0x8')]('/api/fax/accounts',require(_0x11fb('0x47')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x48'),require(_0x11fb('0x49')));_0x51de10[_0x11fb('0x8')]('/api/fax/interactions',require(_0x11fb('0x4a')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x4b'),require('./api/faxMessage'));_0x51de10['use'](_0x11fb('0x4c'),require(_0x11fb('0x4d')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x4e'),require('./api/faxQueueReport'));_0x51de10['use'](_0x11fb('0x4f'),require(_0x11fb('0x50')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x51'),require(_0x11fb('0x52')));_0x51de10[_0x11fb('0x8')]('/api/sms/interactions',require(_0x11fb('0x53')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x54'),require(_0x11fb('0x55')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x56'),require('./api/smsQueue'));_0x51de10[_0x11fb('0x8')](_0x11fb('0x57'),require(_0x11fb('0x58')));_0x51de10['use'](_0x11fb('0x59'),require(_0x11fb('0x5a')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x5b'),require(_0x11fb('0x5c')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x5d'),require('./api/openchannelMessage'));_0x51de10[_0x11fb('0x8')](_0x11fb('0x5e'),require(_0x11fb('0x5f')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x60'),require(_0x11fb('0x61')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x62'),require(_0x11fb('0x63')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x64'),require(_0x11fb('0x65')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x66'),require(_0x11fb('0x67')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x68'),require(_0x11fb('0x69')));_0x51de10['use'](_0x11fb('0x6a'),require('./api/chatOfflineMessage'));_0x51de10['use'](_0x11fb('0x6b'),require(_0x11fb('0x6c')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x6d'),require(_0x11fb('0x6e')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x6f'),require(_0x11fb('0x70')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x71'),require('./api/cmCompany'));_0x51de10[_0x11fb('0x8')](_0x11fb('0x72'),require('./api/cmContact'));_0x51de10[_0x11fb('0x8')](_0x11fb('0x73'),require('./api/cmHopper'));_0x51de10['use']('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x51de10[_0x11fb('0x8')](_0x11fb('0x74'),require(_0x11fb('0x75')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x76'),require(_0x11fb('0x77')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x78'),require(_0x11fb('0x79')));_0x51de10['use'](_0x11fb('0x7a'),require(_0x11fb('0x7b')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x7c'),require('./api/automation'));_0x51de10[_0x11fb('0x8')](_0x11fb('0x7d'),require(_0x11fb('0x7e')));_0x51de10['use'](_0x11fb('0x7f'),require(_0x11fb('0x80')));_0x51de10['use'](_0x11fb('0x81'),require('./api/condition'));_0x51de10[_0x11fb('0x8')](_0x11fb('0x82'),require(_0x11fb('0x83')));_0x51de10[_0x11fb('0x8')]('/api/pauses',require(_0x11fb('0x84')));_0x51de10['use']('/api/cdr',require(_0x11fb('0x85')));_0x51de10['use']('/api/voiceQueuesLog',require(_0x11fb('0x86')));_0x51de10['use'](_0x11fb('0x87'),require(_0x11fb('0x88')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x89'),require(_0x11fb('0x8a')));_0x51de10['use']('/api/tags',require(_0x11fb('0x8b')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x8c'),require(_0x11fb('0x8d')));_0x51de10['use']('/api/triggers',require(_0x11fb('0x8e')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x8f'),require(_0x11fb('0x90')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x91'),require(_0x11fb('0x92')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x93'),require('./api/integrationReport'));_0x51de10[_0x11fb('0x8')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x51de10['use'](_0x11fb('0x94'),require(_0x11fb('0x95')));_0x51de10['use'](_0x11fb('0x96'),require(_0x11fb('0x97')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x98'),require(_0x11fb('0x99')));_0x51de10['use'](_0x11fb('0x9a'),require('./api/analyticFieldReport'));_0x51de10[_0x11fb('0x8')](_0x11fb('0x9b'),require(_0x11fb('0x9c')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x9d'),require(_0x11fb('0x9e')));_0x51de10['use'](_0x11fb('0x9f'),require('./api/intSalesforceConfiguration'));_0x51de10[_0x11fb('0x8')](_0x11fb('0xa0'),require(_0x11fb('0xa1')));_0x51de10[_0x11fb('0x8')]('/api/integrations/sugarcrm/accounts',require(_0x11fb('0xa2')));_0x51de10['use'](_0x11fb('0xa3'),require(_0x11fb('0xa4')));_0x51de10['use'](_0x11fb('0xa5'),require(_0x11fb('0xa6')));_0x51de10['use'](_0x11fb('0xa7'),require(_0x11fb('0xa8')));_0x51de10['use'](_0x11fb('0xa9'),require(_0x11fb('0xaa')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xab'),require(_0x11fb('0xac')));_0x51de10['use'](_0x11fb('0xad'),require(_0x11fb('0xae')));_0x51de10[_0x11fb('0x8')]('/api/integrations/zoho/configurations',require(_0x11fb('0xaf')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xb0'),require(_0x11fb('0xb1')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xb2'),require(_0x11fb('0xb3')));_0x51de10['use'](_0x11fb('0xb4'),require(_0x11fb('0xb5')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xb6'),require('./api/intZendeskField'));_0x51de10['use']('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x51de10[_0x11fb('0x8')]('/api/integrations/freshdesk/configurations',require(_0x11fb('0xb7')));_0x51de10['use'](_0x11fb('0xb8'),require('./api/intFreshdeskField'));_0x51de10[_0x11fb('0x8')](_0x11fb('0xb9'),require(_0x11fb('0xba')));_0x51de10[_0x11fb('0x8')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x51de10['use'](_0x11fb('0xbb'),require('./api/intVtigerField'));_0x51de10['use'](_0x11fb('0xbc'),require('./api/intServicenowAccount'));_0x51de10[_0x11fb('0x8')](_0x11fb('0xbd'),require(_0x11fb('0xbe')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xbf'),require(_0x11fb('0xc0')));_0x51de10['use']('/api/integrations/dynamics365/accounts',require(_0x11fb('0xc1')));_0x51de10['use'](_0x11fb('0xc2'),require(_0x11fb('0xc3')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xc4'),require('./api/intDynamics365Field'));_0x51de10[_0x11fb('0x8')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x51de10[_0x11fb('0x8')](_0x11fb('0xc5'),require('./api/intFreshsalesConfiguration'));_0x51de10[_0x11fb('0x8')](_0x11fb('0xc6'),require(_0x11fb('0xc7')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xc8'),require(_0x11fb('0xc9')));_0x51de10['use']('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x51de10[_0x11fb('0x8')]('/api/chat/internal/messages',require(_0x11fb('0xca')));_0x51de10[_0x11fb('0x8')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x51de10[_0x11fb('0x8')](_0x11fb('0xcb'),require(_0x11fb('0xcc')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xcd'),require(_0x11fb('0xce')));_0x51de10['use'](_0x11fb('0xcf'),require('./api/smsQueueReport'));_0x51de10[_0x11fb('0x8')](_0x11fb('0xd0'),require(_0x11fb('0xd1')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xd2'),require('./api/squareReportDetail'));_0x51de10['use'](_0x11fb('0xd3'),require('./api/jscriptyProject'));_0x51de10[_0x11fb('0x8')](_0x11fb('0xd4'),require('./api/setting'));_0x51de10[_0x11fb('0x8')](_0x11fb('0xd5'),require(_0x11fb('0xd6')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xd7'),require(_0x11fb('0xd8')));_0x51de10[_0x11fb('0x8')]('/api/square/recordings',require('./api/squareRecording'));_0x51de10[_0x11fb('0x8')](_0x11fb('0xd9'),require(_0x11fb('0xda')));_0x51de10['use']('/api/teams',require(_0x11fb('0xdb')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xdc'),require('./api/license'));_0x51de10[_0x11fb('0x8')](_0x11fb('0xdd'),require(_0x11fb('0xde')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xdf'),require(_0x11fb('0xe0')));_0x51de10['use'](_0x11fb('0xe1'),require(_0x11fb('0xe2')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xe3'),require(_0x11fb('0xe4')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xe5'),require('./api/mailTransferReport'));_0x51de10[_0x11fb('0x8')](_0x11fb('0xe6'),require('./api/chatTransferReport'));_0x51de10[_0x11fb('0x8')](_0x11fb('0xe7'),require('./api/faxTransferReport'));_0x51de10[_0x11fb('0x8')](_0x11fb('0xe8'),require(_0x11fb('0xe9')));_0x51de10['use'](_0x11fb('0xea'),require(_0x11fb('0xeb')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xec'),require(_0x11fb('0xed')));_0x51de10['use']('/api/voice/prefixes',require(_0x11fb('0xee')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xef'),require(_0x11fb('0xf0')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xf1'),require('./api/userProfileSection'));_0x51de10[_0x11fb('0x8')]('/api/userProfile/resources',require(_0x11fb('0xf2')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xf3'),require(_0x11fb('0xf4')));_0x51de10[_0x11fb('0x8')]('/api/whatsapp/accounts',require(_0x11fb('0xf5')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xf6'),require(_0x11fb('0xf7')));_0x51de10[_0x11fb('0x8')]('/api/whatsapp/interactions',require(_0x11fb('0xf8')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xf9'),require(_0x11fb('0xfa')));_0x51de10['use']('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x51de10[_0x11fb('0x8')](_0x11fb('0xfb'),require('./api/whatsappTransferReport'));_0x51de10[_0x11fb('0x8')](_0x11fb('0xfc'),require(_0x11fb('0xfd')));_0x51de10[_0x11fb('0x8')](_0x11fb('0xfe'),require(_0x11fb('0xff')));_0x51de10['use'](_0x11fb('0x100'),require(_0x11fb('0x101')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x102'),require(_0x11fb('0x103')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x104'),require(_0x11fb('0x105')));_0x51de10['use']('/api/rpc',require(_0x11fb('0x106')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x107'),require(_0x11fb('0x108')));_0x51de10[_0x11fb('0x8')]('/api/system',require(_0x11fb('0x109')));_0x51de10[_0x11fb('0x8')]('/api/pm2',require(_0x11fb('0x10a')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x10b'),require(_0x11fb('0x10c')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x10d'),express[_0x11fb('0x10e')](path[_0x11fb('0x10f')](config['root'],_0x11fb('0x10d'))));_0x51de10[_0x11fb('0x8')]('/www',express['static'](path[_0x11fb('0x10f')](config[_0x11fb('0x110')],'/www')));_0x51de10[_0x11fb('0x8')](_0x11fb('0x111'),express[_0x11fb('0x10e')](path[_0x11fb('0x10f')](config['root'],_0x11fb('0x111'))));_0x51de10['use']('/snippet',express[_0x11fb('0x10e')](path[_0x11fb('0x10f')](config[_0x11fb('0x110')],_0x11fb('0x112'),_0x11fb('0x113'))));_0x51de10[_0x11fb('0x8')](_0x11fb('0x114'),express['static'](path[_0x11fb('0x10f')](config[_0x11fb('0x110')],_0x11fb('0x115'))));_0x51de10['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0x11fb('0x116')](errors[0x194]);_0x51de10['route']('/*')[_0x11fb('0x116')](function(_0x33da42,_0x480155){_0x480155['sendFile'](path[_0x11fb('0x117')](_0x51de10[_0x11fb('0x116')](_0x11fb('0x118'))+_0x11fb('0x119')));});}; \ No newline at end of file +var _0x7f36=['api','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','user','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','name','agent_id','agent_name','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/interactions','./api/chatMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmCustomField','./api/action','/api/automations','./api/automation','./api/cannedAnswer','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/fields','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','static','root','join','/www','/demo','/snippet','snippet','1.0.16','/server/files/plugins','route','get','sendFile','resolve','appPath','path','express','express-winston','./errors','./config/environment','./config/logger'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0x7f36,0x103));var _0x67f3=function(_0x192c9b,_0x45f704){_0x192c9b=_0x192c9b-0x0;var _0x1a33e9=_0x7f36[_0x192c9b];return _0x1a33e9;};'use strict';var path=require(_0x67f3('0x0'));var express=require(_0x67f3('0x1'));var ewinston=require(_0x67f3('0x2'));var util=require('util');var errors=require(_0x67f3('0x3'));var config=require(_0x67f3('0x4'));var logger=require(_0x67f3('0x5'))(_0x67f3('0x6'));var authLogger=require(_0x67f3('0x5'))('auth');exports[_0x67f3('0x7')]=function(_0x4cc94e){_0x4cc94e[_0x67f3('0x8')](ewinston[_0x67f3('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x49bcbd,_0xbab1fc){return util[_0x67f3('0xa')](_0x67f3('0xb'),_0x49bcbd[_0x67f3('0xc')],_0x49bcbd[_0x67f3('0xd')][_0x67f3('0xe')]?_0x49bcbd['headers'][_0x67f3('0xe')]:_0x49bcbd[_0x67f3('0xf')][_0x67f3('0x10')]||_0x49bcbd['ip'],_0x49bcbd[_0x67f3('0x11')],_0xbab1fc[_0x67f3('0x12')],_0xbab1fc['responseTime'],_0x49bcbd[_0x67f3('0x13')]?_0x49bcbd['user']['id']:null,_0x49bcbd[_0x67f3('0x13')]?_0x49bcbd[_0x67f3('0x13')]['name']:null,_0x49bcbd[_0x67f3('0x13')]?_0x49bcbd[_0x67f3('0x13')][_0x67f3('0x14')]:null);}}));_0x4cc94e[_0x67f3('0x8')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x594564,_0x238f2d){var _0x1b0578=_0x67f3('0x15');if(_0x594564[_0x67f3('0x16')]&&_0x594564[_0x67f3('0x16')][_0x67f3('0x17')]&&_0x594564[_0x67f3('0x16')]['agent_id']){_0x1b0578=_0x67f3('0x18');}return util[_0x67f3('0xa')](_0x1b0578,_0x594564['method'],_0x594564[_0x67f3('0xd')][_0x67f3('0xe')]?_0x594564[_0x67f3('0xd')][_0x67f3('0xe')]:_0x594564[_0x67f3('0xf')][_0x67f3('0x10')]||_0x594564['ip'],_0x594564[_0x67f3('0x11')],_0x238f2d[_0x67f3('0x12')],_0x238f2d['responseTime'],_0x594564[_0x67f3('0x13')]?_0x594564[_0x67f3('0x13')]['id']:null,_0x594564[_0x67f3('0x13')]?_0x594564[_0x67f3('0x13')][_0x67f3('0x19')]:null,_0x594564[_0x67f3('0x13')]?_0x594564[_0x67f3('0x13')][_0x67f3('0x14')]:null,_0x594564[_0x67f3('0x16')]&&_0x594564[_0x67f3('0x16')][_0x67f3('0x17')]?_0x594564[_0x67f3('0x16')][_0x67f3('0x17')]:'other',_0x594564[_0x67f3('0x16')]&&_0x594564['body'][_0x67f3('0x1a')]?_0x594564[_0x67f3('0x16')][_0x67f3('0x1a')]:'',_0x594564[_0x67f3('0x16')]&&_0x594564[_0x67f3('0x16')][_0x67f3('0x1b')]?_0x594564[_0x67f3('0x16')]['agent_name']:'');},'ignoreRoute':function(_0x2f8b1d){var _0x1a160a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1a160a['test'](_0x2f8b1d[_0x67f3('0x11')]);}}));_0x4cc94e[_0x67f3('0x8')]('/api/users',require('./api/user'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x1c'),require('./api/voiceChanSpy'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x1d'),require(_0x67f3('0x1e')));_0x4cc94e['use']('/api/voice/extensions',require(_0x67f3('0x1f')));_0x4cc94e[_0x67f3('0x8')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x20'),require(_0x67f3('0x21')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x22'),require(_0x67f3('0x23')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x24'),require(_0x67f3('0x25')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x26'),require('./api/voiceMail'));_0x4cc94e['use'](_0x67f3('0x27'),require(_0x67f3('0x28')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x29'),require('./api/voiceCallReport'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x2a'),require('./api/voiceDialReport'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x2b'),require('./api/voiceAgentReport'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x2c'),require(_0x67f3('0x2d')));_0x4cc94e[_0x67f3('0x8')]('/api/members/reports',require(_0x67f3('0x2e')));_0x4cc94e['use']('/api/trunks',require(_0x67f3('0x2f')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x30'),require(_0x67f3('0x31')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x32'),require(_0x67f3('0x33')));_0x4cc94e[_0x67f3('0x8')]('/api/mail/accounts',require('./api/mailAccount'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x34'),require(_0x67f3('0x35')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x36'),require(_0x67f3('0x37')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x38'),require('./api/mailInteraction'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x39'),require('./api/mailMessage'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x3a'),require('./api/mailApplication'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x3b'),require(_0x67f3('0x3c')));_0x4cc94e['use'](_0x67f3('0x3d'),require(_0x67f3('0x3e')));_0x4cc94e[_0x67f3('0x8')]('/api/dashboards/items',require(_0x67f3('0x3f')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x40'),require(_0x67f3('0x41')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x42'),require(_0x67f3('0x43')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x44'),require(_0x67f3('0x45')));_0x4cc94e[_0x67f3('0x8')]('/api/fax/messages',require('./api/faxMessage'));_0x4cc94e[_0x67f3('0x8')]('/api/fax/queues',require(_0x67f3('0x46')));_0x4cc94e['use'](_0x67f3('0x47'),require(_0x67f3('0x48')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x49'),require(_0x67f3('0x4a')));_0x4cc94e[_0x67f3('0x8')]('/api/sms/applications',require(_0x67f3('0x4b')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x4c'),require(_0x67f3('0x4d')));_0x4cc94e['use'](_0x67f3('0x4e'),require(_0x67f3('0x4f')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x50'),require(_0x67f3('0x51')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x52'),require('./api/openchannelAccount'));_0x4cc94e['use'](_0x67f3('0x53'),require('./api/openchannelApplication'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x54'),require('./api/openchannelInteraction'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x55'),require(_0x67f3('0x56')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x57'),require(_0x67f3('0x58')));_0x4cc94e['use'](_0x67f3('0x59'),require(_0x67f3('0x5a')));_0x4cc94e[_0x67f3('0x8')]('/api/openchannel/reports/queue',require(_0x67f3('0x5b')));_0x4cc94e[_0x67f3('0x8')]('/api/chat/applications',require('./api/chatApplication'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x5c'),require('./api/chatInteraction'));_0x4cc94e[_0x67f3('0x8')]('/api/chat/messages',require(_0x67f3('0x5d')));_0x4cc94e[_0x67f3('0x8')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x4cc94e['use'](_0x67f3('0x5e'),require(_0x67f3('0x5f')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x60'),require(_0x67f3('0x61')));_0x4cc94e['use'](_0x67f3('0x62'),require(_0x67f3('0x63')));_0x4cc94e[_0x67f3('0x8')]('/api/cm/companies',require(_0x67f3('0x64')));_0x4cc94e[_0x67f3('0x8')]('/api/cm/contacts',require(_0x67f3('0x65')));_0x4cc94e[_0x67f3('0x8')]('/api/cm/hopper',require('./api/cmHopper'));_0x4cc94e['use'](_0x67f3('0x66'),require(_0x67f3('0x67')));_0x4cc94e['use'](_0x67f3('0x68'),require('./api/cmHopperFinal'));_0x4cc94e[_0x67f3('0x8')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x4cc94e[_0x67f3('0x8')]('/api/cm/custom_fields',require(_0x67f3('0x69')));_0x4cc94e[_0x67f3('0x8')]('/api/actions',require(_0x67f3('0x6a')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x6b'),require(_0x67f3('0x6c')));_0x4cc94e[_0x67f3('0x8')]('/api/canned_answers',require(_0x67f3('0x6d')));_0x4cc94e['use']('/api/dispositions',require(_0x67f3('0x6e')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x6f'),require('./api/condition'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x70'),require(_0x67f3('0x71')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x72'),require(_0x67f3('0x73')));_0x4cc94e[_0x67f3('0x8')]('/api/cdr',require('./api/cdr'));_0x4cc94e[_0x67f3('0x8')]('/api/voiceQueuesLog',require(_0x67f3('0x74')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x75'),require(_0x67f3('0x76')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x77'),require('./api/sound'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x78'),require(_0x67f3('0x79')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x7a'),require(_0x67f3('0x7b')));_0x4cc94e[_0x67f3('0x8')]('/api/triggers',require(_0x67f3('0x7c')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x7d'),require(_0x67f3('0x7e')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x7f'),require(_0x67f3('0x80')));_0x4cc94e[_0x67f3('0x8')]('/api/integrations/reports',require(_0x67f3('0x81')));_0x4cc94e['use'](_0x67f3('0x82'),require('./api/analyticCustomReport'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x83'),require(_0x67f3('0x84')));_0x4cc94e[_0x67f3('0x8')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x4cc94e['use']('/api/analytics/metrics',require(_0x67f3('0x85')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x86'),require('./api/analyticFieldReport'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x87'),require(_0x67f3('0x88')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x89'),require(_0x67f3('0x8a')));_0x4cc94e['use']('/api/integrations/salesforce/configurations',require(_0x67f3('0x8b')));_0x4cc94e['use'](_0x67f3('0x8c'),require(_0x67f3('0x8d')));_0x4cc94e['use'](_0x67f3('0x8e'),require(_0x67f3('0x8f')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x90'),require(_0x67f3('0x91')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x92'),require(_0x67f3('0x93')));_0x4cc94e[_0x67f3('0x8')]('/api/integrations/desk/accounts',require(_0x67f3('0x94')));_0x4cc94e[_0x67f3('0x8')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x95'),require('./api/intDeskField'));_0x4cc94e[_0x67f3('0x8')]('/api/integrations/zoho/accounts',require(_0x67f3('0x96')));_0x4cc94e[_0x67f3('0x8')]('/api/integrations/zoho/configurations',require(_0x67f3('0x97')));_0x4cc94e[_0x67f3('0x8')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x98'),require(_0x67f3('0x99')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x9a'),require(_0x67f3('0x9b')));_0x4cc94e[_0x67f3('0x8')]('/api/integrations/zendesk/fields',require(_0x67f3('0x9c')));_0x4cc94e['use'](_0x67f3('0x9d'),require('./api/intFreshdeskAccount'));_0x4cc94e['use']('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x9e'),require('./api/intFreshdeskField'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x9f'),require(_0x67f3('0xa0')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xa1'),require(_0x67f3('0xa2')));_0x4cc94e['use'](_0x67f3('0xa3'),require(_0x67f3('0xa4')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xa5'),require(_0x67f3('0xa6')));_0x4cc94e['use'](_0x67f3('0xa7'),require('./api/intServicenowConfiguration'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xa8'),require(_0x67f3('0xa9')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xaa'),require(_0x67f3('0xab')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xac'),require('./api/intDynamics365Configuration'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xad'),require(_0x67f3('0xae')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xaf'),require('./api/intFreshsalesAccount'));_0x4cc94e[_0x67f3('0x8')]('/api/integrations/freshsales/configurations',require(_0x67f3('0xb0')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xb1'),require(_0x67f3('0xb2')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xb3'),require(_0x67f3('0xb4')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xb5'),require(_0x67f3('0xb6')));_0x4cc94e[_0x67f3('0x8')]('/api/chat/internal/messages',require(_0x67f3('0xb7')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xb8'),require(_0x67f3('0xb9')));_0x4cc94e[_0x67f3('0x8')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xba'),require(_0x67f3('0xbb')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xbc'),require(_0x67f3('0xbd')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xbe'),require(_0x67f3('0xbf')));_0x4cc94e['use']('/api/square/details/reports',require(_0x67f3('0xc0')));_0x4cc94e['use']('/api/jscripty/projects',require('./api/jscriptyProject'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xc1'),require(_0x67f3('0xc2')));_0x4cc94e[_0x67f3('0x8')]('/api/square/odbc',require(_0x67f3('0xc3')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xc4'),require(_0x67f3('0xc5')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xc6'),require('./api/squareRecording'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xc7'),require(_0x67f3('0xc8')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xc9'),require(_0x67f3('0xca')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xcb'),require(_0x67f3('0xcc')));_0x4cc94e[_0x67f3('0x8')]('/api/campaigns',require(_0x67f3('0xcd')));_0x4cc94e['use'](_0x67f3('0xce'),require('./api/migration'));_0x4cc94e[_0x67f3('0x8')]('/api/attachments',require(_0x67f3('0xcf')));_0x4cc94e['use']('/api/plugins',require(_0x67f3('0xd0')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xd1'),require(_0x67f3('0xd2')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xd3'),require(_0x67f3('0xd4')));_0x4cc94e['use'](_0x67f3('0xd5'),require(_0x67f3('0xd6')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xd7'),require(_0x67f3('0xd8')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xd9'),require(_0x67f3('0xda')));_0x4cc94e[_0x67f3('0x8')]('/api/cm/lists',require(_0x67f3('0xdb')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xdc'),require('./api/voicePrefix'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xdd'),require(_0x67f3('0xde')));_0x4cc94e['use']('/api/userProfile/sections',require(_0x67f3('0xdf')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xe0'),require(_0x67f3('0xe1')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xe2'),require(_0x67f3('0xe3')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xe4'),require(_0x67f3('0xe5')));_0x4cc94e[_0x67f3('0x8')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xe6'),require(_0x67f3('0xe7')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xe8'),require(_0x67f3('0xe9')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xea'),require('./api/whatsappQueueReport'));_0x4cc94e[_0x67f3('0x8')]('/api/whatsapp/reports/transfer',require(_0x67f3('0xeb')));_0x4cc94e[_0x67f3('0x8')]('/api/whatsapp/queues',require(_0x67f3('0xec')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xed'),require(_0x67f3('0xee')));_0x4cc94e[_0x67f3('0x8')]('/api/auth/local',require('./api/authLocal'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xef'),require('./api/authGoogle'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xf0'),require(_0x67f3('0xf1')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xf2'),require(_0x67f3('0xf3')));_0x4cc94e['use'](_0x67f3('0xf4'),require(_0x67f3('0xf5')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xf6'),require(_0x67f3('0xf7')));_0x4cc94e['use'](_0x67f3('0xf8'),require(_0x67f3('0xf9')));_0x4cc94e[_0x67f3('0x8')]('/api/webbar',require(_0x67f3('0xfa')));_0x4cc94e['use']('/apidoc',express[_0x67f3('0xfb')](path['join'](config[_0x67f3('0xfc')],'/apidoc')));_0x4cc94e[_0x67f3('0x8')]('/www',express[_0x67f3('0xfb')](path[_0x67f3('0xfd')](config[_0x67f3('0xfc')],_0x67f3('0xfe'))));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xff'),express[_0x67f3('0xfb')](path[_0x67f3('0xfd')](config[_0x67f3('0xfc')],_0x67f3('0xff'))));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x100'),express[_0x67f3('0xfb')](path[_0x67f3('0xfd')](config[_0x67f3('0xfc')],_0x67f3('0x101'),_0x67f3('0x102'))));_0x4cc94e[_0x67f3('0x8')]('/plugins',express[_0x67f3('0xfb')](path[_0x67f3('0xfd')](config['root'],_0x67f3('0x103'))));_0x4cc94e[_0x67f3('0x104')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x67f3('0x105')](errors[0x194]);_0x4cc94e[_0x67f3('0x104')]('/*')[_0x67f3('0x105')](function(_0x1a097f,_0x4d8717){_0x4d8717[_0x67f3('0x106')](path[_0x67f3('0x107')](_0x4cc94e[_0x67f3('0x105')](_0x67f3('0x108'))+'/index.html'));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 9625d4f..629d135 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49b2=['listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../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/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','log','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment'];(function(_0xdc20b6,_0xf116ed){var _0x122910=function(_0x4f5172){while(--_0x4f5172){_0xdc20b6['push'](_0xdc20b6['shift']());}};_0x122910(++_0xf116ed);}(_0x49b2,0x86));var _0x249b=function(_0x2017b7,_0x467241){_0x2017b7=_0x2017b7-0x0;var _0x14ecb7=_0x49b2[_0x2017b7];return _0x14ecb7;};'use strict';var jayson=require(_0x249b('0x0'));var BPromise=require(_0x249b('0x1'));var _=require(_0x249b('0x2'));var config=require(_0x249b('0x3'));exports[_0x249b('0x4')]=function(){return new BPromise(function(_0x153958,_0x47bd0e){var _0x5e5010={};_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x6')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x7')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require('../api/voiceQueue/voiceQueue.rpc'));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x8')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x9')));_0x5e5010=_['merge'](_0x5e5010,require(_0x249b('0xa')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0xb')));_0x5e5010=_['merge'](_0x5e5010,require(_0x249b('0xc')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require('../api/trunk/trunk.rpc'));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0xd')));_0x5e5010=_['merge'](_0x5e5010,require(_0x249b('0xe')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0xf')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x10')));_0x5e5010=_['merge'](_0x5e5010,require(_0x249b('0x11')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x12')));_0x5e5010=_['merge'](_0x5e5010,require(_0x249b('0x13')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require('../api/mailApplication/mailApplication.rpc'));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x14')));_0x5e5010=_['merge'](_0x5e5010,require(_0x249b('0x15')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x16')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x17')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x18')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x19')));_0x5e5010=_['merge'](_0x5e5010,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x1a')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x1b')));_0x5e5010=_['merge'](_0x5e5010,require('../api/smsMessage/smsMessage.rpc'));_0x5e5010=_['merge'](_0x5e5010,require(_0x249b('0x1c')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x1d')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x1e')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x1f')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x5e5010=_['merge'](_0x5e5010,require(_0x249b('0x20')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x21')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x22')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require('../api/cmContact/cmContact.rpc'));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x23')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x24')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x25')));_0x5e5010=_['merge'](_0x5e5010,require(_0x249b('0x26')));_0x5e5010=_['merge'](_0x5e5010,require(_0x249b('0x27')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require('../api/interval/interval.rpc'));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x28')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x29')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x2a')));_0x5e5010=_['merge'](_0x5e5010,require(_0x249b('0x2b')));_0x5e5010=_['merge'](_0x5e5010,require(_0x249b('0x2c')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x2d')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x2e')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x2f')));_0x5e5010=_['merge'](_0x5e5010,require(_0x249b('0x30')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x31')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x32')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x33')));_0x5e5010=_['merge'](_0x5e5010,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x34')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x5e5010=_['merge'](_0x5e5010,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x5e5010=_['merge'](_0x5e5010,require(_0x249b('0x35')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x36')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x37')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x38')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require('../api/squareProject/squareProject.rpc'));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require('../api/squareRecording/squareRecording.rpc'));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x39')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require('../api/campaign/campaign.rpc'));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require('../api/attachment/attachment.rpc'));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require('../api/plugin/plugin.rpc'));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x3a')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x3b')));_0x5e5010=_[_0x249b('0x5')](_0x5e5010,require(_0x249b('0x3c')));var _0x590bdf=jayson[_0x249b('0x3d')](_0x5e5010)[_0x249b('0x3e')]();var _0x2cb9c6=config[_0x249b('0x3f')]['port']||config[_0x249b('0x40')]+0x1;var _0x132973=config['rpc']['ip']||_0x249b('0x41');_0x590bdf['on']('error',function(_0x17cd2f){return _0x47bd0e(_0x17cd2f);});_0x590bdf['listen'](_0x2cb9c6,_0x132973,function(){console[_0x249b('0x42')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x132973,_0x2cb9c6);require(_0x249b('0x43'))['default']();return _0x153958(_0x249b('0x44')+_0x132973+':'+_0x2cb9c6);});});}; \ No newline at end of file +var _0x5887=['../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.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/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','listen','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc'];(function(_0x1313c3,_0x553f2d){var _0x448a82=function(_0x181908){while(--_0x181908){_0x1313c3['push'](_0x1313c3['shift']());}};_0x448a82(++_0x553f2d);}(_0x5887,0xb5));var _0x7588=function(_0x784d87,_0x4f0284){_0x784d87=_0x784d87-0x0;var _0x22e453=_0x5887[_0x784d87];return _0x22e453;};'use strict';var jayson=require(_0x7588('0x0'));var BPromise=require(_0x7588('0x1'));var _=require('lodash');var config=require('../config/environment');exports[_0x7588('0x2')]=function(){return new BPromise(function(_0x457ee4,_0x308216){var _0x5e509b={};_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/user/user.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/voiceExtension/voiceExtension.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/voiceQueue/voiceQueue.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x4')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x5')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x6')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x7')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x8')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x9')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0xa')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0xb')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0xc')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/mailQueue/mailQueue.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0xd')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/mailMessage/mailMessage.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0xe')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0xf')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x10')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x11')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x12')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/faxMessage/faxMessage.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x13')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x14')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x15')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x16')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x17')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x18')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x19')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x1a')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x1b')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x1c')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x1d')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x1e')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/cmContact/cmContact.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x1f')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x20')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x21')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x22')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x23')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x24')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x25')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/sound/sound.rpc'));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x26')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x27')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x28')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x29')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x2a')));_0x5e509b=_['merge'](_0x5e509b,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x2b')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x2c')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x2d')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x2e')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x2f')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x30')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x31')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x32')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x33')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/squareProject/squareProject.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x34')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x35')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x36')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x37')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x38')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x39')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x3a')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x3b')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x3c')));var _0x12f099=jayson[_0x7588('0x3d')](_0x5e509b)['http']();var _0x525b87=config[_0x7588('0x3e')]['port']||config[_0x7588('0x3f')]+0x1;var _0x22f4ca=config[_0x7588('0x3e')]['ip']||'localhost';_0x12f099['on'](_0x7588('0x40'),function(_0x46d1b6){return _0x308216(_0x46d1b6);});_0x12f099['listen'](_0x525b87,_0x22f4ca,function(){console[_0x7588('0x41')](_0x7588('0x42'),_0x22f4ca,_0x525b87);require(_0x7588('0x43'))[_0x7588('0x44')]();return _0x457ee4(_0x7588('0x45')+_0x22f4ca+':'+_0x525b87);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 9879316..80785f4 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 _0x679f=['prototype','sync','answer','sendRequest','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','log','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','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','util','events','EventEmitter','./error','call','setEncoding','utf8','setTimeout','emit','ready','line','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','command=','write','inherits'];(function(_0x403db1,_0x59018e){var _0x47c48f=function(_0x1b663c){while(--_0x1b663c){_0x403db1['push'](_0x403db1['shift']());}};_0x47c48f(++_0x59018e);}(_0x679f,0xd3));var _0xf679=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x679f[_0x40a045];return _0x1a687c;};'use strict';var util=require(_0xf679('0x0'));var _=require('lodash');var EventEmitter=require(_0xf679('0x1'))[_0xf679('0x2')];var AGIReply=require('./reply');var AGIError=require(_0xf679('0x3'));function AGIChannel(_0x43e3b5){var _0x4e0a69=this,_0xaa9c94=new AGIReply(),_0x56bec1=![],_0x2296d7={};EventEmitter[_0xf679('0x4')](_0x4e0a69);_0x43e3b5[_0xf679('0x5')](_0xf679('0x6'));_0x43e3b5[_0xf679('0x7')](0x8*0x3c*0x3c*0x3e8);_0xaa9c94[_0xf679('0x5')](_0xf679('0x6'));_0xaa9c94['on']('headers',function(_0x39c87d){for(var _0x5132b9 in _0x39c87d){_0x4e0a69[_0x5132b9]=_0x39c87d[_0x5132b9];}_0x4e0a69[_0xf679('0x8')](_0xf679('0x9'));});_0xaa9c94['on'](_0xf679('0xa'),function(_0x47e991){if(_0x47e991['toLowerCase']()==_0xf679('0xb')){_0x4e0a69[_0xf679('0x8')]('hangup');return;}if(_0x47e991[_0xf679('0xc')](0x0,0xb)=='520-Invalid'){_0x56bec1=!![];}if(_0x56bec1){_0x2296d7['rx']+=_0x47e991+'\x0a';if(_0x47e991[_0xf679('0xd')](_0xf679('0xe'))!=-0x1){_0x56bec1=![];}}else{_0x2296d7['rx']=_0x47e991;}if(_0x56bec1){return;}if(typeof _0x2296d7['cb']==_0xf679('0xf')){var _0x56aafd=_0x2296d7['rx'][_0xf679('0xc')](0x0,0x3),_0x3e1eb5=null,_0xf5e510=null;_0x56aafd=parseInt(_0x56aafd);if(isNaN(_0x56aafd)){_0x2296d7['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xf679('0x10')});return;}if(_0x56aafd!=0xc8){_0x2296d7['cb'](null,{'code':_0x56aafd,'result':-0x1,'extra':'KO'});return;}_0x3e1eb5=_0x2296d7['rx'][_0xf679('0xc')](0x4)['replace']('result=','');if(_0x3e1eb5[_0xf679('0x11')]('\x20')!=-0x1){_0x3e1eb5=_0x3e1eb5[_0xf679('0x12')](0x0,_0x3e1eb5['indexOf']('\x20'));}if(_[_0xf679('0x13')](_0x3e1eb5,'-1')){_0x3e1eb5=parseInt(_0x3e1eb5);}_0xf5e510=_0x2296d7['rx'][_0xf679('0x14')]('\x20');if(_0xf5e510[_0xf679('0x15')]==0x3){_0xf5e510=_0xf5e510[0x2][_0xf679('0xc')](0x1,_0xf5e510[0x2]['length']-0x1);}else if(_0xf5e510[_0xf679('0x15')]>0x3){var _0x54b5e6=/\((.+)\)/;var _0x52e658=_0x2296d7['rx']['match'](_0x54b5e6);if(_0x52e658){_0xf5e510=_0x52e658[0x1];}else{_0xf5e510=null;}}else{_0xf5e510=null;}_0x2296d7['cb'](null,{'code':_0x56aafd,'result':_0x3e1eb5,'extra':_0xf5e510});}});_0x43e3b5['on'](_0xf679('0x16'),function(_0x4253e5){_0x4e0a69[_0xf679('0x8')](_0xf679('0x16'),new AGIError(_0xf679('0x17'),_0x4253e5[_0xf679('0x18')]));});_0x43e3b5['on'](_0xf679('0x19'),function(){_0x4e0a69[_0xf679('0x8')](_0xf679('0x19'),new AGIError(_0xf679('0x1a')));});_0x43e3b5['on'](_0xf679('0x1b'),function(){_0x4e0a69[_0xf679('0x8')](_0xf679('0x1b'),new AGIError(_0xf679('0x1c')));_0x43e3b5[_0xf679('0x1d')]();});_0x43e3b5[_0xf679('0x1e')](_0xaa9c94);this[_0xf679('0x1f')]=function(_0x328870,_0x2b6ed5){console['log'](_0xf679('0x20'),_0x328870);var _0x328870=_0x328870||'',_0x2b6ed5=typeof _0x2b6ed5==_0xf679('0xf')?_0x2b6ed5:new Function();_0x2296d7={'tx':_0x328870,'rx':'','cb':_0x2b6ed5};_0x43e3b5[_0xf679('0x21')](_0x328870+'\x0a');},this[_0xf679('0x19')]=function(){_0x43e3b5[_0xf679('0x1d')]();};}util[_0xf679('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xf679('0x23')]['sendRequest']=function(_0x139bb7){return this[_0xf679('0x1f')][_0xf679('0x24')](this,_0x139bb7);};AGIChannel[_0xf679('0x23')][_0xf679('0x25')]=function(){return this[_0xf679('0x26')](_0xf679('0x27'));};AGIChannel['prototype']['getData']=function(_0x3ba0c3,_0x214423,_0x53dd1f){_0x3ba0c3=_0x3ba0c3===undefined?_0xf679('0x28'):_0x3ba0c3;_0x214423=_0x214423===undefined?'5':_0x214423;_0x53dd1f=_0x53dd1f===undefined?'1':_0x53dd1f;return this['sendRequest'](util[_0xf679('0x29')](_0xf679('0x2a'),_0x3ba0c3,_0x214423*0x3e8,_0x53dd1f));};AGIChannel['prototype']['noop']=function(_0x507047){_0x507047=_0x507047||_0xf679('0x2b');return this[_0xf679('0x26')](util[_0xf679('0x29')]('VERBOSE\x20\x22%s\x22',_0x507047));};AGIChannel['prototype'][_0xf679('0x2c')]=function(_0x380367,_0x5aeecb){if(_['isArray'](_0x5aeecb)){return this[_0xf679('0x26')](util[_0xf679('0x29')](_0xf679('0x2d'),_0x380367,_0x5aeecb[_0xf679('0x2e')](',')));}return this[_0xf679('0x26')](util[_0xf679('0x29')](_0xf679('0x2d'),_0x380367,_0x5aeecb));};AGIChannel[_0xf679('0x23')][_0xf679('0x2f')]=function(_0x52af66){return this[_0xf679('0x26')](util[_0xf679('0x29')](_0xf679('0x30'),_0x52af66));};AGIChannel['prototype'][_0xf679('0x31')]=function(_0x587560){return this[_0xf679('0x26')](util[_0xf679('0x29')](_0xf679('0x32'),_0x587560));};AGIChannel[_0xf679('0x23')][_0xf679('0x33')]=function(_0x4605c0){return this[_0xf679('0x26')](util[_0xf679('0x29')](_0xf679('0x34'),_0x4605c0));};AGIChannel[_0xf679('0x23')][_0xf679('0xb')]=function(){return this[_0xf679('0x26')](_0xf679('0x35'));};AGIChannel[_0xf679('0x23')]['setVariable']=function(_0x1c640f,_0x2fffc4){var _0xbd697d=_[_0xf679('0x36')](_0x2fffc4)||_[_0xf679('0x37')](_0x2fffc4)?_0x2fffc4[_0xf679('0x38')]():_0x2fffc4;return this[_0xf679('0x26')](util[_0xf679('0x29')](_0xf679('0x39'),_0x1c640f,_0xbd697d?_0xbd697d[_0xf679('0x38')]()[_0xf679('0x3a')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xf679('0x23')][_0xf679('0x3b')]=function(_0x1c54b3,_0x288169){return this['sendRequest'](util[_0xf679('0x29')]('SAY\x20NUMBER\x20%s\x20%s',_0x1c54b3,_0x288169));};AGIChannel[_0xf679('0x23')][_0xf679('0x3c')]=function(_0x2f5273,_0x418934){return this[_0xf679('0x26')](util[_0xf679('0x29')](_0xf679('0x3d'),_0x2f5273,_0x418934));};AGIChannel[_0xf679('0x23')][_0xf679('0x3e')]=function(_0x48e282,_0x374d7b){return this['sendRequest'](util[_0xf679('0x29')](_0xf679('0x3f'),_0x48e282,_0x374d7b));};AGIChannel[_0xf679('0x23')][_0xf679('0x40')]=function(_0x45154d,_0x9078b9,_0xd2eef8){_0x9078b9=_0x9078b9||this[_0xf679('0x41')];_0xd2eef8=_0xd2eef8||0x1;this[_0xf679('0x2f')](_0x45154d);this[_0xf679('0x31')](_0x9078b9);this[_0xf679('0x33')](_0xd2eef8);return this['noop'](util[_0xf679('0x29')](_0xf679('0x42'),_0x45154d,_0x9078b9,_0xd2eef8));};AGIChannel[_0xf679('0x23')][_0xf679('0x43')]=function(_0x56ca18){console[_0xf679('0x44')](_0xf679('0x45'),_0x56ca18);return this['sendRequest'](util[_0xf679('0x29')](_0xf679('0x46'),_0x56ca18));};AGIChannel[_0xf679('0x23')][_0xf679('0x47')]=function(_0x5343a6,_0x238ac0,_0x57d189,_0x2fd6f2,_0x390fb9,_0xb92ce9){_0x238ac0=_0x238ac0||_0xf679('0x48');_0x57d189=_0x57d189||'';_0x2fd6f2=_0x2fd6f2===undefined?-0x1:_0x2fd6f2==='-1'?-0x1:_0x2fd6f2*0x3e8;_0x390fb9=_0x390fb9===undefined?'':'s='+_0x390fb9;_0xb92ce9=_0xb92ce9?_0xf679('0x49'):'';return this[_0xf679('0x26')](util['format'](_0xf679('0x4a'),_0x5343a6,_0x238ac0,_0x57d189,_0x2fd6f2,_0xb92ce9,_0x390fb9));};AGIChannel['prototype']['streamFile']=function(_0x5c275a,_0x67f8){_0x67f8=_0x67f8||'';return this['sendRequest'](util[_0xf679('0x29')](_0xf679('0x4b'),_0x5c275a,_0x67f8));};AGIChannel[_0xf679('0x23')][_0xf679('0x4c')]=function(_0x5c2468){return this[_0xf679('0x2c')]('AGI',_0x5c2468);};AGIChannel[_0xf679('0x23')][_0xf679('0x4d')]=function(_0x4d7c56){return this[_0xf679('0x2c')](_0xf679('0x4e'),_0x4d7c56);};AGIChannel['prototype'][_0xf679('0x16')]=function(_0x1cddc9,_0xae9d62){this[_0xf679('0x4f')](util[_0xf679('0x29')](_0xf679('0x50'),_0x1cddc9['id'],_0x1cddc9[_0xf679('0x51')],_0xae9d62));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x216b=['noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','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','label','util','lodash','events','./reply','./error','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','emit','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','log','command=','close','inherits','prototype','sendRequest','command','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s'];(function(_0x1ceb6e,_0x4d6d50){var _0x1987d3=function(_0x113b78){while(--_0x113b78){_0x1ceb6e['push'](_0x1ceb6e['shift']());}};_0x1987d3(++_0x4d6d50);}(_0x216b,0x174));var _0xb216=function(_0x59c207,_0x8ff66e){_0x59c207=_0x59c207-0x0;var _0x82d8db=_0x216b[_0x59c207];return _0x82d8db;};'use strict';var util=require(_0xb216('0x0'));var _=require(_0xb216('0x1'));var EventEmitter=require(_0xb216('0x2'))['EventEmitter'];var AGIReply=require(_0xb216('0x3'));var AGIError=require(_0xb216('0x4'));function AGIChannel(_0x29b8ef){var _0x257d84=this,_0x155a40=new AGIReply(),_0xbc069=![],_0x4c9687={};EventEmitter['call'](_0x257d84);_0x29b8ef[_0xb216('0x5')](_0xb216('0x6'));_0x29b8ef[_0xb216('0x7')](0x8*0x3c*0x3c*0x3e8);_0x155a40[_0xb216('0x5')](_0xb216('0x6'));_0x155a40['on'](_0xb216('0x8'),function(_0x54baec){for(var _0x383e09 in _0x54baec){_0x257d84[_0x383e09]=_0x54baec[_0x383e09];}_0x257d84['emit'](_0xb216('0x9'));});_0x155a40['on'](_0xb216('0xa'),function(_0x391d75){if(_0x391d75[_0xb216('0xb')]()=='hangup'){_0x257d84['emit']('hangup');return;}if(_0x391d75[_0xb216('0xc')](0x0,0xb)==_0xb216('0xd')){_0xbc069=!![];}if(_0xbc069){_0x4c9687['rx']+=_0x391d75+'\x0a';if(_0x391d75[_0xb216('0xe')](_0xb216('0xf'))!=-0x1){_0xbc069=![];}}else{_0x4c9687['rx']=_0x391d75;}if(_0xbc069){return;}if(typeof _0x4c9687['cb']==_0xb216('0x10')){var _0x3ae0fd=_0x4c9687['rx']['substring'](0x0,0x3),_0x26695f=null,_0xbdabbe=null;_0x3ae0fd=parseInt(_0x3ae0fd);if(isNaN(_0x3ae0fd)){_0x4c9687['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xb216('0x11')});return;}if(_0x3ae0fd!=0xc8){_0x4c9687['cb'](null,{'code':_0x3ae0fd,'result':-0x1,'extra':'KO'});return;}_0x26695f=_0x4c9687['rx']['substring'](0x4)[_0xb216('0x12')]('result=','');if(_0x26695f[_0xb216('0x13')]('\x20')!=-0x1){_0x26695f=_0x26695f[_0xb216('0x14')](0x0,_0x26695f['indexOf']('\x20'));}if(_[_0xb216('0x15')](_0x26695f,'-1')){_0x26695f=parseInt(_0x26695f);}_0xbdabbe=_0x4c9687['rx'][_0xb216('0x16')]('\x20');if(_0xbdabbe[_0xb216('0x17')]==0x3){_0xbdabbe=_0xbdabbe[0x2][_0xb216('0xc')](0x1,_0xbdabbe[0x2][_0xb216('0x17')]-0x1);}else if(_0xbdabbe[_0xb216('0x17')]>0x3){var _0x4ad104=/\((.+)\)/;var _0x400fe3=_0x4c9687['rx'][_0xb216('0x18')](_0x4ad104);if(_0x400fe3){_0xbdabbe=_0x400fe3[0x1];}else{_0xbdabbe=null;}}else{_0xbdabbe=null;}_0x4c9687['cb'](null,{'code':_0x3ae0fd,'result':_0x26695f,'extra':_0xbdabbe});}});_0x29b8ef['on'](_0xb216('0x19'),function(_0x824601){_0x257d84[_0xb216('0x1a')](_0xb216('0x19'),new AGIError(_0xb216('0x1b'),_0x824601[_0xb216('0x1c')]));});_0x29b8ef['on']('close',function(){_0x257d84['emit']('close',new AGIError(_0xb216('0x1d')));});_0x29b8ef['on'](_0xb216('0x1e'),function(){_0x257d84[_0xb216('0x1a')](_0xb216('0x1e'),new AGIError(_0xb216('0x1f')));_0x29b8ef[_0xb216('0x20')]();});_0x29b8ef[_0xb216('0x21')](_0x155a40);this['command']=function(_0x3c7307,_0x3edd80){console[_0xb216('0x22')](_0xb216('0x23'),_0x3c7307);var _0x3c7307=_0x3c7307||'',_0x3edd80=typeof _0x3edd80=='function'?_0x3edd80:new Function();_0x4c9687={'tx':_0x3c7307,'rx':'','cb':_0x3edd80};_0x29b8ef['write'](_0x3c7307+'\x0a');},this[_0xb216('0x24')]=function(){_0x29b8ef[_0xb216('0x20')]();};}util[_0xb216('0x25')](AGIChannel,EventEmitter);AGIChannel[_0xb216('0x26')][_0xb216('0x27')]=function(_0x1a7af8){return this[_0xb216('0x28')][_0xb216('0x29')](this,_0x1a7af8);};AGIChannel[_0xb216('0x26')][_0xb216('0x2a')]=function(){return this[_0xb216('0x27')](_0xb216('0x2b'));};AGIChannel[_0xb216('0x26')][_0xb216('0x2c')]=function(_0xc5b550,_0x152a63,_0x5ee769){_0xc5b550=_0xc5b550===undefined?_0xb216('0x2d'):_0xc5b550;_0x152a63=_0x152a63===undefined?'5':_0x152a63;_0x5ee769=_0x5ee769===undefined?'1':_0x5ee769;return this[_0xb216('0x27')](util[_0xb216('0x2e')](_0xb216('0x2f'),_0xc5b550,_0x152a63*0x3e8,_0x5ee769));};AGIChannel[_0xb216('0x26')][_0xb216('0x30')]=function(_0xadf9a9){_0xadf9a9=_0xadf9a9||_0xb216('0x31');return this[_0xb216('0x27')](util['format'](_0xb216('0x32'),_0xadf9a9));};AGIChannel[_0xb216('0x26')][_0xb216('0x33')]=function(_0x22e109,_0x23fda2){if(_[_0xb216('0x34')](_0x23fda2)){return this['sendRequest'](util['format'](_0xb216('0x35'),_0x22e109,_0x23fda2[_0xb216('0x36')](',')));}return this['sendRequest'](util[_0xb216('0x2e')](_0xb216('0x35'),_0x22e109,_0x23fda2));};AGIChannel[_0xb216('0x26')][_0xb216('0x37')]=function(_0x4933ab){return this['sendRequest'](util[_0xb216('0x2e')]('SET\x20CONTEXT\x20%s',_0x4933ab));};AGIChannel['prototype'][_0xb216('0x38')]=function(_0x3a8c19){return this['sendRequest'](util['format'](_0xb216('0x39'),_0x3a8c19));};AGIChannel[_0xb216('0x26')]['setPriority']=function(_0x139832){return this[_0xb216('0x27')](util[_0xb216('0x2e')]('SET\x20PRIORITY\x20%s',_0x139832));};AGIChannel[_0xb216('0x26')]['hangup']=function(){return this[_0xb216('0x27')](_0xb216('0x3a'));};AGIChannel[_0xb216('0x26')][_0xb216('0x3b')]=function(_0x3747ef,_0x1c88c2){var _0x19b298=_['isBoolean'](_0x1c88c2)||_[_0xb216('0x3c')](_0x1c88c2)?_0x1c88c2[_0xb216('0x3d')]():_0x1c88c2;return this[_0xb216('0x27')](util[_0xb216('0x2e')](_0xb216('0x3e'),_0x3747ef,_0x19b298?_0x19b298[_0xb216('0x3d')]()[_0xb216('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xb216('0x26')][_0xb216('0x3f')]=function(_0x88a489,_0x550de9){return this[_0xb216('0x27')](util[_0xb216('0x2e')](_0xb216('0x40'),_0x88a489,_0x550de9));};AGIChannel[_0xb216('0x26')][_0xb216('0x41')]=function(_0x2db804,_0x5d0b2b){return this['sendRequest'](util['format'](_0xb216('0x42'),_0x2db804,_0x5d0b2b));};AGIChannel[_0xb216('0x26')][_0xb216('0x43')]=function(_0x377000,_0x342af6){return this['sendRequest'](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x377000,_0x342af6));};AGIChannel[_0xb216('0x26')][_0xb216('0x44')]=function(_0x4d3b90,_0x5a4826,_0x266760){_0x5a4826=_0x5a4826||this[_0xb216('0x45')];_0x266760=_0x266760||0x1;this['setContext'](_0x4d3b90);this[_0xb216('0x38')](_0x5a4826);this[_0xb216('0x46')](_0x266760);return this[_0xb216('0x30')](util[_0xb216('0x2e')](_0xb216('0x47'),_0x4d3b90,_0x5a4826,_0x266760));};AGIChannel[_0xb216('0x26')][_0xb216('0x48')]=function(_0x5eb418){console[_0xb216('0x22')](_0xb216('0x49'),_0x5eb418);return this[_0xb216('0x27')](util[_0xb216('0x2e')](_0xb216('0x4a'),_0x5eb418));};AGIChannel['prototype']['recordFile']=function(_0x5a3b45,_0x517ec1,_0x40127e,_0xd6d3da,_0x260b40,_0x4ff5e8){_0x517ec1=_0x517ec1||_0xb216('0x4b');_0x40127e=_0x40127e||'';_0xd6d3da=_0xd6d3da===undefined?-0x1:_0xd6d3da==='-1'?-0x1:_0xd6d3da*0x3e8;_0x260b40=_0x260b40===undefined?'':'s='+_0x260b40;_0x4ff5e8=_0x4ff5e8?_0xb216('0x4c'):'';return this[_0xb216('0x27')](util['format'](_0xb216('0x4d'),_0x5a3b45,_0x517ec1,_0x40127e,_0xd6d3da,_0x4ff5e8,_0x260b40));};AGIChannel[_0xb216('0x26')][_0xb216('0x4e')]=function(_0x5a0a41,_0x52cc7f){_0x52cc7f=_0x52cc7f||'';return this['sendRequest'](util[_0xb216('0x2e')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x5a0a41,_0x52cc7f));};AGIChannel[_0xb216('0x26')][_0xb216('0x4f')]=function(_0x3cb3af){return this[_0xb216('0x33')](_0xb216('0x50'),_0x3cb3af);};AGIChannel['prototype'][_0xb216('0x51')]=function(_0x50d5e0){return this[_0xb216('0x33')](_0xb216('0x52'),_0x50d5e0);};AGIChannel['prototype'][_0xb216('0x19')]=function(_0x3be047,_0x13bda5){this[_0xb216('0x30')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x3be047['id'],_0x3be047[_0xb216('0x53')],_0x13bda5));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index db63a32..9a53c3a 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 _0x046b=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','message','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x46800d,_0x588500){var _0x3824cd=function(_0x14b132){while(--_0x14b132){_0x46800d['push'](_0x46800d['shift']());}};_0x3824cd(++_0x588500);}(_0x046b,0x147));var _0xb046=function(_0x5e9432,_0x3d2847){_0x5e9432=_0x5e9432-0x0;var _0x2ac412=_0x046b[_0x5e9432];return _0x2ac412;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xb046('0x0'),'E_AGI_ARGUMENT_PORT':_0xb046('0x1'),'E_AGI_SERVER_ERROR':_0xb046('0x2'),'E_AGI_SERVER_CLOSE':_0xb046('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xb046('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xb046('0x5'),'E_AGI_SOCKET_CLOSE':_0xb046('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xb046('0x7'),'E_AGI_COMMAND_EMPTY':_0xb046('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xb046('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x5c06b5){var _0x5c06b5=_0x5c06b5||null,_0x1f00c8=_0x1f00c8||[],_0x190c9a=0x1,_0x308e79='';if(!error[_0x5c06b5]){_0x5c06b5=_0xb046('0xa');}_0x1f00c8[_0xb046('0xb')](error[_0x5c06b5]);while(arguments[_0x190c9a]){_0x1f00c8[_0xb046('0xb')](arguments[_0x190c9a]);_0x190c9a++;}_0x308e79=util[_0xb046('0xc')]['apply'](util,_0x1f00c8);this[_0xb046('0xd')]=_0x308e79;this['name']=_0x5c06b5;}module[_0xb046('0xe')]=AGIError; \ No newline at end of file +var _0x4fef=['Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','util'];(function(_0x1ca396,_0x56772a){var _0x1650c4=function(_0x19c9c2){while(--_0x19c9c2){_0x1ca396['push'](_0x1ca396['shift']());}};_0x1650c4(++_0x56772a);}(_0x4fef,0x10f));var _0xf4fe=function(_0x988535,_0x13675b){_0x988535=_0x988535-0x0;var _0x3ce528=_0x4fef[_0x988535];return _0x3ce528;};'use strict';var util=require(_0xf4fe('0x0'));var error={'E_AGI_UNDEFINED':_0xf4fe('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xf4fe('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xf4fe('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xf4fe('0x4'),'E_AGI_SOCKET_ERROR':_0xf4fe('0x5'),'E_AGI_SOCKET_CLOSE':_0xf4fe('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xf4fe('0x7'),'E_AGI_COMMAND_EMPTY':_0xf4fe('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xf4fe('0x9'),'E_AGI_IVR_ENTRY':_0xf4fe('0xa')};function AGIError(_0x522427){var _0x522427=_0x522427||null,_0x3e844d=_0x3e844d||[],_0x4805b0=0x1,_0x23b761='';if(!error[_0x522427]){_0x522427=_0xf4fe('0xb');}_0x3e844d[_0xf4fe('0xc')](error[_0x522427]);while(arguments[_0x4805b0]){_0x3e844d[_0xf4fe('0xc')](arguments[_0x4805b0]);_0x4805b0++;}_0x23b761=util[_0xf4fe('0xd')][_0xf4fe('0xe')](util,_0x3e844d);this[_0xf4fe('0xf')]=_0x23b761;this[_0xf4fe('0x10')]=_0x522427;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 9e4b020..0c402ec 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 _0x8a5c=['addVertex','prototype','addEdge','push','size','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','default','target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges'];(function(_0x50314e,_0x18941c){var _0x2e93e6=function(_0x2383ca){while(--_0x2383ca){_0x50314e['push'](_0x50314e['shift']());}};_0x2e93e6(++_0x18941c);}(_0x8a5c,0x136));var _0xc8a5=function(_0x913740,_0x42dfc1){_0x913740=_0x913740-0x0;var _0x392c11=_0x8a5c[_0x913740];return _0x392c11;};'use strict';var _=require(_0xc8a5('0x0'));var logger=require(_0xc8a5('0x1'))(_0xc8a5('0x2'));var verticesWithRetry=[_0xc8a5('0x3'),_0xc8a5('0x4'),_0xc8a5('0x5')];var Graph=function(){this[_0xc8a5('0x6')]={};this[_0xc8a5('0x7')]={};this[_0xc8a5('0x8')]=0x0;};Graph['prototype'][_0xc8a5('0x9')]=function(_0x66b54){this['vertices'][_0x66b54['id']]=_0x66b54;this[_0xc8a5('0x7')][_0x66b54['id']]=[];};Graph[_0xc8a5('0xa')][_0xc8a5('0xb')]=function(_0xa9f42c,_0x4d25e4,_0x3ecf08){this[_0xc8a5('0x7')][_0xa9f42c][_0xc8a5('0xc')]({'target':_0x4d25e4,'condition':_0x3ecf08});this[_0xc8a5('0x8')]+=0x1;};Graph[_0xc8a5('0xa')][_0xc8a5('0xd')]=function(){return _[_0xc8a5('0xd')](this[_0xc8a5('0x6')]);};Graph[_0xc8a5('0xa')]['relations']=function(){return this['numberOfEdges'];};Graph[_0xc8a5('0xa')]['getVertex']=function(_0xaa6fa2){return this[_0xc8a5('0x6')][_0xaa6fa2];};Graph[_0xc8a5('0xa')][_0xc8a5('0xe')]=function(_0x3e1b4f,_0x5c9d13){if(!this[_0xc8a5('0x6')][_0x3e1b4f]){return logger[_0xc8a5('0xf')]('no\x20vertex\x20found');}var _0x29aada=_0x5c9d13(this[_0xc8a5('0x6')][_0x3e1b4f]);if(!_0x29aada){return logger[_0xc8a5('0xf')](_0xc8a5('0x10'));}if(this[_0xc8a5('0x7')][_0x3e1b4f][_0xc8a5('0x11')]===0x0){return logger['info'](_0xc8a5('0x12'));}for(var _0x44d436=0x0,_0x5cb7ff=[],_0x36a78b=![];_0x44d436\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','log','SQUAREROOT','start','debug','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','vertices','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','vresponse','response','code','result','evtHangup','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','lodash','moment','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','toJson'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x7462,0x165));var _0x2746=function(_0x152678,_0x11e0ac){_0x152678=_0x152678-0x0;var _0x311a9=_0x7462[_0x152678];return _0x311a9;};'use strict';var parser=require(_0x2746('0x0'));var _=require(_0x2746('0x1'));var syncho=require('syncho');var util=require('util');var moment=require(_0x2746('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x2746('0x3'));var utilLicense=require(_0x2746('0x4'));var rpc=require('./rpc');var mailRpc=require(_0x2746('0x5'));var Graph=require(_0x2746('0x6'));var Vertices=require(_0x2746('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x2746('0x3')]=_[_0x2746('0x8')](config[_0x2746('0x3')],{'ip':_0x2746('0x9'),'port':0x11dd});function connectionHandler(_0x40ad2b){process[_0x2746('0xa')](function(){syncho(function(){try{setChannelVariables(_0x40ad2b);agiHandler(_0x40ad2b);}catch(_0x4ea43e){logger[_0x2746('0xb')](_0x4ea43e[_0x2746('0xc')]);}});});}function listeningHandler(){console['log'](_0x2746('0xd'),config[_0x2746('0x3')][_0x2746('0xe')]);logger['info'](util[_0x2746('0xf')](_0x2746('0x10'),config[_0x2746('0x3')]['ip'],config[_0x2746('0x3')][_0x2746('0xe')]));}function errorHandler(_0x1fbbc7){if(_0x1fbbc7&&_0x1fbbc7[_0x2746('0x11')]&&_0x1fbbc7[_0x2746('0x12')]){logger[_0x2746('0xb')](util[_0x2746('0xf')](_0x2746('0x13'),_0x1fbbc7['name'],_0x1fbbc7['message']));}else{logger[_0x2746('0xb')](util[_0x2746('0xf')](_0x2746('0x14'),_0x1fbbc7[_0x2746('0xc')]));}}function closeHandler(){logger['info'](util[_0x2746('0xf')](_0x2746('0x15'),this['arg_1'],this['calleridname'],this[_0x2746('0x16')],this[_0x2746('0x17')],this[_0x2746('0x18')]));try{createSquareReport(this);}catch(_0x407d46){logger[_0x2746('0xb')](_0x407d46[_0x2746('0xc')]);}}function timeoutHandler(){logger[_0x2746('0x19')](util[_0x2746('0xf')](_0x2746('0x1a'),this['arg_1'],this[_0x2746('0x1b')],this['callerid'],this[_0x2746('0x17')],this[_0x2746('0x18')]));}function hangupHandler(){logger[_0x2746('0x19')](util[_0x2746('0xf')](_0x2746('0x1c'),this[_0x2746('0x1d')],this[_0x2746('0x1b')],this[_0x2746('0x16')],this[_0x2746('0x17')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x7390b3){return parser[_0x2746('0x1e')](_0x7390b3,{'object':!![]})[_0x2746('0x1f')]['root'];}function addVertex(_0x24b9c5,_0xf97651,_0x55fe95){_0xf97651[_0x2746('0x20')]=_0x55fe95;if(_0xf97651['hasOwnProperty']('retry')){_0xf97651['maxRetry']=parseInt(_0xf97651['retry'],0xa);}_0x24b9c5[_0x2746('0x21')](_[_0x2746('0x22')](_0xf97651,'mxCell'));}function initGraph(_0x382924,_0x592680){var _0x102002=new Graph();for(var _0x150cc8 in _0x382924){if(_0x382924[_0x2746('0x23')](_0x150cc8)){if(_[_0x2746('0x24')](_0x382924[_0x150cc8])){for(var _0x19017f=0x0;_0x19017f<_0x382924[_0x150cc8][_0x2746('0x25')];_0x19017f+=0x1){addVertex(_0x102002,_0x382924[_0x150cc8][_0x19017f],_0x150cc8);}}else{addVertex(_0x102002,_0x382924[_0x150cc8],_0x150cc8);}}}for(var _0x2b074f=0x0;_0x2b074f<_0x592680[_0x2746('0x25')];_0x2b074f+=0x1){if(_0x592680[_0x2b074f]['source']&&_0x592680[_0x2b074f][_0x2746('0x26')]){_0x102002[_0x2746('0x27')](_0x592680[_0x2b074f]['source'],_0x592680[_0x2b074f]['target'],_0x592680[_0x2b074f]['value']);}}return _0x102002;}function getSquareProject(_0x570de3,_0x539eb5){rpc[_0x2746('0x28')](_0x570de3)[_0x2746('0x29')](function(_0x4b4e0f){_0x539eb5(null,_0x4b4e0f);})['catch'](function(_0x44e985){_0x539eb5(null,_0x44e985);});}function createSquareReport(_0x17f7bf,_0x5d05a2){rpc[_0x2746('0x2a')](_0x17f7bf)[_0x2746('0x29')](function(_0x537912){if(_0x5d05a2){_0x5d05a2(null,_0x537912);}})[_0x2746('0x2b')](function(_0x5b6cd3){if(_0x5d05a2){_0x5d05a2(null,_0x5b6cd3);}});}function setChannelVariables(_0x53a40b){for(var _0x295799 in _0x53a40b){if(_0x53a40b[_0x2746('0x23')](_0x295799)){if(_0x295799[_0x2746('0x2c')](_0x2746('0x2d'))===0x0){_0x53a40b[_0x295799['substring'](0x4)]=_0x53a40b[_0x295799];delete _0x53a40b[_0x295799];}}}}function getLogFromObject(_0x327a55){return util[_0x2746('0x2e')](_0x327a55,{'showHidden':![],'depth':null});}function agiHandler(_0x2351f5){var _0x30f232,_0xa34ab3,_0x16f426,_0x2f96dd,_0x1b840d;logger['debug'](_0x2746('0x2f'),JSON[_0x2746('0x30')](_0x2351f5,null,0x2));logger[_0x2746('0x19')](util[_0x2746('0xf')](_0x2746('0x31'),_0x2351f5[_0x2746('0x1d')],_0x2351f5['calleridname'],_0x2351f5['callerid'],_0x2351f5[_0x2746('0x17')],_0x2351f5[_0x2746('0x18')]));_0x2351f5['on'](_0x2746('0xb'),errorHandler);_0x2351f5['on'](_0x2746('0x32'),closeHandler);_0x2351f5['on'](_0x2746('0x33'),timeoutHandler);_0x2351f5['evtHangup']=![];_0x2351f5['on'](_0x2746('0x34'),hangupHandler);var _0x11be2a=getSquareProject[_0x2746('0x35')](null,_0x2351f5[_0x2746('0x1d')]);if(_0x11be2a){if(_0x11be2a[_0x2746('0x36')]){_0x30f232=getRoot(_0x11be2a[_0x2746('0x36')]);console[_0x2746('0x37')](_0x2746('0x38'),_0x30f232);if(_0x30f232&&_0x30f232[_0x2746('0x39')]){logger[_0x2746('0x3a')](_0x2746('0x3b'),JSON[_0x2746('0x30')](_0x30f232,null,0x2));_0x2351f5[_0x2746('0x3c')]=moment()['format'](_0x2746('0x3d'));_0xa34ab3=initGraph(_[_0x2746('0x22')](_0x30f232,_0x2746('0x3e')),_0x30f232[_0x2746('0x3e')]);_0x16f426=new Vertices(_0x2351f5,rpc,mailRpc);console[_0x2746('0x37')](_0x2746('0x3f'),_0x16f426);logger[_0x2746('0x19')](util[_0x2746('0xf')](_0x2746('0x40'),_0x2351f5['arg_1'],_0x2351f5[_0x2746('0x1b')],_0x2351f5[_0x2746('0x16')],_0x2351f5[_0x2746('0x17')],_0x2351f5[_0x2746('0x18')]));console['log'](_0x2746('0x41'));_0xa34ab3[_0x2746('0x42')](_0x30f232['start']['id'],function(_0x39b608){try{_0x39b608=_0x16f426[_0x2746('0x43')](_0x39b608);logger['debug']('vertex',JSON[_0x2746('0x30')](_0x39b608,null,0x2));console['log']('VERTEX',_0x39b608);if(_0x39b608[_0x2746('0x20')]===_0x2746('0x44')){logger[_0x2746('0x19')](_0x2746('0x45'));_0x2351f5[_0x2746('0x46')]=_0x39b608[_0x2746('0x46')]||_0x2351f5[_0x2746('0x46')];_0x2351f5[_0x2746('0x47')]=_0x39b608[_0x2746('0x47')];_0x2351f5[_0x2746('0x48')]=_0x39b608[_0x2746('0x48')]?_0x39b608[_0x2746('0x48')]-0x1:0x1;return null;}else if(_0x39b608&&_0x16f426[_0x39b608['agicommand']]){_0x1b840d=_0x16f426[_0x39b608[_0x2746('0x20')]](_0x39b608);console['log'](_0x2746('0x49'),_0x1b840d);logger['info'](_0x2746('0x4a'),JSON['stringify'](_0x1b840d,null,0x2));if(_0x1b840d&&_0x1b840d[_0x2746('0x4b')]===AGI_CODE_SUCCESS&&_0x1b840d[_0x2746('0x4c')]!==AGI_RESULT_ERROR&&!_0x2351f5[_0x2746('0x4d')]){logger[_0x2746('0x3a')](_0x2746('0x4a'),getLogFromObject(_0x1b840d));return _[_0x2746('0x4e')](_0x1b840d[_0x2746('0x4c')])?null:_0x1b840d[_0x2746('0x4c')][_0x2746('0x4f')]();}else{logger[_0x2746('0xb')]('response',getLogFromObject(_0x1b840d));return null;}}else{logger[_0x2746('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x58c74b){logger[_0x2746('0xb')](_0x58c74b[_0x2746('0xc')]);return null;}});if(_0x30f232[_0x2746('0x50')]){logger[_0x2746('0x19')](util[_0x2746('0xf')](_0x2746('0x51'),_0x2351f5[_0x2746('0x1d')],_0x2351f5['calleridname'],_0x2351f5[_0x2746('0x16')],_0x2351f5[_0x2746('0x17')],_0x2351f5[_0x2746('0x18')]));_0xa34ab3[_0x2746('0x42')](_0x30f232[_0x2746('0x50')]['id'],function(_0x57191d){try{_0x57191d=_0x16f426[_0x2746('0x43')](_0x57191d);logger['debug'](_0x2746('0x52'),JSON[_0x2746('0x30')](_0x57191d,null,0x2));if(_0x57191d&&_0x16f426[_0x57191d[_0x2746('0x20')]]){_0x1b840d=_0x16f426[_0x57191d[_0x2746('0x20')]](_0x57191d);if(_0x1b840d){logger[_0x2746('0x3a')](_0x2746('0x4a'),getLogFromObject(_0x1b840d));return _[_0x2746('0x4e')](_0x1b840d[_0x2746('0x4c')])?null:_0x1b840d[_0x2746('0x4c')]['toString']();}else{logger['error'](_0x2746('0x4a'),getLogFromObject(_0x1b840d));return null;}}else{logger[_0x2746('0xb')](_0x2746('0x53'));return null;}}catch(_0x526fe1){logger[_0x2746('0xb')](_0x526fe1['stack']);return null;}});}logger['info'](util[_0x2746('0xf')](_0x2746('0x54'),_0x2351f5['arg_1'],_0x2351f5[_0x2746('0x1b')],_0x2351f5['callerid'],_0x2351f5[_0x2746('0x17')],_0x2351f5['uniqueid']));logger[_0x2746('0x19')](util['format'](_0x2746('0x55'),_0x2351f5[_0x2746('0x46')],_0x2351f5[_0x2746('0x47')],parseInt(_0x2351f5[_0x2746('0x48')],0xa)+0x1));_0x2351f5[_0x2746('0x56')](_0x2351f5[_0x2746('0x46')],_0x2351f5['extension'],parseInt(_0x2351f5[_0x2746('0x48')],0xa)+0x1);_0x2351f5[_0x2746('0x32')]();}}else{logger[_0x2746('0xb')](util[_0x2746('0xf')](_0x2746('0x57'),_0x2351f5[_0x2746('0x1d')]));_0x2351f5[_0x2746('0x56')](_0x2351f5['context'],_0x2351f5[_0x2746('0x47')],parseInt(_0x2351f5[_0x2746('0x48')],0xa)+0x1);_0x2351f5[_0x2746('0x32')]();}}else{logger[_0x2746('0xb')](util[_0x2746('0xf')](_0x2746('0x58'),_0x2351f5[_0x2746('0x1d')]));_0x2351f5['continueAt'](_0x2351f5[_0x2746('0x46')],_0x2351f5[_0x2746('0x47')],parseInt(_0x2351f5[_0x2746('0x48')],0xa)+0x1);_0x2351f5['close']();}}function main(){var _0x252e1b;return utilLicense[_0x2746('0x59')]()[_0x2746('0x29')](function(_0x18ec96){if(_0x18ec96){if(_0x18ec96['voice']){if(_0x18ec96[_0x2746('0x5a')]&&_0x18ec96[_0x2746('0x5a')]>0x0){logger['info'](util[_0x2746('0xf')](_0x2746('0x5b'),_0x18ec96[_0x2746('0x5a')]));_0x252e1b=_0x18ec96[_0x2746('0x5a')];}else{logger['info'](_0x2746('0x5c'));}}else{logger[_0x2746('0x19')](_0x2746('0x5d'));_0x252e1b=-0x1;}}})['catch'](function(_0x471a80){logger[_0x2746('0xb')](_0x2746('0x5e'),_0x471a80[_0x2746('0xc')]);})[_0x2746('0x50')](function(){var _0x3bbed9=require(_0x2746('0x5f'))(config[_0x2746('0x3')]['port'],config[_0x2746('0x3')]['ip'],_0x252e1b);_0x3bbed9['on'](_0x2746('0xb'),errorHandler);_0x3bbed9['on']('listening',listeningHandler);_0x3bbed9['on'](_0x2746('0x60'),connectionHandler);_0x3bbed9['on'](_0x2746('0x32'),closeHandler);});}main(); \ No newline at end of file +var _0xc306=['value','getSquareProject','catch','createSquareReport','then','indexOf','substring','inspect','debug','variables','stringify','close','timeout','hangup','sync','production','SQUAREROOT','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','vertices','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','traverseBFS','clear','VERTEX','gotoc','context','extension','priority','vresponse','response','isUndefined','result','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\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','log','port','name','message','format','[ERROR]\x20%s','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[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','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','length','source','target','addEdge'];(function(_0x4870e1,_0x39f5e2){var _0x38169b=function(_0x46f077){while(--_0x46f077){_0x4870e1['push'](_0x4870e1['shift']());}};_0x38169b(++_0x39f5e2);}(_0xc306,0x1a9));var _0x6c30=function(_0x477675,_0x5146c4){_0x477675=_0x477675-0x0;var _0x1d0ff0=_0xc306[_0x477675];return _0x1d0ff0;};'use strict';var parser=require(_0x6c30('0x0'));var _=require('lodash');var syncho=require(_0x6c30('0x1'));var util=require(_0x6c30('0x2'));var moment=require(_0x6c30('0x3'));var config=require(_0x6c30('0x4'));var logger=require(_0x6c30('0x5'))('agi');var utilLicense=require(_0x6c30('0x6'));var rpc=require('./rpc');var mailRpc=require(_0x6c30('0x7'));var Graph=require(_0x6c30('0x8'));var Vertices=require(_0x6c30('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x6c30('0xa')]=_[_0x6c30('0xb')](config[_0x6c30('0xa')],{'ip':_0x6c30('0xc'),'port':0x11dd});function connectionHandler(_0x4e0017){process[_0x6c30('0xd')](function(){syncho(function(){try{setChannelVariables(_0x4e0017);agiHandler(_0x4e0017);}catch(_0x3f937a){logger[_0x6c30('0xe')](_0x3f937a['stack']);}});});}function listeningHandler(){console[_0x6c30('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x6c30('0x10')]);logger['info'](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x6c30('0xa')]['ip'],config[_0x6c30('0xa')][_0x6c30('0x10')]));}function errorHandler(_0x4db908){if(_0x4db908&&_0x4db908[_0x6c30('0x11')]&&_0x4db908['message']){logger[_0x6c30('0xe')](util['format']('[%s]\x20%s',_0x4db908[_0x6c30('0x11')],_0x4db908[_0x6c30('0x12')]));}else{logger['error'](util[_0x6c30('0x13')](_0x6c30('0x14'),_0x4db908[_0x6c30('0x15')]));}}function closeHandler(){logger[_0x6c30('0x16')](util['format'](_0x6c30('0x17'),this[_0x6c30('0x18')],this[_0x6c30('0x19')],this[_0x6c30('0x1a')],this[_0x6c30('0x1b')],this[_0x6c30('0x1c')]));try{createSquareReport(this);}catch(_0x439581){logger[_0x6c30('0xe')](_0x439581[_0x6c30('0x15')]);}}function timeoutHandler(){logger[_0x6c30('0x16')](util['format'](_0x6c30('0x1d'),this[_0x6c30('0x18')],this[_0x6c30('0x19')],this[_0x6c30('0x1a')],this[_0x6c30('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x6c30('0x16')](util[_0x6c30('0x13')](_0x6c30('0x1e'),this[_0x6c30('0x18')],this[_0x6c30('0x19')],this[_0x6c30('0x1a')],this['dnid'],this['uniqueid']));this[_0x6c30('0x1f')]=!![];}function getRoot(_0x4688fa){return parser[_0x6c30('0x20')](_0x4688fa,{'object':!![]})[_0x6c30('0x21')][_0x6c30('0x22')];}function addVertex(_0x34ddb6,_0x17c025,_0x726de6){_0x17c025[_0x6c30('0x23')]=_0x726de6;if(_0x17c025[_0x6c30('0x24')](_0x6c30('0x25'))){_0x17c025[_0x6c30('0x26')]=parseInt(_0x17c025[_0x6c30('0x25')],0xa);}_0x34ddb6[_0x6c30('0x27')](_['omit'](_0x17c025,_0x6c30('0x28')));}function initGraph(_0x1152f3,_0x56f3eb){var _0x190693=new Graph();for(var _0x6fc3f8 in _0x1152f3){if(_0x1152f3[_0x6c30('0x24')](_0x6fc3f8)){if(_['isArray'](_0x1152f3[_0x6fc3f8])){for(var _0x2706ae=0x0;_0x2706ae<_0x1152f3[_0x6fc3f8][_0x6c30('0x29')];_0x2706ae+=0x1){addVertex(_0x190693,_0x1152f3[_0x6fc3f8][_0x2706ae],_0x6fc3f8);}}else{addVertex(_0x190693,_0x1152f3[_0x6fc3f8],_0x6fc3f8);}}}for(var _0x3471dc=0x0;_0x3471dc<_0x56f3eb[_0x6c30('0x29')];_0x3471dc+=0x1){if(_0x56f3eb[_0x3471dc][_0x6c30('0x2a')]&&_0x56f3eb[_0x3471dc][_0x6c30('0x2b')]){_0x190693[_0x6c30('0x2c')](_0x56f3eb[_0x3471dc][_0x6c30('0x2a')],_0x56f3eb[_0x3471dc]['target'],_0x56f3eb[_0x3471dc][_0x6c30('0x2d')]);}}return _0x190693;}function getSquareProject(_0x2ff96a,_0x231ec0){rpc[_0x6c30('0x2e')](_0x2ff96a)['then'](function(_0x5b0990){_0x231ec0(null,_0x5b0990);})[_0x6c30('0x2f')](function(_0x53551f){_0x231ec0(null,_0x53551f);});}function createSquareReport(_0x29bc69,_0x428f61){rpc[_0x6c30('0x30')](_0x29bc69)[_0x6c30('0x31')](function(_0x2a14f7){if(_0x428f61){_0x428f61(null,_0x2a14f7);}})[_0x6c30('0x2f')](function(_0x16dd6f){if(_0x428f61){_0x428f61(null,_0x16dd6f);}});}function setChannelVariables(_0x27ddc4){for(var _0x4ec2a9 in _0x27ddc4){if(_0x27ddc4[_0x6c30('0x24')](_0x4ec2a9)){if(_0x4ec2a9[_0x6c30('0x32')]('agi_')===0x0){_0x27ddc4[_0x4ec2a9[_0x6c30('0x33')](0x4)]=_0x27ddc4[_0x4ec2a9];delete _0x27ddc4[_0x4ec2a9];}}}}function getLogFromObject(_0x1e9997){return util[_0x6c30('0x34')](_0x1e9997,{'showHidden':![],'depth':null});}function agiHandler(_0x4cf1c5){var _0x57153e,_0x11612c,_0x4c5a45,_0x5e852c,_0x5d1f3e;logger[_0x6c30('0x35')](_0x6c30('0x36'),JSON[_0x6c30('0x37')](_0x4cf1c5,null,0x2));logger[_0x6c30('0x16')](util[_0x6c30('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4cf1c5['arg_1'],_0x4cf1c5[_0x6c30('0x19')],_0x4cf1c5['callerid'],_0x4cf1c5['dnid'],_0x4cf1c5[_0x6c30('0x1c')]));_0x4cf1c5['on'](_0x6c30('0xe'),errorHandler);_0x4cf1c5['on'](_0x6c30('0x38'),closeHandler);_0x4cf1c5['on'](_0x6c30('0x39'),timeoutHandler);_0x4cf1c5[_0x6c30('0x1f')]=![];_0x4cf1c5['on'](_0x6c30('0x3a'),hangupHandler);var _0x472664=getSquareProject[_0x6c30('0x3b')](null,_0x4cf1c5[_0x6c30('0x18')]);if(_0x472664){if(_0x472664[_0x6c30('0x3c')]){_0x57153e=getRoot(_0x472664[_0x6c30('0x3c')]);console[_0x6c30('0xf')](_0x6c30('0x3d'),_0x57153e);if(_0x57153e&&_0x57153e['start']){logger[_0x6c30('0x35')](_0x6c30('0x22'),JSON[_0x6c30('0x37')](_0x57153e,null,0x2));_0x4cf1c5[_0x6c30('0x3e')]=moment()[_0x6c30('0x13')](_0x6c30('0x3f'));_0x11612c=initGraph(_[_0x6c30('0x40')](_0x57153e,_0x6c30('0x28')),_0x57153e[_0x6c30('0x28')]);_0x4c5a45=new Vertices(_0x4cf1c5,rpc,mailRpc);console['log'](_0x6c30('0x41'),_0x4c5a45);logger[_0x6c30('0x16')](util[_0x6c30('0x13')](_0x6c30('0x42'),_0x4cf1c5[_0x6c30('0x18')],_0x4cf1c5['calleridname'],_0x4cf1c5[_0x6c30('0x1a')],_0x4cf1c5[_0x6c30('0x1b')],_0x4cf1c5[_0x6c30('0x1c')]));console[_0x6c30('0xf')](_0x6c30('0x43'));_0x11612c[_0x6c30('0x44')](_0x57153e['start']['id'],function(_0x3e29a1){try{_0x3e29a1=_0x4c5a45[_0x6c30('0x45')](_0x3e29a1);logger['debug']('vertex',JSON[_0x6c30('0x37')](_0x3e29a1,null,0x2));console[_0x6c30('0xf')](_0x6c30('0x46'),_0x3e29a1);if(_0x3e29a1[_0x6c30('0x23')]===_0x6c30('0x47')){logger[_0x6c30('0x16')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4cf1c5[_0x6c30('0x48')]=_0x3e29a1['context']||_0x4cf1c5[_0x6c30('0x48')];_0x4cf1c5[_0x6c30('0x49')]=_0x3e29a1[_0x6c30('0x49')];_0x4cf1c5['priority']=_0x3e29a1[_0x6c30('0x4a')]?_0x3e29a1[_0x6c30('0x4a')]-0x1:0x1;return null;}else if(_0x3e29a1&&_0x4c5a45[_0x3e29a1['agicommand']]){_0x5d1f3e=_0x4c5a45[_0x3e29a1[_0x6c30('0x23')]](_0x3e29a1);console[_0x6c30('0xf')](_0x6c30('0x4b'),_0x5d1f3e);logger['info'](_0x6c30('0x4c'),JSON['stringify'](_0x5d1f3e,null,0x2));if(_0x5d1f3e&&_0x5d1f3e['code']===AGI_CODE_SUCCESS&&_0x5d1f3e['result']!==AGI_RESULT_ERROR&&!_0x4cf1c5[_0x6c30('0x1f')]){logger[_0x6c30('0x35')](_0x6c30('0x4c'),getLogFromObject(_0x5d1f3e));return _[_0x6c30('0x4d')](_0x5d1f3e['result'])?null:_0x5d1f3e[_0x6c30('0x4e')][_0x6c30('0x4f')]();}else{logger[_0x6c30('0xe')](_0x6c30('0x4c'),getLogFromObject(_0x5d1f3e));return null;}}else{logger['error'](_0x6c30('0x50'));return null;}}catch(_0x20891a){logger[_0x6c30('0xe')](_0x20891a[_0x6c30('0x15')]);return null;}});if(_0x57153e[_0x6c30('0x51')]){logger[_0x6c30('0x16')](util['format'](_0x6c30('0x52'),_0x4cf1c5[_0x6c30('0x18')],_0x4cf1c5[_0x6c30('0x19')],_0x4cf1c5['callerid'],_0x4cf1c5['dnid'],_0x4cf1c5['uniqueid']));_0x11612c[_0x6c30('0x44')](_0x57153e[_0x6c30('0x51')]['id'],function(_0x1c02c2){try{_0x1c02c2=_0x4c5a45[_0x6c30('0x45')](_0x1c02c2);logger[_0x6c30('0x35')]('vertex',JSON[_0x6c30('0x37')](_0x1c02c2,null,0x2));if(_0x1c02c2&&_0x4c5a45[_0x1c02c2[_0x6c30('0x23')]]){_0x5d1f3e=_0x4c5a45[_0x1c02c2[_0x6c30('0x23')]](_0x1c02c2);if(_0x5d1f3e){logger[_0x6c30('0x35')](_0x6c30('0x4c'),getLogFromObject(_0x5d1f3e));return _[_0x6c30('0x4d')](_0x5d1f3e[_0x6c30('0x4e')])?null:_0x5d1f3e[_0x6c30('0x4e')][_0x6c30('0x4f')]();}else{logger[_0x6c30('0xe')](_0x6c30('0x4c'),getLogFromObject(_0x5d1f3e));return null;}}else{logger['error'](_0x6c30('0x50'));return null;}}catch(_0x29f9d0){logger[_0x6c30('0xe')](_0x29f9d0[_0x6c30('0x15')]);return null;}});}logger[_0x6c30('0x16')](util[_0x6c30('0x13')](_0x6c30('0x53'),_0x4cf1c5[_0x6c30('0x18')],_0x4cf1c5[_0x6c30('0x19')],_0x4cf1c5['callerid'],_0x4cf1c5[_0x6c30('0x1b')],_0x4cf1c5[_0x6c30('0x1c')]));logger['info'](util[_0x6c30('0x13')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4cf1c5[_0x6c30('0x48')],_0x4cf1c5['extension'],parseInt(_0x4cf1c5[_0x6c30('0x4a')],0xa)+0x1));_0x4cf1c5[_0x6c30('0x54')](_0x4cf1c5[_0x6c30('0x48')],_0x4cf1c5[_0x6c30('0x49')],parseInt(_0x4cf1c5[_0x6c30('0x4a')],0xa)+0x1);_0x4cf1c5[_0x6c30('0x38')]();}}else{logger[_0x6c30('0xe')](util[_0x6c30('0x13')](_0x6c30('0x55'),_0x4cf1c5[_0x6c30('0x18')]));_0x4cf1c5[_0x6c30('0x54')](_0x4cf1c5['context'],_0x4cf1c5['extension'],parseInt(_0x4cf1c5['priority'],0xa)+0x1);_0x4cf1c5[_0x6c30('0x38')]();}}else{logger['error'](util['format'](_0x6c30('0x56'),_0x4cf1c5[_0x6c30('0x18')]));_0x4cf1c5[_0x6c30('0x54')](_0x4cf1c5[_0x6c30('0x48')],_0x4cf1c5[_0x6c30('0x49')],parseInt(_0x4cf1c5['priority'],0xa)+0x1);_0x4cf1c5[_0x6c30('0x38')]();}}function main(){var _0x5d7432;return utilLicense[_0x6c30('0x57')]()[_0x6c30('0x31')](function(_0x11df70){if(_0x11df70){if(_0x11df70['voice']){if(_0x11df70[_0x6c30('0x58')]&&_0x11df70[_0x6c30('0x58')]>0x0){logger[_0x6c30('0x16')](util[_0x6c30('0x13')](_0x6c30('0x59'),_0x11df70[_0x6c30('0x58')]));_0x5d7432=_0x11df70[_0x6c30('0x58')];}else{logger[_0x6c30('0x16')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x6c30('0x16')](_0x6c30('0x5a'));_0x5d7432=-0x1;}}})[_0x6c30('0x2f')](function(_0x33cbf8){logger[_0x6c30('0xe')](_0x6c30('0x5b'),_0x33cbf8['stack']);})['finally'](function(){var _0x115efb=require('./server')(config[_0x6c30('0xa')][_0x6c30('0x10')],config[_0x6c30('0xa')]['ip'],_0x5d7432);_0x115efb['on'](_0x6c30('0xe'),errorHandler);_0x115efb['on'](_0x6c30('0x5c'),listeningHandler);_0x115efb['on'](_0x6c30('0x5d'),connectionHandler);_0x115efb['on'](_0x6c30('0x38'),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 a42312f..0426a3d 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(_0x5e2d92,_0x29fc19){var _0x5a56bd=function(_0x492094){while(--_0x492094){_0x5e2d92['push'](_0x5e2d92['shift']());}};_0x5a56bd(++_0x29fc19);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x1e8af4,_0x4b5ac0){var _0x34b1cc=function(_0x26767c){while(--_0x26767c){_0x1e8af4['push'](_0x1e8af4['shift']());}};_0x34b1cc(++_0x4b5ac0);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 c2b3631..7a60a12 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x14a4d0,_0x4c7068){var _0x18c8ab=function(_0x10bd3b){while(--_0x10bd3b){_0x14a4d0['push'](_0x14a4d0['shift']());}};_0x18c8ab(++_0x4c7068);}(_0xb10b,0x12a));var _0xbb10=function(_0x42bbd8,_0x32af99){_0x42bbd8=_0x42bbd8-0x0;var _0x2d4a1c=_0xb10b[_0x42bbd8];return _0x2d4a1c;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x30717e,_0xd96659){var _0x38e97f=function(_0x2b2eeb){while(--_0x2b2eeb){_0x30717e['push'](_0x30717e['shift']());}};_0x38e97f(++_0xd96659);}(_0x5f2f,0x73));var _0xf5f2=function(_0x13eda4,_0x443061){_0x13eda4=_0x13eda4-0x0;var _0x4612fd=_0x5f2f[_0x13eda4];return _0x4612fd;};'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 e9ec7a0..1110cf8 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 _0x11ff=['ShowPause','agentLogin','LoginUser','agentPause','UnpauseUser','agentLogout','bluebird','moment','lodash','jayson/promise','client','http','then','error','message','result','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','email','name','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','dsn','getUserById','getTrunkById','getSoundById','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','createSquareRecording','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact'];(function(_0x4797fa,_0x3fe610){var _0x502b5b=function(_0x3efffc){while(--_0x3efffc){_0x4797fa['push'](_0x4797fa['shift']());}};_0x502b5b(++_0x3fe610);}(_0x11ff,0x1d1));var _0xf11f=function(_0x24a94e,_0x3dabab){_0x24a94e=_0x24a94e-0x0;var _0x48b72a=_0x11ff[_0x24a94e];return _0x48b72a;};'use strict';var BPromise=require(_0xf11f('0x0'));var moment=require(_0xf11f('0x1'));var _=require(_0xf11f('0x2'));var util=require('util');var jayson=require(_0xf11f('0x3'));var client=jayson[_0xf11f('0x4')][_0xf11f('0x5')]({'port':0x2329});function request(_0x53d1bc,_0x4e9239){return new BPromise(function(_0x893004,_0x3911ce){return client['request'](_0x53d1bc,_0x4e9239)[_0xf11f('0x6')](function(_0x590bb9){if(_0x590bb9[_0xf11f('0x7')]){return _0x3911ce(_0x590bb9['error'][_0xf11f('0x8')]);}else{return _0x893004(_0x590bb9[_0xf11f('0x9')]);}})['catch'](function(_0x1d29b4){return _0x3911ce(_0x1d29b4);});});}exports['getSquareProject']=function(_0x158375){return request(_0xf11f('0xa'),{'options':{'raw':![],'where':{'name':_0x158375},'attributes':[_0xf11f('0xb')]}});};exports[_0xf11f('0xc')]=function(_0x41490d){return request(_0xf11f('0xd'),{'options':{'raw':![],'where':{'id':_0x41490d},'include':[{'model':_0xf11f('0xe'),'as':'Smtp'}],'attributes':['id','name',_0xf11f('0xf')]}});};exports['getSquareProjectById']=function(_0x31b465){return request(_0xf11f('0xa'),{'options':{'where':{'id':_0x31b465},'attributes':[_0xf11f('0x10')]}});};exports[_0xf11f('0x11')]=function(_0x323ba6){return request(_0xf11f('0x12'),{'options':{'where':{'id':_0x323ba6},'attributes':[_0xf11f('0x10')]}});};exports['getVariableById']=function(_0x52cd6f){return request(_0xf11f('0x13'),{'options':{'where':{'id':_0x52cd6f},'attributes':[_0xf11f('0x10')]}});};exports[_0xf11f('0x14')]=function(_0x123d7a){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x123d7a},'attributes':[_0xf11f('0x15')]}});};exports[_0xf11f('0x16')]=function(_0x501c76){return request('ShowUser',{'options':{'where':{'id':_0x501c76},'attributes':[_0xf11f('0x10')]}});};exports[_0xf11f('0x17')]=function(_0x4043fe){return request('ShowTrunk',{'options':{'where':{'id':_0x4043fe},'attributes':['name']}});};exports[_0xf11f('0x18')]=function(_0x149f43){return request('ShowSound',{'options':{'where':{'id':_0x149f43},'attributes':[_0xf11f('0x19')]}});};exports[_0xf11f('0x1a')]=function(_0x29eacb){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x29eacb},'include':[{'model':_0xf11f('0x1b'),'as':_0xf11f('0x1c')}]}});};exports[_0xf11f('0x1d')]=function(_0x2c513c){return request(_0xf11f('0x1e'),{'options':{'where':{'id':_0x2c513c},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x3b8f12){return request(_0xf11f('0x1f'),{'body':_0x3b8f12});};exports[_0xf11f('0x20')]=function(_0x189ff0){return request(_0xf11f('0x21'),{'body':_0x189ff0});};exports[_0xf11f('0x22')]=function(_0x5567b1){return request('CreateSquareReport',{'body':_[_0xf11f('0x23')](_0x5567b1,{'project_name':_0x5567b1[_0xf11f('0x24')],'prev_project_name':_0x5567b1[_0xf11f('0x25')]||'','is_subproject':_0x5567b1[_0xf11f('0x25')]?!![]:![],'leaveAt':moment()[_0xf11f('0x26')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xf11f('0x27')]=function(_0xaae271){return request('CreateSquareRecording',{'body':_0xaae271});};exports['createSquareMessage']=function(_0x2a9152){return request('CreateSquareMessage',{'body':_0x2a9152});};exports[_0xf11f('0x28')]=function(_0x4e3182){return request(_0xf11f('0x29'),{'options':{'raw':![],'where':{'phone':_0x4e3182[_0xf11f('0x2a')],'ListId':_0x4e3182[_0xf11f('0x2b')]}}})['then'](function(_0xcc38f3){if(_0xcc38f3){return _0xcc38f3;}return request(_0xf11f('0x2c'),{'body':_0x4e3182});});};exports['getPauseById']=function(_0x2f16e3){return request(_0xf11f('0x2d'),{'options':{'where':{'id':_0x2f16e3},'attributes':[_0xf11f('0x10')]}});};exports[_0xf11f('0x2e')]=function(_0x2d6c2a,_0x32d6c1){return request(_0xf11f('0x2f'),{'body':{'interface':_0x32d6c1},'options':{'where':_0x2d6c2a}});};exports[_0xf11f('0x30')]=function(_0x4481e7,_0x5ab3f2,_0x409da2){return request('PauseUser',{'body':{'type':_0x5ab3f2,'uniqueid':_0x409da2},'options':{'where':_0x4481e7}});};exports['agentUnpause']=function(_0x253ba6){return request(_0xf11f('0x31'),{'body':{},'options':{'where':_0x253ba6}});};exports[_0xf11f('0x32')]=function(_0x515db1){return request('LogoutUser',{'body':{},'options':{'where':_0x515db1}});}; \ No newline at end of file +var _0x58bb=['merge','arg_2','createSquareRecording','CreateSquareRecording','createSquareMessage','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','then','error','message','result','catch','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport'];(function(_0x4f5121,_0x5edcb6){var _0x2c39cd=function(_0x3a2365){while(--_0x3a2365){_0x4f5121['push'](_0x4f5121['shift']());}};_0x2c39cd(++_0x5edcb6);}(_0x58bb,0x1d8));var _0xb58b=function(_0x398601,_0x52cfb0){_0x398601=_0x398601-0x0;var _0x112181=_0x58bb[_0x398601];return _0x112181;};'use strict';var BPromise=require(_0xb58b('0x0'));var moment=require(_0xb58b('0x1'));var _=require(_0xb58b('0x2'));var util=require(_0xb58b('0x3'));var jayson=require(_0xb58b('0x4'));var client=jayson[_0xb58b('0x5')]['http']({'port':0x2329});function request(_0x2fb9ed,_0x416c76){return new BPromise(function(_0x5ac983,_0x39fefd){return client['request'](_0x2fb9ed,_0x416c76)[_0xb58b('0x6')](function(_0x4d6a5f){if(_0x4d6a5f[_0xb58b('0x7')]){return _0x39fefd(_0x4d6a5f[_0xb58b('0x7')][_0xb58b('0x8')]);}else{return _0x5ac983(_0x4d6a5f[_0xb58b('0x9')]);}})[_0xb58b('0xa')](function(_0x3b6d3c){return _0x39fefd(_0x3b6d3c);});});}exports[_0xb58b('0xb')]=function(_0x1e44be){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x1e44be},'attributes':[_0xb58b('0xc')]}});};exports[_0xb58b('0xd')]=function(_0x23e672){return request(_0xb58b('0xe'),{'options':{'raw':![],'where':{'id':_0x23e672},'include':[{'model':_0xb58b('0xf'),'as':_0xb58b('0x10')}],'attributes':['id',_0xb58b('0x11'),_0xb58b('0x12')]}});};exports[_0xb58b('0x13')]=function(_0x34f8ff){return request('ShowSquareProject',{'options':{'where':{'id':_0x34f8ff},'attributes':[_0xb58b('0x11')]}});};exports['getVoiceQueueById']=function(_0x2cb309){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x2cb309},'attributes':['name']}});};exports[_0xb58b('0x14')]=function(_0xc308a3){return request(_0xb58b('0x15'),{'options':{'where':{'id':_0xc308a3},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x557a23){return request(_0xb58b('0x16'),{'options':{'where':{'id':_0x557a23},'attributes':[_0xb58b('0x17')]}});};exports[_0xb58b('0x18')]=function(_0x2c8a92){return request(_0xb58b('0x19'),{'options':{'where':{'id':_0x2c8a92},'attributes':[_0xb58b('0x11')]}});};exports[_0xb58b('0x1a')]=function(_0x305d9b){return request(_0xb58b('0x1b'),{'options':{'where':{'id':_0x305d9b},'attributes':[_0xb58b('0x11')]}});};exports['getSoundById']=function(_0x470324){return request(_0xb58b('0x1c'),{'options':{'where':{'id':_0x470324},'attributes':[_0xb58b('0x1d')]}});};exports[_0xb58b('0x1e')]=function(_0xd9e5fb){return request(_0xb58b('0x1f'),{'options':{'raw':![],'where':{'id':_0xd9e5fb},'include':[{'model':_0xb58b('0x20'),'as':_0xb58b('0x21')}]}});};exports[_0xb58b('0x22')]=function(_0xd18aa7){return request(_0xb58b('0x23'),{'options':{'where':{'id':_0xd18aa7},'attributes':['id',_0xb58b('0x11')]}});};exports[_0xb58b('0x24')]=function(_0x453a6f){return request('CreateSmsMessage',{'body':_0x453a6f});};exports[_0xb58b('0x25')]=function(_0x2024bb){return request(_0xb58b('0x26'),{'body':_0x2024bb});};exports[_0xb58b('0x27')]=function(_0xf188fe){return request(_0xb58b('0x28'),{'body':_[_0xb58b('0x29')](_0xf188fe,{'project_name':_0xf188fe['arg_1'],'prev_project_name':_0xf188fe[_0xb58b('0x2a')]||'','is_subproject':_0xf188fe[_0xb58b('0x2a')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xb58b('0x2b')]=function(_0x329c6d){return request(_0xb58b('0x2c'),{'body':_0x329c6d});};exports[_0xb58b('0x2d')]=function(_0x17308f){return request('CreateSquareMessage',{'body':_0x17308f});};exports['createCmContact']=function(_0x23f329){return request(_0xb58b('0x2e'),{'options':{'raw':![],'where':{'phone':_0x23f329[_0xb58b('0x2f')],'ListId':_0x23f329[_0xb58b('0x30')]}}})[_0xb58b('0x6')](function(_0xab275){if(_0xab275){return _0xab275;}return request(_0xb58b('0x31'),{'body':_0x23f329});});};exports[_0xb58b('0x32')]=function(_0x707d13){return request(_0xb58b('0x33'),{'options':{'where':{'id':_0x707d13},'attributes':[_0xb58b('0x11')]}});};exports[_0xb58b('0x34')]=function(_0x2ce469,_0x45288c){return request(_0xb58b('0x35'),{'body':{'interface':_0x45288c},'options':{'where':_0x2ce469}});};exports['agentPause']=function(_0x348789,_0x359ed2,_0xa04ebe){return request(_0xb58b('0x36'),{'body':{'type':_0x359ed2,'uniqueid':_0xa04ebe},'options':{'where':_0x348789}});};exports['agentUnpause']=function(_0x23de11){return request(_0xb58b('0x37'),{'body':{},'options':{'where':_0x23de11}});};exports['agentLogout']=function(_0x458d3b){return request(_0xb58b('0x38'),{'body':{},'options':{'where':_0x458d3b}});}; \ 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 28cfe96..ff53bfa 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 polly=require('./polly');var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x55e0=['exports','./polly','./lex'];(function(_0x5400d9,_0x5a2440){var _0xe8f60e=function(_0x49ddcb){while(--_0x49ddcb){_0x5400d9['push'](_0x5400d9['shift']());}};_0xe8f60e(++_0x5a2440);}(_0x55e0,0xdc));var _0x055e=function(_0x1c3b3a,_0x434973){_0x1c3b3a=_0x1c3b3a-0x0;var _0x3437c4=_0x55e0[_0x1c3b3a];return _0x3437c4;};var polly=require(_0x055e('0x0'));var lex=require(_0x055e('0x1'));module[_0x055e('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index fafbfe4..e0db860 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 _0xd49c=['exports'];(function(_0x762971,_0x2bd0a9){var _0x20a2ba=function(_0x27458c){while(--_0x27458c){_0x762971['push'](_0x762971['shift']());}};_0x20a2ba(++_0x2bd0a9);}(_0xd49c,0x1d8));var _0xcd49=function(_0x1dc4e1,_0x25c368){_0x1dc4e1=_0x1dc4e1-0x0;var _0x14cda5=_0xd49c[_0x1dc4e1];return _0x14cda5;};'use strict';var lex=require('./lib/api');module[_0xcd49('0x0')]=function(_0x59c5ab,_0x2d8e38,_0x190db1,_0x5bda72,_0x1181d4,_0x52362d){return lex(_0x59c5ab,_0x2d8e38,_0x190db1,_0x5bda72,_0x1181d4,_0x52362d);}; \ No newline at end of file +var _0xa631=['exports'];(function(_0x14abc0,_0x137291){var _0xcf34b6=function(_0x3f6a0){while(--_0x3f6a0){_0x14abc0['push'](_0x14abc0['shift']());}};_0xcf34b6(++_0x137291);}(_0xa631,0xe4));var _0x1a63=function(_0x5a08da,_0x263ab1){_0x5a08da=_0x5a08da-0x0;var _0x3055e5=_0xa631[_0x5a08da];return _0x3055e5;};'use strict';var lex=require('./lib/api');module[_0x1a63('0x0')]=function(_0x1e771b,_0x17d7a7,_0x53c6fb,_0x265d0d,_0x584ab0,_0x536c8d){return lex(_0x1e771b,_0x17d7a7,_0x53c6fb,_0x265d0d,_0x584ab0,_0x536c8d);}; \ 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 98e6a5f..29eb0ff 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 _0xcbc3=['hasOwnProperty','exports','$LATEST','bluebird','aws-sdk','slots'];(function(_0x3a0ef4,_0x14ce45){var _0x2e9b51=function(_0x50135b){while(--_0x50135b){_0x3a0ef4['push'](_0x3a0ef4['shift']());}};_0x2e9b51(++_0x14ce45);}(_0xcbc3,0x8d));var _0x3cbc=function(_0x3d7595,_0x23bf60){_0x3d7595=_0x3d7595-0x0;var _0x163d06=_0xcbc3[_0x3d7595];return _0x163d06;};'use strict';var BPromise=require(_0x3cbc('0x0'));var AWS=require(_0x3cbc('0x1'));function lexResult(_0x1a960c,_0x12e464){return new BPromise(function(_0x18e0a2,_0x5f2fe0){_0x1a960c['postText'](_0x12e464,function(_0x5ccafa,_0x644945){if(_0x5ccafa){_0x5f2fe0(_0x5ccafa);}if(_0x644945[_0x3cbc('0x2')]){for(const _0x29e0f4 in _0x644945[_0x3cbc('0x2')]){if(_0x644945[_0x3cbc('0x2')][_0x3cbc('0x3')](_0x29e0f4)){var _0x4180d2=_0x644945[_0x3cbc('0x2')][_0x29e0f4];_0x644945['slot_'+_0x29e0f4]=_0x4180d2;}}}_0x18e0a2(_0x644945);});});}module[_0x3cbc('0x4')]=function(_0x25d86d,_0x247840,_0x381eec,_0x61de1e,_0x5e7edd,_0x1a688a){var _0x12ea32=new AWS['LexRuntime']({'accessKeyId':_0x247840,'secretAccessKey':_0x381eec,'region':_0x61de1e});var _0x4fa85c={'botAlias':_0x3cbc('0x5'),'botName':_0x1a688a,'inputText':_0x5e7edd,'userId':_0x25d86d};return lexResult(_0x12ea32,_0x4fa85c);}; \ No newline at end of file +var _0x8a74=['postText','slots','hasOwnProperty','slot_','LexRuntime','$LATEST','aws-sdk'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x8a74,0x1bf));var _0x48a7=function(_0x21acea,_0x281ead){_0x21acea=_0x21acea-0x0;var _0x447aac=_0x8a74[_0x21acea];return _0x447aac;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x48a7('0x0'));function lexResult(_0x331c18,_0x226c65){return new BPromise(function(_0x59b7a7,_0x1d0b48){_0x331c18[_0x48a7('0x1')](_0x226c65,function(_0x2f97e6,_0x3ad04c){if(_0x2f97e6){_0x1d0b48(_0x2f97e6);}if(_0x3ad04c[_0x48a7('0x2')]){for(const _0x29cd14 in _0x3ad04c[_0x48a7('0x2')]){if(_0x3ad04c['slots'][_0x48a7('0x3')](_0x29cd14)){var _0x18f186=_0x3ad04c[_0x48a7('0x2')][_0x29cd14];_0x3ad04c[_0x48a7('0x4')+_0x29cd14]=_0x18f186;}}}_0x59b7a7(_0x3ad04c);});});}module['exports']=function(_0x2ceb70,_0x3a0528,_0x3d3777,_0x4b46fb,_0x1a2be7,_0x41b20a){var _0x5848ad=new AWS[(_0x48a7('0x5'))]({'accessKeyId':_0x3a0528,'secretAccessKey':_0x3d3777,'region':_0x4b46fb});var _0x3a8663={'botAlias':_0x48a7('0x6'),'botName':_0x41b20a,'inputText':_0x1a2be7,'userId':_0x2ceb70};return lexResult(_0x5848ad,_0x3a8663);}; \ 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 2771bd3..e8a3682 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 _0x6401=['./lib/api'];(function(_0x3509d8,_0x5074b5){var _0x4dcedb=function(_0x164ac4){while(--_0x164ac4){_0x3509d8['push'](_0x3509d8['shift']());}};_0x4dcedb(++_0x5074b5);}(_0x6401,0xdf));var _0x1640=function(_0x344773,_0x17c411){_0x344773=_0x344773-0x0;var _0x4cb584=_0x6401[_0x344773];return _0x4cb584;};'use strict';var polly=require(_0x1640('0x0'));module['exports']=function(_0x513efe,_0x332f15,_0xee9777,_0x5b2d44,_0x27a13c,_0x2b8ffe,_0x2e66c1){return polly(_0x513efe,_0x332f15,_0xee9777,_0x5b2d44,_0x27a13c,_0x2b8ffe,_0x2e66c1);}; \ No newline at end of file +var _0x0411=['exports','./lib/api'];(function(_0x32b402,_0x1b7069){var _0xb3e117=function(_0x54494d){while(--_0x54494d){_0x32b402['push'](_0x32b402['shift']());}};_0xb3e117(++_0x1b7069);}(_0x0411,0x8d));var _0x1041=function(_0x1933fe,_0x4dd1d2){_0x1933fe=_0x1933fe-0x0;var _0x3ccf9c=_0x0411[_0x1933fe];return _0x3ccf9c;};'use strict';var polly=require(_0x1041('0x0'));module[_0x1041('0x1')]=function(_0x23cfac,_0x48fb55,_0x57b762,_0xa06727,_0x596ab7,_0x2a4b8b,_0x5bc959){return polly(_0x23cfac,_0x48fb55,_0x57b762,_0xa06727,_0x596ab7,_0x2a4b8b,_0x5bc959);}; \ 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 1740769..de72598 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 _0x44e6=['path','bluebird','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','text','mp3'];(function(_0x4a450a,_0x54d42f){var _0x28baf9=function(_0x5cb70a){while(--_0x5cb70a){_0x4a450a['push'](_0x4a450a['shift']());}};_0x28baf9(++_0x54d42f);}(_0x44e6,0x18c));var _0x644e=function(_0x2be8fc,_0x398f30){_0x2be8fc=_0x2be8fc-0x0;var _0x1319a9=_0x44e6[_0x2be8fc];return _0x1319a9;};'use strict';var fs=require('fs');var path=require(_0x644e('0x0'));var BPromise=require(_0x644e('0x1'));var rs=require('randomstring');var AWS=require(_0x644e('0x2'));function pollyResult(_0x5234d8,_0x12ba59,_0x200aca){return new BPromise(function(_0x2d475c,_0xc72379){_0x5234d8['synthesizeSpeech'](_0x12ba59,function(_0x99a5c,_0x4a796b){if(_0x99a5c){_0xc72379(_0x99a5c);}else if(_0x4a796b){if(_0x4a796b[_0x644e('0x3')]instanceof Buffer){fs[_0x644e('0x4')](_0x200aca,_0x4a796b[_0x644e('0x3')],function(_0x36cc93){if(_0x36cc93){_0xc72379(_0x36cc93);}else{_0x2d475c();}});}else{_0xc72379(new Error(_0x644e('0x5')));}}else{_0xc72379(new Error(_0x644e('0x6')));}});});}module['exports']=function(_0x4b6e82,_0x3fe845,_0x22a33f,_0x5221ab,_0x16bec9,_0x1a8d07,_0x147c64){var _0x3dc169=new AWS['Polly']({'accessKeyId':_0x4b6e82,'secretAccessKey':_0x3fe845,'region':_0x22a33f});var _0x1c8514={'Text':_0x16bec9,'TextType':_0x1a8d07||_0x644e('0x7'),'OutputFormat':_0x644e('0x8'),'VoiceId':_0x5221ab};return pollyResult(_0x3dc169,_0x1c8514,_0x147c64);}; \ No newline at end of file +var _0xbd87=['aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbd87,0x11c));var _0x7bd8=function(_0x25fd7f,_0x1fc310){_0x25fd7f=_0x25fd7f-0x0;var _0x558eac=_0xbd87[_0x25fd7f];return _0x558eac;};'use strict';var fs=require('fs');var path=require(_0x7bd8('0x0'));var BPromise=require(_0x7bd8('0x1'));var rs=require('randomstring');var AWS=require(_0x7bd8('0x2'));function pollyResult(_0x163fa4,_0x32e5ac,_0x1ff6fc){return new BPromise(function(_0x42dd1b,_0x2b481e){_0x163fa4[_0x7bd8('0x3')](_0x32e5ac,function(_0xd41c8a,_0x5e76e2){if(_0xd41c8a){_0x2b481e(_0xd41c8a);}else if(_0x5e76e2){if(_0x5e76e2['AudioStream']instanceof Buffer){fs[_0x7bd8('0x4')](_0x1ff6fc,_0x5e76e2[_0x7bd8('0x5')],function(_0x5bedd1){if(_0x5bedd1){_0x2b481e(_0x5bedd1);}else{_0x42dd1b();}});}else{_0x2b481e(new Error(_0x7bd8('0x6')));}}else{_0x2b481e(new Error(_0x7bd8('0x7')));}});});}module[_0x7bd8('0x8')]=function(_0x562548,_0x3c4749,_0x5d90b7,_0x17e4bf,_0x2a6dad,_0x245b22,_0x26d83d){var _0x232b2c=new AWS[(_0x7bd8('0x9'))]({'accessKeyId':_0x562548,'secretAccessKey':_0x3c4749,'region':_0x5d90b7});var _0x24450b={'Text':_0x2a6dad,'TextType':_0x245b22||'text','OutputFormat':_0x7bd8('0xa'),'VoiceId':_0x17e4bf};return pollyResult(_0x232b2c,_0x24450b,_0x26d83d);}; \ 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 16873b8..c55923f 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 _0x819e=['./lib/api','exports'];(function(_0xb58bc2,_0x3fff5f){var _0x3902d6=function(_0x3e3855){while(--_0x3e3855){_0xb58bc2['push'](_0xb58bc2['shift']());}};_0x3902d6(++_0x3fff5f);}(_0x819e,0x1a6));var _0xe819=function(_0x2deb15,_0x102a17){_0x2deb15=_0x2deb15-0x0;var _0x1abb33=_0x819e[_0x2deb15];return _0x1abb33;};'use strict';var asr=require(_0xe819('0x0'));module[_0xe819('0x1')]=function(_0x1468c5,_0x5c3666,_0x5260e7,_0x2bbff2){return asr(_0x1468c5,_0x5c3666,_0x5260e7);}; \ No newline at end of file +var _0x293b=['exports'];(function(_0x2ce3b5,_0x30ce93){var _0x5423d2=function(_0x231b0f){while(--_0x231b0f){_0x2ce3b5['push'](_0x2ce3b5['shift']());}};_0x5423d2(++_0x30ce93);}(_0x293b,0x1ea));var _0xb293=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x293b[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require('./lib/api');module[_0xb293('0x0')]=function(_0xa79dc5,_0x425796,_0x51f86c,_0x3b3734){return asr(_0xa79dc5,_0x425796,_0x51f86c);}; \ 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 981dbe5..8975f37 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 _0x4133=['8000','bluebird','exports','string','length','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x4133,0xf1));var _0x3413=function(_0x272a46,_0x12b300){_0x272a46=_0x272a46-0x0;var _0x2bfd12=_0x4133[_0x272a46];return _0x2bfd12;};'use strict';var url=require('url');var BPromise=require(_0x3413('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x3413('0x1')]=function(_0x1b5540,_0x10af5b,_0x140ff){return new BPromise(function(_0x439688,_0x25ad08){var _0xd554d6;if(typeof _0x1b5540!==_0x3413('0x2')||_0x1b5540[_0x3413('0x3')]===0x0){return _0x25ad08('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x10af5b!=='string'||_0x10af5b[_0x3413('0x3')]===0x0){return _0x25ad08(_0x3413('0x4'));}if(typeof _0x140ff!=='undefined'&&(typeof _0x140ff!==_0x3413('0x2')||_0x140ff[_0x3413('0x3')]===0x0)){return _0x25ad08(_0x3413('0x5'));}try{_0xd554d6=fs[_0x3413('0x6')](_0x1b5540)[_0x3413('0x7')]('base64');}catch(_0xf37e8e){return _0x25ad08(_0xf37e8e);}return _0x439688({'method':_0x3413('0x8'),'uri':host+'/v1/speech:recognize?key='+_0x10af5b,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x3413('0x9'),'languageCode':_0x140ff},'audio':{'content':_0xd554d6}},'json':!![]});});}; \ No newline at end of file +var _0xa1b2=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','https://speech.googleapis.com','exports'];(function(_0x10c04f,_0x21023f){var _0x3c0532=function(_0x5381a1){while(--_0x5381a1){_0x10c04f['push'](_0x10c04f['shift']());}};_0x3c0532(++_0x21023f);}(_0xa1b2,0xa8));var _0x2a1b=function(_0x41b7ef,_0x43d225){_0x41b7ef=_0x41b7ef-0x0;var _0x205cc8=_0xa1b2[_0x41b7ef];return _0x205cc8;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x2a1b('0x0');module[_0x2a1b('0x1')]=function(_0x5800ff,_0x263e6d,_0x32568f){return new BPromise(function(_0x2e0deb,_0x36414d){var _0x504972;if(typeof _0x5800ff!==_0x2a1b('0x2')||_0x5800ff[_0x2a1b('0x3')]===0x0){return _0x36414d(_0x2a1b('0x4'));}if(typeof _0x263e6d!=='string'||_0x263e6d['length']===0x0){return _0x36414d(_0x2a1b('0x5'));}if(typeof _0x32568f!=='undefined'&&(typeof _0x32568f!==_0x2a1b('0x2')||_0x32568f[_0x2a1b('0x3')]===0x0)){return _0x36414d(_0x2a1b('0x6'));}try{_0x504972=fs[_0x2a1b('0x7')](_0x5800ff)[_0x2a1b('0x8')](_0x2a1b('0x9'));}catch(_0x48e319){return _0x36414d(_0x48e319);}return _0x2e0deb({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x263e6d,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x32568f},'audio':{'content':_0x504972}},'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 9425fa0..15e4b1b 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 _0xd1d3=['./asr'];(function(_0x2af8f2,_0xe53d46){var _0x58f9d8=function(_0xfad37d){while(--_0xfad37d){_0x2af8f2['push'](_0x2af8f2['shift']());}};_0x58f9d8(++_0xe53d46);}(_0xd1d3,0xd7));var _0x3d1d=function(_0x161c51,_0x2d6bb3){_0x161c51=_0x161c51-0x0;var _0x7c222d=_0xd1d3[_0x161c51];return _0x7c222d;};var asr=require(_0x3d1d('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x9f91=['exports'];(function(_0x36ee2d,_0x6ba215){var _0x259e9c=function(_0x3d2c18){while(--_0x3d2c18){_0x36ee2d['push'](_0x36ee2d['shift']());}};_0x259e9c(++_0x6ba215);}(_0x9f91,0x14c));var _0x19f9=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x9f91[_0x1bc0ae];return _0x501104;};var asr=require('./asr');module[_0x19f9('0x0')]={'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 68012d4..d0ce971 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 _0xa55f=['writeFile','googleCloudTTS\x20path','googleTTS','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','speech','score','status','metadata','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','path','http','https','parse','randomstring','request-promise','util','google-tts-api','apiai-promise','md5','./aws','./tilde','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','request\x20to\x20','data','end','transcode','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','from','audioContent'];(function(_0x2f21ca,_0x547624){var _0x30495f=function(_0x49c760){while(--_0x49c760){_0x2f21ca['push'](_0x2f21ca['shift']());}};_0x30495f(++_0x547624);}(_0xa55f,0x172));var _0xfa55=function(_0x44bb94,_0x3b2bed){_0x44bb94=_0x44bb94-0x0;var _0x54019f=_0xa55f[_0x44bb94];return _0x54019f;};'use strict';var fs=require('fs');var path=require(_0xfa55('0x0'));var http=require(_0xfa55('0x1'));var https=require(_0xfa55('0x2'));var urlParse=require('url')[_0xfa55('0x3')];var BPromise=require('bluebird');var rs=require(_0xfa55('0x4'));var sox=require('sox');var rp=require(_0xfa55('0x5'));var util=require(_0xfa55('0x6'));var querystring=require('querystring');var tts=require(_0xfa55('0x7'));var apiai=require(_0xfa55('0x8'));var md5=require(_0xfa55('0x9'));var google=require('./google');var aws=require(_0xfa55('0xa'));var tilde=require(_0xfa55('0xb'));var sestek=require('./sestek');var logger=require('../../../config/logger')(_0xfa55('0xc'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x49ce38,_0x1a49cc){return new BPromise(function(_0x4ad3ce,_0x2a6d02){var _0x28b94e=urlParse(_0x49ce38);var _0x4c61a6=_0x28b94e[_0xfa55('0xd')]===_0xfa55('0xe')?https:http;var _0x48a946={'host':_0x28b94e[_0xfa55('0xf')],'path':_0x28b94e[_0xfa55('0x0')],'headers':{'user-agent':_0xfa55('0x10')}};_0x4c61a6[_0xfa55('0x11')](_0x48a946,function(_0x4a2b88){if(_0x4a2b88[_0xfa55('0x12')]!==0xc8){logger[_0xfa55('0x13')]('request\x20to\x20'+_0x49ce38+_0xfa55('0x14')+_0x4a2b88[_0xfa55('0x12')]+'\x20('+_0x4a2b88['statusMessage']+')');_0x2a6d02(new Error('request\x20to\x20'+_0x49ce38+'\x20failed,\x20status\x20code\x20=\x20'+_0x4a2b88[_0xfa55('0x12')]+'\x20('+_0x4a2b88[_0xfa55('0x15')]+')'));return;}var _0x1a39ca=fs[_0xfa55('0x16')](_0x1a49cc);_0x1a39ca['on'](_0xfa55('0x17'),function(){logger[_0xfa55('0x18')](_0xfa55('0x19'));_0x1a39ca[_0xfa55('0x1a')](_0x4ad3ce);});_0x1a39ca['on']('error',function(_0x4b0095){fs[_0xfa55('0x1b')](_0x1a49cc);logger[_0xfa55('0x13')](_0xfa55('0x1c'),_0x4b0095);_0x2a6d02(_0x4b0095);});_0x4a2b88[_0xfa55('0x1d')](_0x1a39ca);})['on'](_0xfa55('0x13'),function(_0x559a28){logger[_0xfa55('0x13')](_0x559a28);_0x2a6d02(_0x559a28);})['end']();});}function uploadFile(_0x300210){return new BPromise(function(_0x4d9b03,_0x1702c4){var _0x6bab10=urlParse(_0x300210);var _0x16c080=_0x6bab10[_0xfa55('0xd')]===_0xfa55('0xe')?https:http;var _0x1dc36c={'host':_0x6bab10[_0xfa55('0xf')],'path':_0x6bab10[_0xfa55('0x0')],'headers':{'user-agent':_0xfa55('0x10')}};_0x16c080[_0xfa55('0x11')](_0x1dc36c,function(_0x2e9274){if(_0x2e9274[_0xfa55('0x12')]!==0xc8){_0x1702c4(new Error(_0xfa55('0x1e')+_0x300210+_0xfa55('0x14')+_0x2e9274[_0xfa55('0x12')]+'\x20('+_0x2e9274[_0xfa55('0x15')]+')'));return;}var _0x3ca4d6='';_0x2e9274['on'](_0xfa55('0x1f'),function(_0x4dec3b){_0x3ca4d6+=_0x4dec3b;});_0x2e9274['on'](_0xfa55('0x20'),function(){_0x4d9b03(_0x3ca4d6);});})['on']('error',function(_0x2eff8b){_0x1702c4(_0x2eff8b);})[_0xfa55('0x20')]();});}function convertFile(_0x2b1ee8,_0x5d42b0){return new BPromise(function(_0x4f5013,_0x3cd22a){var _0x550b63=sox[_0xfa55('0x21')](_0x2b1ee8,_0x5d42b0,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x550b63['on'](_0xfa55('0x13'),function(_0x42292f){logger[_0xfa55('0x13')](_0xfa55('0x22'),_0x42292f);_0x3cd22a(_0x42292f);});_0x550b63['on'](_0xfa55('0x20'),function(){logger[_0xfa55('0x18')](_0xfa55('0x23'));_0x4f5013();});_0x550b63['start']();});}function base64Decode(_0x29f76e,_0x5af8f6){var _0x2c14d6=path[_0xfa55('0x24')](__dirname,_0xfa55('0x25'),rs[_0xfa55('0x26')](0x4)+_0xfa55('0x27'));fs[_0xfa55('0x28')](_0x2c14d6,_0x29f76e,_0xfa55('0x29'));return convertFile(_0x2c14d6,_0x5af8f6)[_0xfa55('0x2a')](function(){try{fs[_0xfa55('0x1b')](_0x2c14d6);fs[_0xfa55('0x2b')](_0x5af8f6,_0xfa55('0x2c'));}catch(_0x4c61ae){logger['error'](_0x4c61ae);}return _0x5af8f6[_0xfa55('0x2d')]('.')[0x0];});}function base64Encode(_0x508946){var _0x509eba=fs[_0xfa55('0x2e')](_0x508946);return new Buffer(_0x509eba)[_0xfa55('0x2f')](_0xfa55('0x29'));}exports['googleCloudTTS']=function(_0x5cdada,_0x18f9fe,_0x171520,_0x3fd056,_0x379e20,_0x3537ba){var _0xa932ee,_0x380625;var _0x178fc8=_0xfa55('0x30');var _0x1f5311=_0xfa55('0x31')+_0x5cdada;var _0x2f3e96={};if(_0x18f9fe===_0xfa55('0x32')){_0x2f3e96[_0xfa55('0x33')]={'ssml':_0x171520};}else{_0x2f3e96[_0xfa55('0x33')]={'text':_0x171520};};_0x2f3e96[_0xfa55('0x34')]={'languageCode':_0x3fd056,'ssmlGender':_0x379e20};_0x2f3e96[_0xfa55('0x35')]={'audioEncoding':_0xfa55('0x36'),'sampleRateHertz':0x1f40};var _0x3f1d7e={'url':_0x178fc8+'text:synthesize'+_0x1f5311,'method':_0xfa55('0x37'),'json':!![],'body':_0x2f3e96};return rp(_0x3f1d7e)['then'](function(_0x276d7d){return new BPromise(function(_0x490480,_0x25fc81){_0xa932ee=path[_0xfa55('0x24')](__dirname,_0xfa55('0x25'),rs['generate'](0x4)+'.mp3');var _0x2a41b0=Buffer[_0xfa55('0x38')](_0x276d7d[_0xfa55('0x39')],_0xfa55('0x29'));return fs[_0xfa55('0x3a')](_0xa932ee,_0x2a41b0,function(_0xe1c305){_0x25fc81(_0xe1c305);},function(_0x3693b8){fs[_0xfa55('0x2b')](_0xa932ee,_0xfa55('0x2c'));_0x490480(_0x3693b8);});});})[_0xfa55('0x2a')](function(_0x1519fc){_0x380625=path[_0xfa55('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0xfa55('0x27'));return convertFile(_0xa932ee,_0x380625);})[_0xfa55('0x2a')](function(){try{fs[_0xfa55('0x1b')](_0xa932ee);fs['chmodSync'](_0x380625,_0xfa55('0x2c'));}catch(_0x522983){logger[_0xfa55('0x13')](_0x522983);}logger[_0xfa55('0x18')](_0xfa55('0x3b'),_0x380625[_0xfa55('0x2d')]('.')[0x0]);return _0x380625[_0xfa55('0x2d')]('.')[0x0];});};exports[_0xfa55('0x3c')]=function(_0x2f52aa,_0x29530a){var _0x433384,_0x4b06c6;return tts(_0x2f52aa,_0x29530a||'en',0x1)[_0xfa55('0x2a')](function(_0x16e85a){logger[_0xfa55('0x18')](_0x16e85a);_0x433384=path[_0xfa55('0x24')](__dirname,_0xfa55('0x25'),rs[_0xfa55('0x26')](0x4)+_0xfa55('0x3d'));return downloadFile(_0x16e85a,_0x433384);})[_0xfa55('0x2a')](function(){_0x4b06c6=path[_0xfa55('0x24')](__dirname,_0xfa55('0x25'),rs['generate'](0x4)+_0xfa55('0x27'));return convertFile(_0x433384,_0x4b06c6);})['then'](function(){try{fs[_0xfa55('0x1b')](_0x433384);fs[_0xfa55('0x2b')](_0x4b06c6,_0xfa55('0x2c'));}catch(_0x10c561){logger[_0xfa55('0x13')](_0x10c561);}logger[_0xfa55('0x18')](_0xfa55('0x3e'),_0x4b06c6['split']('.')[0x0]);return _0x4b06c6[_0xfa55('0x2d')]('.')[0x0];});};exports[_0xfa55('0x3f')]=function(_0x4b7cab,_0x2bacd7,_0x3c40ac){return google[_0xfa55('0x40')](_0x4b7cab,_0x2bacd7,_0x3c40ac)['then'](function(_0x48be0d){logger['info'](_0x48be0d[_0xfa55('0x41')]);return rp(_0x48be0d);})[_0xfa55('0x2a')](function(_0x56e7ec){var _0x381bea='';var _0x4c1891=0x0;try{fs[_0xfa55('0x1b')](_0x4b7cab);}catch(_0x2cc1ce){logger[_0xfa55('0x13')](_0x2cc1ce);}if(_0x56e7ec&&_0x56e7ec[_0xfa55('0x42')]){_0x381bea=_0x56e7ec[_0xfa55('0x42')]['map'](function(_0xe66e7f){return _0xe66e7f&&_0xe66e7f['alternatives'][0x0]&&_0xe66e7f[_0xfa55('0x43')][0x0][_0xfa55('0x44')]?_0xe66e7f['alternatives'][0x0][_0xfa55('0x44')]:'';})[_0xfa55('0x45')]('\x0a');_0x4c1891=_0x56e7ec[_0xfa55('0x42')][_0xfa55('0x46')](function(_0x598919){return _0x598919&&_0x598919[_0xfa55('0x43')][0x0]&&_0x598919[_0xfa55('0x43')][0x0]['confidence']?_0x598919[_0xfa55('0x43')][0x0][_0xfa55('0x47')]:0x0;})[_0xfa55('0x45')]('\x0a');}logger[_0xfa55('0x18')](_0xfa55('0x48'),_0x381bea);logger[_0xfa55('0x18')](_0xfa55('0x49'),_0x4c1891);return{'transcript':_0x381bea,'confidence':_0x4c1891};})['catch'](function(_0x35f6e2){logger[_0xfa55('0x13')]('[%s]\x20%s:%s',_0x35f6e2[_0xfa55('0x12')],_0x35f6e2['name'],_0x35f6e2['message']);});};exports[_0xfa55('0x4a')]=function(_0x370109,_0x3d969e,_0x5f05a5,_0x4ef8e0){var _0x5e903a=apiai(_0x3d969e,{'language':_0x4ef8e0||'en'});return _0x5e903a[_0xfa55('0x4b')](_0x5f05a5,{'sessionId':md5(_0x370109)})[_0xfa55('0x2a')](function(_0x43d88f){logger[_0xfa55('0x18')](JSON[_0xfa55('0x4c')](_0x43d88f));return{'source':_0x43d88f[_0xfa55('0x4d')][_0xfa55('0x4e')],'resolvedQuery':_0x43d88f[_0xfa55('0x4d')][_0xfa55('0x4f')],'action':_0x43d88f[_0xfa55('0x4d')][_0xfa55('0x50')],'actionIncomplete':_0x43d88f[_0xfa55('0x4d')][_0xfa55('0x51')],'speech':_0x43d88f['result']['fulfillment'][_0xfa55('0x52')],'score':_0x43d88f[_0xfa55('0x4d')][_0xfa55('0x53')],'statusCode':_0x43d88f[_0xfa55('0x54')]['code'],'endConversation':_0x43d88f['result'][_0xfa55('0x55')]['endConversation']||![],'isFallbackIntent':_0x43d88f['result'][_0xfa55('0x55')][_0xfa55('0x56')]};});};exports[_0xfa55('0x57')]=function(_0x478834,_0x1f1df4,_0x5e8508,_0x2dae6e){return tilde['asr'](_0x478834,_0x1f1df4,_0x5e8508,_0x2dae6e)[_0xfa55('0x2a')](function(_0x473d07){try{fs[_0xfa55('0x1b')](_0x478834);}catch(_0x21d39a){logger[_0xfa55('0x13')](_0x21d39a);}logger[_0xfa55('0x18')](_0xfa55('0x58'),_0x473d07[_0xfa55('0x44')]);logger[_0xfa55('0x18')](_0xfa55('0x59'),_0x473d07[_0xfa55('0x47')]);return _0x473d07;});};exports[_0xfa55('0x5a')]=function(_0x1207a7,_0x39bc08,_0x581b5e,_0x3b6706,_0x347d1d,_0x3cf451){var _0x519338=path[_0xfa55('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0xfa55('0x3d'));var _0x1b4bb2;return aws[_0xfa55('0x5b')](_0x1207a7,_0x39bc08,_0x581b5e,_0x3b6706,_0x347d1d,_0x3cf451,_0x519338)['then'](function(){_0x1b4bb2=path['resolve'](__dirname,_0xfa55('0x25'),rs[_0xfa55('0x26')](0x4)+_0xfa55('0x27'));return convertFile(_0x519338,_0x1b4bb2);})[_0xfa55('0x2a')](function(){try{fs[_0xfa55('0x1b')](_0x519338);fs['chmodSync'](_0x1b4bb2,_0xfa55('0x2c'));}catch(_0x36daf4){logger['error'](_0x36daf4);}return _0x1b4bb2['split']('.')[0x0];});};exports[_0xfa55('0x5c')]=function(_0x4eecf7,_0x1929bf,_0x562bd7,_0x244f77,_0x2b005d,_0x2e0f2c){return aws[_0xfa55('0x5d')](_0x4eecf7,_0x1929bf,_0x562bd7,_0x244f77,_0x2b005d,_0x2e0f2c)[_0xfa55('0x2a')](function(_0x3b370c){logger[_0xfa55('0x18')](JSON[_0xfa55('0x4c')](_0x3b370c));return _0x3b370c;});};exports['ispeechTTS']=function(_0x3f207c,_0x2d03c6,_0x3a6c22,_0x1ab61a){var _0xd4a95d=util[_0xfa55('0x5e')](_0xfa55('0x5f'),ISPEECH_API,_0x3f207c,encodeURIComponent(_0x2d03c6),_0x3a6c22,_0x1ab61a);var _0x12e7ac=path[_0xfa55('0x24')](__dirname,_0xfa55('0x25'),rs[_0xfa55('0x26')](0x4)+_0xfa55('0x3d'));var _0x58f179;return downloadFile(_0xd4a95d,_0x12e7ac)['then'](function(){_0x58f179=path[_0xfa55('0x24')](__dirname,_0xfa55('0x25'),rs[_0xfa55('0x26')](0x4)+'.wav');return convertFile(_0x12e7ac,_0x58f179);})['then'](function(){try{fs[_0xfa55('0x1b')](_0x12e7ac);fs['chmodSync'](_0x58f179,_0xfa55('0x2c'));}catch(_0x777372){logger[_0xfa55('0x13')](_0x777372);}return _0x58f179['split']('.')[0x0];});};exports[_0xfa55('0x60')]=function(_0x4bdb93,_0x3c49ed,_0x5cc420,_0x59a6b0){var _0x4cce84=util[_0xfa55('0x5e')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3c49ed,_0x5cc420,base64Encode(_0x4bdb93),_0x59a6b0?util[_0xfa55('0x5e')](_0xfa55('0x61'),encodeURIComponent(_0x59a6b0)):_0xfa55('0x62'));return uploadFile(_0x4cce84)['then'](function(_0x59d002){return querystring['parse'](_0x59d002);});};exports[_0xfa55('0x63')]=function(_0x15e0e6,_0x3445ea){return sestek[_0xfa55('0x64')](_0x15e0e6,_0x3445ea)[_0xfa55('0x2a')](function(_0x560dc4){logger[_0xfa55('0x18')](JSON[_0xfa55('0x4c')](_0x560dc4));var _0x1bd17f={'speech':_0x560dc4[_0xfa55('0x65')],'action':_0x560dc4[_0xfa55('0x66')]?_0x560dc4[_0xfa55('0x66')][_0xfa55('0x67')]:undefined,'actiondata':_0x560dc4[_0xfa55('0x66')]?_0x560dc4[_0xfa55('0x66')][_0xfa55('0x68')]:undefined};if(_0x560dc4['channelData']&&_0x560dc4['channelData'][_0xfa55('0x69')]){return base64Decode(_0x560dc4[_0xfa55('0x66')][_0xfa55('0x69')]['Data'],path[_0xfa55('0x24')](__dirname,'tmp',rs[_0xfa55('0x26')](0x4)+_0xfa55('0x27')))['then'](function(_0x1d0eaf){_0x1bd17f[_0xfa55('0x6a')]=_0x1d0eaf;return _0x1bd17f;});}return _0x1bd17f;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xf250=['freeform=3','sestekNDA','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','http','parse','bluebird','randomstring','util','querystring','apiai-promise','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','info','finish\x20download\x20file','close','unlink','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','text:synthesize','POST','resolve','.mp3','from','writeFile','split','googleTTS','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','catch','[%s]\x20%s:%s','googleDialogflow','stringify','result','resolvedQuery','action','actionIncomplete','fulfillment','status','code','endConversation','metadata','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s'];(function(_0x4b8435,_0x442eab){var _0x3aac28=function(_0x327f04){while(--_0x327f04){_0x4b8435['push'](_0x4b8435['shift']());}};_0x3aac28(++_0x442eab);}(_0xf250,0x135));var _0x0f25=function(_0x3ccdb0,_0x4adc30){_0x3ccdb0=_0x3ccdb0-0x0;var _0x58aa5b=_0xf250[_0x3ccdb0];return _0x58aa5b;};'use strict';var fs=require('fs');var path=require('path');var http=require(_0x0f25('0x0'));var https=require('https');var urlParse=require('url')[_0x0f25('0x1')];var BPromise=require(_0x0f25('0x2'));var rs=require(_0x0f25('0x3'));var sox=require('sox');var rp=require('request-promise');var util=require(_0x0f25('0x4'));var querystring=require(_0x0f25('0x5'));var tts=require('google-tts-api');var apiai=require(_0x0f25('0x6'));var md5=require('md5');var google=require(_0x0f25('0x7'));var aws=require('./aws');var tilde=require('./tilde');var sestek=require(_0x0f25('0x8'));var logger=require(_0x0f25('0x9'))(_0x0f25('0xa'));var ISPEECH_API=_0x0f25('0xb');function downloadFile(_0xe4a5ae,_0x20ac2a){return new BPromise(function(_0x537cf3,_0x11b72d){var _0x5e6ea1=urlParse(_0xe4a5ae);var _0x46dc0a=_0x5e6ea1[_0x0f25('0xc')]===_0x0f25('0xd')?https:http;var _0x30dcf3={'host':_0x5e6ea1[_0x0f25('0xe')],'path':_0x5e6ea1[_0x0f25('0xf')],'headers':{'user-agent':_0x0f25('0x10')}};_0x46dc0a[_0x0f25('0x11')](_0x30dcf3,function(_0x545895){if(_0x545895[_0x0f25('0x12')]!==0xc8){logger[_0x0f25('0x13')](_0x0f25('0x14')+_0xe4a5ae+_0x0f25('0x15')+_0x545895[_0x0f25('0x12')]+'\x20('+_0x545895[_0x0f25('0x16')]+')');_0x11b72d(new Error(_0x0f25('0x14')+_0xe4a5ae+'\x20failed,\x20status\x20code\x20=\x20'+_0x545895[_0x0f25('0x12')]+'\x20('+_0x545895[_0x0f25('0x16')]+')'));return;}var _0x11a7cf=fs['createWriteStream'](_0x20ac2a);_0x11a7cf['on']('finish',function(){logger[_0x0f25('0x17')](_0x0f25('0x18'));_0x11a7cf[_0x0f25('0x19')](_0x537cf3);});_0x11a7cf['on']('error',function(_0x122ab1){fs[_0x0f25('0x1a')](_0x20ac2a);logger['error']('download\x20error',_0x122ab1);_0x11b72d(_0x122ab1);});_0x545895[_0x0f25('0x1b')](_0x11a7cf);})['on']('error',function(_0x4b8b9e){logger['error'](_0x4b8b9e);_0x11b72d(_0x4b8b9e);})[_0x0f25('0x1c')]();});}function uploadFile(_0x1d3399){return new BPromise(function(_0x2fe703,_0x2c0366){var _0x523dcf=urlParse(_0x1d3399);var _0x23af9f=_0x523dcf['protocol']===_0x0f25('0xd')?https:http;var _0x666d11={'host':_0x523dcf['host'],'path':_0x523dcf[_0x0f25('0xf')],'headers':{'user-agent':_0x0f25('0x10')}};_0x23af9f[_0x0f25('0x11')](_0x666d11,function(_0x333e05){if(_0x333e05[_0x0f25('0x12')]!==0xc8){_0x2c0366(new Error(_0x0f25('0x14')+_0x1d3399+_0x0f25('0x15')+_0x333e05[_0x0f25('0x12')]+'\x20('+_0x333e05[_0x0f25('0x16')]+')'));return;}var _0x18bb90='';_0x333e05['on'](_0x0f25('0x1d'),function(_0x27a191){_0x18bb90+=_0x27a191;});_0x333e05['on'](_0x0f25('0x1c'),function(){_0x2fe703(_0x18bb90);});})['on'](_0x0f25('0x13'),function(_0x12cdec){_0x2c0366(_0x12cdec);})[_0x0f25('0x1c')]();});}function convertFile(_0x3e6057,_0x22c934){return new BPromise(function(_0x59f20e,_0x261c9c){var _0x44b839=sox[_0x0f25('0x1e')](_0x3e6057,_0x22c934,{'sampleRate':0x1f40,'format':_0x0f25('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x44b839['on']('error',function(_0x259db5){logger[_0x0f25('0x13')](_0x0f25('0x20'),_0x259db5);_0x261c9c(_0x259db5);});_0x44b839['on'](_0x0f25('0x1c'),function(){logger[_0x0f25('0x17')](_0x0f25('0x21'));_0x59f20e();});_0x44b839[_0x0f25('0x22')]();});}function base64Decode(_0x19bd8f,_0x2c43e7){var _0xb76631=path['resolve'](__dirname,_0x0f25('0x23'),rs[_0x0f25('0x24')](0x4)+_0x0f25('0x25'));fs[_0x0f25('0x26')](_0xb76631,_0x19bd8f,_0x0f25('0x27'));return convertFile(_0xb76631,_0x2c43e7)[_0x0f25('0x28')](function(){try{fs[_0x0f25('0x1a')](_0xb76631);fs[_0x0f25('0x29')](_0x2c43e7,_0x0f25('0x2a'));}catch(_0x27da15){logger['error'](_0x27da15);}return _0x2c43e7['split']('.')[0x0];});}function base64Encode(_0x261a6f){var _0xafeecf=fs['readFileSync'](_0x261a6f);return new Buffer(_0xafeecf)[_0x0f25('0x2b')]('base64');}exports['googleCloudTTS']=function(_0x132a13,_0x17923a,_0x2c0fc6,_0x4ac456,_0x167c78,_0x59941e){var _0x23a841,_0x1dffcf;var _0x4935af=_0x0f25('0x2c');var _0x274812=_0x0f25('0x2d')+_0x132a13;var _0x9ef54={};if(_0x17923a===_0x0f25('0x2e')){_0x9ef54[_0x0f25('0x2f')]={'ssml':_0x2c0fc6};}else{_0x9ef54[_0x0f25('0x2f')]={'text':_0x2c0fc6};};_0x9ef54[_0x0f25('0x30')]={'languageCode':_0x4ac456,'ssmlGender':_0x167c78};_0x9ef54['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0xeea0a7={'url':_0x4935af+_0x0f25('0x31')+_0x274812,'method':_0x0f25('0x32'),'json':!![],'body':_0x9ef54};return rp(_0xeea0a7)['then'](function(_0x4def12){return new BPromise(function(_0x20c379,_0x58dce4){_0x23a841=path[_0x0f25('0x33')](__dirname,_0x0f25('0x23'),rs[_0x0f25('0x24')](0x4)+_0x0f25('0x34'));var _0x8534f0=Buffer[_0x0f25('0x35')](_0x4def12['audioContent'],_0x0f25('0x27'));return fs[_0x0f25('0x36')](_0x23a841,_0x8534f0,function(_0x4df40d){_0x58dce4(_0x4df40d);},function(_0x2c1a99){fs[_0x0f25('0x29')](_0x23a841,_0x0f25('0x2a'));_0x20c379(_0x2c1a99);});});})[_0x0f25('0x28')](function(_0xb4ef7b){_0x1dffcf=path[_0x0f25('0x33')](__dirname,_0x0f25('0x23'),rs[_0x0f25('0x24')](0x4)+_0x0f25('0x25'));return convertFile(_0x23a841,_0x1dffcf);})[_0x0f25('0x28')](function(){try{fs['unlink'](_0x23a841);fs['chmodSync'](_0x1dffcf,'777');}catch(_0x475b4){logger[_0x0f25('0x13')](_0x475b4);}logger[_0x0f25('0x17')]('googleCloudTTS\x20path',_0x1dffcf[_0x0f25('0x37')]('.')[0x0]);return _0x1dffcf['split']('.')[0x0];});};exports[_0x0f25('0x38')]=function(_0x122e60,_0x8fb8ef){var _0x326bc8,_0x2ab44a;return tts(_0x122e60,_0x8fb8ef||'en',0x1)[_0x0f25('0x28')](function(_0x59e785){logger['info'](_0x59e785);_0x326bc8=path[_0x0f25('0x33')](__dirname,_0x0f25('0x23'),rs[_0x0f25('0x24')](0x4)+'.mp3');return downloadFile(_0x59e785,_0x326bc8);})['then'](function(){_0x2ab44a=path[_0x0f25('0x33')](__dirname,_0x0f25('0x23'),rs[_0x0f25('0x24')](0x4)+_0x0f25('0x25'));return convertFile(_0x326bc8,_0x2ab44a);})[_0x0f25('0x28')](function(){try{fs[_0x0f25('0x1a')](_0x326bc8);fs[_0x0f25('0x29')](_0x2ab44a,'777');}catch(_0x41c516){logger[_0x0f25('0x13')](_0x41c516);}logger[_0x0f25('0x17')](_0x0f25('0x39'),_0x2ab44a['split']('.')[0x0]);return _0x2ab44a[_0x0f25('0x37')]('.')[0x0];});};exports[_0x0f25('0x3a')]=function(_0x42427a,_0x3a8bc1,_0x3b8166){return google[_0x0f25('0x3b')](_0x42427a,_0x3a8bc1,_0x3b8166)[_0x0f25('0x28')](function(_0x2c022c){logger[_0x0f25('0x17')](_0x2c022c['uri']);return rp(_0x2c022c);})['then'](function(_0x4c303f){var _0x54da78='';var _0xcdd6e=0x0;try{fs[_0x0f25('0x1a')](_0x42427a);}catch(_0x2b8d7f){logger[_0x0f25('0x13')](_0x2b8d7f);}if(_0x4c303f&&_0x4c303f[_0x0f25('0x3c')]){_0x54da78=_0x4c303f['results'][_0x0f25('0x3d')](function(_0x3a1192){return _0x3a1192&&_0x3a1192[_0x0f25('0x3e')][0x0]&&_0x3a1192[_0x0f25('0x3e')][0x0]['transcript']?_0x3a1192[_0x0f25('0x3e')][0x0][_0x0f25('0x3f')]:'';})[_0x0f25('0x40')]('\x0a');_0xcdd6e=_0x4c303f['results'][_0x0f25('0x3d')](function(_0x4c9a95){return _0x4c9a95&&_0x4c9a95[_0x0f25('0x3e')][0x0]&&_0x4c9a95[_0x0f25('0x3e')][0x0]['confidence']?_0x4c9a95['alternatives'][0x0][_0x0f25('0x41')]:0x0;})['join']('\x0a');}logger['info']('googleASR\x20transcription',_0x54da78);logger['info']('googleASR\x20confidence',_0xcdd6e);return{'transcript':_0x54da78,'confidence':_0xcdd6e};})[_0x0f25('0x42')](function(_0xae8b8){logger['error'](_0x0f25('0x43'),_0xae8b8[_0x0f25('0x12')],_0xae8b8['name'],_0xae8b8['message']);});};exports[_0x0f25('0x44')]=function(_0x1cf922,_0x16cf4b,_0x3bd3c8,_0x46fc68){var _0x411cd5=apiai(_0x16cf4b,{'language':_0x46fc68||'en'});return _0x411cd5['textRequest'](_0x3bd3c8,{'sessionId':md5(_0x1cf922)})[_0x0f25('0x28')](function(_0x197a7b){logger[_0x0f25('0x17')](JSON[_0x0f25('0x45')](_0x197a7b));return{'source':_0x197a7b[_0x0f25('0x46')]['source'],'resolvedQuery':_0x197a7b[_0x0f25('0x46')][_0x0f25('0x47')],'action':_0x197a7b[_0x0f25('0x46')][_0x0f25('0x48')],'actionIncomplete':_0x197a7b[_0x0f25('0x46')][_0x0f25('0x49')],'speech':_0x197a7b[_0x0f25('0x46')][_0x0f25('0x4a')]['speech'],'score':_0x197a7b[_0x0f25('0x46')]['score'],'statusCode':_0x197a7b[_0x0f25('0x4b')][_0x0f25('0x4c')],'endConversation':_0x197a7b[_0x0f25('0x46')]['metadata'][_0x0f25('0x4d')]||![],'isFallbackIntent':_0x197a7b[_0x0f25('0x46')][_0x0f25('0x4e')][_0x0f25('0x4f')]};});};exports[_0x0f25('0x50')]=function(_0x45478f,_0x34cc4a,_0x328b0d,_0x2e28a9){return tilde['asr'](_0x45478f,_0x34cc4a,_0x328b0d,_0x2e28a9)['then'](function(_0x5b4b31){try{fs[_0x0f25('0x1a')](_0x45478f);}catch(_0xaed1c7){logger[_0x0f25('0x13')](_0xaed1c7);}logger[_0x0f25('0x17')](_0x0f25('0x51'),_0x5b4b31['transcript']);logger['info'](_0x0f25('0x52'),_0x5b4b31[_0x0f25('0x41')]);return _0x5b4b31;});};exports[_0x0f25('0x53')]=function(_0x2adf77,_0x3d689a,_0x31dcc2,_0x4526b3,_0x385074,_0x2b7aee){var _0x11e2db=path['resolve'](__dirname,'tmp',rs[_0x0f25('0x24')](0x4)+_0x0f25('0x34'));var _0x53afae;return aws[_0x0f25('0x54')](_0x2adf77,_0x3d689a,_0x31dcc2,_0x4526b3,_0x385074,_0x2b7aee,_0x11e2db)[_0x0f25('0x28')](function(){_0x53afae=path[_0x0f25('0x33')](__dirname,_0x0f25('0x23'),rs[_0x0f25('0x24')](0x4)+_0x0f25('0x25'));return convertFile(_0x11e2db,_0x53afae);})[_0x0f25('0x28')](function(){try{fs[_0x0f25('0x1a')](_0x11e2db);fs[_0x0f25('0x29')](_0x53afae,_0x0f25('0x2a'));}catch(_0x51e425){logger[_0x0f25('0x13')](_0x51e425);}return _0x53afae[_0x0f25('0x37')]('.')[0x0];});};exports[_0x0f25('0x55')]=function(_0x35e93b,_0x255544,_0x3141ad,_0x8fe7da,_0x2f8870,_0x5f3924){return aws['lex'](_0x35e93b,_0x255544,_0x3141ad,_0x8fe7da,_0x2f8870,_0x5f3924)['then'](function(_0x130f10){logger[_0x0f25('0x17')](JSON['stringify'](_0x130f10));return _0x130f10;});};exports[_0x0f25('0x56')]=function(_0x64ca26,_0xf643a5,_0x7170dc,_0x4b7f8f){var _0x57e059=util[_0x0f25('0x57')](_0x0f25('0x58'),ISPEECH_API,_0x64ca26,encodeURIComponent(_0xf643a5),_0x7170dc,_0x4b7f8f);var _0x2237fd=path[_0x0f25('0x33')](__dirname,_0x0f25('0x23'),rs[_0x0f25('0x24')](0x4)+'.mp3');var _0x2701e6;return downloadFile(_0x57e059,_0x2237fd)[_0x0f25('0x28')](function(){_0x2701e6=path['resolve'](__dirname,_0x0f25('0x23'),rs[_0x0f25('0x24')](0x4)+_0x0f25('0x25'));return convertFile(_0x2237fd,_0x2701e6);})[_0x0f25('0x28')](function(){try{fs[_0x0f25('0x1a')](_0x2237fd);fs[_0x0f25('0x29')](_0x2701e6,_0x0f25('0x2a'));}catch(_0x3aa277){logger['error'](_0x3aa277);}return _0x2701e6[_0x0f25('0x37')]('.')[0x0];});};exports[_0x0f25('0x59')]=function(_0x75b169,_0x23b21f,_0x2206d9,_0x5c4f10){var _0xaa1578=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x23b21f,_0x2206d9,base64Encode(_0x75b169),_0x5c4f10?util[_0x0f25('0x57')](_0x0f25('0x5a'),encodeURIComponent(_0x5c4f10)):_0x0f25('0x5b'));return uploadFile(_0xaa1578)['then'](function(_0x18b95e){return querystring[_0x0f25('0x1')](_0x18b95e);});};exports[_0x0f25('0x5c')]=function(_0x5688df,_0x310c6c){return sestek['nda'](_0x5688df,_0x310c6c)[_0x0f25('0x28')](function(_0x4b156e){logger[_0x0f25('0x17')](JSON['stringify'](_0x4b156e));var _0x22c0ff={'speech':_0x4b156e[_0x0f25('0x5d')],'action':_0x4b156e[_0x0f25('0x5e')]?_0x4b156e[_0x0f25('0x5e')][_0x0f25('0x5f')]:undefined,'actiondata':_0x4b156e[_0x0f25('0x5e')]?_0x4b156e[_0x0f25('0x5e')]['CustomActionData']:undefined};if(_0x4b156e['channelData']&&_0x4b156e['channelData'][_0x0f25('0x60')]){return base64Decode(_0x4b156e['channelData']['AudioFromTts'][_0x0f25('0x61')],path[_0x0f25('0x33')](__dirname,'tmp',rs[_0x0f25('0x24')](0x4)+_0x0f25('0x25')))[_0x0f25('0x28')](function(_0x326f24){_0x22c0ff[_0x0f25('0x62')]=_0x326f24;return _0x22c0ff;});}return _0x22c0ff;});};exports[_0x0f25('0x63')]=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 7008704..5485171 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 _0xfcbf=['./nda','exports'];(function(_0x56ca0f,_0x52d7d2){var _0x3893ec=function(_0x5130ce){while(--_0x5130ce){_0x56ca0f['push'](_0x56ca0f['shift']());}};_0x3893ec(++_0x52d7d2);}(_0xfcbf,0x192));var _0xffcb=function(_0x285cd0,_0x457f37){_0x285cd0=_0x285cd0-0x0;var _0x5afb57=_0xfcbf[_0x285cd0];return _0x5afb57;};var nda=require(_0xffcb('0x0'));module[_0xffcb('0x1')]={'nda':nda}; \ No newline at end of file +var _0x5392=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5392,0xa7));var _0x2539=function(_0x46b1bd,_0x1940d9){_0x46b1bd=_0x46b1bd-0x0;var _0x1b2f0e=_0x5392[_0x46b1bd];return _0x1b2f0e;};var nda=require('./nda');module[_0x2539('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 9088e5f..aa42355 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 _0xb8df=['../../../../../config/logger','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','callerid','dnid','extension','text','Bearer\x20','access_token','channelData','ProjectName','project','ndagenerate_audio','body','AudioOutputSettings','custom_action','CustomAction','custom_action_data','stringify','request-promise','url'];(function(_0x4586a9,_0x3cff02){var _0x18bc48=function(_0x591b45){while(--_0x591b45){_0x4586a9['push'](_0x4586a9['shift']());}};_0x18bc48(++_0x3cff02);}(_0xb8df,0x194));var _0xfb8d=function(_0x4320ce,_0x49f5f5){_0x4320ce=_0x4320ce-0x0;var _0x537dae=_0xb8df[_0x4320ce];return _0x537dae;};'use strict';var rp=require(_0xfb8d('0x0'));var url=require(_0xfb8d('0x1'));var logger=require(_0xfb8d('0x2'))('agi');module['exports']=function(_0x128bba,_0xc68ff5){var _0x15338c={'method':_0xfb8d('0x3'),'uri':url[_0xfb8d('0x4')](_0xc68ff5[_0xfb8d('0x5')],_0xfb8d('0x6')),'form':{'grant_type':_0xfb8d('0x7'),'username':_0xc68ff5[_0xfb8d('0x8')],'password':_0xc68ff5['password']},'json':!![]};return rp(_0x15338c)[_0xfb8d('0x9')](function(_0x35c346){var _0x2de28c={'method':_0xfb8d('0x3'),'uri':url[_0xfb8d('0x4')](_0xc68ff5[_0xfb8d('0xa')],_0xfb8d('0xb')),'body':{'type':_0xc68ff5['ndaactivity_type']||_0xfb8d('0xc'),'channelId':'Nda','conversation':{'id':_0x128bba['uniqueid']},'from':{'id':_0x128bba[_0xfb8d('0xd')],'name':_0x128bba['calleridname']},'recipient':{'id':_0x128bba[_0xfb8d('0xe')],'name':_0x128bba[_0xfb8d('0xf')]},'text':_0xc68ff5[_0xfb8d('0x10')],'channelData':{}},'headers':{'Authorization':_0xfb8d('0x11')+_0x35c346[_0xfb8d('0x12')]},'json':!![]};if(_0xc68ff5['project']){_0x2de28c['body'][_0xfb8d('0x13')][_0xfb8d('0x14')]=_0xc68ff5[_0xfb8d('0x15')];}if(_0xc68ff5[_0xfb8d('0x16')]=='1'){_0x2de28c[_0xfb8d('0x17')][_0xfb8d('0x13')][_0xfb8d('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0xc68ff5[_0xfb8d('0x19')]){_0x2de28c[_0xfb8d('0x17')][_0xfb8d('0x13')][_0xfb8d('0x1a')]=_0xc68ff5[_0xfb8d('0x19')];if(_0xc68ff5[_0xfb8d('0x1b')]){_0x2de28c[_0xfb8d('0x17')][_0xfb8d('0x13')]['CustomActionData']=_0xc68ff5[_0xfb8d('0x1b')];}}logger['info'](JSON[_0xfb8d('0x1c')](_0x2de28c));return rp(_0x2de28c);});}; \ No newline at end of file +var _0xbe43=['ndauth_url','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','project','body','ProjectName','channelData','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','../../../../../config/logger','resolve'];(function(_0x11259f,_0x23b506){var _0x356dad=function(_0x5045e6){while(--_0x5045e6){_0x11259f['push'](_0x11259f['shift']());}};_0x356dad(++_0x23b506);}(_0xbe43,0x1b1));var _0x3be4=function(_0x1c11ab,_0x38350b){_0x1c11ab=_0x1c11ab-0x0;var _0x5238ff=_0xbe43[_0x1c11ab];return _0x5238ff;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x3be4('0x0'))('agi');module['exports']=function(_0xdd0a65,_0x2e6a57){var _0x33b384={'method':'POST','uri':url[_0x3be4('0x1')](_0x2e6a57[_0x3be4('0x2')],_0x3be4('0x3')),'form':{'grant_type':_0x3be4('0x4'),'username':_0x2e6a57[_0x3be4('0x5')],'password':_0x2e6a57[_0x3be4('0x4')]},'json':!![]};return rp(_0x33b384)[_0x3be4('0x6')](function(_0x303028){var _0x153b2e={'method':_0x3be4('0x7'),'uri':url[_0x3be4('0x1')](_0x2e6a57[_0x3be4('0x8')],_0x3be4('0x9')),'body':{'type':_0x2e6a57[_0x3be4('0xa')]||_0x3be4('0xb'),'channelId':_0x3be4('0xc'),'conversation':{'id':_0xdd0a65[_0x3be4('0xd')]},'from':{'id':_0xdd0a65[_0x3be4('0xe')],'name':_0xdd0a65[_0x3be4('0xf')]},'recipient':{'id':_0xdd0a65[_0x3be4('0x10')],'name':_0xdd0a65[_0x3be4('0x11')]},'text':_0x2e6a57['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x303028['access_token']},'json':!![]};if(_0x2e6a57[_0x3be4('0x12')]){_0x153b2e[_0x3be4('0x13')]['channelData'][_0x3be4('0x14')]=_0x2e6a57[_0x3be4('0x12')];}if(_0x2e6a57['ndagenerate_audio']=='1'){_0x153b2e[_0x3be4('0x13')][_0x3be4('0x15')][_0x3be4('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3be4('0x17')};}if(_0x2e6a57[_0x3be4('0x18')]){_0x153b2e[_0x3be4('0x13')][_0x3be4('0x15')]['CustomAction']=_0x2e6a57[_0x3be4('0x18')];if(_0x2e6a57[_0x3be4('0x19')]){_0x153b2e['body'][_0x3be4('0x15')][_0x3be4('0x1a')]=_0x2e6a57[_0x3be4('0x19')];}}logger[_0x3be4('0x1b')](JSON[_0x3be4('0x1c')](_0x153b2e));return rp(_0x153b2e);});}; \ 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 e50c714..66d3414 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 _0x4407=['./lib/api'];(function(_0x381eae,_0x499a30){var _0x34c099=function(_0x4296ba){while(--_0x4296ba){_0x381eae['push'](_0x381eae['shift']());}};_0x34c099(++_0x499a30);}(_0x4407,0x15e));var _0x7440=function(_0x54169,_0x5cee48){_0x54169=_0x54169-0x0;var _0x4b9d8c=_0x4407[_0x54169];return _0x4b9d8c;};'use strict';var asr=require(_0x7440('0x0'));module['exports']=function(_0x4ab9ce,_0x50ba4d,_0x2401ff,_0x5aa2cb){return asr(_0x4ab9ce,_0x50ba4d,_0x2401ff,_0x5aa2cb);}; \ No newline at end of file +var _0xd8db=['exports','./lib/api'];(function(_0x309a31,_0x2ef3a9){var _0x66ad20=function(_0x1ae547){while(--_0x1ae547){_0x309a31['push'](_0x309a31['shift']());}};_0x66ad20(++_0x2ef3a9);}(_0xd8db,0x69));var _0xbd8d=function(_0x51a8ea,_0x3c6785){_0x51a8ea=_0x51a8ea-0x0;var _0x516fb1=_0xd8db[_0x51a8ea];return _0x516fb1;};'use strict';var asr=require(_0xbd8d('0x0'));module[_0xbd8d('0x1')]=function(_0x4409cf,_0x2729e6,_0x1cc609,_0x47f249){return asr(_0x4409cf,_0x2729e6,_0x1cc609,_0x47f249);}; \ 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 e0a328d..b59a3fa 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 _0x90ac=['createReadStream','data','close','EOS','error','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','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.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','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','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify'];(function(_0x3c392c,_0x31f46f){var _0x2f6813=function(_0x77f678){while(--_0x77f678){_0x3c392c['push'](_0x3c392c['shift']());}};_0x2f6813(++_0x31f46f);}(_0x90ac,0x1ce));var _0xc90a=function(_0x4578aa,_0x318ec8){_0x4578aa=_0x4578aa-0x0;var _0xa6ca87=_0x90ac[_0x4578aa];return _0xa6ca87;};'use strict';var BPromise=require(_0xc90a('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xc90a('0x1'));var crypto=require(_0xc90a('0x2'));var logger=require(_0xc90a('0x3'))(_0xc90a('0x4'));module[_0xc90a('0x5')]=function(_0x218bf5,_0x482777,_0x3dd341,_0x292a75){return new BPromise(function(_0x4b79e4,_0x3b7dae){logger[_0xc90a('0x6')](_0xc90a('0x7'),_0x292a75||_0xc90a('0x8'));var _0x24e9a7=new WebSocket(_0x292a75||_0xc90a('0x8'),{'perMessageDeflate':![]});var _0x249d06='';var _0x2dbc7e='0';var _0x71dec8='1';var _0x4182f4=_0xc90a('0x9');function _0x1f911e(_0x55cf9c){var _0xb796e6=crypto[_0xc90a('0xa')](_0xc90a('0xb'));_0xb796e6[_0xc90a('0xc')](_0x55cf9c);return _0xb796e6['digest'](_0xc90a('0xd'));}function _0x19a8b5(){try{logger[_0xc90a('0x6')](_0xc90a('0xe'));var _0x46b7b4=moment()[_0xc90a('0xf')]();var _0x226aa7=_0x1f911e(_0x46b7b4+_0x482777+_0x3dd341);_0x24e9a7[_0xc90a('0x10')](JSON[_0xc90a('0x11')]({'appID':_0x482777,'timestamp':_0x46b7b4,'appKey':_0x226aa7}));var _0x29ac68=fs[_0xc90a('0x12')](_0x218bf5);_0x29ac68['on'](_0xc90a('0x13'),function(_0x4b2e89){_0x24e9a7[_0xc90a('0x10')](_0x4b2e89);});_0x29ac68['on'](_0xc90a('0x14'),function(){_0x24e9a7[_0xc90a('0x10')](_0xc90a('0x15'));});}catch(_0x567583){logger[_0xc90a('0x16')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x567583));_0x24e9a7['terminate']();}}function _0x51c332(_0x41e603){try{if(_0x41e603){var _0x236a38=JSON['parse'](_0x41e603);switch(_0x236a38[_0xc90a('0x17')]){case 0x0:if(_0x236a38[_0xc90a('0x18')]){if(_0x236a38['result'][_0xc90a('0x19')]){logger[_0xc90a('0x6')](_0xc90a('0x1a'),JSON[_0xc90a('0x11')](_0x236a38[_0xc90a('0x18')][_0xc90a('0x1b')]));_0x249d06=_0x236a38['result']['hypotheses'][0x0]['transcript'];_0x2dbc7e=_0x236a38[_0xc90a('0x18')]['hypotheses'][0x0][_0xc90a('0x1c')];_0x71dec8='0';_0x4182f4=_0xc90a('0x1d');_0x24e9a7[_0xc90a('0x1e')]();}}break;case 0x1:logger[_0xc90a('0x6')](_0xc90a('0x9'));_0x71dec8='1';_0x4182f4=_0xc90a('0x9');break;case 0x2:logger[_0xc90a('0x6')](_0xc90a('0x1f'));_0x71dec8='2';_0x4182f4=_0xc90a('0x1f');break;case 0x9:logger[_0xc90a('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x71dec8='9';_0x4182f4=_0xc90a('0x20');break;case 0xa:logger[_0xc90a('0x6')](_0xc90a('0x21'));_0x71dec8='10';_0x4182f4='Authentication\x20failed.';break;case 0xb:logger[_0xc90a('0x6')](_0xc90a('0x22'));_0x71dec8='11';_0x4182f4=_0xc90a('0x22');}}}catch(_0x5b81ee){logger['error'](_0xc90a('0x23'),JSON[_0xc90a('0x11')](_0x5b81ee));_0x24e9a7[_0xc90a('0x1e')]();}}function _0x9d17ec(){logger[_0xc90a('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x4b79e4({'transcript':_0x249d06,'confidence':_0x2dbc7e,'status':_0x71dec8,'status_message':_0x4182f4});}function _0x1fb6a9(_0x19b41f){logger['error'](_0xc90a('0x24'));if(!_[_0xc90a('0x25')](_0x19b41f)){logger[_0xc90a('0x16')](_[_0xc90a('0x26')](_0x19b41f)?JSON[_0xc90a('0x11')](_0x19b41f):_0x19b41f);}}_0x24e9a7['on']('open',_0x19a8b5);_0x24e9a7['on'](_0xc90a('0x27'),_0x51c332);_0x24e9a7['on'](_0xc90a('0x14'),_0x9d17ec);_0x24e9a7['on'](_0xc90a('0x16'),_0x1fb6a9);});}; \ No newline at end of file +var _0xf32f=['final','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isObject','open','bluebird','lodash','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','status','result'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xf32f,0x1ef));var _0xff32=function(_0x408501,_0x81d8df){_0x408501=_0x408501-0x0;var _0x16f85f=_0xf32f[_0x408501];return _0x16f85f;};'use strict';var BPromise=require(_0xff32('0x0'));var _=require(_0xff32('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xff32('0x2'));var logger=require(_0xff32('0x3'))('agi');module[_0xff32('0x4')]=function(_0x13b0c0,_0x1c0e85,_0x4737a3,_0x76168){return new BPromise(function(_0x486005,_0x187da6){logger[_0xff32('0x5')](_0xff32('0x6'),_0x76168||_0xff32('0x7'));var _0x27211b=new WebSocket(_0x76168||_0xff32('0x7'),{'perMessageDeflate':![]});var _0x175f7b='';var _0x21639a='0';var _0x3b151d='1';var _0x13aa82=_0xff32('0x8');function _0x2a1a10(_0x5de0a8){var _0xa0b1af=crypto['createHash'](_0xff32('0x9'));_0xa0b1af['update'](_0x5de0a8);return _0xa0b1af[_0xff32('0xa')](_0xff32('0xb'));}function _0x5e7279(){try{logger[_0xff32('0x5')](_0xff32('0xc'));var _0x573496=moment()[_0xff32('0xd')]();var _0x1fe797=_0x2a1a10(_0x573496+_0x1c0e85+_0x4737a3);_0x27211b[_0xff32('0xe')](JSON[_0xff32('0xf')]({'appID':_0x1c0e85,'timestamp':_0x573496,'appKey':_0x1fe797}));var _0x5857c5=fs[_0xff32('0x10')](_0x13b0c0);_0x5857c5['on']('data',function(_0x1f48c2){_0x27211b[_0xff32('0xe')](_0x1f48c2);});_0x5857c5['on'](_0xff32('0x11'),function(){_0x27211b['send'](_0xff32('0x12'));});}catch(_0x24ac7d){logger['error'](_0xff32('0x13'),JSON[_0xff32('0xf')](_0x24ac7d));_0x27211b[_0xff32('0x14')]();}}function _0x4a7ced(_0x5a4597){try{if(_0x5a4597){var _0x2987ae=JSON['parse'](_0x5a4597);switch(_0x2987ae[_0xff32('0x15')]){case 0x0:if(_0x2987ae[_0xff32('0x16')]){if(_0x2987ae[_0xff32('0x16')][_0xff32('0x17')]){logger[_0xff32('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0xff32('0xf')](_0x2987ae[_0xff32('0x16')][_0xff32('0x18')]));_0x175f7b=_0x2987ae[_0xff32('0x16')]['hypotheses'][0x0][_0xff32('0x19')];_0x21639a=_0x2987ae['result'][_0xff32('0x18')][0x0][_0xff32('0x1a')];_0x3b151d='0';_0x13aa82=_0xff32('0x1b');_0x27211b[_0xff32('0x14')]();}}break;case 0x1:logger[_0xff32('0x5')](_0xff32('0x8'));_0x3b151d='1';_0x13aa82=_0xff32('0x8');break;case 0x2:logger['info'](_0xff32('0x1c'));_0x3b151d='2';_0x13aa82=_0xff32('0x1c');break;case 0x9:logger[_0xff32('0x5')](_0xff32('0x1d'));_0x3b151d='9';_0x13aa82='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0xff32('0x1e'));_0x3b151d='10';_0x13aa82=_0xff32('0x1e');break;case 0xb:logger['info'](_0xff32('0x1f'));_0x3b151d='11';_0x13aa82='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x129098){logger[_0xff32('0x20')](_0xff32('0x21'),JSON['stringify'](_0x129098));_0x27211b[_0xff32('0x14')]();}}function _0x56466c(){logger[_0xff32('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x486005({'transcript':_0x175f7b,'confidence':_0x21639a,'status':_0x3b151d,'status_message':_0x13aa82});}function _0x4b3abb(_0x3e13d5){logger['error'](_0xff32('0x22'));if(!_['isNil'](_0x3e13d5)){logger[_0xff32('0x20')](_[_0xff32('0x23')](_0x3e13d5)?JSON[_0xff32('0xf')](_0x3e13d5):_0x3e13d5);}}_0x27211b['on'](_0xff32('0x24'),_0x5e7279);_0x27211b['on']('message',_0x4a7ced);_0x27211b['on'](_0xff32('0x11'),_0x56466c);_0x27211b['on'](_0xff32('0x20'),_0x4b3abb);});}; \ 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 ace3148..b156283 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 _0x4ac7=['./asr'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x4ac7,0x13b));var _0x74ac=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4ac7[_0x432682];return _0x463d05;};var asr=require(_0x74ac('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x1485=['exports'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x1485,0x77));var _0x5148=function(_0x1f13f0,_0x66cc8d){_0x1f13f0=_0x1f13f0-0x0;var _0xeda5eb=_0x1485[_0x1f13f0];return _0xeda5eb;};var asr=require('./asr');module[_0x5148('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index bf88b90..1518cce 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 _0xfe60=['nextTick','inherits','exports','net','EventEmitter','./error','./channel','127.0.0.1','call','error','listening','connection','getConnections','emit','E_AGI_SERVER_ERROR','ready','code','close','E_AGI_SERVER_CLOSE'];(function(_0xe65499,_0x2e7f76){var _0x3b89b0=function(_0x470e84){while(--_0x470e84){_0xe65499['push'](_0xe65499['shift']());}};_0x3b89b0(++_0x2e7f76);}(_0xfe60,0x1cb));var _0x0fe6=function(_0x4cd34b,_0x2d8e36){_0x4cd34b=_0x4cd34b-0x0;var _0x22f1d2=_0xfe60[_0x4cd34b];return _0x22f1d2;};'use strict';var util=require('util');var net=require(_0x0fe6('0x0'));var EventEmitter=require('events')[_0x0fe6('0x1')];var AGIError=require(_0x0fe6('0x2'));var AGIChannel=require(_0x0fe6('0x3'));var AGIServer=function(_0x4aa401,_0x40740,_0x244c56){var _0x402912=this,_0x4aa401=_0x4aa401||0x11dd,_0x40740=_0x40740||_0x0fe6('0x4'),_0x1281fc=null,_0x13b947=0x0;EventEmitter[_0x0fe6('0x5')](_0x402912);function _0x24e88f(){if(!_0x4aa401){_0x402912['emit'](_0x0fe6('0x6'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x1281fc=net['createServer']();_0x1281fc['listen'](_0x4aa401,_0x40740);_0x1281fc['on'](_0x0fe6('0x7'),function(){_0x402912['emit'](_0x0fe6('0x7'));});_0x1281fc['on'](_0x0fe6('0x8'),function(_0x1a14f3){_0x1281fc[_0x0fe6('0x9')](function(_0x299994,_0x2498a0){if(_0x299994){_0x402912[_0x0fe6('0xa')]('error',new AGIError(_0x0fe6('0xb'),_0x299994));}else if(_0x244c56&&_0x244c56<0x0){_0x402912[_0x0fe6('0xa')](_0x0fe6('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x1a14f3['destroy']();}else if(_0x244c56&&_0x244c56>0x0&&_0x244c56<_0x2498a0){_0x13b947+=0x1;_0x402912[_0x0fe6('0xa')]('error',new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x13b947));_0x1a14f3['destroy']();}else{var _0x225253=new AGIChannel(_0x1a14f3);_0x225253['on'](_0x0fe6('0xc'),function(){_0x402912[_0x0fe6('0xa')](_0x0fe6('0x8'),_0x225253);});}});});_0x1281fc['on'](_0x0fe6('0x6'),function(_0x16f2f6){_0x402912[_0x0fe6('0xa')](_0x0fe6('0x6'),new AGIError(_0x0fe6('0xb'),_0x16f2f6[_0x0fe6('0xd')]));});_0x1281fc['on'](_0x0fe6('0xe'),function(){_0x402912[_0x0fe6('0xa')]('close',new AGIError(_0x0fe6('0xf')));});}process[_0x0fe6('0x10')](function(){_0x24e88f();});};util[_0x0fe6('0x11')](AGIServer,EventEmitter);module[_0x0fe6('0x12')]=function(_0x38bdeb,_0x3738bd,_0xf351d5){return new AGIServer(_0x38bdeb,_0x3738bd,_0xf351d5);}; \ No newline at end of file +var _0xbec5=['E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','inherits','exports','util','net','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listening','connection'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbec5,0xe5));var _0x5bec=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0xbec5[_0x590a38];return _0xf36626;};'use strict';var util=require(_0x5bec('0x0'));var net=require(_0x5bec('0x1'));var EventEmitter=require('events')[_0x5bec('0x2')];var AGIError=require(_0x5bec('0x3'));var AGIChannel=require(_0x5bec('0x4'));var AGIServer=function(_0x3859a1,_0x244027,_0x4ee982){var _0x1f8933=this,_0x3859a1=_0x3859a1||0x11dd,_0x244027=_0x244027||_0x5bec('0x5'),_0x4aaac6=null,_0x3ed67a=0x0;EventEmitter[_0x5bec('0x6')](_0x1f8933);function _0x406e65(){if(!_0x3859a1){_0x1f8933[_0x5bec('0x7')](_0x5bec('0x8'),new AGIError(_0x5bec('0x9')));return![];}_0x4aaac6=net[_0x5bec('0xa')]();_0x4aaac6['listen'](_0x3859a1,_0x244027);_0x4aaac6['on'](_0x5bec('0xb'),function(){_0x1f8933['emit'](_0x5bec('0xb'));});_0x4aaac6['on'](_0x5bec('0xc'),function(_0x117162){_0x4aaac6['getConnections'](function(_0x288d1b,_0x18fa47){if(_0x288d1b){_0x1f8933[_0x5bec('0x7')]('error',new AGIError(_0x5bec('0xd'),_0x288d1b));}else if(_0x4ee982&&_0x4ee982<0x0){_0x1f8933[_0x5bec('0x7')]('error',new AGIError(_0x5bec('0xe')));_0x117162[_0x5bec('0xf')]();}else if(_0x4ee982&&_0x4ee982>0x0&&_0x4ee982<_0x18fa47){_0x3ed67a+=0x1;_0x1f8933[_0x5bec('0x7')](_0x5bec('0x8'),new AGIError(_0x5bec('0x10'),_0x3ed67a));_0x117162[_0x5bec('0xf')]();}else{var _0x24dcd6=new AGIChannel(_0x117162);_0x24dcd6['on'](_0x5bec('0x11'),function(){_0x1f8933[_0x5bec('0x7')](_0x5bec('0xc'),_0x24dcd6);});}});});_0x4aaac6['on'](_0x5bec('0x8'),function(_0x325daf){_0x1f8933[_0x5bec('0x7')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x325daf[_0x5bec('0x12')]));});_0x4aaac6['on'](_0x5bec('0x13'),function(){_0x1f8933[_0x5bec('0x7')](_0x5bec('0x13'),new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0x406e65();});};util[_0x5bec('0x14')](AGIServer,EventEmitter);module[_0x5bec('0x15')]=function(_0x4e0191,_0x339614,_0xa7e223){return new AGIServer(_0x4e0191,_0x339614,_0xa7e223);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 73830e5..b22c198 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 _0xe1b3=['name','catch','getVoiceQueue','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','label','agicommand','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','log','in\x20createcmcontact','in\x20createcmcontact\x20callback','isNil','random','lastName','phone','list_id','scheduledAt','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','internal','agentLogin','exec','trim','googleCloudTTS','text','languageCode','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','POST','PUT','body','parse','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','uri','clear','clone','hasOwnProperty','isString','includes','replaceObjectAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','isEmpty','%s.%s','setVariable','replaceAllVariables','split','nextbracket','replaceAll','extra','replaceall\x20end','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','logh','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','ndassistant_url','SESTEK_NDA_%s','toUpperCase','out','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','beep','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','success','math','operation','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','response','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','opts','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','statusCode','%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','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','account_id','no\x20mail\x20account\x20configured','email','Smtp','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','arg_1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then'];(function(_0xc46be2,_0x2952d1){var _0x295537=function(_0x27a640){while(--_0x27a640){_0xc46be2['push'](_0xc46be2['shift']());}};_0x295537(++_0x2952d1);}(_0xe1b3,0x1b4));var _0x3e1b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe1b3[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require(_0x3e1b('0x0'));var util=require('util');var _=require(_0x3e1b('0x1'));var sh=require(_0x3e1b('0x2'));var odbc=require(_0x3e1b('0x3'))();var rs=require('randomstring');var moment=require(_0x3e1b('0x4'));var Mustache=require(_0x3e1b('0x5'));var rp=require(_0x3e1b('0x6'));var logger=require(_0x3e1b('0x7'))(_0x3e1b('0x8'));var config=require('../../config/environment');var scripts=require(_0x3e1b('0x9'));var FILES_PATH=_0x3e1b('0xa');var recursiveMapAttributes=[_0x3e1b('0xb'),'rawBody'];var verticesWithRetry=[_0x3e1b('0xc'),_0x3e1b('0xd'),_0x3e1b('0xe')];var AGIVertices=function(_0x1e8d18,_0x33c1cc,_0x461d8d){this[_0x3e1b('0xf')]=_0x1e8d18;this[_0x3e1b('0x10')]=_0x33c1cc;this[_0x3e1b('0x11')]=_0x461d8d;};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x13')]=function(_0x5e46c3,_0x1c0fd8){this[_0x3e1b('0x10')][_0x3e1b('0x14')](_0x5e46c3)[_0x3e1b('0x15')](function(_0xc0ba36){_0x1c0fd8(null,_0xc0ba36?_0xc0ba36[_0x3e1b('0x16')]:![]);})[_0x3e1b('0x17')](function(_0xe5f1bf){_0x1c0fd8(_0xe5f1bf);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x18')]=function(_0xb5523b,_0x1ee9ea){this[_0x3e1b('0x10')]['getVoiceQueueById'](_0xb5523b)[_0x3e1b('0x15')](function(_0x388a86){_0x1ee9ea(null,_0x388a86?_0x388a86['name']:![]);})[_0x3e1b('0x17')](function(_0x2c3eee){_0x1ee9ea(_0x2c3eee);});};AGIVertices[_0x3e1b('0x12')]['getSquareProject']=function(_0xdada55,_0x4cbcd4){this[_0x3e1b('0x10')][_0x3e1b('0x19')](_0xdada55)[_0x3e1b('0x15')](function(_0x2be5c4){_0x4cbcd4(null,_0x2be5c4?_0x2be5c4[_0x3e1b('0x16')]:![]);})[_0x3e1b('0x17')](function(_0x4f6045){_0x4cbcd4(_0x4f6045);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x1a')]=function(_0xa41a85,_0x303673){this['rpc'][_0x3e1b('0x1b')](_0xa41a85)[_0x3e1b('0x15')](function(_0x1ddc24){_0x303673(null,_0x1ddc24?_0x1ddc24[_0x3e1b('0x1c')]:![]);})[_0x3e1b('0x17')](function(_0x32d57d){_0x303673(_0x32d57d);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x1d')]=function(_0x1d8d74,_0x1b028c){this[_0x3e1b('0x10')][_0x3e1b('0x1e')](_0x1d8d74)[_0x3e1b('0x15')](function(_0x2a8749){_0x1b028c(null,_0x2a8749?_0x2a8749['name']:![]);})[_0x3e1b('0x17')](function(_0x52cb17){_0x1b028c(_0x52cb17);});};AGIVertices[_0x3e1b('0x12')]['getTrunk']=function(_0xbc9169,_0x1aeee2){this[_0x3e1b('0x10')]['getTrunkById'](_0xbc9169)[_0x3e1b('0x15')](function(_0x58459f){_0x1aeee2(null,_0x58459f?_0x58459f[_0x3e1b('0x16')]:![]);})[_0x3e1b('0x17')](function(_0x59f06a){_0x1aeee2(_0x59f06a);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x1f')]=function(_0x7f12d6,_0x24ef84){var _0x572348=this;this['rpc'][_0x3e1b('0x20')](_0x7f12d6)[_0x3e1b('0x15')](function(_0x220313){_0x24ef84(null,_0x220313?_0x572348['getSoundPath'](_0x220313[_0x3e1b('0x21')]):![]);})[_0x3e1b('0x17')](function(_0x17e41b){_0x24ef84(_0x17e41b);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x22')]=function(_0x5e9ad2,_0x143ff0){this[_0x3e1b('0x10')][_0x3e1b('0x23')](_0x5e9ad2)[_0x3e1b('0x15')](function(_0x1246b4){_0x143ff0(null,_0x1246b4?_0x1246b4:![]);})[_0x3e1b('0x17')](function(_0x433a29){_0x143ff0(_0x433a29);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x24')]=function(_0x1db2e3,_0x169194,_0x4c660e){this['mailRpc']['sendMailMessage'](_0x1db2e3,_0x169194)['then'](function(){_0x4c660e(null);})[_0x3e1b('0x17')](function(_0x252b41){_0x4c660e(_0x252b41);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x25')]=function(_0x2c6286,_0x446d47){this[_0x3e1b('0x10')][_0x3e1b('0x26')](_0x2c6286)['then'](function(_0x148636){if(_0x148636){if(_0x148636[_0x3e1b('0x27')]){_0x446d47(null,[_0x148636[_0x3e1b('0x28')]]);}else{_0x446d47(null,_[_0x3e1b('0x29')](_0x148636[_0x3e1b('0x2a')],'interval'));}}else{_0x446d47(null,![]);}})['catch'](function(_0xdc2460){_0x446d47(_0xdc2460);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x2b')]=function(_0x905a67){return util[_0x3e1b('0x2c')](_0x3e1b('0x2d'),FILES_PATH,_0x905a67);};AGIVertices['prototype'][_0x3e1b('0x2e')]=function(_0x13c5d0,_0x11bcab,_0xdc1e78){odbc['open'](_0x13c5d0,function(_0x1c619d){if(_0x1c619d){logger[_0x3e1b('0x2f')](_0x3e1b('0x30'),_0x1c619d);_0xdc1e78(_0x1c619d);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x3e1b('0x31')](_0x11bcab,function(_0x1fe467,_0x5143b0){if(_0x1fe467){logger[_0x3e1b('0x32')](_0x3e1b('0x33'),_0x11bcab);_0xdc1e78(_0x1fe467);}else{logger[_0x3e1b('0x32')](_0x3e1b('0x34'),_0x11bcab);odbc[_0x3e1b('0x35')](function(_0x429915){if(_0x429915){logger[_0x3e1b('0x2f')](_0x3e1b('0x36'),_0x429915);}_0xdc1e78(null,_0x5143b0);});}});}});};AGIVertices['prototype'][_0x3e1b('0x37')]=function(_0x387f00,_0x3696dc){this[_0x3e1b('0x10')]['getSmsAccountById'](_0x387f00)[_0x3e1b('0x15')](function(_0x8f0f03){_0x3696dc(null,_0x8f0f03?_0x8f0f03:![]);})[_0x3e1b('0x17')](function(_0x1be35e){_0x3696dc(_0x1be35e);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x38')]=function(_0x1a5a71,_0x1db8c3){this[_0x3e1b('0x10')][_0x3e1b('0x38')](_0x1a5a71)['then'](function(_0x5f00a7){_0x1db8c3(null,_0x5f00a7);})[_0x3e1b('0x17')](function(_0x1a6009){_0x1db8c3(_0x1a6009);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x39')]=function(_0x1bc795,_0x40960a,_0x2e579b){this[_0x3e1b('0x10')][_0x3e1b('0x39')]({'uniqueid':this[_0x3e1b('0xf')]['uniqueid'],'node':_0x1bc795[_0x3e1b('0x3a')],'application':_0x1bc795[_0x3e1b('0x3b')],'data':_0x40960a||null,'project_name':this[_0x3e1b('0xf')]['arg_1'],'callerid':this['channel'][_0x3e1b('0x3c')]})[_0x3e1b('0x15')](function(_0x581af2){if(_0x2e579b){_0x2e579b(null,_0x581af2);}})[_0x3e1b('0x17')](function(_0x84e532){if(_0x2e579b){_0x2e579b(_0x84e532);}});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x3d')]=function(_0x2e5d45,_0x29b834,_0x1ee4f0,_0x2171bb){this[_0x3e1b('0x10')][_0x3e1b('0x3d')]({'uniqueid':this[_0x3e1b('0xf')][_0x3e1b('0x3e')],'callerid':this[_0x3e1b('0xf')][_0x3e1b('0x3c')],'calleridname':this[_0x3e1b('0xf')][_0x3e1b('0x3f')],'context':this[_0x3e1b('0xf')][_0x3e1b('0x40')],'extension':this[_0x3e1b('0xf')][_0x3e1b('0x41')],'priority':this[_0x3e1b('0xf')][_0x3e1b('0x42')],'accountcode':this['channel']['accountcode'],'dnid':this[_0x3e1b('0xf')][_0x3e1b('0x43')],'projectName':this[_0x3e1b('0xf')]['arg_1'],'saveName':_0x29b834,'filename':_0x2e5d45[_0x3e1b('0x44')]||_0x29b834,'savePath':_0x1ee4f0})['then'](function(_0x2d0a0f){_0x2171bb(null,_0x2d0a0f);})['catch'](function(_0xc1ea5a){_0x2171bb(_0xc1ea5a);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x45')]=function(_0x29ba86,_0x413505,_0x10d8f5){this[_0x3e1b('0x10')][_0x3e1b('0x45')]({'uniqueid':this[_0x3e1b('0xf')][_0x3e1b('0x3e')],'body':_0x29ba86,'direction':_0x413505})[_0x3e1b('0x15')](function(_0x52b7de){if(_0x10d8f5){_0x10d8f5(null,_0x52b7de);}})[_0x3e1b('0x17')](function(_0x4edd35){if(_0x10d8f5){_0x10d8f5(_0x4edd35);}});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x46')]=function(_0x398c23,_0x426854){console[_0x3e1b('0x47')](_0x3e1b('0x48'),_0x398c23);console['log'](_0x3e1b('0x49'),_0x426854);this[_0x3e1b('0x10')][_0x3e1b('0x46')]({'firstName':_['isEmpty'](_0x398c23[_0x3e1b('0x16')])||_[_0x3e1b('0x4a')](_0x398c23['name'])?'callback_'+Math[_0x3e1b('0x4b')]():_0x398c23['name'],'lastName':_['isEmpty'](_0x398c23['lastName'])||_[_0x3e1b('0x4a')](_0x398c23['lastName'])?null:_0x398c23[_0x3e1b('0x4c')],'phone':_0x398c23[_0x3e1b('0x4d')],'ListId':_0x398c23[_0x3e1b('0x4e')],'scheduledat':_0x398c23['scheduledAt'],'callbackUniqueid':this['channel']['uniqueid'],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x398c23[_0x3e1b('0x4f')][_0x3e1b('0x50')](),'priority':_0x398c23[_0x3e1b('0x51')]})[_0x3e1b('0x15')](function(_0x49a4b6){_0x426854(null,_0x49a4b6);})[_0x3e1b('0x17')](function(_0x4fc835){_0x426854(_0x4fc835);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x52')]=function(_0x84bd59,_0x5cf8fd){this['rpc']['getPauseById'](_0x84bd59)['then'](function(_0xd2e2c7){_0x5cf8fd(null,_0xd2e2c7?_0xd2e2c7[_0x3e1b('0x16')]:![]);})[_0x3e1b('0x17')](function(_0x3ab66a){_0x5cf8fd(_0x3ab66a);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x53')]=function(_0x7c2f47,_0x14a2d3,_0x4ca25f){var _0x5d49b7={'role':_0x3e1b('0x54')};_0x5d49b7[_0x7c2f47]=this[_0x3e1b('0xf')][_0x3e1b('0x3c')];this[_0x3e1b('0x10')][_0x3e1b('0x53')](_0x5d49b7,_0x14a2d3,this['channel'][_0x3e1b('0x3e')])['then'](function(_0x37b239){_0x4ca25f(null,_[_0x3e1b('0x4a')](_0x37b239)?![]:!![]);})['catch'](function(_0x2e3a3b){logger[_0x3e1b('0x2f')](_0x2e3a3b);_0x4ca25f(null,![]);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x55')]=function(_0x412f38,_0x2c7c1c){var _0x5e1a28={'role':_0x3e1b('0x54')};_0x5e1a28[_0x412f38]=this[_0x3e1b('0xf')]['callerid'];this[_0x3e1b('0x10')][_0x3e1b('0x55')](_0x5e1a28)[_0x3e1b('0x15')](function(_0x4c3727){_0x2c7c1c(null,_['isNil'](_0x4c3727)?![]:!![]);})[_0x3e1b('0x17')](function(_0x5a2ea2){logger[_0x3e1b('0x2f')](_0x5a2ea2);_0x2c7c1c(null,![]);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x56')]=function(_0x5ea865,_0xb7957a){var _0x437c07={'role':'agent'};_0x437c07[_0x5ea865]=this[_0x3e1b('0xf')][_0x3e1b('0x3c')];this[_0x3e1b('0x10')][_0x3e1b('0x56')](_0x437c07)[_0x3e1b('0x15')](function(_0x51e389){_0xb7957a(null,_[_0x3e1b('0x4a')](_0x51e389)?![]:!![]);})[_0x3e1b('0x17')](function(_0x24a3bd){logger[_0x3e1b('0x2f')](_0x24a3bd);_0xb7957a(null,![]);});};AGIVertices[_0x3e1b('0x12')]['agentLogin']=function(_0x2d4e04,_0x34d268){var _0x184c5b={'role':'agent'};_0x184c5b[_0x2d4e04]=this[_0x3e1b('0xf')]['callerid'];var _0x16c25e=_0x2d4e04!=_0x3e1b('0x57')?util['format']('%s/%s@from-sip/n','LOCAL',this[_0x3e1b('0xf')][_0x3e1b('0x3c')]):undefined;this['rpc'][_0x3e1b('0x58')](_0x184c5b,_0x16c25e)['then'](function(_0x224609){_0x34d268(null,_[_0x3e1b('0x4a')](_0x224609)?![]:!![]);})['catch'](function(_0x589739){logger[_0x3e1b('0x2f')](_0x589739);_0x34d268(null,![]);});};AGIVertices[_0x3e1b('0x12')]['shellCommand']=function(_0x426cc9,_0x48af4f){sh[_0x3e1b('0x59')](_[_0x3e1b('0x5a')](_0x426cc9),function(_0x1baaa7,_0x2fee4b){var _0x2c5d80=_0x2fee4b['replace'](/(\r\n|\n|\r)/gm,'');_0x48af4f(null,_0x2c5d80);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x5b')]=function(_0x1a5ff1,_0x24466e){scripts['googleCloudTTS'](_0x1a5ff1['apiKey'],_0x1a5ff1['google_cloud_tts_text_type']||_0x3e1b('0x5c'),_0x1a5ff1['text'],_0x1a5ff1[_0x3e1b('0x5d')]||'en-US',_0x1a5ff1['ssmlGender']||_0x3e1b('0x5e'),_0x1a5ff1[_0x3e1b('0x5f')]||_0x3e1b('0x60'))[_0x3e1b('0x15')](function(_0x3b31ad){_0x24466e(null,_0x3b31ad);})['catch'](function(_0x504b82){_0x24466e(_0x504b82);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x61')]=function(_0x271f1d,_0xc5fb47){scripts[_0x3e1b('0x61')](_0x271f1d['text'],_0x271f1d[_0x3e1b('0x62')]||'en',0x1)[_0x3e1b('0x15')](function(_0xcdd0f8){_0xc5fb47(null,_0xcdd0f8);})[_0x3e1b('0x17')](function(_0x8b7e08){_0xc5fb47(_0x8b7e08);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x63')]=function(_0x362902,_0x3f7f5f){var _0x4bec0d={'uri':_0x362902[_0x3e1b('0x64')],'method':_0x362902[_0x3e1b('0x65')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x362902[_0x3e1b('0x66')])==='number'&&parseInt(_0x362902[_0x3e1b('0x66')])>=0x1?parseInt(_0x362902[_0x3e1b('0x66')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x3e1b('0x67'),_0x3e1b('0x68')],_0x4bec0d[_0x3e1b('0x65')]['toUpperCase']())){try{_0x4bec0d[_0x3e1b('0x69')]=_0x362902['rawBody']?JSON[_0x3e1b('0x6a')](_0x362902[_0x3e1b('0x6b')]):{};}catch(_0x4d73aa){logger[_0x3e1b('0x2f')](_0x3e1b('0x6c'),_0x4d73aa);}}try{_0x4bec0d[_0x3e1b('0x6d')]=_0x362902[_0x3e1b('0xb')]?JSON[_0x3e1b('0x6a')](_0x362902[_0x3e1b('0xb')]):{};}catch(_0x482a3b){logger['error'](_0x3e1b('0x6e'),_0x482a3b);}if(_0x362902[_0x3e1b('0x6f')]){try{var _0x281c89=require(_0x362902[_0x3e1b('0x6f')])[_0x3e1b('0x70')](this,_0x4bec0d);_0x4bec0d['uri']=Mustache[_0x3e1b('0x71')](_0x362902[_0x3e1b('0x64')],_0x281c89,{},['$$','$$']);if(_0x4bec0d[_0x3e1b('0x6d')]){_0x4bec0d[_0x3e1b('0x6d')]=JSON['parse'](Mustache[_0x3e1b('0x71')](JSON[_0x3e1b('0x72')](_0x4bec0d[_0x3e1b('0x6d')]),_0x281c89,{},['$$','$$']));}if(_0x4bec0d['body']){_0x4bec0d[_0x3e1b('0x69')]=JSON['parse'](Mustache[_0x3e1b('0x71')](JSON['stringify'](_0x4bec0d[_0x3e1b('0x69')]),_0x281c89,{},['$$','$$']));}}catch(_0x3552dc){logger[_0x3e1b('0x2f')](_0x3e1b('0x73'),_0x3552dc);}}rp(_0x4bec0d)[_0x3e1b('0x15')](function(_0x483d87){var _0x33e723={'statusCode':_0x483d87['statusCode']||0xc8,'statusMessage':_0x483d87[_0x3e1b('0x74')]||'OK','headers':_0x483d87[_0x3e1b('0x6d')]||{},'body':_0x483d87[_0x3e1b('0x69')]||{}};_0x3f7f5f(null,_0x33e723);})[_0x3e1b('0x17')](function(_0x393638){var _0x5105d7={'statusCode':_0x393638['statusCode']||0x1f4,'statusMessage':_0x393638[_0x3e1b('0x75')]||_0x3e1b('0x76'),'headers':_0x393638['options'][_0x3e1b('0x6d')]||{},'body':_0x393638[_0x3e1b('0x77')][_0x3e1b('0x69')]||{}};_0x3f7f5f(null,_0x5105d7);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x78')]=function(_0x2f8213,_0x2d4401){scripts[_0x3e1b('0x78')](this[_0x3e1b('0xf')][_0x3e1b('0x3e')],_0x2f8213[_0x3e1b('0x79')],_0x2f8213[_0x3e1b('0x5c')],_0x2f8213['dialogflow_language']||'en')['then'](function(_0x5e284c){_0x2d4401(null,_0x5e284c);})['catch'](function(_0x14159c){_0x2d4401(_0x14159c);});};AGIVertices['prototype'][_0x3e1b('0x7a')]=function(_0x4ae7ce,_0x55a7b0){scripts[_0x3e1b('0x7a')](this[_0x3e1b('0xf')],_0x4ae7ce)[_0x3e1b('0x15')](function(_0x43b4f3){_0x55a7b0(null,_0x43b4f3);})[_0x3e1b('0x17')](function(_0x15fc9e){_0x55a7b0(_0x15fc9e);});};AGIVertices['prototype'][_0x3e1b('0x7b')]=function(_0x458236,_0x416890){scripts[_0x3e1b('0x7b')](_0x458236['key'],_0x458236[_0x3e1b('0x5c')],_0x458236[_0x3e1b('0x7c')]||_0x3e1b('0x7d'),_0x458236[_0x3e1b('0x7e')])['then'](function(_0x393a07){_0x416890(null,_0x393a07);})[_0x3e1b('0x17')](function(_0x186850){_0x416890(_0x186850);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x7f')]=function(_0x4f66b8,_0x2a5055,_0x423908){scripts[_0x3e1b('0x7f')](_0x2a5055,_0x4f66b8[_0x3e1b('0x79')],_0x4f66b8[_0x3e1b('0x80')]||_0x3e1b('0x7d'),this[_0x3e1b('0x81')](_0x4f66b8['model'])?_0x4f66b8['model']:undefined)[_0x3e1b('0x15')](function(_0x578b69){_0x423908(null,_0x578b69);})[_0x3e1b('0x17')](function(_0x123ee2){_0x423908(_0x123ee2);});};AGIVertices['prototype'][_0x3e1b('0x82')]=function(_0x15ce7d,_0x19b9d5){scripts['awsPolly'](_0x15ce7d[_0x3e1b('0x83')],_0x15ce7d[_0x3e1b('0x84')],_0x15ce7d[_0x3e1b('0x85')],_0x15ce7d[_0x3e1b('0x86')]||'Amy',_0x15ce7d[_0x3e1b('0x5c')],_0x15ce7d['aws_text_type']||_0x3e1b('0x5c'))[_0x3e1b('0x15')](function(_0x240ae1){_0x19b9d5(null,_0x240ae1);})[_0x3e1b('0x17')](function(_0x1ea114){_0x19b9d5(_0x1ea114);});};AGIVertices['prototype'][_0x3e1b('0x87')]=function(_0x3c5104,_0x1ff234){scripts[_0x3e1b('0x87')](this['channel']['uniqueid'],_0x3c5104[_0x3e1b('0x83')],_0x3c5104['aws_secret_access_key'],_0x3c5104[_0x3e1b('0x88')],_0x3c5104[_0x3e1b('0x5c')],_0x3c5104[_0x3e1b('0x89')])[_0x3e1b('0x15')](function(_0x3fe910){_0x1ff234(null,_0x3fe910);})[_0x3e1b('0x17')](function(_0x5b4e91){_0x1ff234(_0x5b4e91);});};AGIVertices[_0x3e1b('0x12')]['googleASR']=function(_0x58afab,_0xfeffe2,_0x322007){scripts[_0x3e1b('0x8a')](_0xfeffe2,_0x58afab[_0x3e1b('0x79')],_0x58afab[_0x3e1b('0x8b')]||'en-US')[_0x3e1b('0x15')](function(_0x1bf7ac){_0x322007(null,_0x1bf7ac);})['catch'](function(_0x5b713b){_0x322007(_0x5b713b);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x8c')]=function(_0x2a300d,_0x3455ea,_0x8562d){scripts[_0x3e1b('0x8c')](_0x3455ea,_0x2a300d['appid'],_0x2a300d[_0x3e1b('0x8d')],_0x2a300d[_0x3e1b('0x8e')])[_0x3e1b('0x15')](function(_0x558cc7){_0x8562d(null,_0x558cc7);})[_0x3e1b('0x17')](function(_0x32cea7){_0x8562d(_0x32cea7);});};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x8f')]=function(_0xb1fda4){var _0x273ba6=_['includes'](verticesWithRetry,_0xb1fda4[_0x3e1b('0x3b')])?_0xb1fda4:_[_0x3e1b('0x90')](_0xb1fda4);for(var _0x2b16fe in _0x273ba6){if(_0x273ba6[_0x3e1b('0x91')](_0x2b16fe)){if(_0x273ba6[_0x2b16fe]&&_[_0x3e1b('0x92')](_0x273ba6[_0x2b16fe])){if(_[_0x3e1b('0x93')](recursiveMapAttributes,_0x2b16fe)){_0x273ba6[_0x2b16fe]=this[_0x3e1b('0x94')](_0x273ba6[_0x2b16fe]);}else{_0x273ba6[_0x2b16fe]=this['replaceAllVariables'](_0x273ba6[_0x2b16fe]);}}}}return _0x273ba6;};AGIVertices[_0x3e1b('0x12')]['recursiveNodeIndex']=function(_0x19792c){for(var _0x3c93e2 in _0x19792c){if(_0x19792c['hasOwnProperty'](_0x3c93e2)){if(_[_0x3e1b('0x95')](_0x19792c[_0x3c93e2])){this[_0x3e1b('0x96')](_0x19792c[_0x3c93e2]);}else if(_[_0x3e1b('0x97')](_0x19792c[_0x3c93e2])){for(var _0x459249=0x0;_0x459249<_0x19792c[_0x3c93e2][_0x3e1b('0x98')];_0x459249++){this[_0x3e1b('0x96')](_0x19792c[_0x3c93e2][_0x459249]);}}else if(_['isString'](_0x19792c[_0x3c93e2])){_0x19792c[_0x3c93e2]=this['replaceAllVariables'](_0x19792c[_0x3c93e2]);}}}};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x99')]=function(_0x81dcac,_0x12508c){for(var _0x587189 in _0x81dcac){if(_0x81dcac['hasOwnProperty'](_0x587189)){if(_[_0x3e1b('0x95')](_0x81dcac[_0x587189])){if(!_[_0x3e1b('0x9a')](_0x81dcac[_0x587189])){this[_0x3e1b('0x99')](_0x81dcac[_0x587189],util[_0x3e1b('0x2c')](_0x3e1b('0x9b'),_0x12508c,_0x587189));}}else if(_['isArray'](_0x81dcac[_0x587189])){for(var _0x3f10f5=0x0;_0x3f10f5<_0x81dcac[_0x587189][_0x3e1b('0x98')];_0x3f10f5++){this['saveRestApiResult'](_0x81dcac[_0x587189][_0x3f10f5],util['format'](_0x3e1b('0x9b'),_0x12508c,_0x587189+'['+_0x3f10f5+']'));}}else{if(!_[_0x3e1b('0x4a')](_0x81dcac[_0x587189])){this['channel'][_0x3e1b('0x9c')](util[_0x3e1b('0x2c')](_0x3e1b('0x9b'),_0x12508c,_0x587189),_0x81dcac[_0x587189]);}}}}};AGIVertices['prototype'][_0x3e1b('0x94')]=function(_0x562f83){try{var _0x5c43ff=JSON[_0x3e1b('0x6a')](_0x562f83);this['recursiveNodeIndex'](_0x5c43ff);return JSON[_0x3e1b('0x72')](_0x5c43ff);}catch(_0x505f8c){return this['replaceAllVariables'](_0x562f83);}};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x9d')]=function(_0x15ae29){console[_0x3e1b('0x47')]('replaceall\x20init',_0x15ae29);var _0x4ac56a=_0x15ae29['split']('{');for(var _0x57a864=0x1;_0x57a864<_0x4ac56a[_0x3e1b('0x98')];_0x57a864+=0x1){var _0x294a7d=_0x4ac56a[_0x57a864][_0x3e1b('0x9e')]('}');console[_0x3e1b('0x47')](_0x3e1b('0x9f'),_0x294a7d);if(_0x294a7d['length']>0x1){_0x15ae29=_0x15ae29[_0x3e1b('0xa0')]('{'+_0x294a7d[0x0]+'}',this['channel'][_0x3e1b('0x13')](_0x294a7d[0x0])[_0x3e1b('0xa1')]||_0x294a7d[0x0]);}}if(_0x4ac56a[_0x3e1b('0x98')]===0x1){return _0x15ae29[_0x3e1b('0x50')]();}console[_0x3e1b('0x47')](_0x3e1b('0xa2'),_0x15ae29);return this[_0x3e1b('0x9d')](_0x15ae29);};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0xa3')]=function(_0x3d9a61,_0x349482){var _0x20fc32=this[_0x3e1b('0xf')][_0x3e1b('0x13')](_0x3d9a61);if(_0x20fc32[_0x3e1b('0xa4')]===-0x1){return _0x20fc32;}logger[_0x3e1b('0x32')](util['format'](_0x3e1b('0xa5'),_0x349482,_0x20fc32[_0x3e1b('0xa1')]));return this[_0x3e1b('0xf')][_0x3e1b('0x9c')](_0x349482,_0x20fc32[_0x3e1b('0xa1')]);};AGIVertices['prototype'][_0x3e1b('0x81')]=function(_0x4c2169){return _0x4c2169&&_0x4c2169!=='0'&&_0x4c2169!=='-1'&&_0x4c2169!=='';};AGIVertices['prototype'][_0x3e1b('0xa6')]=function(_0x50138d){this[_0x3e1b('0x39')]['sync'](this,_0x50138d,'-');_0x50138d[_0x3e1b('0xa7')]=_0x50138d[_0x3e1b('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0xa8')]=function(_0x2c535f){logger['info'](util[_0x3e1b('0x2c')](_0x3e1b('0xa9'),_0x2c535f[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x2c535f[_0x3e1b('0x5c')])){return this['channel'][_0x3e1b('0xaa')](_0x3e1b('0xab'));}var _0x332e31='\x22'+_0x2c535f[_0x3e1b('0x5c')]+'\x22';if(this['isConfigured'](_0x2c535f[_0x3e1b('0x77')])){_0x332e31+=','+_0x2c535f[_0x3e1b('0x77')];}var _0x781196=this[_0x3e1b('0xf')][_0x3e1b('0x59')](_0x3e1b('0xac'),_0x332e31);if(_0x781196[_0x3e1b('0xa4')]===-0x1){return _0x781196;}return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x332e31));};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0xad')]=function(_0xf9c764){logger['info'](util[_0x3e1b('0x2c')](_0x3e1b('0xae'),_0xf9c764['label']));if(!this['isConfigured'](_0xf9c764['grammar'])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')]('no\x20grammar\x20configured');}var _0x25b807=_0xf9c764[_0x3e1b('0xaf')];if(this[_0x3e1b('0x81')](_0xf9c764[_0x3e1b('0x77')])){_0x25b807+=','+_0xf9c764[_0x3e1b('0x77')];}var _0x561467=this[_0x3e1b('0xf')]['exec'](_0x3e1b('0xb0'),_0x25b807);if(_0x561467[_0x3e1b('0xa4')]===-0x1){return _0x561467;}var _0x5c4825=this['getAndSetVariable'](_0x3e1b('0xb1'),'MRCP_RECOG_CONFIDENCE');if(_0x5c4825['result']===-0x1){return _0x5c4825;}var _0x82a86=this['getAndSetVariable'](_0x3e1b('0xb2'),'MRCP_RECOG_TRANSCRIPT');if(_0x82a86[_0x3e1b('0xa4')]===-0x1){return _0x82a86;}var _0x182384=this[_0x3e1b('0xa3')](_0x3e1b('0xb3'),'MRCP_RECOG_INSTANCE');if(_0x182384[_0x3e1b('0xa4')]===-0x1){return _0x182384;}return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util['format'](_0x3e1b('0xb4'),_0x25b807));};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x8')]=function(_0x56b670){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0xb5'),_0x56b670[_0x3e1b('0x3a')]));return this[_0x3e1b('0xf')][_0x3e1b('0x8')]([_0x56b670[_0x3e1b('0xb6')],_0x56b670[_0x3e1b('0xb7')]]);};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0xb8')]=function(_0x3d76a0){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0xb9'),_0x3d76a0[_0x3e1b('0x3a')]));if(this['isConfigured'](_0x3d76a0[_0x3e1b('0x66')])){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0xba'),_0x3d76a0[_0x3e1b('0x66')]));var _0x19104f=this['channel'][_0x3e1b('0xbb')](_0x3d76a0['timeout']);if(_0x19104f[_0x3e1b('0xa4')]===-0x1){return _0x19104f;}}return this['channel'][_0x3e1b('0xb8')]();};AGIVertices[_0x3e1b('0x12')]['callback']=function(_0xcef7ff){console[_0x3e1b('0xbc')]('enter\x20in\x20callbackblock',_0xcef7ff);logger[_0x3e1b('0x32')](util['format'](_0x3e1b('0xbd'),_0xcef7ff['label']));if(!this[_0x3e1b('0x81')](_0xcef7ff['list_id'])){return this['channel'][_0x3e1b('0x2f')](_0xcef7ff,_0x3e1b('0xbe'));}_0xcef7ff[_0x3e1b('0x4f')]=moment();if(this[_0x3e1b('0x81')](_0xcef7ff[_0x3e1b('0xbf')])){_0xcef7ff['scheduledAt']=moment()[_0x3e1b('0xc0')](_0xcef7ff[_0x3e1b('0xbf')],_0x3e1b('0xc1'));}if(!this[_0x3e1b('0x81')](_0xcef7ff[_0x3e1b('0x51')])){_0xcef7ff[_0x3e1b('0x51')]=0x2;}console[_0x3e1b('0x47')]('before\x20createcmcontact',_0xcef7ff);this[_0x3e1b('0x46')][_0x3e1b('0x70')](this,_0xcef7ff);return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0xcef7ff[_0x3e1b('0x4d')],_0xcef7ff['list_id'],_0xcef7ff['scheduledAt']));};AGIVertices['prototype']['custom_app']=function(_0x36a082){logger[_0x3e1b('0x32')](util['format'](_0x3e1b('0xc2'),_0x36a082[_0x3e1b('0x3a')]));var _0xbe5d9b=this[_0x3e1b('0xf')][_0x3e1b('0x59')](_0x36a082[_0x3e1b('0xc3')],_0x36a082[_0x3e1b('0x77')]);if(_0xbe5d9b[_0x3e1b('0xa4')]===-0x1){return _0xbe5d9b;}return this['channel']['noop'](util[_0x3e1b('0x2c')](_0x3e1b('0xc4'),_0x36a082['application'],_0x36a082[_0x3e1b('0x77')]));};AGIVertices['prototype'][_0x3e1b('0xc5')]=function(_0x142c01){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0xc6'),_0x142c01['label']));if(!this[_0x3e1b('0x81')](_0x142c01[_0x3e1b('0x5c')])){return this[_0x3e1b('0xf')]['noop'](_0x3e1b('0xab'));}var _0x52303c='\x22'+_0x142c01['text']+'\x22';if(this[_0x3e1b('0x81')](_0x142c01[_0x3e1b('0x77')])){_0x52303c+=','+_0x142c01[_0x3e1b('0x77')];}var _0x31cadf=this[_0x3e1b('0xf')][_0x3e1b('0x59')]('MRCPSynth',_0x52303c);if(_0x31cadf[_0x3e1b('0xa4')]===-0x1){return _0x31cadf;}return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0xc7'),_0x52303c));};AGIVertices['prototype']['sestektts']=function(_0x1acb76){logger[_0x3e1b('0x32')](util['format'](_0x3e1b('0xc8'),_0x1acb76['label']));if(!this['isConfigured'](_0x1acb76['text'])){return this['channel'][_0x3e1b('0xaa')](_0x3e1b('0xab'));}var _0x4f7b67='\x22'+_0x1acb76[_0x3e1b('0x5c')]+'\x22';if(this[_0x3e1b('0x81')](_0x1acb76[_0x3e1b('0x77')])){_0x4f7b67+=','+_0x1acb76[_0x3e1b('0x77')];}var _0x4de6aa=this['channel'][_0x3e1b('0x59')](_0x3e1b('0xac'),_0x4f7b67);if(_0x4de6aa[_0x3e1b('0xa4')]===-0x1){return _0x4de6aa;}return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0xc7'),_0x4f7b67));};AGIVertices['prototype'][_0x3e1b('0xc9')]=function(_0x3d9926){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0xca'),_0x3d9926[_0x3e1b('0x3a')]));if(!this['isConfigured'](_0x3d9926[_0x3e1b('0xaf')])){return this[_0x3e1b('0xf')]['noop']('no\x20grammar\x20configured');}var _0x388837=_0x3d9926['grammar'];if(this[_0x3e1b('0x81')](_0x3d9926[_0x3e1b('0x77')])){_0x388837+=','+_0x3d9926[_0x3e1b('0x77')];}var _0x2aefd3=this[_0x3e1b('0xf')][_0x3e1b('0x59')](_0x3e1b('0xb0'),_0x388837);if(_0x2aefd3[_0x3e1b('0xa4')]===-0x1){return _0x2aefd3;}var _0x2301ad=this[_0x3e1b('0xa3')](_0x3e1b('0xb1'),_0x3e1b('0xcb'));if(_0x2301ad[_0x3e1b('0xa4')]===-0x1){return _0x2301ad;}var _0x2ee41f=this[_0x3e1b('0xa3')](_0x3e1b('0xb2'),_0x3e1b('0xcc'));if(_0x2ee41f[_0x3e1b('0xa4')]===-0x1){return _0x2ee41f;}var _0x528e05=this[_0x3e1b('0xa3')](_0x3e1b('0xb3'),_0x3e1b('0xcd'));if(_0x528e05[_0x3e1b('0xa4')]===-0x1){return _0x528e05;}return this[_0x3e1b('0xf')]['noop'](util[_0x3e1b('0x2c')](_0x3e1b('0xb4'),_0x388837));};AGIVertices[_0x3e1b('0x12')]['sestekasr']=function(_0x430645){logger[_0x3e1b('0x32')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x430645[_0x3e1b('0x3a')]));if(!this['isConfigured'](_0x430645[_0x3e1b('0xaf')])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](_0x3e1b('0xce'));}var _0x3b2a66=_0x430645['grammar'];if(this['isConfigured'](_0x430645[_0x3e1b('0x77')])){_0x3b2a66+=','+_0x430645[_0x3e1b('0x77')];}var _0xde72cd=this[_0x3e1b('0xf')]['exec'](_0x3e1b('0xb0'),_0x3b2a66);if(_0xde72cd['result']===-0x1){return _0xde72cd;}var _0x17a0b2=this[_0x3e1b('0xa3')](_0x3e1b('0xb1'),_0x3e1b('0xcf'));if(_0x17a0b2[_0x3e1b('0xa4')]===-0x1){return _0x17a0b2;}var _0x1fe012=this[_0x3e1b('0xa3')](_0x3e1b('0xb2'),_0x3e1b('0xd0'));if(_0x1fe012[_0x3e1b('0xa4')]===-0x1){return _0x1fe012;}var _0x3f9399=this[_0x3e1b('0xa3')](_0x3e1b('0xb3'),_0x3e1b('0xd1'));if(_0x3f9399[_0x3e1b('0xa4')]===-0x1){return _0x3f9399;}return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util['format'](_0x3e1b('0xb4'),_0x3b2a66));};AGIVertices['prototype'][_0x3e1b('0xd2')]=function(_0x3df080){logger['info'](util[_0x3e1b('0x2c')](_0x3e1b('0xd3'),_0x3df080[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x3df080[_0x3e1b('0xd4')])){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x3df080,_0x3e1b('0xd5'));}var _0x51987a=this[_0x3e1b('0x1a')][_0x3e1b('0x70')](this,_0x3df080[_0x3e1b('0xd4')]);if(!_0x51987a){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x3df080,'no\x20odbc\x20database\x20found');}if(!this[_0x3e1b('0x81')](_0x3df080[_0x3e1b('0x31')])){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x3df080,_0x3e1b('0xd6'));}var _0xb179e0=_0x3df080[_0x3e1b('0x31')][_0x3e1b('0xd7')](/(\r\n|\n|\r)/gm,'\x20');this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0xd8'),_0xb179e0));var _0x2426e5=this[_0x3e1b('0x2e')][_0x3e1b('0x70')](this,_0x51987a,_0xb179e0);this['createSquareDetailsReport']['sync'](this,_0x3df080,_0xb179e0);if(!this[_0x3e1b('0x81')](_0x3df080[_0x3e1b('0xd9')])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x303c93=this[_0x3e1b('0x13')]['sync'](this,_0x3df080[_0x3e1b('0xd9')]);if(!_0x303c93){return this['channel'][_0x3e1b('0x2f')](_0x3df080,_0x3e1b('0xda'));}var _0x33011d=this;_0x2426e5[_0x3e1b('0xdb')](function(_0x19247b,_0x223426){Object[_0x3e1b('0xdc')](_0x19247b)[_0x3e1b('0xdb')](function(_0x51ffda){_0x33011d[_0x3e1b('0xf')][_0x3e1b('0x9c')](util[_0x3e1b('0x2c')](_0x3e1b('0xdd'),_0x303c93,_0x223426,_0x51ffda),_0x19247b[_0x51ffda]);});});this['channel'][_0x3e1b('0x9c')](util['format'](_0x3e1b('0xde'),_0x303c93),_0x2426e5[_0x3e1b('0x98')]);return this['channel'][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0xdf'),_0x303c93));};AGIVertices[_0x3e1b('0x12')]['dial']=function(_0x207dd7){logger[_0x3e1b('0xe0')](util[_0x3e1b('0x2c')](_0x3e1b('0xe1'),_0x207dd7['label']));if(!this['isConfigured'](_0x207dd7[_0x3e1b('0xe2')])){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x207dd7,_0x3e1b('0xe3'));}var _0x36def4=this['getUser'][_0x3e1b('0x70')](this,_0x207dd7[_0x3e1b('0xe2')]);if(!_0x36def4){return this[_0x3e1b('0xf')]['error'](_0x207dd7,_0x3e1b('0xe4'));}var _0x265029=this[_0x3e1b('0xf')][_0x3e1b('0x59')]('DIAL',[util[_0x3e1b('0x2c')](_0x3e1b('0xe5'),_0x36def4),_0x207dd7['timeout'],_0x207dd7['opts'],_0x207dd7['url']]);if(_0x265029[_0x3e1b('0xa4')]===-0x1){return _0x265029;}return this[_0x3e1b('0xf')]['noop'](util[_0x3e1b('0x2c')](_0x3e1b('0xe6'),_0x3e1b('0xe7')));};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0xe8')]=function(_0x4b0038){logger['info'](util[_0x3e1b('0x2c')](_0x3e1b('0xe9'),_0x4b0038[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x4b0038[_0x3e1b('0x79')])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](_0x3e1b('0xea'));}if(!this['isConfigured'](_0x4b0038['text'])){return this['channel'][_0x3e1b('0xaa')](_0x3e1b('0xab'));}this['channel'][_0x3e1b('0xeb')]=!![];this['createSquareDetailsReport'](_0x4b0038);this[_0x3e1b('0x45')](_0x4b0038[_0x3e1b('0x5c')],'in');this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0xec'),_0x4b0038[_0x3e1b('0x5c')]));var _0x4ad241=this[_0x3e1b('0x78')]['sync'](this,_0x4b0038);if(_0x4ad241){for(var _0x16d885 in _0x4ad241){if(_0x4ad241[_0x3e1b('0x91')](_0x16d885)){this['channel']['setVariable'](util['format'](_0x3e1b('0xed'),_0x16d885['toUpperCase']()),_0x4ad241[_0x16d885]);}}this['createSquareMessage'](_0x4ad241['speech'],'out');return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0xee'),_0x4ad241[_0x3e1b('0xef')]));}return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x4b0038,_0x3e1b('0xf0'));};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0xf1')]=function(_0x59e28f){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0xf2'),_0x59e28f[_0x3e1b('0x3a')]));if(!this['isConfigured'](_0x59e28f[_0x3e1b('0xf3')])){return this['channel'][_0x3e1b('0xaa')](_0x3e1b('0xf4'));}if(!this[_0x3e1b('0x81')](_0x59e28f['username'])){return this[_0x3e1b('0xf')]['noop'](_0x3e1b('0xf5'));}if(!this[_0x3e1b('0x81')](_0x59e28f[_0x3e1b('0xf6')])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')]('no\x20password\x20configured');}if(!this[_0x3e1b('0x81')](_0x59e28f[_0x3e1b('0xf7')])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](_0x3e1b('0xab'));}this[_0x3e1b('0xf')][_0x3e1b('0xeb')]=!![];this['createSquareDetailsReport'](_0x59e28f);this[_0x3e1b('0x45')](_0x59e28f['text'],'in');this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util['format']('Trying\x20SestekNDA:\x20%s',_0x59e28f[_0x3e1b('0x5c')]));var _0x2677b5=this[_0x3e1b('0x7a')]['sync'](this,_0x59e28f);if(_0x2677b5){for(var _0x276b6f in _0x2677b5){if(_0x2677b5['hasOwnProperty'](_0x276b6f)){this[_0x3e1b('0xf')][_0x3e1b('0x9c')](util[_0x3e1b('0x2c')](_0x3e1b('0xf8'),_0x276b6f[_0x3e1b('0xf9')]()),_0x2677b5[_0x276b6f]);}}this[_0x3e1b('0x45')](_0x2677b5[_0x3e1b('0xef')],_0x3e1b('0xfa'));if(_0x2677b5['audiofile']){this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0xfb'),_0x2677b5['audiofile']));var _0x41363b=this[_0x3e1b('0xf')][_0x3e1b('0xfc')](_0x2677b5['audiofile']);try{fs[_0x3e1b('0xfd')](_0x2677b5['audiofile']+_0x3e1b('0xfe'));}catch(_0x5dbe8c){logger[_0x3e1b('0x2f')](_0x5dbe8c);}return _0x41363b;}else{return this[_0x3e1b('0xf')]['noop'](util[_0x3e1b('0x2c')](_0x3e1b('0xff'),_0x2677b5[_0x3e1b('0xef')]));}}return this[_0x3e1b('0xf')]['error'](_0x59e28f,_0x3e1b('0x100'));};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x101')]=function(_0x2e71e1){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x102'),_0x2e71e1[_0x3e1b('0x3a')]));return this[_0x3e1b('0xf')][_0x3e1b('0xaa')]('end');};AGIVertices['prototype'][_0x3e1b('0x103')]=function(_0x16cbb4){logger['info'](util[_0x3e1b('0x2c')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x16cbb4[_0x3e1b('0x3a')]));var _0x1c9369='';if(_0x16cbb4[_0x3e1b('0x104')]){if(!this[_0x3e1b('0x81')](_0x16cbb4[_0x3e1b('0x104')])){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x16cbb4,_0x3e1b('0x105'));}else{var _0x1e32e3=parseInt(_0x16cbb4[_0x3e1b('0x104')],0xa);if(isNaN(_0x1e32e3)){_0x1c9369=_0x16cbb4[_0x3e1b('0x104')];}else{_0x1c9369=this[_0x3e1b('0x106')][_0x3e1b('0x70')](this,_0x16cbb4['trunk_id']);if(!_0x1c9369){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x16cbb4,_0x3e1b('0x107'));}}}}else if(_0x16cbb4[_0x3e1b('0x108')]){_0x1c9369=_0x16cbb4[_0x3e1b('0x108')];}else{return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x16cbb4,_0x3e1b('0x105'));}var _0x501020=this[_0x3e1b('0xf')]['exec'](_0x3e1b('0xe7'),[util[_0x3e1b('0x2c')](_0x3e1b('0x109'),_0x1c9369,_0x16cbb4['phone']),_0x16cbb4[_0x3e1b('0x66')],_0x16cbb4['opts'],_0x16cbb4[_0x3e1b('0x64')]]);if(_0x501020[_0x3e1b('0xa4')]===-0x1){return _0x501020;}return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')]('Executed\x20command\x20%s',_0x3e1b('0xe7')));};AGIVertices['prototype'][_0x3e1b('0x10a')]=function(_0x1ed7ce){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1ed7ce[_0x3e1b('0x3a')]));return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](_0x3e1b('0x10a'));};AGIVertices[_0x3e1b('0x12')]['getdigits']=function(_0x460b64){logger[_0x3e1b('0x32')](util['format'](_0x3e1b('0x10b'),_0x460b64['label']));if(_0x460b64['retry']===0x0){return this[_0x3e1b('0xa6')](_0x460b64);}_0x460b64[_0x3e1b('0xa7')]-=0x1;if(!this['isConfigured'](_0x460b64[_0x3e1b('0x10c')])){return this['channel'][_0x3e1b('0x2f')](_0x460b64,_0x3e1b('0x10d'));}var _0x39bd52=this['getSound'][_0x3e1b('0x70')](this,_0x460b64[_0x3e1b('0x10c')]);if(!_0x39bd52){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x460b64,_0x3e1b('0x10e'));}if(!this[_0x3e1b('0x81')](_0x460b64[_0x3e1b('0xd9')])){return this['channel'][_0x3e1b('0x2f')](_0x3e1b('0x10f'));}var _0x439db4=this['channel'][_0x3e1b('0x110')](_0x39bd52,_0x460b64['response'],_0x460b64[_0x3e1b('0x111')]);var _0xc01851=_0x439db4[_0x3e1b('0xa4')]?_0x439db4[_0x3e1b('0xa4')][_0x3e1b('0x50')]():'';logger['info'](_0x3e1b('0x112'),JSON[_0x3e1b('0x72')](_0x439db4));if(_0x439db4[_0x3e1b('0xa4')]===-0x1){this[_0x3e1b('0x39')][_0x3e1b('0x70')](this,_0x460b64,_0xc01851);return _0x439db4;}else if(_0x439db4[_0x3e1b('0xa1')]===_0x3e1b('0x66')){_0x439db4[_0x3e1b('0xa4')]=_0xc01851['length']>=parseInt(_0x460b64[_0x3e1b('0x113')])?'x':'i';}else{_0x439db4[_0x3e1b('0xa4')]=_0xc01851[_0x3e1b('0x98')]>=parseInt(_0x460b64['mindigit'])&&_0xc01851['length']<=parseInt(_0x460b64[_0x3e1b('0x111')])?'x':'i';}var _0xacc330=this['getVariable'][_0x3e1b('0x70')](this,_0x460b64[_0x3e1b('0xd9')]);if(!_0xacc330){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x460b64,_0x3e1b('0xda'));}this[_0x3e1b('0xf')][_0x3e1b('0x9c')](_0xacc330,_0xc01851);if(this[_0x3e1b('0x81')](_0x460b64[_0x3e1b('0x114')])){var _0x9ac798=parseInt(_0x460b64[_0x3e1b('0x114')],0xa);var _0x33ace4=rs[_0x3e1b('0x115')]({'charset':'*','length':_0x9ac798});var _0x2fd183=_0xc01851[_0x3e1b('0x98')];if(_0x2fd183>0x0){if(_0x2fd183>_0x9ac798){this[_0x3e1b('0x39')][_0x3e1b('0x70')](this,_0x460b64,_0x460b64[_0x3e1b('0x116')]===_0x3e1b('0x117')?_0x33ace4+_0xc01851['substr'](_0x9ac798):_0xc01851[_0x3e1b('0x118')](0x0,_0x2fd183-_0x9ac798)+_0x33ace4);}else{this[_0x3e1b('0x39')][_0x3e1b('0x70')](this,_0x460b64,rs[_0x3e1b('0x115')]({'charset':'*','length':_0x2fd183}));}}else{this[_0x3e1b('0x39')][_0x3e1b('0x70')](this,_0x460b64,'');}}else{this[_0x3e1b('0x39')]['sync'](this,_0x460b64,_0xc01851);}return _0x439db4;};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0xe')]=function(_0x6fed65){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x119'),_0x6fed65['label']));return this[_0x3e1b('0xd')](_0x6fed65);};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x11a')]=function(_0xfa8f6b){logger[_0x3e1b('0x32')](util['format'](_0x3e1b('0x11b'),_0xfa8f6b['label']));this[_0x3e1b('0x39')][_0x3e1b('0x70')](this,_0xfa8f6b,_0xfa8f6b['goalname']);return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0x11c'),_0xfa8f6b[_0x3e1b('0x11d')]));};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x11e')]=function(_0xd3fc31){logger['info'](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0xd3fc31[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0xd3fc31['aws_access_key_id'])||!this[_0x3e1b('0x81')](_0xd3fc31[_0x3e1b('0x84')])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0xd3fc31[_0x3e1b('0x5c')])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](_0x3e1b('0xab'));}this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0x11f'),_0xd3fc31[_0x3e1b('0x5c')]));var _0x285f06=this[_0x3e1b('0x82')][_0x3e1b('0x70')](this,_0xd3fc31);if(_0x285f06){this['channel'][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')]('aws\x20Polly\x20%s\x20file\x20created',_0x285f06));var _0x31e0f2=this[_0x3e1b('0xf')]['streamFile'](_0x285f06);try{fs[_0x3e1b('0xfd')](_0x285f06+_0x3e1b('0xfe'));}catch(_0x1f2c34){logger[_0x3e1b('0x2f')](_0x1f2c34);}return _0x31e0f2;}return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0xd3fc31,_0x3e1b('0x120'));};AGIVertices[_0x3e1b('0x12')]['awslex']=function(_0x108d31){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x121'),_0x108d31[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x108d31[_0x3e1b('0x83')])||!this[_0x3e1b('0x81')](_0x108d31[_0x3e1b('0x84')])){return this['channel'][_0x3e1b('0xaa')](_0x3e1b('0x122'));}if(!this['isConfigured'](_0x108d31[_0x3e1b('0x89')])){return this[_0x3e1b('0xf')]['noop'](_0x3e1b('0x123'));}if(!this[_0x3e1b('0x81')](_0x108d31[_0x3e1b('0x5c')])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')]('no\x20text\x20configured');}this[_0x3e1b('0xf')][_0x3e1b('0xeb')]=!![];this[_0x3e1b('0x39')](_0x108d31);this[_0x3e1b('0x45')](_0x108d31[_0x3e1b('0x5c')],'in');this[_0x3e1b('0xf')]['noop'](util['format'](_0x3e1b('0x124'),_0x108d31[_0x3e1b('0x5c')]));var _0x549458=this[_0x3e1b('0x87')][_0x3e1b('0x70')](this,_0x108d31);if(_0x549458){for(var _0x2625f9 in _0x549458){if(_0x549458[_0x3e1b('0x91')](_0x2625f9)&&_[_0x3e1b('0x92')](_0x549458[_0x2625f9])){this[_0x3e1b('0xf')][_0x3e1b('0x9c')](util[_0x3e1b('0x2c')](_0x3e1b('0x125'),_0x2625f9['toUpperCase']()),_0x549458[_0x2625f9]);}}if(_[_0x3e1b('0x4a')](_0x549458[_0x3e1b('0x75')])){return this[_0x3e1b('0xf')]['noop'](_0x3e1b('0x126'));}else{this[_0x3e1b('0x45')](_0x549458[_0x3e1b('0x75')],_0x3e1b('0xfa'));return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0x127'),_0x549458['message']));}}return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x108d31,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype'][_0x3e1b('0x128')]=function(_0x3f926e){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x129'),_0x3f926e[_0x3e1b('0x3a')],_0x3f926e[_0x3e1b('0x66')]));if(!this[_0x3e1b('0x81')](_0x3f926e['key'])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](_0x3e1b('0xea'));}var _0x3d3236=_0x3e1b('0x12a');var _0x1eb81e=util[_0x3e1b('0x2c')](_0x3e1b('0x12b'),FILES_PATH,rs[_0x3e1b('0x115')](0x4));var _0x3ea9b1=util['format'](_0x3e1b('0x9b'),_0x1eb81e,_0x3d3236);var _0x15520a=!![];if(_0x3f926e['beep']===_0x3e1b('0x12c')){_0x15520a=![];}var _0x3ab5f4=this[_0x3e1b('0xf')][_0x3e1b('0x12d')](_0x1eb81e,_0x3d3236,_0x3f926e['intKey'],_0x3f926e[_0x3e1b('0x66')],undefined,_0x15520a);if(_0x3ab5f4['result']!==-0x1){this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')]('google\x20%s\x20file\x20created',_0x3ea9b1));var _0x24149a=this[_0x3e1b('0x8a')][_0x3e1b('0x70')](this,_0x3f926e,_0x3ea9b1);if(_0x24149a){for(var _0x34396c in _0x24149a){if(_0x24149a[_0x3e1b('0x91')](_0x34396c)){this[_0x3e1b('0xf')][_0x3e1b('0x9c')](util[_0x3e1b('0x2c')](_0x3e1b('0x12e'),_0x34396c[_0x3e1b('0xf9')]()),_0x24149a[_0x34396c]);}}return this[_0x3e1b('0xf')]['noop'](util[_0x3e1b('0x2c')](_0x3e1b('0x12f'),JSON[_0x3e1b('0x72')](_0x24149a)));}}return _0x3ab5f4;};AGIVertices[_0x3e1b('0x12')]['tildeasr']=function(_0x195516){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x130'),_0x195516[_0x3e1b('0x3a')]));if(!this['isConfigured'](_0x195516['appid'])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](_0x3e1b('0x131'));}if(!this[_0x3e1b('0x81')](_0x195516[_0x3e1b('0x8d')])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')]('no\x20appsecret\x20configured');}var _0x1ed7bb='wav';var _0x5408d9=util[_0x3e1b('0x2c')](_0x3e1b('0x12b'),FILES_PATH,rs[_0x3e1b('0x115')](0x4));var _0x53d713=util[_0x3e1b('0x2c')](_0x3e1b('0x9b'),_0x5408d9,_0x1ed7bb);var _0x174110=!![];if(_0x195516['beep']===_0x3e1b('0x12c')){_0x174110=![];}var _0x3ee9bf=this['channel']['recordFile'](_0x5408d9,_0x1ed7bb,_0x195516[_0x3e1b('0x132')],_0x195516[_0x3e1b('0x66')],undefined,_0x174110);if(_0x3ee9bf[_0x3e1b('0xa4')]!==-0x1){this['channel'][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0x133'),_0x53d713));var _0x2c85f8=this['tildeASR'][_0x3e1b('0x70')](this,_0x195516,_0x53d713);if(_0x2c85f8){for(var _0xcd4dde in _0x2c85f8){if(_0x2c85f8[_0x3e1b('0x91')](_0xcd4dde)){this[_0x3e1b('0xf')][_0x3e1b('0x9c')](util[_0x3e1b('0x2c')](_0x3e1b('0x134'),_0xcd4dde[_0x3e1b('0xf9')]()),_0x2c85f8[_0xcd4dde]);}}return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0x135'),JSON['stringify'](_0x2c85f8)));}}return _0x3ee9bf;};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x136')]=function(_0xfe5b26){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x137'),_0xfe5b26[_0x3e1b('0x3a')]));return this['channel'][_0x3e1b('0x138')](_0xfe5b26['context'],_0xfe5b26[_0x3e1b('0x41')],_0xfe5b26[_0x3e1b('0x42')]);};AGIVertices[_0x3e1b('0x12')]['gotoif']=function(_0x55d020){logger['info'](util[_0x3e1b('0x2c')](_0x3e1b('0x139'),_0x55d020['label']));if(!this[_0x3e1b('0x81')](_0x55d020['condition'])){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x55d020,_0x3e1b('0x13a'));}try{var _0x29cbe4=eval(_0x55d020[_0x3e1b('0x13b')])?'true':_0x3e1b('0x13c');this['channel']['noop'](util['format'](_0x3e1b('0x13d'),_0x55d020[_0x3e1b('0x13b')],_0x29cbe4));return{'code':0xc8,'result':_0x29cbe4};}catch(_0x2f80fd){return{'code':0xc8,'result':_0x3e1b('0x13c')};}};AGIVertices['prototype'][_0x3e1b('0x13e')]=function(_0x3973cd){logger[_0x3e1b('0x32')](util['format'](_0x3e1b('0x13f'),_0x3973cd[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x3973cd[_0x3e1b('0x140')])){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x3973cd,_0x3e1b('0x141'));}var _0x14c76d=this['getIntervals'][_0x3e1b('0x70')](this,_0x3973cd[_0x3e1b('0x140')]);if(!_0x14c76d){return this['channel'][_0x3e1b('0x2f')](_0x3973cd,_0x3e1b('0x142'));}for(var _0x2b5cbb=0x0;_0x2b5cbb<_0x14c76d[_0x3e1b('0x98')];_0x2b5cbb+=0x1){var _0x39f077=this[_0x3e1b('0xf')][_0x3e1b('0x13')](util['format']('IFTIME(%s?true:false)',_0x14c76d[_0x2b5cbb]));if(_0x39f077[_0x3e1b('0xa4')]===-0x1){return _0x39f077;}logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x143'),_0x14c76d[_0x2b5cbb],_0x39f077[_0x3e1b('0xa1')]));if(_0x39f077[_0x3e1b('0xa1')]===_0x3e1b('0x144')){logger['info'](util[_0x3e1b('0x2c')]('IFTIME\x20%s\x20%s',_0x14c76d[_0x2b5cbb],_0x3e1b('0x144')));this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util['format'](_0x3e1b('0x143'),_0x14c76d[_0x2b5cbb],_0x3e1b('0x144')));return{'code':0xc8,'result':_0x3e1b('0x144')};}else{logger['info'](util['format'](_0x3e1b('0x143'),_0x14c76d[_0x2b5cbb],_0x3e1b('0x13c')));this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0x143'),_0x14c76d[_0x2b5cbb],_0x3e1b('0x13c')));}}return{'code':0xc8,'result':_0x3e1b('0x13c')};};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x145')]=function(_0x9eda3a){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x9eda3a['label']));return this[_0x3e1b('0xf')][_0x3e1b('0x145')]();};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x146')]=function(_0x3bf9c8){logger[_0x3e1b('0x32')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x3bf9c8[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x3bf9c8[_0x3e1b('0x79')])){return this[_0x3e1b('0xf')]['noop'](_0x3e1b('0xea'));}var _0x18afdd='wav';var _0x535d9a=util[_0x3e1b('0x2c')](_0x3e1b('0x12b'),FILES_PATH,rs[_0x3e1b('0x115')](0x4));var _0x59d991=util['format'](_0x3e1b('0x9b'),_0x535d9a,_0x18afdd);var _0x38122b=!![];if(_0x3bf9c8[_0x3e1b('0x147')]===_0x3e1b('0x12c')){_0x38122b=![];}var _0x513765=this[_0x3e1b('0xf')][_0x3e1b('0x12d')](_0x535d9a,_0x18afdd,_0x3bf9c8['intKey'],_0x3bf9c8[_0x3e1b('0x66')],undefined,_0x38122b);if(_0x513765['result']!==-0x1){this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')]('ispeech\x20%s\x20file\x20created',_0x59d991));var _0x49521b=this[_0x3e1b('0x7f')][_0x3e1b('0x70')](this,_0x3bf9c8,_0x59d991);if(_0x49521b){for(var _0xcdfbb7 in _0x49521b){if(_0x49521b['hasOwnProperty'](_0xcdfbb7)){this[_0x3e1b('0xf')][_0x3e1b('0x9c')](util[_0x3e1b('0x2c')](_0x3e1b('0x148'),_0xcdfbb7[_0x3e1b('0xf9')]()),_0x49521b[_0xcdfbb7]);}}return this['channel'][_0x3e1b('0xaa')](util['format'](_0x3e1b('0x149'),JSON[_0x3e1b('0x72')](_0x49521b)));}}return _0x513765;};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x14a')]=function(_0x630c8d){logger['info'](util[_0x3e1b('0x2c')](_0x3e1b('0x14b'),_0x630c8d[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x630c8d[_0x3e1b('0x79')])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x630c8d['text'])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')]('no\x20text\x20configured');}this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')]('Trying\x20ispeech\x20TTS\x20%s',_0x630c8d['text']));var _0x115564=this[_0x3e1b('0x7b')][_0x3e1b('0x70')](this,_0x630c8d);if(_0x115564){this['channel'][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0x14c'),_0x115564));var _0xcd5a98=this[_0x3e1b('0xf')][_0x3e1b('0xfc')](_0x115564,_0x630c8d['intKey']);try{fs[_0x3e1b('0xfd')](_0x115564+_0x3e1b('0xfe'));}catch(_0x6cf0b6){logger['error'](_0x6cf0b6);}return _0xcd5a98;}return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x630c8d,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x14d')]=function(_0x4677de){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x14e'),_0x4677de['label']));if(!this['isConfigured'](_0x4677de[_0x3e1b('0x14f')])){return this['channel']['error'](_0x4677de,_0x3e1b('0x150'));}logger[_0x3e1b('0x32')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3e1b('0xf')][_0x3e1b('0x3c')],_0x4677de[_0x3e1b('0x14f')]));var _0x429a8a=this[_0x3e1b('0x58')]['sync'](this,_0x4677de[_0x3e1b('0x14f')]);if(_0x429a8a){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x151'),this[_0x3e1b('0xf')][_0x3e1b('0x3c')],_0x4677de[_0x3e1b('0x14f')]));this['channel'][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0x151'),this[_0x3e1b('0xf')][_0x3e1b('0x3c')],_0x4677de[_0x3e1b('0x14f')]));return{'code':0xc8,'result':'success'};}else{logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x152'),this[_0x3e1b('0xf')][_0x3e1b('0x3c')],_0x4677de[_0x3e1b('0x14f')]));this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util['format'](_0x3e1b('0x152'),this[_0x3e1b('0xf')]['callerid'],_0x4677de[_0x3e1b('0x14f')]));return{'code':0xc8,'result':_0x3e1b('0x153')};}};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x154')]=function(_0x520c78){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x155'),_0x520c78[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x520c78[_0x3e1b('0x14f')])){return this['channel']['error'](_0x520c78,'no\x20find\x20by\x20configured');}logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x156'),this[_0x3e1b('0xf')]['callerid'],_0x520c78[_0x3e1b('0x14f')]));var _0x3d0ea6=this[_0x3e1b('0x56')][_0x3e1b('0x70')](this,_0x520c78['findBy']);if(_0x3d0ea6){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x151'),this[_0x3e1b('0xf')]['callerid'],_0x520c78[_0x3e1b('0x14f')]));this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0x151'),this[_0x3e1b('0xf')]['callerid'],_0x520c78[_0x3e1b('0x14f')]));return{'code':0xc8,'result':_0x3e1b('0x157')};}else{logger[_0x3e1b('0x32')](util['format'](_0x3e1b('0x152'),this[_0x3e1b('0xf')]['callerid'],_0x520c78['findBy']));this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util['format'](_0x3e1b('0x152'),this['channel'][_0x3e1b('0x3c')],_0x520c78[_0x3e1b('0x14f')]));return{'code':0xc8,'result':_0x3e1b('0x153')};}};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x158')]=function(_0x4aa1ef){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x4aa1ef[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x4aa1ef[_0x3e1b('0x159')])){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x4aa1ef,'no\x20operation\x20configured');}this['channel'][_0x3e1b('0xaa')](util['format'](_0x3e1b('0x15a'),_0x4aa1ef[_0x3e1b('0x159')]));var _0x3f4942=eval(_0x4aa1ef[_0x3e1b('0x159')]);if(!this[_0x3e1b('0x81')](_0x4aa1ef[_0x3e1b('0xd9')])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](_0x3e1b('0x10f'));}var _0x2bc8df=this['getVariable'][_0x3e1b('0x70')](this,_0x4aa1ef[_0x3e1b('0xd9')]);if(!_0x2bc8df){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x4aa1ef,_0x3e1b('0xda'));}if(_[_0x3e1b('0x97')](_0x3f4942)){var _0x214e52=this;_0x3f4942[_0x3e1b('0xdb')](function(_0x97881e,_0x4ed3c3){_0x214e52[_0x3e1b('0xf')][_0x3e1b('0x9c')](util['format'](_0x3e1b('0x15b'),_0x2bc8df,_0x4ed3c3),_0x97881e);});return this['channel'][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')]('variable\x20%s[key]\x20set',_0x2bc8df));}else{return this['channel']['setVariable'](_0x2bc8df,_0x3f4942);}};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0xc')]=function(_0x2e0474){logger[_0x3e1b('0x32')](util['format'](_0x3e1b('0x15c'),_0x2e0474['label']));if(_0x2e0474[_0x3e1b('0xa7')]===0x0){return this[_0x3e1b('0xa6')](_0x2e0474);}_0x2e0474[_0x3e1b('0xa7')]-=0x1;if(!this[_0x3e1b('0x81')](_0x2e0474[_0x3e1b('0x10c')])){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x2e0474,_0x3e1b('0x10d'));}var _0x344d0e=this[_0x3e1b('0x1f')][_0x3e1b('0x70')](this,_0x2e0474[_0x3e1b('0x10c')]);if(!_0x344d0e){return this['channel'][_0x3e1b('0x2f')](_0x2e0474,_0x3e1b('0x10e'));}var _0x348ae1=this[_0x3e1b('0xf')][_0x3e1b('0x110')](_0x344d0e,_0x2e0474[_0x3e1b('0x15d')],_0x2e0474['digit']);var _0x1ab3f9=_0x348ae1[_0x3e1b('0xa4')];if(_0x348ae1[_0x3e1b('0xa4')]===-0x1){this[_0x3e1b('0x39')][_0x3e1b('0x70')](this,_0x2e0474,'-1');return _0x348ae1;}else if(_0x348ae1[_0x3e1b('0xa1')]==='timeout'){_0x348ae1[_0x3e1b('0xa4')]=_0x348ae1['result'][_0x3e1b('0x98')]>0x0?_0x348ae1[_0x3e1b('0xa4')]:'t';}else if(_[_0x3e1b('0x9a')](_0x348ae1[_0x3e1b('0xa4')])){_0x348ae1[_0x3e1b('0xa4')]='#';_0x1ab3f9='#';}if(!this[_0x3e1b('0x81')](_0x2e0474[_0x3e1b('0xd9')])){this[_0x3e1b('0xf')][_0x3e1b('0xaa')](_0x3e1b('0x10f'));}else{var _0x30c065=this[_0x3e1b('0x13')][_0x3e1b('0x70')](this,_0x2e0474[_0x3e1b('0xd9')]);if(!_0x30c065){return this['channel'][_0x3e1b('0x2f')](_0x2e0474,_0x3e1b('0xda'));}this[_0x3e1b('0xf')][_0x3e1b('0x9c')](_0x30c065,_0x1ab3f9);}this['createSquareDetailsReport']['sync'](this,_0x2e0474,_0x1ab3f9);return _0x348ae1;};AGIVertices[_0x3e1b('0x12')]['noop']=function(_0x2d8105){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x15e'),_0x2d8105[_0x3e1b('0x3a')]));return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](_0x2d8105['output']||_0x2d8105[_0x3e1b('0x3a')]);};AGIVertices['prototype'][_0x3e1b('0x15f')]=function(_0x3ecf76){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x160'),_0x3ecf76[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x3ecf76['findBy'])){return this['channel'][_0x3e1b('0x2f')](_0x3ecf76,'no\x20find\x20by\x20configured');}logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x156'),this[_0x3e1b('0xf')][_0x3e1b('0x3c')],_0x3ecf76[_0x3e1b('0x14f')]));var _0x33c560=this[_0x3e1b('0x52')]['sync'](this,_0x3ecf76[_0x3e1b('0x161')]);var _0x3911ce=this[_0x3e1b('0x53')][_0x3e1b('0x70')](this,_0x3ecf76[_0x3e1b('0x14f')],_0x33c560);if(_0x3911ce){logger['info'](util[_0x3e1b('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x3ecf76['findBy']));this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x3e1b('0xf')]['callerid'],_0x3ecf76[_0x3e1b('0x14f')]));return{'code':0xc8,'result':_0x3e1b('0x157')};}else{logger[_0x3e1b('0x32')](util['format'](_0x3e1b('0x152'),this[_0x3e1b('0xf')][_0x3e1b('0x3c')],_0x3ecf76['findBy']));this['channel'][_0x3e1b('0xaa')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x3e1b('0xf')][_0x3e1b('0x3c')],_0x3ecf76[_0x3e1b('0x14f')]));return{'code':0xc8,'result':_0x3e1b('0x153')};}};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x162')]=function(_0x12bab4){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x163'),_0x12bab4[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x12bab4[_0x3e1b('0x10c')])){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x12bab4,'no\x20file\x20audio\x20selected');}var _0x1b71c5=this[_0x3e1b('0x1f')][_0x3e1b('0x70')](this,_0x12bab4['file_id']);if(!_0x1b71c5){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x12bab4,_0x3e1b('0x10e'));}var _0x4b07ce=this[_0x3e1b('0xf')]['exec']('PLAYBACK',[_0x1b71c5,_0x12bab4[_0x3e1b('0x164')]]);if(_0x4b07ce[_0x3e1b('0xa4')]===-0x1){return _0x4b07ce;}return this['channel'][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0xc4'),_0x3e1b('0x165'),_0x1b71c5));};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x166')]=function(_0x99c49d){logger[_0x3e1b('0x32')](util['format'](_0x3e1b('0x167'),_0x99c49d[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x99c49d[_0x3e1b('0x168')])){return this[_0x3e1b('0xf')]['error'](_0x99c49d,_0x3e1b('0x169'));}var _0x43bcc0='';var _0x306c00=parseInt(_0x99c49d[_0x3e1b('0x168')],0xa);if(isNaN(_0x306c00)){_0x43bcc0=_0x99c49d['queue_id'];}else{_0x43bcc0=this[_0x3e1b('0x18')][_0x3e1b('0x70')](this,_0x99c49d[_0x3e1b('0x168')]);if(!_0x43bcc0){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x99c49d,_0x3e1b('0x16a'));}}var _0x414a3f='';if(this[_0x3e1b('0x81')](_0x99c49d['file_id'])){var _0x4c2048=this[_0x3e1b('0x1f')][_0x3e1b('0x70')](this,_0x99c49d['file_id']);if(_0x4c2048){_0x414a3f=_0x4c2048;}}this[_0x3e1b('0x39')][_0x3e1b('0x70')](this,_0x99c49d,_0x43bcc0);if(_0x99c49d[_0x3e1b('0x164')]['indexOf']('x')<0x0){_0x99c49d[_0x3e1b('0x164')]+='x';}if(_0x99c49d[_0x3e1b('0x164')][_0x3e1b('0x16b')]('X')<0x0){_0x99c49d[_0x3e1b('0x164')]+='X';}this[_0x3e1b('0xf')][_0x3e1b('0x9c')](_0x3e1b('0x16c'),_0x43bcc0?_0x43bcc0[_0x3e1b('0x16d')]():'');var _0x3ae8f8=this['channel'][_0x3e1b('0x59')]('QUEUE',[_0x43bcc0,_0x99c49d[_0x3e1b('0x164')],_0x99c49d[_0x3e1b('0x64')],_0x414a3f,_0x99c49d['timeout'],_0x99c49d[_0x3e1b('0x8')],_0x99c49d[_0x3e1b('0x16e')],_0x99c49d[_0x3e1b('0x16f')],'',_0x99c49d['position']]);if(_0x3ae8f8[_0x3e1b('0xa4')]===-0x1){return _0x3ae8f8;}return this['channel'][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0xc4'),'QUEUE',_0x43bcc0));};AGIVertices[_0x3e1b('0x12')]['record']=function(_0x82537e){logger[_0x3e1b('0x32')](util['format'](_0x3e1b('0x170'),_0x82537e[_0x3e1b('0x3a')]));var _0x1d59ef=_0x82537e['recordingFormat']||_0x3e1b('0x12a');var _0x193ceb=util['format'](_0x3e1b('0x171'),this[_0x3e1b('0xf')][_0x3e1b('0x3e')],rs[_0x3e1b('0x115')](0x5));var _0xe08e7b=util[_0x3e1b('0x2c')]('%s/recordings/%s.%s',FILES_PATH,_0x193ceb,_0x1d59ef);var _0x172b42=util[_0x3e1b('0x2c')](_0x3e1b('0x12b'),FILES_PATH,_0x193ceb);this[_0x3e1b('0x3d')][_0x3e1b('0x70')](this,_0x82537e,_0x193ceb,_0xe08e7b);this[_0x3e1b('0xf')][_0x3e1b('0x9c')](_0x3e1b('0x172'),_0x193ceb);logger[_0x3e1b('0x32')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x172b42,_0x1d59ef,_0x82537e[_0x3e1b('0x173')],_0x82537e[_0x3e1b('0x66')]);return this['channel']['recordFile'](_0x172b42,_0x1d59ef,_0x82537e['escape_digits'],_0x82537e[_0x3e1b('0x66')],undefined,!![]);};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x174')]=function(_0x5d64ee){logger[_0x3e1b('0x32')](util['format'](_0x3e1b('0x175'),_0x5d64ee['label']));if(!this[_0x3e1b('0x81')](_0x5d64ee[_0x3e1b('0x64')])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](_0x3e1b('0x176'));}var _0x20f7d2=this[_0x3e1b('0x63')]['sync'](this,_0x5d64ee);logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x177'),util[_0x3e1b('0x178')](_0x20f7d2,{'showHidden':![],'depth':null})));if(!this[_0x3e1b('0x81')](_0x5d64ee[_0x3e1b('0xd9')])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x220bcc=this[_0x3e1b('0x13')][_0x3e1b('0x70')](this,_0x5d64ee[_0x3e1b('0xd9')]);if(!_0x220bcc){return this['channel'][_0x3e1b('0x2f')](_0x5d64ee,_0x3e1b('0xda'));}this[_0x3e1b('0xf')][_0x3e1b('0x9c')](util['format'](_0x3e1b('0x179'),_0x220bcc),_0x20f7d2[_0x3e1b('0x17a')]?_0x20f7d2[_0x3e1b('0x17a')]:'200');this[_0x3e1b('0xf')][_0x3e1b('0x9c')](util[_0x3e1b('0x2c')](_0x3e1b('0x17b'),_0x220bcc),_0x20f7d2[_0x3e1b('0x74')]?_0x20f7d2['statusMessage']:'OK');if(_0x20f7d2[_0x3e1b('0x69')]){try{this['saveRestApiResult'](_0x20f7d2[_0x3e1b('0x69')],_0x220bcc);}catch(_0x5b39d1){logger[_0x3e1b('0x2f')](util['format'](_0x3e1b('0x17c'),_0x220bcc));}}return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0xdf'),_0x220bcc));};AGIVertices[_0x3e1b('0x12')]['saydigits']=function(_0x39140f){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x17d'),_0x39140f[_0x3e1b('0x3a')]));return this[_0x3e1b('0xf')]['sayDigits'](_0x39140f[_0x3e1b('0x17e')][_0x3e1b('0xd7')](/\s+/g,''),_0x39140f[_0x3e1b('0x173')]);};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x17f')]=function(_0xeb0298){logger['info'](util[_0x3e1b('0x2c')](_0x3e1b('0x180'),_0xeb0298[_0x3e1b('0x3a')]));return this[_0x3e1b('0xf')][_0x3e1b('0x181')](_0xeb0298['number'][_0x3e1b('0xd7')](/\s+/g,''),_0xeb0298[_0x3e1b('0x173')]);};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x182')]=function(_0x517889){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x183'),_0x517889[_0x3e1b('0x3a')]));return this['channel'][_0x3e1b('0x184')](_0x517889['text'],_0x517889[_0x3e1b('0x173')]);};AGIVertices[_0x3e1b('0x12')]['sendMail']=function(_0x550df5){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x550df5[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x550df5[_0x3e1b('0x185')])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](_0x3e1b('0x186'));}var _0x167afd=this[_0x3e1b('0x22')][_0x3e1b('0x70')](this,_0x550df5['account_id']);if(!_0x167afd||!_0x167afd['Smtp']){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x550df5,'no\x20mail\x20account\x20found');}var _0x2551e8={'from':util[_0x3e1b('0x2c')]('\x22%s\x22\x20<%s>',_0x167afd[_0x3e1b('0x16')],_0x167afd[_0x3e1b('0x187')]||_0x167afd[_0x3e1b('0x188')][_0x3e1b('0x189')]),'to':_0x550df5['to']||'','cc':_0x550df5['cc']||'','bcc':_0x550df5[_0x3e1b('0x18a')]||'','subject':_0x550df5[_0x3e1b('0x18b')],'html':_0x550df5[_0x3e1b('0x5c')],'text':_0x550df5[_0x3e1b('0x5c')]};var _0x551d31={'tls':{'rejectUnauthorized':![]}};if(_0x167afd['Smtp'][_0x3e1b('0x18c')]){_0x551d31['service']=_0x167afd[_0x3e1b('0x188')]['service'];}else{_0x551d31[_0x3e1b('0x18d')]=_0x167afd[_0x3e1b('0x188')][_0x3e1b('0x18d')];_0x551d31[_0x3e1b('0x18e')]=_0x167afd[_0x3e1b('0x188')]['port'];_0x551d31[_0x3e1b('0x18f')]=_0x167afd[_0x3e1b('0x188')][_0x3e1b('0x18f')];}if(_0x167afd[_0x3e1b('0x188')][_0x3e1b('0x190')]){_0x551d31[_0x3e1b('0x191')]={'user':_0x167afd[_0x3e1b('0x188')]['user'],'pass':_0x167afd[_0x3e1b('0x188')][_0x3e1b('0x192')]};}if(this[_0x3e1b('0x81')](_0x550df5[_0x3e1b('0x193')])){}logger['debug'](_0x3e1b('0x194'),JSON[_0x3e1b('0x72')](_0x2551e8));this[_0x3e1b('0x39')][_0x3e1b('0x70')](this,_0x550df5,_0x550df5[_0x3e1b('0x185')]);this['channel'][_0x3e1b('0xaa')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x167afd[_0x3e1b('0x16')]));this['sendMailMessage'][_0x3e1b('0x70')](this,_0x551d31,_0x2551e8);return this[_0x3e1b('0xf')]['noop'](_0x3e1b('0x195'));};AGIVertices['prototype']['sendFax']=function(_0x39d035){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x196'),_0x39d035[_0x3e1b('0x3a')]));return this['channel'][_0x3e1b('0xaa')](_0x3e1b('0x197'));};AGIVertices[_0x3e1b('0x12')]['sendSMS']=function(_0x3e2620){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x198'),_0x3e2620[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x3e2620[_0x3e1b('0x199')])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](_0x3e1b('0x19a'));}var _0x5d6a05=this[_0x3e1b('0x37')][_0x3e1b('0x70')](this,_0x3e2620['sms_account_id']);if(!_0x5d6a05){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x3e2620,_0x3e1b('0x19b'));}var _0x3a17b5={'body':_0x3e2620[_0x3e1b('0x19c')],'phone':_0x3e2620['to']||'','SmsAccountId':_0x5d6a05['id']};logger['debug'](_0x3e1b('0x19d'),JSON[_0x3e1b('0x72')](_0x3a17b5));this[_0x3e1b('0x39')][_0x3e1b('0x70')](this,_0x3e2620,_0x3e2620[_0x3e1b('0x199')]);this[_0x3e1b('0xf')]['noop'](util[_0x3e1b('0x2c')](_0x3e1b('0x19e'),_0x5d6a05['name']));this[_0x3e1b('0x38')][_0x3e1b('0x70')](this,_0x3a17b5);return this[_0x3e1b('0xf')]['noop'](_0x3e1b('0x19f'));};AGIVertices['prototype'][_0x3e1b('0x1a0')]=function(_0x2b1ec7){logger['info'](util['format'](_0x3e1b('0x1a1'),_0x2b1ec7[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x2b1ec7[_0x3e1b('0xd9')])){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x2b1ec7,_0x3e1b('0x1a2'));}var _0x4ef0ec=this[_0x3e1b('0x13')][_0x3e1b('0x70')](this,_0x2b1ec7[_0x3e1b('0xd9')]);if(!_0x4ef0ec){return this['channel']['error'](_0x2b1ec7,'no\x20variable\x20found');}return this['channel'][_0x3e1b('0x9c')](_0x4ef0ec,_0x2b1ec7[_0x3e1b('0x1a3')]);};AGIVertices['prototype'][_0x3e1b('0x1a4')]=function(_0x140935){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x1a5'),_0x140935[_0x3e1b('0x3a')]));this[_0x3e1b('0xf')][_0x3e1b('0xaa')]('START\x20CALLY\x20SQUARE');if(_0x140935[_0x3e1b('0xb8')]===_0x3e1b('0x1a6')){this['channel'][_0x3e1b('0xaa')](_0x3e1b('0x1a7'));return this[_0x3e1b('0xf')][_0x3e1b('0xb8')]();}return this[_0x3e1b('0xf')]['noop'](_0x3e1b('0x1a8'));};AGIVertices['prototype'][_0x3e1b('0x1a9')]=function(_0x4059e9){logger['info'](util[_0x3e1b('0x2c')](_0x3e1b('0x1aa'),_0x4059e9[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x4059e9[_0x3e1b('0x1ab')])){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x4059e9,_0x3e1b('0x1ac'));}var _0x5527b6=this['getSquareProject'][_0x3e1b('0x70')](this,_0x4059e9[_0x3e1b('0x1ab')]);if(!this[_0x3e1b('0x81')](_0x5527b6)){return this['channel'][_0x3e1b('0x2f')](_0x4059e9,util[_0x3e1b('0x2c')](_0x3e1b('0x1ad'),_0x4059e9[_0x3e1b('0x1ab')]));}if(_0x5527b6===this['channel']['arg_1']){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x4059e9,_0x3e1b('0x1ae'));}this[_0x3e1b('0x39')][_0x3e1b('0x70')](this,_0x4059e9,_0x5527b6);var _0x4d7c14=this['channel'][_0x3e1b('0x59')](_0x3e1b('0x1af'),util[_0x3e1b('0x2c')](_0x3e1b('0x1b0'),config[_0x3e1b('0x8')][_0x3e1b('0x18d')]||'127.0.0.1',_0x5527b6,this[_0x3e1b('0xf')][_0x3e1b('0x1b1')]));if(_0x4d7c14[_0x3e1b('0xa4')]===-0x1){return _0x4d7c14;}return this[_0x3e1b('0xf')]['noop'](util[_0x3e1b('0x2c')](_0x3e1b('0xc4'),'AGI',_0x5527b6));};AGIVertices['prototype'][_0x3e1b('0x1b2')]=function(_0x1538fb){logger['info'](util[_0x3e1b('0x2c')](_0x3e1b('0x1b3'),_0x1538fb[_0x3e1b('0x3a')]));var _0x383c1f=this[_0x3e1b('0x1b4')][_0x3e1b('0x70')](this,_0x1538fb[_0x3e1b('0xb6')]);this['createSquareDetailsReport'][_0x3e1b('0x70')](this,_0x1538fb,_0x1538fb[_0x3e1b('0xb6')]);if(this[_0x3e1b('0x81')](_0x1538fb[_0x3e1b('0xd9')])){var _0x10795e=this[_0x3e1b('0x13')][_0x3e1b('0x70')](this,_0x1538fb[_0x3e1b('0xd9')]);if(_0x10795e){this['channel']['setVariable'](_0x10795e,_0x383c1f);return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0x1b5'),_0x1538fb['command'],_0x10795e));}}return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util['format'](_0x3e1b('0x1b6'),_0x1538fb[_0x3e1b('0xb6')]));};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x1b7')]=function(_0x5883ac){logger[_0x3e1b('0x32')](util['format'](_0x3e1b('0x1b8'),_0x5883ac[_0x3e1b('0x3a')]));_0x5883ac[_0x3e1b('0x5c')]=_0x5883ac['text'][_0x3e1b('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5883ac[_0x3e1b('0x1b9')])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](_0x3e1b('0x1ba'));}if(!this['isConfigured'](_0x5883ac['text'])){return this[_0x3e1b('0xf')]['noop']('no\x20text\x20configured');}this['channel'][_0x3e1b('0xaa')](util['format'](_0x3e1b('0x1bb'),_0x5883ac[_0x3e1b('0x5c')]));var _0x2576ef=this[_0x3e1b('0x5b')][_0x3e1b('0x70')](this,_0x5883ac);if(_0x2576ef){this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util['format'](_0x3e1b('0x1bc'),_0x2576ef));var _0x22cd90=this[_0x3e1b('0xf')]['streamFile'](_0x2576ef);try{fs[_0x3e1b('0xfd')](_0x2576ef+'.wav');}catch(_0xb5e82f){logger[_0x3e1b('0x2f')](_0xb5e82f);}return _0x22cd90;}return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x5883ac,_0x3e1b('0x1bd'));};AGIVertices[_0x3e1b('0x12')]['tts']=function(_0x175fed){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x175fed[_0x3e1b('0x3a')]));_0x175fed[_0x3e1b('0x5c')]=_0x175fed[_0x3e1b('0x5c')][_0x3e1b('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3e1b('0x81')](_0x175fed[_0x3e1b('0x5c')])){return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](_0x3e1b('0xab'));}this['channel'][_0x3e1b('0xaa')](util['format'](_0x3e1b('0x1be'),_0x175fed[_0x3e1b('0x5c')]));var _0x8574d7=this['googleTTS']['sync'](this,_0x175fed);if(_0x8574d7){this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0x1bf'),_0x8574d7));var _0x4b8940=this['channel'][_0x3e1b('0xfc')](_0x8574d7);try{fs['unlink'](_0x8574d7+'.wav');}catch(_0x513494){logger[_0x3e1b('0x2f')](_0x513494);}return _0x4b8940;}return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x175fed,_0x3e1b('0x1c0'));};AGIVertices[_0x3e1b('0x12')]['unpause']=function(_0x22d156){logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x1c1'),_0x22d156['label']));if(!this['isConfigured'](_0x22d156[_0x3e1b('0x14f')])){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x22d156,_0x3e1b('0x150'));}logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x156'),this[_0x3e1b('0xf')][_0x3e1b('0x3c')],_0x22d156[_0x3e1b('0x14f')]));var _0x1cdaca=this['agentUnpause'][_0x3e1b('0x70')](this,_0x22d156[_0x3e1b('0x14f')]);if(_0x1cdaca){logger['info'](util['format'](_0x3e1b('0x151'),this[_0x3e1b('0xf')]['callerid'],_0x22d156[_0x3e1b('0x14f')]));this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x3e1b('0xf')]['callerid'],_0x22d156['findBy']));return{'code':0xc8,'result':_0x3e1b('0x157')};}else{logger[_0x3e1b('0x32')](util[_0x3e1b('0x2c')](_0x3e1b('0x152'),this[_0x3e1b('0xf')][_0x3e1b('0x3c')],_0x22d156[_0x3e1b('0x14f')]));this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0x152'),this['channel'][_0x3e1b('0x3c')],_0x22d156['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3e1b('0x12')][_0x3e1b('0x1c2')]=function(_0x44d471){logger[_0x3e1b('0x32')](util['format'](_0x3e1b('0x1c3'),_0x44d471[_0x3e1b('0x3a')]));var _0x19c779=this[_0x3e1b('0xf')]['exec'](_0x3e1b('0x1c4'),[_0x44d471['mailbox'],_0x44d471[_0x3e1b('0x77')]]);if(_0x19c779[_0x3e1b('0xa4')]===-0x1){return _0x19c779;}return this[_0x3e1b('0xf')][_0x3e1b('0xaa')](util[_0x3e1b('0x2c')](_0x3e1b('0xc4'),_0x3e1b('0x1c4'),_0x44d471[_0x3e1b('0x1c5')]));};AGIVertices['prototype'][_0x3e1b('0x1c6')]=function(_0x45f642){logger['info'](util[_0x3e1b('0x2c')](_0x3e1b('0x1c7'),_0x45f642[_0x3e1b('0x3a')]));if(!this[_0x3e1b('0x81')](_0x45f642['variable_id'])){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x45f642,'no\x20variable\x20selected');}var _0x506c7a=this[_0x3e1b('0x13')]['sync'](this,_0x45f642[_0x3e1b('0xd9')]);if(!_0x506c7a){return this[_0x3e1b('0xf')][_0x3e1b('0x2f')](_0x45f642,'no\x20variable\x20found');}var _0x12df8f=this[_0x3e1b('0xf')][_0x3e1b('0x13')](_0x506c7a);return{'code':0xc8,'result':_0x12df8f[_0x3e1b('0xa1')]?_0x12df8f[_0x3e1b('0xa1')]:'-'};};String[_0x3e1b('0x12')][_0x3e1b('0xa0')]=function(_0x3289f7,_0x418b7f){return this[_0x3e1b('0x9e')](_0x3289f7)[_0x3e1b('0x1c8')](_0x418b7f);};module[_0x3e1b('0x1c9')]=AGIVertices; \ No newline at end of file +var _0xfcbc=['agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','number','timeout','POST','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','body','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','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','appid','appsecret','uri','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','replaceall\x20init','split','nextbracket','replaceAll','extra','toString','replaceall\x20end','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','sync','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','result','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','callback','enter\x20in\x20callbackblock','no\x20list\x20selected','delay','add','minutes','before\x20createcmcontact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','SESTEK_ASR_CONFIDENCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','setVariable','%s[%s][%s]','variable\x20%s\x20set','dial','sip_id','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','audiofile','streamFile','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','maxRetry','retry','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','variable_id','getData','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','gotoc','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','success','failure','operation','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','%s_STATUS_MESSAGE','statusMessage','saydigits','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','getMailAccount','Smtp','\x22%s\x22\x20<%s>','user','bcc','service','host','port','secure','authentication','auth','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','./scripts','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','then','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','extension','accountcode','file','createSquareMessage','createCmContact','log','in\x20createcmcontact\x20callback','isEmpty','isNil','lastName','phone','list_id','scheduledAt','callback_priority','agent','agentPause'];(function(_0x3989f1,_0x529cce){var _0x82188f=function(_0x307973){while(--_0x307973){_0x3989f1['push'](_0x3989f1['shift']());}};_0x82188f(++_0x529cce);}(_0xfcbc,0x169));var _0xcfcb=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xfcbc[_0x4c0622];return _0x1799d8;};'use strict';var fs=require('fs');var path=require(_0xcfcb('0x0'));var util=require(_0xcfcb('0x1'));var _=require(_0xcfcb('0x2'));var sh=require(_0xcfcb('0x3'));var odbc=require(_0xcfcb('0x4'))();var rs=require(_0xcfcb('0x5'));var moment=require(_0xcfcb('0x6'));var Mustache=require(_0xcfcb('0x7'));var rp=require(_0xcfcb('0x8'));var logger=require('../../config/logger')('agi');var config=require('../../config/environment');var scripts=require(_0xcfcb('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xcfcb('0xa'),_0xcfcb('0xb')];var verticesWithRetry=['menu',_0xcfcb('0xc'),_0xcfcb('0xd')];var AGIVertices=function(_0x25ccd3,_0x31615d,_0x30f209){this[_0xcfcb('0xe')]=_0x25ccd3;this[_0xcfcb('0xf')]=_0x31615d;this[_0xcfcb('0x10')]=_0x30f209;};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x12')]=function(_0xbeae37,_0x41c883){this[_0xcfcb('0xf')][_0xcfcb('0x13')](_0xbeae37)['then'](function(_0x1b7f72){_0x41c883(null,_0x1b7f72?_0x1b7f72[_0xcfcb('0x14')]:![]);})[_0xcfcb('0x15')](function(_0x4374b3){_0x41c883(_0x4374b3);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x16')]=function(_0x2c46f5,_0x3e5262){this[_0xcfcb('0xf')]['getVoiceQueueById'](_0x2c46f5)[_0xcfcb('0x17')](function(_0x16c6e9){_0x3e5262(null,_0x16c6e9?_0x16c6e9['name']:![]);})[_0xcfcb('0x15')](function(_0x2a9256){_0x3e5262(_0x2a9256);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x18')]=function(_0x3a27d1,_0x5151b8){this[_0xcfcb('0xf')][_0xcfcb('0x19')](_0x3a27d1)[_0xcfcb('0x17')](function(_0x2cd575){_0x5151b8(null,_0x2cd575?_0x2cd575[_0xcfcb('0x14')]:![]);})[_0xcfcb('0x15')](function(_0x5c751b){_0x5151b8(_0x5c751b);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x1a')]=function(_0x37fe4f,_0x5d2e93){this['rpc'][_0xcfcb('0x1b')](_0x37fe4f)[_0xcfcb('0x17')](function(_0x816406){_0x5d2e93(null,_0x816406?_0x816406[_0xcfcb('0x1c')]:![]);})[_0xcfcb('0x15')](function(_0x5b9d24){_0x5d2e93(_0x5b9d24);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x1d')]=function(_0x4c9a4b,_0x38777b){this[_0xcfcb('0xf')]['getUserById'](_0x4c9a4b)[_0xcfcb('0x17')](function(_0x5a6820){_0x38777b(null,_0x5a6820?_0x5a6820[_0xcfcb('0x14')]:![]);})['catch'](function(_0x259ba5){_0x38777b(_0x259ba5);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x1e')]=function(_0x4add9d,_0x265eb0){this[_0xcfcb('0xf')][_0xcfcb('0x1f')](_0x4add9d)[_0xcfcb('0x17')](function(_0x1a5119){_0x265eb0(null,_0x1a5119?_0x1a5119[_0xcfcb('0x14')]:![]);})[_0xcfcb('0x15')](function(_0x29c7ce){_0x265eb0(_0x29c7ce);});};AGIVertices[_0xcfcb('0x11')]['getSound']=function(_0x28c32f,_0xe912c7){var _0x3cdb3b=this;this[_0xcfcb('0xf')][_0xcfcb('0x20')](_0x28c32f)['then'](function(_0x35bf70){_0xe912c7(null,_0x35bf70?_0x3cdb3b[_0xcfcb('0x21')](_0x35bf70[_0xcfcb('0x22')]):![]);})[_0xcfcb('0x15')](function(_0x4d171a){_0xe912c7(_0x4d171a);});};AGIVertices[_0xcfcb('0x11')]['getMailAccount']=function(_0x3ebf90,_0x2032b9){this['rpc'][_0xcfcb('0x23')](_0x3ebf90)[_0xcfcb('0x17')](function(_0x35be10){_0x2032b9(null,_0x35be10?_0x35be10:![]);})[_0xcfcb('0x15')](function(_0x216eb4){_0x2032b9(_0x216eb4);});};AGIVertices[_0xcfcb('0x11')]['sendMailMessage']=function(_0x4a009e,_0x4b2b45,_0x37e23c){this[_0xcfcb('0x10')][_0xcfcb('0x24')](_0x4a009e,_0x4b2b45)[_0xcfcb('0x17')](function(){_0x37e23c(null);})['catch'](function(_0x1bbc7d){_0x37e23c(_0x1bbc7d);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x25')]=function(_0x89fef8,_0x1c5189){this[_0xcfcb('0xf')]['getIntervalById'](_0x89fef8)['then'](function(_0x4aaf84){if(_0x4aaf84){if(_0x4aaf84[_0xcfcb('0x26')]){_0x1c5189(null,[_0x4aaf84['interval']]);}else{_0x1c5189(null,_[_0xcfcb('0x27')](_0x4aaf84[_0xcfcb('0x28')],_0xcfcb('0x29')));}}else{_0x1c5189(null,![]);}})[_0xcfcb('0x15')](function(_0xa69965){_0x1c5189(_0xa69965);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x21')]=function(_0x2d64f5){return util[_0xcfcb('0x2a')](_0xcfcb('0x2b'),FILES_PATH,_0x2d64f5);};AGIVertices[_0xcfcb('0x11')]['getQueryOdbc']=function(_0x889d78,_0x18f2f1,_0x52e9ea){odbc['open'](_0x889d78,function(_0x593634){if(_0x593634){logger[_0xcfcb('0x2c')](_0xcfcb('0x2d'),_0x593634);_0x52e9ea(_0x593634);}else{logger['info'](_0xcfcb('0x2e'));odbc[_0xcfcb('0x2f')](_0x18f2f1,function(_0x10a25,_0x3add68){if(_0x10a25){logger[_0xcfcb('0x30')](_0xcfcb('0x31'),_0x18f2f1);_0x52e9ea(_0x10a25);}else{logger[_0xcfcb('0x30')](_0xcfcb('0x32'),_0x18f2f1);odbc[_0xcfcb('0x33')](function(_0x151f90){if(_0x151f90){logger[_0xcfcb('0x2c')](_0xcfcb('0x34'),_0x151f90);}_0x52e9ea(null,_0x3add68);});}});}});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x35')]=function(_0x449675,_0x3a3a69){this[_0xcfcb('0xf')][_0xcfcb('0x36')](_0x449675)[_0xcfcb('0x17')](function(_0x3cbce0){_0x3a3a69(null,_0x3cbce0?_0x3cbce0:![]);})[_0xcfcb('0x15')](function(_0x16b83c){_0x3a3a69(_0x16b83c);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x37')]=function(_0x50d8f2,_0x72c362){this[_0xcfcb('0xf')][_0xcfcb('0x37')](_0x50d8f2)['then'](function(_0x5e1495){_0x72c362(null,_0x5e1495);})[_0xcfcb('0x15')](function(_0x3f3788){_0x72c362(_0x3f3788);});};AGIVertices[_0xcfcb('0x11')]['createSquareDetailsReport']=function(_0xd5d22,_0x40e6d8,_0x22d021){this[_0xcfcb('0xf')][_0xcfcb('0x38')]({'uniqueid':this[_0xcfcb('0xe')][_0xcfcb('0x39')],'node':_0xd5d22[_0xcfcb('0x3a')],'application':_0xd5d22[_0xcfcb('0x3b')],'data':_0x40e6d8||null,'project_name':this[_0xcfcb('0xe')][_0xcfcb('0x3c')],'callerid':this[_0xcfcb('0xe')]['callerid']})[_0xcfcb('0x17')](function(_0x33af17){if(_0x22d021){_0x22d021(null,_0x33af17);}})[_0xcfcb('0x15')](function(_0x2217aa){if(_0x22d021){_0x22d021(_0x2217aa);}});};AGIVertices['prototype'][_0xcfcb('0x3d')]=function(_0x50e969,_0x41b125,_0x1bd9f5,_0x3ed979){this['rpc']['createSquareRecording']({'uniqueid':this[_0xcfcb('0xe')]['uniqueid'],'callerid':this[_0xcfcb('0xe')][_0xcfcb('0x3e')],'calleridname':this[_0xcfcb('0xe')][_0xcfcb('0x3f')],'context':this[_0xcfcb('0xe')]['context'],'extension':this[_0xcfcb('0xe')][_0xcfcb('0x40')],'priority':this[_0xcfcb('0xe')]['priority'],'accountcode':this[_0xcfcb('0xe')][_0xcfcb('0x41')],'dnid':this[_0xcfcb('0xe')]['dnid'],'projectName':this[_0xcfcb('0xe')]['arg_1'],'saveName':_0x41b125,'filename':_0x50e969[_0xcfcb('0x42')]||_0x41b125,'savePath':_0x1bd9f5})[_0xcfcb('0x17')](function(_0x1c25af){_0x3ed979(null,_0x1c25af);})[_0xcfcb('0x15')](function(_0x54fa2c){_0x3ed979(_0x54fa2c);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x43')]=function(_0x5dce75,_0x5c9f39,_0x4b2a21){this[_0xcfcb('0xf')][_0xcfcb('0x43')]({'uniqueid':this[_0xcfcb('0xe')][_0xcfcb('0x39')],'body':_0x5dce75,'direction':_0x5c9f39})[_0xcfcb('0x17')](function(_0x41c2a6){if(_0x4b2a21){_0x4b2a21(null,_0x41c2a6);}})[_0xcfcb('0x15')](function(_0x123310){if(_0x4b2a21){_0x4b2a21(_0x123310);}});};AGIVertices['prototype'][_0xcfcb('0x44')]=function(_0x31b38f,_0x1c191b){console[_0xcfcb('0x45')]('in\x20createcmcontact',_0x31b38f);console[_0xcfcb('0x45')](_0xcfcb('0x46'),_0x1c191b);this[_0xcfcb('0xf')][_0xcfcb('0x44')]({'firstName':_[_0xcfcb('0x47')](_0x31b38f[_0xcfcb('0x14')])||_[_0xcfcb('0x48')](_0x31b38f[_0xcfcb('0x14')])?'callback_'+Math['random']():_0x31b38f[_0xcfcb('0x14')],'lastName':_[_0xcfcb('0x47')](_0x31b38f[_0xcfcb('0x49')])||_[_0xcfcb('0x48')](_0x31b38f['lastName'])?null:_0x31b38f[_0xcfcb('0x49')],'phone':_0x31b38f[_0xcfcb('0x4a')],'ListId':_0x31b38f[_0xcfcb('0x4b')],'scheduledat':_0x31b38f[_0xcfcb('0x4c')],'callbackUniqueid':this[_0xcfcb('0xe')][_0xcfcb('0x39')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x31b38f['scheduledAt']['toString'](),'priority':_0x31b38f[_0xcfcb('0x4d')]})[_0xcfcb('0x17')](function(_0x49f162){_0x1c191b(null,_0x49f162);})[_0xcfcb('0x15')](function(_0x1c07f7){_0x1c191b(_0x1c07f7);});};AGIVertices[_0xcfcb('0x11')]['getPause']=function(_0x525cff,_0x41589c){this[_0xcfcb('0xf')]['getPauseById'](_0x525cff)[_0xcfcb('0x17')](function(_0x3975ac){_0x41589c(null,_0x3975ac?_0x3975ac[_0xcfcb('0x14')]:![]);})['catch'](function(_0x175348){_0x41589c(_0x175348);});};AGIVertices[_0xcfcb('0x11')]['agentPause']=function(_0x5886a2,_0x2a9e38,_0x5156c1){var _0x352ef4={'role':_0xcfcb('0x4e')};_0x352ef4[_0x5886a2]=this['channel'][_0xcfcb('0x3e')];this['rpc'][_0xcfcb('0x4f')](_0x352ef4,_0x2a9e38,this[_0xcfcb('0xe')][_0xcfcb('0x39')])[_0xcfcb('0x17')](function(_0x5330c2){_0x5156c1(null,_[_0xcfcb('0x48')](_0x5330c2)?![]:!![]);})['catch'](function(_0x564185){logger['error'](_0x564185);_0x5156c1(null,![]);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x50')]=function(_0x5bd312,_0x4899c3){var _0x514a79={'role':'agent'};_0x514a79[_0x5bd312]=this[_0xcfcb('0xe')]['callerid'];this['rpc'][_0xcfcb('0x50')](_0x514a79)['then'](function(_0x166d6b){_0x4899c3(null,_[_0xcfcb('0x48')](_0x166d6b)?![]:!![]);})[_0xcfcb('0x15')](function(_0x476651){logger[_0xcfcb('0x2c')](_0x476651);_0x4899c3(null,![]);});};AGIVertices[_0xcfcb('0x11')]['agentLogout']=function(_0x44948b,_0x5791ff){var _0x36c79a={'role':'agent'};_0x36c79a[_0x44948b]=this[_0xcfcb('0xe')]['callerid'];this[_0xcfcb('0xf')][_0xcfcb('0x51')](_0x36c79a)['then'](function(_0x46c356){_0x5791ff(null,_[_0xcfcb('0x48')](_0x46c356)?![]:!![]);})[_0xcfcb('0x15')](function(_0x5226e9){logger[_0xcfcb('0x2c')](_0x5226e9);_0x5791ff(null,![]);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x52')]=function(_0x5b3fd9,_0x14a101){var _0x184bcc={'role':'agent'};_0x184bcc[_0x5b3fd9]=this[_0xcfcb('0xe')][_0xcfcb('0x3e')];var _0x175eb4=_0x5b3fd9!=_0xcfcb('0x53')?util[_0xcfcb('0x2a')](_0xcfcb('0x54'),_0xcfcb('0x55'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')]):undefined;this[_0xcfcb('0xf')]['agentLogin'](_0x184bcc,_0x175eb4)['then'](function(_0x3c96db){_0x14a101(null,_[_0xcfcb('0x48')](_0x3c96db)?![]:!![]);})[_0xcfcb('0x15')](function(_0x16fd6d){logger[_0xcfcb('0x2c')](_0x16fd6d);_0x14a101(null,![]);});};AGIVertices['prototype'][_0xcfcb('0x56')]=function(_0x41ae8e,_0x573459){sh[_0xcfcb('0x57')](_[_0xcfcb('0x58')](_0x41ae8e),function(_0x1d51a3,_0x5cce9f){var _0x3ef619=_0x5cce9f[_0xcfcb('0x59')](/(\r\n|\n|\r)/gm,'');_0x573459(null,_0x3ef619);});};AGIVertices[_0xcfcb('0x11')]['googleCloudTTS']=function(_0x2f30f8,_0x5202f2){scripts[_0xcfcb('0x5a')](_0x2f30f8['apiKey'],_0x2f30f8[_0xcfcb('0x5b')]||_0xcfcb('0x5c'),_0x2f30f8['text'],_0x2f30f8[_0xcfcb('0x5d')]||_0xcfcb('0x5e'),_0x2f30f8[_0xcfcb('0x5f')]||_0xcfcb('0x60'),_0x2f30f8[_0xcfcb('0x61')]||_0xcfcb('0x62'))[_0xcfcb('0x17')](function(_0x5359de){_0x5202f2(null,_0x5359de);})['catch'](function(_0x175a20){_0x5202f2(_0x175a20);});};AGIVertices['prototype'][_0xcfcb('0x63')]=function(_0x2e09a5,_0xe874c2){scripts['googleTTS'](_0x2e09a5[_0xcfcb('0x5c')],_0x2e09a5[_0xcfcb('0x64')]||'en',0x1)[_0xcfcb('0x17')](function(_0x18bf49){_0xe874c2(null,_0x18bf49);})['catch'](function(_0x5f49a8){_0xe874c2(_0x5f49a8);});};AGIVertices[_0xcfcb('0x11')]['restAPI']=function(_0x320f8f,_0x5de336){var _0x597121={'uri':_0x320f8f[_0xcfcb('0x65')],'method':_0x320f8f[_0xcfcb('0x66')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x320f8f['timeout'])===_0xcfcb('0x67')&&parseInt(_0x320f8f[_0xcfcb('0x68')])>=0x1?parseInt(_0x320f8f[_0xcfcb('0x68')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xcfcb('0x69'),'PUT'],_0x597121[_0xcfcb('0x66')][_0xcfcb('0x6a')]())){try{_0x597121['body']=_0x320f8f[_0xcfcb('0xb')]?JSON['parse'](_0x320f8f[_0xcfcb('0xb')]):{};}catch(_0x19db1e){logger[_0xcfcb('0x2c')](_0xcfcb('0x6b'),_0x19db1e);}}try{_0x597121[_0xcfcb('0x6c')]=_0x320f8f[_0xcfcb('0xa')]?JSON[_0xcfcb('0x6d')](_0x320f8f[_0xcfcb('0xa')]):{};}catch(_0x3342c5){logger['error'](_0xcfcb('0x6e'),_0x3342c5);}if(_0x320f8f[_0xcfcb('0x6f')]){try{var _0x1c7df1=require(_0x320f8f[_0xcfcb('0x6f')])['sync'](this,_0x597121);_0x597121['uri']=Mustache[_0xcfcb('0x70')](_0x320f8f[_0xcfcb('0x65')],_0x1c7df1,{},['$$','$$']);if(_0x597121['headers']){_0x597121['headers']=JSON[_0xcfcb('0x6d')](Mustache[_0xcfcb('0x70')](JSON['stringify'](_0x597121[_0xcfcb('0x6c')]),_0x1c7df1,{},['$$','$$']));}if(_0x597121[_0xcfcb('0x71')]){_0x597121['body']=JSON[_0xcfcb('0x6d')](Mustache[_0xcfcb('0x70')](JSON[_0xcfcb('0x72')](_0x597121[_0xcfcb('0x71')]),_0x1c7df1,{},['$$','$$']));}}catch(_0x791775){logger[_0xcfcb('0x2c')](_0xcfcb('0x73'),_0x791775);}}rp(_0x597121)['then'](function(_0x2a1f3b){var _0x260438={'statusCode':_0x2a1f3b['statusCode']||0xc8,'statusMessage':_0x2a1f3b['statusMessage']||'OK','headers':_0x2a1f3b['headers']||{},'body':_0x2a1f3b['body']||{}};_0x5de336(null,_0x260438);})['catch'](function(_0x2593a1){var _0x3d8d48={'statusCode':_0x2593a1['statusCode']||0x1f4,'statusMessage':_0x2593a1['message']||_0xcfcb('0x74'),'headers':_0x2593a1[_0xcfcb('0x75')][_0xcfcb('0x6c')]||{},'body':_0x2593a1[_0xcfcb('0x75')]['body']||{}};_0x5de336(null,_0x3d8d48);});};AGIVertices[_0xcfcb('0x11')]['googleDialogflow']=function(_0x24d20a,_0x19cc84){scripts[_0xcfcb('0x76')](this[_0xcfcb('0xe')][_0xcfcb('0x39')],_0x24d20a[_0xcfcb('0x77')],_0x24d20a['text'],_0x24d20a[_0xcfcb('0x78')]||'en')['then'](function(_0x19fb8f){_0x19cc84(null,_0x19fb8f);})['catch'](function(_0xa62a59){_0x19cc84(_0xa62a59);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x79')]=function(_0x29d6c6,_0xe72a28){scripts[_0xcfcb('0x79')](this[_0xcfcb('0xe')],_0x29d6c6)[_0xcfcb('0x17')](function(_0x53edbb){_0xe72a28(null,_0x53edbb);})[_0xcfcb('0x15')](function(_0x105bd0){_0xe72a28(_0x105bd0);});};AGIVertices['prototype'][_0xcfcb('0x7a')]=function(_0x124850,_0x55b010){scripts[_0xcfcb('0x7a')](_0x124850[_0xcfcb('0x77')],_0x124850[_0xcfcb('0x5c')],_0x124850[_0xcfcb('0x7b')]||_0xcfcb('0x5e'),_0x124850['speed'])[_0xcfcb('0x17')](function(_0x3cb36e){_0x55b010(null,_0x3cb36e);})['catch'](function(_0xc78c4a){_0x55b010(_0xc78c4a);});};AGIVertices['prototype'][_0xcfcb('0x7c')]=function(_0x58ec12,_0x878a21,_0x3a1d70){scripts[_0xcfcb('0x7c')](_0x878a21,_0x58ec12['key'],_0x58ec12[_0xcfcb('0x7d')]||'en-US',this[_0xcfcb('0x7e')](_0x58ec12[_0xcfcb('0x7f')])?_0x58ec12[_0xcfcb('0x7f')]:undefined)['then'](function(_0x1e7e31){_0x3a1d70(null,_0x1e7e31);})['catch'](function(_0x48c43b){_0x3a1d70(_0x48c43b);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x80')]=function(_0x4e20f0,_0xe86c52){scripts[_0xcfcb('0x80')](_0x4e20f0[_0xcfcb('0x81')],_0x4e20f0[_0xcfcb('0x82')],_0x4e20f0['aws_polly_region'],_0x4e20f0[_0xcfcb('0x83')]||_0xcfcb('0x84'),_0x4e20f0['text'],_0x4e20f0['aws_text_type']||_0xcfcb('0x5c'))[_0xcfcb('0x17')](function(_0x4453f6){_0xe86c52(null,_0x4453f6);})[_0xcfcb('0x15')](function(_0x477b21){_0xe86c52(_0x477b21);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x85')]=function(_0x352e89,_0x55755d){scripts['awsLex'](this[_0xcfcb('0xe')][_0xcfcb('0x39')],_0x352e89['aws_access_key_id'],_0x352e89[_0xcfcb('0x82')],_0x352e89[_0xcfcb('0x86')],_0x352e89[_0xcfcb('0x5c')],_0x352e89[_0xcfcb('0x87')])[_0xcfcb('0x17')](function(_0x264ab9){_0x55755d(null,_0x264ab9);})[_0xcfcb('0x15')](function(_0xf4636b){_0x55755d(_0xf4636b);});};AGIVertices['prototype'][_0xcfcb('0x88')]=function(_0x27530d,_0x19554f,_0x15aed3){scripts[_0xcfcb('0x88')](_0x19554f,_0x27530d[_0xcfcb('0x77')],_0x27530d['google_asr_language']||_0xcfcb('0x5e'))[_0xcfcb('0x17')](function(_0x1ad41c){_0x15aed3(null,_0x1ad41c);})['catch'](function(_0x17743c){_0x15aed3(_0x17743c);});};AGIVertices['prototype']['tildeASR']=function(_0x1b72ad,_0x561810,_0x1381c1){scripts['tildeASR'](_0x561810,_0x1b72ad[_0xcfcb('0x89')],_0x1b72ad[_0xcfcb('0x8a')],_0x1b72ad[_0xcfcb('0x8b')])[_0xcfcb('0x17')](function(_0x104125){_0x1381c1(null,_0x104125);})['catch'](function(_0x5f205e){_0x1381c1(_0x5f205e);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x8c')]=function(_0x40672b){var _0x4aa019=_[_0xcfcb('0x8d')](verticesWithRetry,_0x40672b['agicommand'])?_0x40672b:_[_0xcfcb('0x8e')](_0x40672b);for(var _0x13ebd3 in _0x4aa019){if(_0x4aa019[_0xcfcb('0x8f')](_0x13ebd3)){if(_0x4aa019[_0x13ebd3]&&_[_0xcfcb('0x90')](_0x4aa019[_0x13ebd3])){if(_[_0xcfcb('0x8d')](recursiveMapAttributes,_0x13ebd3)){_0x4aa019[_0x13ebd3]=this[_0xcfcb('0x91')](_0x4aa019[_0x13ebd3]);}else{_0x4aa019[_0x13ebd3]=this[_0xcfcb('0x92')](_0x4aa019[_0x13ebd3]);}}}}return _0x4aa019;};AGIVertices['prototype'][_0xcfcb('0x93')]=function(_0x569efc){for(var _0x1e1167 in _0x569efc){if(_0x569efc[_0xcfcb('0x8f')](_0x1e1167)){if(_[_0xcfcb('0x94')](_0x569efc[_0x1e1167])){this[_0xcfcb('0x93')](_0x569efc[_0x1e1167]);}else if(_[_0xcfcb('0x95')](_0x569efc[_0x1e1167])){for(var _0x1597ea=0x0;_0x1597ea<_0x569efc[_0x1e1167]['length'];_0x1597ea++){this['recursiveNodeIndex'](_0x569efc[_0x1e1167][_0x1597ea]);}}else if(_['isString'](_0x569efc[_0x1e1167])){_0x569efc[_0x1e1167]=this[_0xcfcb('0x92')](_0x569efc[_0x1e1167]);}}}};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x96')]=function(_0x37181b,_0x85c457){for(var _0x1a7299 in _0x37181b){if(_0x37181b[_0xcfcb('0x8f')](_0x1a7299)){if(_['isPlainObject'](_0x37181b[_0x1a7299])){if(!_[_0xcfcb('0x47')](_0x37181b[_0x1a7299])){this[_0xcfcb('0x96')](_0x37181b[_0x1a7299],util[_0xcfcb('0x2a')](_0xcfcb('0x97'),_0x85c457,_0x1a7299));}}else if(_[_0xcfcb('0x95')](_0x37181b[_0x1a7299])){for(var _0x194541=0x0;_0x194541<_0x37181b[_0x1a7299][_0xcfcb('0x98')];_0x194541++){this[_0xcfcb('0x96')](_0x37181b[_0x1a7299][_0x194541],util[_0xcfcb('0x2a')](_0xcfcb('0x97'),_0x85c457,_0x1a7299+'['+_0x194541+']'));}}else{if(!_[_0xcfcb('0x48')](_0x37181b[_0x1a7299])){this[_0xcfcb('0xe')]['setVariable'](util['format'](_0xcfcb('0x97'),_0x85c457,_0x1a7299),_0x37181b[_0x1a7299]);}}}}};AGIVertices['prototype'][_0xcfcb('0x91')]=function(_0x4cfe44){try{var _0x29c029=JSON[_0xcfcb('0x6d')](_0x4cfe44);this[_0xcfcb('0x93')](_0x29c029);return JSON[_0xcfcb('0x72')](_0x29c029);}catch(_0x3289ec){return this[_0xcfcb('0x92')](_0x4cfe44);}};AGIVertices['prototype'][_0xcfcb('0x92')]=function(_0x96cd){console[_0xcfcb('0x45')](_0xcfcb('0x99'),_0x96cd);var _0x148fe2=_0x96cd[_0xcfcb('0x9a')]('{');for(var _0x3d53e7=0x1;_0x3d53e7<_0x148fe2['length'];_0x3d53e7+=0x1){var _0x3507bf=_0x148fe2[_0x3d53e7][_0xcfcb('0x9a')]('}');console[_0xcfcb('0x45')](_0xcfcb('0x9b'),_0x3507bf);if(_0x3507bf['length']>0x1){_0x96cd=_0x96cd[_0xcfcb('0x9c')]('{'+_0x3507bf[0x0]+'}',this[_0xcfcb('0xe')][_0xcfcb('0x12')](_0x3507bf[0x0])[_0xcfcb('0x9d')]||_0x3507bf[0x0]);}}if(_0x148fe2[_0xcfcb('0x98')]===0x1){return _0x96cd[_0xcfcb('0x9e')]();}console['log'](_0xcfcb('0x9f'),_0x96cd);return this['replaceAllVariables'](_0x96cd);};AGIVertices['prototype'][_0xcfcb('0xa0')]=function(_0x5eff57,_0x51ad45){var _0x20851e=this[_0xcfcb('0xe')][_0xcfcb('0x12')](_0x5eff57);if(_0x20851e['result']===-0x1){return _0x20851e;}logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0xa1'),_0x51ad45,_0x20851e['extra']));return this[_0xcfcb('0xe')]['setVariable'](_0x51ad45,_0x20851e[_0xcfcb('0x9d')]);};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x7e')]=function(_0x31ff0a){return _0x31ff0a&&_0x31ff0a!=='0'&&_0x31ff0a!=='-1'&&_0x31ff0a!=='';};AGIVertices[_0xcfcb('0x11')]['maxRetry']=function(_0x19fc9a){this['createSquareDetailsReport'][_0xcfcb('0xa2')](this,_0x19fc9a,'-');_0x19fc9a['retry']=_0x19fc9a['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xcfcb('0x11')]['mrcpsynth']=function(_0x42d1e4){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x42d1e4[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x42d1e4[_0xcfcb('0x5c')])){return this['channel'][_0xcfcb('0xa3')](_0xcfcb('0xa4'));}var _0x3cb506='\x22'+_0x42d1e4[_0xcfcb('0x5c')]+'\x22';if(this['isConfigured'](_0x42d1e4[_0xcfcb('0x75')])){_0x3cb506+=','+_0x42d1e4[_0xcfcb('0x75')];}var _0x2da580=this[_0xcfcb('0xe')][_0xcfcb('0x57')](_0xcfcb('0xa5'),_0x3cb506);if(_0x2da580['result']===-0x1){return _0x2da580;}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format'](_0xcfcb('0xa6'),_0x3cb506));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xa7')]=function(_0x5e2626){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0xa8'),_0x5e2626['label']));if(!this['isConfigured'](_0x5e2626['grammar'])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xa9'));}var _0x215fbb=_0x5e2626[_0xcfcb('0xaa')];if(this[_0xcfcb('0x7e')](_0x5e2626[_0xcfcb('0x75')])){_0x215fbb+=','+_0x5e2626[_0xcfcb('0x75')];}var _0x25fda4=this[_0xcfcb('0xe')][_0xcfcb('0x57')]('MRCPRecog',_0x215fbb);if(_0x25fda4[_0xcfcb('0xab')]===-0x1){return _0x25fda4;}var _0xcaa542=this[_0xcfcb('0xa0')](_0xcfcb('0xac'),'MRCP_RECOG_CONFIDENCE');if(_0xcaa542[_0xcfcb('0xab')]===-0x1){return _0xcaa542;}var _0x25eadd=this['getAndSetVariable']('RECOG_INPUT()',_0xcfcb('0xad'));if(_0x25eadd[_0xcfcb('0xab')]===-0x1){return _0x25eadd;}var _0x1e9aad=this['getAndSetVariable'](_0xcfcb('0xae'),_0xcfcb('0xaf'));if(_0x1e9aad[_0xcfcb('0xab')]===-0x1){return _0x1e9aad;}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format'](_0xcfcb('0xb0'),_0x215fbb));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xb1')]=function(_0x347f35){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0xb2'),_0x347f35['label']));return this[_0xcfcb('0xe')][_0xcfcb('0xb1')]([_0x347f35[_0xcfcb('0xb3')],_0x347f35[_0xcfcb('0xb4')]]);};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xb5')]=function(_0x15302a){logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0xb6'),_0x15302a[_0xcfcb('0x3a')]));if(this['isConfigured'](_0x15302a[_0xcfcb('0x68')])){logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0xb7'),_0x15302a[_0xcfcb('0x68')]));var _0xa2a60a=this[_0xcfcb('0xe')]['wait'](_0x15302a[_0xcfcb('0x68')]);if(_0xa2a60a[_0xcfcb('0xab')]===-0x1){return _0xa2a60a;}}return this[_0xcfcb('0xe')]['answer']();};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xb8')]=function(_0x16d6f0){console['logh'](_0xcfcb('0xb9'),_0x16d6f0);logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x16d6f0[_0xcfcb('0x3a')]));if(!this['isConfigured'](_0x16d6f0[_0xcfcb('0x4b')])){return this['channel']['error'](_0x16d6f0,_0xcfcb('0xba'));}_0x16d6f0[_0xcfcb('0x4c')]=moment();if(this[_0xcfcb('0x7e')](_0x16d6f0[_0xcfcb('0xbb')])){_0x16d6f0[_0xcfcb('0x4c')]=moment()[_0xcfcb('0xbc')](_0x16d6f0['delay'],_0xcfcb('0xbd'));}if(!this[_0xcfcb('0x7e')](_0x16d6f0['callback_priority'])){_0x16d6f0[_0xcfcb('0x4d')]=0x2;}console[_0xcfcb('0x45')](_0xcfcb('0xbe'),_0x16d6f0);this[_0xcfcb('0x44')][_0xcfcb('0xa2')](this,_0x16d6f0);return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xbf'),_0x16d6f0[_0xcfcb('0x4a')],_0x16d6f0[_0xcfcb('0x4b')],_0x16d6f0[_0xcfcb('0x4c')]));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xc0')]=function(_0x48f8b7){logger['info'](util[_0xcfcb('0x2a')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x48f8b7['label']));var _0x666194=this[_0xcfcb('0xe')][_0xcfcb('0x57')](_0x48f8b7[_0xcfcb('0xc1')],_0x48f8b7['options']);if(_0x666194['result']===-0x1){return _0x666194;}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xc2'),_0x48f8b7[_0xcfcb('0xc1')],_0x48f8b7[_0xcfcb('0x75')]));};AGIVertices[_0xcfcb('0x11')]['lumenvoxtts']=function(_0x32944b){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0xc3'),_0x32944b['label']));if(!this[_0xcfcb('0x7e')](_0x32944b[_0xcfcb('0x5c')])){return this['channel']['noop'](_0xcfcb('0xa4'));}var _0x88a271='\x22'+_0x32944b[_0xcfcb('0x5c')]+'\x22';if(this[_0xcfcb('0x7e')](_0x32944b[_0xcfcb('0x75')])){_0x88a271+=','+_0x32944b['options'];}var _0x5166c5=this[_0xcfcb('0xe')]['exec'](_0xcfcb('0xa5'),_0x88a271);if(_0x5166c5['result']===-0x1){return _0x5166c5;}return this['channel']['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0xa6'),_0x88a271));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xc4')]=function(_0x1b3854){logger['info'](util[_0xcfcb('0x2a')](_0xcfcb('0xc5'),_0x1b3854[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x1b3854[_0xcfcb('0x5c')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xa4'));}var _0x10ccd8='\x22'+_0x1b3854[_0xcfcb('0x5c')]+'\x22';if(this[_0xcfcb('0x7e')](_0x1b3854[_0xcfcb('0x75')])){_0x10ccd8+=','+_0x1b3854[_0xcfcb('0x75')];}var _0x2fd5ea=this[_0xcfcb('0xe')][_0xcfcb('0x57')](_0xcfcb('0xa5'),_0x10ccd8);if(_0x2fd5ea[_0xcfcb('0xab')]===-0x1){return _0x2fd5ea;}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xa6'),_0x10ccd8));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xc6')]=function(_0x13ee0b){logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0xc7'),_0x13ee0b[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x13ee0b['grammar'])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xa9'));}var _0x21de29=_0x13ee0b[_0xcfcb('0xaa')];if(this[_0xcfcb('0x7e')](_0x13ee0b[_0xcfcb('0x75')])){_0x21de29+=','+_0x13ee0b[_0xcfcb('0x75')];}var _0x56d102=this[_0xcfcb('0xe')][_0xcfcb('0x57')]('MRCPRecog',_0x21de29);if(_0x56d102[_0xcfcb('0xab')]===-0x1){return _0x56d102;}var _0x12379c=this[_0xcfcb('0xa0')](_0xcfcb('0xac'),_0xcfcb('0xc8'));if(_0x12379c[_0xcfcb('0xab')]===-0x1){return _0x12379c;}var _0x12449d=this[_0xcfcb('0xa0')]('RECOG_INPUT()',_0xcfcb('0xc9'));if(_0x12449d[_0xcfcb('0xab')]===-0x1){return _0x12449d;}var _0x421051=this[_0xcfcb('0xa0')](_0xcfcb('0xae'),_0xcfcb('0xca'));if(_0x421051[_0xcfcb('0xab')]===-0x1){return _0x421051;}return this['channel'][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x21de29));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xcb')]=function(_0x5635a1){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0xcc'),_0x5635a1['label']));if(!this[_0xcfcb('0x7e')](_0x5635a1[_0xcfcb('0xaa')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xa9'));}var _0x36cd0a=_0x5635a1[_0xcfcb('0xaa')];if(this['isConfigured'](_0x5635a1['options'])){_0x36cd0a+=','+_0x5635a1['options'];}var _0x2d2259=this['channel']['exec'](_0xcfcb('0xcd'),_0x36cd0a);if(_0x2d2259[_0xcfcb('0xab')]===-0x1){return _0x2d2259;}var _0x1d16c6=this[_0xcfcb('0xa0')](_0xcfcb('0xac'),_0xcfcb('0xce'));if(_0x1d16c6['result']===-0x1){return _0x1d16c6;}var _0x33b1f5=this['getAndSetVariable']('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x33b1f5['result']===-0x1){return _0x33b1f5;}var _0x51d3a2=this[_0xcfcb('0xa0')](_0xcfcb('0xae'),'SESTEK_ASR_INSTANCE');if(_0x51d3a2[_0xcfcb('0xab')]===-0x1){return _0x51d3a2;}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xb0'),_0x36cd0a));};AGIVertices[_0xcfcb('0x11')]['database']=function(_0x569662){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0xcf'),_0x569662['label']));if(!this[_0xcfcb('0x7e')](_0x569662['odbc_id'])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x569662,_0xcfcb('0xd0'));}var _0x101010=this['getSquareOdbc'][_0xcfcb('0xa2')](this,_0x569662['odbc_id']);if(!_0x101010){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x569662,_0xcfcb('0xd1'));}if(!this[_0xcfcb('0x7e')](_0x569662[_0xcfcb('0x2f')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x569662,_0xcfcb('0xd2'));}var _0x5fa896=_0x569662[_0xcfcb('0x2f')][_0xcfcb('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xd3'),_0x5fa896));var _0x100873=this[_0xcfcb('0xd4')]['sync'](this,_0x101010,_0x5fa896);this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x569662,_0x5fa896);if(!this[_0xcfcb('0x7e')](_0x569662['variable_id'])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xd5'));}var _0x4c1b21=this[_0xcfcb('0x12')][_0xcfcb('0xa2')](this,_0x569662['variable_id']);if(!_0x4c1b21){return this['channel'][_0xcfcb('0x2c')](_0x569662,_0xcfcb('0xd6'));}var _0x2bca87=this;_0x100873[_0xcfcb('0xd7')](function(_0x3ac8a2,_0x367e80){Object['keys'](_0x3ac8a2)[_0xcfcb('0xd7')](function(_0x4794eb){_0x2bca87[_0xcfcb('0xe')][_0xcfcb('0xd8')](util['format'](_0xcfcb('0xd9'),_0x4c1b21,_0x367e80,_0x4794eb),_0x3ac8a2[_0x4794eb]);});});this[_0xcfcb('0xe')][_0xcfcb('0xd8')](util[_0xcfcb('0x2a')]('%s_ROWS_COUNT',_0x4c1b21),_0x100873[_0xcfcb('0x98')]);return this['channel'][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xda'),_0x4c1b21));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xdb')]=function(_0x23f798){logger['debug'](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x23f798[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x23f798[_0xcfcb('0xdc')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x23f798,'no\x20user\x20selected');}var _0x1a73e3=this[_0xcfcb('0x1d')][_0xcfcb('0xa2')](this,_0x23f798[_0xcfcb('0xdc')]);if(!_0x1a73e3){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x23f798,'no\x20user\x20found');}var _0x461c75=this['channel']['exec'](_0xcfcb('0xdd'),[util[_0xcfcb('0x2a')]('SIP/%s',_0x1a73e3),_0x23f798['timeout'],_0x23f798[_0xcfcb('0xde')],_0x23f798['url']]);if(_0x461c75[_0xcfcb('0xab')]===-0x1){return _0x461c75;}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xdf'),_0xcfcb('0xdd')));};AGIVertices['prototype'][_0xcfcb('0xe0')]=function(_0x58cb60){logger['info'](util[_0xcfcb('0x2a')](_0xcfcb('0xe1'),_0x58cb60[_0xcfcb('0x3a')]));if(!this['isConfigured'](_0x58cb60['key'])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xe2'));}if(!this[_0xcfcb('0x7e')](_0x58cb60['text'])){return this[_0xcfcb('0xe')]['noop'](_0xcfcb('0xa4'));}this['channel'][_0xcfcb('0xe3')]=!![];this['createSquareDetailsReport'](_0x58cb60);this[_0xcfcb('0x43')](_0x58cb60[_0xcfcb('0x5c')],'in');this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')]('Trying\x20Dialogflow:\x20%s',_0x58cb60[_0xcfcb('0x5c')]));var _0x248e2e=this[_0xcfcb('0x76')][_0xcfcb('0xa2')](this,_0x58cb60);if(_0x248e2e){for(var _0x4f5a52 in _0x248e2e){if(_0x248e2e['hasOwnProperty'](_0x4f5a52)){this[_0xcfcb('0xe')]['setVariable'](util[_0xcfcb('0x2a')](_0xcfcb('0xe4'),_0x4f5a52[_0xcfcb('0x6a')]()),_0x248e2e[_0x4f5a52]);}}this[_0xcfcb('0x43')](_0x248e2e[_0xcfcb('0xe5')],'out');return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xe6'),_0x248e2e[_0xcfcb('0xe5')]));}return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x58cb60,_0xcfcb('0xe7'));};AGIVertices[_0xcfcb('0x11')]['sesteknda']=function(_0x3c7d11){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0xe8'),_0x3c7d11[_0xcfcb('0x3a')]));if(!this['isConfigured'](_0x3c7d11[_0xcfcb('0xe9')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xea'));}if(!this[_0xcfcb('0x7e')](_0x3c7d11[_0xcfcb('0xeb')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xec'));}if(!this[_0xcfcb('0x7e')](_0x3c7d11['password'])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xed'));}if(!this['isConfigured'](_0x3c7d11[_0xcfcb('0xee')])){return this[_0xcfcb('0xe')]['noop'](_0xcfcb('0xa4'));}this[_0xcfcb('0xe')][_0xcfcb('0xe3')]=!![];this['createSquareDetailsReport'](_0x3c7d11);this['createSquareMessage'](_0x3c7d11[_0xcfcb('0x5c')],'in');this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0xef'),_0x3c7d11[_0xcfcb('0x5c')]));var _0x5bfb75=this[_0xcfcb('0x79')][_0xcfcb('0xa2')](this,_0x3c7d11);if(_0x5bfb75){for(var _0x44d23e in _0x5bfb75){if(_0x5bfb75['hasOwnProperty'](_0x44d23e)){this[_0xcfcb('0xe')]['setVariable'](util[_0xcfcb('0x2a')](_0xcfcb('0xf0'),_0x44d23e[_0xcfcb('0x6a')]()),_0x5bfb75[_0x44d23e]);}}this[_0xcfcb('0x43')](_0x5bfb75[_0xcfcb('0xe5')],_0xcfcb('0xf1'));if(_0x5bfb75[_0xcfcb('0xf2')]){this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x5bfb75['audiofile']));var _0xd86893=this[_0xcfcb('0xe')][_0xcfcb('0xf3')](_0x5bfb75[_0xcfcb('0xf2')]);try{fs['unlink'](_0x5bfb75[_0xcfcb('0xf2')]+_0xcfcb('0xf4'));}catch(_0x51528d){logger[_0xcfcb('0x2c')](_0x51528d);}return _0xd86893;}else{return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xf5'),_0x5bfb75[_0xcfcb('0xe5')]));}}return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x3c7d11,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xf6')]=function(_0x466c07){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0xf7'),_0x466c07['label']));return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xf6'));};AGIVertices['prototype'][_0xcfcb('0xf8')]=function(_0xce80fc){logger['info'](util[_0xcfcb('0x2a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xce80fc['label']));var _0x5db055='';if(_0xce80fc[_0xcfcb('0xf9')]){if(!this[_0xcfcb('0x7e')](_0xce80fc[_0xcfcb('0xf9')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0xce80fc,_0xcfcb('0xfa'));}else{var _0x1cdd35=parseInt(_0xce80fc[_0xcfcb('0xf9')],0xa);if(isNaN(_0x1cdd35)){_0x5db055=_0xce80fc[_0xcfcb('0xf9')];}else{_0x5db055=this['getTrunk']['sync'](this,_0xce80fc['trunk_id']);if(!_0x5db055){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0xce80fc,_0xcfcb('0xfb'));}}}}else if(_0xce80fc['trunk_name']){_0x5db055=_0xce80fc[_0xcfcb('0xfc')];}else{return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0xce80fc,_0xcfcb('0xfa'));}var _0x40faaa=this[_0xcfcb('0xe')][_0xcfcb('0x57')](_0xcfcb('0xdd'),[util['format'](_0xcfcb('0xfd'),_0x5db055,_0xce80fc[_0xcfcb('0x4a')]),_0xce80fc['timeout'],_0xce80fc[_0xcfcb('0xde')],_0xce80fc[_0xcfcb('0x65')]]);if(_0x40faaa[_0xcfcb('0xab')]===-0x1){return _0x40faaa;}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')]('Executed\x20command\x20%s',_0xcfcb('0xdd')));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xfe')]=function(_0x2a4aae){logger['info'](util[_0xcfcb('0x2a')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x2a4aae[_0xcfcb('0x3a')]));return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xfe'));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xc')]=function(_0x692e3d){logger['info'](util[_0xcfcb('0x2a')](_0xcfcb('0xff'),_0x692e3d[_0xcfcb('0x3a')]));if(_0x692e3d['retry']===0x0){return this[_0xcfcb('0x100')](_0x692e3d);}_0x692e3d[_0xcfcb('0x101')]-=0x1;if(!this[_0xcfcb('0x7e')](_0x692e3d[_0xcfcb('0x102')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x692e3d,_0xcfcb('0x103'));}var _0x8b543c=this[_0xcfcb('0x104')][_0xcfcb('0xa2')](this,_0x692e3d[_0xcfcb('0x102')]);if(!_0x8b543c){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x692e3d,_0xcfcb('0x105'));}if(!this['isConfigured'](_0x692e3d[_0xcfcb('0x106')])){return this['channel'][_0xcfcb('0x2c')](_0xcfcb('0xd5'));}var _0x51b1c4=this[_0xcfcb('0xe')][_0xcfcb('0x107')](_0x8b543c,_0x692e3d[_0xcfcb('0x108')],_0x692e3d[_0xcfcb('0x109')]);var _0x34feb4=_0x51b1c4[_0xcfcb('0xab')]?_0x51b1c4[_0xcfcb('0xab')][_0xcfcb('0x9e')]():'';logger[_0xcfcb('0x30')](_0xcfcb('0x10a'),JSON['stringify'](_0x51b1c4));if(_0x51b1c4[_0xcfcb('0xab')]===-0x1){this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x692e3d,_0x34feb4);return _0x51b1c4;}else if(_0x51b1c4[_0xcfcb('0x9d')]===_0xcfcb('0x68')){_0x51b1c4[_0xcfcb('0xab')]=_0x34feb4['length']>=parseInt(_0x692e3d[_0xcfcb('0x10b')])?'x':'i';}else{_0x51b1c4[_0xcfcb('0xab')]=_0x34feb4[_0xcfcb('0x98')]>=parseInt(_0x692e3d['mindigit'])&&_0x34feb4[_0xcfcb('0x98')]<=parseInt(_0x692e3d[_0xcfcb('0x109')])?'x':'i';}var _0x113f5a=this['getVariable']['sync'](this,_0x692e3d[_0xcfcb('0x106')]);if(!_0x113f5a){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x692e3d,'no\x20variable\x20found');}this[_0xcfcb('0xe')][_0xcfcb('0xd8')](_0x113f5a,_0x34feb4);if(this[_0xcfcb('0x7e')](_0x692e3d[_0xcfcb('0x10c')])){var _0x3b1a4a=parseInt(_0x692e3d[_0xcfcb('0x10c')],0xa);var _0x32b54a=rs['generate']({'charset':'*','length':_0x3b1a4a});var _0x3d9869=_0x34feb4[_0xcfcb('0x98')];if(_0x3d9869>0x0){if(_0x3d9869>_0x3b1a4a){this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x692e3d,_0x692e3d[_0xcfcb('0x10d')]===_0xcfcb('0x10e')?_0x32b54a+_0x34feb4[_0xcfcb('0x10f')](_0x3b1a4a):_0x34feb4[_0xcfcb('0x10f')](0x0,_0x3d9869-_0x3b1a4a)+_0x32b54a);}else{this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x692e3d,rs[_0xcfcb('0x110')]({'charset':'*','length':_0x3d9869}));}}else{this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x692e3d,'');}}else{this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x692e3d,_0x34feb4);}return _0x51b1c4;};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xd')]=function(_0x35c2da){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x111'),_0x35c2da['label']));return this[_0xcfcb('0xc')](_0x35c2da);};AGIVertices[_0xcfcb('0x11')]['goal']=function(_0x1da03c){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x1da03c[_0xcfcb('0x3a')]));this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x1da03c,_0x1da03c[_0xcfcb('0x112')]);return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x113'),_0x1da03c['goalname']));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x114')]=function(_0x119a08){logger['info'](util['format'](_0xcfcb('0x115'),_0x119a08['label']));if(!this[_0xcfcb('0x7e')](_0x119a08['aws_access_key_id'])||!this[_0xcfcb('0x7e')](_0x119a08['aws_secret_access_key'])){return this[_0xcfcb('0xe')]['noop'](_0xcfcb('0x116'));}if(!this[_0xcfcb('0x7e')](_0x119a08[_0xcfcb('0x5c')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xa4'));}this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x117'),_0x119a08['text']));var _0x26664e=this[_0xcfcb('0x80')][_0xcfcb('0xa2')](this,_0x119a08);if(_0x26664e){this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x118'),_0x26664e));var _0x3c3ebb=this['channel']['streamFile'](_0x26664e);try{fs[_0xcfcb('0x119')](_0x26664e+_0xcfcb('0xf4'));}catch(_0x5956ea){logger[_0xcfcb('0x2c')](_0x5956ea);}return _0x3c3ebb;}return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x119a08,_0xcfcb('0x11a'));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x11b')]=function(_0x13056f){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x11c'),_0x13056f['label']));if(!this[_0xcfcb('0x7e')](_0x13056f[_0xcfcb('0x81')])||!this[_0xcfcb('0x7e')](_0x13056f[_0xcfcb('0x82')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0x116'));}if(!this[_0xcfcb('0x7e')](_0x13056f['aws_bot_name'])){return this['channel']['noop'](_0xcfcb('0x11d'));}if(!this[_0xcfcb('0x7e')](_0x13056f[_0xcfcb('0x5c')])){return this['channel'][_0xcfcb('0xa3')](_0xcfcb('0xa4'));}this[_0xcfcb('0xe')][_0xcfcb('0xe3')]=!![];this[_0xcfcb('0x38')](_0x13056f);this[_0xcfcb('0x43')](_0x13056f['text'],'in');this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format'](_0xcfcb('0x11e'),_0x13056f[_0xcfcb('0x5c')]));var _0x268b5b=this[_0xcfcb('0x85')][_0xcfcb('0xa2')](this,_0x13056f);if(_0x268b5b){for(var _0x54cbcf in _0x268b5b){if(_0x268b5b[_0xcfcb('0x8f')](_0x54cbcf)&&_[_0xcfcb('0x90')](_0x268b5b[_0x54cbcf])){this[_0xcfcb('0xe')]['setVariable'](util['format']('AWS_LEX_%s',_0x54cbcf[_0xcfcb('0x6a')]()),_0x268b5b[_0x54cbcf]);}}if(_[_0xcfcb('0x48')](_0x268b5b['message'])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0x11f'));}else{this['createSquareMessage'](_0x268b5b[_0xcfcb('0x120')],_0xcfcb('0xf1'));return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format'](_0xcfcb('0x121'),_0x268b5b[_0xcfcb('0x120')]));}}return this[_0xcfcb('0xe')]['error'](_0x13056f,_0xcfcb('0x122'));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x123')]=function(_0x5c269f){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x124'),_0x5c269f[_0xcfcb('0x3a')],_0x5c269f['timeout']));if(!this['isConfigured'](_0x5c269f['key'])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')]('no\x20key\x20configured');}var _0x2bcd5c=_0xcfcb('0x125');var _0x20d8ef=util['format'](_0xcfcb('0x126'),FILES_PATH,rs[_0xcfcb('0x110')](0x4));var _0x29339e=util[_0xcfcb('0x2a')]('%s.%s',_0x20d8ef,_0x2bcd5c);var _0x1ef2da=!![];if(_0x5c269f[_0xcfcb('0x127')]==='NOBEEP'){_0x1ef2da=![];}var _0x44a54e=this[_0xcfcb('0xe')][_0xcfcb('0x128')](_0x20d8ef,_0x2bcd5c,_0x5c269f[_0xcfcb('0x129')],_0x5c269f['timeout'],undefined,_0x1ef2da);if(_0x44a54e[_0xcfcb('0xab')]!==-0x1){this['channel'][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')]('google\x20%s\x20file\x20created',_0x29339e));var _0x5199b6=this[_0xcfcb('0x88')]['sync'](this,_0x5c269f,_0x29339e);if(_0x5199b6){for(var _0x3efc44 in _0x5199b6){if(_0x5199b6['hasOwnProperty'](_0x3efc44)){this[_0xcfcb('0xe')][_0xcfcb('0xd8')](util[_0xcfcb('0x2a')](_0xcfcb('0x12a'),_0x3efc44[_0xcfcb('0x6a')]()),_0x5199b6[_0x3efc44]);}}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')]('GoogleASR\x20Result\x20%s',JSON[_0xcfcb('0x72')](_0x5199b6)));}}return _0x44a54e;};AGIVertices['prototype'][_0xcfcb('0x12b')]=function(_0x795cb2){logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0x12c'),_0x795cb2['label']));if(!this['isConfigured'](_0x795cb2[_0xcfcb('0x89')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0x12d'));}if(!this[_0xcfcb('0x7e')](_0x795cb2[_0xcfcb('0x8a')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0x12e'));}var _0x2d26f7=_0xcfcb('0x125');var _0x522dca=util[_0xcfcb('0x2a')](_0xcfcb('0x126'),FILES_PATH,rs['generate'](0x4));var _0x4d99f1=util['format']('%s.%s',_0x522dca,_0x2d26f7);var _0x4b3cc6=!![];if(_0x795cb2[_0xcfcb('0x127')]==='NOBEEP'){_0x4b3cc6=![];}var _0x2cd46c=this[_0xcfcb('0xe')]['recordFile'](_0x522dca,_0x2d26f7,_0x795cb2[_0xcfcb('0x129')],_0x795cb2[_0xcfcb('0x68')],undefined,_0x4b3cc6);if(_0x2cd46c[_0xcfcb('0xab')]!==-0x1){this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0x12f'),_0x4d99f1));var _0x20edce=this[_0xcfcb('0x130')][_0xcfcb('0xa2')](this,_0x795cb2,_0x4d99f1);if(_0x20edce){for(var _0x1d21f8 in _0x20edce){if(_0x20edce['hasOwnProperty'](_0x1d21f8)){this['channel'][_0xcfcb('0xd8')](util[_0xcfcb('0x2a')](_0xcfcb('0x131'),_0x1d21f8[_0xcfcb('0x6a')]()),_0x20edce[_0x1d21f8]);}}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format']('TildeASR\x20Result\x20%s',JSON['stringify'](_0x20edce)));}}return _0x2cd46c;};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x132')]=function(_0x2a460c){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x2a460c[_0xcfcb('0x3a')]));return this[_0xcfcb('0xe')][_0xcfcb('0x133')](_0x2a460c[_0xcfcb('0x134')],_0x2a460c['extension'],_0x2a460c['priority']);};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x135')]=function(_0x228df5){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x136'),_0x228df5[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x228df5[_0xcfcb('0x137')])){return this['channel'][_0xcfcb('0x2c')](_0x228df5,_0xcfcb('0x138'));}try{var _0x533a7a=eval(_0x228df5[_0xcfcb('0x137')])?'true':'false';this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x139'),_0x228df5[_0xcfcb('0x137')],_0x533a7a));return{'code':0xc8,'result':_0x533a7a};}catch(_0x1e1bcd){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x13a')]=function(_0x204ec6){logger['info'](util[_0xcfcb('0x2a')](_0xcfcb('0x13b'),_0x204ec6['label']));if(!this[_0xcfcb('0x7e')](_0x204ec6['interval_id'])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x204ec6,_0xcfcb('0x13c'));}var _0x2f4e7c=this[_0xcfcb('0x25')]['sync'](this,_0x204ec6['interval_id']);if(!_0x2f4e7c){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x204ec6,_0xcfcb('0x13d'));}for(var _0x241985=0x0;_0x241985<_0x2f4e7c[_0xcfcb('0x98')];_0x241985+=0x1){var _0x2cdd4b=this['channel'][_0xcfcb('0x12')](util['format'](_0xcfcb('0x13e'),_0x2f4e7c[_0x241985]));if(_0x2cdd4b[_0xcfcb('0xab')]===-0x1){return _0x2cdd4b;}logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x13f'),_0x2f4e7c[_0x241985],_0x2cdd4b[_0xcfcb('0x9d')]));if(_0x2cdd4b['extra']===_0xcfcb('0x140')){logger['info'](util[_0xcfcb('0x2a')]('IFTIME\x20%s\x20%s',_0x2f4e7c[_0x241985],_0xcfcb('0x140')));this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0x13f'),_0x2f4e7c[_0x241985],_0xcfcb('0x140')));return{'code':0xc8,'result':_0xcfcb('0x140')};}else{logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0x13f'),_0x2f4e7c[_0x241985],'false'));this['channel'][_0xcfcb('0xa3')](util['format'](_0xcfcb('0x13f'),_0x2f4e7c[_0x241985],_0xcfcb('0x141')));}}return{'code':0xc8,'result':_0xcfcb('0x141')};};AGIVertices['prototype'][_0xcfcb('0x142')]=function(_0x1404af){logger['info'](util[_0xcfcb('0x2a')](_0xcfcb('0x143'),_0x1404af['label']));return this[_0xcfcb('0xe')][_0xcfcb('0x142')]();};AGIVertices[_0xcfcb('0x11')]['ispeechasr']=function(_0x2b132a){logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0x144'),_0x2b132a['label']));if(!this['isConfigured'](_0x2b132a[_0xcfcb('0x77')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xe2'));}var _0x2ab424='wav';var _0x5c0e90=util[_0xcfcb('0x2a')](_0xcfcb('0x126'),FILES_PATH,rs[_0xcfcb('0x110')](0x4));var _0x1fa370=util[_0xcfcb('0x2a')]('%s.%s',_0x5c0e90,_0x2ab424);var _0x17e64d=!![];if(_0x2b132a[_0xcfcb('0x127')]===_0xcfcb('0x145')){_0x17e64d=![];}var _0x50fec3=this[_0xcfcb('0xe')][_0xcfcb('0x128')](_0x5c0e90,_0x2ab424,_0x2b132a['intKey'],_0x2b132a[_0xcfcb('0x68')],undefined,_0x17e64d);if(_0x50fec3[_0xcfcb('0xab')]!==-0x1){this['channel'][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x146'),_0x1fa370));var _0x577e05=this[_0xcfcb('0x7c')][_0xcfcb('0xa2')](this,_0x2b132a,_0x1fa370);if(_0x577e05){for(var _0x5b7647 in _0x577e05){if(_0x577e05['hasOwnProperty'](_0x5b7647)){this[_0xcfcb('0xe')]['setVariable'](util[_0xcfcb('0x2a')](_0xcfcb('0x147'),_0x5b7647[_0xcfcb('0x6a')]()),_0x577e05[_0x5b7647]);}}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format']('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x577e05)));}}return _0x50fec3;};AGIVertices['prototype'][_0xcfcb('0x148')]=function(_0x5212d1){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x149'),_0x5212d1[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x5212d1[_0xcfcb('0x77')])){return this['channel']['noop']('no\x20key\x20configured');}if(!this[_0xcfcb('0x7e')](_0x5212d1['text'])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')]('no\x20text\x20configured');}this[_0xcfcb('0xe')]['noop'](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x5212d1[_0xcfcb('0x5c')]));var _0x891007=this[_0xcfcb('0x7a')][_0xcfcb('0xa2')](this,_0x5212d1);if(_0x891007){this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x146'),_0x891007));var _0x58c953=this[_0xcfcb('0xe')][_0xcfcb('0xf3')](_0x891007,_0x5212d1[_0xcfcb('0x129')]);try{fs[_0xcfcb('0x119')](_0x891007+_0xcfcb('0xf4'));}catch(_0x237880){logger[_0xcfcb('0x2c')](_0x237880);}return _0x58c953;}return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x5212d1,_0xcfcb('0x14a'));};AGIVertices['prototype'][_0xcfcb('0x14b')]=function(_0x59b19f){logger['info'](util[_0xcfcb('0x2a')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x59b19f[_0xcfcb('0x3a')]));if(!this['isConfigured'](_0x59b19f[_0xcfcb('0x14c')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x59b19f,_0xcfcb('0x14d'));}logger[_0xcfcb('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xcfcb('0x3e')],_0x59b19f[_0xcfcb('0x14c')]));var _0x223108=this['agentLogin'][_0xcfcb('0xa2')](this,_0x59b19f[_0xcfcb('0x14c')]);if(_0x223108){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x14e'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x59b19f[_0xcfcb('0x14c')]));this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format'](_0xcfcb('0x14e'),this['channel'][_0xcfcb('0x3e')],_0x59b19f[_0xcfcb('0x14c')]));return{'code':0xc8,'result':'success'};}else{logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x14f'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x59b19f[_0xcfcb('0x14c')]));this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0x14f'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x59b19f['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x150')]=function(_0x27b018){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x27b018['label']));if(!this[_0xcfcb('0x7e')](_0x27b018['findBy'])){return this['channel'][_0xcfcb('0x2c')](_0x27b018,_0xcfcb('0x14d'));}logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0x151'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x27b018[_0xcfcb('0x14c')]));var _0x42e171=this[_0xcfcb('0x51')][_0xcfcb('0xa2')](this,_0x27b018[_0xcfcb('0x14c')]);if(_0x42e171){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x14e'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x27b018[_0xcfcb('0x14c')]));this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x27b018[_0xcfcb('0x14c')]));return{'code':0xc8,'result':_0xcfcb('0x152')};}else{logger['info'](util['format'](_0xcfcb('0x14f'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x27b018[_0xcfcb('0x14c')]));this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x14f'),this['channel'][_0xcfcb('0x3e')],_0x27b018['findBy']));return{'code':0xc8,'result':_0xcfcb('0x153')};}};AGIVertices['prototype']['math']=function(_0x441f22){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x441f22[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x441f22[_0xcfcb('0x154')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x441f22,'no\x20operation\x20configured');}this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')]('math\x20%s',_0x441f22['operation']));var _0x559612=eval(_0x441f22[_0xcfcb('0x154')]);if(!this['isConfigured'](_0x441f22[_0xcfcb('0x106')])){return this[_0xcfcb('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2bbf74=this[_0xcfcb('0x12')][_0xcfcb('0xa2')](this,_0x441f22['variable_id']);if(!_0x2bbf74){return this[_0xcfcb('0xe')]['error'](_0x441f22,_0xcfcb('0xd6'));}if(_[_0xcfcb('0x95')](_0x559612)){var _0x4a7066=this;_0x559612[_0xcfcb('0xd7')](function(_0x2d74cf,_0x521668){_0x4a7066[_0xcfcb('0xe')][_0xcfcb('0xd8')](util[_0xcfcb('0x2a')]('%s[%s]',_0x2bbf74,_0x521668),_0x2d74cf);});return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format']('variable\x20%s[key]\x20set',_0x2bbf74));}else{return this['channel'][_0xcfcb('0xd8')](_0x2bbf74,_0x559612);}};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x155')]=function(_0x211dce){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x156'),_0x211dce[_0xcfcb('0x3a')]));if(_0x211dce['retry']===0x0){return this[_0xcfcb('0x100')](_0x211dce);}_0x211dce[_0xcfcb('0x101')]-=0x1;if(!this[_0xcfcb('0x7e')](_0x211dce['file_id'])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x211dce,_0xcfcb('0x103'));}var _0x24d454=this['getSound'][_0xcfcb('0xa2')](this,_0x211dce[_0xcfcb('0x102')]);if(!_0x24d454){return this[_0xcfcb('0xe')]['error'](_0x211dce,_0xcfcb('0x105'));}var _0x2f0ee9=this[_0xcfcb('0xe')][_0xcfcb('0x107')](_0x24d454,_0x211dce['response'],_0x211dce[_0xcfcb('0x157')]);var _0x328a68=_0x2f0ee9[_0xcfcb('0xab')];if(_0x2f0ee9['result']===-0x1){this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x211dce,'-1');return _0x2f0ee9;}else if(_0x2f0ee9[_0xcfcb('0x9d')]===_0xcfcb('0x68')){_0x2f0ee9[_0xcfcb('0xab')]=_0x2f0ee9[_0xcfcb('0xab')][_0xcfcb('0x98')]>0x0?_0x2f0ee9[_0xcfcb('0xab')]:'t';}else if(_[_0xcfcb('0x47')](_0x2f0ee9['result'])){_0x2f0ee9[_0xcfcb('0xab')]='#';_0x328a68='#';}if(!this[_0xcfcb('0x7e')](_0x211dce['variable_id'])){this[_0xcfcb('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0xf8ab52=this[_0xcfcb('0x12')][_0xcfcb('0xa2')](this,_0x211dce[_0xcfcb('0x106')]);if(!_0xf8ab52){return this['channel'][_0xcfcb('0x2c')](_0x211dce,_0xcfcb('0xd6'));}this[_0xcfcb('0xe')][_0xcfcb('0xd8')](_0xf8ab52,_0x328a68);}this['createSquareDetailsReport'][_0xcfcb('0xa2')](this,_0x211dce,_0x328a68);return _0x2f0ee9;};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xa3')]=function(_0x2a5d56){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x2a5d56['label']));return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0x2a5d56['output']||_0x2a5d56[_0xcfcb('0x3a')]);};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x158')]=function(_0x18a00d){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x159'),_0x18a00d[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x18a00d[_0xcfcb('0x14c')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x18a00d,_0xcfcb('0x14d'));}logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x151'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x18a00d['findBy']));var _0x16f153=this[_0xcfcb('0x15a')][_0xcfcb('0xa2')](this,_0x18a00d[_0xcfcb('0x15b')]);var _0x6a2577=this[_0xcfcb('0x4f')]['sync'](this,_0x18a00d[_0xcfcb('0x14c')],_0x16f153);if(_0x6a2577){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x14e'),this['channel'][_0xcfcb('0x3e')],_0x18a00d[_0xcfcb('0x14c')]));this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x14e'),this['channel']['callerid'],_0x18a00d[_0xcfcb('0x14c')]));return{'code':0xc8,'result':_0xcfcb('0x152')};}else{logger['info'](util['format'](_0xcfcb('0x14f'),this[_0xcfcb('0xe')]['callerid'],_0x18a00d[_0xcfcb('0x14c')]));this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0x14e'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x18a00d[_0xcfcb('0x14c')]));return{'code':0xc8,'result':_0xcfcb('0x153')};}};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x15c')]=function(_0x95b9c8){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x15d'),_0x95b9c8[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x95b9c8[_0xcfcb('0x102')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x95b9c8,_0xcfcb('0x103'));}var _0x3e0b75=this[_0xcfcb('0x104')][_0xcfcb('0xa2')](this,_0x95b9c8[_0xcfcb('0x102')]);if(!_0x3e0b75){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x95b9c8,_0xcfcb('0x105'));}var _0x47ec00=this[_0xcfcb('0xe')][_0xcfcb('0x57')](_0xcfcb('0x15e'),[_0x3e0b75,_0x95b9c8[_0xcfcb('0xde')]]);if(_0x47ec00[_0xcfcb('0xab')]===-0x1){return _0x47ec00;}return this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0xc2'),_0xcfcb('0x15e'),_0x3e0b75));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x15f')]=function(_0x4cf7a6){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x160'),_0x4cf7a6[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x4cf7a6['queue_id'])){return this[_0xcfcb('0xe')]['error'](_0x4cf7a6,_0xcfcb('0x161'));}var _0x278520='';var _0x40c006=parseInt(_0x4cf7a6[_0xcfcb('0x162')],0xa);if(isNaN(_0x40c006)){_0x278520=_0x4cf7a6[_0xcfcb('0x162')];}else{_0x278520=this[_0xcfcb('0x16')][_0xcfcb('0xa2')](this,_0x4cf7a6[_0xcfcb('0x162')]);if(!_0x278520){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x4cf7a6,'no\x20queue\x20found');}}var _0x5d18d2='';if(this[_0xcfcb('0x7e')](_0x4cf7a6[_0xcfcb('0x102')])){var _0x46afd6=this['getSound'][_0xcfcb('0xa2')](this,_0x4cf7a6['file_id']);if(_0x46afd6){_0x5d18d2=_0x46afd6;}}this[_0xcfcb('0x38')]['sync'](this,_0x4cf7a6,_0x278520);if(_0x4cf7a6[_0xcfcb('0xde')]['indexOf']('x')<0x0){_0x4cf7a6[_0xcfcb('0xde')]+='x';}if(_0x4cf7a6[_0xcfcb('0xde')][_0xcfcb('0x163')]('X')<0x0){_0x4cf7a6[_0xcfcb('0xde')]+='X';}this[_0xcfcb('0xe')][_0xcfcb('0xd8')](_0xcfcb('0x164'),_0x278520?_0x278520[_0xcfcb('0x165')]():'');var _0x5af7d9=this[_0xcfcb('0xe')][_0xcfcb('0x57')](_0xcfcb('0x166'),[_0x278520,_0x4cf7a6['opts'],_0x4cf7a6['url'],_0x5d18d2,_0x4cf7a6[_0xcfcb('0x68')],_0x4cf7a6['agi'],_0x4cf7a6[_0xcfcb('0x167')],_0x4cf7a6[_0xcfcb('0x168')],'',_0x4cf7a6[_0xcfcb('0x169')]]);if(_0x5af7d9[_0xcfcb('0xab')]===-0x1){return _0x5af7d9;}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xc2'),_0xcfcb('0x166'),_0x278520));};AGIVertices['prototype'][_0xcfcb('0x16a')]=function(_0x1debc3){logger['info'](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x1debc3['label']));var _0x206a6a=_0x1debc3[_0xcfcb('0x16b')]||'wav';var _0x2aa1e9=util['format']('%s_%s',this[_0xcfcb('0xe')][_0xcfcb('0x39')],rs['generate'](0x5));var _0x4d3816=util[_0xcfcb('0x2a')]('%s/recordings/%s.%s',FILES_PATH,_0x2aa1e9,_0x206a6a);var _0x67363=util['format'](_0xcfcb('0x126'),FILES_PATH,_0x2aa1e9);this['createSquareRecording']['sync'](this,_0x1debc3,_0x2aa1e9,_0x4d3816);this[_0xcfcb('0xe')][_0xcfcb('0xd8')](_0xcfcb('0x16c'),_0x2aa1e9);logger[_0xcfcb('0x30')](_0xcfcb('0x16d'),_0x67363,_0x206a6a,_0x1debc3[_0xcfcb('0x16e')],_0x1debc3[_0xcfcb('0x68')]);return this[_0xcfcb('0xe')]['recordFile'](_0x67363,_0x206a6a,_0x1debc3['escape_digits'],_0x1debc3[_0xcfcb('0x68')],undefined,!![]);};AGIVertices['prototype'][_0xcfcb('0x16f')]=function(_0x220367){logger['info'](util[_0xcfcb('0x2a')](_0xcfcb('0x170'),_0x220367[_0xcfcb('0x3a')]));if(!this['isConfigured'](_0x220367['url'])){return this['channel'][_0xcfcb('0xa3')](_0xcfcb('0x171'));}var _0x348854=this[_0xcfcb('0x172')][_0xcfcb('0xa2')](this,_0x220367);logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x173'),util['inspect'](_0x348854,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x220367[_0xcfcb('0x106')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0x174'));}var _0x4a7f0f=this[_0xcfcb('0x12')][_0xcfcb('0xa2')](this,_0x220367['variable_id']);if(!_0x4a7f0f){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x220367,_0xcfcb('0xd6'));}this['channel'][_0xcfcb('0xd8')](util[_0xcfcb('0x2a')](_0xcfcb('0x175'),_0x4a7f0f),_0x348854[_0xcfcb('0x176')]?_0x348854[_0xcfcb('0x176')]:'200');this[_0xcfcb('0xe')][_0xcfcb('0xd8')](util[_0xcfcb('0x2a')](_0xcfcb('0x177'),_0x4a7f0f),_0x348854['statusMessage']?_0x348854[_0xcfcb('0x178')]:'OK');if(_0x348854['body']){try{this[_0xcfcb('0x96')](_0x348854[_0xcfcb('0x71')],_0x4a7f0f);}catch(_0x3cf33a){logger[_0xcfcb('0x2c')](util[_0xcfcb('0x2a')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x4a7f0f));}}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xda'),_0x4a7f0f));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x179')]=function(_0x506577){logger[_0xcfcb('0x30')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x506577[_0xcfcb('0x3a')]));return this['channel'][_0xcfcb('0x17a')](_0x506577['digits']['replace'](/\s+/g,''),_0x506577[_0xcfcb('0x16e')]);};AGIVertices['prototype'][_0xcfcb('0x17b')]=function(_0x1644bf){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x17c'),_0x1644bf['label']));return this[_0xcfcb('0xe')][_0xcfcb('0x17d')](_0x1644bf[_0xcfcb('0x67')]['replace'](/\s+/g,''),_0x1644bf[_0xcfcb('0x16e')]);};AGIVertices[_0xcfcb('0x11')]['sayphonetic']=function(_0x2db126){logger['info'](util['format'](_0xcfcb('0x17e'),_0x2db126['label']));return this[_0xcfcb('0xe')]['sayPhonetic'](_0x2db126['text'],_0x2db126['escape_digits']);};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x17f')]=function(_0x25abe6){logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0x180'),_0x25abe6[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x25abe6[_0xcfcb('0x181')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')]('no\x20mail\x20account\x20configured');}var _0x5336e8=this[_0xcfcb('0x182')]['sync'](this,_0x25abe6[_0xcfcb('0x181')]);if(!_0x5336e8||!_0x5336e8[_0xcfcb('0x183')]){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x25abe6,'no\x20mail\x20account\x20found');}var _0x202c20={'from':util[_0xcfcb('0x2a')](_0xcfcb('0x184'),_0x5336e8['name'],_0x5336e8['email']||_0x5336e8['Smtp'][_0xcfcb('0x185')]),'to':_0x25abe6['to']||'','cc':_0x25abe6['cc']||'','bcc':_0x25abe6[_0xcfcb('0x186')]||'','subject':_0x25abe6['subject'],'html':_0x25abe6[_0xcfcb('0x5c')],'text':_0x25abe6[_0xcfcb('0x5c')]};var _0x485d84={'tls':{'rejectUnauthorized':![]}};if(_0x5336e8['Smtp'][_0xcfcb('0x187')]){_0x485d84['service']=_0x5336e8[_0xcfcb('0x183')]['service'];}else{_0x485d84['host']=_0x5336e8['Smtp'][_0xcfcb('0x188')];_0x485d84[_0xcfcb('0x189')]=_0x5336e8[_0xcfcb('0x183')]['port'];_0x485d84[_0xcfcb('0x18a')]=_0x5336e8[_0xcfcb('0x183')][_0xcfcb('0x18a')];}if(_0x5336e8['Smtp'][_0xcfcb('0x18b')]){_0x485d84[_0xcfcb('0x18c')]={'user':_0x5336e8[_0xcfcb('0x183')][_0xcfcb('0x185')],'pass':_0x5336e8[_0xcfcb('0x183')]['pass']};}if(this[_0xcfcb('0x7e')](_0x25abe6['template_id'])){}logger[_0xcfcb('0x18d')](_0xcfcb('0x18e'),JSON['stringify'](_0x202c20));this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x25abe6,_0x25abe6[_0xcfcb('0x181')]);this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format'](_0xcfcb('0x18f'),_0x5336e8[_0xcfcb('0x14')]));this['sendMailMessage']['sync'](this,_0x485d84,_0x202c20);return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0x190'));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x191')]=function(_0x546272){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x192'),_0x546272[_0xcfcb('0x3a')]));return this[_0xcfcb('0xe')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x193')]=function(_0xe04879){logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0x194'),_0xe04879['label']));if(!this[_0xcfcb('0x7e')](_0xe04879[_0xcfcb('0x195')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')]('no\x20sms\x20account\x20configured');}var _0x4cdd11=this[_0xcfcb('0x35')][_0xcfcb('0xa2')](this,_0xe04879[_0xcfcb('0x195')]);if(!_0x4cdd11){return this['channel']['error'](_0xe04879,_0xcfcb('0x196'));}var _0x353817={'body':_0xe04879[_0xcfcb('0x197')],'phone':_0xe04879['to']||'','SmsAccountId':_0x4cdd11['id']};logger[_0xcfcb('0x18d')](_0xcfcb('0x198'),JSON['stringify'](_0x353817));this[_0xcfcb('0x38')]['sync'](this,_0xe04879,_0xe04879['sms_account_id']);this['channel']['noop'](util['format'](_0xcfcb('0x199'),_0x4cdd11['name']));this[_0xcfcb('0x37')][_0xcfcb('0xa2')](this,_0x353817);return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0x19a'));};AGIVertices['prototype']['set']=function(_0x164b8d){logger['info'](util[_0xcfcb('0x2a')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x164b8d[_0xcfcb('0x3a')]));if(!this['isConfigured'](_0x164b8d[_0xcfcb('0x106')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x164b8d,_0xcfcb('0x19b'));}var _0x19b55f=this[_0xcfcb('0x12')][_0xcfcb('0xa2')](this,_0x164b8d[_0xcfcb('0x106')]);if(!_0x19b55f){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x164b8d,_0xcfcb('0xd6'));}return this[_0xcfcb('0xe')][_0xcfcb('0xd8')](_0x19b55f,_0x164b8d['variable_value']);};AGIVertices[_0xcfcb('0x11')]['start']=function(_0x88f987){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x19c'),_0x88f987[_0xcfcb('0x3a')]));this[_0xcfcb('0xe')][_0xcfcb('0xa3')]('START\x20CALLY\x20SQUARE');if(_0x88f987[_0xcfcb('0xb5')]==='yes'){this[_0xcfcb('0xe')][_0xcfcb('0xa3')]('Answer');return this['channel']['answer']();}return this[_0xcfcb('0xe')]['noop'](_0xcfcb('0x19d'));};AGIVertices[_0xcfcb('0x11')]['subproject']=function(_0x3ad3b4){logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0x19e'),_0x3ad3b4[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x3ad3b4[_0xcfcb('0x19f')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x3ad3b4,_0xcfcb('0x1a0'));}var _0x21cbae=this[_0xcfcb('0x18')][_0xcfcb('0xa2')](this,_0x3ad3b4[_0xcfcb('0x19f')]);if(!this[_0xcfcb('0x7e')](_0x21cbae)){return this[_0xcfcb('0xe')]['error'](_0x3ad3b4,util[_0xcfcb('0x2a')](_0xcfcb('0x1a1'),_0x3ad3b4[_0xcfcb('0x19f')]));}if(_0x21cbae===this[_0xcfcb('0xe')][_0xcfcb('0x3c')]){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x3ad3b4,_0xcfcb('0x1a2'));}this[_0xcfcb('0x38')]['sync'](this,_0x3ad3b4,_0x21cbae);var _0x52ccff=this[_0xcfcb('0xe')][_0xcfcb('0x57')](_0xcfcb('0x1a3'),util[_0xcfcb('0x2a')](_0xcfcb('0x1a4'),config[_0xcfcb('0xb1')][_0xcfcb('0x188')]||'127.0.0.1',_0x21cbae,this[_0xcfcb('0xe')][_0xcfcb('0x3c')]));if(_0x52ccff[_0xcfcb('0xab')]===-0x1){return _0x52ccff;}return this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0xc2'),_0xcfcb('0x1a3'),_0x21cbae));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x1a5')]=function(_0x1bdb19){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x1a6'),_0x1bdb19[_0xcfcb('0x3a')]));var _0x332d88=this[_0xcfcb('0x56')][_0xcfcb('0xa2')](this,_0x1bdb19[_0xcfcb('0xb3')]);this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x1bdb19,_0x1bdb19[_0xcfcb('0xb3')]);if(this[_0xcfcb('0x7e')](_0x1bdb19['variable_id'])){var _0x32fd95=this['getVariable'][_0xcfcb('0xa2')](this,_0x1bdb19[_0xcfcb('0x106')]);if(_0x32fd95){this['channel']['setVariable'](_0x32fd95,_0x332d88);return this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0x1a7'),_0x1bdb19['command'],_0x32fd95));}}return this['channel'][_0xcfcb('0xa3')](util['format'](_0xcfcb('0x1a8'),_0x1bdb19[_0xcfcb('0xb3')]));};AGIVertices['prototype'][_0xcfcb('0x1a9')]=function(_0x42f3c4){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x1aa'),_0x42f3c4[_0xcfcb('0x3a')]));_0x42f3c4[_0xcfcb('0x5c')]=_0x42f3c4[_0xcfcb('0x5c')][_0xcfcb('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xcfcb('0x7e')](_0x42f3c4[_0xcfcb('0x1ab')])){return this['channel']['noop']('no\x20apiKey\x20configured');}if(!this[_0xcfcb('0x7e')](_0x42f3c4[_0xcfcb('0x5c')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xa4'));}this['channel'][_0xcfcb('0xa3')](util['format'](_0xcfcb('0x1ac'),_0x42f3c4['text']));var _0x28ac60=this[_0xcfcb('0x5a')][_0xcfcb('0xa2')](this,_0x42f3c4);if(_0x28ac60){this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x1ad'),_0x28ac60));var _0x17afc5=this[_0xcfcb('0xe')][_0xcfcb('0xf3')](_0x28ac60);try{fs[_0xcfcb('0x119')](_0x28ac60+_0xcfcb('0xf4'));}catch(_0x3971d2){logger[_0xcfcb('0x2c')](_0x3971d2);}return _0x17afc5;}return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x42f3c4,_0xcfcb('0x1ae'));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x1af')]=function(_0x303cfb){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x303cfb[_0xcfcb('0x3a')]));_0x303cfb[_0xcfcb('0x5c')]=_0x303cfb[_0xcfcb('0x5c')][_0xcfcb('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x303cfb[_0xcfcb('0x5c')])){return this['channel'][_0xcfcb('0xa3')]('no\x20text\x20configured');}this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x1b0'),_0x303cfb[_0xcfcb('0x5c')]));var _0x2b2ade=this[_0xcfcb('0x63')][_0xcfcb('0xa2')](this,_0x303cfb);if(_0x2b2ade){this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')]('Google\x20TTS\x20%s\x20file\x20created',_0x2b2ade));var _0xf2b55=this[_0xcfcb('0xe')]['streamFile'](_0x2b2ade);try{fs[_0xcfcb('0x119')](_0x2b2ade+_0xcfcb('0xf4'));}catch(_0x108bec){logger[_0xcfcb('0x2c')](_0x108bec);}return _0xf2b55;}return this['channel'][_0xcfcb('0x2c')](_0x303cfb,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x1b1')]=function(_0x470ab1){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x1b2'),_0x470ab1[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x470ab1[_0xcfcb('0x14c')])){return this[_0xcfcb('0xe')]['error'](_0x470ab1,_0xcfcb('0x14d'));}logger['info'](util[_0xcfcb('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xcfcb('0x3e')],_0x470ab1[_0xcfcb('0x14c')]));var _0x47ea38=this[_0xcfcb('0x50')][_0xcfcb('0xa2')](this,_0x470ab1[_0xcfcb('0x14c')]);if(_0x47ea38){logger['info'](util[_0xcfcb('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x470ab1[_0xcfcb('0x14c')]));this['channel'][_0xcfcb('0xa3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xcfcb('0xe')]['callerid'],_0x470ab1[_0xcfcb('0x14c')]));return{'code':0xc8,'result':_0xcfcb('0x152')};}else{logger['info'](util[_0xcfcb('0x2a')](_0xcfcb('0x14f'),this['channel']['callerid'],_0x470ab1[_0xcfcb('0x14c')]));this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0x14f'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x470ab1[_0xcfcb('0x14c')]));return{'code':0xc8,'result':_0xcfcb('0x153')};}};AGIVertices['prototype'][_0xcfcb('0x1b3')]=function(_0x367c06){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x1b4'),_0x367c06[_0xcfcb('0x3a')]));var _0x125e74=this['channel'][_0xcfcb('0x57')](_0xcfcb('0x1b5'),[_0x367c06[_0xcfcb('0x1b6')],_0x367c06[_0xcfcb('0x75')]]);if(_0x125e74['result']===-0x1){return _0x125e74;}return this[_0xcfcb('0xe')]['noop'](util['format'](_0xcfcb('0xc2'),'VOICEMAIL',_0x367c06[_0xcfcb('0x1b6')]));};AGIVertices[_0xcfcb('0x11')]['vswitch']=function(_0x16b7e0){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x16b7e0['label']));if(!this[_0xcfcb('0x7e')](_0x16b7e0['variable_id'])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x16b7e0,_0xcfcb('0x19b'));}var _0x4cc57a=this[_0xcfcb('0x12')][_0xcfcb('0xa2')](this,_0x16b7e0[_0xcfcb('0x106')]);if(!_0x4cc57a){return this['channel'][_0xcfcb('0x2c')](_0x16b7e0,_0xcfcb('0xd6'));}var _0x26fc50=this[_0xcfcb('0xe')]['getVariable'](_0x4cc57a);return{'code':0xc8,'result':_0x26fc50[_0xcfcb('0x9d')]?_0x26fc50[_0xcfcb('0x9d')]:'-'};};String['prototype'][_0xcfcb('0x9c')]=function(_0x273851,_0xf0d4ae){return this[_0xcfcb('0x9a')](_0x273851)[_0xcfcb('0x1b7')](_0xf0d4ae);};module[_0xcfcb('0x1b8')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 4151a97..b65dd0a 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 _0x7dfd=['mandatoryDispositionPause','name','QueuePause','getAgent','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','updateAcw','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','saveUnpause','prototype','interface','[ACW][syncAgentConnect]\x20%s','message','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','queue','mandatoryDisposition'];(function(_0xc059cc,_0x46b267){var _0x2eed7e=function(_0x461fa2){while(--_0x461fa2){_0xc059cc['push'](_0xc059cc['shift']());}};_0x2eed7e(++_0x46b267);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xd7df('0x0'));var _=require(_0xd7df('0x1'));var moment=require(_0xd7df('0x2'));var ami=require(_0xd7df('0x3'));var logger=require(_0xd7df('0x4'))(_0xd7df('0x5'));var RpcUser=require(_0xd7df('0x6'));var RpcVoiceAgentReport=require(_0xd7df('0x7'));function Acw(_0x3ef231){this[_0xd7df('0x8')]=_0x3ef231[_0xd7df('0x8')];this[_0xd7df('0x9')]=_0x3ef231[_0xd7df('0x9')];this[_0xd7df('0xa')]=_0x3ef231[_0xd7df('0xa')];this[_0xd7df('0xb')]={};ami['on'](_0xd7df('0xc'),this['syncAgentConnect'][_0xd7df('0xd')](this));ami['on'](_0xd7df('0xe'),this[_0xd7df('0xf')][_0xd7df('0xd')](this));ami['on']('hangup',this[_0xd7df('0x10')]['bind'](this));ami['on'](_0xd7df('0x11'),this['syncAgentRingNoAnswer'][_0xd7df('0xd')](this));ami['on'](_0xd7df('0x12'),this[_0xd7df('0x13')][_0xd7df('0xd')](this));ami['on'](_0xd7df('0x14'),this[_0xd7df('0x15')][_0xd7df('0xd')](this));ami['on'](_0xd7df('0x16'),this[_0xd7df('0x17')][_0xd7df('0xd')](this));}function getDiff(_0xa70589){var _0x4723b7=moment()[_0xd7df('0x18')](0x0);var _0x196632=moment(_0xa70589)[_0xd7df('0x18')](0x0);return _0x4723b7[_0xd7df('0x19')](_0x196632,_0xd7df('0x1a'));}Acw['prototype'][_0xd7df('0x1b')]=function(_0x23cdbc){try{var _0x513b13=this;var _0x18d38f=this[_0xd7df('0xb')][_0x23cdbc]['interface'];var _0x43bc73=this[_0xd7df('0xb')][_0x23cdbc][_0xd7df('0x1c')];var _0x5210e5=this[_0xd7df('0x8')][_0x43bc73];var _0x471621=![];var _0x3cea3='ACW';if(_0x5210e5[_0xd7df('0x1d')]){if(_0x5210e5[_0xd7df('0x1e')][_0xd7df('0x1f')]){_0x471621=!![];_0x3cea3=_0x5210e5['mandatoryDispositionPause'][_0xd7df('0x1f')];}}ami['Action']({'action':_0xd7df('0x20'),'interface':_0x18d38f,'paused':!![],'reason':_0x3cea3})['then'](function(_0x3ae7c3){if(_0x513b13[_0xd7df('0x9')][_0x18d38f]){return RpcUser[_0xd7df('0x21')](_0x513b13['agents'][_0x18d38f]['id'])[_0xd7df('0x22')](function(_0x502ae8){if(_0x502ae8&&!_0x502ae8[_0xd7df('0x23')]){logger[_0xd7df('0x24')](_0xd7df('0x25'),_0x23cdbc,_0x18d38f,_0x43bc73);var _0x29f354=_0x513b13[_0xd7df('0xb')][_0x23cdbc][_0xd7df('0x26')]&&_0x513b13[_0xd7df('0xb')][_0x23cdbc]['destlinkedid']?_0x513b13['channels'][_0x23cdbc][_0xd7df('0x27')]:_0x23cdbc;return RpcUser[_0xd7df('0x28')](_0x513b13[_0xd7df('0x9')][_0x18d38f],_0x3cea3,_0x29f354)[_0xd7df('0x22')](function(_0x13f190){if(!_0x471621){_0x513b13[_0xd7df('0xa')][_0x18d38f]={};logger[_0xd7df('0x24')](_0xd7df('0x29'),_0x23cdbc,_0x513b13[_0xd7df('0x8')][_0x43bc73]['acwTimeout'],_0x18d38f,_0x43bc73);_0x513b13[_0xd7df('0xa')][_0x18d38f][_0xd7df('0x2a')]=setTimeout(_0x513b13[_0xd7df('0x2b')][_0xd7df('0xd')](_0x513b13,_0x18d38f),_0x513b13[_0xd7df('0x8')][_0x43bc73][_0xd7df('0x2c')]*0x3e8);_0x513b13[_0xd7df('0xa')][_0x18d38f][_0xd7df('0x2d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x513b13['timers'][_0x18d38f]['uniqueid']=_0x23cdbc;_0x513b13['timers'][_0x18d38f][_0xd7df('0x1c')]=_0x43bc73;_0x513b13['timers'][_0x18d38f][_0xd7df('0x2e')]=function(){var _0x156612=getDiff(_0x513b13['timers'][_0x18d38f][_0xd7df('0x2d')]);clearTimeout(_0x513b13[_0xd7df('0xa')][_0x18d38f]['timer']);_0x513b13[_0xd7df('0xa')][_0x18d38f][_0xd7df('0x2a')]=![];RpcVoiceAgentReport[_0xd7df('0x2f')]({'acwtime':_0x156612},_0x513b13[_0xd7df('0xa')][_0x18d38f][_0xd7df('0x30')],_0x18d38f)[_0xd7df('0x22')](function(_0x5a658f){logger[_0xd7df('0x24')](_0xd7df('0x31'),_0x23cdbc,_0x156612,_0x5a658f);})[_0xd7df('0x32')](function(_0x1d81b2){logger[_0xd7df('0x33')](_0xd7df('0x34'),_0x23cdbc,_0x1d81b2);});delete _0x513b13[_0xd7df('0xa')][_0x18d38f];};}});}else{logger[_0xd7df('0x24')](_0xd7df('0x35'),_0x23cdbc,_0x18d38f,_0x43bc73);}});}})[_0xd7df('0x32')](function(_0x2e828e){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x23cdbc,_0x513b13[_0xd7df('0x8')][_0x43bc73]['acwTimeout'],_0x18d38f,_0x43bc73);})[_0xd7df('0x36')](function(){delete _0x513b13[_0xd7df('0xb')][_0x23cdbc];});}catch(_0xa0ed20){logger[_0xd7df('0x33')]('[ACW][START]\x20%s',_0xa0ed20['message']);}};Acw['prototype'][_0xd7df('0x2b')]=function(_0x15e682){try{var _0x55c43f=this;if(_0x55c43f[_0xd7df('0xa')][_0x15e682]){_0x55c43f[_0xd7df('0xa')][_0x15e682][_0xd7df('0x2a')]=![];var _0x574567=_0x55c43f['timers'][_0x15e682][_0xd7df('0x30')];var _0x45642c=_0x55c43f['timers'][_0x15e682][_0xd7df('0x1c')];var _0x564ce2=_0x55c43f[_0xd7df('0x8')][_0x45642c][_0xd7df('0x2c')];logger[_0xd7df('0x24')]('[TIMER][STOP][AGENT:%s]',_0x15e682);RpcUser[_0xd7df('0x37')](this[_0xd7df('0x9')][_0x15e682]);RpcVoiceAgentReport[_0xd7df('0x2f')]({'acwtime':_0x564ce2,'agentacw':!![]},_0x574567,_0x15e682)[_0xd7df('0x22')](function(_0x54ea42){logger[_0xd7df('0x24')](_0xd7df('0x31'),_0x574567,_0x564ce2,_0x54ea42);})[_0xd7df('0x32')](function(_0x4f6286){logger[_0xd7df('0x33')](_0xd7df('0x34'),_0x574567,_0x4f6286);});}else{logger[_0xd7df('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x15e682);if(_0x55c43f[_0xd7df('0xa')]){logger[_0xd7df('0x24')]('[ACW][TIMERS]',JSON['stringify'](_0x55c43f[_0xd7df('0xa')]));}}}catch(_0x211feb){logger[_0xd7df('0x33')]('[ACW][STOP]\x20%s',_0x211feb['message']);}};Acw[_0xd7df('0x38')]['syncAgentConnect']=function(_0xe606f4){try{if(this['voiceQueues'][_0xe606f4['queue']]&&(this[_0xd7df('0x8')][_0xe606f4['queue']][_0xd7df('0x5')]||this[_0xd7df('0x8')][_0xe606f4[_0xd7df('0x1c')]][_0xd7df('0x1d')])){if(this[_0xd7df('0x9')][_0xe606f4[_0xd7df('0x39')]]){this[_0xd7df('0xb')][_0xe606f4[_0xd7df('0x30')]]={'queue':_0xe606f4[_0xd7df('0x1c')],'interface':_0xe606f4['interface'],'destlinkedid':_0xe606f4[_0xd7df('0x27')]};}}}catch(_0x4b9076){logger[_0xd7df('0x33')](_0xd7df('0x3a'),_0x4b9076[_0xd7df('0x3b')]);}};Acw[_0xd7df('0x38')][_0xd7df('0x17')]=function(_0x145223){try{if(this[_0xd7df('0x8')][_0x145223[_0xd7df('0x1c')]]&&(this[_0xd7df('0x8')][_0x145223['queue']][_0xd7df('0x5')]||this[_0xd7df('0x8')][_0x145223['queue']]['mandatoryDisposition'])){if(this[_0xd7df('0x9')][_0x145223[_0xd7df('0x39')]]){this[_0xd7df('0xb')][_0x145223['uniqueid']]={'queue':_0x145223['queue'],'interface':_0x145223[_0xd7df('0x39')]};}}}catch(_0x49a763){logger[_0xd7df('0x33')](_0xd7df('0x3c'),_0x49a763[_0xd7df('0x3b')]);}};Acw[_0xd7df('0x38')][_0xd7df('0xf')]=function(_0x28c13f){try{if(this[_0xd7df('0xb')][_0x28c13f[_0xd7df('0x30')]]&&_[_0xd7df('0x3d')](this[_0xd7df('0xb')][_0x28c13f[_0xd7df('0x30')]][_0xd7df('0x26')])){logger['info'](_0xd7df('0x3e'),_0x28c13f[_0xd7df('0x30')]);this[_0xd7df('0x1b')](_0x28c13f[_0xd7df('0x30')]);}else if(this[_0xd7df('0xb')][_0x28c13f['linkedid']]&&_[_0xd7df('0x3d')](this[_0xd7df('0xb')][_0x28c13f[_0xd7df('0x3f')]]['attended'])){logger[_0xd7df('0x24')]('[%s][HANGUP:LINKEDID]',_0x28c13f[_0xd7df('0x3f')]);this[_0xd7df('0x1b')](_0x28c13f[_0xd7df('0x3f')]);}}catch(_0x579bec){logger[_0xd7df('0x33')]('[ACW][syncHangupRequest]\x20%s',_0x579bec['message']);}};Acw['prototype'][_0xd7df('0x10')]=function(_0x4a6cf5){try{if(this[_0xd7df('0xb')][_0x4a6cf5[_0xd7df('0x30')]]&&this[_0xd7df('0xb')][_0x4a6cf5[_0xd7df('0x30')]][_0xd7df('0x26')]){logger[_0xd7df('0x24')](_0xd7df('0x40'),_0x4a6cf5[_0xd7df('0x30')]);this[_0xd7df('0x1b')](_0x4a6cf5[_0xd7df('0x30')]);}else if(this[_0xd7df('0xb')][_0x4a6cf5[_0xd7df('0x3f')]]&&this[_0xd7df('0xb')][_0x4a6cf5[_0xd7df('0x3f')]][_0xd7df('0x26')]){logger[_0xd7df('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x4a6cf5[_0xd7df('0x3f')]);this[_0xd7df('0x1b')](_0x4a6cf5['linkedid']);}}catch(_0x56819b){logger[_0xd7df('0x33')]('[ACW][syncHangup]\x20%s',_0x56819b[_0xd7df('0x3b')]);}};Acw['prototype'][_0xd7df('0x13')]=function(_0x28151a){try{if(!_[_0xd7df('0x41')](this['channels'][_0x28151a['transfereeuniqueid']])){this['startAcw'](_0x28151a[_0xd7df('0x42')]);if(this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x43')]]){this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x43')]][_0xd7df('0x26')]=!![];this['channels'][_0x28151a[_0xd7df('0x44')]]=this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x43')]];delete this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x43')]];}}else if(!_[_0xd7df('0x41')](this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x44')]])){this[_0xd7df('0x1b')](_0x28151a[_0xd7df('0x44')]);if(this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x45')]]){this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x45')]][_0xd7df('0x26')]=!![];this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x42')]]=this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x45')]];delete this[_0xd7df('0xb')][_0x28151a[_0xd7df('0x45')]];}}}catch(_0x393a3a){logger[_0xd7df('0x33')](_0xd7df('0x46'),_0x393a3a[_0xd7df('0x3b')]);}};Acw[_0xd7df('0x38')]['syncBlindTransfer']=function(_0x57ec6f){try{if(this[_0xd7df('0xb')][_0x57ec6f[_0xd7df('0x47')]]){logger[_0xd7df('0x24')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xd7df('0x48')](_0x57ec6f[_0xd7df('0x47')]));this[_0xd7df('0x1b')](_0x57ec6f[_0xd7df('0x47')]);}else if(this['channels'][_0x57ec6f[_0xd7df('0x49')]]){logger[_0xd7df('0x24')](_0xd7df('0x4a'),JSON[_0xd7df('0x48')](_0x57ec6f[_0xd7df('0x49')]));this[_0xd7df('0x1b')](_0x57ec6f[_0xd7df('0x49')]);}}catch(_0x2fdad0){logger['error'](_0xd7df('0x4b'),_0x2fdad0[_0xd7df('0x3b')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x481fa5){try{if(this[_0xd7df('0x8')][_0x481fa5[_0xd7df('0x1c')]]&&this[_0xd7df('0x8')][_0x481fa5[_0xd7df('0x1c')]]['autopause']===_0xd7df('0x4c')){if(this[_0xd7df('0x9')][_0x481fa5[_0xd7df('0x39')]]){logger[_0xd7df('0x24')](_0xd7df('0x4d'),_0x481fa5[_0xd7df('0x30')],_0x481fa5[_0xd7df('0x39')],_0x481fa5['queue']);return RpcUser['savePause'](this[_0xd7df('0x9')][_0x481fa5['interface']],_0xd7df('0x4e'),_0x481fa5[_0xd7df('0x30')]);}}}catch(_0x1efefa){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1efefa[_0xd7df('0x3b')]);}};module[_0xd7df('0x4f')]=Acw; \ No newline at end of file +var _0x7fbe=['transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','interface','ACW','mandatoryDisposition','name','QueuePause','then','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','message','prototype','stopAcw','timer','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','attended','[%s][HANGUP:UNIQUEID]','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]'];(function(_0x30a446,_0x17a06c){var _0x182f93=function(_0x3945a8){while(--_0x3945a8){_0x30a446['push'](_0x30a446['shift']());}};_0x182f93(++_0x17a06c);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x260073,_0xbe6af9){_0x260073=_0x260073-0x0;var _0x4ff033=_0x7fbe[_0x260073];return _0x4ff033;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xe7fb('0x0'));var ami=require(_0xe7fb('0x1'));var logger=require(_0xe7fb('0x2'))(_0xe7fb('0x3'));var RpcUser=require(_0xe7fb('0x4'));var RpcVoiceAgentReport=require(_0xe7fb('0x5'));function Acw(_0x11d2c4){this[_0xe7fb('0x6')]=_0x11d2c4[_0xe7fb('0x6')];this[_0xe7fb('0x7')]=_0x11d2c4[_0xe7fb('0x7')];this[_0xe7fb('0x8')]=_0x11d2c4[_0xe7fb('0x8')];this[_0xe7fb('0x9')]={};ami['on']('agentconnect',this[_0xe7fb('0xa')][_0xe7fb('0xb')](this));ami['on'](_0xe7fb('0xc'),this[_0xe7fb('0xd')]['bind'](this));ami['on']('hangup',this[_0xe7fb('0xe')][_0xe7fb('0xb')](this));ami['on'](_0xe7fb('0xf'),this[_0xe7fb('0x10')][_0xe7fb('0xb')](this));ami['on'](_0xe7fb('0x11'),this[_0xe7fb('0x12')][_0xe7fb('0xb')](this));ami['on'](_0xe7fb('0x13'),this[_0xe7fb('0x14')][_0xe7fb('0xb')](this));ami['on'](_0xe7fb('0x15'),this[_0xe7fb('0x16')][_0xe7fb('0xb')](this));}function getDiff(_0x7fe4d3){var _0x598729=moment()[_0xe7fb('0x17')](0x0);var _0x2225e5=moment(_0x7fe4d3)['milliseconds'](0x0);return _0x598729[_0xe7fb('0x18')](_0x2225e5,_0xe7fb('0x19'));}Acw['prototype'][_0xe7fb('0x1a')]=function(_0x559129){try{var _0x12fff6=this;var _0x18d23c=this[_0xe7fb('0x9')][_0x559129][_0xe7fb('0x1b')];var _0x562262=this[_0xe7fb('0x9')][_0x559129]['queue'];var _0x293a47=this['voiceQueues'][_0x562262];var _0x1e77fd=![];var _0x4708f7=_0xe7fb('0x1c');if(_0x293a47[_0xe7fb('0x1d')]){if(_0x293a47['mandatoryDispositionPause'][_0xe7fb('0x1e')]){_0x1e77fd=!![];_0x4708f7=_0x293a47['mandatoryDispositionPause'][_0xe7fb('0x1e')];}}ami['Action']({'action':_0xe7fb('0x1f'),'interface':_0x18d23c,'paused':!![],'reason':_0x4708f7})['then'](function(_0xa5af01){if(_0x12fff6[_0xe7fb('0x7')][_0x18d23c]){return RpcUser['getAgent'](_0x12fff6[_0xe7fb('0x7')][_0x18d23c]['id'])[_0xe7fb('0x20')](function(_0x3ae8f1){if(_0x3ae8f1&&!_0x3ae8f1['voicePause']){logger[_0xe7fb('0x21')](_0xe7fb('0x22'),_0x559129,_0x18d23c,_0x562262);var _0x5da3d9=_0x12fff6['channels'][_0x559129]['attended']&&_0x12fff6[_0xe7fb('0x9')][_0x559129]['destlinkedid']?_0x12fff6['channels'][_0x559129][_0xe7fb('0x23')]:_0x559129;return RpcUser[_0xe7fb('0x24')](_0x12fff6[_0xe7fb('0x7')][_0x18d23c],_0x4708f7,_0x5da3d9)['then'](function(_0x6c930){if(!_0x1e77fd){_0x12fff6[_0xe7fb('0x8')][_0x18d23c]={};logger[_0xe7fb('0x21')](_0xe7fb('0x25'),_0x559129,_0x12fff6[_0xe7fb('0x6')][_0x562262][_0xe7fb('0x26')],_0x18d23c,_0x562262);_0x12fff6[_0xe7fb('0x8')][_0x18d23c]['timer']=setTimeout(_0x12fff6['stopAcw'][_0xe7fb('0xb')](_0x12fff6,_0x18d23c),_0x12fff6[_0xe7fb('0x6')][_0x562262][_0xe7fb('0x26')]*0x3e8);_0x12fff6['timers'][_0x18d23c][_0xe7fb('0x27')]=moment()[_0xe7fb('0x28')](_0xe7fb('0x29'));_0x12fff6[_0xe7fb('0x8')][_0x18d23c][_0xe7fb('0x2a')]=_0x559129;_0x12fff6[_0xe7fb('0x8')][_0x18d23c][_0xe7fb('0x2b')]=_0x562262;_0x12fff6[_0xe7fb('0x8')][_0x18d23c]['updateAcw']=function(){var _0x3d1fb5=getDiff(_0x12fff6[_0xe7fb('0x8')][_0x18d23c][_0xe7fb('0x27')]);clearTimeout(_0x12fff6['timers'][_0x18d23c]['timer']);_0x12fff6[_0xe7fb('0x8')][_0x18d23c]['timer']=![];RpcVoiceAgentReport[_0xe7fb('0x2c')]({'acwtime':_0x3d1fb5},_0x12fff6[_0xe7fb('0x8')][_0x18d23c][_0xe7fb('0x2a')],_0x18d23c)[_0xe7fb('0x20')](function(_0x556368){logger[_0xe7fb('0x21')](_0xe7fb('0x2d'),_0x559129,_0x3d1fb5,_0x556368);})[_0xe7fb('0x2e')](function(_0x2f8818){logger[_0xe7fb('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x559129,_0x2f8818);});delete _0x12fff6[_0xe7fb('0x8')][_0x18d23c];};}});}else{logger[_0xe7fb('0x21')](_0xe7fb('0x30'),_0x559129,_0x18d23c,_0x562262);}});}})[_0xe7fb('0x2e')](function(_0x46f430){logger[_0xe7fb('0x2f')](_0xe7fb('0x25'),_0x559129,_0x12fff6[_0xe7fb('0x6')][_0x562262][_0xe7fb('0x26')],_0x18d23c,_0x562262);})['finally'](function(){delete _0x12fff6[_0xe7fb('0x9')][_0x559129];});}catch(_0x29ef52){logger[_0xe7fb('0x2f')]('[ACW][START]\x20%s',_0x29ef52[_0xe7fb('0x31')]);}};Acw[_0xe7fb('0x32')][_0xe7fb('0x33')]=function(_0x1530b1){try{var _0x402ca3=this;if(_0x402ca3[_0xe7fb('0x8')][_0x1530b1]){_0x402ca3[_0xe7fb('0x8')][_0x1530b1][_0xe7fb('0x34')]=![];var _0x195c35=_0x402ca3[_0xe7fb('0x8')][_0x1530b1][_0xe7fb('0x2a')];var _0x3c4f4b=_0x402ca3[_0xe7fb('0x8')][_0x1530b1][_0xe7fb('0x2b')];var _0xeb7c29=_0x402ca3[_0xe7fb('0x6')][_0x3c4f4b][_0xe7fb('0x26')];logger[_0xe7fb('0x21')](_0xe7fb('0x35'),_0x1530b1);RpcUser['saveUnpause'](this[_0xe7fb('0x7')][_0x1530b1]);RpcVoiceAgentReport[_0xe7fb('0x2c')]({'acwtime':_0xeb7c29,'agentacw':!![]},_0x195c35,_0x1530b1)[_0xe7fb('0x20')](function(_0x444f98){logger['info'](_0xe7fb('0x2d'),_0x195c35,_0xeb7c29,_0x444f98);})[_0xe7fb('0x2e')](function(_0xd472d){logger[_0xe7fb('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x195c35,_0xd472d);});}else{logger[_0xe7fb('0x2f')](_0xe7fb('0x36'),_0x1530b1);if(_0x402ca3[_0xe7fb('0x8')]){logger[_0xe7fb('0x21')](_0xe7fb('0x37'),JSON[_0xe7fb('0x38')](_0x402ca3['timers']));}}}catch(_0x4362c2){logger[_0xe7fb('0x2f')](_0xe7fb('0x39'),_0x4362c2['message']);}};Acw[_0xe7fb('0x32')][_0xe7fb('0xa')]=function(_0x5d42ac){try{if(this['voiceQueues'][_0x5d42ac['queue']]&&(this['voiceQueues'][_0x5d42ac['queue']][_0xe7fb('0x3')]||this[_0xe7fb('0x6')][_0x5d42ac[_0xe7fb('0x2b')]]['mandatoryDisposition'])){if(this[_0xe7fb('0x7')][_0x5d42ac['interface']]){this[_0xe7fb('0x9')][_0x5d42ac[_0xe7fb('0x2a')]]={'queue':_0x5d42ac['queue'],'interface':_0x5d42ac[_0xe7fb('0x1b')],'destlinkedid':_0x5d42ac[_0xe7fb('0x23')]};}}}catch(_0x240efa){logger[_0xe7fb('0x2f')]('[ACW][syncAgentConnect]\x20%s',_0x240efa[_0xe7fb('0x31')]);}};Acw[_0xe7fb('0x32')][_0xe7fb('0x16')]=function(_0x56a84f){try{if(this[_0xe7fb('0x6')][_0x56a84f[_0xe7fb('0x2b')]]&&(this[_0xe7fb('0x6')][_0x56a84f[_0xe7fb('0x2b')]][_0xe7fb('0x3')]||this['voiceQueues'][_0x56a84f[_0xe7fb('0x2b')]]['mandatoryDisposition'])){if(this[_0xe7fb('0x7')][_0x56a84f[_0xe7fb('0x1b')]]){this[_0xe7fb('0x9')][_0x56a84f[_0xe7fb('0x2a')]]={'queue':_0x56a84f[_0xe7fb('0x2b')],'interface':_0x56a84f['interface']};}}}catch(_0x364a0a){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x364a0a[_0xe7fb('0x31')]);}};Acw[_0xe7fb('0x32')][_0xe7fb('0xd')]=function(_0x589555){try{if(this[_0xe7fb('0x9')][_0x589555[_0xe7fb('0x2a')]]&&_['isUndefined'](this['channels'][_0x589555[_0xe7fb('0x2a')]][_0xe7fb('0x3a')])){logger[_0xe7fb('0x21')](_0xe7fb('0x3b'),_0x589555[_0xe7fb('0x2a')]);this[_0xe7fb('0x1a')](_0x589555[_0xe7fb('0x2a')]);}else if(this[_0xe7fb('0x9')][_0x589555['linkedid']]&&_[_0xe7fb('0x3c')](this['channels'][_0x589555[_0xe7fb('0x3d')]][_0xe7fb('0x3a')])){logger['info'](_0xe7fb('0x3e'),_0x589555['linkedid']);this[_0xe7fb('0x1a')](_0x589555['linkedid']);}}catch(_0x68e723){logger['error'](_0xe7fb('0x3f'),_0x68e723['message']);}};Acw[_0xe7fb('0x32')][_0xe7fb('0xe')]=function(_0x41fcfb){try{if(this[_0xe7fb('0x9')][_0x41fcfb[_0xe7fb('0x2a')]]&&this[_0xe7fb('0x9')][_0x41fcfb[_0xe7fb('0x2a')]]['attended']){logger['info'](_0xe7fb('0x40'),_0x41fcfb['uniqueid']);this['startAcw'](_0x41fcfb['uniqueid']);}else if(this['channels'][_0x41fcfb['linkedid']]&&this[_0xe7fb('0x9')][_0x41fcfb[_0xe7fb('0x3d')]][_0xe7fb('0x3a')]){logger[_0xe7fb('0x21')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x41fcfb[_0xe7fb('0x3d')]);this[_0xe7fb('0x1a')](_0x41fcfb[_0xe7fb('0x3d')]);}}catch(_0x4a9372){logger['error'](_0xe7fb('0x41'),_0x4a9372[_0xe7fb('0x31')]);}};Acw[_0xe7fb('0x32')]['syncAttendedTransfer']=function(_0x27f860){try{if(!_[_0xe7fb('0x42')](this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x43')]])){this['startAcw'](_0x27f860['transfereeuniqueid']);if(this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x44')]]){this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x44')]][_0xe7fb('0x3a')]=!![];this['channels'][_0x27f860[_0xe7fb('0x45')]]=this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x44')]];delete this['channels'][_0x27f860['secondtransfereruniqueid']];}}else if(!_[_0xe7fb('0x42')](this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x45')]])){this[_0xe7fb('0x1a')](_0x27f860[_0xe7fb('0x45')]);if(this[_0xe7fb('0x9')][_0x27f860['origtransfereruniqueid']]){this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x46')]][_0xe7fb('0x3a')]=!![];this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x43')]]=this[_0xe7fb('0x9')][_0x27f860['origtransfereruniqueid']];delete this[_0xe7fb('0x9')][_0x27f860['origtransfereruniqueid']];}}}catch(_0x1eda1d){logger[_0xe7fb('0x2f')](_0xe7fb('0x47'),_0x1eda1d[_0xe7fb('0x31')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x2789a4){try{if(this[_0xe7fb('0x9')][_0x2789a4[_0xe7fb('0x48')]]){logger[_0xe7fb('0x21')](_0xe7fb('0x49'),JSON['stringify'](_0x2789a4[_0xe7fb('0x48')]));this['startAcw'](_0x2789a4[_0xe7fb('0x48')]);}else if(this['channels'][_0x2789a4['transfererlinkedid']]){logger[_0xe7fb('0x21')](_0xe7fb('0x4a'),JSON[_0xe7fb('0x38')](_0x2789a4['transfererlinkedid']));this[_0xe7fb('0x1a')](_0x2789a4[_0xe7fb('0x4b')]);}}catch(_0x3401e0){logger[_0xe7fb('0x2f')](_0xe7fb('0x4c'),_0x3401e0['message']);}};Acw[_0xe7fb('0x32')][_0xe7fb('0x10')]=function(_0x5151ec){try{if(this[_0xe7fb('0x6')][_0x5151ec[_0xe7fb('0x2b')]]&&this['voiceQueues'][_0x5151ec[_0xe7fb('0x2b')]]['autopause']===_0xe7fb('0x4d')){if(this[_0xe7fb('0x7')][_0x5151ec[_0xe7fb('0x1b')]]){logger['info'](_0xe7fb('0x4e'),_0x5151ec[_0xe7fb('0x2a')],_0x5151ec[_0xe7fb('0x1b')],_0x5151ec[_0xe7fb('0x2b')]);return RpcUser[_0xe7fb('0x24')](this[_0xe7fb('0x7')][_0x5151ec[_0xe7fb('0x1b')]],_0xe7fb('0x4f'),_0x5151ec['uniqueid']);}}}catch(_0x497998){logger[_0xe7fb('0x2f')](_0xe7fb('0x50'),_0x497998[_0xe7fb('0x31')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 81d6c5d..0c850a1 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 _0x966b=['error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','log','exports','bluebird','lodash','../../config/logger','ami','../../config/environment','asterisk','port','keepConnected','Action','promisify','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect'];(function(_0x253b26,_0x11b62e){var _0x3ea3a0=function(_0x1a5cad){while(--_0x1a5cad){_0x253b26['push'](_0x253b26['shift']());}};_0x3ea3a0(++_0x11b62e);}(_0x966b,0xf6));var _0xb966=function(_0x3783be,_0x47a0bb){_0x3783be=_0x3783be-0x0;var _0x3af1dc=_0x966b[_0x3783be];return _0x3af1dc;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xb966('0x0'));var moment=require('moment');var util=require('util');var _=require(_0xb966('0x1'));var logger=require(_0xb966('0x2'))(_0xb966('0x3'));var config=require(_0xb966('0x4'));var ami=new Manager(config[_0xb966('0x5')][_0xb966('0x6')],config['asterisk']['ip'],config['asterisk']['username'],config[_0xb966('0x5')]['password'],!![]);ami[_0xb966('0x7')]();ami[_0xb966('0x8')]=BPromise[_0xb966('0x9')](ami['action']);function error(_0x122284){logger['error'](util[_0xb966('0xa')](_0xb966('0xb'),config[_0xb966('0x5')]['username'],config[_0xb966('0x5')]['ip'],config[_0xb966('0x5')][_0xb966('0x6')],util[_0xb966('0xc')](_0x122284,![],null)));}function close(){logger[_0xb966('0xd')](util[_0xb966('0xa')](_0xb966('0xe'),config[_0xb966('0x5')][_0xb966('0xf')],config[_0xb966('0x5')]['ip'],config[_0xb966('0x5')][_0xb966('0x6')]));}ami[_0xb966('0x10')]=function(){return function(){return ami[_0xb966('0x8')]({'action':_0xb966('0x11')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xb966('0x8')]({'action':_0xb966('0x12')});};};ami[_0xb966('0x13')]=function(){return function(){return ami[_0xb966('0x8')]({'action':'sippeerstatus'});};};ami[_0xb966('0x14')]=function(){return function(){return ami[_0xb966('0x8')]({'action':'queuesummary'});};};ami[_0xb966('0x15')]=function(){return function(){return ami['Action']({'action':_0xb966('0x16')});};};function connect(_0x423a81){logger[_0xb966('0x17')](util[_0xb966('0xa')](_0xb966('0x18'),config[_0xb966('0x5')][_0xb966('0xf')],config[_0xb966('0x5')]['ip'],config[_0xb966('0x5')][_0xb966('0x6')]));ami[_0xb966('0x19')](_0xb966('0xd'),error);ami[_0xb966('0x19')](_0xb966('0x1a'),close);}ami['on'](_0xb966('0x1b'),connect);ami['on'](_0xb966('0x1c'),function(_0x38acca){logger[_0xb966('0x17')](util[_0xb966('0xa')](_0xb966('0x1d'),config['asterisk']['username'],config[_0xb966('0x5')]['ip'],config[_0xb966('0x5')][_0xb966('0x6')],util[_0xb966('0xc')](_0x38acca,![],null)));});ami['on'](_0xb966('0x1e'),function(_0xfae334){logger['info'](util['format'](_0xb966('0x1f'),config[_0xb966('0x5')][_0xb966('0xf')],config[_0xb966('0x5')]['ip'],config[_0xb966('0x5')][_0xb966('0x6')]));return BPromise[_0xb966('0x20')]()[_0xb966('0x21')](ami[_0xb966('0x10')]())[_0xb966('0x21')](ami[_0xb966('0x22')]())[_0xb966('0x21')](ami[_0xb966('0x13')]())[_0xb966('0x21')](ami[_0xb966('0x14')]())[_0xb966('0x21')](ami[_0xb966('0x15')]())['catch'](function(_0x12d45b){console[_0xb966('0x23')](_0x12d45b);});});ami[_0xb966('0x19')](_0xb966('0xd'),error);ami['once'](_0xb966('0x1a'),close);module[_0xb966('0x24')]=ami; \ No newline at end of file +var _0x0e41=['asterisk','port','password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','error','actionSipShowRegistry','sipshowregistry','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','resolve','then','actionDeviceStateList','catch','close','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','ami','../../config/environment'];(function(_0x32dcc4,_0x208540){var _0x25742f=function(_0x4bb3c7){while(--_0x4bb3c7){_0x32dcc4['push'](_0x32dcc4['shift']());}};_0x25742f(++_0x208540);}(_0x0e41,0x19b));var _0x10e4=function(_0x69cb63,_0x4f1a7a){_0x69cb63=_0x69cb63-0x0;var _0x49f16c=_0x0e41[_0x69cb63];return _0x49f16c;};'use strict';var Manager=require(_0x10e4('0x0'));var BPromise=require(_0x10e4('0x1'));var moment=require(_0x10e4('0x2'));var util=require('util');var _=require(_0x10e4('0x3'));var logger=require(_0x10e4('0x4'))(_0x10e4('0x5'));var config=require(_0x10e4('0x6'));var ami=new Manager(config[_0x10e4('0x7')][_0x10e4('0x8')],config[_0x10e4('0x7')]['ip'],config[_0x10e4('0x7')]['username'],config[_0x10e4('0x7')][_0x10e4('0x9')],!![]);ami[_0x10e4('0xa')]();ami[_0x10e4('0xb')]=BPromise[_0x10e4('0xc')](ami[_0x10e4('0xd')]);function error(_0x4e6aeb){logger['error'](util[_0x10e4('0xe')](_0x10e4('0xf'),config[_0x10e4('0x7')][_0x10e4('0x10')],config[_0x10e4('0x7')]['ip'],config[_0x10e4('0x7')][_0x10e4('0x8')],util['inspect'](_0x4e6aeb,![],null)));}function close(){logger[_0x10e4('0x11')](util[_0x10e4('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x10e4('0x7')][_0x10e4('0x10')],config[_0x10e4('0x7')]['ip'],config[_0x10e4('0x7')]['port']));}ami[_0x10e4('0x12')]=function(){return function(){return ami[_0x10e4('0xb')]({'action':_0x10e4('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x10e4('0x14')]=function(){return function(){return ami[_0x10e4('0xb')]({'action':_0x10e4('0x15')});};};ami[_0x10e4('0x16')]=function(){return function(){return ami[_0x10e4('0xb')]({'action':_0x10e4('0x17')});};};ami[_0x10e4('0x18')]=function(){return function(){return ami[_0x10e4('0xb')]({'action':_0x10e4('0x19')});};};function connect(_0x397cd8){logger[_0x10e4('0x1a')](util[_0x10e4('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x10e4('0x10')],config['asterisk']['ip'],config[_0x10e4('0x7')]['port']));ami[_0x10e4('0x1b')](_0x10e4('0x11'),error);ami[_0x10e4('0x1b')]('close',close);}ami['on']('connect',connect);ami['on'](_0x10e4('0x1c'),function(_0x737229){logger[_0x10e4('0x1a')](util[_0x10e4('0xe')](_0x10e4('0x1d'),config[_0x10e4('0x7')]['username'],config[_0x10e4('0x7')]['ip'],config[_0x10e4('0x7')][_0x10e4('0x8')],util[_0x10e4('0x1e')](_0x737229,![],null)));});ami['on'](_0x10e4('0x1f'),function(_0x3d7484){logger['info'](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x10e4('0x7')][_0x10e4('0x10')],config[_0x10e4('0x7')]['ip'],config[_0x10e4('0x7')][_0x10e4('0x8')]));return BPromise[_0x10e4('0x20')]()[_0x10e4('0x21')](ami[_0x10e4('0x12')]())['then'](ami[_0x10e4('0x22')]())[_0x10e4('0x21')](ami[_0x10e4('0x14')]())[_0x10e4('0x21')](ami[_0x10e4('0x16')]())[_0x10e4('0x21')](ami[_0x10e4('0x18')]())[_0x10e4('0x23')](function(_0xb0772){console['log'](_0xb0772);});});ami[_0x10e4('0x1b')](_0x10e4('0x11'),error);ami[_0x10e4('0x1b')](_0x10e4('0x24'),close);module[_0x10e4('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 408dd49..1599615 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 _0xc68e=['rpc','message','result','catch','exports','jayson/promise','../../config/logger','ami','client','request','then','debug','memberReport','error'];(function(_0x49d55b,_0x439332){var _0x459027=function(_0x1cd626){while(--_0x1cd626){_0x49d55b['push'](_0x49d55b['shift']());}};_0x459027(++_0x439332);}(_0xc68e,0x91));var _0xec68=function(_0x5e0c27,_0xfe9ee0){_0x5e0c27=_0x5e0c27-0x0;var _0x495393=_0xc68e[_0x5e0c27];return _0x495393;};'use strict';var jayson=require(_0xec68('0x0'));var BPromise=require('bluebird');var logger=require(_0xec68('0x1'))(_0xec68('0x2'));var client=jayson[_0xec68('0x3')]['http']({'port':0x2329});client['Request']=function(_0x413a1c,_0x32db43){return new BPromise(function(_0x189a71,_0x592d1a){return client[_0xec68('0x4')](_0x413a1c,_0x32db43)[_0xec68('0x5')](function(_0x14b3fa){logger[_0xec68('0x6')]('rpc',_0xec68('0x7'),_0x413a1c,_0x32db43,_0x14b3fa);if(_0x14b3fa[_0xec68('0x8')]){logger['error'](_0xec68('0x9'),_0xec68('0x7'),_0x413a1c,_0x14b3fa['error'][_0xec68('0xa')],_0x32db43);return _0x592d1a(_0x14b3fa['error'][_0xec68('0xa')]);}else{return _0x189a71(_0x14b3fa[_0xec68('0xb')]);}})[_0xec68('0xc')](function(_0x4c5d39){logger['error'](_0xec68('0x9'),_0xec68('0x7'),_0x413a1c,_0x4c5d39,_0x32db43);return _0x592d1a(_0x4c5d39);});});};module[_0xec68('0xd')]=client; \ No newline at end of file +var _0x302f=['rpc','memberReport','message','result','catch','exports','jayson/promise','../../config/logger','ami','client','http','Request','debug','error'];(function(_0x3713f0,_0x5882ff){var _0x2429ec=function(_0x38041a){while(--_0x38041a){_0x3713f0['push'](_0x3713f0['shift']());}};_0x2429ec(++_0x5882ff);}(_0x302f,0xe6));var _0xf302=function(_0x48136b,_0x4b0271){_0x48136b=_0x48136b-0x0;var _0x6a7aa5=_0x302f[_0x48136b];return _0x6a7aa5;};'use strict';var jayson=require(_0xf302('0x0'));var BPromise=require('bluebird');var logger=require(_0xf302('0x1'))(_0xf302('0x2'));var client=jayson[_0xf302('0x3')][_0xf302('0x4')]({'port':0x2329});client[_0xf302('0x5')]=function(_0x2ad8c4,_0x2a5abf){return new BPromise(function(_0x4093e1,_0x2cdacf){return client['request'](_0x2ad8c4,_0x2a5abf)['then'](function(_0x5e5f7e){logger[_0xf302('0x6')]('rpc','memberReport',_0x2ad8c4,_0x2a5abf,_0x5e5f7e);if(_0x5e5f7e[_0xf302('0x7')]){logger[_0xf302('0x7')](_0xf302('0x8'),_0xf302('0x9'),_0x2ad8c4,_0x5e5f7e[_0xf302('0x7')][_0xf302('0xa')],_0x2a5abf);return _0x2cdacf(_0x5e5f7e['error'][_0xf302('0xa')]);}else{return _0x4093e1(_0x5e5f7e[_0xf302('0xb')]);}})[_0xf302('0xc')](function(_0x41bc60){logger[_0xf302('0x7')](_0xf302('0x8'),'memberReport',_0x2ad8c4,_0x41bc60,_0x2a5abf);return _0x2cdacf(_0x41bc60);});});};module[_0xf302('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 6cf9314..3c56020 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 _0xc4e6=['callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','voiceQueue','substring','dialCutDigit','getQueue','exports','util','lodash','string','isNil','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback'];(function(_0x3432ca,_0x77ca){var _0x450277=function(_0x331cb6){while(--_0x331cb6){_0x3432ca['push'](_0x3432ca['shift']());}};_0x450277(++_0x77ca);}(_0xc4e6,0x1d9));var _0x6c4e=function(_0x545a3a,_0x3123aa){_0x545a3a=_0x545a3a-0x0;var _0x5a5493=_0xc4e6[_0x545a3a];return _0x5a5493;};'use strict';var util=require(_0x6c4e('0x0'));var _=require(_0x6c4e('0x1'));var moment=require('moment');function checkNameSurname(_0x79153b,_0x1b3896,_0x86fe20){var _0x399a44='';if(!_['isNil'](_0x1b3896)&&_0x6c4e('0x2')===typeof _0x1b3896){_0x399a44+=_0x1b3896;}if(!_[_0x6c4e('0x3')](_0x86fe20)&&_0x6c4e('0x2')===typeof _0x86fe20){_0x399a44+='\x20'+_0x86fe20;}if(_0x399a44!==''){return _0x399a44;}return _0x79153b;}function Action(_0x5d8d70,_0x266061,_0x587927){this['voiceQueue']=_0x5d8d70;this[_0x6c4e('0x4')]=_0x587927||undefined;this[_0x6c4e('0x5')]=checkNameSurname(_0x266061[_0x6c4e('0x6')][_0x6c4e('0x7')],_0x266061[_0x6c4e('0x6')][_0x6c4e('0x8')],_0x266061[_0x6c4e('0x6')][_0x6c4e('0x9')]);this[_0x6c4e('0xa')]=_0x266061[_0x6c4e('0x6')][_0x6c4e('0x7')];this[_0x6c4e('0xb')]=_0x5d8d70['name'];this['active']=_0x266061[_0x6c4e('0xc')]||![];this[_0x6c4e('0xd')]=_0x5d8d70[_0x6c4e('0xd')];this['dialQueueTimeout']=_0x5d8d70[_0x6c4e('0xe')]||0x3;this[_0x6c4e('0xf')]=_0x266061[_0x6c4e('0xf')];this[_0x6c4e('0x10')]=_0x266061['countbusyretry'];this[_0x6c4e('0x11')]=_0x266061[_0x6c4e('0x11')];this[_0x6c4e('0x12')]=_0x266061[_0x6c4e('0x12')];this[_0x6c4e('0x13')]=_0x266061['countnosuchnumberretry'];this[_0x6c4e('0x14')]=_0x266061[_0x6c4e('0x14')];this[_0x6c4e('0x15')]=_0x266061['countabandonedretry'];this['countmachineretry']=_0x266061['countmachineretry'];this['countagentrejectretry']=_0x266061[_0x6c4e('0x16')];this[_0x6c4e('0x17')]=_0x266061[_0x6c4e('0x17')];this['ListId']=_0x266061[_0x6c4e('0x18')];this[_0x6c4e('0x19')]=_0x266061['UserId'];this[_0x6c4e('0x1a')]=_0x266061['VoiceQueueId'];this[_0x6c4e('0x1b')]=_0x266061[_0x6c4e('0x1b')];this[_0x6c4e('0x1c')]=_0x266061['id'];this[_0x6c4e('0x1d')]=_0x266061['Contact'][_0x6c4e('0x8')]||'';this[_0x6c4e('0x1e')]=moment()['format'](_0x6c4e('0x1f'));this[_0x6c4e('0x20')]=_0x266061[_0x6c4e('0x20')];this[_0x6c4e('0x21')]=_0x266061[_0x6c4e('0x21')];this['callbackat']=_0x266061[_0x6c4e('0x22')];this[_0x6c4e('0x23')]=_0x266061['recallme'];this['originatecalleridnum']='';this[_0x6c4e('0x24')]='';}Action[_0x6c4e('0x25')][_0x6c4e('0x26')]=function(){return util[_0x6c4e('0x27')](_0x6c4e('0x28'),this[_0x6c4e('0x5')],this[_0x6c4e('0x29')]['dialCutDigit']>0x0?this[_0x6c4e('0xa')][_0x6c4e('0x2a')](this[_0x6c4e('0x29')][_0x6c4e('0x2b')]):this['number']);};Action[_0x6c4e('0x25')][_0x6c4e('0x2c')]=function(){return this[_0x6c4e('0xb')];};module[_0x6c4e('0x2d')]=Action; \ No newline at end of file +var _0x235a=['recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','queue','exports','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','number','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat'];(function(_0x1e15cc,_0x557934){var _0x3dd903=function(_0x38e380){while(--_0x38e380){_0x1e15cc['push'](_0x1e15cc['shift']());}};_0x3dd903(++_0x557934);}(_0x235a,0x1ef));var _0xa235=function(_0x4bcd5e,_0x93125){_0x4bcd5e=_0x4bcd5e-0x0;var _0x32dd5a=_0x235a[_0x4bcd5e];return _0x32dd5a;};'use strict';var util=require(_0xa235('0x0'));var _=require(_0xa235('0x1'));var moment=require(_0xa235('0x2'));function checkNameSurname(_0x49f946,_0x343afd,_0x52c3b3){var _0x3ae786='';if(!_[_0xa235('0x3')](_0x343afd)&&_0xa235('0x4')===typeof _0x343afd){_0x3ae786+=_0x343afd;}if(!_[_0xa235('0x3')](_0x52c3b3)&&_0xa235('0x4')===typeof _0x52c3b3){_0x3ae786+='\x20'+_0x52c3b3;}if(_0x3ae786!==''){return _0x3ae786;}return _0x49f946;}function Action(_0x5e94b0,_0x2961c8,_0x1707fc){this['voiceQueue']=_0x5e94b0;this[_0xa235('0x5')]=_0x1707fc||undefined;this[_0xa235('0x6')]=checkNameSurname(_0x2961c8[_0xa235('0x7')][_0xa235('0x8')],_0x2961c8['Contact'][_0xa235('0x9')],_0x2961c8['Contact']['lastName']);this[_0xa235('0xa')]=_0x2961c8['Contact'][_0xa235('0x8')];this['queue']=_0x5e94b0['name'];this['active']=_0x2961c8[_0xa235('0xb')]||![];this[_0xa235('0xc')]=_0x5e94b0[_0xa235('0xc')];this[_0xa235('0xd')]=_0x5e94b0['dialQueueTimeout']||0x3;this['scheduledat']=_0x2961c8['scheduledat'];this[_0xa235('0xe')]=_0x2961c8[_0xa235('0xe')];this[_0xa235('0xf')]=_0x2961c8[_0xa235('0xf')];this[_0xa235('0x10')]=_0x2961c8[_0xa235('0x10')];this[_0xa235('0x11')]=_0x2961c8[_0xa235('0x11')];this[_0xa235('0x12')]=_0x2961c8['countdropretry'];this[_0xa235('0x13')]=_0x2961c8[_0xa235('0x13')];this[_0xa235('0x14')]=_0x2961c8[_0xa235('0x14')];this[_0xa235('0x15')]=_0x2961c8[_0xa235('0x15')];this['ContactId']=_0x2961c8['ContactId'];this[_0xa235('0x16')]=_0x2961c8[_0xa235('0x16')];this[_0xa235('0x17')]=_0x2961c8['UserId'];this[_0xa235('0x18')]=_0x2961c8[_0xa235('0x18')];this[_0xa235('0x19')]=_0x2961c8[_0xa235('0x19')];this[_0xa235('0x1a')]=_0x2961c8['id'];this[_0xa235('0x1b')]=_0x2961c8[_0xa235('0x7')]['firstName']||'';this['starttime']=moment()[_0xa235('0x1c')](_0xa235('0x1d'));this[_0xa235('0x1e')]=_0x2961c8[_0xa235('0x1e')];this[_0xa235('0x1f')]=_0x2961c8[_0xa235('0x1f')];this[_0xa235('0x20')]=_0x2961c8[_0xa235('0x20')];this[_0xa235('0x21')]=_0x2961c8[_0xa235('0x21')];this[_0xa235('0x22')]='';this[_0xa235('0x23')]='';}Action[_0xa235('0x24')][_0xa235('0x25')]=function(){return util[_0xa235('0x1c')](_0xa235('0x26'),this[_0xa235('0x6')],this[_0xa235('0x27')][_0xa235('0x28')]>0x0?this[_0xa235('0xa')][_0xa235('0x29')](this['voiceQueue'][_0xa235('0x28')]):this['number']);};Action[_0xa235('0x24')]['getQueue']=function(){return this[_0xa235('0x2a')];};module[_0xa235('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index e882330..43a7c4b 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x030e=['responsetime','endtime','ringtime','starttime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countbusyretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','calleridname','name','calleridnum','number'];(function(_0x4dc3c2,_0x11e73e){var _0x31f644=function(_0x2f501e){while(--_0x2f501e){_0x4dc3c2['push'](_0x4dc3c2['shift']());}};_0x31f644(++_0x11e73e);}(_0x030e,0x1bd));var _0xe030=function(_0x44bb29,_0x41924e){_0x44bb29=_0x44bb29-0x0;var _0x2e34fd=_0x030e[_0x44bb29];return _0x2e34fd;};'use strict';var util=require(_0xe030('0x0'));var _=require(_0xe030('0x1'));var moment=require(_0xe030('0x2'));function getSeconds(_0x25c19f,_0x518ea9){var _0x498190=moment(_0x25c19f)['milliseconds'](0x0);var _0xc68663=moment(_0x518ea9)[_0xe030('0x3')](0x0);return _0x498190[_0xe030('0x4')](_0xc68663,_0xe030('0x5'));}function AdditionalPhone(_0x8be6af){this[_0xe030('0x6')]=_0x8be6af['uniqueid'];this['scheduledat']=_0x8be6af['scheduledat']||undefined;this['type']=_0x8be6af[_0xe030('0x7')];this[_0xe030('0x8')]=_0x8be6af[_0xe030('0x7')]===_0xe030('0x9')?_0xe030('0xa'):_0x8be6af[_0xe030('0x7')];this['countbusyretry']=_0x8be6af['countbusyretry'];this[_0xe030('0xb')]=_0x8be6af['countcongestionretry'];this[_0xe030('0xc')]=_0x8be6af[_0xe030('0xc')];this['countglobal']=_0x8be6af[_0xe030('0xd')]+_0x8be6af[_0xe030('0xb')]+_0x8be6af[_0xe030('0xc')]+_0x8be6af['countnosuchnumberretry']+_0x8be6af['countdropretry']+_0x8be6af['countabandonedretry']+_0x8be6af[_0xe030('0xe')]+_0x8be6af[_0xe030('0xf')];this[_0xe030('0x10')]=_0x8be6af[_0xe030('0x10')];this[_0xe030('0x11')]=_0x8be6af['countdropretry'];this['countabandonedretry']=_0x8be6af[_0xe030('0x12')];this['countmachineretry']=_0x8be6af[_0xe030('0xe')];this[_0xe030('0xf')]=_0x8be6af[_0xe030('0xf')];this['queue']=_0x8be6af['queue'];this[_0xe030('0x13')]=_0x8be6af[_0xe030('0x14')];this[_0xe030('0x15')]=_0x8be6af[_0xe030('0x16')];this['starttime']=_0x8be6af['starttime'];this[_0xe030('0x17')]=_0x8be6af[_0xe030('0x17')];this[_0xe030('0x18')]=_0x8be6af['responsetime'];this[_0xe030('0x19')]=getSeconds(_0x8be6af[_0xe030('0x17')],_0x8be6af[_0xe030('0x1a')]);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0x8be6af[_0xe030('0x1b')];this[_0xe030('0x1c')]=_0x8be6af[_0xe030('0x1c')];this[_0xe030('0x1d')]=_0x8be6af[_0xe030('0x1d')];this[_0xe030('0x1e')]=_0x8be6af[_0xe030('0x1e')];this[_0xe030('0x1f')]=_0x8be6af['ContactId'];this['ListId']=_0x8be6af[_0xe030('0x20')];this['UserId']=_0x8be6af[_0xe030('0x21')];this[_0xe030('0x22')]=_0x8be6af['VoiceQueueId'];this['CampaignId']=_0x8be6af[_0xe030('0x23')];this[_0xe030('0x24')]=_0x8be6af['originatecalleridnum']||'';this['originatecalleridname']=_0x8be6af[_0xe030('0x25')]||'';}module[_0xe030('0x26')]=History; \ No newline at end of file +var _0xab0a=['type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','diff','seconds','uniqueid','scheduledat'];(function(_0x3b0e0d,_0x327c39){var _0x155255=function(_0x487466){while(--_0x487466){_0x3b0e0d['push'](_0x3b0e0d['shift']());}};_0x155255(++_0x327c39);}(_0xab0a,0x150));var _0xaab0=function(_0x415937,_0x484161){_0x415937=_0x415937-0x0;var _0x456f05=_0xab0a[_0x415937];return _0x456f05;};'use strict';var util=require(_0xaab0('0x0'));var _=require('lodash');var moment=require(_0xaab0('0x1'));function getSeconds(_0x1fea44,_0x439e82){var _0xc346d9=moment(_0x1fea44)['milliseconds'](0x0);var _0x2e7e36=moment(_0x439e82)['milliseconds'](0x0);return _0xc346d9[_0xaab0('0x2')](_0x2e7e36,_0xaab0('0x3'));}function AdditionalPhone(_0x38e061){this[_0xaab0('0x4')]=_0x38e061['uniqueid'];this[_0xaab0('0x5')]=_0x38e061[_0xaab0('0x5')]||undefined;this[_0xaab0('0x6')]=_0x38e061['type'];this[_0xaab0('0x7')]=_0x38e061[_0xaab0('0x6')]==='outbound'?_0xaab0('0x8'):_0x38e061['type'];this['countbusyretry']=_0x38e061[_0xaab0('0x9')];this[_0xaab0('0xa')]=_0x38e061['countcongestionretry'];this[_0xaab0('0xb')]=_0x38e061['countnoanswerretry'];this[_0xaab0('0xc')]=_0x38e061[_0xaab0('0x9')]+_0x38e061['countcongestionretry']+_0x38e061[_0xaab0('0xb')]+_0x38e061['countnosuchnumberretry']+_0x38e061['countdropretry']+_0x38e061[_0xaab0('0xd')]+_0x38e061[_0xaab0('0xe')]+_0x38e061[_0xaab0('0xf')];this['countnosuchnumberretry']=_0x38e061[_0xaab0('0x10')];this[_0xaab0('0x11')]=_0x38e061[_0xaab0('0x11')];this[_0xaab0('0xd')]=_0x38e061[_0xaab0('0xd')];this[_0xaab0('0xe')]=_0x38e061['countmachineretry'];this['countagentrejectretry']=_0x38e061['countagentrejectretry'];this['queue']=_0x38e061[_0xaab0('0x8')];this[_0xaab0('0x12')]=_0x38e061[_0xaab0('0x13')];this[_0xaab0('0x14')]=_0x38e061[_0xaab0('0x15')];this[_0xaab0('0x16')]=_0x38e061[_0xaab0('0x16')];this[_0xaab0('0x17')]=_0x38e061[_0xaab0('0x17')];this[_0xaab0('0x18')]=_0x38e061[_0xaab0('0x17')];this['ringtime']=getSeconds(_0x38e061[_0xaab0('0x17')],_0x38e061['starttime']);this[_0xaab0('0x19')]=0x0;this[_0xaab0('0x1a')]=0x0;this[_0xaab0('0x1b')]=_0x38e061[_0xaab0('0x1b')];this[_0xaab0('0x1c')]=_0x38e061[_0xaab0('0x1c')];this['callbackat']=_0x38e061['callbackat'];this[_0xaab0('0x1d')]=_0x38e061['recallme'];this[_0xaab0('0x1e')]=_0x38e061['ContactId'];this[_0xaab0('0x1f')]=_0x38e061[_0xaab0('0x1f')];this[_0xaab0('0x20')]=_0x38e061[_0xaab0('0x20')];this['VoiceQueueId']=_0x38e061[_0xaab0('0x21')];this[_0xaab0('0x22')]=_0x38e061[_0xaab0('0x22')];this[_0xaab0('0x23')]=_0x38e061[_0xaab0('0x23')]||'';this[_0xaab0('0x24')]=_0x38e061[_0xaab0('0x24')]||'';}module[_0xaab0('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 6c8b46d..bf23a87 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 _0x5c8e=['uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5c8e,0xbb));var _0xe5c8=function(_0xa43ffe,_0x3999c7){_0xa43ffe=_0xa43ffe-0x0;var _0x1df04b=_0x5c8e[_0xa43ffe];return _0x1df04b;};'use strict';var util=require(_0xe5c8('0x0'));var _=require(_0xe5c8('0x1'));var moment=require(_0xe5c8('0x2'));function getSeconds(_0x1f81bb,_0xb95295){var _0x30510b=moment(_0x1f81bb)['milliseconds'](0x0);var _0x57d39a=moment(_0xb95295)[_0xe5c8('0x3')](0x0);return _0x30510b['diff'](_0x57d39a,_0xe5c8('0x4'));}function AgentComplete(_0x15cb32,_0x5c6b2a){this[_0xe5c8('0x5')]=0x4;this['statedesc']='Answer';this['scheduledat']=_0x15cb32[_0xe5c8('0x6')];this[_0xe5c8('0x7')]=_0x15cb32['type'];this[_0xe5c8('0x8')]=_0x15cb32[_0xe5c8('0x7')]===_0xe5c8('0x9')?_0xe5c8('0xa'):_0x15cb32[_0xe5c8('0x7')];this['countbusyretry']=_0x15cb32[_0xe5c8('0xb')];this[_0xe5c8('0xc')]=_0x15cb32['countcongestionretry'];this['countnoanswerretry']=_0x15cb32[_0xe5c8('0xd')];this['countglobal']=_0x15cb32[_0xe5c8('0xb')]+_0x15cb32[_0xe5c8('0xc')]+_0x15cb32[_0xe5c8('0xd')]+_0x15cb32[_0xe5c8('0xe')]+_0x15cb32['countdropretry']+_0x15cb32[_0xe5c8('0xf')]+_0x15cb32[_0xe5c8('0x10')]+_0x15cb32[_0xe5c8('0x11')];this[_0xe5c8('0xe')]=_0x15cb32[_0xe5c8('0xe')];this['countdropretry']=_0x15cb32['countdropretry'];this['countabandonedretry']=_0x15cb32[_0xe5c8('0xf')];this[_0xe5c8('0x10')]=_0x15cb32['countmachineretry'];this[_0xe5c8('0x11')]=_0x15cb32[_0xe5c8('0x11')];this[_0xe5c8('0x12')]=_0x5c6b2a[_0xe5c8('0x12')];this[_0xe5c8('0x13')]=_0x15cb32[_0xe5c8('0x14')];this[_0xe5c8('0x15')]=_0x15cb32['number'];this['starttime']=_0x15cb32[_0xe5c8('0x16')];this[_0xe5c8('0x17')]=_0x15cb32[_0xe5c8('0x17')];this['answertime']=_0x15cb32[_0xe5c8('0x18')];this[_0xe5c8('0x19')]=moment()['format'](_0xe5c8('0x1a'));this[_0xe5c8('0x1b')]=getSeconds(_0x15cb32['responsetime'],_0x15cb32[_0xe5c8('0x16')]);this[_0xe5c8('0x1c')]=getSeconds(_0x15cb32['answertime'],_0x15cb32[_0xe5c8('0x17')]);this['talktime']=getSeconds(this['endtime'],_0x15cb32[_0xe5c8('0x18')]);this['queue']=_0x5c6b2a['queue'];this['membername']=_0x5c6b2a['membername'];this[_0xe5c8('0x1d')]=_0x5c6b2a['reason'];this['callback']=_0x15cb32['callback'];this[_0xe5c8('0x1e')]=_0x15cb32[_0xe5c8('0x1e')];this['callbackat']=_0x15cb32[_0xe5c8('0x1f')];this[_0xe5c8('0x20')]=_0x15cb32[_0xe5c8('0x20')];this[_0xe5c8('0x21')]=_0x15cb32['ContactId'];this[_0xe5c8('0x22')]=_0x15cb32['ListId'];this[_0xe5c8('0x23')]=_0x15cb32[_0xe5c8('0x23')];this[_0xe5c8('0x24')]=_0x15cb32[_0xe5c8('0x24')];this[_0xe5c8('0x25')]=_0x15cb32[_0xe5c8('0x25')];this[_0xe5c8('0x26')]=_0x15cb32[_0xe5c8('0x26')]||'';this[_0xe5c8('0x27')]=_0x15cb32[_0xe5c8('0x27')]||'';}module[_0xe5c8('0x28')]=AgentComplete; \ No newline at end of file +var _0x436a=['ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x436a,0x1d2));var _0xa436=function(_0x86dc50,_0xb0c514){_0x86dc50=_0x86dc50-0x0;var _0x819ceb=_0x436a[_0x86dc50];return _0x819ceb;};'use strict';var util=require(_0xa436('0x0'));var _=require('lodash');var moment=require(_0xa436('0x1'));function getSeconds(_0x4af25f,_0x165b47){var _0x11a4fd=moment(_0x4af25f)[_0xa436('0x2')](0x0);var _0x186cfd=moment(_0x165b47)[_0xa436('0x2')](0x0);return _0x11a4fd['diff'](_0x186cfd,_0xa436('0x3'));}function AgentComplete(_0x1fe643,_0x3f7686){this['state']=0x4;this[_0xa436('0x4')]=_0xa436('0x5');this[_0xa436('0x6')]=_0x1fe643[_0xa436('0x6')];this['type']=_0x1fe643[_0xa436('0x7')];this['campaigntype']=_0x1fe643[_0xa436('0x7')]===_0xa436('0x8')?_0xa436('0x9'):_0x1fe643['type'];this['countbusyretry']=_0x1fe643[_0xa436('0xa')];this[_0xa436('0xb')]=_0x1fe643[_0xa436('0xb')];this[_0xa436('0xc')]=_0x1fe643[_0xa436('0xc')];this['countglobal']=_0x1fe643[_0xa436('0xa')]+_0x1fe643[_0xa436('0xb')]+_0x1fe643[_0xa436('0xc')]+_0x1fe643[_0xa436('0xd')]+_0x1fe643['countdropretry']+_0x1fe643['countabandonedretry']+_0x1fe643['countmachineretry']+_0x1fe643[_0xa436('0xe')];this[_0xa436('0xd')]=_0x1fe643['countnosuchnumberretry'];this[_0xa436('0xf')]=_0x1fe643[_0xa436('0xf')];this[_0xa436('0x10')]=_0x1fe643['countabandonedretry'];this[_0xa436('0x11')]=_0x1fe643['countmachineretry'];this[_0xa436('0xe')]=_0x1fe643[_0xa436('0xe')];this[_0xa436('0x12')]=_0x3f7686[_0xa436('0x12')];this[_0xa436('0x13')]=_0x1fe643[_0xa436('0x14')];this[_0xa436('0x15')]=_0x1fe643[_0xa436('0x16')];this[_0xa436('0x17')]=_0x1fe643[_0xa436('0x17')];this[_0xa436('0x18')]=_0x1fe643['responsetime'];this[_0xa436('0x19')]=_0x1fe643[_0xa436('0x19')];this[_0xa436('0x1a')]=moment()[_0xa436('0x1b')](_0xa436('0x1c'));this[_0xa436('0x1d')]=getSeconds(_0x1fe643['responsetime'],_0x1fe643['starttime']);this[_0xa436('0x1e')]=getSeconds(_0x1fe643[_0xa436('0x19')],_0x1fe643[_0xa436('0x18')]);this[_0xa436('0x1f')]=getSeconds(this[_0xa436('0x1a')],_0x1fe643['answertime']);this[_0xa436('0x9')]=_0x3f7686[_0xa436('0x9')];this[_0xa436('0x20')]=_0x3f7686['membername'];this[_0xa436('0x21')]=_0x3f7686[_0xa436('0x21')];this[_0xa436('0x22')]=_0x1fe643[_0xa436('0x22')];this[_0xa436('0x23')]=_0x1fe643['callbackuniqueid'];this[_0xa436('0x24')]=_0x1fe643[_0xa436('0x24')];this[_0xa436('0x25')]=_0x1fe643[_0xa436('0x25')];this['ContactId']=_0x1fe643[_0xa436('0x26')];this[_0xa436('0x27')]=_0x1fe643['ListId'];this[_0xa436('0x28')]=_0x1fe643['UserId'];this[_0xa436('0x29')]=_0x1fe643['VoiceQueueId'];this['CampaignId']=_0x1fe643['CampaignId'];this['originatecalleridnum']=_0x1fe643[_0xa436('0x2a')]||'';this['originatecalleridname']=_0x1fe643[_0xa436('0x2b')]||'';}module[_0xa436('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index f8ec490..4360b3d 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 _0x624e=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime'];(function(_0x40afbc,_0x2c0e71){var _0x11d3f3=function(_0x13b9e0){while(--_0x13b9e0){_0x40afbc['push'](_0x40afbc['shift']());}};_0x11d3f3(++_0x2c0e71);}(_0x624e,0x162));var _0xe624=function(_0x2aeaed,_0x11ef0c){_0x2aeaed=_0x2aeaed-0x0;var _0x352d69=_0x624e[_0x2aeaed];return _0x352d69;};'use strict';var util=require('util');var _=require(_0xe624('0x0'));var moment=require('moment');function getSeconds(_0x26188a,_0x44f2c1){var _0x2388bb=moment(_0x26188a)[_0xe624('0x1')](0x0);var _0x4506f9=moment(_0x44f2c1)['milliseconds'](0x0);return _0x2388bb[_0xe624('0x2')](_0x4506f9,_0xe624('0x3'));}function Final(_0x3cbf74){this[_0xe624('0x4')]=_0x3cbf74['uniqueid'];this[_0xe624('0x5')]=_0x3cbf74[_0xe624('0x5')];this[_0xe624('0x6')]=_0x3cbf74['type'];this[_0xe624('0x7')]=_0x3cbf74[_0xe624('0x6')]===_0xe624('0x8')?_0xe624('0x9'):_0x3cbf74[_0xe624('0x6')];this[_0xe624('0xa')]=_0x3cbf74[_0xe624('0xa')];this['countcongestionretry']=_0x3cbf74[_0xe624('0xb')];this[_0xe624('0xc')]=_0x3cbf74[_0xe624('0xc')];this[_0xe624('0xd')]=_0x3cbf74[_0xe624('0xa')]+_0x3cbf74['countcongestionretry']+_0x3cbf74[_0xe624('0xc')]+_0x3cbf74['countnosuchnumberretry']+_0x3cbf74[_0xe624('0xe')]+_0x3cbf74['countabandonedretry']+_0x3cbf74[_0xe624('0xf')]+_0x3cbf74['countagentrejectretry'];this['countnosuchnumberretry']=_0x3cbf74['countnosuchnumberretry'];this[_0xe624('0xe')]=_0x3cbf74['countdropretry'];this['countabandonedretry']=_0x3cbf74[_0xe624('0x10')];this[_0xe624('0xf')]=_0x3cbf74[_0xe624('0xf')];this[_0xe624('0x11')]=_0x3cbf74['countagentrejectretry'];this[_0xe624('0x9')]=_0x3cbf74[_0xe624('0x9')];this['calleridname']=_0x3cbf74[_0xe624('0x12')];this[_0xe624('0x13')]=_0x3cbf74[_0xe624('0x13')];this['starttime']=_0x3cbf74[_0xe624('0x14')];this[_0xe624('0x15')]=_0x3cbf74['responsetime'];this[_0xe624('0x16')]=_0x3cbf74['responsetime'];this[_0xe624('0x17')]=_0x3cbf74[_0xe624('0x17')]||0x0;this[_0xe624('0x18')]=_0x3cbf74[_0xe624('0x18')]||0x0;this[_0xe624('0x19')]=_0x3cbf74[_0xe624('0x19')]||0x0;this[_0xe624('0x1a')]=_0x3cbf74['callback'];this['callbackuniqueid']=_0x3cbf74[_0xe624('0x1b')];this[_0xe624('0x1c')]=_0x3cbf74[_0xe624('0x1c')];this[_0xe624('0x1d')]=_0x3cbf74[_0xe624('0x1d')];this[_0xe624('0x1e')]=_0x3cbf74['ContactId'];this[_0xe624('0x1f')]=_0x3cbf74[_0xe624('0x1f')];this[_0xe624('0x20')]=_0x3cbf74[_0xe624('0x20')];this[_0xe624('0x21')]=_0x3cbf74['VoiceQueueId'];this[_0xe624('0x22')]=_0x3cbf74[_0xe624('0x22')];this['originatecalleridnum']=_0x3cbf74[_0xe624('0x23')]||'';this['originatecalleridname']=_0x3cbf74[_0xe624('0x24')]||'';}module[_0xe624('0x25')]=Final; \ No newline at end of file +var _0xa1e4=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId'];(function(_0xb0454b,_0x56c432){var _0x38d907=function(_0x4d54c8){while(--_0x4d54c8){_0xb0454b['push'](_0xb0454b['shift']());}};_0x38d907(++_0x56c432);}(_0xa1e4,0x18a));var _0x4a1e=function(_0x29215d,_0x39143f){_0x29215d=_0x29215d-0x0;var _0x265037=_0xa1e4[_0x29215d];return _0x265037;};'use strict';var util=require(_0x4a1e('0x0'));var _=require(_0x4a1e('0x1'));var moment=require('moment');function getSeconds(_0xe764d4,_0x5a8cb){var _0x41a8de=moment(_0xe764d4)[_0x4a1e('0x2')](0x0);var _0x2cb06b=moment(_0x5a8cb)[_0x4a1e('0x2')](0x0);return _0x41a8de[_0x4a1e('0x3')](_0x2cb06b,_0x4a1e('0x4'));}function Final(_0xcfc160){this[_0x4a1e('0x5')]=_0xcfc160['uniqueid'];this[_0x4a1e('0x6')]=_0xcfc160[_0x4a1e('0x6')];this[_0x4a1e('0x7')]=_0xcfc160[_0x4a1e('0x7')];this[_0x4a1e('0x8')]=_0xcfc160[_0x4a1e('0x7')]===_0x4a1e('0x9')?_0x4a1e('0xa'):_0xcfc160[_0x4a1e('0x7')];this[_0x4a1e('0xb')]=_0xcfc160[_0x4a1e('0xb')];this[_0x4a1e('0xc')]=_0xcfc160[_0x4a1e('0xc')];this[_0x4a1e('0xd')]=_0xcfc160[_0x4a1e('0xd')];this[_0x4a1e('0xe')]=_0xcfc160[_0x4a1e('0xb')]+_0xcfc160[_0x4a1e('0xc')]+_0xcfc160[_0x4a1e('0xd')]+_0xcfc160[_0x4a1e('0xf')]+_0xcfc160['countdropretry']+_0xcfc160[_0x4a1e('0x10')]+_0xcfc160[_0x4a1e('0x11')]+_0xcfc160['countagentrejectretry'];this[_0x4a1e('0xf')]=_0xcfc160[_0x4a1e('0xf')];this[_0x4a1e('0x12')]=_0xcfc160['countdropretry'];this[_0x4a1e('0x10')]=_0xcfc160[_0x4a1e('0x10')];this['countmachineretry']=_0xcfc160[_0x4a1e('0x11')];this[_0x4a1e('0x13')]=_0xcfc160[_0x4a1e('0x13')];this['queue']=_0xcfc160[_0x4a1e('0xa')];this['calleridname']=_0xcfc160[_0x4a1e('0x14')];this[_0x4a1e('0x15')]=_0xcfc160[_0x4a1e('0x15')];this[_0x4a1e('0x16')]=_0xcfc160[_0x4a1e('0x16')];this[_0x4a1e('0x17')]=_0xcfc160[_0x4a1e('0x17')];this[_0x4a1e('0x18')]=_0xcfc160[_0x4a1e('0x17')];this[_0x4a1e('0x19')]=_0xcfc160[_0x4a1e('0x19')]||0x0;this[_0x4a1e('0x1a')]=_0xcfc160[_0x4a1e('0x1a')]||0x0;this[_0x4a1e('0x1b')]=_0xcfc160[_0x4a1e('0x1b')]||0x0;this[_0x4a1e('0x1c')]=_0xcfc160[_0x4a1e('0x1c')];this['callbackuniqueid']=_0xcfc160[_0x4a1e('0x1d')];this['callbackat']=_0xcfc160[_0x4a1e('0x1e')];this['recallme']=_0xcfc160[_0x4a1e('0x1f')];this[_0x4a1e('0x20')]=_0xcfc160[_0x4a1e('0x20')];this['ListId']=_0xcfc160['ListId'];this[_0x4a1e('0x21')]=_0xcfc160[_0x4a1e('0x21')];this[_0x4a1e('0x22')]=_0xcfc160[_0x4a1e('0x22')];this[_0x4a1e('0x23')]=_0xcfc160[_0x4a1e('0x23')];this[_0x4a1e('0x24')]=_0xcfc160['originatecalleridnum']||'';this[_0x4a1e('0x25')]=_0xcfc160[_0x4a1e('0x25')]||'';}module[_0x4a1e('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 8dc2ef6..9e4f119 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 _0x4359=['countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','IVR','reason','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countmachineretry'];(function(_0x4a64f5,_0x2ec027){var _0x3ce2eb=function(_0x504ae2){while(--_0x504ae2){_0x4a64f5['push'](_0x4a64f5['shift']());}};_0x3ce2eb(++_0x2ec027);}(_0x4359,0x1dd));var _0x9435=function(_0x703841,_0x52fe1b){_0x703841=_0x703841-0x0;var _0x5e9e58=_0x4359[_0x703841];return _0x5e9e58;};'use strict';var util=require(_0x9435('0x0'));var _=require(_0x9435('0x1'));var moment=require(_0x9435('0x2'));function getSeconds(_0x287f3f,_0x32e54f){var _0x3cac57=moment(_0x287f3f)[_0x9435('0x3')](0x0);var _0x3d9270=moment(_0x32e54f)['milliseconds'](0x0);return _0x3cac57[_0x9435('0x4')](_0x3d9270,_0x9435('0x5'));}function Hangup(_0x5d6843,_0xcc1f9d){this[_0x9435('0x6')]=0x4;this['statedesc']=_0x9435('0x7');this[_0x9435('0x8')]=_0x5d6843[_0x9435('0x8')];this[_0x9435('0x9')]=_0x5d6843['type'];this[_0x9435('0xa')]=_0x5d6843[_0x9435('0x9')]==='outbound'?_0x9435('0xb'):_0x5d6843[_0x9435('0x9')];this['countbusyretry']=_0x5d6843['countbusyretry'];this[_0x9435('0xc')]=_0x5d6843[_0x9435('0xc')];this[_0x9435('0xd')]=_0x5d6843[_0x9435('0xd')];this[_0x9435('0xe')]=_0x5d6843[_0x9435('0xf')]+_0x5d6843['countcongestionretry']+_0x5d6843[_0x9435('0xd')]+_0x5d6843['countnosuchnumberretry']+_0x5d6843[_0x9435('0x10')]+_0x5d6843['countabandonedretry']+_0x5d6843[_0x9435('0x11')]+_0x5d6843[_0x9435('0x12')];this[_0x9435('0x13')]=_0x5d6843[_0x9435('0x13')];this[_0x9435('0x10')]=_0x5d6843[_0x9435('0x10')];this[_0x9435('0x14')]=_0x5d6843[_0x9435('0x14')];this[_0x9435('0x11')]=_0x5d6843[_0x9435('0x11')];this[_0x9435('0x12')]=_0x5d6843[_0x9435('0x12')];this[_0x9435('0x15')]=_0xcc1f9d[_0x9435('0x15')];this[_0x9435('0x16')]=_0x5d6843[_0x9435('0x17')];this[_0x9435('0x18')]=_0x5d6843['number'];this['starttime']=_0x5d6843[_0x9435('0x19')];this[_0x9435('0x1a')]=_0x5d6843[_0x9435('0x1a')];this[_0x9435('0x1b')]=moment()[_0x9435('0x1c')](_0x9435('0x1d'));this[_0x9435('0x1e')]=getSeconds(_0x5d6843['responsetime'],_0x5d6843[_0x9435('0x19')]);this[_0x9435('0x1f')]=0x0;this['talktime']=getSeconds(this[_0x9435('0x1b')],_0x5d6843['responsetime']);this[_0x9435('0xb')]=_0x5d6843['queue'];this[_0x9435('0x20')]=_0x9435('0x21');this[_0x9435('0x22')]=_0xcc1f9d[_0x9435('0x23')];this['callback']=_0x5d6843['callback'];this[_0x9435('0x24')]=_0x5d6843['callbackuniqueid'];this[_0x9435('0x25')]=_0x5d6843['callbackat'];this['recallme']=_0x5d6843[_0x9435('0x26')];this[_0x9435('0x27')]=_0x5d6843[_0x9435('0x27')];this[_0x9435('0x28')]=_0x5d6843['ListId'];this[_0x9435('0x29')]=_0x5d6843['UserId'];this['VoiceQueueId']=_0x5d6843[_0x9435('0x2a')];this[_0x9435('0x2b')]=_0x5d6843[_0x9435('0x2b')];}module[_0x9435('0x2c')]=Hangup; \ No newline at end of file +var _0x2202=['countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','endtime','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x1b1779,_0x1af2e8){var _0x47c709=function(_0xcced02){while(--_0xcced02){_0x1b1779['push'](_0x1b1779['shift']());}};_0x47c709(++_0x1af2e8);}(_0x2202,0x13e));var _0x2220=function(_0x57e7a9,_0x4b20c0){_0x57e7a9=_0x57e7a9-0x0;var _0x46aec4=_0x2202[_0x57e7a9];return _0x46aec4;};'use strict';var util=require(_0x2220('0x0'));var _=require(_0x2220('0x1'));var moment=require('moment');function getSeconds(_0x48983f,_0x192b90){var _0x3faed1=moment(_0x48983f)[_0x2220('0x2')](0x0);var _0x105ed5=moment(_0x192b90)[_0x2220('0x2')](0x0);return _0x3faed1['diff'](_0x105ed5,'seconds');}function Hangup(_0x243578,_0x14b710){this[_0x2220('0x3')]=0x4;this[_0x2220('0x4')]=_0x2220('0x5');this[_0x2220('0x6')]=_0x243578[_0x2220('0x6')];this[_0x2220('0x7')]=_0x243578[_0x2220('0x7')];this[_0x2220('0x8')]=_0x243578[_0x2220('0x7')]===_0x2220('0x9')?_0x2220('0xa'):_0x243578[_0x2220('0x7')];this[_0x2220('0xb')]=_0x243578[_0x2220('0xb')];this[_0x2220('0xc')]=_0x243578[_0x2220('0xc')];this['countnoanswerretry']=_0x243578[_0x2220('0xd')];this[_0x2220('0xe')]=_0x243578[_0x2220('0xb')]+_0x243578['countcongestionretry']+_0x243578[_0x2220('0xd')]+_0x243578[_0x2220('0xf')]+_0x243578[_0x2220('0x10')]+_0x243578[_0x2220('0x11')]+_0x243578[_0x2220('0x12')]+_0x243578['countagentrejectretry'];this[_0x2220('0xf')]=_0x243578[_0x2220('0xf')];this[_0x2220('0x10')]=_0x243578[_0x2220('0x10')];this[_0x2220('0x11')]=_0x243578[_0x2220('0x11')];this[_0x2220('0x12')]=_0x243578[_0x2220('0x12')];this[_0x2220('0x13')]=_0x243578[_0x2220('0x13')];this[_0x2220('0x14')]=_0x14b710[_0x2220('0x14')];this[_0x2220('0x15')]=_0x243578[_0x2220('0x16')];this[_0x2220('0x17')]=_0x243578['number'];this[_0x2220('0x18')]=_0x243578['starttime'];this[_0x2220('0x19')]=_0x243578[_0x2220('0x19')];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x2220('0x1a')]=getSeconds(_0x243578[_0x2220('0x19')],_0x243578[_0x2220('0x18')]);this[_0x2220('0x1b')]=0x0;this[_0x2220('0x1c')]=getSeconds(this[_0x2220('0x1d')],_0x243578[_0x2220('0x19')]);this[_0x2220('0xa')]=_0x243578[_0x2220('0xa')];this['membername']=_0x2220('0x1e');this[_0x2220('0x1f')]=_0x14b710['cause-txt'];this['callback']=_0x243578[_0x2220('0x20')];this['callbackuniqueid']=_0x243578[_0x2220('0x21')];this[_0x2220('0x22')]=_0x243578[_0x2220('0x22')];this[_0x2220('0x23')]=_0x243578[_0x2220('0x23')];this[_0x2220('0x24')]=_0x243578['ContactId'];this[_0x2220('0x25')]=_0x243578[_0x2220('0x25')];this[_0x2220('0x26')]=_0x243578[_0x2220('0x26')];this[_0x2220('0x27')]=_0x243578[_0x2220('0x27')];this['CampaignId']=_0x243578[_0x2220('0x28')];}module[_0x2220('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 88dab47..dedf001 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 _0xb4a3=['milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','lodash'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb4a3,0x174));var _0x3b4a=function(_0x2fdce0,_0x496242){_0x2fdce0=_0x2fdce0-0x0;var _0x36f07e=_0xb4a3[_0x2fdce0];return _0x36f07e;};'use strict';var util=require(_0x3b4a('0x0'));var _=require(_0x3b4a('0x1'));var moment=require('moment');function getSeconds(_0x1563cc,_0x506539){var _0x39016d=moment(_0x1563cc)['milliseconds'](0x0);var _0x410b5b=moment(_0x506539)[_0x3b4a('0x2')](0x0);return _0x39016d['diff'](_0x410b5b,_0x3b4a('0x3'));}function History(_0x47b8bf){this[_0x3b4a('0x4')]=_0x47b8bf[_0x3b4a('0x4')];this[_0x3b4a('0x5')]=_0x47b8bf['scheduledat']||undefined;this['type']=_0x47b8bf[_0x3b4a('0x6')];this[_0x3b4a('0x7')]=_0x47b8bf['type']==='outbound'?_0x3b4a('0x8'):_0x47b8bf[_0x3b4a('0x6')];this[_0x3b4a('0x9')]=_0x47b8bf[_0x3b4a('0x9')];this[_0x3b4a('0xa')]=_0x47b8bf['countcongestionretry'];this[_0x3b4a('0xb')]=_0x47b8bf[_0x3b4a('0xb')];this[_0x3b4a('0xc')]=_0x47b8bf[_0x3b4a('0x9')]+_0x47b8bf['countcongestionretry']+_0x47b8bf[_0x3b4a('0xb')]+_0x47b8bf[_0x3b4a('0xd')]+_0x47b8bf['countdropretry']+_0x47b8bf[_0x3b4a('0xe')]+_0x47b8bf[_0x3b4a('0xf')]+_0x47b8bf[_0x3b4a('0x10')];this[_0x3b4a('0xd')]=_0x47b8bf[_0x3b4a('0xd')];this[_0x3b4a('0x11')]=_0x47b8bf[_0x3b4a('0x11')];this['countabandonedretry']=_0x47b8bf[_0x3b4a('0xe')];this['countmachineretry']=_0x47b8bf[_0x3b4a('0xf')];this[_0x3b4a('0x10')]=_0x47b8bf['countagentrejectretry'];this[_0x3b4a('0x8')]=_0x47b8bf[_0x3b4a('0x8')];this['calleridname']=_0x47b8bf[_0x3b4a('0x12')];this[_0x3b4a('0x13')]=_0x47b8bf['number'];this[_0x3b4a('0x14')]=_0x47b8bf[_0x3b4a('0x14')];this['responsetime']=_0x47b8bf[_0x3b4a('0x15')];this[_0x3b4a('0x16')]=_0x47b8bf['responsetime'];this[_0x3b4a('0x17')]=getSeconds(_0x47b8bf[_0x3b4a('0x15')],_0x47b8bf['starttime']);this[_0x3b4a('0x18')]=0x0;this['talktime']=0x0;this[_0x3b4a('0x19')]=_0x47b8bf['callback'];this[_0x3b4a('0x1a')]=_0x47b8bf['callbackuniqueid'];this[_0x3b4a('0x1b')]=_0x47b8bf[_0x3b4a('0x1b')];this['recallme']=_0x47b8bf['recallme'];this[_0x3b4a('0x1c')]=_0x47b8bf[_0x3b4a('0x1c')];this[_0x3b4a('0x1d')]=_0x47b8bf[_0x3b4a('0x1d')];this[_0x3b4a('0x1e')]=_0x47b8bf[_0x3b4a('0x1e')];this[_0x3b4a('0x1f')]=_0x47b8bf[_0x3b4a('0x1f')];this['CampaignId']=_0x47b8bf['CampaignId'];this[_0x3b4a('0x20')]=_0x47b8bf[_0x3b4a('0x20')]||'';this[_0x3b4a('0x21')]=_0x47b8bf[_0x3b4a('0x21')]||'';}module['exports']=History; \ No newline at end of file +var _0xc3ce=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type'];(function(_0x1ff69b,_0x331e8f){var _0x12bac5=function(_0x1b530a){while(--_0x1b530a){_0x1ff69b['push'](_0x1ff69b['shift']());}};_0x12bac5(++_0x331e8f);}(_0xc3ce,0x1e6));var _0xec3c=function(_0x3585db,_0x15615d){_0x3585db=_0x3585db-0x0;var _0x537104=_0xc3ce[_0x3585db];return _0x537104;};'use strict';var util=require(_0xec3c('0x0'));var _=require(_0xec3c('0x1'));var moment=require('moment');function getSeconds(_0x21367d,_0x49a23c){var _0x5bf111=moment(_0x21367d)[_0xec3c('0x2')](0x0);var _0x30ddbc=moment(_0x49a23c)[_0xec3c('0x2')](0x0);return _0x5bf111[_0xec3c('0x3')](_0x30ddbc,_0xec3c('0x4'));}function History(_0x1e13fd){this[_0xec3c('0x5')]=_0x1e13fd[_0xec3c('0x5')];this[_0xec3c('0x6')]=_0x1e13fd['scheduledat']||undefined;this[_0xec3c('0x7')]=_0x1e13fd[_0xec3c('0x7')];this['campaigntype']=_0x1e13fd[_0xec3c('0x7')]===_0xec3c('0x8')?_0xec3c('0x9'):_0x1e13fd['type'];this[_0xec3c('0xa')]=_0x1e13fd[_0xec3c('0xa')];this['countcongestionretry']=_0x1e13fd[_0xec3c('0xb')];this[_0xec3c('0xc')]=_0x1e13fd[_0xec3c('0xc')];this[_0xec3c('0xd')]=_0x1e13fd['countbusyretry']+_0x1e13fd[_0xec3c('0xb')]+_0x1e13fd[_0xec3c('0xc')]+_0x1e13fd[_0xec3c('0xe')]+_0x1e13fd[_0xec3c('0xf')]+_0x1e13fd[_0xec3c('0x10')]+_0x1e13fd[_0xec3c('0x11')]+_0x1e13fd[_0xec3c('0x12')];this[_0xec3c('0xe')]=_0x1e13fd[_0xec3c('0xe')];this[_0xec3c('0xf')]=_0x1e13fd[_0xec3c('0xf')];this[_0xec3c('0x10')]=_0x1e13fd[_0xec3c('0x10')];this[_0xec3c('0x11')]=_0x1e13fd[_0xec3c('0x11')];this[_0xec3c('0x12')]=_0x1e13fd['countagentrejectretry'];this[_0xec3c('0x9')]=_0x1e13fd[_0xec3c('0x9')];this['calleridname']=_0x1e13fd['name'];this[_0xec3c('0x13')]=_0x1e13fd[_0xec3c('0x14')];this[_0xec3c('0x15')]=_0x1e13fd[_0xec3c('0x15')];this[_0xec3c('0x16')]=_0x1e13fd['responsetime'];this[_0xec3c('0x17')]=_0x1e13fd['responsetime'];this[_0xec3c('0x18')]=getSeconds(_0x1e13fd['responsetime'],_0x1e13fd[_0xec3c('0x15')]);this[_0xec3c('0x19')]=0x0;this[_0xec3c('0x1a')]=0x0;this[_0xec3c('0x1b')]=_0x1e13fd[_0xec3c('0x1b')];this['callbackuniqueid']=_0x1e13fd['callbackuniqueid'];this[_0xec3c('0x1c')]=_0x1e13fd['callbackat'];this[_0xec3c('0x1d')]=_0x1e13fd['recallme'];this[_0xec3c('0x1e')]=_0x1e13fd[_0xec3c('0x1e')];this[_0xec3c('0x1f')]=_0x1e13fd[_0xec3c('0x1f')];this[_0xec3c('0x20')]=_0x1e13fd[_0xec3c('0x20')];this['VoiceQueueId']=_0x1e13fd[_0xec3c('0x21')];this['CampaignId']=_0x1e13fd[_0xec3c('0x22')];this[_0xec3c('0x23')]=_0x1e13fd['originatecalleridnum']||'';this[_0xec3c('0x24')]=_0x1e13fd[_0xec3c('0x24')]||'';}module[_0xec3c('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 8d177ad..a23cbd9 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 _0x52a5=['syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','answered','available','loggedIn','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','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','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','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','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22\x22\x20<>','error','stack','inspect','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','statedesc','endtime','starttime','prototype','loopClearZombieChannels','[uniqueid]','clearZombieChannels','[actions]','sequence','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','then','avgHandleTime','[averageHandleTime]\x20','[rescheduleContact]\x20','unlockContact','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','SIP/%s','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','uniqueid','HangupInAMD','membername','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','rescheduleContact','add','dialMachineRetryFrequency','CampaignId','[rescheduleContact][Machine]','value','[syncHangupInAMDIvr]','countglobal','countnoanswerretry','countnosuchnumberretry','reason19\x20machine....','minutes','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','reason','agent','dialQueueProject2','[syncAgentComplete]','answertime','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','actionid','strategy','roundrobin','paused','stateinterface','locked','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','checkIfTime','ifTime','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','isArray','command','interval','timezones','content','indexOf','true','iftime\x20%s,%s','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','Queue','method\x20not\x20recognized','launchHandleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','checkIfTimeIntervals','[syncCampaigns]','pow','replace','random','match','phone','Contact','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','dialPrefix','trim','substring','dialCutDigit','SIP/%s/%s%s','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','reason\x2020\x20agentreject','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','dialPredictiveInterval','startMethodPredictive','Predictive\x20after\x20first\x20interval','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','UserId','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','checkContactBlack','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','ACTIVE','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','Contact.phone','[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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\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]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./action','./history','./final','./agentComplete','./hangup','env','127.0.0.1','rrmemory','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBookedRR','syncAgentConnect','queuecallerabandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x52a5,0x1de));var _0x552a=function(_0x5cc0bf,_0x528720){_0x5cc0bf=_0x5cc0bf-0x0;var _0x217dbd=_0x52a5[_0x5cc0bf];return _0x217dbd;};'use strict';var util=require(_0x552a('0x0'));var _=require(_0x552a('0x1'));var BPromise=require(_0x552a('0x2'));var uuid=require(_0x552a('0x3'));var moment=require(_0x552a('0x4'));var rr=require('rr');var md5=require(_0x552a('0x5'));var Redis=require(_0x552a('0x6'));var ut=require('../preview/util/util');var config=require(_0x552a('0x7'));var logger=require('../../../config/logger')(_0x552a('0x8'));var loggerBooked=require(_0x552a('0x9'))(_0x552a('0xa'));var loggerPredictive=require(_0x552a('0x9'))(_0x552a('0xb'));var loggerPredictiveCalls=require(_0x552a('0x9'))(_0x552a('0xc'));var loggerSyncQueueSummary=require(_0x552a('0x9'))(_0x552a('0xd'));var ami=require(_0x552a('0xe'));config[_0x552a('0xf')]=_[_0x552a('0x10')](config[_0x552a('0xf')],{'host':_0x552a('0x11'),'port':0x18eb});var io=require(_0x552a('0x12'))(new Redis(config[_0x552a('0xf')]));var cmHopper=require(_0x552a('0x13'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x552a('0x14'));var cmHopperBlack=require(_0x552a('0x15'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x552a('0x16'));var History=require(_0x552a('0x17'));var Final=require(_0x552a('0x18'));var AgentComplete=require(_0x552a('0x19'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x552a('0x1a'));var ipAgi=process[_0x552a('0x1b')]['XCALLY_IP_AGI']||_0x552a('0x1c');var strategy={'rrmemory':_0x552a('0x1d'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence['prototype'][_0x552a('0x1e')]=function(_0x3b1d5d){this[_0x552a('0x1f')]=this[_0x552a('0x1f')]?this[_0x552a('0x1f')][_0x552a('0x20')](_0x3b1d5d):_0x3b1d5d();};function Dialer(_0x13acdd,_0x5b3504){this['sequence']=new Sequence();this[_0x552a('0x21')]=_0x5b3504;this[_0x552a('0x22')]=_0x13acdd['voiceQueues'];this[_0x552a('0x23')]=_0x13acdd['campaigns'];this[_0x552a('0x24')]=_0x13acdd[_0x552a('0x24')];this[_0x552a('0x25')]=_0x13acdd[_0x552a('0x25')];this[_0x552a('0x26')]=config[_0x552a('0x26')]||0x2;this['channels']={};this[_0x552a('0x27')]={};this[_0x552a('0x28')]={};this[_0x552a('0x29')]={};this['optionPredictive']={};this[_0x552a('0x2a')]={};this[_0x552a('0x2b')]={};this[_0x552a('0x2c')]={};this['queueBooked']={};this[_0x552a('0x2d')]={};ami['on']('agentconnect',this[_0x552a('0x2e')]['bind'](this));ami['on'](_0x552a('0x2f'),this['syncQueueCallerAbandon'][_0x552a('0x30')](this));ami['on'](_0x552a('0x31'),this[_0x552a('0x32')]['bind'](this));ami['on'](_0x552a('0x33'),this[_0x552a('0x34')][_0x552a('0x30')](this));ami['on']('custom:queuesummary',this[_0x552a('0xd')][_0x552a('0x30')](this));ami['on'](_0x552a('0x35'),this[_0x552a('0x36')][_0x552a('0x30')](this));ami['on'](_0x552a('0x37'),this[_0x552a('0x38')][_0x552a('0x30')](this));ami['on'](_0x552a('0x39'),this[_0x552a('0x3a')]['bind'](this));ami['on'](_0x552a('0x3b'),this[_0x552a('0x3c')]['bind'](this));ami['on'](_0x552a('0x3d'),this[_0x552a('0x3e')]['bind'](this));this[_0x552a('0x3f')]();this['loopClearZombieChannels']();}function isNotNull(_0x4e9208){return _0x4e9208!==null&&!_[_0x552a('0x40')](_0x4e9208);}function checkIsLoggedIn(_0x44fdce,_0x1a8f14){return function(){if(_0x1a8f14<=0x0){_0x44fdce[_0x552a('0x41')]=_0x552a('0x42');throw _0x44fdce[_0x552a('0x43')]+_0x552a('0x44');}};}function isActive(_0xb42952){return _0xb42952;}function checkIsActive(_0x5bf4e2,_0x58a61e){return function(){if(!isActive(_0x58a61e)){_0x5bf4e2[_0x552a('0x41')]='NOT_ACTIVE';throw _0x5bf4e2[_0x552a('0x43')]+_0x552a('0x45');}};}function checkInterval(_0x21d346){return function(){if(!isNotNull(_0x21d346[_0x552a('0x46')])){_0x21d346[_0x552a('0x41')]=_0x552a('0x47');throw _0x21d346[_0x552a('0x43')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x21d346[_0x552a('0x46')][_0x552a('0x48')])){_0x21d346['message']='INTERVAL_IS_NULL';throw _0x21d346['name']+_0x552a('0x49');}if(!isNotNull(_[_0x552a('0x4a')](_0x21d346[_0x552a('0x46')][_0x552a('0x48')]))){_0x21d346[_0x552a('0x41')]=_0x552a('0x47');throw _0x21d346[_0x552a('0x43')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x52a6ef,_0x17dd78,_0xe67da8){return{'action':_0x52a6ef,'response':_0x17dd78,'message':_0xe67da8,'stack':_0xe67da8};}function myreject(_0x40d846){return function(_0x30d501){return _0x40d846(msgResponse('[ifTime][Action]',_0x552a('0x4b'),JSON[_0x552a('0x4c')](_0x30d501)));};}function getSeconds(_0x19fc74,_0x344536){var _0x272698=moment(_0x19fc74)[_0x552a('0x4d')](0x0);var _0x263588=moment(_0x344536)[_0x552a('0x4d')](0x0);return _0x272698[_0x552a('0x4e')](_0x263588,_0x552a('0x4f'));}function emit(_0x1167fb,_0x19e83a,_0x11acbe){io['to'](_0x1167fb)[_0x552a('0x50')](_0x19e83a,_0x11acbe);}function emitVoiceQueueSummary(_0x3a52d3){if(_0x3a52d3[_0x552a('0x51')]===_0x552a('0x52')){var _0x2d8232={'id':_0x3a52d3['id'],'name':_0x3a52d3['name'],'strategy':_0x3a52d3['strategy'],'answered':_0x3a52d3[_0x552a('0x53')],'available':_0x3a52d3[_0x552a('0x54')],'loggedIn':_0x3a52d3[_0x552a('0x55')],'pTalking':_0x3a52d3['pTalking'],'sumBillable':_0x3a52d3[_0x552a('0x56')],'sumDuration':_0x3a52d3['sumDuration'],'sumHoldTime':_0x3a52d3[_0x552a('0x57')]||0x0,'talking':_0x3a52d3[_0x552a('0x58')],'total':_0x3a52d3[_0x552a('0x59')],'type':_0x3a52d3[_0x552a('0x51')],'unmanaged':_0x3a52d3[_0x552a('0x5a')],'abandoned':_0x3a52d3[_0x552a('0x5b')],'waiting':_0x3a52d3[_0x552a('0x5c')],'loggedInDb':_0x3a52d3[_0x552a('0x5d')],'dialActive':_0x3a52d3[_0x552a('0x5e')],'dialMethod':_0x3a52d3[_0x552a('0x5f')],'dialOriginateCallerIdName':_0x3a52d3[_0x552a('0x60')],'dialOriginateCallerIdNumber':_0x3a52d3[_0x552a('0x61')],'dialOriginateTimeout':_0x3a52d3[_0x552a('0x62')],'dialPrefix':_0x3a52d3['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3a52d3[_0x552a('0x63')],'outboundAnswerCallsDay':_0x3a52d3[_0x552a('0x64')],'outboundBlacklistCallsDay':_0x3a52d3[_0x552a('0x65')],'outboundBusyCallsDay':_0x3a52d3[_0x552a('0x66')],'outboundCongestionCallsDay':_0x3a52d3[_0x552a('0x67')],'outboundDropCallsDayACS':_0x3a52d3[_0x552a('0x68')],'outboundDropCallsDayCallersExit':_0x3a52d3[_0x552a('0x69')],'outboundDropCallsDayTimeout':_0x3a52d3['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3a52d3['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x3a52d3[_0x552a('0x6a')],'outboundOriginateFailureCallsDay':_0x3a52d3['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3a52d3[_0x552a('0x6b')],'outboundRejectCallsDay':_0x3a52d3['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x3a52d3[_0x552a('0x6c')],'predictiveIntervalAnsweredCalls':_0x3a52d3[_0x552a('0x6d')],'predictiveIntervalAvgHoldtime':_0x3a52d3[_0x552a('0x6e')],'predictiveIntervalAvgTalktime':_0x3a52d3['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x3a52d3[_0x552a('0x6f')],'predictiveIntervalDroppedCallsTimeout':_0x3a52d3[_0x552a('0x70')],'predictiveIntervalErlangCalls':_0x3a52d3['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3a52d3[_0x552a('0x71')],'predictiveIntervalHitRate':_0x3a52d3['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x3a52d3[_0x552a('0x72')],'predictiveIntervalPauses':_0x3a52d3[_0x552a('0x73')],'predictiveIntervalAvailable':_0x3a52d3[_0x552a('0x74')],'predictiveIntervalTotalCalls':_0x3a52d3[_0x552a('0x75')],'message':_0x3a52d3[_0x552a('0x41')],'originated':_0x3a52d3[_0x552a('0x76')],'erlangCalls':_0x3a52d3['erlangCalls'],'erlangCallToSecond':_0x3a52d3['erlangCallToSecond'],'erlangAbandonmentRate':_0x3a52d3[_0x552a('0x77')],'erlangBusyFactor':_0x3a52d3[_0x552a('0x78')],'startPredictive':_0x3a52d3['startPredictive'],'startProgressive':_0x3a52d3[_0x552a('0x2b')]};if(_0x3a52d3[_0x552a('0x79')]){_0x2d8232['Trunk']={'id':_0x3a52d3['Trunk']['id'],'name':_0x3a52d3[_0x552a('0x79')][_0x552a('0x43')],'active':_0x3a52d3[_0x552a('0x79')][_0x552a('0x7a')],'callerid':_0x3a52d3[_0x552a('0x79')][_0x552a('0x7b')]};}if(_0x3a52d3[_0x552a('0x46')]){_0x2d8232[_0x552a('0x46')]={'id':_0x3a52d3['Interval']['id'],'name':_0x3a52d3['Interval'][_0x552a('0x43')]};}var _0x44417e=md5(JSON[_0x552a('0x4c')](_0x2d8232));if(_0x3a52d3[_0x552a('0x5')]!==_0x44417e){_0x3a52d3[_0x552a('0x5')]=_0x44417e;emit(util[_0x552a('0x7c')](_0x552a('0x7d'),_0x2d8232[_0x552a('0x43')]),_0x552a('0x7e'),_0x2d8232);}}}function emitCampaignSummary(_0x40ed93){if(_0x40ed93['type']===_0x552a('0x7f')){emit(util[_0x552a('0x7c')](_0x552a('0x80'),_0x40ed93['name']),_0x552a('0x81'),_0x40ed93);}}function checkGetDataPredictive(_0x5d41f9){if(isNotNull(_0x5d41f9)){if(!_[_0x552a('0x4a')](_0x5d41f9)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x552a('0x82')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d41f9[_0x552a('0x75')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d41f9[_0x552a('0x6d')]);loggerPredictive[_0x552a('0x82')](_0x552a('0x83'),_0x5d41f9[_0x552a('0x70')]);loggerPredictive[_0x552a('0x82')](_0x552a('0x84'),_0x5d41f9[_0x552a('0x6f')]);loggerPredictive[_0x552a('0x82')](_0x552a('0x85'),_0x5d41f9[_0x552a('0x6e')]);loggerPredictive['info'](_0x552a('0x86'),_0x5d41f9[_0x552a('0x87')]);loggerPredictive['info'](_0x552a('0x88'));if(_0x5d41f9['predictiveIntervalTotalCalls']>0x0){if(!_[_0x552a('0x40')](_0x5d41f9[_0x552a('0x87')])&&_0x5d41f9[_0x552a('0x87')]>0x0){return!![];}else{loggerPredictive[_0x552a('0x82')](_0x552a('0x89'));}if(!_[_0x552a('0x40')](_0x5d41f9[_0x552a('0x6e')])&&_0x5d41f9['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0x552a('0x82')](_0x552a('0x8a'));}}else{loggerPredictive[_0x552a('0x82')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x552a('0x82')](_0x552a('0x8b'));}}else{loggerPredictive[_0x552a('0x82')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0xe3404a){return function(_0x37b334){loggerPredictive[_0x552a('0x82')](_0x552a('0x8c'));loggerPredictive[_0x552a('0x82')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37b334[_0x552a('0x8d')]);loggerPredictive[_0x552a('0x82')](_0x552a('0x8e'),_0x37b334['erlangCallToSecond']);loggerPredictive['info'](_0x552a('0x8f'),_0x37b334[_0x552a('0x77')]);loggerPredictive[_0x552a('0x82')](_0x552a('0x90'),_0x37b334['erlangBusyFactor']);loggerPredictive[_0x552a('0x82')](_0x552a('0x8f'),_0x37b334['erlangAbandonmentRate']);loggerPredictive[_0x552a('0x82')](_0x552a('0x88'));_['merge'](_0xe3404a,_0x37b334);};}function getDiff(_0x530c98){var _0x4d7bf8=moment()[_0x552a('0x4d')](0x0);var _0x4cf3aa=moment(_0x530c98)['milliseconds'](0x0);return _0x4d7bf8[_0x552a('0x4e')](_0x4cf3aa,_0x552a('0x4f'));}function ifInterval(_0x342c83,_0xbd2ca7){if(_[_0x552a('0x40')](_0xbd2ca7)){return![];}if(getDiff(_0xbd2ca7)<_0x342c83*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x479ead){if(isNotNull(_0x479ead)){if(!_['isUndefined'](_0x479ead['startProgressive'])){_0x479ead[_0x552a('0x2b')]=undefined;loggerPredictive[_0x552a('0x82')](_0x479ead['name'],_0x552a('0x91'));}if(!_[_0x552a('0x40')](_0x479ead[_0x552a('0x2a')])){_0x479ead[_0x552a('0x2a')]=undefined;loggerPredictive[_0x552a('0x82')](_0x479ead[_0x552a('0x43')],_0x552a('0x92'));}if(!_['isUndefined'](_0x479ead[_0x552a('0x93')])){clearInterval(_0x479ead[_0x552a('0x93')]);_0x479ead['handlePredictive']=undefined;loggerPredictive[_0x552a('0x82')](_0x479ead[_0x552a('0x43')],_0x552a('0x94'));}}}function erlangb(_0x335728,_0x9bd203){if(_0x9bd203===0x0){return 0x0;}var _0x2f47b8=0x1;for(var _0x553606=0x1;_0x553606<=_0x9bd203;_0x553606+=0x1){_0x2f47b8=0x1+_0x2f47b8*_0x553606/_0x335728;}return 0x1/_0x2f47b8;}function isVoiceQueueOutbound(_0x3ce1ae){return _0x3ce1ae===_0x552a('0x52');}function isNotPreview(_0x594c5a){return _0x594c5a!==_0x552a('0x21');}function isCampaignIvr(_0x4421a1){return _0x4421a1===_0x552a('0x7f');}function getCallerId(_0x2a4ba9,_0x1a845d,_0x18b4fd){if(!_[_0x552a('0x40')](_0x18b4fd)&&_0x552a('0x95')===typeof _0x18b4fd&&!_[_0x552a('0x4a')](_0x18b4fd)){if(!_[_0x552a('0x40')](_0x1a845d)&&_0x552a('0x95')===typeof _0x1a845d&&!_['isEmpty'](_0x1a845d)){return util['format']('\x22%s\x22\x20<%s>',_0x1a845d,_0x18b4fd);}return util[_0x552a('0x7c')]('\x22%s\x22\x20<%s>',_0x18b4fd,_0x18b4fd);}if(!_['isUndefined'](_0x2a4ba9)&&_0x552a('0x95')===typeof _0x2a4ba9&&!_[_0x552a('0x4a')](_0x2a4ba9)){return _0x2a4ba9;}return _0x552a('0x96');}function loggerCatchQueueSummary(_0x4309c4,_0x6ca4b3){return function(_0x16fcfc){freeVariablesPredictive(_0x6ca4b3);emitVoiceQueueSummary(_0x6ca4b3);emitCampaignSummary(_0x6ca4b3);loggerSyncQueueSummary[_0x552a('0x97')](_0x4309c4,util['inspect'](_0x16fcfc,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x32dd00,_0x1d93be){return function(_0x3c6d06){loggerPredictive['error'](_0x1d93be[_0x552a('0x43')],_0x32dd00);loggerPredictive['error'](_0x3c6d06[_0x552a('0x98')]);freeVariablesPredictive(_0x1d93be);};}function loggerCatch(_0x7c379e){return function(_0x4bb990){logger[_0x552a('0x97')](_0x7c379e,util[_0x552a('0x99')](_0x4bb990,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x15d506){return _0x15d506&&!_[_0x552a('0x40')](_0x15d506)&&_0x15d506[_0x552a('0x9a')]>0x0;}function decremetOriginate(_0x1a98bd){if(!_[_0x552a('0x40')](_0x1a98bd)&&_0x1a98bd!==null){if(_0x1a98bd[_0x552a('0x9b')](_0x552a('0x76'))){if(_0x1a98bd[_0x552a('0x76')]>0x0){_0x1a98bd[_0x552a('0x76')]-=0x1;}else{logger['error'](_0x552a('0x9c'));}}}else{logger[_0x552a('0x97')](_0x552a('0x9d'));}}function checkContactLowerLimitOriginate(_0x582fd8,_0x242417,_0x217297){if(_0x242417>_0x217297){for(var _0x2a6f3f=0x0;_0x2a6f3f<_0x242417-_0x217297;_0x2a6f3f+=0x1){decremetOriginate(_0x582fd8);}}}function loggerGetContactDialer(_0x163c70,_0x3f1dd8,_0x5d1714){return function(_0x42e423){checkContactLowerLimitOriginate(_0x3f1dd8,_0x5d1714,0x0);logger[_0x552a('0x97')](_0x163c70,util[_0x552a('0x99')](_0x42e423,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1835ff){return function(_0x480dae){if(isNotNull(_0x480dae)&&isNotNull(_0x480dae[0x0])){if(_0x480dae[0x0][_0x552a('0x9e')]>0x0){_0x1835ff[_0x552a('0x41')]='RESCHEDULED_CONTACTS';logger[_0x552a('0x82')](_0x552a('0x9f')+_0x1835ff[_0x552a('0x43')],_0x480dae[0x0][_0x552a('0x9e')],_0x552a('0xa0'));}else{_0x1835ff[_0x552a('0x41')]=_0x552a('0xa1');logger['info'](_0x552a('0xa2')+_0x1835ff[_0x552a('0x43')]);}}};}function notSendMessagesQueue(_0x2e2414){if(_0x2e2414[_0x552a('0xa3')]){freeVariablesPredictive(_0x2e2414);if(_0x2e2414[_0x552a('0x76')]===0x0&&_0x2e2414[_0x552a('0x58')]===0x0&&_0x2e2414[_0x552a('0x5c')]===0x0&&(_0x2e2414['pTalking']||0x0)===0x0){_0x2e2414[_0x552a('0xa3')]=![];_0x2e2414[_0x552a('0x54')]=0x0;_0x2e2414[_0x552a('0x41')]=_0x552a('0xa4');loggerSyncQueueSummary[_0x552a('0x97')](_0x552a('0xa5'),_0x2e2414['name'],'is\x20not\x20active');}else{_0x2e2414[_0x552a('0x41')]=_0x552a('0xa6');loggerSyncQueueSummary[_0x552a('0x97')](_0x552a('0xa5'),_0x2e2414[_0x552a('0x43')],_0x552a('0xa7'));}emitVoiceQueueSummary(_0x2e2414);}}function notSendMessagesCampaign(_0x555543){if(_0x555543['sendMessageOneNotActive']){if(_0x555543['originated']===0x0){_0x555543[_0x552a('0xa3')]=![];_0x555543['message']=_0x552a('0xa4');loggerSyncQueueSummary[_0x552a('0x97')](_0x552a('0xa8'),_0x555543['name'],_0x552a('0xa9'));}else{_0x555543['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x552a('0x97')](_0x552a('0xa8'),_0x555543[_0x552a('0x43')],_0x552a('0xa7'));}emitCampaignSummary(_0x555543);}}function createObjHistory(_0x20b363,_0x5d912c,_0xfb272d,_0x422fa8,_0x3638e7){_0x20b363[_0x552a('0x41')]=_0xfb272d;var _0x46101c=new Action(_0x20b363,_0x5d912c);var _0x53cb1e=new History(_0x46101c);_0x53cb1e[_0x552a('0xaa')]=_0x422fa8;_0x53cb1e[_0x552a('0xab')]=_0x3638e7;_0x53cb1e[_0x552a('0xac')]=_0x46101c[_0x552a('0xad')];return _0x53cb1e;}Dialer[_0x552a('0xae')][_0x552a('0xaf')]=function(){var _0x419f13=this;setInterval(function(){_0x419f13['clearZombieChannels'](_0x419f13[_0x552a('0x29')],_0x552a('0xb0'));_0x419f13[_0x552a('0xb1')](_0x419f13[_0x552a('0x27')],_0x552a('0xb2'));},0x32c8);};Dialer[_0x552a('0xae')]['clearZombieChannels']=function(_0x172bc3,_0x55461d){var _0x16172f=this;for(var _0x46654c in _0x172bc3){if(_0x172bc3[_0x552a('0x9b')](_0x46654c)){this[_0x552a('0xb3')][_0x552a('0x1e')](function(){if(!_[_0x552a('0xb4')](_0x172bc3[_0x46654c])){return ami[_0x552a('0xb5')]({'action':_0x552a('0xb6'),'channel':_0x172bc3[_0x46654c][_0x552a('0xb7')]})[_0x552a('0xb8')](function(_0x106633){if(_0x106633[_0x552a('0x41')]===_0x552a('0xb9')){setTimeout(function(){if(_0x172bc3[_0x46654c]&&_0x172bc3[_0x46654c][_0x552a('0x51')]!==_0x552a('0x7f')){_0x16172f[_0x552a('0xba')](_0x16172f['voiceQueues'][_0x172bc3[_0x46654c][_0x552a('0xbb')]]);logger['error'](_0x552a('0xbc'),_0x55461d,_0x46654c,_0x172bc3[_0x46654c]['queue']);delete _0x172bc3[_0x46654c];}if(_0x172bc3[_0x46654c]&&_0x172bc3[_0x46654c][_0x552a('0x51')]===_0x552a('0x7f')){_0x16172f[_0x552a('0xba')](_0x16172f[_0x552a('0x23')][_0x172bc3[_0x46654c][_0x552a('0xbb')]]);logger[_0x552a('0x97')](_0x552a('0xbd'),_0x55461d,_0x46654c,_0x172bc3[_0x46654c]['queue']);delete _0x172bc3[_0x46654c];}},0x2328);}});}});}}};Dialer[_0x552a('0xae')][_0x552a('0xbe')]=function(_0x37162c){return BPromise[_0x552a('0xbf')]()['then'](cmHopper['countReScheduled'](_0x37162c))[_0x552a('0xb8')](loggerCatch(_0x552a('0xc0')));};Dialer['prototype'][_0x552a('0xc1')]=function(_0x4169c2){return BPromise[_0x552a('0xbf')]()['then'](cmHopperBlack[_0x552a('0xc1')](_0x4169c2))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype'][_0x552a('0xc2')]=function(_0x2818a3){return BPromise['resolve']()['then'](cmHopperBlack[_0x552a('0xc2')](_0x2818a3))['catch'](loggerCatch(_0x552a('0xc3')));};Dialer[_0x552a('0xae')][_0x552a('0xc4')]=function(_0x52baf5){return BPromise[_0x552a('0xbf')]()[_0x552a('0xc5')](cmHopperHistory[_0x552a('0xc6')](_0x52baf5))[_0x552a('0xb8')](loggerCatch(_0x552a('0xc7')));};Dialer[_0x552a('0xae')]['rescheduleContact']=function(_0x141bb7){return BPromise['resolve']()[_0x552a('0xc5')](cmHopper['rescheduleContact'](_0x141bb7))[_0x552a('0xb8')](loggerCatch(_0x552a('0xc8')));};Dialer[_0x552a('0xae')][_0x552a('0xc9')]=function(_0x3c2cac,_0x22770f,_0x49aa55){return BPromise[_0x552a('0xbf')]()[_0x552a('0xc5')](cmHopper[_0x552a('0xc9')](_0x3c2cac,_0x22770f,_0x49aa55))['catch'](loggerCatch('[unlockContact]\x20'));};Dialer[_0x552a('0xae')][_0x552a('0xca')]=function(_0x125fb1,_0x5bf603,_0x3ec965,_0x4fb9c7){return BPromise[_0x552a('0xbf')]()[_0x552a('0xc5')](cmHopper['getContactDialer'](_0x125fb1,_0x5bf603,_0x3ec965,_0x4fb9c7))[_0x552a('0xb8')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x552a('0xae')][_0x552a('0xcb')]=function(_0x1e8d8d,_0x4b60c4,_0x2d90a2){return BPromise[_0x552a('0xbf')]()[_0x552a('0xc5')](cmHopper[_0x552a('0xcb')](_0x1e8d8d,_0x4b60c4,_0x2d90a2))[_0x552a('0xb8')](loggerCatch(_0x552a('0xcc')));};Dialer[_0x552a('0xae')][_0x552a('0xcd')]=function(_0x187b6f){return BPromise['resolve']()[_0x552a('0xc5')](voiceQueueRt[_0x552a('0xcd')](_0x187b6f))[_0x552a('0xb8')](loggerCatch(_0x552a('0xce')));};Dialer[_0x552a('0xae')]['moveContactManagedDialer']=function(_0x150c25){return BPromise['resolve']()[_0x552a('0xc5')](cmHopper[_0x552a('0xcf')](_0x150c25))[_0x552a('0xb8')](loggerCatch(_0x552a('0xd0')));};Dialer[_0x552a('0xae')][_0x552a('0xd1')]=function(_0x57a330){return BPromise[_0x552a('0xbf')]()['then'](cmHopperHistory[_0x552a('0xd1')](_0x57a330))[_0x552a('0xb8')](loggerCatch(_0x552a('0xd2')));};Dialer[_0x552a('0xae')][_0x552a('0xba')]=function(_0x59a7e){if(!_[_0x552a('0x40')](_0x59a7e)&&_0x59a7e!==null){if(_0x59a7e[_0x552a('0x9b')](_0x552a('0x76'))){if(_0x59a7e[_0x552a('0x76')]>0x0){_0x59a7e['originated']-=0x1;}else{logger[_0x552a('0x97')](_0x552a('0xd3'));}}}else{logger[_0x552a('0x97')](_0x552a('0xd4'));}};Dialer['prototype']['loggerHandler']=function(_0x3b7c0a,_0x17883e){var _0x4fd3be=this;return function(_0x33fde2){_0x4fd3be['updateOriginated'](_0x17883e);logger['error'](_0x3b7c0a,util[_0x552a('0x99')](_0x33fde2,{'showHidden':![],'depth':null}));};};Dialer[_0x552a('0xae')][_0x552a('0xd5')]=function(_0x19f706,_0x1b077b,_0x49d610){var _0x2893c9={'state':0x19,'statedesc':_0x552a('0xd6')};this['updateOriginated'](_0x1b077b);this[_0x552a('0xd7')](_[_0x552a('0xd8')](_0x2893c9,_[_0x552a('0xd9')](_0x49d610,[_0x552a('0xda'),_0x552a('0xdb'),'UserId',_0x552a('0xdc'),'CampaignId'])),_0x552a('0xdd'),_0x552a('0xde'));logger[_0x552a('0x97')](_0x19f706);};Dialer[_0x552a('0xae')][_0x552a('0xdf')]=function(_0x5bb571){return _0x5bb571===_0x552a('0xe0');};Dialer[_0x552a('0xae')][_0x552a('0xe1')]=function(_0x1829aa){return!_['isUndefined'](_0x1829aa)&&_0x1829aa&&!_['isUndefined'](_0x1829aa[_0x552a('0x43')])&&!_[_0x552a('0x40')](_0x1829aa[_0x552a('0x7a')])&&_0x1829aa['active']&&(this[_0x552a('0x25')][util[_0x552a('0x7c')]('SIP/%s',_0x1829aa[_0x552a('0x43')])][_0x552a('0xb6')]===_0x552a('0xe2')||this['trunks'][util[_0x552a('0x7c')](_0x552a('0xe3'),_0x1829aa[_0x552a('0x43')])][_0x552a('0xb6')]==='unmonitored');};Dialer['prototype']['saveInDb']=function(_0x591b76,_0x1567de,_0x7dde2f){this[_0x552a('0xd1')](_0x591b76)[_0x552a('0xb8')](loggerCatch(_0x1567de));this[_0x552a('0xcf')](_0x591b76)[_0x552a('0xb8')](loggerCatch(_0x7dde2f));};Dialer[_0x552a('0xae')][_0x552a('0x3a')]=function(_0x792516){var _0x3de919=this[_0x552a('0x29')][_0x792516['uniqueid']];var _0x4c5157;if(!_['isNil'](_0x792516)&&!_['isNil'](_0x792516[_0x552a('0xe4')])&&!_[_0x552a('0xb4')](_0x792516[_0x552a('0xe4')][_0x552a('0xe5')])&&_0x792516[_0x552a('0xe6')]===_0x552a('0xe7')&&_0x3de919){if(_0x3de919[_0x552a('0x51')]!==_0x552a('0x7f')&&this[_0x552a('0x22')][_0x3de919['queue']][_0x552a('0xe8')]&&_0x792516['value']===_0x552a('0xe9')){delete this[_0x552a('0x29')][_0x792516[_0x552a('0xea')]];this[_0x552a('0xba')](this[_0x552a('0x22')][_0x3de919[_0x552a('0xbb')]]);this[_0x552a('0x22')][_0x3de919[_0x552a('0xbb')]][_0x552a('0x64')]+=0x1;this[_0x552a('0x22')][_0x3de919[_0x552a('0xbb')]][_0x552a('0x63')]+=0x1;_0x4c5157=new Hangup(_0x3de919,_0x792516);_0x4c5157[_0x552a('0xaa')]=0x12;_0x4c5157['statedesc']=_0x552a('0xeb');_0x4c5157[_0x552a('0xec')]='AMD';this[_0x552a('0xd7')](_0x4c5157,_0x552a('0xed'),_0x552a('0xee'));}if(_0x3de919['type']!==_0x552a('0x7f')&&this['voiceQueues'][_0x3de919[_0x552a('0xbb')]][_0x552a('0xe8')]&&_0x792516['value']===_0x552a('0xef')){var _0x5c9311=this;return new BPromise(function(_0x3213b4,_0x41431e){delete _0x5c9311[_0x552a('0x29')][_0x792516[_0x552a('0xea')]];_0x5c9311[_0x552a('0xba')](_0x5c9311[_0x552a('0x22')][_0x3de919[_0x552a('0xbb')]]);_0x5c9311[_0x552a('0x22')][_0x3de919[_0x552a('0xbb')]][_0x552a('0x64')]+=0x1;_0x5c9311['voiceQueues'][_0x3de919[_0x552a('0xbb')]][_0x552a('0x63')]+=0x1;var _0x5efb4f=_0x5c9311[_0x552a('0x22')][_0x3de919[_0x552a('0xbb')]];var _0x32f56f=new Hangup(_0x3de919,_0x792516);_0x32f56f[_0x552a('0xaa')]=0x13;_0x32f56f['statedesc']=_0x552a('0xf0');_0x32f56f[_0x552a('0xec')]=_0x552a('0xf1');_0x32f56f[_0x552a('0xf2')]+=0x1;_0x32f56f['countglobal']+=0x1;_0x32f56f[_0x552a('0xf3')]=!![];_0x5c9311[_0x552a('0xd1')](_0x32f56f)[_0x552a('0xb8')](loggerCatch(_0x552a('0xf4')));if(_0x32f56f[_0x552a('0xf5')]+_0x32f56f[_0x552a('0xf6')]+_0x32f56f['countnoanswerretry']+_0x32f56f['countnosuchnumberretry']+_0x32f56f[_0x552a('0xf7')]+_0x32f56f[_0x552a('0xf8')]+_0x32f56f[_0x552a('0xf2')]+_0x32f56f[_0x552a('0xf9')]>=_0x5efb4f[_0x552a('0xfa')]){_0x5c9311[_0x552a('0xfb')](_0x32f56f,_0x3213b4,_0x41431e,'reason19\x20machine....');}else{if(_0x32f56f['countmachineretry']>=_0x5efb4f[_0x552a('0xfc')]){_0x5c9311[_0x552a('0xfd')](_0x32f56f,_0x3213b4,_0x41431e,_0x552a('0xfe'));}else{_0x5c9311[_0x552a('0xff')]({'active':![],'countmachineretry':_0x32f56f['countmachineretry'],'scheduledat':moment()[_0x552a('0x100')](_0x5efb4f[_0x552a('0x101')],'minutes')[_0x552a('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x32f56f[_0x552a('0xda')],'ListId':_0x32f56f['ListId'],'VoiceQueueId':_0x32f56f[_0x552a('0xdc')]||undefined,'CampaignId':_0x32f56f[_0x552a('0x102')]||undefined})[_0x552a('0xb8')](loggerCatch(_0x552a('0x103')));_0x3213b4({'reschedule':0x1});}}});}if(_0x3de919[_0x552a('0x51')]===_0x552a('0x7f')&&this[_0x552a('0x23')][_0x3de919[_0x552a('0xbb')]][_0x552a('0xe8')]&&_0x792516[_0x552a('0x104')]==='HANGUP'){delete this[_0x552a('0x29')][_0x792516[_0x552a('0xea')]];this[_0x552a('0xba')](this[_0x552a('0x23')][_0x3de919[_0x552a('0xbb')]]);_0x4c5157=new Hangup(_0x3de919,_0x792516);_0x4c5157[_0x552a('0xaa')]=0x12;_0x4c5157[_0x552a('0xab')]=_0x552a('0xeb');_0x4c5157[_0x552a('0xec')]=_0x552a('0xf1');this[_0x552a('0xd7')](_0x4c5157,'[syncHangupInAMDIvr][createHistory]',_0x552a('0x105'));}if(_0x3de919['type']===_0x552a('0x7f')&&this[_0x552a('0x23')][_0x3de919[_0x552a('0xbb')]]['dialAMDActive']&&_0x792516[_0x552a('0x104')]===_0x552a('0xef')){var _0x5c9311=this;return new BPromise(function(_0x304964,_0x17eb99){delete _0x5c9311[_0x552a('0x29')][_0x792516['uniqueid']];_0x5c9311[_0x552a('0xba')](_0x5c9311['campaigns'][_0x3de919[_0x552a('0xbb')]]);_0x5c9311[_0x552a('0x23')][_0x3de919['queue']][_0x552a('0x64')]+=0x1;_0x5c9311[_0x552a('0x23')][_0x3de919[_0x552a('0xbb')]][_0x552a('0x63')]+=0x1;var _0x3bddb6=_0x5c9311[_0x552a('0x23')][_0x3de919[_0x552a('0xbb')]];var _0x4bc540=new Hangup(_0x3de919,_0x792516);_0x4bc540[_0x552a('0xaa')]=0x13;_0x4bc540['statedesc']=_0x552a('0xf0');_0x4bc540[_0x552a('0xec')]=_0x552a('0xf1');_0x4bc540[_0x552a('0xf2')]+=0x1;_0x4bc540[_0x552a('0x106')]+=0x1;_0x4bc540[_0x552a('0xf3')]=!![];_0x5c9311['createHistory'](_0x4bc540)[_0x552a('0xb8')](loggerCatch(_0x552a('0xf4')));if(_0x4bc540[_0x552a('0xf5')]+_0x4bc540[_0x552a('0xf6')]+_0x4bc540[_0x552a('0x107')]+_0x4bc540[_0x552a('0x108')]+_0x4bc540[_0x552a('0xf7')]+_0x4bc540[_0x552a('0xf8')]+_0x4bc540['countmachineretry']+_0x4bc540[_0x552a('0xf9')]>=_0x3bddb6[_0x552a('0xfa')]){_0x5c9311[_0x552a('0xfb')](_0x4bc540,_0x304964,_0x17eb99,_0x552a('0x109'));}else{if(_0x4bc540[_0x552a('0xf2')]>=_0x3bddb6[_0x552a('0xfc')]){_0x5c9311[_0x552a('0xfd')](_0x4bc540,_0x304964,_0x17eb99,_0x552a('0xfe'));}else{_0x5c9311[_0x552a('0xff')]({'active':![],'countmachineretry':_0x4bc540['countmachineretry'],'scheduledat':moment()[_0x552a('0x100')](_0x3bddb6[_0x552a('0x101')],_0x552a('0x10a'))['format'](_0x552a('0x10b')),'ContactId':_0x4bc540[_0x552a('0xda')],'ListId':_0x4bc540[_0x552a('0xdb')],'VoiceQueueId':_0x4bc540[_0x552a('0xdc')]||undefined,'CampaignId':_0x4bc540[_0x552a('0x102')]||undefined})[_0x552a('0xb8')](loggerCatch(_0x552a('0x103')));_0x304964({'reschedule':0x1});}}});}}};Dialer[_0x552a('0xae')][_0x552a('0x36')]=function(_0x3c8971){var _0x5e5dd7=this[_0x552a('0x29')][_0x3c8971[_0x552a('0xea')]];var _0x2cbc85=this;var _0x31333a;if(_0x5e5dd7&&_0x5e5dd7[_0x552a('0x51')]===_0x552a('0x7f')){delete this[_0x552a('0x29')][_0x3c8971[_0x552a('0xea')]];this[_0x552a('0xba')](this[_0x552a('0x23')][_0x5e5dd7[_0x552a('0xbb')]]);this[_0x552a('0x23')][_0x5e5dd7['queue']][_0x552a('0x10c')]+=0x1;_0x31333a=new Hangup(_0x5e5dd7,_0x3c8971);this[_0x552a('0xd1')](_0x31333a)[_0x552a('0xb8')](loggerCatch(_0x552a('0x10d')));this[_0x552a('0xcf')](_0x31333a)['catch'](loggerCatch(_0x552a('0x10e')));}if(_0x5e5dd7&&_0x5e5dd7[_0x552a('0x51')]!==_0x552a('0x7f')&&isNotNull(this['voiceQueues'][_0x5e5dd7['queue']][_0x552a('0x10f')])){delete this[_0x552a('0x29')][_0x3c8971[_0x552a('0xea')]];this['updateOriginated'](this[_0x552a('0x22')][_0x5e5dd7['queue']]);this[_0x552a('0x22')][_0x5e5dd7['queue']][_0x552a('0x64')]+=0x1;this[_0x552a('0x22')][_0x5e5dd7[_0x552a('0xbb')]][_0x552a('0x63')]+=0x1;_0x31333a=new Hangup(_0x5e5dd7,_0x3c8971);_0x31333a[_0x552a('0xaa')]=0x10;_0x31333a[_0x552a('0xab')]=_0x552a('0x110');_0x31333a[_0x552a('0xec')]=_0x552a('0x111');this[_0x552a('0xd1')](_0x31333a)[_0x552a('0xb8')](loggerCatch(_0x552a('0x10d')));this[_0x552a('0xcf')](_0x31333a)[_0x552a('0xb8')](loggerCatch(_0x552a('0x10e')));}if(_0x5e5dd7&&_0x5e5dd7[_0x552a('0x51')]!==_0x552a('0x7f')&&!isNotNull(this[_0x552a('0x22')][_0x5e5dd7[_0x552a('0xbb')]][_0x552a('0x10f')])){delete this['uniqueId'][_0x3c8971[_0x552a('0xea')]];this[_0x552a('0xba')](this[_0x552a('0x22')][_0x5e5dd7[_0x552a('0xbb')]]);this[_0x552a('0x22')][_0x5e5dd7['queue']][_0x552a('0x6c')]+=0x1;_0x31333a=new Hangup(_0x5e5dd7,_0x3c8971);_0x31333a['state']=0xc;_0x31333a[_0x552a('0xab')]=_0x3c8971[_0x552a('0x112')];_0x31333a['membername']=_0x552a('0x113');this[_0x552a('0xd1')](_0x31333a)['catch'](loggerCatch(_0x552a('0x10d')));this[_0x552a('0xcf')](_0x31333a)[_0x552a('0xb8')](loggerCatch(_0x552a('0x10e')));}};Dialer[_0x552a('0xae')][_0x552a('0x34')]=function(_0x24c83f){var _0x45e245=this[_0x552a('0x29')][_0x24c83f[_0x552a('0xea')]];var _0x51cc63=this;if(this['voiceQueues'][_0x24c83f[_0x552a('0xbb')]]){if(_0x45e245&&_0x45e245['type']!==_0x552a('0x7f')){delete this[_0x552a('0x29')][_0x24c83f[_0x552a('0xea')]];this[_0x552a('0x22')][_0x24c83f[_0x552a('0xbb')]]['outboundAnswerCallsDay']+=0x1;var _0x59cd62=new AgentComplete(_0x45e245,_0x24c83f);if(_0x24c83f[_0x552a('0x114')]===_0x552a('0x115')){_0x59cd62['agiafterat']=this[_0x552a('0x22')][_0x24c83f[_0x552a('0xbb')]][_0x552a('0x116')]&&this[_0x552a('0x22')][_0x24c83f[_0x552a('0xbb')]]['dialAgiAfterHangupAgent']?moment()[_0x552a('0x7c')](_0x552a('0x10b')):undefined;}this[_0x552a('0xd1')](_0x59cd62)[_0x552a('0xb8')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x59cd62)[_0x552a('0xb8')](loggerCatch(_0x552a('0x117')));}}};Dialer[_0x552a('0xae')]['syncAgentConnect']=function(_0x4f493d){if(this['voiceQueues'][_0x4f493d[_0x552a('0xbb')]]){if(this[_0x552a('0x29')][_0x4f493d[_0x552a('0xea')]]&&this[_0x552a('0x29')][_0x4f493d['uniqueid']][_0x552a('0x51')]!=='ivr'){this[_0x552a('0xba')](this[_0x552a('0x22')][_0x4f493d[_0x552a('0xbb')]]);this['uniqueId'][_0x4f493d[_0x552a('0xea')]][_0x552a('0x118')]=moment()[_0x552a('0x7c')](_0x552a('0x10b'));}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0xdd5512){this[_0x552a('0xd1')](_0xdd5512)[_0x552a('0xb8')](loggerCatch(_0x552a('0x119')));this['moveContactManagedDialer'](_0xdd5512)['catch'](loggerCatch(_0x552a('0x11a')));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x223030){var _0x53fe99=this[_0x552a('0x29')][_0x223030[_0x552a('0xea')]];var _0x50b600=this;if(this[_0x552a('0x22')][_0x223030['queue']]){if(_0x53fe99&&_0x53fe99[_0x552a('0x51')]!==_0x552a('0x7f')){delete this[_0x552a('0x29')][_0x223030[_0x552a('0xea')]];this['updateOriginated'](this[_0x552a('0x22')][_0x223030['queue']]);_0x53fe99['droptime']=moment()[_0x552a('0x7c')](_0x552a('0x10b'));var _0x4a5fd4=new QueueCallerAbandon(_0x53fe99,_0x223030);if(getSeconds(_0x53fe99[_0x552a('0x11b')],_0x53fe99[_0x552a('0x11c')])>=_0x53fe99[_0x552a('0x11d')]){this[_0x552a('0x22')][_0x223030['queue']][_0x552a('0x70')]+=0x1;this[_0x552a('0x22')][_0x223030[_0x552a('0xbb')]][_0x552a('0x11e')]+=0x1;this[_0x552a('0x22')][_0x223030[_0x552a('0xbb')]][_0x552a('0x71')]+=0x1;_0x4a5fd4[_0x552a('0xaa')]=0xa;_0x4a5fd4[_0x552a('0xab')]=_0x552a('0x11f');_0x4a5fd4[_0x552a('0x120')]=_0x552a('0x121');_0x4a5fd4[_0x552a('0x122')]=this[_0x552a('0x22')][_0x223030[_0x552a('0xbb')]]['dialQueueProject2']?moment()[_0x552a('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x4a5fd4[_0x552a('0xf7')]+=0x1;_0x4a5fd4[_0x552a('0x106')]+=0x1;if(_0x4a5fd4[_0x552a('0xf7')]>=this['voiceQueues'][_0x223030[_0x552a('0xbb')]][_0x552a('0x123')]){this[_0x552a('0x124')](_0x4a5fd4);}else{this[_0x552a('0xff')]({'active':![],'countdropretry':_0x4a5fd4['countdropretry'],'scheduledat':moment()[_0x552a('0x100')](this[_0x552a('0x22')][_0x223030['queue']][_0x552a('0x125')],'minutes')['format'](_0x552a('0x10b')),'ContactId':_0x53fe99[_0x552a('0xda')],'ListId':_0x53fe99[_0x552a('0xdb')],'VoiceQueueId':_0x53fe99[_0x552a('0xdc')]||undefined,'CampaignId':_0x53fe99[_0x552a('0x102')]||undefined})[_0x552a('0xb8')](loggerCatch(_0x552a('0x126')));var _0x287ce7=new History(_0x4a5fd4);_0x287ce7[_0x552a('0xaa')]=0xa;_0x287ce7[_0x552a('0xab')]=_0x552a('0x11f');_0x287ce7[_0x552a('0xad')]=moment()[_0x552a('0x7c')](_0x552a('0x10b'));_0x287ce7[_0x552a('0xac')]=_0x287ce7[_0x552a('0xad')];_0x287ce7['calleridname']=_0x4a5fd4[_0x552a('0x127')];_0x287ce7[_0x552a('0x128')]=_0x4a5fd4[_0x552a('0x128')];this[_0x552a('0xd1')](_0x287ce7)['catch'](loggerCatch(_0x552a('0x129')));}}else{this['voiceQueues'][_0x223030['queue']][_0x552a('0x6f')]+=0x1;this['voiceQueues'][_0x223030[_0x552a('0xbb')]]['outboundDropCallsDayCallersExit']+=0x1;_0x4a5fd4[_0x552a('0xaa')]=0xb;_0x4a5fd4[_0x552a('0xab')]='Abandoned';_0x4a5fd4[_0x552a('0x120')]=_0x552a('0x12a');_0x4a5fd4[_0x552a('0xf8')]+=0x1;_0x4a5fd4['countglobal']+=0x1;if(_0x4a5fd4[_0x552a('0xf8')]>=this[_0x552a('0x22')][_0x223030[_0x552a('0xbb')]][_0x552a('0x12b')]){this[_0x552a('0x124')](_0x4a5fd4);}else{this[_0x552a('0xff')]({'active':![],'countabandonedretry':_0x4a5fd4[_0x552a('0xf8')],'scheduledat':moment()[_0x552a('0x100')](this[_0x552a('0x22')][_0x223030['queue']]['dialAbandonedRetryFrequency'],_0x552a('0x10a'))[_0x552a('0x7c')](_0x552a('0x10b')),'ContactId':_0x53fe99[_0x552a('0xda')],'ListId':_0x53fe99[_0x552a('0xdb')],'VoiceQueueId':_0x53fe99[_0x552a('0xdc')]||undefined,'CampaignId':_0x53fe99[_0x552a('0x102')]||undefined})[_0x552a('0xb8')](loggerCatch(_0x552a('0x12c')));var _0x287ce7=new History(_0x4a5fd4);_0x287ce7[_0x552a('0xaa')]=0xb;_0x287ce7['statedesc']=_0x552a('0x12d');_0x287ce7['starttime']=moment()[_0x552a('0x7c')](_0x552a('0x10b'));_0x287ce7['endtime']=_0x287ce7[_0x552a('0xad')];_0x287ce7['calleridname']=_0x4a5fd4[_0x552a('0x127')];_0x287ce7[_0x552a('0x128')]=_0x4a5fd4[_0x552a('0x128')];this[_0x552a('0xd1')](_0x287ce7)[_0x552a('0xb8')](loggerCatch(_0x552a('0x12e')));}}}}};Dialer['prototype'][_0x552a('0x38')]=function(_0x4f6ca1){if(this[_0x552a('0x27')][_0x4f6ca1['uniqueid']]){this[_0x552a('0x27')][_0x4f6ca1[_0x552a('0xea')]]['channel']=_0x4f6ca1[_0x552a('0xb7')];}if(this['uniqueId'][_0x4f6ca1[_0x552a('0xea')]]){this[_0x552a('0x29')][_0x4f6ca1[_0x552a('0xea')]][_0x552a('0xb7')]=_0x4f6ca1[_0x552a('0xb7')];}};Dialer[_0x552a('0xae')]['syncQueueMember']=function(_0x5179b1){if(strategy[this[_0x552a('0x22')][this[_0x552a('0x27')][_0x5179b1[_0x552a('0x12f')]][_0x552a('0xbb')]][_0x552a('0x130')]]===_0x552a('0x131')){if(this[_0x552a('0x27')][_0x5179b1[_0x552a('0x12f')]]&&_['isNil'](this[_0x552a('0x27')][_0x5179b1[_0x552a('0x12f')]]['locked'])&&_0x5179b1[_0x552a('0xb6')]==='1'&&_0x5179b1[_0x552a('0x132')]==='0'){if(this[_0x552a('0x24')][_0x5179b1[_0x552a('0x133')]]){if(!this[_0x552a('0x24')][_0x5179b1[_0x552a('0x133')]][_0x552a('0x134')]){this[_0x552a('0x24')][_0x5179b1['stateinterface']][_0x552a('0x134')]=!![];this[_0x552a('0x27')][_0x5179b1[_0x552a('0x12f')]][_0x552a('0x134')]=!![];this[_0x552a('0x27')][_0x5179b1['actionid']][_0x552a('0x133')]=_0x5179b1[_0x552a('0x133')];}}}}else if((strategy[this[_0x552a('0x22')][this[_0x552a('0x27')][_0x5179b1['actionid']]['queue']]['strategy']]||_0x552a('0x1d'))===_0x552a('0x1d')){if(this[_0x552a('0x27')][_0x5179b1[_0x552a('0x12f')]]){if(this[_0x552a('0x24')][_0x5179b1[_0x552a('0x133')]]){this[_0x552a('0x27')][_0x5179b1[_0x552a('0x12f')]][_0x552a('0x133')]=_0x5179b1[_0x552a('0x133')];if(_[_0x552a('0xb4')](this[_0x552a('0x135')][this[_0x552a('0x27')][_0x5179b1[_0x552a('0x12f')]][_0x552a('0xbb')]])){this[_0x552a('0x135')][this[_0x552a('0x27')][_0x5179b1[_0x552a('0x12f')]][_0x552a('0xbb')]]=[];}this[_0x552a('0x135')][this[_0x552a('0x27')][_0x5179b1['actionid']][_0x552a('0xbb')]][_0x552a('0x136')](_[_0x552a('0xd8')](_[_0x552a('0xd9')](this[_0x552a('0x27')][_0x5179b1['actionid']],[_0x552a('0x137'),'stateinterface']),{'status':_0x5179b1[_0x552a('0xb6')],'paused':_0x5179b1[_0x552a('0x132')]}));}}}};function unlockQueueStatus(_0x125760,_0x55a856){setTimeout(function(){if(_[_0x552a('0x40')](_0x125760[_0x552a('0x138')])){loggerBooked['error'](_0x552a('0x139'),_0x55a856);}_0x125760[_0x552a('0x138')]=!![];loggerBooked[_0x552a('0x82')](_0x552a('0x13a'),_0x55a856,JSON[_0x552a('0x4c')](_[_0x552a('0xd9')](_0x125760,['name',_0x552a('0x138')])));},0x1f3);}Dialer['prototype'][_0x552a('0x3e')]=function(_0x4a7fdc){var _0x482c7e=this;var _0x30a4a3=_0x482c7e[_0x552a('0x22')][_0x482c7e[_0x552a('0x27')][_0x4a7fdc[_0x552a('0x12f')]]['queue']];if(strategy[this[_0x552a('0x22')][this[_0x552a('0x27')][_0x4a7fdc[_0x552a('0x12f')]][_0x552a('0xbb')]][_0x552a('0x130')]]===_0x552a('0x131')){if(this[_0x552a('0x27')][_0x4a7fdc[_0x552a('0x12f')]]&&this[_0x552a('0x27')][_0x4a7fdc['actionid']]['stateinterface']){this['preview'][_0x552a('0x13b')](this['actions'][_0x4a7fdc['actionid']][_0x552a('0x137')],this[_0x552a('0x27')][_0x4a7fdc[_0x552a('0x12f')]][_0x552a('0x133')])[_0x552a('0xb8')](function(_0x348b5d){logger[_0x552a('0x97')](_0x552a('0x13c'),util[_0x552a('0x99')](_0x348b5d,{'showHidden':![],'depth':null}));})[_0x552a('0x20')](function(){_0x482c7e[_0x552a('0xba')](_0x482c7e[_0x552a('0x22')][_0x482c7e['actions'][_0x4a7fdc['actionid']][_0x552a('0xbb')]]);_0x482c7e['agents'][_0x482c7e[_0x552a('0x27')][_0x4a7fdc['actionid']][_0x552a('0x133')]][_0x552a('0x134')]=![];delete _0x482c7e['actions'][_0x4a7fdc[_0x552a('0x12f')]];unlockQueueStatus(_0x30a4a3);});}else{this['updateOriginated'](this[_0x552a('0x22')][this[_0x552a('0x27')][_0x4a7fdc[_0x552a('0x12f')]]['queue']]);this[_0x552a('0xff')]({'active':![],'ContactId':this['actions'][_0x4a7fdc[_0x552a('0x12f')]][_0x552a('0xda')],'ListId':this[_0x552a('0x27')][_0x4a7fdc[_0x552a('0x12f')]][_0x552a('0xdb')],'VoiceQueueId':this['actions'][_0x4a7fdc[_0x552a('0x12f')]][_0x552a('0xdc')]||undefined,'CampaignId':this[_0x552a('0x27')][_0x4a7fdc['actionid']]['CampaignId']||undefined})[_0x552a('0xb8')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x552a('0x27')][_0x4a7fdc[_0x552a('0x12f')]];unlockQueueStatus(_0x30a4a3);}}else if((strategy[this[_0x552a('0x22')][this['actions'][_0x4a7fdc['actionid']][_0x552a('0xbb')]]['strategy']]||_0x552a('0x1d'))===_0x552a('0x1d')){var _0x1264e9;if(this[_0x552a('0x27')][_0x4a7fdc[_0x552a('0x12f')]]&&!_[_0x552a('0x4a')](this[_0x552a('0x135')][this[_0x552a('0x27')][_0x4a7fdc[_0x552a('0x12f')]]['queue']])){if(this[_0x552a('0x2d')][_0x482c7e[_0x552a('0x27')][_0x4a7fdc[_0x552a('0x12f')]][_0x552a('0xbb')]]){this[_0x552a('0x2d')][_0x482c7e[_0x552a('0x27')][_0x4a7fdc['actionid']][_0x552a('0xbb')]]=this[_0x552a('0x2d')][this['actions'][_0x4a7fdc['actionid']]['queue']]?this[_0x552a('0x2d')][this[_0x552a('0x27')][_0x4a7fdc[_0x552a('0x12f')]][_0x552a('0xbb')]]:this[_0x552a('0x135')][this['actions'][_0x4a7fdc[_0x552a('0x12f')]][_0x552a('0xbb')]]?this[_0x552a('0x135')][this[_0x552a('0x27')][_0x4a7fdc['actionid']][_0x552a('0xbb')]][_0x552a('0x13d')]||0x0:0x0;}this[_0x552a('0x135')][this[_0x552a('0x27')][_0x4a7fdc[_0x552a('0x12f')]][_0x552a('0xbb')]][_0x552a('0x13d')]=this[_0x552a('0x2d')][this['actions'][_0x4a7fdc[_0x552a('0x12f')]][_0x552a('0xbb')]];for(var _0x347c75=0x0;_0x347c75=0x0?!![]:![];})['catch'](myreject(_0x51b28b)));}}else{_0x7883a2[_0x552a('0x136')](ami[_0x552a('0xb5')]({'action':_0x552a('0x150'),'command':util['format'](_0x552a('0x156'),_0x2ae489,!_[_0x552a('0x40')](config[_0x552a('0x152')][_0x50d2d5])?_0x50d2d5:'')})[_0x552a('0xc5')](function(_0x4208e2){return _0x4208e2[_0x552a('0x153')][_0x552a('0x154')]('true')>=0x0?!![]:![];})[_0x552a('0xb8')](myreject(_0x51b28b)));}BPromise[_0x552a('0x157')](_0x7883a2)[_0x552a('0xc5')](function(_0x333552){var _0x43bbdf=_['some'](_0x333552);if(_0x43bbdf){return _0x5e26d9(_0x43bbdf);}else{_0x1a0a1b[_0x552a('0x41')]=_0x319219?_0x552a('0x158'):_0x552a('0x159');return _0x51b28b(msgResponse(_0x552a('0x15a'),_0x552a('0x14b'),_0x552a('0x15b')+_0x319219+'\x20'+_0x19c773+_0x552a('0x15c')+util['inspect'](_0x2ae489,{'showHidden':![],'depth':null})+_0x552a('0x15d')+_0x50d2d5));}})[_0x552a('0xb8')](function(_0x3aebcd){return _0x51b28b(msgResponse(_0x552a('0x14a'),'Failure',JSON['stringify'](_0x3aebcd)));});});};Dialer[_0x552a('0xae')][_0x552a('0x15e')]=function(_0x15b1f1){var _0x3c7955=this;return function(){switch(_0x15b1f1[_0x552a('0x5f')]){case'progressive':freeVariablesPredictive(_0x15b1f1);_0x3c7955[_0x552a('0x15f')](_0x15b1f1,0x1);break;case _0x552a('0x160'):freeVariablesPredictive(_0x15b1f1);_0x3c7955['handlePower'](_0x15b1f1,_0x15b1f1['dialPowerLevel']);break;case _0x552a('0xb'):_0x3c7955[_0x552a('0xb')](_0x15b1f1);break;case'booked':freeVariablesPredictive(_0x15b1f1);_0x3c7955[_0x552a('0x15f')](_0x15b1f1,0x1);break;default:freeVariablesPredictive(_0x15b1f1);logger[_0x552a('0x97')](_0x552a('0x161'),_0x15b1f1[_0x552a('0x43')],_0x552a('0x162'));}};};Dialer[_0x552a('0xae')][_0x552a('0x163')]=function(_0x3f1030){var _0x1b1ca8=this;return function(){_0x1b1ca8['handleIvr'](_0x3f1030);};};Dialer[_0x552a('0xae')]['syncQueueSummary']=function(_0x3768e){var _0xbe057=this;if(isNotPreview(_0x3768e['dialMethod'])){if(isVoiceQueueOutbound(_0x3768e[_0x552a('0x51')])&&isActive(_0x3768e[_0x552a('0x5e')])){_0x3768e[_0x552a('0xa3')]=!![];BPromise[_0x552a('0xbf')]()[_0x552a('0xc5')](checkIsLoggedIn(_0x3768e,_0x3768e[_0x552a('0x55')]))[_0x552a('0xc5')](checkIsActive(_0x3768e,_0x3768e[_0x552a('0x5e')]))[_0x552a('0xc5')](checkInterval(_0x3768e))[_0x552a('0xc5')](_0xbe057[_0x552a('0x147')](_0x3768e))[_0x552a('0xc5')](_0xbe057['checkIfTime'](_0x3768e[_0x552a('0x164')],_0x3768e[_0x552a('0x165')],_0x3768e[_0x552a('0x43')],_0x3768e))[_0x552a('0xc5')](_0xbe057['checkIfTimeIntervals'](_0x3768e[_0x552a('0x46')],_0x3768e[_0x552a('0x165')],_0x3768e['name'],_0x3768e))[_0x552a('0xc5')](_0xbe057['checkDialMethod'](_0x3768e))[_0x552a('0xb8')](loggerCatchQueueSummary(_0x552a('0x166'),_0x3768e));}else{notSendMessagesQueue(_0x3768e);}}else{freeVariablesPredictive(_0x3768e);}};Dialer[_0x552a('0xae')]['syncCampaigns']=function(){var _0x296a9b=this;var _0x5bb068;for(var _0x483e00 in this[_0x552a('0x23')]){if(this[_0x552a('0x23')][_0x552a('0x9b')](_0x483e00)){_0x5bb068=this[_0x552a('0x23')][_0x483e00];if(isCampaignIvr(_0x5bb068[_0x552a('0x51')])&&isActive(_0x5bb068[_0x552a('0x7a')])){_0x5bb068[_0x552a('0xa3')]=!![];BPromise[_0x552a('0xbf')]()[_0x552a('0xc5')](checkIsActive(_0x5bb068,_0x5bb068[_0x552a('0x7a')]))[_0x552a('0xc5')](checkInterval(_0x5bb068))['then'](_0x296a9b[_0x552a('0x147')](_0x5bb068))[_0x552a('0xc5')](_0x296a9b[_0x552a('0x149')](_0x5bb068[_0x552a('0x164')],_0x5bb068['dialTimezone'],_0x5bb068[_0x552a('0x43')],_0x5bb068))[_0x552a('0xc5')](_0x296a9b[_0x552a('0x167')](_0x5bb068[_0x552a('0x46')],_0x5bb068[_0x552a('0x165')],_0x5bb068[_0x552a('0x43')],_0x5bb068))[_0x552a('0xc5')](_0x296a9b['launchHandleIvr'](_0x5bb068))[_0x552a('0xb8')](loggerCatchQueueSummary(_0x552a('0x168'),_0x5bb068));}else{notSendMessagesCampaign(_0x5bb068);}}}};function getCallerIdRandom(_0x306d38,_0x1d864c){var _0x1cbecc,_0x538f68,_0x4367a7;if(_0x1d864c<=0x0){_0x1d864c=0x1;}_0x1cbecc=new RegExp('\x5cw{0,'+_0x1d864c+'}$');_0x538f68=Math['pow'](0xa,_0x1d864c-0x1);_0x4367a7=Math[_0x552a('0x169')](0xa,_0x1d864c)-0x1;return util[_0x552a('0x7c')]('%s',_[_0x552a('0x16a')](_0x306d38,_0x1cbecc,_[_0x552a('0x16b')](_0x538f68,_0x4367a7)));}function extractCalleridName(_0x26ea70){var _0x2bcebb=_0x26ea70[_0x552a('0x16c')](/"(.*?)"/);return _0x2bcebb?_0x2bcebb[0x1]:_0x26ea70;}function extractCalleridNumber(_0x53efbf){var _0x1d5e1f=_0x53efbf[_0x552a('0x16c')](/<(.*?)>/);return _0x1d5e1f?_0x1d5e1f[0x1]:_0x53efbf;}Dialer['prototype']['actionOriginate']=function(_0x1ea9ce,_0x462c20){var _0x3dd793=this;var _0x3060a4=uuid['v4']();this[_0x552a('0x27')][_0x3060a4]=new Action(_0x1ea9ce,_0x462c20,_0x3060a4);return new BPromise(function(_0x5115b8,_0x3bcee9){if(_[_0x552a('0x40')](_0x1ea9ce)&&'object'!==typeof _0x1ea9ce){return _0x3bcee9(msgResponse('originate',_0x552a('0x14b'),'voiceQueue\x20is\x20undefine'));}if(_[_0x552a('0x40')](_0x462c20['Contact'][_0x552a('0x16d')])||_0x462c20[_0x552a('0x16e')][_0x552a('0x16d')]===null){return _0x3bcee9(msgResponse(_0x552a('0x16f'),_0x552a('0x14b'),'contact\x20is\x20undefine'));}var _0x12b986={'XMD-CALLERID':_0x3dd793[_0x552a('0x27')][_0x3060a4][_0x552a('0x170')](),'XMD-AGI':_0x1ea9ce['dialQueueProject']?util[_0x552a('0x7c')](_0x552a('0x171'),ipAgi,_0x1ea9ce[_0x552a('0x10f')]):_0x552a('0x172'),'XMD-AGIAFTER':_0x1ea9ce['dialQueueProject2']?util['format'](_0x552a('0x171'),ipAgi,_0x1ea9ce[_0x552a('0x116')]):'NONE','XMD-QUEUE':_0x1ea9ce[_0x552a('0x51')]===_0x552a('0x52')?util[_0x552a('0x7c')]('\x22%s,%s%s,,,%s\x22',_0x1ea9ce[_0x552a('0x43')],_0x1ea9ce[_0x552a('0x173')]||'',_0x1ea9ce['dialAgiAfterHangupAgent']?'c':'',_0x1ea9ce[_0x552a('0x11d')]||0x3):_0x552a('0x172'),'XMD-CONTACTID':_0x462c20[_0x552a('0xda')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3dd793[_0x552a('0x27')][_0x3060a4][_0x552a('0x170')](),'XMD-AMD':_0x1ea9ce[_0x552a('0xe8')]?'ACTIVE':_0x552a('0x172'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x1ea9ce[_0x552a('0xe8')]){_0x12b986[_0x552a('0x174')]=_0x1ea9ce[_0x552a('0x175')]||0x9c4;_0x12b986['XMD-AMDGREETING']=_0x1ea9ce[_0x552a('0x176')]||0x5dc;_0x12b986[_0x552a('0x177')]=_0x1ea9ce[_0x552a('0x178')]||0x320;_0x12b986['XMD-AMDTOTALANALYSISTIME']=_0x1ea9ce['dialAMDTotalAnalysisTime']||0x1388;_0x12b986[_0x552a('0x179')]=_0x1ea9ce[_0x552a('0x17a')]||0x64;_0x12b986[_0x552a('0x17b')]=_0x1ea9ce['dialAMDBetweenWordsSilence']||0x32;_0x12b986[_0x552a('0x17c')]=_0x1ea9ce[_0x552a('0x17d')]||0x3;_0x12b986[_0x552a('0x17e')]=_0x1ea9ce[_0x552a('0x17f')]||0x100;_0x12b986[_0x552a('0x180')]=_0x1ea9ce[_0x552a('0x181')]||0x1388;}if(_0x1ea9ce[_0x552a('0x51')]===_0x552a('0x52')){_0x12b986[_0x552a('0x182')]=_0x462c20[_0x552a('0xdc')];}else{_0x12b986[_0x552a('0x183')]=_0x462c20[_0x552a('0x102')];}for(var _0x21b68a in _0x462c20[_0x552a('0x16e')]){if(_0x462c20['Contact']['hasOwnProperty'](_0x21b68a)){if(isNotNull(_0x462c20[_0x552a('0x16e')][_0x21b68a])&&_0x21b68a!=='id'&&_0x21b68a!==_0x552a('0x184')&&_0x21b68a!==_0x552a('0x185')&&_0x21b68a!==_0x552a('0x186')){_0x12b986[util[_0x552a('0x7c')](_0x552a('0x187'),_0x552a('0x188'),_['toUpper'](_0x21b68a))]=_0x462c20[_0x552a('0x16e')][_0x21b68a];}}}var _0x17470b=_0x3dd793[_0x552a('0xe1')](_0x1ea9ce[_0x552a('0x79')])?getCallerId(_0x1ea9ce[_0x552a('0x79')][_0x552a('0x7b')],_0x1ea9ce[_0x552a('0x60')],_0x1ea9ce[_0x552a('0x189')]>0x0?getCallerIdRandom(_0x1ea9ce[_0x552a('0x61')],_0x1ea9ce[_0x552a('0x189')]):_0x1ea9ce['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x1ea9ce[_0x552a('0x148')])?_0x1ea9ce['Trunk'][_0x552a('0x7b')]:_0x1ea9ce[_0x552a('0x148')][_0x552a('0x7b')],_0x1ea9ce['dialOriginateCallerIdName'],_0x1ea9ce['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x1ea9ce[_0x552a('0x61')],_0x1ea9ce[_0x552a('0x189')]):_0x1ea9ce[_0x552a('0x61')]);if(_0x17470b){_0x12b986['XMD-ORIGINATECALLERIDNAME']=_0x3dd793['actions'][_0x3060a4][_0x552a('0x18a')]=extractCalleridName(_0x17470b);_0x12b986[_0x552a('0x18b')]=_0x3dd793[_0x552a('0x27')][_0x3060a4]['originatecalleridnum']=extractCalleridNumber(_0x17470b);}return ami[_0x552a('0xb5')]({'actionid':_0x3060a4,'action':_0x552a('0x16f'),'channel':_0x3dd793['isTrunkReachable'](_0x1ea9ce[_0x552a('0x79')])?util[_0x552a('0x7c')]('SIP/%s/%s%s',_0x1ea9ce['Trunk'][_0x552a('0x43')],isNotNull(_0x1ea9ce[_0x552a('0x18c')])?_0x1ea9ce[_0x552a('0x18c')][_0x552a('0x18d')]()||'':'',_0x1ea9ce['dialCutDigit']>0x0?_0x462c20['Contact'][_0x552a('0x16d')][_0x552a('0x18e')](_0x1ea9ce[_0x552a('0x18f')]):_0x462c20[_0x552a('0x16e')][_0x552a('0x16d')]):util['format'](_0x552a('0x190'),_['isNil'](_0x1ea9ce[_0x552a('0x148')])?_0x1ea9ce[_0x552a('0x79')][_0x552a('0x43')]:_0x1ea9ce[_0x552a('0x148')][_0x552a('0x43')],isNotNull(_0x1ea9ce['dialPrefix'])?_0x1ea9ce[_0x552a('0x18c')][_0x552a('0x18d')]()||'':'',_0x1ea9ce['dialCutDigit']>0x0?_0x462c20[_0x552a('0x16e')][_0x552a('0x16d')][_0x552a('0x18e')](_0x1ea9ce['dialCutDigit']):_0x462c20[_0x552a('0x16e')][_0x552a('0x16d')]),'callerid':_0x17470b,'Exten':_0x552a('0xe7'),'Context':'from-sip','Priority':'1','variable':_0x12b986,'timeout':(_0x1ea9ce[_0x552a('0x62')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3060a4})[_0x552a('0xc5')](function(_0x2257d3){return _0x5115b8(_0x2257d3);})['catch'](function(_0x43075e){_0x1ea9ce['outboundOriginateFailureCallsDay']+=0x1;var _0x3326a2=new History(_0x3dd793[_0x552a('0x27')][_0x3060a4]);logger[_0x552a('0x97')](util[_0x552a('0x7c')](_0x552a('0x191'),JSON['stringify'](_0x43075e)));_0x3326a2['state']=0xe;_0x3326a2[_0x552a('0xab')]=_0x552a('0x192');_0x3326a2['starttime']=moment()[_0x552a('0x7c')](_0x552a('0x10b'));_0x3326a2['endtime']=_0x3326a2[_0x552a('0xad')];_0x3dd793[_0x552a('0xd1')](_0x3326a2)[_0x552a('0xb8')](loggerCatch(_0x552a('0x193')));_0x3dd793[_0x552a('0xcf')](_0x3326a2)[_0x552a('0xb8')](loggerCatch(_0x552a('0x193')))[_0x552a('0x20')](function(){delete _0x3dd793[_0x552a('0x27')][_0x3060a4];return _0x3bcee9(msgResponse('originate',_0x552a('0x4b'),_0x552a('0x194')));});});});};Dialer[_0x552a('0xae')][_0x552a('0x32')]=function(_0x41cce0){var _0x1f0986=this[_0x552a('0x27')][_0x41cce0['actionid']];var _0x3d91a6=this;if(_0x1f0986){delete this['actions'][_0x41cce0[_0x552a('0x12f')]];_0x1f0986[_0x552a('0x11c')]=moment()[_0x552a('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4dfbbb=_0x1f0986['type']==='ivr'?this[_0x552a('0x23')][_0x1f0986[_0x552a('0xbb')]]:this['voiceQueues'][_0x1f0986[_0x552a('0x195')]()];if(!this[_0x552a('0xdf')](_0x41cce0[_0x552a('0x196')])){this[_0x552a('0xba')](_0x4dfbbb);return this['callProgressDetecting'](_0x1f0986,_0x4dfbbb,_0x41cce0)['then'](function(_0x84c58d){})[_0x552a('0xb8')](loggerCatch('[callProgressDetecting]\x20'));}else{this[_0x552a('0x29')][_0x41cce0[_0x552a('0xea')]]=_0x1f0986;}}};Dialer['prototype'][_0x552a('0x197')]=function(_0x4ccda5,_0x389c84,_0x42cbd0){var _0x41dcd8=new History(_0x389c84);if(_0x41dcd8[_0x552a('0xf5')]+_0x41dcd8['countcongestionretry']+_0x41dcd8[_0x552a('0x107')]+_0x41dcd8['countnosuchnumberretry']+_0x41dcd8[_0x552a('0xf7')]+_0x41dcd8[_0x552a('0xf8')]+_0x41dcd8[_0x552a('0xf2')]+_0x41dcd8['countagentrejectretry']>=_0x42cbd0[_0x552a('0xfa')]-0x1){return!![];}switch(_0x4ccda5){case 0x3:if(_0x41dcd8[_0x552a('0x107')]>=_0x42cbd0[_0x552a('0x198')]-0x1){return!![];}else{this[_0x552a('0xff')]({'active':![],'countnoanswerretry':_0x41dcd8['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x42cbd0[_0x552a('0x199')],'minutes')[_0x552a('0x7c')](_0x552a('0x10b')),'ContactId':_0x41dcd8[_0x552a('0xda')],'ListId':_0x41dcd8[_0x552a('0xdb')],'VoiceQueueId':_0x41dcd8['VoiceQueueId']||undefined,'CampaignId':_0x41dcd8[_0x552a('0x102')]||undefined})['catch'](loggerCatch(_0x552a('0x19a')));}break;case 0x5:if(_0x41dcd8[_0x552a('0xf5')]>=_0x42cbd0['dialBusyMaxRetry']-0x1){return!![];}else{this[_0x552a('0xff')]({'active':![],'countbusyretry':_0x41dcd8[_0x552a('0xf5')]+=0x1,'scheduledat':moment()[_0x552a('0x100')](_0x42cbd0[_0x552a('0x19b')],_0x552a('0x10a'))[_0x552a('0x7c')](_0x552a('0x10b')),'ContactId':_0x41dcd8[_0x552a('0xda')],'ListId':_0x41dcd8[_0x552a('0xdb')],'VoiceQueueId':_0x41dcd8[_0x552a('0xdc')]||undefined,'CampaignId':_0x41dcd8[_0x552a('0x102')]||undefined})[_0x552a('0xb8')](loggerCatch(_0x552a('0x19c')));}break;case 0x8:if(_0x41dcd8['countcongestionretry']>=_0x42cbd0[_0x552a('0x19d')]-0x1){return!![];}else{this[_0x552a('0xff')]({'active':![],'countcongestionretry':_0x41dcd8['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x42cbd0['dialCongestionRetryFrequency'],_0x552a('0x10a'))['format'](_0x552a('0x10b')),'ContactId':_0x41dcd8['ContactId'],'ListId':_0x41dcd8[_0x552a('0xdb')],'VoiceQueueId':_0x41dcd8['VoiceQueueId']||undefined,'CampaignId':_0x41dcd8[_0x552a('0x102')]||undefined})['catch'](loggerCatch(_0x552a('0x19e')));}break;case 0x0:if(_0x41dcd8[_0x552a('0x108')]>=_0x42cbd0[_0x552a('0x19f')]-0x1){return!![];}else{this[_0x552a('0xff')]({'active':![],'countnosuchnumberretry':_0x41dcd8[_0x552a('0x108')]+=0x1,'scheduledat':moment()[_0x552a('0x100')](_0x42cbd0[_0x552a('0x1a0')],_0x552a('0x10a'))[_0x552a('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x41dcd8[_0x552a('0xda')],'ListId':_0x41dcd8[_0x552a('0xdb')],'VoiceQueueId':_0x41dcd8[_0x552a('0xdc')]||undefined,'CampaignId':_0x41dcd8[_0x552a('0x102')]||undefined})[_0x552a('0xb8')](loggerCatch(_0x552a('0x1a1')));}break;case 0xa:if(_0x41dcd8[_0x552a('0xf7')]>=_0x42cbd0[_0x552a('0x123')]-0x1){return!![];}else{this[_0x552a('0xff')]({'active':![],'countdropretry':_0x41dcd8['countdropretry']+=0x1,'scheduledat':moment()[_0x552a('0x100')](_0x42cbd0[_0x552a('0x125')],_0x552a('0x10a'))[_0x552a('0x7c')](_0x552a('0x10b')),'ContactId':_0x41dcd8[_0x552a('0xda')],'ListId':_0x41dcd8[_0x552a('0xdb')],'VoiceQueueId':_0x41dcd8['VoiceQueueId']||undefined,'CampaignId':_0x41dcd8[_0x552a('0x102')]||undefined})[_0x552a('0xb8')](loggerCatch(_0x552a('0x126')));}break;case 0xb:if(_0x41dcd8[_0x552a('0xf8')]>=_0x42cbd0[_0x552a('0x12b')]-0x1){return!![];}else{this[_0x552a('0xff')]({'active':![],'countabandonedretry':_0x41dcd8[_0x552a('0xf8')]+=0x1,'scheduledat':moment()[_0x552a('0x100')](_0x42cbd0['dialAbandonedRetryFrequency'],_0x552a('0x10a'))[_0x552a('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x41dcd8[_0x552a('0xda')],'ListId':_0x41dcd8['ListId'],'VoiceQueueId':_0x41dcd8[_0x552a('0xdc')]||undefined,'CampaignId':_0x41dcd8[_0x552a('0x102')]||undefined})[_0x552a('0xb8')](loggerCatch(_0x552a('0x12c')));}break;case 0x13:if(_0x41dcd8[_0x552a('0xf2')]>=_0x42cbd0['dialMachineMaxRetry']-0x1){return!![];}else{this[_0x552a('0xff')]({'active':![],'countmachineretry':_0x41dcd8[_0x552a('0xf2')]+=0x1,'scheduledat':moment()[_0x552a('0x100')](_0x42cbd0[_0x552a('0x101')],'minutes')[_0x552a('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x41dcd8[_0x552a('0xda')],'ListId':_0x41dcd8[_0x552a('0xdb')],'VoiceQueueId':_0x41dcd8['VoiceQueueId']||undefined,'CampaignId':_0x41dcd8[_0x552a('0x102')]||undefined})[_0x552a('0xb8')](loggerCatch(_0x552a('0x103')));}break;case 0x14:if(_0x41dcd8[_0x552a('0xf9')]>=_0x42cbd0[_0x552a('0x1a2')]-0x1){return!![];}else{this[_0x552a('0xff')]({'active':![],'countagentrejectretry':_0x41dcd8['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x552a('0x100')](_0x42cbd0[_0x552a('0x1a3')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x41dcd8[_0x552a('0xda')],'ListId':_0x41dcd8['ListId'],'VoiceQueueId':_0x41dcd8[_0x552a('0xdc')]||undefined,'CampaignId':_0x41dcd8[_0x552a('0x102')]||undefined})[_0x552a('0xb8')](loggerCatch(_0x552a('0x1a4')));}break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x5ab74f,_0x330e09,_0xcfb0b1){var _0x50c82a=this;var _0x476fc9=new History(_0x5ab74f);return new BPromise(function(_0x5385c0,_0x3cd306){if(_[_0x552a('0x40')](_0x330e09)&&_0x552a('0x1a5')!==typeof _0x330e09){return _0x3cd306(msgResponse(_0x552a('0x1a6'),_0x552a('0x14b'),_0x552a('0x1a7')));}if(_[_0x552a('0x40')](_0xcfb0b1)&&_0x552a('0x1a5')!==typeof _0xcfb0b1){return _0x3cd306(msgResponse(_0x552a('0x1a6'),_0x552a('0x14b'),_0x552a('0x1a8')));}switch(_0xcfb0b1[_0x552a('0x114')]){case'0':_0x330e09[_0x552a('0x6a')]+=0x1;_0x476fc9[_0x552a('0xaa')]=0x0;_0x476fc9[_0x552a('0xab')]=_0x552a('0x1a9');_0x476fc9['countnosuchnumberretry']+=0x1;_0x476fc9[_0x552a('0x106')]+=0x1;ami[_0x552a('0x50')]('custom:agentnosuchnumber',ut[_0x552a('0x1aa')](_0x5ab74f,_0x552a('0x1ab')));_0x50c82a['createHistory'](_0x476fc9)['catch'](loggerCatch(_0x552a('0xf4')));if(_0x50c82a[_0x552a('0x197')](0x0,_0x5ab74f,_0x330e09)){if(_0x476fc9['countnosuchnumberretry']>=_0x330e09[_0x552a('0x19f')]){_0x50c82a[_0x552a('0xfd')](_0x476fc9,_0x5385c0,_0x3cd306,_0x552a('0x1ac'));}else{_0x50c82a[_0x552a('0xfb')](_0x476fc9,_0x5385c0,_0x3cd306,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x330e09[_0x552a('0x1ad')]+=0x1;_0x476fc9[_0x552a('0xaa')]=0x3;_0x476fc9['statedesc']=_0x552a('0x1ae');_0x476fc9[_0x552a('0x107')]+=0x1;_0x476fc9['countglobal']+=0x1;ami[_0x552a('0x50')](_0x552a('0x1af'),ut[_0x552a('0x1aa')](_0x5ab74f,_0x552a('0x1b0')));_0x50c82a[_0x552a('0xd1')](_0x476fc9)[_0x552a('0xb8')](loggerCatch(_0x552a('0x1b1')));if(_0x50c82a[_0x552a('0x197')](0x3,_0x5ab74f,_0x330e09)){if(_0x476fc9['countnoanswerretry']>=_0x330e09[_0x552a('0x198')]){_0x50c82a[_0x552a('0xfd')](_0x476fc9,_0x5385c0,_0x3cd306,_0x552a('0x1b2'));}else{_0x50c82a[_0x552a('0xfb')](_0x476fc9,_0x5385c0,_0x3cd306,_0x552a('0x1b2'));}}break;case'5':_0x330e09[_0x552a('0x66')]+=0x1;_0x476fc9[_0x552a('0xaa')]=0x5;_0x476fc9[_0x552a('0xab')]=_0x552a('0x1b3');_0x476fc9[_0x552a('0xf5')]+=0x1;_0x476fc9[_0x552a('0x106')]+=0x1;ami[_0x552a('0x50')](_0x552a('0x1b4'),ut[_0x552a('0x1aa')](_0x5ab74f,_0x552a('0x1b5')));_0x50c82a['createHistory'](_0x476fc9)['catch'](loggerCatch(_0x552a('0x1b6')));if(_0x50c82a['checkRetriveMax'](0x5,_0x5ab74f,_0x330e09)){if(_0x476fc9[_0x552a('0xf5')]>=_0x330e09['dialBusyMaxRetry']){_0x50c82a[_0x552a('0xfd')](_0x476fc9,_0x5385c0,_0x3cd306,'reason\x205\x20busy');}else{_0x50c82a['stateGlobal'](_0x476fc9,_0x5385c0,_0x3cd306,'reason\x205\x20busy');}}break;case'8':_0x330e09[_0x552a('0x67')]+=0x1;_0x476fc9['state']=0x8;_0x476fc9[_0x552a('0xab')]=_0x552a('0x1b7');_0x476fc9['countcongestionretry']+=0x1;_0x476fc9[_0x552a('0x106')]+=0x1;ami[_0x552a('0x50')](_0x552a('0x1b8'),ut[_0x552a('0x1aa')](_0x5ab74f,_0x552a('0x1b9')));_0x50c82a[_0x552a('0xd1')](_0x476fc9)[_0x552a('0xb8')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x50c82a[_0x552a('0x197')](0x8,_0x5ab74f,_0x330e09)){if(_0x476fc9[_0x552a('0xf6')]>=_0x330e09['dialCongestionMaxRetry']){_0x50c82a[_0x552a('0xfd')](_0x476fc9,_0x5385c0,_0x3cd306,_0x552a('0x1ba'));}else{_0x50c82a['stateGlobal'](_0x476fc9,_0x5385c0,_0x3cd306,_0x552a('0x1ba'));}}break;case'11':_0x330e09['outboundAbandonedCallsDay']+=0x1;_0x476fc9[_0x552a('0xaa')]=0xb;_0x476fc9[_0x552a('0xab')]=_0x552a('0x12d');_0x476fc9[_0x552a('0xf8')]+=0x1;_0x476fc9[_0x552a('0x106')]+=0x1;_0x50c82a[_0x552a('0xd1')](_0x476fc9)[_0x552a('0xb8')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x50c82a[_0x552a('0x197')](0xb,_0x5ab74f,_0x330e09)){if(_0x476fc9['countabandonedretry']>=_0x330e09[_0x552a('0x12b')]){_0x50c82a['createStateFinal'](_0x476fc9,_0x5385c0,_0x3cd306,'reason\x2011\x20abandoned');}else{_0x50c82a['stateGlobal'](_0x476fc9,_0x5385c0,_0x3cd306,_0x552a('0x1bb'));}}break;case'20':_0x330e09[_0x552a('0x1bc')]+=0x1;_0x476fc9[_0x552a('0xaa')]=0x14;_0x476fc9[_0x552a('0xab')]='AgentReject';_0x476fc9['countagentrejectretry']+=0x1;_0x476fc9[_0x552a('0x106')]+=0x1;ami[_0x552a('0x50')](_0x552a('0x1bd'),ut[_0x552a('0x1aa')](_0x5ab74f,_0x552a('0x1be')));_0x50c82a[_0x552a('0xd1')](_0x476fc9)[_0x552a('0xb8')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x50c82a[_0x552a('0x197')](0x14,_0x5ab74f,_0x330e09)){if(_0x476fc9['countagentrejectretry']>=_0x330e09[_0x552a('0x1a2')]){_0x50c82a['createStateFinal'](_0x476fc9,_0x5385c0,_0x3cd306,_0x552a('0x1bf'));}else{_0x50c82a['stateGlobal'](_0x476fc9,_0x5385c0,_0x3cd306,_0x552a('0x1bf'));}}break;default:_0x330e09[_0x552a('0x6c')]+=0x1;_0x476fc9[_0x552a('0xaa')]=0xc;_0x476fc9['statedesc']=_0xcfb0b1[_0x552a('0x114')];_0x50c82a[_0x552a('0xd1')](_0x476fc9)[_0x552a('0xb8')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x50c82a[_0x552a('0x197')](_0xcfb0b1['reason'],_0x5ab74f,_0x330e09)){if(_0x476fc9[_0x552a('0xf5')]+_0x476fc9[_0x552a('0xf6')]+_0x476fc9[_0x552a('0x107')]+_0x476fc9[_0x552a('0x108')]+_0x476fc9[_0x552a('0xf7')]+_0x476fc9[_0x552a('0xf8')]+_0x476fc9[_0x552a('0xf2')]+_0x476fc9[_0x552a('0xf9')]>=_0x330e09[_0x552a('0xfa')]){_0x50c82a['stateGlobal'](_0x476fc9,_0x5385c0,_0x3cd306,_0xcfb0b1['reason']);}else{_0x50c82a[_0x552a('0xfd')](_0x476fc9,_0x5385c0,_0x3cd306,_0xcfb0b1[_0x552a('0x114')]);}}}});};Dialer[_0x552a('0xae')][_0x552a('0xfb')]=function(_0x3886c8,_0x81ab8d,_0x4cfc46,_0x1fe9ab){var _0x51371c=new Final(_0x3886c8);_0x51371c[_0x552a('0xaa')]=0xf;_0x51371c['statedesc']='Global';this[_0x552a('0xfd')](_0x51371c,_0x81ab8d,_0x4cfc46,_0x1fe9ab);};Dialer['prototype'][_0x552a('0xfd')]=function(_0x176c58,_0x1d9b67,_0x3578e2,_0x4cb271){this[_0x552a('0xcf')](_0x176c58)[_0x552a('0xc5')](function(_0x58e98d){return _0x1d9b67(msgResponse(_0x552a('0x1a6'),'Success',_0x4cb271));})[_0x552a('0xb8')](function(_0xd0a1b){return _0x3578e2(msgResponse(_0x552a('0x1c0'),_0x552a('0x14b'),_0x552a('0x1c1')));});};Dialer['prototype'][_0x552a('0xb')]=function(_0x453262){var _0x501305=this;var _0x539388=_0x453262[_0x552a('0x1c2')]/0x64;var _0x222a0a=_0x453262[_0x552a('0x11e')]/(_0x453262[_0x552a('0x11e')]+_0x453262[_0x552a('0x64')]);var _0x229926=Math[_0x552a('0x1c3')](_0x453262[_0x552a('0x74')]*(_0x453262[_0x552a('0x1c4')]/0x64));var _0x5e6abf=Math[_0x552a('0x1c3')](_0x453262['predictiveIntervalAvailable']*(_0x453262[_0x552a('0x1c5')]/0x64));var _0x371e96=_0x453262['available']+_0x453262['talking'];var _0x1b95b9=Math[_0x552a('0x1c6')](_0x453262['erlangCalls']*_0x453262['erlangAbandonmentRate']*_0x453262[_0x552a('0x1c7')]*_0x453262['predictiveIntervalMultiplicativeFactor']);if(_[_0x552a('0x40')](_0x453262[_0x552a('0x2b')])){if(!_[_0x552a('0x40')](_0x453262['startPredictive'])){_0x453262[_0x552a('0x2a')]=undefined;loggerPredictive['error'](_0x552a('0x1c8'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x552a('0x40')](_0x453262['handlePredictive'])){loggerPredictive[_0x552a('0x97')](_0x552a('0x1c8'),_0x552a('0x1c9'));clearInterval(_0x453262['handlePredictive']);_0x453262['handlePredictive']=undefined;}_0x453262[_0x552a('0x2b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x453262[_0x552a('0x43')],_0x552a('0x1ca'),_0x453262[_0x552a('0x2b')]);this[_0x552a('0x15f')](_0x453262,0x1);}else if(ifInterval(_0x453262['dialPredictiveInterval'],_0x453262[_0x552a('0x2b')])){this[_0x552a('0x15f')](_0x453262,0x1);loggerPredictiveCalls[_0x552a('0x82')](_0x552a('0x1cb'),_0x453262['startProgressive'],_0x453262[_0x552a('0x43')]);_0x453262[_0x552a('0x8d')]=0x0;_0x453262[_0x552a('0x71')]=0x0;}else if(_0x539388<_0x222a0a&&_0x453262[_0x552a('0x1cc')]===_0x552a('0x1cd')){freeVariablesPredictive(_0x453262);loggerPredictive[_0x552a('0x82')](_0x552a('0x1ce'),_0x552a('0x1cf'),_0x222a0a,'startProgressive',_0x453262['name']);}else if(_0x1b95b9<_0x453262[_0x552a('0x71')]&&_0x453262[_0x552a('0x1cc')]===_0x552a('0x1cd')){freeVariablesPredictive(_0x453262);loggerPredictive[_0x552a('0x82')](_0x552a('0x1d0'),_0x552a('0x1d1'),_0x1b95b9,'Drop\x20in\x20this\x20interval',_0x453262[_0x552a('0x71')],'startProgressive',_0x453262['name']);}else if(!ifInterval(_0x453262['dialPredictiveInterval'],_0x453262[_0x552a('0x2b')])&&_[_0x552a('0x40')](_0x453262[_0x552a('0x2a')])&&!_[_0x552a('0x40')](_0x453262[_0x552a('0x2b')])){_0x453262['startPredictive']=moment()['format'](_0x552a('0x10b'));loggerPredictive[_0x552a('0x82')](_0x453262[_0x552a('0x43')],_0x552a('0x1d2'),_0x453262['startPredictive']);this[_0x552a('0xc4')](_0x453262[_0x552a('0x1d3')])[_0x552a('0xc5')](this['getDataPredictive'](_0x453262))['then'](mergeDataErlangB(_0x453262))[_0x552a('0xc5')](this[_0x552a('0x1d4')](_0x453262))[_0x552a('0xb8')](loggerCatchPredictive(_0x552a('0x1d5'),_0x453262));}else if(!ifInterval(_0x453262[_0x552a('0x1d3')],_0x453262[_0x552a('0x2a')])){_0x453262['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x453262[_0x552a('0x2a')]=moment()[_0x552a('0x7c')](_0x552a('0x10b'));loggerPredictive[_0x552a('0x82')](_0x453262['name'],'recalculate\x20predictive\x20at',_0x453262['startPredictive']);clearInterval(_0x453262[_0x552a('0x93')]);_0x453262['handlePredictive']=undefined;this['averageHandleTime'](_0x453262['dialPredictiveInterval'])[_0x552a('0xc5')](this[_0x552a('0x1d6')](_0x453262))['then'](mergeDataErlangB(_0x453262))['then'](this[_0x552a('0x1d4')](_0x453262))[_0x552a('0xb8')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x453262));}else if(_0x453262['predictiveIntervalAvailable']&&_0x371e96<_0x453262[_0x552a('0x74')]-_0x5e6abf){freeVariablesPredictive(_0x453262);loggerPredictive[_0x552a('0x82')](_0x453262[_0x552a('0x43')],_0x552a('0x1d7'),_0x371e96,_0x552a('0x1d8'),_0x453262[_0x552a('0x74')],'-',_0x5e6abf,'=',_0x453262[_0x552a('0x74')]-_0x5e6abf,')');}else if(_0x453262[_0x552a('0x74')]&&_0x371e96>_0x453262[_0x552a('0x74')]+_0x229926){freeVariablesPredictive(_0x453262);loggerPredictive[_0x552a('0x82')](_0x453262[_0x552a('0x43')],_0x552a('0x1d7'),_0x371e96,_0x552a('0x1d9'),_0x453262[_0x552a('0x74')],'+',_0x229926,'=',_0x453262['predictiveIntervalAvailable']+_0x229926,')');}};Dialer['prototype']['getDataPredictive']=function(_0x526e83){var _0x25fde5=this;return function(_0x30ea76){return new BPromise(function(_0x4b9556,_0x13e11e){_[_0x552a('0xd8')](_0x526e83,_0x30ea76[0x0]);if(checkGetDataPredictive(_0x30ea76[0x0])){var _0x34fc24=_0x526e83[_0x552a('0x74')]=_0x526e83['talking']+_0x526e83[_0x552a('0x54')];var _0x496649=_0x526e83[_0x552a('0x1d3')]*0x3c;var _0x45e730=_0x30ea76[0x0][_0x552a('0x87')]+_0x30ea76[0x0]['predictiveIntervalAvgHoldtime'];var _0x388b91=(_0x30ea76[0x0][_0x552a('0x6d')]+_0x30ea76[0x0][_0x552a('0x70')]+_0x30ea76[0x0][_0x552a('0x6f')])/_0x30ea76[0x0][_0x552a('0x75')];_0x526e83[_0x552a('0x1c7')]=_0x388b91>0x0?_0x388b91:0x1;switch(_0x526e83['dialPredictiveOptimization']){case'dropRate':var _0x2570fb=_0x526e83['dialPredictiveOptimizationPercentage']/0x64;return _0x25fde5['abandonmentRate'](_0x34fc24,_0x496649,_0x45e730,_0x388b91,_0x2570fb)[_0x552a('0xc5')](function(_0x532ae6){return _0x4b9556(_0x532ae6);});case'agentBusyFactor':var _0x3526c3=_0x526e83[_0x552a('0x1c2')]/0x64;return _0x25fde5[_0x552a('0x1da')](_0x34fc24,_0x496649,_0x45e730,_0x388b91,_0x3526c3)[_0x552a('0xc5')](function(_0x189f52){return _0x4b9556(_0x189f52);});default:return _0x13e11e(msgResponse(_0x552a('0x1db'),_0x552a('0x14b'),'Unknown\x20Predictive'));}}else{return _0x13e11e(msgResponse(_0x552a('0x1db'),'Failure',_0x552a('0x1dc')));}});};};Dialer[_0x552a('0xae')][_0x552a('0x1dd')]=function(_0x1c4ebe){var _0x49c106=this;return function(_0x385dfb){return new BPromise(function(_0x406f6a,_0x357c98){_['merge'](_0x1c4ebe,_0x385dfb[0x0]);if(checkGetDataPredictive(_0x385dfb[0x0])){loggerPredictive['info'](JSON[_0x552a('0x4c')](_0x385dfb[0x0]));if(_0x1c4ebe[_0x552a('0x1cc')]===_0x552a('0x1cd')){return _0x49c106[_0x552a('0xcd')](_0x1c4ebe['id'])[_0x552a('0xc5')](function(_0x38509d){var _0x45515a=_0x1c4ebe[_0x552a('0x55')]-_0x38509d[0x0][_0x552a('0x1de')];var _0x2b6459=_0x1c4ebe['dialPredictiveInterval']*0x3c;var _0x279f89=_0x385dfb[0x0]['predictiveIntervalAvgTalktime']+_0x385dfb[0x0]['predictiveIntervalAvgHoldtime'];var _0x6127be=(_0x385dfb[0x0]['predictiveIntervalAnsweredCalls']+_0x385dfb[0x0][_0x552a('0x70')]+_0x385dfb[0x0][_0x552a('0x6f')])/_0x385dfb[0x0][_0x552a('0x75')];var _0x360a36=_0x1c4ebe[_0x552a('0x1c2')]/0x64;_0x1c4ebe[_0x552a('0x73')]=_0x38509d[0x0][_0x552a('0x1de')]||0x0;_0x1c4ebe[_0x552a('0x1c7')]=_0x6127be>0x0?_0x6127be:0x1;return _0x49c106[_0x552a('0x1df')](_0x45515a,_0x2b6459,_0x279f89,_0x6127be,_0x360a36);})[_0x552a('0xc5')](function(_0x1ec7c1){return _0x406f6a(_0x1ec7c1);})[_0x552a('0xb8')](function(_0x4fb5fa){return _0x357c98(msgResponse(_0x552a('0x1e0'),_0x552a('0x14b'),JSON['stringify'](_0x4fb5fa)));});}if(_0x1c4ebe[_0x552a('0x1cc')]==='agentBusyFactor'){return _0x49c106[_0x552a('0xcd')](_0x1c4ebe['id'])['then'](function(_0x54bd9e){var _0x384c65=_0x1c4ebe['loggedIn']-_0x54bd9e[0x0][_0x552a('0x1de')];var _0xad447d=_0x1c4ebe['dialPredictiveInterval']*0x3c;var _0x5d5914=_0x385dfb[0x0]['predictiveIntervalAvgTalktime']+_0x385dfb[0x0][_0x552a('0x6e')];var _0x1d0194=(_0x385dfb[0x0]['predictiveIntervalAnsweredCalls']+_0x385dfb[0x0][_0x552a('0x70')]+_0x385dfb[0x0][_0x552a('0x6f')])/_0x385dfb[0x0][_0x552a('0x75')];var _0x544629=_0x1c4ebe[_0x552a('0x1c2')]/0x64;_0x1c4ebe['predictiveIntervalPauses']=_0x54bd9e[0x0][_0x552a('0x1de')]||0x0;_0x1c4ebe[_0x552a('0x1c7')]=_0x1d0194>0x0?_0x1d0194:0x1;return _0x49c106[_0x552a('0x1da')](_0x384c65,_0xad447d,_0x5d5914,_0x1d0194,_0x544629);})[_0x552a('0xc5')](function(_0x5ade20){return _0x406f6a(_0x5ade20);})[_0x552a('0xb8')](function(_0x4650ee){return _0x357c98(msgResponse(_0x552a('0x1e0'),'Failure',JSON[_0x552a('0x4c')](_0x4650ee)));});}}else{return _0x357c98(msgResponse(_0x552a('0x1db'),'Failure',_0x552a('0x1dc')));}});};};Dialer[_0x552a('0xae')][_0x552a('0x1d4')]=function(_0x6d38fd){var _0x1963ed=this;return function(){var _0x5c014e=0x0;var _0x592dc7=Math[_0x552a('0x1c6')](_0x6d38fd[_0x552a('0x1e1')]*0x3e8);if(_0x592dc7>0x0){_0x592dc7=_0x592dc7<0x64?0x64:_0x592dc7;loggerPredictive['info'](_0x6d38fd['name'],_0x552a('0x1e2'),_0x592dc7,_0x552a('0x4d'));_0x6d38fd[_0x552a('0x93')]=setInterval(function(){_0x1963ed[_0x552a('0x93')](_0x6d38fd);loggerPredictiveCalls[_0x552a('0x82')](_0x552a('0x1e3'),_0x5c014e+=0x1);},_0x592dc7);}else{loggerPredictive[_0x552a('0x82')](_0x6d38fd[_0x552a('0x43')],_0x552a('0x1e4'));}};};Dialer[_0x552a('0xae')]['checkContactBlack']=function(_0x22ead9,_0x2b720b){var _0x4b0458=this;return function(_0x19ea71){if(_[_0x552a('0x4a')](_0x19ea71)){if(_[_0x552a('0xb4')](_0x2b720b[_0x552a('0x1e5')])||!_0x2b720b['recallme']){if(_0x22ead9['dialMethod']===_0x552a('0xa')){_0x22ead9['queueStatusComplete']=_['isUndefined'](_0x22ead9[_0x552a('0x138')])?!![]:_0x22ead9[_0x552a('0x138')];var _0x5cd2cc=uuid['v4']();_0x4b0458[_0x552a('0x27')][_0x5cd2cc]=new Action(_0x22ead9,_0x2b720b,_0x5cd2cc);loggerBooked[_0x552a('0x82')](_0x552a('0x1e6'),_0x5cd2cc,'queueStatusComplete:\x20',JSON[_0x552a('0x4c')](_0x22ead9['queueStatusComplete']),_0x552a('0x1e7'),_0x22ead9[_0x552a('0x43')]);if(_0x22ead9['queueStatusComplete']){_0x22ead9[_0x552a('0x138')]=![];_0x4b0458[_0x552a('0x135')][_0x4b0458[_0x552a('0x27')][_0x5cd2cc]['queue']]=[];ami[_0x552a('0xb5')]({'actionid':_0x5cd2cc,'action':_0x552a('0x1e8'),'queue':_0x22ead9[_0x552a('0x43')]})[_0x552a('0xb8')](function(_0x1442f2){_0x4b0458['updateOriginated'](_0x22ead9);_0x4b0458['rescheduleContact']({'active':![],'ContactId':_0x4b0458[_0x552a('0x27')][_0x5cd2cc][_0x552a('0xda')],'ListId':_0x4b0458[_0x552a('0x27')][_0x5cd2cc]['ListId'],'VoiceQueueId':_0x4b0458[_0x552a('0x27')][_0x5cd2cc][_0x552a('0xdc')]||undefined,'CampaignId':_0x4b0458[_0x552a('0x27')][_0x5cd2cc]['CampaignId']||undefined})['catch'](loggerCatch(_0x552a('0x1e9')));delete _0x4b0458[_0x552a('0x27')][_0x5cd2cc];});}else{loggerBooked['info'](_0x552a('0x1ea'),JSON[_0x552a('0x4c')](_0x22ead9['queueStatusComplete']),_0x552a('0x1e7'),_0x22ead9[_0x552a('0x43')]);_0x4b0458['updateOriginated'](_0x22ead9);_0x4b0458[_0x552a('0xff')]({'active':![],'ContactId':_0x4b0458['actions'][_0x5cd2cc][_0x552a('0xda')],'ListId':_0x4b0458[_0x552a('0x27')][_0x5cd2cc][_0x552a('0xdb')],'VoiceQueueId':_0x4b0458[_0x552a('0x27')][_0x5cd2cc][_0x552a('0xdc')]||undefined,'CampaignId':_0x4b0458[_0x552a('0x27')][_0x5cd2cc][_0x552a('0x102')]||undefined})['catch'](loggerCatch(_0x552a('0x1e9')));delete _0x4b0458[_0x552a('0x27')][_0x5cd2cc];}}else{return _0x4b0458['actionOriginate'](_0x22ead9,_0x2b720b);}}else{if(getDiff(_0x2b720b[_0x552a('0x1eb')])<_0x22ead9[_0x552a('0x1ec')]*0x3c){if(_0x2b720b[_0x552a('0x1ed')]&&!_0x2b720b[_0x552a('0x1ed')][_0x552a('0x1ee')]){_0x4b0458[_0x552a('0x21')]['run'](_0x2b720b['id'])[_0x552a('0x20')](function(){_0x4b0458[_0x552a('0xba')](_0x22ead9);});}else{_0x4b0458[_0x552a('0xc9')]({'active':![]},_0x2b720b['id'],0x1)[_0x552a('0x20')](function(){console['log'](_0x552a('0x1ef'));_0x4b0458[_0x552a('0xba')](_0x22ead9);});}}else{_0x22ead9['outboundReCallsDay']+=0x1;_0x4b0458[_0x552a('0xba')](_0x22ead9);if(_0x22ead9[_0x552a('0x1f0')]){_0x4b0458[_0x552a('0xff')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2b720b[_0x552a('0xda')],'ListId':_0x2b720b[_0x552a('0xdb')],'VoiceQueueId':_0x2b720b[_0x552a('0xdc')]||undefined,'CampaignId':_0x2b720b[_0x552a('0x102')]||undefined})[_0x552a('0xb8')](loggerCatch(_0x552a('0x1f1')));_0x4b0458['createHistory'](createObjHistory(_0x22ead9,_0x2b720b,_0x552a('0x1f2'),0x17,_0x552a('0x1f3')))[_0x552a('0xb8')](loggerCatch(_0x552a('0x1f4')));}else{_0x4b0458[_0x552a('0xd7')](createObjHistory(_0x22ead9,_0x2b720b,'RECALLFAILEDTIMEOUT',0x16,_0x552a('0x1f5')),_0x552a('0x1f6'),'[Originate][HistoryRecallClose]');}}}}else{_0x22ead9['outboundBlacklistCallsDay']+=0x1;_0x4b0458['saveInDb'](createObjHistory(_0x22ead9,_0x2b720b,_0x552a('0x1f7'),0xd,_0x552a('0x1f8')),_0x552a('0x1f9'),_0x552a('0x1fa'));throw _0x552a('0x1fb');}};};Dialer[_0x552a('0xae')][_0x552a('0x1fc')]=function(_0x4c9ee3){var _0x572a86=this;var _0x11dd40=[];var _0x45ac48=_0x4c9ee3['limitCalls']-_0x4c9ee3[_0x552a('0x76')]-_0x4c9ee3[_0x552a('0x1fd')];emitCampaignSummary(_0x4c9ee3);if(_0x45ac48>0x0){if(_0x45ac48>this[_0x552a('0x26')]){_0x45ac48=this[_0x552a('0x26')];}_0x4c9ee3[_0x552a('0x1fd')]+=_0x45ac48;this[_0x552a('0xcb')](_0x4c9ee3['id'],_0x45ac48,_0x4c9ee3[_0x552a('0x1fe')])[_0x552a('0xc5')](function(_0x118e6b){_0x4c9ee3[_0x552a('0x1fd')]-=_0x45ac48;_0x4c9ee3[_0x552a('0x1fd')]=_0x4c9ee3['temp']>0x0?_0x4c9ee3[_0x552a('0x1fd')]:0x0;if(!checkContactEmpty(_0x118e6b)){_0x4c9ee3[_0x552a('0x41')]=_0x552a('0xa1');logger['info'](_0x552a('0x1ff')+_0x4c9ee3[_0x552a('0x43')]);}else{_0x4c9ee3[_0x552a('0x76')]+=_0x118e6b[_0x552a('0x9a')];_0x4c9ee3['message']=_0x552a('0x200');for(var _0x4e9fe6=0x0;_0x4e9fe6<_0x118e6b[_0x552a('0x9a')];_0x4e9fe6+=0x1){_0x4c9ee3['ivrTotalCallsDays']+=0x1;if(_[_0x552a('0xb4')](_0x118e6b[_0x4e9fe6])||_[_0x552a('0xb4')](_0x118e6b[_0x4e9fe6][_0x552a('0x16e')])||_[_0x552a('0xb4')](_0x118e6b[_0x4e9fe6]['Contact'][_0x552a('0x16d')])){_0x572a86['emptyContact']('[actionOriginate]\x20',_0x4c9ee3,_0x118e6b[_0x4e9fe6]);}else{_0x572a86[_0x552a('0xc2')](_['pick'](_0x118e6b[_0x4e9fe6],['CampaignId','Contact.phone']))[_0x552a('0xc5')](_0x572a86[_0x552a('0x201')](_0x4c9ee3,_0x118e6b[_0x4e9fe6]))[_0x552a('0xb8')](_0x572a86[_0x552a('0x202')](_0x552a('0x203'),_0x4c9ee3));}}}})[_0x552a('0xb8')](loggerGetContactDialer(_0x552a('0x204'),_0x4c9ee3,_0x45ac48));}};Dialer[_0x552a('0xae')]['handlePower']=function(_0x39131a,_0x50fd8b){var _0x540dfa=this;var _0x542a7f=[];var _0x322b22=_0x50fd8b>=0x1?_0x50fd8b:0x1;var _0xbb55cd=[];if(_0x39131a[_0x552a('0x5f')]===_0x552a('0xa')){_0x322b22=0x1;}var _0x4379e3=Math['floor'](_0x39131a[_0x552a('0x54')]*_0x322b22)-_0x39131a[_0x552a('0x76')]-_0x39131a[_0x552a('0x1fd')];emitVoiceQueueSummary(_0x39131a);if(_0x39131a[_0x552a('0x205')]>0x0){var _0x4af52a=_0x39131a[_0x552a('0x205')]-_0x39131a['originated']-_0x39131a[_0x552a('0x58')]-_0x39131a[_0x552a('0x1fd')]-_0x39131a[_0x552a('0x206')];if(_0x4379e3>_0x4af52a){_0x4379e3=_0x4af52a;}}if(_0x4379e3>0x0){if(_0x39131a['dialMethod']===_0x552a('0xa')){_0x4379e3=0x1;}if(_0x4379e3>this['maxNumberOriginate']){_0x4379e3=this[_0x552a('0x26')];}_0x39131a[_0x552a('0x1fd')]+=_0x4379e3;for(var _0x2c419a in this['agents']){if(this[_0x552a('0x24')][_0x552a('0x9b')](_0x2c419a)){if(this[_0x552a('0x24')][_0x2c419a][_0x552a('0xaa')]===_0x552a('0x207')&&this[_0x552a('0x24')][_0x2c419a][_0x552a('0xb6')]===_0x552a('0xe2')){_0x542a7f[_0x552a('0x136')](this[_0x552a('0x24')][_0x2c419a]['id']);}}}this[_0x552a('0xca')](_0x39131a['id'],_0x542a7f,_0x4379e3,_0x39131a[_0x552a('0x1fe')])['then'](function(_0x1c337a){_0x39131a['temp']-=_0x4379e3;_0x39131a[_0x552a('0x1fd')]=_0x39131a[_0x552a('0x1fd')]>0x0?_0x39131a['temp']:0x0;if(!checkContactEmpty(_0x1c337a)){_0x540dfa[_0x552a('0xbe')](_0x39131a)['then'](sendMessageReschedule(_0x39131a))[_0x552a('0xb8')](loggerCatch(_0x552a('0xc0')));}else{_0x39131a['originated']+=_0x1c337a[_0x552a('0x9a')];_0x39131a['message']=_0x39131a['dialMethod']===_0x552a('0xa')?_0x552a('0x208'):_0x552a('0x200');for(var _0x3f73db=0x0;_0x3f73db<_0x1c337a[_0x552a('0x9a')];_0x3f73db+=0x1){if(_[_0x552a('0xb4')](_0x1c337a[_0x3f73db])||_[_0x552a('0xb4')](_0x1c337a[_0x3f73db]['Contact'])||_[_0x552a('0xb4')](_0x1c337a[_0x3f73db]['Contact'][_0x552a('0x16d')])){_0x540dfa['emptyContact'](_0x552a('0x209'),_0x39131a,_0x1c337a[_0x3f73db]);}else{_0x540dfa[_0x552a('0xc1')](_[_0x552a('0xd9')](_0x1c337a[_0x3f73db],['VoiceQueueId','Contact.phone']))[_0x552a('0xc5')](_0x540dfa[_0x552a('0x201')](_0x39131a,_0x1c337a[_0x3f73db]))[_0x552a('0xb8')](_0x540dfa['loggerHandler'](_0x552a('0x209'),_0x39131a));}}}})[_0x552a('0xb8')](loggerGetContactDialer(_0x552a('0x20a'),_0x39131a,_0x4379e3));}};Dialer[_0x552a('0xae')][_0x552a('0x93')]=function(_0x3c6912){var _0x5869be=this;if(_0x3c6912[_0x552a('0x205')]>0x0){var _0x1c8911=_0x3c6912[_0x552a('0x205')]-_0x3c6912['originated']-_0x3c6912[_0x552a('0x58')];if(_0x1c8911>0x0){this[_0x552a('0x20b')](_0x3c6912);}else{loggerPredictiveCalls[_0x552a('0x82')](_0x552a('0x20c'));}}else{this[_0x552a('0x20b')](_0x3c6912);}};Dialer[_0x552a('0xae')][_0x552a('0x20b')]=function(_0x179814){var _0x169074=this;var _0xc8fefe=[];_0x179814['originated']+=0x1;for(var _0x1ab8c7 in this[_0x552a('0x24')]){if(this[_0x552a('0x24')]['hasOwnProperty'](_0x1ab8c7)){if(this[_0x552a('0x24')][_0x1ab8c7][_0x552a('0xaa')]===_0x552a('0x207')&&this[_0x552a('0x24')][_0x1ab8c7][_0x552a('0xb6')]===_0x552a('0xe2')){_0xc8fefe['push'](this['agents'][_0x1ab8c7]['id']);}}}this[_0x552a('0xca')](_0x179814['id'],_0xc8fefe,0x1,_0x179814[_0x552a('0x1fe')])[_0x552a('0xc5')](function(_0x4ad218){if(!checkContactEmpty(_0x4ad218)){checkContactLowerLimitOriginate(_0x179814,0x1,0x0);_0x169074[_0x552a('0xbe')](_0x179814)[_0x552a('0xc5')](sendMessageReschedule(_0x179814))[_0x552a('0xb8')](loggerCatch(_0x552a('0xc0')));}else{_0x179814[_0x552a('0x41')]=_0x552a('0x200');if(_[_0x552a('0xb4')](_0x4ad218[0x0])||_[_0x552a('0xb4')](_0x4ad218[0x0]['Contact'])||_[_0x552a('0xb4')](_0x4ad218[0x0][_0x552a('0x16e')][_0x552a('0x16d')])){_0x169074[_0x552a('0xd5')](_0x552a('0x209'),_0x179814,_0x4ad218[0x0]);}else{_0x169074[_0x552a('0xc1')](_[_0x552a('0xd9')](_0x4ad218[0x0],[_0x552a('0xdc'),_0x552a('0x20d')]))[_0x552a('0xc5')](_0x169074['checkContactBlack'](_0x179814,_0x4ad218[0x0]))[_0x552a('0xb8')](_0x169074['loggerHandler']('[actionOriginatePredictive]\x20',_0x179814));}}})['catch'](loggerGetContactDialer(_0x552a('0x20e'),_0x179814,0x1));emitVoiceQueueSummary(_0x179814);};Dialer[_0x552a('0xae')][_0x552a('0x1df')]=function(_0x570e56,_0x2c0e08,_0x48447a,_0x312a74,_0x4abc65,_0x3257ea){loggerPredictive[_0x552a('0x82')](_0x552a('0x20f'));loggerPredictive[_0x552a('0x82')](_0x552a('0x210'),_0x570e56);loggerPredictive[_0x552a('0x82')](_0x552a('0x211'),_0x2c0e08);loggerPredictive[_0x552a('0x82')]('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',_0x48447a);loggerPredictive[_0x552a('0x82')](_0x552a('0x212'),_0x312a74);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4abc65);loggerPredictive[_0x552a('0x82')](_0x552a('0x88'));return new BPromise(function(_0x1ca699,_0x4a8fa5){if(_0x570e56<=0x0||isNaN(_0x570e56)){return _0x4a8fa5(msgResponse(_0x552a('0x213'),_0x552a('0x4b'),_0x552a('0x214')+_0x570e56));}if(_0x48447a<=0x0||isNaN(_0x48447a)){return _0x4a8fa5(msgResponse(_0x552a('0x213'),_0x552a('0x4b'),_0x552a('0x215')+_0x48447a));}if(_0x312a74<=0x0||isNaN(_0x312a74)){return _0x4a8fa5(msgResponse(_0x552a('0x213'),_0x552a('0x4b'),'p\x20=\x20'+_0x312a74));}if(_0x2c0e08<=0x0||isNaN(_0x2c0e08)){return _0x4a8fa5(msgResponse(_0x552a('0x213'),_0x552a('0x4b'),_0x552a('0x216')+_0x2c0e08));}if(_0x4abc65<=0x0||isNaN(_0x4abc65)){return _0x4a8fa5(msgResponse('[abandonmentRate]',_0x552a('0x4b'),'Amax\x20=\x20'+_0x4abc65));}_0x3257ea=_0x3257ea||0x0;var _0x5875cf=0x1/_0x48447a;var _0x60e294=0x0;var _0x58a865=0x0;var _0x5e3717=0x0;var _0x2772f9=0x0;for(var _0x432b92=0x0;_0x5e3717<_0x4abc65;_0x432b92+=0x1){_0x58a865=_0x432b92/_0x2c0e08;_0x60e294=(_0x312a74*_0x58a865+_0x3257ea)/_0x5875cf;_0x5e3717=erlangb(_0x60e294,_0x570e56);_0x2772f9=_0x60e294/_0x570e56*(0x1-erlangb(_0x60e294,_0x570e56));}return _0x1ca699({'erlangCalls':_0x432b92,'erlangCallToSecond':_0x2c0e08/_0x432b92,'erlangAbandonmentRate':_0x5e3717,'erlangBusyFactor':_0x2772f9});});};Dialer[_0x552a('0xae')][_0x552a('0x1da')]=function(_0x1c0e44,_0x4b49a7,_0x222aac,_0x2e723f,_0x552241,_0x3192c1){loggerPredictive[_0x552a('0x82')](_0x552a('0x217'));loggerPredictive[_0x552a('0x82')](_0x552a('0x210'),_0x1c0e44);loggerPredictive[_0x552a('0x82')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b49a7);loggerPredictive['info'](_0x552a('0x218'),_0x222aac);loggerPredictive[_0x552a('0x82')](_0x552a('0x212'),_0x2e723f);loggerPredictive[_0x552a('0x82')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x552241);loggerPredictive[_0x552a('0x82')](_0x552a('0x88'));return new BPromise(function(_0x337a9b,_0x1c9f09){if(_0x1c0e44<=0x0||isNaN(_0x1c0e44)){return _0x1c9f09(msgResponse(_0x552a('0x219'),_0x552a('0x4b'),_0x552a('0x214')+_0x1c0e44));}if(_0x222aac<=0x0||isNaN(_0x222aac)){return _0x1c9f09(msgResponse('[busyFactor]',_0x552a('0x4b'),'Ts\x20=\x20'+_0x222aac));}if(_0x2e723f<=0x0||isNaN(_0x2e723f)){return _0x1c9f09(msgResponse('[busyFactor]',_0x552a('0x4b'),'p\x20=\x20'+_0x2e723f));}if(_0x4b49a7<=0x0||isNaN(_0x4b49a7)){return _0x1c9f09(msgResponse(_0x552a('0x219'),'Error',_0x552a('0x216')+_0x4b49a7));}if(_0x552241<=0x0||isNaN(_0x552241)){return _0x1c9f09(msgResponse(_0x552a('0x219'),_0x552a('0x4b'),_0x552a('0x21a')+_0x552241));}_0x3192c1=_0x3192c1||0x0;var _0x2f9a2d=0x1/_0x222aac;var _0x39b042=0x0;var _0x5de975=0x0;var _0x45a07b=0x0;var _0x1825a8=0x0;for(var _0x2527df=0x0;_0x1825a8<_0x552241;_0x2527df+=0x1){_0x5de975=_0x2527df/_0x4b49a7;_0x39b042=(_0x2e723f*_0x5de975+_0x3192c1)/_0x2f9a2d;_0x45a07b=erlangb(_0x39b042,_0x1c0e44);_0x1825a8=_0x39b042/_0x1c0e44*(0x1-erlangb(_0x39b042,_0x1c0e44));}return _0x337a9b({'erlangCalls':_0x2527df,'erlangCallToSecond':_0x4b49a7/_0x2527df,'erlangAbandonmentRate':_0x45a07b,'erlangBusyFactor':_0x1825a8});});};module[_0x552a('0x21b')]=Dialer; \ No newline at end of file +var _0xd962=['then','catch','[countReScheduled]\x20','prototype','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','updateOriginated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','ListId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','saveInDb','uniqueid','isNil','variable','exten','dialAMDActive','value','outboundAnswerCallsDay','HangupInAMD','membername','[syncHangupInAMD]','MACHINE','outboundAnswerAgiCallsDay','AMD','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','VoiceQueueId','CampaignId','[rescheduleContact][Machine]','campaigns','[syncHangupInAMDIvr][createHistory]','Machine','countglobal','amd','countabandonedretry','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','Unknow','[syncHangupIvr][createHistory]','syncAgentComplete','reason','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','agiafterat','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','calleridnum','channel','syncQueueMember','actionid','strategy','locked','stateinterface','pick','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','finally','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','content','indexOf','iftime\x20%s,%s','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','loggedIn','checkIsTrunkReachable','dialTimezone','checkDialMethod','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAgentRejectMaxRetry','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','averageHandleTime','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','dialPredictiveOptimizationPercentage','busyFactor','startMethodPredictive','floor','erlangCallToSecond','[handlePredictive]','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','Contact.phone','tryOriginatePredictive','[handlePredictive][limitChannel]','[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]','interval\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','p\x20=\x20','exports','util','lodash','moment','md5','ioredis','../preview/util/util','../../../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','./queueCallerAbandon','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','sequence','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','syncAgentConnect','bind','originateresponse','agentcomplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','message','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','emit','type','available','pTalking','sumBillable','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangAbandonmentRate','Trunk','active','format','voice:queue:%s','voice_queue:save','ivr','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\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','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','diff','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','outbound','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','state','statedesc','endtime','starttime','[uniqueid]','clearZombieChannels','actions','[actions]','hasOwnProperty','Action','status','No\x20such\x20channel','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve'];(function(_0x3b918b,_0x2edc55){var _0x57d988=function(_0x1a4463){while(--_0x1a4463){_0x3b918b['push'](_0x3b918b['shift']());}};_0x57d988(++_0x2edc55);}(_0xd962,0x16a));var _0x2d96=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xd962[_0x363ef8];return _0x148822;};'use strict';var util=require(_0x2d96('0x0'));var _=require(_0x2d96('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x2d96('0x2'));var rr=require('rr');var md5=require(_0x2d96('0x3'));var Redis=require(_0x2d96('0x4'));var ut=require(_0x2d96('0x5'));var config=require(_0x2d96('0x6'));var logger=require(_0x2d96('0x7'))(_0x2d96('0x8'));var loggerBooked=require(_0x2d96('0x7'))(_0x2d96('0x9'));var loggerPredictive=require('../../../config/logger')(_0x2d96('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0x2d96('0xb'));var loggerSyncQueueSummary=require(_0x2d96('0x7'))(_0x2d96('0xc'));var ami=require(_0x2d96('0xd'));config[_0x2d96('0xe')]=_[_0x2d96('0xf')](config[_0x2d96('0xe')],{'host':_0x2d96('0x10'),'port':0x18eb});var io=require(_0x2d96('0x11'))(new Redis(config[_0x2d96('0xe')]));var cmHopper=require(_0x2d96('0x12'));var cmHopperFinal=require(_0x2d96('0x13'));var cmHopperHistory=require(_0x2d96('0x14'));var cmHopperBlack=require(_0x2d96('0x15'));var voiceQueueRt=require(_0x2d96('0x16'));var Action=require(_0x2d96('0x17'));var History=require(_0x2d96('0x18'));var Final=require(_0x2d96('0x19'));var AgentComplete=require(_0x2d96('0x1a'));var QueueCallerAbandon=require(_0x2d96('0x1b'));var Hangup=require('./hangup');var ipAgi=process['env'][_0x2d96('0x1c')]||_0x2d96('0x1d');var strategy={'rrmemory':_0x2d96('0x1e'),'roundrobin':_0x2d96('0x1f')};var Sequence=function(){};Sequence['prototype'][_0x2d96('0x20')]=function(_0x1bb080){this['tail']=this[_0x2d96('0x21')]?this[_0x2d96('0x21')]['finally'](_0x1bb080):_0x1bb080();};function Dialer(_0x23cc46,_0x1032f4){this[_0x2d96('0x22')]=new Sequence();this[_0x2d96('0x23')]=_0x1032f4;this[_0x2d96('0x24')]=_0x23cc46[_0x2d96('0x24')];this['campaigns']=_0x23cc46['campaigns'];this['agents']=_0x23cc46[_0x2d96('0x25')];this[_0x2d96('0x26')]=_0x23cc46[_0x2d96('0x26')];this['maxNumberOriginate']=config[_0x2d96('0x27')]||0x2;this[_0x2d96('0x28')]={};this['actions']={};this['contactsId']={};this[_0x2d96('0x29')]={};this[_0x2d96('0x2a')]={};this[_0x2d96('0x2b')]={};this[_0x2d96('0x2c')]={};this[_0x2d96('0x2d')]={};this[_0x2d96('0x2e')]={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0x2d96('0x2f')][_0x2d96('0x30')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x2d96('0x30')](this));ami['on'](_0x2d96('0x31'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x2d96('0x32'),this['syncAgentComplete']['bind'](this));ami['on']('custom:queuesummary',this[_0x2d96('0xc')][_0x2d96('0x30')](this));ami['on'](_0x2d96('0x33'),this[_0x2d96('0x34')][_0x2d96('0x30')](this));ami['on']('newexten',this[_0x2d96('0x35')][_0x2d96('0x30')](this));ami['on'](_0x2d96('0x36'),this[_0x2d96('0x37')]['bind'](this));ami['on'](_0x2d96('0x38'),this['syncQueueMember']['bind'](this));ami['on'](_0x2d96('0x39'),this['syncQueueStatusComplete'][_0x2d96('0x30')](this));this[_0x2d96('0x3a')]();this[_0x2d96('0x3b')]();}function isNotNull(_0x4c86d9){return _0x4c86d9!==null&&!_[_0x2d96('0x3c')](_0x4c86d9);}function checkIsLoggedIn(_0x58111d,_0x1e41f0){return function(){if(_0x1e41f0<=0x0){_0x58111d['message']=_0x2d96('0x3d');throw _0x58111d['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x571c35){return _0x571c35;}function checkIsActive(_0xf2af80,_0x5c227c){return function(){if(!isActive(_0x5c227c)){_0xf2af80[_0x2d96('0x3e')]=_0x2d96('0x3f');throw _0xf2af80[_0x2d96('0x40')]+_0x2d96('0x41');}};}function checkInterval(_0x1cc0ae){return function(){if(!isNotNull(_0x1cc0ae[_0x2d96('0x42')])){_0x1cc0ae[_0x2d96('0x3e')]=_0x2d96('0x43');throw _0x1cc0ae[_0x2d96('0x40')]+_0x2d96('0x44');}if(!isNotNull(_0x1cc0ae[_0x2d96('0x42')][_0x2d96('0x45')])){_0x1cc0ae[_0x2d96('0x3e')]='INTERVAL_IS_NULL';throw _0x1cc0ae[_0x2d96('0x40')]+_0x2d96('0x44');}if(!isNotNull(_[_0x2d96('0x46')](_0x1cc0ae[_0x2d96('0x42')][_0x2d96('0x45')]))){_0x1cc0ae['message']=_0x2d96('0x43');throw _0x1cc0ae['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x36108f,_0x14d921,_0x33c990){return{'action':_0x36108f,'response':_0x14d921,'message':_0x33c990,'stack':_0x33c990};}function myreject(_0x48f070){return function(_0x4df238){return _0x48f070(msgResponse(_0x2d96('0x47'),_0x2d96('0x48'),JSON[_0x2d96('0x49')](_0x4df238)));};}function getSeconds(_0x1bd340,_0x684d51){var _0x266b16=moment(_0x1bd340)[_0x2d96('0x4a')](0x0);var _0x102284=moment(_0x684d51)[_0x2d96('0x4a')](0x0);return _0x266b16['diff'](_0x102284,'seconds');}function emit(_0x36bfaf,_0x29e8dc,_0x54bd22){io['to'](_0x36bfaf)[_0x2d96('0x4b')](_0x29e8dc,_0x54bd22);}function emitVoiceQueueSummary(_0x28bead){if(_0x28bead[_0x2d96('0x4c')]==='outbound'){var _0x7789fc={'id':_0x28bead['id'],'name':_0x28bead[_0x2d96('0x40')],'strategy':_0x28bead['strategy'],'answered':_0x28bead['answered'],'available':_0x28bead[_0x2d96('0x4d')],'loggedIn':_0x28bead['loggedIn'],'pTalking':_0x28bead[_0x2d96('0x4e')],'sumBillable':_0x28bead[_0x2d96('0x4f')],'sumDuration':_0x28bead['sumDuration'],'sumHoldTime':_0x28bead[_0x2d96('0x50')]||0x0,'talking':_0x28bead[_0x2d96('0x51')],'total':_0x28bead['total'],'type':_0x28bead[_0x2d96('0x4c')],'unmanaged':_0x28bead[_0x2d96('0x52')],'abandoned':_0x28bead[_0x2d96('0x53')],'waiting':_0x28bead[_0x2d96('0x54')],'loggedInDb':_0x28bead[_0x2d96('0x55')],'dialActive':_0x28bead[_0x2d96('0x56')],'dialMethod':_0x28bead[_0x2d96('0x57')],'dialOriginateCallerIdName':_0x28bead[_0x2d96('0x58')],'dialOriginateCallerIdNumber':_0x28bead[_0x2d96('0x59')],'dialOriginateTimeout':_0x28bead['dialOriginateTimeout'],'dialPrefix':_0x28bead[_0x2d96('0x5a')],'outboundAnswerAgiCallsDay':_0x28bead['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x28bead['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x28bead[_0x2d96('0x5b')],'outboundBusyCallsDay':_0x28bead[_0x2d96('0x5c')],'outboundCongestionCallsDay':_0x28bead['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x28bead[_0x2d96('0x5d')],'outboundDropCallsDayCallersExit':_0x28bead[_0x2d96('0x5e')],'outboundDropCallsDayTimeout':_0x28bead[_0x2d96('0x5f')],'outboundNoAnswerCallsDay':_0x28bead[_0x2d96('0x60')],'outboundNoSuchCallsDay':_0x28bead[_0x2d96('0x61')],'outboundOriginateFailureCallsDay':_0x28bead[_0x2d96('0x62')],'outboundReCallsDay':_0x28bead[_0x2d96('0x63')],'outboundRejectCallsDay':_0x28bead[_0x2d96('0x64')],'outboundUnknownCallsDay':_0x28bead[_0x2d96('0x65')],'predictiveIntervalAnsweredCalls':_0x28bead[_0x2d96('0x66')],'predictiveIntervalAvgHoldtime':_0x28bead[_0x2d96('0x67')],'predictiveIntervalAvgTalktime':_0x28bead[_0x2d96('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x28bead[_0x2d96('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x28bead[_0x2d96('0x6a')],'predictiveIntervalErlangCalls':_0x28bead[_0x2d96('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x28bead['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x28bead[_0x2d96('0x6c')],'predictiveIntervalMultiplicativeFactor':_0x28bead['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x28bead[_0x2d96('0x6d')],'predictiveIntervalAvailable':_0x28bead[_0x2d96('0x6e')],'predictiveIntervalTotalCalls':_0x28bead['predictiveIntervalTotalCalls'],'message':_0x28bead['message'],'originated':_0x28bead[_0x2d96('0x6f')],'erlangCalls':_0x28bead[_0x2d96('0x70')],'erlangCallToSecond':_0x28bead['erlangCallToSecond'],'erlangAbandonmentRate':_0x28bead[_0x2d96('0x71')],'erlangBusyFactor':_0x28bead['erlangBusyFactor'],'startPredictive':_0x28bead['startPredictive'],'startProgressive':_0x28bead[_0x2d96('0x2c')]};if(_0x28bead[_0x2d96('0x72')]){_0x7789fc[_0x2d96('0x72')]={'id':_0x28bead[_0x2d96('0x72')]['id'],'name':_0x28bead['Trunk']['name'],'active':_0x28bead['Trunk'][_0x2d96('0x73')],'callerid':_0x28bead[_0x2d96('0x72')]['callerid']};}if(_0x28bead[_0x2d96('0x42')]){_0x7789fc[_0x2d96('0x42')]={'id':_0x28bead['Interval']['id'],'name':_0x28bead[_0x2d96('0x42')][_0x2d96('0x40')]};}var _0x47723e=md5(JSON[_0x2d96('0x49')](_0x7789fc));if(_0x28bead[_0x2d96('0x3')]!==_0x47723e){_0x28bead[_0x2d96('0x3')]=_0x47723e;emit(util[_0x2d96('0x74')](_0x2d96('0x75'),_0x7789fc[_0x2d96('0x40')]),_0x2d96('0x76'),_0x7789fc);}}}function emitCampaignSummary(_0x57fb31){if(_0x57fb31[_0x2d96('0x4c')]===_0x2d96('0x77')){emit(util[_0x2d96('0x74')](_0x2d96('0x78'),_0x57fb31[_0x2d96('0x40')]),_0x2d96('0x79'),_0x57fb31);}}function checkGetDataPredictive(_0x4fb18c){if(isNotNull(_0x4fb18c)){if(!_['isEmpty'](_0x4fb18c)){loggerPredictive[_0x2d96('0x7a')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x7b'),_0x4fb18c[_0x2d96('0x7c')]);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x7d'),_0x4fb18c[_0x2d96('0x66')]);loggerPredictive[_0x2d96('0x7a')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4fb18c[_0x2d96('0x6a')]);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x7e'),_0x4fb18c[_0x2d96('0x69')]);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x7f'),_0x4fb18c[_0x2d96('0x67')]);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x80'),_0x4fb18c[_0x2d96('0x68')]);loggerPredictive['info'](_0x2d96('0x81'));if(_0x4fb18c[_0x2d96('0x7c')]>0x0){if(!_['isUndefined'](_0x4fb18c[_0x2d96('0x68')])&&_0x4fb18c['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x82'));}if(!_[_0x2d96('0x3c')](_0x4fb18c[_0x2d96('0x67')])&&_0x4fb18c[_0x2d96('0x67')]>0x0){return!![];}else{loggerPredictive[_0x2d96('0x7a')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x83'));}}else{loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x84'));}}else{loggerPredictive['info'](_0x2d96('0x84'));}return![];}function mergeDataErlangB(_0x3ec4f5){return function(_0x6c44e8){loggerPredictive['info'](_0x2d96('0x85'));loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x86'),_0x6c44e8['erlangCalls']);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x87'),_0x6c44e8['erlangCallToSecond']);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x88'),_0x6c44e8['erlangAbandonmentRate']);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x89'),_0x6c44e8[_0x2d96('0x8a')]);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x88'),_0x6c44e8['erlangAbandonmentRate']);loggerPredictive['info'](_0x2d96('0x81'));_[_0x2d96('0x8b')](_0x3ec4f5,_0x6c44e8);};}function getDiff(_0x212597){var _0x552c47=moment()[_0x2d96('0x4a')](0x0);var _0x33ee6d=moment(_0x212597)[_0x2d96('0x4a')](0x0);return _0x552c47[_0x2d96('0x8c')](_0x33ee6d,_0x2d96('0x8d'));}function ifInterval(_0x2a692e,_0x412ffa){if(_[_0x2d96('0x3c')](_0x412ffa)){return![];}if(getDiff(_0x412ffa)<_0x2a692e*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x370c58){if(isNotNull(_0x370c58)){if(!_['isUndefined'](_0x370c58['startProgressive'])){_0x370c58[_0x2d96('0x2c')]=undefined;loggerPredictive[_0x2d96('0x7a')](_0x370c58[_0x2d96('0x40')],_0x2d96('0x8e'));}if(!_[_0x2d96('0x3c')](_0x370c58[_0x2d96('0x2b')])){_0x370c58[_0x2d96('0x2b')]=undefined;loggerPredictive[_0x2d96('0x7a')](_0x370c58[_0x2d96('0x40')],_0x2d96('0x8f'));}if(!_[_0x2d96('0x3c')](_0x370c58[_0x2d96('0x90')])){clearInterval(_0x370c58[_0x2d96('0x90')]);_0x370c58[_0x2d96('0x90')]=undefined;loggerPredictive['info'](_0x370c58[_0x2d96('0x40')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x4f2ef6,_0x2c0860){if(_0x2c0860===0x0){return 0x0;}var _0x2c9807=0x1;for(var _0x4b6542=0x1;_0x4b6542<=_0x2c0860;_0x4b6542+=0x1){_0x2c9807=0x1+_0x2c9807*_0x4b6542/_0x4f2ef6;}return 0x1/_0x2c9807;}function isVoiceQueueOutbound(_0x316c5d){return _0x316c5d===_0x2d96('0x91');}function isNotPreview(_0x52605d){return _0x52605d!==_0x2d96('0x23');}function isCampaignIvr(_0x5e3b38){return _0x5e3b38===_0x2d96('0x77');}function getCallerId(_0x3382ad,_0xf3340c,_0x420b6d){if(!_[_0x2d96('0x3c')](_0x420b6d)&&_0x2d96('0x92')===typeof _0x420b6d&&!_[_0x2d96('0x46')](_0x420b6d)){if(!_['isUndefined'](_0xf3340c)&&_0x2d96('0x92')===typeof _0xf3340c&&!_[_0x2d96('0x46')](_0xf3340c)){return util['format'](_0x2d96('0x93'),_0xf3340c,_0x420b6d);}return util['format']('\x22%s\x22\x20<%s>',_0x420b6d,_0x420b6d);}if(!_[_0x2d96('0x3c')](_0x3382ad)&&_0x2d96('0x92')===typeof _0x3382ad&&!_[_0x2d96('0x46')](_0x3382ad)){return _0x3382ad;}return _0x2d96('0x94');}function loggerCatchQueueSummary(_0x46e0f8,_0x5c84f7){return function(_0x3079c8){freeVariablesPredictive(_0x5c84f7);emitVoiceQueueSummary(_0x5c84f7);emitCampaignSummary(_0x5c84f7);loggerSyncQueueSummary[_0x2d96('0x95')](_0x46e0f8,util['inspect'](_0x3079c8,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x238aa5,_0x43fe87){return function(_0x21e66c){loggerPredictive[_0x2d96('0x95')](_0x43fe87[_0x2d96('0x40')],_0x238aa5);loggerPredictive[_0x2d96('0x95')](_0x21e66c[_0x2d96('0x96')]);freeVariablesPredictive(_0x43fe87);};}function loggerCatch(_0x2e1eff){return function(_0x5490b9){logger[_0x2d96('0x95')](_0x2e1eff,util['inspect'](_0x5490b9,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x106a48){return _0x106a48&&!_['isUndefined'](_0x106a48)&&_0x106a48[_0x2d96('0x97')]>0x0;}function decremetOriginate(_0x39d785){if(!_[_0x2d96('0x3c')](_0x39d785)&&_0x39d785!==null){if(_0x39d785['hasOwnProperty'](_0x2d96('0x6f'))){if(_0x39d785['originated']>0x0){_0x39d785['originated']-=0x1;}else{logger[_0x2d96('0x95')](_0x2d96('0x98'));}}}else{logger[_0x2d96('0x95')](_0x2d96('0x99'));}}function checkContactLowerLimitOriginate(_0x124045,_0x115efc,_0xf13a93){if(_0x115efc>_0xf13a93){for(var _0x23759d=0x0;_0x23759d<_0x115efc-_0xf13a93;_0x23759d+=0x1){decremetOriginate(_0x124045);}}}function loggerGetContactDialer(_0x249787,_0x22ad71,_0x12822f){return function(_0x5c7db8){checkContactLowerLimitOriginate(_0x22ad71,_0x12822f,0x0);logger['error'](_0x249787,util[_0x2d96('0x9a')](_0x5c7db8,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x335fdf){return function(_0x434481){if(isNotNull(_0x434481)&&isNotNull(_0x434481[0x0])){if(_0x434481[0x0]['contactsRescheduled']>0x0){_0x335fdf[_0x2d96('0x3e')]=_0x2d96('0x9b');logger[_0x2d96('0x7a')](_0x2d96('0x9c')+_0x335fdf[_0x2d96('0x40')],_0x434481[0x0][_0x2d96('0x9d')],_0x2d96('0x9e'));}else{_0x335fdf['message']=_0x2d96('0x9f');logger[_0x2d96('0x7a')](_0x2d96('0xa0')+_0x335fdf[_0x2d96('0x40')]);}}};}function notSendMessagesQueue(_0x210b72){if(_0x210b72['sendMessageOneNotActive']){freeVariablesPredictive(_0x210b72);if(_0x210b72['originated']===0x0&&_0x210b72[_0x2d96('0x51')]===0x0&&_0x210b72[_0x2d96('0x54')]===0x0&&(_0x210b72['pTalking']||0x0)===0x0){_0x210b72[_0x2d96('0xa1')]=![];_0x210b72[_0x2d96('0x4d')]=0x0;_0x210b72[_0x2d96('0x3e')]=_0x2d96('0x3f');loggerSyncQueueSummary['error'](_0x2d96('0xa2'),_0x210b72[_0x2d96('0x40')],'is\x20not\x20active');}else{_0x210b72[_0x2d96('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x2d96('0xa2'),_0x210b72[_0x2d96('0x40')],'is\x20disactive');}emitVoiceQueueSummary(_0x210b72);}}function notSendMessagesCampaign(_0x1cb26d){if(_0x1cb26d[_0x2d96('0xa1')]){if(_0x1cb26d[_0x2d96('0x6f')]===0x0){_0x1cb26d['sendMessageOneNotActive']=![];_0x1cb26d[_0x2d96('0x3e')]=_0x2d96('0x3f');loggerSyncQueueSummary[_0x2d96('0x95')](_0x2d96('0xa3'),_0x1cb26d[_0x2d96('0x40')],_0x2d96('0xa4'));}else{_0x1cb26d['message']=_0x2d96('0xa5');loggerSyncQueueSummary['error'](_0x2d96('0xa3'),_0x1cb26d[_0x2d96('0x40')],_0x2d96('0xa6'));}emitCampaignSummary(_0x1cb26d);}}function createObjHistory(_0x21c669,_0xe5af73,_0x595e1f,_0x20b7e6,_0x56a695){_0x21c669[_0x2d96('0x3e')]=_0x595e1f;var _0x2e5eb3=new Action(_0x21c669,_0xe5af73);var _0x50b2b6=new History(_0x2e5eb3);_0x50b2b6[_0x2d96('0xa7')]=_0x20b7e6;_0x50b2b6[_0x2d96('0xa8')]=_0x56a695;_0x50b2b6[_0x2d96('0xa9')]=_0x2e5eb3[_0x2d96('0xaa')];return _0x50b2b6;}Dialer['prototype'][_0x2d96('0x3b')]=function(){var _0x12204c=this;setInterval(function(){_0x12204c['clearZombieChannels'](_0x12204c[_0x2d96('0x29')],_0x2d96('0xab'));_0x12204c[_0x2d96('0xac')](_0x12204c[_0x2d96('0xad')],_0x2d96('0xae'));},0x32c8);};Dialer['prototype'][_0x2d96('0xac')]=function(_0x42f514,_0x11dfcf){var _0x5284d8=this;for(var _0x5ddbdb in _0x42f514){if(_0x42f514[_0x2d96('0xaf')](_0x5ddbdb)){this[_0x2d96('0x22')][_0x2d96('0x20')](function(){if(!_['isNil'](_0x42f514[_0x5ddbdb])){return ami[_0x2d96('0xb0')]({'action':_0x2d96('0xb1'),'channel':_0x42f514[_0x5ddbdb]['channel']})['catch'](function(_0x29cd4d){if(_0x29cd4d['message']===_0x2d96('0xb2')){setTimeout(function(){if(_0x42f514[_0x5ddbdb]&&_0x42f514[_0x5ddbdb][_0x2d96('0x4c')]!==_0x2d96('0x77')){_0x5284d8['updateOriginated'](_0x5284d8[_0x2d96('0x24')][_0x42f514[_0x5ddbdb][_0x2d96('0xb3')]]);logger['error'](_0x2d96('0xb4'),_0x11dfcf,_0x5ddbdb,_0x42f514[_0x5ddbdb][_0x2d96('0xb3')]);delete _0x42f514[_0x5ddbdb];}if(_0x42f514[_0x5ddbdb]&&_0x42f514[_0x5ddbdb][_0x2d96('0x4c')]===_0x2d96('0x77')){_0x5284d8['updateOriginated'](_0x5284d8['campaigns'][_0x42f514[_0x5ddbdb]['queue']]);logger[_0x2d96('0x95')](_0x2d96('0xb5'),_0x11dfcf,_0x5ddbdb,_0x42f514[_0x5ddbdb]['queue']);delete _0x42f514[_0x5ddbdb];}},0x2328);}});}});}}};Dialer['prototype'][_0x2d96('0xb6')]=function(_0x53a0c3){return BPromise[_0x2d96('0xb7')]()[_0x2d96('0xb8')](cmHopper[_0x2d96('0xb6')](_0x53a0c3))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xba')));};Dialer[_0x2d96('0xbb')][_0x2d96('0xbc')]=function(_0x3ac2ef){return BPromise[_0x2d96('0xb7')]()['then'](cmHopperBlack[_0x2d96('0xbc')](_0x3ac2ef))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xbd')));};Dialer['prototype'][_0x2d96('0xbe')]=function(_0x36e265){return BPromise['resolve']()['then'](cmHopperBlack[_0x2d96('0xbe')](_0x36e265))['catch'](loggerCatch(_0x2d96('0xbf')));};Dialer['prototype']['averageHandleTime']=function(_0x482780){return BPromise[_0x2d96('0xb7')]()[_0x2d96('0xb8')](cmHopperHistory[_0x2d96('0xc0')](_0x482780))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype'][_0x2d96('0xc1')]=function(_0x35ed9f){return BPromise[_0x2d96('0xb7')]()[_0x2d96('0xb8')](cmHopper[_0x2d96('0xc1')](_0x35ed9f))[_0x2d96('0xb9')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype'][_0x2d96('0xc2')]=function(_0x2c5e9a,_0x50e316,_0x523670){return BPromise[_0x2d96('0xb7')]()[_0x2d96('0xb8')](cmHopper[_0x2d96('0xc2')](_0x2c5e9a,_0x50e316,_0x523670))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xc3')));};Dialer[_0x2d96('0xbb')][_0x2d96('0xc4')]=function(_0x33dee8,_0x3bdb79,_0x2af692,_0x2918b6){return BPromise[_0x2d96('0xb7')]()[_0x2d96('0xb8')](cmHopper[_0x2d96('0xc4')](_0x33dee8,_0x3bdb79,_0x2af692,_0x2918b6))[_0x2d96('0xb9')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x2d96('0xbb')][_0x2d96('0xc5')]=function(_0x149726,_0x51d340,_0x510271){return BPromise['resolve']()[_0x2d96('0xb8')](cmHopper[_0x2d96('0xc5')](_0x149726,_0x51d340,_0x510271))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xc6')));};Dialer[_0x2d96('0xbb')][_0x2d96('0xc7')]=function(_0x79bded){return BPromise['resolve']()[_0x2d96('0xb8')](voiceQueueRt[_0x2d96('0xc7')](_0x79bded))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xc8')));};Dialer[_0x2d96('0xbb')][_0x2d96('0xc9')]=function(_0x10423e){return BPromise[_0x2d96('0xb7')]()[_0x2d96('0xb8')](cmHopper[_0x2d96('0xc9')](_0x10423e))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xca')));};Dialer[_0x2d96('0xbb')][_0x2d96('0xcb')]=function(_0x13108b){return BPromise['resolve']()[_0x2d96('0xb8')](cmHopperHistory['createHistory'](_0x13108b))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xcc')));};Dialer['prototype'][_0x2d96('0xcd')]=function(_0x17a08b){if(!_[_0x2d96('0x3c')](_0x17a08b)&&_0x17a08b!==null){if(_0x17a08b[_0x2d96('0xaf')](_0x2d96('0x6f'))){if(_0x17a08b['originated']>0x0){_0x17a08b[_0x2d96('0x6f')]-=0x1;}else{logger['error'](_0x2d96('0xce'));}}}else{logger[_0x2d96('0x95')](_0x2d96('0xcf'));}};Dialer['prototype'][_0x2d96('0xd0')]=function(_0x5c2f9a,_0x277370){var _0x21d6a2=this;return function(_0x1185bb){_0x21d6a2[_0x2d96('0xcd')](_0x277370);logger[_0x2d96('0x95')](_0x5c2f9a,util[_0x2d96('0x9a')](_0x1185bb,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x2d96('0xd1')]=function(_0x1b7038,_0x5e8a34,_0xd8ecaa){var _0x61a796={'state':0x19,'statedesc':_0x2d96('0xd2')};this[_0x2d96('0xcd')](_0x5e8a34);this['saveInDb'](_['merge'](_0x61a796,_['pick'](_0xd8ecaa,['ContactId',_0x2d96('0xd3'),'UserId','VoiceQueueId','CampaignId'])),_0x2d96('0xd4'),'[emptyContact]');logger[_0x2d96('0x95')](_0x1b7038);};Dialer[_0x2d96('0xbb')][_0x2d96('0xd5')]=function(_0x409622){return _0x409622===_0x2d96('0xd6');};Dialer[_0x2d96('0xbb')][_0x2d96('0xd7')]=function(_0x3d4d84){return!_[_0x2d96('0x3c')](_0x3d4d84)&&_0x3d4d84&&!_['isUndefined'](_0x3d4d84[_0x2d96('0x40')])&&!_[_0x2d96('0x3c')](_0x3d4d84[_0x2d96('0x73')])&&_0x3d4d84[_0x2d96('0x73')]&&(this[_0x2d96('0x26')][util[_0x2d96('0x74')](_0x2d96('0xd8'),_0x3d4d84[_0x2d96('0x40')])]['status']===_0x2d96('0xd9')||this[_0x2d96('0x26')][util['format']('SIP/%s',_0x3d4d84['name'])][_0x2d96('0xb1')]===_0x2d96('0xda'));};Dialer[_0x2d96('0xbb')][_0x2d96('0xdb')]=function(_0x3882e0,_0x13c75d,_0x10c320){this[_0x2d96('0xcb')](_0x3882e0)[_0x2d96('0xb9')](loggerCatch(_0x13c75d));this[_0x2d96('0xc9')](_0x3882e0)['catch'](loggerCatch(_0x10c320));};Dialer[_0x2d96('0xbb')][_0x2d96('0x37')]=function(_0x349743){var _0x30920c=this[_0x2d96('0x29')][_0x349743[_0x2d96('0xdc')]];var _0x379f3b;if(!_[_0x2d96('0xdd')](_0x349743)&&!_['isNil'](_0x349743[_0x2d96('0xde')])&&!_[_0x2d96('0xdd')](_0x349743[_0x2d96('0xde')]['amdstatus'])&&_0x349743[_0x2d96('0xdf')]==='xcally-motion-dialer'&&_0x30920c){if(_0x30920c['type']!==_0x2d96('0x77')&&this['voiceQueues'][_0x30920c[_0x2d96('0xb3')]][_0x2d96('0xe0')]&&_0x349743[_0x2d96('0xe1')]==='HANGUP'){delete this['uniqueId'][_0x349743[_0x2d96('0xdc')]];this[_0x2d96('0xcd')](this[_0x2d96('0x24')][_0x30920c[_0x2d96('0xb3')]]);this[_0x2d96('0x24')][_0x30920c['queue']][_0x2d96('0xe2')]+=0x1;this[_0x2d96('0x24')][_0x30920c[_0x2d96('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;_0x379f3b=new Hangup(_0x30920c,_0x349743);_0x379f3b[_0x2d96('0xa7')]=0x12;_0x379f3b[_0x2d96('0xa8')]=_0x2d96('0xe3');_0x379f3b[_0x2d96('0xe4')]='AMD';this[_0x2d96('0xdb')](_0x379f3b,'[syncHangupInAMD][createHistory]',_0x2d96('0xe5'));}if(_0x30920c[_0x2d96('0x4c')]!==_0x2d96('0x77')&&this[_0x2d96('0x24')][_0x30920c[_0x2d96('0xb3')]][_0x2d96('0xe0')]&&_0x349743[_0x2d96('0xe1')]===_0x2d96('0xe6')){var _0x5ef4e8=this;return new BPromise(function(_0x47f278,_0x475f79){delete _0x5ef4e8[_0x2d96('0x29')][_0x349743[_0x2d96('0xdc')]];_0x5ef4e8[_0x2d96('0xcd')](_0x5ef4e8[_0x2d96('0x24')][_0x30920c[_0x2d96('0xb3')]]);_0x5ef4e8[_0x2d96('0x24')][_0x30920c[_0x2d96('0xb3')]]['outboundAnswerCallsDay']+=0x1;_0x5ef4e8[_0x2d96('0x24')][_0x30920c[_0x2d96('0xb3')]][_0x2d96('0xe7')]+=0x1;var _0x576e22=_0x5ef4e8[_0x2d96('0x24')][_0x30920c[_0x2d96('0xb3')]];var _0x8ea134=new Hangup(_0x30920c,_0x349743);_0x8ea134[_0x2d96('0xa7')]=0x13;_0x8ea134[_0x2d96('0xa8')]='Machine';_0x8ea134[_0x2d96('0xe4')]=_0x2d96('0xe8');_0x8ea134['countmachineretry']+=0x1;_0x8ea134['countglobal']+=0x1;_0x8ea134['amd']=!![];_0x5ef4e8['createHistory'](_0x8ea134)[_0x2d96('0xb9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x8ea134[_0x2d96('0xe9')]+_0x8ea134[_0x2d96('0xea')]+_0x8ea134[_0x2d96('0xeb')]+_0x8ea134[_0x2d96('0xec')]+_0x8ea134[_0x2d96('0xed')]+_0x8ea134['countabandonedretry']+_0x8ea134[_0x2d96('0xee')]+_0x8ea134[_0x2d96('0xef')]>=_0x576e22[_0x2d96('0xf0')]){_0x5ef4e8[_0x2d96('0xf1')](_0x8ea134,_0x47f278,_0x475f79,_0x2d96('0xf2'));}else{if(_0x8ea134[_0x2d96('0xee')]>=_0x576e22[_0x2d96('0xf3')]){_0x5ef4e8[_0x2d96('0xf4')](_0x8ea134,_0x47f278,_0x475f79,'reason\x2019\x20machine....');}else{_0x5ef4e8[_0x2d96('0xc1')]({'active':![],'countmachineretry':_0x8ea134[_0x2d96('0xee')],'scheduledat':moment()[_0x2d96('0xf5')](_0x576e22[_0x2d96('0xf6')],_0x2d96('0xf7'))['format'](_0x2d96('0xf8')),'ContactId':_0x8ea134[_0x2d96('0xf9')],'ListId':_0x8ea134[_0x2d96('0xd3')],'VoiceQueueId':_0x8ea134[_0x2d96('0xfa')]||undefined,'CampaignId':_0x8ea134[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xfc')));_0x47f278({'reschedule':0x1});}}});}if(_0x30920c['type']===_0x2d96('0x77')&&this[_0x2d96('0xfd')][_0x30920c[_0x2d96('0xb3')]]['dialAMDActive']&&_0x349743[_0x2d96('0xe1')]==='HANGUP'){delete this[_0x2d96('0x29')][_0x349743[_0x2d96('0xdc')]];this[_0x2d96('0xcd')](this[_0x2d96('0xfd')][_0x30920c[_0x2d96('0xb3')]]);_0x379f3b=new Hangup(_0x30920c,_0x349743);_0x379f3b[_0x2d96('0xa7')]=0x12;_0x379f3b[_0x2d96('0xa8')]='HangupInAMD';_0x379f3b['membername']=_0x2d96('0xe8');this['saveInDb'](_0x379f3b,_0x2d96('0xfe'),'[syncHangupInAMDIvr]');}if(_0x30920c[_0x2d96('0x4c')]===_0x2d96('0x77')&&this['campaigns'][_0x30920c[_0x2d96('0xb3')]]['dialAMDActive']&&_0x349743[_0x2d96('0xe1')]==='MACHINE'){var _0x5ef4e8=this;return new BPromise(function(_0xa3ac3a,_0x4a10b1){delete _0x5ef4e8[_0x2d96('0x29')][_0x349743[_0x2d96('0xdc')]];_0x5ef4e8[_0x2d96('0xcd')](_0x5ef4e8['campaigns'][_0x30920c[_0x2d96('0xb3')]]);_0x5ef4e8[_0x2d96('0xfd')][_0x30920c[_0x2d96('0xb3')]][_0x2d96('0xe2')]+=0x1;_0x5ef4e8[_0x2d96('0xfd')][_0x30920c[_0x2d96('0xb3')]][_0x2d96('0xe7')]+=0x1;var _0x1f489a=_0x5ef4e8['campaigns'][_0x30920c[_0x2d96('0xb3')]];var _0x1db6fa=new Hangup(_0x30920c,_0x349743);_0x1db6fa[_0x2d96('0xa7')]=0x13;_0x1db6fa['statedesc']=_0x2d96('0xff');_0x1db6fa[_0x2d96('0xe4')]=_0x2d96('0xe8');_0x1db6fa[_0x2d96('0xee')]+=0x1;_0x1db6fa[_0x2d96('0x100')]+=0x1;_0x1db6fa[_0x2d96('0x101')]=!![];_0x5ef4e8[_0x2d96('0xcb')](_0x1db6fa)[_0x2d96('0xb9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1db6fa[_0x2d96('0xe9')]+_0x1db6fa['countcongestionretry']+_0x1db6fa[_0x2d96('0xeb')]+_0x1db6fa['countnosuchnumberretry']+_0x1db6fa[_0x2d96('0xed')]+_0x1db6fa[_0x2d96('0x102')]+_0x1db6fa[_0x2d96('0xee')]+_0x1db6fa[_0x2d96('0xef')]>=_0x1f489a[_0x2d96('0xf0')]){_0x5ef4e8['stateGlobal'](_0x1db6fa,_0xa3ac3a,_0x4a10b1,_0x2d96('0xf2'));}else{if(_0x1db6fa[_0x2d96('0xee')]>=_0x1f489a[_0x2d96('0xf3')]){_0x5ef4e8[_0x2d96('0xf4')](_0x1db6fa,_0xa3ac3a,_0x4a10b1,_0x2d96('0x103'));}else{_0x5ef4e8[_0x2d96('0xc1')]({'active':![],'countmachineretry':_0x1db6fa[_0x2d96('0xee')],'scheduledat':moment()[_0x2d96('0xf5')](_0x1f489a['dialMachineRetryFrequency'],_0x2d96('0xf7'))[_0x2d96('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1db6fa['ContactId'],'ListId':_0x1db6fa['ListId'],'VoiceQueueId':_0x1db6fa[_0x2d96('0xfa')]||undefined,'CampaignId':_0x1db6fa[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xfc')));_0xa3ac3a({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x2d96('0x34')]=function(_0x2eb7a7){var _0x16e544=this[_0x2d96('0x29')][_0x2eb7a7['uniqueid']];var _0x14ddce=this;var _0x46c845;if(_0x16e544&&_0x16e544[_0x2d96('0x4c')]===_0x2d96('0x77')){delete this[_0x2d96('0x29')][_0x2eb7a7['uniqueid']];this[_0x2d96('0xcd')](this['campaigns'][_0x16e544[_0x2d96('0xb3')]]);this['campaigns'][_0x16e544[_0x2d96('0xb3')]][_0x2d96('0x104')]+=0x1;_0x46c845=new Hangup(_0x16e544,_0x2eb7a7);this['createHistory'](_0x46c845)[_0x2d96('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x2d96('0xc9')](_0x46c845)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x105')));}if(_0x16e544&&_0x16e544[_0x2d96('0x4c')]!==_0x2d96('0x77')&&isNotNull(this[_0x2d96('0x24')][_0x16e544['queue']]['dialQueueProject'])){delete this[_0x2d96('0x29')][_0x2eb7a7[_0x2d96('0xdc')]];this[_0x2d96('0xcd')](this['voiceQueues'][_0x16e544[_0x2d96('0xb3')]]);this[_0x2d96('0x24')][_0x16e544[_0x2d96('0xb3')]]['outboundAnswerCallsDay']+=0x1;this[_0x2d96('0x24')][_0x16e544[_0x2d96('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;_0x46c845=new Hangup(_0x16e544,_0x2eb7a7);_0x46c845['state']=0x10;_0x46c845[_0x2d96('0xa8')]=_0x2d96('0x106');_0x46c845[_0x2d96('0xe4')]=_0x2d96('0x107');this[_0x2d96('0xcb')](_0x46c845)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x2d96('0xc9')](_0x46c845)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x105')));}if(_0x16e544&&_0x16e544[_0x2d96('0x4c')]!==_0x2d96('0x77')&&!isNotNull(this[_0x2d96('0x24')][_0x16e544['queue']][_0x2d96('0x108')])){delete this[_0x2d96('0x29')][_0x2eb7a7[_0x2d96('0xdc')]];this[_0x2d96('0xcd')](this[_0x2d96('0x24')][_0x16e544[_0x2d96('0xb3')]]);this['voiceQueues'][_0x16e544[_0x2d96('0xb3')]][_0x2d96('0x65')]+=0x1;_0x46c845=new Hangup(_0x16e544,_0x2eb7a7);_0x46c845[_0x2d96('0xa7')]=0xc;_0x46c845[_0x2d96('0xa8')]=_0x2eb7a7[_0x2d96('0x109')];_0x46c845[_0x2d96('0xe4')]=_0x2d96('0x10a');this[_0x2d96('0xcb')](_0x46c845)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x10b')));this[_0x2d96('0xc9')](_0x46c845)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x105')));}};Dialer[_0x2d96('0xbb')][_0x2d96('0x10c')]=function(_0x8ce950){var _0xd3e78a=this[_0x2d96('0x29')][_0x8ce950[_0x2d96('0xdc')]];var _0x39e7ac=this;if(this[_0x2d96('0x24')][_0x8ce950['queue']]){if(_0xd3e78a&&_0xd3e78a['type']!==_0x2d96('0x77')){delete this[_0x2d96('0x29')][_0x8ce950['uniqueid']];this['voiceQueues'][_0x8ce950['queue']][_0x2d96('0xe2')]+=0x1;var _0xba0104=new AgentComplete(_0xd3e78a,_0x8ce950);if(_0x8ce950[_0x2d96('0x10d')]==='agent'){_0xba0104['agiafterat']=this['voiceQueues'][_0x8ce950[_0x2d96('0xb3')]]['dialQueueProject2']&&this['voiceQueues'][_0x8ce950[_0x2d96('0xb3')]][_0x2d96('0x10e')]?moment()[_0x2d96('0x74')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x2d96('0xcb')](_0xba0104)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x10f')));this[_0x2d96('0xc9')](_0xba0104)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x2d96('0xbb')]['syncAgentConnect']=function(_0x26a3c8){if(this['voiceQueues'][_0x26a3c8['queue']]){if(this[_0x2d96('0x29')][_0x26a3c8['uniqueid']]&&this[_0x2d96('0x29')][_0x26a3c8[_0x2d96('0xdc')]][_0x2d96('0x4c')]!==_0x2d96('0x77')){this[_0x2d96('0xcd')](this[_0x2d96('0x24')][_0x26a3c8[_0x2d96('0xb3')]]);this[_0x2d96('0x29')][_0x26a3c8[_0x2d96('0xdc')]][_0x2d96('0x110')]=moment()[_0x2d96('0x74')](_0x2d96('0xf8'));}}};Dialer[_0x2d96('0xbb')][_0x2d96('0x111')]=function(_0xb8a891){this[_0x2d96('0xcb')](_0xb8a891)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x10f')));this['moveContactManagedDialer'](_0xb8a891)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x112')));};Dialer[_0x2d96('0xbb')]['syncQueueCallerAbandon']=function(_0x336206){var _0x4e127=this[_0x2d96('0x29')][_0x336206[_0x2d96('0xdc')]];var _0x475ba0=this;if(this['voiceQueues'][_0x336206[_0x2d96('0xb3')]]){if(_0x4e127&&_0x4e127[_0x2d96('0x4c')]!==_0x2d96('0x77')){delete this[_0x2d96('0x29')][_0x336206['uniqueid']];this['updateOriginated'](this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]]);_0x4e127['droptime']=moment()[_0x2d96('0x74')](_0x2d96('0xf8'));var _0x1dc8bf=new QueueCallerAbandon(_0x4e127,_0x336206);if(getSeconds(_0x4e127[_0x2d96('0x113')],_0x4e127[_0x2d96('0x114')])>=_0x4e127[_0x2d96('0x115')]){this['voiceQueues'][_0x336206[_0x2d96('0xb3')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]][_0x2d96('0x5f')]+=0x1;this[_0x2d96('0x24')][_0x336206['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x1dc8bf[_0x2d96('0xa7')]=0xa;_0x1dc8bf[_0x2d96('0xa8')]=_0x2d96('0x116');_0x1dc8bf[_0x2d96('0x117')]='TIMEOUT';_0x1dc8bf[_0x2d96('0x118')]=this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]]['dialQueueProject2']?moment()[_0x2d96('0x74')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x1dc8bf['countdropretry']+=0x1;_0x1dc8bf[_0x2d96('0x100')]+=0x1;if(_0x1dc8bf[_0x2d96('0xed')]>=this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]][_0x2d96('0x119')]){this['queueCallerAbandonCreateState'](_0x1dc8bf);}else{this[_0x2d96('0xc1')]({'active':![],'countdropretry':_0x1dc8bf[_0x2d96('0xed')],'scheduledat':moment()[_0x2d96('0xf5')](this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]]['dialDropRetryFrequency'],'minutes')['format'](_0x2d96('0xf8')),'ContactId':_0x4e127[_0x2d96('0xf9')],'ListId':_0x4e127[_0x2d96('0xd3')],'VoiceQueueId':_0x4e127[_0x2d96('0xfa')]||undefined,'CampaignId':_0x4e127[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x11a')));var _0x1dfd1a=new History(_0x1dc8bf);_0x1dfd1a[_0x2d96('0xa7')]=0xa;_0x1dfd1a[_0x2d96('0xa8')]=_0x2d96('0x116');_0x1dfd1a[_0x2d96('0xaa')]=moment()[_0x2d96('0x74')](_0x2d96('0xf8'));_0x1dfd1a[_0x2d96('0xa9')]=_0x1dfd1a[_0x2d96('0xaa')];_0x1dfd1a[_0x2d96('0x11b')]=_0x1dc8bf[_0x2d96('0x11b')];_0x1dfd1a['calleridnum']=_0x1dc8bf['calleridnum'];this[_0x2d96('0xcb')](_0x1dfd1a)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x11c')));}}else{this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]][_0x2d96('0x69')]+=0x1;this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]][_0x2d96('0x5e')]+=0x1;_0x1dc8bf[_0x2d96('0xa7')]=0xb;_0x1dc8bf[_0x2d96('0xa8')]='Abandoned';_0x1dc8bf[_0x2d96('0x117')]=_0x2d96('0x11d');_0x1dc8bf[_0x2d96('0x102')]+=0x1;_0x1dc8bf['countglobal']+=0x1;if(_0x1dc8bf[_0x2d96('0x102')]>=this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]][_0x2d96('0x11e')]){this[_0x2d96('0x111')](_0x1dc8bf);}else{this[_0x2d96('0xc1')]({'active':![],'countabandonedretry':_0x1dc8bf[_0x2d96('0x102')],'scheduledat':moment()[_0x2d96('0xf5')](this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]][_0x2d96('0x11f')],_0x2d96('0xf7'))[_0x2d96('0x74')](_0x2d96('0xf8')),'ContactId':_0x4e127[_0x2d96('0xf9')],'ListId':_0x4e127[_0x2d96('0xd3')],'VoiceQueueId':_0x4e127[_0x2d96('0xfa')]||undefined,'CampaignId':_0x4e127[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x120')));var _0x1dfd1a=new History(_0x1dc8bf);_0x1dfd1a[_0x2d96('0xa7')]=0xb;_0x1dfd1a['statedesc']=_0x2d96('0x121');_0x1dfd1a[_0x2d96('0xaa')]=moment()[_0x2d96('0x74')]('YYYY-MM-DD\x20HH:mm:ss');_0x1dfd1a[_0x2d96('0xa9')]=_0x1dfd1a['starttime'];_0x1dfd1a['calleridname']=_0x1dc8bf[_0x2d96('0x11b')];_0x1dfd1a[_0x2d96('0x122')]=_0x1dc8bf['calleridnum'];this['createHistory'](_0x1dfd1a)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype'][_0x2d96('0x35')]=function(_0xba199){if(this[_0x2d96('0xad')][_0xba199[_0x2d96('0xdc')]]){this['actions'][_0xba199[_0x2d96('0xdc')]][_0x2d96('0x123')]=_0xba199[_0x2d96('0x123')];}if(this['uniqueId'][_0xba199[_0x2d96('0xdc')]]){this[_0x2d96('0x29')][_0xba199[_0x2d96('0xdc')]][_0x2d96('0x123')]=_0xba199['channel'];}};Dialer[_0x2d96('0xbb')][_0x2d96('0x124')]=function(_0x1ab5e6){if(strategy[this[_0x2d96('0x24')][this[_0x2d96('0xad')][_0x1ab5e6[_0x2d96('0x125')]][_0x2d96('0xb3')]][_0x2d96('0x126')]]===_0x2d96('0x1f')){if(this[_0x2d96('0xad')][_0x1ab5e6[_0x2d96('0x125')]]&&_[_0x2d96('0xdd')](this['actions'][_0x1ab5e6[_0x2d96('0x125')]][_0x2d96('0x127')])&&_0x1ab5e6[_0x2d96('0xb1')]==='1'&&_0x1ab5e6['paused']==='0'){if(this['agents'][_0x1ab5e6[_0x2d96('0x128')]]){if(!this[_0x2d96('0x25')][_0x1ab5e6[_0x2d96('0x128')]]['locked']){this[_0x2d96('0x25')][_0x1ab5e6[_0x2d96('0x128')]]['locked']=!![];this[_0x2d96('0xad')][_0x1ab5e6['actionid']][_0x2d96('0x127')]=!![];this['actions'][_0x1ab5e6['actionid']][_0x2d96('0x128')]=_0x1ab5e6[_0x2d96('0x128')];}}}}else if((strategy[this['voiceQueues'][this[_0x2d96('0xad')][_0x1ab5e6['actionid']][_0x2d96('0xb3')]][_0x2d96('0x126')]]||_0x2d96('0x1e'))===_0x2d96('0x1e')){if(this['actions'][_0x1ab5e6[_0x2d96('0x125')]]){if(this[_0x2d96('0x25')][_0x1ab5e6[_0x2d96('0x128')]]){this[_0x2d96('0xad')][_0x1ab5e6[_0x2d96('0x125')]][_0x2d96('0x128')]=_0x1ab5e6['stateinterface'];if(_[_0x2d96('0xdd')](this[_0x2d96('0x2e')][this[_0x2d96('0xad')][_0x1ab5e6['actionid']][_0x2d96('0xb3')]])){this[_0x2d96('0x2e')][this[_0x2d96('0xad')][_0x1ab5e6[_0x2d96('0x125')]]['queue']]=[];}this[_0x2d96('0x2e')][this['actions'][_0x1ab5e6[_0x2d96('0x125')]][_0x2d96('0xb3')]]['push'](_['merge'](_[_0x2d96('0x129')](this['actions'][_0x1ab5e6['actionid']],[_0x2d96('0x12a'),_0x2d96('0x128')]),{'status':_0x1ab5e6[_0x2d96('0xb1')],'paused':_0x1ab5e6[_0x2d96('0x12b')]}));}}}};function unlockQueueStatus(_0xbfa8d8,_0x577437){setTimeout(function(){if(_[_0x2d96('0x3c')](_0xbfa8d8[_0x2d96('0x12c')])){loggerBooked[_0x2d96('0x95')](_0x2d96('0x12d'),_0x577437);}_0xbfa8d8['queueStatusComplete']=!![];loggerBooked[_0x2d96('0x7a')]('[booked][unlockQueueStatus]',_0x577437,JSON['stringify'](_[_0x2d96('0x129')](_0xbfa8d8,[_0x2d96('0x40'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x2d96('0xbb')][_0x2d96('0x12e')]=function(_0x520fc6){var _0x21c6d2=this;var _0x3f241f=_0x21c6d2[_0x2d96('0x24')][_0x21c6d2['actions'][_0x520fc6[_0x2d96('0x125')]]['queue']];if(strategy[this[_0x2d96('0x24')][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0xb3')]][_0x2d96('0x126')]]===_0x2d96('0x1f')){if(this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]]&&this['actions'][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0x128')]){this[_0x2d96('0x23')][_0x2d96('0x12f')](this['actions'][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0x12a')],this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0x128')])[_0x2d96('0xb9')](function(_0x49b04a){logger['error'](_0x2d96('0x130'),util['inspect'](_0x49b04a,{'showHidden':![],'depth':null}));})[_0x2d96('0x131')](function(){_0x21c6d2[_0x2d96('0xcd')](_0x21c6d2['voiceQueues'][_0x21c6d2[_0x2d96('0xad')][_0x520fc6['actionid']][_0x2d96('0xb3')]]);_0x21c6d2['agents'][_0x21c6d2[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0x128')]][_0x2d96('0x127')]=![];delete _0x21c6d2['actions'][_0x520fc6[_0x2d96('0x125')]];unlockQueueStatus(_0x3f241f);});}else{this[_0x2d96('0xcd')](this[_0x2d96('0x24')][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]]['queue']]);this[_0x2d96('0xc1')]({'active':![],'ContactId':this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0xf9')],'ListId':this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]]['ListId'],'VoiceQueueId':this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0xfa')]||undefined,'CampaignId':this[_0x2d96('0xad')][_0x520fc6['actionid']][_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x2d96('0xad')][_0x520fc6['actionid']];unlockQueueStatus(_0x3f241f);}}else if((strategy[this[_0x2d96('0x24')][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0xb3')]][_0x2d96('0x126')]]||_0x2d96('0x1e'))===_0x2d96('0x1e')){var _0x251b6d;if(this[_0x2d96('0xad')][_0x520fc6['actionid']]&&!_[_0x2d96('0x46')](this[_0x2d96('0x2e')][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0xb3')]])){if(this[_0x2d96('0x132')][_0x21c6d2['actions'][_0x520fc6['actionid']][_0x2d96('0xb3')]]){this[_0x2d96('0x132')][_0x21c6d2[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0xb3')]]=this['queueBookedRR'][this['actions'][_0x520fc6[_0x2d96('0x125')]]['queue']]?this[_0x2d96('0x132')][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0xb3')]]:this[_0x2d96('0x2e')][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]]['queue']]?this['queueBooked'][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]]['queue']][_0x2d96('0x133')]||0x0:0x0;}this['queueBooked'][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]]['queue']][_0x2d96('0x133')]=this[_0x2d96('0x132')][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0xb3')]];for(var _0x270914=0x0;_0x270914=0x0?!![]:![];})[_0x2d96('0xb9')](myreject(_0x5d32ec)));}}else{_0x321106['push'](ami[_0x2d96('0xb0')]({'action':_0x2d96('0x147'),'command':util[_0x2d96('0x74')](_0x2d96('0x14a'),_0x1e22b4,!_['isUndefined'](config['timezones'][_0x26fe57])?_0x26fe57:'')})[_0x2d96('0xb8')](function(_0x2daadf){return _0x2daadf[_0x2d96('0x148')]['indexOf']('true')>=0x0?!![]:![];})[_0x2d96('0xb9')](myreject(_0x5d32ec)));}BPromise[_0x2d96('0x14b')](_0x321106)[_0x2d96('0xb8')](function(_0x243b8c){var _0x3fefbe=_[_0x2d96('0x14c')](_0x243b8c);if(_0x3fefbe){return _0x4a2d33(_0x3fefbe);}else{_0x100f43[_0x2d96('0x3e')]=_0x4f64ba?_0x2d96('0x14d'):_0x2d96('0x14e');return _0x5d32ec(msgResponse('[ifTime][promiseAll]',_0x2d96('0x13e'),_0x2d96('0x14f')+_0x4f64ba+'\x20'+_0x34bdd1+_0x2d96('0x150')+util[_0x2d96('0x9a')](_0x1e22b4,{'showHidden':![],'depth':null})+_0x2d96('0x151')+_0x26fe57));}})[_0x2d96('0xb9')](function(_0x2faa37){return _0x5d32ec(msgResponse(_0x2d96('0x13d'),_0x2d96('0x13e'),JSON[_0x2d96('0x49')](_0x2faa37)));});});};Dialer[_0x2d96('0xbb')]['checkDialMethod']=function(_0x4c26bd){var _0x2a75d1=this;return function(){switch(_0x4c26bd['dialMethod']){case'progressive':freeVariablesPredictive(_0x4c26bd);_0x2a75d1[_0x2d96('0x152')](_0x4c26bd,0x1);break;case _0x2d96('0x153'):freeVariablesPredictive(_0x4c26bd);_0x2a75d1[_0x2d96('0x152')](_0x4c26bd,_0x4c26bd[_0x2d96('0x154')]);break;case'predictive':_0x2a75d1[_0x2d96('0xa')](_0x4c26bd);break;case _0x2d96('0x9'):freeVariablesPredictive(_0x4c26bd);_0x2a75d1[_0x2d96('0x152')](_0x4c26bd,0x1);break;default:freeVariablesPredictive(_0x4c26bd);logger[_0x2d96('0x95')](_0x2d96('0x155'),_0x4c26bd[_0x2d96('0x40')],_0x2d96('0x156'));}};};Dialer[_0x2d96('0xbb')][_0x2d96('0x157')]=function(_0xd91994){var _0x3a442d=this;return function(){_0x3a442d[_0x2d96('0x158')](_0xd91994);};};Dialer[_0x2d96('0xbb')][_0x2d96('0xc')]=function(_0x4b83d2){var _0x3630e5=this;if(isNotPreview(_0x4b83d2[_0x2d96('0x57')])){if(isVoiceQueueOutbound(_0x4b83d2[_0x2d96('0x4c')])&&isActive(_0x4b83d2[_0x2d96('0x56')])){_0x4b83d2['sendMessageOneNotActive']=!![];BPromise[_0x2d96('0xb7')]()[_0x2d96('0xb8')](checkIsLoggedIn(_0x4b83d2,_0x4b83d2[_0x2d96('0x159')]))[_0x2d96('0xb8')](checkIsActive(_0x4b83d2,_0x4b83d2['dialActive']))[_0x2d96('0xb8')](checkInterval(_0x4b83d2))[_0x2d96('0xb8')](_0x3630e5[_0x2d96('0x15a')](_0x4b83d2))[_0x2d96('0xb8')](_0x3630e5['checkIfTime'](_0x4b83d2['dialGlobalInterval'],_0x4b83d2[_0x2d96('0x15b')],_0x4b83d2[_0x2d96('0x40')],_0x4b83d2))[_0x2d96('0xb8')](_0x3630e5[_0x2d96('0x13c')](_0x4b83d2[_0x2d96('0x42')],_0x4b83d2['dialTimezone'],_0x4b83d2[_0x2d96('0x40')],_0x4b83d2))[_0x2d96('0xb8')](_0x3630e5[_0x2d96('0x15c')](_0x4b83d2))[_0x2d96('0xb9')](loggerCatchQueueSummary('[syncQueueSummary]',_0x4b83d2));}else{notSendMessagesQueue(_0x4b83d2);}}else{freeVariablesPredictive(_0x4b83d2);}};Dialer[_0x2d96('0xbb')][_0x2d96('0x138')]=function(){var _0x2e51eb=this;var _0x4069eb;for(var _0x4f7e42 in this['campaigns']){if(this[_0x2d96('0xfd')]['hasOwnProperty'](_0x4f7e42)){_0x4069eb=this[_0x2d96('0xfd')][_0x4f7e42];if(isCampaignIvr(_0x4069eb[_0x2d96('0x4c')])&&isActive(_0x4069eb[_0x2d96('0x73')])){_0x4069eb[_0x2d96('0xa1')]=!![];BPromise[_0x2d96('0xb7')]()[_0x2d96('0xb8')](checkIsActive(_0x4069eb,_0x4069eb[_0x2d96('0x73')]))[_0x2d96('0xb8')](checkInterval(_0x4069eb))['then'](_0x2e51eb[_0x2d96('0x15a')](_0x4069eb))[_0x2d96('0xb8')](_0x2e51eb[_0x2d96('0x13b')](_0x4069eb['dialGlobalInterval'],_0x4069eb[_0x2d96('0x15b')],_0x4069eb[_0x2d96('0x40')],_0x4069eb))[_0x2d96('0xb8')](_0x2e51eb[_0x2d96('0x13c')](_0x4069eb['Interval'],_0x4069eb['dialTimezone'],_0x4069eb[_0x2d96('0x40')],_0x4069eb))['then'](_0x2e51eb[_0x2d96('0x157')](_0x4069eb))[_0x2d96('0xb9')](loggerCatchQueueSummary(_0x2d96('0x15d'),_0x4069eb));}else{notSendMessagesCampaign(_0x4069eb);}}}};function getCallerIdRandom(_0x153dbc,_0x5b4968){var _0x3b492e,_0x223a6c,_0x123cd;if(_0x5b4968<=0x0){_0x5b4968=0x1;}_0x3b492e=new RegExp(_0x2d96('0x15e')+_0x5b4968+'}$');_0x223a6c=Math[_0x2d96('0x15f')](0xa,_0x5b4968-0x1);_0x123cd=Math[_0x2d96('0x15f')](0xa,_0x5b4968)-0x1;return util[_0x2d96('0x74')]('%s',_['replace'](_0x153dbc,_0x3b492e,_[_0x2d96('0x160')](_0x223a6c,_0x123cd)));}function extractCalleridName(_0x21baa9){var _0x4b2689=_0x21baa9[_0x2d96('0x161')](/"(.*?)"/);return _0x4b2689?_0x4b2689[0x1]:_0x21baa9;}function extractCalleridNumber(_0x472d98){var _0x460840=_0x472d98[_0x2d96('0x161')](/<(.*?)>/);return _0x460840?_0x460840[0x1]:_0x472d98;}Dialer['prototype'][_0x2d96('0x162')]=function(_0x901549,_0x4d806c){var _0x587f73=this;var _0x4fe087=uuid['v4']();this[_0x2d96('0xad')][_0x4fe087]=new Action(_0x901549,_0x4d806c,_0x4fe087);return new BPromise(function(_0x3d4253,_0x28a3f1){if(_[_0x2d96('0x3c')](_0x901549)&&_0x2d96('0x163')!==typeof _0x901549){return _0x28a3f1(msgResponse(_0x2d96('0x164'),_0x2d96('0x13e'),_0x2d96('0x165')));}if(_[_0x2d96('0x3c')](_0x4d806c[_0x2d96('0x166')][_0x2d96('0x167')])||_0x4d806c[_0x2d96('0x166')][_0x2d96('0x167')]===null){return _0x28a3f1(msgResponse(_0x2d96('0x164'),_0x2d96('0x13e'),_0x2d96('0x168')));}var _0x52ac0d={'XMD-CALLERID':_0x587f73[_0x2d96('0xad')][_0x4fe087][_0x2d96('0x169')](),'XMD-AGI':_0x901549[_0x2d96('0x108')]?util[_0x2d96('0x74')](_0x2d96('0x16a'),ipAgi,_0x901549[_0x2d96('0x108')]):_0x2d96('0x16b'),'XMD-AGIAFTER':_0x901549[_0x2d96('0x16c')]?util[_0x2d96('0x74')](_0x2d96('0x16a'),ipAgi,_0x901549[_0x2d96('0x16c')]):_0x2d96('0x16b'),'XMD-QUEUE':_0x901549[_0x2d96('0x4c')]===_0x2d96('0x91')?util['format'](_0x2d96('0x16d'),_0x901549[_0x2d96('0x40')],_0x901549[_0x2d96('0x16e')]||'',_0x901549[_0x2d96('0x10e')]?'c':'',_0x901549[_0x2d96('0x115')]||0x3):'NONE','XMD-CONTACTID':_0x4d806c[_0x2d96('0xf9')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x587f73[_0x2d96('0xad')][_0x4fe087][_0x2d96('0x169')](),'XMD-AMD':_0x901549['dialAMDActive']?_0x2d96('0x16f'):_0x2d96('0x16b'),'XMD-DESTINATION':_0x2d96('0x170')};if(_0x901549[_0x2d96('0xe0')]){_0x52ac0d[_0x2d96('0x171')]=_0x901549[_0x2d96('0x172')]||0x9c4;_0x52ac0d[_0x2d96('0x173')]=_0x901549[_0x2d96('0x174')]||0x5dc;_0x52ac0d[_0x2d96('0x175')]=_0x901549[_0x2d96('0x176')]||0x320;_0x52ac0d['XMD-AMDTOTALANALYSISTIME']=_0x901549['dialAMDTotalAnalysisTime']||0x1388;_0x52ac0d[_0x2d96('0x177')]=_0x901549[_0x2d96('0x178')]||0x64;_0x52ac0d[_0x2d96('0x179')]=_0x901549[_0x2d96('0x17a')]||0x32;_0x52ac0d[_0x2d96('0x17b')]=_0x901549['dialAMDMaximumNumberOfWords']||0x3;_0x52ac0d['XMD-AMDSILENCETHRESHOLD']=_0x901549[_0x2d96('0x17c')]||0x100;_0x52ac0d[_0x2d96('0x17d')]=_0x901549[_0x2d96('0x17e')]||0x1388;}if(_0x901549[_0x2d96('0x4c')]===_0x2d96('0x91')){_0x52ac0d[_0x2d96('0x17f')]=_0x4d806c[_0x2d96('0xfa')];}else{_0x52ac0d[_0x2d96('0x180')]=_0x4d806c['CampaignId'];}for(var _0x49f9a4 in _0x4d806c[_0x2d96('0x166')]){if(_0x4d806c['Contact'][_0x2d96('0xaf')](_0x49f9a4)){if(isNotNull(_0x4d806c[_0x2d96('0x166')][_0x49f9a4])&&_0x49f9a4!=='id'&&_0x49f9a4!==_0x2d96('0x181')&&_0x49f9a4!==_0x2d96('0x182')&&_0x49f9a4!==_0x2d96('0x183')){_0x52ac0d[util[_0x2d96('0x74')](_0x2d96('0x184'),_0x2d96('0x185'),_[_0x2d96('0x186')](_0x49f9a4))]=_0x4d806c[_0x2d96('0x166')][_0x49f9a4];}}}var _0x9f50=_0x587f73[_0x2d96('0xd7')](_0x901549['Trunk'])?getCallerId(_0x901549['Trunk']['callerid'],_0x901549[_0x2d96('0x58')],_0x901549[_0x2d96('0x187')]>0x0?getCallerIdRandom(_0x901549[_0x2d96('0x59')],_0x901549[_0x2d96('0x187')]):_0x901549['dialOriginateCallerIdNumber']):getCallerId(_[_0x2d96('0xdd')](_0x901549['TrunkBackup'])?_0x901549['Trunk'][_0x2d96('0x188')]:_0x901549['TrunkBackup'][_0x2d96('0x188')],_0x901549['dialOriginateCallerIdName'],_0x901549[_0x2d96('0x187')]>0x0?getCallerIdRandom(_0x901549[_0x2d96('0x59')],_0x901549[_0x2d96('0x187')]):_0x901549['dialOriginateCallerIdNumber']);if(_0x9f50){_0x52ac0d[_0x2d96('0x189')]=_0x587f73[_0x2d96('0xad')][_0x4fe087][_0x2d96('0x18a')]=extractCalleridName(_0x9f50);_0x52ac0d[_0x2d96('0x18b')]=_0x587f73[_0x2d96('0xad')][_0x4fe087][_0x2d96('0x18c')]=extractCalleridNumber(_0x9f50);}return ami['Action']({'actionid':_0x4fe087,'action':_0x2d96('0x164'),'channel':_0x587f73[_0x2d96('0xd7')](_0x901549['Trunk'])?util[_0x2d96('0x74')](_0x2d96('0x18d'),_0x901549['Trunk'][_0x2d96('0x40')],isNotNull(_0x901549[_0x2d96('0x5a')])?_0x901549['dialPrefix'][_0x2d96('0x18e')]()||'':'',_0x901549[_0x2d96('0x18f')]>0x0?_0x4d806c['Contact'][_0x2d96('0x167')][_0x2d96('0x190')](_0x901549[_0x2d96('0x18f')]):_0x4d806c[_0x2d96('0x166')]['phone']):util[_0x2d96('0x74')](_0x2d96('0x18d'),_[_0x2d96('0xdd')](_0x901549[_0x2d96('0x139')])?_0x901549[_0x2d96('0x72')][_0x2d96('0x40')]:_0x901549[_0x2d96('0x139')][_0x2d96('0x40')],isNotNull(_0x901549[_0x2d96('0x5a')])?_0x901549['dialPrefix'][_0x2d96('0x18e')]()||'':'',_0x901549[_0x2d96('0x18f')]>0x0?_0x4d806c[_0x2d96('0x166')][_0x2d96('0x167')][_0x2d96('0x190')](_0x901549[_0x2d96('0x18f')]):_0x4d806c[_0x2d96('0x166')][_0x2d96('0x167')]),'callerid':_0x9f50,'Exten':_0x2d96('0x170'),'Context':_0x2d96('0x191'),'Priority':'1','variable':_0x52ac0d,'timeout':(_0x901549['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4fe087})[_0x2d96('0xb8')](function(_0x1672eb){return _0x3d4253(_0x1672eb);})[_0x2d96('0xb9')](function(_0x19aea0){_0x901549[_0x2d96('0x62')]+=0x1;var _0x3406d5=new History(_0x587f73[_0x2d96('0xad')][_0x4fe087]);logger[_0x2d96('0x95')](util[_0x2d96('0x74')](_0x2d96('0x192'),JSON[_0x2d96('0x49')](_0x19aea0)));_0x3406d5[_0x2d96('0xa7')]=0xe;_0x3406d5['statedesc']=_0x2d96('0x193');_0x3406d5['starttime']=moment()['format'](_0x2d96('0xf8'));_0x3406d5[_0x2d96('0xa9')]=_0x3406d5[_0x2d96('0xaa')];_0x587f73[_0x2d96('0xcb')](_0x3406d5)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x194')));_0x587f73[_0x2d96('0xc9')](_0x3406d5)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x194')))[_0x2d96('0x131')](function(){delete _0x587f73[_0x2d96('0xad')][_0x4fe087];return _0x28a3f1(msgResponse('originate','Error',_0x2d96('0x195')));});});});};Dialer[_0x2d96('0xbb')]['syncOriginateResponse']=function(_0x4f154f){var _0x5774d5=this[_0x2d96('0xad')][_0x4f154f[_0x2d96('0x125')]];var _0x8cc13c=this;if(_0x5774d5){delete this[_0x2d96('0xad')][_0x4f154f[_0x2d96('0x125')]];_0x5774d5[_0x2d96('0x114')]=moment()['format'](_0x2d96('0xf8'));var _0x38f125=_0x5774d5['type']===_0x2d96('0x77')?this['campaigns'][_0x5774d5[_0x2d96('0xb3')]]:this[_0x2d96('0x24')][_0x5774d5['getQueue']()];if(!this[_0x2d96('0xd5')](_0x4f154f[_0x2d96('0x196')])){this[_0x2d96('0xcd')](_0x38f125);return this['callProgressDetecting'](_0x5774d5,_0x38f125,_0x4f154f)[_0x2d96('0xb8')](function(_0x42c926){})['catch'](loggerCatch(_0x2d96('0x197')));}else{this[_0x2d96('0x29')][_0x4f154f[_0x2d96('0xdc')]]=_0x5774d5;}}};Dialer['prototype'][_0x2d96('0x198')]=function(_0x7e85ec,_0x5191c6,_0xbce392){var _0x2586d4=new History(_0x5191c6);if(_0x2586d4['countbusyretry']+_0x2586d4['countcongestionretry']+_0x2586d4[_0x2d96('0xeb')]+_0x2586d4['countnosuchnumberretry']+_0x2586d4['countdropretry']+_0x2586d4[_0x2d96('0x102')]+_0x2586d4[_0x2d96('0xee')]+_0x2586d4[_0x2d96('0xef')]>=_0xbce392['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x7e85ec){case 0x3:if(_0x2586d4[_0x2d96('0xeb')]>=_0xbce392[_0x2d96('0x199')]-0x1){return!![];}else{this[_0x2d96('0xc1')]({'active':![],'countnoanswerretry':_0x2586d4[_0x2d96('0xeb')]+=0x1,'scheduledat':moment()[_0x2d96('0xf5')](_0xbce392['dialNoAnswerRetryFrequency'],_0x2d96('0xf7'))[_0x2d96('0x74')](_0x2d96('0xf8')),'ContactId':_0x2586d4['ContactId'],'ListId':_0x2586d4['ListId'],'VoiceQueueId':_0x2586d4['VoiceQueueId']||undefined,'CampaignId':_0x2586d4[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x19a')));}break;case 0x5:if(_0x2586d4[_0x2d96('0xe9')]>=_0xbce392[_0x2d96('0x19b')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x2586d4[_0x2d96('0xe9')]+=0x1,'scheduledat':moment()[_0x2d96('0xf5')](_0xbce392[_0x2d96('0x19c')],_0x2d96('0xf7'))[_0x2d96('0x74')](_0x2d96('0xf8')),'ContactId':_0x2586d4[_0x2d96('0xf9')],'ListId':_0x2586d4[_0x2d96('0xd3')],'VoiceQueueId':_0x2586d4[_0x2d96('0xfa')]||undefined,'CampaignId':_0x2586d4[_0x2d96('0xfb')]||undefined})['catch'](loggerCatch(_0x2d96('0x19d')));}break;case 0x8:if(_0x2586d4[_0x2d96('0xea')]>=_0xbce392[_0x2d96('0x19e')]-0x1){return!![];}else{this[_0x2d96('0xc1')]({'active':![],'countcongestionretry':_0x2586d4[_0x2d96('0xea')]+=0x1,'scheduledat':moment()[_0x2d96('0xf5')](_0xbce392[_0x2d96('0x19f')],_0x2d96('0xf7'))[_0x2d96('0x74')](_0x2d96('0xf8')),'ContactId':_0x2586d4[_0x2d96('0xf9')],'ListId':_0x2586d4['ListId'],'VoiceQueueId':_0x2586d4['VoiceQueueId']||undefined,'CampaignId':_0x2586d4[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1a0')));}break;case 0x0:if(_0x2586d4[_0x2d96('0xec')]>=_0xbce392[_0x2d96('0x1a1')]-0x1){return!![];}else{this[_0x2d96('0xc1')]({'active':![],'countnosuchnumberretry':_0x2586d4[_0x2d96('0xec')]+=0x1,'scheduledat':moment()[_0x2d96('0xf5')](_0xbce392[_0x2d96('0x1a2')],'minutes')[_0x2d96('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2586d4[_0x2d96('0xf9')],'ListId':_0x2586d4[_0x2d96('0xd3')],'VoiceQueueId':_0x2586d4[_0x2d96('0xfa')]||undefined,'CampaignId':_0x2586d4[_0x2d96('0xfb')]||undefined})['catch'](loggerCatch(_0x2d96('0x1a3')));}break;case 0xa:if(_0x2586d4[_0x2d96('0xed')]>=_0xbce392[_0x2d96('0x119')]-0x1){return!![];}else{this[_0x2d96('0xc1')]({'active':![],'countdropretry':_0x2586d4[_0x2d96('0xed')]+=0x1,'scheduledat':moment()[_0x2d96('0xf5')](_0xbce392[_0x2d96('0x1a4')],'minutes')[_0x2d96('0x74')](_0x2d96('0xf8')),'ContactId':_0x2586d4[_0x2d96('0xf9')],'ListId':_0x2586d4['ListId'],'VoiceQueueId':_0x2586d4[_0x2d96('0xfa')]||undefined,'CampaignId':_0x2586d4[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x11a')));}break;case 0xb:if(_0x2586d4['countabandonedretry']>=_0xbce392['dialAbandonedMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x2586d4[_0x2d96('0x102')]+=0x1,'scheduledat':moment()[_0x2d96('0xf5')](_0xbce392[_0x2d96('0x11f')],_0x2d96('0xf7'))[_0x2d96('0x74')](_0x2d96('0xf8')),'ContactId':_0x2586d4[_0x2d96('0xf9')],'ListId':_0x2586d4[_0x2d96('0xd3')],'VoiceQueueId':_0x2586d4[_0x2d96('0xfa')]||undefined,'CampaignId':_0x2586d4[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x120')));}break;case 0x13:if(_0x2586d4[_0x2d96('0xee')]>=_0xbce392[_0x2d96('0xf3')]-0x1){return!![];}else{this[_0x2d96('0xc1')]({'active':![],'countmachineretry':_0x2586d4['countmachineretry']+=0x1,'scheduledat':moment()[_0x2d96('0xf5')](_0xbce392['dialMachineRetryFrequency'],'minutes')[_0x2d96('0x74')](_0x2d96('0xf8')),'ContactId':_0x2586d4[_0x2d96('0xf9')],'ListId':_0x2586d4[_0x2d96('0xd3')],'VoiceQueueId':_0x2586d4['VoiceQueueId']||undefined,'CampaignId':_0x2586d4[_0x2d96('0xfb')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x2586d4[_0x2d96('0xef')]>=_0xbce392[_0x2d96('0x1a5')]-0x1){return!![];}else{this[_0x2d96('0xc1')]({'active':![],'countagentrejectretry':_0x2586d4[_0x2d96('0xef')]+=0x1,'scheduledat':moment()[_0x2d96('0xf5')](_0xbce392['dialAgentRejectRetryFrequency'],_0x2d96('0xf7'))[_0x2d96('0x74')](_0x2d96('0xf8')),'ContactId':_0x2586d4['ContactId'],'ListId':_0x2586d4[_0x2d96('0xd3')],'VoiceQueueId':_0x2586d4[_0x2d96('0xfa')]||undefined,'CampaignId':_0x2586d4[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer[_0x2d96('0xbb')][_0x2d96('0x1a6')]=function(_0x358e87,_0x1bfa1b,_0x2ee8bf){var _0x30a79b=this;var _0x2b0592=new History(_0x358e87);return new BPromise(function(_0x90ac00,_0x3c2af6){if(_[_0x2d96('0x3c')](_0x1bfa1b)&&_0x2d96('0x163')!==typeof _0x1bfa1b){return _0x3c2af6(msgResponse(_0x2d96('0x1a7'),_0x2d96('0x13e'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x2ee8bf)&&_0x2d96('0x163')!==typeof _0x2ee8bf){return _0x3c2af6(msgResponse('[callProgressDetecting]',_0x2d96('0x13e'),_0x2d96('0x1a8')));}switch(_0x2ee8bf['reason']){case'0':_0x1bfa1b[_0x2d96('0x61')]+=0x1;_0x2b0592['state']=0x0;_0x2b0592[_0x2d96('0xa8')]=_0x2d96('0x1a9');_0x2b0592[_0x2d96('0xec')]+=0x1;_0x2b0592['countglobal']+=0x1;ami['emit'](_0x2d96('0x1aa'),ut[_0x2d96('0x1ab')](_0x358e87,_0x2d96('0x1ac')));_0x30a79b['createHistory'](_0x2b0592)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1ad')));if(_0x30a79b[_0x2d96('0x198')](0x0,_0x358e87,_0x1bfa1b)){if(_0x2b0592['countnosuchnumberretry']>=_0x1bfa1b[_0x2d96('0x1a1')]){_0x30a79b[_0x2d96('0xf4')](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1ae'));}else{_0x30a79b[_0x2d96('0xf1')](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1ae'));}}break;case'3':_0x1bfa1b[_0x2d96('0x60')]+=0x1;_0x2b0592[_0x2d96('0xa7')]=0x3;_0x2b0592[_0x2d96('0xa8')]='NoAnswer';_0x2b0592['countnoanswerretry']+=0x1;_0x2b0592[_0x2d96('0x100')]+=0x1;ami['emit']('custom:agentnoanswer',ut['buildObj'](_0x358e87,'noanswer'));_0x30a79b[_0x2d96('0xcb')](_0x2b0592)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1af')));if(_0x30a79b['checkRetriveMax'](0x3,_0x358e87,_0x1bfa1b)){if(_0x2b0592[_0x2d96('0xeb')]>=_0x1bfa1b[_0x2d96('0x199')]){_0x30a79b['createStateFinal'](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1b0'));}else{_0x30a79b['stateGlobal'](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1b0'));}}break;case'5':_0x1bfa1b[_0x2d96('0x5c')]+=0x1;_0x2b0592['state']=0x5;_0x2b0592[_0x2d96('0xa8')]='Busy';_0x2b0592[_0x2d96('0xe9')]+=0x1;_0x2b0592[_0x2d96('0x100')]+=0x1;ami[_0x2d96('0x4b')](_0x2d96('0x1b1'),ut[_0x2d96('0x1ab')](_0x358e87,_0x2d96('0x1b2')));_0x30a79b[_0x2d96('0xcb')](_0x2b0592)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1b3')));if(_0x30a79b[_0x2d96('0x198')](0x5,_0x358e87,_0x1bfa1b)){if(_0x2b0592['countbusyretry']>=_0x1bfa1b[_0x2d96('0x19b')]){_0x30a79b[_0x2d96('0xf4')](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1b4'));}else{_0x30a79b[_0x2d96('0xf1')](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1b4'));}}break;case'8':_0x1bfa1b[_0x2d96('0x1b5')]+=0x1;_0x2b0592['state']=0x8;_0x2b0592[_0x2d96('0xa8')]=_0x2d96('0x1b6');_0x2b0592[_0x2d96('0xea')]+=0x1;_0x2b0592['countglobal']+=0x1;ami[_0x2d96('0x4b')](_0x2d96('0x1b7'),ut[_0x2d96('0x1ab')](_0x358e87,_0x2d96('0x1b8')));_0x30a79b[_0x2d96('0xcb')](_0x2b0592)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1b9')));if(_0x30a79b['checkRetriveMax'](0x8,_0x358e87,_0x1bfa1b)){if(_0x2b0592[_0x2d96('0xea')]>=_0x1bfa1b['dialCongestionMaxRetry']){_0x30a79b['createStateFinal'](_0x2b0592,_0x90ac00,_0x3c2af6,'reason\x208\x20congestion');}else{_0x30a79b['stateGlobal'](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1ba'));}}break;case'11':_0x1bfa1b[_0x2d96('0x1bb')]+=0x1;_0x2b0592['state']=0xb;_0x2b0592[_0x2d96('0xa8')]=_0x2d96('0x121');_0x2b0592['countabandonedretry']+=0x1;_0x2b0592[_0x2d96('0x100')]+=0x1;_0x30a79b['createHistory'](_0x2b0592)['catch'](loggerCatch(_0x2d96('0x1bc')));if(_0x30a79b[_0x2d96('0x198')](0xb,_0x358e87,_0x1bfa1b)){if(_0x2b0592[_0x2d96('0x102')]>=_0x1bfa1b[_0x2d96('0x11e')]){_0x30a79b['createStateFinal'](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1bd'));}else{_0x30a79b['stateGlobal'](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1bd'));}}break;case'20':_0x1bfa1b[_0x2d96('0x64')]+=0x1;_0x2b0592['state']=0x14;_0x2b0592[_0x2d96('0xa8')]=_0x2d96('0x1be');_0x2b0592[_0x2d96('0xef')]+=0x1;_0x2b0592[_0x2d96('0x100')]+=0x1;ami['emit'](_0x2d96('0x1bf'),ut[_0x2d96('0x1ab')](_0x358e87,_0x2d96('0x1c0')));_0x30a79b[_0x2d96('0xcb')](_0x2b0592)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1c1')));if(_0x30a79b['checkRetriveMax'](0x14,_0x358e87,_0x1bfa1b)){if(_0x2b0592[_0x2d96('0xef')]>=_0x1bfa1b[_0x2d96('0x1a5')]){_0x30a79b[_0x2d96('0xf4')](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1c2'));}else{_0x30a79b[_0x2d96('0xf1')](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1c2'));}}break;default:_0x1bfa1b['outboundUnknownCallsDay']+=0x1;_0x2b0592['state']=0xc;_0x2b0592[_0x2d96('0xa8')]=_0x2ee8bf[_0x2d96('0x10d')];_0x30a79b[_0x2d96('0xcb')](_0x2b0592)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1c3')));if(_0x30a79b[_0x2d96('0x198')](_0x2ee8bf[_0x2d96('0x10d')],_0x358e87,_0x1bfa1b)){if(_0x2b0592['countbusyretry']+_0x2b0592['countcongestionretry']+_0x2b0592[_0x2d96('0xeb')]+_0x2b0592[_0x2d96('0xec')]+_0x2b0592[_0x2d96('0xed')]+_0x2b0592[_0x2d96('0x102')]+_0x2b0592[_0x2d96('0xee')]+_0x2b0592[_0x2d96('0xef')]>=_0x1bfa1b[_0x2d96('0xf0')]){_0x30a79b[_0x2d96('0xf1')](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2ee8bf[_0x2d96('0x10d')]);}else{_0x30a79b[_0x2d96('0xf4')](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2ee8bf[_0x2d96('0x10d')]);}}}});};Dialer[_0x2d96('0xbb')][_0x2d96('0xf1')]=function(_0x149a81,_0x5cb492,_0x16eb83,_0x52969f){var _0xe2f503=new Final(_0x149a81);_0xe2f503['state']=0xf;_0xe2f503[_0x2d96('0xa8')]='Global';this[_0x2d96('0xf4')](_0xe2f503,_0x5cb492,_0x16eb83,_0x52969f);};Dialer[_0x2d96('0xbb')][_0x2d96('0xf4')]=function(_0x5c13c8,_0x13c53d,_0x488b0d,_0x16d7a2){this['moveContactManagedDialer'](_0x5c13c8)['then'](function(_0x241987){return _0x13c53d(msgResponse('[callProgressDetecting]',_0x2d96('0xd6'),_0x16d7a2));})['catch'](function(_0x9e20fd){return _0x488b0d(msgResponse(_0x2d96('0x1c4'),_0x2d96('0x13e'),_0x2d96('0x1c5')));});};Dialer[_0x2d96('0xbb')][_0x2d96('0xa')]=function(_0x46cd45){var _0x500055=this;var _0x5c3297=_0x46cd45['dialPredictiveOptimizationPercentage']/0x64;var _0x386f26=_0x46cd45[_0x2d96('0x5f')]/(_0x46cd45['outboundDropCallsDayTimeout']+_0x46cd45[_0x2d96('0xe2')]);var _0x567ec2=Math[_0x2d96('0x1c6')](_0x46cd45['predictiveIntervalAvailable']*(_0x46cd45[_0x2d96('0x1c7')]/0x64));var _0x192518=Math[_0x2d96('0x1c6')](_0x46cd45[_0x2d96('0x6e')]*(_0x46cd45['predictiveIntervalMinThreshold']/0x64));var _0x118b6e=_0x46cd45['available']+_0x46cd45[_0x2d96('0x51')];var _0x3a210e=Math['floor'](_0x46cd45['erlangCalls']*_0x46cd45['erlangAbandonmentRate']*_0x46cd45[_0x2d96('0x6c')]*_0x46cd45['predictiveIntervalMultiplicativeFactor']);if(_[_0x2d96('0x3c')](_0x46cd45[_0x2d96('0x2c')])){if(!_[_0x2d96('0x3c')](_0x46cd45[_0x2d96('0x2b')])){_0x46cd45['startPredictive']=undefined;loggerPredictive[_0x2d96('0x95')](_0x2d96('0x1c8'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x2d96('0x3c')](_0x46cd45[_0x2d96('0x90')])){loggerPredictive[_0x2d96('0x95')](_0x2d96('0x1c8'),_0x2d96('0x1c9'));clearInterval(_0x46cd45['handlePredictive']);_0x46cd45[_0x2d96('0x90')]=undefined;}_0x46cd45[_0x2d96('0x2c')]=moment()['format'](_0x2d96('0xf8'));loggerPredictive['info'](_0x46cd45[_0x2d96('0x40')],'collection\x20data\x20in\x20progressive\x20at',_0x46cd45[_0x2d96('0x2c')]);this[_0x2d96('0x152')](_0x46cd45,0x1);}else if(ifInterval(_0x46cd45[_0x2d96('0x1ca')],_0x46cd45['startProgressive'])){this[_0x2d96('0x152')](_0x46cd45,0x1);loggerPredictiveCalls[_0x2d96('0x7a')]('[startMethodPredictive][StartProgressive][Loop]',_0x46cd45[_0x2d96('0x2c')],_0x46cd45['name']);_0x46cd45[_0x2d96('0x70')]=0x0;_0x46cd45[_0x2d96('0x1cb')]=0x0;}else if(_0x5c3297<_0x386f26&&_0x46cd45[_0x2d96('0x1cc')]===_0x2d96('0x1cd')){freeVariablesPredictive(_0x46cd45);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x1ce'),_0x2d96('0x1cf'),_0x386f26,_0x2d96('0x2c'),_0x46cd45[_0x2d96('0x40')]);}else if(_0x3a210e<_0x46cd45[_0x2d96('0x1cb')]&&_0x46cd45[_0x2d96('0x1cc')]===_0x2d96('0x1cd')){freeVariablesPredictive(_0x46cd45);loggerPredictive['info'](_0x2d96('0x1d0'),_0x2d96('0x1d1'),_0x3a210e,_0x2d96('0x1d2'),_0x46cd45[_0x2d96('0x1cb')],_0x2d96('0x2c'),_0x46cd45[_0x2d96('0x40')]);}else if(!ifInterval(_0x46cd45[_0x2d96('0x1ca')],_0x46cd45[_0x2d96('0x2c')])&&_[_0x2d96('0x3c')](_0x46cd45['startPredictive'])&&!_[_0x2d96('0x3c')](_0x46cd45[_0x2d96('0x2c')])){_0x46cd45['startPredictive']=moment()[_0x2d96('0x74')](_0x2d96('0xf8'));loggerPredictive[_0x2d96('0x7a')](_0x46cd45[_0x2d96('0x40')],_0x2d96('0x1d3'),_0x46cd45[_0x2d96('0x2b')]);this['averageHandleTime'](_0x46cd45[_0x2d96('0x1ca')])[_0x2d96('0xb8')](this[_0x2d96('0x1d4')](_0x46cd45))[_0x2d96('0xb8')](mergeDataErlangB(_0x46cd45))[_0x2d96('0xb8')](this['startMethodPredictive'](_0x46cd45))[_0x2d96('0xb9')](loggerCatchPredictive(_0x2d96('0x1d5'),_0x46cd45));}else if(!ifInterval(_0x46cd45[_0x2d96('0x1ca')],_0x46cd45['startPredictive'])){_0x46cd45[_0x2d96('0x1cb')]=0x0;_0x46cd45[_0x2d96('0x2b')]=moment()[_0x2d96('0x74')](_0x2d96('0xf8'));loggerPredictive[_0x2d96('0x7a')](_0x46cd45[_0x2d96('0x40')],_0x2d96('0x1d6'),_0x46cd45['startPredictive']);clearInterval(_0x46cd45[_0x2d96('0x90')]);_0x46cd45[_0x2d96('0x90')]=undefined;this[_0x2d96('0x1d7')](_0x46cd45['dialPredictiveInterval'])[_0x2d96('0xb8')](this[_0x2d96('0x1d4')](_0x46cd45))[_0x2d96('0xb8')](mergeDataErlangB(_0x46cd45))[_0x2d96('0xb8')](this['startMethodPredictive'](_0x46cd45))[_0x2d96('0xb9')](loggerCatchPredictive(_0x2d96('0x1d8'),_0x46cd45));}else if(_0x46cd45[_0x2d96('0x6e')]&&_0x118b6e<_0x46cd45[_0x2d96('0x6e')]-_0x192518){freeVariablesPredictive(_0x46cd45);loggerPredictive[_0x2d96('0x7a')](_0x46cd45[_0x2d96('0x40')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x118b6e,_0x2d96('0x1d9'),_0x46cd45[_0x2d96('0x6e')],'-',_0x192518,'=',_0x46cd45[_0x2d96('0x6e')]-_0x192518,')');}else if(_0x46cd45[_0x2d96('0x6e')]&&_0x118b6e>_0x46cd45[_0x2d96('0x6e')]+_0x567ec2){freeVariablesPredictive(_0x46cd45);loggerPredictive['info'](_0x46cd45[_0x2d96('0x40')],_0x2d96('0x1da'),_0x118b6e,_0x2d96('0x1db'),_0x46cd45['predictiveIntervalAvailable'],'+',_0x567ec2,'=',_0x46cd45['predictiveIntervalAvailable']+_0x567ec2,')');}};Dialer['prototype'][_0x2d96('0x1d4')]=function(_0x4936e1){var _0x44ea7f=this;return function(_0x5e27f5){return new BPromise(function(_0xb17b4c,_0x20a932){_[_0x2d96('0x8b')](_0x4936e1,_0x5e27f5[0x0]);if(checkGetDataPredictive(_0x5e27f5[0x0])){var _0x2c9abd=_0x4936e1[_0x2d96('0x6e')]=_0x4936e1[_0x2d96('0x51')]+_0x4936e1[_0x2d96('0x4d')];var _0x53b6b4=_0x4936e1[_0x2d96('0x1ca')]*0x3c;var _0xf9a61f=_0x5e27f5[0x0][_0x2d96('0x68')]+_0x5e27f5[0x0][_0x2d96('0x67')];var _0x68e236=(_0x5e27f5[0x0][_0x2d96('0x66')]+_0x5e27f5[0x0][_0x2d96('0x6a')]+_0x5e27f5[0x0][_0x2d96('0x69')])/_0x5e27f5[0x0][_0x2d96('0x7c')];_0x4936e1[_0x2d96('0x6c')]=_0x68e236>0x0?_0x68e236:0x1;switch(_0x4936e1[_0x2d96('0x1cc')]){case _0x2d96('0x1cd'):var _0xb535f2=_0x4936e1['dialPredictiveOptimizationPercentage']/0x64;return _0x44ea7f[_0x2d96('0x1dc')](_0x2c9abd,_0x53b6b4,_0xf9a61f,_0x68e236,_0xb535f2)[_0x2d96('0xb8')](function(_0xcea1c4){return _0xb17b4c(_0xcea1c4);});case _0x2d96('0x1dd'):var _0xf23845=_0x4936e1['dialPredictiveOptimizationPercentage']/0x64;return _0x44ea7f['busyFactor'](_0x2c9abd,_0x53b6b4,_0xf9a61f,_0x68e236,_0xf23845)[_0x2d96('0xb8')](function(_0x4bddc0){return _0xb17b4c(_0x4bddc0);});default:return _0x20a932(msgResponse('[getDataPredictive]',_0x2d96('0x13e'),'Unknown\x20Predictive'));}}else{return _0x20a932(msgResponse(_0x2d96('0x1de'),_0x2d96('0x13e'),_0x2d96('0x1df')));}});};};Dialer[_0x2d96('0xbb')][_0x2d96('0x1e0')]=function(_0x2e255a){var _0x3223c2=this;return function(_0x35fd62){return new BPromise(function(_0x1a6ba5,_0x5ba1c2){_[_0x2d96('0x8b')](_0x2e255a,_0x35fd62[0x0]);if(checkGetDataPredictive(_0x35fd62[0x0])){loggerPredictive[_0x2d96('0x7a')](JSON[_0x2d96('0x49')](_0x35fd62[0x0]));if(_0x2e255a[_0x2d96('0x1cc')]===_0x2d96('0x1cd')){return _0x3223c2['getVoiceQueueRtPauses'](_0x2e255a['id'])[_0x2d96('0xb8')](function(_0x45b213){var _0x48d9ce=_0x2e255a['loggedIn']-_0x45b213[0x0]['outboundQueuePauses'];var _0x22a7a6=_0x2e255a[_0x2d96('0x1ca')]*0x3c;var _0x32e1de=_0x35fd62[0x0]['predictiveIntervalAvgTalktime']+_0x35fd62[0x0][_0x2d96('0x67')];var _0x236605=(_0x35fd62[0x0][_0x2d96('0x66')]+_0x35fd62[0x0][_0x2d96('0x6a')]+_0x35fd62[0x0][_0x2d96('0x69')])/_0x35fd62[0x0][_0x2d96('0x7c')];var _0x3e16f5=_0x2e255a['dialPredictiveOptimizationPercentage']/0x64;_0x2e255a[_0x2d96('0x6d')]=_0x45b213[0x0][_0x2d96('0x1e1')]||0x0;_0x2e255a[_0x2d96('0x6c')]=_0x236605>0x0?_0x236605:0x1;return _0x3223c2[_0x2d96('0x1dc')](_0x48d9ce,_0x22a7a6,_0x32e1de,_0x236605,_0x3e16f5);})[_0x2d96('0xb8')](function(_0x470541){return _0x1a6ba5(_0x470541);})['catch'](function(_0x35a14f){return _0x5ba1c2(msgResponse(_0x2d96('0x1e2'),_0x2d96('0x13e'),JSON['stringify'](_0x35a14f)));});}if(_0x2e255a[_0x2d96('0x1cc')]===_0x2d96('0x1dd')){return _0x3223c2[_0x2d96('0xc7')](_0x2e255a['id'])[_0x2d96('0xb8')](function(_0x19412d){var _0x554080=_0x2e255a[_0x2d96('0x159')]-_0x19412d[0x0]['outboundQueuePauses'];var _0xefbe58=_0x2e255a[_0x2d96('0x1ca')]*0x3c;var _0x565e3b=_0x35fd62[0x0][_0x2d96('0x68')]+_0x35fd62[0x0]['predictiveIntervalAvgHoldtime'];var _0x2d5353=(_0x35fd62[0x0][_0x2d96('0x66')]+_0x35fd62[0x0][_0x2d96('0x6a')]+_0x35fd62[0x0][_0x2d96('0x69')])/_0x35fd62[0x0]['predictiveIntervalTotalCalls'];var _0x5c7c7c=_0x2e255a[_0x2d96('0x1e3')]/0x64;_0x2e255a[_0x2d96('0x6d')]=_0x19412d[0x0][_0x2d96('0x1e1')]||0x0;_0x2e255a[_0x2d96('0x6c')]=_0x2d5353>0x0?_0x2d5353:0x1;return _0x3223c2[_0x2d96('0x1e4')](_0x554080,_0xefbe58,_0x565e3b,_0x2d5353,_0x5c7c7c);})[_0x2d96('0xb8')](function(_0x488cbd){return _0x1a6ba5(_0x488cbd);})['catch'](function(_0x327be6){return _0x5ba1c2(msgResponse(_0x2d96('0x1e2'),_0x2d96('0x13e'),JSON['stringify'](_0x327be6)));});}}else{return _0x5ba1c2(msgResponse(_0x2d96('0x1de'),_0x2d96('0x13e'),'check\x20failure'));}});};};Dialer['prototype'][_0x2d96('0x1e5')]=function(_0x1bd3d0){var _0x2c60c8=this;return function(){var _0x53f3d8=0x0;var _0x3b88a8=Math[_0x2d96('0x1e6')](_0x1bd3d0[_0x2d96('0x1e7')]*0x3e8);if(_0x3b88a8>0x0){_0x3b88a8=_0x3b88a8<0x64?0x64:_0x3b88a8;loggerPredictive[_0x2d96('0x7a')](_0x1bd3d0[_0x2d96('0x40')],'one\x20call\x20every:',_0x3b88a8,_0x2d96('0x4a'));_0x1bd3d0['handlePredictive']=setInterval(function(){_0x2c60c8[_0x2d96('0x90')](_0x1bd3d0);loggerPredictiveCalls[_0x2d96('0x7a')](_0x2d96('0x1e8'),_0x53f3d8+=0x1);},_0x3b88a8);}else{loggerPredictive['info'](_0x1bd3d0[_0x2d96('0x40')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x2d96('0x1e9')]=function(_0x2cdfc6,_0x474711){var _0x88077a=this;return function(_0x47c789){if(_[_0x2d96('0x46')](_0x47c789)){if(_[_0x2d96('0xdd')](_0x474711[_0x2d96('0x1ea')])||!_0x474711[_0x2d96('0x1eb')]){if(_0x2cdfc6[_0x2d96('0x57')]===_0x2d96('0x9')){_0x2cdfc6['queueStatusComplete']=_[_0x2d96('0x3c')](_0x2cdfc6[_0x2d96('0x12c')])?!![]:_0x2cdfc6['queueStatusComplete'];var _0x488cbf=uuid['v4']();_0x88077a[_0x2d96('0xad')][_0x488cbf]=new Action(_0x2cdfc6,_0x474711,_0x488cbf);loggerBooked[_0x2d96('0x7a')](_0x2d96('0x1ec'),_0x488cbf,_0x2d96('0x1ed'),JSON[_0x2d96('0x49')](_0x2cdfc6[_0x2d96('0x12c')]),_0x2d96('0x1ee'),_0x2cdfc6[_0x2d96('0x40')]);if(_0x2cdfc6['queueStatusComplete']){_0x2cdfc6[_0x2d96('0x12c')]=![];_0x88077a[_0x2d96('0x2e')][_0x88077a[_0x2d96('0xad')][_0x488cbf]['queue']]=[];ami[_0x2d96('0xb0')]({'actionid':_0x488cbf,'action':_0x2d96('0x1ef'),'queue':_0x2cdfc6['name']})['catch'](function(_0x19c34d){_0x88077a[_0x2d96('0xcd')](_0x2cdfc6);_0x88077a['rescheduleContact']({'active':![],'ContactId':_0x88077a['actions'][_0x488cbf][_0x2d96('0xf9')],'ListId':_0x88077a['actions'][_0x488cbf][_0x2d96('0xd3')],'VoiceQueueId':_0x88077a[_0x2d96('0xad')][_0x488cbf]['VoiceQueueId']||undefined,'CampaignId':_0x88077a['actions'][_0x488cbf]['CampaignId']||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1f0')));delete _0x88077a[_0x2d96('0xad')][_0x488cbf];});}else{loggerBooked[_0x2d96('0x7a')](_0x2d96('0x1f1'),JSON[_0x2d96('0x49')](_0x2cdfc6['queueStatusComplete']),_0x2d96('0x1ee'),_0x2cdfc6['name']);_0x88077a['updateOriginated'](_0x2cdfc6);_0x88077a[_0x2d96('0xc1')]({'active':![],'ContactId':_0x88077a[_0x2d96('0xad')][_0x488cbf][_0x2d96('0xf9')],'ListId':_0x88077a['actions'][_0x488cbf][_0x2d96('0xd3')],'VoiceQueueId':_0x88077a[_0x2d96('0xad')][_0x488cbf][_0x2d96('0xfa')]||undefined,'CampaignId':_0x88077a[_0x2d96('0xad')][_0x488cbf][_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1f0')));delete _0x88077a['actions'][_0x488cbf];}}else{return _0x88077a[_0x2d96('0x162')](_0x2cdfc6,_0x474711);}}else{if(getDiff(_0x474711['scheduledat'])<_0x2cdfc6[_0x2d96('0x1f2')]*0x3c){if(_0x474711['Agent']&&!_0x474711[_0x2d96('0x1f3')][_0x2d96('0x1f4')]){_0x88077a[_0x2d96('0x23')][_0x2d96('0x12f')](_0x474711['id'])[_0x2d96('0x131')](function(){_0x88077a['updateOriginated'](_0x2cdfc6);});}else{_0x88077a[_0x2d96('0xc2')]({'active':![]},_0x474711['id'],0x1)['finally'](function(){console[_0x2d96('0x1f5')](_0x2d96('0x1f6'));_0x88077a[_0x2d96('0xcd')](_0x2cdfc6);});}}else{_0x2cdfc6[_0x2d96('0x63')]+=0x1;_0x88077a[_0x2d96('0xcd')](_0x2cdfc6);if(_0x2cdfc6[_0x2d96('0x1f7')]){_0x88077a['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x474711['ContactId'],'ListId':_0x474711['ListId'],'VoiceQueueId':_0x474711['VoiceQueueId']||undefined,'CampaignId':_0x474711[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1f8')));_0x88077a[_0x2d96('0xcb')](createObjHistory(_0x2cdfc6,_0x474711,_0x2d96('0x1f9'),0x17,'RecallInQueue'))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1fa')));}else{_0x88077a[_0x2d96('0xdb')](createObjHistory(_0x2cdfc6,_0x474711,_0x2d96('0x1fb'),0x16,_0x2d96('0x1fc')),_0x2d96('0x1fd'),_0x2d96('0x1fe'));}}}}else{_0x2cdfc6[_0x2d96('0x5b')]+=0x1;_0x88077a[_0x2d96('0xdb')](createObjHistory(_0x2cdfc6,_0x474711,_0x2d96('0x1ff'),0xd,_0x2d96('0x200')),_0x2d96('0x201'),'[Originate][MoveBlacklist]');throw _0x2d96('0x202');}};};Dialer['prototype'][_0x2d96('0x158')]=function(_0x4e1bc){var _0x611a7e=this;var _0x211f3c=[];var _0x4a8619=_0x4e1bc[_0x2d96('0x203')]-_0x4e1bc[_0x2d96('0x6f')]-_0x4e1bc[_0x2d96('0x204')];emitCampaignSummary(_0x4e1bc);if(_0x4a8619>0x0){if(_0x4a8619>this['maxNumberOriginate']){_0x4a8619=this[_0x2d96('0x27')];}_0x4e1bc[_0x2d96('0x204')]+=_0x4a8619;this[_0x2d96('0xc5')](_0x4e1bc['id'],_0x4a8619,_0x4e1bc[_0x2d96('0x205')])['then'](function(_0x2c1c4f){_0x4e1bc['temp']-=_0x4a8619;_0x4e1bc[_0x2d96('0x204')]=_0x4e1bc[_0x2d96('0x204')]>0x0?_0x4e1bc[_0x2d96('0x204')]:0x0;if(!checkContactEmpty(_0x2c1c4f)){_0x4e1bc[_0x2d96('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x2d96('0x206')+_0x4e1bc[_0x2d96('0x40')]);}else{_0x4e1bc[_0x2d96('0x6f')]+=_0x2c1c4f[_0x2d96('0x97')];_0x4e1bc[_0x2d96('0x3e')]=_0x2d96('0x207');for(var _0x4e4b49=0x0;_0x4e4b49<_0x2c1c4f['length'];_0x4e4b49+=0x1){_0x4e1bc[_0x2d96('0x208')]+=0x1;if(_[_0x2d96('0xdd')](_0x2c1c4f[_0x4e4b49])||_[_0x2d96('0xdd')](_0x2c1c4f[_0x4e4b49][_0x2d96('0x166')])||_[_0x2d96('0xdd')](_0x2c1c4f[_0x4e4b49][_0x2d96('0x166')][_0x2d96('0x167')])){_0x611a7e['emptyContact'](_0x2d96('0x209'),_0x4e1bc,_0x2c1c4f[_0x4e4b49]);}else{_0x611a7e[_0x2d96('0xbe')](_['pick'](_0x2c1c4f[_0x4e4b49],['CampaignId','Contact.phone']))['then'](_0x611a7e['checkContactBlack'](_0x4e1bc,_0x2c1c4f[_0x4e4b49]))[_0x2d96('0xb9')](_0x611a7e['loggerHandler'](_0x2d96('0x20a'),_0x4e1bc));}}}})[_0x2d96('0xb9')](loggerGetContactDialer(_0x2d96('0x20b'),_0x4e1bc,_0x4a8619));}};Dialer[_0x2d96('0xbb')][_0x2d96('0x152')]=function(_0x4f11cb,_0xf3b2f4){var _0xf7d0a=this;var _0xc47d9c=[];var _0x4f6416=_0xf3b2f4>=0x1?_0xf3b2f4:0x1;var _0x13a095=[];if(_0x4f11cb[_0x2d96('0x57')]===_0x2d96('0x9')){_0x4f6416=0x1;}var _0x12e824=Math[_0x2d96('0x1e6')](_0x4f11cb[_0x2d96('0x4d')]*_0x4f6416)-_0x4f11cb[_0x2d96('0x6f')]-_0x4f11cb[_0x2d96('0x204')];emitVoiceQueueSummary(_0x4f11cb);if(_0x4f11cb[_0x2d96('0x20c')]>0x0){var _0x30db21=_0x4f11cb[_0x2d96('0x20c')]-_0x4f11cb['originated']-_0x4f11cb['talking']-_0x4f11cb['temp']-_0x4f11cb[_0x2d96('0x4e')];if(_0x12e824>_0x30db21){_0x12e824=_0x30db21;}}if(_0x12e824>0x0){if(_0x4f11cb[_0x2d96('0x57')]===_0x2d96('0x9')){_0x12e824=0x1;}if(_0x12e824>this[_0x2d96('0x27')]){_0x12e824=this[_0x2d96('0x27')];}_0x4f11cb[_0x2d96('0x204')]+=_0x12e824;for(var _0x5403a2 in this[_0x2d96('0x25')]){if(this[_0x2d96('0x25')][_0x2d96('0xaf')](_0x5403a2)){if(this[_0x2d96('0x25')][_0x5403a2]['state']===_0x2d96('0x20d')&&this['agents'][_0x5403a2][_0x2d96('0xb1')]===_0x2d96('0xd9')){_0xc47d9c[_0x2d96('0x146')](this['agents'][_0x5403a2]['id']);}}}this[_0x2d96('0xc4')](_0x4f11cb['id'],_0xc47d9c,_0x12e824,_0x4f11cb['dialOrderByScheduledAt'])[_0x2d96('0xb8')](function(_0x17f65f){_0x4f11cb[_0x2d96('0x204')]-=_0x12e824;_0x4f11cb[_0x2d96('0x204')]=_0x4f11cb[_0x2d96('0x204')]>0x0?_0x4f11cb[_0x2d96('0x204')]:0x0;if(!checkContactEmpty(_0x17f65f)){_0xf7d0a[_0x2d96('0xb6')](_0x4f11cb)['then'](sendMessageReschedule(_0x4f11cb))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xba')));}else{_0x4f11cb[_0x2d96('0x6f')]+=_0x17f65f[_0x2d96('0x97')];_0x4f11cb[_0x2d96('0x3e')]=_0x4f11cb[_0x2d96('0x57')]===_0x2d96('0x9')?_0x2d96('0x16f'):_0x2d96('0x207');for(var _0x5f0ec4=0x0;_0x5f0ec4<_0x17f65f[_0x2d96('0x97')];_0x5f0ec4+=0x1){if(_['isNil'](_0x17f65f[_0x5f0ec4])||_[_0x2d96('0xdd')](_0x17f65f[_0x5f0ec4]['Contact'])||_[_0x2d96('0xdd')](_0x17f65f[_0x5f0ec4][_0x2d96('0x166')][_0x2d96('0x167')])){_0xf7d0a[_0x2d96('0xd1')](_0x2d96('0x209'),_0x4f11cb,_0x17f65f[_0x5f0ec4]);}else{_0xf7d0a[_0x2d96('0xbc')](_[_0x2d96('0x129')](_0x17f65f[_0x5f0ec4],['VoiceQueueId',_0x2d96('0x20e')]))[_0x2d96('0xb8')](_0xf7d0a[_0x2d96('0x1e9')](_0x4f11cb,_0x17f65f[_0x5f0ec4]))[_0x2d96('0xb9')](_0xf7d0a[_0x2d96('0xd0')]('[actionOriginate]\x20',_0x4f11cb));}}}})[_0x2d96('0xb9')](loggerGetContactDialer('[getContactDialer2]',_0x4f11cb,_0x12e824));}};Dialer[_0x2d96('0xbb')][_0x2d96('0x90')]=function(_0x3c8a00){var _0xa8afa5=this;if(_0x3c8a00[_0x2d96('0x20c')]>0x0){var _0x5977d7=_0x3c8a00[_0x2d96('0x20c')]-_0x3c8a00[_0x2d96('0x6f')]-_0x3c8a00[_0x2d96('0x51')];if(_0x5977d7>0x0){this[_0x2d96('0x20f')](_0x3c8a00);}else{loggerPredictiveCalls[_0x2d96('0x7a')](_0x2d96('0x210'));}}else{this[_0x2d96('0x20f')](_0x3c8a00);}};Dialer[_0x2d96('0xbb')][_0x2d96('0x20f')]=function(_0x2bc8ca){var _0x228fc1=this;var _0x2e1e5d=[];_0x2bc8ca[_0x2d96('0x6f')]+=0x1;for(var _0x54b545 in this[_0x2d96('0x25')]){if(this[_0x2d96('0x25')][_0x2d96('0xaf')](_0x54b545)){if(this[_0x2d96('0x25')][_0x54b545][_0x2d96('0xa7')]===_0x2d96('0x20d')&&this['agents'][_0x54b545][_0x2d96('0xb1')]==='reachable'){_0x2e1e5d['push'](this[_0x2d96('0x25')][_0x54b545]['id']);}}}this[_0x2d96('0xc4')](_0x2bc8ca['id'],_0x2e1e5d,0x1,_0x2bc8ca['dialOrderByScheduledAt'])['then'](function(_0x31a483){if(!checkContactEmpty(_0x31a483)){checkContactLowerLimitOriginate(_0x2bc8ca,0x1,0x0);_0x228fc1[_0x2d96('0xb6')](_0x2bc8ca)[_0x2d96('0xb8')](sendMessageReschedule(_0x2bc8ca))['catch'](loggerCatch(_0x2d96('0xba')));}else{_0x2bc8ca[_0x2d96('0x3e')]=_0x2d96('0x207');if(_[_0x2d96('0xdd')](_0x31a483[0x0])||_['isNil'](_0x31a483[0x0]['Contact'])||_[_0x2d96('0xdd')](_0x31a483[0x0][_0x2d96('0x166')]['phone'])){_0x228fc1[_0x2d96('0xd1')]('[actionOriginate]\x20',_0x2bc8ca,_0x31a483[0x0]);}else{_0x228fc1[_0x2d96('0xbc')](_[_0x2d96('0x129')](_0x31a483[0x0],[_0x2d96('0xfa'),'Contact.phone']))['then'](_0x228fc1[_0x2d96('0x1e9')](_0x2bc8ca,_0x31a483[0x0]))[_0x2d96('0xb9')](_0x228fc1[_0x2d96('0xd0')](_0x2d96('0x211'),_0x2bc8ca));}}})[_0x2d96('0xb9')](loggerGetContactDialer(_0x2d96('0x212'),_0x2bc8ca,0x1));emitVoiceQueueSummary(_0x2bc8ca);};Dialer[_0x2d96('0xbb')][_0x2d96('0x1dc')]=function(_0x56e722,_0x6a21f5,_0x190568,_0x503c30,_0x5623e8,_0x4470c3){loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x213'));loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x214'),_0x56e722);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x215'),_0x6a21f5);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x216'),_0x190568);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x217'),_0x503c30);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x218'),_0x5623e8);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x81'));return new BPromise(function(_0x2d9a3e,_0x165533){if(_0x56e722<=0x0||isNaN(_0x56e722)){return _0x165533(msgResponse('[abandonmentRate]','Error','m\x20=\x20'+_0x56e722));}if(_0x190568<=0x0||isNaN(_0x190568)){return _0x165533(msgResponse(_0x2d96('0x219'),_0x2d96('0x48'),'Ts\x20=\x20'+_0x190568));}if(_0x503c30<=0x0||isNaN(_0x503c30)){return _0x165533(msgResponse('[abandonmentRate]','Error','p\x20=\x20'+_0x503c30));}if(_0x6a21f5<=0x0||isNaN(_0x6a21f5)){return _0x165533(msgResponse(_0x2d96('0x219'),'Error',_0x2d96('0x21a')+_0x6a21f5));}if(_0x5623e8<=0x0||isNaN(_0x5623e8)){return _0x165533(msgResponse('[abandonmentRate]',_0x2d96('0x48'),'Amax\x20=\x20'+_0x5623e8));}_0x4470c3=_0x4470c3||0x0;var _0x3e8b93=0x1/_0x190568;var _0x20cc63=0x0;var _0x39e799=0x0;var _0x50ccb6=0x0;var _0x30201c=0x0;for(var _0x5995b7=0x0;_0x50ccb6<_0x5623e8;_0x5995b7+=0x1){_0x39e799=_0x5995b7/_0x6a21f5;_0x20cc63=(_0x503c30*_0x39e799+_0x4470c3)/_0x3e8b93;_0x50ccb6=erlangb(_0x20cc63,_0x56e722);_0x30201c=_0x20cc63/_0x56e722*(0x1-erlangb(_0x20cc63,_0x56e722));}return _0x2d9a3e({'erlangCalls':_0x5995b7,'erlangCallToSecond':_0x6a21f5/_0x5995b7,'erlangAbandonmentRate':_0x50ccb6,'erlangBusyFactor':_0x30201c});});};Dialer[_0x2d96('0xbb')][_0x2d96('0x1e4')]=function(_0x117c37,_0x390996,_0x4241f5,_0x2e32fa,_0x110013,_0x4c8fb1){loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x21b'));loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x214'),_0x117c37);loggerPredictive['info'](_0x2d96('0x215'),_0x390996);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x216'),_0x4241f5);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x217'),_0x2e32fa);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x21c'),_0x110013);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x1c1dbc,_0x164db2){if(_0x117c37<=0x0||isNaN(_0x117c37)){return _0x164db2(msgResponse(_0x2d96('0x21d'),_0x2d96('0x48'),_0x2d96('0x21e')+_0x117c37));}if(_0x4241f5<=0x0||isNaN(_0x4241f5)){return _0x164db2(msgResponse(_0x2d96('0x21d'),_0x2d96('0x48'),_0x2d96('0x21f')+_0x4241f5));}if(_0x2e32fa<=0x0||isNaN(_0x2e32fa)){return _0x164db2(msgResponse(_0x2d96('0x21d'),_0x2d96('0x48'),_0x2d96('0x220')+_0x2e32fa));}if(_0x390996<=0x0||isNaN(_0x390996)){return _0x164db2(msgResponse(_0x2d96('0x21d'),_0x2d96('0x48'),_0x2d96('0x21a')+_0x390996));}if(_0x110013<=0x0||isNaN(_0x110013)){return _0x164db2(msgResponse(_0x2d96('0x21d'),_0x2d96('0x48'),'Umin\x20=\x20'+_0x110013));}_0x4c8fb1=_0x4c8fb1||0x0;var _0x463dd9=0x1/_0x4241f5;var _0x1401f9=0x0;var _0xd40779=0x0;var _0x256d50=0x0;var _0x4e13bd=0x0;for(var _0x3845e0=0x0;_0x4e13bd<_0x110013;_0x3845e0+=0x1){_0xd40779=_0x3845e0/_0x390996;_0x1401f9=(_0x2e32fa*_0xd40779+_0x4c8fb1)/_0x463dd9;_0x256d50=erlangb(_0x1401f9,_0x117c37);_0x4e13bd=_0x1401f9/_0x117c37*(0x1-erlangb(_0x1401f9,_0x117c37));}return _0x1c1dbc({'erlangCalls':_0x3845e0,'erlangCallToSecond':_0x390996/_0x3845e0,'erlangAbandonmentRate':_0x256d50,'erlangBusyFactor':_0x4e13bd});});};module[_0x2d96('0x221')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 054666f..caba1d8 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 _0x9369=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','campaigntype','outbound','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','uniqueid','calleridname','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','ContactId'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9369,0x14f));var _0x9936=function(_0x2e3864,_0x3e2777){_0x2e3864=_0x2e3864-0x0;var _0x305521=_0x9369[_0x2e3864];return _0x305521;};'use strict';var util=require(_0x9936('0x0'));var _=require(_0x9936('0x1'));var moment=require(_0x9936('0x2'));function getSeconds(_0x142f57,_0x15f8f4){var _0x37675a=moment(_0x142f57)[_0x9936('0x3')](0x0);var _0x1744ce=moment(_0x15f8f4)[_0x9936('0x3')](0x0);return _0x37675a[_0x9936('0x4')](_0x1744ce,_0x9936('0x5'));}function QueueCallerAbandon(_0x490749,_0x131509){this[_0x9936('0x6')]=_0x490749[_0x9936('0x6')];this['type']=_0x490749['type'];this[_0x9936('0x7')]=_0x490749['type']===_0x9936('0x8')?_0x9936('0x9'):_0x490749[_0x9936('0xa')];this[_0x9936('0xb')]=_0x490749[_0x9936('0xb')];this[_0x9936('0xc')]=_0x490749['countcongestionretry'];this[_0x9936('0xd')]=_0x490749[_0x9936('0xd')];this[_0x9936('0xe')]=_0x490749[_0x9936('0xb')]+_0x490749[_0x9936('0xc')]+_0x490749[_0x9936('0xd')]+_0x490749[_0x9936('0xf')]+_0x490749[_0x9936('0x10')]+_0x490749[_0x9936('0x11')]+_0x490749[_0x9936('0x12')]+_0x490749['countagentrejectretry'];this['countnosuchnumberretry']=_0x490749['countnosuchnumberretry'];this['countdropretry']=_0x490749['countdropretry'];this[_0x9936('0x11')]=_0x490749['countabandonedretry'];this[_0x9936('0x12')]=_0x490749[_0x9936('0x12')];this['countagentrejectretry']=_0x490749['countagentrejectretry'];this[_0x9936('0x13')]=_0x131509['uniqueid'];this[_0x9936('0x14')]=_0x490749['name'];this['calleridnum']=_0x490749[_0x9936('0x15')];this[_0x9936('0x16')]=_0x490749[_0x9936('0x16')];this[_0x9936('0x17')]=_0x490749[_0x9936('0x17')];this[_0x9936('0x18')]=_0x490749['droptime'];this[_0x9936('0x19')]=this[_0x9936('0x18')];this[_0x9936('0x1a')]=getSeconds(_0x490749[_0x9936('0x17')],_0x490749[_0x9936('0x16')]);this[_0x9936('0x1b')]=getSeconds(this[_0x9936('0x18')],_0x490749[_0x9936('0x17')]);this['talktime']=0x0;this['queue']=_0x131509[_0x9936('0x9')];this[_0x9936('0x1c')]=_0x131509['connectedlinename'];this[_0x9936('0x1d')]=_0x131509['reason'];this[_0x9936('0x1e')]=_0x490749[_0x9936('0x1e')];this[_0x9936('0x1f')]=_0x490749[_0x9936('0x1f')];this['callbackat']=_0x490749[_0x9936('0x20')];this['recallme']=_0x490749['recallme'];this[_0x9936('0x21')]=_0x490749['ContactId'];this[_0x9936('0x22')]=_0x490749[_0x9936('0x22')];this['UserId']=_0x490749[_0x9936('0x23')];this[_0x9936('0x24')]=_0x490749[_0x9936('0x24')];this[_0x9936('0x25')]=_0x490749[_0x9936('0x25')];this[_0x9936('0x26')]=_0x490749['originatecalleridnum']||'';this[_0x9936('0x27')]=_0x490749[_0x9936('0x27')]||'';}module[_0x9936('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0x5e0b=['diff','seconds','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','talktime','queue','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds'];(function(_0xd336ba,_0x23d405){var _0x34c559=function(_0x1007b9){while(--_0x1007b9){_0xd336ba['push'](_0xd336ba['shift']());}};_0x34c559(++_0x23d405);}(_0x5e0b,0xa1));var _0xb5e0=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0x5e0b[_0x3b7a0c];return _0x3bb70f;};'use strict';var util=require(_0xb5e0('0x0'));var _=require(_0xb5e0('0x1'));var moment=require('moment');function getSeconds(_0x1e0156,_0x4618e1){var _0x52152e=moment(_0x1e0156)[_0xb5e0('0x2')](0x0);var _0x4b4e01=moment(_0x4618e1)[_0xb5e0('0x2')](0x0);return _0x52152e[_0xb5e0('0x3')](_0x4b4e01,_0xb5e0('0x4'));}function QueueCallerAbandon(_0x4c1aaf,_0x48db97){this[_0xb5e0('0x5')]=_0x4c1aaf['scheduledat'];this[_0xb5e0('0x6')]=_0x4c1aaf[_0xb5e0('0x6')];this['campaigntype']=_0x4c1aaf[_0xb5e0('0x6')]===_0xb5e0('0x7')?'queue':_0x4c1aaf['type'];this[_0xb5e0('0x8')]=_0x4c1aaf[_0xb5e0('0x8')];this[_0xb5e0('0x9')]=_0x4c1aaf[_0xb5e0('0x9')];this['countnoanswerretry']=_0x4c1aaf[_0xb5e0('0xa')];this['countglobal']=_0x4c1aaf[_0xb5e0('0x8')]+_0x4c1aaf[_0xb5e0('0x9')]+_0x4c1aaf[_0xb5e0('0xa')]+_0x4c1aaf[_0xb5e0('0xb')]+_0x4c1aaf[_0xb5e0('0xc')]+_0x4c1aaf['countabandonedretry']+_0x4c1aaf[_0xb5e0('0xd')]+_0x4c1aaf[_0xb5e0('0xe')];this['countnosuchnumberretry']=_0x4c1aaf[_0xb5e0('0xb')];this[_0xb5e0('0xc')]=_0x4c1aaf[_0xb5e0('0xc')];this[_0xb5e0('0xf')]=_0x4c1aaf['countabandonedretry'];this[_0xb5e0('0xd')]=_0x4c1aaf[_0xb5e0('0xd')];this[_0xb5e0('0xe')]=_0x4c1aaf[_0xb5e0('0xe')];this[_0xb5e0('0x10')]=_0x48db97[_0xb5e0('0x10')];this[_0xb5e0('0x11')]=_0x4c1aaf[_0xb5e0('0x12')];this[_0xb5e0('0x13')]=_0x4c1aaf[_0xb5e0('0x14')];this[_0xb5e0('0x15')]=_0x4c1aaf['starttime'];this[_0xb5e0('0x16')]=_0x4c1aaf[_0xb5e0('0x16')];this[_0xb5e0('0x17')]=_0x4c1aaf[_0xb5e0('0x17')];this[_0xb5e0('0x18')]=this[_0xb5e0('0x17')];this['ringtime']=getSeconds(_0x4c1aaf[_0xb5e0('0x16')],_0x4c1aaf['starttime']);this['holdtime']=getSeconds(this['droptime'],_0x4c1aaf[_0xb5e0('0x16')]);this[_0xb5e0('0x19')]=0x0;this[_0xb5e0('0x1a')]=_0x48db97['queue'];this[_0xb5e0('0x1b')]=_0x48db97[_0xb5e0('0x1c')];this['reason']=_0x48db97[_0xb5e0('0x1d')];this['callback']=_0x4c1aaf['callback'];this['callbackuniqueid']=_0x4c1aaf[_0xb5e0('0x1e')];this[_0xb5e0('0x1f')]=_0x4c1aaf['callbackat'];this['recallme']=_0x4c1aaf[_0xb5e0('0x20')];this[_0xb5e0('0x21')]=_0x4c1aaf[_0xb5e0('0x21')];this[_0xb5e0('0x22')]=_0x4c1aaf[_0xb5e0('0x22')];this[_0xb5e0('0x23')]=_0x4c1aaf[_0xb5e0('0x23')];this[_0xb5e0('0x24')]=_0x4c1aaf['VoiceQueueId'];this['CampaignId']=_0x4c1aaf[_0xb5e0('0x25')];this[_0xb5e0('0x26')]=_0x4c1aaf[_0xb5e0('0x26')]||'';this[_0xb5e0('0x27')]=_0x4c1aaf[_0xb5e0('0x27')]||'';}module[_0xb5e0('0x28')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 2cecd0f..f05da58 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 _0xa96e=['localstationid','headerinfo','path','AttachmentId','exports','util','moment','uniqueid','%s/%s/%s','tech','name','fax'];(function(_0x778778,_0x389c6c){var _0x162093=function(_0x2c545d){while(--_0x2c545d){_0x778778['push'](_0x778778['shift']());}};_0x162093(++_0x389c6c);}(_0xa96e,0x191));var _0xea96=function(_0x28e18b,_0x48c862){_0x28e18b=_0x28e18b-0x0;var _0xb9d183=_0xa96e[_0x28e18b];return _0xb9d183;};'use strict';var util=require(_0xea96('0x0'));var _=require('lodash');var moment=require(_0xea96('0x1'));function Action(_0x42aff4,_0x21fe12,_0x266ffe){this[_0xea96('0x2')]=_0x42aff4||undefined;this['channel']=util['format'](_0xea96('0x3'),_0x21fe12[_0xea96('0x4')],_0x21fe12['Trunk'][_0xea96('0x5')],_0x266ffe[_0xea96('0x6')]);this['localstationid']=_0x21fe12[_0xea96('0x7')];this['headerinfo']=_0x21fe12[_0xea96('0x8')];this[_0xea96('0x9')]=_0x266ffe['path'];this[_0xea96('0xa')]=_0x266ffe[_0xea96('0xa')];}module[_0xea96('0xb')]=Action; \ No newline at end of file +var _0xe5f8=['tech','name','fax','localstationid','headerinfo','path','AttachmentId','exports','util','moment','uniqueid','channel','%s/%s/%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe5f8,0x140));var _0x8e5f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe5f8[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0x8e5f('0x0'));var _=require('lodash');var moment=require(_0x8e5f('0x1'));function Action(_0x418297,_0x39498a,_0x217819){this[_0x8e5f('0x2')]=_0x418297||undefined;this[_0x8e5f('0x3')]=util['format'](_0x8e5f('0x4'),_0x39498a[_0x8e5f('0x5')],_0x39498a['Trunk'][_0x8e5f('0x6')],_0x217819[_0x8e5f('0x7')]);this[_0x8e5f('0x8')]=_0x39498a[_0x8e5f('0x8')];this[_0x8e5f('0x9')]=_0x39498a['headerinfo'];this[_0x8e5f('0xa')]=_0x217819['path'];this[_0x8e5f('0xb')]=_0x217819[_0x8e5f('0xb')];}module[_0x8e5f('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 c0f58c3..124c64e 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 _0xf03b=['syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','path','execute','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','trunks','SIP/%s','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','faxstatus','syncFaxStatus','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc'];(function(_0x44cf39,_0x5578ce){var _0x5dd390=function(_0x2fb792){while(--_0x2fb792){_0x44cf39['push'](_0x44cf39['shift']());}};_0x5dd390(++_0x5578ce);}(_0xf03b,0xc5));var _0xbf03=function(_0x51eb63,_0x57cad9){_0x51eb63=_0x51eb63-0x0;var _0x63daa6=_0xf03b[_0x51eb63];return _0x63daa6;};'use strict';var util=require(_0xbf03('0x0'));var _=require(_0xbf03('0x1'));var BPromise=require(_0xbf03('0x2'));var uuid=require(_0xbf03('0x3'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0xbf03('0x4'));var gs=require(_0xbf03('0x5'));var logger=require(_0xbf03('0x6'))(_0xbf03('0x7'));var ami=require(_0xbf03('0x8'));var rpcDb=require(_0xbf03('0x9'));var Channel=require(_0xbf03('0xa'));var ut=require(_0xbf03('0xb'));var Action=require(_0xbf03('0xc'));var faxAccount=require(_0xbf03('0xd'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xbf03('0xe'));function Fax(_0x3532e4){this[_0xbf03('0xf')]={};this[_0xbf03('0x10')]=_0x3532e4[_0xbf03('0x10')];this['trunks']=_0x3532e4['trunks'];this[_0xbf03('0x11')]={};ami['on'](_0xbf03('0x12'),this[_0xbf03('0x13')][_0xbf03('0x14')](this));ami['on'](_0xbf03('0x15'),this[_0xbf03('0x16')]['bind'](this));ami['on'](_0xbf03('0x17'),this[_0xbf03('0x18')][_0xbf03('0x14')](this));ami['on']('newexten',this['syncNewExten'][_0xbf03('0x14')](this));ami['on'](_0xbf03('0x19'),this[_0xbf03('0x1a')][_0xbf03('0x14')](this));ami['on']('receivefax',this[_0xbf03('0x1b')][_0xbf03('0x14')](this));ami['on'](_0xbf03('0x1c'),this['syncHangup'][_0xbf03('0x14')](this));ami['on'](_0xbf03('0x1d'),this[_0xbf03('0x1e')]['bind'](this));}Fax[_0xbf03('0x1f')][_0xbf03('0x13')]=function(_0x29fff0){if(_0x29fff0['context']===_0xbf03('0x20')){for(var _0x21e625 in this[_0xbf03('0x10')]){if(this[_0xbf03('0x10')][_0xbf03('0x21')](_0x21e625)){if(_0x29fff0[_0xbf03('0x22')]===this['faxAccounts'][_0x21e625][_0xbf03('0x23')]){this['channels'][_0x29fff0[_0xbf03('0x24')]]={};this[_0xbf03('0xf')][_0x29fff0[_0xbf03('0x24')]][_0xbf03('0x25')]=_0x29fff0[_0xbf03('0x25')];this[_0xbf03('0xf')][_0x29fff0[_0xbf03('0x24')]]['id']=this[_0xbf03('0x10')][_0x21e625]['id'];this[_0xbf03('0xf')][_0x29fff0['uniqueid']][_0xbf03('0x26')]=this[_0xbf03('0x10')][_0x21e625]['name'];logger[_0xbf03('0x27')](_0x29fff0[_0xbf03('0x24')],_0xbf03('0x28'));}}}}if(this[_0xbf03('0x11')][_0x29fff0[_0xbf03('0x24')]]){this['channels'][_0x29fff0[_0xbf03('0x24')]]={};this['channels'][_0x29fff0['uniqueid']]['channel']=_0x29fff0[_0xbf03('0x25')];logger['info'](_0x29fff0[_0xbf03('0x24')],_0xbf03('0x28'));}};Fax[_0xbf03('0x1f')]['syncVarSet']=function(_0x5d5c0d){if(this['channels'][_0x5d5c0d['uniqueid']]){for(var _0x5cca0e in _0x5d5c0d['variable']){if(_0x5d5c0d[_0xbf03('0x29')]['hasOwnProperty'](_0x5cca0e)){this[_0xbf03('0xf')][_0x5d5c0d[_0xbf03('0x24')]][_0x5cca0e]=_0x5d5c0d[_0xbf03('0x2a')];}}}};Fax[_0xbf03('0x1f')][_0xbf03('0x18')]=function(_0x52f239){if(this[_0xbf03('0xf')][_0x52f239[_0xbf03('0x24')]]){this[_0xbf03('0xf')][_0x52f239[_0xbf03('0x24')]][_0xbf03('0x2b')]=_0x52f239[_0xbf03('0x2b')];this[_0xbf03('0xf')][_0x52f239[_0xbf03('0x24')]][_0xbf03('0x2c')]=_0x52f239['channelstatedesc'];}};Fax[_0xbf03('0x1f')][_0xbf03('0x2d')]=function(_0x2c7705){if(this[_0xbf03('0xf')][_0x2c7705[_0xbf03('0x24')]]){for(var _0x127c3d in _0x2c7705[_0xbf03('0x29')]){if(_0x2c7705['variable'][_0xbf03('0x21')](_0x127c3d)){this[_0xbf03('0xf')][_0x2c7705[_0xbf03('0x24')]][_0x127c3d]=_0x2c7705['value'];}}}};Fax[_0xbf03('0x1f')][_0xbf03('0x1a')]=function(_0x3f03d2){if(this[_0xbf03('0xf')][_0x3f03d2[_0xbf03('0x24')]]){this[_0xbf03('0xf')][_0x3f03d2[_0xbf03('0x24')]][_0xbf03('0x2e')]=_0x3f03d2[_0xbf03('0x2e')];this[_0xbf03('0xf')][_0x3f03d2[_0xbf03('0x24')]][_0xbf03('0x2f')]=_0x3f03d2[_0xbf03('0x2f')];this[_0xbf03('0xf')][_0x3f03d2[_0xbf03('0x24')]][_0xbf03('0x23')]=_0x3f03d2['localstationid'];this[_0xbf03('0xf')][_0x3f03d2[_0xbf03('0x24')]][_0xbf03('0x30')]=_0x3f03d2[_0xbf03('0x30')];logger[_0xbf03('0x27')](_0x3f03d2[_0xbf03('0x24')],_0xbf03('0x31'));}};Fax[_0xbf03('0x1f')][_0xbf03('0x1b')]=function(_0x10a314){var _0x2bc986=this;if(this['channels'][_0x10a314['uniqueid']]){var _0x479d9b=this[_0xbf03('0xf')][_0x10a314[_0xbf03('0x24')]]['id'];this[_0xbf03('0xf')][_0x10a314[_0xbf03('0x24')]][_0xbf03('0x32')]=_0x10a314[_0xbf03('0x32')];this[_0xbf03('0xf')][_0x10a314[_0xbf03('0x24')]][_0xbf03('0x33')]=_0x10a314[_0xbf03('0x33')];this[_0xbf03('0xf')][_0x10a314[_0xbf03('0x24')]][_0xbf03('0x23')]=_0x10a314[_0xbf03('0x23')];this[_0xbf03('0xf')][_0x10a314[_0xbf03('0x24')]][_0xbf03('0x34')]=_0x10a314[_0xbf03('0x34')];this[_0xbf03('0xf')][_0x10a314[_0xbf03('0x24')]][_0xbf03('0x35')]=_0x10a314[_0xbf03('0x35')];this['channels'][_0x10a314[_0xbf03('0x24')]][_0xbf03('0x30')]=_0x10a314[_0xbf03('0x30')];this['channels'][_0x10a314[_0xbf03('0x24')]]['calleridnum']=_0x10a314[_0xbf03('0x36')];if(this[_0xbf03('0xf')][_0x10a314[_0xbf03('0x24')]][_0xbf03('0x33')]>0x0){tiff2pdf(_0x10a314['filename'],_0xbf03('0x37'),function(_0x47f349){logger[_0xbf03('0x27')](_0x10a314[_0xbf03('0x24')],_0xbf03('0x38'),_0x47f349[_0xbf03('0x39')]);attachment[_0xbf03('0x3a')]({'name':path[_0xbf03('0x3b')](_0x10a314[_0xbf03('0x30')])[_0xbf03('0x26')],'basename':path[_0xbf03('0x3b')](_0x10a314[_0xbf03('0x30')])['name']+'.pdf','type':_0xbf03('0x3c')})[_0xbf03('0x3d')](function(_0x2ab33f){faxAccount[_0xbf03('0x3e')](_0x479d9b,{'from':_0x10a314[_0xbf03('0x36')],'mapKey':_0xbf03('0x7'),'body':path[_0xbf03('0x3b')](_0x10a314[_0xbf03('0x30')])[_0xbf03('0x26')]+_0xbf03('0x3f'),'AttachmentId':_0x2ab33f['id']})[_0xbf03('0x40')](function(_0x5ae410){logger[_0xbf03('0x41')](_0x10a314[_0xbf03('0x24')],_0xbf03('0x42'),JSON[_0xbf03('0x43')](_0x5ae410));});})[_0xbf03('0x40')](function(_0x18e053){logger[_0xbf03('0x41')](_0x10a314[_0xbf03('0x24')],'\x20receiveFax\x20',JSON['stringify'](_0x18e053));});});}logger['info'](_0x10a314['uniqueid'],_0xbf03('0x44'));}};Fax[_0xbf03('0x1f')][_0xbf03('0x1e')]=function(_0x40c2df){if(this[_0xbf03('0x11')][_0x40c2df[_0xbf03('0x24')]]){_[_0xbf03('0x45')](this[_0xbf03('0xf')][_0x40c2df[_0xbf03('0x24')]],_[_0xbf03('0x46')](_0x40c2df,[_0xbf03('0x47'),_0xbf03('0x48')]));}};function updateStatus(_0x47428f){if(_0x47428f[_0xbf03('0x49')]){faxMessage[_0xbf03('0x4a')](_0x47428f[_0xbf03('0x49')],{'failMessage':_0xbf03('0x4b')})[_0xbf03('0x3d')](function(_0x2730e0){ut[_0xbf03('0x4c')](_0xbf03('0x4d'),_0x2730e0);})[_0xbf03('0x40')](function(_0x539146){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x539146);});}else{ut[_0xbf03('0x4c')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xbf03('0x1f')][_0xbf03('0x4e')]=function(_0x5a879b,_0x2acda2,_0x16b0fd){var _0x5822bc=this;var _0x7907f0={};if(_0x2acda2){_0x7907f0={'read':_0x2acda2};}else{_0x7907f0={'failMessage':_0x16b0fd};}if(this[_0xbf03('0x11')][_0x5a879b][_0xbf03('0x49')]){faxMessage[_0xbf03('0x4a')](this[_0xbf03('0x11')][_0x5a879b][_0xbf03('0x49')],_0x7907f0)[_0xbf03('0x3d')](function(_0x1608d3){ut['logger'](_0xbf03('0x4f'),_0x1608d3);})[_0xbf03('0x40')](function(_0x570da5){ut[_0xbf03('0x4c')](_0xbf03('0x50'),_0x570da5);})[_0xbf03('0x51')](function(){delete _0x5822bc[_0xbf03('0xf')][_0x5a879b];delete _0x5822bc[_0xbf03('0x11')][_0x5a879b];});}else{ut[_0xbf03('0x4c')](_0xbf03('0x52'));delete this[_0xbf03('0xf')][_0x5a879b];delete this[_0xbf03('0x11')][_0x5a879b];}};Fax[_0xbf03('0x1f')][_0xbf03('0x53')]=function(_0x2132fe){var _0x3e1f99=this;if(this[_0xbf03('0xf')][_0x2132fe['uniqueid']]){if(this[_0xbf03('0x11')][_0x2132fe['uniqueid']]){this[_0xbf03('0xf')][_0x2132fe[_0xbf03('0x24')]]['id']=this[_0xbf03('0x11')][_0x2132fe[_0xbf03('0x24')]]['id'];this['channels'][_0x2132fe[_0xbf03('0x24')]][_0xbf03('0x26')]=this[_0xbf03('0x11')][_0x2132fe[_0xbf03('0x24')]][_0xbf03('0x26')];}logger[_0xbf03('0x27')](_0x2132fe[_0xbf03('0x24')],this[_0xbf03('0x11')][_0x2132fe['uniqueid']]?_0xbf03('0x54'):_0xbf03('0x55'),JSON[_0xbf03('0x43')](this[_0xbf03('0xf')][_0x2132fe[_0xbf03('0x24')]]));if(this[_0xbf03('0x11')][_0x2132fe[_0xbf03('0x24')]]){if(this[_0xbf03('0xf')][_0x2132fe[_0xbf03('0x24')]]['faxpages']>0x0&&this[_0xbf03('0xf')][_0x2132fe[_0xbf03('0x24')]][_0xbf03('0x19')]===_0xbf03('0x56')){this[_0xbf03('0x4e')](_0x2132fe['uniqueid'],!![]);}else{this['updateStatus'](_0x2132fe[_0xbf03('0x24')],![],this[_0xbf03('0xf')][_0x2132fe['uniqueid']][_0xbf03('0x57')]?_0xbf03('0x58')+this[_0xbf03('0xf')][_0x2132fe[_0xbf03('0x24')]][_0xbf03('0x57')]:_0xbf03('0x59'));}}}};Fax[_0xbf03('0x1f')]['send']=function(_0x218e78){var _0x543cc6=this;return new BPromise(function(_0x14d7c0,_0x4470d2){_0x543cc6[_0xbf03('0x5a')](_0x218e78,_0x543cc6[_0xbf03('0x10')][_0x218e78[_0xbf03('0x5b')]])[_0xbf03('0x3d')](function(_0x47bebd){ut['logger']('[Fax][execOriginate][success]',_0x47bebd);_0x14d7c0(ut[_0xbf03('0x39')](_0xbf03('0x5c')));})['catch'](function(_0x2e2523){ut[_0xbf03('0x4c')](_0xbf03('0x5d'),_0x2e2523);updateStatus(_0x218e78);_0x4470d2(ut[_0xbf03('0x39')](_0xbf03('0x5e')));});});};Fax['prototype'][_0xbf03('0x5f')]=function(_0x1c7727){var _0x479ef1=this;return new BPromise(function(_0x192bc9,_0x5b72d1){var _0x40a017=_0x479ef1['checkTrunk'](_0x479ef1[_0xbf03('0x10')][_0x1c7727['FaxAccountId']][_0xbf03('0x60')],_0x1c7727);if(_0x40a017[_0xbf03('0x61')]){_0x192bc9(ut[_0xbf03('0x39')]('Trunk\x20Reachable'));}else{_0x5b72d1(ut[_0xbf03('0x39')](_0x40a017[_0xbf03('0x39')]));}});};function originate(_0x5291cb,_0x26b432,_0x28f15f){return new BPromise(function(_0x1c6b18,_0x318d97){if(_0x28f15f){var _0x19faf4=util['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',path['parse'](_0x5291cb[_0xbf03('0x62')])[_0xbf03('0x26')],_0x5291cb[_0xbf03('0x62')]);gs[_0xbf03('0x63')](_0x19faf4)[_0xbf03('0x3d')](function(){_0x5291cb[_0xbf03('0x62')]=util[_0xbf03('0x64')](_0xbf03('0x65'),path[_0xbf03('0x3b')](_0x5291cb['path'])[_0xbf03('0x66')],path[_0xbf03('0x3b')](_0x5291cb[_0xbf03('0x62')])[_0xbf03('0x26')]);_0x26b432[_0xbf03('0x67')]=_0x5291cb[_0xbf03('0x62')];ut[_0xbf03('0x4c')](_0xbf03('0x68'),'');ami[_0xbf03('0x69')](ut[_0xbf03('0x6a')](_0x5291cb,_0x26b432))[_0xbf03('0x3d')](function(_0x3d55c6){_0x1c6b18(_0x3d55c6);})[_0xbf03('0x40')](function(_0x5c37fb){_0x318d97(_0x5c37fb);});})[_0xbf03('0x40')](function(_0x4f35d9){_0x318d97(_0x4f35d9);});}else{ami['Action'](ut['variablesAction'](_0x5291cb,_0x26b432))['then'](function(_0x16ae91){_0x1c6b18(_0x16ae91);})[_0xbf03('0x40')](function(_0x3761e0){_0x318d97(_0x3761e0);});}});}Fax[_0xbf03('0x1f')]['execOriginate']=function(_0x4ebc1f,_0xdd71c6){var _0x529209=this;return new BPromise(function(_0x4632ac,_0x5d16a4){var _0x418f01=uuid['v4']();var _0x36a768=ut[_0xbf03('0x6b')](_0x4ebc1f,_0xdd71c6);_0x529209[_0xbf03('0x11')][_0x418f01]=new Action(_0x418f01,_0xdd71c6,_0x4ebc1f);var _0xf24f71=_0x529209[_0xbf03('0x11')][_0x418f01];if(path[_0xbf03('0x3b')](_0x4ebc1f['path'])[_0xbf03('0x6c')]==='.pdf'){originate(_0xf24f71,_0x36a768,!![])[_0xbf03('0x3d')](function(_0x1db868){_0x4632ac(_0x1db868);})[_0xbf03('0x40')](function(_0x44b83e){_0x5d16a4(_0x44b83e);});}else{originate(_0xf24f71,_0x36a768,![])[_0xbf03('0x3d')](function(_0x175ce3){_0x4632ac(_0x175ce3);})[_0xbf03('0x40')](function(_0x20f9a4){_0x5d16a4(_0x20f9a4);});}});};Fax[_0xbf03('0x1f')][_0xbf03('0x6d')]=function(_0x1c096e){return!_[_0xbf03('0x6e')](_0x1c096e)&&!_['isNil'](_0x1c096e[_0xbf03('0x26')])&&!_['isNil'](_0x1c096e[_0xbf03('0x6f')])&&_0x1c096e['active']&&!_[_0xbf03('0x6e')](this[_0xbf03('0x70')][util[_0xbf03('0x64')](_0xbf03('0x71'),_0x1c096e[_0xbf03('0x26')])])&&!_[_0xbf03('0x6e')](this[_0xbf03('0x70')][util['format'](_0xbf03('0x71'),_0x1c096e[_0xbf03('0x26')])]['status'])&&(this[_0xbf03('0x70')][util[_0xbf03('0x64')](_0xbf03('0x71'),_0x1c096e[_0xbf03('0x26')])]['status']==='reachable'||this[_0xbf03('0x70')][util[_0xbf03('0x64')]('SIP/%s',_0x1c096e[_0xbf03('0x26')])][_0xbf03('0x2f')]==='unmonitored');};Fax[_0xbf03('0x1f')][_0xbf03('0x72')]=function(_0x5adec5,_0xcfea1){if(!this[_0xbf03('0x6d')](_0x5adec5)){ut[_0xbf03('0x4c')](_0xbf03('0x73'),_[_0xbf03('0x6e')](_0x5adec5)?'':_0x5adec5[_0xbf03('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xbf03('0x74')};}if(_['isNil'](_0xcfea1[_0xbf03('0x7')])){ut[_0xbf03('0x4c')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0xcfea1));return{'isValid':![],'message':_0xbf03('0x75')};}if(_[_0xbf03('0x6e')](_0xcfea1['path'])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0xcfea1));return{'isValid':![],'message':_0xbf03('0x76')};}return{'isValid':!![],'message':_0xbf03('0x77')};};module[_0xbf03('0x78')]=Fax; \ No newline at end of file +var _0x3989=['Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid','util','lodash','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','trunks','newchannel','syncNewchannel','varset','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncReceiveFax','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','faxAccounts','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','actions','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif'];(function(_0x2b310b,_0x3a5dc9){var _0xb804d9=function(_0x40c711){while(--_0x40c711){_0x2b310b['push'](_0x2b310b['shift']());}};_0xb804d9(++_0x3a5dc9);}(_0x3989,0x85));var _0x9398=function(_0x243f1b,_0x22aa07){_0x243f1b=_0x243f1b-0x0;var _0x50339f=_0x3989[_0x243f1b];return _0x50339f;};'use strict';var util=require(_0x9398('0x0'));var _=require(_0x9398('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x9398('0x2'));var path=require(_0x9398('0x3'));var tiff2pdf=require(_0x9398('0x4'));var gs=require('./util/gs');var logger=require(_0x9398('0x5'))(_0x9398('0x6'));var ami=require(_0x9398('0x7'));var rpcDb=require(_0x9398('0x8'));var Channel=require('./channel');var ut=require(_0x9398('0x9'));var Action=require(_0x9398('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x9398('0xb'));var faxMessage=require(_0x9398('0xc'));function Fax(_0x281e97){this[_0x9398('0xd')]={};this['faxAccounts']=_0x281e97['faxAccounts'];this[_0x9398('0xe')]=_0x281e97['trunks'];this['actions']={};ami['on'](_0x9398('0xf'),this[_0x9398('0x10')]['bind'](this));ami['on'](_0x9398('0x11'),this['syncVarSet'][_0x9398('0x12')](this));ami['on'](_0x9398('0x13'),this[_0x9398('0x14')][_0x9398('0x12')](this));ami['on'](_0x9398('0x15'),this[_0x9398('0x16')]['bind'](this));ami['on'](_0x9398('0x17'),this['syncFaxStatus'][_0x9398('0x12')](this));ami['on']('receivefax',this[_0x9398('0x18')]['bind'](this));ami['on']('hangup',this[_0x9398('0x19')][_0x9398('0x12')](this));ami['on']('originateresponse',this[_0x9398('0x1a')][_0x9398('0x12')](this));}Fax[_0x9398('0x1b')]['syncNewchannel']=function(_0x526672){if(_0x526672[_0x9398('0x1c')]===_0x9398('0x1d')){for(var _0x5434db in this[_0x9398('0x1e')]){if(this[_0x9398('0x1e')][_0x9398('0x1f')](_0x5434db)){if(_0x526672[_0x9398('0x20')]===this[_0x9398('0x1e')][_0x5434db][_0x9398('0x21')]){this[_0x9398('0xd')][_0x526672[_0x9398('0x22')]]={};this[_0x9398('0xd')][_0x526672['uniqueid']]['channel']=_0x526672[_0x9398('0x23')];this[_0x9398('0xd')][_0x526672[_0x9398('0x22')]]['id']=this['faxAccounts'][_0x5434db]['id'];this[_0x9398('0xd')][_0x526672[_0x9398('0x22')]][_0x9398('0x24')]=this[_0x9398('0x1e')][_0x5434db][_0x9398('0x24')];logger[_0x9398('0x25')](_0x526672['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0x9398('0x26')][_0x526672['uniqueid']]){this[_0x9398('0xd')][_0x526672[_0x9398('0x22')]]={};this[_0x9398('0xd')][_0x526672['uniqueid']][_0x9398('0x23')]=_0x526672[_0x9398('0x23')];logger[_0x9398('0x25')](_0x526672[_0x9398('0x22')],_0x9398('0x27'));}};Fax[_0x9398('0x1b')]['syncVarSet']=function(_0x45c8db){if(this[_0x9398('0xd')][_0x45c8db[_0x9398('0x22')]]){for(var _0x1fb370 in _0x45c8db[_0x9398('0x28')]){if(_0x45c8db[_0x9398('0x28')][_0x9398('0x1f')](_0x1fb370)){this[_0x9398('0xd')][_0x45c8db[_0x9398('0x22')]][_0x1fb370]=_0x45c8db['value'];}}}};Fax[_0x9398('0x1b')][_0x9398('0x14')]=function(_0x2f6fe0){if(this[_0x9398('0xd')][_0x2f6fe0['uniqueid']]){this[_0x9398('0xd')][_0x2f6fe0[_0x9398('0x22')]]['channelstate']=_0x2f6fe0[_0x9398('0x29')];this[_0x9398('0xd')][_0x2f6fe0[_0x9398('0x22')]][_0x9398('0x2a')]=_0x2f6fe0[_0x9398('0x2a')];}};Fax['prototype'][_0x9398('0x16')]=function(_0x527db5){if(this[_0x9398('0xd')][_0x527db5[_0x9398('0x22')]]){for(var _0x2e44f6 in _0x527db5[_0x9398('0x28')]){if(_0x527db5['variable']['hasOwnProperty'](_0x2e44f6)){this['channels'][_0x527db5[_0x9398('0x22')]][_0x2e44f6]=_0x527db5[_0x9398('0x2b')];}}}};Fax[_0x9398('0x1b')][_0x9398('0x2c')]=function(_0x2bf336){if(this[_0x9398('0xd')][_0x2bf336['uniqueid']]){this[_0x9398('0xd')][_0x2bf336['uniqueid']][_0x9398('0x2d')]=_0x2bf336['operation'];this[_0x9398('0xd')][_0x2bf336[_0x9398('0x22')]]['status']=_0x2bf336[_0x9398('0x2e')];this[_0x9398('0xd')][_0x2bf336['uniqueid']][_0x9398('0x21')]=_0x2bf336[_0x9398('0x21')];this['channels'][_0x2bf336[_0x9398('0x22')]][_0x9398('0x2f')]=_0x2bf336[_0x9398('0x2f')];logger['info'](_0x2bf336[_0x9398('0x22')],_0x9398('0x30'));}};Fax[_0x9398('0x1b')][_0x9398('0x18')]=function(_0x30e1d8){var _0x542c06=this;if(this[_0x9398('0xd')][_0x30e1d8['uniqueid']]){var _0x56c833=this['channels'][_0x30e1d8['uniqueid']]['id'];this[_0x9398('0xd')][_0x30e1d8['uniqueid']][_0x9398('0x31')]=_0x30e1d8['remotestationid'];this[_0x9398('0xd')][_0x30e1d8[_0x9398('0x22')]]['pagestransferred']=_0x30e1d8[_0x9398('0x32')];this['channels'][_0x30e1d8[_0x9398('0x22')]][_0x9398('0x21')]=_0x30e1d8[_0x9398('0x21')];this[_0x9398('0xd')][_0x30e1d8[_0x9398('0x22')]][_0x9398('0x33')]=_0x30e1d8[_0x9398('0x33')];this['channels'][_0x30e1d8[_0x9398('0x22')]][_0x9398('0x34')]=_0x30e1d8[_0x9398('0x34')];this[_0x9398('0xd')][_0x30e1d8[_0x9398('0x22')]][_0x9398('0x2f')]=_0x30e1d8['filename'];this[_0x9398('0xd')][_0x30e1d8[_0x9398('0x22')]][_0x9398('0x35')]=_0x30e1d8[_0x9398('0x35')];if(this['channels'][_0x30e1d8[_0x9398('0x22')]]['pagestransferred']>0x0){tiff2pdf(_0x30e1d8['filename'],_0x9398('0x36'),function(_0x14dfb1){logger[_0x9398('0x25')](_0x30e1d8[_0x9398('0x22')],_0x9398('0x37'),_0x14dfb1[_0x9398('0x38')]);attachment[_0x9398('0x39')]({'name':path['parse'](_0x30e1d8['filename'])['name'],'basename':path[_0x9398('0x3a')](_0x30e1d8[_0x9398('0x2f')])[_0x9398('0x24')]+'.pdf','type':_0x9398('0x3b')})[_0x9398('0x3c')](function(_0x69207f){faxAccount[_0x9398('0x3d')](_0x56c833,{'from':_0x30e1d8['calleridnum'],'mapKey':_0x9398('0x6'),'body':path[_0x9398('0x3a')](_0x30e1d8[_0x9398('0x2f')])['name']+_0x9398('0x3e'),'AttachmentId':_0x69207f['id']})[_0x9398('0x3f')](function(_0x284950){logger[_0x9398('0x40')](_0x30e1d8[_0x9398('0x22')],_0x9398('0x41'),JSON[_0x9398('0x42')](_0x284950));});})[_0x9398('0x3f')](function(_0x148b44){logger[_0x9398('0x40')](_0x30e1d8[_0x9398('0x22')],_0x9398('0x43'),JSON[_0x9398('0x42')](_0x148b44));});});}logger['info'](_0x30e1d8['uniqueid'],_0x9398('0x43'));}};Fax[_0x9398('0x1b')]['syncOriginateResponse']=function(_0x232946){if(this['actions'][_0x232946['uniqueid']]){_[_0x9398('0x44')](this['channels'][_0x232946[_0x9398('0x22')]],_[_0x9398('0x45')](_0x232946,['response',_0x9398('0x46')]));}};function updateStatus(_0x4c2894){if(_0x4c2894['AttachmentId']){faxMessage[_0x9398('0x47')](_0x4c2894[_0x9398('0x48')],{'failMessage':_0x9398('0x49')})['then'](function(_0x1b6bbe){ut['logger'](_0x9398('0x4a'),_0x1b6bbe);})['catch'](function(_0x3a05a9){ut[_0x9398('0x4b')](_0x9398('0x4c'),_0x3a05a9);});}else{ut[_0x9398('0x4b')](_0x9398('0x4d'));}}Fax[_0x9398('0x1b')][_0x9398('0x4e')]=function(_0x10c6f8,_0x53497d,_0x43f0f9){var _0x471e4d=this;var _0x9c0c43={};if(_0x53497d){_0x9c0c43={'read':_0x53497d};}else{_0x9c0c43={'failMessage':_0x43f0f9};}if(this[_0x9398('0x26')][_0x10c6f8][_0x9398('0x48')]){faxMessage[_0x9398('0x47')](this[_0x9398('0x26')][_0x10c6f8][_0x9398('0x48')],_0x9c0c43)[_0x9398('0x3c')](function(_0x28534e){ut['logger']('[Fax][Message][Updated]',_0x28534e);})['catch'](function(_0x66e9ff){ut[_0x9398('0x4b')]('[Fax][Message][NoUpdate1]',_0x66e9ff);})[_0x9398('0x4f')](function(){delete _0x471e4d[_0x9398('0xd')][_0x10c6f8];delete _0x471e4d[_0x9398('0x26')][_0x10c6f8];});}else{ut[_0x9398('0x4b')](_0x9398('0x50'));delete this[_0x9398('0xd')][_0x10c6f8];delete this[_0x9398('0x26')][_0x10c6f8];}};Fax[_0x9398('0x1b')][_0x9398('0x19')]=function(_0x369fb8){var _0x5dfcf5=this;if(this[_0x9398('0xd')][_0x369fb8[_0x9398('0x22')]]){if(this['actions'][_0x369fb8['uniqueid']]){this[_0x9398('0xd')][_0x369fb8[_0x9398('0x22')]]['id']=this[_0x9398('0x26')][_0x369fb8[_0x9398('0x22')]]['id'];this['channels'][_0x369fb8[_0x9398('0x22')]]['name']=this[_0x9398('0x26')][_0x369fb8[_0x9398('0x22')]][_0x9398('0x24')];}logger[_0x9398('0x25')](_0x369fb8[_0x9398('0x22')],this['actions'][_0x369fb8['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x9398('0x51'),JSON[_0x9398('0x42')](this[_0x9398('0xd')][_0x369fb8[_0x9398('0x22')]]));if(this['actions'][_0x369fb8[_0x9398('0x22')]]){if(this[_0x9398('0xd')][_0x369fb8[_0x9398('0x22')]]['faxpages']>0x0&&this[_0x9398('0xd')][_0x369fb8['uniqueid']][_0x9398('0x17')]==='SUCCESS'){this[_0x9398('0x4e')](_0x369fb8[_0x9398('0x22')],!![]);}else{this['updateStatus'](_0x369fb8[_0x9398('0x22')],![],this[_0x9398('0xd')][_0x369fb8[_0x9398('0x22')]][_0x9398('0x52')]?_0x9398('0x53')+this['channels'][_0x369fb8[_0x9398('0x22')]]['faxstatusstring']:_0x9398('0x54'));}}}};Fax[_0x9398('0x1b')][_0x9398('0x55')]=function(_0x1031d8){var _0x5debed=this;return new BPromise(function(_0x3f0f47,_0x3d2bcd){_0x5debed[_0x9398('0x56')](_0x1031d8,_0x5debed[_0x9398('0x1e')][_0x1031d8[_0x9398('0x57')]])[_0x9398('0x3c')](function(_0x5bace7){ut[_0x9398('0x4b')](_0x9398('0x58'),_0x5bace7);_0x3f0f47(ut[_0x9398('0x38')](_0x9398('0x59')));})[_0x9398('0x3f')](function(_0x1c6b3b){ut['logger'](_0x9398('0x5a'),_0x1c6b3b);updateStatus(_0x1031d8);_0x3d2bcd(ut[_0x9398('0x38')](_0x9398('0x5b')));});});};Fax['prototype'][_0x9398('0x5c')]=function(_0x553339){var _0x2ff40e=this;return new BPromise(function(_0x1600d6,_0x8459bf){var _0x4829d5=_0x2ff40e['checkTrunk'](_0x2ff40e['faxAccounts'][_0x553339['FaxAccountId']][_0x9398('0x5d')],_0x553339);if(_0x4829d5[_0x9398('0x5e')]){_0x1600d6(ut[_0x9398('0x38')](_0x9398('0x5f')));}else{_0x8459bf(ut[_0x9398('0x38')](_0x4829d5['message']));}});};function originate(_0x4a9f70,_0x384f9b,_0x3e8d43){return new BPromise(function(_0x2968a8,_0x53ff76){if(_0x3e8d43){var _0xd96992=util[_0x9398('0x60')](_0x9398('0x61'),path[_0x9398('0x3a')](_0x4a9f70[_0x9398('0x3')])[_0x9398('0x24')],_0x4a9f70[_0x9398('0x3')]);gs[_0x9398('0x62')](_0xd96992)[_0x9398('0x3c')](function(){_0x4a9f70[_0x9398('0x3')]=util['format'](_0x9398('0x63'),path[_0x9398('0x3a')](_0x4a9f70['path'])[_0x9398('0x64')],path[_0x9398('0x3a')](_0x4a9f70[_0x9398('0x3')])['name']);_0x384f9b[_0x9398('0x65')]=_0x4a9f70['path'];ut[_0x9398('0x4b')](_0x9398('0x66'),'');ami['Action'](ut['variablesAction'](_0x4a9f70,_0x384f9b))['then'](function(_0x299de5){_0x2968a8(_0x299de5);})[_0x9398('0x3f')](function(_0x2be253){_0x53ff76(_0x2be253);});})[_0x9398('0x3f')](function(_0x5c4cee){_0x53ff76(_0x5c4cee);});}else{ami[_0x9398('0x67')](ut[_0x9398('0x68')](_0x4a9f70,_0x384f9b))[_0x9398('0x3c')](function(_0x10ce65){_0x2968a8(_0x10ce65);})[_0x9398('0x3f')](function(_0x25540f){_0x53ff76(_0x25540f);});}});}Fax['prototype']['execOriginate']=function(_0x5cbfc6,_0x4254d0){var _0x5de3a3=this;return new BPromise(function(_0x53fd60,_0x147b83){var _0x30130c=uuid['v4']();var _0x24f41b=ut['addVariables'](_0x5cbfc6,_0x4254d0);_0x5de3a3['actions'][_0x30130c]=new Action(_0x30130c,_0x4254d0,_0x5cbfc6);var _0x3a74f8=_0x5de3a3[_0x9398('0x26')][_0x30130c];if(path[_0x9398('0x3a')](_0x5cbfc6[_0x9398('0x3')])[_0x9398('0x69')]===_0x9398('0x3e')){originate(_0x3a74f8,_0x24f41b,!![])[_0x9398('0x3c')](function(_0x56369a){_0x53fd60(_0x56369a);})[_0x9398('0x3f')](function(_0x488d59){_0x147b83(_0x488d59);});}else{originate(_0x3a74f8,_0x24f41b,![])[_0x9398('0x3c')](function(_0x56cbb0){_0x53fd60(_0x56cbb0);})[_0x9398('0x3f')](function(_0x47bfb9){_0x147b83(_0x47bfb9);});}});};Fax['prototype'][_0x9398('0x6a')]=function(_0x21c94e){return!_[_0x9398('0x6b')](_0x21c94e)&&!_[_0x9398('0x6b')](_0x21c94e[_0x9398('0x24')])&&!_['isNil'](_0x21c94e[_0x9398('0x6c')])&&_0x21c94e[_0x9398('0x6c')]&&!_[_0x9398('0x6b')](this['trunks'][util[_0x9398('0x60')](_0x9398('0x6d'),_0x21c94e[_0x9398('0x24')])])&&!_['isNil'](this[_0x9398('0xe')][util[_0x9398('0x60')](_0x9398('0x6d'),_0x21c94e[_0x9398('0x24')])][_0x9398('0x2e')])&&(this['trunks'][util['format'](_0x9398('0x6d'),_0x21c94e['name'])][_0x9398('0x2e')]===_0x9398('0x6e')||this['trunks'][util[_0x9398('0x60')](_0x9398('0x6d'),_0x21c94e[_0x9398('0x24')])][_0x9398('0x2e')]===_0x9398('0x6f'));};Fax[_0x9398('0x1b')][_0x9398('0x70')]=function(_0x2a35b8,_0x12e351){if(!this[_0x9398('0x6a')](_0x2a35b8)){ut[_0x9398('0x4b')](_0x9398('0x71'),_['isNil'](_0x2a35b8)?'':_0x2a35b8[_0x9398('0x24')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x9398('0x72')};}if(_[_0x9398('0x6b')](_0x12e351['fax'])){ut['logger'](_0x9398('0x73'),JSON[_0x9398('0x42')](_0x12e351));return{'isValid':![],'message':_0x9398('0x74')};}if(_['isNil'](_0x12e351['path'])){ut[_0x9398('0x4b')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x12e351));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x9398('0x75')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index de6a1cf..fc4a063 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 _0x9224=['../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20'];(function(_0x469852,_0x532e8c){var _0xa844b9=function(_0x511046){while(--_0x511046){_0x469852['push'](_0x469852['shift']());}};_0xa844b9(++_0x532e8c);}(_0x9224,0x11e));var _0x4922=function(_0x295f92,_0x5e9fb2){_0x295f92=_0x295f92-0x0;var _0x38c56f=_0x9224[_0x295f92];return _0x38c56f;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x4922('0x0'))(_0x4922('0x1'));var _=require(_0x4922('0x2'));var faxAccount=require(_0x4922('0x3'));function loggerCatch(_0x2d6602){return function(_0x4ebaf3){logger[_0x4922('0x4')](_0x2d6602,util[_0x4922('0x5')](_0x4ebaf3,{'showHidden':![],'depth':null}));};}exports[_0x4922('0x6')]=function(_0x25f8b6,_0x5de1e4){return BPromise[_0x4922('0x7')]()[_0x4922('0x8')](faxAccount['notify'](_0x25f8b6,_0x5de1e4))[_0x4922('0x9')](loggerCatch(_0x4922('0xa')));}; \ No newline at end of file +var _0xa5d8=['[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','error','inspect','notify','resolve','catch'];(function(_0x588146,_0x32e8c4){var _0x5e19ac=function(_0x2f92d5){while(--_0x2f92d5){_0x588146['push'](_0x588146['shift']());}};_0x5e19ac(++_0x32e8c4);}(_0xa5d8,0xd2));var _0x8a5d=function(_0x3c4ad5,_0x5737eb){_0x3c4ad5=_0x3c4ad5-0x0;var _0x4c564d=_0xa5d8[_0x3c4ad5];return _0x4c564d;};'use strict';var util=require(_0x8a5d('0x0'));var BPromise=require(_0x8a5d('0x1'));var logger=require(_0x8a5d('0x2'))(_0x8a5d('0x3'));var _=require(_0x8a5d('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x59ccb3){return function(_0xfd6316){logger[_0x8a5d('0x5')](_0x59ccb3,util[_0x8a5d('0x6')](_0xfd6316,{'showHidden':![],'depth':null}));};}exports[_0x8a5d('0x7')]=function(_0x3a7270,_0x2ce035){return BPromise[_0x8a5d('0x8')]()['then'](faxAccount[_0x8a5d('0x7')](_0x3a7270,_0x2ce035))[_0x8a5d('0x9')](loggerCatch(_0x8a5d('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 210f956..e56a806 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 _0xb650=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird'];(function(_0x4061e0,_0x40f378){var _0x1a5ef2=function(_0x25e09a){while(--_0x25e09a){_0x4061e0['push'](_0x4061e0['shift']());}};_0x1a5ef2(++_0x40f378);}(_0xb650,0xc2));var _0x0b65=function(_0x17bb0c,_0x1e4f75){_0x17bb0c=_0x17bb0c-0x0;var _0x2beb45=_0xb650[_0x17bb0c];return _0x2beb45;};'use strict';var util=require(_0x0b65('0x0'));var logger=require(_0x0b65('0x1'))(_0x0b65('0x2'));var BPromise=require(_0x0b65('0x3'));var exec=require(_0x0b65('0x4'))[_0x0b65('0x5')];exports[_0x0b65('0x6')]=function(_0x441f53){return new BPromise(function(_0x5c624d,_0x2d6366){exec(_0x441f53,function(_0x4af9e0,_0xf46ac8,_0x5ad669){logger[_0x0b65('0x7')]('Exec\x20gs',_0xf46ac8);if(_0x4af9e0){logger[_0x0b65('0x7')](_0x0b65('0x8'),_0x0b65('0x9'),util[_0x0b65('0xa')](_0x4af9e0,{'showHidden':![],'depth':null}),_0xf46ac8,_0x5ad669);_0x2d6366(_0x4af9e0);}_0x5c624d(_0xf46ac8);});});}; \ No newline at end of file +var _0x329c=['\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs'];(function(_0x326c90,_0x143586){var _0x553370=function(_0xaedd29){while(--_0xaedd29){_0x326c90['push'](_0x326c90['shift']());}};_0x553370(++_0x143586);}(_0x329c,0x91));var _0xc329=function(_0x4854d6,_0x2f1264){_0x4854d6=_0x4854d6-0x0;var _0x3885c0=_0x329c[_0x4854d6];return _0x3885c0;};'use strict';var util=require(_0xc329('0x0'));var logger=require(_0xc329('0x1'))(_0xc329('0x2'));var BPromise=require(_0xc329('0x3'));var exec=require(_0xc329('0x4'))[_0xc329('0x5')];exports[_0xc329('0x6')]=function(_0x1982db){return new BPromise(function(_0xc077db,_0x2365d4){exec(_0x1982db,function(_0x567169,_0x169526,_0x1f750c){logger[_0xc329('0x7')]('Exec\x20gs',_0x169526);if(_0x567169){logger[_0xc329('0x7')](_0xc329('0x8'),_0xc329('0x9'),util[_0xc329('0xa')](_0x567169,{'showHidden':![],'depth':null}),_0x169526,_0x1f750c);_0x2365d4(_0x567169);}_0xc077db(_0x169526);});});}; \ 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 7328db9..0e0cd31 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 _0x68fc=['from-sip','\x22%s\x22\x20<%s>','localstationid','util','lodash','moment','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x68fc,0xa5));var _0xc68f=function(_0x3e08e3,_0x282c0a){_0x3e08e3=_0x3e08e3-0x0;var _0x3ed43a=_0x68fc[_0x3e08e3];return _0x3ed43a;};'use strict';var util=require(_0xc68f('0x0'));var _=require(_0xc68f('0x1'));var moment=require(_0xc68f('0x2'));var logger=require('../../../../config/logger')('fax');exports[_0xc68f('0x3')]=function(_0x506fb5){return{'message':_0x506fb5};};exports[_0xc68f('0x4')]=function(_0x593648,_0x5899ea){logger[_0xc68f('0x5')](_0x593648,util[_0xc68f('0x6')](_0x5899ea,{'showHidden':![],'depth':null}));};exports[_0xc68f('0x7')]=function(_0x363cdf,_0x4fcce4){var _0x4a6f7d={'XMF-ECM':_0x4fcce4[_0xc68f('0x8')],'XMF-HEADERINFO':_0x4fcce4[_0xc68f('0x9')],'XMF-MINRATE':_0x4fcce4[_0xc68f('0xa')],'XMF-MAXRATE':_0x4fcce4[_0xc68f('0xb')],'XMF-MODEM':util[_0xc68f('0xc')](_0xc68f('0xd'),_0x4fcce4[_0xc68f('0xe')]),'XMF-GATEWAY':_0x4fcce4[_0xc68f('0xf')],'XMF-FAXDETECT':_0x4fcce4[_0xc68f('0x10')],'XMF-T38TIMEOUT':_0x4fcce4[_0xc68f('0x11')],'XMF-LOCALSTATIONID':_0x4fcce4['localstationid'],'XMF-PATH':_0x363cdf[_0xc68f('0x12')]};return _0x4a6f7d;};exports[_0xc68f('0x13')]=function(_0x1f2758,_0x1d4ae4){return{'actionid':_0x1f2758[_0xc68f('0x14')],'action':_0xc68f('0x15'),'channel':_0x1f2758[_0xc68f('0x16')],'Exten':_0xc68f('0x17'),'Context':_0xc68f('0x18'),'Priority':'1','callerid':util[_0xc68f('0xc')](_0xc68f('0x19'),_0x1f2758['headerinfo']?_0x1f2758[_0xc68f('0x9')]:'',_0x1f2758[_0xc68f('0x1a')]),'variable':_0x1d4ae4,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1f2758[_0xc68f('0x14')]};}; \ No newline at end of file +var _0x6c76=['fax','message','inspect','addVariables','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','util','lodash','moment'];(function(_0x5b30b5,_0x2b146e){var _0x3db40f=function(_0x2188b0){while(--_0x2188b0){_0x5b30b5['push'](_0x5b30b5['shift']());}};_0x3db40f(++_0x2b146e);}(_0x6c76,0x184));var _0x66c7=function(_0x568f30,_0x1a3c1a){_0x568f30=_0x568f30-0x0;var _0x162baf=_0x6c76[_0x568f30];return _0x162baf;};'use strict';var util=require(_0x66c7('0x0'));var _=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var logger=require('../../../../config/logger')(_0x66c7('0x3'));exports[_0x66c7('0x4')]=function(_0x519756){return{'message':_0x519756};};exports['logger']=function(_0x2f6db7,_0x2b7cf3){logger['info'](_0x2f6db7,util[_0x66c7('0x5')](_0x2b7cf3,{'showHidden':![],'depth':null}));};exports[_0x66c7('0x6')]=function(_0x52f71b,_0x23408c){var _0x4dffcd={'XMF-ECM':_0x23408c['ecm'],'XMF-HEADERINFO':_0x23408c[_0x66c7('0x7')],'XMF-MINRATE':_0x23408c[_0x66c7('0x8')],'XMF-MAXRATE':_0x23408c[_0x66c7('0x9')],'XMF-MODEM':util['format'](_0x66c7('0xa'),_0x23408c[_0x66c7('0xb')]),'XMF-GATEWAY':_0x23408c[_0x66c7('0xc')],'XMF-FAXDETECT':_0x23408c[_0x66c7('0xd')],'XMF-T38TIMEOUT':_0x23408c['t38timeout'],'XMF-LOCALSTATIONID':_0x23408c[_0x66c7('0xe')],'XMF-PATH':_0x52f71b[_0x66c7('0xf')]};return _0x4dffcd;};exports[_0x66c7('0x10')]=function(_0x187e00,_0x21fb64){return{'actionid':_0x187e00[_0x66c7('0x11')],'action':_0x66c7('0x12'),'channel':_0x187e00['channel'],'Exten':_0x66c7('0x13'),'Context':_0x66c7('0x14'),'Priority':'1','callerid':util[_0x66c7('0x15')](_0x66c7('0x16'),_0x187e00[_0x66c7('0x7')]?_0x187e00[_0x66c7('0x7')]:'',_0x187e00[_0x66c7('0xe')]),'variable':_0x21fb64,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x187e00[_0x66c7('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index ce55cf8..2757361 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 _0xf3e0=['initServicenowAccounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','log','bluebird','util','moment','./server','./realtime','./report','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','get','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initTriggers','initZendeskAccounts','getSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts'];(function(_0x2b8325,_0x527c7a){var _0x3019d3=function(_0x18982b){while(--_0x18982b){_0x2b8325['push'](_0x2b8325['shift']());}};_0x3019d3(++_0x527c7a);}(_0xf3e0,0x131));var _0x0f3e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xf3e0[_0x5d6456];return _0x4d66c1;};'use strict';var BPromise=require(_0x0f3e('0x0'));var util=require(_0x0f3e('0x1'));var moment=require(_0x0f3e('0x2'));var server=require(_0x0f3e('0x3'));var Realtime=require(_0x0f3e('0x4'));var Report=require(_0x0f3e('0x5'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x0f3e('0x6'));var Preview=require(_0x0f3e('0x7'));var Fax=require(_0x0f3e('0x8'));var user=require(_0x0f3e('0x9'));var voiceQueue=require(_0x0f3e('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x0f3e('0xb'));var trunk=require('./rpc/trunk');var trigger=require(_0x0f3e('0xc'));var template=require(_0x0f3e('0xd'));var cmHopperHistory=require(_0x0f3e('0xe'));var campaign=require(_0x0f3e('0xf'));var voiceExtension=require(_0x0f3e('0x10'));var faxAccount=require(_0x0f3e('0x11'));var zendesk=require(_0x0f3e('0x12'));var salesforce=require(_0x0f3e('0x13'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x0f3e('0x14'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x0f3e('0x15'));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()[_0x0f3e('0x16')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0f3e('0x16')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0f3e('0x17')]()[_0x0f3e('0x18')](user[_0x0f3e('0x19')]())['then'](realtime[_0x0f3e('0x1a')]())[_0x0f3e('0x18')](user[_0x0f3e('0x1b')]())[_0x0f3e('0x18')](realtime[_0x0f3e('0x1c')]())[_0x0f3e('0x18')](trunk[_0x0f3e('0x1d')]())[_0x0f3e('0x18')](realtime[_0x0f3e('0x1e')]())['then'](voiceQueue[_0x0f3e('0x1f')]())['then'](realtime['initVoiceQueues']())[_0x0f3e('0x18')](trigger['getTriggers']())['then'](realtime[_0x0f3e('0x20')]())[_0x0f3e('0x18')](template['getTemplates']())[_0x0f3e('0x18')](realtime['initTemplates']())[_0x0f3e('0x18')](zendesk['getZendeskAccounts']())['then'](realtime[_0x0f3e('0x21')]())['then'](salesforce[_0x0f3e('0x22')]())['then'](realtime['initSalesforceAccounts']())[_0x0f3e('0x18')](sugarcrm['getSugarcrmAccounts']())['then'](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x0f3e('0x23')]())[_0x0f3e('0x18')](realtime[_0x0f3e('0x24')]())[_0x0f3e('0x18')](desk[_0x0f3e('0x25')]())[_0x0f3e('0x18')](realtime[_0x0f3e('0x26')]())['then'](zoho['getZohoAccounts']())[_0x0f3e('0x18')](realtime[_0x0f3e('0x27')]())['then'](vtiger[_0x0f3e('0x28')]())[_0x0f3e('0x18')](realtime['initVtigerAccounts']())[_0x0f3e('0x18')](freshsales[_0x0f3e('0x29')]())[_0x0f3e('0x18')](realtime['initFreshsalesAccounts']())[_0x0f3e('0x18')](servicenow[_0x0f3e('0x2a')]())[_0x0f3e('0x18')](realtime[_0x0f3e('0x2b')]())['then'](dynamics365['getDynamics365Accounts']())[_0x0f3e('0x18')](realtime['initDynamics365Accounts']())[_0x0f3e('0x18')](campaign[_0x0f3e('0x2c')]())['then'](realtime[_0x0f3e('0x2d')]())['then'](voiceExtension[_0x0f3e('0x2e')]())['then'](realtime[_0x0f3e('0x2f')]())['then'](faxAccount[_0x0f3e('0x30')]())['then'](realtime['initFaxAccounts']())[_0x0f3e('0x18')](function(){return realtime;});}function initParams(){return BPromise[_0x0f3e('0x17')]()[_0x0f3e('0x18')](voiceQueueReport[_0x0f3e('0x31')]())[_0x0f3e('0x18')](realtime[_0x0f3e('0x32')]())[_0x0f3e('0x18')](cmHopperHistory[_0x0f3e('0x33')]())['then'](realtime[_0x0f3e('0x34')]())[_0x0f3e('0x18')](cmHopperHistory[_0x0f3e('0x35')]())[_0x0f3e('0x18')](realtime[_0x0f3e('0x36')]())[_0x0f3e('0x18')](voiceCallReport[_0x0f3e('0x37')]())[_0x0f3e('0x18')](realtime['initVoiceCallReports']())[_0x0f3e('0x18')](function(_0x5f482d){})[_0x0f3e('0x38')](function(_0x4b3040){console[_0x0f3e('0x39')](_0x4b3040);});}function main(){return server['listen'](realtime,preview,fax)[_0x0f3e('0x18')](function(_0x5d14c2){return initRealtime();})[_0x0f3e('0x18')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x42e5cf){console['log'](_0x42e5cf);});}main(); \ No newline at end of file +var _0x2c1b=['initCampaignHopperHistory','initVoiceCallReports','catch','listen','sync','log','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initTriggers','getTemplates','initTemplates','initZendeskAccounts','initSalesforceAccounts','initSugarcrmAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c1b,0xcf));var _0xb2c1=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x2c1b[_0x5cb1af];return _0x8d7940;};'use strict';var BPromise=require(_0xb2c1('0x0'));var util=require(_0xb2c1('0x1'));var moment=require(_0xb2c1('0x2'));var server=require(_0xb2c1('0x3'));var Realtime=require(_0xb2c1('0x4'));var Report=require(_0xb2c1('0x5'));var Acw=require(_0xb2c1('0x6'));var Trigger=require(_0xb2c1('0x7'));var Dialer=require(_0xb2c1('0x8'));var Preview=require(_0xb2c1('0x9'));var Fax=require(_0xb2c1('0xa'));var user=require(_0xb2c1('0xb'));var voiceQueue=require(_0xb2c1('0xc'));var voiceQueueReport=require(_0xb2c1('0xd'));var voiceCallReport=require(_0xb2c1('0xe'));var trunk=require(_0xb2c1('0xf'));var trigger=require(_0xb2c1('0x10'));var template=require(_0xb2c1('0x11'));var cmHopperHistory=require(_0xb2c1('0x12'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xb2c1('0x13'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xb2c1('0x14'));var salesforce=require(_0xb2c1('0x15'));var sugarcrm=require(_0xb2c1('0x16'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xb2c1('0x17'));var zoho=require(_0xb2c1('0x18'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xb2c1('0x19'));var servicenow=require(_0xb2c1('0x1a'));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()[_0xb2c1('0x1b')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xb2c1('0x1b')](_0xb2c1('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xb2c1('0x1d')]()[_0xb2c1('0x1e')](user[_0xb2c1('0x1f')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x20')]())[_0xb2c1('0x1e')](user[_0xb2c1('0x21')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x22')]())[_0xb2c1('0x1e')](trunk[_0xb2c1('0x23')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x24')]())[_0xb2c1('0x1e')](voiceQueue[_0xb2c1('0x25')]())[_0xb2c1('0x1e')](realtime['initVoiceQueues']())['then'](trigger['getTriggers']())['then'](realtime[_0xb2c1('0x26')]())['then'](template[_0xb2c1('0x27')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x28')]())[_0xb2c1('0x1e')](zendesk['getZendeskAccounts']())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x29')]())[_0xb2c1('0x1e')](salesforce['getSalesforceAccounts']())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x2a')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x2b')]())['then'](freshdesk['getFreshdeskAccounts']())[_0xb2c1('0x1e')](realtime['initFreshdeskAccounts']())[_0xb2c1('0x1e')](desk[_0xb2c1('0x2c')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x2d')]())[_0xb2c1('0x1e')](zoho[_0xb2c1('0x2e')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x2f')]())[_0xb2c1('0x1e')](vtiger[_0xb2c1('0x30')]())[_0xb2c1('0x1e')](realtime['initVtigerAccounts']())[_0xb2c1('0x1e')](freshsales['getFreshsalesAccounts']())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x31')]())[_0xb2c1('0x1e')](servicenow[_0xb2c1('0x32')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x33')]())[_0xb2c1('0x1e')](dynamics365['getDynamics365Accounts']())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x34')]())['then'](campaign[_0xb2c1('0x35')]())['then'](realtime['initCampaigns']())[_0xb2c1('0x1e')](voiceExtension[_0xb2c1('0x36')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x37')]())['then'](faxAccount['getFaxAccounts']())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x38')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xb2c1('0x1d')]()[_0xb2c1('0x1e')](voiceQueueReport[_0xb2c1('0x39')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x3a')]())[_0xb2c1('0x1e')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x3b')]())['then'](cmHopperHistory[_0xb2c1('0x3c')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x3d')]())[_0xb2c1('0x1e')](voiceCallReport['getVoiceCallReports']())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x3e')]())[_0xb2c1('0x1e')](function(_0x100210){})[_0xb2c1('0x3f')](function(_0x359118){console['log'](_0x359118);});}function main(){return server[_0xb2c1('0x40')](realtime,preview,fax)['then'](function(_0xbc04d6){return initRealtime();})[_0xb2c1('0x1e')](function(){return initParams();})[_0xb2c1('0x1e')](function(){report[_0xb2c1('0x41')]();setInterval(initRealtime,0x1388);})[_0xb2c1('0x3f')](function(_0x26964e){console[_0xb2c1('0x42')](_0x26964e);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 610e5c1..a35a646 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 _0x86d8=['local','md5','updateStatusRealtime','toLowerCase','idle','inuse','statePause','voiceStatusTime','format','stateTime','user:%s','emit','user:save','exports','lodash','util','../../../config/environment','redis','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown','address','phone','interface','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','onhold'];(function(_0x16b13d,_0x2faf09){var _0x1f1e77=function(_0x2c4d2a){while(--_0x2c4d2a){_0x16b13d['push'](_0x16b13d['shift']());}};_0x1f1e77(++_0x2faf09);}(_0x86d8,0xb8));var _0x886d=function(_0x3def41,_0x16bccf){_0x3def41=_0x3def41-0x0;var _0x391741=_0x86d8[_0x3def41];return _0x391741;};'use strict';var _=require(_0x886d('0x0'));var util=require(_0x886d('0x1'));var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x886d('0x2'));config[_0x886d('0x3')]=_['defaults'](config[_0x886d('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x886d('0x4'))(new Redis(config[_0x886d('0x3')]));function Agent(_0x22b950){this['id']=_0x22b950['id']||0x0;this[_0x886d('0x5')]=_0x22b950[_0x886d('0x5')]||'';this['email']=_0x22b950[_0x886d('0x6')]||'';this[_0x886d('0x7')]=_0x22b950[_0x886d('0x7')]||'';this[_0x886d('0x8')]=_0x22b950[_0x886d('0x8')]||'';this[_0x886d('0x9')]='unknown';this['stateTime']=0x0;this[_0x886d('0xa')]=_0x886d('0xb');this[_0x886d('0xc')]='';this[_0x886d('0xd')]='';this['mobile']='';this[_0x886d('0xe')]='';this[_0x886d('0xf')]=_0x22b950[_0x886d('0xf')]||![];this[_0x886d('0x10')]=_0x886d('0xb');this['voiceStatusTime']=0x0;this[_0x886d('0x11')]='';this[_0x886d('0x12')]='';this[_0x886d('0x13')]=![];this[_0x886d('0x14')]=![];this[_0x886d('0x15')]='';}Agent['prototype'][_0x886d('0x16')]=function(_0x34a8ee){var _0x57447f;if(_0x34a8ee&&_0x34a8ee[_0x886d('0x9')]){_0x57447f=_0x34a8ee['state'][_0x886d('0x17')]();switch(_0x57447f){case'not_inuse':_0x57447f=_0x886d('0x18');break;case _0x886d('0x19'):_0x57447f='talking';break;}}if(_0x57447f&&this[_0x886d('0x10')]!==_0x57447f||_0x34a8ee[_0x886d('0x1a')]){this[_0x886d('0x1b')]=_['toNumber'](moment()[_0x886d('0x1c')]('x'));}if(_0x57447f){this[_0x886d('0x10')]=_0x57447f;}var _0x5c7f44={'id':this['id'],'name':this[_0x886d('0x5')],'email':this[_0x886d('0x6')],'accountcode':this['accountcode'],'fullname':this[_0x886d('0x8')],'state':this[_0x886d('0x9')],'stateTime':this[_0x886d('0x1d')],'status':this[_0x886d('0xa')],'address':this[_0x886d('0xc')],'online':this[_0x886d('0xf')],'voiceStatus':this[_0x886d('0x10')],'voiceStatusTime':this[_0x886d('0x1b')],'voiceStatusCallerIdNumber':this[_0x886d('0x11')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x886d('0xe')],'onhold':this[_0x886d('0x13')]};var _0x2d10e3=md5(JSON['stringify'](_0x5c7f44));if(this[_0x886d('0x15')]!==_0x2d10e3){this[_0x886d('0x15')]=_0x2d10e3;io['to'](util['format'](_0x886d('0x1e'),_0x5c7f44[_0x886d('0x5')]))[_0x886d('0x1f')](_0x886d('0x20'),_0x5c7f44);}};module[_0x886d('0x21')]=Agent; \ No newline at end of file +var _0x055b=['voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','toLowerCase','not_inuse','inuse','talking','statePause','toNumber','voiceStatusCallerIdNumber','interface','stringify','format','emit','user:save','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','online'];(function(_0x374a51,_0x5ec767){var _0x354ee9=function(_0x4183e9){while(--_0x4183e9){_0x374a51['push'](_0x374a51['shift']());}};_0x354ee9(++_0x5ec767);}(_0x055b,0x152));var _0xb055=function(_0x5436d4,_0xd522ce){_0x5436d4=_0x5436d4-0x0;var _0xf402d4=_0x055b[_0x5436d4];return _0xf402d4;};'use strict';var _=require(_0xb055('0x0'));var util=require(_0xb055('0x1'));var moment=require(_0xb055('0x2'));var md5=require(_0xb055('0x3'));var Redis=require(_0xb055('0x4'));var config=require(_0xb055('0x5'));config[_0xb055('0x6')]=_[_0xb055('0x7')](config[_0xb055('0x6')],{'host':_0xb055('0x8'),'port':0x18eb});var io=require(_0xb055('0x9'))(new Redis(config[_0xb055('0x6')]));function Agent(_0x390104){this['id']=_0x390104['id']||0x0;this[_0xb055('0xa')]=_0x390104[_0xb055('0xa')]||'';this[_0xb055('0xb')]=_0x390104[_0xb055('0xb')]||'';this[_0xb055('0xc')]=_0x390104[_0xb055('0xc')]||'';this['fullname']=_0x390104[_0xb055('0xd')]||'';this[_0xb055('0xe')]=_0xb055('0xf');this[_0xb055('0x10')]=0x0;this[_0xb055('0x11')]=_0xb055('0xf');this[_0xb055('0x12')]='';this[_0xb055('0x13')]='';this[_0xb055('0x14')]='';this['interface']='';this[_0xb055('0x15')]=_0x390104[_0xb055('0x15')]||![];this[_0xb055('0x16')]=_0xb055('0xf');this[_0xb055('0x17')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xb055('0x18')]='';this[_0xb055('0x19')]=![];this[_0xb055('0x1a')]=![];this[_0xb055('0x3')]='';}Agent['prototype']['updateStatusRealtime']=function(_0x5950b2){var _0x57fa61;if(_0x5950b2&&_0x5950b2[_0xb055('0xe')]){_0x57fa61=_0x5950b2[_0xb055('0xe')][_0xb055('0x1b')]();switch(_0x57fa61){case _0xb055('0x1c'):_0x57fa61='idle';break;case _0xb055('0x1d'):_0x57fa61=_0xb055('0x1e');break;}}if(_0x57fa61&&this[_0xb055('0x16')]!==_0x57fa61||_0x5950b2[_0xb055('0x1f')]){this['voiceStatusTime']=_[_0xb055('0x20')](moment()['format']('x'));}if(_0x57fa61){this[_0xb055('0x16')]=_0x57fa61;}var _0x17d69f={'id':this['id'],'name':this[_0xb055('0xa')],'email':this[_0xb055('0xb')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0xb055('0xe')],'stateTime':this[_0xb055('0x10')],'status':this[_0xb055('0x11')],'address':this[_0xb055('0x12')],'online':this[_0xb055('0x15')],'voiceStatus':this[_0xb055('0x16')],'voiceStatusTime':this[_0xb055('0x17')],'voiceStatusCallerIdNumber':this[_0xb055('0x21')],'voiceStatusQueue':this[_0xb055('0x18')],'interface':this[_0xb055('0x22')],'onhold':this[_0xb055('0x19')]};var _0x3c0a18=md5(JSON[_0xb055('0x23')](_0x17d69f));if(this[_0xb055('0x3')]!==_0x3c0a18){this[_0xb055('0x3')]=_0x3c0a18;io['to'](util[_0xb055('0x24')]('user:%s',_0x17d69f[_0xb055('0xa')]))[_0xb055('0x25')](_0xb055('0x26'),_0x17d69f);}};module[_0xb055('0x27')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index a7d6ccb..6f4c53b 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 _0xab04=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength'];(function(_0x33c82f,_0x44f7a3){var _0x1f1425=function(_0x168bb6){while(--_0x168bb6){_0x33c82f['push'](_0x33c82f['shift']());}};_0x1f1425(++_0x44f7a3);}(_0xab04,0x194));var _0x4ab0=function(_0xef1e4c,_0x5cb9ae){_0xef1e4c=_0xef1e4c-0x0;var _0x203904=_0xab04[_0xef1e4c];return _0x203904;};'use strict';function Campaign(_0x3bf5b9){this['id']=_0x3bf5b9['id']||0x0;this[_0x4ab0('0x0')]=_0x3bf5b9[_0x4ab0('0x0')]||'';this[_0x4ab0('0x1')]=_0x3bf5b9[_0x4ab0('0x1')]||_0x4ab0('0x2');this[_0x4ab0('0x3')]=0x0;this[_0x4ab0('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x4ab0('0x5')]=0x0;this['message']='';this[_0x4ab0('0x6')]=!![];this['active']=_0x3bf5b9[_0x4ab0('0x7')];this[_0x4ab0('0x8')]=_0x3bf5b9[_0x4ab0('0x8')];this[_0x4ab0('0x9')]=_0x3bf5b9['dialTimezone']||null;this[_0x4ab0('0xa')]=_0x3bf5b9[_0x4ab0('0xa')]?_0x3bf5b9['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x3bf5b9[_0x4ab0('0xb')];this[_0x4ab0('0xc')]=_0x3bf5b9['dialOriginateCallerIdNumber'];this[_0x4ab0('0xd')]=_0x3bf5b9[_0x4ab0('0xd')]||0x1e;this[_0x4ab0('0xe')]=_0x3bf5b9[_0x4ab0('0xe')];this[_0x4ab0('0xf')]=_0x3bf5b9[_0x4ab0('0xf')];this['dialBusyMaxRetry']=_0x3bf5b9[_0x4ab0('0x10')];this[_0x4ab0('0x11')]=_0x3bf5b9[_0x4ab0('0x11')];this[_0x4ab0('0x12')]=_0x3bf5b9['dialNoAnswerMaxRetry'];this[_0x4ab0('0x13')]=_0x3bf5b9[_0x4ab0('0x13')];this[_0x4ab0('0x14')]=_0x3bf5b9[_0x4ab0('0x14')];this[_0x4ab0('0x15')]=_0x3bf5b9[_0x4ab0('0x15')]||0x3;this[_0x4ab0('0x16')]=_0x3bf5b9[_0x4ab0('0x16')]||0x96;this[_0x4ab0('0x17')]=_0x3bf5b9['dialDropMaxRetry']||0x3;this[_0x4ab0('0x18')]=_0x3bf5b9['dialDropRetryFrequency']||0x96;this[_0x4ab0('0x19')]=_0x3bf5b9['dialAbandonedMaxRetry']||0x3;this[_0x4ab0('0x1a')]=_0x3bf5b9['dialAbandonedRetryFrequency']||0x96;this[_0x4ab0('0x1b')]=_0x3bf5b9[_0x4ab0('0x1b')]||0x3;this[_0x4ab0('0x1c')]=_0x3bf5b9[_0x4ab0('0x1c')]||0x96;this[_0x4ab0('0x1d')]=_0x3bf5b9[_0x4ab0('0x1d')]||0x3;this[_0x4ab0('0x1e')]=_0x3bf5b9[_0x4ab0('0x1e')]||0x96;this[_0x4ab0('0x1f')]=_0x3bf5b9[_0x4ab0('0x1f')]||'DESC';this[_0x4ab0('0x20')]=_0x3bf5b9[_0x4ab0('0x20')]||undefined;this[_0x4ab0('0x21')]=_0x3bf5b9[_0x4ab0('0x21')]||undefined;this[_0x4ab0('0x22')]=_0x3bf5b9[_0x4ab0('0x22')]||undefined;this[_0x4ab0('0x23')]=_0x3bf5b9[_0x4ab0('0x23')]?_0x3bf5b9['TrunkBackup']:undefined;this[_0x4ab0('0x24')]=_0x3bf5b9[_0x4ab0('0x24')]?_0x3bf5b9[_0x4ab0('0x24')]:undefined;this[_0x4ab0('0x25')]=_0x3bf5b9[_0x4ab0('0x25')]?_0x3bf5b9['Interval']:undefined;this[_0x4ab0('0x26')]=_0x3bf5b9[_0x4ab0('0x26')]?_0x3bf5b9['SquareProject']:undefined;this[_0x4ab0('0x27')]=_0x3bf5b9['SquareProject']?_0x3bf5b9[_0x4ab0('0x26')][_0x4ab0('0x0')]:undefined;this[_0x4ab0('0x28')]=_0x3bf5b9[_0x4ab0('0x28')]||![];this[_0x4ab0('0x29')]=_0x3bf5b9['dialAMDInitialSilence'];this[_0x4ab0('0x2a')]=_0x3bf5b9[_0x4ab0('0x2a')];this[_0x4ab0('0x2b')]=_0x3bf5b9[_0x4ab0('0x2b')];this[_0x4ab0('0x2c')]=_0x3bf5b9[_0x4ab0('0x2c')];this['dialAMDMinWordLength']=_0x3bf5b9[_0x4ab0('0x2d')];this[_0x4ab0('0x2e')]=_0x3bf5b9[_0x4ab0('0x2e')];this[_0x4ab0('0x2f')]=_0x3bf5b9['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x3bf5b9[_0x4ab0('0x30')];this[_0x4ab0('0x31')]=_0x3bf5b9[_0x4ab0('0x31')];}module['exports']=Campaign; \ No newline at end of file +var _0x30d9=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x70bd25,_0xfef885){var _0x45ae64=function(_0x299802){while(--_0x299802){_0x70bd25['push'](_0x70bd25['shift']());}};_0x45ae64(++_0xfef885);}(_0x30d9,0xd7));var _0x930d=function(_0x5ea3ab,_0x2ff882){_0x5ea3ab=_0x5ea3ab-0x0;var _0x4d3a6f=_0x30d9[_0x5ea3ab];return _0x4d3a6f;};'use strict';function Campaign(_0x132fde){this['id']=_0x132fde['id']||0x0;this[_0x930d('0x0')]=_0x132fde['name']||'';this[_0x930d('0x1')]=_0x132fde['type']||'campaign';this[_0x930d('0x2')]=0x0;this[_0x930d('0x3')]=0x0;this[_0x930d('0x4')]=0x0;this[_0x930d('0x5')]=0x0;this[_0x930d('0x6')]='';this[_0x930d('0x7')]=!![];this['active']=_0x132fde[_0x930d('0x8')];this['limitCalls']=_0x132fde[_0x930d('0x9')];this[_0x930d('0xa')]=_0x132fde[_0x930d('0xa')]||null;this[_0x930d('0xb')]=_0x132fde[_0x930d('0xb')]?_0x132fde[_0x930d('0xb')]:null;this[_0x930d('0xc')]=_0x132fde[_0x930d('0xc')];this[_0x930d('0xd')]=_0x132fde['dialOriginateCallerIdNumber'];this[_0x930d('0xe')]=_0x132fde['dialOriginateTimeout']||0x1e;this[_0x930d('0xf')]=_0x132fde[_0x930d('0xf')];this[_0x930d('0x10')]=_0x132fde[_0x930d('0x10')];this['dialBusyMaxRetry']=_0x132fde[_0x930d('0x11')];this[_0x930d('0x12')]=_0x132fde[_0x930d('0x12')];this[_0x930d('0x13')]=_0x132fde[_0x930d('0x13')];this[_0x930d('0x14')]=_0x132fde[_0x930d('0x14')];this['dialGlobalMaxRetry']=_0x132fde[_0x930d('0x15')];this[_0x930d('0x16')]=_0x132fde[_0x930d('0x16')]||0x3;this[_0x930d('0x17')]=_0x132fde[_0x930d('0x17')]||0x96;this[_0x930d('0x18')]=_0x132fde[_0x930d('0x18')]||0x3;this[_0x930d('0x19')]=_0x132fde[_0x930d('0x19')]||0x96;this[_0x930d('0x1a')]=_0x132fde[_0x930d('0x1a')]||0x3;this['dialAbandonedRetryFrequency']=_0x132fde[_0x930d('0x1b')]||0x96;this[_0x930d('0x1c')]=_0x132fde[_0x930d('0x1c')]||0x3;this[_0x930d('0x1d')]=_0x132fde['dialMachineRetryFrequency']||0x96;this[_0x930d('0x1e')]=_0x132fde[_0x930d('0x1e')]||0x3;this[_0x930d('0x1f')]=_0x132fde[_0x930d('0x1f')]||0x96;this[_0x930d('0x20')]=_0x132fde[_0x930d('0x20')]||_0x930d('0x21');this[_0x930d('0x22')]=_0x132fde[_0x930d('0x22')]||undefined;this[_0x930d('0x23')]=_0x132fde[_0x930d('0x23')]||undefined;this[_0x930d('0x24')]=_0x132fde['dialCutDigit']||undefined;this[_0x930d('0x25')]=_0x132fde['TrunkBackup']?_0x132fde[_0x930d('0x25')]:undefined;this[_0x930d('0x26')]=_0x132fde[_0x930d('0x26')]?_0x132fde['Trunk']:undefined;this[_0x930d('0x27')]=_0x132fde[_0x930d('0x27')]?_0x132fde['Interval']:undefined;this[_0x930d('0x28')]=_0x132fde[_0x930d('0x28')]?_0x132fde['SquareProject']:undefined;this[_0x930d('0x29')]=_0x132fde[_0x930d('0x28')]?_0x132fde[_0x930d('0x28')][_0x930d('0x0')]:undefined;this['dialAMDActive']=_0x132fde[_0x930d('0x2a')]||![];this[_0x930d('0x2b')]=_0x132fde['dialAMDInitialSilence'];this[_0x930d('0x2c')]=_0x132fde[_0x930d('0x2c')];this[_0x930d('0x2d')]=_0x132fde[_0x930d('0x2d')];this['dialAMDTotalAnalysisTime']=_0x132fde[_0x930d('0x2e')];this[_0x930d('0x2f')]=_0x132fde['dialAMDMinWordLength'];this[_0x930d('0x30')]=_0x132fde[_0x930d('0x30')];this[_0x930d('0x31')]=_0x132fde['dialAMDMaximumNumberOfWords'];this[_0x930d('0x32')]=_0x132fde[_0x930d('0x32')];this[_0x930d('0x33')]=_0x132fde[_0x930d('0x33')];}module[_0x930d('0x34')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 4688839..ef26414 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 _0x3ce9=['starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned','billableseconds','type','disposition','monitorFilename','exports'];(function(_0x3b085,_0x250543){var _0x476a57=function(_0x480941){while(--_0x480941){_0x3b085['push'](_0x3b085['shift']());}};_0x476a57(++_0x250543);}(_0x3ce9,0x85));var _0x93ce=function(_0x212a7c,_0x26ef0d){_0x212a7c=_0x212a7c-0x0;var _0x1ab30f=_0x3ce9[_0x212a7c];return _0x1ab30f;};'use strict';function Channel(){this[_0x93ce('0x0')]=null;this['channel']='';this[_0x93ce('0x1')]='';this[_0x93ce('0x2')]=0x0;this[_0x93ce('0x3')]='';this[_0x93ce('0x4')]=undefined;this[_0x93ce('0x5')]=undefined;this[_0x93ce('0x6')]=0x0;this['context']='';this[_0x93ce('0x7')]=0x0;this[_0x93ce('0x8')]=0x0;this[_0x93ce('0x9')]=0x0;this[_0x93ce('0xa')]=![];this[_0x93ce('0xb')]=null;this['endtime']=null;this[_0x93ce('0xc')]=![];this[_0x93ce('0xd')]=![];this['lastapplication']='';this['lastdata']='';this['duration']=0x0;this[_0x93ce('0xe')]=0x0;this['holdtime']=0x0;this[_0x93ce('0xf')]=null;this['tag']=null;this[_0x93ce('0x10')]=null;this['monitor']=![];this[_0x93ce('0x11')]=null;this['queue']=null;this['monitors']=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this['mohtime']=0x0;}module[_0x93ce('0x12')]=Channel; \ No newline at end of file +var _0xfb8a=['answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','type','disposition','monitor','transfercalleridnum','transferconnectedlinenum','mohtime','starttime','channel','destinationchannel','calleridnum','connectedlinenum','accountcode','context','uniqueid','linkedid','exten'];(function(_0x455e00,_0x29577f){var _0x568400=function(_0x6dd5c9){while(--_0x6dd5c9){_0x455e00['push'](_0x455e00['shift']());}};_0x568400(++_0x29577f);}(_0xfb8a,0x109));var _0xafb8=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xfb8a[_0x342700];return _0x53406f;};'use strict';function Channel(){this[_0xafb8('0x0')]=null;this[_0xafb8('0x1')]='';this[_0xafb8('0x2')]='';this[_0xafb8('0x3')]=0x0;this['calleridname']='';this[_0xafb8('0x4')]=undefined;this['connectedlinename']=undefined;this[_0xafb8('0x5')]=0x0;this[_0xafb8('0x6')]='';this[_0xafb8('0x7')]=0x0;this[_0xafb8('0x8')]=0x0;this[_0xafb8('0x9')]=0x0;this[_0xafb8('0xa')]=![];this[_0xafb8('0xb')]=null;this[_0xafb8('0xc')]=null;this[_0xafb8('0xd')]=![];this[_0xafb8('0xe')]=![];this[_0xafb8('0xf')]='';this[_0xafb8('0x10')]='';this[_0xafb8('0x11')]=0x0;this[_0xafb8('0x12')]=0x0;this['holdtime']=0x0;this[_0xafb8('0x13')]=null;this['tag']=null;this[_0xafb8('0x14')]=null;this[_0xafb8('0x15')]=![];this['monitorFilename']=null;this['queue']=null;this['monitors']=[];this[_0xafb8('0x16')]=undefined;this[_0xafb8('0x17')]=undefined;this[_0xafb8('0x18')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 54fd9ba..a2aad7b 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 _0x7a2d=['remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x352f63,_0x4bbe67){var _0x4e883b=function(_0x134d96){while(--_0x134d96){_0x352f63['push'](_0x352f63['shift']());}};_0x4e883b(++_0x4bbe67);}(_0x7a2d,0x142));var _0xd7a2=function(_0x397748,_0x352004){_0x397748=_0x397748-0x0;var _0x248ecf=_0x7a2d[_0x397748];return _0x248ecf;};'use strict';function DeskAccount(_0x3388c3){this['id']=_0x3388c3['id']||0x0;this[_0xd7a2('0x0')]=_0x3388c3[_0xd7a2('0x0')]||'';this[_0xd7a2('0x1')]=_0x3388c3[_0xd7a2('0x1')]||'';this[_0xd7a2('0x2')]=_0x3388c3[_0xd7a2('0x2')]||'';this['authType']=_0x3388c3['authType']||'';this[_0xd7a2('0x3')]=_0x3388c3[_0xd7a2('0x3')]||'';this[_0xd7a2('0x4')]=_0x3388c3[_0xd7a2('0x4')]||'';this['consumerSecret']=_0x3388c3[_0xd7a2('0x5')]||'';this[_0xd7a2('0x6')]=_0x3388c3[_0xd7a2('0x6')]||'';this[_0xd7a2('0x7')]=_0x3388c3[_0xd7a2('0x7')]||'';this[_0xd7a2('0x8')]=_0x3388c3[_0xd7a2('0x8')]||'';this[_0xd7a2('0x9')]=_0x3388c3[_0xd7a2('0x9')]||'';this['Configurations']=_0x3388c3[_0xd7a2('0xa')]||{};}module[_0xd7a2('0xb')]=DeskAccount; \ No newline at end of file +var _0x777f=['token','tokenSecret','type','serverUrl','exports','name','username','remoteUri','authType','password','consumerSecret'];(function(_0x2b2cdf,_0x1586aa){var _0x343405=function(_0x4dfa8c){while(--_0x4dfa8c){_0x2b2cdf['push'](_0x2b2cdf['shift']());}};_0x343405(++_0x1586aa);}(_0x777f,0x9f));var _0xf777=function(_0x5b6cf1,_0x32fdcd){_0x5b6cf1=_0x5b6cf1-0x0;var _0x46278c=_0x777f[_0x5b6cf1];return _0x46278c;};'use strict';function DeskAccount(_0x2e2375){this['id']=_0x2e2375['id']||0x0;this[_0xf777('0x0')]=_0x2e2375[_0xf777('0x0')]||'';this[_0xf777('0x1')]=_0x2e2375[_0xf777('0x1')]||'';this[_0xf777('0x2')]=_0x2e2375[_0xf777('0x2')]||'';this[_0xf777('0x3')]=_0x2e2375['authType']||'';this[_0xf777('0x4')]=_0x2e2375[_0xf777('0x4')]||'';this['consumerKey']=_0x2e2375['consumerKey']||'';this['consumerSecret']=_0x2e2375[_0xf777('0x5')]||'';this[_0xf777('0x6')]=_0x2e2375[_0xf777('0x6')]||'';this[_0xf777('0x7')]=_0x2e2375[_0xf777('0x7')]||'';this[_0xf777('0x8')]=_0x2e2375[_0xf777('0x8')]||'';this[_0xf777('0x9')]=_0x2e2375['serverUrl']||'';this['Configurations']=_0x2e2375['Configurations']||{};}module[_0xf777('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 f43e3ff..cceeca5 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 _0x8587=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x8587,0x169));var _0x7858=function(_0x555eb3,_0x2defb1){_0x555eb3=_0x555eb3-0x0;var _0x32fa3c=_0x8587[_0x555eb3];return _0x32fa3c;};'use strict';function Dynamics365Account(_0x488093){this['id']=_0x488093['id']||0x0;this[_0x7858('0x0')]=_0x488093['name']||'';this['username']=_0x488093[_0x7858('0x1')]||'';this[_0x7858('0x2')]=_0x488093[_0x7858('0x2')]||'';this[_0x7858('0x3')]=_0x488093[_0x7858('0x3')]||'';this[_0x7858('0x4')]=_0x488093['tenantId']||'';this['clientId']=_0x488093[_0x7858('0x5')]||'';this[_0x7858('0x6')]=_0x488093[_0x7858('0x6')]||{};this[_0x7858('0x7')]=_0x488093['serverUrl']||'';this[_0x7858('0x8')]=_0x488093[_0x7858('0x8')]||{};}module[_0x7858('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xc9dc=['tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x37862a,_0x2bc98e){var _0x5b0104=function(_0x391413){while(--_0x391413){_0x37862a['push'](_0x37862a['shift']());}};_0x5b0104(++_0x2bc98e);}(_0xc9dc,0x9c));var _0xcc9d=function(_0x37de5e,_0x3fa541){_0x37de5e=_0x37de5e-0x0;var _0x447e06=_0xc9dc[_0x37de5e];return _0x447e06;};'use strict';function Dynamics365Account(_0x34fc89){this['id']=_0x34fc89['id']||0x0;this[_0xcc9d('0x0')]=_0x34fc89['name']||'';this['username']=_0x34fc89[_0xcc9d('0x1')]||'';this[_0xcc9d('0x2')]=_0x34fc89[_0xcc9d('0x2')]||'';this[_0xcc9d('0x3')]=_0x34fc89[_0xcc9d('0x3')]||'';this['tenantId']=_0x34fc89[_0xcc9d('0x4')]||'';this[_0xcc9d('0x5')]=_0x34fc89[_0xcc9d('0x5')]||'';this[_0xcc9d('0x6')]=_0x34fc89[_0xcc9d('0x6')]||{};this[_0xcc9d('0x7')]=_0x34fc89['serverUrl']||'';this[_0xcc9d('0x8')]=_0x34fc89['Configurations']||{};}module[_0xcc9d('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 163ccc1..96d1408 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 _0x101e=['modem','faxdetect','t38timeout','tech','SIP','Trunk','key','exports','name','description','headerinfo','localstationid','minrate','maxrate'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0x101e,0xbe));var _0xe101=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x101e[_0x6131cd];return _0x47e916;};'use strict';function FaxAccount(_0x1ffcdb){this['id']=_0x1ffcdb['id']||0x0;this['name']=_0x1ffcdb[_0xe101('0x0')]||'';this['description']=_0x1ffcdb[_0xe101('0x1')];this['ecm']=_0x1ffcdb['ecm'];this[_0xe101('0x2')]=_0x1ffcdb['headerinfo'];this[_0xe101('0x3')]=_0x1ffcdb['localstationid'];this[_0xe101('0x4')]=_0x1ffcdb[_0xe101('0x4')]||0x960;this[_0xe101('0x5')]=_0x1ffcdb[_0xe101('0x5')]||0x3840;this[_0xe101('0x6')]=_0x1ffcdb['modem']||'v17,v27,v29';this['gateway']=_0x1ffcdb['gateway']||'no';this['faxdetect']=_0x1ffcdb[_0xe101('0x7')]||'no';this[_0xe101('0x8')]=_0x1ffcdb[_0xe101('0x8')]||0x1388;this[_0xe101('0x9')]=_0x1ffcdb[_0xe101('0x9')]||_0xe101('0xa');this[_0xe101('0xb')]=_0x1ffcdb['Trunk']?_0x1ffcdb[_0xe101('0xb')]:undefined;this['ListId']=_0x1ffcdb['ListId'];this[_0xe101('0xc')]=_0x1ffcdb['key'];}module[_0xe101('0xd')]=FaxAccount; \ No newline at end of file +var _0x7a7c=['t38timeout','tech','SIP','Trunk','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect'];(function(_0x3c8344,_0x42b61c){var _0x59ba5=function(_0x228f07){while(--_0x228f07){_0x3c8344['push'](_0x3c8344['shift']());}};_0x59ba5(++_0x42b61c);}(_0x7a7c,0x1c6));var _0xc7a7=function(_0x2e81c7,_0x57f15a){_0x2e81c7=_0x2e81c7-0x0;var _0x2427dd=_0x7a7c[_0x2e81c7];return _0x2427dd;};'use strict';function FaxAccount(_0x3066df){this['id']=_0x3066df['id']||0x0;this[_0xc7a7('0x0')]=_0x3066df[_0xc7a7('0x0')]||'';this[_0xc7a7('0x1')]=_0x3066df['description'];this[_0xc7a7('0x2')]=_0x3066df[_0xc7a7('0x2')];this[_0xc7a7('0x3')]=_0x3066df['headerinfo'];this[_0xc7a7('0x4')]=_0x3066df[_0xc7a7('0x4')];this['minrate']=_0x3066df[_0xc7a7('0x5')]||0x960;this[_0xc7a7('0x6')]=_0x3066df[_0xc7a7('0x6')]||0x3840;this[_0xc7a7('0x7')]=_0x3066df[_0xc7a7('0x7')]||'v17,v27,v29';this[_0xc7a7('0x8')]=_0x3066df[_0xc7a7('0x8')]||'no';this['faxdetect']=_0x3066df[_0xc7a7('0x9')]||'no';this[_0xc7a7('0xa')]=_0x3066df[_0xc7a7('0xa')]||0x1388;this[_0xc7a7('0xb')]=_0x3066df[_0xc7a7('0xb')]||_0xc7a7('0xc');this[_0xc7a7('0xd')]=_0x3066df[_0xc7a7('0xd')]?_0x3066df['Trunk']:undefined;this['ListId']=_0x3066df['ListId'];this['key']=_0x3066df[_0xc7a7('0xe')];}module[_0xc7a7('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 4946d45..407546d 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 _0x9c01=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x5c32e0,_0x279cc8){var _0x4a5c11=function(_0x3cd97b){while(--_0x3cd97b){_0x5c32e0['push'](_0x5c32e0['shift']());}};_0x4a5c11(++_0x279cc8);}(_0x9c01,0xf3));var _0x19c0=function(_0x24faff,_0x2ade2d){_0x24faff=_0x24faff-0x0;var _0x53f8eb=_0x9c01[_0x24faff];return _0x53f8eb;};'use strict';function FreshdeskAccount(_0xf0a798){this['id']=_0xf0a798['id']||0x0;this[_0x19c0('0x0')]=_0xf0a798[_0x19c0('0x0')]||'';this['username']=_0xf0a798[_0x19c0('0x1')]||'';this[_0x19c0('0x2')]=_0xf0a798[_0x19c0('0x3')]||'';this[_0x19c0('0x4')]=_0xf0a798[_0x19c0('0x4')]||'';this[_0x19c0('0x5')]=_0xf0a798[_0x19c0('0x5')]||'';this[_0x19c0('0x6')]=_0xf0a798[_0x19c0('0x6')]||{};}module[_0x19c0('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x0f08=['remoteUri','serverUrl','Configurations','name','username'];(function(_0x1fa39c,_0x28fa76){var _0x2c7ace=function(_0x45e5d5){while(--_0x45e5d5){_0x1fa39c['push'](_0x1fa39c['shift']());}};_0x2c7ace(++_0x28fa76);}(_0x0f08,0x120));var _0x80f0=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x0f08[_0x1cd47d];return _0x29d52f;};'use strict';function FreshdeskAccount(_0x1577b7){this['id']=_0x1577b7['id']||0x0;this[_0x80f0('0x0')]=_0x1577b7[_0x80f0('0x0')]||'';this['username']=_0x1577b7[_0x80f0('0x1')]||'';this['apiKey']=_0x1577b7['token']||'';this[_0x80f0('0x2')]=_0x1577b7[_0x80f0('0x2')]||'';this[_0x80f0('0x3')]=_0x1577b7[_0x80f0('0x3')]||'';this['Configurations']=_0x1577b7[_0x80f0('0x4')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 5f58745..5743bf9 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 _0x416a=['remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x47c5bf,_0x45977e){var _0x11b779=function(_0x1bd585){while(--_0x1bd585){_0x47c5bf['push'](_0x47c5bf['shift']());}};_0x11b779(++_0x45977e);}(_0x416a,0x7b));var _0xa416=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x416a[_0x3dd15e];return _0x231fd0;};'use strict';function FreshsalesAccount(_0x3135ab){this['id']=_0x3135ab['id']||0x0;this[_0xa416('0x0')]=_0x3135ab[_0xa416('0x0')]||'';this[_0xa416('0x1')]=_0x3135ab['username']||'';this[_0xa416('0x2')]=_0x3135ab['token']||'';this[_0xa416('0x3')]=_0x3135ab['remoteUri']||'';this[_0xa416('0x4')]=_0x3135ab[_0xa416('0x4')]||'';this['Configurations']=_0x3135ab[_0xa416('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xbdf8=['Configurations','exports','name','username','token','remoteUri','serverUrl'];(function(_0x30d02d,_0x7ea7cc){var _0x58138b=function(_0x85127){while(--_0x85127){_0x30d02d['push'](_0x30d02d['shift']());}};_0x58138b(++_0x7ea7cc);}(_0xbdf8,0x16e));var _0x8bdf=function(_0x1b4f28,_0x1fd756){_0x1b4f28=_0x1b4f28-0x0;var _0x354abe=_0xbdf8[_0x1b4f28];return _0x354abe;};'use strict';function FreshsalesAccount(_0x3631c1){this['id']=_0x3631c1['id']||0x0;this[_0x8bdf('0x0')]=_0x3631c1[_0x8bdf('0x0')]||'';this[_0x8bdf('0x1')]=_0x3631c1[_0x8bdf('0x1')]||'';this['apiKey']=_0x3631c1[_0x8bdf('0x2')]||'';this[_0x8bdf('0x3')]=_0x3631c1[_0x8bdf('0x3')]||'';this[_0x8bdf('0x4')]=_0x3631c1[_0x8bdf('0x4')]||'';this[_0x8bdf('0x5')]=_0x3631c1[_0x8bdf('0x5')]||{};}module[_0x8bdf('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 9c06cce..518c69b 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 _0x21ab=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinenum','accountcode','context','exten','priority','lastAssignedTo','exports','type','calleridnum','calleridname','queue','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete'];(function(_0x8127f1,_0x20fe64){var _0x129b7f=function(_0x1c3e5a){while(--_0x1c3e5a){_0x8127f1['push'](_0x8127f1['shift']());}};_0x129b7f(++_0x20fe64);}(_0x21ab,0x7c));var _0xb21a=function(_0x2673c1,_0x489c00){_0x2673c1=_0x2673c1-0x0;var _0x46bde=_0x21ab[_0x2673c1];return _0x46bde;};'use strict';function QueueReport(){this[_0xb21a('0x0')]='inbound';this['uniqueid']='';this[_0xb21a('0x1')]='';this[_0xb21a('0x2')]='';this[_0xb21a('0x3')]='';this['queuecallerjoinAt']=null;this[_0xb21a('0x4')]=null;this[_0xb21a('0x5')]=0x1;this['count']=0x1;this[_0xb21a('0x6')]=![];this[_0xb21a('0x7')]=null;this[_0xb21a('0x8')]=![];this[_0xb21a('0x9')]=null;this[_0xb21a('0xa')]=![];this[_0xb21a('0xb')]=null;this['originalposition']=0x1;this['channel']='';this[_0xb21a('0xc')]='';this['connectedlinename']='';this[_0xb21a('0xd')]='';this[_0xb21a('0xe')]='';this[_0xb21a('0xf')]='';this[_0xb21a('0x10')]='';this['holdtime']=0x0;this['assigned']=![];this[_0xb21a('0x11')]='';this['mohtime']=0x0;this['variables']={};}module[_0xb21a('0x12')]=QueueReport; \ No newline at end of file +var _0xd654=['accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinename'];(function(_0x388d76,_0x692c8a){var _0x4aacc5=function(_0x1ac84f){while(--_0x1ac84f){_0x388d76['push'](_0x388d76['shift']());}};_0x4aacc5(++_0x692c8a);}(_0xd654,0x15a));var _0x4d65=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd654[_0x4565bf];return _0x5610ba;};'use strict';function QueueReport(){this[_0x4d65('0x0')]='inbound';this['uniqueid']='';this[_0x4d65('0x1')]='';this['calleridname']='';this[_0x4d65('0x2')]='';this[_0x4d65('0x3')]=null;this[_0x4d65('0x4')]=null;this[_0x4d65('0x5')]=0x1;this[_0x4d65('0x6')]=0x1;this[_0x4d65('0x7')]=![];this[_0x4d65('0x8')]=null;this[_0x4d65('0x9')]=![];this[_0x4d65('0xa')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x4d65('0xb')]=0x1;this[_0x4d65('0xc')]='';this['connectedlinenum']='';this[_0x4d65('0xd')]='';this[_0x4d65('0xe')]='';this[_0x4d65('0xf')]='';this[_0x4d65('0x10')]='';this[_0x4d65('0x11')]='';this[_0x4d65('0x12')]=0x0;this[_0x4d65('0x13')]=![];this[_0x4d65('0x14')]='';this[_0x4d65('0x15')]=0x0;this[_0x4d65('0x16')]={};}module[_0x4d65('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 46ae95c..4b88859 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 _0x7348=['type','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x7348,0x16b));var _0x8734=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7348[_0x3dd15e];return _0x231fd0;};'use strict';function SalesforceAccount(_0x54f965){this['id']=_0x54f965['id']||0x0;this[_0x8734('0x0')]=_0x54f965[_0x8734('0x0')]||'';this['username']=_0x54f965[_0x8734('0x1')]||'';this[_0x8734('0x2')]=_0x54f965[_0x8734('0x2')]||'';this[_0x8734('0x3')]=_0x54f965[_0x8734('0x3')]||'';this['clientId']=_0x54f965[_0x8734('0x4')]||'';this['clientSecret']=_0x54f965[_0x8734('0x5')]||'';this['securityToken']=_0x54f965[_0x8734('0x6')]||'';this[_0x8734('0x7')]=_0x54f965[_0x8734('0x7')]||'integrationTab';this[_0x8734('0x8')]=_0x54f965['serverUrl']||'';this['Configurations']=_0x54f965[_0x8734('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x5ae9=['clientId','clientSecret','securityToken','type','serverUrl','Configurations','username','remoteUri','password'];(function(_0x964709,_0x318d9a){var _0xfc2f1d=function(_0x51bbc3){while(--_0x51bbc3){_0x964709['push'](_0x964709['shift']());}};_0xfc2f1d(++_0x318d9a);}(_0x5ae9,0x19b));var _0x95ae=function(_0x835cb7,_0x1e574d){_0x835cb7=_0x835cb7-0x0;var _0x3ef599=_0x5ae9[_0x835cb7];return _0x3ef599;};'use strict';function SalesforceAccount(_0x579d85){this['id']=_0x579d85['id']||0x0;this['name']=_0x579d85['name']||'';this[_0x95ae('0x0')]=_0x579d85[_0x95ae('0x0')]||'';this['remoteUri']=_0x579d85[_0x95ae('0x1')]||'';this[_0x95ae('0x2')]=_0x579d85['password']||'';this[_0x95ae('0x3')]=_0x579d85['clientId']||'';this[_0x95ae('0x4')]=_0x579d85[_0x95ae('0x4')]||'';this[_0x95ae('0x5')]=_0x579d85[_0x95ae('0x5')]||'';this[_0x95ae('0x6')]=_0x579d85['type']||'integrationTab';this[_0x95ae('0x7')]=_0x579d85[_0x95ae('0x7')]||'';this[_0x95ae('0x8')]=_0x579d85[_0x95ae('0x8')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 9741345..7aee3e8 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 _0xc2c8=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3b02a6,_0x114854){var _0xddeff4=function(_0x52fd87){while(--_0x52fd87){_0x3b02a6['push'](_0x3b02a6['shift']());}};_0xddeff4(++_0x114854);}(_0xc2c8,0x171));var _0x8c2c=function(_0x1546c1,_0x233f19){_0x1546c1=_0x1546c1-0x0;var _0x5d33fe=_0xc2c8[_0x1546c1];return _0x5d33fe;};'use strict';function ServicenowAccount(_0x295315){this['id']=_0x295315['id']||0x0;this[_0x8c2c('0x0')]=_0x295315[_0x8c2c('0x0')]||'';this[_0x8c2c('0x1')]=_0x295315['username']||'';this[_0x8c2c('0x2')]=_0x295315[_0x8c2c('0x2')]||'';this[_0x8c2c('0x3')]=_0x295315['remoteUri']||'';this[_0x8c2c('0x4')]=_0x295315['serverUrl']||'';this['Configurations']=_0x295315[_0x8c2c('0x5')]||{};}module[_0x8c2c('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x2644=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2644,0x189));var _0x4264=function(_0x8267aa,_0x496ef0){_0x8267aa=_0x8267aa-0x0;var _0x2a437f=_0x2644[_0x8267aa];return _0x2a437f;};'use strict';function ServicenowAccount(_0x4c4df5){this['id']=_0x4c4df5['id']||0x0;this[_0x4264('0x0')]=_0x4c4df5[_0x4264('0x0')]||'';this[_0x4264('0x1')]=_0x4c4df5['username']||'';this[_0x4264('0x2')]=_0x4c4df5[_0x4264('0x2')]||'';this[_0x4264('0x3')]=_0x4c4df5[_0x4264('0x3')]||'';this[_0x4264('0x4')]=_0x4c4df5[_0x4264('0x4')]||'';this[_0x4264('0x5')]=_0x4c4df5['Configurations']||{};}module[_0x4264('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 5242d30..3d24fd8 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 _0xb29e=['name','username','password','serverUrl','Configurations','exports'];(function(_0x811631,_0x38238e){var _0x565d3d=function(_0xe6c23c){while(--_0xe6c23c){_0x811631['push'](_0x811631['shift']());}};_0x565d3d(++_0x38238e);}(_0xb29e,0x150));var _0xeb29=function(_0x1a9ca4,_0x5115db){_0x1a9ca4=_0x1a9ca4-0x0;var _0x19a2c2=_0xb29e[_0x1a9ca4];return _0x19a2c2;};'use strict';function SugarcrmAccount(_0x412bdb){this['id']=_0x412bdb['id']||0x0;this['name']=_0x412bdb[_0xeb29('0x0')]||'';this[_0xeb29('0x1')]=_0x412bdb['username']||'';this[_0xeb29('0x2')]=_0x412bdb[_0xeb29('0x2')]||'';this['remoteUri']=_0x412bdb['remoteUri']||'';this[_0xeb29('0x3')]=_0x412bdb[_0xeb29('0x3')]||'';this[_0xeb29('0x4')]=_0x412bdb['Configurations']||{};}module[_0xeb29('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x1271=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x488d97,_0x318f5d){var _0x5e180e=function(_0x35bdb1){while(--_0x35bdb1){_0x488d97['push'](_0x488d97['shift']());}};_0x5e180e(++_0x318f5d);}(_0x1271,0x12d));var _0x1127=function(_0x8240c4,_0x15f53b){_0x8240c4=_0x8240c4-0x0;var _0x3db05f=_0x1271[_0x8240c4];return _0x3db05f;};'use strict';function SugarcrmAccount(_0x45a9f0){this['id']=_0x45a9f0['id']||0x0;this[_0x1127('0x0')]=_0x45a9f0[_0x1127('0x0')]||'';this[_0x1127('0x1')]=_0x45a9f0[_0x1127('0x1')]||'';this[_0x1127('0x2')]=_0x45a9f0['password']||'';this[_0x1127('0x3')]=_0x45a9f0[_0x1127('0x3')]||'';this[_0x1127('0x4')]=_0x45a9f0[_0x1127('0x4')]||'';this[_0x1127('0x5')]=_0x45a9f0[_0x1127('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 00dd575..7893c58 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 _0x05eb=['exports','name','accountcode','state','unknown','stateTime','status','address'];(function(_0x58f23c,_0x1ad6f6){var _0x679af1=function(_0xa819c7){while(--_0xa819c7){_0x58f23c['push'](_0x58f23c['shift']());}};_0x679af1(++_0x1ad6f6);}(_0x05eb,0xe1));var _0xb05e=function(_0x3e835f,_0x56b6be){_0x3e835f=_0x3e835f-0x0;var _0x59a843=_0x05eb[_0x3e835f];return _0x59a843;};'use strict';function Telephone(_0x13f648){this['id']=_0x13f648['id']||0x0;this['name']=_0x13f648[_0xb05e('0x0')]||'';this['accountcode']=_0x13f648[_0xb05e('0x1')]||'';this[_0xb05e('0x2')]=_0xb05e('0x3');this[_0xb05e('0x4')]=0x0;this[_0xb05e('0x5')]=_0xb05e('0x3');this[_0xb05e('0x6')]='';}module[_0xb05e('0x7')]=Telephone; \ No newline at end of file +var _0x79a8=['exports','name','accountcode','unknown'];(function(_0x28b8b3,_0x5163fb){var _0x236f9d=function(_0xa5d7de){while(--_0xa5d7de){_0x28b8b3['push'](_0x28b8b3['shift']());}};_0x236f9d(++_0x5163fb);}(_0x79a8,0x65));var _0x879a=function(_0x56d9c0,_0x23cac4){_0x56d9c0=_0x56d9c0-0x0;var _0x183ba1=_0x79a8[_0x56d9c0];return _0x183ba1;};'use strict';function Telephone(_0x367356){this['id']=_0x367356['id']||0x0;this[_0x879a('0x0')]=_0x367356[_0x879a('0x0')]||'';this[_0x879a('0x1')]=_0x367356[_0x879a('0x1')]||'';this['state']=_0x879a('0x2');this['stateTime']=0x0;this['status']='unknown';this['address']='';}module[_0x879a('0x3')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index fe2eafb..6912380 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 _0xac47=['html','exports','name'];(function(_0x363335,_0x233d78){var _0x527bf4=function(_0x167143){while(--_0x167143){_0x363335['push'](_0x363335['shift']());}};_0x527bf4(++_0x233d78);}(_0xac47,0x1af));var _0x7ac4=function(_0x17a842,_0x1ac67a){_0x17a842=_0x17a842-0x0;var _0x142199=_0xac47[_0x17a842];return _0x142199;};'use strict';function template(_0x2f55d1){this['id']=_0x2f55d1['id']||0x0;this[_0x7ac4('0x0')]=_0x2f55d1[_0x7ac4('0x0')]||'';this[_0x7ac4('0x1')]=_0x2f55d1[_0x7ac4('0x1')]||'';}module[_0x7ac4('0x2')]=template; \ No newline at end of file +var _0x1e93=['exports','name','html'];(function(_0x210580,_0x1329d5){var _0x477835=function(_0x202c95){while(--_0x202c95){_0x210580['push'](_0x210580['shift']());}};_0x477835(++_0x1329d5);}(_0x1e93,0x14b));var _0x31e9=function(_0x568a72,_0x220535){_0x568a72=_0x568a72-0x0;var _0x614164=_0x1e93[_0x568a72];return _0x614164;};'use strict';function template(_0x3cad79){this['id']=_0x3cad79['id']||0x0;this[_0x31e9('0x0')]=_0x3cad79[_0x31e9('0x0')]||'';this[_0x31e9('0x1')]=_0x3cad79['html']||'';}module[_0x31e9('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 6fd4d8c..fe834ea 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 _0x54ef=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x2aee74,_0x3019e2){var _0x2cd40b=function(_0x14ab50){while(--_0x14ab50){_0x2aee74['push'](_0x2aee74['shift']());}};_0x2cd40b(++_0x3019e2);}(_0x54ef,0x112));var _0xf54e=function(_0x514ff6,_0x16577f){_0x514ff6=_0x514ff6-0x0;var _0x219ab9=_0x54ef[_0x514ff6];return _0x219ab9;};'use strict';function Trigger(_0x19d4d5){this['id']=_0x19d4d5['id']||0x0;this[_0xf54e('0x0')]=_0x19d4d5[_0xf54e('0x0')]||'';this['channel']=_0x19d4d5[_0xf54e('0x1')]||_0xf54e('0x2');this[_0xf54e('0x3')]=_0x19d4d5[_0xf54e('0x3')]||![];this[_0xf54e('0x4')]=_0x19d4d5[_0xf54e('0x4')]||[];this[_0xf54e('0x5')]=_0x19d4d5['AnyConditions']||[];this['Actions']=_0x19d4d5[_0xf54e('0x6')]||[];}module[_0xf54e('0x7')]=Trigger; \ No newline at end of file +var _0x4b84=['name','channel','status','AllConditions','Actions'];(function(_0x5e4d16,_0x6dc4bb){var _0x29842d=function(_0x180e47){while(--_0x180e47){_0x5e4d16['push'](_0x5e4d16['shift']());}};_0x29842d(++_0x6dc4bb);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0x4b84[_0x4347ec];return _0x4c8314;};'use strict';function Trigger(_0x90ff31){this['id']=_0x90ff31['id']||0x0;this[_0x44b8('0x0')]=_0x90ff31['name']||'';this['channel']=_0x90ff31[_0x44b8('0x1')]||'voice';this['status']=_0x90ff31[_0x44b8('0x2')]||![];this[_0x44b8('0x3')]=_0x90ff31[_0x44b8('0x3')]||[];this['AnyConditions']=_0x90ff31['AnyConditions']||[];this['Actions']=_0x90ff31[_0x44b8('0x4')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index f48492d..5374ac7 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 _0x465a=['port','domain','domainport','refresh','stateRegistry','registrationtime','exports','active','name','state','unknown','registry','indexOf','split','host'];(function(_0x45dc79,_0x31256f){var _0x118ae6=function(_0x279862){while(--_0x279862){_0x45dc79['push'](_0x45dc79['shift']());}};_0x118ae6(++_0x31256f);}(_0x465a,0x1d8));var _0xa465=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x465a[_0xa464c9];return _0x3d73c4;};'use strict';function Trunk(_0x27691d){this['id']=_0x27691d['id']||0x0;this[_0xa465('0x0')]=_0x27691d['active']||![];this[_0xa465('0x1')]=_0x27691d[_0xa465('0x1')]||'';this[_0xa465('0x2')]=_0xa465('0x3');this['stateTime']=0x0;this['status']=_0xa465('0x3');this[_0xa465('0x4')]=_0x27691d[_0xa465('0x4')]&&_0x27691d[_0xa465('0x4')][_0xa465('0x5')](':')?_0x27691d['registry'][_0xa465('0x6')](':')[0x0]:'';this[_0xa465('0x7')]='';this[_0xa465('0x8')]='';this[_0xa465('0x9')]='';this[_0xa465('0xa')]='';this[_0xa465('0xb')]='';this[_0xa465('0xc')]='unknown';this[_0xa465('0xd')]='';this['address']='';}module[_0xa465('0xe')]=Trunk; \ No newline at end of file +var _0x4e16=['name','unknown','stateTime','status','registry','indexOf','split','port','domainport','refresh','stateRegistry','registrationtime','address','exports','active'];(function(_0x59e86b,_0x245ea1){var _0x4d8900=function(_0x163d95){while(--_0x163d95){_0x59e86b['push'](_0x59e86b['shift']());}};_0x4d8900(++_0x245ea1);}(_0x4e16,0x1ee));var _0x64e1=function(_0x562219,_0x538e13){_0x562219=_0x562219-0x0;var _0x208fa5=_0x4e16[_0x562219];return _0x208fa5;};'use strict';function Trunk(_0x427db4){this['id']=_0x427db4['id']||0x0;this[_0x64e1('0x0')]=_0x427db4[_0x64e1('0x0')]||![];this[_0x64e1('0x1')]=_0x427db4[_0x64e1('0x1')]||'';this['state']=_0x64e1('0x2');this[_0x64e1('0x3')]=0x0;this[_0x64e1('0x4')]='unknown';this['registry']=_0x427db4[_0x64e1('0x5')]&&_0x427db4[_0x64e1('0x5')][_0x64e1('0x6')](':')?_0x427db4[_0x64e1('0x5')][_0x64e1('0x7')](':')[0x0]:'';this['host']='';this[_0x64e1('0x8')]='';this['domain']='';this[_0x64e1('0x9')]='';this[_0x64e1('0xa')]='';this[_0x64e1('0xb')]=_0x64e1('0x2');this[_0x64e1('0xc')]='';this[_0x64e1('0xd')]='';}module[_0x64e1('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index d8adeb5..261584e 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 _0x8c0a=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x45fffc,_0x3f0396){var _0x11b743=function(_0x5be52a){while(--_0x5be52a){_0x45fffc['push'](_0x45fffc['shift']());}};_0x11b743(++_0x3f0396);}(_0x8c0a,0x1a8));var _0xa8c0=function(_0x2ff20a,_0x56f373){_0x2ff20a=_0x2ff20a-0x0;var _0x49c281=_0x8c0a[_0x2ff20a];return _0x49c281;};'use strict';function voiceExtension(_0x46ebbe){this['id']=_0x46ebbe['id']||0x0;this[_0xa8c0('0x0')]=_0x46ebbe['exten']||'';this[_0xa8c0('0x1')]=_0x46ebbe[_0xa8c0('0x1')]||_0xa8c0('0x2');this['mandatoryDisposition']=_0x46ebbe[_0xa8c0('0x3')]||![];}module[_0xa8c0('0x4')]=voiceExtension; \ No newline at end of file +var _0x2af2=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x3401ce,_0x5d1579){var _0x1bb79d=function(_0x46985e){while(--_0x46985e){_0x3401ce['push'](_0x3401ce['shift']());}};_0x1bb79d(++_0x5d1579);}(_0x2af2,0x13d));var _0x22af=function(_0x5aea7e,_0x234e5a){_0x5aea7e=_0x5aea7e-0x0;var _0x3ab7f7=_0x2af2[_0x5aea7e];return _0x3ab7f7;};'use strict';function voiceExtension(_0x44b4a4){this['id']=_0x44b4a4['id']||0x0;this[_0x22af('0x0')]=_0x44b4a4[_0x22af('0x0')]||'';this['recordingFormat']=_0x44b4a4[_0x22af('0x1')]||_0x22af('0x2');this['mandatoryDisposition']=_0x44b4a4[_0x22af('0x3')]||![];}module[_0x22af('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 9c2b8b7..4fca572 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 _0x52b6=['sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','inuse','invalid','unavailable','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x52b6,0x1c4));var _0x652b=function(_0x33628a,_0x2df134){_0x33628a=_0x33628a-0x0;var _0x25d370=_0x52b6[_0x33628a];return _0x25d370;};'use strict';var statusDesc=['unknown','not_inuse',_0x652b('0x0'),'busy',_0x652b('0x1'),_0x652b('0x2'),'ringing',_0x652b('0x3'),_0x652b('0x4')];var monitorFormat={'wav':_0x652b('0x5'),'wav49':'wav49','gsm':_0x652b('0x6')};var strategy={'rrmemory':_0x652b('0x7'),'roundrobin':_0x652b('0x8')};function VoiceQueue(_0x1de10b){this['id']=_0x1de10b['id']||0x0;this[_0x652b('0x9')]=_0x1de10b[_0x652b('0x9')]||'';this[_0x652b('0xa')]=_0x1de10b[_0x652b('0xa')]||'';this['type']=_0x1de10b[_0x652b('0xb')]||'inbound';this[_0x652b('0xc')]=0x0;this[_0x652b('0xd')]=0x0;this[_0x652b('0xe')]=0x0;this['answered']=0x0;this[_0x652b('0xf')]=0x0;this[_0x652b('0x10')]=0x0;this[_0x652b('0x11')]=0x0;this['unmanaged']=0x0;this[_0x652b('0x12')]=0x0;this[_0x652b('0x13')]=0x0;this[_0x652b('0x14')]=0x0;this[_0x652b('0x15')]=_0x1de10b[_0x652b('0x15')]||![];this['acwTimeout']=_0x1de10b[_0x652b('0x16')]||0xa;this[_0x652b('0x17')]=_0x1de10b[_0x652b('0x17')]||'no';this[_0x652b('0x18')]=!![];this[_0x652b('0x19')]='';this[_0x652b('0x1a')]=0x0;this[_0x652b('0x1b')]=0x0;this[_0x652b('0x1c')]=_0x1de10b[_0x652b('0x1c')]||null;this['dialGlobalInterval']=_0x1de10b['dialGlobalInterval']?_0x1de10b[_0x652b('0x1d')]:null;this[_0x652b('0x1e')]=_0x1de10b[_0x652b('0x1e')];this[_0x652b('0x1f')]=_0x1de10b[_0x652b('0x1f')]||_0x652b('0x20');this[_0x652b('0x21')]=_0x1de10b[_0x652b('0x21')]||0x0;this[_0x652b('0x22')]=_0x1de10b[_0x652b('0x22')]||0x0;this[_0x652b('0x23')]=_0x1de10b[_0x652b('0x23')]||0x1;this[_0x652b('0x24')]=_0x1de10b[_0x652b('0x24')]||_0x652b('0x25');this[_0x652b('0x26')]=_0x1de10b['dialPredictiveOptimizationPercentage']||0.03;this[_0x652b('0x27')]=_0x1de10b[_0x652b('0x27')]||0x258;this['dialOriginateCallerIdName']=_0x1de10b['dialOriginateCallerIdName']||_0x652b('0x28');this[_0x652b('0x29')]=_0x1de10b[_0x652b('0x29')]||_0x652b('0x28');this['dialOriginateTimeout']=_0x1de10b['dialOriginateTimeout']||0x1e;this[_0x652b('0x2a')]=_0x1de10b['dialQueueOptions']||_0x652b('0x2b');this['dialQueueTimeout']=_0x1de10b[_0x652b('0x2c')]||0x3;this[_0x652b('0x2d')]=_0x1de10b['dialQueueProject']||undefined;this[_0x652b('0x2e')]=_0x1de10b[_0x652b('0x2e')]||0x3;this[_0x652b('0x2f')]=_0x1de10b[_0x652b('0x2f')]||0x96;this['dialBusyMaxRetry']=_0x1de10b[_0x652b('0x30')]||0x3;this[_0x652b('0x31')]=_0x1de10b[_0x652b('0x31')]||0x96;this[_0x652b('0x32')]=_0x1de10b[_0x652b('0x32')]||0x3;this[_0x652b('0x33')]=_0x1de10b[_0x652b('0x33')]||0x96;this[_0x652b('0x34')]=_0x1de10b['dialNoSuchNumberMaxRetry']||0x3;this[_0x652b('0x35')]=_0x1de10b[_0x652b('0x35')]||0x96;this[_0x652b('0x36')]=_0x1de10b[_0x652b('0x36')]||0x3;this[_0x652b('0x37')]=_0x1de10b[_0x652b('0x37')]||0x96;this[_0x652b('0x38')]=_0x1de10b[_0x652b('0x38')]||0x3;this['dialAbandonedRetryFrequency']=_0x1de10b[_0x652b('0x39')]||0x96;this[_0x652b('0x3a')]=_0x1de10b[_0x652b('0x3a')]||0x3;this['dialMachineRetryFrequency']=_0x1de10b[_0x652b('0x3b')]||0x96;this[_0x652b('0x3c')]=_0x1de10b[_0x652b('0x3c')]||0x3;this[_0x652b('0x3d')]=_0x1de10b['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x1de10b[_0x652b('0x3e')]||0x4;this[_0x652b('0x3f')]=_0x1de10b[_0x652b('0x3f')]?_0x1de10b[_0x652b('0x3f')]:undefined;this[_0x652b('0x40')]=_0x1de10b[_0x652b('0x40')]?_0x1de10b[_0x652b('0x40')]:undefined;this[_0x652b('0x41')]=_0x1de10b[_0x652b('0x41')]||undefined;this['Interval']=_0x1de10b[_0x652b('0x42')]?_0x1de10b[_0x652b('0x42')]:undefined;this[_0x652b('0x43')]=_0x1de10b['dialOrderByScheduledAt']||_0x652b('0x44');this[_0x652b('0x45')]=_0x1de10b[_0x652b('0x45')]||undefined;this[_0x652b('0x46')]=_0x1de10b[_0x652b('0x46')]||undefined;this['strategy']=strategy[_0x1de10b['strategy']]||_0x652b('0x7');this['queueStatusComplete']=!![];this[_0x652b('0x47')]=_0x1de10b['dialAMDActive']||![];this[_0x652b('0x48')]=_0x1de10b[_0x652b('0x48')];this[_0x652b('0x49')]=_0x1de10b[_0x652b('0x49')];this[_0x652b('0x4a')]=_0x1de10b[_0x652b('0x4a')];this[_0x652b('0x4b')]=_0x1de10b[_0x652b('0x4b')];this[_0x652b('0x4c')]=_0x1de10b[_0x652b('0x4c')];this['dialAMDBetweenWordsSilence']=_0x1de10b[_0x652b('0x4d')];this['dialAMDMaximumNumberOfWords']=_0x1de10b[_0x652b('0x4e')];this[_0x652b('0x4f')]=_0x1de10b['dialAMDSilenceThreshold'];this[_0x652b('0x50')]=_0x1de10b[_0x652b('0x50')];this[_0x652b('0x51')]=0x0;this[_0x652b('0x52')]=0x0;this['timeout']=_0x1de10b[_0x652b('0x53')];this[_0x652b('0x54')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x652b('0x55')]=0x0;this[_0x652b('0x56')]=0x0;this[_0x652b('0x57')]=0x0;this[_0x652b('0x58')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x652b('0x59')]=0x0;this[_0x652b('0x5a')]=0x0;this[_0x652b('0x5b')]=0x0;this[_0x652b('0x5c')]=0x0;this[_0x652b('0x5d')]=0x0;this['startProgressive']=undefined;this[_0x652b('0x5e')]=undefined;this['handlePredictive']=undefined;this[_0x652b('0x5f')]=1.05;this[_0x652b('0x60')]=0x0;this[_0x652b('0x61')]=0x0;this[_0x652b('0x62')]=0x0;this[_0x652b('0x63')]=0x0;this[_0x652b('0x64')]=0x0;this[_0x652b('0x65')]=0x0;this[_0x652b('0x66')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x652b('0x67')]=_0x1de10b[_0x652b('0x68')]||0x14;this[_0x652b('0x69')]=_0x1de10b[_0x652b('0x68')]||0xa;this[_0x652b('0x6a')]=0x0;this[_0x652b('0x6b')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x652b('0x6c')]=0x0;this['erlangCallToSecond']=0x0;this[_0x652b('0x6d')]=0x0;this[_0x652b('0x6e')]=0x0;this[_0x652b('0x6f')]=_0x1de10b[_0x652b('0x6f')]||0x1e;this['dialRecallInQueue']=_0x1de10b[_0x652b('0x70')]||![];this[_0x652b('0x71')]=_0x1de10b[_0x652b('0x71')]||undefined;this[_0x652b('0x72')]=_0x1de10b['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x1de10b[_0x652b('0x73')]||![];this[_0x652b('0xa')]=monitorFormat[_0x1de10b[_0x652b('0xa')]]?monitorFormat[_0x1de10b[_0x652b('0xa')]]:undefined;this[_0x652b('0x74')]=_0x1de10b['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x1de10b['mandatoryDispositionPause']?_0x1de10b[_0x652b('0x75')]:undefined;}module[_0x652b('0x76')]=VoiceQueue; \ No newline at end of file +var _0xb1b7=['dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','wav','wav49','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0xb1b7,0xce));var _0x7b1b=function(_0x23a57c,_0x50f90a){_0x23a57c=_0x23a57c-0x0;var _0x241de6=_0xb1b7[_0x23a57c];return _0x241de6;};'use strict';var statusDesc=[_0x7b1b('0x0'),_0x7b1b('0x1'),_0x7b1b('0x2'),_0x7b1b('0x3'),_0x7b1b('0x4'),_0x7b1b('0x5'),_0x7b1b('0x6'),_0x7b1b('0x7'),'onhold'];var monitorFormat={'wav':_0x7b1b('0x8'),'wav49':_0x7b1b('0x9'),'gsm':'gsm'};var strategy={'rrmemory':_0x7b1b('0xa'),'roundrobin':'roundrobin'};function VoiceQueue(_0x54e0f0){this['id']=_0x54e0f0['id']||0x0;this['name']=_0x54e0f0[_0x7b1b('0xb')]||'';this[_0x7b1b('0xc')]=_0x54e0f0['monitor_format']||'';this['type']=_0x54e0f0[_0x7b1b('0xd')]||_0x7b1b('0xe');this[_0x7b1b('0xf')]=0x0;this[_0x7b1b('0x10')]=0x0;this[_0x7b1b('0x11')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x7b1b('0x12')]=0x0;this[_0x7b1b('0x13')]=0x0;this[_0x7b1b('0x14')]=0x0;this[_0x7b1b('0x15')]=0x0;this[_0x7b1b('0x16')]=0x0;this[_0x7b1b('0x17')]=0x0;this[_0x7b1b('0x18')]=_0x54e0f0['acw']||![];this[_0x7b1b('0x19')]=_0x54e0f0['acwTimeout']||0xa;this[_0x7b1b('0x1a')]=_0x54e0f0['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x7b1b('0x1b')]='';this[_0x7b1b('0x1c')]=0x0;this[_0x7b1b('0x1d')]=0x0;this[_0x7b1b('0x1e')]=_0x54e0f0['dialTimezone']||null;this[_0x7b1b('0x1f')]=_0x54e0f0[_0x7b1b('0x1f')]?_0x54e0f0['dialGlobalInterval']:null;this[_0x7b1b('0x20')]=_0x54e0f0[_0x7b1b('0x20')];this['dialMethod']=_0x54e0f0[_0x7b1b('0x21')]||_0x7b1b('0x22');this[_0x7b1b('0x23')]=_0x54e0f0[_0x7b1b('0x23')]||0x0;this[_0x7b1b('0x24')]=_0x54e0f0[_0x7b1b('0x24')]||0x0;this[_0x7b1b('0x25')]=_0x54e0f0[_0x7b1b('0x25')]||0x1;this[_0x7b1b('0x26')]=_0x54e0f0['dialPredictiveOptimization']||_0x7b1b('0x27');this[_0x7b1b('0x28')]=_0x54e0f0[_0x7b1b('0x28')]||0.03;this[_0x7b1b('0x29')]=_0x54e0f0[_0x7b1b('0x29')]||0x258;this[_0x7b1b('0x2a')]=_0x54e0f0[_0x7b1b('0x2a')]||_0x7b1b('0x2b');this[_0x7b1b('0x2c')]=_0x54e0f0[_0x7b1b('0x2c')]||'anonymous';this[_0x7b1b('0x2d')]=_0x54e0f0[_0x7b1b('0x2d')]||0x1e;this[_0x7b1b('0x2e')]=_0x54e0f0['dialQueueOptions']||_0x7b1b('0x2f');this['dialQueueTimeout']=_0x54e0f0[_0x7b1b('0x30')]||0x3;this['dialQueueProject']=_0x54e0f0[_0x7b1b('0x31')]||undefined;this[_0x7b1b('0x32')]=_0x54e0f0['dialCongestionMaxRetry']||0x3;this[_0x7b1b('0x33')]=_0x54e0f0[_0x7b1b('0x33')]||0x96;this['dialBusyMaxRetry']=_0x54e0f0[_0x7b1b('0x34')]||0x3;this[_0x7b1b('0x35')]=_0x54e0f0[_0x7b1b('0x35')]||0x96;this[_0x7b1b('0x36')]=_0x54e0f0['dialNoAnswerMaxRetry']||0x3;this[_0x7b1b('0x37')]=_0x54e0f0[_0x7b1b('0x37')]||0x96;this[_0x7b1b('0x38')]=_0x54e0f0[_0x7b1b('0x38')]||0x3;this[_0x7b1b('0x39')]=_0x54e0f0[_0x7b1b('0x39')]||0x96;this[_0x7b1b('0x3a')]=_0x54e0f0[_0x7b1b('0x3a')]||0x3;this[_0x7b1b('0x3b')]=_0x54e0f0[_0x7b1b('0x3b')]||0x96;this[_0x7b1b('0x3c')]=_0x54e0f0['dialAbandonedMaxRetry']||0x3;this[_0x7b1b('0x3d')]=_0x54e0f0[_0x7b1b('0x3d')]||0x96;this[_0x7b1b('0x3e')]=_0x54e0f0['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x54e0f0[_0x7b1b('0x3f')]||0x96;this[_0x7b1b('0x40')]=_0x54e0f0[_0x7b1b('0x40')]||0x3;this[_0x7b1b('0x41')]=_0x54e0f0['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x54e0f0[_0x7b1b('0x42')]||0x4;this[_0x7b1b('0x43')]=_0x54e0f0[_0x7b1b('0x43')]?_0x54e0f0[_0x7b1b('0x43')]:undefined;this[_0x7b1b('0x44')]=_0x54e0f0[_0x7b1b('0x44')]?_0x54e0f0['TrunkBackup']:undefined;this[_0x7b1b('0x45')]=_0x54e0f0[_0x7b1b('0x45')]||undefined;this['Interval']=_0x54e0f0[_0x7b1b('0x46')]?_0x54e0f0[_0x7b1b('0x46')]:undefined;this[_0x7b1b('0x47')]=_0x54e0f0[_0x7b1b('0x47')]||'DESC';this[_0x7b1b('0x48')]=_0x54e0f0[_0x7b1b('0x48')]||undefined;this[_0x7b1b('0x49')]=_0x54e0f0['dialCutDigit']||undefined;this[_0x7b1b('0x4a')]=strategy[_0x54e0f0[_0x7b1b('0x4a')]]||'rrmemory';this[_0x7b1b('0x4b')]=!![];this['dialAMDActive']=_0x54e0f0[_0x7b1b('0x4c')]||![];this['dialAMDInitialSilence']=_0x54e0f0[_0x7b1b('0x4d')];this[_0x7b1b('0x4e')]=_0x54e0f0['dialAMDGreeting'];this[_0x7b1b('0x4f')]=_0x54e0f0[_0x7b1b('0x4f')];this[_0x7b1b('0x50')]=_0x54e0f0['dialAMDTotalAnalysisTime'];this[_0x7b1b('0x51')]=_0x54e0f0[_0x7b1b('0x51')];this[_0x7b1b('0x52')]=_0x54e0f0['dialAMDBetweenWordsSilence'];this[_0x7b1b('0x53')]=_0x54e0f0[_0x7b1b('0x53')];this[_0x7b1b('0x54')]=_0x54e0f0[_0x7b1b('0x54')];this['dialAMDMaximumWordLength']=_0x54e0f0[_0x7b1b('0x55')];this[_0x7b1b('0x56')]=0x0;this[_0x7b1b('0x57')]=0x0;this['timeout']=_0x54e0f0[_0x7b1b('0x58')];this['outboundAnswerCallsDay']=0x0;this[_0x7b1b('0x59')]=0x0;this[_0x7b1b('0x5a')]=0x0;this[_0x7b1b('0x5b')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x7b1b('0x5c')]=0x0;this[_0x7b1b('0x5d')]=0x0;this[_0x7b1b('0x5e')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x7b1b('0x5f')]=0x0;this[_0x7b1b('0x60')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x7b1b('0x61')]=undefined;this[_0x7b1b('0x62')]=undefined;this[_0x7b1b('0x63')]=undefined;this[_0x7b1b('0x64')]=1.05;this[_0x7b1b('0x65')]=0x0;this[_0x7b1b('0x66')]=0x0;this[_0x7b1b('0x67')]=0x0;this[_0x7b1b('0x68')]=0x0;this[_0x7b1b('0x69')]=0x0;this[_0x7b1b('0x6a')]=0x0;this[_0x7b1b('0x6b')]=0x0;this[_0x7b1b('0x6c')]=0x0;this[_0x7b1b('0x6d')]=_0x54e0f0[_0x7b1b('0x6e')]||0x14;this['predictiveIntervalMinThreshold']=_0x54e0f0['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x7b1b('0x6f')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x7b1b('0x70')]=0x0;this['erlangCallToSecond']=0x0;this[_0x7b1b('0x71')]=0x0;this[_0x7b1b('0x72')]=0x0;this[_0x7b1b('0x73')]=_0x54e0f0[_0x7b1b('0x73')]||0x1e;this[_0x7b1b('0x74')]=_0x54e0f0[_0x7b1b('0x74')]||![];this[_0x7b1b('0x75')]=_0x54e0f0[_0x7b1b('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x54e0f0[_0x7b1b('0x76')]||![];this[_0x7b1b('0x77')]=_0x54e0f0[_0x7b1b('0x77')]||![];this['monitor_format']=monitorFormat[_0x54e0f0['monitor_format']]?monitorFormat[_0x54e0f0[_0x7b1b('0xc')]]:undefined;this[_0x7b1b('0x78')]=_0x54e0f0[_0x7b1b('0x78')]||![];this['mandatoryDispositionPause']=_0x54e0f0['mandatoryDispositionPause']?_0x54e0f0[_0x7b1b('0x79')]:undefined;}module[_0x7b1b('0x7a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index a16f2fb..898fe0c 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 _0x93f6=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x25979f,_0x32a3eb){var _0x4de4e7=function(_0x32bbdd){while(--_0x32bbdd){_0x25979f['push'](_0x25979f['shift']());}};_0x4de4e7(++_0x32a3eb);}(_0x93f6,0x1f0));var _0x693f=function(_0x401939,_0x26b63a){_0x401939=_0x401939-0x0;var _0x343c3b=_0x93f6[_0x401939];return _0x343c3b;};'use strict';function VtigerAccount(_0x31617c){this['id']=_0x31617c['id']||0x0;this[_0x693f('0x0')]=_0x31617c[_0x693f('0x0')]||'';this[_0x693f('0x1')]=_0x31617c[_0x693f('0x1')]||'';this['accessKey']=_0x31617c[_0x693f('0x2')]||'';this[_0x693f('0x3')]=_0x31617c['remoteUri']||'';this['serverUrl']=_0x31617c[_0x693f('0x4')]||'';this[_0x693f('0x5')]=_0x31617c[_0x693f('0x5')]||{};}module[_0x693f('0x6')]=VtigerAccount; \ No newline at end of file +var _0x98ff=['name','username','accessKey','remoteUri','Configurations','exports'];(function(_0x438b3e,_0x128f17){var _0x1d010e=function(_0x3458d9){while(--_0x3458d9){_0x438b3e['push'](_0x438b3e['shift']());}};_0x1d010e(++_0x128f17);}(_0x98ff,0xba));var _0xf98f=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x98ff[_0x5783f4];return _0x28e380;};'use strict';function VtigerAccount(_0x544e39){this['id']=_0x544e39['id']||0x0;this[_0xf98f('0x0')]=_0x544e39[_0xf98f('0x0')]||'';this[_0xf98f('0x1')]=_0x544e39[_0xf98f('0x1')]||'';this[_0xf98f('0x2')]=_0x544e39['accessKey']||'';this['remoteUri']=_0x544e39[_0xf98f('0x3')]||'';this['serverUrl']=_0x544e39['serverUrl']||'';this['Configurations']=_0x544e39[_0xf98f('0x4')]||{};}module[_0xf98f('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 6136e8b..8fbcc2c 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 _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0xcad7b0,_0x34fd73){var _0x56cf8d=function(_0x332613){while(--_0x332613){_0xcad7b0['push'](_0xcad7b0['shift']());}};_0x56cf8d(++_0x34fd73);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x453299,_0x31452f){var _0x25bd07=function(_0xe1eb87){while(--_0xe1eb87){_0x453299['push'](_0x453299['shift']());}};_0x25bd07(++_0x31452f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index df76e60..4649afb 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 _0x659c=['code','refreshToken','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x1731a9,_0x4fb551){var _0x22b9a5=function(_0x3b62fd){while(--_0x3b62fd){_0x1731a9['push'](_0x1731a9['shift']());}};_0x22b9a5(++_0x4fb551);}(_0x659c,0x1aa));var _0xc659=function(_0x75e866,_0x30b4de){_0x75e866=_0x75e866-0x0;var _0x5e4b64=_0x659c[_0x75e866];return _0x5e4b64;};'use strict';function ZohoAccount(_0x5d69e3){this['id']=_0x5d69e3['id']||0x0;this['name']=_0x5d69e3['name']||'';this[_0xc659('0x0')]=_0x5d69e3[_0xc659('0x0')]||'';this['host']=_0x5d69e3[_0xc659('0x1')]||'';this[_0xc659('0x2')]=_0x5d69e3['zone']||'';this['clientId']=_0x5d69e3[_0xc659('0x3')]||'';this[_0xc659('0x4')]=_0x5d69e3[_0xc659('0x4')]||'';this[_0xc659('0x5')]=_0x5d69e3[_0xc659('0x5')]||'';this[_0xc659('0x6')]=_0x5d69e3['code']||'';this['refreshToken']=_0x5d69e3[_0xc659('0x7')]||'';this['Configurations']=_0x5d69e3['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xeef7=['description','zone','clientId','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x493a96,_0x55d69c){var _0x565afd=function(_0xe8873e){while(--_0xe8873e){_0x493a96['push'](_0x493a96['shift']());}};_0x565afd(++_0x55d69c);}(_0xeef7,0x7d));var _0x7eef=function(_0x3f5d16,_0x231c07){_0x3f5d16=_0x3f5d16-0x0;var _0x3e5df4=_0xeef7[_0x3f5d16];return _0x3e5df4;};'use strict';function ZohoAccount(_0x321fa5){this['id']=_0x321fa5['id']||0x0;this[_0x7eef('0x0')]=_0x321fa5['name']||'';this[_0x7eef('0x1')]=_0x321fa5[_0x7eef('0x1')]||'';this['host']=_0x321fa5['host']||'';this['zone']=_0x321fa5[_0x7eef('0x2')]||'';this[_0x7eef('0x3')]=_0x321fa5[_0x7eef('0x3')]||'';this['clientSecret']=_0x321fa5['clientSecret']||'';this['serverUrl']=_0x321fa5[_0x7eef('0x4')]||'';this[_0x7eef('0x5')]=_0x321fa5[_0x7eef('0x5')]||'';this['refreshToken']=_0x321fa5[_0x7eef('0x6')]||'';this[_0x7eef('0x7')]=_0x321fa5[_0x7eef('0x7')]||{};}module[_0x7eef('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 41e03b6..a5d856d 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 _0x901e=['name','type','campaigntype','queue','Agent','membername','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0x901e,0x1a7));var _0xe901=function(_0x326d35,_0x4f65b3){_0x326d35=_0x326d35-0x0;var _0xd3f8f3=_0x901e[_0x326d35];return _0xd3f8f3;};'use strict';var util=require(_0xe901('0x0'));var _=require(_0xe901('0x1'));var moment=require(_0xe901('0x2'));function checkNameSurname(_0x2229bb,_0x10cb68,_0x46768d){var _0x3d02d5='';if(!_[_0xe901('0x3')](_0x10cb68)&&'string'===typeof _0x10cb68){_0x3d02d5+=_0x10cb68;}if(!_[_0xe901('0x3')](_0x46768d)&&_0xe901('0x4')===typeof _0x46768d){_0x3d02d5+='\x20'+_0x46768d;}if(_0x3d02d5!==''){return _0x3d02d5;}return _0x2229bb;}function Action(_0x570f90,_0x82b025,_0x1663ae,_0x29c8da,_0x398f32){this[_0xe901('0x5')]=_0x1663ae||undefined;this[_0xe901('0x6')]=_0x570f90['id'];this['queue']=_0x82b025[_0xe901('0x7')];this[_0xe901('0x8')]=_0x82b025[_0xe901('0x8')];this[_0xe901('0x9')]=_0xe901('0xa');this['dialAnswer']=![];this['membername']=_['isNil'](_0x570f90[_0xe901('0xb')])?undefined:_0x570f90['Agent'][_0xe901('0x7')];this['channelAgent']=this[_0xe901('0xc')]?util[_0xe901('0xd')](_0xe901('0xe'),this['membername']):_0x29c8da||undefined;this[_0xe901('0xf')]=checkNameSurname(_0x570f90[_0xe901('0x10')][_0xe901('0x11')],_0x570f90[_0xe901('0x10')][_0xe901('0x12')],_0x570f90['Contact'][_0xe901('0x13')]);this[_0xe901('0x14')]=_0x570f90['active']||![];this[_0xe901('0x15')]=_0x570f90[_0xe901('0x10')][_0xe901('0x11')];this[_0xe901('0x16')]=_0x570f90[_0xe901('0x16')];this[_0xe901('0x17')]=_0x570f90[_0xe901('0x17')]||0x0;this[_0xe901('0x18')]=_0x570f90['countcongestionretry']||0x0;this['countnoanswerretry']=_0x570f90['countnoanswerretry']||0x0;this[_0xe901('0x19')]=(_0x570f90[_0xe901('0x17')]||0x0)+(_0x570f90[_0xe901('0x18')]||0x0)+(_0x570f90['countnoanswerretry']||0x0)+(_0x570f90[_0xe901('0x1a')]||0x0)+(_0x570f90[_0xe901('0x1b')]||0x0)+(_0x570f90[_0xe901('0x1c')]||0x0)+(_0x570f90[_0xe901('0x1d')]||0x0)+(_0x570f90[_0xe901('0x1e')]||0x0);this['countnosuchnumberretry']=_0x570f90[_0xe901('0x1a')]||0x0;this['countdropretry']=_0x570f90[_0xe901('0x1b')]||0x0;this['countabandonedretry']=_0x570f90[_0xe901('0x1c')]||0x0;this[_0xe901('0x1d')]=_0x570f90[_0xe901('0x1d')]||0x0;this[_0xe901('0x1e')]=_0x570f90[_0xe901('0x1e')]||0x0;this[_0xe901('0x1f')]=_0x570f90[_0xe901('0x1f')];this['callbackuniqueid']=_0x570f90['callbackuniqueid'];this[_0xe901('0x20')]=_0x570f90[_0xe901('0x20')];this['recallme']=_0x570f90[_0xe901('0x21')];this['ContactId']=_0x570f90['ContactId'];this[_0xe901('0x22')]=_0x570f90[_0xe901('0x22')];this[_0xe901('0x23')]=_[_0xe901('0x3')](_0x570f90[_0xe901('0xb')])?_0x570f90['UserId']:_0x570f90['Agent']['id'];this[_0xe901('0x24')]=_0x570f90[_0xe901('0x24')];this[_0xe901('0x25')]='';this[_0xe901('0x26')]='';}Action['prototype'][_0xe901('0x27')]=function(){return util[_0xe901('0xd')](_0xe901('0x28'),this[_0xe901('0xf')],this[_0xe901('0x29')]);};module[_0xe901('0x2a')]=Action; \ No newline at end of file +var _0x519e=['originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','util','lodash','moment','string','isNil','uniqueid','idContact','queue','type','campaigntype','membername','Agent','name','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x27bd2c,_0x24bd98){var _0x3784ea=function(_0x4ca802){while(--_0x4ca802){_0x27bd2c['push'](_0x27bd2c['shift']());}};_0x3784ea(++_0x24bd98);}(_0x519e,0x86));var _0xe519=function(_0x136ce4,_0xe377f2){_0x136ce4=_0x136ce4-0x0;var _0x229da1=_0x519e[_0x136ce4];return _0x229da1;};'use strict';var util=require(_0xe519('0x0'));var _=require(_0xe519('0x1'));var moment=require(_0xe519('0x2'));function checkNameSurname(_0x89ec0b,_0x4038a8,_0x17b437){var _0x20668e='';if(!_['isNil'](_0x4038a8)&&_0xe519('0x3')===typeof _0x4038a8){_0x20668e+=_0x4038a8;}if(!_[_0xe519('0x4')](_0x17b437)&&_0xe519('0x3')===typeof _0x17b437){_0x20668e+='\x20'+_0x17b437;}if(_0x20668e!==''){return _0x20668e;}return _0x89ec0b;}function Action(_0x170876,_0x2b317a,_0x3d51e6,_0x2a7327,_0xef346b){this[_0xe519('0x5')]=_0x3d51e6||undefined;this[_0xe519('0x6')]=_0x170876['id'];this[_0xe519('0x7')]=_0x2b317a['name'];this[_0xe519('0x8')]=_0x2b317a[_0xe519('0x8')];this[_0xe519('0x9')]=_0xe519('0x7');this['dialAnswer']=![];this[_0xe519('0xa')]=_[_0xe519('0x4')](_0x170876['Agent'])?undefined:_0x170876[_0xe519('0xb')][_0xe519('0xc')];this[_0xe519('0xd')]=this[_0xe519('0xa')]?util[_0xe519('0xe')](_0xe519('0xf'),this['membername']):_0x2a7327||undefined;this[_0xe519('0x10')]=checkNameSurname(_0x170876[_0xe519('0x11')][_0xe519('0x12')],_0x170876[_0xe519('0x11')][_0xe519('0x13')],_0x170876['Contact'][_0xe519('0x14')]);this[_0xe519('0x15')]=_0x170876['active']||![];this['calleridnum']=_0x170876[_0xe519('0x11')]['phone'];this[_0xe519('0x16')]=_0x170876['scheduledat'];this[_0xe519('0x17')]=_0x170876[_0xe519('0x17')]||0x0;this[_0xe519('0x18')]=_0x170876['countcongestionretry']||0x0;this['countnoanswerretry']=_0x170876[_0xe519('0x19')]||0x0;this['countglobal']=(_0x170876[_0xe519('0x17')]||0x0)+(_0x170876[_0xe519('0x18')]||0x0)+(_0x170876[_0xe519('0x19')]||0x0)+(_0x170876['countnosuchnumberretry']||0x0)+(_0x170876[_0xe519('0x1a')]||0x0)+(_0x170876['countabandonedretry']||0x0)+(_0x170876['countmachineretry']||0x0)+(_0x170876[_0xe519('0x1b')]||0x0);this[_0xe519('0x1c')]=_0x170876[_0xe519('0x1c')]||0x0;this[_0xe519('0x1a')]=_0x170876['countdropretry']||0x0;this[_0xe519('0x1d')]=_0x170876[_0xe519('0x1d')]||0x0;this[_0xe519('0x1e')]=_0x170876[_0xe519('0x1e')]||0x0;this[_0xe519('0x1b')]=_0x170876[_0xe519('0x1b')]||0x0;this[_0xe519('0x1f')]=_0x170876[_0xe519('0x1f')];this['callbackuniqueid']=_0x170876['callbackuniqueid'];this[_0xe519('0x20')]=_0x170876[_0xe519('0x20')];this[_0xe519('0x21')]=_0x170876[_0xe519('0x21')];this[_0xe519('0x22')]=_0x170876[_0xe519('0x22')];this[_0xe519('0x23')]=_0x170876[_0xe519('0x23')];this[_0xe519('0x24')]=_[_0xe519('0x4')](_0x170876[_0xe519('0xb')])?_0x170876[_0xe519('0x24')]:_0x170876['Agent']['id'];this[_0xe519('0x25')]=_0x170876[_0xe519('0x25')];this[_0xe519('0x26')]='';this['originatecalleridname']='';}Action[_0xe519('0x27')][_0xe519('0x28')]=function(){return util[_0xe519('0xe')](_0xe519('0x29'),this['calleridname'],this[_0xe519('0x2a')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 8015e8f..3ecc577 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 _0x5dd4=['[syncHangup][talking]','callProgressDetectingCustomer','[syncHangup][talking][cause]','cause','statedesc','dialQueueProject','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','moment','ioredis','../../../config/environment','../../../config/logger','actionPreview','./rpcDb','./action','redis','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','blindtransfer','syncBlindTransfer','name','answered','loggedIn','talking','unmanaged','abandoned','loggedInDb','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','startPredictive','startProgressive','Trunk','active','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','hasOwnProperty','booked','type','outbound','clockClearZombieChannels','clearZombieChannels','preview','setMessage','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','Queue','queue','pTalking','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','recallMe','getContactRecallMe','agentReadyId','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','pTalking:\x20','acw','custom:agentConnectPreview','custom:agentcomplete','complete','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusyGlobal]','[callProgressDetectingCustomer][logBusy]','scheduledAt','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','then','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','unlock','unlockContact','disableContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','dialActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','substring','trim','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerId','callerid','getCallerIdRandom','originatecalleridname','originatecalleridnum','addVariables','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','lookAgent','clone','response','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]'];(function(_0x15336e,_0x3fb381){var _0x3ead42=function(_0x599ce1){while(--_0x599ce1){_0x15336e['push'](_0x15336e['shift']());}};_0x3ead42(++_0x3fb381);}(_0x5dd4,0x15e));var _0x45dd=function(_0x318a0d,_0x5ed3bb){_0x318a0d=_0x318a0d-0x0;var _0x3e56c2=_0x5dd4[_0x318a0d];return _0x3e56c2;};'use strict';var util=require(_0x45dd('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x45dd('0x1'));var md5=require('md5');var Redis=require(_0x45dd('0x2'));var config=require(_0x45dd('0x3'));var logger=require(_0x45dd('0x4'))('preview');var loggerAction=require(_0x45dd('0x4'))(_0x45dd('0x5'));var ami=require('../ami');var rpcDb=require(_0x45dd('0x6'));var Action=require(_0x45dd('0x7'));var ut=require('./util/util');config[_0x45dd('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x45dd('0x8')]));var Sequence=function(){};Sequence[_0x45dd('0x9')][_0x45dd('0xa')]=function(_0x39371a){this['tail']=this[_0x45dd('0xb')]?this[_0x45dd('0xb')]['finally'](_0x39371a):_0x39371a();};function Preview(_0x2cb7d0){this[_0x45dd('0xc')]=new Sequence();this[_0x45dd('0xd')]=_0x2cb7d0[_0x45dd('0xe')];this['trunks']=_0x2cb7d0[_0x45dd('0xf')];this[_0x45dd('0x10')]={};this[_0x45dd('0x11')]=_0x2cb7d0[_0x45dd('0x11')];this['clockClearZombieChannels']=0x0;ami['on'](_0x45dd('0x12'),this[_0x45dd('0x13')][_0x45dd('0x14')](this));ami['on'](_0x45dd('0x15'),this[_0x45dd('0x16')][_0x45dd('0x14')](this));ami['on'](_0x45dd('0x17'),this[_0x45dd('0x18')][_0x45dd('0x14')](this));ami['on'](_0x45dd('0x19'),this[_0x45dd('0x1a')][_0x45dd('0x14')](this));ami['on'](_0x45dd('0x1b'),this['syncNewExten'][_0x45dd('0x14')](this));ami['on'](_0x45dd('0x1c'),this[_0x45dd('0x1d')][_0x45dd('0x14')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x45dd('0x14')](this));ami['on'](_0x45dd('0x1e'),this[_0x45dd('0x1f')][_0x45dd('0x14')](this));this['loopCampaigns'](this[_0x45dd('0xd')]);}function emit(_0x2b07c5,_0x353090,_0x23caf2){io['to'](_0x2b07c5)['emit'](_0x353090,_0x23caf2);}function emitCampaignPreview(_0x301643){if(_0x301643['type']==='outbound'){var _0x4217eb={'id':_0x301643['id'],'name':_0x301643[_0x45dd('0x20')],'strategy':_0x301643['strategy'],'answered':_0x301643[_0x45dd('0x21')],'available':_0x301643['available'],'loggedIn':_0x301643[_0x45dd('0x22')],'pTalking':_0x301643['pTalking'],'sumBillable':_0x301643['sumBillable'],'sumDuration':_0x301643['sumDuration'],'sumHoldTime':_0x301643['sumHoldTime']||0x0,'talking':_0x301643[_0x45dd('0x23')],'total':_0x301643['total'],'type':_0x301643['type'],'unmanaged':_0x301643[_0x45dd('0x24')],'abandoned':_0x301643[_0x45dd('0x25')],'waiting':_0x301643['waiting'],'loggedInDb':_0x301643[_0x45dd('0x26')],'dialActive':_0x301643['dialActive'],'dialMethod':_0x301643[_0x45dd('0x27')],'dialOriginateCallerIdName':_0x301643['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x301643[_0x45dd('0x28')],'dialOriginateTimeout':_0x301643[_0x45dd('0x29')],'dialPrefix':_0x301643[_0x45dd('0x2a')],'outboundAnswerAgiCallsDay':_0x301643[_0x45dd('0x2b')],'outboundAnswerCallsDay':_0x301643[_0x45dd('0x2c')],'outboundBlacklistCallsDay':_0x301643[_0x45dd('0x2d')],'outboundBusyCallsDay':_0x301643['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x301643['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x301643[_0x45dd('0x2e')],'outboundDropCallsDayCallersExit':_0x301643['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x301643['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x301643[_0x45dd('0x2f')],'outboundNoSuchCallsDay':_0x301643[_0x45dd('0x30')],'outboundOriginateFailureCallsDay':_0x301643[_0x45dd('0x31')],'outboundReCallsDay':_0x301643[_0x45dd('0x32')],'outboundRejectCallsDay':_0x301643[_0x45dd('0x33')],'outboundUnknownCallsDay':_0x301643[_0x45dd('0x34')],'outboundAbandonedCallsDay':_0x301643[_0x45dd('0x35')],'predictiveIntervalAnsweredCalls':_0x301643[_0x45dd('0x36')],'predictiveIntervalAvgHoldtime':_0x301643[_0x45dd('0x37')],'predictiveIntervalAvgTalktime':_0x301643[_0x45dd('0x38')],'predictiveIntervalDroppedCallsCallersExit':_0x301643[_0x45dd('0x39')],'predictiveIntervalDroppedCallsTimeout':_0x301643[_0x45dd('0x3a')],'predictiveIntervalErlangCalls':_0x301643['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x301643[_0x45dd('0x3b')],'predictiveIntervalHitRate':_0x301643[_0x45dd('0x3c')],'predictiveIntervalMultiplicativeFactor':_0x301643[_0x45dd('0x3d')],'predictiveIntervalPauses':_0x301643['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x301643[_0x45dd('0x3e')],'predictiveIntervalTotalCalls':_0x301643['predictiveIntervalTotalCalls'],'message':_0x301643[_0x45dd('0x3f')],'originated':_0x301643[_0x45dd('0x40')],'erlangCalls':_0x301643[_0x45dd('0x41')],'erlangCallToSecond':_0x301643[_0x45dd('0x42')],'erlangAbandonmentRate':_0x301643['erlangAbandonmentRate'],'erlangBusyFactor':_0x301643['erlangBusyFactor'],'startPredictive':_0x301643[_0x45dd('0x43')],'startProgressive':_0x301643[_0x45dd('0x44')]};if(_0x301643[_0x45dd('0x45')]){_0x4217eb['Trunk']={'id':_0x301643[_0x45dd('0x45')]['id'],'name':_0x301643['Trunk'][_0x45dd('0x20')],'active':_0x301643['Trunk'][_0x45dd('0x46')],'callerid':_0x301643['Trunk']['callerid']};}if(_0x301643['Interval']){_0x4217eb[_0x45dd('0x47')]={'id':_0x301643[_0x45dd('0x47')]['id'],'name':_0x301643[_0x45dd('0x47')][_0x45dd('0x20')]};}var _0x13c074=md5(JSON[_0x45dd('0x48')](_0x4217eb));if(_0x301643[_0x45dd('0x49')]!==_0x13c074){_0x301643[_0x45dd('0x49')]=_0x13c074;emit(util[_0x45dd('0x4a')](_0x45dd('0x4b'),_0x4217eb[_0x45dd('0x20')]),_0x45dd('0x4c'),_0x4217eb);}}}function emitVoiceQueueChannelRemove(_0x21f594){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x45dd('0x48')](_0x21f594));emit(util['format'](_0x45dd('0x4b'),_0x21f594[_0x45dd('0x20')]),_0x45dd('0x4d'),_0x21f594);}function notSendMessagesQueue(_0x535aa1){if(_0x535aa1[_0x45dd('0x4e')]){if(_0x535aa1['originated']===0x0&&_0x535aa1['pTalking']===0x0){_0x535aa1[_0x45dd('0x4e')]=![];_0x535aa1[_0x45dd('0x4f')]=0x0;_0x535aa1[_0x45dd('0x50')]=0x0;_0x535aa1[_0x45dd('0x3f')]=_0x45dd('0x51');ut[_0x45dd('0x52')](_0x45dd('0x53'),_0x535aa1[_0x45dd('0x20')]+_0x45dd('0x54'));}else{_0x535aa1[_0x45dd('0x3f')]=_0x45dd('0x55');ut[_0x45dd('0x52')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x535aa1['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x535aa1);}}Preview['prototype']['loopCampaigns']=function(){var _0x48656c=this;setInterval(function(){_0x48656c[_0x45dd('0x56')]();},0x7cf);};Preview[_0x45dd('0x9')][_0x45dd('0x56')]=function(){var _0x57530c=this[_0x45dd('0xd')];this['clockClearZombieChannels']+=0x1;for(var _0x498025 in _0x57530c){if(_0x57530c[_0x45dd('0x57')](_0x498025)&&(_0x57530c[_0x498025][_0x45dd('0x27')]==='preview'||_0x57530c[_0x498025][_0x45dd('0x27')]===_0x45dd('0x58'))&&_0x57530c[_0x498025][_0x45dd('0x59')]===_0x45dd('0x5a')){if(this[_0x45dd('0x5b')]>0x7){this[_0x45dd('0x5b')]=0x0;this[_0x45dd('0x5c')]();}}if(_0x57530c['hasOwnProperty'](_0x498025)&&_0x57530c[_0x498025][_0x45dd('0x27')]===_0x45dd('0x5d')&&_0x57530c[_0x498025][_0x45dd('0x59')]==='outbound'){if(_0x57530c[_0x498025]['dialActive']){this[_0x45dd('0x5e')](_0x57530c[_0x498025]);this['recallMe'](_0x57530c[_0x498025]);}else{notSendMessagesQueue(_0x57530c[_0x498025]);}}}};Preview[_0x45dd('0x9')][_0x45dd('0x5f')]=function(_0xaa24c7){var _0x305300=this;this[_0x45dd('0xc')][_0x45dd('0xa')](function(){if(!_[_0x45dd('0x60')](_0x305300['actions'][_0xaa24c7])){loggerAction[_0x45dd('0x61')](_0x45dd('0x62'),_0xaa24c7,_0x45dd('0x63'),_0x305300[_0x45dd('0x10')][_0xaa24c7][_0x45dd('0x64')],'originated:\x20',JSON[_0x45dd('0x48')](_0x305300['campaignsPreview'][_0x305300[_0x45dd('0x10')][_0xaa24c7][_0x45dd('0x64')]][_0x45dd('0x40')]),'pTalking:\x20',JSON[_0x45dd('0x48')](_0x305300[_0x45dd('0xd')][_0x305300[_0x45dd('0x10')][_0xaa24c7][_0x45dd('0x64')]][_0x45dd('0x65')]),JSON['stringify'](_0x305300[_0x45dd('0x10')][_0xaa24c7]['dialAnswer']),JSON[_0x45dd('0x48')](_[_0x45dd('0x66')](_0x305300['actions'][_0xaa24c7],[_0x45dd('0x67'),_0x45dd('0x68'),_0x45dd('0x69'),_0x45dd('0x6a')])));return ami[_0x45dd('0x6b')]({'action':_0x45dd('0x6c'),'channel':_0x305300['actions'][_0xaa24c7][_0x45dd('0x6d')]})[_0x45dd('0x6e')](function(_0x38feea){if(_0x38feea['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x305300[_0x45dd('0x10')][_0xaa24c7]){ut[_0x45dd('0x6f')](_0x305300[_0x45dd('0xd')][_0x305300[_0x45dd('0x10')][_0xaa24c7][_0x45dd('0x64')]],_0x45dd('0x70'));if(_0x305300[_0x45dd('0x10')][_0xaa24c7][_0x45dd('0x71')]===!![]){ut[_0x45dd('0x72')](_0x305300[_0x45dd('0xd')][_0x305300['actions'][_0xaa24c7][_0x45dd('0x64')]],_0x45dd('0x70'));ut[_0x45dd('0x73')](_0x45dd('0x74')+_0xaa24c7,_0x305300['actions'][_0xaa24c7][_0x45dd('0x64')]);}ut[_0x45dd('0x73')](_0x45dd('0x75')+_0xaa24c7,_0x305300[_0x45dd('0x10')][_0xaa24c7]['queue']);delete _0x305300[_0x45dd('0x10')][_0xaa24c7];}},0x2328);}});}});};Preview[_0x45dd('0x9')]['clearZombieChannels']=function(){var _0x41460e=this;loggerAction[_0x45dd('0x61')](_0x45dd('0x76'),_['size'](this[_0x45dd('0x10')]));for(var _0x421cb4 in this['actions']){if(_0x41460e[_0x45dd('0x10')][_0x45dd('0x57')](_0x421cb4)){_0x41460e[_0x45dd('0x5f')](_0x421cb4);}}};Preview[_0x45dd('0x9')][_0x45dd('0x77')]=function(_0x18c705){var _0x1d2cec=this;rpcDb[_0x45dd('0x78')](_0x18c705['id'],ut[_0x45dd('0x79')](this['agents']))['then'](function(_0x1cf331){if(!_[_0x45dd('0x60')](_0x1cf331)){for(var _0x416534=0x0;_0x416534<_0x1cf331[_0x45dd('0x7a')];_0x416534+=0x1){if(ut[_0x45dd('0x7b')](_0x1cf331[_0x416534]['scheduledat'])<_0x18c705[_0x45dd('0x7c')]*0x3c){if(_0x1cf331[_0x416534][_0x45dd('0x7d')]&&!_0x1cf331[_0x416534]['Agent'][_0x45dd('0x7e')]){_0x1d2cec[_0x45dd('0x7f')](_0x1cf331[_0x416534]['id'])['then'](ut[_0x45dd('0x80')](_0x45dd('0x81')))[_0x45dd('0x6e')](ut['logger2']('[RecallMe]'));}else{rpcDb['disableContact'](_0x1cf331[_0x416534]['id']);}}else{var _0x5a1de8=new Action(_0x1cf331[_0x416534],_0x18c705);_0x5a1de8[_0x45dd('0x82')]=moment()[_0x45dd('0x4a')](_0x45dd('0x83'));_0x18c705[_0x45dd('0x32')]+=0x1;ut['logCustomer'](_0x5a1de8,0x17,'RecallInQueue');if(_0x18c705[_0x45dd('0x84')]){rpcDb[_0x45dd('0x85')](ut[_0x45dd('0x86')](_0x1cf331[_0x416534]));rpcDb[_0x45dd('0x87')](_0x5a1de8,_0x45dd('0x88'));}else{ut[_0x45dd('0x89')](_0x5a1de8,0x16,_0x45dd('0x8a'));rpcDb[_0x45dd('0x87')](_0x5a1de8,'[HistoryRecallClose]');rpcDb[_0x45dd('0x8b')](_0x5a1de8,_0x45dd('0x8c'));}}}}})[_0x45dd('0x6e')](ut[_0x45dd('0x80')](_0x45dd('0x8d')));};Preview[_0x45dd('0x9')][_0x45dd('0x5e')]=function(_0x1bbe67){_0x1bbe67[_0x45dd('0x4e')]=!![];if(ut[_0x45dd('0x8e')](_0x1bbe67[_0x45dd('0x22')])){_0x1bbe67[_0x45dd('0x3f')]=_0x45dd('0x8f');}else if(!ut['isActive'](_0x1bbe67['dialActive'])){_0x1bbe67[_0x45dd('0x3f')]=_0x45dd('0x51');}else if(!this[_0x45dd('0x90')](_0x1bbe67[_0x45dd('0x45')])){if(!this[_0x45dd('0x90')](_0x1bbe67[_0x45dd('0x91')])){_0x1bbe67['message']=_0x45dd('0x92');}else{_0x1bbe67['message']=_0x45dd('0x93');}}else{_0x1bbe67[_0x45dd('0x3f')]=_0x45dd('0x93');}emitCampaignPreview(_0x1bbe67);};Preview[_0x45dd('0x9')]['callProgressDetectingCustomer']=function(_0x1ff3cc,_0x20d347,_0x32a509){var _0x836b13=this;var _0x24a014=this[_0x45dd('0x10')][_0x20d347];var _0xb0c978=this[_0x45dd('0xd')][_0x24a014[_0x45dd('0x64')]];var _0x3f9f5c;if(_0xb0c978){switch(_0x32a509){case'1':_0xb0c978['outboundNoSuchCallsDay']+=0x1;_0x24a014[_0x45dd('0x94')]+=0x1;_0x24a014['countglobal']=ut['totalGlobal'](_0x24a014);ut[_0x45dd('0x89')](_0x24a014,0x0,_0x45dd('0x95'));ami[_0x45dd('0x96')](_0x45dd('0x97'),ut[_0x45dd('0x98')](_0x24a014,_0x45dd('0x99')));rpcDb[_0x45dd('0x87')](_0x24a014,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x45dd('0x9a')](_0x24a014)>=_0xb0c978[_0x45dd('0x9b')]){_0x3f9f5c=ut[_0x45dd('0x9c')](_0x24a014,0xf,_0x45dd('0x9d'));rpcDb[_0x45dd('0x8b')](_0x3f9f5c,_0x45dd('0x9e'));}else{if(_0x24a014[_0x45dd('0x94')]>=_0xb0c978[_0x45dd('0x9f')]){rpcDb[_0x45dd('0x8b')](_0x24a014,_0x45dd('0x9e'));}else{rpcDb[_0x45dd('0xa0')](ut['scheduledAt'](_0x24a014,_0x45dd('0x94'),_0xb0c978[_0x45dd('0xa1')]),_0x24a014[_0x45dd('0xa2')],_0x24a014[_0x45dd('0xa3')]);}}delete this[_0x45dd('0x10')][_0x1ff3cc[_0x45dd('0xa4')]];break;case _0x45dd('0xa5'):var _0x491eb4=moment()['format'](_0x45dd('0x83'));_0x24a014[_0x45dd('0xa6')]=_0x491eb4;_0x24a014[_0x45dd('0xa7')]=_0x491eb4;_0x24a014[_0x45dd('0x71')]=!![];_0xb0c978[_0x45dd('0x65')]+=0x1;logger[_0x45dd('0x61')]('[syncHangup][talking][increment]',_0x24a014['uniqueid'],'\x20Queue',_0xb0c978[_0x45dd('0x20')],_0x45dd('0xa8'),_0xb0c978[_0x45dd('0x65')]);ami[_0x45dd('0x96')]('custom:agentconnect',ut[_0x45dd('0x98')](_0x24a014,'connect'));if(_0xb0c978[_0x45dd('0xa9')]){ami[_0x45dd('0x96')](_0x45dd('0xaa'),ut['buildAcw'](_0x24a014));}break;case'16':ami[_0x45dd('0x96')](_0x45dd('0xab'),ut[_0x45dd('0x98')](_0x24a014,'complete'));emitVoiceQueueChannelRemove(ut[_0x45dd('0x98')](_0x24a014,_0x45dd('0xac')));_0xb0c978[_0x45dd('0x2c')]+=0x1;_0xb0c978['total']+=0x1;_0xb0c978[_0x45dd('0x21')]+=0x1;ut['decrementTalkink'](_0xb0c978,_0x45dd('0xad'));_0x24a014[_0x45dd('0xae')]=ut[_0x45dd('0x9a')](_0x24a014);ut[_0x45dd('0x89')](_0x24a014,0x4,_0x45dd('0xaf'));rpcDb['createCustomerHistory'](_0x24a014,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x45dd('0x8b')](_0x24a014,_0x45dd('0xb0'));rpcDb[_0x45dd('0xb1')](_0x24a014);_0xb0c978[_0x45dd('0xb2')]+=_0x24a014[_0x45dd('0xb3')];_0xb0c978[_0x45dd('0xb4')]+=_0x24a014[_0x45dd('0xb3')];logger[_0x45dd('0x61')](_0x45dd('0xb5'),_0x24a014[_0x45dd('0xb6')],_0x45dd('0xb7'),_0xb0c978[_0x45dd('0x20')],'pTalking:\x20',_0xb0c978[_0x45dd('0x65')]);delete this[_0x45dd('0x10')][_0x1ff3cc[_0x45dd('0xa4')]];break;case'BUSY':_0xb0c978[_0x45dd('0xb8')]+=0x1;_0x24a014[_0x45dd('0xb9')]+=0x1;_0x24a014[_0x45dd('0xae')]=ut[_0x45dd('0x9a')](_0x24a014);ut[_0x45dd('0x89')](_0x24a014,0x5,_0x45dd('0xba'));ami[_0x45dd('0x96')](_0x45dd('0xbb'),ut[_0x45dd('0x98')](_0x24a014,_0x45dd('0xbc')));rpcDb[_0x45dd('0x87')](_0x24a014,'[callProgressDetectingCustomer][logBusy]');if(ut['totalGlobal'](_0x24a014)>=_0xb0c978[_0x45dd('0x9b')]){_0x3f9f5c=ut[_0x45dd('0x9c')](_0x24a014,0xf,_0x45dd('0x9d'));rpcDb[_0x45dd('0x8b')](_0x3f9f5c,_0x45dd('0xbd'));}else{if(_0x24a014['countbusyretry']>=_0xb0c978['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x24a014,_0x45dd('0xbe'));}else{rpcDb['rescheduleContact'](ut[_0x45dd('0xbf')](_0x24a014,'countbusyretry',_0xb0c978[_0x45dd('0xc0')]),_0x24a014[_0x45dd('0xa2')],_0x24a014[_0x45dd('0xa3')]);}}break;case _0x45dd('0xc1'):_0xb0c978['outboundNoAnswerCallsDay']+=0x1;_0x24a014[_0x45dd('0xc2')]+=0x1;_0x24a014['countglobal']=ut[_0x45dd('0x9a')](_0x24a014);ut['logCustomer'](_0x24a014,0x3,_0x45dd('0xc3'));ami[_0x45dd('0x96')](_0x45dd('0xc4'),ut[_0x45dd('0x98')](_0x24a014,'noanswer'));rpcDb[_0x45dd('0x87')](_0x24a014,_0x45dd('0xc5'));if(ut['totalGlobal'](_0x24a014)>=_0xb0c978['dialGlobalMaxRetry']){_0x3f9f5c=ut['cloneAction'](_0x24a014,0xf,_0x45dd('0x9d'));rpcDb[_0x45dd('0x8b')](_0x3f9f5c,_0x45dd('0xc6'));}else{if(_0x24a014[_0x45dd('0xc2')]>=_0xb0c978[_0x45dd('0xc7')]){rpcDb[_0x45dd('0x8b')](_0x24a014,_0x45dd('0xc5'));}else{rpcDb[_0x45dd('0xa0')](ut['scheduledAt'](_0x24a014,_0x45dd('0xc2'),_0xb0c978['dialNoAnswerRetryFrequency']),_0x24a014[_0x45dd('0xa2')],_0x24a014[_0x45dd('0xa3')]);}}break;case _0x45dd('0xc8'):_0xb0c978[_0x45dd('0xc9')]+=0x1;_0x24a014[_0x45dd('0xca')]+=0x1;_0x24a014[_0x45dd('0xae')]=ut[_0x45dd('0x9a')](_0x24a014);ut[_0x45dd('0x89')](_0x24a014,0x8,'Congestion');ami[_0x45dd('0x96')](_0x45dd('0xcb'),ut[_0x45dd('0x98')](_0x24a014,_0x45dd('0xcc')));rpcDb['createCustomerHistory'](_0x24a014,_0x45dd('0xcd'));if(ut[_0x45dd('0x9a')](_0x24a014)>=_0xb0c978['dialGlobalMaxRetry']){_0x3f9f5c=ut[_0x45dd('0x9c')](_0x24a014,0xf,_0x45dd('0x9d'));rpcDb[_0x45dd('0x8b')](_0x3f9f5c,_0x45dd('0xce'));}else{if(_0x24a014['countcongestionretry']>=_0xb0c978['dialCongestionMaxRetry']){rpcDb[_0x45dd('0x8b')](_0x24a014,_0x45dd('0xcd'));}else{rpcDb[_0x45dd('0xa0')](ut[_0x45dd('0xbf')](_0x24a014,'countcongestionretry',_0xb0c978[_0x45dd('0xc0')]),_0x24a014[_0x45dd('0xa2')],_0x24a014[_0x45dd('0xa3')]);}}break;case'CANCEL':_0xb0c978[_0x45dd('0x33')]+=0x1;_0x24a014[_0x45dd('0xcf')]+=0x1;_0x24a014[_0x45dd('0xae')]=ut['totalGlobal'](_0x24a014);ut[_0x45dd('0x89')](_0x24a014,0x14,'AgentReject');ami[_0x45dd('0x96')](_0x45dd('0xd0'),ut[_0x45dd('0x98')](_0x24a014,_0x45dd('0xd1')));rpcDb[_0x45dd('0x87')](_0x24a014,_0x45dd('0xd2'));if(ut[_0x45dd('0x9a')](_0x24a014)>=_0xb0c978[_0x45dd('0x9b')]){_0x3f9f5c=ut[_0x45dd('0x9c')](_0x24a014,0x14,'AgentReject');rpcDb[_0x45dd('0x8b')](_0x3f9f5c,_0x45dd('0xd3'));}else{if(_0x24a014[_0x45dd('0xcf')]>=_0xb0c978['dialAgentRejectMaxRetry']){rpcDb[_0x45dd('0x8b')](_0x24a014,_0x45dd('0xd3'));}else{rpcDb[_0x45dd('0xa0')](ut[_0x45dd('0xbf')](_0x24a014,_0x45dd('0xcf'),_0xb0c978[_0x45dd('0xd4')]),_0x24a014[_0x45dd('0xa2')],_0x24a014['activeContact']);}}break;case _0x45dd('0xd5'):_0xb0c978[_0x45dd('0x35')]+=0x1;_0x24a014[_0x45dd('0xd6')]+=0x1;_0x24a014[_0x45dd('0xae')]=ut['totalGlobal'](_0x24a014);ut[_0x45dd('0x89')](_0x24a014,0xb,_0x45dd('0xd7'));rpcDb[_0x45dd('0x87')](_0x24a014,_0x45dd('0xd8'));if(ut[_0x45dd('0x9a')](_0x24a014)>=_0xb0c978[_0x45dd('0x9b')]){_0x3f9f5c=ut['cloneAction'](_0x24a014,0xf,_0x45dd('0x9d'));rpcDb[_0x45dd('0x8b')](_0x3f9f5c,_0x45dd('0xd8'));}else{if(_0x24a014[_0x45dd('0xd9')]>=_0xb0c978[_0x45dd('0xda')]){rpcDb[_0x45dd('0x8b')](_0x24a014,_0x45dd('0xd8'));}else{rpcDb['rescheduleContact'](ut[_0x45dd('0xbf')](_0x24a014,_0x45dd('0xd6'),_0xb0c978[_0x45dd('0xdb')]),_0x24a014[_0x45dd('0xa2')],_0x24a014[_0x45dd('0xa3')]);}}break;default:if(_0x24a014[_0x45dd('0x71')]){ut[_0x45dd('0x72')](_0xb0c978,_0x45dd('0xdc'));ut[_0x45dd('0x73')](_0x45dd('0xdd')+_0xb0c978['name'],_0x1ff3cc);}_0xb0c978[_0x45dd('0x34')]+=0x1;_0x24a014['countglobal']=ut[_0x45dd('0x9a')](_0x24a014);ut[_0x45dd('0x89')](_0x24a014,0xc,_0x1ff3cc['cause-txt']||_0x1ff3cc[_0x45dd('0xde')]);rpcDb[_0x45dd('0x87')](_0x24a014,_0x45dd('0xdf'));if(ut[_0x45dd('0x9a')](_0x24a014)>=_0xb0c978['dialGlobalMaxRetry']){_0x3f9f5c=ut['cloneAction'](_0x24a014,0xf,'Global');rpcDb['createCustomerFinal'](_0x3f9f5c,_0x45dd('0xe0'));}else{rpcDb['createCustomerFinal'](_0x24a014,_0x45dd('0xe0'));}delete this[_0x45dd('0x10')][_0x1ff3cc['linkedid']];}if(!(_0x24a014[_0x45dd('0x71')]&&_0x32a509==='16')){ut[_0x45dd('0x6f')](_0xb0c978,'[callProgressDetectingCustomer]');logger[_0x45dd('0x61')](_0x45dd('0xe1'),_0x24a014['uniqueid'],_0x45dd('0xb7'),_0xb0c978[_0x45dd('0x20')],_0x45dd('0xe2'),_0xb0c978[_0x45dd('0x40')]);}if(_0x32a509!=='ANSWER'){delete this['actions'][_0x1ff3cc[_0x45dd('0xa4')]];delete this['actions'][_0x1ff3cc[_0x45dd('0xe3')]];}}};Preview['prototype'][_0x45dd('0xe4')]=function(_0x1158e1,_0x1c73cb,_0x84c99d){if(_[_0x45dd('0xe5')](_0x1c73cb)&&_0x45dd('0xe6')!==typeof _0x1c73cb){return;}if(_[_0x45dd('0xe5')](_0x84c99d)&&_0x45dd('0xe6')!==typeof _0x84c99d){return;}switch(_0x84c99d[_0x45dd('0xe7')]){case'0':ut[_0x45dd('0xe8')](_0x1158e1,0x0,_0x45dd('0x95'));rpcDb[_0x45dd('0xe9')](_0x1158e1,_0x45dd('0xea'));break;case'3':ut[_0x45dd('0xe8')](_0x1158e1,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x1158e1,_0x45dd('0xeb'));break;case'5':ut[_0x45dd('0xe8')](_0x1158e1,0x5,_0x45dd('0xba'));rpcDb[_0x45dd('0xe9')](_0x1158e1,_0x45dd('0xec'));break;case'8':ut[_0x45dd('0xe8')](_0x1158e1,0x8,_0x45dd('0xed'));rpcDb[_0x45dd('0xe9')](_0x1158e1,_0x45dd('0xee'));break;case'22':ut[_0x45dd('0xe8')](_0x1158e1,0x16,_0x45dd('0xef'));rpcDb[_0x45dd('0xe9')](_0x1158e1,_0x45dd('0xf0'));break;default:ut[_0x45dd('0xe8')](_0x1158e1,0xc,_0x84c99d[_0x45dd('0xe7')]);rpcDb[_0x45dd('0xe9')](_0x1158e1,_0x45dd('0xee'));}ut[_0x45dd('0x6f')](_0x1c73cb,'[callProgressDetectingAgent]');logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x1158e1[_0x45dd('0xb6')],'\x20Queue',_0x1c73cb[_0x45dd('0x20')],_0x45dd('0xe2'),_0x1c73cb['originated']);delete this[_0x45dd('0x10')][_0x1158e1[_0x45dd('0xb6')]];};Preview[_0x45dd('0x9')][_0x45dd('0xf1')]=function(_0x262e0c,_0x4e9421,_0x1b801d,_0x5792ec,_0x2af238){var _0x1d14ba=this;return new BPromise(function(_0x5c7eaf,_0x4bc5c8){if(_['isNil'](_0x4e9421)||_[_0x45dd('0x60')](_0x4e9421[_0x45dd('0xf2')])||_[_0x45dd('0x60')](_0x4e9421[_0x45dd('0xf2')][_0x45dd('0xf3')])||_[_0x45dd('0x60')](_0x4e9421['VoiceQueueId'])){_0x4bc5c8(ut[_0x45dd('0x3f')](_0x45dd('0xf4'),_0x5792ec,_0x2af238));return;}var _0x589da4=uuid['v4']();var _0x192f62=_0x1d14ba[_0x45dd('0xd')][_0x4e9421['Queue'][_0x45dd('0x20')]];var _0xb7bae4=_0x1b801d?_0x1d14ba[_0x45dd('0x11')][_0x1b801d]['id']:undefined;_0x1d14ba[_0x45dd('0x10')][_0x589da4]=new Action(_0x4e9421,_0x192f62,_0x589da4,_0x1b801d,_0xb7bae4);var _0x4eba92=_0x1d14ba[_0x45dd('0x10')][_0x589da4];_0x4eba92[_0x45dd('0xa2')]=_0x5792ec;_0x4eba92[_0x45dd('0xa3')]=_0x2af238;_0x4eba92['lookAgent']=_0x1b801d;if(_[_0x45dd('0xf5')](_0x262e0c)){_0x1d14ba[_0x45dd('0xf6')](_0x4eba92,_0x192f62,_0x4e9421,_0x1b801d)[_0x45dd('0xf7')](function(_0x132ee0){logger['info'](_0x45dd('0xf8'),_0x45dd('0xf9')+_0x4eba92[_0x45dd('0x64')]+'\x20IdHopper:\x20'+_0x4eba92['idContact'],JSON[_0x45dd('0x48')](_0x132ee0));ami[_0x45dd('0x96')](_0x45dd('0xfa'),ut[_0x45dd('0x98')](_0x4eba92,_0x45dd('0xfb')));_0x5c7eaf(ut['message']('Calling'));})[_0x45dd('0x6e')](function(_0x46f24e){ut[_0x45dd('0x52')](_0x45dd('0xfc'),_0x46f24e);_0x4bc5c8(ut[_0x45dd('0x3f')]('Call\x20failed',_0x5792ec,_0x2af238));});}else{_0x192f62['outboundBlacklistCallsDay']+=0x1;ut[_0x45dd('0xfd')](_0x4eba92);rpcDb[_0x45dd('0xfe')](_0x4eba92,_0x45dd('0xff'));delete _0x1d14ba[_0x45dd('0x10')][_0x589da4];_0x4bc5c8(ut[_0x45dd('0x3f')](_0x45dd('0x100'),_0x5792ec,_0x2af238));}});};Preview[_0x45dd('0x9')][_0x45dd('0x90')]=function(_0x49c2dd){return!_['isNil'](_0x49c2dd)&&!_[_0x45dd('0x60')](_0x49c2dd['name'])&&!_[_0x45dd('0x60')](_0x49c2dd['active'])&&_0x49c2dd[_0x45dd('0x46')]&&!_['isNil'](this[_0x45dd('0xf')][util[_0x45dd('0x4a')](_0x45dd('0x101'),_0x49c2dd[_0x45dd('0x20')])])&&!_[_0x45dd('0x60')](this[_0x45dd('0xf')][util[_0x45dd('0x4a')](_0x45dd('0x101'),_0x49c2dd[_0x45dd('0x20')])][_0x45dd('0x6c')])&&(this[_0x45dd('0xf')][util['format']('SIP/%s',_0x49c2dd[_0x45dd('0x20')])][_0x45dd('0x6c')]===_0x45dd('0x102')||this[_0x45dd('0xf')][util[_0x45dd('0x4a')]('SIP/%s',_0x49c2dd[_0x45dd('0x20')])][_0x45dd('0x6c')]===_0x45dd('0x103'));};Preview[_0x45dd('0x9')]['run']=function(_0x5c624e,_0x51219d){var _0x1040dd=this;return new BPromise(function(_0x2cea38,_0x14941e){_0x1040dd['execRun'](_0x5c624e,_0x51219d)[_0x45dd('0xf7')](function(_0x48fe95){_0x2cea38(_[_0x45dd('0x66')](_0x48fe95,[_0x45dd('0x3f')]));})[_0x45dd('0x6e')](function(_0x5870aa){if(_0x5870aa[_0x45dd('0x104')]){rpcDb[_0x45dd('0x105')](_0x5c624e);}if(_0x5870aa['active']){rpcDb[_0x45dd('0x106')](_0x5c624e);}_0x14941e(_['pick'](_0x5870aa,[_0x45dd('0x3f')]));});});};Preview[_0x45dd('0x9')][_0x45dd('0x107')]=function(_0x247681,_0x4db1ce){var _0x57e25b=this;return new BPromise(function(_0x48b35d,_0x2d14dd){var _0x4b784e,_0x45f63f;rpcDb[_0x45dd('0x108')](_0x247681)['then'](function(_0x5e6d2d){if(!_[_0x45dd('0x60')](_0x5e6d2d[0x0])){_0x45f63f=_0x5e6d2d[0x0][_0x45dd('0x109')]?![]:!![];_0x4b784e=_0x5e6d2d[0x0][_0x45dd('0x109')]?!![]:![];_0x4b784e=_0x4db1ce?!![]:_0x4b784e;}var _0x26b66e=_0x57e25b[_0x45dd('0x10a')](_0x5e6d2d);if(_0x26b66e[_0x45dd('0x10b')]){rpcDb[_0x45dd('0x10c')](_[_0x45dd('0x66')](_0x5e6d2d[0x0],[_0x45dd('0x69'),_0x45dd('0x10d')]))[_0x45dd('0xf7')](function(_0x40ee98){_0x57e25b[_0x45dd('0xf1')](_0x40ee98,_0x5e6d2d[0x0],_0x4db1ce,_0x45f63f,_0x4b784e)[_0x45dd('0xf7')](function(_0x4dab1a){_0x48b35d(_0x4dab1a);})['catch'](function(_0x1ac087){_0x2d14dd(_0x1ac087);});})[_0x45dd('0x6e')](function(_0x3f23ee){ut[_0x45dd('0x52')](_0x45dd('0x10e'),_0x3f23ee);_0x2d14dd(ut['message'](_0x45dd('0x10f'),_0x45f63f,_0x4b784e));});}else{_0x2d14dd(ut[_0x45dd('0x3f')](_0x26b66e[_0x45dd('0x3f')],_0x45f63f,_0x4b784e));}})[_0x45dd('0x6e')](function(_0x2769bb){ut[_0x45dd('0x52')](_0x45dd('0x110'),_0x2769bb);_0x2d14dd(ut[_0x45dd('0x3f')](_0x45dd('0x10f'),![],!![]));});});};Preview[_0x45dd('0x9')]['validateContact']=function(_0x593024){if(_[_0x45dd('0x60')](_0x593024)||_[_0x45dd('0xf5')](_0x593024)||!_[_0x45dd('0x60')](_0x593024[0x0]['Agent'])&&_[_0x45dd('0x60')](_0x593024[0x0][_0x45dd('0x7d')][_0x45dd('0x20')])){ut[_0x45dd('0x52')](_0x45dd('0x111'),_0x593024);return{'isValid':![],'message':_0x45dd('0x112')};}var _0x40e1eb=this[_0x45dd('0xd')][_0x593024[0x0][_0x45dd('0x63')][_0x45dd('0x20')]];_0x40e1eb[_0x45dd('0x3f')]='ACTIVE';if(_['isNil'](_0x40e1eb)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x40e1eb);return{'isValid':![],'message':_0x45dd('0x113')};}if(!this[_0x45dd('0x90')](_0x40e1eb[_0x45dd('0x45')])){ut[_0x45dd('0x52')](_0x45dd('0x114'),_0x45dd('0x115')+_0x40e1eb[_0x45dd('0x20')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x45dd('0x90')](_0x40e1eb[_0x45dd('0x91')])){ut[_0x45dd('0x52')](_0x45dd('0x114'),_0x40e1eb['name']+_0x45dd('0x116'));return{'isValid':![],'message':_0x45dd('0x117')};}}if(!ut[_0x45dd('0x118')](_0x40e1eb[_0x45dd('0x119')])){ut['logger'](_0x45dd('0x11a'),_0x40e1eb['name']+_0x45dd('0x11b'));return{'isValid':![],'message':_0x45dd('0x115')+_0x40e1eb[_0x45dd('0x20')]+_0x45dd('0x11b')};}return{'isValid':!![],'message':_0x45dd('0x11c')};};Preview['prototype']['execCall']=function(_0x2720b5,_0x5586c0,_0x249a3f,_0x9bf88b){var _0x2ecd5b=this;return new BPromise(function(_0xcb9fd5,_0x557357){var _0x422b2a=_0x2720b5[_0x45dd('0xb6')];var _0x499eb7=_0x2ecd5b[_0x45dd('0x90')](_0x5586c0[_0x45dd('0x45')])?util[_0x45dd('0x4a')](_0x45dd('0x11d'),_0x5586c0[_0x45dd('0x45')][_0x45dd('0x20')],_['isNil'](_0x5586c0['dialPrefix'])?'':_0x5586c0['dialPrefix']['trim']()||'',_0x5586c0[_0x45dd('0x11e')]>0x0?_0x249a3f[_0x45dd('0xf2')][_0x45dd('0xf3')][_0x45dd('0x11f')](_0x5586c0[_0x45dd('0x11e')]):_0x249a3f['Contact']['phone']):util['format']('SIP/%s/%s%s',_['isNil'](_0x5586c0['TrunkBackup'])?_0x5586c0[_0x45dd('0x45')][_0x45dd('0x20')]:_0x5586c0[_0x45dd('0x91')][_0x45dd('0x20')],_['isNil'](_0x5586c0['dialPrefix'])?'':_0x5586c0[_0x45dd('0x2a')][_0x45dd('0x120')]()||'',_0x5586c0[_0x45dd('0x11e')]>0x0?_0x249a3f[_0x45dd('0xf2')]['phone'][_0x45dd('0x11f')](_0x5586c0[_0x45dd('0x11e')]):_0x249a3f['Contact'][_0x45dd('0xf3')]);var _0x5047f1=_0x2ecd5b['isTrunkReachable'](_0x5586c0[_0x45dd('0x45')])?ut['getCallerId'](_0x5586c0[_0x45dd('0x45')]['callerid'],_0x5586c0[_0x45dd('0x121')],_0x5586c0[_0x45dd('0x122')]>0x0?ut['getCallerIdRandom'](_0x5586c0['dialOriginateCallerIdNumber'],_0x5586c0['dialRandomLastDigitCallerIdNumber']):_0x5586c0['dialOriginateCallerIdNumber']):ut[_0x45dd('0x123')](_[_0x45dd('0x60')](_0x5586c0[_0x45dd('0x91')])?_0x5586c0[_0x45dd('0x45')][_0x45dd('0x124')]:_0x5586c0[_0x45dd('0x91')][_0x45dd('0x124')],_0x5586c0['dialOriginateCallerIdName'],_0x5586c0[_0x45dd('0x122')]>0x0?ut[_0x45dd('0x125')](_0x5586c0[_0x45dd('0x28')],_0x5586c0[_0x45dd('0x122')]):_0x5586c0[_0x45dd('0x28')]);if(_0x5047f1){_0x2720b5[_0x45dd('0x126')]=ut['extractCalleridName'](_0x5047f1);_0x2720b5[_0x45dd('0x127')]=ut['extractCalleridNumber'](_0x5047f1);}var _0x7228f8=ut[_0x45dd('0x128')](_0x5586c0,_0x249a3f,_0x499eb7,_0x5047f1,_0x422b2a,_0x2720b5);_['merge'](_0x2720b5,ut[_0x45dd('0x129')](_0x7228f8));_0x2720b5[_0x45dd('0x82')]=moment()[_0x45dd('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x45dd('0x6b')](ut['variablesAction'](_0x2720b5,_0x5586c0,_0x7228f8,_0x2720b5[_0x45dd('0xa3')],_0x9bf88b))[_0x45dd('0xf7')](function(_0x10acaf){_0x5586c0[_0x45dd('0x40')]+=0x1;logger['info'](_0x45dd('0x12a'),_0x422b2a,_0x45dd('0xb7'),_0x5586c0[_0x45dd('0x20')],_0x45dd('0xe2'),_0x5586c0[_0x45dd('0x40')]);_0xcb9fd5(_0x10acaf);})['catch'](function(_0x526508){ut[_0x45dd('0xe8')](_0x2720b5,0xe,_0x45dd('0x12b'));rpcDb[_0x45dd('0xe9')](_0x2720b5,_0x45dd('0x12c'));_0x557357(_0x526508);});});};Preview[_0x45dd('0x9')][_0x45dd('0x12d')]=function(_0x14058a){if(this[_0x45dd('0x10')][_0x14058a[_0x45dd('0xa4')]]){this['actions'][_0x14058a['linkedid']]['channel']=_0x14058a[_0x45dd('0x6d')];}};Preview[_0x45dd('0x9')][_0x45dd('0x13')]=function(_0x518e3f){var _0x1670ed=this;var _0x1678cd=this['actions'][_0x518e3f[_0x45dd('0x12e')]];if(_0x1678cd){if(_0x1678cd[_0x45dd('0x12f')]&&this[_0x45dd('0x11')][_0x1678cd['lookAgent']]){ut['logLookAgent'](_0x1678cd,this[_0x45dd('0x11')][_0x1678cd['lookAgent']][_0x45dd('0x20')],this[_0x45dd('0x11')][_0x1678cd[_0x45dd('0x12f')]]['id']);}var _0x335f06=_[_0x45dd('0x130')](_0x1678cd);_0x335f06['responsetime']=moment()[_0x45dd('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');var _0x16fb2b=_0x1670ed['campaignsPreview'][_0x1678cd[_0x45dd('0x64')]];if(ut['isFailure'](_0x518e3f[_0x45dd('0x131')])){if(_0x1678cd[_0x45dd('0xa2')]){rpcDb[_0x45dd('0x105')](_0x1678cd[_0x45dd('0x132')]);}if(_0x1678cd[_0x45dd('0xa3')]){rpcDb[_0x45dd('0x106')](_0x1678cd[_0x45dd('0x132')]);}ami[_0x45dd('0x96')](_0x45dd('0x133'),ut['buildObj'](_0x1678cd,_0x45dd('0x134')));this[_0x45dd('0xe4')](_0x335f06,_0x16fb2b,_0x518e3f);}else{_0x1678cd['starttime']=moment()[_0x45dd('0x4a')](_0x45dd('0x83'));ut['logAgent'](_0x335f06,0x4,'Answer');rpcDb['createAgentHistory'](_0x335f06,_0x45dd('0x135'));}}};Preview[_0x45dd('0x9')][_0x45dd('0x16')]=function(_0x43ced1){var _0x5056ab=this;var _0xc63dac=this['actions'][_0x43ced1[_0x45dd('0xa4')]];var _0xa474ed;if(_0xc63dac){_0xa474ed=this[_0x45dd('0xd')][_0xc63dac[_0x45dd('0x64')]];logger[_0x45dd('0x61')](_0x45dd('0x136'),_0x43ced1['linkedid'],_0x45dd('0xb7'),_0xa474ed[_0x45dd('0x20')],_0x45dd('0xa8'),_0xa474ed['pTalking']);}if(this[_0x45dd('0x10')][_0x43ced1[_0x45dd('0xa4')]]&&_0x43ced1['linkedid']!==_0x43ced1[_0x45dd('0xb6')]){if(_0x43ced1['cause']==='16'&&this['actions'][_0x43ced1[_0x45dd('0xa4')]][_0x45dd('0x71')]){this[_0x45dd('0x137')](_0x43ced1,_0x43ced1['linkedid'],_0x43ced1['cause']);}else if(this[_0x45dd('0x10')][_0x43ced1[_0x45dd('0xa4')]][_0x45dd('0x71')]){logger[_0x45dd('0x61')](_0x45dd('0x138'),_0x43ced1[_0x45dd('0xa4')],_0x43ced1[_0x45dd('0x139')],_0x45dd('0xb7'),_0xa474ed[_0x45dd('0x20')],_0x45dd('0xa8'),_0xa474ed[_0x45dd('0x65')]);this[_0x45dd('0x137')](_0x43ced1,_0x43ced1[_0x45dd('0xa4')],_0x43ced1[_0x45dd('0x139')]);}}else if(_0xc63dac&&_['isNil'](_0xc63dac[_0x45dd('0x13a')])&&_0xa474ed[_0x45dd('0x13b')]&&_0x43ced1['linkedid']===_0x43ced1['uniqueid']&&_[_0x45dd('0x60')](_0x43ced1['reason'])&&_0x43ced1['cause']==='16'&&_0x43ced1['channelstate']==='6'&&_[_0x45dd('0xe5')](_0xc63dac[_0x45dd('0x13c')])){if(_0xc63dac[_0x45dd('0xa2')]){rpcDb[_0x45dd('0x105')](_0xc63dac[_0x45dd('0x132')]);}if(_0xc63dac[_0x45dd('0xa3')]){rpcDb[_0x45dd('0x106')](_0xc63dac['idContact']);}_0x43ced1[_0x45dd('0xe7')]='22';this[_0x45dd('0xe4')](_0xc63dac,_0xa474ed,_0x43ced1);}else if(_0xc63dac&&_0xc63dac[_0x45dd('0x13c')]){if(_0x43ced1['cause']==='16'&&this[_0x45dd('0x10')][_0x43ced1[_0x45dd('0xa4')]][_0x45dd('0x71')]){logger[_0x45dd('0x61')]('[syncHangup][talking][transfer]',_0x43ced1[_0x45dd('0xa4')],_0x43ced1[_0x45dd('0x139')],'\x20Queue',_0xa474ed[_0x45dd('0x20')],_0x45dd('0xa8'),_0xa474ed['pTalking']);this['callProgressDetectingCustomer'](_0x43ced1,_0x43ced1['linkedid'],_0x43ced1[_0x45dd('0x139')]);}else if(this[_0x45dd('0x10')][_0x43ced1[_0x45dd('0xa4')]]['dialAnswer']){logger['info'](_0x45dd('0x138'),_0x43ced1['linkedid'],_0x43ced1[_0x45dd('0x139')],_0x45dd('0xb7'),_0xa474ed[_0x45dd('0x20')],'pTalking:\x20',_0xa474ed['pTalking']);this[_0x45dd('0x137')](_0x43ced1,_0x43ced1[_0x45dd('0xa4')],_0x43ced1[_0x45dd('0x139')]);}}};Preview[_0x45dd('0x9')][_0x45dd('0x1a')]=function(_0x163841){if(this[_0x45dd('0x10')][_0x163841[_0x45dd('0xe3')]]&&_0x163841['destlinkedid']!==_0x163841[_0x45dd('0x13d')]){this[_0x45dd('0x137')](_0x163841,_0x163841[_0x45dd('0xe3')],_0x163841[_0x45dd('0xde')]);}};Preview[_0x45dd('0x9')][_0x45dd('0x18')]=function(_0x380764){if(this[_0x45dd('0x10')][_0x380764[_0x45dd('0xa4')]]&&_0x380764[_0x45dd('0xa4')]!==_0x380764[_0x45dd('0xb6')]&&!this[_0x45dd('0x10')][_0x380764[_0x45dd('0xa4')]][_0x45dd('0x71')]){if(_0x380764[_0x45dd('0x139')]==='1'){this[_0x45dd('0x137')](_0x380764,_0x380764[_0x45dd('0xa4')],_0x380764[_0x45dd('0x139')]);}}};Preview[_0x45dd('0x9')][_0x45dd('0x13e')]=function(_0x5c4eac,_0x40c9ff,_0x2887f2){if(this[_0x45dd('0x10')][_0x5c4eac]){if(_[_0x45dd('0x60')](this[_0x45dd('0x10')][_0x5c4eac][_0x45dd('0x13f')])){this['actions'][_0x5c4eac]['variables']={};}this['actions'][_0x5c4eac][_0x45dd('0x13f')][_0x40c9ff]=_0x2887f2;}};Preview[_0x45dd('0x9')][_0x45dd('0x1d')]=function(_0x10b958){try{if(!_['isNil'](_0x10b958)){if(ut[_0x45dd('0x140')](_[_0x45dd('0x141')](_0x10b958[_0x45dd('0x142')])[0x0])){this[_0x45dd('0x13e')](_0x10b958[_0x45dd('0xb6')],_[_0x45dd('0x141')](_0x10b958[_0x45dd('0x142')])[0x0],_0x10b958[_0x45dd('0x143')]);}}}catch(_0x3f91b8){logger['error'](_0x45dd('0x144'),util[_0x45dd('0x145')](_0x3f91b8,{'showHidden':![],'depth':null}));}};Preview[_0x45dd('0x9')][_0x45dd('0x146')]=function(_0x23f260){if(_0x23f260){if(this[_0x45dd('0x10')][_0x23f260[_0x45dd('0x147')]]){this[_0x45dd('0x10')][_0x23f260['transfertargetlinkedid']][_0x45dd('0x13c')]=!![];}}};Preview[_0x45dd('0x9')][_0x45dd('0x1f')]=function(_0x1495cf){if(_0x1495cf){if(this['actions'][_0x1495cf['transfererlinkedid']]){this[_0x45dd('0x10')][_0x1495cf[_0x45dd('0x148')]][_0x45dd('0x13c')]=!![];}}};module[_0x45dd('0x149')]=Preview; \ No newline at end of file +var _0x18e2=['checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','Contact','getCallerId','dialRandomLastDigitCallerIdNumber','extractCalleridName','extractCalleridNumber','merge','starttime','variablesAction','[originated][increment]','OriginateError','linkedid','syncOriginateResponse','actionid','logLookAgent','lookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','reason','channelstate','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','attendedtransfer','blindtransfer','loopCampaigns','type','outbound','strategy','answered','loggedIn','sumBillable','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','pTalking','sendMessageOneNotActive','available','message','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','campaignsPreview','hasOwnProperty','clockClearZombieChannels','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20','dialAnswer','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','isNil','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','logger2','setMessage','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','emit','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','ANSWER','responsetime','[syncHangup][talking][increment]','buildObj','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','decrementTalkink','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','noanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','\x20Queue','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','phone','isEmpty','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','logger','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','pick','getContactPreview','recallme','validateContact','isValid'];(function(_0xcf6a46,_0x17684d){var _0x3f92f7=function(_0x313de5){while(--_0x313de5){_0xcf6a46['push'](_0xcf6a46['shift']());}};_0x3f92f7(++_0x17684d);}(_0x18e2,0x191));var _0x218e=function(_0xa0d0e,_0x38f6d2){_0xa0d0e=_0xa0d0e-0x0;var _0x31d0d7=_0x18e2[_0xa0d0e];return _0x31d0d7;};'use strict';var util=require(_0x218e('0x0'));var _=require(_0x218e('0x1'));var BPromise=require(_0x218e('0x2'));var uuid=require(_0x218e('0x3'));var moment=require(_0x218e('0x4'));var md5=require(_0x218e('0x5'));var Redis=require(_0x218e('0x6'));var config=require(_0x218e('0x7'));var logger=require(_0x218e('0x8'))(_0x218e('0x9'));var loggerAction=require(_0x218e('0x8'))(_0x218e('0xa'));var ami=require(_0x218e('0xb'));var rpcDb=require(_0x218e('0xc'));var Action=require(_0x218e('0xd'));var ut=require(_0x218e('0xe'));config[_0x218e('0xf')]=_[_0x218e('0x10')](config[_0x218e('0xf')],{'host':_0x218e('0x11'),'port':0x18eb});var io=require(_0x218e('0x12'))(new Redis(config[_0x218e('0xf')]));var Sequence=function(){};Sequence[_0x218e('0x13')][_0x218e('0x14')]=function(_0x5257ac){this[_0x218e('0x15')]=this[_0x218e('0x15')]?this[_0x218e('0x15')][_0x218e('0x16')](_0x5257ac):_0x5257ac();};function Preview(_0x4cf9cd){this[_0x218e('0x17')]=new Sequence();this['campaignsPreview']=_0x4cf9cd[_0x218e('0x18')];this['trunks']=_0x4cf9cd[_0x218e('0x19')];this[_0x218e('0x1a')]={};this[_0x218e('0x1b')]=_0x4cf9cd['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0x218e('0x1c'),this['syncOriginateResponse'][_0x218e('0x1d')](this));ami['on'](_0x218e('0x1e'),this[_0x218e('0x1f')][_0x218e('0x1d')](this));ami['on'](_0x218e('0x20'),this[_0x218e('0x21')]['bind'](this));ami['on'](_0x218e('0x22'),this[_0x218e('0x23')][_0x218e('0x1d')](this));ami['on'](_0x218e('0x24'),this[_0x218e('0x25')][_0x218e('0x1d')](this));ami['on']('varset',this['syncVarSet'][_0x218e('0x1d')](this));ami['on'](_0x218e('0x26'),this['syncAttendedTransfer'][_0x218e('0x1d')](this));ami['on'](_0x218e('0x27'),this['syncBlindTransfer'][_0x218e('0x1d')](this));this[_0x218e('0x28')](this['campaignsPreview']);}function emit(_0x3168ee,_0x4287ca,_0x4d2115){io['to'](_0x3168ee)['emit'](_0x4287ca,_0x4d2115);}function emitCampaignPreview(_0xbf51af){if(_0xbf51af[_0x218e('0x29')]===_0x218e('0x2a')){var _0xf0642b={'id':_0xbf51af['id'],'name':_0xbf51af['name'],'strategy':_0xbf51af[_0x218e('0x2b')],'answered':_0xbf51af[_0x218e('0x2c')],'available':_0xbf51af['available'],'loggedIn':_0xbf51af[_0x218e('0x2d')],'pTalking':_0xbf51af['pTalking'],'sumBillable':_0xbf51af[_0x218e('0x2e')],'sumDuration':_0xbf51af['sumDuration'],'sumHoldTime':_0xbf51af[_0x218e('0x2f')]||0x0,'talking':_0xbf51af[_0x218e('0x30')],'total':_0xbf51af[_0x218e('0x31')],'type':_0xbf51af[_0x218e('0x29')],'unmanaged':_0xbf51af['unmanaged'],'abandoned':_0xbf51af[_0x218e('0x32')],'waiting':_0xbf51af[_0x218e('0x33')],'loggedInDb':_0xbf51af[_0x218e('0x34')],'dialActive':_0xbf51af[_0x218e('0x35')],'dialMethod':_0xbf51af[_0x218e('0x36')],'dialOriginateCallerIdName':_0xbf51af[_0x218e('0x37')],'dialOriginateCallerIdNumber':_0xbf51af[_0x218e('0x38')],'dialOriginateTimeout':_0xbf51af[_0x218e('0x39')],'dialPrefix':_0xbf51af[_0x218e('0x3a')],'outboundAnswerAgiCallsDay':_0xbf51af[_0x218e('0x3b')],'outboundAnswerCallsDay':_0xbf51af[_0x218e('0x3c')],'outboundBlacklistCallsDay':_0xbf51af[_0x218e('0x3d')],'outboundBusyCallsDay':_0xbf51af[_0x218e('0x3e')],'outboundCongestionCallsDay':_0xbf51af[_0x218e('0x3f')],'outboundDropCallsDayACS':_0xbf51af[_0x218e('0x40')],'outboundDropCallsDayCallersExit':_0xbf51af[_0x218e('0x41')],'outboundDropCallsDayTimeout':_0xbf51af[_0x218e('0x42')],'outboundNoAnswerCallsDay':_0xbf51af[_0x218e('0x43')],'outboundNoSuchCallsDay':_0xbf51af[_0x218e('0x44')],'outboundOriginateFailureCallsDay':_0xbf51af['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xbf51af['outboundReCallsDay'],'outboundRejectCallsDay':_0xbf51af[_0x218e('0x45')],'outboundUnknownCallsDay':_0xbf51af['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0xbf51af[_0x218e('0x46')],'predictiveIntervalAnsweredCalls':_0xbf51af[_0x218e('0x47')],'predictiveIntervalAvgHoldtime':_0xbf51af[_0x218e('0x48')],'predictiveIntervalAvgTalktime':_0xbf51af['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0xbf51af['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0xbf51af[_0x218e('0x49')],'predictiveIntervalErlangCalls':_0xbf51af[_0x218e('0x4a')],'predictiveIntervalErlangCallsDroppedCalls':_0xbf51af['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xbf51af['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0xbf51af['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0xbf51af['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xbf51af[_0x218e('0x4b')],'predictiveIntervalTotalCalls':_0xbf51af[_0x218e('0x4c')],'message':_0xbf51af['message'],'originated':_0xbf51af[_0x218e('0x4d')],'erlangCalls':_0xbf51af[_0x218e('0x4e')],'erlangCallToSecond':_0xbf51af[_0x218e('0x4f')],'erlangAbandonmentRate':_0xbf51af[_0x218e('0x50')],'erlangBusyFactor':_0xbf51af[_0x218e('0x51')],'startPredictive':_0xbf51af[_0x218e('0x52')],'startProgressive':_0xbf51af[_0x218e('0x53')]};if(_0xbf51af[_0x218e('0x54')]){_0xf0642b[_0x218e('0x54')]={'id':_0xbf51af[_0x218e('0x54')]['id'],'name':_0xbf51af[_0x218e('0x54')][_0x218e('0x55')],'active':_0xbf51af[_0x218e('0x54')][_0x218e('0x56')],'callerid':_0xbf51af[_0x218e('0x54')][_0x218e('0x57')]};}if(_0xbf51af[_0x218e('0x58')]){_0xf0642b[_0x218e('0x58')]={'id':_0xbf51af[_0x218e('0x58')]['id'],'name':_0xbf51af[_0x218e('0x58')][_0x218e('0x55')]};}var _0x30029e=md5(JSON['stringify'](_0xf0642b));if(_0xbf51af[_0x218e('0x5')]!==_0x30029e){_0xbf51af[_0x218e('0x5')]=_0x30029e;emit(util[_0x218e('0x59')](_0x218e('0x5a'),_0xf0642b[_0x218e('0x55')]),_0x218e('0x5b'),_0xf0642b);}}}function emitVoiceQueueChannelRemove(_0xec0119){logger[_0x218e('0x5c')](_0x218e('0x5d'),JSON['stringify'](_0xec0119));emit(util['format'](_0x218e('0x5a'),_0xec0119[_0x218e('0x55')]),'voice_queue_channel:remove',_0xec0119);}function notSendMessagesQueue(_0x5335e9){if(_0x5335e9['sendMessageOneNotActive']){if(_0x5335e9[_0x218e('0x4d')]===0x0&&_0x5335e9[_0x218e('0x5e')]===0x0){_0x5335e9[_0x218e('0x5f')]=![];_0x5335e9[_0x218e('0x60')]=0x0;_0x5335e9['paused']=0x0;_0x5335e9[_0x218e('0x61')]=_0x218e('0x62');ut['logger'](_0x218e('0x63'),_0x5335e9[_0x218e('0x55')]+_0x218e('0x64'));}else{_0x5335e9[_0x218e('0x61')]=_0x218e('0x65');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x5335e9['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x5335e9);}}Preview[_0x218e('0x13')]['loopCampaigns']=function(){var _0x5ab3a6=this;setInterval(function(){_0x5ab3a6[_0x218e('0x66')]();},0x7cf);};Preview[_0x218e('0x13')]['syncCampaigns']=function(){var _0x1a621f=this[_0x218e('0x67')];this['clockClearZombieChannels']+=0x1;for(var _0x21db3e in _0x1a621f){if(_0x1a621f[_0x218e('0x68')](_0x21db3e)&&(_0x1a621f[_0x21db3e][_0x218e('0x36')]===_0x218e('0x9')||_0x1a621f[_0x21db3e][_0x218e('0x36')]==='booked')&&_0x1a621f[_0x21db3e][_0x218e('0x29')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x218e('0x69')]=0x0;this['clearZombieChannels']();}}if(_0x1a621f[_0x218e('0x68')](_0x21db3e)&&_0x1a621f[_0x21db3e][_0x218e('0x36')]==='preview'&&_0x1a621f[_0x21db3e][_0x218e('0x29')]===_0x218e('0x2a')){if(_0x1a621f[_0x21db3e][_0x218e('0x35')]){this['setMessage'](_0x1a621f[_0x21db3e]);this[_0x218e('0x6a')](_0x1a621f[_0x21db3e]);}else{notSendMessagesQueue(_0x1a621f[_0x21db3e]);}}}};Preview[_0x218e('0x13')][_0x218e('0x6b')]=function(_0x19f056){var _0x11f35a=this;this[_0x218e('0x17')]['enqueue'](function(){if(!_['isNil'](_0x11f35a[_0x218e('0x1a')][_0x19f056])){loggerAction[_0x218e('0x5c')](_0x218e('0x6c'),_0x19f056,_0x218e('0x6d'),_0x11f35a['actions'][_0x19f056][_0x218e('0x6e')],_0x218e('0x6f'),JSON[_0x218e('0x70')](_0x11f35a[_0x218e('0x67')][_0x11f35a[_0x218e('0x1a')][_0x19f056][_0x218e('0x6e')]][_0x218e('0x4d')]),_0x218e('0x71'),JSON[_0x218e('0x70')](_0x11f35a[_0x218e('0x67')][_0x11f35a[_0x218e('0x1a')][_0x19f056]['queue']]['pTalking']),JSON[_0x218e('0x70')](_0x11f35a[_0x218e('0x1a')][_0x19f056][_0x218e('0x72')]),JSON[_0x218e('0x70')](_['pick'](_0x11f35a[_0x218e('0x1a')][_0x19f056],['contactId',_0x218e('0x73'),_0x218e('0x74'),_0x218e('0x75')])));return ami[_0x218e('0x76')]({'action':_0x218e('0x77'),'channel':_0x11f35a[_0x218e('0x1a')][_0x19f056][_0x218e('0x78')]})[_0x218e('0x79')](function(_0x35c58d){if(_0x35c58d[_0x218e('0x61')]===_0x218e('0x7a')){setTimeout(function(){if(_0x11f35a[_0x218e('0x1a')][_0x19f056]){ut[_0x218e('0x7b')](_0x11f35a[_0x218e('0x67')][_0x11f35a['actions'][_0x19f056]['queue']],_0x218e('0x7c'));if(_0x11f35a['actions'][_0x19f056][_0x218e('0x72')]===!![]){ut['decrementTalkink'](_0x11f35a['campaignsPreview'][_0x11f35a[_0x218e('0x1a')][_0x19f056][_0x218e('0x6e')]],_0x218e('0x7c'));ut[_0x218e('0x7d')](_0x218e('0x7e')+_0x19f056,_0x11f35a[_0x218e('0x1a')][_0x19f056][_0x218e('0x6e')]);}ut['loggerError'](_0x218e('0x7f')+_0x19f056,_0x11f35a[_0x218e('0x1a')][_0x19f056][_0x218e('0x6e')]);delete _0x11f35a[_0x218e('0x1a')][_0x19f056];}},0x2328);}});}});};Preview[_0x218e('0x13')]['clearZombieChannels']=function(){var _0x303f03=this;loggerAction[_0x218e('0x5c')](_0x218e('0x80'),_[_0x218e('0x81')](this[_0x218e('0x1a')]));for(var _0x2e4354 in this['actions']){if(_0x303f03[_0x218e('0x1a')][_0x218e('0x68')](_0x2e4354)){_0x303f03[_0x218e('0x6b')](_0x2e4354);}}};Preview[_0x218e('0x13')][_0x218e('0x6a')]=function(_0x179b52){var _0x5b305c=this;rpcDb[_0x218e('0x82')](_0x179b52['id'],ut['agentReadyId'](this[_0x218e('0x1b')]))[_0x218e('0x83')](function(_0x14b783){if(!_[_0x218e('0x84')](_0x14b783)){for(var _0x313c2f=0x0;_0x313c2f<_0x14b783[_0x218e('0x85')];_0x313c2f+=0x1){if(ut[_0x218e('0x86')](_0x14b783[_0x313c2f]['scheduledat'])<_0x179b52[_0x218e('0x87')]*0x3c){if(_0x14b783[_0x313c2f]['Agent']&&!_0x14b783[_0x313c2f][_0x218e('0x88')][_0x218e('0x89')]){_0x5b305c[_0x218e('0x8a')](_0x14b783[_0x313c2f]['id'])[_0x218e('0x83')](ut['logger2']('[RecallMe]'))[_0x218e('0x79')](ut['logger2'](_0x218e('0x8b')));}else{rpcDb[_0x218e('0x8c')](_0x14b783[_0x313c2f]['id']);}}else{var _0x16edf4=new Action(_0x14b783[_0x313c2f],_0x179b52);_0x16edf4['starttime']=moment()[_0x218e('0x59')](_0x218e('0x8d'));_0x179b52[_0x218e('0x8e')]+=0x1;ut[_0x218e('0x8f')](_0x16edf4,0x17,_0x218e('0x90'));if(_0x179b52['dialRecallInQueue']){rpcDb[_0x218e('0x91')](ut[_0x218e('0x92')](_0x14b783[_0x313c2f]));rpcDb['createCustomerHistory'](_0x16edf4,_0x218e('0x93'));}else{ut[_0x218e('0x8f')](_0x16edf4,0x16,_0x218e('0x94'));rpcDb[_0x218e('0x95')](_0x16edf4,_0x218e('0x96'));rpcDb[_0x218e('0x97')](_0x16edf4,_0x218e('0x96'));}}}}})[_0x218e('0x79')](ut[_0x218e('0x98')]('[getContactRecallMe]'));};Preview['prototype'][_0x218e('0x99')]=function(_0x39df33){_0x39df33[_0x218e('0x5f')]=!![];if(ut[_0x218e('0x9a')](_0x39df33[_0x218e('0x2d')])){_0x39df33[_0x218e('0x61')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x218e('0x9b')](_0x39df33['dialActive'])){_0x39df33[_0x218e('0x61')]='NOT_ACTIVE';}else if(!this[_0x218e('0x9c')](_0x39df33[_0x218e('0x54')])){if(!this[_0x218e('0x9c')](_0x39df33[_0x218e('0x9d')])){_0x39df33[_0x218e('0x61')]=_0x218e('0x9e');}else{_0x39df33['message']=_0x218e('0x9f');}}else{_0x39df33[_0x218e('0x61')]='ACTIVE';}emitCampaignPreview(_0x39df33);};Preview[_0x218e('0x13')][_0x218e('0xa0')]=function(_0x552632,_0x3300d5,_0x31f84c){var _0x540549=this;var _0x196c44=this[_0x218e('0x1a')][_0x3300d5];var _0x33fb35=this[_0x218e('0x67')][_0x196c44['queue']];var _0x2c346e;if(_0x33fb35){switch(_0x31f84c){case'1':_0x33fb35[_0x218e('0x44')]+=0x1;_0x196c44[_0x218e('0xa1')]+=0x1;_0x196c44['countglobal']=ut[_0x218e('0xa2')](_0x196c44);ut[_0x218e('0x8f')](_0x196c44,0x0,_0x218e('0xa3'));ami[_0x218e('0xa4')]('custom:agentnosuchnumber',ut['buildObj'](_0x196c44,_0x218e('0xa5')));rpcDb[_0x218e('0x95')](_0x196c44,_0x218e('0xa6'));if(ut['totalGlobal'](_0x196c44)>=_0x33fb35[_0x218e('0xa7')]){_0x2c346e=ut['cloneAction'](_0x196c44,0xf,_0x218e('0xa8'));rpcDb[_0x218e('0x97')](_0x2c346e,_0x218e('0xa9'));}else{if(_0x196c44[_0x218e('0xa1')]>=_0x33fb35[_0x218e('0xaa')]){rpcDb['createCustomerFinal'](_0x196c44,_0x218e('0xa9'));}else{rpcDb[_0x218e('0xab')](ut[_0x218e('0xac')](_0x196c44,_0x218e('0xa1'),_0x33fb35[_0x218e('0xad')]),_0x196c44[_0x218e('0xae')],_0x196c44[_0x218e('0xaf')]);}}delete this[_0x218e('0x1a')][_0x552632['linkedid']];break;case _0x218e('0xb0'):var _0x2c4e4e=moment()['format'](_0x218e('0x8d'));_0x196c44[_0x218e('0xb1')]=_0x2c4e4e;_0x196c44['answertime']=_0x2c4e4e;_0x196c44[_0x218e('0x72')]=!![];_0x33fb35[_0x218e('0x5e')]+=0x1;logger['info'](_0x218e('0xb2'),_0x196c44['uniqueid'],'\x20Queue',_0x33fb35[_0x218e('0x55')],_0x218e('0x71'),_0x33fb35[_0x218e('0x5e')]);ami[_0x218e('0xa4')]('custom:agentconnect',ut[_0x218e('0xb3')](_0x196c44,_0x218e('0xb4')));if(_0x33fb35['acw']){ami['emit'](_0x218e('0xb5'),ut[_0x218e('0xb6')](_0x196c44));}break;case'16':ami[_0x218e('0xa4')](_0x218e('0xb7'),ut[_0x218e('0xb3')](_0x196c44,_0x218e('0xb8')));emitVoiceQueueChannelRemove(ut[_0x218e('0xb3')](_0x196c44,'complete'));_0x33fb35[_0x218e('0x3c')]+=0x1;_0x33fb35['total']+=0x1;_0x33fb35['answered']+=0x1;ut[_0x218e('0xb9')](_0x33fb35,_0x218e('0xba'));_0x196c44[_0x218e('0xbb')]=ut[_0x218e('0xa2')](_0x196c44);ut['logCustomer'](_0x196c44,0x4,_0x218e('0xbc'));rpcDb['createCustomerHistory'](_0x196c44,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x218e('0x97')](_0x196c44,_0x218e('0xbd'));rpcDb[_0x218e('0xbe')](_0x196c44);_0x33fb35[_0x218e('0xbf')]+=_0x196c44['talktime'];_0x33fb35[_0x218e('0x2e')]+=_0x196c44[_0x218e('0xc0')];logger['info'](_0x218e('0xc1'),_0x196c44[_0x218e('0xc2')],'\x20Queue',_0x33fb35[_0x218e('0x55')],_0x218e('0x71'),_0x33fb35[_0x218e('0x5e')]);delete this[_0x218e('0x1a')][_0x552632['linkedid']];break;case _0x218e('0xc3'):_0x33fb35[_0x218e('0x3e')]+=0x1;_0x196c44[_0x218e('0xc4')]+=0x1;_0x196c44['countglobal']=ut[_0x218e('0xa2')](_0x196c44);ut[_0x218e('0x8f')](_0x196c44,0x5,'Busy');ami['emit'](_0x218e('0xc5'),ut[_0x218e('0xb3')](_0x196c44,_0x218e('0xc6')));rpcDb['createCustomerHistory'](_0x196c44,_0x218e('0xc7'));if(ut[_0x218e('0xa2')](_0x196c44)>=_0x33fb35[_0x218e('0xa7')]){_0x2c346e=ut[_0x218e('0xc8')](_0x196c44,0xf,_0x218e('0xa8'));rpcDb[_0x218e('0x97')](_0x2c346e,_0x218e('0xc9'));}else{if(_0x196c44[_0x218e('0xc4')]>=_0x33fb35[_0x218e('0xca')]){rpcDb[_0x218e('0x97')](_0x196c44,_0x218e('0xc7'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x196c44,_0x218e('0xc4'),_0x33fb35[_0x218e('0xcb')]),_0x196c44['unlockAgent'],_0x196c44['activeContact']);}}break;case _0x218e('0xcc'):_0x33fb35[_0x218e('0x43')]+=0x1;_0x196c44[_0x218e('0xcd')]+=0x1;_0x196c44[_0x218e('0xbb')]=ut[_0x218e('0xa2')](_0x196c44);ut['logCustomer'](_0x196c44,0x3,_0x218e('0xce'));ami[_0x218e('0xa4')]('custom:agentnoanswer',ut[_0x218e('0xb3')](_0x196c44,_0x218e('0xcf')));rpcDb[_0x218e('0x95')](_0x196c44,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x218e('0xa2')](_0x196c44)>=_0x33fb35[_0x218e('0xa7')]){_0x2c346e=ut['cloneAction'](_0x196c44,0xf,_0x218e('0xa8'));rpcDb[_0x218e('0x97')](_0x2c346e,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x196c44['countnoanswerretry']>=_0x33fb35[_0x218e('0xd0')]){rpcDb[_0x218e('0x97')](_0x196c44,_0x218e('0xd1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x196c44,_0x218e('0xcd'),_0x33fb35[_0x218e('0xd2')]),_0x196c44['unlockAgent'],_0x196c44[_0x218e('0xaf')]);}}break;case _0x218e('0xd3'):_0x33fb35[_0x218e('0x3f')]+=0x1;_0x196c44[_0x218e('0xd4')]+=0x1;_0x196c44[_0x218e('0xbb')]=ut['totalGlobal'](_0x196c44);ut[_0x218e('0x8f')](_0x196c44,0x8,_0x218e('0xd5'));ami[_0x218e('0xa4')](_0x218e('0xd6'),ut[_0x218e('0xb3')](_0x196c44,'congestion'));rpcDb['createCustomerHistory'](_0x196c44,_0x218e('0xd7'));if(ut[_0x218e('0xa2')](_0x196c44)>=_0x33fb35[_0x218e('0xa7')]){_0x2c346e=ut[_0x218e('0xc8')](_0x196c44,0xf,_0x218e('0xa8'));rpcDb[_0x218e('0x97')](_0x2c346e,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x196c44['countcongestionretry']>=_0x33fb35[_0x218e('0xd8')]){rpcDb[_0x218e('0x97')](_0x196c44,_0x218e('0xd7'));}else{rpcDb[_0x218e('0xab')](ut[_0x218e('0xac')](_0x196c44,_0x218e('0xd4'),_0x33fb35[_0x218e('0xcb')]),_0x196c44['unlockAgent'],_0x196c44[_0x218e('0xaf')]);}}break;case _0x218e('0xd9'):_0x33fb35[_0x218e('0x45')]+=0x1;_0x196c44['countagentrejectretry']+=0x1;_0x196c44[_0x218e('0xbb')]=ut[_0x218e('0xa2')](_0x196c44);ut['logCustomer'](_0x196c44,0x14,'AgentReject');ami[_0x218e('0xa4')](_0x218e('0xda'),ut[_0x218e('0xb3')](_0x196c44,_0x218e('0xdb')));rpcDb[_0x218e('0x95')](_0x196c44,_0x218e('0xdc'));if(ut[_0x218e('0xa2')](_0x196c44)>=_0x33fb35[_0x218e('0xa7')]){_0x2c346e=ut[_0x218e('0xc8')](_0x196c44,0x14,'AgentReject');rpcDb[_0x218e('0x97')](_0x2c346e,_0x218e('0xdd'));}else{if(_0x196c44[_0x218e('0xde')]>=_0x33fb35[_0x218e('0xdf')]){rpcDb[_0x218e('0x97')](_0x196c44,_0x218e('0xdd'));}else{rpcDb['rescheduleContact'](ut[_0x218e('0xac')](_0x196c44,'countagentrejectretry',_0x33fb35[_0x218e('0xe0')]),_0x196c44['unlockAgent'],_0x196c44['activeContact']);}}break;case _0x218e('0xe1'):_0x33fb35[_0x218e('0x46')]+=0x1;_0x196c44[_0x218e('0xe2')]+=0x1;_0x196c44['countglobal']=ut[_0x218e('0xa2')](_0x196c44);ut['logCustomer'](_0x196c44,0xb,_0x218e('0xe3'));rpcDb[_0x218e('0x95')](_0x196c44,_0x218e('0xe4'));if(ut['totalGlobal'](_0x196c44)>=_0x33fb35['dialGlobalMaxRetry']){_0x2c346e=ut[_0x218e('0xc8')](_0x196c44,0xf,_0x218e('0xa8'));rpcDb[_0x218e('0x97')](_0x2c346e,_0x218e('0xe4'));}else{if(_0x196c44[_0x218e('0xe5')]>=_0x33fb35['dialAbandonedMaxRety']){rpcDb[_0x218e('0x97')](_0x196c44,_0x218e('0xe4'));}else{rpcDb[_0x218e('0xab')](ut[_0x218e('0xac')](_0x196c44,_0x218e('0xe2'),_0x33fb35[_0x218e('0xe6')]),_0x196c44['unlockAgent'],_0x196c44[_0x218e('0xaf')]);}}break;default:if(_0x196c44[_0x218e('0x72')]){ut[_0x218e('0xb9')](_0x33fb35,_0x218e('0xe7'));ut[_0x218e('0x7d')](_0x218e('0xe8')+_0x33fb35['name'],_0x552632);}_0x33fb35[_0x218e('0xe9')]+=0x1;_0x196c44[_0x218e('0xbb')]=ut[_0x218e('0xa2')](_0x196c44);ut[_0x218e('0x8f')](_0x196c44,0xc,_0x552632[_0x218e('0xea')]||_0x552632[_0x218e('0xeb')]);rpcDb[_0x218e('0x95')](_0x196c44,_0x218e('0xec'));if(ut[_0x218e('0xa2')](_0x196c44)>=_0x33fb35[_0x218e('0xa7')]){_0x2c346e=ut[_0x218e('0xc8')](_0x196c44,0xf,_0x218e('0xa8'));rpcDb[_0x218e('0x97')](_0x2c346e,_0x218e('0xed'));}else{rpcDb[_0x218e('0x97')](_0x196c44,_0x218e('0xed'));}delete this[_0x218e('0x1a')][_0x552632['linkedid']];}if(!(_0x196c44[_0x218e('0x72')]&&_0x31f84c==='16')){ut['updateOriginated'](_0x33fb35,_0x218e('0xee'));logger[_0x218e('0x5c')](_0x218e('0xef'),_0x196c44['uniqueid'],_0x218e('0xf0'),_0x33fb35[_0x218e('0x55')],_0x218e('0x6f'),_0x33fb35[_0x218e('0x4d')]);}if(_0x31f84c!==_0x218e('0xb0')){delete this[_0x218e('0x1a')][_0x552632['linkedid']];delete this['actions'][_0x552632[_0x218e('0xf1')]];}}};Preview[_0x218e('0x13')][_0x218e('0xf2')]=function(_0x1e93ac,_0xae6ed0,_0x50a78f){if(_[_0x218e('0xf3')](_0xae6ed0)&&'object'!==typeof _0xae6ed0){return;}if(_[_0x218e('0xf3')](_0x50a78f)&&_0x218e('0xf4')!==typeof _0x50a78f){return;}switch(_0x50a78f['reason']){case'0':ut[_0x218e('0xf5')](_0x1e93ac,0x0,_0x218e('0xa3'));rpcDb[_0x218e('0xf6')](_0x1e93ac,_0x218e('0xf7'));break;case'3':ut['logAgent'](_0x1e93ac,0x3,_0x218e('0xce'));rpcDb[_0x218e('0xf6')](_0x1e93ac,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x1e93ac,0x5,_0x218e('0xf8'));rpcDb['createAgentHistory'](_0x1e93ac,_0x218e('0xf9'));break;case'8':ut['logAgent'](_0x1e93ac,0x8,_0x218e('0xd5'));rpcDb[_0x218e('0xf6')](_0x1e93ac,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x218e('0xf5')](_0x1e93ac,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x1e93ac,_0x218e('0xfa'));break;default:ut[_0x218e('0xf5')](_0x1e93ac,0xc,_0x50a78f['reason']);rpcDb[_0x218e('0xf6')](_0x1e93ac,_0x218e('0xfb'));}ut[_0x218e('0x7b')](_0xae6ed0,_0x218e('0xfc'));logger[_0x218e('0x5c')](_0x218e('0xfd'),_0x1e93ac['uniqueid'],_0x218e('0xf0'),_0xae6ed0[_0x218e('0x55')],_0x218e('0x6f'),_0xae6ed0[_0x218e('0x4d')]);delete this['actions'][_0x1e93ac[_0x218e('0xc2')]];};Preview[_0x218e('0x13')][_0x218e('0xfe')]=function(_0x2b697b,_0x5e2300,_0x3fed24,_0x23668e,_0x127d0f){var _0x194f75=this;return new BPromise(function(_0x10bd24,_0x120878){if(_['isNil'](_0x5e2300)||_['isNil'](_0x5e2300['Contact'])||_[_0x218e('0x84')](_0x5e2300['Contact'][_0x218e('0xff')])||_['isNil'](_0x5e2300[_0x218e('0x74')])){_0x120878(ut[_0x218e('0x61')]('Contact\x20is\x20undefined',_0x23668e,_0x127d0f));return;}var _0x16a87d=uuid['v4']();var _0x42da09=_0x194f75[_0x218e('0x67')][_0x5e2300[_0x218e('0x6d')][_0x218e('0x55')]];var _0x3b7d23=_0x3fed24?_0x194f75[_0x218e('0x1b')][_0x3fed24]['id']:undefined;_0x194f75[_0x218e('0x1a')][_0x16a87d]=new Action(_0x5e2300,_0x42da09,_0x16a87d,_0x3fed24,_0x3b7d23);var _0x2dd623=_0x194f75['actions'][_0x16a87d];_0x2dd623['unlockAgent']=_0x23668e;_0x2dd623[_0x218e('0xaf')]=_0x127d0f;_0x2dd623['lookAgent']=_0x3fed24;if(_[_0x218e('0x100')](_0x2b697b)){_0x194f75['execCall'](_0x2dd623,_0x42da09,_0x5e2300,_0x3fed24)[_0x218e('0x83')](function(_0x325b24){logger[_0x218e('0x5c')](_0x218e('0x101'),_0x218e('0x102')+_0x2dd623[_0x218e('0x6e')]+'\x20IdHopper:\x20'+_0x2dd623[_0x218e('0x103')],JSON[_0x218e('0x70')](_0x325b24));ami['emit'](_0x218e('0x104'),ut[_0x218e('0xb3')](_0x2dd623,_0x218e('0x105')));_0x10bd24(ut[_0x218e('0x61')](_0x218e('0x106')));})[_0x218e('0x79')](function(_0x4a1cfa){ut[_0x218e('0x107')](_0x218e('0x108'),_0x4a1cfa);_0x120878(ut[_0x218e('0x61')](_0x218e('0x109'),_0x23668e,_0x127d0f));});}else{_0x42da09['outboundBlacklistCallsDay']+=0x1;ut[_0x218e('0x10a')](_0x2dd623);rpcDb[_0x218e('0x10b')](_0x2dd623,_0x218e('0x10c'));delete _0x194f75[_0x218e('0x1a')][_0x16a87d];_0x120878(ut['message'](_0x218e('0x10d'),_0x23668e,_0x127d0f));}});};Preview[_0x218e('0x13')][_0x218e('0x9c')]=function(_0x4e41d3){return!_[_0x218e('0x84')](_0x4e41d3)&&!_[_0x218e('0x84')](_0x4e41d3[_0x218e('0x55')])&&!_['isNil'](_0x4e41d3[_0x218e('0x56')])&&_0x4e41d3[_0x218e('0x56')]&&!_[_0x218e('0x84')](this[_0x218e('0x19')][util[_0x218e('0x59')]('SIP/%s',_0x4e41d3['name'])])&&!_[_0x218e('0x84')](this['trunks'][util[_0x218e('0x59')](_0x218e('0x10e'),_0x4e41d3[_0x218e('0x55')])][_0x218e('0x77')])&&(this[_0x218e('0x19')][util['format'](_0x218e('0x10e'),_0x4e41d3['name'])][_0x218e('0x77')]===_0x218e('0x10f')||this[_0x218e('0x19')][util[_0x218e('0x59')](_0x218e('0x10e'),_0x4e41d3[_0x218e('0x55')])][_0x218e('0x77')]===_0x218e('0x110'));};Preview[_0x218e('0x13')][_0x218e('0x8a')]=function(_0x1c5372,_0x515219){var _0x4606a7=this;return new BPromise(function(_0x1f765b,_0x1dcb8e){_0x4606a7[_0x218e('0x111')](_0x1c5372,_0x515219)[_0x218e('0x83')](function(_0x212605){_0x1f765b(_['pick'](_0x212605,[_0x218e('0x61')]));})[_0x218e('0x79')](function(_0x5bcc94){if(_0x5bcc94[_0x218e('0x112')]){rpcDb[_0x218e('0x113')](_0x1c5372);}if(_0x5bcc94['active']){rpcDb['disableContact'](_0x1c5372);}_0x1dcb8e(_[_0x218e('0x114')](_0x5bcc94,['message']));});});};Preview[_0x218e('0x13')][_0x218e('0x111')]=function(_0xa70fc3,_0x10f3d0){var _0x1a202e=this;return new BPromise(function(_0x347f46,_0x28aadf){var _0x11b0a2,_0x222b90;rpcDb[_0x218e('0x115')](_0xa70fc3)[_0x218e('0x83')](function(_0x271a4d){if(!_[_0x218e('0x84')](_0x271a4d[0x0])){_0x222b90=_0x271a4d[0x0]['recallme']?![]:!![];_0x11b0a2=_0x271a4d[0x0][_0x218e('0x116')]?!![]:![];_0x11b0a2=_0x10f3d0?!![]:_0x11b0a2;}var _0x15de58=_0x1a202e[_0x218e('0x117')](_0x271a4d);if(_0x15de58[_0x218e('0x118')]){rpcDb[_0x218e('0x119')](_[_0x218e('0x114')](_0x271a4d[0x0],[_0x218e('0x74'),_0x218e('0x11a')]))[_0x218e('0x83')](function(_0x202580){_0x1a202e[_0x218e('0xfe')](_0x202580,_0x271a4d[0x0],_0x10f3d0,_0x222b90,_0x11b0a2)['then'](function(_0xf8ab01){_0x347f46(_0xf8ab01);})[_0x218e('0x79')](function(_0x2d5dc3){_0x28aadf(_0x2d5dc3);});})[_0x218e('0x79')](function(_0x3de14a){ut[_0x218e('0x107')](_0x218e('0x11b'),_0x3de14a);_0x28aadf(ut[_0x218e('0x61')](_0x218e('0x11c'),_0x222b90,_0x11b0a2));});}else{_0x28aadf(ut[_0x218e('0x61')](_0x15de58['message'],_0x222b90,_0x11b0a2));}})['catch'](function(_0x58782e){ut[_0x218e('0x107')](_0x218e('0x11d'),_0x58782e);_0x28aadf(ut[_0x218e('0x61')](_0x218e('0x11c'),![],!![]));});});};Preview['prototype'][_0x218e('0x117')]=function(_0x342da9){if(_[_0x218e('0x84')](_0x342da9)||_['isEmpty'](_0x342da9)||!_[_0x218e('0x84')](_0x342da9[0x0][_0x218e('0x88')])&&_[_0x218e('0x84')](_0x342da9[0x0][_0x218e('0x88')][_0x218e('0x55')])){ut[_0x218e('0x107')]('[Preview][validateContact][Empty\x20Contact]',_0x342da9);return{'isValid':![],'message':_0x218e('0x11e')};}var _0x4ba62e=this['campaignsPreview'][_0x342da9[0x0]['Queue'][_0x218e('0x55')]];_0x4ba62e[_0x218e('0x61')]='ACTIVE';if(_[_0x218e('0x84')](_0x4ba62e)){ut[_0x218e('0x107')](_0x218e('0x11f'),_0x4ba62e);return{'isValid':![],'message':_0x218e('0x120')};}if(!this[_0x218e('0x9c')](_0x4ba62e['Trunk'])){ut[_0x218e('0x107')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x218e('0x121')+_0x4ba62e[_0x218e('0x55')]+_0x218e('0x122'));if(!this[_0x218e('0x9c')](_0x4ba62e[_0x218e('0x9d')])){ut['logger'](_0x218e('0x123'),_0x4ba62e['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x218e('0x124')};}}if(!ut[_0x218e('0x9b')](_0x4ba62e[_0x218e('0x35')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x4ba62e['name']+_0x218e('0x125'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4ba62e[_0x218e('0x55')]+_0x218e('0x125')};}return{'isValid':!![],'message':_0x218e('0x126')};};Preview[_0x218e('0x13')][_0x218e('0x127')]=function(_0x339f5f,_0x42017d,_0x2a72ff,_0x40b9a6){var _0x3b11c4=this;return new BPromise(function(_0x46f802,_0x6d701e){var _0x5058c=_0x339f5f[_0x218e('0xc2')];var _0x2b3456=_0x3b11c4[_0x218e('0x9c')](_0x42017d[_0x218e('0x54')])?util[_0x218e('0x59')](_0x218e('0x128'),_0x42017d[_0x218e('0x54')][_0x218e('0x55')],_['isNil'](_0x42017d[_0x218e('0x3a')])?'':_0x42017d[_0x218e('0x3a')][_0x218e('0x129')]()||'',_0x42017d[_0x218e('0x12a')]>0x0?_0x2a72ff['Contact'][_0x218e('0xff')][_0x218e('0x12b')](_0x42017d[_0x218e('0x12a')]):_0x2a72ff[_0x218e('0x12c')][_0x218e('0xff')]):util[_0x218e('0x59')](_0x218e('0x128'),_[_0x218e('0x84')](_0x42017d['TrunkBackup'])?_0x42017d[_0x218e('0x54')][_0x218e('0x55')]:_0x42017d[_0x218e('0x9d')][_0x218e('0x55')],_[_0x218e('0x84')](_0x42017d[_0x218e('0x3a')])?'':_0x42017d[_0x218e('0x3a')][_0x218e('0x129')]()||'',_0x42017d[_0x218e('0x12a')]>0x0?_0x2a72ff['Contact']['phone'][_0x218e('0x12b')](_0x42017d[_0x218e('0x12a')]):_0x2a72ff[_0x218e('0x12c')][_0x218e('0xff')]);var _0x2d447c=_0x3b11c4['isTrunkReachable'](_0x42017d[_0x218e('0x54')])?ut[_0x218e('0x12d')](_0x42017d[_0x218e('0x54')][_0x218e('0x57')],_0x42017d[_0x218e('0x37')],_0x42017d[_0x218e('0x12e')]>0x0?ut['getCallerIdRandom'](_0x42017d[_0x218e('0x38')],_0x42017d[_0x218e('0x12e')]):_0x42017d[_0x218e('0x38')]):ut[_0x218e('0x12d')](_[_0x218e('0x84')](_0x42017d[_0x218e('0x9d')])?_0x42017d[_0x218e('0x54')][_0x218e('0x57')]:_0x42017d[_0x218e('0x9d')]['callerid'],_0x42017d[_0x218e('0x37')],_0x42017d['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x42017d[_0x218e('0x38')],_0x42017d[_0x218e('0x12e')]):_0x42017d[_0x218e('0x38')]);if(_0x2d447c){_0x339f5f['originatecalleridname']=ut[_0x218e('0x12f')](_0x2d447c);_0x339f5f['originatecalleridnum']=ut[_0x218e('0x130')](_0x2d447c);}var _0x55320e=ut['addVariables'](_0x42017d,_0x2a72ff,_0x2b3456,_0x2d447c,_0x5058c,_0x339f5f);_[_0x218e('0x131')](_0x339f5f,ut['toLowerVariables'](_0x55320e));_0x339f5f[_0x218e('0x132')]=moment()[_0x218e('0x59')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x218e('0x76')](ut[_0x218e('0x133')](_0x339f5f,_0x42017d,_0x55320e,_0x339f5f[_0x218e('0xaf')],_0x40b9a6))['then'](function(_0x4dceba){_0x42017d[_0x218e('0x4d')]+=0x1;logger['info'](_0x218e('0x134'),_0x5058c,_0x218e('0xf0'),_0x42017d[_0x218e('0x55')],_0x218e('0x6f'),_0x42017d[_0x218e('0x4d')]);_0x46f802(_0x4dceba);})[_0x218e('0x79')](function(_0x67f90){ut[_0x218e('0xf5')](_0x339f5f,0xe,_0x218e('0x135'));rpcDb[_0x218e('0xf6')](_0x339f5f,'[originateFailure][logOriginateFailure]');_0x6d701e(_0x67f90);});});};Preview['prototype']['syncNewExten']=function(_0x2dba63){if(this['actions'][_0x2dba63['linkedid']]){this[_0x218e('0x1a')][_0x2dba63[_0x218e('0x136')]]['channel']=_0x2dba63[_0x218e('0x78')];}};Preview[_0x218e('0x13')][_0x218e('0x137')]=function(_0x5830ab){var _0x5246e0=this;var _0x3fe7ed=this[_0x218e('0x1a')][_0x5830ab[_0x218e('0x138')]];if(_0x3fe7ed){if(_0x3fe7ed['lookAgent']&&this[_0x218e('0x1b')][_0x3fe7ed['lookAgent']]){ut[_0x218e('0x139')](_0x3fe7ed,this[_0x218e('0x1b')][_0x3fe7ed[_0x218e('0x13a')]]['name'],this[_0x218e('0x1b')][_0x3fe7ed['lookAgent']]['id']);}var _0x3103d8=_[_0x218e('0x13b')](_0x3fe7ed);_0x3103d8[_0x218e('0xb1')]=moment()[_0x218e('0x59')](_0x218e('0x8d'));var _0x16bfca=_0x5246e0[_0x218e('0x67')][_0x3fe7ed['queue']];if(ut[_0x218e('0x13c')](_0x5830ab[_0x218e('0x13d')])){if(_0x3fe7ed['unlockAgent']){rpcDb[_0x218e('0x113')](_0x3fe7ed[_0x218e('0x103')]);}if(_0x3fe7ed[_0x218e('0xaf')]){rpcDb['disableContact'](_0x3fe7ed[_0x218e('0x103')]);}ami[_0x218e('0xa4')](_0x218e('0x13e'),ut[_0x218e('0xb3')](_0x3fe7ed,_0x218e('0x13f')));this['callProgressDetectingAgent'](_0x3103d8,_0x16bfca,_0x5830ab);}else{_0x3fe7ed[_0x218e('0x132')]=moment()[_0x218e('0x59')](_0x218e('0x8d'));ut[_0x218e('0xf5')](_0x3103d8,0x4,'Answer');rpcDb['createAgentHistory'](_0x3103d8,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x218e('0x13')][_0x218e('0x1f')]=function(_0x3f9c18){var _0x45077f=this;var _0x27fec0=this[_0x218e('0x1a')][_0x3f9c18['linkedid']];var _0x2589e8;if(_0x27fec0){_0x2589e8=this[_0x218e('0x67')][_0x27fec0[_0x218e('0x6e')]];logger[_0x218e('0x5c')](_0x218e('0x140'),_0x3f9c18[_0x218e('0x136')],_0x218e('0xf0'),_0x2589e8[_0x218e('0x55')],_0x218e('0x71'),_0x2589e8[_0x218e('0x5e')]);}if(this[_0x218e('0x1a')][_0x3f9c18[_0x218e('0x136')]]&&_0x3f9c18[_0x218e('0x136')]!==_0x3f9c18['uniqueid']){if(_0x3f9c18[_0x218e('0x141')]==='16'&&this[_0x218e('0x1a')][_0x3f9c18[_0x218e('0x136')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x3f9c18,_0x3f9c18[_0x218e('0x136')],_0x3f9c18[_0x218e('0x141')]);}else if(this[_0x218e('0x1a')][_0x3f9c18[_0x218e('0x136')]][_0x218e('0x72')]){logger['info'](_0x218e('0x142'),_0x3f9c18['linkedid'],_0x3f9c18[_0x218e('0x141')],_0x218e('0xf0'),_0x2589e8[_0x218e('0x55')],'pTalking:\x20',_0x2589e8['pTalking']);this[_0x218e('0xa0')](_0x3f9c18,_0x3f9c18[_0x218e('0x136')],_0x3f9c18['cause']);}}else if(_0x27fec0&&_[_0x218e('0x84')](_0x27fec0[_0x218e('0x143')])&&_0x2589e8[_0x218e('0x144')]&&_0x3f9c18['linkedid']===_0x3f9c18[_0x218e('0xc2')]&&_[_0x218e('0x84')](_0x3f9c18[_0x218e('0x145')])&&_0x3f9c18[_0x218e('0x141')]==='16'&&_0x3f9c18[_0x218e('0x146')]==='6'&&_[_0x218e('0xf3')](_0x27fec0[_0x218e('0x147')])){if(_0x27fec0['unlockAgent']){rpcDb[_0x218e('0x113')](_0x27fec0[_0x218e('0x103')]);}if(_0x27fec0['activeContact']){rpcDb['disableContact'](_0x27fec0[_0x218e('0x103')]);}_0x3f9c18['reason']='22';this[_0x218e('0xf2')](_0x27fec0,_0x2589e8,_0x3f9c18);}else if(_0x27fec0&&_0x27fec0['transfer']){if(_0x3f9c18['cause']==='16'&&this[_0x218e('0x1a')][_0x3f9c18[_0x218e('0x136')]]['dialAnswer']){logger[_0x218e('0x5c')]('[syncHangup][talking][transfer]',_0x3f9c18[_0x218e('0x136')],_0x3f9c18[_0x218e('0x141')],_0x218e('0xf0'),_0x2589e8[_0x218e('0x55')],_0x218e('0x71'),_0x2589e8[_0x218e('0x5e')]);this[_0x218e('0xa0')](_0x3f9c18,_0x3f9c18[_0x218e('0x136')],_0x3f9c18[_0x218e('0x141')]);}else if(this['actions'][_0x3f9c18[_0x218e('0x136')]]['dialAnswer']){logger[_0x218e('0x5c')](_0x218e('0x142'),_0x3f9c18[_0x218e('0x136')],_0x3f9c18[_0x218e('0x141')],_0x218e('0xf0'),_0x2589e8[_0x218e('0x55')],_0x218e('0x71'),_0x2589e8['pTalking']);this[_0x218e('0xa0')](_0x3f9c18,_0x3f9c18['linkedid'],_0x3f9c18['cause']);}}};Preview[_0x218e('0x13')][_0x218e('0x23')]=function(_0x389600){if(this['actions'][_0x389600['destlinkedid']]&&_0x389600[_0x218e('0xf1')]!==_0x389600[_0x218e('0x148')]){this[_0x218e('0xa0')](_0x389600,_0x389600[_0x218e('0xf1')],_0x389600[_0x218e('0xeb')]);}};Preview['prototype']['syncHangupRequest']=function(_0x5b0ac8){if(this[_0x218e('0x1a')][_0x5b0ac8[_0x218e('0x136')]]&&_0x5b0ac8[_0x218e('0x136')]!==_0x5b0ac8[_0x218e('0xc2')]&&!this['actions'][_0x5b0ac8[_0x218e('0x136')]][_0x218e('0x72')]){if(_0x5b0ac8[_0x218e('0x141')]==='1'){this[_0x218e('0xa0')](_0x5b0ac8,_0x5b0ac8[_0x218e('0x136')],_0x5b0ac8[_0x218e('0x141')]);}}};Preview['prototype'][_0x218e('0x149')]=function(_0x229d6b,_0x3002c5,_0x290647){if(this[_0x218e('0x1a')][_0x229d6b]){if(_[_0x218e('0x84')](this[_0x218e('0x1a')][_0x229d6b][_0x218e('0x14a')])){this['actions'][_0x229d6b][_0x218e('0x14a')]={};}this['actions'][_0x229d6b][_0x218e('0x14a')][_0x3002c5]=_0x290647;}};Preview[_0x218e('0x13')]['syncVarSet']=function(_0x1f662d){try{if(!_[_0x218e('0x84')](_0x1f662d)){if(ut[_0x218e('0x14b')](_[_0x218e('0x14c')](_0x1f662d[_0x218e('0x14d')])[0x0])){this[_0x218e('0x149')](_0x1f662d[_0x218e('0xc2')],_[_0x218e('0x14c')](_0x1f662d[_0x218e('0x14d')])[0x0],_0x1f662d['value']);}}}catch(_0x5cb8ec){logger['error'](_0x218e('0x14e'),util[_0x218e('0x14f')](_0x5cb8ec,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x218e('0x150')]=function(_0x318a3b){if(_0x318a3b){if(this[_0x218e('0x1a')][_0x318a3b[_0x218e('0x151')]]){this[_0x218e('0x1a')][_0x318a3b[_0x218e('0x151')]][_0x218e('0x147')]=!![];}}};Preview[_0x218e('0x13')][_0x218e('0x152')]=function(_0x16f750){if(_0x16f750){if(this[_0x218e('0x1a')][_0x16f750['transfererlinkedid']]){this['actions'][_0x16f750[_0x218e('0x153')]]['transfer']=!![];}}};module[_0x218e('0x154')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 46faf1b..77399d8 100644 --- a/server/services/ami/preview/rpcDb.js +++ b/server/services/ami/preview/rpcDb.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0faf=['rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','connectedlinename','membername','from-sip','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','then','createHistory','resolve','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal'];(function(_0x48b977,_0x135e03){var _0x4fd510=function(_0x1d2653){while(--_0x1d2653){_0x48b977['push'](_0x48b977['shift']());}};_0x4fd510(++_0x135e03);}(_0x0faf,0x132));var _0xf0fa=function(_0x218ca4,_0x41cc40){_0x218ca4=_0x218ca4-0x0;var _0x1b3ff9=_0x0faf[_0x218ca4];return _0x1b3ff9;};'use strict';var util=require(_0xf0fa('0x0'));var BPromise=require('bluebird');var logger=require(_0xf0fa('0x1'))(_0xf0fa('0x2'));var _=require(_0xf0fa('0x3'));var cmHopper=require(_0xf0fa('0x4'));var cmHopperFinal=require(_0xf0fa('0x5'));var cmHopperHistory=require(_0xf0fa('0x6'));var cmHopperBlack=require(_0xf0fa('0x7'));var voiceQueueRt=require(_0xf0fa('0x8'));var agentReportPreview=require(_0xf0fa('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x3637a3){return function(_0x44ffa0){logger[_0xf0fa('0xa')](_0x3637a3,util[_0xf0fa('0xb')](_0x44ffa0,{'showHidden':![],'depth':null}));};}function create(_0x2db1d9){return BPromise['resolve']()[_0xf0fa('0xc')](cmHopperHistory[_0xf0fa('0xd')](_0x2db1d9))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x3bda51){return BPromise[_0xf0fa('0xe')]()[_0xf0fa('0xc')](agentReportPreview[_0xf0fa('0xd')](_0x3bda51))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x10')));}function moveContact(_0x379ff6){return BPromise[_0xf0fa('0xe')]()['then'](cmHopper[_0xf0fa('0x11')](_0x379ff6,!![]))['catch'](loggerCatch(_0xf0fa('0x12')));}exports['checkIsBlackList']=function(_0x39ae2b){return BPromise[_0xf0fa('0xe')]()[_0xf0fa('0xc')](cmHopperBlack['checkIsBlackList'](_0x39ae2b))['catch'](loggerCatch(_0xf0fa('0x13')));};exports['getContactPreview']=function(_0x1f7159){return BPromise[_0xf0fa('0xe')]()[_0xf0fa('0xc')](cmHopper[_0xf0fa('0x14')](_0x1f7159))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x15')));};exports[_0xf0fa('0xd')]=function(_0x3f3bb7,_0x497542){create(_0x3f3bb7)[_0xf0fa('0xf')](loggerCatch(_0x497542));moveContact(_0x3f3bb7)[_0xf0fa('0xf')](loggerCatch(_0x497542));};exports[_0xf0fa('0x16')]=function(_0x1d3c22,_0x2bdf82){createAgent(_0x1d3c22)[_0xf0fa('0xf')](loggerCatch(_0x2bdf82));};exports['createCustomerHistory']=function(_0x56ef81,_0x2f376d){create(_0x56ef81)[_0xf0fa('0xf')](loggerCatch(_0x2f376d));};exports[_0xf0fa('0x17')]=function(_0x2385e2,_0x1a3620){moveContact(_0x2385e2)[_0xf0fa('0xf')](loggerCatch(_0x1a3620));};exports[_0xf0fa('0x18')]=function(_0x3de639,_0x3b87a2,_0x15942b){if(_0x3b87a2){_0x3de639[_0xf0fa('0x19')]=null;}if(_0x15942b){_0x3de639['active']=![];}return BPromise[_0xf0fa('0xe')]()[_0xf0fa('0xc')](cmHopper[_0xf0fa('0x18')](_0x3de639))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x1a')));};exports[_0xf0fa('0x1b')]=function(_0x3901aa){return BPromise[_0xf0fa('0xe')]()[_0xf0fa('0xc')](cmHopper['countReScheduled'](_0x3901aa))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x1c')));};exports['unlockContact']=function(_0x3b5d7d){return BPromise[_0xf0fa('0xe')]()[_0xf0fa('0xc')](cmHopper['unlockContact']({'UserId':null},_0x3b5d7d,0x1))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x1d')));};exports[_0xf0fa('0x1e')]=function(_0xf631f6){return BPromise['resolve']()['then'](cmHopper[_0xf0fa('0x1f')]({'active':![]},_0xf631f6,0x1))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x20')));};exports[_0xf0fa('0x21')]=function(_0x57b8e9){var _0x4058d6={};_0x4058d6[_0xf0fa('0x22')]=_0x57b8e9[_0xf0fa('0x22')];_0x4058d6['uniqueid']=_0x57b8e9[_0xf0fa('0x23')];_0x4058d6['calleridnum']=_0x57b8e9[_0xf0fa('0x24')];_0x4058d6[_0xf0fa('0x25')]=_0x57b8e9[_0xf0fa('0x25')];_0x4058d6['queue']=_0x57b8e9[_0xf0fa('0x26')];_0x4058d6[_0xf0fa('0x27')]=_0x57b8e9[_0xf0fa('0x28')];_0x4058d6[_0xf0fa('0x29')]=_0x57b8e9[_0xf0fa('0x28')];_0x4058d6[_0xf0fa('0x2a')]=0x1;_0x4058d6['queuecallercompleteAt']=_0x57b8e9['endtime'];_0x4058d6[_0xf0fa('0x2b')]=_0x57b8e9[_0xf0fa('0x2c')];_0x4058d6['context']=_0xf0fa('0x2d');_0x4058d6['exten']='xcally-motion-preview';_0x4058d6['holdtime']=0x0;_0x4058d6[_0xf0fa('0x2e')]=0x1;_0x4058d6['lastAssignedTo']=_0x57b8e9[_0xf0fa('0x2c')];_0x4058d6[_0xf0fa('0x2f')]=_0xf0fa('0x30');return BPromise[_0xf0fa('0xe')]()[_0xf0fa('0xc')](voiceQueueReport[_0xf0fa('0x31')](_0x4058d6))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x32')));};exports['getContactRecallMe']=function(_0x3abd96,_0x307aa8){return BPromise[_0xf0fa('0xe')]()['then'](cmHopper[_0xf0fa('0x33')](_0x3abd96,_0x307aa8))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x34')));};exports[_0xf0fa('0x35')]=function(_0x4879ef){return BPromise['resolve']()[_0xf0fa('0xc')](cmHopper[_0xf0fa('0x18')](_0x4879ef,!![],!![]))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x36')));}; \ No newline at end of file +var _0x5ad3=['[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','calleridnum','calleridname','answertime','queuecallercomplete','endtime','membername','from-sip','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createHistory','createAgentHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled'];(function(_0x4ca164,_0x453db6){var _0x18b051=function(_0x5a584c){while(--_0x5a584c){_0x4ca164['push'](_0x4ca164['shift']());}};_0x18b051(++_0x453db6);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x39db05,_0x3868d0){_0x39db05=_0x39db05-0x0;var _0x3f0e22=_0x5ad3[_0x39db05];return _0x3f0e22;};'use strict';var util=require(_0x35ad('0x0'));var BPromise=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var _=require('lodash');var cmHopper=require(_0x35ad('0x4'));var cmHopperFinal=require(_0x35ad('0x5'));var cmHopperHistory=require(_0x35ad('0x6'));var cmHopperBlack=require(_0x35ad('0x7'));var voiceQueueRt=require(_0x35ad('0x8'));var agentReportPreview=require(_0x35ad('0x9'));var voiceQueueReport=require(_0x35ad('0xa'));function loggerCatch(_0x436dcb){return function(_0x36c606){logger[_0x35ad('0xb')](_0x436dcb,util['inspect'](_0x36c606,{'showHidden':![],'depth':null}));};}function create(_0x292521){return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](cmHopperHistory['createHistory'](_0x292521))[_0x35ad('0xe')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x5a29e3){return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](agentReportPreview['createHistory'](_0x5a29e3))[_0x35ad('0xe')](loggerCatch(_0x35ad('0xf')));}function moveContact(_0x4ad760){return BPromise['resolve']()[_0x35ad('0xd')](cmHopper[_0x35ad('0x10')](_0x4ad760,!![]))['catch'](loggerCatch(_0x35ad('0x11')));}exports[_0x35ad('0x12')]=function(_0x595fe8){return BPromise['resolve']()[_0x35ad('0xd')](cmHopperBlack[_0x35ad('0x12')](_0x595fe8))[_0x35ad('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x35ad('0x13')]=function(_0x2ebceb){return BPromise['resolve']()[_0x35ad('0xd')](cmHopper['getContactPreview'](_0x2ebceb))['catch'](loggerCatch(_0x35ad('0x14')));};exports[_0x35ad('0x15')]=function(_0x27efeb,_0x56cb8e){create(_0x27efeb)[_0x35ad('0xe')](loggerCatch(_0x56cb8e));moveContact(_0x27efeb)[_0x35ad('0xe')](loggerCatch(_0x56cb8e));};exports[_0x35ad('0x16')]=function(_0x3158a1,_0x3a73c8){createAgent(_0x3158a1)[_0x35ad('0xe')](loggerCatch(_0x3a73c8));};exports['createCustomerHistory']=function(_0xd32a43,_0x2876ad){create(_0xd32a43)['catch'](loggerCatch(_0x2876ad));};exports['createCustomerFinal']=function(_0x3251d9,_0x398853){moveContact(_0x3251d9)['catch'](loggerCatch(_0x398853));};exports[_0x35ad('0x17')]=function(_0x32735e,_0x496620,_0x37c03d){if(_0x496620){_0x32735e[_0x35ad('0x18')]=null;}if(_0x37c03d){_0x32735e[_0x35ad('0x19')]=![];}return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](cmHopper[_0x35ad('0x17')](_0x32735e))[_0x35ad('0xe')](loggerCatch(_0x35ad('0x1a')));};exports[_0x35ad('0x1b')]=function(_0xebc6c5){return BPromise['resolve']()[_0x35ad('0xd')](cmHopper[_0x35ad('0x1b')](_0xebc6c5))['catch'](loggerCatch(_0x35ad('0x1c')));};exports[_0x35ad('0x1d')]=function(_0xa3cb9f){return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](cmHopper['unlockContact']({'UserId':null},_0xa3cb9f,0x1))[_0x35ad('0xe')](loggerCatch(_0x35ad('0x1e')));};exports[_0x35ad('0x1f')]=function(_0x1ca61d){return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](cmHopper[_0x35ad('0x1d')]({'active':![]},_0x1ca61d,0x1))[_0x35ad('0xe')](loggerCatch('[activeContact]\x20'));};exports[_0x35ad('0x20')]=function(_0x11da54){var _0x2f8b3={};_0x2f8b3[_0x35ad('0x21')]=_0x11da54[_0x35ad('0x21')];_0x2f8b3['uniqueid']=_0x11da54['uniqueid'];_0x2f8b3[_0x35ad('0x22')]=_0x11da54['calleridnum'];_0x2f8b3[_0x35ad('0x23')]=_0x11da54['calleridname'];_0x2f8b3['queue']=_0x11da54['queue'];_0x2f8b3['queuecallerjoinAt']=_0x11da54[_0x35ad('0x24')];_0x2f8b3['queuecallerleaveAt']=_0x11da54['answertime'];_0x2f8b3[_0x35ad('0x25')]=0x1;_0x2f8b3['queuecallercompleteAt']=_0x11da54[_0x35ad('0x26')];_0x2f8b3['connectedlinename']=_0x11da54[_0x35ad('0x27')];_0x2f8b3['context']=_0x35ad('0x28');_0x2f8b3['exten']=_0x35ad('0x29');_0x2f8b3[_0x35ad('0x2a')]=0x0;_0x2f8b3[_0x35ad('0x2b')]=0x1;_0x2f8b3['lastAssignedTo']=_0x11da54[_0x35ad('0x27')];_0x2f8b3[_0x35ad('0x2c')]=_0x35ad('0x2d');return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](voiceQueueReport['create'](_0x2f8b3))['catch'](loggerCatch(_0x35ad('0x2e')));};exports[_0x35ad('0x2f')]=function(_0x378e2a,_0x1c8a3d){return BPromise['resolve']()[_0x35ad('0xd')](cmHopper[_0x35ad('0x2f')](_0x378e2a,_0x1c8a3d))[_0x35ad('0xe')](loggerCatch(_0x35ad('0x30')));};exports[_0x35ad('0x31')]=function(_0x3b7b52){return BPromise['resolve']()['then'](cmHopper[_0x35ad('0x17')](_0x3b7b52,!![],!![]))[_0x35ad('0xe')](loggerCatch(_0x35ad('0x32')));}; \ 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 0f46fec..0c99bb7 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 _0x4bd3=['addVariables','Queue','name','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','responsetime','endtime','statedesc','starttime','membername','UserId','ringtime','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','channelAgent','calleridnum','from-sip','timeout','countcongestionretry','countnoanswerretry','countagentrejectretry','clone','scheduledAt','scheduledat','add','minutes','ContactId','ListId','VoiceQueueId','pTalking','buildObj','queue','buildAcw','uniqueid','agentReadyId','hasOwnProperty','not_inuse','status','reachable','push','getDiff','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','calleridname','active','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','extractCalleridName','extractCalleridNumber','match','util','moment','../../../../config/logger','127.0.0.1','milliseconds','diff','seconds','error','inspect','logger','info','loggerError','message','getCallerId','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','isActive','isNil'];(function(_0x3987dc,_0x170b21){var _0x2a15bb=function(_0x44dcbd){while(--_0x44dcbd){_0x3987dc['push'](_0x3987dc['shift']());}};_0x2a15bb(++_0x170b21);}(_0x4bd3,0x174));var _0x34bd=function(_0x5bdf4f,_0x2c260d){_0x5bdf4f=_0x5bdf4f-0x0;var _0x474581=_0x4bd3[_0x5bdf4f];return _0x474581;};'use strict';var util=require(_0x34bd('0x0'));var _=require('lodash');var moment=require(_0x34bd('0x1'));var logger=require(_0x34bd('0x2'))('preview');var ipAgi=process['env']['XCALLY_IP_AGI']||_0x34bd('0x3');function getSeconds(_0x44854a,_0x1fc8eb){var _0x5846f3=moment(_0x44854a)[_0x34bd('0x4')](0x0);var _0x2a15a2=moment(_0x1fc8eb)['milliseconds'](0x0);return _0x5846f3[_0x34bd('0x5')](_0x2a15a2,_0x34bd('0x6'));}exports['loggerCatch']=function(_0xd600e1){return function(_0x76de8d){logger[_0x34bd('0x7')](_0xd600e1,util[_0x34bd('0x8')](_0x76de8d,{'showHidden':![],'depth':null}));};};exports[_0x34bd('0x9')]=function(_0x36a463,_0x4db0ba){logger[_0x34bd('0xa')](_0x36a463,util[_0x34bd('0x8')](_0x4db0ba,{'showHidden':![],'depth':null}));};exports[_0x34bd('0xb')]=function(_0x7c7992,_0x501b7f){logger['error'](_0x7c7992,util[_0x34bd('0x8')](_0x501b7f,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x4ac0dc){return function(_0x275d80){logger[_0x34bd('0xa')](_0x4ac0dc,util[_0x34bd('0x8')](_0x275d80,{'showHidden':![],'depth':null}));};};exports[_0x34bd('0xc')]=function(_0x2ee180,_0x14cd37,_0x4134ee){return{'message':_0x2ee180,'unlock':_0x14cd37,'active':_0x4134ee};};exports[_0x34bd('0xd')]=function(_0xf6d2f2,_0x59ed5d,_0x3fa6a8){if(!_['isUndefined'](_0x3fa6a8)&&'string'===typeof _0x3fa6a8&&!_[_0x34bd('0xe')](_0x3fa6a8)){if(!_[_0x34bd('0xf')](_0x59ed5d)&&_0x34bd('0x10')===typeof _0x59ed5d&&!_[_0x34bd('0xe')](_0x59ed5d)){return util[_0x34bd('0x11')](_0x34bd('0x12'),_0x59ed5d,_0x3fa6a8);}return util[_0x34bd('0x11')](_0x34bd('0x12'),_0x3fa6a8,_0x3fa6a8);}if(!_[_0x34bd('0xf')](_0xf6d2f2)&&_0x34bd('0x10')===typeof _0xf6d2f2&&!_[_0x34bd('0xe')](_0xf6d2f2)){return _0xf6d2f2;}return'\x22\x22\x20<>';};exports[_0x34bd('0x13')]=function(_0x324f7d){if(_[_0x34bd('0x14')](_0x324f7d)){return![];}return _0x324f7d;};exports[_0x34bd('0x15')]=function(_0x3976e4,_0x23a94a,_0x288638,_0x3d5f76,_0x130bd0,_0x55538e){var _0x15c0d1={'XMD-QUEUE':_0x23a94a[_0x34bd('0x16')]?_0x23a94a[_0x34bd('0x16')][_0x34bd('0x17')]:'','XMD-CALLERID':_0x3d5f76,'XMD-CALLERID-PREVIEW':_0x55538e?util[_0x34bd('0x11')]('\x22%s\x22\x20<%s>',_0x55538e['calleridname'],_0x55538e['calleridnum']):_0x3d5f76,'XMD-DIALID':_0x130bd0,'XMD-CONTACTID':_0x23a94a['ContactId'],'XMD-CDRTYPE':_0x34bd('0x18'),'CALLERID(all)':_0x3d5f76,'XMD-VOICEQUEUEID':_0x23a94a['VoiceQueueId'],'XMD-DIALCHANNEL':_0x288638,'XMD-DIALTIMEOUT':_0x3976e4[_0x34bd('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0x34bd('0x11')](_0x34bd('0x1a'),_0x3976e4['dialQueueProject2']?'g':'',_[_0x34bd('0xe')](_0x3976e4[_0x34bd('0x1b')])?'':_0x34bd('0x1c')),'XMD-DIALURL':_0x3976e4[_0x34bd('0x1d')]||'','XMD-AGI':_0x3976e4['dialQueueProject']?util[_0x34bd('0x11')](_0x34bd('0x1e'),ipAgi,_0x3976e4[_0x34bd('0x1f')]):_0x34bd('0x20'),'XMD-AGIAFTER':_0x3976e4['dialQueueProject2']?util[_0x34bd('0x11')](_0x34bd('0x1e'),ipAgi,_0x3976e4['dialQueueProject2']):_0x34bd('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x55538e?_0x55538e[_0x34bd('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x55538e?_0x55538e[_0x34bd('0x22')]:'','XMD-DESTINATION':_0x34bd('0x23')};if(!_[_0x34bd('0xe')](_0x3976e4[_0x34bd('0x1b')])){_0x15c0d1[util[_0x34bd('0x11')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3976e4[_0x34bd('0x1b')];_0x15c0d1[util[_0x34bd('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x130bd0;}if(_0x23a94a&&_0x23a94a['Contact']){for(var _0x38bdba in _0x23a94a[_0x34bd('0x24')]){if(_0x23a94a[_0x34bd('0x24')]['hasOwnProperty'](_0x38bdba)){if(!_['isNil'](_0x23a94a[_0x34bd('0x24')][_0x38bdba])&&_0x38bdba!=='id'&&_0x38bdba!==_0x34bd('0x25')&&_0x38bdba!==_0x34bd('0x26')&&_0x38bdba!==_0x34bd('0x27')){_0x15c0d1[util['format'](_0x34bd('0x28'),_0x34bd('0x29'),_[_0x34bd('0x2a')](_0x38bdba))]=_0x23a94a[_0x34bd('0x24')][_0x38bdba];}}}}return _0x15c0d1;};exports[_0x34bd('0x2b')]=function(_0x375cc7){var _0x4ae886={};for(var _0x72bb10 in _0x375cc7){if(_0x375cc7['hasOwnProperty'](_0x72bb10)){_0x4ae886[util[_0x34bd('0x11')]('%s',_[_0x34bd('0x2c')](_0x72bb10))]=_0x375cc7[_0x72bb10];}}return{'variables':_0x4ae886};};exports[_0x34bd('0x2d')]=function(_0x4e9e70,_0x2ff72e){if(!_[_0x34bd('0x14')](_0x4e9e70)){if(_0x4e9e70['hasOwnProperty'](_0x34bd('0x2e'))){if(_0x4e9e70[_0x34bd('0x2e')]>0x0){_0x4e9e70[_0x34bd('0x2e')]-=0x1;}else{logger['error'](_0x34bd('0x2f'),_0x2ff72e);}}}else{logger[_0x34bd('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x2ff72e);}};exports[_0x34bd('0x30')]=function(_0x41c377){var _0x2bcbf9=moment()[_0x34bd('0x11')](_0x34bd('0x31'));_0x41c377[_0x34bd('0x32')]=0xd;_0x41c377['statedesc']='Blacklist';_0x41c377['starttime']=_0x2bcbf9;_0x41c377[_0x34bd('0x33')]=_0x2bcbf9;_0x41c377[_0x34bd('0x34')]=_0x2bcbf9;};exports['logAgent']=function(_0x5b5f86,_0x13d2f0,_0x4f5c8f){var _0x597a82=moment()[_0x34bd('0x11')](_0x34bd('0x31'));_0x5b5f86[_0x34bd('0x32')]=_0x13d2f0;_0x5b5f86[_0x34bd('0x35')]=_0x4f5c8f;_0x5b5f86[_0x34bd('0x33')]=_0x597a82;_0x5b5f86['ringtime']=getSeconds(_0x5b5f86['responsetime'],_0x5b5f86[_0x34bd('0x36')]);};exports['logLookAgent']=function(_0xce6bc6,_0x2c9b7a,_0x3fc418){_0xce6bc6[_0x34bd('0x37')]=_0x2c9b7a;_0xce6bc6[_0x34bd('0x38')]=_0x3fc418;};exports['logCustomer']=function(_0x282297,_0xc1f4c4,_0x16858c){var _0x1b86e1=moment()['format'](_0x34bd('0x31'));_0x282297['state']=_0xc1f4c4;_0x282297[_0x34bd('0x35')]=_0x16858c;_0x282297[_0x34bd('0x33')]=_0x282297['responsetime']?_0x282297[_0x34bd('0x33')]:_0x1b86e1;_0x282297['endtime']=_0x282297[_0x34bd('0x34')]?_0x282297[_0x34bd('0x34')]:_0x1b86e1;_0x282297[_0x34bd('0x39')]=getSeconds(_0x282297[_0x34bd('0x33')]||0x0,_0x282297[_0x34bd('0x36')]||0x0);_0x282297[_0x34bd('0x3a')]=_0x282297[_0x34bd('0x3b')]?getSeconds(_0x282297['endtime'],_0x282297['answertime']):0x0;};exports['isFailure']=function(_0xede936){return _0xede936===_0x34bd('0x3c');};exports[_0x34bd('0x3d')]=function(_0x787f74,_0x514fb3,_0x412fa5,_0x148abe,_0x1c652a){var _0x72a37=_0x148abe?_0x34bd('0x3e'):_0x787f74['calleridname'];_0x72a37=_0x1c652a?_0x34bd('0x3f'):_0x72a37;return{'actionid':_0x787f74['uniqueid'],'action':'originate','channel':_0x787f74[_0x34bd('0x40')],'callerid':util['format'](_0x34bd('0x12'),_0x72a37,_0x787f74[_0x34bd('0x41')]),'Exten':_0x34bd('0x23'),'Context':_0x34bd('0x42'),'Priority':'1','variable':_0x412fa5,'timeout':(_0x514fb3[_0x34bd('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x787f74['uniqueid']};};exports['totalGlobal']=function(_0x33e8e8){return _0x33e8e8['countbusyretry']+_0x33e8e8[_0x34bd('0x44')]+_0x33e8e8[_0x34bd('0x45')]+_0x33e8e8[_0x34bd('0x46')]+_0x33e8e8['countnosuchnumberretry'];};exports['cloneAction']=function(_0x4f96dd){var _0x5a68f3=_[_0x34bd('0x47')](_0x4f96dd);_0x5a68f3['state']=0xf;_0x5a68f3[_0x34bd('0x35')]='Global';return _0x5a68f3;};exports[_0x34bd('0x48')]=function(_0x1d01d7,_0x1fa341,_0x4dc5c0){var _0x2da5c5={};_0x2da5c5[_0x1fa341]=_0x1d01d7[_0x1fa341];_0x2da5c5['active']=![];_0x2da5c5[_0x34bd('0x49')]=moment()[_0x34bd('0x4a')](_0x4dc5c0,_0x34bd('0x4b'))[_0x34bd('0x11')](_0x34bd('0x31'));_0x2da5c5['ContactId']=_0x1d01d7[_0x34bd('0x4c')];_0x2da5c5[_0x34bd('0x4d')]=_0x1d01d7['ListId'];_0x2da5c5[_0x34bd('0x4e')]=_0x1d01d7[_0x34bd('0x4e')]||undefined;return _0x2da5c5;};exports['decrementTalkink']=function(_0x561d77,_0x37ac16){if(!_['isNil'](_0x561d77)){if(_0x561d77['pTalking']>0x0){_0x561d77[_0x34bd('0x4f')]-=0x1;}else{logger[_0x34bd('0x7')](_0x37ac16,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x37ac16,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x1cbf91){if(_0x1cbf91<=0x0){return!![];}return![];};exports[_0x34bd('0x50')]=function(_0x482a0b,_0x4a8291){_0x482a0b['lastevent']=_0x4a8291;_0x482a0b[_0x34bd('0x17')]=_0x482a0b[_0x34bd('0x51')];_0x482a0b['interface']=_0x482a0b[_0x34bd('0x40')];return _0x482a0b;};exports[_0x34bd('0x52')]=function(_0x3f714b){var _0x2c4064={};_0x2c4064[_0x34bd('0x51')]=_0x3f714b[_0x34bd('0x51')];_0x2c4064['interface']=_0x3f714b[_0x34bd('0x40')];_0x2c4064[_0x34bd('0x53')]=_0x3f714b[_0x34bd('0x53')];return _0x2c4064;};exports[_0x34bd('0x54')]=function(_0x589ef1){var _0x1b8b37=[];for(var _0x5235e4 in _0x589ef1){if(_0x589ef1[_0x34bd('0x55')](_0x5235e4)){if(!_['isNil'](_0x589ef1[_0x5235e4])&&_0x589ef1[_0x5235e4][_0x34bd('0x32')]===_0x34bd('0x56')&&_0x589ef1[_0x5235e4][_0x34bd('0x57')]===_0x34bd('0x58')){_0x1b8b37[_0x34bd('0x59')](_0x589ef1[_0x5235e4]['id']);}}}return _0x1b8b37;};exports[_0x34bd('0x5a')]=function(_0x6db4ba){var _0x28394c=moment()[_0x34bd('0x4')](0x0);var _0x3b1dd5=moment(_0x6db4ba)[_0x34bd('0x4')](0x0);return _0x28394c['diff'](_0x3b1dd5,_0x34bd('0x6'));};exports['createBody']=function(_0x15fea7){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x15fea7['ContactId'],'ListId':_0x15fea7[_0x34bd('0x4d')],'VoiceQueueId':_0x15fea7['VoiceQueueId']||undefined,'CampaignId':_0x15fea7[_0x34bd('0x5b')]||undefined};};exports[_0x34bd('0x5c')]=function(_0x2da924){if(_0x2da924===_0x34bd('0x53')||_0x2da924===_0x34bd('0x5d')||_0x2da924===_0x34bd('0x51')||_0x2da924===_0x34bd('0x5e')||_0x2da924===_0x34bd('0x5f')||_0x2da924===_0x34bd('0x60')||_0x2da924===_0x34bd('0x37')||_0x2da924===_0x34bd('0x40')||_0x2da924===_0x34bd('0x61')||_0x2da924===_0x34bd('0x62')||_0x2da924===_0x34bd('0x41')||_0x2da924===_0x34bd('0x49')||_0x2da924==='countbusyretry'||_0x2da924==='countcongestionretry'||_0x2da924===_0x34bd('0x45')||_0x2da924===_0x34bd('0x63')||_0x2da924===_0x34bd('0x64')||_0x2da924===_0x34bd('0x65')||_0x2da924===_0x34bd('0x66')||_0x2da924==='recallme'||_0x2da924==='ContactId'||_0x2da924==='ListId'||_0x2da924==='UserId'||_0x2da924===_0x34bd('0x4e')||_0x2da924===_0x34bd('0x67')||_0x2da924==='xmd-voicequeueid'||_0x2da924===_0x34bd('0x68')||_0x2da924===_0x34bd('0x69')||_0x2da924===_0x34bd('0x6a')||_0x2da924==='xmd-dialurl'||_0x2da924===_0x34bd('0x6b')||_0x2da924===_0x34bd('0x6c')||_0x2da924===_0x34bd('0x6d')||_0x2da924===_0x34bd('0x6e')||_0x2da924===_0x34bd('0x6f')||_0x2da924===_0x34bd('0x70')||_0x2da924===_0x34bd('0x71')||_0x2da924===_0x34bd('0x72')||_0x2da924==='xmd-agi'||_0x2da924==='rtpaudioqos'||_0x2da924===_0x34bd('0x73')||_0x2da924==='rtpaudioqosjitter'||_0x2da924===_0x34bd('0x74')||_0x2da924===_0x34bd('0x75')||_0x2da924===_0x34bd('0x76')||_0x2da924==='rtpaudioqosrtt'||_0x2da924==='rtpaudioqosrttbridged'||_0x2da924===_0x34bd('0x77')||_0x2da924===_0x34bd('0x73')||_0x2da924===_0x34bd('0x78')||_0x2da924==='rtpaudioqosjitterbridged'||_0x2da924==='rtpaudioqosloss'||_0x2da924===_0x34bd('0x76')||_0x2da924===_0x34bd('0x79')||_0x2da924===_0x34bd('0x7a')||_0x2da924===_0x34bd('0x7b')||_0x2da924===_0x34bd('0x7c')||_0x2da924===_0x34bd('0x32')||_0x2da924===_0x34bd('0x35')){return![];}return!![];};exports[_0x34bd('0x7d')]=function(_0x31bedd,_0x4f397f){var _0x4d3118,_0x3878a0,_0x4fab21;if(_0x4f397f<=0x0){_0x4f397f=0x1;}_0x4d3118=new RegExp(_0x34bd('0x7e')+_0x4f397f+'}$');_0x3878a0=Math[_0x34bd('0x7f')](0xa,_0x4f397f-0x1);_0x4fab21=Math[_0x34bd('0x7f')](0xa,_0x4f397f)-0x1;return util[_0x34bd('0x11')]('%s',_['replace'](_0x31bedd,_0x4d3118,_['random'](_0x3878a0,_0x4fab21)));};exports[_0x34bd('0x80')]=function(_0x2273af){var _0x38e91=_0x2273af['match'](/"(.*?)"/);return _0x38e91?_0x38e91[0x1]:_0x2273af;};exports[_0x34bd('0x81')]=function(_0x4832d5){var _0x3ec753=_0x4832d5[_0x34bd('0x82')](/<(.*?)>/);return _0x3ec753?_0x3ec753[0x1]:_0x4832d5;}; \ No newline at end of file +var _0x6132=['isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','NONE','originatecalleridnum','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','membername','UserId','talktime','answertime','Failure','variablesAction','calleridname','BOOKED','uniqueid','originate','xcally-motion-preview','from-sip','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','interface','channelAgent','queue','agentReadyId','not_inuse','status','reachable','getDiff','seconds','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','scheduledat','countglobal','callback','callbackuniqueid','callbackat','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialchannel','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','match','lodash','../../../../config/logger','preview','env','milliseconds','diff','loggerCatch','inspect','info','loggerError','error','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive'];(function(_0x166acc,_0x111e4e){var _0x209f4d=function(_0x354b62){while(--_0x354b62){_0x166acc['push'](_0x166acc['shift']());}};_0x209f4d(++_0x111e4e);}(_0x6132,0xf3));var _0x2613=function(_0x4326e4,_0x1e1efc){_0x4326e4=_0x4326e4-0x0;var _0x57b1a2=_0x6132[_0x4326e4];return _0x57b1a2;};'use strict';var util=require('util');var _=require(_0x2613('0x0'));var moment=require('moment');var logger=require(_0x2613('0x1'))(_0x2613('0x2'));var ipAgi=process[_0x2613('0x3')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x3c1186,_0x521394){var _0x41719b=moment(_0x3c1186)['milliseconds'](0x0);var _0x4479f6=moment(_0x521394)[_0x2613('0x4')](0x0);return _0x41719b[_0x2613('0x5')](_0x4479f6,'seconds');}exports[_0x2613('0x6')]=function(_0x43c876){return function(_0x51f79d){logger['error'](_0x43c876,util[_0x2613('0x7')](_0x51f79d,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x7c5e0b,_0x5894a5){logger[_0x2613('0x8')](_0x7c5e0b,util[_0x2613('0x7')](_0x5894a5,{'showHidden':![],'depth':null}));};exports[_0x2613('0x9')]=function(_0x3dd7aa,_0x49d6a9){logger[_0x2613('0xa')](_0x3dd7aa,util[_0x2613('0x7')](_0x49d6a9,{'showHidden':![],'depth':null}));};exports[_0x2613('0xb')]=function(_0xd7e8ae){return function(_0x5db104){logger[_0x2613('0x8')](_0xd7e8ae,util[_0x2613('0x7')](_0x5db104,{'showHidden':![],'depth':null}));};};exports[_0x2613('0xc')]=function(_0x163b44,_0xfea102,_0x18acee){return{'message':_0x163b44,'unlock':_0xfea102,'active':_0x18acee};};exports[_0x2613('0xd')]=function(_0x2b3e5e,_0x34ce5b,_0x166b99){if(!_[_0x2613('0xe')](_0x166b99)&&_0x2613('0xf')===typeof _0x166b99&&!_[_0x2613('0x10')](_0x166b99)){if(!_[_0x2613('0xe')](_0x34ce5b)&&_0x2613('0xf')===typeof _0x34ce5b&&!_[_0x2613('0x10')](_0x34ce5b)){return util[_0x2613('0x11')](_0x2613('0x12'),_0x34ce5b,_0x166b99);}return util[_0x2613('0x11')](_0x2613('0x12'),_0x166b99,_0x166b99);}if(!_[_0x2613('0xe')](_0x2b3e5e)&&_0x2613('0xf')===typeof _0x2b3e5e&&!_['isEmpty'](_0x2b3e5e)){return _0x2b3e5e;}return _0x2613('0x13');};exports[_0x2613('0x14')]=function(_0x838811){if(_[_0x2613('0x15')](_0x838811)){return![];}return _0x838811;};exports[_0x2613('0x16')]=function(_0x363754,_0x22c4db,_0xaace51,_0x41f86d,_0x335bf5,_0x44cfac){var _0x48811a={'XMD-QUEUE':_0x22c4db[_0x2613('0x17')]?_0x22c4db[_0x2613('0x17')][_0x2613('0x18')]:'','XMD-CALLERID':_0x41f86d,'XMD-CALLERID-PREVIEW':_0x44cfac?util['format'](_0x2613('0x12'),_0x44cfac['calleridname'],_0x44cfac[_0x2613('0x19')]):_0x41f86d,'XMD-DIALID':_0x335bf5,'XMD-CONTACTID':_0x22c4db[_0x2613('0x1a')],'XMD-CDRTYPE':_0x2613('0x1b'),'CALLERID(all)':_0x41f86d,'XMD-VOICEQUEUEID':_0x22c4db[_0x2613('0x1c')],'XMD-DIALCHANNEL':_0xaace51,'XMD-DIALTIMEOUT':_0x363754[_0x2613('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x2613('0x11')](_0x2613('0x1e'),_0x363754[_0x2613('0x1f')]?'g':'',_[_0x2613('0x10')](_0x363754[_0x2613('0x20')])?'':_0x2613('0x21')),'XMD-DIALURL':_0x363754['dialPreviewUrl']||'','XMD-AGI':_0x363754[_0x2613('0x22')]?util[_0x2613('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x363754[_0x2613('0x22')]):'NONE','XMD-AGIAFTER':_0x363754[_0x2613('0x1f')]?util[_0x2613('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x363754[_0x2613('0x1f')]):_0x2613('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x44cfac?_0x44cfac[_0x2613('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x44cfac?_0x44cfac['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x2613('0x10')](_0x363754['monitor_format'])){_0x48811a[util[_0x2613('0x11')]('%s',_0x2613('0x25'))]=_0x363754[_0x2613('0x20')];_0x48811a[util[_0x2613('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x335bf5;}if(_0x22c4db&&_0x22c4db[_0x2613('0x26')]){for(var _0x38519 in _0x22c4db[_0x2613('0x26')]){if(_0x22c4db['Contact'][_0x2613('0x27')](_0x38519)){if(!_[_0x2613('0x15')](_0x22c4db['Contact'][_0x38519])&&_0x38519!=='id'&&_0x38519!==_0x2613('0x28')&&_0x38519!=='createdAt'&&_0x38519!==_0x2613('0x29')){_0x48811a[util['format'](_0x2613('0x2a'),_0x2613('0x2b'),_[_0x2613('0x2c')](_0x38519))]=_0x22c4db[_0x2613('0x26')][_0x38519];}}}}return _0x48811a;};exports[_0x2613('0x2d')]=function(_0x22755c){var _0x34a858={};for(var _0x3ad841 in _0x22755c){if(_0x22755c[_0x2613('0x27')](_0x3ad841)){_0x34a858[util[_0x2613('0x11')]('%s',_[_0x2613('0x2e')](_0x3ad841))]=_0x22755c[_0x3ad841];}}return{'variables':_0x34a858};};exports['updateOriginated']=function(_0x485a92,_0x2c6aad){if(!_['isNil'](_0x485a92)){if(_0x485a92['hasOwnProperty'](_0x2613('0x2f'))){if(_0x485a92[_0x2613('0x2f')]>0x0){_0x485a92[_0x2613('0x2f')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x2c6aad);}}}else{logger['error'](_0x2613('0x30'),_0x2c6aad);}};exports[_0x2613('0x31')]=function(_0x416f25){var _0x35dd2b=moment()[_0x2613('0x11')](_0x2613('0x32'));_0x416f25[_0x2613('0x33')]=0xd;_0x416f25[_0x2613('0x34')]=_0x2613('0x35');_0x416f25[_0x2613('0x36')]=_0x35dd2b;_0x416f25[_0x2613('0x37')]=_0x35dd2b;_0x416f25[_0x2613('0x38')]=_0x35dd2b;};exports[_0x2613('0x39')]=function(_0x166fbb,_0x22d9eb,_0x2b2029){var _0x14e4bb=moment()[_0x2613('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x166fbb['state']=_0x22d9eb;_0x166fbb['statedesc']=_0x2b2029;_0x166fbb['responsetime']=_0x14e4bb;_0x166fbb[_0x2613('0x3a')]=getSeconds(_0x166fbb[_0x2613('0x37')],_0x166fbb['starttime']);};exports['logLookAgent']=function(_0x19af11,_0x51bf5a,_0x1fa7b3){_0x19af11[_0x2613('0x3b')]=_0x51bf5a;_0x19af11[_0x2613('0x3c')]=_0x1fa7b3;};exports['logCustomer']=function(_0x2aacff,_0x33a62a,_0x1679e5){var _0x1e8319=moment()[_0x2613('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x2aacff['state']=_0x33a62a;_0x2aacff[_0x2613('0x34')]=_0x1679e5;_0x2aacff[_0x2613('0x37')]=_0x2aacff['responsetime']?_0x2aacff[_0x2613('0x37')]:_0x1e8319;_0x2aacff[_0x2613('0x38')]=_0x2aacff[_0x2613('0x38')]?_0x2aacff['endtime']:_0x1e8319;_0x2aacff[_0x2613('0x3a')]=getSeconds(_0x2aacff[_0x2613('0x37')]||0x0,_0x2aacff[_0x2613('0x36')]||0x0);_0x2aacff[_0x2613('0x3d')]=_0x2aacff['answertime']?getSeconds(_0x2aacff['endtime'],_0x2aacff[_0x2613('0x3e')]):0x0;};exports['isFailure']=function(_0x444176){return _0x444176===_0x2613('0x3f');};exports[_0x2613('0x40')]=function(_0x13e49e,_0x2930e1,_0x2e35a5,_0x555caf,_0x5bc650){var _0x31d21d=_0x555caf?'RECALL':_0x13e49e[_0x2613('0x41')];_0x31d21d=_0x5bc650?_0x2613('0x42'):_0x31d21d;return{'actionid':_0x13e49e[_0x2613('0x43')],'action':_0x2613('0x44'),'channel':_0x13e49e['channelAgent'],'callerid':util['format'](_0x2613('0x12'),_0x31d21d,_0x13e49e[_0x2613('0x19')]),'Exten':_0x2613('0x45'),'Context':_0x2613('0x46'),'Priority':'1','variable':_0x2e35a5,'timeout':(_0x2930e1['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x13e49e[_0x2613('0x43')]};};exports['totalGlobal']=function(_0x538bd9){return _0x538bd9[_0x2613('0x47')]+_0x538bd9[_0x2613('0x48')]+_0x538bd9[_0x2613('0x49')]+_0x538bd9[_0x2613('0x4a')]+_0x538bd9['countnosuchnumberretry'];};exports[_0x2613('0x4b')]=function(_0x1bdc0f){var _0x111231=_[_0x2613('0x4c')](_0x1bdc0f);_0x111231['state']=0xf;_0x111231[_0x2613('0x34')]=_0x2613('0x4d');return _0x111231;};exports['scheduledAt']=function(_0x2a01de,_0x16f6d0,_0xa20e71){var _0x48756d={};_0x48756d[_0x16f6d0]=_0x2a01de[_0x16f6d0];_0x48756d[_0x2613('0x4e')]=![];_0x48756d['scheduledat']=moment()[_0x2613('0x4f')](_0xa20e71,_0x2613('0x50'))[_0x2613('0x11')](_0x2613('0x32'));_0x48756d[_0x2613('0x1a')]=_0x2a01de[_0x2613('0x1a')];_0x48756d['ListId']=_0x2a01de[_0x2613('0x51')];_0x48756d[_0x2613('0x1c')]=_0x2a01de[_0x2613('0x1c')]||undefined;return _0x48756d;};exports[_0x2613('0x52')]=function(_0x28c708,_0x4a3704){if(!_[_0x2613('0x15')](_0x28c708)){if(_0x28c708[_0x2613('0x53')]>0x0){_0x28c708[_0x2613('0x53')]-=0x1;}else{logger[_0x2613('0xa')](_0x4a3704,_0x2613('0x54'));}}else{logger['error'](_0x4a3704,_0x2613('0x55'));}};exports[_0x2613('0x56')]=function(_0x22e0aa){if(_0x22e0aa<=0x0){return!![];}return![];};exports[_0x2613('0x57')]=function(_0x3a78fe,_0x50063f){_0x3a78fe[_0x2613('0x58')]=_0x50063f;_0x3a78fe[_0x2613('0x18')]=_0x3a78fe['queue'];_0x3a78fe[_0x2613('0x59')]=_0x3a78fe[_0x2613('0x5a')];return _0x3a78fe;};exports['buildAcw']=function(_0x194907){var _0x32a661={};_0x32a661[_0x2613('0x5b')]=_0x194907['queue'];_0x32a661[_0x2613('0x59')]=_0x194907[_0x2613('0x5a')];_0x32a661[_0x2613('0x43')]=_0x194907[_0x2613('0x43')];return _0x32a661;};exports[_0x2613('0x5c')]=function(_0x3a3c37){var _0x13e5dd=[];for(var _0x2f9ed0 in _0x3a3c37){if(_0x3a3c37[_0x2613('0x27')](_0x2f9ed0)){if(!_['isNil'](_0x3a3c37[_0x2f9ed0])&&_0x3a3c37[_0x2f9ed0]['state']===_0x2613('0x5d')&&_0x3a3c37[_0x2f9ed0][_0x2613('0x5e')]===_0x2613('0x5f')){_0x13e5dd['push'](_0x3a3c37[_0x2f9ed0]['id']);}}}return _0x13e5dd;};exports[_0x2613('0x60')]=function(_0x2c7b61){var _0x5cf4d3=moment()[_0x2613('0x4')](0x0);var _0x15c96c=moment(_0x2c7b61)[_0x2613('0x4')](0x0);return _0x5cf4d3[_0x2613('0x5')](_0x15c96c,_0x2613('0x61'));};exports[_0x2613('0x62')]=function(_0x2bc548){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2bc548['ContactId'],'ListId':_0x2bc548[_0x2613('0x51')],'VoiceQueueId':_0x2bc548['VoiceQueueId']||undefined,'CampaignId':_0x2bc548[_0x2613('0x63')]||undefined};};exports['filterKey']=function(_0x41a599){if(_0x41a599==='uniqueid'||_0x41a599===_0x2613('0x64')||_0x41a599===_0x2613('0x5b')||_0x41a599===_0x2613('0x65')||_0x41a599===_0x2613('0x66')||_0x41a599===_0x2613('0x67')||_0x41a599==='membername'||_0x41a599===_0x2613('0x5a')||_0x41a599==='calleridname'||_0x41a599===_0x2613('0x4e')||_0x41a599===_0x2613('0x19')||_0x41a599===_0x2613('0x68')||_0x41a599==='countbusyretry'||_0x41a599===_0x2613('0x48')||_0x41a599===_0x2613('0x49')||_0x41a599===_0x2613('0x69')||_0x41a599===_0x2613('0x6a')||_0x41a599===_0x2613('0x6b')||_0x41a599===_0x2613('0x6c')||_0x41a599==='recallme'||_0x41a599==='ContactId'||_0x41a599==='ListId'||_0x41a599===_0x2613('0x3c')||_0x41a599==='VoiceQueueId'||_0x41a599==='sipcallid'||_0x41a599===_0x2613('0x6d')||_0x41a599===_0x2613('0x6e')||_0x41a599===_0x2613('0x6f')||_0x41a599===_0x2613('0x70')||_0x41a599===_0x2613('0x71')||_0x41a599===_0x2613('0x72')||_0x41a599==='xmd-dialoptions'||_0x41a599==='xmd-dialid'||_0x41a599===_0x2613('0x73')||_0x41a599==='xmd-contactid'||_0x41a599==='xmd-cdrtype'||_0x41a599===_0x2613('0x74')||_0x41a599===_0x2613('0x75')||_0x41a599==='xmd-agi'||_0x41a599===_0x2613('0x76')||_0x41a599===_0x2613('0x77')||_0x41a599===_0x2613('0x78')||_0x41a599===_0x2613('0x79')||_0x41a599===_0x2613('0x7a')||_0x41a599===_0x2613('0x7b')||_0x41a599===_0x2613('0x7c')||_0x41a599==='rtpaudioqosrttbridged'||_0x41a599===_0x2613('0x76')||_0x41a599===_0x2613('0x77')||_0x41a599==='rtpaudioqosjitter'||_0x41a599===_0x2613('0x79')||_0x41a599===_0x2613('0x7a')||_0x41a599===_0x2613('0x7b')||_0x41a599===_0x2613('0x7c')||_0x41a599===_0x2613('0x7d')||_0x41a599==='bridgepeer'||_0x41a599===_0x2613('0x7e')||_0x41a599===_0x2613('0x33')||_0x41a599===_0x2613('0x34')){return![];}return!![];};exports[_0x2613('0x7f')]=function(_0x4355de,_0x5467bd){var _0x5c1e9d,_0x83b8fb,_0x156edb;if(_0x5467bd<=0x0){_0x5467bd=0x1;}_0x5c1e9d=new RegExp(_0x2613('0x80')+_0x5467bd+'}$');_0x83b8fb=Math[_0x2613('0x81')](0xa,_0x5467bd-0x1);_0x156edb=Math['pow'](0xa,_0x5467bd)-0x1;return util['format']('%s',_['replace'](_0x4355de,_0x5c1e9d,_[_0x2613('0x82')](_0x83b8fb,_0x156edb)));};exports['extractCalleridName']=function(_0x2dcc84){var _0x29ec08=_0x2dcc84[_0x2613('0x83')](/"(.*?)"/);return _0x29ec08?_0x29ec08[0x1]:_0x2dcc84;};exports['extractCalleridNumber']=function(_0x4ee679){var _0x1bcc9f=_0x4ee679[_0x2613('0x83')](/<(.*?)>/);return _0x1bcc9f?_0x1bcc9f[0x1]:_0x4ee679;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 5fad734..031b600 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 _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x3be3af,_0x383cb8){var _0x461444=function(_0xf5d882){while(--_0xf5d882){_0x3be3af['push'](_0x3be3af['shift']());}};_0x461444(++_0x383cb8);}(_0x7a54,0x106));var _0x47a5=function(_0xaa4cd4,_0xdc824a){_0xaa4cd4=_0xaa4cd4-0x0;var _0x3cc524=_0x7a54[_0xaa4cd4];return _0x3cc524;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0xb6e4c,_0x42e3bf){var _0x83e9ae=function(_0x5114f3){while(--_0x5114f3){_0xb6e4c['push'](_0xb6e4c['shift']());}};_0x83e9ae(++_0x42e3bf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x35d76f,_0x30b143){_0x35d76f=_0x35d76f-0x0;var _0x2f3ce5=_0x5f2f[_0x35d76f];return _0x2f3ce5;};'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 bda98b8..6282d4b 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 _0x6713=['../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','isNil','interface','SIP/%s','name','total','sumHoldTime','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTemplates','initZendeskAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','outbound','sumDuration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','lodash','../model/agent','../model/telephone','../model/trunk'];(function(_0x55d2ee,_0x5a796c){var _0x1eeb19=function(_0x42f6a3){while(--_0x42f6a3){_0x55d2ee['push'](_0x55d2ee['shift']());}};_0x1eeb19(++_0x5a796c);}(_0x6713,0x6a));var _0x3671=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0x6713[_0x3f8a03];return _0x147fb2;};'use strict';var BPromise=require(_0x3671('0x0'));var util=require('util');var _=require(_0x3671('0x1'));var moment=require('moment');var Agent=require(_0x3671('0x2'));var Telephone=require(_0x3671('0x3'));var Trunk=require(_0x3671('0x4'));var VoiceQueue=require(_0x3671('0x5'));var Trigger=require(_0x3671('0x6'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0x3671('0x7'));var ZendeskAccount=require(_0x3671('0x8'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x3671('0x9'));var SugarcrmAccount=require(_0x3671('0xa'));var ZohoAccount=require(_0x3671('0xb'));var DeskAccount=require(_0x3671('0xc'));var VtigerAccount=require(_0x3671('0xd'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x3671('0xe'));var FreshsalesAccount=require(_0x3671('0xf'));var FaxAccount=require(_0x3671('0x10'));var Realtime=function(){this[_0x3671('0x11')]={};this[_0x3671('0x12')]={};this[_0x3671('0x13')]={};this[_0x3671('0x14')]={};this[_0x3671('0x15')]={};this[_0x3671('0x16')]={};this[_0x3671('0x17')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x3671('0x18')]={};this[_0x3671('0x19')]={};this[_0x3671('0x1a')]={};this[_0x3671('0x1b')]={};this['timers']={};this[_0x3671('0x1c')]={};this['salesforceAccounts']={};this[_0x3671('0x1d')]={};this[_0x3671('0x1e')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x3671('0x1f')]={};this[_0x3671('0x20')]={};this[_0x3671('0x21')]={};this[_0x3671('0x22')]={};this[_0x3671('0x23')]={};};function freeIsNotKey(_0x43d164,_0x20af06,_0x447654){var _0x3ec9aa=_[_0x3671('0x24')](_0x43d164,function(_0x11a387,_0x1c240b){return _0x11a387[_0x447654];});for(var _0x2c40cd in _0x20af06){if(_0x20af06[_0x3671('0x25')](_0x2c40cd)){if(!_0x3ec9aa[_0x2c40cd]){delete _0x20af06[_0x2c40cd];}}}}function freeIsNotKeySip(_0x3a8636,_0x327ca1){var _0x29a1ae=_[_0x3671('0x24')](_0x3a8636,function(_0x76df67,_0x4f3a4a){return util[_0x3671('0x26')]('SIP/%s',_0x76df67['name']);});for(var _0xdbdd3b in _0x327ca1){if(_0x327ca1['hasOwnProperty'](_0xdbdd3b)){if(!_0x29a1ae[_0xdbdd3b]){delete _0x327ca1[_0xdbdd3b];}}}}function freeIsNotKeyAgent(_0x5d33c8,_0x5f58b8){var _0x4bf54e=_[_0x3671('0x24')](_0x5d33c8,function(_0x4d5cb1,_0x244ce0){var _0x15c222=_[_0x3671('0x27')](_0x4d5cb1[_0x3671('0x28')])?util[_0x3671('0x26')](_0x3671('0x29'),_0x4d5cb1[_0x3671('0x2a')]):_0x4d5cb1[_0x3671('0x28')];return _0x15c222;});for(var _0x51f1f6 in _0x5f58b8){if(_0x5f58b8[_0x3671('0x25')](_0x51f1f6)){if(!_0x4bf54e[_0x51f1f6]){delete _0x5f58b8[_0x51f1f6];}}}}function clearVoiceCallReports(_0x25e2ff){_0x25e2ff[_0x3671('0x2b')]=0x0;_0x25e2ff['answered']=0x0;_0x25e2ff[_0x3671('0x2c')]=0x0;_0x25e2ff['sumDuration']=0x0;_0x25e2ff['sumBillable']=0x0;}function clearCampaigns(_0x42cdb4){if(!_[_0x3671('0x2d')](_0x42cdb4)){for(var _0x423032 in _0x42cdb4){if(_0x42cdb4['hasOwnProperty'](_0x423032)){_0x42cdb4[_0x423032][_0x3671('0x2e')]=0x0;_0x42cdb4[_0x423032][_0x3671('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x5d7a3b){if(!_[_0x3671('0x2d')](_0x5d7a3b)){for(var _0x36e1c7 in _0x5d7a3b){if(_0x5d7a3b['hasOwnProperty'](_0x36e1c7)){_0x5d7a3b[_0x36e1c7][_0x3671('0x2b')]=0x0;_0x5d7a3b[_0x36e1c7][_0x3671('0x30')]=0x0;_0x5d7a3b[_0x36e1c7][_0x3671('0x31')]=0x0;_0x5d7a3b[_0x36e1c7]['abandoned']=0x0;_0x5d7a3b[_0x36e1c7][_0x3671('0x2c')]=0x0;_0x5d7a3b[_0x36e1c7]['sumDuration']=0x0;_0x5d7a3b[_0x36e1c7][_0x3671('0x32')]=0x0;_0x5d7a3b[_0x36e1c7][_0x3671('0x33')]=0x0;_0x5d7a3b[_0x36e1c7]['outboundNoAnswerCallsDay']=0x0;_0x5d7a3b[_0x36e1c7]['outboundBusyCallsDay']=0x0;_0x5d7a3b[_0x36e1c7][_0x3671('0x34')]=0x0;_0x5d7a3b[_0x36e1c7][_0x3671('0x35')]=0x0;_0x5d7a3b[_0x36e1c7][_0x3671('0x36')]=0x0;_0x5d7a3b[_0x36e1c7][_0x3671('0x37')]=0x0;_0x5d7a3b[_0x36e1c7][_0x3671('0x38')]=0x0;_0x5d7a3b[_0x36e1c7][_0x3671('0x39')]=0x0;_0x5d7a3b[_0x36e1c7][_0x3671('0x3a')]=0x0;_0x5d7a3b[_0x36e1c7]['outboundRejectCallsDay']=0x0;_0x5d7a3b[_0x36e1c7][_0x3671('0x3b')]=0x0;_0x5d7a3b[_0x36e1c7]['outboundAnswerAgiCallsDay']=0x0;_0x5d7a3b[_0x36e1c7][_0x3671('0x3c')]=0x0;_0x5d7a3b[_0x36e1c7][_0x3671('0x3d')]=!![];}}}}Realtime[_0x3671('0x3e')][_0x3671('0x3f')]=function(_0x526367,_0x508656){for(var _0x43a9b5 in _0x508656){if(_0x526367[_0x3671('0x25')](_0x43a9b5)){_0x526367[_0x43a9b5]=_0x508656[_0x43a9b5];}}};Realtime['prototype']['initAgents']=function(){var _0xa87eb3=this;return function(_0x1c8fdf){if(_0x1c8fdf){freeIsNotKeyAgent(_0x1c8fdf,_0xa87eb3[_0x3671('0x11')]);for(var _0x3e265b=0x0,_0x40e6f7={},_0x58e11b={};_0x3e265b<_0x1c8fdf[_0x3671('0x40')];_0x3e265b+=0x1){_0x40e6f7=_0x1c8fdf[_0x3e265b];var _0x237cbd=_[_0x3671('0x27')](_0x40e6f7[_0x3671('0x28')])?util['format'](_0x3671('0x29'),_0x40e6f7[_0x3671('0x2a')]):_0x40e6f7['interface'];if(_[_0x3671('0x41')](_0xa87eb3[_0x3671('0x11')][_0x237cbd])){_0xa87eb3[_0x3671('0x11')][_0x237cbd]=new Agent(_0x40e6f7);}else{_0xa87eb3[_0x3671('0x3f')](_0xa87eb3[_0x3671('0x11')][_0x237cbd],_0x40e6f7);}}}return _0xa87eb3[_0x3671('0x11')];};};Realtime[_0x3671('0x3e')][_0x3671('0x42')]=function(){var _0x5bdcaa=this;return function(_0xea669e){if(_0xea669e){freeIsNotKeySip(_0xea669e,_0x5bdcaa[_0x3671('0x12')]);for(var _0x178ec6=0x0,_0x20ed3e={},_0x2e33d6={};_0x178ec6<_0xea669e[_0x3671('0x40')];_0x178ec6+=0x1){_0x20ed3e=_0xea669e[_0x178ec6];if(_['isUndefined'](_0x5bdcaa[_0x3671('0x12')][util['format'](_0x3671('0x29'),_0x20ed3e[_0x3671('0x2a')])])){_0x5bdcaa[_0x3671('0x12')][util['format'](_0x3671('0x29'),_0x20ed3e[_0x3671('0x2a')])]=new Telephone(_0x20ed3e);}else{_0x5bdcaa[_0x3671('0x3f')](_0x5bdcaa[_0x3671('0x12')][util[_0x3671('0x26')]('SIP/%s',_0x20ed3e[_0x3671('0x2a')])],_0x20ed3e);}}}return _0x5bdcaa[_0x3671('0x12')];};};Realtime['prototype'][_0x3671('0x43')]=function(){var _0x25e50d=this;return function(_0x510cc1){if(_0x510cc1){freeIsNotKeySip(_0x510cc1,_0x25e50d[_0x3671('0x13')]);for(var _0x1856be=0x0,_0x5a28c1={},_0x2d37a7={};_0x1856be<_0x510cc1[_0x3671('0x40')];_0x1856be+=0x1){_0x5a28c1=_0x510cc1[_0x1856be];if(_['isUndefined'](_0x25e50d[_0x3671('0x13')][util[_0x3671('0x26')](_0x3671('0x29'),_0x5a28c1[_0x3671('0x2a')])])){_0x25e50d[_0x3671('0x13')][util[_0x3671('0x26')](_0x3671('0x29'),_0x5a28c1[_0x3671('0x2a')])]=new Trunk(_0x5a28c1);}else{_0x25e50d['mergeFromDatabase'](_0x25e50d[_0x3671('0x13')][util['format']('SIP/%s',_0x5a28c1['name'])],_0x5a28c1);}}}return _0x25e50d['trunks'];};};Realtime[_0x3671('0x3e')][_0x3671('0x44')]=function(){var _0x20549b=this;return function(_0x1b0e52){if(_0x1b0e52){freeIsNotKey(_0x1b0e52,_0x20549b[_0x3671('0x14')],_0x3671('0x2a'));for(var _0x544e54=0x0,_0x1c4088={},_0x4c7ff5={};_0x544e54<_0x1b0e52['length'];_0x544e54+=0x1){_0x1c4088=_0x1b0e52[_0x544e54];if(_[_0x3671('0x41')](_0x20549b[_0x3671('0x14')][_0x1c4088[_0x3671('0x2a')]])){_0x20549b[_0x3671('0x14')][_0x1c4088[_0x3671('0x2a')]]=new VoiceQueue(_0x1c4088);}else{_0x20549b[_0x3671('0x3f')](_0x20549b[_0x3671('0x14')][_0x1c4088[_0x3671('0x2a')]],_0x1c4088);}}}return _0x20549b[_0x3671('0x14')];};};Realtime[_0x3671('0x3e')]['initTriggers']=function(){var _0x4ddfdc=this;return function(_0x2ce28a){if(_0x2ce28a){freeIsNotKey(_0x2ce28a,_0x4ddfdc[_0x3671('0x15')],'id');for(var _0x5c5a24=0x0,_0x414b0c={},_0x18aad5={};_0x5c5a24<_0x2ce28a[_0x3671('0x40')];_0x5c5a24+=0x1){_0x414b0c=_0x2ce28a[_0x5c5a24];if(_[_0x3671('0x41')](_0x4ddfdc[_0x3671('0x15')][_0x414b0c['id']])){_0x4ddfdc[_0x3671('0x15')][_0x414b0c['id']]=new Trigger(_0x414b0c);}else{_0x4ddfdc['mergeFromDatabase'](_0x4ddfdc[_0x3671('0x15')][_0x414b0c['id']],_0x414b0c);}}}return _0x4ddfdc[_0x3671('0x15')];};};Realtime[_0x3671('0x3e')][_0x3671('0x45')]=function(){var _0x65201c=this;return function(_0x3e556a){if(_0x3e556a){freeIsNotKey(_0x3e556a,_0x65201c[_0x3671('0x17')],'id');for(var _0x1efbfc=0x0,_0xc0c637={},_0x342851={};_0x1efbfc<_0x3e556a[_0x3671('0x40')];_0x1efbfc+=0x1){_0xc0c637=_0x3e556a[_0x1efbfc];if(_[_0x3671('0x41')](_0x65201c[_0x3671('0x17')][_0xc0c637['id']])){_0x65201c['templates'][_0xc0c637['id']]=new Template(_0xc0c637);}else{_0x65201c[_0x3671('0x3f')](_0x65201c[_0x3671('0x17')][_0xc0c637['id']],_0xc0c637);}}}return _0x65201c[_0x3671('0x17')];};};Realtime['prototype'][_0x3671('0x46')]=function(){var _0x13dd93=this;return function(_0x2f0ccd){if(_0x2f0ccd){freeIsNotKey(_0x2f0ccd,_0x13dd93[_0x3671('0x1c')],'id');for(var _0x5ccd58=0x0,_0x3c95c4={},_0x3002ea={};_0x5ccd58<_0x2f0ccd[_0x3671('0x40')];_0x5ccd58+=0x1){_0x3c95c4=_0x2f0ccd[_0x5ccd58];if(_[_0x3671('0x41')](_0x13dd93[_0x3671('0x1c')][_0x3c95c4['id']])){_0x13dd93[_0x3671('0x1c')][_0x3c95c4['id']]=new ZendeskAccount(_0x3c95c4);}else{_0x13dd93['mergeFromDatabase'](_0x13dd93[_0x3671('0x1c')][_0x3c95c4['id']],_0x3c95c4);}}}return _0x13dd93[_0x3671('0x1c')];};};Realtime[_0x3671('0x3e')]['initSalesforceAccounts']=function(){var _0x2b2dc4=this;return function(_0x4717b0){if(_0x4717b0){freeIsNotKey(_0x4717b0,_0x2b2dc4[_0x3671('0x47')],'id');for(var _0x31e7c6=0x0,_0x1fc597={},_0x1192b3={};_0x31e7c6<_0x4717b0[_0x3671('0x40')];_0x31e7c6+=0x1){_0x1fc597=_0x4717b0[_0x31e7c6];if(_['isUndefined'](_0x2b2dc4['salesforceAccounts'][_0x1fc597['id']])){_0x2b2dc4[_0x3671('0x47')][_0x1fc597['id']]=new SalesforceAccount(_0x1fc597);}else{_0x2b2dc4[_0x3671('0x3f')](_0x2b2dc4[_0x3671('0x47')][_0x1fc597['id']],_0x1fc597);}}}return _0x2b2dc4[_0x3671('0x47')];};};Realtime[_0x3671('0x3e')][_0x3671('0x48')]=function(){var _0x5118c3=this;return function(_0x3aebe4){if(_0x3aebe4){freeIsNotKey(_0x3aebe4,_0x5118c3[_0x3671('0x1e')],'id');for(var _0x3fed65=0x0,_0x2655c4={},_0x108049={};_0x3fed65<_0x3aebe4[_0x3671('0x40')];_0x3fed65+=0x1){_0x2655c4=_0x3aebe4[_0x3fed65];if(_['isUndefined'](_0x5118c3['freshdeskAccounts'][_0x2655c4['id']])){_0x5118c3[_0x3671('0x1e')][_0x2655c4['id']]=new FreshdeskAccount(_0x2655c4);}else{_0x5118c3[_0x3671('0x3f')](_0x5118c3[_0x3671('0x1e')][_0x2655c4['id']],_0x2655c4);}}}return _0x5118c3[_0x3671('0x1e')];};};Realtime[_0x3671('0x3e')][_0x3671('0x49')]=function(){var _0x243b1a=this;return function(_0x58a902){if(_0x58a902){freeIsNotKey(_0x58a902,_0x243b1a['zohoAccounts'],'id');for(var _0x4d1a42=0x0,_0x3f7b59={},_0x5e5f99={};_0x4d1a42<_0x58a902[_0x3671('0x40')];_0x4d1a42+=0x1){_0x3f7b59=_0x58a902[_0x4d1a42];if(_['isUndefined'](_0x243b1a['zohoAccounts'][_0x3f7b59['id']])){_0x243b1a['zohoAccounts'][_0x3f7b59['id']]=new ZohoAccount(_0x3f7b59);}else{_0x243b1a['mergeFromDatabase'](_0x243b1a[_0x3671('0x4a')][_0x3f7b59['id']],_0x3f7b59);}}}return _0x243b1a[_0x3671('0x4a')];};};Realtime['prototype'][_0x3671('0x4b')]=function(){var _0x611d75=this;return function(_0x15466f){if(_0x15466f){freeIsNotKey(_0x15466f,_0x611d75['deskAccounts'],'id');for(var _0xeb0205=0x0,_0x334c7c={},_0x5a1e4c={};_0xeb0205<_0x15466f[_0x3671('0x40')];_0xeb0205+=0x1){_0x334c7c=_0x15466f[_0xeb0205];if(_[_0x3671('0x41')](_0x611d75[_0x3671('0x4c')][_0x334c7c['id']])){_0x611d75['deskAccounts'][_0x334c7c['id']]=new DeskAccount(_0x334c7c);}else{_0x611d75[_0x3671('0x3f')](_0x611d75[_0x3671('0x4c')][_0x334c7c['id']],_0x334c7c);}}}return _0x611d75[_0x3671('0x4c')];};};Realtime[_0x3671('0x3e')][_0x3671('0x4d')]=function(){var _0x27acf9=this;return function(_0x4a69c6){if(_0x4a69c6){freeIsNotKey(_0x4a69c6,_0x27acf9[_0x3671('0x1d')],'id');for(var _0x2dc8e7=0x0,_0x489a47={},_0xd40cda={};_0x2dc8e7<_0x4a69c6['length'];_0x2dc8e7+=0x1){_0x489a47=_0x4a69c6[_0x2dc8e7];if(_[_0x3671('0x41')](_0x27acf9['sugarcrmAccounts'][_0x489a47['id']])){_0x27acf9[_0x3671('0x1d')][_0x489a47['id']]=new SugarcrmAccount(_0x489a47);}else{_0x27acf9[_0x3671('0x3f')](_0x27acf9[_0x3671('0x1d')][_0x489a47['id']],_0x489a47);}}}return _0x27acf9[_0x3671('0x1d')];};};Realtime[_0x3671('0x3e')][_0x3671('0x4e')]=function(){var _0x2f01f7=this;return function(_0x4c1a18){if(_0x4c1a18){freeIsNotKey(_0x4c1a18,_0x2f01f7['vtigerAccounts'],'id');for(var _0x1d2e92=0x0,_0x51a20a={},_0x51d1f7={};_0x1d2e92<_0x4c1a18[_0x3671('0x40')];_0x1d2e92+=0x1){_0x51a20a=_0x4c1a18[_0x1d2e92];if(_['isUndefined'](_0x2f01f7[_0x3671('0x1f')][_0x51a20a['id']])){_0x2f01f7['vtigerAccounts'][_0x51a20a['id']]=new VtigerAccount(_0x51a20a);}else{_0x2f01f7['mergeFromDatabase'](_0x2f01f7['vtigerAccounts'][_0x51a20a['id']],_0x51a20a);}}}return _0x2f01f7[_0x3671('0x1f')];};};Realtime[_0x3671('0x3e')][_0x3671('0x4f')]=function(){var _0x5d5ee9=this;return function(_0x23fa4d){if(_0x23fa4d){freeIsNotKey(_0x23fa4d,_0x5d5ee9[_0x3671('0x20')],'id');for(var _0x1016f4=0x0,_0x1c1cde={},_0x592835={};_0x1016f4<_0x23fa4d[_0x3671('0x40')];_0x1016f4+=0x1){_0x1c1cde=_0x23fa4d[_0x1016f4];if(_[_0x3671('0x41')](_0x5d5ee9[_0x3671('0x20')][_0x1c1cde['id']])){_0x5d5ee9[_0x3671('0x20')][_0x1c1cde['id']]=new ServicenowAccount(_0x1c1cde);}else{_0x5d5ee9[_0x3671('0x3f')](_0x5d5ee9['servicenowAccounts'][_0x1c1cde['id']],_0x1c1cde);}}}return _0x5d5ee9[_0x3671('0x20')];};};Realtime['prototype'][_0x3671('0x50')]=function(){var _0x1c89e6=this;return function(_0x2e1d58){if(_0x2e1d58){freeIsNotKey(_0x2e1d58,_0x1c89e6[_0x3671('0x21')],'id');for(var _0xb62c7c=0x0,_0x2c714c={},_0x24dd95={};_0xb62c7c<_0x2e1d58['length'];_0xb62c7c+=0x1){_0x2c714c=_0x2e1d58[_0xb62c7c];if(_[_0x3671('0x41')](_0x1c89e6[_0x3671('0x21')][_0x2c714c['id']])){_0x1c89e6[_0x3671('0x21')][_0x2c714c['id']]=new Dynamics365Account(_0x2c714c);}else{_0x1c89e6[_0x3671('0x3f')](_0x1c89e6[_0x3671('0x21')][_0x2c714c['id']],_0x2c714c);}}}return _0x1c89e6[_0x3671('0x21')];};};Realtime['prototype'][_0x3671('0x51')]=function(){var _0x25a992=this;return function(_0x41ce02){if(_0x41ce02){freeIsNotKey(_0x41ce02,_0x25a992[_0x3671('0x22')],'id');for(var _0x55d67d=0x0,_0x35829b={},_0x258b64={};_0x55d67d<_0x41ce02[_0x3671('0x40')];_0x55d67d+=0x1){_0x35829b=_0x41ce02[_0x55d67d];if(_[_0x3671('0x41')](_0x25a992[_0x3671('0x22')][_0x35829b['id']])){_0x25a992[_0x3671('0x22')][_0x35829b['id']]=new FreshsalesAccount(_0x35829b);}else{_0x25a992[_0x3671('0x3f')](_0x25a992[_0x3671('0x22')][_0x35829b['id']],_0x35829b);}}}return _0x25a992['freshsalesAccounts'];};};Realtime[_0x3671('0x3e')][_0x3671('0x52')]=function(){var _0x4c54c6=this;return function(_0x42109e){for(var _0x182a78=0x0;_0x182a78<_0x42109e[_0x3671('0x40')];_0x182a78+=0x1){_[_0x3671('0x53')](_0x4c54c6[_0x3671('0x14')][_0x42109e[_0x182a78][_0x3671('0x2a')]],_0x42109e[_0x182a78]);}return _0x4c54c6[_0x3671('0x14')];};};Realtime[_0x3671('0x3e')][_0x3671('0x54')]=function(){var _0x352807=this;return function(_0x2cf433){clearVoiceQueues(_0x352807[_0x3671('0x14')]);if(_0x2cf433){_0x2cf433=_[_0x3671('0x55')](_0x2cf433,_0x3671('0x56'));for(var _0x5ba3c3 in _0x2cf433){if(_0x2cf433['hasOwnProperty'](_0x5ba3c3)){var _0x5d8ca0={};for(var _0x16119c=0x0;_0x16119c<_0x2cf433[_0x5ba3c3]['length'];_0x16119c+=0x1){var _0xf300e2=_0x2cf433[_0x5ba3c3][_0x16119c][_0x3671('0x57')];if(_0x352807[_0x3671('0x14')][_0xf300e2]){if(_0x2cf433[_0x5ba3c3][_0x16119c][_0x3671('0x58')]){_0x352807[_0x3671('0x14')][_0xf300e2][_0x3671('0x31')]+=0x1;}if(_0x2cf433[_0x5ba3c3][_0x16119c][_0x3671('0x59')]){_0x352807[_0x3671('0x14')][_0xf300e2][_0x3671('0x5a')]+=0x1;}_0x352807[_0x3671('0x14')][_0xf300e2][_0x3671('0x2c')]+=moment(_0x2cf433[_0x5ba3c3][_0x16119c][_0x3671('0x5b')])['diff'](moment(_0x2cf433[_0x5ba3c3][_0x16119c][_0x3671('0x5c')]),_0x3671('0x5d'))||0x0;if(_0x16119c===_0x2cf433[_0x5ba3c3][_0x3671('0x40')]-0x1){_0x352807[_0x3671('0x14')][_0xf300e2]['sumDuration']+=moment(_0x2cf433[_0x5ba3c3][_0x16119c]['queuecallercompleteAt']||_0x2cf433[_0x5ba3c3][_0x16119c][_0x3671('0x5e')]||_0x2cf433[_0x5ba3c3][_0x16119c][_0x3671('0x5f')])[_0x3671('0x60')](moment(_0x2cf433[_0x5ba3c3][_0x16119c][_0x3671('0x5c')]),_0x3671('0x5d'))||0x0;_0x352807[_0x3671('0x14')][_0xf300e2][_0x3671('0x2b')]+=0x1;if(_0x2cf433[_0x5ba3c3][_0x16119c][_0x3671('0x61')]){_0x352807[_0x3671('0x14')][_0xf300e2][_0x3671('0x30')]+=0x1;_0x352807[_0x3671('0x14')][_0xf300e2][_0x3671('0x32')]+=moment(_0x2cf433[_0x5ba3c3][_0x16119c][_0x3671('0x62')])[_0x3671('0x60')](moment(_0x2cf433[_0x5ba3c3][_0x16119c][_0x3671('0x5b')]),_0x3671('0x5d'))||0x0;}}else{_0x352807[_0x3671('0x14')][_0xf300e2]['sumDuration']+=_0x352807['voiceQueues'][_0xf300e2]['sumHoldTime']||0x0;}}}}}}return _0x352807[_0x3671('0x14')];};};Realtime[_0x3671('0x3e')][_0x3671('0x63')]=function(){var _0x45f1d6=this;return function(_0x16c992){clearVoiceCallReports(_0x45f1d6[_0x3671('0x64')]);if(_0x16c992){for(var _0xd9658e=0x0;_0xd9658e<_0x16c992[_0x3671('0x40')];_0xd9658e+=0x1){_0x45f1d6[_0x3671('0x64')][_0x3671('0x2b')]+=0x1;_0x45f1d6[_0x3671('0x64')][_0x3671('0x65')]+=_0x16c992[_0xd9658e]['duration'];if(_0x16c992[_0xd9658e]['disposition']===_0x3671('0x66')){_0x45f1d6[_0x3671('0x64')]['answered']+=0x1;_0x45f1d6[_0x3671('0x64')]['sumHoldTime']+=_0x16c992[_0xd9658e]['duration']-_0x16c992[_0xd9658e][_0x3671('0x67')]||0x0;_0x45f1d6[_0x3671('0x64')][_0x3671('0x32')]+=_0x16c992[_0xd9658e][_0x3671('0x67')];}}}return _0x45f1d6[_0x3671('0x64')];};};Realtime[_0x3671('0x3e')][_0x3671('0x68')]=function(){var _0x1dfd1a=this;return function(_0x186413){if(_0x186413){freeIsNotKey(_0x186413,_0x1dfd1a[_0x3671('0x16')],_0x3671('0x2a'));for(var _0x30e39b=0x0,_0xbdfde4={};_0x30e39b<_0x186413[_0x3671('0x40')];_0x30e39b+=0x1){_0xbdfde4=_0x186413[_0x30e39b];if(_['isUndefined'](_0x1dfd1a[_0x3671('0x16')][_0xbdfde4[_0x3671('0x2a')]])){_0x1dfd1a[_0x3671('0x16')][_0xbdfde4[_0x3671('0x2a')]]=new Campaign(_0xbdfde4);}else{_0x1dfd1a[_0x3671('0x3f')](_0x1dfd1a[_0x3671('0x16')][_0xbdfde4[_0x3671('0x2a')]],_0xbdfde4);_0x1dfd1a[_0x3671('0x16')][_0xbdfde4['name']][_0x3671('0x69')]=_0xbdfde4[_0x3671('0x6a')]?_0xbdfde4['SquareProject'][_0x3671('0x2a')]:undefined;}}}return _0x1dfd1a['campaigns'];};};Realtime[_0x3671('0x3e')][_0x3671('0x6b')]=function(){var _0x2aeea0=this;return function(_0x459f35){if(_0x459f35){freeIsNotKey(_0x459f35,_0x2aeea0[_0x3671('0x18')],'id');for(var _0x268044=0x0,_0x2bedb5={};_0x268044<_0x459f35[_0x3671('0x40')];_0x268044+=0x1){_0x2bedb5=_0x459f35[_0x268044];if(_[_0x3671('0x41')](_0x2aeea0['voiceExtensions'][_0x2bedb5['id']])){_0x2aeea0[_0x3671('0x18')][_0x2bedb5['id']]=new VoiceExtension(_0x2bedb5);}else{_0x2aeea0[_0x3671('0x3f')](_0x2aeea0[_0x3671('0x18')][_0x2bedb5['id']],_0x2bedb5);}}}return _0x2aeea0[_0x3671('0x18')];};};Realtime[_0x3671('0x3e')][_0x3671('0x6c')]=function(){var _0x386f4e=this;return function(_0x4bcaca){clearCampaigns(_0x386f4e[_0x3671('0x16')]);for(var _0x192ef0=0x0;_0x192ef0<_0x4bcaca[_0x3671('0x40')];_0x192ef0+=0x1){_[_0x3671('0x53')](_0x386f4e[_0x3671('0x16')][_0x4bcaca[_0x192ef0][_0x3671('0x2a')]],_0x4bcaca[_0x192ef0]);}return _0x386f4e[_0x3671('0x16')];};};Realtime[_0x3671('0x3e')][_0x3671('0x6d')]=function(){var _0x4a9c70=this;return function(_0x2e2fe){if(_0x2e2fe){freeIsNotKey(_0x2e2fe,_0x4a9c70[_0x3671('0x23')],'id');for(var _0x1f7f0f=0x0,_0x3e2be1={},_0x2b0b95={};_0x1f7f0f<_0x2e2fe['length'];_0x1f7f0f+=0x1){_0x3e2be1=_0x2e2fe[_0x1f7f0f];if(_[_0x3671('0x41')](_0x4a9c70[_0x3671('0x23')][_0x3e2be1['id']])){_0x4a9c70['faxAccounts'][_0x3e2be1['id']]=new FaxAccount(_0x3e2be1);}else{_0x4a9c70[_0x3671('0x3f')](_0x4a9c70[_0x3671('0x23')][_0x3e2be1['id']],_0x3e2be1);}}}return _0x4a9c70['faxAccounts'];};};module[_0x3671('0x6e')]=Realtime; \ No newline at end of file +var _0x6a3c=['../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','triggers','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','isNil','interface','format','SIP/%s','name','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isUndefined','mergeFromDatabase','telephones','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','queue','queuecallerexit','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','diff','total','queuecallercomplete','queuecallercompleteAt','queuecallerleaveAt','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','bluebird','util','lodash','moment','../model/agent'];(function(_0x4fc80b,_0xfe1b3d){var _0x119dba=function(_0x16ed12){while(--_0x16ed12){_0x4fc80b['push'](_0x4fc80b['shift']());}};_0x119dba(++_0xfe1b3d);}(_0x6a3c,0x14b));var _0xc6a3=function(_0x35d092,_0x43ee53){_0x35d092=_0x35d092-0x0;var _0x409c19=_0x6a3c[_0x35d092];return _0x409c19;};'use strict';var BPromise=require(_0xc6a3('0x0'));var util=require(_0xc6a3('0x1'));var _=require(_0xc6a3('0x2'));var moment=require(_0xc6a3('0x3'));var Agent=require(_0xc6a3('0x4'));var Telephone=require(_0xc6a3('0x5'));var Trunk=require(_0xc6a3('0x6'));var VoiceQueue=require(_0xc6a3('0x7'));var Trigger=require(_0xc6a3('0x8'));var Template=require('../model/template');var Campaign=require(_0xc6a3('0x9'));var VoiceExtension=require(_0xc6a3('0xa'));var ZendeskAccount=require(_0xc6a3('0xb'));var SalesforceAccount=require(_0xc6a3('0xc'));var FreshdeskAccount=require(_0xc6a3('0xd'));var SugarcrmAccount=require(_0xc6a3('0xe'));var ZohoAccount=require(_0xc6a3('0xf'));var DeskAccount=require(_0xc6a3('0x10'));var VtigerAccount=require(_0xc6a3('0x11'));var ServicenowAccount=require(_0xc6a3('0x12'));var Dynamics365Account=require(_0xc6a3('0x13'));var FreshsalesAccount=require(_0xc6a3('0x14'));var FaxAccount=require(_0xc6a3('0x15'));var Realtime=function(){this[_0xc6a3('0x16')]={};this['telephones']={};this[_0xc6a3('0x17')]={};this['voiceQueues']={};this[_0xc6a3('0x18')]={};this['campaigns']={};this['templates']={};this[_0xc6a3('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc6a3('0x1a')]={};this[_0xc6a3('0x1b')]={};this[_0xc6a3('0x1c')]={};this[_0xc6a3('0x1d')]={};this[_0xc6a3('0x1e')]={};this[_0xc6a3('0x1f')]={};this['salesforceAccounts']={};this[_0xc6a3('0x20')]={};this[_0xc6a3('0x21')]={};this[_0xc6a3('0x22')]={};this[_0xc6a3('0x23')]={};this['vtigerAccounts']={};this[_0xc6a3('0x24')]={};this[_0xc6a3('0x25')]={};this[_0xc6a3('0x26')]={};this[_0xc6a3('0x27')]={};};function freeIsNotKey(_0x5a15b4,_0x3f6028,_0xe2dc7d){var _0x3589b4=_['mapKeys'](_0x5a15b4,function(_0xdfae2a,_0x4d0cd0){return _0xdfae2a[_0xe2dc7d];});for(var _0x57656c in _0x3f6028){if(_0x3f6028[_0xc6a3('0x28')](_0x57656c)){if(!_0x3589b4[_0x57656c]){delete _0x3f6028[_0x57656c];}}}}function freeIsNotKeySip(_0x18d7ea,_0x366614){var _0x14171f=_[_0xc6a3('0x29')](_0x18d7ea,function(_0x425e37,_0x28846e){return util['format']('SIP/%s',_0x425e37['name']);});for(var _0x3b1bfd in _0x366614){if(_0x366614[_0xc6a3('0x28')](_0x3b1bfd)){if(!_0x14171f[_0x3b1bfd]){delete _0x366614[_0x3b1bfd];}}}}function freeIsNotKeyAgent(_0x1cb86b,_0x3409bb){var _0x578b5e=_[_0xc6a3('0x29')](_0x1cb86b,function(_0x102d29,_0x465dbe){var _0x1bcd17=_[_0xc6a3('0x2a')](_0x102d29[_0xc6a3('0x2b')])?util[_0xc6a3('0x2c')](_0xc6a3('0x2d'),_0x102d29[_0xc6a3('0x2e')]):_0x102d29[_0xc6a3('0x2b')];return _0x1bcd17;});for(var _0x20a178 in _0x3409bb){if(_0x3409bb[_0xc6a3('0x28')](_0x20a178)){if(!_0x578b5e[_0x20a178]){delete _0x3409bb[_0x20a178];}}}}function clearVoiceCallReports(_0x1c0e7f){_0x1c0e7f['total']=0x0;_0x1c0e7f[_0xc6a3('0x2f')]=0x0;_0x1c0e7f[_0xc6a3('0x30')]=0x0;_0x1c0e7f[_0xc6a3('0x31')]=0x0;_0x1c0e7f[_0xc6a3('0x32')]=0x0;}function clearCampaigns(_0x1caa7d){if(!_[_0xc6a3('0x33')](_0x1caa7d)){for(var _0x37ab72 in _0x1caa7d){if(_0x1caa7d['hasOwnProperty'](_0x37ab72)){_0x1caa7d[_0x37ab72][_0xc6a3('0x34')]=0x0;_0x1caa7d[_0x37ab72][_0xc6a3('0x35')]=0x0;}}}}function clearVoiceQueues(_0x1ee6b6){if(!_[_0xc6a3('0x33')](_0x1ee6b6)){for(var _0x34ba9b in _0x1ee6b6){if(_0x1ee6b6['hasOwnProperty'](_0x34ba9b)){_0x1ee6b6[_0x34ba9b]['total']=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x2f')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x36')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x37')]=0x0;_0x1ee6b6[_0x34ba9b]['sumHoldTime']=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x31')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x32')]=0x0;_0x1ee6b6[_0x34ba9b]['outboundAnswerAgiCallsDay']=0x0;_0x1ee6b6[_0x34ba9b]['outboundNoAnswerCallsDay']=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x38')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x39')]=0x0;_0x1ee6b6[_0x34ba9b]['outboundNoSuchCallsDay']=0x0;_0x1ee6b6[_0x34ba9b]['outboundUnknownCallsDay']=0x0;_0x1ee6b6[_0x34ba9b]['outboundDropCallsDayTimeout']=0x0;_0x1ee6b6[_0x34ba9b]['outboundDropCallsDayCallersExit']=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x3a')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x3b')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x3c')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x3d')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x3e')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x3f')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x40')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x22881e,_0x49ac13){for(var _0x1f81bc in _0x49ac13){if(_0x22881e['hasOwnProperty'](_0x1f81bc)){_0x22881e[_0x1f81bc]=_0x49ac13[_0x1f81bc];}}};Realtime[_0xc6a3('0x41')][_0xc6a3('0x42')]=function(){var _0xd6d505=this;return function(_0x552908){if(_0x552908){freeIsNotKeyAgent(_0x552908,_0xd6d505[_0xc6a3('0x16')]);for(var _0x372a14=0x0,_0x2b61ab={},_0x5c1bb4={};_0x372a14<_0x552908[_0xc6a3('0x43')];_0x372a14+=0x1){_0x2b61ab=_0x552908[_0x372a14];var _0x27549c=_['isNil'](_0x2b61ab[_0xc6a3('0x2b')])?util[_0xc6a3('0x2c')](_0xc6a3('0x2d'),_0x2b61ab['name']):_0x2b61ab[_0xc6a3('0x2b')];if(_[_0xc6a3('0x44')](_0xd6d505[_0xc6a3('0x16')][_0x27549c])){_0xd6d505[_0xc6a3('0x16')][_0x27549c]=new Agent(_0x2b61ab);}else{_0xd6d505[_0xc6a3('0x45')](_0xd6d505[_0xc6a3('0x16')][_0x27549c],_0x2b61ab);}}}return _0xd6d505[_0xc6a3('0x16')];};};Realtime[_0xc6a3('0x41')]['initTelephones']=function(){var _0x1007a7=this;return function(_0x24477e){if(_0x24477e){freeIsNotKeySip(_0x24477e,_0x1007a7['telephones']);for(var _0x4a3366=0x0,_0x1ba5cb={},_0x4aa2dd={};_0x4a3366<_0x24477e[_0xc6a3('0x43')];_0x4a3366+=0x1){_0x1ba5cb=_0x24477e[_0x4a3366];if(_['isUndefined'](_0x1007a7[_0xc6a3('0x46')][util['format'](_0xc6a3('0x2d'),_0x1ba5cb[_0xc6a3('0x2e')])])){_0x1007a7['telephones'][util['format'](_0xc6a3('0x2d'),_0x1ba5cb[_0xc6a3('0x2e')])]=new Telephone(_0x1ba5cb);}else{_0x1007a7[_0xc6a3('0x45')](_0x1007a7[_0xc6a3('0x46')][util[_0xc6a3('0x2c')](_0xc6a3('0x2d'),_0x1ba5cb[_0xc6a3('0x2e')])],_0x1ba5cb);}}}return _0x1007a7[_0xc6a3('0x46')];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x47')]=function(){var _0x4334c1=this;return function(_0x274344){if(_0x274344){freeIsNotKeySip(_0x274344,_0x4334c1['trunks']);for(var _0x574783=0x0,_0x47f2d4={},_0x35c49a={};_0x574783<_0x274344[_0xc6a3('0x43')];_0x574783+=0x1){_0x47f2d4=_0x274344[_0x574783];if(_[_0xc6a3('0x44')](_0x4334c1['trunks'][util[_0xc6a3('0x2c')](_0xc6a3('0x2d'),_0x47f2d4[_0xc6a3('0x2e')])])){_0x4334c1[_0xc6a3('0x17')][util[_0xc6a3('0x2c')](_0xc6a3('0x2d'),_0x47f2d4[_0xc6a3('0x2e')])]=new Trunk(_0x47f2d4);}else{_0x4334c1['mergeFromDatabase'](_0x4334c1[_0xc6a3('0x17')][util['format']('SIP/%s',_0x47f2d4['name'])],_0x47f2d4);}}}return _0x4334c1[_0xc6a3('0x17')];};};Realtime['prototype'][_0xc6a3('0x48')]=function(){var _0x10751c=this;return function(_0x1b8cea){if(_0x1b8cea){freeIsNotKey(_0x1b8cea,_0x10751c[_0xc6a3('0x49')],'name');for(var _0x45335f=0x0,_0x4410ae={},_0x40a081={};_0x45335f<_0x1b8cea[_0xc6a3('0x43')];_0x45335f+=0x1){_0x4410ae=_0x1b8cea[_0x45335f];if(_[_0xc6a3('0x44')](_0x10751c[_0xc6a3('0x49')][_0x4410ae[_0xc6a3('0x2e')]])){_0x10751c['voiceQueues'][_0x4410ae['name']]=new VoiceQueue(_0x4410ae);}else{_0x10751c[_0xc6a3('0x45')](_0x10751c['voiceQueues'][_0x4410ae[_0xc6a3('0x2e')]],_0x4410ae);}}}return _0x10751c['voiceQueues'];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x4a')]=function(){var _0x1fe3f6=this;return function(_0x4800b0){if(_0x4800b0){freeIsNotKey(_0x4800b0,_0x1fe3f6[_0xc6a3('0x18')],'id');for(var _0x387875=0x0,_0x13d807={},_0x464143={};_0x387875<_0x4800b0[_0xc6a3('0x43')];_0x387875+=0x1){_0x13d807=_0x4800b0[_0x387875];if(_[_0xc6a3('0x44')](_0x1fe3f6[_0xc6a3('0x18')][_0x13d807['id']])){_0x1fe3f6[_0xc6a3('0x18')][_0x13d807['id']]=new Trigger(_0x13d807);}else{_0x1fe3f6[_0xc6a3('0x45')](_0x1fe3f6[_0xc6a3('0x18')][_0x13d807['id']],_0x13d807);}}}return _0x1fe3f6[_0xc6a3('0x18')];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x4b')]=function(){var _0x186ae8=this;return function(_0x105d49){if(_0x105d49){freeIsNotKey(_0x105d49,_0x186ae8['templates'],'id');for(var _0x4d1aba=0x0,_0x32f8e4={},_0x224d24={};_0x4d1aba<_0x105d49[_0xc6a3('0x43')];_0x4d1aba+=0x1){_0x32f8e4=_0x105d49[_0x4d1aba];if(_[_0xc6a3('0x44')](_0x186ae8[_0xc6a3('0x4c')][_0x32f8e4['id']])){_0x186ae8[_0xc6a3('0x4c')][_0x32f8e4['id']]=new Template(_0x32f8e4);}else{_0x186ae8['mergeFromDatabase'](_0x186ae8['templates'][_0x32f8e4['id']],_0x32f8e4);}}}return _0x186ae8[_0xc6a3('0x4c')];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x4d')]=function(){var _0x2fdd93=this;return function(_0x3fdef9){if(_0x3fdef9){freeIsNotKey(_0x3fdef9,_0x2fdd93[_0xc6a3('0x1f')],'id');for(var _0x4cbd85=0x0,_0x191876={},_0x1627ac={};_0x4cbd85<_0x3fdef9[_0xc6a3('0x43')];_0x4cbd85+=0x1){_0x191876=_0x3fdef9[_0x4cbd85];if(_[_0xc6a3('0x44')](_0x2fdd93[_0xc6a3('0x1f')][_0x191876['id']])){_0x2fdd93[_0xc6a3('0x1f')][_0x191876['id']]=new ZendeskAccount(_0x191876);}else{_0x2fdd93[_0xc6a3('0x45')](_0x2fdd93[_0xc6a3('0x1f')][_0x191876['id']],_0x191876);}}}return _0x2fdd93[_0xc6a3('0x1f')];};};Realtime['prototype'][_0xc6a3('0x4e')]=function(){var _0x47f9a9=this;return function(_0x4f80ba){if(_0x4f80ba){freeIsNotKey(_0x4f80ba,_0x47f9a9[_0xc6a3('0x4f')],'id');for(var _0x3422b2=0x0,_0x3a2e4b={},_0x513954={};_0x3422b2<_0x4f80ba[_0xc6a3('0x43')];_0x3422b2+=0x1){_0x3a2e4b=_0x4f80ba[_0x3422b2];if(_[_0xc6a3('0x44')](_0x47f9a9[_0xc6a3('0x4f')][_0x3a2e4b['id']])){_0x47f9a9[_0xc6a3('0x4f')][_0x3a2e4b['id']]=new SalesforceAccount(_0x3a2e4b);}else{_0x47f9a9[_0xc6a3('0x45')](_0x47f9a9[_0xc6a3('0x4f')][_0x3a2e4b['id']],_0x3a2e4b);}}}return _0x47f9a9['salesforceAccounts'];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x50')]=function(){var _0x1f173f=this;return function(_0xe11797){if(_0xe11797){freeIsNotKey(_0xe11797,_0x1f173f['freshdeskAccounts'],'id');for(var _0x530d58=0x0,_0x206752={},_0x59a697={};_0x530d58<_0xe11797[_0xc6a3('0x43')];_0x530d58+=0x1){_0x206752=_0xe11797[_0x530d58];if(_[_0xc6a3('0x44')](_0x1f173f[_0xc6a3('0x21')][_0x206752['id']])){_0x1f173f[_0xc6a3('0x21')][_0x206752['id']]=new FreshdeskAccount(_0x206752);}else{_0x1f173f[_0xc6a3('0x45')](_0x1f173f[_0xc6a3('0x21')][_0x206752['id']],_0x206752);}}}return _0x1f173f[_0xc6a3('0x21')];};};Realtime['prototype'][_0xc6a3('0x51')]=function(){var _0x3d7b86=this;return function(_0x5df183){if(_0x5df183){freeIsNotKey(_0x5df183,_0x3d7b86[_0xc6a3('0x22')],'id');for(var _0x292868=0x0,_0x5dd0df={},_0x15c732={};_0x292868<_0x5df183['length'];_0x292868+=0x1){_0x5dd0df=_0x5df183[_0x292868];if(_['isUndefined'](_0x3d7b86[_0xc6a3('0x22')][_0x5dd0df['id']])){_0x3d7b86[_0xc6a3('0x22')][_0x5dd0df['id']]=new ZohoAccount(_0x5dd0df);}else{_0x3d7b86[_0xc6a3('0x45')](_0x3d7b86[_0xc6a3('0x22')][_0x5dd0df['id']],_0x5dd0df);}}}return _0x3d7b86['zohoAccounts'];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x52')]=function(){var _0x33ed43=this;return function(_0x194e83){if(_0x194e83){freeIsNotKey(_0x194e83,_0x33ed43[_0xc6a3('0x23')],'id');for(var _0x24d989=0x0,_0x5a539d={},_0xeea1ed={};_0x24d989<_0x194e83[_0xc6a3('0x43')];_0x24d989+=0x1){_0x5a539d=_0x194e83[_0x24d989];if(_[_0xc6a3('0x44')](_0x33ed43[_0xc6a3('0x23')][_0x5a539d['id']])){_0x33ed43[_0xc6a3('0x23')][_0x5a539d['id']]=new DeskAccount(_0x5a539d);}else{_0x33ed43['mergeFromDatabase'](_0x33ed43['deskAccounts'][_0x5a539d['id']],_0x5a539d);}}}return _0x33ed43[_0xc6a3('0x23')];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x53')]=function(){var _0xb9d98=this;return function(_0x395e1b){if(_0x395e1b){freeIsNotKey(_0x395e1b,_0xb9d98[_0xc6a3('0x20')],'id');for(var _0xb917e8=0x0,_0x51ee80={},_0x3cd2cc={};_0xb917e8<_0x395e1b[_0xc6a3('0x43')];_0xb917e8+=0x1){_0x51ee80=_0x395e1b[_0xb917e8];if(_[_0xc6a3('0x44')](_0xb9d98[_0xc6a3('0x20')][_0x51ee80['id']])){_0xb9d98['sugarcrmAccounts'][_0x51ee80['id']]=new SugarcrmAccount(_0x51ee80);}else{_0xb9d98['mergeFromDatabase'](_0xb9d98['sugarcrmAccounts'][_0x51ee80['id']],_0x51ee80);}}}return _0xb9d98['sugarcrmAccounts'];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x54')]=function(){var _0x1d6bb0=this;return function(_0x1f568a){if(_0x1f568a){freeIsNotKey(_0x1f568a,_0x1d6bb0[_0xc6a3('0x55')],'id');for(var _0x32f593=0x0,_0x1e71e7={},_0x29b34c={};_0x32f593<_0x1f568a[_0xc6a3('0x43')];_0x32f593+=0x1){_0x1e71e7=_0x1f568a[_0x32f593];if(_['isUndefined'](_0x1d6bb0[_0xc6a3('0x55')][_0x1e71e7['id']])){_0x1d6bb0['vtigerAccounts'][_0x1e71e7['id']]=new VtigerAccount(_0x1e71e7);}else{_0x1d6bb0[_0xc6a3('0x45')](_0x1d6bb0['vtigerAccounts'][_0x1e71e7['id']],_0x1e71e7);}}}return _0x1d6bb0[_0xc6a3('0x55')];};};Realtime['prototype'][_0xc6a3('0x56')]=function(){var _0x3455d5=this;return function(_0x26e4f7){if(_0x26e4f7){freeIsNotKey(_0x26e4f7,_0x3455d5[_0xc6a3('0x24')],'id');for(var _0x59911b=0x0,_0x3b7977={},_0x3c7b50={};_0x59911b<_0x26e4f7[_0xc6a3('0x43')];_0x59911b+=0x1){_0x3b7977=_0x26e4f7[_0x59911b];if(_[_0xc6a3('0x44')](_0x3455d5['servicenowAccounts'][_0x3b7977['id']])){_0x3455d5[_0xc6a3('0x24')][_0x3b7977['id']]=new ServicenowAccount(_0x3b7977);}else{_0x3455d5[_0xc6a3('0x45')](_0x3455d5['servicenowAccounts'][_0x3b7977['id']],_0x3b7977);}}}return _0x3455d5[_0xc6a3('0x24')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x10aee6=this;return function(_0x460a6f){if(_0x460a6f){freeIsNotKey(_0x460a6f,_0x10aee6[_0xc6a3('0x25')],'id');for(var _0x31d932=0x0,_0x70f7b={},_0x28d3df={};_0x31d932<_0x460a6f[_0xc6a3('0x43')];_0x31d932+=0x1){_0x70f7b=_0x460a6f[_0x31d932];if(_[_0xc6a3('0x44')](_0x10aee6['dynamics365Accounts'][_0x70f7b['id']])){_0x10aee6[_0xc6a3('0x25')][_0x70f7b['id']]=new Dynamics365Account(_0x70f7b);}else{_0x10aee6[_0xc6a3('0x45')](_0x10aee6[_0xc6a3('0x25')][_0x70f7b['id']],_0x70f7b);}}}return _0x10aee6[_0xc6a3('0x25')];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x57')]=function(){var _0x5b42a8=this;return function(_0x3c0bcb){if(_0x3c0bcb){freeIsNotKey(_0x3c0bcb,_0x5b42a8[_0xc6a3('0x26')],'id');for(var _0x35a7eb=0x0,_0x45b4dc={},_0x3ef9f4={};_0x35a7eb<_0x3c0bcb[_0xc6a3('0x43')];_0x35a7eb+=0x1){_0x45b4dc=_0x3c0bcb[_0x35a7eb];if(_[_0xc6a3('0x44')](_0x5b42a8[_0xc6a3('0x26')][_0x45b4dc['id']])){_0x5b42a8['freshsalesAccounts'][_0x45b4dc['id']]=new FreshsalesAccount(_0x45b4dc);}else{_0x5b42a8['mergeFromDatabase'](_0x5b42a8['freshsalesAccounts'][_0x45b4dc['id']],_0x45b4dc);}}}return _0x5b42a8['freshsalesAccounts'];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x58')]=function(){var _0x229d35=this;return function(_0x5459a5){for(var _0x213ad6=0x0;_0x213ad6<_0x5459a5[_0xc6a3('0x43')];_0x213ad6+=0x1){_[_0xc6a3('0x59')](_0x229d35['voiceQueues'][_0x5459a5[_0x213ad6]['name']],_0x5459a5[_0x213ad6]);}return _0x229d35['voiceQueues'];};};Realtime[_0xc6a3('0x41')]['initVoiceQueueReports']=function(){var _0x131a4c=this;return function(_0x46b48d){clearVoiceQueues(_0x131a4c['voiceQueues']);if(_0x46b48d){_0x46b48d=_[_0xc6a3('0x5a')](_0x46b48d,'uniqueid');for(var _0x36ddd3 in _0x46b48d){if(_0x46b48d[_0xc6a3('0x28')](_0x36ddd3)){var _0x2e5c9a={};for(var _0x2c0a97=0x0;_0x2c0a97<_0x46b48d[_0x36ddd3][_0xc6a3('0x43')];_0x2c0a97+=0x1){var _0x566953=_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x5b')];if(_0x131a4c[_0xc6a3('0x49')][_0x566953]){if(_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x5c')]){_0x131a4c[_0xc6a3('0x49')][_0x566953][_0xc6a3('0x36')]+=0x1;}if(_0x46b48d[_0x36ddd3][_0x2c0a97]['queuecallerabandon']){_0x131a4c[_0xc6a3('0x49')][_0x566953][_0xc6a3('0x37')]+=0x1;}_0x131a4c[_0xc6a3('0x49')][_0x566953][_0xc6a3('0x30')]+=moment(_0x46b48d[_0x36ddd3][_0x2c0a97]['queuecallerleaveAt'])['diff'](moment(_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x5d')]),_0xc6a3('0x5e'))||0x0;if(_0x2c0a97===_0x46b48d[_0x36ddd3][_0xc6a3('0x43')]-0x1){_0x131a4c[_0xc6a3('0x49')][_0x566953][_0xc6a3('0x31')]+=moment(_0x46b48d[_0x36ddd3][_0x2c0a97]['queuecallercompleteAt']||_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x5f')]||_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x60')])[_0xc6a3('0x61')](moment(_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x5d')]),_0xc6a3('0x5e'))||0x0;_0x131a4c[_0xc6a3('0x49')][_0x566953][_0xc6a3('0x62')]+=0x1;if(_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x63')]){_0x131a4c[_0xc6a3('0x49')][_0x566953][_0xc6a3('0x2f')]+=0x1;_0x131a4c[_0xc6a3('0x49')][_0x566953][_0xc6a3('0x32')]+=moment(_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x64')])[_0xc6a3('0x61')](moment(_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x65')]),_0xc6a3('0x5e'))||0x0;}}else{_0x131a4c[_0xc6a3('0x49')][_0x566953]['sumDuration']+=_0x131a4c[_0xc6a3('0x49')][_0x566953][_0xc6a3('0x30')]||0x0;}}}}}}return _0x131a4c[_0xc6a3('0x49')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x395774=this;return function(_0x3ee969){clearVoiceCallReports(_0x395774[_0xc6a3('0x19')]);if(_0x3ee969){for(var _0xa25938=0x0;_0xa25938<_0x3ee969[_0xc6a3('0x43')];_0xa25938+=0x1){_0x395774[_0xc6a3('0x19')][_0xc6a3('0x62')]+=0x1;_0x395774[_0xc6a3('0x19')][_0xc6a3('0x31')]+=_0x3ee969[_0xa25938][_0xc6a3('0x66')];if(_0x3ee969[_0xa25938][_0xc6a3('0x67')]===_0xc6a3('0x68')){_0x395774[_0xc6a3('0x19')][_0xc6a3('0x2f')]+=0x1;_0x395774['outbound'][_0xc6a3('0x30')]+=_0x3ee969[_0xa25938][_0xc6a3('0x66')]-_0x3ee969[_0xa25938][_0xc6a3('0x69')]||0x0;_0x395774[_0xc6a3('0x19')][_0xc6a3('0x32')]+=_0x3ee969[_0xa25938][_0xc6a3('0x69')];}}}return _0x395774[_0xc6a3('0x19')];};};Realtime['prototype'][_0xc6a3('0x6a')]=function(){var _0x28ea01=this;return function(_0x4f6f1a){if(_0x4f6f1a){freeIsNotKey(_0x4f6f1a,_0x28ea01['campaigns'],_0xc6a3('0x2e'));for(var _0x162f75=0x0,_0xb15af5={};_0x162f75<_0x4f6f1a[_0xc6a3('0x43')];_0x162f75+=0x1){_0xb15af5=_0x4f6f1a[_0x162f75];if(_[_0xc6a3('0x44')](_0x28ea01[_0xc6a3('0x6b')][_0xb15af5['name']])){_0x28ea01['campaigns'][_0xb15af5[_0xc6a3('0x2e')]]=new Campaign(_0xb15af5);}else{_0x28ea01[_0xc6a3('0x45')](_0x28ea01['campaigns'][_0xb15af5[_0xc6a3('0x2e')]],_0xb15af5);_0x28ea01[_0xc6a3('0x6b')][_0xb15af5[_0xc6a3('0x2e')]][_0xc6a3('0x6c')]=_0xb15af5[_0xc6a3('0x6d')]?_0xb15af5[_0xc6a3('0x6d')][_0xc6a3('0x2e')]:undefined;}}}return _0x28ea01[_0xc6a3('0x6b')];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x6e')]=function(){var _0x231a90=this;return function(_0x545903){if(_0x545903){freeIsNotKey(_0x545903,_0x231a90[_0xc6a3('0x1a')],'id');for(var _0x2f2e33=0x0,_0x230435={};_0x2f2e33<_0x545903['length'];_0x2f2e33+=0x1){_0x230435=_0x545903[_0x2f2e33];if(_[_0xc6a3('0x44')](_0x231a90['voiceExtensions'][_0x230435['id']])){_0x231a90[_0xc6a3('0x1a')][_0x230435['id']]=new VoiceExtension(_0x230435);}else{_0x231a90[_0xc6a3('0x45')](_0x231a90[_0xc6a3('0x1a')][_0x230435['id']],_0x230435);}}}return _0x231a90[_0xc6a3('0x1a')];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x6f')]=function(){var _0x33956f=this;return function(_0x471377){clearCampaigns(_0x33956f[_0xc6a3('0x6b')]);for(var _0x2678cd=0x0;_0x2678cd<_0x471377[_0xc6a3('0x43')];_0x2678cd+=0x1){_[_0xc6a3('0x59')](_0x33956f[_0xc6a3('0x6b')][_0x471377[_0x2678cd][_0xc6a3('0x2e')]],_0x471377[_0x2678cd]);}return _0x33956f['campaigns'];};};Realtime[_0xc6a3('0x41')]['initFaxAccounts']=function(){var _0xd46584=this;return function(_0x493247){if(_0x493247){freeIsNotKey(_0x493247,_0xd46584[_0xc6a3('0x27')],'id');for(var _0x278e00=0x0,_0x5de818={},_0x21b1e0={};_0x278e00<_0x493247[_0xc6a3('0x43')];_0x278e00+=0x1){_0x5de818=_0x493247[_0x278e00];if(_[_0xc6a3('0x44')](_0xd46584[_0xc6a3('0x27')][_0x5de818['id']])){_0xd46584[_0xc6a3('0x27')][_0x5de818['id']]=new FaxAccount(_0x5de818);}else{_0xd46584[_0xc6a3('0x45')](_0xd46584[_0xc6a3('0x27')][_0x5de818['id']],_0x5de818);}}}return _0xd46584['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 41f1750..2d13771 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 _0x00f2=['format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','destination','exten','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','calleridname','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','exports','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','voiceCallReport','bind','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x00f2,0x182));var _0x200f=function(_0xda4532,_0x4af293){_0xda4532=_0xda4532-0x0;var _0x58b32e=_0x00f2[_0xda4532];return _0x58b32e;};'use strict';var BPromise=require(_0x200f('0x0'));var _=require(_0x200f('0x1'));var moment=require(_0x200f('0x2'));var util=require(_0x200f('0x3'));var config=require(_0x200f('0x4'));var logger=require(_0x200f('0x5'))('ami');var ami=require(_0x200f('0x6'));var RpcVoiceAgentReport=require(_0x200f('0x7'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x200f('0x8'));var RpcMemberReport=require(_0x200f('0x9'));var RpcVoiceQueueReport=require(_0x200f('0xa'));var RpcVoiceRecording=require(_0x200f('0xb'));var RpcVoiceTransferReport=require(_0x200f('0xc'));var VoiceQueueReport=require(_0x200f('0xd'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x200f('0xe'));var UserReport=require(_0x200f('0xf'));function Report(_0x3b725c){this[_0x200f('0x10')]=_0x3b725c;this[_0x200f('0x11')]=_0x3b725c[_0x200f('0x11')];this['telephones']=_0x3b725c[_0x200f('0x12')];}Report[_0x200f('0x13')][_0x200f('0x14')]=function(_0xef4454){var _0x3c829d=new VoiceQueueReport(this[_0x200f('0x10')]);var _0x4008b1=new VoiceAgentReport(this['realtime']);var _0x13f4e9=new VoiceDialReport(this[_0x200f('0x10')]);var _0x667119=new VoiceCallReport(this[_0x200f('0x10')]);var _0x3d5438=new UserReport(this[_0x200f('0x10')]);if(config['xdr']&&config[_0x200f('0x15')][_0x200f('0x16')]){ami['on'](_0x200f('0x17'),this[_0x200f('0x18')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0x200f('0x19')][_0x200f('0x1a')](this));ami['on'](_0x200f('0x1b'),this['voiceAgentReport'][_0x200f('0x1a')](this));ami['on'](_0x200f('0x1c'),this[_0x200f('0x1d')][_0x200f('0x1a')](this));ami['on']('blindtransfer',this[_0x200f('0x1e')]['bind'](this));ami['on'](_0x200f('0x1f'),this[_0x200f('0x20')]['bind'](this));}};Report[_0x200f('0x13')][_0x200f('0x21')]=function(_0x146419){var _0x5d6697=undefined;_0x5d6697=_[_0x200f('0x22')](this[_0x200f('0x11')],function(_0x5ce36d){return _0x5ce36d[_0x200f('0x23')]==_0x146419||_0x5ce36d[_0x200f('0x24')]==_0x146419;});if(_[_0x200f('0x25')](_0x5d6697)){var _0x235752=_[_0x200f('0x22')](this[_0x200f('0x12')],function(_0x324c97){return _0x324c97['accountcode']==_0x146419||_0x324c97[_0x200f('0x24')]==_0x146419;});if(_0x235752){_0x5d6697=_['find'](this[_0x200f('0x11')],function(_0x8a2157){return _0x8a2157[_0x200f('0x26')]==util[_0x200f('0x27')](_0x200f('0x28'),_0x235752[_0x200f('0x24')]);});}}return _0x5d6697;};Report[_0x200f('0x13')][_0x200f('0x18')]=function(_0x31892f){for(var _0x3db4a9=0x0;_0x3db4a9<_0x31892f[_0x200f('0x29')];_0x3db4a9+=0x1){var _0xf372ef=this['findAgent'](_0x31892f[_0x3db4a9][_0x200f('0x2a')]);if(_0xf372ef){_0x31892f[_0x3db4a9][_0x200f('0x23')]=_0xf372ef[_0x200f('0x23')];_0x31892f[_0x3db4a9][_0x200f('0x2b')]=!![];_0x31892f[_0x3db4a9][_0x200f('0x2c')]=_0xf372ef[_0x200f('0x24')];_0x31892f[_0x3db4a9][_0x200f('0x26')]=_[_0x200f('0x25')](_0xf372ef['interface'])?util['format']('SIP/%s',_0xf372ef[_0x200f('0x24')]):_0xf372ef[_0x200f('0x26')];if(_0x31892f[_0x3db4a9]['queuecallercomplete']){_0x31892f[_0x3db4a9][_0x200f('0x2d')]=moment()['format'](_0x200f('0x2e'));}if(_0x31892f[_0x3db4a9]['queuecallerexit']){_0x31892f[_0x3db4a9][_0x200f('0x2f')]=moment()['format'](_0x200f('0x2e'));}RpcMemberReport[_0x200f('0x18')](_0x31892f[_0x3db4a9]);}RpcVoiceQueueReport[_0x200f('0x30')](_0x31892f[_0x3db4a9]);}};function extractCalleridNumber(_0x27dd25){var _0x4397f0=_0x27dd25[_0x200f('0x31')](/<(.*?)>/);return _0x4397f0?_0x4397f0[0x1]:_0x27dd25;}Report[_0x200f('0x13')][_0x200f('0x19')]=function(_0x2b10ba){_0x2b10ba[_0x200f('0x32')]=_0x2b10ba[_0x200f('0x32')]||_0x2b10ba[_0x200f('0x33')];if(_0x2b10ba['type']==_0x200f('0x34')){_0x2b10ba[_0x200f('0x35')]=_0x200f('0x36');_0x2b10ba['lastdata']=_0x2b10ba[_0x200f('0x36')];if(_0x2b10ba[_0x200f('0x37')]==_0x200f('0x38')){_0x2b10ba[_0x200f('0x23')]='';_0x2b10ba[_0x200f('0x32')]=extractCalleridNumber(_0x2b10ba[_0x200f('0x39')]);}else if(_0x2b10ba[_0x200f('0x37')]==_0x200f('0x3a')){if(_0x2b10ba[_0x200f('0x32')]=='xcally-motion-preview'){_0x2b10ba[_0x200f('0x32')]=extractCalleridNumber(_0x2b10ba[_0x200f('0x3b')]);_0x2b10ba['calleridnum']=_0x2b10ba[_0x200f('0x3c')];_0x2b10ba[_0x200f('0x3d')]=[_0x2b10ba[_0x200f('0x3e')],_0x2b10ba[_0x200f('0x3e')]=_0x2b10ba[_0x200f('0x3d')]][0x0];_0x2b10ba[_0x200f('0x39')]=_0x2b10ba['calleridpreview'];}else{_0x2b10ba[_0x200f('0x32')]=_0x2b10ba[_0x200f('0x3f')];_0x2b10ba[_0x200f('0x3f')]=_0x2b10ba[_0x200f('0x3c')];if(_0x2b10ba['disposition']=='ANSWERED'){_0x2b10ba[_0x200f('0x23')]=_0x2b10ba[_0x200f('0x2a')];}else{_0x2b10ba[_0x200f('0x23')]='';}}}}else{_0x2b10ba[_0x200f('0x39')]=util[_0x200f('0x27')]('\x22%s\x22\x20<%s>',_0x2b10ba[_0x200f('0x40')],_0x2b10ba[_0x200f('0x3f')]);}RpcVoiceCallReport[_0x200f('0x30')](_0x2b10ba);if(_0x2b10ba[_0x200f('0x41')]){for(var _0x365f7f=0x0;_0x365f7f<_0x2b10ba[_0x200f('0x42')][_0x200f('0x29')];_0x365f7f+=0x1){_0x2b10ba[_0x200f('0x43')]=_0x2b10ba[_0x200f('0x42')][_0x365f7f][_0x200f('0x44')];_0x2b10ba[_0x200f('0x45')]=_0x2b10ba['monitors'][_0x365f7f][_0x200f('0x45')];if(_0x2b10ba[_0x200f('0x33')]==_0x200f('0x46')){_0x2b10ba[_0x200f('0x3f')]=_0x2b10ba[_0x200f('0x2a')];_0x2b10ba[_0x200f('0x40')]=_0x2b10ba[_0x200f('0x47')];_0x2b10ba[_0x200f('0x2a')]=_0x2b10ba['accountcode'];_0x2b10ba[_0x200f('0x47')]=_0x2b10ba[_0x200f('0x48')];_0x2b10ba[_0x200f('0x33')]=_0x2b10ba['originatecalleridnum'];}else if(_0x2b10ba[_0x200f('0x33')]==_0x200f('0x49')){_0x2b10ba[_0x200f('0x3f')]=_0x2b10ba['destination'];_0x2b10ba[_0x200f('0x33')]=_0x2b10ba[_0x200f('0x3c')];}RpcVoiceRecording[_0x200f('0x30')](_0x2b10ba);}}};Report['prototype'][_0x200f('0x4a')]=function(_0x360801){if(_[_0x200f('0x4b')](_0x360801)){_0x360801[_0x200f('0x4c')](function(_0x45ccf0){RpcVoiceAgentReport['create'](_0x45ccf0);});}else{RpcVoiceAgentReport[_0x200f('0x30')](_0x360801);}};Report[_0x200f('0x13')][_0x200f('0x1d')]=function(_0x2b4189){RpcVoiceDialReport['create'](_0x2b4189);var _0x150746=undefined;var _0x35f12a=_0x2b4189[_0x200f('0x3e')];if(_[_0x200f('0x4d')](_0x35f12a,_0x200f('0x4e'))){var _0xb0f04c=_0x35f12a[_0x200f('0x4f')](_0x35f12a['indexOf']('/')+0x1,_0x35f12a[_0x200f('0x50')]('@'));_0x150746=_[_0x200f('0x22')](this[_0x200f('0x11')],function(_0x3f6cc9){return _0x3f6cc9[_0x200f('0x51')]==_0xb0f04c||_0x3f6cc9[_0x200f('0x52')]==_0xb0f04c||_0x3f6cc9[_0x200f('0x23')]==_0xb0f04c;});}else{var _0xb0f04c=_0x35f12a[_0x200f('0x4f')](_0x35f12a[_0x200f('0x50')]('/')+0x1,_0x35f12a[_0x200f('0x53')]('-'));_0x150746=this[_0x200f('0x21')](_0xb0f04c);}if(_0x150746){_0x2b4189[_0x200f('0x26')]=_[_0x200f('0x25')](_0x150746[_0x200f('0x26')])?util['format']('SIP/%s',_0x150746['name']):_0x150746[_0x200f('0x26')];_0x2b4189['membername']=_0x150746[_0x200f('0x24')];_0x2b4189['accountcode']=_0x150746[_0x200f('0x23')];RpcMemberReport['voiceDialReport'](_0x2b4189);}};Report['prototype'][_0x200f('0x1e')]=function(_0x78194f){RpcVoiceTransferReport[_0x200f('0x1e')](_0x78194f);};Report['prototype'][_0x200f('0x20')]=function(_0x50f006){RpcVoiceTransferReport[_0x200f('0x20')](_0x50f006);};module[_0x200f('0x54')]=Report; \ No newline at end of file +var _0x79a3=['disabled','voiceQueueReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','destination','exten','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','ANSWERED','calleridname','monitor','length','monitorFilename','createdAt','monitors','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','indexOf','mobile','phone','substring','lastIndexOf','exports','bluebird','lodash','moment','../../../config/environment','../../../config/logger','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr'];(function(_0xdc356f,_0x3003d0){var _0x339eaa=function(_0xc2283e){while(--_0xc2283e){_0xdc356f['push'](_0xdc356f['shift']());}};_0x339eaa(++_0x3003d0);}(_0x79a3,0x137));var _0x379a=function(_0x5e76be,_0x260463){_0x5e76be=_0x5e76be-0x0;var _0x51cb9c=_0x79a3[_0x5e76be];return _0x51cb9c;};'use strict';var BPromise=require(_0x379a('0x0'));var _=require(_0x379a('0x1'));var moment=require(_0x379a('0x2'));var util=require('util');var config=require(_0x379a('0x3'));var logger=require(_0x379a('0x4'))('ami');var ami=require(_0x379a('0x5'));var RpcVoiceAgentReport=require(_0x379a('0x6'));var RpcVoiceCallReport=require(_0x379a('0x7'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x379a('0x8'));var RpcVoiceRecording=require(_0x379a('0x9'));var RpcVoiceTransferReport=require(_0x379a('0xa'));var VoiceQueueReport=require(_0x379a('0xb'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x379a('0xc'));var VoiceDialReport=require(_0x379a('0xd'));var UserReport=require(_0x379a('0xe'));function Report(_0x497bdd){this[_0x379a('0xf')]=_0x497bdd;this[_0x379a('0x10')]=_0x497bdd['agents'];this['telephones']=_0x497bdd[_0x379a('0x11')];}Report[_0x379a('0x12')][_0x379a('0x13')]=function(_0x3afbf7){var _0x34bee5=new VoiceQueueReport(this[_0x379a('0xf')]);var _0x4a11ff=new VoiceAgentReport(this[_0x379a('0xf')]);var _0x13945b=new VoiceDialReport(this[_0x379a('0xf')]);var _0x4fad10=new VoiceCallReport(this[_0x379a('0xf')]);var _0x258fd6=new UserReport(this[_0x379a('0xf')]);if(config['xdr']&&config[_0x379a('0x14')][_0x379a('0x15')]){ami['on']('custom:voiceQueueReport',this[_0x379a('0x16')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0x379a('0x17')][_0x379a('0x18')](this));ami['on'](_0x379a('0x19'),this[_0x379a('0x1a')][_0x379a('0x18')](this));ami['on'](_0x379a('0x1b'),this[_0x379a('0x1c')][_0x379a('0x18')](this));ami['on'](_0x379a('0x1d'),this[_0x379a('0x1e')][_0x379a('0x18')](this));ami['on'](_0x379a('0x1f'),this[_0x379a('0x20')][_0x379a('0x18')](this));}};Report['prototype'][_0x379a('0x21')]=function(_0x43228b){var _0x21dae4=undefined;_0x21dae4=_[_0x379a('0x22')](this[_0x379a('0x10')],function(_0x15f57b){return _0x15f57b[_0x379a('0x23')]==_0x43228b||_0x15f57b[_0x379a('0x24')]==_0x43228b;});if(_[_0x379a('0x25')](_0x21dae4)){var _0x1763a2=_[_0x379a('0x22')](this[_0x379a('0x11')],function(_0x5024ff){return _0x5024ff['accountcode']==_0x43228b||_0x5024ff[_0x379a('0x24')]==_0x43228b;});if(_0x1763a2){_0x21dae4=_['find'](this[_0x379a('0x10')],function(_0x5eed14){return _0x5eed14[_0x379a('0x26')]==util[_0x379a('0x27')](_0x379a('0x28'),_0x1763a2[_0x379a('0x24')]);});}}return _0x21dae4;};Report[_0x379a('0x12')]['voiceQueueReport']=function(_0x33290c){for(var _0xf0b34b=0x0;_0xf0b34b<_0x33290c['length'];_0xf0b34b+=0x1){var _0x4cb7e0=this[_0x379a('0x21')](_0x33290c[_0xf0b34b][_0x379a('0x29')]);if(_0x4cb7e0){_0x33290c[_0xf0b34b][_0x379a('0x23')]=_0x4cb7e0[_0x379a('0x23')];_0x33290c[_0xf0b34b][_0x379a('0x2a')]=!![];_0x33290c[_0xf0b34b][_0x379a('0x2b')]=_0x4cb7e0['name'];_0x33290c[_0xf0b34b][_0x379a('0x26')]=_[_0x379a('0x25')](_0x4cb7e0[_0x379a('0x26')])?util[_0x379a('0x27')](_0x379a('0x28'),_0x4cb7e0['name']):_0x4cb7e0[_0x379a('0x26')];if(_0x33290c[_0xf0b34b][_0x379a('0x2c')]){_0x33290c[_0xf0b34b]['queuecallercompleteAt']=moment()[_0x379a('0x27')](_0x379a('0x2d'));}if(_0x33290c[_0xf0b34b][_0x379a('0x2e')]){_0x33290c[_0xf0b34b][_0x379a('0x2f')]=moment()[_0x379a('0x27')](_0x379a('0x2d'));}RpcMemberReport[_0x379a('0x16')](_0x33290c[_0xf0b34b]);}RpcVoiceQueueReport[_0x379a('0x30')](_0x33290c[_0xf0b34b]);}};function extractCalleridNumber(_0x568ba3){var _0x56e1e5=_0x568ba3['match'](/<(.*?)>/);return _0x56e1e5?_0x56e1e5[0x1]:_0x568ba3;}Report[_0x379a('0x12')]['voiceCallReport']=function(_0x11eba1){_0x11eba1[_0x379a('0x31')]=_0x11eba1[_0x379a('0x31')]||_0x11eba1[_0x379a('0x32')];if(_0x11eba1['type']==_0x379a('0x33')){_0x11eba1[_0x379a('0x34')]='queue';_0x11eba1[_0x379a('0x35')]=_0x11eba1[_0x379a('0x36')];if(_0x11eba1[_0x379a('0x37')]==_0x379a('0x38')){_0x11eba1['accountcode']='';_0x11eba1[_0x379a('0x31')]=extractCalleridNumber(_0x11eba1[_0x379a('0x39')]);}else if(_0x11eba1[_0x379a('0x37')]==_0x379a('0x3a')){if(_0x11eba1[_0x379a('0x31')]==_0x379a('0x3b')){_0x11eba1['destination']=extractCalleridNumber(_0x11eba1[_0x379a('0x3c')]);_0x11eba1['calleridnum']=_0x11eba1[_0x379a('0x3d')];_0x11eba1[_0x379a('0x3e')]=[_0x11eba1[_0x379a('0x3f')],_0x11eba1[_0x379a('0x3f')]=_0x11eba1[_0x379a('0x3e')]][0x0];_0x11eba1['callerid']=_0x11eba1[_0x379a('0x3c')];}else{_0x11eba1['destination']=_0x11eba1['calleridnum'];_0x11eba1[_0x379a('0x40')]=_0x11eba1[_0x379a('0x3d')];if(_0x11eba1['disposition']==_0x379a('0x41')){_0x11eba1[_0x379a('0x23')]=_0x11eba1[_0x379a('0x29')];}else{_0x11eba1[_0x379a('0x23')]='';}}}}else{_0x11eba1[_0x379a('0x39')]=util[_0x379a('0x27')]('\x22%s\x22\x20<%s>',_0x11eba1[_0x379a('0x42')],_0x11eba1[_0x379a('0x40')]);}RpcVoiceCallReport[_0x379a('0x30')](_0x11eba1);if(_0x11eba1[_0x379a('0x43')]){for(var _0x50910a=0x0;_0x50910a<_0x11eba1['monitors'][_0x379a('0x44')];_0x50910a+=0x1){_0x11eba1[_0x379a('0x45')]=_0x11eba1['monitors'][_0x50910a]['filename'];_0x11eba1[_0x379a('0x46')]=_0x11eba1[_0x379a('0x47')][_0x50910a][_0x379a('0x46')];if(_0x11eba1[_0x379a('0x32')]==_0x379a('0x3b')){_0x11eba1[_0x379a('0x40')]=_0x11eba1[_0x379a('0x29')];_0x11eba1[_0x379a('0x42')]=_0x11eba1['connectedlinename'];_0x11eba1['connectedlinenum']=_0x11eba1[_0x379a('0x23')];_0x11eba1[_0x379a('0x48')]=_0x11eba1[_0x379a('0x49')];_0x11eba1[_0x379a('0x32')]=_0x11eba1[_0x379a('0x3d')];}else if(_0x11eba1[_0x379a('0x32')]==_0x379a('0x4a')){_0x11eba1[_0x379a('0x40')]=_0x11eba1[_0x379a('0x31')];_0x11eba1[_0x379a('0x32')]=_0x11eba1[_0x379a('0x3d')];}RpcVoiceRecording[_0x379a('0x30')](_0x11eba1);}}};Report[_0x379a('0x12')][_0x379a('0x1a')]=function(_0x25ff66){if(_[_0x379a('0x4b')](_0x25ff66)){_0x25ff66[_0x379a('0x4c')](function(_0x5b31aa){RpcVoiceAgentReport[_0x379a('0x30')](_0x5b31aa);});}else{RpcVoiceAgentReport[_0x379a('0x30')](_0x25ff66);}};Report[_0x379a('0x12')]['voiceDialReport']=function(_0x3be311){RpcVoiceDialReport[_0x379a('0x30')](_0x3be311);var _0x454967=undefined;var _0xdeb235=_0x3be311['channel'];if(_['startsWith'](_0xdeb235,'Local')){var _0x142952=_0xdeb235['substring'](_0xdeb235[_0x379a('0x4d')]('/')+0x1,_0xdeb235[_0x379a('0x4d')]('@'));_0x454967=_['find'](this[_0x379a('0x10')],function(_0x516a92){return _0x516a92[_0x379a('0x4e')]==_0x142952||_0x516a92[_0x379a('0x4f')]==_0x142952||_0x516a92['accountcode']==_0x142952;});}else{var _0x142952=_0xdeb235[_0x379a('0x50')](_0xdeb235[_0x379a('0x4d')]('/')+0x1,_0xdeb235[_0x379a('0x51')]('-'));_0x454967=this[_0x379a('0x21')](_0x142952);}if(_0x454967){_0x3be311[_0x379a('0x26')]=_[_0x379a('0x25')](_0x454967['interface'])?util[_0x379a('0x27')](_0x379a('0x28'),_0x454967[_0x379a('0x24')]):_0x454967[_0x379a('0x26')];_0x3be311['membername']=_0x454967[_0x379a('0x24')];_0x3be311[_0x379a('0x23')]=_0x454967['accountcode'];RpcMemberReport['voiceDialReport'](_0x3be311);}};Report[_0x379a('0x12')][_0x379a('0x1e')]=function(_0x2465b9){RpcVoiceTransferReport[_0x379a('0x1e')](_0x2465b9);};Report['prototype'][_0x379a('0x20')]=function(_0x4923c3){RpcVoiceTransferReport['attendedTransfer'](_0x4923c3);};module[_0x379a('0x52')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 16e83a9..64d7032 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 _0x0ab8=['toNumber','updateStatusRealtime','telephone:%s','startsWith','Local','substring','indexOf','find','mobile','phone','accountcode','[syncDeviceState][UserReport]','inspect','peer','registered','status','address','telephone:save','[syncPeerStatus][UserReport]','exports','lodash','moment','bluebird','ioredis','../../../config/environment','ami','redis','defaults','socket.io-emitter','agents','telephones','registryentry','bind','registry','syncRegistry','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','then','actionSipShowRegistry','actionDeviceStateList','error','prototype','actionSipPeerStatus','[loopSyncRealTimeShow]','isNotNull','emit','trunks','username','stateRegistry','state','merge','omit','actionid','format','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','device','local','inuse','toLowerCase','stateTime'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x0ab8,0x1db));var _0x80ab=function(_0x39c5e1,_0x4f9c62){_0x39c5e1=_0x39c5e1-0x0;var _0x51af6f=_0x0ab8[_0x39c5e1];return _0x51af6f;};'use strict';var _=require(_0x80ab('0x0'));var moment=require(_0x80ab('0x1'));var BPromise=require(_0x80ab('0x2'));var util=require('util');var Redis=require(_0x80ab('0x3'));var config=require(_0x80ab('0x4'));var logger=require('../../../config/logger')(_0x80ab('0x5'));var ami=require('../ami');config[_0x80ab('0x6')]=_[_0x80ab('0x7')](config[_0x80ab('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x80ab('0x8'))(new Redis(config['redis']));function UserReport(_0x11c61d){this['trunks']=_0x11c61d['trunks'];this['agents']=_0x11c61d[_0x80ab('0x9')];this['telephones']=_0x11c61d[_0x80ab('0xa')];ami['on'](_0x80ab('0xb'),this['syncRegistry'][_0x80ab('0xc')](this));ami['on'](_0x80ab('0xd'),this[_0x80ab('0xe')][_0x80ab('0xc')](this));ami['on']('devicestatechange',this[_0x80ab('0xf')][_0x80ab('0xc')](this));ami['on'](_0x80ab('0x10'),this[_0x80ab('0x11')][_0x80ab('0xc')](this));this[_0x80ab('0x12')]();return BPromise['resolve']()[_0x80ab('0x13')](ami[_0x80ab('0x14')]())[_0x80ab('0x13')](ami[_0x80ab('0x15')]())[_0x80ab('0x13')](ami['actionSipPeerStatus']())['catch'](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x271f02){return function(_0x24259b){logger[_0x80ab('0x16')](_0x271f02,util['inspect'](_0x24259b,{'showHidden':![],'depth':null}));};}UserReport[_0x80ab('0x17')][_0x80ab('0x12')]=function(){setInterval(function(){BPromise['resolve']()[_0x80ab('0x13')](ami[_0x80ab('0x14')]())[_0x80ab('0x13')](ami[_0x80ab('0x15')]())[_0x80ab('0x13')](ami[_0x80ab('0x18')]())['catch'](loggerCatch(_0x80ab('0x19')));},0x32c8);};UserReport[_0x80ab('0x17')][_0x80ab('0x1a')]=function(_0x335ad8){return _0x335ad8!==null&&!_['isUndefined'](_0x335ad8);};UserReport[_0x80ab('0x17')][_0x80ab('0x1b')]=function(_0x190760,_0x428d46,_0xb5c55a){io['to'](_0x190760)[_0x80ab('0x1b')](_0x428d46,_0xb5c55a);};UserReport[_0x80ab('0x17')][_0x80ab('0xe')]=function(_0x12b950){try{if(this[_0x80ab('0x1a')](_0x12b950)){var _0x35b489=_['find'](this[_0x80ab('0x1c')],{'registry':_0x12b950[_0x80ab('0x1d')]});if(_0x35b489){_0x12b950[_0x80ab('0x1e')]=_0x12b950[_0x80ab('0x1f')];_[_0x80ab('0x20')](_0x35b489,_[_0x80ab('0x21')](_0x12b950,['event',_0x80ab('0x22'),_0x80ab('0x1d'),_0x80ab('0x1f')]));this[_0x80ab('0x1b')](util[_0x80ab('0x23')](_0x80ab('0x24'),_0x35b489[_0x80ab('0x25')]),_0x80ab('0x26'),_0x35b489);}}}catch(_0x5da429){logger[_0x80ab('0x16')](_0x80ab('0x27'),util['inspect'](_0x5da429,{'showHidden':![],'depth':null}));}};UserReport[_0x80ab('0x17')][_0x80ab('0xf')]=function(_0x19c615){try{if(this[_0x80ab('0x1a')](_0x19c615)){if(this['agents'][_0x19c615['device']]){if(!this[_0x80ab('0x9')][_0x19c615[_0x80ab('0x28')]][_0x80ab('0x29')]||_0x19c615['state']['toLowerCase']()==_0x80ab('0x2a')){this[_0x80ab('0x9')][_0x19c615['device']]['local']=![];if(this['agents'][_0x19c615[_0x80ab('0x28')]][_0x80ab('0x1f')]!==_0x19c615[_0x80ab('0x1f')][_0x80ab('0x2b')]()){this[_0x80ab('0x9')][_0x19c615[_0x80ab('0x28')]][_0x80ab('0x2c')]=_[_0x80ab('0x2d')](moment()['format']('x'));}this['agents'][_0x19c615[_0x80ab('0x28')]]['state']=_0x19c615[_0x80ab('0x1f')]['toLowerCase']();this[_0x80ab('0x9')][_0x19c615[_0x80ab('0x28')]][_0x80ab('0x2e')](_0x19c615);}}else if(this[_0x80ab('0xa')][_0x19c615[_0x80ab('0x28')]]){if(this[_0x80ab('0xa')][_0x19c615[_0x80ab('0x28')]][_0x80ab('0x1f')]!==_0x19c615[_0x80ab('0x1f')][_0x80ab('0x2b')]()){this['telephones'][_0x19c615[_0x80ab('0x28')]][_0x80ab('0x2c')]=_[_0x80ab('0x2d')](moment()['format']('x'));}this['telephones'][_0x19c615[_0x80ab('0x28')]][_0x80ab('0x1f')]=_0x19c615[_0x80ab('0x1f')][_0x80ab('0x2b')]();this[_0x80ab('0x1b')](util[_0x80ab('0x23')](_0x80ab('0x2f'),this[_0x80ab('0xa')][_0x19c615[_0x80ab('0x28')]]['name']),'telephone:save',this[_0x80ab('0xa')][_0x19c615[_0x80ab('0x28')]]);}else if(this['trunks'][_0x19c615[_0x80ab('0x28')]]){if(this[_0x80ab('0x1c')][_0x19c615['device']][_0x80ab('0x1f')]!==_0x19c615[_0x80ab('0x1f')][_0x80ab('0x2b')]()){this['trunks'][_0x19c615[_0x80ab('0x28')]][_0x80ab('0x2c')]=_[_0x80ab('0x2d')](moment()[_0x80ab('0x23')]('x'));}this[_0x80ab('0x1c')][_0x19c615[_0x80ab('0x28')]][_0x80ab('0x1f')]=_0x19c615[_0x80ab('0x1f')]['toLowerCase']();this['emit'](util[_0x80ab('0x23')](_0x80ab('0x24'),this[_0x80ab('0x1c')][_0x19c615[_0x80ab('0x28')]][_0x80ab('0x25')]),_0x80ab('0x26'),this[_0x80ab('0x1c')][_0x19c615[_0x80ab('0x28')]]);}else if(_[_0x80ab('0x30')](_0x19c615[_0x80ab('0x28')],'Queue')){}else if(_[_0x80ab('0x30')](_0x19c615[_0x80ab('0x28')],_0x80ab('0x31'))){var _0x4e0f3d=_0x19c615['device'];var _0x1ce9e8=_0x4e0f3d[_0x80ab('0x32')](_0x4e0f3d[_0x80ab('0x33')]('/')+0x1,_0x4e0f3d[_0x80ab('0x33')]('@'));var _0x5859a3=_[_0x80ab('0x34')](this[_0x80ab('0x9')],function(_0x22130a){return _0x22130a[_0x80ab('0x35')]==_0x1ce9e8||_0x22130a[_0x80ab('0x36')]==_0x1ce9e8||_0x22130a[_0x80ab('0x37')]==_0x1ce9e8;});if(_0x5859a3){if(_0x5859a3['state']!==_0x19c615['state'][_0x80ab('0x2b')]()){_0x5859a3['stateTime']=_[_0x80ab('0x2d')](moment()[_0x80ab('0x23')]('x'));}_0x5859a3[_0x80ab('0x1f')]=_0x19c615[_0x80ab('0x1f')][_0x80ab('0x2b')]();_0x5859a3['local']=!![];_0x5859a3[_0x80ab('0x2e')](_0x19c615);}}else{}}}catch(_0x547595){logger[_0x80ab('0x16')](_0x80ab('0x38'),util[_0x80ab('0x39')](_0x547595,{'showHidden':![],'depth':null}));}};UserReport[_0x80ab('0x17')][_0x80ab('0x11')]=function(_0x14e81c){try{if(this[_0x80ab('0x1a')](_0x14e81c)&&this[_0x80ab('0x1a')](_0x14e81c[_0x80ab('0x10')])){if(this[_0x80ab('0x9')][_0x14e81c[_0x80ab('0x3a')]]){if(!this[_0x80ab('0x9')][_0x14e81c[_0x80ab('0x3a')]][_0x80ab('0x29')]||_0x14e81c[_0x80ab('0x10')][_0x80ab('0x2b')]()==_0x80ab('0x3b')){this['agents'][_0x14e81c[_0x80ab('0x3a')]]['local']=![];this[_0x80ab('0x9')][_0x14e81c[_0x80ab('0x3a')]][_0x80ab('0x3c')]=_0x14e81c[_0x80ab('0x10')][_0x80ab('0x2b')]();this['agents'][_0x14e81c[_0x80ab('0x3a')]][_0x80ab('0x3d')]=_0x14e81c['address'];this[_0x80ab('0x9')][_0x14e81c['peer']][_0x80ab('0x2e')](_0x14e81c);}}else if(this[_0x80ab('0xa')][_0x14e81c[_0x80ab('0x3a')]]){this[_0x80ab('0xa')][_0x14e81c['peer']][_0x80ab('0x3c')]=_0x14e81c[_0x80ab('0x10')][_0x80ab('0x2b')]();this['telephones'][_0x14e81c[_0x80ab('0x3a')]][_0x80ab('0x3d')]=_0x14e81c[_0x80ab('0x3d')];this[_0x80ab('0x1b')](util['format'](_0x80ab('0x2f'),this[_0x80ab('0xa')][_0x14e81c[_0x80ab('0x3a')]][_0x80ab('0x25')]),_0x80ab('0x3e'),this['telephones'][_0x14e81c[_0x80ab('0x3a')]]);}else if(this['trunks'][_0x14e81c[_0x80ab('0x3a')]]){this['trunks'][_0x14e81c['peer']]['status']=_0x14e81c[_0x80ab('0x10')]['toLowerCase']();this[_0x80ab('0x1c')][_0x14e81c[_0x80ab('0x3a')]]['address']=_0x14e81c[_0x80ab('0x3d')];this[_0x80ab('0x1b')](util[_0x80ab('0x23')](_0x80ab('0x24'),this[_0x80ab('0x1c')][_0x14e81c['peer']][_0x80ab('0x25')]),_0x80ab('0x26'),this[_0x80ab('0x1c')][_0x14e81c[_0x80ab('0x3a')]]);}else{}}}catch(_0x8b9f1){logger['error'](_0x80ab('0x3f'),util[_0x80ab('0x39')](_0x8b9f1,{'showHidden':![],'depth':null}));}};module[_0x80ab('0x40')]=UserReport; \ No newline at end of file +var _0x810c=['trunk:save','[syncRegistry][UserReport]','syncDeviceState','device','state','toLowerCase','inuse','local','updateStatusRealtime','stateTime','toNumber','telephone:%s','name','telephone:save','startsWith','Queue','Local','substring','indexOf','find','mobile','phone','accountcode','peer','registered','address','[syncPeerStatus][UserReport]','exports','lodash','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','localhost','socket.io-emitter','agents','telephones','registryentry','syncRegistry','registry','bind','devicestatechange','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','[loopSyncRealTimeShow]','error','inspect','prototype','catch','isNotNull','isUndefined','emit','trunks','username','merge','event','actionid','format','trunk:%s'];(function(_0x4e324f,_0x4f0cfc){var _0x4e6076=function(_0x4b8227){while(--_0x4b8227){_0x4e324f['push'](_0x4e324f['shift']());}};_0x4e6076(++_0x4f0cfc);}(_0x810c,0x1ba));var _0xc810=function(_0x17a749,_0x40908b){_0x17a749=_0x17a749-0x0;var _0x10ee89=_0x810c[_0x17a749];return _0x10ee89;};'use strict';var _=require(_0xc810('0x0'));var moment=require(_0xc810('0x1'));var BPromise=require(_0xc810('0x2'));var util=require(_0xc810('0x3'));var Redis=require(_0xc810('0x4'));var config=require(_0xc810('0x5'));var logger=require(_0xc810('0x6'))('ami');var ami=require(_0xc810('0x7'));config[_0xc810('0x8')]=_['defaults'](config['redis'],{'host':_0xc810('0x9'),'port':0x18eb});var io=require(_0xc810('0xa'))(new Redis(config[_0xc810('0x8')]));function UserReport(_0x349343){this['trunks']=_0x349343['trunks'];this[_0xc810('0xb')]=_0x349343[_0xc810('0xb')];this[_0xc810('0xc')]=_0x349343[_0xc810('0xc')];ami['on'](_0xc810('0xd'),this[_0xc810('0xe')]['bind'](this));ami['on'](_0xc810('0xf'),this['syncRegistry'][_0xc810('0x10')](this));ami['on'](_0xc810('0x11'),this['syncDeviceState'][_0xc810('0x10')](this));ami['on'](_0xc810('0x12'),this[_0xc810('0x13')]['bind'](this));this[_0xc810('0x14')]();return BPromise[_0xc810('0x15')]()[_0xc810('0x16')](ami[_0xc810('0x17')]())[_0xc810('0x16')](ami[_0xc810('0x18')]())[_0xc810('0x16')](ami[_0xc810('0x19')]())['catch'](loggerCatch(_0xc810('0x1a')));}function loggerCatch(_0x3e9560){return function(_0xabf7df){logger[_0xc810('0x1b')](_0x3e9560,util[_0xc810('0x1c')](_0xabf7df,{'showHidden':![],'depth':null}));};}UserReport[_0xc810('0x1d')][_0xc810('0x14')]=function(){setInterval(function(){BPromise[_0xc810('0x15')]()['then'](ami[_0xc810('0x17')]())[_0xc810('0x16')](ami['actionDeviceStateList']())[_0xc810('0x16')](ami[_0xc810('0x19')]())[_0xc810('0x1e')](loggerCatch(_0xc810('0x1a')));},0x32c8);};UserReport[_0xc810('0x1d')][_0xc810('0x1f')]=function(_0x183723){return _0x183723!==null&&!_[_0xc810('0x20')](_0x183723);};UserReport[_0xc810('0x1d')][_0xc810('0x21')]=function(_0x659b74,_0x5207d7,_0x3abb0b){io['to'](_0x659b74)['emit'](_0x5207d7,_0x3abb0b);};UserReport['prototype']['syncRegistry']=function(_0x1da2a5){try{if(this['isNotNull'](_0x1da2a5)){var _0x75c7e=_['find'](this[_0xc810('0x22')],{'registry':_0x1da2a5[_0xc810('0x23')]});if(_0x75c7e){_0x1da2a5['stateRegistry']=_0x1da2a5['state'];_[_0xc810('0x24')](_0x75c7e,_['omit'](_0x1da2a5,[_0xc810('0x25'),_0xc810('0x26'),_0xc810('0x23'),'state']));this[_0xc810('0x21')](util[_0xc810('0x27')](_0xc810('0x28'),_0x75c7e['name']),_0xc810('0x29'),_0x75c7e);}}}catch(_0x1bf598){logger[_0xc810('0x1b')](_0xc810('0x2a'),util['inspect'](_0x1bf598,{'showHidden':![],'depth':null}));}};UserReport[_0xc810('0x1d')][_0xc810('0x2b')]=function(_0x2e6068){try{if(this[_0xc810('0x1f')](_0x2e6068)){if(this[_0xc810('0xb')][_0x2e6068[_0xc810('0x2c')]]){if(!this['agents'][_0x2e6068[_0xc810('0x2c')]]['local']||_0x2e6068[_0xc810('0x2d')][_0xc810('0x2e')]()==_0xc810('0x2f')){this['agents'][_0x2e6068[_0xc810('0x2c')]][_0xc810('0x30')]=![];if(this[_0xc810('0xb')][_0x2e6068[_0xc810('0x2c')]][_0xc810('0x2d')]!==_0x2e6068[_0xc810('0x2d')][_0xc810('0x2e')]()){this[_0xc810('0xb')][_0x2e6068[_0xc810('0x2c')]]['stateTime']=_['toNumber'](moment()[_0xc810('0x27')]('x'));}this['agents'][_0x2e6068['device']][_0xc810('0x2d')]=_0x2e6068[_0xc810('0x2d')][_0xc810('0x2e')]();this[_0xc810('0xb')][_0x2e6068[_0xc810('0x2c')]][_0xc810('0x31')](_0x2e6068);}}else if(this['telephones'][_0x2e6068[_0xc810('0x2c')]]){if(this[_0xc810('0xc')][_0x2e6068['device']][_0xc810('0x2d')]!==_0x2e6068[_0xc810('0x2d')][_0xc810('0x2e')]()){this[_0xc810('0xc')][_0x2e6068[_0xc810('0x2c')]][_0xc810('0x32')]=_[_0xc810('0x33')](moment()[_0xc810('0x27')]('x'));}this[_0xc810('0xc')][_0x2e6068[_0xc810('0x2c')]][_0xc810('0x2d')]=_0x2e6068[_0xc810('0x2d')][_0xc810('0x2e')]();this[_0xc810('0x21')](util[_0xc810('0x27')](_0xc810('0x34'),this[_0xc810('0xc')][_0x2e6068[_0xc810('0x2c')]][_0xc810('0x35')]),_0xc810('0x36'),this[_0xc810('0xc')][_0x2e6068[_0xc810('0x2c')]]);}else if(this[_0xc810('0x22')][_0x2e6068[_0xc810('0x2c')]]){if(this[_0xc810('0x22')][_0x2e6068[_0xc810('0x2c')]]['state']!==_0x2e6068[_0xc810('0x2d')][_0xc810('0x2e')]()){this[_0xc810('0x22')][_0x2e6068[_0xc810('0x2c')]][_0xc810('0x32')]=_[_0xc810('0x33')](moment()[_0xc810('0x27')]('x'));}this[_0xc810('0x22')][_0x2e6068[_0xc810('0x2c')]]['state']=_0x2e6068['state'][_0xc810('0x2e')]();this[_0xc810('0x21')](util[_0xc810('0x27')](_0xc810('0x28'),this[_0xc810('0x22')][_0x2e6068[_0xc810('0x2c')]][_0xc810('0x35')]),_0xc810('0x29'),this[_0xc810('0x22')][_0x2e6068[_0xc810('0x2c')]]);}else if(_[_0xc810('0x37')](_0x2e6068[_0xc810('0x2c')],_0xc810('0x38'))){}else if(_[_0xc810('0x37')](_0x2e6068[_0xc810('0x2c')],_0xc810('0x39'))){var _0x2a2932=_0x2e6068[_0xc810('0x2c')];var _0x11f0b6=_0x2a2932[_0xc810('0x3a')](_0x2a2932[_0xc810('0x3b')]('/')+0x1,_0x2a2932[_0xc810('0x3b')]('@'));var _0x2672eb=_[_0xc810('0x3c')](this[_0xc810('0xb')],function(_0x400c0d){return _0x400c0d[_0xc810('0x3d')]==_0x11f0b6||_0x400c0d[_0xc810('0x3e')]==_0x11f0b6||_0x400c0d[_0xc810('0x3f')]==_0x11f0b6;});if(_0x2672eb){if(_0x2672eb[_0xc810('0x2d')]!==_0x2e6068[_0xc810('0x2d')][_0xc810('0x2e')]()){_0x2672eb[_0xc810('0x32')]=_['toNumber'](moment()[_0xc810('0x27')]('x'));}_0x2672eb[_0xc810('0x2d')]=_0x2e6068[_0xc810('0x2d')][_0xc810('0x2e')]();_0x2672eb[_0xc810('0x30')]=!![];_0x2672eb[_0xc810('0x31')](_0x2e6068);}}else{}}}catch(_0x3e47fa){logger[_0xc810('0x1b')]('[syncDeviceState][UserReport]',util['inspect'](_0x3e47fa,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xc810('0x13')]=function(_0x327d8f){try{if(this['isNotNull'](_0x327d8f)&&this[_0xc810('0x1f')](_0x327d8f[_0xc810('0x12')])){if(this[_0xc810('0xb')][_0x327d8f[_0xc810('0x40')]]){if(!this[_0xc810('0xb')][_0x327d8f[_0xc810('0x40')]]['local']||_0x327d8f[_0xc810('0x12')]['toLowerCase']()==_0xc810('0x41')){this['agents'][_0x327d8f['peer']][_0xc810('0x30')]=![];this[_0xc810('0xb')][_0x327d8f[_0xc810('0x40')]]['status']=_0x327d8f[_0xc810('0x12')][_0xc810('0x2e')]();this[_0xc810('0xb')][_0x327d8f[_0xc810('0x40')]][_0xc810('0x42')]=_0x327d8f[_0xc810('0x42')];this[_0xc810('0xb')][_0x327d8f[_0xc810('0x40')]][_0xc810('0x31')](_0x327d8f);}}else if(this['telephones'][_0x327d8f[_0xc810('0x40')]]){this[_0xc810('0xc')][_0x327d8f[_0xc810('0x40')]]['status']=_0x327d8f['peerstatus'][_0xc810('0x2e')]();this[_0xc810('0xc')][_0x327d8f[_0xc810('0x40')]][_0xc810('0x42')]=_0x327d8f['address'];this[_0xc810('0x21')](util[_0xc810('0x27')](_0xc810('0x34'),this[_0xc810('0xc')][_0x327d8f[_0xc810('0x40')]][_0xc810('0x35')]),_0xc810('0x36'),this[_0xc810('0xc')][_0x327d8f['peer']]);}else if(this[_0xc810('0x22')][_0x327d8f[_0xc810('0x40')]]){this[_0xc810('0x22')][_0x327d8f[_0xc810('0x40')]]['status']=_0x327d8f[_0xc810('0x12')][_0xc810('0x2e')]();this['trunks'][_0x327d8f['peer']][_0xc810('0x42')]=_0x327d8f[_0xc810('0x42')];this[_0xc810('0x21')](util[_0xc810('0x27')]('trunk:%s',this[_0xc810('0x22')][_0x327d8f['peer']][_0xc810('0x35')]),_0xc810('0x29'),this[_0xc810('0x22')][_0x327d8f[_0xc810('0x40')]]);}else{}}}catch(_0x59c5cb){logger[_0xc810('0x1b')](_0xc810('0x43'),util['inspect'](_0x59c5cb,{'showHidden':![],'depth':null}));}};module[_0xc810('0x44')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index d32eb34..0c2597f 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 _0xa432=['lastIndexOf','[syncMusicOnHoldStop][VoiceAgentReport]','lodash','moment','util','ioredis','../../../config/environment','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','event','privilege','custom:agentcalled','user:%s','[syncAgentCalled][VoiceAgentReport]','inspect','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','membername','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','error','[syncAgentConnect][VoiceAgentReport]','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','hasOwnProperty','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentconnectAt','complete','talktime','transfer','agent','acwtime','acwTimeout','[syncAgentComplete][VoiceAgentReport]','syncVarSet','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','memberdynamic','memberlastcall','memberrealtime','isNil','includes','agentcompleteAt','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','diff','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','seconds','[syncBlindTransfer][VoiceAgentReport]','channel','substring','onhold','[syncMusicOnHoldStart][VoiceAgentReport]'];(function(_0x80adec,_0x5f133e){var _0x3231e2=function(_0x4f0003){while(--_0x4f0003){_0x80adec['push'](_0x80adec['shift']());}};_0x3231e2(++_0x5f133e);}(_0xa432,0x84));var _0x2a43=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xa432[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x2a43('0x0'));var moment=require(_0x2a43('0x1'));var util=require(_0x2a43('0x2'));var Redis=require(_0x2a43('0x3'));var config=require(_0x2a43('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0x2a43('0x5'));config[_0x2a43('0x6')]=_[_0x2a43('0x7')](config['redis'],{'host':_0x2a43('0x8'),'port':0x18eb});var io=require(_0x2a43('0x9'))(new Redis(config[_0x2a43('0x6')]));function VoiceAgentReport(_0x47e062){this[_0x2a43('0xa')]={};this[_0x2a43('0xb')]=_0x47e062[_0x2a43('0xb')];this[_0x2a43('0xc')]=_0x47e062[_0x2a43('0xc')];this[_0x2a43('0xd')]={};ami['on'](_0x2a43('0xe'),this[_0x2a43('0xf')][_0x2a43('0x10')](this));ami['on'](_0x2a43('0x11'),this[_0x2a43('0x12')][_0x2a43('0x10')](this));ami['on'](_0x2a43('0x13'),this[_0x2a43('0x14')]['bind'](this));ami['on'](_0x2a43('0x15'),this[_0x2a43('0x16')][_0x2a43('0x10')](this));ami['on'](_0x2a43('0x17'),this[_0x2a43('0x18')][_0x2a43('0x10')](this));ami['on'](_0x2a43('0x19'),this['syncVarSet']['bind'](this));ami['on']('hangup',this[_0x2a43('0x1a')][_0x2a43('0x10')](this));ami['on'](_0x2a43('0x1b'),this[_0x2a43('0x1c')][_0x2a43('0x10')](this));ami['on'](_0x2a43('0x1d'),this[_0x2a43('0x1e')][_0x2a43('0x10')](this));ami['on'](_0x2a43('0x1f'),this[_0x2a43('0x20')][_0x2a43('0x10')](this));ami['on'](_0x2a43('0x21'),this[_0x2a43('0x22')][_0x2a43('0x10')](this));}VoiceAgentReport['prototype'][_0x2a43('0x23')]=function(_0x2da567,_0xc8614b,_0x507b4a){io['to'](_0x2da567)['emit'](_0xc8614b,_0x507b4a);};VoiceAgentReport[_0x2a43('0x24')][_0x2a43('0x25')]=function(_0x2b79b3){return _0x2b79b3!==null&&!_[_0x2a43('0x26')](_0x2b79b3);};VoiceAgentReport[_0x2a43('0x24')][_0x2a43('0xf')]=function(_0x54bc47){try{if(this['isNotNull'](_0x54bc47)){if(_[_0x2a43('0x26')](this['channels'][_0x54bc47[_0x2a43('0x27')]])){this[_0x2a43('0xa')][_0x54bc47['uniqueid']]={};}if(_[_0x2a43('0x26')](this[_0x2a43('0xa')][_0x54bc47[_0x2a43('0x27')]][_0x54bc47[_0x2a43('0x28')]])){this['channels'][_0x54bc47['uniqueid']][_0x54bc47[_0x2a43('0x28')]]={'agentcalledAt':moment()[_0x2a43('0x29')](_0x2a43('0x2a')),'lastevent':_0x2a43('0x2b'),'variables':this['variables'][_0x54bc47[_0x2a43('0x27')]],'type':this['voiceQueues'][_0x54bc47[_0x2a43('0x2c')]]?this[_0x2a43('0xb')][_0x54bc47['queue']][_0x2a43('0x2d')]||_0x2a43('0x2e'):'inbound'};}_[_0x2a43('0x2f')](this['channels'][_0x54bc47[_0x2a43('0x27')]][_0x54bc47[_0x2a43('0x28')]],_[_0x2a43('0x30')](_0x54bc47,[_0x2a43('0x31'),_0x2a43('0x32')]));ami[_0x2a43('0x23')](_0x2a43('0x33'),this['channels'][_0x54bc47[_0x2a43('0x27')]][_0x54bc47[_0x2a43('0x28')]]);this[_0x2a43('0x23')](util['format'](_0x2a43('0x34'),_0x54bc47['membername']),'user:called',this[_0x2a43('0xa')][_0x54bc47['uniqueid']][_0x54bc47[_0x2a43('0x28')]]);}}catch(_0x191a1b){logger['error'](_0x2a43('0x35'),util[_0x2a43('0x36')](_0x191a1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2a43('0x24')][_0x2a43('0x12')]=function(_0x37f1f0){try{if(this['isNotNull'](_0x37f1f0)){if(this[_0x2a43('0xa')][_0x37f1f0[_0x2a43('0x27')]]){for(var _0x2e76cb in this[_0x2a43('0xa')][_0x37f1f0['uniqueid']]){if(this['channels'][_0x37f1f0[_0x2a43('0x27')]]['hasOwnProperty'](_0x2e76cb)){if(_0x37f1f0[_0x2a43('0x28')]===_0x2e76cb){this['channels'][_0x37f1f0[_0x2a43('0x27')]][_0x2e76cb]['agentconnectAt']=moment()[_0x2a43('0x29')](_0x2a43('0x2a'));this[_0x2a43('0xa')][_0x37f1f0[_0x2a43('0x27')]][_0x2e76cb][_0x2a43('0x37')]=_0x2a43('0x38');this[_0x2a43('0xa')][_0x37f1f0[_0x2a43('0x27')]][_0x2e76cb][_0x2a43('0x39')]=_0x37f1f0['holdtime'];this[_0x2a43('0xa')][_0x37f1f0['uniqueid']][_0x2e76cb][_0x2a43('0x3a')]=_0x37f1f0[_0x2a43('0x3a')];this[_0x2a43('0xa')][_0x37f1f0[_0x2a43('0x27')]][_0x2e76cb][_0x2a43('0x3b')]=_0x37f1f0[_0x2a43('0x3b')];this['channels'][_0x37f1f0[_0x2a43('0x27')]][_0x2e76cb]['destchannelstate']=_0x37f1f0[_0x2a43('0x3c')];this['channels'][_0x37f1f0['uniqueid']][_0x2e76cb][_0x2a43('0x3d')]=_0x37f1f0[_0x2a43('0x3d')];_['merge'](this['agents'][_0x37f1f0[_0x2a43('0x3e')]],_[_0x2a43('0x3f')](_0x37f1f0,['queue',_0x2a43('0x40')]));this[_0x2a43('0x23')](util['format'](_0x2a43('0x34'),_0x37f1f0[_0x2a43('0x41')]),_0x2a43('0x42'),this[_0x2a43('0xa')][_0x37f1f0[_0x2a43('0x27')]][_0x37f1f0['destuniqueid']]);ami['emit']('custom:agentconnect',this[_0x2a43('0xa')][_0x37f1f0[_0x2a43('0x27')]][_0x2e76cb]);}else if(!this[_0x2a43('0xa')][_0x37f1f0['uniqueid']][_0x2e76cb][_0x2a43('0x13')]&&!this['channels'][_0x37f1f0[_0x2a43('0x27')]][_0x2e76cb]['agentcomplete']){this[_0x2a43('0xa')][_0x37f1f0[_0x2a43('0x27')]][_0x2e76cb][_0x2a43('0x13')]=!![];this[_0x2a43('0xa')][_0x37f1f0[_0x2a43('0x27')]][_0x2e76cb][_0x2a43('0x43')]=moment()['format'](_0x2a43('0x2a'));this[_0x2a43('0xa')][_0x37f1f0[_0x2a43('0x27')]][_0x2e76cb][_0x2a43('0x44')]=_0x2a43('0x45');this[_0x2a43('0xa')][_0x37f1f0[_0x2a43('0x27')]][_0x2e76cb][_0x2a43('0x37')]=_0x2a43('0x45');this['channels'][_0x37f1f0['uniqueid']][_0x2e76cb][_0x2a43('0x46')]=_0x37f1f0['destuniqueid'];this[_0x2a43('0xa')][_0x37f1f0['uniqueid']][_0x2e76cb][_0x2a43('0x47')]=_0x37f1f0['membername'];ami[_0x2a43('0x23')](_0x2a43('0x48'),this['channels'][_0x37f1f0['uniqueid']][_0x2e76cb]);}}}}}}catch(_0x5838f9){logger[_0x2a43('0x49')](_0x2a43('0x4a'),util[_0x2a43('0x36')](_0x5838f9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2a43('0x14')]=function(_0x27f6e0){try{if(this[_0x2a43('0x25')](_0x27f6e0)){if(this['channels'][_0x27f6e0[_0x2a43('0x27')]]&&this['channels'][_0x27f6e0[_0x2a43('0x27')]][_0x27f6e0[_0x2a43('0x28')]]){this[_0x2a43('0xa')][_0x27f6e0[_0x2a43('0x27')]][_0x27f6e0[_0x2a43('0x28')]]['agentringnoanswer']=!![];this[_0x2a43('0xa')][_0x27f6e0[_0x2a43('0x27')]][_0x27f6e0[_0x2a43('0x28')]][_0x2a43('0x43')]=moment()[_0x2a43('0x29')](_0x2a43('0x2a'));this[_0x2a43('0xa')][_0x27f6e0[_0x2a43('0x27')]][_0x27f6e0['destuniqueid']][_0x2a43('0x44')]=_0x2a43('0x4b');this[_0x2a43('0xa')][_0x27f6e0['uniqueid']][_0x27f6e0[_0x2a43('0x28')]][_0x2a43('0x37')]=_0x2a43('0x4b');ami['emit'](_0x2a43('0x4c'),this[_0x2a43('0xa')][_0x27f6e0['uniqueid']][_0x27f6e0['destuniqueid']]);}}}catch(_0x61b277){logger[_0x2a43('0x49')](_0x2a43('0x4d'),util['inspect'](_0x61b277,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2a43('0x24')][_0x2a43('0x16')]=function(_0x51c457){try{if(this[_0x2a43('0x25')](_0x51c457)){if(this[_0x2a43('0xa')][_0x51c457[_0x2a43('0x27')]]){for(var _0x1d64a8 in this[_0x2a43('0xa')][_0x51c457[_0x2a43('0x27')]]){if(this[_0x2a43('0xa')][_0x51c457[_0x2a43('0x27')]][_0x2a43('0x4e')](_0x1d64a8)&&!this['channels'][_0x51c457['uniqueid']][_0x1d64a8][_0x2a43('0x13')]&&!this['channels'][_0x51c457[_0x2a43('0x27')]][_0x1d64a8]['agentcomplete']){this[_0x2a43('0xa')][_0x51c457[_0x2a43('0x27')]][_0x1d64a8][_0x2a43('0x13')]=!![];this[_0x2a43('0xa')][_0x51c457['uniqueid']][_0x1d64a8][_0x2a43('0x43')]=moment()[_0x2a43('0x29')](_0x2a43('0x2a'));this[_0x2a43('0xa')][_0x51c457['uniqueid']][_0x1d64a8][_0x2a43('0x44')]=_0x2a43('0x4f');this[_0x2a43('0xa')][_0x51c457[_0x2a43('0x27')]][_0x1d64a8][_0x2a43('0x37')]='abandoned';ami['emit'](_0x2a43('0x50'),this[_0x2a43('0xa')][_0x51c457[_0x2a43('0x27')]][_0x1d64a8]);}}}}}catch(_0x261427){logger['error'](_0x2a43('0x51'),util[_0x2a43('0x36')](_0x261427,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2a43('0x24')][_0x2a43('0x18')]=function(_0x2769ed){try{if(this[_0x2a43('0x25')](_0x2769ed)){if(this['channels'][_0x2769ed[_0x2a43('0x27')]]){for(var _0x43931a in this['channels'][_0x2769ed[_0x2a43('0x27')]]){if(this['channels'][_0x2769ed[_0x2a43('0x27')]][_0x2a43('0x4e')](_0x43931a)){if(this['channels'][_0x2769ed['uniqueid']][_0x43931a][_0x2a43('0x52')]&&!this[_0x2a43('0xa')][_0x2769ed[_0x2a43('0x27')]][_0x43931a][_0x2a43('0x17')]){this[_0x2a43('0xa')][_0x2769ed[_0x2a43('0x27')]][_0x43931a][_0x2a43('0x17')]=!![];this[_0x2a43('0xa')][_0x2769ed['uniqueid']][_0x43931a]['agentcompleteAt']=moment()[_0x2a43('0x29')](_0x2a43('0x2a'));this[_0x2a43('0xa')][_0x2769ed[_0x2a43('0x27')]][_0x43931a]['lastevent']=_0x2a43('0x53');this[_0x2a43('0xa')][_0x2769ed[_0x2a43('0x27')]][_0x43931a][_0x2a43('0x54')]=_0x2769ed['talktime'];this[_0x2a43('0xa')][_0x2769ed['uniqueid']][_0x43931a][_0x2a43('0x44')]=_0x2769ed[_0x2a43('0x44')]==_0x2a43('0x55')?_0x2a43('0x56'):_0x2769ed[_0x2a43('0x44')];if(this['voiceQueues'][_0x2769ed[_0x2a43('0x2c')]]&&this['voiceQueues'][_0x2769ed[_0x2a43('0x2c')]]['acw']){this[_0x2a43('0xa')][_0x2769ed[_0x2a43('0x27')]][_0x43931a]['agentacw']=!![];this[_0x2a43('0xa')][_0x2769ed[_0x2a43('0x27')]][_0x43931a][_0x2a43('0x57')]=this[_0x2a43('0xb')][_0x2769ed['queue']][_0x2a43('0x58')];}this['agents'][_0x2769ed[_0x2a43('0x3e')]]=_[_0x2a43('0x30')](this[_0x2a43('0xc')][_0x2769ed[_0x2a43('0x3e')]],['queue','destconnectedlinenum']);this['emit'](util[_0x2a43('0x29')]('user:%s',_0x2769ed['membername']),'user:agentcomplete',this[_0x2a43('0xa')][_0x2769ed[_0x2a43('0x27')]][_0x43931a]);ami['emit']('custom:agentcomplete',this[_0x2a43('0xa')][_0x2769ed[_0x2a43('0x27')]][_0x43931a]);}}}}}}catch(_0x40103b){logger[_0x2a43('0x49')](_0x2a43('0x59'),util[_0x2a43('0x36')](_0x40103b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2a43('0x5a')]=function(_0x47583e){try{if(this[_0x2a43('0x25')](_0x47583e)){this[_0x2a43('0x5b')](_0x47583e[_0x2a43('0x27')],_[_0x2a43('0x5c')](_0x47583e[_0x2a43('0x5d')])[0x0],_0x47583e[_0x2a43('0x5e')]);if(this[_0x2a43('0xa')][_0x47583e[_0x2a43('0x27')]]){for(var _0x668768 in this['channels'][_0x47583e[_0x2a43('0x27')]]){if(this[_0x2a43('0xa')][_0x47583e[_0x2a43('0x27')]][_0x2a43('0x4e')](_0x668768)){if(_[_0x2a43('0x26')](this[_0x2a43('0xa')][_0x47583e['uniqueid']][_0x668768][_0x2a43('0xd')])){this[_0x2a43('0xa')][_0x47583e[_0x2a43('0x27')]][_0x668768]['variables']={};}this[_0x2a43('0xa')][_0x47583e[_0x2a43('0x27')]][_0x668768][_0x2a43('0xd')]=this[_0x2a43('0xd')][_0x47583e[_0x2a43('0x27')]];}}}}}catch(_0x1d2a2b){logger[_0x2a43('0x49')](_0x2a43('0x5f'),util[_0x2a43('0x36')](_0x1d2a2b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2a43('0x24')]['addVariable']=function(_0x3dc6eb,_0xda611a,_0x163b28){var _0x51d46a=[_0x2a43('0x60'),_0x2a43('0x61'),_0x2a43('0x62'),_0x2a43('0x63'),_0x2a43('0x64'),_0x2a43('0x65'),_0x2a43('0x66'),_0x2a43('0x67'),_0x2a43('0x68'),_0x2a43('0x69'),'bridgepeer',_0x2a43('0x6a'),'membercalls',_0x2a43('0x6b'),'memberinterface',_0x2a43('0x6c'),'membername','memberpenalty',_0x2a43('0x6d')];if(!_[_0x2a43('0x6e')](_0xda611a)&&!_[_0x2a43('0x6f')](_0x51d46a,_0xda611a)){if(_[_0x2a43('0x26')](this[_0x2a43('0xd')][_0x3dc6eb])){this['variables'][_0x3dc6eb]={};}this['variables'][_0x3dc6eb][_0xda611a]=_0x163b28;}};VoiceAgentReport[_0x2a43('0x24')][_0x2a43('0x1a')]=function(_0x235f07){try{if(this[_0x2a43('0x25')](_0x235f07)){if(this[_0x2a43('0xa')][_0x235f07['uniqueid']]){for(var _0x243dbc in this['channels'][_0x235f07[_0x2a43('0x27')]]){if(this[_0x2a43('0xa')][_0x235f07[_0x2a43('0x27')]][_0x2a43('0x4e')](_0x243dbc)){if(this[_0x2a43('0xa')][_0x235f07[_0x2a43('0x27')]][_0x243dbc]['reason']=='transfer'&&this[_0x2a43('0xa')][_0x235f07[_0x2a43('0x27')]][_0x243dbc][_0x2a43('0x17')]){this[_0x2a43('0xa')][_0x235f07[_0x2a43('0x27')]][_0x243dbc][_0x2a43('0x70')]=moment()[_0x2a43('0x29')](_0x2a43('0x2a'));}}}ami['emit'](_0x2a43('0x71'),_[_0x2a43('0x72')](this[_0x2a43('0xa')][_0x235f07[_0x2a43('0x27')]]));delete this[_0x2a43('0xa')][_0x235f07[_0x2a43('0x27')]];}if(this['variables'][_0x235f07[_0x2a43('0x27')]]){delete this[_0x2a43('0xd')][_0x235f07['uniqueid']];}}}catch(_0x401366){logger[_0x2a43('0x49')](_0x2a43('0x73'),util[_0x2a43('0x36')](_0x401366,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2a43('0x24')]['syncAttendedTransfer']=function(_0x3235c8){try{if(this[_0x2a43('0x25')](_0x3235c8)){if(this[_0x2a43('0xa')][_0x3235c8[_0x2a43('0x74')]]){for(var _0x490aca in this['channels'][_0x3235c8[_0x2a43('0x74')]]){if(this['channels'][_0x3235c8['transfereeuniqueid']][_0x2a43('0x4e')](_0x490aca)){if(_0x3235c8[_0x2a43('0x75')]===_0x490aca){var _0x1059e7=moment();this[_0x2a43('0xa')][_0x3235c8[_0x2a43('0x74')]][_0x490aca]['agentcomplete']=!![];this['channels'][_0x3235c8['transfereeuniqueid']][_0x490aca]['agentcompleteAt']=moment()[_0x2a43('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2a43('0xa')][_0x3235c8[_0x2a43('0x74')]][_0x490aca]['reason']='transfer';this[_0x2a43('0xa')][_0x3235c8['transfereeuniqueid']][_0x490aca]['lastevent']=_0x2a43('0x53');this[_0x2a43('0xa')][_0x3235c8[_0x2a43('0x74')]][_0x490aca][_0x2a43('0x54')]=_0x1059e7[_0x2a43('0x76')](this[_0x2a43('0xa')][_0x3235c8['transfereeuniqueid']][_0x490aca][_0x2a43('0x52')],'seconds');}}}}if(this[_0x2a43('0xa')][_0x3235c8[_0x2a43('0x77')]]){var _0x3c16fa=this['channels'][_0x3235c8[_0x2a43('0x77')]];this[_0x2a43('0xa')][_0x3235c8[_0x2a43('0x77')]]=this['channels'][_0x3235c8[_0x2a43('0x74')]];this[_0x2a43('0xa')][_0x3235c8[_0x2a43('0x74')]]=_0x3c16fa;}}}catch(_0x531743){logger[_0x2a43('0x49')](_0x2a43('0x78'),util['inspect'](_0x531743,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2a43('0x24')][_0x2a43('0x22')]=function(_0xf3729){try{if(this[_0x2a43('0x25')](_0xf3729)){if(this['channels'][_0xf3729[_0x2a43('0x74')]]){for(var _0x212712 in this[_0x2a43('0xa')][_0xf3729[_0x2a43('0x74')]]){if(this[_0x2a43('0xa')][_0xf3729[_0x2a43('0x74')]]['hasOwnProperty'](_0x212712)){if(_0xf3729[_0x2a43('0x79')]===_0x212712){var _0x14f5bb=moment();this[_0x2a43('0xa')][_0xf3729[_0x2a43('0x74')]][_0x212712]['agentcomplete']=!![];this[_0x2a43('0xa')][_0xf3729[_0x2a43('0x74')]][_0x212712][_0x2a43('0x70')]=_0x14f5bb;this[_0x2a43('0xa')][_0xf3729[_0x2a43('0x74')]][_0x212712][_0x2a43('0x44')]=_0x2a43('0x55');this[_0x2a43('0xa')][_0xf3729[_0x2a43('0x74')]][_0x212712][_0x2a43('0x37')]=_0x2a43('0x53');this[_0x2a43('0xa')][_0xf3729[_0x2a43('0x74')]][_0x212712][_0x2a43('0x54')]=_0x14f5bb[_0x2a43('0x76')](this[_0x2a43('0xa')][_0xf3729[_0x2a43('0x74')]][_0x212712]['agentconnectAt'],_0x2a43('0x7a'));}}}}}}catch(_0x3774a0){logger['error'](_0x2a43('0x7b'),util[_0x2a43('0x36')](_0x3774a0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2a43('0x24')][_0x2a43('0x1c')]=function(_0x278017){var _0x31e42d='';try{if(this['isNotNull'](_0x278017)){if(_0x278017[_0x2a43('0x7c')]){_0x31e42d=_0x278017[_0x2a43('0x7c')][_0x2a43('0x7d')](0x0,_0x278017[_0x2a43('0x7c')]['lastIndexOf']('-'));if(this[_0x2a43('0xc')][_0x31e42d]){this[_0x2a43('0xc')][_0x31e42d][_0x2a43('0x7e')]=!![];}}}}catch(_0x1f514a){logger[_0x2a43('0x49')](_0x2a43('0x7f'),util[_0x2a43('0x36')](_0x1f514a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2a43('0x1e')]=function(_0x27b2a7){var _0x35436b='';try{if(this[_0x2a43('0x25')](_0x27b2a7)){if(_0x27b2a7[_0x2a43('0x7c')]){_0x35436b=_0x27b2a7['channel'][_0x2a43('0x7d')](0x0,_0x27b2a7[_0x2a43('0x7c')][_0x2a43('0x80')]('-'));if(this[_0x2a43('0xc')][_0x35436b]){this['agents'][_0x35436b][_0x2a43('0x7e')]=![];}}}}catch(_0x2e08ac){logger[_0x2a43('0x49')](_0x2a43('0x81'),util[_0x2a43('0x36')](_0x2e08ac,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x9717=['type','inbound','omit','privilege','custom:agentcalled','format','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','complete','talktime','transfer','agent','agentacw','acwtime','user:agentcomplete','addVariable','keys','variable','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','sipuri','bridgepeer','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','custom:voiceAgentReport','[syncHangup][VoiceAgentReport]','transfereeuniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','[syncBlindTransfer][VoiceAgentReport]','channel','substring','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','channels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','variables','queue'];(function(_0x20ea55,_0x17d021){var _0x44c458=function(_0x395cbf){while(--_0x395cbf){_0x20ea55['push'](_0x20ea55['shift']());}};_0x44c458(++_0x17d021);}(_0x9717,0x1a5));var _0x7971=function(_0x581708,_0x55970c){_0x581708=_0x581708-0x0;var _0x378653=_0x9717[_0x581708];return _0x378653;};'use strict';var _=require(_0x7971('0x0'));var moment=require(_0x7971('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x7971('0x2'));var logger=require(_0x7971('0x3'))(_0x7971('0x4'));var ami=require(_0x7971('0x5'));config['redis']=_[_0x7971('0x6')](config[_0x7971('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x5b8785){this[_0x7971('0x8')]={};this[_0x7971('0x9')]=_0x5b8785['voiceQueues'];this[_0x7971('0xa')]=_0x5b8785['agents'];this['variables']={};ami['on'](_0x7971('0xb'),this[_0x7971('0xc')][_0x7971('0xd')](this));ami['on'](_0x7971('0xe'),this[_0x7971('0xf')][_0x7971('0xd')](this));ami['on'](_0x7971('0x10'),this[_0x7971('0x11')][_0x7971('0xd')](this));ami['on'](_0x7971('0x12'),this[_0x7971('0x13')]['bind'](this));ami['on'](_0x7971('0x14'),this[_0x7971('0x15')][_0x7971('0xd')](this));ami['on'](_0x7971('0x16'),this[_0x7971('0x17')][_0x7971('0xd')](this));ami['on'](_0x7971('0x18'),this[_0x7971('0x19')][_0x7971('0xd')](this));ami['on'](_0x7971('0x1a'),this[_0x7971('0x1b')]['bind'](this));ami['on']('musiconholdstop',this[_0x7971('0x1c')][_0x7971('0xd')](this));ami['on'](_0x7971('0x1d'),this[_0x7971('0x1e')][_0x7971('0xd')](this));ami['on'](_0x7971('0x1f'),this[_0x7971('0x20')][_0x7971('0xd')](this));}VoiceAgentReport[_0x7971('0x21')][_0x7971('0x22')]=function(_0x4c6a5a,_0x14487f,_0x106cb3){io['to'](_0x4c6a5a)[_0x7971('0x22')](_0x14487f,_0x106cb3);};VoiceAgentReport[_0x7971('0x21')][_0x7971('0x23')]=function(_0x31f8be){return _0x31f8be!==null&&!_[_0x7971('0x24')](_0x31f8be);};VoiceAgentReport[_0x7971('0x21')][_0x7971('0xc')]=function(_0x33f039){try{if(this['isNotNull'](_0x33f039)){if(_[_0x7971('0x24')](this[_0x7971('0x8')][_0x33f039[_0x7971('0x25')]])){this[_0x7971('0x8')][_0x33f039[_0x7971('0x25')]]={};}if(_[_0x7971('0x24')](this[_0x7971('0x8')][_0x33f039[_0x7971('0x25')]][_0x33f039[_0x7971('0x26')]])){this[_0x7971('0x8')][_0x33f039['uniqueid']][_0x33f039[_0x7971('0x26')]]={'agentcalledAt':moment()['format'](_0x7971('0x27')),'lastevent':_0x7971('0x28'),'variables':this[_0x7971('0x29')][_0x33f039['uniqueid']],'type':this['voiceQueues'][_0x33f039[_0x7971('0x2a')]]?this[_0x7971('0x9')][_0x33f039[_0x7971('0x2a')]][_0x7971('0x2b')]||_0x7971('0x2c'):_0x7971('0x2c')};}_['merge'](this[_0x7971('0x8')][_0x33f039[_0x7971('0x25')]][_0x33f039[_0x7971('0x26')]],_[_0x7971('0x2d')](_0x33f039,['event',_0x7971('0x2e')]));ami[_0x7971('0x22')](_0x7971('0x2f'),this[_0x7971('0x8')][_0x33f039[_0x7971('0x25')]][_0x33f039[_0x7971('0x26')]]);this['emit'](util[_0x7971('0x30')](_0x7971('0x31'),_0x33f039[_0x7971('0x32')]),_0x7971('0x33'),this[_0x7971('0x8')][_0x33f039['uniqueid']][_0x33f039['destuniqueid']]);}}catch(_0x3c32cc){logger[_0x7971('0x34')](_0x7971('0x35'),util[_0x7971('0x36')](_0x3c32cc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7971('0x21')]['syncAgentConnect']=function(_0x53a42d){try{if(this[_0x7971('0x23')](_0x53a42d)){if(this[_0x7971('0x8')][_0x53a42d['uniqueid']]){for(var _0x7da162 in this[_0x7971('0x8')][_0x53a42d['uniqueid']]){if(this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7971('0x37')](_0x7da162)){if(_0x53a42d[_0x7971('0x26')]===_0x7da162){this['channels'][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x38')]=moment()[_0x7971('0x30')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x39')]=_0x7971('0x3a');this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x3b')]=_0x53a42d[_0x7971('0x3b')];this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x3c')]=_0x53a42d['connectedlinenum'];this['channels'][_0x53a42d[_0x7971('0x25')]][_0x7da162]['connectedlinename']=_0x53a42d[_0x7971('0x3d')];this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162]['destchannelstate']=_0x53a42d[_0x7971('0x3e')];this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x3f')]=_0x53a42d[_0x7971('0x3f')];_['merge'](this[_0x7971('0xa')][_0x53a42d[_0x7971('0x40')]],_[_0x7971('0x41')](_0x53a42d,['queue',_0x7971('0x42')]));this['emit'](util[_0x7971('0x30')](_0x7971('0x31'),_0x53a42d[_0x7971('0x32')]),_0x7971('0x43'),this['channels'][_0x53a42d[_0x7971('0x25')]][_0x53a42d[_0x7971('0x26')]]);ami[_0x7971('0x22')]('custom:agentconnect',this['channels'][_0x53a42d['uniqueid']][_0x7da162]);}else if(!this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x10')]&&!this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162]['agentcomplete']){this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x10')]=!![];this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x44')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x45')]=_0x7971('0x46');this[_0x7971('0x8')][_0x53a42d['uniqueid']][_0x7da162]['lastevent']=_0x7971('0x46');this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x47')]=_0x53a42d['destuniqueid'];this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x48')]=_0x53a42d[_0x7971('0x32')];ami[_0x7971('0x22')](_0x7971('0x49'),this['channels'][_0x53a42d[_0x7971('0x25')]][_0x7da162]);}}}}}}catch(_0xbc1840){logger[_0x7971('0x34')]('[syncAgentConnect][VoiceAgentReport]',util[_0x7971('0x36')](_0xbc1840,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7971('0x21')][_0x7971('0x11')]=function(_0x239114){try{if(this[_0x7971('0x23')](_0x239114)){if(this[_0x7971('0x8')][_0x239114['uniqueid']]&&this['channels'][_0x239114[_0x7971('0x25')]][_0x239114[_0x7971('0x26')]]){this['channels'][_0x239114['uniqueid']][_0x239114[_0x7971('0x26')]][_0x7971('0x10')]=!![];this[_0x7971('0x8')][_0x239114[_0x7971('0x25')]][_0x239114[_0x7971('0x26')]]['agentringnoanswerAt']=moment()['format'](_0x7971('0x27'));this[_0x7971('0x8')][_0x239114[_0x7971('0x25')]][_0x239114[_0x7971('0x26')]][_0x7971('0x45')]=_0x7971('0x4a');this[_0x7971('0x8')][_0x239114['uniqueid']][_0x239114['destuniqueid']][_0x7971('0x39')]=_0x7971('0x4a');ami[_0x7971('0x22')](_0x7971('0x4b'),this[_0x7971('0x8')][_0x239114['uniqueid']][_0x239114[_0x7971('0x26')]]);}}}catch(_0x566a83){logger[_0x7971('0x34')](_0x7971('0x4c'),util['inspect'](_0x566a83,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0x1f4f67){try{if(this[_0x7971('0x23')](_0x1f4f67)){if(this['channels'][_0x1f4f67[_0x7971('0x25')]]){for(var _0xfdd705 in this['channels'][_0x1f4f67['uniqueid']]){if(this[_0x7971('0x8')][_0x1f4f67[_0x7971('0x25')]]['hasOwnProperty'](_0xfdd705)&&!this['channels'][_0x1f4f67[_0x7971('0x25')]][_0xfdd705]['agentringnoanswer']&&!this['channels'][_0x1f4f67[_0x7971('0x25')]][_0xfdd705][_0x7971('0x14')]){this[_0x7971('0x8')][_0x1f4f67[_0x7971('0x25')]][_0xfdd705][_0x7971('0x10')]=!![];this[_0x7971('0x8')][_0x1f4f67[_0x7971('0x25')]][_0xfdd705]['agentringnoanswerAt']=moment()[_0x7971('0x30')](_0x7971('0x27'));this[_0x7971('0x8')][_0x1f4f67[_0x7971('0x25')]][_0xfdd705]['reason']=_0x7971('0x4d');this[_0x7971('0x8')][_0x1f4f67[_0x7971('0x25')]][_0xfdd705][_0x7971('0x39')]=_0x7971('0x4d');ami[_0x7971('0x22')](_0x7971('0x4e'),this[_0x7971('0x8')][_0x1f4f67[_0x7971('0x25')]][_0xfdd705]);}}}}}catch(_0x21b55c){logger['error'](_0x7971('0x4f'),util[_0x7971('0x36')](_0x21b55c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7971('0x21')]['syncAgentComplete']=function(_0x1fe770){try{if(this[_0x7971('0x23')](_0x1fe770)){if(this[_0x7971('0x8')][_0x1fe770[_0x7971('0x25')]]){for(var _0x212b10 in this['channels'][_0x1fe770[_0x7971('0x25')]]){if(this[_0x7971('0x8')][_0x1fe770[_0x7971('0x25')]][_0x7971('0x37')](_0x212b10)){if(this[_0x7971('0x8')][_0x1fe770[_0x7971('0x25')]][_0x212b10][_0x7971('0x38')]&&!this[_0x7971('0x8')][_0x1fe770['uniqueid']][_0x212b10][_0x7971('0x14')]){this[_0x7971('0x8')][_0x1fe770[_0x7971('0x25')]][_0x212b10][_0x7971('0x14')]=!![];this['channels'][_0x1fe770[_0x7971('0x25')]][_0x212b10][_0x7971('0x50')]=moment()[_0x7971('0x30')](_0x7971('0x27'));this[_0x7971('0x8')][_0x1fe770[_0x7971('0x25')]][_0x212b10][_0x7971('0x39')]=_0x7971('0x51');this[_0x7971('0x8')][_0x1fe770['uniqueid']][_0x212b10][_0x7971('0x52')]=_0x1fe770[_0x7971('0x52')];this['channels'][_0x1fe770['uniqueid']][_0x212b10][_0x7971('0x45')]=_0x1fe770[_0x7971('0x45')]==_0x7971('0x53')?_0x7971('0x54'):_0x1fe770['reason'];if(this['voiceQueues'][_0x1fe770[_0x7971('0x2a')]]&&this[_0x7971('0x9')][_0x1fe770['queue']]['acw']){this[_0x7971('0x8')][_0x1fe770[_0x7971('0x25')]][_0x212b10][_0x7971('0x55')]=!![];this[_0x7971('0x8')][_0x1fe770[_0x7971('0x25')]][_0x212b10][_0x7971('0x56')]=this[_0x7971('0x9')][_0x1fe770['queue']]['acwTimeout'];}this['agents'][_0x1fe770[_0x7971('0x40')]]=_['omit'](this[_0x7971('0xa')][_0x1fe770['interface']],['queue',_0x7971('0x42')]);this[_0x7971('0x22')](util[_0x7971('0x30')](_0x7971('0x31'),_0x1fe770[_0x7971('0x32')]),_0x7971('0x57'),this[_0x7971('0x8')][_0x1fe770['uniqueid']][_0x212b10]);ami[_0x7971('0x22')]('custom:agentcomplete',this[_0x7971('0x8')][_0x1fe770[_0x7971('0x25')]][_0x212b10]);}}}}}}catch(_0x5920f4){logger[_0x7971('0x34')]('[syncAgentComplete][VoiceAgentReport]',util[_0x7971('0x36')](_0x5920f4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7971('0x21')][_0x7971('0x17')]=function(_0x3ec45e){try{if(this[_0x7971('0x23')](_0x3ec45e)){this[_0x7971('0x58')](_0x3ec45e[_0x7971('0x25')],_[_0x7971('0x59')](_0x3ec45e[_0x7971('0x5a')])[0x0],_0x3ec45e['value']);if(this['channels'][_0x3ec45e[_0x7971('0x25')]]){for(var _0x1e1c12 in this[_0x7971('0x8')][_0x3ec45e[_0x7971('0x25')]]){if(this[_0x7971('0x8')][_0x3ec45e[_0x7971('0x25')]][_0x7971('0x37')](_0x1e1c12)){if(_['isUndefined'](this[_0x7971('0x8')][_0x3ec45e[_0x7971('0x25')]][_0x1e1c12][_0x7971('0x29')])){this['channels'][_0x3ec45e[_0x7971('0x25')]][_0x1e1c12]['variables']={};}this[_0x7971('0x8')][_0x3ec45e[_0x7971('0x25')]][_0x1e1c12][_0x7971('0x29')]=this[_0x7971('0x29')][_0x3ec45e[_0x7971('0x25')]];}}}}}catch(_0x4a146b){logger[_0x7971('0x34')]('[syncVarSet][VoiceAgentReport]',util['inspect'](_0x4a146b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7971('0x21')][_0x7971('0x58')]=function(_0xced0f2,_0x221f1f,_0x3c45eb){var _0x45f226=['rtpaudioqos',_0x7971('0x5b'),'rtpaudioqosjitter',_0x7971('0x5c'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0x7971('0x5d'),'sipcallid',_0x7971('0x5e'),_0x7971('0x5f'),'bridgepvtcallid','membercalls',_0x7971('0x60'),_0x7971('0x61'),_0x7971('0x62'),_0x7971('0x32'),'memberpenalty',_0x7971('0x63')];if(!_[_0x7971('0x64')](_0x221f1f)&&!_[_0x7971('0x65')](_0x45f226,_0x221f1f)){if(_['isUndefined'](this['variables'][_0xced0f2])){this[_0x7971('0x29')][_0xced0f2]={};}this[_0x7971('0x29')][_0xced0f2][_0x221f1f]=_0x3c45eb;}};VoiceAgentReport[_0x7971('0x21')][_0x7971('0x19')]=function(_0x2643f3){try{if(this[_0x7971('0x23')](_0x2643f3)){if(this[_0x7971('0x8')][_0x2643f3[_0x7971('0x25')]]){for(var _0x13b0e8 in this['channels'][_0x2643f3[_0x7971('0x25')]]){if(this[_0x7971('0x8')][_0x2643f3[_0x7971('0x25')]][_0x7971('0x37')](_0x13b0e8)){if(this['channels'][_0x2643f3[_0x7971('0x25')]][_0x13b0e8]['reason']==_0x7971('0x53')&&this[_0x7971('0x8')][_0x2643f3[_0x7971('0x25')]][_0x13b0e8][_0x7971('0x14')]){this['channels'][_0x2643f3[_0x7971('0x25')]][_0x13b0e8][_0x7971('0x50')]=moment()[_0x7971('0x30')](_0x7971('0x27'));}}}ami[_0x7971('0x22')](_0x7971('0x66'),_['values'](this[_0x7971('0x8')][_0x2643f3[_0x7971('0x25')]]));delete this['channels'][_0x2643f3[_0x7971('0x25')]];}if(this['variables'][_0x2643f3['uniqueid']]){delete this[_0x7971('0x29')][_0x2643f3[_0x7971('0x25')]];}}}catch(_0x58fa55){logger['error'](_0x7971('0x67'),util[_0x7971('0x36')](_0x58fa55,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7971('0x21')][_0x7971('0x1e')]=function(_0x1acae4){try{if(this['isNotNull'](_0x1acae4)){if(this[_0x7971('0x8')][_0x1acae4['transfereeuniqueid']]){for(var _0x685fb5 in this['channels'][_0x1acae4[_0x7971('0x68')]]){if(this[_0x7971('0x8')][_0x1acae4[_0x7971('0x68')]]['hasOwnProperty'](_0x685fb5)){if(_0x1acae4['origtransfereruniqueid']===_0x685fb5){var _0x20158b=moment();this[_0x7971('0x8')][_0x1acae4[_0x7971('0x68')]][_0x685fb5][_0x7971('0x14')]=!![];this[_0x7971('0x8')][_0x1acae4[_0x7971('0x68')]][_0x685fb5][_0x7971('0x50')]=moment()['format'](_0x7971('0x27'));this[_0x7971('0x8')][_0x1acae4[_0x7971('0x68')]][_0x685fb5][_0x7971('0x45')]=_0x7971('0x53');this['channels'][_0x1acae4[_0x7971('0x68')]][_0x685fb5][_0x7971('0x39')]=_0x7971('0x51');this[_0x7971('0x8')][_0x1acae4['transfereeuniqueid']][_0x685fb5][_0x7971('0x52')]=_0x20158b[_0x7971('0x69')](this[_0x7971('0x8')][_0x1acae4[_0x7971('0x68')]][_0x685fb5][_0x7971('0x38')],_0x7971('0x6a'));}}}}if(this[_0x7971('0x8')][_0x1acae4[_0x7971('0x6b')]]){var _0x461729=this[_0x7971('0x8')][_0x1acae4[_0x7971('0x6b')]];this[_0x7971('0x8')][_0x1acae4[_0x7971('0x6b')]]=this[_0x7971('0x8')][_0x1acae4['transfereeuniqueid']];this[_0x7971('0x8')][_0x1acae4[_0x7971('0x68')]]=_0x461729;}}}catch(_0x72278e){logger[_0x7971('0x34')](_0x7971('0x6c'),util['inspect'](_0x72278e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7971('0x21')][_0x7971('0x20')]=function(_0x218391){try{if(this[_0x7971('0x23')](_0x218391)){if(this['channels'][_0x218391['transfereeuniqueid']]){for(var _0x52bb6d in this[_0x7971('0x8')][_0x218391[_0x7971('0x68')]]){if(this[_0x7971('0x8')][_0x218391[_0x7971('0x68')]]['hasOwnProperty'](_0x52bb6d)){if(_0x218391['transfereruniqueid']===_0x52bb6d){var _0x5669ac=moment();this['channels'][_0x218391[_0x7971('0x68')]][_0x52bb6d][_0x7971('0x14')]=!![];this['channels'][_0x218391[_0x7971('0x68')]][_0x52bb6d][_0x7971('0x50')]=_0x5669ac;this[_0x7971('0x8')][_0x218391[_0x7971('0x68')]][_0x52bb6d][_0x7971('0x45')]=_0x7971('0x53');this[_0x7971('0x8')][_0x218391[_0x7971('0x68')]][_0x52bb6d][_0x7971('0x39')]='complete';this[_0x7971('0x8')][_0x218391['transfereeuniqueid']][_0x52bb6d][_0x7971('0x52')]=_0x5669ac['diff'](this[_0x7971('0x8')][_0x218391[_0x7971('0x68')]][_0x52bb6d]['agentconnectAt'],_0x7971('0x6a'));}}}}}}catch(_0x5613dc){logger['error'](_0x7971('0x6d'),util[_0x7971('0x36')](_0x5613dc,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7971('0x1b')]=function(_0x569bb3){var _0x52938c='';try{if(this[_0x7971('0x23')](_0x569bb3)){if(_0x569bb3[_0x7971('0x6e')]){_0x52938c=_0x569bb3[_0x7971('0x6e')][_0x7971('0x6f')](0x0,_0x569bb3[_0x7971('0x6e')]['lastIndexOf']('-'));if(this['agents'][_0x52938c]){this['agents'][_0x52938c][_0x7971('0x70')]=!![];}}}}catch(_0x5955c4){logger['error'](_0x7971('0x71'),util[_0x7971('0x36')](_0x5955c4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7971('0x21')][_0x7971('0x1c')]=function(_0x2d5dd9){var _0x5481dc='';try{if(this[_0x7971('0x23')](_0x2d5dd9)){if(_0x2d5dd9[_0x7971('0x6e')]){_0x5481dc=_0x2d5dd9['channel'][_0x7971('0x6f')](0x0,_0x2d5dd9[_0x7971('0x6e')]['lastIndexOf']('-'));if(this[_0x7971('0xa')][_0x5481dc]){this[_0x7971('0xa')][_0x5481dc][_0x7971('0x70')]=![];}}}}catch(_0x255a20){logger[_0x7971('0x34')](_0x7971('0x72'),util[_0x7971('0x36')](_0x255a20,{'showHidden':![],'depth':null}));}};module[_0x7971('0x73')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 4296ecb..42f15c0 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 _0x8d5b=['then','actionCoreShowChannels','catch','log','isNotNull','isUndefined','emit','prototype','syncNewCallerId','uniqueid','linkedid','channels','pick','keys','channel','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','merge','context','split','destconnectedlinenum','exten','format','name','user:agentconnect','error','inspect','application','applicationdata','appdata','duration','subtract','seconds','disposition','includes','lastdata','cdr(','match','[syncNewExten][VoiceCallReport]','syncNewState','answered','holdtime','diff','xcally-motion-preview','connectedlinenum','calleridnum','connectedlinename','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','variable','mixmonitor_filename','xmd-phone','xmd-callerid','xmd-cdrtype','type','value','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','parse','sipcallid','[syncVarSet][VoiceCallReport]','endtime','billableseconds','answertime','from-sip','user:agentcomplete','accountcode','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','ami','unknown','inuse','busy','invalid','ringing','ringinuse','onhold','set','queue','dial','voicemail','NO\x20ANSWER','FAILED','BUSY','localhost','socket.io-emitter','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve'];(function(_0x2f1a30,_0x75bad6){var _0x410238=function(_0x21a58b){while(--_0x21a58b){_0x2f1a30['push'](_0x2f1a30['shift']());}};_0x410238(++_0x75bad6);}(_0x8d5b,0x102));var _0xb8d5=function(_0x4b89d9,_0x3a4a59){_0x4b89d9=_0x4b89d9-0x0;var _0x5648ac=_0x8d5b[_0x4b89d9];return _0x5648ac;};'use strict';var BPromise=require(_0xb8d5('0x0'));var _=require(_0xb8d5('0x1'));var moment=require(_0xb8d5('0x2'));var util=require(_0xb8d5('0x3'));var path=require('path');var Redis=require('ioredis');var config=require(_0xb8d5('0x4'));var logger=require(_0xb8d5('0x5'))(_0xb8d5('0x6'));var ami=require('../ami');var Channel=require('../model/channel');var statusDesc=[_0xb8d5('0x7'),'not_inuse',_0xb8d5('0x8'),_0xb8d5('0x9'),_0xb8d5('0xa'),'unavailable',_0xb8d5('0xb'),_0xb8d5('0xc'),_0xb8d5('0xd')];var applications=[_0xb8d5('0xe'),_0xb8d5('0xf'),'agi',_0xb8d5('0x10'),'playback',_0xb8d5('0x11')];var dispositions=[_0xb8d5('0x12'),_0xb8d5('0x13'),_0xb8d5('0x13'),_0xb8d5('0x12'),_0xb8d5('0x12'),_0xb8d5('0x12'),'ANSWERED',_0xb8d5('0x14'),_0xb8d5('0x13'),_0xb8d5('0x13'),_0xb8d5('0x13')];var actions={};config['redis']=_['defaults'](config['redis'],{'host':_0xb8d5('0x15'),'port':0x18eb});var io=require(_0xb8d5('0x16'))(new Redis(config['redis']));function VoiceCallReport(_0x3263d3){this['channels']=_0x3263d3['channels'];this[_0xb8d5('0x17')]=_0x3263d3[_0xb8d5('0x17')];ami['on'](_0xb8d5('0x18'),this[_0xb8d5('0x19')][_0xb8d5('0x1a')](this));ami['on'](_0xb8d5('0x1b'),this[_0xb8d5('0x19')]['bind'](this));ami['on'](_0xb8d5('0x1c'),this[_0xb8d5('0x1d')][_0xb8d5('0x1a')](this));ami['on'](_0xb8d5('0x1e'),this['syncNewState'][_0xb8d5('0x1a')](this));ami['on'](_0xb8d5('0x1f'),this[_0xb8d5('0x20')]['bind'](this));ami['on'](_0xb8d5('0x21'),this[_0xb8d5('0x22')][_0xb8d5('0x1a')](this));ami['on']('newcallerid',this['syncNewCallerId']['bind'](this));ami['on'](_0xb8d5('0x23'),this[_0xb8d5('0x24')][_0xb8d5('0x1a')](this));ami['on'](_0xb8d5('0x25'),this[_0xb8d5('0x26')][_0xb8d5('0x1a')](this));ami['on'](_0xb8d5('0x27'),this[_0xb8d5('0x28')][_0xb8d5('0x1a')](this));ami['on'](_0xb8d5('0x29'),this[_0xb8d5('0x2a')][_0xb8d5('0x1a')](this));return BPromise[_0xb8d5('0x2b')]()[_0xb8d5('0x2c')](ami[_0xb8d5('0x2d')]())[_0xb8d5('0x2e')](function(_0x41faec){console[_0xb8d5('0x2f')](_0x41faec);});}VoiceCallReport['prototype'][_0xb8d5('0x30')]=function(_0x113d01){return _0x113d01!==null&&!_[_0xb8d5('0x31')](_0x113d01);};VoiceCallReport['prototype'][_0xb8d5('0x32')]=function(_0x577512,_0x771cea,_0x4dc696){io['to'](_0x577512)[_0xb8d5('0x32')](_0x771cea,_0x4dc696);};VoiceCallReport[_0xb8d5('0x33')][_0xb8d5('0x34')]=function(_0x4cef0b){try{if(this['isNotNull'](_0x4cef0b)){if(_0x4cef0b[_0xb8d5('0x35')]===_0x4cef0b[_0xb8d5('0x36')]){if(!_['isUndefined'](this[_0xb8d5('0x37')][_0x4cef0b[_0xb8d5('0x35')]])){_['merge'](this[_0xb8d5('0x37')][_0x4cef0b[_0xb8d5('0x35')]],_[_0xb8d5('0x38')](_0x4cef0b,_[_0xb8d5('0x39')](this[_0xb8d5('0x37')][_0x4cef0b[_0xb8d5('0x35')]])));}}}}catch(_0x57bdcf){logger['error']('[syncNewCallerId][VoiceCallReport]',util['inspect'](_0x57bdcf,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xb8d5('0x1d')]=function(_0x194952){try{if(this[_0xb8d5('0x30')](_0x194952)){if(_0x194952[_0xb8d5('0x35')]===_0x194952['linkedid']&&_0x194952[_0xb8d5('0x3a')]!=_0xb8d5('0x3b')){if(_[_0xb8d5('0x31')](this[_0xb8d5('0x37')][_0x194952['uniqueid']])){this[_0xb8d5('0x37')][_0x194952['uniqueid']]=new Channel();this[_0xb8d5('0x37')][_0x194952[_0xb8d5('0x35')]][_0xb8d5('0x3c')]=moment()['format'](_0xb8d5('0x3d'));this[_0xb8d5('0x37')][_0x194952['uniqueid']]['disposition']=dispositions[_[_0xb8d5('0x3e')](_0x194952[_0xb8d5('0x3f')])];_[_0xb8d5('0x40')](this[_0xb8d5('0x37')][_0x194952[_0xb8d5('0x35')]],_[_0xb8d5('0x38')](_0x194952,_['keys'](this[_0xb8d5('0x37')][_0x194952[_0xb8d5('0x35')]])));if(_0x194952[_0xb8d5('0x41')]==='from-sip'){if(this[_0xb8d5('0x17')][_0x194952[_0xb8d5('0x3a')][_0xb8d5('0x42')]('-')[0x0]]){this[_0xb8d5('0x17')][_0x194952[_0xb8d5('0x3a')][_0xb8d5('0x42')]('-')[0x0]][_0xb8d5('0x43')]=_0x194952[_0xb8d5('0x44')];this[_0xb8d5('0x32')](util[_0xb8d5('0x45')]('user:%s',this[_0xb8d5('0x17')][_0x194952[_0xb8d5('0x3a')][_0xb8d5('0x42')]('-')[0x0]][_0xb8d5('0x46')]),_0xb8d5('0x47'),{'destaccountcode':this['agents'][_0x194952[_0xb8d5('0x3a')][_0xb8d5('0x42')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x194952[_0xb8d5('0x44')]});}}}}}}catch(_0x6ffb35){logger[_0xb8d5('0x48')]('[syncNewChannel][VoiceCallReport]',util[_0xb8d5('0x49')](_0x6ffb35,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb8d5('0x33')][_0xb8d5('0x19')]=function(_0xae1494){try{if(this[_0xb8d5('0x30')](_0xae1494)){if(_0xae1494[_0xb8d5('0x35')]===_0xae1494[_0xb8d5('0x36')]&&_0xae1494[_0xb8d5('0x44')]!='h'&&_0xae1494[_0xb8d5('0x3a')]!='OutgoingSpoolFailed'){_0xae1494[_0xb8d5('0x4a')]=_0xae1494[_0xb8d5('0x4a')]['toLowerCase']();_0xae1494[_0xb8d5('0x4b')]=(_0xae1494[_0xb8d5('0x4c')]||_0xae1494['applicationdata'])['toLowerCase']();if(_[_0xb8d5('0x31')](this[_0xb8d5('0x37')][_0xae1494[_0xb8d5('0x35')]])){this[_0xb8d5('0x37')][_0xae1494[_0xb8d5('0x35')]]=new Channel();this[_0xb8d5('0x37')][_0xae1494[_0xb8d5('0x35')]][_0xb8d5('0x3c')]=_0xae1494[_0xb8d5('0x4d')]?moment()[_0xb8d5('0x4e')](moment[_0xb8d5('0x4d')](_0xae1494[_0xb8d5('0x4d')])[_0xb8d5('0x4f')](),_0xb8d5('0x4f'))[_0xb8d5('0x45')](_0xb8d5('0x3d')):moment()[_0xb8d5('0x45')](_0xb8d5('0x3d'));this['channels'][_0xae1494[_0xb8d5('0x35')]][_0xb8d5('0x50')]=_0xb8d5('0x12');}_[_0xb8d5('0x40')](this['channels'][_0xae1494[_0xb8d5('0x35')]],_[_0xb8d5('0x38')](_0xae1494,_['keys'](this['channels'][_0xae1494[_0xb8d5('0x35')]])));if(_[_0xb8d5('0x51')](applications,_0xae1494[_0xb8d5('0x4a')])){this['channels'][_0xae1494['uniqueid']]['lastapplication']=_0xae1494[_0xb8d5('0x4a')];this[_0xb8d5('0x37')][_0xae1494[_0xb8d5('0x35')]][_0xb8d5('0x52')]=_0xae1494[_0xb8d5('0x4b')];if(_0xae1494[_0xb8d5('0x4a')]===_0xb8d5('0xe')&&_['startsWith'](_0xae1494[_0xb8d5('0x4b')],_0xb8d5('0x53'))){var _0x4e3bbc=_0xae1494[_0xb8d5('0x4b')][_0xb8d5('0x42')]('=');var _0x458b9=_0x4e3bbc[0x0][_0xb8d5('0x54')](/cdr\((.*)\)/);if(_0x458b9){this[_0xb8d5('0x37')][_0xae1494[_0xb8d5('0x35')]][_0x458b9[0x1]]=_0x4e3bbc[0x1];}}else if(_0xae1494[_0xb8d5('0x4a')]===_0xb8d5('0xf')){this[_0xb8d5('0x37')][_0xae1494[_0xb8d5('0x35')]][_0xb8d5('0xf')]=_0xae1494[_0xb8d5('0x4b')][_0xb8d5('0x42')](',')[0x0];}}}}}catch(_0x57ee9d){logger[_0xb8d5('0x48')](_0xb8d5('0x55'),util[_0xb8d5('0x49')](_0x57ee9d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb8d5('0x33')][_0xb8d5('0x56')]=function(_0xaa0bc1){try{if(this['isNotNull'](_0xaa0bc1)){if(_0xaa0bc1['uniqueid']!==_0xaa0bc1[_0xb8d5('0x36')]){if(this[_0xb8d5('0x37')][_0xaa0bc1[_0xb8d5('0x36')]]){if(_0xaa0bc1[_0xb8d5('0x3f')]==='6'){if(!this[_0xb8d5('0x37')][_0xaa0bc1[_0xb8d5('0x36')]][_0xb8d5('0x57')]){var _0x5cd656=moment();this[_0xb8d5('0x37')][_0xaa0bc1['linkedid']][_0xb8d5('0x57')]=!![];this[_0xb8d5('0x37')][_0xaa0bc1[_0xb8d5('0x36')]]['answertime']=_0x5cd656[_0xb8d5('0x45')](_0xb8d5('0x3d'));if(this['channels'][_0xaa0bc1[_0xb8d5('0x36')]]['starttime']){this['channels'][_0xaa0bc1[_0xb8d5('0x36')]][_0xb8d5('0x58')]=_0x5cd656[_0xb8d5('0x59')](this[_0xb8d5('0x37')][_0xaa0bc1[_0xb8d5('0x36')]]['starttime'],_0xb8d5('0x4f'));}}this['channels'][_0xaa0bc1[_0xb8d5('0x36')]][_0xb8d5('0x36')]=_0xaa0bc1[_0xb8d5('0x35')];if(_0xaa0bc1['calleridnum']!==_0xb8d5('0x5a')){this[_0xb8d5('0x37')][_0xaa0bc1[_0xb8d5('0x36')]][_0xb8d5('0x5b')]=_0xaa0bc1[_0xb8d5('0x5c')];}this['channels'][_0xaa0bc1[_0xb8d5('0x36')]][_0xb8d5('0x5d')]=_0xaa0bc1[_0xb8d5('0x5e')];this[_0xb8d5('0x37')][_0xaa0bc1[_0xb8d5('0x36')]][_0xb8d5('0x5f')]=_0xaa0bc1[_0xb8d5('0x3a')];this['channels'][_0xaa0bc1[_0xb8d5('0x36')]][_0xb8d5('0x50')]=dispositions[_[_0xb8d5('0x3e')](_0xaa0bc1['channelstate'])];if(this[_0xb8d5('0x17')][_0xaa0bc1[_0xb8d5('0x3a')][_0xb8d5('0x42')]('-')[0x0]]){this[_0xb8d5('0x37')][_0xaa0bc1['linkedid']][_0xb8d5('0x60')]=this[_0xb8d5('0x17')][_0xaa0bc1['channel']['split']('-')[0x0]]['id'];this[_0xb8d5('0x37')][_0xaa0bc1[_0xb8d5('0x36')]][_0xb8d5('0x61')]=this['agents'][_0xaa0bc1[_0xb8d5('0x3a')][_0xb8d5('0x42')]('-')[0x0]][_0xb8d5('0x46')];}}}}else{if(this['channels'][_0xaa0bc1[_0xb8d5('0x35')]]){if(_0xaa0bc1[_0xb8d5('0x3f')]==='6'){if(this[_0xb8d5('0x17')][_0xaa0bc1[_0xb8d5('0x3a')][_0xb8d5('0x42')]('-')[0x0]]){this[_0xb8d5('0x37')][_0xaa0bc1[_0xb8d5('0x35')]][_0xb8d5('0x60')]=this[_0xb8d5('0x17')][_0xaa0bc1[_0xb8d5('0x3a')][_0xb8d5('0x42')]('-')[0x0]]['id'];this[_0xb8d5('0x37')][_0xaa0bc1[_0xb8d5('0x35')]][_0xb8d5('0x61')]=this['agents'][_0xaa0bc1[_0xb8d5('0x3a')][_0xb8d5('0x42')]('-')[0x0]][_0xb8d5('0x46')];}}}}}}catch(_0x151661){logger['error'](_0xb8d5('0x62'),util[_0xb8d5('0x49')](_0x151661,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb8d5('0x33')][_0xb8d5('0x63')]=function(_0x4fd1ab,_0x4c01da){if(this[_0xb8d5('0x37')][_0x4fd1ab]){this['channels'][_0x4fd1ab][_0xb8d5('0x64')]=!![];if(_[_0xb8d5('0x65')](_0x4c01da,_0xb8d5('0x66'))){_0x4c01da=_0x4c01da[_0xb8d5('0x67')]('.wav49',_0xb8d5('0x68'));}this[_0xb8d5('0x37')][_0x4fd1ab][_0xb8d5('0x69')]=_0x4c01da;var _0x4df7f4=_[_0xb8d5('0x6a')](this[_0xb8d5('0x37')][_0x4fd1ab][_0xb8d5('0x6b')],{'filename':_0x4c01da});if(_[_0xb8d5('0x6c')](_0x4df7f4)){this[_0xb8d5('0x37')][_0x4fd1ab][_0xb8d5('0x6b')][_0xb8d5('0x6d')]({'filename':_0x4c01da,'createdAt':moment()[_0xb8d5('0x45')](_0xb8d5('0x3d')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0xb8d5('0x33')][_0xb8d5('0x20')]=function(_0x5ba6d9){try{if(this['isNotNull'](_0x5ba6d9)){if(this[_0xb8d5('0x37')][_0x5ba6d9[_0xb8d5('0x35')]]&&_0x5ba6d9[_0xb8d5('0x3a')]!=_0xb8d5('0x3b')){if(this['isNotNull'](_0x5ba6d9[_0xb8d5('0x6e')])){if(this['isNotNull'](_0x5ba6d9[_0xb8d5('0x6e')][_0xb8d5('0x6f')])){this['syncMixMonitorFilename'](_0x5ba6d9[_0xb8d5('0x35')],_0x5ba6d9['value']);}else if(this[_0xb8d5('0x30')](_0x5ba6d9[_0xb8d5('0x6e')][_0xb8d5('0x70')])){this[_0xb8d5('0x37')][_0x5ba6d9[_0xb8d5('0x35')]][_0xb8d5('0x5c')]=_0x5ba6d9['value'];}else if(this[_0xb8d5('0x30')](_0x5ba6d9[_0xb8d5('0x6e')][_0xb8d5('0x71')])){this[_0xb8d5('0x37')][_0x5ba6d9[_0xb8d5('0x35')]]['callerid']=_0x5ba6d9['value'];}else if(this[_0xb8d5('0x30')](_0x5ba6d9[_0xb8d5('0x6e')][_0xb8d5('0x72')])){this[_0xb8d5('0x37')][_0x5ba6d9[_0xb8d5('0x35')]][_0xb8d5('0x73')]=_0x5ba6d9[_0xb8d5('0x74')];}else if(this[_0xb8d5('0x30')](_0x5ba6d9[_0xb8d5('0x6e')]['xmd-queue'])){this[_0xb8d5('0x37')][_0x5ba6d9[_0xb8d5('0x35')]][_0xb8d5('0xf')]=_0x5ba6d9[_0xb8d5('0x74')][_0xb8d5('0x42')](',')[0x0];}else if(this[_0xb8d5('0x30')](_0x5ba6d9['variable']['xmd-originatecalleridnum'])){this['channels'][_0x5ba6d9[_0xb8d5('0x35')]][_0xb8d5('0x75')]=_0x5ba6d9['value'];}else if(this[_0xb8d5('0x30')](_0x5ba6d9['variable'][_0xb8d5('0x76')])){this['channels'][_0x5ba6d9[_0xb8d5('0x35')]][_0xb8d5('0x77')]=_0x5ba6d9['value'];}else if(this[_0xb8d5('0x30')](_0x5ba6d9['variable'][_0xb8d5('0x78')])){this[_0xb8d5('0x37')][_0x5ba6d9['uniqueid']][_0xb8d5('0x79')]=_0x5ba6d9[_0xb8d5('0x74')];}else if(this[_0xb8d5('0x30')](_0x5ba6d9[_0xb8d5('0x6e')][_0xb8d5('0x7a')])){this[_0xb8d5('0x37')][_0x5ba6d9[_0xb8d5('0x35')]]['queue']=_0x5ba6d9[_0xb8d5('0x74')];}else if(this[_0xb8d5('0x30')](_0x5ba6d9[_0xb8d5('0x6e')]['sipcallid'])){this[_0xb8d5('0x37')][_0x5ba6d9[_0xb8d5('0x35')]]['sipcalluniqueid']=_0x5ba6d9[_0xb8d5('0x74')];}}}else if(this['isNotNull'](_0x5ba6d9[_0xb8d5('0x6e')]['mixmonitor_filename'])){if(_0x5ba6d9[_0xb8d5('0x74')]){var _0x2576c1=path[_0xb8d5('0x7b')](_0x5ba6d9[_0xb8d5('0x74')])['name'];this[_0xb8d5('0x63')](_0x2576c1,_0x5ba6d9[_0xb8d5('0x74')]);}}else if(this[_0xb8d5('0x37')][_0x5ba6d9[_0xb8d5('0x36')]]){if(this[_0xb8d5('0x30')](_0x5ba6d9['variable'])){if(this[_0xb8d5('0x30')](_0x5ba6d9[_0xb8d5('0x6e')][_0xb8d5('0x7c')])){this['channels'][_0x5ba6d9['linkedid']]['sipcalllinkedid']=_0x5ba6d9[_0xb8d5('0x74')];}}}}}catch(_0x539a6a){logger['error'](_0xb8d5('0x7d'),util[_0xb8d5('0x49')](_0x539a6a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb8d5('0x33')]['syncHangup']=function(_0xce90ad){try{if(this[_0xb8d5('0x30')](_0xce90ad)){if(this[_0xb8d5('0x37')][_0xce90ad['uniqueid']]){var _0x59a680=moment();this['channels'][_0xce90ad[_0xb8d5('0x35')]][_0xb8d5('0x7e')]=_0x59a680[_0xb8d5('0x45')](_0xb8d5('0x3d'));this[_0xb8d5('0x37')][_0xce90ad[_0xb8d5('0x35')]][_0xb8d5('0x4d')]=_0x59a680[_0xb8d5('0x59')](this[_0xb8d5('0x37')][_0xce90ad[_0xb8d5('0x35')]][_0xb8d5('0x3c')],'seconds');if(this[_0xb8d5('0x37')][_0xce90ad[_0xb8d5('0x35')]][_0xb8d5('0x57')]){this[_0xb8d5('0x37')][_0xce90ad[_0xb8d5('0x35')]][_0xb8d5('0x7f')]=_0x59a680[_0xb8d5('0x59')](this[_0xb8d5('0x37')][_0xce90ad[_0xb8d5('0x35')]][_0xb8d5('0x80')],_0xb8d5('0x4f'));this[_0xb8d5('0x37')][_0xce90ad[_0xb8d5('0x35')]][_0xb8d5('0x58')]=this['channels'][_0xce90ad['uniqueid']][_0xb8d5('0x4d')]-this[_0xb8d5('0x37')][_0xce90ad[_0xb8d5('0x35')]][_0xb8d5('0x7f')];}if(_0xce90ad['context']===_0xb8d5('0x81')){if(this['agents'][_0xce90ad['channel'][_0xb8d5('0x42')]('-')[0x0]]){this[_0xb8d5('0x17')][_0xce90ad[_0xb8d5('0x3a')]['split']('-')[0x0]]=_['omit'](this['agents'][_0xce90ad[_0xb8d5('0x3a')][_0xb8d5('0x42')]('-')[0x0]],[_0xb8d5('0x43')]);this[_0xb8d5('0x32')](util[_0xb8d5('0x45')]('user:%s',this[_0xb8d5('0x17')][_0xce90ad['channel'][_0xb8d5('0x42')]('-')[0x0]]['name']),_0xb8d5('0x82'),{'destaccountcode':this['agents'][_0xce90ad[_0xb8d5('0x3a')][_0xb8d5('0x42')]('-')[0x0]][_0xb8d5('0x83')]});}}ami['emit']('custom:voiceCallReport',this[_0xb8d5('0x37')][_0xce90ad[_0xb8d5('0x35')]]);delete this['channels'][_0xce90ad[_0xb8d5('0x35')]];}}}catch(_0x2e3eee){logger[_0xb8d5('0x48')](_0xb8d5('0x84'),util[_0xb8d5('0x49')](_0x2e3eee,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb8d5('0x33')][_0xb8d5('0x24')]=function(_0xcb1acf){try{if(this[_0xb8d5('0x30')](_0xcb1acf)){if(this[_0xb8d5('0x37')][_0xcb1acf[_0xb8d5('0x85')]]){this[_0xb8d5('0x37')][_0xcb1acf[_0xb8d5('0x85')]][_0xb8d5('0x86')]=_0xcb1acf[_0xb8d5('0x87')];this[_0xb8d5('0x37')][_0xcb1acf[_0xb8d5('0x85')]]['transferconnectedlinenum']=_0xcb1acf[_0xb8d5('0x88')];if(this['channels'][_0xcb1acf['secondtransfereruniqueid']]){var _0x37e006=this[_0xb8d5('0x37')][_0xcb1acf[_0xb8d5('0x89')]];this['channels'][_0xcb1acf[_0xb8d5('0x89')]]=this[_0xb8d5('0x37')][_0xcb1acf['transfereeuniqueid']];this[_0xb8d5('0x37')][_0xcb1acf[_0xb8d5('0x85')]]=_0x37e006;}}else if(this['channels'][_0xcb1acf['transfertargetuniqueid']]){this[_0xb8d5('0x37')][_0xcb1acf[_0xb8d5('0x8a')]][_0xb8d5('0x86')]=_0xcb1acf['origtransferercalleridnum'];this[_0xb8d5('0x37')][_0xcb1acf[_0xb8d5('0x8a')]][_0xb8d5('0x8b')]=_0xcb1acf[_0xb8d5('0x88')];if(this[_0xb8d5('0x37')][_0xcb1acf[_0xb8d5('0x8c')]]){var _0x37e006=this['channels'][_0xcb1acf[_0xb8d5('0x8c')]];this['channels'][_0xcb1acf[_0xb8d5('0x8c')]]=this[_0xb8d5('0x37')][_0xcb1acf[_0xb8d5('0x8a')]];this[_0xb8d5('0x37')][_0xcb1acf[_0xb8d5('0x8a')]]=_0x37e006;}}}}catch(_0xe2b2cd){logger['error'](_0xb8d5('0x8d'),util[_0xb8d5('0x49')](_0xe2b2cd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb8d5('0x33')][_0xb8d5('0x26')]=function(_0x12e2f6){try{if(this['isNotNull'](_0x12e2f6)){if(this['channels'][_0x12e2f6['transfereeuniqueid']]){this[_0xb8d5('0x37')][_0x12e2f6['transfereeuniqueid']][_0xb8d5('0x86')]=_0x12e2f6[_0xb8d5('0x8e')];this[_0xb8d5('0x37')][_0x12e2f6[_0xb8d5('0x85')]][_0xb8d5('0x8b')]=_0x12e2f6[_0xb8d5('0x8f')];this[_0xb8d5('0x22')]({'event':_0xb8d5('0x90'),'uniqueid':_0x12e2f6[_0xb8d5('0x85')],'context':_0x12e2f6[_0xb8d5('0x41')],'channel':_0x12e2f6['transfererchannel']});}}}catch(_0x18f32c){logger['error'](_0xb8d5('0x91'),util['inspect'](_0x18f32c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb8d5('0x33')][_0xb8d5('0x28')]=function(_0xf02bf5){try{if(this['isNotNull'](_0xf02bf5)){if(this[_0xb8d5('0x37')][_0xf02bf5[_0xb8d5('0x35')]]){if(!_[_0xb8d5('0x6c')](this[_0xb8d5('0x37')][_0xf02bf5['uniqueid']]['answertime'])){this[_0xb8d5('0x37')][_0xf02bf5['uniqueid']][_0xb8d5('0x92')]=moment()[_0xb8d5('0x45')](_0xb8d5('0x3d'));}}}}catch(_0x4602a7){logger[_0xb8d5('0x48')](_0xb8d5('0x93'),util[_0xb8d5('0x49')](_0x4602a7,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xb8d5('0x2a')]=function(_0x48b3d6){try{if(this[_0xb8d5('0x30')](_0x48b3d6)){if(this[_0xb8d5('0x37')][_0x48b3d6['uniqueid']]){if(!_[_0xb8d5('0x6c')](this[_0xb8d5('0x37')][_0x48b3d6['uniqueid']][_0xb8d5('0x92')])){this[_0xb8d5('0x37')][_0x48b3d6[_0xb8d5('0x35')]]['mohtime']+=moment()[_0xb8d5('0x94')](0x0)[_0xb8d5('0x59')](this[_0xb8d5('0x37')][_0x48b3d6[_0xb8d5('0x35')]][_0xb8d5('0x92')],'seconds');delete this[_0xb8d5('0x37')][_0x48b3d6[_0xb8d5('0x35')]][_0xb8d5('0x92')];}}}}catch(_0x2e4a71){logger[_0xb8d5('0x48')](_0xb8d5('0x95'),util[_0xb8d5('0x49')](_0x2e4a71,{'showHidden':![],'depth':null}));}};module[_0xb8d5('0x96')]=VoiceCallReport; \ No newline at end of file +var _0xdabe=['socket.io-emitter','channels','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','log','isNotNull','isUndefined','emit','prototype','linkedid','merge','uniqueid','error','inspect','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','pick','context','from-sip','agents','split','destconnectedlinenum','exten','user:%s','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','application','toLowerCase','appdata','applicationdata','duration','subtract','seconds','keys','includes','lastapplication','cdr(','match','[syncNewExten][VoiceCallReport]','answered','answertime','diff','calleridnum','xcally-motion-preview','connectedlinenum','calleridname','destinationchannel','membername','name','UserId','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','endsWith','.wav49','replace','monitorFilename','find','monitors','isNil','rec','variable','mixmonitor_filename','value','xmd-callerid','callerid','type','xmd-queue','queue','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','billableseconds','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfercalleridnum','origtransferercalleridnum','transfereeuniqueid','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','extension','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','unknown','inuse','busy','invalid','unavailable','ringing','set','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','localhost'];(function(_0x229d7e,_0x5bc489){var _0xa78280=function(_0x59850e){while(--_0x59850e){_0x229d7e['push'](_0x229d7e['shift']());}};_0xa78280(++_0x5bc489);}(_0xdabe,0x1a8));var _0xedab=function(_0x3d0461,_0xeab134){_0x3d0461=_0x3d0461-0x0;var _0x5d5045=_0xdabe[_0x3d0461];return _0x5d5045;};'use strict';var BPromise=require('bluebird');var _=require(_0xedab('0x0'));var moment=require(_0xedab('0x1'));var util=require(_0xedab('0x2'));var path=require(_0xedab('0x3'));var Redis=require(_0xedab('0x4'));var config=require(_0xedab('0x5'));var logger=require(_0xedab('0x6'))(_0xedab('0x7'));var ami=require('../ami');var Channel=require(_0xedab('0x8'));var statusDesc=[_0xedab('0x9'),'not_inuse',_0xedab('0xa'),_0xedab('0xb'),_0xedab('0xc'),_0xedab('0xd'),_0xedab('0xe'),'ringinuse','onhold'];var applications=[_0xedab('0xf'),'queue',_0xedab('0x10'),_0xedab('0x11'),_0xedab('0x12'),_0xedab('0x13')];var dispositions=['NO\x20ANSWER',_0xedab('0x14'),'FAILED',_0xedab('0x15'),'NO\x20ANSWER',_0xedab('0x15'),_0xedab('0x16'),_0xedab('0x17'),_0xedab('0x14'),_0xedab('0x14'),_0xedab('0x14')];var actions={};config[_0xedab('0x18')]=_['defaults'](config[_0xedab('0x18')],{'host':_0xedab('0x19'),'port':0x18eb});var io=require(_0xedab('0x1a'))(new Redis(config['redis']));function VoiceCallReport(_0x28f99e){this[_0xedab('0x1b')]=_0x28f99e[_0xedab('0x1b')];this['agents']=_0x28f99e['agents'];ami['on']('coreshowchannel',this[_0xedab('0x1c')][_0xedab('0x1d')](this));ami['on'](_0xedab('0x1e'),this[_0xedab('0x1c')][_0xedab('0x1d')](this));ami['on']('newchannel',this[_0xedab('0x1f')][_0xedab('0x1d')](this));ami['on'](_0xedab('0x20'),this[_0xedab('0x21')][_0xedab('0x1d')](this));ami['on'](_0xedab('0x22'),this[_0xedab('0x23')]['bind'](this));ami['on'](_0xedab('0x24'),this[_0xedab('0x25')][_0xedab('0x1d')](this));ami['on']('newcallerid',this[_0xedab('0x26')][_0xedab('0x1d')](this));ami['on'](_0xedab('0x27'),this['syncAttendedTransfer'][_0xedab('0x1d')](this));ami['on']('blindtransfer',this[_0xedab('0x28')]['bind'](this));ami['on'](_0xedab('0x29'),this[_0xedab('0x2a')][_0xedab('0x1d')](this));ami['on']('musiconholdstop',this[_0xedab('0x2b')][_0xedab('0x1d')](this));return BPromise[_0xedab('0x2c')]()[_0xedab('0x2d')](ami[_0xedab('0x2e')]())[_0xedab('0x2f')](function(_0x2ed730){console[_0xedab('0x30')](_0x2ed730);});}VoiceCallReport['prototype'][_0xedab('0x31')]=function(_0x9c38e4){return _0x9c38e4!==null&&!_[_0xedab('0x32')](_0x9c38e4);};VoiceCallReport['prototype'][_0xedab('0x33')]=function(_0x516686,_0x37db78,_0x35f4c5){io['to'](_0x516686)[_0xedab('0x33')](_0x37db78,_0x35f4c5);};VoiceCallReport[_0xedab('0x34')][_0xedab('0x26')]=function(_0x361bba){try{if(this[_0xedab('0x31')](_0x361bba)){if(_0x361bba['uniqueid']===_0x361bba[_0xedab('0x35')]){if(!_[_0xedab('0x32')](this[_0xedab('0x1b')][_0x361bba['uniqueid']])){_[_0xedab('0x36')](this['channels'][_0x361bba[_0xedab('0x37')]],_['pick'](_0x361bba,_['keys'](this[_0xedab('0x1b')][_0x361bba[_0xedab('0x37')]])));}}}}catch(_0x1516a6){logger[_0xedab('0x38')]('[syncNewCallerId][VoiceCallReport]',util[_0xedab('0x39')](_0x1516a6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xedab('0x34')][_0xedab('0x1f')]=function(_0x395969){try{if(this[_0xedab('0x31')](_0x395969)){if(_0x395969[_0xedab('0x37')]===_0x395969[_0xedab('0x35')]&&_0x395969[_0xedab('0x3a')]!=_0xedab('0x3b')){if(_[_0xedab('0x32')](this[_0xedab('0x1b')][_0x395969[_0xedab('0x37')]])){this['channels'][_0x395969['uniqueid']]=new Channel();this[_0xedab('0x1b')][_0x395969[_0xedab('0x37')]][_0xedab('0x3c')]=moment()[_0xedab('0x3d')](_0xedab('0x3e'));this[_0xedab('0x1b')][_0x395969[_0xedab('0x37')]][_0xedab('0x3f')]=dispositions[_[_0xedab('0x40')](_0x395969[_0xedab('0x41')])];_[_0xedab('0x36')](this[_0xedab('0x1b')][_0x395969['uniqueid']],_[_0xedab('0x42')](_0x395969,_['keys'](this[_0xedab('0x1b')][_0x395969[_0xedab('0x37')]])));if(_0x395969[_0xedab('0x43')]===_0xedab('0x44')){if(this[_0xedab('0x45')][_0x395969[_0xedab('0x3a')][_0xedab('0x46')]('-')[0x0]]){this['agents'][_0x395969[_0xedab('0x3a')]['split']('-')[0x0]][_0xedab('0x47')]=_0x395969[_0xedab('0x48')];this['emit'](util['format'](_0xedab('0x49'),this[_0xedab('0x45')][_0x395969[_0xedab('0x3a')][_0xedab('0x46')]('-')[0x0]]['name']),_0xedab('0x4a'),{'destaccountcode':this[_0xedab('0x45')][_0x395969['channel'][_0xedab('0x46')]('-')[0x0]][_0xedab('0x4b')],'destconnectedlinenum':_0x395969[_0xedab('0x48')]});}}}}}}catch(_0x324a04){logger['error'](_0xedab('0x4c'),util[_0xedab('0x39')](_0x324a04,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xedab('0x34')][_0xedab('0x1c')]=function(_0x4452af){try{if(this['isNotNull'](_0x4452af)){if(_0x4452af['uniqueid']===_0x4452af[_0xedab('0x35')]&&_0x4452af['exten']!='h'&&_0x4452af[_0xedab('0x3a')]!=_0xedab('0x3b')){_0x4452af['application']=_0x4452af[_0xedab('0x4d')][_0xedab('0x4e')]();_0x4452af['applicationdata']=(_0x4452af[_0xedab('0x4f')]||_0x4452af[_0xedab('0x50')])[_0xedab('0x4e')]();if(_[_0xedab('0x32')](this[_0xedab('0x1b')][_0x4452af[_0xedab('0x37')]])){this[_0xedab('0x1b')][_0x4452af[_0xedab('0x37')]]=new Channel();this[_0xedab('0x1b')][_0x4452af[_0xedab('0x37')]][_0xedab('0x3c')]=_0x4452af[_0xedab('0x51')]?moment()[_0xedab('0x52')](moment[_0xedab('0x51')](_0x4452af[_0xedab('0x51')])[_0xedab('0x53')](),_0xedab('0x53'))[_0xedab('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xedab('0x3d')](_0xedab('0x3e'));this[_0xedab('0x1b')][_0x4452af[_0xedab('0x37')]]['disposition']='NO\x20ANSWER';}_[_0xedab('0x36')](this[_0xedab('0x1b')][_0x4452af[_0xedab('0x37')]],_[_0xedab('0x42')](_0x4452af,_[_0xedab('0x54')](this[_0xedab('0x1b')][_0x4452af['uniqueid']])));if(_[_0xedab('0x55')](applications,_0x4452af[_0xedab('0x4d')])){this[_0xedab('0x1b')][_0x4452af[_0xedab('0x37')]][_0xedab('0x56')]=_0x4452af[_0xedab('0x4d')];this[_0xedab('0x1b')][_0x4452af[_0xedab('0x37')]]['lastdata']=_0x4452af[_0xedab('0x50')];if(_0x4452af['application']===_0xedab('0xf')&&_['startsWith'](_0x4452af[_0xedab('0x50')],_0xedab('0x57'))){var _0x4d9572=_0x4452af[_0xedab('0x50')]['split']('=');var _0x1b3be6=_0x4d9572[0x0][_0xedab('0x58')](/cdr\((.*)\)/);if(_0x1b3be6){this[_0xedab('0x1b')][_0x4452af[_0xedab('0x37')]][_0x1b3be6[0x1]]=_0x4d9572[0x1];}}else if(_0x4452af['application']==='queue'){this[_0xedab('0x1b')][_0x4452af['uniqueid']]['queue']=_0x4452af[_0xedab('0x50')][_0xedab('0x46')](',')[0x0];}}}}}catch(_0x428776){logger[_0xedab('0x38')](_0xedab('0x59'),util['inspect'](_0x428776,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xedab('0x34')][_0xedab('0x21')]=function(_0x19f27c){try{if(this[_0xedab('0x31')](_0x19f27c)){if(_0x19f27c[_0xedab('0x37')]!==_0x19f27c[_0xedab('0x35')]){if(this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]]){if(_0x19f27c['channelstate']==='6'){if(!this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]][_0xedab('0x5a')]){var _0x1eca76=moment();this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]][_0xedab('0x5a')]=!![];this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]][_0xedab('0x5b')]=_0x1eca76[_0xedab('0x3d')](_0xedab('0x3e'));if(this[_0xedab('0x1b')][_0x19f27c['linkedid']]['starttime']){this['channels'][_0x19f27c['linkedid']]['holdtime']=_0x1eca76[_0xedab('0x5c')](this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]][_0xedab('0x3c')],_0xedab('0x53'));}}this[_0xedab('0x1b')][_0x19f27c['linkedid']][_0xedab('0x35')]=_0x19f27c[_0xedab('0x37')];if(_0x19f27c[_0xedab('0x5d')]!==_0xedab('0x5e')){this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]][_0xedab('0x5f')]=_0x19f27c[_0xedab('0x5d')];}this['channels'][_0x19f27c['linkedid']]['connectedlinename']=_0x19f27c[_0xedab('0x60')];this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]][_0xedab('0x61')]=_0x19f27c[_0xedab('0x3a')];this[_0xedab('0x1b')][_0x19f27c['linkedid']][_0xedab('0x3f')]=dispositions[_[_0xedab('0x40')](_0x19f27c[_0xedab('0x41')])];if(this[_0xedab('0x45')][_0x19f27c[_0xedab('0x3a')][_0xedab('0x46')]('-')[0x0]]){this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]]['UserId']=this['agents'][_0x19f27c['channel']['split']('-')[0x0]]['id'];this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]][_0xedab('0x62')]=this['agents'][_0x19f27c['channel'][_0xedab('0x46')]('-')[0x0]][_0xedab('0x63')];}}}}else{if(this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x37')]]){if(_0x19f27c[_0xedab('0x41')]==='6'){if(this['agents'][_0x19f27c[_0xedab('0x3a')]['split']('-')[0x0]]){this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x37')]][_0xedab('0x64')]=this[_0xedab('0x45')][_0x19f27c[_0xedab('0x3a')][_0xedab('0x46')]('-')[0x0]]['id'];this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x37')]]['membername']=this['agents'][_0x19f27c[_0xedab('0x3a')]['split']('-')[0x0]]['name'];}}}}}}catch(_0x3fce7c){logger[_0xedab('0x38')](_0xedab('0x65'),util[_0xedab('0x39')](_0x3fce7c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xedab('0x66')]=function(_0x13f078,_0x35ecdf){if(this[_0xedab('0x1b')][_0x13f078]){this[_0xedab('0x1b')][_0x13f078]['monitor']=!![];if(_[_0xedab('0x67')](_0x35ecdf,_0xedab('0x68'))){_0x35ecdf=_0x35ecdf[_0xedab('0x69')](_0xedab('0x68'),'.WAV');}this['channels'][_0x13f078][_0xedab('0x6a')]=_0x35ecdf;var _0xcd4388=_[_0xedab('0x6b')](this[_0xedab('0x1b')][_0x13f078][_0xedab('0x6c')],{'filename':_0x35ecdf});if(_[_0xedab('0x6d')](_0xcd4388)){this[_0xedab('0x1b')][_0x13f078]['monitors']['push']({'filename':_0x35ecdf,'createdAt':moment()[_0xedab('0x3d')](_0xedab('0x3e')),'mixmonitorid':'','status':_0xedab('0x6e')});}}};VoiceCallReport[_0xedab('0x34')][_0xedab('0x23')]=function(_0x17b612){try{if(this[_0xedab('0x31')](_0x17b612)){if(this[_0xedab('0x1b')][_0x17b612['uniqueid']]&&_0x17b612['channel']!='OutgoingSpoolFailed'){if(this[_0xedab('0x31')](_0x17b612['variable'])){if(this[_0xedab('0x31')](_0x17b612[_0xedab('0x6f')][_0xedab('0x70')])){this[_0xedab('0x66')](_0x17b612[_0xedab('0x37')],_0x17b612[_0xedab('0x71')]);}else if(this[_0xedab('0x31')](_0x17b612[_0xedab('0x6f')]['xmd-phone'])){this['channels'][_0x17b612[_0xedab('0x37')]][_0xedab('0x5d')]=_0x17b612[_0xedab('0x71')];}else if(this['isNotNull'](_0x17b612[_0xedab('0x6f')][_0xedab('0x72')])){this[_0xedab('0x1b')][_0x17b612['uniqueid']][_0xedab('0x73')]=_0x17b612[_0xedab('0x71')];}else if(this[_0xedab('0x31')](_0x17b612[_0xedab('0x6f')]['xmd-cdrtype'])){this['channels'][_0x17b612[_0xedab('0x37')]][_0xedab('0x74')]=_0x17b612['value'];}else if(this['isNotNull'](_0x17b612[_0xedab('0x6f')][_0xedab('0x75')])){this[_0xedab('0x1b')][_0x17b612[_0xedab('0x37')]][_0xedab('0x76')]=_0x17b612[_0xedab('0x71')][_0xedab('0x46')](',')[0x0];}else if(this[_0xedab('0x31')](_0x17b612[_0xedab('0x6f')]['xmd-originatecalleridnum'])){this[_0xedab('0x1b')][_0x17b612[_0xedab('0x37')]]['originatecalleridnum']=_0x17b612[_0xedab('0x71')];}else if(this[_0xedab('0x31')](_0x17b612[_0xedab('0x6f')][_0xedab('0x77')])){this[_0xedab('0x1b')][_0x17b612[_0xedab('0x37')]][_0xedab('0x78')]=_0x17b612[_0xedab('0x71')];}else if(this[_0xedab('0x31')](_0x17b612['variable'][_0xedab('0x79')])){this[_0xedab('0x1b')][_0x17b612[_0xedab('0x37')]][_0xedab('0x7a')]=_0x17b612[_0xedab('0x71')];}else if(this['isNotNull'](_0x17b612[_0xedab('0x6f')][_0xedab('0x7b')])){this['channels'][_0x17b612[_0xedab('0x37')]][_0xedab('0x76')]=_0x17b612[_0xedab('0x71')];}else if(this[_0xedab('0x31')](_0x17b612[_0xedab('0x6f')][_0xedab('0x7c')])){this[_0xedab('0x1b')][_0x17b612['uniqueid']][_0xedab('0x7d')]=_0x17b612[_0xedab('0x71')];}}}else if(this['isNotNull'](_0x17b612['variable'][_0xedab('0x70')])){if(_0x17b612[_0xedab('0x71')]){var _0x3e5cc1=path[_0xedab('0x7e')](_0x17b612[_0xedab('0x71')])[_0xedab('0x63')];this[_0xedab('0x66')](_0x3e5cc1,_0x17b612[_0xedab('0x71')]);}}else if(this['channels'][_0x17b612['linkedid']]){if(this[_0xedab('0x31')](_0x17b612[_0xedab('0x6f')])){if(this['isNotNull'](_0x17b612[_0xedab('0x6f')]['sipcallid'])){this[_0xedab('0x1b')][_0x17b612['linkedid']][_0xedab('0x7f')]=_0x17b612['value'];}}}}}catch(_0xb72c18){logger[_0xedab('0x38')]('[syncVarSet][VoiceCallReport]',util[_0xedab('0x39')](_0xb72c18,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xedab('0x34')][_0xedab('0x25')]=function(_0x385c0c){try{if(this[_0xedab('0x31')](_0x385c0c)){if(this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]]){var _0x25785a=moment();this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]]['endtime']=_0x25785a[_0xedab('0x3d')](_0xedab('0x3e'));this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]][_0xedab('0x51')]=_0x25785a[_0xedab('0x5c')](this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]]['starttime'],_0xedab('0x53'));if(this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]][_0xedab('0x5a')]){this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]][_0xedab('0x80')]=_0x25785a[_0xedab('0x5c')](this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]][_0xedab('0x5b')],'seconds');this['channels'][_0x385c0c[_0xedab('0x37')]]['holdtime']=this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]][_0xedab('0x51')]-this[_0xedab('0x1b')][_0x385c0c['uniqueid']]['billableseconds'];}if(_0x385c0c['context']==='from-sip'){if(this['agents'][_0x385c0c[_0xedab('0x3a')][_0xedab('0x46')]('-')[0x0]]){this['agents'][_0x385c0c[_0xedab('0x3a')]['split']('-')[0x0]]=_[_0xedab('0x81')](this['agents'][_0x385c0c[_0xedab('0x3a')]['split']('-')[0x0]],['destconnectedlinenum']);this[_0xedab('0x33')](util[_0xedab('0x3d')](_0xedab('0x49'),this['agents'][_0x385c0c[_0xedab('0x3a')][_0xedab('0x46')]('-')[0x0]][_0xedab('0x63')]),_0xedab('0x82'),{'destaccountcode':this[_0xedab('0x45')][_0x385c0c[_0xedab('0x3a')]['split']('-')[0x0]][_0xedab('0x4b')]});}}ami[_0xedab('0x33')](_0xedab('0x83'),this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]]);delete this[_0xedab('0x1b')][_0x385c0c['uniqueid']];}}}catch(_0x43de43){logger['error'](_0xedab('0x84'),util['inspect'](_0x43de43,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xedab('0x34')]['syncAttendedTransfer']=function(_0x1ec58d){try{if(this[_0xedab('0x31')](_0x1ec58d)){if(this['channels'][_0x1ec58d['transfereeuniqueid']]){this[_0xedab('0x1b')][_0x1ec58d['transfereeuniqueid']][_0xedab('0x85')]=_0x1ec58d[_0xedab('0x86')];this[_0xedab('0x1b')][_0x1ec58d[_0xedab('0x87')]][_0xedab('0x88')]=_0x1ec58d[_0xedab('0x89')];if(this[_0xedab('0x1b')][_0x1ec58d['secondtransfereruniqueid']]){var _0x289d68=this['channels'][_0x1ec58d[_0xedab('0x8a')]];this[_0xedab('0x1b')][_0x1ec58d[_0xedab('0x8a')]]=this[_0xedab('0x1b')][_0x1ec58d['transfereeuniqueid']];this[_0xedab('0x1b')][_0x1ec58d[_0xedab('0x87')]]=_0x289d68;}}else if(this[_0xedab('0x1b')][_0x1ec58d[_0xedab('0x8b')]]){this[_0xedab('0x1b')][_0x1ec58d['transfertargetuniqueid']]['transfercalleridnum']=_0x1ec58d[_0xedab('0x86')];this[_0xedab('0x1b')][_0x1ec58d['transfertargetuniqueid']][_0xedab('0x88')]=_0x1ec58d[_0xedab('0x89')];if(this[_0xedab('0x1b')][_0x1ec58d[_0xedab('0x8c')]]){var _0x289d68=this[_0xedab('0x1b')][_0x1ec58d[_0xedab('0x8c')]];this[_0xedab('0x1b')][_0x1ec58d['origtransfereruniqueid']]=this['channels'][_0x1ec58d[_0xedab('0x8b')]];this[_0xedab('0x1b')][_0x1ec58d['transfertargetuniqueid']]=_0x289d68;}}}}catch(_0x107453){logger['error'](_0xedab('0x8d'),util[_0xedab('0x39')](_0x107453,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xedab('0x34')][_0xedab('0x28')]=function(_0x568df5){try{if(this[_0xedab('0x31')](_0x568df5)){if(this[_0xedab('0x1b')][_0x568df5[_0xedab('0x87')]]){this[_0xedab('0x1b')][_0x568df5[_0xedab('0x87')]][_0xedab('0x85')]=_0x568df5['transfereecalleridnum'];this['channels'][_0x568df5['transfereeuniqueid']]['transferconnectedlinenum']=_0x568df5[_0xedab('0x8e')];this[_0xedab('0x25')]({'event':'BlindTransfer','uniqueid':_0x568df5[_0xedab('0x87')],'context':_0x568df5['context'],'channel':_0x568df5['transfererchannel']});}}}catch(_0x169abe){logger['error'](_0xedab('0x8f'),util[_0xedab('0x39')](_0x169abe,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xedab('0x34')][_0xedab('0x2a')]=function(_0xba2c5a){try{if(this['isNotNull'](_0xba2c5a)){if(this[_0xedab('0x1b')][_0xba2c5a[_0xedab('0x37')]]){if(!_[_0xedab('0x6d')](this[_0xedab('0x1b')][_0xba2c5a[_0xedab('0x37')]][_0xedab('0x5b')])){this[_0xedab('0x1b')][_0xba2c5a['uniqueid']][_0xedab('0x90')]=moment()[_0xedab('0x3d')](_0xedab('0x3e'));}}}}catch(_0x27ceac){logger[_0xedab('0x38')](_0xedab('0x91'),util[_0xedab('0x39')](_0x27ceac,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xedab('0x34')]['syncMusicOnHoldStop']=function(_0x21ee2f){try{if(this['isNotNull'](_0x21ee2f)){if(this['channels'][_0x21ee2f[_0xedab('0x37')]]){if(!_[_0xedab('0x6d')](this[_0xedab('0x1b')][_0x21ee2f[_0xedab('0x37')]][_0xedab('0x90')])){this[_0xedab('0x1b')][_0x21ee2f[_0xedab('0x37')]][_0xedab('0x92')]+=moment()[_0xedab('0x93')](0x0)[_0xedab('0x5c')](this[_0xedab('0x1b')][_0x21ee2f['uniqueid']]['mohstarttime'],_0xedab('0x53'));delete this[_0xedab('0x1b')][_0x21ee2f[_0xedab('0x37')]][_0xedab('0x90')];}}}}catch(_0x157132){logger[_0xedab('0x38')](_0xedab('0x94'),util[_0xedab('0x39')](_0x157132,{'showHidden':![],'depth':null}));}};module[_0xedab('0x95')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index dbffd77..b0912c5 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 _0x2234=['duration','diff','starttime','seconds','complete','outbound','answered','holdtime','billableseconds','sumHoldTime','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[syncHangup][VoiceDialReport]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','channels','variables','dialbegin','syncDialBegin','bind','dialend','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','event','privilege','emit','voice:outbound','error','[syncDialBegin][VoiceDialReport]','inspect','syncDialEnd','dialstatus','connectedlinenum','connectedlinename','answertime','lastevent','connect','custom:dialconnect','voice_outbound_channel:save','[syncDialEnd][VoiceDialReport]','addVariable','variable','outboundrouteid','isUndefined','value','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','membercalls','memberdynamic','memberinterface','membername','memberpenalty','memberrealtime','isNil','endtime'];(function(_0x42a62a,_0x2d3511){var _0x1a52d9=function(_0x279c51){while(--_0x279c51){_0x42a62a['push'](_0x42a62a['shift']());}};_0x1a52d9(++_0x2d3511);}(_0x2234,0x16e));var _0x4223=function(_0x34d823,_0x2d20b0){_0x34d823=_0x34d823-0x0;var _0x1eb90c=_0x2234[_0x34d823];return _0x1eb90c;};'use strict';var _=require(_0x4223('0x0'));var moment=require(_0x4223('0x1'));var util=require(_0x4223('0x2'));var Redis=require(_0x4223('0x3'));var config=require(_0x4223('0x4'));var logger=require(_0x4223('0x5'))(_0x4223('0x6'));var ami=require(_0x4223('0x7'));config[_0x4223('0x8')]=_[_0x4223('0x9')](config['redis'],{'host':_0x4223('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4223('0x8')]));function VoiceDialReport(_0x4f1a2){this[_0x4223('0xb')]=_0x4f1a2['outboundChannels'];this['outbound']=_0x4f1a2['outbound'];this[_0x4223('0xc')]={};ami['on'](_0x4223('0xd'),this[_0x4223('0xe')][_0x4223('0xf')](this));ami['on'](_0x4223('0x10'),this['syncDialEnd'][_0x4223('0xf')](this));ami['on'](_0x4223('0x11'),this[_0x4223('0x12')][_0x4223('0xf')](this));ami['on'](_0x4223('0x13'),this[_0x4223('0x14')][_0x4223('0xf')](this));}VoiceDialReport[_0x4223('0x15')]['isNotNull']=function(_0x32913e){return _0x32913e!==null&&!_['isUndefined'](_0x32913e);};VoiceDialReport[_0x4223('0x15')]['emit']=function(_0x3c6fdb,_0x3b41bb,_0x20649e){io['to'](_0x3c6fdb)['emit'](_0x3b41bb,_0x20649e);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x26e986){try{if(this[_0x4223('0x16')](_0x26e986)){if(this[_0x4223('0xb')][_0x26e986[_0x4223('0x17')]]){_[_0x4223('0x18')](this[_0x4223('0xb')][_0x26e986[_0x4223('0x17')]],{'starttime':moment()[_0x4223('0x19')](_0x4223('0x1a')),'lastevent':_0x4223('0x1b'),'interface':_0x26e986[_0x4223('0x1c')][_0x4223('0x1d')](0x0,_0x26e986[_0x4223('0x1c')][_0x4223('0x1e')]('-')),'membername':_0x26e986[_0x4223('0x1c')]['substring'](_0x26e986[_0x4223('0x1c')]['lastIndexOf']('/')+0x1,_0x26e986[_0x4223('0x1c')][_0x4223('0x1e')]('-'))},_['omit'](_0x26e986,[_0x4223('0x1f'),_0x4223('0x20')]));this[_0x4223('0x21')](_0x4223('0x22'),'voice_outbound_channel:save',this[_0x4223('0xb')][_0x26e986[_0x4223('0x17')]]);ami['emit']('custom:dialbegin',this[_0x4223('0xb')][_0x26e986[_0x4223('0x17')]]);}}}catch(_0x1bea2f){logger[_0x4223('0x23')](_0x4223('0x24'),util[_0x4223('0x25')](_0x1bea2f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4223('0x15')][_0x4223('0x26')]=function(_0x61fb76){try{if(this[_0x4223('0x16')](_0x61fb76)){if(this[_0x4223('0xb')][_0x61fb76[_0x4223('0x17')]]){this['channels'][_0x61fb76['uniqueid']][_0x4223('0x27')]=_0x61fb76[_0x4223('0x27')];if(_0x61fb76[_0x4223('0x27')]==='ANSWER'){this[_0x4223('0xb')][_0x61fb76['uniqueid']][_0x4223('0x28')]=_0x61fb76[_0x4223('0x28')];this[_0x4223('0xb')][_0x61fb76[_0x4223('0x17')]][_0x4223('0x29')]=_0x61fb76[_0x4223('0x29')];this[_0x4223('0xb')][_0x61fb76['uniqueid']][_0x4223('0x2a')]=moment()[_0x4223('0x19')](_0x4223('0x1a'));this['channels'][_0x61fb76[_0x4223('0x17')]][_0x4223('0x2b')]=_0x4223('0x2c');ami['emit'](_0x4223('0x2d'),this[_0x4223('0xb')][_0x61fb76[_0x4223('0x17')]]);}this[_0x4223('0x21')]('voice:outbound',_0x4223('0x2e'),this[_0x4223('0xb')][_0x61fb76[_0x4223('0x17')]]);}}}catch(_0x5a450d){logger[_0x4223('0x23')](_0x4223('0x2f'),util['inspect'](_0x5a450d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4223('0x15')]['syncVarSet']=function(_0x2c6493){try{if(this[_0x4223('0x16')](_0x2c6493)){this[_0x4223('0x30')](_0x2c6493[_0x4223('0x17')],_['keys'](_0x2c6493[_0x4223('0x31')])[0x0],_0x2c6493['value']);if(this[_0x4223('0x16')](_0x2c6493[_0x4223('0x31')])&&this[_0x4223('0x16')](_0x2c6493[_0x4223('0x31')][_0x4223('0x32')])){if(_[_0x4223('0x33')](this['channels'][_0x2c6493[_0x4223('0x17')]])){this['channels'][_0x2c6493[_0x4223('0x17')]]={'routeId':_0x2c6493[_0x4223('0x34')],'variables':this[_0x4223('0xc')][_0x2c6493[_0x4223('0x17')]]};this[_0x4223('0x21')](_0x4223('0x22'),_0x4223('0x2e'),this[_0x4223('0xb')][_0x2c6493[_0x4223('0x17')]]);}}}}catch(_0x28af53){logger[_0x4223('0x23')](_0x4223('0x35'),util['inspect'](_0x28af53,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4223('0x15')][_0x4223('0x30')]=function(_0x53faff,_0x593d1e,_0x1fc3cf){var _0x5cb5d4=[_0x4223('0x36'),_0x4223('0x37'),_0x4223('0x38'),_0x4223('0x39'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x4223('0x3a'),_0x4223('0x3b'),'sipcallid','sipuri','bridgepeer',_0x4223('0x3c'),_0x4223('0x3d'),_0x4223('0x3e'),_0x4223('0x3f'),'memberlastcall',_0x4223('0x40'),_0x4223('0x41'),_0x4223('0x42')];if(!_[_0x4223('0x43')](_0x593d1e)&&!_['includes'](_0x5cb5d4,_0x593d1e)){if(_['isUndefined'](this[_0x4223('0xc')][_0x53faff])){this[_0x4223('0xc')][_0x53faff]={};}this['variables'][_0x53faff][_0x593d1e]=_0x1fc3cf;}};VoiceDialReport['prototype'][_0x4223('0x14')]=function(_0x1200b4){try{if(this[_0x4223('0x16')](_0x1200b4)){if(this[_0x4223('0xb')][_0x1200b4[_0x4223('0x17')]]){this['channels'][_0x1200b4[_0x4223('0x17')]][_0x4223('0x44')]=moment()[_0x4223('0x19')](_0x4223('0x1a'));this['channels'][_0x1200b4['uniqueid']][_0x4223('0x45')]=moment(this['channels'][_0x1200b4['uniqueid']]['endtime'])[_0x4223('0x46')](this[_0x4223('0xb')][_0x1200b4['uniqueid']][_0x4223('0x47')],_0x4223('0x48'));this['channels'][_0x1200b4['uniqueid']][_0x4223('0x2b')]=_0x4223('0x49');this[_0x4223('0x4a')]['total']+=0x1;if(this[_0x4223('0xb')][_0x1200b4[_0x4223('0x17')]][_0x4223('0x2a')]){this[_0x4223('0x4a')][_0x4223('0x4b')]+=0x1;this[_0x4223('0xb')][_0x1200b4['uniqueid']][_0x4223('0x4c')]=moment(this[_0x4223('0xb')][_0x1200b4['uniqueid']]['answertime'])[_0x4223('0x46')](this[_0x4223('0xb')][_0x1200b4[_0x4223('0x17')]][_0x4223('0x47')],'seconds');this[_0x4223('0xb')][_0x1200b4['uniqueid']][_0x4223('0x4d')]=moment(this['channels'][_0x1200b4[_0x4223('0x17')]]['endtime'])['diff'](this[_0x4223('0xb')][_0x1200b4[_0x4223('0x17')]][_0x4223('0x2a')],'seconds');this[_0x4223('0x4a')][_0x4223('0x4e')]+=this[_0x4223('0xb')][_0x1200b4['uniqueid']]['holdtime']||0x0;this[_0x4223('0x4a')]['sumBillable']+=this['channels'][_0x1200b4[_0x4223('0x17')]]['billableseconds'];}this[_0x4223('0x4a')][_0x4223('0x4f')]+=this[_0x4223('0xb')][_0x1200b4[_0x4223('0x17')]]['duration'];ami['emit'](_0x4223('0x50'),this[_0x4223('0xb')][_0x1200b4[_0x4223('0x17')]]);ami['emit'](_0x4223('0x51'),this[_0x4223('0xb')][_0x1200b4[_0x4223('0x17')]]);this[_0x4223('0x21')](_0x4223('0x22'),_0x4223('0x52'),this['outbound']);logger['info'](_0x4223('0x53'),JSON[_0x4223('0x54')](this[_0x4223('0xb')][_0x1200b4[_0x4223('0x17')]]));this[_0x4223('0x21')](_0x4223('0x22'),'voice_outbound_channel:remove',this[_0x4223('0xb')][_0x1200b4['uniqueid']]);delete this[_0x4223('0xb')][_0x1200b4[_0x4223('0x17')]];}if(this[_0x4223('0xc')][_0x1200b4['uniqueid']]){delete this[_0x4223('0xc')][_0x1200b4[_0x4223('0x17')]];}}}catch(_0x334438){logger[_0x4223('0x23')](_0x4223('0x55'),util[_0x4223('0x25')](_0x334438,{'showHidden':![],'depth':null}));}};module[_0x4223('0x56')]=VoiceDialReport; \ No newline at end of file +var _0xfd2f=['[syncHangup][VoiceDialReport]','exports','lodash','moment','util','../../../config/environment','ami','../ami','defaults','redis','channels','outbound','dialbegin','syncDialBegin','bind','dialend','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','merge','format','called','channel','substring','lastIndexOf','omit','event','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','voice:outbound','[syncDialEnd][VoiceDialReport]','syncVarSet','keys','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','membername','memberpenalty','includes','variables','endtime','duration','diff','starttime','seconds','lastevent','holdtime','billableseconds','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','voice_outbound_channel:remove'];(function(_0x13289a,_0x5ad531){var _0x2658a0=function(_0x5c9dfd){while(--_0x5c9dfd){_0x13289a['push'](_0x13289a['shift']());}};_0x2658a0(++_0x5ad531);}(_0xfd2f,0x14a));var _0xffd2=function(_0x413704,_0x21b102){_0x413704=_0x413704-0x0;var _0x45940b=_0xfd2f[_0x413704];return _0x45940b;};'use strict';var _=require(_0xffd2('0x0'));var moment=require(_0xffd2('0x1'));var util=require(_0xffd2('0x2'));var Redis=require('ioredis');var config=require(_0xffd2('0x3'));var logger=require('../../../config/logger')(_0xffd2('0x4'));var ami=require(_0xffd2('0x5'));config['redis']=_[_0xffd2('0x6')](config[_0xffd2('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0xd5e752){this[_0xffd2('0x8')]=_0xd5e752['outboundChannels'];this[_0xffd2('0x9')]=_0xd5e752['outbound'];this['variables']={};ami['on'](_0xffd2('0xa'),this[_0xffd2('0xb')][_0xffd2('0xc')](this));ami['on'](_0xffd2('0xd'),this['syncDialEnd'][_0xffd2('0xc')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0xffd2('0xe'),this[_0xffd2('0xf')][_0xffd2('0xc')](this));}VoiceDialReport[_0xffd2('0x10')][_0xffd2('0x11')]=function(_0x1f135b){return _0x1f135b!==null&&!_[_0xffd2('0x12')](_0x1f135b);};VoiceDialReport['prototype']['emit']=function(_0x4de637,_0x4bf841,_0x2f0d34){io['to'](_0x4de637)[_0xffd2('0x13')](_0x4bf841,_0x2f0d34);};VoiceDialReport['prototype'][_0xffd2('0xb')]=function(_0x391d70){try{if(this[_0xffd2('0x11')](_0x391d70)){if(this[_0xffd2('0x8')][_0x391d70[_0xffd2('0x14')]]){_[_0xffd2('0x15')](this[_0xffd2('0x8')][_0x391d70[_0xffd2('0x14')]],{'starttime':moment()[_0xffd2('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xffd2('0x17'),'interface':_0x391d70[_0xffd2('0x18')][_0xffd2('0x19')](0x0,_0x391d70['channel'][_0xffd2('0x1a')]('-')),'membername':_0x391d70[_0xffd2('0x18')][_0xffd2('0x19')](_0x391d70[_0xffd2('0x18')]['lastIndexOf']('/')+0x1,_0x391d70['channel'][_0xffd2('0x1a')]('-'))},_[_0xffd2('0x1b')](_0x391d70,[_0xffd2('0x1c'),'privilege']));this[_0xffd2('0x13')]('voice:outbound',_0xffd2('0x1d'),this[_0xffd2('0x8')][_0x391d70['uniqueid']]);ami[_0xffd2('0x13')](_0xffd2('0x1e'),this[_0xffd2('0x8')][_0x391d70[_0xffd2('0x14')]]);}}}catch(_0x2b8ca2){logger[_0xffd2('0x1f')](_0xffd2('0x20'),util[_0xffd2('0x21')](_0x2b8ca2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xffd2('0x10')][_0xffd2('0x22')]=function(_0x202f9f){try{if(this['isNotNull'](_0x202f9f)){if(this[_0xffd2('0x8')][_0x202f9f[_0xffd2('0x14')]]){this[_0xffd2('0x8')][_0x202f9f[_0xffd2('0x14')]][_0xffd2('0x23')]=_0x202f9f[_0xffd2('0x23')];if(_0x202f9f['dialstatus']===_0xffd2('0x24')){this[_0xffd2('0x8')][_0x202f9f[_0xffd2('0x14')]][_0xffd2('0x25')]=_0x202f9f[_0xffd2('0x25')];this[_0xffd2('0x8')][_0x202f9f[_0xffd2('0x14')]]['connectedlinename']=_0x202f9f[_0xffd2('0x26')];this['channels'][_0x202f9f[_0xffd2('0x14')]][_0xffd2('0x27')]=moment()[_0xffd2('0x16')](_0xffd2('0x28'));this[_0xffd2('0x8')][_0x202f9f[_0xffd2('0x14')]]['lastevent']='connect';ami[_0xffd2('0x13')]('custom:dialconnect',this[_0xffd2('0x8')][_0x202f9f[_0xffd2('0x14')]]);}this[_0xffd2('0x13')](_0xffd2('0x29'),'voice_outbound_channel:save',this['channels'][_0x202f9f[_0xffd2('0x14')]]);}}}catch(_0x7ece74){logger['error'](_0xffd2('0x2a'),util[_0xffd2('0x21')](_0x7ece74,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xffd2('0x2b')]=function(_0x66eb3a){try{if(this[_0xffd2('0x11')](_0x66eb3a)){this['addVariable'](_0x66eb3a['uniqueid'],_[_0xffd2('0x2c')](_0x66eb3a[_0xffd2('0x2d')])[0x0],_0x66eb3a[_0xffd2('0x2e')]);if(this[_0xffd2('0x11')](_0x66eb3a[_0xffd2('0x2d')])&&this['isNotNull'](_0x66eb3a['variable'][_0xffd2('0x2f')])){if(_[_0xffd2('0x12')](this[_0xffd2('0x8')][_0x66eb3a['uniqueid']])){this[_0xffd2('0x8')][_0x66eb3a[_0xffd2('0x14')]]={'routeId':_0x66eb3a[_0xffd2('0x2e')],'variables':this['variables'][_0x66eb3a[_0xffd2('0x14')]]};this[_0xffd2('0x13')](_0xffd2('0x29'),_0xffd2('0x1d'),this[_0xffd2('0x8')][_0x66eb3a[_0xffd2('0x14')]]);}}}}catch(_0x2c0916){logger['error'](_0xffd2('0x30'),util[_0xffd2('0x21')](_0x2c0916,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xffd2('0x10')][_0xffd2('0x31')]=function(_0x3aa1ce,_0x2d0dd8,_0x55745e){var _0x18e464=[_0xffd2('0x32'),_0xffd2('0x33'),_0xffd2('0x34'),_0xffd2('0x35'),_0xffd2('0x36'),_0xffd2('0x37'),'rtpaudioqosrtt',_0xffd2('0x38'),'sipcallid','sipuri',_0xffd2('0x39'),_0xffd2('0x3a'),_0xffd2('0x3b'),_0xffd2('0x3c'),_0xffd2('0x3d'),'memberlastcall',_0xffd2('0x3e'),_0xffd2('0x3f'),'memberrealtime'];if(!_['isNil'](_0x2d0dd8)&&!_[_0xffd2('0x40')](_0x18e464,_0x2d0dd8)){if(_[_0xffd2('0x12')](this[_0xffd2('0x41')][_0x3aa1ce])){this[_0xffd2('0x41')][_0x3aa1ce]={};}this[_0xffd2('0x41')][_0x3aa1ce][_0x2d0dd8]=_0x55745e;}};VoiceDialReport[_0xffd2('0x10')]['syncHangup']=function(_0x2d5e6c){try{if(this['isNotNull'](_0x2d5e6c)){if(this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]]){this[_0xffd2('0x8')][_0x2d5e6c['uniqueid']][_0xffd2('0x42')]=moment()[_0xffd2('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x43')]=moment(this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x42')])[_0xffd2('0x44')](this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x45')],_0xffd2('0x46'));this['channels'][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x47')]='complete';this[_0xffd2('0x9')]['total']+=0x1;if(this['channels'][_0x2d5e6c['uniqueid']][_0xffd2('0x27')]){this['outbound']['answered']+=0x1;this[_0xffd2('0x8')][_0x2d5e6c['uniqueid']][_0xffd2('0x48')]=moment(this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x27')])[_0xffd2('0x44')](this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x45')],_0xffd2('0x46'));this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x49')]=moment(this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x42')])['diff'](this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x27')],_0xffd2('0x46'));this[_0xffd2('0x9')]['sumHoldTime']+=this['channels'][_0x2d5e6c[_0xffd2('0x14')]]['holdtime']||0x0;this[_0xffd2('0x9')][_0xffd2('0x4a')]+=this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x49')];}this[_0xffd2('0x9')][_0xffd2('0x4b')]+=this[_0xffd2('0x8')][_0x2d5e6c['uniqueid']]['duration'];ami[_0xffd2('0x13')](_0xffd2('0x4c'),this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]]);ami['emit'](_0xffd2('0x4d'),this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]]);this['emit'](_0xffd2('0x29'),'voice_outbound:save',this[_0xffd2('0x9')]);logger['info'](_0xffd2('0x4e'),JSON['stringify'](this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]]));this[_0xffd2('0x13')](_0xffd2('0x29'),_0xffd2('0x4f'),this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]]);delete this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]];}if(this[_0xffd2('0x41')][_0x2d5e6c[_0xffd2('0x14')]]){delete this[_0xffd2('0x41')][_0x2d5e6c[_0xffd2('0x14')]];}}}catch(_0x4ef309){logger[_0xffd2('0x1f')](_0xffd2('0x50'),util['inspect'](_0x4ef309,{'showHidden':![],'depth':null}));}};module[_0xffd2('0x51')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 63099dd..37f89ef 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 _0xd007=['syncAgentComplete','assigned','lastAssignedTo','membername','queuecallerexit','reason','transfer','COMPLETED','startsWith','local/','linkedid','queuecallerexitAt','queuecallerjoinAt','FORWARDTRANSFER','FORWARD','transferexten','destexten','transferuniqueid','[syncAgentComplete][VoiceQueueReport]','addVariable','keys','variable','value','queuestatus','lastevent','timeout','custom:timeout','queuecallerleaveAt','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','length','sumDuration','milliseconds','diff','seconds','answered','custom:queuecallerunmanaged','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertype','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','BLIND','BlindTransfer','transfererchannel','syncMusicOnHoldStart','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','bluebird','util','md5','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','socket.io-emitter','prototype','enqueue','tail','agents','voiceQueues','flagQueueSummary','campaigns','queuesummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','agentconnect','syncAgentConnect','varset','syncVarSet','syncHangup','fullybooted','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','channels','switch','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','variables','[voiceQueueReport][checkVariables]','clearQueueReport','queueReports','emitVoiceQueueChannelRemove','inspect','emit','format','voice:queue:%s','name','voice_queue_channel:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','strategy','loggedIn','sumBillable','sumHoldTime','unmanaged','abandoned','Trunk','callerid','Interval','stringify','voice_queue:save','isNotNull','isUndefined','[queues]','then','[queuesummary]','syncQueueSummary','queue','countBy','callers','toNumber','available','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','uniqueid','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','pick','push','emitVoiceQueueChannelSave','[syncQueueCallerJoin][VoiceQueueReport]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','[syncQueueCallerAbandon][VoiceQueueReport]','connectedlinenum','connectedlinename','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]'];(function(_0x2bd880,_0x2003c4){var _0x28b182=function(_0x49ec9e){while(--_0x49ec9e){_0x2bd880['push'](_0x2bd880['shift']());}};_0x28b182(++_0x2003c4);}(_0xd007,0x1eb));var _0x7d00=function(_0x50fc42,_0x32eb38){_0x50fc42=_0x50fc42-0x0;var _0x407360=_0xd007[_0x50fc42];return _0x407360;};'use strict';var _=require(_0x7d00('0x0'));var moment=require('moment');var BPromise=require(_0x7d00('0x1'));var util=require(_0x7d00('0x2'));var md5=require(_0x7d00('0x3'));var Redis=require('ioredis');var config=require(_0x7d00('0x4'));var logger=require(_0x7d00('0x5'))(_0x7d00('0x6'));var ami=require(_0x7d00('0x7'));var QueueReport=require(_0x7d00('0x8'));config[_0x7d00('0x9')]=_[_0x7d00('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7d00('0xb'))(new Redis(config[_0x7d00('0x9')]));var Sequence=function(){};Sequence[_0x7d00('0xc')][_0x7d00('0xd')]=function(_0xd50e20){this[_0x7d00('0xe')]=this[_0x7d00('0xe')]?this[_0x7d00('0xe')]['finally'](_0xd50e20):_0xd50e20();};function VoiceQueueReport(_0x4099e4){this['sequence']=new Sequence();this['queueReports']={};this[_0x7d00('0xf')]=_0x4099e4[_0x7d00('0xf')];this['channels']=_0x4099e4['queueChannels'];this[_0x7d00('0x10')]=_0x4099e4[_0x7d00('0x10')];this[_0x7d00('0x11')]=!![];this[_0x7d00('0x12')]=_0x4099e4[_0x7d00('0x12')];this['variables']={};ami['on'](_0x7d00('0x13'),this['syncQueueSummary'][_0x7d00('0x14')](this));ami['on'](_0x7d00('0x15'),this[_0x7d00('0x16')][_0x7d00('0x14')](this));ami['on'](_0x7d00('0x17'),this[_0x7d00('0x18')][_0x7d00('0x14')](this));ami['on'](_0x7d00('0x19'),this[_0x7d00('0x1a')][_0x7d00('0x14')](this));ami['on'](_0x7d00('0x1b'),this[_0x7d00('0x1c')][_0x7d00('0x14')](this));ami['on'](_0x7d00('0x1d'),this['syncAgentComplete'][_0x7d00('0x14')](this));ami['on'](_0x7d00('0x1e'),this[_0x7d00('0x1f')]['bind'](this));ami['on'](_0x7d00('0x20'),this[_0x7d00('0x21')][_0x7d00('0x14')](this));ami['on']('hangup',this[_0x7d00('0x22')][_0x7d00('0x14')](this));ami['on'](_0x7d00('0x23'),this['syncFullyBooted'][_0x7d00('0x14')](this));ami['on'](_0x7d00('0x24'),this['syncMusicOnHoldStart'][_0x7d00('0x14')](this));ami['on'](_0x7d00('0x25'),this[_0x7d00('0x26')][_0x7d00('0x14')](this));ami['on'](_0x7d00('0x27'),this[_0x7d00('0x28')][_0x7d00('0x14')](this));ami['on'](_0x7d00('0x29'),this[_0x7d00('0x2a')][_0x7d00('0x14')](this));this[_0x7d00('0x2b')]();this['loopQueueShow']();}function isNotNull(_0x413df3){return _0x413df3!==null&&!_['isUndefined'](_0x413df3);}function clearChannels(_0x38aaf7){if(!_[_0x7d00('0x2c')](_0x38aaf7)){for(var _0x42d9f6 in _0x38aaf7){if(_0x38aaf7[_0x7d00('0x2d')](_0x42d9f6)){delete _0x38aaf7[_0x42d9f6];}}}}function clearCampaigns(_0x3cde0c){if(!_[_0x7d00('0x2c')](_0x3cde0c)){for(var _0x9113ae in _0x3cde0c){if(_0x3cde0c[_0x7d00('0x2d')](_0x9113ae)){_0x3cde0c[_0x9113ae][_0x7d00('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x5e6fc1){if(!_[_0x7d00('0x2c')](_0x5e6fc1)){for(var _0x5ccea6 in _0x5e6fc1){if(_0x5e6fc1[_0x7d00('0x2d')](_0x5ccea6)){_0x5e6fc1[_0x5ccea6][_0x7d00('0x2e')]=0x0;_0x5e6fc1[_0x5ccea6][_0x7d00('0x2f')]=0x0;_0x5e6fc1[_0x5ccea6][_0x7d00('0x30')]=0x0;_0x5e6fc1[_0x5ccea6][_0x7d00('0x31')]=0x0;_0x5e6fc1[_0x5ccea6][_0x7d00('0x32')]=!![];}}}}function clearAgentBooked(_0x2e689e){if(!_[_0x7d00('0x2c')](_0x2e689e)){for(var _0x4d1299 in _0x2e689e){if(_0x2e689e[_0x7d00('0x2d')](_0x4d1299)){_0x2e689e[_0x4d1299][_0x7d00('0x33')]=!![];}}}}VoiceQueueReport['prototype'][_0x7d00('0x34')]=function(){var _0x2064f5=this;for(var _0x5e2fc6 in this[_0x7d00('0x35')]){if(this[_0x7d00('0x35')]['hasOwnProperty'](_0x5e2fc6)&&!this[_0x7d00('0x35')][_0x5e2fc6][_0x7d00('0x36')]){this['sequence'][_0x7d00('0xd')](function(){if(!_[_0x7d00('0x37')](_0x2064f5[_0x7d00('0x35')][_0x5e2fc6])){return ami[_0x7d00('0x38')]({'action':_0x7d00('0x39'),'channel':_0x2064f5[_0x7d00('0x35')][_0x5e2fc6][_0x7d00('0x3a')]})[_0x7d00('0x3b')](function(_0x582e84){if(_0x582e84[_0x7d00('0x3c')]===_0x7d00('0x3d')){setTimeout(function(){if(_0x2064f5[_0x7d00('0x35')][_0x5e2fc6]){delete _0x2064f5[_0x7d00('0x35')][_0x5e2fc6];logger[_0x7d00('0x3e')](_0x7d00('0x3f'),_0x5e2fc6);}if(_0x2064f5['queueReports'][_0x5e2fc6]){delete _0x2064f5['queueReports'][_0x5e2fc6];logger[_0x7d00('0x3e')]('[voiceQueueReport][checkQueueReport]',_0x5e2fc6);}if(_0x2064f5[_0x7d00('0x40')][_0x5e2fc6]){delete _0x2064f5[_0x7d00('0x40')][_0x5e2fc6];logger[_0x7d00('0x3e')](_0x7d00('0x41'),_0x5e2fc6);}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0x7d00('0x3e')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x7d00('0x35')]);this[_0x7d00('0x42')](this[_0x7d00('0x43')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x7d00('0x10')]);clearCampaigns(this[_0x7d00('0x12')]);};VoiceQueueReport[_0x7d00('0xc')]['clearQueueReport']=function(_0x152c21){var _0x24a7da=this;if(!_['isEmpty'](_0x152c21)){for(var _0x406e7a in _0x152c21){if(_0x152c21[_0x7d00('0x2d')](_0x406e7a)){_0x24a7da[_0x7d00('0x44')](_0x152c21[_0x406e7a]);delete _0x152c21[_0x406e7a];}}}};function loggerCatch(_0x46f8a1){return function(_0x158f33){logger[_0x7d00('0x3e')](_0x46f8a1,util[_0x7d00('0x45')](_0x158f33,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x7d00('0xc')][_0x7d00('0x46')]=function(_0x5dbe06,_0x1251e9,_0x1b0097){io['to'](_0x5dbe06)[_0x7d00('0x46')](_0x1251e9,_0x1b0097);};VoiceQueueReport[_0x7d00('0xc')]['emitVoiceQueueChannelSave']=function(_0x2bdd8b){this['emit'](util[_0x7d00('0x47')](_0x7d00('0x48'),_0x2bdd8b[_0x7d00('0x49')]),_0x7d00('0x4a'),_0x2bdd8b);};VoiceQueueReport[_0x7d00('0xc')]['emitVoiceQueueChannelRemove']=function(_0x3ee868){logger[_0x7d00('0x4b')](_0x7d00('0x4c'),JSON['stringify'](_0x3ee868));this[_0x7d00('0x46')](util['format'](_0x7d00('0x48'),_0x3ee868[_0x7d00('0x49')]),_0x7d00('0x4d'),_0x3ee868);};VoiceQueueReport[_0x7d00('0xc')][_0x7d00('0x4e')]=function(_0x1dcc53){if(_0x1dcc53[_0x7d00('0x4f')]===_0x7d00('0x50')){var _0x52d1ad={'id':_0x1dcc53['id'],'name':_0x1dcc53['name'],'strategy':_0x1dcc53[_0x7d00('0x51')],'answered':_0x1dcc53['answered'],'available':_0x1dcc53['available'],'loggedIn':_0x1dcc53[_0x7d00('0x52')],'pTalking':_0x1dcc53[_0x7d00('0x30')],'sumBillable':_0x1dcc53[_0x7d00('0x53')],'sumDuration':_0x1dcc53['sumDuration'],'sumHoldTime':_0x1dcc53[_0x7d00('0x54')]||0x0,'talking':_0x1dcc53[_0x7d00('0x2f')],'total':_0x1dcc53['total'],'type':_0x1dcc53['type'],'unmanaged':_0x1dcc53[_0x7d00('0x55')],'abandoned':_0x1dcc53[_0x7d00('0x56')],'waiting':_0x1dcc53['waiting']};if(_0x1dcc53[_0x7d00('0x57')]){_0x52d1ad['Trunk']={'id':_0x1dcc53[_0x7d00('0x57')]['id'],'name':_0x1dcc53[_0x7d00('0x57')][_0x7d00('0x49')],'active':_0x1dcc53[_0x7d00('0x57')]['active'],'callerid':_0x1dcc53[_0x7d00('0x57')][_0x7d00('0x58')]};}if(_0x1dcc53[_0x7d00('0x59')]){_0x52d1ad[_0x7d00('0x59')]={'id':_0x1dcc53['Interval']['id'],'name':_0x1dcc53[_0x7d00('0x59')][_0x7d00('0x49')]};}var _0x4006bb=md5(JSON[_0x7d00('0x5a')](_0x52d1ad));if(_0x1dcc53[_0x7d00('0x3')]!==_0x4006bb){_0x1dcc53['md5']=_0x4006bb;this[_0x7d00('0x46')](util[_0x7d00('0x47')](_0x7d00('0x48'),_0x52d1ad[_0x7d00('0x49')]),_0x7d00('0x5b'),_0x52d1ad);}}};VoiceQueueReport[_0x7d00('0xc')][_0x7d00('0x5c')]=function(_0x27e1a2){return _0x27e1a2!==null&&!_[_0x7d00('0x5d')](_0x27e1a2);};VoiceQueueReport['prototype']['loopQueueShow']=function(){var _0x2d1e2f=this;setInterval(function(){_0x2d1e2f[_0x7d00('0x34')]();ami[_0x7d00('0x38')]({'action':'queues'})[_0x7d00('0x3b')](loggerCatch(_0x7d00('0x5e')));},0x2710);};VoiceQueueReport[_0x7d00('0xc')][_0x7d00('0x2b')]=function(){var _0x2effce=this;setInterval(function(){if(_0x2effce[_0x7d00('0x11')]){return ami[_0x7d00('0x38')]({'action':'queuesummary'})[_0x7d00('0x5f')](function(_0xdbadac){_0x2effce[_0x7d00('0x11')]=![];})[_0x7d00('0x3b')](loggerCatch(_0x7d00('0x60')));}},0x3e8);};VoiceQueueReport[_0x7d00('0xc')][_0x7d00('0x61')]=function(_0x21974b){try{if(this[_0x7d00('0x5c')](_0x21974b)&&this[_0x7d00('0x5c')](_0x21974b[_0x7d00('0x62')])){if(this['voiceQueues'][_0x21974b[_0x7d00('0x62')]]){var _0x3e9678=_[_0x7d00('0x63')](this['channels'],_0x7d00('0x62'))[_0x21974b[_0x7d00('0x62')]]||0x0;var _0x25c555=_0x3e9678-_0x21974b[_0x7d00('0x64')];if(this[_0x7d00('0x10')][_0x21974b[_0x7d00('0x62')]][_0x7d00('0x31')]!==_[_0x7d00('0x65')](_0x21974b[_0x7d00('0x64')])||this['voiceQueues'][_0x21974b[_0x7d00('0x62')]]['loggedIn']!==_['toNumber'](_0x21974b['loggedin'])||this[_0x7d00('0x10')][_0x21974b[_0x7d00('0x62')]][_0x7d00('0x66')]!==_[_0x7d00('0x65')](_0x21974b[_0x7d00('0x66')])||this[_0x7d00('0x10')][_0x21974b[_0x7d00('0x62')]][_0x7d00('0x2f')]!==_0x25c555){this[_0x7d00('0x10')][_0x21974b[_0x7d00('0x62')]][_0x7d00('0x31')]=_[_0x7d00('0x65')](_0x21974b[_0x7d00('0x64')]);this[_0x7d00('0x10')][_0x21974b[_0x7d00('0x62')]][_0x7d00('0x52')]=_[_0x7d00('0x65')](_0x21974b[_0x7d00('0x67')]);this[_0x7d00('0x10')][_0x21974b[_0x7d00('0x62')]][_0x7d00('0x66')]=_[_0x7d00('0x65')](_0x21974b[_0x7d00('0x66')]);this[_0x7d00('0x10')][_0x21974b[_0x7d00('0x62')]][_0x7d00('0x2f')]=_0x25c555>0x0?_0x25c555:0x0;this[_0x7d00('0x10')][_0x21974b[_0x7d00('0x62')]][_0x7d00('0x2f')]=this['voiceQueues'][_0x21974b[_0x7d00('0x62')]]['talking']>_[_0x7d00('0x65')](_0x21974b[_0x7d00('0x67')])?_['toNumber'](_0x21974b['loggedin']):this[_0x7d00('0x10')][_0x21974b[_0x7d00('0x62')]]['talking'];this[_0x7d00('0x4e')](this['voiceQueues'][_0x21974b[_0x7d00('0x62')]]);}ami[_0x7d00('0x46')](_0x7d00('0x68'),this[_0x7d00('0x10')][_0x21974b[_0x7d00('0x62')]]);}}}catch(_0x1e4666){logger[_0x7d00('0x3e')](_0x7d00('0x69'),util['inspect'](_0x1e4666,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7d00('0xc')][_0x7d00('0x16')]=function(_0x9fdbee){this[_0x7d00('0x11')]=!![];};VoiceQueueReport[_0x7d00('0xc')]['syncNewExten']=function(_0x4bbebf){};VoiceQueueReport[_0x7d00('0xc')]['syncQueueCallerJoin']=function(_0x601ea1){try{if(this['isNotNull'](_0x601ea1)){if(_['isUndefined'](this[_0x7d00('0x43')][_0x601ea1['uniqueid']])){this['queueReports'][_0x601ea1[_0x7d00('0x6a')]]=[];this[_0x7d00('0x35')][_0x601ea1[_0x7d00('0x6a')]]={};}var _0x171fab=new QueueReport();_0x171fab[_0x7d00('0x49')]=_0x601ea1[_0x7d00('0x62')];_0x171fab['type']=this[_0x7d00('0x10')][_0x171fab[_0x7d00('0x49')]]&&this[_0x7d00('0x10')][_0x171fab[_0x7d00('0x49')]]['type']?this['voiceQueues'][_0x171fab[_0x7d00('0x49')]][_0x7d00('0x4f')]||_0x7d00('0x50'):_0x7d00('0x50');_0x171fab[_0x7d00('0x62')]=_0x601ea1[_0x7d00('0x62')];_0x171fab['queuecallerjoinAt']=moment()[_0x7d00('0x47')](_0x7d00('0x6b'));_0x171fab[_0x7d00('0x6c')]=_0x601ea1['position'];_0x171fab[_0x7d00('0x6d')]=_0x601ea1['count'];_[_0x7d00('0x6e')](_0x171fab,_[_0x7d00('0x6f')](_0x601ea1,_['keys'](_0x171fab)));this[_0x7d00('0x43')][_0x601ea1['uniqueid']][_0x7d00('0x70')](_0x171fab);this['channels'][_0x601ea1[_0x7d00('0x6a')]]=_0x171fab;this[_0x7d00('0x71')](_0x171fab);}}catch(_0x20d784){logger[_0x7d00('0x3e')](_0x7d00('0x72'),util[_0x7d00('0x45')](_0x20d784,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7d00('0xc')][_0x7d00('0x1a')]=function(_0x521f68){try{if(this[_0x7d00('0x5c')](_0x521f68)){if(this['queueReports'][_0x521f68[_0x7d00('0x6a')]]){var _0x5b978b=_[_0x7d00('0x73')](this['queueReports'][_0x521f68[_0x7d00('0x6a')]]);_0x5b978b[_0x7d00('0x74')]=![];_0x5b978b[_0x7d00('0x75')]=null;_0x5b978b[_0x7d00('0x76')]=_0x521f68[_0x7d00('0x76')];_0x5b978b[_0x7d00('0x77')]=_0x521f68[_0x7d00('0x77')];_0x5b978b[_0x7d00('0x19')]=!![];_0x5b978b[_0x7d00('0x78')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5b978b[_0x7d00('0x79')]='ABANDONED';_0x5b978b['lastAssignedTo']=null;this['channels'][_0x521f68[_0x7d00('0x6a')]]=_0x5b978b;this[_0x7d00('0x44')](_0x5b978b);}}}catch(_0x41b9a6){logger[_0x7d00('0x3e')](_0x7d00('0x7a'),util[_0x7d00('0x45')](_0x41b9a6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7d00('0xc')][_0x7d00('0x1c')]=function(_0x5be47c){try{if(this['isNotNull'](_0x5be47c)){if(this['queueReports'][_0x5be47c[_0x7d00('0x6a')]]){var _0x236375=_['last'](this[_0x7d00('0x43')][_0x5be47c[_0x7d00('0x6a')]]);_0x236375['queuecallerleaveAt']=moment()[_0x7d00('0x47')](_0x7d00('0x6b'));_0x236375[_0x7d00('0x7b')]=_0x5be47c[_0x7d00('0x7b')];_0x236375[_0x7d00('0x7c')]=_0x5be47c[_0x7d00('0x7c')];this[_0x7d00('0x35')][_0x5be47c[_0x7d00('0x6a')]]=_0x236375;this['emitVoiceQueueChannelSave'](_0x236375);}}}catch(_0x2614d1){logger[_0x7d00('0x3e')]('[syncQueueCallerLeave][VoiceQueueReport]',util[_0x7d00('0x45')](_0x2614d1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7d00('0xc')][_0x7d00('0x1f')]=function(_0x4029c3){try{if(this['isNotNull'](_0x4029c3)){if(this['queueReports'][_0x4029c3[_0x7d00('0x6a')]]){var _0x389fc4=_[_0x7d00('0x73')](this[_0x7d00('0x43')][_0x4029c3[_0x7d00('0x6a')]]);_0x389fc4[_0x7d00('0x74')]=!![];_0x389fc4[_0x7d00('0x79')]=_0x7d00('0x7d');}}}catch(_0x46953d){logger['error'](_0x7d00('0x7e'),util[_0x7d00('0x45')](_0x46953d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7d00('0xc')][_0x7d00('0x7f')]=function(_0x2da0a5){try{if(this['isNotNull'](_0x2da0a5)){if(this['queueReports'][_0x2da0a5[_0x7d00('0x6a')]]){var _0x359043=_[_0x7d00('0x73')](this[_0x7d00('0x43')][_0x2da0a5[_0x7d00('0x6a')]]);_0x359043[_0x7d00('0x19')]=![];_0x359043[_0x7d00('0x78')]=null;_0x359043[_0x7d00('0x80')]=!![];_0x359043[_0x7d00('0x81')]=_0x2da0a5[_0x7d00('0x82')];_0x359043[_0x7d00('0x76')]=_0x2da0a5[_0x7d00('0x76')];_0x359043[_0x7d00('0x74')]=!![];_0x359043[_0x7d00('0x83')]=![];_0x359043['queuecallerexitAt']=null;if(!_0x359043['transfer']){if(_0x2da0a5[_0x7d00('0x84')]==_0x7d00('0x85')){_0x359043[_0x7d00('0x79')]=_0x7d00('0x86');}else{if(_[_0x7d00('0x87')](_0x2da0a5[_0x7d00('0x3a')]['toLowerCase'](),_0x7d00('0x88'))){if(this[_0x7d00('0x43')][_0x2da0a5[_0x7d00('0x89')]]){var _0x830d35=_['last'](this['queueReports'][_0x2da0a5[_0x7d00('0x89')]]);_0x830d35['queuecallercomplete']=![];_0x830d35['queuecallerexit']=!![];_0x830d35[_0x7d00('0x8a')]=moment(_0x359043[_0x7d00('0x8b')])['add'](_0x2da0a5[_0x7d00('0x76')],'seconds')[_0x7d00('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x830d35[_0x7d00('0x79')]=_0x7d00('0x8c');_0x830d35[_0x7d00('0x85')]=!![];_0x830d35['transfertype']=_0x7d00('0x8d');_0x830d35[_0x7d00('0x8e')]=_0x2da0a5[_0x7d00('0x8f')];_0x830d35[_0x7d00('0x90')]=_0x2da0a5[_0x7d00('0x6a')];var _0x17dbbc=this[_0x7d00('0x43')][_0x2da0a5[_0x7d00('0x89')]];this['queueReports'][_0x2da0a5['linkedid']]=this[_0x7d00('0x43')][_0x2da0a5['uniqueid']];this['queueReports'][_0x2da0a5[_0x7d00('0x6a')]]=_0x17dbbc;}}else{_0x359043[_0x7d00('0x79')]='COMPLETEDBY'+_0x2da0a5['reason']['toUpperCase']();}}}this[_0x7d00('0x35')][_0x2da0a5['uniqueid']]=_0x359043;this[_0x7d00('0x44')](_0x359043);}}}catch(_0xafba3f){logger[_0x7d00('0x3e')](_0x7d00('0x91'),util[_0x7d00('0x45')](_0xafba3f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7d00('0xc')][_0x7d00('0x21')]=function(_0x2276f6){try{if(this['isNotNull'](_0x2276f6)){this[_0x7d00('0x92')](_0x2276f6[_0x7d00('0x6a')],_[_0x7d00('0x93')](_0x2276f6[_0x7d00('0x94')])[0x0],_0x2276f6[_0x7d00('0x95')]);if(this[_0x7d00('0x43')][_0x2276f6[_0x7d00('0x6a')]]){var _0x5b9528=_[_0x7d00('0x73')](this['queueReports'][_0x2276f6['uniqueid']]);if(_0x5b9528){if(this[_0x7d00('0x5c')](_0x2276f6[_0x7d00('0x94')])&&this[_0x7d00('0x5c')](_0x2276f6['variable'][_0x7d00('0x96')])){switch(_0x2276f6[_0x7d00('0x95')]){case'CONTINUE':_0x5b9528['queuecallerexit']=![];_0x5b9528[_0x7d00('0x8a')]=null;break;case'TIMEOUT':_0x5b9528[_0x7d00('0x97')]=_0x7d00('0x98');ami[_0x7d00('0x46')](_0x7d00('0x99'),_0x5b9528);break;default:_0x5b9528['queuecallerexit']=!![];_0x5b9528[_0x7d00('0x8a')]=moment()[_0x7d00('0x47')](_0x7d00('0x6b'));_0x5b9528[_0x7d00('0x9a')]=moment()[_0x7d00('0x47')](_0x7d00('0x6b'));}_0x5b9528['queuecallerabandon']=![];_0x5b9528['queuecallerabandonAt']=null;_0x5b9528[_0x7d00('0x79')]=_0x2276f6['value'];this[_0x7d00('0x35')][_0x2276f6[_0x7d00('0x6a')]]=_0x5b9528;this[_0x7d00('0x44')](_0x5b9528);}else if(this['isNotNull'](_0x2276f6[_0x7d00('0x94')])&&this[_0x7d00('0x5c')](_0x2276f6[_0x7d00('0x94')][_0x7d00('0x9b')])){if(!_0x5b9528['queuecallerabandon']){_0x5b9528[_0x7d00('0x83')]=!![];_0x5b9528['queuecallerexitAt']=moment()[_0x7d00('0x47')](_0x7d00('0x6b'));_0x5b9528['queuecallerexitreason']=_0x7d00('0x9c');_0x5b9528[_0x7d00('0x9a')]=moment()[_0x7d00('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7d00('0x35')][_0x2276f6[_0x7d00('0x6a')]]=_0x5b9528;}}_0x5b9528[_0x7d00('0x40')]=this['variables'][_0x2276f6[_0x7d00('0x6a')]];}}}}catch(_0x75979d){logger[_0x7d00('0x3e')](_0x7d00('0x9d'),util[_0x7d00('0x45')](_0x75979d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7d00('0x92')]=function(_0x2e9e6d,_0x3fd0e2,_0x2b2b23){var _0x66244d=[_0x7d00('0x9e'),_0x7d00('0x9f'),_0x7d00('0xa0'),_0x7d00('0xa1'),_0x7d00('0xa2'),_0x7d00('0xa3'),_0x7d00('0xa4'),_0x7d00('0xa5'),_0x7d00('0xa6'),_0x7d00('0xa7'),_0x7d00('0xa8'),_0x7d00('0xa9'),_0x7d00('0xaa'),_0x7d00('0xab'),_0x7d00('0xac'),_0x7d00('0xad'),_0x7d00('0x82'),_0x7d00('0xae'),_0x7d00('0xaf')];if(!_[_0x7d00('0x37')](_0x3fd0e2)&&!_[_0x7d00('0xb0')](_0x66244d,_0x3fd0e2)){if(_[_0x7d00('0x5d')](this[_0x7d00('0x40')][_0x2e9e6d])){this['variables'][_0x2e9e6d]={};}this['variables'][_0x2e9e6d][_0x3fd0e2]=_0x2b2b23;}};VoiceQueueReport[_0x7d00('0xc')][_0x7d00('0x22')]=function(_0x407e25){try{if(this['isNotNull'](_0x407e25)){if(this['queueReports'][_0x407e25['uniqueid']]){for(var _0x554428=0x0,_0x47a23f={};_0x5544280x0?_0x14e7ce:0x0;this[_0x36f9('0x13')][_0x3affa9[_0x36f9('0x5f')]]['talking']=this[_0x36f9('0x13')][_0x3affa9[_0x36f9('0x5f')]][_0x36f9('0x63')]>_[_0x36f9('0x62')](_0x3affa9[_0x36f9('0x64')])?_['toNumber'](_0x3affa9[_0x36f9('0x64')]):this['voiceQueues'][_0x3affa9['queue']]['talking'];this[_0x36f9('0x4f')](this['voiceQueues'][_0x3affa9[_0x36f9('0x5f')]]);}ami[_0x36f9('0x45')]('custom:queuesummary',this[_0x36f9('0x13')][_0x3affa9[_0x36f9('0x5f')]]);}}}catch(_0x5f4e27){logger[_0x36f9('0x40')](_0x36f9('0x65'),util[_0x36f9('0x66')](_0x5f4e27,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x1b')]=function(_0x4ba297){this[_0x36f9('0x14')]=!![];};VoiceQueueReport['prototype'][_0x36f9('0x67')]=function(_0x48765d){};VoiceQueueReport['prototype'][_0x36f9('0x1d')]=function(_0x4e1192){try{if(this[_0x36f9('0x5c')](_0x4e1192)){if(_['isUndefined'](this[_0x36f9('0x10')][_0x4e1192[_0x36f9('0x68')]])){this['queueReports'][_0x4e1192['uniqueid']]=[];this['channels'][_0x4e1192[_0x36f9('0x68')]]={};}var _0x494303=new QueueReport();_0x494303[_0x36f9('0x49')]=_0x4e1192['queue'];_0x494303[_0x36f9('0x69')]=this[_0x36f9('0x13')][_0x494303[_0x36f9('0x49')]]&&this[_0x36f9('0x13')][_0x494303[_0x36f9('0x49')]][_0x36f9('0x69')]?this[_0x36f9('0x13')][_0x494303[_0x36f9('0x49')]]['type']||_0x36f9('0x50'):_0x36f9('0x50');_0x494303['queue']=_0x4e1192[_0x36f9('0x5f')];_0x494303[_0x36f9('0x6a')]=moment()[_0x36f9('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x494303[_0x36f9('0x6b')]=_0x4e1192['position'];_0x494303['count']=_0x4e1192[_0x36f9('0x6c')];_[_0x36f9('0x6d')](_0x494303,_['pick'](_0x4e1192,_['keys'](_0x494303)));this[_0x36f9('0x10')][_0x4e1192[_0x36f9('0x68')]][_0x36f9('0x6e')](_0x494303);this[_0x36f9('0x12')][_0x4e1192[_0x36f9('0x68')]]=_0x494303;this[_0x36f9('0x46')](_0x494303);}}catch(_0x59504a){logger[_0x36f9('0x40')](_0x36f9('0x6f'),util[_0x36f9('0x66')](_0x59504a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x1e')]=function(_0x1d5bd9){try{if(this[_0x36f9('0x5c')](_0x1d5bd9)){if(this[_0x36f9('0x10')][_0x1d5bd9['uniqueid']]){var _0x752be4=_[_0x36f9('0x70')](this[_0x36f9('0x10')][_0x1d5bd9[_0x36f9('0x68')]]);_0x752be4[_0x36f9('0x71')]=![];_0x752be4['queuecallercompleteAt']=null;_0x752be4[_0x36f9('0x72')]=_0x1d5bd9['holdtime'];_0x752be4[_0x36f9('0x73')]=_0x1d5bd9[_0x36f9('0x73')];_0x752be4[_0x36f9('0x74')]=!![];_0x752be4[_0x36f9('0x75')]=moment()[_0x36f9('0x47')](_0x36f9('0x76'));_0x752be4[_0x36f9('0x77')]=_0x36f9('0x78');_0x752be4[_0x36f9('0x79')]=null;this['channels'][_0x1d5bd9['uniqueid']]=_0x752be4;this[_0x36f9('0x44')](_0x752be4);}}}catch(_0x42ca0b){logger[_0x36f9('0x40')](_0x36f9('0x7a'),util[_0x36f9('0x66')](_0x42ca0b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x1f')]=function(_0x59c98e){try{if(this[_0x36f9('0x5c')](_0x59c98e)){if(this[_0x36f9('0x10')][_0x59c98e[_0x36f9('0x68')]]){var _0x34a9ce=_[_0x36f9('0x70')](this[_0x36f9('0x10')][_0x59c98e[_0x36f9('0x68')]]);_0x34a9ce[_0x36f9('0x7b')]=moment()[_0x36f9('0x47')](_0x36f9('0x76'));_0x34a9ce[_0x36f9('0x7c')]=_0x59c98e[_0x36f9('0x7c')];_0x34a9ce[_0x36f9('0x7d')]=_0x59c98e[_0x36f9('0x7d')];this[_0x36f9('0x12')][_0x59c98e['uniqueid']]=_0x34a9ce;this[_0x36f9('0x46')](_0x34a9ce);}}}catch(_0x32ac39){logger[_0x36f9('0x40')](_0x36f9('0x7e'),util[_0x36f9('0x66')](_0x32ac39,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x36f9('0x7f')]=function(_0x23108a){try{if(this[_0x36f9('0x5c')](_0x23108a)){if(this[_0x36f9('0x10')][_0x23108a[_0x36f9('0x68')]]){var _0x3b4fa1=_[_0x36f9('0x70')](this[_0x36f9('0x10')][_0x23108a['uniqueid']]);_0x3b4fa1['queuecallercomplete']=!![];_0x3b4fa1[_0x36f9('0x77')]='COMPLETEDBYAGENT';}}}catch(_0x54130e){logger[_0x36f9('0x40')](_0x36f9('0x80'),util[_0x36f9('0x66')](_0x54130e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x21')]=function(_0x226211){try{if(this[_0x36f9('0x5c')](_0x226211)){if(this[_0x36f9('0x10')][_0x226211[_0x36f9('0x68')]]){var _0xda4faf=_['last'](this[_0x36f9('0x10')][_0x226211[_0x36f9('0x68')]]);_0xda4faf[_0x36f9('0x74')]=![];_0xda4faf[_0x36f9('0x75')]=null;_0xda4faf['assigned']=!![];_0xda4faf[_0x36f9('0x79')]=_0x226211[_0x36f9('0x81')];_0xda4faf[_0x36f9('0x72')]=_0x226211[_0x36f9('0x72')];_0xda4faf[_0x36f9('0x71')]=!![];_0xda4faf[_0x36f9('0x82')]=![];_0xda4faf[_0x36f9('0x83')]=null;if(!_0xda4faf[_0x36f9('0x84')]){if(_0x226211[_0x36f9('0x85')]=='transfer'){_0xda4faf[_0x36f9('0x77')]=_0x36f9('0x86');}else{if(_[_0x36f9('0x87')](_0x226211[_0x36f9('0x88')]['toLowerCase'](),_0x36f9('0x89'))){if(this[_0x36f9('0x10')][_0x226211[_0x36f9('0x8a')]]){var _0x2d5d68=_[_0x36f9('0x70')](this[_0x36f9('0x10')][_0x226211['linkedid']]);_0x2d5d68['queuecallercomplete']=![];_0x2d5d68[_0x36f9('0x82')]=!![];_0x2d5d68[_0x36f9('0x83')]=moment(_0xda4faf['queuecallerjoinAt'])[_0x36f9('0x8b')](_0x226211['holdtime'],'seconds')[_0x36f9('0x47')](_0x36f9('0x76'));_0x2d5d68['queuecallerexitreason']='FORWARDTRANSFER';_0x2d5d68['transfer']=!![];_0x2d5d68[_0x36f9('0x8c')]=_0x36f9('0x8d');_0x2d5d68[_0x36f9('0x8e')]=_0x226211[_0x36f9('0x8f')];_0x2d5d68[_0x36f9('0x90')]=_0x226211['uniqueid'];var _0x4e0f1c=this[_0x36f9('0x10')][_0x226211[_0x36f9('0x8a')]];this[_0x36f9('0x10')][_0x226211[_0x36f9('0x8a')]]=this[_0x36f9('0x10')][_0x226211['uniqueid']];this[_0x36f9('0x10')][_0x226211[_0x36f9('0x68')]]=_0x4e0f1c;}}else{_0xda4faf[_0x36f9('0x77')]=_0x36f9('0x91')+_0x226211[_0x36f9('0x85')][_0x36f9('0x92')]();}}}this[_0x36f9('0x12')][_0x226211[_0x36f9('0x68')]]=_0xda4faf;this['emitVoiceQueueChannelRemove'](_0xda4faf);}}}catch(_0x1edc9a){logger[_0x36f9('0x40')](_0x36f9('0x93'),util[_0x36f9('0x66')](_0x1edc9a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x36f9('0xc')]['syncVarSet']=function(_0x18f943){try{if(this[_0x36f9('0x5c')](_0x18f943)){this[_0x36f9('0x94')](_0x18f943['uniqueid'],_[_0x36f9('0x95')](_0x18f943[_0x36f9('0x96')])[0x0],_0x18f943[_0x36f9('0x97')]);if(this['queueReports'][_0x18f943['uniqueid']]){var _0x5cd52e=_[_0x36f9('0x70')](this[_0x36f9('0x10')][_0x18f943['uniqueid']]);if(_0x5cd52e){if(this[_0x36f9('0x5c')](_0x18f943[_0x36f9('0x96')])&&this[_0x36f9('0x5c')](_0x18f943[_0x36f9('0x96')][_0x36f9('0x98')])){switch(_0x18f943['value']){case _0x36f9('0x99'):_0x5cd52e[_0x36f9('0x82')]=![];_0x5cd52e[_0x36f9('0x83')]=null;break;case _0x36f9('0x9a'):_0x5cd52e['lastevent']=_0x36f9('0x9b');ami['emit'](_0x36f9('0x9c'),_0x5cd52e);break;default:_0x5cd52e[_0x36f9('0x82')]=!![];_0x5cd52e[_0x36f9('0x83')]=moment()[_0x36f9('0x47')](_0x36f9('0x76'));_0x5cd52e[_0x36f9('0x7b')]=moment()[_0x36f9('0x47')](_0x36f9('0x76'));}_0x5cd52e[_0x36f9('0x74')]=![];_0x5cd52e[_0x36f9('0x75')]=null;_0x5cd52e[_0x36f9('0x77')]=_0x18f943[_0x36f9('0x97')];this[_0x36f9('0x12')][_0x18f943[_0x36f9('0x68')]]=_0x5cd52e;this[_0x36f9('0x44')](_0x5cd52e);}else if(this[_0x36f9('0x5c')](_0x18f943[_0x36f9('0x96')])&&this[_0x36f9('0x5c')](_0x18f943['variable'][_0x36f9('0x9d')])){if(!_0x5cd52e[_0x36f9('0x74')]){_0x5cd52e[_0x36f9('0x82')]=!![];_0x5cd52e[_0x36f9('0x83')]=moment()[_0x36f9('0x47')](_0x36f9('0x76'));_0x5cd52e['queuecallerexitreason']=_0x36f9('0x9e');_0x5cd52e[_0x36f9('0x7b')]=moment()[_0x36f9('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x36f9('0x12')][_0x18f943[_0x36f9('0x68')]]=_0x5cd52e;}}_0x5cd52e[_0x36f9('0x16')]=this['variables'][_0x18f943['uniqueid']];}}}}catch(_0x3ed857){logger[_0x36f9('0x40')](_0x36f9('0x9f'),util[_0x36f9('0x66')](_0x3ed857,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x94')]=function(_0x3eed59,_0xe166af,_0x46d1cc){var _0x3b4e49=[_0x36f9('0xa0'),_0x36f9('0xa1'),_0x36f9('0xa2'),'rtpaudioqosjitterbridged',_0x36f9('0xa3'),_0x36f9('0xa4'),_0x36f9('0xa5'),'rtpaudioqosrttbridged','sipcallid',_0x36f9('0xa6'),_0x36f9('0xa7'),_0x36f9('0xa8'),_0x36f9('0xa9'),_0x36f9('0xaa'),_0x36f9('0xab'),'memberlastcall','membername',_0x36f9('0xac'),'memberrealtime'];if(!_[_0x36f9('0x3b')](_0xe166af)&&!_[_0x36f9('0xad')](_0x3b4e49,_0xe166af)){if(_[_0x36f9('0x30')](this[_0x36f9('0x16')][_0x3eed59])){this['variables'][_0x3eed59]={};}this[_0x36f9('0x16')][_0x3eed59][_0xe166af]=_0x46d1cc;}};VoiceQueueReport[_0x36f9('0xc')]['syncHangup']=function(_0x5974f4){try{if(this[_0x36f9('0x5c')](_0x5974f4)){if(this[_0x36f9('0x10')][_0x5974f4['uniqueid']]){for(var _0xb903aa=0x0,_0x21c2f4={};_0xb903aa=0x0?moment(_0x3f0ef8[_0xfcc2('0x18')])[_0xfcc2('0xd')](_0x3f0ef8['starttime'],'seconds'):null,'data1':'outbound','data2':_0x3f0ef8[_0xfcc2('0x12')],'data3':_0x3f0ef8[_0xfcc2('0x10')],'data4':_0x3f0ef8[_0xfcc2('0x19')]||null,'role':'agent','internal':_0x3f0ef8[_0xfcc2('0x12')]?_[_0xfcc2('0x1a')](_0x3f0ef8[_0xfcc2('0x12')]):undefined,'uniqueid':_0x3f0ef8['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x08b0=['toNumber','accountcode','membername','starttime','endtime','seconds','outbound','exten','dialstring','uniqueid','moment','lodash','../client','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','SIP/%s','TALKING','queuecallerleaveAt','diff','inbound','queue','agent'];(function(_0x50007b,_0x5dbd41){var _0x317b55=function(_0xfb7311){while(--_0xfb7311){_0x50007b['push'](_0x50007b['shift']());}};_0x317b55(++_0x5dbd41);}(_0x08b0,0x15a));var _0x008b=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0x08b0[_0x3eff21];return _0x1945bb;};'use strict';var moment=require(_0x008b('0x0'));var _=require(_0x008b('0x1'));var util=require('util');var client=require(_0x008b('0x2'));exports['voiceQueueReport']=function(_0x3185c6){var _0x17237c=_0x3185c6[_0x008b('0x3')]||_0x3185c6[_0x008b('0x4')];return client[_0x008b('0x5')](_0x008b('0x6'),{'body':{'channel':_0x008b('0x7'),'membername':_0x3185c6[_0x008b('0x8')],'interface':_[_0x008b('0x9')](_0x3185c6[_0x008b('0xa')])?util['format'](_0x008b('0xb'),_0x3185c6['lastAssignedTo']):_0x3185c6[_0x008b('0xa')],'type':_0x008b('0xc'),'enterAt':_0x3185c6[_0x008b('0xd')],'exitAt':_0x17237c,'duration':moment(_0x17237c)[_0x008b('0xe')](_0x3185c6[_0x008b('0xd')],'seconds'),'data1':_0x008b('0xf'),'data2':_0x3185c6['calleridnum'],'data3':_0x3185c6['exten'],'data4':null,'data5':_0x3185c6[_0x008b('0x10')],'role':_0x008b('0x11'),'internal':_0x3185c6['accountcode']?_[_0x008b('0x12')](_0x3185c6[_0x008b('0x13')]):undefined,'uniqueid':_0x3185c6['uniqueid']},'log':_0x008b('0x6')});};exports['voiceDialReport']=function(_0x16c1ef){return client[_0x008b('0x5')](_0x008b('0x6'),{'body':{'channel':_0x008b('0x7'),'membername':_0x16c1ef[_0x008b('0x14')],'interface':_0x16c1ef[_0x008b('0xa')],'type':'TALKING','enterAt':_0x16c1ef[_0x008b('0x15')],'exitAt':_0x16c1ef['endtime'],'duration':moment(_0x16c1ef[_0x008b('0x16')])[_0x008b('0xe')](_0x16c1ef['starttime'],_0x008b('0x17'))>=0x0?moment(_0x16c1ef[_0x008b('0x16')])[_0x008b('0xe')](_0x16c1ef['starttime'],_0x008b('0x17')):null,'data1':_0x008b('0x18'),'data2':_0x16c1ef['accountcode'],'data3':_0x16c1ef[_0x008b('0x19')],'data4':_0x16c1ef[_0x008b('0x1a')]||null,'role':_0x008b('0x11'),'internal':_0x16c1ef[_0x008b('0x13')]?_['toNumber'](_0x16c1ef[_0x008b('0x13')]):undefined,'uniqueid':_0x16c1ef[_0x008b('0x1b')]},'log':_0x008b('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 0b3c062..fc7b361 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 _0x693f=['name','html','../client','getTemplates','GetTemplate'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xf693('0x0'));exports[_0xf693('0x1')]=function(_0x3511a1){return function(_0x4b17c7){return client['Request'](_0xf693('0x2'),{'options':{'raw':!![],'attributes':['id',_0xf693('0x3'),_0xf693('0x4')]},'log':_0xf693('0x2')});};}; \ No newline at end of file +var _0x9c2c=['../client','getTemplates','GetTemplate','html'];(function(_0x40071b,_0x1c596f){var _0x21883d=function(_0x5b1b98){while(--_0x5b1b98){_0x40071b['push'](_0x40071b['shift']());}};_0x21883d(++_0x1c596f);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc9c2('0x0'));exports[_0xc9c2('0x1')]=function(_0x4ac695){return function(_0x507004){return client['Request'](_0xc9c2('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xc9c2('0x3')]},'log':_0xc9c2('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 554735d..eb9ab0d 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 _0xd1ee=['value','Condition','AnyConditions','field','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','GetTrigger','name','channel','status','AllConditions','operator'];(function(_0x3541be,_0x105f79){var _0x468899=function(_0x563640){while(--_0x563640){_0x3541be['push'](_0x3541be['shift']());}};_0x468899(++_0x105f79);}(_0xd1ee,0x1c6));var _0xed1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd1ee[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xed1e('0x0'));exports[_0xed1e('0x1')]=function(_0x48e08a){return function(_0x10b05c){return client['Request'](_0xed1e('0x2'),{'options':{'raw':![],'attributes':['id',_0xed1e('0x3'),_0xed1e('0x4'),_0xed1e('0x5')],'include':[{'model':'Condition','as':_0xed1e('0x6'),'attributes':['id','field',_0xed1e('0x7'),_0xed1e('0x8')]},{'model':_0xed1e('0x9'),'as':_0xed1e('0xa'),'attributes':['id',_0xed1e('0xb'),'operator',_0xed1e('0x8')]},{'model':_0xed1e('0xc'),'as':_0xed1e('0xd'),'attributes':['id',_0xed1e('0xe'),_0xed1e('0xf'),_0xed1e('0x10'),_0xed1e('0x11'),_0xed1e('0x12'),_0xed1e('0x13'),_0xed1e('0x14'),_0xed1e('0x15')]}]},'log':_0xed1e('0x2')});};}; \ No newline at end of file +var _0x4157=['Request','name','channel','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','Actions','action','data1','data2','data3','data4','data5','data6','GetTrigger','getTriggers'];(function(_0x119190,_0x5074ce){var _0x1c1587=function(_0x2c9625){while(--_0x2c9625){_0x119190['push'](_0x119190['shift']());}};_0x1c1587(++_0x5074ce);}(_0x4157,0x1e2));var _0x7415=function(_0x11fb82,_0x8fd714){_0x11fb82=_0x11fb82-0x0;var _0x59c3bb=_0x4157[_0x11fb82];return _0x59c3bb;};'use strict';var client=require('../client');exports[_0x7415('0x0')]=function(_0x15241e){return function(_0x219edb){return client[_0x7415('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x7415('0x2'),_0x7415('0x3'),_0x7415('0x4')],'include':[{'model':_0x7415('0x5'),'as':_0x7415('0x6'),'attributes':['id',_0x7415('0x7'),_0x7415('0x8'),'value']},{'model':'Condition','as':_0x7415('0x9'),'attributes':['id','field',_0x7415('0x8'),_0x7415('0xa')]},{'model':_0x7415('0xb'),'as':_0x7415('0xc'),'attributes':['id',_0x7415('0xd'),_0x7415('0xe'),_0x7415('0xf'),_0x7415('0x10'),_0x7415('0x11'),_0x7415('0x12'),_0x7415('0x13'),'data7']}]},'log':_0x7415('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index e90f4d5..047a7f9 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 _0xa2ed=['GetTrunk','name','registry','../client','getTrunks','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2ed,0xe1));var _0xda2e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2ed[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xda2e('0x0'));exports[_0xda2e('0x1')]=function(_0x3ce294){return function(_0x225819){return client[_0xda2e('0x2')](_0xda2e('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xda2e('0x4'),_0xda2e('0x5')]},'log':_0xda2e('0x3')});};}; \ No newline at end of file +var _0x5301=['registry','../client','getTrunks','Request','GetTrunk','name'];(function(_0xe51d98,_0x47a734){var _0x5ff5f1=function(_0x4193f4){while(--_0x4193f4){_0xe51d98['push'](_0xe51d98['shift']());}};_0x5ff5f1(++_0x47a734);}(_0x5301,0x133));var _0x1530=function(_0x3eb27b,_0x561a9d){_0x3eb27b=_0x3eb27b-0x0;var _0x44c621=_0x5301[_0x3eb27b];return _0x44c621;};'use strict';var client=require(_0x1530('0x0'));exports[_0x1530('0x1')]=function(_0x10c2c4){return function(_0x29473d){return client[_0x1530('0x2')](_0x1530('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x1530('0x4'),_0x1530('0x5')]},'log':_0x1530('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 7e422fa..96154aa 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 _0xf85d=['internal','getTelephones','savePause','getAgent','ShowUser','voicePause','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','phone','mobile','interface','telephone'];(function(_0xe1c706,_0x3a7f82){var _0xd1cbe=function(_0xae3845){while(--_0xae3845){_0xe1c706['push'](_0xe1c706['shift']());}};_0xd1cbe(++_0x3a7f82);}(_0xf85d,0xf6));var _0xdf85=function(_0x53afa6,_0x59e786){_0x53afa6=_0x53afa6-0x0;var _0x51f86a=_0xf85d[_0x53afa6];return _0x51f86a;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0xdf85('0x0')](_0xdf85('0x1'),{'options':{'raw':![],'where':{'role':_0xdf85('0x2')},'attributes':['id',_0xdf85('0x3'),_0xdf85('0x4'),_0xdf85('0x5'),_0xdf85('0x6'),'online',_0xdf85('0x7'),_0xdf85('0x8'),_0xdf85('0x9'),'voicePause',_0xdf85('0xa'),_0xdf85('0xb'),_0xdf85('0xc')]},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client['Request'](_0xdf85('0x1'),{'options':{'raw':!![],'where':{'role':_0xdf85('0xd')},'attributes':['id',_0xdf85('0x3'),'accountcode',_0xdf85('0xe')]},'log':_0xdf85('0xf')});};};exports[_0xdf85('0x10')]=function(_0x3c6cfd,_0x2bbab3,_0x443d4e){return client[_0xdf85('0x0')]('PauseUser',{'body':{'type':_0x2bbab3,'uniqueid':_0x443d4e},'options':{'where':{'id':_0x3c6cfd['id']}},'log':_0xdf85('0x10')});};exports['saveUnpause']=function(_0x31e62e){return client[_0xdf85('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x31e62e['id']}},'log':_0xdf85('0x10')});};exports[_0xdf85('0x11')]=function(_0x4a6158){return client[_0xdf85('0x0')](_0xdf85('0x12'),{'options':{'raw':![],'where':{'role':_0xdf85('0x2'),'id':_0x4a6158},'attributes':['id',_0xdf85('0x3'),'email',_0xdf85('0x5'),'fullname','online',_0xdf85('0x7'),_0xdf85('0x8'),_0xdf85('0x9'),_0xdf85('0x13'),'interface']},'log':_0xdf85('0x11')});}; \ No newline at end of file +var _0x6af8=['email','online','interface','../client','Request','agent','name','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause','mobile','getAgents','getTelephones','GetUser','telephone','internal','savePause','saveUnpause','getAgent'];(function(_0xb8511a,_0xcc541d){var _0x323cd5=function(_0x4d8c01){while(--_0x4d8c01){_0xb8511a['push'](_0xb8511a['shift']());}};_0x323cd5(++_0xcc541d);}(_0x6af8,0xdf));var _0x86af=function(_0x308eb8,_0x193ed9){_0x308eb8=_0x308eb8-0x0;var _0x3b7d95=_0x6af8[_0x308eb8];return _0x3b7d95;};'use strict';var client=require(_0x86af('0x0'));exports['getAgents']=function(){return function(){return client[_0x86af('0x1')]('GetUser',{'options':{'raw':![],'where':{'role':_0x86af('0x2')},'attributes':['id',_0x86af('0x3'),'email',_0x86af('0x4'),_0x86af('0x5'),'online',_0x86af('0x6'),_0x86af('0x7'),_0x86af('0x8'),_0x86af('0x9'),'phone',_0x86af('0xa'),'interface']},'log':_0x86af('0xb')});};};exports[_0x86af('0xc')]=function(){return function(){return client['Request'](_0x86af('0xd'),{'options':{'raw':!![],'where':{'role':_0x86af('0xe')},'attributes':['id',_0x86af('0x3'),_0x86af('0x4'),_0x86af('0xf')]},'log':'getTelephones'});};};exports[_0x86af('0x10')]=function(_0x191bbc,_0x40de46,_0x744afb){return client['Request']('PauseUser',{'body':{'type':_0x40de46,'uniqueid':_0x744afb},'options':{'where':{'id':_0x191bbc['id']}},'log':_0x86af('0x10')});};exports[_0x86af('0x11')]=function(_0xb43b39){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0xb43b39['id']}},'log':_0x86af('0x10')});};exports[_0x86af('0x12')]=function(_0x45fcd8){return client[_0x86af('0x1')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x86af('0x2'),'id':_0x45fcd8},'attributes':['id','name',_0x86af('0x13'),'accountcode',_0x86af('0x5'),_0x86af('0x14'),_0x86af('0x6'),_0x86af('0x7'),_0x86af('0x8'),_0x86af('0x9'),_0x86af('0x15')]},'log':_0x86af('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 9d28914..c57e735 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 _0x44f4=['../client','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x44f4,0x140));var _0x444f=function(_0x42acd8,_0x335ff2){_0x42acd8=_0x42acd8-0x0;var _0x291afb=_0x44f4[_0x42acd8];return _0x291afb;};'use strict';var client=require(_0x444f('0x0'));exports['create']=function(_0x581047){return client[_0x444f('0x1')](_0x444f('0x2'),{'body':_0x581047,'log':_0x444f('0x2')});};exports['update']=function(_0x20587c,_0x4dd98d,_0xdb1585){return client[_0x444f('0x1')](_0x444f('0x3'),{'body':_0x20587c,'options':{'where':{'uniqueid':_0x4dd98d,'interface':_0xdb1585,'agentcomplete':!![]}},'log':_0x444f('0x3')});}; \ No newline at end of file +var _0x39ef=['CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','../client'];(function(_0x206b6c,_0x22301f){var _0x20bac7=function(_0x37ae2c){while(--_0x37ae2c){_0x206b6c['push'](_0x206b6c['shift']());}};_0x20bac7(++_0x22301f);}(_0x39ef,0xe5));var _0xf39e=function(_0x5ebb09,_0x5a6fe5){_0x5ebb09=_0x5ebb09-0x0;var _0x29d0f4=_0x39ef[_0x5ebb09];return _0x29d0f4;};'use strict';var client=require(_0xf39e('0x0'));exports['create']=function(_0x3e6c2e){return client['Request'](_0xf39e('0x1'),{'body':_0x3e6c2e,'log':_0xf39e('0x1')});};exports[_0xf39e('0x2')]=function(_0x1e9ba4,_0x80255d,_0x57e646){return client[_0xf39e('0x3')](_0xf39e('0x4'),{'body':_0x1e9ba4,'options':{'where':{'uniqueid':_0x80255d,'interface':_0x57e646,'agentcomplete':!![]}},'log':_0xf39e('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 1bcfe38..6d42a72 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 _0x66c1=['day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','startOf'];(function(_0x425b18,_0x24cb5c){var _0x167782=function(_0x129279){while(--_0x129279){_0x425b18['push'](_0x425b18['shift']());}};_0x167782(++_0x24cb5c);}(_0x66c1,0x71));var _0x166c=function(_0x4b3147,_0x2a3dbe){_0x4b3147=_0x4b3147-0x0;var _0x3446c1=_0x66c1[_0x4b3147];return _0x3446c1;};'use strict';var moment=require(_0x166c('0x0'));var util=require(_0x166c('0x1'));var _=require(_0x166c('0x2'));var client=require(_0x166c('0x3'));exports[_0x166c('0x4')]=function(_0x4e1194){return client[_0x166c('0x5')](_0x166c('0x6'),{'body':_['merge'](_0x4e1194,{'source':_0x4e1194[_0x166c('0x7')],'destinationcontext':_0x4e1194[_0x166c('0x8')],'callerid':_0x4e1194[_0x166c('0x9')],'amaflags':_0x166c('0xa')}),'log':_0x166c('0x6')});};exports[_0x166c('0xb')]=function(){return function(){return client[_0x166c('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x166c('0xc')](_0x166c('0xd'))[_0x166c('0xe')](_0x166c('0xf')),moment()[_0x166c('0x10')]('day')[_0x166c('0xe')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x166c('0x11'),_0x166c('0x12'),_0x166c('0x13'),_0x166c('0x14')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x01e1=['YYYY-MM-DD\x20HH:mm:ss','billableseconds','moment','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','day','format','endOf'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x01e1,0x1c4));var _0x101e=function(_0xb2ec63,_0x10dae4){_0xb2ec63=_0xb2ec63-0x0;var _0x598c4f=_0x01e1[_0xb2ec63];return _0x598c4f;};'use strict';var moment=require(_0x101e('0x0'));var util=require('util');var _=require(_0x101e('0x1'));var client=require('../client');exports[_0x101e('0x2')]=function(_0x41f212){return client[_0x101e('0x3')](_0x101e('0x4'),{'body':_[_0x101e('0x5')](_0x41f212,{'source':_0x41f212[_0x101e('0x6')],'destinationcontext':_0x41f212[_0x101e('0x7')],'callerid':_0x41f212['callerid'],'amaflags':_0x101e('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x101e('0x9')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0x101e('0xa'))[_0x101e('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x101e('0xc')](_0x101e('0xa'))[_0x101e('0xb')](_0x101e('0xd'))]}},'attributes':['type','disposition','duration',_0x101e('0xe')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index d7d36ea..8c9fbfb 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 _0x9abc=['Request','CreateVoiceDialReport','../client','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9abc,0x10e));var _0xc9ab=function(_0xb69888,_0x1c9f86){_0xb69888=_0xb69888-0x0;var _0x381491=_0x9abc[_0xb69888];return _0x381491;};'use strict';var client=require(_0xc9ab('0x0'));exports[_0xc9ab('0x1')]=function(_0x5d9351){return client[_0xc9ab('0x2')](_0xc9ab('0x3'),{'body':_0x5d9351,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x205d=['create'];(function(_0x2fc8a0,_0x3cb528){var _0x500b32=function(_0x4d7021){while(--_0x4d7021){_0x2fc8a0['push'](_0x2fc8a0['shift']());}};_0x500b32(++_0x3cb528);}(_0x205d,0x9f));var _0xd205=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x205d[_0x23b655];return _0x364b32;};'use strict';var client=require('../client');exports[_0xd205('0x0')]=function(_0x26c01e){return client['Request']('CreateVoiceDialReport',{'body':_0x26c01e,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ee42cff..1fd7911 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 _0xd84c=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x505de5,_0x41b3bb){var _0x45ffeb=function(_0x2ca66c){while(--_0x2ca66c){_0x505de5['push'](_0x505de5['shift']());}};_0x45ffeb(++_0x41b3bb);}(_0xd84c,0x102));var _0xcd84=function(_0x336ce7,_0x3f830c){_0x336ce7=_0x336ce7-0x0;var _0x359d9b=_0xd84c[_0x336ce7];return _0x359d9b;};'use strict';var client=require(_0xcd84('0x0'));exports[_0xcd84('0x1')]=function(){return function(){return client[_0xcd84('0x2')](_0xcd84('0x3'),{'options':{'raw':!![],'attributes':['id',_0xcd84('0x4'),_0xcd84('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xcd84('0x1')});};}; \ No newline at end of file +var _0xd8d7=['Request','GetVoiceExtension','exten','../client','getVoiceExtensions'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0xd8d7[_0x413b4d];return _0x8b810a;};'use strict';var client=require(_0x7d8d('0x0'));exports[_0x7d8d('0x1')]=function(){return function(){return client[_0x7d8d('0x2')](_0x7d8d('0x3'),{'options':{'raw':!![],'attributes':['id',_0x7d8d('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 89a1cd2..405af49 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 _0x9051=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','callerid','active','Pause','mandatoryDispositionPause','Trunk','Interval','Intervals','interval','getVoiceQueues','../client','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x390c42,_0x10e1ae){var _0x43894c=function(_0x510bd0){while(--_0x510bd0){_0x390c42['push'](_0x390c42['shift']());}};_0x43894c(++_0x10e1ae);}(_0x9051,0x1d7));var _0x1905=function(_0x2c9fd2,_0x13c630){_0x2c9fd2=_0x2c9fd2-0x0;var _0xe7c289=_0x9051[_0x2c9fd2];return _0xe7c289;};'use strict';var client=require(_0x1905('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x1905('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x1905('0x2'),_0x1905('0x3'),_0x1905('0x4'),_0x1905('0x5'),_0x1905('0x6'),_0x1905('0x7'),_0x1905('0x8'),_0x1905('0x9'),'dialLimitChannel',_0x1905('0xa'),_0x1905('0xb'),_0x1905('0xc'),'dialPredictiveOptimizationPercentage',_0x1905('0xd'),_0x1905('0xe'),_0x1905('0xf'),_0x1905('0x10'),'dialQueueOptions',_0x1905('0x11'),_0x1905('0x12'),_0x1905('0x13'),_0x1905('0x14'),'dialBusyMaxRetry',_0x1905('0x15'),_0x1905('0x16'),'dialNoAnswerRetryFrequency',_0x1905('0x17'),_0x1905('0x18'),_0x1905('0x19'),_0x1905('0x1a'),'dialCheckDuplicateType',_0x1905('0x1b'),_0x1905('0x1c'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x1905('0x1d'),_0x1905('0x1e'),_0x1905('0x1f'),_0x1905('0x20'),_0x1905('0x21'),_0x1905('0x22'),_0x1905('0x23'),'dialRecallMeTimeout',_0x1905('0x24'),_0x1905('0x25'),_0x1905('0x26'),'dialAgiAfterHangupClient',_0x1905('0x27'),_0x1905('0x6'),_0x1905('0x28'),_0x1905('0x29'),_0x1905('0x2a'),_0x1905('0x2b'),'dialNoSuchNumberRetryFrequency',_0x1905('0x2c'),_0x1905('0x2d'),'dialAbandonedMaxRetry',_0x1905('0x2e'),_0x1905('0x2f'),_0x1905('0x30'),_0x1905('0x31'),_0x1905('0x32'),_0x1905('0x33'),_0x1905('0x34'),_0x1905('0x35')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x1905('0x2'),_0x1905('0x36'),_0x1905('0x37')]},{'model':_0x1905('0x38'),'as':_0x1905('0x39'),'attributes':['id',_0x1905('0x2')]},{'model':_0x1905('0x3a'),'as':'TrunkBackup','attributes':['id',_0x1905('0x2'),'callerid',_0x1905('0x37')]},{'model':_0x1905('0x3b'),'as':_0x1905('0x3b'),'attributes':['id',_0x1905('0x2')],'include':[{'model':_0x1905('0x3b'),'as':_0x1905('0x3c'),'attributes':['id',_0x1905('0x2'),_0x1905('0x3d')]}]}]},'log':_0x1905('0x3e')});};}; \ No newline at end of file +var _0x7932=['type','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','Interval','interval','../client','getVoiceQueues','name','acw','acwTimeout','autopause','monitor_format'];(function(_0x2ded1e,_0x1584ac){var _0x321640=function(_0x31a626){while(--_0x31a626){_0x2ded1e['push'](_0x2ded1e['shift']());}};_0x321640(++_0x1584ac);}(_0x7932,0x6d));var _0x2793=function(_0x2c5096,_0x2f3bb5){_0x2c5096=_0x2c5096-0x0;var _0x1a719f=_0x7932[_0x2c5096];return _0x1a719f;};'use strict';var client=require(_0x2793('0x0'));exports[_0x2793('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x2793('0x2'),_0x2793('0x3'),_0x2793('0x4'),_0x2793('0x5'),_0x2793('0x6'),_0x2793('0x7'),'dialActive','dialMethod',_0x2793('0x8'),_0x2793('0x9'),_0x2793('0xa'),_0x2793('0xb'),'dialPredictiveOptimizationPercentage',_0x2793('0xc'),_0x2793('0xd'),_0x2793('0xe'),_0x2793('0xf'),_0x2793('0x10'),_0x2793('0x11'),_0x2793('0x12'),'dialCongestionMaxRetry',_0x2793('0x13'),_0x2793('0x14'),_0x2793('0x15'),_0x2793('0x16'),_0x2793('0x17'),_0x2793('0x18'),'dialTimezone',_0x2793('0x19'),_0x2793('0x1a'),'dialCheckDuplicateType',_0x2793('0x1b'),_0x2793('0x1c'),_0x2793('0x1d'),'dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0x2793('0x1e'),_0x2793('0x1f'),_0x2793('0x20'),_0x2793('0x21'),_0x2793('0x22'),_0x2793('0x23'),_0x2793('0x24'),_0x2793('0x25'),_0x2793('0x26'),_0x2793('0x27'),_0x2793('0x28'),'dialQueueProject2','monitor_format',_0x2793('0x29'),'dialRandomLastDigitCallerIdNumber',_0x2793('0x2a'),_0x2793('0x2b'),_0x2793('0x2c'),_0x2793('0x2d'),_0x2793('0x2e'),'dialAbandonedMaxRetry',_0x2793('0x2f'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x2793('0x30'),_0x2793('0x31'),'mandatoryDisposition',_0x2793('0x32'),_0x2793('0x33')],'include':[{'model':'Trunk','as':_0x2793('0x34'),'attributes':['id',_0x2793('0x2'),_0x2793('0x35'),_0x2793('0x36')]},{'model':_0x2793('0x37'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x2793('0x34'),'as':'TrunkBackup','attributes':['id',_0x2793('0x2'),_0x2793('0x35'),'active']},{'model':_0x2793('0x38'),'as':'Interval','attributes':['id',_0x2793('0x2')],'include':[{'model':_0x2793('0x38'),'as':'Intervals','attributes':['id',_0x2793('0x2'),_0x2793('0x39')]}]}]},'log':_0x2793('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index e9604b7..5b5641d 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 _0x1d11=['CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','day','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerabandon','queuecallerabandonAt','moment','lodash','../client','create','Request'];(function(_0x3e3833,_0x2d01db){var _0x511bab=function(_0x7eea7e){while(--_0x7eea7e){_0x3e3833['push'](_0x3e3833['shift']());}};_0x511bab(++_0x2d01db);}(_0x1d11,0xb6));var _0x11d1=function(_0x27dd18,_0x4d6178){_0x27dd18=_0x27dd18-0x0;var _0x3a5873=_0x1d11[_0x27dd18];return _0x3a5873;};'use strict';var moment=require(_0x11d1('0x0'));var _=require(_0x11d1('0x1'));var client=require(_0x11d1('0x2'));exports[_0x11d1('0x3')]=function(_0x444b12){return client[_0x11d1('0x4')](_0x11d1('0x5'),{'body':_0x444b12,'log':_0x11d1('0x5')});};exports[_0x11d1('0x6')]=function(){return function(){return client[_0x11d1('0x4')](_0x11d1('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x11d1('0x8'))['format'](_0x11d1('0x9')),moment()[_0x11d1('0xa')]('day')['format'](_0x11d1('0x9'))]}},'attributes':[_0x11d1('0xb'),'queue','queuecallerjoinAt',_0x11d1('0xc'),_0x11d1('0xd'),_0x11d1('0xe'),'queuecallerexit','queuecallerexitAt',_0x11d1('0xf'),_0x11d1('0x10')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xc1ec=['queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','uniqueid','queue'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xc1ec,0x13d));var _0xcc1e=function(_0x276b58,_0x142d99){_0x276b58=_0x276b58-0x0;var _0x59623c=_0xc1ec[_0x276b58];return _0x59623c;};'use strict';var moment=require(_0xcc1e('0x0'));var _=require(_0xcc1e('0x1'));var client=require(_0xcc1e('0x2'));exports['create']=function(_0x41b881){return client[_0xcc1e('0x3')](_0xcc1e('0x4'),{'body':_0x41b881,'log':_0xcc1e('0x4')});};exports[_0xcc1e('0x5')]=function(){return function(){return client['Request']('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xcc1e('0x6')]('day')[_0xcc1e('0x7')](_0xcc1e('0x8')),moment()[_0xcc1e('0x9')](_0xcc1e('0xa'))[_0xcc1e('0x7')](_0xcc1e('0x8'))]}},'attributes':[_0xcc1e('0xb'),_0xcc1e('0xc'),_0xcc1e('0xd'),_0xcc1e('0xe'),_0xcc1e('0xf'),_0xcc1e('0x10'),_0xcc1e('0x11'),_0xcc1e('0x12'),_0xcc1e('0x13'),_0xcc1e('0x14')]},'log':_0xcc1e('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 682ae0f..02254af 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 _0x4083=['../client','Request','GetVoiceQueueRtPauses'];(function(_0x3c6ae2,_0x5c52d8){var _0x4edda=function(_0x5593eb){while(--_0x5593eb){_0x3c6ae2['push'](_0x3c6ae2['shift']());}};_0x4edda(++_0x5c52d8);}(_0x4083,0x1b0));var _0x3408=function(_0x46161a,_0x1eb7fe){_0x46161a=_0x46161a-0x0;var _0x531421=_0x4083[_0x46161a];return _0x531421;};'use strict';var client=require(_0x3408('0x0'));exports['getVoiceQueueRtPauses']=function(_0x3b4b4a){return function(){return client[_0x3408('0x1')](_0x3408('0x2'),{'options':{'where':{'VoiceQueueId':_0x3b4b4a,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xcbb9=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x2b3939,_0x499ea0){var _0x2d20c3=function(_0x475290){while(--_0x475290){_0x2b3939['push'](_0x2b3939['shift']());}};_0x2d20c3(++_0x499ea0);}(_0xcbb9,0xb1));var _0x9cbb=function(_0x3dff1c,_0x58d15f){_0x3dff1c=_0x3dff1c-0x0;var _0x588567=_0xcbb9[_0x3dff1c];return _0x588567;};'use strict';var client=require(_0x9cbb('0x0'));exports[_0x9cbb('0x1')]=function(_0x22addf){return function(){return client[_0x9cbb('0x2')](_0x9cbb('0x3'),{'options':{'where':{'VoiceQueueId':_0x22addf,'paused':!![]},'raw':!![]},'log':_0x9cbb('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 192f99e..35ffd48 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 _0x3e07=['CreateVoiceRecording','monitorFilename','lodash','../client','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e07,0xde));var _0x73e0=function(_0x149cb4,_0x3aa516){_0x149cb4=_0x149cb4-0x0;var _0x23d197=_0x3e07[_0x149cb4];return _0x23d197;};'use strict';var _=require(_0x73e0('0x0'));var client=require(_0x73e0('0x1'));exports['create']=function(_0x499400){return client[_0x73e0('0x2')](_0x73e0('0x3'),{'body':_['merge'](_0x499400,{'value':_0x499400[_0x73e0('0x4')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0xf89a=['merge','monitorFilename','CreateVoiceRecording','lodash','create'];(function(_0x1830a9,_0x1583bd){var _0x2b6166=function(_0x4cf0e6){while(--_0x4cf0e6){_0x1830a9['push'](_0x1830a9['shift']());}};_0x2b6166(++_0x1583bd);}(_0xf89a,0x198));var _0xaf89=function(_0x47606d,_0x1039c6){_0x47606d=_0x47606d-0x0;var _0x1b0225=_0xf89a[_0x47606d];return _0x1b0225;};'use strict';var _=require(_0xaf89('0x0'));var client=require('../client');exports[_0xaf89('0x1')]=function(_0x1bf391){return client['Request']('CreateVoiceRecording',{'body':_[_0xaf89('0x2')](_0x1bf391,{'value':_0x1bf391[_0xaf89('0x3')]}),'log':_0xaf89('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index d9bd8e6..3957bda 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 _0xa8ad=['transfererconnectedlinenum','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname'];(function(_0x1a26ff,_0x5fec1b){var _0x18b8cd=function(_0x56b9af){while(--_0x56b9af){_0x1a26ff['push'](_0x1a26ff['shift']());}};_0x18b8cd(++_0x5fec1b);}(_0xa8ad,0xbb));var _0xda8a=function(_0x18c57d,_0x16da2b){_0x18c57d=_0x18c57d-0x0;var _0xed0301=_0xa8ad[_0x18c57d];return _0xed0301;};'use strict';var client=require(_0xda8a('0x0'));exports[_0xda8a('0x1')]=function(_0x4f1059){return client[_0xda8a('0x2')](_0xda8a('0x3'),{'body':{'result':_0x4f1059[_0xda8a('0x4')],'transfererchannel':_0x4f1059[_0xda8a('0x5')],'transferercalleridnum':_0x4f1059[_0xda8a('0x6')],'transferercalleridname':_0x4f1059[_0xda8a('0x7')],'transfererconnectedlinenum':_0x4f1059[_0xda8a('0x8')],'transfererconnectedlinename':_0x4f1059['transfererconnectedlinename'],'transfereraccountcode':_0x4f1059['transfereraccountcode'],'transferercontext':_0x4f1059[_0xda8a('0x9')],'transfererexten':_0x4f1059[_0xda8a('0xa')],'transfererlinkedid':_0x4f1059[_0xda8a('0xb')],'transfereechannel':_0x4f1059[_0xda8a('0xc')],'transfereecalleridnum':_0x4f1059[_0xda8a('0xd')],'transfereecalleridname':_0x4f1059[_0xda8a('0xe')],'transfereeconnectedlinenum':_0x4f1059[_0xda8a('0xf')],'transfereeconnectedlinename':_0x4f1059[_0xda8a('0x10')],'transfereeaccountcode':_0x4f1059[_0xda8a('0x11')],'transfereecontext':_0x4f1059[_0xda8a('0x12')],'transfereeexten':_0x4f1059[_0xda8a('0x13')],'transfereelinkedid':_0x4f1059['transfereelinkedid'],'isexternal':_0x4f1059[_0xda8a('0x14')],'context':_0x4f1059[_0xda8a('0x15')],'extension':_0x4f1059[_0xda8a('0x16')],'type':'blind'},'log':_0xda8a('0x3')});};exports[_0xda8a('0x17')]=function(_0x2c2fb6){return client[_0xda8a('0x2')](_0xda8a('0x3'),{'body':{'result':_0x2c2fb6[_0xda8a('0x4')],'transfererchannel':_0x2c2fb6[_0xda8a('0x18')],'transferercalleridnum':_0x2c2fb6['origtransferercalleridnum'],'transferercalleridname':_0x2c2fb6[_0xda8a('0x19')],'transfererconnectedlinenum':_0x2c2fb6['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2c2fb6[_0xda8a('0x1a')],'transfereraccountcode':_0x2c2fb6[_0xda8a('0x1b')],'transferercontext':_0x2c2fb6[_0xda8a('0x1c')],'transfererexten':_0x2c2fb6[_0xda8a('0x1d')],'transfererlinkedid':_0x2c2fb6['origtransfererlinkedid'],'transfereechannel':_0x2c2fb6[_0xda8a('0x1e')],'transfereecalleridnum':_0x2c2fb6['transfertargetcalleridnum'],'transfereecalleridname':_0x2c2fb6[_0xda8a('0x1f')],'transfereeconnectedlinenum':_0x2c2fb6[_0xda8a('0x20')],'transfereeconnectedlinename':_0x2c2fb6[_0xda8a('0x21')],'transfereeaccountcode':_0x2c2fb6[_0xda8a('0x22')],'transfereecontext':_0x2c2fb6[_0xda8a('0x23')],'transfereeexten':_0x2c2fb6['transfertargetexten'],'transfereelinkedid':_0x2c2fb6[_0xda8a('0x24')],'isexternal':_0x2c2fb6[_0xda8a('0x14')],'context':_0x2c2fb6[_0xda8a('0x25')],'extension':_0x2c2fb6['origtransfererexten'],'type':_0xda8a('0x26')},'log':_0xda8a('0x3')});}; \ No newline at end of file +var _0xe464=['result','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','blindTransfer','Request','CreateVoiceTransferReport'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xe464,0x11d));var _0x4e46=function(_0x2131dd,_0x31471c){_0x2131dd=_0x2131dd-0x0;var _0xac1305=_0xe464[_0x2131dd];return _0xac1305;};'use strict';var client=require('../client');exports[_0x4e46('0x0')]=function(_0x3d78fa){return client[_0x4e46('0x1')](_0x4e46('0x2'),{'body':{'result':_0x3d78fa[_0x4e46('0x3')],'transfererchannel':_0x3d78fa[_0x4e46('0x4')],'transferercalleridnum':_0x3d78fa['transferercalleridnum'],'transferercalleridname':_0x3d78fa['transferercalleridname'],'transfererconnectedlinenum':_0x3d78fa[_0x4e46('0x5')],'transfererconnectedlinename':_0x3d78fa[_0x4e46('0x6')],'transfereraccountcode':_0x3d78fa['transfereraccountcode'],'transferercontext':_0x3d78fa[_0x4e46('0x7')],'transfererexten':_0x3d78fa[_0x4e46('0x8')],'transfererlinkedid':_0x3d78fa[_0x4e46('0x9')],'transfereechannel':_0x3d78fa['transfereechannel'],'transfereecalleridnum':_0x3d78fa['transfereecalleridnum'],'transfereecalleridname':_0x3d78fa[_0x4e46('0xa')],'transfereeconnectedlinenum':_0x3d78fa[_0x4e46('0xb')],'transfereeconnectedlinename':_0x3d78fa[_0x4e46('0xc')],'transfereeaccountcode':_0x3d78fa['transfereeaccountcode'],'transfereecontext':_0x3d78fa['transfereecontext'],'transfereeexten':_0x3d78fa[_0x4e46('0xd')],'transfereelinkedid':_0x3d78fa[_0x4e46('0xe')],'isexternal':_0x3d78fa[_0x4e46('0xf')],'context':_0x3d78fa[_0x4e46('0x10')],'extension':_0x3d78fa[_0x4e46('0x11')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x4e46('0x12')]=function(_0x23a1cb){return client[_0x4e46('0x1')](_0x4e46('0x2'),{'body':{'result':_0x23a1cb[_0x4e46('0x3')],'transfererchannel':_0x23a1cb['origtransfererchannel'],'transferercalleridnum':_0x23a1cb['origtransferercalleridnum'],'transferercalleridname':_0x23a1cb['origtransferercalleridname'],'transfererconnectedlinenum':_0x23a1cb[_0x4e46('0x13')],'transfererconnectedlinename':_0x23a1cb[_0x4e46('0x14')],'transfereraccountcode':_0x23a1cb[_0x4e46('0x15')],'transferercontext':_0x23a1cb[_0x4e46('0x16')],'transfererexten':_0x23a1cb[_0x4e46('0x17')],'transfererlinkedid':_0x23a1cb['origtransfererlinkedid'],'transfereechannel':_0x23a1cb[_0x4e46('0x18')],'transfereecalleridnum':_0x23a1cb[_0x4e46('0x19')],'transfereecalleridname':_0x23a1cb[_0x4e46('0x1a')],'transfereeconnectedlinenum':_0x23a1cb[_0x4e46('0x1b')],'transfereeconnectedlinename':_0x23a1cb[_0x4e46('0x1c')],'transfereeaccountcode':_0x23a1cb[_0x4e46('0x1d')],'transfereecontext':_0x23a1cb[_0x4e46('0x1e')],'transfereeexten':_0x23a1cb[_0x4e46('0x1f')],'transfereelinkedid':_0x23a1cb[_0x4e46('0x20')],'isexternal':_0x23a1cb['isexternal'],'context':_0x23a1cb[_0x4e46('0x21')],'extension':_0x23a1cb[_0x4e46('0x22')],'type':_0x4e46('0x23')},'log':_0x4e46('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 000f08a..6f757be 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 _0xa45c=['name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','ami\x20disconnected','join','keys','module','action','Reload','Action','then','message','catch','isConnected','pick','command','Command','voiceQueues','strategy','available','pTalking','sumHoldTime','type','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','Interval','push','length','values','channels','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','find','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','validate','resolve','StopMixMonitor','destinationchannel','format','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicequeuechannel','queueChannels','voicequeuechannelhangup','Hangup','exten','context','telephones','trunks','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','moment','../../../config/environment','../properties','../ami','listen','%s/%s','SIP'];(function(_0x1858ea,_0x366f85){var _0x1c3ec2=function(_0x597b94){while(--_0x597b94){_0x1858ea['push'](_0x1858ea['shift']());}};_0x1c3ec2(++_0x366f85);}(_0xa45c,0x186));var _0xca45=function(_0x2114b2,_0x5b2411){_0x2114b2=_0x2114b2-0x0;var _0x1ea271=_0xa45c[_0x2114b2];return _0x1ea271;};'use strict';var _=require(_0xca45('0x0'));var util=require('util');var jayson=require(_0xca45('0x1'));var schema=require('validate');var BPromise=require('bluebird');var moment=require(_0xca45('0x2'));var config=require(_0xca45('0x3'));var properties=require(_0xca45('0x4'));var ami=require(_0xca45('0x5'));exports[_0xca45('0x6')]=function(_0x1b3c11,_0x25cf7c,_0x21371c){return new BPromise(function(_0x5c90ef,_0x509a41){var _0x2522f0={'QueuePause':function(_0x10bcd2){return new Promise(function(_0x438a08,_0x25f204){var _0x1d8c9c=util['format'](_0xca45('0x7'),_0xca45('0x8'),_0x10bcd2[_0xca45('0x9')]);if(_0x1b3c11[_0xca45('0xa')]&&_0x1b3c11[_0xca45('0xa')][_0x1d8c9c]&&_0x1b3c11[_0xca45('0xa')][_0x1d8c9c]['timer']){_0x1b3c11['timers'][_0x1d8c9c][_0xca45('0xb')]();}if(_0x1b3c11[_0xca45('0xc')][_0x1d8c9c]){_0x1b3c11[_0xca45('0xc')][_0x1d8c9c][_0xca45('0xd')]({'statePause':_0x10bcd2[_0xca45('0xe')]?!![]:![]});}_0x438a08({'code':0xc8,'message':_0xca45('0xf')});});},'Reload':function(_0x1149ef){var _0x2e659c=this;return new Promise(function(_0x1102b3,_0x232bf1){if(ami['isConnected']()==![]){return _0x232bf1(_0x2e659c[_0xca45('0x10')](0x1f4,[config[_0xca45('0x11')]['ip'],config[_0xca45('0x11')][_0xca45('0x12')],_0xca45('0x13')][_0xca45('0x14')]('\x20')));}_0x1149ef=_['pick'](_0x1149ef,_[_0xca45('0x15')](properties[_0xca45('0x16')]));_0x1149ef[_0xca45('0x17')]=_0xca45('0x18');return ami[_0xca45('0x19')](_0x1149ef)[_0xca45('0x1a')](function(_0x41b603){_0x1102b3({'code':0xc8,'message':_0x41b603[_0xca45('0x1b')]});})[_0xca45('0x1c')](function(_0xaff388){_0x232bf1(_0x2e659c['error'](0x1f5,_0xaff388[_0xca45('0x1b')]));});});},'Command':function(_0x1dab19){var _0x505419=this;return new Promise(function(_0x659fc7,_0x33e717){if(ami[_0xca45('0x1d')]()==![]){return _0x33e717(_0x505419[_0xca45('0x10')](0x1f4,[config[_0xca45('0x11')]['ip'],config[_0xca45('0x11')][_0xca45('0x12')],_0xca45('0x13')]['join']('\x20')));}_0x1dab19=_[_0xca45('0x1e')](_0x1dab19,_0xca45('0x1f'));_0x1dab19[_0xca45('0x17')]=_0xca45('0x20');return ami['Action'](_0x1dab19)['then'](function(_0x3809c6){_0x659fc7({'code':0xc8,'message':_0x3809c6['content']});})[_0xca45('0x1c')](function(_0x32ffb8){_0x33e717(_0x505419[_0xca45('0x10')](0x1f5,_0x32ffb8[_0xca45('0x1b')]));});});},'VoiceQueues':function(_0x5331e3){return new Promise(function(_0x38213d,_0x4cdd21){var _0x29de09=[];for(var _0x228f4e in _0x1b3c11['voiceQueues']){if(_0x1b3c11['voiceQueues']['hasOwnProperty'](_0x228f4e)){var _0x5355fd=_0x1b3c11[_0xca45('0x21')][_0x228f4e];var _0x2cc444={'id':_0x5355fd['id'],'name':_0x5355fd[_0xca45('0x9')],'strategy':_0x5355fd[_0xca45('0x22')],'answered':_0x5355fd['answered'],'available':_0x5355fd[_0xca45('0x23')],'loggedIn':_0x5355fd['loggedIn'],'pTalking':_0x5355fd[_0xca45('0x24')],'sumBillable':_0x5355fd['sumBillable'],'sumDuration':_0x5355fd['sumDuration'],'sumHoldTime':_0x5355fd[_0xca45('0x25')]||0x0,'talking':_0x5355fd['talking'],'total':_0x5355fd['total'],'type':_0x5355fd[_0xca45('0x26')],'unmanaged':_0x5355fd[_0xca45('0x27')],'abandoned':_0x5355fd['abandoned'],'waiting':_0x5355fd['waiting'],'loggedInDb':_0x5355fd[_0xca45('0x28')]};if(_0x5355fd[_0xca45('0x26')]==='outbound'){_0x2cc444[_0xca45('0x29')]=_0x5355fd[_0xca45('0x29')];_0x2cc444[_0xca45('0x2a')]=_0x5355fd['dialMethod'];_0x2cc444[_0xca45('0x2b')]=_0x5355fd[_0xca45('0x2b')];_0x2cc444[_0xca45('0x2c')]=_0x5355fd[_0xca45('0x2c')];_0x2cc444[_0xca45('0x2d')]=_0x5355fd[_0xca45('0x2d')];_0x2cc444[_0xca45('0x2e')]=_0x5355fd[_0xca45('0x2e')];_0x2cc444[_0xca45('0x2f')]=_0x5355fd[_0xca45('0x2f')];_0x2cc444[_0xca45('0x30')]=_0x5355fd['outboundAnswerCallsDay'];_0x2cc444['outboundBlacklistCallsDay']=_0x5355fd['outboundBlacklistCallsDay'];_0x2cc444[_0xca45('0x31')]=_0x5355fd['outboundBusyCallsDay'];_0x2cc444[_0xca45('0x32')]=_0x5355fd['outboundCongestionCallsDay'];_0x2cc444['outboundDropCallsDayACS']=_0x5355fd['outboundDropCallsDayACS'];_0x2cc444[_0xca45('0x33')]=_0x5355fd[_0xca45('0x33')];_0x2cc444['outboundDropCallsDayTimeout']=_0x5355fd[_0xca45('0x34')];_0x2cc444['outboundNoAnswerCallsDay']=_0x5355fd[_0xca45('0x35')];_0x2cc444[_0xca45('0x36')]=_0x5355fd[_0xca45('0x36')];_0x2cc444[_0xca45('0x37')]=_0x5355fd[_0xca45('0x37')];_0x2cc444[_0xca45('0x38')]=_0x5355fd['outboundReCallsDay'];_0x2cc444['outboundRejectCallsDay']=_0x5355fd[_0xca45('0x39')];_0x2cc444['outboundUnknownCallsDay']=_0x5355fd[_0xca45('0x3a')];_0x2cc444[_0xca45('0x3b')]=_0x5355fd[_0xca45('0x3b')];_0x2cc444[_0xca45('0x3c')]=_0x5355fd[_0xca45('0x3c')];_0x2cc444[_0xca45('0x3d')]=_0x5355fd[_0xca45('0x3d')];_0x2cc444['predictiveIntervalDroppedCallsCallersExit']=_0x5355fd[_0xca45('0x3e')];_0x2cc444['predictiveIntervalDroppedCallsTimeout']=_0x5355fd[_0xca45('0x3f')];_0x2cc444[_0xca45('0x40')]=_0x5355fd[_0xca45('0x40')];_0x2cc444['predictiveIntervalErlangCallsDroppedCalls']=_0x5355fd[_0xca45('0x41')];_0x2cc444[_0xca45('0x42')]=_0x5355fd['predictiveIntervalHitRate'];_0x2cc444[_0xca45('0x43')]=_0x5355fd[_0xca45('0x43')];_0x2cc444[_0xca45('0x44')]=_0x5355fd[_0xca45('0x44')];_0x2cc444[_0xca45('0x45')]=_0x5355fd[_0xca45('0x45')];_0x2cc444[_0xca45('0x46')]=_0x5355fd[_0xca45('0x46')];_0x2cc444[_0xca45('0x1b')]=_0x5355fd[_0xca45('0x1b')];_0x2cc444[_0xca45('0x47')]=_0x5355fd[_0xca45('0x47')];_0x2cc444[_0xca45('0x48')]=_0x5355fd[_0xca45('0x48')];_0x2cc444[_0xca45('0x49')]=_0x5355fd[_0xca45('0x49')];_0x2cc444[_0xca45('0x4a')]=_0x5355fd['erlangAbandonmentRate'];_0x2cc444[_0xca45('0x4b')]=_0x5355fd[_0xca45('0x4b')];_0x2cc444['startPredictive']=_0x5355fd['startPredictive'];_0x2cc444[_0xca45('0x4c')]=_0x5355fd[_0xca45('0x4c')];}if(_0x5355fd[_0xca45('0x4d')]){_0x2cc444[_0xca45('0x4d')]={'id':_0x5355fd[_0xca45('0x4d')]['id'],'name':_0x5355fd['Trunk'][_0xca45('0x9')],'active':_0x5355fd['Trunk'][_0xca45('0x4e')],'callerid':_0x5355fd[_0xca45('0x4d')]['callerid']};}if(_0x5355fd['Interval']){_0x2cc444[_0xca45('0x4f')]={'id':_0x5355fd[_0xca45('0x4f')]['id'],'name':_0x5355fd[_0xca45('0x4f')][_0xca45('0x9')]};}_0x29de09[_0xca45('0x50')](_0x2cc444);}}_0x38213d({'count':_0x29de09[_0xca45('0x51')],'rows':_0x29de09});});},'VoiceChannels':function(_0x2c41c4){return new Promise(function(_0x17a572,_0x3a316b){var _0x5837fc=_[_0xca45('0x52')](_0x1b3c11[_0xca45('0x53')]);_0x17a572({'count':_0x5837fc[_0xca45('0x51')],'rows':_0x5837fc});});},'VoiceChannelMixMonitor':function(_0x3cad22){var _0x44e5b7=this;return new Promise(function(_0x979f3d,_0x6e03f3){if(ami['isConnected']()==![]){return _0x6e03f3(_0x44e5b7[_0xca45('0x10')](0x1f4,[config['asterisk']['ip'],config[_0xca45('0x11')][_0xca45('0x12')],_0xca45('0x13')][_0xca45('0x14')]('\x20')));}var _0x1cb6b9=schema(properties[_0xca45('0x54')])['validate'](_0x3cad22);if(_0x1cb6b9[_0xca45('0x51')]>0x0){return _0x6e03f3(_0x44e5b7['error'](0x1f4,_[_0xca45('0x55')](_0x1cb6b9,'message')[_0xca45('0x14')](',\x20')));}var _0xf571be=_['find'](_0x1b3c11[_0xca45('0x53')],{'uniqueid':_0x3cad22[_0xca45('0x56')]});if(_0xf571be&&_0xf571be[_0xca45('0x57')]){var _0x2e6c67=util['format'](_0xca45('0x58'),_0x3cad22[_0xca45('0x59')]||_0x3cad22[_0xca45('0x56')],_0x3cad22['format']||_0xca45('0x5a'));return ami[_0xca45('0x19')]({'action':_0xca45('0x5b'),'channel':_0xf571be[_0xca45('0x57')],'file':_0x2e6c67,'options':_0xca45('0x5c')})[_0xca45('0x1a')](function(_0x301fc1){var _0x60ea40=_[_0xca45('0x5d')](_0xf571be[_0xca45('0x5e')],{'filename':'/var/spool/asterisk/monitor/'+_0x2e6c67[_0xca45('0x5f')]()});if(_[_0xca45('0x60')](_0x60ea40)){_0xf571be[_0xca45('0x5e')][_0xca45('0x50')]({'filename':_0xca45('0x61')+_0x2e6c67[_0xca45('0x5f')](),'createdAt':moment()['format'](_0xca45('0x62')),'mixmonitorid':_0x301fc1['mixmonitorid'],'status':_0xca45('0x63')});}else{_0x60ea40['mixmonitorid']=_0x301fc1[_0xca45('0x64')];_0x60ea40[_0xca45('0x65')]=_0xca45('0x63');}_0x979f3d({'code':0xc8,'message':[_0x3cad22[_0xca45('0x56')],_0xca45('0x66'),_0x301fc1['mixmonitorid']][_0xca45('0x14')]('\x20'),'mixmonitorid':_0x301fc1[_0xca45('0x64')]});})[_0xca45('0x1c')](function(_0x25c5ec){_0x6e03f3(_0x44e5b7[_0xca45('0x10')](0x1f5,[_0x3cad22[_0xca45('0x56')],_0x25c5ec['message'][_0xca45('0x5f')]()][_0xca45('0x14')]('\x20')));});}else{return _0x6e03f3(_0x44e5b7[_0xca45('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x4292f9){var _0x4a85c2=this;return new Promise(function(_0x2df44c,_0x7a86b2){if(ami['isConnected']()==![]){return _0x7a86b2(_0x4a85c2['error'](0x1f4,[config[_0xca45('0x11')]['ip'],config['asterisk'][_0xca45('0x12')],_0xca45('0x13')][_0xca45('0x14')]('\x20')));}var _0x13ccb7=schema(properties[_0xca45('0x54')])[_0xca45('0x67')](_0x4292f9);if(_0x13ccb7[_0xca45('0x51')]>0x0){return _0x7a86b2(_0x4a85c2[_0xca45('0x10')](0x1f4,_[_0xca45('0x55')](_0x13ccb7,_0xca45('0x1b'))[_0xca45('0x14')](',\x20')));}var _0x56d6ed=_[_0xca45('0x5d')](_0x1b3c11[_0xca45('0x53')],{'uniqueid':_0x4292f9[_0xca45('0x56')]});if(_0x56d6ed){return BPromise[_0xca45('0x68')]()[_0xca45('0x1a')](function(){if(_0x56d6ed[_0xca45('0x57')]){return ami['Action']({'action':_0xca45('0x69'),'channel':_0x56d6ed[_0xca45('0x57')],'mixmonitorid':_0x4292f9[_0xca45('0x64')]})[_0xca45('0x1c')](function(_0x48ac20){});}})[_0xca45('0x1a')](function(){if(_0x56d6ed[_0xca45('0x6a')]){return ami[_0xca45('0x19')]({'action':_0xca45('0x69'),'channel':_0x56d6ed[_0xca45('0x6a')],'mixmonitorid':_0x4292f9['mixmonitorid']})['catch'](function(_0x15f578){});}})[_0xca45('0x1a')](function(_0x30cb9a){var _0x7d1205=_['find'](_0x56d6ed[_0xca45('0x5e')],{'mixmonitorid':_0x4292f9['mixmonitorid']});if(_0x7d1205){_0x7d1205['status']='stop';}})[_0xca45('0x1a')](function(){var _0x2c9f9d=util[_0xca45('0x6b')]('%s.%s',_0x4292f9[_0xca45('0x59')]||_0x4292f9[_0xca45('0x56')],_0x4292f9[_0xca45('0x6b')]||_0xca45('0x5a'));var _0x334f43=_[_0xca45('0x5d')](_0x56d6ed[_0xca45('0x5e')],{'filename':_0xca45('0x61')+_0x2c9f9d['toLowerCase']()});if(_0x334f43){_0x334f43[_0xca45('0x65')]=_0xca45('0x6c');}})[_0xca45('0x1a')](function(){_0x2df44c({'code':0xc8,'message':[_0x4292f9[_0xca45('0x56')],_0xca45('0x6d')][_0xca45('0x14')]('\x20')});})[_0xca45('0x1c')](function(_0x5d2d92){_0x7a86b2(_0x4a85c2['error'](0x1f5,[_0x4292f9[_0xca45('0x56')],_0x5d2d92['message'][_0xca45('0x5f')]()][_0xca45('0x14')]('\x20')));});}else{return _0x7a86b2(_0x4a85c2[_0xca45('0x10')](0x1f5,_0xca45('0x6e')));}});},'VoiceQueuesChannels':function(_0x4e877c){return new Promise(function(_0x38d145,_0x360ce7){var _0x1404ba=_['values'](_0x1b3c11['queueChannels']);_0x38d145({'count':_0x1404ba[_0xca45('0x51')],'rows':_0x1404ba});});},'VoiceQueuesChannel':function(_0x48d236){var _0x2f2911=this;return new Promise(function(_0x594d6f,_0x269d12){var _0x3c30d0=schema(properties[_0xca45('0x6f')])['validate'](_0x48d236);if(_0x3c30d0[_0xca45('0x51')]>0x0){return _0x269d12(_0x2f2911[_0xca45('0x10')](0x1f4,_[_0xca45('0x55')](_0x3c30d0,'message')[_0xca45('0x14')](',\x20')));}var _0x4a4409=_['find'](_0x1b3c11[_0xca45('0x70')],{'uniqueid':_0x48d236['uniqueid']});if(_0x4a4409){_0x594d6f(_0x4a4409);}else{return _0x269d12(_0x2f2911['error'](0x1f5,_0xca45('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x5fa099){var _0x11c2f9=this;return new Promise(function(_0x168f9e,_0x467222){if(ami[_0xca45('0x1d')]()==![]){return _0x467222(_0x11c2f9['error'](0x1f4,[config['asterisk']['ip'],config[_0xca45('0x11')][_0xca45('0x12')],_0xca45('0x13')]['join']('\x20')));}var _0x42cc44=schema(properties[_0xca45('0x71')])['validate'](_0x5fa099);if(_0x42cc44['length']>0x0){return _0x467222(_0x11c2f9[_0xca45('0x10')](0x1f4,_[_0xca45('0x55')](_0x42cc44,_0xca45('0x1b'))[_0xca45('0x14')](',\x20')));}var _0xd433e7=_[_0xca45('0x5d')](_0x1b3c11[_0xca45('0x70')],{'uniqueid':_0x5fa099[_0xca45('0x56')]});if(_0xd433e7&&_0xd433e7[_0xca45('0x57')]){return ami[_0xca45('0x19')]({'action':_0xca45('0x72'),'channel':_0xd433e7[_0xca45('0x57')]})['then'](function(_0x289edb){_0x168f9e({'code':0xc8,'message':[_0x5fa099[_0xca45('0x56')],_0x289edb[_0xca45('0x1b')][_0xca45('0x5f')]()]['join']('\x20')});})[_0xca45('0x1c')](function(_0x43fcd6){_0x467222(_0x11c2f9['error'](0x1f5,[_0x5fa099[_0xca45('0x56')],_0x43fcd6[_0xca45('0x1b')][_0xca45('0x5f')]()][_0xca45('0x14')]('\x20')));});}else{return _0x467222(_0x11c2f9[_0xca45('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x2b04b2){var _0x448564=this;return new Promise(function(_0x1c2d61,_0x20338f){if(ami[_0xca45('0x1d')]()==![]){return _0x20338f(_0x448564[_0xca45('0x10')](0x1f4,[config[_0xca45('0x11')]['ip'],config[_0xca45('0x11')][_0xca45('0x12')],_0xca45('0x13')][_0xca45('0x14')]('\x20')));}var _0x502ee0=schema(properties['voicequeuechannelredirect'])['validate'](_0x2b04b2);if(_0x502ee0[_0xca45('0x51')]>0x0){return _0x20338f(_0x448564[_0xca45('0x10')](0x1f4,_[_0xca45('0x55')](_0x502ee0,'message')[_0xca45('0x14')](',\x20')));}var _0x440e0f=_[_0xca45('0x5d')](_0x1b3c11[_0xca45('0x70')],{'uniqueid':_0x2b04b2[_0xca45('0x56')]});if(_0x440e0f&&_0x440e0f[_0xca45('0x57')]){return ami['Action']({'action':'Redirect','channel':_0x440e0f[_0xca45('0x57')],'exten':_0x2b04b2[_0xca45('0x73')],'context':_0x2b04b2[_0xca45('0x74')]||_0x440e0f[_0xca45('0x74')],'priority':0x1})[_0xca45('0x1a')](function(_0x37ae80){_0x1c2d61({'code':0xc8,'message':[_0x2b04b2['uniqueid'],_0x37ae80[_0xca45('0x1b')]['toLowerCase']()][_0xca45('0x14')]('\x20')});})['catch'](function(_0x45b0c1){_0x20338f(_0x448564[_0xca45('0x10')](0x1f5,[_0x2b04b2[_0xca45('0x56')],_0x45b0c1[_0xca45('0x1b')]['toLowerCase']()][_0xca45('0x14')]('\x20')));});}else{return _0x20338f(_0x448564[_0xca45('0x10')](0x1f5,_0xca45('0x6e')));}});},'Agents':function(_0x4115a9){return new Promise(function(_0x4144b1,_0x55b145){var _0x3704df=_[_0xca45('0x52')](_0x1b3c11[_0xca45('0xc')]);_0x4144b1({'count':_0x3704df[_0xca45('0x51')],'rows':_0x3704df});});},'Telephones':function(_0x5f246a){return new Promise(function(_0x6463a5,_0x37bf8f){var _0x21c867=_[_0xca45('0x52')](_0x1b3c11[_0xca45('0x75')]);_0x6463a5({'count':_0x21c867[_0xca45('0x51')],'rows':_0x21c867});});},'Trunks':function(_0x10a1f7){return new Promise(function(_0x1bfce3,_0x159485){var _0xa322e4=_['values'](_0x1b3c11[_0xca45('0x76')]);_0x1bfce3({'count':_0xa322e4[_0xca45('0x51')],'rows':_0xa322e4});});},'OutboundChannels':function(_0x3e67a9){return new Promise(function(_0x3eb6e4,_0x5b8e34){var _0x45046f=_[_0xca45('0x52')](_0x1b3c11['outboundChannels']);_0x3eb6e4({'count':_0x45046f[_0xca45('0x51')],'rows':_0x45046f});});},'Outbound':function(_0x4ae7e9){return new Promise(function(_0x172deb,_0x4960b6){_0x172deb(_0x1b3c11[_0xca45('0x77')]);});},'Campaigns':function(_0x5dbe57){return new Promise(function(_0x36af3e,_0x95a735){var _0x5bcc9d=_['values'](_0x1b3c11[_0xca45('0x78')]);_0x36af3e({'count':_0x5bcc9d[_0xca45('0x51')],'rows':_0x5bcc9d});});},'VoiceQueuesPreview':function(_0x2a3059){var _0x8949af=this;return new Promise(function(_0x32ca48,_0x49c16b){_0x25cf7c[_0xca45('0x79')](_0x2a3059['id'])[_0xca45('0x1a')](function(_0x43af2b){_0x32ca48({'code':0xc8,'message':_0x43af2b[_0xca45('0x1b')]});})['catch'](function(_0x39cd8f){_0x49c16b(_0x8949af[_0xca45('0x10')](0x1f4,_0x39cd8f[_0xca45('0x1b')]));});});},'EventManager':function(_0x42a271){var _0x2e346b=this;return new Promise(function(_0x4198bc,_0x28dcd2){if(!_0x42a271[_0xca45('0x7a')]){return _0x28dcd2(_0x2e346b[_0xca45('0x10')](0x1f4,_0xca45('0x7b')));}ami[_0xca45('0x7c')](_0xca45('0x7d')+_0x42a271['event'],_0x42a271[_0xca45('0x1b')]);_0x4198bc({'code':0xc8,'message':_0x42a271});});},'FaxAccounts':function(_0x21fbd5){return new Promise(function(_0x548a5c,_0x256f53){var _0x5e098a=_[_0xca45('0x52')](_0x1b3c11[_0xca45('0x7e')]);_0x548a5c({'count':_0x5e098a['length'],'rows':_0x5e098a});});},'SendFax':function(_0x2028ed){var _0x145ed0=this;return new Promise(function(_0x5f3575,_0x42339c){_0x21371c[_0xca45('0x7f')](_0x2028ed)[_0xca45('0x1a')](function(_0x52d9b5){_0x5f3575({'code':0xc8,'message':_0x52d9b5[_0xca45('0x1b')]});})[_0xca45('0x1c')](function(_0x2c8ea8){_0x42339c(_0x145ed0[_0xca45('0x10')](0x1f4,_0x2c8ea8[_0xca45('0x1b')]));});});},'CheckAfterSend':function(_0x3de9af){var _0x2d1f6a=this;return new Promise(function(_0x2940d3,_0x51af68){_0x21371c['checkAfterSend'](_0x3de9af)[_0xca45('0x1a')](function(_0x5887dd){_0x2940d3({'code':0xc8,'message':_0x5887dd['message']});})[_0xca45('0x1c')](function(_0x36e8ec){_0x51af68(_0x2d1f6a['error'](0x1f4,_0x36e8ec[_0xca45('0x1b')]));});});}};var _0x4e3b13=jayson[_0xca45('0x80')](_0x2522f0)[_0xca45('0x81')]();_0x4e3b13['on'](_0xca45('0x10'),function(_0x480952){return _0x509a41(_0x480952);});_0x4e3b13[_0xca45('0x6')](0x232a,_0xca45('0x82'),function(){console['log'](_0xca45('0x83'),0x232a);return _0x5c90ef(_0xca45('0x84')+0x232a);});});}; \ No newline at end of file +var _0xa940=['unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','callerid','Interval','push','values','length','username','voicechannel','validate','map','find','uniqueid','channel','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','channels','StopMixMonitor','destinationchannel','stop','%s.%s','filename','wav','monitors','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten','context','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','ami\x20disconnected','join','keys','module','action','Reload','Action','catch','message','command','Command','then','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','type'];(function(_0x4452dc,_0x479149){var _0x52b892=function(_0x4a0098){while(--_0x4a0098){_0x4452dc['push'](_0x4452dc['shift']());}};_0x52b892(++_0x479149);}(_0xa940,0x168));var _0x0a94=function(_0x1642a7,_0x2e72f1){_0x1642a7=_0x1642a7-0x0;var _0x41eb0c=_0xa940[_0x1642a7];return _0x41eb0c;};'use strict';var _=require('lodash');var util=require(_0x0a94('0x0'));var jayson=require(_0x0a94('0x1'));var schema=require('validate');var BPromise=require(_0x0a94('0x2'));var moment=require(_0x0a94('0x3'));var config=require(_0x0a94('0x4'));var properties=require(_0x0a94('0x5'));var ami=require(_0x0a94('0x6'));exports[_0x0a94('0x7')]=function(_0x5c71ba,_0x399c79,_0x3c1e1b){return new BPromise(function(_0x4a103c,_0x2f6b77){var _0x50ea05={'QueuePause':function(_0x41697a){return new Promise(function(_0x385ae5,_0x402795){var _0x414e58=util[_0x0a94('0x8')](_0x0a94('0x9'),_0x0a94('0xa'),_0x41697a[_0x0a94('0xb')]);if(_0x5c71ba[_0x0a94('0xc')]&&_0x5c71ba[_0x0a94('0xc')][_0x414e58]&&_0x5c71ba[_0x0a94('0xc')][_0x414e58][_0x0a94('0xd')]){_0x5c71ba[_0x0a94('0xc')][_0x414e58][_0x0a94('0xe')]();}if(_0x5c71ba[_0x0a94('0xf')][_0x414e58]){_0x5c71ba[_0x0a94('0xf')][_0x414e58][_0x0a94('0x10')]({'statePause':_0x41697a[_0x0a94('0x11')]?!![]:![]});}_0x385ae5({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x4787f8){var _0x1ba3ac=this;return new Promise(function(_0x96be8d,_0x50f0b2){if(ami[_0x0a94('0x12')]()==![]){return _0x50f0b2(_0x1ba3ac[_0x0a94('0x13')](0x1f4,[config[_0x0a94('0x14')]['ip'],config[_0x0a94('0x14')]['username'],_0x0a94('0x15')][_0x0a94('0x16')]('\x20')));}_0x4787f8=_['pick'](_0x4787f8,_[_0x0a94('0x17')](properties[_0x0a94('0x18')]));_0x4787f8[_0x0a94('0x19')]=_0x0a94('0x1a');return ami[_0x0a94('0x1b')](_0x4787f8)['then'](function(_0x5492cb){_0x96be8d({'code':0xc8,'message':_0x5492cb['message']});})[_0x0a94('0x1c')](function(_0x5d9cdf){_0x50f0b2(_0x1ba3ac[_0x0a94('0x13')](0x1f5,_0x5d9cdf[_0x0a94('0x1d')]));});});},'Command':function(_0x5647fd){var _0x12ed20=this;return new Promise(function(_0x416f8d,_0xa47fab){if(ami[_0x0a94('0x12')]()==![]){return _0xa47fab(_0x12ed20[_0x0a94('0x13')](0x1f4,[config[_0x0a94('0x14')]['ip'],config[_0x0a94('0x14')]['username'],_0x0a94('0x15')][_0x0a94('0x16')]('\x20')));}_0x5647fd=_['pick'](_0x5647fd,_0x0a94('0x1e'));_0x5647fd['action']=_0x0a94('0x1f');return ami[_0x0a94('0x1b')](_0x5647fd)[_0x0a94('0x20')](function(_0x1de4c3){_0x416f8d({'code':0xc8,'message':_0x1de4c3['content']});})['catch'](function(_0x106044){_0xa47fab(_0x12ed20[_0x0a94('0x13')](0x1f5,_0x106044[_0x0a94('0x1d')]));});});},'VoiceQueues':function(_0x178842){return new Promise(function(_0x3ed8ed,_0x9e6377){var _0x170b2c=[];for(var _0x2a8233 in _0x5c71ba[_0x0a94('0x21')]){if(_0x5c71ba[_0x0a94('0x21')][_0x0a94('0x22')](_0x2a8233)){var _0x47d6da=_0x5c71ba['voiceQueues'][_0x2a8233];var _0x28918d={'id':_0x47d6da['id'],'name':_0x47d6da[_0x0a94('0xb')],'strategy':_0x47d6da[_0x0a94('0x23')],'answered':_0x47d6da[_0x0a94('0x24')],'available':_0x47d6da[_0x0a94('0x25')],'loggedIn':_0x47d6da[_0x0a94('0x26')],'pTalking':_0x47d6da[_0x0a94('0x27')],'sumBillable':_0x47d6da['sumBillable'],'sumDuration':_0x47d6da[_0x0a94('0x28')],'sumHoldTime':_0x47d6da[_0x0a94('0x29')]||0x0,'talking':_0x47d6da[_0x0a94('0x2a')],'total':_0x47d6da[_0x0a94('0x2b')],'type':_0x47d6da[_0x0a94('0x2c')],'unmanaged':_0x47d6da[_0x0a94('0x2d')],'abandoned':_0x47d6da[_0x0a94('0x2e')],'waiting':_0x47d6da['waiting'],'loggedInDb':_0x47d6da[_0x0a94('0x2f')]};if(_0x47d6da[_0x0a94('0x2c')]===_0x0a94('0x30')){_0x28918d[_0x0a94('0x31')]=_0x47d6da[_0x0a94('0x31')];_0x28918d[_0x0a94('0x32')]=_0x47d6da[_0x0a94('0x32')];_0x28918d['dialOriginateCallerIdName']=_0x47d6da['dialOriginateCallerIdName'];_0x28918d['dialOriginateCallerIdNumber']=_0x47d6da[_0x0a94('0x33')];_0x28918d[_0x0a94('0x34')]=_0x47d6da[_0x0a94('0x34')];_0x28918d[_0x0a94('0x35')]=_0x47d6da[_0x0a94('0x35')];_0x28918d[_0x0a94('0x36')]=_0x47d6da[_0x0a94('0x36')];_0x28918d[_0x0a94('0x37')]=_0x47d6da['outboundAnswerCallsDay'];_0x28918d['outboundBlacklistCallsDay']=_0x47d6da[_0x0a94('0x38')];_0x28918d[_0x0a94('0x39')]=_0x47d6da[_0x0a94('0x39')];_0x28918d['outboundCongestionCallsDay']=_0x47d6da['outboundCongestionCallsDay'];_0x28918d[_0x0a94('0x3a')]=_0x47d6da['outboundDropCallsDayACS'];_0x28918d[_0x0a94('0x3b')]=_0x47d6da['outboundDropCallsDayCallersExit'];_0x28918d['outboundDropCallsDayTimeout']=_0x47d6da['outboundDropCallsDayTimeout'];_0x28918d[_0x0a94('0x3c')]=_0x47d6da['outboundNoAnswerCallsDay'];_0x28918d['outboundNoSuchCallsDay']=_0x47d6da[_0x0a94('0x3d')];_0x28918d['outboundOriginateFailureCallsDay']=_0x47d6da[_0x0a94('0x3e')];_0x28918d[_0x0a94('0x3f')]=_0x47d6da[_0x0a94('0x3f')];_0x28918d[_0x0a94('0x40')]=_0x47d6da['outboundRejectCallsDay'];_0x28918d[_0x0a94('0x41')]=_0x47d6da[_0x0a94('0x41')];_0x28918d['predictiveIntervalAnsweredCalls']=_0x47d6da['predictiveIntervalAnsweredCalls'];_0x28918d[_0x0a94('0x42')]=_0x47d6da['predictiveIntervalAvgHoldtime'];_0x28918d[_0x0a94('0x43')]=_0x47d6da[_0x0a94('0x43')];_0x28918d['predictiveIntervalDroppedCallsCallersExit']=_0x47d6da[_0x0a94('0x44')];_0x28918d[_0x0a94('0x45')]=_0x47d6da['predictiveIntervalDroppedCallsTimeout'];_0x28918d['predictiveIntervalErlangCalls']=_0x47d6da[_0x0a94('0x46')];_0x28918d[_0x0a94('0x47')]=_0x47d6da[_0x0a94('0x47')];_0x28918d[_0x0a94('0x48')]=_0x47d6da['predictiveIntervalHitRate'];_0x28918d[_0x0a94('0x49')]=_0x47d6da[_0x0a94('0x49')];_0x28918d['predictiveIntervalPauses']=_0x47d6da[_0x0a94('0x4a')];_0x28918d[_0x0a94('0x4b')]=_0x47d6da[_0x0a94('0x4b')];_0x28918d[_0x0a94('0x4c')]=_0x47d6da[_0x0a94('0x4c')];_0x28918d[_0x0a94('0x1d')]=_0x47d6da[_0x0a94('0x1d')];_0x28918d[_0x0a94('0x4d')]=_0x47d6da[_0x0a94('0x4d')];_0x28918d['erlangCalls']=_0x47d6da[_0x0a94('0x4e')];_0x28918d['erlangCallToSecond']=_0x47d6da[_0x0a94('0x4f')];_0x28918d[_0x0a94('0x50')]=_0x47d6da[_0x0a94('0x50')];_0x28918d[_0x0a94('0x51')]=_0x47d6da[_0x0a94('0x51')];_0x28918d['startPredictive']=_0x47d6da['startPredictive'];_0x28918d[_0x0a94('0x52')]=_0x47d6da[_0x0a94('0x52')];}if(_0x47d6da[_0x0a94('0x53')]){_0x28918d['Trunk']={'id':_0x47d6da[_0x0a94('0x53')]['id'],'name':_0x47d6da[_0x0a94('0x53')][_0x0a94('0xb')],'active':_0x47d6da['Trunk']['active'],'callerid':_0x47d6da[_0x0a94('0x53')][_0x0a94('0x54')]};}if(_0x47d6da[_0x0a94('0x55')]){_0x28918d[_0x0a94('0x55')]={'id':_0x47d6da[_0x0a94('0x55')]['id'],'name':_0x47d6da[_0x0a94('0x55')][_0x0a94('0xb')]};}_0x170b2c[_0x0a94('0x56')](_0x28918d);}}_0x3ed8ed({'count':_0x170b2c['length'],'rows':_0x170b2c});});},'VoiceChannels':function(_0x34a719){return new Promise(function(_0x92cd8b,_0x55de48){var _0x299514=_[_0x0a94('0x57')](_0x5c71ba['channels']);_0x92cd8b({'count':_0x299514[_0x0a94('0x58')],'rows':_0x299514});});},'VoiceChannelMixMonitor':function(_0x16e2b2){var _0x1ff14a=this;return new Promise(function(_0x4dc593,_0x534386){if(ami[_0x0a94('0x12')]()==![]){return _0x534386(_0x1ff14a['error'](0x1f4,[config['asterisk']['ip'],config[_0x0a94('0x14')][_0x0a94('0x59')],_0x0a94('0x15')][_0x0a94('0x16')]('\x20')));}var _0x490ded=schema(properties[_0x0a94('0x5a')])[_0x0a94('0x5b')](_0x16e2b2);if(_0x490ded[_0x0a94('0x58')]>0x0){return _0x534386(_0x1ff14a[_0x0a94('0x13')](0x1f4,_[_0x0a94('0x5c')](_0x490ded,'message')[_0x0a94('0x16')](',\x20')));}var _0x6bcd28=_[_0x0a94('0x5d')](_0x5c71ba['channels'],{'uniqueid':_0x16e2b2[_0x0a94('0x5e')]});if(_0x6bcd28&&_0x6bcd28[_0x0a94('0x5f')]){var _0x2ab01d=util[_0x0a94('0x8')]('%s.%s',_0x16e2b2['filename']||_0x16e2b2['uniqueid'],_0x16e2b2[_0x0a94('0x8')]||'wav');return ami[_0x0a94('0x1b')]({'action':_0x0a94('0x60'),'channel':_0x6bcd28[_0x0a94('0x5f')],'file':_0x2ab01d,'options':_0x0a94('0x61')})['then'](function(_0x1a5bbb){var _0x4270ab=_[_0x0a94('0x5d')](_0x6bcd28['monitors'],{'filename':_0x0a94('0x62')+_0x2ab01d['toLowerCase']()});if(_['isNil'](_0x4270ab)){_0x6bcd28['monitors'][_0x0a94('0x56')]({'filename':_0x0a94('0x62')+_0x2ab01d[_0x0a94('0x63')](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x1a5bbb['mixmonitorid'],'status':'rec'});}else{_0x4270ab[_0x0a94('0x64')]=_0x1a5bbb[_0x0a94('0x64')];_0x4270ab[_0x0a94('0x65')]=_0x0a94('0x66');}_0x4dc593({'code':0xc8,'message':[_0x16e2b2['uniqueid'],_0x0a94('0x67'),_0x1a5bbb[_0x0a94('0x64')]][_0x0a94('0x16')]('\x20'),'mixmonitorid':_0x1a5bbb[_0x0a94('0x64')]});})[_0x0a94('0x1c')](function(_0x335a25){_0x534386(_0x1ff14a[_0x0a94('0x13')](0x1f5,[_0x16e2b2[_0x0a94('0x5e')],_0x335a25[_0x0a94('0x1d')][_0x0a94('0x63')]()][_0x0a94('0x16')]('\x20')));});}else{return _0x534386(_0x1ff14a['error'](0x1f5,_0x0a94('0x68')));}});},'VoiceChannelStopMixMonitor':function(_0x43c1e9){var _0x56cb6c=this;return new Promise(function(_0x56f8ab,_0x52d237){if(ami[_0x0a94('0x12')]()==![]){return _0x52d237(_0x56cb6c[_0x0a94('0x13')](0x1f4,[config[_0x0a94('0x14')]['ip'],config['asterisk'][_0x0a94('0x59')],_0x0a94('0x15')][_0x0a94('0x16')]('\x20')));}var _0x51a299=schema(properties[_0x0a94('0x5a')])[_0x0a94('0x5b')](_0x43c1e9);if(_0x51a299['length']>0x0){return _0x52d237(_0x56cb6c['error'](0x1f4,_[_0x0a94('0x5c')](_0x51a299,_0x0a94('0x1d'))['join'](',\x20')));}var _0x30527b=_[_0x0a94('0x5d')](_0x5c71ba[_0x0a94('0x69')],{'uniqueid':_0x43c1e9[_0x0a94('0x5e')]});if(_0x30527b){return BPromise['resolve']()[_0x0a94('0x20')](function(){if(_0x30527b['channel']){return ami[_0x0a94('0x1b')]({'action':_0x0a94('0x6a'),'channel':_0x30527b['channel'],'mixmonitorid':_0x43c1e9[_0x0a94('0x64')]})[_0x0a94('0x1c')](function(_0x44417a){});}})[_0x0a94('0x20')](function(){if(_0x30527b[_0x0a94('0x6b')]){return ami['Action']({'action':_0x0a94('0x6a'),'channel':_0x30527b['destinationchannel'],'mixmonitorid':_0x43c1e9[_0x0a94('0x64')]})[_0x0a94('0x1c')](function(_0x509291){});}})[_0x0a94('0x20')](function(_0x1bb87a){var _0x10aa82=_[_0x0a94('0x5d')](_0x30527b['monitors'],{'mixmonitorid':_0x43c1e9[_0x0a94('0x64')]});if(_0x10aa82){_0x10aa82[_0x0a94('0x65')]=_0x0a94('0x6c');}})[_0x0a94('0x20')](function(){var _0x22b3ae=util[_0x0a94('0x8')](_0x0a94('0x6d'),_0x43c1e9[_0x0a94('0x6e')]||_0x43c1e9[_0x0a94('0x5e')],_0x43c1e9[_0x0a94('0x8')]||_0x0a94('0x6f'));var _0x3340ec=_['find'](_0x30527b[_0x0a94('0x70')],{'filename':_0x0a94('0x62')+_0x22b3ae[_0x0a94('0x63')]()});if(_0x3340ec){_0x3340ec[_0x0a94('0x65')]=_0x0a94('0x6c');}})[_0x0a94('0x20')](function(){_0x56f8ab({'code':0xc8,'message':[_0x43c1e9[_0x0a94('0x5e')],_0x0a94('0x71')][_0x0a94('0x16')]('\x20')});})[_0x0a94('0x1c')](function(_0x3edb16){_0x52d237(_0x56cb6c[_0x0a94('0x13')](0x1f5,[_0x43c1e9[_0x0a94('0x5e')],_0x3edb16[_0x0a94('0x1d')][_0x0a94('0x63')]()][_0x0a94('0x16')]('\x20')));});}else{return _0x52d237(_0x56cb6c[_0x0a94('0x13')](0x1f5,_0x0a94('0x68')));}});},'VoiceQueuesChannels':function(_0x116d3a){return new Promise(function(_0x446863,_0x1eded9){var _0x4393b8=_[_0x0a94('0x57')](_0x5c71ba[_0x0a94('0x72')]);_0x446863({'count':_0x4393b8[_0x0a94('0x58')],'rows':_0x4393b8});});},'VoiceQueuesChannel':function(_0x2a93d9){var _0x3e9f1=this;return new Promise(function(_0x3eaf61,_0x42d14d){var _0x57e086=schema(properties[_0x0a94('0x73')])[_0x0a94('0x5b')](_0x2a93d9);if(_0x57e086['length']>0x0){return _0x42d14d(_0x3e9f1[_0x0a94('0x13')](0x1f4,_[_0x0a94('0x5c')](_0x57e086,_0x0a94('0x1d'))[_0x0a94('0x16')](',\x20')));}var _0x236dad=_[_0x0a94('0x5d')](_0x5c71ba[_0x0a94('0x72')],{'uniqueid':_0x2a93d9['uniqueid']});if(_0x236dad){_0x3eaf61(_0x236dad);}else{return _0x42d14d(_0x3e9f1['error'](0x1f5,_0x0a94('0x68')));}});},'VoiceQueuesChannelHangup':function(_0x4efc62){var _0x3a42ec=this;return new Promise(function(_0x1b51d4,_0x4e271a){if(ami[_0x0a94('0x12')]()==![]){return _0x4e271a(_0x3a42ec[_0x0a94('0x13')](0x1f4,[config[_0x0a94('0x14')]['ip'],config[_0x0a94('0x14')][_0x0a94('0x59')],_0x0a94('0x15')]['join']('\x20')));}var _0x244d00=schema(properties[_0x0a94('0x74')])[_0x0a94('0x5b')](_0x4efc62);if(_0x244d00[_0x0a94('0x58')]>0x0){return _0x4e271a(_0x3a42ec['error'](0x1f4,_[_0x0a94('0x5c')](_0x244d00,_0x0a94('0x1d'))[_0x0a94('0x16')](',\x20')));}var _0x2f4e24=_[_0x0a94('0x5d')](_0x5c71ba[_0x0a94('0x72')],{'uniqueid':_0x4efc62['uniqueid']});if(_0x2f4e24&&_0x2f4e24[_0x0a94('0x5f')]){return ami[_0x0a94('0x1b')]({'action':_0x0a94('0x75'),'channel':_0x2f4e24[_0x0a94('0x5f')]})[_0x0a94('0x20')](function(_0x12d7cc){_0x1b51d4({'code':0xc8,'message':[_0x4efc62[_0x0a94('0x5e')],_0x12d7cc['message'][_0x0a94('0x63')]()][_0x0a94('0x16')]('\x20')});})[_0x0a94('0x1c')](function(_0x156174){_0x4e271a(_0x3a42ec[_0x0a94('0x13')](0x1f5,[_0x4efc62[_0x0a94('0x5e')],_0x156174[_0x0a94('0x1d')][_0x0a94('0x63')]()][_0x0a94('0x16')]('\x20')));});}else{return _0x4e271a(_0x3a42ec[_0x0a94('0x13')](0x1f5,_0x0a94('0x68')));}});},'VoiceQueuesChannelRedirect':function(_0x54ce65){var _0x1f6788=this;return new Promise(function(_0x22e9dd,_0x3cd5cc){if(ami[_0x0a94('0x12')]()==![]){return _0x3cd5cc(_0x1f6788['error'](0x1f4,[config[_0x0a94('0x14')]['ip'],config['asterisk'][_0x0a94('0x59')],_0x0a94('0x15')][_0x0a94('0x16')]('\x20')));}var _0x311d90=schema(properties['voicequeuechannelredirect'])[_0x0a94('0x5b')](_0x54ce65);if(_0x311d90[_0x0a94('0x58')]>0x0){return _0x3cd5cc(_0x1f6788['error'](0x1f4,_[_0x0a94('0x5c')](_0x311d90,'message')[_0x0a94('0x16')](',\x20')));}var _0x33b8bb=_[_0x0a94('0x5d')](_0x5c71ba['queueChannels'],{'uniqueid':_0x54ce65[_0x0a94('0x5e')]});if(_0x33b8bb&&_0x33b8bb['channel']){return ami[_0x0a94('0x1b')]({'action':_0x0a94('0x76'),'channel':_0x33b8bb[_0x0a94('0x5f')],'exten':_0x54ce65[_0x0a94('0x77')],'context':_0x54ce65[_0x0a94('0x78')]||_0x33b8bb['context'],'priority':0x1})[_0x0a94('0x20')](function(_0xadb74){_0x22e9dd({'code':0xc8,'message':[_0x54ce65[_0x0a94('0x5e')],_0xadb74['message'][_0x0a94('0x63')]()][_0x0a94('0x16')]('\x20')});})[_0x0a94('0x1c')](function(_0x375a2f){_0x3cd5cc(_0x1f6788[_0x0a94('0x13')](0x1f5,[_0x54ce65[_0x0a94('0x5e')],_0x375a2f['message']['toLowerCase']()][_0x0a94('0x16')]('\x20')));});}else{return _0x3cd5cc(_0x1f6788[_0x0a94('0x13')](0x1f5,_0x0a94('0x68')));}});},'Agents':function(_0x518d9c){return new Promise(function(_0x3929ef,_0x53b720){var _0x52a107=_['values'](_0x5c71ba['agents']);_0x3929ef({'count':_0x52a107[_0x0a94('0x58')],'rows':_0x52a107});});},'Telephones':function(_0x2ffe7b){return new Promise(function(_0x343091,_0x302b18){var _0x579db2=_[_0x0a94('0x57')](_0x5c71ba['telephones']);_0x343091({'count':_0x579db2[_0x0a94('0x58')],'rows':_0x579db2});});},'Trunks':function(_0x15d0e8){return new Promise(function(_0x2e2d95,_0x43fa09){var _0x3d854a=_[_0x0a94('0x57')](_0x5c71ba[_0x0a94('0x79')]);_0x2e2d95({'count':_0x3d854a[_0x0a94('0x58')],'rows':_0x3d854a});});},'OutboundChannels':function(_0x4fa7b7){return new Promise(function(_0x1e5b4a,_0x2255f0){var _0x1603ef=_['values'](_0x5c71ba[_0x0a94('0x7a')]);_0x1e5b4a({'count':_0x1603ef[_0x0a94('0x58')],'rows':_0x1603ef});});},'Outbound':function(_0x335cae){return new Promise(function(_0x284023,_0x168504){_0x284023(_0x5c71ba[_0x0a94('0x30')]);});},'Campaigns':function(_0x1c7ef9){return new Promise(function(_0x58013d,_0x4263a7){var _0x4b8760=_[_0x0a94('0x57')](_0x5c71ba[_0x0a94('0x7b')]);_0x58013d({'count':_0x4b8760[_0x0a94('0x58')],'rows':_0x4b8760});});},'VoiceQueuesPreview':function(_0x24a013){var _0x132925=this;return new Promise(function(_0x42b732,_0x1613c3){_0x399c79['run'](_0x24a013['id'])['then'](function(_0x57141c){_0x42b732({'code':0xc8,'message':_0x57141c[_0x0a94('0x1d')]});})['catch'](function(_0x25def4){_0x1613c3(_0x132925[_0x0a94('0x13')](0x1f4,_0x25def4[_0x0a94('0x1d')]));});});},'EventManager':function(_0xf3eeee){var _0x44db62=this;return new Promise(function(_0x33c145,_0x293df8){if(!_0xf3eeee[_0x0a94('0x7c')]){return _0x293df8(_0x44db62[_0x0a94('0x13')](0x1f4,_0x0a94('0x7d')));}ami[_0x0a94('0x7e')](_0x0a94('0x7f')+_0xf3eeee[_0x0a94('0x7c')],_0xf3eeee[_0x0a94('0x1d')]);_0x33c145({'code':0xc8,'message':_0xf3eeee});});},'FaxAccounts':function(_0xd58108){return new Promise(function(_0x5bb1d5,_0x443c6c){var _0x33e133=_[_0x0a94('0x57')](_0x5c71ba[_0x0a94('0x80')]);_0x5bb1d5({'count':_0x33e133[_0x0a94('0x58')],'rows':_0x33e133});});},'SendFax':function(_0x276233){var _0x67976c=this;return new Promise(function(_0x30abf9,_0x19b0b9){_0x3c1e1b[_0x0a94('0x81')](_0x276233)['then'](function(_0x8db910){_0x30abf9({'code':0xc8,'message':_0x8db910['message']});})[_0x0a94('0x1c')](function(_0x42c826){_0x19b0b9(_0x67976c[_0x0a94('0x13')](0x1f4,_0x42c826['message']));});});},'CheckAfterSend':function(_0x10cdf7){var _0x4ea5d6=this;return new Promise(function(_0x17bd9c,_0x3fc3c6){_0x3c1e1b[_0x0a94('0x82')](_0x10cdf7)[_0x0a94('0x20')](function(_0x5f560f){_0x17bd9c({'code':0xc8,'message':_0x5f560f[_0x0a94('0x1d')]});})[_0x0a94('0x1c')](function(_0x158149){_0x3fc3c6(_0x4ea5d6[_0x0a94('0x13')](0x1f4,_0x158149['message']));});});}};var _0x8f037=jayson[_0x0a94('0x83')](_0x50ea05)['http']();_0x8f037['on'](_0x0a94('0x13'),function(_0x5e03c9){return _0x2f6b77(_0x5e03c9);});_0x8f037[_0x0a94('0x7')](0x232a,_0x0a94('0x84'),function(){console[_0x0a94('0x85')](_0x0a94('0x86'),0x232a);return _0x4a103c('RPC\x20listening\x20on\x20port:'+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 9d41167..3443fbd 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 _0xe03b=['name','trigger:%s','action','toLowerCase','merge','[%s][%s]\x20Contact\x20not\x20found','createContact','[%s][%s]\x20Contact\x20created:%s','catch','[%s][%s]\x20Error\x20creating\x20contact','stringify','[%s][%s]\x20Autocreate\x20disabled','bluebird','util','lodash','ioredis','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','[%s][%s]','emit','exec','autoCreate','data2','data1','calleridnum','isNil','routeId','calleridname','','uniqueid','firstName','destcalleridname','destcalleridnum','phone','resolve','then','showContact','omit','info','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','format','user:%s'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe03b,0x155));var _0xbe03=function(_0x2aad87,_0x442b48){_0x2aad87=_0x2aad87-0x0;var _0x364649=_0xe03b[_0x2aad87];return _0x364649;};'use strict';var BPromise=require(_0xbe03('0x0'));var util=require(_0xbe03('0x1'));var _=require(_0xbe03('0x2'));var Redis=require(_0xbe03('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe03('0x4'))(_0xbe03('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0xbe03('0x6')]=_[_0xbe03('0x7')](config[_0xbe03('0x6')],{'host':_0xbe03('0x8'),'port':0x18eb});var io=require(_0xbe03('0x9'))(new Redis(config[_0xbe03('0x6')]));function emit(_0x1b3887,_0x41b8e1,_0x42034b,_0x13ebc0){logger['info'](_0xbe03('0xa'),_0x1b3887,'',_0x41b8e1,_0x42034b,JSON['stringify'](_0x13ebc0));io['to'](_0x41b8e1)[_0xbe03('0xb')](_0x42034b,_0x13ebc0);}exports[_0xbe03('0xc')]=function(_0x2352f8,_0x3a239e,_0x1a487d){_0x1a487d[_0xbe03('0xd')]=0x0;if(_0x3a239e[_0xbe03('0xe')]&&parseInt(_0x3a239e['data2'],0xa)){var _0x4be753={'ListId':parseInt(_0x3a239e[_0xbe03('0xf')],0xa),'phone':_0x1a487d[_0xbe03('0x10')]};if(_[_0xbe03('0x11')](_0x1a487d[_0xbe03('0x12')])){_0x4be753['firstName']=_0x1a487d['calleridname']&&_0x1a487d[_0xbe03('0x13')]!==_0xbe03('0x14')?_0x1a487d[_0xbe03('0x13')]:_0x1a487d['calleridnum']||_0x1a487d[_0xbe03('0x15')];}else{_0x4be753[_0xbe03('0x16')]=_0x1a487d[_0xbe03('0x17')]&&_0x1a487d[_0xbe03('0x17')]!==_0xbe03('0x14')?_0x1a487d[_0xbe03('0x17')]:_0x1a487d[_0xbe03('0x18')]||_0x1a487d['uniqueid'];_0x4be753[_0xbe03('0x19')]=_0x1a487d[_0xbe03('0x17')]&&_0x1a487d[_0xbe03('0x17')]!==_0xbe03('0x14')?_0x1a487d[_0xbe03('0x17')]:_0x1a487d[_0xbe03('0x18')]||_0x1a487d[_0xbe03('0x15')];}BPromise[_0xbe03('0x1a')]()[_0xbe03('0x1b')](cmContactRpc[_0xbe03('0x1c')]({'where':_[_0xbe03('0x1d')](_0x4be753,[_0xbe03('0x16')])}))['then'](function(_0x5b0157){if(_0x5b0157){logger[_0xbe03('0x1e')](_0xbe03('0x1f'),_0x1a487d[_0xbe03('0x15')],'',_0x5b0157['id']);if(_0x2352f8){_0x1a487d[_0xbe03('0x20')]=_0x5b0157['id'];emit(_0x1a487d[_0xbe03('0x15')],util[_0xbe03('0x21')](_0xbe03('0x22'),_0x2352f8[_0xbe03('0x23')]),util[_0xbe03('0x21')](_0xbe03('0x24'),_0x3a239e[_0xbe03('0x25')][_0xbe03('0x26')]()),_[_0xbe03('0x27')](_0x1a487d,{'ListId':parseInt(_0x3a239e[_0xbe03('0xf')],0xa)}));}return;}else{logger[_0xbe03('0x1e')](_0xbe03('0x28'),_0x1a487d['uniqueid'],'');return BPromise[_0xbe03('0x1a')]()[_0xbe03('0x1b')](cmContactRpc[_0xbe03('0x29')](_0x4be753));}})['then'](function(_0xbd6569){if(_0xbd6569){logger[_0xbe03('0x1e')](_0xbe03('0x2a'),_0x1a487d[_0xbe03('0x15')],'',_0xbd6569['id']);if(_0x2352f8){_0x1a487d['xmd-contactid2']=_0xbd6569['id'];emit(_0x1a487d[_0xbe03('0x15')],util[_0xbe03('0x21')](_0xbe03('0x22'),_0x2352f8[_0xbe03('0x23')]),util[_0xbe03('0x21')](_0xbe03('0x24'),_0x3a239e['action'][_0xbe03('0x26')]()),_[_0xbe03('0x27')](_0x1a487d,{'ListId':parseInt(_0x3a239e['data1'],0xa)}));}}})[_0xbe03('0x2b')](function(_0xdf97f2){logger['error'](_0xbe03('0x2c'),_0x1a487d[_0xbe03('0x15')],'',JSON[_0xbe03('0x2d')](_0xdf97f2));});}else{if(_0x2352f8){logger[_0xbe03('0x1e')](_0xbe03('0x2e'),_0x1a487d['uniqueid'],'');emit(_0x1a487d['uniqueid'],util[_0xbe03('0x21')](_0xbe03('0x22'),_0x2352f8['name']),util[_0xbe03('0x21')](_0xbe03('0x24'),_0x3a239e[_0xbe03('0x25')][_0xbe03('0x26')]()),_['merge']({'ListId':parseInt(_0x3a239e[_0xbe03('0xf')],0xa)},_0x1a487d));}}}; \ No newline at end of file +var _0xf3f9=['ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','stringify','autoCreate','data2','data1','calleridnum','isNil','routeId','firstName','calleridname','destcalleridname','','destcalleridnum','uniqueid','then','omit','[%s][%s]\x20Contact\x20found:%s','format','name','action','toLowerCase','resolve','createContact','[%s][%s]\x20Contact\x20created:%s','xmd-contactid2','user:%s','trigger:%s','merge','catch','[%s][%s]\x20Error\x20creating\x20contact','bluebird','util'];(function(_0x129f47,_0x2d4e0c){var _0xcaf42a=function(_0x46a26d){while(--_0x46a26d){_0x129f47['push'](_0x129f47['shift']());}};_0xcaf42a(++_0x2d4e0c);}(_0xf3f9,0x1de));var _0x9f3f=function(_0x1b53ba,_0x1f33ec){_0x1b53ba=_0x1b53ba-0x0;var _0x52b28f=_0xf3f9[_0x1b53ba];return _0x52b28f;};'use strict';var BPromise=require(_0x9f3f('0x0'));var util=require(_0x9f3f('0x1'));var _=require('lodash');var Redis=require(_0x9f3f('0x2'));var config=require(_0x9f3f('0x3'));var logger=require(_0x9f3f('0x4'))(_0x9f3f('0x5'));var cmContactRpc=require(_0x9f3f('0x6'));config[_0x9f3f('0x7')]=_[_0x9f3f('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9f3f('0x9'))(new Redis(config['redis']));function emit(_0x17b150,_0x4a9a17,_0x373b80,_0xa6b3ae){logger[_0x9f3f('0xa')]('[%s][%s]',_0x17b150,'',_0x4a9a17,_0x373b80,JSON[_0x9f3f('0xb')](_0xa6b3ae));io['to'](_0x4a9a17)['emit'](_0x373b80,_0xa6b3ae);}exports['exec']=function(_0x5add2e,_0x52806e,_0x435966){_0x435966[_0x9f3f('0xc')]=0x0;if(_0x52806e[_0x9f3f('0xd')]&&parseInt(_0x52806e[_0x9f3f('0xd')],0xa)){var _0xd63ce8={'ListId':parseInt(_0x52806e[_0x9f3f('0xe')],0xa),'phone':_0x435966[_0x9f3f('0xf')]};if(_[_0x9f3f('0x10')](_0x435966[_0x9f3f('0x11')])){_0xd63ce8[_0x9f3f('0x12')]=_0x435966[_0x9f3f('0x13')]&&_0x435966[_0x9f3f('0x13')]!==''?_0x435966[_0x9f3f('0x13')]:_0x435966[_0x9f3f('0xf')]||_0x435966['uniqueid'];}else{_0xd63ce8['firstName']=_0x435966[_0x9f3f('0x14')]&&_0x435966[_0x9f3f('0x14')]!==_0x9f3f('0x15')?_0x435966[_0x9f3f('0x14')]:_0x435966[_0x9f3f('0x16')]||_0x435966[_0x9f3f('0x17')];_0xd63ce8['phone']=_0x435966[_0x9f3f('0x14')]&&_0x435966[_0x9f3f('0x14')]!==_0x9f3f('0x15')?_0x435966[_0x9f3f('0x14')]:_0x435966[_0x9f3f('0x16')]||_0x435966[_0x9f3f('0x17')];}BPromise['resolve']()[_0x9f3f('0x18')](cmContactRpc['showContact']({'where':_[_0x9f3f('0x19')](_0xd63ce8,[_0x9f3f('0x12')])}))['then'](function(_0x3e276d){if(_0x3e276d){logger[_0x9f3f('0xa')](_0x9f3f('0x1a'),_0x435966[_0x9f3f('0x17')],'',_0x3e276d['id']);if(_0x5add2e){_0x435966['xmd-contactid2']=_0x3e276d['id'];emit(_0x435966['uniqueid'],util[_0x9f3f('0x1b')]('user:%s',_0x5add2e[_0x9f3f('0x1c')]),util['format']('trigger:%s',_0x52806e[_0x9f3f('0x1d')][_0x9f3f('0x1e')]()),_['merge'](_0x435966,{'ListId':parseInt(_0x52806e[_0x9f3f('0xe')],0xa)}));}return;}else{logger['info']('[%s][%s]\x20Contact\x20not\x20found',_0x435966[_0x9f3f('0x17')],'');return BPromise[_0x9f3f('0x1f')]()[_0x9f3f('0x18')](cmContactRpc[_0x9f3f('0x20')](_0xd63ce8));}})['then'](function(_0x1f8ce9){if(_0x1f8ce9){logger['info'](_0x9f3f('0x21'),_0x435966[_0x9f3f('0x17')],'',_0x1f8ce9['id']);if(_0x5add2e){_0x435966[_0x9f3f('0x22')]=_0x1f8ce9['id'];emit(_0x435966['uniqueid'],util[_0x9f3f('0x1b')](_0x9f3f('0x23'),_0x5add2e[_0x9f3f('0x1c')]),util[_0x9f3f('0x1b')](_0x9f3f('0x24'),_0x52806e['action']['toLowerCase']()),_[_0x9f3f('0x25')](_0x435966,{'ListId':parseInt(_0x52806e['data1'],0xa)}));}}})[_0x9f3f('0x26')](function(_0x3187cb){logger['error'](_0x9f3f('0x27'),_0x435966['uniqueid'],'',JSON['stringify'](_0x3187cb));});}else{if(_0x5add2e){logger['info']('[%s][%s]\x20Autocreate\x20disabled',_0x435966[_0x9f3f('0x17')],'');emit(_0x435966[_0x9f3f('0x17')],util['format'](_0x9f3f('0x23'),_0x5add2e[_0x9f3f('0x1c')]),util[_0x9f3f('0x1b')](_0x9f3f('0x24'),_0x52806e[_0x9f3f('0x1d')]['toLowerCase']()),_[_0x9f3f('0x25')]({'ListId':parseInt(_0x52806e[_0x9f3f('0xe')],0xa)},_0x435966));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index cf12ce8..2f0a9f6 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 _0x5025=['salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','freshdeskAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','checkTriggers','interface','triggers','status','checkTrigger','merge','variables','length','Actions','action','contactmanager','motionbar','browser','data1','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','windowWidth','800','data5','windowHeight','600','data6','winApplication','winArguments','name','format','toLowerCase','jscripty','trigger:%s','user:%s','exec','integration','accounts','queue','routeId','urlforward','script','parse','query','search','replace','every','AllConditions','checkConditions','channel','AnyConditions','field','account','chat','ChatWebsiteId','value','AccountId','upperFirst','interaction','message','operator','event','agent','membername','lastevent','exports','util','lodash','url','mustache','ioredis','./integration','./cmContact','./script','../rpc/cmContact','../../../config/environment','../../../config/logger','../ami','redis','defaults','socket.io-emitter','popup','winapp','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts'];(function(_0x201fce,_0x35b92e){var _0x44dad3=function(_0x3ce235){while(--_0x3ce235){_0x201fce['push'](_0x201fce['shift']());}};_0x44dad3(++_0x35b92e);}(_0x5025,0xdc));var _0x5502=function(_0x1d6dea,_0x1f8978){_0x1d6dea=_0x1d6dea-0x0;var _0x1b5967=_0x5025[_0x1d6dea];return _0x1b5967;};'use strict';var util=require(_0x5502('0x0'));var _=require(_0x5502('0x1'));var url=require(_0x5502('0x2'));var Mustache=require(_0x5502('0x3'));var Redis=require(_0x5502('0x4'));var urlforward=require('./urlforward');var integration=require(_0x5502('0x5'));var cmContact=require(_0x5502('0x6'));var script=require(_0x5502('0x7'));var cmContactRpc=require(_0x5502('0x8'));var config=require(_0x5502('0x9'));var logger=require(_0x5502('0xa'))('trigger');var ami=require(_0x5502('0xb'));config[_0x5502('0xc')]=_[_0x5502('0xd')](config[_0x5502('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x5502('0xe'))(new Redis(config[_0x5502('0xc')]));var operators={'equals':function(_0x24f542,_0xf4bdd0){return _0x24f542==_0xf4bdd0;},'not_equals':function(_0x5a6421,_0x3e5077){return _0x5a6421!=_0x3e5077;}};var barAndWebActions=[_0x5502('0xf'),'url',_0x5502('0x10')];function Trigger(_0x547b28){this['triggers']=_0x547b28['triggers'];this[_0x5502('0x11')]=_0x547b28[_0x5502('0x11')];this['voiceQueues']=_0x547b28[_0x5502('0x12')];this['templates']=_0x547b28[_0x5502('0x13')];this[_0x5502('0x14')]=_0x547b28[_0x5502('0x14')];this[_0x5502('0x15')]=_0x547b28[_0x5502('0x15')];this['freshdeskAccounts']=_0x547b28['freshdeskAccounts'];this[_0x5502('0x16')]=_0x547b28[_0x5502('0x16')];this[_0x5502('0x17')]=_0x547b28[_0x5502('0x17')];this[_0x5502('0x18')]=_0x547b28[_0x5502('0x18')];this[_0x5502('0x19')]=_0x547b28[_0x5502('0x19')];this[_0x5502('0x1a')]=_0x547b28[_0x5502('0x1a')];this[_0x5502('0x1b')]=_0x547b28[_0x5502('0x1b')];this[_0x5502('0x1c')]=_0x547b28[_0x5502('0x1c')];this[_0x5502('0x1d')]=_0x547b28[_0x5502('0x1d')];this['accounts']={'zendesk':this[_0x5502('0x15')],'salesforce':this[_0x5502('0x16')],'freshdesk':this[_0x5502('0x1e')],'sugarcrm':this[_0x5502('0x17')],'zoho':this[_0x5502('0x18')],'desk':this[_0x5502('0x19')],'vtiger':this[_0x5502('0x1a')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x5502('0x1d')],'servicenow':this['servicenowAccounts']};ami['on'](_0x5502('0x1f'),this[_0x5502('0x20')][_0x5502('0x21')](this));ami['on'](_0x5502('0x22'),this[_0x5502('0x20')][_0x5502('0x21')](this));ami['on'](_0x5502('0x23'),this[_0x5502('0x20')][_0x5502('0x21')](this));ami['on']('custom:agentcomplete',this[_0x5502('0x20')][_0x5502('0x21')](this));ami['on'](_0x5502('0x24'),this[_0x5502('0x20')]['bind'](this));ami['on'](_0x5502('0x25'),this[_0x5502('0x20')]['bind'](this));ami['on']('custom:agentbusy',this['syncCustomEvent'][_0x5502('0x21')](this));ami['on']('custom:agentcongestion',this[_0x5502('0x20')][_0x5502('0x21')](this));ami['on']('custom:agentreject',this[_0x5502('0x20')][_0x5502('0x21')](this));ami['on'](_0x5502('0x26'),this[_0x5502('0x20')]['bind'](this));ami['on'](_0x5502('0x27'),this[_0x5502('0x20')][_0x5502('0x21')](this));ami['on']('custom:dialbegin',this[_0x5502('0x28')][_0x5502('0x21')](this));ami['on'](_0x5502('0x29'),this['syncAgentDial'][_0x5502('0x21')](this));ami['on'](_0x5502('0x2a'),this[_0x5502('0x28')][_0x5502('0x21')](this));ami['on']('custom:newinteraction',this['syncCustomEvent'][_0x5502('0x21')](this));ami['on'](_0x5502('0x2b'),this[_0x5502('0x20')][_0x5502('0x21')](this));ami['on']('custom:incomingmessage',this[_0x5502('0x20')][_0x5502('0x21')](this));ami['on'](_0x5502('0x2c'),this[_0x5502('0x20')][_0x5502('0x21')](this));ami['on'](_0x5502('0x2d'),this[_0x5502('0x20')]['bind'](this));ami['on'](_0x5502('0x2e'),this[_0x5502('0x20')]['bind'](this));}Trigger[_0x5502('0x2f')][_0x5502('0x30')]=function(_0x2e6d7f,_0x15a989,_0x404173){logger[_0x5502('0x31')](_0x2e6d7f,_0x15a989,JSON[_0x5502('0x32')](_0x404173));io['to'](_0x2e6d7f)[_0x5502('0x30')](_0x15a989,_0x404173);};Trigger[_0x5502('0x2f')]['syncCustomEvent']=function(_0x17fcf9){var _0x1adff8=_[_0x5502('0x33')](_0x17fcf9);this[_0x5502('0x34')](_0x1adff8);};Trigger[_0x5502('0x2f')][_0x5502('0x28')]=function(_0x1afe81){if(this[_0x5502('0x11')][_0x1afe81[_0x5502('0x35')]]){this[_0x5502('0x20')](_0x1afe81);}};Trigger[_0x5502('0x2f')][_0x5502('0x34')]=function(_0x340e66){var _0x2ecb88;for(var _0x53e520 in this[_0x5502('0x36')]){if(this[_0x5502('0x36')]['hasOwnProperty'](_0x53e520)){if(this['triggers'][_0x53e520][_0x5502('0x37')]){_0x2ecb88=this[_0x5502('0x38')](this[_0x5502('0x36')][_0x53e520],_0x340e66);if(_0x2ecb88){_[_0x5502('0x39')](_0x340e66,_0x340e66[_0x5502('0x3a')]);for(var _0x3c01c4=0x0,_0x1a345b,_0x426883,_0x5c6793;_0x3c01c40x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0x2f2360,_0x151089){var _0x1cc8d3=function(_0x5e356f){while(--_0x5e356f){_0x2f2360['push'](_0x2f2360['shift']());}};_0x1cc8d3(++_0x151089);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 92a12fc..48af4ef 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 _0x0048=['stripTrailingSlash','serverUrl','tenantId','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','then','isNil','validateEmail','email','userEmail','length','isdisabled','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','toLowerCase','destcalleridnum','calleridnum','/systemusers(','headers','odata-entityid','substring','lastIndexOf','message','contacts?$select=telephone1','4.0','value','outbound','telephone1','enduserId','contactid',']\x20Enduser\x20Created!','forEach','type','string','nameField','customField','idField','indexOf','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls','callDirection','queue','ticketType','ticketId','format','user:%s','trigger:browser:url'];(function(_0x452583,_0x1d4bb6){var _0x2347c9=function(_0x3b3374){while(--_0x3b3374){_0x452583['push'](_0x452583['shift']());}};_0x2347c9(++_0x1d4bb6);}(_0x0048,0x197));var _0x8004=function(_0x591781,_0x8e0ed2){_0x591781=_0x591781-0x0;var _0x315bd9=_0x0048[_0x591781];return _0x315bd9;};'use strict';var _=require(_0x8004('0x0'));var BPromise=require(_0x8004('0x1'));var rp=require(_0x8004('0x2'));var util=require(_0x8004('0x3'));var intUtil=require('./util');var md5=require(_0x8004('0x4'));var Redis=require(_0x8004('0x5'));var logger=require(_0x8004('0x6'))('dynamics365');var config=require(_0x8004('0x7'));config[_0x8004('0x8')]=_[_0x8004('0x9')](config[_0x8004('0x8')],{'host':_0x8004('0xa'),'port':0x18eb});var io=require(_0x8004('0xb'))(new Redis(config[_0x8004('0x8')]));function getAuthToken(_0x102e14,_0x122e62,_0x42d9de){var _0x46fecb={'method':_0x8004('0xc'),'uri':_0x122e62,'form':{'client_id':_0x102e14[_0x8004('0xd')],'resource':_0x102e14[_0x8004('0xe')],'username':_0x102e14[_0x8004('0xf')],'password':_0x102e14[_0x8004('0x10')],'grant_type':_0x8004('0x10'),'client_secret':_0x102e14[_0x8004('0x11')]},'json':!![]};return rp(_0x46fecb)['then'](function(_0x1e7ae9){return _0x1e7ae9[_0x8004('0x12')];})[_0x8004('0x13')](function(_0x384c28){logger['error']('['+[_0x42d9de[_0x8004('0x14')]()]+_0x8004('0x15'));return _0x384c28['message'];});}function getUser(_0x5ddc5e,_0x1652aa,_0x4f8254,_0x1ae7c0,_0xfff7dd,_0x23f0b3){return new BPromise(function(_0x2c8f2c,_0x6d0e0d){return getAuthToken(_0x1652aa,_0x1ae7c0,_0x23f0b3)['then'](function(_0x5be178){var _0x31268={'method':_0x8004('0x16'),'uri':_0xfff7dd+_0x8004('0x17'),'headers':{'Authorization':_0x8004('0x18')+_0x5be178,'OData-Version':'4.0'},'json':!![]};return rp(_0x31268);})[_0x8004('0x19')](function(_0x52e426){var _0x40dd0c=_0x52e426['value'];var _0x115559=![];var _0x3d1696=null;if(!_[_0x8004('0x1a')](_0x4f8254)){if(intUtil[_0x8004('0x1b')](_0x4f8254[_0x8004('0x1c')])){_0x5ddc5e[_0x8004('0x1d')]=_0x4f8254['email'];for(_0x3d1696=0x0;_0x3d1696<_0x40dd0c[_0x8004('0x1e')];_0x3d1696++){if(_0x40dd0c[_0x3d1696]['internalemailaddress']===_0x4f8254['email']&&!_0x40dd0c[_0x3d1696][_0x8004('0x1f')]){_0x115559=!![];logger[_0x8004('0x20')]('['+[_0x23f0b3['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x40dd0c[_0x3d1696][_0x8004('0x21')]+'!');_0x5ddc5e[_0x8004('0x22')]=_0x40dd0c[_0x3d1696][_0x8004('0x21')];}}}}if(!_0x115559){logger['info']('['+[_0x23f0b3[_0x8004('0x14')]()]+_0x8004('0x23'));_0x5ddc5e[_0x8004('0x1d')]=_0x1652aa[_0x8004('0xf')];for(_0x3d1696=0x0;_0x3d1696<_0x40dd0c[_0x8004('0x1e')];_0x3d1696++){if(_0x40dd0c[_0x3d1696][_0x8004('0x24')]===_0x1652aa[_0x8004('0xf')]){_0x5ddc5e[_0x8004('0x22')]=_0x40dd0c[_0x3d1696][_0x8004('0x21')];}}}_0x2c8f2c(_0x5ddc5e);})[_0x8004('0x13')](function(_0x2e6e75){_0x6d0e0d(_0x2e6e75['message']);});});}function createEndUser(_0x101e32,_0x351d11,_0x5018b7,_0x549efb,_0x2c0524,_0x4768d0){return new BPromise(function(_0x26b5fb,_0x573dc5){return getAuthToken(_0x351d11,_0x5018b7,_0x4768d0)[_0x8004('0x19')](function(_0x20fe8e){var _0x3d5251=_0x4768d0[_0x8004('0x25')]()==='outbound'?_0x2c0524[_0x8004('0x26')]:_0x2c0524[_0x8004('0x27')];var _0x19ca91={'method':_0x8004('0xc'),'uri':_0x549efb+'contacts','body':{'telephone1':_0x3d5251,'fullname':_0x3d5251,'firstname':_0x3d5251,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8004('0x28')+_0x101e32['userId']+')'},'headers':{'Authorization':_0x8004('0x18')+_0x20fe8e,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x19ca91);})[_0x8004('0x19')](function(_0x4e75ff){var _0x58aad6=_0x4e75ff[_0x8004('0x29')][_0x8004('0x2a')];var _0x37bc4f=_0x58aad6[_0x8004('0x2b')](_0x58aad6['lastIndexOf']('(')+0x1,_0x58aad6[_0x8004('0x2c')](')'));_0x101e32['enduserId']=_0x37bc4f;_0x26b5fb(_0x101e32);})[_0x8004('0x13')](function(_0x9155f4){_0x573dc5(_0x9155f4[_0x8004('0x2d')]);});});}function getEndUser(_0xfbf077,_0x2a71eb,_0xf74ab1,_0x275318,_0x531aa1,_0xa10781){return new BPromise(function(_0x47c75c,_0x4d3852){return getAuthToken(_0x2a71eb,_0xf74ab1,_0xa10781)[_0x8004('0x19')](function(_0x2c7ec5){var _0x7990ee={'method':_0x8004('0x16'),'uri':_0x275318+_0x8004('0x2e'),'headers':{'Authorization':_0x8004('0x18')+_0x2c7ec5,'If-None-Match':null,'OData-Version':_0x8004('0x2f')},'json':!![]};return rp(_0x7990ee);})[_0x8004('0x19')](function(_0x2c9f7c){var _0x5712ee=null;if(_0x2c9f7c){var _0x4c8c8f=_0x2c9f7c[_0x8004('0x30')];var _0x28a968=![];for(_0x5712ee=0x0;_0x5712ee<_0x4c8c8f[_0x8004('0x1e')];_0x5712ee++){var _0x43537e=_0xa10781[_0x8004('0x25')]()===_0x8004('0x31')?_0x531aa1[_0x8004('0x26')]:_0x531aa1[_0x8004('0x27')];if(_0x4c8c8f[_0x5712ee][_0x8004('0x32')]===_0x43537e){_0x28a968=!![];_0xfbf077[_0x8004('0x33')]=_0x4c8c8f[_0x5712ee][_0x8004('0x34')];}}if(_0x28a968){_0x47c75c(_0xfbf077);}else{return createEndUser(_0xfbf077,_0x2a71eb,_0xf74ab1,_0x275318,_0x531aa1,_0xa10781)[_0x8004('0x19')](function(_0x543390){logger[_0x8004('0x20')]('['+[_0xa10781['toUpperCase']()]+']\x20Enduser\x20created!',_0x543390['enduserId']);_0x47c75c(_0x543390);});}}else{return createEndUser(_0xfbf077,_0x2a71eb,_0xf74ab1,_0x275318,_0x531aa1,_0xa10781)[_0x8004('0x19')](function(_0x1b12ac){logger[_0x8004('0x20')]('['+[_0xa10781[_0x8004('0x14')]()]+_0x8004('0x35'),_0x1b12ac[_0x8004('0x33')]);_0x47c75c(_0x1b12ac);});}});});}function getCustomFields(_0x3e266e,_0x3cf294,_0x4a7a1d){var _0x3875eb={};if(_0x3e266e['length']>0x0){_[_0x8004('0x36')](_0x3e266e,function(_0x6e3678){if(_0x6e3678[_0x8004('0x37')]===_0x8004('0x38')&&_0x6e3678[_0x8004('0x39')]&&!_0x6e3678[_0x8004('0x3a')]){var _0xb6ecdb=_0x6e3678[_0x8004('0x3b')][_0x8004('0x25')]();var _0x3bf49d=_0xb6ecdb[_0x8004('0x2b')](0x0,_0xb6ecdb[_0x8004('0x3c')]('_'));var _0x17cd27=_0xb6ecdb[_0x8004('0x2b')](_0xb6ecdb[_0x8004('0x3c')]('_')+0x1);if(_0x3bf49d===_0x4a7a1d){_0x3875eb[_0x17cd27]=_0x6e3678['content'];}}});}return _0x3875eb;}function getTicket(_0x271b08,_0x226bbc,_0x34901f,_0x286e3b,_0x4c1279,_0x547bb7,_0x297596){return new BPromise(function(_0x38b8ef,_0x11a67e){var _0x1e0693;return getAuthToken(_0x226bbc,_0x34901f,_0x297596)[_0x8004('0x19')](function(_0x48be01){if(_0x547bb7['ticketType']===_0x8004('0x3d')){_0x1e0693={'method':_0x8004('0xc'),'uri':_0x286e3b+_0x8004('0x3e'),'body':Object[_0x8004('0x3f')]({},{'title':intUtil[_0x8004('0x40')](_0x547bb7[_0x8004('0x41')],_0x4c1279,'\x20'),'description':intUtil['getString'](_0x547bb7[_0x8004('0x42')],_0x4c1279,'\x0a'),'customerid_contact@odata.bind':_0x8004('0x43')+_0x271b08[_0x8004('0x33')]+')','ownerid@odata.bind':_0x8004('0x28')+_0x271b08['userId']+')','caseorigincode':'1'},getCustomFields(_0x547bb7[_0x8004('0x44')],_0x4c1279,_0x547bb7['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x48be01,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x547bb7['ticketType']===_0x8004('0x45')){_0x1e0693={'method':_0x8004('0xc'),'uri':_0x286e3b+_0x8004('0x46'),'body':Object['assign']({},{'subject':intUtil[_0x8004('0x40')](_0x547bb7[_0x8004('0x41')],_0x4c1279,'\x20'),'phonenumber':String(_0x4c1279['calleridnum']),'description':intUtil[_0x8004('0x40')](_0x547bb7[_0x8004('0x42')],_0x4c1279,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x271b08[_0x8004('0x33')]+')','ownerid@odata.bind':_0x8004('0x28')+_0x271b08[_0x8004('0x22')]+')','directioncode':_0x271b08[_0x8004('0x47')]===_0x8004('0x48')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x8004('0x28')+_0x271b08['userId']+')','participationtypemask':_0x271b08[_0x8004('0x47')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x271b08[_0x8004('0x33')]+')','participationtypemask':_0x271b08['callDirection']===_0x8004('0x48')?0x1:0x2}]},getCustomFields(_0x547bb7[_0x8004('0x44')],_0x4c1279,_0x547bb7[_0x8004('0x49')])),'headers':{'Authorization':_0x8004('0x18')+_0x48be01,'OData-Version':_0x8004('0x2f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1e0693);})['then'](function(_0x30ea72){var _0x3c18cb=_0x30ea72[_0x8004('0x29')][_0x8004('0x2a')];var _0x2e30ca=_0x3c18cb[_0x8004('0x2b')](_0x3c18cb['lastIndexOf']('(')+0x1,_0x3c18cb[_0x8004('0x2c')](')'));_0x271b08[_0x8004('0x4a')]=_0x2e30ca;_0x38b8ef(_0x271b08);})[_0x8004('0x13')](function(_0x508c91){_0x11a67e(_0x508c91['message']);});});}function emit(_0x5dbcef,_0x40dd9b,_0x1ec678,_0xae164c){var _0x10a08d={'uri':util[_0x8004('0x4b')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x5dbcef,_0x1ec678,_0xae164c)};io['to'](util['format'](_0x8004('0x4c'),_0x40dd9b))['emit'](_0x8004('0x4d'),_0x10a08d);}exports['cs']=function(_0x4f1740,_0x13b9b6,_0x30b5a0,_0x27df58,_0x457488,_0x4d7104,_0xb1cefe,_0x292016){var _0x19ae32={};_0x4d7104[_0x8004('0xe')]=intUtil[_0x8004('0x4e')](_0x4d7104[_0x8004('0xe')]);_0x4d7104[_0x8004('0x4f')]=intUtil[_0x8004('0x4e')](_0x4d7104[_0x8004('0x4f')]);_0x19ae32[_0x8004('0x47')]=_0x292016===_0x8004('0x48')||_0x292016==='unmanaged'?_0x8004('0x48'):_0x8004('0x31');var _0x4b2da2=util[_0x8004('0x4b')]('%s/api/data/v9.0/',_0x4d7104[_0x8004('0xe')]);var _0x1fa167=util[_0x8004('0x4b')]('https://login.microsoftonline.com/%s/oauth2/token',_0x4d7104[_0x8004('0x50')]);var _0x4c5580=util[_0x8004('0x4b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4d7104[_0x8004('0x4f')],_0x13b9b6['uniqueid'],md5(_0x13b9b6['uniqueid']));if(_0x457488&&_0x457488[_0x8004('0x51')]){logger['info'](_0x8004('0x52'),'Recording\x20is\x20enabled!');_0x13b9b6[_0x8004('0x53')]=_0x4c5580;}else if(_0xb1cefe&&_0xb1cefe[_0x8004('0x54')]&&_0xb1cefe['recordingFormat']!==_0x8004('0x55')){logger[_0x8004('0x20')](_0x8004('0x56'),_0x8004('0x57'));_0x13b9b6['recordingURL']=_0x4c5580;}else{_0x13b9b6['recordingURL']='';}return getUser(_0x19ae32,_0x4d7104,_0x27df58,_0x1fa167,_0x4b2da2,_0x292016)[_0x8004('0x19')](function(_0x5c0690){logger[_0x8004('0x20')]('['+_0x292016['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x5c0690[_0x8004('0x22')]);logger['info']('['+_0x292016[_0x8004('0x14')]()+_0x8004('0x58'),_0x5c0690[_0x8004('0x1d')]);return getEndUser(_0x5c0690,_0x4d7104,_0x1fa167,_0x4b2da2,_0x13b9b6,_0x292016);})[_0x8004('0x19')](function(_0x3a375a){logger[_0x8004('0x20')]('['+_0x292016['toUpperCase']()+_0x8004('0x59'),_0x3a375a[_0x8004('0x33')]);logger[_0x8004('0x20')]('['+_0x292016[_0x8004('0x14')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x13b9b6['calleridnum']);return getTicket(_0x3a375a,_0x4d7104,_0x1fa167,_0x4b2da2,_0x13b9b6,_0x30b5a0,_0x292016);})[_0x8004('0x19')](function(_0x135c17){logger[_0x8004('0x20')](util[_0x8004('0x4b')]('['+_0x292016[_0x8004('0x14')]()+_0x8004('0x5a'),_0x30b5a0['ticketType'],_0x135c17['ticketId']));logger[_0x8004('0x20')](util[_0x8004('0x4b')]('['+_0x292016[_0x8004('0x14')]()+_0x8004('0x5b'),_0x292016));if(_0x292016!==_0x8004('0x5c')){logger['info']('['+_0x292016[_0x8004('0x14')]()+']',_0x8004('0x5d'));emit(_0x4d7104[_0x8004('0xe')],_0x27df58[_0x8004('0x5e')],_0x30b5a0[_0x8004('0x49')],_0x135c17['ticketId']);}})[_0x8004('0x13')](function(_0x214411){logger[_0x8004('0x5f')]('['+_0x292016['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x8004('0x60')](_0x214411,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb6fe=['headers','odata-entityid','substring','lastIndexOf','contacts?$select=telephone1','telephone1','enduserId','contactid','forEach','nameField','customField','idField','indexOf','content','incident','incidents','assign','getString','ticketType','phonecall','Subjects','Descriptions','/contacts(','callDirection','queue','Fields','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%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','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/environment','redis','defaults','socket.io-emitter','POST','clientId','remoteUri','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','length','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers('];(function(_0x6c2b03,_0x4f6978){var _0x111555=function(_0x4cb466){while(--_0x4cb466){_0x6c2b03['push'](_0x6c2b03['shift']());}};_0x111555(++_0x4f6978);}(_0xb6fe,0x192));var _0xeb6f=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xb6fe[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var BPromise=require(_0xeb6f('0x0'));var rp=require(_0xeb6f('0x1'));var util=require(_0xeb6f('0x2'));var intUtil=require(_0xeb6f('0x3'));var md5=require(_0xeb6f('0x4'));var Redis=require(_0xeb6f('0x5'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0xeb6f('0x6'));config[_0xeb6f('0x7')]=_[_0xeb6f('0x8')](config[_0xeb6f('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xeb6f('0x9'))(new Redis(config['redis']));function getAuthToken(_0x542736,_0x46169a,_0x1c704a){var _0x218b8a={'method':_0xeb6f('0xa'),'uri':_0x46169a,'form':{'client_id':_0x542736[_0xeb6f('0xb')],'resource':_0x542736[_0xeb6f('0xc')],'username':_0x542736['username'],'password':_0x542736['password'],'grant_type':_0xeb6f('0xd'),'client_secret':_0x542736['clientSecret']},'json':!![]};return rp(_0x218b8a)[_0xeb6f('0xe')](function(_0x53cd63){return _0x53cd63[_0xeb6f('0xf')];})[_0xeb6f('0x10')](function(_0x3ab27d){logger[_0xeb6f('0x11')]('['+[_0x1c704a[_0xeb6f('0x12')]()]+_0xeb6f('0x13'));return _0x3ab27d[_0xeb6f('0x14')];});}function getUser(_0x543f5a,_0x44fb21,_0x29323b,_0x1e09df,_0x4e8907,_0x1e0ba7){return new BPromise(function(_0x94a51,_0x5ba925){return getAuthToken(_0x44fb21,_0x1e09df,_0x1e0ba7)[_0xeb6f('0xe')](function(_0x4e58b1){var _0x2158a7={'method':_0xeb6f('0x15'),'uri':_0x4e8907+_0xeb6f('0x16'),'headers':{'Authorization':_0xeb6f('0x17')+_0x4e58b1,'OData-Version':_0xeb6f('0x18')},'json':!![]};return rp(_0x2158a7);})[_0xeb6f('0xe')](function(_0x56b735){var _0x47b20e=_0x56b735[_0xeb6f('0x19')];var _0x54eb85=![];var _0x36cb2a=null;if(!_[_0xeb6f('0x1a')](_0x29323b)){if(intUtil[_0xeb6f('0x1b')](_0x29323b[_0xeb6f('0x1c')])){_0x543f5a['userEmail']=_0x29323b[_0xeb6f('0x1c')];for(_0x36cb2a=0x0;_0x36cb2a<_0x47b20e['length'];_0x36cb2a++){if(_0x47b20e[_0x36cb2a][_0xeb6f('0x1d')]===_0x29323b['email']&&!_0x47b20e[_0x36cb2a]['isdisabled']){_0x54eb85=!![];logger[_0xeb6f('0x1e')]('['+[_0x1e0ba7[_0xeb6f('0x12')]()]+_0xeb6f('0x1f')+_0x47b20e[_0x36cb2a][_0xeb6f('0x20')]+'!');_0x543f5a[_0xeb6f('0x21')]=_0x47b20e[_0x36cb2a]['systemuserid'];}}}}if(!_0x54eb85){logger[_0xeb6f('0x1e')]('['+[_0x1e0ba7[_0xeb6f('0x12')]()]+_0xeb6f('0x22'));_0x543f5a['userEmail']=_0x44fb21[_0xeb6f('0x23')];for(_0x36cb2a=0x0;_0x36cb2a<_0x47b20e[_0xeb6f('0x24')];_0x36cb2a++){if(_0x47b20e[_0x36cb2a][_0xeb6f('0x1d')]===_0x44fb21[_0xeb6f('0x23')]){_0x543f5a[_0xeb6f('0x21')]=_0x47b20e[_0x36cb2a][_0xeb6f('0x20')];}}}_0x94a51(_0x543f5a);})[_0xeb6f('0x10')](function(_0x220192){_0x5ba925(_0x220192['message']);});});}function createEndUser(_0x57d053,_0x34f130,_0x279c44,_0x3422a6,_0x3fdfe7,_0x163e2c){return new BPromise(function(_0x387f93,_0x5a4f63){return getAuthToken(_0x34f130,_0x279c44,_0x163e2c)[_0xeb6f('0xe')](function(_0x327db9){var _0x480e63=_0x163e2c[_0xeb6f('0x25')]()===_0xeb6f('0x26')?_0x3fdfe7[_0xeb6f('0x27')]:_0x3fdfe7[_0xeb6f('0x28')];var _0xe46ddb={'method':_0xeb6f('0xa'),'uri':_0x3422a6+_0xeb6f('0x29'),'body':{'telephone1':_0x480e63,'fullname':_0x480e63,'firstname':_0x480e63,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xeb6f('0x2a')+_0x57d053[_0xeb6f('0x21')]+')'},'headers':{'Authorization':_0xeb6f('0x17')+_0x327db9,'OData-Version':_0xeb6f('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xe46ddb);})[_0xeb6f('0xe')](function(_0x5d27a2){var _0x41b721=_0x5d27a2[_0xeb6f('0x2b')][_0xeb6f('0x2c')];var _0x3ae784=_0x41b721[_0xeb6f('0x2d')](_0x41b721[_0xeb6f('0x2e')]('(')+0x1,_0x41b721[_0xeb6f('0x2e')](')'));_0x57d053['enduserId']=_0x3ae784;_0x387f93(_0x57d053);})[_0xeb6f('0x10')](function(_0x5c4ddd){_0x5a4f63(_0x5c4ddd[_0xeb6f('0x14')]);});});}function getEndUser(_0x3dd05f,_0x5ebfb9,_0x566e48,_0x1f3df7,_0x1fadb0,_0xba11a2){return new BPromise(function(_0x4e83f6,_0xd15aa8){return getAuthToken(_0x5ebfb9,_0x566e48,_0xba11a2)[_0xeb6f('0xe')](function(_0x1d32a8){var _0xaff4b2={'method':_0xeb6f('0x15'),'uri':_0x1f3df7+_0xeb6f('0x2f'),'headers':{'Authorization':'Bearer\x20'+_0x1d32a8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xaff4b2);})[_0xeb6f('0xe')](function(_0x136b70){var _0x23447d=null;if(_0x136b70){var _0x5d6219=_0x136b70[_0xeb6f('0x19')];var _0x4064d4=![];for(_0x23447d=0x0;_0x23447d<_0x5d6219['length'];_0x23447d++){var _0x5d366f=_0xba11a2[_0xeb6f('0x25')]()===_0xeb6f('0x26')?_0x1fadb0[_0xeb6f('0x27')]:_0x1fadb0[_0xeb6f('0x28')];if(_0x5d6219[_0x23447d][_0xeb6f('0x30')]===_0x5d366f){_0x4064d4=!![];_0x3dd05f[_0xeb6f('0x31')]=_0x5d6219[_0x23447d][_0xeb6f('0x32')];}}if(_0x4064d4){_0x4e83f6(_0x3dd05f);}else{return createEndUser(_0x3dd05f,_0x5ebfb9,_0x566e48,_0x1f3df7,_0x1fadb0,_0xba11a2)['then'](function(_0x250f59){logger[_0xeb6f('0x1e')]('['+[_0xba11a2[_0xeb6f('0x12')]()]+']\x20Enduser\x20created!',_0x250f59['enduserId']);_0x4e83f6(_0x250f59);});}}else{return createEndUser(_0x3dd05f,_0x5ebfb9,_0x566e48,_0x1f3df7,_0x1fadb0,_0xba11a2)['then'](function(_0x879816){logger[_0xeb6f('0x1e')]('['+[_0xba11a2[_0xeb6f('0x12')]()]+']\x20Enduser\x20Created!',_0x879816[_0xeb6f('0x31')]);_0x4e83f6(_0x879816);});}});});}function getCustomFields(_0x2fbe89,_0x5c9a51,_0x3a3e3f){var _0x5b6023={};if(_0x2fbe89[_0xeb6f('0x24')]>0x0){_[_0xeb6f('0x33')](_0x2fbe89,function(_0x3c973b){if(_0x3c973b['type']==='string'&&_0x3c973b[_0xeb6f('0x34')]&&!_0x3c973b[_0xeb6f('0x35')]){var _0x19ed8a=_0x3c973b[_0xeb6f('0x36')]['toLowerCase']();var _0x5fde6a=_0x19ed8a[_0xeb6f('0x2d')](0x0,_0x19ed8a[_0xeb6f('0x37')]('_'));var _0x2f0cee=_0x19ed8a[_0xeb6f('0x2d')](_0x19ed8a[_0xeb6f('0x37')]('_')+0x1);if(_0x5fde6a===_0x3a3e3f){_0x5b6023[_0x2f0cee]=_0x3c973b[_0xeb6f('0x38')];}}});}return _0x5b6023;}function getTicket(_0x1fc794,_0x2715a2,_0x1ec604,_0x5db6cf,_0x373573,_0x20c597,_0x110579){return new BPromise(function(_0x5c0b8c,_0x297d3d){var _0x14580e;return getAuthToken(_0x2715a2,_0x1ec604,_0x110579)[_0xeb6f('0xe')](function(_0x36f2cf){if(_0x20c597['ticketType']===_0xeb6f('0x39')){_0x14580e={'method':_0xeb6f('0xa'),'uri':_0x5db6cf+_0xeb6f('0x3a'),'body':Object[_0xeb6f('0x3b')]({},{'title':intUtil[_0xeb6f('0x3c')](_0x20c597['Subjects'],_0x373573,'\x20'),'description':intUtil[_0xeb6f('0x3c')](_0x20c597['Descriptions'],_0x373573,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x1fc794[_0xeb6f('0x31')]+')','ownerid@odata.bind':_0xeb6f('0x2a')+_0x1fc794['userId']+')','caseorigincode':'1'},getCustomFields(_0x20c597['Fields'],_0x373573,_0x20c597[_0xeb6f('0x3d')])),'headers':{'Authorization':'Bearer\x20'+_0x36f2cf,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x20c597[_0xeb6f('0x3d')]===_0xeb6f('0x3e')){_0x14580e={'method':_0xeb6f('0xa'),'uri':_0x5db6cf+'phonecalls','body':Object[_0xeb6f('0x3b')]({},{'subject':intUtil[_0xeb6f('0x3c')](_0x20c597[_0xeb6f('0x3f')],_0x373573,'\x20'),'phonenumber':String(_0x373573[_0xeb6f('0x28')]),'description':intUtil[_0xeb6f('0x3c')](_0x20c597[_0xeb6f('0x40')],_0x373573,'\x0a'),'regardingobjectid_contact@odata.bind':_0xeb6f('0x41')+_0x1fc794['enduserId']+')','ownerid@odata.bind':_0xeb6f('0x2a')+_0x1fc794['userId']+')','directioncode':_0x1fc794[_0xeb6f('0x42')]===_0xeb6f('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1fc794[_0xeb6f('0x21')]+')','participationtypemask':_0x1fc794['callDirection']===_0xeb6f('0x43')?0x2:0x1},{'partyid_contact@odata.bind':_0xeb6f('0x41')+_0x1fc794[_0xeb6f('0x31')]+')','participationtypemask':_0x1fc794[_0xeb6f('0x42')]===_0xeb6f('0x43')?0x1:0x2}]},getCustomFields(_0x20c597[_0xeb6f('0x44')],_0x373573,_0x20c597[_0xeb6f('0x3d')])),'headers':{'Authorization':'Bearer\x20'+_0x36f2cf,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x14580e);})[_0xeb6f('0xe')](function(_0x18b378){var _0x1a45f8=_0x18b378[_0xeb6f('0x2b')][_0xeb6f('0x2c')];var _0x19db1a=_0x1a45f8['substring'](_0x1a45f8['lastIndexOf']('(')+0x1,_0x1a45f8[_0xeb6f('0x2e')](')'));_0x1fc794['ticketId']=_0x19db1a;_0x5c0b8c(_0x1fc794);})[_0xeb6f('0x10')](function(_0x479b46){_0x297d3d(_0x479b46[_0xeb6f('0x14')]);});});}function emit(_0x182957,_0x49bbad,_0x240dcf,_0xdcdf68){var _0x2e33f7={'uri':util[_0xeb6f('0x45')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x182957,_0x240dcf,_0xdcdf68)};io['to'](util[_0xeb6f('0x45')](_0xeb6f('0x46'),_0x49bbad))['emit'](_0xeb6f('0x47'),_0x2e33f7);}exports['cs']=function(_0x2071f3,_0x4b8864,_0x2a373d,_0x19ea61,_0x2dd9ce,_0x462801,_0x197da7,_0x332454){var _0x3b99ed={};_0x462801['remoteUri']=intUtil[_0xeb6f('0x48')](_0x462801[_0xeb6f('0xc')]);_0x462801[_0xeb6f('0x49')]=intUtil[_0xeb6f('0x48')](_0x462801[_0xeb6f('0x49')]);_0x3b99ed[_0xeb6f('0x42')]=_0x332454===_0xeb6f('0x43')||_0x332454===_0xeb6f('0x4a')?_0xeb6f('0x43'):'outbound';var _0x2ebfa3=util[_0xeb6f('0x45')](_0xeb6f('0x4b'),_0x462801[_0xeb6f('0xc')]);var _0x1b1882=util[_0xeb6f('0x45')](_0xeb6f('0x4c'),_0x462801['tenantId']);var _0x4d1c57=util['format'](_0xeb6f('0x4d'),_0x462801[_0xeb6f('0x49')],_0x4b8864[_0xeb6f('0x4e')],md5(_0x4b8864[_0xeb6f('0x4e')]));if(_0x2dd9ce&&_0x2dd9ce[_0xeb6f('0x4f')]){logger[_0xeb6f('0x1e')]('[QUEUE]',_0xeb6f('0x50'));_0x4b8864['recordingURL']=_0x4d1c57;}else if(_0x197da7&&_0x197da7[_0xeb6f('0x51')]&&_0x197da7[_0xeb6f('0x51')]!=='none'){logger[_0xeb6f('0x1e')](_0xeb6f('0x52'),_0xeb6f('0x50'));_0x4b8864[_0xeb6f('0x53')]=_0x4d1c57;}else{_0x4b8864['recordingURL']='';}return getUser(_0x3b99ed,_0x462801,_0x19ea61,_0x1b1882,_0x2ebfa3,_0x332454)[_0xeb6f('0xe')](function(_0x39da1c){logger[_0xeb6f('0x1e')]('['+_0x332454[_0xeb6f('0x12')]()+_0xeb6f('0x54'),_0x39da1c['userId']);logger['info']('['+_0x332454[_0xeb6f('0x12')]()+']\x20The\x20User\x20email\x20is:',_0x39da1c['userEmail']);return getEndUser(_0x39da1c,_0x462801,_0x1b1882,_0x2ebfa3,_0x4b8864,_0x332454);})[_0xeb6f('0xe')](function(_0xc413a3){logger[_0xeb6f('0x1e')]('['+_0x332454[_0xeb6f('0x12')]()+']\x20The\x20Enduser\x20ID\x20is:',_0xc413a3[_0xeb6f('0x31')]);logger[_0xeb6f('0x1e')]('['+_0x332454[_0xeb6f('0x12')]()+_0xeb6f('0x55'),_0x4b8864['calleridnum']);return getTicket(_0xc413a3,_0x462801,_0x1b1882,_0x2ebfa3,_0x4b8864,_0x2a373d,_0x332454);})['then'](function(_0x208128){logger[_0xeb6f('0x1e')](util[_0xeb6f('0x45')]('['+_0x332454[_0xeb6f('0x12')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x2a373d[_0xeb6f('0x3d')],_0x208128[_0xeb6f('0x56')]));logger[_0xeb6f('0x1e')](util['format']('['+_0x332454[_0xeb6f('0x12')]()+']\x20Call\x20direction:\x20%s',_0x332454));if(_0x332454!==_0xeb6f('0x4a')){logger[_0xeb6f('0x1e')]('['+_0x332454[_0xeb6f('0x12')]()+']',_0xeb6f('0x57'));emit(_0x462801['remoteUri'],_0x19ea61['name'],_0x2a373d[_0xeb6f('0x3d')],_0x208128[_0xeb6f('0x56')]);}})['catch'](function(_0x502559){logger[_0xeb6f('0x11')]('['+_0x332454[_0xeb6f('0x12')]()+_0xeb6f('0x58'),util['inspect'](_0x502559,{'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 15f97e7..5bb13fd 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 _0xc621=['defaults','localhost','socket.io-emitter','application/json','format','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','value','%s/api/v2/tickets','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','type','string','nameField','customField','toLowerCase','content','idField','variable','variableName','push','customVariable','Variable','custom_fields','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','destcalleridname','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','unmanaged','toUpperCase','calleridname','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis'];(function(_0x54429a,_0x14ef1b){var _0x49e4ce=function(_0x26bd92){while(--_0x26bd92){_0x54429a['push'](_0x54429a['shift']());}};_0x49e4ce(++_0x14ef1b);}(_0xc621,0x1c3));var _0x1c62=function(_0x570a9f,_0x4a2074){_0x570a9f=_0x570a9f-0x0;var _0x493db1=_0xc621[_0x570a9f];return _0x493db1;};'use strict';var _=require(_0x1c62('0x0'));var rp=require(_0x1c62('0x1'));var md5=require(_0x1c62('0x2'));var util=require(_0x1c62('0x3'));var Redis=require('ioredis');var intUtil=require(_0x1c62('0x4'));var config=require(_0x1c62('0x5'));var logger=require(_0x1c62('0x6'))(_0x1c62('0x7'));config[_0x1c62('0x8')]=_[_0x1c62('0x9')](config[_0x1c62('0x8')],{'host':_0x1c62('0xa'),'port':0x18eb});var io=require(_0x1c62('0xb'))(new Redis(config[_0x1c62('0x8')]));var headers={'Content-Type':_0x1c62('0xc'),'Accept':_0x1c62('0xc')};function emit(_0x55beed,_0x2ef7a,_0x4df952){io['to'](_0x55beed)['emit'](_0x2ef7a,_0x4df952);}function getTicket(_0xaba31e,_0x4bed8e,_0x39be0a,_0x4a0b10,_0x3b2f0e){logger['info']('Creating\x20new\x20ticket...');var _0x379b70=_['merge']({'responder_id':_0x4bed8e['id'],'requester_id':_0x39be0a['id'],'name':util[_0x1c62('0xd')]('Caller\x20-\x20%s',_0x3b2f0e['calleridname']),'phone':_0x3b2f0e[_0x1c62('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x1c62('0xf')](_0x4a0b10[_0x1c62('0x10')],_0x3b2f0e,'\x20'),'description':intUtil[_0x1c62('0xf')](_0x4a0b10[_0x1c62('0x11')],_0x3b2f0e,_0x1c62('0x12')),'tags':getTags(_0x4a0b10[_0x1c62('0x13')],_0x1c62('0x14'))},getCustomFields(_0x4a0b10[_0x1c62('0x15')],_0x3b2f0e));_0x379b70['custom_fields']=_['mapValues'](_['keyBy'](_0x379b70['custom_fields'],'id'),_0x1c62('0x16'));return request({'uri':util[_0x1c62('0xd')](_0x1c62('0x17'),_0xaba31e['remoteUri']),'method':'POST','body':_0x379b70})['then'](function(_0x26574a){logger[_0x1c62('0x18')](_0x1c62('0x19'));return _0x26574a;});}function getUser(_0x402660,_0x248ba6){if(intUtil[_0x1c62('0x1a')](_0x248ba6)){return request({'uri':util[_0x1c62('0xd')](_0x1c62('0x1b'),_0x402660[_0x1c62('0x1c')]),'qs':{'email':_0x248ba6}})[_0x1c62('0x1d')](function(_0x1eadfd){if(_0x1eadfd[_0x1c62('0x1e')]){logger[_0x1c62('0x18')](_0x1c62('0x1f'));return _['find'](_0x1eadfd,function(_0x342366){return _0x342366[_0x1c62('0x20')][_0x1c62('0x21')]===_0x248ba6;});}else{logger['info'](_0x1c62('0x22'));return request({'uri':util[_0x1c62('0xd')]('%s/api/v2/agents/me',_0x402660[_0x1c62('0x1c')])})['then'](function(_0x145ad6){logger[_0x1c62('0x18')](_0x1c62('0x23'));return _0x145ad6;});}});}else{logger[_0x1c62('0x18')](_0x1c62('0x24'));return request({'uri':util[_0x1c62('0xd')](_0x1c62('0x25'),_0x402660['remoteUri'])})['then'](function(_0xe568cb){logger[_0x1c62('0x18')](_0x1c62('0x23'));return _0xe568cb;});}}function getEndUser(_0x13fbd4,_0x417459,_0x27b9a0){logger['info'](_0x1c62('0x26'),_0x27b9a0);return request({'uri':util[_0x1c62('0xd')]('%s/api/v2/contacts',_0x13fbd4[_0x1c62('0x1c')]),'qs':{'phone':_0x27b9a0}})['then'](function(_0x26a29c){if(_0x26a29c['length']){logger[_0x1c62('0x18')](_0x1c62('0x27'));return _[_0x1c62('0x28')](_0x26a29c,{'phone':_0x27b9a0});}else{logger[_0x1c62('0x18')](_0x1c62('0x29'));return request({'uri':util['format'](_0x1c62('0x2a'),_0x13fbd4[_0x1c62('0x1c')]),'method':'POST','body':{'name':_0x417459,'phone':_0x27b9a0}})['then'](function(_0x481ef0){logger[_0x1c62('0x18')](_0x1c62('0x2b'));return _0x481ef0;});}});}function getAuth(_0x48e710){return util[_0x1c62('0xd')](_0x1c62('0x2c'),new Buffer(_0x48e710[_0x1c62('0x2d')]+':X')[_0x1c62('0x2e')](_0x1c62('0x2f')));}function request(_0x304d84){logger[_0x1c62('0x30')](_0x1c62('0x31'),JSON[_0x1c62('0x32')](_0x304d84));return rp(_[_0x1c62('0x9')](_0x304d84,{'method':_0x1c62('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x308fe2,_0x2e625b){var _0x2678d4=[];if(_0x308fe2&&_0x308fe2[_0x1c62('0x1e')]>0x0){_0x2678d4=_[_0x1c62('0x34')](_0x308fe2,_0x2e625b);}return _0x2678d4;}function getCustomFields(_0x34ae45,_0xd2381d){var _0x167353=[];var _0x570547={'custom_fields':[]};if(_0x34ae45[_0x1c62('0x1e')]>0x0){_['forEach'](_0x34ae45,function(_0x3ff6d7){if(_0x3ff6d7[_0x1c62('0x35')]===_0x1c62('0x36')&&_0x3ff6d7[_0x1c62('0x37')]&&!_0x3ff6d7[_0x1c62('0x38')]){_0x570547[_0x3ff6d7[_0x1c62('0x37')][_0x1c62('0x39')]()]=_0x3ff6d7[_0x1c62('0x3a')][_0x1c62('0x2e')]();}else if(_0x3ff6d7[_0x1c62('0x35')]===_0x1c62('0x36')&&_0x3ff6d7[_0x1c62('0x3b')]&&_0x3ff6d7['customField']){_0x570547['custom_fields']['push']({'id':_0x3ff6d7['idField'],'value':_0x3ff6d7['content'][_0x1c62('0x2e')]()});}else if(_0x3ff6d7[_0x1c62('0x35')]===_0x1c62('0x3c')&&_0x3ff6d7['variableName']&&_0x3ff6d7[_0x1c62('0x3b')]&&_0x3ff6d7['customField']){_0xd2381d[_0x3ff6d7[_0x1c62('0x3d')]]&&_0x570547['custom_fields'][_0x1c62('0x3e')]({'id':_0x3ff6d7[_0x1c62('0x3b')],'value':_0xd2381d[_0x3ff6d7[_0x1c62('0x3d')]]['toString']()});}else if(_0x3ff6d7[_0x1c62('0x35')]===_0x1c62('0x3f')&&_0x3ff6d7[_0x1c62('0x40')]&&_0x3ff6d7[_0x1c62('0x40')]['name']&&_0x3ff6d7[_0x1c62('0x3b')]&&_0x3ff6d7['customField']){_0xd2381d[_0x3ff6d7[_0x1c62('0x40')][_0x1c62('0x14')][_0x1c62('0x39')]()]&&_0x570547[_0x1c62('0x41')][_0x1c62('0x3e')]({'id':_0x3ff6d7[_0x1c62('0x3b')],'value':_0xd2381d[_0x3ff6d7[_0x1c62('0x40')][_0x1c62('0x14')][_0x1c62('0x39')]()][_0x1c62('0x2e')]()});}});}return _0x570547;}exports[_0x1c62('0x42')]=function(_0x4844d2,_0x203099,_0x544fa4,_0x3050df,_0x173886,_0x2178c9){var _0x14c8c6,_0x1cdaed;_0x2178c9['remoteUri']=intUtil['stripTrailingSlash'](_0x2178c9['remoteUri']);_0x2178c9[_0x1c62('0x43')]=intUtil[_0x1c62('0x44')](_0x2178c9[_0x1c62('0x43')]);if(_0x173886&&_0x173886[_0x1c62('0x45')]){logger[_0x1c62('0x18')](_0x1c62('0x46'),_0x1c62('0x47'));_0x203099[_0x1c62('0x48')]=util['format'](_0x1c62('0x49'),_0x2178c9[_0x1c62('0x43')],_0x203099[_0x1c62('0x4a')],md5(_0x203099[_0x1c62('0x4a')]));}else{_0x203099[_0x1c62('0x48')]='';}headers[_0x1c62('0x4b')]=getAuth(_0x2178c9);return getUser(_0x2178c9,_0x3050df[_0x1c62('0x21')])[_0x1c62('0x1d')](function(_0x2895b8){_0x14c8c6=_0x2895b8;logger[_0x1c62('0x18')](_0x1c62('0x4c'),_0x14c8c6['id']);return getEndUser(_0x2178c9,_0x203099['calleridname'],_0x203099['calleridnum']);})[_0x1c62('0x1d')](function(_0x5c6601){_0x1cdaed=_0x5c6601;logger['info'](_0x1c62('0x4d'),_0x1cdaed['id']);return getTicket(_0x2178c9,_0x14c8c6,_0x1cdaed,_0x544fa4,_0x203099);})[_0x1c62('0x1d')](function(_0x24a082){if(_0x24a082&&_0x24a082['id']){logger[_0x1c62('0x18')](_0x1c62('0x19'));logger[_0x1c62('0x18')](_0x1c62('0x4e'),_0x24a082['id']);logger[_0x1c62('0x18')](_0x1c62('0x46'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1c62('0xd')](_0x1c62('0x4f'),_0x3050df['name']),_0x1c62('0x50'),{'uri':util[_0x1c62('0xd')](_0x1c62('0x51'),_0x2178c9['remoteUri'],_0x24a082['id'])});}})['catch'](function(_0x1f17f6){logger[_0x1c62('0x52')](_0x1c62('0x46'),JSON[_0x1c62('0x32')](_0x1f17f6));});};exports[_0x1c62('0x53')]=function(_0x10d730,_0x7f23e7,_0x2f9339,_0x4450ad,_0x79a7d,_0x1ffc07,_0x3b3e43){var _0x2d722c,_0x10ad1a;_0x1ffc07['remoteUri']=intUtil[_0x1c62('0x44')](_0x1ffc07[_0x1c62('0x1c')]);_0x1ffc07[_0x1c62('0x43')]=intUtil[_0x1c62('0x44')](_0x1ffc07['serverUrl']);if(_0x3b3e43&&_0x3b3e43[_0x1c62('0x54')]&&_0x3b3e43[_0x1c62('0x54')]!=='none'){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x7f23e7[_0x1c62('0x48')]=util[_0x1c62('0xd')](_0x1c62('0x49'),_0x1ffc07[_0x1c62('0x43')],_0x7f23e7[_0x1c62('0x4a')],md5(_0x7f23e7['uniqueid']));}headers[_0x1c62('0x4b')]=getAuth(_0x1ffc07);return getUser(_0x1ffc07,_0x4450ad[_0x1c62('0x21')])[_0x1c62('0x1d')](function(_0x1c745c){_0x2d722c=_0x1c745c;logger[_0x1c62('0x18')]('The\x20User\x20ID\x20is:',_0x2d722c['id']);return getEndUser(_0x1ffc07,_0x7f23e7[_0x1c62('0x55')],_0x7f23e7['destcalleridnum']);})['then'](function(_0x54e86d){_0x10ad1a=_0x54e86d;logger[_0x1c62('0x18')](_0x1c62('0x4d'),_0x10ad1a['id']);return getTicket(_0x1ffc07,_0x2d722c,_0x10ad1a,_0x2f9339,_0x7f23e7);})[_0x1c62('0x1d')](function(_0x1f0a27){if(_0x1f0a27&&_0x1f0a27['id']){logger[_0x1c62('0x18')]('Ticket\x20created!');logger[_0x1c62('0x18')]('The\x20Ticket\x20ID\x20is:',_0x1f0a27['id']);logger[_0x1c62('0x18')](_0x1c62('0x56'),_0x1c62('0x57'));emit(util[_0x1c62('0xd')](_0x1c62('0x4f'),_0x4450ad[_0x1c62('0x14')]),_0x1c62('0x50'),{'uri':util[_0x1c62('0xd')](_0x1c62('0x51'),_0x1ffc07[_0x1c62('0x1c')],_0x1f0a27['id'])});}})[_0x1c62('0x58')](function(_0x27c57d){logger[_0x1c62('0x52')]('[OUTBOUND]',JSON[_0x1c62('0x32')](_0x27c57d));});};exports[_0x1c62('0x59')]=function(_0x39f032,_0x20b7cb,_0x3d0065,_0x13e974,_0x4dfef5,_0x3da53b){var _0x2a91c6,_0x591e3a;_0x3da53b['remoteUri']=intUtil[_0x1c62('0x44')](_0x3da53b['remoteUri']);_0x3da53b['serverUrl']=intUtil[_0x1c62('0x44')](_0x3da53b[_0x1c62('0x43')]);if(_0x4dfef5&&_0x4dfef5[_0x1c62('0x45')]){logger['info']('['+_0x20b7cb['lastevent'][_0x1c62('0x5a')]()+']',_0x1c62('0x47'));_0x20b7cb['recordingURL']=util[_0x1c62('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3da53b[_0x1c62('0x43')],_0x20b7cb[_0x1c62('0x4a')],md5(_0x20b7cb[_0x1c62('0x4a')]));}else{_0x20b7cb[_0x1c62('0x48')]='';}headers[_0x1c62('0x4b')]=getAuth(_0x3da53b);return getUser(_0x3da53b,'')[_0x1c62('0x1d')](function(_0x22977c){_0x2a91c6=_0x22977c;logger[_0x1c62('0x18')](_0x1c62('0x4c'),_0x2a91c6['id']);return getEndUser(_0x3da53b,_0x20b7cb[_0x1c62('0x5b')],_0x20b7cb[_0x1c62('0xe')]);})[_0x1c62('0x1d')](function(_0x200f78){_0x591e3a=_0x200f78;logger[_0x1c62('0x18')]('The\x20Enduser\x20ID\x20is:',_0x591e3a['id']);return getTicket(_0x3da53b,_0x2a91c6,_0x591e3a,_0x3d0065,_0x20b7cb);})['then'](function(_0x53d018){if(_0x53d018){logger[_0x1c62('0x18')](_0x1c62('0x19'));logger[_0x1c62('0x18')]('The\x20Ticket\x20ID\x20is:',_0x53d018['id']);}})[_0x1c62('0x58')](function(_0x2658c9){logger['error']('['+_0x20b7cb['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x2658c9));});}; \ No newline at end of file +var _0x5dd5=['Variable','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','uniqueid','The\x20User\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','toUpperCase','recordingURL','Authorization','request-promise','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','name','Fields','mapValues','value','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','length','map','forEach','type','string','nameField','customField','toLowerCase','idField','push','content','variableName','custom_fields'];(function(_0x5aa6ef,_0x5ec8ed){var _0x2554f5=function(_0x3b20ee){while(--_0x3b20ee){_0x5aa6ef['push'](_0x5aa6ef['shift']());}};_0x2554f5(++_0x5ec8ed);}(_0x5dd5,0x17a));var _0x55dd=function(_0x3794d5,_0x5e6b91){_0x3794d5=_0x3794d5-0x0;var _0x44080c=_0x5dd5[_0x3794d5];return _0x44080c;};'use strict';var _=require('lodash');var rp=require(_0x55dd('0x0'));var md5=require(_0x55dd('0x1'));var util=require(_0x55dd('0x2'));var Redis=require(_0x55dd('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x55dd('0x4'))('freshdesk');config[_0x55dd('0x5')]=_[_0x55dd('0x6')](config[_0x55dd('0x5')],{'host':_0x55dd('0x7'),'port':0x18eb});var io=require(_0x55dd('0x8'))(new Redis(config[_0x55dd('0x5')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x5024f5,_0x5185f3,_0x1b617b){io['to'](_0x5024f5)[_0x55dd('0x9')](_0x5185f3,_0x1b617b);}function getTicket(_0x31f580,_0x3050f8,_0x1018c8,_0x2199cf,_0x1be033){logger[_0x55dd('0xa')](_0x55dd('0xb'));var _0x555d79=_[_0x55dd('0xc')]({'responder_id':_0x3050f8['id'],'requester_id':_0x1018c8['id'],'name':util[_0x55dd('0xd')](_0x55dd('0xe'),_0x1be033[_0x55dd('0xf')]),'phone':_0x1be033[_0x55dd('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x55dd('0x11')](_0x2199cf[_0x55dd('0x12')],_0x1be033,'\x20'),'description':intUtil[_0x55dd('0x11')](_0x2199cf[_0x55dd('0x13')],_0x1be033,'
'),'tags':getTags(_0x2199cf['Tags'],_0x55dd('0x14'))},getCustomFields(_0x2199cf[_0x55dd('0x15')],_0x1be033));_0x555d79['custom_fields']=_[_0x55dd('0x16')](_['keyBy'](_0x555d79['custom_fields'],'id'),_0x55dd('0x17'));return request({'uri':util[_0x55dd('0xd')]('%s/api/v2/tickets',_0x31f580[_0x55dd('0x18')]),'method':_0x55dd('0x19'),'body':_0x555d79})['then'](function(_0x564972){logger[_0x55dd('0xa')](_0x55dd('0x1a'));return _0x564972;});}function getUser(_0x3fa76e,_0x2bac64){if(intUtil[_0x55dd('0x1b')](_0x2bac64)){return request({'uri':util[_0x55dd('0xd')](_0x55dd('0x1c'),_0x3fa76e[_0x55dd('0x18')]),'qs':{'email':_0x2bac64}})[_0x55dd('0x1d')](function(_0x440601){if(_0x440601['length']){logger['info']('Agent\x20found!');return _[_0x55dd('0x1e')](_0x440601,function(_0xace668){return _0xace668[_0x55dd('0x1f')][_0x55dd('0x20')]===_0x2bac64;});}else{logger[_0x55dd('0xa')](_0x55dd('0x21'));return request({'uri':util[_0x55dd('0xd')](_0x55dd('0x22'),_0x3fa76e['remoteUri'])})[_0x55dd('0x1d')](function(_0x455f92){logger[_0x55dd('0xa')](_0x55dd('0x23'));return _0x455f92;});}});}else{logger[_0x55dd('0xa')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x55dd('0xd')](_0x55dd('0x22'),_0x3fa76e[_0x55dd('0x18')])})[_0x55dd('0x1d')](function(_0x680ae3){logger[_0x55dd('0xa')](_0x55dd('0x23'));return _0x680ae3;});}}function getEndUser(_0x28733e,_0x304ba6,_0x3c1e94){logger[_0x55dd('0xa')](_0x55dd('0x24'),_0x3c1e94);return request({'uri':util[_0x55dd('0xd')](_0x55dd('0x25'),_0x28733e[_0x55dd('0x18')]),'qs':{'phone':_0x3c1e94}})['then'](function(_0x14c619){if(_0x14c619['length']){logger[_0x55dd('0xa')](_0x55dd('0x26'));return _['find'](_0x14c619,{'phone':_0x3c1e94});}else{logger['info'](_0x55dd('0x27'));return request({'uri':util['format'](_0x55dd('0x25'),_0x28733e['remoteUri']),'method':'POST','body':{'name':_0x304ba6,'phone':_0x3c1e94}})[_0x55dd('0x1d')](function(_0x805067){logger[_0x55dd('0xa')](_0x55dd('0x28'));return _0x805067;});}});}function getAuth(_0x2ebc4a){return util[_0x55dd('0xd')](_0x55dd('0x29'),new Buffer(_0x2ebc4a[_0x55dd('0x2a')]+':X')[_0x55dd('0x2b')](_0x55dd('0x2c')));}function request(_0x30725d){logger[_0x55dd('0x2d')](_0x55dd('0x2e'),JSON[_0x55dd('0x2f')](_0x30725d));return rp(_[_0x55dd('0x6')](_0x30725d,{'method':_0x55dd('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x57f428,_0x2a4fd0){var _0x3a2a59=[];if(_0x57f428&&_0x57f428[_0x55dd('0x31')]>0x0){_0x3a2a59=_[_0x55dd('0x32')](_0x57f428,_0x2a4fd0);}return _0x3a2a59;}function getCustomFields(_0x4d380d,_0x4622e9){var _0x1d9ac1=[];var _0x2a995d={'custom_fields':[]};if(_0x4d380d[_0x55dd('0x31')]>0x0){_[_0x55dd('0x33')](_0x4d380d,function(_0x1cb934){if(_0x1cb934[_0x55dd('0x34')]===_0x55dd('0x35')&&_0x1cb934[_0x55dd('0x36')]&&!_0x1cb934[_0x55dd('0x37')]){_0x2a995d[_0x1cb934[_0x55dd('0x36')][_0x55dd('0x38')]()]=_0x1cb934['content']['toString']();}else if(_0x1cb934[_0x55dd('0x34')]===_0x55dd('0x35')&&_0x1cb934[_0x55dd('0x39')]&&_0x1cb934['customField']){_0x2a995d['custom_fields'][_0x55dd('0x3a')]({'id':_0x1cb934[_0x55dd('0x39')],'value':_0x1cb934[_0x55dd('0x3b')]['toString']()});}else if(_0x1cb934[_0x55dd('0x34')]==='variable'&&_0x1cb934[_0x55dd('0x3c')]&&_0x1cb934['idField']&&_0x1cb934['customField']){_0x4622e9[_0x1cb934['variableName']]&&_0x2a995d[_0x55dd('0x3d')][_0x55dd('0x3a')]({'id':_0x1cb934[_0x55dd('0x39')],'value':_0x4622e9[_0x1cb934['variableName']]['toString']()});}else if(_0x1cb934[_0x55dd('0x34')]==='customVariable'&&_0x1cb934[_0x55dd('0x3e')]&&_0x1cb934[_0x55dd('0x3e')][_0x55dd('0x14')]&&_0x1cb934[_0x55dd('0x39')]&&_0x1cb934[_0x55dd('0x37')]){_0x4622e9[_0x1cb934[_0x55dd('0x3e')][_0x55dd('0x14')][_0x55dd('0x38')]()]&&_0x2a995d[_0x55dd('0x3d')][_0x55dd('0x3a')]({'id':_0x1cb934[_0x55dd('0x39')],'value':_0x4622e9[_0x1cb934['Variable'][_0x55dd('0x14')]['toLowerCase']()][_0x55dd('0x2b')]()});}});}return _0x2a995d;}exports['queue']=function(_0xe790b2,_0x1d129c,_0x4d160c,_0x528e7a,_0x38ee0e,_0x2af08d){var _0x21b4eb,_0x55d1e0;_0x2af08d[_0x55dd('0x18')]=intUtil[_0x55dd('0x3f')](_0x2af08d['remoteUri']);_0x2af08d[_0x55dd('0x40')]=intUtil['stripTrailingSlash'](_0x2af08d[_0x55dd('0x40')]);if(_0x38ee0e&&_0x38ee0e[_0x55dd('0x41')]){logger['info']('[QUEUE]',_0x55dd('0x42'));_0x1d129c['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2af08d[_0x55dd('0x40')],_0x1d129c[_0x55dd('0x43')],md5(_0x1d129c['uniqueid']));}else{_0x1d129c['recordingURL']='';}headers['Authorization']=getAuth(_0x2af08d);return getUser(_0x2af08d,_0x528e7a[_0x55dd('0x20')])[_0x55dd('0x1d')](function(_0x5394b6){_0x21b4eb=_0x5394b6;logger['info'](_0x55dd('0x44'),_0x21b4eb['id']);return getEndUser(_0x2af08d,_0x1d129c['calleridname'],_0x1d129c['calleridnum']);})[_0x55dd('0x1d')](function(_0x3df910){_0x55d1e0=_0x3df910;logger[_0x55dd('0xa')]('The\x20Enduser\x20ID\x20is:',_0x55d1e0['id']);return getTicket(_0x2af08d,_0x21b4eb,_0x55d1e0,_0x4d160c,_0x1d129c);})[_0x55dd('0x1d')](function(_0x403c31){if(_0x403c31&&_0x403c31['id']){logger['info']('Ticket\x20created!');logger[_0x55dd('0xa')]('The\x20Ticket\x20ID\x20is:',_0x403c31['id']);logger[_0x55dd('0xa')](_0x55dd('0x45'),_0x55dd('0x46'));emit(util['format'](_0x55dd('0x47'),_0x528e7a[_0x55dd('0x14')]),_0x55dd('0x48'),{'uri':util[_0x55dd('0xd')](_0x55dd('0x49'),_0x2af08d[_0x55dd('0x18')],_0x403c31['id'])});}})[_0x55dd('0x4a')](function(_0x4cc1b7){logger[_0x55dd('0x4b')](_0x55dd('0x45'),JSON[_0x55dd('0x2f')](_0x4cc1b7));});};exports[_0x55dd('0x4c')]=function(_0x1ea12e,_0x5a2345,_0x12936c,_0x68ce14,_0x2f61a8,_0x576c96,_0x58903d){var _0x501798,_0x4bf3d6;_0x576c96['remoteUri']=intUtil[_0x55dd('0x3f')](_0x576c96[_0x55dd('0x18')]);_0x576c96[_0x55dd('0x40')]=intUtil[_0x55dd('0x3f')](_0x576c96[_0x55dd('0x40')]);if(_0x58903d&&_0x58903d[_0x55dd('0x4d')]&&_0x58903d['recordingFormat']!==_0x55dd('0x4e')){logger[_0x55dd('0xa')](_0x55dd('0x4f'),_0x55dd('0x42'));_0x5a2345['recordingURL']=util[_0x55dd('0xd')](_0x55dd('0x50'),_0x576c96[_0x55dd('0x40')],_0x5a2345[_0x55dd('0x43')],md5(_0x5a2345[_0x55dd('0x43')]));}headers['Authorization']=getAuth(_0x576c96);return getUser(_0x576c96,_0x68ce14['email'])[_0x55dd('0x1d')](function(_0x527221){_0x501798=_0x527221;logger['info']('The\x20User\x20ID\x20is:',_0x501798['id']);return getEndUser(_0x576c96,_0x5a2345['destcalleridname'],_0x5a2345['destcalleridnum']);})[_0x55dd('0x1d')](function(_0x80d2fe){_0x4bf3d6=_0x80d2fe;logger['info'](_0x55dd('0x51'),_0x4bf3d6['id']);return getTicket(_0x576c96,_0x501798,_0x4bf3d6,_0x12936c,_0x5a2345);})['then'](function(_0x380eae){if(_0x380eae&&_0x380eae['id']){logger[_0x55dd('0xa')](_0x55dd('0x1a'));logger[_0x55dd('0xa')](_0x55dd('0x52'),_0x380eae['id']);logger['info'](_0x55dd('0x4f'),_0x55dd('0x46'));emit(util['format'](_0x55dd('0x47'),_0x68ce14['name']),_0x55dd('0x48'),{'uri':util['format'](_0x55dd('0x49'),_0x576c96['remoteUri'],_0x380eae['id'])});}})['catch'](function(_0xe2f6e){logger['error'](_0x55dd('0x4f'),JSON[_0x55dd('0x2f')](_0xe2f6e));});};exports[_0x55dd('0x53')]=function(_0x19bf98,_0x12ab0e,_0x554d97,_0x4e60d2,_0x7cdd1d,_0x3f28e8){var _0x32df1c,_0x23685a;_0x3f28e8[_0x55dd('0x18')]=intUtil['stripTrailingSlash'](_0x3f28e8[_0x55dd('0x18')]);_0x3f28e8[_0x55dd('0x40')]=intUtil[_0x55dd('0x3f')](_0x3f28e8[_0x55dd('0x40')]);if(_0x7cdd1d&&_0x7cdd1d[_0x55dd('0x41')]){logger[_0x55dd('0xa')]('['+_0x12ab0e[_0x55dd('0x54')][_0x55dd('0x55')]()+']',_0x55dd('0x42'));_0x12ab0e[_0x55dd('0x56')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f28e8['serverUrl'],_0x12ab0e['uniqueid'],md5(_0x12ab0e[_0x55dd('0x43')]));}else{_0x12ab0e['recordingURL']='';}headers[_0x55dd('0x57')]=getAuth(_0x3f28e8);return getUser(_0x3f28e8,'')[_0x55dd('0x1d')](function(_0x558ce6){_0x32df1c=_0x558ce6;logger['info'](_0x55dd('0x44'),_0x32df1c['id']);return getEndUser(_0x3f28e8,_0x12ab0e[_0x55dd('0xf')],_0x12ab0e[_0x55dd('0x10')]);})[_0x55dd('0x1d')](function(_0x316ca2){_0x23685a=_0x316ca2;logger[_0x55dd('0xa')](_0x55dd('0x51'),_0x23685a['id']);return getTicket(_0x3f28e8,_0x32df1c,_0x23685a,_0x554d97,_0x12ab0e);})[_0x55dd('0x1d')](function(_0x17cea5){if(_0x17cea5){logger['info'](_0x55dd('0x1a'));logger[_0x55dd('0xa')](_0x55dd('0x52'),_0x17cea5['id']);}})[_0x55dd('0x4a')](function(_0xe52101){logger['error']('['+_0x12ab0e['lastevent']['toUpperCase']()+']',JSON[_0x55dd('0x2f')](_0xe52101));});}; \ 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 e3b35e3..0851d40 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 _0x5350=['Descriptions','Contact','add','task','Task\x20created:','ticketId','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','outbound','destcalleridnum','calleridnum','callDirection','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','adminEmail','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','User\x20found:','Admin\x20selected','adminId','Getting\x20contacts\x20filter','then','filters','forEach','name','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contacts','find','work_number','contactNumber','mobile_number','endUserId','Contact\x20created:','/api/contacts','userId','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects'];(function(_0x5153c0,_0x4dd5ba){var _0xfb156c=function(_0x184931){while(--_0x184931){_0x5153c0['push'](_0x5153c0['shift']());}};_0xfb156c(++_0x4dd5ba);}(_0x5350,0x78));var _0x0535=function(_0x37e766,_0x471645){_0x37e766=_0x37e766-0x0;var _0x4646d3=_0x5350[_0x37e766];return _0x4646d3;};'use strict';var _=require(_0x0535('0x0'));var rp=require(_0x0535('0x1'));var md5=require(_0x0535('0x2'));var util=require(_0x0535('0x3'));var moment=require(_0x0535('0x4'));var Promise=require(_0x0535('0x5'));var Redis=require('ioredis');var intUtil=require(_0x0535('0x6'));var config=require(_0x0535('0x7'));var logger=require('../../../../config/logger')(_0x0535('0x8'));config[_0x0535('0x9')]=_[_0x0535('0xa')](config[_0x0535('0x9')],{'host':_0x0535('0xb'),'port':0x18eb});var io=require(_0x0535('0xc'))(new Redis(config['redis']));function getAdminId(_0x5be6ed,_0x16d5f0,_0x38911a,_0x5b4275){return new Promise(function(_0x183f37,_0x386743){var _0x6bde2b=![];var _0x4a06d0={'method':_0x0535('0xd'),'uri':_0x5b4275+_0x0535('0xe'),'json':!![]};_0x4a06d0[_0x0535('0xf')]=_0x38911a;logger[_0x0535('0x10')](_0x0535('0x11'));return rp(_0x4a06d0)['then'](function(_0x2507a8){if(_0x2507a8){var _0x441e67=_0x2507a8[_0x0535('0x12')];var _0x2d5259=null;for(_0x2d5259=0x0;_0x2d5259<_0x441e67[_0x0535('0x13')];_0x2d5259++){if(_0x441e67[_0x2d5259]['email']===_0x5be6ed[_0x0535('0x14')]){_0x5be6ed['adminId']=_0x441e67[_0x2d5259]['id'];_0x6bde2b=!![];}}if(_0x6bde2b){logger[_0x0535('0x10')](_0x0535('0x15'),_0x5be6ed['adminId']);_0x183f37(_0x5be6ed);}else{_0x386743({'statusCode':0x194,'message':_0x0535('0x16')});}}else{_0x386743({'statusCode':0x194,'message':_0x0535('0x16')});}})[_0x0535('0x17')](function(_0x2d0fca){logger[_0x0535('0x18')]('['+[_0x16d5f0[_0x0535('0x19')]()]+']',_0x2d0fca[_0x0535('0x1a')]);_0x386743(_0x2d0fca);});});}function getUser(_0x48efa4,_0x2bcae4,_0x539a78){return function(_0x562016){return new Promise(function(_0x52f532,_0x4745ff){var _0x3d4014={'method':_0x0535('0xd'),'uri':_0x539a78+_0x0535('0xe'),'json':!![]};_0x3d4014[_0x0535('0xf')]=_0x2bcae4;logger[_0x0535('0x10')](_0x0535('0x1b'));return rp(_0x3d4014)['then'](function(_0x41f572){if(_0x41f572){var _0x268db1=_0x41f572['users'];var _0x4dc893=![];var _0x28ab05=null;if(_0x562016[_0x0535('0x1c')]!==null){logger[_0x0535('0x10')](_0x0535('0x1d'),_0x562016['agentEmail']);_0x562016[_0x0535('0x1e')]=_0x562016[_0x0535('0x1c')];for(_0x28ab05=0x0;_0x28ab05<_0x268db1[_0x0535('0x13')];_0x28ab05++){if(_0x268db1[_0x28ab05][_0x0535('0x1f')]===_0x562016[_0x0535('0x1c')]){_0x4dc893=!![];_0x562016['userId']=_0x268db1[_0x28ab05]['id'];logger[_0x0535('0x10')](_0x0535('0x20'),_0x562016['userId']);}}}if(!_0x4dc893){logger[_0x0535('0x10')](_0x0535('0x21'));_0x562016[_0x0535('0x1e')]=_0x562016[_0x0535('0x14')];_0x562016['userId']=_0x562016[_0x0535('0x22')];_0x4dc893=!![];}if(_0x4dc893){_0x52f532(_0x562016);}else{_0x4745ff({'statusCode':0x194,'message':_0x0535('0x16')});}}else{_0x4745ff({'statusCode':0x194,'message':_0x0535('0x16')});}})[_0x0535('0x17')](function(_0x10d157){logger[_0x0535('0x18')]('['+[_0x48efa4[_0x0535('0x19')]()]+']',_0x10d157['message']);_0x4745ff(_0x10d157);});});};}function getEndUser(_0xe0972c,_0x434032,_0x2e77ae){return function(_0x1d1556){return new Promise(function(_0x4a3f72,_0x47d7d1){var _0xad60b2=0x0;var _0x11fa6d={'method':'GET','uri':_0x2e77ae+'/api/contacts/filters','json':!![]};_0x11fa6d[_0x0535('0xf')]=_0x434032;logger[_0x0535('0x10')](_0x0535('0x23'));return rp(_0x11fa6d)[_0x0535('0x24')](function(_0x1561d1){_0x1561d1[_0x0535('0x25')][_0x0535('0x26')](function(_0x20467e){if(_0x20467e[_0x0535('0x27')]===_0x0535('0x28')){_0xad60b2=_0x20467e['id'];}});})[_0x0535('0x24')](function(){logger[_0x0535('0x10')](_0x0535('0x29'));var _0x1be73a={'method':_0x0535('0xd'),'uri':_0x2e77ae+_0x0535('0x2a')+_0xad60b2,'json':!![]};_0x1be73a[_0x0535('0xf')]=_0x434032;return rp(_0x1be73a);})[_0x0535('0x24')](function(_0x4cb945){logger[_0x0535('0x10')](_0x0535('0x2b'),_0x1d1556['contactNumber']);if(_0x4cb945[_0x0535('0x2c')][_0x0535('0x13')]>0x0){var _0x434629=_[_0x0535('0x2d')](_0x4cb945[_0x0535('0x2c')],function(_0x566aeb){if(_0x566aeb[_0x0535('0x2e')]===_0x1d1556[_0x0535('0x2f')]||_0x566aeb[_0x0535('0x30')]===_0x1d1556[_0x0535('0x2f')]){return _0x566aeb;}});if(_0x434629){_0x1d1556[_0x0535('0x31')]=_0x434629['id'];logger[_0x0535('0x10')]('Contact\x20found:',_0x1d1556['endUserId']);_0x4a3f72(_0x1d1556);}else{return createEndUser(_0x1d1556,_0xe0972c,_0x434032,_0x2e77ae)[_0x0535('0x24')](function(_0x722d2){logger[_0x0535('0x10')](_0x0535('0x32'),_0x1d1556[_0x0535('0x31')]);_0x4a3f72(_0x722d2);});}}else{return createEndUser(_0x1d1556,_0xe0972c,_0x434032,_0x2e77ae)['then'](function(_0x1d932b){logger[_0x0535('0x10')](_0x0535('0x32'),_0x1d1556[_0x0535('0x31')]);_0x4a3f72(_0x1d932b);});}})[_0x0535('0x17')](function(_0x28becd){throw new Error(_0x28becd['message']);});});};}function createEndUser(_0x5df53e,_0x3b85a3,_0x2236af,_0x43dde5){return new Promise(function(_0x23190c,_0xac065f){var _0x303bd0=moment();var _0x257e33={'method':'POST','uri':_0x43dde5+_0x0535('0x33'),'body':{'contact':{'last_name':_0x5df53e[_0x0535('0x2f')],'work_number':_0x5df53e['contactNumber'],'mobile_number':_0x5df53e[_0x0535('0x2f')],'owner_id':_0x5df53e[_0x0535('0x34')],'created_at':_0x303bd0[_0x0535('0x35')](_0x0535('0x36'))}},'json':!![]};_0x257e33[_0x0535('0xf')]=_0x2236af;logger['info'](_0x0535('0x37'));return rp(_0x257e33)['then'](function(_0x56318a){_0x5df53e[_0x0535('0x31')]=_0x56318a[_0x0535('0x38')]['id'];_0x23190c(_0x5df53e);})['catch'](function(_0x8260c7){logger[_0x0535('0x18')]('['+[_0x3b85a3['toUpperCase']()]+']',_0x8260c7[_0x0535('0x1a')]);_0xac065f(_0x8260c7['message']);});});}function getTicket(_0x56885c,_0x3db580,_0x155a4b,_0x2ab203,_0x8532b8){return function(_0x5871b5){logger[_0x0535('0x10')](_0x0535('0x39'));return new Promise(function(_0x40f13d,_0x3a9c7c){var _0x4a0341=moment();var _0x51fa32={'method':_0x0535('0x3a'),'uri':_0x155a4b+_0x0535('0x3b'),'body':{'title':intUtil[_0x0535('0x3c')](_0x2ab203[_0x0535('0x3d')],_0x8532b8,'\x20'),'description':intUtil[_0x0535('0x3c')](_0x2ab203[_0x0535('0x3e')],_0x8532b8,'\x0a'),'owner_id':_0x5871b5['userId'],'creater_id':_0x5871b5[_0x0535('0x22')],'targetable_id':_0x5871b5[_0x0535('0x31')],'targetable_type':_0x0535('0x3f'),'created_at':_0x4a0341[_0x0535('0x35')](_0x0535('0x36')),'due_date':_0x4a0341[_0x0535('0x40')](0x1e,'m')[_0x0535('0x35')](_0x0535('0x36'))},'json':!![]};_0x51fa32[_0x0535('0xf')]=_0x3db580;return rp(_0x51fa32)[_0x0535('0x24')](function(_0x367a8b){_0x5871b5['ticketId']=_0x367a8b[_0x0535('0x41')]['id'];logger['info'](_0x0535('0x42'),_0x5871b5[_0x0535('0x43')]);_0x40f13d(_0x5871b5);})[_0x0535('0x17')](function(_0x4e8b11){logger[_0x0535('0x18')]('['+[_0x56885c[_0x0535('0x19')]()]+']',_0x4e8b11[_0x0535('0x1a')]);_0x3a9c7c(_0x4e8b11['message']);});});};}function emit(_0xb05bcc,_0xe680bf,_0x3d830d){var _0x56fb99={'uri':_0xb05bcc+_0x0535('0x44')+_0x3d830d};io['to'](util[_0x0535('0x35')](_0x0535('0x45'),_0xe680bf))['emit'](_0x0535('0x46'),_0x56fb99);}exports['cs']=function(_0x64513b,_0x51cc26,_0x5c3365,_0x4ee89f,_0x2c5041,_0x566a40,_0x25c0ee,_0xb1654d){var _0x1dbbea={};var _0x6040eb={'Authorization':_0x0535('0x47')+_0x566a40[_0x0535('0x48')]};_0x566a40[_0x0535('0x49')]=intUtil[_0x0535('0x4a')](_0x566a40[_0x0535('0x49')]);_0x566a40[_0x0535('0x4b')]=intUtil['stripTrailingSlash'](_0x566a40[_0x0535('0x4b')]);var _0x305fc0=_0x566a40['remoteUri'];_0x1dbbea[_0x0535('0x14')]=_0x566a40['username'];_0x1dbbea[_0x0535('0x2f')]=_0xb1654d['toLowerCase']()===_0x0535('0x4c')?_0x51cc26[_0x0535('0x4d')]:_0x51cc26[_0x0535('0x4e')];_0x1dbbea[_0x0535('0x4f')]=_0xb1654d==='queue'||_0xb1654d==='unmanaged'?'queue':_0x0535('0x4c');if(_0x4ee89f){_0x1dbbea[_0x0535('0x1c')]=_0x4ee89f['email'];}var _0x5788c3=util[_0x0535('0x35')](_0x0535('0x50'),_0x566a40[_0x0535('0x4b')],_0x51cc26[_0x0535('0x51')],md5(_0x51cc26['uniqueid']));if(_0x2c5041&&_0x2c5041[_0x0535('0x52')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x51cc26[_0x0535('0x53')]=_0x5788c3;}else if(_0x25c0ee&&_0x25c0ee[_0x0535('0x54')]&&_0x25c0ee[_0x0535('0x54')]!=='none'){logger[_0x0535('0x10')](_0x0535('0x55'),_0x0535('0x56'));_0x51cc26[_0x0535('0x53')]=_0x5788c3;}else{_0x51cc26[_0x0535('0x53')]='';}return getAdminId(_0x1dbbea,_0xb1654d,_0x6040eb,_0x305fc0)[_0x0535('0x24')](getUser(_0xb1654d,_0x6040eb,_0x305fc0))[_0x0535('0x24')](getEndUser(_0xb1654d,_0x6040eb,_0x305fc0))[_0x0535('0x24')](getTicket(_0xb1654d,_0x6040eb,_0x305fc0,_0x5c3365,_0x51cc26))[_0x0535('0x24')](function(_0x1acd4f){logger[_0x0535('0x10')](util['format'](_0x0535('0x57'),_0x1acd4f[_0x0535('0x43')]));if(_0xb1654d!==_0x0535('0x58')){logger[_0x0535('0x10')]('['+[_0xb1654d['toUpperCase']()]+']',_0x0535('0x59'));emit(_0x305fc0,_0x4ee89f['name'],_0x1acd4f[_0x0535('0x31')]);}})[_0x0535('0x17')](function(_0x4d7996){logger[_0x0535('0x18')]('['+[_0xb1654d[_0x0535('0x19')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x0535('0x5a')](_0x4d7996,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb889=['user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','toUpperCase','message','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','email','userId','User\x20found:','Admin\x20selected','catch','error','/api/contacts/filters','Getting\x20contacts\x20filter','name','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','work_number','Contact\x20found:','endUserId','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','task','Task\x20created:','ticketId','/contacts/'];(function(_0x447b8f,_0x396387){var _0x237474=function(_0x15ad47){while(--_0x15ad47){_0x447b8f['push'](_0x447b8f['shift']());}};_0x237474(++_0x396387);}(_0xb889,0x16f));var _0x9b88=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xb889[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x9b88('0x0'));var rp=require(_0x9b88('0x1'));var md5=require(_0x9b88('0x2'));var util=require(_0x9b88('0x3'));var moment=require('moment');var Promise=require(_0x9b88('0x4'));var Redis=require(_0x9b88('0x5'));var intUtil=require(_0x9b88('0x6'));var config=require(_0x9b88('0x7'));var logger=require(_0x9b88('0x8'))(_0x9b88('0x9'));config[_0x9b88('0xa')]=_[_0x9b88('0xb')](config[_0x9b88('0xa')],{'host':_0x9b88('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9b88('0xa')]));function getAdminId(_0x23b6f0,_0x143302,_0x17c1e6,_0x37fa10){return new Promise(function(_0x5c4fc4,_0x3c7b98){var _0x13c0d0=![];var _0x210ac1={'method':_0x9b88('0xd'),'uri':_0x37fa10+_0x9b88('0xe'),'json':!![]};_0x210ac1[_0x9b88('0xf')]=_0x17c1e6;logger[_0x9b88('0x10')](_0x9b88('0x11'));return rp(_0x210ac1)[_0x9b88('0x12')](function(_0x34f7d6){if(_0x34f7d6){var _0x4e5103=_0x34f7d6['users'];var _0x253efd=null;for(_0x253efd=0x0;_0x253efd<_0x4e5103['length'];_0x253efd++){if(_0x4e5103[_0x253efd]['email']===_0x23b6f0[_0x9b88('0x13')]){_0x23b6f0[_0x9b88('0x14')]=_0x4e5103[_0x253efd]['id'];_0x13c0d0=!![];}}if(_0x13c0d0){logger[_0x9b88('0x10')]('Admin\x20found:',_0x23b6f0[_0x9b88('0x14')]);_0x5c4fc4(_0x23b6f0);}else{_0x3c7b98({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3c7b98({'statusCode':0x194,'message':_0x9b88('0x15')});}})['catch'](function(_0x4bc3de){logger['error']('['+[_0x143302[_0x9b88('0x16')]()]+']',_0x4bc3de[_0x9b88('0x17')]);_0x3c7b98(_0x4bc3de);});});}function getUser(_0x199f55,_0x2d9556,_0x1eefac){return function(_0x42554d){return new Promise(function(_0x11a44f,_0x658142){var _0x18a90c={'method':_0x9b88('0xd'),'uri':_0x1eefac+'/api/selector/owners','json':!![]};_0x18a90c[_0x9b88('0xf')]=_0x2d9556;logger['info'](_0x9b88('0x18'));return rp(_0x18a90c)[_0x9b88('0x12')](function(_0x133ec2){if(_0x133ec2){var _0x447143=_0x133ec2[_0x9b88('0x19')];var _0x11fbd8=![];var _0x267bc2=null;if(_0x42554d[_0x9b88('0x1a')]!==null){logger[_0x9b88('0x10')](_0x9b88('0x1b'),_0x42554d['agentEmail']);_0x42554d[_0x9b88('0x1c')]=_0x42554d[_0x9b88('0x1a')];for(_0x267bc2=0x0;_0x267bc2<_0x447143[_0x9b88('0x1d')];_0x267bc2++){if(_0x447143[_0x267bc2][_0x9b88('0x1e')]===_0x42554d['agentEmail']){_0x11fbd8=!![];_0x42554d[_0x9b88('0x1f')]=_0x447143[_0x267bc2]['id'];logger[_0x9b88('0x10')](_0x9b88('0x20'),_0x42554d[_0x9b88('0x1f')]);}}}if(!_0x11fbd8){logger[_0x9b88('0x10')](_0x9b88('0x21'));_0x42554d[_0x9b88('0x1c')]=_0x42554d[_0x9b88('0x13')];_0x42554d[_0x9b88('0x1f')]=_0x42554d['adminId'];_0x11fbd8=!![];}if(_0x11fbd8){_0x11a44f(_0x42554d);}else{_0x658142({'statusCode':0x194,'message':_0x9b88('0x15')});}}else{_0x658142({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x9b88('0x22')](function(_0x4e2544){logger[_0x9b88('0x23')]('['+[_0x199f55[_0x9b88('0x16')]()]+']',_0x4e2544['message']);_0x658142(_0x4e2544);});});};}function getEndUser(_0xda709e,_0x5b1366,_0x243c83){return function(_0x730586){return new Promise(function(_0x5b3142,_0x276164){var _0x977d05=0x0;var _0x587ed2={'method':'GET','uri':_0x243c83+_0x9b88('0x24'),'json':!![]};_0x587ed2[_0x9b88('0xf')]=_0x5b1366;logger['info'](_0x9b88('0x25'));return rp(_0x587ed2)[_0x9b88('0x12')](function(_0x20507d){_0x20507d['filters']['forEach'](function(_0x57c5b9){if(_0x57c5b9[_0x9b88('0x26')]==='All\x20Contacts'){_0x977d05=_0x57c5b9['id'];}});})[_0x9b88('0x12')](function(){logger[_0x9b88('0x10')](_0x9b88('0x27'));var _0x52b443={'method':_0x9b88('0xd'),'uri':_0x243c83+_0x9b88('0x28')+_0x977d05,'json':!![]};_0x52b443[_0x9b88('0xf')]=_0x5b1366;return rp(_0x52b443);})[_0x9b88('0x12')](function(_0x578e7b){logger[_0x9b88('0x10')](_0x9b88('0x29'),_0x730586[_0x9b88('0x2a')]);if(_0x578e7b[_0x9b88('0x2b')][_0x9b88('0x1d')]>0x0){var _0x163aba=_[_0x9b88('0x2c')](_0x578e7b[_0x9b88('0x2b')],function(_0x22992c){if(_0x22992c[_0x9b88('0x2d')]===_0x730586[_0x9b88('0x2a')]||_0x22992c['mobile_number']===_0x730586[_0x9b88('0x2a')]){return _0x22992c;}});if(_0x163aba){_0x730586['endUserId']=_0x163aba['id'];logger[_0x9b88('0x10')](_0x9b88('0x2e'),_0x730586[_0x9b88('0x2f')]);_0x5b3142(_0x730586);}else{return createEndUser(_0x730586,_0xda709e,_0x5b1366,_0x243c83)['then'](function(_0x5819d2){logger[_0x9b88('0x10')]('Contact\x20created:',_0x730586[_0x9b88('0x2f')]);_0x5b3142(_0x5819d2);});}}else{return createEndUser(_0x730586,_0xda709e,_0x5b1366,_0x243c83)[_0x9b88('0x12')](function(_0x52d1e8){logger[_0x9b88('0x10')]('Contact\x20created:',_0x730586['endUserId']);_0x5b3142(_0x52d1e8);});}})['catch'](function(_0x2f2ff6){throw new Error(_0x2f2ff6[_0x9b88('0x17')]);});});};}function createEndUser(_0x162f57,_0x4c8f8c,_0x98425,_0x5561c6){return new Promise(function(_0xf8bddd,_0x148426){var _0xd071=moment();var _0x2488af={'method':_0x9b88('0x30'),'uri':_0x5561c6+_0x9b88('0x31'),'body':{'contact':{'last_name':_0x162f57[_0x9b88('0x2a')],'work_number':_0x162f57[_0x9b88('0x2a')],'mobile_number':_0x162f57[_0x9b88('0x2a')],'owner_id':_0x162f57['userId'],'created_at':_0xd071[_0x9b88('0x32')](_0x9b88('0x33'))}},'json':!![]};_0x2488af[_0x9b88('0xf')]=_0x98425;logger[_0x9b88('0x10')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x2488af)[_0x9b88('0x12')](function(_0x58461c){_0x162f57['endUserId']=_0x58461c[_0x9b88('0x34')]['id'];_0xf8bddd(_0x162f57);})[_0x9b88('0x22')](function(_0x2db369){logger[_0x9b88('0x23')]('['+[_0x4c8f8c[_0x9b88('0x16')]()]+']',_0x2db369[_0x9b88('0x17')]);_0x148426(_0x2db369[_0x9b88('0x17')]);});});}function getTicket(_0x452174,_0x18e1d1,_0x43e341,_0x37274c,_0x42c2c4){return function(_0x5c03bc){logger[_0x9b88('0x10')](_0x9b88('0x35'));return new Promise(function(_0x1226e7,_0x212bbf){var _0x1b1458=moment();var _0xa553bc={'method':'POST','uri':_0x43e341+_0x9b88('0x36'),'body':{'title':intUtil[_0x9b88('0x37')](_0x37274c['Subjects'],_0x42c2c4,'\x20'),'description':intUtil[_0x9b88('0x37')](_0x37274c[_0x9b88('0x38')],_0x42c2c4,'\x0a'),'owner_id':_0x5c03bc[_0x9b88('0x1f')],'creater_id':_0x5c03bc[_0x9b88('0x14')],'targetable_id':_0x5c03bc[_0x9b88('0x2f')],'targetable_type':_0x9b88('0x39'),'created_at':_0x1b1458['format'](_0x9b88('0x33')),'due_date':_0x1b1458[_0x9b88('0x3a')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0xa553bc[_0x9b88('0xf')]=_0x18e1d1;return rp(_0xa553bc)['then'](function(_0xa96e3f){_0x5c03bc['ticketId']=_0xa96e3f[_0x9b88('0x3b')]['id'];logger[_0x9b88('0x10')](_0x9b88('0x3c'),_0x5c03bc[_0x9b88('0x3d')]);_0x1226e7(_0x5c03bc);})[_0x9b88('0x22')](function(_0x39275f){logger[_0x9b88('0x23')]('['+[_0x452174[_0x9b88('0x16')]()]+']',_0x39275f['message']);_0x212bbf(_0x39275f[_0x9b88('0x17')]);});});};}function emit(_0x3a1168,_0x549978,_0x3537fd){var _0x41e7b1={'uri':_0x3a1168+_0x9b88('0x3e')+_0x3537fd};io['to'](util[_0x9b88('0x32')](_0x9b88('0x3f'),_0x549978))['emit'](_0x9b88('0x40'),_0x41e7b1);}exports['cs']=function(_0x168b78,_0x443c9b,_0x1fd343,_0x59b7b2,_0x5e448c,_0x65af72,_0x552848,_0x7e8b5f){var _0x123d23={};var _0x4021c7={'Authorization':_0x9b88('0x41')+_0x65af72[_0x9b88('0x42')]};_0x65af72[_0x9b88('0x43')]=intUtil[_0x9b88('0x44')](_0x65af72[_0x9b88('0x43')]);_0x65af72['serverUrl']=intUtil[_0x9b88('0x44')](_0x65af72[_0x9b88('0x45')]);var _0x5c0da3=_0x65af72[_0x9b88('0x43')];_0x123d23[_0x9b88('0x13')]=_0x65af72[_0x9b88('0x46')];_0x123d23[_0x9b88('0x2a')]=_0x7e8b5f[_0x9b88('0x47')]()===_0x9b88('0x48')?_0x443c9b['destcalleridnum']:_0x443c9b['calleridnum'];_0x123d23[_0x9b88('0x49')]=_0x7e8b5f===_0x9b88('0x4a')||_0x7e8b5f===_0x9b88('0x4b')?_0x9b88('0x4a'):_0x9b88('0x48');if(_0x59b7b2){_0x123d23[_0x9b88('0x1a')]=_0x59b7b2[_0x9b88('0x1e')];}var _0x542f7a=util[_0x9b88('0x32')](_0x9b88('0x4c'),_0x65af72[_0x9b88('0x45')],_0x443c9b[_0x9b88('0x4d')],md5(_0x443c9b[_0x9b88('0x4d')]));if(_0x5e448c&&_0x5e448c[_0x9b88('0x4e')]){logger[_0x9b88('0x10')]('[QUEUE]',_0x9b88('0x4f'));_0x443c9b['recordingURL']=_0x542f7a;}else if(_0x552848&&_0x552848[_0x9b88('0x50')]&&_0x552848[_0x9b88('0x50')]!==_0x9b88('0x51')){logger[_0x9b88('0x10')]('[OUTBOUND]',_0x9b88('0x4f'));_0x443c9b[_0x9b88('0x52')]=_0x542f7a;}else{_0x443c9b[_0x9b88('0x52')]='';}return getAdminId(_0x123d23,_0x7e8b5f,_0x4021c7,_0x5c0da3)[_0x9b88('0x12')](getUser(_0x7e8b5f,_0x4021c7,_0x5c0da3))[_0x9b88('0x12')](getEndUser(_0x7e8b5f,_0x4021c7,_0x5c0da3))['then'](getTicket(_0x7e8b5f,_0x4021c7,_0x5c0da3,_0x1fd343,_0x443c9b))['then'](function(_0x3c57df){logger[_0x9b88('0x10')](util[_0x9b88('0x32')](_0x9b88('0x53'),_0x3c57df[_0x9b88('0x3d')]));if(_0x7e8b5f!=='unmanaged'){logger[_0x9b88('0x10')]('['+[_0x7e8b5f['toUpperCase']()]+']',_0x9b88('0x54'));emit(_0x5c0da3,_0x59b7b2['name'],_0x3c57df['endUserId']);}})['catch'](function(_0x3ee602){logger['error']('['+[_0x7e8b5f[_0x9b88('0x16')]()]+_0x9b88('0x55'),util['inspect'](_0x3ee602,{'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 dd4f41e..9288ade 100644 --- a/server/services/ami/trigger/integration/index.js +++ b/server/services/ami/trigger/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['data1','data2','find','Configurations','data3','queue','outbound','EVENT\x20UNKNOWN','unmanaged','toLowerCase','vtiger','freshsales','log','unknown\x20integration','../../../../config/logger','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','error','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','dynamics365','servicenow','exec','includes'];(function(_0x5658e6,_0x133234){var _0x32cf9e=function(_0x1c0f7d){while(--_0x1c0f7d){_0x5658e6['push'](_0x5658e6['shift']());}};_0x32cf9e(++_0x133234);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0x5eb8[_0x5712f8];return _0x14a364;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x85eb('0x0'));var salesforce=require(_0x85eb('0x1'));var sugarcrm=require(_0x85eb('0x2'));var freshdesk=require(_0x85eb('0x3'));var zoho=require(_0x85eb('0x4'));var desk=require(_0x85eb('0x5'));var vtiger=require(_0x85eb('0x6'));var servicenow=require(_0x85eb('0x7'));var dynamics365=require(_0x85eb('0x8'));var freshsales=require(_0x85eb('0x9'));var integrations=[_0x85eb('0xa'),_0x85eb('0xb'),'sugarcrm',_0x85eb('0xc'),_0x85eb('0xd'),_0x85eb('0xe'),'vtiger',_0x85eb('0xf'),'freshsales',_0x85eb('0x10')];exports[_0x85eb('0x11')]=function(_0x673228,_0x29030b,_0x1dacf2,_0x73e6d0,_0x2c7fd3,_0x50ef6f){if(_0x1dacf2){if(_[_0x85eb('0x12')](integrations,_0x673228[_0x85eb('0x13')]['toLowerCase']())){try{var _0x2af376=null;var _0x784583='';var _0x2f42ba=_0x1dacf2[_0x673228[_0x85eb('0x13')]['toLowerCase']()];if(_0x2f42ba){var _0x548628=_0x2f42ba[_0x673228[_0x85eb('0x14')]];if(_0x548628){var _0x5c760a=_[_0x85eb('0x15')](_0x548628[_0x85eb('0x16')],{'id':parseInt(_0x673228[_0x85eb('0x17')],0xa)});if(_0x5c760a){if(_0x73e6d0){if(_0x2c7fd3&&_0x29030b[_0x85eb('0x18')]){_0x784583=_0x85eb('0x18');}else if(_0x29030b['routeId']){_0x784583=_0x85eb('0x19');}else{console['log'](_0x85eb('0x1a'),_0x29030b);}}else{_0x784583=_0x85eb('0x1b');}switch(_0x673228[_0x85eb('0x13')][_0x85eb('0x1c')]()){case'zendesk':zendesk[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case'salesforce':salesforce[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case'sugarcrm':sugarcrm[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0xc'):freshdesk[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0xd'):zoho[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0xe'):desk[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0x1d'):vtiger[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0x1e'):freshsales['cs'](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f,_0x784583);break;case _0x85eb('0x10'):servicenow['cs'](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f,_0x784583);break;case'dynamics365':dynamics365['cs'](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f,_0x784583);break;default:console[_0x85eb('0x1f')](_0x85eb('0x20'));}}else{_0x2af376=require(_0x85eb('0x21'))(_0x673228['data1']['toLowerCase']());_0x2af376['error']('[EXEC]',util[_0x85eb('0x22')](_0x85eb('0x23'),_0x673228[_0x85eb('0x13')][_0x85eb('0x1c')](),_0x673228[_0x85eb('0x17')]));}}else{_0x2af376=require(_0x85eb('0x21'))(_0x673228['data1']['toLowerCase']());_0x2af376['error'](_0x85eb('0x24'),util[_0x85eb('0x22')](_0x85eb('0x25'),_0x673228[_0x85eb('0x13')][_0x85eb('0x1c')](),_0x673228[_0x85eb('0x14')]));}}else{}}catch(_0x5dfc96){console[_0x85eb('0x26')](_0x5dfc96);}}}}; \ No newline at end of file +var _0xda3f=['outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','sugarcrm','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','data2','util','./zendesk','./zoho','./vtiger','./servicenow','./freshsales','zendesk','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','Configurations','data3'];(function(_0x47517e,_0x59d6eb){var _0x360a08=function(_0x246bb8){while(--_0x246bb8){_0x47517e['push'](_0x47517e['shift']());}};_0x360a08(++_0x59d6eb);}(_0xda3f,0xec));var _0xfda3=function(_0x32c3a8,_0x363fd0){_0x32c3a8=_0x32c3a8-0x0;var _0xa0846f=_0xda3f[_0x32c3a8];return _0xa0846f;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var zendesk=require(_0xfda3('0x1'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0xfda3('0x2'));var desk=require('./desk');var vtiger=require(_0xfda3('0x3'));var servicenow=require(_0xfda3('0x4'));var dynamics365=require('./dynamics365');var freshsales=require(_0xfda3('0x5'));var integrations=[_0xfda3('0x6'),'salesforce','sugarcrm',_0xfda3('0x7'),_0xfda3('0x8'),_0xfda3('0x9'),_0xfda3('0xa'),_0xfda3('0xb'),_0xfda3('0xc'),_0xfda3('0xd')];exports[_0xfda3('0xe')]=function(_0xdc5b45,_0x14d549,_0x102643,_0x4713ba,_0x4d7841,_0xe933f5){if(_0x102643){if(_[_0xfda3('0xf')](integrations,_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')]())){try{var _0x1443f4=null;var _0x4b77ea='';var _0x583125=_0x102643[_0xdc5b45['data1'][_0xfda3('0x11')]()];if(_0x583125){var _0x1e7a55=_0x583125[_0xdc5b45['data2']];if(_0x1e7a55){var _0x501588=_['find'](_0x1e7a55[_0xfda3('0x12')],{'id':parseInt(_0xdc5b45[_0xfda3('0x13')],0xa)});if(_0x501588){if(_0x4713ba){if(_0x4d7841&&_0x14d549['queue']){_0x4b77ea='queue';}else if(_0x14d549['routeId']){_0x4b77ea=_0xfda3('0x14');}else{console[_0xfda3('0x15')](_0xfda3('0x16'),_0x14d549);}}else{_0x4b77ea=_0xfda3('0x17');}switch(_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')]()){case _0xfda3('0x6'):zendesk[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x18'):salesforce[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x19'):sugarcrm[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x7'):freshdesk[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case'zoho':zoho[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x9'):desk[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0xa'):vtiger[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0xc'):freshsales['cs'](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5,_0x4b77ea);break;case _0xfda3('0xd'):servicenow['cs'](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5,_0x4b77ea);break;case'dynamics365':dynamics365['cs'](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5,_0x4b77ea);break;default:console[_0xfda3('0x15')](_0xfda3('0x1a'));}}else{_0x1443f4=require(_0xfda3('0x1b'))(_0xdc5b45['data1']['toLowerCase']());_0x1443f4[_0xfda3('0x1c')](_0xfda3('0x1d'),util[_0xfda3('0x1e')]('%s\x20configuration\x20#%s\x20not\x20found',_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')](),_0xdc5b45[_0xfda3('0x13')]));}}else{_0x1443f4=require(_0xfda3('0x1b'))(_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')]());_0x1443f4[_0xfda3('0x1c')](_0xfda3('0x1d'),util[_0xfda3('0x1e')]('%s\x20account\x20#%s\x20not\x20found',_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')](),_0xdc5b45[_0xfda3('0x1f')]));}}else{}}catch(_0x4ae9b9){console[_0xfda3('0x1c')](_0x4ae9b9);}}}}; \ 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 c4713bd..df68bd9 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 _0x7afa=['validateEmail','User','find','execute','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','lead','Case','Phone','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','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','toLowerCase','password','concat','securityToken','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','name','integrationTab','user:%s','newTab','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','[OUTBOUND]','uniqueid','email','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','localhost','socket.io-emitter','emit','ticketType','Task','assign','utc','Subjects','getString','Descriptions','WhoId','sobject','create','isNil'];(function(_0x3b601f,_0x249171){var _0x421392=function(_0x541480){while(--_0x541480){_0x3b601f['push'](_0x3b601f['shift']());}};_0x421392(++_0x249171);}(_0x7afa,0x13e));var _0xa7af=function(_0x4a9dda,_0x345843){_0x4a9dda=_0x4a9dda-0x0;var _0x48750b=_0x7afa[_0x4a9dda];return _0x48750b;};'use strict';var _=require(_0xa7af('0x0'));var rp=require(_0xa7af('0x1'));var moment=require(_0xa7af('0x2'));var BPromise=require(_0xa7af('0x3'));var md5=require('md5');var jsforce=require(_0xa7af('0x4'));var util=require(_0xa7af('0x5'));var Redis=require(_0xa7af('0x6'));var intUtil=require(_0xa7af('0x7'));var config=require(_0xa7af('0x8'));var logger=require(_0xa7af('0x9'))(_0xa7af('0xa'));config['redis']=_[_0xa7af('0xb')](config[_0xa7af('0xc')],{'host':_0xa7af('0xd'),'port':0x18eb});var io=require(_0xa7af('0xe'))(new Redis(config[_0xa7af('0xc')]));function emit(_0x1f90c7,_0x5787cb,_0x41e78a){io['to'](_0x1f90c7)[_0xa7af('0xf')](_0x5787cb,_0x41e78a);}function getTicket(_0x44c145,_0x195ac7,_0x57e752,_0x5408b8,_0x58b11d,_0x48a38c,_0x10235f,_0x1f45c7){var _0x294a80={};if(_0x5408b8[_0xa7af('0x10')]===_0xa7af('0x11')){_0x294a80=Object[_0xa7af('0x12')]({},{'OwnerId':_0x195ac7['id'],'ActivityDate':moment[_0xa7af('0x13')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x5408b8[_0xa7af('0x14')],_0x58b11d,'\x20'),'Description':intUtil[_0xa7af('0x15')](_0x5408b8[_0xa7af('0x16')],_0x58b11d,'\x0a')},getCustomFields(_0x48a38c,_0x58b11d));if(_0x57e752){_0x294a80[_0xa7af('0x17')]=_0x57e752['id'];}}else if(_0x5408b8[_0xa7af('0x10')]==='Case'){_0x294a80=Object['assign']({},{'OwnerId':_0x195ac7['id'],'Subject':intUtil['getString'](_0x5408b8[_0xa7af('0x14')],_0x58b11d,'\x20'),'Description':intUtil['getString'](_0x5408b8[_0xa7af('0x16')],_0x58b11d,'\x0a')},getCustomFields(_0x48a38c,_0x58b11d));if(_0x57e752){_0x294a80['ContactId']=_0x57e752['id'];}}return _0x10235f[_0xa7af('0x18')](_0x5408b8[_0xa7af('0x10')])[_0xa7af('0x19')](_0x294a80);}function getUser(_0x38dda2,_0x2457f1,_0x277750){if(!_[_0xa7af('0x1a')](_0x2457f1)&&intUtil[_0xa7af('0x1b')](_0x2457f1)){var _0x4db312={'Email':_0x2457f1};var _0xac931b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x277750[_0xa7af('0x18')](_0xa7af('0x1c'))[_0xa7af('0x1d')](_0x4db312,_0xac931b)[_0xa7af('0x1e')]()[_0xa7af('0x1f')](function(_0x3f4fef){if(_0x3f4fef[_0xa7af('0x20')]){var _0x435dc3=_['find'](_0x3f4fef,function(_0xace4b4){return _0xace4b4[_0xa7af('0x21')]===_0x2457f1;});if(_0x435dc3){logger[_0xa7af('0x22')](_0xa7af('0x23'),_0x2457f1);return BPromise[_0xa7af('0x24')]({'id':_0x435dc3['Id'],'name':_0x435dc3[_0xa7af('0x25')]});}}else{logger[_0xa7af('0x22')](_0xa7af('0x26'),_0x2457f1);return _0x277750[_0xa7af('0x27')]()['then'](function(_0x463abc){return BPromise[_0xa7af('0x24')]({'id':_0x463abc[_0xa7af('0x28')],'name':_0x463abc['display_name']});});}});}else{logger[_0xa7af('0x22')](_0xa7af('0x26'),_0x2457f1);return _0x277750[_0xa7af('0x27')]()['then'](function(_0x3005a6){return BPromise[_0xa7af('0x24')]({'id':_0x3005a6[_0xa7af('0x28')],'name':_0x3005a6[_0xa7af('0x29')]});});}}function getEndUser(_0x44f6e1,_0x1e351b,_0x3a1f91,_0x15a052,_0x3ea6ca){var _0x131d07={'Phone':_0x15a052};var _0x1dc92c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){if(_0x1e351b[_0xa7af('0x10')]==='Task'){logger[_0xa7af('0x22')](_0xa7af('0x2a'),_0x15a052,_0x1e351b[_0xa7af('0x2b')]);switch(_0x1e351b['moduleSearch']){case _0xa7af('0x2c'):return _0x3ea6ca[_0xa7af('0x18')](_0xa7af('0x2d'))[_0xa7af('0x1d')](_0x131d07,_0x1dc92c)[_0xa7af('0x1e')]()['then'](function(_0x169d8c){if(_0x169d8c&&_0x169d8c[_0xa7af('0x20')]){return _0x169d8c;}else{return _0x3ea6ca[_0xa7af('0x18')](_0xa7af('0x2e'))['find'](_0x131d07,_0x1dc92c);}});case _0xa7af('0x2f'):return _0x3ea6ca[_0xa7af('0x18')](_0xa7af('0x2d'))[_0xa7af('0x1d')](_0x131d07,_0x1dc92c)['execute']();case _0xa7af('0x30'):return _0x3ea6ca[_0xa7af('0x18')](_0xa7af('0x2e'))['find'](_0x131d07,_0x1dc92c);default:return null;}}else if(_0x1e351b[_0xa7af('0x10')]===_0xa7af('0x31')){logger[_0xa7af('0x22')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x15a052,_0xa7af('0x2f'));return _0x3ea6ca[_0xa7af('0x18')](_0xa7af('0x2d'))[_0xa7af('0x1d')](_0x131d07,_0x1dc92c)['execute']();}})[_0xa7af('0x1f')](function(_0x2720f3){if(_0x2720f3&&_0x2720f3[_0xa7af('0x20')]){var _0x2576c8=_['find'](_0x2720f3,function(_0x14dd61){return _0x14dd61['Phone']===_0x15a052;});if(_0x2576c8){return BPromise[_0xa7af('0x24')]({'id':_0x2576c8['Id'],'name':_0x2576c8[_0xa7af('0x25')],'phone':_0x2576c8[_0xa7af('0x32')]});}}})[_0xa7af('0x1f')](function(_0x1e2c0f){if(_0x1e2c0f){logger[_0xa7af('0x22')](_0xa7af('0x33'),_0x15a052);return BPromise[_0xa7af('0x24')](_0x1e2c0f);}else{logger[_0xa7af('0x22')](_0xa7af('0x34'),_0x15a052);var _0x4d8364={'LastName':_0x3a1f91!==''?_0x3a1f91:util[_0xa7af('0x35')]('Caller\x20-\x20%s',_0x15a052),'Phone':_0x15a052};if(_0x1e351b[_0xa7af('0x36')]){if(_0x1e351b[_0xa7af('0x36')]===_0xa7af('0x2f')){logger[_0xa7af('0x22')](_0xa7af('0x37'),_0x15a052,_0x1e351b[_0xa7af('0x36')]);}else if(_0x1e351b['moduleCreate']===_0xa7af('0x30')&&_0x1e351b[_0xa7af('0x10')]===_0xa7af('0x11')){logger[_0xa7af('0x22')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x15a052,_0x1e351b[_0xa7af('0x36')]);_0x4d8364[_0xa7af('0x38')]=_0xa7af('0x39');}else{return null;}}return _0x3ea6ca['sobject'](_['upperFirst'](_0x1e351b[_0xa7af('0x36')]))[_0xa7af('0x19')](_0x4d8364);}});}function getCustomFields(_0x80c479,_0x6e039e){var _0x497a27={};if(_0x80c479[_0xa7af('0x20')]>0x0){_[_0xa7af('0x3a')](_0x80c479,function(_0x13d3e0){if(_0x13d3e0[_0xa7af('0x3b')]===_0xa7af('0x3c')&&_0x13d3e0['idField']){_0x497a27[_0x13d3e0[_0xa7af('0x3d')]]=_0x13d3e0[_0xa7af('0x3e')][_0xa7af('0x3f')]();}else if(_0x13d3e0[_0xa7af('0x3b')]==='variable'&&_0x13d3e0['variableName']&&_0x13d3e0['idField']){_0x6e039e[_0x13d3e0['variableName']]&&(_0x497a27[_0x13d3e0['idField']]=_0x6e039e[_0x13d3e0[_0xa7af('0x40')]][_0xa7af('0x3f')]());}else if(_0x13d3e0[_0xa7af('0x3b')]===_0xa7af('0x41')&&_0x13d3e0[_0xa7af('0x42')]&&_0x13d3e0['Variable']['name']&&_0x13d3e0[_0xa7af('0x3d')]){_0x6e039e[_0x13d3e0[_0xa7af('0x42')]['name'][_0xa7af('0x43')]()]&&(_0x497a27[_0x13d3e0[_0xa7af('0x3d')]]=_0x6e039e[_0x13d3e0[_0xa7af('0x42')]['name'][_0xa7af('0x43')]()][_0xa7af('0x3f')]());}});}return _0x497a27;}function getConnection(_0x49ace3){var _0x50e7df=_0x49ace3[_0xa7af('0x44')][_0xa7af('0x45')](_0x49ace3[_0xa7af('0x46')]);var _0x335e24=new jsforce['Connection']({'oauth2':{'loginUrl':_0x49ace3['remoteUri']||_0xa7af('0x47'),'clientId':_0x49ace3[_0xa7af('0x48')],'clientSecret':_0x49ace3[_0xa7af('0x49')]}});return _0x335e24[_0xa7af('0x4a')](_0x49ace3[_0xa7af('0x4b')],_0x50e7df)[_0xa7af('0x1f')](function(){logger['info'](_0xa7af('0x4c'));return _0x335e24;});}exports['queue']=function(_0x287f2b,_0x1ae44b,_0x484cbd,_0x41519f,_0x7f28b1,_0x50f596){var _0x1f5f99,_0x4708a3,_0xef5479,_0xc0c75b;_0x50f596[_0xa7af('0x4d')]=intUtil[_0xa7af('0x4e')](_0x50f596[_0xa7af('0x4d')]);_0x50f596['remoteUri']=intUtil[_0xa7af('0x4e')](_0x50f596[_0xa7af('0x4f')]);if(_0x7f28b1&&_0x7f28b1[_0xa7af('0x50')]){logger[_0xa7af('0x22')](_0xa7af('0x51'),_0xa7af('0x52'));_0x1ae44b[_0xa7af('0x53')]=util[_0xa7af('0x35')](_0xa7af('0x54'),_0x50f596['serverUrl'],_0x1ae44b['uniqueid'],md5(_0x1ae44b['uniqueid']));}else{_0x1ae44b['recordingURL']='';}return getConnection(_0x50f596)[_0xa7af('0x1f')](function(_0x25526b){_0xc0c75b=_0x25526b;return getUser(_0x50f596,_0x41519f['email'],_0xc0c75b);})[_0xa7af('0x1f')](function(_0x2e09aa){_0x1f5f99=_0x2e09aa;return getEndUser(_0x50f596,_0x484cbd,_0x1ae44b[_0xa7af('0x55')],_0x1ae44b['calleridnum'],_0xc0c75b);})[_0xa7af('0x1f')](function(_0x23af9b){_0x4708a3=_0x23af9b;return getTicket(_0x50f596,_0x1f5f99,_0x4708a3,_0x484cbd,_0x1ae44b,_0x484cbd[_0xa7af('0x56')],_0xc0c75b,_0xa7af('0x57'));})['then'](function(_0x41ef76){_0xef5479=_0x41ef76;logger[_0xa7af('0x22')](_0xa7af('0x58'),_0xef5479['id']);logger[_0xa7af('0x22')](_0xa7af('0x59'),_0xef5479['id'],_0x41519f[_0xa7af('0x5a')],_0x50f596[_0xa7af('0x3b')]);switch(_0x50f596['type']){case _0xa7af('0x5b'):emit(util[_0xa7af('0x35')](_0xa7af('0x5c'),_0x41519f['name']),'trigger:salesforce:display',{'recordId':_0xef5479['id']});break;case _0xa7af('0x5d'):emit(util['format']('user:%s',_0x41519f[_0xa7af('0x5a')]),'trigger:browser:url',{'uri':util[_0xa7af('0x35')]('%s/%s/e',_0xc0c75b[_0xa7af('0x5e')],_0xef5479['id'])});break;default:logger[_0xa7af('0x5f')](_0xa7af('0x60'));}})[_0xa7af('0x61')](function(_0x414f78){logger[_0xa7af('0x5f')](_0xa7af('0x51'),JSON[_0xa7af('0x62')](_0x414f78));});};exports[_0xa7af('0x63')]=function(_0xec62b3,_0x5c4e5a,_0x29e8d8,_0x472b1d,_0x1f4402,_0x54840d,_0x5e6c8e){var _0x59178d,_0x48ab4c,_0x1830fd,_0x444c56;_0x54840d[_0xa7af('0x4d')]=intUtil[_0xa7af('0x4e')](_0x54840d[_0xa7af('0x4d')]);_0x54840d[_0xa7af('0x4f')]=intUtil['stripTrailingSlash'](_0x54840d[_0xa7af('0x4f')]);if(_0x5e6c8e&&_0x5e6c8e[_0xa7af('0x64')]&&_0x5e6c8e[_0xa7af('0x64')]!=='none'){logger[_0xa7af('0x22')](_0xa7af('0x65'),_0xa7af('0x52'));_0x5c4e5a[_0xa7af('0x53')]=util[_0xa7af('0x35')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x54840d[_0xa7af('0x4d')],_0x5c4e5a[_0xa7af('0x66')],md5(_0x5c4e5a[_0xa7af('0x66')]));}return getConnection(_0x54840d)['then'](function(_0x599ba8){_0x444c56=_0x599ba8;return getUser(_0x54840d,_0x472b1d[_0xa7af('0x67')],_0x444c56);})['then'](function(_0x2dcb75){_0x59178d=_0x2dcb75;return getEndUser(_0x54840d,_0x29e8d8,_0x5c4e5a[_0xa7af('0x68')],_0x5c4e5a['destcalleridnum'],_0x444c56);})[_0xa7af('0x1f')](function(_0xf664b5){_0x48ab4c=_0xf664b5;return getTicket(_0x54840d,_0x59178d,_0x48ab4c,_0x29e8d8,_0x5c4e5a,_0x29e8d8[_0xa7af('0x56')],_0x444c56,_0xa7af('0x63'));})['then'](function(_0xfaa471){_0x1830fd=_0xfaa471;logger[_0xa7af('0x22')](_0xa7af('0x69'),_0x1830fd['id']);logger['info'](_0xa7af('0x6a'),_0x1830fd['id'],_0x472b1d[_0xa7af('0x5a')],_0x54840d[_0xa7af('0x3b')]);switch(_0x54840d['type']){case _0xa7af('0x5b'):emit(util[_0xa7af('0x35')](_0xa7af('0x5c'),_0x472b1d['name']),'trigger:salesforce:display',{'recordId':_0x1830fd['id']});break;case _0xa7af('0x5d'):emit(util[_0xa7af('0x35')](_0xa7af('0x5c'),_0x472b1d[_0xa7af('0x5a')]),_0xa7af('0x6b'),{'uri':util[_0xa7af('0x35')](_0xa7af('0x6c'),_0x444c56[_0xa7af('0x5e')],_0x1830fd['id'])});break;default:logger[_0xa7af('0x5f')](_0xa7af('0x65'),_0xa7af('0x6d'));}})['catch'](function(_0x254efe){logger['error'](_0xa7af('0x65'),JSON[_0xa7af('0x62')](_0x254efe));});};exports[_0xa7af('0x6e')]=function(_0x280e26,_0x4f392e,_0x925fd,_0x30f0ce,_0x564439,_0x42d16f){var _0x1ffa12,_0x461d65,_0x114fb8,_0x5ae62b;_0x42d16f[_0xa7af('0x4d')]=intUtil[_0xa7af('0x4e')](_0x42d16f[_0xa7af('0x4d')]);_0x42d16f[_0xa7af('0x4f')]=intUtil[_0xa7af('0x4e')](_0x42d16f[_0xa7af('0x4f')]);if(_0x564439&&_0x564439[_0xa7af('0x50')]){logger['info']('['+_0x4f392e[_0xa7af('0x6f')][_0xa7af('0x70')]()+']',_0xa7af('0x52'));_0x4f392e[_0xa7af('0x53')]=util[_0xa7af('0x35')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x42d16f[_0xa7af('0x4d')],_0x4f392e[_0xa7af('0x66')],md5(_0x4f392e['uniqueid']));}else{_0x4f392e['recordingURL']='';}return getConnection(_0x42d16f)[_0xa7af('0x1f')](function(_0x5b9806){_0x5ae62b=_0x5b9806;if(!_[_0xa7af('0x1a')](_0x30f0ce)){return getUser(_0x42d16f,_0x30f0ce[_0xa7af('0x5a')],_0x5ae62b);}else{return getUser(_0x42d16f,null,_0x5ae62b);}})['then'](function(_0xabc457){_0x1ffa12=_0xabc457;return getEndUser(_0x42d16f,_0x925fd,_0x4f392e[_0xa7af('0x55')],_0x4f392e[_0xa7af('0x71')],_0x5ae62b);})[_0xa7af('0x1f')](function(_0x20d528){_0x461d65=_0x20d528;return getTicket(_0x42d16f,_0x1ffa12,_0x461d65,_0x925fd,_0x4f392e,_0x925fd[_0xa7af('0x56')],_0x5ae62b);})[_0xa7af('0x1f')](function(_0x357dda){_0x114fb8=_0x357dda;logger[_0xa7af('0x22')]('['+_0x4f392e[_0xa7af('0x6f')][_0xa7af('0x70')]()+_0xa7af('0x72'),_0x114fb8['id']);logger[_0xa7af('0x22')]('['+_0x4f392e['lastevent'][_0xa7af('0x70')]()+']\x20Integration\x20account\x20type\x20%s.',_0x42d16f[_0xa7af('0x3b')]);})['catch'](function(_0x568490){logger['error']('['+_0x4f392e[_0xa7af('0x6f')][_0xa7af('0x70')]()+']',JSON['stringify'](_0x568490));});}; \ No newline at end of file +var _0x94c4=['username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','format','uniqueid','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','stringify','recordingFormat','[OUTBOUND]','email','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','monitor_format','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','ticketType','Task','assign','utc','getString','Descriptions','Case','Subjects','ContactId','sobject','create','isNil','validateEmail','User','find','length','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','execute','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','Company','upperFirst','string','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x94c4,0x9f));var _0x494c=function(_0x25669c,_0x3163ce){_0x25669c=_0x25669c-0x0;var _0x5c5284=_0x94c4[_0x25669c];return _0x5c5284;};'use strict';var _=require(_0x494c('0x0'));var rp=require(_0x494c('0x1'));var moment=require('moment');var BPromise=require(_0x494c('0x2'));var md5=require(_0x494c('0x3'));var jsforce=require(_0x494c('0x4'));var util=require(_0x494c('0x5'));var Redis=require(_0x494c('0x6'));var intUtil=require(_0x494c('0x7'));var config=require('../../../../config/environment');var logger=require(_0x494c('0x8'))(_0x494c('0x9'));config[_0x494c('0xa')]=_[_0x494c('0xb')](config[_0x494c('0xa')],{'host':_0x494c('0xc'),'port':0x18eb});var io=require(_0x494c('0xd'))(new Redis(config[_0x494c('0xa')]));function emit(_0x5a94ef,_0x16a397,_0x567b02){io['to'](_0x5a94ef)['emit'](_0x16a397,_0x567b02);}function getTicket(_0x4fe4d1,_0x243108,_0x41ef8c,_0x4b3651,_0x48665d,_0x5e3312,_0x18a8f5,_0x3b1a74){var _0x2e1b38={};if(_0x4b3651[_0x494c('0xe')]===_0x494c('0xf')){_0x2e1b38=Object[_0x494c('0x10')]({},{'OwnerId':_0x243108['id'],'ActivityDate':moment[_0x494c('0x11')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x494c('0x12')](_0x4b3651['Subjects'],_0x48665d,'\x20'),'Description':intUtil['getString'](_0x4b3651[_0x494c('0x13')],_0x48665d,'\x0a')},getCustomFields(_0x5e3312,_0x48665d));if(_0x41ef8c){_0x2e1b38['WhoId']=_0x41ef8c['id'];}}else if(_0x4b3651[_0x494c('0xe')]===_0x494c('0x14')){_0x2e1b38=Object[_0x494c('0x10')]({},{'OwnerId':_0x243108['id'],'Subject':intUtil['getString'](_0x4b3651[_0x494c('0x15')],_0x48665d,'\x20'),'Description':intUtil['getString'](_0x4b3651[_0x494c('0x13')],_0x48665d,'\x0a')},getCustomFields(_0x5e3312,_0x48665d));if(_0x41ef8c){_0x2e1b38[_0x494c('0x16')]=_0x41ef8c['id'];}}return _0x18a8f5[_0x494c('0x17')](_0x4b3651[_0x494c('0xe')])[_0x494c('0x18')](_0x2e1b38);}function getUser(_0x1e7940,_0x4215a7,_0x452a59){if(!_[_0x494c('0x19')](_0x4215a7)&&intUtil[_0x494c('0x1a')](_0x4215a7)){var _0x101286={'Email':_0x4215a7};var _0x554ee4={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x452a59[_0x494c('0x17')](_0x494c('0x1b'))[_0x494c('0x1c')](_0x101286,_0x554ee4)['execute']()['then'](function(_0xaaff10){if(_0xaaff10[_0x494c('0x1d')]){var _0x4c5fe7=_[_0x494c('0x1c')](_0xaaff10,function(_0x59057a){return _0x59057a[_0x494c('0x1e')]===_0x4215a7;});if(_0x4c5fe7){logger[_0x494c('0x1f')]('Agent\x20%s\x20found.',_0x4215a7);return BPromise[_0x494c('0x20')]({'id':_0x4c5fe7['Id'],'name':_0x4c5fe7[_0x494c('0x21')]});}}else{logger[_0x494c('0x1f')](_0x494c('0x22'),_0x4215a7);return _0x452a59['identity']()[_0x494c('0x23')](function(_0x21b147){return BPromise['resolve']({'id':_0x21b147[_0x494c('0x24')],'name':_0x21b147['display_name']});});}});}else{logger[_0x494c('0x1f')](_0x494c('0x22'),_0x4215a7);return _0x452a59[_0x494c('0x25')]()[_0x494c('0x23')](function(_0x5059c6){return BPromise[_0x494c('0x20')]({'id':_0x5059c6[_0x494c('0x24')],'name':_0x5059c6['display_name']});});}}function getEndUser(_0x4f836d,_0x64a520,_0x5df66b,_0xc30371,_0x48cec7){var _0x39c9bf={'Phone':_0xc30371};var _0x4eb134={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x494c('0x20')]()[_0x494c('0x23')](function(){if(_0x64a520[_0x494c('0xe')]===_0x494c('0xf')){logger[_0x494c('0x1f')](_0x494c('0x26'),_0xc30371,_0x64a520[_0x494c('0x27')]);switch(_0x64a520[_0x494c('0x27')]){case _0x494c('0x28'):return _0x48cec7[_0x494c('0x17')](_0x494c('0x29'))[_0x494c('0x1c')](_0x39c9bf,_0x4eb134)['execute']()['then'](function(_0x4555fd){if(_0x4555fd&&_0x4555fd[_0x494c('0x1d')]){return _0x4555fd;}else{return _0x48cec7[_0x494c('0x17')](_0x494c('0x2a'))['find'](_0x39c9bf,_0x4eb134);}});case _0x494c('0x2b'):return _0x48cec7[_0x494c('0x17')](_0x494c('0x29'))[_0x494c('0x1c')](_0x39c9bf,_0x4eb134)[_0x494c('0x2c')]();case'lead':return _0x48cec7[_0x494c('0x17')](_0x494c('0x2a'))[_0x494c('0x1c')](_0x39c9bf,_0x4eb134);default:return null;}}else if(_0x64a520[_0x494c('0xe')]==='Case'){logger['info'](_0x494c('0x26'),_0xc30371,_0x494c('0x2b'));return _0x48cec7[_0x494c('0x17')]('Contact')[_0x494c('0x1c')](_0x39c9bf,_0x4eb134)['execute']();}})[_0x494c('0x23')](function(_0x587127){if(_0x587127&&_0x587127[_0x494c('0x1d')]){var _0x6149d2=_['find'](_0x587127,function(_0x359ea5){return _0x359ea5['Phone']===_0xc30371;});if(_0x6149d2){return BPromise[_0x494c('0x20')]({'id':_0x6149d2['Id'],'name':_0x6149d2[_0x494c('0x21')],'phone':_0x6149d2[_0x494c('0x2d')]});}}})[_0x494c('0x23')](function(_0x3c60cd){if(_0x3c60cd){logger[_0x494c('0x1f')](_0x494c('0x2e'),_0xc30371);return BPromise[_0x494c('0x20')](_0x3c60cd);}else{logger[_0x494c('0x1f')](_0x494c('0x2f'),_0xc30371);var _0x596697={'LastName':_0x5df66b!==''?_0x5df66b:util['format'](_0x494c('0x30'),_0xc30371),'Phone':_0xc30371};if(_0x64a520[_0x494c('0x31')]){if(_0x64a520[_0x494c('0x31')]==='contact'){logger[_0x494c('0x1f')](_0x494c('0x32'),_0xc30371,_0x64a520[_0x494c('0x31')]);}else if(_0x64a520[_0x494c('0x31')]===_0x494c('0x33')&&_0x64a520[_0x494c('0xe')]==='Task'){logger[_0x494c('0x1f')](_0x494c('0x32'),_0xc30371,_0x64a520[_0x494c('0x31')]);_0x596697[_0x494c('0x34')]='No\x20Company';}else{return null;}}return _0x48cec7[_0x494c('0x17')](_[_0x494c('0x35')](_0x64a520[_0x494c('0x31')]))[_0x494c('0x18')](_0x596697);}});}function getCustomFields(_0x242c86,_0x10a147){var _0x23f321={};if(_0x242c86[_0x494c('0x1d')]>0x0){_['forEach'](_0x242c86,function(_0x16ceb3){if(_0x16ceb3['type']===_0x494c('0x36')&&_0x16ceb3[_0x494c('0x37')]){_0x23f321[_0x16ceb3[_0x494c('0x37')]]=_0x16ceb3[_0x494c('0x38')]['toString']();}else if(_0x16ceb3[_0x494c('0x39')]===_0x494c('0x3a')&&_0x16ceb3['variableName']&&_0x16ceb3[_0x494c('0x37')]){_0x10a147[_0x16ceb3['variableName']]&&(_0x23f321[_0x16ceb3['idField']]=_0x10a147[_0x16ceb3[_0x494c('0x3b')]][_0x494c('0x3c')]());}else if(_0x16ceb3[_0x494c('0x39')]===_0x494c('0x3d')&&_0x16ceb3[_0x494c('0x3e')]&&_0x16ceb3[_0x494c('0x3e')]['name']&&_0x16ceb3[_0x494c('0x37')]){_0x10a147[_0x16ceb3['Variable'][_0x494c('0x3f')][_0x494c('0x40')]()]&&(_0x23f321[_0x16ceb3[_0x494c('0x37')]]=_0x10a147[_0x16ceb3['Variable'][_0x494c('0x3f')][_0x494c('0x40')]()]['toString']());}});}return _0x23f321;}function getConnection(_0x37b576){var _0x356785=_0x37b576[_0x494c('0x41')][_0x494c('0x42')](_0x37b576[_0x494c('0x43')]);var _0x5d9dd8=new jsforce[(_0x494c('0x44'))]({'oauth2':{'loginUrl':_0x37b576['remoteUri']||_0x494c('0x45'),'clientId':_0x37b576[_0x494c('0x46')],'clientSecret':_0x37b576[_0x494c('0x47')]}});return _0x5d9dd8[_0x494c('0x48')](_0x37b576[_0x494c('0x49')],_0x356785)[_0x494c('0x23')](function(){logger[_0x494c('0x1f')](_0x494c('0x4a'));return _0x5d9dd8;});}exports[_0x494c('0x4b')]=function(_0x3a1596,_0x14983b,_0x110b2b,_0x4eaa23,_0x1dbe36,_0x2e4ab2){var _0x33e1c7,_0x428672,_0xbd2493,_0x50b638;_0x2e4ab2['serverUrl']=intUtil[_0x494c('0x4c')](_0x2e4ab2[_0x494c('0x4d')]);_0x2e4ab2['remoteUri']=intUtil['stripTrailingSlash'](_0x2e4ab2[_0x494c('0x4e')]);if(_0x1dbe36&&_0x1dbe36['monitor_format']){logger[_0x494c('0x1f')](_0x494c('0x4f'),_0x494c('0x50'));_0x14983b[_0x494c('0x51')]=util[_0x494c('0x52')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2e4ab2[_0x494c('0x4d')],_0x14983b[_0x494c('0x53')],md5(_0x14983b[_0x494c('0x53')]));}else{_0x14983b[_0x494c('0x51')]='';}return getConnection(_0x2e4ab2)['then'](function(_0x10f7e2){_0x50b638=_0x10f7e2;return getUser(_0x2e4ab2,_0x4eaa23['email'],_0x50b638);})[_0x494c('0x23')](function(_0x93b920){_0x33e1c7=_0x93b920;return getEndUser(_0x2e4ab2,_0x110b2b,_0x14983b[_0x494c('0x54')],_0x14983b['calleridnum'],_0x50b638);})['then'](function(_0x45952b){_0x428672=_0x45952b;return getTicket(_0x2e4ab2,_0x33e1c7,_0x428672,_0x110b2b,_0x14983b,_0x110b2b[_0x494c('0x55')],_0x50b638,_0x494c('0x4b'));})[_0x494c('0x23')](function(_0x4061f4){_0xbd2493=_0x4061f4;logger[_0x494c('0x1f')](_0x494c('0x56'),_0xbd2493['id']);logger[_0x494c('0x1f')](_0x494c('0x57'),_0xbd2493['id'],_0x4eaa23[_0x494c('0x3f')],_0x2e4ab2[_0x494c('0x39')]);switch(_0x2e4ab2[_0x494c('0x39')]){case _0x494c('0x58'):emit(util[_0x494c('0x52')](_0x494c('0x59'),_0x4eaa23[_0x494c('0x3f')]),'trigger:salesforce:display',{'recordId':_0xbd2493['id']});break;case _0x494c('0x5a'):emit(util[_0x494c('0x52')]('user:%s',_0x4eaa23[_0x494c('0x3f')]),_0x494c('0x5b'),{'uri':util[_0x494c('0x52')](_0x494c('0x5c'),_0x50b638['instanceUrl'],_0xbd2493['id'])});break;default:logger['error'](_0x494c('0x5d'));}})['catch'](function(_0x2eb3fe){logger[_0x494c('0x5e')](_0x494c('0x4f'),JSON[_0x494c('0x5f')](_0x2eb3fe));});};exports['outbound']=function(_0x4a3426,_0x4df406,_0x19af97,_0x1df8ef,_0x2e271,_0x29f88b,_0x1b909a){var _0x4b5ea4,_0x2a7a6b,_0x49b57c,_0x24a52f;_0x29f88b[_0x494c('0x4d')]=intUtil[_0x494c('0x4c')](_0x29f88b[_0x494c('0x4d')]);_0x29f88b[_0x494c('0x4e')]=intUtil[_0x494c('0x4c')](_0x29f88b['remoteUri']);if(_0x1b909a&&_0x1b909a[_0x494c('0x60')]&&_0x1b909a['recordingFormat']!=='none'){logger[_0x494c('0x1f')](_0x494c('0x61'),_0x494c('0x50'));_0x4df406[_0x494c('0x51')]=util[_0x494c('0x52')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x29f88b[_0x494c('0x4d')],_0x4df406[_0x494c('0x53')],md5(_0x4df406['uniqueid']));}return getConnection(_0x29f88b)[_0x494c('0x23')](function(_0x1bd0bf){_0x24a52f=_0x1bd0bf;return getUser(_0x29f88b,_0x1df8ef[_0x494c('0x62')],_0x24a52f);})[_0x494c('0x23')](function(_0x192bf3){_0x4b5ea4=_0x192bf3;return getEndUser(_0x29f88b,_0x19af97,_0x4df406[_0x494c('0x63')],_0x4df406[_0x494c('0x64')],_0x24a52f);})[_0x494c('0x23')](function(_0x376f19){_0x2a7a6b=_0x376f19;return getTicket(_0x29f88b,_0x4b5ea4,_0x2a7a6b,_0x19af97,_0x4df406,_0x19af97[_0x494c('0x55')],_0x24a52f,_0x494c('0x65'));})[_0x494c('0x23')](function(_0x1ce13c){_0x49b57c=_0x1ce13c;logger[_0x494c('0x1f')](_0x494c('0x66'),_0x49b57c['id']);logger[_0x494c('0x1f')](_0x494c('0x67'),_0x49b57c['id'],_0x1df8ef['name'],_0x29f88b[_0x494c('0x39')]);switch(_0x29f88b[_0x494c('0x39')]){case _0x494c('0x58'):emit(util[_0x494c('0x52')]('user:%s',_0x1df8ef[_0x494c('0x3f')]),_0x494c('0x68'),{'recordId':_0x49b57c['id']});break;case _0x494c('0x5a'):emit(util[_0x494c('0x52')]('user:%s',_0x1df8ef[_0x494c('0x3f')]),_0x494c('0x5b'),{'uri':util['format']('%s/%s/e',_0x24a52f[_0x494c('0x69')],_0x49b57c['id'])});break;default:logger[_0x494c('0x5e')](_0x494c('0x61'),_0x494c('0x6a'));}})[_0x494c('0x6b')](function(_0x519df7){logger[_0x494c('0x5e')]('[OUTBOUND]',JSON['stringify'](_0x519df7));});};exports[_0x494c('0x6c')]=function(_0x59393c,_0x1f1d5c,_0x1bfa64,_0x5b1fc9,_0x1bdc5d,_0x335add){var _0x2e74dc,_0x2dc42a,_0x35b695,_0x28310c;_0x335add[_0x494c('0x4d')]=intUtil['stripTrailingSlash'](_0x335add[_0x494c('0x4d')]);_0x335add['remoteUri']=intUtil[_0x494c('0x4c')](_0x335add[_0x494c('0x4e')]);if(_0x1bdc5d&&_0x1bdc5d[_0x494c('0x6d')]){logger['info']('['+_0x1f1d5c[_0x494c('0x6e')][_0x494c('0x6f')]()+']',_0x494c('0x50'));_0x1f1d5c[_0x494c('0x51')]=util[_0x494c('0x52')](_0x494c('0x70'),_0x335add[_0x494c('0x4d')],_0x1f1d5c[_0x494c('0x53')],md5(_0x1f1d5c['uniqueid']));}else{_0x1f1d5c['recordingURL']='';}return getConnection(_0x335add)[_0x494c('0x23')](function(_0x4994f2){_0x28310c=_0x4994f2;if(!_[_0x494c('0x19')](_0x5b1fc9)){return getUser(_0x335add,_0x5b1fc9[_0x494c('0x3f')],_0x28310c);}else{return getUser(_0x335add,null,_0x28310c);}})[_0x494c('0x23')](function(_0x38b464){_0x2e74dc=_0x38b464;return getEndUser(_0x335add,_0x1bfa64,_0x1f1d5c[_0x494c('0x54')],_0x1f1d5c[_0x494c('0x71')],_0x28310c);})['then'](function(_0x3ef082){_0x2dc42a=_0x3ef082;return getTicket(_0x335add,_0x2e74dc,_0x2dc42a,_0x1bfa64,_0x1f1d5c,_0x1bfa64[_0x494c('0x55')],_0x28310c);})[_0x494c('0x23')](function(_0x48e409){_0x35b695=_0x48e409;logger['info']('['+_0x1f1d5c[_0x494c('0x6e')]['toUpperCase']()+_0x494c('0x72'),_0x35b695['id']);logger[_0x494c('0x1f')]('['+_0x1f1d5c[_0x494c('0x6e')][_0x494c('0x6f')]()+_0x494c('0x73'),_0x335add[_0x494c('0x39')]);})['catch'](function(_0xd17e11){logger['error']('['+_0x1f1d5c['lastevent'][_0x494c('0x6f')]()+']',JSON[_0x494c('0x5f')](_0xd17e11));});}; \ 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 c79da54..e101d42 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 _0x1261=['recordingURL','The\x20ticket\x20ID\x20is:\x20%s','format','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','GET','],\x20getUser\x20rp\x20obj','then','length','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','customField','name',']\x20getTicket\x20input\x20crm','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0x5e45f8,_0x336669){var _0x418888=function(_0xeb626c){while(--_0xeb626c){_0x5e45f8['push'](_0x5e45f8['shift']());}};_0x418888(++_0x336669);}(_0x1261,0x144));var _0x1126=function(_0x2c094f,_0xe5a1b0){_0x2c094f=_0x2c094f-0x0;var _0x2f7176=_0x1261[_0x2c094f];return _0x2f7176;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc4aa=['all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','isNil','email','destcalleridnum','calleridnum','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','POST','ticketNumber','push'];(function(_0x451359,_0x49a479){var _0x41b9e5=function(_0x1c5706){while(--_0x1c5706){_0x451359['push'](_0x451359['shift']());}};_0x41b9e5(++_0x49a479);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0xac4a('0x0'));var Promise=require(_0xac4a('0x1'));var rp=require(_0xac4a('0x2'));var util=require(_0xac4a('0x3'));var md5=require(_0xac4a('0x4'));var Redis=require(_0xac4a('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xac4a('0x6'));config[_0xac4a('0x7')]=_[_0xac4a('0x8')](config[_0xac4a('0x7')],{'host':_0xac4a('0x9'),'port':0x18eb});var io=require(_0xac4a('0xa'))(new Redis(config[_0xac4a('0x7')]));function getAdminUser(_0x10525b,_0x5c6179,_0x5b8339,_0x1aba6d,_0x2a4d53,_0x26ec84){return new Promise(function(_0x4f4146,_0x1d182e){var _0x3a82de={'method':_0xac4a('0xb'),'uri':_0x1aba6d+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x2a4d53+'&'+_0x26ec84,'auth':_0x5c6179,'json':!![]};return rp(_0x3a82de)[_0xac4a('0xc')](function(_0x488e3c){if(_0x488e3c[_0xac4a('0xd')]['length']>0x0){_0x5b8339[_0xac4a('0xe')]=_0x488e3c[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}logger['info']('['+[_0x10525b[_0xac4a('0x10')]()]+_0xac4a('0x11'),_0x5b8339);_0x4f4146(_0x5b8339);})[_0xac4a('0x12')](function(_0x6e00d4){logger[_0xac4a('0x13')]('['+[_0x10525b[_0xac4a('0x10')]()]+']',_0x6e00d4[_0xac4a('0x14')]);_0x1d182e(_0x6e00d4[_0xac4a('0x14')]);});});}function getUser(_0x190418,_0x42c7fc,_0x11e101,_0x26dbb8,_0x4a2119){return function(_0x402fff){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x16'),_0x402fff);return new Promise(function(_0x3e88e3,_0x387a54){if(intUtil[_0xac4a('0x17')](_0x402fff[_0xac4a('0x18')])){var _0x546c5d={'method':'GET','uri':_0x11e101+_0xac4a('0x19')+_0x402fff[_0xac4a('0x18')]+'&'+_0x26dbb8+'&'+_0x4a2119,'auth':_0x42c7fc,'json':!![]};logger[_0xac4a('0x15')]('['+[_0x190418['toUpperCase']()]+_0xac4a('0x1a'),_0x546c5d);return rp(_0x546c5d)[_0xac4a('0xc')](function(_0x3752e4){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x1b'),_0x3752e4);if(_0x3752e4[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0&&String(_0x3752e4['result'][0x0][_0xac4a('0x1d')])===_0xac4a('0x1e')){_0x402fff['userId']=_0x3752e4[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}else{_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff['userEmail']=_0x402fff[_0xac4a('0x20')];}logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x21'),_0x402fff);_0x3e88e3(_0x402fff);})[_0xac4a('0x12')](function(_0x2b0dc2){logger[_0xac4a('0x13')]('['+[_0x190418[_0xac4a('0x10')]()]+']',_0x2b0dc2[_0xac4a('0x14')]);_0x387a54(_0x2b0dc2[_0xac4a('0x14')]);});}else{logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x22'));_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff[_0xac4a('0x18')]=_0x402fff['adminEmail'];_0x3e88e3(_0x402fff);}});};}function createEndUser(_0x23b061,_0x267a22,_0x42a33c,_0x2772fe,_0x116700){logger['info']('['+[_0x23b061['toUpperCase']()]+_0xac4a('0x23'),_0x42a33c);return new Promise(function(_0x7a948b,_0x1f12d5){var _0x546b65={'method':'POST','uri':_0x2772fe+_0xac4a('0x24')+_0x116700,'body':{'user_name':_0x42a33c[_0xac4a('0x25')],'roles':_0xac4a('0x26'),'first_name':_0x42a33c[_0xac4a('0x25')],'active':_0xac4a('0x1e'),'date_format':'System','phone':_0x42a33c[_0xac4a('0x25')]},'auth':_0x267a22,'json':!![]};return rp(_0x546b65)['then'](function(_0x30364b){logger['info']('['+[_0x23b061[_0xac4a('0x10')]()]+_0xac4a('0x27'),_0x30364b[_0xac4a('0xd')]);_0x42a33c[_0xac4a('0x28')]=_0x30364b[_0xac4a('0xd')][_0xac4a('0xf')];_0x7a948b(_0x42a33c);})[_0xac4a('0x12')](function(_0x1f13f3){logger[_0xac4a('0x13')]('['+[_0x23b061[_0xac4a('0x10')]()]+']',_0x1f13f3[_0xac4a('0x14')]);_0x1f12d5(_0x1f13f3[_0xac4a('0x14')]);});});}function getEndUser(_0x1a9be2,_0x1a9d4e,_0x5634e2,_0x30442d,_0x1c41fb){return function(_0x5a4e2b){logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x5a4e2b);return new Promise(function(_0x58804b,_0x11f0be){var _0x1ba096={'method':_0xac4a('0xb'),'uri':_0x5634e2+_0xac4a('0x29')+_0x5a4e2b['endUserNumber']+'&'+_0x30442d+'&'+_0x1c41fb,'auth':_0x1a9d4e,'json':!![]};return rp(_0x1ba096)[_0xac4a('0xc')](function(_0x2e56c6){if(_0x2e56c6['result'][_0xac4a('0x1c')]>0x0){_0x5a4e2b[_0xac4a('0x28')]=_0x2e56c6[_0xac4a('0xd')][0x0]['sys_id'];logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+_0xac4a('0x2a'),_0x5a4e2b);_0x58804b(_0x5a4e2b);}else{return createEndUser(_0x1a9be2,_0x1a9d4e,_0x5a4e2b,_0x5634e2,_0x30442d)['then'](function(_0x35bc94){logger[_0xac4a('0x15')]('['+[_0x1a9be2['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x35bc94);_0x58804b(_0x35bc94);});}})[_0xac4a('0x12')](function(_0x5e0926){logger['error']('['+[_0x1a9be2['toUpperCase']()]+']',_0x5e0926['message']);_0x11f0be(_0x5e0926[_0xac4a('0x14')]);});});};}function getCustomFields(_0x2bf8e8,_0x37834b){var _0x472484={};if(_0x2bf8e8[_0xac4a('0x1c')]>0x0){_[_0xac4a('0x2b')](_0x2bf8e8,function(_0x4220e2){if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x2e')]&&!_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')]['toLowerCase']()]=_0x4220e2['content']['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x4220e2[_0xac4a('0x32')][_0xac4a('0x33')]();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x34')&&_0x4220e2['variableName']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x35')]]['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x36')&&_0x4220e2['Variable']&&_0x4220e2[_0xac4a('0x37')]['name']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x37')][_0xac4a('0x38')][_0xac4a('0x31')]()][_0xac4a('0x33')]();}});}return _0x472484;}function getTicket(_0x98e0c4,_0xcb002b,_0x4fa9eb,_0x3b68b3,_0x569812,_0x1646ea){return function(_0x41d11d){logger[_0xac4a('0x15')]('['+[_0x98e0c4['toUpperCase']()]+_0xac4a('0x39'),_0x41d11d);return new Promise(function(_0x19276e,_0x5f54ff){var _0x42969b=_0x98e0c4['toLowerCase']()===_0xac4a('0x3a')?_0x41d11d[_0xac4a('0x1f')]:_0x41d11d[_0xac4a('0x28')];var _0x5e3581={'method':'POST','uri':_0x4fa9eb+_0xac4a('0x3b')+'?'+_0x1646ea,'body':Object['assign']({},{'active':_0xac4a('0x1e'),'caller_id':_0x42969b,'assigned_to':_0x41d11d['userId'],'short_description':intUtil[_0xac4a('0x3c')](_0x3b68b3['Subjects'],_0x569812,'\x20'),'description':intUtil[_0xac4a('0x3c')](_0x3b68b3[_0xac4a('0x3d')],_0x569812,'\x0a')},getCustomFields(_0x3b68b3[_0xac4a('0x3e')],_0x569812)),'auth':_0xcb002b,'json':!![]};return rp(_0x5e3581)[_0xac4a('0xc')](function(_0x54782f){logger[_0xac4a('0x15')]('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x3f'),_0x54782f[_0xac4a('0xd')]);_0x41d11d[_0xac4a('0x40')]=_0x54782f[_0xac4a('0xd')][_0xac4a('0xf')];_0x41d11d['ticketNumber']=_0x54782f[_0xac4a('0xd')][_0xac4a('0x41')];logger['info']('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x42'),_0x41d11d);_0x19276e(_0x41d11d);})[_0xac4a('0x12')](function(_0x3ac36e){logger['error']('['+[_0x98e0c4[_0xac4a('0x10')]()]+']',_0x3ac36e[_0xac4a('0x14')]);_0x5f54ff(_0x3ac36e[_0xac4a('0x14')]);});});};}function createRemoteTag(_0x129d58,_0x890910,_0x49fbc3,_0x179373){return new Promise(function(_0x564b10,_0x307441){var _0x2c04af={'method':'POST','uri':_0x49fbc3+'label'+'?'+_0x179373,'body':{'short_description':_0x129d58,'global':!![],'active':!![],'name':_0x129d58},'auth':_0x890910,'json':!![]};return rp(_0x2c04af)[_0xac4a('0xc')](function(_0x70fdc3){var _0x4d448f=_0x70fdc3[_0xac4a('0xd')][_0xac4a('0xf')];_0x564b10(_0x4d448f);});});}function getRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6,_0x108f7c){return new Promise(function(_0xb43fdb,_0xb5897b){var _0xdc80e3={'method':_0xac4a('0xb'),'uri':_0x48900f+_0xac4a('0x43')+'?sysparm_query=name%3D'+_0x26b582+'&'+_0x3057d6,'auth':_0x103d05,'json':!![]};return rp(_0xdc80e3)[_0xac4a('0xc')](function(_0xef51d0){if(_0xef51d0[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0){var _0x1b7231=_0xef51d0[_0xac4a('0xd')][0x0][_0xac4a('0xf')];_0xb43fdb(_0x1b7231);}else{return createRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6)[_0xac4a('0xc')](function(_0x159e43){_0xb43fdb(_0x159e43);});}});});}function assignTagToIncident(_0x786d9,_0x3b175a,_0x38dd4f,_0x400ac4,_0x2fe7df){return new Promise(function(_0x5222f3,_0x11c753){var _0x492aae={'method':_0xac4a('0x44'),'uri':_0x38dd4f+'label_entry'+'?'+_0x2fe7df,'body':{'label':_0x786d9,'table':_0xac4a('0x3b'),'id_type':'Incident','table_key':_0x400ac4[_0xac4a('0x40')],'title':'Incident\x20-\x20'+_0x400ac4[_0xac4a('0x45')],'id_display':_0x400ac4['ticketNumber']},'auth':_0x3b175a,'json':!![]};return rp(_0x492aae)['then'](function(_0x52c957){_0x5222f3();})[_0xac4a('0x12')](function(){_0x5222f3();});});}function manageTags(_0x3bcae2,_0x3c2f84,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa,_0x50dece){return new Promise(function(_0x34215e,_0x5d03e5){var _0x347880=[];_0x3c2f84[_0xac4a('0x2b')](function(_0x3da7e7){_0x347880[_0xac4a('0x46')](getRemoteTag(_0x3da7e7,_0x2f9940,_0xb7b884,_0x1e1ffa,_0x50dece));});return Promise[_0xac4a('0x47')](_0x347880)[_0xac4a('0xc')](function(_0x3abd57){if(_0x3abd57[_0xac4a('0x1c')]){logger[_0xac4a('0x15')]('['+[_0x3bcae2[_0xac4a('0x10')]()]+_0xac4a('0x48'),_0x3abd57);var _0x2498ad=[];_0x3abd57[_0xac4a('0x2b')](function(_0x2cc410){_0x2498ad[_0xac4a('0x46')](assignTagToIncident(_0x2cc410,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa));});return Promise[_0xac4a('0x47')](_0x2498ad)[_0xac4a('0xc')](function(){_0x34215e();})['catch'](function(){_0x34215e();});}else{_0x34215e();}});});}function getTags(_0xa90d71,_0x1672c0,_0x4fb812,_0x3c3576,_0x34bd1c,_0x2d24c7){return function(_0x2b8562){return new Promise(function(_0x357cac,_0x4d1440){var _0x47c6d8=[];var _0x45f3c3=_0x3c3576[_0xac4a('0x49')];if(_0x45f3c3&&_0x45f3c3[_0xac4a('0x1c')]>0x0){_0x47c6d8=_[_0xac4a('0x4a')](_0x45f3c3,_0xac4a('0x38'));}if(_0x47c6d8[_0xac4a('0x1c')]>0x0){return manageTags(_0xa90d71,_0x47c6d8,_0x1672c0,_0x4fb812,_0x2b8562,_0x34bd1c,_0x2d24c7)[_0xac4a('0xc')](function(){_0x357cac(_0x2b8562);});}else{_0x357cac(_0x2b8562);}});};}function emit(_0x2988d7,_0x44c60b,_0x295f21){var _0x278c09='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xac4a('0x4b')+_0xac4a('0x4c');var _0x2954fc={'uri':_0x2988d7+_0xac4a('0x4d')+_0x295f21+_0x278c09};io['to'](util[_0xac4a('0x4e')](_0xac4a('0x4f'),_0x44c60b))[_0xac4a('0x50')](_0xac4a('0x51'),_0x2954fc);}exports['cs']=function(_0x453d62,_0x2a5acc,_0xb09b89,_0xb12cc5,_0x5f0173,_0x13c854,_0xc74ce8,_0x26bd31){var _0x231932={};var _0x513976={'user':_0x13c854[_0xac4a('0x52')],'pass':_0x13c854['password']};var _0xab4305=_0xac4a('0x53');var _0x499abc='sysparm_display_value=true';_0x13c854[_0xac4a('0x54')]=intUtil[_0xac4a('0x55')](_0x13c854[_0xac4a('0x54')]);_0x13c854['serverUrl']=intUtil[_0xac4a('0x55')](_0x13c854['serverUrl']);var _0x114b11=util['format']('%s/api/now/table/',_0x13c854[_0xac4a('0x54')]);_0x231932['userEmail']=!_[_0xac4a('0x56')](_0xb12cc5)?_0xb12cc5['email']:null;_0x231932[_0xac4a('0x20')]=_0x13c854[_0xac4a('0x57')];_0x231932['endUserNumber']=_0x26bd31[_0xac4a('0x31')]()==='outbound'?_0x2a5acc[_0xac4a('0x58')]:_0x2a5acc[_0xac4a('0x59')];_0x231932['callDirection']=_0x26bd31===_0xac4a('0x5a')||_0x26bd31==='unmanaged'?'queue':_0xac4a('0x3a');var _0x4e3129=util[_0xac4a('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13c854['serverUrl'],_0x2a5acc[_0xac4a('0x5b')],md5(_0x2a5acc[_0xac4a('0x5b')]));if(_0x5f0173&&_0x5f0173[_0xac4a('0x5c')]){logger['info']('[QUEUE]',_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else if(_0xc74ce8&&_0xc74ce8['recordingFormat']&&_0xc74ce8['recordingFormat']!==_0xac4a('0x5f')){logger[_0xac4a('0x15')](_0xac4a('0x60'),_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else{_0x2a5acc[_0xac4a('0x5e')]='';}return getAdminUser(_0x26bd31,_0x513976,_0x231932,_0x114b11,_0x499abc,_0xab4305)[_0xac4a('0xc')](getUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getEndUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getTicket(_0x26bd31,_0x513976,_0x114b11,_0xb09b89,_0x2a5acc,_0x499abc))['then'](function(_0x1201e8){logger[_0xac4a('0x15')](util[_0xac4a('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1201e8[_0xac4a('0x40')]));logger[_0xac4a('0x15')](util[_0xac4a('0x4e')](_0xac4a('0x61'),_0x26bd31));if(_0x26bd31!==_0xac4a('0x62')){logger['info']('['+[_0x26bd31[_0xac4a('0x10')]()]+']',_0xac4a('0x63'));emit(_0x13c854[_0xac4a('0x54')],_0xb12cc5[_0xac4a('0x38')],_0x1201e8[_0xac4a('0x40')]);}})[_0xac4a('0x12')](function(_0xd7bdd6){logger['error']('['+[_0x26bd31[_0xac4a('0x10')]()]+_0xac4a('0x64'),util[_0xac4a('0x65')](_0xd7bdd6,{'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 2886cc2..442ca96 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 _0xadb5=['nameField','toLowerCase','content','toString','customField','custom_fields','idField','variable','customVariable','Variable','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','Fields','Outbound','users','user:%s','trigger:browser:url','catch','unmanaged','The\x20User\x20ID\x20is:','contacts','toUpperCase','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','emit','info','name','Subjects','assigned_user_id','created_by','getString','Descriptions','date_start','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','push','variableName','JSON','stringify','Calls','format','apiKey','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','then','debug','[HTTP]','merge','map','type','string'];(function(_0x4f3cd1,_0x4b666e){var _0x4f304d=function(_0x5691ad){while(--_0x5691ad){_0x4f3cd1['push'](_0x4f3cd1['shift']());}};_0x4f304d(++_0x4b666e);}(_0xadb5,0xad));var _0x5adb=function(_0x2c475d,_0x130d43){_0x2c475d=_0x2c475d-0x0;var _0x368976=_0xadb5[_0x2c475d];return _0x368976;};'use strict';var _=require('lodash');var rp=require(_0x5adb('0x0'));var BPromise=require('bluebird');var md5=require(_0x5adb('0x1'));var util=require(_0x5adb('0x2'));var Redis=require(_0x5adb('0x3'));var intUtil=require('./util');var config=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var io=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));var def={'method':_0x5adb('0xb'),'json':!![]};function emit(_0x47228a,_0x6d1b45,_0x41261c){io['to'](_0x47228a)[_0x5adb('0xc')](_0x6d1b45,_0x41261c);}function getTicket(_0x34f59d,_0x336bad,_0x129f5a,_0x275428,_0x563d86,_0x4c268d,_0x1a8f66,_0x1ea238){logger[_0x5adb('0xd')]('Creating\x20new\x20ticket...');var _0x29f0d5=new Date();var _0x56012f=[{'name':_0x5adb('0xe'),'value':intUtil['getString'](_0x275428[_0x5adb('0xf')],_0x563d86,'\x20')},{'name':_0x5adb('0x10'),'value':_0x336bad['id']},{'name':_0x5adb('0x11'),'value':_0x336bad['id']},{'name':'description','value':intUtil[_0x5adb('0x12')](_0x275428[_0x5adb('0x13')],_0x563d86,'\x0a')},{'name':_0x5adb('0x14'),'value':_0x29f0d5['toISOString']()[_0x5adb('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':_0x5adb('0x16'),'value':'0'},{'name':_0x5adb('0x17'),'value':'15'},{'name':_0x5adb('0x18'),'value':_0x129f5a['id']},{'name':_0x5adb('0x19'),'value':_0x5adb('0x1a')},{'name':_0x5adb('0x1b'),'value':_0x129f5a[_0x5adb('0xe')]},{'name':_0x5adb('0x1c'),'value':_0x1ea238}];if(_0x4c268d[_0x5adb('0x1d')]){_['forEach'](_0x4c268d,function(_0x3fff62){if(_0x563d86[_0x3fff62['variableName']]){_0x56012f[_0x5adb('0x1e')]({'name':_0x3fff62['idField'],'value':_0x563d86[_0x3fff62[_0x5adb('0x1f')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x5adb('0x20'),'rest_data':JSON[_0x5adb('0x21')]({'session':_0x1a8f66['id'],'module_name':_0x5adb('0x22'),'name_value_list':_0x56012f})}});}function getAuth(_0x1fd4a7){return util[_0x5adb('0x23')]('Basic\x20%s',new Buffer(_0x1fd4a7[_0x5adb('0x24')]+':X')['toString']('base64'));}function getServerInfo(_0x3754cc){return request({'form':{'method':_0x5adb('0x25'),'input_type':_0x5adb('0x20'),'response_type':_0x5adb('0x20'),'rest_data':JSON[_0x5adb('0x21')]({'session':_0x3754cc['id']})}});}function getUser(_0x413911,_0xfd9bb9,_0x4ca150){if(!_[_0x5adb('0x26')](_0xfd9bb9)){logger[_0x5adb('0xd')](_0x5adb('0x27'),_0xfd9bb9);return request({'form':{'method':_0x5adb('0x28'),'input_type':_0x5adb('0x20'),'response_type':'JSON','rest_data':JSON[_0x5adb('0x21')]({'session':_0x4ca150['id'],'module_name':_0x5adb('0x29'),'query':util['format'](_0x5adb('0x2a'),_0xfd9bb9),'order_by':'','offset':'0','select_fields':['id',_0x5adb('0xe'),_0x5adb('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x13ad1d){if(_0x13ad1d[_0x5adb('0x2c')][_0x5adb('0x1d')]){var _0x2c64a3=_[_0x5adb('0x2d')](_0x13ad1d[_0x5adb('0x2c')],function(_0x4a5d46){return _0x4a5d46['name_value_list']['user_name'][_0x5adb('0x2e')]===_0xfd9bb9;});if(_0x2c64a3){logger[_0x5adb('0xd')](_0x5adb('0x2f'));return BPromise[_0x5adb('0x30')]({'id':_0x2c64a3[_0x5adb('0x31')]['id']['value'],'name':_0x2c64a3[_0x5adb('0x31')][_0x5adb('0xe')][_0x5adb('0x2e')]});}}logger[_0x5adb('0xd')](_0x5adb('0x32'));return BPromise[_0x5adb('0x30')]({'id':_0x4ca150[_0x5adb('0x31')][_0x5adb('0x33')][_0x5adb('0x2e')],'name':_0x4ca150[_0x5adb('0x31')]['user_name'][_0x5adb('0x2e')]});});}else{logger['info'](_0x5adb('0x34'));return BPromise[_0x5adb('0x30')]({'id':_0x4ca150['name_value_list'][_0x5adb('0x33')][_0x5adb('0x2e')],'name':_0x4ca150[_0x5adb('0x31')]['user_name'][_0x5adb('0x2e')]});}}function getEndUser(_0x14cf00,_0x4b5887,_0x5bb227,_0x1ed9ea){logger['info'](_0x5adb('0x35'),_0x5bb227);return request({'form':{'method':_0x5adb('0x28'),'input_type':_0x5adb('0x20'),'response_type':_0x5adb('0x20'),'rest_data':JSON[_0x5adb('0x21')]({'session':_0x1ed9ea['id'],'module_name':'Contacts','query':util[_0x5adb('0x23')](_0x5adb('0x36'),_0x5bb227),'order_by':'','offset':'0','select_fields':['id',_0x5adb('0xe'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x32eb69){if(_0x32eb69[_0x5adb('0x2c')]['length']){var _0x2355bc=_['find'](_0x32eb69[_0x5adb('0x2c')],function(_0x58cc5d){return _0x58cc5d[_0x5adb('0x31')]['phone_home'][_0x5adb('0x2e')]===_0x5bb227;});if(_0x2355bc){logger[_0x5adb('0xd')]('Enduser\x20found!');return BPromise[_0x5adb('0x30')]({'id':_0x2355bc['name_value_list']['id'][_0x5adb('0x2e')],'name':_0x2355bc[_0x5adb('0x31')][_0x5adb('0xe')]['value'],'phone':_0x2355bc[_0x5adb('0x31')][_0x5adb('0x37')][_0x5adb('0x2e')]});}}else{logger[_0x5adb('0xd')](_0x5adb('0x38'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x1ed9ea['id'],'module_name':_0x5adb('0x1a'),'name_value_list':[{'name':_0x5adb('0x39'),'value':_0x4b5887!==_0x5adb('0x3a')?_0x4b5887:util[_0x5adb('0x23')](_0x5adb('0x3b'),_0x5bb227)},{'name':_0x5adb('0x37'),'value':_0x5bb227}]})}})[_0x5adb('0x3c')](function(_0x3bf282){logger['info']('Enduser\x20created.');return BPromise[_0x5adb('0x30')]({'id':_0x3bf282['id'],'name':_0x3bf282['entry_list'][_0x5adb('0x39')][_0x5adb('0x2e')],'phone':_0x3bf282[_0x5adb('0x2c')][_0x5adb('0x37')][_0x5adb('0x2e')]});});}});}function request(_0x522ee5){logger[_0x5adb('0x3d')](_0x5adb('0x3e'),JSON['stringify'](_0x522ee5));return rp(_[_0x5adb('0x3f')](def,_0x522ee5));}function getTags(_0x1a256c,_0x5833c8){var _0x120497=[];if(_0x1a256c&&_0x1a256c[_0x5adb('0x1d')]>0x0){_0x120497=_[_0x5adb('0x40')](_0x1a256c,_0x5833c8);}return _0x120497;}function getCustomFields(_0x35c379,_0xea3307){var _0x4362ec=[];var _0x33ef58={'custom_fields':[]};if(_0x35c379['length']>0x0){_['forEach'](_0x35c379,function(_0x26a656){if(_0x26a656[_0x5adb('0x41')]===_0x5adb('0x42')&&_0x26a656[_0x5adb('0x43')]&&!_0x26a656['customField']){_0x33ef58[_0x26a656['nameField'][_0x5adb('0x44')]()]=_0x26a656[_0x5adb('0x45')][_0x5adb('0x46')]();}else if(_0x26a656[_0x5adb('0x41')]===_0x5adb('0x42')&&_0x26a656['idField']&&_0x26a656[_0x5adb('0x47')]){_0x33ef58[_0x5adb('0x48')]['push']({'id':_0x26a656[_0x5adb('0x49')],'value':_0x26a656[_0x5adb('0x45')][_0x5adb('0x46')]()});}else if(_0x26a656[_0x5adb('0x41')]===_0x5adb('0x4a')&&_0x26a656[_0x5adb('0x1f')]&&_0x26a656[_0x5adb('0x49')]&&_0x26a656[_0x5adb('0x47')]){_0xea3307[_0x26a656['variableName']]&&_0x33ef58[_0x5adb('0x48')]['push']({'id':_0x26a656['idField'],'value':_0xea3307[_0x26a656['variableName']][_0x5adb('0x46')]()});}else if(_0x26a656[_0x5adb('0x41')]===_0x5adb('0x4b')&&_0x26a656['Variable']&&_0x26a656[_0x5adb('0x4c')]['name']&&_0x26a656[_0x5adb('0x49')]&&_0x26a656[_0x5adb('0x47')]){_0xea3307[_0x26a656[_0x5adb('0x4c')]['name'][_0x5adb('0x44')]()]&&_0x33ef58['custom_fields'][_0x5adb('0x1e')]({'id':_0x26a656[_0x5adb('0x49')],'value':_0xea3307[_0x26a656['Variable'][_0x5adb('0xe')][_0x5adb('0x44')]()][_0x5adb('0x46')]()});}});}return _0x33ef58;}function getConnection(_0x101008){return request({'method':_0x5adb('0xb'),'form':{'method':'login','input_type':_0x5adb('0x20'),'response_type':_0x5adb('0x20'),'rest_data':JSON[_0x5adb('0x21')]({'user_auth':{'user_name':_0x101008[_0x5adb('0x4d')],'password':_0x101008['password'],'encryption':_0x5adb('0x4e')},'application':_0x5adb('0x4f')})}})[_0x5adb('0x3c')](function(_0x4d98d0){var _0x2b34a8=_0x4d98d0;if(_0x2b34a8['id']){def[_0x5adb('0x50')]=_0x2b34a8['id'];return BPromise[_0x5adb('0x30')](_0x2b34a8);}else{throw new Error(util[_0x5adb('0x23')]('Account\x20%d\x20is\x20not\x20valid',_0x101008['id']));}});}function setRelationship(_0x3f5c8e,_0x91775c,_0x28b291,_0x2cee37){return request({'form':{'method':_0x5adb('0x51'),'input_type':'JSON','response_type':_0x5adb('0x20'),'rest_data':JSON['stringify']({'session':_0x3f5c8e['id'],'module_name':_0x5adb('0x22'),'module_id':_0x28b291['id'],'link_field_name':_0x2cee37,'related_ids':[_0x91775c['id']]})}});}exports['queue']=function(_0x31ae72,_0x35df22,_0x1a9358,_0x42f6d9,_0x59b512,_0x18f95c){var _0x229ae2,_0x24b1f1,_0x53d262,_0x5b005d;_0x18f95c['remoteUri']=intUtil[_0x5adb('0x52')](_0x18f95c[_0x5adb('0x53')]);_0x18f95c[_0x5adb('0x54')]=intUtil[_0x5adb('0x52')](_0x18f95c[_0x5adb('0x54')]);def[_0x5adb('0x55')]=util[_0x5adb('0x23')](_0x5adb('0x56'),_0x18f95c[_0x5adb('0x53')]);if(_0x59b512&&_0x59b512[_0x5adb('0x57')]){logger[_0x5adb('0xd')](_0x5adb('0x58'),_0x5adb('0x59'));_0x35df22['recordingURL']=util['format'](_0x5adb('0x5a'),_0x18f95c[_0x5adb('0x54')],_0x35df22[_0x5adb('0x5b')],md5(_0x35df22[_0x5adb('0x5b')]));}else{_0x35df22['recordingURL']='';}return getConnection(_0x18f95c)[_0x5adb('0x3c')](function(_0xddd468){_0x5b005d=_0xddd468;return getUser(_0x18f95c,_0x42f6d9['name'],_0x5b005d);})[_0x5adb('0x3c')](function(_0x476e62){_0x229ae2=_0x476e62;logger[_0x5adb('0xd')]('The\x20User\x20ID\x20is:',_0x229ae2['id']);return getEndUser(_0x18f95c,_0x35df22[_0x5adb('0x5c')],_0x35df22[_0x5adb('0x5d')],_0x5b005d);})[_0x5adb('0x3c')](function(_0x30c92c){_0x24b1f1=_0x30c92c;logger[_0x5adb('0xd')](_0x5adb('0x5e'),_0x24b1f1['id']);return getTicket(_0x18f95c,_0x229ae2,_0x24b1f1,_0x1a9358,_0x35df22,_0x1a9358['Fields'],_0x5b005d,_0x5adb('0x5f'));})[_0x5adb('0x3c')](function(_0x4488e7){_0x53d262=_0x4488e7;logger['info'](_0x5adb('0x60'));logger[_0x5adb('0xd')](_0x5adb('0x61'),_0x53d262['id']);return setRelationship(_0x5b005d,_0x229ae2,_0x53d262,'users');})[_0x5adb('0x3c')](function(){return setRelationship(_0x5b005d,_0x24b1f1,_0x53d262,'contacts');})[_0x5adb('0x3c')](function(){return getServerInfo(_0x5b005d);})[_0x5adb('0x3c')](function(_0x24e1ab){var _0x57f0a4=parseInt(_0x24e1ab[_0x5adb('0x62')][_0x5adb('0x63')](0x0));var _0x539814=util[_0x5adb('0x23')](_0x5adb('0x64'),_0x18f95c[_0x5adb('0x53')],_0x53d262['id']);if(_0x57f0a4>0x6){_0x539814=util[_0x5adb('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x18f95c[_0x5adb('0x53')],_0x53d262['id']);}logger[_0x5adb('0xd')](_0x5adb('0x58'),_0x5adb('0x65'));emit(util['format']('user:%s',_0x42f6d9[_0x5adb('0xe')]),'trigger:browser:url',{'uri':_0x539814});})['catch'](function(_0x5d8e1d){logger[_0x5adb('0x66')](_0x5adb('0x58'),JSON['stringify'](_0x5d8e1d));});};exports[_0x5adb('0x67')]=function(_0x91e023,_0xcdde17,_0xf6ef8a,_0x358a23,_0x126e38,_0x460d20,_0x1ffcd3){var _0x5240c1,_0x4b9e80,_0x58112b,_0x347b7b;_0x460d20[_0x5adb('0x53')]=intUtil[_0x5adb('0x52')](_0x460d20[_0x5adb('0x53')]);_0x460d20[_0x5adb('0x54')]=intUtil[_0x5adb('0x52')](_0x460d20[_0x5adb('0x54')]);def[_0x5adb('0x55')]=util['format']('%s/service/v4_1/rest.php',_0x460d20[_0x5adb('0x53')]);if(_0x1ffcd3&&_0x1ffcd3[_0x5adb('0x68')]&&_0x1ffcd3[_0x5adb('0x68')]!==_0x5adb('0x69')){logger[_0x5adb('0xd')](_0x5adb('0x6a'),_0x5adb('0x59'));_0xcdde17[_0x5adb('0x6b')]=util[_0x5adb('0x23')](_0x5adb('0x5a'),_0x460d20['serverUrl'],_0xcdde17[_0x5adb('0x5b')],md5(_0xcdde17[_0x5adb('0x5b')]));}return getConnection(_0x460d20)[_0x5adb('0x3c')](function(_0x5d3aa4){_0x347b7b=_0x5d3aa4;return getUser(_0x460d20,_0x358a23[_0x5adb('0xe')],_0x347b7b);})[_0x5adb('0x3c')](function(_0x4f7bd0){_0x5240c1=_0x4f7bd0;logger[_0x5adb('0xd')]('The\x20User\x20ID\x20is:',_0x5240c1['id']);return getEndUser(_0x460d20,_0xcdde17[_0x5adb('0x6c')],_0xcdde17[_0x5adb('0x6d')],_0x347b7b);})['then'](function(_0x4734c6){_0x4b9e80=_0x4734c6;logger[_0x5adb('0xd')](_0x5adb('0x5e'),_0x4b9e80['id']);return getTicket(_0x460d20,_0x5240c1,_0x4b9e80,_0xf6ef8a,_0xcdde17,_0xf6ef8a[_0x5adb('0x6e')],_0x347b7b,_0x5adb('0x6f'));})[_0x5adb('0x3c')](function(_0x3cee6c){_0x58112b=_0x3cee6c;logger[_0x5adb('0xd')]('Ticket\x20created!');logger[_0x5adb('0xd')](_0x5adb('0x61'),_0x58112b['id']);return setRelationship(_0x347b7b,_0x5240c1,_0x58112b,_0x5adb('0x70'));})['then'](function(){return setRelationship(_0x347b7b,_0x4b9e80,_0x58112b,'contacts');})[_0x5adb('0x3c')](function(){return getServerInfo(_0x347b7b);})['then'](function(_0x27d3d8){var _0xa69b3c=parseInt(_0x27d3d8[_0x5adb('0x62')]['charAt'](0x0));var _0x3a9735=util[_0x5adb('0x23')](_0x5adb('0x64'),_0x460d20[_0x5adb('0x53')],_0x58112b['id']);if(_0xa69b3c>0x6){_0x3a9735=util[_0x5adb('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x460d20[_0x5adb('0x53')],_0x58112b['id']);}logger[_0x5adb('0xd')](_0x5adb('0x6a'),_0x5adb('0x65'));emit(util['format'](_0x5adb('0x71'),_0x358a23[_0x5adb('0xe')]),_0x5adb('0x72'),{'uri':_0x3a9735});})[_0x5adb('0x73')](function(_0x15d4f1){logger[_0x5adb('0x66')](_0x5adb('0x6a'),JSON['stringify'](_0x15d4f1));});};exports[_0x5adb('0x74')]=function(_0x453031,_0x5f36ec,_0x44f940,_0x2f8468,_0x4fc0d5,_0x462fa0){var _0x50f8ed,_0x372354,_0x268df2,_0x4a2ebc;_0x462fa0[_0x5adb('0x53')]=intUtil['stripTrailingSlash'](_0x462fa0[_0x5adb('0x53')]);_0x462fa0[_0x5adb('0x54')]=intUtil[_0x5adb('0x52')](_0x462fa0[_0x5adb('0x54')]);def[_0x5adb('0x55')]=util['format'](_0x5adb('0x56'),_0x462fa0[_0x5adb('0x53')]);if(_0x4fc0d5&&_0x4fc0d5[_0x5adb('0x57')]){logger[_0x5adb('0xd')]('['+_0x5f36ec['lastevent']['toUpperCase']()+']',_0x5adb('0x59'));_0x5f36ec[_0x5adb('0x6b')]=util[_0x5adb('0x23')](_0x5adb('0x5a'),_0x462fa0[_0x5adb('0x54')],_0x5f36ec[_0x5adb('0x5b')],md5(_0x5f36ec[_0x5adb('0x5b')]));}else{_0x5f36ec['recordingURL']='';}return getConnection(_0x462fa0)[_0x5adb('0x3c')](function(_0x14bada){_0x4a2ebc=_0x14bada;if(!_[_0x5adb('0x26')](_0x2f8468)){return getUser(_0x462fa0,_0x2f8468[_0x5adb('0xe')],_0x4a2ebc);}else{return getUser(_0x462fa0,null,_0x4a2ebc);}})['then'](function(_0x450f90){_0x50f8ed=_0x450f90;logger[_0x5adb('0xd')](_0x5adb('0x75'),_0x50f8ed['id']);return getEndUser(_0x462fa0,_0x5f36ec[_0x5adb('0x5c')],_0x5f36ec[_0x5adb('0x5d')],_0x4a2ebc);})[_0x5adb('0x3c')](function(_0x315ac6){_0x372354=_0x315ac6;logger[_0x5adb('0xd')](_0x5adb('0x5e'),_0x372354['id']);return getTicket(_0x462fa0,_0x50f8ed,_0x372354,_0x44f940,_0x5f36ec,_0x44f940['Fields'],_0x4a2ebc,_0x5adb('0x5f'));})[_0x5adb('0x3c')](function(_0x5c55ee){_0x268df2=_0x5c55ee;logger[_0x5adb('0xd')](_0x5adb('0x60'));logger[_0x5adb('0xd')](_0x5adb('0x61'),_0x268df2['id']);return setRelationship(_0x4a2ebc,_0x50f8ed,_0x268df2,_0x5adb('0x70'));})[_0x5adb('0x3c')](function(){return setRelationship(_0x4a2ebc,_0x372354,_0x268df2,_0x5adb('0x76'));})[_0x5adb('0x3c')](function(){return getServerInfo(_0x4a2ebc);})['catch'](function(_0x11d9ce){logger[_0x5adb('0x66')]('['+_0x5f36ec['lastevent'][_0x5adb('0x77')]()+']',JSON[_0x5adb('0x21')](_0x11d9ce));});}; \ No newline at end of file +var _0xad40=['%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','error','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','Outbound','Ticket\x20created!','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','replace','duration_minutes','parent_type','parent_name','length','forEach','variableName','push','idField','set_entry','stringify','format','apiKey','toString','base64','get_server_info','JSON','isNil','Getting\x20agent\x20with\x20name','Employees','user_name','then','find','entry_list','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','username','PLAIN','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt'];(function(_0x2e6b7e,_0x4b8f20){var _0x3c03cf=function(_0x54f0e9){while(--_0x54f0e9){_0x2e6b7e['push'](_0x2e6b7e['shift']());}};_0x3c03cf(++_0x4b8f20);}(_0xad40,0xfa));var _0x0ad4=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xad40[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0ad4('0x0'));var rp=require(_0x0ad4('0x1'));var BPromise=require(_0x0ad4('0x2'));var md5=require(_0x0ad4('0x3'));var util=require('util');var Redis=require(_0x0ad4('0x4'));var intUtil=require(_0x0ad4('0x5'));var config=require(_0x0ad4('0x6'));var logger=require(_0x0ad4('0x7'))(_0x0ad4('0x8'));config[_0x0ad4('0x9')]=_[_0x0ad4('0xa')](config['redis'],{'host':_0x0ad4('0xb'),'port':0x18eb});var io=require(_0x0ad4('0xc'))(new Redis(config[_0x0ad4('0x9')]));var def={'method':_0x0ad4('0xd'),'json':!![]};function emit(_0x44b342,_0x29f1ee,_0x239e92){io['to'](_0x44b342)['emit'](_0x29f1ee,_0x239e92);}function getTicket(_0x918eb4,_0x3788e9,_0x90d11a,_0x2c5757,_0x2a4ba5,_0xbbd2bd,_0x43197c,_0x48c3d9){logger[_0x0ad4('0xe')](_0x0ad4('0xf'));var _0x23b1de=new Date();var _0x15b90f=[{'name':_0x0ad4('0x10'),'value':intUtil[_0x0ad4('0x11')](_0x2c5757[_0x0ad4('0x12')],_0x2a4ba5,'\x20')},{'name':_0x0ad4('0x13'),'value':_0x3788e9['id']},{'name':_0x0ad4('0x14'),'value':_0x3788e9['id']},{'name':_0x0ad4('0x15'),'value':intUtil['getString'](_0x2c5757[_0x0ad4('0x16')],_0x2a4ba5,'\x0a')},{'name':'date_start','value':_0x23b1de[_0x0ad4('0x17')]()['slice'](0x0,0x13)[_0x0ad4('0x18')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x0ad4('0x19'),'value':'15'},{'name':'parent_id','value':_0x90d11a['id']},{'name':_0x0ad4('0x1a'),'value':'Contacts'},{'name':_0x0ad4('0x1b'),'value':_0x90d11a[_0x0ad4('0x10')]},{'name':'direction','value':_0x48c3d9}];if(_0xbbd2bd[_0x0ad4('0x1c')]){_[_0x0ad4('0x1d')](_0xbbd2bd,function(_0x5dbea6){if(_0x2a4ba5[_0x5dbea6[_0x0ad4('0x1e')]]){_0x15b90f[_0x0ad4('0x1f')]({'name':_0x5dbea6[_0x0ad4('0x20')],'value':_0x2a4ba5[_0x5dbea6[_0x0ad4('0x1e')]]});}});}return request({'form':{'method':_0x0ad4('0x21'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x0ad4('0x22')]({'session':_0x43197c['id'],'module_name':'Calls','name_value_list':_0x15b90f})}});}function getAuth(_0x5394db){return util[_0x0ad4('0x23')]('Basic\x20%s',new Buffer(_0x5394db[_0x0ad4('0x24')]+':X')[_0x0ad4('0x25')](_0x0ad4('0x26')));}function getServerInfo(_0x147361){return request({'form':{'method':_0x0ad4('0x27'),'input_type':_0x0ad4('0x28'),'response_type':_0x0ad4('0x28'),'rest_data':JSON[_0x0ad4('0x22')]({'session':_0x147361['id']})}});}function getUser(_0xf47993,_0x2565aa,_0x169232){if(!_[_0x0ad4('0x29')](_0x2565aa)){logger[_0x0ad4('0xe')](_0x0ad4('0x2a'),_0x2565aa);return request({'form':{'method':'get_entry_list','input_type':_0x0ad4('0x28'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x169232['id'],'module_name':_0x0ad4('0x2b'),'query':util[_0x0ad4('0x23')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x2565aa),'order_by':'','offset':'0','select_fields':['id',_0x0ad4('0x10'),_0x0ad4('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0ad4('0x2d')](function(_0x193a8a){if(_0x193a8a['entry_list'][_0x0ad4('0x1c')]){var _0x34847b=_[_0x0ad4('0x2e')](_0x193a8a[_0x0ad4('0x2f')],function(_0x169555){return _0x169555[_0x0ad4('0x30')]['user_name'][_0x0ad4('0x31')]===_0x2565aa;});if(_0x34847b){logger[_0x0ad4('0xe')]('Agent\x20found!');return BPromise['resolve']({'id':_0x34847b[_0x0ad4('0x30')]['id']['value'],'name':_0x34847b['name_value_list'][_0x0ad4('0x10')]['value']});}}logger[_0x0ad4('0xe')](_0x0ad4('0x32'));return BPromise[_0x0ad4('0x33')]({'id':_0x169232['name_value_list'][_0x0ad4('0x34')][_0x0ad4('0x31')],'name':_0x169232[_0x0ad4('0x30')][_0x0ad4('0x2c')][_0x0ad4('0x31')]});});}else{logger[_0x0ad4('0xe')](_0x0ad4('0x35'));return BPromise[_0x0ad4('0x33')]({'id':_0x169232['name_value_list'][_0x0ad4('0x34')]['value'],'name':_0x169232[_0x0ad4('0x30')][_0x0ad4('0x2c')][_0x0ad4('0x31')]});}}function getEndUser(_0x432f7f,_0x3d72fb,_0x44e177,_0x165c48){logger[_0x0ad4('0xe')]('Searching\x20enduser\x20with\x20phone',_0x44e177);return request({'form':{'method':'get_entry_list','input_type':_0x0ad4('0x28'),'response_type':'JSON','rest_data':JSON[_0x0ad4('0x22')]({'session':_0x165c48['id'],'module_name':_0x0ad4('0x36'),'query':util[_0x0ad4('0x23')](_0x0ad4('0x37'),_0x44e177),'order_by':'','offset':'0','select_fields':['id',_0x0ad4('0x10'),_0x0ad4('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x8764b3){if(_0x8764b3[_0x0ad4('0x2f')][_0x0ad4('0x1c')]){var _0x3e6d2e=_[_0x0ad4('0x2e')](_0x8764b3['entry_list'],function(_0x243058){return _0x243058[_0x0ad4('0x30')][_0x0ad4('0x38')][_0x0ad4('0x31')]===_0x44e177;});if(_0x3e6d2e){logger[_0x0ad4('0xe')](_0x0ad4('0x39'));return BPromise[_0x0ad4('0x33')]({'id':_0x3e6d2e[_0x0ad4('0x30')]['id']['value'],'name':_0x3e6d2e[_0x0ad4('0x30')][_0x0ad4('0x10')][_0x0ad4('0x31')],'phone':_0x3e6d2e[_0x0ad4('0x30')][_0x0ad4('0x38')][_0x0ad4('0x31')]});}}else{logger[_0x0ad4('0xe')](_0x0ad4('0x3a'));return request({'form':{'method':_0x0ad4('0x21'),'input_type':_0x0ad4('0x28'),'response_type':_0x0ad4('0x28'),'rest_data':JSON[_0x0ad4('0x22')]({'session':_0x165c48['id'],'module_name':_0x0ad4('0x36'),'name_value_list':[{'name':_0x0ad4('0x3b'),'value':_0x3d72fb!==''?_0x3d72fb:util[_0x0ad4('0x23')](_0x0ad4('0x3c'),_0x44e177)},{'name':_0x0ad4('0x38'),'value':_0x44e177}]})}})[_0x0ad4('0x2d')](function(_0x18bf38){logger[_0x0ad4('0xe')](_0x0ad4('0x3d'));return BPromise[_0x0ad4('0x33')]({'id':_0x18bf38['id'],'name':_0x18bf38[_0x0ad4('0x2f')][_0x0ad4('0x3b')][_0x0ad4('0x31')],'phone':_0x18bf38['entry_list']['phone_home'][_0x0ad4('0x31')]});});}});}function request(_0xc69b7f){logger[_0x0ad4('0x3e')]('[HTTP]',JSON[_0x0ad4('0x22')](_0xc69b7f));return rp(_[_0x0ad4('0x3f')](def,_0xc69b7f));}function getTags(_0x5b655d,_0x3e3a4a){var _0x2aa94f=[];if(_0x5b655d&&_0x5b655d['length']>0x0){_0x2aa94f=_[_0x0ad4('0x40')](_0x5b655d,_0x3e3a4a);}return _0x2aa94f;}function getCustomFields(_0x42f0fb,_0x116e94){var _0x447991=[];var _0x108ac5={'custom_fields':[]};if(_0x42f0fb['length']>0x0){_[_0x0ad4('0x1d')](_0x42f0fb,function(_0x3a26d3){if(_0x3a26d3[_0x0ad4('0x41')]===_0x0ad4('0x42')&&_0x3a26d3[_0x0ad4('0x43')]&&!_0x3a26d3[_0x0ad4('0x44')]){_0x108ac5[_0x3a26d3[_0x0ad4('0x43')][_0x0ad4('0x45')]()]=_0x3a26d3[_0x0ad4('0x46')]['toString']();}else if(_0x3a26d3[_0x0ad4('0x41')]===_0x0ad4('0x42')&&_0x3a26d3[_0x0ad4('0x20')]&&_0x3a26d3[_0x0ad4('0x44')]){_0x108ac5[_0x0ad4('0x47')][_0x0ad4('0x1f')]({'id':_0x3a26d3['idField'],'value':_0x3a26d3[_0x0ad4('0x46')][_0x0ad4('0x25')]()});}else if(_0x3a26d3[_0x0ad4('0x41')]===_0x0ad4('0x48')&&_0x3a26d3[_0x0ad4('0x1e')]&&_0x3a26d3[_0x0ad4('0x20')]&&_0x3a26d3[_0x0ad4('0x44')]){_0x116e94[_0x3a26d3[_0x0ad4('0x1e')]]&&_0x108ac5[_0x0ad4('0x47')][_0x0ad4('0x1f')]({'id':_0x3a26d3[_0x0ad4('0x20')],'value':_0x116e94[_0x3a26d3['variableName']][_0x0ad4('0x25')]()});}else if(_0x3a26d3[_0x0ad4('0x41')]===_0x0ad4('0x49')&&_0x3a26d3[_0x0ad4('0x4a')]&&_0x3a26d3['Variable']['name']&&_0x3a26d3[_0x0ad4('0x20')]&&_0x3a26d3['customField']){_0x116e94[_0x3a26d3[_0x0ad4('0x4a')][_0x0ad4('0x10')][_0x0ad4('0x45')]()]&&_0x108ac5['custom_fields'][_0x0ad4('0x1f')]({'id':_0x3a26d3[_0x0ad4('0x20')],'value':_0x116e94[_0x3a26d3[_0x0ad4('0x4a')][_0x0ad4('0x10')][_0x0ad4('0x45')]()]['toString']()});}});}return _0x108ac5;}function getConnection(_0x49e30c){return request({'method':_0x0ad4('0xd'),'form':{'method':_0x0ad4('0x4b'),'input_type':_0x0ad4('0x28'),'response_type':_0x0ad4('0x28'),'rest_data':JSON[_0x0ad4('0x22')]({'user_auth':{'user_name':_0x49e30c[_0x0ad4('0x4c')],'password':_0x49e30c['password'],'encryption':_0x0ad4('0x4d')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x422f3f){var _0x4ea158=_0x422f3f;if(_0x4ea158['id']){def['sessionID']=_0x4ea158['id'];return BPromise[_0x0ad4('0x33')](_0x4ea158);}else{throw new Error(util[_0x0ad4('0x23')](_0x0ad4('0x4e'),_0x49e30c['id']));}});}function setRelationship(_0xb27aa7,_0xc6f224,_0x3eea6a,_0xceff9d){return request({'form':{'method':'set_relationship','input_type':_0x0ad4('0x28'),'response_type':_0x0ad4('0x28'),'rest_data':JSON[_0x0ad4('0x22')]({'session':_0xb27aa7['id'],'module_name':'Calls','module_id':_0x3eea6a['id'],'link_field_name':_0xceff9d,'related_ids':[_0xc6f224['id']]})}});}exports[_0x0ad4('0x4f')]=function(_0x5c7a96,_0x193a82,_0x153642,_0x1b302d,_0x38f7ea,_0xb6be21){var _0x3ebfbd,_0x26e36d,_0x2b99c6,_0x56d663;_0xb6be21['remoteUri']=intUtil['stripTrailingSlash'](_0xb6be21[_0x0ad4('0x50')]);_0xb6be21[_0x0ad4('0x51')]=intUtil[_0x0ad4('0x52')](_0xb6be21[_0x0ad4('0x51')]);def[_0x0ad4('0x53')]=util[_0x0ad4('0x23')](_0x0ad4('0x54'),_0xb6be21[_0x0ad4('0x50')]);if(_0x38f7ea&&_0x38f7ea[_0x0ad4('0x55')]){logger[_0x0ad4('0xe')](_0x0ad4('0x56'),_0x0ad4('0x57'));_0x193a82[_0x0ad4('0x58')]=util['format'](_0x0ad4('0x59'),_0xb6be21['serverUrl'],_0x193a82[_0x0ad4('0x5a')],md5(_0x193a82[_0x0ad4('0x5a')]));}else{_0x193a82[_0x0ad4('0x58')]='';}return getConnection(_0xb6be21)[_0x0ad4('0x2d')](function(_0x3d7e37){_0x56d663=_0x3d7e37;return getUser(_0xb6be21,_0x1b302d[_0x0ad4('0x10')],_0x56d663);})['then'](function(_0x4d8cb2){_0x3ebfbd=_0x4d8cb2;logger[_0x0ad4('0xe')]('The\x20User\x20ID\x20is:',_0x3ebfbd['id']);return getEndUser(_0xb6be21,_0x193a82[_0x0ad4('0x5b')],_0x193a82[_0x0ad4('0x5c')],_0x56d663);})[_0x0ad4('0x2d')](function(_0x3b7b8d){_0x26e36d=_0x3b7b8d;logger['info'](_0x0ad4('0x5d'),_0x26e36d['id']);return getTicket(_0xb6be21,_0x3ebfbd,_0x26e36d,_0x153642,_0x193a82,_0x153642[_0x0ad4('0x5e')],_0x56d663,_0x0ad4('0x5f'));})[_0x0ad4('0x2d')](function(_0x2d5b26){_0x2b99c6=_0x2d5b26;logger['info']('Ticket\x20created!');logger[_0x0ad4('0xe')](_0x0ad4('0x60'),_0x2b99c6['id']);return setRelationship(_0x56d663,_0x3ebfbd,_0x2b99c6,_0x0ad4('0x61'));})[_0x0ad4('0x2d')](function(){return setRelationship(_0x56d663,_0x26e36d,_0x2b99c6,_0x0ad4('0x62'));})['then'](function(){return getServerInfo(_0x56d663);})[_0x0ad4('0x2d')](function(_0x3735fc){var _0x5928be=parseInt(_0x3735fc[_0x0ad4('0x63')][_0x0ad4('0x64')](0x0));var _0x416c5c=util[_0x0ad4('0x23')](_0x0ad4('0x65'),_0xb6be21[_0x0ad4('0x50')],_0x2b99c6['id']);if(_0x5928be>0x6){_0x416c5c=util[_0x0ad4('0x23')](_0x0ad4('0x66'),_0xb6be21['remoteUri'],_0x2b99c6['id']);}logger[_0x0ad4('0xe')](_0x0ad4('0x56'),_0x0ad4('0x67'));emit(util[_0x0ad4('0x23')](_0x0ad4('0x68'),_0x1b302d['name']),_0x0ad4('0x69'),{'uri':_0x416c5c});})[_0x0ad4('0x6a')](function(_0x24b332){logger[_0x0ad4('0x6b')]('[QUEUE]',JSON[_0x0ad4('0x22')](_0x24b332));});};exports[_0x0ad4('0x6c')]=function(_0x152eed,_0x3b03cc,_0x1ec41d,_0x4109ce,_0x2edb0b,_0x569832,_0x5e1a9a){var _0xa3c0ef,_0x497c8b,_0xc79343,_0x3508f1;_0x569832[_0x0ad4('0x50')]=intUtil[_0x0ad4('0x52')](_0x569832[_0x0ad4('0x50')]);_0x569832[_0x0ad4('0x51')]=intUtil[_0x0ad4('0x52')](_0x569832[_0x0ad4('0x51')]);def[_0x0ad4('0x53')]=util[_0x0ad4('0x23')](_0x0ad4('0x54'),_0x569832[_0x0ad4('0x50')]);if(_0x5e1a9a&&_0x5e1a9a[_0x0ad4('0x6d')]&&_0x5e1a9a['recordingFormat']!=='none'){logger[_0x0ad4('0xe')](_0x0ad4('0x6e'),_0x0ad4('0x57'));_0x3b03cc['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x569832[_0x0ad4('0x51')],_0x3b03cc['uniqueid'],md5(_0x3b03cc[_0x0ad4('0x5a')]));}return getConnection(_0x569832)[_0x0ad4('0x2d')](function(_0x12d3d9){_0x3508f1=_0x12d3d9;return getUser(_0x569832,_0x4109ce[_0x0ad4('0x10')],_0x3508f1);})[_0x0ad4('0x2d')](function(_0x478445){_0xa3c0ef=_0x478445;logger[_0x0ad4('0xe')](_0x0ad4('0x6f'),_0xa3c0ef['id']);return getEndUser(_0x569832,_0x3b03cc['destcalleridname'],_0x3b03cc['destcalleridnum'],_0x3508f1);})[_0x0ad4('0x2d')](function(_0x445173){_0x497c8b=_0x445173;logger[_0x0ad4('0xe')](_0x0ad4('0x5d'),_0x497c8b['id']);return getTicket(_0x569832,_0xa3c0ef,_0x497c8b,_0x1ec41d,_0x3b03cc,_0x1ec41d[_0x0ad4('0x5e')],_0x3508f1,_0x0ad4('0x70'));})[_0x0ad4('0x2d')](function(_0x239b59){_0xc79343=_0x239b59;logger['info'](_0x0ad4('0x71'));logger[_0x0ad4('0xe')](_0x0ad4('0x60'),_0xc79343['id']);return setRelationship(_0x3508f1,_0xa3c0ef,_0xc79343,_0x0ad4('0x61'));})[_0x0ad4('0x2d')](function(){return setRelationship(_0x3508f1,_0x497c8b,_0xc79343,_0x0ad4('0x62'));})[_0x0ad4('0x2d')](function(){return getServerInfo(_0x3508f1);})[_0x0ad4('0x2d')](function(_0x1efe6d){var _0xdb1230=parseInt(_0x1efe6d['version'][_0x0ad4('0x64')](0x0));var _0x19460a=util[_0x0ad4('0x23')](_0x0ad4('0x65'),_0x569832[_0x0ad4('0x50')],_0xc79343['id']);if(_0xdb1230>0x6){_0x19460a=util[_0x0ad4('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x569832[_0x0ad4('0x50')],_0xc79343['id']);}logger[_0x0ad4('0xe')]('[OUTBOUND]',_0x0ad4('0x67'));emit(util[_0x0ad4('0x23')](_0x0ad4('0x68'),_0x4109ce[_0x0ad4('0x10')]),_0x0ad4('0x69'),{'uri':_0x19460a});})[_0x0ad4('0x6a')](function(_0x409149){logger[_0x0ad4('0x6b')](_0x0ad4('0x6e'),JSON[_0x0ad4('0x22')](_0x409149));});};exports[_0x0ad4('0x72')]=function(_0x1831db,_0x377f48,_0x226bef,_0x278eea,_0x51d48c,_0x50d30c){var _0x166d2b,_0x3dcd37,_0x3c9a3a,_0x41f21f;_0x50d30c[_0x0ad4('0x50')]=intUtil[_0x0ad4('0x52')](_0x50d30c['remoteUri']);_0x50d30c[_0x0ad4('0x51')]=intUtil[_0x0ad4('0x52')](_0x50d30c[_0x0ad4('0x51')]);def[_0x0ad4('0x53')]=util['format']('%s/service/v4_1/rest.php',_0x50d30c[_0x0ad4('0x50')]);if(_0x51d48c&&_0x51d48c[_0x0ad4('0x55')]){logger[_0x0ad4('0xe')]('['+_0x377f48[_0x0ad4('0x73')][_0x0ad4('0x74')]()+']',_0x0ad4('0x57'));_0x377f48['recordingURL']=util['format'](_0x0ad4('0x59'),_0x50d30c[_0x0ad4('0x51')],_0x377f48['uniqueid'],md5(_0x377f48['uniqueid']));}else{_0x377f48[_0x0ad4('0x58')]='';}return getConnection(_0x50d30c)['then'](function(_0x49c5e2){_0x41f21f=_0x49c5e2;if(!_['isNil'](_0x278eea)){return getUser(_0x50d30c,_0x278eea[_0x0ad4('0x10')],_0x41f21f);}else{return getUser(_0x50d30c,null,_0x41f21f);}})[_0x0ad4('0x2d')](function(_0x438813){_0x166d2b=_0x438813;logger[_0x0ad4('0xe')]('The\x20User\x20ID\x20is:',_0x166d2b['id']);return getEndUser(_0x50d30c,_0x377f48[_0x0ad4('0x5b')],_0x377f48[_0x0ad4('0x5c')],_0x41f21f);})[_0x0ad4('0x2d')](function(_0x300d40){_0x3dcd37=_0x300d40;logger['info'](_0x0ad4('0x5d'),_0x3dcd37['id']);return getTicket(_0x50d30c,_0x166d2b,_0x3dcd37,_0x226bef,_0x377f48,_0x226bef[_0x0ad4('0x5e')],_0x41f21f,'Inbound');})['then'](function(_0x226677){_0x3c9a3a=_0x226677;logger[_0x0ad4('0xe')](_0x0ad4('0x71'));logger[_0x0ad4('0xe')]('The\x20Ticket\x20ID\x20is:',_0x3c9a3a['id']);return setRelationship(_0x41f21f,_0x166d2b,_0x3c9a3a,_0x0ad4('0x61'));})[_0x0ad4('0x2d')](function(){return setRelationship(_0x41f21f,_0x3dcd37,_0x3c9a3a,_0x0ad4('0x62'));})['then'](function(){return getServerInfo(_0x41f21f);})['catch'](function(_0x4f1103){logger[_0x0ad4('0x6b')]('['+_0x377f48[_0x0ad4('0x73')][_0x0ad4('0x74')]()+']',JSON['stringify'](_0x4f1103));});}; \ 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 9eba632..eb23c0d 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 _0x055b=['stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','lodash','length','string','content','type','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','variable','join'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0x055b,0xc5));var _0xb055=function(_0x8dc50e,_0x2529a3){_0x8dc50e=_0x8dc50e-0x0;var _0x58418d=_0x055b[_0x8dc50e];return _0x58418d;};'use strict';var _=require(_0xb055('0x0'));var util=require('util');exports['getString']=function(_0x2c2b0b,_0xde69f4,_0x454222){var _0x33da55=[];if(_0x2c2b0b[_0xb055('0x1')]>0x0){var _0x2792db=_['sortBy'](_0x2c2b0b,['id']);for(var _0x222e0b=0x0;_0x222e0b<_0x2792db[_0xb055('0x1')];_0x222e0b++){var _0x409ca8=_0x2792db[_0x222e0b];if(_0x409ca8['type']===_0xb055('0x2')){_0x33da55['push'](_0x409ca8[_0xb055('0x3')]);}else if(_0x409ca8[_0xb055('0x4')]==='variable'&&_0x409ca8[_0xb055('0x5')]){_0xde69f4[_0x409ca8['variableName']]&&_0x33da55[_0xb055('0x6')](_0xde69f4[_0x409ca8[_0xb055('0x5')]][_0xb055('0x7')]());}else if(_0x409ca8[_0xb055('0x4')]===_0xb055('0x8')&&_0x409ca8[_0xb055('0x9')]&&_0x409ca8[_0xb055('0x9')]['name']){_0xde69f4[_0x409ca8[_0xb055('0x9')][_0xb055('0xa')]['toLowerCase']()]&&_0x33da55[_0xb055('0x6')](_0xde69f4[_0x409ca8['Variable'][_0xb055('0xa')][_0xb055('0xb')]()][_0xb055('0x7')]());}else if(_0x409ca8[_0xb055('0x4')]==='keyValue'){if(_0x409ca8[_0xb055('0xc')]===_0xb055('0x2')&&_0x409ca8[_0xb055('0xd')]){_0x33da55[_0xb055('0x6')](util[_0xb055('0xe')](_0xb055('0xf'),_0x409ca8[_0xb055('0xd')],_0x409ca8[_0xb055('0x10')]));}else if(_0x409ca8['keyType']===_0xb055('0x11')&&_0x409ca8[_0xb055('0x5')]&&_0x409ca8[_0xb055('0xd')]){_0xde69f4[_0x409ca8[_0xb055('0x5')]]&&_0x33da55[_0xb055('0x6')](util[_0xb055('0xe')](_0xb055('0xf'),_0x409ca8[_0xb055('0xd')],_0xde69f4[_0x409ca8[_0xb055('0x5')]]));}else if(_0x409ca8['keyType']===_0xb055('0x8')&&_0x409ca8['Variable']&&_0x409ca8['Variable'][_0xb055('0xa')]&&_0x409ca8['key']){_0xde69f4[_0x409ca8[_0xb055('0x9')][_0xb055('0xa')]['toLowerCase']()]&&_0x33da55[_0xb055('0x6')](util[_0xb055('0xe')](_0xb055('0xf'),_0x409ca8[_0xb055('0xd')],_0xde69f4[_0x409ca8[_0xb055('0x9')][_0xb055('0xa')][_0xb055('0xb')]()]));}}}}return _0x33da55[_0xb055('0x12')](_0x454222);};exports[_0xb055('0x13')]=function(_0x36c8b5){var _0x9bb408=_0x36c8b5['slice'](-0x1);if(_0x9bb408==='/'){_0x36c8b5=_0x36c8b5[_0xb055('0x14')](0x0,_0x36c8b5[_0xb055('0x15')](_0x9bb408));}return _0x36c8b5;};exports[_0xb055('0x16')]=function(_0x53213f){if(!_[_0xb055('0x17')](_0x53213f)&&_0x53213f!==''){var _0x3ba0ee=/^(([^<>()\[\]\\.,;:\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 _0x3ba0ee['test'](String(_0x53213f)[_0xb055('0xb')]());}else{return![];}}; \ No newline at end of file +var _0xf26e=['util','getString','length','sortBy','content','type','variable','variableName','push','toString','name','Variable','toLowerCase','keyValue','keyType','key','format','keyContent','%s:\x20%s','customVariable','stripTrailingSlash','slice','substring','isNil','test','lodash'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xf26e,0x67));var _0xef26=function(_0x44af12,_0x587bda){_0x44af12=_0x44af12-0x0;var _0xa6c21d=_0xf26e[_0x44af12];return _0xa6c21d;};'use strict';var _=require(_0xef26('0x0'));var util=require(_0xef26('0x1'));exports[_0xef26('0x2')]=function(_0x4d473b,_0x94c5d5,_0x440f94){var _0x1b067c=[];if(_0x4d473b[_0xef26('0x3')]>0x0){var _0x300a84=_[_0xef26('0x4')](_0x4d473b,['id']);for(var _0x33ea97=0x0;_0x33ea97<_0x300a84['length'];_0x33ea97++){var _0x3fb1f6=_0x300a84[_0x33ea97];if(_0x3fb1f6['type']==='string'){_0x1b067c['push'](_0x3fb1f6[_0xef26('0x5')]);}else if(_0x3fb1f6[_0xef26('0x6')]===_0xef26('0x7')&&_0x3fb1f6[_0xef26('0x8')]){_0x94c5d5[_0x3fb1f6[_0xef26('0x8')]]&&_0x1b067c[_0xef26('0x9')](_0x94c5d5[_0x3fb1f6[_0xef26('0x8')]][_0xef26('0xa')]());}else if(_0x3fb1f6[_0xef26('0x6')]==='customVariable'&&_0x3fb1f6['Variable']&&_0x3fb1f6['Variable'][_0xef26('0xb')]){_0x94c5d5[_0x3fb1f6[_0xef26('0xc')][_0xef26('0xb')]['toLowerCase']()]&&_0x1b067c['push'](_0x94c5d5[_0x3fb1f6[_0xef26('0xc')][_0xef26('0xb')][_0xef26('0xd')]()][_0xef26('0xa')]());}else if(_0x3fb1f6[_0xef26('0x6')]===_0xef26('0xe')){if(_0x3fb1f6[_0xef26('0xf')]==='string'&&_0x3fb1f6[_0xef26('0x10')]){_0x1b067c[_0xef26('0x9')](util[_0xef26('0x11')]('%s:\x20%s',_0x3fb1f6['key'],_0x3fb1f6[_0xef26('0x12')]));}else if(_0x3fb1f6[_0xef26('0xf')]===_0xef26('0x7')&&_0x3fb1f6[_0xef26('0x8')]&&_0x3fb1f6['key']){_0x94c5d5[_0x3fb1f6[_0xef26('0x8')]]&&_0x1b067c[_0xef26('0x9')](util[_0xef26('0x11')](_0xef26('0x13'),_0x3fb1f6[_0xef26('0x10')],_0x94c5d5[_0x3fb1f6[_0xef26('0x8')]]));}else if(_0x3fb1f6[_0xef26('0xf')]===_0xef26('0x14')&&_0x3fb1f6[_0xef26('0xc')]&&_0x3fb1f6['Variable'][_0xef26('0xb')]&&_0x3fb1f6['key']){_0x94c5d5[_0x3fb1f6[_0xef26('0xc')][_0xef26('0xb')][_0xef26('0xd')]()]&&_0x1b067c[_0xef26('0x9')](util[_0xef26('0x11')](_0xef26('0x13'),_0x3fb1f6[_0xef26('0x10')],_0x94c5d5[_0x3fb1f6[_0xef26('0xc')]['name'][_0xef26('0xd')]()]));}}}}return _0x1b067c['join'](_0x440f94);};exports[_0xef26('0x15')]=function(_0x54b40f){var _0x11323e=_0x54b40f[_0xef26('0x16')](-0x1);if(_0x11323e==='/'){_0x54b40f=_0x54b40f[_0xef26('0x17')](0x0,_0x54b40f['lastIndexOf'](_0x11323e));}return _0x54b40f;};exports['validateEmail']=function(_0x2e4c00){if(!_[_0xef26('0x18')](_0x2e4c00)&&_0x2e4c00!==''){var _0x16a440=/^(([^<>()\[\]\\.,;:\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 _0x16a440[_0xef26('0x19')](String(_0x2e4c00)[_0xef26('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 ddc4b87..c63ebc2 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 _0xd51d=['Open','getString','Descriptions','POST','format','remoteUri','create','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','GET','%s/webservice.php','query','username','sessionName','email1','first_name','last_name','userId','catch','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','length','Enduser\x20found!','firstname','Contacts','Enduser\x20created.','lastname','phone','getEndUser','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Fields','user:%s','unmanaged','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','forEach','string','idField','toString','type','variableName','Variable','name','toLowerCase','info','merge','Normal'];(function(_0x5ae626,_0x5994e9){var _0x39523b=function(_0x4aa51b){while(--_0x4aa51b){_0x5ae626['push'](_0x5ae626['shift']());}};_0x39523b(++_0x5994e9);}(_0xd51d,0x1d1));var _0xdd51=function(_0x63267,_0x21f36e){_0x63267=_0x63267-0x0;var _0x430cb3=_0xd51d[_0x63267];return _0x430cb3;};'use strict';var _=require(_0xdd51('0x0'));var rp=require(_0xdd51('0x1'));var BPromise=require(_0xdd51('0x2'));var md5=require(_0xdd51('0x3'));var util=require(_0xdd51('0x4'));var Redis=require(_0xdd51('0x5'));var intUtil=require('./util');var config=require(_0xdd51('0x6'));var logger=require(_0xdd51('0x7'))(_0xdd51('0x8'));config[_0xdd51('0x9')]=_['defaults'](config[_0xdd51('0x9')],{'host':_0xdd51('0xa'),'port':0x18eb});var io=require(_0xdd51('0xb'))(new Redis(config[_0xdd51('0x9')]));function emit(_0x2712e2,_0x4c560,_0x659cd9){io['to'](_0x2712e2)[_0xdd51('0xc')](_0x4c560,_0x659cd9);}function getCustomFields(_0x509030,_0x4b62a6){var _0x2d092d={};if(_0x509030['length']>0x0){_[_0xdd51('0xd')](_0x509030,function(_0x15e35b){if(_0x15e35b['type']===_0xdd51('0xe')&&_0x15e35b[_0xdd51('0xf')]){_0x2d092d[_0x15e35b[_0xdd51('0xf')]]=_0x15e35b['content'][_0xdd51('0x10')]();}else if(_0x15e35b[_0xdd51('0x11')]==='variable'&&_0x15e35b['variableName']&&_0x15e35b['idField']&&_0x4b62a6[_0x15e35b[_0xdd51('0x12')]]){_0x2d092d[_0x15e35b[_0xdd51('0xf')]]=_0x4b62a6[_0x15e35b[_0xdd51('0x12')]]['toString']();}else if(_0x15e35b[_0xdd51('0x11')]==='customVariable'&&_0x15e35b['Variable']&&_0x15e35b[_0xdd51('0x13')]['name']&&_0x15e35b[_0xdd51('0xf')]&&_0x4b62a6[_0x15e35b['Variable'][_0xdd51('0x14')][_0xdd51('0x15')]()]){_0x2d092d[_0x15e35b[_0xdd51('0xf')]]=_0x4b62a6[_0x15e35b['Variable'][_0xdd51('0x14')][_0xdd51('0x15')]()][_0xdd51('0x10')]();}});}return _0x2d092d;}function createTicket(_0x54a318,_0x5ae641,_0x3736db,_0x6064d7,_0x4dcd9b,_0x52c9dc,_0x2de3f9){logger[_0xdd51('0x16')]('Creating\x20new\x20ticket...');var _0x35a353=_[_0xdd51('0x17')]({'parent_id':'','assigned_user_id':_0x5ae641['id'],'ticketpriorities':_0xdd51('0x18'),'ticketstatus':_0xdd51('0x19'),'ticket_title':intUtil[_0xdd51('0x1a')](_0x6064d7['Subjects'],_0x4dcd9b,'\x20'),'description':intUtil[_0xdd51('0x1a')](_0x6064d7[_0xdd51('0x1b')],_0x4dcd9b,'\x0a'),'contact_id':_0x3736db['id']},getCustomFields(_0x52c9dc,_0x4dcd9b));var _0x5e41c8={'method':_0xdd51('0x1c'),'uri':util[_0xdd51('0x1d')]('%s/webservice.php',_0x54a318[_0xdd51('0x1e')]),'form':{'operation':_0xdd51('0x1f'),'username':_0x54a318['username'],'sessionName':_0x2de3f9['sessionName'],'elementType':'HelpDesk','element':JSON[_0xdd51('0x20')](_0x35a353)},'json':!![]};return request(_0x5e41c8)[_0xdd51('0x21')](function(_0x413e27){if(_0x413e27[_0xdd51('0x22')]){return BPromise[_0xdd51('0x23')]({'id':_0x413e27[_0xdd51('0x24')]['id']});}else{throw new Error(util[_0xdd51('0x1d')](_0xdd51('0x25'),JSON['stringify'](_0x413e27[_0xdd51('0x26')])));}})['catch'](function(_0x5ddcab){var _0x42c71a=_0x5ddcab[_0xdd51('0x27')]||0x1f4;logger[_0xdd51('0x26')](_0xdd51('0x28'),'createTicket',_0x42c71a,JSON['stringify'](_0x5ddcab));});}function getUser(_0x5aeca8,_0x99e6e7,_0x554964){if(intUtil[_0xdd51('0x29')](_0x99e6e7)){logger[_0xdd51('0x16')]('Getting\x20agent\x20with\x20email',_0x99e6e7);return request({'method':_0xdd51('0x2a'),'uri':util[_0xdd51('0x1d')](_0xdd51('0x2b'),_0x5aeca8[_0xdd51('0x1e')]),'qs':{'operation':_0xdd51('0x2c'),'username':_0x5aeca8[_0xdd51('0x2d')],'sessionName':_0x554964[_0xdd51('0x2e')],'query':util[_0xdd51('0x1d')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x99e6e7)},'json':!![]})['then'](function(_0x315c42){if(_0x315c42[_0xdd51('0x22')]&&_0x315c42[_0xdd51('0x24')]['length']){logger[_0xdd51('0x16')]('Agent\x20found!');return BPromise[_0xdd51('0x23')]({'id':_0x315c42[_0xdd51('0x24')][0x0]['id'],'email':_0x315c42[_0xdd51('0x24')][0x0][_0xdd51('0x2f')],'name':_0x315c42[_0xdd51('0x24')][0x0][_0xdd51('0x30')]+'\x20'+_0x315c42[_0xdd51('0x24')][_0xdd51('0x31')]});}else{logger[_0xdd51('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x554964[_0xdd51('0x32')],'email':_0x5aeca8[_0xdd51('0x2d')],'name':'admin'});}})[_0xdd51('0x33')](function(_0x3c588d){var _0x5ce417=_0x3c588d[_0xdd51('0x27')]||0x1f4;logger[_0xdd51('0x26')](_0xdd51('0x28'),_0xdd51('0x34'),_0x5ce417,JSON[_0xdd51('0x20')](_0x3c588d));});}else{logger[_0xdd51('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x554964[_0xdd51('0x32')],'email':_0x5aeca8['username'],'name':_0xdd51('0x35')})['catch'](function(_0x97fd44){var _0x2fc3ee=_0x97fd44[_0xdd51('0x27')]||0x1f4;logger[_0xdd51('0x26')](_0xdd51('0x28'),'getUser',_0x2fc3ee,JSON[_0xdd51('0x20')](_0x97fd44));});}}function getEndUser(_0x2c5313,_0x1501c5,_0x61fa58,_0x968768){logger[_0xdd51('0x16')](_0xdd51('0x36'),_0x61fa58);return request({'method':'GET','uri':util[_0xdd51('0x1d')](_0xdd51('0x2b'),_0x2c5313[_0xdd51('0x1e')]),'qs':{'operation':_0xdd51('0x2c'),'username':_0x2c5313[_0xdd51('0x2d')],'sessionName':_0x968768[_0xdd51('0x2e')],'query':util[_0xdd51('0x1d')](_0xdd51('0x37'),_0x61fa58,_0x61fa58,_0x61fa58,_0x61fa58,_0x61fa58)},'json':!![]})[_0xdd51('0x21')](function(_0x546729){if(_0x546729[_0xdd51('0x22')]&&_0x546729['result'][_0xdd51('0x38')]){logger['info'](_0xdd51('0x39'));return BPromise[_0xdd51('0x23')]({'id':_0x546729[_0xdd51('0x24')][0x0]['id'],'name':_0x546729[_0xdd51('0x24')][0x0][_0xdd51('0x3a')]+'\x20'+_0x546729[_0xdd51('0x24')][0x0]['lastname'],'phone':_0x61fa58});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0xdd51('0x1c'),'uri':util[_0xdd51('0x1d')](_0xdd51('0x2b'),_0x2c5313[_0xdd51('0x1e')]),'form':{'operation':_0xdd51('0x1f'),'sessionName':_0x968768[_0xdd51('0x2e')],'elementType':_0xdd51('0x3b'),'element':JSON[_0xdd51('0x20')]({'lastname':_0x1501c5,'phone':_0x61fa58,'assigned_user_id':'\x20'})},'json':!![]})[_0xdd51('0x21')](function(_0xd23a50){logger[_0xdd51('0x16')](_0xdd51('0x3c'));return BPromise[_0xdd51('0x23')]({'id':_0xd23a50[_0xdd51('0x24')]['id'],'name':_0xd23a50[_0xdd51('0x24')][_0xdd51('0x3d')],'phone':_0xd23a50[_0xdd51('0x24')][_0xdd51('0x3e')]});})[_0xdd51('0x33')](function(_0x44928f){var _0x4c75d1=_0x44928f[_0xdd51('0x27')]||0x1f4;logger[_0xdd51('0x26')](_0xdd51('0x28'),_0xdd51('0x3f'),_0x4c75d1,JSON[_0xdd51('0x20')](_0x44928f));});}});}function getConnection(_0x2fef4d){var _0x4c65e7=_0x2fef4d[_0xdd51('0x2d')];var _0x5f270b=_0x2fef4d[_0xdd51('0x40')];return request({'method':'GET','uri':util['format']('%s/webservice.php',_0x2fef4d[_0xdd51('0x1e')]),'qs':{'operation':_0xdd51('0x41'),'username':_0x4c65e7},'json':!![]})[_0xdd51('0x21')](function(_0xfb1091){if(_0xfb1091[_0xdd51('0x22')]){return request({'method':_0xdd51('0x1c'),'uri':util['format']('%s/webservice.php',_0x2fef4d[_0xdd51('0x1e')]),'form':{'operation':'login','username':_0x4c65e7,'accessKey':md5(_0xfb1091[_0xdd51('0x24')][_0xdd51('0x42')]+_0x5f270b)},'json':!![]});}})[_0xdd51('0x21')](function(_0x54fb2f){if(_0x54fb2f['success']){return BPromise[_0xdd51('0x23')](_0x54fb2f['result']);}else{throw new Error(util['format'](_0xdd51('0x43'),_0x2fef4d['id']));}})[_0xdd51('0x33')](function(_0xd051e){var _0x2927e4=_0xd051e[_0xdd51('0x27')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getConnection',_0x2927e4,JSON[_0xdd51('0x20')](_0xd051e));});}function request(_0x160221){logger['info'](_0xdd51('0x44'),JSON[_0xdd51('0x20')](_0x160221));return rp(_0x160221);}exports[_0xdd51('0x45')]=function(_0x59b43f,_0x476921,_0x50b614,_0x5510f4,_0x4d0c6c,_0x32d9e2){var _0x195a13,_0x2164b0,_0x8f25c,_0x345da0;_0x32d9e2[_0xdd51('0x1e')]=intUtil[_0xdd51('0x46')](_0x32d9e2[_0xdd51('0x1e')]);if(_0x4d0c6c&&_0x4d0c6c[_0xdd51('0x47')]){logger['info']('[QUEUE]',_0xdd51('0x48'));_0x476921[_0xdd51('0x49')]=util['format'](_0xdd51('0x4a'),_0x32d9e2[_0xdd51('0x4b')],_0x476921[_0xdd51('0x4c')],md5(_0x476921[_0xdd51('0x4c')]));}else{_0x476921[_0xdd51('0x49')]='';}return getConnection(_0x32d9e2)['then'](function(_0x4a869b){_0x345da0=_0x4a869b;return getUser(_0x32d9e2,_0x5510f4['email'],_0x345da0);})[_0xdd51('0x21')](function(_0x235eef){_0x195a13=_0x235eef;logger[_0xdd51('0x16')](_0xdd51('0x4d'),_0x195a13['id']);return getEndUser(_0x32d9e2,_0x476921[_0xdd51('0x4e')],_0x476921[_0xdd51('0x4f')],_0x345da0);})[_0xdd51('0x21')](function(_0xd65f77){_0x2164b0=_0xd65f77;logger[_0xdd51('0x16')]('The\x20Enduser\x20ID\x20is:',_0x2164b0['id']);return createTicket(_0x32d9e2,_0x195a13,_0x2164b0,_0x50b614,_0x476921,_0x50b614['Fields'],_0x345da0);})[_0xdd51('0x21')](function(_0x3036d3){_0x8f25c=_0x3036d3;logger[_0xdd51('0x16')](_0xdd51('0x50'));logger[_0xdd51('0x16')](_0xdd51('0x51'),_0x8f25c['id']);var _0x2b55b8=util[_0xdd51('0x1d')](_0xdd51('0x52'),_0x32d9e2[_0xdd51('0x1e')],_[_0xdd51('0x53')](_0x8f25c['id'],'x')[0x1]);logger['info'](_0xdd51('0x54'),_0xdd51('0x55'));emit(util[_0xdd51('0x1d')]('user:%s',_0x5510f4[_0xdd51('0x14')]),_0xdd51('0x56'),{'uri':_0x2b55b8});})[_0xdd51('0x33')](function(_0x1f0cee){logger['error'](_0xdd51('0x54'),JSON[_0xdd51('0x20')](_0x1f0cee));});};exports[_0xdd51('0x57')]=function(_0x3ba334,_0xc0ca2,_0x40be62,_0x5d2783,_0x3dc016,_0x58addc,_0xb7ba3){var _0x2b48f6,_0x56840c,_0x1566e6,_0x2e4dc8;_0x58addc['remoteUri']=intUtil[_0xdd51('0x46')](_0x58addc[_0xdd51('0x1e')]);_0x58addc[_0xdd51('0x4b')]=intUtil['stripTrailingSlash'](_0x58addc[_0xdd51('0x4b')]);if(_0xb7ba3&&_0xb7ba3['recordingFormat']&&_0xb7ba3['recordingFormat']!==_0xdd51('0x58')){logger['info'](_0xdd51('0x59'),_0xdd51('0x48'));_0xc0ca2[_0xdd51('0x49')]=util[_0xdd51('0x1d')](_0xdd51('0x4a'),_0x58addc[_0xdd51('0x4b')],_0xc0ca2['uniqueid'],md5(_0xc0ca2[_0xdd51('0x4c')]));}return getConnection(_0x58addc)[_0xdd51('0x21')](function(_0x5a1ce5){_0x2e4dc8=_0x5a1ce5;return getUser(_0x58addc,_0x5d2783[_0xdd51('0x5a')],_0x2e4dc8);})[_0xdd51('0x21')](function(_0x1395ff){_0x2b48f6=_0x1395ff;logger[_0xdd51('0x16')](_0xdd51('0x4d'),_0x2b48f6['id']);return getEndUser(_0x58addc,_0xc0ca2[_0xdd51('0x5b')],_0xc0ca2[_0xdd51('0x5c')],_0x2e4dc8);})[_0xdd51('0x21')](function(_0x273692){_0x56840c=_0x273692;logger[_0xdd51('0x16')](_0xdd51('0x5d'),_0x56840c['id']);return createTicket(_0x58addc,_0x2b48f6,_0x56840c,_0x40be62,_0xc0ca2,_0x40be62[_0xdd51('0x5e')],_0x2e4dc8);})[_0xdd51('0x21')](function(_0x23e748){_0x1566e6=_0x23e748;logger[_0xdd51('0x16')]('Ticket\x20created!');logger[_0xdd51('0x16')](_0xdd51('0x51'),_0x1566e6['id']);var _0x45e7ce=util[_0xdd51('0x1d')](_0xdd51('0x52'),_0x58addc['remoteUri'],_[_0xdd51('0x53')](_0x1566e6['id'],'x')[0x1]);logger['info']('[OUTBOUND]',_0xdd51('0x55'));emit(util[_0xdd51('0x1d')](_0xdd51('0x5f'),_0x5d2783[_0xdd51('0x14')]),_0xdd51('0x56'),{'uri':_0x45e7ce});})['catch'](function(_0xcb7c04){logger['error'](_0xdd51('0x59'),JSON[_0xdd51('0x20')](_0xcb7c04));});};exports[_0xdd51('0x60')]=function(_0x218389,_0x14631d,_0x489c4e,_0x2a778c,_0x1ff0da,_0x57bb28){var _0x36a873,_0x2afa5,_0x48dd22,_0x781a8f;_0x57bb28[_0xdd51('0x1e')]=intUtil[_0xdd51('0x46')](_0x57bb28[_0xdd51('0x1e')]);_0x57bb28[_0xdd51('0x4b')]=intUtil[_0xdd51('0x46')](_0x57bb28[_0xdd51('0x4b')]);if(_0x1ff0da&&_0x1ff0da[_0xdd51('0x47')]){logger[_0xdd51('0x16')]('['+_0x14631d['lastevent'][_0xdd51('0x61')]()+']',_0xdd51('0x48'));_0x14631d[_0xdd51('0x49')]=util[_0xdd51('0x1d')](_0xdd51('0x4a'),_0x57bb28[_0xdd51('0x4b')],_0x14631d[_0xdd51('0x4c')],md5(_0x14631d['uniqueid']));}else{_0x14631d[_0xdd51('0x49')]='';}return getConnection(_0x57bb28)[_0xdd51('0x21')](function(_0x4a6a34){_0x781a8f=_0x4a6a34;return getUser(_0x57bb28,'',_0x781a8f);})[_0xdd51('0x21')](function(_0x1d58df){_0x36a873=_0x1d58df;logger['info']('The\x20User\x20ID\x20is:',_0x36a873['id']);return getEndUser(_0x57bb28,_0x14631d['calleridname'],_0x14631d[_0xdd51('0x4f')],_0x781a8f);})[_0xdd51('0x21')](function(_0x35aae7){_0x2afa5=_0x35aae7;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2afa5['id']);return createTicket(_0x57bb28,_0x36a873,_0x2afa5,_0x489c4e,_0x14631d,_0x489c4e[_0xdd51('0x5e')],_0x781a8f);})[_0xdd51('0x21')](function(_0x3af506){_0x48dd22=_0x3af506;logger[_0xdd51('0x16')](_0xdd51('0x50'));logger[_0xdd51('0x16')](_0xdd51('0x51'),_0x48dd22['id']);})['catch'](function(_0x38000b){logger['error']('['+_0x14631d['lastevent'][_0xdd51('0x61')]()+']',JSON['stringify'](_0x38000b));});}; \ No newline at end of file +var _0x4723=['info','Creating\x20new\x20ticket...','Normal','Open','getString','Descriptions','POST','format','%s/webservice.php','create','username','HelpDesk','stringify','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','then','success','result','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','error','getUser','Searching\x20end\x20user\x20with\x20phone','sessionName','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\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','serverUrl','[OUTBOUND]','Recording\x20is\x20enabled!','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','calleridnum','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','emit','length','forEach','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x56df27,_0x54182d){var _0x1ce2c5=function(_0x12a1b9){while(--_0x12a1b9){_0x56df27['push'](_0x56df27['shift']());}};_0x1ce2c5(++_0x54182d);}(_0x4723,0x16c));var _0x3472=function(_0x2330fd,_0x56e9c7){_0x2330fd=_0x2330fd-0x0;var _0x5c1eba=_0x4723[_0x2330fd];return _0x5c1eba;};'use strict';var _=require(_0x3472('0x0'));var rp=require(_0x3472('0x1'));var BPromise=require('bluebird');var md5=require(_0x3472('0x2'));var util=require(_0x3472('0x3'));var Redis=require(_0x3472('0x4'));var intUtil=require(_0x3472('0x5'));var config=require(_0x3472('0x6'));var logger=require(_0x3472('0x7'))(_0x3472('0x8'));config[_0x3472('0x9')]=_[_0x3472('0xa')](config[_0x3472('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4fc267,_0x16bd34,_0x3c1647){io['to'](_0x4fc267)[_0x3472('0xb')](_0x16bd34,_0x3c1647);}function getCustomFields(_0x1bcaf5,_0x2214e6){var _0xa3b312={};if(_0x1bcaf5[_0x3472('0xc')]>0x0){_[_0x3472('0xd')](_0x1bcaf5,function(_0x8b845){if(_0x8b845[_0x3472('0xe')]==='string'&&_0x8b845[_0x3472('0xf')]){_0xa3b312[_0x8b845[_0x3472('0xf')]]=_0x8b845[_0x3472('0x10')][_0x3472('0x11')]();}else if(_0x8b845[_0x3472('0xe')]===_0x3472('0x12')&&_0x8b845[_0x3472('0x13')]&&_0x8b845[_0x3472('0xf')]&&_0x2214e6[_0x8b845[_0x3472('0x13')]]){_0xa3b312[_0x8b845[_0x3472('0xf')]]=_0x2214e6[_0x8b845[_0x3472('0x13')]][_0x3472('0x11')]();}else if(_0x8b845['type']===_0x3472('0x14')&&_0x8b845[_0x3472('0x15')]&&_0x8b845[_0x3472('0x15')][_0x3472('0x16')]&&_0x8b845[_0x3472('0xf')]&&_0x2214e6[_0x8b845['Variable'][_0x3472('0x16')]['toLowerCase']()]){_0xa3b312[_0x8b845[_0x3472('0xf')]]=_0x2214e6[_0x8b845[_0x3472('0x15')][_0x3472('0x16')][_0x3472('0x17')]()][_0x3472('0x11')]();}});}return _0xa3b312;}function createTicket(_0x51d3e3,_0x34bc62,_0xdc94ae,_0x338986,_0x46905b,_0x37bbb5,_0x299aaf){logger[_0x3472('0x18')](_0x3472('0x19'));var _0x3335b5=_['merge']({'parent_id':'','assigned_user_id':_0x34bc62['id'],'ticketpriorities':_0x3472('0x1a'),'ticketstatus':_0x3472('0x1b'),'ticket_title':intUtil[_0x3472('0x1c')](_0x338986['Subjects'],_0x46905b,'\x20'),'description':intUtil['getString'](_0x338986[_0x3472('0x1d')],_0x46905b,'\x0a'),'contact_id':_0xdc94ae['id']},getCustomFields(_0x37bbb5,_0x46905b));var _0x3d9bea={'method':_0x3472('0x1e'),'uri':util[_0x3472('0x1f')](_0x3472('0x20'),_0x51d3e3['remoteUri']),'form':{'operation':_0x3472('0x21'),'username':_0x51d3e3[_0x3472('0x22')],'sessionName':_0x299aaf['sessionName'],'elementType':_0x3472('0x23'),'element':JSON[_0x3472('0x24')](_0x3335b5)},'json':!![]};return request(_0x3d9bea)['then'](function(_0x48979d){if(_0x48979d['success']){return BPromise['resolve']({'id':_0x48979d['result']['id']});}else{throw new Error(util[_0x3472('0x1f')](_0x3472('0x25'),JSON[_0x3472('0x24')](_0x48979d['error'])));}})[_0x3472('0x26')](function(_0x5cfba2){var _0x418646=_0x5cfba2[_0x3472('0x27')]||0x1f4;logger['error'](_0x3472('0x28'),_0x3472('0x29'),_0x418646,JSON[_0x3472('0x24')](_0x5cfba2));});}function getUser(_0x4c5f36,_0x40e273,_0x42a27c){if(intUtil[_0x3472('0x2a')](_0x40e273)){logger['info'](_0x3472('0x2b'),_0x40e273);return request({'method':'GET','uri':util['format']('%s/webservice.php',_0x4c5f36[_0x3472('0x2c')]),'qs':{'operation':_0x3472('0x2d'),'username':_0x4c5f36[_0x3472('0x22')],'sessionName':_0x42a27c['sessionName'],'query':util[_0x3472('0x1f')](_0x3472('0x2e'),_0x40e273)},'json':!![]})[_0x3472('0x2f')](function(_0x313421){if(_0x313421[_0x3472('0x30')]&&_0x313421[_0x3472('0x31')][_0x3472('0xc')]){logger[_0x3472('0x18')]('Agent\x20found!');return BPromise[_0x3472('0x32')]({'id':_0x313421[_0x3472('0x31')][0x0]['id'],'email':_0x313421[_0x3472('0x31')][0x0][_0x3472('0x33')],'name':_0x313421[_0x3472('0x31')][0x0]['first_name']+'\x20'+_0x313421[_0x3472('0x31')][_0x3472('0x34')]});}else{logger[_0x3472('0x18')](_0x3472('0x35'));return BPromise[_0x3472('0x32')]({'id':_0x42a27c[_0x3472('0x36')],'email':_0x4c5f36[_0x3472('0x22')],'name':_0x3472('0x37')});}})[_0x3472('0x26')](function(_0x1e0177){var _0xfa3a55=_0x1e0177[_0x3472('0x27')]||0x1f4;logger[_0x3472('0x38')](_0x3472('0x28'),_0x3472('0x39'),_0xfa3a55,JSON[_0x3472('0x24')](_0x1e0177));});}else{logger['info'](_0x3472('0x35'));return BPromise[_0x3472('0x32')]({'id':_0x42a27c[_0x3472('0x36')],'email':_0x4c5f36[_0x3472('0x22')],'name':_0x3472('0x37')})[_0x3472('0x26')](function(_0x464416){var _0x11b940=_0x464416['statusCode']||0x1f4;logger[_0x3472('0x38')](_0x3472('0x28'),_0x3472('0x39'),_0x11b940,JSON['stringify'](_0x464416));});}}function getEndUser(_0x322435,_0x15d5b4,_0x4d08a2,_0x72d165){logger['info'](_0x3472('0x3a'),_0x4d08a2);return request({'method':'GET','uri':util[_0x3472('0x1f')]('%s/webservice.php',_0x322435['remoteUri']),'qs':{'operation':_0x3472('0x2d'),'username':_0x322435['username'],'sessionName':_0x72d165[_0x3472('0x3b')],'query':util[_0x3472('0x1f')](_0x3472('0x3c'),_0x4d08a2,_0x4d08a2,_0x4d08a2,_0x4d08a2,_0x4d08a2)},'json':!![]})[_0x3472('0x2f')](function(_0x4eaeb4){if(_0x4eaeb4[_0x3472('0x30')]&&_0x4eaeb4['result'][_0x3472('0xc')]){logger[_0x3472('0x18')]('Enduser\x20found!');return BPromise[_0x3472('0x32')]({'id':_0x4eaeb4['result'][0x0]['id'],'name':_0x4eaeb4[_0x3472('0x31')][0x0]['firstname']+'\x20'+_0x4eaeb4[_0x3472('0x31')][0x0]['lastname'],'phone':_0x4d08a2});}else{logger[_0x3472('0x18')](_0x3472('0x3d'));return request({'method':_0x3472('0x1e'),'uri':util['format'](_0x3472('0x20'),_0x322435[_0x3472('0x2c')]),'form':{'operation':_0x3472('0x21'),'sessionName':_0x72d165[_0x3472('0x3b')],'elementType':_0x3472('0x3e'),'element':JSON[_0x3472('0x24')]({'lastname':_0x15d5b4,'phone':_0x4d08a2,'assigned_user_id':'\x20'})},'json':!![]})[_0x3472('0x2f')](function(_0x13a05c){logger[_0x3472('0x18')](_0x3472('0x3f'));return BPromise[_0x3472('0x32')]({'id':_0x13a05c[_0x3472('0x31')]['id'],'name':_0x13a05c['result']['lastname'],'phone':_0x13a05c[_0x3472('0x31')][_0x3472('0x40')]});})[_0x3472('0x26')](function(_0x5d5de9){var _0x39964b=_0x5d5de9['statusCode']||0x1f4;logger[_0x3472('0x38')](_0x3472('0x28'),'getEndUser',_0x39964b,JSON['stringify'](_0x5d5de9));});}});}function getConnection(_0x3019c3){var _0x15b4e8=_0x3019c3[_0x3472('0x22')];var _0x112efc=_0x3019c3['accessKey'];return request({'method':'GET','uri':util[_0x3472('0x1f')]('%s/webservice.php',_0x3019c3[_0x3472('0x2c')]),'qs':{'operation':'getchallenge','username':_0x15b4e8},'json':!![]})[_0x3472('0x2f')](function(_0x3d9e19){if(_0x3d9e19[_0x3472('0x30')]){return request({'method':_0x3472('0x1e'),'uri':util[_0x3472('0x1f')](_0x3472('0x20'),_0x3019c3[_0x3472('0x2c')]),'form':{'operation':_0x3472('0x41'),'username':_0x15b4e8,'accessKey':md5(_0x3d9e19[_0x3472('0x31')][_0x3472('0x42')]+_0x112efc)},'json':!![]});}})[_0x3472('0x2f')](function(_0x1fe26c){if(_0x1fe26c[_0x3472('0x30')]){return BPromise['resolve'](_0x1fe26c[_0x3472('0x31')]);}else{throw new Error(util['format'](_0x3472('0x43'),_0x3019c3['id']));}})[_0x3472('0x26')](function(_0x97228c){var _0x3ae5be=_0x97228c[_0x3472('0x27')]||0x1f4;logger[_0x3472('0x38')](_0x3472('0x28'),'getConnection',_0x3ae5be,JSON[_0x3472('0x24')](_0x97228c));});}function request(_0xca2fc5){logger['info'](_0x3472('0x44'),JSON[_0x3472('0x24')](_0xca2fc5));return rp(_0xca2fc5);}exports[_0x3472('0x45')]=function(_0x288302,_0x2c6c2d,_0x44bfe5,_0xc203d4,_0x94e9e4,_0x1200a8){var _0x512e13,_0xdf5f43,_0x3791ba,_0xf8c416;_0x1200a8[_0x3472('0x2c')]=intUtil[_0x3472('0x46')](_0x1200a8[_0x3472('0x2c')]);if(_0x94e9e4&&_0x94e9e4[_0x3472('0x47')]){logger['info'](_0x3472('0x48'),'Recording\x20is\x20enabled!');_0x2c6c2d[_0x3472('0x49')]=util[_0x3472('0x1f')](_0x3472('0x4a'),_0x1200a8['serverUrl'],_0x2c6c2d[_0x3472('0x4b')],md5(_0x2c6c2d[_0x3472('0x4b')]));}else{_0x2c6c2d[_0x3472('0x49')]='';}return getConnection(_0x1200a8)[_0x3472('0x2f')](function(_0x5cdfac){_0xf8c416=_0x5cdfac;return getUser(_0x1200a8,_0xc203d4['email'],_0xf8c416);})[_0x3472('0x2f')](function(_0x595263){_0x512e13=_0x595263;logger['info']('The\x20User\x20ID\x20is:',_0x512e13['id']);return getEndUser(_0x1200a8,_0x2c6c2d[_0x3472('0x4c')],_0x2c6c2d['calleridnum'],_0xf8c416);})['then'](function(_0x2aa81a){_0xdf5f43=_0x2aa81a;logger['info'](_0x3472('0x4d'),_0xdf5f43['id']);return createTicket(_0x1200a8,_0x512e13,_0xdf5f43,_0x44bfe5,_0x2c6c2d,_0x44bfe5[_0x3472('0x4e')],_0xf8c416);})[_0x3472('0x2f')](function(_0x1f9e6a){_0x3791ba=_0x1f9e6a;logger[_0x3472('0x18')](_0x3472('0x4f'));logger[_0x3472('0x18')](_0x3472('0x50'),_0x3791ba['id']);var _0x201e6c=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x1200a8[_0x3472('0x2c')],_['split'](_0x3791ba['id'],'x')[0x1]);logger['info'](_0x3472('0x48'),_0x3472('0x51'));emit(util[_0x3472('0x1f')](_0x3472('0x52'),_0xc203d4[_0x3472('0x16')]),_0x3472('0x53'),{'uri':_0x201e6c});})[_0x3472('0x26')](function(_0x35888f){logger[_0x3472('0x38')](_0x3472('0x48'),JSON[_0x3472('0x24')](_0x35888f));});};exports[_0x3472('0x54')]=function(_0x4fd3e4,_0x5de623,_0x5a68e2,_0x1a6b99,_0x13a257,_0x4e57d3,_0x416c04){var _0x3208c9,_0x5c336c,_0x25ecbe,_0x4270ba;_0x4e57d3[_0x3472('0x2c')]=intUtil[_0x3472('0x46')](_0x4e57d3[_0x3472('0x2c')]);_0x4e57d3[_0x3472('0x55')]=intUtil[_0x3472('0x46')](_0x4e57d3[_0x3472('0x55')]);if(_0x416c04&&_0x416c04['recordingFormat']&&_0x416c04['recordingFormat']!=='none'){logger['info'](_0x3472('0x56'),_0x3472('0x57'));_0x5de623[_0x3472('0x49')]=util[_0x3472('0x1f')](_0x3472('0x4a'),_0x4e57d3[_0x3472('0x55')],_0x5de623['uniqueid'],md5(_0x5de623[_0x3472('0x4b')]));}return getConnection(_0x4e57d3)[_0x3472('0x2f')](function(_0x1bcb72){_0x4270ba=_0x1bcb72;return getUser(_0x4e57d3,_0x1a6b99[_0x3472('0x58')],_0x4270ba);})['then'](function(_0x28a9c4){_0x3208c9=_0x28a9c4;logger[_0x3472('0x18')](_0x3472('0x59'),_0x3208c9['id']);return getEndUser(_0x4e57d3,_0x5de623[_0x3472('0x5a')],_0x5de623[_0x3472('0x5b')],_0x4270ba);})['then'](function(_0x14bc96){_0x5c336c=_0x14bc96;logger[_0x3472('0x18')](_0x3472('0x4d'),_0x5c336c['id']);return createTicket(_0x4e57d3,_0x3208c9,_0x5c336c,_0x5a68e2,_0x5de623,_0x5a68e2[_0x3472('0x4e')],_0x4270ba);})[_0x3472('0x2f')](function(_0x3729ad){_0x25ecbe=_0x3729ad;logger[_0x3472('0x18')](_0x3472('0x4f'));logger[_0x3472('0x18')](_0x3472('0x50'),_0x25ecbe['id']);var _0x54fb13=util[_0x3472('0x1f')](_0x3472('0x5c'),_0x4e57d3[_0x3472('0x2c')],_[_0x3472('0x5d')](_0x25ecbe['id'],'x')[0x1]);logger[_0x3472('0x18')](_0x3472('0x56'),_0x3472('0x51'));emit(util[_0x3472('0x1f')](_0x3472('0x52'),_0x1a6b99[_0x3472('0x16')]),_0x3472('0x53'),{'uri':_0x54fb13});})['catch'](function(_0x440c18){logger[_0x3472('0x38')](_0x3472('0x56'),JSON['stringify'](_0x440c18));});};exports['unmanaged']=function(_0x5e7261,_0x4e10bf,_0x14f046,_0x27240f,_0x14ba2f,_0x24f900){var _0x14120f,_0x559ba2,_0x57da90,_0x47f299;_0x24f900[_0x3472('0x2c')]=intUtil['stripTrailingSlash'](_0x24f900[_0x3472('0x2c')]);_0x24f900['serverUrl']=intUtil[_0x3472('0x46')](_0x24f900['serverUrl']);if(_0x14ba2f&&_0x14ba2f[_0x3472('0x47')]){logger[_0x3472('0x18')]('['+_0x4e10bf['lastevent']['toUpperCase']()+']',_0x3472('0x57'));_0x4e10bf[_0x3472('0x49')]=util[_0x3472('0x1f')](_0x3472('0x4a'),_0x24f900[_0x3472('0x55')],_0x4e10bf[_0x3472('0x4b')],md5(_0x4e10bf['uniqueid']));}else{_0x4e10bf[_0x3472('0x49')]='';}return getConnection(_0x24f900)['then'](function(_0x43da9f){_0x47f299=_0x43da9f;return getUser(_0x24f900,'',_0x47f299);})['then'](function(_0x4baff4){_0x14120f=_0x4baff4;logger[_0x3472('0x18')](_0x3472('0x59'),_0x14120f['id']);return getEndUser(_0x24f900,_0x4e10bf[_0x3472('0x4c')],_0x4e10bf[_0x3472('0x5e')],_0x47f299);})[_0x3472('0x2f')](function(_0x167b06){_0x559ba2=_0x167b06;logger[_0x3472('0x18')](_0x3472('0x4d'),_0x559ba2['id']);return createTicket(_0x24f900,_0x14120f,_0x559ba2,_0x14f046,_0x4e10bf,_0x14f046[_0x3472('0x4e')],_0x47f299);})[_0x3472('0x2f')](function(_0x35d630){_0x57da90=_0x35d630;logger['info'](_0x3472('0x4f'));logger[_0x3472('0x18')](_0x3472('0x50'),_0x57da90['id']);})[_0x3472('0x26')](function(_0x45d683){logger[_0x3472('0x38')]('['+_0x4e10bf[_0x3472('0x5f')][_0x3472('0x60')]()+']',JSON['stringify'](_0x45d683));});}; \ 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 1cd1b02..7931115 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 _0x3e5c=['variableName','idField','customVariable','Variable','toLowerCase','custom_fields','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridnum','The\x20Ticket\x20ID\x20is:','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','unmanaged','lastevent','toUpperCase','recordingURL','calleridname','\x20Error\x20running\x20Zendesk\x20integration','inspect','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','%s/token:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','length','map','forEach','type','string','nameField','customField','push','content','variable'];(function(_0x33d4a5,_0x514a52){var _0x5a5e9d=function(_0x23bcc1){while(--_0x23bcc1){_0x33d4a5['push'](_0x33d4a5['shift']());}};_0x5a5e9d(++_0x514a52);}(_0x3e5c,0x9a));var _0xc3e5=function(_0xa517d,_0x3a90cc){_0xa517d=_0xa517d-0x0;var _0x2c6f44=_0x3e5c[_0xa517d];return _0x2c6f44;};'use strict';var _=require(_0xc3e5('0x0'));var rp=require(_0xc3e5('0x1'));var md5=require(_0xc3e5('0x2'));var util=require(_0xc3e5('0x3'));var Redis=require('ioredis');var intUtil=require(_0xc3e5('0x4'));var config=require(_0xc3e5('0x5'));var logger=require(_0xc3e5('0x6'))(_0xc3e5('0x7'));config[_0xc3e5('0x8')]=_[_0xc3e5('0x9')](config['redis'],{'host':_0xc3e5('0xa'),'port':0x18eb});var io=require(_0xc3e5('0xb'))(new Redis(config[_0xc3e5('0x8')]));function emit(_0xcbbec0,_0x2d580e,_0x4864a2){io['to'](_0xcbbec0)[_0xc3e5('0xc')](_0x2d580e,_0x4864a2);}var headers={'Content-Type':_0xc3e5('0xd'),'Accept':_0xc3e5('0xd')};function getTicket(_0x19813b,_0x448454,_0x644286,_0xd1ef16,_0x55bece){logger[_0xc3e5('0xe')](_0xc3e5('0xf'));return request({'uri':util[_0xc3e5('0x10')](_0xc3e5('0x11'),_0x19813b['remoteUri']),'method':_0xc3e5('0x12'),'body':{'ticket':_[_0xc3e5('0x13')]({'requester_id':_0x644286['id'],'submitter_id':_0x448454?_0x448454['id']:undefined,'assignee_id':_0x448454?_0x448454['id']:undefined,'tags':getTags(_0xd1ef16[_0xc3e5('0x14')],_0xc3e5('0x15')),'subject':intUtil[_0xc3e5('0x16')](_0xd1ef16[_0xc3e5('0x17')],_0x55bece,'\x20'),'description':intUtil['getString'](_0xd1ef16['Descriptions'],_0x55bece,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0xd1ef16[_0xc3e5('0x18')],_0x55bece,'\x0a')}},getCustomFields(_0xd1ef16['Fields'],_0x55bece))}})[_0xc3e5('0x19')](function(_0x3fb3ab){logger['info'](_0xc3e5('0x1a'));return _0x3fb3ab[_0xc3e5('0x1b')];});}function getUser(_0x2cc476,_0x1829f9){if(intUtil[_0xc3e5('0x1c')](_0x1829f9)){logger['info'](_0xc3e5('0x1d'),_0x1829f9);return request({'uri':util[_0xc3e5('0x10')](_0xc3e5('0x1e'),_0x2cc476[_0xc3e5('0x1f')]),'qs':{'query':util[_0xc3e5('0x10')](_0xc3e5('0x20'),_0x1829f9)}})['then'](function(_0x13d709){if(_0x13d709[_0xc3e5('0x21')]){logger['info'](_0xc3e5('0x22'));return _['find'](_0x13d709[_0xc3e5('0x23')],{'email':_0x1829f9,'role':_0xc3e5('0x24')});}else{logger[_0xc3e5('0xe')](_0xc3e5('0x25'));return request({'uri':util[_0xc3e5('0x10')]('%s/users/me.json',_0x2cc476[_0xc3e5('0x1f')])})[_0xc3e5('0x19')](function(_0x2d8c6f){logger[_0xc3e5('0xe')](_0xc3e5('0x26'));return _0x2d8c6f[_0xc3e5('0x27')];});}});}else{logger[_0xc3e5('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc3e5('0x10')](_0xc3e5('0x28'),_0x2cc476[_0xc3e5('0x1f')])})[_0xc3e5('0x19')](function(_0x29c158){logger[_0xc3e5('0xe')](_0xc3e5('0x26'));return _0x29c158[_0xc3e5('0x27')];});}}function getEndUser(_0x564748,_0x25d3a3,_0x4c33d9){logger['info'](_0xc3e5('0x29'),_0x4c33d9);return request({'uri':util[_0xc3e5('0x10')](_0xc3e5('0x1e'),_0x564748['remoteUri']),'qs':{'query':util[_0xc3e5('0x10')](_0xc3e5('0x2a'),_0x4c33d9)}})[_0xc3e5('0x19')](function(_0x3ad580){var _0x591262;if(_0x3ad580[_0xc3e5('0x23')]['length']){_0x3ad580[_0xc3e5('0x23')]=_[_0xc3e5('0x2b')](_0x3ad580[_0xc3e5('0x23')],{'suspended':![],'role':'end-user'});if(_0x3ad580['results']['length']){_0x591262=_[_0xc3e5('0x2c')](_0x3ad580[_0xc3e5('0x23')]);}}if(_0x591262){logger[_0xc3e5('0xe')](_0xc3e5('0x2d'));return _0x591262;}else{logger[_0xc3e5('0xe')](_0xc3e5('0x2e'));return request({'uri':util['format'](_0xc3e5('0x2f'),_0x564748[_0xc3e5('0x1f')]),'method':_0xc3e5('0x12'),'body':{'user':{'role':_0xc3e5('0x30'),'name':util[_0xc3e5('0x10')](_0xc3e5('0x31'),_0x25d3a3||_0x4c33d9),'phone':_0x4c33d9}}})[_0xc3e5('0x19')](function(_0x133a46){logger[_0xc3e5('0xe')](_0xc3e5('0x32'));return _0x133a46[_0xc3e5('0x27')];});}});}function getAuth(_0x5d4297){var _0x3d7b87;if(_0x5d4297['authType']===_0xc3e5('0x33')){_0x3d7b87=util[_0xc3e5('0x10')](_0xc3e5('0x34'),_0x5d4297[_0xc3e5('0x35')],_0x5d4297['password']);}else if(_0x5d4297[_0xc3e5('0x36')]==='token'){_0x3d7b87=util['format'](_0xc3e5('0x37'),_0x5d4297['username'],_0x5d4297[_0xc3e5('0x38')]);}return util[_0xc3e5('0x10')](_0xc3e5('0x39'),new Buffer(_0x3d7b87)[_0xc3e5('0x3a')](_0xc3e5('0x3b')));}function request(_0x554b57){logger[_0xc3e5('0x3c')](_0xc3e5('0x3d'),JSON[_0xc3e5('0x3e')](_0x554b57));return rp(_[_0xc3e5('0x9')](_0x554b57,{'method':_0xc3e5('0x3f'),'headers':headers,'json':!![]}));}function getTags(_0x57a919,_0x3ab3be){var _0x484e21=[];if(_0x57a919&&_0x57a919[_0xc3e5('0x40')]>0x0){_0x484e21=_[_0xc3e5('0x41')](_0x57a919,_0x3ab3be);}return _0x484e21;}function getCustomFields(_0x4c9997,_0x30538f){var _0x565d93=[];var _0xd2b224={'custom_fields':[]};if(_0x4c9997[_0xc3e5('0x40')]>0x0){_[_0xc3e5('0x42')](_0x4c9997,function(_0x4a2c6b){if(_0x4a2c6b[_0xc3e5('0x43')]===_0xc3e5('0x44')&&_0x4a2c6b[_0xc3e5('0x45')]&&!_0x4a2c6b[_0xc3e5('0x46')]){_0xd2b224[_0x4a2c6b[_0xc3e5('0x45')]['toLowerCase']()]=_0x4a2c6b['content']['toString']();}else if(_0x4a2c6b[_0xc3e5('0x43')]===_0xc3e5('0x44')&&_0x4a2c6b['idField']&&_0x4a2c6b[_0xc3e5('0x46')]){_0xd2b224['custom_fields'][_0xc3e5('0x47')]({'id':_0x4a2c6b['idField'],'value':_0x4a2c6b[_0xc3e5('0x48')]['toString']()});}else if(_0x4a2c6b[_0xc3e5('0x43')]===_0xc3e5('0x49')&&_0x4a2c6b[_0xc3e5('0x4a')]&&_0x4a2c6b[_0xc3e5('0x4b')]&&_0x4a2c6b[_0xc3e5('0x46')]){_0x30538f[_0x4a2c6b[_0xc3e5('0x4a')]]&&_0xd2b224['custom_fields']['push']({'id':_0x4a2c6b[_0xc3e5('0x4b')],'value':_0x30538f[_0x4a2c6b['variableName']][_0xc3e5('0x3a')]()});}else if(_0x4a2c6b[_0xc3e5('0x43')]===_0xc3e5('0x4c')&&_0x4a2c6b[_0xc3e5('0x4d')]&&_0x4a2c6b[_0xc3e5('0x4d')][_0xc3e5('0x15')]&&_0x4a2c6b['idField']&&_0x4a2c6b[_0xc3e5('0x46')]){_0x30538f[_0x4a2c6b[_0xc3e5('0x4d')][_0xc3e5('0x15')][_0xc3e5('0x4e')]()]&&_0xd2b224[_0xc3e5('0x4f')][_0xc3e5('0x47')]({'id':_0x4a2c6b[_0xc3e5('0x4b')],'value':_0x30538f[_0x4a2c6b[_0xc3e5('0x4d')][_0xc3e5('0x15')][_0xc3e5('0x4e')]()]['toString']()});}});}return _0xd2b224;}exports['queue']=function(_0x5b5569,_0x3c7119,_0x5785e0,_0x2ca8cb,_0x48661e,_0x31587d){var _0x3b24c4,_0x49d5d9;_0x31587d[_0xc3e5('0x1f')]=intUtil[_0xc3e5('0x50')](_0x31587d[_0xc3e5('0x1f')]);_0x31587d[_0xc3e5('0x51')]=intUtil['stripTrailingSlash'](_0x31587d['serverUrl']);if(_0x48661e&&_0x48661e[_0xc3e5('0x52')]){logger[_0xc3e5('0xe')]('[QUEUE]',_0xc3e5('0x53'));_0x3c7119['recordingURL']=util[_0xc3e5('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x31587d[_0xc3e5('0x51')],_0x3c7119['uniqueid'],md5(_0x3c7119['uniqueid']));}else{_0x3c7119['recordingURL']='';}headers[_0xc3e5('0x54')]=getAuth(_0x31587d);return getUser(_0x31587d,_0x2ca8cb[_0xc3e5('0x55')])[_0xc3e5('0x19')](function(_0x5adc21){_0x3b24c4=_0x5adc21;logger['info'](_0xc3e5('0x56'),_0x3b24c4['id']);return getEndUser(_0x31587d,_0x3c7119['calleridname'],_0x3c7119[_0xc3e5('0x57')]);})[_0xc3e5('0x19')](function(_0x364297){_0x49d5d9=_0x364297;logger[_0xc3e5('0xe')](_0xc3e5('0x58'),_0x49d5d9['id']);return getTicket(_0x31587d,_0x3b24c4,_0x49d5d9,_0x5785e0,_0x3c7119);})[_0xc3e5('0x19')](function(_0x5cd31c){if(_0x5cd31c){logger[_0xc3e5('0xe')]('The\x20Ticket\x20ID\x20is:',_0x5cd31c['id']);switch(_0x31587d['type']){case _0xc3e5('0x59'):logger['info'](_0xc3e5('0x5a'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xc3e5('0x5b'),_0x31587d[_0xc3e5('0x1f')],_0x3b24c4['id'],_0x5cd31c['id']),'method':'POST'});case'newTab':logger[_0xc3e5('0xe')](_0xc3e5('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc3e5('0x10')](_0xc3e5('0x5c'),_0x2ca8cb[_0xc3e5('0x15')]),_0xc3e5('0x5d'),{'uri':util[_0xc3e5('0x10')](_0xc3e5('0x5e'),_0x31587d[_0xc3e5('0x1f')],_0x5cd31c['id'])});break;default:logger['error'](_0xc3e5('0x5a'),_0xc3e5('0x5f'));}}})['catch'](function(_0x4b33e1){logger[_0xc3e5('0x60')](_0xc3e5('0x61'),util['inspect'](_0x4b33e1,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x566ed0,_0x4ada0d,_0x44152a,_0x232e57,_0x474891,_0x694a5d,_0x1cb207){var _0x4bb735,_0x14ad81;_0x694a5d[_0xc3e5('0x1f')]=intUtil[_0xc3e5('0x50')](_0x694a5d['remoteUri']);_0x694a5d[_0xc3e5('0x51')]=intUtil[_0xc3e5('0x50')](_0x694a5d[_0xc3e5('0x51')]);if(_0x1cb207&&_0x1cb207[_0xc3e5('0x62')]&&_0x1cb207[_0xc3e5('0x62')]!=='none'){logger['info'](_0xc3e5('0x63'),_0xc3e5('0x53'));_0x4ada0d['recordingURL']=util[_0xc3e5('0x10')](_0xc3e5('0x64'),_0x694a5d['serverUrl'],_0x4ada0d[_0xc3e5('0x65')],md5(_0x4ada0d[_0xc3e5('0x65')]));}headers[_0xc3e5('0x54')]=getAuth(_0x694a5d);return getUser(_0x694a5d,_0x232e57[_0xc3e5('0x55')])[_0xc3e5('0x19')](function(_0x3364d3){_0x4bb735=_0x3364d3;logger[_0xc3e5('0xe')](_0xc3e5('0x56'),_0x4bb735['id']);return getEndUser(_0x694a5d,_0x4ada0d['destcalleridname'],_0x4ada0d[_0xc3e5('0x66')]);})[_0xc3e5('0x19')](function(_0x3db9ac){_0x14ad81=_0x3db9ac;logger['info']('The\x20Enduser\x20ID\x20is:',_0x14ad81['id']);return getTicket(_0x694a5d,_0x4bb735,_0x14ad81,_0x44152a,_0x4ada0d);})[_0xc3e5('0x19')](function(_0x470b8d){if(_0x470b8d){logger[_0xc3e5('0xe')](_0xc3e5('0x67'),_0x470b8d['id']);switch(_0x694a5d[_0xc3e5('0x43')]){case _0xc3e5('0x59'):logger['info'](_0xc3e5('0x63'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xc3e5('0x10')](_0xc3e5('0x5b'),_0x694a5d[_0xc3e5('0x1f')],_0x4bb735['id'],_0x470b8d['id']),'method':_0xc3e5('0x12')});case _0xc3e5('0x68'):logger[_0xc3e5('0xe')](_0xc3e5('0x63'),_0xc3e5('0x69'));emit(util[_0xc3e5('0x10')](_0xc3e5('0x5c'),_0x232e57['name']),'trigger:browser:url',{'uri':util[_0xc3e5('0x10')](_0xc3e5('0x5e'),_0x694a5d[_0xc3e5('0x1f')],_0x470b8d['id'])});break;default:logger[_0xc3e5('0x60')](_0xc3e5('0x63'),_0xc3e5('0x5f'));}}})[_0xc3e5('0x6a')](function(_0x95db72){logger[_0xc3e5('0x60')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x95db72,{'showHidden':!![],'depth':null}));});};exports[_0xc3e5('0x6b')]=function(_0x1a8d1c,_0x44bf4f,_0x2f480b,_0x58d33a,_0x2d184a,_0x182a6d){var _0x5ae5bf,_0x1cf94c;_0x182a6d[_0xc3e5('0x1f')]=intUtil[_0xc3e5('0x50')](_0x182a6d[_0xc3e5('0x1f')]);_0x182a6d['serverUrl']=intUtil[_0xc3e5('0x50')](_0x182a6d[_0xc3e5('0x51')]);if(_0x2d184a&&_0x2d184a['monitor_format']){logger[_0xc3e5('0xe')]('['+_0x44bf4f[_0xc3e5('0x6c')][_0xc3e5('0x6d')]()+']',_0xc3e5('0x53'));_0x44bf4f[_0xc3e5('0x6e')]=util[_0xc3e5('0x10')](_0xc3e5('0x64'),_0x182a6d[_0xc3e5('0x51')],_0x44bf4f[_0xc3e5('0x65')],md5(_0x44bf4f[_0xc3e5('0x65')]));}else{_0x44bf4f['recordingURL']='';}headers[_0xc3e5('0x54')]=getAuth(_0x182a6d);return getUser(_0x182a6d)[_0xc3e5('0x19')](function(_0x65c755){_0x5ae5bf=_0x65c755;logger[_0xc3e5('0xe')](_0xc3e5('0x56'),_0x5ae5bf['id']);return getEndUser(_0x182a6d,_0x44bf4f[_0xc3e5('0x6f')],_0x44bf4f[_0xc3e5('0x57')]);})['then'](function(_0xe68131){_0x1cf94c=_0xe68131;logger[_0xc3e5('0xe')](_0xc3e5('0x58'),_0x1cf94c['id']);return getTicket(_0x182a6d,_0x5ae5bf,_0x1cf94c,_0x2f480b,_0x44bf4f);})[_0xc3e5('0x19')](function(_0xca1b8a){if(_0xca1b8a){logger[_0xc3e5('0xe')](_0xc3e5('0x67'),_0xca1b8a['id']);}})[_0xc3e5('0x6a')](function(_0x5aa68c){logger['error']('['+_0x44bf4f[_0xc3e5('0x6c')][_0xc3e5('0x6d')]()+']'+_0xc3e5('0x70'),util[_0xc3e5('0x71')](_0x5aa68c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6324=['[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','toUpperCase','catch','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/logger','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','getString','Subjects','Descriptions','Fields','then','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','authType','password','%s:%s','username','token','Basic\x20%s','toString','debug','[HTTP]','stringify','defaults','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','idField','variableName','push','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none'];(function(_0x573010,_0x2923c4){var _0x84c43d=function(_0x22c44d){while(--_0x22c44d){_0x573010['push'](_0x573010['shift']());}};_0x84c43d(++_0x2923c4);}(_0x6324,0x142));var _0x4632=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x6324[_0x32d457];return _0x338386;};'use strict';var _=require(_0x4632('0x0'));var rp=require(_0x4632('0x1'));var md5=require(_0x4632('0x2'));var util=require(_0x4632('0x3'));var Redis=require('ioredis');var intUtil=require(_0x4632('0x4'));var config=require('../../../../config/environment');var logger=require(_0x4632('0x5'))('zendesk');config[_0x4632('0x6')]=_['defaults'](config[_0x4632('0x6')],{'host':_0x4632('0x7'),'port':0x18eb});var io=require(_0x4632('0x8'))(new Redis(config[_0x4632('0x6')]));function emit(_0x4a15b2,_0x17e860,_0x44dd6d){io['to'](_0x4a15b2)[_0x4632('0x9')](_0x17e860,_0x44dd6d);}var headers={'Content-Type':'application/json','Accept':_0x4632('0xa')};function getTicket(_0x47824c,_0x47a518,_0x556bbc,_0xcdefa2,_0x21999d){logger[_0x4632('0xb')](_0x4632('0xc'));return request({'uri':util[_0x4632('0xd')](_0x4632('0xe'),_0x47824c[_0x4632('0xf')]),'method':_0x4632('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x556bbc['id'],'submitter_id':_0x47a518?_0x47a518['id']:undefined,'assignee_id':_0x47a518?_0x47a518['id']:undefined,'tags':getTags(_0xcdefa2[_0x4632('0x11')],'name'),'subject':intUtil[_0x4632('0x12')](_0xcdefa2[_0x4632('0x13')],_0x21999d,'\x20'),'description':intUtil[_0x4632('0x12')](_0xcdefa2[_0x4632('0x14')],_0x21999d,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0xcdefa2[_0x4632('0x14')],_0x21999d,'\x0a')}},getCustomFields(_0xcdefa2[_0x4632('0x15')],_0x21999d))}})[_0x4632('0x16')](function(_0x37d798){logger[_0x4632('0xb')]('Ticket\x20created!');return _0x37d798['ticket'];});}function getUser(_0x2fd7ae,_0x38bedd){if(intUtil[_0x4632('0x17')](_0x38bedd)){logger[_0x4632('0xb')]('Getting\x20agent\x20with\x20email',_0x38bedd);return request({'uri':util[_0x4632('0xd')](_0x4632('0x18'),_0x2fd7ae[_0x4632('0xf')]),'qs':{'query':util['format'](_0x4632('0x19'),_0x38bedd)}})[_0x4632('0x16')](function(_0x58e193){if(_0x58e193['count']){logger[_0x4632('0xb')](_0x4632('0x1a'));return _[_0x4632('0x1b')](_0x58e193[_0x4632('0x1c')],{'email':_0x38bedd,'role':_0x4632('0x1d')});}else{logger[_0x4632('0xb')](_0x4632('0x1e'));return request({'uri':util[_0x4632('0xd')](_0x4632('0x1f'),_0x2fd7ae[_0x4632('0xf')])})[_0x4632('0x16')](function(_0x2d656a){logger[_0x4632('0xb')](_0x4632('0x20'));return _0x2d656a[_0x4632('0x21')];});}});}else{logger[_0x4632('0xb')](_0x4632('0x1e'));return request({'uri':util[_0x4632('0xd')](_0x4632('0x1f'),_0x2fd7ae[_0x4632('0xf')])})[_0x4632('0x16')](function(_0x4455ef){logger[_0x4632('0xb')](_0x4632('0x20'));return _0x4455ef[_0x4632('0x21')];});}}function getEndUser(_0x1b8de0,_0x4af026,_0x2e3428){logger[_0x4632('0xb')](_0x4632('0x22'),_0x2e3428);return request({'uri':util[_0x4632('0xd')](_0x4632('0x18'),_0x1b8de0[_0x4632('0xf')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x2e3428)}})[_0x4632('0x16')](function(_0x244743){var _0x2f6656;if(_0x244743[_0x4632('0x1c')][_0x4632('0x23')]){_0x244743[_0x4632('0x1c')]=_[_0x4632('0x24')](_0x244743['results'],{'suspended':![],'role':_0x4632('0x25')});if(_0x244743[_0x4632('0x1c')]['length']){_0x2f6656=_[_0x4632('0x26')](_0x244743['results']);}}if(_0x2f6656){logger[_0x4632('0xb')]('Enduser\x20found!');return _0x2f6656;}else{logger['info'](_0x4632('0x27'));return request({'uri':util[_0x4632('0xd')](_0x4632('0x28'),_0x1b8de0['remoteUri']),'method':'POST','body':{'user':{'role':_0x4632('0x25'),'name':util[_0x4632('0xd')]('Caller\x20-\x20%s',_0x4af026||_0x2e3428),'phone':_0x2e3428}}})['then'](function(_0x97cb9a){logger[_0x4632('0xb')]('Enduser\x20created.');return _0x97cb9a[_0x4632('0x21')];});}});}function getAuth(_0x2a1093){var _0x4686c7;if(_0x2a1093[_0x4632('0x29')]===_0x4632('0x2a')){_0x4686c7=util['format'](_0x4632('0x2b'),_0x2a1093[_0x4632('0x2c')],_0x2a1093['password']);}else if(_0x2a1093['authType']===_0x4632('0x2d')){_0x4686c7=util['format']('%s/token:%s',_0x2a1093[_0x4632('0x2c')],_0x2a1093['token']);}return util[_0x4632('0xd')](_0x4632('0x2e'),new Buffer(_0x4686c7)[_0x4632('0x2f')]('base64'));}function request(_0x4d091b){logger[_0x4632('0x30')](_0x4632('0x31'),JSON[_0x4632('0x32')](_0x4d091b));return rp(_[_0x4632('0x33')](_0x4d091b,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x486f6c,_0x3114c4){var _0xd90c7c=[];if(_0x486f6c&&_0x486f6c[_0x4632('0x23')]>0x0){_0xd90c7c=_['map'](_0x486f6c,_0x3114c4);}return _0xd90c7c;}function getCustomFields(_0x5a3fb4,_0x53b436){var _0x405308=[];var _0x393ef2={'custom_fields':[]};if(_0x5a3fb4['length']>0x0){_[_0x4632('0x34')](_0x5a3fb4,function(_0x20a700){if(_0x20a700[_0x4632('0x35')]===_0x4632('0x36')&&_0x20a700[_0x4632('0x37')]&&!_0x20a700[_0x4632('0x38')]){_0x393ef2[_0x20a700[_0x4632('0x37')][_0x4632('0x39')]()]=_0x20a700[_0x4632('0x3a')][_0x4632('0x2f')]();}else if(_0x20a700[_0x4632('0x35')]===_0x4632('0x36')&&_0x20a700['idField']&&_0x20a700[_0x4632('0x38')]){_0x393ef2[_0x4632('0x3b')]['push']({'id':_0x20a700[_0x4632('0x3c')],'value':_0x20a700[_0x4632('0x3a')]['toString']()});}else if(_0x20a700[_0x4632('0x35')]==='variable'&&_0x20a700[_0x4632('0x3d')]&&_0x20a700[_0x4632('0x3c')]&&_0x20a700[_0x4632('0x38')]){_0x53b436[_0x20a700[_0x4632('0x3d')]]&&_0x393ef2['custom_fields'][_0x4632('0x3e')]({'id':_0x20a700[_0x4632('0x3c')],'value':_0x53b436[_0x20a700[_0x4632('0x3d')]][_0x4632('0x2f')]()});}else if(_0x20a700['type']==='customVariable'&&_0x20a700[_0x4632('0x3f')]&&_0x20a700[_0x4632('0x3f')][_0x4632('0x40')]&&_0x20a700['idField']&&_0x20a700[_0x4632('0x38')]){_0x53b436[_0x20a700[_0x4632('0x3f')][_0x4632('0x40')][_0x4632('0x39')]()]&&_0x393ef2[_0x4632('0x3b')][_0x4632('0x3e')]({'id':_0x20a700[_0x4632('0x3c')],'value':_0x53b436[_0x20a700['Variable'][_0x4632('0x40')][_0x4632('0x39')]()][_0x4632('0x2f')]()});}});}return _0x393ef2;}exports[_0x4632('0x41')]=function(_0x165c00,_0x4d1d50,_0x579ed2,_0x6e373d,_0x3a1d52,_0x23b0df){var _0x2e5978,_0x4fa733;_0x23b0df[_0x4632('0xf')]=intUtil[_0x4632('0x42')](_0x23b0df[_0x4632('0xf')]);_0x23b0df[_0x4632('0x43')]=intUtil[_0x4632('0x42')](_0x23b0df['serverUrl']);if(_0x3a1d52&&_0x3a1d52[_0x4632('0x44')]){logger[_0x4632('0xb')](_0x4632('0x45'),_0x4632('0x46'));_0x4d1d50[_0x4632('0x47')]=util[_0x4632('0xd')](_0x4632('0x48'),_0x23b0df[_0x4632('0x43')],_0x4d1d50[_0x4632('0x49')],md5(_0x4d1d50[_0x4632('0x49')]));}else{_0x4d1d50[_0x4632('0x47')]='';}headers['Authorization']=getAuth(_0x23b0df);return getUser(_0x23b0df,_0x6e373d[_0x4632('0x4a')])[_0x4632('0x16')](function(_0x30864d){_0x2e5978=_0x30864d;logger['info'](_0x4632('0x4b'),_0x2e5978['id']);return getEndUser(_0x23b0df,_0x4d1d50[_0x4632('0x4c')],_0x4d1d50[_0x4632('0x4d')]);})[_0x4632('0x16')](function(_0xa681e9){_0x4fa733=_0xa681e9;logger[_0x4632('0xb')](_0x4632('0x4e'),_0x4fa733['id']);return getTicket(_0x23b0df,_0x2e5978,_0x4fa733,_0x579ed2,_0x4d1d50);})[_0x4632('0x16')](function(_0x1f43b6){if(_0x1f43b6){logger[_0x4632('0xb')]('The\x20Ticket\x20ID\x20is:',_0x1f43b6['id']);switch(_0x23b0df[_0x4632('0x35')]){case _0x4632('0x4f'):logger['info'](_0x4632('0x45'),_0x4632('0x50'));return request({'uri':util[_0x4632('0xd')](_0x4632('0x51'),_0x23b0df[_0x4632('0xf')],_0x2e5978['id'],_0x1f43b6['id']),'method':_0x4632('0x10')});case _0x4632('0x52'):logger[_0x4632('0xb')](_0x4632('0x45'),_0x4632('0x53'));emit(util[_0x4632('0xd')](_0x4632('0x54'),_0x6e373d[_0x4632('0x40')]),_0x4632('0x55'),{'uri':util[_0x4632('0xd')](_0x4632('0x56'),_0x23b0df[_0x4632('0xf')],_0x1f43b6['id'])});break;default:logger[_0x4632('0x57')](_0x4632('0x45'),_0x4632('0x58'));}}})['catch'](function(_0x3bd8ee){logger[_0x4632('0x57')](_0x4632('0x59'),util[_0x4632('0x5a')](_0x3bd8ee,{'showHidden':!![],'depth':null}));});};exports[_0x4632('0x5b')]=function(_0x33ad25,_0x5d2cbb,_0x3d313f,_0x433fea,_0x41409d,_0x5877b9,_0xdc9d7f){var _0x275ea1,_0x57dbe7;_0x5877b9[_0x4632('0xf')]=intUtil[_0x4632('0x42')](_0x5877b9[_0x4632('0xf')]);_0x5877b9['serverUrl']=intUtil[_0x4632('0x42')](_0x5877b9[_0x4632('0x43')]);if(_0xdc9d7f&&_0xdc9d7f[_0x4632('0x5c')]&&_0xdc9d7f[_0x4632('0x5c')]!==_0x4632('0x5d')){logger[_0x4632('0xb')](_0x4632('0x5e'),_0x4632('0x46'));_0x5d2cbb[_0x4632('0x47')]=util[_0x4632('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5877b9[_0x4632('0x43')],_0x5d2cbb[_0x4632('0x49')],md5(_0x5d2cbb['uniqueid']));}headers[_0x4632('0x5f')]=getAuth(_0x5877b9);return getUser(_0x5877b9,_0x433fea['email'])['then'](function(_0xa55d76){_0x275ea1=_0xa55d76;logger[_0x4632('0xb')](_0x4632('0x4b'),_0x275ea1['id']);return getEndUser(_0x5877b9,_0x5d2cbb[_0x4632('0x60')],_0x5d2cbb[_0x4632('0x61')]);})[_0x4632('0x16')](function(_0x32920e){_0x57dbe7=_0x32920e;logger[_0x4632('0xb')](_0x4632('0x4e'),_0x57dbe7['id']);return getTicket(_0x5877b9,_0x275ea1,_0x57dbe7,_0x3d313f,_0x5d2cbb);})[_0x4632('0x16')](function(_0x1c321f){if(_0x1c321f){logger[_0x4632('0xb')](_0x4632('0x62'),_0x1c321f['id']);switch(_0x5877b9[_0x4632('0x35')]){case'integrationTab':logger['info'](_0x4632('0x5e'),_0x4632('0x50'));return request({'uri':util[_0x4632('0xd')](_0x4632('0x51'),_0x5877b9[_0x4632('0xf')],_0x275ea1['id'],_0x1c321f['id']),'method':_0x4632('0x10')});case'newTab':logger[_0x4632('0xb')](_0x4632('0x5e'),_0x4632('0x53'));emit(util[_0x4632('0xd')]('user:%s',_0x433fea['name']),_0x4632('0x55'),{'uri':util['format'](_0x4632('0x56'),_0x5877b9[_0x4632('0xf')],_0x1c321f['id'])});break;default:logger[_0x4632('0x57')](_0x4632('0x5e'),_0x4632('0x58'));}}})['catch'](function(_0x61aa92){logger[_0x4632('0x57')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x61aa92,{'showHidden':!![],'depth':null}));});};exports[_0x4632('0x63')]=function(_0x1375f6,_0x47391f,_0x3090d6,_0x4dfda1,_0x5a2cc1,_0x52e63b){var _0x10f7ab,_0x5b37cc;_0x52e63b[_0x4632('0xf')]=intUtil[_0x4632('0x42')](_0x52e63b[_0x4632('0xf')]);_0x52e63b[_0x4632('0x43')]=intUtil[_0x4632('0x42')](_0x52e63b[_0x4632('0x43')]);if(_0x5a2cc1&&_0x5a2cc1[_0x4632('0x44')]){logger[_0x4632('0xb')]('['+_0x47391f[_0x4632('0x64')][_0x4632('0x65')]()+']',_0x4632('0x46'));_0x47391f[_0x4632('0x47')]=util[_0x4632('0xd')](_0x4632('0x48'),_0x52e63b[_0x4632('0x43')],_0x47391f[_0x4632('0x49')],md5(_0x47391f['uniqueid']));}else{_0x47391f[_0x4632('0x47')]='';}headers[_0x4632('0x5f')]=getAuth(_0x52e63b);return getUser(_0x52e63b)[_0x4632('0x16')](function(_0x26a3f3){_0x10f7ab=_0x26a3f3;logger[_0x4632('0xb')](_0x4632('0x4b'),_0x10f7ab['id']);return getEndUser(_0x52e63b,_0x47391f[_0x4632('0x4c')],_0x47391f[_0x4632('0x4d')]);})[_0x4632('0x16')](function(_0x33561f){_0x5b37cc=_0x33561f;logger[_0x4632('0xb')](_0x4632('0x4e'),_0x5b37cc['id']);return getTicket(_0x52e63b,_0x10f7ab,_0x5b37cc,_0x3090d6,_0x47391f);})[_0x4632('0x16')](function(_0x4bba05){if(_0x4bba05){logger[_0x4632('0xb')](_0x4632('0x62'),_0x4bba05['id']);}})[_0x4632('0x66')](function(_0x3a4645){logger[_0x4632('0x57')]('['+_0x47391f[_0x4632('0x64')]['toUpperCase']()+']'+_0x4632('0x67'),util[_0x4632('0x5a')](_0x3a4645,{'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 5c0eeb2..d0a5484 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 _0xf793=['Variable','name','toLowerCase','split','isNil','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','refresh_token','access_token','add','seconds','catch','error','stack','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','profile','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','role','last_name','data','code','SUCCESS','startCase','log','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','moduleCreate','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Owner','administrator','first_name','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','utc','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','starttime','mm:ss','lastevent','called','Call_Result','Called','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','details','err','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','uniqueid','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','none','[OUTBOUND]','recordingURL','/api/voice/recordings/','destcalleridname','Outbound','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','zoho.eu','request-promise','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','emit','debug','[HTTP]','stringify','length','forEach','type','idField','content','toString','variable','variableName'];(function(_0x2e6d36,_0xd9726e){var _0x1612f4=function(_0x2cad69){while(--_0x2cad69){_0x2e6d36['push'](_0x2e6d36['shift']());}};_0x1612f4(++_0xd9726e);}(_0xf793,0x1ac));var _0x3f79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf793[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var rp=require(_0x3f79('0x0'));var md5=require('md5');var util=require('util');var intUtil=require(_0x3f79('0x1'));var moment=require(_0x3f79('0x2'));var Redis=require(_0x3f79('0x3'));var BPromise=require(_0x3f79('0x4'));var config=require(_0x3f79('0x5'));var logger=require(_0x3f79('0x6'))(_0x3f79('0x7'));config[_0x3f79('0x8')]=_[_0x3f79('0x9')](config[_0x3f79('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x5f4ddc,_0x5d64d8,_0x244e6d){io['to'](_0x5f4ddc)[_0x3f79('0xa')](_0x5d64d8,_0x244e6d);}function request(_0x1bbf9f){logger[_0x3f79('0xb')](_0x3f79('0xc'),JSON[_0x3f79('0xd')](_0x1bbf9f));return rp(_0x1bbf9f);}function getCustomFields(_0xf97932,_0x2f0c1f){var _0x1fb280={};if(_0xf97932[_0x3f79('0xe')]>0x0){_[_0x3f79('0xf')](_0xf97932,function(_0x520c87){if(_0x520c87[_0x3f79('0x10')]==='string'&&_0x520c87[_0x3f79('0x11')]){_0x1fb280[_0x520c87[_0x3f79('0x11')]]=_0x520c87[_0x3f79('0x12')][_0x3f79('0x13')]();}else if(_0x520c87[_0x3f79('0x10')]===_0x3f79('0x14')&&_0x520c87[_0x3f79('0x15')]&&_0x520c87['idField']&&_0x2f0c1f[_0x520c87[_0x3f79('0x15')]]){_0x1fb280[_0x520c87[_0x3f79('0x11')]]=_0x2f0c1f[_0x520c87['variableName']]['toString']();}else if(_0x520c87[_0x3f79('0x10')]==='customVariable'&&_0x520c87[_0x3f79('0x16')]&&_0x520c87[_0x3f79('0x16')][_0x3f79('0x17')]&&_0x520c87['idField']&&_0x2f0c1f[_0x520c87[_0x3f79('0x16')]['name'][_0x3f79('0x18')]()]){_0x1fb280[_0x520c87[_0x3f79('0x11')]]=_0x2f0c1f[_0x520c87['Variable'][_0x3f79('0x17')]['toLowerCase']()]['toString']();}});}return _0x1fb280;}function getName(_0xa19ada){if(_0xa19ada['indexOf']('\x20')>0x0){var _0x337766=_0xa19ada[_0x3f79('0x19')](/ (.+)/);if(_0x337766[0x1]){return _0x337766;}}return[_0xa19ada,_0xa19ada];}var accountsTokens={};function getAccessToken(_0x1c9ccf){return new Promise(function(_0xf26e0e,_0x2f421c){if(!_['isNil'](accountsTokens[_0x1c9ccf['id']])&&!_[_0x3f79('0x1a')](accountsTokens[_0x1c9ccf['id']]['access_token'])){if(moment()[_0x3f79('0x1b')](accountsTokens[_0x1c9ccf['id']][_0x3f79('0x1c')])){_0xf26e0e(accountsTokens[_0x1c9ccf['id']]['access_token']);}}var _0x2cd3f4;switch(_0x1c9ccf[_0x3f79('0x1d')]){case'US':_0x2cd3f4='https://accounts.zoho.com';break;case'AU':_0x2cd3f4=_0x3f79('0x1e');break;case'EU':_0x2cd3f4=_0x3f79('0x1f');break;case'IN':_0x2cd3f4='https://accounts.zoho.in';break;case'CN':_0x2cd3f4=_0x3f79('0x20');break;default:_0x2cd3f4=_0x3f79('0x1f');break;}var _0x276f98={'method':_0x3f79('0x21'),'uri':_0x2cd3f4+_0x3f79('0x22'),'qs':{'refresh_token':_0x1c9ccf['refreshToken'],'client_id':_0x1c9ccf['clientId'],'client_secret':_0x1c9ccf[_0x3f79('0x23')],'grant_type':_0x3f79('0x24')},'json':!![]};return rp(_0x276f98)['then'](function(_0x170417){accountsTokens[_0x1c9ccf['id']]={'access_token':_0x170417[_0x3f79('0x25')],'expires_in':moment()[_0x3f79('0x26')](_0x170417[_0x3f79('0x1c')],_0x3f79('0x27'))};_0xf26e0e(_0x170417[_0x3f79('0x25')]);})[_0x3f79('0x28')](function(_0x9e561d){logger[_0x3f79('0x29')]('Failing\x20creating\x20the\x20access_token',_0x9e561d[_0x3f79('0x2a')]);_0x2f421c(_0x9e561d);});});}function getUser(_0x230988,_0x20db03,_0xd47ba0,_0x39b9ad){logger['info']('Search\x20user');return request({'method':_0x3f79('0x2b'),'uri':util[_0x3f79('0x2c')](_0x3f79('0x2d'),_0x20db03),'qs':{'type':_0x3f79('0x2e')},'headers':{'Authorization':_0x3f79('0x2f')+_0x230988},'json':!![]})[_0x3f79('0x30')](function(_0x1570da){if(_0x1570da[_0x3f79('0x31')]){var _0x4d5cfc=-0x1;if(_[_0x3f79('0x32')](_0x1570da[_0x3f79('0x31')])){if(!_[_0x3f79('0x1a')](_0x39b9ad)){_0x4d5cfc=_[_0x3f79('0x33')](_0x1570da[_0x3f79('0x31')],function(_0x592870){return _0x592870[_0x3f79('0x34')]===_0x39b9ad;});}if(_0x4d5cfc>=0x0){logger[_0x3f79('0x35')](_0x3f79('0x36'));}else{logger[_0x3f79('0x35')](_0x3f79('0x37'));_0x4d5cfc=_['findIndex'](_0x1570da[_0x3f79('0x31')],function(_0x33248c){return _0x33248c['profile'][_0x3f79('0x17')]===_0x3f79('0x38');});}return _0x1570da[_0x3f79('0x31')][_0x4d5cfc];}else{if(_0x1570da['user'][_0x3f79('0x39')]['name']===_0x3f79('0x38')){logger['info'](_0x3f79('0x37'));user=_0x1570da[_0x3f79('0x3a')];return user;}else{logger[_0x3f79('0x29')](_0x3f79('0x3b'),JSON[_0x3f79('0xd')](_0x1570da));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x3f79('0xd')](_0x1570da));}}}else{logger[_0x3f79('0x29')](_0x3f79('0x3b'),JSON[_0x3f79('0xd')](_0x1570da));throw new Error(_0x3f79('0x3c')+JSON[_0x3f79('0xd')](_0x1570da));}})['catch'](function(_0x174ebb){console[_0x3f79('0x29')](_0x174ebb);});}function getZohoUser(_0x5f35c4,_0x561c81){return new BPromise(function(_0x1e71df,_0xb56ce9){request(_0x5f35c4)[_0x3f79('0x30')](function(_0x4d70a8){var _0x56d36b=null;if(_0x4d70a8){_0x56d36b=_0x4d70a8['data'][0x0];_0x56d36b[_0x3f79('0x3d')]=_0x561c81;}_0x1e71df(_0x56d36b);})[_0x3f79('0x28')](function(_0x4af77e){_0xb56ce9(_0x4af77e);});});}function createEndUser(_0xe9a580,_0x16739d,_0x352f6d,_0x398cf8,_0x3c9296,_0x3a8a5b){var _0x352f6d=getName(_0x352f6d);return request({'method':_0x3f79('0x21'),'uri':_0x3f79('0x3e')+_0x16739d+_0x3f79('0x3f')+_['startCase'](_0x3a8a5b['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x352f6d[0x1],'First_Name':_0x352f6d[0x0],'Phone':_0x398cf8,'Owner':{'name':!_[_0x3f79('0x1a')](_0x3c9296[_0x3f79('0x40')][_0x3f79('0x17')])?_0x3c9296['role'][_0x3f79('0x17')]:!_[_0x3f79('0x1a')](_0x3c9296['first_name'])?_0x3c9296['first_name']+'\x20'+_0x3c9296[_0x3f79('0x41')]:_0x3c9296['last_name'],'id':_0x3c9296['id']}}]},'headers':{'Authorization':_0x3f79('0x2f')+_0xe9a580},'json':!![]})[_0x3f79('0x30')](function(_0x1fdd15){if(_0x1fdd15&&_0x1fdd15[_0x3f79('0x42')][0x0][_0x3f79('0x43')]===_0x3f79('0x44')){var _0x1a4f60=_0x1fdd15[_0x3f79('0x42')][0x0]['details'];_0x1a4f60[_0x3f79('0x3d')]=_[_0x3f79('0x45')](_0x3a8a5b['moduleCreate'])+'s';return _0x1a4f60;}logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0x3f79('0xd')](data));})[_0x3f79('0x28')](function(_0x2aa3b6){console[_0x3f79('0x46')](_0x3f79('0x47'),_0x2aa3b6);});}function getEndUser(_0x29ae44,_0x1f4c6b,_0x2031a0,_0x124711,_0xc8338f,_0x3b760c,_0x2972b1){var _0x3d08b0={'method':_0x3f79('0x2b'),'uri':'','headers':{'Authorization':_0x3f79('0x2f')+_0x29ae44},'json':!![]};switch(_0x2972b1[_0x3f79('0x48')]){case'contact_lead':_0x3d08b0[_0x3f79('0x49')]=_0x3f79('0x3e')+_0x1f4c6b+_0x3f79('0x4a')+_0xc8338f+'))';return getZohoUser(_0x3d08b0,_0x3f79('0x4b'))[_0x3f79('0x30')](function(_0x2a48a2){if(_0x2a48a2)return _0x2a48a2;_0x3d08b0[_0x3f79('0x49')]=_0x3f79('0x3e')+_0x1f4c6b+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0xc8338f+'))';return getZohoUser(_0x3d08b0,_0x3f79('0x4c'))['then'](function(_0x6db9ae){if(_0x6db9ae)return _0x6db9ae;if(_0x2972b1[_0x3f79('0x4d')]!=_0x3f79('0x4e')){return createEndUser(_0x29ae44,_0x1f4c6b,_0x124711,_0xc8338f,_0x3b760c,_0x2972b1);}else{return{};}});});break;case _0x3f79('0x4f'):_0x3d08b0[_0x3f79('0x49')]=_0x3f79('0x3e')+_0x1f4c6b+_0x3f79('0x4a')+_0xc8338f+'))';return getZohoUser(_0x3d08b0,_0x3f79('0x4b'))[_0x3f79('0x30')](function(_0x4c7695){if(_0x4c7695)return _0x4c7695;if(_0x2972b1[_0x3f79('0x4d')]!='nothing'){return createEndUser(_0x29ae44,_0x1f4c6b,_0x124711,_0xc8338f,_0x3b760c,_0x2972b1);}else{return{};}});break;case _0x3f79('0x50'):_0x3d08b0[_0x3f79('0x49')]=_0x3f79('0x3e')+_0x1f4c6b+_0x3f79('0x51')+_0xc8338f+'))';return getZohoUser(_0x3d08b0,_0x3f79('0x4c'))[_0x3f79('0x30')](function(_0x140d01){if(_0x140d01)return _0x140d01;if(_0x2972b1[_0x3f79('0x4d')]!=_0x3f79('0x4e')){return createEndUser(_0x29ae44,_0x1f4c6b,_0x124711,_0xc8338f,_0x3b760c,_0x2972b1);}else{return{};}});break;}}function getCall(_0x4169a3,_0x472666,_0xd280ab,_0x52e36e,_0x160586,_0x34d2d8,_0x168e96,_0x380d50){logger[_0x3f79('0x35')]('Creating\x20new\x20call...');var _0x10e323={};_0x10e323[_0x3f79('0x52')]={'name':!_[_0x3f79('0x1a')](_0x52e36e[_0x3f79('0x40')][_0x3f79('0x17')])&&!_[_0x3f79('0x1a')](_0x52e36e[_0x3f79('0x39')]['name'])&&_0x52e36e[_0x3f79('0x39')]['name']===_0x3f79('0x53')?_0x52e36e[_0x3f79('0x40')][_0x3f79('0x17')]:!_[_0x3f79('0x1a')](_0x52e36e['first_name'])?_0x52e36e[_0x3f79('0x54')]+'\x20'+_0x52e36e[_0x3f79('0x41')]:_0x52e36e['last_name'],'id':_0x52e36e['id']};_0x10e323[_0x3f79('0x55')]=intUtil[_0x3f79('0x56')](_0x34d2d8[_0x3f79('0x57')],_0x168e96,'\x20');_0x10e323[_0x3f79('0x58')]=intUtil['getString'](_0x34d2d8[_0x3f79('0x59')],_0x168e96,'\x0a');if(_0x160586['enduserType']==='Contacts'){_0x10e323[_0x3f79('0x5a')]={'name':!_[_0x3f79('0x1a')](_0x160586[_0x3f79('0x5b')])?_0x160586[_0x3f79('0x5b')]:!_[_0x3f79('0x1a')](_0x160586[_0x3f79('0x5c')])?_0x160586[_0x3f79('0x5c')]+'\x20'+_0x160586['Last_Name']:_0x160586[_0x3f79('0x5d')],'id':_0x160586['id']};}if(_0x160586[_0x3f79('0x3d')]===_0x3f79('0x4c')){_0x10e323[_0x3f79('0x5e')]={'name':!_[_0x3f79('0x1a')](_0x160586[_0x3f79('0x5b')])?_0x160586[_0x3f79('0x5b')]:!_[_0x3f79('0x1a')](_0x160586['First_Name'])?_0x160586[_0x3f79('0x5c')]+'\x20'+_0x160586[_0x3f79('0x5d')]:_0x160586[_0x3f79('0x5d')],'id':_0x160586['id']};_0x10e323['$se_module']=_[_0x3f79('0x45')](_0x160586['enduserType']);}if(_0x168e96[_0x3f79('0x5f')]){_0x10e323['Call_Duration']=moment[_0x3f79('0x60')](parseInt(_0x168e96['talktime'])*0x3e8)[_0x3f79('0x2c')]('mm:ss');}else if(_0x168e96['answertime']&&_0x168e96[_0x3f79('0x61')]){_0x10e323[_0x3f79('0x62')]=moment[_0x3f79('0x60')](moment(_0x168e96['endtime'],_0x3f79('0x63'))['diff'](moment(_0x168e96[_0x3f79('0x64')],'YYYY-MM-DDTHH:mm:ss')))[_0x3f79('0x2c')](_0x3f79('0x65'));}switch(_0x168e96[_0x3f79('0x66')]){case _0x3f79('0x67'):_0x10e323[_0x3f79('0x68')]=_0x3f79('0x69');break;case'complete':case _0x3f79('0x6a'):_0x10e323[_0x3f79('0x68')]=_0x3f79('0x6b');break;case _0x3f79('0x6c'):_0x10e323[_0x3f79('0x68')]=_0x3f79('0x6d');break;case _0x3f79('0x6e'):_0x10e323[_0x3f79('0x68')]=_0x3f79('0x6f');break;case _0x3f79('0x70'):_0x10e323[_0x3f79('0x68')]=_0x3f79('0x71');default:}_0x10e323[_0x3f79('0x72')]=(_0x380d50===_0x3f79('0x73')?moment(_0x168e96[_0x3f79('0x64')])[_0x3f79('0x2c')](_0x3f79('0x63')):moment(_0x168e96[_0x3f79('0x74')])[_0x3f79('0x2c')](_0x3f79('0x63')))||moment()[_0x3f79('0x2c')](_0x3f79('0x63'));_0x10e323[_0x3f79('0x75')]=_0x380d50||_0x3f79('0x76');_0x10e323=_['merge'](_0x10e323,getCustomFields(_0x34d2d8[_0x3f79('0x77')],_0x168e96));return request({'method':_0x3f79('0x21'),'uri':'https://www.zohoapis.'+_0x472666+_0x3f79('0x78'),'headers':{'Authorization':_0x3f79('0x2f')+_0x4169a3},'body':{'data':[_0x10e323]},'json':!![]})['then'](function(_0x3f4aa7){if(_0x3f4aa7&&_0x3f4aa7['data'][0x0][_0x3f79('0x43')]===_0x3f79('0x44')){logger['info'](_0x3f79('0x79'));return{'id':_0x3f4aa7['data'][0x0][_0x3f79('0x7a')]['id']};}})[_0x3f79('0x28')](function(_0x17f97c){logger['info'](_0x3f79('0x7b'),_0x17f97c[_0x3f79('0x2a')]);console[_0x3f79('0x46')](_0x3f79('0x7b'),_0x17f97c);});}exports['queue']=function(_0x5e2e7e,_0x22bdbc,_0x421f26,_0x4fd951,_0x2d99cc,_0x132060){var _0x2cecd5,_0x46fd20,_0x41c78e;_0x132060[_0x3f79('0x7c')]=intUtil[_0x3f79('0x7d')](_0x132060['host']);_0x132060[_0x3f79('0x7e')]=intUtil[_0x3f79('0x7d')](_0x132060[_0x3f79('0x7e')]);if(_0x2d99cc&&_0x2d99cc[_0x3f79('0x7f')]){logger[_0x3f79('0x35')]('[QUEUE]',_0x3f79('0x80'));_0x22bdbc['recordingURL']=_0x132060[_0x3f79('0x7e')]+'/api/voice/recordings/'+_0x22bdbc['uniqueid']+_0x3f79('0x81')+md5(_0x22bdbc[_0x3f79('0x82')]);}else{_0x22bdbc['recordingURL']='';}var _0x3fdd56=_0x132060['host']==='zoho.eu'?'eu':_0x3f79('0x83');return getAccessToken(_0x132060)[_0x3f79('0x30')](function(_0x578918){_0x41c78e=_0x578918;return getUser(_0x41c78e,_0x3fdd56,_0x132060,_0x4fd951[_0x3f79('0x34')]);})[_0x3f79('0x30')](function(_0xaa7fec){_0x2cecd5=_0xaa7fec;logger[_0x3f79('0x35')](_0x3f79('0x84'),_0x2cecd5['id']);return getEndUser(_0x41c78e,_0x3fdd56,_0x132060,_0x22bdbc[_0x3f79('0x85')],_0x22bdbc[_0x3f79('0x86')],_0x2cecd5,_0x421f26);})['then'](function(_0x436e4f){_0x46fd20=_0x436e4f;return getCall(_0x41c78e,_0x3fdd56,_0x132060,_0x2cecd5,_0x46fd20,_0x421f26,_0x22bdbc,_0x3f79('0x76'));})[_0x3f79('0x30')](function(_0x4876ce){if(_0x4876ce){logger[_0x3f79('0x35')](_0x3f79('0x87'),_0x4876ce['id']);logger[_0x3f79('0x35')](_0x3f79('0x88'),_0x3f79('0x89'));emit(util[_0x3f79('0x2c')](_0x3f79('0x8a'),_0x4fd951[_0x3f79('0x17')]),'trigger:browser:url',{'uri':_0x3f79('0x8b')+_0x132060[_0x3f79('0x7c')]+'/crm/EntityInfo.do?module=Calls&id='+_0x4876ce['id']});}})[_0x3f79('0x28')](function(_0x3223e0){logger[_0x3f79('0x29')](_0x3f79('0x88'),JSON[_0x3f79('0xd')](_0x3223e0));});};exports[_0x3f79('0x73')]=function(_0x34a043,_0x4a14a0,_0x3af74e,_0x474a9f,_0x3de798,_0x2b9dd5,_0x1768ed){var _0x5cfb80,_0x2a4158,_0x4c52ac;_0x2b9dd5[_0x3f79('0x7c')]=intUtil['stripTrailingSlash'](_0x2b9dd5[_0x3f79('0x7c')]);_0x2b9dd5[_0x3f79('0x7e')]=intUtil[_0x3f79('0x7d')](_0x2b9dd5['serverUrl']);if(_0x1768ed&&_0x1768ed['recordingFormat']&&_0x1768ed['recordingFormat']!==_0x3f79('0x8c')){logger[_0x3f79('0x35')](_0x3f79('0x8d'),_0x3f79('0x80'));_0x4a14a0[_0x3f79('0x8e')]=_0x2b9dd5['serverUrl']+_0x3f79('0x8f')+_0x4a14a0[_0x3f79('0x82')]+_0x3f79('0x81')+md5(_0x4a14a0[_0x3f79('0x82')]);}var _0x395d66=_0x2b9dd5[_0x3f79('0x7c')]==='zoho.eu'?'eu':_0x3f79('0x83');return getAccessToken(_0x2b9dd5)[_0x3f79('0x30')](function(_0x7ea41b){_0x4c52ac=_0x7ea41b;return getUser(_0x4c52ac,_0x395d66,_0x2b9dd5,_0x474a9f['email']);})[_0x3f79('0x30')](function(_0x2a38b1){_0x5cfb80=_0x2a38b1;logger[_0x3f79('0x35')](_0x3f79('0x84'),_0x5cfb80['id']);return getEndUser(_0x4c52ac,_0x395d66,_0x2b9dd5,_0x4a14a0[_0x3f79('0x90')],_0x4a14a0['destcalleridnum'],_0x5cfb80,_0x3af74e);})[_0x3f79('0x30')](function(_0x5ea178){_0x2a4158=_0x5ea178;return getCall(_0x4c52ac,_0x395d66,_0x2b9dd5,_0x5cfb80,_0x2a4158,_0x3af74e,_0x4a14a0,_0x3f79('0x91'));})[_0x3f79('0x30')](function(_0x466d7a){if(_0x466d7a){logger[_0x3f79('0x35')](_0x3f79('0x87'),_0x466d7a['id']);logger['info']('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x3f79('0x8a'),_0x474a9f['name']),'trigger:browser:url',{'uri':_0x3f79('0x8b')+_0x2b9dd5['host']+_0x3f79('0x92')+_0x466d7a['id']});}})[_0x3f79('0x28')](function(_0x298dff){logger[_0x3f79('0x29')](_0x3f79('0x8d'),JSON[_0x3f79('0xd')](_0x298dff));});};exports[_0x3f79('0x93')]=function(_0x59f92a,_0x4e5bc7,_0x3b8f97,_0x322ba1,_0x168165,_0x5a6e7f){var _0x1d4973,_0x11018c,_0x2f8a8f;_0x5a6e7f[_0x3f79('0x7c')]=intUtil[_0x3f79('0x7d')](_0x5a6e7f[_0x3f79('0x7c')]);_0x5a6e7f[_0x3f79('0x7e')]=intUtil[_0x3f79('0x7d')](_0x5a6e7f[_0x3f79('0x7e')]);if(_0x168165&&_0x168165[_0x3f79('0x7f')]){logger[_0x3f79('0x35')]('['+_0x4e5bc7[_0x3f79('0x66')][_0x3f79('0x94')]()+']',_0x3f79('0x80'));_0x4e5bc7[_0x3f79('0x8e')]=_0x5a6e7f[_0x3f79('0x7e')]+'/api/voice/recordings/'+_0x4e5bc7['uniqueid']+_0x3f79('0x81')+md5(_0x4e5bc7[_0x3f79('0x82')]);}else{_0x4e5bc7[_0x3f79('0x8e')]='';}var _0x58c3bb=_0x5a6e7f['host']===_0x3f79('0x95')?'eu':_0x3f79('0x83');return getAccessToken(_0x5a6e7f)[_0x3f79('0x30')](function(_0x24bfe6){_0x2f8a8f=_0x24bfe6;return getUser(_0x2f8a8f,_0x58c3bb,_0x5a6e7f);})[_0x3f79('0x30')](function(_0x2e6ff6){_0x1d4973=_0x2e6ff6;logger[_0x3f79('0x35')](_0x3f79('0x84'),_0x1d4973['id']);return getEndUser(_0x2f8a8f,_0x58c3bb,_0x5a6e7f,_0x4e5bc7[_0x3f79('0x85')],_0x4e5bc7[_0x3f79('0x86')],_0x1d4973,_0x3b8f97);})[_0x3f79('0x30')](function(_0x338183){_0x11018c=_0x338183;return getCall(_0x2f8a8f,_0x58c3bb,_0x5a6e7f,_0x1d4973,_0x11018c,_0x3b8f97,_0x4e5bc7,'Inbound');})[_0x3f79('0x30')](function(_0x37d8a5){if(_0x37d8a5){logger[_0x3f79('0x35')](_0x3f79('0x87'),_0x37d8a5['id']);}})[_0x3f79('0x28')](function(_0x3cdbc3){logger[_0x3f79('0x29')]('['+_0x4e5bc7[_0x3f79('0x66')][_0x3f79('0x94')]()+']',JSON[_0x3f79('0xd')](_0x3cdbc3));});}; \ No newline at end of file +var _0xa195=['stringify','forEach','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','data','code','SUCCESS','details','startCase','Error:\x20','catch','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','last_name','Subject','getString','Subjects','Description','Descriptions','Contacts','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','format','mm:ss','utc','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Called','complete','Call_Result','Answered','Rejected','abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','toUpperCase','lodash','request-promise','util','./util','ioredis','../../../../config/environment','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]'];(function(_0x401f03,_0x1cd361){var _0xd1e6f9=function(_0x2a51f2){while(--_0x2a51f2){_0x401f03['push'](_0x401f03['shift']());}};_0xd1e6f9(++_0x1cd361);}(_0xa195,0x1b2));var _0x5a19=function(_0x273301,_0x523bb8){_0x273301=_0x273301-0x0;var _0x27607d=_0xa195[_0x273301];return _0x27607d;};'use strict';var _=require(_0x5a19('0x0'));var rp=require(_0x5a19('0x1'));var md5=require('md5');var util=require(_0x5a19('0x2'));var intUtil=require(_0x5a19('0x3'));var moment=require('moment');var Redis=require(_0x5a19('0x4'));var BPromise=require('bluebird');var config=require(_0x5a19('0x5'));var logger=require('../../../../config/logger')(_0x5a19('0x6'));config[_0x5a19('0x7')]=_['defaults'](config[_0x5a19('0x7')],{'host':_0x5a19('0x8'),'port':0x18eb});var io=require(_0x5a19('0x9'))(new Redis(config[_0x5a19('0x7')]));function emit(_0x328c98,_0x17889c,_0x5c28bc){io['to'](_0x328c98)[_0x5a19('0xa')](_0x17889c,_0x5c28bc);}function request(_0x26e303){logger[_0x5a19('0xb')](_0x5a19('0xc'),JSON[_0x5a19('0xd')](_0x26e303));return rp(_0x26e303);}function getCustomFields(_0x46d8e7,_0x1e55a6){var _0x20c238={};if(_0x46d8e7['length']>0x0){_[_0x5a19('0xe')](_0x46d8e7,function(_0x24191f){if(_0x24191f[_0x5a19('0xf')]==='string'&&_0x24191f[_0x5a19('0x10')]){_0x20c238[_0x24191f['idField']]=_0x24191f[_0x5a19('0x11')][_0x5a19('0x12')]();}else if(_0x24191f['type']===_0x5a19('0x13')&&_0x24191f[_0x5a19('0x14')]&&_0x24191f[_0x5a19('0x10')]&&_0x1e55a6[_0x24191f[_0x5a19('0x14')]]){_0x20c238[_0x24191f['idField']]=_0x1e55a6[_0x24191f[_0x5a19('0x14')]][_0x5a19('0x12')]();}else if(_0x24191f[_0x5a19('0xf')]===_0x5a19('0x15')&&_0x24191f[_0x5a19('0x16')]&&_0x24191f['Variable']['name']&&_0x24191f[_0x5a19('0x10')]&&_0x1e55a6[_0x24191f[_0x5a19('0x16')][_0x5a19('0x17')][_0x5a19('0x18')]()]){_0x20c238[_0x24191f[_0x5a19('0x10')]]=_0x1e55a6[_0x24191f[_0x5a19('0x16')][_0x5a19('0x17')]['toLowerCase']()][_0x5a19('0x12')]();}});}return _0x20c238;}function getName(_0x46733f){if(_0x46733f['indexOf']('\x20')>0x0){var _0x36b3ac=_0x46733f[_0x5a19('0x19')](/ (.+)/);if(_0x36b3ac[0x1]){return _0x36b3ac;}}return[_0x46733f,_0x46733f];}var accountsTokens={};function getAccessToken(_0x47738f){return new Promise(function(_0x1d1b16,_0x44061f){if(!_[_0x5a19('0x1a')](accountsTokens[_0x47738f['id']])&&!_[_0x5a19('0x1a')](accountsTokens[_0x47738f['id']][_0x5a19('0x1b')])){if(moment()['isBefore'](accountsTokens[_0x47738f['id']][_0x5a19('0x1c')])){_0x1d1b16(accountsTokens[_0x47738f['id']][_0x5a19('0x1b')]);}}var _0x65efba;switch(_0x47738f[_0x5a19('0x1d')]){case'US':_0x65efba=_0x5a19('0x1e');break;case'AU':_0x65efba='https://accounts.zoho.com.au';break;case'EU':_0x65efba=_0x5a19('0x1f');break;case'IN':_0x65efba=_0x5a19('0x20');break;case'CN':_0x65efba=_0x5a19('0x21');break;default:_0x65efba='https://accounts.zoho.eu';break;}var _0x48f895={'method':_0x5a19('0x22'),'uri':_0x65efba+_0x5a19('0x23'),'qs':{'refresh_token':_0x47738f[_0x5a19('0x24')],'client_id':_0x47738f[_0x5a19('0x25')],'client_secret':_0x47738f[_0x5a19('0x26')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x48f895)[_0x5a19('0x27')](function(_0x2ab999){accountsTokens[_0x47738f['id']]={'access_token':_0x2ab999['access_token'],'expires_in':moment()[_0x5a19('0x28')](_0x2ab999[_0x5a19('0x1c')],'seconds')};_0x1d1b16(_0x2ab999[_0x5a19('0x1b')]);})['catch'](function(_0x1040af){logger[_0x5a19('0x29')](_0x5a19('0x2a'),_0x1040af[_0x5a19('0x2b')]);_0x44061f(_0x1040af);});});}function getUser(_0x68fbb7,_0x3c9aef,_0x25e724,_0x18ea07){logger['info'](_0x5a19('0x2c'));return request({'method':_0x5a19('0x2d'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x3c9aef),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x5a19('0x2e')+_0x68fbb7},'json':!![]})[_0x5a19('0x27')](function(_0x96b675){if(_0x96b675['users']){var _0x4e8c10=-0x1;if(_[_0x5a19('0x2f')](_0x96b675[_0x5a19('0x30')])){if(!_[_0x5a19('0x1a')](_0x18ea07)){_0x4e8c10=_[_0x5a19('0x31')](_0x96b675[_0x5a19('0x30')],function(_0x405967){return _0x405967[_0x5a19('0x32')]===_0x18ea07;});}if(_0x4e8c10>=0x0){logger[_0x5a19('0x33')](_0x5a19('0x34'));}else{logger['info'](_0x5a19('0x35'));_0x4e8c10=_['findIndex'](_0x96b675[_0x5a19('0x30')],function(_0x546c36){return _0x546c36[_0x5a19('0x36')][_0x5a19('0x17')]===_0x5a19('0x37');});}return _0x96b675[_0x5a19('0x30')][_0x4e8c10];}else{if(_0x96b675[_0x5a19('0x38')][_0x5a19('0x36')][_0x5a19('0x17')]==='Administrator'){logger[_0x5a19('0x33')]('Using\x20the\x20admin\x20account!');user=_0x96b675[_0x5a19('0x38')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x5a19('0xd')](_0x96b675));throw new Error(_0x5a19('0x39')+JSON[_0x5a19('0xd')](_0x96b675));}}}else{logger['error'](_0x5a19('0x3a'),JSON[_0x5a19('0xd')](_0x96b675));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x5a19('0xd')](_0x96b675));}})['catch'](function(_0x4fe605){console[_0x5a19('0x29')](_0x4fe605);});}function getZohoUser(_0x38d1a2,_0x1ffdfd){return new BPromise(function(_0x263951,_0x245c9f){request(_0x38d1a2)[_0x5a19('0x27')](function(_0x190002){var _0x29282c=null;if(_0x190002){_0x29282c=_0x190002['data'][0x0];_0x29282c[_0x5a19('0x3b')]=_0x1ffdfd;}_0x263951(_0x29282c);})['catch'](function(_0x43ddd8){_0x245c9f(_0x43ddd8);});});}function createEndUser(_0x23188e,_0x3a7ce0,_0x1478a5,_0x134890,_0x3ac723,_0x2882d8){var _0x1478a5=getName(_0x1478a5);return request({'method':_0x5a19('0x22'),'uri':_0x5a19('0x3c')+_0x3a7ce0+_0x5a19('0x3d')+_['startCase'](_0x2882d8[_0x5a19('0x3e')])+'s','body':{'data':[{'Last_Name':_0x1478a5[0x1],'First_Name':_0x1478a5[0x0],'Phone':_0x134890,'Owner':{'name':!_[_0x5a19('0x1a')](_0x3ac723['role'][_0x5a19('0x17')])?_0x3ac723[_0x5a19('0x3f')][_0x5a19('0x17')]:!_['isNil'](_0x3ac723[_0x5a19('0x40')])?_0x3ac723[_0x5a19('0x40')]+'\x20'+_0x3ac723['last_name']:_0x3ac723['last_name'],'id':_0x3ac723['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x23188e},'json':!![]})[_0x5a19('0x27')](function(_0x3b07d0){if(_0x3b07d0&&_0x3b07d0[_0x5a19('0x41')][0x0][_0x5a19('0x42')]===_0x5a19('0x43')){var _0x1f02b4=_0x3b07d0[_0x5a19('0x41')][0x0][_0x5a19('0x44')];_0x1f02b4[_0x5a19('0x3b')]=_[_0x5a19('0x45')](_0x2882d8[_0x5a19('0x3e')])+'s';return _0x1f02b4;}logger[_0x5a19('0x29')](_0x5a19('0x3a'),JSON[_0x5a19('0xd')](data));throw new Error(_0x5a19('0x46')+JSON[_0x5a19('0xd')](data));})[_0x5a19('0x47')](function(_0x5d9b53){console['log']('CREATE\x20ERROR',_0x5d9b53);});}function getEndUser(_0x12304f,_0x1337aa,_0x2a2121,_0x27bbec,_0x2ce111,_0x140755,_0x430258){var _0x48bb88={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x12304f},'json':!![]};switch(_0x430258[_0x5a19('0x48')]){case _0x5a19('0x49'):_0x48bb88[_0x5a19('0x4a')]=_0x5a19('0x3c')+_0x1337aa+_0x5a19('0x4b')+_0x2ce111+'))';return getZohoUser(_0x48bb88,'Contacts')[_0x5a19('0x27')](function(_0x2e6fbc){if(_0x2e6fbc)return _0x2e6fbc;_0x48bb88[_0x5a19('0x4a')]=_0x5a19('0x3c')+_0x1337aa+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2ce111+'))';return getZohoUser(_0x48bb88,_0x5a19('0x4c'))['then'](function(_0x1a6035){if(_0x1a6035)return _0x1a6035;if(_0x430258['moduleCreate']!=_0x5a19('0x4d')){return createEndUser(_0x12304f,_0x1337aa,_0x27bbec,_0x2ce111,_0x140755,_0x430258);}else{return{};}});});break;case _0x5a19('0x4e'):_0x48bb88[_0x5a19('0x4a')]='https://www.zohoapis.'+_0x1337aa+_0x5a19('0x4b')+_0x2ce111+'))';return getZohoUser(_0x48bb88,'Contacts')[_0x5a19('0x27')](function(_0x9fb163){if(_0x9fb163)return _0x9fb163;if(_0x430258[_0x5a19('0x3e')]!='nothing'){return createEndUser(_0x12304f,_0x1337aa,_0x27bbec,_0x2ce111,_0x140755,_0x430258);}else{return{};}});break;case _0x5a19('0x4f'):_0x48bb88[_0x5a19('0x4a')]=_0x5a19('0x3c')+_0x1337aa+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2ce111+'))';return getZohoUser(_0x48bb88,'Leads')[_0x5a19('0x27')](function(_0x1cd73e){if(_0x1cd73e)return _0x1cd73e;if(_0x430258[_0x5a19('0x3e')]!=_0x5a19('0x4d')){return createEndUser(_0x12304f,_0x1337aa,_0x27bbec,_0x2ce111,_0x140755,_0x430258);}else{return{};}});break;}}function getCall(_0x3acaa6,_0x52f989,_0x5ea1e5,_0x2dbf53,_0x29639e,_0x107111,_0x4eab2e,_0x157cc7){logger[_0x5a19('0x33')](_0x5a19('0x50'));var _0x33e2b7={};_0x33e2b7[_0x5a19('0x51')]={'name':!_['isNil'](_0x2dbf53[_0x5a19('0x3f')][_0x5a19('0x17')])&&!_[_0x5a19('0x1a')](_0x2dbf53[_0x5a19('0x36')][_0x5a19('0x17')])&&_0x2dbf53[_0x5a19('0x36')][_0x5a19('0x17')]===_0x5a19('0x52')?_0x2dbf53['role']['name']:!_[_0x5a19('0x1a')](_0x2dbf53[_0x5a19('0x40')])?_0x2dbf53[_0x5a19('0x40')]+'\x20'+_0x2dbf53[_0x5a19('0x53')]:_0x2dbf53[_0x5a19('0x53')],'id':_0x2dbf53['id']};_0x33e2b7[_0x5a19('0x54')]=intUtil[_0x5a19('0x55')](_0x107111[_0x5a19('0x56')],_0x4eab2e,'\x20');_0x33e2b7[_0x5a19('0x57')]=intUtil[_0x5a19('0x55')](_0x107111[_0x5a19('0x58')],_0x4eab2e,'\x0a');if(_0x29639e[_0x5a19('0x3b')]===_0x5a19('0x59')){_0x33e2b7[_0x5a19('0x5a')]={'name':!_[_0x5a19('0x1a')](_0x29639e[_0x5a19('0x5b')])?_0x29639e['Full_Name']:!_[_0x5a19('0x1a')](_0x29639e['First_Name'])?_0x29639e[_0x5a19('0x5c')]+'\x20'+_0x29639e[_0x5a19('0x5d')]:_0x29639e[_0x5a19('0x5d')],'id':_0x29639e['id']};}if(_0x29639e['enduserType']==='Leads'){_0x33e2b7[_0x5a19('0x5e')]={'name':!_['isNil'](_0x29639e[_0x5a19('0x5b')])?_0x29639e[_0x5a19('0x5b')]:!_[_0x5a19('0x1a')](_0x29639e['First_Name'])?_0x29639e[_0x5a19('0x5c')]+'\x20'+_0x29639e[_0x5a19('0x5d')]:_0x29639e['Last_Name'],'id':_0x29639e['id']};_0x33e2b7['$se_module']=_['startCase'](_0x29639e['enduserType']);}if(_0x4eab2e[_0x5a19('0x5f')]){_0x33e2b7[_0x5a19('0x60')]=moment['utc'](parseInt(_0x4eab2e[_0x5a19('0x5f')])*0x3e8)[_0x5a19('0x61')](_0x5a19('0x62'));}else if(_0x4eab2e['answertime']&&_0x4eab2e['endtime']){_0x33e2b7[_0x5a19('0x60')]=moment[_0x5a19('0x63')](moment(_0x4eab2e[_0x5a19('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0x5a19('0x65')](moment(_0x4eab2e[_0x5a19('0x66')],_0x5a19('0x67'))))['format'](_0x5a19('0x62'));}switch(_0x4eab2e[_0x5a19('0x68')]){case _0x5a19('0x69'):_0x33e2b7['Call_Result']=_0x5a19('0x6a');break;case _0x5a19('0x6b'):case'connect':_0x33e2b7[_0x5a19('0x6c')]=_0x5a19('0x6d');break;case'rejected':_0x33e2b7['Call_Result']=_0x5a19('0x6e');break;case _0x5a19('0x6f'):_0x33e2b7[_0x5a19('0x6c')]='Abandoned';break;case _0x5a19('0x70'):_0x33e2b7['Call_Result']='Timeout';default:}_0x33e2b7[_0x5a19('0x71')]=(_0x157cc7===_0x5a19('0x72')?moment(_0x4eab2e[_0x5a19('0x66')])[_0x5a19('0x61')](_0x5a19('0x67')):moment(_0x4eab2e[_0x5a19('0x73')])['format'](_0x5a19('0x67')))||moment()[_0x5a19('0x61')](_0x5a19('0x67'));_0x33e2b7['Call_Type']=_0x157cc7||_0x5a19('0x74');_0x33e2b7=_[_0x5a19('0x75')](_0x33e2b7,getCustomFields(_0x107111[_0x5a19('0x76')],_0x4eab2e));return request({'method':_0x5a19('0x22'),'uri':_0x5a19('0x3c')+_0x52f989+_0x5a19('0x77'),'headers':{'Authorization':_0x5a19('0x2e')+_0x3acaa6},'body':{'data':[_0x33e2b7]},'json':!![]})['then'](function(_0x93b4b7){if(_0x93b4b7&&_0x93b4b7[_0x5a19('0x41')][0x0][_0x5a19('0x42')]==='SUCCESS'){logger[_0x5a19('0x33')]('Call\x20created!');return{'id':_0x93b4b7['data'][0x0][_0x5a19('0x44')]['id']};}})[_0x5a19('0x47')](function(_0x10c292){logger[_0x5a19('0x33')](_0x5a19('0x78'),_0x10c292[_0x5a19('0x2b')]);console['log'](_0x5a19('0x78'),_0x10c292);});}exports[_0x5a19('0x79')]=function(_0x319eee,_0x435d3c,_0x4fa208,_0x21142c,_0xbada32,_0x8bdc72){var _0x3e1b9a,_0x1c8b70,_0x5b9d86;_0x8bdc72[_0x5a19('0x7a')]=intUtil['stripTrailingSlash'](_0x8bdc72[_0x5a19('0x7a')]);_0x8bdc72[_0x5a19('0x7b')]=intUtil[_0x5a19('0x7c')](_0x8bdc72[_0x5a19('0x7b')]);if(_0xbada32&&_0xbada32[_0x5a19('0x7d')]){logger[_0x5a19('0x33')](_0x5a19('0x7e'),_0x5a19('0x7f'));_0x435d3c[_0x5a19('0x80')]=_0x8bdc72[_0x5a19('0x7b')]+_0x5a19('0x81')+_0x435d3c[_0x5a19('0x82')]+_0x5a19('0x83')+md5(_0x435d3c[_0x5a19('0x82')]);}else{_0x435d3c[_0x5a19('0x80')]='';}var _0x4662ba=_0x8bdc72[_0x5a19('0x7a')]===_0x5a19('0x84')?'eu':_0x5a19('0x85');return getAccessToken(_0x8bdc72)['then'](function(_0x2d57f9){_0x5b9d86=_0x2d57f9;return getUser(_0x5b9d86,_0x4662ba,_0x8bdc72,_0x21142c[_0x5a19('0x32')]);})[_0x5a19('0x27')](function(_0x5014b4){_0x3e1b9a=_0x5014b4;logger[_0x5a19('0x33')](_0x5a19('0x86'),_0x3e1b9a['id']);return getEndUser(_0x5b9d86,_0x4662ba,_0x8bdc72,_0x435d3c[_0x5a19('0x87')],_0x435d3c['calleridnum'],_0x3e1b9a,_0x4fa208);})['then'](function(_0x336077){_0x1c8b70=_0x336077;return getCall(_0x5b9d86,_0x4662ba,_0x8bdc72,_0x3e1b9a,_0x1c8b70,_0x4fa208,_0x435d3c,_0x5a19('0x74'));})['then'](function(_0x521edf){if(_0x521edf){logger[_0x5a19('0x33')](_0x5a19('0x88'),_0x521edf['id']);logger['info'](_0x5a19('0x7e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5a19('0x61')](_0x5a19('0x89'),_0x21142c[_0x5a19('0x17')]),'trigger:browser:url',{'uri':_0x5a19('0x8a')+_0x8bdc72[_0x5a19('0x7a')]+_0x5a19('0x8b')+_0x521edf['id']});}})[_0x5a19('0x47')](function(_0x2aa6d0){logger[_0x5a19('0x29')](_0x5a19('0x7e'),JSON[_0x5a19('0xd')](_0x2aa6d0));});};exports[_0x5a19('0x72')]=function(_0x16f882,_0x4d40fb,_0x56d8c3,_0x34a729,_0x44ebe7,_0x42142d,_0xa287d4){var _0x1206eb,_0x46e8fb,_0x207874;_0x42142d['host']=intUtil[_0x5a19('0x7c')](_0x42142d[_0x5a19('0x7a')]);_0x42142d[_0x5a19('0x7b')]=intUtil[_0x5a19('0x7c')](_0x42142d[_0x5a19('0x7b')]);if(_0xa287d4&&_0xa287d4[_0x5a19('0x8c')]&&_0xa287d4['recordingFormat']!=='none'){logger[_0x5a19('0x33')]('[OUTBOUND]',_0x5a19('0x7f'));_0x4d40fb['recordingURL']=_0x42142d[_0x5a19('0x7b')]+_0x5a19('0x81')+_0x4d40fb['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x4d40fb['uniqueid']);}var _0x3729ef=_0x42142d['host']===_0x5a19('0x84')?'eu':_0x5a19('0x85');return getAccessToken(_0x42142d)[_0x5a19('0x27')](function(_0x5e39b0){_0x207874=_0x5e39b0;return getUser(_0x207874,_0x3729ef,_0x42142d,_0x34a729[_0x5a19('0x32')]);})[_0x5a19('0x27')](function(_0x2c8b4d){_0x1206eb=_0x2c8b4d;logger['info'](_0x5a19('0x86'),_0x1206eb['id']);return getEndUser(_0x207874,_0x3729ef,_0x42142d,_0x4d40fb[_0x5a19('0x8d')],_0x4d40fb[_0x5a19('0x8e')],_0x1206eb,_0x56d8c3);})[_0x5a19('0x27')](function(_0x626b37){_0x46e8fb=_0x626b37;return getCall(_0x207874,_0x3729ef,_0x42142d,_0x1206eb,_0x46e8fb,_0x56d8c3,_0x4d40fb,_0x5a19('0x8f'));})[_0x5a19('0x27')](function(_0x1626bd){if(_0x1626bd){logger[_0x5a19('0x33')](_0x5a19('0x88'),_0x1626bd['id']);logger[_0x5a19('0x33')](_0x5a19('0x90'),_0x5a19('0x91'));emit(util['format']('user:%s',_0x34a729[_0x5a19('0x17')]),_0x5a19('0x92'),{'uri':_0x5a19('0x8a')+_0x42142d[_0x5a19('0x7a')]+_0x5a19('0x8b')+_0x1626bd['id']});}})[_0x5a19('0x47')](function(_0x33257c){logger[_0x5a19('0x29')](_0x5a19('0x90'),JSON[_0x5a19('0xd')](_0x33257c));});};exports[_0x5a19('0x93')]=function(_0x224280,_0x159883,_0x59412e,_0x4f2781,_0x21349c,_0x4ca1fc){var _0x312f8f,_0x552822,_0x2be3cd;_0x4ca1fc[_0x5a19('0x7a')]=intUtil[_0x5a19('0x7c')](_0x4ca1fc['host']);_0x4ca1fc[_0x5a19('0x7b')]=intUtil[_0x5a19('0x7c')](_0x4ca1fc[_0x5a19('0x7b')]);if(_0x21349c&&_0x21349c[_0x5a19('0x7d')]){logger[_0x5a19('0x33')]('['+_0x159883['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x159883[_0x5a19('0x80')]=_0x4ca1fc[_0x5a19('0x7b')]+'/api/voice/recordings/'+_0x159883['uniqueid']+_0x5a19('0x83')+md5(_0x159883[_0x5a19('0x82')]);}else{_0x159883[_0x5a19('0x80')]='';}var _0x536bcf=_0x4ca1fc[_0x5a19('0x7a')]===_0x5a19('0x84')?'eu':_0x5a19('0x85');return getAccessToken(_0x4ca1fc)[_0x5a19('0x27')](function(_0x5dd169){_0x2be3cd=_0x5dd169;return getUser(_0x2be3cd,_0x536bcf,_0x4ca1fc);})[_0x5a19('0x27')](function(_0x57543e){_0x312f8f=_0x57543e;logger[_0x5a19('0x33')](_0x5a19('0x86'),_0x312f8f['id']);return getEndUser(_0x2be3cd,_0x536bcf,_0x4ca1fc,_0x159883[_0x5a19('0x87')],_0x159883['calleridnum'],_0x312f8f,_0x59412e);})['then'](function(_0x3b63be){_0x552822=_0x3b63be;return getCall(_0x2be3cd,_0x536bcf,_0x4ca1fc,_0x312f8f,_0x552822,_0x59412e,_0x159883,'Inbound');})[_0x5a19('0x27')](function(_0x290619){if(_0x290619){logger[_0x5a19('0x33')](_0x5a19('0x88'),_0x290619['id']);}})[_0x5a19('0x47')](function(_0x37b527){logger[_0x5a19('0x29')]('['+_0x159883[_0x5a19('0x68')][_0x5a19('0x94')]()+']',JSON[_0x5a19('0xd')](_0x37b527));});}; \ 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 cccddd5..f182ac5 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(_0x4b65cd,_0x3c7ab9){var _0x5af6fd=function(_0x3794b4){while(--_0x3794b4){_0x4b65cd['push'](_0x4b65cd['shift']());}};_0x5af6fd(++_0x3c7ab9);}(_0x7a54,0x106));var _0x47a5=function(_0x2122bf,_0x298942){_0x2122bf=_0x2122bf-0x0;var _0x17ae16=_0x7a54[_0x2122bf];return _0x17ae16;};'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(_0x168170,_0x1f8514){var _0x301582=function(_0x1767c8){while(--_0x1767c8){_0x168170['push'](_0x168170['shift']());}};_0x301582(++_0x1f8514);}(_0x7a54,0x106));var _0x47a5=function(_0xaf0f44,_0x1849ee){_0xaf0f44=_0xaf0f44-0x0;var _0x2df32c=_0x7a54[_0xaf0f44];return _0x2df32c;};'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 2e14981..72a0ad6 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x1bf9b0,_0x386849){var _0x4a73db=function(_0x551bd8){while(--_0x551bd8){_0x1bf9b0['push'](_0x1bf9b0['shift']());}};_0x4a73db(++_0x386849);}(_0x7a54,0x106));var _0x47a5=function(_0x1aff9b,_0x53eb95){_0x1aff9b=_0x1aff9b-0x0;var _0x3f5d51=_0x7a54[_0x1aff9b];return _0x3f5d51;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file +var _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(_0x57b6bb,_0x4f1ea6){var _0x39a128=function(_0x256c29){while(--_0x256c29){_0x57b6bb['push'](_0x57b6bb['shift']());}};_0x39a128(++_0x4f1ea6);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e1e25,_0xdc1421){_0x5e1e25=_0x5e1e25-0x0;var _0x548e5f=_0xb10b[_0x5e1e25];return _0x548e5f;};'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 diff --git a/server/services/email/client.js b/server/services/email/client.js index b3d2407..2de8bc2 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 _0x89fe=['http','Request','request','then','debug','error','rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x9f4560,_0x5976c0){var _0x5c8943=function(_0x3c93a3){while(--_0x3c93a3){_0x9f4560['push'](_0x9f4560['shift']());}};_0x5c8943(++_0x5976c0);}(_0x89fe,0x83));var _0xe89f=function(_0x407f9f,_0x2b7b48){_0x407f9f=_0x407f9f-0x0;var _0x30246=_0x89fe[_0x407f9f];return _0x30246;};'use strict';var jayson=require(_0xe89f('0x0'));var BPromise=require(_0xe89f('0x1'));var logger=require(_0xe89f('0x2'))(_0xe89f('0x3'));var client=jayson['client'][_0xe89f('0x4')]({'port':0x2329});client[_0xe89f('0x5')]=function(_0x580dce,_0x3d3aa8){return new BPromise(function(_0x3d8b30,_0x159e6b){return client[_0xe89f('0x6')](_0x580dce,_0x3d3aa8)[_0xe89f('0x7')](function(_0x2d5020){logger[_0xe89f('0x8')]('rpc',_0xe89f('0x3'),_0x580dce,_0x3d3aa8,_0x2d5020);if(_0x2d5020[_0xe89f('0x9')]){logger[_0xe89f('0x9')](_0xe89f('0xa'),_0xe89f('0x3'),_0x580dce,_0x2d5020['error'][_0xe89f('0xb')],_0x3d3aa8);return _0x159e6b(_0x2d5020[_0xe89f('0x9')][_0xe89f('0xb')]);}else{return _0x3d8b30(_0x2d5020[_0xe89f('0xc')]);}})[_0xe89f('0xd')](function(_0x104647){logger[_0xe89f('0x9')](_0xe89f('0xa'),_0xe89f('0x3'),_0x580dce,_0x104647,_0x3d3aa8);return _0x159e6b(_0x104647);});});};module[_0xe89f('0xe')]=client; \ No newline at end of file +var _0x49fe=['routing','message','result','exports','jayson/promise','bluebird','../../config/logger','http','then','debug','rpc','error'];(function(_0x3144ec,_0x10259d){var _0x26a508=function(_0xe91eba){while(--_0xe91eba){_0x3144ec['push'](_0x3144ec['shift']());}};_0x26a508(++_0x10259d);}(_0x49fe,0x100));var _0xe49f=function(_0x3d76d6,_0x4625d9){_0x3d76d6=_0x3d76d6-0x0;var _0x1f6a18=_0x49fe[_0x3d76d6];return _0x1f6a18;};'use strict';var jayson=require(_0xe49f('0x0'));var BPromise=require(_0xe49f('0x1'));var logger=require(_0xe49f('0x2'))('routing');var client=jayson['client'][_0xe49f('0x3')]({'port':0x2329});client['Request']=function(_0x195bcf,_0x199a0b){return new BPromise(function(_0xb0e197,_0x43c119){return client['request'](_0x195bcf,_0x199a0b)[_0xe49f('0x4')](function(_0x51fe70){logger[_0xe49f('0x5')](_0xe49f('0x6'),'routing',_0x195bcf,_0x199a0b,_0x51fe70);if(_0x51fe70[_0xe49f('0x7')]){logger[_0xe49f('0x7')](_0xe49f('0x6'),_0xe49f('0x8'),_0x195bcf,_0x51fe70[_0xe49f('0x7')]['message'],_0x199a0b);return _0x43c119(_0x51fe70['error'][_0xe49f('0x9')]);}else{return _0xb0e197(_0x51fe70[_0xe49f('0xa')]);}})['catch'](function(_0x51be71){logger[_0xe49f('0x7')](_0xe49f('0x6'),_0xe49f('0x8'),_0x195bcf,_0x51be71,_0x199a0b);return _0x43c119(_0x51be71);});});};module[_0xe49f('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index fe6b670..8e19eca 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 _0x644f=['./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch'];(function(_0x2721d6,_0x572143){var _0x3ff642=function(_0x108307){while(--_0x108307){_0x2721d6['push'](_0x2721d6['shift']());}};_0x3ff642(++_0x572143);}(_0x644f,0x177));var _0xf644=function(_0x596284,_0x1cd02b){_0x596284=_0x596284-0x0;var _0x5313c6=_0x644f[_0x596284];return _0x5313c6;};'use strict';var BPromise=require('bluebird');var server=require(_0xf644('0x0'));var Realtime=require(_0xf644('0x1'));var EmailChannel=require(_0xf644('0x2'));var mailAccount=require(_0xf644('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xf644('0x4'))['db'];function initRealtime(){return BPromise[_0xf644('0x5')]()[_0xf644('0x6')](mailAccount[_0xf644('0x7')]())[_0xf644('0x6')](realtime['initMailAccounts']())['then'](function(){email[_0xf644('0x8')](realtime[_0xf644('0x9')]);return realtime;});}function main(){return server[_0xf644('0xa')](realtime,email)['then'](function(_0x1f826a){return initRealtime();})[_0xf644('0x6')](function(_0x302671){return db[_0xf644('0xb')][_0xf644('0xc')]({'attributes':['id','loginMailFrequency'],'raw':!![]});})[_0xf644('0x6')](function(_0x21e90a){return setInterval(initRealtime,_0x21e90a[_0xf644('0xd')]*0x3e8);})[_0xf644('0xe')](function(_0x59d974){console['log'](_0x59d974);});}main(); \ No newline at end of file +var _0x8085=['catch','bluebird','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency'];(function(_0x385c76,_0xb97335){var _0x5c8367=function(_0xdfcd3){while(--_0xdfcd3){_0x385c76['push'](_0x385c76['shift']());}};_0x5c8367(++_0xb97335);}(_0x8085,0x71));var _0x5808=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x8085[_0x2283dc];return _0x16db90;};'use strict';var BPromise=require(_0x5808('0x0'));var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x5808('0x1'));var mailAccount=require(_0x5808('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x5808('0x3'))['db'];function initRealtime(){return BPromise[_0x5808('0x4')]()['then'](mailAccount['getMailAccounts']())[_0x5808('0x5')](realtime[_0x5808('0x6')]())['then'](function(){email[_0x5808('0x7')](realtime[_0x5808('0x8')]);return realtime;});}function main(){return server[_0x5808('0x9')](realtime,email)[_0x5808('0x5')](function(_0x2a9716){return initRealtime();})[_0x5808('0x5')](function(_0x30e63c){return db[_0x5808('0xa')][_0x5808('0xb')]({'attributes':['id',_0x5808('0xc')],'raw':!![]});})[_0x5808('0x5')](function(_0x422c41){return setInterval(initRealtime,_0x422c41[_0x5808('0xc')]*0x3e8);})[_0x5808('0xd')](function(_0x16d194){console['log'](_0x16d194);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 090c5c0..0026392 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 _0xfa44=['Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','catch','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','defaults','localhost','redis','./imap','mailAccounts','imapAccounts','name','key','active','Imap','status','messageStatus','total','stringify','emit','mailAccount:update','prototype','refresh','hasOwnProperty','handleImapBox','bind','end','error','handleImapError','isNil','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','then','info','Mail\x20accepted\x20from\x20routing'];(function(_0x34a5fa,_0x5deee4){var _0xb152a3=function(_0x2bbaf2){while(--_0x2bbaf2){_0x34a5fa['push'](_0x34a5fa['shift']());}};_0xb152a3(++_0x5deee4);}(_0xfa44,0x1df));var _0x4fa4=function(_0xa3400,_0x3a980a){_0xa3400=_0xa3400-0x0;var _0x33dba2=_0xfa44[_0xa3400];return _0x33dba2;};'use strict';var _=require(_0x4fa4('0x0'));var moment=require(_0x4fa4('0x1'));var BPromise=require(_0x4fa4('0x2'));var md5=require(_0x4fa4('0x3'));var Redis=require(_0x4fa4('0x4'));var config=require(_0x4fa4('0x5'));var logger=require(_0x4fa4('0x6'))(_0x4fa4('0x7'));config['redis']=_[_0x4fa4('0x8')](config['redis'],{'host':_0x4fa4('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4fa4('0xa')]));var EmailImap=require(_0x4fa4('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x2f79c8){logger['info']('start\x20email\x20channel');this[_0x4fa4('0xc')]=_0x2f79c8[_0x4fa4('0xc')];this[_0x4fa4('0xd')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x2c8cc1){var _0x5e725e=this[_0x4fa4('0xc')][_0x2c8cc1];var _0x2aac1e={'id':_0x5e725e['id'],'name':_0x5e725e[_0x4fa4('0xe')],'key':_0x5e725e[_0x4fa4('0xf')],'active':_0x5e725e[_0x4fa4('0x10')],'Imap':{'status':_0x5e725e[_0x4fa4('0x11')][_0x4fa4('0x12')],'messageStatus':_0x5e725e[_0x4fa4('0x11')][_0x4fa4('0x13')],'total':_0x5e725e['Imap'][_0x4fa4('0x14')]}};if(_['isNil'](md5Accounts[_0x2c8cc1])){md5Accounts[_0x2c8cc1]={};}var _0x4b2700=md5(JSON[_0x4fa4('0x15')](_0x2aac1e));if(md5Accounts[_0x2c8cc1][_0x4fa4('0x3')]!==_0x4b2700){md5Accounts[_0x2c8cc1][_0x4fa4('0x3')]=_0x4b2700;io[_0x4fa4('0x16')](_0x4fa4('0x17'),_0x2aac1e);}};EmailChannel[_0x4fa4('0x18')][_0x4fa4('0x19')]=function(_0xa99e9e){for(var _0x35a552 in _0xa99e9e){if(_0xa99e9e[_0x4fa4('0x1a')](_0x35a552)){if(_0xa99e9e[_0x35a552]['Imap']&&_0xa99e9e[_0x35a552][_0x4fa4('0x10')]){var _0x324c59=_0xa99e9e[_0x35a552][_0x4fa4('0x11')];if(!this[_0x4fa4('0xd')][_0x4fa4('0x1a')](_0x324c59['id'])){this['imapAccounts'][_0x324c59['id']]=new EmailImap(_0x324c59,_0xa99e9e[_0x35a552][_0x4fa4('0x7')]);this[_0x4fa4('0xd')][_0x324c59['id']]['on']('box',this[_0x4fa4('0x1b')][_0x4fa4('0x1c')](this,_0x35a552));this[_0x4fa4('0xd')][_0x324c59['id']]['on']('email',this['handleImapEmail']['bind'](this,_0x35a552));this[_0x4fa4('0xd')][_0x324c59['id']]['on'](_0x4fa4('0x1d'),this['handleImapEnd'][_0x4fa4('0x1c')](this,_0x35a552));this['imapAccounts'][_0x324c59['id']]['on'](_0x4fa4('0x1e'),this[_0x4fa4('0x1f')]['bind'](this,_0x35a552));}}else{if(_[_0x4fa4('0x20')](this['mailAccounts'][_0x35a552]['Imap'])){this[_0x4fa4('0xc')][_0x35a552][_0x4fa4('0x11')]={};}this[_0x4fa4('0xc')][_0x35a552][_0x4fa4('0x11')][_0x4fa4('0x12')]=_0x4fa4('0x21');this[_0x4fa4('0xc')][_0x35a552][_0x4fa4('0x11')][_0x4fa4('0x13')]='';this[_0x4fa4('0x16')](_0x35a552);}}}};EmailChannel[_0x4fa4('0x18')][_0x4fa4('0x1b')]=function(_0x4f20a0,_0x2fef86){if(this[_0x4fa4('0xc')][_0x4f20a0]){this['mailAccounts'][_0x4f20a0]['Imap']['status']='connected';this[_0x4fa4('0xc')][_0x4f20a0][_0x4fa4('0x11')]['messageStatus']=_0x2fef86['name'];if(_0x2fef86[_0x4fa4('0x22')]){this[_0x4fa4('0xc')][_0x4f20a0][_0x4fa4('0x11')]['total']=_0x2fef86[_0x4fa4('0x22')]['total'];}return this[_0x4fa4('0x16')](_0x4f20a0);}};EmailChannel[_0x4fa4('0x18')]['handleImapEmail']=function(_0x56e415,_0x5e01d0){logger['info'](_0x4fa4('0x23'),_0x5e01d0[_0x4fa4('0x24')],_0x5e01d0['lastName'],_0x5e01d0[_0x4fa4('0x25')],_0x56e415);if(this[_0x4fa4('0xc')][_0x56e415]){return mailAccount['notify'](_0x56e415,_0x5e01d0)[_0x4fa4('0x26')](function(_0x268b01){if(_0x268b01){logger[_0x4fa4('0x27')](_0x4fa4('0x28'));}})['catch'](function(_0x18bb54){logger[_0x4fa4('0x1e')](_0x4fa4('0x29'),JSON[_0x4fa4('0x15')](_0x18bb54));});}};EmailChannel[_0x4fa4('0x18')][_0x4fa4('0x2a')]=function(_0x1545dc){if(this[_0x4fa4('0xc')][_0x1545dc]&&this[_0x4fa4('0xc')][_0x1545dc]['Imap']){if(this[_0x4fa4('0xd')][this[_0x4fa4('0xc')][_0x1545dc][_0x4fa4('0x11')]['id']]){delete this[_0x4fa4('0xd')][this[_0x4fa4('0xc')][_0x1545dc][_0x4fa4('0x11')]['id']];}this['mailAccounts'][_0x1545dc][_0x4fa4('0x11')][_0x4fa4('0x2b')]=moment();this[_0x4fa4('0x16')](_0x1545dc);}};EmailChannel[_0x4fa4('0x18')][_0x4fa4('0x1f')]=function(_0x54a3a4,_0x570318){if(this[_0x4fa4('0xc')][_0x54a3a4]){this[_0x4fa4('0xc')][_0x54a3a4][_0x4fa4('0x11')][_0x4fa4('0x12')]='error';this[_0x4fa4('0xc')][_0x54a3a4][_0x4fa4('0x11')]['messageStatus']=_0x570318;return this[_0x4fa4('0x16')](_0x54a3a4);}};EmailChannel[_0x4fa4('0x18')][_0x4fa4('0x2c')]=function(_0x3edc42,_0x337c93){return this[_0x4fa4('0x2d')][_0x4fa4('0x2e')](_0x3edc42,_0x337c93);};EmailChannel[_0x4fa4('0x18')][_0x4fa4('0x2f')]=function(_0x8c277f){var _0x1f3310=this;if(this[_0x4fa4('0xc')][_0x8c277f['id']]){if(_[_0x4fa4('0x20')](this['mailAccounts'][_0x8c277f['id']]['Smtp'])){this[_0x4fa4('0xc')][_0x8c277f['id']][_0x4fa4('0x30')]={};}this[_0x4fa4('0xc')][_0x8c277f['id']][_0x4fa4('0x30')][_0x4fa4('0x2b')]=moment();return new BPromise(function(_0x3e8960,_0x25ced8){return _0x1f3310[_0x4fa4('0x2d')][_0x4fa4('0x31')](_0x8c277f)[_0x4fa4('0x26')](function(_0x5cd36c){_0x1f3310[_0x4fa4('0xc')][_0x8c277f['id']][_0x4fa4('0x30')][_0x4fa4('0x12')]=_0x4fa4('0x32');_0x1f3310[_0x4fa4('0xc')][_0x8c277f['id']][_0x4fa4('0x30')][_0x4fa4('0x13')]='';_0x1f3310[_0x4fa4('0x16')](_0x8c277f['id']);_0x3e8960(_0x5cd36c);})[_0x4fa4('0x33')](function(_0x122438){_0x1f3310[_0x4fa4('0xc')][_0x8c277f['id']][_0x4fa4('0x30')]['status']=_0x4fa4('0x1e');_0x1f3310['mailAccounts'][_0x8c277f['id']]['Smtp'][_0x4fa4('0x13')]=_0x122438;_0x1f3310[_0x4fa4('0x16')](_0x8c277f['id']);_0x25ced8(_0x122438);});});}return this[_0x4fa4('0x2d')][_0x4fa4('0x31')](_0x8c277f);};module['exports']=EmailChannel; \ No newline at end of file +var _0x2081=['hasOwnProperty','active','handleImapBox','email','handleImapEmail','bind','end','handleImapEnd','error','disabled','messageStatus','prototype','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','name','key','Imap','status','total','isNil','stringify','emit','mailAccount:update','refresh'];(function(_0x127ae8,_0x78f7f5){var _0x36a731=function(_0x545c4b){while(--_0x545c4b){_0x127ae8['push'](_0x127ae8['shift']());}};_0x36a731(++_0x78f7f5);}(_0x2081,0xc4));var _0x1208=function(_0x575057,_0x14baf3){_0x575057=_0x575057-0x0;var _0x49dbc8=_0x2081[_0x575057];return _0x49dbc8;};'use strict';var _=require(_0x1208('0x0'));var moment=require(_0x1208('0x1'));var BPromise=require(_0x1208('0x2'));var md5=require(_0x1208('0x3'));var Redis=require(_0x1208('0x4'));var config=require(_0x1208('0x5'));var logger=require('../../../config/logger')('email');config[_0x1208('0x6')]=_[_0x1208('0x7')](config['redis'],{'host':_0x1208('0x8'),'port':0x18eb});var io=require(_0x1208('0x9'))(new Redis(config[_0x1208('0x6')]));var EmailImap=require(_0x1208('0xa'));var EmailSmtp=require(_0x1208('0xb'));var mailAccount=require(_0x1208('0xc'));var md5Accounts={};function EmailChannel(_0x1a4729){logger[_0x1208('0xd')](_0x1208('0xe'));this[_0x1208('0xf')]=_0x1a4729[_0x1208('0xf')];this[_0x1208('0x10')]={};this[_0x1208('0x11')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x1922ef){var _0x44ff54=this[_0x1208('0xf')][_0x1922ef];var _0xcbeba7={'id':_0x44ff54['id'],'name':_0x44ff54[_0x1208('0x12')],'key':_0x44ff54[_0x1208('0x13')],'active':_0x44ff54['active'],'Imap':{'status':_0x44ff54[_0x1208('0x14')][_0x1208('0x15')],'messageStatus':_0x44ff54[_0x1208('0x14')]['messageStatus'],'total':_0x44ff54[_0x1208('0x14')][_0x1208('0x16')]}};if(_[_0x1208('0x17')](md5Accounts[_0x1922ef])){md5Accounts[_0x1922ef]={};}var _0x107a52=md5(JSON[_0x1208('0x18')](_0xcbeba7));if(md5Accounts[_0x1922ef][_0x1208('0x3')]!==_0x107a52){md5Accounts[_0x1922ef][_0x1208('0x3')]=_0x107a52;io[_0x1208('0x19')](_0x1208('0x1a'),_0xcbeba7);}};EmailChannel['prototype'][_0x1208('0x1b')]=function(_0x281c91){for(var _0x2fdacc in _0x281c91){if(_0x281c91[_0x1208('0x1c')](_0x2fdacc)){if(_0x281c91[_0x2fdacc]['Imap']&&_0x281c91[_0x2fdacc][_0x1208('0x1d')]){var _0x87326=_0x281c91[_0x2fdacc]['Imap'];if(!this[_0x1208('0x10')][_0x1208('0x1c')](_0x87326['id'])){this[_0x1208('0x10')][_0x87326['id']]=new EmailImap(_0x87326,_0x281c91[_0x2fdacc]['email']);this[_0x1208('0x10')][_0x87326['id']]['on']('box',this[_0x1208('0x1e')]['bind'](this,_0x2fdacc));this[_0x1208('0x10')][_0x87326['id']]['on'](_0x1208('0x1f'),this[_0x1208('0x20')][_0x1208('0x21')](this,_0x2fdacc));this[_0x1208('0x10')][_0x87326['id']]['on'](_0x1208('0x22'),this[_0x1208('0x23')][_0x1208('0x21')](this,_0x2fdacc));this[_0x1208('0x10')][_0x87326['id']]['on'](_0x1208('0x24'),this['handleImapError'][_0x1208('0x21')](this,_0x2fdacc));}}else{if(_[_0x1208('0x17')](this[_0x1208('0xf')][_0x2fdacc][_0x1208('0x14')])){this[_0x1208('0xf')][_0x2fdacc][_0x1208('0x14')]={};}this[_0x1208('0xf')][_0x2fdacc][_0x1208('0x14')][_0x1208('0x15')]=_0x1208('0x25');this[_0x1208('0xf')][_0x2fdacc][_0x1208('0x14')][_0x1208('0x26')]='';this['emit'](_0x2fdacc);}}}};EmailChannel[_0x1208('0x27')][_0x1208('0x1e')]=function(_0x1aeaa0,_0x453a6d){if(this[_0x1208('0xf')][_0x1aeaa0]){this[_0x1208('0xf')][_0x1aeaa0][_0x1208('0x14')][_0x1208('0x15')]=_0x1208('0x28');this['mailAccounts'][_0x1aeaa0][_0x1208('0x14')][_0x1208('0x26')]=_0x453a6d[_0x1208('0x12')];if(_0x453a6d[_0x1208('0x29')]){this[_0x1208('0xf')][_0x1aeaa0][_0x1208('0x14')]['total']=_0x453a6d[_0x1208('0x29')][_0x1208('0x16')];}return this[_0x1208('0x19')](_0x1aeaa0);}};EmailChannel['prototype'][_0x1208('0x20')]=function(_0x2a8d64,_0xa06c73){logger[_0x1208('0xd')](_0x1208('0x2a'),_0xa06c73[_0x1208('0x2b')],_0xa06c73['lastName'],_0xa06c73[_0x1208('0x2c')],_0x2a8d64);if(this[_0x1208('0xf')][_0x2a8d64]){return mailAccount[_0x1208('0x2d')](_0x2a8d64,_0xa06c73)[_0x1208('0x2e')](function(_0x41142a){if(_0x41142a){logger[_0x1208('0xd')](_0x1208('0x2f'));}})[_0x1208('0x30')](function(_0x1b4282){logger[_0x1208('0x24')](_0x1208('0x31'),JSON[_0x1208('0x18')](_0x1b4282));});}};EmailChannel['prototype'][_0x1208('0x23')]=function(_0x25e141){if(this[_0x1208('0xf')][_0x25e141]&&this['mailAccounts'][_0x25e141]['Imap']){if(this['imapAccounts'][this[_0x1208('0xf')][_0x25e141][_0x1208('0x14')]['id']]){delete this[_0x1208('0x10')][this[_0x1208('0xf')][_0x25e141][_0x1208('0x14')]['id']];}this['mailAccounts'][_0x25e141][_0x1208('0x14')][_0x1208('0x32')]=moment();this[_0x1208('0x19')](_0x25e141);}};EmailChannel[_0x1208('0x27')]['handleImapError']=function(_0x5ef5a7,_0x4d56a8){if(this['mailAccounts'][_0x5ef5a7]){this[_0x1208('0xf')][_0x5ef5a7][_0x1208('0x14')][_0x1208('0x15')]='error';this[_0x1208('0xf')][_0x5ef5a7]['Imap']['messageStatus']=_0x4d56a8;return this[_0x1208('0x19')](_0x5ef5a7);}};EmailChannel[_0x1208('0x27')][_0x1208('0x33')]=function(_0x3eaddf,_0x554ee1){return this['smtp']['send'](_0x3eaddf,_0x554ee1);};EmailChannel[_0x1208('0x27')][_0x1208('0x34')]=function(_0x1e8f5b){var _0x56efe3=this;if(this[_0x1208('0xf')][_0x1e8f5b['id']]){if(_[_0x1208('0x17')](this['mailAccounts'][_0x1e8f5b['id']]['Smtp'])){this['mailAccounts'][_0x1e8f5b['id']][_0x1208('0x35')]={};}this[_0x1208('0xf')][_0x1e8f5b['id']][_0x1208('0x35')][_0x1208('0x32')]=moment();return new BPromise(function(_0xf4419a,_0x4741b9){return _0x56efe3[_0x1208('0x11')][_0x1208('0x36')](_0x1e8f5b)[_0x1208('0x2e')](function(_0x38d408){_0x56efe3['mailAccounts'][_0x1e8f5b['id']][_0x1208('0x35')][_0x1208('0x15')]='verified';_0x56efe3[_0x1208('0xf')][_0x1e8f5b['id']]['Smtp'][_0x1208('0x26')]='';_0x56efe3['emit'](_0x1e8f5b['id']);_0xf4419a(_0x38d408);})[_0x1208('0x30')](function(_0xbe0474){_0x56efe3[_0x1208('0xf')][_0x1e8f5b['id']]['Smtp'][_0x1208('0x15')]=_0x1208('0x24');_0x56efe3[_0x1208('0xf')][_0x1e8f5b['id']][_0x1208('0x35')][_0x1208('0x26')]=_0xbe0474;_0x56efe3[_0x1208('0x19')](_0x1e8f5b['id']);_0x4741b9(_0xbe0474);});});}return this[_0x1208('0x11')][_0x1208('0x36')](_0x1e8f5b);};module[_0x1208('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 7bc9187..acbc2f3 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 _0x70e3=['error','handleError','connect','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','email','openBox','mailbox','handleOpenBox','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','end','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','imap','randomstring','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','INBOX','account','getAccount','once','handleReady','bind','handleEnd'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x70e3,0xae));var _0x370e=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x70e3[_0x164eca];return _0x2ce562;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0x370e('0x0'));var _=require('lodash');var rs=require(_0x370e('0x1'));var simpleParser=require('mailparser')[_0x370e('0x2')];var Iconv=require(_0x370e('0x3'))[_0x370e('0x4')];var EventEmitter=require('events')[_0x370e('0x5')];var utils=require(_0x370e('0x6'));var logger=require(_0x370e('0x7'))('email');function EmailImap(_0x1043cf,_0x45a78b){this['mailbox']=_0x370e('0x8');this[_0x370e('0x9')]=this[_0x370e('0xa')](_0x1043cf,_0x45a78b);this['imap']=new Imap(this[_0x370e('0x9')]);this[_0x370e('0x0')][_0x370e('0xb')]('ready',this[_0x370e('0xc')][_0x370e('0xd')](this));this['imap']['once']('end',this[_0x370e('0xe')]['bind'](this));this['imap']['on'](_0x370e('0xf'),this[_0x370e('0x10')]['bind'](this));this['imap'][_0x370e('0x11')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x370e('0x12')]['getAccount']=function(_0x21cc48,_0x575fe6){var _0x329cda={'connTimeout':_0x21cc48['connTimeout']?_0x21cc48[_0x370e('0x13')]*0x3e8:0x2710,'authTimeout':_0x21cc48[_0x370e('0x14')]?_0x21cc48['authTimeout']*0x3e8:0x1388};if(_[_0x370e('0x15')](_0x21cc48[_0x370e('0x16')])){if(_0x21cc48[_0x370e('0x17')]){_0x329cda[_0x370e('0x18')]=_0x21cc48[_0x370e('0x18')];_0x329cda[_0x370e('0x19')]=_0x21cc48[_0x370e('0x19')];}_0x329cda[_0x370e('0x1a')]=_0x21cc48['host'];_0x329cda[_0x370e('0x1b')]=_0x21cc48[_0x370e('0x1b')]||0x3e1;if(_0x21cc48[_0x370e('0x1c')]){_0x329cda[_0x370e('0x1c')]=!![];}else{_0x329cda[_0x370e('0x1c')]=![];_0x329cda[_0x370e('0x1d')]=_0x370e('0x1e');}}else{_0x329cda[_0x370e('0x18')]=_0x21cc48['user'];_0x329cda[_0x370e('0x19')]=_0x21cc48['password'];_0x329cda[_0x370e('0x1a')]=utils[_0x370e('0x1f')](_0x21cc48[_0x370e('0x16')]);_0x329cda[_0x370e('0x1b')]=0x3e1;_0x329cda[_0x370e('0x1c')]=!![];}_0x329cda[_0x370e('0x20')]=_0x575fe6||_0x21cc48[_0x370e('0x18')]||'anonymous@xcally.com';return _0x329cda;};EmailImap[_0x370e('0x12')][_0x370e('0xc')]=function(){this['imap'][_0x370e('0x21')](this[_0x370e('0x22')],![],this[_0x370e('0x23')][_0x370e('0xd')](this));};EmailImap[_0x370e('0x12')][_0x370e('0x23')]=function(_0x51f278,_0x3d841b){if(_0x51f278){this[_0x370e('0x10')](_0x51f278,!![]);}else{this['emit'](_0x370e('0x24'),_0x3d841b);this[_0x370e('0x25')]();}};EmailImap[_0x370e('0x12')][_0x370e('0x26')]=function(_0x46861f){if(_0x46861f){this[_0x370e('0x10')](_0x46861f,!![]);}else{this[_0x370e('0x0')]['end']();}};EmailImap['prototype']['readUnseen']=function(){this[_0x370e('0x0')][_0x370e('0x27')]([_0x370e('0x28')],this[_0x370e('0x29')][_0x370e('0xd')](this));};EmailImap[_0x370e('0x12')][_0x370e('0x29')]=function(_0x19d56d,_0x2fb8ed){if(_0x19d56d){this['handleError'](_0x19d56d,!![]);}else{if(_0x2fb8ed[_0x370e('0x2a')]){try{var _0x581328=this[_0x370e('0x0')][_0x370e('0x2b')](_0x2fb8ed,{'bodies':'','markSeen':!![]});_0x581328['on'](_0x370e('0x2c'),this['handleFetchMessage']['bind'](this));_0x581328['once'](_0x370e('0xf'),this[_0x370e('0x2d')]['bind'](this));_0x581328['once'](_0x370e('0x2e'),this[_0x370e('0x2f')][_0x370e('0xd')](this));}catch(_0x1ea0cc){logger[_0x370e('0xf')](_0x1ea0cc);}}else{this[_0x370e('0x0')][_0x370e('0x30')](!![],this[_0x370e('0x26')][_0x370e('0xd')](this));}}};EmailImap[_0x370e('0x12')][_0x370e('0x31')]=function(_0x4331e7,_0x629c79){_0x4331e7['on'](_0x370e('0x32'),this[_0x370e('0x33')][_0x370e('0xd')](this));_0x4331e7[_0x370e('0xb')](_0x370e('0x34'),this[_0x370e('0x35')][_0x370e('0xd')](this));_0x4331e7[_0x370e('0xb')]('end',this[_0x370e('0x36')][_0x370e('0xd')](this));};EmailImap['prototype'][_0x370e('0x33')]=function(_0x19c0f8,_0xb8a03b){simpleParser(_0x19c0f8,{'Iconv':Iconv},this[_0x370e('0x37')][_0x370e('0xd')](this));};EmailImap[_0x370e('0x12')][_0x370e('0x35')]=function(_0x32bca1){};EmailImap[_0x370e('0x12')][_0x370e('0x36')]=function(){};EmailImap[_0x370e('0x12')][_0x370e('0x37')]=function(_0xfa354f,_0x289d8b){if(_0xfa354f){logger['error'](_0xfa354f);}else{var _0x334991=this;utils[_0x370e('0x38')](this[_0x370e('0x9')],_0x289d8b,function(_0x8c8c31){_0x334991[_0x370e('0x39')]('email',_0x8c8c31);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0x370e('0x0')]['closeBox'](!![],this[_0x370e('0x26')]['bind'](this));};EmailImap[_0x370e('0x12')][_0x370e('0x2d')]=function(_0x2f831d){this[_0x370e('0x10')](_0x2f831d);this[_0x370e('0x0')][_0x370e('0x30')](!![],this[_0x370e('0x26')][_0x370e('0xd')](this));};EmailImap[_0x370e('0x12')]['handleEnd']=function(){this['emit'](_0x370e('0x2e'));};EmailImap['prototype'][_0x370e('0x10')]=function(_0x310474,_0x490978){logger['error'](_0x370e('0x10'),this[_0x370e('0x9')][_0x370e('0x20')],JSON[_0x370e('0x3a')](_0x310474));var _0x54ceba='';if(_0x310474){if(_0x310474['textCode']){_0x54ceba=_0x310474[_0x370e('0x3b')];}else{for(var _0x2e470a in _0x310474){if(_0x310474[_0x370e('0x3c')](_0x2e470a)){_0x54ceba+=_[_0x370e('0x3d')](_0x2e470a)+':\x20'+_0x310474[_0x2e470a]+'\x0a';}}}}if(_0x490978){this[_0x370e('0x0')][_0x370e('0x2e')]();}else{this[_0x370e('0x39')](_0x370e('0xf'),_0x54ceba);this['emit'](_0x370e('0x2e'));}};module[_0x370e('0x3e')]=EmailImap; \ No newline at end of file +var _0x2a4f=['length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','error','closeBox','handleCloseBox','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','account','emit','textCode','hasOwnProperty','upperFirst','exports','path','imap','lodash','mailparser','iconv','events','./utils','../../../config/logger','email','INBOX','getAccount','ready','handleReady','once','end','handleEnd','handleError','bind','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','openBox','handleOpenBox','box','readUnseen','search','handleReadUnseen'];(function(_0x2d6138,_0x219734){var _0x55eb00=function(_0xff8f6){while(--_0xff8f6){_0x2d6138['push'](_0x2d6138['shift']());}};_0x55eb00(++_0x219734);}(_0x2a4f,0xfd));var _0xf2a4=function(_0x43037d,_0x36c76f){_0x43037d=_0x43037d-0x0;var _0x13d7e6=_0x2a4f[_0x43037d];return _0x13d7e6;};'use strict';var fs=require('fs');var path=require(_0xf2a4('0x0'));var util=require('util');var Imap=require(_0xf2a4('0x1'));var _=require(_0xf2a4('0x2'));var rs=require('randomstring');var simpleParser=require(_0xf2a4('0x3'))['simpleParser'];var Iconv=require(_0xf2a4('0x4'))['Iconv'];var EventEmitter=require(_0xf2a4('0x5'))['EventEmitter'];var utils=require(_0xf2a4('0x6'));var logger=require(_0xf2a4('0x7'))(_0xf2a4('0x8'));function EmailImap(_0x3d7cfc,_0x5bb1f1){this['mailbox']=_0xf2a4('0x9');this['account']=this[_0xf2a4('0xa')](_0x3d7cfc,_0x5bb1f1);this[_0xf2a4('0x1')]=new Imap(this['account']);this[_0xf2a4('0x1')]['once'](_0xf2a4('0xb'),this[_0xf2a4('0xc')]['bind'](this));this[_0xf2a4('0x1')][_0xf2a4('0xd')](_0xf2a4('0xe'),this[_0xf2a4('0xf')]['bind'](this));this[_0xf2a4('0x1')]['on']('error',this[_0xf2a4('0x10')][_0xf2a4('0x11')](this));this[_0xf2a4('0x1')][_0xf2a4('0x12')]();}util[_0xf2a4('0x13')](EmailImap,EventEmitter);EmailImap[_0xf2a4('0x14')][_0xf2a4('0xa')]=function(_0x4e67a7,_0x5da05e){var _0x523a1c={'connTimeout':_0x4e67a7[_0xf2a4('0x15')]?_0x4e67a7['connTimeout']*0x3e8:0x2710,'authTimeout':_0x4e67a7[_0xf2a4('0x16')]?_0x4e67a7[_0xf2a4('0x16')]*0x3e8:0x1388};if(_[_0xf2a4('0x17')](_0x4e67a7[_0xf2a4('0x18')])){if(_0x4e67a7['authentication']){_0x523a1c[_0xf2a4('0x19')]=_0x4e67a7[_0xf2a4('0x19')];_0x523a1c[_0xf2a4('0x1a')]=_0x4e67a7[_0xf2a4('0x1a')];}_0x523a1c[_0xf2a4('0x1b')]=_0x4e67a7['host'];_0x523a1c[_0xf2a4('0x1c')]=_0x4e67a7[_0xf2a4('0x1c')]||0x3e1;if(_0x4e67a7[_0xf2a4('0x1d')]){_0x523a1c['tls']=!![];}else{_0x523a1c[_0xf2a4('0x1d')]=![];_0x523a1c[_0xf2a4('0x1e')]='required';}}else{_0x523a1c[_0xf2a4('0x19')]=_0x4e67a7[_0xf2a4('0x19')];_0x523a1c[_0xf2a4('0x1a')]=_0x4e67a7[_0xf2a4('0x1a')];_0x523a1c[_0xf2a4('0x1b')]=utils['getHost'](_0x4e67a7[_0xf2a4('0x18')]);_0x523a1c[_0xf2a4('0x1c')]=0x3e1;_0x523a1c[_0xf2a4('0x1d')]=!![];}_0x523a1c[_0xf2a4('0x8')]=_0x5da05e||_0x4e67a7['user']||'anonymous@xcally.com';return _0x523a1c;};EmailImap[_0xf2a4('0x14')][_0xf2a4('0xc')]=function(){this[_0xf2a4('0x1')][_0xf2a4('0x1f')](this['mailbox'],![],this[_0xf2a4('0x20')][_0xf2a4('0x11')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x5f6f21,_0x3665b4){if(_0x5f6f21){this[_0xf2a4('0x10')](_0x5f6f21,!![]);}else{this['emit'](_0xf2a4('0x21'),_0x3665b4);this['readUnseen']();}};EmailImap[_0xf2a4('0x14')]['handleCloseBox']=function(_0x1d4fd1){if(_0x1d4fd1){this[_0xf2a4('0x10')](_0x1d4fd1,!![]);}else{this[_0xf2a4('0x1')][_0xf2a4('0xe')]();}};EmailImap[_0xf2a4('0x14')][_0xf2a4('0x22')]=function(){this[_0xf2a4('0x1')][_0xf2a4('0x23')](['UNSEEN'],this[_0xf2a4('0x24')]['bind'](this));};EmailImap[_0xf2a4('0x14')][_0xf2a4('0x24')]=function(_0xf25c0f,_0x43f4b4){if(_0xf25c0f){this[_0xf2a4('0x10')](_0xf25c0f,!![]);}else{if(_0x43f4b4[_0xf2a4('0x25')]){try{var _0x50adeb=this['imap'][_0xf2a4('0x26')](_0x43f4b4,{'bodies':'','markSeen':!![]});_0x50adeb['on'](_0xf2a4('0x27'),this[_0xf2a4('0x28')][_0xf2a4('0x11')](this));_0x50adeb['once']('error',this[_0xf2a4('0x29')][_0xf2a4('0x11')](this));_0x50adeb['once']('end',this[_0xf2a4('0x2a')]['bind'](this));}catch(_0x80bc67){logger[_0xf2a4('0x2b')](_0x80bc67);}}else{this[_0xf2a4('0x1')][_0xf2a4('0x2c')](!![],this[_0xf2a4('0x2d')]['bind'](this));}}};EmailImap[_0xf2a4('0x14')][_0xf2a4('0x28')]=function(_0x429e37,_0x4a7a64){_0x429e37['on']('body',this[_0xf2a4('0x2e')][_0xf2a4('0x11')](this));_0x429e37['once'](_0xf2a4('0x2f'),this[_0xf2a4('0x30')][_0xf2a4('0x11')](this));_0x429e37[_0xf2a4('0xd')](_0xf2a4('0xe'),this['handleMessageEnd']['bind'](this));};EmailImap[_0xf2a4('0x14')][_0xf2a4('0x2e')]=function(_0x35f65b,_0x28a881){simpleParser(_0x35f65b,{'Iconv':Iconv},this[_0xf2a4('0x31')][_0xf2a4('0x11')](this));};EmailImap[_0xf2a4('0x14')]['handleMessageAttributes']=function(_0x2c99df){};EmailImap[_0xf2a4('0x14')][_0xf2a4('0x32')]=function(){};EmailImap[_0xf2a4('0x14')]['handleSimpleParser']=function(_0x27b3e8,_0xbf61f9){if(_0x27b3e8){logger[_0xf2a4('0x2b')](_0x27b3e8);}else{var _0x466d9d=this;utils[_0xf2a4('0x33')](this[_0xf2a4('0x34')],_0xbf61f9,function(_0x5ec2b4){_0x466d9d['emit'](_0xf2a4('0x8'),_0x5ec2b4);});}};EmailImap['prototype'][_0xf2a4('0x2a')]=function(){this[_0xf2a4('0x1')][_0xf2a4('0x2c')](!![],this['handleCloseBox'][_0xf2a4('0x11')](this));};EmailImap[_0xf2a4('0x14')][_0xf2a4('0x29')]=function(_0x1bb4f1){this[_0xf2a4('0x10')](_0x1bb4f1);this[_0xf2a4('0x1')][_0xf2a4('0x2c')](!![],this[_0xf2a4('0x2d')]['bind'](this));};EmailImap[_0xf2a4('0x14')][_0xf2a4('0xf')]=function(){this[_0xf2a4('0x35')]('end');};EmailImap['prototype'][_0xf2a4('0x10')]=function(_0x62eb18,_0x2840e1){logger[_0xf2a4('0x2b')]('handleError',this[_0xf2a4('0x34')]['email'],JSON['stringify'](_0x62eb18));var _0x3e9d79='';if(_0x62eb18){if(_0x62eb18[_0xf2a4('0x36')]){_0x3e9d79=_0x62eb18[_0xf2a4('0x36')];}else{for(var _0x1a6834 in _0x62eb18){if(_0x62eb18[_0xf2a4('0x37')](_0x1a6834)){_0x3e9d79+=_[_0xf2a4('0x38')](_0x1a6834)+':\x20'+_0x62eb18[_0x1a6834]+'\x0a';}}}}if(_0x2840e1){this[_0xf2a4('0x1')][_0xf2a4('0xe')]();}else{this[_0xf2a4('0x35')](_0xf2a4('0x2b'),_0x3e9d79);this[_0xf2a4('0x35')]('end');}};module[_0xf2a4('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 1c7b1ca..a58200a 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 _0x7838=['exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','verify','toString','Not\x20verifired'];(function(_0x424b56,_0x10cb4f){var _0x4a982c=function(_0x225ec3){while(--_0x225ec3){_0x424b56['push'](_0x424b56['shift']());}};_0x4a982c(++_0x10cb4f);}(_0x7838,0x1b1));var _0x8783=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x7838[_0x376b45];return _0x2341b3;};'use strict';var nodemailer=require(_0x8783('0x0'));var BPromise=require(_0x8783('0x1'));var inlineBase64=require(_0x8783('0x2'));function EmailSmtp(){}EmailSmtp[_0x8783('0x3')][_0x8783('0x4')]=function(_0x54139d,_0x30cb7a){return new BPromise(function(_0xc4e3,_0x4a1830){var _0x433ee0=nodemailer[_0x8783('0x5')](_0x54139d);_0x433ee0[_0x8783('0x6')](_0x8783('0x7'),inlineBase64());_0x433ee0['sendMail'](_0x30cb7a,function(_0x21ae83,_0xac9431){if(_0x21ae83){_0x4a1830(_0x21ae83['toString']());}else{_0xc4e3(_0xac9431);}});});};EmailSmtp['prototype'][_0x8783('0x8')]=function(_0x24b386){return new BPromise(function(_0x1ffb32,_0x198856){var _0x59789e=nodemailer[_0x8783('0x5')](_0x24b386);_0x59789e['verify'](function(_0xe5dba,_0x307a27){if(_0xe5dba){_0x198856(_0xe5dba[_0x8783('0x9')]());}else{if(_0x307a27){_0x1ffb32(_0x307a27);}else{_0x198856(_0x8783('0xa'));}}});});};module[_0x8783('0xb')]=EmailSmtp; \ No newline at end of file +var _0xd616=['verify','toString','Not\x20verifired','exports','bluebird','prototype','send','createTransport','use','sendMail'];(function(_0x162440,_0x1cce48){var _0x14fe6d=function(_0x55fae3){while(--_0x55fae3){_0x162440['push'](_0x162440['shift']());}};_0x14fe6d(++_0x1cce48);}(_0xd616,0x90));var _0x6d61=function(_0x529f1c,_0x437ed1){_0x529f1c=_0x529f1c-0x0;var _0x4d57ab=_0xd616[_0x529f1c];return _0x4d57ab;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x6d61('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x6d61('0x1')][_0x6d61('0x2')]=function(_0x285740,_0x55c1ad){return new BPromise(function(_0x5a4a22,_0x2711b5){var _0xa816b2=nodemailer[_0x6d61('0x3')](_0x285740);_0xa816b2[_0x6d61('0x4')]('compile',inlineBase64());_0xa816b2[_0x6d61('0x5')](_0x55c1ad,function(_0x32c4cc,_0x489a20){if(_0x32c4cc){_0x2711b5(_0x32c4cc['toString']());}else{_0x5a4a22(_0x489a20);}});});};EmailSmtp[_0x6d61('0x1')][_0x6d61('0x6')]=function(_0x55308a){return new BPromise(function(_0x3577e9,_0x19f835){var _0x1c37d6=nodemailer[_0x6d61('0x3')](_0x55308a);_0x1c37d6[_0x6d61('0x6')](function(_0x1af252,_0x2bfa52){if(_0x1af252){_0x19f835(_0x1af252[_0x6d61('0x7')]());}else{if(_0x2bfa52){_0x3577e9(_0x2bfa52);}else{_0x19f835(_0x6d61('0x8'));}}});});};module[_0x6d61('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 99f237d..8de8a51 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 _0x20f8=['format','%s-%s','now','root','server/files/attachments/','content','push','contentType','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','Attachments','Data','getHost','gmail','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','split','slice','join','name','Anonymous','pop','length','isEmpty','@xcally.com','html','replace','body','message','originTo','includes','originCc','bcc','attachments','attach','type','attachment','filename','attachment-'];(function(_0x510759,_0x5a53ea){var _0x484be6=function(_0x55e5c2){while(--_0x55e5c2){_0x510759['push'](_0x510759['shift']());}};_0x484be6(++_0x5a53ea);}(_0x20f8,0x9c));var _0x820f=function(_0x23e828,_0x16f975){_0x23e828=_0x23e828-0x0;var _0x4f90df=_0x20f8[_0x23e828];return _0x4f90df;};'use strict';var _=require(_0x820f('0x0'));var moment=require(_0x820f('0x1'));var random=require(_0x820f('0x2'));var fs=require('fs');var path=require(_0x820f('0x3'));var util=require(_0x820f('0x4'));var tnef=require(_0x820f('0x5'));var logger=require(_0x820f('0x6'))(_0x820f('0x7'));var config=require('../../../config/environment');function getAddress(_0x568a43){var _0x2ddbbc=_[_0x820f('0x8')](_0x568a43[_0x820f('0x9')]);return _0x2ddbbc&&_0x2ddbbc[_0x820f('0xa')]?_0x2ddbbc['address']:_0x820f('0xb')+random[_0x820f('0xc')](0x6)+'@xcally.com';}function getFirstName(_0x230712){var _0x3e65c9=_[_0x820f('0x8')](_0x230712[_0x820f('0x9')]);if(_0x3e65c9&&_0x3e65c9['name']){var _0x435010=_0x3e65c9['name'][_0x820f('0xd')](/\s+/);return _0x435010['length']?_0x435010[_0x820f('0xe')](0x0,-0x1)[_0x820f('0xf')]('\x20'):_0x3e65c9[_0x820f('0x10')];}return _0x820f('0x11');}function getLastName(_0x298ef5){var _0x91164d=_[_0x820f('0x8')](_0x298ef5[_0x820f('0x9')]);if(_0x91164d&&_0x91164d[_0x820f('0x10')]){var _0x261aeb=_0x91164d[_0x820f('0x10')][_0x820f('0xd')](/\s+/);return _0x261aeb['length']>0x1?_0x261aeb[_0x820f('0x12')]():'';}return'';}function getMails(_0x14e263,_0x3ffe77){var _0x2d67a3='';for(var _0x5515f7=0x0;_0x5515f7<_0x3ffe77[_0x820f('0x9')][_0x820f('0x13')];_0x5515f7+=0x1){if(_0x3ffe77['value'][_0x5515f7][_0x820f('0xa')]!==_0x14e263){if(!_[_0x820f('0x14')](_0x2d67a3)){_0x2d67a3+=',';}_0x2d67a3+=_0x3ffe77['value'][_0x5515f7][_0x820f('0x10')]||_0x3ffe77[_0x820f('0x9')][_0x5515f7][_0x820f('0xa')]||'';_0x2d67a3+='\x20<';_0x2d67a3+=_0x3ffe77['value'][_0x5515f7]['address']?_0x3ffe77[_0x820f('0x9')][_0x5515f7]['address']:_0x820f('0xb')+random[_0x820f('0xc')](0x6)+_0x820f('0x15');_0x2d67a3+='>';}}return _0x2d67a3;}function parseEmail(_0x4973e5,_0x11a2b3,_0x381aa3){if(_0x11a2b3[_0x820f('0x16')]){var _0x22bfa3=/)<[^<]*)*<\/script>/gi;while(_0x22bfa3['test'](_0x11a2b3['html'])){_0x11a2b3[_0x820f('0x16')]=_0x11a2b3[_0x820f('0x16')][_0x820f('0x17')](_0x22bfa3,'');}_0x381aa3[_0x820f('0x18')]=_0x11a2b3['html'];}else{_0x381aa3['body']=_0x11a2b3['textAsHtml'];}if(_0x381aa3[_0x820f('0x18')]){_0x381aa3[_0x820f('0x18')]=_0x381aa3[_0x820f('0x18')]['replace'](/Empty\x20message

';if(_0x54dbcc[_0x820f('0x38')]){for(var _0x4337b1=0x0;_0x4337b1<_0x54dbcc['Attachments'][_0x820f('0x13')];_0x4337b1++){var _0x5540a7=_0x54dbcc['Attachments'][_0x4337b1];_0x12606c['message'][_0x820f('0x1e')][_0x820f('0x2a')]({'filename':_0x5540a7['Title'],'content':new Buffer(_0x5540a7[_0x820f('0x39')])});}}}_0x34a11a(parseEmail(_0x2248ce,_0x3686d5,_0x12606c));});}else{_0x3686d5[_0x820f('0x16')]='

Empty\x20message

';_0x34a11a(parseEmail(_0x2248ce,_0x3686d5,_0x12606c));}}else{_0x34a11a(parseEmail(_0x2248ce,_0x3686d5,_0x12606c));}};exports[_0x820f('0x3a')]=function(_0x514499){switch(_0x514499){case _0x820f('0x3b'):return'imap.gmail.com';case'yahoo':return'imap.mail.yahoo.com';case _0x820f('0x3c'):return _0x820f('0x3d');case _0x820f('0x3e'):return'outlook.office365.com';}return _0x820f('0x3f');}; \ No newline at end of file +var _0x894f=['attachment-','%s-%s','now','root','server/files/attachments/','writeFileSync','content','push','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','info','format','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','util','node-tnef','../../../config/logger','email','../../../config/environment','address','anonymous','generate','value','name','slice','join','Anonymous','head','length','pop','isEmpty','@xcally.com','html','replace','body','message','originTo','includes','originCc','bcc','attachments','type','filename'];(function(_0x3aa0fa,_0x2023d7){var _0x459755=function(_0x53a393){while(--_0x53a393){_0x3aa0fa['push'](_0x3aa0fa['shift']());}};_0x459755(++_0x2023d7);}(_0x894f,0x1a1));var _0xf894=function(_0x31bcff,_0x3ac346){_0x31bcff=_0x31bcff-0x0;var _0x2fd754=_0x894f[_0x31bcff];return _0x2fd754;};'use strict';var _=require(_0xf894('0x0'));var moment=require(_0xf894('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0xf894('0x2'));var tnef=require(_0xf894('0x3'));var logger=require(_0xf894('0x4'))(_0xf894('0x5'));var config=require(_0xf894('0x6'));function getAddress(_0xbdf94d){var _0x82fa3a=_['head'](_0xbdf94d['value']);return _0x82fa3a&&_0x82fa3a[_0xf894('0x7')]?_0x82fa3a[_0xf894('0x7')]:_0xf894('0x8')+random[_0xf894('0x9')](0x6)+'@xcally.com';}function getFirstName(_0x5deb77){var _0x4d3861=_['head'](_0x5deb77[_0xf894('0xa')]);if(_0x4d3861&&_0x4d3861[_0xf894('0xb')]){var _0xaafe53=_0x4d3861['name']['split'](/\s+/);return _0xaafe53['length']?_0xaafe53[_0xf894('0xc')](0x0,-0x1)[_0xf894('0xd')]('\x20'):_0x4d3861['name'];}return _0xf894('0xe');}function getLastName(_0x4f4c72){var _0x2610c1=_[_0xf894('0xf')](_0x4f4c72['value']);if(_0x2610c1&&_0x2610c1['name']){var _0x58da5d=_0x2610c1[_0xf894('0xb')]['split'](/\s+/);return _0x58da5d[_0xf894('0x10')]>0x1?_0x58da5d[_0xf894('0x11')]():'';}return'';}function getMails(_0x343c68,_0x45a866){var _0x889533='';for(var _0x44dfaa=0x0;_0x44dfaa<_0x45a866[_0xf894('0xa')][_0xf894('0x10')];_0x44dfaa+=0x1){if(_0x45a866[_0xf894('0xa')][_0x44dfaa][_0xf894('0x7')]!==_0x343c68){if(!_[_0xf894('0x12')](_0x889533)){_0x889533+=',';}_0x889533+=_0x45a866[_0xf894('0xa')][_0x44dfaa][_0xf894('0xb')]||_0x45a866[_0xf894('0xa')][_0x44dfaa]['address']||'';_0x889533+='\x20<';_0x889533+=_0x45a866[_0xf894('0xa')][_0x44dfaa][_0xf894('0x7')]?_0x45a866[_0xf894('0xa')][_0x44dfaa][_0xf894('0x7')]:_0xf894('0x8')+random['generate'](0x6)+_0xf894('0x13');_0x889533+='>';}}return _0x889533;}function parseEmail(_0xca15b4,_0x4d3681,_0x24d32d){if(_0x4d3681[_0xf894('0x14')]){var _0x111dc8=/)<[^<]*)*<\/script>/gi;while(_0x111dc8['test'](_0x4d3681['html'])){_0x4d3681[_0xf894('0x14')]=_0x4d3681[_0xf894('0x14')][_0xf894('0x15')](_0x111dc8,'');}_0x24d32d[_0xf894('0x16')]=_0x4d3681[_0xf894('0x14')];}else{_0x24d32d[_0xf894('0x16')]=_0x4d3681['textAsHtml'];}if(_0x24d32d[_0xf894('0x16')]){_0x24d32d[_0xf894('0x16')]=_0x24d32d[_0xf894('0x16')][_0xf894('0x15')](/0x0){if(this[_0x14bb50+_0xfb2a('0x27')]>0x0&&this[_0x14bb50+_0xfb2a('0x26')]>=this[_0x14bb50+_0xfb2a('0x27')]){return _0xfb2a('0x28');}else{return _0xfb2a('0x29');}}else{return _0xfb2a('0x2a');}};Agent[_0xfb2a('0x2b')]['updateRealtime']=function(){var _0x3115f2=['mail',_0xfb2a('0x2c'),_0xfb2a('0x2d'),'fax',_0xfb2a('0x2e'),_0xfb2a('0x2f')];for(var _0x4eb16e=0x0;_0x4eb16e<_0x3115f2[_0xfb2a('0x30')];_0x4eb16e+=0x1){var _0x388bfe=this['getChannelStatus'](_0x3115f2[_0x4eb16e]);if(this[_0x3115f2[_0x4eb16e]+_0xfb2a('0x31')]!==_0x388bfe){this[_0x3115f2[_0x4eb16e]+_0xfb2a('0x32')]=_[_0xfb2a('0x33')](moment()[_0xfb2a('0x34')]('x'));}this[_0x3115f2[_0x4eb16e]+_0xfb2a('0x31')]=_0x388bfe;}var _0x3b0d65={'id':this['id'],'name':this[_0xfb2a('0x8')],'online':this[_0xfb2a('0x9')],'voicePause':this[_0xfb2a('0xa')],'chatPause':this[_0xfb2a('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0xfb2a('0xe')],'faxPause':this[_0xfb2a('0xd')],'openchannelPause':this[_0xfb2a('0xf')],'chatStatus':this[_0xfb2a('0x10')],'chatStatusTime':this[_0xfb2a('0x12')],'chatCapacity':this[_0xfb2a('0x35')],'chatCurrentCapacity':this[_0xfb2a('0x36')],'mailStatus':this[_0xfb2a('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xfb2a('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xfb2a('0x17')],'faxCapacity':this[_0xfb2a('0x37')],'faxCurrentCapacity':this[_0xfb2a('0x18')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xfb2a('0x1a')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xfb2a('0x1c')],'whatsappStatus':this[_0xfb2a('0x1d')],'whatsappStatusTime':this[_0xfb2a('0x38')],'whatsappCapacity':this[_0xfb2a('0x1e')],'whatsappCurrentCapacity':this[_0xfb2a('0x1f')],'openchannelStatus':this[_0xfb2a('0x20')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xfb2a('0x23')],'busy':this[_0xfb2a('0x24')],'busyQueue':this['busyQueue']};var _0x4b6e4d=md5(JSON[_0xfb2a('0x39')](_0x3b0d65));if(this[_0xfb2a('0x2')]!==_0x4b6e4d){this[_0xfb2a('0x2')]=_0x4b6e4d;io[_0xfb2a('0x3a')](_0xfb2a('0x3b'),_0x3b0d65);}};module[_0xfb2a('0x3c')]=Agent; \ No newline at end of file +var _0x63c6=['whatsapp','length','Status','toNumber','chatStatusTime','mailStatus','stringify','emit','user:save','exports','lodash','moment','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','md5','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','mail','chat','openchannel','sms'];(function(_0x30b159,_0x3fbb50){var _0x23c3f9=function(_0xa21305){while(--_0xa21305){_0x30b159['push'](_0x30b159['shift']());}};_0x23c3f9(++_0x3fbb50);}(_0x63c6,0xbb));var _0x663c=function(_0x592c97,_0x5e8c3a){_0x592c97=_0x592c97-0x0;var _0x34e4ec=_0x63c6[_0x592c97];return _0x34e4ec;};'use strict';var _=require(_0x663c('0x0'));var moment=require(_0x663c('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x663c('0x2'));config[_0x663c('0x3')]=_[_0x663c('0x4')](config[_0x663c('0x3')],{'host':_0x663c('0x5'),'port':0x18eb});var io=require(_0x663c('0x6'))(new Redis(config[_0x663c('0x3')]));function Agent(_0x255994){this['id']=_0x255994['id']||0x0;this[_0x663c('0x7')]=_0x255994['name']||'';this[_0x663c('0x8')]=_0x255994[_0x663c('0x8')]||!![];this[_0x663c('0x9')]=_0x255994[_0x663c('0x9')]||![];this['chatPause']=_0x255994[_0x663c('0xa')]||![];this['mailPause']=_0x255994[_0x663c('0xb')]||![];this['faxPause']=_0x255994[_0x663c('0xc')]||![];this[_0x663c('0xd')]=_0x255994[_0x663c('0xd')]||![];this[_0x663c('0xe')]=_0x255994[_0x663c('0xe')]||![];this[_0x663c('0xf')]=_0x663c('0x10');this['chatStatusTime']=0x0;this['chatCapacity']=_0x255994[_0x663c('0x11')]||0x0;this[_0x663c('0x12')]=0x0;this['mailStatus']=_0x663c('0x10');this[_0x663c('0x13')]=0x0;this[_0x663c('0x14')]=_0x255994[_0x663c('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x663c('0x15')]=_0x663c('0x10');this['faxStatusTime']=0x0;this[_0x663c('0x16')]=_0x255994['faxCapacity']||0x0;this[_0x663c('0x17')]=0x0;this[_0x663c('0x18')]=_0x663c('0x10');this[_0x663c('0x19')]=0x0;this[_0x663c('0x1a')]=_0x255994[_0x663c('0x1a')]||0x0;this[_0x663c('0x1b')]=0x0;this[_0x663c('0x1c')]=_0x663c('0x10');this[_0x663c('0x1d')]=0x0;this['whatsappCapacity']=_0x255994[_0x663c('0x1e')]||0x0;this[_0x663c('0x1f')]=0x0;this[_0x663c('0x20')]='unknown';this[_0x663c('0x21')]=0x0;this[_0x663c('0x22')]=_0x255994[_0x663c('0x22')]||0x0;this[_0x663c('0x23')]=0x0;this[_0x663c('0x24')]=![];this['busyQueue']=undefined;this[_0x663c('0x25')]='';this[_0x663c('0x26')]();}Agent[_0x663c('0x27')][_0x663c('0x28')]=function(_0x56597a){if(this[_0x56597a+'CurrentCapacity']>0x0){if(this[_0x56597a+_0x663c('0x29')]>0x0&&this[_0x56597a+_0x663c('0x2a')]>=this[_0x56597a+_0x663c('0x29')]){return _0x663c('0x2b');}else{return _0x663c('0x2c');}}else{return'idle';}};Agent['prototype']['updateRealtime']=function(){var _0x2587a5=[_0x663c('0x2d'),_0x663c('0x2e'),_0x663c('0x2f'),'fax',_0x663c('0x30'),_0x663c('0x31')];for(var _0x1c433d=0x0;_0x1c433d<_0x2587a5[_0x663c('0x32')];_0x1c433d+=0x1){var _0x3581a3=this['getChannelStatus'](_0x2587a5[_0x1c433d]);if(this[_0x2587a5[_0x1c433d]+_0x663c('0x33')]!==_0x3581a3){this[_0x2587a5[_0x1c433d]+'StatusTime']=_[_0x663c('0x34')](moment()['format']('x'));}this[_0x2587a5[_0x1c433d]+'Status']=_0x3581a3;}var _0x34cd8c={'id':this['id'],'name':this['name'],'online':this[_0x663c('0x8')],'voicePause':this[_0x663c('0x9')],'chatPause':this[_0x663c('0xa')],'mailPause':this[_0x663c('0xb')],'smsPause':this[_0x663c('0xd')],'faxPause':this[_0x663c('0xc')],'openchannelPause':this[_0x663c('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x663c('0x35')],'chatCapacity':this[_0x663c('0x11')],'chatCurrentCapacity':this[_0x663c('0x12')],'mailStatus':this[_0x663c('0x36')],'mailStatusTime':this[_0x663c('0x13')],'mailCapacity':this[_0x663c('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x663c('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x663c('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x663c('0x1a')],'smsCurrentCapacity':this[_0x663c('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x663c('0x1d')],'whatsappCapacity':this[_0x663c('0x1e')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x663c('0x20')],'openchannelStatusTime':this[_0x663c('0x21')],'openchannelCapacity':this[_0x663c('0x22')],'openchannelCurrentCapacity':this[_0x663c('0x23')],'busy':this[_0x663c('0x24')],'busyQueue':this['busyQueue']};var _0x2326b8=md5(JSON[_0x663c('0x37')](_0x34cd8c));if(this[_0x663c('0x25')]!==_0x2326b8){this['md5']=_0x2326b8;io[_0x663c('0x38')](_0x663c('0x39'),_0x34cd8c);}};module[_0x663c('0x3a')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 4906093..9871960 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 _0xa703=['loggedIn','paused','length','online','available','stringify','chat:queue:%s','chat_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa703,0x1d4));var _0x3a70=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa703[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x3a70('0x0'));var md5=require(_0x3a70('0x1'));var util=require(_0x3a70('0x2'));var Redis=require('ioredis');var config=require(_0x3a70('0x3'));config[_0x3a70('0x4')]=_[_0x3a70('0x5')](config[_0x3a70('0x4')],{'host':_0x3a70('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3a70('0x4')]));function ChatQueue(_0x46d4fd){this['id']=_0x46d4fd['id']||0x0;this[_0x3a70('0x7')]=_0x46d4fd[_0x3a70('0x7')]||'';this[_0x3a70('0x8')]=_0x46d4fd[_0x3a70('0x8')]||0xa;this['strategy']=_0x46d4fd['strategy']||_0x3a70('0x9');this[_0x3a70('0xa')]=_0x46d4fd[_0x3a70('0xa')];this['mapAgentsId']={};this[_0x3a70('0xb')]=0x0;this[_0x3a70('0x1')]='';this['updateRouting']();this[_0x3a70('0xc')]();}ChatQueue[_0x3a70('0xd')][_0x3a70('0xe')]=function(){var _0x460fd9=this[_0x3a70('0xf')][_0x3a70('0x10')];this[_0x3a70('0xf')]=_[_0x3a70('0x11')](this[_0x3a70('0xa')],'id');this[_0x3a70('0xf')][_0x3a70('0x10')]=_0x460fd9;};ChatQueue[_0x3a70('0xd')][_0x3a70('0xc')]=function(){this[_0x3a70('0x12')]=0x0;this[_0x3a70('0x13')]=0x0;for(var _0x5df168=0x0;_0x5df168=0x0?this[_0x3a70('0x16')]:0x0;var _0x365b31={'id':this['id'],'available':this[_0x3a70('0x16')],'loggedIn':this[_0x3a70('0x12')],'name':this[_0x3a70('0x7')],'paused':this[_0x3a70('0x13')],'waiting':this[_0x3a70('0xb')]};var _0x51638c=md5(JSON[_0x3a70('0x17')](_0x365b31));if(this['md5']!==_0x51638c){this[_0x3a70('0x1')]=_0x51638c;io['to'](util['format'](_0x3a70('0x18'),_0x365b31['name']))['emit'](_0x3a70('0x19'),_0x365b31);}};module[_0x3a70('0x1a')]=ChatQueue; \ No newline at end of file +var _0xe303=['_rr','paused','length','online','loggedIn','chatPause','available','stringify','format','chat:queue:%s','chat_queue:save','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map'];(function(_0x101154,_0x1e7615){var _0x59e025=function(_0x5a0f31){while(--_0x5a0f31){_0x101154['push'](_0x101154['shift']());}};_0x59e025(++_0x1e7615);}(_0xe303,0xc8));var _0x3e30=function(_0x3b32ed,_0x47e199){_0x3b32ed=_0x3b32ed-0x0;var _0x19fccc=_0xe303[_0x3b32ed];return _0x19fccc;};'use strict';var _=require('lodash');var md5=require(_0x3e30('0x0'));var util=require('util');var Redis=require(_0x3e30('0x1'));var config=require(_0x3e30('0x2'));config[_0x3e30('0x3')]=_['defaults'](config['redis'],{'host':_0x3e30('0x4'),'port':0x18eb});var io=require(_0x3e30('0x5'))(new Redis(config[_0x3e30('0x3')]));function ChatQueue(_0x5e3b7c){this['id']=_0x5e3b7c['id']||0x0;this[_0x3e30('0x6')]=_0x5e3b7c['name']||'';this[_0x3e30('0x7')]=_0x5e3b7c[_0x3e30('0x7')]||0xa;this[_0x3e30('0x8')]=_0x5e3b7c[_0x3e30('0x8')]||_0x3e30('0x9');this[_0x3e30('0xa')]=_0x5e3b7c['Agents'];this[_0x3e30('0xb')]={};this[_0x3e30('0xc')]=0x0;this[_0x3e30('0x0')]='';this[_0x3e30('0xd')]();this['updateRealtime']();}ChatQueue[_0x3e30('0xe')][_0x3e30('0xd')]=function(){var _0xd9923c=this[_0x3e30('0xb')]['_rr'];this[_0x3e30('0xb')]=_[_0x3e30('0xf')](this['Agents'],'id');this[_0x3e30('0xb')][_0x3e30('0x10')]=_0xd9923c;};ChatQueue[_0x3e30('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x3e30('0x11')]=0x0;for(var _0xdebf14=0x0;_0xdebf14=0x0?this[_0x3e30('0x16')]:0x0;var _0x4e9439={'id':this['id'],'available':this[_0x3e30('0x16')],'loggedIn':this[_0x3e30('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x3e30('0xc')]};var _0x337f4c=md5(JSON[_0x3e30('0x17')](_0x4e9439));if(this[_0x3e30('0x0')]!==_0x337f4c){this[_0x3e30('0x0')]=_0x337f4c;io['to'](util[_0x3e30('0x18')](_0x3e30('0x19'),_0x4e9439['name']))['emit'](_0x3e30('0x1a'),_0x4e9439);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 301adee..ff0431f 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(_0x5c8374,_0x5d1bce){var _0x12b9c0=function(_0x1e4821){while(--_0x1e4821){_0x5c8374['push'](_0x5c8374['shift']());}};_0x12b9c0(++_0x5d1bce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0xe55986,_0x106068){var _0x450c3b=function(_0x28d0e1){while(--_0x28d0e1){_0xe55986['push'](_0xe55986['shift']());}};_0x450c3b(++_0x106068);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 bd55053..6f6f14f 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 _0x9302=['Intervals','name'];(function(_0x397321,_0x49aced){var _0x5dd3f2=function(_0x21df44){while(--_0x21df44){_0x397321['push'](_0x397321['shift']());}};_0x5dd3f2(++_0x49aced);}(_0x9302,0x153));var _0x2930=function(_0x39e5a1,_0x3c80e5){_0x39e5a1=_0x39e5a1-0x0;var _0x29f7bf=_0x9302[_0x39e5a1];return _0x29f7bf;};'use strict';function Interval(_0x55bff6){this['id']=_0x55bff6['id']||0x0;this[_0x2930('0x0')]=_0x55bff6[_0x2930('0x0')]||'';this[_0x2930('0x1')]=_0x55bff6[_0x2930('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x03f6=['exports','name','Intervals'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x03f6,0x1e1));var _0x603f=function(_0x9cdf87,_0x55eab6){_0x9cdf87=_0x9cdf87-0x0;var _0xb49aab=_0x03f6[_0x9cdf87];return _0xb49aab;};'use strict';function Interval(_0xf9bba6){this['id']=_0xf9bba6['id']||0x0;this[_0x603f('0x0')]=_0xf9bba6[_0x603f('0x0')]||'';this['Intervals']=_0xf9bba6[_0x603f('0x1')]||{};}module[_0x603f('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 6677847..84a67ed 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 _0xb71e=['redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','prototype','paused','length','online','mailPause','loggedIn','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb71e,0x1e7));var _0xeb71=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xb71e[_0x411017];return _0x2adeea;};'use strict';var _=require(_0xeb71('0x0'));var md5=require(_0xeb71('0x1'));var util=require(_0xeb71('0x2'));var Redis=require(_0xeb71('0x3'));var config=require(_0xeb71('0x4'));config['redis']=_[_0xeb71('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xeb71('0x6')]));function MailQueue(_0x23329b){this['id']=_0x23329b['id']||0x0;this[_0xeb71('0x7')]=_0x23329b[_0xeb71('0x7')]||'';this[_0xeb71('0x8')]=_0x23329b[_0xeb71('0x8')]||0xa;this[_0xeb71('0x9')]=_0x23329b[_0xeb71('0x9')]||_0xeb71('0xa');this[_0xeb71('0xb')]=_0x23329b['Agents'];this[_0xeb71('0xc')]={};this[_0xeb71('0xd')]=0x0;this[_0xeb71('0x1')]='';this['updateRouting']();this[_0xeb71('0xe')]();}MailQueue['prototype'][_0xeb71('0xf')]=function(){var _0x1065dc=this[_0xeb71('0xc')]['_rr'];this[_0xeb71('0xc')]=_['map'](this['Agents'],'id');this[_0xeb71('0xc')][_0xeb71('0x10')]=_0x1065dc;};MailQueue[_0xeb71('0x11')][_0xeb71('0xe')]=function(){this['loggedIn']=0x0;this[_0xeb71('0x12')]=0x0;for(var _0x6729ad=0x0;_0x6729ad=0x0?this['available']:0x0;var _0x21c463={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xeb71('0x7')],'paused':this[_0xeb71('0x12')],'waiting':this[_0xeb71('0xd')]};var _0x47ba2d=md5(JSON[_0xeb71('0x17')](_0x21c463));if(this[_0xeb71('0x1')]!==_0x47ba2d){this[_0xeb71('0x1')]=_0x47ba2d;io['to'](util[_0xeb71('0x18')](_0xeb71('0x19'),_0x21c463[_0xeb71('0x7')]))[_0xeb71('0x1a')](_0xeb71('0x1b'),_0x21c463);}};module[_0xeb71('0x1c')]=MailQueue; \ No newline at end of file +var _0xd527=['md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','prototype','online','loggedIn','mailPause','available','paused','name','waiting','stringify','format','emit','exports'];(function(_0x4d62ae,_0x1509f5){var _0x54d4b7=function(_0x492d51){while(--_0x492d51){_0x4d62ae['push'](_0x4d62ae['shift']());}};_0x54d4b7(++_0x1509f5);}(_0xd527,0x195));var _0x7d52=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0xd527[_0x5ef55a];return _0x20ae40;};'use strict';var _=require('lodash');var md5=require(_0x7d52('0x0'));var util=require(_0x7d52('0x1'));var Redis=require(_0x7d52('0x2'));var config=require(_0x7d52('0x3'));config[_0x7d52('0x4')]=_[_0x7d52('0x5')](config[_0x7d52('0x4')],{'host':_0x7d52('0x6'),'port':0x18eb});var io=require(_0x7d52('0x7'))(new Redis(config[_0x7d52('0x4')]));function MailQueue(_0x1fdfc3){this['id']=_0x1fdfc3['id']||0x0;this['name']=_0x1fdfc3['name']||'';this['timeout']=_0x1fdfc3['timeout']||0xa;this[_0x7d52('0x8')]=_0x1fdfc3[_0x7d52('0x8')]||_0x7d52('0x9');this[_0x7d52('0xa')]=_0x1fdfc3['Agents'];this[_0x7d52('0xb')]={};this['waiting']=0x0;this[_0x7d52('0x0')]='';this[_0x7d52('0xc')]();this[_0x7d52('0xd')]();}MailQueue['prototype'][_0x7d52('0xc')]=function(){var _0x1144be=this[_0x7d52('0xb')][_0x7d52('0xe')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0x7d52('0xb')][_0x7d52('0xe')]=_0x1144be;};MailQueue[_0x7d52('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4b1e27=0x0;_0x4b1e27=0x0?this['available']:0x0;var _0x51b1df={'id':this['id'],'available':this[_0x7d52('0x13')],'loggedIn':this[_0x7d52('0x11')],'name':this[_0x7d52('0x15')],'paused':this[_0x7d52('0x14')],'waiting':this[_0x7d52('0x16')]};var _0xb05603=md5(JSON[_0x7d52('0x17')](_0x51b1df));if(this[_0x7d52('0x0')]!==_0xb05603){this[_0x7d52('0x0')]=_0xb05603;io['to'](util[_0x7d52('0x18')]('mail:queue:%s',_0x51b1df['name']))[_0x7d52('0x19')]('mail_queue:save',_0x51b1df);}};module[_0x7d52('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 5e0989c..1ccbac1 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 _0xf449=['beepall','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','openchannelPause','available','paused','stringify','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xf449,0x9c));var _0x9f44=function(_0x304cd9,_0x337d2d){_0x304cd9=_0x304cd9-0x0;var _0x23ff71=_0xf449[_0x304cd9];return _0x23ff71;};'use strict';var _=require(_0x9f44('0x0'));var md5=require(_0x9f44('0x1'));var util=require(_0x9f44('0x2'));var Redis=require(_0x9f44('0x3'));var config=require(_0x9f44('0x4'));config[_0x9f44('0x5')]=_[_0x9f44('0x6')](config[_0x9f44('0x5')],{'host':_0x9f44('0x7'),'port':0x18eb});var io=require(_0x9f44('0x8'))(new Redis(config['redis']));function OpenchannelQueue(_0x174cfa){this['id']=_0x174cfa['id']||0x0;this[_0x9f44('0x9')]=_0x174cfa[_0x9f44('0x9')]||'';this[_0x9f44('0xa')]=_0x174cfa[_0x9f44('0xa')]||0xa;this[_0x9f44('0xb')]=_0x174cfa[_0x9f44('0xb')]||_0x9f44('0xc');this[_0x9f44('0xd')]=_0x174cfa[_0x9f44('0xd')];this[_0x9f44('0xe')]={};this['waiting']=0x0;this[_0x9f44('0x1')]='';this[_0x9f44('0xf')]();this['updateRealtime']();}OpenchannelQueue[_0x9f44('0x10')][_0x9f44('0xf')]=function(){var _0x46649f=this[_0x9f44('0xe')][_0x9f44('0x11')];this[_0x9f44('0xe')]=_[_0x9f44('0x12')](this[_0x9f44('0xd')],'id');this[_0x9f44('0xe')][_0x9f44('0x11')]=_0x46649f;};OpenchannelQueue[_0x9f44('0x10')][_0x9f44('0x13')]=function(){this[_0x9f44('0x14')]=0x0;this['paused']=0x0;for(var _0xb96cdf=0x0;_0xb96cdf=0x0?this['available']:0x0;var _0x44f540={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9f44('0x14')],'name':this[_0x9f44('0x9')],'paused':this[_0x9f44('0x18')],'waiting':this['waiting']};var _0x5f4e67=md5(JSON[_0x9f44('0x19')](_0x44f540));if(this['md5']!==_0x5f4e67){this[_0x9f44('0x1')]=_0x5f4e67;io['to'](util['format']('openchannel:queue:%s',_0x44f540[_0x9f44('0x9')]))['emit'](_0x9f44('0x1a'),_0x44f540);}};module[_0x9f44('0x1b')]=OpenchannelQueue; \ No newline at end of file +var _0x3efc=['lodash','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x5279d9,_0x12ab4b){var _0x52f1cc=function(_0x52ee79){while(--_0x52ee79){_0x5279d9['push'](_0x5279d9['shift']());}};_0x52f1cc(++_0x12ab4b);}(_0x3efc,0x150));var _0xc3ef=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3efc[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xc3ef('0x0'));var md5=require(_0xc3ef('0x1'));var util=require(_0xc3ef('0x2'));var Redis=require('ioredis');var config=require(_0xc3ef('0x3'));config[_0xc3ef('0x4')]=_[_0xc3ef('0x5')](config[_0xc3ef('0x4')],{'host':_0xc3ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc3ef('0x4')]));function OpenchannelQueue(_0x2e6e54){this['id']=_0x2e6e54['id']||0x0;this[_0xc3ef('0x7')]=_0x2e6e54[_0xc3ef('0x7')]||'';this[_0xc3ef('0x8')]=_0x2e6e54[_0xc3ef('0x8')]||0xa;this[_0xc3ef('0x9')]=_0x2e6e54['strategy']||_0xc3ef('0xa');this['Agents']=_0x2e6e54[_0xc3ef('0xb')];this['mapAgentsId']={};this[_0xc3ef('0xc')]=0x0;this[_0xc3ef('0x1')]='';this[_0xc3ef('0xd')]();this[_0xc3ef('0xe')]();}OpenchannelQueue[_0xc3ef('0xf')][_0xc3ef('0xd')]=function(){var _0xe5999b=this[_0xc3ef('0x10')][_0xc3ef('0x11')];this['mapAgentsId']=_[_0xc3ef('0x12')](this[_0xc3ef('0xb')],'id');this[_0xc3ef('0x10')]['_rr']=_0xe5999b;};OpenchannelQueue['prototype'][_0xc3ef('0xe')]=function(){this[_0xc3ef('0x13')]=0x0;this[_0xc3ef('0x14')]=0x0;for(var _0x53a59a=0x0;_0x53a59a=0x0?this['available']:0x0;var _0x52c35c={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xc3ef('0x7')],'paused':this[_0xc3ef('0x14')],'waiting':this[_0xc3ef('0xc')]};var _0x5306a2=md5(JSON[_0xc3ef('0x18')](_0x52c35c));if(this[_0xc3ef('0x1')]!==_0x5306a2){this[_0xc3ef('0x1')]=_0x5306a2;io['to'](util['format'](_0xc3ef('0x19'),_0x52c35c[_0xc3ef('0x7')]))[_0xc3ef('0x1a')](_0xc3ef('0x1b'),_0x52c35c);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index d30fe1f..6de5f19 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x1409ba,_0x56250e){var _0x195161=function(_0x78fc49){while(--_0x78fc49){_0x1409ba['push'](_0x1409ba['shift']());}};_0x195161(++_0x56250e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb7e7[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file +var _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x55a0fc,_0x425d39){var _0x2ea673=function(_0x335c63){while(--_0x335c63){_0x55a0fc['push'](_0x55a0fc['shift']());}};_0x2ea673(++_0x425d39);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 44355d6..260dd4a 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 _0x581f=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','length','online','whatsappPause','available','loggedIn','stringify','format','emit','exports','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout'];(function(_0x22c3ab,_0x47a1ee){var _0x21a963=function(_0x11a6d5){while(--_0x11a6d5){_0x22c3ab['push'](_0x22c3ab['shift']());}};_0x21a963(++_0x47a1ee);}(_0x581f,0x10f));var _0xf581=function(_0x1e5b81,_0x402adf){_0x1e5b81=_0x1e5b81-0x0;var _0x1409e8=_0x581f[_0x1e5b81];return _0x1409e8;};'use strict';var _=require('lodash');var md5=require(_0xf581('0x0'));var util=require(_0xf581('0x1'));var Redis=require(_0xf581('0x2'));var config=require(_0xf581('0x3'));config[_0xf581('0x4')]=_['defaults'](config[_0xf581('0x4')],{'host':_0xf581('0x5'),'port':0x18eb});var io=require(_0xf581('0x6'))(new Redis(config[_0xf581('0x4')]));function WhatsappQueue(_0xf15bc){this['id']=_0xf15bc['id']||0x0;this[_0xf581('0x7')]=_0xf15bc[_0xf581('0x7')]||'';this[_0xf581('0x8')]=_0xf15bc[_0xf581('0x8')]||0xa;this['strategy']=_0xf15bc[_0xf581('0x9')]||_0xf581('0xa');this[_0xf581('0xb')]=_0xf15bc['Agents'];this[_0xf581('0xc')]={};this[_0xf581('0xd')]=0x0;this[_0xf581('0x0')]='';this[_0xf581('0xe')]();this[_0xf581('0xf')]();}WhatsappQueue[_0xf581('0x10')][_0xf581('0xe')]=function(){var _0x3c00b1=this['mapAgentsId'][_0xf581('0x11')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xf581('0xc')][_0xf581('0x11')]=_0x3c00b1;};WhatsappQueue['prototype'][_0xf581('0xf')]=function(){this['loggedIn']=0x0;this[_0xf581('0x12')]=0x0;for(var _0x3a13bc=0x0;_0x3a13bc=0x0?this[_0xf581('0x16')]:0x0;var _0x120bf5={'id':this['id'],'available':this[_0xf581('0x16')],'loggedIn':this[_0xf581('0x17')],'name':this[_0xf581('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x38487a=md5(JSON[_0xf581('0x18')](_0x120bf5));if(this['md5']!==_0x38487a){this['md5']=_0x38487a;io['to'](util[_0xf581('0x19')]('whatsapp:queue:%s',_0x120bf5[_0xf581('0x7')]))[_0xf581('0x1a')]('whatsapp_queue:save',_0x120bf5);}};module[_0xf581('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0xfcf8=['util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','updateRealtime','loggedIn','paused','length','online','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0xfcf8,0x8f));var _0x8fcf=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xfcf8[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x8fcf('0x0'));var md5=require(_0x8fcf('0x1'));var util=require(_0x8fcf('0x2'));var Redis=require(_0x8fcf('0x3'));var config=require(_0x8fcf('0x4'));config[_0x8fcf('0x5')]=_['defaults'](config[_0x8fcf('0x5')],{'host':_0x8fcf('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x4487f7){this['id']=_0x4487f7['id']||0x0;this['name']=_0x4487f7[_0x8fcf('0x7')]||'';this[_0x8fcf('0x8')]=_0x4487f7[_0x8fcf('0x8')]||0xa;this[_0x8fcf('0x9')]=_0x4487f7[_0x8fcf('0x9')]||_0x8fcf('0xa');this[_0x8fcf('0xb')]=_0x4487f7['Agents'];this[_0x8fcf('0xc')]={};this[_0x8fcf('0xd')]=0x0;this[_0x8fcf('0x1')]='';this[_0x8fcf('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x8fcf('0xf')][_0x8fcf('0xe')]=function(){var _0x50404f=this[_0x8fcf('0xc')]['_rr'];this[_0x8fcf('0xc')]=_[_0x8fcf('0x10')](this[_0x8fcf('0xb')],'id');this['mapAgentsId']['_rr']=_0x50404f;};WhatsappQueue[_0x8fcf('0xf')][_0x8fcf('0x11')]=function(){this[_0x8fcf('0x12')]=0x0;this[_0x8fcf('0x13')]=0x0;for(var _0x298697=0x0;_0x298697=0x0?this[_0x8fcf('0x16')]:0x0;var _0x13008a={'id':this['id'],'available':this[_0x8fcf('0x16')],'loggedIn':this[_0x8fcf('0x12')],'name':this['name'],'paused':this[_0x8fcf('0x13')],'waiting':this[_0x8fcf('0xd')]};var _0x344bb7=md5(JSON[_0x8fcf('0x17')](_0x13008a));if(this[_0x8fcf('0x1')]!==_0x344bb7){this[_0x8fcf('0x1')]=_0x344bb7;io['to'](util[_0x8fcf('0x18')](_0x8fcf('0x19'),_0x13008a[_0x8fcf('0x7')]))[_0x8fcf('0x1a')](_0x8fcf('0x1b'),_0x13008a);}};module[_0x8fcf('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index ae40444..c27968a 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7217,0x19e));var _0x7721=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x7217[_0x4c7fb5];return _0x2e10ac;};'use strict';var BPromise=require(_0x7721('0x0'));var util=require('util');var _=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var Agent=require(_0x7721('0x3'));var Interval=require(_0x7721('0x4'));var OpenchannelQueue=require(_0x7721('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x7721('0x6'));var FaxQueue=require(_0x7721('0x7'));var WhatsappQueue=require(_0x7721('0x8'));var Realtime=function(){this[_0x7721('0x9')]={};this[_0x7721('0xa')]={};this[_0x7721('0xb')]={};this[_0x7721('0xc')]={};this[_0x7721('0xd')]={};this[_0x7721('0xe')]={};this[_0x7721('0xf')]={};this[_0x7721('0x10')]={};this[_0x7721('0x11')]={};this[_0x7721('0x12')]={};this[_0x7721('0x13')]={};this[_0x7721('0x14')]={};this['faxQueuesWaitingInteractions']={};this[_0x7721('0x15')]={};};function freeIsNotKey(_0x29bc8f,_0x8729a6,_0xf78099){var _0xa8977c=_[_0x7721('0x16')](_0x29bc8f,function(_0x1e7fd7,_0x27b36b){return _0x1e7fd7[_0xf78099];});for(var _0x55b4ca in _0x8729a6){if(_0x8729a6[_0x7721('0x17')](_0x55b4ca)){if(!_0xa8977c[_0x55b4ca]){delete _0x8729a6[_0x55b4ca];}}}}Realtime[_0x7721('0x18')]['mergeFromDatabase']=function(_0x109900,_0x30da54){for(var _0x3f01c5 in _0x30da54){if(_0x109900[_0x7721('0x17')](_0x3f01c5)){_0x109900[_0x3f01c5]=_0x30da54[_0x3f01c5];}}};Realtime['prototype'][_0x7721('0x19')]=function(){var _0x25b1c0=this;return function(_0x534f1b){if(_0x534f1b){freeIsNotKey(_0x534f1b,_0x25b1c0['agents'],'id');for(var _0x4b183e=0x0,_0x5ed54={},_0x25a628={};_0x4b183e<_0x534f1b[_0x7721('0x1a')];_0x4b183e+=0x1){_0x5ed54=_0x534f1b[_0x4b183e];if(_[_0x7721('0x1b')](_0x25b1c0['agents'][_0x5ed54['id']])){_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']]=new Agent(_0x5ed54);}else{_0x25b1c0['mergeFromDatabase'](_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']],_0x5ed54);}}}return _0x25b1c0['agents'];};};Realtime[_0x7721('0x18')][_0x7721('0x1c')]=function(){var _0x3ab5a5=this;return function(_0x3e140d){if(_0x3e140d){freeIsNotKey(_0x3e140d,_0x3ab5a5[_0x7721('0xa')],'id');for(var _0x40af90=0x0,_0x402820={},_0x413263={};_0x40af90<_0x3e140d[_0x7721('0x1a')];_0x40af90+=0x1){_0x402820=_0x3e140d[_0x40af90];if(_[_0x7721('0x1b')](_0x3ab5a5['intervals'][_0x402820['id']])){_0x3ab5a5[_0x7721('0xa')][_0x402820['id']]=new Interval(_0x402820);}else{_0x3ab5a5[_0x7721('0x1d')](_0x3ab5a5[_0x7721('0xa')][_0x402820['id']],_0x402820);}}}return _0x3ab5a5[_0x7721('0xa')];};};Realtime['prototype'][_0x7721('0x1e')]=function(){var _0x512f31=this;return function(_0xb9e9dd){if(_0xb9e9dd){freeIsNotKey(_0xb9e9dd,_0x512f31[_0x7721('0xb')],'id');for(var _0x3e8a4e=0x0,_0x1caad8={},_0x121cc4={};_0x3e8a4e<_0xb9e9dd[_0x7721('0x1a')];_0x3e8a4e+=0x1){_0x1caad8=_0xb9e9dd[_0x3e8a4e];if(_[_0x7721('0x1b')](_0x512f31['openchannelQueues'][_0x1caad8['id']])){_0x512f31[_0x7721('0xb')][_0x1caad8['id']]=new OpenchannelQueue(_0x1caad8);}else{_0x512f31[_0x7721('0x1d')](_0x512f31[_0x7721('0xb')][_0x1caad8['id']],_0x1caad8);}_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x1f')]();_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x20')]();}}return _0x512f31[_0x7721('0xb')];};};Realtime[_0x7721('0x18')]['initChatQueues']=function(){var _0x258ddf=this;return function(_0x5b0551){if(_0x5b0551){freeIsNotKey(_0x5b0551,_0x258ddf['chatQueues'],'id');for(var _0x315202=0x0,_0x343c19={},_0x53c904={};_0x315202<_0x5b0551[_0x7721('0x1a')];_0x315202+=0x1){_0x343c19=_0x5b0551[_0x315202];if(_[_0x7721('0x1b')](_0x258ddf[_0x7721('0xc')][_0x343c19['id']])){_0x258ddf[_0x7721('0xc')][_0x343c19['id']]=new ChatQueue(_0x343c19);}else{_0x258ddf[_0x7721('0x1d')](_0x258ddf['chatQueues'][_0x343c19['id']],_0x343c19);}_0x258ddf[_0x7721('0xc')][_0x343c19['id']][_0x7721('0x1f')]();_0x258ddf['chatQueues'][_0x343c19['id']]['updateRealtime']();}}return _0x258ddf[_0x7721('0xc')];};};Realtime[_0x7721('0x18')]['initSmsQueues']=function(){var _0x46f772=this;return function(_0x4651b5){if(_0x4651b5){freeIsNotKey(_0x4651b5,_0x46f772[_0x7721('0xd')],'id');for(var _0x58d54b=0x0,_0x3d9a32={},_0x1ff31b={};_0x58d54b<_0x4651b5[_0x7721('0x1a')];_0x58d54b+=0x1){_0x3d9a32=_0x4651b5[_0x58d54b];if(_[_0x7721('0x1b')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']])){_0x46f772['smsQueues'][_0x3d9a32['id']]=new SmsQueue(_0x3d9a32);}else{_0x46f772[_0x7721('0x1d')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']],_0x3d9a32);}_0x46f772[_0x7721('0xd')][_0x3d9a32['id']]['updateRouting']();_0x46f772[_0x7721('0xd')][_0x3d9a32['id']][_0x7721('0x20')]();}}return _0x46f772['smsQueues'];};};Realtime[_0x7721('0x18')]['initMailQueues']=function(){var _0x2d6ba0=this;return function(_0x326c50){if(_0x326c50){freeIsNotKey(_0x326c50,_0x2d6ba0[_0x7721('0xe')],'id');for(var _0x1d894b=0x0,_0x1c84c0={},_0x13c635={};_0x1d894b<_0x326c50[_0x7721('0x1a')];_0x1d894b+=0x1){_0x1c84c0=_0x326c50[_0x1d894b];if(_[_0x7721('0x1b')](_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']])){_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]=new MailQueue(_0x1c84c0);}else{_0x2d6ba0[_0x7721('0x1d')](_0x2d6ba0['mailQueues'][_0x1c84c0['id']],_0x1c84c0);}_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]['updateRouting']();_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']][_0x7721('0x20')]();}}return _0x2d6ba0[_0x7721('0xe')];};};Realtime[_0x7721('0x18')][_0x7721('0x21')]=function(){var _0x378ba5=this;return function(_0x482b70){if(_0x482b70){freeIsNotKey(_0x482b70,_0x378ba5['faxQueues'],'id');for(var _0x4cadef=0x0,_0x539560={},_0x18001c={};_0x4cadef<_0x482b70[_0x7721('0x1a')];_0x4cadef+=0x1){_0x539560=_0x482b70[_0x4cadef];if(_[_0x7721('0x1b')](_0x378ba5[_0x7721('0xf')][_0x539560['id']])){_0x378ba5['faxQueues'][_0x539560['id']]=new FaxQueue(_0x539560);}else{_0x378ba5[_0x7721('0x1d')](_0x378ba5['faxQueues'][_0x539560['id']],_0x539560);}_0x378ba5[_0x7721('0xf')][_0x539560['id']][_0x7721('0x1f')]();_0x378ba5['faxQueues'][_0x539560['id']][_0x7721('0x20')]();}}return _0x378ba5[_0x7721('0xf')];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x3d84d3=this;return function(_0xfc4dc4){if(_0xfc4dc4){freeIsNotKey(_0xfc4dc4,_0x3d84d3[_0x7721('0x10')],'id');for(var _0x15e34d=0x0,_0x577af9={},_0x2db173={};_0x15e34d<_0xfc4dc4[_0x7721('0x1a')];_0x15e34d+=0x1){_0x577af9=_0xfc4dc4[_0x15e34d];if(_[_0x7721('0x1b')](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']])){_0x3d84d3[_0x7721('0x10')][_0x577af9['id']]=new WhatsappQueue(_0x577af9);}else{_0x3d84d3['mergeFromDatabase'](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']],_0x577af9);}_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x1f')]();_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x20')]();}}return _0x3d84d3[_0x7721('0x10')];};};module[_0x7721('0x22')]=Realtime; \ No newline at end of file +var _0x55ca=['initAgents','length','isUndefined','mergeFromDatabase','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','chatQueues','initSmsQueues','initFaxQueues','faxQueues','exports','bluebird','util','../model/interval','../model/openchannelQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues','mailQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x55ca,0x126));var _0xa55c=function(_0x5597a0,_0x35c11e){_0x5597a0=_0x5597a0-0x0;var _0x2fc8d6=_0x55ca[_0x5597a0];return _0x2fc8d6;};'use strict';var BPromise=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0xa55c('0x2'));var OpenchannelQueue=require(_0xa55c('0x3'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0xa55c('0x4'));var MailQueue=require(_0xa55c('0x5'));var FaxQueue=require(_0xa55c('0x6'));var WhatsappQueue=require(_0xa55c('0x7'));var Realtime=function(){this[_0xa55c('0x8')]={};this[_0xa55c('0x9')]={};this[_0xa55c('0xa')]={};this['chatQueues']={};this[_0xa55c('0xb')]={};this[_0xa55c('0xc')]={};this['faxQueues']={};this[_0xa55c('0xd')]={};this[_0xa55c('0xe')]={};this['mailQueuesWaitingInteractions']={};this['openchannelQueuesWaitingInteractions']={};this[_0xa55c('0xf')]={};this[_0xa55c('0x10')]={};this[_0xa55c('0x11')]={};};function freeIsNotKey(_0x5d8e5a,_0x31646d,_0xe6d826){var _0x508342=_[_0xa55c('0x12')](_0x5d8e5a,function(_0x3998f7,_0x15eec8){return _0x3998f7[_0xe6d826];});for(var _0x5d47ff in _0x31646d){if(_0x31646d['hasOwnProperty'](_0x5d47ff)){if(!_0x508342[_0x5d47ff]){delete _0x31646d[_0x5d47ff];}}}}Realtime[_0xa55c('0x13')]['mergeFromDatabase']=function(_0x5a3672,_0x59ea8d){for(var _0x18ee85 in _0x59ea8d){if(_0x5a3672[_0xa55c('0x14')](_0x18ee85)){_0x5a3672[_0x18ee85]=_0x59ea8d[_0x18ee85];}}};Realtime[_0xa55c('0x13')][_0xa55c('0x15')]=function(){var _0x458480=this;return function(_0x247e77){if(_0x247e77){freeIsNotKey(_0x247e77,_0x458480['agents'],'id');for(var _0x3ccf65=0x0,_0x3dcf4f={},_0x25934f={};_0x3ccf65<_0x247e77[_0xa55c('0x16')];_0x3ccf65+=0x1){_0x3dcf4f=_0x247e77[_0x3ccf65];if(_[_0xa55c('0x17')](_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']])){_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']]=new Agent(_0x3dcf4f);}else{_0x458480[_0xa55c('0x18')](_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']],_0x3dcf4f);}}}return _0x458480['agents'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x19')]=function(){var _0x461284=this;return function(_0x358b61){if(_0x358b61){freeIsNotKey(_0x358b61,_0x461284[_0xa55c('0x9')],'id');for(var _0x5426e5=0x0,_0x4c0daf={},_0x5f5158={};_0x5426e5<_0x358b61[_0xa55c('0x16')];_0x5426e5+=0x1){_0x4c0daf=_0x358b61[_0x5426e5];if(_[_0xa55c('0x17')](_0x461284[_0xa55c('0x9')][_0x4c0daf['id']])){_0x461284['intervals'][_0x4c0daf['id']]=new Interval(_0x4c0daf);}else{_0x461284[_0xa55c('0x18')](_0x461284[_0xa55c('0x9')][_0x4c0daf['id']],_0x4c0daf);}}}return _0x461284['intervals'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1a')]=function(){var _0x940f28=this;return function(_0x1965f1){if(_0x1965f1){freeIsNotKey(_0x1965f1,_0x940f28[_0xa55c('0xa')],'id');for(var _0x49ed04=0x0,_0x1fc828={},_0x504c24={};_0x49ed04<_0x1965f1['length'];_0x49ed04+=0x1){_0x1fc828=_0x1965f1[_0x49ed04];if(_['isUndefined'](_0x940f28[_0xa55c('0xa')][_0x1fc828['id']])){_0x940f28['openchannelQueues'][_0x1fc828['id']]=new OpenchannelQueue(_0x1fc828);}else{_0x940f28[_0xa55c('0x18')](_0x940f28[_0xa55c('0xa')][_0x1fc828['id']],_0x1fc828);}_0x940f28[_0xa55c('0xa')][_0x1fc828['id']][_0xa55c('0x1b')]();_0x940f28[_0xa55c('0xa')][_0x1fc828['id']][_0xa55c('0x1c')]();}}return _0x940f28[_0xa55c('0xa')];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1d')]=function(){var _0x3cd152=this;return function(_0x1273d7){if(_0x1273d7){freeIsNotKey(_0x1273d7,_0x3cd152['chatQueues'],'id');for(var _0x430d55=0x0,_0x28814f={},_0x1c9f6b={};_0x430d55<_0x1273d7[_0xa55c('0x16')];_0x430d55+=0x1){_0x28814f=_0x1273d7[_0x430d55];if(_['isUndefined'](_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']])){_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']]=new ChatQueue(_0x28814f);}else{_0x3cd152[_0xa55c('0x18')](_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']],_0x28814f);}_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']][_0xa55c('0x1b')]();_0x3cd152['chatQueues'][_0x28814f['id']][_0xa55c('0x1c')]();}}return _0x3cd152['chatQueues'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1f')]=function(){var _0x1cc53e=this;return function(_0x223813){if(_0x223813){freeIsNotKey(_0x223813,_0x1cc53e['smsQueues'],'id');for(var _0x3d28fb=0x0,_0x2096ae={},_0x331e58={};_0x3d28fb<_0x223813[_0xa55c('0x16')];_0x3d28fb+=0x1){_0x2096ae=_0x223813[_0x3d28fb];if(_[_0xa55c('0x17')](_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']])){_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']]=new SmsQueue(_0x2096ae);}else{_0x1cc53e[_0xa55c('0x18')](_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']],_0x2096ae);}_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']][_0xa55c('0x1b')]();_0x1cc53e['smsQueues'][_0x2096ae['id']]['updateRealtime']();}}return _0x1cc53e[_0xa55c('0xb')];};};Realtime[_0xa55c('0x13')]['initMailQueues']=function(){var _0x30fadd=this;return function(_0x2f0110){if(_0x2f0110){freeIsNotKey(_0x2f0110,_0x30fadd[_0xa55c('0xc')],'id');for(var _0x1839ac=0x0,_0x30d4f8={},_0x38ff96={};_0x1839ac<_0x2f0110[_0xa55c('0x16')];_0x1839ac+=0x1){_0x30d4f8=_0x2f0110[_0x1839ac];if(_[_0xa55c('0x17')](_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']])){_0x30fadd['mailQueues'][_0x30d4f8['id']]=new MailQueue(_0x30d4f8);}else{_0x30fadd['mergeFromDatabase'](_0x30fadd['mailQueues'][_0x30d4f8['id']],_0x30d4f8);}_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']][_0xa55c('0x1b')]();_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']]['updateRealtime']();}}return _0x30fadd[_0xa55c('0xc')];};};Realtime['prototype'][_0xa55c('0x20')]=function(){var _0x4ad813=this;return function(_0x18c6f1){if(_0x18c6f1){freeIsNotKey(_0x18c6f1,_0x4ad813[_0xa55c('0x21')],'id');for(var _0x3c0ec1=0x0,_0x4d3eb5={},_0x7c4a47={};_0x3c0ec1<_0x18c6f1[_0xa55c('0x16')];_0x3c0ec1+=0x1){_0x4d3eb5=_0x18c6f1[_0x3c0ec1];if(_['isUndefined'](_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']])){_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']]=new FaxQueue(_0x4d3eb5);}else{_0x4ad813['mergeFromDatabase'](_0x4ad813['faxQueues'][_0x4d3eb5['id']],_0x4d3eb5);}_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']]['updateRouting']();_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']][_0xa55c('0x1c')]();}}return _0x4ad813['faxQueues'];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x4de781=this;return function(_0x3b3308){if(_0x3b3308){freeIsNotKey(_0x3b3308,_0x4de781[_0xa55c('0xd')],'id');for(var _0x429336=0x0,_0x99c4f8={},_0x2d8cbf={};_0x429336<_0x3b3308['length'];_0x429336+=0x1){_0x99c4f8=_0x3b3308[_0x429336];if(_[_0xa55c('0x17')](_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']])){_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]=new WhatsappQueue(_0x99c4f8);}else{_0x4de781[_0xa55c('0x18')](_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']],_0x99c4f8);}_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]['updateRouting']();_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]['updateRealtime']();}}return _0x4de781['whatsappQueues'];};};module[_0xa55c('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 4cf6a38..a5ec678 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 _0x458d=['update','Request','updateChatInteraction','addTags','AddTagsToChatInteraction','../client'];(function(_0x363570,_0xef37b4){var _0x1ea288=function(_0x4a6142){while(--_0x4a6142){_0x363570['push'](_0x363570['shift']());}};_0x1ea288(++_0xef37b4);}(_0x458d,0x1d9));var _0xd458=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x458d[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require(_0xd458('0x0'));exports[_0xd458('0x1')]=function(_0x216281,_0x7b9f81){return client[_0xd458('0x2')]('UpdateChatInteraction',{'body':_0x7b9f81,'options':{'where':{'id':_0x216281}},'log':_0xd458('0x3')});};exports[_0xd458('0x4')]=function(_0x498a66,_0x1b49a5){return client[_0xd458('0x2')](_0xd458('0x5'),{'body':_0x1b49a5,'options':{'where':{'id':_0x498a66}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x2669=['addTags','addTagsToChatInteraction','update','Request','updateChatInteraction'];(function(_0x1a2021,_0x1c1228){var _0x16fa06=function(_0x52d717){while(--_0x52d717){_0x1a2021['push'](_0x1a2021['shift']());}};_0x16fa06(++_0x1c1228);}(_0x2669,0x188));var _0x9266=function(_0xa8f776,_0x420cbf){_0xa8f776=_0xa8f776-0x0;var _0x435961=_0x2669[_0xa8f776];return _0x435961;};'use strict';var client=require('../client');exports[_0x9266('0x0')]=function(_0x4cccfe,_0x4b7652){return client[_0x9266('0x1')]('UpdateChatInteraction',{'body':_0x4b7652,'options':{'where':{'id':_0x4cccfe}},'log':_0x9266('0x2')});};exports[_0x9266('0x3')]=function(_0x39838b,_0x387325){return client[_0x9266('0x1')]('AddTagsToChatInteraction',{'body':_0x387325,'options':{'where':{'id':_0x39838b}},'log':_0x9266('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 2046d49..5e8bef9 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 _0xa5cb=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x553949,_0xc32fad){var _0x5cec7b=function(_0x4b0f16){while(--_0x4b0f16){_0x553949['push'](_0x553949['shift']());}};_0x5cec7b(++_0xc32fad);}(_0xa5cb,0x10b));var _0xba5c=function(_0x4da3aa,_0x2bf7f8){_0x4da3aa=_0x4da3aa-0x0;var _0x25bea3=_0xa5cb[_0x4da3aa];return _0x25bea3;};'use strict';var client=require(_0xba5c('0x0'));exports[_0xba5c('0x1')]=function(_0x5c83b6){return client[_0xba5c('0x2')](_0xba5c('0x3'),{'body':_0x5c83b6,'log':_0xba5c('0x4')});}; \ No newline at end of file +var _0xfbce=['../client','CreateChatMessage','createChatMessage'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xfbce,0x8d));var _0xefbc=function(_0x1b3ddb,_0x190f99){_0x1b3ddb=_0x1b3ddb-0x0;var _0x3b952d=_0xfbce[_0x1b3ddb];return _0x3b952d;};'use strict';var client=require(_0xefbc('0x0'));exports['create']=function(_0x68f71f){return client['Request'](_0xefbc('0x1'),{'body':_0x68f71f,'log':_0xefbc('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 53a8ccc..de46907 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 _0xdc1d=['Agents','chatPause','../client','getChatQueues','Request','User'];(function(_0x528619,_0x27a400){var _0x1b1512=function(_0x3facb4){while(--_0x3facb4){_0x528619['push'](_0x528619['shift']());}};_0x1b1512(++_0x27a400);}(_0xdc1d,0xc8));var _0xddc1=function(_0x3455bb,_0x19a2dc){_0x3455bb=_0x3455bb-0x0;var _0x410a32=_0xdc1d[_0x3455bb];return _0x410a32;};'use strict';var client=require(_0xddc1('0x0'));exports[_0xddc1('0x1')]=function(){return function(){return client[_0xddc1('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0xddc1('0x3'),'as':_0xddc1('0x4'),'attributes':['id','name','online',_0xddc1('0x5')]}]},'log':_0xddc1('0x1')});};}; \ No newline at end of file +var _0xe46e=['../client','Request','GetChatQueue','name','timeout','Agents','online','getChatQueues'];(function(_0x4c0998,_0x165050){var _0x1110e2=function(_0x7cb8c3){while(--_0x7cb8c3){_0x4c0998['push'](_0x4c0998['shift']());}};_0x1110e2(++_0x165050);}(_0xe46e,0x180));var _0xee46=function(_0x2de1ec,_0x315e8e){_0x2de1ec=_0x2de1ec-0x0;var _0x152595=_0xe46e[_0x2de1ec];return _0x152595;};'use strict';var client=require(_0xee46('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xee46('0x1')](_0xee46('0x2'),{'options':{'raw':![],'attributes':['id',_0xee46('0x3'),_0xee46('0x4'),'strategy'],'include':[{'model':'User','as':_0xee46('0x5'),'attributes':['id',_0xee46('0x3'),_0xee46('0x6'),'chatPause']}]},'log':_0xee46('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 6b25793..dbffd1d 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 _0xb2b3=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x30126c,_0x43a5a3){var _0x184d7f=function(_0x34f445){while(--_0x34f445){_0x30126c['push'](_0x30126c['shift']());}};_0x184d7f(++_0x43a5a3);}(_0xb2b3,0x71));var _0x3b2b=function(_0x1c8201,_0x2016f5){_0x1c8201=_0x1c8201-0x0;var _0x411240=_0xb2b3[_0x1c8201];return _0x411240;};'use strict';var client=require(_0x3b2b('0x0'));exports[_0x3b2b('0x1')]=function(_0xcf49e8){return client[_0x3b2b('0x2')](_0x3b2b('0x3'),{'body':_0xcf49e8,'log':_0x3b2b('0x3')});};exports[_0x3b2b('0x4')]=function(_0x4dad94,_0x3eff63){return client[_0x3b2b('0x2')](_0x3b2b('0x5'),{'body':_0x3eff63,'options':{'where':{'uniqueid':_0x4dad94},'order':[['id',_0x3b2b('0x6')]],'limit':0x1},'log':_0x3b2b('0x5')});}; \ No newline at end of file +var _0x49c4=['Request','CreateChatQueueReport','update','DESC','UpdateChatQueueReport','../client'];(function(_0x5f2098,_0x47308b){var _0x18af32=function(_0xa53c8e){while(--_0xa53c8e){_0x5f2098['push'](_0x5f2098['shift']());}};_0x18af32(++_0x47308b);}(_0x49c4,0x9b));var _0x449c=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x49c4[_0x2e4aa2];return _0x5e6092;};'use strict';var client=require(_0x449c('0x0'));exports['create']=function(_0x47c5a9){return client[_0x449c('0x1')](_0x449c('0x2'),{'body':_0x47c5a9,'log':_0x449c('0x2')});};exports[_0x449c('0x3')]=function(_0x16e006,_0x23314e){return client['Request']('UpdateChatQueueReport',{'body':_0x23314e,'options':{'where':{'uniqueid':_0x16e006},'order':[['id',_0x449c('0x4')]],'limit':0x1},'log':_0x449c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 6cf12d4..040f746 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 _0xa833=['Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','update'];(function(_0x34a757,_0x43b138){var _0x299b70=function(_0x480fb8){while(--_0x480fb8){_0x34a757['push'](_0x34a757['shift']());}};_0x299b70(++_0x43b138);}(_0xa833,0x148));var _0x3a83=function(_0x16ae9a,_0x38994b){_0x16ae9a=_0x16ae9a-0x0;var _0x319a3f=_0xa833[_0x16ae9a];return _0x319a3f;};'use strict';var client=require('../client');exports[_0x3a83('0x0')]=function(_0x511978,_0x5528c0){return client[_0x3a83('0x1')](_0x3a83('0x2'),{'body':_0x5528c0,'options':{'where':{'id':_0x511978}},'log':_0x3a83('0x3')});};exports[_0x3a83('0x4')]=function(_0x489450,_0x3fadeb){return client[_0x3a83('0x1')](_0x3a83('0x5'),{'body':_0x3fadeb,'options':{'where':{'id':_0x489450}},'log':_0x3a83('0x6')});}; \ No newline at end of file +var _0x870d=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x27689b,_0x207195){var _0x10c86b=function(_0x411ede){while(--_0x411ede){_0x27689b['push'](_0x27689b['shift']());}};_0x10c86b(++_0x207195);}(_0x870d,0x1eb));var _0xd870=function(_0x5bca71,_0x592224){_0x5bca71=_0x5bca71-0x0;var _0x2440e2=_0x870d[_0x5bca71];return _0x2440e2;};'use strict';var client=require(_0xd870('0x0'));exports[_0xd870('0x1')]=function(_0x4da954,_0x4337c4){return client['Request'](_0xd870('0x2'),{'body':_0x4337c4,'options':{'where':{'id':_0x4da954}},'log':_0xd870('0x3')});};exports[_0xd870('0x4')]=function(_0x15f2dc,_0x43999f){return client[_0xd870('0x5')](_0xd870('0x6'),{'body':_0x43999f,'options':{'where':{'id':_0x15f2dc}},'log':_0xd870('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 2f9e892..28fcfc4 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 _0x082a=['create','CreateFaxMessage','../client'];(function(_0x1eb919,_0x15d388){var _0x17f629=function(_0x114188){while(--_0x114188){_0x1eb919['push'](_0x1eb919['shift']());}};_0x17f629(++_0x15d388);}(_0x082a,0xe0));var _0xa082=function(_0x128128,_0x31df3a){_0x128128=_0x128128-0x0;var _0xaade61=_0x082a[_0x128128];return _0xaade61;};'use strict';var client=require(_0xa082('0x0'));exports[_0xa082('0x1')]=function(_0x7740d0){return client['Request'](_0xa082('0x2'),{'body':_0x7740d0,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xdd4c=['createFaxMessage','create','Request','CreateFaxMessage'];(function(_0x17e771,_0x55fd17){var _0x1f3a6d=function(_0x346ee3){while(--_0x346ee3){_0x17e771['push'](_0x17e771['shift']());}};_0x1f3a6d(++_0x55fd17);}(_0xdd4c,0x8d));var _0xcdd4=function(_0x2a5da5,_0x5d34e5){_0x2a5da5=_0x2a5da5-0x0;var _0x715df1=_0xdd4c[_0x2a5da5];return _0x715df1;};'use strict';var client=require('../client');exports[_0xcdd4('0x0')]=function(_0x1cca3f){return client[_0xcdd4('0x1')](_0xcdd4('0x2'),{'body':_0x1cca3f,'log':_0xcdd4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 76bd80f..401e62e 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 _0x6517=['timeout','strategy','User','Agents','online','faxPause','../client','getFaxQueues','GetFaxQueue','name'];(function(_0xb9d3b0,_0x112543){var _0x3da738=function(_0x25412d){while(--_0x25412d){_0xb9d3b0['push'](_0xb9d3b0['shift']());}};_0x3da738(++_0x112543);}(_0x6517,0x1b4));var _0x7651=function(_0x5db3c4,_0x128315){_0x5db3c4=_0x5db3c4-0x0;var _0x244398=_0x6517[_0x5db3c4];return _0x244398;};'use strict';var client=require(_0x7651('0x0'));exports[_0x7651('0x1')]=function(){return function(){return client['Request'](_0x7651('0x2'),{'options':{'raw':![],'attributes':['id',_0x7651('0x3'),_0x7651('0x4'),_0x7651('0x5')],'include':[{'model':_0x7651('0x6'),'as':_0x7651('0x7'),'attributes':['id','name',_0x7651('0x8'),_0x7651('0x9')]}]},'log':_0x7651('0x1')});};}; \ No newline at end of file +var _0xee25=['timeout','User','Agents','online','faxPause','getFaxQueues','GetFaxQueue','name'];(function(_0x12c178,_0x35a3f6){var _0x504051=function(_0x276053){while(--_0x276053){_0x12c178['push'](_0x12c178['shift']());}};_0x504051(++_0x35a3f6);}(_0xee25,0x8d));var _0x5ee2=function(_0x1759d8,_0x3bb3c7){_0x1759d8=_0x1759d8-0x0;var _0x560ed1=_0xee25[_0x1759d8];return _0x560ed1;};'use strict';var client=require('../client');exports[_0x5ee2('0x0')]=function(){return function(){return client['Request'](_0x5ee2('0x1'),{'options':{'raw':![],'attributes':['id',_0x5ee2('0x2'),_0x5ee2('0x3'),'strategy'],'include':[{'model':_0x5ee2('0x4'),'as':_0x5ee2('0x5'),'attributes':['id',_0x5ee2('0x2'),_0x5ee2('0x6'),_0x5ee2('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index bd5bc04..eb5f066 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 _0xd187=['update','Request','UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport'];(function(_0x5ade35,_0x35cec6){var _0x21d317=function(_0x4369b1){while(--_0x4369b1){_0x5ade35['push'](_0x5ade35['shift']());}};_0x21d317(++_0x35cec6);}(_0xd187,0x90));var _0x7d18=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0xd187[_0x2f2360];return _0x1cc8d3;};'use strict';var client=require(_0x7d18('0x0'));exports[_0x7d18('0x1')]=function(_0x3423d6){return client['Request'](_0x7d18('0x2'),{'body':_0x3423d6,'log':_0x7d18('0x2')});};exports[_0x7d18('0x3')]=function(_0x27509b,_0x305cf7){return client[_0x7d18('0x4')](_0x7d18('0x5'),{'body':_0x305cf7,'options':{'where':{'uniqueid':_0x27509b},'order':[['id',_0x7d18('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x5da8=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x392dc7,_0x2b5c91){var _0x440de9=function(_0xddb25b){while(--_0xddb25b){_0x392dc7['push'](_0x392dc7['shift']());}};_0x440de9(++_0x2b5c91);}(_0x5da8,0x1b0));var _0x85da=function(_0x3875e9,_0x8c1f0c){_0x3875e9=_0x3875e9-0x0;var _0x168265=_0x5da8[_0x3875e9];return _0x168265;};'use strict';var client=require(_0x85da('0x0'));exports[_0x85da('0x1')]=function(_0x90fa12){return client[_0x85da('0x2')](_0x85da('0x3'),{'body':_0x90fa12,'log':_0x85da('0x3')});};exports[_0x85da('0x4')]=function(_0x1c3876,_0x36d402){return client[_0x85da('0x2')](_0x85da('0x5'),{'body':_0x36d402,'options':{'where':{'uniqueid':_0x1c3876},'order':[['id',_0x85da('0x6')]],'limit':0x1},'log':_0x85da('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index ea15798..da937b4 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 _0xe511=['interval','../client','getIntervals','GetInterval','Interval','Intervals'];(function(_0x4cc228,_0x370c94){var _0x1a7d2d=function(_0x8e4132){while(--_0x8e4132){_0x4cc228['push'](_0x4cc228['shift']());}};_0x1a7d2d(++_0x370c94);}(_0xe511,0x16f));var _0x1e51=function(_0x5504fc,_0x2e161c){_0x5504fc=_0x5504fc-0x0;var _0xbad34c=_0xe511[_0x5504fc];return _0xbad34c;};'use strict';var client=require(_0x1e51('0x0'));exports[_0x1e51('0x1')]=function(){return function(){return client['Request'](_0x1e51('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x1e51('0x3'),'as':_0x1e51('0x4'),'attributes':['id','name',_0x1e51('0x5')]}]},'log':_0x1e51('0x1')});};}; \ No newline at end of file +var _0x01d3=['interval','../client','getIntervals','Request','GetInterval','Interval','Intervals'];(function(_0x2baa60,_0xf1dd85){var _0x459792=function(_0x51d329){while(--_0x51d329){_0x2baa60['push'](_0x2baa60['shift']());}};_0x459792(++_0xf1dd85);}(_0x01d3,0xa2));var _0x301d=function(_0x5d07a7,_0x43ff2e){_0x5d07a7=_0x5d07a7-0x0;var _0x95d216=_0x01d3[_0x5d07a7];return _0x95d216;};'use strict';var client=require(_0x301d('0x0'));exports[_0x301d('0x1')]=function(){return function(){return client[_0x301d('0x2')](_0x301d('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x301d('0x4'),'as':_0x301d('0x5'),'attributes':['id','name',_0x301d('0x6')]}]},'log':_0x301d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 03eb30e..dc041c1 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 _0x2172=['update','Request','UpdateMailInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x190644,_0x5149a5){var _0xf6768=function(_0x131416){while(--_0x131416){_0x190644['push'](_0x190644['shift']());}};_0xf6768(++_0x5149a5);}(_0x2172,0x197));var _0x2217=function(_0x1a2325,_0x3ae3e5){_0x1a2325=_0x1a2325-0x0;var _0xe7c76=_0x2172[_0x1a2325];return _0xe7c76;};'use strict';var client=require(_0x2217('0x0'));exports[_0x2217('0x1')]=function(_0x49c966,_0x405c6f){return client[_0x2217('0x2')](_0x2217('0x3'),{'body':_0x405c6f,'options':{'where':{'id':_0x49c966}},'log':'updateMailInteraction'});};exports[_0x2217('0x4')]=function(_0x226d97,_0x104b05){return client['Request']('AddTagsToMailInteraction',{'body':_0x104b05,'options':{'where':{'id':_0x226d97}},'log':_0x2217('0x5')});}; \ No newline at end of file +var _0x54e3=['Request','addTagsToChatInteraction','../client','updateMailInteraction','addTags'];(function(_0x524615,_0x6470f5){var _0x49fd51=function(_0x24d299){while(--_0x24d299){_0x524615['push'](_0x524615['shift']());}};_0x49fd51(++_0x6470f5);}(_0x54e3,0x124));var _0x354e=function(_0x1bc20d,_0x2ea2db){_0x1bc20d=_0x1bc20d-0x0;var _0x131e17=_0x54e3[_0x1bc20d];return _0x131e17;};'use strict';var client=require(_0x354e('0x0'));exports['update']=function(_0xe23b4d,_0x283dcb){return client['Request']('UpdateMailInteraction',{'body':_0x283dcb,'options':{'where':{'id':_0xe23b4d}},'log':_0x354e('0x1')});};exports[_0x354e('0x2')]=function(_0x54b971,_0x338bac){return client[_0x354e('0x3')]('AddTagsToMailInteraction',{'body':_0x338bac,'options':{'where':{'id':_0x54b971}},'log':_0x354e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 70a61a6..3ee8e0d 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 _0xb972=['createMailMessage','create'];(function(_0x109371,_0x441c8e){var _0x4fd858=function(_0x13504f){while(--_0x13504f){_0x109371['push'](_0x109371['shift']());}};_0x4fd858(++_0x441c8e);}(_0xb972,0x135));var _0x2b97=function(_0x319784,_0x47e6d4){_0x319784=_0x319784-0x0;var _0x1917da=_0xb972[_0x319784];return _0x1917da;};'use strict';var client=require('../client');exports[_0x2b97('0x0')]=function(_0x363176){return client['Request']('CreateMailMessage',{'body':_0x363176,'log':_0x2b97('0x1')});}; \ No newline at end of file +var _0xe5b6=['Request','../client','create'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0xe5b6,0x70));var _0x6e5b=function(_0x242b7c,_0x5a0fde){_0x242b7c=_0x242b7c-0x0;var _0x4e9563=_0xe5b6[_0x242b7c];return _0x4e9563;};'use strict';var client=require(_0x6e5b('0x0'));exports[_0x6e5b('0x1')]=function(_0x2c415b){return client[_0x6e5b('0x2')]('CreateMailMessage',{'body':_0x2c415b,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 099760b..e4163e2 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 _0x0207=['mailPause','../client','getMailQueues','Request','GetMailQueue','timeout','strategy','User','online'];(function(_0x51130b,_0x1cb05f){var _0x57b1d5=function(_0xf9796e){while(--_0xf9796e){_0x51130b['push'](_0x51130b['shift']());}};_0x57b1d5(++_0x1cb05f);}(_0x0207,0x14e));var _0x7020=function(_0x53d8df,_0x514c07){_0x53d8df=_0x53d8df-0x0;var _0x2a714e=_0x0207[_0x53d8df];return _0x2a714e;};'use strict';var client=require(_0x7020('0x0'));exports[_0x7020('0x1')]=function(){return function(){return client[_0x7020('0x2')](_0x7020('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x7020('0x4'),_0x7020('0x5')],'include':[{'model':_0x7020('0x6'),'as':'Agents','attributes':['id','name',_0x7020('0x7'),_0x7020('0x8')]}]},'log':_0x7020('0x1')});};}; \ No newline at end of file +var _0x5775=['name','Agents','online','mailPause','../client','getMailQueues','GetMailQueue'];(function(_0x5be901,_0x3d0145){var _0x194714=function(_0x4e8d4d){while(--_0x4e8d4d){_0x5be901['push'](_0x5be901['shift']());}};_0x194714(++_0x3d0145);}(_0x5775,0x15b));var _0x5577=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x5775[_0x34325b];return _0x3da348;};'use strict';var client=require(_0x5577('0x0'));exports[_0x5577('0x1')]=function(){return function(){return client['Request'](_0x5577('0x2'),{'options':{'raw':![],'attributes':['id',_0x5577('0x3'),'timeout','strategy'],'include':[{'model':'User','as':_0x5577('0x4'),'attributes':['id','name',_0x5577('0x5'),_0x5577('0x6')]}]},'log':_0x5577('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index b3d3666..92ead0f 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 _0xc0f7=['DESC','UpdateMailQueueReport','../client','create','Request','update'];(function(_0x3ff306,_0x23e474){var _0x4509d6=function(_0x598959){while(--_0x598959){_0x3ff306['push'](_0x3ff306['shift']());}};_0x4509d6(++_0x23e474);}(_0xc0f7,0x116));var _0x7c0f=function(_0x381d26,_0xaa0e81){_0x381d26=_0x381d26-0x0;var _0x3e7e4d=_0xc0f7[_0x381d26];return _0x3e7e4d;};'use strict';var client=require(_0x7c0f('0x0'));exports[_0x7c0f('0x1')]=function(_0x5d5c6a){return client[_0x7c0f('0x2')]('CreateMailQueueReport',{'body':_0x5d5c6a,'log':'CreateMailQueueReport'});};exports[_0x7c0f('0x3')]=function(_0x41b159,_0x2163aa){return client[_0x7c0f('0x2')]('UpdateMailQueueReport',{'body':_0x2163aa,'options':{'where':{'uniqueid':_0x41b159},'order':[['id',_0x7c0f('0x4')]],'limit':0x1},'log':_0x7c0f('0x5')});}; \ No newline at end of file +var _0x2477=['UpdateMailQueueReport','../client','CreateMailQueueReport','update','Request'];(function(_0x591935,_0x3a04f5){var _0x59bffa=function(_0x13f499){while(--_0x13f499){_0x591935['push'](_0x591935['shift']());}};_0x59bffa(++_0x3a04f5);}(_0x2477,0x187));var _0x7247=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0x2477[_0x2b152a];return _0x2ad4c7;};'use strict';var client=require(_0x7247('0x0'));exports['create']=function(_0x407f56){return client['Request'](_0x7247('0x1'),{'body':_0x407f56,'log':'CreateMailQueueReport'});};exports[_0x7247('0x2')]=function(_0x5e4451,_0x3b33f0){return client[_0x7247('0x3')](_0x7247('0x4'),{'body':_0x3b33f0,'options':{'where':{'uniqueid':_0x5e4451},'order':[['id','DESC']],'limit':0x1},'log':_0x7247('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index f5b0598..7b24b21 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 _0xd915=['updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','UpdateOpenchannelInteraction'];(function(_0x144e8d,_0x43ba2d){var _0x34c42c=function(_0x797b7c){while(--_0x797b7c){_0x144e8d['push'](_0x144e8d['shift']());}};_0x34c42c(++_0x43ba2d);}(_0xd915,0x6e));var _0x5d91=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xd915[_0x9cd4c3];return _0x4c9025;};'use strict';var client=require(_0x5d91('0x0'));exports['update']=function(_0x1d5504,_0x49374b){return client['Request'](_0x5d91('0x1'),{'body':_0x49374b,'options':{'where':{'id':_0x1d5504}},'log':_0x5d91('0x2')});};exports[_0x5d91('0x3')]=function(_0x137dc7,_0x5e1aef){return client[_0x5d91('0x4')](_0x5d91('0x5'),{'body':_0x5e1aef,'options':{'where':{'id':_0x137dc7}},'log':_0x5d91('0x6')});}; \ No newline at end of file +var _0xa225=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','updateOpenchannelInteraction'];(function(_0x4eba62,_0x54477a){var _0x246083=function(_0x5e575f){while(--_0x5e575f){_0x4eba62['push'](_0x4eba62['shift']());}};_0x246083(++_0x54477a);}(_0xa225,0xd5));var _0x5a22=function(_0x6f723e,_0x136bd0){_0x6f723e=_0x6f723e-0x0;var _0x2afaa1=_0xa225[_0x6f723e];return _0x2afaa1;};'use strict';var client=require(_0x5a22('0x0'));exports['update']=function(_0x168b15,_0x3bf85e){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x3bf85e,'options':{'where':{'id':_0x168b15}},'log':_0x5a22('0x1')});};exports[_0x5a22('0x2')]=function(_0x29a571,_0x3f9f77){return client['Request'](_0x5a22('0x3'),{'body':_0x3f9f77,'options':{'where':{'id':_0x29a571}},'log':_0x5a22('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 28863da..f2dd08a 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 _0xf3cd=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x99b691,_0x23f1b8){var _0x53180e=function(_0x134e0a){while(--_0x134e0a){_0x99b691['push'](_0x99b691['shift']());}};_0x53180e(++_0x23f1b8);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0xf3cd[_0x454165];return _0x56db53;};'use strict';var client=require(_0xdf3c('0x0'));exports[_0xdf3c('0x1')]=function(_0x31e5a5){return client[_0xdf3c('0x2')](_0xdf3c('0x3'),{'body':_0x31e5a5,'log':_0xdf3c('0x4')});}; \ No newline at end of file +var _0xcb91=['CreateOpenchannelMessage','createOpenchannelMessage','Request'];(function(_0x12287b,_0x24974c){var _0x3e7605=function(_0x589485){while(--_0x589485){_0x12287b['push'](_0x12287b['shift']());}};_0x3e7605(++_0x24974c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3f2d02,_0x2c7deb){_0x3f2d02=_0x3f2d02-0x0;var _0x54092b=_0xcb91[_0x3f2d02];return _0x54092b;};'use strict';var client=require('../client');exports['create']=function(_0x26fe42){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'body':_0x26fe42,'log':_0x1cb9('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 3c2774d..7e3cfee 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 _0x0ef6=['timeout','User','name','online','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x13cbfb,_0x5b397d){var _0x2b4439=function(_0x707df2){while(--_0x707df2){_0x13cbfb['push'](_0x13cbfb['shift']());}};_0x2b4439(++_0x5b397d);}(_0x0ef6,0x14d));var _0x60ef=function(_0x4197e6,_0x5036c6){_0x4197e6=_0x4197e6-0x0;var _0x385f3f=_0x0ef6[_0x4197e6];return _0x385f3f;};'use strict';var client=require('../client');exports[_0x60ef('0x0')]=function(){return function(){return client[_0x60ef('0x1')](_0x60ef('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x60ef('0x3'),'strategy'],'include':[{'model':_0x60ef('0x4'),'as':'Agents','attributes':['id',_0x60ef('0x5'),_0x60ef('0x6'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x06b0=['../client','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','getOpenchannelQueues'];(function(_0x51dfe2,_0xa2a9e){var _0x478344=function(_0x1df303){while(--_0x1df303){_0x51dfe2['push'](_0x51dfe2['shift']());}};_0x478344(++_0xa2a9e);}(_0x06b0,0xd1));var _0x006b=function(_0x5f572e,_0xa8ae3f){_0x5f572e=_0x5f572e-0x0;var _0x5e65dc=_0x06b0[_0x5f572e];return _0x5e65dc;};'use strict';var client=require(_0x006b('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x006b('0x1')](_0x006b('0x2'),{'options':{'raw':![],'attributes':['id',_0x006b('0x3'),_0x006b('0x4'),_0x006b('0x5')],'include':[{'model':_0x006b('0x6'),'as':_0x006b('0x7'),'attributes':['id',_0x006b('0x3'),_0x006b('0x8'),_0x006b('0x9')]}]},'log':_0x006b('0xa')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 363a0c5..f8242c4 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 _0x81c9=['DESC','CreateOpenchannelQueueReport','update','Request'];(function(_0x47cef7,_0x148fd9){var _0x2a4bcd=function(_0x1a8b23){while(--_0x1a8b23){_0x47cef7['push'](_0x47cef7['shift']());}};_0x2a4bcd(++_0x148fd9);}(_0x81c9,0xc5));var _0x981c=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x81c9[_0x4cf98e];return _0x1623ac;};'use strict';var client=require('../client');exports['create']=function(_0x28b0de){return client['Request'](_0x981c('0x0'),{'body':_0x28b0de,'log':_0x981c('0x0')});};exports[_0x981c('0x1')]=function(_0x5eb96b,_0xd6d8ad){return client[_0x981c('0x2')]('UpdateOpenchannelQueueReport',{'body':_0xd6d8ad,'options':{'where':{'uniqueid':_0x5eb96b},'order':[['id',_0x981c('0x3')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x102a=['Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x428301,_0x439ef9){var _0x1d1ada=function(_0xeab08a){while(--_0xeab08a){_0x428301['push'](_0x428301['shift']());}};_0x1d1ada(++_0x439ef9);}(_0x102a,0x1e4));var _0xa102=function(_0x5f44b9,_0x368af6){_0x5f44b9=_0x5f44b9-0x0;var _0x551ab9=_0x102a[_0x5f44b9];return _0x551ab9;};'use strict';var client=require(_0xa102('0x0'));exports[_0xa102('0x1')]=function(_0x51d44b){return client[_0xa102('0x2')]('CreateOpenchannelQueueReport',{'body':_0x51d44b,'log':_0xa102('0x3')});};exports['update']=function(_0x386b44,_0x257660){return client[_0xa102('0x2')](_0xa102('0x4'),{'body':_0x257660,'options':{'where':{'uniqueid':_0x386b44},'order':[['id',_0xa102('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 3248048..e4b8d02 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 _0xae3e=['updateSmsInteraction','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x200312,_0x524007){var _0x1d3ff0=function(_0x573eb9){while(--_0x573eb9){_0x200312['push'](_0x200312['shift']());}};_0x1d3ff0(++_0x524007);}(_0xae3e,0x17e));var _0xeae3=function(_0x27b423,_0x312583){_0x27b423=_0x27b423-0x0;var _0x5c11b8=_0xae3e[_0x27b423];return _0x5c11b8;};'use strict';var client=require(_0xeae3('0x0'));exports[_0xeae3('0x1')]=function(_0x3160c1,_0x10cd31){return client['Request']('UpdateSmsInteraction',{'body':_0x10cd31,'options':{'where':{'id':_0x3160c1}},'log':_0xeae3('0x2')});};exports['addTags']=function(_0x5d1327,_0x1e3a15){return client[_0xeae3('0x3')](_0xeae3('0x4'),{'body':_0x1e3a15,'options':{'where':{'id':_0x5d1327}},'log':_0xeae3('0x5')});}; \ No newline at end of file +var _0x2913=['Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x26afc5,_0x49844c){var _0x11d9aa=function(_0x504e89){while(--_0x504e89){_0x26afc5['push'](_0x26afc5['shift']());}};_0x11d9aa(++_0x49844c);}(_0x2913,0x123));var _0x3291=function(_0x4b93cd,_0x23cd51){_0x4b93cd=_0x4b93cd-0x0;var _0x3b6ad5=_0x2913[_0x4b93cd];return _0x3b6ad5;};'use strict';var client=require('../client');exports['update']=function(_0x38c4ef,_0x10a850){return client['Request'](_0x3291('0x0'),{'body':_0x10a850,'options':{'where':{'id':_0x38c4ef}},'log':_0x3291('0x1')});};exports[_0x3291('0x2')]=function(_0x1cb732,_0x22e946){return client[_0x3291('0x3')](_0x3291('0x4'),{'body':_0x22e946,'options':{'where':{'id':_0x1cb732}},'log':_0x3291('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index a3cbce2..6dc6183 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 _0xb6f5=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x4478b3,_0x4214a7){var _0x20a3fd=function(_0xb873f2){while(--_0xb873f2){_0x4478b3['push'](_0x4478b3['shift']());}};_0x20a3fd(++_0x4214a7);}(_0xb6f5,0x138));var _0x5b6f=function(_0x3dfeb9,_0x1cc6e4){_0x3dfeb9=_0x3dfeb9-0x0;var _0x412314=_0xb6f5[_0x3dfeb9];return _0x412314;};'use strict';var client=require(_0x5b6f('0x0'));exports[_0x5b6f('0x1')]=function(_0x4589e3){return client[_0x5b6f('0x2')](_0x5b6f('0x3'),{'body':_0x4589e3,'log':_0x5b6f('0x4')});}; \ No newline at end of file +var _0x5615=['../client','create','CreateSmsMessage','createSmsMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5615,0xa0));var _0x5561=function(_0x3d78dc,_0x190ed6){_0x3d78dc=_0x3d78dc-0x0;var _0x527293=_0x5615[_0x3d78dc];return _0x527293;};'use strict';var client=require(_0x5561('0x0'));exports[_0x5561('0x1')]=function(_0x529110){return client['Request'](_0x5561('0x2'),{'body':_0x529110,'log':_0x5561('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 308afee..265991a 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 _0x0bee=['../client','getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','User','smsPause'];(function(_0x22bae4,_0x22474b){var _0x2047b6=function(_0x849589){while(--_0x849589){_0x22bae4['push'](_0x22bae4['shift']());}};_0x2047b6(++_0x22474b);}(_0x0bee,0x117));var _0xe0be=function(_0x276cb6,_0x5531d3){_0x276cb6=_0x276cb6-0x0;var _0xd53542=_0x0bee[_0x276cb6];return _0xd53542;};'use strict';var client=require(_0xe0be('0x0'));exports[_0xe0be('0x1')]=function(){return function(){return client[_0xe0be('0x2')](_0xe0be('0x3'),{'options':{'raw':![],'attributes':['id',_0xe0be('0x4'),_0xe0be('0x5'),_0xe0be('0x6')],'include':[{'model':_0xe0be('0x7'),'as':'Agents','attributes':['id',_0xe0be('0x4'),'online',_0xe0be('0x8')]}]},'log':_0xe0be('0x1')});};}; \ No newline at end of file +var _0x48f5=['User','Agents','online','smsPause','../client','getSmsQueues','Request','GetSmsQueue','name','strategy'];(function(_0x321157,_0x25090c){var _0x11e86c=function(_0x6ae52c){while(--_0x6ae52c){_0x321157['push'](_0x321157['shift']());}};_0x11e86c(++_0x25090c);}(_0x48f5,0x68));var _0x548f=function(_0x321665,_0x44fbde){_0x321665=_0x321665-0x0;var _0x3dab65=_0x48f5[_0x321665];return _0x3dab65;};'use strict';var client=require(_0x548f('0x0'));exports[_0x548f('0x1')]=function(){return function(){return client[_0x548f('0x2')](_0x548f('0x3'),{'options':{'raw':![],'attributes':['id',_0x548f('0x4'),'timeout',_0x548f('0x5')],'include':[{'model':_0x548f('0x6'),'as':_0x548f('0x7'),'attributes':['id','name',_0x548f('0x8'),_0x548f('0x9')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index a87fb7e..e34b3fd 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 _0x7510=['CreateSmsQueueReport','create','Request'];(function(_0x45901b,_0x22e777){var _0x5d387d=function(_0x3fcfde){while(--_0x3fcfde){_0x45901b['push'](_0x45901b['shift']());}};_0x5d387d(++_0x22e777);}(_0x7510,0xa9));var _0x0751=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7510[_0x3947c9];return _0x2e7871;};'use strict';var client=require('../client');exports[_0x0751('0x0')]=function(_0x58625d){return client[_0x0751('0x1')](_0x0751('0x2'),{'body':_0x58625d,'log':_0x0751('0x2')});};exports['update']=function(_0x387016,_0x2021d5){return client[_0x0751('0x1')]('UpdateSmsQueueReport',{'body':_0x2021d5,'options':{'where':{'uniqueid':_0x387016},'order':[['id','DESC']],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x62b7=['CreateSmsQueueReport','UpdateSmsQueueReport','../client','create','Request'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x62b7,0x179));var _0x762b=function(_0x5ec09d,_0x391827){_0x5ec09d=_0x5ec09d-0x0;var _0x304aae=_0x62b7[_0x5ec09d];return _0x304aae;};'use strict';var client=require(_0x762b('0x0'));exports[_0x762b('0x1')]=function(_0xf532e9){return client[_0x762b('0x2')](_0x762b('0x3'),{'body':_0xf532e9,'log':_0x762b('0x3')});};exports['update']=function(_0x25ea19,_0x587d18){return client[_0x762b('0x2')](_0x762b('0x4'),{'body':_0x587d18,'options':{'where':{'uniqueid':_0x25ea19},'order':[['id','DESC']],'limit':0x1},'log':_0x762b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index fed856e..2a54558 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 _0x5d95=['mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','GetUser','agent','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0x5d95,0x113));var _0x55d9=function(_0x19982d,_0x5a69f9){_0x19982d=_0x19982d-0x0;var _0x5e35c5=_0x5d95[_0x19982d];return _0x5e35c5;};'use strict';var client=require('../client');exports[_0x55d9('0x0')]=function(){return function(){return client['Request'](_0x55d9('0x1'),{'options':{'raw':!![],'where':{'role':_0x55d9('0x2')},'attributes':['id',_0x55d9('0x3'),_0x55d9('0x4'),'pauseType','lastPauseAt',_0x55d9('0x5'),_0x55d9('0x6'),_0x55d9('0x7'),_0x55d9('0x8'),_0x55d9('0x9'),_0x55d9('0xa'),_0x55d9('0xb'),_0x55d9('0xc'),_0x55d9('0xd'),_0x55d9('0xe'),_0x55d9('0xf'),_0x55d9('0x10'),_0x55d9('0x11')]},'log':_0x55d9('0x0')});};}; \ No newline at end of file +var _0xa1d3=['smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','../client','getAgents','GetUser','agent','name','online','pauseType','lastPauseAt','mailPause'];(function(_0x6ef1a7,_0x388ae9){var _0x48e84a=function(_0x2f40f0){while(--_0x2f40f0){_0x6ef1a7['push'](_0x6ef1a7['shift']());}};_0x48e84a(++_0x388ae9);}(_0xa1d3,0x1b1));var _0x3a1d=function(_0x514299,_0x44a553){_0x514299=_0x514299-0x0;var _0x453188=_0xa1d3[_0x514299];return _0x453188;};'use strict';var client=require(_0x3a1d('0x0'));exports[_0x3a1d('0x1')]=function(){return function(){return client['Request'](_0x3a1d('0x2'),{'options':{'raw':!![],'where':{'role':_0x3a1d('0x3')},'attributes':['id',_0x3a1d('0x4'),_0x3a1d('0x5'),_0x3a1d('0x6'),_0x3a1d('0x7'),'voicePause','chatPause',_0x3a1d('0x8'),'faxPause',_0x3a1d('0x9'),_0x3a1d('0xa'),_0x3a1d('0xb'),_0x3a1d('0xc'),_0x3a1d('0xd'),_0x3a1d('0xe'),_0x3a1d('0xf'),_0x3a1d('0x10'),'openchannelCapacity']},'log':'getAgents'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index c2117dc..0cb9aed 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 _0x3351=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x3351,0x1b4));var _0x1335=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3351[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x1335('0x0'));exports['update']=function(_0x5a075d,_0x2bf4df){return client[_0x1335('0x1')](_0x1335('0x2'),{'body':_0x2bf4df,'options':{'where':{'id':_0x5a075d}},'log':_0x1335('0x3')});};exports[_0x1335('0x4')]=function(_0x173f26,_0x1f635d){return client['Request'](_0x1335('0x5'),{'body':_0x1f635d,'options':{'where':{'id':_0x173f26}},'log':_0x1335('0x6')});}; \ No newline at end of file +var _0xd82a=['../client','update','UpdateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0xd82a,0xbd));var _0xad82=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xd82a[_0x288f5e];return _0x476cc9;};'use strict';var client=require(_0xad82('0x0'));exports[_0xad82('0x1')]=function(_0x2fd97e,_0x40afa5){return client['Request'](_0xad82('0x2'),{'body':_0x40afa5,'options':{'where':{'id':_0x2fd97e}},'log':'updateWhatsappInteraction'});};exports[_0xad82('0x3')]=function(_0x3a0a37,_0x40b3d6){return client[_0xad82('0x4')](_0xad82('0x5'),{'body':_0x40b3d6,'options':{'where':{'id':_0x3a0a37}},'log':_0xad82('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index edbf746..bf3d04e 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 _0x4e02=['create','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x4e02,0x129));var _0x24e0=function(_0x3f8282,_0x11b607){_0x3f8282=_0x3f8282-0x0;var _0x50f918=_0x4e02[_0x3f8282];return _0x50f918;};'use strict';var client=require('../client');exports[_0x24e0('0x0')]=function(_0x279c29){return client['Request'](_0x24e0('0x1'),{'body':_0x279c29,'log':_0x24e0('0x2')});}; \ No newline at end of file +var _0x197d=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x35ca98,_0x4d5c36){var _0x46ef88=function(_0x144b8d){while(--_0x144b8d){_0x35ca98['push'](_0x35ca98['shift']());}};_0x46ef88(++_0x4d5c36);}(_0x197d,0xb5));var _0xd197=function(_0x4a8ce2,_0x563bbc){_0x4a8ce2=_0x4a8ce2-0x0;var _0x3c6905=_0x197d[_0x4a8ce2];return _0x3c6905;};'use strict';var client=require(_0xd197('0x0'));exports[_0xd197('0x1')]=function(_0x3470bc){return client[_0xd197('0x2')](_0xd197('0x3'),{'body':_0x3470bc,'log':_0xd197('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 82fe116..c10f9f1 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 _0xe493=['Request','GetWhatsappQueue','name','strategy','User','whatsappPause','../client','getWhatsappQueues'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xe493,0x7e));var _0x3e49=function(_0x40b9d0,_0x3537da){_0x40b9d0=_0x40b9d0-0x0;var _0x144b8d=_0xe493[_0x40b9d0];return _0x144b8d;};'use strict';var client=require(_0x3e49('0x0'));exports[_0x3e49('0x1')]=function(){return function(){return client[_0x3e49('0x2')](_0x3e49('0x3'),{'options':{'raw':![],'attributes':['id',_0x3e49('0x4'),'timeout',_0x3e49('0x5')],'include':[{'model':_0x3e49('0x6'),'as':'Agents','attributes':['id',_0x3e49('0x4'),'online',_0x3e49('0x7')]}]},'log':_0x3e49('0x1')});};}; \ No newline at end of file +var _0xc901=['whatsappPause','getWhatsappQueues','../client','timeout','strategy','Agents','name','online'];(function(_0x274108,_0x1e5879){var _0x516356=function(_0x5be079){while(--_0x5be079){_0x274108['push'](_0x274108['shift']());}};_0x516356(++_0x1e5879);}(_0xc901,0x142));var _0x1c90=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc901[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x1c90('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0x1c90('0x1'),_0x1c90('0x2')],'include':[{'model':'User','as':_0x1c90('0x3'),'attributes':['id',_0x1c90('0x4'),_0x1c90('0x5'),_0x1c90('0x6')]}]},'log':_0x1c90('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index ea9bff6..3036eb6 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 _0xf6e1=['Request','UpdateWhatsappQueueReport','../client','create','CreateWhatsappQueueReport','update'];(function(_0x298e73,_0x4a537c){var _0x5391d8=function(_0x1c010e){while(--_0x1c010e){_0x298e73['push'](_0x298e73['shift']());}};_0x5391d8(++_0x4a537c);}(_0xf6e1,0x10a));var _0x1f6e=function(_0x23c4b3,_0x1e1fa3){_0x23c4b3=_0x23c4b3-0x0;var _0x2c4c7e=_0xf6e1[_0x23c4b3];return _0x2c4c7e;};'use strict';var client=require(_0x1f6e('0x0'));exports[_0x1f6e('0x1')]=function(_0x5b0e0e){return client['Request'](_0x1f6e('0x2'),{'body':_0x5b0e0e,'log':_0x1f6e('0x2')});};exports[_0x1f6e('0x3')]=function(_0x537255,_0x138b0f){return client[_0x1f6e('0x4')](_0x1f6e('0x5'),{'body':_0x138b0f,'options':{'where':{'uniqueid':_0x537255},'order':[['id','DESC']],'limit':0x1},'log':_0x1f6e('0x5')});}; \ No newline at end of file +var _0x4a45=['update','DESC','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x4a45,0xb9));var _0x54a4=function(_0x1d6f6c,_0x39ace0){_0x1d6f6c=_0x1d6f6c-0x0;var _0x2d592d=_0x4a45[_0x1d6f6c];return _0x2d592d;};'use strict';var client=require(_0x54a4('0x0'));exports[_0x54a4('0x1')]=function(_0x131c73){return client[_0x54a4('0x2')](_0x54a4('0x3'),{'body':_0x131c73,'log':_0x54a4('0x3')});};exports[_0x54a4('0x4')]=function(_0x402f19,_0x319614){return client[_0x54a4('0x2')]('UpdateWhatsappQueueReport',{'body':_0x319614,'options':{'where':{'uniqueid':_0x402f19},'order':[['id',_0x54a4('0x5')]],'limit':0x1},'log':_0x54a4('0x6')});}; \ 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 f25bb76..e4e3e77 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 _0x802d=['number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','timeout','atimeout','channel','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x42d98f,_0x1b4bbf){var _0x460ebc=function(_0x3128ce){while(--_0x3128ce){_0x42d98f['push'](_0x42d98f['shift']());}};_0x460ebc(++_0x1b4bbf);}(_0x802d,0xed));var _0xd802=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x802d[_0x40ac5e];return _0x2839d6;};'use strict';var schema=require(_0xd802('0x0'));var _=require(_0xd802('0x1'));var util=require(_0xd802('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xd802('0x3'))(_0xd802('0x4'));var strategy=require(_0xd802('0x5'));var queue=schema({'name':{'type':_0xd802('0x6'),'required':!![],'message':_0xd802('0x7')},'timeout':{'type':_0xd802('0x8'),'message':_0xd802('0x9')}});function writeLog(_0x3c16b9,_0x1a44db,_0x53e082){return logger[_0xd802('0xa')](util[_0xd802('0xb')](_0xd802('0xc'),_0x3c16b9,_0x1a44db[_0xd802('0xd')],_0x53e082));}function handleFindAgent(_0x1a60dc){return function(_0x4c2582){return _0x4c2582[_0xd802('0xd')]['toLowerCase']()===_0x1a60dc[_0xd802('0xe')]();};}exports[_0xd802('0xf')]=function(_0x45c494,_0x35d632,_0x283519,_0x4447cf){return function(_0x212631){try{var _0x5000f4={'name':_0x35d632[0x0],'timeout':_0x35d632[0x1]};var _0x268aa8=queue[_0xd802('0x0')](_0x5000f4,{'typecast':!![]});if(_0x268aa8[_0xd802('0x10')]){logger[_0xd802('0x11')](_0xd802('0x12'),_0x45c494,_[_0xd802('0x13')](_0x268aa8,_0xd802('0x14'))[_0xd802('0x15')](',\x20'));_0x212631[_0xd802('0x16')]();}else{var _0x2f2e3b=_['find'](_0x283519['agents'],handleFindAgent(_0x5000f4[_0xd802('0xd')]));if(_0x2f2e3b){var _0x1e778d=(_0x5000f4[_0xd802('0x17')]||0xa)*0x3e8;var _0x8d7388,_0x24c225;var _0x5630b3=seqqueue['createQueue'](_0x1e778d);_0x5630b3['id']=_0x45c494;_0x5630b3[_0xd802('0x18')]=_0x1e778d;_0x5630b3[_0xd802('0x19')]=_0x4447cf[_0xd802('0x19')];writeLog(_0x45c494,_0x2f2e3b,util[_0xd802('0xb')]('START:%s',_0x1e778d));_0x283519[_0xd802('0x1a')][_0x45c494]['on'](_0xd802('0x1b'),function(){logger[_0xd802('0xa')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x45c494);clearTimeout(_0x24c225);_0x24c225=undefined;_0x5630b3[_0xd802('0x1c')]();if(_0x283519[_0xd802('0x1a')][_0x45c494]){delete _0x283519['rules'][_0x45c494];}_0x212631['stop']();});_0x283519[_0xd802('0x1a')][_0x45c494]['on'](_0xd802('0x1d'),function(){if(_0x283519['rules'][_0x45c494]){delete _0x283519[_0xd802('0x1a')][_0x45c494];}});_0x24c225=setTimeout(function(){logger[_0xd802('0xa')](_0xd802('0x1e'),_0x45c494);clearTimeout(_0x24c225);_0x5630b3[_0xd802('0x1c')]();_0x212631['next']();},_0x1e778d);strategy['agent'](_0x5630b3,_0x2f2e3b,_0x283519,_0x4447cf);}else{logger[_0xd802('0x11')](_0xd802('0x1f'),_0x45c494,_0x5000f4[_0xd802('0xd')]);_0x212631['stop']();}}}catch(_0x5d356f){console[_0xd802('0x20')](_0x5d356f);logger[_0xd802('0x11')](_0xd802('0x21'),_0x45c494,_0x5d356f[_0xd802('0x22')]);_0x212631[_0xd802('0x16')]();}};}; \ No newline at end of file +var _0x3f21=['[%s][AGENT]\x20ROUTING\x20STOPPED','complete','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','lodash','util','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','validate','length','error','[%s][AGENT]\x20%s','map','message','join','stop','timeout','createQueue','atimeout','channel','format','START:%s','rules','end'];(function(_0x201d02,_0x16330b){var _0x549a99=function(_0x10066a){while(--_0x10066a){_0x201d02['push'](_0x201d02['shift']());}};_0x549a99(++_0x16330b);}(_0x3f21,0xcd));var _0x13f2=function(_0x4343e2,_0x346afb){_0x4343e2=_0x4343e2-0x0;var _0x402b4f=_0x3f21[_0x4343e2];return _0x402b4f;};'use strict';var schema=require('validate');var _=require(_0x13f2('0x0'));var util=require(_0x13f2('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x13f2('0x2'))(_0x13f2('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x13f2('0x4')},'timeout':{'type':_0x13f2('0x5'),'message':_0x13f2('0x6')}});function writeLog(_0x52c7a7,_0x259bd3,_0x5e8ca6){return logger[_0x13f2('0x7')](util['format'](_0x13f2('0x8'),_0x52c7a7,_0x259bd3['name'],_0x5e8ca6));}function handleFindAgent(_0x1a6d1c){return function(_0x3347fa){return _0x3347fa[_0x13f2('0x9')]['toLowerCase']()===_0x1a6d1c['toLowerCase']();};}exports['consequence']=function(_0x126ede,_0x46ec9b,_0x3a8295,_0x10d537){return function(_0x53611c){try{var _0x511196={'name':_0x46ec9b[0x0],'timeout':_0x46ec9b[0x1]};var _0x1c26ac=queue[_0x13f2('0xa')](_0x511196,{'typecast':!![]});if(_0x1c26ac[_0x13f2('0xb')]){logger[_0x13f2('0xc')](_0x13f2('0xd'),_0x126ede,_[_0x13f2('0xe')](_0x1c26ac,_0x13f2('0xf'))[_0x13f2('0x10')](',\x20'));_0x53611c[_0x13f2('0x11')]();}else{var _0x2a7300=_['find'](_0x3a8295['agents'],handleFindAgent(_0x511196[_0x13f2('0x9')]));if(_0x2a7300){var _0x15830b=(_0x511196[_0x13f2('0x12')]||0xa)*0x3e8;var _0x294b05,_0x42fdd2;var _0x2d58ad=seqqueue[_0x13f2('0x13')](_0x15830b);_0x2d58ad['id']=_0x126ede;_0x2d58ad[_0x13f2('0x14')]=_0x15830b;_0x2d58ad[_0x13f2('0x15')]=_0x10d537[_0x13f2('0x15')];writeLog(_0x126ede,_0x2a7300,util[_0x13f2('0x16')](_0x13f2('0x17'),_0x15830b));_0x3a8295[_0x13f2('0x18')][_0x126ede]['on'](_0x13f2('0x19'),function(){logger[_0x13f2('0x7')](_0x13f2('0x1a'),_0x126ede);clearTimeout(_0x42fdd2);_0x42fdd2=undefined;_0x2d58ad['close']();if(_0x3a8295[_0x13f2('0x18')][_0x126ede]){delete _0x3a8295[_0x13f2('0x18')][_0x126ede];}_0x53611c[_0x13f2('0x11')]();});_0x3a8295[_0x13f2('0x18')][_0x126ede]['on'](_0x13f2('0x1b'),function(){if(_0x3a8295[_0x13f2('0x18')][_0x126ede]){delete _0x3a8295['rules'][_0x126ede];}});_0x42fdd2=setTimeout(function(){logger[_0x13f2('0x7')]('[%s][AGENT]\x20ROUTING\x20END',_0x126ede);clearTimeout(_0x42fdd2);_0x2d58ad[_0x13f2('0x1c')]();_0x53611c[_0x13f2('0x1d')]();},_0x15830b);strategy['agent'](_0x2d58ad,_0x2a7300,_0x3a8295,_0x10d537);}else{logger[_0x13f2('0xc')](_0x13f2('0x1e'),_0x126ede,_0x511196[_0x13f2('0x9')]);_0x53611c[_0x13f2('0x11')]();}}}catch(_0x2845f3){console['log'](_0x2845f3);logger[_0x13f2('0xc')](_0x13f2('0x1f'),_0x126ede,_0x2845f3[_0x13f2('0x20')]);_0x53611c[_0x13f2('0x11')]();}};}; \ 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 a099cf2..695bb58 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 _0xf494=['YYYY-MM-DD\x20HH:mm:ss','out','channel','account','upperFirst','InteractionId','created','body','getMustacheRender','Message','catch','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','postText','message','amazonlex','create','dialogState','Failed','stringify','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact'];(function(_0x336a64,_0x5a1cc4){var _0x500701=function(_0x2fa576){while(--_0x2fa576){_0x336a64['push'](_0x336a64['shift']());}};_0x500701(++_0x5a1cc4);}(_0xf494,0x1c6));var _0x4f49=function(_0x2e4441,_0x366096){_0x2e4441=_0x2e4441-0x0;var _0x3f1c00=_0xf494[_0x2e4441];return _0x3f1c00;};'use strict';var _=require(_0x4f49('0x0'));var moment=require(_0x4f49('0x1'));var AWS=require(_0x4f49('0x2'));var utils=require('./utils');var logger=require(_0x4f49('0x3'))(_0x4f49('0x4'));var rpc={'chatMessage':require(_0x4f49('0x5')),'openchannelMessage':require(_0x4f49('0x6')),'mailMessage':require(_0x4f49('0x7')),'smsMessage':require(_0x4f49('0x8')),'faxMessage':require(_0x4f49('0x9')),'whatsappMessage':require(_0x4f49('0xa'))};exports[_0x4f49('0xb')]=function(_0x413530,_0x42b0e8){return function(_0x5eb186){try{if(!_['isNil'](this[_0x4f49('0xc')][_0x4f49('0xd')])){logger[_0x4f49('0xe')](_0x4f49('0xf'),_0x413530,_0x4f49('0x10'));return _0x5eb186[_0x4f49('0x11')]();}var _0x151d8c={'ContactId':this[_0x4f49('0x12')]['id'],'sentAt':moment()['format'](_0x4f49('0x13')),'direction':_0x4f49('0x14')};var _0x5bcfe5=this[_0x4f49('0x15')];if(_0x5bcfe5==='chat'){_0x151d8c['ChatWebsiteId']=this[_0x4f49('0x16')]['id'];}else{_0x151d8c[_[_0x4f49('0x17')](_0x5bcfe5)+'AccountId']=this[_0x4f49('0x16')]['id'];}_0x151d8c[_[_0x4f49('0x17')](_0x5bcfe5)+_0x4f49('0x18')]=this[_0x4f49('0xc')]['id'];if(this[_0x4f49('0xc')][_0x4f49('0x19')]){var _0xfdb477=_0x42b0e8[0x4];if(!_['isEmpty'](_0xfdb477)){_0x151d8c[_0x4f49('0x1a')]=utils[_0x4f49('0x1b')](_0xfdb477,this);return rpc[_0x5bcfe5+_0x4f49('0x1c')]['create'](_0x151d8c)['then'](function(_0x2f0a0d){logger[_0x4f49('0xe')](_0x4f49('0xf'),_0x413530,_0x151d8c['body']);})[_0x4f49('0x1d')](function(_0x399be7){logger[_0x4f49('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x413530,JSON['stringify'](_0x399be7));})['finally'](function(){logger['info'](_0x4f49('0x1f'),_0x413530);_0x5eb186[_0x4f49('0x20')]();});}else{logger[_0x4f49('0xe')](_0x4f49('0x21'),_0x413530);_0x5eb186['stop']();}}else{var _0x416893=this;var _0x2aed27=new AWS[(_0x4f49('0x22'))]({'accessKeyId':_0x42b0e8[0x0],'secretAccessKey':_0x42b0e8[0x1],'region':_0x42b0e8[0x2]});var _0xaab5e7={'botAlias':_0x4f49('0x23'),'botName':_0x42b0e8[0x3],'inputText':this['message'][_0x4f49('0x1a')],'userId':this[_0x4f49('0x15')]+':'+this[_0x4f49('0xc')]['id']['toString']()};_0x2aed27[_0x4f49('0x24')](_0xaab5e7,function(_0x1d70a7,_0x32ca7b){if(_0x1d70a7){logger[_0x4f49('0x1e')](_0x4f49('0xf'),_0x413530,_0x1d70a7[_0x4f49('0x25')]);_0x5eb186['next']();}else if(_0x32ca7b&&_0x32ca7b['message']){_0x416893[_0x4f49('0x1a')][_0x4f49('0x26')]=_0x32ca7b;_0x151d8c['body']=_0x32ca7b[_0x4f49('0x25')];return rpc[_0x5bcfe5+_0x4f49('0x1c')][_0x4f49('0x27')](_0x151d8c)['then'](function(_0xc54070){logger[_0x4f49('0xe')](_0x4f49('0xf'),_0x413530,_0x151d8c[_0x4f49('0x1a')]);if(_0x32ca7b[_0x4f49('0x28')]==_0x4f49('0x29')){_0x5eb186['next']();}else{_0x5eb186['stop']();}})[_0x4f49('0x1d')](function(_0x2c00ee){logger[_0x4f49('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x413530,JSON[_0x4f49('0x2a')](_0x2c00ee));_0x5eb186[_0x4f49('0x11')]();});}else{_0x5eb186[_0x4f49('0x11')]();}});}}catch(_0x506b20){logger['error'](_0x4f49('0xf'),_0x413530,JSON[_0x4f49('0x2a')](_0x506b20));_0x5eb186[_0x4f49('0x20')]();}};}; \ No newline at end of file +var _0xba34=['body','getMustacheRender','Message','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','postText','amazonlex','Failed','stringify','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','ChatWebsiteId','upperFirst','account','InteractionId','created','isEmpty'];(function(_0x7ea912,_0x2c10eb){var _0x5bce6c=function(_0x5af2ed){while(--_0x5af2ed){_0x7ea912['push'](_0x7ea912['shift']());}};_0x5bce6c(++_0x2c10eb);}(_0xba34,0x119));var _0x4ba3=function(_0x441895,_0x23bf5d){_0x441895=_0x441895-0x0;var _0x5f77a4=_0xba34[_0x441895];return _0x5f77a4;};'use strict';var _=require(_0x4ba3('0x0'));var moment=require(_0x4ba3('0x1'));var AWS=require(_0x4ba3('0x2'));var utils=require(_0x4ba3('0x3'));var logger=require(_0x4ba3('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4ba3('0x5')),'smsMessage':require(_0x4ba3('0x6')),'faxMessage':require(_0x4ba3('0x7')),'whatsappMessage':require(_0x4ba3('0x8'))};exports[_0x4ba3('0x9')]=function(_0xb88621,_0xe5f99a){return function(_0x585f2d){try{if(!_[_0x4ba3('0xa')](this[_0x4ba3('0xb')][_0x4ba3('0xc')])){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0xb88621,_0x4ba3('0xf'));return _0x585f2d[_0x4ba3('0x10')]();}var _0x3f653c={'ContactId':this[_0x4ba3('0x11')]['id'],'sentAt':moment()[_0x4ba3('0x12')](_0x4ba3('0x13')),'direction':'out'};var _0x4619c5=this[_0x4ba3('0x14')];if(_0x4619c5==='chat'){_0x3f653c[_0x4ba3('0x15')]=this['account']['id'];}else{_0x3f653c[_[_0x4ba3('0x16')](_0x4619c5)+'AccountId']=this[_0x4ba3('0x17')]['id'];}_0x3f653c[_[_0x4ba3('0x16')](_0x4619c5)+_0x4ba3('0x18')]=this[_0x4ba3('0xb')]['id'];if(this[_0x4ba3('0xb')][_0x4ba3('0x19')]){var _0x3a74f7=_0xe5f99a[0x4];if(!_[_0x4ba3('0x1a')](_0x3a74f7)){_0x3f653c[_0x4ba3('0x1b')]=utils[_0x4ba3('0x1c')](_0x3a74f7,this);return rpc[_0x4619c5+_0x4ba3('0x1d')][_0x4ba3('0x1e')](_0x3f653c)[_0x4ba3('0x1f')](function(_0x25f584){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0xb88621,_0x3f653c['body']);})[_0x4ba3('0x20')](function(_0x788277){logger[_0x4ba3('0x21')](_0x4ba3('0xe'),_0xb88621,JSON['stringify'](_0x788277));})[_0x4ba3('0x22')](function(){logger[_0x4ba3('0xd')](_0x4ba3('0x23'),_0xb88621);_0x585f2d[_0x4ba3('0x24')]();});}else{logger[_0x4ba3('0xd')](_0x4ba3('0x25'),_0xb88621);_0x585f2d['stop']();}}else{var _0x57de6a=this;var _0x2278b0=new AWS['LexRuntime']({'accessKeyId':_0xe5f99a[0x0],'secretAccessKey':_0xe5f99a[0x1],'region':_0xe5f99a[0x2]});var _0x18dff5={'botAlias':_0x4ba3('0x26'),'botName':_0xe5f99a[0x3],'inputText':this[_0x4ba3('0x27')][_0x4ba3('0x1b')],'userId':this[_0x4ba3('0x14')]+':'+this[_0x4ba3('0xb')]['id']['toString']()};_0x2278b0[_0x4ba3('0x28')](_0x18dff5,function(_0x1f87e1,_0x5c28f9){if(_0x1f87e1){logger[_0x4ba3('0x21')]('[%s][AMAZONLEX]\x20%s',_0xb88621,_0x1f87e1[_0x4ba3('0x27')]);_0x585f2d[_0x4ba3('0x10')]();}else if(_0x5c28f9&&_0x5c28f9[_0x4ba3('0x27')]){_0x57de6a[_0x4ba3('0x1b')][_0x4ba3('0x29')]=_0x5c28f9;_0x3f653c[_0x4ba3('0x1b')]=_0x5c28f9[_0x4ba3('0x27')];return rpc[_0x4619c5+_0x4ba3('0x1d')][_0x4ba3('0x1e')](_0x3f653c)[_0x4ba3('0x1f')](function(_0x50c729){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0xb88621,_0x3f653c[_0x4ba3('0x1b')]);if(_0x5c28f9['dialogState']==_0x4ba3('0x2a')){_0x585f2d[_0x4ba3('0x10')]();}else{_0x585f2d[_0x4ba3('0x24')]();}})['catch'](function(_0x10cae6){logger[_0x4ba3('0x21')](_0x4ba3('0xe'),_0xb88621,JSON[_0x4ba3('0x2b')](_0x10cae6));_0x585f2d['next']();});}else{_0x585f2d['next']();}});}}catch(_0x38ef88){logger[_0x4ba3('0x21')](_0x4ba3('0xe'),_0xb88621,JSON[_0x4ba3('0x2b')](_0x38ef88));_0x585f2d[_0x4ba3('0x24')]();}};}; \ 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 2e7256b..9f6c430 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 _0x5ed2=['startsWith','Re:','Re:\x20','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','mail','Smtp','service','host','port','secure','authentication','auth','user','html','body',''+_['replace'](_0x3a541f[_0x25ed('0x2b')],_0x25ed('0x2c'),'';return mailRpc['sendMailMessage'](_0x48d576,_0x3a541f)[_0x25ed('0x2d')](function(_0x1517c3){logger['info'](_0x25ed('0x2e'),_0x8f49b6);_0x3a541f['messageId']=_0x1517c3[_0x25ed('0x12')][_0x25ed('0x2f')];return rpc[_0x2d8d08+'Message'][_0x25ed('0x30')](_0x3a541f);})[_0x25ed('0x2d')](function(_0x3714b6){logger['info'](_0x25ed('0x31'),_0x8f49b6,JSON[_0x25ed('0x32')](_0x3714b6));})[_0x25ed('0x33')](function(_0xf263ab){logger['error'](_0x25ed('0x34'),_0x8f49b6,JSON['stringify'](_0xf263ab));})[_0x25ed('0x35')](function(){_0x3d949b[_0x25ed('0x36')]();});}else{return rpc[this[_0x25ed('0x1a')]+'Message'][_0x25ed('0x30')](_0x3a541f)[_0x25ed('0x2d')](function(_0x1be23c){logger['info'](_0x25ed('0x31'),_0x8f49b6,_0x3a541f[_0x25ed('0x2b')]);})[_0x25ed('0x33')](function(_0x42ebf8){logger[_0x25ed('0x37')](_0x25ed('0x31'),_0x8f49b6,JSON[_0x25ed('0x32')](_0x42ebf8));})[_0x25ed('0x35')](function(){_0x3d949b[_0x25ed('0x36')]();});}}}catch(_0x427402){logger['error'](_0x25ed('0x31'),_0x8f49b6,JSON['stringify'](_0x427402));_0x3d949b[_0x25ed('0x38')]();}};}; \ No newline at end of file +var _0x910e=['[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','stringify','catch','error','finally','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','format','YYYY-MM-DD\x20HH:mm:ss','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','Message','account','Smtp','host','port','secure','authentication','auth','user','inReplyTo','html','','replace','body','','then'];(function(_0x19f5ad,_0xb7bc88){var _0x3c1507=function(_0x2b10df){while(--_0x2b10df){_0x19f5ad['push'](_0x19f5ad['shift']());}};_0x3c1507(++_0xb7bc88);}(_0x910e,0xef));var _0xe910=function(_0x5362bb,_0x5a7143){_0x5362bb=_0x5362bb-0x0;var _0x1cb94d=_0x910e[_0x5362bb];return _0x1cb94d;};'use strict';var _=require(_0xe910('0x0'));var moment=require(_0xe910('0x1'));var utils=require(_0xe910('0x2'));var logger=require(_0xe910('0x3'))(_0xe910('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe910('0x5')),'mailMessage':require(_0xe910('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe910('0x7'))};var mailRpc=require(_0xe910('0x8'));exports[_0xe910('0x9')]=function(_0x8cc5e9,_0x55267c){return function(_0x420c72){try{if(_0x55267c[0x0]==='1'&&(_[_0xe910('0xa')](this[_0xe910('0xb')][_0xe910('0xc')])||!this['interaction'][_0xe910('0xc')])){logger[_0xe910('0xd')](_0xe910('0xe'),_0x8cc5e9,_0xe910('0xf'));return _0x420c72[_0xe910('0x10')]();}var _0x14e5c9=this[_0xe910('0x11')];var _0x38e3f5={'body':utils['getMustacheRender'](_0x55267c[0x1],this),'ContactId':this['contact']['id'],'sentAt':moment()[_0xe910('0x12')](_0xe910('0x13')),'direction':'out'};if(this[_0xe910('0x14')]){_0x38e3f5['to']=this[_0xe910('0x14')][_0xe910('0x15')]||'';_0x38e3f5['cc']=this[_0xe910('0x14')]['cc']||'';_0x38e3f5[_0xe910('0x15')]=this[_0xe910('0x14')]['to']||'';_0x38e3f5[_0xe910('0x16')]=this[_0xe910('0x14')][_0xe910('0x16')]||'';_0x38e3f5[_0xe910('0x17')]=!![];if(this[_0xe910('0x14')]['subject']){_0x38e3f5[_0xe910('0x18')]='';_0x38e3f5['subject']+=_[_0xe910('0x19')](this[_0xe910('0x14')][_0xe910('0x18')],_0xe910('0x1a'))?'':_0xe910('0x1b');_0x38e3f5[_0xe910('0x18')]+=this[_0xe910('0x14')]['subject'];}}if(this[_0xe910('0x11')]===_0xe910('0x1c')){_0x38e3f5[_0xe910('0x1d')]=this['account']['id'];}else{_0x38e3f5[_[_0xe910('0x1e')](this[_0xe910('0x11')])+_0xe910('0x1f')]=this['account']['id'];}_0x38e3f5[_[_0xe910('0x1e')](this['channel'])+_0xe910('0x20')]=this[_0xe910('0xb')]['id'];if(rpc[this[_0xe910('0x11')]+_0xe910('0x21')]){if(this[_0xe910('0x11')]==='mail'){var _0x457663={'tls':{'rejectUnauthorized':![]}};if(this[_0xe910('0x22')][_0xe910('0x23')]['service']){_0x457663['service']=this[_0xe910('0x22')]['Smtp']['service'];}else{_0x457663[_0xe910('0x24')]=this['account'][_0xe910('0x23')][_0xe910('0x24')];_0x457663[_0xe910('0x25')]=this[_0xe910('0x22')][_0xe910('0x23')][_0xe910('0x25')];_0x457663[_0xe910('0x26')]=this[_0xe910('0x22')]['Smtp'][_0xe910('0x26')];}if(this['account'][_0xe910('0x23')][_0xe910('0x27')]){_0x457663[_0xe910('0x28')]={'user':this['account'][_0xe910('0x23')][_0xe910('0x29')],'pass':this['account'][_0xe910('0x23')]['pass']};}_0x38e3f5[_0xe910('0x2a')]=this['message']['messageId'];_0x38e3f5[_0xe910('0x2b')]=_0xe910('0x2c')+_[_0xe910('0x2d')](_0x38e3f5[_0xe910('0x2e')],_0xe910('0x2f'),_0xe910('0x30'))+_0xe910('0x31');return mailRpc['sendMailMessage'](_0x457663,_0x38e3f5)[_0xe910('0x32')](function(_0x8def7a){logger['info'](_0xe910('0x33'),_0x8cc5e9);_0x38e3f5[_0xe910('0x34')]=_0x8def7a[_0xe910('0x14')][_0xe910('0x34')];return rpc[_0x14e5c9+'Message']['create'](_0x38e3f5);})[_0xe910('0x32')](function(_0x282fa6){logger['info'](_0xe910('0xe'),_0x8cc5e9,JSON[_0xe910('0x35')](_0x282fa6));})[_0xe910('0x36')](function(_0xd9242){logger[_0xe910('0x37')]('[RPC][%s][AUTOREPLY]\x20%s',_0x8cc5e9,JSON[_0xe910('0x35')](_0xd9242));})[_0xe910('0x38')](function(){_0x420c72[_0xe910('0x10')]();});}else{return rpc[this[_0xe910('0x11')]+_0xe910('0x21')]['create'](_0x38e3f5)[_0xe910('0x32')](function(_0xacdcde){logger[_0xe910('0xd')]('[%s][AUTOREPLY]\x20%s',_0x8cc5e9,_0x38e3f5[_0xe910('0x2e')]);})['catch'](function(_0x5f088c){logger[_0xe910('0x37')](_0xe910('0xe'),_0x8cc5e9,JSON[_0xe910('0x35')](_0x5f088c));})[_0xe910('0x38')](function(){_0x420c72[_0xe910('0x10')]();});}}}catch(_0x2faf05){logger[_0xe910('0x37')](_0xe910('0xe'),_0x8cc5e9,JSON[_0xe910('0x35')](_0x2faf05));_0x420c72[_0xe910('0x39')]();}};}; \ 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 f1f4c7d..6e691c3 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 _0xf417=['routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','system','Interaction','channel','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stop','stringify','../../../../config/logger'];(function(_0x112036,_0x2a3aa3){var _0x4afc55=function(_0x483a7f){while(--_0x483a7f){_0x112036['push'](_0x112036['shift']());}};_0x4afc55(++_0x2a3aa3);}(_0xf417,0x8f));var _0x7f41=function(_0x5ce34a,_0x57887e){_0x5ce34a=_0x5ce34a-0x0;var _0x309350=_0xf417[_0x5ce34a];return _0x309350;};'use strict';var moment=require('moment');var logger=require(_0x7f41('0x0'))(_0x7f41('0x1'));var rpc={'chatInteraction':require(_0x7f41('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x7f41('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x7f41('0x4'))};exports['consequence']=function(_0x51b0cb,_0x5ad014,_0x5ecdb2,_0x1775d8){return function(_0x4e37b5){try{logger[_0x7f41('0x5')](_0x7f41('0x6'),_0x51b0cb,_0x5ad014[0x0]);var _0x507ac0={'closed':0x1,'closedAt':moment()[_0x7f41('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x7f41('0x8'),'disposition':_0x5ad014[0x0]};if(rpc[_0x1775d8['channel']+_0x7f41('0x9')]){rpc[_0x1775d8[_0x7f41('0xa')]+'Interaction']['update'](_0x1775d8[_0x7f41('0xb')]['id'],_0x507ac0)['then'](function(_0x4bc8ff){logger[_0x7f41('0x5')](_0x7f41('0xc'),_0x51b0cb,_0x1775d8[_0x7f41('0xb')]['id']);})[_0x7f41('0xd')](function(_0x637b2d){logger[_0x7f41('0xe')](_0x7f41('0xf'),_0x51b0cb,JSON['stringify'](_0x637b2d));})['finally'](function(){_0x4e37b5[_0x7f41('0x10')]();});}}catch(_0x4f5b74){logger['error'](_0x7f41('0xf'),_0x51b0cb,JSON[_0x7f41('0x11')](_0x4f5b74));_0x4e37b5[_0x7f41('0x10')]();}};}; \ No newline at end of file +var _0x31f0=['consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','stop','moment','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x55bfb9,_0x208357){var _0x13c0f3=function(_0x96c95b){while(--_0x96c95b){_0x55bfb9['push'](_0x55bfb9['shift']());}};_0x13c0f3(++_0x208357);}(_0x31f0,0xb7));var _0x031f=function(_0xcb01d1,_0x5e7471){_0xcb01d1=_0xcb01d1-0x0;var _0x569c54=_0x31f0[_0xcb01d1];return _0x569c54;};'use strict';var moment=require(_0x031f('0x0'));var logger=require('../../../../config/logger')(_0x031f('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x031f('0x2')),'smsInteraction':require(_0x031f('0x3')),'mailInteraction':require(_0x031f('0x4')),'faxInteraction':require(_0x031f('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x031f('0x6')]=function(_0x1a63ba,_0x4f6059,_0x4c0f94,_0x56328c){return function(_0x3dc98e){try{logger['info'](_0x031f('0x7'),_0x1a63ba,_0x4f6059[0x0]);var _0x4300b4={'closed':0x1,'closedAt':moment()[_0x031f('0x8')](_0x031f('0x9')),'closeReason':'system','disposition':_0x4f6059[0x0]};if(rpc[_0x56328c[_0x031f('0xa')]+_0x031f('0xb')]){rpc[_0x56328c[_0x031f('0xa')]+_0x031f('0xb')][_0x031f('0xc')](_0x56328c[_0x031f('0xd')]['id'],_0x4300b4)[_0x031f('0xe')](function(_0x3fd541){logger['info'](_0x031f('0xf'),_0x1a63ba,_0x56328c[_0x031f('0xd')]['id']);})[_0x031f('0x10')](function(_0x351052){logger[_0x031f('0x11')](_0x031f('0x12'),_0x1a63ba,JSON[_0x031f('0x13')](_0x351052));})['finally'](function(){_0x3dc98e[_0x031f('0x14')]();});}}catch(_0x23b40c){logger[_0x031f('0x11')](_0x031f('0x12'),_0x1a63ba,JSON[_0x031f('0x13')](_0x23b40c));_0x3dc98e['stop']();}};}; \ 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 480be7f..536e4b8 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 _0x4a2f=['interaction','created','isEmpty','Message','create','then','info','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','body','dialogflow','result','fulfillment','speech','metadata','endConversation','next','lodash','moment','apiai-promise','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId'];(function(_0x4a07c3,_0x2146ce){var _0x5df284=function(_0x16fe67){while(--_0x16fe67){_0x4a07c3['push'](_0x4a07c3['shift']());}};_0x5df284(++_0x2146ce);}(_0x4a2f,0x16e));var _0xf4a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a2f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf4a2('0x0'));var moment=require(_0xf4a2('0x1'));var apiai=require(_0xf4a2('0x2'));var md5=require('md5');var utils=require(_0xf4a2('0x3'));var logger=require(_0xf4a2('0x4'))('routing');var rpc={'chatMessage':require(_0xf4a2('0x5')),'openchannelMessage':require(_0xf4a2('0x6')),'mailMessage':require(_0xf4a2('0x7')),'smsMessage':require(_0xf4a2('0x8')),'faxMessage':require(_0xf4a2('0x9')),'whatsappMessage':require(_0xf4a2('0xa'))};exports[_0xf4a2('0xb')]=function(_0xad6baa,_0x51f76b){return function(_0x414418){try{if(!_[_0xf4a2('0xc')](this['interaction'][_0xf4a2('0xd')])){logger['info'](_0xf4a2('0xe'),_0xad6baa,_0xf4a2('0xf'));return _0x414418['next']();}var _0x42f0d5={'ContactId':this[_0xf4a2('0x10')]['id'],'sentAt':moment()[_0xf4a2('0x11')](_0xf4a2('0x12')),'direction':'out'};var _0x4f5a8a=this[_0xf4a2('0x13')];if(_0x4f5a8a===_0xf4a2('0x14')){_0x42f0d5[_0xf4a2('0x15')]=this[_0xf4a2('0x16')]['id'];}else{_0x42f0d5[_[_0xf4a2('0x17')](_0x4f5a8a)+_0xf4a2('0x18')]=this[_0xf4a2('0x16')]['id'];}_0x42f0d5[_['upperFirst'](_0x4f5a8a)+_0xf4a2('0x19')]=this[_0xf4a2('0x1a')]['id'];if(this[_0xf4a2('0x1a')][_0xf4a2('0x1b')]){var _0x635abb=_0x51f76b[0x2];if(!_[_0xf4a2('0x1c')](_0x635abb)){_0x42f0d5['body']=utils['getMustacheRender'](_0x635abb,this);return rpc[_0x4f5a8a+_0xf4a2('0x1d')][_0xf4a2('0x1e')](_0x42f0d5)[_0xf4a2('0x1f')](function(_0x54caf1){logger[_0xf4a2('0x20')](_0xf4a2('0xe'),_0xad6baa,_0x42f0d5['body']);})[_0xf4a2('0x21')](function(_0xec5dfc){logger[_0xf4a2('0x22')](_0xf4a2('0xe'),_0xad6baa,JSON[_0xf4a2('0x23')](_0xec5dfc));})['finally'](function(){logger[_0xf4a2('0x20')](_0xf4a2('0x24'),_0xad6baa);_0x414418[_0xf4a2('0x25')]();});}else{logger['info'](_0xf4a2('0x26'),_0xad6baa);_0x414418[_0xf4a2('0x25')]();}}else{var _0x3b5fbf=this;var _0x56864d=apiai(_0x51f76b[0x0],{'language':_0x51f76b[0x1]||'en'});return _0x56864d[_0xf4a2('0x27')](this[_0xf4a2('0x28')][_0xf4a2('0x29')],{'sessionId':md5(this['interaction']['id'])})[_0xf4a2('0x1f')](function(_0x186a8a){_0x3b5fbf[_0xf4a2('0x29')][_0xf4a2('0x2a')]=_0x186a8a;_0x42f0d5['body']=_0x186a8a[_0xf4a2('0x2b')][_0xf4a2('0x2c')][_0xf4a2('0x2d')];return rpc[_0x4f5a8a+_0xf4a2('0x1d')][_0xf4a2('0x1e')](_0x42f0d5)[_0xf4a2('0x1f')](function(_0x36e643){logger[_0xf4a2('0x20')](_0xf4a2('0xe'),_0xad6baa,_0x42f0d5[_0xf4a2('0x29')]);if(_0x186a8a[_0xf4a2('0x2b')][_0xf4a2('0x2e')][_0xf4a2('0x2f')]){_0x414418[_0xf4a2('0x30')]();}else{_0x414418[_0xf4a2('0x25')]();}})['catch'](function(_0x4c126a){logger['error'](_0xf4a2('0xe'),_0xad6baa,JSON[_0xf4a2('0x23')](_0x4c126a));_0x414418['next']();});})[_0xf4a2('0x21')](function(_0x23f00f){logger[_0xf4a2('0x22')](_0xf4a2('0xe'),_0xad6baa,_0x23f00f[_0xf4a2('0x28')]);_0x414418[_0xf4a2('0x30')]();});}}catch(_0xf9077d){logger[_0xf4a2('0x22')](_0xf4a2('0xe'),_0xad6baa,JSON[_0xf4a2('0x23')](_0xf9077d));_0x414418[_0xf4a2('0x25')]();}};}; \ No newline at end of file +var _0x2991=['format','YYYY-MM-DD\x20HH:mm:ss','out','chat','ChatWebsiteId','AccountId','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','dialogflow','result','fulfillment','speech','endConversation','next','moment','apiai-promise','md5','../../../../config/logger','routing','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x1ab9b2,_0xadcbe8){var _0x567d79=function(_0x1cf17d){while(--_0x1cf17d){_0x1ab9b2['push'](_0x1ab9b2['shift']());}};_0x567d79(++_0xadcbe8);}(_0x2991,0x70));var _0x1299=function(_0x2a27b9,_0x16738b){_0x2a27b9=_0x2a27b9-0x0;var _0x358625=_0x2991[_0x2a27b9];return _0x358625;};'use strict';var _=require('lodash');var moment=require(_0x1299('0x0'));var apiai=require(_0x1299('0x1'));var md5=require(_0x1299('0x2'));var utils=require('./utils');var logger=require(_0x1299('0x3'))(_0x1299('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1299('0x5')),'faxMessage':require(_0x1299('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x1299('0x7')]=function(_0xb60e6e,_0x25c875){return function(_0x35424e){try{if(!_[_0x1299('0x8')](this[_0x1299('0x9')][_0x1299('0xa')])){logger[_0x1299('0xb')](_0x1299('0xc'),_0xb60e6e,_0x1299('0xd'));return _0x35424e['next']();}var _0x1d339a={'ContactId':this['contact']['id'],'sentAt':moment()[_0x1299('0xe')](_0x1299('0xf')),'direction':_0x1299('0x10')};var _0x547df1=this['channel'];if(_0x547df1===_0x1299('0x11')){_0x1d339a[_0x1299('0x12')]=this['account']['id'];}else{_0x1d339a[_['upperFirst'](_0x547df1)+_0x1299('0x13')]=this['account']['id'];}_0x1d339a[_[_0x1299('0x14')](_0x547df1)+_0x1299('0x15')]=this['interaction']['id'];if(this[_0x1299('0x9')][_0x1299('0x16')]){var _0xf1c7e0=_0x25c875[0x2];if(!_[_0x1299('0x17')](_0xf1c7e0)){_0x1d339a[_0x1299('0x18')]=utils[_0x1299('0x19')](_0xf1c7e0,this);return rpc[_0x547df1+_0x1299('0x1a')][_0x1299('0x1b')](_0x1d339a)[_0x1299('0x1c')](function(_0x5955da){logger[_0x1299('0xb')]('[%s][DIALOGFLOW]\x20%s',_0xb60e6e,_0x1d339a[_0x1299('0x18')]);})[_0x1299('0x1d')](function(_0x5cb000){logger[_0x1299('0x1e')](_0x1299('0xc'),_0xb60e6e,JSON[_0x1299('0x1f')](_0x5cb000));})[_0x1299('0x20')](function(){logger['info'](_0x1299('0x21'),_0xb60e6e);_0x35424e['stop']();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xb60e6e);_0x35424e[_0x1299('0x22')]();}}else{var _0x36f070=this;var _0x1bf150=apiai(_0x25c875[0x0],{'language':_0x25c875[0x1]||'en'});return _0x1bf150['textRequest'](this[_0x1299('0x23')][_0x1299('0x18')],{'sessionId':md5(this[_0x1299('0x9')]['id'])})['then'](function(_0x51e863){_0x36f070[_0x1299('0x18')][_0x1299('0x24')]=_0x51e863;_0x1d339a[_0x1299('0x18')]=_0x51e863[_0x1299('0x25')][_0x1299('0x26')][_0x1299('0x27')];return rpc[_0x547df1+'Message'][_0x1299('0x1b')](_0x1d339a)['then'](function(_0x557235){logger['info'](_0x1299('0xc'),_0xb60e6e,_0x1d339a[_0x1299('0x18')]);if(_0x51e863[_0x1299('0x25')]['metadata'][_0x1299('0x28')]){_0x35424e[_0x1299('0x29')]();}else{_0x35424e[_0x1299('0x22')]();}})[_0x1299('0x1d')](function(_0x463dc2){logger[_0x1299('0x1e')](_0x1299('0xc'),_0xb60e6e,JSON[_0x1299('0x1f')](_0x463dc2));_0x35424e[_0x1299('0x29')]();});})[_0x1299('0x1d')](function(_0x45a8b2){logger[_0x1299('0x1e')]('[%s][DIALOGFLOW]\x20%s',_0xb60e6e,_0x45a8b2[_0x1299('0x23')]);_0x35424e[_0x1299('0x29')]();});}}catch(_0x54324d){logger['error']('[%s][DIALOGFLOW]\x20%s',_0xb60e6e,JSON[_0x1299('0x1f')](_0x54324d));_0x35424e[_0x1299('0x22')]();}};}; \ 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 dc13933..3211994 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 _0x7907=['stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found'];(function(_0x39d1d5,_0x42916a){var _0x9be0ab=function(_0x1abda5){while(--_0x1abda5){_0x39d1d5['push'](_0x39d1d5['shift']());}};_0x9be0ab(++_0x42916a);}(_0x7907,0x199));var _0x7790=function(_0x6156e3,_0x144d5c){_0x6156e3=_0x6156e3-0x0;var _0x3658cc=_0x7907[_0x6156e3];return _0x3658cc;};'use strict';var schema=require(_0x7790('0x0'));var _=require(_0x7790('0x1'));var htmlToText=require(_0x7790('0x2'));var utils=require(_0x7790('0x3'));var logger=require(_0x7790('0x4'))(_0x7790('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x7790('0x6')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x7790('0x7'),'message':_0x7790('0x8')}});exports[_0x7790('0x9')]=function(_0x437a23,_0x565f9e){return function(_0x3928b8){try{var _0x3cee93={'condition':htmlToText[_0x7790('0xa')](utils[_0x7790('0xb')](_0x565f9e[0x0],this),{'wordwrap':![]})[_0x7790('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x565f9e[0x1],'priorityFalse':_0x565f9e[0x2]};var _0x11e0b1=gotoif[_0x7790('0x0')](_0x3cee93,{'typecast':!![]});if(_0x11e0b1['length']){logger[_0x7790('0xd')](_0x7790('0xe'),_0x437a23,_[_0x7790('0xf')](_0x11e0b1,_0x7790('0x10'))[_0x7790('0x11')](',\x20'));_0x3928b8['stop']();}else{try{var _0x53df1c=eval('('+_0x3cee93[_0x7790('0x12')]+')');var _0x296fab=_0x53df1c?_0x3cee93[_0x7790('0x13')]:_0x3cee93[_0x7790('0x14')];logger[_0x7790('0x15')](_0x7790('0x16'),_0x437a23,_0x3cee93['condition'],_0x53df1c,_0x296fab||_0x7790('0x17'));if(_0x296fab){var _0x35e43a=_[_0x7790('0x18')](_0x3928b8['rules'](),{'p':_0x296fab});if(_0x35e43a>=0x0){logger[_0x7790('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x437a23,_0x296fab||_0x7790('0x17'),_0x35e43a);_0x3928b8[_0x7790('0x17')](_0x35e43a);}else{logger[_0x7790('0x15')](_0x7790('0x19'),_0x437a23,_0x296fab||'next');_0x3928b8[_0x7790('0x1a')]();}}else{_0x3928b8[_0x7790('0x17')]();}}catch(_0x163e3d){logger['error'](_0x7790('0x1b'),_0x437a23,_0x163e3d[_0x7790('0x10')]);_0x3928b8[_0x7790('0x1a')]();}}}catch(_0x3d7f3f){logger[_0x7790('0xd')](_0x7790('0xe'),_0x437a23,JSON[_0x7790('0x1c')](_0x3d7f3f));_0x3928b8['stop']();}};}; \ No newline at end of file +var _0xfe73=['getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','join','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','fromString'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0xfe73,0x1b5));var _0x3fe7=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xfe73[_0x24f31b];return _0x488401;};'use strict';var schema=require(_0x3fe7('0x0'));var _=require(_0x3fe7('0x1'));var htmlToText=require(_0x3fe7('0x2'));var utils=require(_0x3fe7('0x3'));var logger=require(_0x3fe7('0x4'))(_0x3fe7('0x5'));var gotoif=schema({'condition':{'type':_0x3fe7('0x6'),'required':!![],'message':_0x3fe7('0x7')},'priorityTrue':{'type':_0x3fe7('0x8'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x3fe7('0x8'),'message':_0x3fe7('0x9')}});exports['consequence']=function(_0x3805c4,_0x424edf){return function(_0x2ae7fa){try{var _0x3675ea={'condition':htmlToText[_0x3fe7('0xa')](utils[_0x3fe7('0xb')](_0x424edf[0x0],this),{'wordwrap':![]})[_0x3fe7('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x424edf[0x1],'priorityFalse':_0x424edf[0x2]};var _0x3f68ba=gotoif[_0x3fe7('0x0')](_0x3675ea,{'typecast':!![]});if(_0x3f68ba[_0x3fe7('0xd')]){logger['error'](_0x3fe7('0xe'),_0x3805c4,_[_0x3fe7('0xf')](_0x3f68ba,_0x3fe7('0x10'))[_0x3fe7('0x11')](',\x20'));_0x2ae7fa['stop']();}else{try{var _0x5552eb=eval('('+_0x3675ea['condition']+')');var _0x3bf136=_0x5552eb?_0x3675ea[_0x3fe7('0x12')]:_0x3675ea[_0x3fe7('0x13')];logger[_0x3fe7('0x14')](_0x3fe7('0x15'),_0x3805c4,_0x3675ea[_0x3fe7('0x16')],_0x5552eb,_0x3bf136||_0x3fe7('0x17'));if(_0x3bf136){var _0x262505=_[_0x3fe7('0x18')](_0x2ae7fa[_0x3fe7('0x19')](),{'p':_0x3bf136});if(_0x262505>=0x0){logger[_0x3fe7('0x14')](_0x3fe7('0x1a'),_0x3805c4,_0x3bf136||_0x3fe7('0x17'),_0x262505);_0x2ae7fa['next'](_0x262505);}else{logger['info'](_0x3fe7('0x1b'),_0x3805c4,_0x3bf136||_0x3fe7('0x17'));_0x2ae7fa[_0x3fe7('0x1c')]();}}else{_0x2ae7fa[_0x3fe7('0x17')]();}}catch(_0x5f9795){logger[_0x3fe7('0x1d')](_0x3fe7('0x1e'),_0x3805c4,_0x5f9795[_0x3fe7('0x10')]);_0x2ae7fa[_0x3fe7('0x1c')]();}}}catch(_0x4a4b30){logger[_0x3fe7('0x1d')](_0x3fe7('0xe'),_0x3805c4,JSON[_0x3fe7('0x1f')](_0x4a4b30));_0x2ae7fa['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index eb10afc..0fc8da1 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 _0xacf3=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','lodash','../../../../config/logger','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','info'];(function(_0x252f3b,_0x16a41e){var _0x510747=function(_0x5729a9){while(--_0x5729a9){_0x252f3b['push'](_0x252f3b['shift']());}};_0x510747(++_0x16a41e);}(_0xacf3,0xec));var _0x3acf=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xacf3[_0x27af45];return _0x18df21;};'use strict';var schema=require('validate');var _=require(_0x3acf('0x0'));var logger=require(_0x3acf('0x1'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x3acf('0x2')}});exports[_0x3acf('0x3')]=function(_0x88d54d,_0x15c48c){return function(_0x47bdf0){try{var _0x52d1b9={'priority':_0x15c48c[0x0]};var _0x40eebf=gotop[_0x3acf('0x4')](_0x52d1b9,{'typecast':!![]});if(_0x40eebf[_0x3acf('0x5')]){logger[_0x3acf('0x6')]('[%s][GOTOP]\x20%s',_0x88d54d,_[_0x3acf('0x7')](_0x40eebf,'message')[_0x3acf('0x8')](',\x20'));_0x47bdf0[_0x3acf('0x9')]();}else{logger['info'](_0x3acf('0xa'),_0x88d54d,_0x52d1b9['priority']);if(_0x52d1b9[_0x3acf('0xb')]){var _0x47fa07=_[_0x3acf('0xc')](_0x47bdf0[_0x3acf('0xd')](),{'p':_0x52d1b9['priority']});if(_0x47fa07>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x88d54d,_0x52d1b9['priority']||_0x3acf('0xe'),_0x47fa07);_0x47bdf0['next'](_0x47fa07);}else{logger[_0x3acf('0xf')](_0x3acf('0x10'),_0x88d54d,_0x52d1b9[_0x3acf('0xb')]||_0x3acf('0xe'));_0x47bdf0['stop']();}}else{_0x47bdf0[_0x3acf('0xe')]();}}}catch(_0x3818df){logger['error'](_0x3acf('0x11'),_0x88d54d,JSON['stringify'](_0x3818df));_0x47bdf0[_0x3acf('0x9')]();}};}; \ No newline at end of file +var _0xf4e8=['join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s'];(function(_0x201e1b,_0x1ddea6){var _0x256eb0=function(_0x573f93){while(--_0x573f93){_0x201e1b['push'](_0x201e1b['shift']());}};_0x256eb0(++_0x1ddea6);}(_0xf4e8,0x15f));var _0x8f4e=function(_0x41f7b2,_0x58547b){_0x41f7b2=_0x41f7b2-0x0;var _0x19ec6d=_0xf4e8[_0x41f7b2];return _0x19ec6d;};'use strict';var schema=require(_0x8f4e('0x0'));var _=require(_0x8f4e('0x1'));var logger=require(_0x8f4e('0x2'))(_0x8f4e('0x3'));var gotop=schema({'priority':{'type':_0x8f4e('0x4'),'required':!![],'message':_0x8f4e('0x5')}});exports['consequence']=function(_0x1b5446,_0x18721a){return function(_0x32cacc){try{var _0x1a7d8a={'priority':_0x18721a[0x0]};var _0x4eeed5=gotop[_0x8f4e('0x0')](_0x1a7d8a,{'typecast':!![]});if(_0x4eeed5[_0x8f4e('0x6')]){logger[_0x8f4e('0x7')](_0x8f4e('0x8'),_0x1b5446,_['map'](_0x4eeed5,'message')[_0x8f4e('0x9')](',\x20'));_0x32cacc[_0x8f4e('0xa')]();}else{logger['info'](_0x8f4e('0xb'),_0x1b5446,_0x1a7d8a[_0x8f4e('0xc')]);if(_0x1a7d8a[_0x8f4e('0xc')]){var _0x3e4fbc=_[_0x8f4e('0xd')](_0x32cacc[_0x8f4e('0xe')](),{'p':_0x1a7d8a['priority']});if(_0x3e4fbc>=0x0){logger[_0x8f4e('0xf')](_0x8f4e('0x10'),_0x1b5446,_0x1a7d8a[_0x8f4e('0xc')]||_0x8f4e('0x11'),_0x3e4fbc);_0x32cacc[_0x8f4e('0x11')](_0x3e4fbc);}else{logger['info'](_0x8f4e('0x12'),_0x1b5446,_0x1a7d8a[_0x8f4e('0xc')]||_0x8f4e('0x11'));_0x32cacc[_0x8f4e('0xa')]();}}else{_0x32cacc[_0x8f4e('0x11')]();}}}catch(_0x42ad56){logger[_0x8f4e('0x7')]('[%s][GOTOP]\x20%s',_0x1b5446,JSON[_0x8f4e('0x13')](_0x42ad56));_0x32cacc[_0x8f4e('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index ce86756..b5278a1 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 _0xc343=['create','then','next','catch','[%s][MESSAGE]\x20%s','stop','error','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','chat','ChatWebsiteId','channel','AccountId','account','upperFirst','InteractionId','Message'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc343,0x7f));var _0x3c34=function(_0x5955ac,_0xe6d86c){_0x5955ac=_0x5955ac-0x0;var _0x1fce1d=_0xc343[_0x5955ac];return _0x1fce1d;};'use strict';var _=require('lodash');var utils=require(_0x3c34('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x3c34('0x1')),'openchannelMessage':require(_0x3c34('0x2')),'mailMessage':require(_0x3c34('0x3')),'smsMessage':require(_0x3c34('0x4')),'faxMessage':require(_0x3c34('0x5')),'whatsappMessage':require(_0x3c34('0x6'))};exports[_0x3c34('0x7')]=function(_0x1c0613,_0x2d2a40){return function(_0x59a194){try{var _0xb1110f={'body':utils['getMustacheRender'](_0x2d2a40[0x0],this),'ContactId':this[_0x3c34('0x8')]['id']};if(this['channel']===_0x3c34('0x9')){_0xb1110f[_0x3c34('0xa')]=this['account']['id'];}else{_0xb1110f[_['upperFirst'](this[_0x3c34('0xb')])+_0x3c34('0xc')]=this[_0x3c34('0xd')]['id'];}_0xb1110f[_[_0x3c34('0xe')](this['channel'])+_0x3c34('0xf')]=this['interaction']['id'];if(rpc[this[_0x3c34('0xb')]+_0x3c34('0x10')]){return rpc[this[_0x3c34('0xb')]+_0x3c34('0x10')][_0x3c34('0x11')](_0xb1110f)[_0x3c34('0x12')](function(_0x5ada89){logger['info']('[%s][MESSAGE]\x20%s',_0x1c0613,_0xb1110f['body']);_0x59a194[_0x3c34('0x13')]();})[_0x3c34('0x14')](function(_0x346a06){logger['error'](_0x3c34('0x15'),_0x1c0613,JSON['stringify'](_0x346a06));_0x59a194[_0x3c34('0x16')]();});}}catch(_0x373326){logger[_0x3c34('0x17')](_0x3c34('0x15'),_0x1c0613,JSON['stringify'](_0x373326));_0x59a194['stop']();}};}; \ No newline at end of file +var _0x4784=['AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst'];(function(_0x2564be,_0x2bfdd7){var _0x47905e=function(_0x70eae1){while(--_0x70eae1){_0x2564be['push'](_0x2564be['shift']());}};_0x47905e(++_0x2bfdd7);}(_0x4784,0x19d));var _0x4478=function(_0x1b08c9,_0x514a3a){_0x1b08c9=_0x1b08c9-0x0;var _0x272c0c=_0x4784[_0x1b08c9];return _0x272c0c;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x4478('0x0'));var rpc={'chatMessage':require(_0x4478('0x1')),'openchannelMessage':require(_0x4478('0x2')),'mailMessage':require(_0x4478('0x3')),'smsMessage':require(_0x4478('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4478('0x5'))};exports['consequence']=function(_0x56315f,_0x4059f0){return function(_0xdec58e){try{var _0x3d392f={'body':utils[_0x4478('0x6')](_0x4059f0[0x0],this),'ContactId':this[_0x4478('0x7')]['id']};if(this[_0x4478('0x8')]==='chat'){_0x3d392f[_0x4478('0x9')]=this[_0x4478('0xa')]['id'];}else{_0x3d392f[_[_0x4478('0xb')](this[_0x4478('0x8')])+_0x4478('0xc')]=this['account']['id'];}_0x3d392f[_[_0x4478('0xb')](this[_0x4478('0x8')])+_0x4478('0xd')]=this[_0x4478('0xe')]['id'];if(rpc[this[_0x4478('0x8')]+'Message']){return rpc[this[_0x4478('0x8')]+_0x4478('0xf')][_0x4478('0x10')](_0x3d392f)[_0x4478('0x11')](function(_0x2fe0f2){logger[_0x4478('0x12')](_0x4478('0x13'),_0x56315f,_0x3d392f[_0x4478('0x14')]);_0xdec58e['next']();})[_0x4478('0x15')](function(_0x1437b8){logger[_0x4478('0x16')](_0x4478('0x13'),_0x56315f,JSON[_0x4478('0x17')](_0x1437b8));_0xdec58e[_0x4478('0x18')]();});}}catch(_0x3c6263){logger[_0x4478('0x16')]('[%s][MESSAGE]\x20%s',_0x56315f,JSON[_0x4478('0x17')](_0x3c6263));_0xdec58e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index bce166e..03f0f5d 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 _0xe750=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x358674,_0x2341d7){var _0x5e43ad=function(_0x5e1b29){while(--_0x5e1b29){_0x358674['push'](_0x358674['shift']());}};_0x5e43ad(++_0x2341d7);}(_0xe750,0x101));var _0x0e75=function(_0x44fdb7,_0x45e8fc){_0x44fdb7=_0x44fdb7-0x0;var _0x590b82=_0xe750[_0x44fdb7];return _0x590b82;};'use strict';var utils=require(_0x0e75('0x0'));var logger=require(_0x0e75('0x1'))(_0x0e75('0x2'));exports[_0x0e75('0x3')]=function(_0x1db337,_0x475f7f){return function(_0x1b77a5){try{logger[_0x0e75('0x4')](_0x0e75('0x5'),_0x1db337,utils[_0x0e75('0x6')](_0x475f7f[0x0],this));_0x1b77a5[_0x0e75('0x7')]();}catch(_0x5b6a09){logger['error'](_0x0e75('0x5'),_0x1db337,JSON[_0x0e75('0x8')](_0x5b6a09));_0x1b77a5[_0x0e75('0x9')]();}};}; \ No newline at end of file +var _0xa095=['getMustacheRender','error','stop','./utils','../../../../config/logger','routing','info','[%s][NOOP]\x20%s'];(function(_0x2f2d60,_0x4322bc){var _0x248feb=function(_0x151591){while(--_0x151591){_0x2f2d60['push'](_0x2f2d60['shift']());}};_0x248feb(++_0x4322bc);}(_0xa095,0xf3));var _0x5a09=function(_0x4c9316,_0x5c7f6f){_0x4c9316=_0x4c9316-0x0;var _0x146aad=_0xa095[_0x4c9316];return _0x146aad;};'use strict';var utils=require(_0x5a09('0x0'));var logger=require(_0x5a09('0x1'))(_0x5a09('0x2'));exports['consequence']=function(_0x43c9ad,_0x89200e){return function(_0x14e579){try{logger[_0x5a09('0x3')](_0x5a09('0x4'),_0x43c9ad,utils[_0x5a09('0x5')](_0x89200e[0x0],this));_0x14e579['next']();}catch(_0x252e18){logger[_0x5a09('0x6')](_0x5a09('0x4'),_0x43c9ad,JSON['stringify'](_0x252e18));_0x14e579[_0x5a09('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index d3290b5..1be0fd6 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 _0x9957=['seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','queue','joinAt','emit','clone','queue_id','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','waiting','accepted','body','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util'];(function(_0x596d89,_0x3f9156){var _0x571fd5=function(_0x1404ca){while(--_0x1404ca){_0x596d89['push'](_0x596d89['shift']());}};_0x571fd5(++_0x3f9156);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var seqqueue=require(_0x7995('0x3'));var moment=require('moment');var Redis=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var strategy=require('./strategy');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));var attributes=['id','queue_id',_0x7995('0xc'),_0x7995('0xd'),'from',_0x7995('0xe')];function emit(_0x3116fb,_0x18c8a3,_0x35b5fe){io['to'](_0x3116fb)[_0x7995('0xf')](_0x18c8a3,_0x35b5fe);}function emitChannelQueueInteraction(_0x1e400a,_0x341672,_0x524f7b,_0x245143,_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e=_[_0x7995('0x10')](_0x524f7b);_0x19a27e[_0x7995('0x11')]=_0x2cb37a;_0x19a27e[_0x7995('0xd')]=_0x341672;_0x19a27e[_0x7995('0xc')]=_0x245143;_0x19a27e['id']=_0x41c652;if(_0x581f22){_0xb0c872[util['format']('%sQueuesWaitingInteractions',_0x1e400a)][_0x41c652]=_[_0x7995('0x12')](_0x19a27e,attributes);}else{delete _0xb0c872[util[_0x7995('0x13')](_0x7995('0x14'),_0x1e400a)][_0x41c652];}emit(util[_0x7995('0x13')](_0x7995('0x15'),_0x1e400a,_0x341672),util[_0x7995('0x13')](_0x7995('0x16'),_0x1e400a,_0x581f22?_0x7995('0x17'):'remove'),_[_0x7995('0x12')](_0x19a27e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7995('0x18')),'chatQueueReport':require(_0x7995('0x19')),'smsQueueReport':require(_0x7995('0x1a')),'faxQueueReport':require(_0x7995('0x1b')),'whatsappQueueReport':require(_0x7995('0x1c'))};var queue=schema({'name':{'type':_0x7995('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x7995('0x1e')}});function startRouting(_0x5e6f90,_0x555f74,_0x3ec178,_0x3d463e){if(_0x5e6f90&&_0x555f74&&_0x3ec178){_0x555f74['waiting']+=0x1;var _0x3a9b54={'uniqueid':_0x5e6f90,'from':_0x3ec178['body']?_0x3ec178['body'][_0x7995('0x1f')]:'','joinAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'ContactId':_0x3ec178[_0x7995('0x21')]?_0x3ec178[_0x7995('0x21')]['id']:null,'ListId':_0x3ec178[_0x7995('0x22')]?_0x3ec178['list']['id']:null};_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x25')]=_0x555f74['id']||null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x26')]=_0x3ec178[_0x7995('0x27')]?_0x3ec178[_0x7995('0x27')]['id']:null;_0x3a9b54[_['upperFirst'](_0x3ec178[_0x7995('0x24')])+_0x7995('0x28')]=_0x3ec178[_0x7995('0x29')]?_0x3ec178[_0x7995('0x29')]['id']:null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+(_0x3ec178['channel']!==_0x7995('0x2a')?'AccountId':_0x7995('0x2b'))]=_0x3ec178[_0x7995('0xc')]?_0x3ec178[_0x7995('0xc')]['id']:null;logger[_0x7995('0x2c')](util[_0x7995('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x5e6f90,_0x555f74[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x3ec178['channel'],_0x555f74[_0x7995('0x2d')],_0x3a9b54,_0x3ec178[_0x7995('0xc')][_0x7995('0x2d')],_0x3ec178['message']['id'],!![],_0x3d463e,_0x555f74['id']);if(rpc[_0x3ec178['channel']+'QueueReport']){return rpc[_0x3ec178[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x2f')](_0x3a9b54)[_0x7995('0x30')](function(_0x2e3493){logger[_0x7995('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x481c74,_0xfa8f15,_0x5524af,_0x553671){if(_0x481c74&&_0xfa8f15){_0xfa8f15[_0x7995('0x32')]-=0x1;var _0x29fac5={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'acceptAt':moment()['format'](_0x7995('0x20')),'reason':_0x7995('0x33')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x481c74,_0xfa8f15[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x5524af[_0x7995('0x24')],_0xfa8f15['name'],_0x5524af[_0x7995('0x34')],_0x5524af['account'][_0x7995('0x2d')],_0x5524af[_0x7995('0x29')]['id'],![],_0x553671,_0xfa8f15['id']);if(rpc[_0x5524af[_0x7995('0x24')]+'QueueReport']){return rpc[_0x5524af['channel']+_0x7995('0x2e')]['update'](_0x481c74,_0x29fac5)['catch'](function(_0x3e99cd){logger[_0x7995('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x1baa15,_0x1922b4,_0x2b772f,_0x18667c){if(_0x1baa15&&_0x1922b4){_0x1922b4[_0x7995('0x32')]-=0x1;var _0x53002a={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'exitAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'reason':'timeout'};logger[_0x7995('0x2c')](util[_0x7995('0x13')](_0x7995('0x35'),_0x1baa15,_0x1922b4[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x2b772f[_0x7995('0x24')],_0x1922b4[_0x7995('0x2d')],_0x2b772f['body'],_0x2b772f[_0x7995('0xc')][_0x7995('0x2d')],_0x2b772f[_0x7995('0x29')]['id'],![],_0x18667c);if(rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')]){return rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x36')](_0x1baa15,_0x53002a)[_0x7995('0x30')](function(_0x447981){logger[_0x7995('0x31')](_0x7995('0x37'));});}}}function handleFindQueue(_0x7b4e67){return function(_0x53cda2){return _0x53cda2['name'][_0x7995('0x38')]()===_0x7b4e67[_0x7995('0x38')]();};}exports['consequence']=function(_0x4b0855,_0x3f8522,_0x4a9fef,_0x504a33){return function(_0x23da6b){try{var _0x36e28b={'name':_0x3f8522[0x0],'timeout':_0x3f8522[0x1]};var _0x35c8ff=queue['validate'](_0x36e28b,{'typecast':!![]});if(_0x35c8ff[_0x7995('0x39')]){logger['error'](_0x7995('0x3a'),_0x4b0855,_['map'](_0x35c8ff,'message')[_0x7995('0x3b')](',\x20'));_0x23da6b[_0x7995('0x3c')]();}else{var _0xc04e5=_[_0x7995('0x3d')](_0x4a9fef[_0x504a33['channel']+_0x7995('0x3e')],handleFindQueue(_0x36e28b[_0x7995('0x2d')]));if(_0xc04e5){startRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);var _0x31b347=(_0xc04e5[_0x7995('0x3f')]||0xa)*0x3e8;var _0x4e09b7=(_0x36e28b['timeout']||0x14)*0x3e8;var _0x1c37c6,_0x55791b;if(_0x31b347>_0x4e09b7){_0x4e09b7=_0x31b347;}var _0x23c41d=seqqueue['createQueue'](_0x31b347);_0x23c41d['id']=_0x4b0855;_0x23c41d[_0x7995('0x40')]=_0x31b347;_0x23c41d['qtimeout']=_0x4e09b7;_0x23c41d[_0x7995('0x24')]=_0x504a33[_0x7995('0x24')];_0x4a9fef['rules'][_0x4b0855]['on'](_0x7995('0x41'),function(){logger[_0x7995('0x2c')](_0x7995('0x42'),_0x4b0855);stopRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x1c37c6=undefined;_0x23c41d[_0x7995('0x43')](!![]);if(_0x4a9fef['rules'][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}_0x23da6b[_0x7995('0x3c')]();});_0x4a9fef[_0x7995('0x44')][_0x4b0855]['on']('complete',function(){if(_0x4a9fef[_0x7995('0x44')][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}});_0x1c37c6=setTimeout(function(){logger[_0x7995('0x2c')](_0x7995('0x45'),_0x4b0855);endRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x23c41d[_0x7995('0x43')](!![]);_0x23da6b['next']();},_0x4e09b7);switch(_0xc04e5[_0x7995('0x46')]){case _0x7995('0x47'):strategy['rrmemory'](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);break;default:strategy[_0x7995('0x48')](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);}}else{logger['error'](_0x7995('0x49'),_0x4b0855,_0x36e28b[_0x7995('0x2d')]);_0x23da6b[_0x7995('0x3c')]();}}}catch(_0x30e220){console[_0x7995('0x4a')](_0x30e220);logger[_0x7995('0x31')](_0x7995('0x3a'),_0x4b0855,_0x30e220['stack']);_0x23da6b[_0x7995('0x3c')]();}};}; \ No newline at end of file +var _0x9c44=['[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','atimeout','rules','end','close','complete','next','strategy','rrmemory','beepall','log','stack','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','list','QueueId','upperFirst','channel','InteractionId','message','AccountId','info','name','QueueReport','create','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','catch','error','update\x20queue\x20report','timeout'];(function(_0x142ec2,_0x5bb03d){var _0x45ef4e=function(_0x4bc513){while(--_0x4bc513){_0x142ec2['push'](_0x142ec2['shift']());}};_0x45ef4e(++_0x5bb03d);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x49c4('0x0'));var seqqueue=require(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var config=require(_0x49c4('0x4'));var logger=require(_0x49c4('0x5'))('routing');var strategy=require('./strategy');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));var attributes=['id',_0x49c4('0x9'),'account',_0x49c4('0xa'),_0x49c4('0xb'),_0x49c4('0xc')];function emit(_0x4487ca,_0x4c7d3a,_0x5ab4a3){io['to'](_0x4487ca)[_0x49c4('0xd')](_0x4c7d3a,_0x5ab4a3);}function emitChannelQueueInteraction(_0x313e73,_0x58cad7,_0xb611a1,_0x459d09,_0x4adb3c,_0x536d42,_0x1d19bf,_0x6d1b08){var _0x5487cd=_[_0x49c4('0xe')](_0xb611a1);_0x5487cd[_0x49c4('0x9')]=_0x6d1b08;_0x5487cd['queue']=_0x58cad7;_0x5487cd[_0x49c4('0xf')]=_0x459d09;_0x5487cd['id']=_0x4adb3c;if(_0x536d42){_0x1d19bf[util[_0x49c4('0x10')](_0x49c4('0x11'),_0x313e73)][_0x4adb3c]=_[_0x49c4('0x12')](_0x5487cd,attributes);}else{delete _0x1d19bf[util[_0x49c4('0x10')](_0x49c4('0x11'),_0x313e73)][_0x4adb3c];}emit(util[_0x49c4('0x10')](_0x49c4('0x13'),_0x313e73,_0x58cad7),util['format'](_0x49c4('0x14'),_0x313e73,_0x536d42?_0x49c4('0x15'):_0x49c4('0x16')),_[_0x49c4('0x12')](_0x5487cd,attributes));}var rpc={'openchannelQueueReport':require(_0x49c4('0x17')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x49c4('0x18')),'smsQueueReport':require(_0x49c4('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x49c4('0x1a'),'required':!![],'message':_0x49c4('0x1b')},'timeout':{'type':_0x49c4('0x1c'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x24856d,_0x50b151,_0x2cbd50,_0x1806c2){if(_0x24856d&&_0x50b151&&_0x2cbd50){_0x50b151[_0x49c4('0x1d')]+=0x1;var _0x291526={'uniqueid':_0x24856d,'from':_0x2cbd50[_0x49c4('0x1e')]?_0x2cbd50[_0x49c4('0x1e')][_0x49c4('0xb')]:'','joinAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'ContactId':_0x2cbd50['contact']?_0x2cbd50['contact']['id']:null,'ListId':_0x2cbd50['list']?_0x2cbd50[_0x49c4('0x20')]['id']:null};_0x291526[_['upperFirst'](_0x2cbd50['channel'])+_0x49c4('0x21')]=_0x50b151['id']||null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+_0x49c4('0x24')]=_0x2cbd50['interaction']?_0x2cbd50['interaction']['id']:null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+'MessageId']=_0x2cbd50[_0x49c4('0x25')]?_0x2cbd50[_0x49c4('0x25')]['id']:null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+(_0x2cbd50['channel']!=='chat'?_0x49c4('0x26'):'WebsiteId')]=_0x2cbd50[_0x49c4('0xf')]?_0x2cbd50[_0x49c4('0xf')]['id']:null;logger[_0x49c4('0x27')](util[_0x49c4('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x24856d,_0x50b151[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x2cbd50[_0x49c4('0x23')],_0x50b151[_0x49c4('0x28')],_0x291526,_0x2cbd50[_0x49c4('0xf')][_0x49c4('0x28')],_0x2cbd50[_0x49c4('0x25')]['id'],!![],_0x1806c2,_0x50b151['id']);if(rpc[_0x2cbd50[_0x49c4('0x23')]+_0x49c4('0x29')]){return rpc[_0x2cbd50[_0x49c4('0x23')]+_0x49c4('0x29')][_0x49c4('0x2a')](_0x291526)['catch'](function(_0x4f4495){logger['error'](_0x49c4('0x2b'));});}}}function stopRouting(_0x7ee704,_0x1eb035,_0x27e467,_0x28eb47){if(_0x7ee704&&_0x1eb035){_0x1eb035['waiting']-=0x1;var _0x38ad77={'leaveAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'acceptAt':moment()[_0x49c4('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0x49c4('0x27')](util[_0x49c4('0x10')](_0x49c4('0x2c'),_0x7ee704,_0x1eb035[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x27e467[_0x49c4('0x23')],_0x1eb035['name'],_0x27e467[_0x49c4('0x1e')],_0x27e467[_0x49c4('0xf')][_0x49c4('0x28')],_0x27e467['message']['id'],![],_0x28eb47,_0x1eb035['id']);if(rpc[_0x27e467['channel']+_0x49c4('0x29')]){return rpc[_0x27e467[_0x49c4('0x23')]+_0x49c4('0x29')][_0x49c4('0x2d')](_0x7ee704,_0x38ad77)[_0x49c4('0x2e')](function(_0x2cf897){logger[_0x49c4('0x2f')](_0x49c4('0x30'));});}}}function endRouting(_0x3209cd,_0x4e0209,_0x2d34ca,_0x5b96df){if(_0x3209cd&&_0x4e0209){_0x4e0209[_0x49c4('0x1d')]-=0x1;var _0x349791={'leaveAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'exitAt':moment()['format'](_0x49c4('0x1f')),'reason':_0x49c4('0x31')};logger[_0x49c4('0x27')](util['format'](_0x49c4('0x32'),_0x3209cd,_0x4e0209[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x2d34ca[_0x49c4('0x23')],_0x4e0209[_0x49c4('0x28')],_0x2d34ca[_0x49c4('0x1e')],_0x2d34ca[_0x49c4('0xf')][_0x49c4('0x28')],_0x2d34ca[_0x49c4('0x25')]['id'],![],_0x5b96df);if(rpc[_0x2d34ca[_0x49c4('0x23')]+_0x49c4('0x29')]){return rpc[_0x2d34ca[_0x49c4('0x23')]+'QueueReport'][_0x49c4('0x2d')](_0x3209cd,_0x349791)[_0x49c4('0x2e')](function(_0x32b172){logger[_0x49c4('0x2f')](_0x49c4('0x30'));});}}}function handleFindQueue(_0x29dd5d){return function(_0x1be62d){return _0x1be62d[_0x49c4('0x28')][_0x49c4('0x33')]()===_0x29dd5d[_0x49c4('0x33')]();};}exports[_0x49c4('0x34')]=function(_0xa3d59e,_0x326142,_0x4e38bc,_0x212366){return function(_0x49829e){try{var _0x104efb={'name':_0x326142[0x0],'timeout':_0x326142[0x1]};var _0x4915bc=queue[_0x49c4('0x35')](_0x104efb,{'typecast':!![]});if(_0x4915bc[_0x49c4('0x36')]){logger[_0x49c4('0x2f')](_0x49c4('0x37'),_0xa3d59e,_['map'](_0x4915bc,'message')[_0x49c4('0x38')](',\x20'));_0x49829e[_0x49c4('0x39')]();}else{var _0x38349b=_[_0x49c4('0x3a')](_0x4e38bc[_0x212366['channel']+_0x49c4('0x3b')],handleFindQueue(_0x104efb[_0x49c4('0x28')]));if(_0x38349b){startRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);var _0x2ccd47=(_0x38349b[_0x49c4('0x31')]||0xa)*0x3e8;var _0x81a674=(_0x104efb[_0x49c4('0x31')]||0x14)*0x3e8;var _0x1a9593,_0x3351c1;if(_0x2ccd47>_0x81a674){_0x81a674=_0x2ccd47;}var _0x3c4a1d=seqqueue['createQueue'](_0x2ccd47);_0x3c4a1d['id']=_0xa3d59e;_0x3c4a1d[_0x49c4('0x3c')]=_0x2ccd47;_0x3c4a1d['qtimeout']=_0x81a674;_0x3c4a1d[_0x49c4('0x23')]=_0x212366[_0x49c4('0x23')];_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]['on'](_0x49c4('0x3e'),function(){logger[_0x49c4('0x27')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0xa3d59e);stopRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);clearTimeout(_0x1a9593);_0x1a9593=undefined;_0x3c4a1d[_0x49c4('0x3f')](!![]);if(_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]){delete _0x4e38bc[_0x49c4('0x3d')][_0xa3d59e];}_0x49829e[_0x49c4('0x39')]();});_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]['on'](_0x49c4('0x40'),function(){if(_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]){delete _0x4e38bc['rules'][_0xa3d59e];}});_0x1a9593=setTimeout(function(){logger[_0x49c4('0x27')]('[%s][QUEUE]\x20APPLICATION\x20END',_0xa3d59e);endRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);clearTimeout(_0x1a9593);_0x3c4a1d[_0x49c4('0x3f')](!![]);_0x49829e[_0x49c4('0x41')]();},_0x81a674);switch(_0x38349b[_0x49c4('0x42')]){case _0x49c4('0x43'):strategy[_0x49c4('0x43')](_0x3c4a1d,_0x38349b,_0x4e38bc,_0x212366);break;default:strategy[_0x49c4('0x44')](_0x3c4a1d,_0x38349b,_0x4e38bc,_0x212366);}}else{logger[_0x49c4('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xa3d59e,_0x104efb[_0x49c4('0x28')]);_0x49829e[_0x49c4('0x39')]();}}}catch(_0x4a5c34){console[_0x49c4('0x45')](_0x4a5c34);logger[_0x49c4('0x2f')](_0x49c4('0x37'),_0xa3d59e,_0x4a5c34[_0x49c4('0x46')]);_0x49829e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 87bc93d..f576376 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 _0x41cd=['lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','bind','timeout','drained','prototype','handleRun','handleDrained','handleTimeout','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','TIMEOUT'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x41cd,0x1ad));var _0xd41c=function(_0x1cc060,_0x1afbdc){_0x1cc060=_0x1cc060-0x0;var _0x5c7e10=_0x41cd[_0x1cc060];return _0x5c7e10;};'use strict';var _=require(_0xd41c('0x0'));var uuid=require(_0xd41c('0x1'));var util=require(_0xd41c('0x2'));var logger=require(_0xd41c('0x3'))(_0xd41c('0x4'));var Agent=function(_0x1f52ba,_0x228759,_0x223d12,_0x520813){this[_0xd41c('0x5')]=uuid['v4']();this[_0xd41c('0x6')]=_0x1f52ba;this['agent']=_0x228759;this[_0xd41c('0x7')]=_0x223d12;this[_0xd41c('0x4')]=_0x520813;this[_0xd41c('0x6')][_0xd41c('0x8')](this['handleRun'][_0xd41c('0x9')](this),this['handleTimeout'][_0xd41c('0x9')](this));this[_0xd41c('0x6')]['on'](_0xd41c('0xa'),this['handleTimeout']['bind'](this));this['squeue']['on'](_0xd41c('0xb'),this['handleDrained'][_0xd41c('0x9')](this));};Agent[_0xd41c('0xc')][_0xd41c('0x8')]=function(){this['squeue']['push'](this[_0xd41c('0xd')][_0xd41c('0x9')](this),this['handleTimeout']['bind'](this));};Agent['prototype'][_0xd41c('0xe')]=function(){this[_0xd41c('0xf')](!![]);};Agent['prototype'][_0xd41c('0xd')]=function(_0xae0f09){logger[_0xd41c('0x10')](_0xd41c('0x11'),this['squeue']['id'],this[_0xd41c('0x12')]['id']);if(_[_0xd41c('0x13')](this[_0xd41c('0x7')][_0xd41c('0x14')][this[_0xd41c('0x12')]['id']])){logger[_0xd41c('0x10')](_0xd41c('0x15'),this[_0xd41c('0x6')]['id'],this[_0xd41c('0x12')]['id']);setTimeout(this[_0xd41c('0x8')]['bind'](this),0x3e8);}else{if(this[_0xd41c('0x4')][_0xd41c('0x16')]||util[_0xd41c('0x17')](this[_0xd41c('0x6')]['id'],this[_0xd41c('0x7')][_0xd41c('0x14')][this[_0xd41c('0x12')]['id']],this['squeue'][_0xd41c('0x18')],![])){this[_0xd41c('0x7')][_0xd41c('0x14')][this[_0xd41c('0x12')]['id']][_0xd41c('0x19')]=!![];this[_0xd41c('0x7')][_0xd41c('0x14')][this[_0xd41c('0x12')]['id']][_0xd41c('0x1a')]=undefined;util[_0xd41c('0x1b')](this[_0xd41c('0x5')],this['squeue']['id'],this[_0xd41c('0x7')]['agents'][this[_0xd41c('0x12')]['id']],null,this['routing']);util[_0xd41c('0x1c')](this[_0xd41c('0x6')]['id'],this[_0xd41c('0x7')][_0xd41c('0x14')][this[_0xd41c('0x12')]['id']],'RINGING'+(this[_0xd41c('0x4')][_0xd41c('0x16')]?':FORCED':''));}else{logger[_0xd41c('0x10')](_0xd41c('0x1d'),this[_0xd41c('0x6')]['id'],this[_0xd41c('0x12')]['id']);setTimeout(this[_0xd41c('0x8')][_0xd41c('0x9')](this),0x3e8);}}};Agent[_0xd41c('0xc')]['handleTimeout']=function(_0xaf2d9e){if(_['isNil'](this[_0xd41c('0x7')][_0xd41c('0x14')][this[_0xd41c('0x12')]['id']])){return logger['info'](_0xd41c('0x15'),this['squeue']['id'],this[_0xd41c('0x12')]['id']);}else{logger[_0xd41c('0x10')](_0xd41c('0x1e'),this[_0xd41c('0x6')]['id'],this[_0xd41c('0x12')]['id']);util['hideNotification'](this[_0xd41c('0x5')],this[_0xd41c('0x6')]['id'],this[_0xd41c('0x7')][_0xd41c('0x14')][this['agent']['id']],null,this[_0xd41c('0x4')]);this['realtime'][_0xd41c('0x14')][this[_0xd41c('0x12')]['id']][_0xd41c('0x19')]=![];this['realtime'][_0xd41c('0x14')][this[_0xd41c('0x12')]['id']]['busyQueue']=undefined;util['writeLog'](this[_0xd41c('0x6')]['id'],this['realtime'][_0xd41c('0x14')][this[_0xd41c('0x12')]['id']],_0xaf2d9e?_0xd41c('0x1f'):_0xd41c('0x20'));}if(!_0xaf2d9e){setTimeout(this['push'][_0xd41c('0x9')](this),0x3e8);}};function agent(_0x4190e7,_0x4f4ca5,_0x5d83f4,_0x3838d5){return new Agent(_0x4190e7,_0x4f4ca5,_0x5d83f4,_0x3838d5);}module['exports']=agent; \ No newline at end of file +var _0xcac8=['agent','realtime','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','info','agents','channel','busy','busyQueue','showNotification','writeLog','RINGING','forcedOwnership','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','routing','notificationId','squeue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcac8,0x163));var _0x8cac=function(_0x4da191,_0x2062f1){_0x4da191=_0x4da191-0x0;var _0x53689f=_0xcac8[_0x4da191];return _0x53689f;};'use strict';var _=require(_0x8cac('0x0'));var uuid=require(_0x8cac('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x8cac('0x2'));var Agent=function(_0x8a6db3,_0xf0da25,_0x193b30,_0x44796a){this[_0x8cac('0x3')]=uuid['v4']();this[_0x8cac('0x4')]=_0x8a6db3;this[_0x8cac('0x5')]=_0xf0da25;this[_0x8cac('0x6')]=_0x193b30;this[_0x8cac('0x2')]=_0x44796a;this[_0x8cac('0x4')][_0x8cac('0x7')](this[_0x8cac('0x8')][_0x8cac('0x9')](this),this[_0x8cac('0xa')][_0x8cac('0x9')](this));this[_0x8cac('0x4')]['on'](_0x8cac('0xb'),this['handleTimeout']['bind'](this));this[_0x8cac('0x4')]['on']('drained',this[_0x8cac('0xc')][_0x8cac('0x9')](this));};Agent['prototype'][_0x8cac('0x7')]=function(){this[_0x8cac('0x4')][_0x8cac('0x7')](this['handleRun'][_0x8cac('0x9')](this),this[_0x8cac('0xa')]['bind'](this));};Agent[_0x8cac('0xd')][_0x8cac('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0x8cac('0xd')][_0x8cac('0x8')]=function(_0x4d4765){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x8cac('0x4')]['id'],this[_0x8cac('0x5')]['id']);if(_['isNil'](this[_0x8cac('0x6')]['agents'][this[_0x8cac('0x5')]['id']])){logger[_0x8cac('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x8cac('0x4')]['id'],this[_0x8cac('0x5')]['id']);setTimeout(this['push'][_0x8cac('0x9')](this),0x3e8);}else{if(this[_0x8cac('0x2')]['forcedOwnership']||util['isAgentAvailable'](this[_0x8cac('0x4')]['id'],this[_0x8cac('0x6')][_0x8cac('0xf')][this['agent']['id']],this[_0x8cac('0x4')][_0x8cac('0x10')],![])){this['realtime'][_0x8cac('0xf')][this[_0x8cac('0x5')]['id']][_0x8cac('0x11')]=!![];this[_0x8cac('0x6')][_0x8cac('0xf')][this['agent']['id']][_0x8cac('0x12')]=undefined;util[_0x8cac('0x13')](this['notificationId'],this['squeue']['id'],this[_0x8cac('0x6')][_0x8cac('0xf')][this[_0x8cac('0x5')]['id']],null,this[_0x8cac('0x2')]);util[_0x8cac('0x14')](this[_0x8cac('0x4')]['id'],this['realtime'][_0x8cac('0xf')][this[_0x8cac('0x5')]['id']],_0x8cac('0x15')+(this['routing'][_0x8cac('0x16')]?':FORCED':''));}else{logger['info'](_0x8cac('0x17'),this[_0x8cac('0x4')]['id'],this[_0x8cac('0x5')]['id']);setTimeout(this[_0x8cac('0x7')]['bind'](this),0x3e8);}}};Agent['prototype'][_0x8cac('0xa')]=function(_0x1b04a7){if(_[_0x8cac('0x18')](this['realtime'][_0x8cac('0xf')][this[_0x8cac('0x5')]['id']])){return logger[_0x8cac('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x8cac('0x5')]['id']);}else{logger[_0x8cac('0xe')](_0x8cac('0x19'),this[_0x8cac('0x4')]['id'],this[_0x8cac('0x5')]['id']);util[_0x8cac('0x1a')](this[_0x8cac('0x3')],this[_0x8cac('0x4')]['id'],this[_0x8cac('0x6')]['agents'][this[_0x8cac('0x5')]['id']],null,this[_0x8cac('0x2')]);this[_0x8cac('0x6')]['agents'][this[_0x8cac('0x5')]['id']][_0x8cac('0x11')]=![];this[_0x8cac('0x6')]['agents'][this['agent']['id']][_0x8cac('0x12')]=undefined;util['writeLog'](this[_0x8cac('0x4')]['id'],this['realtime']['agents'][this['agent']['id']],_0x1b04a7?_0x8cac('0x1b'):_0x8cac('0x1c'));}if(!_0x1b04a7){setTimeout(this[_0x8cac('0x7')]['bind'](this),0x3e8);}};function agent(_0xa1d666,_0x49f401,_0x3aa580,_0x440848){return new Agent(_0xa1d666,_0x49f401,_0x3aa580,_0x440848);}module[_0x8cac('0x1d')]=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 f7b5c9b..8808678 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 _0xdc11=['info','isAgentAvailable','channel','writeLog','busyQueue','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','STOP','TIMEOUT','busy','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','queue','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','Agents','length','isNil','realtime','agents'];(function(_0x33e38c,_0x1e68a0){var _0x3090dd=function(_0x497cd6){while(--_0x497cd6){_0x33e38c['push'](_0x33e38c['shift']());}};_0x3090dd(++_0x1e68a0);}(_0xdc11,0x10b));var _0x1dc1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc11[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1dc1('0x0'));var uuid=require(_0x1dc1('0x1'));var util=require(_0x1dc1('0x2'));var logger=require(_0x1dc1('0x3'))('routing');var Beepall=function(_0x16cb99,_0x1be203,_0x362214,_0x2cc3c6){this[_0x1dc1('0x4')]=uuid['v4']();this[_0x1dc1('0x5')]=_0x16cb99;this[_0x1dc1('0x6')]=_0x1be203;this['realtime']=_0x362214;this[_0x1dc1('0x7')]=_0x2cc3c6;this[_0x1dc1('0x5')][_0x1dc1('0x8')](this[_0x1dc1('0x9')][_0x1dc1('0xa')](this),this[_0x1dc1('0xb')][_0x1dc1('0xa')](this));this[_0x1dc1('0x5')]['on'](_0x1dc1('0xc'),this['handleTimeout'][_0x1dc1('0xa')](this));this[_0x1dc1('0x5')]['on'](_0x1dc1('0xd'),this[_0x1dc1('0xe')][_0x1dc1('0xa')](this));};Beepall[_0x1dc1('0xf')][_0x1dc1('0x8')]=function(){this[_0x1dc1('0x5')]['push'](this[_0x1dc1('0x9')][_0x1dc1('0xa')](this),this['handleTimeout'][_0x1dc1('0xa')](this));};Beepall[_0x1dc1('0xf')][_0x1dc1('0xe')]=function(_0xdce582){this[_0x1dc1('0xb')](!![]);};Beepall[_0x1dc1('0xf')][_0x1dc1('0x9')]=function(_0x36a1f0){var _0x30a5eb=!![];if(!_['isNil'](this['queue'])&&!_['isNil'](this[_0x1dc1('0x6')][_0x1dc1('0x10')])&&this[_0x1dc1('0x6')][_0x1dc1('0x10')][_0x1dc1('0x11')]>0x0){for(var _0x51984d=0x0,_0x194c62;_0x51984d0x0){for(var _0x16aa3e=0x0,_0x582bca;_0x16aa3e0x0&&_0x229ea0[_0x1d0c1a+'CurrentCapacity']>=_0x229ea0[_0x1d0c1a+'Capacity']){writeLog(_0x16ad67,_0x229ea0,_0x1d0c1a['toUpperCase']()+_0xb354('0x28'));return![];}}return!![];};exports[_0xb354('0x29')]=function(_0x4d738c,_0x26a9a8,_0x2be501,_0x325c7d,_0x1f3d0d){return sendNotification(!![],_0x4d738c,_0x26a9a8,_0x2be501,_0x325c7d,_0x1f3d0d);};exports[_0xb354('0x2a')]=function(_0x152135,_0x2e7b4b,_0x501f08,_0x22a670,_0x443982){return sendNotification(![],_0x152135,_0x2e7b4b,_0x501f08,_0x22a670,_0x443982);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x77f1=['emit','format','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','util','../utils','mustache','routing','redis','localhost','socket.io-emitter'];(function(_0x214a25,_0x15071d){var _0x405988=function(_0x5c6fc1){while(--_0x5c6fc1){_0x214a25['push'](_0x214a25['shift']());}};_0x405988(++_0x15071d);}(_0x77f1,0x1dd));var _0x177f=function(_0x1cdb6e,_0x461158){_0x1cdb6e=_0x1cdb6e-0x0;var _0x11f675=_0x77f1[_0x1cdb6e];return _0x11f675;};'use strict';var _=require('lodash');var util=require(_0x177f('0x0'));var utils=require(_0x177f('0x1'));var Mustache=require(_0x177f('0x2'));var Redis=require('ioredis');var config=require('../../../../../config/environment');var logger=require('../../../../../config/logger')(_0x177f('0x3'));config[_0x177f('0x4')]=_['defaults'](config[_0x177f('0x4')],{'host':_0x177f('0x5'),'port':0x18eb});var io=require(_0x177f('0x6'))(new Redis(config[_0x177f('0x4')]));function emit(_0x1bd6b3,_0x58525a,_0x3f43c1){io['to'](_0x1bd6b3)[_0x177f('0x7')](_0x58525a,_0x3f43c1);}function sendNotification(_0x480125,_0xba9371,_0x51a488,_0x2652b4,_0x4e1bab,_0x2050c2){io['to'](util[_0x177f('0x8')]('user:%s',_0x2652b4[_0x177f('0x9')]))[_0x177f('0x7')](_0x177f('0xa'),_0x2652b4);var _0xf5086c=_0x2050c2||{};var _0x233919=_0x51a488[_0x177f('0xb')]('.');var _0x35e9f3={'uniqueid':_0xba9371,'channel':_0x233919[0x0],'id':_0x233919[0x1],'title':_0x233919[0x0]+_0x177f('0xc'),'interactionId':_0x233919[0x2],'queue':_0x4e1bab?_0x4e1bab['name']:null,'sound':_0xf5086c[_0x177f('0xd')][_0x177f('0xe')],'shake':_0xf5086c[_0x177f('0xd')][_0x177f('0xf')]};try{if(!_0xf5086c['body']){_0xf5086c[_0x177f('0x10')]={};}if(_0x4e1bab){_0xf5086c[_0x177f('0x10')][_0x177f('0x11')]=_0x4e1bab;}else if(_0xf5086c['body']['queue']){delete _0xf5086c[_0x177f('0x10')][_0x177f('0x11')];}_0x35e9f3[_0x177f('0x12')]=utils[_0x177f('0x13')](_0xf5086c[_0x177f('0xd')][_0x177f('0x14')],_0xf5086c);}catch(_0x2900de){_0x35e9f3[_0x177f('0x12')]=_0x177f('0x15');logger[_0x177f('0x16')](util['format'](_0x177f('0x17'),_0xba9371,_0x2900de[_0x177f('0x18')]));}io['to'](util['format'](_0x177f('0x19'),_0x2652b4[_0x177f('0x9')]))[_0x177f('0x7')](util[_0x177f('0x8')](_0x177f('0x1a'),_0x480125?_0x177f('0x1b'):_0x177f('0x1c')),_0x35e9f3);}function writeLog(_0x3d3daf,_0x3d48eb,_0x377b95){return logger['info'](util[_0x177f('0x8')](_0x177f('0x1d'),_0x3d3daf,_0x3d48eb[_0x177f('0x9')],_0x377b95));}exports[_0x177f('0x1e')]=function(_0x2880e6,_0x28c762,_0x7adaaf,_0x5eeffa){if(_0x28c762['busy']){writeLog(_0x2880e6,_0x28c762,_0x177f('0x1f'));return![];}if(!_0x28c762[_0x177f('0x20')]){writeLog(_0x2880e6,_0x28c762,_0x177f('0x21'));return![];}if(_0x28c762[_0x7adaaf+_0x177f('0x22')]){writeLog(_0x2880e6,_0x28c762,_0x177f('0x23'));return![];}if(_0x5eeffa&&_0x28c762[_0x177f('0x24')](_0x7adaaf+'Capacity')&&_0x28c762[_0x177f('0x24')](_0x7adaaf+_0x177f('0x25'))){if(_0x28c762[_0x7adaaf+_0x177f('0x26')]>0x0&&_0x28c762[_0x7adaaf+_0x177f('0x25')]>=_0x28c762[_0x7adaaf+_0x177f('0x26')]){writeLog(_0x2880e6,_0x28c762,_0x7adaaf[_0x177f('0x27')]()+_0x177f('0x28'));return![];}}return!![];};exports[_0x177f('0x29')]=function(_0x1ae57e,_0x2a64d7,_0x13f570,_0x3d7f1c,_0x25d876){return sendNotification(!![],_0x1ae57e,_0x2a64d7,_0x13f570,_0x3d7f1c,_0x25d876);};exports[_0x177f('0x2a')]=function(_0xdf7bd,_0x4a1b02,_0xfa8ad0,_0x1df4e4,_0x4b9c40){return sendNotification(![],_0xdf7bd,_0x4a1b02,_0xfa8ad0,_0x1df4e4,_0x4b9c40);};exports[_0x177f('0x2b')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 336ab81..629936a 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 _0x0551=['message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','exec','trim','replace','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','validate','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map'];(function(_0x484bf4,_0x2b975c){var _0x31c683=function(_0x1cdda2){while(--_0x1cdda2){_0x484bf4['push'](_0x484bf4['shift']());}};_0x31c683(++_0x2b975c);}(_0x0551,0x157));var _0x1055=function(_0x4bfd95,_0x1c3b3b){_0x4bfd95=_0x4bfd95-0x0;var _0x1484cd=_0x0551[_0x4bfd95];return _0x1484cd;};'use strict';var schema=require(_0x1055('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x1055('0x1'));var logger=require('../../../../config/logger')(_0x1055('0x2'));var system=schema({'command':{'type':_0x1055('0x3'),'required':!![],'message':_0x1055('0x4')}});exports['consequence']=function(_0x1e3d12,_0x4c7de4){return function(_0x1d2bbe){try{var _0x499c5d={'command':_0x4c7de4[0x0]};var _0x5c5068=system[_0x1055('0x0')](_0x499c5d,{'typecast':!![]});if(_0x5c5068[_0x1055('0x5')]){logger[_0x1055('0x6')](_0x1055('0x7'),_0x1e3d12,_[_0x1055('0x8')](_0x5c5068,_0x1055('0x9'))[_0x1055('0xa')](',\x20'));logger['info'](_0x1055('0xb'),_0x1e3d12);_0x1d2bbe[_0x1055('0xc')]();}else{var _0x540e1b=this;var _0x23420b=utils[_0x1055('0xd')](_0x4c7de4[0x0],this);logger[_0x1055('0xe')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x1e3d12,_0x23420b);sh[_0x1055('0xf')](_[_0x1055('0x10')](_0x23420b),function(_0x3fceae,_0x50659a){logger[_0x1055('0xe')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x1e3d12,_0x3fceae);if(_0x3fceae==0x0){var _0x29990a=_0x50659a[_0x1055('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x4c7de4[0x1])||_['isEmpty'](_0x4c7de4[0x1])){logger[_0x1055('0xe')](_0x1055('0x12'),_0x1e3d12);_0x540e1b[_0x1055('0x13')][_0x4c7de4[0x1]]=_0x29990a;}else{logger[_0x1055('0xe')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x1e3d12,_0x4c7de4[0x1],_0x29990a);_0x540e1b['body'][_0x4c7de4[0x1]]=_0x29990a;}}_0x1d2bbe[_0x1055('0xc')]();});}}catch(_0x399a29){logger[_0x1055('0x6')](_0x1055('0x7'),_0x1e3d12,_[_0x1055('0x14')](_0x399a29)?JSON[_0x1055('0x15')](_0x399a29):_0x399a29);logger[_0x1055('0xe')](_0x1055('0xb'),_0x1e3d12);_0x1d2bbe[_0x1055('0xc')]();}};}; \ No newline at end of file +var _0x2898=['next','info','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x497880,_0x430dbc){var _0x1a3d4b=function(_0x25d7e1){while(--_0x25d7e1){_0x497880['push'](_0x497880['shift']());}};_0x1a3d4b(++_0x430dbc);}(_0x2898,0x11f));var _0x8289=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0x2898[_0x308213];return _0x2e1619;};'use strict';var schema=require(_0x8289('0x0'));var sh=require(_0x8289('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0x8289('0x2'),'required':!![],'message':_0x8289('0x3')}});exports[_0x8289('0x4')]=function(_0x459415,_0x3ce352){return function(_0x393232){try{var _0x2943e7={'command':_0x3ce352[0x0]};var _0x31fb97=system[_0x8289('0x0')](_0x2943e7,{'typecast':!![]});if(_0x31fb97[_0x8289('0x5')]){logger[_0x8289('0x6')](_0x8289('0x7'),_0x459415,_[_0x8289('0x8')](_0x31fb97,_0x8289('0x9'))[_0x8289('0xa')](',\x20'));logger['info'](_0x8289('0xb'),_0x459415);_0x393232[_0x8289('0xc')]();}else{var _0x166292=this;var _0xdb2774=utils['getMustacheRender'](_0x3ce352[0x0],this);logger[_0x8289('0xd')](_0x8289('0xe'),_0x459415,_0xdb2774);sh['exec'](_[_0x8289('0xf')](_0xdb2774),function(_0x1f25e9,_0x552216){logger[_0x8289('0xd')](_0x8289('0x10'),_0x459415,_0x1f25e9);if(_0x1f25e9==0x0){var _0x151ead=_0x552216[_0x8289('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x8289('0x12')](_0x3ce352[0x1])||_[_0x8289('0x13')](_0x3ce352[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x459415);_0x166292['body'][_0x3ce352[0x1]]=_0x151ead;}else{logger['info'](_0x8289('0x14'),_0x459415,_0x3ce352[0x1],_0x151ead);_0x166292['body'][_0x3ce352[0x1]]=_0x151ead;}}_0x393232[_0x8289('0xc')]();});}}catch(_0x213d44){logger['error'](_0x8289('0x7'),_0x459415,_[_0x8289('0x15')](_0x213d44)?JSON[_0x8289('0x16')](_0x213d44):_0x213d44);logger[_0x8289('0xd')](_0x8289('0xb'),_0x459415);_0x393232[_0x8289('0xc')]();}};}; \ 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 208adc3..1ffb0c8 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 _0x2698=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','next','isObject','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info'];(function(_0x52fad4,_0x3d75c8){var _0x3621ea=function(_0x4d38ad){while(--_0x4d38ad){_0x52fad4['push'](_0x52fad4['shift']());}};_0x3621ea(++_0x3d75c8);}(_0x2698,0xc7));var _0x8269=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2698[_0x14add3];return _0x4a174f;};'use strict';var schema=require(_0x8269('0x0'));var _=require(_0x8269('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x8269('0x2')),'smsInteraction':require(_0x8269('0x3')),'mailInteraction':require(_0x8269('0x4')),'faxInteraction':require(_0x8269('0x5')),'whatsappInteraction':require(_0x8269('0x6'))};var logger=require(_0x8269('0x7'))(_0x8269('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x8269('0x9')]=function(_0x459492,_0x518ea3,_0x15be5e,_0x372ddf){return function(_0x1d34bf){try{var _0x4a77ed={'tag':_0x518ea3[0x0]};var _0x547e12=tag['validate'](_0x4a77ed,{'typecast':!![]});if(_0x547e12[_0x8269('0xa')]){logger[_0x8269('0xb')](_0x8269('0xc'),_0x459492,_[_0x8269('0xd')](_0x547e12,_0x8269('0xe'))[_0x8269('0xf')](',\x20'));logger[_0x8269('0x10')](_0x8269('0x11'),_0x459492);_0x1d34bf['next']();}else{var _0x5b7934={'ids':[_0x518ea3[0x0]]};if(rpc[_0x372ddf['channel']+'Interaction']){rpc[_0x372ddf[_0x8269('0x12')]+'Interaction'][_0x8269('0x13')](_0x372ddf[_0x8269('0x14')]['id'],_0x5b7934)['then'](function(_0x4b5388){logger[_0x8269('0x10')](_0x8269('0x15'),_0x459492,_0x518ea3[0x1],_0x372ddf[_0x8269('0x12')],_0x372ddf['interaction']['id']);})[_0x8269('0x16')](function(_0x5f44cf){logger[_0x8269('0xb')](_0x8269('0xc'),_0x459492,JSON[_0x8269('0x17')](_0x5f44cf));logger[_0x8269('0x10')](_0x8269('0x11'),_0x459492);})[_0x8269('0x18')](function(){_0x1d34bf[_0x8269('0x19')]();});}}}catch(_0x354b95){logger[_0x8269('0xb')](_0x8269('0xc'),_0x459492,_[_0x8269('0x1a')](_0x354b95)?JSON[_0x8269('0x17')](_0x354b95):_0x354b95);logger[_0x8269('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x459492);_0x1d34bf['next']();}};}; \ No newline at end of file +var _0xbaa0=['../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','catch','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction'];(function(_0x903e7f,_0x3a8c45){var _0x2411f3=function(_0x4392a0){while(--_0x4392a0){_0x903e7f['push'](_0x903e7f['shift']());}};_0x2411f3(++_0x3a8c45);}(_0xbaa0,0x10e));var _0x0baa=function(_0x3456e8,_0x5e604b){_0x3456e8=_0x3456e8-0x0;var _0x1d405d=_0xbaa0[_0x3456e8];return _0x1d405d;};'use strict';var schema=require(_0x0baa('0x0'));var _=require(_0x0baa('0x1'));var rpc={'chatInteraction':require(_0x0baa('0x2')),'openchannelInteraction':require(_0x0baa('0x3')),'smsInteraction':require(_0x0baa('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x0baa('0x5'))};var logger=require(_0x0baa('0x6'))(_0x0baa('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x0baa('0x8')}});exports[_0x0baa('0x9')]=function(_0x33ee12,_0x5d6a3a,_0x4f4fd8,_0x5ce300){return function(_0x157138){try{var _0x346b2d={'tag':_0x5d6a3a[0x0]};var _0x3f4732=tag[_0x0baa('0x0')](_0x346b2d,{'typecast':!![]});if(_0x3f4732[_0x0baa('0xa')]){logger[_0x0baa('0xb')](_0x0baa('0xc'),_0x33ee12,_[_0x0baa('0xd')](_0x3f4732,'message')['join'](',\x20'));logger[_0x0baa('0xe')](_0x0baa('0xf'),_0x33ee12);_0x157138[_0x0baa('0x10')]();}else{var _0x5de4fc={'ids':[_0x5d6a3a[0x0]]};if(rpc[_0x5ce300[_0x0baa('0x11')]+_0x0baa('0x12')]){rpc[_0x5ce300[_0x0baa('0x11')]+_0x0baa('0x12')]['addTags'](_0x5ce300[_0x0baa('0x13')]['id'],_0x5de4fc)[_0x0baa('0x14')](function(_0x19b3fe){logger[_0x0baa('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x33ee12,_0x5d6a3a[0x1],_0x5ce300[_0x0baa('0x11')],_0x5ce300[_0x0baa('0x13')]['id']);})[_0x0baa('0x15')](function(_0x1d05e7){logger[_0x0baa('0xb')](_0x0baa('0xc'),_0x33ee12,JSON['stringify'](_0x1d05e7));logger[_0x0baa('0xe')](_0x0baa('0xf'),_0x33ee12);})['finally'](function(){_0x157138[_0x0baa('0x10')]();});}}}catch(_0x829f7){logger[_0x0baa('0xb')](_0x0baa('0xc'),_0x33ee12,_['isObject'](_0x829f7)?JSON[_0x0baa('0x16')](_0x829f7):_0x829f7);logger[_0x0baa('0xe')](_0x0baa('0xf'),_0x33ee12);_0x157138['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 0c63d10..065c658 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 _0x94b1=['render','body','contact','message','account','list','lodash'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x94b1,0x102));var _0x194b=function(_0x3e5a45,_0x8fa178){_0x3e5a45=_0x3e5a45-0x0;var _0x25c3ec=_0x94b1[_0x3e5a45];return _0x25c3ec;};'use strict';var Mustache=require('mustache');var _=require(_0x194b('0x0'));module['exports']={'getMustacheRender':function(_0x457a28,_0x1d079d){return Mustache[_0x194b('0x1')](_0x457a28,_['merge'](_0x1d079d[_0x194b('0x2')],{'contact':_0x1d079d[_0x194b('0x3')],'message':_0x1d079d[_0x194b('0x4')],'account':_0x1d079d[_0x194b('0x5')],'interaction':_0x1d079d['interaction'],'list':_0x1d079d[_0x194b('0x6')]}))||'';}}; \ No newline at end of file +var _0xb634=['mustache','exports','merge','body','contact','message','account','interaction'];(function(_0x23840d,_0x1b8d7a){var _0x14265b=function(_0x25b9b6){while(--_0x25b9b6){_0x23840d['push'](_0x23840d['shift']());}};_0x14265b(++_0x1b8d7a);}(_0xb634,0x1c0));var _0x4b63=function(_0x4812c6,_0x2e4bd1){_0x4812c6=_0x4812c6-0x0;var _0x375230=_0xb634[_0x4812c6];return _0x375230;};'use strict';var Mustache=require(_0x4b63('0x0'));var _=require('lodash');module[_0x4b63('0x1')]={'getMustacheRender':function(_0x53aafa,_0x938dee){return Mustache['render'](_0x53aafa,_[_0x4b63('0x2')](_0x938dee[_0x4b63('0x3')],{'contact':_0x938dee[_0x4b63('0x4')],'message':_0x938dee[_0x4b63('0x5')],'account':_0x938dee[_0x4b63('0x6')],'interaction':_0x938dee[_0x4b63('0x7')],'list':_0x938dee['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 08bfaa6..2ddba39 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 _0x7655=['CurrentCapacity','agent\x20not\x20found','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','uuid','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','channel','interaction','applications','isArray','length','existsSync','join','.js','toLowerCase','autoreply','appdata','split','push','dialogflow','slice','amazonlex','message','TagId','format','%s:%s:%s','app','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','execute','Applications\x20executed','stringify','rules','complete','No\x20applications\x20to\x20execute','stack','error','routing\x20is\x20empty','emit','QueueReport','update','UserId','catch','message\x20is\x20empty','agents','agent','busy','busyQueue','hasOwnProperty','capacity'];(function(_0x282613,_0x235d74){var _0x3ff9e4=function(_0x3ffb4e){while(--_0x3ffb4e){_0x282613['push'](_0x282613['shift']());}};_0x3ff9e4(++_0x235d74);}(_0x7655,0x18c));var _0x5765=function(_0x40d081,_0x6519ac){_0x40d081=_0x40d081-0x0;var _0x8a8ad1=_0x7655[_0x40d081];return _0x8a8ad1;};'use strict';var _=require(_0x5765('0x0'));var util=require(_0x5765('0x1'));var path=require(_0x5765('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x5765('0x3'));var uuid=require(_0x5765('0x4'));var config=require(_0x5765('0x5'));var logger=require('../../../config/logger')(_0x5765('0x6'));var rpc={'openchannelQueueReport':require(_0x5765('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x5765('0x8')),'smsQueueReport':require(_0x5765('0x9')),'faxQueueReport':require(_0x5765('0xa')),'whatsappQueueReport':require(_0x5765('0xb'))};var RuleEngine=require(_0x5765('0xc'));function getId(_0x464ef6,_0x3b23f1,_0x10ba8c){return util['format'](_0x5765('0xd'),_0x464ef6,_0x3b23f1||0x0,_0x10ba8c||0x0);}function getIntervals(_0x1ae375,_0x49c405){var _0x32d29a=[];if(!_['isNil'](_0x49c405[_0x5765('0xe')])&&!_[_0x5765('0xf')](_0x1ae375[_0x49c405[_0x5765('0xe')]])&&!_[_0x5765('0xf')](_0x1ae375[_0x49c405['IntervalId']][_0x5765('0x10')])){_0x32d29a=_[_0x5765('0x11')](_0x1ae375[_0x49c405[_0x5765('0xe')]][_0x5765('0x10')],_0x5765('0x12'));}else if(!_[_0x5765('0xf')](_0x49c405[_0x5765('0x12')])){_0x32d29a=[_0x49c405['interval']];}return _0x32d29a;}exports[_0x5765('0x13')]=function(_0x5e7102){_0x5e7102['rules']={};return new BPromise(function(_0x253db6,_0x363d28){var _0x52dc67={'Start':function(_0x2cff07){var _0x516d37=this;return new Promise(function(_0x421804,_0x239f3d){if(_0x2cff07){try{var _0x191142=[];var _0x772195=getId(_0x2cff07[_0x5765('0x14')],_0x2cff07['message']?_0x2cff07['message']['id']:0x0,_0x2cff07[_0x5765('0x15')]?_0x2cff07[_0x5765('0x15')]['id']:0x0);if(_0x2cff07[_0x5765('0x16')]&&_[_0x5765('0x17')](_0x2cff07[_0x5765('0x16')])&&_0x2cff07[_0x5765('0x16')][_0x5765('0x18')]){for(var _0x140029=0x0;_0x140029<_0x2cff07[_0x5765('0x16')][_0x5765('0x18')];_0x140029+=0x1){var _0x298ae9=_0x2cff07['applications'][_0x140029];if(fs[_0x5765('0x19')](path[_0x5765('0x1a')](__dirname,'applications',_0x298ae9['app']+_0x5765('0x1b')))){var _0x19abd0=[];switch(_0x298ae9['app'][_0x5765('0x1c')]()){case _0x5765('0x1d'):var _0x1a2204=_0x298ae9[_0x5765('0x1e')][_0x5765('0x1f')](',');_0x19abd0[_0x5765('0x20')](_0x1a2204[0x0]);_0x19abd0[_0x5765('0x20')](_0x1a2204['slice'](0x1,_0x1a2204[_0x5765('0x18')])['join'](','));break;case _0x5765('0x21'):var _0x24be31=_0x298ae9[_0x5765('0x1e')]['split'](',');_0x19abd0[_0x5765('0x20')](_0x24be31[0x0]);_0x19abd0[_0x5765('0x20')](_0x24be31[0x1]);_0x19abd0[_0x5765('0x20')](_0x24be31[_0x5765('0x22')](0x2,_0x24be31[_0x5765('0x18')])[_0x5765('0x1a')](','));break;case _0x5765('0x23'):var _0x2346ed=_0x298ae9[_0x5765('0x1e')][_0x5765('0x1f')](',');_0x19abd0[_0x5765('0x20')](_0x2346ed[0x0]);_0x19abd0[_0x5765('0x20')](_0x2346ed[0x1]);_0x19abd0[_0x5765('0x20')](_0x2346ed[0x2]);_0x19abd0['push'](_0x2346ed[0x3]);_0x19abd0[_0x5765('0x20')](_0x2346ed[_0x5765('0x22')](0x4,_0x2346ed['length'])['join'](','));break;case _0x5765('0x24'):_0x19abd0[_0x5765('0x20')](_0x298ae9['appdata']);break;case'tag':_0x19abd0['push'](_0x298ae9[_0x5765('0x25')]);_0x19abd0['push'](_0x298ae9[_0x5765('0x1e')]);break;default:_0x19abd0=_[_0x5765('0xf')](_0x298ae9[_0x5765('0x1e')])?[]:_0x298ae9[_0x5765('0x1e')][_0x5765('0x1f')](',');}var _0x2415cf={'id':util[_0x5765('0x26')](_0x5765('0x27'),_0x772195,_0x298ae9['id'],_0x298ae9[_0x5765('0x28')]),'condition':require('./interval')['condition'](_0x772195,getIntervals(_0x5e7102[_0x5765('0x29')],_0x298ae9),_0x5e7102),'consequence':require(_0x5765('0x2a')+_0x298ae9[_0x5765('0x28')])[_0x5765('0x2b')](_0x772195,_0x19abd0,_0x5e7102,_0x2cff07),'p':_0x298ae9[_0x5765('0x2c')]||0x0};logger[_0x5765('0x2d')](_0x5765('0x2e'),_0x2415cf['id'],_0x5765('0x2f'),getIntervals(_0x5e7102[_0x5765('0x29')],_0x298ae9)['join']('\x20|\x20'));_0x191142[_0x5765('0x20')](_0x2415cf);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0x5765('0x1a')](__dirname,_0x5765('0x16'),_0x298ae9[_0x5765('0x28')]+'.js'));}}_0x5e7102['rules'][_0x772195]=new RuleEngine(_0x191142);_0x5e7102['rules'][_0x772195][_0x5765('0x30')](_0x2cff07,function(_0x2dbff3){logger[_0x5765('0x2d')](_0x5765('0x31'),JSON[_0x5765('0x32')](_0x2dbff3['matchPath']));if(_0x5e7102['rules'][_0x772195]){_0x5e7102[_0x5765('0x33')][_0x772195]['emit'](_0x5765('0x34'));}});return _0x421804({'code':0xc8,'message':_0x2cff07});}else{logger[_0x5765('0x2d')](_0x5765('0x35'));return _0x421804({'code':0xc8,'message':_0x2cff07});}}catch(_0x215177){logger['error'](_0x215177[_0x5765('0x36')]);return _0x239f3d(_0x516d37[_0x5765('0x37')](0x1f4,_0x215177));}}return _0x239f3d(_0x5765('0x38'));});},'AcceptMessage':function(_0x233bbf){var _0x1a013b=this;return new Promise(function(_0x54413f,_0x2cbf46){if(_0x233bbf[_0x5765('0x24')]&&_0x233bbf[_0x5765('0x24')]['id']){try{var _0x138d37=getId(_0x233bbf[_0x5765('0x14')],_0x233bbf['message']?_0x233bbf[_0x5765('0x24')]['id']:0x0,_0x233bbf[_0x5765('0x15')]?_0x233bbf['interaction']['id']:0x0);if(_0x5e7102[_0x5765('0x33')][_0x138d37]){_0x5e7102[_0x5765('0x33')][_0x138d37][_0x5765('0x39')]('end');if(rpc[_0x233bbf[_0x5765('0x14')]+_0x5765('0x3a')]){rpc[_0x233bbf[_0x5765('0x14')]+_0x5765('0x3a')][_0x5765('0x3b')](_0x138d37,{'UserId':_0x233bbf[_0x5765('0x24')][_0x5765('0x3c')]})[_0x5765('0x3d')](function(_0x13ac9e){logger[_0x5765('0x37')]('error\x20update\x20queue\x20report');});}}return _0x54413f({'code':0xc8,'message':_0x233bbf});}catch(_0x2b8e7b){logger[_0x5765('0x37')](_0x2b8e7b['stack']);return _0x2cbf46(_0x1a013b[_0x5765('0x37')](0x1f4,_0x2b8e7b));}}logger[_0x5765('0x37')](_0x5765('0x3e'));return _0x2cbf46(_0x1a013b['error'](0x1f4,_0x5765('0x3e')));});},'RejectMessage':function(_0x1d0217){var _0x433d6f=this;return new Promise(function(_0x49e7bb,_0x2c7208){if(_0x1d0217['agent']&&_0x1d0217['agent']['id']){try{if(_0x5e7102[_0x5765('0x3f')][_0x1d0217['agent']['id']]){_0x5e7102[_0x5765('0x3f')][_0x1d0217[_0x5765('0x40')]['id']][_0x5765('0x41')]=![];_0x5e7102[_0x5765('0x3f')][_0x1d0217[_0x5765('0x40')]['id']][_0x5765('0x42')]=undefined;}return _0x49e7bb({'code':0xc8,'message':_0x1d0217});}catch(_0x3f60be){logger[_0x5765('0x37')](_0x3f60be['stack']);return _0x2c7208(_0x433d6f[_0x5765('0x37')](0x1f4,_0x3f60be));}}logger['error']('message\x20is\x20empty');return _0x2c7208(_0x433d6f[_0x5765('0x37')](0x1f4,_0x5765('0x3e')));});},'AbandonInteraction':function(_0x3999ae){var _0xbb4b0c=this;return new Promise(function(_0x54e738,_0x499646){if(_0x3999ae[_0x5765('0x14')]&&_0x3999ae[_0x5765('0x15')]&&_0x3999ae['interaction']['id']){try{var _0x186590=getId(_0x3999ae[_0x5765('0x14')],_0x3999ae[_0x5765('0x24')]?_0x3999ae['message']['id']:0x0,_0x3999ae[_0x5765('0x15')]?_0x3999ae[_0x5765('0x15')]['id']:0x0);if(_0x5e7102[_0x5765('0x33')][_0x186590]){_0x5e7102[_0x5765('0x33')][_0x186590][_0x5765('0x39')]('end');}return _0x54e738({'code':0xc8,'message':_0x3999ae});}catch(_0x4debd1){logger[_0x5765('0x37')](_0x4debd1[_0x5765('0x36')]);return _0x499646(_0xbb4b0c[_0x5765('0x37')](0x1f4,_0x4debd1));}}logger['error'](_0x5765('0x3e'));return _0x499646(_0xbb4b0c[_0x5765('0x37')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x3a5784){var _0xccbf3c=this;return new Promise(function(_0x250bf9,_0x43e9c1){if(_0x5e7102[_0x5765('0x3f')][_0x5765('0x43')](_0x3a5784['id'])){for(var _0x5ada89 in _0x3a5784['capacity']){if(_0x3a5784[_0x5765('0x44')][_0x5765('0x43')](_0x5ada89)){if(_0x5e7102[_0x5765('0x3f')][_0x3a5784['id']][_0x5765('0x43')](_0x5ada89+'CurrentCapacity')){_0x5e7102[_0x5765('0x3f')][_0x3a5784['id']][_0x5ada89+_0x5765('0x45')]=parseInt(_0x3a5784[_0x5765('0x44')][_0x5ada89],0xa);}}}_0x5e7102[_0x5765('0x3f')][_0x3a5784['id']]['updateRealtime']();return _0x250bf9({'code':0xc8,'message':_0x5e7102[_0x5765('0x3f')][_0x3a5784['id']]});}else{return _0x43e9c1(_0xccbf3c['error'](0x1f4,_0x5765('0x46')));}});},'Agents':function(_0x877a64){return new Promise(function(_0x295ded,_0x5575ab){var _0x2d07b4=_['values'](_0x5e7102[_0x5765('0x3f')]);_0x295ded({'count':_0x2d07b4['length'],'rows':_0x2d07b4});});},'ChatQueues':function(_0x33513b){return new Promise(function(_0x1fe1ee,_0x2807a4){var _0x56c0da=[];for(var _0x5d95b3 in _0x5e7102[_0x5765('0x47')]){if(_0x5e7102[_0x5765('0x47')][_0x5765('0x43')](_0x5d95b3)){var _0x1adadf=_0x5e7102['chatQueues'][_0x5d95b3];var _0x30b072={'id':_0x1adadf['id'],'available':_0x1adadf[_0x5765('0x48')],'loggedIn':_0x1adadf[_0x5765('0x49')],'name':_0x1adadf['name'],'paused':_0x1adadf[_0x5765('0x4a')],'waiting':_0x1adadf[_0x5765('0x4b')]};_0x56c0da[_0x5765('0x20')](_0x30b072);}}_0x1fe1ee({'count':_0x56c0da[_0x5765('0x18')],'rows':_0x56c0da});});},'MailQueues':function(_0x1411af){return new Promise(function(_0x14235f,_0x71fe82){var _0x3f4fc3=[];for(var _0xb6d1ae in _0x5e7102['mailQueues']){if(_0x5e7102['mailQueues']['hasOwnProperty'](_0xb6d1ae)){var _0x14a2be=_0x5e7102[_0x5765('0x4c')][_0xb6d1ae];var _0x1d260a={'id':_0x14a2be['id'],'available':_0x14a2be[_0x5765('0x48')],'loggedIn':_0x14a2be[_0x5765('0x49')],'name':_0x14a2be[_0x5765('0x4d')],'paused':_0x14a2be[_0x5765('0x4a')],'waiting':_0x14a2be[_0x5765('0x4b')]};_0x3f4fc3[_0x5765('0x20')](_0x1d260a);}}_0x14235f({'count':_0x3f4fc3[_0x5765('0x18')],'rows':_0x3f4fc3});});},'OpenchannelQueues':function(_0x1c9fc8){return new Promise(function(_0x3da24c,_0x6a1574){var _0x3ae0e8=[];for(var _0x5c04a4 in _0x5e7102[_0x5765('0x4e')]){if(_0x5e7102['openchannelQueues'][_0x5765('0x43')](_0x5c04a4)){var _0x176d9b=_0x5e7102[_0x5765('0x4e')][_0x5c04a4];var _0x4bee6c={'id':_0x176d9b['id'],'available':_0x176d9b[_0x5765('0x48')],'loggedIn':_0x176d9b[_0x5765('0x49')],'name':_0x176d9b[_0x5765('0x4d')],'paused':_0x176d9b[_0x5765('0x4a')],'waiting':_0x176d9b[_0x5765('0x4b')]};_0x3ae0e8[_0x5765('0x20')](_0x4bee6c);}}_0x3da24c({'count':_0x3ae0e8[_0x5765('0x18')],'rows':_0x3ae0e8});});},'SmsQueues':function(_0x1942dd){return new Promise(function(_0x4df235,_0x54466e){var _0x4fcbb2=[];for(var _0xc08f29 in _0x5e7102[_0x5765('0x4f')]){if(_0x5e7102[_0x5765('0x4f')][_0x5765('0x43')](_0xc08f29)){var _0x233d6e=_0x5e7102[_0x5765('0x4f')][_0xc08f29];var _0xf307c={'id':_0x233d6e['id'],'available':_0x233d6e[_0x5765('0x48')],'loggedIn':_0x233d6e['loggedIn'],'name':_0x233d6e['name'],'paused':_0x233d6e['paused'],'waiting':_0x233d6e[_0x5765('0x4b')]};_0x4fcbb2[_0x5765('0x20')](_0xf307c);}}_0x4df235({'count':_0x4fcbb2[_0x5765('0x18')],'rows':_0x4fcbb2});});},'FaxQueues':function(_0x2f42bb){return new Promise(function(_0x44cbbe,_0x219226){var _0x169ac3=[];for(var _0x58e87e in _0x5e7102[_0x5765('0x50')]){if(_0x5e7102[_0x5765('0x50')][_0x5765('0x43')](_0x58e87e)){var _0x312e8c=_0x5e7102['faxQueues'][_0x58e87e];var _0x5410d1={'id':_0x312e8c['id'],'available':_0x312e8c[_0x5765('0x48')],'loggedIn':_0x312e8c[_0x5765('0x49')],'name':_0x312e8c[_0x5765('0x4d')],'paused':_0x312e8c[_0x5765('0x4a')],'waiting':_0x312e8c[_0x5765('0x4b')]};_0x169ac3[_0x5765('0x20')](_0x5410d1);}}_0x44cbbe({'count':_0x169ac3['length'],'rows':_0x169ac3});});},'WhatsappQueues':function(_0x3e062f){return new Promise(function(_0xdc6dc2,_0x1e3195){var _0x2a6db7=[];for(var _0x35313d in _0x5e7102['whatsappQueues']){if(_0x5e7102[_0x5765('0x51')][_0x5765('0x43')](_0x35313d)){var _0x53516c=_0x5e7102[_0x5765('0x51')][_0x35313d];var _0x5f0b0a={'id':_0x53516c['id'],'available':_0x53516c[_0x5765('0x48')],'loggedIn':_0x53516c[_0x5765('0x49')],'name':_0x53516c['name'],'paused':_0x53516c['paused'],'waiting':_0x53516c['waiting']};_0x2a6db7['push'](_0x5f0b0a);}}_0xdc6dc2({'count':_0x2a6db7[_0x5765('0x18')],'rows':_0x2a6db7});});},'ChatQueuesWaitingInteractions':function(_0x2a85ec){return new Promise(function(_0x5508a7,_0x14ae12){var _0x2c095e=_[_0x5765('0x52')](_0x5e7102['chatQueuesWaitingInteractions']);_0x5508a7({'count':_0x2c095e[_0x5765('0x18')],'rows':_0x2c095e});});},'MailQueuesWaitingInteractions':function(_0x275754){return new Promise(function(_0x126a57,_0xabe23b){var _0x1283d1=_['values'](_0x5e7102[_0x5765('0x53')]);_0x126a57({'count':_0x1283d1[_0x5765('0x18')],'rows':_0x1283d1});});},'OpenchannelQueuesWaitingInteractions':function(_0xe69292){return new Promise(function(_0x1ab6b2,_0x112386){var _0x2461ad=_[_0x5765('0x52')](_0x5e7102[_0x5765('0x54')]);_0x1ab6b2({'count':_0x2461ad[_0x5765('0x18')],'rows':_0x2461ad});});},'SmsQueuesWaitingInteractions':function(_0x3292d4){return new Promise(function(_0x52860d,_0xd11ca2){var _0x45a30f=_['values'](_0x5e7102[_0x5765('0x55')]);_0x52860d({'count':_0x45a30f[_0x5765('0x18')],'rows':_0x45a30f});});},'FaxQueuesWaitingInteractions':function(_0x5e96cb){return new Promise(function(_0x1949b4,_0x300d29){var _0x538279=_[_0x5765('0x52')](_0x5e7102[_0x5765('0x56')]);_0x1949b4({'count':_0x538279[_0x5765('0x18')],'rows':_0x538279});});},'WhatsappQueuesWaitingInteractions':function(_0x2fb667){return new Promise(function(_0x29d836,_0x44da14){var _0x4f38dd=_['values'](_0x5e7102['whatsappQueuesWaitingInteractions']);_0x29d836({'count':_0x4f38dd[_0x5765('0x18')],'rows':_0x4f38dd});});}};var _0x3d1c6c=jayson[_0x5765('0x57')](_0x52dc67)[_0x5765('0x58')]();_0x3d1c6c['on']('error',function(_0x439713){logger[_0x5765('0x37')](JSON[_0x5765('0x32')](_0x439713));return _0x363d28(_0x439713);});_0x3d1c6c[_0x5765('0x13')](0x232c,_0x5765('0x59'),function(){console[_0x5765('0x5a')](_0x5765('0x5b'),0x232c);return _0x253db6(_0x5765('0x5c')+0x232c);});});}; \ No newline at end of file +var _0x09c2=['channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','autoreply','appdata','split','push','slice','amazonlex','tag','TagId','%s:%s:%s','./interval','intervals','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','mailQueues','waiting','smsQueues','faxQueues','available','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','http','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules'];(function(_0x505a40,_0x59994f){var _0x472c12=function(_0x189593){while(--_0x189593){_0x505a40['push'](_0x505a40['shift']());}};_0x472c12(++_0x59994f);}(_0x09c2,0x9e));var _0x209c=function(_0x4a96d2,_0x689504){_0x4a96d2=_0x4a96d2-0x0;var _0x38af04=_0x09c2[_0x4a96d2];return _0x38af04;};'use strict';var _=require(_0x209c('0x0'));var util=require(_0x209c('0x1'));var path=require(_0x209c('0x2'));var fs=require('fs');var jayson=require(_0x209c('0x3'));var BPromise=require('bluebird');var uuid=require(_0x209c('0x4'));var config=require(_0x209c('0x5'));var logger=require(_0x209c('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x209c('0x7')),'mailQueueReport':require(_0x209c('0x8')),'chatQueueReport':require(_0x209c('0x9')),'smsQueueReport':require(_0x209c('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x209c('0xb'));function getId(_0xb83a42,_0x413d70,_0x557486){return util['format'](_0x209c('0xc'),_0xb83a42,_0x413d70||0x0,_0x557486||0x0);}function getIntervals(_0x4c6dd4,_0xb24d3c){var _0x26796f=[];if(!_['isNil'](_0xb24d3c[_0x209c('0xd')])&&!_[_0x209c('0xe')](_0x4c6dd4[_0xb24d3c[_0x209c('0xd')]])&&!_[_0x209c('0xe')](_0x4c6dd4[_0xb24d3c['IntervalId']][_0x209c('0xf')])){_0x26796f=_[_0x209c('0x10')](_0x4c6dd4[_0xb24d3c[_0x209c('0xd')]]['Intervals'],_0x209c('0x11'));}else if(!_['isNil'](_0xb24d3c[_0x209c('0x11')])){_0x26796f=[_0xb24d3c[_0x209c('0x11')]];}return _0x26796f;}exports[_0x209c('0x12')]=function(_0x4c1991){_0x4c1991[_0x209c('0x13')]={};return new BPromise(function(_0x5a0532,_0xbd78b5){var _0x43b20f={'Start':function(_0x1319e8){var _0x325bdf=this;return new Promise(function(_0x5d7003,_0x4ce4fb){if(_0x1319e8){try{var _0x4f8f41=[];var _0x38e704=getId(_0x1319e8[_0x209c('0x14')],_0x1319e8[_0x209c('0x15')]?_0x1319e8[_0x209c('0x15')]['id']:0x0,_0x1319e8[_0x209c('0x16')]?_0x1319e8['interaction']['id']:0x0);if(_0x1319e8['applications']&&_[_0x209c('0x17')](_0x1319e8[_0x209c('0x18')])&&_0x1319e8[_0x209c('0x18')][_0x209c('0x19')]){for(var _0x4138aa=0x0;_0x4138aa<_0x1319e8[_0x209c('0x18')][_0x209c('0x19')];_0x4138aa+=0x1){var _0x4a1f47=_0x1319e8[_0x209c('0x18')][_0x4138aa];if(fs[_0x209c('0x1a')](path[_0x209c('0x1b')](__dirname,_0x209c('0x18'),_0x4a1f47[_0x209c('0x1c')]+_0x209c('0x1d')))){var _0x22d576=[];switch(_0x4a1f47[_0x209c('0x1c')]['toLowerCase']()){case _0x209c('0x1e'):var _0x1ac816=_0x4a1f47[_0x209c('0x1f')][_0x209c('0x20')](',');_0x22d576[_0x209c('0x21')](_0x1ac816[0x0]);_0x22d576['push'](_0x1ac816[_0x209c('0x22')](0x1,_0x1ac816[_0x209c('0x19')])[_0x209c('0x1b')](','));break;case'dialogflow':var _0x51abc2=_0x4a1f47[_0x209c('0x1f')][_0x209c('0x20')](',');_0x22d576[_0x209c('0x21')](_0x51abc2[0x0]);_0x22d576[_0x209c('0x21')](_0x51abc2[0x1]);_0x22d576['push'](_0x51abc2['slice'](0x2,_0x51abc2[_0x209c('0x19')])[_0x209c('0x1b')](','));break;case _0x209c('0x23'):var _0x17b644=_0x4a1f47[_0x209c('0x1f')][_0x209c('0x20')](',');_0x22d576[_0x209c('0x21')](_0x17b644[0x0]);_0x22d576[_0x209c('0x21')](_0x17b644[0x1]);_0x22d576[_0x209c('0x21')](_0x17b644[0x2]);_0x22d576[_0x209c('0x21')](_0x17b644[0x3]);_0x22d576[_0x209c('0x21')](_0x17b644['slice'](0x4,_0x17b644['length'])[_0x209c('0x1b')](','));break;case _0x209c('0x15'):_0x22d576[_0x209c('0x21')](_0x4a1f47[_0x209c('0x1f')]);break;case _0x209c('0x24'):_0x22d576[_0x209c('0x21')](_0x4a1f47[_0x209c('0x25')]);_0x22d576[_0x209c('0x21')](_0x4a1f47[_0x209c('0x1f')]);break;default:_0x22d576=_['isNil'](_0x4a1f47[_0x209c('0x1f')])?[]:_0x4a1f47[_0x209c('0x1f')][_0x209c('0x20')](',');}var _0x3c46b2={'id':util['format'](_0x209c('0x26'),_0x38e704,_0x4a1f47['id'],_0x4a1f47[_0x209c('0x1c')]),'condition':require(_0x209c('0x27'))['condition'](_0x38e704,getIntervals(_0x4c1991[_0x209c('0x28')],_0x4a1f47),_0x4c1991),'consequence':require('./applications/'+_0x4a1f47['app'])[_0x209c('0x29')](_0x38e704,_0x22d576,_0x4c1991,_0x1319e8),'p':_0x4a1f47[_0x209c('0x2a')]||0x0};logger[_0x209c('0x2b')](_0x209c('0x2c'),_0x3c46b2['id'],'on\x20interval',getIntervals(_0x4c1991[_0x209c('0x28')],_0x4a1f47)[_0x209c('0x1b')](_0x209c('0x2d')));_0x4f8f41['push'](_0x3c46b2);}else{logger['error'](_0x209c('0x2e'),path[_0x209c('0x1b')](__dirname,_0x209c('0x18'),_0x4a1f47[_0x209c('0x1c')]+'.js'));}}_0x4c1991['rules'][_0x38e704]=new RuleEngine(_0x4f8f41);_0x4c1991[_0x209c('0x13')][_0x38e704][_0x209c('0x2f')](_0x1319e8,function(_0xad7fa){logger[_0x209c('0x2b')](_0x209c('0x30'),JSON[_0x209c('0x31')](_0xad7fa['matchPath']));if(_0x4c1991[_0x209c('0x13')][_0x38e704]){_0x4c1991[_0x209c('0x13')][_0x38e704][_0x209c('0x32')](_0x209c('0x33'));}});return _0x5d7003({'code':0xc8,'message':_0x1319e8});}else{logger[_0x209c('0x2b')](_0x209c('0x34'));return _0x5d7003({'code':0xc8,'message':_0x1319e8});}}catch(_0x212071){logger[_0x209c('0x35')](_0x212071[_0x209c('0x36')]);return _0x4ce4fb(_0x325bdf[_0x209c('0x35')](0x1f4,_0x212071));}}return _0x4ce4fb(_0x209c('0x37'));});},'AcceptMessage':function(_0x39a3dd){var _0x1b0a4f=this;return new Promise(function(_0x6b6617,_0x115ddf){if(_0x39a3dd[_0x209c('0x15')]&&_0x39a3dd[_0x209c('0x15')]['id']){try{var _0x4e0763=getId(_0x39a3dd[_0x209c('0x14')],_0x39a3dd[_0x209c('0x15')]?_0x39a3dd[_0x209c('0x15')]['id']:0x0,_0x39a3dd[_0x209c('0x16')]?_0x39a3dd[_0x209c('0x16')]['id']:0x0);if(_0x4c1991[_0x209c('0x13')][_0x4e0763]){_0x4c1991[_0x209c('0x13')][_0x4e0763][_0x209c('0x32')]('end');if(rpc[_0x39a3dd['channel']+_0x209c('0x38')]){rpc[_0x39a3dd[_0x209c('0x14')]+_0x209c('0x38')][_0x209c('0x39')](_0x4e0763,{'UserId':_0x39a3dd[_0x209c('0x15')][_0x209c('0x3a')]})[_0x209c('0x3b')](function(_0x138d92){logger[_0x209c('0x35')](_0x209c('0x3c'));});}}return _0x6b6617({'code':0xc8,'message':_0x39a3dd});}catch(_0x25bbf1){logger['error'](_0x25bbf1['stack']);return _0x115ddf(_0x1b0a4f[_0x209c('0x35')](0x1f4,_0x25bbf1));}}logger['error'](_0x209c('0x3d'));return _0x115ddf(_0x1b0a4f[_0x209c('0x35')](0x1f4,_0x209c('0x3d')));});},'RejectMessage':function(_0x1758b4){var _0x22dc02=this;return new Promise(function(_0x3eb09e,_0x4cf096){if(_0x1758b4[_0x209c('0x3e')]&&_0x1758b4['agent']['id']){try{if(_0x4c1991[_0x209c('0x3f')][_0x1758b4['agent']['id']]){_0x4c1991['agents'][_0x1758b4[_0x209c('0x3e')]['id']][_0x209c('0x40')]=![];_0x4c1991[_0x209c('0x3f')][_0x1758b4[_0x209c('0x3e')]['id']][_0x209c('0x41')]=undefined;}return _0x3eb09e({'code':0xc8,'message':_0x1758b4});}catch(_0x224880){logger[_0x209c('0x35')](_0x224880['stack']);return _0x4cf096(_0x22dc02[_0x209c('0x35')](0x1f4,_0x224880));}}logger[_0x209c('0x35')](_0x209c('0x3d'));return _0x4cf096(_0x22dc02[_0x209c('0x35')](0x1f4,_0x209c('0x3d')));});},'AbandonInteraction':function(_0x161f06){var _0x52d02f=this;return new Promise(function(_0x2e677e,_0x2ceb94){if(_0x161f06[_0x209c('0x14')]&&_0x161f06[_0x209c('0x16')]&&_0x161f06[_0x209c('0x16')]['id']){try{var _0x44669b=getId(_0x161f06[_0x209c('0x14')],_0x161f06[_0x209c('0x15')]?_0x161f06['message']['id']:0x0,_0x161f06[_0x209c('0x16')]?_0x161f06[_0x209c('0x16')]['id']:0x0);if(_0x4c1991[_0x209c('0x13')][_0x44669b]){_0x4c1991[_0x209c('0x13')][_0x44669b][_0x209c('0x32')]('end');}return _0x2e677e({'code':0xc8,'message':_0x161f06});}catch(_0xa47038){logger[_0x209c('0x35')](_0xa47038[_0x209c('0x36')]);return _0x2ceb94(_0x52d02f[_0x209c('0x35')](0x1f4,_0xa47038));}}logger[_0x209c('0x35')]('message\x20is\x20empty');return _0x2ceb94(_0x52d02f[_0x209c('0x35')](0x1f4,_0x209c('0x3d')));});},'AgentCapacity':function(_0x4a5a4e){var _0x5a47bc=this;return new Promise(function(_0xe8bda5,_0x7ed1a1){if(_0x4c1991['agents'][_0x209c('0x42')](_0x4a5a4e['id'])){for(var _0x2ccb2b in _0x4a5a4e[_0x209c('0x43')]){if(_0x4a5a4e['capacity'][_0x209c('0x42')](_0x2ccb2b)){if(_0x4c1991[_0x209c('0x3f')][_0x4a5a4e['id']][_0x209c('0x42')](_0x2ccb2b+_0x209c('0x44'))){_0x4c1991[_0x209c('0x3f')][_0x4a5a4e['id']][_0x2ccb2b+_0x209c('0x44')]=parseInt(_0x4a5a4e[_0x209c('0x43')][_0x2ccb2b],0xa);}}}_0x4c1991[_0x209c('0x3f')][_0x4a5a4e['id']][_0x209c('0x45')]();return _0xe8bda5({'code':0xc8,'message':_0x4c1991[_0x209c('0x3f')][_0x4a5a4e['id']]});}else{return _0x7ed1a1(_0x5a47bc[_0x209c('0x35')](0x1f4,_0x209c('0x46')));}});},'Agents':function(_0x16e17e){return new Promise(function(_0x481d71,_0xfd0007){var _0x26f749=_[_0x209c('0x47')](_0x4c1991[_0x209c('0x3f')]);_0x481d71({'count':_0x26f749[_0x209c('0x19')],'rows':_0x26f749});});},'ChatQueues':function(_0x1306ae){return new Promise(function(_0x229da4,_0x4c1a8b){var _0x200baf=[];for(var _0x26ffda in _0x4c1991['chatQueues']){if(_0x4c1991[_0x209c('0x48')][_0x209c('0x42')](_0x26ffda)){var _0x52739e=_0x4c1991[_0x209c('0x48')][_0x26ffda];var _0x3310dd={'id':_0x52739e['id'],'available':_0x52739e['available'],'loggedIn':_0x52739e[_0x209c('0x49')],'name':_0x52739e[_0x209c('0x4a')],'paused':_0x52739e[_0x209c('0x4b')],'waiting':_0x52739e['waiting']};_0x200baf[_0x209c('0x21')](_0x3310dd);}}_0x229da4({'count':_0x200baf['length'],'rows':_0x200baf});});},'MailQueues':function(_0x391b58){return new Promise(function(_0x534d97,_0x42766a){var _0x53b94d=[];for(var _0x1efd8a in _0x4c1991[_0x209c('0x4c')]){if(_0x4c1991[_0x209c('0x4c')]['hasOwnProperty'](_0x1efd8a)){var _0x2c8f52=_0x4c1991[_0x209c('0x4c')][_0x1efd8a];var _0x20332d={'id':_0x2c8f52['id'],'available':_0x2c8f52['available'],'loggedIn':_0x2c8f52[_0x209c('0x49')],'name':_0x2c8f52['name'],'paused':_0x2c8f52[_0x209c('0x4b')],'waiting':_0x2c8f52[_0x209c('0x4d')]};_0x53b94d['push'](_0x20332d);}}_0x534d97({'count':_0x53b94d[_0x209c('0x19')],'rows':_0x53b94d});});},'OpenchannelQueues':function(_0x58e475){return new Promise(function(_0x27d2d0,_0xb88d2f){var _0x47817d=[];for(var _0xcfe3ff in _0x4c1991['openchannelQueues']){if(_0x4c1991['openchannelQueues'][_0x209c('0x42')](_0xcfe3ff)){var _0x2e536e=_0x4c1991['openchannelQueues'][_0xcfe3ff];var _0x2b1c4b={'id':_0x2e536e['id'],'available':_0x2e536e['available'],'loggedIn':_0x2e536e['loggedIn'],'name':_0x2e536e[_0x209c('0x4a')],'paused':_0x2e536e[_0x209c('0x4b')],'waiting':_0x2e536e[_0x209c('0x4d')]};_0x47817d[_0x209c('0x21')](_0x2b1c4b);}}_0x27d2d0({'count':_0x47817d['length'],'rows':_0x47817d});});},'SmsQueues':function(_0x4dd843){return new Promise(function(_0x1637f2,_0x4f6430){var _0x2b9a62=[];for(var _0x474a72 in _0x4c1991[_0x209c('0x4e')]){if(_0x4c1991[_0x209c('0x4e')][_0x209c('0x42')](_0x474a72)){var _0x1acb17=_0x4c1991[_0x209c('0x4e')][_0x474a72];var _0x906960={'id':_0x1acb17['id'],'available':_0x1acb17['available'],'loggedIn':_0x1acb17['loggedIn'],'name':_0x1acb17['name'],'paused':_0x1acb17[_0x209c('0x4b')],'waiting':_0x1acb17['waiting']};_0x2b9a62[_0x209c('0x21')](_0x906960);}}_0x1637f2({'count':_0x2b9a62[_0x209c('0x19')],'rows':_0x2b9a62});});},'FaxQueues':function(_0x3c9949){return new Promise(function(_0x51ab98,_0x35da24){var _0x490f36=[];for(var _0x4f6fff in _0x4c1991[_0x209c('0x4f')]){if(_0x4c1991[_0x209c('0x4f')][_0x209c('0x42')](_0x4f6fff)){var _0x3a27f4=_0x4c1991[_0x209c('0x4f')][_0x4f6fff];var _0x597c49={'id':_0x3a27f4['id'],'available':_0x3a27f4[_0x209c('0x50')],'loggedIn':_0x3a27f4[_0x209c('0x49')],'name':_0x3a27f4[_0x209c('0x4a')],'paused':_0x3a27f4[_0x209c('0x4b')],'waiting':_0x3a27f4[_0x209c('0x4d')]};_0x490f36[_0x209c('0x21')](_0x597c49);}}_0x51ab98({'count':_0x490f36[_0x209c('0x19')],'rows':_0x490f36});});},'WhatsappQueues':function(_0x4a36c5){return new Promise(function(_0x40b265,_0x109d01){var _0x3f7127=[];for(var _0x5629a2 in _0x4c1991[_0x209c('0x51')]){if(_0x4c1991[_0x209c('0x51')][_0x209c('0x42')](_0x5629a2)){var _0x4b291e=_0x4c1991[_0x209c('0x51')][_0x5629a2];var _0x48ecfb={'id':_0x4b291e['id'],'available':_0x4b291e['available'],'loggedIn':_0x4b291e[_0x209c('0x49')],'name':_0x4b291e[_0x209c('0x4a')],'paused':_0x4b291e[_0x209c('0x4b')],'waiting':_0x4b291e[_0x209c('0x4d')]};_0x3f7127[_0x209c('0x21')](_0x48ecfb);}}_0x40b265({'count':_0x3f7127[_0x209c('0x19')],'rows':_0x3f7127});});},'ChatQueuesWaitingInteractions':function(_0x23b89d){return new Promise(function(_0x36e7da,_0x3f5ad3){var _0x2ebc8a=_[_0x209c('0x47')](_0x4c1991[_0x209c('0x52')]);_0x36e7da({'count':_0x2ebc8a[_0x209c('0x19')],'rows':_0x2ebc8a});});},'MailQueuesWaitingInteractions':function(_0x5ad7a4){return new Promise(function(_0xbfc24a,_0x34bcfd){var _0x52b56b=_['values'](_0x4c1991[_0x209c('0x53')]);_0xbfc24a({'count':_0x52b56b[_0x209c('0x19')],'rows':_0x52b56b});});},'OpenchannelQueuesWaitingInteractions':function(_0x16cfdd){return new Promise(function(_0x2eff1c,_0x5af181){var _0x188930=_['values'](_0x4c1991[_0x209c('0x54')]);_0x2eff1c({'count':_0x188930[_0x209c('0x19')],'rows':_0x188930});});},'SmsQueuesWaitingInteractions':function(_0x3f2577){return new Promise(function(_0x1dd3ec,_0x6e6fb1){var _0x5be559=_[_0x209c('0x47')](_0x4c1991[_0x209c('0x55')]);_0x1dd3ec({'count':_0x5be559['length'],'rows':_0x5be559});});},'FaxQueuesWaitingInteractions':function(_0x59cf15){return new Promise(function(_0x498747,_0x3faf40){var _0x8dbba9=_[_0x209c('0x47')](_0x4c1991['faxQueuesWaitingInteractions']);_0x498747({'count':_0x8dbba9[_0x209c('0x19')],'rows':_0x8dbba9});});},'WhatsappQueuesWaitingInteractions':function(_0x5e2328){return new Promise(function(_0x379c88,_0x7106ca){var _0x102ddd=_[_0x209c('0x47')](_0x4c1991['whatsappQueuesWaitingInteractions']);_0x379c88({'count':_0x102ddd['length'],'rows':_0x102ddd});});}};var _0x2098d2=jayson['server'](_0x43b20f)[_0x209c('0x56')]();_0x2098d2['on'](_0x209c('0x35'),function(_0x232c2f){logger[_0x209c('0x35')](JSON[_0x209c('0x31')](_0x232c2f));return _0xbd78b5(_0x232c2f);});_0x2098d2['listen'](0x232c,'127.0.0.1',function(){console['log'](_0x209c('0x57'),0x232c);return _0x5a0532(_0x209c('0x58')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index af3e041..6e7c399 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 _0xa914=['message','result','catch','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','log','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http','then','error'];(function(_0x39cad3,_0x298264){var _0x15b8eb=function(_0x189eff){while(--_0x189eff){_0x39cad3['push'](_0x39cad3['shift']());}};_0x15b8eb(++_0x298264);}(_0xa914,0x19b));var _0x4a91=function(_0x499ae7,_0x11541d){_0x499ae7=_0x499ae7-0x0;var _0xdfdd0f=_0xa914[_0x499ae7];return _0xdfdd0f;};'use strict';var util=require(_0x4a91('0x0'));var BPromise=require(_0x4a91('0x1'));var jayson=require(_0x4a91('0x2'));var _=require(_0x4a91('0x3'));var logger=require(_0x4a91('0x4'))('routing');var client=jayson[_0x4a91('0x5')][_0x4a91('0x6')]({'port':0x232a});function request(_0x56b04b,_0x5cde9){return new BPromise(function(_0x5aa4c7,_0x17e2b3){return client['request'](_0x56b04b,_0x5cde9)[_0x4a91('0x7')](function(_0x22d927){if(_0x22d927[_0x4a91('0x8')]){return _0x17e2b3(_0x22d927['error'][_0x4a91('0x9')]);}else{return _0x5aa4c7(_0x22d927[_0x4a91('0xa')]);}})[_0x4a91('0xb')](function(_0x12162f){return _0x17e2b3(_0x12162f);});});}exports[_0x4a91('0xc')]=function(_0xe6171a,_0x32e91a,_0x2c5503){return function(_0x39c883){if(_0x2c5503['rules']&&!_0x2c5503['rules'][_0xe6171a]){logger[_0x4a91('0xd')](_0x4a91('0xe'),_0xe6171a);return _0x39c883[_0x4a91('0xf')]();}var _0x44f96a=[];for(var _0x5110f7=0x0;_0x5110f7<_0x32e91a[_0x4a91('0x10')];_0x5110f7+=0x1){_0x44f96a['push'](request(_0x4a91('0x11'),{'command':util[_0x4a91('0x12')](_0x4a91('0x13'),_0x32e91a[_0x5110f7])})[_0x4a91('0x7')](function(_0x37007a){return _0x37007a&&_0x37007a[_0x4a91('0x9')]&&_0x37007a[_0x4a91('0x9')][_0x4a91('0x14')](_0x4a91('0x15'))>=0x0?!![]:![];})[_0x4a91('0xb')](function(_0x22f9b5){logger[_0x4a91('0x8')](_0x4a91('0x16'),_0xe6171a,_0x32e91a[_0x5110f7]);}));}BPromise[_0x4a91('0x17')](_0x44f96a)['then'](function(_0x58660f){var _0x12520a=_[_0x4a91('0x18')](_0x58660f);logger[_0x4a91('0xd')]('[%s][INTERVAL]\x20%s\x20%s',_0xe6171a,_0x32e91a[_0x4a91('0x19')](_0x4a91('0x1a')),_0x12520a);_0x39c883['when'](_0x12520a);})[_0x4a91('0xb')](function(_0x3461d7){console[_0x4a91('0x1b')](_0x3461d7);logger[_0x4a91('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0xe6171a,_0x32e91a[_0x4a91('0x19')](_0x4a91('0x1a')),_0x3461d7['stack']);_0x39c883[_0x4a91('0xf')]();});};}; \ No newline at end of file +var _0x87cd=['join','log','[%s][INTERVAL]\x20%s\x20%s','util','bluebird','jayson/promise','../../../config/logger','routing','http','request','then','error','message','result','catch','rules','stop','length','push','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some'];(function(_0x51cdc4,_0x2ca7fd){var _0x1b6ddf=function(_0x17d765){while(--_0x17d765){_0x51cdc4['push'](_0x51cdc4['shift']());}};_0x1b6ddf(++_0x2ca7fd);}(_0x87cd,0x155));var _0xd87c=function(_0x4372a3,_0x132ee3){_0x4372a3=_0x4372a3-0x0;var _0x25b0f9=_0x87cd[_0x4372a3];return _0x25b0f9;};'use strict';var util=require(_0xd87c('0x0'));var BPromise=require(_0xd87c('0x1'));var jayson=require(_0xd87c('0x2'));var _=require('lodash');var logger=require(_0xd87c('0x3'))(_0xd87c('0x4'));var client=jayson['client'][_0xd87c('0x5')]({'port':0x232a});function request(_0x50f289,_0xb006a4){return new BPromise(function(_0x2c5d07,_0x11b17d){return client[_0xd87c('0x6')](_0x50f289,_0xb006a4)[_0xd87c('0x7')](function(_0x12137b){if(_0x12137b['error']){return _0x11b17d(_0x12137b[_0xd87c('0x8')][_0xd87c('0x9')]);}else{return _0x2c5d07(_0x12137b[_0xd87c('0xa')]);}})[_0xd87c('0xb')](function(_0x5cbc55){return _0x11b17d(_0x5cbc55);});});}exports['condition']=function(_0x1a94f4,_0x1ff962,_0x10f0dc){return function(_0x4ea42d){if(_0x10f0dc[_0xd87c('0xc')]&&!_0x10f0dc[_0xd87c('0xc')][_0x1a94f4]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x1a94f4);return _0x4ea42d[_0xd87c('0xd')]();}var _0x28801a=[];for(var _0x157dc5=0x0;_0x157dc5<_0x1ff962[_0xd87c('0xe')];_0x157dc5+=0x1){_0x28801a[_0xd87c('0xf')](request(_0xd87c('0x10'),{'command':util['format'](_0xd87c('0x11'),_0x1ff962[_0x157dc5])})[_0xd87c('0x7')](function(_0x3fcbf3){return _0x3fcbf3&&_0x3fcbf3[_0xd87c('0x9')]&&_0x3fcbf3[_0xd87c('0x9')][_0xd87c('0x12')](_0xd87c('0x13'))>=0x0?!![]:![];})[_0xd87c('0xb')](function(_0xba9a66){logger[_0xd87c('0x8')](_0xd87c('0x14'),_0x1a94f4,_0x1ff962[_0x157dc5]);}));}BPromise[_0xd87c('0x15')](_0x28801a)[_0xd87c('0x7')](function(_0x53a864){var _0x5e6ec1=_[_0xd87c('0x16')](_0x53a864);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x1a94f4,_0x1ff962[_0xd87c('0x17')]('\x20|\x20'),_0x5e6ec1);_0x4ea42d['when'](_0x5e6ec1);})[_0xd87c('0xb')](function(_0x337223){console[_0xd87c('0x18')](_0x337223);logger['error'](_0xd87c('0x19'),_0x1a94f4,_0x1ff962['join']('\x20|\x20'),_0x337223['stack']);_0x4ea42d[_0xd87c('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index a24b5bc..d531bb7 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 _0x5d12=['agentconnect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','transfertargetuniqueid','agentcalledAt','hangup','cause','rejected','agent','lodash','./utils','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','queue','then','type','agentacw','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','agentcalled','destuniqueid','called','connectedlinename','error','agentringnoanswer','isNil','lastevent','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','agentringnoanswerAt','now','abandoned','stack'];(function(_0x2c5255,_0x4340c3){var _0x30d0ea=function(_0x131ba1){while(--_0x131ba1){_0x2c5255['push'](_0x2c5255['shift']());}};_0x30d0ea(++_0x4340c3);}(_0x5d12,0x18f));var _0x25d1=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x5d12[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0x25d1('0x0'));var util=require('util');var utils=require(_0x25d1('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x104f08,_0x3ddd2f){utils['info'](util[_0x25d1('0x2')](_0x25d1('0x3'),_0x104f08[_0x25d1('0x4')],_0x104f08['channel'],_0x104f08['queue'],_0x104f08[_0x25d1('0x5')],_0x104f08[_0x25d1('0x6')],_0x104f08[_0x25d1('0x7')],_0x104f08[_0x25d1('0x8')],_0x104f08['lastevent']));if(_0x104f08['queue']){utils[_0x25d1('0x9')](_0x104f08[_0x25d1('0xa')])[_0x25d1('0xb')](function(_0x9f7d8a){if(_0x9f7d8a){_0x104f08[_0x25d1('0xc')]=_0x9f7d8a[_0x25d1('0xc')];_0x104f08[_0x25d1('0xd')]=_0x104f08['agentcomplete']?_0x9f7d8a[_0x25d1('0xe')]:![];_0x104f08[_0x25d1('0xf')]=_0x104f08['agentacw']?_0x9f7d8a[_0x25d1('0x10')]:0x0;}utils['request'](_0x25d1('0x11'),_0x104f08);});}else{utils[_0x25d1('0x12')](_0x25d1('0x11'),_0x104f08);}if(_0x3ddd2f){delete transfers[_0x104f08[_0x25d1('0x4')]];}else{delete agents[_0x104f08['destuniqueid']];}}exports[_0x25d1('0x13')]=function(_0x1e84a7){try{agents[_0x1e84a7[_0x25d1('0x14')]]=_0x1e84a7;agents[_0x1e84a7[_0x25d1('0x14')]]['agentcalledAt']=utils['now']();agents[_0x1e84a7[_0x25d1('0x14')]]['lastevent']=_0x25d1('0x15');agents[_0x1e84a7[_0x25d1('0x14')]]['connectedlinenum']=null;agents[_0x1e84a7[_0x25d1('0x14')]][_0x25d1('0x16')]=null;}catch(_0x1e66ab){utils[_0x25d1('0x17')](_0x1e66ab['stack']);}};exports[_0x25d1('0x18')]=function(_0x3cecc9){try{if(!_[_0x25d1('0x19')](agents[_0x3cecc9[_0x25d1('0x14')]])){agents[_0x3cecc9[_0x25d1('0x14')]][_0x25d1('0x18')]=!![];agents[_0x3cecc9[_0x25d1('0x14')]]['agentringnoanswerAt']=utils['now']();agents[_0x3cecc9[_0x25d1('0x14')]][_0x25d1('0x1a')]='timeout';agents[_0x3cecc9['destuniqueid']][_0x25d1('0x1b')]='timeout';agents[_0x3cecc9[_0x25d1('0x14')]][_0x25d1('0x1c')]=_0x3cecc9[_0x25d1('0x1d')]?parseInt(_0x3cecc9[_0x25d1('0x1d')])/0x3e8:0x0;agents[_0x3cecc9[_0x25d1('0x14')]][_0x25d1('0x1e')]=0x0;unanswered[_0x25d1('0x1f')](_0x3cecc9[_0x25d1('0x14')]);}}catch(_0x2be4cf){utils['error'](_0x2be4cf['stack']);}};exports[_0x25d1('0x20')]=function(_0x498573){try{_[_0x25d1('0x21')](agents,function(_0x53b652,_0x51c0f9){if(_0x53b652['uniqueid']==_0x498573[_0x25d1('0x4')]&&!_[_0x25d1('0x22')](unanswered,_0x53b652['destuniqueid'])){_0x53b652[_0x25d1('0x18')]=!![];_0x53b652[_0x25d1('0x23')]=utils[_0x25d1('0x24')]();_0x53b652[_0x25d1('0x1a')]=_0x25d1('0x25');_0x53b652[_0x25d1('0x1b')]='abandoned';_0x53b652[_0x25d1('0x1c')]=_0x498573['holdtime'];_0x53b652[_0x25d1('0x1e')]=0x0;writeDB(_0x53b652);}});}catch(_0x413a8f){utils[_0x25d1('0x17')](_0x413a8f[_0x25d1('0x26')]);}};exports[_0x25d1('0x27')]=function(_0x703f13){try{if(agents[_0x703f13[_0x25d1('0x14')]]){agents[_0x703f13[_0x25d1('0x14')]][_0x25d1('0x28')]=utils['now']();agents[_0x703f13['destuniqueid']][_0x25d1('0x8')]=_0x703f13[_0x25d1('0x8')];agents[_0x703f13[_0x25d1('0x14')]][_0x25d1('0x16')]=_0x703f13[_0x25d1('0x16')];agents[_0x703f13[_0x25d1('0x14')]][_0x25d1('0x1c')]=_0x703f13['ringtime'];agents[_0x703f13[_0x25d1('0x14')]][_0x25d1('0x1a')]=_0x25d1('0x29');_[_0x25d1('0x21')](agents,function(_0x4b7404,_0x36fc4b){if(_0x4b7404['destuniqueid']!=_0x703f13[_0x25d1('0x14')]&&_0x4b7404[_0x25d1('0x4')]==_0x703f13['uniqueid']){_0x4b7404[_0x25d1('0x1e')]=0x0;_0x4b7404[_0x25d1('0x1c')]=_0x703f13[_0x25d1('0x1d')];_0x4b7404[_0x25d1('0x18')]=!![];_0x4b7404['agentringnoanswerAt']=utils[_0x25d1('0x24')]();_0x4b7404[_0x25d1('0x1a')]=_0x25d1('0x2a');_0x4b7404['reason']=_0x25d1('0x2a');_0x4b7404[_0x25d1('0x2b')]=_0x703f13[_0x25d1('0x14')];_0x4b7404[_0x25d1('0x2c')]=_0x703f13[_0x25d1('0x5')];writeDB(_0x4b7404);}});}}catch(_0x373562){utils[_0x25d1('0x17')](_0x373562[_0x25d1('0x26')]);}};exports[_0x25d1('0x2d')]=function(_0x4c8ae5){try{if(!_['isNil'](agents[_0x4c8ae5[_0x25d1('0x14')]])){agents[_0x4c8ae5[_0x25d1('0x14')]][_0x25d1('0x2d')]=!![];agents[_0x4c8ae5['destuniqueid']][_0x25d1('0x2e')]=utils[_0x25d1('0x24')]();agents[_0x4c8ae5['destuniqueid']]['talktime']=utils[_0x25d1('0x2f')](agents[_0x4c8ae5[_0x25d1('0x14')]][_0x25d1('0x2e')],agents[_0x4c8ae5[_0x25d1('0x14')]][_0x25d1('0x28')]);agents[_0x4c8ae5[_0x25d1('0x14')]][_0x25d1('0x1b')]=_0x4c8ae5['reason'];agents[_0x4c8ae5['destuniqueid']]['lastevent']=_0x25d1('0x30');writeDB(agents[_0x4c8ae5[_0x25d1('0x14')]]);}}catch(_0x38257c){utils[_0x25d1('0x17')](_0x38257c['stack']);}};exports[_0x25d1('0x31')]=function(_0x26e6de){try{if(!_[_0x25d1('0x19')](agents[_0x26e6de[_0x25d1('0x32')]])){agents[_0x26e6de[_0x25d1('0x32')]][_0x25d1('0x33')]=!![];agents[_0x26e6de[_0x25d1('0x32')]][_0x25d1('0x34')]=_0x25d1('0x35');agents[_0x26e6de['transfereruniqueid']][_0x25d1('0x36')]=_0x26e6de[_0x25d1('0x37')];agents[_0x26e6de[_0x25d1('0x32')]][_0x25d1('0x38')]=agents[_0x26e6de[_0x25d1('0x32')]][_0x25d1('0x4')];}}catch(_0x5d1fbd){utils[_0x25d1('0x17')](_0x5d1fbd[_0x25d1('0x26')]);}};exports[_0x25d1('0x39')]=function(_0xc7e5b1){try{if(_0xc7e5b1[_0x25d1('0x3a')]==_0xc7e5b1['origtransfererlinkedid']){if(!_[_0x25d1('0x19')](agents[_0xc7e5b1[_0x25d1('0x3b')]])){agents[_0xc7e5b1[_0x25d1('0x3b')]][_0x25d1('0x33')]=!![];agents[_0xc7e5b1['secondtransfereruniqueid']][_0x25d1('0x34')]=_0x25d1('0x3c');agents[_0xc7e5b1['secondtransfereruniqueid']][_0x25d1('0x36')]=_0xc7e5b1[_0x25d1('0x3d')];agents[_0xc7e5b1['secondtransfereruniqueid']]['transferuniqueid']=_0xc7e5b1[_0x25d1('0x3a')];}if(_0xc7e5b1[_0x25d1('0x3e')]&&agents[_0xc7e5b1[_0x25d1('0x3e')]]){agents[_0xc7e5b1[_0x25d1('0x3e')]][_0x25d1('0x3f')]=0x1;transfers[_0xc7e5b1['transfereeuniqueid']]=_[_0x25d1('0x40')](agents[_0xc7e5b1[_0x25d1('0x3e')]]);transfers[_0xc7e5b1['transfereeuniqueid']]['calleridnum']=agents[_0xc7e5b1[_0x25d1('0x3b')]][_0x25d1('0x7')];transfers[_0xc7e5b1[_0x25d1('0x3e')]][_0x25d1('0x41')]=agents[_0xc7e5b1[_0x25d1('0x3b')]][_0x25d1('0x41')];transfers[_0xc7e5b1['transfereeuniqueid']]['agentcalledAt']=utils[_0x25d1('0x24')]();transfers[_0xc7e5b1[_0x25d1('0x3e')]]['agentconnectAt']=utils[_0x25d1('0x24')]();transfers[_0xc7e5b1['transfereeuniqueid']][_0x25d1('0x1c')]=0x0;transfers[_0xc7e5b1['transfereeuniqueid']][_0x25d1('0x3f')]=0x2;}}else if(_0xc7e5b1['secondtransfereruniqueid']==_0xc7e5b1[_0x25d1('0x42')]){if(!_[_0x25d1('0x19')](agents[_0xc7e5b1[_0x25d1('0x3a')]])){agents[_0xc7e5b1[_0x25d1('0x3a')]][_0x25d1('0x33')]=!![];agents[_0xc7e5b1[_0x25d1('0x3a')]][_0x25d1('0x34')]=_0x25d1('0x3c');agents[_0xc7e5b1[_0x25d1('0x3a')]][_0x25d1('0x36')]=_0xc7e5b1['secondtransfererexten'];agents[_0xc7e5b1['origtransfereruniqueid']][_0x25d1('0x38')]=_0xc7e5b1['secondtransfereruniqueid'];}if(_0xc7e5b1[_0x25d1('0x43')]&&agents[_0xc7e5b1[_0x25d1('0x43')]]){agents[_0xc7e5b1[_0x25d1('0x43')]][_0x25d1('0x3f')]=0x1;transfers[_0xc7e5b1[_0x25d1('0x43')]]=_[_0x25d1('0x40')](agents[_0xc7e5b1[_0x25d1('0x43')]]);transfers[_0xc7e5b1[_0x25d1('0x43')]]['calleridnum']=agents[_0xc7e5b1[_0x25d1('0x3a')]][_0x25d1('0x7')];transfers[_0xc7e5b1[_0x25d1('0x43')]]['calleridname']=agents[_0xc7e5b1[_0x25d1('0x3a')]][_0x25d1('0x41')];transfers[_0xc7e5b1[_0x25d1('0x43')]][_0x25d1('0x44')]=utils[_0x25d1('0x24')]();transfers[_0xc7e5b1[_0x25d1('0x43')]][_0x25d1('0x28')]=utils[_0x25d1('0x24')]();transfers[_0xc7e5b1[_0x25d1('0x43')]][_0x25d1('0x1c')]=0x0;transfers[_0xc7e5b1[_0x25d1('0x43')]][_0x25d1('0x3f')]=0x2;}}}catch(_0x14b325){utils[_0x25d1('0x17')](_0x14b325[_0x25d1('0x26')]);}};exports[_0x25d1('0x45')]=function(_0x90fb1f){try{if(agents[_0x90fb1f[_0x25d1('0x4')]]&&agents[_0x90fb1f[_0x25d1('0x4')]][_0x25d1('0x1b')]==='timeout'){if(_0x90fb1f[_0x25d1('0x46')]==='21'){agents[_0x90fb1f[_0x25d1('0x4')]][_0x25d1('0x1b')]=_0x25d1('0x47');agents[_0x90fb1f['uniqueid']][_0x25d1('0x1a')]=_0x25d1('0x47');}writeDB(agents[_0x90fb1f[_0x25d1('0x4')]]);var _0x880397=unanswered['indexOf'](_0x90fb1f[_0x25d1('0x4')]);if(_0x880397>-0x1)unanswered['splice'](_0x880397,0x1);}if(transfers[_0x90fb1f[_0x25d1('0x4')]]){transfers[_0x90fb1f['uniqueid']][_0x25d1('0x2d')]=!![];transfers[_0x90fb1f[_0x25d1('0x4')]][_0x25d1('0x2e')]=utils[_0x25d1('0x24')]();transfers[_0x90fb1f[_0x25d1('0x4')]][_0x25d1('0x1e')]=utils[_0x25d1('0x2f')](transfers[_0x90fb1f[_0x25d1('0x4')]][_0x25d1('0x2e')],transfers[_0x90fb1f[_0x25d1('0x4')]][_0x25d1('0x28')]);transfers[_0x90fb1f[_0x25d1('0x4')]]['reason']=_0x25d1('0x48');transfers[_0x90fb1f[_0x25d1('0x4')]][_0x25d1('0x1a')]='complete';writeDB(transfers[_0x90fb1f[_0x25d1('0x4')]],!![]);}if(agents[_0x90fb1f[_0x25d1('0x4')]]&&agents[_0x90fb1f[_0x25d1('0x4')]]['agentconnectAt']){agents[_0x90fb1f[_0x25d1('0x4')]][_0x25d1('0x2d')]=!![];agents[_0x90fb1f[_0x25d1('0x4')]][_0x25d1('0x2e')]=utils[_0x25d1('0x24')]();agents[_0x90fb1f[_0x25d1('0x4')]][_0x25d1('0x1e')]=utils[_0x25d1('0x2f')](agents[_0x90fb1f[_0x25d1('0x4')]][_0x25d1('0x2e')],agents[_0x90fb1f[_0x25d1('0x4')]][_0x25d1('0x28')]);agents[_0x90fb1f[_0x25d1('0x4')]][_0x25d1('0x1b')]=agents[_0x90fb1f[_0x25d1('0x4')]]['transfer']?'transfer':_0x25d1('0x48');agents[_0x90fb1f[_0x25d1('0x4')]][_0x25d1('0x1a')]=_0x25d1('0x30');writeDB(agents[_0x90fb1f['uniqueid']]);}}catch(_0x5bb846){utils[_0x25d1('0x17')](_0x5bb846[_0x25d1('0x26')]);}}; \ No newline at end of file +var _0xd906=['clone','hangup','cause','rejected','indexOf','splice','agent','complete','lodash','util','./utils','info','format','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','uniqueid','destuniqueid','agentcalled','agentcalledAt','now','called','error','stack','isNil','agentringnoanswer','agentringnoanswerAt','lastevent','timeout','ringtime','push','queuecallerabandon','forIn','includes','abandoned','holdtime','talktime','agentconnect','agentconnectAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','agentcompleteAt','diffTime','reason','blindtransfer','transfereruniqueid','transfertype','blind','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','transfertargetuniqueid'];(function(_0x1804c1,_0x2b07bc){var _0x24b5bb=function(_0xa02e68){while(--_0xa02e68){_0x1804c1['push'](_0x1804c1['shift']());}};_0x24b5bb(++_0x2b07bc);}(_0xd906,0x175));var _0x6d90=function(_0x1f703f,_0x2eca87){_0x1f703f=_0x1f703f-0x0;var _0x17b7f1=_0xd906[_0x1f703f];return _0x17b7f1;};'use strict';var _=require(_0x6d90('0x0'));var util=require(_0x6d90('0x1'));var utils=require(_0x6d90('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x25c158,_0x3a62d6){utils[_0x6d90('0x3')](util[_0x6d90('0x4')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x25c158['uniqueid'],_0x25c158[_0x6d90('0x5')],_0x25c158[_0x6d90('0x6')],_0x25c158[_0x6d90('0x7')],_0x25c158[_0x6d90('0x8')],_0x25c158[_0x6d90('0x9')],_0x25c158[_0x6d90('0xa')],_0x25c158['lastevent']));if(_0x25c158[_0x6d90('0x6')]){utils[_0x6d90('0xb')](_0x25c158['queue'])[_0x6d90('0xc')](function(_0x5a087e){if(_0x5a087e){_0x25c158[_0x6d90('0xd')]=_0x5a087e[_0x6d90('0xd')];_0x25c158[_0x6d90('0xe')]=_0x25c158['agentcomplete']?_0x5a087e[_0x6d90('0xf')]:![];_0x25c158[_0x6d90('0x10')]=_0x25c158['agentacw']?_0x5a087e[_0x6d90('0x11')]:0x0;}utils['request'](_0x6d90('0x12'),_0x25c158);});}else{utils[_0x6d90('0x13')](_0x6d90('0x12'),_0x25c158);}if(_0x3a62d6){delete transfers[_0x25c158[_0x6d90('0x14')]];}else{delete agents[_0x25c158[_0x6d90('0x15')]];}}exports[_0x6d90('0x16')]=function(_0x4315c2){try{agents[_0x4315c2[_0x6d90('0x15')]]=_0x4315c2;agents[_0x4315c2[_0x6d90('0x15')]][_0x6d90('0x17')]=utils[_0x6d90('0x18')]();agents[_0x4315c2[_0x6d90('0x15')]]['lastevent']=_0x6d90('0x19');agents[_0x4315c2[_0x6d90('0x15')]][_0x6d90('0xa')]=null;agents[_0x4315c2[_0x6d90('0x15')]]['connectedlinename']=null;}catch(_0x536ea4){utils[_0x6d90('0x1a')](_0x536ea4[_0x6d90('0x1b')]);}};exports['agentringnoanswer']=function(_0x5d368e){try{if(!_[_0x6d90('0x1c')](agents[_0x5d368e[_0x6d90('0x15')]])){agents[_0x5d368e['destuniqueid']][_0x6d90('0x1d')]=!![];agents[_0x5d368e[_0x6d90('0x15')]][_0x6d90('0x1e')]=utils[_0x6d90('0x18')]();agents[_0x5d368e[_0x6d90('0x15')]][_0x6d90('0x1f')]=_0x6d90('0x20');agents[_0x5d368e[_0x6d90('0x15')]]['reason']='timeout';agents[_0x5d368e[_0x6d90('0x15')]]['holdtime']=_0x5d368e[_0x6d90('0x21')]?parseInt(_0x5d368e['ringtime'])/0x3e8:0x0;agents[_0x5d368e[_0x6d90('0x15')]]['talktime']=0x0;unanswered[_0x6d90('0x22')](_0x5d368e[_0x6d90('0x15')]);}}catch(_0x4b0527){utils['error'](_0x4b0527[_0x6d90('0x1b')]);}};exports[_0x6d90('0x23')]=function(_0x195e18){try{_[_0x6d90('0x24')](agents,function(_0x3d041c,_0x5ecbe9){if(_0x3d041c[_0x6d90('0x14')]==_0x195e18['uniqueid']&&!_[_0x6d90('0x25')](unanswered,_0x3d041c[_0x6d90('0x15')])){_0x3d041c[_0x6d90('0x1d')]=!![];_0x3d041c[_0x6d90('0x1e')]=utils[_0x6d90('0x18')]();_0x3d041c[_0x6d90('0x1f')]='abandoned';_0x3d041c['reason']=_0x6d90('0x26');_0x3d041c[_0x6d90('0x27')]=_0x195e18[_0x6d90('0x27')];_0x3d041c[_0x6d90('0x28')]=0x0;writeDB(_0x3d041c);}});}catch(_0x3450b4){utils[_0x6d90('0x1a')](_0x3450b4[_0x6d90('0x1b')]);}};exports[_0x6d90('0x29')]=function(_0x27ff44){try{if(agents[_0x27ff44[_0x6d90('0x15')]]){agents[_0x27ff44[_0x6d90('0x15')]][_0x6d90('0x2a')]=utils[_0x6d90('0x18')]();agents[_0x27ff44[_0x6d90('0x15')]][_0x6d90('0xa')]=_0x27ff44[_0x6d90('0xa')];agents[_0x27ff44[_0x6d90('0x15')]]['connectedlinename']=_0x27ff44['connectedlinename'];agents[_0x27ff44[_0x6d90('0x15')]][_0x6d90('0x27')]=_0x27ff44['ringtime'];agents[_0x27ff44[_0x6d90('0x15')]][_0x6d90('0x1f')]='connect';_[_0x6d90('0x24')](agents,function(_0xe3f6c4,_0x11746e){if(_0xe3f6c4['destuniqueid']!=_0x27ff44[_0x6d90('0x15')]&&_0xe3f6c4['uniqueid']==_0x27ff44['uniqueid']){_0xe3f6c4[_0x6d90('0x28')]=0x0;_0xe3f6c4[_0x6d90('0x27')]=_0x27ff44['ringtime'];_0xe3f6c4['agentringnoanswer']=!![];_0xe3f6c4[_0x6d90('0x1e')]=utils[_0x6d90('0x18')]();_0xe3f6c4['lastevent']='answered_elsewhere';_0xe3f6c4['reason']='answered_elsewhere';_0xe3f6c4[_0x6d90('0x2b')]=_0x27ff44['destuniqueid'];_0xe3f6c4[_0x6d90('0x2c')]=_0x27ff44[_0x6d90('0x7')];writeDB(_0xe3f6c4);}});}}catch(_0x3948d3){utils[_0x6d90('0x1a')](_0x3948d3[_0x6d90('0x1b')]);}};exports['agentcomplete']=function(_0x852701){try{if(!_['isNil'](agents[_0x852701['destuniqueid']])){agents[_0x852701[_0x6d90('0x15')]][_0x6d90('0x2d')]=!![];agents[_0x852701[_0x6d90('0x15')]][_0x6d90('0x2e')]=utils[_0x6d90('0x18')]();agents[_0x852701[_0x6d90('0x15')]]['talktime']=utils[_0x6d90('0x2f')](agents[_0x852701['destuniqueid']][_0x6d90('0x2e')],agents[_0x852701['destuniqueid']][_0x6d90('0x2a')]);agents[_0x852701[_0x6d90('0x15')]][_0x6d90('0x30')]=_0x852701['reason'];agents[_0x852701[_0x6d90('0x15')]]['lastevent']='complete';writeDB(agents[_0x852701[_0x6d90('0x15')]]);}}catch(_0x5e0b26){utils[_0x6d90('0x1a')](_0x5e0b26[_0x6d90('0x1b')]);}};exports[_0x6d90('0x31')]=function(_0x44d930){try{if(!_[_0x6d90('0x1c')](agents[_0x44d930[_0x6d90('0x32')]])){agents[_0x44d930[_0x6d90('0x32')]]['transfer']=!![];agents[_0x44d930[_0x6d90('0x32')]][_0x6d90('0x33')]=_0x6d90('0x34');agents[_0x44d930[_0x6d90('0x32')]]['transferexten']=_0x44d930[_0x6d90('0x35')];agents[_0x44d930[_0x6d90('0x32')]][_0x6d90('0x36')]=agents[_0x44d930[_0x6d90('0x32')]][_0x6d90('0x14')];}}catch(_0x4aa71e){utils[_0x6d90('0x1a')](_0x4aa71e[_0x6d90('0x1b')]);}};exports['attendedtransfer']=function(_0x3359f4){try{if(_0x3359f4[_0x6d90('0x37')]==_0x3359f4[_0x6d90('0x38')]){if(!_[_0x6d90('0x1c')](agents[_0x3359f4[_0x6d90('0x39')]])){agents[_0x3359f4[_0x6d90('0x39')]][_0x6d90('0x3a')]=!![];agents[_0x3359f4[_0x6d90('0x39')]][_0x6d90('0x33')]='ATTENDED';agents[_0x3359f4[_0x6d90('0x39')]][_0x6d90('0x3b')]=_0x3359f4[_0x6d90('0x3c')];agents[_0x3359f4[_0x6d90('0x39')]][_0x6d90('0x36')]=_0x3359f4['origtransfereruniqueid'];}if(_0x3359f4[_0x6d90('0x3d')]&&agents[_0x3359f4[_0x6d90('0x3d')]]){agents[_0x3359f4[_0x6d90('0x3d')]][_0x6d90('0x3e')]=0x1;transfers[_0x3359f4[_0x6d90('0x3d')]]=_['clone'](agents[_0x3359f4['transfereeuniqueid']]);transfers[_0x3359f4['transfereeuniqueid']]['calleridnum']=agents[_0x3359f4[_0x6d90('0x39')]]['calleridnum'];transfers[_0x3359f4[_0x6d90('0x3d')]][_0x6d90('0x3f')]=agents[_0x3359f4[_0x6d90('0x39')]][_0x6d90('0x3f')];transfers[_0x3359f4[_0x6d90('0x3d')]][_0x6d90('0x17')]=utils['now']();transfers[_0x3359f4[_0x6d90('0x3d')]][_0x6d90('0x2a')]=utils[_0x6d90('0x18')]();transfers[_0x3359f4['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x3359f4[_0x6d90('0x3d')]][_0x6d90('0x3e')]=0x2;}}else if(_0x3359f4['secondtransfereruniqueid']==_0x3359f4['secondtransfererlinkedid']){if(!_[_0x6d90('0x1c')](agents[_0x3359f4[_0x6d90('0x37')]])){agents[_0x3359f4[_0x6d90('0x37')]]['transfer']=!![];agents[_0x3359f4[_0x6d90('0x37')]]['transfertype']='ATTENDED';agents[_0x3359f4['origtransfereruniqueid']][_0x6d90('0x3b')]=_0x3359f4['secondtransfererexten'];agents[_0x3359f4[_0x6d90('0x37')]][_0x6d90('0x36')]=_0x3359f4[_0x6d90('0x39')];}if(_0x3359f4[_0x6d90('0x40')]&&agents[_0x3359f4[_0x6d90('0x40')]]){agents[_0x3359f4[_0x6d90('0x40')]][_0x6d90('0x3e')]=0x1;transfers[_0x3359f4[_0x6d90('0x40')]]=_[_0x6d90('0x41')](agents[_0x3359f4[_0x6d90('0x40')]]);transfers[_0x3359f4[_0x6d90('0x40')]]['calleridnum']=agents[_0x3359f4['origtransfereruniqueid']][_0x6d90('0x9')];transfers[_0x3359f4[_0x6d90('0x40')]][_0x6d90('0x3f')]=agents[_0x3359f4[_0x6d90('0x37')]][_0x6d90('0x3f')];transfers[_0x3359f4[_0x6d90('0x40')]][_0x6d90('0x17')]=utils[_0x6d90('0x18')]();transfers[_0x3359f4[_0x6d90('0x40')]][_0x6d90('0x2a')]=utils[_0x6d90('0x18')]();transfers[_0x3359f4[_0x6d90('0x40')]][_0x6d90('0x27')]=0x0;transfers[_0x3359f4['transfertargetuniqueid']][_0x6d90('0x3e')]=0x2;}}}catch(_0x5e4390){utils['error'](_0x5e4390[_0x6d90('0x1b')]);}};exports[_0x6d90('0x42')]=function(_0x22aa6f){try{if(agents[_0x22aa6f[_0x6d90('0x14')]]&&agents[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x30')]==='timeout'){if(_0x22aa6f[_0x6d90('0x43')]==='21'){agents[_0x22aa6f['uniqueid']][_0x6d90('0x30')]=_0x6d90('0x44');agents[_0x22aa6f[_0x6d90('0x14')]]['lastevent']='rejected';}writeDB(agents[_0x22aa6f[_0x6d90('0x14')]]);var _0x2ebbf6=unanswered[_0x6d90('0x45')](_0x22aa6f[_0x6d90('0x14')]);if(_0x2ebbf6>-0x1)unanswered[_0x6d90('0x46')](_0x2ebbf6,0x1);}if(transfers[_0x22aa6f[_0x6d90('0x14')]]){transfers[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x2d')]=!![];transfers[_0x22aa6f['uniqueid']]['agentcompleteAt']=utils[_0x6d90('0x18')]();transfers[_0x22aa6f['uniqueid']]['talktime']=utils['diffTime'](transfers[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x2e')],transfers[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x2a')]);transfers[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x30')]=_0x6d90('0x47');transfers[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x1f')]=_0x6d90('0x48');writeDB(transfers[_0x22aa6f['uniqueid']],!![]);}if(agents[_0x22aa6f[_0x6d90('0x14')]]&&agents[_0x22aa6f[_0x6d90('0x14')]]['agentconnectAt']){agents[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x2d')]=!![];agents[_0x22aa6f[_0x6d90('0x14')]]['agentcompleteAt']=utils[_0x6d90('0x18')]();agents[_0x22aa6f['uniqueid']][_0x6d90('0x28')]=utils[_0x6d90('0x2f')](agents[_0x22aa6f[_0x6d90('0x14')]]['agentcompleteAt'],agents[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x2a')]);agents[_0x22aa6f['uniqueid']][_0x6d90('0x30')]=agents[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x3a')]?_0x6d90('0x3a'):_0x6d90('0x47');agents[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x1f')]=_0x6d90('0x48');writeDB(agents[_0x22aa6f[_0x6d90('0x14')]]);}}catch(_0x93637e){utils[_0x6d90('0x1a')](_0x93637e[_0x6d90('0x1b')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index d5c60d2..c2bc8f3 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 _0xc07f=['channelstate','systemanswertime','transfer','answertime','toNumber','error','stack','hangup','calleridname','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','_attended','transfertargetchannel','destinationchannel','origtransfererchannel','userfield','musiconholdstart','musiconholdstop','musiconholdstartAt','mohtime','xmd-originatecalleridnum','variable','xmd-phone','xmd-callerid-preview','xmd-queue','lastdata','value','xmd-contactid','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','application','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','source','destination','callerid','disposition','then','CreateVoiceCallReport','request','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','context','now','DOCUMENTATION','isNil'];(function(_0x23d789,_0x9aeb78){var _0x567afd=function(_0x4cdfff){while(--_0x4cdfff){_0x23d789['push'](_0x23d789['shift']());}};_0x567afd(++_0x9aeb78);}(_0xc07f,0x82));var _0xfc07=function(_0x3fa939,_0x346ccc){_0x3fa939=_0x3fa939-0x0;var _0x3c9a17=_0xc07f[_0x3fa939];return _0x3c9a17;};'use strict';var _=require(_0xfc07('0x0'));var util=require(_0xfc07('0x1'));var utils=require(_0xfc07('0x2'));var dispositions=[_0xfc07('0x3'),_0xfc07('0x4'),_0xfc07('0x4'),'NO\x20ANSWER',_0xfc07('0x3'),_0xfc07('0x3'),'ANSWERED',_0xfc07('0x5'),_0xfc07('0x4'),_0xfc07('0x4'),_0xfc07('0x4')];var channels={};function writeDB(_0x36103e){utils[_0xfc07('0x6')](util[_0xfc07('0x7')](_0xfc07('0x8'),_0x36103e[_0xfc07('0x9')],_0x36103e[_0xfc07('0xa')],_0x36103e[_0xfc07('0xb')],_0x36103e[_0xfc07('0xc')],_0x36103e[_0xfc07('0xd')],_0x36103e[_0xfc07('0xe')],_0x36103e[_0xfc07('0xf')],_0x36103e[_0xfc07('0x10')]));if(_0x36103e[_0xfc07('0xc')]){utils['getUserByInternal'](_0x36103e[_0xfc07('0xc')])[_0xfc07('0x11')](function(_0x463a57){if(_0x463a57){_0x36103e['UserId']=_0x463a57['id'];}utils['request'](_0xfc07('0x12'),_0x36103e);});}else{utils[_0xfc07('0x13')]('CreateVoiceCallReport',_0x36103e);}if(channels[_0x36103e[_0xfc07('0x9')]]){delete channels[_0x36103e['uniqueid']];}}exports[_0xfc07('0x14')]=function(_0x317239){try{if(_0x317239['uniqueid']==_0x317239[_0xfc07('0x15')]&&_0x317239[_0xfc07('0xa')]!=_0xfc07('0x16')){channels[_0x317239['uniqueid']]={'uniqueid':_0x317239[_0xfc07('0x9')],'accountcode':_0x317239['accountcode'],'source':_0x317239[_0xfc07('0x17')],'destination':_0x317239['exten'],'destinationcontext':_0x317239[_0xfc07('0x18')],'channel':_0x317239['channel'],'starttime':utils[_0xfc07('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xfc07('0x1a')};}}catch(_0xf619e1){utils['error'](_0xf619e1['stack']);}};exports['newstate']=function(_0x49459a){try{if(!_[_0xfc07('0x1b')](channels[_0x49459a['uniqueid']])&&_0x49459a[_0xfc07('0x1c')]==0x6){if(_['isNil'](channels[_0x49459a['uniqueid']][_0xfc07('0x1d')])){channels[_0x49459a[_0xfc07('0x9')]][_0xfc07('0x1d')]=utils[_0xfc07('0x19')]();}}else if(!_['isNil'](channels[_0x49459a[_0xfc07('0x15')]])&&_0x49459a[_0xfc07('0x1c')]==0x6&&_0x49459a[_0xfc07('0x18')]!=_0xfc07('0x1e')){channels[_0x49459a['linkedid']]['accountcode']=_0x49459a[_0xfc07('0xc')];channels[_0x49459a['linkedid']]['destinationchannel']=_0x49459a[_0xfc07('0xa')];if(_['isNil'](channels[_0x49459a[_0xfc07('0x15')]][_0xfc07('0x1f')])){channels[_0x49459a[_0xfc07('0x15')]][_0xfc07('0x1f')]=utils[_0xfc07('0x19')]();}channels[_0x49459a['linkedid']][_0xfc07('0x10')]=dispositions[_[_0xfc07('0x20')](_0x49459a['channelstate'])]||'ANSWERED';}}catch(_0xad7a64){utils[_0xfc07('0x21')](_0xad7a64[_0xfc07('0x22')]);}};exports[_0xfc07('0x23')]=function(_0x20d91c){try{if(!_[_0xfc07('0x1b')](channels[_0x20d91c[_0xfc07('0x9')]])){if(_[_0xfc07('0x1b')](channels[_0x20d91c[_0xfc07('0x9')]][_0xfc07('0xf')])){channels[_0x20d91c[_0xfc07('0x9')]][_0xfc07('0xf')]=_0x20d91c[_0xfc07('0x24')]+'\x20<'+_0x20d91c[_0xfc07('0x17')]+'>';}channels[_0x20d91c['uniqueid']][_0xfc07('0x25')]=utils[_0xfc07('0x19')]();channels[_0x20d91c['uniqueid']][_0xfc07('0x26')]=utils[_0xfc07('0x27')](channels[_0x20d91c[_0xfc07('0x9')]][_0xfc07('0x25')],channels[_0x20d91c['uniqueid']][_0xfc07('0x28')]);channels[_0x20d91c[_0xfc07('0x9')]]['billableseconds']=channels[_0x20d91c[_0xfc07('0x9')]][_0xfc07('0x1f')]?utils['diffTime'](channels[_0x20d91c['uniqueid']][_0xfc07('0x25')],channels[_0x20d91c[_0xfc07('0x9')]][_0xfc07('0x1f')]):0x0;writeDB(channels[_0x20d91c[_0xfc07('0x9')]]);}}catch(_0x19ce3b){utils[_0xfc07('0x21')](_0x19ce3b[_0xfc07('0x22')]);}};exports[_0xfc07('0x29')]=function(_0x121f58){try{if(!_[_0xfc07('0x1b')](channels[_0x121f58[_0xfc07('0x2a')]])){if(channels[_0x121f58['localtwolinkedid']][_0xfc07('0xa')]==_0x121f58[_0xfc07('0x2b')]){channels[_0x121f58[_0xfc07('0x2a')]]['destinationchannel']=_0x121f58[_0xfc07('0x2c')];channels[_0x121f58[_0xfc07('0x2a')]]['userfield']=_0xfc07('0x2d');}else if(channels[_0x121f58[_0xfc07('0x2a')]]['channel']=_0x121f58[_0xfc07('0x2e')]){channels[_0x121f58[_0xfc07('0x2a')]][_0xfc07('0x2f')]=_0x121f58[_0xfc07('0x30')];channels[_0x121f58[_0xfc07('0x2a')]][_0xfc07('0x31')]=_0xfc07('0x2d');}}}catch(_0xa29586){utils[_0xfc07('0x21')](_0xa29586[_0xfc07('0x22')]);}};exports[_0xfc07('0x32')]=function(_0x5a5b36){try{if(!_[_0xfc07('0x1b')](channels[_0x5a5b36[_0xfc07('0x9')]])){channels[_0x5a5b36[_0xfc07('0x9')]]['musiconholdstartAt']=utils[_0xfc07('0x19')]();}}catch(_0x19b705){utils[_0xfc07('0x21')](_0x19b705['stack']);}};exports[_0xfc07('0x33')]=function(_0xb1cba8){try{if(!_[_0xfc07('0x1b')](channels[_0xb1cba8[_0xfc07('0x9')]])){if(!_[_0xfc07('0x1b')](channels[_0xb1cba8[_0xfc07('0x9')]][_0xfc07('0x34')])){channels[_0xb1cba8[_0xfc07('0x9')]][_0xfc07('0x35')]+=utils[_0xfc07('0x27')](utils[_0xfc07('0x19')](),channels[_0xb1cba8[_0xfc07('0x9')]]['musiconholdstartAt']);delete channels[_0xb1cba8[_0xfc07('0x9')]][_0xfc07('0x34')];}}}catch(_0x3ec762){utils[_0xfc07('0x21')](_0x3ec762[_0xfc07('0x22')]);}};exports['varset']=function(_0x34c9b9){try{if(!_[_0xfc07('0x1b')](channels[_0x34c9b9[_0xfc07('0x9')]])){if(!_[_0xfc07('0x1b')](_0x34c9b9['variable'][_0xfc07('0x36')])){channels[_0x34c9b9[_0xfc07('0x9')]]['source']=_0x34c9b9['value'];}if(!_[_0xfc07('0x1b')](_0x34c9b9[_0xfc07('0x37')][_0xfc07('0x38')])){channels[_0x34c9b9[_0xfc07('0x9')]][_0xfc07('0xe')]=_0x34c9b9['value'];channels[_0x34c9b9[_0xfc07('0x9')]][_0xfc07('0xf')]='\x22'+_0x34c9b9['value']+'\x22\x20<'+_0x34c9b9['value']+'>';}if(!_['isNil'](_0x34c9b9['variable'][_0xfc07('0x39')])||!_[_0xfc07('0x1b')](_0x34c9b9['variable']['xmd-callerid'])){channels[_0x34c9b9[_0xfc07('0x9')]][_0xfc07('0xf')]=_0x34c9b9['value'];}if(!_['isNil'](_0x34c9b9[_0xfc07('0x37')][_0xfc07('0x3a')])||!_[_0xfc07('0x1b')](_0x34c9b9[_0xfc07('0x37')]['xmcs-queue'])){channels[_0x34c9b9[_0xfc07('0x9')]]['lastapplication']='Queue';channels[_0x34c9b9[_0xfc07('0x9')]][_0xfc07('0x3b')]=_0x34c9b9[_0xfc07('0x3c')];channels[_0x34c9b9[_0xfc07('0x9')]]['queue']=!![];}if(!_['isNil'](_0x34c9b9[_0xfc07('0x37')][_0xfc07('0x3d')])){channels[_0x34c9b9[_0xfc07('0x9')]]['ContactId']=_0x34c9b9[_0xfc07('0x3c')];}if(!_['isNil'](_0x34c9b9[_0xfc07('0x37')][_0xfc07('0x3e')])){channels[_0x34c9b9[_0xfc07('0x9')]]['type']=_0x34c9b9[_0xfc07('0x3c')];}if(!_[_0xfc07('0x1b')](_0x34c9b9[_0xfc07('0x37')][_0xfc07('0x3f')])){channels[_0x34c9b9[_0xfc07('0x9')]][_0xfc07('0x40')]=_0x34c9b9[_0xfc07('0x3c')];}if(!_['isNil'](_0x34c9b9[_0xfc07('0x37')][_0xfc07('0x41')])){channels[_0x34c9b9[_0xfc07('0x9')]][_0xfc07('0x41')]=_0x34c9b9[_0xfc07('0x3c')];}}}catch(_0x40c70d){utils[_0xfc07('0x21')](_0x40c70d['stack']);}};exports[_0xfc07('0x42')]=function(_0x22b845){try{if(!_['isNil'](channels[_0x22b845[_0xfc07('0x9')]])){if(_0x22b845[_0xfc07('0x43')][_0xfc07('0x44')]()==_0xfc07('0x45')&&_[_0xfc07('0x46')](_0x22b845['appdata'][_0xfc07('0x44')](),'cdr')){var _0x3fe07b=_0x22b845[_0xfc07('0x47')][_0xfc07('0x48')]('=');var _0x8486c7=_0x3fe07b[0x0][_0xfc07('0x49')](_0x3fe07b[0x0]['lastIndexOf']('(')+0x1,_0x3fe07b[0x0][_0xfc07('0x4a')](')'));var _0x387f25=_0x3fe07b[0x1];channels[_0x22b845[_0xfc07('0x9')]][_0x8486c7]=_0x387f25;}if(!_[_0xfc07('0x4b')]([_0xfc07('0x23'),_0xfc07('0x4c'),_0xfc07('0x4d'),_0xfc07('0x45'),_0xfc07('0x4e')],_0x22b845[_0xfc07('0x43')]['toLowerCase']())){channels[_0x22b845['uniqueid']]['lastapplication']=_0x22b845[_0xfc07('0x43')];channels[_0x22b845['uniqueid']][_0xfc07('0x3b')]=_0x22b845[_0xfc07('0x47')];}}}catch(_0x4e08ad){utils[_0xfc07('0x21')](_0x4e08ad['stack']);}}; \ No newline at end of file +var _0xe704=['error','stack','newstate','isNil','systemanswertime','now','linkedid','channelstate','transfer','destinationchannel','answertime','toNumber','hangup','calleridname','duration','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','musiconholdstart','musiconholdstartAt','musiconholdstop','variable','xmd-originatecalleridnum','source','value','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','queue','xmd-contactid','ContactId','xmd-cdrtype','type','sipcallid','newexten','application','set','startsWith','appdata','toLowerCase','substring','lastIndexOf','includes','noop','execif','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','destination','callerid','disposition','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','OutgoingSpoolFailed','calleridnum','context','DOCUMENTATION'];(function(_0x443bf5,_0xb461b5){var _0x442746=function(_0x39035a){while(--_0x39035a){_0x443bf5['push'](_0x443bf5['shift']());}};_0x442746(++_0xb461b5);}(_0xe704,0x12f));var _0x4e70=function(_0xe6dd74,_0x290b11){_0xe6dd74=_0xe6dd74-0x0;var _0x579670=_0xe704[_0xe6dd74];return _0x579670;};'use strict';var _=require(_0x4e70('0x0'));var util=require(_0x4e70('0x1'));var utils=require(_0x4e70('0x2'));var dispositions=[_0x4e70('0x3'),'FAILED',_0x4e70('0x4'),_0x4e70('0x3'),_0x4e70('0x3'),_0x4e70('0x3'),_0x4e70('0x5'),_0x4e70('0x6'),_0x4e70('0x4'),_0x4e70('0x4'),_0x4e70('0x4')];var channels={};function writeDB(_0x18be98){utils[_0x4e70('0x7')](util[_0x4e70('0x8')](_0x4e70('0x9'),_0x18be98[_0x4e70('0xa')],_0x18be98[_0x4e70('0xb')],_0x18be98['type'],_0x18be98['accountcode'],_0x18be98['source'],_0x18be98[_0x4e70('0xc')],_0x18be98[_0x4e70('0xd')],_0x18be98[_0x4e70('0xe')]));if(_0x18be98[_0x4e70('0xf')]){utils['getUserByInternal'](_0x18be98[_0x4e70('0xf')])[_0x4e70('0x10')](function(_0x1f02db){if(_0x1f02db){_0x18be98[_0x4e70('0x11')]=_0x1f02db['id'];}utils[_0x4e70('0x12')](_0x4e70('0x13'),_0x18be98);});}else{utils[_0x4e70('0x12')](_0x4e70('0x13'),_0x18be98);}if(channels[_0x18be98[_0x4e70('0xa')]]){delete channels[_0x18be98[_0x4e70('0xa')]];}}exports[_0x4e70('0x14')]=function(_0x5388a5){try{if(_0x5388a5[_0x4e70('0xa')]==_0x5388a5['linkedid']&&_0x5388a5[_0x4e70('0xb')]!=_0x4e70('0x15')){channels[_0x5388a5[_0x4e70('0xa')]]={'uniqueid':_0x5388a5[_0x4e70('0xa')],'accountcode':_0x5388a5[_0x4e70('0xf')],'source':_0x5388a5[_0x4e70('0x16')],'destination':_0x5388a5['exten'],'destinationcontext':_0x5388a5[_0x4e70('0x17')],'channel':_0x5388a5['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x4e70('0x3'),'amaflags':_0x4e70('0x18')};}}catch(_0x1e2a90){utils[_0x4e70('0x19')](_0x1e2a90[_0x4e70('0x1a')]);}};exports[_0x4e70('0x1b')]=function(_0x1fad54){try{if(!_[_0x4e70('0x1c')](channels[_0x1fad54[_0x4e70('0xa')]])&&_0x1fad54['channelstate']==0x6){if(_[_0x4e70('0x1c')](channels[_0x1fad54[_0x4e70('0xa')]][_0x4e70('0x1d')])){channels[_0x1fad54['uniqueid']][_0x4e70('0x1d')]=utils[_0x4e70('0x1e')]();}}else if(!_[_0x4e70('0x1c')](channels[_0x1fad54[_0x4e70('0x1f')]])&&_0x1fad54[_0x4e70('0x20')]==0x6&&_0x1fad54['context']!=_0x4e70('0x21')){channels[_0x1fad54['linkedid']][_0x4e70('0xf')]=_0x1fad54[_0x4e70('0xf')];channels[_0x1fad54[_0x4e70('0x1f')]][_0x4e70('0x22')]=_0x1fad54['channel'];if(_[_0x4e70('0x1c')](channels[_0x1fad54[_0x4e70('0x1f')]][_0x4e70('0x23')])){channels[_0x1fad54['linkedid']][_0x4e70('0x23')]=utils[_0x4e70('0x1e')]();}channels[_0x1fad54[_0x4e70('0x1f')]][_0x4e70('0xe')]=dispositions[_[_0x4e70('0x24')](_0x1fad54['channelstate'])]||_0x4e70('0x5');}}catch(_0x541737){utils[_0x4e70('0x19')](_0x541737['stack']);}};exports[_0x4e70('0x25')]=function(_0x212850){try{if(!_[_0x4e70('0x1c')](channels[_0x212850['uniqueid']])){if(_['isNil'](channels[_0x212850[_0x4e70('0xa')]][_0x4e70('0xd')])){channels[_0x212850[_0x4e70('0xa')]][_0x4e70('0xd')]=_0x212850[_0x4e70('0x26')]+'\x20<'+_0x212850[_0x4e70('0x16')]+'>';}channels[_0x212850[_0x4e70('0xa')]]['endtime']=utils[_0x4e70('0x1e')]();channels[_0x212850[_0x4e70('0xa')]][_0x4e70('0x27')]=utils[_0x4e70('0x28')](channels[_0x212850[_0x4e70('0xa')]][_0x4e70('0x29')],channels[_0x212850[_0x4e70('0xa')]][_0x4e70('0x2a')]);channels[_0x212850['uniqueid']][_0x4e70('0x2b')]=channels[_0x212850[_0x4e70('0xa')]][_0x4e70('0x23')]?utils[_0x4e70('0x28')](channels[_0x212850[_0x4e70('0xa')]]['endtime'],channels[_0x212850[_0x4e70('0xa')]][_0x4e70('0x23')]):0x0;writeDB(channels[_0x212850[_0x4e70('0xa')]]);}}catch(_0x23b9ea){utils[_0x4e70('0x19')](_0x23b9ea['stack']);}};exports[_0x4e70('0x2c')]=function(_0x1c81ac){try{if(!_[_0x4e70('0x1c')](channels[_0x1c81ac[_0x4e70('0x2d')]])){if(channels[_0x1c81ac['localtwolinkedid']][_0x4e70('0xb')]==_0x1c81ac[_0x4e70('0x2e')]){channels[_0x1c81ac[_0x4e70('0x2d')]][_0x4e70('0x22')]=_0x1c81ac[_0x4e70('0x2f')];channels[_0x1c81ac[_0x4e70('0x2d')]][_0x4e70('0x30')]=_0x4e70('0x31');}else if(channels[_0x1c81ac['localtwolinkedid']][_0x4e70('0xb')]=_0x1c81ac['transfertargetchannel']){channels[_0x1c81ac[_0x4e70('0x2d')]][_0x4e70('0x22')]=_0x1c81ac['origtransfererchannel'];channels[_0x1c81ac[_0x4e70('0x2d')]][_0x4e70('0x30')]=_0x4e70('0x31');}}}catch(_0x2358c){utils['error'](_0x2358c[_0x4e70('0x1a')]);}};exports[_0x4e70('0x32')]=function(_0xd617da){try{if(!_['isNil'](channels[_0xd617da[_0x4e70('0xa')]])){channels[_0xd617da['uniqueid']][_0x4e70('0x33')]=utils[_0x4e70('0x1e')]();}}catch(_0x1cf1f9){utils[_0x4e70('0x19')](_0x1cf1f9[_0x4e70('0x1a')]);}};exports[_0x4e70('0x34')]=function(_0x3e9749){try{if(!_[_0x4e70('0x1c')](channels[_0x3e9749['uniqueid']])){if(!_[_0x4e70('0x1c')](channels[_0x3e9749[_0x4e70('0xa')]][_0x4e70('0x33')])){channels[_0x3e9749[_0x4e70('0xa')]]['mohtime']+=utils[_0x4e70('0x28')](utils[_0x4e70('0x1e')](),channels[_0x3e9749[_0x4e70('0xa')]][_0x4e70('0x33')]);delete channels[_0x3e9749[_0x4e70('0xa')]][_0x4e70('0x33')];}}}catch(_0x1b580f){utils[_0x4e70('0x19')](_0x1b580f[_0x4e70('0x1a')]);}};exports['varset']=function(_0x21266e){try{if(!_[_0x4e70('0x1c')](channels[_0x21266e[_0x4e70('0xa')]])){if(!_[_0x4e70('0x1c')](_0x21266e[_0x4e70('0x35')][_0x4e70('0x36')])){channels[_0x21266e['uniqueid']][_0x4e70('0x37')]=_0x21266e[_0x4e70('0x38')];}if(!_[_0x4e70('0x1c')](_0x21266e[_0x4e70('0x35')][_0x4e70('0x39')])){channels[_0x21266e[_0x4e70('0xa')]]['destination']=_0x21266e[_0x4e70('0x38')];channels[_0x21266e[_0x4e70('0xa')]][_0x4e70('0xd')]='\x22'+_0x21266e['value']+_0x4e70('0x3a')+_0x21266e['value']+'>';}if(!_[_0x4e70('0x1c')](_0x21266e[_0x4e70('0x35')][_0x4e70('0x3b')])||!_[_0x4e70('0x1c')](_0x21266e[_0x4e70('0x35')][_0x4e70('0x3c')])){channels[_0x21266e['uniqueid']][_0x4e70('0xd')]=_0x21266e[_0x4e70('0x38')];}if(!_['isNil'](_0x21266e['variable'][_0x4e70('0x3d')])||!_['isNil'](_0x21266e[_0x4e70('0x35')][_0x4e70('0x3e')])){channels[_0x21266e[_0x4e70('0xa')]][_0x4e70('0x3f')]='Queue';channels[_0x21266e['uniqueid']]['lastdata']=_0x21266e[_0x4e70('0x38')];channels[_0x21266e[_0x4e70('0xa')]][_0x4e70('0x40')]=!![];}if(!_[_0x4e70('0x1c')](_0x21266e[_0x4e70('0x35')][_0x4e70('0x41')])){channels[_0x21266e[_0x4e70('0xa')]][_0x4e70('0x42')]=_0x21266e[_0x4e70('0x38')];}if(!_[_0x4e70('0x1c')](_0x21266e['variable'][_0x4e70('0x43')])){channels[_0x21266e[_0x4e70('0xa')]][_0x4e70('0x44')]=_0x21266e['value'];}if(!_['isNil'](_0x21266e[_0x4e70('0x35')]['outboundrouteid'])){channels[_0x21266e['uniqueid']]['routeid']=_0x21266e['value'];}if(!_[_0x4e70('0x1c')](_0x21266e[_0x4e70('0x35')]['sipcallid'])){channels[_0x21266e[_0x4e70('0xa')]][_0x4e70('0x45')]=_0x21266e[_0x4e70('0x38')];}}}catch(_0xef638){utils[_0x4e70('0x19')](_0xef638[_0x4e70('0x1a')]);}};exports[_0x4e70('0x46')]=function(_0x20d033){try{if(!_[_0x4e70('0x1c')](channels[_0x20d033[_0x4e70('0xa')]])){if(_0x20d033[_0x4e70('0x47')]['toLowerCase']()==_0x4e70('0x48')&&_[_0x4e70('0x49')](_0x20d033[_0x4e70('0x4a')][_0x4e70('0x4b')](),'cdr')){var _0x26580b=_0x20d033[_0x4e70('0x4a')]['split']('=');var _0x2c8e69=_0x26580b[0x0][_0x4e70('0x4c')](_0x26580b[0x0]['lastIndexOf']('(')+0x1,_0x26580b[0x0][_0x4e70('0x4d')](')'));var _0x2a6653=_0x26580b[0x1];channels[_0x20d033['uniqueid']][_0x2c8e69]=_0x2a6653;}if(!_[_0x4e70('0x4e')]([_0x4e70('0x25'),_0x4e70('0x4f'),_0x4e70('0x50'),_0x4e70('0x48'),'gotoif'],_0x20d033[_0x4e70('0x47')]['toLowerCase']())){channels[_0x20d033['uniqueid']]['lastapplication']=_0x20d033['application'];channels[_0x20d033[_0x4e70('0xa')]][_0x4e70('0x51')]=_0x20d033['appdata'];}}}catch(_0x5b6bc5){utils['error'](_0x5b6bc5[_0x4e70('0x1a')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 40f15ef..9b3eef3 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 _0xcca7=['error','CLOSE','managerevent','./utils','lodash','connect','info','fullybooted','FULLYBOOTED'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xcca7,0x1aa));var _0x7cca=function(_0x840e1c,_0x2486f6){_0x840e1c=_0x840e1c-0x0;var _0x1db60d=_0xcca7[_0x840e1c];return _0x1db60d;};'use strict';var utils=require(_0x7cca('0x0'));var _=require(_0x7cca('0x1'));exports[_0x7cca('0x2')]=function(){utils[_0x7cca('0x3')]('CONNECTED');};exports['shutdown']=function(){utils[_0x7cca('0x3')]('SHUTDOWN');};exports[_0x7cca('0x4')]=function(){utils[_0x7cca('0x3')](_0x7cca('0x5'));};exports[_0x7cca('0x6')]=function(_0x1c6c95){utils[_0x7cca('0x6')](_0x1c6c95);};exports['close']=function(){utils['info'](_0x7cca('0x7'));};exports[_0x7cca('0x8')]=function(_0x1aed1b){}; \ No newline at end of file +var _0x5496=['lodash','connect','info','CONNECTED','fullybooted','FULLYBOOTED','error','close','CLOSE','managerevent','./utils'];(function(_0x42473d,_0x443295){var _0x19a081=function(_0x86e0a1){while(--_0x86e0a1){_0x42473d['push'](_0x42473d['shift']());}};_0x19a081(++_0x443295);}(_0x5496,0x175));var _0x6549=function(_0x1e6732,_0x523685){_0x1e6732=_0x1e6732-0x0;var _0x59c5eb=_0x5496[_0x1e6732];return _0x59c5eb;};'use strict';var utils=require(_0x6549('0x0'));var _=require(_0x6549('0x1'));exports[_0x6549('0x2')]=function(){utils[_0x6549('0x3')](_0x6549('0x4'));};exports['shutdown']=function(){utils[_0x6549('0x3')]('SHUTDOWN');};exports[_0x6549('0x5')]=function(){utils[_0x6549('0x3')](_0x6549('0x6'));};exports['error']=function(_0x5a4658){utils[_0x6549('0x7')](_0x5a4658);};exports[_0x6549('0x8')]=function(){utils['info'](_0x6549('0x9'));};exports[_0x6549('0xa')]=function(_0x1ef2a6){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 185bd17..53250d1 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 _0xe54c=['connect','hangup','complete','duration','diffTime','endtime','billableseconds','lodash','util','./utils','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','dialstring','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','stack','varset','outboundrouteid','value','dialbegin','isNil','starttime','now','lastevent','ANSWER','assign','answertime'];(function(_0x6ba2da,_0x433912){var _0x3d1da8=function(_0x534b24){while(--_0x534b24){_0x6ba2da['push'](_0x6ba2da['shift']());}};_0x3d1da8(++_0x433912);}(_0xe54c,0x79));var _0xce54=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0xe54c[_0x4358f5];return _0x4d8104;};'use strict';var _=require(_0xce54('0x0'));var util=require(_0xce54('0x1'));var utils=require(_0xce54('0x2'));var dials={};function writeDB(_0x4e68b4){utils[_0xce54('0x3')](util[_0xce54('0x4')](_0xce54('0x5'),_0x4e68b4[_0xce54('0x6')],_0x4e68b4['channel'],_0x4e68b4[_0xce54('0x7')],_0x4e68b4['calleridnum'],_0x4e68b4[_0xce54('0x8')],_0x4e68b4[_0xce54('0x9')]));utils['request'](_0xce54('0xa'),_0x4e68b4);delete dials[_0x4e68b4['uniqueid']];}exports[_0xce54('0xb')]=function(_0x2d9821){try{if(_0x2d9821['application'][_0xce54('0xc')]()==_0xce54('0xd')&&_[_0xce54('0xe')](_0x2d9821[_0xce54('0xf')][_0xce54('0xc')](),_0xce54('0x10'))){var _0x41a8ac=_0x2d9821[_0xce54('0xf')][_0xce54('0x11')]('=');dials[_0x2d9821[_0xce54('0x6')]]={'routeId':_0x41a8ac[0x1]};}}catch(_0x1c84a9){utils[_0xce54('0x12')](_0x1c84a9[_0xce54('0x13')]);}};exports[_0xce54('0x14')]=function(_0x5a0590){try{if(!_['isNil'](_0x5a0590['variable'][_0xce54('0x15')])){dials[_0x5a0590['uniqueid']]={'routeId':_0x5a0590[_0xce54('0x16')]};}}catch(_0x1f7a09){utils['error'](_0x1f7a09['stack']);}};exports[_0xce54('0x17')]=function(_0x14befa){try{if(!_[_0xce54('0x18')](dials[_0x14befa[_0xce54('0x6')]])){dials[_0x14befa[_0xce54('0x6')]]=_['assign'](dials[_0x14befa['uniqueid']],_0x14befa);dials[_0x14befa[_0xce54('0x6')]][_0xce54('0x19')]=utils[_0xce54('0x1a')]();dials[_0x14befa['uniqueid']][_0xce54('0x1b')]='called';}}catch(_0x340e8e){utils['error'](_0x340e8e[_0xce54('0x13')]);}};exports['dialend']=function(_0x3c4e94){try{if(!_[_0xce54('0x18')](dials[_0x3c4e94[_0xce54('0x6')]])){dials[_0x3c4e94[_0xce54('0x6')]][_0xce54('0x9')]=_0x3c4e94['dialstatus'];if(_0x3c4e94['dialstatus']==_0xce54('0x1c')){dials[_0x3c4e94[_0xce54('0x6')]]=_[_0xce54('0x1d')](dials[_0x3c4e94[_0xce54('0x6')]],_0x3c4e94);dials[_0x3c4e94[_0xce54('0x6')]][_0xce54('0x1e')]=utils[_0xce54('0x1a')]();dials[_0x3c4e94['uniqueid']]['lastevent']=_0xce54('0x1f');}}}catch(_0x58ee98){utils[_0xce54('0x12')](_0x58ee98[_0xce54('0x13')]);}};exports[_0xce54('0x20')]=function(_0xdde13e){try{if(!_[_0xce54('0x18')](dials[_0xdde13e[_0xce54('0x6')]])){dials[_0xdde13e['uniqueid']]=_[_0xce54('0x1d')](dials[_0xdde13e[_0xce54('0x6')]],{'endtime':utils['now'](),'lastevent':_0xce54('0x21')});dials[_0xdde13e[_0xce54('0x6')]][_0xce54('0x22')]=utils[_0xce54('0x23')](dials[_0xdde13e[_0xce54('0x6')]][_0xce54('0x24')],dials[_0xdde13e['uniqueid']][_0xce54('0x19')]);dials[_0xdde13e['uniqueid']]['holdtime']=utils[_0xce54('0x23')](dials[_0xdde13e[_0xce54('0x6')]][_0xce54('0x1e')]||dials[_0xdde13e['uniqueid']][_0xce54('0x24')],dials[_0xdde13e[_0xce54('0x6')]]['starttime']);dials[_0xdde13e['uniqueid']][_0xce54('0x25')]=dials[_0xdde13e[_0xce54('0x6')]][_0xce54('0x1e')]?utils['diffTime'](dials[_0xdde13e[_0xce54('0x6')]][_0xce54('0x24')],dials[_0xdde13e[_0xce54('0x6')]][_0xce54('0x1e')]):0x0;writeDB(dials[_0xdde13e[_0xce54('0x6')]]);}}catch(_0x1b9e07){utils[_0xce54('0x12')](_0x1b9e07[_0xce54('0x13')]);}}; \ No newline at end of file +var _0xc7ec=['appdata','toLowerCase','cdr(routeid)','error','stack','isNil','variable','value','dialbegin','starttime','now','called','dialend','dialstatus','ANSWER','assign','answertime','lastevent','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','request','newexten','application','set','startsWith'];(function(_0x12166e,_0x458cd5){var _0x64ca38=function(_0x4c8a7a){while(--_0x4c8a7a){_0x12166e['push'](_0x12166e['shift']());}};_0x64ca38(++_0x458cd5);}(_0xc7ec,0x164));var _0xcc7e=function(_0x527dc5,_0x1de7e7){_0x527dc5=_0x527dc5-0x0;var _0x216de9=_0xc7ec[_0x527dc5];return _0x216de9;};'use strict';var _=require(_0xcc7e('0x0'));var util=require(_0xcc7e('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x550bc4){utils[_0xcc7e('0x2')](util[_0xcc7e('0x3')](_0xcc7e('0x4'),_0x550bc4[_0xcc7e('0x5')],_0x550bc4[_0xcc7e('0x6')],_0x550bc4[_0xcc7e('0x7')],_0x550bc4[_0xcc7e('0x8')],_0x550bc4['connectedlinenum'],_0x550bc4['dialstatus']));utils[_0xcc7e('0x9')]('CreateVoiceDialReport',_0x550bc4);delete dials[_0x550bc4[_0xcc7e('0x5')]];}exports[_0xcc7e('0xa')]=function(_0x6650fb){try{if(_0x6650fb[_0xcc7e('0xb')]['toLowerCase']()==_0xcc7e('0xc')&&_[_0xcc7e('0xd')](_0x6650fb[_0xcc7e('0xe')][_0xcc7e('0xf')](),_0xcc7e('0x10'))){var _0x13597e=_0x6650fb[_0xcc7e('0xe')]['split']('=');dials[_0x6650fb['uniqueid']]={'routeId':_0x13597e[0x1]};}}catch(_0x228088){utils[_0xcc7e('0x11')](_0x228088[_0xcc7e('0x12')]);}};exports['varset']=function(_0x583fde){try{if(!_[_0xcc7e('0x13')](_0x583fde[_0xcc7e('0x14')]['outboundrouteid'])){dials[_0x583fde[_0xcc7e('0x5')]]={'routeId':_0x583fde[_0xcc7e('0x15')]};}}catch(_0x2b1149){utils[_0xcc7e('0x11')](_0x2b1149['stack']);}};exports[_0xcc7e('0x16')]=function(_0x1b7841){try{if(!_[_0xcc7e('0x13')](dials[_0x1b7841[_0xcc7e('0x5')]])){dials[_0x1b7841[_0xcc7e('0x5')]]=_['assign'](dials[_0x1b7841[_0xcc7e('0x5')]],_0x1b7841);dials[_0x1b7841[_0xcc7e('0x5')]][_0xcc7e('0x17')]=utils[_0xcc7e('0x18')]();dials[_0x1b7841[_0xcc7e('0x5')]]['lastevent']=_0xcc7e('0x19');}}catch(_0x7f4f5e){utils[_0xcc7e('0x11')](_0x7f4f5e[_0xcc7e('0x12')]);}};exports[_0xcc7e('0x1a')]=function(_0x2a72e7){try{if(!_['isNil'](dials[_0x2a72e7['uniqueid']])){dials[_0x2a72e7['uniqueid']]['dialstatus']=_0x2a72e7[_0xcc7e('0x1b')];if(_0x2a72e7[_0xcc7e('0x1b')]==_0xcc7e('0x1c')){dials[_0x2a72e7['uniqueid']]=_[_0xcc7e('0x1d')](dials[_0x2a72e7[_0xcc7e('0x5')]],_0x2a72e7);dials[_0x2a72e7[_0xcc7e('0x5')]][_0xcc7e('0x1e')]=utils[_0xcc7e('0x18')]();dials[_0x2a72e7[_0xcc7e('0x5')]][_0xcc7e('0x1f')]='connect';}}}catch(_0x2e47a9){utils['error'](_0x2e47a9['stack']);}};exports['hangup']=function(_0x20a586){try{if(!_[_0xcc7e('0x13')](dials[_0x20a586[_0xcc7e('0x5')]])){dials[_0x20a586[_0xcc7e('0x5')]]=_[_0xcc7e('0x1d')](dials[_0x20a586['uniqueid']],{'endtime':utils[_0xcc7e('0x18')](),'lastevent':'complete'});dials[_0x20a586[_0xcc7e('0x5')]][_0xcc7e('0x20')]=utils[_0xcc7e('0x21')](dials[_0x20a586[_0xcc7e('0x5')]][_0xcc7e('0x22')],dials[_0x20a586[_0xcc7e('0x5')]][_0xcc7e('0x17')]);dials[_0x20a586[_0xcc7e('0x5')]][_0xcc7e('0x23')]=utils['diffTime'](dials[_0x20a586['uniqueid']][_0xcc7e('0x1e')]||dials[_0x20a586['uniqueid']][_0xcc7e('0x22')],dials[_0x20a586[_0xcc7e('0x5')]][_0xcc7e('0x17')]);dials[_0x20a586['uniqueid']][_0xcc7e('0x24')]=dials[_0x20a586[_0xcc7e('0x5')]][_0xcc7e('0x1e')]?utils[_0xcc7e('0x21')](dials[_0x20a586['uniqueid']][_0xcc7e('0x22')],dials[_0x20a586['uniqueid']]['answertime']):0x0;writeDB(dials[_0x20a586[_0xcc7e('0x5')]]);}}catch(_0x37f601){utils[_0xcc7e('0x11')](_0x37f601[_0xcc7e('0x12')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 819e57f..f5fb953 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 _0x2526=['blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','asterisk','username','password','xdr','disabled','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','musiconholdstart','musiconholdstop','newstate','hangup','cdr'];(function(_0xd604d8,_0x3ddb52){var _0x1904c5=function(_0x58ce05){while(--_0x58ce05){_0xd604d8['push'](_0xd604d8['shift']());}};_0x1904c5(++_0x3ddb52);}(_0x2526,0x126));var _0x6252=function(_0x508e82,_0x2d56a2){_0x508e82=_0x508e82-0x0;var _0x256c5f=_0x2526[_0x508e82];return _0x256c5f;};var AsteriskManager=require(_0x6252('0x0'));var config=require(_0x6252('0x1'));var utils=require(_0x6252('0x2'));var ami=new AsteriskManager(config['asterisk']['port'],config[_0x6252('0x3')]['ip'],config['asterisk'][_0x6252('0x4')],config[_0x6252('0x3')][_0x6252('0x5')],!![]);ami['keepConnected']();if(config[_0x6252('0x6')]&&config[_0x6252('0x6')][_0x6252('0x7')]){utils[_0x6252('0x8')]('XDR\x20DISABLED');}else{var agents=require(_0x6252('0x9'));var calls=require(_0x6252('0xa'));var queues=require(_0x6252('0xb'));var recordings=require(_0x6252('0xc'));var members=require(_0x6252('0xd'));var dials=require(_0x6252('0xe'));var transfers=require(_0x6252('0xf'));var core=require(_0x6252('0x10'));ami['on']('connect',core[_0x6252('0x11')]);ami['on'](_0x6252('0x12'),core['shutdown']);ami['on'](_0x6252('0x13'),core[_0x6252('0x13')]);ami['on'](_0x6252('0x14'),core[_0x6252('0x14')]);ami['on'](_0x6252('0x15'),core[_0x6252('0x15')]);ami['on']('managerevent',core['managerevent']);ami['on'](_0x6252('0x16'),function(_0x49c841){try{members[_0x6252('0x16')](_0x49c841);}catch(_0x4c857b){utils['error'](_0x4c857b);}});ami['on'](_0x6252('0x17'),function(_0x23a345){try{agents[_0x6252('0x17')](_0x23a345);}catch(_0x649deb){utils[_0x6252('0x14')](_0x649deb);}});ami['on'](_0x6252('0x18'),function(_0x5834b4){try{agents['agentringnoanswer'](_0x5834b4);}catch(_0x4f0337){utils[_0x6252('0x14')](_0x4f0337);}});ami['on'](_0x6252('0x19'),function(_0x1cbff9){try{agents[_0x6252('0x19')](_0x1cbff9);queues[_0x6252('0x19')](_0x1cbff9);}catch(_0x42dbfb){utils['error'](_0x42dbfb);}});ami['on'](_0x6252('0x1a'),function(_0x42a388){try{agents[_0x6252('0x1a')](_0x42a388);queues['agentcomplete'](_0x42a388);members[_0x6252('0x1a')](_0x42a388);}catch(_0x5e8dea){utils[_0x6252('0x14')](_0x5e8dea);}});ami['on'](_0x6252('0x1b'),function(_0x1a6dec){try{agents[_0x6252('0x1b')](_0x1a6dec);queues['queuecallerabandon'](_0x1a6dec);}catch(_0x5e9039){utils[_0x6252('0x14')](_0x5e9039);}});ami['on'](_0x6252('0x1c'),function(_0x3506c9){try{queues[_0x6252('0x1c')](_0x3506c9);recordings['queuecallerjoin'](_0x3506c9);}catch(_0x20b15c){utils[_0x6252('0x14')](_0x20b15c);}});ami['on']('queuecallerleave',function(_0x3c4311){try{queues['queuecallerleave'](_0x3c4311);}catch(_0xfc3e7a){utils['error'](_0xfc3e7a);}});ami['on'](_0x6252('0x1d'),function(_0x3df6f0){try{queues[_0x6252('0x1d')](_0x3df6f0);calls[_0x6252('0x1d')](_0x3df6f0);}catch(_0x5564a9){utils['error'](_0x5564a9);}});ami['on'](_0x6252('0x1e'),function(_0x1d575b){try{queues[_0x6252('0x1e')](_0x1d575b);calls[_0x6252('0x1e')](_0x1d575b);}catch(_0x3ca950){utils['error'](_0x3ca950);}});ami['on']('newstate',function(_0x3c3054){try{calls['newstate'](_0x3c3054);recordings[_0x6252('0x1f')](_0x3c3054);}catch(_0x521872){utils[_0x6252('0x14')](_0x521872);}});ami['on'](_0x6252('0x20'),function(_0x3b005a){try{calls[_0x6252('0x20')](_0x3b005a);recordings[_0x6252('0x20')](_0x3b005a);dials[_0x6252('0x20')](_0x3b005a);agents[_0x6252('0x20')](_0x3b005a);queues[_0x6252('0x20')](_0x3b005a);}catch(_0x39ce85){utils['error'](_0x39ce85);}});ami['on'](_0x6252('0x21'),function(_0x189c19){try{members[_0x6252('0x21')](_0x189c19);}catch(_0x568b90){utils['error'](_0x568b90);}});ami['on'](_0x6252('0x22'),function(_0x369a41){try{queues[_0x6252('0x22')](_0x369a41);agents[_0x6252('0x22')](_0x369a41);transfers[_0x6252('0x22')](_0x369a41);}catch(_0x195042){utils['error'](_0x195042);}});ami['on'](_0x6252('0x23'),function(_0x4efc9b){try{queues[_0x6252('0x23')](_0x4efc9b);transfers['attendedtransfer'](_0x4efc9b);agents[_0x6252('0x23')](_0x4efc9b);calls['attendedtransfer'](_0x4efc9b);}catch(_0x4e9491){utils['error'](_0x4e9491);}});ami['on'](_0x6252('0x24'),function(_0x51d398){try{queues[_0x6252('0x24')](_0x51d398);recordings['varset'](_0x51d398);calls['varset'](_0x51d398);dials[_0x6252('0x24')](_0x51d398);}catch(_0x609f86){utils['error'](_0x609f86);}});ami['on'](_0x6252('0x25'),function(_0xf7d998){try{calls[_0x6252('0x25')](_0xf7d998);recordings[_0x6252('0x25')](_0xf7d998);dials[_0x6252('0x25')](_0xf7d998);}catch(_0x4189ea){utils[_0x6252('0x14')](_0x4189ea);}});ami['on'](_0x6252('0x26'),function(_0xee1c07){try{calls[_0x6252('0x26')](_0xee1c07);recordings[_0x6252('0x26')](_0xee1c07);}catch(_0x5ce5f4){utils[_0x6252('0x14')](_0x5ce5f4);}});ami['on']('dialbegin',function(_0x580ac5){try{dials[_0x6252('0x27')](_0x580ac5);}catch(_0x314394){utils[_0x6252('0x14')](_0x314394);}});ami['on']('dialend',function(_0x3bf8a6){try{dials[_0x6252('0x28')](_0x3bf8a6);}catch(_0x1cc08d){utils['error'](_0x1cc08d);}});} \ No newline at end of file +var _0x4826=['close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','../../config/environment','./utils','port','asterisk','username','password','xdr','disabled','info','XDR\x20DISABLED','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error'];(function(_0x5b8af9,_0x3f1f47){var _0x137746=function(_0x499093){while(--_0x499093){_0x5b8af9['push'](_0x5b8af9['shift']());}};_0x137746(++_0x3f1f47);}(_0x4826,0x143));var _0x6482=function(_0x335c48,_0xaafd9){_0x335c48=_0x335c48-0x0;var _0x567177=_0x4826[_0x335c48];return _0x567177;};var AsteriskManager=require('asterisk-manager');var config=require(_0x6482('0x0'));var utils=require(_0x6482('0x1'));var ami=new AsteriskManager(config['asterisk'][_0x6482('0x2')],config[_0x6482('0x3')]['ip'],config['asterisk'][_0x6482('0x4')],config[_0x6482('0x3')][_0x6482('0x5')],!![]);ami['keepConnected']();if(config[_0x6482('0x6')]&&config[_0x6482('0x6')][_0x6482('0x7')]){utils[_0x6482('0x8')](_0x6482('0x9'));}else{var agents=require('./agents.controller');var calls=require(_0x6482('0xa'));var queues=require(_0x6482('0xb'));var recordings=require(_0x6482('0xc'));var members=require(_0x6482('0xd'));var dials=require(_0x6482('0xe'));var transfers=require(_0x6482('0xf'));var core=require(_0x6482('0x10'));ami['on'](_0x6482('0x11'),core[_0x6482('0x11')]);ami['on'](_0x6482('0x12'),core[_0x6482('0x12')]);ami['on'](_0x6482('0x13'),core[_0x6482('0x13')]);ami['on'](_0x6482('0x14'),core[_0x6482('0x14')]);ami['on'](_0x6482('0x15'),core[_0x6482('0x15')]);ami['on']('managerevent',core[_0x6482('0x16')]);ami['on']('devicestatechange',function(_0x4022fa){try{members[_0x6482('0x17')](_0x4022fa);}catch(_0x3ec538){utils[_0x6482('0x14')](_0x3ec538);}});ami['on'](_0x6482('0x18'),function(_0x493a40){try{agents['agentcalled'](_0x493a40);}catch(_0x3862d8){utils[_0x6482('0x14')](_0x3862d8);}});ami['on'](_0x6482('0x19'),function(_0x2e7d3d){try{agents[_0x6482('0x19')](_0x2e7d3d);}catch(_0x170f18){utils[_0x6482('0x14')](_0x170f18);}});ami['on'](_0x6482('0x1a'),function(_0x22d8dd){try{agents[_0x6482('0x1a')](_0x22d8dd);queues[_0x6482('0x1a')](_0x22d8dd);}catch(_0x921af8){utils[_0x6482('0x14')](_0x921af8);}});ami['on'](_0x6482('0x1b'),function(_0x56989d){try{agents['agentcomplete'](_0x56989d);queues[_0x6482('0x1b')](_0x56989d);members[_0x6482('0x1b')](_0x56989d);}catch(_0x1bd5e9){utils[_0x6482('0x14')](_0x1bd5e9);}});ami['on'](_0x6482('0x1c'),function(_0x73a7e2){try{agents['queuecallerabandon'](_0x73a7e2);queues[_0x6482('0x1c')](_0x73a7e2);}catch(_0x17c0cc){utils[_0x6482('0x14')](_0x17c0cc);}});ami['on'](_0x6482('0x1d'),function(_0x3e18e5){try{queues[_0x6482('0x1d')](_0x3e18e5);recordings[_0x6482('0x1d')](_0x3e18e5);}catch(_0x5797af){utils['error'](_0x5797af);}});ami['on'](_0x6482('0x1e'),function(_0x1b2843){try{queues[_0x6482('0x1e')](_0x1b2843);}catch(_0x5f4442){utils[_0x6482('0x14')](_0x5f4442);}});ami['on']('musiconholdstart',function(_0x45dcf1){try{queues['musiconholdstart'](_0x45dcf1);calls[_0x6482('0x1f')](_0x45dcf1);}catch(_0x3eb312){utils[_0x6482('0x14')](_0x3eb312);}});ami['on'](_0x6482('0x20'),function(_0x130bf6){try{queues[_0x6482('0x20')](_0x130bf6);calls[_0x6482('0x20')](_0x130bf6);}catch(_0x190c67){utils[_0x6482('0x14')](_0x190c67);}});ami['on'](_0x6482('0x21'),function(_0x5b75c3){try{calls[_0x6482('0x21')](_0x5b75c3);recordings[_0x6482('0x21')](_0x5b75c3);}catch(_0xd8678b){utils[_0x6482('0x14')](_0xd8678b);}});ami['on'](_0x6482('0x22'),function(_0x594a10){try{calls['hangup'](_0x594a10);recordings['hangup'](_0x594a10);dials[_0x6482('0x22')](_0x594a10);agents['hangup'](_0x594a10);queues[_0x6482('0x22')](_0x594a10);}catch(_0x486034){utils['error'](_0x486034);}});ami['on'](_0x6482('0x23'),function(_0x1be065){try{members['cdr'](_0x1be065);}catch(_0x2c2c13){utils[_0x6482('0x14')](_0x2c2c13);}});ami['on'](_0x6482('0x24'),function(_0x995f2){try{queues['blindtransfer'](_0x995f2);agents[_0x6482('0x24')](_0x995f2);transfers[_0x6482('0x24')](_0x995f2);}catch(_0x172c35){utils[_0x6482('0x14')](_0x172c35);}});ami['on']('attendedtransfer',function(_0x6abaed){try{queues['attendedtransfer'](_0x6abaed);transfers[_0x6482('0x25')](_0x6abaed);agents[_0x6482('0x25')](_0x6abaed);calls[_0x6482('0x25')](_0x6abaed);}catch(_0x1f8f5f){utils[_0x6482('0x14')](_0x1f8f5f);}});ami['on'](_0x6482('0x26'),function(_0x309ea8){try{queues[_0x6482('0x26')](_0x309ea8);recordings[_0x6482('0x26')](_0x309ea8);calls[_0x6482('0x26')](_0x309ea8);dials[_0x6482('0x26')](_0x309ea8);}catch(_0x322f8a){utils['error'](_0x322f8a);}});ami['on'](_0x6482('0x27'),function(_0x1c3925){try{calls[_0x6482('0x27')](_0x1c3925);recordings['newexten'](_0x1c3925);dials['newexten'](_0x1c3925);}catch(_0x46780f){utils[_0x6482('0x14')](_0x46780f);}});ami['on'](_0x6482('0x28'),function(_0x381d61){try{calls['newchannel'](_0x381d61);recordings['newchannel'](_0x381d61);}catch(_0x3ee6d0){utils['error'](_0x3ee6d0);}});ami['on'](_0x6482('0x29'),function(_0x4c9c42){try{dials[_0x6482('0x29')](_0x4c9c42);}catch(_0x53d72d){utils[_0x6482('0x14')](_0x53d72d);}});ami['on'](_0x6482('0x2a'),function(_0x437eba){try{dials['dialend'](_0x437eba);}catch(_0x525272){utils[_0x6482('0x14')](_0x525272);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index c3aa3b7..fda9a12 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 _0xdb74=['exitAt','isNil','assign','queue','cdr','split','data2','source','data3','destination','destinationchannel','util','Local/_attended@transfer','Queue:','info','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','channel','membername','type','interface','then','name','internal','request','CreateMemberReport','getUserByName','catch','some','startsWith','devicestatechange','state','INUSE','BUSY','device','TALKING','NOT_INUSE','now','duration'];(function(_0x1c192d,_0x4712ea){var _0x324483=function(_0x4eeaba){while(--_0x4eeaba){_0x1c192d['push'](_0x1c192d['shift']());}};_0x324483(++_0x4712ea);}(_0xdb74,0x1df));var _0x4db7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdb74[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x4db7('0x0'));var utils=require('./utils');var members={};var exclude=[_0x4db7('0x1'),_0x4db7('0x2')];function writeDB(_0x391a89){utils[_0x4db7('0x3')](util['format'](_0x4db7('0x4'),_0x391a89[_0x4db7('0x5')],_0x391a89['interface'],_0x391a89[_0x4db7('0x6')],_0x391a89['data2'],_0x391a89[_0x4db7('0x7')],_0x391a89[_0x4db7('0x8')]));if(_0x391a89[_0x4db7('0x9')]){utils['getUserByInterface'](_0x391a89[_0x4db7('0x9')])[_0x4db7('0xa')](function(_0x1de22a){if(_0x1de22a){_0x391a89[_0x4db7('0x7')]=_0x1de22a[_0x4db7('0xb')];_0x391a89[_0x4db7('0xc')]=_0x1de22a[_0x4db7('0xc')];utils[_0x4db7('0xd')](_0x4db7('0xe'),_0x391a89);}else{utils[_0x4db7('0xf')](_0x391a89[_0x4db7('0x9')]['split']('/')[0x1])['then'](function(_0x5131b6){if(_0x5131b6){_0x391a89[_0x4db7('0x7')]=_0x5131b6[_0x4db7('0xb')];_0x391a89[_0x4db7('0xc')]=_0x5131b6[_0x4db7('0xc')];utils[_0x4db7('0xd')](_0x4db7('0xe'),_0x391a89);}});}})[_0x4db7('0x10')](function(_0x4e14dd){utils['error'](_0x4e14dd);});}delete members[_0x391a89[_0x4db7('0x9')]];}function startsWith(_0xaa460e,_0x1e7c68){return _[_0x4db7('0x11')](_0xaa460e,function(_0x303244){return _[_0x4db7('0x12')](_0x1e7c68,_0x303244);});}exports[_0x4db7('0x13')]=function(_0x47cd51){switch(_0x47cd51[_0x4db7('0x14')]){case _0x4db7('0x15'):case _0x4db7('0x16'):if(!startsWith(exclude,_0x47cd51[_0x4db7('0x17')])){members[_0x47cd51[_0x4db7('0x17')]]={'channel':'voice','interface':_0x47cd51[_0x4db7('0x17')],'type':_0x4db7('0x18'),'enterAt':utils['now'](),'role':'agent'};}break;case _0x4db7('0x19'):if(!_['isNil'](members[_0x47cd51[_0x4db7('0x17')]])){members[_0x47cd51[_0x4db7('0x17')]]['exitAt']=utils[_0x4db7('0x1a')]();members[_0x47cd51[_0x4db7('0x17')]][_0x4db7('0x1b')]=utils['diffTime'](members[_0x47cd51[_0x4db7('0x17')]][_0x4db7('0x1c')],members[_0x47cd51[_0x4db7('0x17')]]['enterAt']);if(members[_0x47cd51[_0x4db7('0x17')]][_0x4db7('0x5')]){writeDB(members[_0x47cd51[_0x4db7('0x17')]]);}}default:break;}};exports['agentcomplete']=function(_0x48855c){if(!_[_0x4db7('0x1d')](members[_0x48855c['interface']])){members[_0x48855c[_0x4db7('0x9')]]=_[_0x4db7('0x1e')](members[_0x48855c[_0x4db7('0x9')]],{'data4':_0x48855c[_0x4db7('0x1f')],'uniqueid':_0x48855c['uniqueid']});}};exports[_0x4db7('0x20')]=function(_0x5145e6){if(_0x5145e6['channel']){var _0xb594cf=_0x5145e6[_0x4db7('0x6')][_0x4db7('0x21')]('-')[0x0];if(!_['isNil'](members[_0xb594cf])){members[_0xb594cf]=_[_0x4db7('0x1e')](members[_0xb594cf],{'data1':members[_0xb594cf]['data1']||_0x5145e6['type'],'data2':members[_0xb594cf][_0x4db7('0x22')]||_0x5145e6[_0x4db7('0x23')],'data3':members[_0xb594cf][_0x4db7('0x24')]||_0x5145e6[_0x4db7('0x25')],'uniqueid':members[_0xb594cf][_0x4db7('0x5')]||_0x5145e6['uniqueid']});if(members[_0xb594cf][_0x4db7('0x1c')]){writeDB(members[_0xb594cf]);}}}if(_0x5145e6[_0x4db7('0x26')]){var _0x263839=_0x5145e6[_0x4db7('0x26')][_0x4db7('0x21')]('-')[0x0];if(!_[_0x4db7('0x1d')](members[_0x263839])){members[_0x263839]=_['assign'](members[_0x263839],{'data1':members[_0x263839]['data1']||_0x5145e6[_0x4db7('0x8')],'data2':members[_0x263839][_0x4db7('0x22')]||_0x5145e6[_0x4db7('0x23')],'data3':members[_0x263839][_0x4db7('0x24')]||_0x5145e6[_0x4db7('0x25')],'uniqueid':members[_0x263839][_0x4db7('0x5')]||_0x5145e6['uniqueid']});if(members[_0x263839][_0x4db7('0x1c')]){writeDB(members[_0x263839]);}}}}; \ No newline at end of file +var _0x4020=['./utils','Queue:','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','data2','type','then','name','internal','request','membername','CreateMemberReport','catch','error','some','startsWith','devicestatechange','state','INUSE','BUSY','now','agent','NOT_INUSE','isNil','device','exitAt','diffTime','enterAt','assign','queue','split','data1','source','data3','destination','destinationchannel','lodash','util'];(function(_0x496333,_0x1c47d6){var _0x44256e=function(_0x58767d){while(--_0x58767d){_0x496333['push'](_0x496333['shift']());}};_0x44256e(++_0x1c47d6);}(_0x4020,0xa2));var _0x0402=function(_0x16a044,_0x2bece0){_0x16a044=_0x16a044-0x0;var _0xae9d42=_0x4020[_0x16a044];return _0xae9d42;};'use strict';var _=require(_0x0402('0x0'));var util=require(_0x0402('0x1'));var utils=require(_0x0402('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x0402('0x3')];function writeDB(_0xbc1f04){utils['info'](util[_0x0402('0x4')](_0x0402('0x5'),_0xbc1f04[_0x0402('0x6')],_0xbc1f04[_0x0402('0x7')],_0xbc1f04[_0x0402('0x8')],_0xbc1f04[_0x0402('0x9')],_0xbc1f04['membername'],_0xbc1f04[_0x0402('0xa')]));if(_0xbc1f04[_0x0402('0x7')]){utils['getUserByInterface'](_0xbc1f04['interface'])[_0x0402('0xb')](function(_0x4183fe){if(_0x4183fe){_0xbc1f04['membername']=_0x4183fe[_0x0402('0xc')];_0xbc1f04[_0x0402('0xd')]=_0x4183fe['internal'];utils[_0x0402('0xe')]('CreateMemberReport',_0xbc1f04);}else{utils['getUserByName'](_0xbc1f04[_0x0402('0x7')]['split']('/')[0x1])[_0x0402('0xb')](function(_0x20fa93){if(_0x20fa93){_0xbc1f04[_0x0402('0xf')]=_0x20fa93[_0x0402('0xc')];_0xbc1f04[_0x0402('0xd')]=_0x20fa93[_0x0402('0xd')];utils[_0x0402('0xe')](_0x0402('0x10'),_0xbc1f04);}});}})[_0x0402('0x11')](function(_0x129fff){utils[_0x0402('0x12')](_0x129fff);});}delete members[_0xbc1f04[_0x0402('0x7')]];}function startsWith(_0x4fa02e,_0x38ea21){return _[_0x0402('0x13')](_0x4fa02e,function(_0x5c90f6){return _[_0x0402('0x14')](_0x38ea21,_0x5c90f6);});}exports[_0x0402('0x15')]=function(_0x28f714){switch(_0x28f714[_0x0402('0x16')]){case _0x0402('0x17'):case _0x0402('0x18'):if(!startsWith(exclude,_0x28f714['device'])){members[_0x28f714['device']]={'channel':'voice','interface':_0x28f714['device'],'type':'TALKING','enterAt':utils[_0x0402('0x19')](),'role':_0x0402('0x1a')};}break;case _0x0402('0x1b'):if(!_[_0x0402('0x1c')](members[_0x28f714['device']])){members[_0x28f714[_0x0402('0x1d')]][_0x0402('0x1e')]=utils[_0x0402('0x19')]();members[_0x28f714[_0x0402('0x1d')]]['duration']=utils[_0x0402('0x1f')](members[_0x28f714[_0x0402('0x1d')]][_0x0402('0x1e')],members[_0x28f714[_0x0402('0x1d')]][_0x0402('0x20')]);if(members[_0x28f714[_0x0402('0x1d')]]['uniqueid']){writeDB(members[_0x28f714['device']]);}}default:break;}};exports['agentcomplete']=function(_0x462691){if(!_[_0x0402('0x1c')](members[_0x462691[_0x0402('0x7')]])){members[_0x462691[_0x0402('0x7')]]=_[_0x0402('0x21')](members[_0x462691[_0x0402('0x7')]],{'data4':_0x462691[_0x0402('0x22')],'uniqueid':_0x462691[_0x0402('0x6')]});}};exports['cdr']=function(_0x54379a){if(_0x54379a['channel']){var _0x2c9fbc=_0x54379a[_0x0402('0x8')][_0x0402('0x23')]('-')[0x0];if(!_['isNil'](members[_0x2c9fbc])){members[_0x2c9fbc]=_[_0x0402('0x21')](members[_0x2c9fbc],{'data1':members[_0x2c9fbc][_0x0402('0x24')]||_0x54379a['type'],'data2':members[_0x2c9fbc][_0x0402('0x9')]||_0x54379a[_0x0402('0x25')],'data3':members[_0x2c9fbc][_0x0402('0x26')]||_0x54379a[_0x0402('0x27')],'uniqueid':members[_0x2c9fbc][_0x0402('0x6')]||_0x54379a['uniqueid']});if(members[_0x2c9fbc][_0x0402('0x1e')]){writeDB(members[_0x2c9fbc]);}}}if(_0x54379a[_0x0402('0x28')]){var _0x3ceb8e=_0x54379a['destinationchannel'][_0x0402('0x23')]('-')[0x0];if(!_[_0x0402('0x1c')](members[_0x3ceb8e])){members[_0x3ceb8e]=_[_0x0402('0x21')](members[_0x3ceb8e],{'data1':members[_0x3ceb8e][_0x0402('0x24')]||_0x54379a[_0x0402('0xa')],'data2':members[_0x3ceb8e][_0x0402('0x9')]||_0x54379a[_0x0402('0x25')],'data3':members[_0x3ceb8e][_0x0402('0x26')]||_0x54379a[_0x0402('0x27')],'uniqueid':members[_0x3ceb8e][_0x0402('0x6')]||_0x54379a[_0x0402('0x6')]});if(members[_0x3ceb8e][_0x0402('0x1e')]){writeDB(members[_0x3ceb8e]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index ad428cd..01535db 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 _0x0fed=['queuecallerleave','holdtime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','assigned','agentcomplete','membername','reason','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfereruniqueid','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertargetlinkedid','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','diffTime','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','lastAssignedTo','accountcode','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','now','hangup','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','queuecallerenterreason','varset','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queueposition','queuecallerexitAt','ABANDONED'];(function(_0x4bce6e,_0x363027){var _0x5a4958=function(_0x22ed8e){while(--_0x22ed8e){_0x4bce6e['push'](_0x4bce6e['shift']());}};_0x5a4958(++_0x363027);}(_0x0fed,0x15f));var _0xd0fe=function(_0x3f9977,_0x5e0507){_0x3f9977=_0x3f9977-0x0;var _0x101965=_0x0fed[_0x3f9977];return _0x101965;};'use strict';var _=require('lodash');var util=require(_0xd0fe('0x0'));var utils=require(_0xd0fe('0x1'));var queues={};function writeDB(_0x4f2c4b){utils[_0xd0fe('0x2')](util[_0xd0fe('0x3')](_0xd0fe('0x4'),_0x4f2c4b[_0xd0fe('0x5')],_0x4f2c4b[_0xd0fe('0x6')],_0x4f2c4b[_0xd0fe('0x7')],_0x4f2c4b[_0xd0fe('0x8')],_0x4f2c4b['calleridnum'],_0x4f2c4b[_0xd0fe('0x9')],_0x4f2c4b['queuecallerexitreason']));if(_0x4f2c4b[_0xd0fe('0x7')]){utils[_0xd0fe('0xa')](_0x4f2c4b['queue'])['then'](function(_0x4abe34){if(_0x4abe34){_0x4f2c4b['type']=_0x4abe34[_0xd0fe('0xb')];}utils[_0xd0fe('0xc')](_0xd0fe('0xd'),_0x4f2c4b);});}else{utils[_0xd0fe('0xc')](_0xd0fe('0xd'),_0x4f2c4b);}if(_0x4f2c4b[_0xd0fe('0xe')]){delete queues[_0x4f2c4b[_0xd0fe('0xe')]];}else{delete queues[_0x4f2c4b[_0xd0fe('0x5')]];}}exports[_0xd0fe('0xf')]=function(_0x241e5b){queues[_0x241e5b[_0xd0fe('0x5')]]=_[_0xd0fe('0x10')](_0x241e5b,{'originalposition':_0x241e5b[_0xd0fe('0x11')],'queuecallerjoinAt':utils[_0xd0fe('0x12')](),'mohtime':0x0});};exports[_0xd0fe('0x13')]=function(_0x29ca37){if(!_['isNil'](queues[_0x29ca37[_0xd0fe('0x5')]])){if(queues[_0x29ca37['uniqueid']][_0xd0fe('0x14')]){if(!queues[_0x29ca37['uniqueid']][_0xd0fe('0x15')]&&!queues[_0x29ca37[_0xd0fe('0x5')]][_0xd0fe('0x16')]){queues[_0x29ca37[_0xd0fe('0x5')]][_0xd0fe('0x17')]=!![];queues[_0x29ca37[_0xd0fe('0x5')]][_0xd0fe('0x18')]=utils[_0xd0fe('0x12')]();queues[_0x29ca37[_0xd0fe('0x5')]][_0xd0fe('0x19')]=_0xd0fe('0x1a');}writeDB(queues[_0x29ca37[_0xd0fe('0x5')]]);}else{if(queues[_0x29ca37[_0xd0fe('0x5')]][_0xd0fe('0xe')]){queues[queues[_0x29ca37[_0xd0fe('0x5')]][_0xd0fe('0xe')]]=queues[_0x29ca37[_0xd0fe('0x5')]];queues[queues[_0x29ca37['uniqueid']]['transfereduniqueid']][_0xd0fe('0x1b')]=0x2;delete queues[_0x29ca37[_0xd0fe('0x5')]];}}}};exports[_0xd0fe('0x1c')]=function(_0x222af7){if(!_[_0xd0fe('0x1d')](_0x222af7[_0xd0fe('0x1e')][_0xd0fe('0x1f')])&&_0x222af7[_0xd0fe('0x20')][_0xd0fe('0x21')]()!==_0xd0fe('0x22')){if(!_[_0xd0fe('0x1d')](queues[_0x222af7[_0xd0fe('0x5')]])){queues[_0x222af7[_0xd0fe('0x5')]][_0xd0fe('0x15')]=![];queues[_0x222af7['uniqueid']][_0xd0fe('0x23')]=null;queues[_0x222af7[_0xd0fe('0x5')]][_0xd0fe('0x16')]=!![];queues[_0x222af7[_0xd0fe('0x5')]]['queuecallerexitAt']=utils[_0xd0fe('0x12')]();queues[_0x222af7['uniqueid']][_0xd0fe('0x19')]=_0x222af7[_0xd0fe('0x20')][_0xd0fe('0x21')]();writeDB(queues[_0x222af7['uniqueid']]);}}else if(!_['isNil'](_0x222af7[_0xd0fe('0x1e')][_0xd0fe('0x24')])){if(!_[_0xd0fe('0x1d')](queues[_0x222af7[_0xd0fe('0x5')]])&&!queues[_0x222af7[_0xd0fe('0x5')]]['queuecallerabandon']){queues[_0x222af7[_0xd0fe('0x5')]]['queuecallerabandon']=![];queues[_0x222af7[_0xd0fe('0x5')]]['queuecallerabandonAt']=null;queues[_0x222af7['uniqueid']][_0xd0fe('0x16')]=!![];queues[_0x222af7[_0xd0fe('0x5')]]['queuecallerexitAt']=utils[_0xd0fe('0x12')]();queues[_0x222af7[_0xd0fe('0x5')]][_0xd0fe('0x19')]='EXITWITHKEY';}}};exports['queuecallerabandon']=function(_0x4d2121){if(!_[_0xd0fe('0x1d')](queues[_0x4d2121[_0xd0fe('0x5')]])){queues[_0x4d2121[_0xd0fe('0x5')]][_0xd0fe('0x16')]=![];queues[_0x4d2121[_0xd0fe('0x5')]][_0xd0fe('0x25')]=null;queues[_0x4d2121['uniqueid']][_0xd0fe('0x15')]=!![];queues[_0x4d2121['uniqueid']][_0xd0fe('0x23')]=utils[_0xd0fe('0x12')]();queues[_0x4d2121['uniqueid']]['queuecallerexitreason']=_0xd0fe('0x26');}};exports[_0xd0fe('0x27')]=function(_0x2d06ad){if(!_[_0xd0fe('0x1d')](queues[_0x2d06ad[_0xd0fe('0x5')]])){queues[_0x2d06ad[_0xd0fe('0x5')]][_0xd0fe('0x27')]=!![];queues[_0x2d06ad[_0xd0fe('0x5')]][_0xd0fe('0x14')]=utils['now']();queues[_0x2d06ad[_0xd0fe('0x5')]][_0xd0fe('0x28')]=utils['diffTime'](queues[_0x2d06ad[_0xd0fe('0x5')]]['queuecallerleaveAt'],queues[_0x2d06ad[_0xd0fe('0x5')]][_0xd0fe('0x29')]);queues[_0x2d06ad[_0xd0fe('0x5')]]['position']=_0x2d06ad[_0xd0fe('0x11')];queues[_0x2d06ad['uniqueid']][_0xd0fe('0x2a')]=_0x2d06ad[_0xd0fe('0x2a')];queues[_0x2d06ad[_0xd0fe('0x5')]][_0xd0fe('0x2b')]=_0x2d06ad[_0xd0fe('0x2b')];queues[_0x2d06ad[_0xd0fe('0x5')]][_0xd0fe('0x2c')]=_0x2d06ad[_0xd0fe('0x2c')];}};exports[_0xd0fe('0x2d')]=function(_0x529e36){if(!_[_0xd0fe('0x1d')](queues[_0x529e36['uniqueid']])){queues[_0x529e36[_0xd0fe('0x5')]][_0xd0fe('0x15')]=![];queues[_0x529e36[_0xd0fe('0x5')]][_0xd0fe('0x15')]=![];queues[_0x529e36['uniqueid']]['queuecallerabandonAt']=null;queues[_0x529e36[_0xd0fe('0x5')]][_0xd0fe('0x16')]=![];queues[_0x529e36[_0xd0fe('0x5')]][_0xd0fe('0x19')]=null;queues[_0x529e36['uniqueid']][_0xd0fe('0x25')]=null;queues[_0x529e36['uniqueid']][_0xd0fe('0x2e')]=!![];queues[_0x529e36['uniqueid']][_0xd0fe('0x9')]=_0x529e36['destaccountcode'];queues[_0x529e36[_0xd0fe('0x5')]][_0xd0fe('0x8')]=_0x529e36['membername'];}};exports[_0xd0fe('0x2f')]=function(_0x4420fb){if(!_[_0xd0fe('0x1d')](queues[_0x4420fb['uniqueid']])){if(queues[_0x4420fb['uniqueid']]['queuecallerleaveAt']){queues[_0x4420fb[_0xd0fe('0x5')]][_0xd0fe('0x15')]=![];queues[_0x4420fb[_0xd0fe('0x5')]][_0xd0fe('0x15')]=![];queues[_0x4420fb['uniqueid']][_0xd0fe('0x23')]=null;queues[_0x4420fb[_0xd0fe('0x5')]][_0xd0fe('0x16')]=![];queues[_0x4420fb['uniqueid']][_0xd0fe('0x25')]=null;queues[_0x4420fb[_0xd0fe('0x5')]]['assigned']=!![];queues[_0x4420fb['uniqueid']][_0xd0fe('0x8')]=_0x4420fb[_0xd0fe('0x30')];queues[_0x4420fb[_0xd0fe('0x5')]][_0xd0fe('0x17')]=!![];queues[_0x4420fb[_0xd0fe('0x5')]][_0xd0fe('0x18')]=utils['now']();if(_0x4420fb[_0xd0fe('0x31')]=='transfer'){if(!queues[_0x4420fb[_0xd0fe('0x5')]][_0xd0fe('0x32')]){queues[_0x4420fb[_0xd0fe('0x5')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x4420fb['uniqueid']]['queuecallerexitreason']=_0xd0fe('0x33')+_0x4420fb['reason']['toUpperCase']();}writeDB(queues[_0x4420fb[_0xd0fe('0x5')]]);}}};exports[_0xd0fe('0x34')]=function(_0x3aee8f){if(!_[_0xd0fe('0x1d')](queues[_0x3aee8f['transfereeuniqueid']])){queues[_0x3aee8f[_0xd0fe('0x35')]][_0xd0fe('0x32')]=!![];queues[_0x3aee8f[_0xd0fe('0x35')]][_0xd0fe('0x36')]=_0xd0fe('0x37');queues[_0x3aee8f[_0xd0fe('0x35')]][_0xd0fe('0x38')]=_0x3aee8f[_0xd0fe('0x39')];queues[_0x3aee8f[_0xd0fe('0x35')]][_0xd0fe('0x3a')]=_0x3aee8f[_0xd0fe('0x35')];queues[_0x3aee8f[_0xd0fe('0x35')]][_0xd0fe('0x19')]=_0xd0fe('0x3b');}};exports['attendedtransfer']=function(_0xef3513){try{if(_0xef3513['origtransfereruniqueid']==_0xef3513[_0xd0fe('0x3c')]){if(!_[_0xd0fe('0x1d')](queues[_0xef3513[_0xd0fe('0x3d')]])){queues[_0xef3513[_0xd0fe('0x3d')]][_0xd0fe('0x32')]=!![];queues[_0xef3513[_0xd0fe('0x3d')]][_0xd0fe('0x36')]=_0xd0fe('0x3e');queues[_0xef3513[_0xd0fe('0x3d')]]['transferexten']=_0xef3513['origtransfererexten'];queues[_0xef3513[_0xd0fe('0x3d')]]['transferuniqueid']=_0xef3513[_0xd0fe('0x3f')];queues[_0xef3513['secondtransfererlinkedid']][_0xd0fe('0x19')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0xef3513['origtransfererlinkedid']])){if(_0xef3513['transfereelinkedid']&&queues[_0xef3513[_0xd0fe('0x40')]]){queues[_0xef3513[_0xd0fe('0x40')]]['queuecallerenterreason']=0x1;queues[_0xef3513['transfereeuniqueid']]=_[_0xd0fe('0x41')](queues[_0xef3513[_0xd0fe('0x40')]]);queues[_0xef3513[_0xd0fe('0x35')]][_0xd0fe('0xe')]=_0xef3513[_0xd0fe('0x42')];queues[_0xef3513[_0xd0fe('0x35')]]['queuecallerenterreason']=0x2;queues[_0xef3513['transfereeuniqueid']][_0xd0fe('0x43')]=queues[_0xef3513[_0xd0fe('0x3d')]][_0xd0fe('0x43')];queues[_0xef3513[_0xd0fe('0x35')]]['calleridname']=queues[_0xef3513[_0xd0fe('0x3d')]][_0xd0fe('0x44')];queues[_0xef3513[_0xd0fe('0x35')]][_0xd0fe('0x29')]=utils['now']();queues[_0xef3513[_0xd0fe('0x35')]][_0xd0fe('0x14')]=utils[_0xd0fe('0x12')]();queues[_0xef3513[_0xd0fe('0x35')]][_0xd0fe('0x28')]=0x0;queues[_0xef3513[_0xd0fe('0x35')]][_0xd0fe('0x45')]=0x0;}else{queues[_0xef3513[_0xd0fe('0x3c')]]['transfereduniqueid']=_0xef3513[_0xd0fe('0x3d')];}}}else if(_0xef3513[_0xd0fe('0x46')]==_0xef3513['secondtransfererlinkedid']){if(!_[_0xd0fe('0x1d')](queues[_0xef3513[_0xd0fe('0x3c')]])){queues[_0xef3513[_0xd0fe('0x3c')]][_0xd0fe('0x32')]=!![];queues[_0xef3513['origtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0xef3513['origtransfererlinkedid']][_0xd0fe('0x38')]=_0xef3513['secondtransfererexten'];queues[_0xef3513[_0xd0fe('0x3c')]][_0xd0fe('0x3a')]=_0xef3513[_0xd0fe('0x46')];queues[_0xef3513[_0xd0fe('0x3c')]][_0xd0fe('0x19')]=_0xd0fe('0x47');}if(!_[_0xd0fe('0x1d')](queues[_0xef3513['secondtransfererlinkedid']])){if(_0xef3513[_0xd0fe('0x48')]&&queues[_0xef3513[_0xd0fe('0x48')]]){queues[_0xef3513[_0xd0fe('0x48')]][_0xd0fe('0x1b')]=0x1;queues[_0xef3513[_0xd0fe('0x42')]]=_[_0xd0fe('0x41')](queues[_0xef3513[_0xd0fe('0x48')]]);queues[_0xef3513[_0xd0fe('0x42')]][_0xd0fe('0xe')]=_0xef3513[_0xd0fe('0x42')];queues[_0xef3513[_0xd0fe('0x42')]][_0xd0fe('0x1b')]=0x2;queues[_0xef3513[_0xd0fe('0x42')]][_0xd0fe('0x43')]=queues[_0xef3513['origtransfererlinkedid']]['calleridnum'];queues[_0xef3513[_0xd0fe('0x42')]]['calleridname']=queues[_0xef3513['origtransfererlinkedid']][_0xd0fe('0x44')];queues[_0xef3513[_0xd0fe('0x42')]][_0xd0fe('0x29')]=utils[_0xd0fe('0x12')]();queues[_0xef3513[_0xd0fe('0x42')]][_0xd0fe('0x14')]=utils[_0xd0fe('0x12')]();queues[_0xef3513[_0xd0fe('0x42')]][_0xd0fe('0x28')]=0x0;queues[_0xef3513[_0xd0fe('0x42')]][_0xd0fe('0x45')]=0x0;}else{queues[_0xef3513['secondtransfererlinkedid']][_0xd0fe('0xe')]=_0xef3513[_0xd0fe('0x3c')];}}}}catch(_0x354db9){utils['error'](_0x354db9[_0xd0fe('0x49')]);}};exports[_0xd0fe('0x4a')]=function(_0x5bceb5){if(!_['isNil'](queues[_0x5bceb5[_0xd0fe('0x5')]])){queues[_0x5bceb5[_0xd0fe('0x5')]][_0xd0fe('0x4b')]=utils[_0xd0fe('0x12')]();}};exports[_0xd0fe('0x4c')]=function(_0x4ac325){if(!_[_0xd0fe('0x1d')](queues[_0x4ac325[_0xd0fe('0x5')]])){if(!_[_0xd0fe('0x1d')](queues[_0x4ac325[_0xd0fe('0x5')]][_0xd0fe('0x4b')])){queues[_0x4ac325[_0xd0fe('0x5')]][_0xd0fe('0x45')]+=utils[_0xd0fe('0x4d')](utils[_0xd0fe('0x12')](),queues[_0x4ac325[_0xd0fe('0x5')]][_0xd0fe('0x4b')]);delete queues[_0x4ac325[_0xd0fe('0x5')]]['musiconholdstartAt'];}}}; \ No newline at end of file +var _0x163d=['transfertargetlinkedid','queuecallerenterreason','clone','musiconholdstart','musiconholdstartAt','musiconholdstop','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','channel','queue','calleridnum','accountcode','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','uniqueid','assign','position','now','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallerexitreason','COMPLETEDBYAGENT','varset','variable','queuestatus','value','CONTINUE','queuecallerexitAt','queuecallerabandonAt','EXITWITHKEY','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode','membername','lastAssignedTo','queuecallercompleteAt','transfer','TRANSFER','reason','toUpperCase','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid'];(function(_0x5617e2,_0x1ffcd7){var _0x27b60d=function(_0xf3f7a2){while(--_0xf3f7a2){_0x5617e2['push'](_0x5617e2['shift']());}};_0x27b60d(++_0x1ffcd7);}(_0x163d,0xea));var _0xd163=function(_0x21cec0,_0x31be6c){_0x21cec0=_0x21cec0-0x0;var _0x1c1cf1=_0x163d[_0x21cec0];return _0x1c1cf1;};'use strict';var _=require('lodash');var util=require(_0xd163('0x0'));var utils=require(_0xd163('0x1'));var queues={};function writeDB(_0x106e00){utils[_0xd163('0x2')](util[_0xd163('0x3')](_0xd163('0x4'),_0x106e00['uniqueid'],_0x106e00[_0xd163('0x5')],_0x106e00[_0xd163('0x6')],_0x106e00['lastAssignedTo'],_0x106e00[_0xd163('0x7')],_0x106e00[_0xd163('0x8')],_0x106e00['queuecallerexitreason']));if(_0x106e00[_0xd163('0x6')]){utils['getVoiceQueueByName'](_0x106e00['queue'])[_0xd163('0x9')](function(_0x4e45fe){if(_0x4e45fe){_0x106e00[_0xd163('0xa')]=_0x4e45fe['type'];}utils[_0xd163('0xb')]('CreateVoiceQueueReport',_0x106e00);});}else{utils['request'](_0xd163('0xc'),_0x106e00);}if(_0x106e00[_0xd163('0xd')]){delete queues[_0x106e00[_0xd163('0xd')]];}else{delete queues[_0x106e00['uniqueid']];}}exports[_0xd163('0xe')]=function(_0x5529b4){queues[_0x5529b4[_0xd163('0xf')]]=_[_0xd163('0x10')](_0x5529b4,{'originalposition':_0x5529b4[_0xd163('0x11')],'queuecallerjoinAt':utils[_0xd163('0x12')](),'mohtime':0x0});};exports['hangup']=function(_0x9c48b6){if(!_[_0xd163('0x13')](queues[_0x9c48b6[_0xd163('0xf')]])){if(queues[_0x9c48b6[_0xd163('0xf')]][_0xd163('0x14')]){if(!queues[_0x9c48b6[_0xd163('0xf')]][_0xd163('0x15')]&&!queues[_0x9c48b6['uniqueid']][_0xd163('0x16')]){queues[_0x9c48b6[_0xd163('0xf')]][_0xd163('0x17')]=!![];queues[_0x9c48b6['uniqueid']]['queuecallercompleteAt']=utils[_0xd163('0x12')]();queues[_0x9c48b6[_0xd163('0xf')]][_0xd163('0x18')]=_0xd163('0x19');}writeDB(queues[_0x9c48b6[_0xd163('0xf')]]);}else{if(queues[_0x9c48b6['uniqueid']][_0xd163('0xd')]){queues[queues[_0x9c48b6[_0xd163('0xf')]][_0xd163('0xd')]]=queues[_0x9c48b6['uniqueid']];queues[queues[_0x9c48b6[_0xd163('0xf')]][_0xd163('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0x9c48b6[_0xd163('0xf')]];}}}};exports[_0xd163('0x1a')]=function(_0x320f50){if(!_[_0xd163('0x13')](_0x320f50[_0xd163('0x1b')][_0xd163('0x1c')])&&_0x320f50[_0xd163('0x1d')]['toUpperCase']()!==_0xd163('0x1e')){if(!_[_0xd163('0x13')](queues[_0x320f50['uniqueid']])){queues[_0x320f50[_0xd163('0xf')]][_0xd163('0x15')]=![];queues[_0x320f50[_0xd163('0xf')]]['queuecallerabandonAt']=null;queues[_0x320f50['uniqueid']][_0xd163('0x16')]=!![];queues[_0x320f50[_0xd163('0xf')]][_0xd163('0x1f')]=utils[_0xd163('0x12')]();queues[_0x320f50[_0xd163('0xf')]][_0xd163('0x18')]=_0x320f50[_0xd163('0x1d')]['toUpperCase']();writeDB(queues[_0x320f50[_0xd163('0xf')]]);}}else if(!_[_0xd163('0x13')](_0x320f50[_0xd163('0x1b')]['queueposition'])){if(!_[_0xd163('0x13')](queues[_0x320f50[_0xd163('0xf')]])&&!queues[_0x320f50[_0xd163('0xf')]][_0xd163('0x15')]){queues[_0x320f50[_0xd163('0xf')]]['queuecallerabandon']=![];queues[_0x320f50[_0xd163('0xf')]][_0xd163('0x20')]=null;queues[_0x320f50[_0xd163('0xf')]][_0xd163('0x16')]=!![];queues[_0x320f50[_0xd163('0xf')]][_0xd163('0x1f')]=utils[_0xd163('0x12')]();queues[_0x320f50[_0xd163('0xf')]][_0xd163('0x18')]=_0xd163('0x21');}}};exports[_0xd163('0x15')]=function(_0x3542fc){if(!_['isNil'](queues[_0x3542fc[_0xd163('0xf')]])){queues[_0x3542fc[_0xd163('0xf')]][_0xd163('0x16')]=![];queues[_0x3542fc[_0xd163('0xf')]][_0xd163('0x1f')]=null;queues[_0x3542fc['uniqueid']]['queuecallerabandon']=!![];queues[_0x3542fc[_0xd163('0xf')]][_0xd163('0x20')]=utils[_0xd163('0x12')]();queues[_0x3542fc[_0xd163('0xf')]][_0xd163('0x18')]='ABANDONED';}};exports[_0xd163('0x22')]=function(_0x30828e){if(!_[_0xd163('0x13')](queues[_0x30828e[_0xd163('0xf')]])){queues[_0x30828e[_0xd163('0xf')]]['queuecallerleave']=!![];queues[_0x30828e[_0xd163('0xf')]][_0xd163('0x14')]=utils[_0xd163('0x12')]();queues[_0x30828e['uniqueid']][_0xd163('0x23')]=utils[_0xd163('0x24')](queues[_0x30828e[_0xd163('0xf')]][_0xd163('0x14')],queues[_0x30828e[_0xd163('0xf')]][_0xd163('0x25')]);queues[_0x30828e['uniqueid']][_0xd163('0x11')]=_0x30828e[_0xd163('0x11')];queues[_0x30828e['uniqueid']]['count']=_0x30828e[_0xd163('0x26')];queues[_0x30828e[_0xd163('0xf')]][_0xd163('0x27')]=_0x30828e[_0xd163('0x27')];queues[_0x30828e[_0xd163('0xf')]][_0xd163('0x28')]=_0x30828e[_0xd163('0x28')];}};exports[_0xd163('0x29')]=function(_0x57d9e5){if(!_['isNil'](queues[_0x57d9e5['uniqueid']])){queues[_0x57d9e5[_0xd163('0xf')]][_0xd163('0x15')]=![];queues[_0x57d9e5[_0xd163('0xf')]][_0xd163('0x15')]=![];queues[_0x57d9e5[_0xd163('0xf')]][_0xd163('0x20')]=null;queues[_0x57d9e5[_0xd163('0xf')]][_0xd163('0x16')]=![];queues[_0x57d9e5['uniqueid']][_0xd163('0x18')]=null;queues[_0x57d9e5['uniqueid']][_0xd163('0x1f')]=null;queues[_0x57d9e5[_0xd163('0xf')]][_0xd163('0x2a')]=!![];queues[_0x57d9e5[_0xd163('0xf')]][_0xd163('0x8')]=_0x57d9e5[_0xd163('0x2b')];queues[_0x57d9e5[_0xd163('0xf')]]['lastAssignedTo']=_0x57d9e5[_0xd163('0x2c')];}};exports['agentcomplete']=function(_0x567bb0){if(!_[_0xd163('0x13')](queues[_0x567bb0[_0xd163('0xf')]])){if(queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x14')]){queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x15')]=![];queues[_0x567bb0['uniqueid']]['queuecallerabandon']=![];queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x20')]=null;queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x16')]=![];queues[_0x567bb0['uniqueid']][_0xd163('0x1f')]=null;queues[_0x567bb0['uniqueid']][_0xd163('0x2a')]=!![];queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x2d')]=_0x567bb0[_0xd163('0x2c')];queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x17')]=!![];queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x2e')]=utils[_0xd163('0x12')]();if(_0x567bb0['reason']=='transfer'){if(!queues[_0x567bb0['uniqueid']][_0xd163('0x2f')]){queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x18')]=_0xd163('0x30');}}else{queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x18')]='COMPLETEDBY'+_0x567bb0[_0xd163('0x31')][_0xd163('0x32')]();}writeDB(queues[_0x567bb0[_0xd163('0xf')]]);}}};exports[_0xd163('0x33')]=function(_0x123993){if(!_[_0xd163('0x13')](queues[_0x123993[_0xd163('0x34')]])){queues[_0x123993['transfereeuniqueid']][_0xd163('0x2f')]=!![];queues[_0x123993[_0xd163('0x34')]][_0xd163('0x35')]=_0xd163('0x36');queues[_0x123993[_0xd163('0x34')]][_0xd163('0x37')]=_0x123993[_0xd163('0x38')];queues[_0x123993[_0xd163('0x34')]][_0xd163('0x39')]=_0x123993[_0xd163('0x34')];queues[_0x123993[_0xd163('0x34')]][_0xd163('0x18')]=_0xd163('0x3a');}};exports[_0xd163('0x3b')]=function(_0x3005e0){try{if(_0x3005e0[_0xd163('0x3c')]==_0x3005e0[_0xd163('0x3d')]){if(!_[_0xd163('0x13')](queues[_0x3005e0[_0xd163('0x3e')]])){queues[_0x3005e0['secondtransfererlinkedid']][_0xd163('0x2f')]=!![];queues[_0x3005e0[_0xd163('0x3e')]][_0xd163('0x35')]=_0xd163('0x3f');queues[_0x3005e0[_0xd163('0x3e')]][_0xd163('0x37')]=_0x3005e0['origtransfererexten'];queues[_0x3005e0[_0xd163('0x3e')]][_0xd163('0x39')]=_0x3005e0['origtransfereruniqueid'];queues[_0x3005e0[_0xd163('0x3e')]][_0xd163('0x18')]=_0xd163('0x40');}if(!_[_0xd163('0x13')](queues[_0x3005e0[_0xd163('0x3d')]])){if(_0x3005e0['transfereelinkedid']&&queues[_0x3005e0[_0xd163('0x41')]]){queues[_0x3005e0['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x3005e0['transfereeuniqueid']]=_['clone'](queues[_0x3005e0['transfereelinkedid']]);queues[_0x3005e0[_0xd163('0x34')]][_0xd163('0xd')]=_0x3005e0[_0xd163('0x42')];queues[_0x3005e0['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x3005e0['transfereeuniqueid']][_0xd163('0x7')]=queues[_0x3005e0[_0xd163('0x3e')]][_0xd163('0x7')];queues[_0x3005e0[_0xd163('0x34')]][_0xd163('0x43')]=queues[_0x3005e0['secondtransfererlinkedid']][_0xd163('0x43')];queues[_0x3005e0['transfereeuniqueid']][_0xd163('0x25')]=utils[_0xd163('0x12')]();queues[_0x3005e0[_0xd163('0x34')]][_0xd163('0x14')]=utils['now']();queues[_0x3005e0[_0xd163('0x34')]]['holdtime']=0x0;queues[_0x3005e0[_0xd163('0x34')]][_0xd163('0x44')]=0x0;}else{queues[_0x3005e0[_0xd163('0x3d')]][_0xd163('0xd')]=_0x3005e0[_0xd163('0x3e')];}}}else if(_0x3005e0[_0xd163('0x45')]==_0x3005e0[_0xd163('0x3e')]){if(!_[_0xd163('0x13')](queues[_0x3005e0[_0xd163('0x3d')]])){queues[_0x3005e0[_0xd163('0x3d')]][_0xd163('0x2f')]=!![];queues[_0x3005e0[_0xd163('0x3d')]][_0xd163('0x35')]='ATTENDED';queues[_0x3005e0[_0xd163('0x3d')]]['transferexten']=_0x3005e0['secondtransfererexten'];queues[_0x3005e0[_0xd163('0x3d')]][_0xd163('0x39')]=_0x3005e0[_0xd163('0x45')];queues[_0x3005e0[_0xd163('0x3d')]][_0xd163('0x18')]=_0xd163('0x40');}if(!_['isNil'](queues[_0x3005e0[_0xd163('0x3e')]])){if(_0x3005e0[_0xd163('0x46')]&&queues[_0x3005e0[_0xd163('0x46')]]){queues[_0x3005e0[_0xd163('0x46')]][_0xd163('0x47')]=0x1;queues[_0x3005e0[_0xd163('0x42')]]=_[_0xd163('0x48')](queues[_0x3005e0[_0xd163('0x46')]]);queues[_0x3005e0[_0xd163('0x42')]][_0xd163('0xd')]=_0x3005e0[_0xd163('0x42')];queues[_0x3005e0[_0xd163('0x42')]][_0xd163('0x47')]=0x2;queues[_0x3005e0[_0xd163('0x42')]][_0xd163('0x7')]=queues[_0x3005e0[_0xd163('0x3d')]]['calleridnum'];queues[_0x3005e0[_0xd163('0x42')]][_0xd163('0x43')]=queues[_0x3005e0[_0xd163('0x3d')]][_0xd163('0x43')];queues[_0x3005e0[_0xd163('0x42')]][_0xd163('0x25')]=utils[_0xd163('0x12')]();queues[_0x3005e0[_0xd163('0x42')]][_0xd163('0x14')]=utils[_0xd163('0x12')]();queues[_0x3005e0[_0xd163('0x42')]][_0xd163('0x23')]=0x0;queues[_0x3005e0[_0xd163('0x42')]][_0xd163('0x44')]=0x0;}else{queues[_0x3005e0[_0xd163('0x3e')]]['transfereduniqueid']=_0x3005e0[_0xd163('0x3d')];}}}}catch(_0x1c6889){utils['error'](_0x1c6889['stack']);}};exports[_0xd163('0x49')]=function(_0x360b13){if(!_['isNil'](queues[_0x360b13[_0xd163('0xf')]])){queues[_0x360b13[_0xd163('0xf')]][_0xd163('0x4a')]=utils['now']();}};exports[_0xd163('0x4b')]=function(_0x3d4542){if(!_[_0xd163('0x13')](queues[_0x3d4542[_0xd163('0xf')]])){if(!_[_0xd163('0x13')](queues[_0x3d4542['uniqueid']][_0xd163('0x4a')])){queues[_0x3d4542[_0xd163('0xf')]][_0xd163('0x44')]+=utils[_0xd163('0x24')](utils[_0xd163('0x12')](),queues[_0x3d4542[_0xd163('0xf')]][_0xd163('0x4a')]);delete queues[_0x3d4542[_0xd163('0xf')]][_0xd163('0x4a')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index a98997e..57e54b7 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['application','set','appdata','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','uniqueid','accountcode','exten','context','channel','isNil','channelstate','linkedid','transfer','error','varset','variable','endsWith','.wav49','value','replace','.WAV','find','monitors','stack','hangup','calleridnum','calleridname','connectedlinename','outbound','connectedlinenum','forEach','clone','newexten'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x0a9e('0x0'));var utils=require(_0x0a9e('0x1'));var recordings={};function writeDB(_0x29929c){utils['debug'](_0x29929c);if(_0x29929c['accountcode']){utils[_0x0a9e('0x2')](_0x29929c['accountcode'])[_0x0a9e('0x3')](function(_0x432180){if(_0x432180){_0x29929c[_0x0a9e('0x4')]=_0x432180[_0x0a9e('0x5')];_0x29929c[_0x0a9e('0x6')]=_0x432180['id'];}utils['request'](_0x0a9e('0x7'),_0x29929c);});}else{utils[_0x0a9e('0x8')](_0x0a9e('0x7'),_0x29929c);}}exports['newchannel']=function(_0x503809){try{if(_0x503809[_0x0a9e('0x9')]==_0x503809['linkedid']){recordings[_0x503809['uniqueid']]={'uniqueid':_0x503809[_0x0a9e('0x9')],'accountcode':_0x503809[_0x0a9e('0xa')],'exten':_0x503809[_0x0a9e('0xb')],'context':_0x503809[_0x0a9e('0xc')],'channel':_0x503809[_0x0a9e('0xd')],'monitors':[]};}}catch(_0xbd1168){utils['error'](_0xbd1168['stack']);}};exports['newstate']=function(_0x4cfe67){try{if(!_[_0x0a9e('0xe')](recordings[_0x4cfe67[_0x0a9e('0x9')]])&&_0x4cfe67[_0x0a9e('0xf')]==0x6){}else if(!_[_0x0a9e('0xe')](recordings[_0x4cfe67[_0x0a9e('0x10')]])&&_0x4cfe67[_0x0a9e('0xf')]==0x6&&_0x4cfe67['context']!=_0x0a9e('0x11')){recordings[_0x4cfe67[_0x0a9e('0x10')]][_0x0a9e('0xa')]=_0x4cfe67[_0x0a9e('0xa')];}}catch(_0x44dcfd){utils[_0x0a9e('0x12')](_0x44dcfd['stack']);}};exports[_0x0a9e('0x13')]=function(_0x5d0880){try{if(!_[_0x0a9e('0xe')](_0x5d0880['variable'])&&!_[_0x0a9e('0xe')](_0x5d0880[_0x0a9e('0x14')]['mixmonitor_filename'])){if(_[_0x0a9e('0x15')](_0x5d0880['value'],_0x0a9e('0x16'))){_0x5d0880[_0x0a9e('0x17')]=_0x5d0880[_0x0a9e('0x17')][_0x0a9e('0x18')](_0x0a9e('0x16'),_0x0a9e('0x19'));}if(recordings[_0x5d0880[_0x0a9e('0x10')]]){var _0x20559e=_[_0x0a9e('0x1a')](recordings[_0x5d0880[_0x0a9e('0x10')]][_0x0a9e('0x1b')],{'value':_0x5d0880[_0x0a9e('0x17')]});if(_['isNil'](_0x20559e)){recordings[_0x5d0880[_0x0a9e('0x10')]][_0x0a9e('0x1b')]['push']({'value':_0x5d0880[_0x0a9e('0x17')]});}}}}catch(_0x5a09ef){utils['error'](_0x5a09ef[_0x0a9e('0x1c')]);}};exports[_0x0a9e('0x1d')]=function(_0x38e7c4){try{if(!_[_0x0a9e('0xe')](recordings[_0x38e7c4['uniqueid']])){recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1e')]=_0x38e7c4[_0x0a9e('0x1e')];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1f')]=_0x38e7c4[_0x0a9e('0x1f')];recordings[_0x38e7c4[_0x0a9e('0x9')]]['connectedlinenum']=_0x38e7c4['connectedlinenum'];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x20')]=_0x38e7c4[_0x0a9e('0x20')];if(recordings[_0x38e7c4[_0x0a9e('0x9')]]['type']==_0x0a9e('0x21')&&recordings[_0x38e7c4['uniqueid']][_0x0a9e('0xa')]){recordings[_0x38e7c4['uniqueid']][_0x0a9e('0x22')]=recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0xa')];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x20')]='';}recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1b')][_0x0a9e('0x23')](_0x5a101a=>{var _0x3652a7=_[_0x0a9e('0x24')](recordings[_0x38e7c4[_0x0a9e('0x9')]]);_0x3652a7[_0x0a9e('0x17')]=_0x5a101a['value'];writeDB(_0x3652a7);});delete recordings[_0x38e7c4[_0x0a9e('0x9')]];}}catch(_0x40e7a3){utils[_0x0a9e('0x12')](_0x40e7a3[_0x0a9e('0x1c')]);}};exports[_0x0a9e('0x25')]=function(_0x563b45){try{if(!_[_0x0a9e('0xe')](recordings[_0x563b45[_0x0a9e('0x9')]])){if(_0x563b45[_0x0a9e('0x26')]['toLowerCase']()==_0x0a9e('0x27')&&_['startsWith'](_0x563b45[_0x0a9e('0x28')][_0x0a9e('0x29')](),_0x0a9e('0x2a'))){var _0x33bdb7=_0x563b45[_0x0a9e('0x28')]['split']('=');var _0x66c1d2=_0x33bdb7[0x0][_0x0a9e('0x2b')](_0x33bdb7[0x0][_0x0a9e('0x2c')]('(')+0x1,_0x33bdb7[0x0][_0x0a9e('0x2c')](')'));var _0x2b45ea=_0x33bdb7[0x1];recordings[_0x563b45[_0x0a9e('0x9')]][_0x66c1d2]=_0x2b45ea;}}}catch(_0x332d35){utils[_0x0a9e('0x12')](_0x332d35['stack']);}};exports[_0x0a9e('0x2d')]=function(_0x5e7238){try{if(!_[_0x0a9e('0xe')](recordings[_0x5e7238[_0x0a9e('0x9')]])){recordings[_0x5e7238[_0x0a9e('0x9')]][_0x0a9e('0x2e')]=_0x5e7238['queue'];}}catch(_0x191e91){utils[_0x0a9e('0x12')](_0x191e91[_0x0a9e('0x1c')]);}}; \ No newline at end of file +var _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(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x34e8,0x12c));var _0x834e=function(_0x53ddfa,_0x7048){_0x53ddfa=_0x53ddfa-0x0;var _0x175052=_0x34e8[_0x53ddfa];return _0x175052;};'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 01b8589..f3baea5 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 _0x3a0f=['transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','./utils','format','TRANSFER|%s','type','request','CreateVoiceTransferReport','blindtransfer','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel'];(function(_0x49d2db,_0x5382bb){var _0x4fa207=function(_0x4c0a0f){while(--_0x4c0a0f){_0x49d2db['push'](_0x49d2db['shift']());}};_0x4fa207(++_0x5382bb);}(_0x3a0f,0x145));var _0xf3a0=function(_0x517828,_0x520be4){_0x517828=_0x517828-0x0;var _0x53d571=_0x3a0f[_0x517828];return _0x53d571;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xf3a0('0x0'));function writeDB(_0x52e528){utils['info'](util[_0xf3a0('0x1')](_0xf3a0('0x2'),_0x52e528[_0xf3a0('0x3')]));utils[_0xf3a0('0x4')](_0xf3a0('0x5'),_0x52e528);}exports[_0xf3a0('0x6')]=function(_0x5fc36e){try{_0x5fc36e[_0xf3a0('0x3')]='blind';writeDB(_0x5fc36e);}catch(_0x4736b7){utils[_0xf3a0('0x7')](_0x4736b7[_0xf3a0('0x8')]);}};exports[_0xf3a0('0x9')]=function(_0x5d64bc){try{_0x5d64bc=_[_0xf3a0('0xa')](_0x5d64bc,{'transfererchannel':_0x5d64bc[_0xf3a0('0xb')],'transferercalleridnum':_0x5d64bc[_0xf3a0('0xc')],'transferercalleridname':_0x5d64bc[_0xf3a0('0xd')],'transfererconnectedlinenum':_0x5d64bc[_0xf3a0('0xe')],'transfererconnectedlinename':_0x5d64bc[_0xf3a0('0xf')],'transfereraccountcode':_0x5d64bc[_0xf3a0('0x10')],'transferercontext':_0x5d64bc[_0xf3a0('0x11')],'transfererexten':_0x5d64bc['secondtransfererexten'],'transfererlinkedid':_0x5d64bc[_0xf3a0('0x12')],'context':_0x5d64bc[_0xf3a0('0x13')],'extension':_0x5d64bc[_0xf3a0('0x14')],'type':'attended'});if(_[_0xf3a0('0x15')](_0x5d64bc[_0xf3a0('0x16')])){_0x5d64bc=_[_0xf3a0('0xa')](_0x5d64bc,{'transfereechannel':_0x5d64bc['transfertargetchannel'],'transfereecalleridnum':_0x5d64bc['transfertargetcalleridnum'],'transfereecalleridname':_0x5d64bc[_0xf3a0('0x17')],'transfereeconnectedlinenum':_0x5d64bc[_0xf3a0('0x18')],'transfereeconnectedlinename':_0x5d64bc[_0xf3a0('0x19')],'transfereeaccountcode':_0x5d64bc[_0xf3a0('0x1a')],'transfereecontext':_0x5d64bc['transfertargetcontext'],'transfereeexten':_0x5d64bc[_0xf3a0('0x1b')],'transfereelinkedid':_0x5d64bc[_0xf3a0('0x1c')]});}writeDB(_0x5d64bc);}catch(_0x34ec7c){utils[_0xf3a0('0x7')](_0x34ec7c[_0xf3a0('0x8')]);}}; \ No newline at end of file +var _0x4be6=['transfertargetlinkedid','util','./utils','info','format','TRANSFER|%s','type','request','CreateVoiceTransferReport','blindtransfer','blind','stack','attendedtransfer','assign','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4be6,0xb5));var _0x64be=function(_0x302099,_0xe61dca){_0x302099=_0x302099-0x0;var _0x24a042=_0x4be6[_0x302099];return _0x24a042;};'use strict';var _=require('lodash');var util=require(_0x64be('0x0'));var utils=require(_0x64be('0x1'));function writeDB(_0x22ef48){utils[_0x64be('0x2')](util[_0x64be('0x3')](_0x64be('0x4'),_0x22ef48[_0x64be('0x5')]));utils[_0x64be('0x6')](_0x64be('0x7'),_0x22ef48);}exports[_0x64be('0x8')]=function(_0x56f0c3){try{_0x56f0c3[_0x64be('0x5')]=_0x64be('0x9');writeDB(_0x56f0c3);}catch(_0x3e8639){utils['error'](_0x3e8639[_0x64be('0xa')]);}};exports[_0x64be('0xb')]=function(_0x50d57f){try{_0x50d57f=_[_0x64be('0xc')](_0x50d57f,{'transfererchannel':_0x50d57f['origtransfererchannel'],'transferercalleridnum':_0x50d57f[_0x64be('0xd')],'transferercalleridname':_0x50d57f[_0x64be('0xe')],'transfererconnectedlinenum':_0x50d57f['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x50d57f[_0x64be('0xf')],'transfereraccountcode':_0x50d57f[_0x64be('0x10')],'transferercontext':_0x50d57f[_0x64be('0x11')],'transfererexten':_0x50d57f[_0x64be('0x12')],'transfererlinkedid':_0x50d57f['origtransfererlinkedid'],'context':_0x50d57f[_0x64be('0x13')],'extension':_0x50d57f['origtransfererexten'],'type':_0x64be('0x14')});if(_[_0x64be('0x15')](_0x50d57f[_0x64be('0x16')])){_0x50d57f=_[_0x64be('0xc')](_0x50d57f,{'transfereechannel':_0x50d57f[_0x64be('0x17')],'transfereecalleridnum':_0x50d57f['transfertargetcalleridnum'],'transfereecalleridname':_0x50d57f[_0x64be('0x18')],'transfereeconnectedlinenum':_0x50d57f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x50d57f[_0x64be('0x19')],'transfereeaccountcode':_0x50d57f[_0x64be('0x1a')],'transfereecontext':_0x50d57f[_0x64be('0x1b')],'transfereeexten':_0x50d57f[_0x64be('0x1c')],'transfereelinkedid':_0x50d57f[_0x64be('0x1d')]});}writeDB(_0x50d57f);}catch(_0x507bca){utils['error'](_0x507bca[_0x64be('0xa')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 81e54fb..3638f2f 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 _0x5f47=['bluebird','client','../../config/logger','info','debug','stringify','error','request','then','stack','GetUser','internal','name','interface','GETUSER|','result','length','FOUND','NOTFOUND','getUserByInternal','catch','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','GETVOICEQUEUEBYNAME|','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment'];(function(_0x5b816b,_0x269404){var _0x3363f8=function(_0x2c121f){while(--_0x2c121f){_0x5b816b['push'](_0x5b816b['shift']());}};_0x3363f8(++_0x269404);}(_0x5f47,0x146));var _0x75f4=function(_0x53b243,_0x13e5a6){_0x53b243=_0x53b243-0x0;var _0x502dfd=_0x5f47[_0x53b243];return _0x502dfd;};'use strict';var jayson=require(_0x75f4('0x0'));var moment=require(_0x75f4('0x1'));var BPromise=require(_0x75f4('0x2'));var client=jayson[_0x75f4('0x3')]['http']({'port':0x2329});var logger=require(_0x75f4('0x4'))('xdr');exports[_0x75f4('0x5')]=function(_0xc98c54){logger[_0x75f4('0x5')](_0xc98c54);};exports[_0x75f4('0x6')]=function(_0x141931){logger[_0x75f4('0x6')](JSON[_0x75f4('0x7')](_0x141931));};exports[_0x75f4('0x8')]=function(_0x21328b){logger[_0x75f4('0x8')](_0x21328b['stack']);};exports['request']=function(_0x36ab98,_0x3737a6){return client[_0x75f4('0x9')](_0x36ab98,{'body':_0x3737a6})[_0x75f4('0xa')](function(_0x95222a){logger[_0x75f4('0x6')](JSON[_0x75f4('0x7')](_0x95222a));})['catch'](function(_0x3285c6){logger[_0x75f4('0x8')](_0x3285c6[_0x75f4('0xb')]);});};function getUser(_0x1037d1){return client['request'](_0x75f4('0xc'),{'options':{'raw':!![],'attributes':['id',_0x75f4('0xd'),_0x75f4('0xe'),_0x75f4('0xf')],'where':_0x1037d1,'limit':0x1}})['then'](function(_0x9f99a2){logger['info'](_0x75f4('0x10')+JSON[_0x75f4('0x7')](_0x1037d1)+'|'+(_0x9f99a2[_0x75f4('0x11')][_0x75f4('0x12')]?_0x75f4('0x13'):_0x75f4('0x14')));return _0x9f99a2[_0x75f4('0x11')][_0x75f4('0x12')]?_0x9f99a2[_0x75f4('0x11')][0x0]:null;});}exports[_0x75f4('0x15')]=function(_0x34c5c2){return new BPromise(function(_0x1f84ba,_0x109bdb){if(_0x34c5c2){return getUser({'internal':_0x34c5c2})[_0x75f4('0xa')](function(_0x385508){return _0x1f84ba(_0x385508);})['catch'](function(_0x170e8e){logger[_0x75f4('0x8')](_0x170e8e[_0x75f4('0xb')]);return _0x1f84ba(null);});}else{return _0x1f84ba(null);}});};exports['getUserByInterface']=function(_0x4982a7){return new BPromise(function(_0x14b354,_0x28af6e){if(_0x4982a7){return getUser({'interface':_0x4982a7})[_0x75f4('0xa')](function(_0x4fe624){return _0x14b354(_0x4fe624);})[_0x75f4('0x16')](function(_0xece96f){logger[_0x75f4('0x8')](_0xece96f['stack']);return _0x14b354(null);});}else{return _0x14b354(null);}});};exports[_0x75f4('0x17')]=function(_0x101308){return new BPromise(function(_0x55bccc,_0x167920){if(_0x101308){return getUser({'name':_0x101308})[_0x75f4('0xa')](function(_0x116dd1){return _0x55bccc(_0x116dd1);})[_0x75f4('0x16')](function(_0x65386){logger[_0x75f4('0x8')](_0x65386[_0x75f4('0xb')]);return _0x55bccc(null);});}else{return _0x55bccc(null);}});};exports[_0x75f4('0x18')]=function(_0x52ad02){return new BPromise(function(_0x59e4d1,_0x5b1fc8){if(_0x52ad02){return client[_0x75f4('0x9')](_0x75f4('0x19'),{'options':{'raw':!![],'attributes':['id',_0x75f4('0xe'),_0x75f4('0x1a'),'acw',_0x75f4('0x1b')],'where':{'name':_0x52ad02},'limit':0x1}})[_0x75f4('0xa')](function(_0x44548c){logger[_0x75f4('0x5')](_0x75f4('0x1c')+_0x52ad02+'|'+(_0x44548c[_0x75f4('0x11')][_0x75f4('0x12')]?_0x75f4('0x13'):_0x75f4('0x14')));return _0x59e4d1(_0x44548c[_0x75f4('0x11')][_0x75f4('0x12')]?_0x44548c[_0x75f4('0x11')][0x0]:null);})['catch'](function(_0x50bdd5){logger[_0x75f4('0x8')](_0x50bdd5[_0x75f4('0xb')]);return _0x59e4d1(null);});}else{return _0x59e4d1(null);}});};exports['addTime']=function(_0x160d28,_0x45d8f9){return moment(_0x160d28)[_0x75f4('0x1d')](_0x45d8f9,_0x75f4('0x1e'))[_0x75f4('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x75f4('0x20')]=function(_0x22fcfc,_0x5b46be){return moment(_0x22fcfc)[_0x75f4('0x21')](_0x5b46be,'seconds')[_0x75f4('0x1f')](_0x75f4('0x22'));};exports[_0x75f4('0x23')]=function(_0x5d45a6,_0x210c58){return moment(_0x5d45a6)[_0x75f4('0x24')](moment(_0x210c58),_0x75f4('0x1e'));};exports[_0x75f4('0x25')]=function(_0x1a1559,_0x5477ba){return parseInt(_0x1a1559,0xa)+parseInt(_0x5477ba,0xa);};exports[_0x75f4('0x26')]=function(){return moment()[_0x75f4('0x1f')](_0x75f4('0x22'));};exports[_0x75f4('0x27')]=function(_0x355ad0,_0x589877){if(_0x589877){return moment(_0x355ad0)[_0x75f4('0x27')](_0x589877);}else{return!![];}};exports[_0x75f4('0x28')]=function(_0x474ac9,_0x438d71){if(_0x438d71){return moment(_0x474ac9)[_0x75f4('0x28')](_0x438d71);}else if(_0x474ac9){return!![];}else{return![];}}; \ No newline at end of file +var _0xd840=['catch','internal','name','interface','then','GETUSER|','stringify','length','FOUND','NOTFOUND','result','getUserByInternal','getUserByInterface','getUserByName','GetVoiceQueue','type','acw','GETVOICEQUEUEBYNAME|','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diff','sumTime','isAfter','isBefore','moment','bluebird','client','http','../../config/logger','info','debug','error','stack','request'];(function(_0x49933b,_0xf55e90){var _0xe9b5c0=function(_0x389ef3){while(--_0x389ef3){_0x49933b['push'](_0x49933b['shift']());}};_0xe9b5c0(++_0xf55e90);}(_0xd840,0x1be));var _0x0d84=function(_0x5a09db,_0x41a70c){_0x5a09db=_0x5a09db-0x0;var _0x3f722a=_0xd840[_0x5a09db];return _0x3f722a;};'use strict';var jayson=require('jayson/promise');var moment=require(_0x0d84('0x0'));var BPromise=require(_0x0d84('0x1'));var client=jayson[_0x0d84('0x2')][_0x0d84('0x3')]({'port':0x2329});var logger=require(_0x0d84('0x4'))('xdr');exports[_0x0d84('0x5')]=function(_0x1ce2f4){logger['info'](_0x1ce2f4);};exports['debug']=function(_0x54484f){logger[_0x0d84('0x6')](JSON['stringify'](_0x54484f));};exports[_0x0d84('0x7')]=function(_0x36bc7e){logger[_0x0d84('0x7')](_0x36bc7e[_0x0d84('0x8')]);};exports[_0x0d84('0x9')]=function(_0x4afede,_0x4bbd86){return client[_0x0d84('0x9')](_0x4afede,{'body':_0x4bbd86})['then'](function(_0x5674b0){logger[_0x0d84('0x6')](JSON['stringify'](_0x5674b0));})[_0x0d84('0xa')](function(_0x2e2474){logger[_0x0d84('0x7')](_0x2e2474['stack']);});};function getUser(_0x17e946){return client[_0x0d84('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x0d84('0xb'),_0x0d84('0xc'),_0x0d84('0xd')],'where':_0x17e946,'limit':0x1}})[_0x0d84('0xe')](function(_0x323a22){logger[_0x0d84('0x5')](_0x0d84('0xf')+JSON[_0x0d84('0x10')](_0x17e946)+'|'+(_0x323a22['result'][_0x0d84('0x11')]?_0x0d84('0x12'):_0x0d84('0x13')));return _0x323a22[_0x0d84('0x14')]['length']?_0x323a22[_0x0d84('0x14')][0x0]:null;});}exports[_0x0d84('0x15')]=function(_0x348511){return new BPromise(function(_0x38f2d7,_0x263886){if(_0x348511){return getUser({'internal':_0x348511})[_0x0d84('0xe')](function(_0x20294f){return _0x38f2d7(_0x20294f);})['catch'](function(_0x3d6c2a){logger['error'](_0x3d6c2a['stack']);return _0x38f2d7(null);});}else{return _0x38f2d7(null);}});};exports[_0x0d84('0x16')]=function(_0x5e3957){return new BPromise(function(_0x186b36,_0x235afb){if(_0x5e3957){return getUser({'interface':_0x5e3957})['then'](function(_0x11789e){return _0x186b36(_0x11789e);})[_0x0d84('0xa')](function(_0x2e7956){logger[_0x0d84('0x7')](_0x2e7956[_0x0d84('0x8')]);return _0x186b36(null);});}else{return _0x186b36(null);}});};exports[_0x0d84('0x17')]=function(_0x51068c){return new BPromise(function(_0x12edcb,_0x1c02c1){if(_0x51068c){return getUser({'name':_0x51068c})[_0x0d84('0xe')](function(_0x999c9c){return _0x12edcb(_0x999c9c);})[_0x0d84('0xa')](function(_0x1e323c){logger[_0x0d84('0x7')](_0x1e323c['stack']);return _0x12edcb(null);});}else{return _0x12edcb(null);}});};exports['getVoiceQueueByName']=function(_0x18644a){return new BPromise(function(_0x1141d8,_0x3c2a82){if(_0x18644a){return client['request'](_0x0d84('0x18'),{'options':{'raw':!![],'attributes':['id',_0x0d84('0xc'),_0x0d84('0x19'),_0x0d84('0x1a'),'acwTimeout'],'where':{'name':_0x18644a},'limit':0x1}})['then'](function(_0x305ecb){logger[_0x0d84('0x5')](_0x0d84('0x1b')+_0x18644a+'|'+(_0x305ecb['result']['length']?_0x0d84('0x12'):_0x0d84('0x13')));return _0x1141d8(_0x305ecb[_0x0d84('0x14')][_0x0d84('0x11')]?_0x305ecb[_0x0d84('0x14')][0x0]:null);})[_0x0d84('0xa')](function(_0x491c6c){logger[_0x0d84('0x7')](_0x491c6c[_0x0d84('0x8')]);return _0x1141d8(null);});}else{return _0x1141d8(null);}});};exports['addTime']=function(_0x3e6625,_0x5a6274){return moment(_0x3e6625)[_0x0d84('0x1c')](_0x5a6274,'seconds')[_0x0d84('0x1d')](_0x0d84('0x1e'));};exports[_0x0d84('0x1f')]=function(_0x5e9316,_0x425da6){return moment(_0x5e9316)[_0x0d84('0x20')](_0x425da6,_0x0d84('0x21'))[_0x0d84('0x1d')](_0x0d84('0x1e'));};exports['diffTime']=function(_0xc1ff69,_0x44e08b){return moment(_0xc1ff69)[_0x0d84('0x22')](moment(_0x44e08b),'seconds');};exports[_0x0d84('0x23')]=function(_0x32f52a,_0x5e30d2){return parseInt(_0x32f52a,0xa)+parseInt(_0x5e30d2,0xa);};exports['now']=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x0d84('0x24')]=function(_0x566595,_0x79b554){if(_0x79b554){return moment(_0x566595)[_0x0d84('0x24')](_0x79b554);}else{return!![];}};exports[_0x0d84('0x25')]=function(_0x5d324f,_0x540372){if(_0x540372){return moment(_0x5d324f)[_0x0d84('0x25')](_0x540372);}else if(_0x5d324f){return!![];}else{return![];}}; \ No newline at end of file